diff --git a/package.json b/package.json index 4526435..35770ee 100644 --- a/package.json +++ b/package.json @@ -1,24 +1,25 @@ { "name": "cyberball-osu", - "version": "3.2.0", + "version": "3.3.0", "description": "A clone of Empirisoft's Cyberball: Cyberball is a virtual ball-toss game that can be used for research on ostracism, social exclusion, or rejection. It has also been used to study discrimination and prejudice (in these instances, Cyberball ball toss choices are used as Dependent Variable).", "license": "MIT", "dependencies": { "@types/clipboard": "^2.0.7", "aurelia-animator-css": "^1.0.4", - "aurelia-bootstrapper": "^2.3.2", - "clipboard": "^2.0.10", - "phaser": "^3.55.2" + "aurelia-bootstrapper": "^2.4.0", + "clipboard": "^2.0.11", + "phaser": "^3.60.0" }, "devDependencies": { - "@types/jasmine": "^3.10.3", - "@types/lz-string": "^1.3.34", - "@types/node": "^17.0.21", - "aurelia-cli": "^2.0.3", - "aurelia-testing": "^1.0.0", + "@types/jasmine": "^4.3.1", + "@types/lz-string": "^1.5.0", + "@types/node": "^18.15.11", + "aurelia-cli": "^3.0.1", + "aurelia-testing": "^1.1.0", "aurelia-tools": "^2.0.0", - "browser-sync": "^2.27.7", - "connect-history-api-fallback": "^1.6.0", + "browser-sync": "^2.29.1", + "connect-history-api-fallback": "^2.0.0", + "cross-env": "^7.0.3", "debounce": "^1.2.1", "gulp": "^4.0.0", "gulp-notify": "^4.0.0", @@ -27,25 +28,26 @@ "gulp-tslint": "^8.1.4", "gulp-typescript": "^6.0.0-alpha.1", "gulp-watch": "^5.0.1", - "jasmine-core": "^4.0.1", - "karma": "^6.3.17", - "karma-chrome-launcher": "^3.1.0", - "karma-jasmine": "^4.0.1", - "karma-sourcemap-loader": "^0.3.8", + "jasmine-core": "^4.6.0", + "karma": "^6.4.1", + "karma-chrome-launcher": "^3.1.1", + "karma-jasmine": "^5.1.0", + "karma-sourcemap-loader": "^0.4.0", "karma-typescript-preprocessor": "^0.4.0", - "minimatch": "^5.0.1", - "promise-polyfill": "^8.2.1", + "minimatch": "^9.0.0", + "promise-polyfill": "^8.3.0", "requirejs": "^2.3.6", + "source-map": "^0.7.4", "text": "requirejs/text#latest", "through2": "^4.0.2", "tslint": "^6.1.3", - "typescript": "^4.6.2", + "typescript": "^5.0.4", "vinyl-fs": "^3.0.3" }, "scripts": { - "build": "au build", - "start": "au run", - "test": "au test" + "build": "cross-env NODE_OPTIONS=--no-experimental-fetch au build", + "start": "cross-env NODE_OPTIONS=--no-experimental-fetch au run", + "test": "cross-env NODE_OPTIONS=--no-experimental-fetch au test" }, "engines": { "node": ">=8.9.0" diff --git a/scripts/app-bundle.js b/scripts/app-bundle.js index 45df514..739d60b 100644 --- a/scripts/app-bundle.js +++ b/scripts/app-bundle.js @@ -358,7 +358,7 @@ define('pages/home',["require", "exports", "aurelia-templating-resources", "aure Object.defineProperty(exports, "__esModule", { value: true }); exports.HomeViewModel = void 0; clipboard_1 = __importDefault(clipboard_1); - var HomeViewModel = (function () { + var HomeViewModel = exports.HomeViewModel = (function () { function HomeViewModel(signaler) { this.signaler = signaler; this.settings = settings_model_1.defaultSettings; @@ -407,10 +407,9 @@ define('pages/home',["require", "exports", "aurelia-templating-resources", "aure ], HomeViewModel); return HomeViewModel; }()); - exports.HomeViewModel = HomeViewModel; }); ; -define('text!pages/home.html',[],function(){return "\n";});; +define('text!pages/home.html',[],function(){return "\r\n";});; var __decorate = (this && this.__decorate) || function (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); @@ -424,7 +423,7 @@ define('pages/message-test',["require", "exports", "aurelia-templating-resources "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MessageTestViewModel = void 0; - var MessageTestViewModel = (function () { + var MessageTestViewModel = exports.MessageTestViewModel = (function () { function MessageTestViewModel(signaler) { this.signaler = signaler; this.messages = []; @@ -443,7 +442,6 @@ define('pages/message-test',["require", "exports", "aurelia-templating-resources ], MessageTestViewModel); return MessageTestViewModel; }()); - exports.MessageTestViewModel = MessageTestViewModel; }); ; define('text!pages/message-test.html',[],function(){return "\n";});; @@ -474,7 +472,7 @@ define('resources/phaser-game/phaser-game',["require", "exports", "aurelia-frame Object.defineProperty(exports, "__esModule", { value: true }); exports.PhaserGameCustomElement = void 0; phaser_1 = __importDefault(phaser_1); - var PhaserGameCustomElement = (function () { + var PhaserGameCustomElement = exports.PhaserGameCustomElement = (function () { function PhaserGameCustomElement(element) { this.element = element; } @@ -498,7 +496,6 @@ define('resources/phaser-game/phaser-game',["require", "exports", "aurelia-frame ], PhaserGameCustomElement); return PhaserGameCustomElement; }()); - exports.PhaserGameCustomElement = PhaserGameCustomElement; }); ; define('resources/value-converters/flag-value-converter',["require", "exports"], function (require, exports) { @@ -641,10 +638,10 @@ define('scenes/cyberball',["require", "exports", "enums/leave-trigger", "phaser" this.load.image('ball', "".concat(this.settings.baseUrl, "/").concat(this.settings.ballSprite)); this.load.multiatlas('player', "".concat(this.settings.baseUrl, "/player.json"), 'assets'); if (this.settings.player.portrait) - this.load.image('playerPortrait', 'https://cors-anywhere.herokuapp.com/' + this.settings.player.portrait); + this.load.image('playerPortrait', 'https://proxy.cors.sh/' + this.settings.player.portrait); this.settings.computerPlayers.forEach(function (cpu, i) { if (cpu.portrait) - _this.load.image('cpuPortrait' + i, 'https://cors-anywhere.herokuapp.com/' + cpu.portrait); + _this.load.image('cpuPortrait' + i, 'https://proxy.cors.sh/' + cpu.portrait); }); }; CyberballScene.prototype.create = function () { @@ -793,7 +790,10 @@ define('scenes/cyberball',["require", "exports", "enums/leave-trigger", "phaser" this.gameEnded = true; this.postEvent('game-end'); clearTimeout(this.activeTimeout); - this.playerGroup.children.each(function (child) { return child.removeAllListeners(); }); + this.playerGroup.children.iterate(function (child) { + child.removeAllListeners(); + return true; + }); this.add.rectangle(this.sys.canvas.width / 2, this.sys.canvas.height / 2, this.sys.canvas.width, this.sys.canvas.height, 0xdddddd, this.settings.gameOverOpacity); this.add.text(this.sys.canvas.width / 2, this.sys.canvas.height / 2, this.settings.gameOverText, textStyle).setOrigin(0.5); }; diff --git a/scripts/app-bundle.js.map b/scripts/app-bundle.js.map index 8738166..6a794b7 100644 --- a/scripts/app-bundle.js.map +++ b/scripts/app-bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/app.ts","../src/app.html","../src/behaviors/get-variant-value.ts","../src/enums/leave-trigger.ts","../src/environment.ts","../src/helpers.ts","../src/main.ts","../src/models/banter-model.ts","../src/models/cpu-model.ts","../src/models/cpu-settings-model.ts","../src/models/player-model.ts","../src/models/player-settings-model.ts","../src/models/settings-model.ts","../src/pages/game.ts","../src/pages/game.css","../src/pages/game.html","../src/pages/home.ts","../src/pages/home.html","../src/pages/message-test.ts","../src/pages/message-test.html","../src/resources/index.ts","../src/resources/phaser-game/phaser-game.ts","../src/resources/value-converters/flag-value-converter.ts","../src/resources/value-converters/integer-array-value-converter.ts","../src/resources/value-converters/integer-value-converter.ts","../src/resources/value-converters/json-value-converter.ts","../src/resources/value-converters/number-value-converter.ts","../src/scenes/cyberball.ts"],"names":[],"mappings":";;;;IAEA;QAAA;QAcA,CAAC;QAXG,6BAAe,GAAf,UAAgB,MAA2B,EAAE,MAAc;YACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YAErB,MAAM,CAAC,KAAK,GAAG,WAAW,CAAC;YAE3B,MAAM,CAAC,GAAG,CAAC;gBACP,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE;gBAC7D,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE;gBACvD,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,oBAAoB,EAAE;aAClF,CAAC,CAAC;QACP,CAAC;QACL,UAAC;IAAD,CAdA,AAcC,IAAA;IAdY,kBAAG;;;ACFhB;;;;;ICAA,SAAgB,eAAe,CAAC,IAAY,EAAE,QAAgB;QAC1D,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAClF,CAAC;IAFD,0CAEC;;;;;;;ICFD,IAAY,YAOX;IAPD,WAAY,YAAY;QACpB,+CAAQ,CAAA;QACR,+CAAQ,CAAA;QACR,+CAAa,CAAA;QACb,qDAAgB,CAAA;QAChB,6DAAoB,CAAA;QACpB,8DAAoB,CAAA;IACxB,CAAC,EAPW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAOvB;;;;;;ICPD,kBAAe;QACb,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,IAAI;KACd,CAAC;;;;;;;ICHF,SAAgB,qBAAqB,CAAC,MAAiC;QACnE,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;IACzE,CAAC;IAFD,sDAEC;IAED,SAAgB,qBAAqB,CAAC,MAAiC;QACnE,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;IACzE,CAAC;IAFD,sDAEC;;;;;;;;;;;ICHD,SAAgB,SAAS,CAAC,OAAgB;QACxC,OAAO,CAAC,GAAG;aACR,qBAAqB,EAAE;aACvB,OAAO,CAAC,WAAW,CAAC,CAAC;QAExB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,qBAAW,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAErE,IAAI,qBAAW,CAAC,OAAO,EAAE;YACvB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;SACvC;QAED,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,cAAM,OAAA,OAAO,CAAC,OAAO,EAAE,EAAjB,CAAiB,CAAC,CAAC;IAChD,CAAC;IAZD,8BAYC;;;;;;;ICfD;QAAA;QAKA,CAAC;QAAD,kBAAC;IAAD,CALA,AAKC,IAAA;IALY,kCAAW;;;;;;;;;;;;;;;;;;;;;;ICKxB;QAAyB,uBAAM;QAG3B,aAAY,QAA0B,EAAE,aAA6B;mBACjE,kBAAM,QAAQ,EAAE,aAAa,CAAC;QAClC,CAAC;QACL,UAAC;IAAD,CANA,AAMC,CANwB,qBAAM,GAM9B;IANY,kBAAG;;;;;;;;;;;;;;;;;;;;;;ICFhB;QAAsC,oCAAmB;QAwBrD,0BAAY,IAAgC;YAA5C,YACI,iBAAO,SAIV;YA3BD,sBAAgB,GAAkB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAE3C,gBAAU,GAAW,GAAG,CAAC;YACzB,wBAAkB,GAAW,GAAG,CAAC;YAEjC,gBAAU,GAAW,GAAG,CAAC;YACzB,wBAAkB,GAAW,GAAG,CAAC;YAUjC,qBAAe,GAAY,GAAG,CAAC;YAC/B,qBAAe,GAAY,GAAG,CAAC;YAC/B,wBAAkB,GAAY,GAAG,CAAC;YAClC,4BAAsB,GAAY,GAAG,CAAC;YACtC,4BAAsB,GAAY,EAAE,CAAC;YAKjC,IAAG,IAAI;gBACH,MAAM,CAAC,MAAM,CAAC,KAAI,EAAE,IAAI,CAAC,CAAC;;QAClC,CAAC;QACL,uBAAC;IAAD,CA9BA,AA8BC,CA9BqC,2CAAmB,GA8BxD;IA9BY,4CAAgB;;;;;;;ICG7B;QAeI,gBAAY,QAA6B,EAAE,aAA6B;YAVjE,YAAO,GAAY,KAAK,CAAC;YAW5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACvC,CAAC;QAEM,uBAAM,GAAb;YAGI,IAAI,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAElC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;YAG5F,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;YAElF,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI;gBAClB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YAEvE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CACvC,QAAQ,CAAC,CAAC,EACV,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,EACxC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAClB,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAC5C,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAEjB,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;gBACxB,IAAI,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBAElD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;aAC1G;YAID,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI,EAAE;gBACxE,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAA,mCAAe,EAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;aAC3H;YAED,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW,EAAE;gBACtF,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAA,mCAAe,EAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC;aAC/I;QACL,CAAC;QAGS,4BAAW,GAArB;YACI,IAAI,OAAO,GAAG,EAAE,CAAC;YAEjB,IAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY;gBACvC,OAAO,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,CAAC;YAE5G,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CACxB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EACvC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,CACjD,CAAC;QACN,CAAC;QAES,oCAAmB,GAA7B;YACI,IAAI,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAElC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CACxB,QAAQ,CAAC,CAAC,EACV,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,cAAc,GAAG,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,CAC9I,CAAC;QACN,CAAC;QACL,aAAC;IAAD,CA9EA,AA8EC,IAAA;IA9EY,wBAAM;;;;;;;ICJnB;QA4BI,6BAAY,IAAmC;YArB/C,iBAAY,GAAkB,4BAAY,CAAC,IAAI,CAAC;YAGhD,cAAS,GAAY,EAAE,CAAC;YACxB,sBAAiB,GAAY,CAAC,CAAC;YAG/B,cAAS,GAAY,GAAG,CAAC;YACzB,sBAAiB,GAAY,EAAE,CAAC;YAGhC,iBAAY,GAAY,EAAE,CAAC;YAC3B,yBAAoB,GAAY,CAAC,CAAC;YAGlC,qBAAgB,GAAY,EAAE,CAAC;YAC/B,6BAAwB,GAAY,EAAE,CAAC;YAGvC,qBAAgB,GAAY,CAAC,CAAC;YAG1B,IAAG,IAAI;gBACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAClC,CAAC;QACL,0BAAC;IAAD,CAhCA,AAgCC,IAAA;IAhCY,kDAAmB;;;;;;;ICChC;QAoCI,uBAAY,IAA6B;YAnCzC,WAAM,GAAwB,IAAI,2CAAmB,EAAE,CAAC;YAIxD,eAAU,GAAW,EAAE,CAAC;YACxB,cAAS,GAAW,CAAC,CAAC;YACtB,qBAAgB,GAAY,KAAK,CAAC;YAClC,kBAAa,GAAW,aAAa,CAAC;YACtC,cAAS,GAAW,GAAG,CAAC;YAExB,gBAAW,GAAY,KAAK,CAAC;YAC7B,6BAAwB,GAAY,KAAK,CAAC;YAC1C,aAAQ,GAAkB;gBACtB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;aACrC,CAAC;YAGF,YAAO,GAAW,UAAU,CAAC;YAE7B,eAAU,GAAW,UAAU,CAAC;YAGhC,mBAAc,GAAW,EAAE,CAAC;YAC5B,oBAAe,GAAW,EAAE,CAAC;YAO7B,gBAAW,GAAY,KAAK,CAAC;YAE7B,iBAAY,GAAW,WAAW,CAAC;YACnC,oBAAe,GAAW,GAAG,CAAC;YAG1B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9B,CAAC;QAZD,sBAAI,uCAAY;iBAAhB;gBACI,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,QAAQ,EAAZ,CAAY,CAAC,CAAC;YAClF,CAAC;;;WAAA;QAWL,oBAAC;IAAD,CAvCA,AAuCC,IAAA;IAvCY,sCAAa;IAyCb,QAAA,eAAe,GAAG,IAAI,aAAa,CAAC;QAC7C,MAAM,EAAE,IAAI,2CAAmB,CAAC;YAC7B,IAAI,EAAE,UAAU;SAClB,CAAC;QACF,eAAe,EAAE;YACb,IAAI,qCAAgB,CAAC;gBACjB,IAAI,EAAE,UAAU;aACnB,CAAC;YACF,IAAI,qCAAgB,CAAC;gBACjB,IAAI,EAAE,UAAU;aACnB,CAAC;SACL;KACJ,CAAC,CAAC;;;;;;;;;;;IC/CH;QAAA;YACI,aAAQ,GAAkB,gCAAe,CAAC;YAM1C,cAAS,GAAG,GAAG,CAAC;YAChB,eAAU,GAAG,GAAG,CAAC;YAiCjB,iBAAY,GAA0C,EAAE,CAAC;QAU7D,CAAC;QAvCG,gCAAQ,GAAR,UAAS,MAAM;YACX,IAAG,UAAU,IAAI,MAAM,EAAE;gBACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,8BAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;aACxE;YAED,IAAG,YAAY,IAAI,MAAM,EAAE;gBACvB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;aACjD;YAED,IAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE;gBAC3B,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,CAAC;aAC3F;QACL,CAAC;QAED,4BAAI,GAAJ;YACI,IAAI,CAAC,UAAU,GAAI;gBACf,IAAI,EAAE,gBAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,IAAI,CAAC,SAAS;gBACrB,MAAM,EAAE,IAAI,CAAC,UAAU;gBACvB,KAAK,EAAE,IAAI,0BAAc,CAAC,IAAI,CAAC,QAAQ,CAAC;gBACxC,OAAO,EAAE;oBACL,OAAO,EAAE,QAAQ;iBACpB;aACJ,CAAC;QACN,CAAC;QAOD,mCAAW,GAAX;YACI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;gBACnB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI;gBACjC,IAAI,EAAE,IAAI,CAAC,WAAW;aACzB,CAAC,CAAC;YAEH,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QAC1B,CAAC;QACL,oBAAC;IAAD,CAnDA,AAmDC,IAAA;IAnDY,sCAAa;;;ACT1B;ACAA;;;;;;;;;;;;;;;;;;ICOA;QAII,uBAAoB,QAAyB;YAAzB,aAAQ,GAAR,QAAQ,CAAiB;YAH7C,aAAQ,GAAkB,gCAAe,CAAC;QAGM,CAAC;QAEjD,4BAAI,GAAJ;YACI,IAAI,CAAC,SAAS,GAAG,IAAI,mBAAW,CAAC,OAAO,CAAC,CAAC;QAC9C,CAAC;QAED,8BAAM,GAAN;YACI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC7B,CAAC;QAED,8BAAM,GAAN;YAAA,iBASC;YARG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,qCAAgB,CAAC;gBACpD,IAAI,EAAE,iBAAU,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAE;aAC7D,CAAC,CAAC,CAAC;YAEJ,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,UAAA,GAAG;gBACrC,OAAM,GAAG,CAAC,gBAAgB,CAAC,MAAM,IAAI,KAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM;oBACrE,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;QACP,CAAC;QAED,iCAAS,GAAT;YACI,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC;YAEpC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,UAAA,GAAG;gBACrC,GAAG,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC;YAC/B,CAAC,CAAC,CAAC;QACP,CAAC;QAED,oCAAY,GAAZ;YACI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAC1C,CAAC;QAED,sBAAI,8BAAG;iBAAP;gBACI,IAAI,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAEhE,GAAG,IAAI,iBAAiB,CAAC;gBACzB,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAE3C,OAAO,GAAG,CAAC;YACf,CAAC;;;WAAA;QAED,gCAAQ,GAAR;YACI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;QAhDQ,aAAa;YADzB,IAAA,8BAAU,GAAE;6CAKqB,8CAAe;WAJpC,aAAa,CAiDzB;QAAD,oBAAC;KAjDD,AAiDC,IAAA;IAjDY,sCAAa;;;ACP1B;;;;;;;;;;;;;;ICIA;QAGI,8BAAoB,QAAyB;YAAzB,aAAQ,GAAR,QAAQ,CAAiB;YAF7C,aAAQ,GAAe,EAAE,CAAC;QAEsB,CAAC;QAEjD,mCAAI,GAAJ;YAAA,iBAOC;YANG,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAC,CAAC;gBACjC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;gBAC/B,KAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAE3B,KAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;QACP,CAAC;QAZQ,oBAAoB;YADhC,IAAA,8BAAU,GAAE;6CAIqB,8CAAe;WAHpC,oBAAoB,CAahC;QAAD,2BAAC;KAbD,AAaC,IAAA;IAbY,oDAAoB;;;ACJjC;;;;;ICEA,SAAgB,SAAS,CAAC,MAA8B;QACpD,MAAM,CAAC,eAAe,CAAC,4BAAQ,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC,CAAC;IAC7E,CAAC;IAFD,8BAEC;;;;;;;;;;;;;;;;;;;;ICED;QAII,iCAAsB,OAAgB;YAAhB,YAAO,GAAP,OAAO,CAAS;QAEtC,CAAC;QAED,sCAAI,GAAJ;YACI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,OAAsB,CAAC;YACjD,IAAI,CAAC,IAAI,GAAG,IAAI,gBAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7C,CAAC;QAVS;YAAT,4BAAQ;;+DAAsC;QACrC;YAAT,4BAAQ;sCAAO,gBAAM,CAAC,IAAI;6DAAC;QAFnB,uBAAuB;YAHnC,IAAA,iCAAa,EAAC,aAAa,CAAC;YAC5B,IAAA,8BAAU,GAAE;YACZ,IAAA,8BAAU,EAAC,uBAAuB,CAAC;6CAKD,OAAO;WAJ7B,uBAAuB,CAYnC;QAAD,8BAAC;KAZD,AAYC,IAAA;IAZY,0DAAuB;;;;;;;ICNpC;QAAA;QAQA,CAAC;QAPG,qCAAQ,GAAR,UAAS,KAAK,EAAE,MAAM,EAAE,IAAI;YACxB,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC;QAClD,CAAC;QAED,mCAAM,GAAN,UAAO,MAAM,EAAE,MAAM,EAAE,IAAI;YACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;QACpC,CAAC;QACL,yBAAC;IAAD,CARA,AAQC,IAAA;IARY,gDAAkB;;;;;;;ICA/B;QAAA;QAeA,CAAC;QAdG,6CAAQ,GAAR,UAAS,KAAa;YAElB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAGtC,IAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,GAAG;gBAC7B,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAE9C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAI,KAAK,MAAG,CAAC,CAAC;QACpC,CAAC;QAED,2CAAM,GAAN,UAAO,KAAoB;YACvB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACjE,CAAC;QACL,iCAAC;IAAD,CAfA,AAeC,IAAA;IAfY,gEAA0B;;;;;;;ICAvC;QAAA;QAIA,CAAC;QAHG,wCAAQ,GAAR,UAAS,KAAK;YACV,OAAO,QAAQ,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG,CAAC,CAAC;QAClC,CAAC;QACL,4BAAC;IAAD,CAJA,AAIC,IAAA;IAJY,sDAAqB;;;;;;;ICAlC;QAAA;QAIA,CAAC;QAHG,mCAAM,GAAN,UAAO,KAAK;YACR,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC1C,CAAC;QACL,yBAAC;IAAD,CAJA,AAIC,IAAA;IAJY,gDAAkB;;;;;;;ICA/B;QAAA;QAIA,CAAC;QAHG,uCAAQ,GAAR,UAAS,KAAK;YACV,OAAO,UAAU,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG,CAAC,CAAC;QACpC,CAAC;QACL,2BAAC;IAAD,CAJA,AAIC,IAAA;IAJY,oDAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICMjC,IAAM,SAAS,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAG5D;QAAoC,kCAAY;QAgC5C,wBAAY,QAAuB;YAAnC,YACI,kBAAM,EAAE,CAAC,SAGZ;YA3BO,gBAAU,GAAgC,EAAE,CAAC;YAK7C,mBAAa,GAAG,IAAI,CAAC;YACrB,cAAQ,GAAG,IAAI,CAAC;YAKhB,mBAAa,GAAa,EAAE,CAAC;YAC7B,qBAAe,GAAY,KAAK,CAAC;YAEjC,eAAS,GAAG,KAAK,CAAC;YAIlB,gBAAU,GAAG,CAAC,CAAC;YACf,mBAAa,GAAG,CAAC,CAAC;YAOtB,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;;QAC7B,CAAC;QAEM,gCAAO,GAAd;YAAA,iBAcC;YAbG,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;YAGpC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,UAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,cAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAE,CAAC,CAAC;YAChF,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,iBAAc,EAAE,QAAQ,CAAC,CAAC;YAEjF,IAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ;gBAC5B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,sCAAsC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAE9G,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,UAAC,GAAG,EAAE,CAAC;gBACzC,IAAG,GAAG,CAAC,QAAQ;oBACX,KAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,CAAC,EAAE,sCAAsC,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;YAClG,CAAC,CAAC,CAAC;QACP,CAAC;QAEM,+BAAM,GAAb;YAAA,iBA0HC;YAzHG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;YAIhD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;gBACd,GAAG,EAAE,QAAQ;gBACb,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;aAC3G,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;gBACd,GAAG,EAAE,MAAM;gBACX,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;aACzG,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;gBACd,GAAG,EAAE,OAAO;gBACZ,SAAS,EAAE,EAAE;gBACb,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;aAC1G,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;gBACd,GAAG,EAAE,OAAO;gBACZ,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;aAC1G,CAAC,CAAC;YAIH,IAAI,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAE9C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;YACpF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;YAC1G,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAE5D,IAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI;gBACxB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YAEjF,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YAErL,IAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAC9B,IAAI,gBAAgB,GAAG,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBACzE,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;gBAErF,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;aAC/D;YAED,IAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI,EAAE;gBAC9E,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,CAAC;aAC5J;YAED,IAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW,EAAE;gBAC5F,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC,CAAC;aACjL;oCAIQ,CAAC;gBACN,IAAI,WAAW,GAAG,OAAK,cAAc,CAAC,CAAC,CAAC,CAAC;gBACzC,IAAI,SAAS,GAA8B,OAAK,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;gBAEzH,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,OAAK,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,EAAE,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;gBAE3K,IAAG,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;oBACtC,gBAAgB,GAAG,OAAK,sBAAsB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;oBAC7D,KAAK,GAAG,OAAK,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,aAAa,GAAG,CAAC,CAAC,CAAC;oBAEtF,KAAK,CAAC,QAAQ,CAAC,OAAK,QAAQ,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;iBAC/D;gBAED,SAAS,CAAC,KAAK,GAAG,WAAW,CAAC,CAAC,GAAG,OAAK,YAAY,CAAC,CAAC,CAAC;gBACtD,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;gBAEhE,IAAG,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI;oBACpC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;gBAErF,SAAS,CAAC,cAAc,EAAE,CAAC;gBAC3B,SAAS,CAAC,EAAE,CAAC,aAAa,EAAE,UAAC,CAAC;oBAC1B,IAAI,KAAI,CAAC,aAAa,EAAE;wBAEpB,KAAI,CAAC,YAAY,CAAC,KAAK,GAAG,KAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAI,CAAC,YAAY,CAAC,CAAC,CAAC;wBAE7D,IAAI,cAAY,GAAG,KAAI,CAAC,qBAAqB,CAAC,KAAI,CAAC,YAAY,CAAC,CAAC;wBACjE,KAAI,CAAC,UAAU,CAAC,CAAC,GAAG,cAAY,CAAC,CAAC,CAAC;wBACnC,KAAI,CAAC,UAAU,CAAC,CAAC,GAAG,cAAY,CAAC,CAAC,CAAC;wBAEnC,KAAI,CAAC,SAAS,CAAC,KAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;qBAChD;gBACL,CAAC,CAAC,CAAC;gBAEH,IAAG,CAAC,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI,EAAE;oBAC1F,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAK,eAAe,CAAC,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,CAAC;iBAC5K;gBAED,IAAG,CAAC,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW,EAAE;oBACxG,SAAS,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAK,eAAe,CAAC,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC,CAAC;iBACjM;gBAED,OAAK,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;;+BAlCxB,gBAAgB,EAChB,KAAK;YARjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE;wBAApD,CAAC;aA0CT;YAID,IAAI,YAAY,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACjE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;YAElF,IAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ;gBACrB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YAE5E,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,UAAC,EAAE,EAAE,QAAQ;gBACrE,IAAI,CAAC,KAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,KAAI,CAAC,WAAW;oBAC/C,KAAI,CAAC,SAAS,CAAC,QAAqC,CAAC,CAAC;YAC9D,CAAC,CAAC,CAAC;YAIH,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC5B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;YAE/B,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE;gBAC/D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,SAAS,CAAC,CAAC;gBACpG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aACtC;QACL,CAAC;QAEM,+BAAM,GAAb;YAAA,iBAmEC;YAlEG,IAAG,IAAI,CAAC,SAAS;gBACb,OAAO;YAEX,IAAI,IAAI,CAAC,aAAa,EAAE;gBACpB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACjC,IAAI,CAAC,YAAY,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;gBAE7D,IAAI,YAAY,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBACjE,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;gBACnC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;aACtC;iBAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAEvB,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAA,CAAC;oBACpC,IAAI,MAAM,GAAG,CAA8B,CAAC;oBAC5C,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;wBAClC,MAAM,CAAC,KAAK,GAAG,KAAI,CAAC,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAA;gBACnD,CAAC,CAAC,CAAC;aACN;YAGD,IAAG,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI;gBACjG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;gBACzD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;gBAC5B,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;oBAC/B,MAAM,EAAE,cAAc;iBACzB,CAAC,CAAC;aACN;iBAEI,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW;gBACxI,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;gBACpE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;gBAC5B,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;oBAC/B,MAAM,EAAE,cAAc;iBACzB,CAAC,CAAC;aACN;YAED,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAA,GAAG;gBAIvB,IAAI,GAAG,IAAI,KAAI,CAAC,WAAW,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;oBAChD,OAAO;gBAEX,IAAI,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAqB,CAAC;gBAG3D,IAAG,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI;oBAC5D,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;oBAC3C,KAAI,CAAC,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;iBACvC;qBAEI,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW;oBAChF,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;oBAClD,KAAI,CAAC,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;iBACvC;YACL,CAAC,CAAC,CAAC;YAIH,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB;gBAC7D,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;YAErD,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;gBACtF,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;gBACpC,IAAI,CAAC,QAAQ,EAAE,CAAC;aACnB;QACL,CAAC;QAEM,iCAAQ,GAAf;YACI,IAAI,IAAI,CAAC,SAAS;gBACd,OAAO;YAEX,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YAEtB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;YAG3B,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACjC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,kBAAkB,EAAE,EAA1B,CAA0B,CAAC,CAAC;YAGpE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;YAClK,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC/H,CAAC;QAIM,kCAAS,GAAhB,UAAiB,OAAkC,EAAE,QAAmC;YACpF,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;gBACpB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI;gBACzC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI;gBAC3C,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ;aACnC,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAK3B,IAAI,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAClD,IAAG,CAAC,eAAe,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW,EAAE;gBACvF,QAAQ,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,gBAAgB,EAAE,eAAe,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC,CAAC;aAC9J;YAED,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YAC3C,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;YAE5B,IAAI,CAAC,UAAU,EAAE,CAAC;YAIlB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtB,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAIhC,IAAI,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;YAC9D,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC9G,CAAC;QAEM,kCAAS,GAAhB,UAAiB,QAAmC;YAApD,iBA+HC;;YA5HG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC,CAAA;YAIpC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAIvB,IAAI,YAAY,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;YACvD,IAAI,CAAC,UAAU,CAAC,IAAmC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;YAK3F,IAAG,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI,EAAE;gBACvG,IAAI,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;gBAE/G,IAAI,IAAI,CAAC,UAAU,IAAI,WAAW,EAAE;oBAChC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;oBAC5B,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;wBAC/B,MAAM,EAAE,gBAAgB;qBAC3B,CAAC,CAAC;iBACN;aACJ;iBAEI,IAAG,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,OAAO,CAAC,KAAK,4BAAY,CAAC,OAAO,EAAE;gBAClH,IAAI,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;gBACrH,IAAI,mBAAmB,GAAG,MAAA,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,mCAAI,CAAC,CAAC;gBAE1E,IAAG,IAAI,CAAC,YAAY,IAAI,QAAQ;oBAC5B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,mBAAmB,CAAC,CAAC;gBAEtE,IAAI,mBAAmB,IAAI,WAAW,EAAE;oBACpC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;oBAC5B,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;wBAC/B,MAAM,EAAE,gBAAgB;qBAC3B,CAAC,CAAC;iBACN;aACJ;YAED,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAA,GAAG;;gBAIvB,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;oBACxC,OAAO;gBAEX,IAAI,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAqB,CAAC;gBAC3D,IAAI,aAAa,GAAG,CAAC,MAAA,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,CAAC;gBAC5D,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;gBAG5C,IAAG,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI,EAAE;oBAClE,IAAI,WAAW,GAAG,KAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;oBAEvF,IAAI,KAAI,CAAC,UAAU,IAAI,WAAW,IAAI,KAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC;wBAC5E,KAAI,CAAC,SAAS,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;iBAC7C;qBAEI,IAAG,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,OAAO,CAAC,KAAK,4BAAY,CAAC,OAAO,EAAE;oBAC7E,IAAI,WAAW,GAAG,KAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;oBAE7F,IAAI,aAAa,IAAI,WAAW,IAAI,KAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,kBAAkB,CAAC;wBAC7E,KAAI,CAAC,SAAS,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;iBAC7C;YACL,CAAC,CAAC,CAAC;YAIH,IACI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;gBACnF,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAC,wBAAwB,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;gBACpH,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAC7E;gBACE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;gBAClC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAChB,OAAO;aACV;YAID,IAAI,QAAQ,KAAK,IAAI,CAAC,YAAY,EAAE;gBAChC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;aAC7B;iBAAM;gBACH,IAAI,UAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAqB,CAAC;gBAEhE,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC;oBAC5B,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAExB,YAAY,GAAG,KAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;oBACpD,KAAI,CAAC,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;oBACnC,KAAI,CAAC,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;oBAEnC,KAAI,CAAC,aAAa,GAAG,UAAU,CAAC;wBAC5B,IAAI,KAAI,CAAC,QAAQ,CAAC,WAAW,EAAE;4BAE3B,OAAM,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAI,CAAC,aAAa,CAAC,KAAK,KAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;gCACjG,CAAC,KAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAI,CAAC,aAAa,CAAC,CAAC;gCACxE,KAAI,CAAC,aAAa,EAAE,CAAA;4BAExB,KAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAI,CAAC,aAAa,CAAC,CAA8B,CAAC,CAAA;4BACjI,KAAI,CAAC,aAAa,EAAE,CAAC;yBACxB;6BAAM;4BACH,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;4BAGjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gCACvD,MAAM,IAAI,UAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;gCAEvC,IAAI,MAAM,IAAI,CAAC,EAAE;oCAEb,IAAI,CAAC,IAAI,KAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;wCACrD,CAAC,EAAE,CAAA;oCAEP,KAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAA8B,CAAC,CAAC;oCAEzF,MAAM;iCACT;6BACJ;yBACJ;oBACL,CAAC,EAAE,KAAI,CAAC,eAAe,CAAC,UAAQ,CAAC,UAAU,EAAE,UAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC;gBAC/E,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,UAAQ,CAAC,UAAU,EAAE,UAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAA;aAC7E;QACL,CAAC;QAEM,kCAAS,GAAhB,UAAiB,MAAiC,EAAE,MAAmB;YAAvE,iBA4EC;YA5EmD,uBAAA,EAAA,WAAmB;YACnE,IAAI,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAA4B,CAAC;YAC1E,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAEjE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACrC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAE/B,UAAU,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC;YAI5D,MAAM,CAAC,kBAAkB,EAAE,CAAC;YAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAEzB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;gBACpB,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI;gBACvC,MAAM,EAAE,MAAM;aACjB,CAAC,CAAC;YAIH,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAEnC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,UAAC,GAAG,EAAE,CAAC;gBACzC,IAAG,KAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;oBACjC,OAAO;gBAEX,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;gBAE1D,IAAI,WAAW,GAAG,WAAW,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;gBACxE,IAAI,YAAY,GAAG,GAAG,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;gBACrD,GAAG,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;gBACtC,IAAI,KAAK,GAAG,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,GAAG,IAAK,OAAA,GAAG,GAAG,GAAG,EAAT,CAAS,CAAC,CAAC;gBAEjE,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACjD,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC;wBAC5B,SAAS;oBAEb,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,YAAY,CAAC;iBAC7E;gBAED,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;YAGH,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE;gBACnE,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAChB,OAAO;aACV;YAID,IAAG,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW,EAAE;gBACrH,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBAC9E,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE;oBACpE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;oBAC5B,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;wBAC/B,MAAM,EAAE,eAAe;qBAC1B,CAAC,CAAC;iBACN;aACJ;YAED,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAA,GAAG;gBACvB,IAAI,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAqB,CAAC;gBAK3D,IAAI,GAAG,IAAI,KAAI,CAAC,WAAW,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;oBAChD,OAAO;gBAEX,IAAG,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW,EAAE;oBAChF,IAAI,KAAI,CAAC,aAAa,CAAC,MAAM,IAAI,QAAQ,CAAC,gBAAgB,IAAI,KAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,sBAAsB,CAAC;wBAC3G,KAAI,CAAC,SAAS,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;iBAC5C;YACL,CAAC,CAAC,CAAC;QACP,CAAC;QAID,uCAAc,GAAd,UAAe,CAAS;YAEpB,IAAI,OAAO,GAAG,EAAE,CAAC;YACjB,IAAI,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAErH,IAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC3C,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CACxB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EACzB,OAAO,GAAG,YAAY,CACzB,CAAC;aACL;YAED,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CAExB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,EAEpG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC;gBACrD,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;gBAC9B,CAAC,CAAC,OAAO,GAAG,YAAY,CAC/B,CAAC;QACN,CAAC;QAED,+CAAsB,GAAtB,UAAuB,CAAS,EAAE,MAAiC;YAC/D,IAAI,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YAEtC,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CACxB,QAAQ,CAAC,CAAC,EACV,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CACpG,CAAC;QACN,CAAC;QAED,0CAAiB,GAAjB;YACI,IAAI,OAAO,GAAG,EAAE,CAAC;YAEjB,IAAG,IAAI,CAAC,QAAQ,CAAC,YAAY;gBACzB,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,CAAC;YAEhF,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CACxB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EACzB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,CACnC,CAAC;QACN,CAAC;QAED,kDAAyB,GAAzB,UAA0B,MAAiC;YACvD,IAAI,QAAQ,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAExC,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CACxB,QAAQ,CAAC,CAAC,EACV,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,CAC7G,CAAC;QACN,CAAC;QAGD,8CAAqB,GAArB,UAAsB,MAAiC;YACnD,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACtF,CAAC;QAGD,8CAAqB,GAArB,UAAsB,MAAiC;YACnD,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACtF,CAAC;QAED,wCAAe,GAAf,UAAgB,IAAY,EAAE,QAAgB;YAC1C,OAAO,IAAI,GAAG,CAAC,gBAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,gBAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QAClF,CAAC;QAED,oCAAW,GAAX,UAAY,MAAc;YACtB,OAAO,gBAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC;QACrD,CAAC;QAED,sCAAa,GAAb;YACI,IAAI,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5E,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;YAE3D,OAAO,UAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,cAAI,IAAI,CAAC,aAAa,EAAE,cAAI,IAAI,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAG,IAAI,CAAC,aAAa,EAAE,CAAE,CAAC;QACnI,CAAC;QAED,kCAAS,GAAT,UAAU,IAAY,EAAE,IAAc;YAAd,qBAAA,EAAA,SAAc;YAClC,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC;YAEzC,MAAM,CAAC,MAAM,CAAC,WAAW,YACrB,IAAI,EAAE,IAAI,IACP,IAAI,GACR,GAAG,CAAC,CAAC;QACZ,CAAC;QACL,qBAAC;IAAD,CAjlBA,AAilBC,CAjlBmC,gBAAM,CAAC,KAAK,GAilB/C;IAjlBY,wCAAc","file":"app-bundle.js","sourcesContent":["import { RouterConfiguration, Router } from 'aurelia-router';\n\nexport class App {\n router: Router;\n\n configureRouter(config: RouterConfiguration, router: Router): void {\n this.router = router;\n\n config.title = 'Cyberball';\n\n config.map([\n { route: ['', 'home'], name: 'home', moduleId: 'pages/home' },\n { route: 'game', name: 'game', moduleId: 'pages/game' },\n { route: 'message-test', name: 'message-test', moduleId: 'pages/message-test' }\n ]);\n }\n}\n","\n","export function getVariantValue(base: number, variance: number): number {\n return base + (Phaser.Math.RND.between(0, variance) * Phaser.Math.RND.sign());\n}\n","export enum LeaveTrigger {\r\n None = 0,\r\n Turn = 1,\r\n Time = 1 << 1,\r\n Ignored = 1 << 2,\r\n OtherLeaver = 1 << 3,\r\n TimeIgnored = 1 << 4\r\n}\r\n","export default {\n debug: true,\n testing: true\n};\n","export function getCaughtBallPosition(player: Phaser.GameObjects.Sprite) {\n return { x: player.x + (player.flipX ? -50 : 50), y: player.y - 15 };\n}\n\nexport function getActiveBallPosition(player: Phaser.GameObjects.Sprite) {\n return { x: player.x + (player.flipX ? 40 : -40), y: player.y - 20 };\n}\n","import {Aurelia} from 'aurelia-framework'\nimport environment from './environment';\n\nexport function configure(aurelia: Aurelia) {\n aurelia.use\n .standardConfiguration()\n .feature('resources');\n\n aurelia.use.developmentLogging(environment.debug ? 'debug' : 'warn');\n\n if (environment.testing) {\n aurelia.use.plugin('aurelia-testing');\n }\n\n aurelia.start().then(() => aurelia.setRoot());\n}\n","export class BanterModel {\n chance: number;\n delay: number;\n delayVariance: number;\n messages: Array;\n}\n","import { CyberballScene } from 'scenes/cyberball';\nimport { CpuSettingsModel } from './cpu-settings-model';\nimport { Player } from \"./player-model\";\n\n// TODO: WIP isolate game logic into more classes.\nexport class Cpu extends Player {\n public settings: CpuSettingsModel;\n\n constructor(settings: CpuSettingsModel, gameReference: CyberballScene) {\n super(settings, gameReference);\n }\n}\n","import { BanterModel } from './banter-model';\nimport { PlayerSettingsModel } from './player-settings-model';\n\nexport class CpuSettingsModel extends PlayerSettingsModel {\n // A set of weights for each possible target, adding up to 100%.\n targetPreference: Array = [50, 50];\n\n throwDelay: number = 500;\n throwDelayVariance: number = 200;\n\n catchDelay: number = 500;\n catchDelayVariance: number = 200;\n\n introductionBanter?: BanterModel;\n throwBanter?: BanterModel\n catchBanter?: BanterModel\n leftOutBanter?: BanterModel\n\n boredomBanterThreshold?: number;\n boredomBanter?: BanterModel;\n\n leaveTurnChance?: number = 100;\n leaveTimeChance?: number = 100;\n leaveIgnoredChance?: number = 100;\n leaveTimeIgnoredChance?: number = 100;\n leaveOtherLeaverChance?: number = 50;\n\n constructor(init?: Partial) {\n super();\n\n if(init)\n Object.assign(this, init);\n }\n}\n","import { getVariantValue } from './../behaviors/get-variant-value';\nimport { LeaveTrigger } from 'enums/leave-trigger';\nimport { CyberballScene } from './../scenes/cyberball';\nimport { PlayerSettingsModel } from './player-settings-model';\n\n// TODO: WIP isolate game logic into more classes.\nexport class Player {\n public settings: PlayerSettingsModel;\n protected gameReference: CyberballScene\n\n // State\n public hasBall: boolean = false;\n public leaveTimeThreshold: number;\n public leaveIgnoreTimeThreshold: number;\n\n // Graphics\n protected group: Phaser.Physics.Arcade.Group;\n public sprite: Phaser.GameObjects.Sprite;\n protected nameText: Phaser.GameObjects.Text;\n protected portrait: Phaser.GameObjects.Image;\n\n constructor(settings: PlayerSettingsModel, gameReference: CyberballScene) {\n this.settings = settings;\n this.gameReference = gameReference;\n }\n\n public create() {\n // Graphics\n\n let position = this.getPosition();\n\n this.group = this.gameReference.physics.add.group({ immovable: true, allowGravity: false });\n\n // TODO: Separate spritesheet and animation from game into separate class?\n this.sprite = this.group.create(position.x, position.y, 'player', 'active/1.png');\n\n if (this.settings.tint)\n this.sprite.setTint(parseInt(this.settings.tint.substring(1), 16));\n\n this.nameText = this.gameReference.add.text(\n position.x,\n position.y + this.sprite.height / 2 + 10,\n this.settings.name,\n { fontFamily: 'Arial', color: '#000000' }\n ).setOrigin(0.5);\n\n if (this.settings.portrait) {\n let portraitPosition = this.getPortraitPosition();\n // TODO: Load portrait in constructor?\n this.portrait = this.gameReference.add.image(portraitPosition.x, portraitPosition.y, 'playerPortrait');\n }\n\n // Triggers\n\n if ((this.settings.leaveTrigger & LeaveTrigger.Time) === LeaveTrigger.Time) {\n this.leaveTimeThreshold = Date.now() + getVariantValue(this.settings.leaveTime, this.settings.leaveTimeVariance) * 1000;\n }\n\n if ((this.settings.leaveTrigger & LeaveTrigger.TimeIgnored) === LeaveTrigger.TimeIgnored) {\n this.leaveIgnoreTimeThreshold = Date.now() + getVariantValue(this.settings.leaveTimeIgnored, this.settings.leaveTimeIgnoredVariance) * 1000;\n }\n }\n\n // TODO: This feels gross.\n protected getPosition(): Phaser.Geom.Point {\n let padding = 75;\n\n if(this.gameReference.settings.hasPortraits)\n padding += this.gameReference.settings.portraitHeight + this.gameReference.settings.portraitPadding * 2;\n\n return new Phaser.Geom.Point(\n this.gameReference.sys.canvas.width / 2,\n this.gameReference.sys.canvas.height - padding\n );\n }\n\n protected getPortraitPosition(): Phaser.Geom.Point {\n var position = this.getPosition();\n\n return new Phaser.Geom.Point(\n position.x,\n position.y + this.gameReference.settings.portraitHeight / 2 + this.gameReference.settings.portraitPadding * 2 + this.sprite.height / 2 + 10\n );\n }\n}\n","import { LeaveTrigger } from \"enums/leave-trigger\";\n\nexport class PlayerSettingsModel {\n name: string;\n tint?: string;\n\n portrait?: string;\n\n /** Actions that may trigger a leave by this player. */\n leaveTrigger?: LeaveTrigger = LeaveTrigger.None;\n\n /** This player may leave after this many turns. */\n leaveTurn?: number = 10;\n leaveTurnVariance?: number = 2;\n\n /** This player may leave after this much time. (Seconds) */\n leaveTime?: number = 120;\n leaveTimeVariance?: number = 30;\n\n /** This player may leave after not catching the ball for this many turns. */\n leaveIgnored?: number = 10;\n leaveIgnoredVariance?: number = 2;\n\n /** This player may leave after not catching the ball for this much time. (Seconds) */\n leaveTimeIgnored?: number = 45;\n leaveTimeIgnoredVariance?: number = 15;\n\n /** This player may leave after this many other players leave. */\n leaveOtherLeaver?: number = 2;\n\n constructor(init?: Partial) {\n if(init)\n Object.assign(this, init);\n }\n}\n","import { PlayerSettingsModel } from './player-settings-model';\nimport { CpuSettingsModel } from './cpu-settings-model';\n\nexport class SettingsModel {\n player: PlayerSettingsModel = new PlayerSettingsModel();\n computerPlayers: Array;\n\n // Gameplay\n throwCount: number = 10;\n timeLimit: number = 0;\n displayTimeLimit: boolean = false;\n timeLimitText: string = 'Time Limit:';\n ballSpeed: number = 500;\n\n useSchedule: boolean = false;\n scheduleHonorsThrowCount: boolean = false;\n schedule: Array = [\n 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0\n ];\n\n // Graphics\n baseUrl: string = './assets';\n\n ballSprite: string = 'ball.png';\n ballTint?: string;\n\n portraitHeight: number = 75;\n portraitPadding: number = 10;\n\n get hasPortraits(): boolean | string {\n return this.player.portrait || this.computerPlayers.some(cpu => cpu.portrait);\n }\n\n // Misc\n chatEnabled: boolean = false;\n\n gameOverText: string = \"Game Over\";\n gameOverOpacity: number = 0.5;\n\n constructor(init?: Partial) {\n Object.assign(this, init);\n }\n}\n\nexport const defaultSettings = new SettingsModel({\n player: new PlayerSettingsModel({\n name: 'Player 1'\n }),\n computerPlayers: [\n new CpuSettingsModel({\n name: 'Player 2'\n }),\n new CpuSettingsModel({\n name: 'Player 3'\n })\n ]\n});\n","import { CyberballScene } from './../scenes/cyberball';\nimport { defaultSettings, SettingsModel } from './../models/settings-model';\nimport Phaser from 'phaser';\nimport { PhaserGameCustomElement } from 'resources/phaser-game/phaser-game';\n\n// // TODO: Use events to talk to Qualtrics?\n// //setTimeout(() => { window.dispatchEvent(new CustomEvent('complete', { detail: { test: 'test' } }))}, 1000)\n\n\nexport class GameViewModel {\n settings: SettingsModel = defaultSettings;\n\n // Game:\n\n game: PhaserGameCustomElement;\n\n gameWidth = 800;\n gameHeight = 460;\n\n gameConfig: Phaser.Types.Core.GameConfig;\n\n activate(params) {\n if('settings' in params) {\n this.settings = new SettingsModel(JSON.parse(atob(params.settings)));\n }\n\n if('playerName' in params) {\n this.settings.player.name = params.playerName;\n }\n\n if(this.settings.hasPortraits) {\n this.gameHeight += this.settings.portraitHeight * 2 + this.settings.portraitPadding * 4;\n }\n }\n\n bind() {\n this.gameConfig = {\n type: Phaser.AUTO,\n width: this.gameWidth,\n height: this.gameHeight,\n scene: new CyberballScene(this.settings),\n physics: {\n default: 'arcade'\n }\n };\n }\n\n // Chat:\n\n chatMessage: string;\n chatMessages: Array<{sender: string, text: string}> = [];\n\n sendMessage() {\n this.chatMessages.push({\n sender: this.settings.player.name,\n text: this.chatMessage\n });\n\n this.chatMessage = '';\n }\n}\n","canvas {\n max-width: 100%;\n}\n\n.chat-log {\n border: 1px solid black;\n border-bottom: 0;\n height: 100px;\n overflow-y: auto;\n}\n\n.chat-input {\n display: flex;\n}\n\n.chat-input input {\n flex: 1;\n}\n","\n","import {BindingSignaler} from 'aurelia-templating-resources';\nimport {autoinject} from 'aurelia-framework';\nimport { SettingsModel, defaultSettings } from \"models/settings-model\";\nimport { CpuSettingsModel } from 'models/cpu-settings-model';\nimport ClipboardJS from 'clipboard';\n\n@autoinject()\nexport class HomeViewModel {\n settings: SettingsModel = defaultSettings;\n clipboard: ClipboardJS;\n\n constructor(private signaler: BindingSignaler) {}\n\n bind() {\n this.clipboard = new ClipboardJS('#copy');\n }\n\n unbind() {\n this.clipboard.destroy();\n }\n\n addCPU() {\n this.settings.computerPlayers.push(new CpuSettingsModel({\n name: `Player ${this.settings.computerPlayers.length + 2}`\n }));\n\n this.settings.computerPlayers.forEach(cpu => {\n while(cpu.targetPreference.length != this.settings.computerPlayers.length)\n cpu.targetPreference.push(0);\n });\n }\n\n removeCPU() {\n this.settings.computerPlayers.pop();\n\n this.settings.computerPlayers.forEach(cpu => {\n cpu.targetPreference.pop();\n });\n }\n\n saveSettings() {\n this.signaler.signal('save-settings');\n }\n\n get url() {\n let url = document.location.origin + document.location.pathname;\n\n url += '#game?settings=';\n url += btoa(JSON.stringify(this.settings));\n\n return url;\n }\n\n testGame() {\n window.open(this.url);\n }\n}\n","\n","import {BindingSignaler} from 'aurelia-templating-resources';\nimport {autoinject} from 'aurelia-framework';\n\n@autoinject()\nexport class MessageTestViewModel {\n messages: Array = [];\n\n constructor(private signaler: BindingSignaler) {}\n\n bind() {\n window.addEventListener('message', (e) => {\n console.log('message', e.data);\n this.messages.push(e.data);\n\n this.signaler.signal('message');\n });\n }\n}\n","\n","import { FrameworkConfiguration, PLATFORM } from 'aurelia-framework';\n\nexport function configure(config: FrameworkConfiguration) {\n config.globalResources(PLATFORM.moduleName('./phaser-game/phaser-game'));\n}\n","import { customElement, bindable, autoinject, inlineView } from \"aurelia-framework\";\nimport Phaser from 'phaser';\n\n@customElement('phaser-game')\n@autoinject()\n@inlineView('')\nexport class PhaserGameCustomElement {\n @bindable config: Phaser.Types.Core.GameConfig;\n @bindable game: Phaser.Game;\n\n constructor(protected element: Element) {\n\n }\n\n bind() {\n this.config.parent = this.element as HTMLElement;\n this.game = new Phaser.Game(this.config);\n }\n}\n","export class FlagValueConverter {\r\n fromView(value, source, flag) {\r\n return value ? source | flag : source & ~flag;\r\n }\r\n\r\n toView(_value, source, flag) {\r\n return (source & flag) === flag;\r\n }\r\n}\r\n","export class IntegerArrayValueConverter {\n fromView(value: string) {\n // Remove anything but numbers and commas.\n value = value.replace(/[^0-9,]/g, '');\n\n // Remove any trailing comma.\n if(value[value.length - 1] == ',')\n value = value.substr(0, value.length - 1);\n\n return JSON.parse(`[${value}]`);\n }\n\n toView(value: Array) {\n return JSON.stringify(value).substr(1, value.length * 2 - 1);\n }\n}\n","export class IntegerValueConverter {\n fromView(value) {\n return parseInt(value ?? '0');\n }\n}\n","export class JsonValueConverter {\n toView(value) {\n return JSON.stringify(value, null, 2);\n }\n}\n","export class NumberValueConverter {\n fromView(value) {\n return parseFloat(value ?? '0');\n }\n}\n","import { Player } from './../models/player-model';\nimport { LeaveTrigger } from 'enums/leave-trigger';\nimport { SettingsModel } from './../models/settings-model';\nimport Phaser from 'phaser';\nimport { CpuSettingsModel } from 'models/cpu-settings-model';\n\nconst textStyle = { fontFamily: 'Arial', color: '#000000' };\n\n\nexport class CyberballScene extends Phaser.Scene {\n public settings: SettingsModel;\n\n // Game Objects:\n private player: Player;\n\n private ballSprite: Phaser.GameObjects.Sprite;\n private playerSprite: Phaser.GameObjects.Sprite;\n private playerGroup: Phaser.Physics.Arcade.Group;\n private cpuSprites: Phaser.GameObjects.Sprite[] = [];\n private timeLimitText: Phaser.GameObjects.Text;\n\n // Gameplay Mechanics:\n\n private playerHasBall = true;\n private ballHeld = true;\n private throwTarget: Phaser.GameObjects.Sprite;\n\n private activeTimeout;\n\n private absentPlayers: number[] = [];\n private showPlayerLeave: boolean = false;\n\n private gameEnded = false;\n\n // Stats:\n\n private throwCount = 0;\n private scheduleIndex = 0;\n private lastTime: number;\n private startTime: number;\n\n constructor(settings: SettingsModel) {\n super({});\n\n this.settings = settings;\n }\n\n public preload() {\n this.load.crossOrigin = 'anonymous';\n\n // TODO: Load from settings.\n this.load.image('ball', `${this.settings.baseUrl}/${this.settings.ballSprite}`);\n this.load.multiatlas('player', `${this.settings.baseUrl}/player.json`, 'assets');\n\n if(this.settings.player.portrait)\n this.load.image('playerPortrait', 'https://cors-anywhere.herokuapp.com/' + this.settings.player.portrait);\n\n this.settings.computerPlayers.forEach((cpu, i) => {\n if(cpu.portrait)\n this.load.image('cpuPortrait' + i, 'https://cors-anywhere.herokuapp.com/' + cpu.portrait);\n });\n }\n\n public create() {\n this.cameras.main.setBackgroundColor('#ffffff');\n\n // Animations:\n\n this.anims.create({\n key: 'active',\n frames: this.anims.generateFrameNames('player', { start: 1, end: 1, prefix: 'active/', suffix: '.png' })\n });\n\n this.anims.create({\n key: 'idle',\n frames: this.anims.generateFrameNames('player', { start: 1, end: 1, prefix: 'idle/', suffix: '.png' })\n });\n\n this.anims.create({\n key: 'throw',\n frameRate: 12,\n frames: this.anims.generateFrameNames('player', { start: 1, end: 3, prefix: 'throw/', suffix: '.png' })\n });\n\n this.anims.create({\n key: 'catch',\n frames: this.anims.generateFrameNames('player', { start: 1, end: 1, prefix: 'catch/', suffix: '.png' })\n });\n\n // Player:\n\n let playerPosition = this.getPlayerPosition();\n\n this.playerGroup = this.physics.add.group({ immovable: true, allowGravity: false });\n this.playerSprite = this.playerGroup.create(playerPosition.x, playerPosition.y, 'player', 'active/1.png');\n this.playerSprite.setData('settings', this.settings.player);\n\n if(this.settings.player.tint)\n this.playerSprite.setTint(parseInt(this.settings.player.tint.substr(1), 16));\n\n this.playerSprite.setData('name-object', this.add.text(playerPosition.x, playerPosition.y + this.playerSprite.height / 2 + 10, this.settings.player.name, textStyle).setOrigin(0.5));\n\n if(this.settings.player.portrait) {\n var portraitPosition = this.getPlayerPortraitPosition(this.playerSprite);\n var image = this.add.image(portraitPosition.x, portraitPosition.y, 'playerPortrait');\n\n image.setScale(this.settings.portraitHeight / image.height);\n }\n\n if((this.settings.player.leaveTrigger & LeaveTrigger.Time) === LeaveTrigger.Time) {\n this.playerSprite.setData('leaveTime', Date.now() + this.getVariantValue(this.settings.player.leaveTime, this.settings.player.leaveTimeVariance) * 1000);\n }\n\n if((this.settings.player.leaveTrigger & LeaveTrigger.TimeIgnored) === LeaveTrigger.TimeIgnored) {\n this.playerSprite.setData('leaveTimeIgnored', Date.now() + this.getVariantValue(this.settings.player.leaveTimeIgnored, this.settings.player.leaveTimeIgnoredVariance) * 1000);\n }\n\n // CPU:\n\n for (let i = 0; i < this.settings.computerPlayers.length; i++) {\n let cpuPosition = this.getCPUPosition(i);\n let cpuSprite: Phaser.GameObjects.Sprite = this.playerGroup.create(cpuPosition.x, cpuPosition.y, 'player', 'idle/1.png');\n\n cpuSprite.setData('name-object', this.add.text(cpuPosition.x, cpuPosition.y + cpuSprite.height / 2 + 10, this.settings.computerPlayers[i].name, textStyle).setOrigin(0.5));\n\n if(this.settings.computerPlayers[i].portrait) {\n var portraitPosition = this.getCPUPortraitPosition(i, cpuSprite);\n var image = this.add.image(portraitPosition.x, portraitPosition.y, 'cpuPortrait' + i);\n\n image.setScale(this.settings.portraitHeight / image.height);\n }\n\n cpuSprite.flipX = cpuPosition.x > this.playerSprite.x;\n cpuSprite.setData('settings', this.settings.computerPlayers[i]);\n\n if(this.settings.computerPlayers[i].tint)\n cpuSprite.setTint(parseInt(this.settings.computerPlayers[i].tint.substr(1), 16));\n\n cpuSprite.setInteractive();\n cpuSprite.on('pointerdown', (e) => {\n if (this.playerHasBall) {\n // Ensure player and ball are facing the correct way on touch devices:\n this.playerSprite.flipX = this.input.x < this.playerSprite.x;\n\n let ballPosition = this.getActiveBallPosition(this.playerSprite);\n this.ballSprite.x = ballPosition.x;\n this.ballSprite.y = ballPosition.y;\n\n this.throwBall(this.playerSprite, cpuSprite);\n }\n });\n\n if((this.settings.computerPlayers[i].leaveTrigger & LeaveTrigger.Time) === LeaveTrigger.Time) {\n cpuSprite.setData('leaveTime', Date.now() + this.getVariantValue(this.settings.computerPlayers[i].leaveTime, this.settings.computerPlayers[i].leaveTimeVariance) * 1000);\n }\n\n if((this.settings.computerPlayers[i].leaveTrigger & LeaveTrigger.TimeIgnored) === LeaveTrigger.TimeIgnored) {\n cpuSprite.setData('leaveTimeIgnored', Date.now() + this.getVariantValue(this.settings.computerPlayers[i].leaveTimeIgnored, this.settings.computerPlayers[i].leaveTimeIgnoredVariance) * 1000);\n }\n\n this.cpuSprites.push(cpuSprite);\n }\n\n // Ball:\n\n let ballPosition = this.getActiveBallPosition(this.playerSprite);\n this.ballSprite = this.physics.add.sprite(ballPosition.x, ballPosition.y, 'ball');\n\n if(this.settings.ballTint)\n this.ballSprite.setTint(parseInt(this.settings.ballTint.substr(1), 16));\n\n this.physics.add.overlap(this.ballSprite, this.playerGroup, (_b, receiver) => {\n if (!this.ballHeld && receiver === this.throwTarget)\n this.catchBall(receiver as Phaser.GameObjects.Sprite);\n });\n\n // Time Limit:\n\n this.startTime = Date.now();\n this.lastTime = this.startTime;\n\n if (this.settings.timeLimit > 0 && this.settings.displayTimeLimit) {\n this.timeLimitText = this.add.text(this.sys.canvas.width - 10, 10, this.getTimeString(), textStyle);\n this.timeLimitText.setOrigin(1, 0);\n }\n }\n\n public update() {\n if(this.gameEnded)\n return;\n\n if (this.playerHasBall) {\n this.playerSprite.play('active');\n this.playerSprite.flipX = this.input.x < this.playerSprite.x;\n\n let ballPosition = this.getActiveBallPosition(this.playerSprite);\n this.ballSprite.x = ballPosition.x;\n this.ballSprite.y = ballPosition.y;\n } else if (!this.ballHeld) {\n // Eyes on the ball:\n this.playerGroup.getChildren().forEach(c => {\n let sprite = c as Phaser.GameObjects.Sprite;\n if (sprite.frame.name.includes('idle'))\n sprite.flipX = this.ballSprite.x < sprite.x\n });\n }\n\n // Player may leave after time has passed:\n if(!this.showPlayerLeave && (this.settings.player.leaveTrigger & LeaveTrigger.Time) === LeaveTrigger.Time &&\n Date.now() > this.playerSprite.getData('leaveTime')) {\n this.showPlayerLeave = true;\n this.postEvent('player-may-leave', {\n reason: 'time elapsed'\n });\n }\n // Player may leave after ignored for a time:\n else if (!this.playerHasBall && !this.showPlayerLeave && (this.settings.player.leaveTrigger & LeaveTrigger.TimeIgnored) === LeaveTrigger.TimeIgnored &&\n Date.now() > this.playerSprite.getData('leaveTimeIgnored')) {\n this.showPlayerLeave = true;\n this.postEvent('player-may-leave', {\n reason: 'time ignored'\n });\n }\n\n this.cpuSprites.forEach(cpu => {\n // CPU shouldn't leave if they:\n // - have the ball or are about to catch the ball\n // - have already left\n if (cpu == this.throwTarget || cpu.getData('absent'))\n return;\n\n let settings = cpu.getData('settings') as CpuSettingsModel;\n\n // CPU may leave after some time\n if((settings.leaveTrigger & LeaveTrigger.Time) === LeaveTrigger.Time &&\n Date.now() > cpu.getData('leaveTime')) {\n this.leaveGame(cpu, 'time elapsed');\n }\n // CPU may leave after ignored for a time:\n else if ((settings.leaveTrigger & LeaveTrigger.TimeIgnored) === LeaveTrigger.TimeIgnored &&\n Date.now() > cpu.getData('leaveTimeIgnored')) {\n this.leaveGame(cpu, 'time ignored');\n }\n });\n\n // Time Limit:\n\n if (this.settings.timeLimit > 0 && this.settings.displayTimeLimit)\n this.timeLimitText.setText(this.getTimeString());\n\n if (this.settings.timeLimit > 0 && Date.now() - this.startTime > this.settings.timeLimit) {\n this.postEvent('global-time-limit');\n this.gameOver();\n }\n }\n\n public gameOver() {\n if (this.gameEnded)\n return;\n\n this.gameEnded = true;\n\n this.postEvent('game-end');\n\n // Stop future throws:\n clearTimeout(this.activeTimeout);\n this.playerGroup.children.each(child => child.removeAllListeners());\n\n // Draw game over screen:\n this.add.rectangle(this.sys.canvas.width / 2, this.sys.canvas.height / 2, this.sys.canvas.width, this.sys.canvas.height, 0xdddddd, this.settings.gameOverOpacity);\n this.add.text(this.sys.canvas.width / 2, this.sys.canvas.height / 2, this.settings.gameOverText, textStyle).setOrigin(0.5);\n }\n\n // Mechanics:\n\n public throwBall(thrower: Phaser.GameObjects.Sprite, receiver: Phaser.GameObjects.Sprite) {\n this.postEvent('throw', {\n thrower: thrower.getData('settings').name,\n receiver: receiver.getData('settings').name,\n wait: Date.now() - this.lastTime\n });\n\n this.lastTime = Date.now();\n\n // Update trackers:\n\n // Wait until the player throws the ball to reset their ignored timer, so they cannot ignore themselves.\n let throwerSettings = thrower.getData('settings');\n if((throwerSettings.leaveTrigger & LeaveTrigger.TimeIgnored) === LeaveTrigger.TimeIgnored) {\n receiver.setData('leaveTimeIgnored', Date.now() + this.getVariantValue(throwerSettings.leaveTimeIgnored, throwerSettings.leaveTimeIgnoredVariance) * 1000);\n }\n\n this.playerHasBall = this.ballHeld = false;\n this.throwTarget = receiver;\n\n this.throwCount++;\n\n // Player animation:\n\n thrower.play('throw');\n thrower.playAfterRepeat('idle');\n\n // Ball physics:\n\n let ballTargetPosition = this.getCaughtBallPosition(receiver);\n this.physics.moveTo(this.ballSprite, ballTargetPosition.x, ballTargetPosition.y, this.settings.ballSpeed);\n }\n\n public catchBall(receiver: Phaser.GameObjects.Sprite) {\n // Update trackers:\n\n this.ballHeld = true;\n receiver.setData('throwsIgnored', 0)\n\n // Player animation:\n\n receiver.play('catch');\n\n // Ball physics:\n\n let ballPosition = this.getCaughtBallPosition(receiver);\n (this.ballSprite.body as Phaser.Physics.Arcade.Body).reset(ballPosition.x, ballPosition.y);\n\n // Check for leavers:\n\n // Player may leave after a number of turns:\n if(!this.showPlayerLeave && (this.settings.player.leaveTrigger & LeaveTrigger.Turn) === LeaveTrigger.Turn) {\n let leaveThrows = this.getVariantValue(this.settings.player.leaveTurn, this.settings.player.leaveTurnVariance);\n\n if (this.throwCount >= leaveThrows) {\n this.showPlayerLeave = true;\n this.postEvent('player-may-leave', {\n reason: 'throws elapsed'\n });\n }\n }\n // Player may leave after ignored for a number of turns:\n else if(!this.showPlayerLeave && (this.settings.player.leaveTrigger & LeaveTrigger.Ignored) === LeaveTrigger.Ignored) {\n let leaveThrows = this.getVariantValue(this.settings.player.leaveIgnored, this.settings.player.leaveIgnoredVariance);\n let playerThrowsIgnored = this.playerSprite.getData('throwsIgnored') ?? 0;\n\n if(this.playerSprite != receiver)\n this.playerSprite.setData('throwsIgnored', ++playerThrowsIgnored);\n\n if (playerThrowsIgnored >= leaveThrows) {\n this.showPlayerLeave = true;\n this.postEvent('player-may-leave', {\n reason: 'throws ignored'\n });\n }\n }\n\n this.cpuSprites.forEach(cpu => {\n // CPU shouldn't leave if they:\n // - have the ball\n // - have already left\n if (cpu == receiver || cpu.getData('absent'))\n return;\n\n let settings = cpu.getData('settings') as CpuSettingsModel;\n let throwsIgnored = (cpu.getData('throwsIgnored') ?? 0) + 1;\n cpu.setData('throwsIgnored', throwsIgnored);\n\n // CPU may leave after a number of turns:\n if((settings.leaveTrigger & LeaveTrigger.Turn) === LeaveTrigger.Turn) {\n let leaveThrows = this.getVariantValue(settings.leaveTurn, settings.leaveTurnVariance);\n\n if (this.throwCount >= leaveThrows && this.checkChance(settings.leaveTurnChance))\n this.leaveGame(cpu, 'throws elapsed');\n }\n // CPU may leave after ignored for a number of turns:\n else if((settings.leaveTrigger & LeaveTrigger.Ignored) === LeaveTrigger.Ignored) {\n let leaveThrows = this.getVariantValue(settings.leaveIgnored, settings.leaveIgnoredVariance);\n\n if (throwsIgnored >= leaveThrows && this.checkChance(settings.leaveIgnoredChance))\n this.leaveGame(cpu, 'throws ignored');\n }\n });\n\n // The game ends at the end of the schedule or when reaching the throw count.\n\n if (\n (this.settings.useSchedule && this.scheduleIndex === this.settings.schedule.length) ||\n (this.settings.useSchedule && this.settings.scheduleHonorsThrowCount && this.throwCount >= this.settings.throwCount) ||\n (!this.settings.useSchedule && this.throwCount >= this.settings.throwCount)\n ) {\n this.postEvent('throw-count-met');\n this.gameOver();\n return;\n }\n\n // Prepare for next throw:\n\n if (receiver === this.playerSprite) {\n this.playerHasBall = true;\n } else {\n let settings = receiver.getData('settings') as CpuSettingsModel;\n\n this.activeTimeout = setTimeout(() => {\n receiver.play('active');\n\n ballPosition = this.getActiveBallPosition(receiver);\n this.ballSprite.x = ballPosition.x;\n this.ballSprite.y = ballPosition.y;\n\n this.activeTimeout = setTimeout(() => {\n if (this.settings.useSchedule) {\n // Skip self and absent players in schedule.\n while(this.settings.schedule[this.scheduleIndex] === this.playerGroup.getChildren().indexOf(receiver) &&\n !this.absentPlayers.includes(this.settings.schedule[this.scheduleIndex]))\n this.scheduleIndex++\n\n this.throwBall(receiver, this.playerGroup.getChildren()[this.settings.schedule[this.scheduleIndex]] as Phaser.GameObjects.Sprite)\n this.scheduleIndex++;\n } else {\n let random = Math.random() * 100;\n\n // A psuedo-random target is selected by subtracting the target preference chance from the random number until 0 is reached\n for (var i = 0; i < settings.targetPreference.length; i++) {\n random -= settings.targetPreference[i];\n\n if (random <= 0) {\n // Exclude self\n if (i >= this.playerGroup.getChildren().indexOf(receiver))\n i++\n\n this.throwBall(receiver, this.playerGroup.getChildren()[i] as Phaser.GameObjects.Sprite);\n\n break;\n }\n }\n }\n }, this.getVariantValue(settings.throwDelay, settings.throwDelayVariance));\n }, this.getVariantValue(settings.catchDelay, settings.catchDelayVariance))\n }\n }\n\n public leaveGame(player: Phaser.GameObjects.Sprite, reason: string = '') {\n let nameObject = player.getData('name-object') as Phaser.GameObjects.Text;\n let playerIndex = this.playerGroup.getChildren().indexOf(player);\n\n this.absentPlayers.push(playerIndex);\n player.setData('absent', true);\n\n nameObject.setText([nameObject.text, 'has left the game.']);\n\n // Deactivate player object\n\n player.removeAllListeners();\n player.setVisible(false);\n\n this.postEvent('leave', {\n leaver: player.getData('settings').name,\n reason: reason\n });\n\n // Redistribute throw target weights:\n\n console.log('pindex', playerIndex);\n\n this.settings.computerPlayers.forEach((cpu, i) => {\n if(this.absentPlayers.includes(i + 1))\n return;\n\n console.log('distribute before', i, cpu.targetPreference);\n\n let targetIndex = playerIndex > (i + 1) ? playerIndex - 1 : playerIndex;\n let targetWeight = cpu.targetPreference[targetIndex];\n cpu.targetPreference[targetIndex] = 0;\n let total = cpu.targetPreference.reduce((acc, cur) => acc + cur);\n\n for(let k = 0; k < cpu.targetPreference.length; k++) {\n if (cpu.targetPreference[k] == 0)\n continue;\n\n cpu.targetPreference[k] += cpu.targetPreference[k] / total * targetWeight;\n }\n\n console.log('distribute after', i, cpu.targetPreference);\n });\n\n // If there is only one player left, end the game:\n if (this.absentPlayers.length >= this.settings.computerPlayers.length) {\n this.gameOver();\n return;\n }\n\n // Check if this triggers other players leaving:\n\n if(!this.showPlayerLeave && (this.settings.player.leaveTrigger & LeaveTrigger.OtherLeaver) === LeaveTrigger.OtherLeaver) {\n console.log(this.absentPlayers.length, this.settings.player.leaveOtherLeaver);\n if (this.absentPlayers.length >= this.settings.player.leaveOtherLeaver) {\n this.showPlayerLeave = true;\n this.postEvent('player-may-leave', {\n reason: 'other leavers'\n });\n }\n }\n\n this.cpuSprites.forEach(cpu => {\n let settings = cpu.getData('settings') as CpuSettingsModel;\n\n // CPU shouldn't leave if they:\n // - have the ball\n // - have already left\n if (cpu == this.throwTarget || cpu.getData('absent'))\n return;\n\n if((settings.leaveTrigger & LeaveTrigger.OtherLeaver) === LeaveTrigger.OtherLeaver) {\n if (this.absentPlayers.length >= settings.leaveOtherLeaver && this.checkChance(settings.leaveOtherLeaverChance))\n this.leaveGame(cpu, 'other leavers');\n }\n });\n }\n\n // Helpers:\n\n getCPUPosition(i: number): Phaser.Geom.Point {\n // TODO: Increase padding when portaits are enabled.\n let padding = 75;\n let extraPadding = this.settings.hasPortraits ? this.settings.portraitHeight + this.settings.portraitPadding * 2 : 0;\n\n if(this.settings.computerPlayers.length === 1) {\n return new Phaser.Geom.Point(\n this.sys.canvas.width / 2,\n padding + extraPadding\n );\n }\n\n return new Phaser.Geom.Point(\n // Evenly divide the width of the screen by the number of players.\n ((this.sys.canvas.width - (padding * 2)) / (this.settings.computerPlayers.length - 1)) * i + padding,\n // First and last player are closer in the middle, others stand along the edge.\n i === 0 || i === this.settings.computerPlayers.length - 1\n ? (this.sys.canvas.height / 2)\n : padding + extraPadding\n );\n }\n\n getCPUPortraitPosition(i: number, sprite: Phaser.GameObjects.Sprite): Phaser.Geom.Point {\n let position = this.getCPUPosition(i);\n\n return new Phaser.Geom.Point(\n position.x,\n position.y - this.settings.portraitHeight + this.settings.portraitPadding * 2 - sprite.height / 2\n );\n }\n\n getPlayerPosition(): Phaser.Geom.Point {\n let padding = 75;\n\n if(this.settings.hasPortraits)\n padding += this.settings.portraitHeight + this.settings.portraitPadding * 2;\n\n return new Phaser.Geom.Point(\n this.sys.canvas.width / 2,\n this.sys.canvas.height - padding\n );\n }\n\n getPlayerPortraitPosition(sprite: Phaser.GameObjects.Sprite): Phaser.Geom.Point {\n var position = this.getPlayerPosition();\n\n return new Phaser.Geom.Point(\n position.x,\n position.y + this.settings.portraitHeight / 2 + this.settings.portraitPadding * 2 + sprite.height / 2 + 10\n );\n }\n\n // TODO: This is invalid if the sprites are changed.\n getCaughtBallPosition(target: Phaser.GameObjects.Sprite) {\n return new Phaser.Geom.Point(target.x + (target.flipX ? -50 : 50), target.y - 15);\n }\n\n // TODO: This is invalid if the sprites are changed.\n getActiveBallPosition(target: Phaser.GameObjects.Sprite) {\n return new Phaser.Geom.Point(target.x + (target.flipX ? 40 : -40), target.y - 20);\n }\n\n getVariantValue(base: number, variance: number): number {\n return base + (Phaser.Math.RND.between(0, variance) * Phaser.Math.RND.sign());\n }\n\n checkChance(chance: number): boolean {\n return Phaser.Math.RND.between(0, 100) <= chance;\n }\n\n getTimeString(): string {\n let timeRemaining = this.settings.timeLimit - (Date.now() - this.startTime);\n let time = new Date(timeRemaining < 0 ? 0 : timeRemaining);\n\n return `${this.settings.timeLimitText} ${time.getUTCMinutes()}:${time.getUTCSeconds() < 10 ? '0' : ''}${time.getUTCSeconds()}`;\n }\n\n postEvent(type: string, data: any = {}): void {\n console.log('post event: ' + type, data);\n\n window.parent.postMessage({\n type: type,\n ...data\n }, '*');\n }\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../src/app.ts","../src/app.html","../src/behaviors/get-variant-value.ts","../src/enums/leave-trigger.ts","../src/environment.ts","../src/helpers.ts","../src/main.ts","../src/models/banter-model.ts","../src/models/cpu-model.ts","../src/models/cpu-settings-model.ts","../src/models/player-model.ts","../src/models/player-settings-model.ts","../src/models/settings-model.ts","../src/pages/game.ts","../src/pages/game.css","../src/pages/game.html","../src/pages/home.ts","../src/pages/home.html","../src/pages/message-test.ts","../src/pages/message-test.html","../src/resources/index.ts","../src/resources/phaser-game/phaser-game.ts","../src/resources/value-converters/flag-value-converter.ts","../src/resources/value-converters/integer-array-value-converter.ts","../src/resources/value-converters/integer-value-converter.ts","../src/resources/value-converters/json-value-converter.ts","../src/resources/value-converters/number-value-converter.ts","../src/scenes/cyberball.ts"],"names":[],"mappings":";;;;IAEA;QAAA;QAcA,CAAC;QAXG,6BAAe,GAAf,UAAgB,MAA2B,EAAE,MAAc;YACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YAErB,MAAM,CAAC,KAAK,GAAG,WAAW,CAAC;YAE3B,MAAM,CAAC,GAAG,CAAC;gBACP,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE;gBAC7D,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE;gBACvD,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,oBAAoB,EAAE;aAClF,CAAC,CAAC;QACP,CAAC;QACL,UAAC;IAAD,CAdA,AAcC,IAAA;IAdY,kBAAG;;;ACFhB;;;;;ICAA,SAAgB,eAAe,CAAC,IAAY,EAAE,QAAgB;QAC1D,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAClF,CAAC;IAFD,0CAEC;;;;;;;ICFD,IAAY,YAOX;IAPD,WAAY,YAAY;QACpB,+CAAQ,CAAA;QACR,+CAAQ,CAAA;QACR,+CAAa,CAAA;QACb,qDAAgB,CAAA;QAChB,6DAAoB,CAAA;QACpB,8DAAoB,CAAA;IACxB,CAAC,EAPW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAOvB;;;;;;ICPD,kBAAe;QACb,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,IAAI;KACd,CAAC;;;;;;;ICHF,SAAgB,qBAAqB,CAAC,MAAiC;QACnE,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;IACzE,CAAC;IAFD,sDAEC;IAED,SAAgB,qBAAqB,CAAC,MAAiC;QACnE,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;IACzE,CAAC;IAFD,sDAEC;;;;;;;;;;;ICHD,SAAgB,SAAS,CAAC,OAAgB;QACxC,OAAO,CAAC,GAAG;aACR,qBAAqB,EAAE;aACvB,OAAO,CAAC,WAAW,CAAC,CAAC;QAExB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,qBAAW,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAErE,IAAI,qBAAW,CAAC,OAAO,EAAE;YACvB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;SACvC;QAED,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,cAAM,OAAA,OAAO,CAAC,OAAO,EAAE,EAAjB,CAAiB,CAAC,CAAC;IAChD,CAAC;IAZD,8BAYC;;;;;;;ICfD;QAAA;QAKA,CAAC;QAAD,kBAAC;IAAD,CALA,AAKC,IAAA;IALY,kCAAW;;;;;;;;;;;;;;;;;;;;;;ICKxB;QAAyB,uBAAM;QAG3B,aAAY,QAA0B,EAAE,aAA6B;mBACjE,kBAAM,QAAQ,EAAE,aAAa,CAAC;QAClC,CAAC;QACL,UAAC;IAAD,CANA,AAMC,CANwB,qBAAM,GAM9B;IANY,kBAAG;;;;;;;;;;;;;;;;;;;;;;ICFhB;QAAsC,oCAAmB;QAwBrD,0BAAY,IAAgC;YAA5C,YACI,iBAAO,SAIV;YA3BD,sBAAgB,GAAkB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAE3C,gBAAU,GAAW,GAAG,CAAC;YACzB,wBAAkB,GAAW,GAAG,CAAC;YAEjC,gBAAU,GAAW,GAAG,CAAC;YACzB,wBAAkB,GAAW,GAAG,CAAC;YAUjC,qBAAe,GAAY,GAAG,CAAC;YAC/B,qBAAe,GAAY,GAAG,CAAC;YAC/B,wBAAkB,GAAY,GAAG,CAAC;YAClC,4BAAsB,GAAY,GAAG,CAAC;YACtC,4BAAsB,GAAY,EAAE,CAAC;YAKjC,IAAG,IAAI;gBACH,MAAM,CAAC,MAAM,CAAC,KAAI,EAAE,IAAI,CAAC,CAAC;;QAClC,CAAC;QACL,uBAAC;IAAD,CA9BA,AA8BC,CA9BqC,2CAAmB,GA8BxD;IA9BY,4CAAgB;;;;;;;ICG7B;QAeI,gBAAY,QAA6B,EAAE,aAA6B;YAVjE,YAAO,GAAY,KAAK,CAAC;YAW5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACvC,CAAC;QAEM,uBAAM,GAAb;YAGI,IAAI,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAElC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;YAG5F,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;YAElF,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI;gBAClB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YAEvE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CACvC,QAAQ,CAAC,CAAC,EACV,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,EACxC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAClB,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAC5C,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAEjB,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;gBACxB,IAAI,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBAElD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;aAC1G;YAID,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI,EAAE;gBACxE,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAA,mCAAe,EAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;aAC3H;YAED,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW,EAAE;gBACtF,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAA,mCAAe,EAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC;aAC/I;QACL,CAAC;QAGS,4BAAW,GAArB;YACI,IAAI,OAAO,GAAG,EAAE,CAAC;YAEjB,IAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY;gBACvC,OAAO,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,CAAC;YAE5G,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CACxB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EACvC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,CACjD,CAAC;QACN,CAAC;QAES,oCAAmB,GAA7B;YACI,IAAI,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAElC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CACxB,QAAQ,CAAC,CAAC,EACV,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,cAAc,GAAG,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,CAC9I,CAAC;QACN,CAAC;QACL,aAAC;IAAD,CA9EA,AA8EC,IAAA;IA9EY,wBAAM;;;;;;;ICJnB;QA4BI,6BAAY,IAAmC;YArB/C,iBAAY,GAAkB,4BAAY,CAAC,IAAI,CAAC;YAGhD,cAAS,GAAY,EAAE,CAAC;YACxB,sBAAiB,GAAY,CAAC,CAAC;YAG/B,cAAS,GAAY,GAAG,CAAC;YACzB,sBAAiB,GAAY,EAAE,CAAC;YAGhC,iBAAY,GAAY,EAAE,CAAC;YAC3B,yBAAoB,GAAY,CAAC,CAAC;YAGlC,qBAAgB,GAAY,EAAE,CAAC;YAC/B,6BAAwB,GAAY,EAAE,CAAC;YAGvC,qBAAgB,GAAY,CAAC,CAAC;YAG1B,IAAG,IAAI;gBACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAClC,CAAC;QACL,0BAAC;IAAD,CAhCA,AAgCC,IAAA;IAhCY,kDAAmB;;;;;;;ICChC;QAoCI,uBAAY,IAA6B;YAnCzC,WAAM,GAAwB,IAAI,2CAAmB,EAAE,CAAC;YAIxD,eAAU,GAAW,EAAE,CAAC;YACxB,cAAS,GAAW,CAAC,CAAC;YACtB,qBAAgB,GAAY,KAAK,CAAC;YAClC,kBAAa,GAAW,aAAa,CAAC;YACtC,cAAS,GAAW,GAAG,CAAC;YAExB,gBAAW,GAAY,KAAK,CAAC;YAC7B,6BAAwB,GAAY,KAAK,CAAC;YAC1C,aAAQ,GAAkB;gBACtB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;aACrC,CAAC;YAGF,YAAO,GAAW,UAAU,CAAC;YAE7B,eAAU,GAAW,UAAU,CAAC;YAGhC,mBAAc,GAAW,EAAE,CAAC;YAC5B,oBAAe,GAAW,EAAE,CAAC;YAO7B,gBAAW,GAAY,KAAK,CAAC;YAE7B,iBAAY,GAAW,WAAW,CAAC;YACnC,oBAAe,GAAW,GAAG,CAAC;YAG1B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9B,CAAC;QAZD,sBAAI,uCAAY;iBAAhB;gBACI,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,QAAQ,EAAZ,CAAY,CAAC,CAAC;YAClF,CAAC;;;WAAA;QAWL,oBAAC;IAAD,CAvCA,AAuCC,IAAA;IAvCY,sCAAa;IAyCb,QAAA,eAAe,GAAG,IAAI,aAAa,CAAC;QAC7C,MAAM,EAAE,IAAI,2CAAmB,CAAC;YAC7B,IAAI,EAAE,UAAU;SAClB,CAAC;QACF,eAAe,EAAE;YACb,IAAI,qCAAgB,CAAC;gBACjB,IAAI,EAAE,UAAU;aACnB,CAAC;YACF,IAAI,qCAAgB,CAAC;gBACjB,IAAI,EAAE,UAAU;aACnB,CAAC;SACL;KACJ,CAAC,CAAC;;;;;;;;;;;IC/CH;QAAA;YACI,aAAQ,GAAkB,gCAAe,CAAC;YAM1C,cAAS,GAAG,GAAG,CAAC;YAChB,eAAU,GAAG,GAAG,CAAC;YAiCjB,iBAAY,GAA0C,EAAE,CAAC;QAU7D,CAAC;QAvCG,gCAAQ,GAAR,UAAS,MAAM;YACX,IAAG,UAAU,IAAI,MAAM,EAAE;gBACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,8BAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;aACxE;YAED,IAAG,YAAY,IAAI,MAAM,EAAE;gBACvB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;aACjD;YAED,IAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE;gBAC3B,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,CAAC;aAC3F;QACL,CAAC;QAED,4BAAI,GAAJ;YACI,IAAI,CAAC,UAAU,GAAI;gBACf,IAAI,EAAE,gBAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,IAAI,CAAC,SAAS;gBACrB,MAAM,EAAE,IAAI,CAAC,UAAU;gBACvB,KAAK,EAAE,IAAI,0BAAc,CAAC,IAAI,CAAC,QAAQ,CAAC;gBACxC,OAAO,EAAE;oBACL,OAAO,EAAE,QAAQ;iBACpB;aACJ,CAAC;QACN,CAAC;QAOD,mCAAW,GAAX;YACI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;gBACnB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI;gBACjC,IAAI,EAAE,IAAI,CAAC,WAAW;aACzB,CAAC,CAAC;YAEH,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QAC1B,CAAC;QACL,oBAAC;IAAD,CAnDA,AAmDC,IAAA;IAnDY,sCAAa;;;ACT1B;ACAA;;;;;;;;;;;;;;;;;;ICOA;QAII,uBAAoB,QAAyB;YAAzB,aAAQ,GAAR,QAAQ,CAAiB;YAH7C,aAAQ,GAAkB,gCAAe,CAAC;QAGM,CAAC;QAEjD,4BAAI,GAAJ;YACI,IAAI,CAAC,SAAS,GAAG,IAAI,mBAAW,CAAC,OAAO,CAAC,CAAC;QAC9C,CAAC;QAED,8BAAM,GAAN;YACI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC7B,CAAC;QAED,8BAAM,GAAN;YAAA,iBASC;YARG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,qCAAgB,CAAC;gBACpD,IAAI,EAAE,iBAAU,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAE;aAC7D,CAAC,CAAC,CAAC;YAEJ,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,UAAA,GAAG;gBACrC,OAAM,GAAG,CAAC,gBAAgB,CAAC,MAAM,IAAI,KAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM;oBACrE,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;QACP,CAAC;QAED,iCAAS,GAAT;YACI,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC;YAEpC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,UAAA,GAAG;gBACrC,GAAG,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC;YAC/B,CAAC,CAAC,CAAC;QACP,CAAC;QAED,oCAAY,GAAZ;YACI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAC1C,CAAC;QAED,sBAAI,8BAAG;iBAAP;gBACI,IAAI,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAEhE,GAAG,IAAI,iBAAiB,CAAC;gBACzB,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAE3C,OAAO,GAAG,CAAC;YACf,CAAC;;;WAAA;QAED,gCAAQ,GAAR;YACI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;QAhDQ,aAAa;YADzB,IAAA,8BAAU,GAAE;6CAKqB,8CAAe;WAJpC,aAAa,CAiDzB;QAAD,oBAAC;KAlDD,AAkDC,IAAA;;;ACxDD;;;;;;;;;;;;;;ICIA;QAGI,8BAAoB,QAAyB;YAAzB,aAAQ,GAAR,QAAQ,CAAiB;YAF7C,aAAQ,GAAe,EAAE,CAAC;QAEsB,CAAC;QAEjD,mCAAI,GAAJ;YAAA,iBAOC;YANG,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAC,CAAC;gBACjC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;gBAC/B,KAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAE3B,KAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;QACP,CAAC;QAZQ,oBAAoB;YADhC,IAAA,8BAAU,GAAE;6CAIqB,8CAAe;WAHpC,oBAAoB,CAahC;QAAD,2BAAC;KAdD,AAcC,IAAA;;;ACjBD;;;;;ICEA,SAAgB,SAAS,CAAC,MAA8B;QACpD,MAAM,CAAC,eAAe,CAAC,4BAAQ,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC,CAAC;IAC7E,CAAC;IAFD,8BAEC;;;;;;;;;;;;;;;;;;;;ICED;QAII,iCAAsB,OAAgB;YAAhB,YAAO,GAAP,OAAO,CAAS;QAEtC,CAAC;QAED,sCAAI,GAAJ;YACI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,OAAsB,CAAC;YACjD,IAAI,CAAC,IAAI,GAAG,IAAI,gBAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7C,CAAC;QAVS;YAAT,4BAAQ;;+DAAsC;QACrC;YAAT,4BAAQ;sCAAO,gBAAM,CAAC,IAAI;6DAAC;QAFnB,uBAAuB;YAHnC,IAAA,iCAAa,EAAC,aAAa,CAAC;YAC5B,IAAA,8BAAU,GAAE;YACZ,IAAA,8BAAU,EAAC,uBAAuB,CAAC;6CAKD,OAAO;WAJ7B,uBAAuB,CAYnC;QAAD,8BAAC;KAfD,AAeC,IAAA;;;;;;;IClBD;QAAA;QAQA,CAAC;QAPG,qCAAQ,GAAR,UAAS,KAAK,EAAE,MAAM,EAAE,IAAI;YACxB,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC;QAClD,CAAC;QAED,mCAAM,GAAN,UAAO,MAAM,EAAE,MAAM,EAAE,IAAI;YACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;QACpC,CAAC;QACL,yBAAC;IAAD,CARA,AAQC,IAAA;IARY,gDAAkB;;;;;;;ICA/B;QAAA;QAeA,CAAC;QAdG,6CAAQ,GAAR,UAAS,KAAa;YAElB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAGtC,IAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,GAAG;gBAC7B,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAE9C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAI,KAAK,MAAG,CAAC,CAAC;QACpC,CAAC;QAED,2CAAM,GAAN,UAAO,KAAoB;YACvB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACjE,CAAC;QACL,iCAAC;IAAD,CAfA,AAeC,IAAA;IAfY,gEAA0B;;;;;;;ICAvC;QAAA;QAIA,CAAC;QAHG,wCAAQ,GAAR,UAAS,KAAK;YACV,OAAO,QAAQ,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG,CAAC,CAAC;QAClC,CAAC;QACL,4BAAC;IAAD,CAJA,AAIC,IAAA;IAJY,sDAAqB;;;;;;;ICAlC;QAAA;QAIA,CAAC;QAHG,mCAAM,GAAN,UAAO,KAAK;YACR,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC1C,CAAC;QACL,yBAAC;IAAD,CAJA,AAIC,IAAA;IAJY,gDAAkB;;;;;;;ICA/B;QAAA;QAIA,CAAC;QAHG,uCAAQ,GAAR,UAAS,KAAK;YACV,OAAO,UAAU,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG,CAAC,CAAC;QACpC,CAAC;QACL,2BAAC;IAAD,CAJA,AAIC,IAAA;IAJY,oDAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ICMjC,IAAM,SAAS,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAG5D;QAAoC,kCAAY;QAgC5C,wBAAY,QAAuB;YAAnC,YACI,kBAAM,EAAE,CAAC,SAGZ;YA3BO,gBAAU,GAAgC,EAAE,CAAC;YAK7C,mBAAa,GAAG,IAAI,CAAC;YACrB,cAAQ,GAAG,IAAI,CAAC;YAKhB,mBAAa,GAAa,EAAE,CAAC;YAC7B,qBAAe,GAAY,KAAK,CAAC;YAEjC,eAAS,GAAG,KAAK,CAAC;YAIlB,gBAAU,GAAG,CAAC,CAAC;YACf,mBAAa,GAAG,CAAC,CAAC;YAOtB,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;;QAC7B,CAAC;QAEM,gCAAO,GAAd;YAAA,iBAcC;YAbG,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;YAGpC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,UAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,cAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAE,CAAC,CAAC;YAChF,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,iBAAc,EAAE,QAAQ,CAAC,CAAC;YAEjF,IAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ;gBAC5B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,wBAAwB,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAEhG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,UAAC,GAAG,EAAE,CAAC;gBACzC,IAAG,GAAG,CAAC,QAAQ;oBACX,KAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,CAAC,EAAE,wBAAwB,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;YACpF,CAAC,CAAC,CAAC;QACP,CAAC;QAEM,+BAAM,GAAb;YAAA,iBA0HC;YAzHG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;YAIhD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;gBACd,GAAG,EAAE,QAAQ;gBACb,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;aAC3G,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;gBACd,GAAG,EAAE,MAAM;gBACX,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;aACzG,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;gBACd,GAAG,EAAE,OAAO;gBACZ,SAAS,EAAE,EAAE;gBACb,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;aAC1G,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;gBACd,GAAG,EAAE,OAAO;gBACZ,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;aAC1G,CAAC,CAAC;YAIH,IAAI,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAE9C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;YACpF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;YAC1G,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAE5D,IAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI;gBACxB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YAEjF,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YAErL,IAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE;gBAC9B,IAAI,gBAAgB,GAAG,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBACzE,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;gBAErF,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;aAC/D;YAED,IAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI,EAAE;gBAC9E,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,CAAC;aAC5J;YAED,IAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW,EAAE;gBAC5F,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC,CAAC;aACjL;oCAIQ,CAAC;gBACN,IAAI,WAAW,GAAG,OAAK,cAAc,CAAC,CAAC,CAAC,CAAC;gBACzC,IAAI,SAAS,GAA8B,OAAK,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;gBAEzH,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,OAAK,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,EAAE,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;gBAE3K,IAAG,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;oBACtC,gBAAgB,GAAG,OAAK,sBAAsB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;oBAC7D,KAAK,GAAG,OAAK,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,aAAa,GAAG,CAAC,CAAC,CAAC;oBAEtF,KAAK,CAAC,QAAQ,CAAC,OAAK,QAAQ,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;iBAC/D;gBAED,SAAS,CAAC,KAAK,GAAG,WAAW,CAAC,CAAC,GAAG,OAAK,YAAY,CAAC,CAAC,CAAC;gBACtD,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;gBAEhE,IAAG,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI;oBACpC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;gBAErF,SAAS,CAAC,cAAc,EAAE,CAAC;gBAC3B,SAAS,CAAC,EAAE,CAAC,aAAa,EAAE,UAAC,CAAC;oBAC1B,IAAI,KAAI,CAAC,aAAa,EAAE;wBAEpB,KAAI,CAAC,YAAY,CAAC,KAAK,GAAG,KAAI,CAAC,KAAK,CAAC,CAAC,GAAG,KAAI,CAAC,YAAY,CAAC,CAAC,CAAC;wBAE7D,IAAI,cAAY,GAAG,KAAI,CAAC,qBAAqB,CAAC,KAAI,CAAC,YAAY,CAAC,CAAC;wBACjE,KAAI,CAAC,UAAU,CAAC,CAAC,GAAG,cAAY,CAAC,CAAC,CAAC;wBACnC,KAAI,CAAC,UAAU,CAAC,CAAC,GAAG,cAAY,CAAC,CAAC,CAAC;wBAEnC,KAAI,CAAC,SAAS,CAAC,KAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;qBAChD;gBACL,CAAC,CAAC,CAAC;gBAEH,IAAG,CAAC,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI,EAAE;oBAC1F,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAK,eAAe,CAAC,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,CAAC;iBAC5K;gBAED,IAAG,CAAC,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW,EAAE;oBACxG,SAAS,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAK,eAAe,CAAC,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,OAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC,CAAC;iBACjM;gBAED,OAAK,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;;+BAlCxB,gBAAgB,EAChB,KAAK;YARjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE;wBAApD,CAAC;aA0CT;YAID,IAAI,YAAY,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACjE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;YAElF,IAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ;gBACrB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YAE5E,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,UAAC,EAAE,EAAE,QAAQ;gBACrE,IAAI,CAAC,KAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,KAAI,CAAC,WAAW;oBAC/C,KAAI,CAAC,SAAS,CAAC,QAAqC,CAAC,CAAC;YAC9D,CAAC,CAAC,CAAC;YAIH,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC5B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;YAE/B,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE;gBAC/D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,SAAS,CAAC,CAAC;gBACpG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aACtC;QACL,CAAC;QAEM,+BAAM,GAAb;YAAA,iBAmEC;YAlEG,IAAG,IAAI,CAAC,SAAS;gBACb,OAAO;YAEX,IAAI,IAAI,CAAC,aAAa,EAAE;gBACpB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACjC,IAAI,CAAC,YAAY,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;gBAE7D,IAAI,YAAY,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBACjE,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;gBACnC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;aACtC;iBAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAEvB,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAA,CAAC;oBACpC,IAAI,MAAM,GAAG,CAA8B,CAAC;oBAC5C,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;wBAClC,MAAM,CAAC,KAAK,GAAG,KAAI,CAAC,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAA;gBACnD,CAAC,CAAC,CAAC;aACN;YAGD,IAAG,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI;gBACjG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;gBACzD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;gBAC5B,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;oBAC/B,MAAM,EAAE,cAAc;iBACzB,CAAC,CAAC;aACN;iBAEI,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW;gBACxI,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;gBACpE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;gBAC5B,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;oBAC/B,MAAM,EAAE,cAAc;iBACzB,CAAC,CAAC;aACN;YAED,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAA,GAAG;gBAIvB,IAAI,GAAG,IAAI,KAAI,CAAC,WAAW,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;oBAChD,OAAO;gBAEX,IAAI,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAqB,CAAC;gBAG3D,IAAG,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI;oBAC5D,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;oBAC3C,KAAI,CAAC,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;iBACvC;qBAEI,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW;oBAChF,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;oBAClD,KAAI,CAAC,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;iBACvC;YACL,CAAC,CAAC,CAAC;YAIH,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB;gBAC7D,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;YAErD,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;gBACtF,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;gBACpC,IAAI,CAAC,QAAQ,EAAE,CAAC;aACnB;QACL,CAAC;QAEM,iCAAQ,GAAf;YACI,IAAI,IAAI,CAAC,SAAS;gBACd,OAAO;YAEX,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YAEtB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;YAG3B,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACjC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,KAAK;gBACnC,KAAK,CAAC,kBAAkB,EAAE,CAAC;gBAC3B,OAAO,IAAI,CAAC;YAChB,CAAC,CAAC,CAAC;YAGH,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;YAClK,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC/H,CAAC;QAIM,kCAAS,GAAhB,UAAiB,OAAkC,EAAE,QAAmC;YACpF,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;gBACpB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI;gBACzC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI;gBAC3C,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ;aACnC,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAK3B,IAAI,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAElD,IAAG,CAAC,eAAe,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW,EAAE;gBACvF,QAAQ,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,gBAAgB,EAAE,eAAe,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC,CAAC;aAC9J;YAED,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YAC3C,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;YAE5B,IAAI,CAAC,UAAU,EAAE,CAAC;YAIlB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtB,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAIhC,IAAI,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;YAC9D,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC9G,CAAC;QAEM,kCAAS,GAAhB,UAAiB,QAAmC;YAApD,iBA+HC;;YA5HG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC,CAAA;YAIpC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAIvB,IAAI,YAAY,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;YACvD,IAAI,CAAC,UAAU,CAAC,IAAmC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;YAK3F,IAAG,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI,EAAE;gBACvG,IAAI,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;gBAE/G,IAAI,IAAI,CAAC,UAAU,IAAI,WAAW,EAAE;oBAChC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;oBAC5B,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;wBAC/B,MAAM,EAAE,gBAAgB;qBAC3B,CAAC,CAAC;iBACN;aACJ;iBAEI,IAAG,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,OAAO,CAAC,KAAK,4BAAY,CAAC,OAAO,EAAE;gBAClH,IAAI,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;gBACrH,IAAI,mBAAmB,GAAG,MAAA,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,mCAAI,CAAC,CAAC;gBAE1E,IAAG,IAAI,CAAC,YAAY,IAAI,QAAQ;oBAC5B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,mBAAmB,CAAC,CAAC;gBAEtE,IAAI,mBAAmB,IAAI,WAAW,EAAE;oBACpC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;oBAC5B,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;wBAC/B,MAAM,EAAE,gBAAgB;qBAC3B,CAAC,CAAC;iBACN;aACJ;YAED,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAA,GAAG;;gBAIvB,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;oBACxC,OAAO;gBAEX,IAAI,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAqB,CAAC;gBAC3D,IAAI,aAAa,GAAG,CAAC,MAAA,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,CAAC;gBAC5D,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;gBAG5C,IAAG,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,IAAI,CAAC,KAAK,4BAAY,CAAC,IAAI,EAAE;oBAClE,IAAI,WAAW,GAAG,KAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;oBAEvF,IAAI,KAAI,CAAC,UAAU,IAAI,WAAW,IAAI,KAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC;wBAC5E,KAAI,CAAC,SAAS,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;iBAC7C;qBAEI,IAAG,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,OAAO,CAAC,KAAK,4BAAY,CAAC,OAAO,EAAE;oBAC7E,IAAI,WAAW,GAAG,KAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;oBAE7F,IAAI,aAAa,IAAI,WAAW,IAAI,KAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,kBAAkB,CAAC;wBAC7E,KAAI,CAAC,SAAS,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;iBAC7C;YACL,CAAC,CAAC,CAAC;YAIH,IACI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;gBACnF,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAC,wBAAwB,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;gBACpH,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAC7E;gBACE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;gBAClC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAChB,OAAO;aACV;YAID,IAAI,QAAQ,KAAK,IAAI,CAAC,YAAY,EAAE;gBAChC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;aAC7B;iBAAM;gBACH,IAAI,UAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAqB,CAAC;gBAEhE,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC;oBAC5B,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAExB,YAAY,GAAG,KAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;oBACpD,KAAI,CAAC,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;oBACnC,KAAI,CAAC,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;oBAEnC,KAAI,CAAC,aAAa,GAAG,UAAU,CAAC;wBAC5B,IAAI,KAAI,CAAC,QAAQ,CAAC,WAAW,EAAE;4BAE3B,OAAM,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAI,CAAC,aAAa,CAAC,KAAK,KAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;gCACjG,CAAC,KAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAI,CAAC,aAAa,CAAC,CAAC;gCACxE,KAAI,CAAC,aAAa,EAAE,CAAA;4BAExB,KAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,KAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAI,CAAC,aAAa,CAAC,CAA8B,CAAC,CAAA;4BACjI,KAAI,CAAC,aAAa,EAAE,CAAC;yBACxB;6BAAM;4BACH,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;4BAGjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gCACvD,MAAM,IAAI,UAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;gCAEvC,IAAI,MAAM,IAAI,CAAC,EAAE;oCAEb,IAAI,CAAC,IAAI,KAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;wCACrD,CAAC,EAAE,CAAA;oCAEP,KAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAA8B,CAAC,CAAC;oCAEzF,MAAM;iCACT;6BACJ;yBACJ;oBACL,CAAC,EAAE,KAAI,CAAC,eAAe,CAAC,UAAQ,CAAC,UAAU,EAAE,UAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC;gBAC/E,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,UAAQ,CAAC,UAAU,EAAE,UAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAA;aAC7E;QACL,CAAC;QAEM,kCAAS,GAAhB,UAAiB,MAAiC,EAAE,MAAmB;YAAvE,iBA4EC;YA5EmD,uBAAA,EAAA,WAAmB;YACnE,IAAI,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAA4B,CAAC;YAC1E,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAEjE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACrC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAE/B,UAAU,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC;YAI5D,MAAM,CAAC,kBAAkB,EAAE,CAAC;YAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAEzB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;gBACpB,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI;gBACvC,MAAM,EAAE,MAAM;aACjB,CAAC,CAAC;YAIH,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAEnC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,UAAC,GAAG,EAAE,CAAC;gBACzC,IAAG,KAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;oBACjC,OAAO;gBAEX,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;gBAE1D,IAAI,WAAW,GAAG,WAAW,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;gBACxE,IAAI,YAAY,GAAG,GAAG,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;gBACrD,GAAG,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;gBACtC,IAAI,KAAK,GAAG,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,GAAG,IAAK,OAAA,GAAG,GAAG,GAAG,EAAT,CAAS,CAAC,CAAC;gBAEjE,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACjD,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC;wBAC5B,SAAS;oBAEb,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,YAAY,CAAC;iBAC7E;gBAED,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;YAGH,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE;gBACnE,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAChB,OAAO;aACV;YAID,IAAG,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW,EAAE;gBACrH,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBAC9E,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE;oBACpE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;oBAC5B,IAAI,CAAC,SAAS,CAAC,kBAAkB,EAAE;wBAC/B,MAAM,EAAE,eAAe;qBAC1B,CAAC,CAAC;iBACN;aACJ;YAED,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAA,GAAG;gBACvB,IAAI,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAqB,CAAC;gBAK3D,IAAI,GAAG,IAAI,KAAI,CAAC,WAAW,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;oBAChD,OAAO;gBAEX,IAAG,CAAC,QAAQ,CAAC,YAAY,GAAG,4BAAY,CAAC,WAAW,CAAC,KAAK,4BAAY,CAAC,WAAW,EAAE;oBAChF,IAAI,KAAI,CAAC,aAAa,CAAC,MAAM,IAAI,QAAQ,CAAC,gBAAgB,IAAI,KAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,sBAAsB,CAAC;wBAC3G,KAAI,CAAC,SAAS,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;iBAC5C;YACL,CAAC,CAAC,CAAC;QACP,CAAC;QAID,uCAAc,GAAd,UAAe,CAAS;YAEpB,IAAI,OAAO,GAAG,EAAE,CAAC;YACjB,IAAI,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAErH,IAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC3C,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CACxB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EACzB,OAAO,GAAG,YAAY,CACzB,CAAC;aACL;YAED,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CAExB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,EAEpG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC;gBACrD,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;gBAC9B,CAAC,CAAC,OAAO,GAAG,YAAY,CAC/B,CAAC;QACN,CAAC;QAED,+CAAsB,GAAtB,UAAuB,CAAS,EAAE,MAAiC;YAC/D,IAAI,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YAEtC,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CACxB,QAAQ,CAAC,CAAC,EACV,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CACpG,CAAC;QACN,CAAC;QAED,0CAAiB,GAAjB;YACI,IAAI,OAAO,GAAG,EAAE,CAAC;YAEjB,IAAG,IAAI,CAAC,QAAQ,CAAC,YAAY;gBACzB,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,CAAC;YAEhF,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CACxB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EACzB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,CACnC,CAAC;QACN,CAAC;QAED,kDAAyB,GAAzB,UAA0B,MAAiC;YACvD,IAAI,QAAQ,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAExC,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CACxB,QAAQ,CAAC,CAAC,EACV,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,CAC7G,CAAC;QACN,CAAC;QAGD,8CAAqB,GAArB,UAAsB,MAAiC;YACnD,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACtF,CAAC;QAGD,8CAAqB,GAArB,UAAsB,MAAiC;YACnD,OAAO,IAAI,gBAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACtF,CAAC;QAED,wCAAe,GAAf,UAAgB,IAAY,EAAE,QAAgB;YAC1C,OAAO,IAAI,GAAG,CAAC,gBAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,gBAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QAClF,CAAC;QAED,oCAAW,GAAX,UAAY,MAAc;YACtB,OAAO,gBAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC;QACrD,CAAC;QAED,sCAAa,GAAb;YACI,IAAI,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5E,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;YAE3D,OAAO,UAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,cAAI,IAAI,CAAC,aAAa,EAAE,cAAI,IAAI,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAG,IAAI,CAAC,aAAa,EAAE,CAAE,CAAC;QACnI,CAAC;QAED,kCAAS,GAAT,UAAU,IAAY,EAAE,IAAc;YAAd,qBAAA,EAAA,SAAc;YAClC,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC;YAEzC,MAAM,CAAC,MAAM,CAAC,WAAW,YACrB,IAAI,EAAE,IAAI,IACP,IAAI,GACR,GAAG,CAAC,CAAC;QACZ,CAAC;QACL,qBAAC;IAAD,CArlBA,AAqlBC,CArlBmC,gBAAM,CAAC,KAAK,GAqlB/C;IArlBY,wCAAc","file":"app-bundle.js","sourcesContent":["import { RouterConfiguration, Router } from 'aurelia-router';\n\nexport class App {\n router: Router;\n\n configureRouter(config: RouterConfiguration, router: Router): void {\n this.router = router;\n\n config.title = 'Cyberball';\n\n config.map([\n { route: ['', 'home'], name: 'home', moduleId: 'pages/home' },\n { route: 'game', name: 'game', moduleId: 'pages/game' },\n { route: 'message-test', name: 'message-test', moduleId: 'pages/message-test' }\n ]);\n }\n}\n","\n","export function getVariantValue(base: number, variance: number): number {\r\n return base + (Phaser.Math.RND.between(0, variance) * Phaser.Math.RND.sign());\r\n}\r\n","export enum LeaveTrigger {\r\n None = 0,\r\n Turn = 1,\r\n Time = 1 << 1,\r\n Ignored = 1 << 2,\r\n OtherLeaver = 1 << 3,\r\n TimeIgnored = 1 << 4\r\n}\r\n","export default {\n debug: true,\n testing: true\n};\n","export function getCaughtBallPosition(player: Phaser.GameObjects.Sprite) {\n return { x: player.x + (player.flipX ? -50 : 50), y: player.y - 15 };\n}\n\nexport function getActiveBallPosition(player: Phaser.GameObjects.Sprite) {\n return { x: player.x + (player.flipX ? 40 : -40), y: player.y - 20 };\n}\n","import {Aurelia} from 'aurelia-framework'\nimport environment from './environment';\n\nexport function configure(aurelia: Aurelia) {\n aurelia.use\n .standardConfiguration()\n .feature('resources');\n\n aurelia.use.developmentLogging(environment.debug ? 'debug' : 'warn');\n\n if (environment.testing) {\n aurelia.use.plugin('aurelia-testing');\n }\n\n aurelia.start().then(() => aurelia.setRoot());\n}\n","export class BanterModel {\n chance: number;\n delay: number;\n delayVariance: number;\n messages: Array;\n}\n","import { CyberballScene } from 'scenes/cyberball';\r\nimport { CpuSettingsModel } from './cpu-settings-model';\r\nimport { Player } from \"./player-model\";\r\n\r\n// TODO: WIP isolate game logic into more classes.\r\nexport class Cpu extends Player {\r\n public settings: CpuSettingsModel;\r\n\r\n constructor(settings: CpuSettingsModel, gameReference: CyberballScene) {\r\n super(settings, gameReference);\r\n }\r\n}\r\n","import { BanterModel } from './banter-model';\r\nimport { PlayerSettingsModel } from './player-settings-model';\r\n\r\nexport class CpuSettingsModel extends PlayerSettingsModel {\r\n // A set of weights for each possible target, adding up to 100%.\r\n targetPreference: Array = [50, 50];\r\n\r\n throwDelay: number = 500;\r\n throwDelayVariance: number = 200;\r\n\r\n catchDelay: number = 500;\r\n catchDelayVariance: number = 200;\r\n\r\n introductionBanter?: BanterModel;\r\n throwBanter?: BanterModel\r\n catchBanter?: BanterModel\r\n leftOutBanter?: BanterModel\r\n\r\n boredomBanterThreshold?: number;\r\n boredomBanter?: BanterModel;\r\n\r\n leaveTurnChance?: number = 100;\r\n leaveTimeChance?: number = 100;\r\n leaveIgnoredChance?: number = 100;\r\n leaveTimeIgnoredChance?: number = 100;\r\n leaveOtherLeaverChance?: number = 50;\r\n\r\n constructor(init?: Partial) {\r\n super();\r\n\r\n if(init)\r\n Object.assign(this, init);\r\n }\r\n}\r\n","import { getVariantValue } from './../behaviors/get-variant-value';\r\nimport { LeaveTrigger } from 'enums/leave-trigger';\r\nimport { CyberballScene } from './../scenes/cyberball';\r\nimport { PlayerSettingsModel } from './player-settings-model';\r\n\r\n// TODO: WIP isolate game logic into more classes.\r\nexport class Player {\r\n public settings: PlayerSettingsModel;\r\n protected gameReference: CyberballScene\r\n\r\n // State\r\n public hasBall: boolean = false;\r\n public leaveTimeThreshold: number;\r\n public leaveIgnoreTimeThreshold: number;\r\n\r\n // Graphics\r\n protected group: Phaser.Physics.Arcade.Group;\r\n public sprite: Phaser.GameObjects.Sprite;\r\n protected nameText: Phaser.GameObjects.Text;\r\n protected portrait: Phaser.GameObjects.Image;\r\n\r\n constructor(settings: PlayerSettingsModel, gameReference: CyberballScene) {\r\n this.settings = settings;\r\n this.gameReference = gameReference;\r\n }\r\n\r\n public create() {\r\n // Graphics\r\n\r\n let position = this.getPosition();\r\n\r\n this.group = this.gameReference.physics.add.group({ immovable: true, allowGravity: false });\r\n\r\n // TODO: Separate spritesheet and animation from game into separate class?\r\n this.sprite = this.group.create(position.x, position.y, 'player', 'active/1.png');\r\n\r\n if (this.settings.tint)\r\n this.sprite.setTint(parseInt(this.settings.tint.substring(1), 16));\r\n\r\n this.nameText = this.gameReference.add.text(\r\n position.x,\r\n position.y + this.sprite.height / 2 + 10,\r\n this.settings.name,\r\n { fontFamily: 'Arial', color: '#000000' }\r\n ).setOrigin(0.5);\r\n\r\n if (this.settings.portrait) {\r\n let portraitPosition = this.getPortraitPosition();\r\n // TODO: Load portrait in constructor?\r\n this.portrait = this.gameReference.add.image(portraitPosition.x, portraitPosition.y, 'playerPortrait');\r\n }\r\n\r\n // Triggers\r\n\r\n if ((this.settings.leaveTrigger & LeaveTrigger.Time) === LeaveTrigger.Time) {\r\n this.leaveTimeThreshold = Date.now() + getVariantValue(this.settings.leaveTime, this.settings.leaveTimeVariance) * 1000;\r\n }\r\n\r\n if ((this.settings.leaveTrigger & LeaveTrigger.TimeIgnored) === LeaveTrigger.TimeIgnored) {\r\n this.leaveIgnoreTimeThreshold = Date.now() + getVariantValue(this.settings.leaveTimeIgnored, this.settings.leaveTimeIgnoredVariance) * 1000;\r\n }\r\n }\r\n\r\n // TODO: This feels gross.\r\n protected getPosition(): Phaser.Geom.Point {\r\n let padding = 75;\r\n\r\n if(this.gameReference.settings.hasPortraits)\r\n padding += this.gameReference.settings.portraitHeight + this.gameReference.settings.portraitPadding * 2;\r\n\r\n return new Phaser.Geom.Point(\r\n this.gameReference.sys.canvas.width / 2,\r\n this.gameReference.sys.canvas.height - padding\r\n );\r\n }\r\n\r\n protected getPortraitPosition(): Phaser.Geom.Point {\r\n var position = this.getPosition();\r\n\r\n return new Phaser.Geom.Point(\r\n position.x,\r\n position.y + this.gameReference.settings.portraitHeight / 2 + this.gameReference.settings.portraitPadding * 2 + this.sprite.height / 2 + 10\r\n );\r\n }\r\n}\r\n","import { LeaveTrigger } from \"enums/leave-trigger\";\r\n\r\nexport class PlayerSettingsModel {\r\n name: string;\r\n tint?: string;\r\n\r\n portrait?: string;\r\n\r\n /** Actions that may trigger a leave by this player. */\r\n leaveTrigger?: LeaveTrigger = LeaveTrigger.None;\r\n\r\n /** This player may leave after this many turns. */\r\n leaveTurn?: number = 10;\r\n leaveTurnVariance?: number = 2;\r\n\r\n /** This player may leave after this much time. (Seconds) */\r\n leaveTime?: number = 120;\r\n leaveTimeVariance?: number = 30;\r\n\r\n /** This player may leave after not catching the ball for this many turns. */\r\n leaveIgnored?: number = 10;\r\n leaveIgnoredVariance?: number = 2;\r\n\r\n /** This player may leave after not catching the ball for this much time. (Seconds) */\r\n leaveTimeIgnored?: number = 45;\r\n leaveTimeIgnoredVariance?: number = 15;\r\n\r\n /** This player may leave after this many other players leave. */\r\n leaveOtherLeaver?: number = 2;\r\n\r\n constructor(init?: Partial) {\r\n if(init)\r\n Object.assign(this, init);\r\n }\r\n}\r\n","import { PlayerSettingsModel } from './player-settings-model';\r\nimport { CpuSettingsModel } from './cpu-settings-model';\r\n\r\nexport class SettingsModel {\r\n player: PlayerSettingsModel = new PlayerSettingsModel();\r\n computerPlayers: Array;\r\n\r\n // Gameplay\r\n throwCount: number = 10;\r\n timeLimit: number = 0;\r\n displayTimeLimit: boolean = false;\r\n timeLimitText: string = 'Time Limit:';\r\n ballSpeed: number = 500;\r\n\r\n useSchedule: boolean = false;\r\n scheduleHonorsThrowCount: boolean = false;\r\n schedule: Array = [\r\n 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0\r\n ];\r\n\r\n // Graphics\r\n baseUrl: string = './assets';\r\n\r\n ballSprite: string = 'ball.png';\r\n ballTint?: string;\r\n\r\n portraitHeight: number = 75;\r\n portraitPadding: number = 10;\r\n\r\n get hasPortraits(): boolean | string {\r\n return this.player.portrait || this.computerPlayers.some(cpu => cpu.portrait);\r\n }\r\n\r\n // Misc\r\n chatEnabled: boolean = false;\r\n\r\n gameOverText: string = \"Game Over\";\r\n gameOverOpacity: number = 0.5;\r\n\r\n constructor(init?: Partial) {\r\n Object.assign(this, init);\r\n }\r\n}\r\n\r\nexport const defaultSettings = new SettingsModel({\r\n player: new PlayerSettingsModel({\r\n name: 'Player 1'\r\n }),\r\n computerPlayers: [\r\n new CpuSettingsModel({\r\n name: 'Player 2'\r\n }),\r\n new CpuSettingsModel({\r\n name: 'Player 3'\r\n })\r\n ]\r\n});\r\n","import { CyberballScene } from './../scenes/cyberball';\nimport { defaultSettings, SettingsModel } from './../models/settings-model';\nimport Phaser from 'phaser';\nimport { PhaserGameCustomElement } from 'resources/phaser-game/phaser-game';\n\n// // TODO: Use events to talk to Qualtrics?\n// //setTimeout(() => { window.dispatchEvent(new CustomEvent('complete', { detail: { test: 'test' } }))}, 1000)\n\n\nexport class GameViewModel {\n settings: SettingsModel = defaultSettings;\n\n // Game:\n\n game: PhaserGameCustomElement;\n\n gameWidth = 800;\n gameHeight = 460;\n\n gameConfig: Phaser.Types.Core.GameConfig;\n\n activate(params) {\n if('settings' in params) {\n this.settings = new SettingsModel(JSON.parse(atob(params.settings)));\n }\n\n if('playerName' in params) {\n this.settings.player.name = params.playerName;\n }\n\n if(this.settings.hasPortraits) {\n this.gameHeight += this.settings.portraitHeight * 2 + this.settings.portraitPadding * 4;\n }\n }\n\n bind() {\n this.gameConfig = {\n type: Phaser.AUTO,\n width: this.gameWidth,\n height: this.gameHeight,\n scene: new CyberballScene(this.settings),\n physics: {\n default: 'arcade'\n }\n };\n }\n\n // Chat:\n\n chatMessage: string;\n chatMessages: Array<{sender: string, text: string}> = [];\n\n sendMessage() {\n this.chatMessages.push({\n sender: this.settings.player.name,\n text: this.chatMessage\n });\n\n this.chatMessage = '';\n }\n}\n","canvas {\n max-width: 100%;\n}\n\n.chat-log {\n border: 1px solid black;\n border-bottom: 0;\n height: 100px;\n overflow-y: auto;\n}\n\n.chat-input {\n display: flex;\n}\n\n.chat-input input {\n flex: 1;\n}\n","\n","import {BindingSignaler} from 'aurelia-templating-resources';\r\nimport {autoinject} from 'aurelia-framework';\r\nimport { SettingsModel, defaultSettings } from \"models/settings-model\";\r\nimport { CpuSettingsModel } from 'models/cpu-settings-model';\r\nimport ClipboardJS from 'clipboard';\r\n\r\n@autoinject()\r\nexport class HomeViewModel {\r\n settings: SettingsModel = defaultSettings;\r\n clipboard: ClipboardJS;\r\n\r\n constructor(private signaler: BindingSignaler) {}\r\n\r\n bind() {\r\n this.clipboard = new ClipboardJS('#copy');\r\n }\r\n\r\n unbind() {\r\n this.clipboard.destroy();\r\n }\r\n\r\n addCPU() {\r\n this.settings.computerPlayers.push(new CpuSettingsModel({\r\n name: `Player ${this.settings.computerPlayers.length + 2}`\r\n }));\r\n\r\n this.settings.computerPlayers.forEach(cpu => {\r\n while(cpu.targetPreference.length != this.settings.computerPlayers.length)\r\n cpu.targetPreference.push(0);\r\n });\r\n }\r\n\r\n removeCPU() {\r\n this.settings.computerPlayers.pop();\r\n\r\n this.settings.computerPlayers.forEach(cpu => {\r\n cpu.targetPreference.pop();\r\n });\r\n }\r\n\r\n saveSettings() {\r\n this.signaler.signal('save-settings');\r\n }\r\n\r\n get url() {\r\n let url = document.location.origin + document.location.pathname;\r\n\r\n url += '#game?settings=';\r\n url += btoa(JSON.stringify(this.settings));\r\n\r\n return url;\r\n }\r\n\r\n testGame() {\r\n window.open(this.url);\r\n }\r\n}\r\n","\r\n","import {BindingSignaler} from 'aurelia-templating-resources';\nimport {autoinject} from 'aurelia-framework';\n\n@autoinject()\nexport class MessageTestViewModel {\n messages: Array = [];\n\n constructor(private signaler: BindingSignaler) {}\n\n bind() {\n window.addEventListener('message', (e) => {\n console.log('message', e.data);\n this.messages.push(e.data);\n\n this.signaler.signal('message');\n });\n }\n}\n","\n","import { FrameworkConfiguration, PLATFORM } from 'aurelia-framework';\n\nexport function configure(config: FrameworkConfiguration) {\n config.globalResources(PLATFORM.moduleName('./phaser-game/phaser-game'));\n}\n","import { customElement, bindable, autoinject, inlineView } from \"aurelia-framework\";\nimport Phaser from 'phaser';\n\n@customElement('phaser-game')\n@autoinject()\n@inlineView('')\nexport class PhaserGameCustomElement {\n @bindable config: Phaser.Types.Core.GameConfig;\n @bindable game: Phaser.Game;\n\n constructor(protected element: Element) {\n\n }\n\n bind() {\n this.config.parent = this.element as HTMLElement;\n this.game = new Phaser.Game(this.config);\n }\n}\n","export class FlagValueConverter {\r\n fromView(value, source, flag) {\r\n return value ? source | flag : source & ~flag;\r\n }\r\n\r\n toView(_value, source, flag) {\r\n return (source & flag) === flag;\r\n }\r\n}\r\n","export class IntegerArrayValueConverter {\n fromView(value: string) {\n // Remove anything but numbers and commas.\n value = value.replace(/[^0-9,]/g, '');\n\n // Remove any trailing comma.\n if(value[value.length - 1] == ',')\n value = value.substr(0, value.length - 1);\n\n return JSON.parse(`[${value}]`);\n }\n\n toView(value: Array) {\n return JSON.stringify(value).substr(1, value.length * 2 - 1);\n }\n}\n","export class IntegerValueConverter {\r\n fromView(value) {\r\n return parseInt(value ?? '0');\r\n }\r\n}\r\n","export class JsonValueConverter {\n toView(value) {\n return JSON.stringify(value, null, 2);\n }\n}\n","export class NumberValueConverter {\r\n fromView(value) {\r\n return parseFloat(value ?? '0');\r\n }\r\n}\r\n","import { Player } from './../models/player-model';\r\nimport { LeaveTrigger } from 'enums/leave-trigger';\r\nimport { SettingsModel } from './../models/settings-model';\r\nimport Phaser from 'phaser';\r\nimport { CpuSettingsModel } from 'models/cpu-settings-model';\r\n\r\nconst textStyle = { fontFamily: 'Arial', color: '#000000' };\r\n\r\n\r\nexport class CyberballScene extends Phaser.Scene {\r\n public settings: SettingsModel;\r\n\r\n // Game Objects:\r\n private player: Player;\r\n\r\n private ballSprite: Phaser.GameObjects.Sprite;\r\n private playerSprite: Phaser.GameObjects.Sprite;\r\n private playerGroup: Phaser.Physics.Arcade.Group;\r\n private cpuSprites: Phaser.GameObjects.Sprite[] = [];\r\n private timeLimitText: Phaser.GameObjects.Text;\r\n\r\n // Gameplay Mechanics:\r\n\r\n private playerHasBall = true;\r\n private ballHeld = true;\r\n private throwTarget: Phaser.GameObjects.Sprite;\r\n\r\n private activeTimeout;\r\n\r\n private absentPlayers: number[] = [];\r\n private showPlayerLeave: boolean = false;\r\n\r\n private gameEnded = false;\r\n\r\n // Stats:\r\n\r\n private throwCount = 0;\r\n private scheduleIndex = 0;\r\n private lastTime: number;\r\n private startTime: number;\r\n\r\n constructor(settings: SettingsModel) {\r\n super({});\r\n\r\n this.settings = settings;\r\n }\r\n\r\n public preload() {\r\n this.load.crossOrigin = 'anonymous';\r\n\r\n // TODO: Load from settings.\r\n this.load.image('ball', `${this.settings.baseUrl}/${this.settings.ballSprite}`);\r\n this.load.multiatlas('player', `${this.settings.baseUrl}/player.json`, 'assets');\r\n\r\n if(this.settings.player.portrait)\r\n this.load.image('playerPortrait', 'https://proxy.cors.sh/' + this.settings.player.portrait);\r\n\r\n this.settings.computerPlayers.forEach((cpu, i) => {\r\n if(cpu.portrait)\r\n this.load.image('cpuPortrait' + i, 'https://proxy.cors.sh/' + cpu.portrait);\r\n });\r\n }\r\n\r\n public create() {\r\n this.cameras.main.setBackgroundColor('#ffffff');\r\n\r\n // Animations:\r\n\r\n this.anims.create({\r\n key: 'active',\r\n frames: this.anims.generateFrameNames('player', { start: 1, end: 1, prefix: 'active/', suffix: '.png' })\r\n });\r\n\r\n this.anims.create({\r\n key: 'idle',\r\n frames: this.anims.generateFrameNames('player', { start: 1, end: 1, prefix: 'idle/', suffix: '.png' })\r\n });\r\n\r\n this.anims.create({\r\n key: 'throw',\r\n frameRate: 12,\r\n frames: this.anims.generateFrameNames('player', { start: 1, end: 3, prefix: 'throw/', suffix: '.png' })\r\n });\r\n\r\n this.anims.create({\r\n key: 'catch',\r\n frames: this.anims.generateFrameNames('player', { start: 1, end: 1, prefix: 'catch/', suffix: '.png' })\r\n });\r\n\r\n // Player:\r\n\r\n let playerPosition = this.getPlayerPosition();\r\n\r\n this.playerGroup = this.physics.add.group({ immovable: true, allowGravity: false });\r\n this.playerSprite = this.playerGroup.create(playerPosition.x, playerPosition.y, 'player', 'active/1.png');\r\n this.playerSprite.setData('settings', this.settings.player);\r\n\r\n if(this.settings.player.tint)\r\n this.playerSprite.setTint(parseInt(this.settings.player.tint.substr(1), 16));\r\n\r\n this.playerSprite.setData('name-object', this.add.text(playerPosition.x, playerPosition.y + this.playerSprite.height / 2 + 10, this.settings.player.name, textStyle).setOrigin(0.5));\r\n\r\n if(this.settings.player.portrait) {\r\n var portraitPosition = this.getPlayerPortraitPosition(this.playerSprite);\r\n var image = this.add.image(portraitPosition.x, portraitPosition.y, 'playerPortrait');\r\n\r\n image.setScale(this.settings.portraitHeight / image.height);\r\n }\r\n\r\n if((this.settings.player.leaveTrigger & LeaveTrigger.Time) === LeaveTrigger.Time) {\r\n this.playerSprite.setData('leaveTime', Date.now() + this.getVariantValue(this.settings.player.leaveTime, this.settings.player.leaveTimeVariance) * 1000);\r\n }\r\n\r\n if((this.settings.player.leaveTrigger & LeaveTrigger.TimeIgnored) === LeaveTrigger.TimeIgnored) {\r\n this.playerSprite.setData('leaveTimeIgnored', Date.now() + this.getVariantValue(this.settings.player.leaveTimeIgnored, this.settings.player.leaveTimeIgnoredVariance) * 1000);\r\n }\r\n\r\n // CPU:\r\n\r\n for (let i = 0; i < this.settings.computerPlayers.length; i++) {\r\n let cpuPosition = this.getCPUPosition(i);\r\n let cpuSprite: Phaser.GameObjects.Sprite = this.playerGroup.create(cpuPosition.x, cpuPosition.y, 'player', 'idle/1.png');\r\n\r\n cpuSprite.setData('name-object', this.add.text(cpuPosition.x, cpuPosition.y + cpuSprite.height / 2 + 10, this.settings.computerPlayers[i].name, textStyle).setOrigin(0.5));\r\n\r\n if(this.settings.computerPlayers[i].portrait) {\r\n var portraitPosition = this.getCPUPortraitPosition(i, cpuSprite);\r\n var image = this.add.image(portraitPosition.x, portraitPosition.y, 'cpuPortrait' + i);\r\n\r\n image.setScale(this.settings.portraitHeight / image.height);\r\n }\r\n\r\n cpuSprite.flipX = cpuPosition.x > this.playerSprite.x;\r\n cpuSprite.setData('settings', this.settings.computerPlayers[i]);\r\n\r\n if(this.settings.computerPlayers[i].tint)\r\n cpuSprite.setTint(parseInt(this.settings.computerPlayers[i].tint.substr(1), 16));\r\n\r\n cpuSprite.setInteractive();\r\n cpuSprite.on('pointerdown', (e) => {\r\n if (this.playerHasBall) {\r\n // Ensure player and ball are facing the correct way on touch devices:\r\n this.playerSprite.flipX = this.input.x < this.playerSprite.x;\r\n\r\n let ballPosition = this.getActiveBallPosition(this.playerSprite);\r\n this.ballSprite.x = ballPosition.x;\r\n this.ballSprite.y = ballPosition.y;\r\n\r\n this.throwBall(this.playerSprite, cpuSprite);\r\n }\r\n });\r\n\r\n if((this.settings.computerPlayers[i].leaveTrigger & LeaveTrigger.Time) === LeaveTrigger.Time) {\r\n cpuSprite.setData('leaveTime', Date.now() + this.getVariantValue(this.settings.computerPlayers[i].leaveTime, this.settings.computerPlayers[i].leaveTimeVariance) * 1000);\r\n }\r\n\r\n if((this.settings.computerPlayers[i].leaveTrigger & LeaveTrigger.TimeIgnored) === LeaveTrigger.TimeIgnored) {\r\n cpuSprite.setData('leaveTimeIgnored', Date.now() + this.getVariantValue(this.settings.computerPlayers[i].leaveTimeIgnored, this.settings.computerPlayers[i].leaveTimeIgnoredVariance) * 1000);\r\n }\r\n\r\n this.cpuSprites.push(cpuSprite);\r\n }\r\n\r\n // Ball:\r\n\r\n let ballPosition = this.getActiveBallPosition(this.playerSprite);\r\n this.ballSprite = this.physics.add.sprite(ballPosition.x, ballPosition.y, 'ball');\r\n\r\n if(this.settings.ballTint)\r\n this.ballSprite.setTint(parseInt(this.settings.ballTint.substr(1), 16));\r\n\r\n this.physics.add.overlap(this.ballSprite, this.playerGroup, (_b, receiver) => {\r\n if (!this.ballHeld && receiver === this.throwTarget)\r\n this.catchBall(receiver as Phaser.GameObjects.Sprite);\r\n });\r\n\r\n // Time Limit:\r\n\r\n this.startTime = Date.now();\r\n this.lastTime = this.startTime;\r\n\r\n if (this.settings.timeLimit > 0 && this.settings.displayTimeLimit) {\r\n this.timeLimitText = this.add.text(this.sys.canvas.width - 10, 10, this.getTimeString(), textStyle);\r\n this.timeLimitText.setOrigin(1, 0);\r\n }\r\n }\r\n\r\n public update() {\r\n if(this.gameEnded)\r\n return;\r\n\r\n if (this.playerHasBall) {\r\n this.playerSprite.play('active');\r\n this.playerSprite.flipX = this.input.x < this.playerSprite.x;\r\n\r\n let ballPosition = this.getActiveBallPosition(this.playerSprite);\r\n this.ballSprite.x = ballPosition.x;\r\n this.ballSprite.y = ballPosition.y;\r\n } else if (!this.ballHeld) {\r\n // Eyes on the ball:\r\n this.playerGroup.getChildren().forEach(c => {\r\n let sprite = c as Phaser.GameObjects.Sprite;\r\n if (sprite.frame.name.includes('idle'))\r\n sprite.flipX = this.ballSprite.x < sprite.x\r\n });\r\n }\r\n\r\n // Player may leave after time has passed:\r\n if(!this.showPlayerLeave && (this.settings.player.leaveTrigger & LeaveTrigger.Time) === LeaveTrigger.Time &&\r\n Date.now() > this.playerSprite.getData('leaveTime')) {\r\n this.showPlayerLeave = true;\r\n this.postEvent('player-may-leave', {\r\n reason: 'time elapsed'\r\n });\r\n }\r\n // Player may leave after ignored for a time:\r\n else if (!this.playerHasBall && !this.showPlayerLeave && (this.settings.player.leaveTrigger & LeaveTrigger.TimeIgnored) === LeaveTrigger.TimeIgnored &&\r\n Date.now() > this.playerSprite.getData('leaveTimeIgnored')) {\r\n this.showPlayerLeave = true;\r\n this.postEvent('player-may-leave', {\r\n reason: 'time ignored'\r\n });\r\n }\r\n\r\n this.cpuSprites.forEach(cpu => {\r\n // CPU shouldn't leave if they:\r\n // - have the ball or are about to catch the ball\r\n // - have already left\r\n if (cpu == this.throwTarget || cpu.getData('absent'))\r\n return;\r\n\r\n let settings = cpu.getData('settings') as CpuSettingsModel;\r\n\r\n // CPU may leave after some time\r\n if((settings.leaveTrigger & LeaveTrigger.Time) === LeaveTrigger.Time &&\r\n Date.now() > cpu.getData('leaveTime')) {\r\n this.leaveGame(cpu, 'time elapsed');\r\n }\r\n // CPU may leave after ignored for a time:\r\n else if ((settings.leaveTrigger & LeaveTrigger.TimeIgnored) === LeaveTrigger.TimeIgnored &&\r\n Date.now() > cpu.getData('leaveTimeIgnored')) {\r\n this.leaveGame(cpu, 'time ignored');\r\n }\r\n });\r\n\r\n // Time Limit:\r\n\r\n if (this.settings.timeLimit > 0 && this.settings.displayTimeLimit)\r\n this.timeLimitText.setText(this.getTimeString());\r\n\r\n if (this.settings.timeLimit > 0 && Date.now() - this.startTime > this.settings.timeLimit) {\r\n this.postEvent('global-time-limit');\r\n this.gameOver();\r\n }\r\n }\r\n\r\n public gameOver() {\r\n if (this.gameEnded)\r\n return;\r\n\r\n this.gameEnded = true;\r\n\r\n this.postEvent('game-end');\r\n\r\n // Stop future throws:\r\n clearTimeout(this.activeTimeout);\r\n this.playerGroup.children.iterate(child => {\r\n child.removeAllListeners();\r\n return true;\r\n });\r\n\r\n // Draw game over screen:\r\n this.add.rectangle(this.sys.canvas.width / 2, this.sys.canvas.height / 2, this.sys.canvas.width, this.sys.canvas.height, 0xdddddd, this.settings.gameOverOpacity);\r\n this.add.text(this.sys.canvas.width / 2, this.sys.canvas.height / 2, this.settings.gameOverText, textStyle).setOrigin(0.5);\r\n }\r\n\r\n // Mechanics:\r\n\r\n public throwBall(thrower: Phaser.GameObjects.Sprite, receiver: Phaser.GameObjects.Sprite) {\r\n this.postEvent('throw', {\r\n thrower: thrower.getData('settings').name,\r\n receiver: receiver.getData('settings').name,\r\n wait: Date.now() - this.lastTime\r\n });\r\n\r\n this.lastTime = Date.now();\r\n\r\n // Update trackers:\r\n\r\n // Wait until the player throws the ball to reset their ignored timer, so they cannot ignore themselves.\r\n let throwerSettings = thrower.getData('settings');\r\n // TODO: Bug\r\n if((throwerSettings.leaveTrigger & LeaveTrigger.TimeIgnored) === LeaveTrigger.TimeIgnored) {\r\n receiver.setData('leaveTimeIgnored', Date.now() + this.getVariantValue(throwerSettings.leaveTimeIgnored, throwerSettings.leaveTimeIgnoredVariance) * 1000);\r\n }\r\n\r\n this.playerHasBall = this.ballHeld = false;\r\n this.throwTarget = receiver;\r\n\r\n this.throwCount++;\r\n\r\n // Player animation:\r\n\r\n thrower.play('throw');\r\n thrower.playAfterRepeat('idle');\r\n\r\n // Ball physics:\r\n\r\n let ballTargetPosition = this.getCaughtBallPosition(receiver);\r\n this.physics.moveTo(this.ballSprite, ballTargetPosition.x, ballTargetPosition.y, this.settings.ballSpeed);\r\n }\r\n\r\n public catchBall(receiver: Phaser.GameObjects.Sprite) {\r\n // Update trackers:\r\n\r\n this.ballHeld = true;\r\n receiver.setData('throwsIgnored', 0)\r\n\r\n // Player animation:\r\n\r\n receiver.play('catch');\r\n\r\n // Ball physics:\r\n\r\n let ballPosition = this.getCaughtBallPosition(receiver);\r\n (this.ballSprite.body as Phaser.Physics.Arcade.Body).reset(ballPosition.x, ballPosition.y);\r\n\r\n // Check for leavers:\r\n\r\n // Player may leave after a number of turns:\r\n if(!this.showPlayerLeave && (this.settings.player.leaveTrigger & LeaveTrigger.Turn) === LeaveTrigger.Turn) {\r\n let leaveThrows = this.getVariantValue(this.settings.player.leaveTurn, this.settings.player.leaveTurnVariance);\r\n\r\n if (this.throwCount >= leaveThrows) {\r\n this.showPlayerLeave = true;\r\n this.postEvent('player-may-leave', {\r\n reason: 'throws elapsed'\r\n });\r\n }\r\n }\r\n // Player may leave after ignored for a number of turns:\r\n else if(!this.showPlayerLeave && (this.settings.player.leaveTrigger & LeaveTrigger.Ignored) === LeaveTrigger.Ignored) {\r\n let leaveThrows = this.getVariantValue(this.settings.player.leaveIgnored, this.settings.player.leaveIgnoredVariance);\r\n let playerThrowsIgnored = this.playerSprite.getData('throwsIgnored') ?? 0;\r\n\r\n if(this.playerSprite != receiver)\r\n this.playerSprite.setData('throwsIgnored', ++playerThrowsIgnored);\r\n\r\n if (playerThrowsIgnored >= leaveThrows) {\r\n this.showPlayerLeave = true;\r\n this.postEvent('player-may-leave', {\r\n reason: 'throws ignored'\r\n });\r\n }\r\n }\r\n\r\n this.cpuSprites.forEach(cpu => {\r\n // CPU shouldn't leave if they:\r\n // - have the ball\r\n // - have already left\r\n if (cpu == receiver || cpu.getData('absent'))\r\n return;\r\n\r\n let settings = cpu.getData('settings') as CpuSettingsModel;\r\n let throwsIgnored = (cpu.getData('throwsIgnored') ?? 0) + 1;\r\n cpu.setData('throwsIgnored', throwsIgnored);\r\n\r\n // CPU may leave after a number of turns:\r\n if((settings.leaveTrigger & LeaveTrigger.Turn) === LeaveTrigger.Turn) {\r\n let leaveThrows = this.getVariantValue(settings.leaveTurn, settings.leaveTurnVariance);\r\n\r\n if (this.throwCount >= leaveThrows && this.checkChance(settings.leaveTurnChance))\r\n this.leaveGame(cpu, 'throws elapsed');\r\n }\r\n // CPU may leave after ignored for a number of turns:\r\n else if((settings.leaveTrigger & LeaveTrigger.Ignored) === LeaveTrigger.Ignored) {\r\n let leaveThrows = this.getVariantValue(settings.leaveIgnored, settings.leaveIgnoredVariance);\r\n\r\n if (throwsIgnored >= leaveThrows && this.checkChance(settings.leaveIgnoredChance))\r\n this.leaveGame(cpu, 'throws ignored');\r\n }\r\n });\r\n\r\n // The game ends at the end of the schedule or when reaching the throw count.\r\n\r\n if (\r\n (this.settings.useSchedule && this.scheduleIndex === this.settings.schedule.length) ||\r\n (this.settings.useSchedule && this.settings.scheduleHonorsThrowCount && this.throwCount >= this.settings.throwCount) ||\r\n (!this.settings.useSchedule && this.throwCount >= this.settings.throwCount)\r\n ) {\r\n this.postEvent('throw-count-met');\r\n this.gameOver();\r\n return;\r\n }\r\n\r\n // Prepare for next throw:\r\n\r\n if (receiver === this.playerSprite) {\r\n this.playerHasBall = true;\r\n } else {\r\n let settings = receiver.getData('settings') as CpuSettingsModel;\r\n\r\n this.activeTimeout = setTimeout(() => {\r\n receiver.play('active');\r\n\r\n ballPosition = this.getActiveBallPosition(receiver);\r\n this.ballSprite.x = ballPosition.x;\r\n this.ballSprite.y = ballPosition.y;\r\n\r\n this.activeTimeout = setTimeout(() => {\r\n if (this.settings.useSchedule) {\r\n // Skip self and absent players in schedule.\r\n while(this.settings.schedule[this.scheduleIndex] === this.playerGroup.getChildren().indexOf(receiver) &&\r\n !this.absentPlayers.includes(this.settings.schedule[this.scheduleIndex]))\r\n this.scheduleIndex++\r\n\r\n this.throwBall(receiver, this.playerGroup.getChildren()[this.settings.schedule[this.scheduleIndex]] as Phaser.GameObjects.Sprite)\r\n this.scheduleIndex++;\r\n } else {\r\n let random = Math.random() * 100;\r\n\r\n // A psuedo-random target is selected by subtracting the target preference chance from the random number until 0 is reached\r\n for (var i = 0; i < settings.targetPreference.length; i++) {\r\n random -= settings.targetPreference[i];\r\n\r\n if (random <= 0) {\r\n // Exclude self\r\n if (i >= this.playerGroup.getChildren().indexOf(receiver))\r\n i++\r\n\r\n this.throwBall(receiver, this.playerGroup.getChildren()[i] as Phaser.GameObjects.Sprite);\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }, this.getVariantValue(settings.throwDelay, settings.throwDelayVariance));\r\n }, this.getVariantValue(settings.catchDelay, settings.catchDelayVariance))\r\n }\r\n }\r\n\r\n public leaveGame(player: Phaser.GameObjects.Sprite, reason: string = '') {\r\n let nameObject = player.getData('name-object') as Phaser.GameObjects.Text;\r\n let playerIndex = this.playerGroup.getChildren().indexOf(player);\r\n\r\n this.absentPlayers.push(playerIndex);\r\n player.setData('absent', true);\r\n\r\n nameObject.setText([nameObject.text, 'has left the game.']);\r\n\r\n // Deactivate player object\r\n\r\n player.removeAllListeners();\r\n player.setVisible(false);\r\n\r\n this.postEvent('leave', {\r\n leaver: player.getData('settings').name,\r\n reason: reason\r\n });\r\n\r\n // Redistribute throw target weights:\r\n\r\n console.log('pindex', playerIndex);\r\n\r\n this.settings.computerPlayers.forEach((cpu, i) => {\r\n if(this.absentPlayers.includes(i + 1))\r\n return;\r\n\r\n console.log('distribute before', i, cpu.targetPreference);\r\n\r\n let targetIndex = playerIndex > (i + 1) ? playerIndex - 1 : playerIndex;\r\n let targetWeight = cpu.targetPreference[targetIndex];\r\n cpu.targetPreference[targetIndex] = 0;\r\n let total = cpu.targetPreference.reduce((acc, cur) => acc + cur);\r\n\r\n for(let k = 0; k < cpu.targetPreference.length; k++) {\r\n if (cpu.targetPreference[k] == 0)\r\n continue;\r\n\r\n cpu.targetPreference[k] += cpu.targetPreference[k] / total * targetWeight;\r\n }\r\n\r\n console.log('distribute after', i, cpu.targetPreference);\r\n });\r\n\r\n // If there is only one player left, end the game:\r\n if (this.absentPlayers.length >= this.settings.computerPlayers.length) {\r\n this.gameOver();\r\n return;\r\n }\r\n\r\n // Check if this triggers other players leaving:\r\n\r\n if(!this.showPlayerLeave && (this.settings.player.leaveTrigger & LeaveTrigger.OtherLeaver) === LeaveTrigger.OtherLeaver) {\r\n console.log(this.absentPlayers.length, this.settings.player.leaveOtherLeaver);\r\n if (this.absentPlayers.length >= this.settings.player.leaveOtherLeaver) {\r\n this.showPlayerLeave = true;\r\n this.postEvent('player-may-leave', {\r\n reason: 'other leavers'\r\n });\r\n }\r\n }\r\n\r\n this.cpuSprites.forEach(cpu => {\r\n let settings = cpu.getData('settings') as CpuSettingsModel;\r\n\r\n // CPU shouldn't leave if they:\r\n // - have the ball\r\n // - have already left\r\n if (cpu == this.throwTarget || cpu.getData('absent'))\r\n return;\r\n\r\n if((settings.leaveTrigger & LeaveTrigger.OtherLeaver) === LeaveTrigger.OtherLeaver) {\r\n if (this.absentPlayers.length >= settings.leaveOtherLeaver && this.checkChance(settings.leaveOtherLeaverChance))\r\n this.leaveGame(cpu, 'other leavers');\r\n }\r\n });\r\n }\r\n\r\n // Helpers:\r\n\r\n getCPUPosition(i: number): Phaser.Geom.Point {\r\n // TODO: Increase padding when portaits are enabled.\r\n let padding = 75;\r\n let extraPadding = this.settings.hasPortraits ? this.settings.portraitHeight + this.settings.portraitPadding * 2 : 0;\r\n\r\n if(this.settings.computerPlayers.length === 1) {\r\n return new Phaser.Geom.Point(\r\n this.sys.canvas.width / 2,\r\n padding + extraPadding\r\n );\r\n }\r\n\r\n return new Phaser.Geom.Point(\r\n // Evenly divide the width of the screen by the number of players.\r\n ((this.sys.canvas.width - (padding * 2)) / (this.settings.computerPlayers.length - 1)) * i + padding,\r\n // First and last player are closer in the middle, others stand along the edge.\r\n i === 0 || i === this.settings.computerPlayers.length - 1\r\n ? (this.sys.canvas.height / 2)\r\n : padding + extraPadding\r\n );\r\n }\r\n\r\n getCPUPortraitPosition(i: number, sprite: Phaser.GameObjects.Sprite): Phaser.Geom.Point {\r\n let position = this.getCPUPosition(i);\r\n\r\n return new Phaser.Geom.Point(\r\n position.x,\r\n position.y - this.settings.portraitHeight + this.settings.portraitPadding * 2 - sprite.height / 2\r\n );\r\n }\r\n\r\n getPlayerPosition(): Phaser.Geom.Point {\r\n let padding = 75;\r\n\r\n if(this.settings.hasPortraits)\r\n padding += this.settings.portraitHeight + this.settings.portraitPadding * 2;\r\n\r\n return new Phaser.Geom.Point(\r\n this.sys.canvas.width / 2,\r\n this.sys.canvas.height - padding\r\n );\r\n }\r\n\r\n getPlayerPortraitPosition(sprite: Phaser.GameObjects.Sprite): Phaser.Geom.Point {\r\n var position = this.getPlayerPosition();\r\n\r\n return new Phaser.Geom.Point(\r\n position.x,\r\n position.y + this.settings.portraitHeight / 2 + this.settings.portraitPadding * 2 + sprite.height / 2 + 10\r\n );\r\n }\r\n\r\n // TODO: This is invalid if the sprites are changed.\r\n getCaughtBallPosition(target: Phaser.GameObjects.Sprite) {\r\n return new Phaser.Geom.Point(target.x + (target.flipX ? -50 : 50), target.y - 15);\r\n }\r\n\r\n // TODO: This is invalid if the sprites are changed.\r\n getActiveBallPosition(target: Phaser.GameObjects.Sprite) {\r\n return new Phaser.Geom.Point(target.x + (target.flipX ? 40 : -40), target.y - 20);\r\n }\r\n\r\n getVariantValue(base: number, variance: number): number {\r\n return base + (Phaser.Math.RND.between(0, variance) * Phaser.Math.RND.sign());\r\n }\r\n\r\n checkChance(chance: number): boolean {\r\n return Phaser.Math.RND.between(0, 100) <= chance;\r\n }\r\n\r\n getTimeString(): string {\r\n let timeRemaining = this.settings.timeLimit - (Date.now() - this.startTime);\r\n let time = new Date(timeRemaining < 0 ? 0 : timeRemaining);\r\n\r\n return `${this.settings.timeLimitText} ${time.getUTCMinutes()}:${time.getUTCSeconds() < 10 ? '0' : ''}${time.getUTCSeconds()}`;\r\n }\r\n\r\n postEvent(type: string, data: any = {}): void {\r\n console.log('post event: ' + type, data);\r\n\r\n window.parent.postMessage({\r\n type: type,\r\n ...data\r\n }, '*');\r\n }\r\n}\r\n"]} \ No newline at end of file diff --git a/scripts/vendor-bundle.js b/scripts/vendor-bundle.js index 7e578b2..94d0124 100644 --- a/scripts/vendor-bundle.js +++ b/scripts/vendor-bundle.js @@ -1,4 +1,4 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";function e(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})}function t(e){return new this(function(t,n){function o(e,n){if(n&&("object"==typeof n||"function"==typeof n)){var f=n.then;if("function"==typeof f)return void f.call(n,function(t){o(e,t)},function(n){r[e]={status:"rejected",reason:n},0==--i&&t(r)})}r[e]={status:"fulfilled",value:n},0==--i&&t(r)}if(!e||"undefined"==typeof e.length)return n(new TypeError(typeof e+" "+e+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var r=Array.prototype.slice.call(e);if(0===r.length)return t([]);for(var i=r.length,f=0;r.length>f;f++)o(f,r[f])})}function n(e){return!(!e||"undefined"==typeof e.length)}function o(){}function r(e){if(!(this instanceof r))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],l(e,this)}function i(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,r._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var o;try{o=n(e._value)}catch(r){return void u(t.promise,r)}f(t.promise,o)}else(1===e._state?f:u)(t.promise,e._value)})):e._deferreds.push(t)}function f(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof r)return e._state=3,e._value=t,void c(e);if("function"==typeof n)return void l(function(e,t){return function(){e.apply(t,arguments)}}(n,t),e)}e._state=1,e._value=t,c(e)}catch(o){u(e,o)}}function u(e,t){e._state=2,e._value=t,c(e)}function c(e){2===e._state&&0===e._deferreds.length&&r._immediateFn(function(){e._handled||r._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;n>t;t++)i(e,e._deferreds[t]);e._deferreds=null}function l(e,t){var n=!1;try{e(function(e){n||(n=!0,f(t,e))},function(e){n||(n=!0,u(t,e))})}catch(o){if(n)return;n=!0,u(t,o)}}var a=setTimeout,s="undefined"!=typeof setImmediate?setImmediate:null;r.prototype["catch"]=function(e){return this.then(null,e)},r.prototype.then=function(e,t){var n=new this.constructor(o);return i(this,new function(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}(e,t,n)),n},r.prototype["finally"]=e,r.all=function(e){return new r(function(t,o){function r(e,n){try{if(n&&("object"==typeof n||"function"==typeof n)){var u=n.then;if("function"==typeof u)return void u.call(n,function(t){r(e,t)},o)}i[e]=n,0==--f&&t(i)}catch(c){o(c)}}if(!n(e))return o(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(e);if(0===i.length)return t([]);for(var f=i.length,u=0;i.length>u;u++)r(u,i[u])})},r.allSettled=t,r.resolve=function(e){return e&&"object"==typeof e&&e.constructor===r?e:new r(function(t){t(e)})},r.reject=function(e){return new r(function(t,n){n(e)})},r.race=function(e){return new r(function(t,o){if(!n(e))return o(new TypeError("Promise.race accepts an array"));for(var i=0,f=e.length;f>i;i++)r.resolve(e[i]).then(t,o)})},r._immediateFn="function"==typeof s&&function(e){s(e)}||function(e){a(e,0)},r._unhandledRejectionFn=function(e){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var d=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"function"!=typeof d.Promise?d.Promise=r:(d.Promise.prototype["finally"]||(d.Promise.prototype["finally"]=e),d.Promise.allSettled||(d.Promise.allSettled=t))}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";function e(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})}function t(e){return new this(function(t,n){function r(e,n){if(n&&("object"==typeof n||"function"==typeof n)){var f=n.then;if("function"==typeof f)return void f.call(n,function(t){r(e,t)},function(n){o[e]={status:"rejected",reason:n},0==--i&&t(o)})}o[e]={status:"fulfilled",value:n},0==--i&&t(o)}if(!e||"undefined"==typeof e.length)return n(new TypeError(typeof e+" "+e+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var o=Array.prototype.slice.call(e);if(0===o.length)return t([]);for(var i=o.length,f=0;o.length>f;f++)r(f,o[f])})}function n(e,t){this.name="AggregateError",this.errors=e,this.message=t||""}function r(e){var t=this;return new t(function(r,o){if(!e||"undefined"==typeof e.length)return o(new TypeError("Promise.any accepts an array"));var i=Array.prototype.slice.call(e);if(0===i.length)return o();for(var f=[],u=0;i.length>u;u++)try{t.resolve(i[u]).then(r)["catch"](function(e){f.push(e),f.length===i.length&&o(new n(f,"All promises were rejected"))})}catch(c){o(c)}})}function o(e){return!(!e||"undefined"==typeof e.length)}function i(){}function f(e){if(!(this instanceof f))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=undefined,this._deferreds=[],s(e,this)}function u(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,f._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var r;try{r=n(e._value)}catch(o){return void a(t.promise,o)}c(t.promise,r)}else(1===e._state?c:a)(t.promise,e._value)})):e._deferreds.push(t)}function c(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof f)return e._state=3,e._value=t,void l(e);if("function"==typeof n)return void s(function(e,t){return function(){e.apply(t,arguments)}}(n,t),e)}e._state=1,e._value=t,l(e)}catch(r){a(e,r)}}function a(e,t){e._state=2,e._value=t,l(e)}function l(e){2===e._state&&0===e._deferreds.length&&f._immediateFn(function(){e._handled||f._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;n>t;t++)u(e,e._deferreds[t]);e._deferreds=null}function s(e,t){var n=!1;try{e(function(e){n||(n=!0,c(t,e))},function(e){n||(n=!0,a(t,e))})}catch(r){if(n)return;n=!0,a(t,r)}}n.prototype=Error.prototype;var d=setTimeout;f.prototype["catch"]=function(e){return this.then(null,e)},f.prototype.then=function(e,t){var n=new this.constructor(i);return u(this,new function(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}(e,t,n)),n},f.prototype["finally"]=e,f.all=function(e){return new f(function(t,n){function r(e,o){try{if(o&&("object"==typeof o||"function"==typeof o)){var u=o.then;if("function"==typeof u)return void u.call(o,function(t){r(e,t)},n)}i[e]=o,0==--f&&t(i)}catch(c){n(c)}}if(!o(e))return n(new TypeError("Promise.all accepts an array"));var i=Array.prototype.slice.call(e);if(0===i.length)return t([]);for(var f=i.length,u=0;i.length>u;u++)r(u,i[u])})},f.any=r,f.allSettled=t,f.resolve=function(e){return e&&"object"==typeof e&&e.constructor===f?e:new f(function(t){t(e)})},f.reject=function(e){return new f(function(t,n){n(e)})},f.race=function(e){return new f(function(t,n){if(!o(e))return n(new TypeError("Promise.race accepts an array"));for(var r=0,i=e.length;i>r;r++)f.resolve(e[r]).then(t,n)})},f._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){d(e,0)},f._unhandledRejectionFn=function(e){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var p=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"function"!=typeof p.Promise?p.Promise=f:(p.Promise.prototype["finally"]||(p.Promise.prototype["finally"]=e),p.Promise.allSettled||(p.Promise.allSettled=t),p.Promise.any||(p.Promise.any=r))}); ; /** vim: et:ts=4:sw=4:sts=4 * @license RequireJS 2.3.6 Copyright jQuery Foundation and other contributors. @@ -5415,7 +5415,7 @@ var ModifyMapObserver = function (_ModifyCollectionObse2) { var emLogger = LogManager.getLogger('event-manager'); function findOriginalEventTarget(event) { - return event.path && event.path[0] || event.deepPath && event.deepPath[0] || event.target; + return event.composedPath && event.composedPath()[0] || event.deepPath && event.deepPath()[0] || event.path && event.path[0] || event.target; } function stopPropagation() { @@ -5479,43 +5479,47 @@ var CapturedHandlerEntry = function () { return CapturedHandlerEntry; }(); -function handleDelegatedEvent(event) { - event.propagationStopped = false; - var target = findOriginalEventTarget(event); - - while (target && !event.propagationStopped) { - if (target.delegatedCallbacks) { - var callback = target.delegatedCallbacks[event.type]; - if (callback) { - if (event.stopPropagation !== stopPropagation) { - event.standardStopPropagation = event.stopPropagation; - event.stopPropagation = stopPropagation; - } - if ('handleEvent' in callback) { - callback.handleEvent(event); - } else { - callback(event); - } - } - } - - target = target.parentNode; - } -} - var DelegateHandlerEntry = function () { - function DelegateHandlerEntry(eventName) { + function DelegateHandlerEntry(eventName, eventManager) { this.eventName = eventName; this.count = 0; + this.eventManager = eventManager; } + DelegateHandlerEntry.prototype.handleEvent = function handleEvent(event) { + event.propagationStopped = false; + var target = findOriginalEventTarget(event); + + while (target && !event.propagationStopped) { + if (target.delegatedCallbacks) { + var callback = target.delegatedCallbacks[event.type]; + if (callback) { + if (event.stopPropagation !== stopPropagation) { + event.standardStopPropagation = event.stopPropagation; + event.stopPropagation = stopPropagation; + } + if ('handleEvent' in callback) { + callback.handleEvent(event); + } else { + callback(event); + } + } + } + + var parent = target.parentNode; + var shouldEscapeShadowRoot = this.eventManager.escapeShadowRoot && parent instanceof ShadowRoot; + + target = shouldEscapeShadowRoot ? parent.host : parent; + } + }; + DelegateHandlerEntry.prototype.increment = function increment() { this.count++; if (this.count === 1) { - _aureliaPal.DOM.addEventListener(this.eventName, handleDelegatedEvent, false); + _aureliaPal.DOM.addEventListener(this.eventName, this, false); } }; @@ -5523,7 +5527,7 @@ var DelegateHandlerEntry = function () { if (this.count === 0) { emLogger.warn('The same EventListener was disposed multiple times.'); } else if (--this.count === 0) { - _aureliaPal.DOM.removeEventListener(this.eventName, handleDelegatedEvent, false); + _aureliaPal.DOM.removeEventListener(this.eventName, this, false); } }; @@ -5568,11 +5572,13 @@ var EventHandler = function () { }(); var DefaultEventStrategy = function () { - function DefaultEventStrategy() { + function DefaultEventStrategy(eventManager) { this.delegatedHandlers = {}; this.capturedHandlers = {}; + + this.eventManager = eventManager; } DefaultEventStrategy.prototype.subscribe = function subscribe(target, targetEvent, callback, strategy, disposable) { @@ -5582,7 +5588,7 @@ var DefaultEventStrategy = function () { if (strategy === delegationStrategy.bubbling) { delegatedHandlers = this.delegatedHandlers; - handlerEntry = delegatedHandlers[targetEvent] || (delegatedHandlers[targetEvent] = new DelegateHandlerEntry(targetEvent)); + handlerEntry = delegatedHandlers[targetEvent] || (delegatedHandlers[targetEvent] = new DelegateHandlerEntry(targetEvent, this.eventManager)); var delegatedCallbacks = target.delegatedCallbacks || (target.delegatedCallbacks = {}); if (!delegatedCallbacks[targetEvent]) { handlerEntry.increment(); @@ -5643,10 +5649,13 @@ var delegationStrategy = exports.delegationStrategy = { var EventManager = exports.EventManager = function () { function EventManager() { + var escapeShadowRoot = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + this.elementHandlerLookup = {}; this.eventStrategyLookup = {}; + this.escapeShadowRoot = escapeShadowRoot; this.registerElementConfig({ tagName: 'input', @@ -5686,7 +5695,7 @@ var EventManager = exports.EventManager = function () { } }); - this.defaultEventStrategy = new DefaultEventStrategy(); + this.defaultEventStrategy = new DefaultEventStrategy(this); } EventManager.prototype.registerElementConfig = function registerElementConfig(config) { @@ -5947,7 +5956,7 @@ var SetterObserver = exports.SetterObserver = (_dec6 = subscriberCollection(), _ SetterObserver.prototype.call = function call() { var oldValue = this.oldValue; - var newValue = this.currentValue; + var newValue = this.oldValue = this.currentValue; this.queued = false; @@ -7805,179 +7814,148 @@ function signalBindings(name) { ; define('aurelia-bootstrapper/dist/commonjs/aurelia-bootstrapper',['require','exports','module','aurelia-polyfills','aurelia-pal'],function (require, exports, module) {'use strict'; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.starting = undefined; - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -exports.bootstrap = bootstrap; +Object.defineProperty(exports, '__esModule', { value: true }); require('aurelia-polyfills'); - -var _aureliaPal = require('aurelia-pal'); +var aureliaPal = require('aurelia-pal'); var bootstrapPromises = []; -var startResolve = void 0; - -var startPromise = new Promise(function (resolve) { - return startResolve = resolve; -}); -var host = _aureliaPal.PLATFORM.global; +var startResolve; +var startPromise = new Promise(function (resolve) { return startResolve = resolve; }); +var host = aureliaPal.PLATFORM.global; var isNodeLike = typeof process !== 'undefined' && !process.browser; - function ready() { - if (!host.document || host.document.readyState === 'complete') { - return Promise.resolve(); - } - - return new Promise(function (resolve) { - host.document.addEventListener('DOMContentLoaded', completed); - host.addEventListener('load', completed); - - function completed() { - host.document.removeEventListener('DOMContentLoaded', completed); - host.removeEventListener('load', completed); - resolve(); + if (!host.document || host.document.readyState === 'complete') { + return Promise.resolve(); } - }); + return new Promise(function (resolve) { + host.document.addEventListener('DOMContentLoaded', completed); + host.addEventListener('load', completed); + function completed() { + host.document.removeEventListener('DOMContentLoaded', completed); + host.removeEventListener('load', completed); + resolve(); + } + }); } - function createLoader() { - if (_aureliaPal.PLATFORM.Loader) { - return Promise.resolve(new _aureliaPal.PLATFORM.Loader()); - } - - if (typeof AURELIA_WEBPACK_2_0 === 'undefined') { - if (typeof __webpack_require__ !== 'undefined') { - var m = __webpack_require__(require.resolve('aurelia-loader-webpack')); - return Promise.resolve(new m.WebpackLoader()); + if (aureliaPal.PLATFORM.Loader) { + return Promise.resolve(new aureliaPal.PLATFORM.Loader()); + } + if (typeof AURELIA_WEBPACK_2_0 === 'undefined') { + if (typeof __webpack_require__ !== 'undefined') { + var m = __webpack_require__(require.resolve('aurelia-loader-webpack')); + return Promise.resolve(new m.WebpackLoader()); + } + if (host.System && typeof host.System.config === 'function') { + return host.System.normalize('aurelia-bootstrapper').then(function (bsn) { + return host.System.normalize('aurelia-loader-default', bsn); + }).then(function (loaderName) { + return host.System.import(loaderName).then(function (m) { return new m.DefaultLoader(); }); + }); + } + if (typeof host.require === 'function' && typeof host.define === 'function' && typeof host.define.amd === 'object') { + return new Promise(function (resolve, reject) { return host.require(['aurelia-loader-default'], function (m) { return resolve(new m.DefaultLoader()); }, reject); }); + } + if (isNodeLike && typeof module !== 'undefined' && typeof module.require !== 'undefined') { + var m = module.require('aurelia-loader-nodejs'); + return Promise.resolve(new m.NodeJsLoader()); + } } - - if (host.System && typeof host.System.config === 'function') { - return host.System.normalize('aurelia-bootstrapper').then(function (bsn) { - return host.System.normalize('aurelia-loader-default', bsn); - }).then(function (loaderName) { - return host.System.import(loaderName).then(function (m) { - return new m.DefaultLoader(); - }); - }); + return Promise.reject('No PLATFORM.Loader is defined and there is neither a System API (ES6) or a Require API (AMD) globally available to load your app.'); +} +function initializePal(loader) { + if (aureliaPal.isInitialized) + return Promise.resolve(); + var type; + var isRenderer = isNodeLike && (process.type === 'renderer' || process.versions['node-webkit']); + if (isNodeLike && !isRenderer) { + type = 'nodejs'; } - - if (typeof host.require === 'function' && typeof host.define === 'function' && _typeof(host.define.amd) === 'object') { - return new Promise(function (resolve, reject) { - return host.require(['aurelia-loader-default'], function (m) { - return resolve(new m.DefaultLoader()); - }, reject); - }); + else if (typeof window !== 'undefined') { + type = 'browser'; } - - if (isNodeLike && typeof module !== 'undefined' && typeof module.require !== 'undefined') { - var _m = module.require('aurelia-loader-nodejs'); - return Promise.resolve(new _m.NodeJsLoader()); + else if (typeof self !== 'undefined') { + type = 'worker'; } - } - - return Promise.reject('No PLATFORM.Loader is defined and there is neither a System API (ES6) or a Require API (AMD) globally available to load your app.'); -} - -function initializePal(loader) { - if (_aureliaPal.isInitialized) return Promise.resolve(); - - var type = void 0; - - var isRenderer = isNodeLike && (process.type === 'renderer' || process.versions['node-webkit']); - - if (isNodeLike && !isRenderer) { - type = 'nodejs'; - } else if (typeof window !== 'undefined') { - type = 'browser'; - } else if (typeof self !== 'undefined') { - type = 'worker'; - } else { - throw new Error('Could not determine platform implementation to load.'); - } - - return loader.loadModule('aurelia-pal-' + type).then(function (palModule) { - return type === 'nodejs' && !_aureliaPal.isInitialized && palModule.globalize() || palModule.initialize(); - }); + else { + throw new Error('Could not determine platform implementation to load.'); + } + return loader.loadModule('aurelia-pal-' + type) + .then(function (palModule) { return type === 'nodejs' && !aureliaPal.isInitialized && palModule.globalize() || palModule.initialize(); }); } - function preparePlatform(loader) { - var map = function map(moduleId, relativeTo) { - return loader.normalize(moduleId, relativeTo).then(function (normalized) { - loader.map(moduleId, normalized); - return normalized; - }); - }; - - return initializePal(loader).then(function () { - return loader.normalize('aurelia-bootstrapper'); - }).then(function (bootstrapperName) { - var frameworkPromise = map(_aureliaPal.PLATFORM.moduleName('aurelia-framework', { exports: ['Aurelia'] }), bootstrapperName); - - return Promise.all([frameworkPromise, frameworkPromise.then(function (frameworkName) { - return map('aurelia-dependency-injection', frameworkName); - }), map('aurelia-router', bootstrapperName), map('aurelia-logging-console', bootstrapperName)]); - }).then(function (_ref) { - var frameworkName = _ref[0]; - return loader.loadModule(frameworkName); - }).then(function (fx) { - return startResolve(function () { - return new fx.Aurelia(loader); - }); - }); + var map = function (moduleId, relativeTo) { + return loader.normalize(moduleId, relativeTo) + .then(function (normalized) { + loader.map(moduleId, normalized); + return normalized; + }); + }; + return initializePal(loader) + .then(function () { return loader.normalize('aurelia-bootstrapper'); }) + .then(function (bootstrapperName) { + var frameworkPromise = map(aureliaPal.PLATFORM.moduleName('aurelia-framework', { exports: ['Aurelia'] }), bootstrapperName); + return Promise.all([ + frameworkPromise, + frameworkPromise.then(function (frameworkName) { return map('aurelia-dependency-injection', frameworkName); }), + map('aurelia-router', bootstrapperName), + map('aurelia-logging-console', bootstrapperName) + ]); + }) + .then(function (_a) { + var frameworkName = _a[0]; + return loader.loadModule(frameworkName); + }) + .then(function (fx) { return startResolve(function () { return new fx.Aurelia(loader); }); }); } - function config(appHost, configModuleId, aurelia) { - aurelia.host = appHost; - aurelia.configModuleId = configModuleId || null; - - if (configModuleId) { - return aurelia.loader.loadModule(configModuleId).then(function (customConfig) { - if (!customConfig.configure) { - throw new Error('Cannot initialize module \'' + configModuleId + '\' without a configure function.'); - } - - return customConfig.configure(aurelia); - }); - } - - aurelia.use.standardConfiguration().developmentLogging(); - - return aurelia.start().then(function () { - return aurelia.setRoot(); - }); + aurelia.host = appHost; + aurelia.configModuleId = configModuleId || null; + if (configModuleId) { + return aurelia.loader + .loadModule(configModuleId) + .then(function (customConfig) { + if (!customConfig.configure) { + throw new Error("Cannot initialize module '".concat(configModuleId, "' without a configure function.")); + } + return customConfig.configure(aurelia); + }); + } + aurelia.use + .standardConfiguration() + .developmentLogging(); + return aurelia.start().then(function () { return aurelia.setRoot(); }); } - function run() { - return ready().then(createLoader).then(preparePlatform).then(function () { - var appHosts = host.document.querySelectorAll('[aurelia-app],[data-aurelia-app]'); - for (var i = 0, ii = appHosts.length; i < ii; ++i) { - var appHost = appHosts[i]; - var moduleId = appHost.getAttribute('aurelia-app') || appHost.getAttribute('data-aurelia-app'); - bootstrap(config.bind(null, appHost, moduleId)); - } - - var toConsole = console.error.bind(console); - var bootstraps = bootstrapPromises.map(function (p) { - return p.catch(toConsole); + return ready() + .then(createLoader) + .then(preparePlatform) + .then(function () { + var appHosts = host.document.querySelectorAll('[aurelia-app],[data-aurelia-app]'); + for (var i = 0, ii = appHosts.length; i < ii; ++i) { + var appHost = appHosts[i]; + var mainModuleId = appHost.getAttribute('aurelia-app') || appHost.getAttribute('data-aurelia-app'); + bootstrap(config.bind(null, appHost, mainModuleId)); + } + var toConsole = console.error.bind(console); + var bootstraps = bootstrapPromises.map(function (p) { return p.catch(toConsole); }); + bootstrapPromises = null; + return Promise.all(bootstraps); }); - bootstrapPromises = null; - return Promise.all(bootstraps); - }); } - function bootstrap(configure) { - var p = startPromise.then(function (factory) { - return configure(factory()); - }); - if (bootstrapPromises) bootstrapPromises.push(p); - return p; + var p = startPromise.then(function (factory) { return configure(factory()); }); + if (bootstrapPromises) + bootstrapPromises.push(p); + return p; } +var starting = run(); + +exports.bootstrap = bootstrap; +exports.starting = starting; + -var starting = exports.starting = run(); }); ; define('aurelia-dependency-injection/dist/commonjs/aurelia-dependency-injection',['require','exports','module','aurelia-metadata','aurelia-pal'],function (require, exports, module) {'use strict'; @@ -8820,636 +8798,499 @@ function configure(config) { ; define('aurelia-framework/dist/commonjs/aurelia-framework',['require','exports','module','aurelia-dependency-injection','aurelia-binding','aurelia-metadata','aurelia-templating','aurelia-loader','aurelia-task-queue','aurelia-path','aurelia-pal','aurelia-logging'],function (require, exports, module) {'use strict'; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.LogManager = exports.FrameworkConfiguration = exports.Aurelia = undefined; - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var _aureliaDependencyInjection = require('aurelia-dependency-injection'); - -Object.keys(_aureliaDependencyInjection).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _aureliaDependencyInjection[key]; - } - }); -}); - -var _aureliaBinding = require('aurelia-binding'); - -Object.keys(_aureliaBinding).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _aureliaBinding[key]; - } - }); -}); - -var _aureliaMetadata = require('aurelia-metadata'); - -Object.keys(_aureliaMetadata).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _aureliaMetadata[key]; - } - }); -}); - -var _aureliaTemplating = require('aurelia-templating'); - -Object.keys(_aureliaTemplating).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _aureliaTemplating[key]; - } - }); -}); - -var _aureliaLoader = require('aurelia-loader'); - -Object.keys(_aureliaLoader).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _aureliaLoader[key]; - } - }); -}); - -var _aureliaTaskQueue = require('aurelia-task-queue'); - -Object.keys(_aureliaTaskQueue).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _aureliaTaskQueue[key]; - } - }); -}); - -var _aureliaPath = require('aurelia-path'); - -Object.keys(_aureliaPath).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _aureliaPath[key]; - } - }); -}); - -var _aureliaPal = require('aurelia-pal'); - -Object.keys(_aureliaPal).forEach(function (key) { - if (key === "default" || key === "__esModule") return; - Object.defineProperty(exports, key, { - enumerable: true, - get: function get() { - return _aureliaPal[key]; - } - }); -}); - -var _aureliaLogging = require('aurelia-logging'); - -var TheLogManager = _interopRequireWildcard(_aureliaLogging); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - - -function preventActionlessFormSubmit() { - _aureliaPal.DOM.addEventListener('submit', function (evt) { - var target = evt.target; - var action = target.action; +Object.defineProperty(exports, '__esModule', { value: true }); - if (target.tagName.toLowerCase() === 'form' && !action) { - evt.preventDefault(); +var aureliaDependencyInjection = require('aurelia-dependency-injection'); +var aureliaBinding = require('aurelia-binding'); +var aureliaMetadata = require('aurelia-metadata'); +var aureliaTemplating = require('aurelia-templating'); +var aureliaLoader = require('aurelia-loader'); +var aureliaTaskQueue = require('aurelia-task-queue'); +var aureliaPath = require('aurelia-path'); +var aureliaPal = require('aurelia-pal'); +var TheLogManager = require('aurelia-logging'); + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); } - }); + n["default"] = e; + return Object.freeze(n); } -var Aurelia = exports.Aurelia = function () { - function Aurelia(loader, container, resources) { - - - this.loader = loader || new _aureliaPal.PLATFORM.Loader(); - this.container = container || new _aureliaDependencyInjection.Container().makeGlobal(); - this.resources = resources || new _aureliaTemplating.ViewResources(); - this.use = new FrameworkConfiguration(this); - this.logger = TheLogManager.getLogger('aurelia'); - this.hostConfigured = false; - this.host = null; - - this.use.instance(Aurelia, this); - this.use.instance(_aureliaLoader.Loader, this.loader); - this.use.instance(_aureliaTemplating.ViewResources, this.resources); - } - - Aurelia.prototype.start = function start() { - var _this = this; - - if (this._started) { - return this._started; - } - - this.logger.info('Aurelia Starting'); - return this._started = this.use.apply().then(function () { - preventActionlessFormSubmit(); - - if (!_this.container.hasResolver(_aureliaTemplating.BindingLanguage)) { - var message = 'You must configure Aurelia with a BindingLanguage implementation.'; - _this.logger.error(message); - throw new Error(message); - } - - _this.logger.info('Aurelia Started'); - var evt = _aureliaPal.DOM.createCustomEvent('aurelia-started', { bubbles: true, cancelable: true }); - _aureliaPal.DOM.dispatchEvent(evt); - return _this; - }); - }; - - Aurelia.prototype.enhance = function enhance() { - var _this2 = this; - - var bindingContext = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var applicationHost = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - - this._configureHost(applicationHost || _aureliaPal.DOM.querySelectorAll('body')[0]); - - return new Promise(function (resolve) { - var engine = _this2.container.get(_aureliaTemplating.TemplatingEngine); - _this2.root = engine.enhance({ container: _this2.container, element: _this2.host, resources: _this2.resources, bindingContext: bindingContext }); - _this2.root.attached(); - _this2._onAureliaComposed(); - resolve(_this2); - }); - }; - - Aurelia.prototype.setRoot = function setRoot() { - var _this3 = this; - - var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var applicationHost = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - - var instruction = {}; - - if (this.root && this.root.viewModel && this.root.viewModel.router) { - this.root.viewModel.router.deactivate(); - this.root.viewModel.router.reset(); - } - - this._configureHost(applicationHost); - - var engine = this.container.get(_aureliaTemplating.TemplatingEngine); - var transaction = this.container.get(_aureliaTemplating.CompositionTransaction); - delete transaction.initialComposition; - - if (!root) { - if (this.configModuleId) { - root = (0, _aureliaPath.relativeToFile)('./app', this.configModuleId); - } else { - root = 'app'; - } - } - - instruction.viewModel = root; - instruction.container = instruction.childContainer = this.container; - instruction.viewSlot = this.hostSlot; - instruction.host = this.host; - - return engine.compose(instruction).then(function (r) { - _this3.root = r; - instruction.viewSlot.attached(); - _this3._onAureliaComposed(); - return _this3; - }); - }; - - Aurelia.prototype._configureHost = function _configureHost(applicationHost) { - if (this.hostConfigured) { - return; - } - applicationHost = applicationHost || this.host; - - if (!applicationHost || typeof applicationHost === 'string') { - this.host = _aureliaPal.DOM.getElementById(applicationHost || 'applicationHost'); - } else { - this.host = applicationHost; - } - - if (!this.host) { - throw new Error('No applicationHost was specified.'); - } +var TheLogManager__namespace = /*#__PURE__*/_interopNamespace(TheLogManager); - this.hostConfigured = true; - this.host.aurelia = this; - this.hostSlot = new _aureliaTemplating.ViewSlot(this.host, true); - this.hostSlot.transformChildNodesIntoView(); - this.container.registerInstance(_aureliaPal.DOM.boundary, this.host); - }; - - Aurelia.prototype._onAureliaComposed = function _onAureliaComposed() { - var evt = _aureliaPal.DOM.createCustomEvent('aurelia-composed', { bubbles: true, cancelable: true }); - setTimeout(function () { - return _aureliaPal.DOM.dispatchEvent(evt); - }, 1); - }; - - return Aurelia; -}(); - -var logger = TheLogManager.getLogger('aurelia'); +var logger = TheLogManager__namespace.getLogger('aurelia'); var extPattern = /\.[^/.]+$/; - function runTasks(config, tasks) { - var current = void 0; - var next = function next() { - current = tasks.shift(); - if (current) { - return Promise.resolve(current(config)).then(next); - } - - return Promise.resolve(); - }; - - return next(); + var current; + var next = function () { + current = tasks.shift(); + if (current) { + return Promise.resolve(current(config)).then(next); + } + return Promise.resolve(); + }; + return next(); } - function loadPlugin(fwConfig, loader, info) { - logger.debug('Loading plugin ' + info.moduleId + '.'); - if (typeof info.moduleId === 'string') { - fwConfig.resourcesRelativeTo = info.resourcesRelativeTo; - - var id = info.moduleId; - - if (info.resourcesRelativeTo.length > 1) { - return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]).then(function (normalizedId) { - return _loadPlugin(normalizedId); - }); - } - - return _loadPlugin(id); - } else if (typeof info.configure === 'function') { - if (fwConfig.configuredPlugins.indexOf(info.configure) !== -1) { - return Promise.resolve(); - } - fwConfig.configuredPlugins.push(info.configure); - - return Promise.resolve(info.configure.call(null, fwConfig, info.config || {})); - } - throw new Error(invalidConfigMsg(info.moduleId || info.configure, 'plugin')); - - function _loadPlugin(moduleId) { - return loader.loadModule(moduleId).then(function (m) { - if ('configure' in m) { - if (fwConfig.configuredPlugins.indexOf(m.configure) !== -1) { - return Promise.resolve(); - } - return Promise.resolve(m.configure(fwConfig, info.config || {})).then(function () { - fwConfig.configuredPlugins.push(m.configure); - fwConfig.resourcesRelativeTo = null; - logger.debug('Configured plugin ' + info.moduleId + '.'); + logger.debug("Loading plugin ".concat(info.moduleId, ".")); + if (typeof info.moduleId === 'string') { + fwConfig.resourcesRelativeTo = info.resourcesRelativeTo; + var id = info.moduleId; + if (info.resourcesRelativeTo.length > 1) { + return loader.normalize(info.moduleId, info.resourcesRelativeTo[1]) + .then(function (normalizedId) { return _loadPlugin(normalizedId); }); + } + return _loadPlugin(id); + } + else if (typeof info.configure === 'function') { + if (fwConfig.configuredPlugins.indexOf(info.configure) !== -1) { + return Promise.resolve(); + } + fwConfig.configuredPlugins.push(info.configure); + return Promise.resolve(info.configure.call(null, fwConfig, info.config || {})); + } + throw new Error(invalidConfigMsg(info.moduleId || info.configure, 'plugin')); + function _loadPlugin(moduleId) { + return loader.loadModule(moduleId).then(function (m) { + if ('configure' in m) { + if (fwConfig.configuredPlugins.indexOf(m.configure) !== -1) { + return Promise.resolve(); + } + return Promise.resolve(m.configure(fwConfig, info.config || {})).then(function () { + fwConfig.configuredPlugins.push(m.configure); + fwConfig.resourcesRelativeTo = null; + logger.debug("Configured plugin ".concat(info.moduleId, ".")); + }); + } + fwConfig.resourcesRelativeTo = null; + logger.debug("Loaded plugin ".concat(info.moduleId, ".")); }); - } - - fwConfig.resourcesRelativeTo = null; - logger.debug('Loaded plugin ' + info.moduleId + '.'); - }); - } + } } - function loadResources(aurelia, resourcesToLoad, appResources) { - if (Object.keys(resourcesToLoad).length === 0) { - return Promise.resolve(); - } - var viewEngine = aurelia.container.get(_aureliaTemplating.ViewEngine); - - return Promise.all(Object.keys(resourcesToLoad).map(function (n) { - return _normalize(resourcesToLoad[n]); - })).then(function (loads) { - var names = []; - var importIds = []; - - loads.forEach(function (l) { - names.push(undefined); - importIds.push(l.importId); - }); - - return viewEngine.importViewResources(importIds, names, appResources); - }); - - function _normalize(load) { - var moduleId = load.moduleId; - var ext = getExt(moduleId); - - if (isOtherResource(moduleId)) { - moduleId = removeExt(moduleId); + if (Object.keys(resourcesToLoad).length === 0) { + return Promise.resolve(); } - - return aurelia.loader.normalize(moduleId, load.relativeTo).then(function (normalized) { - return { - name: load.moduleId, - importId: isOtherResource(load.moduleId) ? addOriginalExt(normalized, ext) : normalized - }; + var viewEngine = aurelia.container.get(aureliaTemplating.ViewEngine); + return Promise.all(Object.keys(resourcesToLoad).map(function (n) { return _normalize(resourcesToLoad[n]); })) + .then(function (loads) { + var names = []; + var importIds = []; + loads.forEach(function (l) { + names.push(undefined); + importIds.push(l.importId); + }); + return viewEngine.importViewResources(importIds, names, appResources); }); - } - - function isOtherResource(name) { - var ext = getExt(name); - if (!ext) return false; - if (ext === '') return false; - if (ext === '.js' || ext === '.ts') return false; - return true; - } - - function removeExt(name) { - return name.replace(extPattern, ''); - } - - function addOriginalExt(normalized, ext) { - return removeExt(normalized) + '.' + ext; - } + function _normalize(load) { + var moduleId = load.moduleId; + var ext = getExt(moduleId); + if (isOtherResource(moduleId)) { + moduleId = removeExt(moduleId); + } + return aurelia.loader.normalize(moduleId, load.relativeTo) + .then(function (normalized) { + return { + name: load.moduleId, + importId: isOtherResource(load.moduleId) ? addOriginalExt(normalized, ext) : normalized + }; + }); + } + function isOtherResource(name) { + var ext = getExt(name); + if (!ext) + return false; + if (ext === '') + return false; + if (ext === '.js' || ext === '.ts') + return false; + return true; + } + function removeExt(name) { + return name.replace(extPattern, ''); + } + function addOriginalExt(normalized, ext) { + return removeExt(normalized) + '.' + ext; + } } - function getExt(name) { - var match = name.match(extPattern); - if (match && match.length > 0) { - return match[0].split('.')[1]; - } + var match = name.match(extPattern); + if (match && match.length > 0) { + return (match[0].split('.'))[1]; + } } - function loadBehaviors(config) { - return Promise.all(config.behaviorsToLoad.map(function (m) { - return m.load(config.container, m.target); - })).then(function () { - config.behaviorsToLoad = null; - }); + return Promise.all(config.behaviorsToLoad.map(function (m) { return m.load(config.container, m.target); })).then(function () { + config.behaviorsToLoad = null; + }); } - function assertProcessed(plugins) { - if (plugins.processed) { - throw new Error('This config instance has already been applied. To load more plugins or global resources, create a new FrameworkConfiguration instance.'); - } + if (plugins.processed) { + throw new Error('This config instance has already been applied. To load more plugins or global resources, create a new FrameworkConfiguration instance.'); + } } - function invalidConfigMsg(cfg, type) { - return 'Invalid ' + type + ' [' + cfg + '], ' + type + ' must be specified as functions or relative module IDs.'; + return "Invalid ".concat(type, " [").concat(cfg, "], ").concat(type, " must be specified as functions or relative module IDs."); } +var FrameworkConfiguration = (function () { + function FrameworkConfiguration(aurelia) { + var _this = this; + this.aurelia = aurelia; + this.container = aurelia.container; + this.info = []; + this.processed = false; + this.preTasks = []; + this.postTasks = []; + this.behaviorsToLoad = []; + this.configuredPlugins = []; + this.resourcesToLoad = {}; + this.preTask(function () { return aurelia.loader.normalize('aurelia-bootstrapper', undefined) + .then(function (name) { return _this.bootstrapperName = name; }); }); + this.postTask(function () { return loadResources(aurelia, _this.resourcesToLoad, aurelia.resources); }); + } + FrameworkConfiguration.prototype.instance = function (type, instance) { + this.container.registerInstance(type, instance); + return this; + }; + FrameworkConfiguration.prototype.singleton = function (type, implementation) { + this.container.registerSingleton(type, implementation); + return this; + }; + FrameworkConfiguration.prototype.transient = function (type, implementation) { + this.container.registerTransient(type, implementation); + return this; + }; + FrameworkConfiguration.prototype.preTask = function (task) { + assertProcessed(this); + this.preTasks.push(task); + return this; + }; + FrameworkConfiguration.prototype.postTask = function (task) { + assertProcessed(this); + this.postTasks.push(task); + return this; + }; + FrameworkConfiguration.prototype.feature = function (plugin, config) { + if (config === void 0) { config = {}; } + switch (typeof plugin) { + case 'string': + var hasIndex = /\/index$/i.test(plugin); + var moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; + var root = hasIndex ? plugin.slice(0, -6) : plugin; + this.info.push({ moduleId: moduleId, resourcesRelativeTo: [root, ''], config: config }); + break; + case 'function': + this.info.push({ configure: plugin, config: config || {} }); + break; + default: + throw new Error(invalidConfigMsg(plugin, 'feature')); + } + return this; + }; + FrameworkConfiguration.prototype.globalResources = function (resources) { + var _this = this; + assertProcessed(this); + var toAdd = Array.isArray(resources) ? resources : arguments; + var resource; + var resourcesRelativeTo = this.resourcesRelativeTo || ['', '']; + for (var i = 0, ii = toAdd.length; i < ii; ++i) { + resource = toAdd[i]; + switch (typeof resource) { + case 'string': + var parent_1 = resourcesRelativeTo[0]; + var grandParent = resourcesRelativeTo[1]; + var name_1 = resource; + if ((resource.startsWith('./') || resource.startsWith('../')) && parent_1 !== '') { + name_1 = aureliaPath.join(parent_1, resource); + } + this.resourcesToLoad[name_1] = { moduleId: name_1, relativeTo: grandParent }; + break; + case 'function': + var meta = this.aurelia.resources.autoRegister(this.container, resource); + if (meta instanceof aureliaTemplating.HtmlBehaviorResource && meta.elementName !== null) { + if (this.behaviorsToLoad.push(meta) === 1) { + this.postTask(function () { return loadBehaviors(_this); }); + } + } + break; + default: + throw new Error(invalidConfigMsg(resource, 'resource')); + } + } + return this; + }; + FrameworkConfiguration.prototype.globalName = function (resourcePath, newName) { + assertProcessed(this); + this.resourcesToLoad[resourcePath] = { moduleId: newName, relativeTo: '' }; + return this; + }; + FrameworkConfiguration.prototype.plugin = function (plugin, pluginConfig) { + assertProcessed(this); + var info; + switch (typeof plugin) { + case 'string': + info = { moduleId: plugin, resourcesRelativeTo: [plugin, ''], config: pluginConfig || {} }; + break; + case 'function': + info = { configure: plugin, config: pluginConfig || {} }; + break; + default: + throw new Error(invalidConfigMsg(plugin, 'plugin')); + } + this.info.push(info); + return this; + }; + FrameworkConfiguration.prototype._addNormalizedPlugin = function (name, config) { + var _this = this; + var plugin = { moduleId: name, resourcesRelativeTo: [name, ''], config: config || {} }; + this.info.push(plugin); + this.preTask(function () { + var relativeTo = [name, _this.bootstrapperName]; + plugin.moduleId = name; + plugin.resourcesRelativeTo = relativeTo; + return Promise.resolve(); + }); + return this; + }; + FrameworkConfiguration.prototype.defaultBindingLanguage = function () { + return this._addNormalizedPlugin('aurelia-templating-binding'); + }; + FrameworkConfiguration.prototype.router = function () { + return this._addNormalizedPlugin('aurelia-templating-router'); + }; + FrameworkConfiguration.prototype.history = function () { + return this._addNormalizedPlugin('aurelia-history-browser'); + }; + FrameworkConfiguration.prototype.defaultResources = function () { + return this._addNormalizedPlugin('aurelia-templating-resources'); + }; + FrameworkConfiguration.prototype.eventAggregator = function () { + return this._addNormalizedPlugin('aurelia-event-aggregator'); + }; + FrameworkConfiguration.prototype.basicConfiguration = function () { + return this.defaultBindingLanguage().defaultResources().eventAggregator(); + }; + FrameworkConfiguration.prototype.standardConfiguration = function () { + return this.basicConfiguration().history().router(); + }; + FrameworkConfiguration.prototype.developmentLogging = function (level) { + var _this = this; + var logLevel = level ? TheLogManager__namespace.logLevel[level] : undefined; + if (logLevel === undefined) { + logLevel = TheLogManager__namespace.logLevel.debug; + } + this.preTask(function () { + return _this.aurelia.loader.normalize('aurelia-logging-console', _this.bootstrapperName).then(function (name) { + return _this.aurelia.loader.loadModule(name).then(function (m) { + TheLogManager__namespace.addAppender(new m.ConsoleAppender()); + TheLogManager__namespace.setLevel(logLevel); + }); + }); + }); + return this; + }; + FrameworkConfiguration.prototype.apply = function () { + var _this = this; + if (this.processed) { + return Promise.resolve(); + } + return runTasks(this, this.preTasks).then(function () { + var loader = _this.aurelia.loader; + var info = _this.info; + var current; + var next = function () { + current = info.shift(); + if (current) { + return loadPlugin(_this, loader, current).then(next); + } + _this.processed = true; + _this.configuredPlugins = null; + return Promise.resolve(); + }; + return next().then(function () { return runTasks(_this, _this.postTasks); }); + }); + }; + return FrameworkConfiguration; +}()); -var FrameworkConfiguration = function () { - function FrameworkConfiguration(aurelia) { - var _this4 = this; - - - - this.aurelia = aurelia; - this.container = aurelia.container; - - this.info = []; - this.processed = false; - this.preTasks = []; - this.postTasks = []; - - this.behaviorsToLoad = []; +function preventActionlessFormSubmit() { + aureliaPal.DOM.addEventListener('submit', function (evt) { + var target = evt.target; + var action = target.action; + if (target.tagName.toLowerCase() === 'form' && !action) { + evt.preventDefault(); + } + }, false); +} +var Aurelia = (function () { + function Aurelia(loader, container, resources) { + this.loader = loader || new aureliaPal.PLATFORM.Loader(); + this.container = container || (new aureliaDependencyInjection.Container()).makeGlobal(); + this.resources = resources || new aureliaTemplating.ViewResources(); + this.use = new FrameworkConfiguration(this); + this.logger = TheLogManager__namespace.getLogger('aurelia'); + this.hostConfigured = false; + this.host = null; + this.use.instance(Aurelia, this); + this.use.instance(aureliaLoader.Loader, this.loader); + this.use.instance(aureliaTemplating.ViewResources, this.resources); + } + Aurelia.prototype.start = function () { + var _this = this; + if (this._started) { + return this._started; + } + this.logger.info('Aurelia Starting'); + return this._started = this.use.apply().then(function () { + preventActionlessFormSubmit(); + if (!_this.container.hasResolver(aureliaTemplating.BindingLanguage)) { + var message = 'You must configure Aurelia with a BindingLanguage implementation.'; + _this.logger.error(message); + throw new Error(message); + } + _this.logger.info('Aurelia Started'); + var evt = aureliaPal.DOM.createCustomEvent('aurelia-started', { bubbles: true, cancelable: true }); + aureliaPal.DOM.dispatchEvent(evt); + return _this; + }); + }; + Aurelia.prototype.enhance = function (bindingContext, applicationHost) { + var _this = this; + if (bindingContext === void 0) { bindingContext = {}; } + if (applicationHost === void 0) { applicationHost = null; } + this._configureHost(applicationHost || aureliaPal.DOM.querySelectorAll('body')[0]); + return new Promise(function (resolve) { + var engine = _this.container.get(aureliaTemplating.TemplatingEngine); + _this.root = engine.enhance({ container: _this.container, element: _this.host, resources: _this.resources, bindingContext: bindingContext }); + _this.root.attached(); + _this._onAureliaComposed(); + resolve(_this); + }); + }; + Aurelia.prototype.setRoot = function (root, applicationHost) { + var _this = this; + if (root === void 0) { root = null; } + if (applicationHost === void 0) { applicationHost = null; } + var instruction = {}; + if (this.root && this.root.viewModel && this.root.viewModel.router) { + this.root.viewModel.router.deactivate(); + this.root.viewModel.router.reset(); + } + this._configureHost(applicationHost); + var engine = this.container.get(aureliaTemplating.TemplatingEngine); + var transaction = this.container.get(aureliaTemplating.CompositionTransaction); + delete transaction.initialComposition; + if (!root) { + if (this.configModuleId) { + root = aureliaPath.relativeToFile('./app', this.configModuleId); + } + else { + root = 'app'; + } + } + instruction.viewModel = root; + instruction.container = instruction.childContainer = this.container; + instruction.viewSlot = this.hostSlot; + instruction.host = this.host; + return engine.compose(instruction).then(function (r) { + _this.root = r; + instruction.viewSlot.attached(); + _this._onAureliaComposed(); + return _this; + }); + }; + Aurelia.prototype._configureHost = function (applicationHost) { + if (this.hostConfigured) { + return; + } + applicationHost = applicationHost || this.host; + if (!applicationHost || typeof applicationHost === 'string') { + this.host = aureliaPal.DOM.getElementById(applicationHost || 'applicationHost'); + } + else { + this.host = applicationHost; + } + if (!this.host) { + throw new Error('No applicationHost was specified.'); + } + this.hostConfigured = true; + this.host.aurelia = this; + this.hostSlot = new aureliaTemplating.ViewSlot(this.host, true); + this.hostSlot.transformChildNodesIntoView(); + this.container.registerInstance(aureliaPal.DOM.boundary, this.host); + }; + Aurelia.prototype._onAureliaComposed = function () { + var evt = aureliaPal.DOM.createCustomEvent('aurelia-composed', { bubbles: true, cancelable: true }); + setTimeout(function () { return aureliaPal.DOM.dispatchEvent(evt); }, 1); + }; + return Aurelia; +}()); - this.configuredPlugins = []; - this.resourcesToLoad = {}; - this.preTask(function () { - return aurelia.loader.normalize('aurelia-bootstrapper').then(function (name) { - return _this4.bootstrapperName = name; - }); +exports.LogManager = TheLogManager__namespace; +exports.Aurelia = Aurelia; +exports.FrameworkConfiguration = FrameworkConfiguration; +Object.keys(aureliaDependencyInjection).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return aureliaDependencyInjection[k]; } }); - this.postTask(function () { - return loadResources(aurelia, _this4.resourcesToLoad, aurelia.resources); +}); +Object.keys(aureliaBinding).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return aureliaBinding[k]; } }); - } - - FrameworkConfiguration.prototype.instance = function instance(type, _instance) { - this.container.registerInstance(type, _instance); - return this; - }; - - FrameworkConfiguration.prototype.singleton = function singleton(type, implementation) { - this.container.registerSingleton(type, implementation); - return this; - }; - - FrameworkConfiguration.prototype.transient = function transient(type, implementation) { - this.container.registerTransient(type, implementation); - return this; - }; - - FrameworkConfiguration.prototype.preTask = function preTask(task) { - assertProcessed(this); - this.preTasks.push(task); - return this; - }; - - FrameworkConfiguration.prototype.postTask = function postTask(task) { - assertProcessed(this); - this.postTasks.push(task); - return this; - }; - - FrameworkConfiguration.prototype.feature = function feature(plugin) { - var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - switch (typeof plugin === 'undefined' ? 'undefined' : _typeof(plugin)) { - case 'string': - var hasIndex = /\/index$/i.test(plugin); - var _moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index'; - var root = hasIndex ? plugin.substr(0, plugin.length - 6) : plugin; - this.info.push({ moduleId: _moduleId, resourcesRelativeTo: [root, ''], config: config }); - break; - - case 'function': - this.info.push({ configure: plugin, config: config || {} }); - break; - default: - throw new Error(invalidConfigMsg(plugin, 'feature')); - } - return this; - }; - - FrameworkConfiguration.prototype.globalResources = function globalResources(resources) { - var _this5 = this; - - assertProcessed(this); - - var toAdd = Array.isArray(resources) ? resources : arguments; - var resource = void 0; - var resourcesRelativeTo = this.resourcesRelativeTo || ['', '']; - - for (var i = 0, ii = toAdd.length; i < ii; ++i) { - resource = toAdd[i]; - switch (typeof resource === 'undefined' ? 'undefined' : _typeof(resource)) { - case 'string': - var parent = resourcesRelativeTo[0]; - var grandParent = resourcesRelativeTo[1]; - var name = resource; - - if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') { - name = (0, _aureliaPath.join)(parent, resource); - } - - this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent }; - break; - case 'function': - var meta = this.aurelia.resources.autoRegister(this.container, resource); - if (meta instanceof _aureliaTemplating.HtmlBehaviorResource && meta.elementName !== null) { - if (this.behaviorsToLoad.push(meta) === 1) { - this.postTask(function () { - return loadBehaviors(_this5); - }); - } - } - break; - default: - throw new Error(invalidConfigMsg(resource, 'resource')); - } - } - - return this; - }; - - FrameworkConfiguration.prototype.globalName = function globalName(resourcePath, newName) { - assertProcessed(this); - this.resourcesToLoad[resourcePath] = { moduleId: newName, relativeTo: '' }; - return this; - }; - - FrameworkConfiguration.prototype.plugin = function plugin(_plugin, pluginConfig) { - assertProcessed(this); - - var info = void 0; - switch (typeof _plugin === 'undefined' ? 'undefined' : _typeof(_plugin)) { - case 'string': - info = { moduleId: _plugin, resourcesRelativeTo: [_plugin, ''], config: pluginConfig || {} }; - break; - case 'function': - info = { configure: _plugin, config: pluginConfig || {} }; - break; - default: - throw new Error(invalidConfigMsg(_plugin, 'plugin')); - } - this.info.push(info); - return this; - }; - - FrameworkConfiguration.prototype._addNormalizedPlugin = function _addNormalizedPlugin(name, config) { - var _this6 = this; - - var plugin = { moduleId: name, resourcesRelativeTo: [name, ''], config: config || {} }; - this.info.push(plugin); - - this.preTask(function () { - var relativeTo = [name, _this6.bootstrapperName]; - plugin.moduleId = name; - plugin.resourcesRelativeTo = relativeTo; - return Promise.resolve(); +}); +Object.keys(aureliaMetadata).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return aureliaMetadata[k]; } }); - - return this; - }; - - FrameworkConfiguration.prototype.defaultBindingLanguage = function defaultBindingLanguage() { - return this._addNormalizedPlugin('aurelia-templating-binding'); - }; - - FrameworkConfiguration.prototype.router = function router() { - return this._addNormalizedPlugin('aurelia-templating-router'); - }; - - FrameworkConfiguration.prototype.history = function history() { - return this._addNormalizedPlugin('aurelia-history-browser'); - }; - - FrameworkConfiguration.prototype.defaultResources = function defaultResources() { - return this._addNormalizedPlugin('aurelia-templating-resources'); - }; - - FrameworkConfiguration.prototype.eventAggregator = function eventAggregator() { - return this._addNormalizedPlugin('aurelia-event-aggregator'); - }; - - FrameworkConfiguration.prototype.basicConfiguration = function basicConfiguration() { - return this.defaultBindingLanguage().defaultResources().eventAggregator(); - }; - - FrameworkConfiguration.prototype.standardConfiguration = function standardConfiguration() { - return this.basicConfiguration().history().router(); - }; - - FrameworkConfiguration.prototype.developmentLogging = function developmentLogging(level) { - var _this7 = this; - - var logLevel = level ? TheLogManager.logLevel[level] : undefined; - - if (logLevel === undefined) { - logLevel = TheLogManager.logLevel.debug; - } - - this.preTask(function () { - return _this7.aurelia.loader.normalize('aurelia-logging-console', _this7.bootstrapperName).then(function (name) { - return _this7.aurelia.loader.loadModule(name).then(function (m) { - TheLogManager.addAppender(new m.ConsoleAppender()); - TheLogManager.setLevel(logLevel); - }); - }); +}); +Object.keys(aureliaTemplating).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return aureliaTemplating[k]; } }); - - return this; - }; - - FrameworkConfiguration.prototype.apply = function apply() { - var _this8 = this; - - if (this.processed) { - return Promise.resolve(); - } - - return runTasks(this, this.preTasks).then(function () { - var loader = _this8.aurelia.loader; - var info = _this8.info; - var current = void 0; - - var next = function next() { - current = info.shift(); - if (current) { - return loadPlugin(_this8, loader, current).then(next); - } - - _this8.processed = true; - _this8.configuredPlugins = null; - return Promise.resolve(); - }; - - return next().then(function () { - return runTasks(_this8, _this8.postTasks); - }); +}); +Object.keys(aureliaLoader).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return aureliaLoader[k]; } }); - }; +}); +Object.keys(aureliaTaskQueue).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return aureliaTaskQueue[k]; } + }); +}); +Object.keys(aureliaPath).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return aureliaPath[k]; } + }); +}); +Object.keys(aureliaPal).forEach(function (k) { + if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { + enumerable: true, + get: function () { return aureliaPal[k]; } + }); +}); - return FrameworkConfiguration; -}(); -exports.FrameworkConfiguration = FrameworkConfiguration; -var LogManager = exports.LogManager = TheLogManager; }); ; define('aurelia-history-browser/dist/commonjs/aurelia-history-browser',['require','exports','module','aurelia-history','aurelia-pal'],function (require, exports, module) {'use strict'; @@ -11446,214 +11287,216 @@ function reset() { ; define('aurelia-path/dist/commonjs/aurelia-path',['require','exports','module'],function (require, exports, module) {'use strict'; -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -exports.relativeToFile = relativeToFile; -exports.join = join; -exports.buildQueryString = buildQueryString; -exports.parseQueryString = parseQueryString; +Object.defineProperty(exports, '__esModule', { value: true }); function trimDots(ary) { - for (var i = 0; i < ary.length; ++i) { - var part = ary[i]; - if (part === '.') { - ary.splice(i, 1); - i -= 1; - } else if (part === '..') { - if (i === 0 || i === 1 && ary[2] === '..' || ary[i - 1] === '..') { - continue; - } else if (i > 0) { - ary.splice(i - 1, 2); - i -= 2; - } + for (var i = 0; i < ary.length; ++i) { + var part = ary[i]; + if (part === '.') { + ary.splice(i, 1); + i -= 1; + } + else if (part === '..') { + if (i === 0 || (i === 1 && ary[2] === '..') || ary[i - 1] === '..') { + continue; + } + else if (i > 0) { + ary.splice(i - 1, 2); + i -= 2; + } + } } - } } - function relativeToFile(name, file) { - var fileParts = file && file.split('/'); - var nameParts = name.trim().split('/'); - - if (nameParts[0].charAt(0) === '.' && fileParts) { - var normalizedBaseParts = fileParts.slice(0, fileParts.length - 1); - nameParts.unshift.apply(nameParts, normalizedBaseParts); - } - - trimDots(nameParts); - - return nameParts.join('/'); + var fileParts = file && file.split('/'); + var nameParts = name.trim().split('/'); + if (nameParts[0].charAt(0) === '.' && fileParts) { + var normalizedBaseParts = fileParts.slice(0, fileParts.length - 1); + nameParts.unshift.apply(nameParts, normalizedBaseParts); + } + trimDots(nameParts); + return nameParts.join('/'); } - function join(path1, path2) { - if (!path1) { - return path2; - } - - if (!path2) { - return path1; - } - - var schemeMatch = path1.match(/^([^/]*?:)\//); - var scheme = schemeMatch && schemeMatch.length > 0 ? schemeMatch[1] : ''; - path1 = path1.substr(scheme.length); - - var urlPrefix = void 0; - if (path1.indexOf('///') === 0 && scheme === 'file:') { - urlPrefix = '///'; - } else if (path1.indexOf('//') === 0) { - urlPrefix = '//'; - } else if (path1.indexOf('/') === 0) { - urlPrefix = '/'; - } else { - urlPrefix = ''; - } - - var trailingSlash = path2.slice(-1) === '/' ? '/' : ''; - - var url1 = path1.split('/'); - var url2 = path2.split('/'); - var url3 = []; - - for (var i = 0, ii = url1.length; i < ii; ++i) { - if (url1[i] === '..') { - url3.pop(); - } else if (url1[i] === '.' || url1[i] === '') { - continue; - } else { - url3.push(url1[i]); + if (!path1) { + return path2; } - } - - for (var _i = 0, _ii = url2.length; _i < _ii; ++_i) { - if (url2[_i] === '..') { - url3.pop(); - } else if (url2[_i] === '.' || url2[_i] === '') { - continue; - } else { - url3.push(url2[_i]); + if (!path2) { + return path1; } - } - - return scheme + urlPrefix + url3.join('/') + trailingSlash; + var schemeMatch = path1.match(/^([^/]*?:)\//); + var scheme = (schemeMatch && schemeMatch.length > 0) ? schemeMatch[1] : ''; + path1 = path1.substr(scheme.length); + var urlPrefix; + if (path1.indexOf('///') === 0 && scheme === 'file:') { + urlPrefix = '///'; + } + else if (path1.indexOf('//') === 0) { + urlPrefix = '//'; + } + else if (path1.indexOf('/') === 0) { + urlPrefix = '/'; + } + else { + urlPrefix = ''; + } + var trailingSlash = path2.slice(-1) === '/' ? '/' : ''; + var url1 = path1.split('/'); + var url2 = path2.split('/'); + var url3 = []; + for (var i = 0, ii = url1.length; i < ii; ++i) { + if (url1[i] === '..') { + if (url3.length && url3[url3.length - 1] !== '..') { + url3.pop(); + } + else { + url3.push(url1[i]); + } + } + else if (url1[i] === '.' || url1[i] === '') { + continue; + } + else { + url3.push(url1[i]); + } + } + for (var i = 0, ii = url2.length; i < ii; ++i) { + if (url2[i] === '..') { + if (url3.length && url3[url3.length - 1] !== '..') { + url3.pop(); + } + else { + url3.push(url2[i]); + } + } + else if (url2[i] === '.' || url2[i] === '') { + continue; + } + else { + url3.push(url2[i]); + } + } + return scheme + urlPrefix + url3.join('/') + trailingSlash; } - var encode = encodeURIComponent; -var encodeKey = function encodeKey(k) { - return encode(k).replace('%24', '$'); -}; - +var encodeKey = function (k) { return encode(k).replace('%24', '$'); }; function buildParam(key, value, traditional) { - var result = []; - if (value === null || value === undefined) { - return result; - } - if (Array.isArray(value)) { - for (var i = 0, l = value.length; i < l; i++) { - if (traditional) { - result.push(encodeKey(key) + '=' + encode(value[i])); - } else { - var arrayKey = key + '[' + (_typeof(value[i]) === 'object' && value[i] !== null ? i : '') + ']'; - result = result.concat(buildParam(arrayKey, value[i])); - } + var result = []; + if (value === null || value === undefined) { + return result; } - } else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && !traditional) { - for (var propertyName in value) { - result = result.concat(buildParam(key + '[' + propertyName + ']', value[propertyName])); + if (Array.isArray(value)) { + for (var i = 0, l = value.length; i < l; i++) { + if (traditional) { + result.push(encodeKey(key) + "=" + encode(value[i])); + } + else { + var arrayKey = key + '[' + (typeof value[i] === 'object' && value[i] !== null ? i : '') + ']'; + result = result.concat(buildParam(arrayKey, value[i])); + } + } } - } else { - result.push(encodeKey(key) + '=' + encode(value)); - } - return result; + else if (typeof (value) === 'object' && !traditional) { + for (var propertyName in value) { + result = result.concat(buildParam(key + '[' + propertyName + ']', value[propertyName])); + } + } + else { + result.push(encodeKey(key) + "=" + encode(value)); + } + return result; } - function buildQueryString(params, traditional) { - var pairs = []; - var keys = Object.keys(params || {}).sort(); - for (var i = 0, len = keys.length; i < len; i++) { - var key = keys[i]; - pairs = pairs.concat(buildParam(key, params[key], traditional)); - } - - if (pairs.length === 0) { - return ''; - } - - return pairs.join('&'); + var pairs = []; + var keys = Object.keys(params || {}).sort(); + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i]; + pairs = pairs.concat(buildParam(key, params[key], traditional)); + } + if (pairs.length === 0) { + return ''; + } + return pairs.join('&'); } - function processScalarParam(existedParam, value) { - if (Array.isArray(existedParam)) { - existedParam.push(value); - return existedParam; - } - if (existedParam !== undefined) { - return [existedParam, value]; - } - - return value; + if (Array.isArray(existedParam)) { + existedParam.push(value); + return existedParam; + } + if (existedParam !== undefined) { + return [existedParam, value]; + } + return value; } - function parseComplexParam(queryParams, keys, value) { - var currentParams = queryParams; - var keysLastIndex = keys.length - 1; - for (var j = 0; j <= keysLastIndex; j++) { - var key = keys[j] === '' ? currentParams.length : keys[j]; - if (j < keysLastIndex) { - var prevValue = !currentParams[key] || _typeof(currentParams[key]) === 'object' ? currentParams[key] : [currentParams[key]]; - currentParams = currentParams[key] = prevValue || (isNaN(keys[j + 1]) ? {} : []); - } else { - currentParams = currentParams[key] = value; + var currentParams = queryParams; + var keysLastIndex = keys.length - 1; + for (var j = 0; j <= keysLastIndex; j++) { + var key = keys[j] === '' ? currentParams.length : keys[j]; + preventPollution(key); + if (j < keysLastIndex) { + var prevValue = !currentParams[key] || typeof currentParams[key] === 'object' ? currentParams[key] : [currentParams[key]]; + currentParams = currentParams[key] = prevValue || (isNaN(keys[j + 1]) ? {} : []); + } + else { + currentParams = currentParams[key] = value; + } } - } } - function parseQueryString(queryString) { - var queryParams = {}; - if (!queryString || typeof queryString !== 'string') { + var queryParams = {}; + if (!queryString || typeof queryString !== 'string') { + return queryParams; + } + var query = queryString; + if (query.charAt(0) === '?') { + query = query.substr(1); + } + var pairs = query.replace(/\+/g, ' ').split('&'); + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i].split('='); + var key = decodeURIComponent(pair[0]); + if (!key) { + continue; + } + var keys = key.split(']['); + var keysLastIndex = keys.length - 1; + if (/\[/.test(keys[0]) && /\]$/.test(keys[keysLastIndex])) { + keys[keysLastIndex] = keys[keysLastIndex].replace(/\]$/, ''); + keys = keys.shift().split('[').concat(keys); + keysLastIndex = keys.length - 1; + } + else { + keysLastIndex = 0; + } + if (pair.length >= 2) { + var value = pair[1] ? decodeURIComponent(pair[1]) : ''; + if (keysLastIndex) { + parseComplexParam(queryParams, keys, value); + } + else { + preventPollution(key); + queryParams[key] = processScalarParam(queryParams[key], value); + } + } + else { + queryParams[key] = true; + } + } return queryParams; - } - - var query = queryString; - if (query.charAt(0) === '?') { - query = query.substr(1); - } - - var pairs = query.replace(/\+/g, ' ').split('&'); - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i].split('='); - var key = decodeURIComponent(pair[0]); - if (!key) { - continue; +} +function preventPollution(key) { + if (key === '__proto__') { + throw new Error('Prototype pollution detected.'); } +} - var keys = key.split(']['); - var keysLastIndex = keys.length - 1; +exports.buildQueryString = buildQueryString; +exports.join = join; +exports.parseQueryString = parseQueryString; +exports.relativeToFile = relativeToFile; - if (/\[/.test(keys[0]) && /\]$/.test(keys[keysLastIndex])) { - keys[keysLastIndex] = keys[keysLastIndex].replace(/\]$/, ''); - keys = keys.shift().split('[').concat(keys); - keysLastIndex = keys.length - 1; - } else { - keysLastIndex = 0; - } - if (pair.length >= 2) { - var value = pair[1] ? decodeURIComponent(pair[1]) : ''; - if (keysLastIndex) { - parseComplexParam(queryParams, keys, value); - } else { - queryParams[key] = processScalarParam(queryParams[key], value); - } - } else { - queryParams[key] = true; - } - } - return queryParams; -} }); ; define('aurelia-polyfills/dist/commonjs/aurelia-polyfills',['require','exports','module','aurelia-pal'],function (require, exports, module) {'use strict'; @@ -15555,909 +15398,47 @@ function filterFlushStack(stack) { } }); ; -define('aurelia-templating-binding/dist/commonjs/aurelia-templating-binding',['require','exports','module','aurelia-logging','aurelia-binding','aurelia-templating'],function (require, exports, module) {'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.TemplatingBindingLanguage = exports.SyntaxInterpreter = exports.LetInterpolationBinding = exports.LetInterpolationBindingExpression = exports.LetBinding = exports.LetExpression = exports.ChildInterpolationBinding = exports.InterpolationBinding = exports.InterpolationBindingExpression = exports.AttributeMap = undefined; - -var _class, _temp, _dec, _class2, _dec2, _class3, _class4, _temp2, _class5, _temp3; - -exports.configure = configure; - -var _aureliaLogging = require('aurelia-logging'); - -var LogManager = _interopRequireWildcard(_aureliaLogging); - -var _aureliaBinding = require('aurelia-binding'); - -var _aureliaTemplating = require('aurelia-templating'); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - - -var AttributeMap = exports.AttributeMap = (_temp = _class = function () { - function AttributeMap(svg) { - - - this.elements = Object.create(null); - this.allElements = Object.create(null); - - this.svg = svg; - - this.registerUniversal('accesskey', 'accessKey'); - this.registerUniversal('contenteditable', 'contentEditable'); - this.registerUniversal('tabindex', 'tabIndex'); - this.registerUniversal('textcontent', 'textContent'); - this.registerUniversal('innerhtml', 'innerHTML'); - this.registerUniversal('scrolltop', 'scrollTop'); - this.registerUniversal('scrollleft', 'scrollLeft'); - this.registerUniversal('readonly', 'readOnly'); - - this.register('label', 'for', 'htmlFor'); - - this.register('img', 'usemap', 'useMap'); - - this.register('input', 'maxlength', 'maxLength'); - this.register('input', 'minlength', 'minLength'); - this.register('input', 'formaction', 'formAction'); - this.register('input', 'formenctype', 'formEncType'); - this.register('input', 'formmethod', 'formMethod'); - this.register('input', 'formnovalidate', 'formNoValidate'); - this.register('input', 'formtarget', 'formTarget'); - - this.register('textarea', 'maxlength', 'maxLength'); - - this.register('td', 'rowspan', 'rowSpan'); - this.register('td', 'colspan', 'colSpan'); - this.register('th', 'rowspan', 'rowSpan'); - this.register('th', 'colspan', 'colSpan'); - } - - AttributeMap.prototype.register = function register(elementName, attributeName, propertyName) { - elementName = elementName.toLowerCase(); - attributeName = attributeName.toLowerCase(); - var element = this.elements[elementName] = this.elements[elementName] || Object.create(null); - element[attributeName] = propertyName; - }; - - AttributeMap.prototype.registerUniversal = function registerUniversal(attributeName, propertyName) { - attributeName = attributeName.toLowerCase(); - this.allElements[attributeName] = propertyName; - }; - - AttributeMap.prototype.map = function map(elementName, attributeName) { - if (this.svg.isStandardSvgAttribute(elementName, attributeName)) { - return attributeName; - } - elementName = elementName.toLowerCase(); - attributeName = attributeName.toLowerCase(); - var element = this.elements[elementName]; - if (element !== undefined && attributeName in element) { - return element[attributeName]; - } - if (attributeName in this.allElements) { - return this.allElements[attributeName]; - } - - if (/(?:^data-)|(?:^aria-)|:/.test(attributeName)) { - return attributeName; - } - return (0, _aureliaBinding.camelCase)(attributeName); - }; - - return AttributeMap; -}(), _class.inject = [_aureliaBinding.SVGAnalyzer], _temp); - -var InterpolationBindingExpression = exports.InterpolationBindingExpression = function () { - function InterpolationBindingExpression(observerLocator, targetProperty, parts, mode, lookupFunctions, attribute) { - - - this.observerLocator = observerLocator; - this.targetProperty = targetProperty; - this.parts = parts; - this.mode = mode; - this.lookupFunctions = lookupFunctions; - this.attribute = this.attrToRemove = attribute; - this.discrete = false; - } - - InterpolationBindingExpression.prototype.createBinding = function createBinding(target) { - if (this.parts.length === 3) { - return new ChildInterpolationBinding(target, this.observerLocator, this.parts[1], this.mode, this.lookupFunctions, this.targetProperty, this.parts[0], this.parts[2]); - } - return new InterpolationBinding(this.observerLocator, this.parts, target, this.targetProperty, this.mode, this.lookupFunctions); - }; - - return InterpolationBindingExpression; -}(); - -function validateTarget(target, propertyName) { - if (propertyName === 'style') { - LogManager.getLogger('templating-binding').info('Internet Explorer does not support interpolation in "style" attributes. Use the style attribute\'s alias, "css" instead.'); - } else if (target.parentElement && target.parentElement.nodeName === 'TEXTAREA' && propertyName === 'textContent') { - throw new Error('Interpolation binding cannot be used in the content of a textarea element. Use instead.'); - } -} - -var InterpolationBinding = exports.InterpolationBinding = function () { - function InterpolationBinding(observerLocator, parts, target, targetProperty, mode, lookupFunctions) { - - - validateTarget(target, targetProperty); - this.observerLocator = observerLocator; - this.parts = parts; - this.target = target; - this.targetProperty = targetProperty; - this.targetAccessor = observerLocator.getAccessor(target, targetProperty); - this.mode = mode; - this.lookupFunctions = lookupFunctions; - } - - InterpolationBinding.prototype.interpolate = function interpolate() { - if (this.isBound) { - var value = ''; - var parts = this.parts; - for (var i = 0, ii = parts.length; i < ii; i++) { - value += i % 2 === 0 ? parts[i] : this['childBinding' + i].value; - } - this.targetAccessor.setValue(value, this.target, this.targetProperty); - } - }; - - InterpolationBinding.prototype.updateOneTimeBindings = function updateOneTimeBindings() { - for (var i = 1, ii = this.parts.length; i < ii; i += 2) { - var child = this['childBinding' + i]; - if (child.mode === _aureliaBinding.bindingMode.oneTime) { - child.call(); - } - } - }; - - InterpolationBinding.prototype.bind = function bind(source) { - if (this.isBound) { - if (this.source === source) { - return; - } - this.unbind(); - } - this.source = source; - - var parts = this.parts; - for (var i = 1, ii = parts.length; i < ii; i += 2) { - var binding = new ChildInterpolationBinding(this, this.observerLocator, parts[i], this.mode, this.lookupFunctions); - binding.bind(source); - this['childBinding' + i] = binding; - } - - this.isBound = true; - this.interpolate(); - }; - - InterpolationBinding.prototype.unbind = function unbind() { - if (!this.isBound) { - return; - } - this.isBound = false; - this.source = null; - var parts = this.parts; - for (var i = 1, ii = parts.length; i < ii; i += 2) { - var name = 'childBinding' + i; - this[name].unbind(); - } - }; - - return InterpolationBinding; -}(); - -var ChildInterpolationBinding = exports.ChildInterpolationBinding = (_dec = (0, _aureliaBinding.connectable)(), _dec(_class2 = function () { - function ChildInterpolationBinding(target, observerLocator, sourceExpression, mode, lookupFunctions, targetProperty, left, right) { - - - if (target instanceof InterpolationBinding) { - this.parent = target; - } else { - validateTarget(target, targetProperty); - this.target = target; - this.targetProperty = targetProperty; - this.targetAccessor = observerLocator.getAccessor(target, targetProperty); - } - this.observerLocator = observerLocator; - this.sourceExpression = sourceExpression; - this.mode = mode; - this.lookupFunctions = lookupFunctions; - this.left = left; - this.right = right; - } - - ChildInterpolationBinding.prototype.updateTarget = function updateTarget(value) { - value = value === null || value === undefined ? '' : value.toString(); - if (value !== this.value) { - this.value = value; - if (this.parent) { - this.parent.interpolate(); - } else { - this.targetAccessor.setValue(this.left + value + this.right, this.target, this.targetProperty); - } - } - }; - - ChildInterpolationBinding.prototype.call = function call() { - if (!this.isBound) { - return; - } - - this.rawValue = this.sourceExpression.evaluate(this.source, this.lookupFunctions); - this.updateTarget(this.rawValue); - - if (this.mode !== _aureliaBinding.bindingMode.oneTime) { - this._version++; - this.sourceExpression.connect(this, this.source); - if (this.rawValue instanceof Array) { - this.observeArray(this.rawValue); - } - this.unobserve(false); - } - }; - - ChildInterpolationBinding.prototype.bind = function bind(source) { - if (this.isBound) { - if (this.source === source) { - return; - } - this.unbind(); - } - this.isBound = true; - this.source = source; - - var sourceExpression = this.sourceExpression; - if (sourceExpression.bind) { - sourceExpression.bind(this, source, this.lookupFunctions); - } - - this.rawValue = sourceExpression.evaluate(source, this.lookupFunctions); - this.updateTarget(this.rawValue); - - if (this.mode === _aureliaBinding.bindingMode.oneWay) { - (0, _aureliaBinding.enqueueBindingConnect)(this); - } - }; - - ChildInterpolationBinding.prototype.unbind = function unbind() { - if (!this.isBound) { - return; - } - this.isBound = false; - var sourceExpression = this.sourceExpression; - if (sourceExpression.unbind) { - sourceExpression.unbind(this, this.source); - } - this.source = null; - this.value = null; - this.rawValue = null; - this.unobserve(true); - }; - - ChildInterpolationBinding.prototype.connect = function connect(evaluate) { - if (!this.isBound) { - return; - } - if (evaluate) { - this.rawValue = this.sourceExpression.evaluate(this.source, this.lookupFunctions); - this.updateTarget(this.rawValue); - } - this.sourceExpression.connect(this, this.source); - if (this.rawValue instanceof Array) { - this.observeArray(this.rawValue); - } - }; - - return ChildInterpolationBinding; -}()) || _class2); - -var LetExpression = exports.LetExpression = function () { - function LetExpression(observerLocator, targetProperty, sourceExpression, lookupFunctions, toBindingContext) { - - - this.observerLocator = observerLocator; - this.sourceExpression = sourceExpression; - this.targetProperty = targetProperty; - this.lookupFunctions = lookupFunctions; - this.toBindingContext = toBindingContext; - } - - LetExpression.prototype.createBinding = function createBinding() { - return new LetBinding(this.observerLocator, this.sourceExpression, this.targetProperty, this.lookupFunctions, this.toBindingContext); - }; - - return LetExpression; -}(); - -var LetBinding = exports.LetBinding = (_dec2 = (0, _aureliaBinding.connectable)(), _dec2(_class3 = function () { - function LetBinding(observerLocator, sourceExpression, targetProperty, lookupFunctions, toBindingContext) { - - - this.observerLocator = observerLocator; - this.sourceExpression = sourceExpression; - this.targetProperty = targetProperty; - this.lookupFunctions = lookupFunctions; - this.source = null; - this.target = null; - this.toBindingContext = toBindingContext; - } - - LetBinding.prototype.updateTarget = function updateTarget() { - var value = this.sourceExpression.evaluate(this.source, this.lookupFunctions); - this.target[this.targetProperty] = value; - }; - - LetBinding.prototype.call = function call(context) { - if (!this.isBound) { - return; - } - if (context === _aureliaBinding.sourceContext) { - this.updateTarget(); - return; - } - throw new Error('Unexpected call context ' + context); - }; - - LetBinding.prototype.bind = function bind(source) { - if (this.isBound) { - if (this.source === source) { - return; - } - this.unbind(); - } - - this.isBound = true; - this.source = source; - this.target = this.toBindingContext ? source.bindingContext : source.overrideContext; - - if (this.sourceExpression.bind) { - this.sourceExpression.bind(this, source, this.lookupFunctions); - } - - (0, _aureliaBinding.enqueueBindingConnect)(this); - }; - - LetBinding.prototype.unbind = function unbind() { - if (!this.isBound) { - return; - } - this.isBound = false; - if (this.sourceExpression.unbind) { - this.sourceExpression.unbind(this, this.source); - } - this.source = null; - this.target = null; - this.unobserve(true); - }; - - LetBinding.prototype.connect = function connect() { - if (!this.isBound) { - return; - } - this.updateTarget(); - this.sourceExpression.connect(this, this.source); - }; - - return LetBinding; -}()) || _class3); - -var LetInterpolationBindingExpression = exports.LetInterpolationBindingExpression = function () { - function LetInterpolationBindingExpression(observerLocator, targetProperty, parts, lookupFunctions, toBindingContext) { - - - this.observerLocator = observerLocator; - this.targetProperty = targetProperty; - this.parts = parts; - this.lookupFunctions = lookupFunctions; - this.toBindingContext = toBindingContext; - } - - LetInterpolationBindingExpression.prototype.createBinding = function createBinding() { - return new LetInterpolationBinding(this.observerLocator, this.targetProperty, this.parts, this.lookupFunctions, this.toBindingContext); - }; - - return LetInterpolationBindingExpression; -}(); - -var LetInterpolationBinding = exports.LetInterpolationBinding = function () { - function LetInterpolationBinding(observerLocator, targetProperty, parts, lookupFunctions, toBindingContext) { - - - this.observerLocator = observerLocator; - this.parts = parts; - this.targetProperty = targetProperty; - this.lookupFunctions = lookupFunctions; - this.toBindingContext = toBindingContext; - this.target = null; - } - - LetInterpolationBinding.prototype.bind = function bind(source) { - if (this.isBound) { - if (this.source === source) { - return; - } - this.unbind(); - } - - this.isBound = true; - this.source = source; - this.target = this.toBindingContext ? source.bindingContext : source.overrideContext; - - this.interpolationBinding = this.createInterpolationBinding(); - this.interpolationBinding.bind(source); - }; - - LetInterpolationBinding.prototype.unbind = function unbind() { - if (!this.isBound) { - return; - } - this.isBound = false; - this.source = null; - this.target = null; - this.interpolationBinding.unbind(); - this.interpolationBinding = null; - }; - - LetInterpolationBinding.prototype.createInterpolationBinding = function createInterpolationBinding() { - if (this.parts.length === 3) { - return new ChildInterpolationBinding(this.target, this.observerLocator, this.parts[1], _aureliaBinding.bindingMode.oneWay, this.lookupFunctions, this.targetProperty, this.parts[0], this.parts[2]); - } - return new InterpolationBinding(this.observerLocator, this.parts, this.target, this.targetProperty, _aureliaBinding.bindingMode.oneWay, this.lookupFunctions); - }; - - return LetInterpolationBinding; -}(); - -var SyntaxInterpreter = exports.SyntaxInterpreter = (_temp2 = _class4 = function () { - function SyntaxInterpreter(parser, observerLocator, eventManager, attributeMap) { - - - this.parser = parser; - this.observerLocator = observerLocator; - this.eventManager = eventManager; - this.attributeMap = attributeMap; - } - - SyntaxInterpreter.prototype.interpret = function interpret(resources, element, info, existingInstruction, context) { - if (info.command in this) { - return this[info.command](resources, element, info, existingInstruction, context); - } - - return this.handleUnknownCommand(resources, element, info, existingInstruction, context); - }; - - SyntaxInterpreter.prototype.handleUnknownCommand = function handleUnknownCommand(resources, element, info, existingInstruction, context) { - LogManager.getLogger('templating-binding').warn('Unknown binding command.', info); - return existingInstruction; - }; - - SyntaxInterpreter.prototype.determineDefaultBindingMode = function determineDefaultBindingMode(element, attrName, context) { - var tagName = element.tagName.toLowerCase(); - - if (tagName === 'input' && (attrName === 'value' || attrName === 'files') && element.type !== 'checkbox' && element.type !== 'radio' || tagName === 'input' && attrName === 'checked' && (element.type === 'checkbox' || element.type === 'radio') || (tagName === 'textarea' || tagName === 'select') && attrName === 'value' || (attrName === 'textcontent' || attrName === 'innerhtml') && element.contentEditable === 'true' || attrName === 'scrolltop' || attrName === 'scrollleft') { - return _aureliaBinding.bindingMode.twoWay; - } - - if (context && attrName in context.attributes && context.attributes[attrName] && context.attributes[attrName].defaultBindingMode >= _aureliaBinding.bindingMode.oneTime) { - return context.attributes[attrName].defaultBindingMode; - } - - return _aureliaBinding.bindingMode.oneWay; - }; - - SyntaxInterpreter.prototype.bind = function bind(resources, element, info, existingInstruction, context) { - var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName); - - instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), info.defaultBindingMode === undefined || info.defaultBindingMode === null ? this.determineDefaultBindingMode(element, info.attrName, context) : info.defaultBindingMode, resources.lookupFunctions); - - return instruction; - }; - - SyntaxInterpreter.prototype.trigger = function trigger(resources, element, info) { - return new _aureliaBinding.ListenerExpression(this.eventManager, info.attrName, this.parser.parse(info.attrValue), _aureliaBinding.delegationStrategy.none, true, resources.lookupFunctions); - }; - - SyntaxInterpreter.prototype.capture = function capture(resources, element, info) { - return new _aureliaBinding.ListenerExpression(this.eventManager, info.attrName, this.parser.parse(info.attrValue), _aureliaBinding.delegationStrategy.capturing, true, resources.lookupFunctions); - }; - - SyntaxInterpreter.prototype.delegate = function delegate(resources, element, info) { - return new _aureliaBinding.ListenerExpression(this.eventManager, info.attrName, this.parser.parse(info.attrValue), _aureliaBinding.delegationStrategy.bubbling, true, resources.lookupFunctions); - }; - - SyntaxInterpreter.prototype.call = function call(resources, element, info, existingInstruction) { - var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName); - - instruction.attributes[info.attrName] = new _aureliaBinding.CallExpression(this.observerLocator, info.attrName, this.parser.parse(info.attrValue), resources.lookupFunctions); - - return instruction; - }; - - SyntaxInterpreter.prototype.options = function options(resources, element, info, existingInstruction, context) { - var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName); - var attrValue = info.attrValue; - var language = this.language; - var name = null; - var target = ''; - var current = void 0; - var i = void 0; - var ii = void 0; - var inString = false; - var inEscape = false; - var foundName = false; - - for (i = 0, ii = attrValue.length; i < ii; ++i) { - current = attrValue[i]; - - if (current === ';' && !inString) { - if (!foundName) { - name = this._getPrimaryPropertyName(resources, context); - } - info = language.inspectAttribute(resources, '?', name, target.trim()); - language.createAttributeInstruction(resources, element, info, instruction, context); - - if (!instruction.attributes[info.attrName]) { - instruction.attributes[info.attrName] = info.attrValue; - } - - target = ''; - name = null; - } else if (current === ':' && name === null) { - foundName = true; - name = target.trim(); - target = ''; - } else if (current === '\\') { - target += current; - inEscape = true; - continue; - } else { - target += current; - - if (name !== null && inEscape === false && current === '\'') { - inString = !inString; - } - } - - inEscape = false; - } - - if (!foundName) { - name = this._getPrimaryPropertyName(resources, context); - } - - if (name !== null) { - info = language.inspectAttribute(resources, '?', name, target.trim()); - language.createAttributeInstruction(resources, element, info, instruction, context); - - if (!instruction.attributes[info.attrName]) { - instruction.attributes[info.attrName] = info.attrValue; - } - } - - return instruction; - }; - - SyntaxInterpreter.prototype._getPrimaryPropertyName = function _getPrimaryPropertyName(resources, context) { - var type = resources.getAttribute(context.attributeName); - if (type && type.primaryProperty) { - return type.primaryProperty.attribute; - } - return null; - }; - - SyntaxInterpreter.prototype['for'] = function _for(resources, element, info, existingInstruction) { - var parts = void 0; - var keyValue = void 0; - var instruction = void 0; - var attrValue = void 0; - var isDestructuring = void 0; - - attrValue = info.attrValue; - isDestructuring = attrValue.match(/^ *[[].+[\]]/); - parts = isDestructuring ? attrValue.split('of ') : attrValue.split(' of '); - - if (parts.length !== 2) { - throw new Error('Incorrect syntax for "for". The form is: "$local of $items" or "[$key, $value] of $items".'); - } - - instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName); - - if (isDestructuring) { - keyValue = parts[0].replace(/[[\]]/g, '').replace(/,/g, ' ').replace(/\s+/g, ' ').trim().split(' '); - instruction.attributes.key = keyValue[0]; - instruction.attributes.value = keyValue[1]; - } else { - instruction.attributes.local = parts[0]; - } - - instruction.attributes.items = new _aureliaBinding.BindingExpression(this.observerLocator, 'items', this.parser.parse(parts[1]), _aureliaBinding.bindingMode.oneWay, resources.lookupFunctions); - - return instruction; - }; - - SyntaxInterpreter.prototype['two-way'] = function twoWay(resources, element, info, existingInstruction) { - var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName); - - instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), _aureliaBinding.bindingMode.twoWay, resources.lookupFunctions); - - return instruction; - }; - - SyntaxInterpreter.prototype['to-view'] = function toView(resources, element, info, existingInstruction) { - var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName); - - instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), _aureliaBinding.bindingMode.toView, resources.lookupFunctions); - - return instruction; - }; - - SyntaxInterpreter.prototype['from-view'] = function fromView(resources, element, info, existingInstruction) { - var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName); - - instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), _aureliaBinding.bindingMode.fromView, resources.lookupFunctions); - - return instruction; - }; - - SyntaxInterpreter.prototype['one-time'] = function oneTime(resources, element, info, existingInstruction) { - var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName); - - instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), _aureliaBinding.bindingMode.oneTime, resources.lookupFunctions); - - return instruction; - }; - - return SyntaxInterpreter; -}(), _class4.inject = [_aureliaBinding.Parser, _aureliaBinding.ObserverLocator, _aureliaBinding.EventManager, AttributeMap], _temp2); - - -SyntaxInterpreter.prototype['one-way'] = SyntaxInterpreter.prototype['to-view']; - -var info = {}; - -var TemplatingBindingLanguage = exports.TemplatingBindingLanguage = (_temp3 = _class5 = function (_BindingLanguage) { - _inherits(TemplatingBindingLanguage, _BindingLanguage); - - function TemplatingBindingLanguage(parser, observerLocator, syntaxInterpreter, attributeMap) { - - - var _this = _possibleConstructorReturn(this, _BindingLanguage.call(this)); - - _this.parser = parser; - _this.observerLocator = observerLocator; - _this.syntaxInterpreter = syntaxInterpreter; - _this.emptyStringExpression = _this.parser.parse('\'\''); - syntaxInterpreter.language = _this; - _this.attributeMap = attributeMap; - _this.toBindingContextAttr = 'to-binding-context'; - return _this; - } - - TemplatingBindingLanguage.prototype.inspectAttribute = function inspectAttribute(resources, elementName, attrName, attrValue) { - var parts = attrName.split('.'); - - info.defaultBindingMode = null; - - if (parts.length === 2) { - info.attrName = parts[0].trim(); - info.attrValue = attrValue; - info.command = parts[1].trim(); - - if (info.command === 'ref') { - info.expression = new _aureliaBinding.NameExpression(this.parser.parse(attrValue), info.attrName, resources.lookupFunctions); - info.command = null; - info.attrName = 'ref'; - } else { - info.expression = null; - } - } else if (attrName === 'ref') { - info.attrName = attrName; - info.attrValue = attrValue; - info.command = null; - info.expression = new _aureliaBinding.NameExpression(this.parser.parse(attrValue), 'element', resources.lookupFunctions); - } else { - info.attrName = attrName; - info.attrValue = attrValue; - info.command = null; - var interpolationParts = this.parseInterpolation(resources, attrValue); - if (interpolationParts === null) { - info.expression = null; - } else { - info.expression = new InterpolationBindingExpression(this.observerLocator, this.attributeMap.map(elementName, attrName), interpolationParts, _aureliaBinding.bindingMode.oneWay, resources.lookupFunctions, attrName); - } - } - - return info; - }; - - TemplatingBindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, theInfo, existingInstruction, context) { - var instruction = void 0; - - if (theInfo.expression) { - if (theInfo.attrName === 'ref') { - return theInfo.expression; - } - - instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(theInfo.attrName); - instruction.attributes[theInfo.attrName] = theInfo.expression; - } else if (theInfo.command) { - instruction = this.syntaxInterpreter.interpret(resources, element, theInfo, existingInstruction, context); - } - - return instruction; - }; - - TemplatingBindingLanguage.prototype.createLetExpressions = function createLetExpressions(resources, letElement) { - var expressions = []; - var attributes = letElement.attributes; - - var attr = void 0; - - var parts = void 0; - var attrName = void 0; - var attrValue = void 0; - var command = void 0; - var toBindingContextAttr = this.toBindingContextAttr; - var toBindingContext = letElement.hasAttribute(toBindingContextAttr); - for (var i = 0, ii = attributes.length; ii > i; ++i) { - attr = attributes[i]; - attrName = attr.name; - attrValue = attr.nodeValue; - parts = attrName.split('.'); - - if (attrName === toBindingContextAttr) { - continue; - } - - if (parts.length === 2) { - command = parts[1]; - if (command !== 'bind') { - LogManager.getLogger('templating-binding-language').warn('Detected invalid let command. Expected "' + parts[0] + '.bind", given "' + attrName + '"'); - continue; - } - expressions.push(new LetExpression(this.observerLocator, (0, _aureliaBinding.camelCase)(parts[0]), this.parser.parse(attrValue), resources.lookupFunctions, toBindingContext)); - } else { - attrName = (0, _aureliaBinding.camelCase)(attrName); - parts = this.parseInterpolation(resources, attrValue); - if (parts === null) { - LogManager.getLogger('templating-binding-language').warn('Detected string literal in let bindings. Did you mean "' + attrName + '.bind=' + attrValue + '" or "' + attrName + '=${' + attrValue + '}" ?'); - } - if (parts) { - expressions.push(new LetInterpolationBindingExpression(this.observerLocator, attrName, parts, resources.lookupFunctions, toBindingContext)); - } else { - expressions.push(new LetExpression(this.observerLocator, attrName, new _aureliaBinding.LiteralString(attrValue), resources.lookupFunctions, toBindingContext)); - } - } - } - return expressions; - }; - - TemplatingBindingLanguage.prototype.inspectTextContent = function inspectTextContent(resources, value) { - var parts = this.parseInterpolation(resources, value); - if (parts === null) { - return null; - } - return new InterpolationBindingExpression(this.observerLocator, 'textContent', parts, _aureliaBinding.bindingMode.oneWay, resources.lookupFunctions, 'textContent'); - }; - - TemplatingBindingLanguage.prototype.parseInterpolation = function parseInterpolation(resources, value) { - var i = value.indexOf('${', 0); - var ii = value.length; - var char = void 0; - var pos = 0; - var open = 0; - var quote = null; - var interpolationStart = void 0; - var parts = void 0; - var partIndex = 0; - - while (i >= 0 && i < ii - 2) { - open = 1; - interpolationStart = i; - i += 2; - - do { - char = value[i]; - i++; - - if (char === "'" || char === '"') { - if (quote === null) { - quote = char; - } else if (quote === char) { - quote = null; - } - continue; - } - - if (char === '\\') { - i++; - continue; - } - - if (quote !== null) { - continue; - } - - if (char === '{') { - open++; - } else if (char === '}') { - open--; - } - } while (open > 0 && i < ii); - - if (open === 0) { - parts = parts || []; - if (value[interpolationStart - 1] === '\\' && value[interpolationStart - 2] !== '\\') { - parts[partIndex] = value.substring(pos, interpolationStart - 1) + value.substring(interpolationStart, i); - partIndex++; - parts[partIndex] = this.emptyStringExpression; - partIndex++; - } else { - parts[partIndex] = value.substring(pos, interpolationStart); - partIndex++; - parts[partIndex] = this.parser.parse(value.substring(interpolationStart + 2, i - 1)); - partIndex++; - } - pos = i; - i = value.indexOf('${', i); - } else { - break; - } - } - - if (partIndex === 0) { - return null; - } - - parts[partIndex] = value.substr(pos); - return parts; - }; - - return TemplatingBindingLanguage; -}(_aureliaTemplating.BindingLanguage), _class5.inject = [_aureliaBinding.Parser, _aureliaBinding.ObserverLocator, SyntaxInterpreter, AttributeMap], _temp3); -function configure(config) { - config.container.registerSingleton(_aureliaTemplating.BindingLanguage, TemplatingBindingLanguage); - config.container.registerAlias(_aureliaTemplating.BindingLanguage, TemplatingBindingLanguage); -} -}); -; -define('aurelia-templating-resources/dist/commonjs/aurelia-templating-resources',['require','exports','module','aurelia-dependency-injection','aurelia-pal','aurelia-task-queue','aurelia-templating','aurelia-binding','aurelia-logging','aurelia-loader','aurelia-path','aurelia-metadata'],function (require, exports, module) {'use strict'; +define('aurelia-templating-binding/dist/commonjs/aurelia-templating-binding',['require','exports','module','aurelia-templating','aurelia-binding','aurelia-logging'],function (require, exports, module) {'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); -var aureliaDependencyInjection = require('aurelia-dependency-injection'); -var aureliaPal = require('aurelia-pal'); -var aureliaTaskQueue = require('aurelia-task-queue'); var aureliaTemplating = require('aurelia-templating'); var aureliaBinding = require('aurelia-binding'); -var aureliaLogging = require('aurelia-logging'); -var aureliaLoader = require('aurelia-loader'); -var aureliaPath = require('aurelia-path'); -var aureliaMetadata = require('aurelia-metadata'); +var LogManager = require('aurelia-logging'); -/*! ***************************************************************************** -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 +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n["default"] = e; + return Object.freeze(n); +} -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. +var LogManager__namespace = /*#__PURE__*/_interopNamespace(LogManager); -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ @@ -16481,6 +15462,810 @@ function __decorate(decorators, target, key, desc) { return c > 3 && r && Object.defineProperty(target, key, r), r; } +var AttributeMap = (function () { + function AttributeMap(svg) { + this.elements = Object.create(null); + this.allElements = Object.create(null); + this.svg = svg; + this.registerUniversal('accesskey', 'accessKey'); + this.registerUniversal('contenteditable', 'contentEditable'); + this.registerUniversal('tabindex', 'tabIndex'); + this.registerUniversal('textcontent', 'textContent'); + this.registerUniversal('innerhtml', 'innerHTML'); + this.registerUniversal('scrolltop', 'scrollTop'); + this.registerUniversal('scrollleft', 'scrollLeft'); + this.registerUniversal('readonly', 'readOnly'); + this.register('label', 'for', 'htmlFor'); + this.register('img', 'usemap', 'useMap'); + this.register('input', 'maxlength', 'maxLength'); + this.register('input', 'minlength', 'minLength'); + this.register('input', 'formaction', 'formAction'); + this.register('input', 'formenctype', 'formEncType'); + this.register('input', 'formmethod', 'formMethod'); + this.register('input', 'formnovalidate', 'formNoValidate'); + this.register('input', 'formtarget', 'formTarget'); + this.register('textarea', 'maxlength', 'maxLength'); + this.register('td', 'rowspan', 'rowSpan'); + this.register('td', 'colspan', 'colSpan'); + this.register('th', 'rowspan', 'rowSpan'); + this.register('th', 'colspan', 'colSpan'); + } + AttributeMap.prototype.register = function (elementName, attributeName, propertyName) { + elementName = elementName.toLowerCase(); + attributeName = attributeName.toLowerCase(); + var element = this.elements[elementName] = (this.elements[elementName] || Object.create(null)); + element[attributeName] = propertyName; + }; + AttributeMap.prototype.registerUniversal = function (attributeName, propertyName) { + attributeName = attributeName.toLowerCase(); + this.allElements[attributeName] = propertyName; + }; + AttributeMap.prototype.map = function (elementName, attributeName) { + if (this.svg.isStandardSvgAttribute(elementName, attributeName)) { + return attributeName; + } + elementName = elementName.toLowerCase(); + attributeName = attributeName.toLowerCase(); + var element = this.elements[elementName]; + if (element !== undefined && attributeName in element) { + return element[attributeName]; + } + if (attributeName in this.allElements) { + return this.allElements[attributeName]; + } + if (/(?:^data-)|(?:^aria-)|:/.test(attributeName)) { + return attributeName; + } + return aureliaBinding.camelCase(attributeName); + }; + AttributeMap.inject = [aureliaBinding.SVGAnalyzer]; + return AttributeMap; +}()); + +var InterpolationBindingExpression = (function () { + function InterpolationBindingExpression(observerLocator, targetProperty, parts, mode, lookupFunctions, attribute) { + this.observerLocator = observerLocator; + this.targetProperty = targetProperty; + this.parts = parts; + this.mode = mode; + this.lookupFunctions = lookupFunctions; + this.attribute = this.attrToRemove = attribute; + this.discrete = false; + } + InterpolationBindingExpression.prototype.createBinding = function (target) { + if (this.parts.length === 3) { + return new ChildInterpolationBinding(target, this.observerLocator, this.parts[1], this.mode, this.lookupFunctions, this.targetProperty, this.parts[0], this.parts[2]); + } + return new InterpolationBinding(this.observerLocator, this.parts, target, this.targetProperty, this.mode, this.lookupFunctions); + }; + return InterpolationBindingExpression; +}()); +function validateTarget(target, propertyName) { + if (propertyName === 'style') { + LogManager__namespace.getLogger('templating-binding') + .info('Internet Explorer does not support interpolation in "style" attributes. Use the style attribute\'s alias, "css" instead.'); + } + else if (target.parentElement && target.parentElement.nodeName === 'TEXTAREA' && propertyName === 'textContent') { + throw new Error('Interpolation binding cannot be used in the content of a textarea element. Use instead.'); + } +} +var InterpolationBinding = (function () { + function InterpolationBinding(observerLocator, parts, target, targetProperty, mode, lookupFunctions) { + validateTarget(target, targetProperty); + this.observerLocator = observerLocator; + this.parts = parts; + this.target = target; + this.targetProperty = targetProperty; + this.targetAccessor = observerLocator.getAccessor(target, targetProperty); + this.mode = mode; + this.lookupFunctions = lookupFunctions; + } + InterpolationBinding.prototype.interpolate = function () { + if (this.isBound) { + var value = ''; + var parts = this.parts; + for (var i = 0, ii = parts.length; i < ii; i++) { + value += (i % 2 === 0 ? parts[i] : this["childBinding".concat(i)].value); + } + this.targetAccessor.setValue(value, this.target, this.targetProperty); + } + }; + InterpolationBinding.prototype.updateOneTimeBindings = function () { + for (var i = 1, ii = this.parts.length; i < ii; i += 2) { + var child = this["childBinding".concat(i)]; + if (child.mode === aureliaBinding.bindingMode.oneTime) { + child.call(); + } + } + }; + InterpolationBinding.prototype.bind = function (source) { + if (this.isBound) { + if (this.source === source) { + return; + } + this.unbind(); + } + this.source = source; + var parts = this.parts; + for (var i = 1, ii = parts.length; i < ii; i += 2) { + var binding = new ChildInterpolationBinding(this, this.observerLocator, parts[i], this.mode, this.lookupFunctions); + binding.bind(source); + this["childBinding".concat(i)] = binding; + } + this.isBound = true; + this.interpolate(); + }; + InterpolationBinding.prototype.unbind = function () { + if (!this.isBound) { + return; + } + this.isBound = false; + this.source = null; + var parts = this.parts; + for (var i = 1, ii = parts.length; i < ii; i += 2) { + var name_1 = "childBinding".concat(i); + this[name_1].unbind(); + } + }; + return InterpolationBinding; +}()); +var ChildInterpolationBinding = (function () { + function ChildInterpolationBinding(target, observerLocator, sourceExpression, mode, lookupFunctions, targetProperty, left, right) { + if (target instanceof InterpolationBinding) { + this.parent = target; + } + else { + validateTarget(target, targetProperty); + this.target = target; + this.targetProperty = targetProperty; + this.targetAccessor = observerLocator.getAccessor(target, targetProperty); + } + this.observerLocator = observerLocator; + this.sourceExpression = sourceExpression; + this.mode = mode; + this.lookupFunctions = lookupFunctions; + this.left = left; + this.right = right; + } + ChildInterpolationBinding.prototype.updateTarget = function (value) { + value = value === null || value === undefined ? '' : value.toString(); + if (value !== this.value) { + this.value = value; + if (this.parent) { + this.parent.interpolate(); + } + else { + this.targetAccessor.setValue(this.left + value + this.right, this.target, this.targetProperty); + } + } + }; + ChildInterpolationBinding.prototype.call = function () { + if (!this.isBound) { + return; + } + this.rawValue = this.sourceExpression.evaluate(this.source, this.lookupFunctions); + this.updateTarget(this.rawValue); + if (this.mode !== aureliaBinding.bindingMode.oneTime) { + this._version++; + this.sourceExpression.connect(this, this.source); + if (this.rawValue instanceof Array) { + this.observeArray(this.rawValue); + } + this.unobserve(false); + } + }; + ChildInterpolationBinding.prototype.bind = function (source) { + if (this.isBound) { + if (this.source === source) { + return; + } + this.unbind(); + } + this.isBound = true; + this.source = source; + var sourceExpression = this.sourceExpression; + if (sourceExpression.bind) { + sourceExpression.bind(this, source, this.lookupFunctions); + } + this.rawValue = sourceExpression.evaluate(source, this.lookupFunctions); + this.updateTarget(this.rawValue); + if (this.mode === aureliaBinding.bindingMode.oneWay) { + aureliaBinding.enqueueBindingConnect(this); + } + }; + ChildInterpolationBinding.prototype.unbind = function () { + if (!this.isBound) { + return; + } + this.isBound = false; + var sourceExpression = this.sourceExpression; + if (sourceExpression.unbind) { + sourceExpression.unbind(this, this.source); + } + this.source = null; + this.value = null; + this.rawValue = null; + this.unobserve(true); + }; + ChildInterpolationBinding.prototype.connect = function (evaluate) { + if (!this.isBound) { + return; + } + if (evaluate) { + this.rawValue = this.sourceExpression.evaluate(this.source, this.lookupFunctions); + this.updateTarget(this.rawValue); + } + this.sourceExpression.connect(this, this.source); + if (this.rawValue instanceof Array) { + this.observeArray(this.rawValue); + } + }; + ChildInterpolationBinding = __decorate([ + aureliaBinding.connectable() + ], ChildInterpolationBinding); + return ChildInterpolationBinding; +}()); + +var LetExpression = (function () { + function LetExpression(observerLocator, targetProperty, sourceExpression, lookupFunctions, toBindingContext) { + this.observerLocator = observerLocator; + this.sourceExpression = sourceExpression; + this.targetProperty = targetProperty; + this.lookupFunctions = lookupFunctions; + this.toBindingContext = toBindingContext; + } + LetExpression.prototype.createBinding = function () { + return new LetBinding(this.observerLocator, this.sourceExpression, this.targetProperty, this.lookupFunctions, this.toBindingContext); + }; + return LetExpression; +}()); +var LetBinding = (function () { + function LetBinding(observerLocator, sourceExpression, targetProperty, lookupFunctions, toBindingContext) { + this.observerLocator = observerLocator; + this.sourceExpression = sourceExpression; + this.targetProperty = targetProperty; + this.lookupFunctions = lookupFunctions; + this.source = null; + this.target = null; + this.toBindingContext = toBindingContext; + } + LetBinding.prototype.updateTarget = function () { + var value = this.sourceExpression.evaluate(this.source, this.lookupFunctions); + this.target[this.targetProperty] = value; + }; + LetBinding.prototype.call = function (context) { + if (!this.isBound) { + return; + } + if (context === aureliaBinding.sourceContext) { + this.updateTarget(); + return; + } + throw new Error("Unexpected call context ".concat(context)); + }; + LetBinding.prototype.bind = function (source) { + if (this.isBound) { + if (this.source === source) { + return; + } + this.unbind(); + } + this.isBound = true; + this.source = source; + this.target = this.toBindingContext ? source.bindingContext : source.overrideContext; + if (this.sourceExpression.bind) { + this.sourceExpression.bind(this, source, this.lookupFunctions); + } + aureliaBinding.enqueueBindingConnect(this); + }; + LetBinding.prototype.unbind = function () { + if (!this.isBound) { + return; + } + this.isBound = false; + if (this.sourceExpression.unbind) { + this.sourceExpression.unbind(this, this.source); + } + this.source = null; + this.target = null; + this.unobserve(true); + }; + LetBinding.prototype.unobserve = function (arg0) { + throw new Error('Method not implemented.'); + }; + LetBinding.prototype.connect = function () { + if (!this.isBound) { + return; + } + this.updateTarget(); + this.sourceExpression.connect(this, this.source); + }; + LetBinding = __decorate([ + aureliaBinding.connectable() + ], LetBinding); + return LetBinding; +}()); + +var LetInterpolationBindingExpression = (function () { + function LetInterpolationBindingExpression(observerLocator, targetProperty, parts, lookupFunctions, toBindingContext) { + this.observerLocator = observerLocator; + this.targetProperty = targetProperty; + this.parts = parts; + this.lookupFunctions = lookupFunctions; + this.toBindingContext = toBindingContext; + } + LetInterpolationBindingExpression.prototype.createBinding = function () { + return new LetInterpolationBinding(this.observerLocator, this.targetProperty, this.parts, this.lookupFunctions, this.toBindingContext); + }; + return LetInterpolationBindingExpression; +}()); +var LetInterpolationBinding = (function () { + function LetInterpolationBinding(observerLocator, targetProperty, parts, lookupFunctions, toBindingContext) { + this.observerLocator = observerLocator; + this.parts = parts; + this.targetProperty = targetProperty; + this.lookupFunctions = lookupFunctions; + this.toBindingContext = toBindingContext; + this.target = null; + } + LetInterpolationBinding.prototype.bind = function (source) { + if (this.isBound) { + if (this.source === source) { + return; + } + this.unbind(); + } + this.isBound = true; + this.source = source; + this.target = this.toBindingContext ? source.bindingContext : source.overrideContext; + this.interpolationBinding = this.createInterpolationBinding(); + this.interpolationBinding.bind(source); + }; + LetInterpolationBinding.prototype.unbind = function () { + if (!this.isBound) { + return; + } + this.isBound = false; + this.source = null; + this.target = null; + this.interpolationBinding.unbind(); + this.interpolationBinding = null; + }; + LetInterpolationBinding.prototype.createInterpolationBinding = function () { + if (this.parts.length === 3) { + return new ChildInterpolationBinding(this.target, this.observerLocator, this.parts[1], aureliaBinding.bindingMode.toView, this.lookupFunctions, this.targetProperty, this.parts[0], this.parts[2]); + } + return new InterpolationBinding(this.observerLocator, this.parts, this.target, this.targetProperty, aureliaBinding.bindingMode.toView, this.lookupFunctions); + }; + return LetInterpolationBinding; +}()); + +var SyntaxInterpreter = (function () { + function SyntaxInterpreter(parser, observerLocator, eventManager, attributeMap) { + this.parser = parser; + this.observerLocator = observerLocator; + this.eventManager = eventManager; + this.attributeMap = attributeMap; + } + SyntaxInterpreter.prototype.interpret = function (resources, element, info, existingInstruction, context) { + if (info.command in this) { + return this[info.command](resources, element, info, existingInstruction, context); + } + return this.handleUnknownCommand(resources, element, info, existingInstruction, context); + }; + SyntaxInterpreter.prototype.handleUnknownCommand = function (resources, element, info, existingInstruction, context) { + LogManager__namespace.getLogger('templating-binding').warn('Unknown binding command.', info); + return existingInstruction; + }; + SyntaxInterpreter.prototype.determineDefaultBindingMode = function (element, attrName, context) { + var tagName = element.tagName.toLowerCase(); + if (tagName === 'input' && (attrName === 'value' || attrName === 'files') && element.type !== 'checkbox' && element.type !== 'radio' + || tagName === 'input' && attrName === 'checked' && (element.type === 'checkbox' || element.type === 'radio') + || (tagName === 'textarea' || tagName === 'select') && attrName === 'value' + || (attrName === 'textcontent' || attrName === 'innerhtml') && element.contentEditable === 'true' + || attrName === 'scrolltop' + || attrName === 'scrollleft') { + return aureliaBinding.bindingMode.twoWay; + } + if (context + && attrName in context.attributes + && context.attributes[attrName] + && context.attributes[attrName].defaultBindingMode >= aureliaBinding.bindingMode.oneTime) { + return context.attributes[attrName].defaultBindingMode; + } + return aureliaBinding.bindingMode.toView; + }; + SyntaxInterpreter.prototype.bind = function (resources, element, info, existingInstruction, context) { + var instruction = existingInstruction || aureliaTemplating.BehaviorInstruction.attribute(info.attrName); + instruction.attributes[info.attrName] = new aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), info.defaultBindingMode === undefined || info.defaultBindingMode === null + ? this.determineDefaultBindingMode(element, info.attrName, context) + : info.defaultBindingMode, resources.lookupFunctions); + return instruction; + }; + SyntaxInterpreter.prototype.trigger = function (resources, element, info) { + return new aureliaBinding.ListenerExpression(this.eventManager, info.attrName, this.parser.parse(info.attrValue), aureliaBinding.delegationStrategy.none, true, resources.lookupFunctions); + }; + SyntaxInterpreter.prototype.capture = function (resources, element, info) { + return new aureliaBinding.ListenerExpression(this.eventManager, info.attrName, this.parser.parse(info.attrValue), aureliaBinding.delegationStrategy.capturing, true, resources.lookupFunctions); + }; + SyntaxInterpreter.prototype.delegate = function (resources, element, info) { + return new aureliaBinding.ListenerExpression(this.eventManager, info.attrName, this.parser.parse(info.attrValue), aureliaBinding.delegationStrategy.bubbling, true, resources.lookupFunctions); + }; + SyntaxInterpreter.prototype.call = function (resources, element, info, existingInstruction) { + var instruction = existingInstruction || aureliaTemplating.BehaviorInstruction.attribute(info.attrName); + instruction.attributes[info.attrName] = new aureliaBinding.CallExpression(this.observerLocator, info.attrName, this.parser.parse(info.attrValue), resources.lookupFunctions); + return instruction; + }; + SyntaxInterpreter.prototype.options = function (resources, element, info, existingInstruction, context) { + var instruction = existingInstruction || aureliaTemplating.BehaviorInstruction.attribute(info.attrName); + var attrValue = info.attrValue; + var language = this.language; + var name = null; + var target = ''; + var current; + var i; + var ii; + var inString = false; + var inEscape = false; + var foundName = false; + for (i = 0, ii = attrValue.length; i < ii; ++i) { + current = attrValue[i]; + if (current === ';' && !inString) { + if (!foundName) { + name = this._getPrimaryPropertyName(resources, context); + } + info = language.inspectAttribute(resources, '?', name, target.trim()); + language.createAttributeInstruction(resources, element, info, instruction, context); + if (!instruction.attributes[info.attrName]) { + instruction.attributes[info.attrName] = info.attrValue; + } + target = ''; + name = null; + } + else if (current === ':' && name === null) { + foundName = true; + name = target.trim(); + target = ''; + } + else if (current === '\\') { + target += current; + inEscape = true; + continue; + } + else { + target += current; + if (name !== null && inEscape === false && current === '\'') { + inString = !inString; + } + } + inEscape = false; + } + if (!foundName) { + name = this._getPrimaryPropertyName(resources, context); + } + if (name !== null) { + info = language.inspectAttribute(resources, '?', name, target.trim()); + language.createAttributeInstruction(resources, element, info, instruction, context); + if (!instruction.attributes[info.attrName]) { + instruction.attributes[info.attrName] = info.attrValue; + } + } + return instruction; + }; + SyntaxInterpreter.prototype._getPrimaryPropertyName = function (resources, context) { + var type = resources.getAttribute(context.attributeName); + if (type && type.primaryProperty) { + return type.primaryProperty.attribute; + } + return null; + }; + SyntaxInterpreter.prototype['for'] = function (resources, element, info, existingInstruction) { + var parts; + var keyValue; + var instruction; + var attrValue; + var isDestructuring; + attrValue = info.attrValue; + isDestructuring = attrValue.match(/^ *[[].+[\]]/); + parts = isDestructuring ? attrValue.split('of ') : attrValue.split(' of '); + if (parts.length !== 2) { + throw new Error('Incorrect syntax for "for". The form is: "$local of $items" or "[$key, $value] of $items".'); + } + instruction = existingInstruction || aureliaTemplating.BehaviorInstruction.attribute(info.attrName); + if (isDestructuring) { + keyValue = parts[0].replace(/[[\]]/g, '').replace(/,/g, ' ').replace(/\s+/g, ' ').trim().split(' '); + instruction.attributes.key = keyValue[0]; + instruction.attributes.value = keyValue[1]; + } + else { + instruction.attributes.local = parts[0]; + } + instruction.attributes.items = new aureliaBinding.BindingExpression(this.observerLocator, 'items', this.parser.parse(parts[1]), aureliaBinding.bindingMode.toView, resources.lookupFunctions); + return instruction; + }; + SyntaxInterpreter.prototype['two-way'] = function (resources, element, info, existingInstruction) { + var instruction = existingInstruction || aureliaTemplating.BehaviorInstruction.attribute(info.attrName); + instruction.attributes[info.attrName] = new aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), aureliaBinding.bindingMode.twoWay, resources.lookupFunctions); + return instruction; + }; + SyntaxInterpreter.prototype['to-view'] = function (resources, element, info, existingInstruction) { + var instruction = existingInstruction || aureliaTemplating.BehaviorInstruction.attribute(info.attrName); + instruction.attributes[info.attrName] = new aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), aureliaBinding.bindingMode.toView, resources.lookupFunctions); + return instruction; + }; + SyntaxInterpreter.prototype['from-view'] = function (resources, element, info, existingInstruction) { + var instruction = existingInstruction || aureliaTemplating.BehaviorInstruction.attribute(info.attrName); + instruction.attributes[info.attrName] = new aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), aureliaBinding.bindingMode.fromView, resources.lookupFunctions); + return instruction; + }; + SyntaxInterpreter.prototype['one-time'] = function (resources, element, info, existingInstruction) { + var instruction = existingInstruction || aureliaTemplating.BehaviorInstruction.attribute(info.attrName); + instruction.attributes[info.attrName] = new aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap.map(element.tagName, info.attrName), this.parser.parse(info.attrValue), aureliaBinding.bindingMode.oneTime, resources.lookupFunctions); + return instruction; + }; + SyntaxInterpreter.inject = [aureliaBinding.Parser, aureliaBinding.ObserverLocator, aureliaBinding.EventManager, AttributeMap]; + return SyntaxInterpreter; +}()); +Object.defineProperty(SyntaxInterpreter.prototype, 'one-way', Object.getOwnPropertyDescriptor(SyntaxInterpreter.prototype, 'to-view')); + +var info = {}; +var TemplatingBindingLanguage = (function (_super) { + __extends(TemplatingBindingLanguage, _super); + function TemplatingBindingLanguage(parser, observerLocator, syntaxInterpreter, attributeMap) { + var _this = _super.call(this) || this; + _this.parser = parser; + _this.observerLocator = observerLocator; + _this.syntaxInterpreter = syntaxInterpreter; + _this.emptyStringExpression = _this.parser.parse('\'\''); + syntaxInterpreter.language = _this; + _this.attributeMap = attributeMap; + _this.toBindingContextAttr = 'to-binding-context'; + return _this; + } + TemplatingBindingLanguage.prototype.inspectAttribute = function (resources, elementName, attrName, attrValue) { + var parts = attrName.split('.'); + info.defaultBindingMode = null; + if (parts.length === 2) { + info.attrName = parts[0].trim(); + info.attrValue = attrValue; + info.command = parts[1].trim(); + if (info.command === 'ref') { + info.expression = new aureliaBinding.NameExpression(this.parser.parse(attrValue), info.attrName, resources.lookupFunctions); + info.command = null; + info.attrName = 'ref'; + } + else { + info.expression = null; + } + } + else if (attrName === 'ref') { + info.attrName = attrName; + info.attrValue = attrValue; + info.command = null; + info.expression = new aureliaBinding.NameExpression(this.parser.parse(attrValue), 'element', resources.lookupFunctions); + } + else { + info.attrName = attrName; + info.attrValue = attrValue; + info.command = null; + var interpolationParts = this.parseInterpolation(resources, attrValue); + if (interpolationParts === null) { + info.expression = null; + } + else { + info.expression = new InterpolationBindingExpression(this.observerLocator, this.attributeMap.map(elementName, attrName), interpolationParts, aureliaBinding.bindingMode.toView, resources.lookupFunctions, attrName); + } + } + return info; + }; + TemplatingBindingLanguage.prototype.createAttributeInstruction = function (resources, element, theInfo, existingInstruction, context) { + var instruction; + if (theInfo.expression) { + if (theInfo.attrName === 'ref') { + return theInfo.expression; + } + instruction = existingInstruction || aureliaTemplating.BehaviorInstruction.attribute(theInfo.attrName); + instruction.attributes[theInfo.attrName] = theInfo.expression; + } + else if (theInfo.command) { + instruction = this.syntaxInterpreter.interpret(resources, element, theInfo, existingInstruction, context); + } + return instruction; + }; + TemplatingBindingLanguage.prototype.createLetExpressions = function (resources, letElement) { + var expressions = []; + var attributes = letElement.attributes; + var attr; + var parts; + var attrName; + var attrValue; + var command; + var toBindingContextAttr = this.toBindingContextAttr; + var toBindingContext = letElement.hasAttribute(toBindingContextAttr); + for (var i = 0, ii = attributes.length; ii > i; ++i) { + attr = attributes[i]; + attrName = attr.name; + attrValue = attr.nodeValue; + parts = attrName.split('.'); + if (attrName === toBindingContextAttr) { + continue; + } + if (parts.length === 2) { + command = parts[1]; + if (command !== 'bind') { + LogManager__namespace.getLogger('templating-binding-language') + .warn("Detected invalid let command. Expected \"".concat(parts[0], ".bind\", given \"").concat(attrName, "\"")); + continue; + } + expressions.push(new LetExpression(this.observerLocator, aureliaBinding.camelCase(parts[0]), this.parser.parse(attrValue), resources.lookupFunctions, toBindingContext)); + } + else { + attrName = aureliaBinding.camelCase(attrName); + parts = this.parseInterpolation(resources, attrValue); + if (parts === null) { + LogManager__namespace.getLogger('templating-binding-language') + .warn("Detected string literal in let bindings. Did you mean \"".concat(attrName, ".bind=").concat(attrValue, "\" or \"").concat(attrName, "=${").concat(attrValue, "}\" ?")); + } + if (parts) { + expressions.push(new LetInterpolationBindingExpression(this.observerLocator, attrName, parts, resources.lookupFunctions, toBindingContext)); + } + else { + expressions.push(new LetExpression(this.observerLocator, attrName, new aureliaBinding.LiteralString(attrValue), resources.lookupFunctions, toBindingContext)); + } + } + } + return expressions; + }; + TemplatingBindingLanguage.prototype.inspectTextContent = function (resources, value) { + var parts = this.parseInterpolation(resources, value); + if (parts === null) { + return null; + } + return new InterpolationBindingExpression(this.observerLocator, 'textContent', parts, aureliaBinding.bindingMode.toView, resources.lookupFunctions, 'textContent'); + }; + TemplatingBindingLanguage.prototype.parseInterpolation = function (resources, value) { + var i = value.indexOf('${', 0); + var ii = value.length; + var char; + var pos = 0; + var open = 0; + var quote = null; + var interpolationStart; + var parts; + var partIndex = 0; + while (i >= 0 && i < ii - 2) { + open = 1; + interpolationStart = i; + i += 2; + do { + char = value[i]; + i++; + if (char === "'" || char === '"') { + if (quote === null) { + quote = char; + } + else if (quote === char) { + quote = null; + } + continue; + } + if (char === '\\') { + i++; + continue; + } + if (quote !== null) { + continue; + } + if (char === '{') { + open++; + } + else if (char === '}') { + open--; + } + } while (open > 0 && i < ii); + if (open === 0) { + parts = parts || []; + if (value[interpolationStart - 1] === '\\' && value[interpolationStart - 2] !== '\\') { + parts[partIndex] = value.substring(pos, interpolationStart - 1) + value.substring(interpolationStart, i); + partIndex++; + parts[partIndex] = this.emptyStringExpression; + partIndex++; + } + else { + parts[partIndex] = value.substring(pos, interpolationStart); + partIndex++; + parts[partIndex] = this.parser.parse(value.substring(interpolationStart + 2, i - 1)); + partIndex++; + } + pos = i; + i = value.indexOf('${', i); + } + else { + break; + } + } + if (partIndex === 0) { + return null; + } + parts[partIndex] = value.substr(pos); + return parts; + }; + TemplatingBindingLanguage.inject = [aureliaBinding.Parser, aureliaBinding.ObserverLocator, SyntaxInterpreter, AttributeMap]; + return TemplatingBindingLanguage; +}(aureliaTemplating.BindingLanguage)); + +function configure(config) { + config.container.registerSingleton(aureliaTemplating.BindingLanguage, TemplatingBindingLanguage); + config.container.registerAlias(aureliaTemplating.BindingLanguage, TemplatingBindingLanguage); +} + +exports.AttributeMap = AttributeMap; +exports.ChildInterpolationBinding = ChildInterpolationBinding; +exports.InterpolationBinding = InterpolationBinding; +exports.InterpolationBindingExpression = InterpolationBindingExpression; +exports.LetBinding = LetBinding; +exports.LetExpression = LetExpression; +exports.LetInterpolationBinding = LetInterpolationBinding; +exports.LetInterpolationBindingExpression = LetInterpolationBindingExpression; +exports.SyntaxInterpreter = SyntaxInterpreter; +exports.TemplatingBindingLanguage = TemplatingBindingLanguage; +exports.configure = configure; + + +}); +; +define('aurelia-templating-resources/dist/commonjs/aurelia-templating-resources',['require','exports','module','aurelia-dependency-injection','aurelia-pal','aurelia-task-queue','aurelia-templating','aurelia-binding','aurelia-loader','aurelia-path','aurelia-metadata','aurelia-logging'],function (require, exports, module) {'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var aureliaDependencyInjection = require('aurelia-dependency-injection'); +var aureliaPal = require('aurelia-pal'); +var aureliaTaskQueue = require('aurelia-task-queue'); +var aureliaTemplating = require('aurelia-templating'); +var aureliaBinding = require('aurelia-binding'); +var aureliaLoader = require('aurelia-loader'); +var aureliaPath = require('aurelia-path'); +var aureliaMetadata = require('aurelia-metadata'); +var aureliaLogging = require('aurelia-logging'); + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +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; +} + var ActivationStrategy; (function (ActivationStrategy) { ActivationStrategy["InvokeLifecycle"] = "invoke-lifecycle"; @@ -17459,6 +17244,7 @@ var AbstractRepeater = (function () { return AbstractRepeater; }()); +var matcherExtractionMarker = '__marker_extracted__'; var Repeat = (function (_super) { __extends(Repeat, _super); function Repeat(viewFactory, instruction, viewSlot, viewResources, observerLocator, strategyLocator) { @@ -17486,7 +17272,11 @@ var Repeat = (function (_super) { }; Repeat.prototype.bind = function (bindingContext, overrideContext) { this.scope = { bindingContext: bindingContext, overrideContext: overrideContext }; - this.matcherBinding = this._captureAndRemoveMatcherBinding(); + var instruction = this.instruction; + if (!(matcherExtractionMarker in instruction)) { + instruction[matcherExtractionMarker] = this._captureAndRemoveMatcherBinding(); + } + this.matcherBinding = instruction[matcherExtractionMarker]; this.itemsChanged(); }; Repeat.prototype.unbind = function () { @@ -17512,7 +17302,7 @@ var Repeat = (function (_super) { var items = this.items; this.strategy = this.strategyLocator.getStrategy(items); if (!this.strategy) { - throw new Error("Value for '" + this.sourceExpression + "' is non-repeatable"); + throw new Error("Value for '".concat(this.sourceExpression, "' is non-repeatable")); } if (!this.isOneTime && !this._observeInnerCollection()) { this._observeCollection(); @@ -17587,10 +17377,10 @@ var Repeat = (function (_super) { if (Repeat_1.useInnerMatcher) { return extractMatcherBindingExpression(instructions); } - if (template.children.length > 1) { + if (getChildrenCount(template) > 1) { return undefined; } - var repeatedElement = template.firstElementChild; + var repeatedElement = getFirstElementChild(template); if (!repeatedElement.hasAttribute('au-target-id')) { return undefined; } @@ -17685,9 +17475,29 @@ var extractMatcherBindingExpression = function (instructions, targetedElementId) } } }; +var getChildrenCount = function (el) { + var childNodes = el.childNodes; + var count = 0; + for (var i = 0, ii = childNodes.length; ii > i; ++i) { + if (childNodes[i].nodeType === 1) { + ++count; + } + } + return count; +}; +var getFirstElementChild = function (el) { + var firstChild = el.firstChild; + while (firstChild !== null) { + if (firstChild.nodeType === 1) { + return firstChild; + } + firstChild = firstChild.nextSibling; + } + return null; +}; var aureliaHideClassName = 'aurelia-hide'; -var aureliaHideClass = "." + aureliaHideClassName + " { display:none !important; }"; +var aureliaHideClass = ".".concat(aureliaHideClassName, " { display:none !important; }"); function injectAureliaHideStyleAtHead() { aureliaPal.DOM.injectStyles(aureliaHideClass); } @@ -17761,18 +17571,11 @@ var Hide = (function () { return Hide; }()); -var SCRIPT_REGEX = /)<[^<]*)*<\/script>/gi; -var needsToWarn = true; var HTMLSanitizer = (function () { function HTMLSanitizer() { } HTMLSanitizer.prototype.sanitize = function (input) { - if (needsToWarn) { - needsToWarn = false; - aureliaLogging.getLogger('html-sanitizer') - .warn("CAUTION: The default HTMLSanitizer does NOT provide security against a wide variety of sophisticated XSS attacks,\nand should not be relied on for sanitizing input from unknown sources.\nPlease see https://aurelia.io/docs/binding/basics#element-content for instructions on how to use a secure solution like DOMPurify or sanitize-html."); - } - return input.replace(SCRIPT_REGEX, ''); + throw new Error("To protect the application against a wide variety of sophisticated XSS attacks.\nPlease see https://aurelia.io/docs/binding/basics#element-content for instructions on how to use a secure solution like DOMPurify or sanitize-html."); }; return HTMLSanitizer; }()); @@ -17828,7 +17631,7 @@ var Focus = (function () { Focus.inject = function () { return [aureliaPal.DOM.Element, aureliaTaskQueue.TaskQueue]; }; - Focus.prototype.valueChanged = function (newValue) { + Focus.prototype.valueChanged = function () { if (this.isAttached) { this._apply(); } @@ -17880,7 +17683,7 @@ var Focus = (function () { var cssUrlMatcher = /url\((?!['"]data)([^)]+)\)/gi; function fixupCSSUrls(address, css) { if (typeof css !== 'string') { - throw new Error("Failed loading required CSS file: " + address); + throw new Error("Failed loading required CSS file: ".concat(address)); } return css.replace(cssUrlMatcher, function (match, p1) { var quote = p1.charAt(0); @@ -17912,7 +17715,7 @@ var CSSResource = (function () { var _this = this; return container.get(aureliaLoader.Loader) .loadText(this.address) - .catch(function (err) { return null; }) + .catch(function () { return null; }) .then(function (text) { text = fixupCSSUrls(_this.address, text); _this._scoped.css = text; @@ -17920,6 +17723,7 @@ var CSSResource = (function () { _this._alreadyGloballyInjected = true; aureliaPal.DOM.injectStyles(text); } + return _this; }); }; return CSSResource; @@ -18317,7 +18121,7 @@ function _createDynamicElement(_a) { break; default: aureliaLogging.getLogger('aurelia-html-only-element') - .warn("Expected 'use-shadow-dom' value to be \"close\", \"open\" or \"\", received " + useShadowDOMmode); + .warn("Expected 'use-shadow-dom' value to be \"close\", \"open\" or \"\", received ".concat(useShadowDOMmode)); break; } return DynamicElement; @@ -18326,7 +18130,7 @@ function _createDynamicElement(_a) { function getElementName(address) { return /([^\/^\?]+)\.html/i.exec(address)[1].toLowerCase(); } -function configure(config) { +function configure$1(config) { var viewEngine = config.container.get(aureliaTemplating.ViewEngine); var loader = config.aurelia.loader; viewEngine.addResourcePlugin('.html', { @@ -18349,10 +18153,10 @@ function configure(config) { }); } -function configure$1(config) { +function configure(config) { injectAureliaHideStyleAtHead(); config.globalResources(Compose, If, Else, With, Repeat, Show, Hide, Replaceable, Focus, SanitizeHTMLValueConverter, OneTimeBindingBehavior, OneWayBindingBehavior, ToViewBindingBehavior, FromViewBindingBehavior, TwoWayBindingBehavior, ThrottleBindingBehavior, DebounceBindingBehavior, SelfBindingBehavior, SignalBindingBehavior, UpdateTriggerBindingBehavior, AttrBindingBehavior); - configure(config); + configure$1(config); var viewEngine = config.container.get(aureliaTemplating.ViewEngine); var styleResourcePlugin = { fetch: function (address) { @@ -18393,7 +18197,7 @@ exports.ToViewBindingBehavior = ToViewBindingBehavior; exports.TwoWayBindingBehavior = TwoWayBindingBehavior; exports.UpdateTriggerBindingBehavior = UpdateTriggerBindingBehavior; exports.With = With; -exports.configure = configure$1; +exports.configure = configure; exports.createFullOverrideContext = createFullOverrideContext; exports.getItemsSourceExpression = getItemsSourceExpression; exports.isOneTime = isOneTime; @@ -18418,44 +18222,63 @@ var aureliaBinding = require('aurelia-binding'); var aureliaPal = require('aurelia-pal'); var LogManager = require('aurelia-logging'); -/*! ***************************************************************************** -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 +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n["default"] = e; + return Object.freeze(n); +} -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. +var LogManager__namespace = /*#__PURE__*/_interopNamespace(LogManager); -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* 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]; }; + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } -var EmptyLayoutViewModel = /** @class */ (function () { +var EmptyLayoutViewModel = (function () { function EmptyLayoutViewModel() { } return EmptyLayoutViewModel; }()); -/** - * Implementation of Aurelia Router ViewPort. Responsible for loading route, composing and swapping routes views - */ -var RouterView = /** @class */ (function () { +var RouterView = (function () { function RouterView(element, container, viewSlot, router, viewLocator, compositionTransaction, compositionEngine) { this.element = element; this.container = container; @@ -18464,21 +18287,12 @@ var RouterView = /** @class */ (function () { this.viewLocator = viewLocator; this.compositionTransaction = compositionTransaction; this.compositionEngine = compositionEngine; - // add this to router view ports lookup based on name attribute - // when this router is the root router-view - // also trigger AppRouter registerViewPort extra flow this.router.registerViewPort(this, this.element.getAttribute('name')); - // Each process its instruction as a composition transaction - // there are differences between intial composition and subsequent compositions - // also there are differences between root composition and child composition - // mark the first composition transaction with a property initialComposition to distinguish it - // when the root gets new instruction for the first time if (!('initialComposition' in compositionTransaction)) { compositionTransaction.initialComposition = true; this.compositionTransactionNotifier = compositionTransaction.enlist(); } } - /**@internal */ RouterView.inject = function () { return [aureliaPal.DOM.Element, aureliaDependencyInjection.Container, aureliaTemplating.ViewSlot, aureliaRouter.Router, aureliaTemplating.ViewLocator, aureliaTemplating.CompositionTransaction, aureliaTemplating.CompositionEngine]; }; @@ -18486,17 +18300,11 @@ var RouterView = /** @class */ (function () { this.owningView = owningView; }; RouterView.prototype.bind = function (bindingContext, overrideContext) { - // router needs to get access to view model of current route parent - // doing it in generic way via viewModel property on container this.container.viewModel = bindingContext; this.overrideContext = overrideContext; }; - /** - * Implementation of `aurelia-router` ViewPort interface, responsible for templating related part in routing Pipeline - */ RouterView.prototype.process = function ($viewPortInstruction, waitToSwap) { var _this = this; - // have strong typings without exposing it in public typings, this is to ensure maximum backward compat var viewPortInstruction = $viewPortInstruction; var component = viewPortInstruction.component; var childContainer = component.childContainer; @@ -18506,7 +18314,6 @@ var RouterView = /** @class */ (function () { var config = component.router.currentInstruction.config; var viewPortConfig = config.viewPorts ? (config.viewPorts[viewPortInstruction.name] || {}) : {}; childContainer.get(RouterViewLocator)._notify(this); - // layoutInstruction is our layout viewModel var layoutInstruction = { viewModel: viewPortConfig.layoutViewModel || config.layoutViewModel || this.layoutViewModel, view: viewPortConfig.layoutView || config.layoutView || this.layoutView, @@ -18515,24 +18322,13 @@ var RouterView = /** @class */ (function () { childContainer: childContainer, viewSlot: this.viewSlot }; - // viewport will be a thin wrapper around composition engine - // to process instruction/configuration from users - // preparing all information related to a composition process - // first by getting view strategy of a ViewPortComponent View var viewStrategy = this.viewLocator.getViewStrategy(component.view || viewModel); if (viewStrategy && component.view) { viewStrategy.makeRelativeTo(aureliaMetadata.Origin.get(component.router.container.viewModel.constructor).moduleId); } - // using metadata of a custom element view model to load appropriate view-factory instance return metadata .load(childContainer, viewModelResource.value, null, viewStrategy, true) - // for custom element, viewFactory typing is always ViewFactory - // for custom attribute, it will be HtmlBehaviorResource .then(function (viewFactory) { - // if this is not the first time that this is composing its instruction - // try to capture ownership of the composition transaction - // child will not be able to capture, since root typically captures - // the ownership token if (!_this.compositionTransactionNotifier) { _this.compositionTransactionOwnershipToken = _this.compositionTransaction.tryCapture(); } @@ -18549,12 +18345,10 @@ var RouterView = /** @class */ (function () { }; RouterView.prototype.swap = function ($viewPortInstruction) { var _this = this; - // have strong typings without exposing it in public typings, this is to ensure maximum backward compat var viewPortInstruction = $viewPortInstruction; var viewPortController = viewPortInstruction.controller; var layoutInstruction = viewPortInstruction.layoutInstruction; var previousView = this.view; - // Final step of swapping a ViewPortComponent var work = function () { var swapStrategy = aureliaTemplating.SwapStrategies[_this.swapOrder] || aureliaTemplating.SwapStrategies.after; var viewSlot = _this.viewSlot; @@ -18562,14 +18356,9 @@ var RouterView = /** @class */ (function () { _this._notify(); }); }; - // Ensure all users setups have been completed var ready = function (owningView_or_layoutView) { viewPortController.automate(_this.overrideContext, owningView_or_layoutView); var transactionOwnerShipToken = _this.compositionTransactionOwnershipToken; - // if this router-view is the root of a normal startup via aurelia.setRoot - // attemp to take control of the transaction - // if ownership can be taken - // wait for transaction to complete before swapping if (transactionOwnerShipToken) { return transactionOwnerShipToken .waitForCompositionComplete() @@ -18578,28 +18367,17 @@ var RouterView = /** @class */ (function () { return work(); }); } - // otherwise, just swap return work(); }; - // If there is layout instruction, new to compose layout before processing ViewPortComponent - // layout controller/view/view-model is composed using composition engine APIs if (layoutInstruction) { if (!layoutInstruction.viewModel) { - // createController chokes if there's no viewmodel, so create a dummy one - // but avoid using a POJO as it creates unwanted metadata in Object constructor layoutInstruction.viewModel = new EmptyLayoutViewModel(); } - // using composition engine to create compose layout return this.compositionEngine - // first create controller from layoutInstruction - // and treat it as CompositionContext - // then emulate slot projection with ViewPortComponent view .createController(layoutInstruction) .then(function (layoutController) { var layoutView = layoutController.view; aureliaTemplating.ShadowDOM.distributeView(viewPortController.view, layoutController.slots || layoutView.slots); - // when there is a layout - // view hierarchy is: owner view -> layout view -> ViewPortComponent view layoutController.automate(aureliaBinding.createOverrideContext(layoutInstruction.viewModel), _this.owningView); layoutView.children.push(viewPortController.view); return layoutView || layoutController; @@ -18609,18 +18387,9 @@ var RouterView = /** @class */ (function () { return ready(newView); }); } - // if there is no layout, then get ViewPortComponent view ready as view property - // and process controller/swapping - // when there is no layout - // view hierarchy is: owner view -> ViewPortComponent view this.view = viewPortController.view; return ready(this.owningView); }; - /** - * Notify composition transaction that this router has finished processing - * Happens when this is the root router-view - * @internal - */ RouterView.prototype._notify = function () { var notifier = this.compositionTransactionNotifier; if (notifier) { @@ -18628,69 +18397,40 @@ var RouterView = /** @class */ (function () { this.compositionTransactionNotifier = null; } }; - /** - * @internal Actively avoid using decorator to reduce the amount of code generated - * - * There is no view to compose by default in a router view - * This custom element is responsible for composing its own view, based on current config - */ RouterView.$view = null; - /** - * @internal Actively avoid using decorator to reduce the amount of code generated - */ RouterView.$resource = { name: 'router-view', bindables: ['swapOrder', 'layoutView', 'layoutViewModel', 'layoutModel', 'inherit-binding-context'] }; return RouterView; }()); -/** -* Locator which finds the nearest RouterView, relative to the current dependency injection container. -*/ -var RouterViewLocator = /** @class */ (function () { - /** - * Creates an instance of the RouterViewLocator class. - */ +var RouterViewLocator = (function () { function RouterViewLocator() { var _this = this; this.promise = new Promise(function (resolve) { return _this.resolve = resolve; }); } - /** - * Finds the nearest RouterView instance. - * @returns A promise that will be resolved with the located RouterView instance. - */ RouterViewLocator.prototype.findNearest = function () { return this.promise; }; - /**@internal */ RouterViewLocator.prototype._notify = function (routerView) { this.resolve(routerView); }; return RouterViewLocator; }()); -/**@internal exported for unit testing */ -var EmptyClass = /** @class */ (function () { +var EmptyClass = (function () { function EmptyClass() { } return EmptyClass; }()); aureliaTemplating.inlineView('')(EmptyClass); -/** - * Default implementation of `RouteLoader` used for loading component based on a route config - */ -var TemplatingRouteLoader = /** @class */ (function (_super) { +var TemplatingRouteLoader = (function (_super) { __extends(TemplatingRouteLoader, _super); function TemplatingRouteLoader(compositionEngine) { var _this = _super.call(this) || this; _this.compositionEngine = compositionEngine; return _this; } - /** - * Resolve a view model from a RouteConfig - * Throws when there is neither "moduleId" nor "viewModel" property - * @internal - */ TemplatingRouteLoader.prototype.resolveViewModel = function (router, config) { return new Promise(function (resolve, reject) { var viewModel; @@ -18700,9 +18440,6 @@ var TemplatingRouteLoader = /** @class */ (function (_super) { viewModel = EmptyClass; } else { - // this requires container of router has passes a certain point - // where a view model has been setup on the container - // it will fail in enhance scenario because no viewport has been registered moduleId = aureliaPath.relativeToFile(moduleId, aureliaMetadata.Origin.get(router.container.viewModel.constructor).moduleId); if (/\.html/i.test(moduleId)) { viewModel = createDynamicClass(moduleId); @@ -18713,15 +18450,9 @@ var TemplatingRouteLoader = /** @class */ (function (_super) { } return resolve(viewModel); } - // todo: add if ('viewModel' in config) to support static view model resolution reject(new Error('Invalid route config. No "moduleId" found.')); }); }; - /** - * Create child container based on a router container - * Also ensures that child router are properly constructed in the newly created child container - * @internal - */ TemplatingRouteLoader.prototype.createChildContainer = function (router) { var childContainer = router.container.createChild(); childContainer.registerSingleton(RouterViewLocator); @@ -18732,10 +18463,7 @@ var TemplatingRouteLoader = /** @class */ (function (_super) { }; return childContainer; }; - /** - * Load corresponding component of a route config of a navigation instruction - */ - TemplatingRouteLoader.prototype.loadRoute = function (router, config, _navInstruction) { + TemplatingRouteLoader.prototype.loadRoute = function (router, config, navInstruction) { var _this = this; return this .resolveViewModel(router, config) @@ -18746,14 +18474,12 @@ var TemplatingRouteLoader = /** @class */ (function (_super) { router: router }); }); }; - /**@internal */ TemplatingRouteLoader.inject = [aureliaTemplating.CompositionEngine]; return TemplatingRouteLoader; }(aureliaRouter.RouteLoader)); -/**@internal exported for unit testing */ function createDynamicClass(moduleId) { var name = /([^\/^\?]+)\.html/i.exec(moduleId)[1]; - var DynamicClass = /** @class */ (function () { + var DynamicClass = (function () { function DynamicClass() { } DynamicClass.prototype.bind = function (bindingContext) { @@ -18766,17 +18492,13 @@ function createDynamicClass(moduleId) { return DynamicClass; } -var logger = LogManager.getLogger('route-href'); -/** - * Helper custom attribute to help associate an element with a route by name - */ -var RouteHref = /** @class */ (function () { +var logger = LogManager__namespace.getLogger('route-href'); +var RouteHref = (function () { function RouteHref(router, element) { this.router = router; this.element = element; this.attribute = 'href'; } - /*@internal */ RouteHref.inject = function () { return [aureliaRouter.Router, aureliaPal.DOM.Element]; }; @@ -18799,7 +18521,6 @@ var RouteHref = /** @class */ (function () { .ensureConfigured() .then(function () { if (!_this.isActive) { - // returning null to avoid Bluebird warning return null; } var element = _this.element; @@ -18810,16 +18531,12 @@ var RouteHref = /** @class */ (function () { else { element.setAttribute(_this.attribute, href); } - // returning null to avoid Bluebird warning return null; }) .catch(function (reason) { logger.error(reason); }); }; - /** - * @internal Actively avoid using decorator to reduce the amount of code generated - */ RouteHref.$resource = { type: 'attribute', name: 'route-href', @@ -18827,7 +18544,7 @@ var RouteHref = /** @class */ (function () { { name: 'route', changeHandler: 'processChange', primaryProperty: true }, { name: 'params', changeHandler: 'processChange' }, 'attribute' - ] // type definition of Aurelia templating is wrong + ] }; return RouteHref; }()); @@ -18842,456 +18559,207 @@ function configure(config) { exports.RouteHref = RouteHref; exports.RouterView = RouterView; +exports.RouterViewLocator = RouterViewLocator; exports.TemplatingRouteLoader = TemplatingRouteLoader; exports.configure = configure; }); ; -define('aurelia-templating/dist/commonjs/aurelia-templating',['require','exports','module','aurelia-logging','aurelia-metadata','aurelia-pal','aurelia-loader','aurelia-path','aurelia-binding','aurelia-dependency-injection','aurelia-task-queue'],function (require, exports, module) {'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.TemplatingEngine = exports.ElementConfigResource = exports.CompositionEngine = exports.SwapStrategies = exports.HtmlBehaviorResource = exports.BindableProperty = exports.BehaviorPropertyObserver = exports.Controller = exports.ViewEngine = exports.ModuleAnalyzer = exports.ResourceDescription = exports.ResourceModule = exports.ViewCompiler = exports.ViewFactory = exports.BoundViewFactory = exports.ViewSlot = exports.View = exports.ViewResources = exports.ShadowDOM = exports.ShadowSlot = exports.PassThroughSlot = exports.SlotCustomAttribute = exports.BindingLanguage = exports.ViewLocator = exports.StaticViewStrategy = exports.InlineViewStrategy = exports.TemplateRegistryViewStrategy = exports.NoViewStrategy = exports.ConventionalViewStrategy = exports.RelativeViewStrategy = exports.viewStrategy = exports.TargetInstruction = exports.BehaviorInstruction = exports.ViewCompileInstruction = exports.ResourceLoadContext = exports.ElementEvents = exports.ViewEngineHooksResource = exports.CompositionTransaction = exports.CompositionTransactionOwnershipToken = exports.CompositionTransactionNotifier = exports.Animator = exports.animationEvent = undefined; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var _class, _temp, _class2, _temp2, _dec, _class3, _dec2, _class4, _dec3, _class5, _dec4, _class6, _dec5, _class7, _dec6, _class8, _class9, _temp3, _class10, _temp4, _class12, _dec7, _class14, _dec8, _class15, _class16, _temp5, _dec9, _class17, _dec10, _class18, _dec11, _class19; - -exports._hyphenate = _hyphenate; -exports._isAllWhitespace = _isAllWhitespace; -exports.viewEngineHooks = viewEngineHooks; -exports.validateBehaviorName = validateBehaviorName; -exports.children = children; -exports.child = child; -exports.resource = resource; -exports.behavior = behavior; -exports.customElement = customElement; -exports.customAttribute = customAttribute; -exports.templateController = templateController; -exports.bindable = bindable; -exports.dynamicOptions = dynamicOptions; -exports.useShadowDOM = useShadowDOM; -exports.processAttributes = processAttributes; -exports.processContent = processContent; -exports.containerless = containerless; -exports.useViewStrategy = useViewStrategy; -exports.useView = useView; -exports.inlineView = inlineView; -exports.noView = noView; -exports.view = view; -exports.elementConfig = elementConfig; -exports.viewResources = viewResources; - -var _aureliaLogging = require('aurelia-logging'); - -var LogManager = _interopRequireWildcard(_aureliaLogging); - -var _aureliaMetadata = require('aurelia-metadata'); - -var _aureliaPal = require('aurelia-pal'); - -var _aureliaLoader = require('aurelia-loader'); - -var _aureliaPath = require('aurelia-path'); - -var _aureliaBinding = require('aurelia-binding'); - -var _aureliaDependencyInjection = require('aurelia-dependency-injection'); - -var _aureliaTaskQueue = require('aurelia-task-queue'); - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - - -var animationEvent = exports.animationEvent = { - enterBegin: 'animation:enter:begin', - enterActive: 'animation:enter:active', - enterDone: 'animation:enter:done', - enterTimeout: 'animation:enter:timeout', - - leaveBegin: 'animation:leave:begin', - leaveActive: 'animation:leave:active', - leaveDone: 'animation:leave:done', - leaveTimeout: 'animation:leave:timeout', - - staggerNext: 'animation:stagger:next', +define('aurelia-templating/dist/commonjs/aurelia-templating',['require','exports','module','aurelia-pal','aurelia-loader','aurelia-metadata','aurelia-path','aurelia-logging','aurelia-binding','aurelia-dependency-injection','aurelia-task-queue'],function (require, exports, module) {'use strict'; - removeClassBegin: 'animation:remove-class:begin', - removeClassActive: 'animation:remove-class:active', - removeClassDone: 'animation:remove-class:done', - removeClassTimeout: 'animation:remove-class:timeout', - - addClassBegin: 'animation:add-class:begin', - addClassActive: 'animation:add-class:active', - addClassDone: 'animation:add-class:done', - addClassTimeout: 'animation:add-class:timeout', - - animateBegin: 'animation:animate:begin', - animateActive: 'animation:animate:active', - animateDone: 'animation:animate:done', - animateTimeout: 'animation:animate:timeout', - - sequenceBegin: 'animation:sequence:begin', - sequenceDone: 'animation:sequence:done' -}; - -var Animator = exports.Animator = function () { - function Animator() { - - } - - Animator.prototype.enter = function enter(element) { - return Promise.resolve(false); - }; - - Animator.prototype.leave = function leave(element) { - return Promise.resolve(false); - }; - - Animator.prototype.removeClass = function removeClass(element, className) { - element.classList.remove(className); - return Promise.resolve(false); - }; - - Animator.prototype.addClass = function addClass(element, className) { - element.classList.add(className); - return Promise.resolve(false); - }; - - Animator.prototype.animate = function animate(element, className) { - return Promise.resolve(false); - }; - - Animator.prototype.runSequence = function runSequence(animations) {}; - - Animator.prototype.registerEffect = function registerEffect(effectName, properties) {}; - - Animator.prototype.unregisterEffect = function unregisterEffect(effectName) {}; - - return Animator; -}(); - -var CompositionTransactionNotifier = exports.CompositionTransactionNotifier = function () { - function CompositionTransactionNotifier(owner) { - - - this.owner = owner; - this.owner._compositionCount++; - } - - CompositionTransactionNotifier.prototype.done = function done() { - this.owner._compositionCount--; - this.owner._tryCompleteTransaction(); - }; - - return CompositionTransactionNotifier; -}(); - -var CompositionTransactionOwnershipToken = exports.CompositionTransactionOwnershipToken = function () { - function CompositionTransactionOwnershipToken(owner) { - - - this.owner = owner; - this.owner._ownershipToken = this; - this.thenable = this._createThenable(); - } - - CompositionTransactionOwnershipToken.prototype.waitForCompositionComplete = function waitForCompositionComplete() { - this.owner._tryCompleteTransaction(); - return this.thenable; - }; - - CompositionTransactionOwnershipToken.prototype.resolve = function resolve() { - this._resolveCallback(); - }; - - CompositionTransactionOwnershipToken.prototype._createThenable = function _createThenable() { - var _this = this; - - return new Promise(function (resolve, reject) { - _this._resolveCallback = resolve; - }); - }; - - return CompositionTransactionOwnershipToken; -}(); - -var CompositionTransaction = exports.CompositionTransaction = function () { - function CompositionTransaction() { - - - this._ownershipToken = null; - this._compositionCount = 0; - } - - CompositionTransaction.prototype.tryCapture = function tryCapture() { - return this._ownershipToken === null ? new CompositionTransactionOwnershipToken(this) : null; - }; - - CompositionTransaction.prototype.enlist = function enlist() { - return new CompositionTransactionNotifier(this); - }; - - CompositionTransaction.prototype._tryCompleteTransaction = function _tryCompleteTransaction() { - if (this._compositionCount <= 0) { - this._compositionCount = 0; - - if (this._ownershipToken !== null) { - var token = this._ownershipToken; - this._ownershipToken = null; - token.resolve(); - } - } - }; - - return CompositionTransaction; -}(); - -var capitalMatcher = /([A-Z])/g; - -function addHyphenAndLower(char) { - return '-' + char.toLowerCase(); -} - -function _hyphenate(name) { - return (name.charAt(0).toLowerCase() + name.slice(1)).replace(capitalMatcher, addHyphenAndLower); -} - -function _isAllWhitespace(node) { - return !(node.auInterpolationTarget || /[^\t\n\r ]/.test(node.textContent)); -} - -var ViewEngineHooksResource = exports.ViewEngineHooksResource = function () { - function ViewEngineHooksResource() { - - } - - ViewEngineHooksResource.prototype.initialize = function initialize(container, target) { - this.instance = container.get(target); - }; - - ViewEngineHooksResource.prototype.register = function register(registry, name) { - registry.registerViewEngineHooks(this.instance); - }; +Object.defineProperty(exports, '__esModule', { value: true }); - ViewEngineHooksResource.prototype.load = function load(container, target) {}; +var aureliaPal = require('aurelia-pal'); +var aureliaLoader = require('aurelia-loader'); +var aureliaMetadata = require('aurelia-metadata'); +var aureliaPath = require('aurelia-path'); +var LogManager = require('aurelia-logging'); +var aureliaBinding = require('aurelia-binding'); +var aureliaDependencyInjection = require('aurelia-dependency-injection'); +var aureliaTaskQueue = require('aurelia-task-queue'); - ViewEngineHooksResource.convention = function convention(name) { - if (name.endsWith('ViewEngineHooks')) { - return new ViewEngineHooksResource(); +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); } - }; - - return ViewEngineHooksResource; -}(); - -function viewEngineHooks(target) { - var deco = function deco(t) { - _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new ViewEngineHooksResource(), t); - }; - - return target ? deco(target) : deco; + n["default"] = e; + return Object.freeze(n); } -var ElementEvents = exports.ElementEvents = (_temp = _class = function () { - function ElementEvents(element) { - - - this.element = element; - this.subscriptions = {}; - } - - ElementEvents.prototype._enqueueHandler = function _enqueueHandler(handler) { - this.subscriptions[handler.eventName] = this.subscriptions[handler.eventName] || []; - this.subscriptions[handler.eventName].push(handler); - }; - - ElementEvents.prototype._dequeueHandler = function _dequeueHandler(handler) { - var index = void 0; - var subscriptions = this.subscriptions[handler.eventName]; - if (subscriptions) { - index = subscriptions.indexOf(handler); - if (index > -1) { - subscriptions.splice(index, 1); - } - } - return handler; - }; - - ElementEvents.prototype.publish = function publish(eventName) { - var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - var cancelable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; +var LogManager__namespace = /*#__PURE__*/_interopNamespace(LogManager); - var event = _aureliaPal.DOM.createCustomEvent(eventName, { cancelable: cancelable, bubbles: bubbles, detail: detail }); - this.element.dispatchEvent(event); - }; - - ElementEvents.prototype.subscribe = function subscribe(eventName, handler, captureOrOptions) { - if (typeof handler === 'function') { - if (captureOrOptions === undefined) { - captureOrOptions = ElementEvents.defaultListenerOptions; - } - var eventHandler = new EventHandlerImpl(this, eventName, handler, captureOrOptions, false); - return eventHandler; - } - - return undefined; - }; - - ElementEvents.prototype.subscribeOnce = function subscribeOnce(eventName, handler, captureOrOptions) { - if (typeof handler === 'function') { - if (captureOrOptions === undefined) { - captureOrOptions = ElementEvents.defaultListenerOptions; - } - var eventHandler = new EventHandlerImpl(this, eventName, handler, captureOrOptions, true); - return eventHandler; +var ElementEvents = (function () { + function ElementEvents(element) { + this.element = element; + this.subscriptions = {}; } - - return undefined; - }; - - ElementEvents.prototype.dispose = function dispose(eventName) { - if (eventName && typeof eventName === 'string') { - var subscriptions = this.subscriptions[eventName]; - if (subscriptions) { - while (subscriptions.length) { - var subscription = subscriptions.pop(); - if (subscription) { - subscription.dispose(); - } + ElementEvents.prototype._enqueueHandler = function (handler) { + this.subscriptions[handler.eventName] = this.subscriptions[handler.eventName] || []; + this.subscriptions[handler.eventName].push(handler); + }; + ElementEvents.prototype._dequeueHandler = function (handler) { + var index; + var subscriptions = this.subscriptions[handler.eventName]; + if (subscriptions) { + index = subscriptions.indexOf(handler); + if (index > -1) { + subscriptions.splice(index, 1); + } } - } - } else { - this.disposeAll(); - } - }; + return handler; + }; + ElementEvents.prototype.publish = function (eventName, detail, bubbles, cancelable) { + if (detail === void 0) { detail = {}; } + if (bubbles === void 0) { bubbles = true; } + if (cancelable === void 0) { cancelable = true; } + var event = aureliaPal.DOM.createCustomEvent(eventName, { cancelable: cancelable, bubbles: bubbles, detail: detail }); + this.element.dispatchEvent(event); + }; + ElementEvents.prototype.subscribe = function (eventName, handler, captureOrOptions) { + if (typeof handler === 'function') { + if (captureOrOptions === undefined) { + captureOrOptions = ElementEvents.defaultListenerOptions; + } + var eventHandler = new EventHandlerImpl(this, eventName, handler, captureOrOptions, false); + return eventHandler; + } + return undefined; + }; + ElementEvents.prototype.subscribeOnce = function (eventName, handler, captureOrOptions) { + if (typeof handler === 'function') { + if (captureOrOptions === undefined) { + captureOrOptions = ElementEvents.defaultListenerOptions; + } + var eventHandler = new EventHandlerImpl(this, eventName, handler, captureOrOptions, true); + return eventHandler; + } + return undefined; + }; + ElementEvents.prototype.dispose = function (eventName) { + if (eventName && typeof eventName === 'string') { + var subscriptions = this.subscriptions[eventName]; + if (subscriptions) { + while (subscriptions.length) { + var subscription = subscriptions.pop(); + if (subscription) { + subscription.dispose(); + } + } + } + } + else { + this.disposeAll(); + } + }; + ElementEvents.prototype.disposeAll = function () { + for (var key in this.subscriptions) { + this.dispose(key); + } + }; + ElementEvents.defaultListenerOptions = true; + return ElementEvents; +}()); +var EventHandlerImpl = (function () { + function EventHandlerImpl(owner, eventName, handler, captureOrOptions, once) { + this.owner = owner; + this.eventName = eventName; + this.handler = handler; + this.capture = typeof captureOrOptions === 'boolean' ? captureOrOptions : captureOrOptions.capture; + this.bubbles = !this.capture; + this.captureOrOptions = captureOrOptions; + this.once = once; + owner.element.addEventListener(eventName, this, captureOrOptions); + owner._enqueueHandler(this); + } + EventHandlerImpl.prototype.handleEvent = function (e) { + var fn = this.handler; + fn(e); + if (this.once) { + this.dispose(); + } + }; + EventHandlerImpl.prototype.dispose = function () { + this.owner.element.removeEventListener(this.eventName, this, this.captureOrOptions); + this.owner._dequeueHandler(this); + this.owner = this.handler = null; + }; + return EventHandlerImpl; +}()); - ElementEvents.prototype.disposeAll = function disposeAll() { - for (var _key in this.subscriptions) { - this.dispose(_key); +var ResourceLoadContext = (function () { + function ResourceLoadContext() { + this.dependencies = {}; } - }; - - return ElementEvents; -}(), _class.defaultListenerOptions = true, _temp); - -var EventHandlerImpl = function () { - function EventHandlerImpl(owner, eventName, handler, captureOrOptions, once) { - - - this.owner = owner; - this.eventName = eventName; - this.handler = handler; - - this.capture = typeof captureOrOptions === 'boolean' ? captureOrOptions : captureOrOptions.capture; - this.bubbles = !this.capture; - this.captureOrOptions = captureOrOptions; - this.once = once; - owner.element.addEventListener(eventName, this, captureOrOptions); - owner._enqueueHandler(this); - } - - EventHandlerImpl.prototype.handleEvent = function handleEvent(e) { - var fn = this.handler; - fn(e); - if (this.once) { - this.dispose(); + ResourceLoadContext.prototype.addDependency = function (url) { + this.dependencies[url] = true; + }; + ResourceLoadContext.prototype.hasDependency = function (url) { + return url in this.dependencies; + }; + return ResourceLoadContext; +}()); +var ViewCompileInstruction = (function () { + function ViewCompileInstruction(targetShadowDOM, compileSurrogate) { + if (targetShadowDOM === void 0) { targetShadowDOM = false; } + if (compileSurrogate === void 0) { compileSurrogate = false; } + this.targetShadowDOM = targetShadowDOM; + this.compileSurrogate = compileSurrogate; + this.associatedModuleId = null; + } + ViewCompileInstruction.normal = new ViewCompileInstruction(); + return ViewCompileInstruction; +}()); +var BehaviorInstruction = (function () { + function BehaviorInstruction() { } - }; - - EventHandlerImpl.prototype.dispose = function dispose() { - this.owner.element.removeEventListener(this.eventName, this, this.captureOrOptions); - this.owner._dequeueHandler(this); - this.owner = this.handler = null; - }; - - return EventHandlerImpl; -}(); - -var ResourceLoadContext = exports.ResourceLoadContext = function () { - function ResourceLoadContext() { - - - this.dependencies = {}; - } - - ResourceLoadContext.prototype.addDependency = function addDependency(url) { - this.dependencies[url] = true; - }; - - ResourceLoadContext.prototype.hasDependency = function hasDependency(url) { - return url in this.dependencies; - }; - - return ResourceLoadContext; -}(); - -var ViewCompileInstruction = exports.ViewCompileInstruction = function ViewCompileInstruction() { - var targetShadowDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - var compileSurrogate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - - - this.targetShadowDOM = targetShadowDOM; - this.compileSurrogate = compileSurrogate; - this.associatedModuleId = null; -}; - -ViewCompileInstruction.normal = new ViewCompileInstruction(); - -var BehaviorInstruction = exports.BehaviorInstruction = function () { - function BehaviorInstruction() { - - } - - BehaviorInstruction.enhance = function enhance() { - var instruction = new BehaviorInstruction(); - instruction.enhance = true; - return instruction; - }; - - BehaviorInstruction.unitTest = function unitTest(type, attributes) { - var instruction = new BehaviorInstruction(); - instruction.type = type; - instruction.attributes = attributes || {}; - return instruction; - }; - - BehaviorInstruction.element = function element(node, type) { - var instruction = new BehaviorInstruction(); - instruction.type = type; - instruction.attributes = {}; - instruction.anchorIsContainer = !(node.hasAttribute('containerless') || type.containerless); - instruction.initiatedByBehavior = true; - return instruction; - }; - - BehaviorInstruction.attribute = function attribute(attrName, type) { - var instruction = new BehaviorInstruction(); - instruction.attrName = attrName; - instruction.type = type || null; - instruction.attributes = {}; - return instruction; - }; - - BehaviorInstruction.dynamic = function dynamic(host, viewModel, viewFactory) { - var instruction = new BehaviorInstruction(); - instruction.host = host; - instruction.viewModel = viewModel; - instruction.viewFactory = viewFactory; - instruction.inheritBindingContext = true; - return instruction; - }; - - return BehaviorInstruction; -}(); - + BehaviorInstruction.enhance = function () { + var instruction = new BehaviorInstruction(); + instruction.enhance = true; + return instruction; + }; + BehaviorInstruction.unitTest = function (type, attributes) { + var instruction = new BehaviorInstruction(); + instruction.type = type; + instruction.attributes = attributes || {}; + return instruction; + }; + BehaviorInstruction.element = function (node, type) { + var instruction = new BehaviorInstruction(); + instruction.type = type; + instruction.attributes = {}; + instruction.anchorIsContainer = !(node.hasAttribute('containerless') || type.containerless); + instruction.initiatedByBehavior = true; + return instruction; + }; + BehaviorInstruction.attribute = function (attrName, type) { + var instruction = new BehaviorInstruction(); + instruction.attrName = attrName; + instruction.type = type || null; + instruction.attributes = {}; + return instruction; + }; + BehaviorInstruction.dynamic = function (host, viewModel, viewFactory) { + var instruction = new BehaviorInstruction(); + instruction.host = host; + instruction.viewModel = viewModel; + instruction.viewFactory = viewFactory; + instruction.inheritBindingContext = true; + return instruction; + }; + BehaviorInstruction.normal = new BehaviorInstruction(); + return BehaviorInstruction; +}()); var biProto = BehaviorInstruction.prototype; biProto.initiatedByBehavior = false; biProto.enhance = false; @@ -19307,22204 +18775,21041 @@ biProto.attributes = null; biProto.type = null; biProto.attrName = null; biProto.inheritBindingContext = false; - -BehaviorInstruction.normal = new BehaviorInstruction(); - -var TargetInstruction = exports.TargetInstruction = (_temp2 = _class2 = function () { - function TargetInstruction() { - - } - - TargetInstruction.shadowSlot = function shadowSlot(parentInjectorId) { - var instruction = new TargetInstruction(); - instruction.parentInjectorId = parentInjectorId; - instruction.shadowSlot = true; - return instruction; - }; - - TargetInstruction.contentExpression = function contentExpression(expression) { - var instruction = new TargetInstruction(); - instruction.contentExpression = expression; - return instruction; - }; - - TargetInstruction.letElement = function letElement(expressions) { - var instruction = new TargetInstruction(); - instruction.expressions = expressions; - instruction.letElement = true; - return instruction; - }; - - TargetInstruction.lifting = function lifting(parentInjectorId, liftingInstruction) { - var instruction = new TargetInstruction(); - instruction.parentInjectorId = parentInjectorId; - instruction.expressions = TargetInstruction.noExpressions; - instruction.behaviorInstructions = [liftingInstruction]; - instruction.viewFactory = liftingInstruction.viewFactory; - instruction.providers = [liftingInstruction.type.target]; - instruction.lifting = true; - return instruction; - }; - - TargetInstruction.normal = function normal(injectorId, parentInjectorId, providers, behaviorInstructions, expressions, elementInstruction) { - var instruction = new TargetInstruction(); - instruction.injectorId = injectorId; - instruction.parentInjectorId = parentInjectorId; - instruction.providers = providers; - instruction.behaviorInstructions = behaviorInstructions; - instruction.expressions = expressions; - instruction.anchorIsContainer = elementInstruction ? elementInstruction.anchorIsContainer : true; - instruction.elementInstruction = elementInstruction; - return instruction; - }; - - TargetInstruction.surrogate = function surrogate(providers, behaviorInstructions, expressions, values) { - var instruction = new TargetInstruction(); - instruction.expressions = expressions; - instruction.behaviorInstructions = behaviorInstructions; - instruction.providers = providers; - instruction.values = values; - return instruction; - }; - - return TargetInstruction; -}(), _class2.noExpressions = Object.freeze([]), _temp2); - - +var TargetInstruction = (function () { + function TargetInstruction() { + } + TargetInstruction.shadowSlot = function (parentInjectorId) { + var instruction = new TargetInstruction(); + instruction.parentInjectorId = parentInjectorId; + instruction.shadowSlot = true; + return instruction; + }; + TargetInstruction.contentExpression = function (expression) { + var instruction = new TargetInstruction(); + instruction.contentExpression = expression; + return instruction; + }; + TargetInstruction.letElement = function (expressions) { + var instruction = new TargetInstruction(); + instruction.expressions = expressions; + instruction.letElement = true; + return instruction; + }; + TargetInstruction.lifting = function (parentInjectorId, liftingInstruction) { + var instruction = new TargetInstruction(); + instruction.parentInjectorId = parentInjectorId; + instruction.expressions = TargetInstruction.noExpressions; + instruction.behaviorInstructions = [liftingInstruction]; + instruction.viewFactory = liftingInstruction.viewFactory; + instruction.providers = [liftingInstruction.type.target]; + instruction.lifting = true; + return instruction; + }; + TargetInstruction.normal = function (injectorId, parentInjectorId, providers, behaviorInstructions, expressions, elementInstruction) { + var instruction = new TargetInstruction(); + instruction.injectorId = injectorId; + instruction.parentInjectorId = parentInjectorId; + instruction.providers = providers; + instruction.behaviorInstructions = behaviorInstructions; + instruction.expressions = expressions; + instruction.anchorIsContainer = elementInstruction ? elementInstruction.anchorIsContainer : true; + instruction.elementInstruction = elementInstruction; + return instruction; + }; + TargetInstruction.surrogate = function (providers, behaviorInstructions, expressions, values) { + var instruction = new TargetInstruction(); + instruction.expressions = expressions; + instruction.behaviorInstructions = behaviorInstructions; + instruction.providers = providers; + instruction.values = values; + return instruction; + }; + TargetInstruction.noExpressions = Object.freeze([]); + return TargetInstruction; +}()); var tiProto = TargetInstruction.prototype; - tiProto.injectorId = null; tiProto.parentInjectorId = null; - tiProto.shadowSlot = false; tiProto.slotName = null; tiProto.slotFallbackFactory = null; - tiProto.contentExpression = null; tiProto.letElement = false; - tiProto.expressions = null; tiProto.expressions = null; tiProto.providers = null; - tiProto.viewFactory = null; - tiProto.anchorIsContainer = false; tiProto.elementInstruction = null; tiProto.lifting = false; - tiProto.values = null; -var viewStrategy = exports.viewStrategy = _aureliaMetadata.protocol.create('aurelia:view-strategy', { - validate: function validate(target) { - if (!(typeof target.loadViewFactory === 'function')) { - return 'View strategies must implement: loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext): Promise'; - } - - return true; - }, - compose: function compose(target) { - if (!(typeof target.makeRelativeTo === 'function')) { - target.makeRelativeTo = _aureliaPal.PLATFORM.noop; - } - } -}); - -var RelativeViewStrategy = exports.RelativeViewStrategy = (_dec = viewStrategy(), _dec(_class3 = function () { - function RelativeViewStrategy(path) { - - - this.path = path; - this.absolutePath = null; - } - - RelativeViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) { - if (this.absolutePath === null && this.moduleId) { - this.absolutePath = (0, _aureliaPath.relativeToFile)(this.path, this.moduleId); - } - - compileInstruction.associatedModuleId = this.moduleId; - return viewEngine.loadViewFactory(this.absolutePath || this.path, compileInstruction, loadContext, target); - }; - - RelativeViewStrategy.prototype.makeRelativeTo = function makeRelativeTo(file) { - if (this.absolutePath === null) { - this.absolutePath = (0, _aureliaPath.relativeToFile)(this.path, file); - } - }; - - return RelativeViewStrategy; -}()) || _class3); -var ConventionalViewStrategy = exports.ConventionalViewStrategy = (_dec2 = viewStrategy(), _dec2(_class4 = function () { - function ConventionalViewStrategy(viewLocator, origin) { - - - this.moduleId = origin.moduleId; - this.viewUrl = viewLocator.convertOriginToViewUrl(origin); - } - - ConventionalViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) { - compileInstruction.associatedModuleId = this.moduleId; - return viewEngine.loadViewFactory(this.viewUrl, compileInstruction, loadContext, target); - }; - - return ConventionalViewStrategy; -}()) || _class4); -var NoViewStrategy = exports.NoViewStrategy = (_dec3 = viewStrategy(), _dec3(_class5 = function () { - function NoViewStrategy(dependencies, dependencyBaseUrl) { - - - this.dependencies = dependencies || null; - this.dependencyBaseUrl = dependencyBaseUrl || ''; - } - - NoViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) { - var entry = this.entry; - var dependencies = this.dependencies; - - if (entry && entry.factoryIsReady) { - return Promise.resolve(null); - } - - this.entry = entry = new _aureliaLoader.TemplateRegistryEntry(this.moduleId || this.dependencyBaseUrl); +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ - entry.dependencies = []; - entry.templateIsLoaded = true; +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; +} - if (dependencies !== null) { - for (var i = 0, ii = dependencies.length; i < ii; ++i) { - var current = dependencies[i]; +var capitalMatcher = /([A-Z])/g; +function addHyphenAndLower(char) { + return '-' + char.toLowerCase(); +} +function _hyphenate(name) { + return (name.charAt(0).toLowerCase() + name.slice(1)).replace(capitalMatcher, addHyphenAndLower); +} +function _isAllWhitespace(node) { + return !(node.auInterpolationTarget || (/[^\t\n\r ]/.test(node.textContent))); +} - if (typeof current === 'string' || typeof current === 'function') { - entry.addDependency(current); - } else { - entry.addDependency(current.from, current.as); +var BehaviorPropertyObserver = (function () { + function BehaviorPropertyObserver(taskQueue, obj, propertyName, selfSubscriber, initialValue) { + this.taskQueue = taskQueue; + this.obj = obj; + this.propertyName = propertyName; + this.notqueued = true; + this.publishing = false; + this.selfSubscriber = selfSubscriber; + this.currentValue = this.oldValue = initialValue; + } + BehaviorPropertyObserver.prototype.getValue = function () { + return this.currentValue; + }; + BehaviorPropertyObserver.prototype.setValue = function (newValue) { + var oldValue = this.currentValue; + if (!Object.is(newValue, oldValue)) { + this.oldValue = oldValue; + this.currentValue = newValue; + if (this.publishing && this.notqueued) { + if (this.taskQueue.flushing) { + this.call(); + } + else { + this.notqueued = false; + this.taskQueue.queueMicroTask(this); + } + } } - } - } - - compileInstruction.associatedModuleId = this.moduleId; - - return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target); - }; - - return NoViewStrategy; -}()) || _class5); -var TemplateRegistryViewStrategy = exports.TemplateRegistryViewStrategy = (_dec4 = viewStrategy(), _dec4(_class6 = function () { - function TemplateRegistryViewStrategy(moduleId, entry) { - - - this.moduleId = moduleId; - this.entry = entry; - } - - TemplateRegistryViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) { - var entry = this.entry; - - if (entry.factoryIsReady) { - return Promise.resolve(entry.factory); - } - - compileInstruction.associatedModuleId = this.moduleId; - return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target); - }; - - return TemplateRegistryViewStrategy; -}()) || _class6); -var InlineViewStrategy = exports.InlineViewStrategy = (_dec5 = viewStrategy(), _dec5(_class7 = function () { - function InlineViewStrategy(markup, dependencies, dependencyBaseUrl) { - - - this.markup = markup; - this.dependencies = dependencies || null; - this.dependencyBaseUrl = dependencyBaseUrl || ''; - } - - InlineViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) { - var entry = this.entry; - var dependencies = this.dependencies; - - if (entry && entry.factoryIsReady) { - return Promise.resolve(entry.factory); - } - - this.entry = entry = new _aureliaLoader.TemplateRegistryEntry(this.moduleId || this.dependencyBaseUrl); - entry.template = _aureliaPal.DOM.createTemplateFromMarkup(this.markup); - - if (dependencies !== null) { - for (var i = 0, ii = dependencies.length; i < ii; ++i) { - var current = dependencies[i]; - - if (typeof current === 'string' || typeof current === 'function') { - entry.addDependency(current); - } else { - entry.addDependency(current.from, current.as); + }; + BehaviorPropertyObserver.prototype.call = function () { + var oldValue = this.oldValue; + var newValue = this.currentValue; + this.notqueued = true; + if (Object.is(newValue, oldValue)) { + return; } - } - } - - compileInstruction.associatedModuleId = this.moduleId; - return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target); - }; - - return InlineViewStrategy; -}()) || _class7); -var StaticViewStrategy = exports.StaticViewStrategy = (_dec6 = viewStrategy(), _dec6(_class8 = function () { - function StaticViewStrategy(config) { - + if (this.selfSubscriber) { + this.selfSubscriber(newValue, oldValue); + } + this.callSubscribers(newValue, oldValue); + this.oldValue = newValue; + }; + BehaviorPropertyObserver.prototype.callSubscribers = function (newValue, oldValue) { + throw new Error('Method not implemented.'); + }; + BehaviorPropertyObserver.prototype.subscribe = function (context, callable) { + this.addSubscriber(context, callable); + }; + BehaviorPropertyObserver.prototype.addSubscriber = function (context, callable) { + throw new Error('Method not implemented.'); + }; + BehaviorPropertyObserver.prototype.unsubscribe = function (context, callable) { + this.removeSubscriber(context, callable); + }; + BehaviorPropertyObserver.prototype.removeSubscriber = function (context, callable) { + throw new Error('Method not implemented.'); + }; + BehaviorPropertyObserver = __decorate([ + aureliaBinding.subscriberCollection() + ], BehaviorPropertyObserver); + return BehaviorPropertyObserver; +}()); - if (typeof config === 'string' || config instanceof _aureliaPal.DOM.Element && config.tagName === 'TEMPLATE') { - config = { - template: config - }; +function getObserver(instance, name) { + var lookup = instance.__observers__; + if (lookup === undefined) { + var ctor = Object.getPrototypeOf(instance).constructor; + var behavior = aureliaMetadata.metadata.get(aureliaMetadata.metadata.resource, ctor); + if (!behavior.isInitialized) { + behavior.initialize(aureliaDependencyInjection.Container.instance || new aureliaDependencyInjection.Container(), instance.constructor); + } + lookup = behavior.observerLocator.getOrCreateObserversLookup(instance); + behavior._ensurePropertiesDefined(instance, lookup); } - this.template = config.template; - this.dependencies = config.dependencies || []; - this.factoryIsReady = false; - this.onReady = null; - this.moduleId = 'undefined'; - } - - StaticViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) { - var _this2 = this; - - if (this.factoryIsReady) { - return Promise.resolve(this.factory); + return lookup[name]; +} +var BindableProperty = (function () { + function BindableProperty(nameOrConfig) { + if (typeof nameOrConfig === 'string') { + this.name = nameOrConfig; + } + else { + Object.assign(this, nameOrConfig); + } + this.attribute = this.attribute || _hyphenate(this.name); + var defaultBindingMode = this.defaultBindingMode; + if (defaultBindingMode === null || defaultBindingMode === undefined) { + this.defaultBindingMode = aureliaBinding.bindingMode.oneWay; + } + else if (typeof defaultBindingMode === 'string') { + this.defaultBindingMode = aureliaBinding.bindingMode[defaultBindingMode] || aureliaBinding.bindingMode.oneWay; + } + this.changeHandler = this.changeHandler || null; + this.owner = null; + this.descriptor = null; } - var deps = this.dependencies; - deps = typeof deps === 'function' ? deps() : deps; - deps = deps ? deps : []; - deps = Array.isArray(deps) ? deps : [deps]; - - return Promise.all(deps).then(function (dependencies) { - var container = viewEngine.container; - var appResources = viewEngine.appResources; - var viewCompiler = viewEngine.viewCompiler; - var viewResources = new ViewResources(appResources); - - var resource = void 0; - var elDeps = []; - - if (target) { - viewResources.autoRegister(container, target); - } - - for (var _iterator = dependencies, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; + BindableProperty.prototype.registerWith = function (target, behavior, descriptor) { + behavior.properties.push(this); + behavior.attributes[this.attribute] = this; + this.owner = behavior; + if (descriptor) { + this.descriptor = descriptor; + return this._configureDescriptor(descriptor); } - - var dep = _ref; - - if (typeof dep === 'function') { - resource = viewResources.autoRegister(container, dep); - if (resource.elementName !== null) { - elDeps.push(resource); - } - } else if (dep && (typeof dep === 'undefined' ? 'undefined' : _typeof(dep)) === 'object') { - for (var _key2 in dep) { - var exported = dep[_key2]; - if (typeof exported === 'function') { - resource = viewResources.autoRegister(container, exported); - if (resource.elementName !== null) { - elDeps.push(resource); - } + return undefined; + }; + BindableProperty.prototype._configureDescriptor = function (descriptor) { + var name = this.name; + descriptor.configurable = true; + descriptor.enumerable = true; + if ('initializer' in descriptor) { + this.defaultValue = descriptor.initializer; + delete descriptor.initializer; + delete descriptor.writable; + } + if ('value' in descriptor) { + this.defaultValue = descriptor.value; + delete descriptor.value; + delete descriptor.writable; + } + descriptor.get = function () { + return getObserver(this, name).getValue(); + }; + descriptor.set = function (value) { + getObserver(this, name).setValue(value); + }; + descriptor.get.getObserver = function (obj) { + return getObserver(obj, name); + }; + return descriptor; + }; + BindableProperty.prototype.defineOn = function (target, behavior) { + var name = this.name; + var handlerName; + if (this.changeHandler === null) { + handlerName = name + 'Changed'; + if (handlerName in target.prototype) { + this.changeHandler = handlerName; } - } - } else { - throw new Error('dependency neither function nor object. Received: "' + (typeof dep === 'undefined' ? 'undefined' : _typeof(dep)) + '"'); } - } - - return Promise.all(elDeps.map(function (el) { - return el.load(container, el.target); - })).then(function () { - var factory = _this2.template !== null ? viewCompiler.compile(_this2.template, viewResources, compileInstruction) : null; - _this2.factoryIsReady = true; - _this2.factory = factory; - return factory; - }); - }); - }; - - return StaticViewStrategy; -}()) || _class8); -var ViewLocator = exports.ViewLocator = (_temp3 = _class9 = function () { - function ViewLocator() { - - } - - ViewLocator.prototype.getViewStrategy = function getViewStrategy(value) { - if (!value) { - return null; - } - - if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && 'getViewStrategy' in value) { - var _origin = _aureliaMetadata.Origin.get(value.constructor); - - value = value.getViewStrategy(); - - if (typeof value === 'string') { - value = new RelativeViewStrategy(value); - } - - viewStrategy.assert(value); - - if (_origin.moduleId) { - value.makeRelativeTo(_origin.moduleId); - } - - return value; - } - - if (typeof value === 'string') { - value = new RelativeViewStrategy(value); - } - - if (viewStrategy.validate(value)) { - return value; - } - - if (typeof value !== 'function') { - value = value.constructor; - } - - if ('$view' in value) { - var c = value.$view; - var _view = void 0; - c = typeof c === 'function' ? c.call(value) : c; - if (c === null) { - _view = new NoViewStrategy(); - } else { - _view = c instanceof StaticViewStrategy ? c : new StaticViewStrategy(c); - } - _aureliaMetadata.metadata.define(ViewLocator.viewStrategyMetadataKey, _view, value); - return _view; - } - - var origin = _aureliaMetadata.Origin.get(value); - var strategy = _aureliaMetadata.metadata.get(ViewLocator.viewStrategyMetadataKey, value); - - if (!strategy) { - if (!origin.moduleId) { - throw new Error('Cannot determine default view strategy for object.', value); - } + if (this.descriptor === null) { + Object.defineProperty(target.prototype, name, this._configureDescriptor({})); + } + }; + BindableProperty.prototype.createObserver = function (viewModel) { + var selfSubscriber = null; + var defaultValue = this.defaultValue; + var changeHandlerName = this.changeHandler; + var name = this.name; + var initialValue; + if (this.hasOptions) { + return undefined; + } + if (changeHandlerName in viewModel) { + if ('propertyChanged' in viewModel) { + selfSubscriber = function (newValue, oldValue) { + viewModel[changeHandlerName](newValue, oldValue); + viewModel.propertyChanged(name, newValue, oldValue); + }; + } + else { + selfSubscriber = function (newValue, oldValue) { return viewModel[changeHandlerName](newValue, oldValue); }; + } + } + else if ('propertyChanged' in viewModel) { + selfSubscriber = function (newValue, oldValue) { return viewModel.propertyChanged(name, newValue, oldValue); }; + } + else if (changeHandlerName !== null) { + throw new Error("Change handler ".concat(changeHandlerName, " was specified but not declared on the class.")); + } + if (defaultValue !== undefined) { + initialValue = typeof defaultValue === 'function' ? defaultValue.call(viewModel) : defaultValue; + } + return new BehaviorPropertyObserver(this.owner.taskQueue, viewModel, this.name, selfSubscriber, initialValue); + }; + BindableProperty.prototype._initialize = function (viewModel, observerLookup, attributes, behaviorHandlesBind, boundProperties) { + var selfSubscriber; + var observer; + var attribute; + var defaultValue = this.defaultValue; + if (this.isDynamic) { + for (var key in attributes) { + this._createDynamicProperty(viewModel, observerLookup, behaviorHandlesBind, key, attributes[key], boundProperties); + } + } + else if (!this.hasOptions) { + observer = observerLookup[this.name]; + if (attributes !== null) { + selfSubscriber = observer.selfSubscriber; + attribute = attributes[this.attribute]; + if (behaviorHandlesBind) { + observer.selfSubscriber = null; + } + if (typeof attribute === 'string') { + viewModel[this.name] = attribute; + observer.call(); + } + else if (attribute) { + boundProperties.push({ observer: observer, binding: attribute.createBinding(viewModel) }); + } + else if (defaultValue !== undefined) { + observer.call(); + } + observer.selfSubscriber = selfSubscriber; + } + observer.publishing = true; + } + }; + BindableProperty.prototype._createDynamicProperty = function (viewModel, observerLookup, behaviorHandlesBind, name, attribute, boundProperties) { + var changeHandlerName = name + 'Changed'; + var selfSubscriber = null; + var observer; + var info; + if (changeHandlerName in viewModel) { + if ('propertyChanged' in viewModel) { + selfSubscriber = function (newValue, oldValue) { + viewModel[changeHandlerName](newValue, oldValue); + viewModel.propertyChanged(name, newValue, oldValue); + }; + } + else { + selfSubscriber = function (newValue, oldValue) { return viewModel[changeHandlerName](newValue, oldValue); }; + } + } + else if ('propertyChanged' in viewModel) { + selfSubscriber = function (newValue, oldValue) { return viewModel.propertyChanged(name, newValue, oldValue); }; + } + observer = observerLookup[name] = new BehaviorPropertyObserver(this.owner.taskQueue, viewModel, name, selfSubscriber); + Object.defineProperty(viewModel, name, { + configurable: true, + enumerable: true, + get: observer.getValue.bind(observer), + set: observer.setValue.bind(observer) + }); + if (behaviorHandlesBind) { + observer.selfSubscriber = null; + } + if (typeof attribute === 'string') { + viewModel[name] = attribute; + observer.call(); + } + else if (attribute) { + info = { observer: observer, binding: attribute.createBinding(viewModel) }; + boundProperties.push(info); + } + observer.publishing = true; + observer.selfSubscriber = selfSubscriber; + }; + return BindableProperty; +}()); - strategy = this.createFallbackViewStrategy(origin); - } else if (origin.moduleId) { - strategy.moduleId = origin.moduleId; +var ViewLocator = (function () { + function ViewLocator() { } - - return strategy; - }; - - ViewLocator.prototype.createFallbackViewStrategy = function createFallbackViewStrategy(origin) { - return new ConventionalViewStrategy(this, origin); - }; - - ViewLocator.prototype.convertOriginToViewUrl = function convertOriginToViewUrl(origin) { - var moduleId = origin.moduleId; - var id = moduleId.endsWith('.js') || moduleId.endsWith('.ts') ? moduleId.substring(0, moduleId.length - 3) : moduleId; - return id + '.html'; - }; - - return ViewLocator; -}(), _class9.viewStrategyMetadataKey = 'aurelia:view-strategy', _temp3); - + ViewLocator.prototype.getViewStrategy = function (value) { + if (!value) { + return null; + } + if (typeof value === 'object' && 'getViewStrategy' in value) { + var origin_1 = aureliaMetadata.Origin.get(value.constructor); + value = value.getViewStrategy(); + if (typeof value === 'string') { + value = new RelativeViewStrategy(value); + } + viewStrategy.assert(value); + if (origin_1.moduleId) { + value.makeRelativeTo(origin_1.moduleId); + } + return value; + } + if (typeof value === 'string') { + value = new RelativeViewStrategy(value); + } + if (viewStrategy.validate(value)) { + return value; + } + if (typeof value !== 'function') { + value = value.constructor; + } + if ('$view' in value) { + var c = value.$view; + var view = void 0; + c = typeof c === 'function' ? c.call(value) : c; + if (c === null) { + view = new NoViewStrategy(); + } + else { + view = c instanceof StaticViewStrategy ? c : new StaticViewStrategy(c); + } + aureliaMetadata.metadata.define(ViewLocator.viewStrategyMetadataKey, view, value); + return view; + } + var origin = aureliaMetadata.Origin.get(value); + var strategy = aureliaMetadata.metadata.get(ViewLocator.viewStrategyMetadataKey, value); + if (!strategy) { + if (!origin.moduleId) { + throw new Error('Cannot determine default view strategy for object.\n' + value); + } + strategy = this.createFallbackViewStrategy(origin); + } + else if (origin.moduleId) { + strategy.moduleId = origin.moduleId; + } + return strategy; + }; + ViewLocator.prototype.createFallbackViewStrategy = function (origin) { + return new ConventionalViewStrategy(this, origin); + }; + ViewLocator.prototype.convertOriginToViewUrl = function (origin) { + var moduleId = origin.moduleId; + var id = (moduleId.endsWith('.js') || moduleId.endsWith('.ts')) ? moduleId.substring(0, moduleId.length - 3) : moduleId; + return id + '.html'; + }; + ViewLocator.viewStrategyMetadataKey = 'aurelia:view-strategy'; + return ViewLocator; +}()); function mi(name) { - throw new Error('BindingLanguage must implement ' + name + '().'); + throw new Error("BindingLanguage must implement ".concat(name, "().")); } - -var BindingLanguage = exports.BindingLanguage = function () { - function BindingLanguage() { - - } - - BindingLanguage.prototype.inspectAttribute = function inspectAttribute(resources, elementName, attrName, attrValue) { - mi('inspectAttribute'); - }; - - BindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, info, existingInstruction) { - mi('createAttributeInstruction'); - }; - - BindingLanguage.prototype.createLetExpressions = function createLetExpressions(resources, element) { - mi('createLetExpressions'); - }; - - BindingLanguage.prototype.inspectTextContent = function inspectTextContent(resources, value) { - mi('inspectTextContent'); - }; - - return BindingLanguage; -}(); - -var noNodes = Object.freeze([]); - -var SlotCustomAttribute = exports.SlotCustomAttribute = function () { - SlotCustomAttribute.inject = function inject() { - return [_aureliaPal.DOM.Element]; - }; - - function SlotCustomAttribute(element) { - - - this.element = element; - this.element.auSlotAttribute = this; - } - - SlotCustomAttribute.prototype.valueChanged = function valueChanged(newValue, oldValue) {}; - - return SlotCustomAttribute; -}(); - -var PassThroughSlot = exports.PassThroughSlot = function () { - function PassThroughSlot(anchor, name, destinationName, fallbackFactory) { - - - this.anchor = anchor; - this.anchor.viewSlot = this; - this.name = name; - this.destinationName = destinationName; - this.fallbackFactory = fallbackFactory; - this.destinationSlot = null; - this.projections = 0; - this.contentView = null; - - var attr = new SlotCustomAttribute(this.anchor); - attr.value = this.destinationName; - } - - PassThroughSlot.prototype.renderFallbackContent = function renderFallbackContent(view, nodes, projectionSource, index) { - if (this.contentView === null) { - this.contentView = this.fallbackFactory.create(this.ownerView.container); - this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext); - - var slots = Object.create(null); - slots[this.destinationSlot.name] = this.destinationSlot; - - ShadowDOM.distributeView(this.contentView, slots, projectionSource, index, this.destinationSlot.name); - } - }; - - PassThroughSlot.prototype.passThroughTo = function passThroughTo(destinationSlot) { - this.destinationSlot = destinationSlot; - }; - - PassThroughSlot.prototype.addNode = function addNode(view, node, projectionSource, index) { - if (this.contentView !== null) { - this.contentView.removeNodes(); - this.contentView.detached(); - this.contentView.unbind(); - this.contentView = null; - } - - if (node.viewSlot instanceof PassThroughSlot) { - node.viewSlot.passThroughTo(this); - return; - } - - this.projections++; - this.destinationSlot.addNode(view, node, projectionSource, index); - }; - - PassThroughSlot.prototype.removeView = function removeView(view, projectionSource) { - this.projections--; - this.destinationSlot.removeView(view, projectionSource); - - if (this.needsFallbackRendering) { - this.renderFallbackContent(null, noNodes, projectionSource); - } - }; - - PassThroughSlot.prototype.removeAll = function removeAll(projectionSource) { - this.projections = 0; - this.destinationSlot.removeAll(projectionSource); - - if (this.needsFallbackRendering) { - this.renderFallbackContent(null, noNodes, projectionSource); - } - }; - - PassThroughSlot.prototype.projectFrom = function projectFrom(view, projectionSource) { - this.destinationSlot.projectFrom(view, projectionSource); - }; - - PassThroughSlot.prototype.created = function created(ownerView) { - this.ownerView = ownerView; - }; - - PassThroughSlot.prototype.bind = function bind(view) { - if (this.contentView) { - this.contentView.bind(view.bindingContext, view.overrideContext); - } - }; - - PassThroughSlot.prototype.attached = function attached() { - if (this.contentView) { - this.contentView.attached(); - } - }; - - PassThroughSlot.prototype.detached = function detached() { - if (this.contentView) { - this.contentView.detached(); - } - }; - - PassThroughSlot.prototype.unbind = function unbind() { - if (this.contentView) { - this.contentView.unbind(); - } - }; - - _createClass(PassThroughSlot, [{ - key: 'needsFallbackRendering', - get: function get() { - return this.fallbackFactory && this.projections === 0; - } - }]); - - return PassThroughSlot; -}(); - -var ShadowSlot = exports.ShadowSlot = function () { - function ShadowSlot(anchor, name, fallbackFactory) { - - - this.anchor = anchor; - this.anchor.isContentProjectionSource = true; - this.anchor.viewSlot = this; - this.name = name; - this.fallbackFactory = fallbackFactory; - this.contentView = null; - this.projections = 0; - this.children = []; - this.projectFromAnchors = null; - this.destinationSlots = null; - } - - ShadowSlot.prototype.addNode = function addNode(view, node, projectionSource, index, destination) { - if (this.contentView !== null) { - this.contentView.removeNodes(); - this.contentView.detached(); - this.contentView.unbind(); - this.contentView = null; - } - - if (node.viewSlot instanceof PassThroughSlot) { - node.viewSlot.passThroughTo(this); - return; +var BindingLanguage = (function () { + function BindingLanguage() { } + BindingLanguage.prototype.inspectAttribute = function (resources, elementName, attrName, attrValue) { + mi('inspectAttribute'); + }; + BindingLanguage.prototype.createAttributeInstruction = function (resources, element, info, existingInstruction, context) { + mi('createAttributeInstruction'); + }; + BindingLanguage.prototype.createLetExpressions = function (resources, element) { + mi('createLetExpressions'); + }; + BindingLanguage.prototype.inspectTextContent = function (resources, value) { + mi('inspectTextContent'); + }; + return BindingLanguage; +}()); - if (this.destinationSlots !== null) { - ShadowDOM.distributeNodes(view, [node], this.destinationSlots, this, index); - } else { - node.auOwnerView = view; - node.auProjectionSource = projectionSource; - node.auAssignedSlot = this; - - var anchor = this._findAnchor(view, node, projectionSource, index); - var parent = anchor.parentNode; - - parent.insertBefore(node, anchor); - this.children.push(node); - this.projections++; +var noNodes = Object.freeze([]); +var SlotCustomAttribute = (function () { + function SlotCustomAttribute(element) { + this.element = element; + this.element.auSlotAttribute = this; } - }; - - ShadowSlot.prototype.removeView = function removeView(view, projectionSource) { - if (this.destinationSlots !== null) { - ShadowDOM.undistributeView(view, this.destinationSlots, this); - } else if (this.contentView && this.contentView.hasSlots) { - ShadowDOM.undistributeView(view, this.contentView.slots, projectionSource); - } else { - var found = this.children.find(function (x) { - return x.auSlotProjectFrom === projectionSource; - }); - if (found) { - var _children = found.auProjectionChildren; - - for (var i = 0, ii = _children.length; i < ii; ++i) { - var _child = _children[i]; - - if (_child.auOwnerView === view) { - _children.splice(i, 1); - view.fragment.appendChild(_child); - i--;ii--; - this.projections--; - } + SlotCustomAttribute.inject = function () { + return [aureliaPal.DOM.Element]; + }; + SlotCustomAttribute.prototype.valueChanged = function (newValue, oldValue) { }; + return SlotCustomAttribute; +}()); +var PassThroughSlot = (function () { + function PassThroughSlot(anchor, name, destinationName, fallbackFactory) { + this.anchor = anchor; + this.anchor.viewSlot = this; + this.name = name; + this.destinationName = destinationName; + this.fallbackFactory = fallbackFactory; + this.destinationSlot = null; + this.projections = 0; + this.contentView = null; + var attr = new SlotCustomAttribute(this.anchor); + attr.value = this.destinationName; + } + Object.defineProperty(PassThroughSlot.prototype, "needsFallbackRendering", { + get: function () { + return this.fallbackFactory && this.projections === 0; + }, + enumerable: false, + configurable: true + }); + PassThroughSlot.prototype.renderFallbackContent = function (view, nodes, projectionSource, index) { + if (this.contentView === null) { + this.contentView = this.fallbackFactory.create(this.ownerView.container); + this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext); + var slots = Object.create(null); + slots[this.destinationSlot.name] = this.destinationSlot; + ShadowDOM.distributeView(this.contentView, slots, projectionSource, index, this.destinationSlot.name); } - - if (this.needsFallbackRendering) { - this.renderFallbackContent(view, noNodes, projectionSource); + }; + PassThroughSlot.prototype.passThroughTo = function (destinationSlot) { + this.destinationSlot = destinationSlot; + }; + PassThroughSlot.prototype.addNode = function (view, node, projectionSource, index) { + if (this.contentView !== null) { + this.contentView.removeNodes(); + this.contentView.detached(); + this.contentView.unbind(); + this.contentView = null; + } + if (node.viewSlot instanceof PassThroughSlot) { + node.viewSlot.passThroughTo(this); + return; } - } - } - }; - - ShadowSlot.prototype.removeAll = function removeAll(projectionSource) { - if (this.destinationSlots !== null) { - ShadowDOM.undistributeAll(this.destinationSlots, this); - } else if (this.contentView && this.contentView.hasSlots) { - ShadowDOM.undistributeAll(this.contentView.slots, projectionSource); - } else { - var found = this.children.find(function (x) { - return x.auSlotProjectFrom === projectionSource; - }); - - if (found) { - var _children2 = found.auProjectionChildren; - for (var i = 0, ii = _children2.length; i < ii; ++i) { - var _child2 = _children2[i]; - _child2.auOwnerView.fragment.appendChild(_child2); - this.projections--; + this.projections++; + this.destinationSlot.addNode(view, node, projectionSource, index); + }; + PassThroughSlot.prototype.removeView = function (view, projectionSource) { + this.projections--; + this.destinationSlot.removeView(view, projectionSource); + if (this.needsFallbackRendering) { + this.renderFallbackContent(null, noNodes, projectionSource); } - - found.auProjectionChildren = []; - + }; + PassThroughSlot.prototype.removeAll = function (projectionSource) { + this.projections = 0; + this.destinationSlot.removeAll(projectionSource); if (this.needsFallbackRendering) { - this.renderFallbackContent(null, noNodes, projectionSource); + this.renderFallbackContent(null, noNodes, projectionSource); } - } - } - }; - - ShadowSlot.prototype._findAnchor = function _findAnchor(view, node, projectionSource, index) { - if (projectionSource) { - var found = this.children.find(function (x) { - return x.auSlotProjectFrom === projectionSource; - }); - if (found) { - if (index !== undefined) { - var _children3 = found.auProjectionChildren; - var viewIndex = -1; - var lastView = void 0; - - for (var i = 0, ii = _children3.length; i < ii; ++i) { - var current = _children3[i]; - - if (current.auOwnerView !== lastView) { - viewIndex++; - lastView = current.auOwnerView; - - if (viewIndex >= index && lastView !== view) { - _children3.splice(i, 0, node); - return current; - } + }; + PassThroughSlot.prototype.projectFrom = function (view, projectionSource) { + this.destinationSlot.projectFrom(view, projectionSource); + }; + PassThroughSlot.prototype.created = function (ownerView) { + this.ownerView = ownerView; + }; + PassThroughSlot.prototype.bind = function (view) { + if (this.contentView) { + this.contentView.bind(view.bindingContext, view.overrideContext); + } + }; + PassThroughSlot.prototype.attached = function () { + if (this.contentView) { + this.contentView.attached(); + } + }; + PassThroughSlot.prototype.detached = function () { + if (this.contentView) { + this.contentView.detached(); + } + }; + PassThroughSlot.prototype.unbind = function () { + if (this.contentView) { + this.contentView.unbind(); + } + }; + return PassThroughSlot; +}()); +var ShadowSlot = (function () { + function ShadowSlot(anchor, name, fallbackFactory) { + this.anchor = anchor; + this.anchor.isContentProjectionSource = true; + this.anchor.viewSlot = this; + this.name = name; + this.fallbackFactory = fallbackFactory; + this.contentView = null; + this.projections = 0; + this.children = []; + this.projectFromAnchors = null; + this.destinationSlots = null; + } + Object.defineProperty(ShadowSlot.prototype, "needsFallbackRendering", { + get: function () { + return this.fallbackFactory && this.projections === 0; + }, + enumerable: false, + configurable: true + }); + ShadowSlot.prototype.addNode = function (view, node, projectionSource, index, destination) { + var $node = node; + if (this.contentView !== null) { + this.contentView.removeNodes(); + this.contentView.detached(); + this.contentView.unbind(); + this.contentView = null; + } + if ($node.viewSlot instanceof PassThroughSlot) { + $node.viewSlot.passThroughTo(this); + return; + } + if (this.destinationSlots !== null) { + ShadowDOM.distributeNodes(view, [$node], this.destinationSlots, this, index); + } + else { + $node.auOwnerView = view; + $node.auProjectionSource = projectionSource; + $node.auAssignedSlot = this; + var anchor = this._findAnchor(view, $node, projectionSource, index); + var parent_1 = anchor.parentNode; + parent_1.insertBefore($node, anchor); + this.children.push($node); + this.projections++; + } + }; + ShadowSlot.prototype.removeView = function (view, projectionSource) { + if (this.destinationSlots !== null) { + ShadowDOM.undistributeView(view, this.destinationSlots, this); + } + else if (this.contentView && this.contentView.hasSlots) { + ShadowDOM.undistributeView(view, this.contentView.slots, projectionSource); + } + else { + var found = this.children.find(function (x) { return x.auSlotProjectFrom === projectionSource; }); + if (found) { + var children = found.auProjectionChildren; + var ownChildren = this.children; + for (var i = 0, ii = children.length; i < ii; ++i) { + var child = children[i]; + if (child.auOwnerView === view) { + children.splice(i, 1); + view.fragment.appendChild(child); + i--; + ii--; + this.projections--; + var idx = ownChildren.indexOf(child); + if (idx > -1) { + ownChildren.splice(idx, 1); + } + } + } + if (this.needsFallbackRendering) { + this.renderFallbackContent(view, noNodes, projectionSource); + } } - } } - - found.auProjectionChildren.push(node); - return found; - } - } - - return this.anchor; - }; - - ShadowSlot.prototype.projectTo = function projectTo(slots) { - this.destinationSlots = slots; - }; - - ShadowSlot.prototype.projectFrom = function projectFrom(view, projectionSource) { - var anchor = _aureliaPal.DOM.createComment('anchor'); - var parent = this.anchor.parentNode; - anchor.auSlotProjectFrom = projectionSource; - anchor.auOwnerView = view; - anchor.auProjectionChildren = []; - parent.insertBefore(anchor, this.anchor); - this.children.push(anchor); - - if (this.projectFromAnchors === null) { - this.projectFromAnchors = []; - } - - this.projectFromAnchors.push(anchor); - }; - - ShadowSlot.prototype.renderFallbackContent = function renderFallbackContent(view, nodes, projectionSource, index) { - if (this.contentView === null) { - this.contentView = this.fallbackFactory.create(this.ownerView.container); - this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext); - this.contentView.insertNodesBefore(this.anchor); + }; + ShadowSlot.prototype.removeAll = function (projectionSource) { + if (this.destinationSlots !== null) { + ShadowDOM.undistributeAll(this.destinationSlots, this); + } + else if (this.contentView && this.contentView.hasSlots) { + ShadowDOM.undistributeAll(this.contentView.slots, projectionSource); + } + else { + var found = this.children.find(function (x) { return x.auSlotProjectFrom === projectionSource; }); + if (found) { + var children = found.auProjectionChildren; + var ownChildren = this.children; + for (var i = 0, ii = children.length; i < ii; ++i) { + var child = children[i]; + child.auOwnerView.fragment.appendChild(child); + this.projections--; + var idx = ownChildren.indexOf(child); + if (idx > -1) { + ownChildren.splice(idx, 1); + } + } + found.auProjectionChildren = []; + if (this.needsFallbackRendering) { + this.renderFallbackContent(null, noNodes, projectionSource); + } + } + } + }; + ShadowSlot.prototype._findAnchor = function (view, node, projectionSource, index) { + if (projectionSource) { + var found = this.children.find(function (x) { return x.auSlotProjectFrom === projectionSource; }); + if (found) { + if (index !== undefined) { + var children = found.auProjectionChildren; + var viewIndex = -1; + var lastView = void 0; + for (var i = 0, ii = children.length; i < ii; ++i) { + var current = children[i]; + if (current.auOwnerView !== lastView) { + viewIndex++; + lastView = current.auOwnerView; + if (viewIndex >= index && lastView !== view) { + children.splice(i, 0, node); + return current; + } + } + } + } + found.auProjectionChildren.push(node); + return found; + } + } + return this.anchor; + }; + ShadowSlot.prototype.projectTo = function (slots) { + this.destinationSlots = slots; + }; + ShadowSlot.prototype.projectFrom = function (view, projectionSource) { + var anchor = aureliaPal.DOM.createComment('anchor'); + var parent = this.anchor.parentNode; + anchor.auSlotProjectFrom = projectionSource; + anchor.auOwnerView = view; + anchor.auProjectionChildren = []; + parent.insertBefore(anchor, this.anchor); + this.children.push(anchor); + if (this.projectFromAnchors === null) { + this.projectFromAnchors = []; + } + this.projectFromAnchors.push(anchor); + }; + ShadowSlot.prototype.renderFallbackContent = function (view, nodes, projectionSource, index) { + if (this.contentView === null) { + this.contentView = this.fallbackFactory.create(this.ownerView.container); + this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext); + this.contentView.insertNodesBefore(this.anchor); + } + if (this.contentView.hasSlots) { + var slots = this.contentView.slots; + var projectFromAnchors = this.projectFromAnchors; + if (projectFromAnchors !== null) { + for (var slotName in slots) { + var slot = slots[slotName]; + for (var i = 0, ii = projectFromAnchors.length; i < ii; ++i) { + var anchor = projectFromAnchors[i]; + slot.projectFrom(anchor.auOwnerView, anchor.auSlotProjectFrom); + } + } + } + this.fallbackSlots = slots; + ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index); + } + }; + ShadowSlot.prototype.created = function (ownerView) { + this.ownerView = ownerView; + }; + ShadowSlot.prototype.bind = function (view) { + if (this.contentView) { + this.contentView.bind(view.bindingContext, view.overrideContext); + } + }; + ShadowSlot.prototype.attached = function () { + if (this.contentView) { + this.contentView.attached(); + } + }; + ShadowSlot.prototype.detached = function () { + if (this.contentView) { + this.contentView.detached(); + } + }; + ShadowSlot.prototype.unbind = function () { + if (this.contentView) { + this.contentView.unbind(); + } + }; + return ShadowSlot; +}()); +var ShadowDOM = (function () { + function ShadowDOM() { } - - if (this.contentView.hasSlots) { - var slots = this.contentView.slots; - var projectFromAnchors = this.projectFromAnchors; - - if (projectFromAnchors !== null) { + ShadowDOM.getSlotName = function (node) { + if (node.auSlotAttribute === undefined) { + return ShadowDOM.defaultSlotKey; + } + return node.auSlotAttribute.value; + }; + ShadowDOM.distributeView = function (view, slots, projectionSource, index, destinationOverride) { + var nodes; + if (view === null) { + nodes = noNodes; + } + else { + var childNodes = view.fragment.childNodes; + var ii = childNodes.length; + nodes = new Array(ii); + for (var i = 0; i < ii; ++i) { + nodes[i] = childNodes[i]; + } + } + ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride); + }; + ShadowDOM.undistributeView = function (view, slots, projectionSource) { for (var slotName in slots) { - var slot = slots[slotName]; - - for (var i = 0, ii = projectFromAnchors.length; i < ii; ++i) { - var anchor = projectFromAnchors[i]; - slot.projectFrom(anchor.auOwnerView, anchor.auSlotProjectFrom); - } + slots[slotName].removeView(view, projectionSource); } - } - - this.fallbackSlots = slots; - ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index); - } - }; - - ShadowSlot.prototype.created = function created(ownerView) { - this.ownerView = ownerView; - }; - - ShadowSlot.prototype.bind = function bind(view) { - if (this.contentView) { - this.contentView.bind(view.bindingContext, view.overrideContext); - } - }; - - ShadowSlot.prototype.attached = function attached() { - if (this.contentView) { - this.contentView.attached(); - } - }; - - ShadowSlot.prototype.detached = function detached() { - if (this.contentView) { - this.contentView.detached(); - } - }; - - ShadowSlot.prototype.unbind = function unbind() { - if (this.contentView) { - this.contentView.unbind(); - } - }; - - _createClass(ShadowSlot, [{ - key: 'needsFallbackRendering', - get: function get() { - return this.fallbackFactory && this.projections === 0; - } - }]); - - return ShadowSlot; -}(); - -var ShadowDOM = exports.ShadowDOM = (_temp4 = _class10 = function () { - function ShadowDOM() { - - } - - ShadowDOM.getSlotName = function getSlotName(node) { - if (node.auSlotAttribute === undefined) { - return ShadowDOM.defaultSlotKey; - } - - return node.auSlotAttribute.value; - }; - - ShadowDOM.distributeView = function distributeView(view, slots, projectionSource, index, destinationOverride) { - var nodes = void 0; - - if (view === null) { - nodes = noNodes; - } else { - var childNodes = view.fragment.childNodes; - var ii = childNodes.length; - nodes = new Array(ii); - - for (var i = 0; i < ii; ++i) { - nodes[i] = childNodes[i]; - } - } - - ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride); - }; - - ShadowDOM.undistributeView = function undistributeView(view, slots, projectionSource) { - for (var slotName in slots) { - slots[slotName].removeView(view, projectionSource); - } - }; - - ShadowDOM.undistributeAll = function undistributeAll(slots, projectionSource) { - for (var slotName in slots) { - slots[slotName].removeAll(projectionSource); - } - }; - - ShadowDOM.distributeNodes = function distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride) { - for (var i = 0, ii = nodes.length; i < ii; ++i) { - var currentNode = nodes[i]; - var nodeType = currentNode.nodeType; - - if (currentNode.isContentProjectionSource) { - currentNode.viewSlot.projectTo(slots); - + }; + ShadowDOM.undistributeAll = function (slots, projectionSource) { for (var slotName in slots) { - slots[slotName].projectFrom(view, currentNode.viewSlot); + slots[slotName].removeAll(projectionSource); } - - nodes.splice(i, 1); - ii--;i--; - } else if (nodeType === 1 || nodeType === 3 || currentNode.viewSlot instanceof PassThroughSlot) { - if (nodeType === 3 && _isAllWhitespace(currentNode)) { - nodes.splice(i, 1); - ii--;i--; - } else { - var found = slots[destinationOverride || ShadowDOM.getSlotName(currentNode)]; - - if (found) { - found.addNode(view, currentNode, projectionSource, index); - nodes.splice(i, 1); - ii--;i--; - } + }; + ShadowDOM.distributeNodes = function (view, nodes, slots, projectionSource, index, destinationOverride) { + for (var i = 0, ii = nodes.length; i < ii; ++i) { + var currentNode = nodes[i]; + var nodeType = currentNode.nodeType; + if (currentNode.isContentProjectionSource) { + currentNode.viewSlot.projectTo(slots); + for (var slotName in slots) { + slots[slotName].projectFrom(view, currentNode.viewSlot); + } + nodes.splice(i, 1); + ii--; + i--; + } + else if (nodeType === 1 || nodeType === 3 || currentNode.viewSlot instanceof PassThroughSlot) { + if (nodeType === 3 && _isAllWhitespace(currentNode)) { + nodes.splice(i, 1); + ii--; + i--; + } + else { + var found = slots[destinationOverride || ShadowDOM.getSlotName(currentNode)]; + if (found) { + found.addNode(view, currentNode, projectionSource, index); + nodes.splice(i, 1); + ii--; + i--; + } + } + } + else { + nodes.splice(i, 1); + ii--; + i--; + } } - } else { - nodes.splice(i, 1); - ii--;i--; - } - } - - for (var _slotName in slots) { - var slot = slots[_slotName]; + for (var slotName in slots) { + var slot = slots[slotName]; + if (slot.needsFallbackRendering) { + slot.renderFallbackContent(view, nodes, projectionSource, index); + } + } + }; + ShadowDOM.defaultSlotKey = '__au-default-slot-key__'; + return ShadowDOM; +}()); - if (slot.needsFallbackRendering) { - slot.renderFallbackContent(view, nodes, projectionSource, index); - } +var CompositionTransactionNotifier = (function () { + function CompositionTransactionNotifier(owner) { + this.owner = owner; + this.owner._compositionCount++; } - }; - - return ShadowDOM; -}(), _class10.defaultSlotKey = '__au-default-slot-key__', _temp4); - - -function register(lookup, name, resource, type) { - if (!name) { - return; - } - - var existing = lookup[name]; - if (existing) { - if (existing !== resource) { - throw new Error('Attempted to register ' + type + ' when one with the same name already exists. Name: ' + name + '.'); + CompositionTransactionNotifier.prototype.done = function () { + this.owner._compositionCount--; + this.owner._tryCompleteTransaction(); + }; + return CompositionTransactionNotifier; +}()); +var CompositionTransactionOwnershipToken = (function () { + function CompositionTransactionOwnershipToken(owner) { + this.owner = owner; + this.owner._ownershipToken = this; + this.thenable = this._createThenable(); } - - return; - } - - lookup[name] = resource; -} - -function validateBehaviorName(name, type) { - if (/[A-Z]/.test(name)) { - var newName = _hyphenate(name); - LogManager.getLogger('templating').warn('\'' + name + '\' is not a valid ' + type + ' name and has been converted to \'' + newName + '\'. Upper-case letters are not allowed because the DOM is not case-sensitive.'); - return newName; - } - return name; -} - -var conventionMark = '__au_resource__'; - -var ViewResources = exports.ViewResources = function () { - ViewResources.convention = function convention(target, existing) { - var resource = void 0; - - if (existing && conventionMark in existing) { - return existing; + CompositionTransactionOwnershipToken.prototype.waitForCompositionComplete = function () { + this.owner._tryCompleteTransaction(); + return this.thenable; + }; + CompositionTransactionOwnershipToken.prototype.resolve = function () { + this._resolveCallback(); + }; + CompositionTransactionOwnershipToken.prototype._resolveCallback = function () { + throw new Error("Method not implemented."); + }; + CompositionTransactionOwnershipToken.prototype._createThenable = function () { + var _this = this; + return new Promise(function (resolve) { + _this._resolveCallback = resolve; + }); + }; + return CompositionTransactionOwnershipToken; +}()); +var CompositionTransaction = (function () { + function CompositionTransaction() { + this._ownershipToken = null; + this._compositionCount = 0; } - if ('$resource' in target) { - var config = target.$resource; + CompositionTransaction.prototype.tryCapture = function () { + return this._ownershipToken === null + ? new CompositionTransactionOwnershipToken(this) + : null; + }; + CompositionTransaction.prototype.enlist = function () { + return new CompositionTransactionNotifier(this); + }; + CompositionTransaction.prototype._tryCompleteTransaction = function () { + if (this._compositionCount <= 0) { + this._compositionCount = 0; + if (this._ownershipToken !== null) { + var token = this._ownershipToken; + this._ownershipToken = null; + token.resolve(); + } + } + }; + return CompositionTransaction; +}()); - if (typeof config === 'string') { - resource = existing || new HtmlBehaviorResource(); - resource[conventionMark] = true; - if (!resource.elementName) { - resource.elementName = validateBehaviorName(config, 'custom element'); +var View = (function () { + function View(container, viewFactory, fragment, controllers, bindings, children, slots) { + this.container = container; + this.viewFactory = viewFactory; + this.resources = viewFactory.resources; + this.fragment = fragment; + this.firstChild = fragment.firstChild; + this.lastChild = fragment.lastChild; + this.controllers = controllers; + this.bindings = bindings; + this.children = children; + this.slots = slots; + this.hasSlots = false; + this.fromCache = false; + this.isBound = false; + this.isAttached = false; + this.bindingContext = null; + this.overrideContext = null; + this.controller = null; + this.viewModelScope = null; + this.animatableElement = undefined; + this._isUserControlled = false; + this.contentView = null; + for (var _ in slots) { + this.hasSlots = true; + break; } - } else { - if (typeof config === 'function') { - config = config.call(target); + } + View.prototype.returnToCache = function () { + this.viewFactory.returnViewToCache(this); + }; + View.prototype.created = function () { + var i; + var ii; + var controllers = this.controllers; + for (i = 0, ii = controllers.length; i < ii; ++i) { + controllers[i].created(this); + } + }; + View.prototype.bind = function (bindingContext, overrideContext, _systemUpdate) { + var controllers; + var bindings; + var children; + var i; + var ii; + if (_systemUpdate && this._isUserControlled) { + return; } - if (typeof config === 'string') { - config = { name: config }; + if (this.isBound) { + if (this.bindingContext === bindingContext) { + return; + } + this.unbind(); } - - config = Object.assign({}, config); - - var resourceType = config.type || 'element'; - - var _name = config.name; - switch (resourceType) { - case 'element':case 'attribute': - resource = existing || new HtmlBehaviorResource(); - resource[conventionMark] = true; - if (resourceType === 'element') { - if (!resource.elementName) { - resource.elementName = _name ? validateBehaviorName(_name, 'custom element') : _hyphenate(target.name); - } - } else { - if (!resource.attributeName) { - resource.attributeName = _name ? validateBehaviorName(_name, 'custom attribute') : _hyphenate(target.name); - } + this.isBound = true; + this.bindingContext = bindingContext; + this.overrideContext = overrideContext || aureliaBinding.createOverrideContext(bindingContext); + this.resources._invokeHook('beforeBind', this); + bindings = this.bindings; + for (i = 0, ii = bindings.length; i < ii; ++i) { + bindings[i].bind(this); + } + if (this.viewModelScope !== null) { + bindingContext.bind(this.viewModelScope.bindingContext, this.viewModelScope.overrideContext); + this.viewModelScope = null; + } + controllers = this.controllers; + for (i = 0, ii = controllers.length; i < ii; ++i) { + controllers[i].bind(this); + } + children = this.children; + for (i = 0, ii = children.length; i < ii; ++i) { + children[i].bind(bindingContext, overrideContext, true); + } + if (this.hasSlots) { + ShadowDOM.distributeView(this.contentView, this.slots); + } + }; + View.prototype.addBinding = function (binding) { + this.bindings.push(binding); + if (this.isBound) { + binding.bind(this); + } + }; + View.prototype.unbind = function () { + var controllers; + var bindings; + var children; + var i; + var ii; + if (this.isBound) { + this.isBound = false; + this.resources._invokeHook('beforeUnbind', this); + if (this.controller !== null) { + this.controller.unbind(); } - if ('templateController' in config) { - config.liftsContent = config.templateController; - delete config.templateController; + bindings = this.bindings; + for (i = 0, ii = bindings.length; i < ii; ++i) { + bindings[i].unbind(); } - if ('defaultBindingMode' in config && resource.attributeDefaultBindingMode !== undefined) { - config.attributeDefaultBindingMode = config.defaultBindingMode; - delete config.defaultBindingMode; + controllers = this.controllers; + for (i = 0, ii = controllers.length; i < ii; ++i) { + controllers[i].unbind(); } - - delete config.name; - - Object.assign(resource, config); - break; - case 'valueConverter': - resource = new _aureliaBinding.ValueConverterResource((0, _aureliaBinding.camelCase)(_name || target.name)); - break; - case 'bindingBehavior': - resource = new _aureliaBinding.BindingBehaviorResource((0, _aureliaBinding.camelCase)(_name || target.name)); - break; - case 'viewEngineHooks': - resource = new ViewEngineHooksResource(); - break; + children = this.children; + for (i = 0, ii = children.length; i < ii; ++i) { + children[i].unbind(); + } + this.bindingContext = null; + this.overrideContext = null; } - } - - if (resource instanceof HtmlBehaviorResource) { - var _bindables = typeof config === 'string' ? undefined : config.bindables; - var currentProps = resource.properties; - if (Array.isArray(_bindables)) { - for (var i = 0, ii = _bindables.length; ii > i; ++i) { - var prop = _bindables[i]; - if (!prop || typeof prop !== 'string' && !prop.name) { - throw new Error('Invalid bindable property at "' + i + '" for class "' + target.name + '". Expected either a string or an object with "name" property.'); - } - var newProp = new BindableProperty(prop); - - var existed = false; - for (var j = 0, jj = currentProps.length; jj > j; ++j) { - if (currentProps[j].name === newProp.name) { - existed = true; + }; + View.prototype.insertNodesBefore = function (refNode) { + refNode.parentNode.insertBefore(this.fragment, refNode); + }; + View.prototype.appendNodesTo = function (parent) { + parent.appendChild(this.fragment); + }; + View.prototype.removeNodes = function () { + var fragment = this.fragment; + var current = this.firstChild; + var end = this.lastChild; + var next; + while (current) { + next = current.nextSibling; + fragment.appendChild(current); + if (current === end) { break; - } - } - if (existed) { - continue; } - newProp.registerWith(target, resource); - } + current = next; } - } - } - return resource; - }; - - function ViewResources(parent, viewUrl) { - - - this.bindingLanguage = null; - - this.parent = parent || null; - this.hasParent = this.parent !== null; - this.viewUrl = viewUrl || ''; - this.lookupFunctions = { - valueConverters: this.getValueConverter.bind(this), - bindingBehaviors: this.getBindingBehavior.bind(this) - }; - this.attributes = Object.create(null); - this.elements = Object.create(null); - this.valueConverters = Object.create(null); - this.bindingBehaviors = Object.create(null); - this.attributeMap = Object.create(null); - this.values = Object.create(null); - this.beforeCompile = this.afterCompile = this.beforeCreate = this.afterCreate = this.beforeBind = this.beforeUnbind = false; - } - - ViewResources.prototype._tryAddHook = function _tryAddHook(obj, name) { - if (typeof obj[name] === 'function') { - var func = obj[name].bind(obj); - var counter = 1; - var callbackName = void 0; - - while (this[callbackName = name + counter.toString()] !== undefined) { - counter++; - } - - this[name] = true; - this[callbackName] = func; - } - }; - - ViewResources.prototype._invokeHook = function _invokeHook(name, one, two, three, four) { - if (this.hasParent) { - this.parent._invokeHook(name, one, two, three, four); - } - - if (this[name]) { - this[name + '1'](one, two, three, four); - - var callbackName = name + '2'; - if (this[callbackName]) { - this[callbackName](one, two, three, four); - - callbackName = name + '3'; - if (this[callbackName]) { - this[callbackName](one, two, three, four); - - var counter = 4; - - while (this[callbackName = name + counter.toString()] !== undefined) { - this[callbackName](one, two, three, four); - counter++; - } + }; + View.prototype.attached = function () { + var controllers; + var children; + var i; + var ii; + if (this.isAttached) { + return; } - } - } - }; - - ViewResources.prototype.registerViewEngineHooks = function registerViewEngineHooks(hooks) { - this._tryAddHook(hooks, 'beforeCompile'); - this._tryAddHook(hooks, 'afterCompile'); - this._tryAddHook(hooks, 'beforeCreate'); - this._tryAddHook(hooks, 'afterCreate'); - this._tryAddHook(hooks, 'beforeBind'); - this._tryAddHook(hooks, 'beforeUnbind'); - }; - - ViewResources.prototype.getBindingLanguage = function getBindingLanguage(bindingLanguageFallback) { - return this.bindingLanguage || (this.bindingLanguage = bindingLanguageFallback); - }; - - ViewResources.prototype.patchInParent = function patchInParent(newParent) { - var originalParent = this.parent; - - this.parent = newParent || null; - this.hasParent = this.parent !== null; - - if (newParent.parent === null) { - newParent.parent = originalParent; - newParent.hasParent = originalParent !== null; - } - }; - - ViewResources.prototype.relativeToView = function relativeToView(path) { - return (0, _aureliaPath.relativeToFile)(path, this.viewUrl); - }; - - ViewResources.prototype.registerElement = function registerElement(tagName, behavior) { - register(this.elements, tagName, behavior, 'an Element'); - }; - - ViewResources.prototype.getElement = function getElement(tagName) { - return this.elements[tagName] || (this.hasParent ? this.parent.getElement(tagName) : null); - }; - - ViewResources.prototype.mapAttribute = function mapAttribute(attribute) { - return this.attributeMap[attribute] || (this.hasParent ? this.parent.mapAttribute(attribute) : null); - }; - - ViewResources.prototype.registerAttribute = function registerAttribute(attribute, behavior, knownAttribute) { - this.attributeMap[attribute] = knownAttribute; - register(this.attributes, attribute, behavior, 'an Attribute'); - }; - - ViewResources.prototype.getAttribute = function getAttribute(attribute) { - return this.attributes[attribute] || (this.hasParent ? this.parent.getAttribute(attribute) : null); - }; - - ViewResources.prototype.registerValueConverter = function registerValueConverter(name, valueConverter) { - register(this.valueConverters, name, valueConverter, 'a ValueConverter'); - }; - - ViewResources.prototype.getValueConverter = function getValueConverter(name) { - return this.valueConverters[name] || (this.hasParent ? this.parent.getValueConverter(name) : null); - }; - - ViewResources.prototype.registerBindingBehavior = function registerBindingBehavior(name, bindingBehavior) { - register(this.bindingBehaviors, name, bindingBehavior, 'a BindingBehavior'); - }; - - ViewResources.prototype.getBindingBehavior = function getBindingBehavior(name) { - return this.bindingBehaviors[name] || (this.hasParent ? this.parent.getBindingBehavior(name) : null); - }; - - ViewResources.prototype.registerValue = function registerValue(name, value) { - register(this.values, name, value, 'a value'); - }; - - ViewResources.prototype.getValue = function getValue(name) { - return this.values[name] || (this.hasParent ? this.parent.getValue(name) : null); - }; - - ViewResources.prototype.autoRegister = function autoRegister(container, impl) { - var resourceTypeMeta = _aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.resource, impl); - if (resourceTypeMeta) { - if (resourceTypeMeta instanceof HtmlBehaviorResource) { - ViewResources.convention(impl, resourceTypeMeta); - - if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) { - HtmlBehaviorResource.convention(impl.name, resourceTypeMeta); + this.isAttached = true; + if (this.controller !== null) { + this.controller.attached(); } - if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) { - resourceTypeMeta.elementName = _hyphenate(impl.name); + controllers = this.controllers; + for (i = 0, ii = controllers.length; i < ii; ++i) { + controllers[i].attached(); } - } - } else { - resourceTypeMeta = ViewResources.convention(impl) || HtmlBehaviorResource.convention(impl.name) || _aureliaBinding.ValueConverterResource.convention(impl.name) || _aureliaBinding.BindingBehaviorResource.convention(impl.name) || ViewEngineHooksResource.convention(impl.name); - if (!resourceTypeMeta) { - resourceTypeMeta = new HtmlBehaviorResource(); - resourceTypeMeta.elementName = _hyphenate(impl.name); - } - _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, resourceTypeMeta, impl); - } - resourceTypeMeta.initialize(container, impl); - resourceTypeMeta.register(this); - return resourceTypeMeta; - }; - - return ViewResources; -}(); - -var View = exports.View = function () { - function View(container, viewFactory, fragment, controllers, bindings, children, slots) { - - - this.container = container; - this.viewFactory = viewFactory; - this.resources = viewFactory.resources; - this.fragment = fragment; - this.firstChild = fragment.firstChild; - this.lastChild = fragment.lastChild; - this.controllers = controllers; - this.bindings = bindings; - this.children = children; - this.slots = slots; - this.hasSlots = false; - this.fromCache = false; - this.isBound = false; - this.isAttached = false; - this.bindingContext = null; - this.overrideContext = null; - this.controller = null; - this.viewModelScope = null; - this.animatableElement = undefined; - this._isUserControlled = false; - this.contentView = null; - - for (var _key3 in slots) { - this.hasSlots = true; - break; - } - } - - View.prototype.returnToCache = function returnToCache() { - this.viewFactory.returnViewToCache(this); - }; - - View.prototype.created = function created() { - var i = void 0; - var ii = void 0; - var controllers = this.controllers; - - for (i = 0, ii = controllers.length; i < ii; ++i) { - controllers[i].created(this); - } - }; - - View.prototype.bind = function bind(bindingContext, overrideContext, _systemUpdate) { - var controllers = void 0; - var bindings = void 0; - var children = void 0; - var i = void 0; - var ii = void 0; - - if (_systemUpdate && this._isUserControlled) { - return; - } - - if (this.isBound) { - if (this.bindingContext === bindingContext) { - return; - } - - this.unbind(); - } - - this.isBound = true; - this.bindingContext = bindingContext; - this.overrideContext = overrideContext || (0, _aureliaBinding.createOverrideContext)(bindingContext); - - this.resources._invokeHook('beforeBind', this); - - bindings = this.bindings; - for (i = 0, ii = bindings.length; i < ii; ++i) { - bindings[i].bind(this); - } - - if (this.viewModelScope !== null) { - bindingContext.bind(this.viewModelScope.bindingContext, this.viewModelScope.overrideContext); - this.viewModelScope = null; - } - - controllers = this.controllers; - for (i = 0, ii = controllers.length; i < ii; ++i) { - controllers[i].bind(this); - } - - children = this.children; - for (i = 0, ii = children.length; i < ii; ++i) { - children[i].bind(bindingContext, overrideContext, true); - } - - if (this.hasSlots) { - ShadowDOM.distributeView(this.contentView, this.slots); - } - }; - - View.prototype.addBinding = function addBinding(binding) { - this.bindings.push(binding); - - if (this.isBound) { - binding.bind(this); - } - }; - - View.prototype.unbind = function unbind() { - var controllers = void 0; - var bindings = void 0; - var children = void 0; - var i = void 0; - var ii = void 0; - - if (this.isBound) { - this.isBound = false; - this.resources._invokeHook('beforeUnbind', this); - - if (this.controller !== null) { - this.controller.unbind(); - } - - bindings = this.bindings; - for (i = 0, ii = bindings.length; i < ii; ++i) { - bindings[i].unbind(); - } - - controllers = this.controllers; - for (i = 0, ii = controllers.length; i < ii; ++i) { - controllers[i].unbind(); - } - - children = this.children; - for (i = 0, ii = children.length; i < ii; ++i) { - children[i].unbind(); - } - - this.bindingContext = null; - this.overrideContext = null; - } - }; - - View.prototype.insertNodesBefore = function insertNodesBefore(refNode) { - refNode.parentNode.insertBefore(this.fragment, refNode); - }; - - View.prototype.appendNodesTo = function appendNodesTo(parent) { - parent.appendChild(this.fragment); - }; - - View.prototype.removeNodes = function removeNodes() { - var fragment = this.fragment; - var current = this.firstChild; - var end = this.lastChild; - var next = void 0; - - while (current) { - next = current.nextSibling; - fragment.appendChild(current); - - if (current === end) { - break; - } - - current = next; - } - }; - - View.prototype.attached = function attached() { - var controllers = void 0; - var children = void 0; - var i = void 0; - var ii = void 0; - - if (this.isAttached) { - return; - } - - this.isAttached = true; + children = this.children; + for (i = 0, ii = children.length; i < ii; ++i) { + children[i].attached(); + } + }; + View.prototype.detached = function () { + var controllers; + var children; + var i; + var ii; + if (this.isAttached) { + this.isAttached = false; + if (this.controller !== null) { + this.controller.detached(); + } + controllers = this.controllers; + for (i = 0, ii = controllers.length; i < ii; ++i) { + controllers[i].detached(); + } + children = this.children; + for (i = 0, ii = children.length; i < ii; ++i) { + children[i].detached(); + } + } + }; + return View; +}()); - if (this.controller !== null) { - this.controller.attached(); +var Animator = (function () { + function Animator() { } + Animator.prototype.enter = function (element) { + return Promise.resolve(false); + }; + Animator.prototype.leave = function (element) { + return Promise.resolve(false); + }; + Animator.prototype.removeClass = function (element, className) { + element.classList.remove(className); + return Promise.resolve(false); + }; + Animator.prototype.addClass = function (element, className) { + element.classList.add(className); + return Promise.resolve(false); + }; + Animator.prototype.animate = function (element, className) { + return Promise.resolve(false); + }; + Animator.prototype.runSequence = function (animations) { + return Promise.resolve(false); + }; + Animator.prototype.registerEffect = function (effectName, properties) { }; + Animator.prototype.unregisterEffect = function (effectName) { }; + return Animator; +}()); - controllers = this.controllers; - for (i = 0, ii = controllers.length; i < ii; ++i) { - controllers[i].attached(); +function getAnimatableElement(view) { + if (view.animatableElement !== undefined) { + return view.animatableElement; } - - children = this.children; - for (i = 0, ii = children.length; i < ii; ++i) { - children[i].attached(); + var current = view.firstChild; + while (current && current.nodeType !== 1) { + current = current.nextSibling; } - }; - - View.prototype.detached = function detached() { - var controllers = void 0; - var children = void 0; - var i = void 0; - var ii = void 0; - - if (this.isAttached) { - this.isAttached = false; - - if (this.controller !== null) { - this.controller.detached(); - } - - controllers = this.controllers; - for (i = 0, ii = controllers.length; i < ii; ++i) { - controllers[i].detached(); - } - - children = this.children; - for (i = 0, ii = children.length; i < ii; ++i) { - children[i].detached(); - } + if (current && current.nodeType === 1) { + return (view.animatableElement = current.classList.contains('au-animate') ? current : null); } - }; - - return View; -}(); - -function getAnimatableElement(view) { - if (view.animatableElement !== undefined) { - return view.animatableElement; - } - - var current = view.firstChild; - - while (current && current.nodeType !== 1) { - current = current.nextSibling; - } - - if (current && current.nodeType === 1) { - return view.animatableElement = current.classList.contains('au-animate') ? current : null; - } - - return view.animatableElement = null; + return (view.animatableElement = null); } - -var ViewSlot = exports.ViewSlot = function () { - function ViewSlot(anchor, anchorIsContainer) { - var animator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Animator.instance; - - - - this.anchor = anchor; - this.anchorIsContainer = anchorIsContainer; - this.bindingContext = null; - this.overrideContext = null; - this.animator = animator; - this.children = []; - this.isBound = false; - this.isAttached = false; - this.contentSelectors = null; - anchor.viewSlot = this; - anchor.isContentProjectionSource = false; - } - - ViewSlot.prototype.animateView = function animateView(view) { - var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'enter'; - - var animatableElement = getAnimatableElement(view); - - if (animatableElement !== null) { - switch (direction) { - case 'enter': - return this.animator.enter(animatableElement); - case 'leave': - return this.animator.leave(animatableElement); - default: - throw new Error('Invalid animation direction: ' + direction); - } - } - }; - - ViewSlot.prototype.transformChildNodesIntoView = function transformChildNodesIntoView() { - var parent = this.anchor; - - this.children.push({ - fragment: parent, - firstChild: parent.firstChild, - lastChild: parent.lastChild, - returnToCache: function returnToCache() {}, - removeNodes: function removeNodes() { - var last = void 0; - - while (last = parent.lastChild) { - parent.removeChild(last); +var ViewSlot = (function () { + function ViewSlot(anchor, anchorIsContainer, animator) { + if (animator === void 0) { animator = Animator.instance; } + this.anchor = anchor; + this.anchorIsContainer = anchorIsContainer; + this.bindingContext = null; + this.overrideContext = null; + this.animator = animator; + this.children = []; + this.isBound = false; + this.isAttached = false; + this.contentSelectors = null; + anchor.viewSlot = this; + anchor.isContentProjectionSource = false; + } + ViewSlot.prototype.animateView = function (view, direction) { + if (direction === void 0) { direction = 'enter'; } + var animatableElement = getAnimatableElement(view); + if (animatableElement !== null) { + switch (direction) { + case 'enter': + return this.animator.enter(animatableElement); + case 'leave': + return this.animator.leave(animatableElement); + default: + throw new Error('Invalid animation direction: ' + direction); + } } - }, - created: function created() {}, - bind: function bind() {}, - unbind: function unbind() {}, - attached: function attached() {}, - detached: function detached() {} - }); - }; - - ViewSlot.prototype.bind = function bind(bindingContext, overrideContext) { - var i = void 0; - var ii = void 0; - var children = void 0; - - if (this.isBound) { - if (this.bindingContext === bindingContext) { - return; - } - - this.unbind(); - } - - this.isBound = true; - this.bindingContext = bindingContext = bindingContext || this.bindingContext; - this.overrideContext = overrideContext = overrideContext || this.overrideContext; - - children = this.children; - for (i = 0, ii = children.length; i < ii; ++i) { - children[i].bind(bindingContext, overrideContext, true); - } - }; - - ViewSlot.prototype.unbind = function unbind() { - if (this.isBound) { - var i = void 0; - var ii = void 0; - var _children4 = this.children; - - this.isBound = false; - this.bindingContext = null; - this.overrideContext = null; - - for (i = 0, ii = _children4.length; i < ii; ++i) { - _children4[i].unbind(); - } - } - }; - - ViewSlot.prototype.add = function add(view) { - if (this.anchorIsContainer) { - view.appendNodesTo(this.anchor); - } else { - view.insertNodesBefore(this.anchor); - } - - this.children.push(view); - - if (this.isAttached) { - view.attached(); - return this.animateView(view, 'enter'); - } - }; - - ViewSlot.prototype.insert = function insert(index, view) { - var children = this.children; - var length = children.length; - - if (index === 0 && length === 0 || index >= length) { - return this.add(view); - } - - view.insertNodesBefore(children[index].firstChild); - children.splice(index, 0, view); - - if (this.isAttached) { - view.attached(); - return this.animateView(view, 'enter'); - } - }; - - ViewSlot.prototype.move = function move(sourceIndex, targetIndex) { - if (sourceIndex === targetIndex) { - return; - } - - var children = this.children; - var view = children[sourceIndex]; - - view.removeNodes(); - view.insertNodesBefore(children[targetIndex].firstChild); - children.splice(sourceIndex, 1); - children.splice(targetIndex, 0, view); - }; - - ViewSlot.prototype.remove = function remove(view, returnToCache, skipAnimation) { - return this.removeAt(this.children.indexOf(view), returnToCache, skipAnimation); - }; - - ViewSlot.prototype.removeMany = function removeMany(viewsToRemove, returnToCache, skipAnimation) { - var _this3 = this; - - var children = this.children; - var ii = viewsToRemove.length; - var i = void 0; - var rmPromises = []; - - viewsToRemove.forEach(function (child) { - if (skipAnimation) { - child.removeNodes(); - return; - } - - var animation = _this3.animateView(child, 'leave'); - if (animation) { - rmPromises.push(animation.then(function () { - return child.removeNodes(); - })); - } else { - child.removeNodes(); - } - }); - - var removeAction = function removeAction() { - if (_this3.isAttached) { - for (i = 0; i < ii; ++i) { - viewsToRemove[i].detached(); + }; + ViewSlot.prototype.transformChildNodesIntoView = function () { + var parent = this.anchor; + this.children.push({ + fragment: parent, + firstChild: parent.firstChild, + lastChild: parent.lastChild, + returnToCache: function () { }, + removeNodes: function () { + var last; + while (last = parent.lastChild) { + parent.removeChild(last); + } + }, + created: function () { }, + bind: function () { }, + unbind: function () { }, + attached: function () { }, + detached: function () { } + }); + }; + ViewSlot.prototype.bind = function (bindingContext, overrideContext) { + var i; + var ii; + var children; + if (this.isBound) { + if (this.bindingContext === bindingContext) { + return; + } + this.unbind(); } - } - - if (returnToCache) { - for (i = 0; i < ii; ++i) { - viewsToRemove[i].returnToCache(); + this.isBound = true; + this.bindingContext = bindingContext = bindingContext || this.bindingContext; + this.overrideContext = overrideContext = overrideContext || this.overrideContext; + children = this.children; + for (i = 0, ii = children.length; i < ii; ++i) { + children[i].bind(bindingContext, overrideContext, true); } - } - - for (i = 0; i < ii; ++i) { - var index = children.indexOf(viewsToRemove[i]); - if (index >= 0) { - children.splice(index, 1); + }; + ViewSlot.prototype.unbind = function () { + if (this.isBound) { + var i = void 0; + var ii = void 0; + var children = this.children; + this.isBound = false; + this.bindingContext = null; + this.overrideContext = null; + for (i = 0, ii = children.length; i < ii; ++i) { + children[i].unbind(); + } } - } }; - - if (rmPromises.length > 0) { - return Promise.all(rmPromises).then(function () { - return removeAction(); - }); - } - - return removeAction(); - }; - - ViewSlot.prototype.removeAt = function removeAt(index, returnToCache, skipAnimation) { - var _this4 = this; - - var view = this.children[index]; - - var removeAction = function removeAction() { - index = _this4.children.indexOf(view); - view.removeNodes(); - _this4.children.splice(index, 1); - - if (_this4.isAttached) { - view.detached(); - } - - if (returnToCache) { - view.returnToCache(); - } - - return view; + ViewSlot.prototype.add = function (view) { + if (this.anchorIsContainer) { + view.appendNodesTo(this.anchor); + } + else { + view.insertNodesBefore(this.anchor); + } + this.children.push(view); + if (this.isAttached) { + view.attached(); + return this.animateView(view, 'enter'); + } }; - - if (!skipAnimation) { - var animation = this.animateView(view, 'leave'); - if (animation) { - return animation.then(function () { - return removeAction(); + ViewSlot.prototype.insert = function (index, view) { + var children = this.children; + var length = children.length; + if ((index === 0 && length === 0) || index >= length) { + return this.add(view); + } + view.insertNodesBefore(children[index].firstChild); + children.splice(index, 0, view); + if (this.isAttached) { + view.attached(); + return this.animateView(view, 'enter'); + } + }; + ViewSlot.prototype.move = function (sourceIndex, targetIndex) { + if (sourceIndex === targetIndex) { + return; + } + var children = this.children; + var view = children[sourceIndex]; + view.removeNodes(); + view.insertNodesBefore(children[targetIndex].firstChild); + children.splice(sourceIndex, 1); + children.splice(targetIndex, 0, view); + }; + ViewSlot.prototype.remove = function (view, returnToCache, skipAnimation) { + return this.removeAt(this.children.indexOf(view), returnToCache, skipAnimation); + }; + ViewSlot.prototype.removeMany = function (viewsToRemove, returnToCache, skipAnimation) { + var _this = this; + var children = this.children; + var ii = viewsToRemove.length; + var i; + var rmPromises = []; + viewsToRemove.forEach(function (child) { + if (skipAnimation) { + child.removeNodes(); + return; + } + var animation = _this.animateView(child, 'leave'); + if (animation) { + rmPromises.push(animation.then(function () { return child.removeNodes(); })); + } + else { + child.removeNodes(); + } }); - } - } - - return removeAction(); - }; - - ViewSlot.prototype.removeAll = function removeAll(returnToCache, skipAnimation) { - var _this5 = this; - - var children = this.children; - var ii = children.length; - var i = void 0; - var rmPromises = []; - - children.forEach(function (child) { - if (skipAnimation) { - child.removeNodes(); - return; - } - - var animation = _this5.animateView(child, 'leave'); - if (animation) { - rmPromises.push(animation.then(function () { - return child.removeNodes(); - })); - } else { - child.removeNodes(); - } - }); - - var removeAction = function removeAction() { - if (_this5.isAttached) { - for (i = 0; i < ii; ++i) { - children[i].detached(); + var removeAction = function () { + if (_this.isAttached) { + for (i = 0; i < ii; ++i) { + viewsToRemove[i].detached(); + } + } + if (returnToCache) { + for (i = 0; i < ii; ++i) { + viewsToRemove[i].returnToCache(); + } + } + for (i = 0; i < ii; ++i) { + var index = children.indexOf(viewsToRemove[i]); + if (index >= 0) { + children.splice(index, 1); + } + } + }; + if (rmPromises.length > 0) { + return Promise.all(rmPromises).then(function () { return removeAction(); }); } - } - - if (returnToCache) { - for (i = 0; i < ii; ++i) { - var _child3 = children[i]; - - if (_child3) { - _child3.returnToCache(); - } + return removeAction(); + }; + ViewSlot.prototype.removeAt = function (index, returnToCache, skipAnimation) { + var _this = this; + var view = this.children[index]; + var removeAction = function () { + index = _this.children.indexOf(view); + view.removeNodes(); + _this.children.splice(index, 1); + if (_this.isAttached) { + view.detached(); + } + if (returnToCache) { + view.returnToCache(); + } + return view; + }; + if (!skipAnimation) { + var animation = this.animateView(view, 'leave'); + if (animation) { + return animation.then(function () { return removeAction(); }); + } } - } - - _this5.children = []; + return removeAction(); }; - - if (rmPromises.length > 0) { - return Promise.all(rmPromises).then(function () { + ViewSlot.prototype.removeAll = function (returnToCache, skipAnimation) { + var _this = this; + var children = this.children; + var ii = children.length; + var i; + var rmPromises = []; + children.forEach(function (child) { + if (skipAnimation) { + child.removeNodes(); + return; + } + var animation = _this.animateView(child, 'leave'); + if (animation) { + rmPromises.push(animation.then(function () { return child.removeNodes(); })); + } + else { + child.removeNodes(); + } + }); + var removeAction = function () { + if (_this.isAttached) { + for (i = 0; i < ii; ++i) { + children[i].detached(); + } + } + if (returnToCache) { + for (i = 0; i < ii; ++i) { + var child = children[i]; + if (child) { + child.returnToCache(); + } + } + } + _this.children = []; + }; + if (rmPromises.length > 0) { + return Promise.all(rmPromises).then(function () { return removeAction(); }); + } return removeAction(); - }); - } - - return removeAction(); - }; - - ViewSlot.prototype.attached = function attached() { - var i = void 0; - var ii = void 0; - var children = void 0; - var child = void 0; - - if (this.isAttached) { - return; - } - - this.isAttached = true; - - children = this.children; - for (i = 0, ii = children.length; i < ii; ++i) { - child = children[i]; - child.attached(); - this.animateView(child, 'enter'); - } - }; - - ViewSlot.prototype.detached = function detached() { - var i = void 0; - var ii = void 0; - var children = void 0; - - if (this.isAttached) { - this.isAttached = false; - children = this.children; - for (i = 0, ii = children.length; i < ii; ++i) { - children[i].detached(); - } - } - }; - - ViewSlot.prototype.projectTo = function projectTo(slots) { - var _this6 = this; - - this.projectToSlots = slots; - this.add = this._projectionAdd; - this.insert = this._projectionInsert; - this.move = this._projectionMove; - this.remove = this._projectionRemove; - this.removeAt = this._projectionRemoveAt; - this.removeMany = this._projectionRemoveMany; - this.removeAll = this._projectionRemoveAll; - this.children.forEach(function (view) { - return ShadowDOM.distributeView(view, slots, _this6); - }); - }; - - ViewSlot.prototype._projectionAdd = function _projectionAdd(view) { - ShadowDOM.distributeView(view, this.projectToSlots, this); - - this.children.push(view); - - if (this.isAttached) { - view.attached(); - } - }; - - ViewSlot.prototype._projectionInsert = function _projectionInsert(index, view) { - if (index === 0 && !this.children.length || index >= this.children.length) { - this.add(view); - } else { - ShadowDOM.distributeView(view, this.projectToSlots, this, index); - - this.children.splice(index, 0, view); - - if (this.isAttached) { - view.attached(); - } - } - }; - - ViewSlot.prototype._projectionMove = function _projectionMove(sourceIndex, targetIndex) { - if (sourceIndex === targetIndex) { - return; - } - - var children = this.children; - var view = children[sourceIndex]; - - ShadowDOM.undistributeView(view, this.projectToSlots, this); - ShadowDOM.distributeView(view, this.projectToSlots, this, targetIndex); - - children.splice(sourceIndex, 1); - children.splice(targetIndex, 0, view); - }; - - ViewSlot.prototype._projectionRemove = function _projectionRemove(view, returnToCache) { - ShadowDOM.undistributeView(view, this.projectToSlots, this); - this.children.splice(this.children.indexOf(view), 1); + }; + ViewSlot.prototype.attached = function () { + var i; + var ii; + var children; + var child; + if (this.isAttached) { + return; + } + this.isAttached = true; + children = this.children; + for (i = 0, ii = children.length; i < ii; ++i) { + child = children[i]; + child.attached(); + this.animateView(child, 'enter'); + } + }; + ViewSlot.prototype.detached = function () { + var i; + var ii; + var children; + if (this.isAttached) { + this.isAttached = false; + children = this.children; + for (i = 0, ii = children.length; i < ii; ++i) { + children[i].detached(); + } + } + }; + ViewSlot.prototype.projectTo = function (slots) { + var _this = this; + this.projectToSlots = slots; + this.add = this._projectionAdd; + this.insert = this._projectionInsert; + this.move = this._projectionMove; + this.remove = this._projectionRemove; + this.removeAt = this._projectionRemoveAt; + this.removeMany = this._projectionRemoveMany; + this.removeAll = this._projectionRemoveAll; + this.children.forEach(function (view) { return ShadowDOM.distributeView(view, slots, _this); }); + }; + ViewSlot.prototype._projectionAdd = function (view) { + ShadowDOM.distributeView(view, this.projectToSlots, this); + this.children.push(view); + if (this.isAttached) { + view.attached(); + } + }; + ViewSlot.prototype._projectionInsert = function (index, view) { + if ((index === 0 && !this.children.length) || index >= this.children.length) { + this.add(view); + } + else { + ShadowDOM.distributeView(view, this.projectToSlots, this, index); + this.children.splice(index, 0, view); + if (this.isAttached) { + view.attached(); + } + } + }; + ViewSlot.prototype._projectionMove = function (sourceIndex, targetIndex) { + if (sourceIndex === targetIndex) { + return; + } + var children = this.children; + var view = children[sourceIndex]; + ShadowDOM.undistributeView(view, this.projectToSlots, this); + ShadowDOM.distributeView(view, this.projectToSlots, this, targetIndex); + children.splice(sourceIndex, 1); + children.splice(targetIndex, 0, view); + }; + ViewSlot.prototype._projectionRemove = function (view, returnToCache) { + ShadowDOM.undistributeView(view, this.projectToSlots, this); + this.children.splice(this.children.indexOf(view), 1); + if (this.isAttached) { + view.detached(); + } + if (returnToCache) { + view.returnToCache(); + } + }; + ViewSlot.prototype._projectionRemoveAt = function (index, returnToCache) { + var view = this.children[index]; + ShadowDOM.undistributeView(view, this.projectToSlots, this); + this.children.splice(index, 1); + if (this.isAttached) { + view.detached(); + } + if (returnToCache) { + view.returnToCache(); + } + }; + ViewSlot.prototype._projectionRemoveMany = function (viewsToRemove, returnToCache) { + var _this = this; + viewsToRemove.forEach(function (view) { return _this.remove(view, returnToCache); }); + }; + ViewSlot.prototype._projectionRemoveAll = function (returnToCache) { + ShadowDOM.undistributeAll(this.projectToSlots, this); + var children = this.children; + var ii = children.length; + for (var i = 0; i < ii; ++i) { + if (returnToCache) { + children[i].returnToCache(); + } + else if (this.isAttached) { + children[i].detached(); + } + } + this.children = []; + }; + return ViewSlot; +}()); - if (this.isAttached) { - view.detached(); +var $resolver = aureliaDependencyInjection.resolver; +var ProviderResolver = (function () { + function ProviderResolver() { } - if (returnToCache) { - view.returnToCache(); + ProviderResolver.prototype.get = function (container, key) { + var id = key.__providerId__; + return id in container ? container[id] : (container[id] = container.invoke(key)); + }; + ProviderResolver = __decorate([ + $resolver + ], ProviderResolver); + return ProviderResolver; +}()); +var providerResolverInstance = new ProviderResolver(); +function elementContainerGet(key) { + if (key === aureliaPal.DOM.Element) { + return this.element; } - }; - - ViewSlot.prototype._projectionRemoveAt = function _projectionRemoveAt(index, returnToCache) { - var view = this.children[index]; - - ShadowDOM.undistributeView(view, this.projectToSlots, this); - this.children.splice(index, 1); - - if (this.isAttached) { - view.detached(); + if (key === BoundViewFactory) { + if (this.boundViewFactory) { + return this.boundViewFactory; + } + var factory = this.instruction.viewFactory; + var partReplacements = this.partReplacements; + if (partReplacements) { + factory = partReplacements[factory.part] || factory; + } + this.boundViewFactory = new BoundViewFactory(this, factory, partReplacements); + return this.boundViewFactory; } - if (returnToCache) { - view.returnToCache(); + if (key === ViewSlot) { + if (this.viewSlot === undefined) { + this.viewSlot = new ViewSlot(this.element, this.instruction.anchorIsContainer); + this.element.isContentProjectionSource = this.instruction.lifting; + this.children.push(this.viewSlot); + } + return this.viewSlot; } - }; - - ViewSlot.prototype._projectionRemoveMany = function _projectionRemoveMany(viewsToRemove, returnToCache) { - var _this7 = this; - - viewsToRemove.forEach(function (view) { - return _this7.remove(view, returnToCache); - }); - }; - - ViewSlot.prototype._projectionRemoveAll = function _projectionRemoveAll(returnToCache) { - ShadowDOM.undistributeAll(this.projectToSlots, this); - - var children = this.children; - var ii = children.length; - - for (var i = 0; i < ii; ++i) { - if (returnToCache) { - children[i].returnToCache(); - } else if (this.isAttached) { - children[i].detached(); - } + if (key === ElementEvents) { + return this.elementEvents || (this.elementEvents = new ElementEvents(this.element)); } - - this.children = []; - }; - - return ViewSlot; -}(); - -var ProviderResolver = (0, _aureliaDependencyInjection.resolver)(_class12 = function () { - function ProviderResolver() { - - } - - ProviderResolver.prototype.get = function get(container, key) { - var id = key.__providerId__; - return id in container ? container[id] : container[id] = container.invoke(key); - }; - - return ProviderResolver; -}()) || _class12; - -var providerResolverInstance = new ProviderResolver(); - -function elementContainerGet(key) { - if (key === _aureliaPal.DOM.Element) { - return this.element; - } - - if (key === BoundViewFactory) { - if (this.boundViewFactory) { - return this.boundViewFactory; + if (key === CompositionTransaction) { + return this.compositionTransaction || (this.compositionTransaction = this.parent.get(key)); } - - var factory = this.instruction.viewFactory; - var _partReplacements = this.partReplacements; - - if (_partReplacements) { - factory = _partReplacements[factory.part] || factory; + if (key === ViewResources) { + return this.viewResources; } - - this.boundViewFactory = new BoundViewFactory(this, factory, _partReplacements); - return this.boundViewFactory; - } - - if (key === ViewSlot) { - if (this.viewSlot === undefined) { - this.viewSlot = new ViewSlot(this.element, this.instruction.anchorIsContainer); - this.element.isContentProjectionSource = this.instruction.lifting; - this.children.push(this.viewSlot); + if (key === TargetInstruction) { + return this.instruction; } - - return this.viewSlot; - } - - if (key === ElementEvents) { - return this.elementEvents || (this.elementEvents = new ElementEvents(this.element)); - } - - if (key === CompositionTransaction) { - return this.compositionTransaction || (this.compositionTransaction = this.parent.get(key)); - } - - if (key === ViewResources) { - return this.viewResources; - } - - if (key === TargetInstruction) { - return this.instruction; - } - - return this.superGet(key); + return this.superGet(key); } - function createElementContainer(parent, element, instruction, children, partReplacements, resources) { - var container = parent.createChild(); - var providers = void 0; - var i = void 0; - - container.element = element; - container.instruction = instruction; - container.children = children; - container.viewResources = resources; - container.partReplacements = partReplacements; - - providers = instruction.providers; - i = providers.length; - - while (i--) { - container._resolvers.set(providers[i], providerResolverInstance); - } - - container.superGet = container.get; - container.get = elementContainerGet; - - return container; + var container = parent.createChild(); + var providers; + var i; + container.element = element; + container.instruction = instruction; + container.children = children; + container.viewResources = resources; + container.partReplacements = partReplacements; + providers = instruction.providers; + i = providers.length; + while (i--) { + container._resolvers.set(providers[i], providerResolverInstance); + } + container.superGet = container.get; + container.get = elementContainerGet; + return container; } - function hasAttribute(name) { - return this._element.hasAttribute(name); + return this._element.hasAttribute(name); } - function getAttribute(name) { - return this._element.getAttribute(name); + return this._element.getAttribute(name); } - function setAttribute(name, value) { - this._element.setAttribute(name, value); + this._element.setAttribute(name, value); } - function makeElementIntoAnchor(element, elementInstruction) { - var anchor = _aureliaPal.DOM.createComment('anchor'); - - if (elementInstruction) { - var firstChild = element.firstChild; - - if (firstChild && firstChild.tagName === 'AU-CONTENT') { - anchor.contentElement = firstChild; - } - - anchor._element = element; - - anchor.hasAttribute = hasAttribute; - anchor.getAttribute = getAttribute; - anchor.setAttribute = setAttribute; - } - - _aureliaPal.DOM.replaceNode(anchor, element); - - return anchor; + var anchor = aureliaPal.DOM.createComment('anchor'); + if (elementInstruction) { + var firstChild = element.firstChild; + if (firstChild && firstChild.tagName === 'AU-CONTENT') { + anchor.contentElement = firstChild; + } + anchor._element = element; + anchor.hasAttribute = hasAttribute; + anchor.getAttribute = getAttribute; + anchor.setAttribute = setAttribute; + } + aureliaPal.DOM.replaceNode(anchor, element); + return anchor; } - function applyInstructions(containers, element, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources) { - var behaviorInstructions = instruction.behaviorInstructions; - var expressions = instruction.expressions; - var elementContainer = void 0; - var i = void 0; - var ii = void 0; - var current = void 0; - var instance = void 0; - - if (instruction.contentExpression) { - bindings.push(instruction.contentExpression.createBinding(element.nextSibling)); - element.nextSibling.auInterpolationTarget = true; - element.parentNode.removeChild(element); - return; - } - - if (instruction.shadowSlot) { - var commentAnchor = _aureliaPal.DOM.createComment('slot'); - var slot = void 0; - - if (instruction.slotDestination) { - slot = new PassThroughSlot(commentAnchor, instruction.slotName, instruction.slotDestination, instruction.slotFallbackFactory); - } else { - slot = new ShadowSlot(commentAnchor, instruction.slotName, instruction.slotFallbackFactory); + var behaviorInstructions = instruction.behaviorInstructions; + var expressions = instruction.expressions; + var elementContainer; + var i; + var ii; + var current; + var instance; + if (instruction.contentExpression) { + bindings.push(instruction.contentExpression.createBinding(element.nextSibling)); + element.nextSibling.auInterpolationTarget = true; + element.parentNode.removeChild(element); + return; } - - _aureliaPal.DOM.replaceNode(commentAnchor, element); - shadowSlots[instruction.slotName] = slot; - controllers.push(slot); - return; - } - - if (instruction.letElement) { - for (i = 0, ii = expressions.length; i < ii; ++i) { - bindings.push(expressions[i].createBinding()); + if (instruction.shadowSlot) { + var commentAnchor = aureliaPal.DOM.createComment('slot'); + var slot = void 0; + if (instruction.slotDestination) { + slot = new PassThroughSlot(commentAnchor, instruction.slotName, instruction.slotDestination, instruction.slotFallbackFactory); + } + else { + slot = new ShadowSlot(commentAnchor, instruction.slotName, instruction.slotFallbackFactory); + } + aureliaPal.DOM.replaceNode(commentAnchor, element); + shadowSlots[instruction.slotName] = slot; + controllers.push(slot); + return; } - element.parentNode.removeChild(element); - return; - } - - if (behaviorInstructions.length) { - if (!instruction.anchorIsContainer) { - element = makeElementIntoAnchor(element, instruction.elementInstruction); + if (instruction.letElement) { + for (i = 0, ii = expressions.length; i < ii; ++i) { + bindings.push(expressions[i].createBinding()); + } + element.parentNode.removeChild(element); + return; } - - containers[instruction.injectorId] = elementContainer = createElementContainer(containers[instruction.parentInjectorId], element, instruction, children, partReplacements, resources); - - for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) { - current = behaviorInstructions[i]; - instance = current.type.create(elementContainer, current, element, bindings); - controllers.push(instance); + if (behaviorInstructions.length) { + if (!instruction.anchorIsContainer) { + element = makeElementIntoAnchor(element, instruction.elementInstruction); + } + containers[instruction.injectorId] = elementContainer = + createElementContainer(containers[instruction.parentInjectorId], element, instruction, children, partReplacements, resources); + for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) { + current = behaviorInstructions[i]; + instance = current.type.create(elementContainer, current, element, bindings); + controllers.push(instance); + } + } + for (i = 0, ii = expressions.length; i < ii; ++i) { + bindings.push(expressions[i].createBinding(element)); } - } - - for (i = 0, ii = expressions.length; i < ii; ++i) { - bindings.push(expressions[i].createBinding(element)); - } } - function styleStringToObject(style, target) { - var attributes = style.split(';'); - var firstIndexOfColon = void 0; - var i = void 0; - var current = void 0; - var key = void 0; - var value = void 0; - - target = target || {}; - - for (i = 0; i < attributes.length; i++) { - current = attributes[i]; - firstIndexOfColon = current.indexOf(':'); - key = current.substring(0, firstIndexOfColon).trim(); - value = current.substring(firstIndexOfColon + 1).trim(); - target[key] = value; - } - - return target; + var attributes = style.split(';'); + var firstIndexOfColon; + var i; + var current; + var key; + var value; + target = target || {}; + for (i = 0; i < attributes.length; i++) { + current = attributes[i]; + firstIndexOfColon = current.indexOf(':'); + key = current.substring(0, firstIndexOfColon).trim(); + value = current.substring(firstIndexOfColon + 1).trim(); + target[key] = value; + } + return target; } - function styleObjectToString(obj) { - var result = ''; - - for (var _key4 in obj) { - result += _key4 + ':' + obj[_key4] + ';'; - } - - return result; -} - -function applySurrogateInstruction(container, element, instruction, controllers, bindings, children) { - var behaviorInstructions = instruction.behaviorInstructions; - var expressions = instruction.expressions; - var providers = instruction.providers; - var values = instruction.values; - var i = void 0; - var ii = void 0; - var current = void 0; - var instance = void 0; - var currentAttributeValue = void 0; - - i = providers.length; - while (i--) { - container._resolvers.set(providers[i], providerResolverInstance); - } - - for (var _key5 in values) { - currentAttributeValue = element.getAttribute(_key5); - - if (currentAttributeValue) { - if (_key5 === 'class') { - element.setAttribute('class', currentAttributeValue + ' ' + values[_key5]); - } else if (_key5 === 'style') { - var styleObject = styleStringToObject(values[_key5]); - styleStringToObject(currentAttributeValue, styleObject); - element.setAttribute('style', styleObjectToString(styleObject)); - } - } else { - element.setAttribute(_key5, values[_key5]); - } - } - - if (behaviorInstructions.length) { - for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) { - current = behaviorInstructions[i]; - instance = current.type.create(container, current, element, bindings); - - if (instance.contentView) { - children.push(instance.contentView); - } - - controllers.push(instance); + var result = ''; + for (var key in obj) { + result += key + ':' + obj[key] + ';'; } - } - - for (i = 0, ii = expressions.length; i < ii; ++i) { - bindings.push(expressions[i].createBinding(element)); - } + return result; } - -var BoundViewFactory = exports.BoundViewFactory = function () { - function BoundViewFactory(parentContainer, viewFactory, partReplacements) { - - - this.parentContainer = parentContainer; - this.viewFactory = viewFactory; - this.factoryCreateInstruction = { partReplacements: partReplacements }; - } - - BoundViewFactory.prototype.create = function create() { - var view = this.viewFactory.create(this.parentContainer.createChild(), this.factoryCreateInstruction); - view._isUserControlled = true; - return view; - }; - - BoundViewFactory.prototype.setCacheSize = function setCacheSize(size, doNotOverrideIfAlreadySet) { - this.viewFactory.setCacheSize(size, doNotOverrideIfAlreadySet); - }; - - BoundViewFactory.prototype.getCachedView = function getCachedView() { - return this.viewFactory.getCachedView(); - }; - - BoundViewFactory.prototype.returnViewToCache = function returnViewToCache(view) { - this.viewFactory.returnViewToCache(view); - }; - - _createClass(BoundViewFactory, [{ - key: 'isCaching', - get: function get() { - return this.viewFactory.isCaching; - } - }]); - - return BoundViewFactory; -}(); - -var ViewFactory = exports.ViewFactory = function () { - function ViewFactory(template, instructions, resources) { - - - this.isCaching = false; - - this.template = template; - this.instructions = instructions; - this.resources = resources; - this.cacheSize = -1; - this.cache = null; - } - - ViewFactory.prototype.setCacheSize = function setCacheSize(size, doNotOverrideIfAlreadySet) { - if (size) { - if (size === '*') { - size = Number.MAX_VALUE; - } else if (typeof size === 'string') { - size = parseInt(size, 10); - } - } - - if (this.cacheSize === -1 || !doNotOverrideIfAlreadySet) { - this.cacheSize = size; - } - - if (this.cacheSize > 0) { - this.cache = []; - } else { - this.cache = null; - } - - this.isCaching = this.cacheSize > 0; - }; - - ViewFactory.prototype.getCachedView = function getCachedView() { - return this.cache !== null ? this.cache.pop() || null : null; - }; - - ViewFactory.prototype.returnViewToCache = function returnViewToCache(view) { - if (view.isAttached) { - view.detached(); - } - - if (view.isBound) { - view.unbind(); - } - - if (this.cache !== null && this.cache.length < this.cacheSize) { - view.fromCache = true; - this.cache.push(view); +function applySurrogateInstruction(container, element, instruction, controllers, bindings, children) { + var behaviorInstructions = instruction.behaviorInstructions; + var expressions = instruction.expressions; + var providers = instruction.providers; + var values = instruction.values; + var i; + var ii; + var current; + var instance; + var currentAttributeValue; + i = providers.length; + while (i--) { + container._resolvers.set(providers[i], providerResolverInstance); } - }; - - ViewFactory.prototype.create = function create(container, createInstruction, element) { - createInstruction = createInstruction || BehaviorInstruction.normal; - - var cachedView = this.getCachedView(); - if (cachedView !== null) { - return cachedView; + for (var key in values) { + currentAttributeValue = element.getAttribute(key); + if (currentAttributeValue) { + if (key === 'class') { + element.setAttribute('class', currentAttributeValue + ' ' + values[key]); + } + else if (key === 'style') { + var styleObject = styleStringToObject(values[key]); + styleStringToObject(currentAttributeValue, styleObject); + element.setAttribute('style', styleObjectToString(styleObject)); + } + } + else { + element.setAttribute(key, values[key]); + } } - - var fragment = createInstruction.enhance ? this.template : this.template.cloneNode(true); - var instructables = fragment.querySelectorAll('.au-target'); - var instructions = this.instructions; - var resources = this.resources; - var controllers = []; - var bindings = []; - var children = []; - var shadowSlots = Object.create(null); - var containers = { root: container }; - var partReplacements = createInstruction.partReplacements; - var i = void 0; - var ii = void 0; - var view = void 0; - var instructable = void 0; - var instruction = void 0; - - this.resources._invokeHook('beforeCreate', this, container, fragment, createInstruction); - - if (element && this.surrogateInstruction !== null) { - applySurrogateInstruction(container, element, this.surrogateInstruction, controllers, bindings, children); + if (behaviorInstructions.length) { + for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) { + current = behaviorInstructions[i]; + instance = current.type.create(container, current, element, bindings); + if (instance.contentView) { + children.push(instance.contentView); + } + controllers.push(instance); + } } - - if (createInstruction.enhance && fragment.hasAttribute('au-target-id')) { - instructable = fragment; - instruction = instructions[instructable.getAttribute('au-target-id')]; - applyInstructions(containers, instructable, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources); + for (i = 0, ii = expressions.length; i < ii; ++i) { + bindings.push(expressions[i].createBinding(element)); } - - for (i = 0, ii = instructables.length; i < ii; ++i) { - instructable = instructables[i]; - instruction = instructions[instructable.getAttribute('au-target-id')]; - applyInstructions(containers, instructable, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources); +} +var BoundViewFactory = (function () { + function BoundViewFactory(parentContainer, viewFactory, partReplacements) { + this.parentContainer = parentContainer; + this.viewFactory = viewFactory; + this.factoryCreateInstruction = { partReplacements: partReplacements }; } - - view = new View(container, this, fragment, controllers, bindings, children, shadowSlots); - - if (!createInstruction.initiatedByBehavior) { - view.created(); + BoundViewFactory.prototype.create = function () { + var view = this.viewFactory.create(this.parentContainer.createChild(), this.factoryCreateInstruction); + view._isUserControlled = true; + return view; + }; + Object.defineProperty(BoundViewFactory.prototype, "isCaching", { + get: function () { + return this.viewFactory.isCaching; + }, + enumerable: false, + configurable: true + }); + BoundViewFactory.prototype.setCacheSize = function (size, doNotOverrideIfAlreadySet) { + this.viewFactory.setCacheSize(size, doNotOverrideIfAlreadySet); + }; + BoundViewFactory.prototype.getCachedView = function () { + return this.viewFactory.getCachedView(); + }; + BoundViewFactory.prototype.returnViewToCache = function (view) { + this.viewFactory.returnViewToCache(view); + }; + return BoundViewFactory; +}()); +var ViewFactory = (function () { + function ViewFactory(template, instructions, resources) { + this.isCaching = false; + this.template = template; + this.instructions = instructions; + this.resources = resources; + this.cacheSize = -1; + this.cache = null; } - - this.resources._invokeHook('afterCreate', view); - - return view; - }; - - return ViewFactory; -}(); + ViewFactory.prototype.setCacheSize = function (size, doNotOverrideIfAlreadySet) { + if (size) { + if (size === '*') { + size = Number.MAX_VALUE; + } + else if (typeof size === 'string') { + size = parseInt(size, 10); + } + } + if (this.cacheSize === -1 || !doNotOverrideIfAlreadySet) { + this.cacheSize = Number(size); + } + if (this.cacheSize > 0) { + this.cache = []; + } + else { + this.cache = null; + } + this.isCaching = this.cacheSize > 0; + }; + ViewFactory.prototype.getCachedView = function () { + return this.cache !== null ? (this.cache.pop() || null) : null; + }; + ViewFactory.prototype.returnViewToCache = function (view) { + if (view.isAttached) { + view.detached(); + } + if (view.isBound) { + view.unbind(); + } + if (this.cache !== null && this.cache.length < this.cacheSize) { + view.fromCache = true; + this.cache.push(view); + } + }; + ViewFactory.prototype.create = function (container, createInstruction, element) { + createInstruction = createInstruction || BehaviorInstruction.normal; + var cachedView = this.getCachedView(); + if (cachedView !== null) { + return cachedView; + } + var fragment = createInstruction.enhance ? this.template : this.template.cloneNode(true); + var instructables = fragment.querySelectorAll('.au-target'); + var instructions = this.instructions; + var resources = this.resources; + var controllers = []; + var bindings = []; + var children = []; + var shadowSlots = Object.create(null); + var containers = { root: container }; + var partReplacements = createInstruction.partReplacements; + var i; + var ii; + var view; + var instructable; + var instruction; + this.resources._invokeHook('beforeCreate', this, container, fragment, createInstruction); + if (element && this.surrogateInstruction !== null) { + applySurrogateInstruction(container, element, this.surrogateInstruction, controllers, bindings, children); + } + if (createInstruction.enhance && fragment.hasAttribute('au-target-id')) { + instructable = fragment; + instruction = instructions[instructable.getAttribute('au-target-id')]; + applyInstructions(containers, instructable, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources); + } + for (i = 0, ii = instructables.length; i < ii; ++i) { + instructable = instructables[i]; + instruction = instructions[instructable.getAttribute('au-target-id')]; + applyInstructions(containers, instructable, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources); + } + view = new View(container, this, fragment, controllers, bindings, children, shadowSlots); + if (!createInstruction.initiatedByBehavior) { + view.created(); + } + this.resources._invokeHook('afterCreate', view); + return view; + }; + return ViewFactory; +}()); var nextInjectorId = 0; function getNextInjectorId() { - return ++nextInjectorId; + return ++nextInjectorId; } - var lastAUTargetID = 0; function getNextAUTargetID() { - return (++lastAUTargetID).toString(); + return (++lastAUTargetID).toString(); } - function makeIntoInstructionTarget(element) { - var value = element.getAttribute('class'); - var auTargetID = getNextAUTargetID(); - - element.setAttribute('class', value ? value + ' au-target' : 'au-target'); - element.setAttribute('au-target-id', auTargetID); - - return auTargetID; + var value = element.getAttribute('class'); + var auTargetID = getNextAUTargetID(); + element.setAttribute('class', (value ? value + ' au-target' : 'au-target')); + element.setAttribute('au-target-id', auTargetID); + return auTargetID; } - function makeShadowSlot(compiler, resources, node, instructions, parentInjectorId) { - var auShadowSlot = _aureliaPal.DOM.createElement('au-shadow-slot'); - _aureliaPal.DOM.replaceNode(auShadowSlot, node); - - var auTargetID = makeIntoInstructionTarget(auShadowSlot); - var instruction = TargetInstruction.shadowSlot(parentInjectorId); - - instruction.slotName = node.getAttribute('name') || ShadowDOM.defaultSlotKey; - instruction.slotDestination = node.getAttribute('slot'); - - if (node.innerHTML.trim()) { - var fragment = _aureliaPal.DOM.createDocumentFragment(); - var _child4 = void 0; - - while (_child4 = node.firstChild) { - fragment.appendChild(_child4); - } - - instruction.slotFallbackFactory = compiler.compile(fragment, resources); - } - - instructions[auTargetID] = instruction; - - return auShadowSlot; + var auShadowSlot = aureliaPal.DOM.createElement('au-shadow-slot'); + aureliaPal.DOM.replaceNode(auShadowSlot, node); + var auTargetID = makeIntoInstructionTarget(auShadowSlot); + var instruction = TargetInstruction.shadowSlot(parentInjectorId); + instruction.slotName = node.getAttribute('name') || ShadowDOM.defaultSlotKey; + instruction.slotDestination = node.getAttribute('slot'); + if (node.innerHTML.trim()) { + var fragment = aureliaPal.DOM.createDocumentFragment(); + var child = void 0; + while (child = node.firstChild) { + fragment.appendChild(child); + } + instruction.slotFallbackFactory = compiler.compile(fragment, resources); + } + instructions[auTargetID] = instruction; + return auShadowSlot; } - var defaultLetHandler = BindingLanguage.prototype.createLetExpressions; - -var ViewCompiler = exports.ViewCompiler = (_dec7 = (0, _aureliaDependencyInjection.inject)(BindingLanguage, ViewResources), _dec7(_class14 = function () { - function ViewCompiler(bindingLanguage, resources) { - - - this.bindingLanguage = bindingLanguage; - this.resources = resources; - } - - ViewCompiler.prototype.compile = function compile(source, resources, compileInstruction) { - resources = resources || this.resources; - compileInstruction = compileInstruction || ViewCompileInstruction.normal; - source = typeof source === 'string' ? _aureliaPal.DOM.createTemplateFromMarkup(source) : source; - - var content = void 0; - var part = void 0; - var cacheSize = void 0; - - if (source.content) { - part = source.getAttribute('part'); - cacheSize = source.getAttribute('view-cache'); - content = _aureliaPal.DOM.adoptNode(source.content); - } else { - content = source; +var ViewCompiler = (function () { + function ViewCompiler(bindingLanguage, resources) { + this.bindingLanguage = bindingLanguage; + this.resources = resources; } - - compileInstruction.targetShadowDOM = compileInstruction.targetShadowDOM && _aureliaPal.FEATURE.shadowDOM; - resources._invokeHook('beforeCompile', content, resources, compileInstruction); - - var instructions = {}; - this._compileNode(content, resources, instructions, source, 'root', !compileInstruction.targetShadowDOM); - - var firstChild = content.firstChild; - if (firstChild && firstChild.nodeType === 1) { - var targetId = firstChild.getAttribute('au-target-id'); - if (targetId) { - var ins = instructions[targetId]; - - if (ins.shadowSlot || ins.lifting || ins.elementInstruction && !ins.elementInstruction.anchorIsContainer) { - content.insertBefore(_aureliaPal.DOM.createComment('view'), firstChild); + ViewCompiler.inject = function () { + return [BindingLanguage, ViewResources]; + }; + ViewCompiler.prototype.compile = function (source, resources, compileInstruction) { + resources = resources || this.resources; + compileInstruction = compileInstruction || ViewCompileInstruction.normal; + source = typeof source === 'string' ? aureliaPal.DOM.createTemplateFromMarkup(source) : source; + var content; + var part; + var cacheSize; + if (source.content) { + part = source.getAttribute('part'); + cacheSize = source.getAttribute('view-cache'); + content = aureliaPal.DOM.adoptNode(source.content); } - } - } - - var factory = new ViewFactory(content, instructions, resources); - - factory.surrogateInstruction = compileInstruction.compileSurrogate ? this._compileSurrogate(source, resources) : null; - factory.part = part; - - if (cacheSize) { - factory.setCacheSize(cacheSize); - } - - resources._invokeHook('afterCompile', factory); - - return factory; - }; - - ViewCompiler.prototype._compileNode = function _compileNode(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM) { - switch (node.nodeType) { - case 1: - return this._compileElement(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM); - case 3: - var expression = resources.getBindingLanguage(this.bindingLanguage).inspectTextContent(resources, node.wholeText); - if (expression) { - var marker = _aureliaPal.DOM.createElement('au-marker'); - var auTargetID = makeIntoInstructionTarget(marker); - (node.parentNode || parentNode).insertBefore(marker, node); - node.textContent = ' '; - instructions[auTargetID] = TargetInstruction.contentExpression(expression); - - while (node.nextSibling && node.nextSibling.nodeType === 3) { - (node.parentNode || parentNode).removeChild(node.nextSibling); - } - } else { - while (node.nextSibling && node.nextSibling.nodeType === 3) { - node = node.nextSibling; - } + else { + content = source; + } + compileInstruction.targetShadowDOM = compileInstruction.targetShadowDOM && aureliaPal.FEATURE.shadowDOM; + resources._invokeHook('beforeCompile', content, resources, compileInstruction); + var instructions = {}; + this._compileNode(content, resources, instructions, source, 'root', !compileInstruction.targetShadowDOM); + var firstChild = content.firstChild; + if (firstChild && firstChild.nodeType === 1) { + var targetId = firstChild.getAttribute('au-target-id'); + if (targetId) { + var ins = instructions[targetId]; + if (ins.shadowSlot || ins.lifting || (ins.elementInstruction && !ins.elementInstruction.anchorIsContainer)) { + content.insertBefore(aureliaPal.DOM.createComment('view'), firstChild); + } + } + } + var factory = new ViewFactory(content, instructions, resources); + factory.surrogateInstruction = compileInstruction.compileSurrogate ? this._compileSurrogate(source, resources) : null; + factory.part = part; + if (cacheSize) { + factory.setCacheSize(cacheSize); + } + resources._invokeHook('afterCompile', factory); + return factory; + }; + ViewCompiler.prototype._compileNode = function (node, resources, instructions, parentNode, parentInjectorId, targetLightDOM) { + switch (node.nodeType) { + case 1: + return this._compileElement(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM); + case 3: + var expression = resources.getBindingLanguage(this.bindingLanguage).inspectTextContent(resources, node.wholeText); + if (expression) { + var marker = aureliaPal.DOM.createElement('au-marker'); + var auTargetID = makeIntoInstructionTarget(marker); + (node.parentNode || parentNode).insertBefore(marker, node); + node.textContent = ' '; + instructions[auTargetID] = TargetInstruction.contentExpression(expression); + while (node.nextSibling && node.nextSibling.nodeType === 3) { + (node.parentNode || parentNode).removeChild(node.nextSibling); + } + } + else { + while (node.nextSibling && node.nextSibling.nodeType === 3) { + node = node.nextSibling; + } + } + return node.nextSibling; + case 11: + var currentChild = node.firstChild; + while (currentChild) { + currentChild = this._compileNode(currentChild, resources, instructions, node, parentInjectorId, targetLightDOM); + } + break; } return node.nextSibling; - case 11: - var currentChild = node.firstChild; - while (currentChild) { - currentChild = this._compileNode(currentChild, resources, instructions, node, parentInjectorId, targetLightDOM); + }; + ViewCompiler.prototype._compileSurrogate = function (node, resources) { + var tagName = node.tagName.toLowerCase(); + var attributes = node.attributes; + var bindingLanguage = resources.getBindingLanguage(this.bindingLanguage); + var knownAttribute; + var property; + var instruction; + var i; + var ii; + var attr; + var attrName; + var attrValue; + var info; + var type; + var expressions = []; + var expression; + var behaviorInstructions = []; + var values = {}; + var hasValues = false; + var providers = []; + for (i = 0, ii = attributes.length; i < ii; ++i) { + attr = attributes[i]; + attrName = attr.name; + attrValue = attr.value; + info = bindingLanguage.inspectAttribute(resources, tagName, attrName, attrValue); + type = resources.getAttribute(info.attrName); + if (type) { + knownAttribute = resources.mapAttribute(info.attrName); + if (knownAttribute) { + property = type.attributes[knownAttribute]; + if (property) { + info.defaultBindingMode = property.defaultBindingMode; + if (!info.command && !info.expression) { + info.command = property.hasOptions ? 'options' : null; + } + if (info.command && (info.command !== 'options') && type.primaryProperty) { + var primaryProperty = type.primaryProperty; + attrName = info.attrName = primaryProperty.attribute; + info.defaultBindingMode = primaryProperty.defaultBindingMode; + } + } + } + } + instruction = bindingLanguage.createAttributeInstruction(resources, node, info, undefined, type); + if (instruction) { + if (instruction.alteredAttr) { + type = resources.getAttribute(instruction.attrName); + } + if (instruction.discrete) { + expressions.push(instruction); + } + else { + if (type) { + instruction.type = type; + this._configureProperties(instruction, resources); + if (type.liftsContent) { + throw new Error('You cannot place a template controller on a surrogate element.'); + } + else { + behaviorInstructions.push(instruction); + } + } + else { + expressions.push(instruction.attributes[instruction.attrName]); + } + } + } + else { + if (type) { + instruction = BehaviorInstruction.attribute(attrName, type); + instruction.attributes[resources.mapAttribute(attrName)] = attrValue; + if (type.liftsContent) { + throw new Error('You cannot place a template controller on a surrogate element.'); + } + else { + behaviorInstructions.push(instruction); + } + } + else if (attrName !== 'id' && attrName !== 'part' && attrName !== 'replace-part') { + hasValues = true; + values[attrName] = attrValue; + } + } } - break; - default: - break; - } - - return node.nextSibling; - }; - - ViewCompiler.prototype._compileSurrogate = function _compileSurrogate(node, resources) { - var tagName = node.tagName.toLowerCase(); - var attributes = node.attributes; - var bindingLanguage = resources.getBindingLanguage(this.bindingLanguage); - var knownAttribute = void 0; - var property = void 0; - var instruction = void 0; - var i = void 0; - var ii = void 0; - var attr = void 0; - var attrName = void 0; - var attrValue = void 0; - var info = void 0; - var type = void 0; - var expressions = []; - var expression = void 0; - var behaviorInstructions = []; - var values = {}; - var hasValues = false; - var providers = []; - - for (i = 0, ii = attributes.length; i < ii; ++i) { - attr = attributes[i]; - attrName = attr.name; - attrValue = attr.value; - - info = bindingLanguage.inspectAttribute(resources, tagName, attrName, attrValue); - type = resources.getAttribute(info.attrName); - - if (type) { - knownAttribute = resources.mapAttribute(info.attrName); - if (knownAttribute) { - property = type.attributes[knownAttribute]; - - if (property) { - info.defaultBindingMode = property.defaultBindingMode; - - if (!info.command && !info.expression) { - info.command = property.hasOptions ? 'options' : null; + if (expressions.length || behaviorInstructions.length || hasValues) { + for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) { + instruction = behaviorInstructions[i]; + instruction.type.compile(this, resources, node, instruction); + providers.push(instruction.type.target); } - - if (info.command && info.command !== 'options' && type.primaryProperty) { - var _primaryProperty = type.primaryProperty; - attrName = info.attrName = _primaryProperty.attribute; - - info.defaultBindingMode = _primaryProperty.defaultBindingMode; + for (i = 0, ii = expressions.length; i < ii; ++i) { + expression = expressions[i]; + if (expression.attrToRemove !== undefined) { + node.removeAttribute(expression.attrToRemove); + } } - } + return TargetInstruction.surrogate(providers, behaviorInstructions, expressions, values); } - } - - instruction = bindingLanguage.createAttributeInstruction(resources, node, info, undefined, type); - - if (instruction) { - if (instruction.alteredAttr) { - type = resources.getAttribute(instruction.attrName); + return null; + }; + ViewCompiler.prototype._compileElement = function (node, resources, instructions, parentNode, parentInjectorId, targetLightDOM) { + var tagName = node.tagName.toLowerCase(); + var attributes = node.attributes; + var expressions = []; + var expression; + var behaviorInstructions = []; + var providers = []; + var bindingLanguage = resources.getBindingLanguage(this.bindingLanguage); + var liftingInstruction; + var viewFactory; + var type; + var elementInstruction; + var elementProperty; + var i; + var ii; + var attr; + var attrName; + var attrValue; + var originalAttrName; + var instruction; + var info; + var property; + var knownAttribute; + var auTargetID; + var injectorId; + if (tagName === 'slot') { + if (targetLightDOM) { + node = makeShadowSlot(this, resources, node, instructions, parentInjectorId); + } + return node.nextSibling; } - - if (instruction.discrete) { - expressions.push(instruction); - } else { - if (type) { - instruction.type = type; - this._configureProperties(instruction, resources); - - if (type.liftsContent) { - throw new Error('You cannot place a template controller on a surrogate element.'); - } else { - behaviorInstructions.push(instruction); + else if (tagName === 'template') { + if (!('content' in node)) { + throw new Error('You cannot place a template element within ' + node.namespaceURI + ' namespace'); } - } else { - expressions.push(instruction.attributes[instruction.attrName]); - } + viewFactory = this.compile(node, resources); + viewFactory.part = node.getAttribute('part'); } - } else { - if (type) { - instruction = BehaviorInstruction.attribute(attrName, type); - instruction.attributes[resources.mapAttribute(attrName)] = attrValue; - - if (type.liftsContent) { - throw new Error('You cannot place a template controller on a surrogate element.'); - } else { - behaviorInstructions.push(instruction); - } - } else if (attrName !== 'id' && attrName !== 'part' && attrName !== 'replace-part') { - hasValues = true; - values[attrName] = attrValue; + else { + type = resources.getElement(node.getAttribute('as-element') || tagName); + if (tagName === 'let' && !type && bindingLanguage.createLetExpressions !== defaultLetHandler) { + expressions = bindingLanguage.createLetExpressions(resources, node); + auTargetID = makeIntoInstructionTarget(node); + instructions[auTargetID] = TargetInstruction.letElement(expressions); + return node.nextSibling; + } + if (type) { + elementInstruction = BehaviorInstruction.element(node, type); + type.processAttributes(this, resources, node, attributes, elementInstruction); + behaviorInstructions.push(elementInstruction); + } + } + for (i = 0, ii = attributes.length; i < ii; ++i) { + attr = attributes[i]; + originalAttrName = attrName = attr.name; + attrValue = attr.value; + info = bindingLanguage.inspectAttribute(resources, tagName, attrName, attrValue); + if (targetLightDOM && info.attrName === 'slot') { + info.attrName = attrName = 'au-slot'; + } + type = resources.getAttribute(info.attrName); + elementProperty = null; + if (type) { + knownAttribute = resources.mapAttribute(info.attrName); + if (knownAttribute) { + property = type.attributes[knownAttribute]; + if (property) { + info.defaultBindingMode = property.defaultBindingMode; + if (!info.command && !info.expression) { + info.command = property.hasOptions ? 'options' : null; + } + if (info.command && (info.command !== 'options') && type.primaryProperty) { + var primaryProperty = type.primaryProperty; + attrName = info.attrName = primaryProperty.attribute; + info.defaultBindingMode = primaryProperty.defaultBindingMode; + } + } + } + } + else if (elementInstruction) { + elementProperty = elementInstruction.type.attributes[info.attrName]; + if (elementProperty) { + info.defaultBindingMode = elementProperty.defaultBindingMode; + } + } + if (elementProperty) { + instruction = bindingLanguage.createAttributeInstruction(resources, node, info, elementInstruction); + } + else { + instruction = bindingLanguage.createAttributeInstruction(resources, node, info, undefined, type); + } + if (instruction) { + if (instruction.alteredAttr) { + type = resources.getAttribute(instruction.attrName); + } + if (instruction.discrete) { + expressions.push(instruction); + } + else { + if (type) { + instruction.type = type; + this._configureProperties(instruction, resources); + if (type.liftsContent) { + instruction.originalAttrName = originalAttrName; + liftingInstruction = instruction; + break; + } + else { + behaviorInstructions.push(instruction); + } + } + else if (elementProperty) { + elementInstruction.attributes[info.attrName].targetProperty = elementProperty.name; + } + else { + expressions.push(instruction.attributes[instruction.attrName]); + } + } + } + else { + if (type) { + instruction = BehaviorInstruction.attribute(attrName, type); + instruction.attributes[resources.mapAttribute(attrName)] = attrValue; + if (type.liftsContent) { + instruction.originalAttrName = originalAttrName; + liftingInstruction = instruction; + break; + } + else { + behaviorInstructions.push(instruction); + } + } + else if (elementProperty) { + elementInstruction.attributes[attrName] = attrValue; + } + } } - } - } - - if (expressions.length || behaviorInstructions.length || hasValues) { - for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) { - instruction = behaviorInstructions[i]; - instruction.type.compile(this, resources, node, instruction); - providers.push(instruction.type.target); - } - - for (i = 0, ii = expressions.length; i < ii; ++i) { - expression = expressions[i]; - if (expression.attrToRemove !== undefined) { - node.removeAttribute(expression.attrToRemove); + if (liftingInstruction) { + liftingInstruction.viewFactory = viewFactory; + node = liftingInstruction.type.compile(this, resources, node, liftingInstruction, parentNode); + auTargetID = makeIntoInstructionTarget(node); + instructions[auTargetID] = TargetInstruction.lifting(parentInjectorId, liftingInstruction); + } + else { + var skipContentProcessing = false; + if (expressions.length || behaviorInstructions.length) { + injectorId = behaviorInstructions.length ? getNextInjectorId() : false; + for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) { + instruction = behaviorInstructions[i]; + instruction.type.compile(this, resources, node, instruction, parentNode); + providers.push(instruction.type.target); + skipContentProcessing = skipContentProcessing || instruction.skipContentProcessing; + } + for (i = 0, ii = expressions.length; i < ii; ++i) { + expression = expressions[i]; + if (expression.attrToRemove !== undefined) { + node.removeAttribute(expression.attrToRemove); + } + } + auTargetID = makeIntoInstructionTarget(node); + instructions[auTargetID] = TargetInstruction.normal(injectorId, parentInjectorId, providers, behaviorInstructions, expressions, elementInstruction); + } + if (skipContentProcessing) { + return node.nextSibling; + } + var currentChild = node.firstChild; + while (currentChild) { + currentChild = this._compileNode(currentChild, resources, instructions, node, injectorId || parentInjectorId, targetLightDOM); + } } - } - - return TargetInstruction.surrogate(providers, behaviorInstructions, expressions, values); - } - - return null; - }; - - ViewCompiler.prototype._compileElement = function _compileElement(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM) { - var tagName = node.tagName.toLowerCase(); - var attributes = node.attributes; - var expressions = []; - var expression = void 0; - var behaviorInstructions = []; - var providers = []; - var bindingLanguage = resources.getBindingLanguage(this.bindingLanguage); - var liftingInstruction = void 0; - var viewFactory = void 0; - var type = void 0; - var elementInstruction = void 0; - var elementProperty = void 0; - var i = void 0; - var ii = void 0; - var attr = void 0; - var attrName = void 0; - var attrValue = void 0; - var originalAttrName = void 0; - var instruction = void 0; - var info = void 0; - var property = void 0; - var knownAttribute = void 0; - var auTargetID = void 0; - var injectorId = void 0; - - if (tagName === 'slot') { - if (targetLightDOM) { - node = makeShadowSlot(this, resources, node, instructions, parentInjectorId); - } - return node.nextSibling; - } else if (tagName === 'template') { - if (!('content' in node)) { - throw new Error('You cannot place a template element within ' + node.namespaceURI + ' namespace'); - } - viewFactory = this.compile(node, resources); - viewFactory.part = node.getAttribute('part'); - } else { - type = resources.getElement(node.getAttribute('as-element') || tagName); - - if (tagName === 'let' && !type && bindingLanguage.createLetExpressions !== defaultLetHandler) { - expressions = bindingLanguage.createLetExpressions(resources, node); - auTargetID = makeIntoInstructionTarget(node); - instructions[auTargetID] = TargetInstruction.letElement(expressions); return node.nextSibling; - } - if (type) { - elementInstruction = BehaviorInstruction.element(node, type); - type.processAttributes(this, resources, node, attributes, elementInstruction); - behaviorInstructions.push(elementInstruction); - } - } - - for (i = 0, ii = attributes.length; i < ii; ++i) { - attr = attributes[i]; - originalAttrName = attrName = attr.name; - attrValue = attr.value; - info = bindingLanguage.inspectAttribute(resources, tagName, attrName, attrValue); - - if (targetLightDOM && info.attrName === 'slot') { - info.attrName = attrName = 'au-slot'; - } - - type = resources.getAttribute(info.attrName); - elementProperty = null; - - if (type) { - knownAttribute = resources.mapAttribute(info.attrName); - if (knownAttribute) { - property = type.attributes[knownAttribute]; - - if (property) { - info.defaultBindingMode = property.defaultBindingMode; - - if (!info.command && !info.expression) { - info.command = property.hasOptions ? 'options' : null; + }; + ViewCompiler.prototype._configureProperties = function (instruction, resources) { + var type = instruction.type; + var attrName = instruction.attrName; + var attributes = instruction.attributes; + var property; + var key; + var value; + var knownAttribute = resources.mapAttribute(attrName); + if (knownAttribute && attrName in attributes && knownAttribute !== attrName) { + attributes[knownAttribute] = attributes[attrName]; + delete attributes[attrName]; + } + for (key in attributes) { + value = attributes[key]; + if (value !== null && typeof value === 'object') { + property = type.attributes[key]; + if (property !== undefined) { + value.targetProperty = property.name; + } + else { + value.targetProperty = key; + } } + } + }; + return ViewCompiler; +}()); - if (info.command && info.command !== 'options' && type.primaryProperty) { - var _primaryProperty2 = type.primaryProperty; - attrName = info.attrName = _primaryProperty2.attribute; +var ViewEngineHooksResource = (function () { + function ViewEngineHooksResource() { + } + ViewEngineHooksResource.prototype.initialize = function (container, target) { + this.instance = container.get(target); + }; + ViewEngineHooksResource.prototype.register = function (registry, name) { + registry.registerViewEngineHooks(this.instance); + }; + ViewEngineHooksResource.prototype.load = function (container, target) { }; + ViewEngineHooksResource.convention = function (name) { + if (name.endsWith('ViewEngineHooks')) { + return new ViewEngineHooksResource(); + } + }; + return ViewEngineHooksResource; +}()); +function viewEngineHooks(target) { + var deco = function (t) { + aureliaMetadata.metadata.define(aureliaMetadata.metadata.resource, new ViewEngineHooksResource(), t); + }; + return target ? deco(target) : deco; +} - info.defaultBindingMode = _primaryProperty2.defaultBindingMode; +var ResourceModule = (function () { + function ResourceModule(moduleId) { + this.id = moduleId; + this.moduleInstance = null; + this.mainResource = null; + this.resources = null; + this.viewStrategy = null; + this.isInitialized = false; + this.onLoaded = null; + this.loadContext = null; + } + ResourceModule.prototype.initialize = function (container) { + var current = this.mainResource; + var resources = this.resources; + var vs = this.viewStrategy; + if (this.isInitialized) { + return; + } + this.isInitialized = true; + if (current !== undefined) { + current.metadata.viewStrategy = vs; + current.initialize(container); + } + for (var i = 0, ii = resources.length; i < ii; ++i) { + current = resources[i]; + current.metadata.viewStrategy = vs; + current.initialize(container); + } + }; + ResourceModule.prototype.register = function (registry, name) { + var main = this.mainResource; + var resources = this.resources; + if (main !== undefined) { + main.register(registry, name); + name = null; + } + for (var i = 0, ii = resources.length; i < ii; ++i) { + resources[i].register(registry, name); + name = null; + } + }; + ResourceModule.prototype.load = function (container, loadContext) { + if (this.onLoaded !== null) { + return this.loadContext === loadContext ? Promise.resolve() : this.onLoaded; + } + var main = this.mainResource; + var resources = this.resources; + var loads; + if (main !== undefined) { + loads = new Array(resources.length + 1); + loads[0] = main.load(container, loadContext); + for (var i = 0, ii = resources.length; i < ii; ++i) { + loads[i + 1] = resources[i].load(container, loadContext); } - } } - } else if (elementInstruction) { - elementProperty = elementInstruction.type.attributes[info.attrName]; - if (elementProperty) { - info.defaultBindingMode = elementProperty.defaultBindingMode; + else { + loads = new Array(resources.length); + for (var i = 0, ii = resources.length; i < ii; ++i) { + loads[i] = resources[i].load(container, loadContext); + } } - } - - if (elementProperty) { - instruction = bindingLanguage.createAttributeInstruction(resources, node, info, elementInstruction); - } else { - instruction = bindingLanguage.createAttributeInstruction(resources, node, info, undefined, type); - } - - if (instruction) { - if (instruction.alteredAttr) { - type = resources.getAttribute(instruction.attrName); + this.loadContext = loadContext; + this.onLoaded = Promise.all(loads); + return this.onLoaded; + }; + return ResourceModule; +}()); +var ResourceDescription = (function () { + function ResourceDescription(key, exportedValue, resourceTypeMeta) { + if (!resourceTypeMeta) { + resourceTypeMeta = aureliaMetadata.metadata.get(aureliaMetadata.metadata.resource, exportedValue); + if (!resourceTypeMeta) { + resourceTypeMeta = new HtmlBehaviorResource(); + resourceTypeMeta.elementName = _hyphenate(key); + aureliaMetadata.metadata.define(aureliaMetadata.metadata.resource, resourceTypeMeta, exportedValue); + } } - - if (instruction.discrete) { - expressions.push(instruction); - } else { - if (type) { - instruction.type = type; - this._configureProperties(instruction, resources); - - if (type.liftsContent) { - instruction.originalAttrName = originalAttrName; - liftingInstruction = instruction; - break; - } else { - behaviorInstructions.push(instruction); + if (resourceTypeMeta instanceof HtmlBehaviorResource) { + if (resourceTypeMeta.elementName === undefined) { + resourceTypeMeta.elementName = _hyphenate(key); + } + else if (resourceTypeMeta.attributeName === undefined) { + resourceTypeMeta.attributeName = _hyphenate(key); + } + else if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) { + HtmlBehaviorResource.convention(key, resourceTypeMeta); } - } else if (elementProperty) { - elementInstruction.attributes[info.attrName].targetProperty = elementProperty.name; - } else { - expressions.push(instruction.attributes[instruction.attrName]); - } } - } else { - if (type) { - instruction = BehaviorInstruction.attribute(attrName, type); - instruction.attributes[resources.mapAttribute(attrName)] = attrValue; - - if (type.liftsContent) { - instruction.originalAttrName = originalAttrName; - liftingInstruction = instruction; - break; - } else { - behaviorInstructions.push(instruction); - } - } else if (elementProperty) { - elementInstruction.attributes[attrName] = attrValue; + else if (!resourceTypeMeta.name) { + resourceTypeMeta.name = _hyphenate(key); } - } + this.metadata = resourceTypeMeta; + this.value = exportedValue; } - - if (liftingInstruction) { - liftingInstruction.viewFactory = viewFactory; - node = liftingInstruction.type.compile(this, resources, node, liftingInstruction, parentNode); - auTargetID = makeIntoInstructionTarget(node); - instructions[auTargetID] = TargetInstruction.lifting(parentInjectorId, liftingInstruction); - } else { - var skipContentProcessing = false; - - if (expressions.length || behaviorInstructions.length) { - injectorId = behaviorInstructions.length ? getNextInjectorId() : false; - - for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) { - instruction = behaviorInstructions[i]; - instruction.type.compile(this, resources, node, instruction, parentNode); - providers.push(instruction.type.target); - skipContentProcessing = skipContentProcessing || instruction.skipContentProcessing; + ResourceDescription.prototype.initialize = function (container) { + this.metadata.initialize(container, this.value); + }; + ResourceDescription.prototype.register = function (registry, name) { + this.metadata.register(registry, name); + }; + ResourceDescription.prototype.load = function (container, loadContext) { + return this.metadata.load(container, this.value, loadContext); + }; + return ResourceDescription; +}()); +var ModuleAnalyzer = (function () { + function ModuleAnalyzer() { + this.cache = Object.create(null); + } + ModuleAnalyzer.prototype.getAnalysis = function (moduleId) { + return this.cache[moduleId]; + }; + ModuleAnalyzer.prototype.analyze = function (moduleId, moduleInstance, mainResourceKey) { + var mainResource; + var fallbackValue; + var fallbackKey; + var resourceTypeMeta; + var key; + var exportedValue; + var resources = []; + var conventional; + var vs; + var resourceModule; + resourceModule = this.cache[moduleId]; + if (resourceModule) { + return resourceModule; + } + resourceModule = new ResourceModule(moduleId); + this.cache[moduleId] = resourceModule; + if (typeof moduleInstance === 'function') { + moduleInstance = { 'default': moduleInstance }; + } + if (mainResourceKey) { + mainResource = new ResourceDescription(mainResourceKey, moduleInstance[mainResourceKey]); + } + for (key in moduleInstance) { + exportedValue = moduleInstance[key]; + if (key === mainResourceKey || typeof exportedValue !== 'function') { + continue; + } + resourceTypeMeta = aureliaMetadata.metadata.get(aureliaMetadata.metadata.resource, exportedValue); + if (resourceTypeMeta) { + if (resourceTypeMeta instanceof HtmlBehaviorResource) { + ViewResources.convention(exportedValue, resourceTypeMeta); + if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) { + HtmlBehaviorResource.convention(key, resourceTypeMeta); + } + if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) { + resourceTypeMeta.elementName = _hyphenate(key); + } + } + if (!mainResource && resourceTypeMeta instanceof HtmlBehaviorResource && resourceTypeMeta.elementName !== null) { + mainResource = new ResourceDescription(key, exportedValue, resourceTypeMeta); + } + else { + resources.push(new ResourceDescription(key, exportedValue, resourceTypeMeta)); + } + } + else if (viewStrategy.decorates(exportedValue)) { + vs = exportedValue; + } + else if (exportedValue instanceof aureliaLoader.TemplateRegistryEntry) { + vs = new TemplateRegistryViewStrategy(moduleId, exportedValue); + } + else { + if (conventional = ViewResources.convention(exportedValue)) { + if (conventional.elementName !== null && !mainResource) { + mainResource = new ResourceDescription(key, exportedValue, conventional); + } + else { + resources.push(new ResourceDescription(key, exportedValue, conventional)); + } + aureliaMetadata.metadata.define(aureliaMetadata.metadata.resource, conventional, exportedValue); + } + else if (conventional = HtmlBehaviorResource.convention(key)) { + if (conventional.elementName !== null && !mainResource) { + mainResource = new ResourceDescription(key, exportedValue, conventional); + } + else { + resources.push(new ResourceDescription(key, exportedValue, conventional)); + } + aureliaMetadata.metadata.define(aureliaMetadata.metadata.resource, conventional, exportedValue); + } + else if (conventional = aureliaBinding.ValueConverterResource.convention(key) + || aureliaBinding.BindingBehaviorResource.convention(key) + || ViewEngineHooksResource.convention(key)) { + resources.push(new ResourceDescription(key, exportedValue, conventional)); + aureliaMetadata.metadata.define(aureliaMetadata.metadata.resource, conventional, exportedValue); + } + else if (!fallbackValue) { + fallbackValue = exportedValue; + fallbackKey = key; + } + } } - - for (i = 0, ii = expressions.length; i < ii; ++i) { - expression = expressions[i]; - if (expression.attrToRemove !== undefined) { - node.removeAttribute(expression.attrToRemove); - } + if (!mainResource && fallbackValue) { + mainResource = new ResourceDescription(fallbackKey, fallbackValue); } + resourceModule.moduleInstance = moduleInstance; + resourceModule.mainResource = mainResource; + resourceModule.resources = resources; + resourceModule.viewStrategy = vs; + return resourceModule; + }; + return ModuleAnalyzer; +}()); - auTargetID = makeIntoInstructionTarget(node); - instructions[auTargetID] = TargetInstruction.normal(injectorId, parentInjectorId, providers, behaviorInstructions, expressions, elementInstruction); - } - - if (skipContentProcessing) { - return node.nextSibling; - } - - var currentChild = node.firstChild; - while (currentChild) { - currentChild = this._compileNode(currentChild, resources, instructions, node, injectorId || parentInjectorId, targetLightDOM); - } - } - - return node.nextSibling; - }; - - ViewCompiler.prototype._configureProperties = function _configureProperties(instruction, resources) { - var type = instruction.type; - var attrName = instruction.attrName; - var attributes = instruction.attributes; - var property = void 0; - var key = void 0; - var value = void 0; - - var knownAttribute = resources.mapAttribute(attrName); - if (knownAttribute && attrName in attributes && knownAttribute !== attrName) { - attributes[knownAttribute] = attributes[attrName]; - delete attributes[attrName]; +var logger = LogManager__namespace.getLogger('templating'); +function ensureRegistryEntry(loader, urlOrRegistryEntry) { + if (urlOrRegistryEntry instanceof aureliaLoader.TemplateRegistryEntry) { + return Promise.resolve(urlOrRegistryEntry); } - - for (key in attributes) { - value = attributes[key]; - - if (value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') { - property = type.attributes[key]; - - if (property !== undefined) { - value.targetProperty = property.name; - } else { - value.targetProperty = key; - } - } + return loader.loadTemplate(urlOrRegistryEntry); +} +var ProxyViewFactory = (function () { + function ProxyViewFactory(promise) { + var _this = this; + promise.then(function (x) { return _this.viewFactory = x; }); } - }; - - return ViewCompiler; -}()) || _class14); - -var ResourceModule = exports.ResourceModule = function () { - function ResourceModule(moduleId) { - - - this.id = moduleId; - this.moduleInstance = null; - this.mainResource = null; - this.resources = null; - this.viewStrategy = null; - this.isInitialized = false; - this.onLoaded = null; - this.loadContext = null; - } - - ResourceModule.prototype.initialize = function initialize(container) { - var current = this.mainResource; - var resources = this.resources; - var vs = this.viewStrategy; + ProxyViewFactory.prototype.create = function (container, bindingContext, createInstruction, element) { + return this.viewFactory.create(container, bindingContext, createInstruction, element); + }; + Object.defineProperty(ProxyViewFactory.prototype, "isCaching", { + get: function () { + return this.viewFactory.isCaching; + }, + enumerable: false, + configurable: true + }); + ProxyViewFactory.prototype.setCacheSize = function (size, doNotOverrideIfAlreadySet) { + this.viewFactory.setCacheSize(size, doNotOverrideIfAlreadySet); + }; + ProxyViewFactory.prototype.getCachedView = function () { + return this.viewFactory.getCachedView(); + }; + ProxyViewFactory.prototype.returnViewToCache = function (view) { + this.viewFactory.returnViewToCache(view); + }; + return ProxyViewFactory; +}()); +var auSlotBehavior = null; +var ViewEngine = (function () { + function ViewEngine(loader, container, viewCompiler, moduleAnalyzer, appResources) { + this.loader = loader; + this.container = container; + this.viewCompiler = viewCompiler; + this.moduleAnalyzer = moduleAnalyzer; + this.appResources = appResources; + this._pluginMap = {}; + if (auSlotBehavior === null) { + auSlotBehavior = new HtmlBehaviorResource(); + auSlotBehavior.attributeName = 'au-slot'; + aureliaMetadata.metadata.define(aureliaMetadata.metadata.resource, auSlotBehavior, SlotCustomAttribute); + } + auSlotBehavior.initialize(container, SlotCustomAttribute); + auSlotBehavior.register(appResources); + } + ViewEngine.inject = function () { + return [aureliaLoader.Loader, aureliaDependencyInjection.Container, ViewCompiler, ModuleAnalyzer, ViewResources]; + }; + ViewEngine.prototype.addResourcePlugin = function (extension, implementation) { + var name = extension.replace('.', '') + '-resource-plugin'; + this._pluginMap[extension] = name; + this.loader.addPlugin(name, implementation); + }; + ViewEngine.prototype.loadViewFactory = function (urlOrRegistryEntry, compileInstruction, loadContext, target) { + var _this = this; + loadContext = loadContext || new ResourceLoadContext(); + return ensureRegistryEntry(this.loader, urlOrRegistryEntry).then(function (registryEntry) { + var url = registryEntry.address; + if (registryEntry.onReady) { + if (!loadContext.hasDependency(url)) { + loadContext.addDependency(url); + return registryEntry.onReady; + } + if (registryEntry.template === null) { + return registryEntry.onReady; + } + return Promise.resolve(new ProxyViewFactory(registryEntry.onReady)); + } + loadContext.addDependency(url); + registryEntry.onReady = _this.loadTemplateResources(registryEntry, compileInstruction, loadContext, target).then(function (resources) { + registryEntry.resources = resources; + if (registryEntry.template === null) { + return registryEntry.factory = null; + } + var viewFactory = _this.viewCompiler.compile(registryEntry.template, resources, compileInstruction); + return registryEntry.factory = viewFactory; + }); + return registryEntry.onReady; + }); + }; + ViewEngine.prototype.loadTemplateResources = function (registryEntry, compileInstruction, loadContext, target) { + var resources = new ViewResources(this.appResources, registryEntry.address); + var dependencies = registryEntry.dependencies; + var importIds; + var names; + compileInstruction = compileInstruction || ViewCompileInstruction.normal; + if (dependencies.length === 0 && !compileInstruction.associatedModuleId) { + return Promise.resolve(resources); + } + importIds = dependencies.map(function (x) { return x.src; }); + names = dependencies.map(function (x) { return x.name; }); + logger.debug("importing resources for ".concat(registryEntry.address), importIds); + if (target) { + var viewModelRequires = aureliaMetadata.metadata.get(ViewEngine.viewModelRequireMetadataKey, target); + if (viewModelRequires) { + var templateImportCount = importIds.length; + for (var i = 0, ii = viewModelRequires.length; i < ii; ++i) { + var req = viewModelRequires[i]; + var importId = typeof req === 'function' + ? aureliaMetadata.Origin.get(req).moduleId + : aureliaPath.relativeToFile(req.src || req, registryEntry.address); + if (importIds.indexOf(importId) === -1) { + importIds.push(importId); + names.push(req.as); + } + } + logger.debug("importing ViewModel resources for ".concat(compileInstruction.associatedModuleId), importIds.slice(templateImportCount)); + } + } + return this.importViewResources(importIds, names, resources, compileInstruction, loadContext); + }; + ViewEngine.prototype.importViewModelResource = function (moduleImport, moduleMember) { + var _this = this; + return this.loader.loadModule(moduleImport).then(function (viewModelModule) { + var normalizedId = aureliaMetadata.Origin.get(viewModelModule).moduleId; + var resourceModule = _this.moduleAnalyzer.analyze(normalizedId, viewModelModule, moduleMember); + if (!resourceModule.mainResource) { + throw new Error("No view model found in module \"".concat(moduleImport, "\".")); + } + resourceModule.initialize(_this.container); + return resourceModule.mainResource; + }); + }; + ViewEngine.prototype.importViewResources = function (moduleIds, names, resources, compileInstruction, loadContext) { + var _this = this; + loadContext = loadContext || new ResourceLoadContext(); + compileInstruction = compileInstruction || ViewCompileInstruction.normal; + moduleIds = moduleIds.map(function (x) { return _this._applyLoaderPlugin(x); }); + return this.loader.loadAllModules(moduleIds).then(function (imports) { + var i; + var ii; + var analysis; + var normalizedId; + var current; + var associatedModule; + var container = _this.container; + var moduleAnalyzer = _this.moduleAnalyzer; + var allAnalysis = new Array(imports.length); + for (i = 0, ii = imports.length; i < ii; ++i) { + current = imports[i]; + normalizedId = aureliaMetadata.Origin.get(current).moduleId; + analysis = moduleAnalyzer.analyze(normalizedId, current); + analysis.initialize(container); + analysis.register(resources, names[i]); + allAnalysis[i] = analysis; + } + if (compileInstruction.associatedModuleId) { + associatedModule = moduleAnalyzer.getAnalysis(compileInstruction.associatedModuleId); + if (associatedModule) { + associatedModule.register(resources); + } + } + for (i = 0, ii = allAnalysis.length; i < ii; ++i) { + allAnalysis[i] = allAnalysis[i].load(container, loadContext); + } + return Promise.all(allAnalysis).then(function () { return resources; }); + }); + }; + ViewEngine.prototype._applyLoaderPlugin = function (id) { + var index = id.lastIndexOf('.'); + if (index !== -1) { + var ext = id.substring(index); + var pluginName = this._pluginMap[ext]; + if (pluginName === undefined) { + return id; + } + return this.loader.applyPluginToUrl(id, pluginName); + } + return id; + }; + ViewEngine.viewModelRequireMetadataKey = 'aurelia:view-model-require'; + return ViewEngine; +}()); - if (this.isInitialized) { - return; +var Controller = (function () { + function Controller(behavior, instruction, viewModel, container) { + this.behavior = behavior; + this.instruction = instruction; + this.viewModel = viewModel; + this.isAttached = false; + this.view = null; + this.isBound = false; + this.scope = null; + this.container = container; + this.elementEvents = container.elementEvents || null; + var observerLookup = behavior.observerLocator.getOrCreateObserversLookup(viewModel); + var handlesBind = behavior.handlesBind; + var attributes = instruction.attributes; + var boundProperties = this.boundProperties = []; + var properties = behavior.properties; + var i; + var ii; + behavior._ensurePropertiesDefined(viewModel, observerLookup); + for (i = 0, ii = properties.length; i < ii; ++i) { + properties[i]._initialize(viewModel, observerLookup, attributes, handlesBind, boundProperties); + } } + Controller.prototype.created = function (owningView) { + if (this.behavior.handlesCreated) { + this.viewModel.created(owningView, this.view); + } + }; + Controller.prototype.automate = function (overrideContext, owningView) { + this.view.bindingContext = this.viewModel; + this.view.overrideContext = overrideContext || aureliaBinding.createOverrideContext(this.viewModel); + this.view._isUserControlled = true; + if (this.behavior.handlesCreated) { + this.viewModel.created(owningView || null, this.view); + } + this.bind(this.view); + }; + Controller.prototype.bind = function (scope) { + var skipSelfSubscriber = this.behavior.handlesBind; + var boundProperties = this.boundProperties; + var i; + var ii; + var x; + var observer; + var selfSubscriber; + if (this.isBound) { + if (this.scope === scope) { + return; + } + this.unbind(); + } + this.isBound = true; + this.scope = scope; + for (i = 0, ii = boundProperties.length; i < ii; ++i) { + x = boundProperties[i]; + observer = x.observer; + selfSubscriber = observer.selfSubscriber; + observer.publishing = false; + if (skipSelfSubscriber) { + observer.selfSubscriber = null; + } + x.binding.bind(scope); + observer.call(); + observer.publishing = true; + observer.selfSubscriber = selfSubscriber; + } + var overrideContext; + if (this.view !== null) { + if (skipSelfSubscriber) { + this.view.viewModelScope = scope; + } + if (this.viewModel === scope.overrideContext.bindingContext) { + overrideContext = scope.overrideContext; + } + else if (this.instruction.inheritBindingContext) { + overrideContext = aureliaBinding.createOverrideContext(this.viewModel, scope.overrideContext); + } + else { + overrideContext = aureliaBinding.createOverrideContext(this.viewModel); + overrideContext.__parentOverrideContext = scope.overrideContext; + } + this.view.bind(this.viewModel, overrideContext); + } + else if (skipSelfSubscriber) { + overrideContext = scope.overrideContext; + if (scope.overrideContext.__parentOverrideContext !== undefined + && this.viewModel.viewFactory && this.viewModel.viewFactory.factoryCreateInstruction.partReplacements) { + overrideContext = Object.assign({}, scope.overrideContext); + overrideContext.parentOverrideContext = scope.overrideContext.__parentOverrideContext; + } + this.viewModel.bind(scope.bindingContext, overrideContext); + } + }; + Controller.prototype.unbind = function () { + if (this.isBound) { + var boundProperties = this.boundProperties; + var i = void 0; + var ii = void 0; + this.isBound = false; + this.scope = null; + if (this.view !== null) { + this.view.unbind(); + } + if (this.behavior.handlesUnbind) { + this.viewModel.unbind(); + } + if (this.elementEvents !== null) { + this.elementEvents.disposeAll(); + } + for (i = 0, ii = boundProperties.length; i < ii; ++i) { + boundProperties[i].binding.unbind(); + } + } + }; + Controller.prototype.attached = function () { + if (this.isAttached) { + return; + } + this.isAttached = true; + if (this.behavior.handlesAttached) { + this.viewModel.attached(); + } + if (this.view !== null) { + this.view.attached(); + } + }; + Controller.prototype.detached = function () { + if (this.isAttached) { + this.isAttached = false; + if (this.view !== null) { + this.view.detached(); + } + if (this.behavior.handlesDetached) { + this.viewModel.detached(); + } + } + }; + return Controller; +}()); - this.isInitialized = true; +var lastProviderId = 0; +function nextProviderId() { + return ++lastProviderId; +} +function doProcessContent() { return true; } +function doProcessAttributes() { } +var HtmlBehaviorResource = (function () { + function HtmlBehaviorResource() { + this.elementName = null; + this.attributeName = null; + this.attributeDefaultBindingMode = undefined; + this.liftsContent = false; + this.targetShadowDOM = false; + this.shadowDOMOptions = null; + this.processAttributes = doProcessAttributes; + this.processContent = doProcessContent; + this.usesShadowDOM = false; + this.childBindings = null; + this.hasDynamicOptions = false; + this.containerless = false; + this.properties = []; + this.attributes = {}; + this.isInitialized = false; + this.primaryProperty = null; + } + HtmlBehaviorResource.convention = function (name, existing) { + var behavior; + if (name.endsWith('CustomAttribute')) { + behavior = existing || new HtmlBehaviorResource(); + behavior.attributeName = _hyphenate(name.substring(0, name.length - 15)); + } + if (name.endsWith('CustomElement')) { + behavior = existing || new HtmlBehaviorResource(); + behavior.elementName = _hyphenate(name.substring(0, name.length - 13)); + } + return behavior; + }; + HtmlBehaviorResource.prototype.addChildBinding = function (behavior) { + if (this.childBindings === null) { + this.childBindings = []; + } + this.childBindings.push(behavior); + }; + HtmlBehaviorResource.prototype.initialize = function (container, target) { + var proto = target.prototype; + var properties = this.properties; + var attributeName = this.attributeName; + var attributeDefaultBindingMode = this.attributeDefaultBindingMode; + var i; + var ii; + var current; + if (this.isInitialized) { + return; + } + this.isInitialized = true; + target.__providerId__ = nextProviderId(); + this.observerLocator = container.get(aureliaBinding.ObserverLocator); + this.taskQueue = container.get(aureliaTaskQueue.TaskQueue); + this.target = target; + this.usesShadowDOM = this.targetShadowDOM && aureliaPal.FEATURE.shadowDOM; + this.handlesCreated = ('created' in proto); + this.handlesBind = ('bind' in proto); + this.handlesUnbind = ('unbind' in proto); + this.handlesAttached = ('attached' in proto); + this.handlesDetached = ('detached' in proto); + this.htmlName = this.elementName || this.attributeName; + if (attributeName !== null) { + if (properties.length === 0) { + new BindableProperty({ + name: 'value', + changeHandler: 'valueChanged' in proto ? 'valueChanged' : null, + attribute: attributeName, + defaultBindingMode: attributeDefaultBindingMode + }).registerWith(target, this); + } + current = properties[0]; + if (properties.length === 1 && current.name === 'value') { + current.isDynamic = current.hasOptions = this.hasDynamicOptions; + current.defineOn(target, this); + } + else { + for (i = 0, ii = properties.length; i < ii; ++i) { + properties[i].defineOn(target, this); + if (properties[i].primaryProperty) { + if (this.primaryProperty) { + throw new Error('Only one bindable property on a custom element can be defined as the default'); + } + this.primaryProperty = properties[i]; + } + } + current = new BindableProperty({ + name: 'value', + changeHandler: 'valueChanged' in proto ? 'valueChanged' : null, + attribute: attributeName, + defaultBindingMode: attributeDefaultBindingMode + }); + current.hasOptions = true; + current.registerWith(target, this); + } + } + else { + for (i = 0, ii = properties.length; i < ii; ++i) { + properties[i].defineOn(target, this); + } + this._copyInheritedProperties(container, target); + } + }; + HtmlBehaviorResource.prototype.register = function (registry, name) { + var _this = this; + if (this.attributeName !== null) { + registry.registerAttribute(name || this.attributeName, this, this.attributeName); + if (Array.isArray(this.aliases)) { + this.aliases + .forEach(function (alias) { + registry.registerAttribute(alias, _this, _this.attributeName); + }); + } + } + if (this.elementName !== null) { + registry.registerElement(name || this.elementName, this); + } + }; + HtmlBehaviorResource.prototype.aliases = function (aliases) { + throw new Error('Method not implemented.'); + }; + HtmlBehaviorResource.prototype.load = function (container, target, loadContext, viewStrategy, transientView) { + var _this = this; + var options; + if (this.elementName !== null) { + viewStrategy = container.get(ViewLocator).getViewStrategy(viewStrategy || this.viewStrategy || target); + options = new ViewCompileInstruction(this.targetShadowDOM, true); + if (!viewStrategy.moduleId) { + viewStrategy.moduleId = aureliaMetadata.Origin.get(target).moduleId; + } + return viewStrategy + .loadViewFactory(container.get(ViewEngine), options, loadContext, target) + .then(function (viewFactory) { + if (!transientView || !_this.viewFactory) { + _this.viewFactory = viewFactory; + } + return viewFactory; + }); + } + return Promise.resolve(this); + }; + HtmlBehaviorResource.prototype.compile = function (compiler, resources, node, instruction, parentNode) { + if (this.liftsContent) { + if (!instruction.viewFactory) { + var template = aureliaPal.DOM.createElement('template'); + var fragment = aureliaPal.DOM.createDocumentFragment(); + var cacheSize = node.getAttribute('view-cache'); + var part = node.getAttribute('part'); + node.removeAttribute(instruction.originalAttrName); + aureliaPal.DOM.replaceNode(template, node, parentNode); + fragment.appendChild(node); + instruction.viewFactory = compiler.compile(fragment, resources); + if (part) { + instruction.viewFactory.part = part; + node.removeAttribute('part'); + } + if (cacheSize) { + instruction.viewFactory.setCacheSize(cacheSize); + node.removeAttribute('view-cache'); + } + node = template; + } + } + else if (this.elementName !== null) { + var partReplacements = {}; + if (this.processContent(compiler, resources, node, instruction) && node.hasChildNodes()) { + var currentChild = node.firstChild; + var contentElement = this.usesShadowDOM ? null : aureliaPal.DOM.createElement('au-content'); + var nextSibling = void 0; + var toReplace = void 0; + while (currentChild) { + nextSibling = currentChild.nextSibling; + if (currentChild.tagName === 'TEMPLATE' && (toReplace = currentChild.getAttribute('replace-part'))) { + partReplacements[toReplace] = compiler.compile(currentChild, resources); + aureliaPal.DOM.removeNode(currentChild, parentNode); + instruction.partReplacements = partReplacements; + } + else if (contentElement !== null) { + if (currentChild.nodeType === 3 && _isAllWhitespace(currentChild)) { + aureliaPal.DOM.removeNode(currentChild, parentNode); + } + else { + contentElement.appendChild(currentChild); + } + } + currentChild = nextSibling; + } + if (contentElement !== null && contentElement.hasChildNodes()) { + node.appendChild(contentElement); + } + instruction.skipContentProcessing = false; + } + else { + instruction.skipContentProcessing = true; + } + } + else if (!this.processContent(compiler, resources, node, instruction)) { + instruction.skipContentProcessing = true; + } + return node; + }; + HtmlBehaviorResource.prototype.create = function (container, instruction, element, bindings) { + var viewHost; + var au = null; + instruction = instruction || BehaviorInstruction.normal; + element = element || null; + bindings = bindings || null; + if (this.elementName !== null && element) { + if (this.usesShadowDOM) { + viewHost = element.attachShadow(this.shadowDOMOptions); + container.registerInstance(aureliaPal.DOM.boundary, viewHost); + } + else { + viewHost = element; + if (this.targetShadowDOM) { + container.registerInstance(aureliaPal.DOM.boundary, viewHost); + } + } + } + if (element !== null) { + element.au = au = element.au || {}; + } + var viewModel = instruction.viewModel || container.get(this.target); + var controller = new Controller(this, instruction, viewModel, container); + var childBindings = this.childBindings; + var viewFactory; + if (this.liftsContent) { + au.controller = controller; + } + else if (this.elementName !== null) { + viewFactory = instruction.viewFactory || this.viewFactory; + container.viewModel = viewModel; + if (viewFactory) { + controller.view = viewFactory.create(container, instruction, element); + } + if (element !== null) { + au.controller = controller; + if (controller.view) { + if (!this.usesShadowDOM && (element.childNodes.length === 1 || element.contentElement)) { + var contentElement = element.childNodes[0] || element.contentElement; + controller.view.contentView = { fragment: contentElement }; + contentElement.parentNode && aureliaPal.DOM.removeNode(contentElement); + } + if (instruction.anchorIsContainer) { + if (childBindings !== null) { + for (var i = 0, ii = childBindings.length; i < ii; ++i) { + controller.view.addBinding(childBindings[i].create(element, viewModel, controller)); + } + } + controller.view.appendNodesTo(viewHost); + } + else { + controller.view.insertNodesBefore(viewHost); + } + } + else if (childBindings !== null) { + for (var i = 0, ii = childBindings.length; i < ii; ++i) { + bindings.push(childBindings[i].create(element, viewModel, controller)); + } + } + } + else if (controller.view) { + controller.view.controller = controller; + if (childBindings !== null) { + for (var i = 0, ii = childBindings.length; i < ii; ++i) { + controller.view.addBinding(childBindings[i].create(instruction.host, viewModel, controller)); + } + } + } + else if (childBindings !== null) { + for (var i = 0, ii = childBindings.length; i < ii; ++i) { + bindings.push(childBindings[i].create(instruction.host, viewModel, controller)); + } + } + } + else if (childBindings !== null) { + for (var i = 0, ii = childBindings.length; i < ii; ++i) { + bindings.push(childBindings[i].create(element, viewModel, controller)); + } + } + if (au !== null) { + au[this.htmlName] = controller; + } + if (instruction.initiatedByBehavior && viewFactory) { + controller.view.created(); + } + return controller; + }; + HtmlBehaviorResource.prototype._ensurePropertiesDefined = function (instance, lookup) { + var properties; + var i; + var ii; + var observer; + if ('__propertiesDefined__' in lookup) { + return; + } + lookup.__propertiesDefined__ = true; + properties = this.properties; + for (i = 0, ii = properties.length; i < ii; ++i) { + observer = properties[i].createObserver(instance); + if (observer !== undefined) { + lookup[observer.propertyName] = observer; + } + } + }; + HtmlBehaviorResource.prototype._copyInheritedProperties = function (container, target) { + var behavior; + var derived = target; + while (true) { + var proto = Object.getPrototypeOf(target.prototype); + target = proto && proto.constructor; + if (!target) { + return; + } + behavior = aureliaMetadata.metadata.getOwn(aureliaMetadata.metadata.resource, target); + if (behavior) { + break; + } + } + behavior.initialize(container, target); + var _loop_1 = function (i, ii) { + var prop = behavior.properties[i]; + if (this_1.properties.some(function (p) { return p.name === prop.name; })) { + return "continue"; + } + new BindableProperty(prop).registerWith(derived, this_1); + }; + var this_1 = this; + for (var i = 0, ii = behavior.properties.length; i < ii; ++i) { + _loop_1(i); + } + }; + return HtmlBehaviorResource; +}()); - if (current !== undefined) { - current.metadata.viewStrategy = vs; - current.initialize(container); +function register(lookup, name, resource, type) { + if (!name) { + return; } - - for (var i = 0, ii = resources.length; i < ii; ++i) { - current = resources[i]; - current.metadata.viewStrategy = vs; - current.initialize(container); + var existing = lookup[name]; + if (existing) { + if (existing !== resource) { + throw new Error("Attempted to register ".concat(type, " when one with the same name already exists. Name: ").concat(name, ".")); + } + return; } - }; - - ResourceModule.prototype.register = function register(registry, name) { - var main = this.mainResource; - var resources = this.resources; + lookup[name] = resource; +} +function validateBehaviorName(name, type) { + if (/[A-Z]/.test(name)) { + var newName = _hyphenate(name); + LogManager__namespace + .getLogger('templating') + .warn("'".concat(name, "' is not a valid ").concat(type, " name and has been converted to '").concat(newName, "'. Upper-case letters are not allowed because the DOM is not case-sensitive.")); + return newName; + } + return name; +} +var conventionMark = '__au_resource__'; +var ViewResources = (function () { + function ViewResources(parent, viewUrl) { + this.bindingLanguage = null; + this.parent = parent || null; + this.hasParent = this.parent !== null; + this.viewUrl = viewUrl || ''; + this.lookupFunctions = { + valueConverters: this.getValueConverter.bind(this), + bindingBehaviors: this.getBindingBehavior.bind(this) + }; + this.attributes = Object.create(null); + this.elements = Object.create(null); + this.valueConverters = Object.create(null); + this.bindingBehaviors = Object.create(null); + this.attributeMap = Object.create(null); + this.values = Object.create(null); + this.beforeCompile = this.afterCompile = this.beforeCreate = this.afterCreate = this.beforeBind = this.beforeUnbind = false; + } + ViewResources.convention = function (target, existing) { + var resource; + if (existing && conventionMark in existing) { + return existing; + } + if ('$resource' in target) { + var config = target.$resource; + if (typeof config === 'string') { + resource = existing || new HtmlBehaviorResource(); + resource[conventionMark] = true; + if (!resource.elementName) { + resource.elementName = validateBehaviorName(config, 'custom element'); + } + } + else { + if (typeof config === 'function') { + config = config.call(target); + } + if (typeof config === 'string') { + config = { name: config }; + } + config = Object.assign({}, config); + var resourceType = config.type || 'element'; + var name_1 = config.name; + switch (resourceType) { + case 'element': + case 'attribute': + resource = existing || new HtmlBehaviorResource(); + resource[conventionMark] = true; + if (resourceType === 'element') { + if (!resource.elementName) { + resource.elementName = name_1 + ? validateBehaviorName(name_1, 'custom element') + : _hyphenate(target.name); + } + } + else { + if (!resource.attributeName) { + resource.attributeName = name_1 + ? validateBehaviorName(name_1, 'custom attribute') + : _hyphenate(target.name); + } + } + if ('templateController' in config) { + config.liftsContent = config.templateController; + delete config.templateController; + } + if ('defaultBindingMode' in config && resource.attributeDefaultBindingMode !== undefined) { + config.attributeDefaultBindingMode = config.defaultBindingMode; + delete config.defaultBindingMode; + } + delete config.name; + Object.assign(resource, config); + break; + case 'valueConverter': + resource = new aureliaBinding.ValueConverterResource(aureliaBinding.camelCase(name_1 || target.name)); + break; + case 'bindingBehavior': + resource = new aureliaBinding.BindingBehaviorResource(aureliaBinding.camelCase(name_1 || target.name)); + break; + case 'viewEngineHooks': + resource = new ViewEngineHooksResource(); + break; + } + } + if (resource instanceof HtmlBehaviorResource) { + var bindables = typeof config === 'string' ? undefined : config.bindables; + var currentProps = resource.properties; + if (Array.isArray(bindables)) { + for (var i = 0, ii = bindables.length; ii > i; ++i) { + var prop = bindables[i]; + if (!prop || (typeof prop !== 'string' && !prop.name)) { + throw new Error("Invalid bindable property at \"".concat(i, "\" for class \"").concat(target.name, "\". Expected either a string or an object with \"name\" property.")); + } + var newProp = new BindableProperty(prop); + var existed = false; + for (var j = 0, jj = currentProps.length; jj > j; ++j) { + if (currentProps[j].name === newProp.name) { + existed = true; + break; + } + } + if (existed) { + continue; + } + newProp.registerWith(target, resource); + } + } + } + } + return resource; + }; + ViewResources.prototype._tryAddHook = function (obj, name) { + if (typeof obj[name] === 'function') { + var func = obj[name].bind(obj); + var counter = 1; + var callbackName = void 0; + while (this[callbackName = name + counter.toString()] !== undefined) { + counter++; + } + this[name] = true; + this[callbackName] = func; + } + }; + ViewResources.prototype._invokeHook = function (name, one, two, three, four) { + if (this.hasParent) { + this.parent._invokeHook(name, one, two, three, four); + } + if (this[name]) { + this[name + '1'](one, two, three, four); + var callbackName = name + '2'; + if (this[callbackName]) { + this[callbackName](one, two, three, four); + callbackName = name + '3'; + if (this[callbackName]) { + this[callbackName](one, two, three, four); + var counter = 4; + while (this[callbackName = name + counter.toString()] !== undefined) { + this[callbackName](one, two, three, four); + counter++; + } + } + } + } + }; + ViewResources.prototype.registerViewEngineHooks = function (hooks) { + this._tryAddHook(hooks, 'beforeCompile'); + this._tryAddHook(hooks, 'afterCompile'); + this._tryAddHook(hooks, 'beforeCreate'); + this._tryAddHook(hooks, 'afterCreate'); + this._tryAddHook(hooks, 'beforeBind'); + this._tryAddHook(hooks, 'beforeUnbind'); + }; + ViewResources.prototype.getBindingLanguage = function (bindingLanguageFallback) { + return this.bindingLanguage || (this.bindingLanguage = bindingLanguageFallback); + }; + ViewResources.prototype.patchInParent = function (newParent) { + var originalParent = this.parent; + this.parent = newParent || null; + this.hasParent = this.parent !== null; + if (newParent.parent === null) { + newParent.parent = originalParent; + newParent.hasParent = originalParent !== null; + } + }; + ViewResources.prototype.relativeToView = function (path) { + return aureliaPath.relativeToFile(path, this.viewUrl); + }; + ViewResources.prototype.registerElement = function (tagName, behavior) { + register(this.elements, tagName, behavior, 'an Element'); + }; + ViewResources.prototype.getElement = function (tagName) { + return this.elements[tagName] || (this.hasParent ? this.parent.getElement(tagName) : null); + }; + ViewResources.prototype.mapAttribute = function (attribute) { + return this.attributeMap[attribute] || (this.hasParent ? this.parent.mapAttribute(attribute) : null); + }; + ViewResources.prototype.registerAttribute = function (attribute, behavior, knownAttribute) { + this.attributeMap[attribute] = knownAttribute; + register(this.attributes, attribute, behavior, 'an Attribute'); + }; + ViewResources.prototype.getAttribute = function (attribute) { + return this.attributes[attribute] || (this.hasParent ? this.parent.getAttribute(attribute) : null); + }; + ViewResources.prototype.registerValueConverter = function (name, valueConverter) { + register(this.valueConverters, name, valueConverter, 'a ValueConverter'); + }; + ViewResources.prototype.getValueConverter = function (name) { + return this.valueConverters[name] || (this.hasParent ? this.parent.getValueConverter(name) : null); + }; + ViewResources.prototype.registerBindingBehavior = function (name, bindingBehavior) { + register(this.bindingBehaviors, name, bindingBehavior, 'a BindingBehavior'); + }; + ViewResources.prototype.getBindingBehavior = function (name) { + return this.bindingBehaviors[name] || (this.hasParent ? this.parent.getBindingBehavior(name) : null); + }; + ViewResources.prototype.registerValue = function (name, value) { + register(this.values, name, value, 'a value'); + }; + ViewResources.prototype.getValue = function (name) { + return this.values[name] || (this.hasParent ? this.parent.getValue(name) : null); + }; + ViewResources.prototype.autoRegister = function (container, impl) { + var resourceTypeMeta = aureliaMetadata.metadata.getOwn(aureliaMetadata.metadata.resource, impl); + if (resourceTypeMeta) { + if (resourceTypeMeta instanceof HtmlBehaviorResource) { + ViewResources.convention(impl, resourceTypeMeta); + if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) { + HtmlBehaviorResource.convention(impl.name, resourceTypeMeta); + } + if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) { + resourceTypeMeta.elementName = _hyphenate(impl.name); + } + } + } + else { + resourceTypeMeta = ViewResources.convention(impl) + || HtmlBehaviorResource.convention(impl.name) + || aureliaBinding.ValueConverterResource.convention(impl.name) + || aureliaBinding.BindingBehaviorResource.convention(impl.name) + || ViewEngineHooksResource.convention(impl.name); + if (!resourceTypeMeta) { + resourceTypeMeta = new HtmlBehaviorResource(); + resourceTypeMeta.elementName = _hyphenate(impl.name); + } + aureliaMetadata.metadata.define(aureliaMetadata.metadata.resource, resourceTypeMeta, impl); + } + resourceTypeMeta.initialize(container, impl); + resourceTypeMeta.register(this, undefined); + return resourceTypeMeta; + }; + return ViewResources; +}()); - if (main !== undefined) { - main.register(registry, name); - name = null; +var viewStrategy = aureliaMetadata.protocol.create('aurelia:view-strategy', { + validate: function (target) { + if (!(typeof target.loadViewFactory === 'function')) { + return 'View strategies must implement: loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext): Promise'; + } + return true; + }, + compose: function (target) { + if (!(typeof target.makeRelativeTo === 'function')) { + target.makeRelativeTo = aureliaPal.PLATFORM.noop; + } } - - for (var i = 0, ii = resources.length; i < ii; ++i) { - resources[i].register(registry, name); - name = null; +}); +var RelativeViewStrategy = (function () { + function RelativeViewStrategy(path) { + this.path = path; + this.absolutePath = null; } - }; - - ResourceModule.prototype.load = function load(container, loadContext) { - if (this.onLoaded !== null) { - return this.loadContext === loadContext ? Promise.resolve() : this.onLoaded; + RelativeViewStrategy.prototype.loadViewFactory = function (viewEngine, compileInstruction, loadContext, target) { + if (this.absolutePath === null && this.moduleId) { + this.absolutePath = aureliaPath.relativeToFile(this.path, this.moduleId); + } + compileInstruction.associatedModuleId = this.moduleId; + return viewEngine.loadViewFactory(this.absolutePath || this.path, compileInstruction, loadContext, target); + }; + RelativeViewStrategy.prototype.makeRelativeTo = function (file) { + if (this.absolutePath === null) { + this.absolutePath = aureliaPath.relativeToFile(this.path, file); + } + }; + RelativeViewStrategy = __decorate([ + viewStrategy() + ], RelativeViewStrategy); + return RelativeViewStrategy; +}()); +var ConventionalViewStrategy = (function () { + function ConventionalViewStrategy(viewLocator, origin) { + this.moduleId = origin.moduleId; + this.viewUrl = viewLocator.convertOriginToViewUrl(origin); + } + ConventionalViewStrategy.prototype.loadViewFactory = function (viewEngine, compileInstruction, loadContext, target) { + compileInstruction.associatedModuleId = this.moduleId; + return viewEngine.loadViewFactory(this.viewUrl, compileInstruction, loadContext, target); + }; + ConventionalViewStrategy = __decorate([ + viewStrategy() + ], ConventionalViewStrategy); + return ConventionalViewStrategy; +}()); +var NoViewStrategy = (function () { + function NoViewStrategy(dependencies, dependencyBaseUrl) { + this.dependencies = dependencies || null; + this.dependencyBaseUrl = dependencyBaseUrl || ''; + } + NoViewStrategy.prototype.loadViewFactory = function (viewEngine, compileInstruction, loadContext, target) { + var entry = this.entry; + var dependencies = this.dependencies; + if (entry && entry.factoryIsReady) { + return Promise.resolve(null); + } + this.entry = entry = new aureliaLoader.TemplateRegistryEntry(this.moduleId || this.dependencyBaseUrl); + entry.dependencies = []; + entry.templateIsLoaded = true; + if (dependencies !== null) { + for (var i = 0, ii = dependencies.length; i < ii; ++i) { + var current = dependencies[i]; + if (typeof current === 'string' || typeof current === 'function') { + entry.addDependency(current); + } + else { + entry.addDependency(current.from, current.as); + } + } + } + compileInstruction.associatedModuleId = this.moduleId; + return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target); + }; + NoViewStrategy = __decorate([ + viewStrategy() + ], NoViewStrategy); + return NoViewStrategy; +}()); +var TemplateRegistryViewStrategy = (function () { + function TemplateRegistryViewStrategy(moduleId, entry) { + this.moduleId = moduleId; + this.entry = entry; + } + TemplateRegistryViewStrategy.prototype.loadViewFactory = function (viewEngine, compileInstruction, loadContext, target) { + var entry = this.entry; + if (entry.factoryIsReady) { + return Promise.resolve(entry.factory); + } + compileInstruction.associatedModuleId = this.moduleId; + return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target); + }; + TemplateRegistryViewStrategy = __decorate([ + viewStrategy() + ], TemplateRegistryViewStrategy); + return TemplateRegistryViewStrategy; +}()); +var InlineViewStrategy = (function () { + function InlineViewStrategy(markup, dependencies, dependencyBaseUrl) { + this.markup = markup; + this.dependencies = dependencies || null; + this.dependencyBaseUrl = dependencyBaseUrl || ''; + } + InlineViewStrategy.prototype.loadViewFactory = function (viewEngine, compileInstruction, loadContext, target) { + var entry = this.entry; + var dependencies = this.dependencies; + if (entry && entry.factoryIsReady) { + return Promise.resolve(entry.factory); + } + this.entry = entry = new aureliaLoader.TemplateRegistryEntry(this.moduleId || this.dependencyBaseUrl); + entry.template = aureliaPal.DOM.createTemplateFromMarkup(this.markup); + if (dependencies !== null) { + for (var i = 0, ii = dependencies.length; i < ii; ++i) { + var current = dependencies[i]; + if (typeof current === 'string' || typeof current === 'function') { + entry.addDependency(current); + } + else { + entry.addDependency(current.from, current.as); + } + } + } + compileInstruction.associatedModuleId = this.moduleId; + return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target); + }; + InlineViewStrategy = __decorate([ + viewStrategy() + ], InlineViewStrategy); + return InlineViewStrategy; +}()); +var StaticViewStrategy = (function () { + function StaticViewStrategy(config) { + if (typeof config === 'string' || (config instanceof aureliaPal.DOM.Element && config.tagName === 'TEMPLATE')) { + config = { + template: config + }; + } + this.template = config.template; + this.dependencies = config.dependencies || []; + this.factoryIsReady = false; + this.onReady = null; + this.moduleId = 'undefined'; } + StaticViewStrategy.prototype.loadViewFactory = function (viewEngine, compileInstruction, loadContext, target) { + var _this = this; + if (this.factoryIsReady) { + return Promise.resolve(this.factory); + } + var $deps = this.dependencies; + var deps = typeof $deps === 'function' ? $deps() : $deps; + deps = deps ? deps : []; + deps = Array.isArray(deps) ? deps : [deps]; + return Promise.all(deps).then(function (dependencies) { + var container = viewEngine.container; + var appResources = viewEngine.appResources; + var viewCompiler = viewEngine.viewCompiler; + var viewResources = new ViewResources(appResources); + var resource; + var elDeps = []; + if (target) { + viewResources.autoRegister(container, target); + } + for (var _i = 0, dependencies_1 = dependencies; _i < dependencies_1.length; _i++) { + var dep = dependencies_1[_i]; + if (typeof dep === 'function') { + resource = viewResources.autoRegister(container, dep); + if (resource.elementName !== null) { + elDeps.push(resource); + } + } + else if (dep && typeof dep === 'object') { + for (var key in dep) { + var exported = dep[key]; + if (typeof exported === 'function') { + resource = viewResources.autoRegister(container, exported); + if (resource.elementName !== null) { + elDeps.push(resource); + } + } + } + } + else { + throw new Error("dependency neither function nor object. Received: \"".concat(typeof dep, "\"")); + } + } + return Promise.all(elDeps.map(function (el) { return el.load(container, el.target); })).then(function () { + var factory = _this.template !== null + ? viewCompiler.compile(_this.template, viewResources, compileInstruction) + : null; + _this.factoryIsReady = true; + _this.factory = factory; + return factory; + }); + }); + }; + StaticViewStrategy = __decorate([ + viewStrategy() + ], StaticViewStrategy); + return StaticViewStrategy; +}()); - var main = this.mainResource; - var resources = this.resources; - var loads = void 0; - - if (main !== undefined) { - loads = new Array(resources.length + 1); - loads[0] = main.load(container, loadContext); - for (var i = 0, ii = resources.length; i < ii; ++i) { - loads[i + 1] = resources[i].load(container, loadContext); - } - } else { - loads = new Array(resources.length); - for (var _i2 = 0, _ii = resources.length; _i2 < _ii; ++_i2) { - loads[_i2] = resources[_i2].load(container, loadContext); - } +function remove(viewSlot, previous) { + return Array.isArray(previous) + ? viewSlot.removeMany(previous, true) + : viewSlot.remove(previous, true); +} +var SwapStrategies = { + before: function (viewSlot, previous, callback) { + return (previous === undefined) + ? callback() + : callback().then(function () { return remove(viewSlot, previous); }); + }, + with: function (viewSlot, previous, callback) { + return (previous === undefined) + ? callback() + : Promise.all([remove(viewSlot, previous), callback()]); + }, + after: function (viewSlot, previous, callback) { + return Promise.resolve(viewSlot.removeAll(true)).then(callback); } +}; - this.loadContext = loadContext; - this.onLoaded = Promise.all(loads); - return this.onLoaded; - }; - - return ResourceModule; -}(); - -var ResourceDescription = exports.ResourceDescription = function () { - function ResourceDescription(key, exportedValue, resourceTypeMeta) { - - - if (!resourceTypeMeta) { - resourceTypeMeta = _aureliaMetadata.metadata.get(_aureliaMetadata.metadata.resource, exportedValue); - - if (!resourceTypeMeta) { - resourceTypeMeta = new HtmlBehaviorResource(); - resourceTypeMeta.elementName = _hyphenate(key); - _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, resourceTypeMeta, exportedValue); - } +function tryActivateViewModel(context) { + if (context.skipActivation || typeof context.viewModel.activate !== 'function') { + return Promise.resolve(); } - - if (resourceTypeMeta instanceof HtmlBehaviorResource) { - if (resourceTypeMeta.elementName === undefined) { - resourceTypeMeta.elementName = _hyphenate(key); - } else if (resourceTypeMeta.attributeName === undefined) { - resourceTypeMeta.attributeName = _hyphenate(key); - } else if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) { - HtmlBehaviorResource.convention(key, resourceTypeMeta); - } - } else if (!resourceTypeMeta.name) { - resourceTypeMeta.name = _hyphenate(key); + return context.viewModel.activate(context.model) || Promise.resolve(); +} +var CompositionEngine = (function () { + function CompositionEngine(viewEngine, viewLocator) { + this.viewEngine = viewEngine; + this.viewLocator = viewLocator; } + CompositionEngine.prototype._swap = function (context, view) { + var swapStrategy = SwapStrategies[context.swapOrder] || SwapStrategies.after; + var previousViews = context.viewSlot.children.slice(); + return swapStrategy(context.viewSlot, previousViews, function () { + return Promise.resolve(context.viewSlot.add(view)).then(function () { + if (context.currentController) { + context.currentController.unbind(); + } + }); + }).then(function () { + if (context.compositionTransactionNotifier) { + context.compositionTransactionNotifier.done(); + } + }); + }; + CompositionEngine.prototype._createControllerAndSwap = function (context) { + var _this = this; + return this.createController(context).then(function (controller) { + if (context.compositionTransactionOwnershipToken) { + return context.compositionTransactionOwnershipToken + .waitForCompositionComplete() + .then(function () { + controller.automate(context.overrideContext, context.owningView); + return _this._swap(context, controller.view); + }) + .then(function () { return controller; }); + } + controller.automate(context.overrideContext, context.owningView); + return _this._swap(context, controller.view).then(function () { return controller; }); + }); + }; + CompositionEngine.prototype.createController = function (context) { + var _this = this; + var childContainer; + var viewModel; + var viewModelResource; + var m; + return this + .ensureViewModel(context) + .then(tryActivateViewModel) + .then(function () { + childContainer = context.childContainer; + viewModel = context.viewModel; + viewModelResource = context.viewModelResource; + m = viewModelResource.metadata; + var viewStrategy = _this.viewLocator.getViewStrategy(context.view || viewModel); + if (context.viewResources) { + viewStrategy.makeRelativeTo(context.viewResources.viewUrl); + } + return m.load(childContainer, viewModelResource.value, null, viewStrategy, true); + }).then(function (viewFactory) { return m.create(childContainer, BehaviorInstruction.dynamic(context.host, viewModel, viewFactory)); }); + }; + CompositionEngine.prototype.ensureViewModel = function (context) { + var childContainer = context.childContainer = (context.childContainer || context.container.createChild()); + if (typeof context.viewModel === 'string') { + context.viewModel = context.viewResources + ? context.viewResources.relativeToView(context.viewModel) + : context.viewModel; + return this.viewEngine.importViewModelResource(context.viewModel).then(function (viewModelResource) { + childContainer.autoRegister(viewModelResource.value); + if (context.host) { + childContainer.registerInstance(aureliaPal.DOM.Element, context.host); + } + context.viewModel = childContainer.viewModel = childContainer.get(viewModelResource.value); + context.viewModelResource = viewModelResource; + return context; + }); + } + var ctor = context.viewModel.constructor; + var isClass = typeof context.viewModel === 'function'; + if (isClass) { + ctor = context.viewModel; + childContainer.autoRegister(ctor); + } + var m = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, HtmlBehaviorResource, ctor); + m.elementName = m.elementName || 'dynamic-element'; + m.initialize(isClass ? childContainer : (context.container || childContainer), ctor); + context.viewModelResource = { metadata: m, value: ctor }; + if (context.host) { + childContainer.registerInstance(aureliaPal.DOM.Element, context.host); + } + childContainer.viewModel = context.viewModel = isClass ? childContainer.get(ctor) : context.viewModel; + return Promise.resolve(context); + }; + CompositionEngine.prototype.compose = function (context) { + var _this = this; + context.childContainer = context.childContainer || context.container.createChild(); + context.view = this.viewLocator.getViewStrategy(context.view); + var transaction = context.childContainer.get(CompositionTransaction); + var compositionTransactionOwnershipToken = transaction.tryCapture(); + if (compositionTransactionOwnershipToken) { + context.compositionTransactionOwnershipToken = compositionTransactionOwnershipToken; + } + else { + context.compositionTransactionNotifier = transaction.enlist(); + } + if (context.viewModel) { + return this._createControllerAndSwap(context); + } + else if (context.view) { + if (context.viewResources) { + context.view.makeRelativeTo(context.viewResources.viewUrl); + } + return context.view.loadViewFactory(this.viewEngine, new ViewCompileInstruction()).then(function (viewFactory) { + var result = viewFactory.create(context.childContainer); + result.bind(context.bindingContext, context.overrideContext); + if (context.compositionTransactionOwnershipToken) { + return context.compositionTransactionOwnershipToken.waitForCompositionComplete() + .then(function () { return _this._swap(context, result); }) + .then(function () { return result; }); + } + return _this._swap(context, result).then(function () { return result; }); + }); + } + else if (context.viewSlot) { + context.viewSlot.removeAll(); + if (context.compositionTransactionNotifier) { + context.compositionTransactionNotifier.done(); + } + return Promise.resolve(null); + } + return Promise.resolve(null); + }; + CompositionEngine = __decorate([ + aureliaDependencyInjection.inject(ViewEngine, ViewLocator) + ], CompositionEngine); + return CompositionEngine; +}()); - this.metadata = resourceTypeMeta; - this.value = exportedValue; - } - - ResourceDescription.prototype.initialize = function initialize(container) { - this.metadata.initialize(container, this.value); - }; +var animationEvent = { + enterBegin: 'animation:enter:begin', + enterActive: 'animation:enter:active', + enterDone: 'animation:enter:done', + enterTimeout: 'animation:enter:timeout', + leaveBegin: 'animation:leave:begin', + leaveActive: 'animation:leave:active', + leaveDone: 'animation:leave:done', + leaveTimeout: 'animation:leave:timeout', + staggerNext: 'animation:stagger:next', + removeClassBegin: 'animation:remove-class:begin', + removeClassActive: 'animation:remove-class:active', + removeClassDone: 'animation:remove-class:done', + removeClassTimeout: 'animation:remove-class:timeout', + addClassBegin: 'animation:add-class:begin', + addClassActive: 'animation:add-class:active', + addClassDone: 'animation:add-class:done', + addClassTimeout: 'animation:add-class:timeout', + animateBegin: 'animation:animate:begin', + animateActive: 'animation:animate:active', + animateDone: 'animation:animate:done', + animateTimeout: 'animation:animate:timeout', + sequenceBegin: 'animation:sequence:begin', + sequenceDone: 'animation:sequence:done' +}; - ResourceDescription.prototype.register = function register(registry, name) { - this.metadata.register(registry, name); - }; +function createChildObserverDecorator(selectorOrConfig, all) { + return function (target, key, descriptor) { + var actualTarget = typeof key === 'string' ? target.constructor : target; + var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, HtmlBehaviorResource, actualTarget); + if (typeof selectorOrConfig === 'string') { + selectorOrConfig = { + selector: selectorOrConfig, + name: key + }; + } + if (descriptor) { + descriptor.writable = true; + descriptor.configurable = true; + } + selectorOrConfig.all = all; + r.addChildBinding(new ChildObserver(selectorOrConfig)); + }; +} +function children(selectorOrConfig) { + return createChildObserverDecorator(selectorOrConfig, true); +} +function child(selectorOrConfig) { + return createChildObserverDecorator(selectorOrConfig, false); +} +var ChildObserver = (function () { + function ChildObserver(config) { + this.name = config.name; + this.changeHandler = config.changeHandler || this.name + 'Changed'; + this.selector = config.selector; + this.all = config.all; + } + ChildObserver.prototype.create = function (viewHost, viewModel, controller) { + return new ChildObserverBinder(this.selector, viewHost, this.name, viewModel, controller, this.changeHandler, this.all); + }; + return ChildObserver; +}()); +var noMutations = []; +function trackMutation(groupedMutations, binder, record) { + var mutations = groupedMutations.get(binder); + if (!mutations) { + mutations = []; + groupedMutations.set(binder, mutations); + } + mutations.push(record); +} +function onChildChange(mutations, observer) { + var binders = observer.binders; + var bindersLength = binders.length; + var groupedMutations = new Map(); + for (var i = 0, ii = mutations.length; i < ii; ++i) { + var record = mutations[i]; + var added = record.addedNodes; + var removed = record.removedNodes; + for (var j = 0, jj = removed.length; j < jj; ++j) { + var node = removed[j]; + if (node.nodeType === 1) { + for (var k = 0; k < bindersLength; ++k) { + var binder = binders[k]; + if (binder.onRemove(node)) { + trackMutation(groupedMutations, binder, record); + } + } + } + } + for (var j = 0, jj = added.length; j < jj; ++j) { + var node = added[j]; + if (node.nodeType === 1) { + for (var k = 0; k < bindersLength; ++k) { + var binder = binders[k]; + if (binder.onAdd(node)) { + trackMutation(groupedMutations, binder, record); + } + } + } + } + } + groupedMutations.forEach(function (mutationRecords, binder) { + if (binder.isBound && binder.changeHandler !== null) { + binder.viewModel[binder.changeHandler](mutationRecords); + } + }); +} +var ChildObserverBinder = (function () { + function ChildObserverBinder(selector, viewHost, property, viewModel, controller, changeHandler, all) { + this.selector = selector; + this.viewHost = viewHost; + this.property = property; + this.viewModel = viewModel; + this.controller = controller; + this.changeHandler = changeHandler in viewModel ? changeHandler : null; + this.usesShadowDOM = controller.behavior.usesShadowDOM; + this.all = all; + if (!this.usesShadowDOM && controller.view && controller.view.contentView) { + this.contentView = controller.view.contentView; + } + else { + this.contentView = null; + } + this.source = null; + this.isBound = false; + } + ChildObserverBinder.prototype.matches = function (element) { + if (element.matches(this.selector)) { + if (this.contentView === null) { + return true; + } + var contentView = this.contentView; + var assignedSlot = element.auAssignedSlot; + if (assignedSlot && assignedSlot.projectFromAnchors) { + var anchors = assignedSlot.projectFromAnchors; + for (var i = 0, ii = anchors.length; i < ii; ++i) { + if (anchors[i].auOwnerView === contentView) { + return true; + } + } + return false; + } + return element.auOwnerView === contentView; + } + return false; + }; + ChildObserverBinder.prototype.bind = function (source) { + if (this.isBound) { + if (this.source === source) { + return; + } + this.source = source; + } + this.isBound = true; + var viewHost = this.viewHost; + var viewModel = this.viewModel; + var observer = viewHost.__childObserver__; + if (!observer) { + observer = viewHost.__childObserver__ = aureliaPal.DOM.createMutationObserver(onChildChange); + var options = { + childList: true, + subtree: !this.usesShadowDOM + }; + observer.observe(viewHost, options); + observer.binders = []; + } + observer.binders.push(this); + if (this.usesShadowDOM) { + var current = viewHost.firstElementChild; + if (this.all) { + var items = viewModel[this.property]; + if (!items) { + items = viewModel[this.property] = []; + } + else { + items.splice(0); + } + while (current) { + if (this.matches(current)) { + items.push(current.au && current.au.controller ? current.au.controller.viewModel : current); + } + current = current.nextElementSibling; + } + if (this.changeHandler !== null) { + this.viewModel[this.changeHandler](noMutations); + } + } + else { + while (current) { + if (this.matches(current)) { + var value = current.au && current.au.controller ? current.au.controller.viewModel : current; + this.viewModel[this.property] = value; + if (this.changeHandler !== null) { + this.viewModel[this.changeHandler](value); + } + break; + } + current = current.nextElementSibling; + } + } + } + }; + ChildObserverBinder.prototype.onRemove = function (element) { + if (this.matches(element)) { + var value = element.au && element.au.controller ? element.au.controller.viewModel : element; + if (this.all) { + var items = (this.viewModel[this.property] || (this.viewModel[this.property] = [])); + var index = items.indexOf(value); + if (index !== -1) { + items.splice(index, 1); + } + return true; + } + var currentValue = this.viewModel[this.property]; + if (currentValue === value) { + this.viewModel[this.property] = null; + if (this.isBound && this.changeHandler !== null) { + this.viewModel[this.changeHandler](value); + } + } + } + return false; + }; + ChildObserverBinder.prototype.onAdd = function (element) { + if (this.matches(element)) { + var value = element.au && element.au.controller ? element.au.controller.viewModel : element; + if (this.all) { + var items = (this.viewModel[this.property] || (this.viewModel[this.property] = [])); + if (this.selector === '*') { + items.push(value); + return true; + } + var index = 0; + var prev = element.previousElementSibling; + while (prev) { + if (this.matches(prev)) { + index++; + } + prev = prev.previousElementSibling; + } + items.splice(index, 0, value); + return true; + } + this.viewModel[this.property] = value; + if (this.isBound && this.changeHandler !== null) { + this.viewModel[this.changeHandler](value); + } + } + return false; + }; + ChildObserverBinder.prototype.unbind = function () { + if (!this.isBound) { + return; + } + this.isBound = false; + this.source = null; + var childObserver = this.viewHost.__childObserver__; + if (childObserver) { + var binders = childObserver.binders; + if (binders && binders.length) { + var idx = binders.indexOf(this); + if (idx !== -1) { + binders.splice(idx, 1); + } + if (binders.length === 0) { + childObserver.disconnect(); + this.viewHost.__childObserver__ = null; + } + } + if (this.usesShadowDOM) { + this.viewModel[this.property] = null; + } + } + }; + return ChildObserverBinder; +}()); - ResourceDescription.prototype.load = function load(container, loadContext) { - return this.metadata.load(container, this.value, loadContext); - }; +var ElementConfigResource = (function () { + function ElementConfigResource() { + } + ElementConfigResource.prototype.initialize = function (container, target) { }; + ElementConfigResource.prototype.register = function (registry, name) { }; + ElementConfigResource.prototype.load = function (container, target) { + var config = new target(); + var eventManager = container.get(aureliaBinding.EventManager); + eventManager.registerElementConfig(config); + }; + return ElementConfigResource; +}()); - return ResourceDescription; -}(); +function resource(instanceOrConfig) { + return function (target) { + var isConfig = typeof instanceOrConfig === 'string' || Object.getPrototypeOf(instanceOrConfig) === Object.prototype; + if (isConfig) { + target.$resource = instanceOrConfig; + } + else { + aureliaMetadata.metadata.define(aureliaMetadata.metadata.resource, instanceOrConfig, target); + } + }; +} +function behavior(override) { + return function (target) { + if (override instanceof HtmlBehaviorResource) { + aureliaMetadata.metadata.define(aureliaMetadata.metadata.resource, override, target); + } + else { + var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, HtmlBehaviorResource, target); + Object.assign(r, override); + } + }; +} +function customElement(name) { + return function (target) { + var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, HtmlBehaviorResource, target); + r.elementName = validateBehaviorName(name, 'custom element'); + }; +} +function customAttribute(name, defaultBindingMode, aliases) { + return function (target) { + var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, HtmlBehaviorResource, target); + r.attributeName = validateBehaviorName(name, 'custom attribute'); + r.attributeDefaultBindingMode = defaultBindingMode; + r.aliases = aliases; + }; +} +function templateController(target) { + var deco = function (t) { + var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, HtmlBehaviorResource, t); + r.liftsContent = true; + }; + return target ? deco(target) : deco; +} +function bindable(nameOrConfigOrTarget, key, descriptor) { + var deco = function (target, key2, descriptor2) { + var actualTarget = key2 ? target.constructor : target; + var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, HtmlBehaviorResource, actualTarget); + var prop; + if (key2) { + nameOrConfigOrTarget = nameOrConfigOrTarget || {}; + nameOrConfigOrTarget.name = key2; + } + prop = new BindableProperty(nameOrConfigOrTarget); + return prop.registerWith(actualTarget, r, descriptor2); + }; + if (!nameOrConfigOrTarget) { + return deco; + } + if (key) { + var target = nameOrConfigOrTarget; + nameOrConfigOrTarget = null; + return deco(target, key, descriptor); + } + return deco; +} +function dynamicOptions(target) { + var deco = function (t) { + var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, HtmlBehaviorResource, t); + r.hasDynamicOptions = true; + }; + return target ? deco(target) : deco; +} +var defaultShadowDOMOptions = { mode: 'open' }; +function useShadowDOM(targetOrOptions) { + var options = typeof targetOrOptions === 'function' || !targetOrOptions + ? defaultShadowDOMOptions + : targetOrOptions; + var deco = function (t) { + var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, HtmlBehaviorResource, t); + r.targetShadowDOM = true; + r.shadowDOMOptions = options; + }; + return typeof targetOrOptions === 'function' ? deco(targetOrOptions) : deco; +} +function processAttributes(processor) { + return function (t) { + var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, HtmlBehaviorResource, t); + r.processAttributes = function (compiler, resources, node, attributes, elementInstruction) { + try { + processor(compiler, resources, node, attributes, elementInstruction); + } + catch (error) { + LogManager__namespace.getLogger('templating').error(error); + } + }; + }; +} +function doNotProcessContent() { return false; } +function processContent(processor) { + return function (t) { + var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, HtmlBehaviorResource, t); + r.processContent = processor ? function (compiler, resources, node, instruction) { + try { + return processor(compiler, resources, node, instruction); + } + catch (error) { + LogManager__namespace.getLogger('templating').error(error); + return false; + } + } : doNotProcessContent; + }; +} +function containerless(target) { + var deco = function (t) { + var r = aureliaMetadata.metadata.getOrCreateOwn(aureliaMetadata.metadata.resource, HtmlBehaviorResource, t); + r.containerless = true; + }; + return target ? deco(target) : deco; +} +function useViewStrategy(strategy) { + return function (target) { + aureliaMetadata.metadata.define(ViewLocator.viewStrategyMetadataKey, strategy, target); + }; +} +function useView(path) { + return useViewStrategy(new RelativeViewStrategy(path)); +} +function inlineView(markup, dependencies, dependencyBaseUrl) { + return useViewStrategy(new InlineViewStrategy(markup, dependencies, dependencyBaseUrl)); +} +function noView(targetOrDependencies, dependencyBaseUrl) { + var target; + var dependencies; + if (typeof targetOrDependencies === 'function') { + target = targetOrDependencies; + } + else { + dependencies = targetOrDependencies; + target = undefined; + } + var deco = function (t) { + aureliaMetadata.metadata.define(ViewLocator.viewStrategyMetadataKey, new NoViewStrategy(dependencies, dependencyBaseUrl), t); + }; + return target ? deco(target) : deco; +} +function view(templateOrConfig) { + return function (target) { + target.$view = templateOrConfig; + }; +} +function elementConfig(target) { + var deco = function (t) { + aureliaMetadata.metadata.define(aureliaMetadata.metadata.resource, new ElementConfigResource(), t); + }; + return target ? deco(target) : deco; +} +function viewResources() { + var resources = []; + for (var _i = 0; _i < arguments.length; _i++) { + resources[_i] = arguments[_i]; + } + return function (target) { + aureliaMetadata.metadata.define(ViewEngine.viewModelRequireMetadataKey, resources, target); + }; +} -var ModuleAnalyzer = exports.ModuleAnalyzer = function () { - function ModuleAnalyzer() { - +var TemplatingEngine = (function () { + function TemplatingEngine(container, moduleAnalyzer, viewCompiler, compositionEngine) { + this._container = container; + this._moduleAnalyzer = moduleAnalyzer; + this._viewCompiler = viewCompiler; + this._compositionEngine = compositionEngine; + container.registerInstance(Animator, Animator.instance = new Animator()); + } + TemplatingEngine.prototype.configureAnimator = function (animator) { + this._container.unregister(Animator); + this._container.registerInstance(Animator, Animator.instance = animator); + }; + TemplatingEngine.prototype.compose = function (context) { + return this._compositionEngine.compose(context); + }; + TemplatingEngine.prototype.enhance = function (instruction) { + if (instruction instanceof aureliaPal.DOM.Element) { + instruction = { element: instruction }; + } + var compilerInstructions = { letExpressions: [] }; + var resources = instruction.resources || this._container.get(ViewResources); + this._viewCompiler._compileNode(instruction.element, resources, compilerInstructions, instruction.element.parentNode, 'root', true); + var factory = new ViewFactory(instruction.element, compilerInstructions, resources); + var container = instruction.container || this._container.createChild(); + var view = factory.create(container, BehaviorInstruction.enhance()); + view.bind(instruction.bindingContext || {}, instruction.overrideContext); + view.firstChild = view.lastChild = view.fragment; + view.fragment = aureliaPal.DOM.createDocumentFragment(); + view.attached(); + return view; + }; + TemplatingEngine.inject = [aureliaDependencyInjection.Container, ModuleAnalyzer, ViewCompiler, CompositionEngine]; + return TemplatingEngine; +}()); - this.cache = Object.create(null); - } +exports.Animator = Animator; +exports.BehaviorInstruction = BehaviorInstruction; +exports.BehaviorPropertyObserver = BehaviorPropertyObserver; +exports.BindableProperty = BindableProperty; +exports.BindingLanguage = BindingLanguage; +exports.BoundViewFactory = BoundViewFactory; +exports.CompositionEngine = CompositionEngine; +exports.CompositionTransaction = CompositionTransaction; +exports.CompositionTransactionNotifier = CompositionTransactionNotifier; +exports.CompositionTransactionOwnershipToken = CompositionTransactionOwnershipToken; +exports.Controller = Controller; +exports.ConventionalViewStrategy = ConventionalViewStrategy; +exports.ElementConfigResource = ElementConfigResource; +exports.ElementEvents = ElementEvents; +exports.HtmlBehaviorResource = HtmlBehaviorResource; +exports.InlineViewStrategy = InlineViewStrategy; +exports.ModuleAnalyzer = ModuleAnalyzer; +exports.NoViewStrategy = NoViewStrategy; +exports.PassThroughSlot = PassThroughSlot; +exports.RelativeViewStrategy = RelativeViewStrategy; +exports.ResourceDescription = ResourceDescription; +exports.ResourceLoadContext = ResourceLoadContext; +exports.ResourceModule = ResourceModule; +exports.ShadowDOM = ShadowDOM; +exports.ShadowSlot = ShadowSlot; +exports.SlotCustomAttribute = SlotCustomAttribute; +exports.StaticViewStrategy = StaticViewStrategy; +exports.SwapStrategies = SwapStrategies; +exports.TargetInstruction = TargetInstruction; +exports.TemplateRegistryViewStrategy = TemplateRegistryViewStrategy; +exports.TemplatingEngine = TemplatingEngine; +exports.View = View; +exports.ViewCompileInstruction = ViewCompileInstruction; +exports.ViewCompiler = ViewCompiler; +exports.ViewEngine = ViewEngine; +exports.ViewEngineHooksResource = ViewEngineHooksResource; +exports.ViewFactory = ViewFactory; +exports.ViewLocator = ViewLocator; +exports.ViewResources = ViewResources; +exports.ViewSlot = ViewSlot; +exports._hyphenate = _hyphenate; +exports._isAllWhitespace = _isAllWhitespace; +exports.animationEvent = animationEvent; +exports.behavior = behavior; +exports.bindable = bindable; +exports.child = child; +exports.children = children; +exports.containerless = containerless; +exports.customAttribute = customAttribute; +exports.customElement = customElement; +exports.dynamicOptions = dynamicOptions; +exports.elementConfig = elementConfig; +exports.inlineView = inlineView; +exports.noView = noView; +exports.processAttributes = processAttributes; +exports.processContent = processContent; +exports.resource = resource; +exports.templateController = templateController; +exports.useShadowDOM = useShadowDOM; +exports.useView = useView; +exports.useViewStrategy = useViewStrategy; +exports.validateBehaviorName = validateBehaviorName; +exports.view = view; +exports.viewEngineHooks = viewEngineHooks; +exports.viewResources = viewResources; +exports.viewStrategy = viewStrategy; - ModuleAnalyzer.prototype.getAnalysis = function getAnalysis(moduleId) { - return this.cache[moduleId]; - }; - ModuleAnalyzer.prototype.analyze = function analyze(moduleId, moduleInstance, mainResourceKey) { - var mainResource = void 0; - var fallbackValue = void 0; - var fallbackKey = void 0; - var resourceTypeMeta = void 0; - var key = void 0; - var exportedValue = void 0; - var resources = []; - var conventional = void 0; - var vs = void 0; - var resourceModule = void 0; +}); +; +define('aurelia-testing/dist/commonjs/aurelia-testing',['require','exports','module','aurelia-templating','aurelia-logging','aurelia-pal'],function (require, exports, module) {'use strict'; - resourceModule = this.cache[moduleId]; - if (resourceModule) { - return resourceModule; - } +Object.defineProperty(exports, '__esModule', { value: true }); - resourceModule = new ResourceModule(moduleId); - this.cache[moduleId] = resourceModule; +var aureliaTemplating = require('aurelia-templating'); +var aureliaLogging = require('aurelia-logging'); +var aureliaPal = require('aurelia-pal'); - if (typeof moduleInstance === 'function') { - moduleInstance = { 'default': moduleInstance }; +var CompileSpy = (function () { + function CompileSpy(element, instruction) { + aureliaLogging.getLogger('compile-spy').info(element.toString(), instruction); } + Object.defineProperty(CompileSpy, "inject", { + get: function () { return [aureliaPal.DOM.Element, aureliaTemplating.TargetInstruction]; }, + enumerable: false, + configurable: true + }); + CompileSpy.$resource = { + type: 'attribute', + name: 'compile-spy' + }; + return CompileSpy; +}()); - if (mainResourceKey) { - mainResource = new ResourceDescription(mainResourceKey, moduleInstance[mainResourceKey]); +var ViewSpy = (function () { + function ViewSpy() { + this.logger = aureliaLogging.getLogger('view-spy'); } + ViewSpy.prototype._log = function (lifecycleName, context) { + if (!this.value && lifecycleName === 'created') { + this.logger.info(lifecycleName, this.view); + } + else if (this.value && this.value.indexOf(lifecycleName) !== -1) { + this.logger.info(lifecycleName, this.view, context); + } + }; + ViewSpy.prototype.created = function (view) { + this.view = view; + this._log('created'); + }; + ViewSpy.prototype.bind = function (bindingContext) { + this._log('bind', bindingContext); + }; + ViewSpy.prototype.attached = function () { + this._log('attached'); + }; + ViewSpy.prototype.detached = function () { + this._log('detached'); + }; + ViewSpy.prototype.unbind = function () { + this._log('unbind'); + }; + ViewSpy.$resource = { + type: 'attribute', + name: 'view-spy' + }; + return ViewSpy; +}()); - for (key in moduleInstance) { - exportedValue = moduleInstance[key]; - - if (key === mainResourceKey || typeof exportedValue !== 'function') { - continue; - } - - resourceTypeMeta = _aureliaMetadata.metadata.get(_aureliaMetadata.metadata.resource, exportedValue); - - if (resourceTypeMeta) { - if (resourceTypeMeta instanceof HtmlBehaviorResource) { - ViewResources.convention(exportedValue, resourceTypeMeta); +/****************************************************************************** +Copyright (c) Microsoft Corporation. - if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) { - HtmlBehaviorResource.convention(key, resourceTypeMeta); - } +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. - if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) { - resourceTypeMeta.elementName = _hyphenate(key); - } - } +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ - if (!mainResource && resourceTypeMeta instanceof HtmlBehaviorResource && resourceTypeMeta.elementName !== null) { - mainResource = new ResourceDescription(key, exportedValue, resourceTypeMeta); - } else { - resources.push(new ResourceDescription(key, exportedValue, resourceTypeMeta)); +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } - } else if (viewStrategy.decorates(exportedValue)) { - vs = exportedValue; - } else if (exportedValue instanceof _aureliaLoader.TemplateRegistryEntry) { - vs = new TemplateRegistryViewStrategy(moduleId, exportedValue); - } else { - if (conventional = ViewResources.convention(exportedValue)) { - if (conventional.elementName !== null && !mainResource) { - mainResource = new ResourceDescription(key, exportedValue, conventional); - } else { - resources.push(new ResourceDescription(key, exportedValue, conventional)); - } - _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, conventional, exportedValue); - } else if (conventional = HtmlBehaviorResource.convention(key)) { - if (conventional.elementName !== null && !mainResource) { - mainResource = new ResourceDescription(key, exportedValue, conventional); - } else { - resources.push(new ResourceDescription(key, exportedValue, conventional)); - } + return t; + }; + return __assign.apply(this, arguments); +}; - _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, conventional, exportedValue); - } else if (conventional = _aureliaBinding.ValueConverterResource.convention(key) || _aureliaBinding.BindingBehaviorResource.convention(key) || ViewEngineHooksResource.convention(key)) { - resources.push(new ResourceDescription(key, exportedValue, conventional)); - _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, conventional, exportedValue); - } else if (!fallbackValue) { - fallbackValue = exportedValue; - fallbackKey = key; +function waitFor(getter, options) { + if (options === void 0) { options = { present: true, interval: 50, timeout: 5000 }; } + var timedOut = false; + options = __assign({ present: true, interval: 50, timeout: 5000 }, options); + function wait() { + var element = getter(); + var found = element !== null && (!(element instanceof NodeList) && + !element.jquery || element.length > 0); + if (!options.present === !found || timedOut) { + return Promise.resolve(element); } - } + return new Promise(function (rs) { return setTimeout(rs, options.interval); }).then(wait); } + return Promise.race([ + new Promise(function (_, rj) { return setTimeout(function () { + timedOut = true; + rj(new Error(options.present ? 'Element not found' : 'Element not removed')); + }, options.timeout); }), + wait() + ]); +} +function waitForDocumentElement(selector, options) { + return waitFor(function () { return document.querySelector(selector); }, options); +} +function waitForDocumentElements(selector, options) { + return waitFor(function () { return document.querySelectorAll(selector); }, options); +} - if (!mainResource && fallbackValue) { - mainResource = new ResourceDescription(fallbackKey, fallbackValue); +var StageComponent = (function () { + function StageComponent() { } + StageComponent.withResources = function (resources) { + if (resources === void 0) { resources = []; } + return new ComponentTester().withResources(resources); + }; + return StageComponent; +}()); +var ComponentTester = (function () { + function ComponentTester() { + this.resources = []; + } + ComponentTester.prototype.configure = function (aurelia) { + return aurelia.use.standardConfiguration(); + }; + ComponentTester.prototype.bootstrap = function (configure) { + this.configure = configure; + }; + ComponentTester.prototype.withResources = function (resources) { + this.resources = resources; + return this; + }; + ComponentTester.prototype.inView = function (html) { + this.html = html; + return this; + }; + ComponentTester.prototype.boundTo = function (bindingContext) { + this.bindingContext = bindingContext; + return this; + }; + ComponentTester.prototype.manuallyHandleLifecycle = function () { + this._prepareLifecycle(); + return this; + }; + ComponentTester.prototype.create = function (bootstrap) { + var _this = this; + return bootstrap(function (aurelia) { + return Promise.resolve(_this.configure(aurelia)).then(function () { + if (_this.resources) { + aurelia.use.globalResources(_this.resources); + } + return aurelia.start().then(function () { + _this.host = document.createElement('div'); + _this.host.innerHTML = _this.html; + document.body.appendChild(_this.host); + return aurelia.enhance(_this.bindingContext, _this.host).then(function () { + _this.rootView = aurelia.root; + _this.element = _this.host.firstElementChild; + if (aurelia.root.controllers.length) { + _this.viewModel = aurelia.root.controllers[0].viewModel; + } + return new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, 0); }); + }); + }); + }); + }); + }; + ComponentTester.prototype.dispose = function () { + if (this.host === undefined || this.rootView === undefined) { + throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()'); + } + this.rootView.detached(); + this.rootView.unbind(); + return this.host.parentNode.removeChild(this.host); + }; + ComponentTester.prototype._prepareLifecycle = function () { + var _this = this; + var bindPrototype = aureliaTemplating.View.prototype.bind; + aureliaTemplating.View.prototype.bind = function () { }; + this.bind = function (bindingContext) { return new Promise(function (resolve) { + aureliaTemplating.View.prototype.bind = bindPrototype; + if (bindingContext !== undefined) { + _this.bindingContext = bindingContext; + } + _this.rootView.bind(_this.bindingContext); + setTimeout(function () { return resolve(); }, 0); + }); }; + var attachedPrototype = aureliaTemplating.View.prototype.attached; + aureliaTemplating.View.prototype.attached = function () { }; + this.attached = function () { return new Promise(function (resolve) { + aureliaTemplating.View.prototype.attached = attachedPrototype; + _this.rootView.attached(); + setTimeout(function () { return resolve(); }, 0); + }); }; + this.detached = function () { return new Promise(function (resolve) { + _this.rootView.detached(); + setTimeout(function () { return resolve(); }, 0); + }); }; + this.unbind = function () { return new Promise(function (resolve) { + _this.rootView.unbind(); + setTimeout(function () { return resolve(); }, 0); + }); }; + }; + ComponentTester.prototype.waitForElement = function (selector, options) { + var _this = this; + return waitFor(function () { return _this.element.querySelector(selector); }, options); + }; + ComponentTester.prototype.waitForElements = function (selector, options) { + var _this = this; + return waitFor(function () { return _this.element.querySelectorAll(selector); }, options); + }; + return ComponentTester; +}()); - resourceModule.moduleInstance = moduleInstance; - resourceModule.mainResource = mainResource; - resourceModule.resources = resources; - resourceModule.viewStrategy = vs; - - return resourceModule; - }; +function configure(config) { + config.globalResources([CompileSpy, ViewSpy]); +} - return ModuleAnalyzer; -}(); +exports.CompileSpy = CompileSpy; +exports.ComponentTester = ComponentTester; +exports.StageComponent = StageComponent; +exports.ViewSpy = ViewSpy; +exports.configure = configure; +exports.waitFor = waitFor; +exports.waitForDocumentElement = waitForDocumentElement; +exports.waitForDocumentElements = waitForDocumentElements; -var logger = LogManager.getLogger('templating'); -function ensureRegistryEntry(loader, urlOrRegistryEntry) { - if (urlOrRegistryEntry instanceof _aureliaLoader.TemplateRegistryEntry) { - return Promise.resolve(urlOrRegistryEntry); - } +}); +; +/*! + * clipboard.js v2.0.11 + * https://clipboardjs.com/ + * + * Licensed MIT © Zeno Rocha + */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define('clipboard/dist/clipboard',[], factory); + else if(typeof exports === 'object') + exports["ClipboardJS"] = factory(); + else + root["ClipboardJS"] = factory(); +})(this, function() { +return /******/ (function() { // webpackBootstrap +/******/ var __webpack_modules__ = ({ - return loader.loadTemplate(urlOrRegistryEntry); -} +/***/ 686: +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -var ProxyViewFactory = function () { - function ProxyViewFactory(promise) { - var _this8 = this; +"use strict"; - +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + "default": function() { return /* binding */ clipboard; } +}); - promise.then(function (x) { - return _this8.viewFactory = x; - }); +// EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js +var tiny_emitter = __webpack_require__(279); +var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter); +// EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js +var listen = __webpack_require__(370); +var listen_default = /*#__PURE__*/__webpack_require__.n(listen); +// EXTERNAL MODULE: ./node_modules/select/src/select.js +var src_select = __webpack_require__(817); +var select_default = /*#__PURE__*/__webpack_require__.n(src_select); +;// CONCATENATED MODULE: ./src/common/command.js +/** + * Executes a given operation type. + * @param {String} type + * @return {Boolean} + */ +function command(type) { + try { + return document.execCommand(type); + } catch (err) { + return false; } +} +;// CONCATENATED MODULE: ./src/actions/cut.js - ProxyViewFactory.prototype.create = function create(container, bindingContext, createInstruction, element) { - return this.viewFactory.create(container, bindingContext, createInstruction, element); - }; - - ProxyViewFactory.prototype.setCacheSize = function setCacheSize(size, doNotOverrideIfAlreadySet) { - this.viewFactory.setCacheSize(size, doNotOverrideIfAlreadySet); - }; - - ProxyViewFactory.prototype.getCachedView = function getCachedView() { - return this.viewFactory.getCachedView(); - }; - - ProxyViewFactory.prototype.returnViewToCache = function returnViewToCache(view) { - this.viewFactory.returnViewToCache(view); - }; - _createClass(ProxyViewFactory, [{ - key: 'isCaching', - get: function get() { - return this.viewFactory.isCaching; - } - }]); +/** + * Cut action wrapper. + * @param {String|HTMLElement} target + * @return {String} + */ - return ProxyViewFactory; -}(); +var ClipboardActionCut = function ClipboardActionCut(target) { + var selectedText = select_default()(target); + command('cut'); + return selectedText; +}; -var auSlotBehavior = null; +/* harmony default export */ var actions_cut = (ClipboardActionCut); +;// CONCATENATED MODULE: ./src/common/create-fake-element.js +/** + * Creates a fake textarea element with a value. + * @param {String} value + * @return {HTMLElement} + */ +function createFakeElement(value) { + var isRTL = document.documentElement.getAttribute('dir') === 'rtl'; + var fakeElement = document.createElement('textarea'); // Prevent zooming on iOS -var ViewEngine = exports.ViewEngine = (_dec8 = (0, _aureliaDependencyInjection.inject)(_aureliaLoader.Loader, _aureliaDependencyInjection.Container, ViewCompiler, ModuleAnalyzer, ViewResources), _dec8(_class15 = (_temp5 = _class16 = function () { - function ViewEngine(loader, container, viewCompiler, moduleAnalyzer, appResources) { - + fakeElement.style.fontSize = '12pt'; // Reset box model - this.loader = loader; - this.container = container; - this.viewCompiler = viewCompiler; - this.moduleAnalyzer = moduleAnalyzer; - this.appResources = appResources; - this._pluginMap = {}; + fakeElement.style.border = '0'; + fakeElement.style.padding = '0'; + fakeElement.style.margin = '0'; // Move element out of screen horizontally - if (auSlotBehavior === null) { - auSlotBehavior = new HtmlBehaviorResource(); - auSlotBehavior.attributeName = 'au-slot'; - _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, auSlotBehavior, SlotCustomAttribute); - } + fakeElement.style.position = 'absolute'; + fakeElement.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically - auSlotBehavior.initialize(container, SlotCustomAttribute); - auSlotBehavior.register(appResources); - } + var yPosition = window.pageYOffset || document.documentElement.scrollTop; + fakeElement.style.top = "".concat(yPosition, "px"); + fakeElement.setAttribute('readonly', ''); + fakeElement.value = value; + return fakeElement; +} +;// CONCATENATED MODULE: ./src/actions/copy.js - ViewEngine.prototype.addResourcePlugin = function addResourcePlugin(extension, implementation) { - var name = extension.replace('.', '') + '-resource-plugin'; - this._pluginMap[extension] = name; - this.loader.addPlugin(name, implementation); - }; - ViewEngine.prototype.loadViewFactory = function loadViewFactory(urlOrRegistryEntry, compileInstruction, loadContext, target) { - var _this9 = this; - loadContext = loadContext || new ResourceLoadContext(); +/** + * Create fake copy action wrapper using a fake element. + * @param {String} target + * @param {Object} options + * @return {String} + */ - return ensureRegistryEntry(this.loader, urlOrRegistryEntry).then(function (registryEntry) { - var url = registryEntry.address; +var fakeCopyAction = function fakeCopyAction(value, options) { + var fakeElement = createFakeElement(value); + options.container.appendChild(fakeElement); + var selectedText = select_default()(fakeElement); + command('copy'); + fakeElement.remove(); + return selectedText; +}; +/** + * Copy action wrapper. + * @param {String|HTMLElement} target + * @param {Object} options + * @return {String} + */ - if (registryEntry.onReady) { - if (!loadContext.hasDependency(url)) { - loadContext.addDependency(url); - return registryEntry.onReady; - } - if (registryEntry.template === null) { - return registryEntry.onReady; - } +var ClipboardActionCopy = function ClipboardActionCopy(target) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { + container: document.body + }; + var selectedText = ''; - return Promise.resolve(new ProxyViewFactory(registryEntry.onReady)); - } + if (typeof target === 'string') { + selectedText = fakeCopyAction(target, options); + } else if (target instanceof HTMLInputElement && !['text', 'search', 'url', 'tel', 'password'].includes(target === null || target === void 0 ? void 0 : target.type)) { + // If input type doesn't support `setSelectionRange`. Simulate it. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange + selectedText = fakeCopyAction(target.value, options); + } else { + selectedText = select_default()(target); + command('copy'); + } - loadContext.addDependency(url); + return selectedText; +}; - registryEntry.onReady = _this9.loadTemplateResources(registryEntry, compileInstruction, loadContext, target).then(function (resources) { - registryEntry.resources = resources; +/* harmony default export */ var actions_copy = (ClipboardActionCopy); +;// CONCATENATED MODULE: ./src/actions/default.js +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - if (registryEntry.template === null) { - return registryEntry.factory = null; - } - var viewFactory = _this9.viewCompiler.compile(registryEntry.template, resources, compileInstruction); - return registryEntry.factory = viewFactory; - }); - return registryEntry.onReady; - }); - }; +/** + * Inner function which performs selection from either `text` or `target` + * properties and then executes copy or cut operations. + * @param {Object} options + */ - ViewEngine.prototype.loadTemplateResources = function loadTemplateResources(registryEntry, compileInstruction, loadContext, target) { - var resources = new ViewResources(this.appResources, registryEntry.address); - var dependencies = registryEntry.dependencies; - var importIds = void 0; - var names = void 0; +var ClipboardActionDefault = function ClipboardActionDefault() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + // Defines base properties passed from constructor. + var _options$action = options.action, + action = _options$action === void 0 ? 'copy' : _options$action, + container = options.container, + target = options.target, + text = options.text; // Sets the `action` to be performed which can be either 'copy' or 'cut'. - compileInstruction = compileInstruction || ViewCompileInstruction.normal; + if (action !== 'copy' && action !== 'cut') { + throw new Error('Invalid "action" value, use either "copy" or "cut"'); + } // Sets the `target` property using an element that will be have its content copied. - if (dependencies.length === 0 && !compileInstruction.associatedModuleId) { - return Promise.resolve(resources); - } - importIds = dependencies.map(function (x) { - return x.src; - }); - names = dependencies.map(function (x) { - return x.name; - }); - logger.debug('importing resources for ' + registryEntry.address, importIds); - - if (target) { - var viewModelRequires = _aureliaMetadata.metadata.get(ViewEngine.viewModelRequireMetadataKey, target); - if (viewModelRequires) { - var templateImportCount = importIds.length; - for (var i = 0, ii = viewModelRequires.length; i < ii; ++i) { - var req = viewModelRequires[i]; - var importId = typeof req === 'function' ? _aureliaMetadata.Origin.get(req).moduleId : (0, _aureliaPath.relativeToFile)(req.src || req, registryEntry.address); - - if (importIds.indexOf(importId) === -1) { - importIds.push(importId); - names.push(req.as); - } - } - logger.debug('importing ViewModel resources for ' + compileInstruction.associatedModuleId, importIds.slice(templateImportCount)); + if (target !== undefined) { + if (target && _typeof(target) === 'object' && target.nodeType === 1) { + if (action === 'copy' && target.hasAttribute('disabled')) { + throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); } - } - - return this.importViewResources(importIds, names, resources, compileInstruction, loadContext); - }; - - ViewEngine.prototype.importViewModelResource = function importViewModelResource(moduleImport, moduleMember) { - var _this10 = this; - return this.loader.loadModule(moduleImport).then(function (viewModelModule) { - var normalizedId = _aureliaMetadata.Origin.get(viewModelModule).moduleId; - var resourceModule = _this10.moduleAnalyzer.analyze(normalizedId, viewModelModule, moduleMember); - - if (!resourceModule.mainResource) { - throw new Error('No view model found in module "' + moduleImport + '".'); + if (action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { + throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); } + } else { + throw new Error('Invalid "target" value, use a valid Element'); + } + } // Define selection strategy based on `text` property. - resourceModule.initialize(_this10.container); - return resourceModule.mainResource; + if (text) { + return actions_copy(text, { + container: container }); - }; - - ViewEngine.prototype.importViewResources = function importViewResources(moduleIds, names, resources, compileInstruction, loadContext) { - var _this11 = this; + } // Defines which selection strategy based on `target` property. - loadContext = loadContext || new ResourceLoadContext(); - compileInstruction = compileInstruction || ViewCompileInstruction.normal; - moduleIds = moduleIds.map(function (x) { - return _this11._applyLoaderPlugin(x); + if (target) { + return action === 'cut' ? actions_cut(target) : actions_copy(target, { + container: container }); + } +}; - return this.loader.loadAllModules(moduleIds).then(function (imports) { - var i = void 0; - var ii = void 0; - var analysis = void 0; - var normalizedId = void 0; - var current = void 0; - var associatedModule = void 0; - var container = _this11.container; - var moduleAnalyzer = _this11.moduleAnalyzer; - var allAnalysis = new Array(imports.length); - - for (i = 0, ii = imports.length; i < ii; ++i) { - current = imports[i]; - normalizedId = _aureliaMetadata.Origin.get(current).moduleId; +/* harmony default export */ var actions_default = (ClipboardActionDefault); +;// CONCATENATED MODULE: ./src/clipboard.js +function clipboard_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return clipboard_typeof(obj); } - analysis = moduleAnalyzer.analyze(normalizedId, current); - analysis.initialize(container); - analysis.register(resources, names[i]); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - allAnalysis[i] = analysis; - } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - if (compileInstruction.associatedModuleId) { - associatedModule = moduleAnalyzer.getAnalysis(compileInstruction.associatedModuleId); +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - if (associatedModule) { - associatedModule.register(resources); - } - } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - for (i = 0, ii = allAnalysis.length; i < ii; ++i) { - allAnalysis[i] = allAnalysis[i].load(container, loadContext); - } +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - return Promise.all(allAnalysis).then(function () { - return resources; - }); - }); - }; +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - ViewEngine.prototype._applyLoaderPlugin = function _applyLoaderPlugin(id) { - var index = id.lastIndexOf('.'); - if (index !== -1) { - var ext = id.substring(index); - var pluginName = this._pluginMap[ext]; +function _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - if (pluginName === undefined) { - return id; - } +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - return this.loader.applyPluginToUrl(id, pluginName); - } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - return id; - }; +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - return ViewEngine; -}(), _class16.viewModelRequireMetadataKey = 'aurelia:view-model-require', _temp5)) || _class15); -var Controller = exports.Controller = function () { - function Controller(behavior, instruction, viewModel, container) { - - this.behavior = behavior; - this.instruction = instruction; - this.viewModel = viewModel; - this.isAttached = false; - this.view = null; - this.isBound = false; - this.scope = null; - this.container = container; - this.elementEvents = container.elementEvents || null; - - var observerLookup = behavior.observerLocator.getOrCreateObserversLookup(viewModel); - var handlesBind = behavior.handlesBind; - var attributes = instruction.attributes; - var boundProperties = this.boundProperties = []; - var properties = behavior.properties; - var i = void 0; - var ii = void 0; - behavior._ensurePropertiesDefined(viewModel, observerLookup); - for (i = 0, ii = properties.length; i < ii; ++i) { - properties[i]._initialize(viewModel, observerLookup, attributes, handlesBind, boundProperties); - } - } - Controller.prototype.created = function created(owningView) { - if (this.behavior.handlesCreated) { - this.viewModel.created(owningView, this.view); - } - }; +/** + * Helper function to retrieve attribute value. + * @param {String} suffix + * @param {Element} element + */ - Controller.prototype.automate = function automate(overrideContext, owningView) { - this.view.bindingContext = this.viewModel; - this.view.overrideContext = overrideContext || (0, _aureliaBinding.createOverrideContext)(this.viewModel); - this.view._isUserControlled = true; +function getAttributeValue(suffix, element) { + var attribute = "data-clipboard-".concat(suffix); - if (this.behavior.handlesCreated) { - this.viewModel.created(owningView || null, this.view); - } + if (!element.hasAttribute(attribute)) { + return; + } - this.bind(this.view); - }; - - Controller.prototype.bind = function bind(scope) { - var skipSelfSubscriber = this.behavior.handlesBind; - var boundProperties = this.boundProperties; - var i = void 0; - var ii = void 0; - var x = void 0; - var observer = void 0; - var selfSubscriber = void 0; + return element.getAttribute(attribute); +} +/** + * Base class which takes one or more elements, adds event listeners to them, + * and instantiates a new `ClipboardAction` on each click. + */ - if (this.isBound) { - if (this.scope === scope) { - return; - } - this.unbind(); - } +var Clipboard = /*#__PURE__*/function (_Emitter) { + _inherits(Clipboard, _Emitter); - this.isBound = true; - this.scope = scope; + var _super = _createSuper(Clipboard); - for (i = 0, ii = boundProperties.length; i < ii; ++i) { - x = boundProperties[i]; - observer = x.observer; - selfSubscriber = observer.selfSubscriber; - observer.publishing = false; + /** + * @param {String|HTMLElement|HTMLCollection|NodeList} trigger + * @param {Object} options + */ + function Clipboard(trigger, options) { + var _this; - if (skipSelfSubscriber) { - observer.selfSubscriber = null; - } + _classCallCheck(this, Clipboard); - x.binding.bind(scope); - observer.call(); + _this = _super.call(this); - observer.publishing = true; - observer.selfSubscriber = selfSubscriber; - } + _this.resolveOptions(options); - var overrideContext = void 0; - if (this.view !== null) { - if (skipSelfSubscriber) { - this.view.viewModelScope = scope; - } + _this.listenClick(trigger); - if (this.viewModel === scope.overrideContext.bindingContext) { - overrideContext = scope.overrideContext; - } else if (this.instruction.inheritBindingContext) { - overrideContext = (0, _aureliaBinding.createOverrideContext)(this.viewModel, scope.overrideContext); - } else { - overrideContext = (0, _aureliaBinding.createOverrideContext)(this.viewModel); - overrideContext.__parentOverrideContext = scope.overrideContext; - } + return _this; + } + /** + * Defines if attributes would be resolved using internal setter functions + * or custom functions that were passed in the constructor. + * @param {Object} options + */ - this.view.bind(this.viewModel, overrideContext); - } else if (skipSelfSubscriber) { - overrideContext = scope.overrideContext; - if (scope.overrideContext.__parentOverrideContext !== undefined && this.viewModel.viewFactory && this.viewModel.viewFactory.factoryCreateInstruction.partReplacements) { - overrideContext = Object.assign({}, scope.overrideContext); - overrideContext.parentOverrideContext = scope.overrideContext.__parentOverrideContext; - } - this.viewModel.bind(scope.bindingContext, overrideContext); + _createClass(Clipboard, [{ + key: "resolveOptions", + value: function resolveOptions() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + this.action = typeof options.action === 'function' ? options.action : this.defaultAction; + this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; + this.text = typeof options.text === 'function' ? options.text : this.defaultText; + this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body; } - }; - - Controller.prototype.unbind = function unbind() { - if (this.isBound) { - var _boundProperties = this.boundProperties; - var _i3 = void 0; - var _ii2 = void 0; - - this.isBound = false; - this.scope = null; - - if (this.view !== null) { - this.view.unbind(); - } - - if (this.behavior.handlesUnbind) { - this.viewModel.unbind(); - } + /** + * Adds a click event listener to the passed trigger. + * @param {String|HTMLElement|HTMLCollection|NodeList} trigger + */ - if (this.elementEvents !== null) { - this.elementEvents.disposeAll(); - } + }, { + key: "listenClick", + value: function listenClick(trigger) { + var _this2 = this; - for (_i3 = 0, _ii2 = _boundProperties.length; _i3 < _ii2; ++_i3) { - _boundProperties[_i3].binding.unbind(); - } + this.listener = listen_default()(trigger, 'click', function (e) { + return _this2.onClick(e); + }); } - }; + /** + * Defines a new `ClipboardAction` on each click event. + * @param {Event} e + */ - Controller.prototype.attached = function attached() { - if (this.isAttached) { - return; - } + }, { + key: "onClick", + value: function onClick(e) { + var trigger = e.delegateTarget || e.currentTarget; + var action = this.action(trigger) || 'copy'; + var text = actions_default({ + action: action, + container: this.container, + target: this.target(trigger), + text: this.text(trigger) + }); // Fires an event based on the copy operation result. - this.isAttached = true; + this.emit(text ? 'success' : 'error', { + action: action, + text: text, + trigger: trigger, + clearSelection: function clearSelection() { + if (trigger) { + trigger.focus(); + } - if (this.behavior.handlesAttached) { - this.viewModel.attached(); + window.getSelection().removeAllRanges(); + } + }); } + /** + * Default `action` lookup function. + * @param {Element} trigger + */ - if (this.view !== null) { - this.view.attached(); + }, { + key: "defaultAction", + value: function defaultAction(trigger) { + return getAttributeValue('action', trigger); } - }; - - Controller.prototype.detached = function detached() { - if (this.isAttached) { - this.isAttached = false; + /** + * Default `target` lookup function. + * @param {Element} trigger + */ - if (this.view !== null) { - this.view.detached(); - } + }, { + key: "defaultTarget", + value: function defaultTarget(trigger) { + var selector = getAttributeValue('target', trigger); - if (this.behavior.handlesDetached) { - this.viewModel.detached(); + if (selector) { + return document.querySelector(selector); } } - }; - - return Controller; -}(); - -var BehaviorPropertyObserver = exports.BehaviorPropertyObserver = (_dec9 = (0, _aureliaBinding.subscriberCollection)(), _dec9(_class17 = function () { - function BehaviorPropertyObserver(taskQueue, obj, propertyName, selfSubscriber, initialValue) { - - - this.taskQueue = taskQueue; - this.obj = obj; - this.propertyName = propertyName; - this.notqueued = true; - this.publishing = false; - this.selfSubscriber = selfSubscriber; - this.currentValue = this.oldValue = initialValue; - } - - BehaviorPropertyObserver.prototype.getValue = function getValue() { - return this.currentValue; - }; - - BehaviorPropertyObserver.prototype.setValue = function setValue(newValue) { - var oldValue = this.currentValue; + /** + * Allow fire programmatically a copy action + * @param {String|HTMLElement} target + * @param {Object} options + * @returns Text copied. + */ - if (!Object.is(newValue, oldValue)) { - this.oldValue = oldValue; - this.currentValue = newValue; + }, { + key: "defaultText", - if (this.publishing && this.notqueued) { - if (this.taskQueue.flushing) { - this.call(); - } else { - this.notqueued = false; - this.taskQueue.queueMicroTask(this); - } - } + /** + * Default `text` lookup function. + * @param {Element} trigger + */ + value: function defaultText(trigger) { + return getAttributeValue('text', trigger); } - }; - - BehaviorPropertyObserver.prototype.call = function call() { - var oldValue = this.oldValue; - var newValue = this.currentValue; - - this.notqueued = true; + /** + * Destroy lifecycle. + */ - if (Object.is(newValue, oldValue)) { - return; + }, { + key: "destroy", + value: function destroy() { + this.listener.destroy(); } - - if (this.selfSubscriber) { - this.selfSubscriber(newValue, oldValue); + }], [{ + key: "copy", + value: function copy(target) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { + container: document.body + }; + return actions_copy(target, options); } + /** + * Allow fire programmatically a cut action + * @param {String|HTMLElement} target + * @returns Text cutted. + */ - this.callSubscribers(newValue, oldValue); - this.oldValue = newValue; - }; - - BehaviorPropertyObserver.prototype.subscribe = function subscribe(context, callable) { - this.addSubscriber(context, callable); - }; - - BehaviorPropertyObserver.prototype.unsubscribe = function unsubscribe(context, callable) { - this.removeSubscriber(context, callable); - }; - - return BehaviorPropertyObserver; -}()) || _class17); - - -function getObserver(instance, name) { - var lookup = instance.__observers__; - - if (lookup === undefined) { - var ctor = Object.getPrototypeOf(instance).constructor; - var _behavior = _aureliaMetadata.metadata.get(_aureliaMetadata.metadata.resource, ctor); - if (!_behavior.isInitialized) { - _behavior.initialize(_aureliaDependencyInjection.Container.instance || new _aureliaDependencyInjection.Container(), instance.constructor); + }, { + key: "cut", + value: function cut(target) { + return actions_cut(target); } + /** + * Returns the support of the given action, or all actions if no action is + * given. + * @param {String} [action] + */ - lookup = _behavior.observerLocator.getOrCreateObserversLookup(instance); - _behavior._ensurePropertiesDefined(instance, lookup); - } - - return lookup[name]; -} - -var BindableProperty = exports.BindableProperty = function () { - function BindableProperty(nameOrConfig) { - - - if (typeof nameOrConfig === 'string') { - this.name = nameOrConfig; - } else { - Object.assign(this, nameOrConfig); + }, { + key: "isSupported", + value: function isSupported() { + var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut']; + var actions = typeof action === 'string' ? [action] : action; + var support = !!document.queryCommandSupported; + actions.forEach(function (action) { + support = support && !!document.queryCommandSupported(action); + }); + return support; } + }]); - this.attribute = this.attribute || _hyphenate(this.name); - var defaultBindingMode = this.defaultBindingMode; - if (defaultBindingMode === null || defaultBindingMode === undefined) { - this.defaultBindingMode = _aureliaBinding.bindingMode.oneWay; - } else if (typeof defaultBindingMode === 'string') { - this.defaultBindingMode = _aureliaBinding.bindingMode[defaultBindingMode] || _aureliaBinding.bindingMode.oneWay; - } - this.changeHandler = this.changeHandler || null; - this.owner = null; - this.descriptor = null; - } + return Clipboard; +}((tiny_emitter_default())); - BindableProperty.prototype.registerWith = function registerWith(target, behavior, descriptor) { - behavior.properties.push(this); - behavior.attributes[this.attribute] = this; - this.owner = behavior; +/* harmony default export */ var clipboard = (Clipboard); - if (descriptor) { - this.descriptor = descriptor; - return this._configureDescriptor(descriptor); - } +/***/ }), - return undefined; - }; +/***/ 828: +/***/ (function(module) { - BindableProperty.prototype._configureDescriptor = function _configureDescriptor(descriptor) { - var name = this.name; +var DOCUMENT_NODE_TYPE = 9; - descriptor.configurable = true; - descriptor.enumerable = true; +/** + * A polyfill for Element.matches() + */ +if (typeof Element !== 'undefined' && !Element.prototype.matches) { + var proto = Element.prototype; - if ('initializer' in descriptor) { - this.defaultValue = descriptor.initializer; - delete descriptor.initializer; - delete descriptor.writable; - } + proto.matches = proto.matchesSelector || + proto.mozMatchesSelector || + proto.msMatchesSelector || + proto.oMatchesSelector || + proto.webkitMatchesSelector; +} - if ('value' in descriptor) { - this.defaultValue = descriptor.value; - delete descriptor.value; - delete descriptor.writable; +/** + * Finds the closest parent that matches a selector. + * + * @param {Element} element + * @param {String} selector + * @return {Function} + */ +function closest (element, selector) { + while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { + if (typeof element.matches === 'function' && + element.matches(selector)) { + return element; + } + element = element.parentNode; } +} - descriptor.get = function () { - return getObserver(this, name).getValue(); - }; - - descriptor.set = function (value) { - getObserver(this, name).setValue(value); - }; +module.exports = closest; - descriptor.get.getObserver = function (obj) { - return getObserver(obj, name); - }; - return descriptor; - }; +/***/ }), - BindableProperty.prototype.defineOn = function defineOn(target, behavior) { - var name = this.name; - var handlerName = void 0; +/***/ 438: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (this.changeHandler === null) { - handlerName = name + 'Changed'; - if (handlerName in target.prototype) { - this.changeHandler = handlerName; - } - } +var closest = __webpack_require__(828); - if (this.descriptor === null) { - Object.defineProperty(target.prototype, name, this._configureDescriptor(behavior, {})); - } - }; +/** + * Delegates event to a selector. + * + * @param {Element} element + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @param {Boolean} useCapture + * @return {Object} + */ +function _delegate(element, selector, type, callback, useCapture) { + var listenerFn = listener.apply(this, arguments); - BindableProperty.prototype.createObserver = function createObserver(viewModel) { - var selfSubscriber = null; - var defaultValue = this.defaultValue; - var changeHandlerName = this.changeHandler; - var name = this.name; - var initialValue = void 0; + element.addEventListener(type, listenerFn, useCapture); - if (this.hasOptions) { - return undefined; + return { + destroy: function() { + element.removeEventListener(type, listenerFn, useCapture); + } } +} - if (changeHandlerName in viewModel) { - if ('propertyChanged' in viewModel) { - selfSubscriber = function selfSubscriber(newValue, oldValue) { - viewModel[changeHandlerName](newValue, oldValue); - viewModel.propertyChanged(name, newValue, oldValue); - }; - } else { - selfSubscriber = function selfSubscriber(newValue, oldValue) { - return viewModel[changeHandlerName](newValue, oldValue); - }; - } - } else if ('propertyChanged' in viewModel) { - selfSubscriber = function selfSubscriber(newValue, oldValue) { - return viewModel.propertyChanged(name, newValue, oldValue); - }; - } else if (changeHandlerName !== null) { - throw new Error('Change handler ' + changeHandlerName + ' was specified but not declared on the class.'); +/** + * Delegates event to a selector. + * + * @param {Element|String|Array} [elements] + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @param {Boolean} useCapture + * @return {Object} + */ +function delegate(elements, selector, type, callback, useCapture) { + // Handle the regular Element usage + if (typeof elements.addEventListener === 'function') { + return _delegate.apply(null, arguments); } - if (defaultValue !== undefined) { - initialValue = typeof defaultValue === 'function' ? defaultValue.call(viewModel) : defaultValue; + // Handle Element-less usage, it defaults to global delegation + if (typeof type === 'function') { + // Use `document` as the first parameter, then apply arguments + // This is a short way to .unshift `arguments` without running into deoptimizations + return _delegate.bind(null, document).apply(null, arguments); } - return new BehaviorPropertyObserver(this.owner.taskQueue, viewModel, this.name, selfSubscriber, initialValue); - }; - - BindableProperty.prototype._initialize = function _initialize(viewModel, observerLookup, attributes, behaviorHandlesBind, boundProperties) { - var selfSubscriber = void 0; - var observer = void 0; - var attribute = void 0; - var defaultValue = this.defaultValue; - - if (this.isDynamic) { - for (var _key6 in attributes) { - this._createDynamicProperty(viewModel, observerLookup, behaviorHandlesBind, _key6, attributes[_key6], boundProperties); - } - } else if (!this.hasOptions) { - observer = observerLookup[this.name]; + // Handle Selector-based usage + if (typeof elements === 'string') { + elements = document.querySelectorAll(elements); + } - if (attributes !== null) { - selfSubscriber = observer.selfSubscriber; - attribute = attributes[this.attribute]; + // Handle Array-like based usage + return Array.prototype.map.call(elements, function (element) { + return _delegate(element, selector, type, callback, useCapture); + }); +} - if (behaviorHandlesBind) { - observer.selfSubscriber = null; - } +/** + * Finds closest match and invokes callback. + * + * @param {Element} element + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @return {Function} + */ +function listener(element, selector, type, callback) { + return function(e) { + e.delegateTarget = closest(e.target, selector); - if (typeof attribute === 'string') { - viewModel[this.name] = attribute; - observer.call(); - } else if (attribute) { - boundProperties.push({ observer: observer, binding: attribute.createBinding(viewModel) }); - } else if (defaultValue !== undefined) { - observer.call(); + if (e.delegateTarget) { + callback.call(element, e); } - - observer.selfSubscriber = selfSubscriber; - } - - observer.publishing = true; } - }; +} - BindableProperty.prototype._createDynamicProperty = function _createDynamicProperty(viewModel, observerLookup, behaviorHandlesBind, name, attribute, boundProperties) { - var changeHandlerName = name + 'Changed'; - var selfSubscriber = null; - var observer = void 0; - var info = void 0; +module.exports = delegate; - if (changeHandlerName in viewModel) { - if ('propertyChanged' in viewModel) { - selfSubscriber = function selfSubscriber(newValue, oldValue) { - viewModel[changeHandlerName](newValue, oldValue); - viewModel.propertyChanged(name, newValue, oldValue); - }; - } else { - selfSubscriber = function selfSubscriber(newValue, oldValue) { - return viewModel[changeHandlerName](newValue, oldValue); - }; - } - } else if ('propertyChanged' in viewModel) { - selfSubscriber = function selfSubscriber(newValue, oldValue) { - return viewModel.propertyChanged(name, newValue, oldValue); - }; - } - observer = observerLookup[name] = new BehaviorPropertyObserver(this.owner.taskQueue, viewModel, name, selfSubscriber); +/***/ }), - Object.defineProperty(viewModel, name, { - configurable: true, - enumerable: true, - get: observer.getValue.bind(observer), - set: observer.setValue.bind(observer) - }); +/***/ 879: +/***/ (function(__unused_webpack_module, exports) { - if (behaviorHandlesBind) { - observer.selfSubscriber = null; - } +/** + * Check if argument is a HTML element. + * + * @param {Object} value + * @return {Boolean} + */ +exports.node = function(value) { + return value !== undefined + && value instanceof HTMLElement + && value.nodeType === 1; +}; - if (typeof attribute === 'string') { - viewModel[name] = attribute; - observer.call(); - } else if (attribute) { - info = { observer: observer, binding: attribute.createBinding(viewModel) }; - boundProperties.push(info); - } +/** + * Check if argument is a list of HTML elements. + * + * @param {Object} value + * @return {Boolean} + */ +exports.nodeList = function(value) { + var type = Object.prototype.toString.call(value); - observer.publishing = true; - observer.selfSubscriber = selfSubscriber; - }; + return value !== undefined + && (type === '[object NodeList]' || type === '[object HTMLCollection]') + && ('length' in value) + && (value.length === 0 || exports.node(value[0])); +}; - return BindableProperty; -}(); +/** + * Check if argument is a string. + * + * @param {Object} value + * @return {Boolean} + */ +exports.string = function(value) { + return typeof value === 'string' + || value instanceof String; +}; -var lastProviderId = 0; +/** + * Check if argument is a function. + * + * @param {Object} value + * @return {Boolean} + */ +exports.fn = function(value) { + var type = Object.prototype.toString.call(value); -function nextProviderId() { - return ++lastProviderId; -} + return type === '[object Function]'; +}; -function doProcessContent() { - return true; -} -function doProcessAttributes() {} -var HtmlBehaviorResource = exports.HtmlBehaviorResource = function () { - function HtmlBehaviorResource() { - +/***/ }), - this.elementName = null; - this.attributeName = null; - this.attributeDefaultBindingMode = undefined; - this.liftsContent = false; - this.targetShadowDOM = false; - this.shadowDOMOptions = null; - this.processAttributes = doProcessAttributes; - this.processContent = doProcessContent; - this.usesShadowDOM = false; - this.childBindings = null; - this.hasDynamicOptions = false; - this.containerless = false; - this.properties = []; - this.attributes = {}; - this.isInitialized = false; - this.primaryProperty = null; - } +/***/ 370: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - HtmlBehaviorResource.convention = function convention(name, existing) { - var behavior = void 0; +var is = __webpack_require__(879); +var delegate = __webpack_require__(438); - if (name.endsWith('CustomAttribute')) { - behavior = existing || new HtmlBehaviorResource(); - behavior.attributeName = _hyphenate(name.substring(0, name.length - 15)); +/** + * Validates all params and calls the right + * listener function based on its target type. + * + * @param {String|HTMLElement|HTMLCollection|NodeList} target + * @param {String} type + * @param {Function} callback + * @return {Object} + */ +function listen(target, type, callback) { + if (!target && !type && !callback) { + throw new Error('Missing required arguments'); } - if (name.endsWith('CustomElement')) { - behavior = existing || new HtmlBehaviorResource(); - behavior.elementName = _hyphenate(name.substring(0, name.length - 13)); + if (!is.string(type)) { + throw new TypeError('Second argument must be a String'); } - return behavior; - }; - - HtmlBehaviorResource.prototype.addChildBinding = function addChildBinding(behavior) { - if (this.childBindings === null) { - this.childBindings = []; + if (!is.fn(callback)) { + throw new TypeError('Third argument must be a Function'); } - this.childBindings.push(behavior); - }; - - HtmlBehaviorResource.prototype.initialize = function initialize(container, target) { - var proto = target.prototype; - var properties = this.properties; - var attributeName = this.attributeName; - var attributeDefaultBindingMode = this.attributeDefaultBindingMode; - var i = void 0; - var ii = void 0; - var current = void 0; - - if (this.isInitialized) { - return; + if (is.node(target)) { + return listenNode(target, type, callback); } + else if (is.nodeList(target)) { + return listenNodeList(target, type, callback); + } + else if (is.string(target)) { + return listenSelector(target, type, callback); + } + else { + throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList'); + } +} - this.isInitialized = true; - target.__providerId__ = nextProviderId(); - - this.observerLocator = container.get(_aureliaBinding.ObserverLocator); - this.taskQueue = container.get(_aureliaTaskQueue.TaskQueue); - - this.target = target; - this.usesShadowDOM = this.targetShadowDOM && _aureliaPal.FEATURE.shadowDOM; - this.handlesCreated = 'created' in proto; - this.handlesBind = 'bind' in proto; - this.handlesUnbind = 'unbind' in proto; - this.handlesAttached = 'attached' in proto; - this.handlesDetached = 'detached' in proto; - this.htmlName = this.elementName || this.attributeName; - - if (attributeName !== null) { - if (properties.length === 0) { - new BindableProperty({ - name: 'value', - changeHandler: 'valueChanged' in proto ? 'valueChanged' : null, - attribute: attributeName, - defaultBindingMode: attributeDefaultBindingMode - }).registerWith(target, this); - } - - current = properties[0]; +/** + * Adds an event listener to a HTML element + * and returns a remove listener function. + * + * @param {HTMLElement} node + * @param {String} type + * @param {Function} callback + * @return {Object} + */ +function listenNode(node, type, callback) { + node.addEventListener(type, callback); - if (properties.length === 1 && current.name === 'value') { - current.isDynamic = current.hasOptions = this.hasDynamicOptions; - current.defineOn(target, this); - } else { - for (i = 0, ii = properties.length; i < ii; ++i) { - properties[i].defineOn(target, this); - if (properties[i].primaryProperty) { - if (this.primaryProperty) { - throw new Error('Only one bindable property on a custom element can be defined as the default'); - } - this.primaryProperty = properties[i]; - } + return { + destroy: function() { + node.removeEventListener(type, callback); } - - current = new BindableProperty({ - name: 'value', - changeHandler: 'valueChanged' in proto ? 'valueChanged' : null, - attribute: attributeName, - defaultBindingMode: attributeDefaultBindingMode - }); - - current.hasOptions = true; - current.registerWith(target, this); - } - } else { - for (i = 0, ii = properties.length; i < ii; ++i) { - properties[i].defineOn(target, this); - } - - this._copyInheritedProperties(container, target); } - }; - - HtmlBehaviorResource.prototype.register = function register(registry, name) { - var _this12 = this; - - if (this.attributeName !== null) { - registry.registerAttribute(name || this.attributeName, this, this.attributeName); +} - if (Array.isArray(this.aliases)) { - this.aliases.forEach(function (alias) { - registry.registerAttribute(alias, _this12, _this12.attributeName); - }); - } - } +/** + * Add an event listener to a list of HTML elements + * and returns a remove listener function. + * + * @param {NodeList|HTMLCollection} nodeList + * @param {String} type + * @param {Function} callback + * @return {Object} + */ +function listenNodeList(nodeList, type, callback) { + Array.prototype.forEach.call(nodeList, function(node) { + node.addEventListener(type, callback); + }); - if (this.elementName !== null) { - registry.registerElement(name || this.elementName, this); + return { + destroy: function() { + Array.prototype.forEach.call(nodeList, function(node) { + node.removeEventListener(type, callback); + }); + } } - }; - - HtmlBehaviorResource.prototype.load = function load(container, target, loadContext, viewStrategy, transientView) { - var _this13 = this; - - var options = void 0; +} - if (this.elementName !== null) { - viewStrategy = container.get(ViewLocator).getViewStrategy(viewStrategy || this.viewStrategy || target); - options = new ViewCompileInstruction(this.targetShadowDOM, true); +/** + * Add an event listener to a selector + * and returns a remove listener function. + * + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @return {Object} + */ +function listenSelector(selector, type, callback) { + return delegate(document.body, selector, type, callback); +} - if (!viewStrategy.moduleId) { - viewStrategy.moduleId = _aureliaMetadata.Origin.get(target).moduleId; - } +module.exports = listen; - return viewStrategy.loadViewFactory(container.get(ViewEngine), options, loadContext, target).then(function (viewFactory) { - if (!transientView || !_this13.viewFactory) { - _this13.viewFactory = viewFactory; - } - return viewFactory; - }); - } +/***/ }), - return Promise.resolve(this); - }; +/***/ 817: +/***/ (function(module) { - HtmlBehaviorResource.prototype.compile = function compile(compiler, resources, node, instruction, parentNode) { - if (this.liftsContent) { - if (!instruction.viewFactory) { - var _template = _aureliaPal.DOM.createElement('template'); - var fragment = _aureliaPal.DOM.createDocumentFragment(); - var cacheSize = node.getAttribute('view-cache'); - var part = node.getAttribute('part'); +function select(element) { + var selectedText; - node.removeAttribute(instruction.originalAttrName); - _aureliaPal.DOM.replaceNode(_template, node, parentNode); - fragment.appendChild(node); - instruction.viewFactory = compiler.compile(fragment, resources); + if (element.nodeName === 'SELECT') { + element.focus(); - if (part) { - instruction.viewFactory.part = part; - node.removeAttribute('part'); - } + selectedText = element.value; + } + else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { + var isReadOnly = element.hasAttribute('readonly'); - if (cacheSize) { - instruction.viewFactory.setCacheSize(cacheSize); - node.removeAttribute('view-cache'); + if (!isReadOnly) { + element.setAttribute('readonly', ''); } - node = _template; - } - } else if (this.elementName !== null) { - var _partReplacements2 = {}; - - if (this.processContent(compiler, resources, node, instruction) && node.hasChildNodes()) { - var currentChild = node.firstChild; - var contentElement = this.usesShadowDOM ? null : _aureliaPal.DOM.createElement('au-content'); - var nextSibling = void 0; - var toReplace = void 0; - - while (currentChild) { - nextSibling = currentChild.nextSibling; - - if (currentChild.tagName === 'TEMPLATE' && (toReplace = currentChild.getAttribute('replace-part'))) { - _partReplacements2[toReplace] = compiler.compile(currentChild, resources); - _aureliaPal.DOM.removeNode(currentChild, parentNode); - instruction.partReplacements = _partReplacements2; - } else if (contentElement !== null) { - if (currentChild.nodeType === 3 && _isAllWhitespace(currentChild)) { - _aureliaPal.DOM.removeNode(currentChild, parentNode); - } else { - contentElement.appendChild(currentChild); - } - } - - currentChild = nextSibling; - } + element.select(); + element.setSelectionRange(0, element.value.length); - if (contentElement !== null && contentElement.hasChildNodes()) { - node.appendChild(contentElement); + if (!isReadOnly) { + element.removeAttribute('readonly'); } - instruction.skipContentProcessing = false; - } else { - instruction.skipContentProcessing = true; - } - } else if (!this.processContent(compiler, resources, node, instruction)) { - instruction.skipContentProcessing = true; + selectedText = element.value; } + else { + if (element.hasAttribute('contenteditable')) { + element.focus(); + } - return node; - }; - - HtmlBehaviorResource.prototype.create = function create(container, instruction, element, bindings) { - var viewHost = void 0; - var au = null; - - instruction = instruction || BehaviorInstruction.normal; - element = element || null; - bindings = bindings || null; + var selection = window.getSelection(); + var range = document.createRange(); - if (this.elementName !== null && element) { - if (this.usesShadowDOM) { - viewHost = element.attachShadow(this.shadowDOMOptions); - container.registerInstance(_aureliaPal.DOM.boundary, viewHost); - } else { - viewHost = element; - if (this.targetShadowDOM) { - container.registerInstance(_aureliaPal.DOM.boundary, viewHost); - } - } - } + range.selectNodeContents(element); + selection.removeAllRanges(); + selection.addRange(range); - if (element !== null) { - element.au = au = element.au || {}; + selectedText = selection.toString(); } - var viewModel = instruction.viewModel || container.get(this.target); - var controller = new Controller(this, instruction, viewModel, container); - var childBindings = this.childBindings; - var viewFactory = void 0; + return selectedText; +} - if (this.liftsContent) { - au.controller = controller; - } else if (this.elementName !== null) { - viewFactory = instruction.viewFactory || this.viewFactory; - container.viewModel = viewModel; +module.exports = select; - if (viewFactory) { - controller.view = viewFactory.create(container, instruction, element); - } - if (element !== null) { - au.controller = controller; +/***/ }), - if (controller.view) { - if (!this.usesShadowDOM && (element.childNodes.length === 1 || element.contentElement)) { - var contentElement = element.childNodes[0] || element.contentElement; - controller.view.contentView = { fragment: contentElement }; - contentElement.parentNode && _aureliaPal.DOM.removeNode(contentElement); - } +/***/ 279: +/***/ (function(module) { - if (instruction.anchorIsContainer) { - if (childBindings !== null) { - for (var _i4 = 0, _ii3 = childBindings.length; _i4 < _ii3; ++_i4) { - controller.view.addBinding(childBindings[_i4].create(element, viewModel, controller)); - } - } +function E () { + // Keep this empty so it's easier to inherit from + // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) +} - controller.view.appendNodesTo(viewHost); - } else { - controller.view.insertNodesBefore(viewHost); - } - } else if (childBindings !== null) { - for (var _i5 = 0, _ii4 = childBindings.length; _i5 < _ii4; ++_i5) { - bindings.push(childBindings[_i5].create(element, viewModel, controller)); - } - } - } else if (controller.view) { - controller.view.controller = controller; +E.prototype = { + on: function (name, callback, ctx) { + var e = this.e || (this.e = {}); - if (childBindings !== null) { - for (var _i6 = 0, _ii5 = childBindings.length; _i6 < _ii5; ++_i6) { - controller.view.addBinding(childBindings[_i6].create(instruction.host, viewModel, controller)); - } - } - } else if (childBindings !== null) { - for (var _i7 = 0, _ii6 = childBindings.length; _i7 < _ii6; ++_i7) { - bindings.push(childBindings[_i7].create(instruction.host, viewModel, controller)); - } - } - } else if (childBindings !== null) { - for (var _i8 = 0, _ii7 = childBindings.length; _i8 < _ii7; ++_i8) { - bindings.push(childBindings[_i8].create(element, viewModel, controller)); - } - } + (e[name] || (e[name] = [])).push({ + fn: callback, + ctx: ctx + }); - if (au !== null) { - au[this.htmlName] = controller; - } + return this; + }, - if (instruction.initiatedByBehavior && viewFactory) { - controller.view.created(); - } + once: function (name, callback, ctx) { + var self = this; + function listener () { + self.off(name, listener); + callback.apply(ctx, arguments); + }; - return controller; - }; + listener._ = callback + return this.on(name, listener, ctx); + }, - HtmlBehaviorResource.prototype._ensurePropertiesDefined = function _ensurePropertiesDefined(instance, lookup) { - var properties = void 0; - var i = void 0; - var ii = void 0; - var observer = void 0; + emit: function (name) { + var data = [].slice.call(arguments, 1); + var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); + var i = 0; + var len = evtArr.length; - if ('__propertiesDefined__' in lookup) { - return; + for (i; i < len; i++) { + evtArr[i].fn.apply(evtArr[i].ctx, data); } - lookup.__propertiesDefined__ = true; - properties = this.properties; + return this; + }, - for (i = 0, ii = properties.length; i < ii; ++i) { - observer = properties[i].createObserver(instance); + off: function (name, callback) { + var e = this.e || (this.e = {}); + var evts = e[name]; + var liveEvents = []; - if (observer !== undefined) { - lookup[observer.propertyName] = observer; + if (evts && callback) { + for (var i = 0, len = evts.length; i < len; i++) { + if (evts[i].fn !== callback && evts[i].fn._ !== callback) + liveEvents.push(evts[i]); } } - }; - HtmlBehaviorResource.prototype._copyInheritedProperties = function _copyInheritedProperties(container, target) { - var _this14 = this; + // Remove event from queue to prevent memory leak + // Suggested by https://github.com/lazd + // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 - var behavior = void 0; - var derived = target; + (liveEvents.length) + ? e[name] = liveEvents + : delete e[name]; - while (true) { - var proto = Object.getPrototypeOf(target.prototype); - target = proto && proto.constructor; - if (!target) { - return; - } - behavior = _aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.resource, target); - if (behavior) { - break; - } - } - behavior.initialize(container, target); + return this; + } +}; - var _loop = function _loop(_i9, _ii8) { - var prop = behavior.properties[_i9]; +module.exports = E; +module.exports.TinyEmitter = E; - if (_this14.properties.some(function (p) { - return p.name === prop.name; - })) { - return 'continue'; - } - new BindableProperty(prop).registerWith(derived, _this14); - }; +/***/ }) - for (var _i9 = 0, _ii8 = behavior.properties.length; _i9 < _ii8; ++_i9) { - var _ret = _loop(_i9, _ii8); +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ if(__webpack_module_cache__[moduleId]) { +/******/ return __webpack_module_cache__[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/************************************************************************/ +/******/ // module exports must be returned from runtime so entry inlining is disabled +/******/ // startup +/******/ // Load entry module and return exports +/******/ return __webpack_require__(686); +/******/ })() +.default; +});; +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define("Phaser", [], factory); + else if(typeof exports === 'object') + exports["Phaser"] = factory(); + else + root["Phaser"] = factory(); +})(this, () => { +return /******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ - if (_ret === 'continue') continue; - } - }; +/***/ 6659: +/***/ ((module) => { - return HtmlBehaviorResource; -}(); +"use strict"; -function createChildObserverDecorator(selectorOrConfig, all) { - return function (target, key, descriptor) { - var actualTarget = typeof key === 'string' ? target.constructor : target; - var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, actualTarget); - if (typeof selectorOrConfig === 'string') { - selectorOrConfig = { - selector: selectorOrConfig, - name: key - }; - } +var has = Object.prototype.hasOwnProperty + , prefix = '~'; - if (descriptor) { - descriptor.writable = true; - descriptor.configurable = true; - } +/** + * Constructor to create a storage for our `EE` objects. + * An `Events` instance is a plain object whose properties are event names. + * + * @constructor + * @private + */ +function Events() {} - selectorOrConfig.all = all; - r.addChildBinding(new ChildObserver(selectorOrConfig)); - }; -} +// +// We try to not inherit from `Object.prototype`. In some engines creating an +// instance in this way is faster than calling `Object.create(null)` directly. +// If `Object.create(null)` is not supported we prefix the event names with a +// character to make sure that the built-in object properties are not +// overridden or used as an attack vector. +// +if (Object.create) { + Events.prototype = Object.create(null); -function children(selectorOrConfig) { - return createChildObserverDecorator(selectorOrConfig, true); + // + // This hack is needed because the `__proto__` property is still inherited in + // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. + // + if (!new Events().__proto__) prefix = false; } -function child(selectorOrConfig) { - return createChildObserverDecorator(selectorOrConfig, false); +/** + * Representation of a single event listener. + * + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} [once=false] Specify if the listener is a one-time listener. + * @constructor + * @private + */ +function EE(fn, context, once) { + this.fn = fn; + this.context = context; + this.once = once || false; } -var ChildObserver = function () { - function ChildObserver(config) { - - - this.name = config.name; - this.changeHandler = config.changeHandler || this.name + 'Changed'; - this.selector = config.selector; - this.all = config.all; +/** + * Add a listener for a given event. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} once Specify if the listener is a one-time listener. + * @returns {EventEmitter} + * @private + */ +function addListener(emitter, event, fn, context, once) { + if (typeof fn !== 'function') { + throw new TypeError('The listener must be a function'); } - ChildObserver.prototype.create = function create(viewHost, viewModel, controller) { - return new ChildObserverBinder(this.selector, viewHost, this.name, viewModel, controller, this.changeHandler, this.all); - }; - - return ChildObserver; -}(); - -var noMutations = []; - -function trackMutation(groupedMutations, binder, record) { - var mutations = groupedMutations.get(binder); + var listener = new EE(fn, context || emitter, once) + , evt = prefix ? prefix + event : event; - if (!mutations) { - mutations = []; - groupedMutations.set(binder, mutations); - } + if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; + else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); + else emitter._events[evt] = [emitter._events[evt], listener]; - mutations.push(record); + return emitter; } -function onChildChange(mutations, observer) { - var binders = observer.binders; - var bindersLength = binders.length; - var groupedMutations = new Map(); - - for (var _i10 = 0, _ii9 = mutations.length; _i10 < _ii9; ++_i10) { - var record = mutations[_i10]; - var added = record.addedNodes; - var removed = record.removedNodes; - - for (var j = 0, jj = removed.length; j < jj; ++j) { - var _node = removed[j]; - if (_node.nodeType === 1) { - for (var k = 0; k < bindersLength; ++k) { - var binder = binders[k]; - if (binder.onRemove(_node)) { - trackMutation(groupedMutations, binder, record); - } - } - } - } - - for (var _j = 0, _jj = added.length; _j < _jj; ++_j) { - var _node2 = added[_j]; - if (_node2.nodeType === 1) { - for (var _k = 0; _k < bindersLength; ++_k) { - var _binder = binders[_k]; - if (_binder.onAdd(_node2)) { - trackMutation(groupedMutations, _binder, record); - } - } - } - } - } - - groupedMutations.forEach(function (value, key) { - if (key.changeHandler !== null) { - key.viewModel[key.changeHandler](value); - } - }); +/** + * Clear event by name. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} evt The Event name. + * @private + */ +function clearEvent(emitter, evt) { + if (--emitter._eventsCount === 0) emitter._events = new Events(); + else delete emitter._events[evt]; } -var ChildObserverBinder = function () { - function ChildObserverBinder(selector, viewHost, property, viewModel, controller, changeHandler, all) { - - - this.selector = selector; - this.viewHost = viewHost; - this.property = property; - this.viewModel = viewModel; - this.controller = controller; - this.changeHandler = changeHandler in viewModel ? changeHandler : null; - this.usesShadowDOM = controller.behavior.usesShadowDOM; - this.all = all; - - if (!this.usesShadowDOM && controller.view && controller.view.contentView) { - this.contentView = controller.view.contentView; - } else { - this.contentView = null; - } - } - - ChildObserverBinder.prototype.matches = function matches(element) { - if (element.matches(this.selector)) { - if (this.contentView === null) { - return true; - } - - var contentView = this.contentView; - var assignedSlot = element.auAssignedSlot; - - if (assignedSlot && assignedSlot.projectFromAnchors) { - var anchors = assignedSlot.projectFromAnchors; - - for (var _i11 = 0, _ii10 = anchors.length; _i11 < _ii10; ++_i11) { - if (anchors[_i11].auOwnerView === contentView) { - return true; - } - } +/** + * Minimal `EventEmitter` interface that is molded against the Node.js + * `EventEmitter` interface. + * + * @constructor + * @public + */ +function EventEmitter() { + this._events = new Events(); + this._eventsCount = 0; +} - return false; - } +/** + * Return an array listing the events for which the emitter has registered + * listeners. + * + * @returns {Array} + * @public + */ +EventEmitter.prototype.eventNames = function eventNames() { + var names = [] + , events + , name; - return element.auOwnerView === contentView; - } + if (this._eventsCount === 0) return names; - return false; - }; + for (name in (events = this._events)) { + if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); + } - ChildObserverBinder.prototype.bind = function bind(source) { - var viewHost = this.viewHost; - var viewModel = this.viewModel; - var observer = viewHost.__childObserver__; + if (Object.getOwnPropertySymbols) { + return names.concat(Object.getOwnPropertySymbols(events)); + } - if (!observer) { - observer = viewHost.__childObserver__ = _aureliaPal.DOM.createMutationObserver(onChildChange); + return names; +}; - var options = { - childList: true, - subtree: !this.usesShadowDOM - }; +/** + * Return the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Array} The registered listeners. + * @public + */ +EventEmitter.prototype.listeners = function listeners(event) { + var evt = prefix ? prefix + event : event + , handlers = this._events[evt]; - observer.observe(viewHost, options); - observer.binders = []; - } + if (!handlers) return []; + if (handlers.fn) return [handlers.fn]; - observer.binders.push(this); + for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { + ee[i] = handlers[i].fn; + } - if (this.usesShadowDOM) { - var current = viewHost.firstElementChild; + return ee; +}; - if (this.all) { - var items = viewModel[this.property]; - if (!items) { - items = viewModel[this.property] = []; - } else { - items.splice(0); - } +/** + * Return the number of listeners listening to a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Number} The number of listeners. + * @public + */ +EventEmitter.prototype.listenerCount = function listenerCount(event) { + var evt = prefix ? prefix + event : event + , listeners = this._events[evt]; - while (current) { - if (this.matches(current)) { - items.push(current.au && current.au.controller ? current.au.controller.viewModel : current); - } + if (!listeners) return 0; + if (listeners.fn) return 1; + return listeners.length; +}; - current = current.nextElementSibling; - } +/** + * Calls each of the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Boolean} `true` if the event had listeners, else `false`. + * @public + */ +EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { + var evt = prefix ? prefix + event : event; - if (this.changeHandler !== null) { - this.viewModel[this.changeHandler](noMutations); - } - } else { - while (current) { - if (this.matches(current)) { - var _value = current.au && current.au.controller ? current.au.controller.viewModel : current; - this.viewModel[this.property] = _value; + if (!this._events[evt]) return false; - if (this.changeHandler !== null) { - this.viewModel[this.changeHandler](_value); - } + var listeners = this._events[evt] + , len = arguments.length + , args + , i; - break; - } + if (listeners.fn) { + if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); - current = current.nextElementSibling; - } - } + switch (len) { + case 1: return listeners.fn.call(listeners.context), true; + case 2: return listeners.fn.call(listeners.context, a1), true; + case 3: return listeners.fn.call(listeners.context, a1, a2), true; + case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; + case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; + case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; } - }; - ChildObserverBinder.prototype.onRemove = function onRemove(element) { - if (this.matches(element)) { - var _value2 = element.au && element.au.controller ? element.au.controller.viewModel : element; - - if (this.all) { - var items = this.viewModel[this.property] || (this.viewModel[this.property] = []); - var index = items.indexOf(_value2); - - if (index !== -1) { - items.splice(index, 1); - } - - return true; - } - - return false; + for (i = 1, args = new Array(len -1); i < len; i++) { + args[i - 1] = arguments[i]; } - return false; - }; - - ChildObserverBinder.prototype.onAdd = function onAdd(element) { - if (this.matches(element)) { - var _value3 = element.au && element.au.controller ? element.au.controller.viewModel : element; - - if (this.all) { - var items = this.viewModel[this.property] || (this.viewModel[this.property] = []); - - if (this.selector === '*') { - items.push(_value3); - return true; - } + listeners.fn.apply(listeners.context, args); + } else { + var length = listeners.length + , j; - var index = 0; - var prev = element.previousElementSibling; + for (i = 0; i < length; i++) { + if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); - while (prev) { - if (this.matches(prev)) { - index++; + switch (len) { + case 1: listeners[i].fn.call(listeners[i].context); break; + case 2: listeners[i].fn.call(listeners[i].context, a1); break; + case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; + case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; + default: + if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { + args[j - 1] = arguments[j]; } - prev = prev.previousElementSibling; - } - - items.splice(index, 0, _value3); - return true; - } - - this.viewModel[this.property] = _value3; - - if (this.changeHandler !== null) { - this.viewModel[this.changeHandler](_value3); + listeners[i].fn.apply(listeners[i].context, args); } } + } - return false; - }; + return true; +}; - ChildObserverBinder.prototype.unbind = function unbind() { - if (this.viewHost.__childObserver__) { - this.viewHost.__childObserver__.disconnect(); - this.viewHost.__childObserver__ = null; - this.viewModel[this.property] = null; - } - }; - - return ChildObserverBinder; -}(); - -function remove(viewSlot, previous) { - return Array.isArray(previous) ? viewSlot.removeMany(previous, true) : viewSlot.remove(previous, true); -} - -var SwapStrategies = exports.SwapStrategies = { - before: function before(viewSlot, previous, callback) { - return previous === undefined ? callback() : callback().then(function () { - return remove(viewSlot, previous); - }); - }, - with: function _with(viewSlot, previous, callback) { - return previous === undefined ? callback() : Promise.all([remove(viewSlot, previous), callback()]); - }, - after: function after(viewSlot, previous, callback) { - return Promise.resolve(viewSlot.removeAll(true)).then(callback); - } +/** + * Add a listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.on = function on(event, fn, context) { + return addListener(this, event, fn, context, false); }; -function tryActivateViewModel(context) { - if (context.skipActivation || typeof context.viewModel.activate !== 'function') { - return Promise.resolve(); - } - - return context.viewModel.activate(context.model) || Promise.resolve(); -} +/** + * Add a one-time listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.once = function once(event, fn, context) { + return addListener(this, event, fn, context, true); +}; -var CompositionEngine = exports.CompositionEngine = (_dec10 = (0, _aureliaDependencyInjection.inject)(ViewEngine, ViewLocator), _dec10(_class18 = function () { - function CompositionEngine(viewEngine, viewLocator) { - +/** + * Remove the listeners of a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn Only remove the listeners that match this function. + * @param {*} context Only remove the listeners that have this context. + * @param {Boolean} once Only remove one-time listeners. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { + var evt = prefix ? prefix + event : event; - this.viewEngine = viewEngine; - this.viewLocator = viewLocator; + if (!this._events[evt]) return this; + if (!fn) { + clearEvent(this, evt); + return this; } - CompositionEngine.prototype._swap = function _swap(context, view) { - var swapStrategy = SwapStrategies[context.swapOrder] || SwapStrategies.after; - var previousViews = context.viewSlot.children.slice(); + var listeners = this._events[evt]; - return swapStrategy(context.viewSlot, previousViews, function () { - return Promise.resolve(context.viewSlot.add(view)).then(function () { - if (context.currentController) { - context.currentController.unbind(); - } - }); - }).then(function () { - if (context.compositionTransactionNotifier) { - context.compositionTransactionNotifier.done(); + if (listeners.fn) { + if ( + listeners.fn === fn && + (!once || listeners.once) && + (!context || listeners.context === context) + ) { + clearEvent(this, evt); + } + } else { + for (var i = 0, events = [], length = listeners.length; i < length; i++) { + if ( + listeners[i].fn !== fn || + (once && !listeners[i].once) || + (context && listeners[i].context !== context) + ) { + events.push(listeners[i]); } - }); - }; + } - CompositionEngine.prototype._createControllerAndSwap = function _createControllerAndSwap(context) { - var _this15 = this; + // + // Reset the array, or remove it completely if we have no more listeners. + // + if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; + else clearEvent(this, evt); + } - return this.createController(context).then(function (controller) { - if (context.compositionTransactionOwnershipToken) { - return context.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () { - controller.automate(context.overrideContext, context.owningView); + return this; +}; - return _this15._swap(context, controller.view); - }).then(function () { - return controller; - }); - } +/** + * Remove all listeners, or those of the specified event. + * + * @param {(String|Symbol)} [event] The event name. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { + var evt; - controller.automate(context.overrideContext, context.owningView); + if (event) { + evt = prefix ? prefix + event : event; + if (this._events[evt]) clearEvent(this, evt); + } else { + this._events = new Events(); + this._eventsCount = 0; + } - return _this15._swap(context, controller.view).then(function () { - return controller; - }); - }); - }; + return this; +}; + +// +// Alias methods names because people roll like that. +// +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; +EventEmitter.prototype.addListener = EventEmitter.prototype.on; - CompositionEngine.prototype.createController = function createController(context) { - var _this16 = this; +// +// Expose the prefix. +// +EventEmitter.prefixed = prefix; - var childContainer = void 0; - var viewModel = void 0; - var viewModelResource = void 0; +// +// Allow `EventEmitter` to be imported as module namespace. +// +EventEmitter.EventEmitter = EventEmitter; - var m = void 0; +// +// Expose the module. +// +if (true) { + module.exports = EventEmitter; +} - return this.ensureViewModel(context).then(tryActivateViewModel).then(function () { - childContainer = context.childContainer; - viewModel = context.viewModel; - viewModelResource = context.viewModelResource; - m = viewModelResource.metadata; - var viewStrategy = _this16.viewLocator.getViewStrategy(context.view || viewModel); +/***/ }), - if (context.viewResources) { - viewStrategy.makeRelativeTo(context.viewResources.viewUrl); - } +/***/ 62270: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return m.load(childContainer, viewModelResource.value, null, viewStrategy, true); - }).then(function (viewFactory) { - return m.create(childContainer, BehaviorInstruction.dynamic(context.host, viewModel, viewFactory)); - }); - }; +/** + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - CompositionEngine.prototype.ensureViewModel = function ensureViewModel(context) { - var childContainer = context.childContainer = context.childContainer || context.container.createChild(); +var QuickSet = __webpack_require__(82590); - if (typeof context.viewModel === 'string') { - context.viewModel = context.viewResources ? context.viewResources.relativeToView(context.viewModel) : context.viewModel; +/** + * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, and aligns them next to each other. + * + * The first item isn't moved. The second item is aligned next to the first, then the third next to the second, and so on. + * + * @function Phaser.Actions.AlignTo + * @since 3.22.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} position - The position to align the items with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var AlignTo = function (items, position, offsetX, offsetY) +{ + var target = items[0]; - return this.viewEngine.importViewModelResource(context.viewModel).then(function (viewModelResource) { - childContainer.autoRegister(viewModelResource.value); + for (var i = 1; i < items.length; i++) + { + var item = items[i]; - if (context.host) { - childContainer.registerInstance(_aureliaPal.DOM.Element, context.host); - } + QuickSet(item, target, position, offsetX, offsetY); - context.viewModel = childContainer.viewModel = childContainer.get(viewModelResource.value); - context.viewModelResource = viewModelResource; - return context; - }); + target = item; } - var ctor = context.viewModel.constructor; - var isClass = typeof context.viewModel === 'function'; - if (isClass) { - ctor = context.viewModel; - childContainer.autoRegister(ctor); - } - var m = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, ctor); + return items; +}; - m.elementName = m.elementName || 'dynamic-element'; +module.exports = AlignTo; - m.initialize(isClass ? childContainer : context.container || childContainer, ctor); - context.viewModelResource = { metadata: m, value: ctor }; +/***/ }), - if (context.host) { - childContainer.registerInstance(_aureliaPal.DOM.Element, context.host); - } - childContainer.viewModel = context.viewModel = isClass ? childContainer.get(ctor) : context.viewModel; - return Promise.resolve(context); - }; +/***/ 61148: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - CompositionEngine.prototype.compose = function compose(context) { - var _this17 = this; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - context.childContainer = context.childContainer || context.container.createChild(); - context.view = this.viewLocator.getViewStrategy(context.view); +var PropertyValueInc = __webpack_require__(6124); - var transaction = context.childContainer.get(CompositionTransaction); - var compositionTransactionOwnershipToken = transaction.tryCapture(); +/** + * Takes an array of Game Objects, or any objects that have a public `angle` property, + * and then adds the given value to each of their `angle` properties. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `Angle(group.getChildren(), value, step)` + * + * @function Phaser.Actions.Angle + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to be added to the `angle` property. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var Angle = function (items, value, step, index, direction) +{ + return PropertyValueInc(items, 'angle', value, step, index, direction); +}; - if (compositionTransactionOwnershipToken) { - context.compositionTransactionOwnershipToken = compositionTransactionOwnershipToken; - } else { - context.compositionTransactionNotifier = transaction.enlist(); - } +module.exports = Angle; - if (context.viewModel) { - return this._createControllerAndSwap(context); - } else if (context.view) { - if (context.viewResources) { - context.view.makeRelativeTo(context.viewResources.viewUrl); - } - return context.view.loadViewFactory(this.viewEngine, new ViewCompileInstruction()).then(function (viewFactory) { - var result = viewFactory.create(context.childContainer); - result.bind(context.bindingContext, context.overrideContext); +/***/ }), - if (context.compositionTransactionOwnershipToken) { - return context.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () { - return _this17._swap(context, result); - }).then(function () { - return result; - }); - } +/***/ 22015: +/***/ ((module) => { - return _this17._swap(context, result).then(function () { - return result; - }); - }); - } else if (context.viewSlot) { - context.viewSlot.removeAll(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (context.compositionTransactionNotifier) { - context.compositionTransactionNotifier.done(); - } +/** + * Takes an array of objects and passes each of them to the given callback. + * + * @function Phaser.Actions.Call + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {Phaser.Types.Actions.CallCallback} callback - The callback to be invoked. It will be passed just one argument: the item from the array. + * @param {*} context - The scope in which the callback will be invoked. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that was passed to this Action. + */ +var Call = function (items, callback, context) +{ + for (var i = 0; i < items.length; i++) + { + var item = items[i]; - return Promise.resolve(null); + callback.call(context, item); } - return Promise.resolve(null); - }; - - return CompositionEngine; -}()) || _class18); - -var ElementConfigResource = exports.ElementConfigResource = function () { - function ElementConfigResource() { - - } - - ElementConfigResource.prototype.initialize = function initialize(container, target) {}; - - ElementConfigResource.prototype.register = function register(registry, name) {}; + return items; +}; - ElementConfigResource.prototype.load = function load(container, target) { - var config = new target(); - var eventManager = container.get(_aureliaBinding.EventManager); - eventManager.registerElementConfig(config); - }; +module.exports = Call; - return ElementConfigResource; -}(); -function resource(instanceOrConfig) { - return function (target) { - var isConfig = typeof instanceOrConfig === 'string' || Object.getPrototypeOf(instanceOrConfig) === Object.prototype; - if (isConfig) { - target.$resource = instanceOrConfig; - } else { - _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, instanceOrConfig, target); - } - }; -} +/***/ }), -function behavior(override) { - return function (target) { - if (override instanceof HtmlBehaviorResource) { - _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, override, target); - } else { - var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, target); - Object.assign(r, override); - } - }; -} +/***/ 31060: +/***/ ((module) => { -function customElement(name) { - return function (target) { - var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, target); - r.elementName = validateBehaviorName(name, 'custom element'); - }; -} +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -function customAttribute(name, defaultBindingMode, aliases) { - return function (target) { - var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, target); - r.attributeName = validateBehaviorName(name, 'custom attribute'); - r.attributeDefaultBindingMode = defaultBindingMode; - r.aliases = aliases; - }; -} +/** + * Takes an array of objects and returns the first element in the array that has properties which match + * all of those specified in the `compare` object. For example, if the compare object was: `{ scaleX: 0.5, alpha: 1 }` + * then it would return the first item which had the property `scaleX` set to 0.5 and `alpha` set to 1. + * + * To use this with a Group: `GetFirst(group.getChildren(), compare, index)` + * + * @function Phaser.Actions.GetFirst + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be searched by this action. + * @param {object} compare - The comparison object. Each property in this object will be checked against the items of the array. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * + * @return {?(object|Phaser.GameObjects.GameObject)} The first object in the array that matches the comparison object, or `null` if no match was found. + */ +var GetFirst = function (items, compare, index) +{ + if (index === undefined) { index = 0; } -function templateController(target) { - var deco = function deco(t) { - var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t); - r.liftsContent = true; - }; + for (var i = index; i < items.length; i++) + { + var item = items[i]; - return target ? deco(target) : deco; -} + var match = true; -function bindable(nameOrConfigOrTarget, key, descriptor) { - var deco = function deco(target, key2, descriptor2) { - var actualTarget = key2 ? target.constructor : target; - var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, actualTarget); - var prop = void 0; + for (var property in compare) + { + if (item[property] !== compare[property]) + { + match = false; + } + } - if (key2) { - nameOrConfigOrTarget = nameOrConfigOrTarget || {}; - nameOrConfigOrTarget.name = key2; + if (match) + { + return item; + } } - prop = new BindableProperty(nameOrConfigOrTarget); - return prop.registerWith(actualTarget, r, descriptor2); - }; + return null; +}; - if (!nameOrConfigOrTarget) { - return deco; - } +module.exports = GetFirst; - if (key) { - var _target = nameOrConfigOrTarget; - nameOrConfigOrTarget = null; - return deco(_target, key, descriptor); - } - return deco; -} +/***/ }), -function dynamicOptions(target) { - var deco = function deco(t) { - var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t); - r.hasDynamicOptions = true; - }; +/***/ 52367: +/***/ ((module) => { - return target ? deco(target) : deco; -} +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -var defaultShadowDOMOptions = { mode: 'open' }; -function useShadowDOM(targetOrOptions) { - var options = typeof targetOrOptions === 'function' || !targetOrOptions ? defaultShadowDOMOptions : targetOrOptions; +/** + * Takes an array of objects and returns the last element in the array that has properties which match + * all of those specified in the `compare` object. For example, if the compare object was: `{ scaleX: 0.5, alpha: 1 }` + * then it would return the last item which had the property `scaleX` set to 0.5 and `alpha` set to 1. + * + * To use this with a Group: `GetLast(group.getChildren(), compare, index)` + * + * @function Phaser.Actions.GetLast + * @since 3.3.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be searched by this action. + * @param {object} compare - The comparison object. Each property in this object will be checked against the items of the array. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * + * @return {?(object|Phaser.GameObjects.GameObject)} The last object in the array that matches the comparison object, or `null` if no match was found. + */ +var GetLast = function (items, compare, index) +{ + if (index === undefined) { index = 0; } - var deco = function deco(t) { - var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t); - r.targetShadowDOM = true; - r.shadowDOMOptions = options; - }; + for (var i = index; i < items.length; i++) + { + var item = items[i]; - return typeof targetOrOptions === 'function' ? deco(targetOrOptions) : deco; -} + var match = true; -function processAttributes(processor) { - return function (t) { - var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t); - r.processAttributes = function (compiler, resources, node, attributes, elementInstruction) { - try { - processor(compiler, resources, node, attributes, elementInstruction); - } catch (error) { - LogManager.getLogger('templating').error(error); - } - }; - }; -} + for (var property in compare) + { + if (item[property] !== compare[property]) + { + match = false; + } + } -function doNotProcessContent() { - return false; -} + if (match) + { + return item; + } + } -function processContent(processor) { - return function (t) { - var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t); - r.processContent = processor ? function (compiler, resources, node, instruction) { - try { - return processor(compiler, resources, node, instruction); - } catch (error) { - LogManager.getLogger('templating').error(error); - return false; - } - } : doNotProcessContent; - }; -} + return null; +}; -function containerless(target) { - var deco = function deco(t) { - var r = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaMetadata.metadata.resource, HtmlBehaviorResource, t); - r.containerless = true; - }; +module.exports = GetLast; - return target ? deco(target) : deco; -} -function useViewStrategy(strategy) { - return function (target) { - _aureliaMetadata.metadata.define(ViewLocator.viewStrategyMetadataKey, strategy, target); - }; -} +/***/ }), -function useView(path) { - return useViewStrategy(new RelativeViewStrategy(path)); -} +/***/ 12673: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -function inlineView(markup, dependencies, dependencyBaseUrl) { - return useViewStrategy(new InlineViewStrategy(markup, dependencies, dependencyBaseUrl)); -} +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -function noView(targetOrDependencies, dependencyBaseUrl) { - var target = void 0; - var dependencies = void 0; - if (typeof targetOrDependencies === 'function') { - target = targetOrDependencies; - } else { - dependencies = targetOrDependencies; - target = undefined; - } +var AlignIn = __webpack_require__(40327); +var CONST = __webpack_require__(84093); +var GetFastValue = __webpack_require__(72632); +var NOOP = __webpack_require__(72283); +var Zone = __webpack_require__(71030); - var deco = function deco(t) { - _aureliaMetadata.metadata.define(ViewLocator.viewStrategyMetadataKey, new NoViewStrategy(dependencies, dependencyBaseUrl), t); - }; +var tempZone = new Zone({ sys: { queueDepthSort: NOOP, events: { once: NOOP } } }, 0, 0, 1, 1).setOrigin(0, 0); - return target ? deco(target) : deco; -} +/** + * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, + * and then aligns them based on the grid configuration given to this action. + * + * @function Phaser.Actions.GridAlign + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {Phaser.Types.Actions.GridAlignConfig} options - The GridAlign Configuration object. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var GridAlign = function (items, options) +{ + if (options === undefined) { options = {}; } -function view(templateOrConfig) { - return function (target) { - target.$view = templateOrConfig; - }; -} + var widthSet = options.hasOwnProperty('width'); + var heightSet = options.hasOwnProperty('height'); -function elementConfig(target) { - var deco = function deco(t) { - _aureliaMetadata.metadata.define(_aureliaMetadata.metadata.resource, new ElementConfigResource(), t); - }; + var width = GetFastValue(options, 'width', -1); + var height = GetFastValue(options, 'height', -1); - return target ? deco(target) : deco; -} + var cellWidth = GetFastValue(options, 'cellWidth', 1); + var cellHeight = GetFastValue(options, 'cellHeight', cellWidth); -function viewResources() { - for (var _len = arguments.length, resources = Array(_len), _key7 = 0; _key7 < _len; _key7++) { - resources[_key7] = arguments[_key7]; - } + var position = GetFastValue(options, 'position', CONST.TOP_LEFT); + var x = GetFastValue(options, 'x', 0); + var y = GetFastValue(options, 'y', 0); - return function (target) { - _aureliaMetadata.metadata.define(ViewEngine.viewModelRequireMetadataKey, resources, target); - }; -} + var cx = 0; + var cy = 0; + var w = (width * cellWidth); + var h = (height * cellHeight); -var TemplatingEngine = exports.TemplatingEngine = (_dec11 = (0, _aureliaDependencyInjection.inject)(_aureliaDependencyInjection.Container, ModuleAnalyzer, ViewCompiler, CompositionEngine), _dec11(_class19 = function () { - function TemplatingEngine(container, moduleAnalyzer, viewCompiler, compositionEngine) { - + tempZone.setPosition(x, y); + tempZone.setSize(cellWidth, cellHeight); - this._container = container; - this._moduleAnalyzer = moduleAnalyzer; - this._viewCompiler = viewCompiler; - this._compositionEngine = compositionEngine; - container.registerInstance(Animator, Animator.instance = new Animator()); - } + for (var i = 0; i < items.length; i++) + { + AlignIn(items[i], tempZone, position); - TemplatingEngine.prototype.configureAnimator = function configureAnimator(animator) { - this._container.unregister(Animator); - this._container.registerInstance(Animator, Animator.instance = animator); - }; + if (widthSet && width === -1) + { + // We keep laying them out horizontally until we've done them all + tempZone.x += cellWidth; + } + else if (heightSet && height === -1) + { + // We keep laying them out vertically until we've done them all + tempZone.y += cellHeight; + } + else if (heightSet && !widthSet) + { + // We keep laying them out until we hit the column limit + cy += cellHeight; + tempZone.y += cellHeight; - TemplatingEngine.prototype.compose = function compose(context) { - return this._compositionEngine.compose(context); - }; + if (cy === h) + { + cy = 0; + cx += cellWidth; + tempZone.y = y; + tempZone.x += cellWidth; - TemplatingEngine.prototype.enhance = function enhance(instruction) { - if (instruction instanceof _aureliaPal.DOM.Element) { - instruction = { element: instruction }; - } + if (cx === w) + { + // We've hit the column limit, so return, even if there are items left + break; + } + } + } + else + { + // We keep laying them out until we hit the column limit + cx += cellWidth; + tempZone.x += cellWidth; - var compilerInstructions = { letExpressions: [] }; - var resources = instruction.resources || this._container.get(ViewResources); + if (cx === w) + { + cx = 0; + cy += cellHeight; + tempZone.x = x; + tempZone.y += cellHeight; - this._viewCompiler._compileNode(instruction.element, resources, compilerInstructions, instruction.element.parentNode, 'root', true); + if (cy === h) + { + // We've hit the column limit, so return, even if there are items left + break; + } + } + } + } - var factory = new ViewFactory(instruction.element, compilerInstructions, resources); - var container = instruction.container || this._container.createChild(); - var view = factory.create(container, BehaviorInstruction.enhance()); + return items; +}; - view.bind(instruction.bindingContext || {}, instruction.overrideContext); +module.exports = GridAlign; - view.firstChild = view.lastChild = view.fragment; - view.fragment = _aureliaPal.DOM.createDocumentFragment(); - view.attached(); - return view; - }; +/***/ }), - return TemplatingEngine; -}()) || _class19); -}); -; -define('aurelia-testing/dist/commonjs/aurelia-testing',['require','exports','module','./compile-spy','./view-spy','./component-tester','./wait'],function (require, exports, module) {"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./compile-spy")); -__export(require("./view-spy")); -__export(require("./component-tester")); -__export(require("./wait")); -function configure(config) { - config.globalResources([ - './compile-spy', - './view-spy' - ]); -} -exports.configure = configure; +/***/ 691: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -}); -; -define('aurelia-testing/dist/commonjs/compile-spy',['require','exports','module','aurelia-templating','aurelia-dependency-injection','aurelia-logging','aurelia-pal'],function (require, exports, module) {"use strict"; -var __decorate = (this && this.__decorate) || function (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; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var aurelia_templating_1 = require("aurelia-templating"); -var aurelia_dependency_injection_1 = require("aurelia-dependency-injection"); -var aurelia_logging_1 = require("aurelia-logging"); -var aurelia_pal_1 = require("aurelia-pal"); /** - * Attribute to be placed on any element to have it emit the View Compiler's - * TargetInstruction into the debug console, giving you insight into all the - * parsed bindings, behaviors and event handers for the targeted element. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CompileSpy = /** @class */ (function () { - /** - * Creates and instanse of CompileSpy. - * @param element target element on where attribute is placed on. - * @param instruction instructions for how the target element should be enhanced. - */ - function CompileSpy(element, instruction) { - aurelia_logging_1.getLogger('compile-spy').info(element.toString(), instruction); - } - CompileSpy = __decorate([ - aurelia_templating_1.customAttribute('compile-spy'), - aurelia_dependency_injection_1.inject(aurelia_pal_1.DOM.Element, aurelia_templating_1.TargetInstruction) - ], CompileSpy); - return CompileSpy; -}()); -exports.CompileSpy = CompileSpy; -}); -; -define('aurelia-testing/dist/commonjs/component-tester',['require','exports','module','aurelia-templating','./wait'],function (require, exports, module) {"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var aurelia_templating_1 = require("aurelia-templating"); -var wait_1 = require("./wait"); -var StageComponent = /** @class */ (function () { - function StageComponent() { - } - StageComponent.withResources = function (resources) { - if (resources === void 0) { resources = []; } - return new ComponentTester().withResources(resources); - }; - return StageComponent; -}()); -exports.StageComponent = StageComponent; -var ComponentTester = /** @class */ (function () { - function ComponentTester() { - this.resources = []; - } - ComponentTester.prototype.configure = function (aurelia) { - return aurelia.use.standardConfiguration(); - }; - ComponentTester.prototype.bootstrap = function (configure) { - this.configure = configure; - }; - ComponentTester.prototype.withResources = function (resources) { - this.resources = resources; - return this; - }; - ComponentTester.prototype.inView = function (html) { - this.html = html; - return this; - }; - ComponentTester.prototype.boundTo = function (bindingContext) { - this.bindingContext = bindingContext; - return this; - }; - ComponentTester.prototype.manuallyHandleLifecycle = function () { - this._prepareLifecycle(); - return this; - }; - ComponentTester.prototype.create = function (bootstrap) { - var _this = this; - return bootstrap(function (aurelia) { - return Promise.resolve(_this.configure(aurelia)).then(function () { - if (_this.resources) { - aurelia.use.globalResources(_this.resources); - } - return aurelia.start().then(function () { - _this.host = document.createElement('div'); - _this.host.innerHTML = _this.html; - document.body.appendChild(_this.host); - return aurelia.enhance(_this.bindingContext, _this.host).then(function () { - _this.rootView = aurelia.root; - _this.element = _this.host.firstElementChild; - if (aurelia.root.controllers.length) { - _this.viewModel = aurelia.root.controllers[0].viewModel; - } - return new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, 0); }); - }); - }); - }); - }); - }; - ComponentTester.prototype.dispose = function () { - if (this.host === undefined || this.rootView === undefined) { - throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()'); - } - this.rootView.detached(); - this.rootView.unbind(); - return this.host.parentNode.removeChild(this.host); - }; - ComponentTester.prototype._prepareLifecycle = function () { - var _this = this; - // bind - var bindPrototype = aurelia_templating_1.View.prototype.bind; - // tslint:disable-next-line:no-empty - aurelia_templating_1.View.prototype.bind = function () { }; - this.bind = function (bindingContext) { return new Promise(function (resolve) { - aurelia_templating_1.View.prototype.bind = bindPrototype; - if (bindingContext !== undefined) { - _this.bindingContext = bindingContext; - } - _this.rootView.bind(_this.bindingContext); - setTimeout(function () { return resolve(); }, 0); - }); }; - // attached - var attachedPrototype = aurelia_templating_1.View.prototype.attached; - // tslint:disable-next-line:no-empty - aurelia_templating_1.View.prototype.attached = function () { }; - this.attached = function () { return new Promise(function (resolve) { - aurelia_templating_1.View.prototype.attached = attachedPrototype; - _this.rootView.attached(); - setTimeout(function () { return resolve(); }, 0); - }); }; - // detached - this.detached = function () { return new Promise(function (resolve) { - _this.rootView.detached(); - setTimeout(function () { return resolve(); }, 0); - }); }; - // unbind - this.unbind = function () { return new Promise(function (resolve) { - _this.rootView.unbind(); - setTimeout(function () { return resolve(); }, 0); - }); }; - }; - ComponentTester.prototype.waitForElement = function (selector, options) { - var _this = this; - return wait_1.waitFor(function () { return _this.element.querySelector(selector); }, options); - }; - ComponentTester.prototype.waitForElements = function (selector, options) { - var _this = this; - return wait_1.waitFor(function () { return _this.element.querySelectorAll(selector); }, options); - }; - return ComponentTester; -}()); -exports.ComponentTester = ComponentTester; +var PropertyValueInc = __webpack_require__(6124); -}); -; -define('aurelia-testing/dist/commonjs/view-spy',['require','exports','module','aurelia-templating','aurelia-logging'],function (require, exports, module) {"use strict"; -var __decorate = (this && this.__decorate) || function (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; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var aurelia_templating_1 = require("aurelia-templating"); -var aurelia_logging_1 = require("aurelia-logging"); /** - * Attribute to be placed on any HTML element in a view to emit the View instance - * to the debug console, giving you insight into the live View instance, including - * all child views, live bindings, behaviors and more. + * Takes an array of Game Objects, or any objects that have a public `alpha` property, + * and then adds the given value to each of their `alpha` properties. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `IncAlpha(group.getChildren(), value, step)` + * + * @function Phaser.Actions.IncAlpha + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to be added to the `alpha` property. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ -var ViewSpy = /** @class */ (function () { - /** - * Creates a new instance of ViewSpy. - */ - function ViewSpy() { - this.logger = aurelia_logging_1.getLogger('view-spy'); - } - ViewSpy.prototype._log = function (lifecycleName, context) { - if (!this.value && lifecycleName === 'created') { - this.logger.info(lifecycleName, this.view); - } - else if (this.value && this.value.indexOf(lifecycleName) !== -1) { - this.logger.info(lifecycleName, this.view, context); - } - }; - /** - * Invoked when the target view is created. - * @param view The target view. - */ - ViewSpy.prototype.created = function (view) { - this.view = view; - this._log('created'); - }; - /** - * Invoked when the target view is bound. - * @param bindingContext The target view's binding context. - */ - ViewSpy.prototype.bind = function (bindingContext) { - this._log('bind', bindingContext); - }; - /** - * Invoked when the target element is attached to the DOM. - */ - ViewSpy.prototype.attached = function () { - this._log('attached'); - }; - /** - * Invoked when the target element is detached from the DOM. - */ - ViewSpy.prototype.detached = function () { - this._log('detached'); - }; - /** - * Invoked when the target element is unbound. - */ - ViewSpy.prototype.unbind = function () { - this._log('unbind'); - }; - ViewSpy = __decorate([ - aurelia_templating_1.customAttribute('view-spy') - ], ViewSpy); - return ViewSpy; -}()); -exports.ViewSpy = ViewSpy; - -}); -; -define('aurelia-testing/dist/commonjs/wait',['require','exports','module'],function (require, exports, module) {"use strict"; -var __assign = (this && this.__assign) || Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; +var IncAlpha = function (items, value, step, index, direction) +{ + return PropertyValueInc(items, 'alpha', value, step, index, direction); }; -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Generic function to wait for something to happen. Uses polling - * @param getter: a getter function that returns anything else than `null` or an - * empty array or an empty jQuery object when the - * condition is met - * @param options: lookup options, defaults to - * `{present: true, interval: 50, timeout: 5000}` - */ -function waitFor(getter, options) { - if (options === void 0) { options = { present: true, interval: 50, timeout: 5000 }; } - // prevents infinite recursion if the request times out - var timedOut = false; - options = __assign({ present: true, interval: 50, timeout: 5000 }, options); - function wait() { - var element = getter(); - // boolean is needed here, hence the length > 0 - var found = element !== null && (!(element instanceof NodeList) && - !element.jquery || element.length > 0); - if (!options.present === !found || timedOut) { - return Promise.resolve(element); - } - return new Promise(function (rs) { return setTimeout(rs, options.interval); }).then(wait); - } - return Promise.race([ - new Promise(function (_, rj) { return setTimeout(function () { - timedOut = true; - rj(new Error(options.present ? 'Element not found' : 'Element not removed')); - }, options.timeout); }), - wait() - ]); -} -exports.waitFor = waitFor; -function waitForDocumentElement(selector, options) { - return waitFor(function () { return document.querySelector(selector); }, options); -} -exports.waitForDocumentElement = waitForDocumentElement; -function waitForDocumentElements(selector, options) { - return waitFor(function () { return document.querySelectorAll(selector); }, options); -} -exports.waitForDocumentElements = waitForDocumentElements; -}); -; -/*! - * clipboard.js v2.0.10 - * https://clipboardjs.com/ - * - * Licensed MIT © Zeno Rocha - */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define('clipboard/dist/clipboard',[], factory); - else if(typeof exports === 'object') - exports["ClipboardJS"] = factory(); - else - root["ClipboardJS"] = factory(); -})(this, function() { -return /******/ (function() { // webpackBootstrap -/******/ var __webpack_modules__ = ({ +module.exports = IncAlpha; -/***/ 686: -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -"use strict"; +/***/ }), -// EXPORTS -__webpack_require__.d(__webpack_exports__, { - "default": function() { return /* binding */ clipboard; } -}); +/***/ 3877: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -// EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js -var tiny_emitter = __webpack_require__(279); -var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter); -// EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js -var listen = __webpack_require__(370); -var listen_default = /*#__PURE__*/__webpack_require__.n(listen); -// EXTERNAL MODULE: ./node_modules/select/src/select.js -var src_select = __webpack_require__(817); -var select_default = /*#__PURE__*/__webpack_require__.n(src_select); -;// CONCATENATED MODULE: ./src/common/command.js /** - * Executes a given operation type. - * @param {String} type - * @return {Boolean} + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -function command(type) { - try { - return document.execCommand(type); - } catch (err) { - return false; - } -} -;// CONCATENATED MODULE: ./src/actions/cut.js +var PropertyValueInc = __webpack_require__(6124); /** - * Cut action wrapper. - * @param {String|HTMLElement} target - * @return {String} + * Takes an array of Game Objects, or any objects that have a public `x` property, + * and then adds the given value to each of their `x` properties. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `IncX(group.getChildren(), value, step)` + * + * @function Phaser.Actions.IncX + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to be added to the `x` property. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ - -var ClipboardActionCut = function ClipboardActionCut(target) { - var selectedText = select_default()(target); - command('cut'); - return selectedText; +var IncX = function (items, value, step, index, direction) +{ + return PropertyValueInc(items, 'x', value, step, index, direction); }; -/* harmony default export */ var actions_cut = (ClipboardActionCut); -;// CONCATENATED MODULE: ./src/common/create-fake-element.js -/** - * Creates a fake textarea element with a value. - * @param {String} value - * @return {HTMLElement} - */ -function createFakeElement(value) { - var isRTL = document.documentElement.getAttribute('dir') === 'rtl'; - var fakeElement = document.createElement('textarea'); // Prevent zooming on iOS - - fakeElement.style.fontSize = '12pt'; // Reset box model - - fakeElement.style.border = '0'; - fakeElement.style.padding = '0'; - fakeElement.style.margin = '0'; // Move element out of screen horizontally - - fakeElement.style.position = 'absolute'; - fakeElement.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically +module.exports = IncX; - var yPosition = window.pageYOffset || document.documentElement.scrollTop; - fakeElement.style.top = "".concat(yPosition, "px"); - fakeElement.setAttribute('readonly', ''); - fakeElement.value = value; - return fakeElement; -} -;// CONCATENATED MODULE: ./src/actions/copy.js +/***/ }), +/***/ 71020: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * Copy action wrapper. - * @param {String|HTMLElement} target - * @param {Object} options - * @return {String} + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ClipboardActionCopy = function ClipboardActionCopy(target) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { - container: document.body - }; - var selectedText = ''; - - if (typeof target === 'string') { - var fakeElement = createFakeElement(target); - options.container.appendChild(fakeElement); - selectedText = select_default()(fakeElement); - command('copy'); - fakeElement.remove(); - } else { - selectedText = select_default()(target); - command('copy'); - } - - return selectedText; -}; - -/* harmony default export */ var actions_copy = (ClipboardActionCopy); -;// CONCATENATED MODULE: ./src/actions/default.js -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - - +var PropertyValueInc = __webpack_require__(6124); /** - * Inner function which performs selection from either `text` or `target` - * properties and then executes copy or cut operations. - * @param {Object} options + * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, + * and then adds the given value to each of them. + * + * The optional `stepX` and `stepY` properties are applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `IncXY(group.getChildren(), x, y, stepX, stepY)` + * + * @function Phaser.Actions.IncXY + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} x - The amount to be added to the `x` property. + * @param {number} [y=x] - The amount to be added to the `y` property. If `undefined` or `null` it uses the `x` value. + * @param {number} [stepX=0] - This is added to the `x` amount, multiplied by the iteration counter. + * @param {number} [stepY=0] - This is added to the `y` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ +var IncXY = function (items, x, y, stepX, stepY, index, direction) +{ + if (y === undefined || y === null) { y = x; } -var ClipboardActionDefault = function ClipboardActionDefault() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - // Defines base properties passed from constructor. - var _options$action = options.action, - action = _options$action === void 0 ? 'copy' : _options$action, - container = options.container, - target = options.target, - text = options.text; // Sets the `action` to be performed which can be either 'copy' or 'cut'. + PropertyValueInc(items, 'x', x, stepX, index, direction); - if (action !== 'copy' && action !== 'cut') { - throw new Error('Invalid "action" value, use either "copy" or "cut"'); - } // Sets the `target` property using an element that will be have its content copied. + return PropertyValueInc(items, 'y', y, stepY, index, direction); +}; +module.exports = IncXY; - if (target !== undefined) { - if (target && _typeof(target) === 'object' && target.nodeType === 1) { - if (action === 'copy' && target.hasAttribute('disabled')) { - throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); - } - if (action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { - throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); - } - } else { - throw new Error('Invalid "target" value, use a valid Element'); - } - } // Define selection strategy based on `text` property. +/***/ }), +/***/ 28970: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (text) { - return actions_copy(text, { - container: container - }); - } // Defines which selection strategy based on `target` property. +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ +var PropertyValueInc = __webpack_require__(6124); - if (target) { - return action === 'cut' ? actions_cut(target) : actions_copy(target, { - container: container - }); - } +/** + * Takes an array of Game Objects, or any objects that have a public `y` property, + * and then adds the given value to each of their `y` properties. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `IncY(group.getChildren(), value, step)` + * + * @function Phaser.Actions.IncY + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to be added to the `y` property. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var IncY = function (items, value, step, index, direction) +{ + return PropertyValueInc(items, 'y', value, step, index, direction); }; -/* harmony default export */ var actions_default = (ClipboardActionDefault); -;// CONCATENATED MODULE: ./src/clipboard.js -function clipboard_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return clipboard_typeof(obj); } +module.exports = IncY; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } +/***/ }), -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } +/***/ 82249: +/***/ ((module) => { -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } +/** + * Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of a Circle. + * + * If you wish to pass a `Phaser.GameObjects.Circle` Shape to this function, you should pass its `geom` property. + * + * @function Phaser.Actions.PlaceOnCircle + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Circle} circle - The Circle to position the Game Objects on. + * @param {number} [startAngle=0] - Optional angle to start position from, in radians. + * @param {number} [endAngle=6.28] - Optional angle to stop position at, in radians. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + */ +var PlaceOnCircle = function (items, circle, startAngle, endAngle) +{ + if (startAngle === undefined) { startAngle = 0; } + if (endAngle === undefined) { endAngle = 6.28; } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + var angle = startAngle; + var angleStep = (endAngle - startAngle) / items.length; -function _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + var cx = circle.x; + var cy = circle.y; + var radius = circle.radius; -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + for (var i = 0; i < items.length; i++) + { + items[i].x = cx + (radius * Math.cos(angle)); + items[i].y = cy + (radius * Math.sin(angle)); -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + angle += angleStep; + } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + return items; +}; +module.exports = PlaceOnCircle; +/***/ }), +/***/ 30285: +/***/ ((module) => { +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ /** - * Helper function to retrieve attribute value. - * @param {String} suffix - * @param {Element} element + * Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of an Ellipse. + * + * If you wish to pass a `Phaser.GameObjects.Ellipse` Shape to this function, you should pass its `geom` property. + * + * @function Phaser.Actions.PlaceOnEllipse + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to position the Game Objects on. + * @param {number} [startAngle=0] - Optional angle to start position from, in radians. + * @param {number} [endAngle=6.28] - Optional angle to stop position at, in radians. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ +var PlaceOnEllipse = function (items, ellipse, startAngle, endAngle) +{ + if (startAngle === undefined) { startAngle = 0; } + if (endAngle === undefined) { endAngle = 6.28; } -function getAttributeValue(suffix, element) { - var attribute = "data-clipboard-".concat(suffix); + var angle = startAngle; + var angleStep = (endAngle - startAngle) / items.length; - if (!element.hasAttribute(attribute)) { - return; - } + var a = ellipse.width / 2; + var b = ellipse.height / 2; - return element.getAttribute(attribute); -} -/** - * Base class which takes one or more elements, adds event listeners to them, - * and instantiates a new `ClipboardAction` on each click. - */ + for (var i = 0; i < items.length; i++) + { + items[i].x = ellipse.x + a * Math.cos(angle); + items[i].y = ellipse.y + b * Math.sin(angle); + angle += angleStep; + } -var Clipboard = /*#__PURE__*/function (_Emitter) { - _inherits(Clipboard, _Emitter); + return items; +}; - var _super = _createSuper(Clipboard); +module.exports = PlaceOnEllipse; - /** - * @param {String|HTMLElement|HTMLCollection|NodeList} trigger - * @param {Object} options - */ - function Clipboard(trigger, options) { - var _this; - _classCallCheck(this, Clipboard); +/***/ }), - _this = _super.call(this); +/***/ 61557: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - _this.resolveOptions(options); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - _this.listenClick(trigger); +var GetPoints = __webpack_require__(8570); - return _this; - } - /** - * Defines if attributes would be resolved using internal setter functions - * or custom functions that were passed in the constructor. - * @param {Object} options - */ +/** + * Positions an array of Game Objects on evenly spaced points of a Line. + * + * @function Phaser.Actions.PlaceOnLine + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Line} line - The Line to position the Game Objects on. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + */ +var PlaceOnLine = function (items, line) +{ + var points = GetPoints(line, items.length); + for (var i = 0; i < items.length; i++) + { + var item = items[i]; + var point = points[i]; - _createClass(Clipboard, [{ - key: "resolveOptions", - value: function resolveOptions() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - this.action = typeof options.action === 'function' ? options.action : this.defaultAction; - this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; - this.text = typeof options.text === 'function' ? options.text : this.defaultText; - this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body; + item.x = point.x; + item.y = point.y; } - /** - * Adds a click event listener to the passed trigger. - * @param {String|HTMLElement|HTMLCollection|NodeList} trigger - */ - - }, { - key: "listenClick", - value: function listenClick(trigger) { - var _this2 = this; - this.listener = listen_default()(trigger, 'click', function (e) { - return _this2.onClick(e); - }); - } - /** - * Defines a new `ClipboardAction` on each click event. - * @param {Event} e - */ + return items; +}; - }, { - key: "onClick", - value: function onClick(e) { - var trigger = e.delegateTarget || e.currentTarget; - var action = this.action(trigger) || 'copy'; - var text = actions_default({ - action: action, - container: this.container, - target: this.target(trigger), - text: this.text(trigger) - }); // Fires an event based on the copy operation result. +module.exports = PlaceOnLine; - this.emit(text ? 'success' : 'error', { - action: action, - text: text, - trigger: trigger, - clearSelection: function clearSelection() { - if (trigger) { - trigger.focus(); - } - document.activeElement.blur(); - window.getSelection().removeAllRanges(); - } - }); - } - /** - * Default `action` lookup function. - * @param {Element} trigger - */ +/***/ }), - }, { - key: "defaultAction", - value: function defaultAction(trigger) { - return getAttributeValue('action', trigger); - } - /** - * Default `target` lookup function. - * @param {Element} trigger - */ +/***/ 63549: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - }, { - key: "defaultTarget", - value: function defaultTarget(trigger) { - var selector = getAttributeValue('target', trigger); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (selector) { - return document.querySelector(selector); - } - } - /** - * Allow fire programmatically a copy action - * @param {String|HTMLElement} target - * @param {Object} options - * @returns Text copied. - */ +var MarchingAnts = __webpack_require__(40053); +var RotateLeft = __webpack_require__(77640); +var RotateRight = __webpack_require__(38487); - }, { - key: "defaultText", +/** + * Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of a Rectangle. + * + * Placement starts from the top-left of the rectangle, and proceeds in a clockwise direction. + * If the `shift` parameter is given you can offset where placement begins. + * + * @function Phaser.Actions.PlaceOnRectangle + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to position the Game Objects on. + * @param {number} [shift=0] - An optional positional offset. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + */ +var PlaceOnRectangle = function (items, rect, shift) +{ + if (shift === undefined) { shift = 0; } - /** - * Default `text` lookup function. - * @param {Element} trigger - */ - value: function defaultText(trigger) { - return getAttributeValue('text', trigger); - } - /** - * Destroy lifecycle. - */ + var points = MarchingAnts(rect, false, items.length); - }, { - key: "destroy", - value: function destroy() { - this.listener.destroy(); + if (shift > 0) + { + RotateLeft(points, shift); } - }], [{ - key: "copy", - value: function copy(target) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { - container: document.body - }; - return actions_copy(target, options); + else if (shift < 0) + { + RotateRight(points, Math.abs(shift)); } - /** - * Allow fire programmatically a cut action - * @param {String|HTMLElement} target - * @returns Text cutted. - */ - }, { - key: "cut", - value: function cut(target) { - return actions_cut(target); + for (var i = 0; i < items.length; i++) + { + items[i].x = points[i].x; + items[i].y = points[i].y; } - /** - * Returns the support of the given action, or all actions if no action is - * given. - * @param {String} [action] - */ - }, { - key: "isSupported", - value: function isSupported() { - var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut']; - var actions = typeof action === 'string' ? [action] : action; - var support = !!document.queryCommandSupported; - actions.forEach(function (action) { - support = support && !!document.queryCommandSupported(action); - }); - return support; - } - }]); + return items; +}; - return Clipboard; -}((tiny_emitter_default())); +module.exports = PlaceOnRectangle; -/* harmony default export */ var clipboard = (Clipboard); /***/ }), -/***/ 828: -/***/ (function(module) { - -var DOCUMENT_NODE_TYPE = 9; +/***/ 51629: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * A polyfill for Element.matches() + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -if (typeof Element !== 'undefined' && !Element.prototype.matches) { - var proto = Element.prototype; - proto.matches = proto.matchesSelector || - proto.mozMatchesSelector || - proto.msMatchesSelector || - proto.oMatchesSelector || - proto.webkitMatchesSelector; -} +var BresenhamPoints = __webpack_require__(58813); /** - * Finds the closest parent that matches a selector. + * Takes an array of Game Objects and positions them on evenly spaced points around the edges of a Triangle. + * + * If you wish to pass a `Phaser.GameObjects.Triangle` Shape to this function, you should pass its `geom` property. * - * @param {Element} element - * @param {String} selector - * @return {Function} + * @function Phaser.Actions.PlaceOnTriangle + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Triangle} triangle - The Triangle to position the Game Objects on. + * @param {number} [stepRate=1] - An optional step rate, to increase or decrease the packing of the Game Objects on the lines. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ -function closest (element, selector) { - while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { - if (typeof element.matches === 'function' && - element.matches(selector)) { - return element; - } - element = element.parentNode; +var PlaceOnTriangle = function (items, triangle, stepRate) +{ + var p1 = BresenhamPoints({ x1: triangle.x1, y1: triangle.y1, x2: triangle.x2, y2: triangle.y2 }, stepRate); + var p2 = BresenhamPoints({ x1: triangle.x2, y1: triangle.y2, x2: triangle.x3, y2: triangle.y3 }, stepRate); + var p3 = BresenhamPoints({ x1: triangle.x3, y1: triangle.y3, x2: triangle.x1, y2: triangle.y1 }, stepRate); + + // Remove overlaps + p1.pop(); + p2.pop(); + p3.pop(); + + p1 = p1.concat(p2, p3); + + var step = p1.length / items.length; + var p = 0; + + for (var i = 0; i < items.length; i++) + { + var item = items[i]; + var point = p1[Math.floor(p)]; + + item.x = point.x; + item.y = point.y; + + p += step; } -} -module.exports = closest; + return items; +}; + +module.exports = PlaceOnTriangle; /***/ }), -/***/ 438: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 1045: +/***/ ((module) => { -var closest = __webpack_require__(828); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ /** - * Delegates event to a selector. + * Play an animation on all Game Objects in the array that have an Animation component. * - * @param {Element} element - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @param {Boolean} useCapture - * @return {Object} + * You can pass either an animation key, or an animation configuration object for more control over the playback. + * + * @function Phaser.Actions.PlayAnimation + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {boolean} [ignoreIfPlaying=false] - If this animation is already playing then ignore this call. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ -function _delegate(element, selector, type, callback, useCapture) { - var listenerFn = listener.apply(this, arguments); - - element.addEventListener(type, listenerFn, useCapture); +var PlayAnimation = function (items, key, ignoreIfPlaying) +{ + for (var i = 0; i < items.length; i++) + { + var gameObject = items[i]; - return { - destroy: function() { - element.removeEventListener(type, listenerFn, useCapture); + if (gameObject.anims) + { + gameObject.anims.play(key, ignoreIfPlaying); } } -} -/** - * Delegates event to a selector. - * - * @param {Element|String|Array} [elements] - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @param {Boolean} useCapture - * @return {Object} - */ -function delegate(elements, selector, type, callback, useCapture) { - // Handle the regular Element usage - if (typeof elements.addEventListener === 'function') { - return _delegate.apply(null, arguments); - } + return items; +}; - // Handle Element-less usage, it defaults to global delegation - if (typeof type === 'function') { - // Use `document` as the first parameter, then apply arguments - // This is a short way to .unshift `arguments` without running into deoptimizations - return _delegate.bind(null, document).apply(null, arguments); - } +module.exports = PlayAnimation; - // Handle Selector-based usage - if (typeof elements === 'string') { - elements = document.querySelectorAll(elements); - } - // Handle Array-like based usage - return Array.prototype.map.call(elements, function (element) { - return _delegate(element, selector, type, callback, useCapture); - }); -} +/***/ }), + +/***/ 6124: +/***/ ((module) => { /** - * Finds closest match and invokes callback. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Takes an array of Game Objects, or any objects that have a public property as defined in `key`, + * and then adds the given value to it. * - * @param {Element} element - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @return {Function} + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `PropertyValueInc(group.getChildren(), key, value, step)` + * + * @function Phaser.Actions.PropertyValueInc + * @since 3.3.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {string} key - The property to be updated. + * @param {number} value - The amount to be added to the property. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ -function listener(element, selector, type, callback) { - return function(e) { - e.delegateTarget = closest(e.target, selector); +var PropertyValueInc = function (items, key, value, step, index, direction) +{ + if (step === undefined) { step = 0; } + if (index === undefined) { index = 0; } + if (direction === undefined) { direction = 1; } - if (e.delegateTarget) { - callback.call(element, e); + var i; + var t = 0; + var end = items.length; + + if (direction === 1) + { + // Start to End + for (i = index; i < end; i++) + { + items[i][key] += value + (t * step); + t++; + } + } + else + { + // End to Start + for (i = index; i >= 0; i--) + { + items[i][key] += value + (t * step); + t++; } } -} -module.exports = delegate; + return items; +}; + +module.exports = PropertyValueInc; /***/ }), -/***/ 879: -/***/ (function(__unused_webpack_module, exports) { +/***/ 23646: +/***/ ((module) => { /** - * Check if argument is a HTML element. - * - * @param {Object} value - * @return {Boolean} + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -exports.node = function(value) { - return value !== undefined - && value instanceof HTMLElement - && value.nodeType === 1; -}; /** - * Check if argument is a list of HTML elements. + * Takes an array of Game Objects, or any objects that have a public property as defined in `key`, + * and then sets it to the given value. * - * @param {Object} value - * @return {Boolean} + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `PropertyValueSet(group.getChildren(), key, value, step)` + * + * @function Phaser.Actions.PropertyValueSet + * @since 3.3.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {string} key - The property to be updated. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ -exports.nodeList = function(value) { - var type = Object.prototype.toString.call(value); +var PropertyValueSet = function (items, key, value, step, index, direction) +{ + if (step === undefined) { step = 0; } + if (index === undefined) { index = 0; } + if (direction === undefined) { direction = 1; } - return value !== undefined - && (type === '[object NodeList]' || type === '[object HTMLCollection]') - && ('length' in value) - && (value.length === 0 || exports.node(value[0])); + var i; + var t = 0; + var end = items.length; + + if (direction === 1) + { + // Start to End + for (i = index; i < end; i++) + { + items[i][key] = value + (t * step); + t++; + } + } + else + { + // End to Start + for (i = index; i >= 0; i--) + { + items[i][key] = value + (t * step); + t++; + } + } + + return items; }; +module.exports = PropertyValueSet; + + +/***/ }), + +/***/ 4392: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + /** - * Check if argument is a string. - * - * @param {Object} value - * @return {Boolean} + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -exports.string = function(value) { - return typeof value === 'string' - || value instanceof String; -}; + +var Random = __webpack_require__(30977); /** - * Check if argument is a function. + * Takes an array of Game Objects and positions them at random locations within the Circle. + * + * If you wish to pass a `Phaser.GameObjects.Circle` Shape to this function, you should pass its `geom` property. * - * @param {Object} value - * @return {Boolean} + * @function Phaser.Actions.RandomCircle + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Circle} circle - The Circle to position the Game Objects within. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ -exports.fn = function(value) { - var type = Object.prototype.toString.call(value); +var RandomCircle = function (items, circle) +{ + for (var i = 0; i < items.length; i++) + { + Random(circle, items[i]); + } - return type === '[object Function]'; + return items; }; +module.exports = RandomCircle; + /***/ }), -/***/ 370: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ 94985: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var is = __webpack_require__(879); -var delegate = __webpack_require__(438); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Random = __webpack_require__(72006); /** - * Validates all params and calls the right - * listener function based on its target type. + * Takes an array of Game Objects and positions them at random locations within the Ellipse. + * + * If you wish to pass a `Phaser.GameObjects.Ellipse` Shape to this function, you should pass its `geom` property. * - * @param {String|HTMLElement|HTMLCollection|NodeList} target - * @param {String} type - * @param {Function} callback - * @return {Object} + * @function Phaser.Actions.RandomEllipse + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to position the Game Objects within. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ -function listen(target, type, callback) { - if (!target && !type && !callback) { - throw new Error('Missing required arguments'); +var RandomEllipse = function (items, ellipse) +{ + for (var i = 0; i < items.length; i++) + { + Random(ellipse, items[i]); } - if (!is.string(type)) { - throw new TypeError('Second argument must be a String'); - } + return items; +}; - if (!is.fn(callback)) { - throw new TypeError('Third argument must be a Function'); - } +module.exports = RandomEllipse; - if (is.node(target)) { - return listenNode(target, type, callback); - } - else if (is.nodeList(target)) { - return listenNodeList(target, type, callback); - } - else if (is.string(target)) { - return listenSelector(target, type, callback); - } - else { - throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList'); - } -} -/** - * Adds an event listener to a HTML element - * and returns a remove listener function. - * - * @param {HTMLElement} node - * @param {String} type - * @param {Function} callback - * @return {Object} - */ -function listenNode(node, type, callback) { - node.addEventListener(type, callback); +/***/ }), - return { - destroy: function() { - node.removeEventListener(type, callback); - } - } -} +/***/ 63305: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * Add an event listener to a list of HTML elements - * and returns a remove listener function. - * - * @param {NodeList|HTMLCollection} nodeList - * @param {String} type - * @param {Function} callback - * @return {Object} + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -function listenNodeList(nodeList, type, callback) { - Array.prototype.forEach.call(nodeList, function(node) { - node.addEventListener(type, callback); - }); - return { - destroy: function() { - Array.prototype.forEach.call(nodeList, function(node) { - node.removeEventListener(type, callback); - }); - } - } -} +var Random = __webpack_require__(74077); /** - * Add an event listener to a selector - * and returns a remove listener function. + * Takes an array of Game Objects and positions them at random locations on the Line. + * + * If you wish to pass a `Phaser.GameObjects.Line` Shape to this function, you should pass its `geom` property. * - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @return {Object} + * @function Phaser.Actions.RandomLine + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Line} line - The Line to position the Game Objects randomly on. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ -function listenSelector(selector, type, callback) { - return delegate(document.body, selector, type, callback); -} +var RandomLine = function (items, line) +{ + for (var i = 0; i < items.length; i++) + { + Random(line, items[i]); + } -module.exports = listen; + return items; +}; + +module.exports = RandomLine; /***/ }), -/***/ 817: -/***/ (function(module) { +/***/ 90739: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -function select(element) { - var selectedText; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (element.nodeName === 'SELECT') { - element.focus(); +var Random = __webpack_require__(30001); - selectedText = element.value; +/** + * Takes an array of Game Objects and positions them at random locations within the Rectangle. + * + * @function Phaser.Actions.RandomRectangle + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to position the Game Objects within. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + */ +var RandomRectangle = function (items, rect) +{ + for (var i = 0; i < items.length; i++) + { + Random(rect, items[i]); } - else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { - var isReadOnly = element.hasAttribute('readonly'); - if (!isReadOnly) { - element.setAttribute('readonly', ''); - } + return items; +}; - element.select(); - element.setSelectionRange(0, element.value.length); +module.exports = RandomRectangle; - if (!isReadOnly) { - element.removeAttribute('readonly'); - } - selectedText = element.value; - } - else { - if (element.hasAttribute('contenteditable')) { - element.focus(); - } +/***/ }), - var selection = window.getSelection(); - var range = document.createRange(); +/***/ 91417: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - range.selectNodeContents(element); - selection.removeAllRanges(); - selection.addRange(range); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - selectedText = selection.toString(); +var Random = __webpack_require__(99761); + +/** + * Takes an array of Game Objects and positions them at random locations within the Triangle. + * + * If you wish to pass a `Phaser.GameObjects.Triangle` Shape to this function, you should pass its `geom` property. + * + * @function Phaser.Actions.RandomTriangle + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Triangle} triangle - The Triangle to position the Game Objects within. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + */ +var RandomTriangle = function (items, triangle) +{ + for (var i = 0; i < items.length; i++) + { + Random(triangle, items[i]); } - return selectedText; -} + return items; +}; -module.exports = select; +module.exports = RandomTriangle; /***/ }), -/***/ 279: -/***/ (function(module) { - -function E () { - // Keep this empty so it's easier to inherit from - // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) -} +/***/ 26182: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -E.prototype = { - on: function (name, callback, ctx) { - var e = this.e || (this.e = {}); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - (e[name] || (e[name] = [])).push({ - fn: callback, - ctx: ctx - }); +var PropertyValueInc = __webpack_require__(6124); - return this; - }, +/** + * Takes an array of Game Objects, or any objects that have a public `rotation` property, + * and then adds the given value to each of their `rotation` properties. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `Rotate(group.getChildren(), value, step)` + * + * @function Phaser.Actions.Rotate + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to be added to the `rotation` property (in radians). + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var Rotate = function (items, value, step, index, direction) +{ + return PropertyValueInc(items, 'rotation', value, step, index, direction); +}; - once: function (name, callback, ctx) { - var self = this; - function listener () { - self.off(name, listener); - callback.apply(ctx, arguments); - }; +module.exports = Rotate; - listener._ = callback - return this.on(name, listener, ctx); - }, - emit: function (name) { - var data = [].slice.call(arguments, 1); - var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); - var i = 0; - var len = evtArr.length; +/***/ }), - for (i; i < len; i++) { - evtArr[i].fn.apply(evtArr[i].ctx, data); - } +/***/ 87299: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - off: function (name, callback) { - var e = this.e || (this.e = {}); - var evts = e[name]; - var liveEvents = []; +var RotateAroundDistance = __webpack_require__(72395); +var DistanceBetween = __webpack_require__(53996); - if (evts && callback) { - for (var i = 0, len = evts.length; i < len; i++) { - if (evts[i].fn !== callback && evts[i].fn._ !== callback) - liveEvents.push(evts[i]); - } - } +/** + * Rotates each item around the given point by the given angle. + * + * @function Phaser.Actions.RotateAround + * @since 3.0.0 + * @see Phaser.Math.RotateAroundDistance + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {object} point - Any object with public `x` and `y` properties. + * @param {number} angle - The angle to rotate by, in radians. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + */ +var RotateAround = function (items, point, angle) +{ + var x = point.x; + var y = point.y; - // Remove event from queue to prevent memory leak - // Suggested by https://github.com/lazd - // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 + for (var i = 0; i < items.length; i++) + { + var item = items[i]; - (liveEvents.length) - ? e[name] = liveEvents - : delete e[name]; + RotateAroundDistance(item, x, y, angle, Math.max(1, DistanceBetween(item.x, item.y, x, y))); + } - return this; - } + return items; }; -module.exports = E; -module.exports.TinyEmitter = E; +module.exports = RotateAround; -/***/ }) +/***/ }), -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/************************************************************************/ -/******/ // module exports must be returned from runtime so entry inlining is disabled -/******/ // startup -/******/ // Load entry module and return exports -/******/ return __webpack_require__(686); -/******/ })() -.default; -});; -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define("Phaser", [], factory); - else if(typeof exports === 'object') - exports["Phaser"] = factory(); - else - root["Phaser"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1528); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { +/***/ 92194: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Taken from klasse by mattdesl https://github.com/mattdesl/klasse - -function hasGetterOrSetter (def) -{ - return (!!def.get && typeof def.get === 'function') || (!!def.set && typeof def.set === 'function'); -} - -function getProperty (definition, k, isClassDescriptor) -{ - // This may be a lightweight object, OR it might be a property that was defined previously. - - // For simple class descriptors we can just assume its NOT previously defined. - var def = (isClassDescriptor) ? definition[k] : Object.getOwnPropertyDescriptor(definition, k); +var MathRotateAroundDistance = __webpack_require__(72395); - if (!isClassDescriptor && def.value && typeof def.value === 'object') +/** + * Rotates an array of Game Objects around a point by the given angle and distance. + * + * @function Phaser.Actions.RotateAroundDistance + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {object} point - Any object with public `x` and `y` properties. + * @param {number} angle - The angle to rotate by, in radians. + * @param {number} distance - The distance from the point of rotation in pixels. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + */ +var RotateAroundDistance = function (items, point, angle, distance) +{ + var x = point.x; + var y = point.y; + + // There's nothing to do + if (distance === 0) { - def = def.value; + return items; } - // This might be a regular property, or it may be a getter/setter the user defined in a class. - if (def && hasGetterOrSetter(def)) + for (var i = 0; i < items.length; i++) { - if (typeof def.enumerable === 'undefined') - { - def.enumerable = true; - } + MathRotateAroundDistance(items[i], x, y, angle, distance); + } - if (typeof def.configurable === 'undefined') - { - def.configurable = true; - } + return items; +}; - return def; - } - else - { - return false; - } -} +module.exports = RotateAroundDistance; -function hasNonConfigurable (obj, k) -{ - var prop = Object.getOwnPropertyDescriptor(obj, k); - if (!prop) - { - return false; - } +/***/ }), - if (prop.value && typeof prop.value === 'object') - { - prop = prop.value; - } +/***/ 30363: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (prop.configurable === false) - { - return true; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return false; -} +var PropertyValueInc = __webpack_require__(6124); /** - * Extends the given `myClass` object's prototype with the properties of `definition`. + * Takes an array of Game Objects, or any objects that have a public `scaleX` property, + * and then adds the given value to each of their `scaleX` properties. * - * @function extend - * @ignore - * @param {Object} ctor The constructor object to mix into. - * @param {Object} definition A dictionary of functions for the class. - * @param {boolean} isClassDescriptor Is the definition a class descriptor? - * @param {Object} [extend] The parent constructor object. + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `ScaleX(group.getChildren(), value, step)` + * + * @function Phaser.Actions.ScaleX + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to be added to the `scaleX` property. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ -function extend (ctor, definition, isClassDescriptor, extend) +var ScaleX = function (items, value, step, index, direction) { - for (var k in definition) - { - if (!definition.hasOwnProperty(k)) - { - continue; - } + return PropertyValueInc(items, 'scaleX', value, step, index, direction); +}; - var def = getProperty(definition, k, isClassDescriptor); +module.exports = ScaleX; - if (def !== false) - { - // If Extends is used, we will check its prototype to see if the final variable exists. - var parent = extend || ctor; +/***/ }), - if (hasNonConfigurable(parent.prototype, k)) - { - // Just skip the final property - if (Class.ignoreFinals) - { - continue; - } +/***/ 51449: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // We cannot re-define a property that is configurable=false. - // So we will consider them final and throw an error. This is by - // default so it is clear to the developer what is happening. - // You can set ignoreFinals to true if you need to extend a class - // which has configurable=false; it will simply not re-define final properties. - throw new Error('cannot override final property \'' + k + '\', set Class.ignoreFinals = true to skip'); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - Object.defineProperty(ctor.prototype, k, def); - } - else - { - ctor.prototype[k] = definition[k]; - } - } -} +var PropertyValueInc = __webpack_require__(6124); /** - * Applies the given `mixins` to the prototype of `myClass`. + * Takes an array of Game Objects, or any objects that have public `scaleX` and `scaleY` properties, + * and then adds the given value to each of them. * - * @function mixin - * @ignore - * @param {Object} myClass The constructor object to mix into. - * @param {Object|Array} mixins The mixins to apply to the constructor. + * The optional `stepX` and `stepY` properties are applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `ScaleXY(group.getChildren(), scaleX, scaleY, stepX, stepY)` + * + * @function Phaser.Actions.ScaleXY + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} scaleX - The amount to be added to the `scaleX` property. + * @param {number} [scaleY] - The amount to be added to the `scaleY` property. If `undefined` or `null` it uses the `scaleX` value. + * @param {number} [stepX=0] - This is added to the `scaleX` amount, multiplied by the iteration counter. + * @param {number} [stepY=0] - This is added to the `scaleY` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ -function mixin (myClass, mixins) +var ScaleXY = function (items, scaleX, scaleY, stepX, stepY, index, direction) { - if (!mixins) - { - return; - } + if (scaleY === undefined || scaleY === null) { scaleY = scaleX; } - if (!Array.isArray(mixins)) - { - mixins = [ mixins ]; - } + PropertyValueInc(items, 'scaleX', scaleX, stepX, index, direction); - for (var i = 0; i < mixins.length; i++) - { - extend(myClass, mixins[i].prototype || mixins[i]); - } -} + return PropertyValueInc(items, 'scaleY', scaleY, stepY, index, direction); +}; + +module.exports = ScaleXY; + + +/***/ }), + +/***/ 64895: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * Creates a new class with the given descriptor. - * The constructor, defined by the name `initialize`, - * is an optional function. If unspecified, an anonymous - * function will be used which calls the parent class (if - * one exists). + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var PropertyValueInc = __webpack_require__(6124); + +/** + * Takes an array of Game Objects, or any objects that have a public `scaleY` property, + * and then adds the given value to each of their `scaleY` properties. * - * You can also use `Extends` and `Mixins` to provide subclassing - * and inheritance. + * The optional `step` property is applied incrementally, multiplied by each item in the array. * - * @class Phaser.Class - * @constructor - * @param {Object} definition a dictionary of functions for the class - * @example + * To use this with a Group: `ScaleY(group.getChildren(), value, step)` * - * var MyClass = new Phaser.Class({ + * @function Phaser.Actions.ScaleY + * @since 3.0.0 * - * initialize: function() { - * this.foo = 2.0; - * }, + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] * - * bar: function() { - * return this.foo + 5; - * } - * }); + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to be added to the `scaleY` property. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ -function Class (definition) +var ScaleY = function (items, value, step, index, direction) { - if (!definition) - { - definition = {}; - } - - // The variable name here dictates what we see in Chrome debugger - var initialize; - var Extends; + return PropertyValueInc(items, 'scaleY', value, step, index, direction); +}; - if (definition.initialize) - { - if (typeof definition.initialize !== 'function') - { - throw new Error('initialize must be a function'); - } +module.exports = ScaleY; - initialize = definition.initialize; - // Usually we should avoid 'delete' in V8 at all costs. - // However, its unlikely to make any performance difference - // here since we only call this on class creation (i.e. not object creation). - delete definition.initialize; - } - else if (definition.Extends) - { - var base = definition.Extends; +/***/ }), - initialize = function () - { - base.apply(this, arguments); - }; - } - else - { - initialize = function () {}; - } +/***/ 30329: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (definition.Extends) - { - initialize.prototype = Object.create(definition.Extends.prototype); - initialize.prototype.constructor = initialize; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // For getOwnPropertyDescriptor to work, we need to act directly on the Extends (or Mixin) +var PropertyValueSet = __webpack_require__(23646); - Extends = definition.Extends; +/** + * Takes an array of Game Objects, or any objects that have the public property `alpha` + * and then sets it to the given value. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `SetAlpha(group.getChildren(), value, step)` + * + * @function Phaser.Actions.SetAlpha + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var SetAlpha = function (items, value, step, index, direction) +{ + return PropertyValueSet(items, 'alpha', value, step, index, direction); +}; - delete definition.Extends; - } - else - { - initialize.prototype.constructor = initialize; - } +module.exports = SetAlpha; - // Grab the mixins, if they are specified... - var mixins = null; - if (definition.Mixins) - { - mixins = definition.Mixins; - delete definition.Mixins; - } +/***/ }), - // First, mixin if we can. - mixin(initialize, mixins); +/***/ 43954: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Now we grab the actual definition which defines the overrides. - extend(initialize, definition, true, Extends); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return initialize; -} +var PropertyValueSet = __webpack_require__(23646); -Class.extend = extend; -Class.mixin = mixin; -Class.ignoreFinals = false; +/** + * Takes an array of Game Objects, or any objects that have the public property `blendMode` + * and then sets it to the given value. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `SetBlendMode(group.getChildren(), value)` + * + * @function Phaser.Actions.SetBlendMode + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to set the property to. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var SetBlendMode = function (items, value, index, direction) +{ + return PropertyValueSet(items, 'blendMode', value, 0, index, direction); +}; -module.exports = Class; +module.exports = SetBlendMode; /***/ }), -/* 1 */ -/***/ (function(module, exports) { + +/***/ 70688: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var PropertyValueSet = __webpack_require__(23646); + /** - * A NOOP (No Operation) callback function. + * Takes an array of Game Objects, or any objects that have the public property `depth` + * and then sets it to the given value. * - * Used internally by Phaser when it's more expensive to determine if a callback exists - * than it is to just invoke an empty function. + * The optional `step` property is applied incrementally, multiplied by each item in the array. * - * @function Phaser.Utils.NOOP + * To use this with a Group: `SetDepth(group.getChildren(), value, step)` + * + * @function Phaser.Actions.SetDepth * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ -var NOOP = function () +var SetDepth = function (items, value, step, index, direction) { - // NOOP + return PropertyValueSet(items, 'depth', value, step, index, direction); }; -module.exports = NOOP; +module.exports = SetDepth; /***/ }), -/* 2 */ -/***/ (function(module, exports) { + +/***/ 8314: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Finds the key within the top level of the {@link source} object, or returns {@link defaultValue} + * Passes all provided Game Objects to the Input Manager to enable them for input with identical areas and callbacks. + * + * @see {@link Phaser.GameObjects.GameObject#setInteractive} * - * @function Phaser.Utils.Objects.GetFastValue + * @function Phaser.Actions.SetHitArea * @since 3.0.0 * - * @param {object} source - The object to search - * @param {string} key - The key for the property on source. Must exist at the top level of the source object (no periods) - * @param {*} [defaultValue] - The default value to use if the key does not exist. + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] * - * @return {*} The value if found; otherwise, defaultValue (null if none provided) + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {*} hitArea - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. + * @param {Phaser.Types.Input.HitAreaCallback} hitAreaCallback - A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ -var GetFastValue = function (source, key, defaultValue) +var SetHitArea = function (items, hitArea, hitAreaCallback) { - var t = typeof(source); - - if (!source || t === 'number' || t === 'string') - { - return defaultValue; - } - else if (source.hasOwnProperty(key) && source[key] !== undefined) - { - return source[key]; - } - else + for (var i = 0; i < items.length; i++) { - return defaultValue; + items[i].setInteractive(hitArea, hitAreaCallback); } + + return items; }; -module.exports = GetFastValue; +module.exports = SetHitArea; /***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 12894: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - -var Class = __webpack_require__(0); -var FuzzyEqual = __webpack_require__(124); +var PropertyValueSet = __webpack_require__(23646); /** - * @classdesc - * A representation of a vector in 2D space. + * Takes an array of Game Objects, or any objects that have the public properties `originX` and `originY` + * and then sets them to the given values. * - * A two-component vector. + * The optional `stepX` and `stepY` properties are applied incrementally, multiplied by each item in the array. * - * @class Vector2 - * @memberof Phaser.Math - * @constructor + * To use this with a Group: `SetOrigin(group.getChildren(), originX, originY, stepX, stepY)` + * + * @function Phaser.Actions.SetOrigin * @since 3.0.0 * - * @param {number|Phaser.Types.Math.Vector2Like} [x] - The x component, or an object with `x` and `y` properties. - * @param {number} [y] - The y component. + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} originX - The amount to set the `originX` property to. + * @param {number} [originY] - The amount to set the `originY` property to. If `undefined` or `null` it uses the `originX` value. + * @param {number} [stepX=0] - This is added to the `originX` amount, multiplied by the iteration counter. + * @param {number} [stepY=0] - This is added to the `originY` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ -var Vector2 = new Class({ +var SetOrigin = function (items, originX, originY, stepX, stepY, index, direction) +{ + if (originY === undefined || originY === null) { originY = originX; } - initialize: + PropertyValueSet(items, 'originX', originX, stepX, index, direction); + PropertyValueSet(items, 'originY', originY, stepY, index, direction); - function Vector2 (x, y) + items.forEach(function (item) { - /** - * The x component of this Vector. - * - * @name Phaser.Math.Vector2#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.x = 0; - - /** - * The y component of this Vector. - * - * @name Phaser.Math.Vector2#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; + item.updateDisplayOrigin(); + }); - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - } - else - { - if (y === undefined) { y = x; } + return items; +}; - this.x = x || 0; - this.y = y || 0; - } - }, +module.exports = SetOrigin; - /** - * Make a clone of this Vector2. - * - * @method Phaser.Math.Vector2#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Vector2} A clone of this Vector2. - */ - clone: function () - { - return new Vector2(this.x, this.y); - }, - /** - * Copy the components of a given Vector into this Vector. - * - * @method Phaser.Math.Vector2#copy - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} src - The Vector to copy the components from. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - copy: function (src) - { - this.x = src.x || 0; - this.y = src.y || 0; +/***/ }), - return this; - }, +/***/ 38767: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Set the component values of this Vector from a given Vector2Like object. - * - * @method Phaser.Math.Vector2#setFromObject - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} obj - The object containing the component values to set for this Vector. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - setFromObject: function (obj) - { - this.x = obj.x || 0; - this.y = obj.y || 0; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var PropertyValueSet = __webpack_require__(23646); - /** - * Set the `x` and `y` components of the this Vector to the given `x` and `y` values. - * - * @method Phaser.Math.Vector2#set - * @since 3.0.0 - * - * @param {number} x - The x value to set for this Vector. - * @param {number} [y=x] - The y value to set for this Vector. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - set: function (x, y) - { - if (y === undefined) { y = x; } +/** + * Takes an array of Game Objects, or any objects that have the public property `rotation` + * and then sets it to the given value. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `SetRotation(group.getChildren(), value, step)` + * + * @function Phaser.Actions.SetRotation + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var SetRotation = function (items, value, step, index, direction) +{ + return PropertyValueSet(items, 'rotation', value, step, index, direction); +}; - this.x = x; - this.y = y; +module.exports = SetRotation; - return this; - }, - /** - * This method is an alias for `Vector2.set`. - * - * @method Phaser.Math.Vector2#setTo - * @since 3.4.0 - * - * @param {number} x - The x value to set for this Vector. - * @param {number} [y=x] - The y value to set for this Vector. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - setTo: function (x, y) - { - return this.set(x, y); - }, +/***/ }), - /** - * Sets the `x` and `y` values of this object from a given polar coordinate. - * - * @method Phaser.Math.Vector2#setToPolar - * @since 3.0.0 - * - * @param {number} azimuth - The angular coordinate, in radians. - * @param {number} [radius=1] - The radial coordinate (length). - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - setToPolar: function (azimuth, radius) - { - if (radius == null) { radius = 1; } +/***/ 18584: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.x = Math.cos(azimuth) * radius; - this.y = Math.sin(azimuth) * radius; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var PropertyValueSet = __webpack_require__(23646); - /** - * Check whether this Vector is equal to a given Vector. - * - * Performs a strict equality check against each Vector's components. - * - * @method Phaser.Math.Vector2#equals - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} v - The vector to compare with this Vector. - * - * @return {boolean} Whether the given Vector is equal to this Vector. - */ - equals: function (v) - { - return ((this.x === v.x) && (this.y === v.y)); - }, +/** + * Takes an array of Game Objects, or any objects that have the public properties `scaleX` and `scaleY` + * and then sets them to the given values. + * + * The optional `stepX` and `stepY` properties are applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `SetScale(group.getChildren(), scaleX, scaleY, stepX, stepY)` + * + * @function Phaser.Actions.SetScale + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} scaleX - The amount to set the `scaleX` property to. + * @param {number} [scaleY] - The amount to set the `scaleY` property to. If `undefined` or `null` it uses the `scaleX` value. + * @param {number} [stepX=0] - This is added to the `scaleX` amount, multiplied by the iteration counter. + * @param {number} [stepY=0] - This is added to the `scaleY` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var SetScale = function (items, scaleX, scaleY, stepX, stepY, index, direction) +{ + if (scaleY === undefined || scaleY === null) { scaleY = scaleX; } - /** - * Check whether this Vector is approximately equal to a given Vector. - * - * @method Phaser.Math.Vector2#fuzzyEquals - * @since 3.23.0 - * - * @param {Phaser.Types.Math.Vector2Like} v - The vector to compare with this Vector. - * @param {number} [epsilon=0.0001] - The tolerance value. - * - * @return {boolean} Whether both absolute differences of the x and y components are smaller than `epsilon`. - */ - fuzzyEquals: function (v, epsilon) - { - return (FuzzyEqual(this.x, v.x, epsilon) && FuzzyEqual(this.y, v.y, epsilon)); - }, + PropertyValueSet(items, 'scaleX', scaleX, stepX, index, direction); - /** - * Calculate the angle between this Vector and the positive x-axis, in radians. - * - * @method Phaser.Math.Vector2#angle - * @since 3.0.0 - * - * @return {number} The angle between this Vector, and the positive x-axis, given in radians. - */ - angle: function () - { - // computes the angle in radians with respect to the positive x-axis + return PropertyValueSet(items, 'scaleY', scaleY, stepY, index, direction); +}; - var angle = Math.atan2(this.y, this.x); +module.exports = SetScale; - if (angle < 0) - { - angle += 2 * Math.PI; - } - return angle; - }, +/***/ }), - /** - * Set the angle of this Vector. - * - * @method Phaser.Math.Vector2#setAngle - * @since 3.23.0 - * - * @param {number} angle - The angle, in radians. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - setAngle: function (angle) - { - return this.setToPolar(angle, this.length()); - }, +/***/ 17381: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Add a given Vector to this Vector. Addition is component-wise. - * - * @method Phaser.Math.Vector2#add - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} src - The Vector to add to this Vector. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - add: function (src) - { - this.x += src.x; - this.y += src.y; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var PropertyValueSet = __webpack_require__(23646); - /** - * Subtract the given Vector from this Vector. Subtraction is component-wise. - * - * @method Phaser.Math.Vector2#subtract - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} src - The Vector to subtract from this Vector. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - subtract: function (src) - { - this.x -= src.x; - this.y -= src.y; +/** + * Takes an array of Game Objects, or any objects that have the public property `scaleX` + * and then sets it to the given value. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `SetScaleX(group.getChildren(), value, step)` + * + * @function Phaser.Actions.SetScaleX + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var SetScaleX = function (items, value, step, index, direction) +{ + return PropertyValueSet(items, 'scaleX', value, step, index, direction); +}; - return this; - }, +module.exports = SetScaleX; - /** - * Perform a component-wise multiplication between this Vector and the given Vector. - * - * Multiplies this Vector by the given Vector. - * - * @method Phaser.Math.Vector2#multiply - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} src - The Vector to multiply this Vector by. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - multiply: function (src) - { - this.x *= src.x; - this.y *= src.y; - return this; - }, +/***/ }), - /** - * Scale this Vector by the given value. - * - * @method Phaser.Math.Vector2#scale - * @since 3.0.0 - * - * @param {number} value - The value to scale this Vector by. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - scale: function (value) - { - if (isFinite(value)) - { - this.x *= value; - this.y *= value; - } - else - { - this.x = 0; - this.y = 0; - } +/***/ 74370: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Perform a component-wise division between this Vector and the given Vector. - * - * Divides this Vector by the given Vector. - * - * @method Phaser.Math.Vector2#divide - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} src - The Vector to divide this Vector by. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - divide: function (src) - { - this.x /= src.x; - this.y /= src.y; +var PropertyValueSet = __webpack_require__(23646); - return this; - }, +/** + * Takes an array of Game Objects, or any objects that have the public property `scaleY` + * and then sets it to the given value. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `SetScaleY(group.getChildren(), value, step)` + * + * @function Phaser.Actions.SetScaleY + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var SetScaleY = function (items, value, step, index, direction) +{ + return PropertyValueSet(items, 'scaleY', value, step, index, direction); +}; - /** - * Negate the `x` and `y` components of this Vector. - * - * @method Phaser.Math.Vector2#negate - * @since 3.0.0 - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - negate: function () - { - this.x = -this.x; - this.y = -this.y; +module.exports = SetScaleY; - return this; - }, - /** - * Calculate the distance between this Vector and the given Vector. - * - * @method Phaser.Math.Vector2#distance - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} src - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector. - */ - distance: function (src) - { - var dx = src.x - this.x; - var dy = src.y - this.y; +/***/ }), - return Math.sqrt(dx * dx + dy * dy); - }, +/***/ 27773: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Calculate the distance between this Vector and the given Vector, squared. - * - * @method Phaser.Math.Vector2#distanceSq - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} src - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector, squared. - */ - distanceSq: function (src) - { - var dx = src.x - this.x; - var dy = src.y - this.y; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return dx * dx + dy * dy; - }, +var PropertyValueSet = __webpack_require__(23646); - /** - * Calculate the length (or magnitude) of this Vector. - * - * @method Phaser.Math.Vector2#length - * @since 3.0.0 - * - * @return {number} The length of this Vector. - */ - length: function () - { - var x = this.x; - var y = this.y; +/** + * Takes an array of Game Objects, or any objects that have the public properties `scrollFactorX` and `scrollFactorY` + * and then sets them to the given values. + * + * The optional `stepX` and `stepY` properties are applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `SetScrollFactor(group.getChildren(), scrollFactorX, scrollFactorY, stepX, stepY)` + * + * @function Phaser.Actions.SetScrollFactor + * @since 3.21.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} scrollFactorX - The amount to set the `scrollFactorX` property to. + * @param {number} [scrollFactorY] - The amount to set the `scrollFactorY` property to. If `undefined` or `null` it uses the `scrollFactorX` value. + * @param {number} [stepX=0] - This is added to the `scrollFactorX` amount, multiplied by the iteration counter. + * @param {number} [stepY=0] - This is added to the `scrollFactorY` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var SetScrollFactor = function (items, scrollFactorX, scrollFactorY, stepX, stepY, index, direction) +{ + if (scrollFactorY === undefined || scrollFactorY === null) { scrollFactorY = scrollFactorX; } - return Math.sqrt(x * x + y * y); - }, + PropertyValueSet(items, 'scrollFactorX', scrollFactorX, stepX, index, direction); - /** - * Set the length (or magnitude) of this Vector. - * - * @method Phaser.Math.Vector2#setLength - * @since 3.23.0 - * - * @param {number} length - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - setLength: function (length) - { - return this.normalize().scale(length); - }, + return PropertyValueSet(items, 'scrollFactorY', scrollFactorY, stepY, index, direction); +}; - /** - * Calculate the length of this Vector squared. - * - * @method Phaser.Math.Vector2#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Vector, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; +module.exports = SetScrollFactor; - return x * x + y * y; - }, - /** - * Normalize this Vector. - * - * Makes the vector a unit length vector (magnitude of 1) in the same direction. - * - * @method Phaser.Math.Vector2#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - normalize: function () - { - var x = this.x; - var y = this.y; - var len = x * x + y * y; +/***/ }), - if (len > 0) - { - len = 1 / Math.sqrt(len); +/***/ 75257: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.x = x * len; - this.y = y * len; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var PropertyValueSet = __webpack_require__(23646); - /** - * Rotate this Vector to its perpendicular, in the positive direction. - * - * @method Phaser.Math.Vector2#normalizeRightHand - * @since 3.0.0 - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - normalizeRightHand: function () - { - var x = this.x; - - this.x = this.y * -1; - this.y = x; - - return this; - }, - - /** - * Rotate this Vector to its perpendicular, in the negative direction. - * - * @method Phaser.Math.Vector2#normalizeLeftHand - * @since 3.23.0 - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - normalizeLeftHand: function () - { - var x = this.x; - - this.x = this.y; - this.y = x * -1; - - return this; - }, - - /** - * Calculate the dot product of this Vector and the given Vector. - * - * @method Phaser.Math.Vector2#dot - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} src - The Vector2 to dot product with this Vector2. - * - * @return {number} The dot product of this Vector and the given Vector. - */ - dot: function (src) - { - return this.x * src.x + this.y * src.y; - }, - - /** - * Calculate the cross product of this Vector and the given Vector. - * - * @method Phaser.Math.Vector2#cross - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} src - The Vector2 to cross with this Vector2. - * - * @return {number} The cross product of this Vector and the given Vector. - */ - cross: function (src) - { - return this.x * src.y - this.y * src.x; - }, +/** + * Takes an array of Game Objects, or any objects that have the public property `scrollFactorX` + * and then sets it to the given value. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `SetScrollFactorX(group.getChildren(), value, step)` + * + * @function Phaser.Actions.SetScrollFactorX + * @since 3.21.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var SetScrollFactorX = function (items, value, step, index, direction) +{ + return PropertyValueSet(items, 'scrollFactorX', value, step, index, direction); +}; - /** - * Linearly interpolate between this Vector and the given Vector. - * - * Interpolates this Vector towards the given Vector. - * - * @method Phaser.Math.Vector2#lerp - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} src - The Vector2 to interpolate towards. - * @param {number} [t=0] - The interpolation percentage, between 0 and 1. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - lerp: function (src, t) - { - if (t === undefined) { t = 0; } +module.exports = SetScrollFactorX; - var ax = this.x; - var ay = this.y; - this.x = ax + t * (src.x - ax); - this.y = ay + t * (src.y - ay); +/***/ }), - return this; - }, +/***/ 54512: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector2#transformMat3 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector2 with. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - transformMat3: function (mat) - { - var x = this.x; - var y = this.y; - var m = mat.val; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.x = m[0] * x + m[3] * y + m[6]; - this.y = m[1] * x + m[4] * y + m[7]; +var PropertyValueSet = __webpack_require__(23646); - return this; - }, +/** + * Takes an array of Game Objects, or any objects that have the public property `scrollFactorY` + * and then sets it to the given value. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `SetScrollFactorY(group.getChildren(), value, step)` + * + * @function Phaser.Actions.SetScrollFactorY + * @since 3.21.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var SetScrollFactorY = function (items, value, step, index, direction) +{ + return PropertyValueSet(items, 'scrollFactorY', value, step, index, direction); +}; - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector2#transformMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector2 with. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - transformMat4: function (mat) - { - var x = this.x; - var y = this.y; - var m = mat.val; +module.exports = SetScrollFactorY; - this.x = m[0] * x + m[4] * y + m[12]; - this.y = m[1] * x + m[5] * y + m[13]; - return this; - }, +/***/ }), - /** - * Make this Vector the zero vector (0, 0). - * - * @method Phaser.Math.Vector2#reset - * @since 3.0.0 - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - reset: function () - { - this.x = 0; - this.y = 0; +/***/ 69423: +/***/ ((module) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Limit the length (or magnitude) of this Vector. - * - * @method Phaser.Math.Vector2#limit - * @since 3.23.0 - * - * @param {number} max - The maximum length. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - limit: function (max) +/** + * Takes an array of Game Objects, or any objects that have the public method setTint() and then updates it to the given value(s). You can specify tint color per corner or provide only one color value for `topLeft` parameter, in which case whole item will be tinted with that color. + * + * @function Phaser.Actions.SetTint + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {number} topLeft - The tint being applied to top-left corner of item. If other parameters are given no value, this tint will be applied to whole item. + * @param {number} [topRight] - The tint to be applied to top-right corner of item. + * @param {number} [bottomLeft] - The tint to be applied to the bottom-left corner of item. + * @param {number} [bottomRight] - The tint to be applied to the bottom-right corner of item. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + */ +var SetTint = function (items, topLeft, topRight, bottomLeft, bottomRight) +{ + for (var i = 0; i < items.length; i++) { - var len = this.length(); - - if (len && len > max) - { - this.scale(max / len); - } + items[i].setTint(topLeft, topRight, bottomLeft, bottomRight); + } - return this; - }, + return items; +}; - /** - * Reflect this Vector off a line defined by a normal. - * - * @method Phaser.Math.Vector2#reflect - * @since 3.23.0 - * - * @param {Phaser.Math.Vector2} normal - A vector perpendicular to the line. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - reflect: function (normal) - { - normal = normal.clone().normalize(); +module.exports = SetTint; - return this.subtract(normal.scale(2 * this.dot(normal))); - }, - /** - * Reflect this Vector across another. - * - * @method Phaser.Math.Vector2#mirror - * @since 3.23.0 - * - * @param {Phaser.Math.Vector2} axis - A vector to reflect across. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - mirror: function (axis) - { - return this.reflect(axis).negate(); - }, +/***/ }), - /** - * Rotate this Vector by an angle amount. - * - * @method Phaser.Math.Vector2#rotate - * @since 3.23.0 - * - * @param {number} delta - The angle to rotate by, in radians. - * - * @return {Phaser.Math.Vector2} This Vector2. - */ - rotate: function (delta) - { - var cos = Math.cos(delta); - var sin = Math.sin(delta); +/***/ 58291: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this.set(cos * this.x - sin * this.y, sin * this.x + cos * this.y); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -}); +var PropertyValueSet = __webpack_require__(23646); /** - * A static zero Vector2 for use by reference. + * Takes an array of Game Objects, or any objects that have the public property `visible` + * and then sets it to the given value. * - * This constant is meant for comparison operations and should not be modified directly. + * To use this with a Group: `SetVisible(group.getChildren(), value)` * - * @constant - * @name Phaser.Math.Vector2.ZERO - * @type {Phaser.Math.Vector2} - * @since 3.1.0 - */ -Vector2.ZERO = new Vector2(); - -/** - * A static right Vector2 for use by reference. + * @function Phaser.Actions.SetVisible + * @since 3.0.0 * - * This constant is meant for comparison operations and should not be modified directly. + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] * - * @constant - * @name Phaser.Math.Vector2.RIGHT - * @type {Phaser.Math.Vector2} - * @since 3.16.0 + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {boolean} value - The value to set the property to. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ -Vector2.RIGHT = new Vector2(1, 0); +var SetVisible = function (items, value, index, direction) +{ + return PropertyValueSet(items, 'visible', value, 0, index, direction); +}; + +module.exports = SetVisible; + + +/***/ }), + +/***/ 94833: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * A static left Vector2 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector2.LEFT - * @type {Phaser.Math.Vector2} - * @since 3.16.0 + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -Vector2.LEFT = new Vector2(-1, 0); + +var PropertyValueSet = __webpack_require__(23646); /** - * A static up Vector2 for use by reference. + * Takes an array of Game Objects, or any objects that have the public property `x` + * and then sets it to the given value. * - * This constant is meant for comparison operations and should not be modified directly. + * The optional `step` property is applied incrementally, multiplied by each item in the array. * - * @constant - * @name Phaser.Math.Vector2.UP - * @type {Phaser.Math.Vector2} - * @since 3.16.0 - */ -Vector2.UP = new Vector2(0, -1); - -/** - * A static down Vector2 for use by reference. + * To use this with a Group: `SetX(group.getChildren(), value, step)` * - * This constant is meant for comparison operations and should not be modified directly. + * @function Phaser.Actions.SetX + * @since 3.0.0 * - * @constant - * @name Phaser.Math.Vector2.DOWN - * @type {Phaser.Math.Vector2} - * @since 3.16.0 - */ -Vector2.DOWN = new Vector2(0, 1); - -/** - * A static one Vector2 for use by reference. + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] * - * This constant is meant for comparison operations and should not be modified directly. + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * - * @constant - * @name Phaser.Math.Vector2.ONE - * @type {Phaser.Math.Vector2} - * @since 3.16.0 + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ -Vector2.ONE = new Vector2(1, 1); +var SetX = function (items, value, step, index, direction) +{ + return PropertyValueSet(items, 'x', value, step, index, direction); +}; -module.exports = Vector2; +module.exports = SetX; /***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 14284: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var GEOM_CONST = __webpack_require__(56); +var PropertyValueSet = __webpack_require__(23646); /** - * @classdesc - * Defines a Point in 2D space, with an x and y component. + * Takes an array of Game Objects, or any objects that have the public properties `x` and `y` + * and then sets them to the given values. * - * @class Point - * @memberof Phaser.Geom - * @constructor + * The optional `stepX` and `stepY` properties are applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `SetXY(group.getChildren(), x, y, stepX, stepY)` + * + * @function Phaser.Actions.SetXY * @since 3.0.0 * - * @param {number} [x=0] - The x coordinate of this Point. - * @param {number} [y=x] - The y coordinate of this Point. + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} x - The amount to set the `x` property to. + * @param {number} [y=x] - The amount to set the `y` property to. If `undefined` or `null` it uses the `x` value. + * @param {number} [stepX=0] - This is added to the `x` amount, multiplied by the iteration counter. + * @param {number} [stepY=0] - This is added to the `y` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. */ -var Point = new Class({ +var SetXY = function (items, x, y, stepX, stepY, index, direction) +{ + if (y === undefined || y === null) { y = x; } - initialize: + PropertyValueSet(items, 'x', x, stepX, index, direction); - function Point (x, y) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = x; } + return PropertyValueSet(items, 'y', y, stepY, index, direction); +}; - /** - * The geometry constant type of this object: `GEOM_CONST.POINT`. - * Used for fast type comparisons. - * - * @name Phaser.Geom.Point#type - * @type {number} - * @readonly - * @since 3.19.0 - */ - this.type = GEOM_CONST.POINT; +module.exports = SetXY; - /** - * The x coordinate of this Point. - * - * @name Phaser.Geom.Point#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.x = x; - /** - * The y coordinate of this Point. - * - * @name Phaser.Geom.Point#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = y; - }, +/***/ }), - /** - * Set the x and y coordinates of the point to the given values. - * - * @method Phaser.Geom.Point#setTo - * @since 3.0.0 - * - * @param {number} [x=0] - The x coordinate of this Point. - * @param {number} [y=x] - The y coordinate of this Point. - * - * @return {this} This Point object. - */ - setTo: function (x, y) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = x; } +/***/ 96574: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.x = x; - this.y = y; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - } +var PropertyValueSet = __webpack_require__(23646); -}); +/** + * Takes an array of Game Objects, or any objects that have the public property `y` + * and then sets it to the given value. + * + * The optional `step` property is applied incrementally, multiplied by each item in the array. + * + * To use this with a Group: `SetY(group.getChildren(), value, step)` + * + * @function Phaser.Actions.SetY + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + */ +var SetY = function (items, value, step, index, direction) +{ + return PropertyValueSet(items, 'y', value, step, index, direction); +}; -module.exports = Point; +module.exports = SetY; /***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 74086: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(24); -var SceneEvents = __webpack_require__(20); +var Vector2 = __webpack_require__(93736); /** - * @classdesc - * The Game Object Factory is a Scene plugin that allows you to quickly create many common - * types of Game Objects and have them automatically registered with the Scene. + * Takes an array of items, such as Game Objects, or any objects with public `x` and + * `y` properties and then iterates through them. As this function iterates, it moves + * the position of the current element to be that of the previous entry in the array. + * This repeats until all items have been moved. * - * Game Objects directly register themselves with the Factory and inject their own creation - * methods into the class. + * The direction controls the order of iteration. A value of 0 (the default) assumes + * that the final item in the array is the 'head' item. * - * @class GameObjectFactory - * @memberof Phaser.GameObjects - * @constructor + * A direction value of 1 assumes that the first item in the array is the 'head' item. + * + * The position of the 'head' item is set to the x/y values given to this function. + * Every other item in the array is then updated, in sequence, to be that of the + * previous (or next) entry in the array. + * + * The final x/y coords are returned, or set in the 'output' Vector2. + * + * Think of it as being like the game Snake, where the 'head' is moved and then + * each body piece is moved into the space of the previous piece. + * + * @function Phaser.Actions.ShiftPosition * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene to which this Game Object Factory belongs. + * @generic {Phaser.GameObjects.GameObject[]} G - [items] + * @generic {Phaser.Math.Vector2} O - [output,$return] + * + * @param {(Phaser.Types.Math.Vector2Like[]|Phaser.GameObjects.GameObject[])} items - An array of Game Objects, or objects with public x and y positions. The contents of this array are updated by this Action. + * @param {number} x - The x coordinate to place the head item at. + * @param {number} y - The y coordinate to place the head item at. + * @param {number} [direction=0] - The iteration direction. 0 = first to last and 1 = last to first. + * @param {Phaser.Types.Math.Vector2Like} [output] - An optional Vec2Like object to store the final position in. + * + * @return {Phaser.Types.Math.Vector2Like} The output vector. */ -var GameObjectFactory = new Class({ +var ShiftPosition = function (items, x, y, direction, output) +{ + if (direction === undefined) { direction = 0; } + if (output === undefined) { output = new Vector2(); } - initialize: + var px; + var py; + var len = items.length; - function GameObjectFactory (scene) + if (len === 1) { - /** - * The Scene to which this Game Object Factory belongs. - * - * @name Phaser.GameObjects.GameObjectFactory#scene - * @type {Phaser.Scene} - * @protected - * @since 3.0.0 - */ - this.scene = scene; + px = items[0].x; + py = items[0].y; - /** - * A reference to the Scene.Systems. - * - * @name Phaser.GameObjects.GameObjectFactory#systems - * @type {Phaser.Scenes.Systems} - * @protected - * @since 3.0.0 - */ - this.systems = scene.sys; + items[0].x = x; + items[0].y = y; + } + else + { + var i = 1; + var pos = 0; - /** - * A reference to the Scene Event Emitter. - * - * @name Phaser.GameObjects.GameObjectFactory#events - * @type {Phaser.Events.EventEmitter} - * @protected - * @since 3.50.0 - */ - this.events = scene.sys.events; + if (direction === 0) + { + pos = len - 1; + i = len - 2; + } - /** - * A reference to the Scene Display List. - * - * @name Phaser.GameObjects.GameObjectFactory#displayList - * @type {Phaser.GameObjects.DisplayList} - * @protected - * @since 3.0.0 - */ - this.displayList; + px = items[pos].x; + py = items[pos].y; - /** - * A reference to the Scene Update List. - * - * @name Phaser.GameObjects.GameObjectFactory#updateList - * @type {Phaser.GameObjects.UpdateList} - * @protected - * @since 3.0.0 - */ - this.updateList; + // Update the head item to the new x/y coordinates + items[pos].x = x; + items[pos].y = y; - this.events.once(SceneEvents.BOOT, this.boot, this); - this.events.on(SceneEvents.START, this.start, this); - }, + for (var c = 0; c < len; c++) + { + if (i >= len || i === -1) + { + continue; + } - /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. - * - * @method Phaser.GameObjects.GameObjectFactory#boot - * @private - * @since 3.5.1 - */ - boot: function () - { - this.displayList = this.systems.displayList; - this.updateList = this.systems.updateList; + // Current item + var cur = items[i]; - this.events.once(SceneEvents.DESTROY, this.destroy, this); - }, + // Get current item x/y, to be passed to the next item in the list + var cx = cur.x; + var cy = cur.y; - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. - * - * @method Phaser.GameObjects.GameObjectFactory#start - * @private - * @since 3.5.0 - */ - start: function () - { - this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); - }, + // Set current item to the previous items x/y + cur.x = px; + cur.y = py; - /** - * Adds an existing Game Object to this Scene. - * - * If the Game Object renders, it will be added to the Display List. - * If it has a `preUpdate` method, it will be added to the Update List. - * - * @method Phaser.GameObjects.GameObjectFactory#existing - * @since 3.0.0 - * - * @generic {(Phaser.GameObjects.GameObject|Phaser.GameObjects.Group|Phaser.GameObjects.Layer)} G - [child,$return] - * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.Group|Phaser.GameObjects.Layer)} child - The child to be added to this Scene. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was added. - */ - existing: function (child) - { - if (child.renderCanvas || child.renderWebGL) - { - this.displayList.add(child); - } + // Set current as previous + px = cx; + py = cy; - // For when custom objects have overridden `preUpdate` but don't hook into the ADDED_TO_SCENE event: - // Adding to the list multiple times is safe, as it won't add duplicates into the list anyway. - if (child.preUpdate) - { - this.updateList.add(child); + if (direction === 0) + { + i--; + } + else + { + i++; + } } + } - return child; - }, + // Return the final set of coordinates as they're effectively lost from the shift and may be needed - /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. - * - * @method Phaser.GameObjects.GameObjectFactory#shutdown - * @private - * @since 3.0.0 - */ - shutdown: function () - { - this.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); - }, + output.x = px; + output.y = py; - /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. - * - * @method Phaser.GameObjects.GameObjectFactory#destroy - * @private - * @since 3.0.0 - */ - destroy: function () - { - this.shutdown(); + return output; +}; - this.events.off(SceneEvents.START, this.start, this); +module.exports = ShiftPosition; - this.scene = null; - this.systems = null; - this.events = null; - this.displayList = null; - this.updateList = null; - } +/***/ }), -}); +/***/ 86347: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * Static method called directly by the Game Object factory functions. - * With this method you can register a custom GameObject factory in the GameObjectFactory, - * providing a name (`factoryType`) and the constructor (`factoryFunction`) in order - * to be called when you call to Phaser.Scene.add[ factoryType ] method. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var ArrayShuffle = __webpack_require__(18592); + +/** + * Shuffles the array in place. The shuffled array is both modified and returned. * - * @method Phaser.GameObjects.GameObjectFactory.register - * @static + * @function Phaser.Actions.Shuffle * @since 3.0.0 + * @see Phaser.Utils.Array.Shuffle * - * @param {string} factoryType - The key of the factory that you will use to call to Phaser.Scene.add[ factoryType ] method. - * @param {function} factoryFunction - The constructor function to be called when you invoke to the Phaser.Scene.add method. + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ -GameObjectFactory.register = function (factoryType, factoryFunction) +var Shuffle = function (items) { - if (!GameObjectFactory.prototype.hasOwnProperty(factoryType)) - { - GameObjectFactory.prototype[factoryType] = factoryFunction; - } + return ArrayShuffle(items); }; +module.exports = Shuffle; + + +/***/ }), + +/***/ 1558: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + /** - * Static method called directly by the Game Object factory functions. - * With this method you can remove a custom GameObject factory registered in the GameObjectFactory, - * providing a its `factoryType`. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var MathSmoothStep = __webpack_require__(5514); + +/** + * Smoothstep is a sigmoid-like interpolation and clamping function. + * + * The function depends on three parameters, the input x, the "left edge" and the "right edge", with the left edge being assumed smaller than the right edge. The function receives a real number x as an argument and returns 0 if x is less than or equal to the left edge, 1 if x is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, between 0 and 1 otherwise. The slope of the smoothstep function is zero at both edges. This is convenient for creating a sequence of transitions using smoothstep to interpolate each segment as an alternative to using more sophisticated or expensive interpolation techniques. * - * @method Phaser.GameObjects.GameObjectFactory.remove - * @static + * @function Phaser.Actions.SmoothStep * @since 3.0.0 * - * @param {string} factoryType - The key of the factory that you want to remove from the GameObjectFactory. + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {string} property - The property of the Game Object to interpolate. + * @param {number} min - The minimum interpolation value. + * @param {number} max - The maximum interpolation value. + * @param {boolean} [inc=false] - Should the values be incremented? `true` or set (`false`) + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ -GameObjectFactory.remove = function (factoryType) +var SmoothStep = function (items, property, min, max, inc) { - if (GameObjectFactory.prototype.hasOwnProperty(factoryType)) + if (inc === undefined) { inc = false; } + + var step = Math.abs(max - min) / items.length; + var i; + + if (inc) { - delete GameObjectFactory.prototype[factoryType]; + for (i = 0; i < items.length; i++) + { + items[i][property] += MathSmoothStep(i * step, min, max); + } + } + else + { + for (i = 0; i < items.length; i++) + { + items[i][property] = MathSmoothStep(i * step, min, max); + } } -}; -PluginCache.register('GameObjectFactory', GameObjectFactory, 'add'); + return items; +}; -module.exports = GameObjectFactory; +module.exports = SmoothStep; /***/ }), -/* 6 */ -/***/ (function(module, exports) { + +/***/ 9938: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Source object -// The key as a string, or an array of keys, i.e. 'banner', or 'banner.hideBanner' -// The default value to use if the key doesn't exist +var MathSmootherStep = __webpack_require__(87736); /** - * Retrieves a value from an object. + * Smootherstep is a sigmoid-like interpolation and clamping function. + * + * The function depends on three parameters, the input x, the "left edge" and the "right edge", with the left edge being assumed smaller than the right edge. The function receives a real number x as an argument and returns 0 if x is less than or equal to the left edge, 1 if x is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, between 0 and 1 otherwise. The slope of the smoothstep function is zero at both edges. This is convenient for creating a sequence of transitions using smoothstep to interpolate each segment as an alternative to using more sophisticated or expensive interpolation techniques. * - * @function Phaser.Utils.Objects.GetValue + * @function Phaser.Actions.SmootherStep * @since 3.0.0 * - * @param {object} source - The object to retrieve the value from. - * @param {string} key - The name of the property to retrieve from the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`) - `banner.hideBanner` would return the value of the `hideBanner` property from the object stored in the `banner` property of the `source` object. - * @param {*} defaultValue - The value to return if the `key` isn't found in the `source` object. + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] * - * @return {*} The value of the requested key. + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {string} property - The property of the Game Object to interpolate. + * @param {number} min - The minimum interpolation value. + * @param {number} max - The maximum interpolation value. + * @param {boolean} [inc=false] - Should the values be incremented? `true` or set (`false`) + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. */ -var GetValue = function (source, key, defaultValue) +var SmootherStep = function (items, property, min, max, inc) { - if (!source || typeof source === 'number') - { - return defaultValue; - } - else if (source.hasOwnProperty(key)) - { - return source[key]; - } - else if (key.indexOf('.') !== -1) - { - var keys = key.split('.'); - var parent = source; - var value = defaultValue; + if (inc === undefined) { inc = false; } - // Use for loop here so we can break early - for (var i = 0; i < keys.length; i++) - { - if (parent.hasOwnProperty(keys[i])) - { - // Yes it has a key property, let's carry on down - value = parent[keys[i]]; + var step = Math.abs(max - min) / items.length; + var i; - parent = parent[keys[i]]; - } - else - { - // Can't go any further, so reset to default - value = defaultValue; - break; - } + if (inc) + { + for (i = 0; i < items.length; i++) + { + items[i][property] += MathSmootherStep(i * step, min, max); } - - return value; } else { - return defaultValue; + for (i = 0; i < items.length; i++) + { + items[i][property] = MathSmootherStep(i * step, min, max); + } } + + return items; }; -module.exports = GetValue; +module.exports = SmootherStep; /***/ }), -/* 7 */ -/***/ (function(module, exports) { + +/***/ 71060: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * This is a slightly modified version of jQuery.isPlainObject. - * A plain object is an object whose internal class property is [object Object]. + * Takes an array of Game Objects and then modifies their `property` so the value equals, or is incremented, by the + * calculated spread value. + * + * The spread value is derived from the given `min` and `max` values and the total number of items in the array. + * + * For example, to cause an array of Sprites to change in alpha from 0 to 1 you could call: + * + * ```javascript + * Phaser.Actions.Spread(itemsArray, 'alpha', 0, 1); + * ``` * - * @function Phaser.Utils.Objects.IsPlainObject + * @function Phaser.Actions.Spread * @since 3.0.0 * - * @param {object} obj - The object to inspect. + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] * - * @return {boolean} `true` if the object is plain, otherwise `false`. + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {string} property - The property of the Game Object to spread. + * @param {number} min - The minimum value. + * @param {number} max - The maximum value. + * @param {boolean} [inc=false] - Should the values be incremented? `true` or set (`false`) + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that were passed to this Action. */ -var IsPlainObject = function (obj) +var Spread = function (items, property, min, max, inc) { - // Not plain objects: - // - Any object or value whose internal [[Class]] property is not "[object Object]" - // - DOM nodes - // - window - if (typeof(obj) !== 'object' || obj.nodeType || obj === obj.window) + if (inc === undefined) { inc = false; } + if (items.length === 0) { return items; } + if (items.length === 1) // if only one item put it at the center { - return false; + if (inc) + { + items[0][property] += (max + min) / 2; + } + else + { + items[0][property] = (max + min) / 2; + } + + return items; } - // Support: Firefox <20 - // The try/catch suppresses exceptions thrown when attempting to access - // the "constructor" property of certain host objects, ie. |window.location| - // https://bugzilla.mozilla.org/show_bug.cgi?id=814622 - try + var step = Math.abs(max - min) / (items.length - 1); + var i; + + if (inc) { - if (obj.constructor && !({}).hasOwnProperty.call(obj.constructor.prototype, 'isPrototypeOf')) + for (i = 0; i < items.length; i++) { - return false; + items[i][property] += i * step + min; } } - catch (e) + else { - return false; + for (i = 0; i < items.length; i++) + { + items[i][property] = i * step + min; + } } - // If the function hasn't returned already, we're confident that - // |obj| is a plain object, created by {} or constructed with new Object - return true; + return items; }; -module.exports = IsPlainObject; +module.exports = Spread; /***/ }), -/* 8 */ -/***/ (function(module, exports) { + +/***/ 11207: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var types = {}; +/** + * Takes an array of Game Objects and toggles the visibility of each one. + * Those previously `visible = false` will become `visible = true`, and vice versa. + * + * @function Phaser.Actions.ToggleVisible + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + */ +var ToggleVisible = function (items) +{ + for (var i = 0; i < items.length; i++) + { + items[i].visible = !items[i].visible; + } + + return items; +}; + +module.exports = ToggleVisible; + + +/***/ }), + +/***/ 24404: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @namespace Phaser.Loader.FileTypesManager + * @author Richard Davey + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FileTypesManager = { +var Wrap = __webpack_require__(1071); - /** - * Static method called when a LoaderPlugin is created. - * - * Loops through the local types object and injects all of them as - * properties into the LoaderPlugin instance. - * - * @method Phaser.Loader.FileTypesManager.install - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - The LoaderPlugin to install the types into. - */ - install: function (loader) +/** + * Iterates through the given array and makes sure that each objects x and y + * properties are wrapped to keep them contained within the given Rectangles + * area. + * + * @function Phaser.Actions.WrapInRectangle + * @since 3.0.0 + * @see Phaser.Math.Wrap + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. + * @param {Phaser.Geom.Rectangle} rect - The rectangle which the objects will be wrapped to remain within. + * @param {number} [padding=0] - An amount added to each side of the rectangle during the operation. + * + * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + */ +var WrapInRectangle = function (items, rect, padding) +{ + if (padding === undefined) { - for (var key in types) - { - loader[key] = types[key]; - } - }, + padding = 0; + } - /** - * Static method called directly by the File Types. - * - * The key is a reference to the function used to load the files via the Loader, i.e. `image`. - * - * @method Phaser.Loader.FileTypesManager.register - * @since 3.0.0 - * - * @param {string} key - The key that will be used as the method name in the LoaderPlugin. - * @param {function} factoryFunction - The function that will be called when LoaderPlugin.key is invoked. - */ - register: function (key, factoryFunction) + for (var i = 0; i < items.length; i++) { - types[key] = factoryFunction; - }, + var item = items[i]; - /** - * Removed all associated file types. - * - * @method Phaser.Loader.FileTypesManager.destroy - * @since 3.0.0 - */ - destroy: function () - { - types = {}; + item.x = Wrap(item.x, rect.left - padding, rect.right + padding); + item.y = Wrap(item.y, rect.top - padding, rect.bottom + padding); } + return items; }; -module.exports = FileTypesManager; +module.exports = WrapInRectangle; /***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/***/ 83979: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var has = Object.prototype.hasOwnProperty - , prefix = '~'; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ /** - * Constructor to create a storage for our `EE` objects. - * An `Events` instance is a plain object whose properties are event names. - * - * @constructor - * @private + * @namespace Phaser.Actions */ -function Events() {} -// -// We try to not inherit from `Object.prototype`. In some engines creating an -// instance in this way is faster than calling `Object.create(null)` directly. -// If `Object.create(null)` is not supported we prefix the event names with a -// character to make sure that the built-in object properties are not -// overridden or used as an attack vector. -// -if (Object.create) { - Events.prototype = Object.create(null); +module.exports = { - // - // This hack is needed because the `__proto__` property is still inherited in - // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. - // - if (!new Events().__proto__) prefix = false; -} + AlignTo: __webpack_require__(62270), + Angle: __webpack_require__(61148), + Call: __webpack_require__(22015), + GetFirst: __webpack_require__(31060), + GetLast: __webpack_require__(52367), + GridAlign: __webpack_require__(12673), + IncAlpha: __webpack_require__(691), + IncX: __webpack_require__(3877), + IncXY: __webpack_require__(71020), + IncY: __webpack_require__(28970), + PlaceOnCircle: __webpack_require__(82249), + PlaceOnEllipse: __webpack_require__(30285), + PlaceOnLine: __webpack_require__(61557), + PlaceOnRectangle: __webpack_require__(63549), + PlaceOnTriangle: __webpack_require__(51629), + PlayAnimation: __webpack_require__(1045), + PropertyValueInc: __webpack_require__(6124), + PropertyValueSet: __webpack_require__(23646), + RandomCircle: __webpack_require__(4392), + RandomEllipse: __webpack_require__(94985), + RandomLine: __webpack_require__(63305), + RandomRectangle: __webpack_require__(90739), + RandomTriangle: __webpack_require__(91417), + Rotate: __webpack_require__(26182), + RotateAround: __webpack_require__(87299), + RotateAroundDistance: __webpack_require__(92194), + ScaleX: __webpack_require__(30363), + ScaleXY: __webpack_require__(51449), + ScaleY: __webpack_require__(64895), + SetAlpha: __webpack_require__(30329), + SetBlendMode: __webpack_require__(43954), + SetDepth: __webpack_require__(70688), + SetHitArea: __webpack_require__(8314), + SetOrigin: __webpack_require__(12894), + SetRotation: __webpack_require__(38767), + SetScale: __webpack_require__(18584), + SetScaleX: __webpack_require__(17381), + SetScaleY: __webpack_require__(74370), + SetScrollFactor: __webpack_require__(27773), + SetScrollFactorX: __webpack_require__(75257), + SetScrollFactorY: __webpack_require__(54512), + SetTint: __webpack_require__(69423), + SetVisible: __webpack_require__(58291), + SetX: __webpack_require__(94833), + SetXY: __webpack_require__(14284), + SetY: __webpack_require__(96574), + ShiftPosition: __webpack_require__(74086), + Shuffle: __webpack_require__(86347), + SmootherStep: __webpack_require__(9938), + SmoothStep: __webpack_require__(1558), + Spread: __webpack_require__(71060), + ToggleVisible: __webpack_require__(11207), + WrapInRectangle: __webpack_require__(24404) + +}; + + +/***/ }), + +/***/ 85463: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(16938); +var FindClosestInSorted = __webpack_require__(2406); +var Frame = __webpack_require__(71519); +var GetValue = __webpack_require__(10850); +var SortByDigits = __webpack_require__(28834); /** - * Representation of a single event listener. + * @classdesc + * A Frame based Animation. * - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} [once=false] Specify if the listener is a one-time listener. - * @constructor - * @private - */ -function EE(fn, context, once) { - this.fn = fn; - this.context = context; - this.once = once || false; -} - -/** - * Add a listener for a given event. + * Animations in Phaser consist of a sequence of `AnimationFrame` objects, which are managed by + * this class, along with properties that impact playback, such as the animations frame rate + * or delay. * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} context The context to invoke the listener with. - * @param {Boolean} once Specify if the listener is a one-time listener. - * @returns {EventEmitter} - * @private - */ -function addListener(emitter, event, fn, context, once) { - if (typeof fn !== 'function') { - throw new TypeError('The listener must be a function'); - } - - var listener = new EE(fn, context || emitter, once) - , evt = prefix ? prefix + event : event; - - if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; - else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); - else emitter._events[evt] = [emitter._events[evt], listener]; - - return emitter; -} - -/** - * Clear event by name. + * This class contains all of the properties and methods needed to handle playback of the animation + * directly to an `AnimationState` instance, which is owned by a Sprite, or similar Game Object. * - * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. - * @param {(String|Symbol)} evt The Event name. - * @private - */ -function clearEvent(emitter, evt) { - if (--emitter._eventsCount === 0) emitter._events = new Events(); - else delete emitter._events[evt]; -} - -/** - * Minimal `EventEmitter` interface that is molded against the Node.js - * `EventEmitter` interface. + * You don't typically create an instance of this class directly, but instead go via + * either the `AnimationManager` or the `AnimationState` and use their `create` methods, + * depending on if you need a global animation, or local to a specific Sprite. * + * @class Animation + * @memberof Phaser.Animations * @constructor - * @public - */ -function EventEmitter() { - this._events = new Events(); - this._eventsCount = 0; -} - -/** - * Return an array listing the events for which the emitter has registered - * listeners. - * - * @returns {Array} - * @public - */ -EventEmitter.prototype.eventNames = function eventNames() { - var names = [] - , events - , name; - - if (this._eventsCount === 0) return names; - - for (name in (events = this._events)) { - if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); - } - - if (Object.getOwnPropertySymbols) { - return names.concat(Object.getOwnPropertySymbols(events)); - } - - return names; -}; - -/** - * Return the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Array} The registered listeners. - * @public - */ -EventEmitter.prototype.listeners = function listeners(event) { - var evt = prefix ? prefix + event : event - , handlers = this._events[evt]; - - if (!handlers) return []; - if (handlers.fn) return [handlers.fn]; - - for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { - ee[i] = handlers[i].fn; - } - - return ee; -}; - -/** - * Return the number of listeners listening to a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Number} The number of listeners. - * @public - */ -EventEmitter.prototype.listenerCount = function listenerCount(event) { - var evt = prefix ? prefix + event : event - , listeners = this._events[evt]; - - if (!listeners) return 0; - if (listeners.fn) return 1; - return listeners.length; -}; - -/** - * Calls each of the listeners registered for a given event. - * - * @param {(String|Symbol)} event The event name. - * @returns {Boolean} `true` if the event had listeners, else `false`. - * @public - */ -EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return false; - - var listeners = this._events[evt] - , len = arguments.length - , args - , i; - - if (listeners.fn) { - if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); - - switch (len) { - case 1: return listeners.fn.call(listeners.context), true; - case 2: return listeners.fn.call(listeners.context, a1), true; - case 3: return listeners.fn.call(listeners.context, a1, a2), true; - case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; - case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; - case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; - } - - for (i = 1, args = new Array(len -1); i < len; i++) { - args[i - 1] = arguments[i]; - } - - listeners.fn.apply(listeners.context, args); - } else { - var length = listeners.length - , j; - - for (i = 0; i < length; i++) { - if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); - - switch (len) { - case 1: listeners[i].fn.call(listeners[i].context); break; - case 2: listeners[i].fn.call(listeners[i].context, a1); break; - case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; - case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; - default: - if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { - args[j - 1] = arguments[j]; - } - - listeners[i].fn.apply(listeners[i].context, args); - } - } - } - - return true; -}; - -/** - * Add a listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.on = function on(event, fn, context) { - return addListener(this, event, fn, context, false); -}; - -/** - * Add a one-time listener for a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn The listener function. - * @param {*} [context=this] The context to invoke the listener with. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.once = function once(event, fn, context) { - return addListener(this, event, fn, context, true); -}; - -/** - * Remove the listeners of a given event. - * - * @param {(String|Symbol)} event The event name. - * @param {Function} fn Only remove the listeners that match this function. - * @param {*} context Only remove the listeners that have this context. - * @param {Boolean} once Only remove one-time listeners. - * @returns {EventEmitter} `this`. - * @public - */ -EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { - var evt = prefix ? prefix + event : event; - - if (!this._events[evt]) return this; - if (!fn) { - clearEvent(this, evt); - return this; - } - - var listeners = this._events[evt]; - - if (listeners.fn) { - if ( - listeners.fn === fn && - (!once || listeners.once) && - (!context || listeners.context === context) - ) { - clearEvent(this, evt); - } - } else { - for (var i = 0, events = [], length = listeners.length; i < length; i++) { - if ( - listeners[i].fn !== fn || - (once && !listeners[i].once) || - (context && listeners[i].context !== context) - ) { - events.push(listeners[i]); - } - } - - // - // Reset the array, or remove it completely if we have no more listeners. - // - if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; - else clearEvent(this, evt); - } - - return this; -}; - -/** - * Remove all listeners, or those of the specified event. + * @since 3.0.0 * - * @param {(String|Symbol)} [event] The event name. - * @returns {EventEmitter} `this`. - * @public + * @param {Phaser.Animations.AnimationManager} manager - A reference to the global Animation Manager + * @param {string} key - The unique identifying string for this animation. + * @param {Phaser.Types.Animations.Animation} config - The Animation configuration. */ -EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { - var evt; - - if (event) { - evt = prefix ? prefix + event : event; - if (this._events[evt]) clearEvent(this, evt); - } else { - this._events = new Events(); - this._eventsCount = 0; - } - - return this; -}; - -// -// Alias methods names because people roll like that. -// -EventEmitter.prototype.off = EventEmitter.prototype.removeListener; -EventEmitter.prototype.addListener = EventEmitter.prototype.on; - -// -// Expose the prefix. -// -EventEmitter.prefixed = prefix; - -// -// Allow `EventEmitter` to be imported as module namespace. -// -EventEmitter.EventEmitter = EventEmitter; - -// -// Expose the module. -// -if (true) { - module.exports = EventEmitter; -} - +var Animation = new Class({ -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { + initialize: -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + function Animation (manager, key, config) + { + /** + * A reference to the global Animation Manager. + * + * @name Phaser.Animations.Animation#manager + * @type {Phaser.Animations.AnimationManager} + * @since 3.0.0 + */ + this.manager = manager; -var Class = __webpack_require__(0); -var Contains = __webpack_require__(57); -var GetPoint = __webpack_require__(171); -var GetPoints = __webpack_require__(306); -var GEOM_CONST = __webpack_require__(56); -var Line = __webpack_require__(47); -var Random = __webpack_require__(174); + /** + * The unique identifying string for this animation. + * + * @name Phaser.Animations.Animation#key + * @type {string} + * @since 3.0.0 + */ + this.key = key; -/** - * @classdesc - * Encapsulates a 2D rectangle defined by its corner point in the top-left and its extends in x (width) and y (height) - * - * @class Rectangle - * @memberof Phaser.Geom - * @constructor - * @since 3.0.0 - * - * @param {number} [x=0] - The X coordinate of the top left corner of the Rectangle. - * @param {number} [y=0] - The Y coordinate of the top left corner of the Rectangle. - * @param {number} [width=0] - The width of the Rectangle. - * @param {number} [height=0] - The height of the Rectangle. - */ -var Rectangle = new Class({ + /** + * A frame based animation (as opposed to a bone based animation) + * + * @name Phaser.Animations.Animation#type + * @type {string} + * @default frame + * @since 3.0.0 + */ + this.type = 'frame'; - initialize: + /** + * Extract all the frame data into the frames array. + * + * @name Phaser.Animations.Animation#frames + * @type {Phaser.Animations.AnimationFrame[]} + * @since 3.0.0 + */ + this.frames = this.getFrames( + manager.textureManager, + GetValue(config, 'frames', []), + GetValue(config, 'defaultTextureKey', null), + GetValue(config, 'sortFrames', true) + ); - function Rectangle (x, y, width, height) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = 0; } - if (height === undefined) { height = 0; } + /** + * The frame rate of playback in frames per second (default 24 if duration is null) + * + * @name Phaser.Animations.Animation#frameRate + * @type {number} + * @default 24 + * @since 3.0.0 + */ + this.frameRate = GetValue(config, 'frameRate', null); /** - * The geometry constant type of this object: `GEOM_CONST.RECTANGLE`. - * Used for fast type comparisons. + * How long the animation should play for, in milliseconds. + * If the `frameRate` property has been set then it overrides this value, + * otherwise the `frameRate` is derived from `duration`. * - * @name Phaser.Geom.Rectangle#type + * @name Phaser.Animations.Animation#duration * @type {number} - * @readonly - * @since 3.19.0 + * @since 3.0.0 */ - this.type = GEOM_CONST.RECTANGLE; + this.duration = GetValue(config, 'duration', null); /** - * The X coordinate of the top left corner of the Rectangle. + * How many ms per frame, not including frame specific modifiers. * - * @name Phaser.Geom.Rectangle#x + * @name Phaser.Animations.Animation#msPerFrame * @type {number} - * @default 0 * @since 3.0.0 */ - this.x = x; + this.msPerFrame; /** - * The Y coordinate of the top left corner of the Rectangle. + * Skip frames if the time lags, or always advanced anyway? * - * @name Phaser.Geom.Rectangle#y + * @name Phaser.Animations.Animation#skipMissedFrames + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.skipMissedFrames = GetValue(config, 'skipMissedFrames', true); + + /** + * The delay in ms before the playback will begin. + * + * @name Phaser.Animations.Animation#delay * @type {number} * @default 0 * @since 3.0.0 */ - this.y = y; + this.delay = GetValue(config, 'delay', 0); /** - * The width of the Rectangle, i.e. the distance between its left side (defined by `x`) and its right side. + * Number of times to repeat the animation. Set to -1 to repeat forever. * - * @name Phaser.Geom.Rectangle#width + * @name Phaser.Animations.Animation#repeat * @type {number} * @default 0 * @since 3.0.0 */ - this.width = width; + this.repeat = GetValue(config, 'repeat', 0); /** - * The height of the Rectangle, i.e. the distance between its top side (defined by `y`) and its bottom side. + * The delay in ms before the a repeat play starts. * - * @name Phaser.Geom.Rectangle#height + * @name Phaser.Animations.Animation#repeatDelay * @type {number} * @default 0 * @since 3.0.0 */ - this.height = height; - }, + this.repeatDelay = GetValue(config, 'repeatDelay', 0); - /** - * Checks if the given point is inside the Rectangle's bounds. - * - * @method Phaser.Geom.Rectangle#contains - * @since 3.0.0 - * - * @param {number} x - The X coordinate of the point to check. - * @param {number} y - The Y coordinate of the point to check. - * - * @return {boolean} `true` if the point is within the Rectangle's bounds, otherwise `false`. - */ - contains: function (x, y) - { - return Contains(this, x, y); - }, + /** + * Should the animation yoyo (reverse back down to the start) before repeating? + * + * @name Phaser.Animations.Animation#yoyo + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.yoyo = GetValue(config, 'yoyo', false); - /** - * Calculates the coordinates of a point at a certain `position` on the Rectangle's perimeter. - * - * The `position` is a fraction between 0 and 1 which defines how far into the perimeter the point is. - * - * A value of 0 or 1 returns the point at the top left corner of the rectangle, while a value of 0.5 returns the point at the bottom right corner of the rectangle. Values between 0 and 0.5 are on the top or the right side and values between 0.5 and 1 are on the bottom or the left side. - * - * @method Phaser.Geom.Rectangle#getPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [output,$return] - * - * @param {number} position - The normalized distance into the Rectangle's perimeter to return. - * @param {(Phaser.Geom.Point|object)} [output] - An object to update with the `x` and `y` coordinates of the point. - * - * @return {(Phaser.Geom.Point|object)} The updated `output` object, or a new Point if no `output` object was given. - */ - getPoint: function (position, output) - { - return GetPoint(this, position, output); - }, + /** + * If the animation has a delay set, before playback will begin, this + * controls when the first frame is set on the Sprite. If this property + * is 'false' then the frame is set only after the delay has expired. + * This is the default behavior. + * + * @name Phaser.Animations.Animation#showBeforeDelay + * @type {boolean} + * @default false + * @since 3.60.0 + */ + this.showBeforeDelay = GetValue(config, 'showBeforeDelay', false); - /** - * Returns an array of points from the perimeter of the Rectangle, each spaced out based on the quantity or step required. - * - * @method Phaser.Geom.Rectangle#getPoints - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point[]} O - [output,$return] - * - * @param {number} quantity - The number of points to return. Set to `false` or 0 to return an arbitrary number of points (`perimeter / stepRate`) evenly spaced around the Rectangle based on the `stepRate`. - * @param {number} [stepRate] - If `quantity` is 0, determines the normalized distance between each returned point. - * @param {(array|Phaser.Geom.Point[])} [output] - An array to which to append the points. - * - * @return {(array|Phaser.Geom.Point[])} The modified `output` array, or a new array if none was provided. - */ - getPoints: function (quantity, stepRate, output) - { - return GetPoints(this, quantity, stepRate, output); + /** + * Should the GameObject's `visible` property be set to `true` when the animation starts to play? + * + * @name Phaser.Animations.Animation#showOnStart + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.showOnStart = GetValue(config, 'showOnStart', false); + + /** + * Should the GameObject's `visible` property be set to `false` when the animation finishes? + * + * @name Phaser.Animations.Animation#hideOnComplete + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.hideOnComplete = GetValue(config, 'hideOnComplete', false); + + /** + * Global pause. All Game Objects using this Animation instance are impacted by this property. + * + * @name Phaser.Animations.Animation#paused + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.paused = false; + + this.calculateDuration(this, this.getTotalFrames(), this.duration, this.frameRate); + + if (this.manager.on) + { + this.manager.on(Events.PAUSE_ALL, this.pause, this); + this.manager.on(Events.RESUME_ALL, this.resume, this); + } }, /** - * Returns a random point within the Rectangle's bounds. - * - * @method Phaser.Geom.Rectangle#getRandomPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [point,$return] + * Gets the total number of frames in this animation. * - * @param {Phaser.Geom.Point} [point] - The object in which to store the `x` and `y` coordinates of the point. + * @method Phaser.Animations.Animation#getTotalFrames + * @since 3.50.0 * - * @return {Phaser.Geom.Point} The updated `point`, or a new Point if none was provided. + * @return {number} The total number of frames in this animation. */ - getRandomPoint: function (point) + getTotalFrames: function () { - return Random(this, point); + return this.frames.length; }, /** - * Sets the position, width, and height of the Rectangle. - * - * @method Phaser.Geom.Rectangle#setTo - * @since 3.0.0 + * Calculates the duration, frame rate and msPerFrame values. * - * @param {number} x - The X coordinate of the top left corner of the Rectangle. - * @param {number} y - The Y coordinate of the top left corner of the Rectangle. - * @param {number} width - The width of the Rectangle. - * @param {number} height - The height of the Rectangle. + * @method Phaser.Animations.Animation#calculateDuration + * @since 3.50.0 * - * @return {this} This Rectangle object. + * @param {Phaser.Animations.Animation} target - The target to set the values on. + * @param {number} totalFrames - The total number of frames in the animation. + * @param {?number} [duration] - The duration to calculate the frame rate from. Pass `null` if you wish to set the `frameRate` instead. + * @param {?number} [frameRate] - The frame rate to calculate the duration from. */ - setTo: function (x, y, width, height) + calculateDuration: function (target, totalFrames, duration, frameRate) { - this.x = x; - this.y = y; - this.width = width; - this.height = height; + if (duration === null && frameRate === null) + { + // No duration or frameRate given, use default frameRate of 24fps + target.frameRate = 24; + target.duration = (24 / totalFrames) * 1000; + } + else if (duration && frameRate === null) + { + // Duration given but no frameRate, so set the frameRate based on duration + // I.e. 12 frames in the animation, duration = 4000 ms + // So frameRate is 12 / (4000 / 1000) = 3 fps + target.duration = duration; + target.frameRate = totalFrames / (duration / 1000); + } + else + { + // frameRate given, derive duration from it (even if duration also specified) + // I.e. 15 frames in the animation, frameRate = 30 fps + // So duration is 15 / 30 = 0.5 * 1000 (half a second, or 500ms) + target.frameRate = frameRate; + target.duration = (totalFrames / frameRate) * 1000; + } - return this; + target.msPerFrame = 1000 / target.frameRate; }, /** - * Resets the position, width, and height of the Rectangle to 0. + * Add frames to the end of the animation. * - * @method Phaser.Geom.Rectangle#setEmpty + * @method Phaser.Animations.Animation#addFrame * @since 3.0.0 * - * @return {this} This Rectangle object. + * @param {(string|Phaser.Types.Animations.AnimationFrame[])} config - Either a string, in which case it will use all frames from a texture with the matching key, or an array of Animation Frame configuration objects. + * + * @return {this} This Animation object. */ - setEmpty: function () + addFrame: function (config) { - return this.setTo(0, 0, 0, 0); + return this.addFrameAt(this.frames.length, config); }, /** - * Sets the position of the Rectangle. + * Add frame/s into the animation. * - * @method Phaser.Geom.Rectangle#setPosition + * @method Phaser.Animations.Animation#addFrameAt * @since 3.0.0 * - * @param {number} x - The X coordinate of the top left corner of the Rectangle. - * @param {number} [y=x] - The Y coordinate of the top left corner of the Rectangle. + * @param {number} index - The index to insert the frame at within the animation. + * @param {(string|Phaser.Types.Animations.AnimationFrame[])} config - Either a string, in which case it will use all frames from a texture with the matching key, or an array of Animation Frame configuration objects. * - * @return {this} This Rectangle object. + * @return {this} This Animation object. */ - setPosition: function (x, y) + addFrameAt: function (index, config) { - if (y === undefined) { y = x; } - - this.x = x; - this.y = y; + var newFrames = this.getFrames(this.manager.textureManager, config); - return this; - }, + if (newFrames.length > 0) + { + if (index === 0) + { + this.frames = newFrames.concat(this.frames); + } + else if (index === this.frames.length) + { + this.frames = this.frames.concat(newFrames); + } + else + { + var pre = this.frames.slice(0, index); + var post = this.frames.slice(index); - /** - * Sets the width and height of the Rectangle. - * - * @method Phaser.Geom.Rectangle#setSize - * @since 3.0.0 - * - * @param {number} width - The width to set the Rectangle to. - * @param {number} [height=width] - The height to set the Rectangle to. - * - * @return {this} This Rectangle object. - */ - setSize: function (width, height) - { - if (height === undefined) { height = width; } + this.frames = pre.concat(newFrames, post); + } - this.width = width; - this.height = height; + this.updateFrameSequence(); + } return this; }, /** - * Determines if the Rectangle is empty. A Rectangle is empty if its width or height is less than or equal to 0. + * Check if the given frame index is valid. * - * @method Phaser.Geom.Rectangle#isEmpty + * @method Phaser.Animations.Animation#checkFrame * @since 3.0.0 * - * @return {boolean} `true` if the Rectangle is empty. A Rectangle object is empty if its width or height is less than or equal to 0. + * @param {number} index - The index to be checked. + * + * @return {boolean} `true` if the index is valid, otherwise `false`. */ - isEmpty: function () + checkFrame: function (index) { - return (this.width <= 0 || this.height <= 0); + return (index >= 0 && index < this.frames.length); }, /** - * Returns a Line object that corresponds to the top of this Rectangle. + * Called internally when this Animation first starts to play. + * Sets the accumulator and nextTick properties. * - * @method Phaser.Geom.Rectangle#getLineA + * @method Phaser.Animations.Animation#getFirstTick + * @protected * @since 3.0.0 * - * @generic {Phaser.Geom.Line} O - [line,$return] - * - * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. - * - * @return {Phaser.Geom.Line} A Line object that corresponds to the top of this Rectangle. + * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. */ - getLineA: function (line) + getFirstTick: function (state) { - if (line === undefined) { line = new Line(); } - - line.setTo(this.x, this.y, this.right, this.y); + // When is the first update due? + state.accumulator = 0; - return line; + state.nextTick = state.msPerFrame + state.currentFrame.duration; }, /** - * Returns a Line object that corresponds to the right of this Rectangle. + * Returns the AnimationFrame at the provided index * - * @method Phaser.Geom.Rectangle#getLineB + * @method Phaser.Animations.Animation#getFrameAt + * @protected * @since 3.0.0 * - * @generic {Phaser.Geom.Line} O - [line,$return] - * - * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. + * @param {number} index - The index in the AnimationFrame array * - * @return {Phaser.Geom.Line} A Line object that corresponds to the right of this Rectangle. + * @return {Phaser.Animations.AnimationFrame} The frame at the index provided from the animation sequence */ - getLineB: function (line) + getFrameAt: function (index) { - if (line === undefined) { line = new Line(); } - - line.setTo(this.right, this.y, this.right, this.bottom); - - return line; + return this.frames[index]; }, /** - * Returns a Line object that corresponds to the bottom of this Rectangle. + * Creates AnimationFrame instances based on the given frame data. * - * @method Phaser.Geom.Rectangle#getLineC + * @method Phaser.Animations.Animation#getFrames * @since 3.0.0 * - * @generic {Phaser.Geom.Line} O - [line,$return] - * - * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. + * @param {Phaser.Textures.TextureManager} textureManager - A reference to the global Texture Manager. + * @param {(string|Phaser.Types.Animations.AnimationFrame[])} frames - Either a string, in which case it will use all frames from a texture with the matching key, or an array of Animation Frame configuration objects. + * @param {string} [defaultTextureKey] - The key to use if no key is set in the frame configuration object. * - * @return {Phaser.Geom.Line} A Line object that corresponds to the bottom of this Rectangle. + * @return {Phaser.Animations.AnimationFrame[]} An array of newly created AnimationFrame instances. */ - getLineC: function (line) + getFrames: function (textureManager, frames, defaultTextureKey, sortFrames) { - if (line === undefined) { line = new Line(); } + if (sortFrames === undefined) { sortFrames = true; } - line.setTo(this.right, this.bottom, this.x, this.bottom); + var out = []; + var prev; + var animationFrame; + var index = 1; + var i; + var textureKey; - return line; - }, + // if frames is a string, we'll get all the frames from the texture manager as if it's a sprite sheet + if (typeof frames === 'string') + { + textureKey = frames; - /** - * Returns a Line object that corresponds to the left of this Rectangle. - * - * @method Phaser.Geom.Rectangle#getLineD - * @since 3.0.0 - * - * @generic {Phaser.Geom.Line} O - [line,$return] - * - * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. - * - * @return {Phaser.Geom.Line} A Line object that corresponds to the left of this Rectangle. - */ - getLineD: function (line) - { - if (line === undefined) { line = new Line(); } + if (!textureManager.exists(textureKey)) + { + console.warn('Texture "%s" not found', textureKey); - line.setTo(this.x, this.bottom, this.x, this.y); + return out; + } - return line; - }, + var texture = textureManager.get(textureKey); + var frameKeys = texture.getFrameNames(); - /** - * The x coordinate of the left of the Rectangle. - * Changing the left property of a Rectangle object has no effect on the y and height properties. However it does affect the width property, whereas changing the x value does not affect the width property. - * - * @name Phaser.Geom.Rectangle#left - * @type {number} - * @since 3.0.0 - */ - left: { + if (sortFrames) + { + SortByDigits(frameKeys); + } - get: function () + frames = []; + + frameKeys.forEach(function (value) + { + frames.push({ key: textureKey, frame: value }); + }); + } + + if (!Array.isArray(frames) || frames.length === 0) { - return this.x; - }, + return out; + } - set: function (value) + for (i = 0; i < frames.length; i++) { - if (value >= this.right) + var item = frames[i]; + + var key = GetValue(item, 'key', defaultTextureKey); + + if (!key) { - this.width = 0; + continue; } - else + + // Could be an integer or a string + var frame = GetValue(item, 'frame', 0); + + // The actual texture frame + var textureFrame = textureManager.getFrame(key, frame); + + if (!textureFrame) { - this.width = this.right - value; - } + console.warn('Texture "%s" not found', key); - this.x = value; - } + continue; + } - }, + animationFrame = new Frame(key, frame, index, textureFrame); - /** - * The sum of the x and width properties. - * Changing the right property of a Rectangle object has no effect on the x, y and height properties, however it does affect the width property. - * - * @name Phaser.Geom.Rectangle#right - * @type {number} - * @since 3.0.0 - */ - right: { + animationFrame.duration = GetValue(item, 'duration', 0); - get: function () - { - return this.x + this.width; - }, + animationFrame.isFirst = (!prev); - set: function (value) - { - if (value <= this.x) + // The previously created animationFrame + if (prev) { - this.width = 0; + prev.nextFrame = animationFrame; + + animationFrame.prevFrame = prev; } - else + + out.push(animationFrame); + + prev = animationFrame; + + index++; + } + + if (out.length > 0) + { + animationFrame.isLast = true; + + // Link them end-to-end, so they loop + animationFrame.nextFrame = out[0]; + + out[0].prevFrame = animationFrame; + + // Generate the progress data + + var slice = 1 / (out.length - 1); + + for (i = 0; i < out.length; i++) { - this.width = value - this.x; + out[i].progress = i * slice; } } + return out; }, /** - * The y coordinate of the top of the Rectangle. Changing the top property of a Rectangle object has no effect on the x and width properties. - * However it does affect the height property, whereas changing the y value does not affect the height property. + * Called internally. Sets the accumulator and nextTick values of the current Animation. * - * @name Phaser.Geom.Rectangle#top - * @type {number} + * @method Phaser.Animations.Animation#getNextTick * @since 3.0.0 + * + * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. */ - top: { - - get: function () - { - return this.y; - }, + getNextTick: function (state) + { + state.accumulator -= state.nextTick; - set: function (value) - { - if (value >= this.bottom) - { - this.height = 0; - } - else - { - this.height = (this.bottom - value); - } + state.nextTick = state.msPerFrame + state.currentFrame.duration; + }, - this.y = value; - } + /** + * Returns the frame closest to the given progress value between 0 and 1. + * + * @method Phaser.Animations.Animation#getFrameByProgress + * @since 3.4.0 + * + * @param {number} value - A value between 0 and 1. + * + * @return {Phaser.Animations.AnimationFrame} The frame closest to the given progress value. + */ + getFrameByProgress: function (value) + { + value = Clamp(value, 0, 1); + return FindClosestInSorted(value, this.frames, 'progress'); }, /** - * The sum of the y and height properties. - * Changing the bottom property of a Rectangle object has no effect on the x, y and width properties, but does change the height property. + * Advance the animation frame. * - * @name Phaser.Geom.Rectangle#bottom - * @type {number} + * @method Phaser.Animations.Animation#nextFrame * @since 3.0.0 + * + * @param {Phaser.Animations.AnimationState} state - The Animation State to advance. */ - bottom: { + nextFrame: function (state) + { + var frame = state.currentFrame; - get: function () + if (frame.isLast) { - return this.y + this.height; - }, + // We're at the end of the animation - set: function (value) - { - if (value <= this.y) + // Yoyo? (happens before repeat) + if (state.yoyo) { - this.height = 0; + this.handleYoyoFrame(state, false); + } + else if (state.repeatCounter > 0) + { + // Repeat (happens before complete) + + if (state.inReverse && state.forward) + { + state.forward = false; + } + else + { + this.repeatAnimation(state); + } } else { - this.height = value - this.y; + state.complete(); } } - + else + { + this.updateAndGetNextTick(state, frame.nextFrame); + } }, /** - * The x coordinate of the center of the Rectangle. + * Handle the yoyo functionality in nextFrame and previousFrame methods. * - * @name Phaser.Geom.Rectangle#centerX - * @type {number} - * @since 3.0.0 + * @method Phaser.Animations.Animation#handleYoyoFrame + * @private + * @since 3.12.0 + * + * @param {Phaser.Animations.AnimationState} state - The Animation State to advance. + * @param {boolean} isReverse - Is animation in reverse mode? (Default: false) */ - centerX: { + handleYoyoFrame: function (state, isReverse) + { + if (!isReverse) { isReverse = false; } - get: function () + if (state.inReverse === !isReverse && state.repeatCounter > 0) { - return this.x + (this.width / 2); - }, + if (state.repeatDelay === 0 || state.pendingRepeat) + { + state.forward = isReverse; + } - set: function (value) + this.repeatAnimation(state); + + return; + } + + if (state.inReverse !== isReverse && state.repeatCounter === 0) { - this.x = value - (this.width / 2); + state.complete(); + + return; } - }, + state.forward = isReverse; - /** - * The y coordinate of the center of the Rectangle. - * - * @name Phaser.Geom.Rectangle#centerY - * @type {number} - * @since 3.0.0 - */ - centerY: { - - get: function () - { - return this.y + (this.height / 2); - }, - - set: function (value) - { - this.y = value - (this.height / 2); - } - - } - -}); - -module.exports = Rectangle; - - -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.GameObjects.Components - */ - -module.exports = { - - Alpha: __webpack_require__(607), - AlphaSingle: __webpack_require__(303), - BlendMode: __webpack_require__(304), - ComputedSize: __webpack_require__(608), - Crop: __webpack_require__(609), - Depth: __webpack_require__(305), - Flip: __webpack_require__(610), - GetBounds: __webpack_require__(611), - Mask: __webpack_require__(309), - Origin: __webpack_require__(632), - PathFollower: __webpack_require__(633), - Pipeline: __webpack_require__(167), - ScrollFactor: __webpack_require__(312), - Size: __webpack_require__(634), - Texture: __webpack_require__(635), - TextureCrop: __webpack_require__(636), - Tint: __webpack_require__(637), - ToJSON: __webpack_require__(176), - Transform: __webpack_require__(313), - TransformMatrix: __webpack_require__(25), - Visible: __webpack_require__(314) - -}; - - -/***/ }), -/* 12 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @author Matthew Groves <@doormat> - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var frame = (isReverse) ? state.currentFrame.nextFrame : state.currentFrame.prevFrame; -/** - * Generate shader source to test maximum ifs. - * - * @private - * @ignore - * @param {number} maxIfs - The number of if statements to generate - */ -function GenerateSrc (maxIfs) -{ - var src = ''; + this.updateAndGetNextTick(state, frame); + }, - for (var i = 0; i < maxIfs; ++i) + /** + * Returns the animation last frame. + * + * @method Phaser.Animations.Animation#getLastFrame + * @since 3.12.0 + * + * @return {Phaser.Animations.AnimationFrame} The last Animation Frame. + */ + getLastFrame: function () { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += 'if(test == ' + i + '.0){}'; - } - } - - return src; -} - -/** - * @namespace Phaser.Renderer.WebGL.Utils - * @since 3.0.0 - */ -module.exports = { + return this.frames[this.frames.length - 1]; + }, /** - * Packs four floats on a range from 0.0 to 1.0 into a single Uint32 + * Called internally when the Animation is playing backwards. + * Sets the previous frame, causing a yoyo, repeat, complete or update, accordingly. * - * @function Phaser.Renderer.WebGL.Utils.getTintFromFloats + * @method Phaser.Animations.Animation#previousFrame * @since 3.0.0 * - * @param {number} r - Red component in a range from 0.0 to 1.0 - * @param {number} g - Green component in a range from 0.0 to 1.0 - * @param {number} b - Blue component in a range from 0.0 to 1.0 - * @param {number} a - Alpha component in a range from 0.0 to 1.0 - * - * @return {number} The packed RGBA values as a Uint32. + * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. */ - getTintFromFloats: function (r, g, b, a) + previousFrame: function (state) { - var ur = ((r * 255) | 0) & 0xff; - var ug = ((g * 255) | 0) & 0xff; - var ub = ((b * 255) | 0) & 0xff; - var ua = ((a * 255) | 0) & 0xff; + var frame = state.currentFrame; - return ((ua << 24) | (ur << 16) | (ug << 8) | ub) >>> 0; + if (frame.isFirst) + { + // We're at the start of the animation + if (state.yoyo) + { + this.handleYoyoFrame(state, true); + } + else if (state.repeatCounter > 0) + { + if (state.inReverse && !state.forward) + { + this.repeatAnimation(state); + } + else + { + // Repeat (happens before complete) + state.forward = true; + + this.repeatAnimation(state); + } + } + else + { + state.complete(); + } + } + else + { + this.updateAndGetNextTick(state, frame.prevFrame); + } }, /** - * Packs a Uint24, representing RGB components, with a Float32, representing - * the alpha component, with a range between 0.0 and 1.0 and return a Uint32 - * - * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha - * @since 3.0.0 + * Update Frame and Wait next tick. * - * @param {number} rgb - Uint24 representing RGB components - * @param {number} a - Float32 representing Alpha component + * @method Phaser.Animations.Animation#updateAndGetNextTick + * @private + * @since 3.12.0 * - * @return {number} Packed RGBA as Uint32 + * @param {Phaser.Animations.AnimationState} state - The Animation State. + * @param {Phaser.Animations.AnimationFrame} frame - An Animation frame. */ - getTintAppendFloatAlpha: function (rgb, a) + updateAndGetNextTick: function (state, frame) { - var ua = ((a * 255) | 0) & 0xff; + state.setCurrentFrame(frame); - return ((ua << 24) | rgb) >>> 0; + this.getNextTick(state); }, /** - * Packs a Uint24, representing RGB components, with a Float32, representing - * the alpha component, with a range between 0.0 and 1.0 and return a - * swizzled Uint32 + * Removes the given AnimationFrame from this Animation instance. + * This is a global action. Any Game Object using this Animation will be impacted by this change. * - * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlphaAndSwap + * @method Phaser.Animations.Animation#removeFrame * @since 3.0.0 * - * @param {number} rgb - Uint24 representing RGB components - * @param {number} a - Float32 representing Alpha component + * @param {Phaser.Animations.AnimationFrame} frame - The AnimationFrame to be removed. * - * @return {number} Packed RGBA as Uint32 + * @return {this} This Animation object. */ - getTintAppendFloatAlphaAndSwap: function (rgb, a) + removeFrame: function (frame) { - var ur = ((rgb >> 16) | 0) & 0xff; - var ug = ((rgb >> 8) | 0) & 0xff; - var ub = (rgb | 0) & 0xff; - var ua = ((a * 255) | 0) & 0xff; + var index = this.frames.indexOf(frame); - return ((ua << 24) | (ub << 16) | (ug << 8) | ur) >>> 0; + if (index !== -1) + { + this.removeFrameAt(index); + } + + return this; }, /** - * Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0 + * Removes a frame from the AnimationFrame array at the provided index + * and updates the animation accordingly. * - * @function Phaser.Renderer.WebGL.Utils.getFloatsFromUintRGB + * @method Phaser.Animations.Animation#removeFrameAt * @since 3.0.0 * - * @param {number} rgb - RGB packed as a Uint24 + * @param {number} index - The index in the AnimationFrame array * - * @return {array} Array of floats representing each component as a float + * @return {this} This Animation object. */ - getFloatsFromUintRGB: function (rgb) + removeFrameAt: function (index) { - var ur = ((rgb >> 16) | 0) & 0xff; - var ug = ((rgb >> 8) | 0) & 0xff; - var ub = (rgb | 0) & 0xff; + this.frames.splice(index, 1); - return [ ur / 255, ug / 255, ub / 255 ]; + this.updateFrameSequence(); + + return this; }, /** - * Check to see how many texture units the GPU supports, based on the given config value. - * Then tests this against the maximum number of iterations GLSL can support. - * - * @function Phaser.Renderer.WebGL.Utils.checkShaderMax - * @since 3.50.0 + * Called internally during playback. Forces the animation to repeat, providing there are enough counts left + * in the repeat counter. * - * @param {WebGLRenderingContext} gl - The WebGLContext used to create the shaders. - * @param {number} maxTextures - The Game Config maxTextures value. + * @method Phaser.Animations.Animation#repeatAnimation + * @fires Phaser.Animations.Events#ANIMATION_REPEAT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_REPEAT + * @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_REPEAT + * @since 3.0.0 * - * @return {number} The number of texture units that is supported by this browser and GPU. + * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. */ - checkShaderMax: function (gl, maxTextures) + repeatAnimation: function (state) { - if (!maxTextures || maxTextures === -1) + if (state._pendingStop === 2) { - maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); + if (state._pendingStopValue === 0) + { + return state.stop(); + } + else + { + state._pendingStopValue--; + } } - var shader = gl.createShader(gl.FRAGMENT_SHADER); - - var fragTemplate = [ - 'precision mediump float;', - 'void main(void){', - 'float test = 0.1;', - '%forloop%', - 'gl_FragColor = vec4(0.0);', - '}' - ].join('\n'); - - // eslint-disable-next-line no-constant-condition - while (true) + if (state.repeatDelay > 0 && !state.pendingRepeat) { - var fragmentSrc = fragTemplate.replace(/%forloop%/gi, GenerateSrc(maxTextures)); - - gl.shaderSource(shader, fragmentSrc); - gl.compileShader(shader); + state.pendingRepeat = true; + state.accumulator -= state.nextTick; + state.nextTick += state.repeatDelay; + } + else + { + state.repeatCounter--; - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) + if (state.forward) { - maxTextures = (maxTextures / 2) | 0; + state.setCurrentFrame(state.currentFrame.nextFrame); } else { - // valid! - break; + state.setCurrentFrame(state.currentFrame.prevFrame); } - } - return maxTextures; + if (state.isPlaying) + { + this.getNextTick(state); + + state.handleRepeat(); + } + } }, /** - * Checks the given Fragment Shader Source for `%count%` and `%forloop%` declarations and - * replaces those with GLSL code for setting `texture = texture2D(uMainSampler[i], outTexCoord)`. - * - * @function Phaser.Renderer.WebGL.Utils.parseFragmentShaderMaxTextures - * @since 3.50.0 + * Converts the animation data to JSON. * - * @param {string} fragmentShaderSource - The Fragment Shader source code to operate on. - * @param {number} maxTextures - The number of maxTextures value. + * @method Phaser.Animations.Animation#toJSON + * @since 3.0.0 * - * @return {string} The modified Fragment Shader source. + * @return {Phaser.Types.Animations.JSONAnimation} The resulting JSONAnimation formatted object. */ - parseFragmentShaderMaxTextures: function (fragmentShaderSource, maxTextures) + toJSON: function () { - if (!fragmentShaderSource) - { - return ''; - } - - var src = ''; + var output = { + key: this.key, + type: this.type, + frames: [], + frameRate: this.frameRate, + duration: this.duration, + skipMissedFrames: this.skipMissedFrames, + delay: this.delay, + repeat: this.repeat, + repeatDelay: this.repeatDelay, + yoyo: this.yoyo, + showBeforeDelay: this.showBeforeDelay, + showOnStart: this.showOnStart, + hideOnComplete: this.hideOnComplete + }; - for (var i = 0; i < maxTextures; i++) + this.frames.forEach(function (frame) { - if (i > 0) - { - src += '\n\telse '; - } - - if (i < maxTextures - 1) - { - src += 'if (outTexId < ' + i + '.5)'; - } - - src += '\n\t{'; - src += '\n\t\ttexture = texture2D(uMainSampler[' + i + '], outTexCoord);'; - src += '\n\t}'; - } - - fragmentShaderSource = fragmentShaderSource.replace(/%count%/gi, maxTextures.toString()); - - return fragmentShaderSource.replace(/%forloop%/gi, src); - } -}; - - -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var MATH = __webpack_require__(193); -var GetValue = __webpack_require__(6); + output.frames.push(frame.toJSON()); + }); -/** - * Retrieves a value from an object. Allows for more advanced selection options, including: - * - * Allowed types: - * - * Implicit - * { - * x: 4 - * } - * - * From function - * { - * x: function () - * } - * - * Randomly pick one element from the array - * { - * x: [a, b, c, d, e, f] - * } - * - * Random integer between min and max: - * { - * x: { randInt: [min, max] } - * } - * - * Random float between min and max: - * { - * x: { randFloat: [min, max] } - * } - * - * - * @function Phaser.Utils.Objects.GetAdvancedValue - * @since 3.0.0 - * - * @param {object} source - The object to retrieve the value from. - * @param {string} key - The name of the property to retrieve from the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`) - `banner.hideBanner` would return the value of the `hideBanner` property from the object stored in the `banner` property of the `source` object. - * @param {*} defaultValue - The value to return if the `key` isn't found in the `source` object. - * - * @return {*} The value of the requested key. - */ -var GetAdvancedValue = function (source, key, defaultValue) -{ - var value = GetValue(source, key, null); + return output; + }, - if (value === null) - { - return defaultValue; - } - else if (Array.isArray(value)) - { - return MATH.RND.pick(value); - } - else if (typeof value === 'object') - { - if (value.hasOwnProperty('randInt')) - { - return MATH.RND.integerInRange(value.randInt[0], value.randInt[1]); - } - else if (value.hasOwnProperty('randFloat')) - { - return MATH.RND.realInRange(value.randFloat[0], value.randFloat[1]); - } - } - else if (typeof value === 'function') + /** + * Called internally whenever frames are added to, or removed from, this Animation. + * + * @method Phaser.Animations.Animation#updateFrameSequence + * @since 3.0.0 + * + * @return {this} This Animation object. + */ + updateFrameSequence: function () { - return value(key); - } + var len = this.frames.length; + var slice = 1 / (len - 1); - return value; -}; + var frame; -module.exports = GetAdvancedValue; + for (var i = 0; i < len; i++) + { + frame = this.frames[i]; + frame.index = i + 1; + frame.isFirst = false; + frame.isLast = false; + frame.progress = i * slice; -/***/ }), -/* 14 */ -/***/ (function(module, exports) { + if (i === 0) + { + frame.isFirst = true; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (len === 1) + { + frame.isLast = true; + frame.nextFrame = frame; + frame.prevFrame = frame; + } + else + { + frame.isLast = false; + frame.prevFrame = this.frames[len - 1]; + frame.nextFrame = this.frames[i + 1]; + } + } + else if (i === len - 1 && len > 1) + { + frame.isLast = true; + frame.prevFrame = this.frames[len - 2]; + frame.nextFrame = this.frames[0]; + } + else if (len > 1) + { + frame.prevFrame = this.frames[i - 1]; + frame.nextFrame = this.frames[i + 1]; + } + } -var MATH_CONST = { + return this; + }, /** - * The value of PI * 2. - * - * @name Phaser.Math.PI2 - * @type {number} + * Pauses playback of this Animation. The paused state is set immediately. + * + * @method Phaser.Animations.Animation#pause * @since 3.0.0 + * + * @return {this} This Animation object. */ - PI2: Math.PI * 2, + pause: function () + { + this.paused = true; - /** - * The value of PI * 0.5. - * - * @name Phaser.Math.TAU - * @type {number} - * @since 3.0.0 - */ - TAU: Math.PI * 0.5, + return this; + }, /** - * An epsilon value (1.0e-6) - * - * @name Phaser.Math.EPSILON - * @type {number} + * Resumes playback of this Animation. The paused state is reset immediately. + * + * @method Phaser.Animations.Animation#resume * @since 3.0.0 + * + * @return {this} This Animation object. */ - EPSILON: 1.0e-6, + resume: function () + { + this.paused = false; - /** - * For converting degrees to radians (PI / 180) - * - * @name Phaser.Math.DEG_TO_RAD - * @type {number} - * @since 3.0.0 - */ - DEG_TO_RAD: Math.PI / 180, + return this; + }, /** - * For converting radians to degrees (180 / PI) - * - * @name Phaser.Math.RAD_TO_DEG - * @type {number} + * Destroys this Animation instance. It will remove all event listeners, + * remove this animation and its key from the global Animation Manager, + * and then destroy all Animation Frames in turn. + * + * @method Phaser.Animations.Animation#destroy * @since 3.0.0 */ - RAD_TO_DEG: 180 / Math.PI, + destroy: function () + { + if (this.manager.off) + { + this.manager.off(Events.PAUSE_ALL, this.pause, this); + this.manager.off(Events.RESUME_ALL, this.resume, this); + } - /** - * An instance of the Random Number Generator. - * This is not set until the Game boots. - * - * @name Phaser.Math.RND - * @type {Phaser.Math.RandomDataGenerator} - * @since 3.0.0 - */ - RND: null, + this.manager.remove(this.key); - /** - * The minimum safe integer this browser supports. - * We use a const for backward compatibility with Internet Explorer. - * - * @name Phaser.Math.MIN_SAFE_INTEGER - * @type {number} - * @since 3.21.0 - */ - MIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER || -9007199254740991, + for (var i = 0; i < this.frames.length; i++) + { + this.frames[i].destroy(); + } - /** - * The maximum safe integer this browser supports. - * We use a const for backward compatibility with Internet Explorer. - * - * @name Phaser.Math.MAX_SAFE_INTEGER - * @type {number} - * @since 3.21.0 - */ - MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER || 9007199254740991 + this.frames = []; -}; + this.manager = null; + } -module.exports = MATH_CONST; +}); + +module.exports = Animation; /***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 71519: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var ComponentsToJSON = __webpack_require__(176); -var DataManager = __webpack_require__(101); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(75); -var SceneEvents = __webpack_require__(20); +var Class = __webpack_require__(56694); /** * @classdesc - * The base class that all Game Objects extend. - * You don't create GameObjects directly and they cannot be added to the display list. - * Instead, use them as the base for your own custom classes. + * A single frame in an Animation sequence. * - * @class GameObject - * @memberof Phaser.GameObjects - * @extends Phaser.Events.EventEmitter + * An AnimationFrame consists of a reference to the Texture it uses for rendering, references to other + * frames in the animation, and index data. It also has the ability to modify the animation timing. + * + * AnimationFrames are generated automatically by the Animation class. + * + * @class AnimationFrame + * @memberof Phaser.Animations * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. - * @param {string} type - A textual representation of the type of Game Object, i.e. `sprite`. + * @param {string} textureKey - The key of the Texture this AnimationFrame uses. + * @param {(string|number)} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses. + * @param {number} index - The index of this AnimationFrame within the Animation sequence. + * @param {Phaser.Textures.Frame} frame - A reference to the Texture Frame this AnimationFrame uses for rendering. + * @param {boolean} [isKeyFrame=false] - Is this Frame a Keyframe within the Animation? */ -var GameObject = new Class({ - - Extends: EventEmitter, +var AnimationFrame = new Class({ initialize: - function GameObject (scene, type) + function AnimationFrame (textureKey, textureFrame, index, frame, isKeyFrame) { - EventEmitter.call(this); + if (isKeyFrame === undefined) { isKeyFrame = false; } /** - * A reference to the Scene to which this Game Object belongs. - * - * Game Objects can only belong to one Scene. - * - * You should consider this property as being read-only. You cannot move a - * Game Object to another Scene by simply changing it. + * The key of the Texture this AnimationFrame uses. * - * @name Phaser.GameObjects.GameObject#scene - * @type {Phaser.Scene} + * @name Phaser.Animations.AnimationFrame#textureKey + * @type {string} * @since 3.0.0 */ - this.scene = scene; + this.textureKey = textureKey; /** - * Holds a reference to the Display List that contains this Game Object. - * - * This is set automatically when this Game Object is added to a Scene or Layer. - * - * You should treat this property as being read-only. + * The key of the Frame within the Texture that this AnimationFrame uses. * - * @name Phaser.GameObjects.GameObject#displayList - * @type {(Phaser.GameObjects.DisplayList|Phaser.GameObjects.Layer)} - * @default null - * @since 3.50.0 + * @name Phaser.Animations.AnimationFrame#textureFrame + * @type {(string|number)} + * @since 3.0.0 */ - this.displayList = null; + this.textureFrame = textureFrame; /** - * A textual representation of this Game Object, i.e. `sprite`. - * Used internally by Phaser but is available for your own custom classes to populate. + * The index of this AnimationFrame within the Animation sequence. * - * @name Phaser.GameObjects.GameObject#type - * @type {string} + * @name Phaser.Animations.AnimationFrame#index + * @type {number} * @since 3.0.0 */ - this.type = type; + this.index = index; /** - * The current state of this Game Object. + * A reference to the Texture Frame this AnimationFrame uses for rendering. * - * Phaser itself will never modify this value, although plugins may do so. + * @name Phaser.Animations.AnimationFrame#frame + * @type {Phaser.Textures.Frame} + * @since 3.0.0 + */ + this.frame = frame; + + /** + * Is this the first frame in an animation sequence? * - * Use this property to track the state of a Game Object during its lifetime. For example, it could change from - * a state of 'moving', to 'attacking', to 'dead'. The state value should be an integer (ideally mapped to a constant - * in your game code), or a string. These are recommended to keep it light and simple, with fast comparisons. - * If you need to store complex data about your Game Object, look at using the Data Component instead. + * @name Phaser.Animations.AnimationFrame#isFirst + * @type {boolean} + * @default false + * @readonly + * @since 3.0.0 + */ + this.isFirst = false; + + /** + * Is this the last frame in an animation sequence? * - * @name Phaser.GameObjects.GameObject#state - * @type {(number|string)} - * @since 3.16.0 + * @name Phaser.Animations.AnimationFrame#isLast + * @type {boolean} + * @default false + * @readonly + * @since 3.0.0 */ - this.state = 0; + this.isLast = false; /** - * The parent Container of this Game Object, if it has one. + * A reference to the AnimationFrame that comes before this one in the animation, if any. * - * @name Phaser.GameObjects.GameObject#parentContainer - * @type {Phaser.GameObjects.Container} - * @since 3.4.0 + * @name Phaser.Animations.AnimationFrame#prevFrame + * @type {?Phaser.Animations.AnimationFrame} + * @default null + * @readonly + * @since 3.0.0 */ - this.parentContainer = null; + this.prevFrame = null; /** - * The name of this Game Object. - * Empty by default and never populated by Phaser, this is left for developers to use. + * A reference to the AnimationFrame that comes after this one in the animation, if any. * - * @name Phaser.GameObjects.GameObject#name - * @type {string} - * @default '' + * @name Phaser.Animations.AnimationFrame#nextFrame + * @type {?Phaser.Animations.AnimationFrame} + * @default null + * @readonly * @since 3.0.0 */ - this.name = ''; + this.nextFrame = null; /** - * The active state of this Game Object. - * A Game Object with an active state of `true` is processed by the Scenes UpdateList, if added to it. - * An active object is one which is having its logic and internal systems updated. + * Additional time (in ms) that this frame should appear for during playback. + * The value is added onto the msPerFrame set by the animation. * - * @name Phaser.GameObjects.GameObject#active - * @type {boolean} - * @default true + * @name Phaser.Animations.AnimationFrame#duration + * @type {number} + * @default 0 * @since 3.0.0 */ - this.active = true; + this.duration = 0; /** - * The Tab Index of the Game Object. - * Reserved for future use by plugins and the Input Manager. + * What % through the animation does this frame come? + * This value is generated when the animation is created and cached here. * - * @name Phaser.GameObjects.GameObject#tabIndex + * @name Phaser.Animations.AnimationFrame#progress * @type {number} - * @default -1 + * @default 0 + * @readonly * @since 3.0.0 */ - this.tabIndex = -1; + this.progress = 0; /** - * A Data Manager. - * It allows you to store, query and get key/value paired information specific to this Game Object. - * `null` by default. Automatically created if you use `getData` or `setData` or `setDataEnabled`. + * Is this Frame a KeyFrame within the Animation? * - * @name Phaser.GameObjects.GameObject#data - * @type {Phaser.Data.DataManager} - * @default null + * @name Phaser.Animations.AnimationFrame#isKeyFrame + * @type {boolean} + * @since 3.50.0 + */ + this.isKeyFrame = isKeyFrame; + }, + + /** + * Generates a JavaScript object suitable for converting to JSON. + * + * @method Phaser.Animations.AnimationFrame#toJSON + * @since 3.0.0 + * + * @return {Phaser.Types.Animations.JSONAnimationFrame} The AnimationFrame data. + */ + toJSON: function () + { + return { + key: this.textureKey, + frame: this.textureFrame, + duration: this.duration, + keyframe: this.isKeyFrame + }; + }, + + /** + * Destroys this object by removing references to external resources and callbacks. + * + * @method Phaser.Animations.AnimationFrame#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.frame = undefined; + } + +}); + +module.exports = AnimationFrame; + + +/***/ }), + +/***/ 90249: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Animation = __webpack_require__(85463); +var Class = __webpack_require__(56694); +var CustomMap = __webpack_require__(33885); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(16938); +var GameEvents = __webpack_require__(97081); +var GetFastValue = __webpack_require__(72632); +var GetValue = __webpack_require__(10850); +var MATH_CONST = __webpack_require__(83392); +var NumberArray = __webpack_require__(13401); +var Pad = __webpack_require__(76400); + +/** + * @classdesc + * The Animation Manager. + * + * Animations are managed by the global Animation Manager. This is a singleton class that is + * responsible for creating and delivering animations and their corresponding data to all Game Objects. + * Unlike plugins it is owned by the Game instance, not the Scene. + * + * Sprites and other Game Objects get the data they need from the AnimationManager. + * + * @class AnimationManager + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Animations + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Game} game - A reference to the Phaser.Game instance. + */ +var AnimationManager = new Class({ + + Extends: EventEmitter, + + initialize: + + function AnimationManager (game) + { + EventEmitter.call(this); + + /** + * A reference to the Phaser.Game instance. + * + * @name Phaser.Animations.AnimationManager#game + * @type {Phaser.Game} + * @protected * @since 3.0.0 */ - this.data = null; + this.game = game; /** - * The flags that are compared against `RENDER_MASK` to determine if this Game Object will render or not. - * The bits are 0001 | 0010 | 0100 | 1000 set by the components Visible, Alpha, Transform and Texture respectively. - * If those components are not used by your custom class then you can use this bitmask as you wish. + * A reference to the Texture Manager. * - * @name Phaser.GameObjects.GameObject#renderFlags - * @type {number} - * @default 15 + * @name Phaser.Animations.AnimationManager#textureManager + * @type {Phaser.Textures.TextureManager} + * @protected * @since 3.0.0 */ - this.renderFlags = 15; + this.textureManager = null; /** - * A bitmask that controls if this Game Object is drawn by a Camera or not. - * Not usually set directly, instead call `Camera.ignore`, however you can - * set this property directly using the Camera.id property: + * The global time scale of the Animation Manager. * - * @example - * this.cameraFilter |= camera.id + * This scales the time delta between two frames, thus influencing the speed of time for the Animation Manager. * - * @name Phaser.GameObjects.GameObject#cameraFilter + * @name Phaser.Animations.AnimationManager#globalTimeScale * @type {number} - * @default 0 + * @default 1 * @since 3.0.0 */ - this.cameraFilter = 0; + this.globalTimeScale = 1; /** - * If this Game Object is enabled for input then this property will contain an InteractiveObject instance. - * Not usually set directly. Instead call `GameObject.setInteractive()`. + * The Animations registered in the Animation Manager. * - * @name Phaser.GameObjects.GameObject#input - * @type {?Phaser.Types.Input.InteractiveObject} - * @default null + * This map should be modified with the {@link #add} and {@link #create} methods of the Animation Manager. + * + * @name Phaser.Animations.AnimationManager#anims + * @type {Phaser.Structs.Map.} + * @protected * @since 3.0.0 */ - this.input = null; + this.anims = new CustomMap(); /** - * If this Game Object is enabled for Arcade or Matter Physics then this property will contain a reference to a Physics Body. + * A list of animation mix times. * - * @name Phaser.GameObjects.GameObject#body - * @type {?(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody|MatterJS.BodyType)} - * @default null - * @since 3.0.0 + * See the {@link #setMix} method for more details. + * + * @name Phaser.Animations.AnimationManager#mixes + * @type {Phaser.Structs.Map.} + * @since 3.50.0 */ - this.body = null; + this.mixes = new CustomMap(); /** - * This Game Object will ignore all calls made to its destroy method if this flag is set to `true`. - * This includes calls that may come from a Group, Container or the Scene itself. - * While it allows you to persist a Game Object across Scenes, please understand you are entirely - * responsible for managing references to and from this Game Object. + * Whether the Animation Manager is paused along with all of its Animations. * - * @name Phaser.GameObjects.GameObject#ignoreDestroy + * @name Phaser.Animations.AnimationManager#paused * @type {boolean} * @default false - * @since 3.5.0 + * @since 3.0.0 */ - this.ignoreDestroy = false; + this.paused = false; - this.on(Events.ADDED_TO_SCENE, this.addedToScene, this); - this.on(Events.REMOVED_FROM_SCENE, this.removedFromScene, this); + /** + * The name of this Animation Manager. + * + * @name Phaser.Animations.AnimationManager#name + * @type {string} + * @since 3.0.0 + */ + this.name = 'AnimationManager'; - // Tell the Scene to re-sort the children - scene.sys.queueDepthSort(); + game.events.once(GameEvents.BOOT, this.boot, this); }, /** - * Sets the `active` property of this Game Object and returns this Game Object for further chaining. - * A Game Object with its `active` property set to `true` will be updated by the Scenes UpdateList. + * Registers event listeners after the Game boots. * - * @method Phaser.GameObjects.GameObject#setActive + * @method Phaser.Animations.AnimationManager#boot + * @listens Phaser.Core.Events#DESTROY * @since 3.0.0 - * - * @param {boolean} value - True if this Game Object should be set as active, false if not. - * - * @return {this} This GameObject. */ - setActive: function (value) + boot: function () { - this.active = value; + this.textureManager = this.game.textures; - return this; + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** - * Sets the `name` property of this Game Object and returns this Game Object for further chaining. - * The `name` property is not populated by Phaser and is presented for your own use. + * Adds a mix between two animations. * - * @method Phaser.GameObjects.GameObject#setName - * @since 3.0.0 + * Mixing allows you to specify a unique delay between a pairing of animations. * - * @param {string} value - The name to be given to this Game Object. + * When playing Animation A on a Game Object, if you then play Animation B, and a + * mix exists, it will wait for the specified delay to be over before playing Animation B. * - * @return {this} This GameObject. + * This allows you to customise smoothing between different types of animation, such + * as blending between an idle and a walk state, or a running and a firing state. + * + * Note that mixing is only applied if you use the `Sprite.play` method. If you opt to use + * `playAfterRepeat` or `playAfterDelay` instead, those will take priority and the mix + * delay will not be used. + * + * To update an existing mix, just call this method with the new delay. + * + * To remove a mix pairing, see the `removeMix` method. + * + * @method Phaser.Animations.AnimationManager#addMix + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation)} animA - The string-based key, or instance of, Animation A. + * @param {(string|Phaser.Animations.Animation)} animB - The string-based key, or instance of, Animation B. + * @param {number} delay - The delay, in milliseconds, to wait when transitioning from Animation A to B. + * + * @return {this} This Animation Manager. */ - setName: function (value) + addMix: function (animA, animB, delay) { - this.name = value; + var anims = this.anims; + var mixes = this.mixes; + + var keyA = (typeof(animA) === 'string') ? animA : animA.key; + var keyB = (typeof(animB) === 'string') ? animB : animB.key; + + if (anims.has(keyA) && anims.has(keyB)) + { + var mixObj = mixes.get(keyA); + + if (!mixObj) + { + mixObj = {}; + } + + mixObj[keyB] = delay; + + mixes.set(keyA, mixObj); + } return this; }, /** - * Sets the current state of this Game Object. + * Removes a mix between two animations. * - * Phaser itself will never modify the State of a Game Object, although plugins may do so. + * Mixing allows you to specify a unique delay between a pairing of animations. * - * For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'. - * The state value should typically be an integer (ideally mapped to a constant - * in your game code), but could also be a string. It is recommended to keep it light and simple. - * If you need to store complex data about your Game Object, look at using the Data Component instead. + * Calling this method lets you remove those pairings. You can either remove + * it between `animA` and `animB`, or if you do not provide the `animB` parameter, + * it will remove all `animA` mixes. * - * @method Phaser.GameObjects.GameObject#setState - * @since 3.16.0 + * If you wish to update an existing mix instead, call the `addMix` method with the + * new delay. * - * @param {(number|string)} value - The state of the Game Object. + * @method Phaser.Animations.AnimationManager#removeMix + * @since 3.50.0 * - * @return {this} This GameObject. + * @param {(string|Phaser.Animations.Animation)} animA - The string-based key, or instance of, Animation A. + * @param {(string|Phaser.Animations.Animation)} [animB] - The string-based key, or instance of, Animation B. If not given, all mixes for Animation A will be removed. + * + * @return {this} This Animation Manager. */ - setState: function (value) + removeMix: function (animA, animB) { - this.state = value; + var mixes = this.mixes; + + var keyA = (typeof(animA) === 'string') ? animA : animA.key; + + var mixObj = mixes.get(keyA); + + if (mixObj) + { + if (animB) + { + var keyB = (typeof(animB) === 'string') ? animB : animB.key; + + if (mixObj.hasOwnProperty(keyB)) + { + // Remove just this pairing + delete mixObj[keyB]; + } + } + else if (!animB) + { + // Remove everything for animA + mixes.delete(keyA); + } + } return this; }, /** - * Adds a Data Manager component to this Game Object. + * Returns the mix delay between two animations. * - * @method Phaser.GameObjects.GameObject#setDataEnabled - * @since 3.0.0 - * @see Phaser.Data.DataManager + * If no mix has been set-up, this method will return zero. * - * @return {this} This GameObject. + * If you wish to create, or update, a new mix, call the `addMix` method. + * If you wish to remove a mix, call the `removeMix` method. + * + * @method Phaser.Animations.AnimationManager#getMix + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation)} animA - The string-based key, or instance of, Animation A. + * @param {(string|Phaser.Animations.Animation)} animB - The string-based key, or instance of, Animation B. + * + * @return {number} The mix duration, or zero if no mix exists. */ - setDataEnabled: function () + getMix: function (animA, animB) { - if (!this.data) + var mixes = this.mixes; + + var keyA = (typeof(animA) === 'string') ? animA : animA.key; + var keyB = (typeof(animB) === 'string') ? animB : animB.key; + + var mixObj = mixes.get(keyA); + + if (mixObj && mixObj.hasOwnProperty(keyB)) { - this.data = new DataManager(this); + return mixObj[keyB]; + } + else + { + return 0; } - - return this; }, /** - * Allows you to store a key value pair within this Game Objects Data Manager. + * Adds an existing Animation to the Animation Manager. * - * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled - * before setting the value. + * @method Phaser.Animations.AnimationManager#add + * @fires Phaser.Animations.Events#ADD_ANIMATION + * @since 3.0.0 * - * If the key doesn't already exist in the Data Manager then it is created. + * @param {string} key - The key under which the Animation should be added. The Animation will be updated with it. Must be unique. + * @param {Phaser.Animations.Animation} animation - The Animation which should be added to the Animation Manager. * - * ```javascript - * sprite.setData('name', 'Red Gem Stone'); - * ``` - * - * You can also pass in an object of key value pairs as the first argument: - * - * ```javascript - * sprite.setData({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 }); - * ``` - * - * To get a value back again you can call `getData`: - * - * ```javascript - * sprite.getData('gold'); - * ``` - * - * Or you can access the value directly via the `values` property, where it works like any other variable: - * - * ```javascript - * sprite.data.values.gold += 50; - * ``` - * - * When the value is first set, a `setdata` event is emitted from this Game Object. - * - * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. - * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. - * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. - * - * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. - * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. - * - * @method Phaser.GameObjects.GameObject#setData - * @since 3.0.0 - * - * @param {(string|object)} key - The key to set the value for. Or an object of key value pairs. If an object the `data` argument is ignored. - * @param {*} [data] - The value to set for the given key. If an object is provided as the key this argument is ignored. - * - * @return {this} This GameObject. + * @return {this} This Animation Manager. */ - setData: function (key, value) + add: function (key, animation) { - if (!this.data) + if (this.anims.has(key)) { - this.data = new DataManager(this); + console.warn('Animation key exists: ' + key); + + return this; } - this.data.set(key, value); + animation.key = key; + + this.anims.set(key, animation); + + this.emit(Events.ADD_ANIMATION, key, animation); return this; }, /** - * Increase a value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is increased from 0. - * - * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled - * before setting the value. - * - * If the key doesn't already exist in the Data Manager then it is created. + * Checks to see if the given key is already in use within the Animation Manager or not. * - * When the value is first set, a `setdata` event is emitted from this Game Object. + * Animations are global. Keys created in one scene can be used from any other Scene in your game. They are not Scene specific. * - * @method Phaser.GameObjects.GameObject#incData - * @since 3.23.0 + * @method Phaser.Animations.AnimationManager#exists + * @since 3.16.0 * - * @param {(string|object)} key - The key to increase the value for. - * @param {*} [data] - The value to increase for the given key. + * @param {string} key - The key of the Animation to check. * - * @return {this} This GameObject. + * @return {boolean} `true` if the Animation already exists in the Animation Manager, or `false` if the key is available. */ - incData: function (key, value) + exists: function (key) { - if (!this.data) - { - this.data = new DataManager(this); - } - - this.data.inc(key, value); - - return this; + return this.anims.has(key); }, /** - * Toggle a boolean value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is toggled from false. + * Create one, or more animations from a loaded Aseprite JSON file. * - * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled - * before setting the value. + * Aseprite is a powerful animated sprite editor and pixel art tool. * - * If the key doesn't already exist in the Data Manager then it is created. + * You can find more details at https://www.aseprite.org/ * - * When the value is first set, a `setdata` event is emitted from this Game Object. + * To export a compatible JSON file in Aseprite, please do the following: * - * @method Phaser.GameObjects.GameObject#toggleData - * @since 3.23.0 + * 1. Go to "File - Export Sprite Sheet" * - * @param {(string|object)} key - The key to toggle the value for. + * 2. On the **Layout** tab: + * 2a. Set the "Sheet type" to "Packed" + * 2b. Set the "Constraints" to "None" + * 2c. Check the "Merge Duplicates" checkbox * - * @return {this} This GameObject. - */ - toggleData: function (key) - { - if (!this.data) - { - this.data = new DataManager(this); - } - - this.data.toggle(key); - - return this; - }, - - /** - * Retrieves the value for the given key in this Game Objects Data Manager, or undefined if it doesn't exist. + * 3. On the **Sprite** tab: + * 3a. Set "Layers" to "Visible layers" + * 3b. Set "Frames" to "All frames", unless you only wish to export a sub-set of tags * - * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either: + * 4. On the **Borders** tab: + * 4a. Check the "Trim Sprite" and "Trim Cells" options + * 4b. Ensure "Border Padding", "Spacing" and "Inner Padding" are all > 0 (1 is usually enough) + * + * 5. On the **Output** tab: + * 5a. Check "Output File", give your image a name and make sure you choose "png files" as the file type + * 5b. Check "JSON Data" and give your json file a name + * 5c. The JSON Data type can be either a Hash or Array, Phaser doesn't mind. + * 5d. Make sure "Tags" is checked in the Meta options + * 5e. In the "Item Filename" input box, make sure it says just "{frame}" and nothing more. + * + * 6. Click export + * + * This was tested with Aseprite 1.2.25. + * + * This will export a png and json file which you can load using the Aseprite Loader, i.e.: * * ```javascript - * sprite.getData('gold'); + * function preload () + * { + * this.load.path = 'assets/animations/aseprite/'; + * this.load.aseprite('paladin', 'paladin.png', 'paladin.json'); + * } * ``` * - * Or access the value directly: + * Once loaded, you can call this method from within a Scene with the 'atlas' key: * * ```javascript - * sprite.data.values.gold; + * this.anims.createFromAseprite('paladin'); * ``` * - * You can also pass in an array of keys, in which case an array of values will be returned: + * Any animations defined in the JSON will now be available to use in Phaser and you play them + * via their Tag name. For example, if you have an animation called 'War Cry' on your Aseprite timeline, + * you can play it in Phaser using that Tag name: * * ```javascript - * sprite.getData([ 'gold', 'armor', 'health' ]); + * this.add.sprite(400, 300).play('War Cry'); * ``` * - * This approach is useful for destructuring arrays in ES6. + * When calling this method you can optionally provide an array of tag names, and only those animations + * will be created. For example: * - * @method Phaser.GameObjects.GameObject#getData - * @since 3.0.0 + * ```javascript + * this.anims.createFromAseprite('paladin', [ 'step', 'War Cry', 'Magnum Break' ]); + * ``` * - * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys. + * This will only create the 3 animations defined. Note that the tag names are case-sensitive. * - * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array. + * @method Phaser.Animations.AnimationManager#createFromAseprite + * @since 3.50.0 + * + * @param {string} key - The key of the loaded Aseprite atlas. It must have been loaded prior to calling this method. + * @param {string[]} [tags] - An array of Tag names. If provided, only animations found in this array will be created. + * @param {(Phaser.Animations.AnimationManager|Phaser.GameObjects.GameObject)} [target] - Create the animations on this target Sprite. If not given, they will be created globally in this Animation Manager. + * + * @return {Phaser.Animations.Animation[]} An array of Animation instances that were successfully created. */ - getData: function (key) + createFromAseprite: function (key, tags, target) { - if (!this.data) + var output = []; + + var data = this.game.cache.json.get(key); + + if (!data) { - this.data = new DataManager(this); + console.warn('No Aseprite data found for: ' + key); + + return output; } - return this.data.get(key); + var _this = this; + + var meta = GetValue(data, 'meta', null); + var frames = GetValue(data, 'frames', null); + + if (meta && frames) + { + var frameTags = GetValue(meta, 'frameTags', []); + + frameTags.forEach(function (tag) + { + var animFrames = []; + + var name = GetFastValue(tag, 'name', null); + var from = GetFastValue(tag, 'from', 0); + var to = GetFastValue(tag, 'to', 0); + var direction = GetFastValue(tag, 'direction', 'forward'); + + if (!name) + { + // Skip if no name + return; + } + + if (!tags || (tags && tags.indexOf(name) > -1)) + { + // Get all the frames for this tag and calculate the total duration in milliseconds. + var totalDuration = 0; + for (var i = from; i <= to; i++) + { + var frameKey = i.toString(); + var frame = frames[frameKey]; + + if (frame) + { + var frameDuration = GetFastValue(frame, 'duration', MATH_CONST.MAX_SAFE_INTEGER); + animFrames.push({ key: key, frame: frameKey, duration: frameDuration }); + totalDuration += frameDuration; + } + } + + // Fix duration to play nice with how the next tick is calculated. + var msPerFrame = totalDuration / animFrames.length; + + animFrames.forEach(function (entry) + { + entry.duration -= msPerFrame; + }); + + if (direction === 'reverse') + { + animFrames = animFrames.reverse(); + } + + // Create the animation + var createConfig = { + key: name, + frames: animFrames, + duration: totalDuration, + yoyo: (direction === 'pingpong') + }; + + var result; + + if (target) + { + if (target.anims) + { + result = target.anims.create(createConfig); + } + } + else + { + result = _this.create(createConfig); + } + + if (result) + { + output.push(result); + } + } + }); + } + + return output; }, /** - * Pass this Game Object to the Input Manager to enable it for Input. - * - * Input works by using hit areas, these are nearly always geometric shapes, such as rectangles or circles, that act as the hit area - * for the Game Object. However, you can provide your own hit area shape and callback, should you wish to handle some more advanced - * input detection. + * Creates a new Animation and adds it to the Animation Manager. * - * If no arguments are provided it will try and create a rectangle hit area based on the texture frame the Game Object is using. If - * this isn't a texture-bound object, such as a Graphics or BitmapText object, this will fail, and you'll need to provide a specific - * shape for it to use. + * Animations are global. Once created, you can use them in any Scene in your game. They are not Scene specific. * - * You can also provide an Input Configuration Object as the only argument to this method. + * If an invalid key is given this method will return `false`. * - * @example - * sprite.setInteractive(); + * If you pass the key of an animation that already exists in the Animation Manager, that animation will be returned. * - * @example - * sprite.setInteractive(new Phaser.Geom.Circle(45, 46, 45), Phaser.Geom.Circle.Contains); + * A brand new animation is only created if the key is valid and not already in use. * - * @example - * graphics.setInteractive(new Phaser.Geom.Rectangle(0, 0, 128, 128), Phaser.Geom.Rectangle.Contains); + * If you wish to re-use an existing key, call `AnimationManager.remove` first, then this method. * - * @method Phaser.GameObjects.GameObject#setInteractive + * @method Phaser.Animations.AnimationManager#create + * @fires Phaser.Animations.Events#ADD_ANIMATION * @since 3.0.0 * - * @param {(Phaser.Types.Input.InputConfiguration|any)} [hitArea] - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not given it will try to create a Rectangle based on the texture frame. - * @param {Phaser.Types.Input.HitAreaCallback} [callback] - The callback that determines if the pointer is within the Hit Area shape or not. If you provide a shape you must also provide a callback. - * @param {boolean} [dropZone=false] - Should this Game Object be treated as a drop zone target? + * @param {Phaser.Types.Animations.Animation} config - The configuration settings for the Animation. * - * @return {this} This GameObject. + * @return {(Phaser.Animations.Animation|false)} The Animation that was created, or `false` if the key is already in use. */ - setInteractive: function (hitArea, hitAreaCallback, dropZone) + create: function (config) { - this.scene.sys.input.enable(this, hitArea, hitAreaCallback, dropZone); + var key = config.key; - return this; + var anim = false; + + if (key) + { + anim = this.get(key); + + if (!anim) + { + anim = new Animation(this, key, config); + + this.anims.set(key, anim); + + this.emit(Events.ADD_ANIMATION, key, anim); + } + else + { + console.warn('AnimationManager key already exists: ' + key); + } + } + + return anim; }, /** - * If this Game Object has previously been enabled for input, this will disable it. - * - * An object that is disabled for input stops processing or being considered for - * input events, but can be turned back on again at any time by simply calling - * `setInteractive()` with no arguments provided. + * Loads this Animation Manager's Animations and settings from a JSON object. * - * If want to completely remove interaction from this Game Object then use `removeInteractive` instead. + * @method Phaser.Animations.AnimationManager#fromJSON + * @since 3.0.0 * - * @method Phaser.GameObjects.GameObject#disableInteractive - * @since 3.7.0 + * @param {(string|Phaser.Types.Animations.JSONAnimations|Phaser.Types.Animations.JSONAnimation)} data - The JSON object to parse. + * @param {boolean} [clearCurrentAnimations=false] - If set to `true`, the current animations will be removed (`anims.clear()`). If set to `false` (default), the animations in `data` will be added. * - * @return {this} This GameObject. + * @return {Phaser.Animations.Animation[]} An array containing all of the Animation objects that were created as a result of this call. */ - disableInteractive: function () + fromJSON: function (data, clearCurrentAnimations) { - if (this.input) + if (clearCurrentAnimations === undefined) { clearCurrentAnimations = false; } + + if (clearCurrentAnimations) + { + this.anims.clear(); + } + + // Do we have a String (i.e. from JSON, or an Object?) + if (typeof data === 'string') { - this.input.enabled = false; + data = JSON.parse(data); } - return this; + var output = []; + + // Array of animations, or a single animation? + if (data.hasOwnProperty('anims') && Array.isArray(data.anims)) + { + for (var i = 0; i < data.anims.length; i++) + { + output.push(this.create(data.anims[i])); + } + + if (data.hasOwnProperty('globalTimeScale')) + { + this.globalTimeScale = data.globalTimeScale; + } + } + else if (data.hasOwnProperty('key') && data.type === 'frame') + { + output.push(this.create(data)); + } + + return output; }, /** - * If this Game Object has previously been enabled for input, this will queue it - * for removal, causing it to no longer be interactive. The removal happens on - * the next game step, it is not immediate. + * Generate an array of {@link Phaser.Types.Animations.AnimationFrame} objects from a texture key and configuration object. * - * The Interactive Object that was assigned to this Game Object will be destroyed, - * removed from the Input Manager and cleared from this Game Object. + * Generates objects with string based frame names, as configured by the given {@link Phaser.Types.Animations.GenerateFrameNames}. * - * If you wish to re-enable this Game Object at a later date you will need to - * re-create its InteractiveObject by calling `setInteractive` again. + * It's a helper method, designed to make it easier for you to extract all of the frame names from texture atlases. * - * If you wish to only temporarily stop an object from receiving input then use - * `disableInteractive` instead, as that toggles the interactive state, where-as - * this erases it completely. + * If you're working with a sprite sheet, see the `generateFrameNumbers` method instead. * - * If you wish to resize a hit area, don't remove and then set it as being - * interactive. Instead, access the hitarea object directly and resize the shape - * being used. I.e.: `sprite.input.hitArea.setSize(width, height)` (assuming the - * shape is a Rectangle, which it is by default.) + * Example: * - * @method Phaser.GameObjects.GameObject#removeInteractive - * @since 3.7.0 + * If you have a texture atlases loaded called `gems` and it contains 6 frames called `ruby_0001`, `ruby_0002`, and so on, + * then you can call this method using: `this.anims.generateFrameNames('gems', { prefix: 'ruby_', start: 1, end: 6, zeroPad: 4 })`. * - * @return {this} This GameObject. + * The `end` value tells it to select frames 1 through 6, incrementally numbered, all starting with the prefix `ruby_`. The `zeroPad` + * value tells it how many zeroes pad out the numbers. To create an animation using this method, you can do: + * + * ```javascript + * this.anims.create({ + * key: 'ruby', + * repeat: -1, + * frames: this.anims.generateFrameNames('gems', { + * prefix: 'ruby_', + * end: 6, + * zeroPad: 4 + * }) + * }); + * ``` + * + * Please see the animation examples for further details. + * + * @method Phaser.Animations.AnimationManager#generateFrameNames + * @since 3.0.0 + * + * @param {string} key - The key for the texture containing the animation frames. + * @param {Phaser.Types.Animations.GenerateFrameNames} [config] - The configuration object for the animation frame names. + * + * @return {Phaser.Types.Animations.AnimationFrame[]} The array of {@link Phaser.Types.Animations.AnimationFrame} objects. */ - removeInteractive: function () + generateFrameNames: function (key, config) { - this.scene.sys.input.clear(this); + var prefix = GetValue(config, 'prefix', ''); + var start = GetValue(config, 'start', 0); + var end = GetValue(config, 'end', 0); + var suffix = GetValue(config, 'suffix', ''); + var zeroPad = GetValue(config, 'zeroPad', 0); + var out = GetValue(config, 'outputArray', []); + var frames = GetValue(config, 'frames', false); - this.input = undefined; + if (!this.textureManager.exists(key)) + { + console.warn('Texture "%s" not found', key); - return this; + return out; + } + + var texture = this.textureManager.get(key); + + if (!texture) + { + return out; + } + + var i; + + if (!config) + { + // Use every frame in the atlas + frames = texture.getFrameNames(); + + for (i = 0; i < frames.length; i++) + { + out.push({ key: key, frame: frames[i] }); + } + } + else + { + if (!frames) + { + frames = NumberArray(start, end); + } + + for (i = 0; i < frames.length; i++) + { + var frame = prefix + Pad(frames[i], zeroPad, '0', 1) + suffix; + + if (texture.has(frame)) + { + out.push({ key: key, frame: frame }); + } + else + { + console.warn('Frame "%s" not found in texture "%s"', frame, key); + } + } + } + + return out; }, /** - * This callback is invoked when this Game Object is added to a Scene. + * Generate an array of {@link Phaser.Types.Animations.AnimationFrame} objects from a texture key and configuration object. * - * Can be overriden by custom Game Objects, but be aware of some Game Objects that - * will use this, such as Sprites, to add themselves into the Update List. + * Generates objects with numbered frame names, as configured by the given {@link Phaser.Types.Animations.GenerateFrameNumbers}. * - * You can also listen for the `ADDED_TO_SCENE` event from this Game Object. + * If you're working with a texture atlas, see the `generateFrameNames` method instead. * - * @method Phaser.GameObjects.GameObject#addedToScene - * @since 3.50.0 - */ - addedToScene: function () - { - }, - - /** - * This callback is invoked when this Game Object is removed from a Scene. + * It's a helper method, designed to make it easier for you to extract frames from sprite sheets. * - * Can be overriden by custom Game Objects, but be aware of some Game Objects that - * will use this, such as Sprites, to removed themselves from the Update List. + * Example: * - * You can also listen for the `REMOVED_FROM_SCENE` event from this Game Object. + * If you have a sprite sheet loaded called `explosion` and it contains 12 frames, then you can call this method using: * - * @method Phaser.GameObjects.GameObject#removedFromScene - * @since 3.50.0 - */ - removedFromScene: function () - { - }, - - /** - * To be overridden by custom GameObjects. Allows base objects to be used in a Pool. + * `this.anims.generateFrameNumbers('explosion', { start: 0, end: 11 })`. * - * @method Phaser.GameObjects.GameObject#update - * @since 3.0.0 + * The `end` value of 11 tells it to stop after the 12th frame has been added, because it started at zero. * - * @param {...*} [args] - args - */ - update: function () - { - }, - - /** - * Returns a JSON representation of the Game Object. + * To create an animation using this method, you can do: * - * @method Phaser.GameObjects.GameObject#toJSON - * @since 3.0.0 + * ```javascript + * this.anims.create({ + * key: 'boom', + * frames: this.anims.generateFrameNumbers('explosion', { + * start: 0, + * end: 11 + * }) + * }); + * ``` * - * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. - */ - toJSON: function () - { - return ComponentsToJSON(this); - }, - - /** - * Compares the renderMask with the renderFlags to see if this Game Object will render or not. - * Also checks the Game Object against the given Cameras exclusion list. + * Note that `start` is optional and you don't need to include it if the animation starts from frame 0. * - * @method Phaser.GameObjects.GameObject#willRender - * @since 3.0.0 + * To specify an animation in reverse, swap the `start` and `end` values. * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against this Game Object. + * If the frames are not sequential, you may pass an array of frame numbers instead, for example: * - * @return {boolean} True if the Game Object should be rendered, otherwise false. - */ - willRender: function (camera) - { - return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); - }, - - /** - * Returns an array containing the display list index of either this Game Object, or if it has one, - * its parent Container. It then iterates up through all of the parent containers until it hits the - * root of the display list (which is index 0 in the returned array). + * `this.anims.generateFrameNumbers('explosion', { frames: [ 0, 1, 2, 1, 2, 3, 4, 0, 1, 2 ] })` * - * Used internally by the InputPlugin but also useful if you wish to find out the display depth of - * this Game Object and all of its ancestors. + * Please see the animation examples and `GenerateFrameNumbers` config docs for further details. * - * @method Phaser.GameObjects.GameObject#getIndexList - * @since 3.4.0 + * @method Phaser.Animations.AnimationManager#generateFrameNumbers + * @since 3.0.0 * - * @return {number[]} An array of display list position indexes. + * @param {string} key - The key for the texture containing the animation frames. + * @param {Phaser.Types.Animations.GenerateFrameNumbers} [config] - The configuration object for the animation frames. + * + * @return {Phaser.Types.Animations.AnimationFrame[]} The array of {@link Phaser.Types.Animations.AnimationFrame} objects. */ - getIndexList: function () + generateFrameNumbers: function (key, config) { - // eslint-disable-next-line consistent-this - var child = this; - var parent = this.parentContainer; + var start = GetValue(config, 'start', 0); + var end = GetValue(config, 'end', -1); + var first = GetValue(config, 'first', false); + var out = GetValue(config, 'outputArray', []); + var frames = GetValue(config, 'frames', false); - var indexes = []; + if (!this.textureManager.exists(key)) + { + console.warn('Texture "%s" not found', key); - while (parent) + return out; + } + + var texture = this.textureManager.get(key); + + if (!texture) { - indexes.unshift(parent.getIndex(child)); + return out; + } - child = parent; + if (first && texture.has(first)) + { + out.push({ key: key, frame: first }); + } - if (!parent.parentContainer) - { - break; - } - else + // No 'frames' array? Then generate one automatically + if (!frames) + { + if (end === -1) { - parent = parent.parentContainer; + // -1 because of __BASE, which we don't want in our results + // and -1 because frames are zero based + end = texture.frameTotal - 2; } - } - if (this.displayList) - { - indexes.unshift(this.displayList.getIndex(child)); + frames = NumberArray(start, end); } - else + + for (var i = 0; i < frames.length; i++) { - indexes.unshift(this.scene.sys.displayList.getIndex(child)); + var frameName = frames[i]; + + if (texture.has(frameName)) + { + out.push({ key: key, frame: frameName }); + } + else + { + console.warn('Frame "%s" not found in texture "%s"', frameName, key); + } } - return indexes; + return out; }, /** - * Adds this Game Object to the given Display List. - * - * If no Display List is specified, it will default to the Display List owned by the Scene to which - * this Game Object belongs. - * - * A Game Object can only exist on one Display List at any given time, but may move freely between them. + * Get an Animation. * - * If this Game Object is already on another Display List when this method is called, it will first - * be removed from it, before being added to the new list. + * @method Phaser.Animations.AnimationManager#get + * @since 3.0.0 * - * You can query which list it is on by looking at the `Phaser.GameObjects.GameObject#displayList` property. + * @param {string} key - The key of the Animation to retrieve. * - * If a Game Object isn't on any display list, it will not be rendered. If you just wish to temporarly - * disable it from rendering, consider using the `setVisible` method, instead. + * @return {Phaser.Animations.Animation} The Animation. + */ + get: function (key) + { + return this.anims.get(key); + }, + + /** + * Returns an array of all Animation keys that are using the given + * Texture. Only Animations that have at least one AnimationFrame + * entry using this texture will be included in the result. * - * @method Phaser.GameObjects.GameObject#addToDisplayList - * @fires Phaser.Scenes.Events#ADDED_TO_SCENE - * @fires Phaser.GameObjects.Events#ADDED_TO_SCENE - * @since 3.53.0 + * @method Phaser.Animations.AnimationManager#getAnimsFromTexture + * @since 3.60.0 * - * @param {(Phaser.GameObjects.DisplayList|Phaser.GameObjects.Layer)} [displayList] - The Display List to add to. Defaults to the Scene Display List. + * @param {(string|Phaser.Textures.Texture|Phaser.Textures.Frame)} key - The unique string-based key of the Texture, or a Texture, or Frame instance. * - * @return {this} This Game Object. + * @return {string[]} An array of Animation keys that feature the given Texture. */ - addToDisplayList: function (displayList) + getAnimsFromTexture: function (key) { - if (displayList === undefined) { displayList = this.scene.sys.displayList; } + var texture = this.textureManager.get(key); - if (this.displayList && this.displayList !== displayList) - { - this.removeFromDisplayList(); - } + var match = texture.key; + var anims = this.anims.getArray(); - // Don't repeat if it's already on this list - if (!displayList.exists(this)) + var out = []; + + for (var i = 0; i < anims.length; i++) { - this.displayList = displayList; + var anim = anims[i]; + var frames = anim.frames; - displayList.add(this, true); + for (var c = 0; c < frames.length; c++) + { + if (frames[c].textureKey === match) + { + out.push(anim.key); - displayList.queueDepthSort(); + break; + } + } + } - this.emit(Events.ADDED_TO_SCENE, this, this.scene); + return out; + }, - displayList.events.emit(SceneEvents.ADDED_TO_SCENE, this, this.scene); + /** + * Pause all animations. + * + * @method Phaser.Animations.AnimationManager#pauseAll + * @fires Phaser.Animations.Events#PAUSE_ALL + * @since 3.0.0 + * + * @return {this} This Animation Manager. + */ + pauseAll: function () + { + if (!this.paused) + { + this.paused = true; + + this.emit(Events.PAUSE_ALL); } return this; }, /** - * Adds this Game Object to the Update List belonging to the Scene. - * - * When a Game Object is added to the Update List it will have its `preUpdate` method called - * every game frame. This method is passed two parameters: `delta` and `time`. + * Play an animation on the given Game Objects that have an Animation Component. * - * If you wish to run your own logic within `preUpdate` then you should always call - * `preUpdate.super(delta, time)` within it, or it may fail to process required operations, - * such as Sprite animations. + * @method Phaser.Animations.AnimationManager#play + * @since 3.0.0 * - * @method Phaser.GameObjects.GameObject#addToUpdateList - * @since 3.53.0 + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} children - An array of Game Objects to play the animation on. They must have an Animation Component. * - * @return {this} This Game Object. + * @return {this} This Animation Manager. */ - addToUpdateList: function () + play: function (key, children) { - if (this.scene && this.preUpdate) + if (!Array.isArray(children)) { - this.scene.sys.updateList.add(this); + children = [ children ]; + } + + for (var i = 0; i < children.length; i++) + { + children[i].anims.play(key); } return this; }, /** - * Removes this Game Object from the Display List it is currently on. + * Takes an array of Game Objects that have an Animation Component and then + * starts the given animation playing on them. The start time of each Game Object + * is offset, incrementally, by the `stagger` amount. * - * A Game Object can only exist on one Display List at any given time, but may move freely removed - * and added back at a later stage. + * For example, if you pass an array with 4 children and a stagger time of 1000, + * the delays will be: * - * You can query which list it is on by looking at the `Phaser.GameObjects.GameObject#displayList` property. + * child 1: 1000ms delay + * child 2: 2000ms delay + * child 3: 3000ms delay + * child 4: 4000ms delay * - * If a Game Object isn't on any Display List, it will not be rendered. If you just wish to temporarly - * disable it from rendering, consider using the `setVisible` method, instead. + * If you set the `staggerFirst` parameter to `false` they would be: * - * @method Phaser.GameObjects.GameObject#removeFromDisplayList - * @fires Phaser.Scenes.Events#REMOVED_FROM_SCENE - * @fires Phaser.GameObjects.Events#REMOVED_FROM_SCENE - * @since 3.53.0 + * child 1: 0ms delay + * child 2: 1000ms delay + * child 3: 2000ms delay + * child 4: 3000ms delay * - * @return {this} This Game Object. + * You can also set `stagger` to be a negative value. If it was -1000, the above would be: + * + * child 1: 3000ms delay + * child 2: 2000ms delay + * child 3: 1000ms delay + * child 4: 0ms delay + * + * @method Phaser.Animations.AnimationManager#staggerPlay + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} children - An array of Game Objects to play the animation on. They must have an Animation Component. + * @param {number} stagger - The amount of time, in milliseconds, to offset each play time by. If a negative value is given, it's applied to the children in reverse order. + * @param {boolean} [staggerFirst=true] -Should the first child be staggered as well? + * + * @return {this} This Animation Manager. */ - removeFromDisplayList: function () + staggerPlay: function (key, children, stagger, staggerFirst) { - var displayList = this.displayList || this.scene.sys.displayList; + if (stagger === undefined) { stagger = 0; } + if (staggerFirst === undefined) { staggerFirst = true; } - if (displayList.exists(this)) + if (!Array.isArray(children)) { - displayList.remove(this, true); + children = [ children ]; + } - displayList.queueDepthSort(); + var len = children.length; - this.displayList = null; + if (!staggerFirst) + { + len--; + } - this.emit(Events.REMOVED_FROM_SCENE, this, this.scene); + for (var i = 0; i < children.length; i++) + { + var time = (stagger < 0) ? Math.abs(stagger) * (len - i) : stagger * i; - displayList.events.emit(SceneEvents.REMOVED_FROM_SCENE, this, this.scene); + children[i].anims.playAfterDelay(key, time); } return this; }, /** - * Removes this Game Object from the Scene's Update List. + * Removes an Animation from this Animation Manager, based on the given key. * - * When a Game Object is on the Update List, it will have its `preUpdate` method called - * every game frame. Calling this method will remove it from the list, preventing this. + * This is a global action. Once an Animation has been removed, no Game Objects + * can carry on using it. * - * Removing a Game Object from the Update List will stop most internal functions working. - * For example, removing a Sprite from the Update List will prevent it from being able to - * run animations. + * @method Phaser.Animations.AnimationManager#remove + * @fires Phaser.Animations.Events#REMOVE_ANIMATION + * @since 3.0.0 * - * @method Phaser.GameObjects.GameObject#removeFromUpdateList - * @since 3.53.0 + * @param {string} key - The key of the animation to remove. * - * @return {this} This Game Object. + * @return {Phaser.Animations.Animation} The Animation instance that was removed from the Animation Manager. */ - removeFromUpdateList: function () + remove: function (key) { - if (this.scene && this.preUpdate) + var anim = this.get(key); + + if (anim) { - this.scene.sys.updateList.remove(this); + this.emit(Events.REMOVE_ANIMATION, key, anim); + + this.anims.delete(key); + + this.removeMix(key); } - return this; + return anim; }, /** - * Destroys this Game Object removing it from the Display List and Update List and - * severing all ties to parent resources. - * - * Also removes itself from the Input Manager and Physics Manager if previously enabled. - * - * Use this to remove a Game Object from your game if you don't ever plan to use it again. - * As long as no reference to it exists within your own code it should become free for - * garbage collection by the browser. - * - * If you just want to temporarily disable an object then look at using the - * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected. + * Resume all paused animations. * - * @method Phaser.GameObjects.GameObject#destroy - * @fires Phaser.GameObjects.Events#DESTROY + * @method Phaser.Animations.AnimationManager#resumeAll + * @fires Phaser.Animations.Events#RESUME_ALL * @since 3.0.0 * - * @param {boolean} [fromScene=false] - `True` if this Game Object is being destroyed by the Scene, `false` if not. + * @return {this} This Animation Manager. */ - destroy: function (fromScene) + resumeAll: function () { - // This Game Object has already been destroyed - if (!this.scene || this.ignoreDestroy) + if (this.paused) { - return; - } - - if (fromScene === undefined) { fromScene = false; } + this.paused = false; - if (this.preDestroy) - { - this.preDestroy.call(this); + this.emit(Events.RESUME_ALL); } - this.emit(Events.DESTROY, this, fromScene); - - this.removeAllListeners(); - - if (this.postPipelines) - { - this.resetPostPipeline(true); - } + return this; + }, - this.removeFromDisplayList(); - this.removeFromUpdateList(); + /** + * Returns the Animation data as JavaScript object based on the given key. + * Or, if not key is defined, it will return the data of all animations as array of objects. + * + * @method Phaser.Animations.AnimationManager#toJSON + * @since 3.0.0 + * + * @param {string} [key] - The animation to get the JSONAnimation data from. If not provided, all animations are returned as an array. + * + * @return {Phaser.Types.Animations.JSONAnimations} The resulting JSONAnimations formatted object. + */ + toJSON: function (key) + { + var output = { + anims: [], + globalTimeScale: this.globalTimeScale + }; - if (this.input) + if (key !== undefined && key !== '') { - this.scene.sys.input.clear(this); - - this.input = undefined; + output.anims.push(this.anims.get(key).toJSON()); } - - if (this.data) + else { - this.data.destroy(); - - this.data = undefined; + this.anims.each(function (animationKey, animation) + { + output.anims.push(animation.toJSON()); + }); } - if (this.body) - { - this.body.destroy(); + return output; + }, - this.body = undefined; - } + /** + * Destroy this Animation Manager and clean up animation definitions and references to other objects. + * This method should not be called directly. It will be called automatically as a response to a `destroy` event from the Phaser.Game instance. + * + * @method Phaser.Animations.AnimationManager#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.anims.clear(); + this.mixes.clear(); - this.active = false; - this.visible = false; + this.textureManager = null; - this.scene = undefined; - this.parentContainer = undefined; + this.game = null; } }); -/** - * The bitmask that `GameObject.renderFlags` is compared against to determine if the Game Object will render or not. - * - * @constant {number} RENDER_MASK - * @memberof Phaser.GameObjects.GameObject - * @default - */ -GameObject.RENDER_MASK = 15; - -module.exports = GameObject; +module.exports = AnimationManager; /***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 16569: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(24); -var SceneEvents = __webpack_require__(20); +var Class = __webpack_require__(56694); +var CustomMap = __webpack_require__(33885); +var GetFastValue = __webpack_require__(72632); +var Events = __webpack_require__(16938); +var Animation = __webpack_require__(85463); /** * @classdesc - * The Game Object Creator is a Scene plugin that allows you to quickly create many common - * types of Game Objects and return them. Unlike the Game Object Factory, they are not automatically - * added to the Scene. + * The Animation State Component. * - * Game Objects directly register themselves with the Creator and inject their own creation - * methods into the class. + * This component provides features to apply animations to Game Objects. It is responsible for + * loading, queuing animations for later playback, mixing between animations and setting + * the current animation frame to the Game Object that owns this component. * - * @class GameObjectCreator - * @memberof Phaser.GameObjects + * This component lives as an instance within any Game Object that has it defined, such as Sprites. + * + * You can access its properties and methods via the `anims` property, i.e. `Sprite.anims`. + * + * As well as playing animations stored in the global Animation Manager, this component + * can also create animations that are stored locally within it. See the `create` method + * for more details. + * + * Prior to Phaser 3.50 this component was called just `Animation` and lived in the + * `Phaser.GameObjects.Components` namespace. It was renamed to `AnimationState` + * in 3.50 to help better identify its true purpose when browsing the documentation. + * + * @class AnimationState + * @memberof Phaser.Animations * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene to which this Game Object Factory belongs. + * @param {Phaser.GameObjects.GameObject} parent - The Game Object to which this animation component belongs. */ -var GameObjectCreator = new Class({ +var AnimationState = new Class({ initialize: - function GameObjectCreator (scene) + function AnimationState (parent) { /** - * The Scene to which this Game Object Creator belongs. + * The Game Object to which this animation component belongs. * - * @name Phaser.GameObjects.GameObjectCreator#scene - * @type {Phaser.Scene} - * @protected + * You can typically access this component from the Game Object + * via the `this.anims` property. + * + * @name Phaser.Animations.AnimationState#parent + * @type {Phaser.GameObjects.GameObject} * @since 3.0.0 */ - this.scene = scene; + this.parent = parent; /** - * A reference to the Scene.Systems. + * A reference to the global Animation Manager. * - * @name Phaser.GameObjects.GameObjectCreator#systems - * @type {Phaser.Scenes.Systems} - * @protected + * @name Phaser.Animations.AnimationState#animationManager + * @type {Phaser.Animations.AnimationManager} * @since 3.0.0 */ - this.systems = scene.sys; + this.animationManager = parent.scene.sys.anims; + + this.animationManager.on(Events.REMOVE_ANIMATION, this.globalRemove, this); /** - * A reference to the Scene Event Emitter. + * A reference to the Texture Manager. * - * @name Phaser.GameObjects.GameObjectCreator#events - * @type {Phaser.Events.EventEmitter} + * @name Phaser.Animations.AnimationState#textureManager + * @type {Phaser.Textures.TextureManager} * @protected * @since 3.50.0 */ - this.events = scene.sys.events; + this.textureManager = this.animationManager.textureManager; /** - * A reference to the Scene Display List. + * The Animations stored locally in this Animation component. * - * @name Phaser.GameObjects.GameObjectCreator#displayList - * @type {Phaser.GameObjects.DisplayList} + * Do not modify the contents of this Map directly, instead use the + * `add`, `create` and `remove` methods of this class instead. + * + * @name Phaser.Animations.AnimationState#anims + * @type {Phaser.Structs.Map.} * @protected - * @since 3.0.0 + * @since 3.50.0 */ - this.displayList; + this.anims = null; /** - * A reference to the Scene Update List. + * Is an animation currently playing or not? * - * @name Phaser.GameObjects.GameObjectCreator#updateList - * @type {Phaser.GameObjects.UpdateList} - * @protected + * @name Phaser.Animations.AnimationState#isPlaying + * @type {boolean} + * @default false * @since 3.0.0 */ - this.updateList; - - this.events.once(SceneEvents.BOOT, this.boot, this); - this.events.on(SceneEvents.START, this.start, this); - }, - - /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. - * - * @method Phaser.GameObjects.GameObjectCreator#boot - * @private - * @since 3.5.1 - */ - boot: function () - { - this.displayList = this.systems.displayList; - this.updateList = this.systems.updateList; + this.isPlaying = false; - this.events.once(SceneEvents.DESTROY, this.destroy, this); - }, + /** + * Has the current animation started playing, or is it waiting for a delay to expire? + * + * @name Phaser.Animations.AnimationState#hasStarted + * @type {boolean} + * @default false + * @since 3.50.0 + */ + this.hasStarted = false; - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. - * - * @method Phaser.GameObjects.GameObjectCreator#start - * @private - * @since 3.5.0 - */ - start: function () - { - this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); - }, - - /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. - * - * @method Phaser.GameObjects.GameObjectCreator#shutdown - * @private - * @since 3.0.0 - */ - shutdown: function () - { - this.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); - }, - - /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. - * - * @method Phaser.GameObjects.GameObjectCreator#destroy - * @private - * @since 3.0.0 - */ - destroy: function () - { - this.shutdown(); - - this.events.off(SceneEvents.START, this.start, this); - - this.scene = null; - this.systems = null; - this.events = null; - - this.displayList = null; - this.updateList = null; - } - -}); - -/** - * Static method called directly by the Game Object creator functions. - * With this method you can register a custom GameObject factory in the GameObjectCreator, - * providing a name (`factoryType`) and the constructor (`factoryFunction`) in order - * to be called when you invoke Phaser.Scene.make[ factoryType ] method. - * - * @method Phaser.GameObjects.GameObjectCreator.register - * @static - * @since 3.0.0 - * - * @param {string} factoryType - The key of the factory that you will use to call to Phaser.Scene.make[ factoryType ] method. - * @param {function} factoryFunction - The constructor function to be called when you invoke to the Phaser.Scene.make method. - */ -GameObjectCreator.register = function (factoryType, factoryFunction) -{ - if (!GameObjectCreator.prototype.hasOwnProperty(factoryType)) - { - GameObjectCreator.prototype[factoryType] = factoryFunction; - } -}; - -/** - * Static method called directly by the Game Object Creator functions. - * - * With this method you can remove a custom Game Object Creator that has been previously - * registered in the Game Object Creator. Pass in its `factoryType` in order to remove it. - * - * @method Phaser.GameObjects.GameObjectCreator.remove - * @static - * @since 3.0.0 - * - * @param {string} factoryType - The key of the factory that you want to remove from the GameObjectCreator. - */ -GameObjectCreator.remove = function (factoryType) -{ - if (GameObjectCreator.prototype.hasOwnProperty(factoryType)) - { - delete GameObjectCreator.prototype[factoryType]; - } -}; - -PluginCache.register('GameObjectCreator', GameObjectCreator, 'make'); - -module.exports = GameObjectCreator; - - -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var IsPlainObject = __webpack_require__(7); - -// @param {boolean} deep - Perform a deep copy? -// @param {object} target - The target object to copy to. -// @return {object} The extended object. - -/** - * This is a slightly modified version of http://api.jquery.com/jQuery.extend/ - * - * @function Phaser.Utils.Objects.Extend - * @since 3.0.0 - * - * @param {...*} [args] - The objects that will be mixed. - * - * @return {object} The extended object. - */ -var Extend = function () -{ - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if (typeof target === 'boolean') - { - deep = target; - target = arguments[1] || {}; - - // skip the boolean and the target - i = 2; - } - - // extend Phaser if only one argument is passed - if (length === i) - { - target = this; - --i; - } - - for (; i < length; i++) - { - // Only deal with non-null/undefined values - if ((options = arguments[i]) != null) - { - // Extend the base object - for (name in options) - { - src = target[name]; - copy = options[name]; - - // Prevent never-ending loop - if (target === copy) - { - continue; - } - - // Recurse if we're merging plain objects or arrays - if (deep && copy && (IsPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) - { - if (copyIsArray) - { - copyIsArray = false; - clone = src && Array.isArray(src) ? src : []; - } - else - { - clone = src && IsPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[name] = Extend(deep, clone, copy); - - // Don't bring in undefined values - } - else if (copy !== undefined) - { - target[name] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -module.exports = Extend; - - -/***/ }), -/* 18 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Force a value within the boundaries by clamping it to the range `min`, `max`. - * - * @function Phaser.Math.Clamp - * @since 3.0.0 - * - * @param {number} value - The value to be clamped. - * @param {number} min - The minimum bounds. - * @param {number} max - The maximum bounds. - * - * @return {number} The clamped value. - */ -var Clamp = function (value, min, max) -{ - return Math.max(min, Math.min(max, value)); -}; - -module.exports = Clamp; - - -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var TransformMatrix = __webpack_require__(25); - -var tempMatrix1 = new TransformMatrix(); -var tempMatrix2 = new TransformMatrix(); -var tempMatrix3 = new TransformMatrix(); - -var result = { camera: tempMatrix1, sprite: tempMatrix2, calc: tempMatrix3 }; - -/** - * Calculates the Transform Matrix of the given Game Object and Camera, factoring in - * the parent matrix if provided. - * - * Note that the object this results contains _references_ to the Transform Matrices, - * not new instances of them. Therefore, you should use their values immediately, or - * copy them to your own matrix, as they will be replaced as soon as another Game - * Object is rendered. - * - * @function Phaser.GameObjects.GetCalcMatrix - * @memberof Phaser.GameObjects - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} src - The Game Object to calculate the transform matrix for. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera being used to render the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - The transform matrix of the parent container, if any. - * - * @return {Phaser.Types.GameObjects.GetCalcMatrixResults} The results object containing the updated transform matrices. - */ -var GetCalcMatrix = function (src, camera, parentMatrix) -{ - var camMatrix = tempMatrix1; - var spriteMatrix = tempMatrix2; - var calcMatrix = tempMatrix3; - - spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); - - if (parentMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - - // Undo the camera scroll - spriteMatrix.e = src.x; - spriteMatrix.f = src.y; - } - else - { - spriteMatrix.e -= camera.scrollX * src.scrollFactorX; - spriteMatrix.f -= camera.scrollY * src.scrollFactorY; - } - - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); - - return result; -}; - -module.exports = GetCalcMatrix; - - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Scenes.Events - */ - -module.exports = { - - ADDED_TO_SCENE: __webpack_require__(656), - BOOT: __webpack_require__(657), - CREATE: __webpack_require__(658), - DESTROY: __webpack_require__(659), - PAUSE: __webpack_require__(660), - POST_UPDATE: __webpack_require__(661), - PRE_RENDER: __webpack_require__(662), - PRE_UPDATE: __webpack_require__(663), - READY: __webpack_require__(664), - REMOVED_FROM_SCENE: __webpack_require__(665), - RENDER: __webpack_require__(666), - RESUME: __webpack_require__(667), - SHUTDOWN: __webpack_require__(668), - SLEEP: __webpack_require__(669), - START: __webpack_require__(670), - TRANSITION_COMPLETE: __webpack_require__(671), - TRANSITION_INIT: __webpack_require__(672), - TRANSITION_OUT: __webpack_require__(673), - TRANSITION_START: __webpack_require__(674), - TRANSITION_WAKE: __webpack_require__(675), - UPDATE: __webpack_require__(676), - WAKE: __webpack_require__(677) - -}; - - -/***/ }), -/* 21 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var FILE_CONST = { - - /** - * The Loader is idle. - * - * @name Phaser.Loader.LOADER_IDLE - * @type {number} - * @since 3.0.0 - */ - LOADER_IDLE: 0, - - /** - * The Loader is actively loading. - * - * @name Phaser.Loader.LOADER_LOADING - * @type {number} - * @since 3.0.0 - */ - LOADER_LOADING: 1, - - /** - * The Loader is processing files is has loaded. - * - * @name Phaser.Loader.LOADER_PROCESSING - * @type {number} - * @since 3.0.0 - */ - LOADER_PROCESSING: 2, - - /** - * The Loader has completed loading and processing. - * - * @name Phaser.Loader.LOADER_COMPLETE - * @type {number} - * @since 3.0.0 - */ - LOADER_COMPLETE: 3, - - /** - * The Loader is shutting down. - * - * @name Phaser.Loader.LOADER_SHUTDOWN - * @type {number} - * @since 3.0.0 - */ - LOADER_SHUTDOWN: 4, - - /** - * The Loader has been destroyed. - * - * @name Phaser.Loader.LOADER_DESTROYED - * @type {number} - * @since 3.0.0 - */ - LOADER_DESTROYED: 5, - - /** - * File is in the load queue but not yet started - * - * @name Phaser.Loader.FILE_PENDING - * @type {number} - * @since 3.0.0 - */ - FILE_PENDING: 10, - - /** - * File has been started to load by the loader (onLoad called) - * - * @name Phaser.Loader.FILE_LOADING - * @type {number} - * @since 3.0.0 - */ - FILE_LOADING: 11, - - /** - * File has loaded successfully, awaiting processing - * - * @name Phaser.Loader.FILE_LOADED - * @type {number} - * @since 3.0.0 - */ - FILE_LOADED: 12, - - /** - * File failed to load - * - * @name Phaser.Loader.FILE_FAILED - * @type {number} - * @since 3.0.0 - */ - FILE_FAILED: 13, - - /** - * File is being processed (onProcess callback) - * - * @name Phaser.Loader.FILE_PROCESSING - * @type {number} - * @since 3.0.0 - */ - FILE_PROCESSING: 14, - - /** - * The File has errored somehow during processing. - * - * @name Phaser.Loader.FILE_ERRORED - * @type {number} - * @since 3.0.0 - */ - FILE_ERRORED: 16, - - /** - * File has finished processing. - * - * @name Phaser.Loader.FILE_COMPLETE - * @type {number} - * @since 3.0.0 - */ - FILE_COMPLETE: 17, - - /** - * File has been destroyed - * - * @name Phaser.Loader.FILE_DESTROYED - * @type {number} - * @since 3.0.0 - */ - FILE_DESTROYED: 18, - - /** - * File was populated from local data and doesn't need an HTTP request - * - * @name Phaser.Loader.FILE_POPULATED - * @type {number} - * @since 3.0.0 - */ - FILE_POPULATED: 19 - -}; - -module.exports = FILE_CONST; - - -/***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Core.Events - */ - -module.exports = { - - BLUR: __webpack_require__(612), - BOOT: __webpack_require__(613), - CONTEXT_LOST: __webpack_require__(614), - CONTEXT_RESTORED: __webpack_require__(615), - DESTROY: __webpack_require__(616), - FOCUS: __webpack_require__(617), - HIDDEN: __webpack_require__(618), - PAUSE: __webpack_require__(619), - POST_RENDER: __webpack_require__(620), - POST_STEP: __webpack_require__(621), - PRE_RENDER: __webpack_require__(622), - PRE_STEP: __webpack_require__(623), - READY: __webpack_require__(624), - RESUME: __webpack_require__(625), - STEP: __webpack_require__(626), - VISIBLE: __webpack_require__(627) - -}; - - -/***/ }), -/* 23 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The current Animation loaded into this Animation component. + * + * Will by `null` if no animation is yet loaded. + * + * @name Phaser.Animations.AnimationState#currentAnim + * @type {?Phaser.Animations.Animation} + * @default null + * @since 3.0.0 + */ + this.currentAnim = null; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The current AnimationFrame being displayed by this Animation component. + * + * Will by `null` if no animation is yet loaded. + * + * @name Phaser.Animations.AnimationState#currentFrame + * @type {?Phaser.Animations.AnimationFrame} + * @default null + * @since 3.0.0 + */ + this.currentFrame = null; -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var Events = __webpack_require__(95); -var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(155); -var MergeXHRSettings = __webpack_require__(240); -var XHRLoader = __webpack_require__(517); -var XHRSettings = __webpack_require__(156); + /** + * The key, instance, or config of the next Animation to be loaded into this Animation component + * when the current animation completes. + * + * Will by `null` if no animation has been queued. + * + * @name Phaser.Animations.AnimationState#nextAnim + * @type {?(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} + * @default null + * @since 3.16.0 + */ + this.nextAnim = null; -/** - * @classdesc - * The base File class used by all File Types that the Loader can support. - * You shouldn't create an instance of a File directly, but should extend it with your own class, setting a custom type and processing methods. - * - * @class File - * @memberof Phaser.Loader - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that is going to load this File. - * @param {Phaser.Types.Loader.FileConfig} fileConfig - The file configuration object, as created by the file type. - */ -var File = new Class({ + /** + * A queue of Animations to be loaded into this Animation component when the current animation completes. + * + * Populate this queue via the `chain` method. + * + * @name Phaser.Animations.AnimationState#nextAnimsQueue + * @type {array} + * @since 3.24.0 + */ + this.nextAnimsQueue = []; - initialize: + /** + * The Time Scale factor. + * + * You can adjust this value to modify the passage of time for the animation that is currently + * playing. For example, setting it to 2 will make the animation play twice as fast. Or setting + * it to 0.5 will slow the animation down. + * + * You can change this value at run-time, or set it via the `PlayAnimationConfig`. + * + * Prior to Phaser 3.50 this property was private and called `_timeScale`. + * + * @name Phaser.Animations.AnimationState#timeScale + * @type {number} + * @default 1 + * @since 3.50.0 + */ + this.timeScale = 1; - function File (loader, fileConfig) - { /** - * A reference to the Loader that is going to load this file. + * The frame rate of playback, of the current animation, in frames per second. * - * @name Phaser.Loader.File#loader - * @type {Phaser.Loader.LoaderPlugin} + * This value is set when a new animation is loaded into this component and should + * be treated as read-only, as changing it once playback has started will not alter + * the animation. To change the frame rate, provide a new value in the `PlayAnimationConfig` object. + * + * @name Phaser.Animations.AnimationState#frameRate + * @type {number} + * @default 0 * @since 3.0.0 */ - this.loader = loader; + this.frameRate = 0; /** - * A reference to the Cache, or Texture Manager, that is going to store this file if it loads. + * The duration of the current animation, in milliseconds. * - * @name Phaser.Loader.File#cache - * @type {(Phaser.Cache.BaseCache|Phaser.Textures.TextureManager)} - * @since 3.7.0 + * This value is set when a new animation is loaded into this component and should + * be treated as read-only, as changing it once playback has started will not alter + * the animation. To change the duration, provide a new value in the `PlayAnimationConfig` object. + * + * @name Phaser.Animations.AnimationState#duration + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.cache = GetFastValue(fileConfig, 'cache', false); + this.duration = 0; /** - * The file type string (image, json, etc) for sorting within the Loader. + * The number of milliseconds per frame, not including frame specific modifiers that may be present in the + * Animation data. * - * @name Phaser.Loader.File#type - * @type {string} + * This value is calculated when a new animation is loaded into this component and should + * be treated as read-only. Changing it will not alter playback speed. + * + * @name Phaser.Animations.AnimationState#msPerFrame + * @type {number} + * @default 0 * @since 3.0.0 */ - this.type = GetFastValue(fileConfig, 'type', false); + this.msPerFrame = 0; /** - * Unique cache key (unique within its file type) + * Skip frames if the time lags, or always advanced anyway? * - * @name Phaser.Loader.File#key - * @type {string} + * @name Phaser.Animations.AnimationState#skipMissedFrames + * @type {boolean} + * @default true * @since 3.0.0 */ - this.key = GetFastValue(fileConfig, 'key', false); + this.skipMissedFrames = true; - var loadKey = this.key; + /** + * The delay before starting playback of the current animation, in milliseconds. + * + * This value is set when a new animation is loaded into this component and should + * be treated as read-only, as changing it once playback has started will not alter + * the animation. To change the delay, provide a new value in the `PlayAnimationConfig` object. + * + * Prior to Phaser 3.50 this property was private and called `_delay`. + * + * @name Phaser.Animations.AnimationState#delay + * @type {number} + * @default 0 + * @since 3.50.0 + */ + this.delay = 0; - if (loader.prefix && loader.prefix !== '') - { - this.key = loader.prefix + loadKey; - } + /** + * The number of times to repeat playback of the current animation. + * + * If -1, it means the animation will repeat forever. + * + * This value is set when a new animation is loaded into this component and should + * be treated as read-only, as changing it once playback has started will not alter + * the animation. To change the number of repeats, provide a new value in the `PlayAnimationConfig` object. + * + * Prior to Phaser 3.50 this property was private and called `_repeat`. + * + * @name Phaser.Animations.AnimationState#repeat + * @type {number} + * @default 0 + * @since 3.50.0 + */ + this.repeat = 0; - if (!this.type || !this.key) - { - throw new Error('Invalid Loader.' + this.type + ' key'); - } + /** + * The number of milliseconds to wait before starting the repeat playback of the current animation. + * + * This value is set when a new animation is loaded into this component, but can also be modified + * at run-time. + * + * You can change the repeat delay by providing a new value in the `PlayAnimationConfig` object. + * + * Prior to Phaser 3.50 this property was private and called `_repeatDelay`. + * + * @name Phaser.Animations.AnimationState#repeatDelay + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.repeatDelay = 0; - var url = GetFastValue(fileConfig, 'url'); + /** + * Should the current animation yoyo? An animation that yoyos will play in reverse, from the end + * to the start, before then repeating or completing. An animation that does not yoyo will just + * play from the start to the end. + * + * This value is set when a new animation is loaded into this component, but can also be modified + * at run-time. + * + * You can change the yoyo by providing a new value in the `PlayAnimationConfig` object. + * + * Prior to Phaser 3.50 this property was private and called `_yoyo`. + * + * @name Phaser.Animations.AnimationState#yoyo + * @type {boolean} + * @default false + * @since 3.50.0 + */ + this.yoyo = false; - if (url === undefined) - { - url = loader.path + loadKey + '.' + GetFastValue(fileConfig, 'extension', ''); - } - else if (typeof url === 'string' && !url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/)) - { - url = loader.path + url; - } + /** + * If the animation has a delay set, before playback will begin, this + * controls when the first frame is set on the Sprite. If this property + * is 'false' then the frame is set only after the delay has expired. + * This is the default behavior. + * + * If this property is 'true' then the first frame of this animation + * is set immediately, and then when the delay expires, playback starts. + * + * @name Phaser.Animations.AnimationState#showBeforeDelay + * @type {boolean} + * @since 3.60.0 + */ + this.showBeforeDelay = false; /** - * The URL of the file, not including baseURL. + * Should the GameObject's `visible` property be set to `true` when the animation starts to play? * - * Automatically has Loader.path prepended to it if a string. + * This will happen _after_ any delay that may have been set. * - * Can also be a JavaScript Object, such as the results of parsing JSON data. + * This value is set when a new animation is loaded into this component, but can also be modified + * at run-time, assuming the animation is currently delayed. * - * @name Phaser.Loader.File#url - * @type {object|string} - * @since 3.0.0 + * @name Phaser.Animations.AnimationState#showOnStart + * @type {boolean} + * @since 3.50.0 */ - this.url = url; + this.showOnStart = false; /** - * The final URL this file will load from, including baseURL and path. - * Set automatically when the Loader calls 'load' on this file. + * Should the GameObject's `visible` property be set to `false` when the animation completes? * - * @name Phaser.Loader.File#src - * @type {string} - * @since 3.0.0 + * This value is set when a new animation is loaded into this component, but can also be modified + * at run-time, assuming the animation is still actively playing. + * + * @name Phaser.Animations.AnimationState#hideOnComplete + * @type {boolean} + * @since 3.50.0 */ - this.src = ''; + this.hideOnComplete = false; /** - * The merged XHRSettings for this file. + * Is the playhead moving forwards (`true`) or in reverse (`false`) ? * - * @name Phaser.Loader.File#xhrSettings - * @type {Phaser.Types.Loader.XHRSettingsObject} + * @name Phaser.Animations.AnimationState#forward + * @type {boolean} + * @default true * @since 3.0.0 */ - this.xhrSettings = XHRSettings(GetFastValue(fileConfig, 'responseType', undefined)); - - if (GetFastValue(fileConfig, 'xhrSettings', false)) - { - this.xhrSettings = MergeXHRSettings(this.xhrSettings, GetFastValue(fileConfig, 'xhrSettings', {})); - } + this.forward = true; /** - * The XMLHttpRequest instance (as created by XHR Loader) that is loading this File. + * An internal trigger that tells the component if it should plays the animation + * in reverse mode ('true') or not ('false'). This is used because `forward` can + * be changed by the `yoyo` feature. * - * @name Phaser.Loader.File#xhrLoader - * @type {?XMLHttpRequest} - * @since 3.0.0 + * Prior to Phaser 3.50 this property was private and called `_reverse`. + * + * @name Phaser.Animations.AnimationState#inReverse + * @type {boolean} + * @default false + * @since 3.50.0 */ - this.xhrLoader = null; + this.inReverse = false; /** - * The current state of the file. One of the FILE_CONST values. + * Internal time overflow accumulator. * - * @name Phaser.Loader.File#state + * This has the `delta` time added to it as part of the `update` step. + * + * @name Phaser.Animations.AnimationState#accumulator * @type {number} + * @default 0 * @since 3.0.0 */ - this.state = (typeof(this.url) === 'function') ? CONST.FILE_POPULATED : CONST.FILE_PENDING; + this.accumulator = 0; /** - * The total size of this file. - * Set by onProgress and only if loading via XHR. + * The time point at which the next animation frame will change. * - * @name Phaser.Loader.File#bytesTotal + * This value is compared against the `accumulator` as part of the `update` step. + * + * @name Phaser.Animations.AnimationState#nextTick * @type {number} * @default 0 * @since 3.0.0 */ - this.bytesTotal = 0; + this.nextTick = 0; /** - * Updated as the file loads. - * Only set if loading via XHR. + * A counter keeping track of how much delay time, in milliseconds, is left before playback begins. * - * @name Phaser.Loader.File#bytesLoaded + * This is set via the `playAfterDelay` method, although it can be modified at run-time + * if required, as long as the animation has not already started playing. + * + * @name Phaser.Animations.AnimationState#delayCounter * @type {number} - * @default -1 - * @since 3.0.0 + * @default 0 + * @since 3.50.0 */ - this.bytesLoaded = -1; + this.delayCounter = 0; /** - * A percentage value between 0 and 1 indicating how much of this file has loaded. - * Only set if loading via XHR. + * A counter that keeps track of how many repeats are left to run. * - * @name Phaser.Loader.File#percentComplete + * This value is set when a new animation is loaded into this component, but can also be modified + * at run-time. + * + * @name Phaser.Animations.AnimationState#repeatCounter * @type {number} - * @default -1 + * @default 0 * @since 3.0.0 */ - this.percentComplete = -1; + this.repeatCounter = 0; /** - * For CORs based loading. - * If this is undefined then the File will check BaseLoader.crossOrigin and use that (if set) + * An internal flag keeping track of pending repeats. * - * @name Phaser.Loader.File#crossOrigin - * @type {(string|undefined)} + * @name Phaser.Animations.AnimationState#pendingRepeat + * @type {boolean} + * @default false * @since 3.0.0 */ - this.crossOrigin = undefined; + this.pendingRepeat = false; /** - * The processed file data, stored here after the file has loaded. + * Is the Animation paused? * - * @name Phaser.Loader.File#data - * @type {*} + * @name Phaser.Animations.AnimationState#_paused + * @type {boolean} + * @private + * @default false * @since 3.0.0 */ - this.data = undefined; + this._paused = false; /** - * A config object that can be used by file types to store transitional data. + * Was the animation previously playing before being paused? * - * @name Phaser.Loader.File#config - * @type {*} + * @name Phaser.Animations.AnimationState#_wasPlaying + * @type {boolean} + * @private + * @default false * @since 3.0.0 */ - this.config = GetFastValue(fileConfig, 'config', {}); + this._wasPlaying = false; /** - * If this is a multipart file, i.e. an atlas and its json together, then this is a reference - * to the parent MultiFile. Set and used internally by the Loader or specific file types. + * Internal property tracking if this Animation is waiting to stop. * - * @name Phaser.Loader.File#multiFile - * @type {?Phaser.Loader.MultiFile} - * @since 3.7.0 + * 0 = No + * 1 = Waiting for ms to pass + * 2 = Waiting for repeat + * 3 = Waiting for specific frame + * + * @name Phaser.Animations.AnimationState#_pendingStop + * @type {number} + * @private + * @since 3.4.0 */ - this.multiFile; + this._pendingStop = 0; /** - * Does this file have an associated linked file? Such as an image and a normal map. - * Atlases and Bitmap Fonts use the multiFile, because those files need loading together but aren't - * actually bound by data, where-as a linkFile is. + * Internal property used by _pendingStop. * - * @name Phaser.Loader.File#linkFile - * @type {?Phaser.Loader.File} - * @since 3.7.0 + * @name Phaser.Animations.AnimationState#_pendingStopValue + * @type {any} + * @private + * @since 3.4.0 */ - this.linkFile; + this._pendingStopValue; }, /** - * Links this File with another, so they depend upon each other for loading and processing. + * Sets an animation, or an array of animations, to be played in the future, after the current one completes or stops. * - * @method Phaser.Loader.File#setLink - * @since 3.7.0 + * The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, + * or have one of the `stop` methods called. * - * @param {Phaser.Loader.File} fileB - The file to link to this one. - */ - setLink: function (fileB) - { - this.linkFile = fileB; - - fileB.linkFile = this; - }, - - /** - * Resets the XHRLoader instance this file is using. + * An animation set to repeat forever will never enter a completed state unless stopped. * - * @method Phaser.Loader.File#resetXHR - * @since 3.0.0 + * You can chain a new animation at any point, including before the current one starts playing, during it, or when it ends (via its `animationcomplete` event). + * + * Chained animations are specific to a Game Object, meaning different Game Objects can have different chained animations without impacting the global animation they're playing. + * + * Call this method with no arguments to reset all currently chained animations. + * + * @method Phaser.Animations.AnimationState#chain + * @since 3.16.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig|string[]|Phaser.Animations.Animation[]|Phaser.Types.Animations.PlayAnimationConfig[])} [key] - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object, or an array of them. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - resetXHR: function () + chain: function (key) { - if (this.xhrLoader) + var parent = this.parent; + + if (key === undefined) { - this.xhrLoader.onload = undefined; - this.xhrLoader.onerror = undefined; - this.xhrLoader.onprogress = undefined; + this.nextAnimsQueue.length = 0; + this.nextAnim = null; + + return parent; } - }, - /** - * Called by the Loader, starts the actual file downloading. - * During the load the methods onLoad, onError and onProgress are called, based on the XHR events. - * You shouldn't normally call this method directly, it's meant to be invoked by the Loader. - * - * @method Phaser.Loader.File#load - * @since 3.0.0 - */ - load: function () - { - if (this.state === CONST.FILE_POPULATED) + if (!Array.isArray(key)) { - // Can happen for example in a JSONFile if they've provided a JSON object instead of a URL - this.loader.nextFile(this, true); + key = [ key ]; } - else - { - this.state = CONST.FILE_LOADING; - this.src = GetURL(this, this.loader.baseURL); + for (var i = 0; i < key.length; i++) + { + var anim = key[i]; - if (this.src.indexOf('data:') === 0) + if (!this.nextAnim) { - console.warn('Local data URIs are not supported: ' + this.key); + this.nextAnim = anim; } else { - // The creation of this XHRLoader starts the load process going. - // It will automatically call the following, based on the load outcome: - // - // xhr.onload = this.onLoad - // xhr.onerror = this.onError - // xhr.onprogress = this.onProgress - - this.xhrLoader = XHRLoader(this, this.loader.xhr); + this.nextAnimsQueue.push(anim); } } + + return this.parent; }, /** - * Called when the file finishes loading, is sent a DOM ProgressEvent. + * Returns the key of the animation currently loaded into this component. * - * @method Phaser.Loader.File#onLoad - * @since 3.0.0 + * Prior to Phaser 3.50 this method was called `getCurrentKey`. * - * @param {XMLHttpRequest} xhr - The XMLHttpRequest that caused this onload event. - * @param {ProgressEvent} event - The DOM ProgressEvent that resulted from this load. + * @method Phaser.Animations.AnimationState#getName + * @since 3.50.0 + * + * @return {string} The key of the Animation currently loaded into this component, or an empty string if none loaded. */ - onLoad: function (xhr, event) + getName: function () { - // On iOS, Capacitor often runs on a capacitor:// protocol, meaning local files are served from capacitor:// rather than file:// - // See: https://github.com/photonstorm/phaser/issues/5685 - - var isLocalFile = xhr.responseURL && (xhr.responseURL.indexOf('file://') === 0 || xhr.responseURL.indexOf('capacitor://') === 0); - - var localFileOk = (isLocalFile && event.target.status === 0); - - var success = !(event.target && event.target.status !== 200) || localFileOk; - - // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called. - if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) - { - success = false; - } - - this.state = CONST.FILE_LOADED; - - this.resetXHR(); - - this.loader.nextFile(this, success); + return (this.currentAnim) ? this.currentAnim.key : ''; }, /** - * Called if the file errors while loading, is sent a DOM ProgressEvent. + * Returns the key of the animation frame currently displayed by this component. * - * @method Phaser.Loader.File#onError - * @since 3.0.0 + * @method Phaser.Animations.AnimationState#getFrameName + * @since 3.50.0 * - * @param {XMLHttpRequest} xhr - The XMLHttpRequest that caused this onload event. - * @param {ProgressEvent} event - The DOM ProgressEvent that resulted from this error. + * @return {string} The key of the Animation Frame currently displayed by this component, or an empty string if no animation has been loaded. */ - onError: function () + getFrameName: function () { - this.resetXHR(); - - this.loader.nextFile(this, false); + return (this.currentFrame) ? this.currentFrame.textureFrame : ''; }, /** - * Called during the file load progress. Is sent a DOM ProgressEvent. + * Internal method used to load an animation into this component. * - * @method Phaser.Loader.File#onProgress - * @fires Phaser.Loader.Events#FILE_PROGRESS + * @method Phaser.Animations.AnimationState#load + * @protected * @since 3.0.0 * - * @param {ProgressEvent} event - The DOM ProgressEvent. + * @param {(string|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or a `PlayAnimationConfig` object. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - onProgress: function (event) + load: function (key) { - if (event.lengthComputable) + if (this.isPlaying) { - this.bytesLoaded = event.loaded; - this.bytesTotal = event.total; + this.stop(); + } - this.percentComplete = Math.min((this.bytesLoaded / this.bytesTotal), 1); + var manager = this.animationManager; + var animKey = (typeof key === 'string') ? key : GetFastValue(key, 'key', null); - this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete); + // Get the animation, first from the local map and, if not found, from the Animation Manager + var anim = (this.exists(animKey)) ? this.get(animKey) : manager.get(animKey); + + if (!anim) + { + console.warn('Missing animation: ' + animKey); } - }, + else + { + this.currentAnim = anim; - /** - * Usually overridden by the FileTypes and is called by Loader.nextFile. - * This method controls what extra work this File does with its loaded data, for example a JSON file will parse itself during this stage. - * - * @method Phaser.Loader.File#onProcess - * @since 3.0.0 - */ - onProcess: function () - { - this.state = CONST.FILE_PROCESSING; + // And now override the animation values, if set in the config. - this.onProcessComplete(); - }, + var totalFrames = anim.getTotalFrames(); + var frameRate = GetFastValue(key, 'frameRate', anim.frameRate); + var duration = GetFastValue(key, 'duration', anim.duration); - /** - * Called when the File has completed processing. - * Checks on the state of its multifile, if set. - * - * @method Phaser.Loader.File#onProcessComplete - * @since 3.7.0 - */ - onProcessComplete: function () - { - this.state = CONST.FILE_COMPLETE; + anim.calculateDuration(this, totalFrames, duration, frameRate); - if (this.multiFile) - { - this.multiFile.onFileComplete(this); + this.delay = GetFastValue(key, 'delay', anim.delay); + this.repeat = GetFastValue(key, 'repeat', anim.repeat); + this.repeatDelay = GetFastValue(key, 'repeatDelay', anim.repeatDelay); + this.yoyo = GetFastValue(key, 'yoyo', anim.yoyo); + this.showBeforeDelay = GetFastValue(key, 'showBeforeDelay', anim.showBeforeDelay); + this.showOnStart = GetFastValue(key, 'showOnStart', anim.showOnStart); + this.hideOnComplete = GetFastValue(key, 'hideOnComplete', anim.hideOnComplete); + this.skipMissedFrames = GetFastValue(key, 'skipMissedFrames', anim.skipMissedFrames); + + this.timeScale = GetFastValue(key, 'timeScale', this.timeScale); + + var startFrame = GetFastValue(key, 'startFrame', 0); + + if (startFrame > anim.getTotalFrames()) + { + startFrame = 0; + } + + var frame = anim.frames[startFrame]; + + if (startFrame === 0 && !this.forward) + { + frame = anim.getLastFrame(); + } + + this.currentFrame = frame; } - this.loader.fileProcessComplete(this); + return this.parent; }, /** - * Called when the File has completed processing but it generated an error. - * Checks on the state of its multifile, if set. + * Pause the current animation and set the `isPlaying` property to `false`. + * You can optionally pause it at a specific frame. * - * @method Phaser.Loader.File#onProcessError - * @since 3.7.0 + * @method Phaser.Animations.AnimationState#pause + * @since 3.0.0 + * + * @param {Phaser.Animations.AnimationFrame} [atFrame] - An optional frame to set after pausing the animation. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - onProcessError: function () + pause: function (atFrame) { - this.state = CONST.FILE_ERRORED; + if (!this._paused) + { + this._paused = true; + this._wasPlaying = this.isPlaying; + this.isPlaying = false; + } - if (this.multiFile) + if (atFrame !== undefined) { - this.multiFile.onFileFailed(this); + this.setCurrentFrame(atFrame); } - this.loader.fileProcessComplete(this); + return this.parent; }, /** - * Checks if a key matching the one used by this file exists in the target Cache or not. - * This is called automatically by the LoaderPlugin to decide if the file can be safely - * loaded or will conflict. + * Resumes playback of a paused animation and sets the `isPlaying` property to `true`. + * You can optionally tell it to start playback from a specific frame. * - * @method Phaser.Loader.File#hasCacheConflict - * @since 3.7.0 + * @method Phaser.Animations.AnimationState#resume + * @since 3.0.0 * - * @return {boolean} `true` if adding this file will cause a conflict, otherwise `false`. - */ - hasCacheConflict: function () - { - return (this.cache && this.cache.exists(this.key)); - }, - - /** - * Adds this file to its target cache upon successful loading and processing. - * This method is often overridden by specific file types. + * @param {Phaser.Animations.AnimationFrame} [fromFrame] - An optional frame to set before restarting playback. * - * @method Phaser.Loader.File#addToCache - * @since 3.7.0 + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - addToCache: function () + resume: function (fromFrame) { - if (this.cache) + if (this._paused) { - this.cache.add(this.key, this.data); + this._paused = false; + this.isPlaying = this._wasPlaying; + } + + if (fromFrame !== undefined) + { + this.setCurrentFrame(fromFrame); } - this.pendingDestroy(); + return this.parent; }, /** - * Called once the file has been added to its cache and is now ready for deletion from the Loader. - * It will emit a `filecomplete` event from the LoaderPlugin. + * Waits for the specified delay, in milliseconds, then starts playback of the given animation. * - * @method Phaser.Loader.File#pendingDestroy - * @fires Phaser.Loader.Events#FILE_COMPLETE - * @fires Phaser.Loader.Events#FILE_KEY_COMPLETE - * @since 3.7.0 + * If the animation _also_ has a delay value set in its config, it will be **added** to the delay given here. + * + * If an animation is already running and a new animation is given to this method, it will wait for + * the given delay before starting the new animation. + * + * If no animation is currently running, the given one begins after the delay. + * + * Prior to Phaser 3.50 this method was called 'delayedPlay' and the parameters were in the reverse order. + * + * @method Phaser.Animations.AnimationState#playAfterDelay + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {number} delay - The delay, in milliseconds, to wait before starting the animation playing. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - pendingDestroy: function (data) + playAfterDelay: function (key, delay) { - if (data === undefined) { data = this.data; } + if (!this.isPlaying) + { + this.delayCounter = delay; - var key = this.key; - var type = this.type; + this.play(key, true); + } + else + { + // If we've got a nextAnim, move it to the queue + var nextAnim = this.nextAnim; + var queue = this.nextAnimsQueue; - this.loader.emit(Events.FILE_COMPLETE, key, type, data); - this.loader.emit(Events.FILE_KEY_COMPLETE + type + '-' + key, key, type, data); + if (nextAnim) + { + queue.unshift(nextAnim); + } - this.loader.flagForRemoval(this); + this.nextAnim = key; + + this._pendingStop = 1; + this._pendingStopValue = delay; + } + + return this.parent; }, /** - * Destroy this File and any references it holds. + * Waits for the current animation to complete the `repeatCount` number of repeat cycles, then starts playback + * of the given animation. * - * @method Phaser.Loader.File#destroy - * @since 3.7.0 + * You can use this to ensure there are no harsh jumps between two sets of animations, i.e. going from an + * idle animation to a walking animation, by making them blend smoothly into each other. + * + * If no animation is currently running, the given one will start immediately. + * + * @method Phaser.Animations.AnimationState#playAfterRepeat + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {number} [repeatCount=1] - How many times should the animation repeat before the next one starts? + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - destroy: function () - { - this.loader = null; - this.cache = null; - this.xhrSettings = null; - this.multiFile = null; - this.linkFile = null; - this.data = null; - } - -}); - -/** - * Static method for creating object URL using URL API and setting it as image 'src' attribute. - * If URL API is not supported (usually on old browsers) it falls back to creating Base64 encoded url using FileReader. - * - * @method Phaser.Loader.File.createObjectURL - * @static - * @since 3.7.0 - * - * @param {HTMLImageElement} image - Image object which 'src' attribute should be set to object URL. - * @param {Blob} blob - A Blob object to create an object URL for. - * @param {string} defaultType - Default mime type used if blob type is not available. - */ -File.createObjectURL = function (image, blob, defaultType) -{ - if (typeof URL === 'function') - { - image.src = URL.createObjectURL(blob); - } - else + playAfterRepeat: function (key, repeatCount) { - var reader = new FileReader(); + if (repeatCount === undefined) { repeatCount = 1; } - reader.onload = function () + if (!this.isPlaying) { - image.removeAttribute('crossOrigin'); - image.src = 'data:' + (blob.type || defaultType) + ';base64,' + reader.result.split(',')[1]; - }; - - reader.onerror = image.onerror; - - reader.readAsDataURL(blob); - } -}; - -/** - * Static method for releasing an existing object URL which was previously created - * by calling {@link File#createObjectURL} method. - * - * @method Phaser.Loader.File.revokeObjectURL - * @static - * @since 3.7.0 - * - * @param {HTMLImageElement} image - Image object which 'src' attribute should be revoked. - */ -File.revokeObjectURL = function (image) -{ - if (typeof URL === 'function') - { - URL.revokeObjectURL(image.src); - } -}; - -module.exports = File; - - -/***/ }), -/* 24 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -// Contains the plugins that Phaser uses globally and locally. -// These are the source objects, not instantiated. -var corePlugins = {}; - -// Contains the plugins that the dev has loaded into their game -// These are the source objects, not instantiated. -var customPlugins = {}; - -var PluginCache = {}; - -/** - * @namespace Phaser.Plugins.PluginCache - */ - -/** - * Static method called directly by the Core internal Plugins. - * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) - * Plugin is the object to instantiate to create the plugin - * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input) - * - * @method Phaser.Plugins.PluginCache.register - * @since 3.8.0 - * - * @param {string} key - A reference used to get this plugin from the plugin cache. - * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. - * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used. - * @param {boolean} [custom=false] - Core Scene plugin or a Custom Scene plugin? - */ -PluginCache.register = function (key, plugin, mapping, custom) -{ - if (custom === undefined) { custom = false; } - - corePlugins[key] = { plugin: plugin, mapping: mapping, custom: custom }; -}; - -/** - * Stores a custom plugin in the global plugin cache. - * The key must be unique, within the scope of the cache. - * - * @method Phaser.Plugins.PluginCache.registerCustom - * @since 3.8.0 - * - * @param {string} key - A reference used to get this plugin from the plugin cache. - * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. - * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used. - * @param {?any} data - A value to be passed to the plugin's `init` method. - */ -PluginCache.registerCustom = function (key, plugin, mapping, data) -{ - customPlugins[key] = { plugin: plugin, mapping: mapping, data: data }; -}; + this.play(key); + } + else + { + // If we've got a nextAnim, move it to the queue + var nextAnim = this.nextAnim; + var queue = this.nextAnimsQueue; -/** - * Checks if the given key is already being used in the core plugin cache. - * - * @method Phaser.Plugins.PluginCache.hasCore - * @since 3.8.0 - * - * @param {string} key - The key to check for. - * - * @return {boolean} `true` if the key is already in use in the core cache, otherwise `false`. - */ -PluginCache.hasCore = function (key) -{ - return corePlugins.hasOwnProperty(key); -}; + if (nextAnim) + { + queue.unshift(nextAnim); + } -/** - * Checks if the given key is already being used in the custom plugin cache. - * - * @method Phaser.Plugins.PluginCache.hasCustom - * @since 3.8.0 - * - * @param {string} key - The key to check for. - * - * @return {boolean} `true` if the key is already in use in the custom cache, otherwise `false`. - */ -PluginCache.hasCustom = function (key) -{ - return customPlugins.hasOwnProperty(key); -}; + if (this.repeatCounter !== -1 && repeatCount > this.repeatCounter) + { + repeatCount = this.repeatCounter; + } -/** - * Returns the core plugin object from the cache based on the given key. - * - * @method Phaser.Plugins.PluginCache.getCore - * @since 3.8.0 - * - * @param {string} key - The key of the core plugin to get. - * - * @return {Phaser.Types.Plugins.CorePluginContainer} The core plugin object. - */ -PluginCache.getCore = function (key) -{ - return corePlugins[key]; -}; + this.nextAnim = key; -/** - * Returns the custom plugin object from the cache based on the given key. - * - * @method Phaser.Plugins.PluginCache.getCustom - * @since 3.8.0 - * - * @param {string} key - The key of the custom plugin to get. - * - * @return {Phaser.Types.Plugins.CustomPluginContainer} The custom plugin object. - */ -PluginCache.getCustom = function (key) -{ - return customPlugins[key]; -}; + this._pendingStop = 2; + this._pendingStopValue = repeatCount; + } -/** - * Returns an object from the custom cache based on the given key that can be instantiated. - * - * @method Phaser.Plugins.PluginCache.getCustomClass - * @since 3.8.0 - * - * @param {string} key - The key of the custom plugin to get. - * - * @return {function} The custom plugin object. - */ -PluginCache.getCustomClass = function (key) -{ - return (customPlugins.hasOwnProperty(key)) ? customPlugins[key].plugin : null; -}; + return this.parent; + }, -/** - * Removes a core plugin based on the given key. - * - * @method Phaser.Plugins.PluginCache.remove - * @since 3.8.0 - * - * @param {string} key - The key of the core plugin to remove. - */ -PluginCache.remove = function (key) -{ - if (corePlugins.hasOwnProperty(key)) + /** + * Start playing the given animation on this Sprite. + * + * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. + * + * The benefit of a global animation is that multiple Sprites can all play the same animation, without + * having to duplicate the data. You can just create it once and then play it on any Sprite. + * + * The following code shows how to create a global repeating animation. The animation will be created + * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': + * + * ```javascript + * var config = { + * key: 'run', + * frames: 'muybridge', + * frameRate: 15, + * repeat: -1 + * }; + * + * // This code should be run from within a Scene: + * this.anims.create(config); + * ``` + * + * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, + * you can call the `Animation.create` method instead. It accepts the exact same parameters as when + * creating a global animation, however the resulting data is kept locally in this Sprite. + * + * With the animation created, either globally or locally, you can now play it on this Sprite: + * + * ```javascript + * this.add.sprite(x, y).play('run'); + * ``` + * + * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config + * object instead: + * + * ```javascript + * this.add.sprite(x, y).play({ key: 'run', frameRate: 24 }); + * ``` + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * If you need a Sprite to be able to play both local and global animations, make sure they don't + * have conflicting keys. + * + * See the documentation for the `PlayAnimationConfig` config object for more details about this. + * + * Also, see the documentation in the Animation Manager for further details on creating animations. + * + * @method Phaser.Animations.AnimationState#play + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.0.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {boolean} [ignoreIfPlaying=false] - If this animation is already playing then ignore this call. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + */ + play: function (key, ignoreIfPlaying) { - delete corePlugins[key]; - } -}; + if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } -/** - * Removes a custom plugin based on the given key. - * - * @method Phaser.Plugins.PluginCache.removeCustom - * @since 3.8.0 - * - * @param {string} key - The key of the custom plugin to remove. - */ -PluginCache.removeCustom = function (key) -{ - if (customPlugins.hasOwnProperty(key)) - { - delete customPlugins[key]; - } -}; + var currentAnim = this.currentAnim; + var parent = this.parent; -/** - * Removes all Core Plugins. - * - * This includes all of the internal system plugins that Phaser needs, like the Input Plugin and Loader Plugin. - * So be sure you only call this if you do not wish to run Phaser again. - * - * @method Phaser.Plugins.PluginCache.destroyCorePlugins - * @since 3.12.0 - */ -PluginCache.destroyCorePlugins = function () -{ - for (var key in corePlugins) - { - if (corePlugins.hasOwnProperty(key)) - { - delete corePlugins[key]; - } - } -}; + // Must be either an Animation instance, or a PlayAnimationConfig object + var animKey = (typeof key === 'string') ? key : key.key; -/** - * Removes all Custom Plugins. - * - * @method Phaser.Plugins.PluginCache.destroyCustomPlugins - * @since 3.12.0 - */ -PluginCache.destroyCustomPlugins = function () -{ - for (var key in customPlugins) - { - if (customPlugins.hasOwnProperty(key)) + if (ignoreIfPlaying && this.isPlaying && currentAnim.key === animKey) { - delete customPlugins[key]; + return parent; } - } -}; - -module.exports = PluginCache; - - -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ -var Class = __webpack_require__(0); -var MATH_CONST = __webpack_require__(14); -var Vector2 = __webpack_require__(3); - -/** - * @classdesc - * A Matrix used for display transformations for rendering. - * - * It is represented like so: - * - * ``` - * | a | c | tx | - * | b | d | ty | - * | 0 | 0 | 1 | - * ``` - * - * @class TransformMatrix - * @memberof Phaser.GameObjects.Components - * @constructor - * @since 3.0.0 - * - * @param {number} [a=1] - The Scale X value. - * @param {number} [b=0] - The Skew Y value. - * @param {number} [c=0] - The Skew X value. - * @param {number} [d=1] - The Scale Y value. - * @param {number} [tx=0] - The Translate X value. - * @param {number} [ty=0] - The Translate Y value. - */ -var TransformMatrix = new Class({ + // Are we mixing? + if (currentAnim && this.isPlaying) + { + var mix = this.animationManager.getMix(currentAnim.key, key); - initialize: + if (mix > 0) + { + return this.playAfterDelay(key, mix); + } + } - function TransformMatrix (a, b, c, d, tx, ty) - { - if (a === undefined) { a = 1; } - if (b === undefined) { b = 0; } - if (c === undefined) { c = 0; } - if (d === undefined) { d = 1; } - if (tx === undefined) { tx = 0; } - if (ty === undefined) { ty = 0; } + this.forward = true; + this.inReverse = false; - /** - * The matrix values. - * - * @name Phaser.GameObjects.Components.TransformMatrix#matrix - * @type {Float32Array} - * @since 3.0.0 - */ - this.matrix = new Float32Array([ a, b, c, d, tx, ty, 0, 0, 1 ]); + this._paused = false; + this._wasPlaying = true; - /** - * The decomposed matrix. - * - * @name Phaser.GameObjects.Components.TransformMatrix#decomposedMatrix - * @type {object} - * @since 3.0.0 - */ - this.decomposedMatrix = { - translateX: 0, - translateY: 0, - scaleX: 1, - scaleY: 1, - rotation: 0 - }; + return this.startAnimation(key); }, /** - * The Scale X value. + * Start playing the given animation on this Sprite, in reverse. * - * @name Phaser.GameObjects.Components.TransformMatrix#a - * @type {number} - * @since 3.4.0 + * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. + * + * The benefit of a global animation is that multiple Sprites can all play the same animation, without + * having to duplicate the data. You can just create it once and then play it on any Sprite. + * + * The following code shows how to create a global repeating animation. The animation will be created + * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': + * + * ```javascript + * var config = { + * key: 'run', + * frames: 'muybridge', + * frameRate: 15, + * repeat: -1 + * }; + * + * // This code should be run from within a Scene: + * this.anims.create(config); + * ``` + * + * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, + * you can call the `Animation.create` method instead. It accepts the exact same parameters as when + * creating a global animation, however the resulting data is kept locally in this Sprite. + * + * With the animation created, either globally or locally, you can now play it on this Sprite: + * + * ```javascript + * this.add.sprite(x, y).playReverse('run'); + * ``` + * + * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config + * object instead: + * + * ```javascript + * this.add.sprite(x, y).playReverse({ key: 'run', frameRate: 24 }); + * ``` + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * If you need a Sprite to be able to play both local and global animations, make sure they don't + * have conflicting keys. + * + * See the documentation for the `PlayAnimationConfig` config object for more details about this. + * + * Also, see the documentation in the Animation Manager for further details on creating animations. + * + * @method Phaser.Animations.AnimationState#playReverse + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.12.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - a: { + playReverse: function (key, ignoreIfPlaying) + { + if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } - get: function () - { - return this.matrix[0]; - }, + // Must be either an Animation instance, or a PlayAnimationConfig object + var animKey = (typeof key === 'string') ? key : key.key; - set: function (value) + if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === animKey) { - this.matrix[0] = value; + return this.parent; } - }, - - /** - * The Skew Y value. - * - * @name Phaser.GameObjects.Components.TransformMatrix#b - * @type {number} - * @since 3.4.0 - */ - b: { - - get: function () - { - return this.matrix[1]; - }, + this.forward = false; + this.inReverse = true; - set: function (value) - { - this.matrix[1] = value; - } + this._paused = false; + this._wasPlaying = true; + return this.startAnimation(key); }, /** - * The Skew X value. + * Load the animation based on the key and set-up all of the internal values + * needed for playback to start. If there is no delay, it will also fire the start events. * - * @name Phaser.GameObjects.Components.TransformMatrix#c - * @type {number} - * @since 3.4.0 + * @method Phaser.Animations.AnimationState#startAnimation + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.50.0 + * + * @param {(string|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or a `PlayAnimationConfig` object. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - c: { + startAnimation: function (key) + { + this.load(key); - get: function () - { - return this.matrix[2]; - }, + var anim = this.currentAnim; + var gameObject = this.parent; - set: function (value) + if (!anim) { - this.matrix[2] = value; + return gameObject; } - }, - - /** - * The Scale Y value. - * - * @name Phaser.GameObjects.Components.TransformMatrix#d - * @type {number} - * @since 3.4.0 - */ - d: { + // Should give us 9,007,199,254,740,991 safe repeats + this.repeatCounter = (this.repeat === -1) ? Number.MAX_VALUE : this.repeat; - get: function () - { - return this.matrix[3]; - }, + anim.getFirstTick(this); - set: function (value) - { - this.matrix[3] = value; - } + this.isPlaying = true; + this.pendingRepeat = false; + this.hasStarted = false; - }, + this._pendingStop = 0; + this._pendingStopValue = 0; + this._paused = false; - /** - * The Translate X value. - * - * @name Phaser.GameObjects.Components.TransformMatrix#e - * @type {number} - * @since 3.11.0 - */ - e: { + // Add any delay the animation itself may have had as well + this.delayCounter += this.delay; - get: function () + if (this.delayCounter === 0) { - return this.matrix[4]; - }, - - set: function (value) + this.handleStart(); + } + else if (this.showBeforeDelay) { - this.matrix[4] = value; + // We have a delay, but still need to set the frame + this.setCurrentFrame(this.currentFrame); } + return gameObject; }, /** - * The Translate Y value. + * Handles the start of an animation playback. * - * @name Phaser.GameObjects.Components.TransformMatrix#f - * @type {number} - * @since 3.11.0 + * @method Phaser.Animations.AnimationState#handleStart + * @private + * @since 3.50.0 */ - f: { - - get: function () - { - return this.matrix[5]; - }, - - set: function (value) + handleStart: function () + { + if (this.showOnStart) { - this.matrix[5] = value; + this.parent.setVisible(true); } + this.setCurrentFrame(this.currentFrame); + + this.hasStarted = true; + + this.emitEvents(Events.ANIMATION_START); }, /** - * The Translate X value. + * Handles the repeat of an animation. * - * @name Phaser.GameObjects.Components.TransformMatrix#tx - * @type {number} - * @since 3.4.0 + * @method Phaser.Animations.AnimationState#handleRepeat + * @private + * @since 3.50.0 */ - tx: { - - get: function () - { - return this.matrix[4]; - }, - - set: function (value) - { - this.matrix[4] = value; - } + handleRepeat: function () + { + this.pendingRepeat = false; + this.emitEvents(Events.ANIMATION_REPEAT); }, /** - * The Translate Y value. + * Handles the stop of an animation playback. * - * @name Phaser.GameObjects.Components.TransformMatrix#ty - * @type {number} - * @since 3.4.0 + * @method Phaser.Animations.AnimationState#handleStop + * @private + * @since 3.50.0 */ - ty: { - - get: function () - { - return this.matrix[5]; - }, + handleStop: function () + { + this._pendingStop = 0; - set: function (value) - { - this.matrix[5] = value; - } + this.isPlaying = false; + this.emitEvents(Events.ANIMATION_STOP); }, /** - * The rotation of the Matrix. Value is in radians. + * Handles the completion of an animation playback. * - * @name Phaser.GameObjects.Components.TransformMatrix#rotation - * @type {number} - * @readonly - * @since 3.4.0 + * @method Phaser.Animations.AnimationState#handleComplete + * @private + * @since 3.50.0 */ - rotation: { + handleComplete: function () + { + this._pendingStop = 0; - get: function () + this.isPlaying = false; + + if (this.hideOnComplete) { - return Math.acos(this.a / this.scaleX) * ((Math.atan(-this.c / this.a) < 0) ? -1 : 1); + this.parent.setVisible(false); } + this.emitEvents(Events.ANIMATION_COMPLETE, Events.ANIMATION_COMPLETE_KEY); }, /** - * The rotation of the Matrix, normalized to be within the Phaser right-handed - * clockwise rotation space. Value is in radians. + * Fires the given animation event. * - * @name Phaser.GameObjects.Components.TransformMatrix#rotationNormalized - * @type {number} - * @readonly - * @since 3.19.0 + * @method Phaser.Animations.AnimationState#emitEvents + * @private + * @since 3.50.0 + * + * @param {string} event - The Animation Event to dispatch. */ - rotationNormalized: { + emitEvents: function (event, keyEvent) + { + var anim = this.currentAnim; - get: function () + if (anim) { - var matrix = this.matrix; + var frame = this.currentFrame; - var a = matrix[0]; - var b = matrix[1]; - var c = matrix[2]; - var d = matrix[3]; + var gameObject = this.parent; - if (a || b) - { - // var r = Math.sqrt(a * a + b * b); + var frameKey = frame.textureFrame; - return (b > 0) ? Math.acos(a / this.scaleX) : -Math.acos(a / this.scaleX); - } - else if (c || d) - { - // var s = Math.sqrt(c * c + d * d); + gameObject.emit(event, anim, frame, gameObject, frameKey); - return MATH_CONST.TAU - ((d > 0) ? Math.acos(-c / this.scaleY) : -Math.acos(c / this.scaleY)); - } - else + if (keyEvent) { - return 0; + gameObject.emit(keyEvent + anim.key, anim, frame, gameObject, frameKey); } } - }, /** - * The decomposed horizontal scale of the Matrix. This value is always positive. + * Reverse the Animation that is already playing on the Game Object. * - * @name Phaser.GameObjects.Components.TransformMatrix#scaleX - * @type {number} - * @readonly - * @since 3.4.0 + * @method Phaser.Animations.AnimationState#reverse + * @since 3.12.0 + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - scaleX: { - - get: function () + reverse: function () + { + if (this.isPlaying) { - return Math.sqrt((this.a * this.a) + (this.b * this.b)); + this.inReverse = !this.inReverse; + + this.forward = !this.forward; } + return this.parent; }, /** - * The decomposed vertical scale of the Matrix. This value is always positive. + * Returns a value between 0 and 1 indicating how far this animation is through, ignoring repeats and yoyos. * - * @name Phaser.GameObjects.Components.TransformMatrix#scaleY - * @type {number} - * @readonly + * The value is based on the current frame and how far that is in the animation, it is not based on + * the duration of the animation. + * + * @method Phaser.Animations.AnimationState#getProgress * @since 3.4.0 + * + * @return {number} The progress of the current animation in frames, between 0 and 1. */ - scaleY: { + getProgress: function () + { + var frame = this.currentFrame; - get: function () + if (!frame) { - return Math.sqrt((this.c * this.c) + (this.d * this.d)); + return 0; + } + + var p = frame.progress; + + if (this.inReverse) + { + p *= -1; } + return p; }, /** - * Reset the Matrix to an identity matrix. + * Takes a value between 0 and 1 and uses it to set how far this animation is through playback. * - * @method Phaser.GameObjects.Components.TransformMatrix#loadIdentity - * @since 3.0.0 + * Does not factor in repeats or yoyos, but does handle playing forwards or backwards. * - * @return {this} This TransformMatrix. + * The value is based on the current frame and how far that is in the animation, it is not based on + * the duration of the animation. + * + * @method Phaser.Animations.AnimationState#setProgress + * @since 3.4.0 + * + * @param {number} [value=0] - The progress value, between 0 and 1. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - loadIdentity: function () + setProgress: function (value) { - var matrix = this.matrix; + if (!this.forward) + { + value = 1 - value; + } - matrix[0] = 1; - matrix[1] = 0; - matrix[2] = 0; - matrix[3] = 1; - matrix[4] = 0; - matrix[5] = 0; + this.setCurrentFrame(this.currentAnim.getFrameByProgress(value)); - return this; + return this.parent; }, /** - * Translate the Matrix. + * Sets the number of times that the animation should repeat after its first play through. + * For example, if repeat is 1, the animation will play a total of twice: the initial play plus 1 repeat. * - * @method Phaser.GameObjects.Components.TransformMatrix#translate - * @since 3.0.0 + * To repeat indefinitely, use -1. + * The value should always be an integer. * - * @param {number} x - The horizontal translation value. - * @param {number} y - The vertical translation value. + * Calling this method only works if the animation is already running. Otherwise, any + * value specified here will be overwritten when the next animation loads in. To avoid this, + * use the `repeat` property of the `PlayAnimationConfig` object instead. * - * @return {this} This TransformMatrix. + * @method Phaser.Animations.AnimationState#setRepeat + * @since 3.4.0 + * + * @param {number} value - The number of times that the animation should repeat. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - translate: function (x, y) + setRepeat: function (value) { - var matrix = this.matrix; - - matrix[4] = matrix[0] * x + matrix[2] * y + matrix[4]; - matrix[5] = matrix[1] * x + matrix[3] * y + matrix[5]; + this.repeatCounter = (value === -1) ? Number.MAX_VALUE : value; - return this; + return this.parent; }, /** - * Scale the Matrix. - * - * @method Phaser.GameObjects.Components.TransformMatrix#scale - * @since 3.0.0 + * Handle the removal of an animation from the Animation Manager. * - * @param {number} x - The horizontal scale value. - * @param {number} y - The vertical scale value. + * @method Phaser.Animations.AnimationState#globalRemove + * @since 3.50.0 * - * @return {this} This TransformMatrix. + * @param {string} [key] - The key of the removed Animation. + * @param {Phaser.Animations.Animation} [animation] - The removed Animation. */ - scale: function (x, y) + globalRemove: function (key, animation) { - var matrix = this.matrix; + if (animation === undefined) { animation = this.currentAnim; } - matrix[0] *= x; - matrix[1] *= x; - matrix[2] *= y; - matrix[3] *= y; + if (this.isPlaying && animation.key === this.currentAnim.key) + { + this.stop(); - return this; + this.setCurrentFrame(this.currentAnim.frames[0]); + } }, /** - * Rotate the Matrix. + * Restarts the current animation from its beginning. * - * @method Phaser.GameObjects.Components.TransformMatrix#rotate + * You can optionally reset the delay and repeat counters as well. + * + * Calling this will fire the `ANIMATION_RESTART` event immediately. + * + * If you `includeDelay` then it will also fire the `ANIMATION_START` event once + * the delay has expired, otherwise, playback will just begin immediately. + * + * @method Phaser.Animations.AnimationState#restart + * @fires Phaser.Animations.Events#ANIMATION_RESTART * @since 3.0.0 * - * @param {number} angle - The angle of rotation in radians. + * @param {boolean} [includeDelay=false] - Whether to include the delay value of the animation when restarting. + * @param {boolean} [resetRepeats=false] - Whether to reset the repeat counter or not? * - * @return {this} This TransformMatrix. + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - rotate: function (angle) + restart: function (includeDelay, resetRepeats) { - var sin = Math.sin(angle); - var cos = Math.cos(angle); + if (includeDelay === undefined) { includeDelay = false; } + if (resetRepeats === undefined) { resetRepeats = false; } - var matrix = this.matrix; + var anim = this.currentAnim; + var gameObject = this.parent; - var a = matrix[0]; - var b = matrix[1]; - var c = matrix[2]; - var d = matrix[3]; + if (!anim) + { + return gameObject; + } - matrix[0] = a * cos + c * sin; - matrix[1] = b * cos + d * sin; - matrix[2] = a * -sin + c * cos; - matrix[3] = b * -sin + d * cos; + if (resetRepeats) + { + this.repeatCounter = (this.repeat === -1) ? Number.MAX_VALUE : this.repeat; + } - return this; - }, + anim.getFirstTick(this); - /** - * Multiply this Matrix by the given Matrix. - * - * If an `out` Matrix is given then the results will be stored in it. - * If it is not given, this matrix will be updated in place instead. - * Use an `out` Matrix if you do not wish to mutate this matrix. - * - * @method Phaser.GameObjects.Components.TransformMatrix#multiply - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Components.TransformMatrix} rhs - The Matrix to multiply by. - * @param {Phaser.GameObjects.Components.TransformMatrix} [out] - An optional Matrix to store the results in. - * - * @return {(this|Phaser.GameObjects.Components.TransformMatrix)} Either this TransformMatrix, or the `out` Matrix, if given in the arguments. - */ - multiply: function (rhs, out) - { - var matrix = this.matrix; - var source = rhs.matrix; + this.emitEvents(Events.ANIMATION_RESTART); - var localA = matrix[0]; - var localB = matrix[1]; - var localC = matrix[2]; - var localD = matrix[3]; - var localE = matrix[4]; - var localF = matrix[5]; + this.isPlaying = true; + this.pendingRepeat = false; - var sourceA = source[0]; - var sourceB = source[1]; - var sourceC = source[2]; - var sourceD = source[3]; - var sourceE = source[4]; - var sourceF = source[5]; + // Set this to `true` if there is no delay to include, so it skips the `hasStarted` check in `update`. + this.hasStarted = !includeDelay; - var destinationMatrix = (out === undefined) ? this : out; + this._pendingStop = 0; + this._pendingStopValue = 0; + this._paused = false; - destinationMatrix.a = (sourceA * localA) + (sourceB * localC); - destinationMatrix.b = (sourceA * localB) + (sourceB * localD); - destinationMatrix.c = (sourceC * localA) + (sourceD * localC); - destinationMatrix.d = (sourceC * localB) + (sourceD * localD); - destinationMatrix.e = (sourceE * localA) + (sourceF * localC) + localE; - destinationMatrix.f = (sourceE * localB) + (sourceF * localD) + localF; + this.setCurrentFrame(anim.frames[0]); - return destinationMatrix; + return this.parent; }, /** - * Multiply this Matrix by the matrix given, including the offset. + * The current animation has completed. This dispatches the `ANIMATION_COMPLETE` event. * - * The offsetX is added to the tx value: `offsetX * a + offsetY * c + tx`. - * The offsetY is added to the ty value: `offsetY * b + offsetY * d + ty`. + * This method is called by the Animation instance and should not usually be invoked directly. * - * @method Phaser.GameObjects.Components.TransformMatrix#multiplyWithOffset - * @since 3.11.0 + * If no animation is loaded, no events will be dispatched. * - * @param {Phaser.GameObjects.Components.TransformMatrix} src - The source Matrix to copy from. - * @param {number} offsetX - Horizontal offset to factor in to the multiplication. - * @param {number} offsetY - Vertical offset to factor in to the multiplication. + * If another animation has been queued for playback, it will be started after the events fire. * - * @return {this} This TransformMatrix. + * @method Phaser.Animations.AnimationState#complete + * @fires Phaser.Animations.Events#ANIMATION_COMPLETE + * @since 3.50.0 + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - multiplyWithOffset: function (src, offsetX, offsetY) + complete: function () { - var matrix = this.matrix; - var otherMatrix = src.matrix; + this._pendingStop = 0; - var a0 = matrix[0]; - var b0 = matrix[1]; - var c0 = matrix[2]; - var d0 = matrix[3]; - var tx0 = matrix[4]; - var ty0 = matrix[5]; + this.isPlaying = false; - var pse = offsetX * a0 + offsetY * c0 + tx0; - var psf = offsetX * b0 + offsetY * d0 + ty0; + if (this.currentAnim) + { + this.handleComplete(); + } - var a1 = otherMatrix[0]; - var b1 = otherMatrix[1]; - var c1 = otherMatrix[2]; - var d1 = otherMatrix[3]; - var tx1 = otherMatrix[4]; - var ty1 = otherMatrix[5]; + if (this.nextAnim) + { + var key = this.nextAnim; - matrix[0] = a1 * a0 + b1 * c0; - matrix[1] = a1 * b0 + b1 * d0; - matrix[2] = c1 * a0 + d1 * c0; - matrix[3] = c1 * b0 + d1 * d0; - matrix[4] = tx1 * a0 + ty1 * c0 + pse; - matrix[5] = tx1 * b0 + ty1 * d0 + psf; + this.nextAnim = (this.nextAnimsQueue.length > 0) ? this.nextAnimsQueue.shift() : null; - return this; + this.play(key); + } + + return this.parent; }, /** - * Transform the Matrix. + * Immediately stops the current animation from playing and dispatches the `ANIMATION_STOP` event. * - * @method Phaser.GameObjects.Components.TransformMatrix#transform - * @since 3.0.0 + * If no animation is running, no events will be dispatched. * - * @param {number} a - The Scale X value. - * @param {number} b - The Shear Y value. - * @param {number} c - The Shear X value. - * @param {number} d - The Scale Y value. - * @param {number} tx - The Translate X value. - * @param {number} ty - The Translate Y value. + * If there is another animation in the queue (set via the `chain` method) then it will start playing. * - * @return {this} This TransformMatrix. + * @method Phaser.Animations.AnimationState#stop + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.0.0 + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - transform: function (a, b, c, d, tx, ty) + stop: function () { - var matrix = this.matrix; + this._pendingStop = 0; - var a0 = matrix[0]; - var b0 = matrix[1]; - var c0 = matrix[2]; - var d0 = matrix[3]; - var tx0 = matrix[4]; - var ty0 = matrix[5]; + this.isPlaying = false; - matrix[0] = a * a0 + b * c0; - matrix[1] = a * b0 + b * d0; - matrix[2] = c * a0 + d * c0; - matrix[3] = c * b0 + d * d0; - matrix[4] = tx * a0 + ty * c0 + tx0; - matrix[5] = tx * b0 + ty * d0 + ty0; + this.delayCounter = 0; - return this; + if (this.currentAnim) + { + this.handleStop(); + } + + if (this.nextAnim) + { + var key = this.nextAnim; + + this.nextAnim = this.nextAnimsQueue.shift(); + + this.play(key); + } + + return this.parent; }, /** - * Transform a point using this Matrix. + * Stops the current animation from playing after the specified time delay, given in milliseconds. * - * @method Phaser.GameObjects.Components.TransformMatrix#transformPoint - * @since 3.0.0 + * It then dispatches the `ANIMATION_STOP` event. * - * @param {number} x - The x coordinate of the point to transform. - * @param {number} y - The y coordinate of the point to transform. - * @param {(Phaser.Geom.Point|Phaser.Math.Vector2|object)} point - The Point object to store the transformed coordinates. + * If no animation is running, no events will be dispatched. + * + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. * - * @return {(Phaser.Geom.Point|Phaser.Math.Vector2|object)} The Point containing the transformed coordinates. + * @method Phaser.Animations.AnimationState#stopAfterDelay + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.4.0 + * + * @param {number} delay - The number of milliseconds to wait before stopping this animation. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - transformPoint: function (x, y, point) + stopAfterDelay: function (delay) { - if (point === undefined) { point = { x: 0, y: 0 }; } - - var matrix = this.matrix; - - var a = matrix[0]; - var b = matrix[1]; - var c = matrix[2]; - var d = matrix[3]; - var tx = matrix[4]; - var ty = matrix[5]; - - point.x = x * a + y * c + tx; - point.y = x * b + y * d + ty; + this._pendingStop = 1; + this._pendingStopValue = delay; - return point; + return this.parent; }, /** - * Invert the Matrix. + * Stops the current animation from playing when it next repeats. * - * @method Phaser.GameObjects.Components.TransformMatrix#invert - * @since 3.0.0 + * It then dispatches the `ANIMATION_STOP` event. * - * @return {this} This TransformMatrix. + * If no animation is running, no events will be dispatched. + * + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * Prior to Phaser 3.50 this method was called `stopOnRepeat` and had no parameters. + * + * @method Phaser.Animations.AnimationState#stopAfterRepeat + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.50.0 + * + * @param {number} [repeatCount=1] - How many times should the animation repeat before stopping? + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - invert: function () + stopAfterRepeat: function (repeatCount) { - var matrix = this.matrix; - - var a = matrix[0]; - var b = matrix[1]; - var c = matrix[2]; - var d = matrix[3]; - var tx = matrix[4]; - var ty = matrix[5]; + if (repeatCount === undefined) { repeatCount = 1; } - var n = a * d - b * c; + if (this.repeatCounter !== -1 && repeatCount > this.repeatCounter) + { + repeatCount = this.repeatCounter; + } - matrix[0] = d / n; - matrix[1] = -b / n; - matrix[2] = -c / n; - matrix[3] = a / n; - matrix[4] = (c * ty - d * tx) / n; - matrix[5] = -(a * ty - b * tx) / n; + this._pendingStop = 2; + this._pendingStopValue = repeatCount; - return this; + return this.parent; }, /** - * Set the values of this Matrix to copy those of the matrix given. + * Stops the current animation from playing when it next sets the given frame. + * If this frame doesn't exist within the animation it will not stop it from playing. * - * @method Phaser.GameObjects.Components.TransformMatrix#copyFrom - * @since 3.11.0 + * It then dispatches the `ANIMATION_STOP` event. * - * @param {Phaser.GameObjects.Components.TransformMatrix} src - The source Matrix to copy from. + * If no animation is running, no events will be dispatched. * - * @return {this} This TransformMatrix. + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * @method Phaser.Animations.AnimationState#stopOnFrame + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.4.0 + * + * @param {Phaser.Animations.AnimationFrame} frame - The frame to check before stopping this animation. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. */ - copyFrom: function (src) + stopOnFrame: function (frame) { - var matrix = this.matrix; - - matrix[0] = src.a; - matrix[1] = src.b; - matrix[2] = src.c; - matrix[3] = src.d; - matrix[4] = src.e; - matrix[5] = src.f; + this._pendingStop = 3; + this._pendingStopValue = frame; - return this; + return this.parent; }, /** - * Set the values of this Matrix to copy those of the array given. - * Where array indexes 0, 1, 2, 3, 4 and 5 are mapped to a, b, c, d, e and f. - * - * @method Phaser.GameObjects.Components.TransformMatrix#copyFromArray - * @since 3.11.0 + * Returns the total number of frames in this animation, or returns zero if no + * animation has been loaded. * - * @param {array} src - The array of values to set into this matrix. + * @method Phaser.Animations.AnimationState#getTotalFrames + * @since 3.4.0 * - * @return {this} This TransformMatrix. + * @return {number} The total number of frames in the current animation, or zero if no animation has been loaded. */ - copyFromArray: function (src) + getTotalFrames: function () { - var matrix = this.matrix; - - matrix[0] = src[0]; - matrix[1] = src[1]; - matrix[2] = src[2]; - matrix[3] = src[3]; - matrix[4] = src[4]; - matrix[5] = src[5]; - - return this; + return (this.currentAnim) ? this.currentAnim.getTotalFrames() : 0; }, /** - * Copy the values from this Matrix to the given Canvas Rendering Context. - * This will use the Context.transform method. + * The internal update loop for the AnimationState Component. * - * @method Phaser.GameObjects.Components.TransformMatrix#copyToContext - * @since 3.12.0 + * This is called automatically by the `Sprite.preUpdate` method. * - * @param {CanvasRenderingContext2D} ctx - The Canvas Rendering Context to copy the matrix values to. + * @method Phaser.Animations.AnimationState#update + * @since 3.0.0 * - * @return {CanvasRenderingContext2D} The Canvas Rendering Context. + * @param {number} time - The current timestamp. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - copyToContext: function (ctx) + update: function (time, delta) { - var matrix = this.matrix; + var anim = this.currentAnim; - ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); + if (!this.isPlaying || !anim || anim.paused) + { + return; + } - return ctx; + this.accumulator += delta * this.timeScale; + + if (this._pendingStop === 1) + { + this._pendingStopValue -= delta; + + if (this._pendingStopValue <= 0) + { + return this.stop(); + } + } + + if (!this.hasStarted) + { + if (this.accumulator >= this.delayCounter) + { + this.accumulator -= this.delayCounter; + + this.handleStart(); + } + } + else if (this.accumulator >= this.nextTick) + { + // Process one frame advance as standard + + if (this.forward) + { + anim.nextFrame(this); + } + else + { + anim.previousFrame(this); + } + + // And only do more if we're skipping frames and have time left + if (this.isPlaying && this._pendingStop === 0 && this.skipMissedFrames && this.accumulator > this.nextTick) + { + var safetyNet = 0; + + do + { + if (this.forward) + { + anim.nextFrame(this); + } + else + { + anim.previousFrame(this); + } + + safetyNet++; + + } while (this.isPlaying && this.accumulator > this.nextTick && safetyNet < 60); + } + } }, /** - * Copy the values from this Matrix to the given Canvas Rendering Context. - * This will use the Context.setTransform method. + * Sets the given Animation Frame as being the current frame + * and applies it to the parent Game Object, adjusting size and origin as needed. * - * @method Phaser.GameObjects.Components.TransformMatrix#setToContext - * @since 3.12.0 + * @method Phaser.Animations.AnimationState#setCurrentFrame + * @fires Phaser.Animations.Events#ANIMATION_UPDATE + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.4.0 * - * @param {CanvasRenderingContext2D} ctx - The Canvas Rendering Context to copy the matrix values to. + * @param {Phaser.Animations.AnimationFrame} animationFrame - The animation frame to change to. * - * @return {CanvasRenderingContext2D} The Canvas Rendering Context. + * @return {Phaser.GameObjects.GameObject} The Game Object this Animation Component belongs to. */ - setToContext: function (ctx) + setCurrentFrame: function (animationFrame) { - var matrix = this.matrix; + var gameObject = this.parent; - ctx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); + this.currentFrame = animationFrame; - return ctx; + gameObject.texture = animationFrame.frame.texture; + gameObject.frame = animationFrame.frame; + + if (gameObject.isCropped) + { + gameObject.frame.updateCropUVs(gameObject._crop, gameObject.flipX, gameObject.flipY); + } + + if (animationFrame.setAlpha) + { + gameObject.alpha = animationFrame.alpha; + } + + gameObject.setSizeToFrame(); + + if (gameObject._originComponent) + { + if (animationFrame.frame.customPivot) + { + gameObject.setOrigin(animationFrame.frame.pivotX, animationFrame.frame.pivotY); + } + else + { + gameObject.updateDisplayOrigin(); + } + } + + if (this.isPlaying && this.hasStarted) + { + this.emitEvents(Events.ANIMATION_UPDATE); + + if (this._pendingStop === 3 && this._pendingStopValue === animationFrame) + { + this.stop(); + } + } + + return gameObject; }, /** - * Copy the values in this Matrix to the array given. - * - * Where array indexes 0, 1, 2, 3, 4 and 5 are mapped to a, b, c, d, e and f. + * Advances the animation to the next frame, regardless of the time or animation state. + * If the animation is set to repeat, or yoyo, this will still take effect. * - * @method Phaser.GameObjects.Components.TransformMatrix#copyToArray - * @since 3.12.0 + * Calling this does not change the direction of the animation. I.e. if it was currently + * playing in reverse, calling this method doesn't then change the direction to forwards. * - * @param {array} [out] - The array to copy the matrix values in to. + * @method Phaser.Animations.AnimationState#nextFrame + * @since 3.16.0 * - * @return {array} An array where elements 0 to 5 contain the values from this matrix. + * @return {Phaser.GameObjects.GameObject} The Game Object this Animation Component belongs to. */ - copyToArray: function (out) + nextFrame: function () { - var matrix = this.matrix; - - if (out === undefined) - { - out = [ matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5] ]; - } - else + if (this.currentAnim) { - out[0] = matrix[0]; - out[1] = matrix[1]; - out[2] = matrix[2]; - out[3] = matrix[3]; - out[4] = matrix[4]; - out[5] = matrix[5]; + this.currentAnim.nextFrame(this); } - return out; + return this.parent; }, /** - * Set the values of this Matrix. + * Advances the animation to the previous frame, regardless of the time or animation state. + * If the animation is set to repeat, or yoyo, this will still take effect. * - * @method Phaser.GameObjects.Components.TransformMatrix#setTransform - * @since 3.0.0 + * Calling this does not change the direction of the animation. I.e. if it was currently + * playing in forwards, calling this method doesn't then change the direction to backwards. * - * @param {number} a - The Scale X value. - * @param {number} b - The Shear Y value. - * @param {number} c - The Shear X value. - * @param {number} d - The Scale Y value. - * @param {number} tx - The Translate X value. - * @param {number} ty - The Translate Y value. + * @method Phaser.Animations.AnimationState#previousFrame + * @since 3.16.0 * - * @return {this} This TransformMatrix. + * @return {Phaser.GameObjects.GameObject} The Game Object this Animation Component belongs to. */ - setTransform: function (a, b, c, d, tx, ty) + previousFrame: function () { - var matrix = this.matrix; - - matrix[0] = a; - matrix[1] = b; - matrix[2] = c; - matrix[3] = d; - matrix[4] = tx; - matrix[5] = ty; + if (this.currentAnim) + { + this.currentAnim.previousFrame(this); + } - return this; + return this.parent; }, /** - * Decompose this Matrix into its translation, scale and rotation values using QR decomposition. + * Get an Animation instance that has been created locally on this Sprite. * - * The result must be applied in the following order to reproduce the current matrix: + * See the `create` method for more details. * - * translate -> rotate -> scale + * @method Phaser.Animations.AnimationState#get + * @since 3.50.0 * - * @method Phaser.GameObjects.Components.TransformMatrix#decomposeMatrix - * @since 3.0.0 + * @param {string} key - The key of the Animation to retrieve. * - * @return {object} The decomposed Matrix. + * @return {Phaser.Animations.Animation} The Animation, or `null` if the key is invalid. */ - decomposeMatrix: function () + get: function (key) { - var decomposedMatrix = this.decomposedMatrix; - - var matrix = this.matrix; - - // a = scale X (1) - // b = shear Y (0) - // c = shear X (0) - // d = scale Y (1) - - var a = matrix[0]; - var b = matrix[1]; - var c = matrix[2]; - var d = matrix[3]; - - var determ = a * d - b * c; - - decomposedMatrix.translateX = matrix[4]; - decomposedMatrix.translateY = matrix[5]; - - if (a || b) - { - var r = Math.sqrt(a * a + b * b); - - decomposedMatrix.rotation = (b > 0) ? Math.acos(a / r) : -Math.acos(a / r); - decomposedMatrix.scaleX = r; - decomposedMatrix.scaleY = determ / r; - } - else if (c || d) - { - var s = Math.sqrt(c * c + d * d); - - decomposedMatrix.rotation = Math.PI * 0.5 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)); - decomposedMatrix.scaleX = determ / s; - decomposedMatrix.scaleY = s; - } - else - { - decomposedMatrix.rotation = 0; - decomposedMatrix.scaleX = 0; - decomposedMatrix.scaleY = 0; - } - - return decomposedMatrix; + return (this.anims) ? this.anims.get(key) : null; }, /** - * Apply the identity, translate, rotate and scale operations on the Matrix. + * Checks to see if the given key is already used locally within the animations stored on this Sprite. * - * @method Phaser.GameObjects.Components.TransformMatrix#applyITRS - * @since 3.0.0 + * @method Phaser.Animations.AnimationState#exists + * @since 3.50.0 * - * @param {number} x - The horizontal translation. - * @param {number} y - The vertical translation. - * @param {number} rotation - The angle of rotation in radians. - * @param {number} scaleX - The horizontal scale. - * @param {number} scaleY - The vertical scale. + * @param {string} key - The key of the Animation to check. * - * @return {this} This TransformMatrix. + * @return {boolean} `true` if the Animation exists locally, or `false` if the key is available, or there are no local animations. */ - applyITRS: function (x, y, rotation, scaleX, scaleY) + exists: function (key) { - var matrix = this.matrix; - - var radianSin = Math.sin(rotation); - var radianCos = Math.cos(rotation); - - // Translate - matrix[4] = x; - matrix[5] = y; - - // Rotate and Scale - matrix[0] = radianCos * scaleX; - matrix[1] = radianSin * scaleX; - matrix[2] = -radianSin * scaleY; - matrix[3] = radianCos * scaleY; - - return this; + return (this.anims) ? this.anims.has(key) : false; }, /** - * Takes the `x` and `y` values and returns a new position in the `output` vector that is the inverse of - * the current matrix with its transformation applied. + * Creates a new Animation that is local specifically to this Sprite. * - * Can be used to translate points from world to local space. + * When a Sprite owns an animation, it is kept out of the global Animation Manager, which means + * you're free to use keys that may be already defined there. Unless you specifically need a Sprite + * to have a unique animation, you should favor using global animations instead, as they allow for + * the same animation to be used across multiple Sprites, saving on memory. However, if this Sprite + * is the only one to use this animation, it's sensible to create it here. * - * @method Phaser.GameObjects.Components.TransformMatrix#applyInverse - * @since 3.12.0 + * If an invalid key is given this method will return `false`. * - * @param {number} x - The x position to translate. - * @param {number} y - The y position to translate. - * @param {Phaser.Math.Vector2} [output] - A Vector2, or point-like object, to store the results in. + * If you pass the key of an animation that already exists locally, that animation will be returned. * - * @return {Phaser.Math.Vector2} The coordinates, inverse-transformed through this matrix. + * A brand new animation is only created if the key is valid and not already in use by this Sprite. + * + * If you wish to re-use an existing key, call the `remove` method first, then this method. + * + * @method Phaser.Animations.AnimationState#create + * @since 3.50.0 + * + * @param {Phaser.Types.Animations.Animation} config - The configuration settings for the Animation. + * + * @return {(Phaser.Animations.Animation|false)} The Animation that was created, or `false` if the key is already in use. */ - applyInverse: function (x, y, output) + create: function (config) { - if (output === undefined) { output = new Vector2(); } + var key = config.key; - var matrix = this.matrix; + var anim = false; - var a = matrix[0]; - var b = matrix[1]; - var c = matrix[2]; - var d = matrix[3]; - var tx = matrix[4]; - var ty = matrix[5]; + if (key) + { + anim = this.get(key); - var id = 1 / ((a * d) + (c * -b)); + if (!anim) + { + anim = new Animation(this, key, config); - output.x = (d * id * x) + (-c * id * y) + (((ty * c) - (tx * d)) * id); - output.y = (a * id * y) + (-b * id * x) + (((-ty * a) + (tx * b)) * id); + if (!this.anims) + { + this.anims = new CustomMap(); + } - return output; + this.anims.set(key, anim); + } + else + { + console.warn('Animation key already exists: ' + key); + } + } + + return anim; }, /** - * Returns the X component of this matrix multiplied by the given values. - * This is the same as `x * a + y * c + e`. + * Create one, or more animations from a loaded Aseprite JSON file. * - * @method Phaser.GameObjects.Components.TransformMatrix#getX - * @since 3.12.0 + * Aseprite is a powerful animated sprite editor and pixel art tool. * - * @param {number} x - The x value. - * @param {number} y - The y value. + * You can find more details at https://www.aseprite.org/ * - * @return {number} The calculated x value. + * To export a compatible JSON file in Aseprite, please do the following: + * + * 1. Go to "File - Export Sprite Sheet" + * + * 2. On the **Layout** tab: + * 2a. Set the "Sheet type" to "Packed" + * 2b. Set the "Constraints" to "None" + * 2c. Check the "Merge Duplicates" checkbox + * + * 3. On the **Sprite** tab: + * 3a. Set "Layers" to "Visible layers" + * 3b. Set "Frames" to "All frames", unless you only wish to export a sub-set of tags + * + * 4. On the **Borders** tab: + * 4a. Check the "Trim Sprite" and "Trim Cells" options + * 4b. Ensure "Border Padding", "Spacing" and "Inner Padding" are all > 0 (1 is usually enough) + * + * 5. On the **Output** tab: + * 5a. Check "Output File", give your image a name and make sure you choose "png files" as the file type + * 5b. Check "JSON Data" and give your json file a name + * 5c. The JSON Data type can be either a Hash or Array, Phaser doesn't mind. + * 5d. Make sure "Tags" is checked in the Meta options + * 5e. In the "Item Filename" input box, make sure it says just "{frame}" and nothing more. + * + * 6. Click export + * + * This was tested with Aseprite 1.2.25. + * + * This will export a png and json file which you can load using the Aseprite Loader, i.e.: + * + * ```javascript + * function preload () + * { + * this.load.path = 'assets/animations/aseprite/'; + * this.load.aseprite('paladin', 'paladin.png', 'paladin.json'); + * } + * ``` + * + * Once loaded, you can call this method on a Sprite with the 'atlas' key: + * + * ```javascript + * const sprite = this.add.sprite(400, 300); + * + * sprite.anims.createFromAseprite('paladin'); + * ``` + * + * Any animations defined in the JSON will now be available to use on this Sprite and you play them + * via their Tag name. For example, if you have an animation called 'War Cry' on your Aseprite timeline, + * you can play it on the Sprite using that Tag name: + * + * ```javascript + * const sprite = this.add.sprite(400, 300); + * + * sprite.anims.createFromAseprite('paladin'); + * + * sprite.play('War Cry'); + * ``` + * + * When calling this method you can optionally provide an array of tag names, and only those animations + * will be created. For example: + * + * ```javascript + * sprite.anims.createFromAseprite('paladin', [ 'step', 'War Cry', 'Magnum Break' ]); + * ``` + * + * This will only create the 3 animations defined. Note that the tag names are case-sensitive. + * + * @method Phaser.Animations.AnimationState#createFromAseprite + * @since 3.60.0 + * + * @param {string} key - The key of the loaded Aseprite atlas. It must have been loaded prior to calling this method. + * @param {string[]} [tags] - An array of Tag names. If provided, only animations found in this array will be created. + * + * @return {Phaser.Animations.Animation[]} An array of Animation instances that were successfully created. */ - getX: function (x, y) + createFromAseprite: function (key, tags) { - return x * this.a + y * this.c + this.e; + return this.animationManager.createFromAseprite(key, tags, this.parent); }, /** - * Returns the Y component of this matrix multiplied by the given values. - * This is the same as `x * b + y * d + f`. + * Generate an array of {@link Phaser.Types.Animations.AnimationFrame} objects from a texture key and configuration object. * - * @method Phaser.GameObjects.Components.TransformMatrix#getY - * @since 3.12.0 + * Generates objects with string based frame names, as configured by the given {@link Phaser.Types.Animations.GenerateFrameNames}. * - * @param {number} x - The x value. - * @param {number} y - The y value. + * It's a helper method, designed to make it easier for you to extract all of the frame names from texture atlases. + * If you're working with a sprite sheet, see the `generateFrameNumbers` method instead. * - * @return {number} The calculated y value. + * Example: + * + * If you have a texture atlases loaded called `gems` and it contains 6 frames called `ruby_0001`, `ruby_0002`, and so on, + * then you can call this method using: `this.anims.generateFrameNames('gems', { prefix: 'ruby_', end: 6, zeroPad: 4 })`. + * + * The `end` value tells it to look for 6 frames, incrementally numbered, all starting with the prefix `ruby_`. The `zeroPad` + * value tells it how many zeroes pad out the numbers. To create an animation using this method, you can do: + * + * ```javascript + * this.anims.create({ + * key: 'ruby', + * repeat: -1, + * frames: this.anims.generateFrameNames('gems', { + * prefix: 'ruby_', + * end: 6, + * zeroPad: 4 + * }) + * }); + * ``` + * + * Please see the animation examples for further details. + * + * @method Phaser.Animations.AnimationState#generateFrameNames + * @since 3.50.0 + * + * @param {string} key - The key for the texture containing the animation frames. + * @param {Phaser.Types.Animations.GenerateFrameNames} [config] - The configuration object for the animation frame names. + * + * @return {Phaser.Types.Animations.AnimationFrame[]} The array of {@link Phaser.Types.Animations.AnimationFrame} objects. */ - getY: function (x, y) + generateFrameNames: function (key, config) { - return x * this.b + y * this.d + this.f; + return this.animationManager.generateFrameNames(key, config); }, /** - * Returns the X component of this matrix multiplied by the given values. + * Generate an array of {@link Phaser.Types.Animations.AnimationFrame} objects from a texture key and configuration object. * - * This is the same as `x * a + y * c + e`, optionally passing via `Math.round`. + * Generates objects with numbered frame names, as configured by the given {@link Phaser.Types.Animations.GenerateFrameNumbers}. * - * @method Phaser.GameObjects.Components.TransformMatrix#getXRound + * If you're working with a texture atlas, see the `generateFrameNames` method instead. + * + * It's a helper method, designed to make it easier for you to extract frames from sprite sheets. + * If you're working with a texture atlas, see the `generateFrameNames` method instead. + * + * Example: + * + * If you have a sprite sheet loaded called `explosion` and it contains 12 frames, then you can call this method using: + * `this.anims.generateFrameNumbers('explosion', { start: 0, end: 11 })`. + * + * The `end` value tells it to stop after 12 frames. To create an animation using this method, you can do: + * + * ```javascript + * this.anims.create({ + * key: 'boom', + * frames: this.anims.generateFrameNumbers('explosion', { + * start: 0, + * end: 11 + * }) + * }); + * ``` + * + * Note that `start` is optional and you don't need to include it if the animation starts from frame 0. + * + * To specify an animation in reverse, swap the `start` and `end` values. + * + * If the frames are not sequential, you may pass an array of frame numbers instead, for example: + * + * `this.anims.generateFrameNumbers('explosion', { frames: [ 0, 1, 2, 1, 2, 3, 4, 0, 1, 2 ] })` + * + * Please see the animation examples and `GenerateFrameNumbers` config docs for further details. + * + * @method Phaser.Animations.AnimationState#generateFrameNumbers * @since 3.50.0 * - * @param {number} x - The x value. - * @param {number} y - The y value. - * @param {boolean} [round=false] - Math.round the resulting value? + * @param {string} key - The key for the texture containing the animation frames. + * @param {Phaser.Types.Animations.GenerateFrameNumbers} [config] - The configuration object for the animation frames. * - * @return {number} The calculated x value. + * @return {Phaser.Types.Animations.AnimationFrame[]} The array of {@link Phaser.Types.Animations.AnimationFrame} objects. */ - getXRound: function (x, y, round) + generateFrameNumbers: function (key, config) { - var v = this.getX(x, y); - - if (round) - { - v = Math.round(v); - } - - return v; + return this.animationManager.generateFrameNumbers(key, config); }, /** - * Returns the Y component of this matrix multiplied by the given values. + * Removes a locally created Animation from this Sprite, based on the given key. * - * This is the same as `x * b + y * d + f`, optionally passing via `Math.round`. + * Once an Animation has been removed, this Sprite cannot play it again without re-creating it. * - * @method Phaser.GameObjects.Components.TransformMatrix#getYRound + * @method Phaser.Animations.AnimationState#remove * @since 3.50.0 * - * @param {number} x - The x value. - * @param {number} y - The y value. - * @param {boolean} [round=false] - Math.round the resulting value? + * @param {string} key - The key of the animation to remove. * - * @return {number} The calculated y value. + * @return {Phaser.Animations.Animation} The Animation instance that was removed from this Sprite, if the key was valid. */ - getYRound: function (x, y, round) + remove: function (key) { - var v = this.getY(x, y); + var anim = this.get(key); - if (round) + if (anim) { - v = Math.round(v); + if (this.currentAnim === anim) + { + this.stop(); + } + + this.anims.delete(key); } - return v; + return anim; }, /** - * Returns a string that can be used in a CSS Transform call as a `matrix` property. + * Destroy this Animation component. * - * @method Phaser.GameObjects.Components.TransformMatrix#getCSSMatrix - * @since 3.12.0 + * Unregisters event listeners and cleans up its references. * - * @return {string} A string containing the CSS Transform matrix values. + * @method Phaser.Animations.AnimationState#destroy + * @since 3.0.0 */ - getCSSMatrix: function () + destroy: function () { - var m = this.matrix; + this.animationManager.off(Events.REMOVE_ANIMATION, this.globalRemove, this); - return 'matrix(' + m[0] + ',' + m[1] + ',' + m[2] + ',' + m[3] + ',' + m[4] + ',' + m[5] + ')'; + if (this.anims) + { + this.anims.clear(); + } + + this.animationManager = null; + this.parent = null; + this.nextAnim = null; + this.nextAnimsQueue.length = 0; + + this.currentAnim = null; + this.currentFrame = null; }, /** - * Destroys this Transform Matrix. + * `true` if the current animation is paused, otherwise `false`. * - * @method Phaser.GameObjects.Components.TransformMatrix#destroy + * @name Phaser.Animations.AnimationState#isPaused + * @readonly + * @type {boolean} * @since 3.4.0 */ - destroy: function () - { - this.matrix = null; - this.decomposedMatrix = null; + isPaused: { + + get: function () + { + return this._paused; + } + } }); -module.exports = TransformMatrix; +module.exports = AnimationState; /***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 44509: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetFastValue = __webpack_require__(2); - /** - * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. + * The Add Animation Event. * - * @function Phaser.Tilemaps.Components.GetTilesWithin - * @since 3.0.0 + * This event is dispatched when a new animation is added to the global Animation Manager. * - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * This can happen either as a result of an animation instance being added to the Animation Manager, + * or the Animation Manager creating a new animation directly. * - * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. + * @event Phaser.Animations.Events#ADD_ANIMATION + * @type {string} + * @since 3.0.0 + * + * @param {string} key - The key of the Animation that was added to the global Animation Manager. + * @param {Phaser.Animations.Animation} animation - An instance of the newly created Animation. */ -var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer) -{ - if (tileX === undefined) { tileX = 0; } - if (tileY === undefined) { tileY = 0; } - if (width === undefined) { width = layer.width; } - if (height === undefined) { height = layer.height; } - if (!filteringOptions) { filteringOptions = {}; } - - var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false); - var isColliding = GetFastValue(filteringOptions, 'isColliding', false); - var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false); - - // Clip x, y to top left of map, while shrinking width/height to match. - if (tileX < 0) - { - width += tileX; - tileX = 0; - } - - if (tileY < 0) - { - height += tileY; - tileY = 0; - } - - // Clip width and height to bottom right of map. - if (tileX + width > layer.width) - { - width = Math.max(layer.width - tileX, 0); - } - - if (tileY + height > layer.height) - { - height = Math.max(layer.height - tileY, 0); - } +module.exports = 'add'; - var results = []; - for (var ty = tileY; ty < tileY + height; ty++) - { - for (var tx = tileX; tx < tileX + width; tx++) - { - var tile = layer.data[ty][tx]; +/***/ }), - if (tile !== null) - { - if (isNotEmpty && tile.index === -1) - { - continue; - } +/***/ 84563: +/***/ ((module) => { - if (isColliding && !tile.collides) - { - continue; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (hasInterestingFace && !tile.hasInterestingFace) - { - continue; - } - - results.push(tile); - } - } - } - - return results; -}; - -module.exports = GetTilesWithin; +/** + * The Animation Complete Event. + * + * This event is dispatched by a Sprite when an animation playing on it completes playback. + * This happens when the animation gets to the end of its sequence, factoring in any delays + * or repeats it may have to process. + * + * An animation that is set to loop, or repeat forever, will never fire this event, because + * it never actually completes. If you need to handle this, listen for the `ANIMATION_STOP` + * event instead, as this is emitted when the animation is stopped directly. + * + * Listen for it on the Sprite using `sprite.on('animationcomplete', listener)` + * + * The animation event flow is as follows: + * + * 1. `ANIMATION_START` + * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) + * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) + * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) + * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) + * + * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. + * + * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. + * + * @event Phaser.Animations.Events#ANIMATION_COMPLETE + * @type {string} + * @since 3.50.0 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. + * @param {string} frameKey - The unique key of the Animation Frame within the Animation. + */ +module.exports = 'animationcomplete'; /***/ }), -/* 27 */ -/***/ (function(module, exports) { + +/***/ 61586: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Takes an array of Game Objects, or any objects that have a public property as defined in `key`, - * and then sets it to the given value. + * The Animation Complete Dynamic Key Event. * - * The optional `step` property is applied incrementally, multiplied by each item in the array. + * This event is dispatched by a Sprite when an animation playing on it completes playback. + * This happens when the animation gets to the end of its sequence, factoring in any delays + * or repeats it may have to process. * - * To use this with a Group: `PropertyValueSet(group.getChildren(), key, value, step)` + * An animation that is set to loop, or repeat forever, will never fire this event, because + * it never actually completes. If you need to handle this, listen for the `ANIMATION_STOP` + * event instead, as this is emitted when the animation is stopped directly. * - * @function Phaser.Actions.PropertyValueSet - * @since 3.3.0 + * The difference between this and the `ANIMATION_COMPLETE` event is that this one has a + * dynamic event name that contains the name of the animation within it. For example, + * if you had an animation called `explode` you could listen for the completion of that + * specific animation by using: `sprite.on('animationcomplete-explode', listener)`. Or, if you + * wish to use types: `sprite.on(Phaser.Animations.Events.ANIMATION_COMPLETE_KEY + 'explode', listener)`. * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * The animation event flow is as follows: * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {string} key - The property to be updated. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * 1. `ANIMATION_START` + * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) + * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) + * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) + * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. + * + * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. + * + * @event Phaser.Animations.Events#ANIMATION_COMPLETE_KEY + * @type {string} + * @since 3.50.0 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. + * @param {string} frameKey - The unique key of the Animation Frame within the Animation. */ -var PropertyValueSet = function (items, key, value, step, index, direction) -{ - if (step === undefined) { step = 0; } - if (index === undefined) { index = 0; } - if (direction === undefined) { direction = 1; } +module.exports = 'animationcomplete-'; - var i; - var t = 0; - var end = items.length; - if (direction === 1) - { - // Start to End - for (i = index; i < end; i++) - { - items[i][key] = value + (t * step); - t++; - } - } - else - { - // End to Start - for (i = index; i >= 0; i--) - { - items[i][key] = value + (t * step); - t++; - } - } +/***/ }), - return items; -}; +/***/ 72175: +/***/ ((module) => { -module.exports = PropertyValueSet; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Animation Repeat Event. + * + * This event is dispatched by a Sprite when an animation repeats playing on it. + * This happens if the animation was created, or played, with a `repeat` value specified. + * + * An animation will repeat when it reaches the end of its sequence. + * + * Listen for it on the Sprite using `sprite.on('animationrepeat', listener)` + * + * The animation event flow is as follows: + * + * 1. `ANIMATION_START` + * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) + * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) + * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) + * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) + * + * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. + * + * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. + * + * @event Phaser.Animations.Events#ANIMATION_REPEAT + * @type {string} + * @since 3.50.0 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has repeated. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation repeated. + * @param {string} frameKey - The unique key of the Animation Frame within the Animation. + */ +module.exports = 'animationrepeat'; /***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 568: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlendModes = __webpack_require__(35); -var GetAdvancedValue = __webpack_require__(13); - /** - * Builds a Game Object using the provided configuration object. + * The Animation Restart Event. * - * @function Phaser.GameObjects.BuildGameObject - * @since 3.0.0 + * This event is dispatched by a Sprite when an animation restarts playing on it. + * This only happens when the `Sprite.anims.restart` method is called. * - * @param {Phaser.Scene} scene - A reference to the Scene. - * @param {Phaser.GameObjects.GameObject} gameObject - The initial GameObject. - * @param {Phaser.Types.GameObjects.GameObjectConfig} config - The config to build the GameObject with. + * Listen for it on the Sprite using `sprite.on('animationrestart', listener)` * - * @return {Phaser.GameObjects.GameObject} The built Game Object. + * The animation event flow is as follows: + * + * 1. `ANIMATION_START` + * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) + * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) + * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) + * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) + * + * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. + * + * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. + * + * @event Phaser.Animations.Events#ANIMATION_RESTART + * @type {string} + * @since 3.50.0 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has restarted. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted. + * @param {string} frameKey - The unique key of the Animation Frame within the Animation. */ -var BuildGameObject = function (scene, gameObject, config) -{ - // Position +module.exports = 'animationrestart'; - gameObject.x = GetAdvancedValue(config, 'x', 0); - gameObject.y = GetAdvancedValue(config, 'y', 0); - gameObject.depth = GetAdvancedValue(config, 'depth', 0); - // Flip +/***/ }), - gameObject.flipX = GetAdvancedValue(config, 'flipX', false); - gameObject.flipY = GetAdvancedValue(config, 'flipY', false); +/***/ 37690: +/***/ ((module) => { - // Scale - // Either: { scale: 2 } or { scale: { x: 2, y: 2 }} +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var scale = GetAdvancedValue(config, 'scale', null); +/** + * The Animation Start Event. + * + * This event is dispatched by a Sprite when an animation starts playing on it. + * This happens when the animation is played, factoring in any delay that may have been specified. + * This event happens after the delay has expired and prior to the first update event. + * + * Listen for it on the Sprite using `sprite.on('animationstart', listener)` + * + * The animation event flow is as follows: + * + * 1. `ANIMATION_START` + * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) + * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) + * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) + * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) + * + * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. + * + * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. + * + * @event Phaser.Animations.Events#ANIMATION_START + * @type {string} + * @since 3.50.0 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has started. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started. + * @param {string} frameKey - The unique key of the Animation Frame within the Animation. + */ +module.exports = 'animationstart'; - if (typeof scale === 'number') - { - gameObject.setScale(scale); - } - else if (scale !== null) - { - gameObject.scaleX = GetAdvancedValue(scale, 'x', 1); - gameObject.scaleY = GetAdvancedValue(scale, 'y', 1); - } - // ScrollFactor - // Either: { scrollFactor: 2 } or { scrollFactor: { x: 2, y: 2 }} +/***/ }), - var scrollFactor = GetAdvancedValue(config, 'scrollFactor', null); +/***/ 58525: +/***/ ((module) => { - if (typeof scrollFactor === 'number') - { - gameObject.setScrollFactor(scrollFactor); - } - else if (scrollFactor !== null) - { - gameObject.scrollFactorX = GetAdvancedValue(scrollFactor, 'x', 1); - gameObject.scrollFactorY = GetAdvancedValue(scrollFactor, 'y', 1); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Rotation +/** + * The Animation Stop Event. + * + * This event is dispatched by a Sprite when an animation is stopped on it. An animation + * will only be stopeed if a method such as `Sprite.stop` or `Sprite.anims.stopAfterDelay` + * is called. It can also be emitted if a new animation is started before the current one completes. + * + * Listen for it on the Sprite using `sprite.on('animationstop', listener)` + * + * The animation event flow is as follows: + * + * 1. `ANIMATION_START` + * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) + * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) + * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) + * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) + * + * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. + * + * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. + * + * @event Phaser.Animations.Events#ANIMATION_STOP + * @type {string} + * @since 3.50.0 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has stopped. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation stopped. + * @param {string} frameKey - The unique key of the Animation Frame within the Animation. + */ +module.exports = 'animationstop'; - gameObject.rotation = GetAdvancedValue(config, 'rotation', 0); - var angle = GetAdvancedValue(config, 'angle', null); +/***/ }), - if (angle !== null) - { - gameObject.angle = angle; - } +/***/ 5243: +/***/ ((module) => { - // Alpha +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - gameObject.alpha = GetAdvancedValue(config, 'alpha', 1); +/** + * The Animation Update Event. + * + * This event is dispatched by a Sprite when an animation playing on it updates. This happens when the animation changes frame. + * An animation will change frame based on the frame rate and other factors like `timeScale` and `delay`. It can also change + * frame when stopped or restarted. + * + * Listen for it on the Sprite using `sprite.on('animationupdate', listener)` + * + * If an animation is playing faster than the game frame-rate can handle, it's entirely possible for it to emit several + * update events in a single game frame, so please be aware of this in your code. The **final** event received that frame + * is the one that is rendered to the game. + * + * The animation event flow is as follows: + * + * 1. `ANIMATION_START` + * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) + * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) + * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) + * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) + * + * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. + * + * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. + * + * @event Phaser.Animations.Events#ANIMATION_UPDATE + * @type {string} + * @since 3.50.0 + * + * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has updated. + * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. + * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. + * @param {string} frameKey - The unique key of the Animation Frame within the Animation. + */ +module.exports = 'animationupdate'; - // Origin - // Either: { origin: 0.5 } or { origin: { x: 0.5, y: 0.5 }} - var origin = GetAdvancedValue(config, 'origin', null); +/***/ }), - if (typeof origin === 'number') - { - gameObject.setOrigin(origin); - } - else if (origin !== null) - { - var ox = GetAdvancedValue(origin, 'x', 0.5); - var oy = GetAdvancedValue(origin, 'y', 0.5); +/***/ 10598: +/***/ ((module) => { - gameObject.setOrigin(ox, oy); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // BlendMode +/** + * The Pause All Animations Event. + * + * This event is dispatched when the global Animation Manager is told to pause. + * + * When this happens all current animations will stop updating, although it doesn't necessarily mean + * that the game has paused as well. + * + * @event Phaser.Animations.Events#PAUSE_ALL + * @type {string} + * @since 3.0.0 + */ +module.exports = 'pauseall'; - gameObject.blendMode = GetAdvancedValue(config, 'blendMode', BlendModes.NORMAL); - // Visible +/***/ }), - gameObject.visible = GetAdvancedValue(config, 'visible', true); +/***/ 4860: +/***/ ((module) => { - // Add to Scene +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var add = GetAdvancedValue(config, 'add', true); +/** + * The Remove Animation Event. + * + * This event is dispatched when an animation is removed from the global Animation Manager. + * + * @event Phaser.Animations.Events#REMOVE_ANIMATION + * @type {string} + * @since 3.0.0 + * + * @param {string} key - The key of the Animation that was removed from the global Animation Manager. + * @param {Phaser.Animations.Animation} animation - An instance of the removed Animation. + */ +module.exports = 'remove'; - if (add) - { - scene.sys.displayList.add(gameObject); - } - if (gameObject.preUpdate) - { - scene.sys.updateList.add(gameObject); - } +/***/ }), - return gameObject; -}; +/***/ 31865: +/***/ ((module) => { -module.exports = BuildGameObject; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Resume All Animations Event. + * + * This event is dispatched when the global Animation Manager resumes, having been previously paused. + * + * When this happens all current animations will continue updating again. + * + * @event Phaser.Animations.Events#RESUME_ALL + * @type {string} + * @since 3.0.0 + */ +module.exports = 'resumeall'; /***/ }), -/* 29 */ -/***/ (function(module, exports) { + +/***/ 16938: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Phaser Tilemap constants for orientation. - * - * @namespace Phaser.Tilemaps.Orientation - * @memberof Phaser.Tilemaps - * @since 3.50.0 - */ - -/** - * Phaser Tilemap constants for orientation. - * - * To find out what each mode does please see [Phaser.Tilemaps.Orientation]{@link Phaser.Tilemaps.Orientation}. - * - * @typedef {Phaser.Tilemaps.Orientation} Phaser.Tilemaps.OrientationType - * @memberof Phaser.Tilemaps - * @since 3.50.0 + * @namespace Phaser.Animations.Events */ module.exports = { - /** - * Orthogonal Tilemap orientation constant. - * - * @name Phaser.Tilemaps.Orientation.ORTHOGONAL - * @type {number} - * @const - * @since 3.50.0 - */ - ORTHOGONAL: 0, - - /** - * Isometric Tilemap orientation constant. - * - * @name Phaser.Tilemaps.Orientation.ISOMETRIC - * @type {number} - * @const - * @since 3.50.0 - */ - ISOMETRIC: 1, - - /** - * Staggered Tilemap orientation constant. - * - * @name Phaser.Tilemaps.Orientation.STAGGERED - * @type {number} - * @const - * @since 3.50.0 - */ - STAGGERED: 2, - - /** - * Hexagonal Tilemap orientation constant. - * - * @name Phaser.Tilemaps.Orientation.HEXAGONAL - * @type {number} - * @const - * @since 3.50.0 - */ - HEXAGONAL: 3 + ADD_ANIMATION: __webpack_require__(44509), + ANIMATION_COMPLETE: __webpack_require__(84563), + ANIMATION_COMPLETE_KEY: __webpack_require__(61586), + ANIMATION_REPEAT: __webpack_require__(72175), + ANIMATION_RESTART: __webpack_require__(568), + ANIMATION_START: __webpack_require__(37690), + ANIMATION_STOP: __webpack_require__(58525), + ANIMATION_UPDATE: __webpack_require__(5243), + PAUSE_ALL: __webpack_require__(10598), + REMOVE_ANIMATION: __webpack_require__(4860), + RESUME_ALL: __webpack_require__(31865) }; /***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 13517: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCalcMatrix = __webpack_require__(19); - /** - * Takes a reference to the Canvas Renderer, a Canvas Rendering Context, a Game Object, a Camera and a parent matrix - * and then performs the following steps: - * - * 1. Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. - * 2. Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. - * 3. Sets the blend mode of the context to be that used by the Game Object. - * 4. Sets the alpha value of the context to be that used by the Game Object combined with the Camera. - * 5. Saves the context state. - * 6. Sets the final matrix values into the context via setTransform. - * 7. If Renderer.antialias, or the frame.source.scaleMode is set, then imageSmoothingEnabled is set. - * - * This function is only meant to be used internally. Most of the Canvas Renderer classes use it. - * - * @function Phaser.Renderer.Canvas.SetTransform - * @since 3.12.0 - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {CanvasRenderingContext2D} ctx - The canvas context to set the transform on. - * @param {Phaser.GameObjects.GameObject} src - The Game Object being rendered. Can be any type that extends the base class. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - A parent transform matrix to apply to the Game Object before rendering. - * - * @return {boolean} `true` if the Game Object context was set, otherwise `false`. + * @namespace Phaser.Animations */ -var SetTransform = function (renderer, ctx, src, camera, parentMatrix) -{ - var alpha = camera.alpha * src.alpha; - - if (alpha <= 0) - { - // Nothing to see, so don't waste time calculating stuff - return false; - } - - var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; - - // Blend Mode - ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; - - // Alpha - ctx.globalAlpha = alpha; - - ctx.save(); - calcMatrix.setToContext(ctx); +module.exports = { - ctx.imageSmoothingEnabled = !(!renderer.antialias || (src.frame && src.frame.source.scaleMode)); + Animation: __webpack_require__(85463), + AnimationFrame: __webpack_require__(71519), + AnimationManager: __webpack_require__(90249), + AnimationState: __webpack_require__(16569), + Events: __webpack_require__(16938) - return true; }; -module.exports = SetTransform; - /***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 23740: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(33); -var Smoothing = __webpack_require__(192); - -// The pool into which the canvas elements are placed. -var pool = []; - -// Automatically apply smoothing(false) to created Canvas elements -var _disableContextSmoothing = false; +var Class = __webpack_require__(56694); +var CustomMap = __webpack_require__(33885); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(69773); /** - * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements. - * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again, - * which is useless for some of the Phaser pipelines / renderer. + * @classdesc + * The BaseCache is a base Cache class that can be used for storing references to any kind of data. * - * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created. - * Which means all instances of Phaser Games on the same page can share the one single pool. + * Data can be added, retrieved and removed based on the given keys. * - * @namespace Phaser.Display.Canvas.CanvasPool + * Keys are string-based. + * + * @class BaseCache + * @memberof Phaser.Cache + * @constructor * @since 3.0.0 */ -var CanvasPool = function () -{ - /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. - * - * @function Phaser.Display.Canvas.CanvasPool.create - * @since 3.0.0 - * - * @param {*} parent - The parent of the Canvas object. - * @param {number} [width=1] - The width of the Canvas. - * @param {number} [height=1] - The height of the Canvas. - * @param {number} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. - * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? - * - * @return {HTMLCanvasElement} The canvas element that was created or pulled from the pool - */ - var create = function (parent, width, height, canvasType, selfParent) - { - if (width === undefined) { width = 1; } - if (height === undefined) { height = 1; } - if (canvasType === undefined) { canvasType = CONST.CANVAS; } - if (selfParent === undefined) { selfParent = false; } - - var canvas; - var container = first(canvasType); - - if (container === null) - { - container = { - parent: parent, - canvas: document.createElement('canvas'), - type: canvasType - }; - - if (canvasType === CONST.CANVAS) - { - pool.push(container); - } - - canvas = container.canvas; - } - else - { - container.parent = parent; - - canvas = container.canvas; - } - - if (selfParent) - { - container.parent = canvas; - } +var BaseCache = new Class({ - canvas.width = width; - canvas.height = height; + initialize: - if (_disableContextSmoothing && canvasType === CONST.CANVAS) - { - Smoothing.disable(canvas.getContext('2d')); - } + function BaseCache () + { + /** + * The Map in which the cache objects are stored. + * + * You can query the Map directly or use the BaseCache methods. + * + * @name Phaser.Cache.BaseCache#entries + * @type {Phaser.Structs.Map.} + * @since 3.0.0 + */ + this.entries = new CustomMap(); - return canvas; - }; + /** + * An instance of EventEmitter used by the cache to emit related events. + * + * @name Phaser.Cache.BaseCache#events + * @type {Phaser.Events.EventEmitter} + * @since 3.0.0 + */ + this.events = new EventEmitter(); + }, /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. + * Adds an item to this cache. The item is referenced by a unique string, which you are responsible + * for setting and keeping track of. The item can only be retrieved by using this string. * - * @function Phaser.Display.Canvas.CanvasPool.create2D + * @method Phaser.Cache.BaseCache#add + * @fires Phaser.Cache.Events#ADD * @since 3.0.0 * - * @param {*} parent - The parent of the Canvas object. - * @param {number} [width=1] - The width of the Canvas. - * @param {number} [height=1] - The height of the Canvas. + * @param {string} key - The unique key by which the data added to the cache will be referenced. + * @param {*} data - The data to be stored in the cache. * - * @return {HTMLCanvasElement} The created canvas. + * @return {this} This BaseCache object. */ - var create2D = function (parent, width, height) + add: function (key, data) { - return create(parent, width, height, CONST.CANVAS); - }; + this.entries.set(key, data); + + this.events.emit(Events.ADD, this, key, data); + + return this; + }, /** - * Creates a new Canvas DOM element, or pulls one from the pool if free. + * Checks if this cache contains an item matching the given key. + * This performs the same action as `BaseCache.exists`. * - * @function Phaser.Display.Canvas.CanvasPool.createWebGL + * @method Phaser.Cache.BaseCache#has * @since 3.0.0 * - * @param {*} parent - The parent of the Canvas object. - * @param {number} [width=1] - The width of the Canvas. - * @param {number} [height=1] - The height of the Canvas. + * @param {string} key - The unique key of the item to be checked in this cache. * - * @return {HTMLCanvasElement} The created WebGL canvas. + * @return {boolean} Returns `true` if the cache contains an item matching the given key, otherwise `false`. */ - var createWebGL = function (parent, width, height) + has: function (key) { - return create(parent, width, height, CONST.WEBGL); - }; + return this.entries.has(key); + }, /** - * Gets the first free canvas index from the pool. + * Checks if this cache contains an item matching the given key. + * This performs the same action as `BaseCache.has` and is called directly by the Loader. * - * @function Phaser.Display.Canvas.CanvasPool.first - * @since 3.0.0 + * @method Phaser.Cache.BaseCache#exists + * @since 3.7.0 * - * @param {number} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * @param {string} key - The unique key of the item to be checked in this cache. * - * @return {HTMLCanvasElement} The first free canvas, or `null` if a WebGL canvas was requested or if the pool doesn't have free canvases. + * @return {boolean} Returns `true` if the cache contains an item matching the given key, otherwise `false`. */ - var first = function (canvasType) + exists: function (key) { - if (canvasType === undefined) { canvasType = CONST.CANVAS; } - - if (canvasType === CONST.WEBGL) - { - return null; - } - - for (var i = 0; i < pool.length; i++) - { - var container = pool[i]; - - if (!container.parent && container.type === canvasType) - { - return container; - } - } - - return null; - }; + return this.entries.has(key); + }, /** - * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. - * The canvas has its width and height set to 1, and its parent attribute nulled. + * Gets an item from this cache based on the given key. * - * @function Phaser.Display.Canvas.CanvasPool.remove + * @method Phaser.Cache.BaseCache#get * @since 3.0.0 * - * @param {*} parent - The canvas or the parent of the canvas to free. + * @param {string} key - The unique key of the item to be retrieved from this cache. + * + * @return {*} The item in the cache, or `null` if no item matching the given key was found. */ - var remove = function (parent) + get: function (key) { - // Check to see if the parent is a canvas object - var isCanvas = parent instanceof HTMLCanvasElement; - - pool.forEach(function (container) - { - if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent)) - { - container.parent = null; - container.canvas.width = 1; - container.canvas.height = 1; - } - }); - }; + return this.entries.get(key); + }, /** - * Gets the total number of used canvas elements in the pool. + * Removes and item from this cache based on the given key. * - * @function Phaser.Display.Canvas.CanvasPool.total + * If an entry matching the key is found it is removed from the cache and a `remove` event emitted. + * No additional checks are done on the item removed. If other systems or parts of your game code + * are relying on this item, it is up to you to sever those relationships prior to removing the item. + * + * @method Phaser.Cache.BaseCache#remove + * @fires Phaser.Cache.Events#REMOVE * @since 3.0.0 * - * @return {number} The number of used canvases. + * @param {string} key - The unique key of the item to remove from the cache. + * + * @return {this} This BaseCache object. */ - var total = function () + remove: function (key) { - var c = 0; + var entry = this.get(key); - pool.forEach(function (container) + if (entry) { - if (container.parent) - { - c++; - } - }); + this.entries.delete(key); - return c; - }; + this.events.emit(Events.REMOVE, this, key, entry.data); + } + + return this; + }, /** - * Gets the total number of free canvas elements in the pool. + * Returns all keys in use in this cache. * - * @function Phaser.Display.Canvas.CanvasPool.free - * @since 3.0.0 + * @method Phaser.Cache.BaseCache#getKeys + * @since 3.17.0 * - * @return {number} The number of free canvases. + * @return {string[]} Array containing all the keys. */ - var free = function () + getKeys: function () { - return pool.length - total(); - }; + return this.entries.keys(); + }, /** - * Disable context smoothing on any new Canvas element created. + * Destroys this cache and all items within it. * - * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing + * @method Phaser.Cache.BaseCache#destroy * @since 3.0.0 */ - var disableSmoothing = function () + destroy: function () { - _disableContextSmoothing = true; - }; + this.entries.clear(); + this.events.removeAllListeners(); - /** - * Enable context smoothing on any new Canvas element created. - * - * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing - * @since 3.0.0 - */ - var enableSmoothing = function () - { - _disableContextSmoothing = false; - }; + this.entries = null; + this.events = null; + } - return { - create2D: create2D, - create: create, - createWebGL: createWebGL, - disableSmoothing: disableSmoothing, - enableSmoothing: enableSmoothing, - first: first, - free: free, - pool: pool, - remove: remove, - total: total - }; -}; +}); -// If we export the called function here, it'll only be invoked once (not every time it's required). -module.exports = CanvasPool(); +module.exports = BaseCache; /***/ }), -/* 32 */ -/***/ (function(module, exports) { - -/** -* The `Matter.Common` module contains utility functions that are common to all modules. -* -* @class Common -*/ -var Common = {}; +/***/ 43474: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = Common; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -(function() { +var BaseCache = __webpack_require__(23740); +var Class = __webpack_require__(56694); +var GameEvents = __webpack_require__(97081); - Common._nextId = 0; - Common._seed = 0; - Common._nowStartTime = +(new Date()); +/** + * @classdesc + * The Cache Manager is the global cache owned and maintained by the Game instance. + * + * Various systems, such as the file Loader, rely on this cache in order to store the files + * it has loaded. The manager itself doesn't store any files, but instead owns multiple BaseCache + * instances, one per type of file. You can also add your own custom caches. + * + * @class CacheManager + * @memberof Phaser.Cache + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this CacheManager. + */ +var CacheManager = new Class({ - /** - * Extends the object in the first argument using the object in the second argument. - * @method extend - * @param {} obj - * @param {boolean} deep - * @return {} obj extended - */ - Common.extend = function(obj, deep) { - var argsStart, - args, - deepClone; + initialize: - if (typeof deep === 'boolean') { - argsStart = 2; - deepClone = deep; - } else { - argsStart = 1; - deepClone = true; - } + function CacheManager (game) + { + /** + * A reference to the Phaser.Game instance that owns this CacheManager. + * + * @name Phaser.Cache.CacheManager#game + * @type {Phaser.Game} + * @protected + * @since 3.0.0 + */ + this.game = game; - for (var i = argsStart; i < arguments.length; i++) { - var source = arguments[i]; + /** + * A Cache storing all binary files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#binary + * @type {Phaser.Cache.BaseCache} + * @since 3.0.0 + */ + this.binary = new BaseCache(); - if (source) { - for (var prop in source) { - if (deepClone && source[prop] && source[prop].constructor === Object) { - if (!obj[prop] || obj[prop].constructor === Object) { - obj[prop] = obj[prop] || {}; - Common.extend(obj[prop], deepClone, source[prop]); - } else { - obj[prop] = source[prop]; - } - } else { - obj[prop] = source[prop]; - } - } - } - } - - return obj; - }; + /** + * A Cache storing all bitmap font data files, typically added via the Loader. + * Only the font data is stored in this cache, the textures are part of the Texture Manager. + * + * @name Phaser.Cache.CacheManager#bitmapFont + * @type {Phaser.Cache.BaseCache} + * @since 3.0.0 + */ + this.bitmapFont = new BaseCache(); - /** - * Creates a new clone of the object, if deep is true references will also be cloned. - * @method clone - * @param {} obj - * @param {bool} deep - * @return {} obj cloned - */ - Common.clone = function(obj, deep) { - return Common.extend({}, deep, obj); - }; + /** + * A Cache storing all JSON data files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#json + * @type {Phaser.Cache.BaseCache} + * @since 3.0.0 + */ + this.json = new BaseCache(); - /** - * Returns the list of keys for the given object. - * @method keys - * @param {} obj - * @return {string[]} keys - */ - Common.keys = function(obj) { - if (Object.keys) - return Object.keys(obj); + /** + * A Cache storing all physics data files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#physics + * @type {Phaser.Cache.BaseCache} + * @since 3.0.0 + */ + this.physics = new BaseCache(); - // avoid hasOwnProperty for performance - var keys = []; - for (var key in obj) - keys.push(key); - return keys; - }; + /** + * A Cache storing all shader source files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#shader + * @type {Phaser.Cache.BaseCache} + * @since 3.0.0 + */ + this.shader = new BaseCache(); - /** - * Returns the list of values for the given object. - * @method values - * @param {} obj - * @return {array} Array of the objects property values - */ - Common.values = function(obj) { - var values = []; - - if (Object.keys) { - var keys = Object.keys(obj); - for (var i = 0; i < keys.length; i++) { - values.push(obj[keys[i]]); - } - return values; - } - - // avoid hasOwnProperty for performance - for (var key in obj) - values.push(obj[key]); - return values; - }; + /** + * A Cache storing all non-streaming audio files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#audio + * @type {Phaser.Cache.BaseCache} + * @since 3.0.0 + */ + this.audio = new BaseCache(); - /** - * Gets a value from `base` relative to the `path` string. - * @method get - * @param {} obj The base object - * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz' - * @param {number} [begin] Path slice begin - * @param {number} [end] Path slice end - * @return {} The object at the given path - */ - Common.get = function(obj, path, begin, end) { - path = path.split('.').slice(begin, end); + /** + * A Cache storing all non-streaming video files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#video + * @type {Phaser.Cache.BaseCache} + * @since 3.20.0 + */ + this.video = new BaseCache(); - for (var i = 0; i < path.length; i += 1) { - obj = obj[path[i]]; - } + /** + * A Cache storing all text files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#text + * @type {Phaser.Cache.BaseCache} + * @since 3.0.0 + */ + this.text = new BaseCache(); - return obj; - }; - - /** - * Sets a value on `base` relative to the given `path` string. - * @method set - * @param {} obj The base object - * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz' - * @param {} val The value to set - * @param {number} [begin] Path slice begin - * @param {number} [end] Path slice end - * @return {} Pass through `val` for chaining - */ - Common.set = function(obj, path, val, begin, end) { - var parts = path.split('.').slice(begin, end); - Common.get(obj, path, 0, -1)[parts[parts.length - 1]] = val; - return val; - }; - - /** - * Shuffles the given array in-place. - * The function uses a seeded random generator. - * @method shuffle - * @param {array} array - * @return {array} array shuffled randomly - */ - Common.shuffle = function(array) { - for (var i = array.length - 1; i > 0; i--) { - var j = Math.floor(Common.random() * (i + 1)); - var temp = array[i]; - array[i] = array[j]; - array[j] = temp; - } - return array; - }; - - /** - * Randomly chooses a value from a list with equal probability. - * The function uses a seeded random generator. - * @method choose - * @param {array} choices - * @return {object} A random choice object from the array - */ - Common.choose = function(choices) { - return choices[Math.floor(Common.random() * choices.length)]; - }; - - /** - * Returns true if the object is a HTMLElement, otherwise false. - * @method isElement - * @param {object} obj - * @return {boolean} True if the object is a HTMLElement, otherwise false - */ - Common.isElement = function(obj) { - if (typeof HTMLElement !== 'undefined') { - return obj instanceof HTMLElement; - } - - return !!(obj && obj.nodeType && obj.nodeName); - }; - - /** - * Returns true if the object is an array. - * @method isArray - * @param {object} obj - * @return {boolean} True if the object is an array, otherwise false - */ - Common.isArray = function(obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - }; - - /** - * Returns true if the object is a function. - * @method isFunction - * @param {object} obj - * @return {boolean} True if the object is a function, otherwise false - */ - Common.isFunction = function(obj) { - return typeof obj === "function"; - }; - - /** - * Returns true if the object is a plain object. - * @method isPlainObject - * @param {object} obj - * @return {boolean} True if the object is a plain object, otherwise false - */ - Common.isPlainObject = function(obj) { - return typeof obj === 'object' && obj.constructor === Object; - }; - - /** - * Returns true if the object is a string. - * @method isString - * @param {object} obj - * @return {boolean} True if the object is a string, otherwise false - */ - Common.isString = function(obj) { - return Object.prototype.toString.call(obj) === '[object String]'; - }; - - /** - * Returns the given value clamped between a minimum and maximum value. - * @method clamp - * @param {number} value - * @param {number} min - * @param {number} max - * @return {number} The value clamped between min and max inclusive - */ - Common.clamp = function(value, min, max) { - if (value < min) - return min; - if (value > max) - return max; - return value; - }; - - /** - * Returns the sign of the given value. - * @method sign - * @param {number} value - * @return {number} -1 if negative, +1 if 0 or positive - */ - Common.sign = function(value) { - return value < 0 ? -1 : 1; - }; - - /** - * Returns the current timestamp since the time origin (e.g. from page load). - * The result will be high-resolution including decimal places if available. - * @method now - * @return {number} the current timestamp - */ - Common.now = function() { - if (typeof window !== 'undefined' && window.performance) { - if (window.performance.now) { - return window.performance.now(); - } else if (window.performance.webkitNow) { - return window.performance.webkitNow(); - } - } + /** + * A Cache storing all html files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#html + * @type {Phaser.Cache.BaseCache} + * @since 3.12.0 + */ + this.html = new BaseCache(); - return (new Date()) - Common._nowStartTime; - }; - - /** - * Returns a random value between a minimum and a maximum value inclusive. - * The function uses a seeded random generator. - * @method random - * @param {number} min - * @param {number} max - * @return {number} A random number between min and max inclusive - */ - Common.random = function(min, max) { - min = (typeof min !== "undefined") ? min : 0; - max = (typeof max !== "undefined") ? max : 1; - return min + _seededRandom() * (max - min); - }; + /** + * A Cache storing all WaveFront OBJ files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#obj + * @type {Phaser.Cache.BaseCache} + * @since 3.0.0 + */ + this.obj = new BaseCache(); - var _seededRandom = function() { - // https://en.wikipedia.org/wiki/Linear_congruential_generator - Common._seed = (Common._seed * 9301 + 49297) % 233280; - return Common._seed / 233280; - }; + /** + * A Cache storing all tilemap data files, typically added via the Loader. + * Only the data is stored in this cache, the textures are part of the Texture Manager. + * + * @name Phaser.Cache.CacheManager#tilemap + * @type {Phaser.Cache.BaseCache} + * @since 3.0.0 + */ + this.tilemap = new BaseCache(); - /** - * Converts a CSS hex colour string into an integer. - * @method colorToNumber - * @param {string} colorString - * @return {number} An integer representing the CSS hex string - */ - Common.colorToNumber = function(colorString) { - colorString = colorString.replace('#',''); + /** + * A Cache storing all xml data files, typically added via the Loader. + * + * @name Phaser.Cache.CacheManager#xml + * @type {Phaser.Cache.BaseCache} + * @since 3.0.0 + */ + this.xml = new BaseCache(); - if (colorString.length == 3) { - colorString = colorString.charAt(0) + colorString.charAt(0) - + colorString.charAt(1) + colorString.charAt(1) - + colorString.charAt(2) + colorString.charAt(2); - } + /** + * An object that contains your own custom BaseCache entries. + * Add to this via the `addCustom` method. + * + * @name Phaser.Cache.CacheManager#custom + * @type {Object.} + * @since 3.0.0 + */ + this.custom = {}; - return parseInt(colorString, 16); - }; + this.game.events.once(GameEvents.DESTROY, this.destroy, this); + }, /** - * The console logging level to use, where each level includes all levels above and excludes the levels below. - * The default level is 'debug' which shows all console messages. + * Add your own custom Cache for storing your own files. + * The cache will be available under `Cache.custom.key`. + * The cache will only be created if the key is not already in use. * - * Possible level values are: - * - 0 = None - * - 1 = Debug - * - 2 = Info - * - 3 = Warn - * - 4 = Error - * @property Common.logLevel - * @type {Number} - * @default 1 - */ - Common.logLevel = 1; - - /** - * Shows a `console.log` message only if the current `Common.logLevel` allows it. - * The message will be prefixed with 'matter-js' to make it easily identifiable. - * @method log - * @param ...objs {} The objects to log. - */ - Common.log = function() { - if (console && Common.logLevel > 0 && Common.logLevel <= 3) { - console.log.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); - } - }; - - /** - * Shows a `console.info` message only if the current `Common.logLevel` allows it. - * The message will be prefixed with 'matter-js' to make it easily identifiable. - * @method info - * @param ...objs {} The objects to log. - */ - Common.info = function() { - if (console && Common.logLevel > 0 && Common.logLevel <= 2) { - console.info.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); - } - }; - - /** - * Shows a `console.warn` message only if the current `Common.logLevel` allows it. - * The message will be prefixed with 'matter-js' to make it easily identifiable. - * @method warn - * @param ...objs {} The objects to log. - */ - Common.warn = function() { - if (console && Common.logLevel > 0 && Common.logLevel <= 3) { - console.warn.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); - } - }; - - /** - * Returns the next unique sequential ID. - * @method nextId - * @return {Number} Unique sequential ID - */ - Common.nextId = function() { - return Common._nextId++; - }; - - /** - * A cross browser compatible indexOf implementation. - * @method indexOf - * @param {array} haystack - * @param {object} needle - * @return {number} The position of needle in haystack, otherwise -1. - */ - Common.indexOf = function(haystack, needle) { - if (haystack.indexOf) - return haystack.indexOf(needle); - - for (var i = 0; i < haystack.length; i++) { - if (haystack[i] === needle) - return i; - } - - return -1; - }; - - /** - * A cross browser compatible array map implementation. - * @method map - * @param {array} list - * @param {function} func - * @return {array} Values from list transformed by func. + * @method Phaser.Cache.CacheManager#addCustom + * @since 3.0.0 + * + * @param {string} key - The unique key of your custom cache. + * + * @return {Phaser.Cache.BaseCache} A reference to the BaseCache that was created. If the key was already in use, a reference to the existing cache is returned instead. */ - Common.map = function(list, func) { - if (list.map) { - return list.map(func); - } - - var mapped = []; - - for (var i = 0; i < list.length; i += 1) { - mapped.push(func(list[i])); + addCustom: function (key) + { + if (!this.custom.hasOwnProperty(key)) + { + this.custom[key] = new BaseCache(); } - return mapped; - }; + return this.custom[key]; + }, /** - * Takes a directed graph and returns the partially ordered set of vertices in topological order. - * Circular dependencies are allowed. - * @method topologicalSort - * @param {object} graph - * @return {array} Partially ordered set of vertices in topological order. + * Removes all entries from all BaseCaches and destroys all custom caches. + * + * @method Phaser.Cache.CacheManager#destroy + * @since 3.0.0 */ - Common.topologicalSort = function(graph) { - // https://github.com/mgechev/javascript-algorithms - // Copyright (c) Minko Gechev (MIT license) - // Modifications: tidy formatting and naming - var result = [], - visited = [], - temp = []; - - for (var node in graph) { - if (!visited[node] && !temp[node]) { - Common._topologicalSort(node, visited, temp, graph, result); - } - } - - return result; - }; - - Common._topologicalSort = function(node, visited, temp, graph, result) { - var neighbors = graph[node] || []; - temp[node] = true; - - for (var i = 0; i < neighbors.length; i += 1) { - var neighbor = neighbors[i]; - - if (temp[neighbor]) { - // skip circular dependencies - continue; - } + destroy: function () + { + var keys = [ + 'binary', + 'bitmapFont', + 'json', + 'physics', + 'shader', + 'audio', + 'video', + 'text', + 'html', + 'obj', + 'tilemap', + 'xml' + ]; - if (!visited[neighbor]) { - Common._topologicalSort(neighbor, visited, temp, graph, result); - } + for (var i = 0; i < keys.length; i++) + { + this[keys[i]].destroy(); + this[keys[i]] = null; } - temp[node] = false; - visited[node] = true; - - result.push(node); - }; - - /** - * Takes _n_ functions as arguments and returns a new function that calls them in order. - * The arguments applied when calling the new function will also be applied to every function passed. - * The value of `this` refers to the last value returned in the chain that was not `undefined`. - * Therefore if a passed function does not return a value, the previously returned value is maintained. - * After all passed functions have been called the new function returns the last returned value (if any). - * If any of the passed functions are a chain, then the chain will be flattened. - * @method chain - * @param ...funcs {function} The functions to chain. - * @return {function} A new function that calls the passed functions in order. - */ - Common.chain = function() { - var funcs = []; - - for (var i = 0; i < arguments.length; i += 1) { - var func = arguments[i]; - - if (func._chained) { - // flatten already chained functions - funcs.push.apply(funcs, func._chained); - } else { - funcs.push(func); - } + for (var key in this.custom) + { + this.custom[key].destroy(); } - var chain = function() { - // https://github.com/GoogleChrome/devtools-docs/issues/53#issuecomment-51941358 - var lastResult, - args = new Array(arguments.length); + this.custom = null; - for (var i = 0, l = arguments.length; i < l; i++) { - args[i] = arguments[i]; - } + this.game = null; + } - for (i = 0; i < funcs.length; i += 1) { - var result = funcs[i].apply(lastResult, args); +}); - if (typeof result !== 'undefined') { - lastResult = result; - } - } +module.exports = CacheManager; - return lastResult; - }; - chain._chained = funcs; +/***/ }), - return chain; - }; +/***/ 94762: +/***/ ((module) => { - /** - * Chains a function to excute before the original function on the given `path` relative to `base`. - * See also docs for `Common.chain`. - * @method chainPathBefore - * @param {} base The base object - * @param {string} path The path relative to `base` - * @param {function} func The function to chain before the original - * @return {function} The chained function that replaced the original - */ - Common.chainPathBefore = function(base, path, func) { - return Common.set(base, path, Common.chain( - func, - Common.get(base, path) - )); - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Chains a function to excute after the original function on the given `path` relative to `base`. - * See also docs for `Common.chain`. - * @method chainPathAfter - * @param {} base The base object - * @param {string} path The path relative to `base` - * @param {function} func The function to chain after the original - * @return {function} The chained function that replaced the original - */ - Common.chainPathAfter = function(base, path, func) { - return Common.set(base, path, Common.chain( - Common.get(base, path), - func - )); - }; -})(); +/** + * The Cache Add Event. + * + * This event is dispatched by any Cache that extends the BaseCache each time a new object is added to it. + * + * @event Phaser.Cache.Events#ADD + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Cache.BaseCache} cache - The cache to which the object was added. + * @param {string} key - The key of the object added to the cache. + * @param {*} object - A reference to the object that was added to the cache. + */ +module.exports = 'add'; /***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 75968: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Global constants. + * The Cache Remove Event. * - * @ignore + * This event is dispatched by any Cache that extends the BaseCache each time an object is removed from it. + * + * @event Phaser.Cache.Events#REMOVE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Cache.BaseCache} cache - The cache from which the object was removed. + * @param {string} key - The key of the object removed from the cache. + * @param {*} object - A reference to the object that was removed from the cache. */ +module.exports = 'remove'; -var CONST = { - /** - * Phaser Release Version - * - * @name Phaser.VERSION - * @const - * @type {string} - * @since 3.0.0 - */ - VERSION: '3.55.2', +/***/ }), - BlendModes: __webpack_require__(35), +/***/ 69773: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - ScaleModes: __webpack_require__(168), +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * This setting will auto-detect if the browser is capable of suppporting WebGL. - * If it is, it will use the WebGL Renderer. If not, it will fall back to the Canvas Renderer. - * - * @name Phaser.AUTO - * @const - * @type {number} - * @since 3.0.0 - */ - AUTO: 0, +/** + * @namespace Phaser.Cache.Events + */ - /** - * Forces Phaser to only use the Canvas Renderer, regardless if the browser supports - * WebGL or not. - * - * @name Phaser.CANVAS - * @const - * @type {number} - * @since 3.0.0 - */ - CANVAS: 1, +module.exports = { - /** - * Forces Phaser to use the WebGL Renderer. If the browser does not support it, there is - * no fallback to Canvas with this setting, so you should trap it and display a suitable - * message to the user. - * - * @name Phaser.WEBGL - * @const - * @type {number} - * @since 3.0.0 - */ - WEBGL: 2, + ADD: __webpack_require__(94762), + REMOVE: __webpack_require__(75968) - /** - * A Headless Renderer doesn't create either a Canvas or WebGL Renderer. However, it still - * absolutely relies on the DOM being present and available. This mode is meant for unit testing, - * not for running Phaser on the server, which is something you really shouldn't do. - * - * @name Phaser.HEADLESS - * @const - * @type {number} - * @since 3.0.0 - */ - HEADLESS: 3, +}; - /** - * In Phaser the value -1 means 'forever' in lots of cases, this const allows you to use it instead - * to help you remember what the value is doing in your code. - * - * @name Phaser.FOREVER - * @const - * @type {number} - * @since 3.0.0 - */ - FOREVER: -1, - /** - * Direction constant. - * - * @name Phaser.NONE - * @const - * @type {number} - * @since 3.0.0 - */ - NONE: 4, +/***/ }), - /** - * Direction constant. - * - * @name Phaser.UP - * @const - * @type {number} - * @since 3.0.0 - */ - UP: 5, +/***/ 45820: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Direction constant. - * - * @name Phaser.DOWN - * @const - * @type {number} - * @since 3.0.0 - */ - DOWN: 6, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Direction constant. - * - * @name Phaser.LEFT - * @const - * @type {number} - * @since 3.0.0 - */ - LEFT: 7, +/** + * @namespace Phaser.Cache + */ - /** - * Direction constant. - * - * @name Phaser.RIGHT - * @const - * @type {number} - * @since 3.0.0 - */ - RIGHT: 8 +module.exports = { -}; + BaseCache: __webpack_require__(23740), + CacheManager: __webpack_require__(43474), + Events: __webpack_require__(69773) -module.exports = CONST; +}; /***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 51052: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(15); -var Line = __webpack_require__(47); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var DegToRad = __webpack_require__(75606); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(89787); +var Rectangle = __webpack_require__(74118); +var TransformMatrix = __webpack_require__(69360); +var ValueToColor = __webpack_require__(93222); +var Vector2 = __webpack_require__(93736); /** * @classdesc - * The Shape Game Object is a base class for the various different shapes, such as the Arc, Star or Polygon. - * You cannot add a Shape directly to your Scene, it is meant as a base for your own custom Shape classes. + * A Base Camera class. * - * @class Shape - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects + * The Camera is the way in which all games are rendered in Phaser. They provide a view into your game world, + * and can be positioned, rotated, zoomed and scrolled accordingly. + * + * A Camera consists of two elements: The viewport and the scroll values. + * + * The viewport is the physical position and size of the Camera within your game. Cameras, by default, are + * created the same size as your game, but their position and size can be set to anything. This means if you + * wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game, + * you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`). + * + * If you wish to change where the Camera is looking in your game, then you scroll it. You can do this + * via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the + * viewport, and changing the viewport has no impact on the scrolling. + * + * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, + * allowing you to filter Game Objects out on a per-Camera basis. + * + * The Base Camera is extended by the Camera class, which adds in special effects including Fade, + * Flash and Camera Shake, as well as the ability to follow Game Objects. + * + * The Base Camera was introduced in Phaser 3.12. It was split off from the Camera class, to allow + * you to isolate special effects as needed. Therefore the 'since' values for properties of this class relate + * to when they were added to the Camera class. + * + * @class BaseCamera + * @memberof Phaser.Cameras.Scene2D * @constructor - * @since 3.13.0 + * @since 3.12.0 * - * @extends Phaser.GameObjects.Components.AlphaSingle - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.Events.EventEmitter + * @extends Phaser.GameObjects.Components.Alpha * @extends Phaser.GameObjects.Components.Visible * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {string} [type] - The internal type of the Shape. - * @param {any} [data] - The data of the source shape geometry, if any. + * @param {number} x - The x position of the Camera, relative to the top-left of the game canvas. + * @param {number} y - The y position of the Camera, relative to the top-left of the game canvas. + * @param {number} width - The width of the Camera, in pixels. + * @param {number} height - The height of the Camera, in pixels. */ -var Shape = new Class({ +var BaseCamera = new Class({ - Extends: GameObject, + Extends: EventEmitter, Mixins: [ Components.AlphaSingle, - Components.BlendMode, - Components.Depth, - Components.GetBounds, - Components.Mask, - Components.Origin, - Components.Pipeline, - Components.ScrollFactor, - Components.Transform, Components.Visible ], initialize: - function Shape (scene, type, data) + function BaseCamera (x, y, width, height) { - if (type === undefined) { type = 'Shape'; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 0; } + if (height === undefined) { height = 0; } - GameObject.call(this, scene, type); + EventEmitter.call(this); /** - * The source Shape data. Typically a geometry object. - * You should not manipulate this directly. + * A reference to the Scene this camera belongs to. * - * @name Phaser.GameObjects.Shape#geom - * @type {any} - * @readonly - * @since 3.13.0 + * @name Phaser.Cameras.Scene2D.BaseCamera#scene + * @type {Phaser.Scene} + * @since 3.0.0 */ - this.geom = data; + this.scene; /** - * Holds the polygon path data for filled rendering. + * A reference to the Game Scene Manager. * - * @name Phaser.GameObjects.Shape#pathData - * @type {number[]} - * @readonly - * @since 3.13.0 + * @name Phaser.Cameras.Scene2D.BaseCamera#sceneManager + * @type {Phaser.Scenes.SceneManager} + * @since 3.12.0 */ - this.pathData = []; + this.sceneManager; /** - * Holds the earcut polygon path index data for filled rendering. + * A reference to the Game Scale Manager. * - * @name Phaser.GameObjects.Shape#pathIndexes - * @type {number[]} - * @readonly - * @since 3.13.0 + * @name Phaser.Cameras.Scene2D.BaseCamera#scaleManager + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 */ - this.pathIndexes = []; + this.scaleManager; /** - * The fill color used by this Shape. + * A reference to the Scene's Camera Manager to which this Camera belongs. * - * @name Phaser.GameObjects.Shape#fillColor - * @type {number} - * @since 3.13.0 + * @name Phaser.Cameras.Scene2D.BaseCamera#cameraManager + * @type {Phaser.Cameras.Scene2D.CameraManager} + * @since 3.17.0 */ - this.fillColor = 0xffffff; + this.cameraManager; /** - * The fill alpha value used by this Shape. + * The Camera ID. Assigned by the Camera Manager and used to handle camera exclusion. + * This value is a bitmask. * - * @name Phaser.GameObjects.Shape#fillAlpha + * @name Phaser.Cameras.Scene2D.BaseCamera#id * @type {number} - * @since 3.13.0 + * @readonly + * @since 3.11.0 */ - this.fillAlpha = 1; + this.id = 0; /** - * The stroke color used by this Shape. + * The name of the Camera. This is left empty for your own use. * - * @name Phaser.GameObjects.Shape#strokeColor - * @type {number} - * @since 3.13.0 + * @name Phaser.Cameras.Scene2D.BaseCamera#name + * @type {string} + * @default '' + * @since 3.0.0 */ - this.strokeColor = 0xffffff; + this.name = ''; /** - * The stroke alpha value used by this Shape. + * Should this camera round its pixel values to integers? * - * @name Phaser.GameObjects.Shape#strokeAlpha - * @type {number} - * @since 3.13.0 + * @name Phaser.Cameras.Scene2D.BaseCamera#roundPixels + * @type {boolean} + * @default false + * @since 3.0.0 */ - this.strokeAlpha = 1; + this.roundPixels = false; /** - * The stroke line width used by this Shape. + * Is this Camera visible or not? * - * @name Phaser.GameObjects.Shape#lineWidth - * @type {number} - * @since 3.13.0 + * A visible camera will render and perform input tests. + * An invisible camera will not render anything and will skip input tests. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#visible + * @type {boolean} + * @default true + * @since 3.10.0 */ - this.lineWidth = 1; /** - * Controls if this Shape is filled or not. - * Note that some Shapes do not support being filled (such as Line shapes) + * Is this Camera using a bounds to restrict scrolling movement? * - * @name Phaser.GameObjects.Shape#isFilled + * Set this property along with the bounds via `Camera.setBounds`. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#useBounds * @type {boolean} - * @since 3.13.0 + * @default false + * @since 3.0.0 */ - this.isFilled = false; + this.useBounds = false; /** - * Controls if this Shape is stroked or not. - * Note that some Shapes do not support being stroked (such as Iso Box shapes) + * The World View is a Rectangle that defines the area of the 'world' the Camera is currently looking at. + * This factors in the Camera viewport size, zoom and scroll position and is updated in the Camera preRender step. + * If you have enabled Camera bounds the worldview will be clamped to those bounds accordingly. + * You can use it for culling or intersection checks. * - * @name Phaser.GameObjects.Shape#isStroked - * @type {boolean} - * @since 3.13.0 + * @name Phaser.Cameras.Scene2D.BaseCamera#worldView + * @type {Phaser.Geom.Rectangle} + * @readonly + * @since 3.11.0 */ - this.isStroked = false; + this.worldView = new Rectangle(); /** - * Controls if this Shape path is closed during rendering when stroked. - * Note that some Shapes are always closed when stroked (such as Ellipse shapes) + * Is this Camera dirty? * - * @name Phaser.GameObjects.Shape#closePath + * A dirty Camera has had either its viewport size, bounds, scroll, rotation or zoom levels changed since the last frame. + * + * This flag is cleared during the `postRenderCamera` method of the renderer. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#dirty * @type {boolean} - * @since 3.13.0 + * @default true + * @since 3.11.0 */ - this.closePath = true; + this.dirty = true; /** - * Private internal value. - * A Line used when parsing internal path data to avoid constant object re-creation. + * The x position of the Camera viewport, relative to the top-left of the game canvas. + * The viewport is the area into which the camera renders. + * To adjust the position the camera is looking at in the game world, see the `scrollX` value. * - * @name Phaser.GameObjects.Shape#_tempLine - * @type {Phaser.Geom.Line} + * @name Phaser.Cameras.Scene2D.BaseCamera#_x + * @type {number} * @private - * @since 3.13.0 + * @since 3.0.0 */ - this._tempLine = new Line(); + this._x = x; /** - * The native (un-scaled) width of this Game Object. + * The y position of the Camera, relative to the top-left of the game canvas. + * The viewport is the area into which the camera renders. + * To adjust the position the camera is looking at in the game world, see the `scrollY` value. * - * Changing this value will not change the size that the Game Object is rendered in-game. - * For that you need to either set the scale of the Game Object (`setScale`) or use - * the `displayWidth` property. + * @name Phaser.Cameras.Scene2D.BaseCamera#_y + * @type {number} + * @private + * @since 3.0.0 + */ + this._y = y; + + /** + * The width of the Camera viewport, in pixels. * - * @name Phaser.GameObjects.Shape#width + * The viewport is the area into which the Camera renders. Setting the viewport does + * not restrict where the Camera can scroll to. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_width * @type {number} - * @since 3.13.0 + * @private + * @since 3.11.0 */ - this.width = 0; + this._width = width; /** - * The native (un-scaled) height of this Game Object. + * The height of the Camera viewport, in pixels. * - * Changing this value will not change the size that the Game Object is rendered in-game. - * For that you need to either set the scale of the Game Object (`setScale`) or use - * the `displayHeight` property. + * The viewport is the area into which the Camera renders. Setting the viewport does + * not restrict where the Camera can scroll to. * - * @name Phaser.GameObjects.Shape#height + * @name Phaser.Cameras.Scene2D.BaseCamera#_height * @type {number} - * @since 3.0.0 + * @private + * @since 3.11.0 */ - this.height = 0; + this._height = height; - this.initPipeline(); - }, + /** + * The bounds the camera is restrained to during scrolling. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_bounds + * @type {Phaser.Geom.Rectangle} + * @private + * @since 3.0.0 + */ + this._bounds = new Rectangle(); - /** - * Sets the fill color and alpha for this Shape. - * - * If you wish for the Shape to not be filled then call this method with no arguments, or just set `isFilled` to `false`. - * - * Note that some Shapes do not support fill colors, such as the Line shape. - * - * This call can be chained. - * - * @method Phaser.GameObjects.Shape#setFillStyle - * @since 3.13.0 - * - * @param {number} [color] - The color used to fill this shape. If not provided the Shape will not be filled. - * @param {number} [alpha=1] - The alpha value used when filling this shape, if a fill color is given. - * - * @return {this} This Game Object instance. - */ - setFillStyle: function (color, alpha) - { - if (alpha === undefined) { alpha = 1; } + /** + * The horizontal scroll position of this Camera. + * + * Change this value to cause the Camera to scroll around your Scene. + * + * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, + * will automatically adjust the Camera scroll values accordingly. + * + * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollX + * @type {number} + * @private + * @default 0 + * @since 3.11.0 + */ + this._scrollX = 0; - if (color === undefined) - { - this.isFilled = false; - } - else - { - this.fillColor = color; - this.fillAlpha = alpha; - this.isFilled = true; - } + /** + * The vertical scroll position of this Camera. + * + * Change this value to cause the Camera to scroll around your Scene. + * + * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, + * will automatically adjust the Camera scroll values accordingly. + * + * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollY + * @type {number} + * @private + * @default 0 + * @since 3.11.0 + */ + this._scrollY = 0; - return this; - }, + /** + * The Camera horizontal zoom value. Change this value to zoom in, or out of, a Scene. + * + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. + * + * Set to 1 to return to the default zoom level. + * + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_zoomX + * @type {number} + * @private + * @default 1 + * @since 3.50.0 + */ + this._zoomX = 1; - /** - * Sets the stroke color and alpha for this Shape. - * - * If you wish for the Shape to not be stroked then call this method with no arguments, or just set `isStroked` to `false`. - * - * Note that some Shapes do not support being stroked, such as the Iso Box shape. - * - * This call can be chained. - * - * @method Phaser.GameObjects.Shape#setStrokeStyle - * @since 3.13.0 - * - * @param {number} [lineWidth] - The width of line to stroke with. If not provided or undefined the Shape will not be stroked. - * @param {number} [color] - The color used to stroke this shape. If not provided the Shape will not be stroked. - * @param {number} [alpha=1] - The alpha value used when stroking this shape, if a stroke color is given. - * - * @return {this} This Game Object instance. - */ - setStrokeStyle: function (lineWidth, color, alpha) - { - if (alpha === undefined) { alpha = 1; } - - if (lineWidth === undefined) - { - this.isStroked = false; - } - else - { - this.lineWidth = lineWidth; - this.strokeColor = color; - this.strokeAlpha = alpha; - this.isStroked = true; - } - - return this; - }, - - /** - * Sets if this Shape path is closed during rendering when stroked. - * Note that some Shapes are always closed when stroked (such as Ellipse shapes) - * - * This call can be chained. - * - * @method Phaser.GameObjects.Shape#setClosePath - * @since 3.13.0 - * - * @param {boolean} value - Set to `true` if the Shape should be closed when stroked, otherwise `false`. - * - * @return {this} This Game Object instance. - */ - setClosePath: function (value) - { - this.closePath = value; - - return this; - }, - - /** - * Sets the internal size of this Game Object, as used for frame or physics body creation. - * - * This will not change the size that the Game Object is rendered in-game. - * For that you need to either set the scale of the Game Object (`setScale`) or call the - * `setDisplaySize` method, which is the same thing as changing the scale but allows you - * to do so by giving pixel values. - * - * If you have enabled this Game Object for input, changing the size will _not_ change the - * size of the hit area. To do this you should adjust the `input.hitArea` object directly. - * - * @method Phaser.GameObjects.Shape#setSize - * @private - * @since 3.13.0 - * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. - * - * @return {this} This Game Object instance. - */ - setSize: function (width, height) - { - this.width = width; - this.height = height; - - return this; - }, - - /** - * Sets the display size of this Shape. - * - * Calling this will adjust the scale. - * - * @method Phaser.GameObjects.Shape#setDisplaySize - * @since 3.53.0 - * - * @param {number} width - The display width of this Shape. - * @param {number} height - The display height of this Shape. - * - * @return {this} This Shape instance. - */ - setDisplaySize: function (width, height) - { - this.displayWidth = width; - this.displayHeight = height; - - return this; - }, - - /** - * Internal destroy handler, called as part of the destroy process. - * - * @method Phaser.GameObjects.Shape#preDestroy - * @protected - * @since 3.13.0 - */ - preDestroy: function () - { - this.geom = null; - this._tempLine = null; - this.pathData = []; - this.pathIndexes = []; - }, - - /** - * The displayed width of this Game Object. - * - * This value takes into account the scale factor. - * - * Setting this value will adjust the Game Object's scale property. - * - * @name Phaser.GameObjects.Shape#displayWidth - * @type {number} - * @since 3.13.0 - */ - displayWidth: { - - get: function () - { - return this.scaleX * this.width; - }, - - set: function (value) - { - this.scaleX = value / this.width; - } - - }, - - /** - * The displayed height of this Game Object. - * - * This value takes into account the scale factor. - * - * Setting this value will adjust the Game Object's scale property. - * - * @name Phaser.GameObjects.Shape#displayHeight - * @type {number} - * @since 3.13.0 - */ - displayHeight: { - - get: function () - { - return this.scaleY * this.height; - }, - - set: function (value) - { - this.scaleY = value / this.height; - } - - } - -}); - -module.exports = Shape; - - -/***/ }), -/* 35 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Phaser Blend Modes. - * - * @namespace Phaser.BlendModes - * @since 3.0.0 - */ - -module.exports = { - - /** - * Skips the Blend Mode check in the renderer. - * - * @name Phaser.BlendModes.SKIP_CHECK - * @type {number} - * @const - * @since 3.0.0 - */ - SKIP_CHECK: -1, - - /** - * Normal blend mode. For Canvas and WebGL. - * This is the default setting and draws new shapes on top of the existing canvas content. - * - * @name Phaser.BlendModes.NORMAL - * @type {number} - * @const - * @since 3.0.0 - */ - NORMAL: 0, - - /** - * Add blend mode. For Canvas and WebGL. - * Where both shapes overlap the color is determined by adding color values. - * - * @name Phaser.BlendModes.ADD - * @type {number} - * @const - * @since 3.0.0 - */ - ADD: 1, - - /** - * Multiply blend mode. For Canvas and WebGL. - * The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. - * - * @name Phaser.BlendModes.MULTIPLY - * @type {number} - * @const - * @since 3.0.0 - */ - MULTIPLY: 2, - - /** - * Screen blend mode. For Canvas and WebGL. - * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) - * - * @name Phaser.BlendModes.SCREEN - * @type {number} - * @const - * @since 3.0.0 - */ - SCREEN: 3, - - /** - * Overlay blend mode. For Canvas only. - * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter. - * - * @name Phaser.BlendModes.OVERLAY - * @type {number} - * @const - * @since 3.0.0 - */ - OVERLAY: 4, - - /** - * Darken blend mode. For Canvas only. - * Retains the darkest pixels of both layers. - * - * @name Phaser.BlendModes.DARKEN - * @type {number} - * @const - * @since 3.0.0 - */ - DARKEN: 5, - - /** - * Lighten blend mode. For Canvas only. - * Retains the lightest pixels of both layers. - * - * @name Phaser.BlendModes.LIGHTEN - * @type {number} - * @const - * @since 3.0.0 - */ - LIGHTEN: 6, - - /** - * Color Dodge blend mode. For Canvas only. - * Divides the bottom layer by the inverted top layer. - * - * @name Phaser.BlendModes.COLOR_DODGE - * @type {number} - * @const - * @since 3.0.0 - */ - COLOR_DODGE: 7, - - /** - * Color Burn blend mode. For Canvas only. - * Divides the inverted bottom layer by the top layer, and then inverts the result. - * - * @name Phaser.BlendModes.COLOR_BURN - * @type {number} - * @const - * @since 3.0.0 - */ - COLOR_BURN: 8, - - /** - * Hard Light blend mode. For Canvas only. - * A combination of multiply and screen like overlay, but with top and bottom layer swapped. - * - * @name Phaser.BlendModes.HARD_LIGHT - * @type {number} - * @const - * @since 3.0.0 - */ - HARD_LIGHT: 9, - - /** - * Soft Light blend mode. For Canvas only. - * A softer version of hard-light. Pure black or white does not result in pure black or white. - * - * @name Phaser.BlendModes.SOFT_LIGHT - * @type {number} - * @const - * @since 3.0.0 - */ - SOFT_LIGHT: 10, - - /** - * Difference blend mode. For Canvas only. - * Subtracts the bottom layer from the top layer or the other way round to always get a positive value. - * - * @name Phaser.BlendModes.DIFFERENCE - * @type {number} - * @const - * @since 3.0.0 - */ - DIFFERENCE: 11, - - /** - * Exclusion blend mode. For Canvas only. - * Like difference, but with lower contrast. - * - * @name Phaser.BlendModes.EXCLUSION - * @type {number} - * @const - * @since 3.0.0 - */ - EXCLUSION: 12, - - /** - * Hue blend mode. For Canvas only. - * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer. - * - * @name Phaser.BlendModes.HUE - * @type {number} - * @const - * @since 3.0.0 - */ - HUE: 13, - - /** - * Saturation blend mode. For Canvas only. - * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer. - * - * @name Phaser.BlendModes.SATURATION - * @type {number} - * @const - * @since 3.0.0 - */ - SATURATION: 14, - - /** - * Color blend mode. For Canvas only. - * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer. - * - * @name Phaser.BlendModes.COLOR - * @type {number} - * @const - * @since 3.0.0 - */ - COLOR: 15, - - /** - * Luminosity blend mode. For Canvas only. - * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer. - * - * @name Phaser.BlendModes.LUMINOSITY - * @type {number} - * @const - * @since 3.0.0 - */ - LUMINOSITY: 16, - - /** - * Alpha erase blend mode. For Canvas and WebGL. - * - * @name Phaser.BlendModes.ERASE - * @type {number} - * @const - * @since 3.0.0 - */ - ERASE: 17, - - /** - * Source-in blend mode. For Canvas only. - * The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent. - * - * @name Phaser.BlendModes.SOURCE_IN - * @type {number} - * @const - * @since 3.0.0 - */ - SOURCE_IN: 18, - - /** - * Source-out blend mode. For Canvas only. - * The new shape is drawn where it doesn't overlap the existing canvas content. - * - * @name Phaser.BlendModes.SOURCE_OUT - * @type {number} - * @const - * @since 3.0.0 - */ - SOURCE_OUT: 19, - - /** - * Source-out blend mode. For Canvas only. - * The new shape is only drawn where it overlaps the existing canvas content. - * - * @name Phaser.BlendModes.SOURCE_ATOP - * @type {number} - * @const - * @since 3.0.0 - */ - SOURCE_ATOP: 20, - - /** - * Destination-over blend mode. For Canvas only. - * New shapes are drawn behind the existing canvas content. - * - * @name Phaser.BlendModes.DESTINATION_OVER - * @type {number} - * @const - * @since 3.0.0 - */ - DESTINATION_OVER: 21, - - /** - * Destination-in blend mode. For Canvas only. - * The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent. - * - * @name Phaser.BlendModes.DESTINATION_IN - * @type {number} - * @const - * @since 3.0.0 - */ - DESTINATION_IN: 22, - - /** - * Destination-out blend mode. For Canvas only. - * The existing content is kept where it doesn't overlap the new shape. - * - * @name Phaser.BlendModes.DESTINATION_OUT - * @type {number} - * @const - * @since 3.0.0 - */ - DESTINATION_OUT: 23, - - /** - * Destination-out blend mode. For Canvas only. - * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content. - * - * @name Phaser.BlendModes.DESTINATION_ATOP - * @type {number} - * @const - * @since 3.0.0 - */ - DESTINATION_ATOP: 24, - - /** - * Lighten blend mode. For Canvas only. - * Where both shapes overlap the color is determined by adding color values. - * - * @name Phaser.BlendModes.LIGHTER - * @type {number} - * @const - * @since 3.0.0 - */ - LIGHTER: 25, - - /** - * Copy blend mode. For Canvas only. - * Only the new shape is shown. - * - * @name Phaser.BlendModes.COPY - * @type {number} - * @const - * @since 3.0.0 - */ - COPY: 26, - - /** - * Xor blend mode. For Canvas only. - * Shapes are made transparent where both overlap and drawn normal everywhere else. - * - * @name Phaser.BlendModes.XOR - * @type {number} - * @const - * @since 3.0.0 - */ - XOR: 27 - -}; - - -/***/ }), -/* 36 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CONST = __webpack_require__(14); - -/** - * Convert the given angle from degrees, to the equivalent angle in radians. - * - * @function Phaser.Math.DegToRad - * @since 3.0.0 - * - * @param {number} degrees - The angle (in degrees) to convert to radians. - * - * @return {number} The given angle converted to radians. - */ -var DegToRad = function (degrees) -{ - return degrees * CONST.DEG_TO_RAD; -}; - -module.exports = DegToRad; - - -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Cameras.Scene2D.Events - */ - -module.exports = { - - DESTROY: __webpack_require__(743), - FADE_IN_COMPLETE: __webpack_require__(744), - FADE_IN_START: __webpack_require__(745), - FADE_OUT_COMPLETE: __webpack_require__(746), - FADE_OUT_START: __webpack_require__(747), - FLASH_COMPLETE: __webpack_require__(748), - FLASH_START: __webpack_require__(749), - FOLLOW_UPDATE: __webpack_require__(750), - PAN_COMPLETE: __webpack_require__(751), - PAN_START: __webpack_require__(752), - POST_RENDER: __webpack_require__(753), - PRE_RENDER: __webpack_require__(754), - ROTATE_COMPLETE: __webpack_require__(755), - ROTATE_START: __webpack_require__(756), - SHAKE_COMPLETE: __webpack_require__(757), - SHAKE_START: __webpack_require__(758), - ZOOM_COMPLETE: __webpack_require__(759), - ZOOM_START: __webpack_require__(760) - -}; - - -/***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var GetColor = __webpack_require__(103); -var GetColor32 = __webpack_require__(328); -var HSVToRGB = __webpack_require__(188); -var RGBToHSV = __webpack_require__(329); - -/** - * @namespace Phaser.Display.Color - */ - -/** - * @classdesc - * The Color class holds a single color value and allows for easy modification and reading of it. - * - * @class Color - * @memberof Phaser.Display - * @constructor - * @since 3.0.0 - * - * @param {number} [red=0] - The red color value. A number between 0 and 255. - * @param {number} [green=0] - The green color value. A number between 0 and 255. - * @param {number} [blue=0] - The blue color value. A number between 0 and 255. - * @param {number} [alpha=255] - The alpha value. A number between 0 and 255. - */ -var Color = new Class({ - - initialize: - - function Color (red, green, blue, alpha) - { - if (red === undefined) { red = 0; } - if (green === undefined) { green = 0; } - if (blue === undefined) { blue = 0; } - if (alpha === undefined) { alpha = 255; } + /** + * The Camera vertical zoom value. Change this value to zoom in, or out of, a Scene. + * + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. + * + * Set to 1 to return to the default zoom level. + * + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_zoomY + * @type {number} + * @private + * @default 1 + * @since 3.50.0 + */ + this._zoomY = 1; /** - * The internal red color value. + * The rotation of the Camera in radians. * - * @name Phaser.Display.Color#r + * Camera rotation always takes place based on the Camera viewport. By default, rotation happens + * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. + * + * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not + * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_rotation * @type {number} * @private * @default 0 - * @since 3.0.0 + * @since 3.11.0 */ - this.r = 0; + this._rotation = 0; /** - * The internal green color value. + * A local transform matrix used for internal calculations. * - * @name Phaser.Display.Color#g - * @type {number} + * @name Phaser.Cameras.Scene2D.BaseCamera#matrix + * @type {Phaser.GameObjects.Components.TransformMatrix} * @private - * @default 0 * @since 3.0.0 */ - this.g = 0; + this.matrix = new TransformMatrix(); /** - * The internal blue color value. + * Does this Camera have a transparent background? * - * @name Phaser.Display.Color#b - * @type {number} - * @private - * @default 0 + * @name Phaser.Cameras.Scene2D.BaseCamera#transparent + * @type {boolean} + * @default true * @since 3.0.0 */ - this.b = 0; + this.transparent = true; /** - * The internal alpha color value. + * The background color of this Camera. Only used if `transparent` is `false`. * - * @name Phaser.Display.Color#a - * @type {number} - * @private - * @default 255 + * @name Phaser.Cameras.Scene2D.BaseCamera#backgroundColor + * @type {Phaser.Display.Color} * @since 3.0.0 */ - this.a = 255; + this.backgroundColor = ValueToColor('rgba(0,0,0,0)'); /** - * The hue color value. A number between 0 and 1. - * This is the base color. + * The Camera alpha value. Setting this property impacts every single object that this Camera + * renders. You can either set the property directly, i.e. via a Tween, to fade a Camera in or out, + * or via the chainable `setAlpha` method instead. * - * @name Phaser.Display.Color#_h + * @name Phaser.Cameras.Scene2D.BaseCamera#alpha * @type {number} - * @default 0 + * @default 1 + * @since 3.11.0 + */ + + /** + * Should the camera cull Game Objects before checking them for input hit tests? + * In some special cases it may be beneficial to disable this. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#disableCull + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.disableCull = false; + + /** + * A temporary array of culled objects. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#culledObjects + * @type {Phaser.GameObjects.GameObject[]} + * @default [] * @private - * @since 3.13.0 + * @since 3.0.0 */ - this._h = 0; + this.culledObjects = []; /** - * The saturation color value. A number between 0 and 1. - * This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white. + * The mid-point of the Camera in 'world' coordinates. * - * @name Phaser.Display.Color#_s + * Use it to obtain exactly where in the world the center of the camera is currently looking. + * + * This value is updated in the preRender method, after the scroll values and follower + * have been processed. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#midPoint + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.11.0 + */ + this.midPoint = new Vector2(width / 2, height / 2); + + /** + * The horizontal origin of rotation for this Camera. + * + * By default the camera rotates around the center of the viewport. + * + * Changing the origin allows you to adjust the point in the viewport from which rotation happens. + * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. + * + * See `setOrigin` to set both origins in a single, chainable call. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#originX * @type {number} - * @default 0 - * @private - * @since 3.13.0 + * @default 0.5 + * @since 3.11.0 */ - this._s = 0; + this.originX = 0.5; /** - * The lightness color value. A number between 0 and 1. - * This controls how dark the color is. Where 1 is as bright as possible and 0 is black. + * The vertical origin of rotation for this Camera. * - * @name Phaser.Display.Color#_v + * By default the camera rotates around the center of the viewport. + * + * Changing the origin allows you to adjust the point in the viewport from which rotation happens. + * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. + * + * See `setOrigin` to set both origins in a single, chainable call. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#originY * @type {number} - * @default 0 - * @private - * @since 3.13.0 + * @default 0.5 + * @since 3.11.0 */ - this._v = 0; + this.originY = 0.5; /** - * Is this color update locked? + * Does this Camera have a custom viewport? * - * @name Phaser.Display.Color#_locked + * @name Phaser.Cameras.Scene2D.BaseCamera#_customViewport * @type {boolean} * @private - * @since 3.13.0 + * @default false + * @since 3.12.0 */ - this._locked = false; + this._customViewport = false; /** - * An array containing the calculated color values for WebGL use. + * The Mask this Camera is using during render. + * Set the mask using the `setMask` method. Remove the mask using the `clearMask` method. * - * @name Phaser.Display.Color#gl - * @type {number[]} - * @since 3.0.0 + * @name Phaser.Cameras.Scene2D.BaseCamera#mask + * @type {?(Phaser.Display.Masks.BitmapMask|Phaser.Display.Masks.GeometryMask)} + * @since 3.17.0 */ - this.gl = [ 0, 0, 0, 1 ]; + this.mask = null; /** - * Pre-calculated internal color value. + * The Camera that this Camera uses for translation during masking. * - * @name Phaser.Display.Color#_color - * @type {number} + * If the mask is fixed in position this will be a reference to + * the CameraManager.default instance. Otherwise, it'll be a reference + * to itself. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#_maskCamera + * @type {?Phaser.Cameras.Scene2D.BaseCamera} * @private - * @default 0 - * @since 3.0.0 + * @since 3.17.0 */ - this._color = 0; + this._maskCamera = null; /** - * Pre-calculated internal color32 value. + * This array is populated with all of the Game Objects that this Camera has rendered + * in the previous (or current, depending on when you inspect it) frame. * - * @name Phaser.Display.Color#_color32 - * @type {number} - * @private - * @default 0 - * @since 3.0.0 + * It is cleared at the start of `Camera.preUpdate`, or if the Camera is destroyed. + * + * You should not modify this array as it is used internally by the input system, + * however you can read it as required. Note that Game Objects may appear in this + * list multiple times if they belong to multiple non-exclusive Containers. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#renderList + * @type {Phaser.GameObjects.GameObject[]} + * @since 3.52.0 */ - this._color32 = 0; + this.renderList = []; /** - * Pre-calculated internal color rgb string value. + * Is this Camera a Scene Camera? (which is the default), or a Camera + * belonging to a Texture? * - * @name Phaser.Display.Color#_rgba - * @type {string} - * @private - * @default '' - * @since 3.0.0 + * @name Phaser.Cameras.Scene2D.BaseCamera#isSceneCamera + * @type {boolean} + * @default true + * @since 3.60.0 */ - this._rgba = ''; - - this.setTo(red, green, blue, alpha); + this.isSceneCamera = true; }, /** - * Sets this color to be transparent. Sets all values to zero. + * Adds the given Game Object to this cameras render list. * - * @method Phaser.Display.Color#transparent - * @since 3.0.0 + * This is invoked during the rendering stage. Only objects that are actually rendered + * will appear in the render list. * - * @return {Phaser.Display.Color} This Color object. + * @method Phaser.Cameras.Scene2D.BaseCamera#addToRenderList + * @since 3.52.0 + * + * @param {Phaser.GameObjects.GameObject} child - The Game Object to add to the render list. */ - transparent: function () + addToRenderList: function (child) { - this._locked = true; + this.renderList.push(child); + }, - this.red = 0; - this.green = 0; - this.blue = 0; - this.alpha = 0; + /** + * Set the Alpha level of this Camera. The alpha controls the opacity of the Camera as it renders. + * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setAlpha + * @since 3.11.0 + * + * @param {number} [value=1] - The Camera alpha value. + * + * @return {this} This Camera instance. + */ - this._locked = false; + /** + * Sets the rotation origin of this Camera. + * + * The values are given in the range 0 to 1 and are only used when calculating Camera rotation. + * + * By default the camera rotates around the center of the viewport. + * + * Changing the origin allows you to adjust the point in the viewport from which rotation happens. + * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setOrigin + * @since 3.11.0 + * + * @param {number} [x=0.5] - The horizontal origin value. + * @param {number} [y=x] - The vertical origin value. If not defined it will be set to the value of `x`. + * + * @return {this} This Camera instance. + */ + setOrigin: function (x, y) + { + if (x === undefined) { x = 0.5; } + if (y === undefined) { y = x; } - return this.update(true); + this.originX = x; + this.originY = y; + + return this; }, /** - * Sets the color of this Color component. + * Calculates what the Camera.scrollX and scrollY values would need to be in order to move + * the Camera so it is centered on the given x and y coordinates, without actually moving + * the Camera there. The results are clamped based on the Camera bounds, if set. * - * @method Phaser.Display.Color#setTo - * @since 3.0.0 + * @method Phaser.Cameras.Scene2D.BaseCamera#getScroll + * @since 3.11.0 * - * @param {number} red - The red color value. A number between 0 and 255. - * @param {number} green - The green color value. A number between 0 and 255. - * @param {number} blue - The blue color value. A number between 0 and 255. - * @param {number} [alpha=255] - The alpha value. A number between 0 and 255. - * @param {boolean} [updateHSV=true] - Update the HSV values after setting the RGB values? + * @param {number} x - The horizontal coordinate to center on. + * @param {number} y - The vertical coordinate to center on. + * @param {Phaser.Math.Vector2} [out] - A Vector2 to store the values in. If not given a new Vector2 is created. * - * @return {Phaser.Display.Color} This Color object. + * @return {Phaser.Math.Vector2} The scroll coordinates stored in the `x` and `y` properties. */ - setTo: function (red, green, blue, alpha, updateHSV) + getScroll: function (x, y, out) { - if (alpha === undefined) { alpha = 255; } - if (updateHSV === undefined) { updateHSV = true; } + if (out === undefined) { out = new Vector2(); } - this._locked = true; + var originX = this.width * 0.5; + var originY = this.height * 0.5; - this.red = red; - this.green = green; - this.blue = blue; - this.alpha = alpha; + out.x = x - originX; + out.y = y - originY; - this._locked = false; + if (this.useBounds) + { + out.x = this.clampX(out.x); + out.y = this.clampY(out.y); + } - return this.update(updateHSV); + return out; }, /** - * Sets the red, green, blue and alpha GL values of this Color component. + * Moves the Camera horizontally so that it is centered on the given x coordinate, bounds allowing. + * Calling this does not change the scrollY value. * - * @method Phaser.Display.Color#setGLTo - * @since 3.0.0 + * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnX + * @since 3.16.0 * - * @param {number} red - The red color value. A number between 0 and 1. - * @param {number} green - The green color value. A number between 0 and 1. - * @param {number} blue - The blue color value. A number between 0 and 1. - * @param {number} [alpha=1] - The alpha value. A number between 0 and 1. + * @param {number} x - The horizontal coordinate to center on. * - * @return {Phaser.Display.Color} This Color object. + * @return {this} This Camera instance. */ - setGLTo: function (red, green, blue, alpha) + centerOnX: function (x) { - if (alpha === undefined) { alpha = 1; } + var originX = this.width * 0.5; - this._locked = true; + this.midPoint.x = x; - this.redGL = red; - this.greenGL = green; - this.blueGL = blue; - this.alphaGL = alpha; + this.scrollX = x - originX; - this._locked = false; + if (this.useBounds) + { + this.scrollX = this.clampX(this.scrollX); + } - return this.update(true); + return this; }, /** - * Sets the color based on the color object given. + * Moves the Camera vertically so that it is centered on the given y coordinate, bounds allowing. + * Calling this does not change the scrollX value. * - * @method Phaser.Display.Color#setFromRGB - * @since 3.0.0 + * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnY + * @since 3.16.0 * - * @param {Phaser.Types.Display.InputColorObject} color - An object containing `r`, `g`, `b` and optionally `a` values in the range 0 to 255. + * @param {number} y - The vertical coordinate to center on. * - * @return {Phaser.Display.Color} This Color object. + * @return {this} This Camera instance. */ - setFromRGB: function (color) + centerOnY: function (y) { - this._locked = true; + var originY = this.height * 0.5; - this.red = color.r; - this.green = color.g; - this.blue = color.b; + this.midPoint.y = y; - if (color.hasOwnProperty('a')) + this.scrollY = y - originY; + + if (this.useBounds) { - this.alpha = color.a; + this.scrollY = this.clampY(this.scrollY); } - this._locked = false; - - return this.update(true); + return this; }, /** - * Sets the color based on the hue, saturation and lightness values given. + * Moves the Camera so that it is centered on the given coordinates, bounds allowing. * - * @method Phaser.Display.Color#setFromHSV - * @since 3.13.0 + * @method Phaser.Cameras.Scene2D.BaseCamera#centerOn + * @since 3.11.0 * - * @param {number} h - The hue, in the range 0 - 1. This is the base color. - * @param {number} s - The saturation, in the range 0 - 1. This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white. - * @param {number} v - The value, in the range 0 - 1. This controls how dark the color is. Where 1 is as bright as possible and 0 is black. + * @param {number} x - The horizontal coordinate to center on. + * @param {number} y - The vertical coordinate to center on. * - * @return {Phaser.Display.Color} This Color object. + * @return {this} This Camera instance. */ - setFromHSV: function (h, s, v) + centerOn: function (x, y) { - return HSVToRGB(h, s, v, this); + this.centerOnX(x); + this.centerOnY(y); + + return this; }, /** - * Updates the internal cache values. + * Moves the Camera so that it is looking at the center of the Camera Bounds, if enabled. * - * @method Phaser.Display.Color#update - * @private + * @method Phaser.Cameras.Scene2D.BaseCamera#centerToBounds * @since 3.0.0 * - * @return {Phaser.Display.Color} This Color object. + * @return {this} This Camera instance. */ - update: function (updateHSV) + centerToBounds: function () { - if (updateHSV === undefined) { updateHSV = false; } - - if (this._locked) + if (this.useBounds) { - return this; - } - - var r = this.r; - var g = this.g; - var b = this.b; - var a = this.a; + var bounds = this._bounds; + var originX = this.width * 0.5; + var originY = this.height * 0.5; - this._color = GetColor(r, g, b); - this._color32 = GetColor32(r, g, b, a); - this._rgba = 'rgba(' + r + ',' + g + ',' + b + ',' + (a / 255) + ')'; + this.midPoint.set(bounds.centerX, bounds.centerY); - if (updateHSV) - { - RGBToHSV(r, g, b, this); + this.scrollX = bounds.centerX - originX; + this.scrollY = bounds.centerY - originY; } return this; }, /** - * Updates the internal hsv cache values. + * Moves the Camera so that it is re-centered based on its viewport size. * - * @method Phaser.Display.Color#updateHSV - * @private - * @since 3.13.0 + * @method Phaser.Cameras.Scene2D.BaseCamera#centerToSize + * @since 3.0.0 * - * @return {Phaser.Display.Color} This Color object. + * @return {this} This Camera instance. */ - updateHSV: function () + centerToSize: function () { - var r = this.r; - var g = this.g; - var b = this.b; - - RGBToHSV(r, g, b, this); + this.scrollX = this.width * 0.5; + this.scrollY = this.height * 0.5; return this; }, /** - * Returns a new Color component using the values from this one. + * Takes an array of Game Objects and returns a new array featuring only those objects + * visible by this camera. * - * @method Phaser.Display.Color#clone + * @method Phaser.Cameras.Scene2D.BaseCamera#cull * @since 3.0.0 * - * @return {Phaser.Display.Color} A new Color object. - */ - clone: function () - { - return new Color(this.r, this.g, this.b, this.a); - }, - - /** - * Sets this Color object to be grayscaled based on the shade value given. + * @generic {Phaser.GameObjects.GameObject[]} G - [renderableObjects,$return] * - * @method Phaser.Display.Color#gray - * @since 3.13.0 - * - * @param {number} shade - A value between 0 and 255. + * @param {Phaser.GameObjects.GameObject[]} renderableObjects - An array of Game Objects to cull. * - * @return {Phaser.Display.Color} This Color object. + * @return {Phaser.GameObjects.GameObject[]} An array of Game Objects visible to this Camera. */ - gray: function (shade) + cull: function (renderableObjects) { - return this.setTo(shade, shade, shade); - }, + if (this.disableCull) + { + return renderableObjects; + } - /** - * Sets this Color object to be a random color between the `min` and `max` values given. - * - * @method Phaser.Display.Color#random - * @since 3.13.0 - * - * @param {number} [min=0] - The minimum random color value. Between 0 and 255. - * @param {number} [max=255] - The maximum random color value. Between 0 and 255. - * - * @return {Phaser.Display.Color} This Color object. - */ - random: function (min, max) - { - if (min === undefined) { min = 0; } - if (max === undefined) { max = 255; } + var cameraMatrix = this.matrix.matrix; - var r = Math.floor(min + Math.random() * (max - min)); - var g = Math.floor(min + Math.random() * (max - min)); - var b = Math.floor(min + Math.random() * (max - min)); + var mva = cameraMatrix[0]; + var mvb = cameraMatrix[1]; + var mvc = cameraMatrix[2]; + var mvd = cameraMatrix[3]; - return this.setTo(r, g, b); - }, + /* First Invert Matrix */ + var determinant = (mva * mvd) - (mvb * mvc); - /** - * Sets this Color object to be a random grayscale color between the `min` and `max` values given. - * - * @method Phaser.Display.Color#randomGray - * @since 3.13.0 - * - * @param {number} [min=0] - The minimum random color value. Between 0 and 255. - * @param {number} [max=255] - The maximum random color value. Between 0 and 255. - * - * @return {Phaser.Display.Color} This Color object. - */ - randomGray: function (min, max) - { - if (min === undefined) { min = 0; } - if (max === undefined) { max = 255; } + if (!determinant) + { + return renderableObjects; + } - var s = Math.floor(min + Math.random() * (max - min)); + var mve = cameraMatrix[4]; + var mvf = cameraMatrix[5]; - return this.setTo(s, s, s); - }, + var scrollX = this.scrollX; + var scrollY = this.scrollY; + var cameraW = this.width; + var cameraH = this.height; + var cullTop = this.y; + var cullBottom = cullTop + cameraH; + var cullLeft = this.x; + var cullRight = cullLeft + cameraW; + var culledObjects = this.culledObjects; + var length = renderableObjects.length; - /** - * Increase the saturation of this Color by the percentage amount given. - * The saturation is the amount of the base color in the hue. - * - * @method Phaser.Display.Color#saturate - * @since 3.13.0 - * - * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. - * - * @return {Phaser.Display.Color} This Color object. - */ - saturate: function (amount) - { - this.s += amount / 100; + determinant = 1 / determinant; - return this; - }, + culledObjects.length = 0; - /** - * Decrease the saturation of this Color by the percentage amount given. - * The saturation is the amount of the base color in the hue. - * - * @method Phaser.Display.Color#desaturate - * @since 3.13.0 - * - * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. - * - * @return {Phaser.Display.Color} This Color object. - */ - desaturate: function (amount) - { - this.s -= amount / 100; + for (var index = 0; index < length; ++index) + { + var object = renderableObjects[index]; - return this; - }, + if (!object.hasOwnProperty('width') || object.parentContainer) + { + culledObjects.push(object); + continue; + } - /** - * Increase the lightness of this Color by the percentage amount given. - * - * @method Phaser.Display.Color#lighten - * @since 3.13.0 - * - * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. - * - * @return {Phaser.Display.Color} This Color object. - */ - lighten: function (amount) - { - this.v += amount / 100; + var objectW = object.width; + var objectH = object.height; + var objectX = (object.x - (scrollX * object.scrollFactorX)) - (objectW * object.originX); + var objectY = (object.y - (scrollY * object.scrollFactorY)) - (objectH * object.originY); + var tx = (objectX * mva + objectY * mvc + mve); + var ty = (objectX * mvb + objectY * mvd + mvf); + var tw = ((objectX + objectW) * mva + (objectY + objectH) * mvc + mve); + var th = ((objectX + objectW) * mvb + (objectY + objectH) * mvd + mvf); - return this; + if ((tw > cullLeft && tx < cullRight) && (th > cullTop && ty < cullBottom)) + { + culledObjects.push(object); + } + } + + return culledObjects; }, /** - * Decrease the lightness of this Color by the percentage amount given. + * Converts the given `x` and `y` coordinates into World space, based on this Cameras transform. + * You can optionally provide a Vector2, or similar object, to store the results in. * - * @method Phaser.Display.Color#darken - * @since 3.13.0 - * - * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. + * @method Phaser.Cameras.Scene2D.BaseCamera#getWorldPoint + * @since 3.0.0 * - * @return {Phaser.Display.Color} This Color object. - */ - darken: function (amount) - { - this.v -= amount / 100; - - return this; - }, - - /** - * Brighten this Color by the percentage amount given. + * @generic {Phaser.Math.Vector2} O - [output,$return] * - * @method Phaser.Display.Color#brighten - * @since 3.13.0 - * - * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. + * @param {number} x - The x position to convert to world space. + * @param {number} y - The y position to convert to world space. + * @param {(object|Phaser.Math.Vector2)} [output] - An optional object to store the results in. If not provided a new Vector2 will be created. * - * @return {Phaser.Display.Color} This Color object. + * @return {Phaser.Math.Vector2} An object holding the converted values in its `x` and `y` properties. */ - brighten: function (amount) + getWorldPoint: function (x, y, output) { - var r = this.r; - var g = this.g; - var b = this.b; + if (output === undefined) { output = new Vector2(); } - r = Math.max(0, Math.min(255, r - Math.round(255 * - (amount / 100)))); - g = Math.max(0, Math.min(255, g - Math.round(255 * - (amount / 100)))); - b = Math.max(0, Math.min(255, b - Math.round(255 * - (amount / 100)))); + var cameraMatrix = this.matrix.matrix; - return this.setTo(r, g, b); - }, + var mva = cameraMatrix[0]; + var mvb = cameraMatrix[1]; + var mvc = cameraMatrix[2]; + var mvd = cameraMatrix[3]; + var mve = cameraMatrix[4]; + var mvf = cameraMatrix[5]; - /** - * The color of this Color component, not including the alpha channel. - * - * @name Phaser.Display.Color#color - * @type {number} - * @readonly - * @since 3.0.0 - */ - color: { + // Invert Matrix + var determinant = (mva * mvd) - (mvb * mvc); - get: function () + if (!determinant) { - return this._color; + output.x = x; + output.y = y; + + return output; } - }, + determinant = 1 / determinant; - /** - * The color of this Color component, including the alpha channel. - * - * @name Phaser.Display.Color#color32 - * @type {number} - * @readonly - * @since 3.0.0 - */ - color32: { + var ima = mvd * determinant; + var imb = -mvb * determinant; + var imc = -mvc * determinant; + var imd = mva * determinant; + var ime = (mvc * mvf - mvd * mve) * determinant; + var imf = (mvb * mve - mva * mvf) * determinant; - get: function () - { - return this._color32; - } + var c = Math.cos(this.rotation); + var s = Math.sin(this.rotation); - }, + var zoomX = this.zoomX; + var zoomY = this.zoomY; - /** - * The color of this Color component as a string which can be used in CSS color values. - * - * @name Phaser.Display.Color#rgba - * @type {string} - * @readonly - * @since 3.0.0 - */ - rgba: { + var scrollX = this.scrollX; + var scrollY = this.scrollY; - get: function () - { - return this._rgba; - } + var sx = x + ((scrollX * c - scrollY * s) * zoomX); + var sy = y + ((scrollX * s + scrollY * c) * zoomY); + + // Apply transform to point + output.x = (sx * ima + sy * imc) + ime; + output.y = (sx * imb + sy * imd) + imf; + return output; }, /** - * The red color value, normalized to the range 0 to 1. + * Given a Game Object, or an array of Game Objects, it will update all of their camera filter settings + * so that they are ignored by this Camera. This means they will not be rendered by this Camera. * - * @name Phaser.Display.Color#redGL - * @type {number} + * @method Phaser.Cameras.Scene2D.BaseCamera#ignore * @since 3.0.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group|Phaser.GameObjects.Layer|Phaser.GameObjects.Layer[])} entries - The Game Object, or array of Game Objects, to be ignored by this Camera. + * + * @return {this} This Camera instance. */ - redGL: { + ignore: function (entries) + { + var id = this.id; - get: function () + if (!Array.isArray(entries)) { - return this.gl[0]; - }, + entries = [ entries ]; + } - set: function (value) + for (var i = 0; i < entries.length; i++) { - this.gl[0] = Math.min(Math.abs(value), 1); - - this.r = Math.floor(this.gl[0] * 255); + var entry = entries[i]; - this.update(true); + if (Array.isArray(entry)) + { + this.ignore(entry); + } + else if (entry.isParent) + { + this.ignore(entry.getChildren()); + } + else + { + entry.cameraFilter |= id; + } } + return this; }, /** - * The green color value, normalized to the range 0 to 1. + * Internal preRender step. * - * @name Phaser.Display.Color#greenGL - * @type {number} + * @method Phaser.Cameras.Scene2D.BaseCamera#preRender + * @protected * @since 3.0.0 */ - greenGL: { - - get: function () - { - return this.gl[1]; - }, + preRender: function () + { + this.renderList.length = 0; - set: function (value) - { - this.gl[1] = Math.min(Math.abs(value), 1); + var width = this.width; + var height = this.height; - this.g = Math.floor(this.gl[1] * 255); + var halfWidth = width * 0.5; + var halfHeight = height * 0.5; - this.update(true); - } + var zoomX = this.zoomX; + var zoomY = this.zoomY; + var matrix = this.matrix; - }, + var originX = width * this.originX; + var originY = height * this.originY; - /** - * The blue color value, normalized to the range 0 to 1. - * - * @name Phaser.Display.Color#blueGL - * @type {number} - * @since 3.0.0 - */ - blueGL: { + var sx = this.scrollX; + var sy = this.scrollY; - get: function () + if (this.useBounds) { - return this.gl[2]; - }, + sx = this.clampX(sx); + sy = this.clampY(sy); + } - set: function (value) + if (this.roundPixels) { - this.gl[2] = Math.min(Math.abs(value), 1); - - this.b = Math.floor(this.gl[2] * 255); - - this.update(true); + originX = Math.round(originX); + originY = Math.round(originY); } - }, - - /** - * The alpha color value, normalized to the range 0 to 1. - * - * @name Phaser.Display.Color#alphaGL - * @type {number} - * @since 3.0.0 - */ - alphaGL: { + // Values are in pixels and not impacted by zooming the Camera + this.scrollX = sx; + this.scrollY = sy; - get: function () - { - return this.gl[3]; - }, + var midX = sx + halfWidth; + var midY = sy + halfHeight; - set: function (value) - { - this.gl[3] = Math.min(Math.abs(value), 1); + // The center of the camera, in world space, so taking zoom into account + // Basically the pixel value of what it's looking at in the middle of the cam + this.midPoint.set(midX, midY); - this.a = Math.floor(this.gl[3] * 255); + var displayWidth = width / zoomX; + var displayHeight = height / zoomY; - this.update(); - } + this.worldView.setTo( + midX - (displayWidth / 2), + midY - (displayHeight / 2), + displayWidth, + displayHeight + ); + matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoomX, zoomY); + matrix.translate(-originX, -originY); }, /** - * The red color value, normalized to the range 0 to 255. + * Takes an x value and checks it's within the range of the Camera bounds, adjusting if required. + * Do not call this method if you are not using camera bounds. * - * @name Phaser.Display.Color#red - * @type {number} - * @since 3.0.0 + * @method Phaser.Cameras.Scene2D.BaseCamera#clampX + * @since 3.11.0 + * + * @param {number} x - The value to horizontally scroll clamp. + * + * @return {number} The adjusted value to use as scrollX. */ - red: { - - get: function () - { - return this.r; - }, - - set: function (value) - { - value = Math.floor(Math.abs(value)); + clampX: function (x) + { + var bounds = this._bounds; - this.r = Math.min(value, 255); + var dw = this.displayWidth; - this.gl[0] = value / 255; + var bx = bounds.x + ((dw - this.width) / 2); + var bw = Math.max(bx, bx + bounds.width - dw); - this.update(true); + if (x < bx) + { + x = bx; + } + else if (x > bw) + { + x = bw; } + return x; }, /** - * The green color value, normalized to the range 0 to 255. + * Takes a y value and checks it's within the range of the Camera bounds, adjusting if required. + * Do not call this method if you are not using camera bounds. * - * @name Phaser.Display.Color#green - * @type {number} - * @since 3.0.0 + * @method Phaser.Cameras.Scene2D.BaseCamera#clampY + * @since 3.11.0 + * + * @param {number} y - The value to vertically scroll clamp. + * + * @return {number} The adjusted value to use as scrollY. */ - green: { - - get: function () - { - return this.g; - }, - - set: function (value) - { - value = Math.floor(Math.abs(value)); + clampY: function (y) + { + var bounds = this._bounds; - this.g = Math.min(value, 255); + var dh = this.displayHeight; - this.gl[1] = value / 255; + var by = bounds.y + ((dh - this.height) / 2); + var bh = Math.max(by, by + bounds.height - dh); - this.update(true); + if (y < by) + { + y = by; + } + else if (y > bh) + { + y = bh; } + return y; }, + /* + var gap = this._zoomInversed; + return gap * Math.round((src.x - this.scrollX * src.scrollFactorX) / gap); + */ + /** - * The blue color value, normalized to the range 0 to 255. + * If this Camera has previously had movement bounds set on it, this will remove them. * - * @name Phaser.Display.Color#blue - * @type {number} + * @method Phaser.Cameras.Scene2D.BaseCamera#removeBounds * @since 3.0.0 + * + * @return {this} This Camera instance. */ - blue: { - - get: function () - { - return this.b; - }, - - set: function (value) - { - value = Math.floor(Math.abs(value)); - - this.b = Math.min(value, 255); + removeBounds: function () + { + this.useBounds = false; - this.gl[2] = value / 255; + this.dirty = true; - this.update(true); - } + this._bounds.setEmpty(); + return this; }, /** - * The alpha color value, normalized to the range 0 to 255. + * Set the rotation of this Camera. This causes everything it renders to appear rotated. * - * @name Phaser.Display.Color#alpha - * @type {number} + * Rotating a camera does not rotate the viewport itself, it is applied during rendering. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setAngle * @since 3.0.0 + * + * @param {number} [value=0] - The cameras angle of rotation, given in degrees. + * + * @return {this} This Camera instance. */ - alpha: { - - get: function () - { - return this.a; - }, - - set: function (value) - { - value = Math.floor(Math.abs(value)); - - this.a = Math.min(value, 255); - - this.gl[3] = value / 255; + setAngle: function (value) + { + if (value === undefined) { value = 0; } - this.update(); - } + this.rotation = DegToRad(value); + return this; }, /** - * The hue color value. A number between 0 and 1. - * This is the base color. + * Sets the background color for this Camera. * - * @name Phaser.Display.Color#h - * @type {number} - * @since 3.13.0 + * By default a Camera has a transparent background but it can be given a solid color, with any level + * of transparency, via this method. + * + * The color value can be specified using CSS color notation, hex or numbers. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setBackgroundColor + * @since 3.0.0 + * + * @param {(string|number|Phaser.Types.Display.InputColorObject)} [color='rgba(0,0,0,0)'] - The color value. In CSS, hex or numeric color notation. + * + * @return {this} This Camera instance. */ - h: { - - get: function () - { - return this._h; - }, + setBackgroundColor: function (color) + { + if (color === undefined) { color = 'rgba(0,0,0,0)'; } - set: function (value) - { - this._h = value; + this.backgroundColor = ValueToColor(color); - HSVToRGB(value, this._s, this._v, this); - } + this.transparent = (this.backgroundColor.alpha === 0); + return this; }, /** - * The saturation color value. A number between 0 and 1. - * This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white. + * Set the bounds of the Camera. The bounds are an axis-aligned rectangle. * - * @name Phaser.Display.Color#s - * @type {number} - * @since 3.13.0 + * The Camera bounds controls where the Camera can scroll to, stopping it from scrolling off the + * edges and into blank space. It does not limit the placement of Game Objects, or where + * the Camera viewport can be positioned. + * + * Temporarily disable the bounds by changing the boolean `Camera.useBounds`. + * + * Clear the bounds entirely by calling `Camera.removeBounds`. + * + * If you set bounds that are smaller than the viewport it will stop the Camera from being + * able to scroll. The bounds can be positioned where-ever you wish. By default they are from + * 0x0 to the canvas width x height. This means that the coordinate 0x0 is the top left of + * the Camera bounds. However, you can position them anywhere. So if you wanted a game world + * that was 2048x2048 in size, with 0x0 being the center of it, you can set the bounds x/y + * to be -1024, -1024, with a width and height of 2048. Depending on your game you may find + * it easier for 0x0 to be the top-left of the bounds, or you may wish 0x0 to be the middle. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setBounds + * @since 3.0.0 + * + * @param {number} x - The top-left x coordinate of the bounds. + * @param {number} y - The top-left y coordinate of the bounds. + * @param {number} width - The width of the bounds, in pixels. + * @param {number} height - The height of the bounds, in pixels. + * @param {boolean} [centerOn=false] - If `true` the Camera will automatically be centered on the new bounds. + * + * @return {this} This Camera instance. */ - s: { + setBounds: function (x, y, width, height, centerOn) + { + if (centerOn === undefined) { centerOn = false; } - get: function () - { - return this._s; - }, + this._bounds.setTo(x, y, width, height); - set: function (value) - { - this._s = value; + this.dirty = true; + this.useBounds = true; - HSVToRGB(this._h, value, this._v, this); + if (centerOn) + { + this.centerToBounds(); + } + else + { + this.scrollX = this.clampX(this.scrollX); + this.scrollY = this.clampY(this.scrollY); } + return this; }, /** - * The lightness color value. A number between 0 and 1. - * This controls how dark the color is. Where 1 is as bright as possible and 0 is black. + * Returns a rectangle containing the bounds of the Camera. * - * @name Phaser.Display.Color#v - * @type {number} - * @since 3.13.0 + * If the Camera does not have any bounds the rectangle will be empty. + * + * The rectangle is a copy of the bounds, so is safe to modify. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#getBounds + * @since 3.16.0 + * + * @param {Phaser.Geom.Rectangle} [out] - An optional Rectangle to store the bounds in. If not given, a new Rectangle will be created. + * + * @return {Phaser.Geom.Rectangle} A rectangle containing the bounds of this Camera. */ - v: { - - get: function () - { - return this._v; - }, - - set: function (value) - { - this._v = value; - - HSVToRGB(this._h, this._s, value, this); - } - - } - -}); - -module.exports = Color; - - -/***/ }), -/* 39 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - -var Class = __webpack_require__(0); - -/** - * @classdesc - * A representation of a vector in 3D space. - * - * A three-component vector. - * - * @class Vector3 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - */ -var Vector3 = new Class({ - - initialize: - - function Vector3 (x, y, z) + getBounds: function (out) { - /** - * The x component of this Vector. - * - * @name Phaser.Math.Vector3#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.x = 0; + if (out === undefined) { out = new Rectangle(); } - /** - * The y component of this Vector. - * - * @name Phaser.Math.Vector3#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; + var source = this._bounds; - /** - * The z component of this Vector. - * - * @name Phaser.Math.Vector3#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.z = 0; + out.setTo(source.x, source.y, source.width, source.height); - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - } + return out; }, /** - * Set this Vector to point up. - * - * Sets the y component of the vector to 1, and the others to 0. + * Sets the name of this Camera. + * This value is for your own use and isn't used internally. * - * @method Phaser.Math.Vector3#up + * @method Phaser.Cameras.Scene2D.BaseCamera#setName * @since 3.0.0 * - * @return {Phaser.Math.Vector3} This Vector3. + * @param {string} [value=''] - The name of the Camera. + * + * @return {this} This Camera instance. */ - up: function () + setName: function (value) { - this.x = 0; - this.y = 1; - this.z = 0; + if (value === undefined) { value = ''; } + + this.name = value; return this; }, /** - * Sets the components of this Vector to be the `Math.min` result from the given vector. + * Set the position of the Camera viewport within the game. * - * @method Phaser.Math.Vector3#min - * @since 3.50.0 + * This does not change where the camera is 'looking'. See `setScroll` to control that. * - * @param {Phaser.Math.Vector3} v - The Vector3 to check the minimum values against. + * @method Phaser.Cameras.Scene2D.BaseCamera#setPosition + * @since 3.0.0 * - * @return {Phaser.Math.Vector3} This Vector3. + * @param {number} x - The top-left x coordinate of the Camera viewport. + * @param {number} [y=x] - The top-left y coordinate of the Camera viewport. + * + * @return {this} This Camera instance. */ - min: function (v) + setPosition: function (x, y) { - this.x = Math.min(this.x, v.x); - this.y = Math.min(this.y, v.y); - this.z = Math.min(this.z, v.z); + if (y === undefined) { y = x; } + + this.x = x; + this.y = y; return this; }, /** - * Sets the components of this Vector to be the `Math.max` result from the given vector. + * Set the rotation of this Camera. This causes everything it renders to appear rotated. * - * @method Phaser.Math.Vector3#max - * @since 3.50.0 + * Rotating a camera does not rotate the viewport itself, it is applied during rendering. * - * @param {Phaser.Math.Vector3} v - The Vector3 to check the maximum values against. + * @method Phaser.Cameras.Scene2D.BaseCamera#setRotation + * @since 3.0.0 * - * @return {Phaser.Math.Vector3} This Vector3. + * @param {number} [value=0] - The rotation of the Camera, in radians. + * + * @return {this} This Camera instance. */ - max: function (v) + setRotation: function (value) { - this.x = Math.max(this.x, v.x); - this.y = Math.max(this.y, v.y); - this.z = Math.max(this.z, v.z); + if (value === undefined) { value = 0; } + + this.rotation = value; return this; }, /** - * Make a clone of this Vector3. + * Should the Camera round pixel values to whole integers when rendering Game Objects? * - * @method Phaser.Math.Vector3#clone + * In some types of game, especially with pixel art, this is required to prevent sub-pixel aliasing. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setRoundPixels * @since 3.0.0 * - * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values. + * @param {boolean} value - `true` to round Camera pixels, `false` to not. + * + * @return {this} This Camera instance. */ - clone: function () + setRoundPixels: function (value) { - return new Vector3(this.x, this.y, this.z); + this.roundPixels = value; + + return this; }, /** - * Adds the two given Vector3s and sets the results into this Vector3. + * Sets the Scene the Camera is bound to. * - * @method Phaser.Math.Vector3#addVectors - * @since 3.50.0 + * @method Phaser.Cameras.Scene2D.BaseCamera#setScene + * @since 3.0.0 * - * @param {Phaser.Math.Vector3} a - The first Vector to add. - * @param {Phaser.Math.Vector3} b - The second Vector to add. + * @param {Phaser.Scene} scene - The Scene the camera is bound to. + * @param {boolean} [isSceneCamera=true] - Is this Camera being used for a Scene (true) or a Texture? (false) * - * @return {Phaser.Math.Vector3} This Vector3. + * @return {this} This Camera instance. */ - addVectors: function (a, b) + setScene: function (scene, isSceneCamera) { - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; + if (isSceneCamera === undefined) { isSceneCamera = true; } + + if (this.scene && this._customViewport) + { + this.sceneManager.customViewports--; + } + + this.scene = scene; + this.isSceneCamera = isSceneCamera; + + var sys = scene.sys; + + this.sceneManager = sys.game.scene; + this.scaleManager = sys.scale; + this.cameraManager = sys.cameras; + + this.updateSystem(); return this; }, /** - * Calculate the cross (vector) product of two given Vectors. + * Set the position of where the Camera is looking within the game. + * You can also modify the properties `Camera.scrollX` and `Camera.scrollY` directly. + * Use this method, or the scroll properties, to move your camera around the game world. * - * @method Phaser.Math.Vector3#crossVectors + * This does not change where the camera viewport is placed. See `setPosition` to control that. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setScroll * @since 3.0.0 * - * @param {Phaser.Math.Vector3} a - The first Vector to multiply. - * @param {Phaser.Math.Vector3} b - The second Vector to multiply. + * @param {number} x - The x coordinate of the Camera in the game world. + * @param {number} [y=x] - The y coordinate of the Camera in the game world. * - * @return {Phaser.Math.Vector3} This Vector3. + * @return {this} This Camera instance. */ - crossVectors: function (a, b) + setScroll: function (x, y) { - var ax = a.x; - var ay = a.y; - var az = a.z; - var bx = b.x; - var by = b.y; - var bz = b.z; + if (y === undefined) { y = x; } - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; + this.scrollX = x; + this.scrollY = y; return this; }, /** - * Check whether this Vector is equal to a given Vector. + * Set the size of the Camera viewport. * - * Performs a strict equality check against each Vector's components. + * By default a Camera is the same size as the game, but can be made smaller via this method, + * allowing you to create mini-cam style effects by creating and positioning a smaller Camera + * viewport within your game. * - * @method Phaser.Math.Vector3#equals + * @method Phaser.Cameras.Scene2D.BaseCamera#setSize * @since 3.0.0 * - * @param {Phaser.Math.Vector3} v - The Vector3 to compare against. + * @param {number} width - The width of the Camera viewport. + * @param {number} [height=width] - The height of the Camera viewport. * - * @return {boolean} True if the two vectors strictly match, otherwise false. + * @return {this} This Camera instance. */ - equals: function (v) + setSize: function (width, height) { - return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z)); + if (height === undefined) { height = width; } + + this.width = width; + this.height = height; + + return this; }, /** - * Copy the components of a given Vector into this Vector. + * This method sets the position and size of the Camera viewport in a single call. * - * @method Phaser.Math.Vector3#copy + * If you're trying to change where the Camera is looking at in your game, then see + * the method `Camera.setScroll` instead. This method is for changing the viewport + * itself, not what the camera can see. + * + * By default a Camera is the same size as the game, but can be made smaller via this method, + * allowing you to create mini-cam style effects by creating and positioning a smaller Camera + * viewport within your game. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setViewport * @since 3.0.0 * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from. + * @param {number} x - The top-left x coordinate of the Camera viewport. + * @param {number} y - The top-left y coordinate of the Camera viewport. + * @param {number} width - The width of the Camera viewport. + * @param {number} [height=width] - The height of the Camera viewport. * - * @return {Phaser.Math.Vector3} This Vector3. + * @return {this} This Camera instance. */ - copy: function (src) + setViewport: function (x, y, width, height) { - this.x = src.x; - this.y = src.y; - this.z = src.z || 0; + this.x = x; + this.y = y; + this.width = width; + this.height = height; return this; }, /** - * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values. + * Set the zoom value of the Camera. * - * @method Phaser.Math.Vector3#set + * Changing to a smaller value, such as 0.5, will cause the camera to 'zoom out'. + * Changing to a larger value, such as 2, will cause the camera to 'zoom in'. + * + * A value of 1 means 'no zoom' and is the default. + * + * Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering. + * + * As of Phaser 3.50 you can now set the horizontal and vertical zoom values independently. + * + * @method Phaser.Cameras.Scene2D.BaseCamera#setZoom * @since 3.0.0 * - * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components. - * @param {number} [y] - The y value to set for this Vector. - * @param {number} [z] - The z value to set for this Vector. + * @param {number} [x=1] - The horizontal zoom value of the Camera. The minimum it can be is 0.001. + * @param {number} [y=x] - The vertical zoom value of the Camera. The minimum it can be is 0.001. * - * @return {Phaser.Math.Vector3} This Vector3. + * @return {this} This Camera instance. */ - set: function (x, y, z) + setZoom: function (x, y) { - if (typeof x === 'object') + if (x === undefined) { x = 1; } + if (y === undefined) { y = x; } + + if (x === 0) { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; + x = 0.001; } - else + + if (y === 0) { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; + y = 0.001; } + this.zoomX = x; + this.zoomY = y; + return this; }, /** - * Sets the components of this Vector3 from the position of the given Matrix4. + * Sets the mask to be applied to this Camera during rendering. * - * @method Phaser.Math.Vector3#setFromMatrixPosition - * @since 3.50.0 + * The mask must have been previously created and can be either a GeometryMask or a BitmapMask. * - * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to get the position from. + * Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. * - * @return {Phaser.Math.Vector3} This Vector3. - */ - setFromMatrixPosition: function (m) - { - return this.fromArray(m.val, 12); - }, - - /** - * Sets the components of this Vector3 from the Matrix4 column specified. + * If a mask is already set on this Camera it will be immediately replaced. * - * @method Phaser.Math.Vector3#setFromMatrixColumn - * @since 3.50.0 + * Masks have no impact on physics or input detection. They are purely a rendering component + * that allows you to limit what is visible during the render pass. * - * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to get the column from. - * @param {number} index - The column index. + * @method Phaser.Cameras.Scene2D.BaseCamera#setMask + * @since 3.17.0 * - * @return {Phaser.Math.Vector3} This Vector3. + * @param {(Phaser.Display.Masks.BitmapMask|Phaser.Display.Masks.GeometryMask)} mask - The mask this Camera will use when rendering. + * @param {boolean} [fixedPosition=true] - Should the mask translate along with the Camera, or be fixed in place and not impacted by the Cameras transform? + * + * @return {this} This Camera instance. */ - setFromMatrixColumn: function (mat4, index) + setMask: function (mask, fixedPosition) { - return this.fromArray(mat4.val, index * 4); + if (fixedPosition === undefined) { fixedPosition = true; } + + this.mask = mask; + + this._maskCamera = (fixedPosition) ? this.cameraManager.default : this; + + return this; }, /** - * Sets the components of this Vector3 from the given array, based on the offset. - * - * Vector3.x = array[offset] - * Vector3.y = array[offset + 1] - * Vector3.z = array[offset + 2] + * Clears the mask that this Camera was using. * - * @method Phaser.Math.Vector3#fromArray - * @since 3.50.0 + * @method Phaser.Cameras.Scene2D.BaseCamera#clearMask + * @since 3.17.0 * - * @param {number[]} array - The array of values to get this Vector from. - * @param {number} [offset=0] - The offset index into the array. + * @param {boolean} [destroyMask=false] - Destroy the mask before clearing it? * - * @return {Phaser.Math.Vector3} This Vector3. + * @return {this} This Camera instance. */ - fromArray: function (array, offset) + clearMask: function (destroyMask) { - if (offset === undefined) { offset = 0; } + if (destroyMask === undefined) { destroyMask = false; } - this.x = array[offset]; - this.y = array[offset + 1]; - this.z = array[offset + 2]; + if (destroyMask && this.mask) + { + this.mask.destroy(); + } + + this.mask = null; return this; }, /** - * Add a given Vector to this Vector. Addition is component-wise. + * Sets the visibility of this Camera. * - * @method Phaser.Math.Vector3#add - * @since 3.0.0 + * An invisible Camera will skip rendering and input tests of everything it can see. * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - add: function (v) - { - this.x += v.x; - this.y += v.y; - this.z += v.z || 0; - - return this; - }, - - /** - * Add the given value to each component of this Vector. - * - * @method Phaser.Math.Vector3#addScalar - * @since 3.50.0 + * @method Phaser.Cameras.Scene2D.BaseCamera#setVisible + * @since 3.10.0 * - * @param {number} s - The amount to add to this Vector. + * @param {boolean} value - The visible state of the Camera. * - * @return {Phaser.Math.Vector3} This Vector3. + * @return {this} This Camera instance. */ - addScalar: function (s) - { - this.x += s; - this.y += s; - this.z += s; - - return this; - }, /** - * Add and scale a given Vector to this Vector. Addition is component-wise. - * - * @method Phaser.Math.Vector3#addScale - * @since 3.50.0 + * Returns an Object suitable for JSON storage containing all of the Camera viewport and rendering properties. * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. - * @param {number} scale - The amount to scale `v` by. + * @method Phaser.Cameras.Scene2D.BaseCamera#toJSON + * @since 3.0.0 * - * @return {Phaser.Math.Vector3} This Vector3. + * @return {Phaser.Types.Cameras.Scene2D.JSONCamera} A well-formed object suitable for conversion to JSON. */ - addScale: function (v, scale) + toJSON: function () { - this.x += v.x * scale; - this.y += v.y * scale; - this.z += v.z * scale || 0; + var output = { + name: this.name, + x: this.x, + y: this.y, + width: this.width, + height: this.height, + zoom: this.zoom, + rotation: this.rotation, + roundPixels: this.roundPixels, + scrollX: this.scrollX, + scrollY: this.scrollY, + backgroundColor: this.backgroundColor.rgba + }; - return this; + if (this.useBounds) + { + output['bounds'] = { + x: this._bounds.x, + y: this._bounds.y, + width: this._bounds.width, + height: this._bounds.height + }; + } + + return output; }, /** - * Subtract the given Vector from this Vector. Subtraction is component-wise. + * Internal method called automatically by the Camera Manager. * - * @method Phaser.Math.Vector3#subtract + * @method Phaser.Cameras.Scene2D.BaseCamera#update + * @protected * @since 3.0.0 * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector. - * - * @return {Phaser.Math.Vector3} This Vector3. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - subtract: function (v) + update: function () { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z || 0; - - return this; + // NOOP }, /** - * Perform a component-wise multiplication between this Vector and the given Vector. - * - * Multiplies this Vector by the given Vector. - * - * @method Phaser.Math.Vector3#multiply - * @since 3.0.0 + * Set if this Camera is being used as a Scene Camera, or a Texture + * Camera. * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by. + * @method Phaser.Cameras.Scene2D.BaseCamera#setIsSceneCamera + * @since 3.60.0 * - * @return {Phaser.Math.Vector3} This Vector3. + * @param {boolean} value - Is this being used as a Scene Camera, or a Texture camera? */ - multiply: function (v) + setIsSceneCamera: function (value) { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z || 1; + this.isSceneCamera = value; return this; }, /** - * Scale this Vector by the given value. - * - * @method Phaser.Math.Vector3#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Vector by. + * Internal method called automatically when the viewport changes. * - * @return {Phaser.Math.Vector3} This Vector3. + * @method Phaser.Cameras.Scene2D.BaseCamera#updateSystem + * @private + * @since 3.12.0 */ - scale: function (scale) + updateSystem: function () { - if (isFinite(scale)) + if (!this.scaleManager || !this.isSceneCamera) { - this.x *= scale; - this.y *= scale; - this.z *= scale; + return; } - else + + var custom = (this._x !== 0 || this._y !== 0 || this.scaleManager.width !== this._width || this.scaleManager.height !== this._height); + + var sceneManager = this.sceneManager; + + if (custom && !this._customViewport) { - this.x = 0; - this.y = 0; - this.z = 0; + // We need a custom viewport for this Camera + sceneManager.customViewports++; + } + else if (!custom && this._customViewport) + { + // We're turning off a custom viewport for this Camera + sceneManager.customViewports--; } - return this; + this.dirty = true; + this._customViewport = custom; }, /** - * Perform a component-wise division between this Vector and the given Vector. - * - * Divides this Vector by the given Vector. + * Destroys this Camera instance and its internal properties and references. + * Once destroyed you cannot use this Camera again, even if re-added to a Camera Manager. * - * @method Phaser.Math.Vector3#divide - * @since 3.0.0 + * This method is called automatically by `CameraManager.remove` if that methods `runDestroy` argument is `true`, which is the default. * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by. + * Unless you have a specific reason otherwise, always use `CameraManager.remove` and allow it to handle the camera destruction, + * rather than calling this method directly. * - * @return {Phaser.Math.Vector3} This Vector3. + * @method Phaser.Cameras.Scene2D.BaseCamera#destroy + * @fires Phaser.Cameras.Scene2D.Events#DESTROY + * @since 3.0.0 */ - divide: function (v) + destroy: function () { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z || 1; + this.emit(Events.DESTROY, this); - return this; - }, + this.removeAllListeners(); - /** - * Negate the `x`, `y` and `z` components of this Vector. - * - * @method Phaser.Math.Vector3#negate - * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. - */ - negate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; + this.matrix.destroy(); - return this; - }, + this.culledObjects = []; - /** - * Calculate the distance between this Vector and the given Vector. - * - * @method Phaser.Math.Vector3#distance - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector. - */ - distance: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; + if (this._customViewport) + { + // We're turning off a custom viewport for this Camera + this.sceneManager.customViewports--; + } - return Math.sqrt(dx * dx + dy * dy + dz * dz); - }, + this.renderList = []; - /** - * Calculate the distance between this Vector and the given Vector, squared. - * - * @method Phaser.Math.Vector3#distanceSq - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. - * - * @return {number} The distance from this Vector to the given Vector, squared. - */ - distanceSq: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; + this._bounds = null; - return dx * dx + dy * dy + dz * dz; + this.scene = null; + this.scaleManager = null; + this.sceneManager = null; + this.cameraManager = null; }, /** - * Calculate the length (or magnitude) of this Vector. + * The x position of the Camera viewport, relative to the top-left of the game canvas. + * The viewport is the area into which the camera renders. + * To adjust the position the camera is looking at in the game world, see the `scrollX` value. * - * @method Phaser.Math.Vector3#length + * @name Phaser.Cameras.Scene2D.BaseCamera#x + * @type {number} * @since 3.0.0 - * - * @return {number} The length of this Vector. */ - length: function () - { - var x = this.x; - var y = this.y; - var z = this.z; + x: { - return Math.sqrt(x * x + y * y + z * z); - }, + get: function () + { + return this._x; + }, - /** - * Calculate the length of this Vector squared. - * - * @method Phaser.Math.Vector3#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Vector, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; + set: function (value) + { + this._x = value; + this.updateSystem(); + } - return x * x + y * y + z * z; }, /** - * Normalize this Vector. - * - * Makes the vector a unit length vector (magnitude of 1) in the same direction. + * The y position of the Camera viewport, relative to the top-left of the game canvas. + * The viewport is the area into which the camera renders. + * To adjust the position the camera is looking at in the game world, see the `scrollY` value. * - * @method Phaser.Math.Vector3#normalize + * @name Phaser.Cameras.Scene2D.BaseCamera#y + * @type {number} * @since 3.0.0 - * - * @return {Phaser.Math.Vector3} This Vector3. */ - normalize: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var len = x * x + y * y + z * z; + y: { - if (len > 0) + get: function () { - len = 1 / Math.sqrt(len); + return this._y; + }, - this.x = x * len; - this.y = y * len; - this.z = z * len; + set: function (value) + { + this._y = value; + this.updateSystem(); } - return this; }, /** - * Calculate the dot product of this Vector and the given Vector. - * - * @method Phaser.Math.Vector3#dot - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3. + * The width of the Camera viewport, in pixels. * - * @return {number} The dot product of this Vector and `v`. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z; - }, - - /** - * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector. + * The viewport is the area into which the Camera renders. Setting the viewport does + * not restrict where the Camera can scroll to. * - * @method Phaser.Math.Vector3#cross + * @name Phaser.Cameras.Scene2D.BaseCamera#width + * @type {number} * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector to cross product with. - * - * @return {Phaser.Math.Vector3} This Vector3. */ - cross: function (v) - { - var ax = this.x; - var ay = this.y; - var az = this.z; - var bx = v.x; - var by = v.y; - var bz = v.z; + width: { - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; + get: function () + { + return this._width; + }, + + set: function (value) + { + this._width = value; + this.updateSystem(); + } - return this; }, /** - * Linearly interpolate between this Vector and the given Vector. + * The height of the Camera viewport, in pixels. * - * Interpolates this Vector towards the given Vector. + * The viewport is the area into which the Camera renders. Setting the viewport does + * not restrict where the Camera can scroll to. * - * @method Phaser.Math.Vector3#lerp + * @name Phaser.Cameras.Scene2D.BaseCamera#height + * @type {number} * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards. - * @param {number} [t=0] - The interpolation percentage, between 0 and 1. - * - * @return {Phaser.Math.Vector3} This Vector3. */ - lerp: function (v, t) - { - if (t === undefined) { t = 0; } + height: { - var ax = this.x; - var ay = this.y; - var az = this.z; + get: function () + { + return this._height; + }, - this.x = ax + t * (v.x - ax); - this.y = ay + t * (v.y - ay); - this.z = az + t * (v.z - az); + set: function (value) + { + this._height = value; + this.updateSystem(); + } - return this; }, /** - * Takes a Matrix3 and applies it to this Vector3. + * The horizontal scroll position of this Camera. * - * @method Phaser.Math.Vector3#applyMatrix3 - * @since 3.50.0 + * Change this value to cause the Camera to scroll around your Scene. * - * @param {Phaser.Math.Matrix3} mat3 - The Matrix3 to apply to this Vector3. + * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, + * will automatically adjust the Camera scroll values accordingly. * - * @return {Phaser.Math.Vector3} This Vector3. + * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#scrollX + * @type {number} + * @default 0 + * @since 3.0.0 */ - applyMatrix3: function (mat3) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat3.val; + scrollX: { - this.x = m[0] * x + m[3] * y + m[6] * z; - this.y = m[1] * x + m[4] * y + m[7] * z; - this.z = m[2] * x + m[5] * y + m[8] * z; + get: function () + { + return this._scrollX; + }, + + set: function (value) + { + if (value !== this._scrollX) + { + this._scrollX = value; + this.dirty = true; + } + } - return this; }, /** - * Takes a Matrix4 and applies it to this Vector3. + * The vertical scroll position of this Camera. * - * @method Phaser.Math.Vector3#applyMatrix4 - * @since 3.50.0 + * Change this value to cause the Camera to scroll around your Scene. * - * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to apply to this Vector3. + * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, + * will automatically adjust the Camera scroll values accordingly. * - * @return {Phaser.Math.Vector3} This Vector3. + * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#scrollY + * @type {number} + * @default 0 + * @since 3.0.0 */ - applyMatrix4: function (mat4) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat4.val; + scrollY: { - var w = 1 / (m[3] * x + m[7] * y + m[11] * z + m[15]); + get: function () + { + return this._scrollY; + }, - this.x = (m[0] * x + m[4] * y + m[8] * z + m[12]) * w; - this.y = (m[1] * x + m[5] * y + m[9] * z + m[13]) * w; - this.z = (m[2] * x + m[6] * y + m[10] * z + m[14]) * w; + set: function (value) + { + if (value !== this._scrollY) + { + this._scrollY = value; + this.dirty = true; + } + } - return this; }, /** - * Transform this Vector with the given Matrix. + * The Camera zoom value. Change this value to zoom in, or out of, a Scene. * - * @method Phaser.Math.Vector3#transformMat3 - * @since 3.0.0 + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. * - * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with. + * Set to 1 to return to the default zoom level. * - * @return {Phaser.Math.Vector3} This Vector3. - */ - transformMat3: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - this.x = x * m[0] + y * m[3] + z * m[6]; - this.y = x * m[1] + y * m[4] + z * m[7]; - this.z = x * m[2] + y * m[5] + z * m[8]; - - return this; - }, - - /** - * Transform this Vector with the given Matrix4. + * Be careful to never set this value to zero. * - * @method Phaser.Math.Vector3#transformMat4 + * @name Phaser.Cameras.Scene2D.BaseCamera#zoom + * @type {number} + * @default 1 * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. - * - * @return {Phaser.Math.Vector3} This Vector3. */ - transformMat4: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; + zoom: { - this.x = m[0] * x + m[4] * y + m[8] * z + m[12]; - this.y = m[1] * x + m[5] * y + m[9] * z + m[13]; - this.z = m[2] * x + m[6] * y + m[10] * z + m[14]; + get: function () + { + return (this._zoomX + this._zoomY) / 2; + }, + + set: function (value) + { + this._zoomX = value; + this._zoomY = value; + + this.dirty = true; + } - return this; }, /** - * Transforms the coordinates of this Vector3 with the given Matrix4. + * The Camera horizontal zoom value. Change this value to zoom in, or out of, a Scene. * - * @method Phaser.Math.Vector3#transformCoordinates - * @since 3.0.0 + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. + * Set to 1 to return to the default zoom level. * - * @return {Phaser.Math.Vector3} This Vector3. + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#zoomX + * @type {number} + * @default 1 + * @since 3.50.0 */ - transformCoordinates: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; + zoomX: { - var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; - var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; - var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; - var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; + get: function () + { + return this._zoomX; + }, - this.x = tx / tw; - this.y = ty / tw; - this.z = tz / tw; + set: function (value) + { + this._zoomX = value; + this.dirty = true; + } - return this; }, /** - * Transform this Vector with the given Quaternion. + * The Camera vertical zoom value. Change this value to zoom in, or out of, a Scene. * - * @method Phaser.Math.Vector3#transformQuat - * @since 3.0.0 + * A value of 0.5 would zoom the Camera out, so you can now see twice as much + * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel + * now takes up 2 pixels when rendered. * - * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. + * Set to 1 to return to the default zoom level. * - * @return {Phaser.Math.Vector3} This Vector3. + * Be careful to never set this value to zero. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#zoomY + * @type {number} + * @default 1 + * @since 3.50.0 */ - transformQuat: function (q) - { - // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations - var x = this.x; - var y = this.y; - var z = this.z; - var qx = q.x; - var qy = q.y; - var qz = q.z; - var qw = q.w; + zoomY: { - // calculate quat * vec - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = -qx * x - qy * y - qz * z; + get: function () + { + return this._zoomY; + }, - // calculate result * inverse quat - this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; - this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; - this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; + set: function (value) + { + this._zoomY = value; + this.dirty = true; + } - return this; }, /** - * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, - * e.g. unprojecting a 2D point into 3D space. + * The rotation of the Camera in radians. * - * @method Phaser.Math.Vector3#project - * @since 3.0.0 + * Camera rotation always takes place based on the Camera viewport. By default, rotation happens + * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with. + * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not + * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. * - * @return {Phaser.Math.Vector3} This Vector3. + * @name Phaser.Cameras.Scene2D.BaseCamera#rotation + * @type {number} + * @private + * @default 0 + * @since 3.11.0 */ - project: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var m = mat.val; - - var a00 = m[0]; - var a01 = m[1]; - var a02 = m[2]; - var a03 = m[3]; - var a10 = m[4]; - var a11 = m[5]; - var a12 = m[6]; - var a13 = m[7]; - var a20 = m[8]; - var a21 = m[9]; - var a22 = m[10]; - var a23 = m[11]; - var a30 = m[12]; - var a31 = m[13]; - var a32 = m[14]; - var a33 = m[15]; + rotation: { - var lw = 1 / (x * a03 + y * a13 + z * a23 + a33); + get: function () + { + return this._rotation; + }, - this.x = (x * a00 + y * a10 + z * a20 + a30) * lw; - this.y = (x * a01 + y * a11 + z * a21 + a31) * lw; - this.z = (x * a02 + y * a12 + z * a22 + a32) * lw; + set: function (value) + { + this._rotation = value; + this.dirty = true; + } - return this; }, /** - * Multiplies this Vector3 by the given view and projection matrices. - * - * @method Phaser.Math.Vector3#projectViewMatrix - * @since 3.50.0 - * - * @param {Phaser.Math.Matrix4} viewMatrix - A View Matrix. - * @param {Phaser.Math.Matrix4} projectionMatrix - A Projection Matrix. + * The horizontal position of the center of the Camera's viewport, relative to the left of the game canvas. * - * @return {Phaser.Math.Vector3} This Vector3. + * @name Phaser.Cameras.Scene2D.BaseCamera#centerX + * @type {number} + * @readonly + * @since 3.10.0 */ - projectViewMatrix: function (viewMatrix, projectionMatrix) - { - return this.applyMatrix4(viewMatrix).applyMatrix4(projectionMatrix); + centerX: { + + get: function () + { + return this.x + (0.5 * this.width); + } + }, /** - * Multiplies this Vector3 by the given inversed projection matrix and world matrix. - * - * @method Phaser.Math.Vector3#unprojectViewMatrix - * @since 3.50.0 - * - * @param {Phaser.Math.Matrix4} projectionMatrix - An inversed Projection Matrix. - * @param {Phaser.Math.Matrix4} worldMatrix - A World View Matrix. + * The vertical position of the center of the Camera's viewport, relative to the top of the game canvas. * - * @return {Phaser.Math.Vector3} This Vector3. + * @name Phaser.Cameras.Scene2D.BaseCamera#centerY + * @type {number} + * @readonly + * @since 3.10.0 */ - unprojectViewMatrix: function (projectionMatrix, worldMatrix) - { - return this.applyMatrix4(projectionMatrix).applyMatrix4(worldMatrix); + centerY: { + + get: function () + { + return this.y + (0.5 * this.height); + } + }, /** - * Unproject this point from 2D space to 3D space. - * The point should have its x and y properties set to - * 2D screen space, and the z either at 0 (near plane) - * or 1 (far plane). The provided matrix is assumed to already - * be combined, i.e. projection * view * model. - * - * After this operation, this vector's (x, y, z) components will - * represent the unprojected 3D coordinate. + * The displayed width of the camera viewport, factoring in the camera zoom level. * - * @method Phaser.Math.Vector3#unproject - * @since 3.0.0 + * If a camera has a viewport width of 800 and a zoom of 0.5 then its display width + * would be 1600, as it's displaying twice as many pixels as zoom level 1. * - * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels. - * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix. + * Equally, a camera with a width of 800 and zoom of 2 would have a display width + * of 400 pixels. * - * @return {Phaser.Math.Vector3} This Vector3. + * @name Phaser.Cameras.Scene2D.BaseCamera#displayWidth + * @type {number} + * @readonly + * @since 3.11.0 */ - unproject: function (viewport, invProjectionView) - { - var viewX = viewport.x; - var viewY = viewport.y; - var viewWidth = viewport.z; - var viewHeight = viewport.w; - - var x = this.x - viewX; - var y = (viewHeight - this.y - 1) - viewY; - var z = this.z; + displayWidth: { - this.x = (2 * x) / viewWidth - 1; - this.y = (2 * y) / viewHeight - 1; - this.z = 2 * z - 1; + get: function () + { + return this.width / this.zoomX; + } - return this.project(invProjectionView); }, /** - * Make this Vector the zero vector (0, 0, 0). + * The displayed height of the camera viewport, factoring in the camera zoom level. * - * @method Phaser.Math.Vector3#reset - * @since 3.0.0 + * If a camera has a viewport height of 600 and a zoom of 0.5 then its display height + * would be 1200, as it's displaying twice as many pixels as zoom level 1. * - * @return {Phaser.Math.Vector3} This Vector3. + * Equally, a camera with a height of 600 and zoom of 2 would have a display height + * of 300 pixels. + * + * @name Phaser.Cameras.Scene2D.BaseCamera#displayHeight + * @type {number} + * @readonly + * @since 3.11.0 */ - reset: function () - { - this.x = 0; - this.y = 0; - this.z = 0; + displayHeight: { + + get: function () + { + return this.height / this.zoomY; + } - return this; } }); -/** - * A static zero Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.ZERO - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.ZERO = new Vector3(); +module.exports = BaseCamera; -/** - * A static right Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.RIGHT - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.RIGHT = new Vector3(1, 0, 0); -/** - * A static left Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.LEFT - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.LEFT = new Vector3(-1, 0, 0); +/***/ }), + +/***/ 47751: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * A static up Vector3 for use by reference. - * - * This constant is meant for comparison operations and should not be modified directly. - * - * @constant - * @name Phaser.Math.Vector3.UP - * @type {Phaser.Math.Vector3} - * @since 3.16.0 + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -Vector3.UP = new Vector3(0, -1, 0); + +var BaseCamera = __webpack_require__(51052); +var CenterOn = __webpack_require__(79993); +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var Effects = __webpack_require__(53030); +var Events = __webpack_require__(89787); +var Linear = __webpack_require__(42798); +var Rectangle = __webpack_require__(74118); +var Vector2 = __webpack_require__(93736); /** - * A static down Vector3 for use by reference. + * @classdesc + * A Camera. * - * This constant is meant for comparison operations and should not be modified directly. + * The Camera is the way in which all games are rendered in Phaser. They provide a view into your game world, + * and can be positioned, rotated, zoomed and scrolled accordingly. * - * @constant - * @name Phaser.Math.Vector3.DOWN - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.DOWN = new Vector3(0, 1, 0); - -/** - * A static forward Vector3 for use by reference. + * A Camera consists of two elements: The viewport and the scroll values. * - * This constant is meant for comparison operations and should not be modified directly. + * The viewport is the physical position and size of the Camera within your game. Cameras, by default, are + * created the same size as your game, but their position and size can be set to anything. This means if you + * wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game, + * you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`). * - * @constant - * @name Phaser.Math.Vector3.FORWARD - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.FORWARD = new Vector3(0, 0, 1); - -/** - * A static back Vector3 for use by reference. + * If you wish to change where the Camera is looking in your game, then you scroll it. You can do this + * via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the + * viewport, and changing the viewport has no impact on the scrolling. * - * This constant is meant for comparison operations and should not be modified directly. + * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, + * allowing you to filter Game Objects out on a per-Camera basis. * - * @constant - * @name Phaser.Math.Vector3.BACK - * @type {Phaser.Math.Vector3} - * @since 3.16.0 - */ -Vector3.BACK = new Vector3(0, 0, -1); - -/** - * A static one Vector3 for use by reference. + * A Camera also has built-in special effects including Fade, Flash and Camera Shake. * - * This constant is meant for comparison operations and should not be modified directly. + * @class Camera + * @memberof Phaser.Cameras.Scene2D + * @constructor + * @since 3.0.0 * - * @constant - * @name Phaser.Math.Vector3.ONE - * @type {Phaser.Math.Vector3} - * @since 3.16.0 + * @extends Phaser.Cameras.Scene2D.BaseCamera + * @extends Phaser.GameObjects.Components.PostPipeline + * + * @param {number} x - The x position of the Camera, relative to the top-left of the game canvas. + * @param {number} y - The y position of the Camera, relative to the top-left of the game canvas. + * @param {number} width - The width of the Camera, in pixels. + * @param {number} height - The height of the Camera, in pixels. */ -Vector3.ONE = new Vector3(1, 1, 1); - -module.exports = Vector3; +var Camera = new Class({ + Extends: BaseCamera, -/***/ }), -/* 40 */ -/***/ (function(module, exports) { + Mixins: [ + Components.PostPipeline + ], -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + initialize: -/** - * @namespace Phaser.Tilemaps.Formats - */ + function Camera (x, y, width, height) + { + BaseCamera.call(this, x, y, width, height); -module.exports = { + this.initPostPipeline(); - /** - * CSV Map Type - * - * @name Phaser.Tilemaps.Formats.CSV - * @type {number} - * @since 3.0.0 - */ - CSV: 0, + /** + * Does this Camera allow the Game Objects it renders to receive input events? + * + * @name Phaser.Cameras.Scene2D.Camera#inputEnabled + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.inputEnabled = true; - /** - * Tiled JSON Map Type - * - * @name Phaser.Tilemaps.Formats.TILED_JSON - * @type {number} - * @since 3.0.0 - */ - TILED_JSON: 1, + /** + * The Camera Fade effect handler. + * To fade this camera see the `Camera.fade` methods. + * + * @name Phaser.Cameras.Scene2D.Camera#fadeEffect + * @type {Phaser.Cameras.Scene2D.Effects.Fade} + * @since 3.5.0 + */ + this.fadeEffect = new Effects.Fade(this); - /** - * 2D Array Map Type - * - * @name Phaser.Tilemaps.Formats.ARRAY_2D - * @type {number} - * @since 3.0.0 - */ - ARRAY_2D: 2, + /** + * The Camera Flash effect handler. + * To flash this camera see the `Camera.flash` method. + * + * @name Phaser.Cameras.Scene2D.Camera#flashEffect + * @type {Phaser.Cameras.Scene2D.Effects.Flash} + * @since 3.5.0 + */ + this.flashEffect = new Effects.Flash(this); - /** - * Weltmeister (Impact.js) Map Type - * - * @name Phaser.Tilemaps.Formats.WELTMEISTER - * @type {number} - * @since 3.0.0 - */ - WELTMEISTER: 3 + /** + * The Camera Shake effect handler. + * To shake this camera see the `Camera.shake` method. + * + * @name Phaser.Cameras.Scene2D.Camera#shakeEffect + * @type {Phaser.Cameras.Scene2D.Effects.Shake} + * @since 3.5.0 + */ + this.shakeEffect = new Effects.Shake(this); -}; + /** + * The Camera Pan effect handler. + * To pan this camera see the `Camera.pan` method. + * + * @name Phaser.Cameras.Scene2D.Camera#panEffect + * @type {Phaser.Cameras.Scene2D.Effects.Pan} + * @since 3.11.0 + */ + this.panEffect = new Effects.Pan(this); + /** + * The Camera Rotate To effect handler. + * To rotate this camera see the `Camera.rotateTo` method. + * + * @name Phaser.Cameras.Scene2D.Camera#rotateToEffect + * @type {Phaser.Cameras.Scene2D.Effects.RotateTo} + * @since 3.23.0 + */ + this.rotateToEffect = new Effects.RotateTo(this); -/***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The Camera Zoom effect handler. + * To zoom this camera see the `Camera.zoom` method. + * + * @name Phaser.Cameras.Scene2D.Camera#zoomEffect + * @type {Phaser.Cameras.Scene2D.Effects.Zoom} + * @since 3.11.0 + */ + this.zoomEffect = new Effects.Zoom(this); -/** - * The `Matter.Body` module contains methods for creating and manipulating body models. - * A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`. - * Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module `Matter.Bodies`. - * - * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). - * @class Body - */ + /** + * The linear interpolation value to use when following a target. + * + * Can also be set via `setLerp` or as part of the `startFollow` call. + * + * The default values of 1 means the camera will instantly snap to the target coordinates. + * A lower value, such as 0.1 means the camera will more slowly track the target, giving + * a smooth transition. You can set the horizontal and vertical values independently, and also + * adjust this value in real-time during your game. + * + * Be sure to keep the value between 0 and 1. A value of zero will disable tracking on that axis. + * + * @name Phaser.Cameras.Scene2D.Camera#lerp + * @type {Phaser.Math.Vector2} + * @since 3.9.0 + */ + this.lerp = new Vector2(1, 1); -var Body = {}; + /** + * The values stored in this property are subtracted from the Camera targets position, allowing you to + * offset the camera from the actual target x/y coordinates by this amount. + * Can also be set via `setFollowOffset` or as part of the `startFollow` call. + * + * @name Phaser.Cameras.Scene2D.Camera#followOffset + * @type {Phaser.Math.Vector2} + * @since 3.9.0 + */ + this.followOffset = new Vector2(); -module.exports = Body; - -var Vertices = __webpack_require__(64); -var Vector = __webpack_require__(83); -var Sleeping = __webpack_require__(165); -var Common = __webpack_require__(32); -var Bounds = __webpack_require__(84); -var Axes = __webpack_require__(271); - -(function() { + /** + * The Camera dead zone. + * + * The deadzone is only used when the camera is following a target. + * + * It defines a rectangular region within which if the target is present, the camera will not scroll. + * If the target moves outside of this area, the camera will begin scrolling in order to follow it. + * + * The `lerp` values that you can set for a follower target also apply when using a deadzone. + * + * You can directly set this property to be an instance of a Rectangle. Or, you can use the + * `setDeadzone` method for a chainable approach. + * + * The rectangle you provide can have its dimensions adjusted dynamically, however, please + * note that its position is updated every frame, as it is constantly re-centered on the cameras mid point. + * + * Calling `setDeadzone` with no arguments will reset an active deadzone, as will setting this property + * to `null`. + * + * @name Phaser.Cameras.Scene2D.Camera#deadzone + * @type {?Phaser.Geom.Rectangle} + * @since 3.11.0 + */ + this.deadzone = null; - Body._inertiaScale = 4; - Body._nextCollidingGroupId = 1; - Body._nextNonCollidingGroupId = -1; - Body._nextCategory = 0x0001; + /** + * Internal follow target reference. + * + * @name Phaser.Cameras.Scene2D.Camera#_follow + * @type {?any} + * @private + * @default null + * @since 3.0.0 + */ + this._follow = null; + }, /** - * Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * Vertices must be specified in clockwise order. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {} options - * @return {body} body + * Sets the Camera dead zone. + * + * The deadzone is only used when the camera is following a target. + * + * It defines a rectangular region within which if the target is present, the camera will not scroll. + * If the target moves outside of this area, the camera will begin scrolling in order to follow it. + * + * The deadzone rectangle is re-positioned every frame so that it is centered on the mid-point + * of the camera. This allows you to use the object for additional game related checks, such as + * testing if an object is within it or not via a Rectangle.contains call. + * + * The `lerp` values that you can set for a follower target also apply when using a deadzone. + * + * Calling this method with no arguments will reset an active deadzone. + * + * @method Phaser.Cameras.Scene2D.Camera#setDeadzone + * @since 3.11.0 + * + * @param {number} [width] - The width of the deadzone rectangle in pixels. If not specified the deadzone is removed. + * @param {number} [height] - The height of the deadzone rectangle in pixels. + * + * @return {this} This Camera instance. */ - Body.create = function(options) { - var defaults = { - id: Common.nextId(), - type: 'body', - label: 'Body', - parts: [], - plugin: {}, - angle: 0, - vertices: null, // Phaser change: no point calling fromPath if they pass in vertices anyway - position: { x: 0, y: 0 }, - force: { x: 0, y: 0 }, - torque: 0, - positionImpulse: { x: 0, y: 0 }, - previousPositionImpulse: { x: 0, y: 0 }, - constraintImpulse: { x: 0, y: 0, angle: 0 }, - totalContacts: 0, - speed: 0, - angularSpeed: 0, - velocity: { x: 0, y: 0 }, - angularVelocity: 0, - isSensor: false, - isStatic: false, - isSleeping: false, - motion: 0, - sleepThreshold: 60, - density: 0.001, - restitution: 0, - friction: 0.1, - frictionStatic: 0.5, - frictionAir: 0.01, - collisionFilter: { - category: 0x0001, - mask: 0xFFFFFFFF, - group: 0 - }, - slop: 0.05, - timeScale: 1, - events: null, - bounds: null, - chamfer: null, - circleRadius: 0, - positionPrev: null, - anglePrev: 0, - parent: null, - axes: null, - area: 0, - mass: 0, - inverseMass: 0, - inertia: 0, - inverseInertia: 0, - _original: null, - render: { - visible: true, - opacity: 1, - sprite: { - xOffset: 0, - yOffset: 0 - }, - fillColor: null, // custom Phaser property - fillOpacity: null, // custom Phaser property - lineColor: null, // custom Phaser property - lineOpacity: null, // custom Phaser property - lineThickness: null // custom Phaser property - }, - gameObject: null, // custom Phaser property - scale: { x: 1, y: 1 }, // custom Phaser property - centerOfMass: { x: 0, y: 0 }, // custom Phaser property (float, 0 - 1) - centerOffset: { x: 0, y: 0 }, // custom Phaser property (pixel values) - gravityScale: { x: 1, y: 1 }, // custom Phaser property - ignoreGravity: false, // custom Phaser property - ignorePointer: false, // custom Phaser property - onCollideCallback: null, // custom Phaser property - onCollideEndCallback: null, // custom Phaser property - onCollideActiveCallback: null, // custom Phaser property - onCollideWith: {} // custom Phaser property - }; - - if (!options.hasOwnProperty('position') && options.hasOwnProperty('vertices')) - { - options.position = Vertices.centre(options.vertices); - } - else if (!options.hasOwnProperty('vertices')) + setDeadzone: function (width, height) + { + if (width === undefined) { - defaults.vertices = Vertices.fromPath('L 0 0 L 40 0 L 40 40 L 0 40'); + this.deadzone = null; } - - var body = Common.extend(defaults, options); - - _initProperties(body, options); - - // Helper function - body.setOnCollideWith = function (body, callback) + else { - if (callback) + if (this.deadzone) { - this.onCollideWith[body.id] = callback; + this.deadzone.width = width; + this.deadzone.height = height; } else { - delete this.onCollideWith[body.id]; + this.deadzone = new Rectangle(0, 0, width, height); } - return this; + if (this._follow) + { + var originX = this.width / 2; + var originY = this.height / 2; + + var fx = this._follow.x - this.followOffset.x; + var fy = this._follow.y - this.followOffset.y; + + this.midPoint.set(fx, fy); + + this.scrollX = fx - originX; + this.scrollY = fy - originY; + } + + CenterOn(this.deadzone, this.midPoint.x, this.midPoint.y); } - return body; - }; + return this; + }, /** - * Returns the next unique group index for which bodies will collide. - * If `isNonColliding` is `true`, returns the next unique group index for which bodies will _not_ collide. - * See `body.collisionFilter` for more information. - * @method nextGroup - * @param {bool} [isNonColliding=false] - * @return {Number} Unique group index + * Fades the Camera in from the given color over the duration specified. + * + * @method Phaser.Cameras.Scene2D.Camera#fadeIn + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE + * @since 3.3.0 + * + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * + * @return {this} This Camera instance. */ - Body.nextGroup = function(isNonColliding) { - if (isNonColliding) - return Body._nextNonCollidingGroupId--; - - return Body._nextCollidingGroupId++; - }; + fadeIn: function (duration, red, green, blue, callback, context) + { + return this.fadeEffect.start(false, duration, red, green, blue, true, callback, context); + }, /** - * Returns the next unique category bitfield (starting after the initial default category `0x0001`). - * There are 32 available. See `body.collisionFilter` for more information. - * @method nextCategory - * @return {Number} Unique category bitfield + * Fades the Camera out to the given color over the duration specified. + * This is an alias for Camera.fade that forces the fade to start, regardless of existing fades. + * + * @method Phaser.Cameras.Scene2D.Camera#fadeOut + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE + * @since 3.3.0 + * + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * + * @return {this} This Camera instance. */ - Body.nextCategory = function() { - Body._nextCategory = Body._nextCategory << 1; - return Body._nextCategory; - }; + fadeOut: function (duration, red, green, blue, callback, context) + { + return this.fadeEffect.start(true, duration, red, green, blue, true, callback, context); + }, /** - * Initialises body properties. - * @method _initProperties - * @private - * @param {body} body - * @param {} [options] + * Fades the Camera from the given color to transparent over the duration specified. + * + * @method Phaser.Cameras.Scene2D.Camera#fadeFrom + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE + * @since 3.5.0 + * + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. + * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * + * @return {this} This Camera instance. */ - var _initProperties = function(body, options) { - options = options || {}; - - // init required properties (order is important) - Body.set(body, { - bounds: body.bounds || Bounds.create(body.vertices), - positionPrev: body.positionPrev || Vector.clone(body.position), - anglePrev: body.anglePrev || body.angle, - vertices: body.vertices, - parts: body.parts || [body], - isStatic: body.isStatic, - isSleeping: body.isSleeping, - parent: body.parent || body - }); - - var bounds = body.bounds; - - Vertices.rotate(body.vertices, body.angle, body.position); - Axes.rotate(body.axes, body.angle); - Bounds.update(bounds, body.vertices, body.velocity); - - // allow options to override the automatically calculated properties - Body.set(body, { - axes: options.axes || body.axes, - area: options.area || body.area, - mass: options.mass || body.mass, - inertia: options.inertia || body.inertia - }); - - if (body.parts.length === 1) - { - var centerOfMass = body.centerOfMass; - var centerOffset = body.centerOffset; - - var bodyWidth = bounds.max.x - bounds.min.x; - var bodyHeight = bounds.max.y - bounds.min.y; - - centerOfMass.x = -(bounds.min.x - body.position.x) / bodyWidth; - centerOfMass.y = -(bounds.min.y - body.position.y) / bodyHeight; - - centerOffset.x = bodyWidth * centerOfMass.x; - centerOffset.y = bodyHeight * centerOfMass.y; - } - }; + fadeFrom: function (duration, red, green, blue, force, callback, context) + { + return this.fadeEffect.start(false, duration, red, green, blue, force, callback, context); + }, /** - * Given a property and a value (or map of), sets the property(s) on the body, using the appropriate setter functions if they exist. - * Prefer to use the actual setter functions in performance critical situations. - * @method set - * @param {body} body - * @param {} settings A property name (or map of properties and values) to set on the body. - * @param {} value The value to set if `settings` is a single property name. + * Fades the Camera from transparent to the given color over the duration specified. + * + * @method Phaser.Cameras.Scene2D.Camera#fade + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE + * @since 3.0.0 + * + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. + * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * + * @return {this} This Camera instance. */ - Body.set = function(body, settings, value) { - var property; - - if (typeof settings === 'string') { - property = settings; - settings = {}; - settings[property] = value; - } - - for (property in settings) { - if (!Object.prototype.hasOwnProperty.call(settings, property)) - continue; - - value = settings[property]; - switch (property) { - - case 'isStatic': - Body.setStatic(body, value); - break; - case 'isSleeping': - Sleeping.set(body, value); - break; - case 'mass': - Body.setMass(body, value); - break; - case 'density': - Body.setDensity(body, value); - break; - case 'inertia': - Body.setInertia(body, value); - break; - case 'vertices': - Body.setVertices(body, value); - break; - case 'position': - Body.setPosition(body, value); - break; - case 'angle': - Body.setAngle(body, value); - break; - case 'velocity': - Body.setVelocity(body, value); - break; - case 'angularVelocity': - Body.setAngularVelocity(body, value); - break; - case 'parts': - Body.setParts(body, value); - break; - case 'centre': - Body.setCentre(body, value); - break; - default: - body[property] = value; - } - } - }; + fade: function (duration, red, green, blue, force, callback, context) + { + return this.fadeEffect.start(true, duration, red, green, blue, force, callback, context); + }, /** - * Sets the body as static, including isStatic flag and setting mass and inertia to Infinity. - * @method setStatic - * @param {body} body - * @param {bool} isStatic + * Flashes the Camera by setting it to the given color immediately and then fading it away again quickly over the duration specified. + * + * @method Phaser.Cameras.Scene2D.Camera#flash + * @fires Phaser.Cameras.Scene2D.Events#FLASH_START + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE + * @since 3.0.0 + * + * @param {number} [duration=250] - The duration of the effect in milliseconds. + * @param {number} [red=255] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=255] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=255] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. + * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * + * @return {this} This Camera instance. */ - Body.setStatic = function(body, isStatic) { - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - part.isStatic = isStatic; - - if (isStatic) { - part._original = { - restitution: part.restitution, - friction: part.friction, - mass: part.mass, - inertia: part.inertia, - density: part.density, - inverseMass: part.inverseMass, - inverseInertia: part.inverseInertia - }; - - part.restitution = 0; - part.friction = 1; - part.mass = part.inertia = part.density = Infinity; - part.inverseMass = part.inverseInertia = 0; - - part.positionPrev.x = part.position.x; - part.positionPrev.y = part.position.y; - part.anglePrev = part.angle; - part.angularVelocity = 0; - part.speed = 0; - part.angularSpeed = 0; - part.motion = 0; - } else if (part._original) { - part.restitution = part._original.restitution; - part.friction = part._original.friction; - part.mass = part._original.mass; - part.inertia = part._original.inertia; - part.density = part._original.density; - part.inverseMass = part._original.inverseMass; - part.inverseInertia = part._original.inverseInertia; - - part._original = null; - } - } - }; + flash: function (duration, red, green, blue, force, callback, context) + { + return this.flashEffect.start(duration, red, green, blue, force, callback, context); + }, /** - * Sets the mass of the body. Inverse mass, density and inertia are automatically updated to reflect the change. - * @method setMass - * @param {body} body - * @param {number} mass + * Shakes the Camera by the given intensity over the duration specified. + * + * @method Phaser.Cameras.Scene2D.Camera#shake + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_START + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE + * @since 3.0.0 + * + * @param {number} [duration=100] - The duration of the effect in milliseconds. + * @param {(number|Phaser.Math.Vector2)} [intensity=0.05] - The intensity of the shake. + * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * + * @return {this} This Camera instance. */ - Body.setMass = function(body, mass) { - var moment = body.inertia / (body.mass / 6); - body.inertia = moment * (mass / 6); - body.inverseInertia = 1 / body.inertia; - - body.mass = mass; - body.inverseMass = 1 / body.mass; - body.density = body.mass / body.area; - }; + shake: function (duration, intensity, force, callback, context) + { + return this.shakeEffect.start(duration, intensity, force, callback, context); + }, /** - * Sets the density of the body. Mass and inertia are automatically updated to reflect the change. - * @method setDensity - * @param {body} body - * @param {number} density + * This effect will scroll the Camera so that the center of its viewport finishes at the given destination, + * over the duration and with the ease specified. + * + * @method Phaser.Cameras.Scene2D.Camera#pan + * @fires Phaser.Cameras.Scene2D.Events#PAN_START + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE + * @since 3.11.0 + * + * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. + * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. + * @param {Phaser.Types.Cameras.Scene2D.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, + * the current camera scroll x coordinate and the current camera scroll y coordinate. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * + * @return {this} This Camera instance. */ - Body.setDensity = function(body, density) { - Body.setMass(body, density * body.area); - body.density = density; - }; + pan: function (x, y, duration, ease, force, callback, context) + { + return this.panEffect.start(x, y, duration, ease, force, callback, context); + }, /** - * Sets the moment of inertia (i.e. second moment of area) of the body. - * Inverse inertia is automatically updated to reflect the change. Mass is not changed. - * @method setInertia - * @param {body} body - * @param {number} inertia + * This effect will rotate the Camera so that the viewport finishes at the given angle in radians, + * over the duration and with the ease specified. + * + * @method Phaser.Cameras.Scene2D.Camera#rotateTo + * @since 3.23.0 + * + * @param {number} radians - The destination angle in radians to rotate the Camera viewport to. If the angle is positive then the rotation is clockwise else anticlockwise + * @param {boolean} [shortestPath=false] - If shortest path is set to true the camera will rotate in the quickest direction clockwise or anti-clockwise. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {(string|function)} [ease='Linear'] - The ease to use for the rotation. Can be any of the Phaser Easing constants or a custom function. + * @param {boolean} [force=false] - Force the rotation effect to start immediately, even if already running. + * @param {CameraRotateCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, + * the current camera rotation angle in radians. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * + * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. */ - Body.setInertia = function(body, inertia) { - body.inertia = inertia; - body.inverseInertia = 1 / body.inertia; - }; + rotateTo: function (radians, shortestPath, duration, ease, force, callback, context) + { + return this.rotateToEffect.start(radians, shortestPath, duration, ease, force, callback, context); + }, /** - * Sets the body's vertices and updates body properties accordingly, including inertia, area and mass (with respect to `body.density`). - * Vertices will be automatically transformed to be orientated around their centre of mass as the origin. - * They are then automatically translated to world space based on `body.position`. + * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. * - * The `vertices` argument should be passed as an array of `Matter.Vector` points (or a `Matter.Vertices` array). - * Vertices must form a convex hull, concave hulls are not supported. + * @method Phaser.Cameras.Scene2D.Camera#zoomTo + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_START + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE + * @since 3.11.0 * - * @method setVertices - * @param {body} body - * @param {vector[]} vertices + * @param {number} zoom - The target Camera zoom value. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. + * @param {Phaser.Types.Cameras.Scene2D.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, + * the current camera scroll x coordinate and the current camera scroll y coordinate. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * + * @return {this} This Camera instance. */ - Body.setVertices = function(body, vertices) { - // change vertices - if (vertices[0].body === body) { - body.vertices = vertices; - } else { - body.vertices = Vertices.create(vertices, body); - } + zoomTo: function (zoom, duration, ease, force, callback, context) + { + return this.zoomEffect.start(zoom, duration, ease, force, callback, context); + }, - // update properties - body.axes = Axes.fromVertices(body.vertices); - body.area = Vertices.area(body.vertices); - Body.setMass(body, body.density * body.area); + /** + * Internal preRender step. + * + * @method Phaser.Cameras.Scene2D.Camera#preRender + * @protected + * @since 3.0.0 + */ + preRender: function () + { + this.renderList.length = 0; - // orient vertices around the centre of mass at origin (0, 0) - var centre = Vertices.centre(body.vertices); - Vertices.translate(body.vertices, centre, -1); + var width = this.width; + var height = this.height; - // update inertia while vertices are at origin (0, 0) - Body.setInertia(body, Body._inertiaScale * Vertices.inertia(body.vertices, body.mass)); + var halfWidth = width * 0.5; + var halfHeight = height * 0.5; - // update geometry - Vertices.translate(body.vertices, body.position); + var zoom = this.zoom; + var matrix = this.matrix; - Bounds.update(body.bounds, body.vertices, body.velocity); - }; + var originX = width * this.originX; + var originY = height * this.originY; - /** - * Sets the parts of the `body` and updates mass, inertia and centroid. - * Each part will have its parent set to `body`. - * By default the convex hull will be automatically computed and set on `body`, unless `autoHull` is set to `false.` - * Note that this method will ensure that the first part in `body.parts` will always be the `body`. - * @method setParts - * @param {body} body - * @param [body] parts - * @param {bool} [autoHull=true] - */ - Body.setParts = function(body, parts, autoHull) { - var i; + var follow = this._follow; + var deadzone = this.deadzone; - // add all the parts, ensuring that the first part is always the parent body - parts = parts.slice(0); - body.parts.length = 0; - body.parts.push(body); - body.parent = body; + var sx = this.scrollX; + var sy = this.scrollY; - for (i = 0; i < parts.length; i++) { - var part = parts[i]; - if (part !== body) { - part.parent = body; - body.parts.push(part); - } + if (deadzone) + { + CenterOn(deadzone, this.midPoint.x, this.midPoint.y); } - if (body.parts.length === 1) - return; + var emitFollowEvent = false; - autoHull = typeof autoHull !== 'undefined' ? autoHull : true; + if (this.roundPixels) + { + originX = Math.floor(originX); + originY = Math.floor(originY); + } - // find the convex hull of all parts to set on the parent body - if (autoHull) { - var vertices = []; - for (i = 0; i < parts.length; i++) { - vertices = vertices.concat(parts[i].vertices); + if (follow && !this.panEffect.isRunning) + { + var lerp = this.lerp; + + var fx = follow.x - this.followOffset.x; + var fy = follow.y - this.followOffset.y; + + if (this.roundPixels) + { + fx = Math.floor(fx); + fy = Math.floor(fy); } - Vertices.clockwiseSort(vertices); + if (deadzone) + { + if (fx < deadzone.x) + { + sx = Linear(sx, sx - (deadzone.x - fx), lerp.x); + } + else if (fx > deadzone.right) + { + sx = Linear(sx, sx + (fx - deadzone.right), lerp.x); + } - var hull = Vertices.hull(vertices), - hullCentre = Vertices.centre(hull); + if (fy < deadzone.y) + { + sy = Linear(sy, sy - (deadzone.y - fy), lerp.y); + } + else if (fy > deadzone.bottom) + { + sy = Linear(sy, sy + (fy - deadzone.bottom), lerp.y); + } + } + else + { + sx = Linear(sx, fx - originX, lerp.x); + sy = Linear(sy, fy - originY, lerp.y); + } - Body.setVertices(body, hull); - Vertices.translate(body.vertices, hullCentre); + emitFollowEvent = true; } - // sum the properties of all compound parts of the parent body - var total = Body._totalProperties(body); - - // Phaser addition - var cx = total.centre.x; - var cy = total.centre.y; + if (this.useBounds) + { + sx = this.clampX(sx); + sy = this.clampY(sy); + } - var bounds = body.bounds; - var centerOfMass = body.centerOfMass; - var centerOffset = body.centerOffset; + if (this.roundPixels) + { + sx = Math.floor(sx); + sy = Math.floor(sy); + } - Bounds.update(bounds, body.vertices, body.velocity); + // Values are in pixels and not impacted by zooming the Camera + this.scrollX = sx; + this.scrollY = sy; - centerOfMass.x = -(bounds.min.x - cx) / (bounds.max.x - bounds.min.x); - centerOfMass.y = -(bounds.min.y - cy) / (bounds.max.y - bounds.min.y); + var midX = sx + halfWidth; + var midY = sy + halfHeight; - centerOffset.x = cx; - centerOffset.y = cy; + // The center of the camera, in world space, so taking zoom into account + // Basically the pixel value of what it's looking at in the middle of the cam + this.midPoint.set(midX, midY); - body.area = total.area; - body.parent = body; - body.position.x = cx; - body.position.y = cy; - body.positionPrev.x = cx; - body.positionPrev.y = cy; + var displayWidth = width / zoom; + var displayHeight = height / zoom; - Body.setMass(body, total.mass); - Body.setInertia(body, total.inertia); - Body.setPosition(body, total.centre); - }; + var vwx = midX - (displayWidth / 2); + var vwy = midY - (displayHeight / 2); - /** - * Set the centre of mass of the body. - * The `centre` is a vector in world-space unless `relative` is set, in which case it is a translation. - * The centre of mass is the point the body rotates about and can be used to simulate non-uniform density. - * This is equal to moving `body.position` but not the `body.vertices`. - * Invalid if the `centre` falls outside the body's convex hull. - * @method setCentre - * @param {body} body - * @param {vector} centre - * @param {bool} relative - */ - Body.setCentre = function(body, centre, relative) { - if (!relative) { - body.positionPrev.x = centre.x - (body.position.x - body.positionPrev.x); - body.positionPrev.y = centre.y - (body.position.y - body.positionPrev.y); - body.position.x = centre.x; - body.position.y = centre.y; - } else { - body.positionPrev.x += centre.x; - body.positionPrev.y += centre.y; - body.position.x += centre.x; - body.position.y += centre.y; + if (this.roundPixels) + { + vwx = Math.floor(vwx); + vwy = Math.floor(vwy); } - }; - /** - * Sets the position of the body instantly. Velocity, angle, force etc. are unchanged. - * @method setPosition - * @param {body} body - * @param {vector} position - */ - Body.setPosition = function(body, position) { - var delta = Vector.sub(position, body.position); - body.positionPrev.x += delta.x; - body.positionPrev.y += delta.y; + this.worldView.setTo(vwx, vwy, displayWidth, displayHeight); - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - part.position.x += delta.x; - part.position.y += delta.y; - Vertices.translate(part.vertices, delta); - Bounds.update(part.bounds, part.vertices, body.velocity); - } - }; + matrix.applyITRS(Math.floor(this.x + originX), Math.floor(this.y + originY), this.rotation, zoom, zoom); + matrix.translate(-originX, -originY); - /** - * Sets the angle of the body instantly. Angular velocity, position, force etc. are unchanged. - * @method setAngle - * @param {body} body - * @param {number} angle - */ - Body.setAngle = function(body, angle) { - var delta = angle - body.angle; - body.anglePrev += delta; + this.shakeEffect.preRender(); - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - part.angle += delta; - Vertices.rotate(part.vertices, delta, body.position); - Axes.rotate(part.axes, delta); - Bounds.update(part.bounds, part.vertices, body.velocity); - if (i > 0) { - Vector.rotateAbout(part.position, delta, body.position, part.position); - } + if (emitFollowEvent) + { + this.emit(Events.FOLLOW_UPDATE, this, follow); } - }; + }, /** - * Sets the linear velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`. - * @method setVelocity - * @param {body} body - * @param {vector} velocity + * Sets the linear interpolation value to use when following a target. + * + * The default values of 1 means the camera will instantly snap to the target coordinates. + * A lower value, such as 0.1 means the camera will more slowly track the target, giving + * a smooth transition. You can set the horizontal and vertical values independently, and also + * adjust this value in real-time during your game. + * + * Be sure to keep the value between 0 and 1. A value of zero will disable tracking on that axis. + * + * @method Phaser.Cameras.Scene2D.Camera#setLerp + * @since 3.9.0 + * + * @param {number} [x=1] - The amount added to the horizontal linear interpolation of the follow target. + * @param {number} [y=1] - The amount added to the vertical linear interpolation of the follow target. + * + * @return {this} This Camera instance. */ - Body.setVelocity = function(body, velocity) { - body.positionPrev.x = body.position.x - velocity.x; - body.positionPrev.y = body.position.y - velocity.y; - body.velocity.x = velocity.x; - body.velocity.y = velocity.y; - body.speed = Vector.magnitude(body.velocity); - }; + setLerp: function (x, y) + { + if (x === undefined) { x = 1; } + if (y === undefined) { y = x; } - /** - * Sets the angular velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`. - * @method setAngularVelocity - * @param {body} body - * @param {number} velocity - */ - Body.setAngularVelocity = function(body, velocity) { - body.anglePrev = body.angle - velocity; - body.angularVelocity = velocity; - body.angularSpeed = Math.abs(body.angularVelocity); - }; + this.lerp.set(x, y); - /** - * Moves a body by a given vector relative to its current position, without imparting any velocity. - * @method translate - * @param {body} body - * @param {vector} translation - */ - Body.translate = function(body, translation) { - Body.setPosition(body, Vector.add(body.position, translation)); - }; + return this; + }, /** - * Rotates a body by a given angle relative to its current angle, without imparting any angular velocity. - * @method rotate - * @param {body} body - * @param {number} rotation - * @param {vector} [point] + * Sets the horizontal and vertical offset of the camera from its follow target. + * The values are subtracted from the targets position during the Cameras update step. + * + * @method Phaser.Cameras.Scene2D.Camera#setFollowOffset + * @since 3.9.0 + * + * @param {number} [x=0] - The horizontal offset from the camera follow target.x position. + * @param {number} [y=0] - The vertical offset from the camera follow target.y position. + * + * @return {this} This Camera instance. */ - Body.rotate = function(body, rotation, point) { - if (!point) { - Body.setAngle(body, body.angle + rotation); - } else { - var cos = Math.cos(rotation), - sin = Math.sin(rotation), - dx = body.position.x - point.x, - dy = body.position.y - point.y; - - Body.setPosition(body, { - x: point.x + (dx * cos - dy * sin), - y: point.y + (dx * sin + dy * cos) - }); + setFollowOffset: function (x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } - Body.setAngle(body, body.angle + rotation); - } - }; + this.followOffset.set(x, y); + + return this; + }, /** - * Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre). - * @method scale - * @param {body} body - * @param {number} scaleX - * @param {number} scaleY - * @param {vector} [point] + * Sets the Camera to follow a Game Object. + * + * When enabled the Camera will automatically adjust its scroll position to keep the target Game Object + * in its center. + * + * You can set the linear interpolation value used in the follow code. + * Use low lerp values (such as 0.1) to automatically smooth the camera motion. + * + * If you find you're getting a slight "jitter" effect when following an object it's probably to do with sub-pixel + * rendering of the targets position. This can be rounded by setting the `roundPixels` argument to `true` to + * force full pixel rounding rendering. Note that this can still be broken if you have specified a non-integer zoom + * value on the camera. So be sure to keep the camera zoom to integers. + * + * @method Phaser.Cameras.Scene2D.Camera#startFollow + * @since 3.0.0 + * + * @param {(Phaser.GameObjects.GameObject|object)} target - The target for the Camera to follow. + * @param {boolean} [roundPixels=false] - Round the camera position to whole integers to avoid sub-pixel rendering? + * @param {number} [lerpX=1] - A value between 0 and 1. This value specifies the amount of linear interpolation to use when horizontally tracking the target. The closer the value to 1, the faster the camera will track. + * @param {number} [lerpY=1] - A value between 0 and 1. This value specifies the amount of linear interpolation to use when vertically tracking the target. The closer the value to 1, the faster the camera will track. + * @param {number} [offsetX=0] - The horizontal offset from the camera follow target.x position. + * @param {number} [offsetY=0] - The vertical offset from the camera follow target.y position. + * + * @return {this} This Camera instance. */ - Body.scale = function(body, scaleX, scaleY, point) { - var totalArea = 0, - totalInertia = 0; - - point = point || body.position; + startFollow: function (target, roundPixels, lerpX, lerpY, offsetX, offsetY) + { + if (roundPixels === undefined) { roundPixels = false; } + if (lerpX === undefined) { lerpX = 1; } + if (lerpY === undefined) { lerpY = lerpX; } + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = offsetX; } - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; + this._follow = target; - part.scale.x = scaleX; - part.scale.y = scaleY; + this.roundPixels = roundPixels; - // scale vertices - Vertices.scale(part.vertices, scaleX, scaleY, point); + lerpX = Clamp(lerpX, 0, 1); + lerpY = Clamp(lerpY, 0, 1); - // update properties - part.axes = Axes.fromVertices(part.vertices); - part.area = Vertices.area(part.vertices); - Body.setMass(part, body.density * part.area); + this.lerp.set(lerpX, lerpY); - // update inertia (requires vertices to be at origin) - Vertices.translate(part.vertices, { x: -part.position.x, y: -part.position.y }); - Body.setInertia(part, Body._inertiaScale * Vertices.inertia(part.vertices, part.mass)); - Vertices.translate(part.vertices, { x: part.position.x, y: part.position.y }); + this.followOffset.set(offsetX, offsetY); - if (i > 0) { - totalArea += part.area; - totalInertia += part.inertia; - } + var originX = this.width / 2; + var originY = this.height / 2; - // scale position - part.position.x = point.x + (part.position.x - point.x) * scaleX; - part.position.y = point.y + (part.position.y - point.y) * scaleY; + var fx = target.x - offsetX; + var fy = target.y - offsetY; - // update bounds - Bounds.update(part.bounds, part.vertices, body.velocity); - } + this.midPoint.set(fx, fy); - // handle parent body - if (body.parts.length > 1) { - body.area = totalArea; + this.scrollX = fx - originX; + this.scrollY = fy - originY; - if (!body.isStatic) { - Body.setMass(body, body.density * totalArea); - Body.setInertia(body, totalInertia); - } + if (this.useBounds) + { + this.scrollX = this.clampX(this.scrollX); + this.scrollY = this.clampY(this.scrollY); } - // handle circles - if (body.circleRadius) { - if (scaleX === scaleY) { - body.circleRadius *= scaleX; - } else { - // body is no longer a circle - body.circleRadius = null; - } - } - }; + return this; + }, /** - * Performs a simulation step for the given `body`, including updating position and angle using Verlet integration. - * @method update - * @param {body} body - * @param {number} deltaTime - * @param {number} timeScale - * @param {number} correction + * Stops a Camera from following a Game Object, if previously set via `Camera.startFollow`. + * + * @method Phaser.Cameras.Scene2D.Camera#stopFollow + * @since 3.0.0 + * + * @return {this} This Camera instance. */ - Body.update = function(body, deltaTime, timeScale, correction) { - var deltaTimeSquared = Math.pow(deltaTime * timeScale * body.timeScale, 2); - - // from the previous step - var frictionAir = 1 - body.frictionAir * timeScale * body.timeScale, - velocityPrevX = body.position.x - body.positionPrev.x, - velocityPrevY = body.position.y - body.positionPrev.y; - - // update velocity with Verlet integration - body.velocity.x = (velocityPrevX * frictionAir * correction) + (body.force.x / body.mass) * deltaTimeSquared; - body.velocity.y = (velocityPrevY * frictionAir * correction) + (body.force.y / body.mass) * deltaTimeSquared; - - body.positionPrev.x = body.position.x; - body.positionPrev.y = body.position.y; - body.position.x += body.velocity.x; - body.position.y += body.velocity.y; + stopFollow: function () + { + this._follow = null; - // update angular velocity with Verlet integration - body.angularVelocity = ((body.angle - body.anglePrev) * frictionAir * correction) + (body.torque / body.inertia) * deltaTimeSquared; - body.anglePrev = body.angle; - body.angle += body.angularVelocity; + return this; + }, - // track speed and acceleration - body.speed = Vector.magnitude(body.velocity); - body.angularSpeed = Math.abs(body.angularVelocity); - - // transform the body geometry - for (var i = 0; i < body.parts.length; i++) { - var part = body.parts[i]; - - Vertices.translate(part.vertices, body.velocity); - - if (i > 0) { - part.position.x += body.velocity.x; - part.position.y += body.velocity.y; - } - - if (body.angularVelocity !== 0) { - Vertices.rotate(part.vertices, body.angularVelocity, body.position); - Axes.rotate(part.axes, body.angularVelocity); - if (i > 0) { - Vector.rotateAbout(part.position, body.angularVelocity, body.position, part.position); - } - } + /** + * Resets any active FX, such as a fade, flash or shake. Useful to call after a fade in order to + * remove the fade. + * + * @method Phaser.Cameras.Scene2D.Camera#resetFX + * @since 3.0.0 + * + * @return {this} This Camera instance. + */ + resetFX: function () + { + this.rotateToEffect.reset(); + this.panEffect.reset(); + this.shakeEffect.reset(); + this.flashEffect.reset(); + this.fadeEffect.reset(); - Bounds.update(part.bounds, part.vertices, body.velocity); - } - }; + return this; + }, /** - * Applies a force to a body from a given world-space position, including resulting torque. - * @method applyForce - * @param {body} body - * @param {vector} position - * @param {vector} force + * Internal method called automatically by the Camera Manager. + * + * @method Phaser.Cameras.Scene2D.Camera#update + * @protected + * @since 3.0.0 + * + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - Body.applyForce = function(body, position, force) { - body.force.x += force.x; - body.force.y += force.y; - var offset = { x: position.x - body.position.x, y: position.y - body.position.y }; - body.torque += offset.x * force.y - offset.y * force.x; - }; + update: function (time, delta) + { + if (this.visible) + { + this.rotateToEffect.update(time, delta); + this.panEffect.update(time, delta); + this.zoomEffect.update(time, delta); + this.shakeEffect.update(time, delta); + this.flashEffect.update(time, delta); + this.fadeEffect.update(time, delta); + } + }, /** - * Returns the sums of the properties of all compound parts of the parent body. - * @method _totalProperties - * @private - * @param {body} body - * @return {} + * Destroys this Camera instance. You rarely need to call this directly. + * + * Called by the Camera Manager. If you wish to destroy a Camera please use `CameraManager.remove` as + * cameras are stored in a pool, ready for recycling later, and calling this directly will prevent that. + * + * @method Phaser.Cameras.Scene2D.Camera#destroy + * @fires Phaser.Cameras.Scene2D.Events#DESTROY + * @since 3.0.0 */ - Body._totalProperties = function(body) { - // from equations at: - // https://ecourses.ou.edu/cgi-bin/ebook.cgi?doc=&topic=st&chap_sec=07.2&page=theory - // http://output.to/sideway/default.asp?qno=121100087 - - var properties = { - mass: 0, - area: 0, - inertia: 0, - centre: { x: 0, y: 0 } - }; - - // sum the properties of all compound parts of the parent body - for (var i = body.parts.length === 1 ? 0 : 1; i < body.parts.length; i++) { - var part = body.parts[i], - mass = part.mass !== Infinity ? part.mass : 1; + destroy: function () + { + this.resetFX(); - properties.mass += mass; - properties.area += part.area; - properties.inertia += part.inertia; - properties.centre = Vector.add(properties.centre, Vector.mult(part.position, mass)); - } + BaseCamera.prototype.destroy.call(this); - properties.centre = Vector.div(properties.centre, properties.mass); + this._follow = null; - return properties; - }; + this.deadzone = null; + } - /* - * - * Events Documentation - * - */ +}); - /** - * Fired when a body starts sleeping (where `this` is the body). - * - * @event sleepStart - * @this {body} The body that has started sleeping - * @param {} event An event object - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ +module.exports = Camera; - /** - * Fired when a body ends sleeping (where `this` is the body). - * - * @event sleepEnd - * @this {body} The body that has ended sleeping - * @param {} event An event object - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - /* - * - * Properties Documentation - * - */ +/***/ }), - /** - * An integer `Number` uniquely identifying number generated in `Body.create` by `Common.nextId`. - * - * @property id - * @type number - */ +/***/ 62382: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * A `String` denoting the type of object. - * - * @property type - * @type string - * @default "body" - * @readOnly - */ +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * An arbitrary `String` name to help the user identify and manage bodies. - * - * @property label - * @type string - * @default "Body" - */ +var Camera = __webpack_require__(47751); +var Class = __webpack_require__(56694); +var GetFastValue = __webpack_require__(72632); +var PluginCache = __webpack_require__(91963); +var RectangleContains = __webpack_require__(94287); +var ScaleEvents = __webpack_require__(40444); +var SceneEvents = __webpack_require__(7599); - /** - * An array of bodies that make up this body. - * The first body in the array must always be a self reference to the current body instance. - * All bodies in the `parts` array together form a single rigid compound body. - * Parts are allowed to overlap, have gaps or holes or even form concave bodies. - * Parts themselves should never be added to a `World`, only the parent body should be. - * Use `Body.setParts` when setting parts to ensure correct updates of all properties. - * - * @property parts - * @type body[] - */ +/** + * @classdesc + * The Camera Manager is a plugin that belongs to a Scene and is responsible for managing all of the Scene Cameras. + * + * By default you can access the Camera Manager from within a Scene using `this.cameras`, although this can be changed + * in your game config. + * + * Create new Cameras using the `add` method. Or extend the Camera class with your own addition code and then add + * the new Camera in using the `addExisting` method. + * + * Cameras provide a view into your game world, and can be positioned, rotated, zoomed and scrolled accordingly. + * + * A Camera consists of two elements: The viewport and the scroll values. + * + * The viewport is the physical position and size of the Camera within your game. Cameras, by default, are + * created the same size as your game, but their position and size can be set to anything. This means if you + * wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game, + * you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`). + * + * If you wish to change where the Camera is looking in your game, then you scroll it. You can do this + * via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the + * viewport, and changing the viewport has no impact on the scrolling. + * + * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, + * allowing you to filter Game Objects out on a per-Camera basis. The Camera Manager can manage up to 31 unique + * 'Game Object ignore capable' Cameras. Any Cameras beyond 31 that you create will all be given a Camera ID of + * zero, meaning that they cannot be used for Game Object exclusion. This means if you need your Camera to ignore + * Game Objects, make sure it's one of the first 31 created. + * + * A Camera also has built-in special effects including Fade, Flash, Camera Shake, Pan and Zoom. + * + * @class CameraManager + * @memberof Phaser.Cameras.Scene2D + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene that owns the Camera Manager plugin. + */ +var CameraManager = new Class({ - /** - * An object reserved for storing plugin-specific properties. - * - * @property plugin - * @type {} - */ + initialize: - /** - * A self reference if the body is _not_ a part of another body. - * Otherwise this is a reference to the body that this is a part of. - * See `body.parts`. - * - * @property parent - * @type body - */ + function CameraManager (scene) + { + /** + * The Scene that owns the Camera Manager plugin. + * + * @name Phaser.Cameras.Scene2D.CameraManager#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; - /** - * A `Number` specifying the angle of the body, in radians. - * - * @property angle - * @type number - * @default 0 - */ + /** + * A reference to the Scene.Systems handler for the Scene that owns the Camera Manager. + * + * @name Phaser.Cameras.Scene2D.CameraManager#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; - /** - * An array of `Vector` objects that specify the convex hull of the rigid body. - * These should be provided about the origin `(0, 0)`. E.g. - * - * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] - * - * When passed via `Body.create`, the vertices are translated relative to `body.position` (i.e. world-space, and constantly updated by `Body.update` during simulation). - * The `Vector` objects are also augmented with additional properties required for efficient collision detection. - * - * Other properties such as `inertia` and `bounds` are automatically calculated from the passed vertices (unless provided via `options`). - * Concave hulls are not currently supported. The module `Matter.Vertices` contains useful methods for working with vertices. - * - * @property vertices - * @type vector[] - */ + /** + * All Cameras created by, or added to, this Camera Manager, will have their `roundPixels` + * property set to match this value. By default it is set to match the value set in the + * game configuration, but can be changed at any point. Equally, individual cameras can + * also be changed as needed. + * + * @name Phaser.Cameras.Scene2D.CameraManager#roundPixels + * @type {boolean} + * @since 3.11.0 + */ + this.roundPixels = scene.sys.game.config.roundPixels; - /** - * A `Vector` that specifies the current world-space position of the body. - * - * @property position - * @type vector - * @default { x: 0, y: 0 } - */ + /** + * An Array of the Camera objects being managed by this Camera Manager. + * The Cameras are updated and rendered in the same order in which they appear in this array. + * Do not directly add or remove entries to this array. However, you can move the contents + * around the array should you wish to adjust the display order. + * + * @name Phaser.Cameras.Scene2D.CameraManager#cameras + * @type {Phaser.Cameras.Scene2D.Camera[]} + * @since 3.0.0 + */ + this.cameras = []; - /** - * A `Vector` that holds the current scale values as set by `Body.setScale`. - * - * @property scale - * @type vector - * @default { x: 1, y: 1 } - */ + /** + * A handy reference to the 'main' camera. By default this is the first Camera the + * Camera Manager creates. You can also set it directly, or use the `makeMain` argument + * in the `add` and `addExisting` methods. It allows you to access it from your game: + * + * ```javascript + * var cam = this.cameras.main; + * ``` + * + * Also see the properties `camera1`, `camera2` and so on. + * + * @name Phaser.Cameras.Scene2D.CameraManager#main + * @type {Phaser.Cameras.Scene2D.Camera} + * @since 3.0.0 + */ + this.main; - /** - * A `Vector` that specifies the force to apply in the current step. It is zeroed after every `Body.update`. See also `Body.applyForce`. - * - * @property force - * @type vector - * @default { x: 0, y: 0 } - */ + /** + * A default un-transformed Camera that doesn't exist on the camera list and doesn't + * count towards the total number of cameras being managed. It exists for other + * systems, as well as your own code, should they require a basic un-transformed + * camera instance from which to calculate a view matrix. + * + * @name Phaser.Cameras.Scene2D.CameraManager#default + * @type {Phaser.Cameras.Scene2D.Camera} + * @since 3.17.0 + */ + this.default; - /** - * A `Number` that specifies the torque (turning force) to apply in the current step. It is zeroed after every `Body.update`. - * - * @property torque - * @type number - * @default 0 - */ + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); + }, /** - * A `Number` that _measures_ the current speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.velocity`). + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. * - * @readOnly - * @property speed - * @type number - * @default 0 + * @method Phaser.Cameras.Scene2D.CameraManager#boot + * @private + * @listens Phaser.Scenes.Events#DESTROY + * @since 3.5.1 */ + boot: function () + { + var sys = this.systems; - /** - * A `Number` that _measures_ the current angular speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.angularVelocity`). - * - * @readOnly - * @property angularSpeed - * @type number - * @default 0 - */ + if (sys.settings.cameras) + { + // We have cameras to create + this.fromJSON(sys.settings.cameras); + } + else + { + // Make one + this.add(); + } - /** - * A `Vector` that _measures_ the current velocity of the body after the last `Body.update`. It is read-only. - * If you need to modify a body's velocity directly, you should either apply a force or simply change the body's `position` (as the engine uses position-Verlet integration). - * - * @readOnly - * @property velocity - * @type vector - * @default { x: 0, y: 0 } - */ + this.main = this.cameras[0]; - /** - * A `Number` that _measures_ the current angular velocity of the body after the last `Body.update`. It is read-only. - * If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's `angle` (as the engine uses position-Verlet integration). - * - * @readOnly - * @property angularVelocity - * @type number - * @default 0 - */ + // Create a default camera + this.default = new Camera(0, 0, sys.scale.width, sys.scale.height).setScene(this.scene); - /** - * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. - * If you need to set a body as static after its creation, you should use `Body.setStatic` as this requires more than just setting this flag. - * - * @property isStatic - * @type boolean - * @default false - */ + sys.game.scale.on(ScaleEvents.RESIZE, this.onResize, this); - /** - * A flag that indicates whether a body is a sensor. Sensor triggers collision events, but doesn't react with colliding body physically. - * - * @property isSensor - * @type boolean - * @default false - */ + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); + }, /** - * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. - * If you need to set a body as sleeping, you should use `Sleeping.set` as this requires more than just setting this flag. + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. * - * @property isSleeping - * @type boolean - * @default false + * @method Phaser.Cameras.Scene2D.CameraManager#start + * @private + * @listens Phaser.Scenes.Events#UPDATE + * @listens Phaser.Scenes.Events#SHUTDOWN + * @since 3.5.0 */ + start: function () + { + if (!this.main) + { + var sys = this.systems; - /** - * A `Number` that _measures_ the amount of movement a body currently has (a combination of `speed` and `angularSpeed`). It is read-only and always positive. - * It is used and updated by the `Matter.Sleeping` module during simulation to decide if a body has come to rest. - * - * @readOnly - * @property motion - * @type number - * @default 0 - */ + if (sys.settings.cameras) + { + // We have cameras to create + this.fromJSON(sys.settings.cameras); + } + else + { + // Make one + this.add(); + } - /** - * A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the `Matter.Sleeping` module (if sleeping is enabled by the engine). - * - * @property sleepThreshold - * @type number - * @default 60 - */ + this.main = this.cameras[0]; + } - /** - * A `Number` that defines the density of the body, that is its mass per unit area. - * If you pass the density via `Body.create` the `mass` property is automatically calculated for you based on the size (area) of the object. - * This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood). - * - * @property density - * @type number - * @default 0.001 - */ + var eventEmitter = this.systems.events; - /** - * A `Number` that defines the mass of the body, although it may be more appropriate to specify the `density` property instead. - * If you modify this value, you must also modify the `body.inverseMass` property (`1 / mass`). - * - * @property mass - * @type number - */ + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); + }, /** - * A `Number` that defines the inverse mass of the body (`1 / mass`). - * If you modify this value, you must also modify the `body.mass` property. + * Adds a new Camera into the Camera Manager. The Camera Manager can support up to 31 different Cameras. * - * @property inverseMass - * @type number - */ - - /** - * A `Number` that defines the moment of inertia (i.e. second moment of area) of the body. - * It is automatically calculated from the given convex hull (`vertices` array) and density in `Body.create`. - * If you modify this value, you must also modify the `body.inverseInertia` property (`1 / inertia`). + * Each Camera has its own viewport, which controls the size of the Camera and its position within the canvas. * - * @property inertia - * @type number - */ - - /** - * A `Number` that defines the inverse moment of inertia of the body (`1 / inertia`). - * If you modify this value, you must also modify the `body.inertia` property. + * Use the `Camera.scrollX` and `Camera.scrollY` properties to change where the Camera is looking, or the + * Camera methods such as `centerOn`. Cameras also have built in special effects, such as fade, flash, shake, + * pan and zoom. * - * @property inverseInertia - * @type number - */ - - /** - * A `Number` that defines the restitution (elasticity) of the body. The value is always positive and is in the range `(0, 1)`. - * A value of `0` means collisions may be perfectly inelastic and no bouncing may occur. - * A value of `0.8` means the body may bounce back with approximately 80% of its kinetic energy. - * Note that collision response is based on _pairs_ of bodies, and that `restitution` values are _combined_ with the following formula: + * By default Cameras are transparent and will render anything that they can see based on their `scrollX` + * and `scrollY` values. Game Objects can be set to be ignored by a Camera by using the `Camera.ignore` method. * - * Math.max(bodyA.restitution, bodyB.restitution) + * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change + * it after creation if required. * - * @property restitution - * @type number - * @default 0 - */ - - /** - * A `Number` that defines the friction of the body. The value is always positive and is in the range `(0, 1)`. - * A value of `0` means that the body may slide indefinitely. - * A value of `1` means the body may come to a stop almost instantly after a force is applied. + * See the Camera class documentation for more details. * - * The effects of the value may be non-linear. - * High values may be unstable depending on the body. - * The engine uses a Coulomb friction model including static and kinetic friction. - * Note that collision response is based on _pairs_ of bodies, and that `friction` values are _combined_ with the following formula: + * @method Phaser.Cameras.Scene2D.CameraManager#add + * @since 3.0.0 * - * Math.min(bodyA.friction, bodyB.friction) + * @param {number} [x=0] - The horizontal position of the Camera viewport. + * @param {number} [y=0] - The vertical position of the Camera viewport. + * @param {number} [width] - The width of the Camera viewport. If not given it'll be the game config size. + * @param {number} [height] - The height of the Camera viewport. If not given it'll be the game config size. + * @param {boolean} [makeMain=false] - Set this Camera as being the 'main' camera. This just makes the property `main` a reference to it. + * @param {string} [name=''] - The name of the Camera. * - * @property friction - * @type number - * @default 0.1 + * @return {Phaser.Cameras.Scene2D.Camera} The newly created Camera. */ + add: function (x, y, width, height, makeMain, name) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } + if (makeMain === undefined) { makeMain = false; } + if (name === undefined) { name = ''; } - /** - * A `Number` that defines the static friction of the body (in the Coulomb friction model). - * A value of `0` means the body will never 'stick' when it is nearly stationary and only dynamic `friction` is used. - * The higher the value (e.g. `10`), the more force it will take to initially get the body moving when nearly stationary. - * This value is multiplied with the `friction` property to make it easier to change `friction` and maintain an appropriate amount of static friction. - * - * @property frictionStatic - * @type number - * @default 0.5 - */ + var camera = new Camera(x, y, width, height); - /** - * A `Number` that defines the air friction of the body (air resistance). - * A value of `0` means the body will never slow as it moves through space. - * The higher the value, the faster a body slows when moving through space. - * The effects of the value are non-linear. - * - * @property frictionAir - * @type number - * @default 0.01 - */ + camera.setName(name); + camera.setScene(this.scene); + camera.setRoundPixels(this.roundPixels); + + camera.id = this.getNextID(); + + this.cameras.push(camera); + + if (makeMain) + { + this.main = camera; + } + + return camera; + }, /** - * An `Object` that specifies the collision filtering properties of this body. + * Adds an existing Camera into the Camera Manager. * - * Collisions between two bodies will obey the following rules: - * - If the two bodies have the same non-zero value of `collisionFilter.group`, - * they will always collide if the value is positive, and they will never collide - * if the value is negative. - * - If the two bodies have different values of `collisionFilter.group` or if one - * (or both) of the bodies has a value of 0, then the category/mask rules apply as follows: + * The Camera should either be a `Phaser.Cameras.Scene2D.Camera` instance, or a class that extends from it. * - * Each body belongs to a collision category, given by `collisionFilter.category`. This - * value is used as a bit field and the category should have only one bit set, meaning that - * the value of this property is a power of two in the range [1, 2^31]. Thus, there are 32 - * different collision categories available. + * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change + * it after addition if required. * - * Each body also defines a collision bitmask, given by `collisionFilter.mask` which specifies - * the categories it collides with (the value is the bitwise AND value of all these categories). + * The Camera will be assigned an ID, which is used for Game Object exclusion and then added to the + * manager. As long as it doesn't already exist in the manager it will be added then returned. * - * Using the category/mask rules, two bodies `A` and `B` collide if each includes the other's - * category in its mask, i.e. `(categoryA & maskB) !== 0` and `(categoryB & maskA) !== 0` - * are both true. + * If this method returns `null` then the Camera already exists in this Camera Manager. * - * @property collisionFilter - * @type object - */ - - /** - * An Integer `Number`, that specifies the collision group this body belongs to. - * See `body.collisionFilter` for more information. + * @method Phaser.Cameras.Scene2D.CameraManager#addExisting + * @since 3.0.0 * - * @property collisionFilter.group - * @type object - * @default 0 - */ - - /** - * A bit field that specifies the collision category this body belongs to. - * The category value should have only one bit set, for example `0x0001`. - * This means there are up to 32 unique collision categories available. - * See `body.collisionFilter` for more information. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to be added to the Camera Manager. + * @param {boolean} [makeMain=false] - Set this Camera as being the 'main' camera. This just makes the property `main` a reference to it. * - * @property collisionFilter.category - * @type object - * @default 1 + * @return {?Phaser.Cameras.Scene2D.Camera} The Camera that was added to the Camera Manager, or `null` if it couldn't be added. */ + addExisting: function (camera, makeMain) + { + if (makeMain === undefined) { makeMain = false; } - /** - * A bit mask that specifies the collision categories this body may collide with. - * See `body.collisionFilter` for more information. - * - * @property collisionFilter.mask - * @type object - * @default -1 - */ + var index = this.cameras.indexOf(camera); - /** - * A `Number` that specifies a tolerance on how far a body is allowed to 'sink' or rotate into other bodies. - * Avoid changing this value unless you understand the purpose of `slop` in physics engines. - * The default should generally suffice, although very large bodies may require larger values for stable stacking. - * - * @property slop - * @type number - * @default 0.05 - */ + if (index === -1) + { + camera.id = this.getNextID(); - /** - * A `Number` that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. - * - * @property timeScale - * @type number - * @default 1 - */ + camera.setRoundPixels(this.roundPixels); - /** - * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. - * - * @property render - * @type object - */ + this.cameras.push(camera); - /** - * A flag that indicates if the body should be rendered. - * - * @property render.visible - * @type boolean - * @default true - */ + if (makeMain) + { + this.main = camera; + } - /** - * Sets the opacity to use when rendering. - * - * @property render.opacity - * @type number - * @default 1 - */ + return camera; + } + + return null; + }, /** - * An `Object` that defines the sprite properties to use when rendering, if any. + * Gets the next available Camera ID number. * - * @property render.sprite - * @type object + * The Camera Manager supports up to 31 unique cameras, after which the ID returned will always be zero. + * You can create additional cameras beyond 31, but they cannot be used for Game Object exclusion. + * + * @method Phaser.Cameras.Scene2D.CameraManager#getNextID + * @private + * @since 3.11.0 + * + * @return {number} The next available Camera ID, or 0 if they're all already in use. */ + getNextID: function () + { + var cameras = this.cameras; - /** - * A `Number` that defines the offset in the x-axis for the sprite (normalised by texture width). - * - * @property render.sprite.xOffset - * @type number - * @default 0 - */ + var testID = 1; - /** - * A `Number` that defines the offset in the y-axis for the sprite (normalised by texture height). - * - * @property render.sprite.yOffset - * @type number - * @default 0 - */ + // Find the first free camera ID we can use - /** - * A hex color value that defines the fill color to use when rendering the body. - * - * @property render.fillColor - * @type number - */ + for (var t = 0; t < 32; t++) + { + var found = false; - /** - * A value that defines the fill opacity to use when rendering the body. - * - * @property render.fillOpacity - * @type number - */ + for (var i = 0; i < cameras.length; i++) + { + var camera = cameras[i]; - /** - * A hex color value that defines the line color to use when rendering the body. - * - * @property render.lineColor - * @type number - */ + if (camera && camera.id === testID) + { + found = true; + continue; + } + } - /** - * A value that defines the line opacity to use when rendering the body. - * - * @property render.lineOpacity - * @type number - */ + if (found) + { + testID = testID << 1; + } + else + { + return testID; + } + } - /** - * A `Number` that defines the line width to use when rendering the body outline. - * - * @property render.lineThickness - * @type number - */ + return 0; + }, /** - * An array of unique axis vectors (edge normals) used for collision detection. - * These are automatically calculated from the given convex hull (`vertices` array) in `Body.create`. - * They are constantly updated by `Body.update` during the simulation. + * Gets the total number of Cameras in this Camera Manager. * - * @property axes - * @type vector[] - */ - - /** - * A `Number` that _measures_ the area of the body's convex hull, calculated at creation by `Body.create`. + * If the optional `isVisible` argument is set it will only count Cameras that are currently visible. * - * @property area - * @type string - * @default - */ - - /** - * A `Bounds` object that defines the AABB region for the body. - * It is automatically calculated from the given convex hull (`vertices` array) in `Body.create` and constantly updated by `Body.update` during simulation. + * @method Phaser.Cameras.Scene2D.CameraManager#getTotal + * @since 3.11.0 * - * @property bounds - * @type bounds - */ - - /** - * A reference to the Phaser Game Object this body belongs to, if any. + * @param {boolean} [isVisible=false] - Set the `true` to only include visible Cameras in the total. * - * @property gameObject - * @type Phaser.GameObjects.GameObject + * @return {number} The total number of Cameras in this Camera Manager. */ + getTotal: function (isVisible) + { + if (isVisible === undefined) { isVisible = false; } - /** - * The center of mass of the Body. - * - * @property centerOfMass - * @type vector - * @default { x: 0, y: 0 } - */ + var total = 0; - /** - * The center of the body in pixel values. - * Used by Phaser for texture aligment. - * - * @property centerOffset - * @type vector - * @default { x: 0, y: 0 } - */ + var cameras = this.cameras; - /** - * Will this Body ignore World gravity during the Engine update? - * - * @property ignoreGravity - * @type boolean - * @default false - */ + for (var i = 0; i < cameras.length; i++) + { + var camera = cameras[i]; - /** - * Scale the influence of World gravity when applied to this body. - * - * @property gravityScale - * @type vector - * @default { x: 1, y: 1 } - */ + if (!isVisible || (isVisible && camera.visible)) + { + total++; + } + } - /** - * Will this Body ignore Phaser Pointer input events? - * - * @property ignorePointer - * @type boolean - * @default false - */ + return total; + }, /** - * A callback that is invoked when this Body starts colliding with any other Body. - * - * You can register callbacks by providing a function of type `( pair: Matter.Pair) => void`. + * Populates this Camera Manager based on the given configuration object, or an array of config objects. * - * @property onCollideCallback - * @type function - * @default null - */ - - /** - * A callback that is invoked when this Body stops colliding with any other Body. - * - * You can register callbacks by providing a function of type `( pair: Matter.Pair) => void`. + * See the `Phaser.Types.Cameras.Scene2D.CameraConfig` documentation for details of the object structure. * - * @property onCollideEndCallback - * @type function - * @default null - */ - - /** - * A callback that is invoked for the duration that this Body is colliding with any other Body. - * - * You can register callbacks by providing a function of type `( pair: Matter.Pair) => void`. + * @method Phaser.Cameras.Scene2D.CameraManager#fromJSON + * @since 3.0.0 * - * @property onCollideActiveCallback - * @type function - * @default null - */ - - /** - * A collision callback dictionary used by the `Body.setOnCollideWith` function. + * @param {(Phaser.Types.Cameras.Scene2D.CameraConfig|Phaser.Types.Cameras.Scene2D.CameraConfig[])} config - A Camera configuration object, or an array of them, to be added to this Camera Manager. * - * @property onCollideWith - * @type object - * @default null + * @return {this} This Camera Manager instance. */ + fromJSON: function (config) + { + if (!Array.isArray(config)) + { + config = [ config ]; + } -})(); + var gameWidth = this.scene.sys.scale.width; + var gameHeight = this.scene.sys.scale.height; + for (var i = 0; i < config.length; i++) + { + var cameraConfig = config[i]; -/***/ }), -/* 42 */ -/***/ (function(module, exports) { + var x = GetFastValue(cameraConfig, 'x', 0); + var y = GetFastValue(cameraConfig, 'y', 0); + var width = GetFastValue(cameraConfig, 'width', gameWidth); + var height = GetFastValue(cameraConfig, 'height', gameHeight); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var camera = this.add(x, y, width, height); -/** - * Returns the bottom coordinate from the bounds of the Game Object. - * - * @function Phaser.Display.Bounds.GetBottom - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * - * @return {number} The bottom coordinate of the bounds of the Game Object. - */ -var GetBottom = function (gameObject) -{ - return (gameObject.y + gameObject.height) - (gameObject.height * gameObject.originY); -}; + // Direct properties + camera.name = GetFastValue(cameraConfig, 'name', ''); + camera.zoom = GetFastValue(cameraConfig, 'zoom', 1); + camera.rotation = GetFastValue(cameraConfig, 'rotation', 0); + camera.scrollX = GetFastValue(cameraConfig, 'scrollX', 0); + camera.scrollY = GetFastValue(cameraConfig, 'scrollY', 0); + camera.roundPixels = GetFastValue(cameraConfig, 'roundPixels', false); + camera.visible = GetFastValue(cameraConfig, 'visible', true); -module.exports = GetBottom; + // Background Color + var backgroundColor = GetFastValue(cameraConfig, 'backgroundColor', false); -/***/ }), -/* 43 */ -/***/ (function(module, exports) { + if (backgroundColor) + { + camera.setBackgroundColor(backgroundColor); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Bounds -/** - * Returns the left coordinate from the bounds of the Game Object. - * - * @function Phaser.Display.Bounds.GetLeft - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * - * @return {number} The left coordinate of the bounds of the Game Object. - */ -var GetLeft = function (gameObject) -{ - return gameObject.x - (gameObject.width * gameObject.originX); -}; + var boundsConfig = GetFastValue(cameraConfig, 'bounds', null); -module.exports = GetLeft; + if (boundsConfig) + { + var bx = GetFastValue(boundsConfig, 'x', 0); + var by = GetFastValue(boundsConfig, 'y', 0); + var bwidth = GetFastValue(boundsConfig, 'width', gameWidth); + var bheight = GetFastValue(boundsConfig, 'height', gameHeight); + camera.setBounds(bx, by, bwidth, bheight); + } + } -/***/ }), -/* 44 */ -/***/ (function(module, exports) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Gets a Camera based on its name. + * + * Camera names are optional and don't have to be set, so this method is only of any use if you + * have given your Cameras unique names. + * + * @method Phaser.Cameras.Scene2D.CameraManager#getCamera + * @since 3.0.0 + * + * @param {string} name - The name of the Camera. + * + * @return {?Phaser.Cameras.Scene2D.Camera} The first Camera with a name matching the given string, otherwise `null`. + */ + getCamera: function (name) + { + var cameras = this.cameras; -/** - * Returns the right coordinate from the bounds of the Game Object. - * - * @function Phaser.Display.Bounds.GetRight - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * - * @return {number} The right coordinate of the bounds of the Game Object. - */ -var GetRight = function (gameObject) -{ - return (gameObject.x + gameObject.width) - (gameObject.width * gameObject.originX); -}; - -module.exports = GetRight; - - -/***/ }), -/* 45 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Returns the top coordinate from the bounds of the Game Object. - * - * @function Phaser.Display.Bounds.GetTop - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * - * @return {number} The top coordinate of the bounds of the Game Object. - */ -var GetTop = function (gameObject) -{ - return gameObject.y - (gameObject.height * gameObject.originY); -}; - -module.exports = GetTop; - - -/***/ }), -/* 46 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Takes an array of Game Objects, or any objects that have a public property as defined in `key`, - * and then adds the given value to it. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `PropertyValueInc(group.getChildren(), key, value, step)` - * - * @function Phaser.Actions.PropertyValueInc - * @since 3.3.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {string} key - The property to be updated. - * @param {number} value - The amount to be added to the property. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var PropertyValueInc = function (items, key, value, step, index, direction) -{ - if (step === undefined) { step = 0; } - if (index === undefined) { index = 0; } - if (direction === undefined) { direction = 1; } - - var i; - var t = 0; - var end = items.length; - - if (direction === 1) - { - // Start to End - for (i = index; i < end; i++) - { - items[i][key] += value + (t * step); - t++; - } - } - else - { - // End to Start - for (i = index; i >= 0; i--) + for (var i = 0; i < cameras.length; i++) { - items[i][key] += value + (t * step); - t++; + if (cameras[i].name === name) + { + return cameras[i]; + } } - } - - return items; -}; - -module.exports = PropertyValueInc; - - -/***/ }), -/* 47 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var GetPoint = __webpack_require__(307); -var GetPoints = __webpack_require__(172); -var GEOM_CONST = __webpack_require__(56); -var Random = __webpack_require__(173); -var Vector2 = __webpack_require__(3); - -/** - * @classdesc - * Defines a Line segment, a part of a line between two endpoints. - * - * @class Line - * @memberof Phaser.Geom - * @constructor - * @since 3.0.0 - * - * @param {number} [x1=0] - The x coordinate of the lines starting point. - * @param {number} [y1=0] - The y coordinate of the lines starting point. - * @param {number} [x2=0] - The x coordinate of the lines ending point. - * @param {number} [y2=0] - The y coordinate of the lines ending point. - */ -var Line = new Class({ - - initialize: - - function Line (x1, y1, x2, y2) - { - if (x1 === undefined) { x1 = 0; } - if (y1 === undefined) { y1 = 0; } - if (x2 === undefined) { x2 = 0; } - if (y2 === undefined) { y2 = 0; } - /** - * The geometry constant type of this object: `GEOM_CONST.LINE`. - * Used for fast type comparisons. - * - * @name Phaser.Geom.Line#type - * @type {number} - * @readonly - * @since 3.19.0 - */ - this.type = GEOM_CONST.LINE; - - /** - * The x coordinate of the lines starting point. - * - * @name Phaser.Geom.Line#x1 - * @type {number} - * @since 3.0.0 - */ - this.x1 = x1; - - /** - * The y coordinate of the lines starting point. - * - * @name Phaser.Geom.Line#y1 - * @type {number} - * @since 3.0.0 - */ - this.y1 = y1; - - /** - * The x coordinate of the lines ending point. - * - * @name Phaser.Geom.Line#x2 - * @type {number} - * @since 3.0.0 - */ - this.x2 = x2; - - /** - * The y coordinate of the lines ending point. - * - * @name Phaser.Geom.Line#y2 - * @type {number} - * @since 3.0.0 - */ - this.y2 = y2; + return null; }, /** - * Get a point on a line that's a given percentage along its length. + * Returns an array of all cameras below the given Pointer. * - * @method Phaser.Geom.Line#getPoint - * @since 3.0.0 + * The first camera in the array is the top-most camera in the camera list. * - * @generic {Phaser.Geom.Point} O - [output,$return] + * @method Phaser.Cameras.Scene2D.CameraManager#getCamerasBelowPointer + * @since 3.10.0 * - * @param {number} position - A value between 0 and 1, where 0 is the start, 0.5 is the middle and 1 is the end of the line. - * @param {(Phaser.Geom.Point|object)} [output] - An optional point, or point-like object, to store the coordinates of the point on the line. + * @param {Phaser.Input.Pointer} pointer - The Pointer to check against. * - * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point on the line. + * @return {Phaser.Cameras.Scene2D.Camera[]} An array of cameras below the Pointer. */ - getPoint: function (position, output) + getCamerasBelowPointer: function (pointer) { - return GetPoint(this, position, output); + var cameras = this.cameras; + + var x = pointer.x; + var y = pointer.y; + + var output = []; + + for (var i = 0; i < cameras.length; i++) + { + var camera = cameras[i]; + + if (camera.visible && camera.inputEnabled && RectangleContains(camera, x, y)) + { + // So the top-most camera is at the top of the search array + output.unshift(camera); + } + } + + return output; }, /** - * Get a number of points along a line's length. + * Removes the given Camera, or an array of Cameras, from this Camera Manager. * - * Provide a `quantity` to get an exact number of points along the line. + * If found in the Camera Manager it will be immediately removed from the local cameras array. + * If also currently the 'main' camera, 'main' will be reset to be camera 0. * - * Provide a `stepRate` to ensure a specific distance between each point on the line. Set `quantity` to `0` when - * providing a `stepRate`. + * The removed Cameras are automatically destroyed if the `runDestroy` argument is `true`, which is the default. + * If you wish to re-use the cameras then set this to `false`, but know that they will retain their references + * and internal data until destroyed or re-added to a Camera Manager. * - * @method Phaser.Geom.Line#getPoints + * @method Phaser.Cameras.Scene2D.CameraManager#remove * @since 3.0.0 * - * @generic {Phaser.Geom.Point[]} O - [output,$return] - * - * @param {number} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead. - * @param {number} [stepRate] - The distance between each point on the line. When set, `quantity` is implied and should be set to `0`. - * @param {(array|Phaser.Geom.Point[])} [output] - An optional array of Points, or point-like objects, to store the coordinates of the points on the line. + * @param {(Phaser.Cameras.Scene2D.Camera|Phaser.Cameras.Scene2D.Camera[])} camera - The Camera, or an array of Cameras, to be removed from this Camera Manager. + * @param {boolean} [runDestroy=true] - Automatically call `Camera.destroy` on each Camera removed from this Camera Manager. * - * @return {(array|Phaser.Geom.Point[])} An array of Points, or point-like objects, containing the coordinates of the points on the line. + * @return {number} The total number of Cameras removed. */ - getPoints: function (quantity, stepRate, output) + remove: function (camera, runDestroy) { - return GetPoints(this, quantity, stepRate, output); + if (runDestroy === undefined) { runDestroy = true; } + + if (!Array.isArray(camera)) + { + camera = [ camera ]; + } + + var total = 0; + var cameras = this.cameras; + + for (var i = 0; i < camera.length; i++) + { + var index = cameras.indexOf(camera[i]); + + if (index !== -1) + { + if (runDestroy) + { + cameras[index].destroy(); + } + else + { + cameras[index].renderList = []; + } + + cameras.splice(index, 1); + + total++; + } + } + + if (!this.main && cameras[0]) + { + this.main = cameras[0]; + } + + return total; }, /** - * Get a random Point on the Line. - * - * @method Phaser.Geom.Line#getRandomPoint - * @since 3.0.0 + * The internal render method. This is called automatically by the Scene and should not be invoked directly. * - * @generic {Phaser.Geom.Point} O - [point,$return] + * It will iterate through all local cameras and render them in turn, as long as they're visible and have + * an alpha level > 0. * - * @param {(Phaser.Geom.Point|object)} [point] - An instance of a Point to be modified. + * @method Phaser.Cameras.Scene2D.CameraManager#render + * @protected + * @since 3.0.0 * - * @return {Phaser.Geom.Point} A random Point on the Line. + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Renderer that will render the children to this camera. + * @param {Phaser.GameObjects.DisplayList} displayList - The Display List for the Scene. */ - getRandomPoint: function (point) + render: function (renderer, displayList) { - return Random(this, point); + var scene = this.scene; + var cameras = this.cameras; + + for (var i = 0; i < cameras.length; i++) + { + var camera = cameras[i]; + + if (camera.visible && camera.alpha > 0) + { + camera.preRender(); + + var visibleChildren = this.getVisibleChildren(displayList.getChildren(), camera); + + renderer.render(scene, visibleChildren, camera); + } + } }, /** - * Set new coordinates for the line endpoints. + * Takes an array of Game Objects and a Camera and returns a new array + * containing only those Game Objects that pass the `willRender` test + * against the given Camera. * - * @method Phaser.Geom.Line#setTo - * @since 3.0.0 + * @method Phaser.Cameras.Scene2D.CameraManager#getVisibleChildren + * @since 3.50.0 * - * @param {number} [x1=0] - The x coordinate of the lines starting point. - * @param {number} [y1=0] - The y coordinate of the lines starting point. - * @param {number} [x2=0] - The x coordinate of the lines ending point. - * @param {number} [y2=0] - The y coordinate of the lines ending point. + * @param {Phaser.GameObjects.GameObject[]} children - An array of Game Objects to be checked against the camera. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to filter the Game Objects against. * - * @return {this} This Line object. + * @return {Phaser.GameObjects.GameObject[]} A filtered list of only Game Objects within the Scene that will render against the given Camera. */ - setTo: function (x1, y1, x2, y2) + getVisibleChildren: function (children, camera) { - if (x1 === undefined) { x1 = 0; } - if (y1 === undefined) { y1 = 0; } - if (x2 === undefined) { x2 = 0; } - if (y2 === undefined) { y2 = 0; } - - this.x1 = x1; - this.y1 = y1; - - this.x2 = x2; - this.y2 = y2; - - return this; + return children.filter(function (child) + { + return child.willRender(camera); + }); }, /** - * Returns a Vector2 object that corresponds to the start of this Line. - * - * @method Phaser.Geom.Line#getPointA - * @since 3.0.0 + * Resets this Camera Manager. * - * @generic {Phaser.Math.Vector2} O - [vec2,$return] + * This will iterate through all current Cameras, destroying them all, then it will reset the + * cameras array, reset the ID counter and create 1 new single camera using the default values. * - * @param {Phaser.Math.Vector2} [vec2] - A Vector2 object to set the results in. If `undefined` a new Vector2 will be created. + * @method Phaser.Cameras.Scene2D.CameraManager#resetAll + * @since 3.0.0 * - * @return {Phaser.Math.Vector2} A Vector2 object that corresponds to the start of this Line. + * @return {Phaser.Cameras.Scene2D.Camera} The freshly created main Camera. */ - getPointA: function (vec2) + resetAll: function () { - if (vec2 === undefined) { vec2 = new Vector2(); } + for (var i = 0; i < this.cameras.length; i++) + { + this.cameras[i].destroy(); + } - vec2.set(this.x1, this.y1); + this.cameras = []; - return vec2; + this.main = this.add(); + + return this.main; }, /** - * Returns a Vector2 object that corresponds to the end of this Line. + * The main update loop. Called automatically when the Scene steps. * - * @method Phaser.Geom.Line#getPointB + * @method Phaser.Cameras.Scene2D.CameraManager#update + * @protected * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [vec2,$return] - * - * @param {Phaser.Math.Vector2} [vec2] - A Vector2 object to set the results in. If `undefined` a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2} A Vector2 object that corresponds to the end of this Line. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - getPointB: function (vec2) + update: function (time, delta) { - if (vec2 === undefined) { vec2 = new Vector2(); } - - vec2.set(this.x2, this.y2); - - return vec2; + for (var i = 0; i < this.cameras.length; i++) + { + this.cameras[i].update(time, delta); + } }, /** - * The left position of the Line. + * The event handler that manages the `resize` event dispatched by the Scale Manager. * - * @name Phaser.Geom.Line#left - * @type {number} - * @since 3.0.0 + * @method Phaser.Cameras.Scene2D.CameraManager#onResize + * @since 3.18.0 + * + * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions. The canvas width / height values match this. */ - left: { - - get: function () + onResize: function (gameSize, baseSize, displaySize, previousWidth, previousHeight) + { + for (var i = 0; i < this.cameras.length; i++) { - return Math.min(this.x1, this.x2); - }, + var cam = this.cameras[i]; - set: function (value) - { - if (this.x1 <= this.x2) - { - this.x1 = value; - } - else + // if camera is at 0x0 and was the size of the previous game size, then we can safely assume it + // should be updated to match the new game size too + + if (cam._x === 0 && cam._y === 0 && cam._width === previousWidth && cam._height === previousHeight) { - this.x2 = value; + cam.setSize(baseSize.width, baseSize.height); } } - }, /** - * The right position of the Line. + * Resizes all cameras to the given dimensions. * - * @name Phaser.Geom.Line#right - * @type {number} - * @since 3.0.0 + * @method Phaser.Cameras.Scene2D.CameraManager#resize + * @since 3.2.0 + * + * @param {number} width - The new width of the camera. + * @param {number} height - The new height of the camera. */ - right: { - - get: function () - { - return Math.max(this.x1, this.x2); - }, - - set: function (value) + resize: function (width, height) + { + for (var i = 0; i < this.cameras.length; i++) { - if (this.x1 > this.x2) - { - this.x1 = value; - } - else - { - this.x2 = value; - } + this.cameras[i].setSize(width, height); } - }, /** - * The top position of the Line. + * The Scene that owns this plugin is shutting down. + * We need to kill and reset all internal properties as well as stop listening to Scene events. * - * @name Phaser.Geom.Line#top - * @type {number} + * @method Phaser.Cameras.Scene2D.CameraManager#shutdown + * @private * @since 3.0.0 */ - top: { - - get: function () - { - return Math.min(this.y1, this.y2); - }, + shutdown: function () + { + this.main = undefined; - set: function (value) + for (var i = 0; i < this.cameras.length; i++) { - if (this.y1 <= this.y2) - { - this.y1 = value; - } - else - { - this.y2 = value; - } + this.cameras[i].destroy(); } + this.cameras = []; + + var eventEmitter = this.systems.events; + + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * The bottom position of the Line. + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. * - * @name Phaser.Geom.Line#bottom - * @type {number} + * @method Phaser.Cameras.Scene2D.CameraManager#destroy + * @private * @since 3.0.0 */ - bottom: { + destroy: function () + { + this.shutdown(); - get: function () - { - return Math.max(this.y1, this.y2); - }, + this.default.destroy(); - set: function (value) - { - if (this.y1 > this.y2) - { - this.y1 = value; - } - else - { - this.y2 = value; - } - } + this.systems.events.off(SceneEvents.START, this.start, this); + this.systems.events.off(SceneEvents.DESTROY, this.destroy, this); + this.systems.game.scale.off(ScaleEvents.RESIZE, this.onResize, this); + this.scene = null; + this.systems = null; } }); -module.exports = Line; - - -/***/ }), -/* 48 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Sets the fillStyle on the target context based on the given Shape. - * - * @method Phaser.GameObjects.Shape#FillStyleCanvas - * @since 3.13.0 - * @private - * - * @param {CanvasRenderingContext2D} ctx - The context to set the fill style on. - * @param {Phaser.GameObjects.Shape} src - The Game Object to set the fill style from. - * @param {number} [altColor] - An alternative color to render with. - * @param {number} [altAlpha] - An alternative alpha to render with. - */ -var FillStyleCanvas = function (ctx, src, altColor, altAlpha) -{ - var fillColor = (altColor) ? altColor : src.fillColor; - var fillAlpha = (altAlpha) ? altAlpha : src.fillAlpha; - - var red = ((fillColor & 0xFF0000) >>> 16); - var green = ((fillColor & 0xFF00) >>> 8); - var blue = (fillColor & 0xFF); - - ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')'; -}; +PluginCache.register('CameraManager', CameraManager, 'cameras'); -module.exports = FillStyleCanvas; +module.exports = CameraManager; /***/ }), -/* 49 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 92522: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(89787); /** * @classdesc - * A MultiFile is a special kind of parent that contains two, or more, Files as children and looks after - * the loading and processing of them all. It is commonly extended and used as a base class for file types such as AtlasJSON or BitmapFont. + * A Camera Fade effect. * - * You shouldn't create an instance of a MultiFile directly, but should extend it with your own class, setting a custom type and processing methods. + * This effect will fade the camera viewport to the given color, over the duration specified. * - * @class MultiFile - * @memberof Phaser.Loader + * Only the camera viewport is faded. None of the objects it is displaying are impacted, i.e. their colors do + * not change. + * + * The effect will dispatch several events on the Camera itself and you can also specify an `onUpdate` callback, + * which is invoked each frame for the duration of the effect, if required. + * + * @class Fade + * @memberof Phaser.Cameras.Scene2D.Effects * @constructor - * @since 3.7.0 + * @since 3.5.0 * - * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that is going to load this File. - * @param {string} type - The file type string for sorting within the Loader. - * @param {string} key - The key of the file within the loader. - * @param {Phaser.Loader.File[]} files - An array of Files that make-up this MultiFile. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera this effect is acting upon. */ -var MultiFile = new Class({ +var Fade = new Class({ initialize: - function MultiFile (loader, type, key, files) + function Fade (camera) { - var finalFiles = []; - - // Clean out any potential 'null' or 'undefined' file entries - files.forEach(function (file) - { - if (file) - { - finalFiles.push(file); - } - }); + /** + * The Camera this effect belongs to. + * + * @name Phaser.Cameras.Scene2D.Effects.Fade#camera + * @type {Phaser.Cameras.Scene2D.Camera} + * @readonly + * @since 3.5.0 + */ + this.camera = camera; /** - * A reference to the Loader that is going to load this file. + * Is this effect actively running? * - * @name Phaser.Loader.MultiFile#loader - * @type {Phaser.Loader.LoaderPlugin} - * @since 3.7.0 + * @name Phaser.Cameras.Scene2D.Effects.Fade#isRunning + * @type {boolean} + * @readonly + * @default false + * @since 3.5.0 */ - this.loader = loader; + this.isRunning = false; /** - * The file type string for sorting within the Loader. + * Has this effect finished running? * - * @name Phaser.Loader.MultiFile#type - * @type {string} - * @since 3.7.0 + * This is different from `isRunning` because it remains set to `true` when the effect is over, + * until the effect is either reset or started again. + * + * @name Phaser.Cameras.Scene2D.Effects.Fade#isComplete + * @type {boolean} + * @readonly + * @default false + * @since 3.5.0 */ - this.type = type; + this.isComplete = false; /** - * Unique cache key (unique within its file type) + * The direction of the fade. + * `true` = fade out (transparent to color), `false` = fade in (color to transparent) * - * @name Phaser.Loader.MultiFile#key - * @type {string} - * @since 3.7.0 + * @name Phaser.Cameras.Scene2D.Effects.Fade#direction + * @type {boolean} + * @readonly + * @since 3.5.0 */ - this.key = key; + this.direction = true; /** - * The current index being used by multi-file loaders to avoid key clashes. + * The duration of the effect, in milliseconds. * - * @name Phaser.Loader.MultiFile#multiKeyIndex + * @name Phaser.Cameras.Scene2D.Effects.Fade#duration * @type {number} - * @private - * @since 3.20.0 + * @readonly + * @default 0 + * @since 3.5.0 */ - this.multiKeyIndex = loader.multiKeyIndex++; + this.duration = 0; /** - * Array of files that make up this MultiFile. + * The value of the red color channel the camera will use for the fade effect. + * A value between 0 and 255. * - * @name Phaser.Loader.MultiFile#files - * @type {Phaser.Loader.File[]} - * @since 3.7.0 + * @name Phaser.Cameras.Scene2D.Effects.Fade#red + * @type {number} + * @private + * @since 3.5.0 */ - this.files = finalFiles; + this.red = 0; /** - * The completion status of this MultiFile. + * The value of the green color channel the camera will use for the fade effect. + * A value between 0 and 255. * - * @name Phaser.Loader.MultiFile#complete - * @type {boolean} - * @default false - * @since 3.7.0 + * @name Phaser.Cameras.Scene2D.Effects.Fade#green + * @type {number} + * @private + * @since 3.5.0 */ - this.complete = false; + this.green = 0; /** - * The number of files to load. + * The value of the blue color channel the camera will use for the fade effect. + * A value between 0 and 255. * - * @name Phaser.Loader.MultiFile#pending + * @name Phaser.Cameras.Scene2D.Effects.Fade#blue * @type {number} - * @since 3.7.0 + * @private + * @since 3.5.0 */ - - this.pending = finalFiles.length; + this.blue = 0; /** - * The number of files that failed to load. + * The value of the alpha channel used during the fade effect. + * A value between 0 and 1. * - * @name Phaser.Loader.MultiFile#failed + * @name Phaser.Cameras.Scene2D.Effects.Fade#alpha * @type {number} - * @default 0 - * @since 3.7.0 + * @private + * @since 3.5.0 */ - this.failed = 0; + this.alpha = 0; /** - * A storage container for transient data that the loading files need. + * If this effect is running this holds the current percentage of the progress, a value between 0 and 1. * - * @name Phaser.Loader.MultiFile#config - * @type {any} - * @since 3.7.0 + * @name Phaser.Cameras.Scene2D.Effects.Fade#progress + * @type {number} + * @since 3.5.0 */ - this.config = {}; + this.progress = 0; /** - * A reference to the Loaders baseURL at the time this MultiFile was created. - * Used to populate child-files. + * Effect elapsed timer. * - * @name Phaser.Loader.MultiFile#baseURL - * @type {string} - * @since 3.20.0 + * @name Phaser.Cameras.Scene2D.Effects.Fade#_elapsed + * @type {number} + * @private + * @since 3.5.0 */ - this.baseURL = loader.baseURL; + this._elapsed = 0; /** - * A reference to the Loaders path at the time this MultiFile was created. - * Used to populate child-files. + * This callback is invoked every frame for the duration of the effect. * - * @name Phaser.Loader.MultiFile#path - * @type {string} - * @since 3.20.0 + * @name Phaser.Cameras.Scene2D.Effects.Fade#_onUpdate + * @type {?Phaser.Types.Cameras.Scene2D.CameraFadeCallback} + * @private + * @default null + * @since 3.5.0 */ - this.path = loader.path; + this._onUpdate; /** - * A reference to the Loaders prefix at the time this MultiFile was created. - * Used to populate child-files. + * On Complete callback scope. * - * @name Phaser.Loader.MultiFile#prefix - * @type {string} - * @since 3.20.0 + * @name Phaser.Cameras.Scene2D.Effects.Fade#_onUpdateScope + * @type {any} + * @private + * @since 3.5.0 */ - this.prefix = loader.prefix; - - // Link the files - for (var i = 0; i < finalFiles.length; i++) - { - finalFiles[i].multiFile = this; - } + this._onUpdateScope; }, /** - * Checks if this MultiFile is ready to process its children or not. + * Fades the Camera to or from the given color over the duration specified. * - * @method Phaser.Loader.MultiFile#isReadyToProcess - * @since 3.7.0 + * @method Phaser.Cameras.Scene2D.Effects.Fade#start + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @since 3.5.0 * - * @return {boolean} `true` if all children of this MultiFile have loaded, otherwise `false`. + * @param {boolean} [direction=true] - The direction of the fade. `true` = fade out (transparent to color), `false` = fade in (color to transparent) + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. + * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. + * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. + * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. + * @param {Phaser.Types.Cameras.Scene2D.CameraFadeCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * + * @return {Phaser.Cameras.Scene2D.Camera} The Camera on which the effect was started. */ - isReadyToProcess: function () + start: function (direction, duration, red, green, blue, force, callback, context) { - return (this.pending === 0 && this.failed === 0 && !this.complete); + if (direction === undefined) { direction = true; } + if (duration === undefined) { duration = 1000; } + if (red === undefined) { red = 0; } + if (green === undefined) { green = 0; } + if (blue === undefined) { blue = 0; } + if (force === undefined) { force = false; } + if (callback === undefined) { callback = null; } + if (context === undefined) { context = this.camera.scene; } + + if (!force && this.isRunning) + { + return this.camera; + } + + this.isRunning = true; + this.isComplete = false; + this.duration = duration; + this.direction = direction; + this.progress = 0; + + this.red = red; + this.green = green; + this.blue = blue; + this.alpha = (direction) ? Number.MIN_VALUE : 1; + + this._elapsed = 0; + + this._onUpdate = callback; + this._onUpdateScope = context; + + var eventName = (direction) ? Events.FADE_OUT_START : Events.FADE_IN_START; + + this.camera.emit(eventName, this.camera, this, duration, red, green, blue); + + return this.camera; }, /** - * Adds another child to this MultiFile, increases the pending count and resets the completion status. - * - * @method Phaser.Loader.MultiFile#addToMultiFile - * @since 3.7.0 + * The main update loop for this effect. Called automatically by the Camera. * - * @param {Phaser.Loader.File} files - The File to add to this MultiFile. + * @method Phaser.Cameras.Scene2D.Effects.Fade#update + * @since 3.5.0 * - * @return {Phaser.Loader.MultiFile} This MultiFile instance. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - addToMultiFile: function (file) + update: function (time, delta) { - this.files.push(file); + if (!this.isRunning) + { + return; + } - file.multiFile = this; + this._elapsed += delta; - this.pending++; + this.progress = Clamp(this._elapsed / this.duration, 0, 1); - this.complete = false; + if (this._onUpdate) + { + this._onUpdate.call(this._onUpdateScope, this.camera, this.progress); + } - return this; + if (this._elapsed < this.duration) + { + this.alpha = (this.direction) ? this.progress : 1 - this.progress; + } + else + { + this.alpha = (this.direction) ? 1 : 0; + this.effectComplete(); + } }, /** - * Called by each File when it finishes loading. + * Called internally by the Canvas Renderer. * - * @method Phaser.Loader.MultiFile#onFileComplete - * @since 3.7.0 + * @method Phaser.Cameras.Scene2D.Effects.Fade#postRenderCanvas + * @since 3.5.0 * - * @param {Phaser.Loader.File} file - The File that has completed processing. + * @param {CanvasRenderingContext2D} ctx - The Canvas context to render to. + * + * @return {boolean} `true` if the effect drew to the renderer, otherwise `false`. */ - onFileComplete: function (file) + postRenderCanvas: function (ctx) { - var index = this.files.indexOf(file); - - if (index !== -1) + if (!this.isRunning && !this.isComplete) { - this.pending--; + return false; } + + var camera = this.camera; + + ctx.fillStyle = 'rgba(' + this.red + ',' + this.green + ',' + this.blue + ',' + this.alpha + ')'; + ctx.fillRect(camera.x, camera.y, camera.width, camera.height); + + return true; }, /** - * Called by each File that fails to load. + * Called internally by the WebGL Renderer. * - * @method Phaser.Loader.MultiFile#onFileFailed - * @since 3.7.0 + * @method Phaser.Cameras.Scene2D.Effects.Fade#postRenderWebGL + * @since 3.5.0 * - * @param {Phaser.Loader.File} file - The File that has failed to load. + * @param {Phaser.Renderer.WebGL.Pipelines.MultiPipeline} pipeline - The WebGL Pipeline to render to. Must provide the `drawFillRect` method. + * @param {function} getTintFunction - A function that will return the gl safe tint colors. + * + * @return {boolean} `true` if the effect drew to the renderer, otherwise `false`. */ - onFileFailed: function (file) + postRenderWebGL: function (pipeline, getTintFunction) { - var index = this.files.indexOf(file); - - if (index !== -1) + if (!this.isRunning && !this.isComplete) { - this.failed++; + return false; } - } - -}); - -module.exports = MultiFile; + var camera = this.camera; + var red = this.red / 255; + var green = this.green / 255; + var blue = this.blue / 255; -/***/ }), -/* 50 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Calculate the distance between two sets of coordinates (points). - * - * @function Phaser.Math.Distance.Between - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The distance between each point. - */ -var DistanceBetween = function (x1, y1, x2, y2) -{ - var dx = x1 - x2; - var dy = y1 - y2; + pipeline.drawFillRect( + camera.x, camera.y, camera.width, camera.height, + getTintFunction(blue, green, red, 1), + this.alpha + ); - return Math.sqrt(dx * dx + dy * dy); -}; + return true; + }, -module.exports = DistanceBetween; + /** + * Called internally when the effect completes. + * + * @method Phaser.Cameras.Scene2D.Effects.Fade#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE + * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE + * @since 3.5.0 + */ + effectComplete: function () + { + this._onUpdate = null; + this._onUpdateScope = null; + this.isRunning = false; + this.isComplete = true; -/***/ }), -/* 51 */ -/***/ (function(module, exports, __webpack_require__) { + var eventName = (this.direction) ? Events.FADE_OUT_COMPLETE : Events.FADE_IN_COMPLETE; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.camera.emit(eventName, this.camera, this); + }, -/** - * @namespace Phaser.Input.Events - */ + /** + * Resets this camera effect. + * If it was previously running, it stops instantly without calling its onComplete callback or emitting an event. + * + * @method Phaser.Cameras.Scene2D.Effects.Fade#reset + * @since 3.5.0 + */ + reset: function () + { + this.isRunning = false; + this.isComplete = false; -module.exports = { + this._onUpdate = null; + this._onUpdateScope = null; + }, - BOOT: __webpack_require__(922), - DESTROY: __webpack_require__(923), - DRAG_END: __webpack_require__(924), - DRAG_ENTER: __webpack_require__(925), - DRAG: __webpack_require__(926), - DRAG_LEAVE: __webpack_require__(927), - DRAG_OVER: __webpack_require__(928), - DRAG_START: __webpack_require__(929), - DROP: __webpack_require__(930), - GAME_OUT: __webpack_require__(931), - GAME_OVER: __webpack_require__(932), - GAMEOBJECT_DOWN: __webpack_require__(933), - GAMEOBJECT_DRAG_END: __webpack_require__(934), - GAMEOBJECT_DRAG_ENTER: __webpack_require__(935), - GAMEOBJECT_DRAG: __webpack_require__(936), - GAMEOBJECT_DRAG_LEAVE: __webpack_require__(937), - GAMEOBJECT_DRAG_OVER: __webpack_require__(938), - GAMEOBJECT_DRAG_START: __webpack_require__(939), - GAMEOBJECT_DROP: __webpack_require__(940), - GAMEOBJECT_MOVE: __webpack_require__(941), - GAMEOBJECT_OUT: __webpack_require__(942), - GAMEOBJECT_OVER: __webpack_require__(943), - GAMEOBJECT_POINTER_DOWN: __webpack_require__(944), - GAMEOBJECT_POINTER_MOVE: __webpack_require__(945), - GAMEOBJECT_POINTER_OUT: __webpack_require__(946), - GAMEOBJECT_POINTER_OVER: __webpack_require__(947), - GAMEOBJECT_POINTER_UP: __webpack_require__(948), - GAMEOBJECT_POINTER_WHEEL: __webpack_require__(949), - GAMEOBJECT_UP: __webpack_require__(950), - GAMEOBJECT_WHEEL: __webpack_require__(951), - MANAGER_BOOT: __webpack_require__(952), - MANAGER_PROCESS: __webpack_require__(953), - MANAGER_UPDATE: __webpack_require__(954), - POINTER_DOWN: __webpack_require__(955), - POINTER_DOWN_OUTSIDE: __webpack_require__(956), - POINTER_MOVE: __webpack_require__(957), - POINTER_OUT: __webpack_require__(958), - POINTER_OVER: __webpack_require__(959), - POINTER_UP: __webpack_require__(960), - POINTER_UP_OUTSIDE: __webpack_require__(961), - POINTER_WHEEL: __webpack_require__(962), - POINTERLOCK_CHANGE: __webpack_require__(963), - PRE_UPDATE: __webpack_require__(964), - SHUTDOWN: __webpack_require__(965), - START: __webpack_require__(966), - UPDATE: __webpack_require__(967) - -}; - - -/***/ }), -/* 52 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Destroys this effect, releasing it from the Camera. + * + * @method Phaser.Cameras.Scene2D.Effects.Fade#destroy + * @since 3.5.0 + */ + destroy: function () + { + this.reset(); -/** - * Positions the Game Object so that the top of its bounds aligns with the given coordinate. - * - * @function Phaser.Display.Bounds.SetTop - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. - * @param {number} value - The coordinate to position the Game Object bounds on. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. - */ -var SetTop = function (gameObject, value) -{ - gameObject.y = value + (gameObject.height * gameObject.originY); + this.camera = null; + } - return gameObject; -}; +}); -module.exports = SetTop; +module.exports = Fade; /***/ }), -/* 53 */ -/***/ (function(module, exports) { + +/***/ 22151: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(89787); + /** - * Positions the Game Object so that the left of its bounds aligns with the given coordinate. + * @classdesc + * A Camera Flash effect. * - * @function Phaser.Display.Bounds.SetLeft - * @since 3.0.0 + * This effect will flash the camera viewport to the given color, over the duration specified. * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * Only the camera viewport is flashed. None of the objects it is displaying are impacted, i.e. their colors do + * not change. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. - * @param {number} value - The coordinate to position the Game Object bounds on. + * The effect will dispatch several events on the Camera itself and you can also specify an `onUpdate` callback, + * which is invoked each frame for the duration of the effect, if required. * - * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. + * @class Flash + * @memberof Phaser.Cameras.Scene2D.Effects + * @constructor + * @since 3.5.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera this effect is acting upon. */ -var SetLeft = function (gameObject, value) -{ - gameObject.x = value + (gameObject.width * gameObject.originX); +var Flash = new Class({ - return gameObject; -}; + initialize: -module.exports = SetLeft; + function Flash (camera) + { + /** + * The Camera this effect belongs to. + * + * @name Phaser.Cameras.Scene2D.Effects.Flash#camera + * @type {Phaser.Cameras.Scene2D.Camera} + * @readonly + * @since 3.5.0 + */ + this.camera = camera; + /** + * Is this effect actively running? + * + * @name Phaser.Cameras.Scene2D.Effects.Flash#isRunning + * @type {boolean} + * @readonly + * @default false + * @since 3.5.0 + */ + this.isRunning = false; -/***/ }), -/* 54 */ -/***/ (function(module, exports) { + /** + * The duration of the effect, in milliseconds. + * + * @name Phaser.Cameras.Scene2D.Effects.Flash#duration + * @type {number} + * @readonly + * @default 0 + * @since 3.5.0 + */ + this.duration = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The value of the red color channel the camera will use for the flash effect. + * A value between 0 and 255. + * + * @name Phaser.Cameras.Scene2D.Effects.Flash#red + * @type {number} + * @private + * @since 3.5.0 + */ + this.red = 0; -/** - * Positions the Game Object so that the left of its bounds aligns with the given coordinate. - * - * @function Phaser.Display.Bounds.SetRight - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. - * @param {number} value - The coordinate to position the Game Object bounds on. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. - */ -var SetRight = function (gameObject, value) -{ - gameObject.x = (value - gameObject.width) + (gameObject.width * gameObject.originX); + /** + * The value of the green color channel the camera will use for the flash effect. + * A value between 0 and 255. + * + * @name Phaser.Cameras.Scene2D.Effects.Flash#green + * @type {number} + * @private + * @since 3.5.0 + */ + this.green = 0; - return gameObject; -}; + /** + * The value of the blue color channel the camera will use for the flash effect. + * A value between 0 and 255. + * + * @name Phaser.Cameras.Scene2D.Effects.Flash#blue + * @type {number} + * @private + * @since 3.5.0 + */ + this.blue = 0; -module.exports = SetRight; + /** + * The value of the alpha channel used during the flash effect. + * A value between 0 and 1. + * + * @name Phaser.Cameras.Scene2D.Effects.Flash#alpha + * @type {number} + * @since 3.5.0 + */ + this.alpha = 1; + /** + * If this effect is running this holds the current percentage of the progress, a value between 0 and 1. + * + * @name Phaser.Cameras.Scene2D.Effects.Flash#progress + * @type {number} + * @since 3.5.0 + */ + this.progress = 0; -/***/ }), -/* 55 */ -/***/ (function(module, exports) { + /** + * Effect elapsed timer. + * + * @name Phaser.Cameras.Scene2D.Effects.Flash#_elapsed + * @type {number} + * @private + * @since 3.5.0 + */ + this._elapsed = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * This is an internal copy of the initial value of `this.alpha`, used to calculate the current alpha value of the fade effect. + * + * @name Phaser.Cameras.Scene2D.Effects.Flash#_alpha + * @type {number} + * @private + * @readonly + * @since 3.60.0 + */ + this._alpha; -/** - * Positions the Game Object so that the bottom of its bounds aligns with the given coordinate. - * - * @function Phaser.Display.Bounds.SetBottom - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. - * @param {number} value - The coordinate to position the Game Object bounds on. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. - */ -var SetBottom = function (gameObject, value) -{ - gameObject.y = (value - gameObject.height) + (gameObject.height * gameObject.originY); + /** + * This callback is invoked every frame for the duration of the effect. + * + * @name Phaser.Cameras.Scene2D.Effects.Flash#_onUpdate + * @type {?Phaser.Types.Cameras.Scene2D.CameraFlashCallback} + * @private + * @default null + * @since 3.5.0 + */ + this._onUpdate; - return gameObject; -}; + /** + * On Complete callback scope. + * + * @name Phaser.Cameras.Scene2D.Effects.Flash#_onUpdateScope + * @type {any} + * @private + * @since 3.5.0 + */ + this._onUpdateScope; + }, -module.exports = SetBottom; + /** + * Flashes the Camera to or from the given color over the duration specified. + * + * @method Phaser.Cameras.Scene2D.Effects.Flash#start + * @fires Phaser.Cameras.Scene2D.Events#FLASH_START + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE + * @since 3.5.0 + * + * @param {number} [duration=250] - The duration of the effect in milliseconds. + * @param {number} [red=255] - The amount to flash the red channel towards. A value between 0 and 255. + * @param {number} [green=255] - The amount to flash the green channel towards. A value between 0 and 255. + * @param {number} [blue=255] - The amount to flash the blue channel towards. A value between 0 and 255. + * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. + * @param {Phaser.Types.Cameras.Scene2D.CameraFlashCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * + * @return {Phaser.Cameras.Scene2D.Camera} The Camera on which the effect was started. + */ + start: function (duration, red, green, blue, force, callback, context) + { + if (duration === undefined) { duration = 250; } + if (red === undefined) { red = 255; } + if (green === undefined) { green = 255; } + if (blue === undefined) { blue = 255; } + if (force === undefined) { force = false; } + if (callback === undefined) { callback = null; } + if (context === undefined) { context = this.camera.scene; } + if (!force && this.isRunning) + { + return this.camera; + } -/***/ }), -/* 56 */ -/***/ (function(module, exports) { + this.isRunning = true; + this.duration = duration; + this.progress = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.red = red; + this.green = green; + this.blue = blue; -var GEOM_CONST = { + this._alpha = this.alpha; + this._elapsed = 0; - /** - * A Circle Geometry object type. - * - * @name Phaser.Geom.CIRCLE - * @type {number} - * @since 3.19.0 - */ - CIRCLE: 0, + this._onUpdate = callback; + this._onUpdateScope = context; - /** - * An Ellipse Geometry object type. - * - * @name Phaser.Geom.ELLIPSE - * @type {number} - * @since 3.19.0 - */ - ELLIPSE: 1, + this.camera.emit(Events.FLASH_START, this.camera, this, duration, red, green, blue); - /** - * A Line Geometry object type. - * - * @name Phaser.Geom.LINE - * @type {number} - * @since 3.19.0 - */ - LINE: 2, + return this.camera; + }, /** - * A Point Geometry object type. - * - * @name Phaser.Geom.POINT - * @type {number} - * @since 3.19.0 + * The main update loop for this effect. Called automatically by the Camera. + * + * @method Phaser.Cameras.Scene2D.Effects.Flash#update + * @since 3.5.0 + * + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - POINT: 3, + update: function (time, delta) + { + if (!this.isRunning) + { + return; + } + + this._elapsed += delta; + + this.progress = Clamp(this._elapsed / this.duration, 0, 1); + + if (this._onUpdate) + { + this._onUpdate.call(this._onUpdateScope, this.camera, this.progress); + } + + if (this._elapsed < this.duration) + { + this.alpha = this._alpha * (1 - this.progress); + } + else + { + this.effectComplete(); + } + }, /** - * A Polygon Geometry object type. - * - * @name Phaser.Geom.POLYGON - * @type {number} - * @since 3.19.0 + * Called internally by the Canvas Renderer. + * + * @method Phaser.Cameras.Scene2D.Effects.Flash#postRenderCanvas + * @since 3.5.0 + * + * @param {CanvasRenderingContext2D} ctx - The Canvas context to render to. + * + * @return {boolean} `true` if the effect drew to the renderer, otherwise `false`. */ - POLYGON: 4, + postRenderCanvas: function (ctx) + { + if (!this.isRunning) + { + return false; + } + + var camera = this.camera; + + ctx.fillStyle = 'rgba(' + this.red + ',' + this.green + ',' + this.blue + ',' + this.alpha + ')'; + ctx.fillRect(camera.x, camera.y, camera.width, camera.height); + + return true; + }, /** - * A Rectangle Geometry object type. - * - * @name Phaser.Geom.RECTANGLE - * @type {number} - * @since 3.19.0 + * Called internally by the WebGL Renderer. + * + * @method Phaser.Cameras.Scene2D.Effects.Flash#postRenderWebGL + * @since 3.5.0 + * + * @param {Phaser.Renderer.WebGL.Pipelines.MultiPipeline} pipeline - The WebGL Pipeline to render to. Must provide the `drawFillRect` method. + * @param {function} getTintFunction - A function that will return the gl safe tint colors. + * + * @return {boolean} `true` if the effect drew to the renderer, otherwise `false`. */ - RECTANGLE: 5, + postRenderWebGL: function (pipeline, getTintFunction) + { + if (!this.isRunning) + { + return false; + } + + var camera = this.camera; + var red = this.red / 255; + var green = this.green / 255; + var blue = this.blue / 255; + + pipeline.drawFillRect( + camera.x, camera.y, camera.width, camera.height, + getTintFunction(blue, green, red, 1), + this.alpha + ); + + return true; + }, /** - * A Triangle Geometry object type. - * - * @name Phaser.Geom.TRIANGLE - * @type {number} - * @since 3.19.0 + * Called internally when the effect completes. + * + * @method Phaser.Cameras.Scene2D.Effects.Flash#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE + * @since 3.5.0 */ - TRIANGLE: 6 - -}; + effectComplete: function () + { + this.alpha = this._alpha; + this._onUpdate = null; + this._onUpdateScope = null; -module.exports = GEOM_CONST; + this.isRunning = false; + this.camera.emit(Events.FLASH_COMPLETE, this.camera, this); + }, -/***/ }), -/* 57 */ -/***/ (function(module, exports) { + /** + * Resets this camera effect. + * If it was previously running, it stops instantly without calling its onComplete callback or emitting an event. + * + * @method Phaser.Cameras.Scene2D.Effects.Flash#reset + * @since 3.5.0 + */ + reset: function () + { + this.isRunning = false; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this._onUpdate = null; + this._onUpdateScope = null; + }, -/** - * Checks if a given point is inside a Rectangle's bounds. - * - * @function Phaser.Geom.Rectangle.Contains - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to check. - * @param {number} x - The X coordinate of the point to check. - * @param {number} y - The Y coordinate of the point to check. - * - * @return {boolean} `true` if the point is within the Rectangle's bounds, otherwise `false`. - */ -var Contains = function (rect, x, y) -{ - if (rect.width <= 0 || rect.height <= 0) + /** + * Destroys this effect, releasing it from the Camera. + * + * @method Phaser.Cameras.Scene2D.Effects.Flash#destroy + * @since 3.5.0 + */ + destroy: function () { - return false; + this.reset(); + + this.camera = null; } - return (rect.x <= x && rect.x + rect.width >= x && rect.y <= y && rect.y + rect.height >= y); -}; +}); -module.exports = Contains; +module.exports = Flash; /***/ }), -/* 58 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 37551: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var DeepCopy = __webpack_require__(175); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(374); -var GetFastValue = __webpack_require__(2); -var Matrix4 = __webpack_require__(69); -var RendererEvents = __webpack_require__(91); -var RenderTarget = __webpack_require__(141); -var Utils = __webpack_require__(12); -var WebGLShader = __webpack_require__(375); +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var EaseMap = __webpack_require__(35060); +var Events = __webpack_require__(89787); +var Vector2 = __webpack_require__(93736); /** * @classdesc - * The `WebGLPipeline` is a base class used by all of the core Phaser pipelines. - * - * It describes the way elements will be rendered in WebGL. Internally, it handles - * compiling the shaders, creating vertex buffers, assigning primitive topology and - * binding vertex attributes, all based on the given configuration data. - * - * The pipeline is configured by passing in a `WebGLPipelineConfig` object. Please - * see the documentation for this type to fully understand the configuration options - * available to you. + * A Camera Pan effect. * - * Usually, you would not extend from this class directly, but would instead extend - * from one of the core pipelines, such as the Multi Pipeline. + * This effect will scroll the Camera so that the center of its viewport finishes at the given destination, + * over the duration and with the ease specified. * - * The pipeline flow per render-step is as follows: + * Only the camera scroll is moved. None of the objects it is displaying are impacted, i.e. their positions do + * not change. * - * 1) onPreRender - called once at the start of the render step - * 2) onRender - call for each Scene Camera that needs to render (so can be multiple times per render step) - * 3) Internal flow: - * 3a) bind (only called if a Game Object is using this pipeline and it's not currently active) - * 3b) onBind (called for every Game Object that uses this pipeline) - * 3c) flush (can be called by a Game Object, internal method or from outside by changing pipeline) - * 4) onPostRender - called once at the end of the render step + * The effect will dispatch several events on the Camera itself and you can also specify an `onUpdate` callback, + * which is invoked each frame for the duration of the effect if required. * - * @class WebGLPipeline - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Renderer.WebGL + * @class Pan + * @memberof Phaser.Cameras.Scene2D.Effects * @constructor - * @since 3.0.0 + * @since 3.11.0 * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration object for this WebGL Pipeline. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera this effect is acting upon. */ -var WebGLPipeline = new Class({ - - Extends: EventEmitter, +var Pan = new Class({ initialize: - function WebGLPipeline (config) + function Pan (camera) { - EventEmitter.call(this); - - var game = config.game; - var renderer = game.renderer; - var gl = renderer.gl; - - /** - * Name of the pipeline. Used for identification and setting from Game Objects. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#name - * @type {string} - * @since 3.0.0 - */ - this.name = GetFastValue(config, 'name', 'WebGLPipeline'); - - /** - * The Phaser Game instance to which this pipeline is bound. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; - - /** - * The WebGL Renderer instance to which this pipeline is bound. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer - * @type {Phaser.Renderer.WebGL.WebGLRenderer} - * @since 3.0.0 - */ - this.renderer = renderer; - - /** - * A reference to the WebGL Pipeline Manager. - * - * This is initially undefined and only set when this pipeline is added - * to the manager. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#manager - * @type {?Phaser.Renderer.WebGL.PipelineManager} - * @since 3.50.0 - */ - this.manager; - - /** - * The WebGL context this WebGL Pipeline uses. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#gl - * @type {WebGLRenderingContext} - * @since 3.0.0 - */ - this.gl = gl; - - /** - * The canvas which this WebGL Pipeline renders to. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#view - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.view = game.canvas; - - /** - * Width of the current viewport. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#width - * @type {number} - * @since 3.0.0 - */ - this.width = 0; - - /** - * Height of the current viewport. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#height - * @type {number} - * @since 3.0.0 - */ - this.height = 0; - - /** - * The current number of vertices that have been added to the pipeline batch. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.vertexCount = 0; - /** - * The total number of vertices that this pipeline batch can hold before it will flush. - * - * This defaults to `renderer batchSize * 6`, where `batchSize` is defined in the Renderer Game Config. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity - * @type {number} - * @since 3.0.0 - */ - this.vertexCapacity = 0; - - /** - * Raw byte buffer of vertices. - * - * Either set via the config object `vertices` property, or generates a new Array Buffer of - * size `vertexCapacity * vertexSize`. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData - * @type {ArrayBuffer} - * @readonly - * @since 3.0.0 - */ - this.vertexData; - - /** - * The WebGLBuffer that holds the vertex data. - * - * Created from the `vertexData` ArrayBuffer. If `vertices` are set in the config, a `STATIC_DRAW` buffer - * is created. If not, a `DYNAMIC_DRAW` buffer is created. + * The Camera this effect belongs to. * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer - * @type {WebGLBuffer} + * @name Phaser.Cameras.Scene2D.Effects.Pan#camera + * @type {Phaser.Cameras.Scene2D.Camera} * @readonly - * @since 3.0.0 - */ - this.vertexBuffer; - - /** - * The primitive topology which the pipeline will use to submit draw calls. - * - * Defaults to GL_TRIANGLES if not otherwise set in the config. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#topology - * @type {GLenum} - * @since 3.0.0 - */ - this.topology = GetFastValue(config, 'topology', gl.TRIANGLES); - - /** - * Uint8 view to the `vertexData` ArrayBuffer. Used for uploading vertex buffer resources to the GPU. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#bytes - * @type {Uint8Array} - * @since 3.0.0 - */ - this.bytes; - - /** - * Float32 view of the array buffer containing the pipeline's vertices. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexViewF32 - * @type {Float32Array} - * @since 3.0.0 - */ - this.vertexViewF32; - - /** - * Uint32 view of the array buffer containing the pipeline's vertices. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexViewU32 - * @type {Uint32Array} - * @since 3.0.0 - */ - this.vertexViewU32; - - /** - * Indicates if the current pipeline is active, or not. - * - * Toggle this property to enable or disable a pipeline from rendering anything. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#active - * @type {boolean} - * @since 3.10.0 - */ - this.active = true; - - /** - * Holds the most recently assigned texture unit. - * - * Treat this value as read-only. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#currentUnit - * @type {number} - * @since 3.50.0 - */ - this.currentUnit = 0; - - /** - * Some pipelines require the forced use of texture zero (like the light pipeline). - * - * This property should be set when that is the case. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#forceZero - * @type {boolean} - * @since 3.50.0 + * @since 3.11.0 */ - this.forceZero = GetFastValue(config, 'forceZero', false); + this.camera = camera; /** - * Indicates if this pipeline has booted or not. - * - * A pipeline boots only when the Game instance itself, and all associated systems, is - * fully ready. + * Is this effect actively running? * - * @name Phaser.Renderer.WebGL.WebGLPipeline#hasBooted + * @name Phaser.Cameras.Scene2D.Effects.Pan#isRunning * @type {boolean} * @readonly - * @since 3.50.0 + * @default false + * @since 3.11.0 */ - this.hasBooted = false; + this.isRunning = false; /** - * Indicates if this is a Post FX Pipeline, or not. + * The duration of the effect, in milliseconds. * - * @name Phaser.Renderer.WebGL.WebGLPipeline#isPostFX - * @type {boolean} + * @name Phaser.Cameras.Scene2D.Effects.Pan#duration + * @type {number} * @readonly - * @since 3.50.0 - */ - this.isPostFX = false; - - /** - * An array of RenderTarget instances that belong to this pipeline. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#renderTargets - * @type {Phaser.Renderer.WebGL.RenderTarget[]} - * @since 3.50.0 + * @default 0 + * @since 3.11.0 */ - this.renderTargets = []; + this.duration = 0; /** - * A reference to the currently bound Render Target instance from the `WebGLPipeline.renderTargets` array. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#currentRenderTarget - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @since 3.50.0 + * The starting scroll coordinates to pan the camera from. + * + * @name Phaser.Cameras.Scene2D.Effects.Pan#source + * @type {Phaser.Math.Vector2} + * @since 3.11.0 */ - this.currentRenderTarget; + this.source = new Vector2(); /** - * An array of all the WebGLShader instances that belong to this pipeline. - * - * Shaders manage their own attributes and uniforms, but share the same vertex data buffer, - * which belongs to this pipeline. - * - * Shaders are set in a call to the `setShadersFromConfig` method, which happens automatically, - * but can also be called at any point in your game. See the method documentation for details. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#shaders - * @type {Phaser.Renderer.WebGL.WebGLShader[]} - * @since 3.50.0 + * The constantly updated value based on zoom. + * + * @name Phaser.Cameras.Scene2D.Effects.Pan#current + * @type {Phaser.Math.Vector2} + * @since 3.11.0 */ - this.shaders = []; + this.current = new Vector2(); /** - * A reference to the currently bound WebGLShader instance from the `WebGLPipeline.shaders` array. - * - * For lots of pipelines, this is the only shader, so it is a quick way to reference it without - * an array look-up. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#currentShader - * @type {Phaser.Renderer.WebGL.WebGLShader} - * @since 3.50.0 + * The destination scroll coordinates to pan the camera to. + * + * @name Phaser.Cameras.Scene2D.Effects.Pan#destination + * @type {Phaser.Math.Vector2} + * @since 3.11.0 */ - this.currentShader; + this.destination = new Vector2(); /** - * The Projection matrix, used by shaders as 'uProjectionMatrix' uniform. - * - * @name Phaser.Renderer.WebGL.WebGLPipeline#projectionMatrix - * @type {Phaser.Math.Matrix4} - * @since 3.50.0 + * The ease function to use during the pan. + * + * @name Phaser.Cameras.Scene2D.Effects.Pan#ease + * @type {function} + * @since 3.11.0 */ - this.projectionMatrix; + this.ease; /** - * The cached width of the Projection matrix. + * If this effect is running this holds the current percentage of the progress, a value between 0 and 1. * - * @name Phaser.Renderer.WebGL.WebGLPipeline#projectionWidth + * @name Phaser.Cameras.Scene2D.Effects.Pan#progress * @type {number} - * @since 3.50.0 + * @since 3.11.0 */ - this.projectionWidth = 0; + this.progress = 0; /** - * The cached height of the Projection matrix. + * Effect elapsed timer. * - * @name Phaser.Renderer.WebGL.WebGLPipeline#projectionHeight + * @name Phaser.Cameras.Scene2D.Effects.Pan#_elapsed * @type {number} - * @since 3.50.0 + * @private + * @since 3.11.0 */ - this.projectionHeight = 0; + this._elapsed = 0; /** - * The configuration object that was used to create this pipeline. - * - * Treat this object as 'read only', because changing it post-creation will not - * impact this pipeline in any way. However, it is used internally for cloning - * and post-boot set-up. + * This callback is invoked every frame for the duration of the effect. * - * @name Phaser.Renderer.WebGL.WebGLPipeline#config - * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} - * @since 3.50.0 + * @name Phaser.Cameras.Scene2D.Effects.Pan#_onUpdate + * @type {?Phaser.Types.Cameras.Scene2D.CameraPanCallback} + * @private + * @default null + * @since 3.11.0 */ - this.config = config; + this._onUpdate; /** - * Has the GL Context been reset to the Phaser defaults since the last time - * this pipeline was bound? This is set automatically when the Pipeline Manager - * resets itself, usually after handing off to a 3rd party renderer like Spine. - * - * You should treat this property as read-only. + * On Complete callback scope. * - * @name Phaser.Renderer.WebGL.WebGLPipeline#glReset - * @type {boolean} - * @since 3.53.0 + * @name Phaser.Cameras.Scene2D.Effects.Pan#_onUpdateScope + * @type {any} + * @private + * @since 3.11.0 */ - this.glReset = false; + this._onUpdateScope; }, /** - * Called when the Game has fully booted and the Renderer has finished setting up. - * - * By this stage all Game level systems are now in place. You can perform any final tasks that the - * pipeline may need, that relies on game systems such as the Texture Manager being ready. + * This effect will scroll the Camera so that the center of its viewport finishes at the given destination, + * over the duration and with the ease specified. * - * @method Phaser.Renderer.WebGL.WebGLPipeline#boot - * @fires Phaser.Renderer.WebGL.Pipelines.Events#BOOT + * @method Phaser.Cameras.Scene2D.Effects.Pan#start + * @fires Phaser.Cameras.Scene2D.Events#PAN_START + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE * @since 3.11.0 + * + * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. + * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. + * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. + * @param {Phaser.Types.Cameras.Scene2D.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, + * the current camera scroll x coordinate and the current camera scroll y coordinate. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * + * @return {Phaser.Cameras.Scene2D.Camera} The Camera on which the effect was started. */ - boot: function () + start: function (x, y, duration, ease, force, callback, context) { - var i; - var gl = this.gl; - var config = this.config; - var renderer = this.renderer; + if (duration === undefined) { duration = 1000; } + if (ease === undefined) { ease = EaseMap.Linear; } + if (force === undefined) { force = false; } + if (callback === undefined) { callback = null; } + if (context === undefined) { context = this.camera.scene; } - if (!this.isPostFX) + var cam = this.camera; + + if (!force && this.isRunning) { - this.projectionMatrix = new Matrix4().identity(); + return cam; } - // Create the Render Targets - - var renderTargets = this.renderTargets; + this.isRunning = true; + this.duration = duration; + this.progress = 0; - var targets = GetFastValue(config, 'renderTarget', false); + // Starting from + this.source.set(cam.scrollX, cam.scrollY); - // If boolean, set to number = 1 - if (typeof(targets) === 'boolean' && targets) - { - targets = 1; - } + // Destination + this.destination.set(x, y); - var width = renderer.width; - var height = renderer.height; + // Zoom factored version + cam.getScroll(x, y, this.current); - if (typeof(targets) === 'number') + // Using this ease + if (typeof ease === 'string' && EaseMap.hasOwnProperty(ease)) { - // Create this many default RTs - for (i = 0; i < targets; i++) - { - renderTargets.push(new RenderTarget(renderer, width, height, 1, 0, true)); - } + this.ease = EaseMap[ease]; } - else if (Array.isArray(targets)) + else if (typeof ease === 'function') { - for (i = 0; i < targets.length; i++) - { - var scale = GetFastValue(targets[i], 'scale', 1); - var minFilter = GetFastValue(targets[i], 'minFilter', 0); - var autoClear = GetFastValue(targets[i], 'autoClear', 1); - - renderTargets.push(new RenderTarget(renderer, width, height, scale, minFilter, autoClear)); - } + this.ease = ease; } - if (renderTargets.length) - { - // Default to the first one in the array - this.currentRenderTarget = renderTargets[0]; - } + this._elapsed = 0; - // Create the Shaders + this._onUpdate = callback; + this._onUpdateScope = context; - this.setShadersFromConfig(config); + this.camera.emit(Events.PAN_START, this.camera, this, duration, x, y); - // Which shader has the largest vertex size? - var shaders = this.shaders; - var vertexSize = 0; + return cam; + }, - for (i = 0; i < shaders.length; i++) + /** + * The main update loop for this effect. Called automatically by the Camera. + * + * @method Phaser.Cameras.Scene2D.Effects.Pan#update + * @since 3.11.0 + * + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. + */ + update: function (time, delta) + { + if (!this.isRunning) { - if (shaders[i].vertexSize > vertexSize) - { - vertexSize = shaders[i].vertexSize; - } + return; } - var batchSize = GetFastValue(config, 'batchSize', renderer.config.batchSize); + this._elapsed += delta; - // * 6 because there are 6 vertices in a quad and 'batchSize' represents the quantity of quads in the batch + var progress = Clamp(this._elapsed / this.duration, 0, 1); - this.vertexCapacity = batchSize * 6; + this.progress = progress; - var data = new ArrayBuffer(this.vertexCapacity * vertexSize); + var cam = this.camera; - this.vertexData = data; - this.bytes = new Uint8Array(data); - this.vertexViewF32 = new Float32Array(data); - this.vertexViewU32 = new Uint32Array(data); + if (this._elapsed < this.duration) + { + var v = this.ease(progress); - var configVerts = GetFastValue(config, 'vertices', null); + cam.getScroll(this.destination.x, this.destination.y, this.current); - if (configVerts) - { - this.vertexViewF32.set(configVerts); + var x = this.source.x + ((this.current.x - this.source.x) * v); + var y = this.source.y + ((this.current.y - this.source.y) * v); - this.vertexBuffer = renderer.createVertexBuffer(data, gl.STATIC_DRAW); + cam.setScroll(x, y); + + if (this._onUpdate) + { + this._onUpdate.call(this._onUpdateScope, cam, progress, x, y); + } } else { - this.vertexBuffer = renderer.createVertexBuffer(data.byteLength, gl.DYNAMIC_DRAW); - } - - // Set-up shaders - - this.setVertexBuffer(); + cam.centerOn(this.destination.x, this.destination.y); - for (i = shaders.length - 1; i >= 0; i--) - { - shaders[i].rebind(); + if (this._onUpdate) + { + this._onUpdate.call(this._onUpdateScope, cam, progress, cam.scrollX, cam.scrollY); + } + + this.effectComplete(); } - - this.hasBooted = true; - - renderer.on(RendererEvents.RESIZE, this.resize, this); - renderer.on(RendererEvents.PRE_RENDER, this.onPreRender, this); - renderer.on(RendererEvents.RENDER, this.onRender, this); - renderer.on(RendererEvents.POST_RENDER, this.onPostRender, this); - - this.emit(Events.BOOT, this); - - this.onBoot(); }, /** - * This method is called once when this pipeline has finished being set-up - * at the end of the boot process. By the time this method is called, all - * of the shaders are ready and configured. + * Called internally when the effect completes. * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onBoot - * @since 3.50.0 + * @method Phaser.Cameras.Scene2D.Effects.Pan#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE + * @since 3.11.0 */ - onBoot: function () + effectComplete: function () { + this._onUpdate = null; + this._onUpdateScope = null; + + this.isRunning = false; + + this.camera.emit(Events.PAN_COMPLETE, this.camera, this); }, /** - * This method is called once when this pipeline has finished being set-up - * at the end of the boot process. By the time this method is called, all - * of the shaders are ready and configured. It's also called if the renderer - * changes size. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onResize - * @since 3.50.0 + * Resets this camera effect. + * If it was previously running, it stops instantly without calling its onComplete callback or emitting an event. * - * @param {number} width - The new width of this WebGL Pipeline. - * @param {number} height - The new height of this WebGL Pipeline. + * @method Phaser.Cameras.Scene2D.Effects.Pan#reset + * @since 3.11.0 */ - onResize: function () + reset: function () { + this.isRunning = false; + + this._onUpdate = null; + this._onUpdateScope = null; }, /** - * Sets the currently active shader within this pipeline. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setShader - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.WebGLShader} shader - The shader to set as being current. - * @param {boolean} [setAttributes=false] - Should the vertex attribute pointers be set? + * Destroys this effect, releasing it from the Camera. * - * @return {this} This WebGLPipeline instance. + * @method Phaser.Cameras.Scene2D.Effects.Pan#destroy + * @since 3.11.0 */ - setShader: function (shader, setAttributes) + destroy: function () { - var renderer = this.renderer; + this.reset(); - if (shader !== this.currentShader || renderer.currentProgram !== this.currentShader.program) - { - this.flush(); + this.camera = null; + this.source = null; + this.destination = null; + } - renderer.resetTextures(); +}); - var wasBound = this.setVertexBuffer(); +module.exports = Pan; - if (wasBound && !setAttributes) - { - setAttributes = true; - } - shader.bind(setAttributes, false); +/***/ }), - this.currentShader = shader; - } +/***/ 1771: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Jason Nicholls + * @copyright 2018 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ - /** - * Searches all shaders in this pipeline for one matching the given name, then returns it. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#getShaderByName - * @since 3.50.0 - * - * @param {string} name - The index of the shader to set. - * - * @return {Phaser.Renderer.WebGL.WebGLShader} The WebGLShader instance, if found. - */ - getShaderByName: function (name) - { - var shaders = this.shaders; +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(89787); +var EaseMap = __webpack_require__(35060); - for (var i = 0; i < shaders.length; i++) - { - if (shaders[i].name === name) - { - return shaders[i]; - } - } - }, +/** + * @classdesc + * A Camera Rotate effect. + * + * This effect will rotate the Camera so that the its viewport finishes at the given angle in radians, + * over the duration and with the ease specified. + * + * Camera rotation always takes place based on the Camera viewport. By default, rotation happens + * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. + * + * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not + * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. + * + * Only the camera is rotates. None of the objects it is displaying are impacted, i.e. their positions do + * not change. + * + * The effect will dispatch several events on the Camera itself and you can also specify an `onUpdate` callback, + * which is invoked each frame for the duration of the effect if required. + * + * @class RotateTo + * @memberof Phaser.Cameras.Scene2D.Effects + * @constructor + * @since 3.23.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera this effect is acting upon. + */ +var RotateTo = new Class({ - /** - * Destroys all shaders currently set in the `WebGLPipeline.shaders` array and then parses the given - * `config` object, extracting the shaders from it, creating `WebGLShader` instances and finally - * setting them into the `shaders` array of this pipeline. - * - * This is a destructive process. Be very careful when you call it, should you need to. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setShadersFromConfig - * @since 3.50.0 - * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration object for this WebGL Pipeline. - * - * @return {this} This WebGLPipeline instance. - */ - setShadersFromConfig: function (config) + initialize: + + function RotateTo (camera) { - var i; - var shaders = this.shaders; - var renderer = this.renderer; + /** + * The Camera this effect belongs to. + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#camera + * @type {Phaser.Cameras.Scene2D.Camera} + * @readonly + * @since 3.23.0 + */ + this.camera = camera; - for (i = 0; i < shaders.length; i++) - { - shaders[i].destroy(); - } + /** + * Is this effect actively running? + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#isRunning + * @type {boolean} + * @readonly + * @default false + * @since 3.23.0 + */ + this.isRunning = false; - var vName = 'vertShader'; - var fName = 'fragShader'; - var aName = 'attributes'; + /** + * The duration of the effect, in milliseconds. + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#duration + * @type {number} + * @readonly + * @default 0 + * @since 3.23.0 + */ + this.duration = 0; - var defaultVertShader = GetFastValue(config, vName, null); - var defaultFragShader = Utils.parseFragmentShaderMaxTextures(GetFastValue(config, fName, null), renderer.maxTextures); - var defaultAttribs = GetFastValue(config, aName, null); + /** + * The starting angle to rotate the camera from. + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#source + * @type {number} + * @since 3.23.0 + */ + this.source = 0; - var configShaders = GetFastValue(config, 'shaders', []); + /** + * The constantly updated value based on the force. + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#current + * @type {number} + * @since 3.23.0 + */ + this.current = 0; - var len = configShaders.length; + /** + * The destination angle in radians to rotate the camera to. + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#destination + * @type {number} + * @since 3.23.0 + */ + this.destination = 0; - if (len === 0) - { - if (defaultVertShader && defaultFragShader) - { - this.shaders = [ new WebGLShader(this, 'default', defaultVertShader, defaultFragShader, DeepCopy(defaultAttribs)) ]; - } - } - else - { - var newShaders = []; + /** + * The ease function to use during the Rotate. + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#ease + * @type {function} + * @since 3.23.0 + */ + this.ease; - for (i = 0; i < len; i++) - { - var shaderEntry = configShaders[i]; + /** + * If this effect is running this holds the current percentage of the progress, a value between 0 and 1. + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#progress + * @type {number} + * @since 3.23.0 + */ + this.progress = 0; - var name = GetFastValue(shaderEntry, 'name', 'default'); + /** + * Effect elapsed timer. + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#_elapsed + * @type {number} + * @private + * @since 3.23.0 + */ + this._elapsed = 0; - var vertShader = GetFastValue(shaderEntry, vName, defaultVertShader); - var fragShader = Utils.parseFragmentShaderMaxTextures(GetFastValue(shaderEntry, fName, defaultFragShader), renderer.maxTextures); - var attributes = GetFastValue(shaderEntry, aName, defaultAttribs); + /** + * @callback CameraRotateCallback + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running. + * @param {number} progress - The progress of the effect. A value between 0 and 1. + * @param {number} angle - The Camera's new angle in radians. + */ - if (vertShader && fragShader) - { - newShaders.push(new WebGLShader(this, name, vertShader, fragShader, DeepCopy(attributes))); - } - } + /** + * This callback is invoked every frame for the duration of the effect. + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#_onUpdate + * @type {?CameraRotateCallback} + * @private + * @default null + * @since 3.23.0 + */ + this._onUpdate; - this.shaders = newShaders; - } + /** + * On Complete callback scope. + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#_onUpdateScope + * @type {any} + * @private + * @since 3.23.0 + */ + this._onUpdateScope; - if (this.shaders.length === 0) - { - console.warn('Pipeline: ' + this.name + ' - Invalid shader config'); - } - else - { - this.currentShader = this.shaders[0]; - } + /** + * The direction of the rotation. + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#clockwise + * @type {boolean} + * @since 3.23.0 + */ + this.clockwise = true; - return this; + /** + * The shortest direction to the target rotation. + * + * @name Phaser.Cameras.Scene2D.Effects.RotateTo#shortestPath + * @type {boolean} + * @since 3.23.0 + */ + this.shortestPath = false; }, /** - * Custom pipelines can use this method in order to perform any required pre-batch tasks - * for the given Game Object. It must return the texture unit the Game Object was assigned. + * This effect will scroll the Camera so that the center of its viewport finishes at the given angle, + * over the duration and with the ease specified. * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setGameObject - * @since 3.50.0 + * @method Phaser.Cameras.Scene2D.Effects.RotateTo#start + * @fires Phaser.Cameras.Scene2D.Events#ROTATE_START + * @fires Phaser.Cameras.Scene2D.Events#ROTATE_COMPLETE + * @since 3.23.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object being rendered or added to the batch. - * @param {Phaser.Textures.Frame} [frame] - Optional frame to use. Can override that of the Game Object. + * @param {number} radians - The destination angle in radians to rotate the Camera viewport to. If the angle is positive then the rotation is clockwise else anticlockwise + * @param {boolean} [shortestPath=false] - If shortest path is set to true the camera will rotate in the quickest direction clockwise or anti-clockwise. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {(string|function)} [ease='Linear'] - The ease to use for the Rotate. Can be any of the Phaser Easing constants or a custom function. + * @param {boolean} [force=false] - Force the rotation effect to start immediately, even if already running. + * @param {CameraRotateCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, + * the current camera scroll x coordinate and the current camera scroll y coordinate. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. * - * @return {number} The texture unit the Game Object has been assigned. + * @return {Phaser.Cameras.Scene2D.Camera} The Camera on which the effect was started. */ - setGameObject: function (gameObject, frame) + start: function (radians, shortestPath, duration, ease, force, callback, context) { - if (frame === undefined) { frame = gameObject.frame; } + if (duration === undefined) { duration = 1000; } + if (ease === undefined) { ease = EaseMap.Linear; } + if (force === undefined) { force = false; } + if (callback === undefined) { callback = null; } + if (context === undefined) { context = this.camera.scene; } + if (shortestPath === undefined) { shortestPath = false; } - this.currentUnit = this.renderer.setTextureSource(frame.source); + this.shortestPath = shortestPath; - return this.currentUnit; - }, + var tmpDestination = radians; - /** - * Check if the current batch of vertices is full. - * - * You can optionally provide an `amount` parameter. If given, it will check if the batch - * needs to flush _if_ the `amount` is added to it. This allows you to test if you should - * flush before populating the batch. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush - * @since 3.0.0 - * - * @param {number} [amount=0] - Will the batch need to flush if this many vertices are added to it? - * - * @return {boolean} `true` if the current batch should be flushed, otherwise `false`. - */ - shouldFlush: function (amount) - { - if (amount === undefined) { amount = 0; } + if (radians < 0) + { + tmpDestination = -1 * radians; + this.clockwise = false; + } + else + { + this.clockwise = true; + } - return (this.vertexCount + amount > this.vertexCapacity); - }, + var maxRad = (360 * Math.PI) / 180; - /** - * Resizes the properties used to describe the viewport. - * - * This method is called automatically by the renderer during its resize handler. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#resize - * @fires Phaser.Renderer.WebGL.Pipelines.Events#RESIZE - * @since 3.0.0 - * - * @param {number} width - The new width of this WebGL Pipeline. - * @param {number} height - The new height of this WebGL Pipeline. - * - * @return {this} This WebGLPipeline instance. - */ - resize: function (width, height) - { - if (width !== this.width || height !== this.height) + tmpDestination = tmpDestination - (Math.floor(tmpDestination / maxRad) * maxRad); + + var cam = this.camera; + + if (!force && this.isRunning) { - this.flush(); + return cam; } - this.width = width; - this.height = height; + this.isRunning = true; + this.duration = duration; + this.progress = 0; - var targets = this.renderTargets; + // Starting from + this.source = cam.rotation; - for (var i = 0; i < targets.length; i++) + // Destination + this.destination = tmpDestination; + + // Using this ease + if (typeof ease === 'string' && EaseMap.hasOwnProperty(ease)) { - targets[i].resize(width, height); + this.ease = EaseMap[ease]; + } + else if (typeof ease === 'function') + { + this.ease = ease; } - this.setProjectionMatrix(width, height); + this._elapsed = 0; - this.emit(Events.RESIZE, width, height, this); + this._onUpdate = callback; + this._onUpdateScope = context; - this.onResize(width, height); - return this; + if (this.shortestPath) + { + // The shortest path is true so calculate the quickest direction + var cwDist = 0; + var acwDist = 0; + + if (this.destination > this.source) + { + cwDist = Math.abs(this.destination - this.source); + } + else + { + cwDist = (Math.abs(this.destination + maxRad) - this.source); + } + + if (this.source > this.destination) + { + acwDist = Math.abs(this.source - this.destination); + } + else + { + acwDist = (Math.abs(this.source + maxRad) - this.destination); + } + + if (cwDist < acwDist) + { + this.clockwise = true; + } + else if (cwDist > acwDist) + { + this.clockwise = false; + } + } + + this.camera.emit(Events.ROTATE_START, this.camera, this, duration, tmpDestination); + + return cam; }, /** - * Adjusts this pipelines ortho Projection Matrix to use the given dimensions - * and resets the `uProjectionMatrix` uniform on all bound shaders. - * - * This method is called automatically by the renderer during its resize handler. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setProjectionMatrix - * @since 3.50.0 + * The main update loop for this effect. Called automatically by the Camera. * - * @param {number} width - The new width of this WebGL Pipeline. - * @param {number} height - The new height of this WebGL Pipeline. + * @method Phaser.Cameras.Scene2D.Effects.RotateTo#update + * @since 3.23.0 * - * @return {this} This WebGLPipeline instance. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - setProjectionMatrix: function (width, height) + update: function (time, delta) { - var projectionMatrix = this.projectionMatrix; - - // Because not all pipelines have them - if (!projectionMatrix) + if (!this.isRunning) { - return this; + return; } - this.projectionWidth = width; - this.projectionHeight = height; + this._elapsed += delta; - projectionMatrix.ortho(0, width, height, 0, -1000, 1000); + var progress = Clamp(this._elapsed / this.duration, 0, 1); - var shaders = this.shaders; + this.progress = progress; - var name = 'uProjectionMatrix'; + var cam = this.camera; - for (var i = 0; i < shaders.length; i++) + if (this._elapsed < this.duration) { - var shader = shaders[i]; + var v = this.ease(progress); - if (shader.hasUniform(name)) + this.current = cam.rotation; + var distance = 0; + var maxRad = (360 * Math.PI) / 180; + var target = this.destination; + var current = this.current; + + if (this.clockwise === false) { - shader.resetUniform(name); + target = this.current; + current = this.destination; + } - shader.setMatrix4fv(name, false, projectionMatrix.val, shader); + if (target >= current) + { + distance = Math.abs(target - current); + } + else + { + distance = (Math.abs(target + maxRad) - current); } - } - return this; - }, + var r = 0; - /** - * Adjusts this pipelines ortho Projection Matrix to match that of the global - * WebGL Renderer Projection Matrix. - * - * This method is called automatically by the Pipeline Manager when this - * pipeline is set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#updateProjectionMatrix - * @since 3.50.0 - */ - updateProjectionMatrix: function () - { - if (this.projectionMatrix) + if (this.clockwise) + { + r = (cam.rotation + (distance * v)); + } + else + { + r = (cam.rotation - (distance * v)); + } + + cam.rotation = r; + + if (this._onUpdate) + { + this._onUpdate.call(this._onUpdateScope, cam, progress, r); + } + } + else { - var globalWidth = this.renderer.projectionWidth; - var globalHeight = this.renderer.projectionHeight; + cam.rotation = this.destination; - if (this.projectionWidth !== globalWidth || this.projectionHeight !== globalHeight) + if (this._onUpdate) { - this.setProjectionMatrix(globalWidth, globalHeight); + this._onUpdate.call(this._onUpdateScope, cam, progress, this.destination); } + + this.effectComplete(); } }, /** - * This method is called every time the Pipeline Manager makes this pipeline the currently active one. - * - * It binds the resources and shader needed for this pipeline, including setting the vertex buffer - * and attribute pointers. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#bind - * @fires Phaser.Renderer.WebGL.Pipelines.Events#BIND - * @since 3.0.0 - * - * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. + * Called internally when the effect completes. * - * @return {this} This WebGLPipeline instance. + * @method Phaser.Cameras.Scene2D.Effects.RotateTo#effectComplete + * @since 3.23.0 */ - bind: function (currentShader) + effectComplete: function () { - if (currentShader === undefined) { currentShader = this.currentShader; } - - if (this.glReset) - { - return this.rebind(currentShader); - } - - var wasBound = this.setVertexBuffer(); - - currentShader.bind(wasBound); + this._onUpdate = null; + this._onUpdateScope = null; - this.currentShader = currentShader; + this.isRunning = false; - this.emit(Events.BIND, this, currentShader); + this.camera.emit(Events.ROTATE_COMPLETE, this.camera, this); + }, - this.onActive(currentShader); + /** + * Resets this camera effect. + * If it was previously running, it stops instantly without calling its onComplete callback or emitting an event. + * + * @method Phaser.Cameras.Scene2D.Effects.RotateTo#reset + * @since 3.23.0 + */ + reset: function () + { + this.isRunning = false; - return this; + this._onUpdate = null; + this._onUpdateScope = null; }, /** - * This method is called every time the Pipeline Manager rebinds this pipeline. - * - * It resets all shaders this pipeline uses, setting their attributes again. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#rebind - * @fires Phaser.Renderer.WebGL.Pipelines.Events#REBIND - * @since 3.0.0 - * - * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. + * Destroys this effect, releasing it from the Camera. * - * @return {this} This WebGLPipeline instance. + * @method Phaser.Cameras.Scene2D.Effects.RotateTo#destroy + * @since 3.23.0 */ - rebind: function (currentShader) + destroy: function () { - this.setVertexBuffer(); + this.reset(); - var shaders = this.shaders; + this.camera = null; + this.source = null; + this.destination = null; + } - // Loop in reverse, so the first shader in the array is left as being bound - for (var i = shaders.length - 1; i >= 0; i--) - { - var shader = shaders[i].rebind(); +}); - if (!currentShader || shader === currentShader) - { - this.currentShader = shader; - } - } +module.exports = RotateTo; - this.emit(Events.REBIND, this.currentShader); - this.onActive(this.currentShader); +/***/ }), - this.onRebind(); +/***/ 3241: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.glReset = false; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(89787); +var Vector2 = __webpack_require__(93736); - /** - * Binds the vertex buffer to be the active ARRAY_BUFFER on the WebGL context. - * - * It first checks to see if it's already set as the active buffer and only - * binds itself if not. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setVertexBuffer - * @since 3.50.0 - * - * @return {boolean} `true` if the vertex buffer was bound, or `false` if it was already bound. - */ - setVertexBuffer: function () +/** + * @classdesc + * A Camera Shake effect. + * + * This effect will shake the camera viewport by a random amount, bounded by the specified intensity, each frame. + * + * Only the camera viewport is moved. None of the objects it is displaying are impacted, i.e. their positions do + * not change. + * + * The effect will dispatch several events on the Camera itself and you can also specify an `onUpdate` callback, + * which is invoked each frame for the duration of the effect if required. + * + * @class Shake + * @memberof Phaser.Cameras.Scene2D.Effects + * @constructor + * @since 3.5.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera this effect is acting upon. + */ +var Shake = new Class({ + + initialize: + + function Shake (camera) { - var gl = this.gl; - var buffer = this.vertexBuffer; + /** + * The Camera this effect belongs to. + * + * @name Phaser.Cameras.Scene2D.Effects.Shake#camera + * @type {Phaser.Cameras.Scene2D.Camera} + * @readonly + * @since 3.5.0 + */ + this.camera = camera; - if (gl.getParameter(gl.ARRAY_BUFFER_BINDING) !== buffer) - { - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + /** + * Is this effect actively running? + * + * @name Phaser.Cameras.Scene2D.Effects.Shake#isRunning + * @type {boolean} + * @readonly + * @default false + * @since 3.5.0 + */ + this.isRunning = false; - return true; - } + /** + * The duration of the effect, in milliseconds. + * + * @name Phaser.Cameras.Scene2D.Effects.Shake#duration + * @type {number} + * @readonly + * @default 0 + * @since 3.5.0 + */ + this.duration = 0; - return false; + /** + * The intensity of the effect. Use small float values. The default when the effect starts is 0.05. + * This is a Vector2 object, allowing you to control the shake intensity independently across x and y. + * You can modify this value while the effect is active to create more varied shake effects. + * + * @name Phaser.Cameras.Scene2D.Effects.Shake#intensity + * @type {Phaser.Math.Vector2} + * @since 3.5.0 + */ + this.intensity = new Vector2(); + + /** + * If this effect is running this holds the current percentage of the progress, a value between 0 and 1. + * + * @name Phaser.Cameras.Scene2D.Effects.Shake#progress + * @type {number} + * @since 3.5.0 + */ + this.progress = 0; + + /** + * Effect elapsed timer. + * + * @name Phaser.Cameras.Scene2D.Effects.Shake#_elapsed + * @type {number} + * @private + * @since 3.5.0 + */ + this._elapsed = 0; + + /** + * How much to offset the camera by horizontally. + * + * @name Phaser.Cameras.Scene2D.Effects.Shake#_offsetX + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._offsetX = 0; + + /** + * How much to offset the camera by vertically. + * + * @name Phaser.Cameras.Scene2D.Effects.Shake#_offsetY + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._offsetY = 0; + + /** + * This callback is invoked every frame for the duration of the effect. + * + * @name Phaser.Cameras.Scene2D.Effects.Shake#_onUpdate + * @type {?Phaser.Types.Cameras.Scene2D.CameraShakeCallback} + * @private + * @default null + * @since 3.5.0 + */ + this._onUpdate; + + /** + * On Complete callback scope. + * + * @name Phaser.Cameras.Scene2D.Effects.Shake#_onUpdateScope + * @type {any} + * @private + * @since 3.5.0 + */ + this._onUpdateScope; }, /** - * This method is called as a result of the `WebGLPipeline.batchQuad` method, right before a quad - * belonging to a Game Object is about to be added to the batch. When this is called, the - * renderer has just performed a flush. It will bind the current render target, if any are set - * and finally call the `onPreBatch` hook. + * Shakes the Camera by the given intensity over the duration specified. * - * @method Phaser.Renderer.WebGL.WebGLPipeline#preBatch - * @since 3.50.0 + * @method Phaser.Cameras.Scene2D.Effects.Shake#start + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_START + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE + * @since 3.5.0 * - * @param {(Phaser.GameObjects.GameObject|Phaser.Cameras.Scene2D.Camera)} [gameObject] - The Game Object or Camera that invoked this pipeline, if any. + * @param {number} [duration=100] - The duration of the effect in milliseconds. + * @param {(number|Phaser.Math.Vector2)} [intensity=0.05] - The intensity of the shake. + * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. + * @param {Phaser.Types.Cameras.Scene2D.CameraShakeCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. * - * @return {this} This WebGLPipeline instance. + * @return {Phaser.Cameras.Scene2D.Camera} The Camera on which the effect was started. */ - preBatch: function (gameObject) + start: function (duration, intensity, force, callback, context) { - if (this.currentRenderTarget) + if (duration === undefined) { duration = 100; } + if (intensity === undefined) { intensity = 0.05; } + if (force === undefined) { force = false; } + if (callback === undefined) { callback = null; } + if (context === undefined) { context = this.camera.scene; } + + if (!force && this.isRunning) { - this.currentRenderTarget.bind(); + return this.camera; } - this.onPreBatch(gameObject); + this.isRunning = true; + this.duration = duration; + this.progress = 0; - return this; - }, + if (typeof intensity === 'number') + { + this.intensity.set(intensity); + } + else + { + this.intensity.set(intensity.x, intensity.y); + } - /** - * This method is called as a result of the `WebGLPipeline.batchQuad` method, right after a quad - * belonging to a Game Object has been added to the batch. When this is called, the - * renderer has just performed a flush. - * - * It calls the `onDraw` hook followed by the `onPostBatch` hook, which can be used to perform - * additional Post FX Pipeline processing. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#postBatch - * @since 3.50.0 - * - * @param {(Phaser.GameObjects.GameObject|Phaser.Cameras.Scene2D.Camera)} [gameObject] - The Game Object or Camera that invoked this pipeline, if any. - * - * @return {this} This WebGLPipeline instance. - */ - postBatch: function (gameObject) - { - this.onDraw(this.currentRenderTarget); + this._elapsed = 0; + this._offsetX = 0; + this._offsetY = 0; - this.onPostBatch(gameObject); + this._onUpdate = callback; + this._onUpdateScope = context; - return this; - }, + this.camera.emit(Events.SHAKE_START, this.camera, this, duration, intensity); - /** - * This method is only used by Post FX Pipelines and those that extend from them. - * - * This method is called every time the `postBatch` method is called and is passed a - * reference to the current render target. - * - * At the very least a Post FX Pipeline should call `this.bindAndDraw(renderTarget)`, - * however, you can do as much additional processing as you like in this method if - * you override it from within your own pipelines. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onDraw - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.RenderTarget} renderTarget - The Render Target. - */ - onDraw: function () - { + return this.camera; }, /** - * This method is called every time the Pipeline Manager deactivates this pipeline, swapping from - * it to another one. This happens after a call to `flush` and before the new pipeline is bound. + * The pre-render step for this effect. Called automatically by the Camera. * - * @method Phaser.Renderer.WebGL.WebGLPipeline#unbind - * @since 3.50.0 + * @method Phaser.Cameras.Scene2D.Effects.Shake#preRender + * @since 3.5.0 */ - unbind: function () + preRender: function () { - if (this.currentRenderTarget) + if (this.isRunning) { - this.currentRenderTarget.unbind(); + this.camera.matrix.translate(this._offsetX, this._offsetY); } }, /** - * Uploads the vertex data and emits a draw call for the current batch of vertices. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#flush - * @fires Phaser.Renderer.WebGL.Pipelines.Events#BEFORE_FLUSH - * @fires Phaser.Renderer.WebGL.Pipelines.Events#AFTER_FLUSH - * @since 3.0.0 + * The main update loop for this effect. Called automatically by the Camera. * - * @param {boolean} [isPostFlush=false] - Was this flush invoked as part of a post-process, or not? + * @method Phaser.Cameras.Scene2D.Effects.Shake#update + * @since 3.5.0 * - * @return {this} This WebGLPipeline instance. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - flush: function (isPostFlush) + update: function (time, delta) { - if (isPostFlush === undefined) { isPostFlush = false; } - - if (this.vertexCount > 0) + if (!this.isRunning) { - this.emit(Events.BEFORE_FLUSH, this, isPostFlush); - - this.onBeforeFlush(isPostFlush); - - var gl = this.gl; - var vertexCount = this.vertexCount; - var vertexSize = this.currentShader.vertexSize; + return; + } - if (this.active) - { - this.setVertexBuffer(); + this._elapsed += delta; - if (vertexCount === this.vertexCapacity) - { - gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.DYNAMIC_DRAW); - } - else - { - gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); - } + this.progress = Clamp(this._elapsed / this.duration, 0, 1); - gl.drawArrays(this.topology, 0, vertexCount); - } + if (this._onUpdate) + { + this._onUpdate.call(this._onUpdateScope, this.camera, this.progress); + } - this.vertexCount = 0; + if (this._elapsed < this.duration) + { + var intensity = this.intensity; + var width = this.camera.width; + var height = this.camera.height; + var zoom = this.camera.zoom; - this.emit(Events.AFTER_FLUSH, this, isPostFlush); + this._offsetX = (Math.random() * intensity.x * width * 2 - intensity.x * width) * zoom; + this._offsetY = (Math.random() * intensity.y * height * 2 - intensity.y * height) * zoom; - this.onAfterFlush(isPostFlush); + if (this.camera.roundPixels) + { + this._offsetX = Math.round(this._offsetX); + this._offsetY = Math.round(this._offsetY); + } + } + else + { + this.effectComplete(); } - - return this; }, /** - * By default this is an empty method hook that you can override and use in your own custom pipelines. - * - * This method is called every time the Pipeline Manager makes this the active pipeline. It is called - * at the end of the `WebGLPipeline.bind` method, after the current shader has been set. The current - * shader is passed to this hook. - * - * For example, if a display list has 3 Sprites in it that all use the same pipeline, this hook will - * only be called for the first one, as the 2nd and 3rd Sprites do not cause the pipeline to be changed. - * - * If you need to listen for that event instead, use the `onBind` hook. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onActive - * @since 3.50.0 + * Called internally when the effect completes. * - * @param {Phaser.Renderer.WebGL.WebGLShader} currentShader - The shader that was set as current. + * @method Phaser.Cameras.Scene2D.Effects.Shake#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE + * @since 3.5.0 */ - onActive: function () + effectComplete: function () { - }, + this._offsetX = 0; + this._offsetY = 0; - /** - * By default this is an empty method hook that you can override and use in your own custom pipelines. - * - * This method is called every time a **Game Object** asks the Pipeline Manager to use this pipeline, - * even if the pipeline is already active. - * - * Unlike the `onActive` method, which is only called when the Pipeline Manager makes this pipeline - * active, this hook is called for every Game Object that requests use of this pipeline, allowing you to - * perform per-object set-up, such as loading shader uniform data. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. - */ - onBind: function () - { - }, + this._onUpdate = null; + this._onUpdateScope = null; - /** - * By default this is an empty method hook that you can override and use in your own custom pipelines. - * - * This method is called when the Pipeline Manager needs to rebind this pipeline. This happens after a - * pipeline has been cleared, usually when passing control over to a 3rd party WebGL library, like Spine, - * and then returing to Phaser again. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onRebind - * @since 3.50.0 - */ - onRebind: function () - { - }, + this.isRunning = false; - /** - * By default this is an empty method hook that you can override and use in your own custom pipelines. - * - * This method is called every time the `batchQuad` or `batchTri` methods are called. If this was - * as a result of a Game Object, then the Game Object reference is passed to this hook too. - * - * This hook is called _after_ the quad (or tri) has been added to the batch, so you can safely - * call 'flush' from within this. - * - * Note that Game Objects may call `batchQuad` or `batchTri` multiple times for a single draw, - * for example the Graphics Game Object. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onBatch - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. - */ - onBatch: function () - { + this.camera.emit(Events.SHAKE_COMPLETE, this.camera, this); }, /** - * By default this is an empty method hook that you can override and use in your own custom pipelines. - * - * This method is called immediately before a **Game Object** is about to add itself to the batch. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreBatch - * @since 3.50.0 + * Resets this camera effect. + * If it was previously running, it stops instantly without calling its onComplete callback or emitting an event. * - * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + * @method Phaser.Cameras.Scene2D.Effects.Shake#reset + * @since 3.5.0 */ - onPreBatch: function () + reset: function () { - }, + this.isRunning = false; - /** - * By default this is an empty method hook that you can override and use in your own custom pipelines. - * - * This method is called immediately after a **Game Object** has been added to the batch. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostBatch - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. - */ - onPostBatch: function () - { + this._offsetX = 0; + this._offsetY = 0; + + this._onUpdate = null; + this._onUpdateScope = null; }, /** - * By default this is an empty method hook that you can override and use in your own custom pipelines. - * - * This method is called once per frame, right before anything has been rendered, but after the canvas - * has been cleared. If this pipeline has a render target, it will also have been cleared by this point. + * Destroys this effect, releasing it from the Camera. * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender - * @since 3.50.0 + * @method Phaser.Cameras.Scene2D.Effects.Shake#destroy + * @since 3.5.0 */ - onPreRender: function () + destroy: function () { - }, + this.reset(); - /** - * By default this is an empty method hook that you can override and use in your own custom pipelines. - * - * This method is called _once per frame_, by every Camera in a Scene that wants to render. - * - * It is called at the start of the rendering process, before anything has been drawn to the Camera. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender - * @since 3.50.0 - * - * @param {Phaser.Scene} scene - The Scene being rendered. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. - */ - onRender: function () - { - }, - - /** - * By default this is an empty method hook that you can override and use in your own custom pipelines. - * - * This method is called _once per frame_, after all rendering has happened and snapshots have been taken. - * - * It is called at the very end of the rendering process, once all Cameras, for all Scenes, have - * been rendered. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender - * @since 3.50.0 - */ - onPostRender: function () - { - }, - - /** - * By default this is an empty method hook that you can override and use in your own custom pipelines. - * - * This method is called every time this pipeline is asked to flush its batch. - * - * It is called immediately before the `gl.bufferData` and `gl.drawArrays` calls are made, so you can - * perform any final pre-render modifications. To apply changes post-render, see `onAfterFlush`. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onBeforeFlush - * @since 3.50.0 - * - * @param {boolean} [isPostFlush=false] - Was this flush invoked as part of a post-process, or not? - */ - onBeforeFlush: function () - { - }, - - /** - * By default this is an empty method hook that you can override and use in your own custom pipelines. - * - * This method is called immediately after this pipeline has finished flushing its batch. - * - * It is called after the `gl.drawArrays` call. - * - * You can perform additional post-render effects, but be careful not to call `flush` - * on this pipeline from within this method, or you'll cause an infinite loop. - * - * To apply changes pre-render, see `onBeforeFlush`. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#onAfterFlush - * @since 3.50.0 - * - * @param {boolean} [isPostFlush=false] - Was this flush invoked as part of a post-process, or not? - */ - onAfterFlush: function () - { - }, - - /** - * Adds a single vertex to the current vertex buffer and increments the - * `vertexCount` property by 1. - * - * This method is called directly by `batchTri` and `batchQuad`. - * - * It does not perform any batch limit checking itself, so if you need to call - * this method directly, do so in the same way that `batchQuad` does, for example. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#batchVert - * @since 3.50.0 - * - * @param {number} x - The vertex x position. - * @param {number} y - The vertex y position. - * @param {number} u - UV u value. - * @param {number} v - UV v value. - * @param {number} unit - Texture unit to which the texture needs to be bound. - * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. - * @param {number} tint - The tint color value. - */ - batchVert: function (x, y, u, v, unit, tintEffect, tint) - { - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; + this.camera = null; + this.intensity = null; + } - var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; +}); - vertexViewF32[++vertexOffset] = x; - vertexViewF32[++vertexOffset] = y; - vertexViewF32[++vertexOffset] = u; - vertexViewF32[++vertexOffset] = v; - vertexViewF32[++vertexOffset] = unit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = tint; +module.exports = Shake; - this.vertexCount++; - }, - /** - * Adds the vertices data into the batch and flushes if full. - * - * Assumes 6 vertices in the following arrangement: - * - * ``` - * 0----3 - * |\ B| - * | \ | - * | \ | - * | A \| - * | \ - * 1----2 - * ``` - * - * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3 - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#batchQuad - * @since 3.50.0 - * - * @param {(Phaser.GameObjects.GameObject|null)} gameObject - The Game Object, if any, drawing this quad. - * @param {number} x0 - The top-left x position. - * @param {number} y0 - The top-left y position. - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} u0 - UV u0 value. - * @param {number} v0 - UV v0 value. - * @param {number} u1 - UV u1 value. - * @param {number} v1 - UV v1 value. - * @param {number} tintTL - The top-left tint color value. - * @param {number} tintTR - The top-right tint color value. - * @param {number} tintBL - The bottom-left tint color value. - * @param {number} tintBR - The bottom-right tint color value. - * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. - * @param {number} [unit=0] - Texture unit to which the texture needs to be bound. - * - * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. - */ - batchQuad: function (gameObject, x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit) - { - if (unit === undefined) { unit = this.currentUnit; } +/***/ }), - var hasFlushed = false; +/***/ 13383: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (this.shouldFlush(6)) - { - this.flush(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - hasFlushed = true; +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var EaseMap = __webpack_require__(35060); +var Events = __webpack_require__(89787); - unit = this.setTexture2D(texture); - } +/** + * @classdesc + * A Camera Zoom effect. + * + * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. + * + * The effect will dispatch several events on the Camera itself and you can also specify an `onUpdate` callback, + * which is invoked each frame for the duration of the effect if required. + * + * @class Zoom + * @memberof Phaser.Cameras.Scene2D.Effects + * @constructor + * @since 3.11.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera this effect is acting upon. + */ +var Zoom = new Class({ - this.batchVert(x0, y0, u0, v0, unit, tintEffect, tintTL); - this.batchVert(x1, y1, u0, v1, unit, tintEffect, tintBL); - this.batchVert(x2, y2, u1, v1, unit, tintEffect, tintBR); - this.batchVert(x0, y0, u0, v0, unit, tintEffect, tintTL); - this.batchVert(x2, y2, u1, v1, unit, tintEffect, tintBR); - this.batchVert(x3, y3, u1, v0, unit, tintEffect, tintTR); + initialize: - this.onBatch(gameObject); + function Zoom (camera) + { + /** + * The Camera this effect belongs to. + * + * @name Phaser.Cameras.Scene2D.Effects.Zoom#camera + * @type {Phaser.Cameras.Scene2D.Camera} + * @readonly + * @since 3.11.0 + */ + this.camera = camera; - return hasFlushed; - }, + /** + * Is this effect actively running? + * + * @name Phaser.Cameras.Scene2D.Effects.Zoom#isRunning + * @type {boolean} + * @readonly + * @default false + * @since 3.11.0 + */ + this.isRunning = false; - /** - * Adds the vertices data into the batch and flushes if full. - * - * Assumes 3 vertices in the following arrangement: - * - * ``` - * 0 - * |\ - * | \ - * | \ - * | \ - * | \ - * 1-----2 - * ``` - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#batchTri - * @since 3.50.0 - * - * @param {(Phaser.GameObjects.GameObject|null)} gameObject - The Game Object, if any, drawing this quad. - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} u0 - UV u0 value. - * @param {number} v0 - UV v0 value. - * @param {number} u1 - UV u1 value. - * @param {number} v1 - UV v1 value. - * @param {number} tintTL - The top-left tint color value. - * @param {number} tintTR - The top-right tint color value. - * @param {number} tintBL - The bottom-left tint color value. - * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. - * @param {number} [unit=0] - Texture unit to which the texture needs to be bound. - * - * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. - */ - batchTri: function (gameObject, x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect, texture, unit) - { - if (unit === undefined) { unit = this.currentUnit; } + /** + * The duration of the effect, in milliseconds. + * + * @name Phaser.Cameras.Scene2D.Effects.Zoom#duration + * @type {number} + * @readonly + * @default 0 + * @since 3.11.0 + */ + this.duration = 0; - var hasFlushed = false; + /** + * The starting zoom value; + * + * @name Phaser.Cameras.Scene2D.Effects.Zoom#source + * @type {number} + * @since 3.11.0 + */ + this.source = 1; - if (this.shouldFlush(3)) - { - this.flush(); + /** + * The destination zoom value. + * + * @name Phaser.Cameras.Scene2D.Effects.Zoom#destination + * @type {number} + * @since 3.11.0 + */ + this.destination = 1; - hasFlushed = true; + /** + * The ease function to use during the zoom. + * + * @name Phaser.Cameras.Scene2D.Effects.Zoom#ease + * @type {function} + * @since 3.11.0 + */ + this.ease; - unit = this.setTexture2D(texture); - } + /** + * If this effect is running this holds the current percentage of the progress, a value between 0 and 1. + * + * @name Phaser.Cameras.Scene2D.Effects.Zoom#progress + * @type {number} + * @since 3.11.0 + */ + this.progress = 0; - this.batchVert(x0, y0, u0, v0, unit, tintEffect, tintTL); - this.batchVert(x1, y1, u0, v1, unit, tintEffect, tintTR); - this.batchVert(x2, y2, u1, v1, unit, tintEffect, tintBL); + /** + * Effect elapsed timer. + * + * @name Phaser.Cameras.Scene2D.Effects.Zoom#_elapsed + * @type {number} + * @private + * @since 3.11.0 + */ + this._elapsed = 0; - this.onBatch(gameObject); + /** + * This callback is invoked every frame for the duration of the effect. + * + * @name Phaser.Cameras.Scene2D.Effects.Zoom#_onUpdate + * @type {?Phaser.Types.Cameras.Scene2D.CameraZoomCallback} + * @private + * @default null + * @since 3.11.0 + */ + this._onUpdate; - return hasFlushed; + /** + * On Complete callback scope. + * + * @name Phaser.Cameras.Scene2D.Effects.Zoom#_onUpdateScope + * @type {any} + * @private + * @since 3.11.0 + */ + this._onUpdateScope; }, /** - * Pushes a filled rectangle into the vertex batch. - * - * The dimensions are run through `Math.floor` before the quad is generated. - * - * Rectangle has no transform values and isn't transformed into the local space. + * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. * - * Used for directly batching untransformed rectangles, such as Camera background colors. + * @method Phaser.Cameras.Scene2D.Effects.Zoom#start + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_START + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE + * @since 3.11.0 * - * @method Phaser.Renderer.WebGL.WebGLPipeline#drawFillRect - * @since 3.50.0 + * @param {number} zoom - The target Camera zoom value. + * @param {number} [duration=1000] - The duration of the effect in milliseconds. + * @param {(string|function)} [ease='Linear'] - The ease to use for the Zoom. Can be any of the Phaser Easing constants or a custom function. + * @param {boolean} [force=false] - Force the zoom effect to start immediately, even if already running. + * @param {Phaser.Types.Cameras.Scene2D.CameraZoomCallback} [callback] - This callback will be invoked every frame for the duration of the effect. + * It is sent three arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, + * and the current camera zoom value. + * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. * - * @param {number} x - Horizontal top left coordinate of the rectangle. - * @param {number} y - Vertical top left coordinate of the rectangle. - * @param {number} width - Width of the rectangle. - * @param {number} height - Height of the rectangle. - * @param {number} color - Color of the rectangle to draw. - * @param {number} alpha - Alpha value of the rectangle to draw. - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. - * @param {boolean} [flipUV=true] - Flip the vertical UV coordinates of the texture before rendering? + * @return {Phaser.Cameras.Scene2D.Camera} The Camera on which the effect was started. */ - drawFillRect: function (x, y, width, height, color, alpha, texture, flipUV) + start: function (zoom, duration, ease, force, callback, context) { - if (texture === undefined) { texture = this.renderer.whiteTexture.glTexture; } - if (flipUV === undefined) { flipUV = true; } + if (duration === undefined) { duration = 1000; } + if (ease === undefined) { ease = EaseMap.Linear; } + if (force === undefined) { force = false; } + if (callback === undefined) { callback = null; } + if (context === undefined) { context = this.camera.scene; } - x = Math.floor(x); - y = Math.floor(y); + var cam = this.camera; - var xw = Math.floor(x + width); - var yh = Math.floor(y + height); + if (!force && this.isRunning) + { + return cam; + } - var unit = this.setTexture2D(texture); + this.isRunning = true; + this.duration = duration; + this.progress = 0; - var tint = Utils.getTintAppendFloatAlphaAndSwap(color, alpha); + // Starting from + this.source = cam.zoom; - var u0 = 0; - var v0 = 0; - var u1 = 1; - var v1 = 1; + // Zooming to + this.destination = zoom; - if (flipUV) + // Using this ease + if (typeof ease === 'string' && EaseMap.hasOwnProperty(ease)) { - v0 = 1; - v1 = 0; + this.ease = EaseMap[ease]; + } + else if (typeof ease === 'function') + { + this.ease = ease; } - this.batchQuad(null, x, y, x, yh, xw, yh, xw, y, u0, v0, u1, v1, tint, tint, tint, tint, 0, texture, unit); - }, + this._elapsed = 0; - /** - * Sets the texture to be bound to the next available texture unit and returns - * the unit id. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setTexture2D - * @since 3.50.0 - * - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses `whiteTexture`. - * - * @return {number} The assigned texture unit. - */ - setTexture2D: function (texture) - { - if (texture === undefined) { texture = this.renderer.whiteTexture.glTexture; } + this._onUpdate = callback; + this._onUpdateScope = context; - this.currentUnit = this.renderer.setTexture2D(texture); + this.camera.emit(Events.ZOOM_START, this.camera, this, duration, zoom); - return this.currentUnit; + return cam; }, /** - * Activates the given WebGL Texture and binds it to the requested texture slot. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#bindTexture - * @since 3.50.0 + * The main update loop for this effect. Called automatically by the Camera. * - * @param {WebGLTexture} [target] - The WebGLTexture to activate and bind. - * @param {number} [unit=0] - The WebGL texture ID to activate. Defaults to `gl.TEXTURE0`. + * @method Phaser.Cameras.Scene2D.Effects.Zoom#update + * @since 3.11.0 * - * @return {this} This WebGL Pipeline instance. + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - bindTexture: function (texture, unit) + update: function (time, delta) { - if (unit === undefined) { unit = 0; } - - var gl = this.gl; + if (!this.isRunning) + { + return; + } - gl.activeTexture(gl.TEXTURE0 + unit); + this._elapsed += delta; - gl.bindTexture(gl.TEXTURE_2D, texture); + this.progress = Clamp(this._elapsed / this.duration, 0, 1); - return this; - }, + if (this._elapsed < this.duration) + { + this.camera.zoom = this.source + ((this.destination - this.source) * this.ease(this.progress)); - /** - * Activates the given Render Target texture and binds it to the - * requested WebGL texture slot. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#bindRenderTarget - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The Render Target to activate and bind. - * @param {number} [unit=0] - The WebGL texture ID to activate. Defaults to `gl.TEXTURE0`. - * - * @return {this} This WebGL Pipeline instance. - */ - bindRenderTarget: function (target, unit) - { - return this.bindTexture(target.texture, unit); - }, + if (this._onUpdate) + { + this._onUpdate.call(this._onUpdateScope, this.camera, this.progress, this.camera.zoom); + } + } + else + { + this.camera.zoom = this.destination; - /** - * Sets the current duration into a 1f uniform value based on the given name. - * - * This can be used for mapping time uniform values, such as `iTime`. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setTime - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * - * @return {this} This WebGLPipeline instance. - */ - setTime: function (uniform) - { - this.set1f(uniform, this.game.loop.getDuration()); + if (this._onUpdate) + { + this._onUpdate.call(this._onUpdateScope, this.camera, this.progress, this.destination); + } - return this; + this.effectComplete(); + } }, /** - * Sets a 1f uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set1f - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number} x - The new value of the `float` uniform. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * Called internally when the effect completes. * - * @return {this} This WebGLPipeline instance. + * @method Phaser.Cameras.Scene2D.Effects.Zoom#effectComplete + * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE + * @since 3.11.0 */ - set1f: function (name, x, shader) + effectComplete: function () { - if (shader === undefined) { shader = this.currentShader; } + this._onUpdate = null; + this._onUpdateScope = null; - shader.set1f(name, x); + this.isRunning = false; - return this; + this.camera.emit(Events.ZOOM_COMPLETE, this.camera, this); }, /** - * Sets a 2f uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set2f - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number} x - The new X component of the `vec2` uniform. - * @param {number} y - The new Y component of the `vec2` uniform. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * Resets this camera effect. + * If it was previously running, it stops instantly without calling its onComplete callback or emitting an event. * - * @return {this} This WebGLPipeline instance. + * @method Phaser.Cameras.Scene2D.Effects.Zoom#reset + * @since 3.11.0 */ - set2f: function (name, x, y, shader) + reset: function () { - if (shader === undefined) { shader = this.currentShader; } - - shader.set2f(name, x, y); + this.isRunning = false; - return this; + this._onUpdate = null; + this._onUpdateScope = null; }, /** - * Sets a 3f uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set3f - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number} x - The new X component of the `vec3` uniform. - * @param {number} y - The new Y component of the `vec3` uniform. - * @param {number} z - The new Z component of the `vec3` uniform. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * Destroys this effect, releasing it from the Camera. * - * @return {this} This WebGLPipeline instance. + * @method Phaser.Cameras.Scene2D.Effects.Zoom#destroy + * @since 3.11.0 */ - set3f: function (name, x, y, z, shader) + destroy: function () { - if (shader === undefined) { shader = this.currentShader; } - - shader.set3f(name, x, y, z); + this.reset(); - return this; - }, + this.camera = null; + } - /** - * Sets a 4f uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set4f - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number} x - X component of the uniform - * @param {number} y - Y component of the uniform - * @param {number} z - Z component of the uniform - * @param {number} w - W component of the uniform - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set4f: function (name, x, y, z, w, shader) - { - if (shader === undefined) { shader = this.currentShader; } +}); - shader.set4f(name, x, y, z, w); +module.exports = Zoom; - return this; - }, - /** - * Sets a 1fv uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set1fv - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set1fv: function (name, arr, shader) - { - if (shader === undefined) { shader = this.currentShader; } +/***/ }), - shader.set1fv(name, arr); +/***/ 53030: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets a 2fv uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set2fv - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set2fv: function (name, arr, shader) - { - if (shader === undefined) { shader = this.currentShader; } +/** + * @namespace Phaser.Cameras.Scene2D.Effects + */ - shader.set2fv(name, arr); +module.exports = { - return this; - }, + Fade: __webpack_require__(92522), + Flash: __webpack_require__(22151), + Pan: __webpack_require__(37551), + Shake: __webpack_require__(3241), + RotateTo: __webpack_require__(1771), + Zoom: __webpack_require__(13383) - /** - * Sets a 3fv uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set3fv - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set3fv: function (name, arr, shader) - { - if (shader === undefined) { shader = this.currentShader; } +}; - shader.set3fv(name, arr); - return this; - }, +/***/ }), - /** - * Sets a 4fv uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set4fv - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set4fv: function (name, arr, shader) - { - if (shader === undefined) { shader = this.currentShader; } +/***/ 39577: +/***/ ((module) => { - shader.set4fv(name, arr); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +/** + * The Destroy Camera Event. + * + * This event is dispatched by a Camera instance when it is destroyed by the Camera Manager. + * + * Listen for it via either of the following: + * + * ```js + * this.cameras.main.on('cameradestroy', () => {}); + * ``` + * + * or use the constant, to avoid having to remember the correct event string: + * + * ```js + * this.cameras.main.on(Phaser.Cameras.Scene2D.Events.DESTROY, () => {}); + * ``` + * + * @event Phaser.Cameras.Scene2D.Events#DESTROY + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that was destroyed. + */ +module.exports = 'cameradestroy'; - /** - * Sets a 1iv uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set1iv - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set1iv: function (name, arr, shader) - { - if (shader === undefined) { shader = this.currentShader; } - shader.set1iv(name, arr); +/***/ }), - return this; - }, +/***/ 85373: +/***/ ((module) => { - /** - * Sets a 2iv uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set2iv - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set2iv: function (name, arr, shader) - { - if (shader === undefined) { shader = this.currentShader; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - shader.set2iv(name, arr); +/** + * The Camera Fade In Complete Event. + * + * This event is dispatched by a Camera instance when the Fade In Effect completes. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeincomplete', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE + * @type {string} + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + */ +module.exports = 'camerafadeincomplete'; - return this; - }, - /** - * Sets a 3iv uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set3iv - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set3iv: function (name, arr, shader) - { - if (shader === undefined) { shader = this.currentShader; } +/***/ }), - shader.set3iv(name, arr); +/***/ 92057: +/***/ ((module) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets a 4iv uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set4iv - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set4iv: function (name, arr, shader) - { - if (shader === undefined) { shader = this.currentShader; } +/** + * The Camera Fade In Start Event. + * + * This event is dispatched by a Camera instance when the Fade In Effect starts. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeinstart', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_IN_START + * @type {string} + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + * @param {number} duration - The duration of the effect. + * @param {number} red - The red color channel value. + * @param {number} green - The green color channel value. + * @param {number} blue - The blue color channel value. + */ +module.exports = 'camerafadeinstart'; - shader.set4iv(name, arr); - return this; - }, +/***/ }), - /** - * Sets a 1i uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set1i - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number} x - The new value of the `int` uniform. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set1i: function (name, x, shader) - { - if (shader === undefined) { shader = this.currentShader; } +/***/ 1903: +/***/ ((module) => { - shader.set1i(name, x); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +/** + * The Camera Fade Out Complete Event. + * + * This event is dispatched by a Camera instance when the Fade Out Effect completes. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeoutcomplete', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE + * @type {string} + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + */ +module.exports = 'camerafadeoutcomplete'; - /** - * Sets a 2i uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set2i - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number} x - The new X component of the `ivec2` uniform. - * @param {number} y - The new Y component of the `ivec2` uniform. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set2i: function (name, x, y, shader) - { - if (shader === undefined) { shader = this.currentShader; } - shader.set2i(name, x, y); +/***/ }), - return this; - }, +/***/ 96131: +/***/ ((module) => { - /** - * Sets a 3i uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set3i - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number} x - The new X component of the `ivec3` uniform. - * @param {number} y - The new Y component of the `ivec3` uniform. - * @param {number} z - The new Z component of the `ivec3` uniform. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set3i: function (name, x, y, z, shader) - { - if (shader === undefined) { shader = this.currentShader; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - shader.set3i(name, x, y, z); +/** + * The Camera Fade Out Start Event. + * + * This event is dispatched by a Camera instance when the Fade Out Effect starts. + * + * Listen to it from a Camera instance using `Camera.on('camerafadeoutstart', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FADE_OUT_START + * @type {string} + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. + * @param {number} duration - The duration of the effect. + * @param {number} red - The red color channel value. + * @param {number} green - The green color channel value. + * @param {number} blue - The blue color channel value. + */ +module.exports = 'camerafadeoutstart'; - return this; - }, - /** - * Sets a 4i uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#set4i - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {number} x - X component of the uniform. - * @param {number} y - Y component of the uniform. - * @param {number} z - Z component of the uniform. - * @param {number} w - W component of the uniform. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - set4i: function (name, x, y, z, w, shader) - { - if (shader === undefined) { shader = this.currentShader; } +/***/ }), - shader.set4i(name, x, y, z, w); +/***/ 85409: +/***/ ((module) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets a matrix 2fv uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix2fv - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. - * @param {number[]|Float32Array} matrix - The new values for the `mat2` uniform. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - setMatrix2fv: function (name, transpose, matrix, shader) - { - if (shader === undefined) { shader = this.currentShader; } +/** + * The Camera Flash Complete Event. + * + * This event is dispatched by a Camera instance when the Flash Effect completes. + * + * Listen for it via either of the following: + * + * ```js + * this.cameras.main.on('cameraflashcomplete', () => {}); + * ``` + * + * or use the constant, to avoid having to remember the correct event string: + * + * ```js + * this.cameras.main.on(Phaser.Cameras.Scene2D.Events.FLASH_COMPLETE, () => {}); + * ``` + * + * @event Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE + * @type {string} + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. + */ +module.exports = 'cameraflashcomplete'; - shader.setMatrix2fv(name, transpose, matrix); - return this; - }, +/***/ }), - /** - * Sets a matrix 3fv uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix3fv - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. - * @param {Float32Array} matrix - The new values for the `mat3` uniform. - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - setMatrix3fv: function (name, transpose, matrix, shader) - { - if (shader === undefined) { shader = this.currentShader; } +/***/ 25500: +/***/ ((module) => { - shader.setMatrix3fv(name, transpose, matrix); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +/** + * The Camera Flash Start Event. + * + * This event is dispatched by a Camera instance when the Flash Effect starts. + * + * Listen for it via either of the following: + * + * ```js + * this.cameras.main.on('cameraflashstart', () => {}); + * ``` + * + * or use the constant, to avoid having to remember the correct event string: + * + * ```js + * this.cameras.main.on(Phaser.Cameras.Scene2D.Events.FLASH_START, () => {}); + * ``` + * + * @event Phaser.Cameras.Scene2D.Events#FLASH_START + * @type {string} + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. + * @param {number} duration - The duration of the effect. + * @param {number} red - The red color channel value. + * @param {number} green - The green color channel value. + * @param {number} blue - The blue color channel value. + */ +module.exports = 'cameraflashstart'; - /** - * Sets a matrix 4fv uniform value based on the given name on the currently set shader. - * - * The current shader is bound, before the uniform is set, making it active within the - * WebGLRenderer. This means you can safely call this method from a location such as - * a Scene `create` or `update` method. However, when working within a Shader file - * directly, use the `WebGLShader` method equivalent instead, to avoid the program - * being set. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix4fv - * @since 3.50.0 - * - * @param {string} name - The name of the uniform to set. - * @param {boolean} transpose - Should the matrix be transpose - * @param {Float32Array} matrix - Matrix data - * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. - * - * @return {this} This WebGLPipeline instance. - */ - setMatrix4fv: function (name, transpose, matrix, shader) - { - if (shader === undefined) { shader = this.currentShader; } - shader.setMatrix4fv(name, transpose, matrix); +/***/ }), - return this; - }, +/***/ 44071: +/***/ ((module) => { - /** - * Destroys all shader instances, removes all object references and nulls all external references. - * - * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy - * @fires Phaser.Renderer.WebGL.Pipelines.Events#DESTROY - * @since 3.0.0 - * - * @return {this} This WebGLPipeline instance. - */ - destroy: function () - { - this.emit(Events.DESTROY, this); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var i; +/** + * The Camera Follower Update Event. + * + * This event is dispatched by a Camera instance when it is following a + * Game Object and the Camera position has been updated as a result of + * that following. + * + * Listen to it from a Camera instance using: `camera.on('followupdate', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#FOLLOW_UPDATE + * @type {string} + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that emitted the event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the camera is following. + */ +module.exports = 'followupdate'; - var shaders = this.shaders; - for (i = 0; i < shaders.length; i++) - { - shaders[i].destroy(); - } +/***/ }), - var targets = this.renderTargets; +/***/ 19818: +/***/ ((module) => { - for (i = 0; i < targets.length; i++) - { - targets[i].destroy(); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.gl.deleteBuffer(this.vertexBuffer); +/** + * The Camera Pan Complete Event. + * + * This event is dispatched by a Camera instance when the Pan Effect completes. + * + * Listen for it via either of the following: + * + * ```js + * this.cameras.main.on('camerapancomplete', () => {}); + * ``` + * + * or use the constant, to avoid having to remember the correct event string: + * + * ```js + * this.cameras.main.on(Phaser.Cameras.Scene2D.Events.PAN_COMPLETE, () => {}); + * ``` + * + * @event Phaser.Cameras.Scene2D.Events#PAN_COMPLETE + * @type {string} + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. + */ +module.exports = 'camerapancomplete'; - var renderer = this.renderer; - renderer.off(RendererEvents.RESIZE, this.resize, this); - renderer.off(RendererEvents.PRE_RENDER, this.onPreRender, this); - renderer.off(RendererEvents.RENDER, this.onRender, this); - renderer.off(RendererEvents.POST_RENDER, this.onPostRender, this); +/***/ }), - this.removeAllListeners(); +/***/ 80002: +/***/ ((module) => { - this.game = null; - this.renderer = null; - this.manager = null; - this.gl = null; - this.view = null; - this.shaders = null; - this.renderTargets = null; - this.bytes = null; - this.vertexViewF32 = null; - this.vertexViewU32 = null; - this.vertexData = null; - this.vertexBuffer = null; - this.currentShader = null; - this.currentRenderTarget = null; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - } +/** + * The Camera Pan Start Event. + * + * This event is dispatched by a Camera instance when the Pan Effect starts. + * + * Listen for it via either of the following: + * + * ```js + * this.cameras.main.on('camerapanstart', () => {}); + * ``` + * + * or use the constant, to avoid having to remember the correct event string: + * + * ```js + * this.cameras.main.on(Phaser.Cameras.Scene2D.Events.PAN_START, () => {}); + * ``` + * + * @event Phaser.Cameras.Scene2D.Events#PAN_START + * @type {string} + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. + * @param {number} duration - The duration of the effect. + * @param {number} x - The destination scroll x coordinate. + * @param {number} y - The destination scroll y coordinate. + */ +module.exports = 'camerapanstart'; -}); -module.exports = WebGLPipeline; +/***/ }), + +/***/ 87966: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Camera Post-Render Event. + * + * This event is dispatched by a Camera instance after is has finished rendering. + * It is only dispatched if the Camera is rendering to a texture. + * + * Listen to it from a Camera instance using: `camera.on('postrender', listener)`. + * + * @event Phaser.Cameras.Scene2D.Events#POST_RENDER + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that has finished rendering to a texture. + */ +module.exports = 'postrender'; /***/ }), -/* 59 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; +/***/ 74217: +/***/ ((module) => { + /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * This module implements a modified ear slicing algorithm, optimized by z-order curve hashing and extended to - * handle holes, twisted polygons, degeneracies and self-intersections in a way that doesn't guarantee correctness - * of triangulation, but attempts to always produce acceptable results for practical data. + * The Camera Pre-Render Event. * - * Example: + * This event is dispatched by a Camera instance when it is about to render. + * It is only dispatched if the Camera is rendering to a texture. * - * ```javascript - * const triangles = Phaser.Geom.Polygon.Earcut([10,0, 0,50, 60,60, 70,10]); // returns [1,0,3, 3,2,1] - * ``` + * Listen to it from a Camera instance using: `camera.on('prerender', listener)`. * - * Each group of three vertex indices in the resulting array forms a triangle. + * @event Phaser.Cameras.Scene2D.Events#PRE_RENDER + * @type {string} + * @since 3.0.0 * - * ```javascript - * // triangulating a polygon with a hole - * earcut([0,0, 100,0, 100,100, 0,100, 20,20, 80,20, 80,80, 20,80], [4]); - * // [3,0,4, 5,4,0, 3,4,7, 5,0,1, 2,3,7, 6,5,1, 2,7,6, 6,1,2] + * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that is about to render to a texture. + */ +module.exports = 'prerender'; + + +/***/ }), + +/***/ 34805: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Camera Rotate Complete Event. * - * // triangulating a polygon with 3d coords - * earcut([10,0,1, 0,50,2, 60,60,3, 70,10,4], null, 3); - * // [1,0,3, 3,2,1] - * ``` + * This event is dispatched by a Camera instance when the Rotate Effect completes. * - * If you pass a single vertex as a hole, Earcut treats it as a Steiner point. + * Listen for it via either of the following: * - * If your input is a multi-dimensional array (e.g. GeoJSON Polygon), you can convert it to the format - * expected by Earcut with `Phaser.Geom.Polygon.Earcut.flatten`: + * ```js + * this.cameras.main.on('camerarotatecomplete', () => {}); + * ``` * - * ```javascript - * var data = earcut.flatten(geojson.geometry.coordinates); - * var triangles = earcut(data.vertices, data.holes, data.dimensions); + * or use the constant, to avoid having to remember the correct event string: + * + * ```js + * this.cameras.main.on(Phaser.Cameras.Scene2D.Events.ROTATE_COMPLETE, () => {}); * ``` * - * After getting a triangulation, you can verify its correctness with `Phaser.Geom.Polygon.Earcut.deviation`: + * @event Phaser.Cameras.Scene2D.Events#ROTATE_COMPLETE + * @type {string} + * @since 3.23.0 * - * ```javascript - * var deviation = earcut.deviation(vertices, holes, dimensions, triangles); + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.RotateTo} effect - A reference to the effect instance. + */ +module.exports = 'camerarotatecomplete'; + + +/***/ }), + +/***/ 30408: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Camera Rotate Start Event. + * + * This event is dispatched by a Camera instance when the Rotate Effect starts. + * + * Listen for it via either of the following: + * + * ```js + * this.cameras.main.on('camerarotatestart', () => {}); * ``` - * Returns the relative difference between the total area of triangles and the area of the input polygon. - * 0 means the triangulation is fully correct. * - * For more information see https://github.com/mapbox/earcut + * or use the constant, to avoid having to remember the correct event string: * - * @function Phaser.Geom.Polygon.Earcut - * @since 3.50.0 + * ```js + * this.cameras.main.on(Phaser.Cameras.Scene2D.Events.ROTATE_START, () => {}); + * ``` * - * @param {number[]} data - A flat array of vertex coordinate, like [x0,y0, x1,y1, x2,y2, ...] - * @param {number[]} [holeIndices] - An array of hole indices if any (e.g. [5, 8] for a 12-vertex input would mean one hole with vertices 5–7 and another with 8–11). - * @param {number} [dimensions=2] - The number of coordinates per vertex in the input array (2 by default). + * @event Phaser.Cameras.Scene2D.Events#ROTATE_START + * @type {string} + * @since 3.23.0 * - * @return {number[]} An array of triangulated data. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.RotateTo} effect - A reference to the effect instance. + * @param {number} duration - The duration of the effect. + * @param {number} destination - The destination value. */ +module.exports = 'camerarotatestart'; - // Earcut 2.2.2 (January 21st 2020) -/* - * ISC License +/***/ }), + +/***/ 49856: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Camera Shake Complete Event. * - * Copyright (c) 2016, Mapbox + * This event is dispatched by a Camera instance when the Shake Effect completes. * - * Permission to use, copy, modify, and/or distribute this software for any purpose - * with or without fee is hereby granted, provided that the above copyright notice - * and this permission notice appear in all copies. + * Listen for it via either of the following: * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. + * ```js + * this.cameras.main.on('camerashakecomplete', () => {}); + * ``` + * + * or use the constant, to avoid having to remember the correct event string: + * + * ```js + * this.cameras.main.on(Phaser.Cameras.Scene2D.Events.SHAKE_COMPLETE, () => {}); + * ``` + * + * @event Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE + * @type {string} + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. */ +module.exports = 'camerashakecomplete'; +/***/ }), -function earcut(data, holeIndices, dim) { - - dim = dim || 2; +/***/ 69189: +/***/ ((module) => { - var hasHoles = holeIndices && holeIndices.length, - outerLen = hasHoles ? holeIndices[0] * dim : data.length, - outerNode = linkedList(data, 0, outerLen, dim, true), - triangles = []; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (!outerNode || outerNode.next === outerNode.prev) return triangles; +/** + * The Camera Shake Start Event. + * + * This event is dispatched by a Camera instance when the Shake Effect starts. + * + * Listen for it via either of the following: + * + * ```js + * this.cameras.main.on('camerashakestart', () => {}); + * ``` + * + * or use the constant, to avoid having to remember the correct event string: + * + * ```js + * this.cameras.main.on(Phaser.Cameras.Scene2D.Events.SHAKE_START, () => {}); + * ``` + * + * @event Phaser.Cameras.Scene2D.Events#SHAKE_START + * @type {string} + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. + * @param {number} duration - The duration of the effect. + * @param {number} intensity - The intensity of the effect. + */ +module.exports = 'camerashakestart'; - var minX, minY, maxX, maxY, x, y, invSize; - if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); +/***/ }), - // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox - if (data.length > 80 * dim) { - minX = maxX = data[0]; - minY = maxY = data[1]; +/***/ 67657: +/***/ ((module) => { - for (var i = dim; i < outerLen; i += dim) { - x = data[i]; - y = data[i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // minX, minY and invSize are later used to transform coords into integers for z-order calculation - invSize = Math.max(maxX - minX, maxY - minY); - invSize = invSize !== 0 ? 1 / invSize : 0; - } +/** + * The Camera Zoom Complete Event. + * + * This event is dispatched by a Camera instance when the Zoom Effect completes. + * + * Listen for it via either of the following: + * + * ```js + * this.cameras.main.on('camerazoomcomplete', () => {}); + * ``` + * + * or use the constant, to avoid having to remember the correct event string: + * + * ```js + * this.cameras.main.on(Phaser.Cameras.Scene2D.Events.ZOOM_COMPLETE, () => {}); + * ``` + * + * @event Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE + * @type {string} + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. + */ +module.exports = 'camerazoomcomplete'; - earcutLinked(outerNode, triangles, dim, minX, minY, invSize); - return triangles; -} +/***/ }), -// create a circular doubly linked list from polygon points in the specified winding order -function linkedList(data, start, end, dim, clockwise) { - var i, last; +/***/ 14229: +/***/ ((module) => { - if (clockwise === (signedArea(data, start, end, dim) > 0)) { - for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); - } else { - for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (last && equals(last, last.next)) { - removeNode(last); - last = last.next; - } +/** + * The Camera Zoom Start Event. + * + * This event is dispatched by a Camera instance when the Zoom Effect starts. + * + * Listen for it via either of the following: + * + * ```js + * this.cameras.main.on('camerazoomstart', () => {}); + * ``` + * + * or use the constant, to avoid having to remember the correct event string: + * + * ```js + * this.cameras.main.on(Phaser.Cameras.Scene2D.Events.ZOOM_START, () => {}); + * ``` + * + * @event Phaser.Cameras.Scene2D.Events#ZOOM_START + * @type {string} + * @since 3.3.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. + * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. + * @param {number} duration - The duration of the effect. + * @param {number} zoom - The destination zoom value. + */ +module.exports = 'camerazoomstart'; - return last; -} -// eliminate colinear or duplicate points -function filterPoints(start, end) { - if (!start) return start; - if (!end) end = start; +/***/ }), - var p = start, - again; - do { - again = false; +/***/ 89787: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { - removeNode(p); - p = end = p.prev; - if (p === p.next) break; - again = true; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - } else { - p = p.next; - } - } while (again || p !== end); +/** + * @namespace Phaser.Cameras.Scene2D.Events + */ - return end; -} +module.exports = { -// main ear slicing loop which triangulates a polygon (given as a linked list) -function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { - if (!ear) return; + DESTROY: __webpack_require__(39577), + FADE_IN_COMPLETE: __webpack_require__(85373), + FADE_IN_START: __webpack_require__(92057), + FADE_OUT_COMPLETE: __webpack_require__(1903), + FADE_OUT_START: __webpack_require__(96131), + FLASH_COMPLETE: __webpack_require__(85409), + FLASH_START: __webpack_require__(25500), + FOLLOW_UPDATE: __webpack_require__(44071), + PAN_COMPLETE: __webpack_require__(19818), + PAN_START: __webpack_require__(80002), + POST_RENDER: __webpack_require__(87966), + PRE_RENDER: __webpack_require__(74217), + ROTATE_COMPLETE: __webpack_require__(34805), + ROTATE_START: __webpack_require__(30408), + SHAKE_COMPLETE: __webpack_require__(49856), + SHAKE_START: __webpack_require__(69189), + ZOOM_COMPLETE: __webpack_require__(67657), + ZOOM_START: __webpack_require__(14229) - // interlink polygon nodes in z-order - if (!pass && invSize) indexCurve(ear, minX, minY, invSize); +}; - var stop = ear, - prev, next; - // iterate through ears, slicing them one by one - while (ear.prev !== ear.next) { - prev = ear.prev; - next = ear.next; +/***/ }), - if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { - // cut off the triangle - triangles.push(prev.i / dim); - triangles.push(ear.i / dim); - triangles.push(next.i / dim); +/***/ 32356: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - removeNode(ear); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // skipping the next vertex leads to less sliver triangles - ear = next.next; - stop = next.next; +/** + * @namespace Phaser.Cameras.Scene2D + */ - continue; - } +module.exports = { - ear = next; + Camera: __webpack_require__(47751), + BaseCamera: __webpack_require__(51052), + CameraManager: __webpack_require__(62382), + Effects: __webpack_require__(53030), + Events: __webpack_require__(89787) - // if we looped through the whole remaining polygon and can't find any more ears - if (ear === stop) { - // try filtering points and slicing again - if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); +}; - // if this didn't work, try curing all small self-intersections locally - } else if (pass === 1) { - ear = cureLocalIntersections(filterPoints(ear), triangles, dim); - earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); - // as a last resort, try splitting the remaining polygon into two - } else if (pass === 2) { - splitEarcut(ear, triangles, dim, minX, minY, invSize); - } +/***/ }), - break; - } - } -} +/***/ 84219: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -// check whether a polygon node forms a valid ear with adjacent nodes -function isEar(ear) { - var a = ear.prev, - b = ear, - c = ear.next; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (area(a, b, c) >= 0) return false; // reflex, can't be an ear +var Class = __webpack_require__(56694); +var GetValue = __webpack_require__(10850); - // now make sure we don't have other points inside the potential ear - var p = ear.next.next; +/** + * @classdesc + * A Fixed Key Camera Control. + * + * This allows you to control the movement and zoom of a camera using the defined keys. + * + * ```javascript + * var camControl = new FixedKeyControl({ + * camera: this.cameras.main, + * left: cursors.left, + * right: cursors.right, + * speed: float OR { x: 0, y: 0 } + * }); + * ``` + * + * Movement is precise and has no 'smoothing' applied to it. + * + * You must call the `update` method of this controller every frame. + * + * @class FixedKeyControl + * @memberof Phaser.Cameras.Controls + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Types.Cameras.Controls.FixedKeyControlConfig} config - The Fixed Key Control configuration object. + */ +var FixedKeyControl = new Class({ - while (p !== ear.prev) { - if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.next; - } + initialize: - return true; -} + function FixedKeyControl (config) + { + /** + * The Camera that this Control will update. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#camera + * @type {?Phaser.Cameras.Scene2D.Camera} + * @default null + * @since 3.0.0 + */ + this.camera = GetValue(config, 'camera', null); -function isEarHashed(ear, minX, minY, invSize) { - var a = ear.prev, - b = ear, - c = ear.next; + /** + * The Key to be pressed that will move the Camera left. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#left + * @type {?Phaser.Input.Keyboard.Key} + * @default null + * @since 3.0.0 + */ + this.left = GetValue(config, 'left', null); - if (area(a, b, c) >= 0) return false; // reflex, can't be an ear + /** + * The Key to be pressed that will move the Camera right. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#right + * @type {?Phaser.Input.Keyboard.Key} + * @default null + * @since 3.0.0 + */ + this.right = GetValue(config, 'right', null); - // triangle bbox; min & max are calculated like this for speed - var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), - minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), - maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), - maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); + /** + * The Key to be pressed that will move the Camera up. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#up + * @type {?Phaser.Input.Keyboard.Key} + * @default null + * @since 3.0.0 + */ + this.up = GetValue(config, 'up', null); - // z-order range for the current triangle bbox; - var minZ = zOrder(minTX, minTY, minX, minY, invSize), - maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); + /** + * The Key to be pressed that will move the Camera down. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#down + * @type {?Phaser.Input.Keyboard.Key} + * @default null + * @since 3.0.0 + */ + this.down = GetValue(config, 'down', null); - var p = ear.prevZ, - n = ear.nextZ; + /** + * The Key to be pressed that will zoom the Camera in. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#zoomIn + * @type {?Phaser.Input.Keyboard.Key} + * @default null + * @since 3.0.0 + */ + this.zoomIn = GetValue(config, 'zoomIn', null); - // look for points inside the triangle in both directions - while (p && p.z >= minZ && n && n.z <= maxZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.prevZ; + /** + * The Key to be pressed that will zoom the Camera out. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#zoomOut + * @type {?Phaser.Input.Keyboard.Key} + * @default null + * @since 3.0.0 + */ + this.zoomOut = GetValue(config, 'zoomOut', null); - if (n !== ear.prev && n !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && - area(n.prev, n, n.next) >= 0) return false; - n = n.nextZ; - } + /** + * The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#zoomSpeed + * @type {number} + * @default 0.01 + * @since 3.0.0 + */ + this.zoomSpeed = GetValue(config, 'zoomSpeed', 0.01); - // look for remaining points in decreasing z-order - while (p && p.z >= minZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.prevZ; - } + /** + * The smallest zoom value the camera will reach when zoomed out. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#minZoom + * @type {number} + * @default 0.001 + * @since 3.53.0 + */ + this.minZoom = GetValue(config, 'minZoom', 0.001); - // look for remaining points in increasing z-order - while (n && n.z <= maxZ) { - if (n !== ear.prev && n !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && - area(n.prev, n, n.next) >= 0) return false; - n = n.nextZ; - } + /** + * The largest zoom value the camera will reach when zoomed in. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#maxZoom + * @type {number} + * @default 1000 + * @since 3.53.0 + */ + this.maxZoom = GetValue(config, 'maxZoom', 1000); - return true; -} + /** + * The horizontal speed the camera will move. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#speedX + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.speedX = 0; -// go through all polygon nodes and cure small local self-intersections -function cureLocalIntersections(start, triangles, dim) { - var p = start; - do { - var a = p.prev, - b = p.next.next; + /** + * The vertical speed the camera will move. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#speedY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.speedY = 0; - if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { + var speed = GetValue(config, 'speed', null); - triangles.push(a.i / dim); - triangles.push(p.i / dim); - triangles.push(b.i / dim); + if (typeof speed === 'number') + { + this.speedX = speed; + this.speedY = speed; + } + else + { + this.speedX = GetValue(config, 'speed.x', 0); + this.speedY = GetValue(config, 'speed.y', 0); + } - // remove two nodes involved - removeNode(p); - removeNode(p.next); + /** + * Internal property to track the current zoom level. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#_zoom + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._zoom = 0; - p = start = b; - } - p = p.next; - } while (p !== start); + /** + * A flag controlling if the Controls will update the Camera or not. + * + * @name Phaser.Cameras.Controls.FixedKeyControl#active + * @type {boolean} + * @since 3.0.0 + */ + this.active = (this.camera !== null); + }, - return filterPoints(p); -} + /** + * Starts the Key Control running, providing it has been linked to a camera. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#start + * @since 3.0.0 + * + * @return {this} This Key Control instance. + */ + start: function () + { + this.active = (this.camera !== null); -// try splitting polygon into two and triangulate them independently -function splitEarcut(start, triangles, dim, minX, minY, invSize) { - // look for a valid diagonal that divides the polygon into two - var a = start; - do { - var b = a.next.next; - while (b !== a.prev) { - if (a.i !== b.i && isValidDiagonal(a, b)) { - // split the polygon in two by the diagonal - var c = splitPolygon(a, b); + return this; + }, - // filter colinear points around the cuts - a = filterPoints(a, a.next); - c = filterPoints(c, c.next); + /** + * Stops this Key Control from running. Call `start` to start it again. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#stop + * @since 3.0.0 + * + * @return {this} This Key Control instance. + */ + stop: function () + { + this.active = false; - // run earcut on each half - earcutLinked(a, triangles, dim, minX, minY, invSize); - earcutLinked(c, triangles, dim, minX, minY, invSize); - return; - } - b = b.next; - } - a = a.next; - } while (a !== start); -} + return this; + }, -// link every hole into the outer loop, producing a single-ring polygon without holes -function eliminateHoles(data, holeIndices, outerNode, dim) { - var queue = [], - i, len, start, end, list; + /** + * Binds this Key Control to a camera. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#setCamera + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to bind this Key Control to. + * + * @return {this} This Key Control instance. + */ + setCamera: function (camera) + { + this.camera = camera; - for (i = 0, len = holeIndices.length; i < len; i++) { - start = holeIndices[i] * dim; - end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - list = linkedList(data, start, end, dim, false); - if (list === list.next) list.steiner = true; - queue.push(getLeftmost(list)); - } + return this; + }, - queue.sort(compareX); + /** + * Applies the results of pressing the control keys to the Camera. + * + * You must call this every step, it is not called automatically. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#update + * @since 3.0.0 + * + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + update: function (delta) + { + if (!this.active) + { + return; + } - // process holes from left to right - for (i = 0; i < queue.length; i++) { - eliminateHole(queue[i], outerNode); - outerNode = filterPoints(outerNode, outerNode.next); - } + if (delta === undefined) { delta = 1; } - return outerNode; -} + var cam = this.camera; -function compareX(a, b) { - return a.x - b.x; -} + if (this.up && this.up.isDown) + { + cam.scrollY -= ((this.speedY * delta) | 0); + } + else if (this.down && this.down.isDown) + { + cam.scrollY += ((this.speedY * delta) | 0); + } -// find a bridge between vertices that connects hole with an outer ring and and link it -function eliminateHole(hole, outerNode) { - outerNode = findHoleBridge(hole, outerNode); - if (outerNode) { - var b = splitPolygon(outerNode, hole); + if (this.left && this.left.isDown) + { + cam.scrollX -= ((this.speedX * delta) | 0); + } + else if (this.right && this.right.isDown) + { + cam.scrollX += ((this.speedX * delta) | 0); + } - // filter collinear points around the cuts - filterPoints(outerNode, outerNode.next); - filterPoints(b, b.next); - } -} + // Camera zoom -// David Eberly's algorithm for finding a bridge between hole and outer polygon -function findHoleBridge(hole, outerNode) { - var p = outerNode, - hx = hole.x, - hy = hole.y, - qx = -Infinity, - m; + if (this.zoomIn && this.zoomIn.isDown) + { + cam.zoom -= this.zoomSpeed; - // find a segment intersected by a ray from the hole's leftmost point to the left; - // segment's endpoint with lesser x will be potential connection point - do { - if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { - var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); - if (x <= hx && x > qx) { - qx = x; - if (x === hx) { - if (hy === p.y) return p; - if (hy === p.next.y) return p.next; - } - m = p.x < p.next.x ? p : p.next; + if (cam.zoom < this.minZoom) + { + cam.zoom = this.minZoom; } } - p = p.next; - } while (p !== outerNode); + else if (this.zoomOut && this.zoomOut.isDown) + { + cam.zoom += this.zoomSpeed; - if (!m) return null; + if (cam.zoom > this.maxZoom) + { + cam.zoom = this.maxZoom; + } + } + }, - if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint + /** + * Destroys this Key Control. + * + * @method Phaser.Cameras.Controls.FixedKeyControl#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.camera = null; - // look for points inside the triangle of hole point, segment intersection and endpoint; - // if there are no points found, we have a valid connection; - // otherwise choose the point of the minimum angle with the ray as connection point + this.left = null; + this.right = null; + this.up = null; + this.down = null; - var stop = m, - mx = m.x, - my = m.y, - tanMin = Infinity, - tan; + this.zoomIn = null; + this.zoomOut = null; + } - p = m; +}); - do { - if (hx >= p.x && p.x >= mx && hx !== p.x && - pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { +module.exports = FixedKeyControl; - tan = Math.abs(hy - p.y) / (hx - p.x); // tangential - if (locallyInside(p, hole) && - (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) { - m = p; - tanMin = tan; - } - } +/***/ }), - p = p.next; - } while (p !== stop); +/***/ 69370: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return m; -} +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -// whether sector in vertex m contains sector in vertex p in the same coordinates -function sectorContainsSector(m, p) { - return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0; -} +var Class = __webpack_require__(56694); +var GetValue = __webpack_require__(10850); -// interlink polygon nodes in z-order -function indexCurve(start, minX, minY, invSize) { - var p = start; - do { - if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize); - p.prevZ = p.prev; - p.nextZ = p.next; - p = p.next; - } while (p !== start); - - p.prevZ.nextZ = null; - p.prevZ = null; +/** + * @classdesc + * A Smoothed Key Camera Control. + * + * This allows you to control the movement and zoom of a camera using the defined keys. + * Unlike the Fixed Camera Control you can also provide physics values for acceleration, drag and maxSpeed for smoothing effects. + * + * ```javascript + * var controlConfig = { + * camera: this.cameras.main, + * left: cursors.left, + * right: cursors.right, + * up: cursors.up, + * down: cursors.down, + * zoomIn: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.Q), + * zoomOut: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.E), + * zoomSpeed: 0.02, + * acceleration: 0.06, + * drag: 0.0005, + * maxSpeed: 1.0 + * }; + * ``` + * + * You must call the `update` method of this controller every frame. + * + * @class SmoothedKeyControl + * @memberof Phaser.Cameras.Controls + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Types.Cameras.Controls.SmoothedKeyControlConfig} config - The Smoothed Key Control configuration object. + */ +var SmoothedKeyControl = new Class({ - sortLinked(p); -} + initialize: -// Simon Tatham's linked list merge sort algorithm -// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html -function sortLinked(list) { - var i, p, q, e, tail, numMerges, pSize, qSize, - inSize = 1; + function SmoothedKeyControl (config) + { + /** + * The Camera that this Control will update. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#camera + * @type {?Phaser.Cameras.Scene2D.Camera} + * @default null + * @since 3.0.0 + */ + this.camera = GetValue(config, 'camera', null); - do { - p = list; - list = null; - tail = null; - numMerges = 0; + /** + * The Key to be pressed that will move the Camera left. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#left + * @type {?Phaser.Input.Keyboard.Key} + * @default null + * @since 3.0.0 + */ + this.left = GetValue(config, 'left', null); - while (p) { - numMerges++; - q = p; - pSize = 0; - for (i = 0; i < inSize; i++) { - pSize++; - q = q.nextZ; - if (!q) break; - } - qSize = inSize; + /** + * The Key to be pressed that will move the Camera right. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#right + * @type {?Phaser.Input.Keyboard.Key} + * @default null + * @since 3.0.0 + */ + this.right = GetValue(config, 'right', null); - while (pSize > 0 || (qSize > 0 && q)) { + /** + * The Key to be pressed that will move the Camera up. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#up + * @type {?Phaser.Input.Keyboard.Key} + * @default null + * @since 3.0.0 + */ + this.up = GetValue(config, 'up', null); - if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { - e = p; - p = p.nextZ; - pSize--; - } else { - e = q; - q = q.nextZ; - qSize--; - } + /** + * The Key to be pressed that will move the Camera down. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#down + * @type {?Phaser.Input.Keyboard.Key} + * @default null + * @since 3.0.0 + */ + this.down = GetValue(config, 'down', null); - if (tail) tail.nextZ = e; - else list = e; + /** + * The Key to be pressed that will zoom the Camera in. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomIn + * @type {?Phaser.Input.Keyboard.Key} + * @default null + * @since 3.0.0 + */ + this.zoomIn = GetValue(config, 'zoomIn', null); - e.prevZ = tail; - tail = e; - } + /** + * The Key to be pressed that will zoom the Camera out. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomOut + * @type {?Phaser.Input.Keyboard.Key} + * @default null + * @since 3.0.0 + */ + this.zoomOut = GetValue(config, 'zoomOut', null); - p = q; - } + /** + * The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomSpeed + * @type {number} + * @default 0.01 + * @since 3.0.0 + */ + this.zoomSpeed = GetValue(config, 'zoomSpeed', 0.01); - tail.nextZ = null; - inSize *= 2; + /** + * The smallest zoom value the camera will reach when zoomed out. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#minZoom + * @type {number} + * @default 0.001 + * @since 3.53.0 + */ + this.minZoom = GetValue(config, 'minZoom', 0.001); - } while (numMerges > 1); + /** + * The largest zoom value the camera will reach when zoomed in. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxZoom + * @type {number} + * @default 1000 + * @since 3.53.0 + */ + this.maxZoom = GetValue(config, 'maxZoom', 1000); - return list; -} + /** + * The horizontal acceleration the camera will move. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#accelX + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.accelX = 0; -// z-order of a point given coords and inverse of the longer side of data bbox -function zOrder(x, y, minX, minY, invSize) { - // coords are transformed into non-negative 15-bit integer range - x = 32767 * (x - minX) * invSize; - y = 32767 * (y - minY) * invSize; + /** + * The vertical acceleration the camera will move. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#accelY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.accelY = 0; - x = (x | (x << 8)) & 0x00FF00FF; - x = (x | (x << 4)) & 0x0F0F0F0F; - x = (x | (x << 2)) & 0x33333333; - x = (x | (x << 1)) & 0x55555555; + var accel = GetValue(config, 'acceleration', null); - y = (y | (y << 8)) & 0x00FF00FF; - y = (y | (y << 4)) & 0x0F0F0F0F; - y = (y | (y << 2)) & 0x33333333; - y = (y | (y << 1)) & 0x55555555; + if (typeof accel === 'number') + { + this.accelX = accel; + this.accelY = accel; + } + else + { + this.accelX = GetValue(config, 'acceleration.x', 0); + this.accelY = GetValue(config, 'acceleration.y', 0); + } - return x | (y << 1); -} + /** + * The horizontal drag applied to the camera when it is moving. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#dragX + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.dragX = 0; -// find the leftmost node of a polygon ring -function getLeftmost(start) { - var p = start, - leftmost = start; - do { - if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p; - p = p.next; - } while (p !== start); + /** + * The vertical drag applied to the camera when it is moving. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#dragY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.dragY = 0; - return leftmost; -} + var drag = GetValue(config, 'drag', null); -// check if a point lies within a convex triangle -function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { - return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && - (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && - (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; -} + if (typeof drag === 'number') + { + this.dragX = drag; + this.dragY = drag; + } + else + { + this.dragX = GetValue(config, 'drag.x', 0); + this.dragY = GetValue(config, 'drag.y', 0); + } -// check if a diagonal between two polygon nodes is valid (lies in polygon interior) -function isValidDiagonal(a, b) { - return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges - (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible - (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors - equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case -} + /** + * The maximum horizontal speed the camera will move. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedX + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.maxSpeedX = 0; -// signed area of a triangle -function area(p, q, r) { - return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); -} + /** + * The maximum vertical speed the camera will move. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.maxSpeedY = 0; -// check if two points are equal -function equals(p1, p2) { - return p1.x === p2.x && p1.y === p2.y; -} + var maxSpeed = GetValue(config, 'maxSpeed', null); -// check if two segments intersect -function intersects(p1, q1, p2, q2) { - var o1 = sign(area(p1, q1, p2)); - var o2 = sign(area(p1, q1, q2)); - var o3 = sign(area(p2, q2, p1)); - var o4 = sign(area(p2, q2, q1)); + if (typeof maxSpeed === 'number') + { + this.maxSpeedX = maxSpeed; + this.maxSpeedY = maxSpeed; + } + else + { + this.maxSpeedX = GetValue(config, 'maxSpeed.x', 0); + this.maxSpeedY = GetValue(config, 'maxSpeed.y', 0); + } - if (o1 !== o2 && o3 !== o4) return true; // general case + /** + * Internal property to track the speed of the control. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedX + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._speedX = 0; - if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1 - if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1 - if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2 - if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2 + /** + * Internal property to track the speed of the control. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedY + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._speedY = 0; - return false; -} + /** + * Internal property to track the zoom of the control. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#_zoom + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._zoom = 0; -// for collinear points p, q, r, check if point q lies on segment pr -function onSegment(p, q, r) { - return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y); -} + /** + * A flag controlling if the Controls will update the Camera or not. + * + * @name Phaser.Cameras.Controls.SmoothedKeyControl#active + * @type {boolean} + * @since 3.0.0 + */ + this.active = (this.camera !== null); + }, -function sign(num) { - return num > 0 ? 1 : num < 0 ? -1 : 0; -} + /** + * Starts the Key Control running, providing it has been linked to a camera. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#start + * @since 3.0.0 + * + * @return {this} This Key Control instance. + */ + start: function () + { + this.active = (this.camera !== null); -// check if a polygon diagonal intersects any polygon segments -function intersectsPolygon(a, b) { - var p = a; - do { - if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && - intersects(p, p.next, a, b)) return true; - p = p.next; - } while (p !== a); + return this; + }, - return false; -} + /** + * Stops this Key Control from running. Call `start` to start it again. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#stop + * @since 3.0.0 + * + * @return {this} This Key Control instance. + */ + stop: function () + { + this.active = false; -// check if a polygon diagonal is locally inside the polygon -function locallyInside(a, b) { - return area(a.prev, a, a.next) < 0 ? - area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : - area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; -} + return this; + }, -// check if the middle point of a polygon diagonal is inside the polygon -function middleInside(a, b) { - var p = a, - inside = false, - px = (a.x + b.x) / 2, - py = (a.y + b.y) / 2; - do { - if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && - (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) - inside = !inside; - p = p.next; - } while (p !== a); + /** + * Binds this Key Control to a camera. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#setCamera + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to bind this Key Control to. + * + * @return {this} This Key Control instance. + */ + setCamera: function (camera) + { + this.camera = camera; - return inside; -} + return this; + }, -// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; -// if one belongs to the outer ring and another to a hole, it merges it into a single ring -function splitPolygon(a, b) { - var a2 = new Node(a.i, a.x, a.y), - b2 = new Node(b.i, b.x, b.y), - an = a.next, - bp = b.prev; + /** + * Applies the results of pressing the control keys to the Camera. + * + * You must call this every step, it is not called automatically. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#update + * @since 3.0.0 + * + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + update: function (delta) + { + if (!this.active) + { + return; + } - a.next = b; - b.prev = a; + if (delta === undefined) { delta = 1; } - a2.next = an; - an.prev = a2; + var cam = this.camera; - b2.next = a2; - a2.prev = b2; + // Apply Deceleration - bp.next = b2; - b2.prev = bp; + if (this._speedX > 0) + { + this._speedX -= this.dragX * delta; - return b2; -} + if (this._speedX < 0) + { + this._speedX = 0; + } + } + else if (this._speedX < 0) + { + this._speedX += this.dragX * delta; -// create a node and optionally link it with previous one (in a circular doubly linked list) -function insertNode(i, x, y, last) { - var p = new Node(i, x, y); + if (this._speedX > 0) + { + this._speedX = 0; + } + } - if (!last) { - p.prev = p; - p.next = p; + if (this._speedY > 0) + { + this._speedY -= this.dragY * delta; - } else { - p.next = last.next; - p.prev = last; - last.next.prev = p; - last.next = p; - } - return p; -} + if (this._speedY < 0) + { + this._speedY = 0; + } + } + else if (this._speedY < 0) + { + this._speedY += this.dragY * delta; -function removeNode(p) { - p.next.prev = p.prev; - p.prev.next = p.next; + if (this._speedY > 0) + { + this._speedY = 0; + } + } - if (p.prevZ) p.prevZ.nextZ = p.nextZ; - if (p.nextZ) p.nextZ.prevZ = p.prevZ; -} + // Check for keys -function Node(i, x, y) { - // vertex index in coordinates array - this.i = i; + if (this.up && this.up.isDown) + { + this._speedY += this.accelY; - // vertex coordinates - this.x = x; - this.y = y; + if (this._speedY > this.maxSpeedY) + { + this._speedY = this.maxSpeedY; + } + } + else if (this.down && this.down.isDown) + { + this._speedY -= this.accelY; - // previous and next vertex nodes in a polygon ring - this.prev = null; - this.next = null; + if (this._speedY < -this.maxSpeedY) + { + this._speedY = -this.maxSpeedY; + } + } - // z-order curve value - this.z = null; + if (this.left && this.left.isDown) + { + this._speedX += this.accelX; - // previous and next nodes in z-order - this.prevZ = null; - this.nextZ = null; + if (this._speedX > this.maxSpeedX) + { + this._speedX = this.maxSpeedX; + } + } + else if (this.right && this.right.isDown) + { + this._speedX -= this.accelX; - // indicates whether this is a steiner point - this.steiner = false; -} + if (this._speedX < -this.maxSpeedX) + { + this._speedX = -this.maxSpeedX; + } + } -// return a percentage difference between the polygon area and its triangulation area; -// used to verify correctness of triangulation -earcut.deviation = function (data, holeIndices, dim, triangles) { - var hasHoles = holeIndices && holeIndices.length; - var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + // Camera zoom - var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); - if (hasHoles) { - for (var i = 0, len = holeIndices.length; i < len; i++) { - var start = holeIndices[i] * dim; - var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - polygonArea -= Math.abs(signedArea(data, start, end, dim)); + if (this.zoomIn && this.zoomIn.isDown) + { + this._zoom = -this.zoomSpeed; + } + else if (this.zoomOut && this.zoomOut.isDown) + { + this._zoom = this.zoomSpeed; + } + else + { + this._zoom = 0; } - } - var trianglesArea = 0; - for (i = 0; i < triangles.length; i += 3) { - var a = triangles[i] * dim; - var b = triangles[i + 1] * dim; - var c = triangles[i + 2] * dim; - trianglesArea += Math.abs( - (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - - (data[a] - data[b]) * (data[c + 1] - data[a + 1])); - } + // Apply to Camera - return polygonArea === 0 && trianglesArea === 0 ? 0 : - Math.abs((trianglesArea - polygonArea) / polygonArea); -}; + if (this._speedX !== 0) + { + cam.scrollX -= ((this._speedX * delta) | 0); + } -function signedArea(data, start, end, dim) { - var sum = 0; - for (var i = start, j = end - dim; i < end; i += dim) { - sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); - j = i; - } - return sum; -} + if (this._speedY !== 0) + { + cam.scrollY -= ((this._speedY * delta) | 0); + } -// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts -earcut.flatten = function (data) { - var dim = data[0][0].length, - result = {vertices: [], holes: [], dimensions: dim}, - holeIndex = 0; + if (this._zoom !== 0) + { + cam.zoom += this._zoom; - for (var i = 0; i < data.length; i++) { - for (var j = 0; j < data[i].length; j++) { - for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); - } - if (i > 0) { - holeIndex += data[i - 1].length; - result.holes.push(holeIndex); + if (cam.zoom < this.minZoom) + { + cam.zoom = this.minZoom; + } + else if (cam.zoom > this.maxZoom) + { + cam.zoom = this.maxZoom; + } } + }, + + /** + * Destroys this Key Control. + * + * @method Phaser.Cameras.Controls.SmoothedKeyControl#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.camera = null; + + this.left = null; + this.right = null; + this.up = null; + this.down = null; + + this.zoomIn = null; + this.zoomOut = null; } - return result; -}; -module.exports = earcut; +}); + +module.exports = SmoothedKeyControl; /***/ }), -/* 60 */ -/***/ (function(module, exports) { + +/***/ 6524: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Sets the strokeStyle and lineWidth on the target context based on the given Shape. - * - * @method Phaser.GameObjects.Shape#LineStyleCanvas - * @since 3.13.0 - * @private - * - * @param {CanvasRenderingContext2D} ctx - The context to set the stroke style on. - * @param {Phaser.GameObjects.Shape} src - The Game Object to set the stroke style from. - * @param {number} [altColor] - An alternative color to render with. - * @param {number} [altAlpha] - An alternative alpha to render with. + * @namespace Phaser.Cameras.Controls */ -var LineStyleCanvas = function (ctx, src, altColor, altAlpha) -{ - var strokeColor = (altColor) ? altColor : src.strokeColor; - var strokeAlpha = (altAlpha) ? altAlpha : src.strokeAlpha; - var red = ((strokeColor & 0xFF0000) >>> 16); - var green = ((strokeColor & 0xFF00) >>> 8); - var blue = (strokeColor & 0xFF); +module.exports = { - ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + strokeAlpha + ')'; - ctx.lineWidth = src.lineWidth; -}; + FixedKeyControl: __webpack_require__(84219), + SmoothedKeyControl: __webpack_require__(69370) -module.exports = LineStyleCanvas; +}; /***/ }), -/* 61 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 44143: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var GetValue = __webpack_require__(6); -var IsPlainObject = __webpack_require__(7); - /** - * @classdesc - * A single JSON File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#json method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#json. - * - * @class JSONFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {(object|string)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, can be a fully formed JSON Object. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + * @namespace Phaser.Cameras */ -var JSONFile = new Class({ - - Extends: File, - - initialize: - - // url can either be a string, in which case it is treated like a proper url, or an object, in which case it is treated as a ready-made JS Object - // dataKey allows you to pluck a specific object out of the JSON and put just that into the cache, rather than the whole thing - - function JSONFile (loader, key, url, xhrSettings, dataKey) - { - var extension = 'json'; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - dataKey = GetFastValue(config, 'dataKey', dataKey); - } - - var fileConfig = { - type: 'json', - cache: loader.cacheManager.json, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings, - config: dataKey - }; - - File.call(this, loader, fileConfig); - - if (IsPlainObject(url)) - { - // Object provided instead of a URL, so no need to actually load it (populate data with value) - if (dataKey) - { - this.data = GetValue(url, dataKey); - } - else - { - this.data = url; - } - - this.state = CONST.FILE_POPULATED; - } - }, - - /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. - * - * @method Phaser.Loader.FileTypes.JSONFile#onProcess - * @since 3.7.0 - */ - onProcess: function () - { - if (this.state !== CONST.FILE_POPULATED) - { - this.state = CONST.FILE_PROCESSING; - - try - { - var json = JSON.parse(this.xhrLoader.responseText); - } - catch (e) - { - console.warn('Invalid JSON: ' + this.key); - - this.onProcessError(); - - throw e; - } - - var key = this.config; - - if (typeof key === 'string') - { - this.data = GetValue(json, key, json); - } - else - { - this.data = json; - } - } - - this.onProcessComplete(); - } - -}); /** - * Adds a JSON file, or array of JSON files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.json('wavedata', 'files/AlienWaveData.json'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global JSON Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the JSON Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the JSON Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.json({ - * key: 'wavedata', - * url: 'files/AlienWaveData.json' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.JSONFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.json('wavedata', 'files/AlienWaveData.json'); - * // and later in your game ... - * var data = this.cache.json.get('wavedata'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and - * this is what you would use to retrieve the text from the JSON Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" - * and no URL is given then the Loader will set the URL to be "data.json". It will always add `.json` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * You can also optionally provide a `dataKey` to use. This allows you to extract only a part of the JSON and store it in the Cache, - * rather than the whole file. For example, if your JSON data had a structure like this: - * - * ```json - * { - * "level1": { - * "baddies": { - * "aliens": {}, - * "boss": {} - * } - * }, - * "level2": {}, - * "level3": {} - * } - * ``` - * - * And you only wanted to store the `boss` data in the Cache, then you could pass `level1.baddies.boss`as the `dataKey`. - * - * Note: The ability to load this type of file will only be available if the JSON File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#json - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {(object|string)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, can be a fully formed JSON Object. - * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. + * @namespace Phaser.Types.Cameras */ -FileTypesManager.register('json', function (key, url, dataKey, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new JSONFile(this, key[i])); - } - } - else - { - this.addFile(new JSONFile(this, key, url, xhrSettings, dataKey)); - } - return this; -}); +module.exports = { -module.exports = JSONFile; + Controls: __webpack_require__(6524), + Scene2D: __webpack_require__(32356) + +}; /***/ }), -/* 62 */ -/***/ (function(module, exports) { + +/***/ 86459: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Arcade Physics consts. + * Global constants. * * @ignore */ @@ -41512,6853 +39817,6092 @@ module.exports = JSONFile; var CONST = { /** - * Dynamic Body. + * Phaser Release Version * - * @name Phaser.Physics.Arcade.DYNAMIC_BODY - * @readonly - * @type {number} + * @name Phaser.VERSION + * @const + * @type {string} * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#physicsType - * @see Phaser.Physics.Arcade.Group#physicsType */ - DYNAMIC_BODY: 0, + VERSION: '3.60.0', + + BlendModes: __webpack_require__(95723), + + ScaleModes: __webpack_require__(27394), /** - * Static Body. + * This setting will auto-detect if the browser is capable of suppporting WebGL. + * If it is, it will use the WebGL Renderer. If not, it will fall back to the Canvas Renderer. * - * @name Phaser.Physics.Arcade.STATIC_BODY - * @readonly + * @name Phaser.AUTO + * @const * @type {number} * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#physicsType - * @see Phaser.Physics.Arcade.StaticBody#physicsType */ - STATIC_BODY: 1, + AUTO: 0, /** - * Arcade Physics Group containing Dynamic Bodies. + * Forces Phaser to only use the Canvas Renderer, regardless if the browser supports + * WebGL or not. * - * @name Phaser.Physics.Arcade.GROUP - * @readonly + * @name Phaser.CANVAS + * @const * @type {number} * @since 3.0.0 */ - GROUP: 2, + CANVAS: 1, /** - * A Tilemap Layer. + * Forces Phaser to use the WebGL Renderer. If the browser does not support it, there is + * no fallback to Canvas with this setting, so you should trap it and display a suitable + * message to the user. * - * @name Phaser.Physics.Arcade.TILEMAPLAYER - * @readonly + * @name Phaser.WEBGL + * @const * @type {number} * @since 3.0.0 */ - TILEMAPLAYER: 3, + WEBGL: 2, /** - * Facing no direction (initial value). + * A Headless Renderer doesn't create either a Canvas or WebGL Renderer. However, it still + * absolutely relies on the DOM being present and available. This mode is meant for unit testing, + * not for running Phaser on the server, which is something you really shouldn't do. * - * @name Phaser.Physics.Arcade.FACING_NONE - * @readonly + * @name Phaser.HEADLESS + * @const * @type {number} * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing */ - FACING_NONE: 10, + HEADLESS: 3, /** - * Facing up. + * In Phaser the value -1 means 'forever' in lots of cases, this const allows you to use it instead + * to help you remember what the value is doing in your code. * - * @name Phaser.Physics.Arcade.FACING_UP - * @readonly + * @name Phaser.FOREVER + * @const * @type {number} * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing */ - FACING_UP: 11, + FOREVER: -1, /** - * Facing down. + * Direction constant. * - * @name Phaser.Physics.Arcade.FACING_DOWN - * @readonly + * @name Phaser.NONE + * @const * @type {number} * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing */ - FACING_DOWN: 12, + NONE: 4, /** - * Facing left. + * Direction constant. * - * @name Phaser.Physics.Arcade.FACING_LEFT - * @readonly + * @name Phaser.UP + * @const * @type {number} * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing */ - FACING_LEFT: 13, + UP: 5, /** - * Facing right. + * Direction constant. * - * @name Phaser.Physics.Arcade.FACING_RIGHT - * @readonly + * @name Phaser.DOWN + * @const * @type {number} * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#facing */ - FACING_RIGHT: 14 - -}; - -module.exports = CONST; - - -/***/ }), -/* 63 */ -/***/ (function(module, exports, __webpack_require__) { + DOWN: 6, + + /** + * Direction constant. + * + * @name Phaser.LEFT + * @const + * @type {number} + * @since 3.0.0 + */ + LEFT: 7, + + /** + * Direction constant. + * + * @name Phaser.RIGHT + * @const + * @type {number} + * @since 3.0.0 + */ + RIGHT: 8 + +}; + +module.exports = CONST; + + +/***/ }), + +/***/ 14033: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTileAt = __webpack_require__(158); -var GetTilesWithin = __webpack_require__(26); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(86459); +var DefaultPlugins = __webpack_require__(18360); +var Device = __webpack_require__(77290); +var GetFastValue = __webpack_require__(72632); +var GetValue = __webpack_require__(10850); +var IsPlainObject = __webpack_require__(42911); +var NOOP = __webpack_require__(72283); +var PhaserMath = __webpack_require__(5923); +var PIPELINE_CONST = __webpack_require__(65641); +var ValueToColor = __webpack_require__(93222); /** - * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the - * layer. Interesting faces are used internally for optimizing collisions against tiles. This method - * is mostly used internally. + * @classdesc + * The active game configuration settings, parsed from a {@link Phaser.Types.Core.GameConfig} object. * - * @function Phaser.Tilemaps.Components.CalculateFacesWithin + * @class Config + * @memberof Phaser.Core + * @constructor * @since 3.0.0 * - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Types.Core.GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. + * + * @see Phaser.Game#config */ -var CalculateFacesWithin = function (tileX, tileY, width, height, layer) -{ - var above = null; - var below = null; - var left = null; - var right = null; +var Config = new Class({ - var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + initialize: - for (var i = 0; i < tiles.length; i++) + function Config (config) { - var tile = tiles[i]; + if (config === undefined) { config = {}; } - if (tile) - { - if (tile.collides) - { - above = GetTileAt(tile.x, tile.y - 1, true, layer); - below = GetTileAt(tile.x, tile.y + 1, true, layer); - left = GetTileAt(tile.x - 1, tile.y, true, layer); - right = GetTileAt(tile.x + 1, tile.y, true, layer); + var defaultBannerColor = [ + '#ff0000', + '#ffff00', + '#00ff00', + '#00ffff', + '#000000' + ]; - tile.faceTop = (above && above.collides) ? false : true; - tile.faceBottom = (below && below.collides) ? false : true; - tile.faceLeft = (left && left.collides) ? false : true; - tile.faceRight = (right && right.collides) ? false : true; - } - else - { - tile.resetFaces(); - } - } - } -}; + var defaultBannerTextColor = '#ffffff'; -module.exports = CalculateFacesWithin; + // Scale Manager - Anything set in here over-rides anything set in the core game config + var scaleConfig = GetValue(config, 'scale', null); -/***/ }), -/* 64 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * @const {(number|string)} Phaser.Core.Config#width - The width of the underlying canvas, in pixels. + */ + this.width = GetValue(scaleConfig, 'width', 1024, config); -/** -* The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. -* A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. -* A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull). -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class Vertices -*/ + /** + * @const {(number|string)} Phaser.Core.Config#height - The height of the underlying canvas, in pixels. + */ + this.height = GetValue(scaleConfig, 'height', 768, config); -var Vertices = {}; + /** + * @const {(Phaser.Scale.ZoomType|number)} Phaser.Core.Config#zoom - The zoom factor, as used by the Scale Manager. + */ + this.zoom = GetValue(scaleConfig, 'zoom', 1, config); -module.exports = Vertices; + /** + * @const {?*} Phaser.Core.Config#parent - A parent DOM element into which the canvas created by the renderer will be injected. + */ + this.parent = GetValue(scaleConfig, 'parent', undefined, config); -var Vector = __webpack_require__(83); -var Common = __webpack_require__(32); + /** + * @const {Phaser.Scale.ScaleModeType} Phaser.Core.Config#scaleMode - The scale mode as used by the Scale Manager. The default is zero, which is no scaling. + */ + this.scaleMode = GetValue(scaleConfig, (scaleConfig) ? 'mode' : 'scaleMode', 0, config); -(function() { + /** + * @const {boolean} Phaser.Core.Config#expandParent - Is the Scale Manager allowed to adjust the CSS height property of the parent to be 100%? + */ + this.expandParent = GetValue(scaleConfig, 'expandParent', true, config); - /** - * Creates a new set of `Matter.Body` compatible vertices. - * The `points` argument accepts an array of `Matter.Vector` points orientated around the origin `(0, 0)`, for example: - * - * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] - * - * The `Vertices.create` method returns a new array of vertices, which are similar to Matter.Vector objects, - * but with some additional references required for efficient collision detection routines. - * - * Vertices must be specified in clockwise order. - * - * Note that the `body` argument is not optional, a `Matter.Body` reference must be provided. - * - * @method create - * @param {vector[]} points - * @param {body} body - */ - Vertices.create = function(points, body) { - var vertices = []; + /** + * @const {boolean} Phaser.Core.Config#autoRound - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. + */ + this.autoRound = GetValue(scaleConfig, 'autoRound', false, config); - for (var i = 0; i < points.length; i++) { - var point = points[i], - vertex = { - x: point.x, - y: point.y, - index: i, - body: body, - isInternal: false, - contact: null, - offset: null - }; + /** + * @const {Phaser.Scale.CenterType} Phaser.Core.Config#autoCenter - Automatically center the canvas within the parent? + */ + this.autoCenter = GetValue(scaleConfig, 'autoCenter', 0, config); - vertex.contact = { - vertex: vertex, - normalImpulse: 0, - tangentImpulse: 0 - }; + /** + * @const {number} Phaser.Core.Config#resizeInterval - How many ms should elapse before checking if the browser size has changed? + */ + this.resizeInterval = GetValue(scaleConfig, 'resizeInterval', 500, config); - vertices.push(vertex); - } + /** + * @const {?(HTMLElement|string)} Phaser.Core.Config#fullscreenTarget - The DOM element that will be sent into full screen mode, or its `id`. If undefined Phaser will create its own div and insert the canvas into it when entering fullscreen mode. + */ + this.fullscreenTarget = GetValue(scaleConfig, 'fullscreenTarget', null, config); - return vertices; - }; + /** + * @const {number} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum. + */ + this.minWidth = GetValue(scaleConfig, 'minWidth', 0, config); - /** - * Parses a string containing ordered x y pairs separated by spaces (and optionally commas), - * into a `Matter.Vertices` object for the given `Matter.Body`. - * For parsing SVG paths, see `Svg.pathToVertices`. - * @method fromPath - * @param {string} path - * @param {body} body - * @return {vertices} vertices - */ - Vertices.fromPath = function(path, body) { - var pathPattern = /L?\s*([-\d.e]+)[\s,]*([-\d.e]+)*/ig, - points = []; + /** + * @const {number} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum. + */ + this.maxWidth = GetValue(scaleConfig, 'maxWidth', 0, config); - path.replace(pathPattern, function(match, x, y) { - points.push({ x: parseFloat(x), y: parseFloat(y) }); - }); + /** + * @const {number} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum. + */ + this.minHeight = GetValue(scaleConfig, 'minHeight', 0, config); - return Vertices.create(points, body); - }; + /** + * @const {number} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum. + */ + this.maxHeight = GetValue(scaleConfig, 'maxHeight', 0, config); - /** - * Returns the centre (centroid) of the set of vertices. - * @method centre - * @param {vertices} vertices - * @return {vector} The centre point - */ - Vertices.centre = function(vertices) { - var area = Vertices.area(vertices, true), - centre = { x: 0, y: 0 }, - cross, - temp, - j; + /** + * @const {number} Phaser.Core.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default) + */ + this.renderType = GetValue(config, 'type', CONST.AUTO); - for (var i = 0; i < vertices.length; i++) { - j = (i + 1) % vertices.length; - cross = Vector.cross(vertices[i], vertices[j]); - temp = Vector.mult(Vector.add(vertices[i], vertices[j]), cross); - centre = Vector.add(centre, temp); - } + /** + * @const {?HTMLCanvasElement} Phaser.Core.Config#canvas - Force Phaser to use your own Canvas element instead of creating one. + */ + this.canvas = GetValue(config, 'canvas', null); - return Vector.div(centre, 6 * area); - }; + /** + * @const {?(CanvasRenderingContext2D|WebGLRenderingContext)} Phaser.Core.Config#context - Force Phaser to use your own Canvas context instead of creating one. + */ + this.context = GetValue(config, 'context', null); - /** - * Returns the average (mean) of the set of vertices. - * @method mean - * @param {vertices} vertices - * @return {vector} The average point - */ - Vertices.mean = function(vertices) { - var average = { x: 0, y: 0 }; + /** + * @const {?string} Phaser.Core.Config#canvasStyle - Optional CSS attributes to be set on the canvas object created by the renderer. + */ + this.canvasStyle = GetValue(config, 'canvasStyle', null); - for (var i = 0; i < vertices.length; i++) { - average.x += vertices[i].x; - average.y += vertices[i].y; - } + /** + * @const {boolean} Phaser.Core.Config#customEnvironment - Is Phaser running under a custom (non-native web) environment? If so, set this to `true` to skip internal Feature detection. If `true` the `renderType` cannot be left as `AUTO`. + */ + this.customEnvironment = GetValue(config, 'customEnvironment', false); - return Vector.div(average, vertices.length); - }; + /** + * @const {?object} Phaser.Core.Config#sceneConfig - The default Scene configuration object. + */ + this.sceneConfig = GetValue(config, 'scene', null); - /** - * Returns the area of the set of vertices. - * @method area - * @param {vertices} vertices - * @param {bool} signed - * @return {number} The area - */ - Vertices.area = function(vertices, signed) { - var area = 0, - j = vertices.length - 1; + /** + * @const {string[]} Phaser.Core.Config#seed - A seed which the Random Data Generator will use. If not given, a dynamic seed based on the time is used. + */ + this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); - for (var i = 0; i < vertices.length; i++) { - area += (vertices[j].x - vertices[i].x) * (vertices[j].y + vertices[i].y); - j = i; - } + PhaserMath.RND = new PhaserMath.RandomDataGenerator(this.seed); - if (signed) - return area / 2; + /** + * @const {string} Phaser.Core.Config#gameTitle - The title of the game. + */ + this.gameTitle = GetValue(config, 'title', ''); - return Math.abs(area) / 2; - }; + /** + * @const {string} Phaser.Core.Config#gameURL - The URL of the game. + */ + this.gameURL = GetValue(config, 'url', 'https://phaser.io'); - /** - * Returns the moment of inertia (second moment of area) of the set of vertices given the total mass. - * @method inertia - * @param {vertices} vertices - * @param {number} mass - * @return {number} The polygon's moment of inertia - */ - Vertices.inertia = function(vertices, mass) { - var numerator = 0, - denominator = 0, - v = vertices, - cross, - j; + /** + * @const {string} Phaser.Core.Config#gameVersion - The version of the game. + */ + this.gameVersion = GetValue(config, 'version', ''); - // find the polygon's moment of inertia, using second moment of area - // from equations at http://www.physicsforums.com/showthread.php?t=25293 - for (var n = 0; n < v.length; n++) { - j = (n + 1) % v.length; - cross = Math.abs(Vector.cross(v[j], v[n])); - numerator += cross * (Vector.dot(v[j], v[j]) + Vector.dot(v[j], v[n]) + Vector.dot(v[n], v[n])); - denominator += cross; - } + /** + * @const {boolean} Phaser.Core.Config#autoFocus - If `true` the window will automatically be given focus immediately and on any future mousedown event. + */ + this.autoFocus = GetValue(config, 'autoFocus', true); - return (mass / 6) * (numerator / denominator); - }; + /** + * @const {(number|boolean)} Phaser.Core.Config#stableSort - `false` or `0` = Use the built-in StableSort (needed for older browsers), `true` or `1` = Rely on ES2019 Array.sort being stable (modern browsers only), or `-1` = Try and determine this automatically based on browser inspection (not guaranteed to work, errs on side of caution). + */ + this.stableSort = GetValue(config, 'stableSort', -1); - /** - * Translates the set of vertices in-place. - * @method translate - * @param {vertices} vertices - * @param {vector} vector - * @param {number} scalar - */ - Vertices.translate = function(vertices, vector, scalar) { - var i; - if (scalar) { - for (i = 0; i < vertices.length; i++) { - vertices[i].x += vector.x * scalar; - vertices[i].y += vector.y * scalar; - } - } else { - for (i = 0; i < vertices.length; i++) { - vertices[i].x += vector.x; - vertices[i].y += vector.y; - } + if (this.stableSort === -1) + { + this.stableSort = (Device.browser.es2019) ? 1 : 0; } - return vertices; - }; + Device.features.stableSort = this.stableSort; - /** - * Rotates the set of vertices in-place. - * @method rotate - * @param {vertices} vertices - * @param {number} angle - * @param {vector} point - */ - Vertices.rotate = function(vertices, angle, point) { - if (angle === 0) - return; + // DOM Element Container - var cos = Math.cos(angle), - sin = Math.sin(angle); + /** + * @const {?boolean} Phaser.Core.Config#domCreateContainer - Should the game create a div element to act as a DOM Container? Only enable if you're using DOM Element objects. You must provide a parent object if you use this feature. + */ + this.domCreateContainer = GetValue(config, 'dom.createContainer', false); - for (var i = 0; i < vertices.length; i++) { - var vertice = vertices[i], - dx = vertice.x - point.x, - dy = vertice.y - point.y; - - vertice.x = point.x + (dx * cos - dy * sin); - vertice.y = point.y + (dx * sin + dy * cos); - } + /** + * @const {?string} Phaser.Core.Config#domPointerEvents - The default `pointerEvents` attribute set on the DOM Container. + */ + this.domPointerEvents = GetValue(config, 'dom.pointerEvents', 'none'); - return vertices; - }; + // Input - /** - * Returns `true` if the `point` is inside the set of `vertices`. - * @method contains - * @param {vertices} vertices - * @param {vector} point - * @return {boolean} True if the vertices contains point, otherwise false - */ - Vertices.contains = function(vertices, point) { - for (var i = 0; i < vertices.length; i++) { - var vertice = vertices[i], - nextVertice = vertices[(i + 1) % vertices.length]; - if ((point.x - vertice.x) * (nextVertice.y - vertice.y) + (point.y - vertice.y) * (vertice.x - nextVertice.x) > 0) { - return false; - } - } + /** + * @const {boolean} Phaser.Core.Config#inputKeyboard - Enable the Keyboard Plugin. This can be disabled in games that don't need keyboard input. + */ + this.inputKeyboard = GetValue(config, 'input.keyboard', true); - return true; - }; + /** + * @const {*} Phaser.Core.Config#inputKeyboardEventTarget - The DOM Target to listen for keyboard events on. Defaults to `window` if not specified. + */ + this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); - /** - * Scales the vertices from a point (default is centre) in-place. - * @method scale - * @param {vertices} vertices - * @param {number} scaleX - * @param {number} scaleY - * @param {vector} point - */ - Vertices.scale = function(vertices, scaleX, scaleY, point) { - if (scaleX === 1 && scaleY === 1) - return vertices; + /** + * @const {?number[]} Phaser.Core.Config#inputKeyboardCapture - `preventDefault` will be called on every non-modified key which has a key code in this array. By default, it is empty. + */ + this.inputKeyboardCapture = GetValue(config, 'input.keyboard.capture', []); - point = point || Vertices.centre(vertices); + /** + * @const {(boolean|object)} Phaser.Core.Config#inputMouse - Enable the Mouse Plugin. This can be disabled in games that don't need mouse input. + */ + this.inputMouse = GetValue(config, 'input.mouse', true); - var vertex, - delta; + /** + * @const {?*} Phaser.Core.Config#inputMouseEventTarget - The DOM Target to listen for mouse events on. Defaults to the game canvas if not specified. + */ + this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); - for (var i = 0; i < vertices.length; i++) { - vertex = vertices[i]; - delta = Vector.sub(vertex, point); - vertices[i].x = point.x + delta.x * scaleX; - vertices[i].y = point.y + delta.y * scaleY; - } + /** + * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultDown - Should `mousedown` DOM events have `preventDefault` called on them? + */ + this.inputMousePreventDefaultDown = GetValue(config, 'input.mouse.preventDefaultDown', true); - return vertices; - }; + /** + * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultUp - Should `mouseup` DOM events have `preventDefault` called on them? + */ + this.inputMousePreventDefaultUp = GetValue(config, 'input.mouse.preventDefaultUp', true); - /** - * Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices. - * The radius parameter is a single number or an array to specify the radius for each vertex. - * @method chamfer - * @param {vertices} vertices - * @param {number[]} radius - * @param {number} quality - * @param {number} qualityMin - * @param {number} qualityMax - */ - Vertices.chamfer = function(vertices, radius, quality, qualityMin, qualityMax) { - if (typeof radius === 'number') { - radius = [radius]; - } else { - radius = radius || [8]; - } + /** + * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultMove - Should `mousemove` DOM events have `preventDefault` called on them? + */ + this.inputMousePreventDefaultMove = GetValue(config, 'input.mouse.preventDefaultMove', true); - // quality defaults to -1, which is auto - quality = (typeof quality !== 'undefined') ? quality : -1; - qualityMin = qualityMin || 2; - qualityMax = qualityMax || 14; + /** + * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultWheel - Should `wheel` DOM events have `preventDefault` called on them? + */ + this.inputMousePreventDefaultWheel = GetValue(config, 'input.mouse.preventDefaultWheel', true); - var newVertices = []; + /** + * @const {boolean} Phaser.Core.Config#inputTouch - Enable the Touch Plugin. This can be disabled in games that don't need touch input. + */ + this.inputTouch = GetValue(config, 'input.touch', Device.input.touch); - for (var i = 0; i < vertices.length; i++) { - var prevVertex = vertices[i - 1 >= 0 ? i - 1 : vertices.length - 1], - vertex = vertices[i], - nextVertex = vertices[(i + 1) % vertices.length], - currentRadius = radius[i < radius.length ? i : radius.length - 1]; + /** + * @const {?*} Phaser.Core.Config#inputTouchEventTarget - The DOM Target to listen for touch events on. Defaults to the game canvas if not specified. + */ + this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); - if (currentRadius === 0) { - newVertices.push(vertex); - continue; - } + /** + * @const {boolean} Phaser.Core.Config#inputTouchCapture - Should touch events be captured? I.e. have prevent default called on them. + */ + this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); - var prevNormal = Vector.normalise({ - x: vertex.y - prevVertex.y, - y: prevVertex.x - vertex.x - }); + /** + * @const {number} Phaser.Core.Config#inputActivePointers - The number of Pointer objects created by default. In a mouse-only, or non-multi touch game, you can leave this as 1. + */ + this.inputActivePointers = GetValue(config, 'input.activePointers', 1); - var nextNormal = Vector.normalise({ - x: nextVertex.y - vertex.y, - y: vertex.x - nextVertex.x - }); + /** + * @const {number} Phaser.Core.Config#inputSmoothFactor - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. + */ + this.inputSmoothFactor = GetValue(config, 'input.smoothFactor', 0); - var diagonalRadius = Math.sqrt(2 * Math.pow(currentRadius, 2)), - radiusVector = Vector.mult(Common.clone(prevNormal), currentRadius), - midNormal = Vector.normalise(Vector.mult(Vector.add(prevNormal, nextNormal), 0.5)), - scaledVertex = Vector.sub(vertex, Vector.mult(midNormal, diagonalRadius)); + /** + * @const {boolean} Phaser.Core.Config#inputWindowEvents - Should Phaser listen for input events on the Window? If you disable this, events like 'POINTER_UP_OUTSIDE' will no longer fire. + */ + this.inputWindowEvents = GetValue(config, 'input.windowEvents', true); - var precision = quality; + /** + * @const {boolean} Phaser.Core.Config#inputGamepad - Enable the Gamepad Plugin. This can be disabled in games that don't need gamepad input. + */ + this.inputGamepad = GetValue(config, 'input.gamepad', false); - if (quality === -1) { - // automatically decide precision - precision = Math.pow(currentRadius, 0.32) * 1.75; - } + /** + * @const {*} Phaser.Core.Config#inputGamepadEventTarget - The DOM Target to listen for gamepad events on. Defaults to `window` if not specified. + */ + this.inputGamepadEventTarget = GetValue(config, 'input.gamepad.target', window); - precision = Common.clamp(precision, qualityMin, qualityMax); + /** + * @const {boolean} Phaser.Core.Config#disableContextMenu - Set to `true` to disable the right-click context menu. + */ + this.disableContextMenu = GetValue(config, 'disableContextMenu', false); - // use an even value for precision, more likely to reduce axes by using symmetry - if (precision % 2 === 1) - precision += 1; + /** + * @const {Phaser.Types.Core.AudioConfig} Phaser.Core.Config#audio - The Audio Configuration object. + */ + this.audio = GetValue(config, 'audio', {}); - var alpha = Math.acos(Vector.dot(prevNormal, nextNormal)), - theta = alpha / precision; + // If you do: { banner: false } it won't display any banner at all - for (var j = 0; j < precision; j++) { - newVertices.push(Vector.add(Vector.rotate(radiusVector, theta * j), scaledVertex)); - } - } + /** + * @const {boolean} Phaser.Core.Config#hideBanner - Don't write the banner line to the console.log. + */ + this.hideBanner = (GetValue(config, 'banner', null) === false); - return newVertices; - }; + /** + * @const {boolean} Phaser.Core.Config#hidePhaser - Omit Phaser's name and version from the banner. + */ + this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); - /** - * Sorts the input vertices into clockwise order in place. - * @method clockwiseSort - * @param {vertices} vertices - * @return {vertices} vertices - */ - Vertices.clockwiseSort = function(vertices) { - var centre = Vertices.mean(vertices); + /** + * @const {string} Phaser.Core.Config#bannerTextColor - The color of the banner text. + */ + this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); - vertices.sort(function(vertexA, vertexB) { - return Vector.angle(centre, vertexA) - Vector.angle(centre, vertexB); - }); + /** + * @const {string[]} Phaser.Core.Config#bannerBackgroundColor - The background colors of the banner. + */ + this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor); - return vertices; - }; + if (this.gameTitle === '' && this.hidePhaser) + { + this.hideBanner = true; + } - /** - * Returns true if the vertices form a convex shape (vertices must be in clockwise order). - * @method isConvex - * @param {vertices} vertices - * @return {bool} `true` if the `vertices` are convex, `false` if not (or `null` if not computable). - */ - Vertices.isConvex = function(vertices) { - // http://paulbourke.net/geometry/polygonmesh/ - // Copyright (c) Paul Bourke (use permitted) + /** + * @const {Phaser.Types.Core.FPSConfig} Phaser.Core.Config#fps - The Frame Rate Configuration object, as parsed by the Timestep class. + */ + this.fps = GetValue(config, 'fps', null); - var flag = 0, - n = vertices.length, - i, - j, - k, - z; + // Render Settings - Anything set in here over-rides anything set in the core game config - if (n < 3) - return null; + var renderConfig = GetValue(config, 'render', null); - for (i = 0; i < n; i++) { - j = (i + 1) % n; - k = (i + 2) % n; - z = (vertices[j].x - vertices[i].x) * (vertices[k].y - vertices[j].y); - z -= (vertices[j].y - vertices[i].y) * (vertices[k].x - vertices[j].x); + /** + * @const {Phaser.Types.Core.PipelineConfig} Phaser.Core.Config#pipeline - An object mapping WebGL names to WebGLPipeline classes. These should be class constructors, not instances. + */ + this.pipeline = GetValue(renderConfig, 'pipeline', null, config); - if (z < 0) { - flag |= 1; - } else if (z > 0) { - flag |= 2; - } + /** + * @const {boolean} Phaser.Core.Config#autoMobilePipeline - Automatically enable the Mobile Pipeline if iOS or Android detected? + */ + this.autoMobilePipeline = GetValue(renderConfig, 'autoMobilePipeline', true, config); - if (flag === 3) { - return false; - } - } + /** + * @const {string} Phaser.Core.Config#defaultPipeline - The WebGL Pipeline that Game Objects will use by default. Set to 'MultiPipeline' as standard. See also 'autoMobilePipeline'. + */ + this.defaultPipeline = GetValue(renderConfig, 'defaultPipeline', PIPELINE_CONST.MULTI_PIPELINE, config); - if (flag !== 0){ - return true; - } else { - return null; - } - }; + /** + * @const {boolean} Phaser.Core.Config#antialias - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. + */ + this.antialias = GetValue(renderConfig, 'antialias', true, config); - /** - * Returns the convex hull of the input vertices as a new array of points. - * @method hull - * @param {vertices} vertices - * @return [vertex] vertices - */ - Vertices.hull = function(vertices) { - // http://geomalgorithms.com/a10-_hull-1.html + /** + * @const {boolean} Phaser.Core.Config#antialiasGL - Sets the `antialias` property when the WebGL context is created. Setting this value does not impact any subsequent textures that are created, or the canvas style attributes. + */ + this.antialiasGL = GetValue(renderConfig, 'antialiasGL', true, config); - var upper = [], - lower = [], - vertex, - i; + /** + * @const {string} Phaser.Core.Config#mipmapFilter - Sets the `mipmapFilter` property when the WebGL renderer is created. + */ + this.mipmapFilter = GetValue(renderConfig, 'mipmapFilter', '', config); - // sort vertices on x-axis (y-axis for ties) - vertices = vertices.slice(0); - vertices.sort(function(vertexA, vertexB) { - var dx = vertexA.x - vertexB.x; - return dx !== 0 ? dx : vertexA.y - vertexB.y; - }); + /** + * @const {boolean} Phaser.Core.Config#desynchronized - When set to `true` it will create a desynchronized context for both 2D and WebGL. See https://developers.google.com/web/updates/2019/05/desynchronized for details. + */ + this.desynchronized = GetValue(renderConfig, 'desynchronized', false, config); - // build lower hull - for (i = 0; i < vertices.length; i += 1) { - vertex = vertices[i]; + /** + * @const {boolean} Phaser.Core.Config#roundPixels - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. + */ + this.roundPixels = GetValue(renderConfig, 'roundPixels', false, config); - while (lower.length >= 2 - && Vector.cross3(lower[lower.length - 2], lower[lower.length - 1], vertex) <= 0) { - lower.pop(); - } + /** + * @const {boolean} Phaser.Core.Config#pixelArt - Prevent pixel art from becoming blurred when scaled. It will remain crisp (tells the WebGL renderer to automatically create textures using a linear filter mode). + */ + this.pixelArt = GetValue(renderConfig, 'pixelArt', this.zoom !== 1, config); - lower.push(vertex); + if (this.pixelArt) + { + this.antialias = false; + this.antialiasGL = false; + this.roundPixels = true; } - // build upper hull - for (i = vertices.length - 1; i >= 0; i -= 1) { - vertex = vertices[i]; + /** + * @const {boolean} Phaser.Core.Config#transparent - Whether the game canvas will have a transparent background. + */ + this.transparent = GetValue(renderConfig, 'transparent', false, config); - while (upper.length >= 2 - && Vector.cross3(upper[upper.length - 2], upper[upper.length - 1], vertex) <= 0) { - upper.pop(); - } + /** + * @const {boolean} Phaser.Core.Config#clearBeforeRender - Whether the game canvas will be cleared between each rendering frame. You can disable this if you have a full-screen background image or game object. + */ + this.clearBeforeRender = GetValue(renderConfig, 'clearBeforeRender', true, config); - upper.push(vertex); - } + /** + * @const {boolean} Phaser.Core.Config#preserveDrawingBuffer - If the value is true the WebGL buffers will not be cleared and will preserve their values until cleared or overwritten by the author. + */ + this.preserveDrawingBuffer = GetValue(renderConfig, 'preserveDrawingBuffer', false, config); - // concatenation of the lower and upper hulls gives the convex hull - // omit last points because they are repeated at the beginning of the other list - upper.pop(); - lower.pop(); + /** + * @const {boolean} Phaser.Core.Config#premultipliedAlpha - In WebGL mode, sets the drawing buffer to contain colors with pre-multiplied alpha. + */ + this.premultipliedAlpha = GetValue(renderConfig, 'premultipliedAlpha', true, config); - return upper.concat(lower); - }; + /** + * @const {boolean} Phaser.Core.Config#failIfMajorPerformanceCaveat - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. + */ + this.failIfMajorPerformanceCaveat = GetValue(renderConfig, 'failIfMajorPerformanceCaveat', false, config); -})(); + /** + * @const {string} Phaser.Core.Config#powerPreference - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. + */ + this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default', config); + /** + * @const {number} Phaser.Core.Config#batchSize - The default WebGL Batch size. Represents the number of _quads_ that can be added to a single batch. + */ + this.batchSize = GetValue(renderConfig, 'batchSize', 4096, config); -/***/ }), -/* 65 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * @const {number} Phaser.Core.Config#maxTextures - When in WebGL mode, this sets the maximum number of GPU Textures to use. The default, -1, will use all available units. The WebGL1 spec says all browsers should provide a minimum of 8. + */ + this.maxTextures = GetValue(renderConfig, 'maxTextures', -1, config); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * @const {number} Phaser.Core.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. + */ + this.maxLights = GetValue(renderConfig, 'maxLights', 10, config); -var Class = __webpack_require__(0); -var Contains = __webpack_require__(66); -var GetPoint = __webpack_require__(300); -var GetPoints = __webpack_require__(301); -var GEOM_CONST = __webpack_require__(56); -var Random = __webpack_require__(170); + var bgc = GetValue(config, 'backgroundColor', 0); -/** - * @classdesc - * A Circle object. - * - * This is a geometry object, containing numerical values and related methods to inspect and modify them. - * It is not a Game Object, in that you cannot add it to the display list, and it has no texture. - * To render a Circle you should look at the capabilities of the Graphics class. - * - * @class Circle - * @memberof Phaser.Geom - * @constructor - * @since 3.0.0 - * - * @param {number} [x=0] - The x position of the center of the circle. - * @param {number} [y=0] - The y position of the center of the circle. - * @param {number} [radius=0] - The radius of the circle. - */ -var Circle = new Class({ + /** + * @const {Phaser.Display.Color} Phaser.Core.Config#backgroundColor - The background color of the game canvas. The default is black. This value is ignored if `transparent` is set to `true`. + */ + this.backgroundColor = ValueToColor(bgc); - initialize: + if (this.transparent) + { + this.backgroundColor = ValueToColor(0x000000); + this.backgroundColor.alpha = 0; + } - function Circle (x, y, radius) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (radius === undefined) { radius = 0; } + /** + * @const {Phaser.Types.Core.BootCallback} Phaser.Core.Config#preBoot - Called before Phaser boots. Useful for initializing anything not related to Phaser that Phaser may require while booting. + */ + this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); /** - * The geometry constant type of this object: `GEOM_CONST.CIRCLE`. - * Used for fast type comparisons. - * - * @name Phaser.Geom.Circle#type - * @type {number} - * @readonly - * @since 3.19.0 + * @const {Phaser.Types.Core.BootCallback} Phaser.Core.Config#postBoot - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. */ - this.type = GEOM_CONST.CIRCLE; + this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); /** - * The x position of the center of the circle. - * - * @name Phaser.Geom.Circle#x - * @type {number} - * @default 0 - * @since 3.0.0 + * @const {Phaser.Types.Core.PhysicsConfig} Phaser.Core.Config#physics - The Physics Configuration object. */ - this.x = x; + this.physics = GetValue(config, 'physics', {}); /** - * The y position of the center of the circle. - * - * @name Phaser.Geom.Circle#y - * @type {number} - * @default 0 - * @since 3.0.0 + * @const {(boolean|string)} Phaser.Core.Config#defaultPhysicsSystem - The default physics system. It will be started for each scene. Either 'arcade', 'impact' or 'matter'. */ - this.y = y; + this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); /** - * The internal radius of the circle. - * - * @name Phaser.Geom.Circle#_radius - * @type {number} - * @private - * @since 3.0.0 + * @const {string} Phaser.Core.Config#loaderBaseURL - A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. */ - this._radius = radius; + this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); /** - * The internal diameter of the circle. - * - * @name Phaser.Geom.Circle#_diameter - * @type {number} - * @private - * @since 3.0.0 + * @const {string} Phaser.Core.Config#loaderPath - A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. */ - this._diameter = radius * 2; - }, + this.loaderPath = GetValue(config, 'loader.path', ''); - /** - * Check to see if the Circle contains the given x / y coordinates. - * - * @method Phaser.Geom.Circle#contains - * @since 3.0.0 - * - * @param {number} x - The x coordinate to check within the circle. - * @param {number} y - The y coordinate to check within the circle. - * - * @return {boolean} True if the coordinates are within the circle, otherwise false. - */ - contains: function (x, y) - { - return Contains(this, x, y); - }, + /** + * @const {number} Phaser.Core.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). + */ + this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', (Device.os.android) ? 6 : 32); - /** - * Returns a Point object containing the coordinates of a point on the circumference of the Circle - * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point - * at 180 degrees around the circle. - * - * @method Phaser.Geom.Circle#getPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle. - * @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created. - * - * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the circle. - */ - getPoint: function (position, point) - { - return GetPoint(this, position, point); - }, + /** + * @const {(string|undefined)} Phaser.Core.Config#loaderCrossOrigin - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. + */ + this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); - /** - * Returns an array of Point objects containing the coordinates of the points around the circumference of the Circle, - * based on the given quantity or stepRate values. - * - * @method Phaser.Geom.Circle#getPoints - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point[]} O - [output,$return] - * - * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. - * @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate. - * @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created. - * - * @return {(array|Phaser.Geom.Point[])} An array of Point objects pertaining to the points around the circumference of the circle. - */ - getPoints: function (quantity, stepRate, output) - { - return GetPoints(this, quantity, stepRate, output); - }, + /** + * @const {string} Phaser.Core.Config#loaderResponseType - The response type of the XHR request, e.g. `blob`, `text`, etc. + */ + this.loaderResponseType = GetValue(config, 'loader.responseType', ''); - /** - * Returns a uniformly distributed random point from anywhere within the Circle. - * - * @method Phaser.Geom.Circle#getRandomPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [point,$return] - * - * @param {(Phaser.Geom.Point|object)} [point] - A Point or point-like object to set the random `x` and `y` values in. - * - * @return {(Phaser.Geom.Point|object)} A Point object with the random values set in the `x` and `y` properties. - */ - getRandomPoint: function (point) - { - return Random(this, point); - }, + /** + * @const {boolean} Phaser.Core.Config#loaderAsync - Should the XHR request use async or not? + */ + this.loaderAsync = GetValue(config, 'loader.async', true); - /** - * Sets the x, y and radius of this circle. - * - * @method Phaser.Geom.Circle#setTo - * @since 3.0.0 - * - * @param {number} [x=0] - The x position of the center of the circle. - * @param {number} [y=0] - The y position of the center of the circle. - * @param {number} [radius=0] - The radius of the circle. - * - * @return {this} This Circle object. - */ - setTo: function (x, y, radius) - { - this.x = x; - this.y = y; - this._radius = radius; - this._diameter = radius * 2; + /** + * @const {string} Phaser.Core.Config#loaderUser - Optional username for all XHR requests. + */ + this.loaderUser = GetValue(config, 'loader.user', ''); - return this; - }, + /** + * @const {string} Phaser.Core.Config#loaderPassword - Optional password for all XHR requests. + */ + this.loaderPassword = GetValue(config, 'loader.password', ''); - /** - * Sets this Circle to be empty with a radius of zero. - * Does not change its position. - * - * @method Phaser.Geom.Circle#setEmpty - * @since 3.0.0 - * - * @return {this} This Circle object. - */ - setEmpty: function () - { - this._radius = 0; - this._diameter = 0; + /** + * @const {number} Phaser.Core.Config#loaderTimeout - Optional XHR timeout value, in ms. + */ + this.loaderTimeout = GetValue(config, 'loader.timeout', 0); - return this; - }, + /** + * @const {boolean} Phaser.Core.Config#loaderWithCredentials - Optional XHR withCredentials value. + */ + this.loaderWithCredentials = GetValue(config, 'loader.withCredentials', false); - /** - * Sets the position of this Circle. - * - * @method Phaser.Geom.Circle#setPosition - * @since 3.0.0 - * - * @param {number} [x=0] - The x position of the center of the circle. - * @param {number} [y=0] - The y position of the center of the circle. - * - * @return {this} This Circle object. - */ - setPosition: function (x, y) - { - if (y === undefined) { y = x; } + /** + * @const {string} Phaser.Core.Config#loaderImageLoadType - Optional load type for image, `XHR` is default, or `HTMLImageElement` for a lightweight way. + */ + this.loaderImageLoadType = GetValue(config, 'loader.imageLoadType', 'XHR'); - this.x = x; - this.y = y; + // On iOS, Capacitor often runs on a capacitor:// protocol, meaning local files are served from capacitor:// rather than file:// + // See: https://github.com/photonstorm/phaser/issues/5685 - return this; - }, + /** + * @const {string[]} Phaser.Core.Config#loaderLocalScheme - An array of schemes that the Loader considers as being 'local' files. Defaults to: `[ 'file://', 'capacitor://' ]`. + */ + this.loaderLocalScheme = GetValue(config, 'loader.localScheme', [ 'file://', 'capacitor://' ]); - /** - * Checks to see if the Circle is empty: has a radius of zero. - * - * @method Phaser.Geom.Circle#isEmpty - * @since 3.0.0 - * - * @return {boolean} True if the Circle is empty, otherwise false. - */ - isEmpty: function () - { - return (this._radius <= 0); - }, + /** + * @const {number} Phaser.Core.Config#glowFXQuality - The quality of the Glow FX (defaults to 0.1) + */ + this.glowFXQuality = GetValue(config, 'fx.glow.quality', 0.1); - /** - * The radius of the Circle. - * - * @name Phaser.Geom.Circle#radius - * @type {number} - * @since 3.0.0 - */ - radius: { + /** + * @const {number} Phaser.Core.Config#glowFXDistance - The distance of the Glow FX (defaults to 10) + */ + this.glowFXDistance = GetValue(config, 'fx.glow.distance', 10); - get: function () - { - return this._radius; - }, + /* + * Allows `plugins` property to either be an array, in which case it just replaces + * the default plugins like previously, or a config object. + * + * plugins: { + * global: [ + * { key: 'TestPlugin', plugin: TestPlugin, start: true, data: { msg: 'The plugin is alive' } }, + * ], + * scene: [ + * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } + * ], + * default: [], OR + * defaultMerge: [ + * 'ModPlayer' + * ] + * } + */ - set: function (value) - { - this._radius = value; - this._diameter = value * 2; - } + /** + * @const {any} Phaser.Core.Config#installGlobalPlugins - An array of global plugins to be installed. + */ + this.installGlobalPlugins = []; - }, + /** + * @const {any} Phaser.Core.Config#installScenePlugins - An array of Scene level plugins to be installed. + */ + this.installScenePlugins = []; - /** - * The diameter of the Circle. - * - * @name Phaser.Geom.Circle#diameter - * @type {number} - * @since 3.0.0 - */ - diameter: { + var plugins = GetValue(config, 'plugins', null); + var defaultPlugins = DefaultPlugins.DefaultScene; - get: function () + if (plugins) { - return this._diameter; - }, - - set: function (value) - { - this._diameter = value; - this._radius = value * 0.5; + // Old 3.7 array format? + if (Array.isArray(plugins)) + { + this.defaultPlugins = plugins; + } + else if (IsPlainObject(plugins)) + { + this.installGlobalPlugins = GetFastValue(plugins, 'global', []); + this.installScenePlugins = GetFastValue(plugins, 'scene', []); + + if (Array.isArray(plugins.default)) + { + defaultPlugins = plugins.default; + } + else if (Array.isArray(plugins.defaultMerge)) + { + defaultPlugins = defaultPlugins.concat(plugins.defaultMerge); + } + } } - }, + /** + * @const {any} Phaser.Core.Config#defaultPlugins - The plugins installed into every Scene (in addition to CoreScene and Global). + */ + this.defaultPlugins = defaultPlugins; - /** - * The left position of the Circle. - * - * @name Phaser.Geom.Circle#left - * @type {number} - * @since 3.0.0 - */ - left: { + // Default / Missing Images + var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; - get: function () - { - return this.x - this._radius; - }, + /** + * @const {string} Phaser.Core.Config#defaultImage - A base64 encoded PNG that will be used as the default blank texture. + */ + this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); - set: function (value) + /** + * @const {string} Phaser.Core.Config#missingImage - A base64 encoded PNG that will be used as the default texture when a texture is assigned that is missing or not loaded. + */ + this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); + + /** + * @const {string} Phaser.Core.Config#whiteImage - A base64 encoded PNG that will be used as the default texture when a texture is assigned that is white or not loaded. + */ + this.whiteImage = GetValue(config, 'images.white', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABdJREFUeNpi/P//PwMMMDEgAdwcgAADAJZuAwXJYZOzAAAAAElFTkSuQmCC'); + + if (window) { - this.x = value + this._radius; + if (window.FORCE_WEBGL) + { + this.renderType = CONST.WEBGL; + } + else if (window.FORCE_CANVAS) + { + this.renderType = CONST.CANVAS; + } } + } - }, +}); - /** - * The right position of the Circle. - * - * @name Phaser.Geom.Circle#right - * @type {number} - * @since 3.0.0 - */ - right: { +module.exports = Config; - get: function () - { - return this.x + this._radius; - }, - set: function (value) - { - this.x = value - this._radius; - } +/***/ }), - }, +/***/ 50150: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The top position of the Circle. - * - * @name Phaser.Geom.Circle#top - * @type {number} - * @since 3.0.0 - */ - top: { +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - get: function () +var CanvasInterpolation = __webpack_require__(70616); +var CanvasPool = __webpack_require__(61068); +var CONST = __webpack_require__(86459); +var Features = __webpack_require__(90185); + +/** + * Called automatically by Phaser.Game and responsible for creating the renderer it will use. + * + * Relies upon two webpack global flags to be defined: `WEBGL_RENDERER` and `CANVAS_RENDERER` during build time, but not at run-time. + * + * @function Phaser.Core.CreateRenderer + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Phaser.Game instance on which the renderer will be set. + */ +var CreateRenderer = function (game) +{ + var config = game.config; + + if ((config.customEnvironment || config.canvas) && config.renderType === CONST.AUTO) + { + throw new Error('Must set explicit renderType in custom environment'); + } + + // Not a custom environment, didn't provide their own canvas and not headless, so determine the renderer: + if (!config.customEnvironment && !config.canvas && config.renderType !== CONST.HEADLESS) + { + if (config.renderType === CONST.AUTO) { - return this.y - this._radius; - }, + config.renderType = Features.webGL ? CONST.WEBGL : CONST.CANVAS; + } - set: function (value) + if (config.renderType === CONST.WEBGL) { - this.y = value + this._radius; + if (!Features.webGL) { throw new Error('Cannot create WebGL context, aborting.'); } + } + else if (config.renderType === CONST.CANVAS) + { + if (!Features.canvas) { throw new Error('Cannot create Canvas context, aborting.'); } + } + else + { + throw new Error('Unknown value for renderer type: ' + config.renderType); } + } - }, + // Pixel Art mode? + if (!config.antialias) + { + CanvasPool.disableSmoothing(); + } - /** - * The bottom position of the Circle. - * - * @name Phaser.Geom.Circle#bottom - * @type {number} - * @since 3.0.0 - */ - bottom: { + var baseSize = game.scale.baseSize; - get: function () - { - return this.y + this._radius; - }, + var width = baseSize.width; + var height = baseSize.height; - set: function (value) + // Does the game config provide its own canvas element to use? + if (config.canvas) + { + game.canvas = config.canvas; + + game.canvas.width = width; + game.canvas.height = height; + } + else + { + game.canvas = CanvasPool.create(game, width, height, config.renderType); + } + + // Does the game config provide some canvas css styles to use? + if (config.canvasStyle) + { + game.canvas.style = config.canvasStyle; + } + + // Pixel Art mode? + if (!config.antialias) + { + CanvasInterpolation.setCrisp(game.canvas); + } + + if (config.renderType === CONST.HEADLESS) + { + // Nothing more to do here + return; + } + + var CanvasRenderer; + var WebGLRenderer; + + if (true) + { + CanvasRenderer = __webpack_require__(91135); + WebGLRenderer = __webpack_require__(11857); + + // Let the config pick the renderer type, as both are included + if (config.renderType === CONST.WEBGL) { - this.y = value - this._radius; + game.renderer = new WebGLRenderer(game); + } + else + { + game.renderer = new CanvasRenderer(game); + game.context = game.renderer.gameContext; } - } -}); + if (false) + {} -module.exports = Circle; + if (false) + {} +}; + +module.exports = CreateRenderer; /***/ }), -/* 66 */ -/***/ (function(module, exports) { + +/***/ 77291: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var CONST = __webpack_require__(86459); + /** - * Check to see if the Circle contains the given x / y coordinates. + * Called automatically by Phaser.Game and responsible for creating the console.log debug header. * - * @function Phaser.Geom.Circle.Contains - * @since 3.0.0 + * You can customize or disable the header via the Game Config object. * - * @param {Phaser.Geom.Circle} circle - The Circle to check. - * @param {number} x - The x coordinate to check within the circle. - * @param {number} y - The y coordinate to check within the circle. + * @function Phaser.Core.DebugHeader + * @since 3.0.0 * - * @return {boolean} True if the coordinates are within the circle, otherwise false. + * @param {Phaser.Game} game - The Phaser.Game instance which will output this debug header. */ -var Contains = function (circle, x, y) +var DebugHeader = function (game) { - // Check if x/y are within the bounds first - if (circle.radius > 0 && x >= circle.left && x <= circle.right && y >= circle.top && y <= circle.bottom) + var config = game.config; + + if (config.hideBanner) { - var dx = (circle.x - x) * (circle.x - x); - var dy = (circle.y - y) * (circle.y - y); + return; + } - return (dx + dy) <= (circle.radius * circle.radius); + var renderType = 'WebGL'; + + if (config.renderType === CONST.CANVAS) + { + renderType = 'Canvas'; + } + else if (config.renderType === CONST.HEADLESS) + { + renderType = 'Headless'; + } + + var audioConfig = config.audio; + var deviceAudio = game.device.audio; + + var audioType; + + if (deviceAudio.webAudio && !audioConfig.disableWebAudio) + { + audioType = 'Web Audio'; + } + else if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData)) + { + audioType = 'No Audio'; } else { - return false; + audioType = 'HTML5 Audio'; } -}; -module.exports = Contains; + if (!game.device.browser.ie) + { + var c = ''; + var args = [ c ]; + if (Array.isArray(config.bannerBackgroundColor)) + { + var lastColor; -/***/ }), -/* 67 */ -/***/ (function(module, exports) { + config.bannerBackgroundColor.forEach(function (color) + { + c = c.concat('%c '); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + args.push('background: ' + color); -/** - * Calculate the length of the given line. - * - * @function Phaser.Geom.Line.Length - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The line to calculate the length of. - * - * @return {number} The length of the line. - */ -var Length = function (line) -{ - return Math.sqrt((line.x2 - line.x1) * (line.x2 - line.x1) + (line.y2 - line.y1) * (line.y2 - line.y1)); -}; + lastColor = color; -module.exports = Length; + }); + // inject the text color + args[args.length - 1] = 'color: ' + config.bannerTextColor + '; background: ' + lastColor; + } + else + { + c = c.concat('%c '); -/***/ }), -/* 68 */ -/***/ (function(module, exports) { + args.push('color: ' + config.bannerTextColor + '; background: ' + config.bannerBackgroundColor); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // URL link background color (always transparent to support different browser themes) + args.push('background: transparent'); -/** - * Wrap the given `value` between `min` and `max. - * - * @function Phaser.Math.Wrap - * @since 3.0.0 - * - * @param {number} value - The value to wrap. - * @param {number} min - The minimum value. - * @param {number} max - The maximum value. - * - * @return {number} The wrapped value. - */ -var Wrap = function (value, min, max) -{ - var range = max - min; + if (config.gameTitle) + { + c = c.concat(config.gameTitle); - return (min + ((((value - min) % range) + range) % range)); + if (config.gameVersion) + { + c = c.concat(' v' + config.gameVersion); + } + + if (!config.hidePhaser) + { + c = c.concat(' / '); + } + } + + var fb = ( false) ? 0 : ''; + + if (!config.hidePhaser) + { + c = c.concat('Phaser v' + CONST.VERSION + fb + ' (' + renderType + ' | ' + audioType + ')'); + } + + c = c.concat(' %c ' + config.gameURL); + + // Inject the new string back into the args array + args[0] = c; + + console.log.apply(console, args); + } + else if (window['console']) + { + console.log('Phaser v' + CONST.VERSION + ' / https://phaser.io'); + } }; -module.exports = Wrap; +module.exports = DebugHeader; /***/ }), -/* 69 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 15213: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Vector3 = __webpack_require__(39); +var AddToDOM = __webpack_require__(99584); +var AnimationManager = __webpack_require__(90249); +var CacheManager = __webpack_require__(43474); +var CanvasPool = __webpack_require__(61068); +var Class = __webpack_require__(56694); +var Config = __webpack_require__(14033); +var CreateDOMContainer = __webpack_require__(85178); +var CreateRenderer = __webpack_require__(50150); +var DataManager = __webpack_require__(81078); +var DebugHeader = __webpack_require__(77291); +var Device = __webpack_require__(77290); +var DOMContentLoaded = __webpack_require__(21546); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(97081); +var InputManager = __webpack_require__(69898); +var PluginCache = __webpack_require__(91963); +var PluginManager = __webpack_require__(49274); +var ScaleManager = __webpack_require__(756); +var SceneManager = __webpack_require__(13553); +var TextureEvents = __webpack_require__(38203); +var TextureManager = __webpack_require__(6237); +var TimeStep = __webpack_require__(26617); +var VisibilityHandler = __webpack_require__(26493); -/** - * @ignore - */ -var EPSILON = 0.000001; +if (true) +{ + var SoundManagerCreator = __webpack_require__(84191); +} + +if (false) +{ var FacebookInstantGamesPlugin; } /** * @classdesc - * A four-dimensional matrix. + * The Phaser.Game instance is the main controller for the entire Phaser game. It is responsible + * for handling the boot process, parsing the configuration values, creating the renderer, + * and setting-up all of the global Phaser systems, such as sound and input. + * Once that is complete it will start the Scene Manager and then begin the main game loop. * - * Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji - * and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + * You should generally avoid accessing any of the systems created by Game, and instead use those + * made available to you via the Phaser.Scene Systems class instead. * - * @class Matrix4 - * @memberof Phaser.Math + * @class Game + * @memberof Phaser * @constructor + * @fires Phaser.Core.Events#BLUR + * @fires Phaser.Core.Events#FOCUS + * @fires Phaser.Core.Events#HIDDEN + * @fires Phaser.Core.Events#VISIBLE * @since 3.0.0 * - * @param {Phaser.Math.Matrix4} [m] - Optional Matrix4 to copy values from. + * @param {Phaser.Types.Core.GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. */ -var Matrix4 = new Class({ +var Game = new Class({ initialize: - function Matrix4 (m) + function Game (config) { /** - * The matrix values. + * The parsed Game Configuration object. * - * @name Phaser.Math.Matrix4#val - * @type {Float32Array} + * The values stored within this object are read-only and should not be changed at run-time. + * + * @name Phaser.Game#config + * @type {Phaser.Core.Config} + * @readonly * @since 3.0.0 */ - this.val = new Float32Array(16); + this.config = new Config(config); - if (m) - { - // Assume Matrix4 with val: - this.copy(m); - } - else + /** + * A reference to either the Canvas or WebGL Renderer that this Game is using. + * + * @name Phaser.Game#renderer + * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} + * @since 3.0.0 + */ + this.renderer = null; + + /** + * A reference to an HTML Div Element used as the DOM Element Container. + * + * Only set if `createDOMContainer` is `true` in the game config (by default it is `false`) and + * if you provide a parent element to insert the Phaser Game inside. + * + * See the DOM Element Game Object for more details. + * + * @name Phaser.Game#domContainer + * @type {HTMLDivElement} + * @since 3.17.0 + */ + this.domContainer = null; + + /** + * A reference to the HTML Canvas Element that Phaser uses to render the game. + * This is created automatically by Phaser unless you provide a `canvas` property + * in your Game Config. + * + * @name Phaser.Game#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.canvas = null; + + /** + * A reference to the Rendering Context belonging to the Canvas Element this game is rendering to. + * If the game is running under Canvas it will be a 2d Canvas Rendering Context. + * If the game is running under WebGL it will be a WebGL Rendering Context. + * This context is created automatically by Phaser unless you provide a `context` property + * in your Game Config. + * + * @name Phaser.Game#context + * @type {(CanvasRenderingContext2D|WebGLRenderingContext)} + * @since 3.0.0 + */ + this.context = null; + + /** + * A flag indicating when this Game instance has finished its boot process. + * + * @name Phaser.Game#isBooted + * @type {boolean} + * @readonly + * @since 3.0.0 + */ + this.isBooted = false; + + /** + * A flag indicating if this Game is currently running its game step or not. + * + * @name Phaser.Game#isRunning + * @type {boolean} + * @readonly + * @since 3.0.0 + */ + this.isRunning = false; + + /** + * An Event Emitter which is used to broadcast game-level events from the global systems. + * + * @name Phaser.Game#events + * @type {Phaser.Events.EventEmitter} + * @since 3.0.0 + */ + this.events = new EventEmitter(); + + /** + * An instance of the Animation Manager. + * + * The Animation Manager is a global system responsible for managing all animations used within your game. + * + * @name Phaser.Game#anims + * @type {Phaser.Animations.AnimationManager} + * @since 3.0.0 + */ + this.anims = new AnimationManager(this); + + /** + * An instance of the Texture Manager. + * + * The Texture Manager is a global system responsible for managing all textures being used by your game. + * + * @name Phaser.Game#textures + * @type {Phaser.Textures.TextureManager} + * @since 3.0.0 + */ + this.textures = new TextureManager(this); + + /** + * An instance of the Cache Manager. + * + * The Cache Manager is a global system responsible for caching, accessing and releasing external game assets. + * + * @name Phaser.Game#cache + * @type {Phaser.Cache.CacheManager} + * @since 3.0.0 + */ + this.cache = new CacheManager(this); + + /** + * An instance of the Data Manager. This is a global manager, available from any Scene + * and allows you to share and exchange your own game-level data or events without having + * to use an internal event system. + * + * @name Phaser.Game#registry + * @type {Phaser.Data.DataManager} + * @since 3.0.0 + */ + this.registry = new DataManager(this, new EventEmitter()); + + /** + * An instance of the Input Manager. + * + * The Input Manager is a global system responsible for the capture of browser-level input events. + * + * @name Phaser.Game#input + * @type {Phaser.Input.InputManager} + * @since 3.0.0 + */ + this.input = new InputManager(this, this.config); + + /** + * An instance of the Scene Manager. + * + * The Scene Manager is a global system responsible for creating, modifying and updating the Scenes in your game. + * + * @name Phaser.Game#scene + * @type {Phaser.Scenes.SceneManager} + * @since 3.0.0 + */ + this.scene = new SceneManager(this, this.config.sceneConfig); + + /** + * A reference to the Device inspector. + * + * Contains information about the device running this game, such as OS, browser vendor and feature support. + * Used by various systems to determine capabilities and code paths. + * + * @name Phaser.Game#device + * @type {Phaser.DeviceConf} + * @since 3.0.0 + */ + this.device = Device; + + /** + * An instance of the Scale Manager. + * + * The Scale Manager is a global system responsible for handling scaling of the game canvas. + * + * @name Phaser.Game#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 + */ + this.scale = new ScaleManager(this, this.config); + + /** + * An instance of the base Sound Manager. + * + * The Sound Manager is a global system responsible for the playback and updating of all audio in your game. + * + * You can disable the inclusion of the Sound Manager in your build by toggling the webpack `FEATURE_SOUND` flag. + * + * @name Phaser.Game#sound + * @type {(Phaser.Sound.NoAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager|Phaser.Sound.WebAudioSoundManager)} + * @since 3.0.0 + */ + this.sound = null; + + if (true) { - // Default to identity - this.identity(); + this.sound = SoundManagerCreator.create(this); } - }, - /** - * Make a clone of this Matrix4. - * - * @method Phaser.Math.Matrix4#clone - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix4} A clone of this Matrix4. - */ - clone: function () - { - return new Matrix4(this); + /** + * An instance of the Time Step. + * + * The Time Step is a global system responsible for setting-up and responding to the browser frame events, processing + * them and calculating delta values. It then automatically calls the game step. + * + * @name Phaser.Game#loop + * @type {Phaser.Core.TimeStep} + * @since 3.0.0 + */ + this.loop = new TimeStep(this, this.config.fps); + + /** + * An instance of the Plugin Manager. + * + * The Plugin Manager is a global system that allows plugins to register themselves with it, and can then install + * those plugins into Scenes as required. + * + * @name Phaser.Game#plugins + * @type {Phaser.Plugins.PluginManager} + * @since 3.0.0 + */ + this.plugins = new PluginManager(this, this.config); + + if (false) + {} + + /** + * Is this Game pending destruction at the start of the next frame? + * + * @name Phaser.Game#pendingDestroy + * @type {boolean} + * @private + * @since 3.5.0 + */ + this.pendingDestroy = false; + + /** + * Remove the Canvas once the destroy is over? + * + * @name Phaser.Game#removeCanvas + * @type {boolean} + * @private + * @since 3.5.0 + */ + this.removeCanvas = false; + + /** + * Remove everything when the game is destroyed. + * You cannot create a new Phaser instance on the same web page after doing this. + * + * @name Phaser.Game#noReturn + * @type {boolean} + * @private + * @since 3.12.0 + */ + this.noReturn = false; + + /** + * Does the window the game is running in currently have focus or not? + * This is modified by the VisibilityHandler. + * + * @name Phaser.Game#hasFocus + * @type {boolean} + * @readonly + * @since 3.9.0 + */ + this.hasFocus = false; + + /** + * Is the Game currently paused? This will stop everything from updating, + * except the `TimeStep` and related RequestAnimationFrame or setTimeout. + * Those will continue stepping, but the core Game step will be skipped. + * + * @name Phaser.Game#isPaused + * @type {boolean} + * @since 3.60.0 + */ + this.isPaused = false; + + // Wait for the DOM Ready event, then call boot. + DOMContentLoaded(this.boot.bind(this)); }, /** - * This method is an alias for `Matrix4.copy`. + * This method is called automatically when the DOM is ready. It is responsible for creating the renderer, + * displaying the Debug Header, adding the game canvas to the DOM and emitting the 'boot' event. + * It listens for a 'ready' event from the base systems and once received it will call `Game.start`. * - * @method Phaser.Math.Matrix4#set + * @method Phaser.Game#boot + * @protected + * @fires Phaser.Core.Events#BOOT + * @listens Phaser.Textures.Events#READY * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to set the values of this Matrix's from. - * - * @return {this} This Matrix4. */ - set: function (src) + boot: function () { - return this.copy(src); - }, + if (!PluginCache.hasCore('EventEmitter')) + { + console.warn('Aborting. Core Plugins missing.'); + return; + } - /** - * Sets all values of this Matrix4. - * - * @method Phaser.Math.Matrix4#setValues - * @since 3.50.0 - * - * @param {number} m00 - The m00 value. - * @param {number} m01 - The m01 value. - * @param {number} m02 - The m02 value. - * @param {number} m03 - The m03 value. - * @param {number} m10 - The m10 value. - * @param {number} m11 - The m11 value. - * @param {number} m12 - The m12 value. - * @param {number} m13 - The m13 value. - * @param {number} m20 - The m20 value. - * @param {number} m21 - The m21 value. - * @param {number} m22 - The m22 value. - * @param {number} m23 - The m23 value. - * @param {number} m30 - The m30 value. - * @param {number} m31 - The m31 value. - * @param {number} m32 - The m32 value. - * @param {number} m33 - The m33 value. - * - * @return {this} This Matrix4 instance. - */ - setValues: function (m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) - { - var out = this.val; + this.isBooted = true; - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m03; - out[4] = m10; - out[5] = m11; - out[6] = m12; - out[7] = m13; - out[8] = m20; - out[9] = m21; - out[10] = m22; - out[11] = m23; - out[12] = m30; - out[13] = m31; - out[14] = m32; - out[15] = m33; + this.config.preBoot(this); - return this; + this.scale.preBoot(); + + CreateRenderer(this); + + CreateDOMContainer(this); + + DebugHeader(this); + + AddToDOM(this.canvas, this.config.parent); + + // The Texture Manager has to wait on a couple of non-blocking events before it's fully ready. + // So it will emit this internal event when done: + this.textures.once(TextureEvents.READY, this.texturesReady, this); + + this.events.emit(Events.BOOT); + + if (false) + {} }, /** - * Copy the values of a given Matrix into this Matrix. - * - * @method Phaser.Math.Matrix4#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to copy the values from. + * Called automatically when the Texture Manager has finished setting up and preparing the + * default textures. * - * @return {this} This Matrix4. + * @method Phaser.Game#texturesReady + * @private + * @fires Phaser.Game#READY + * @since 3.12.0 */ - copy: function (src) + texturesReady: function () { - var a = src.val; + // Start all the other systems + this.events.emit(Events.READY); - return this.setValues(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); + this.start(); }, /** - * Set the values of this Matrix from the given array. + * Called automatically by Game.boot once all of the global systems have finished setting themselves up. + * By this point the Game is now ready to start the main loop running. + * It will also enable the Visibility Handler. * - * @method Phaser.Math.Matrix4#fromArray + * @method Phaser.Game#start + * @protected * @since 3.0.0 - * - * @param {number[]} a - The array to copy the values from. Must have at least 16 elements. - * - * @return {this} This Matrix4. */ - fromArray: function (a) + start: function () { - return this.setValues(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); + this.isRunning = true; + + this.config.postBoot(this); + + if (this.renderer) + { + this.loop.start(this.step.bind(this)); + } + else + { + this.loop.start(this.headlessStep.bind(this)); + } + + VisibilityHandler(this); + + var eventEmitter = this.events; + + eventEmitter.on(Events.HIDDEN, this.onHidden, this); + eventEmitter.on(Events.VISIBLE, this.onVisible, this); + eventEmitter.on(Events.BLUR, this.onBlur, this); + eventEmitter.on(Events.FOCUS, this.onFocus, this); }, /** - * Reset this Matrix. + * The main Game Step. Called automatically by the Time Step, once per browser frame (typically as a result of + * Request Animation Frame, or Set Timeout on very old browsers.) * - * Sets all values to `0`. + * The step will update the global managers first, then proceed to update each Scene in turn, via the Scene Manager. * - * @method Phaser.Math.Matrix4#zero + * It will then render each Scene in turn, via the Renderer. This process emits `prerender` and `postrender` events. + * + * @method Phaser.Game#step + * @fires Phaser.Core.Events#PRE_STEP + * @fires Phaser.Core.Events#STEP + * @fires Phaser.Core.Events#POST_STEP + * @fires Phaser.Core.Events#PRE_RENDER + * @fires Phaser.Core.Events#POST_RENDER * @since 3.0.0 * - * @return {Phaser.Math.Matrix4} This Matrix4. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ - zero: function () + step: function (time, delta) { - return this.setValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + if (this.pendingDestroy) + { + return this.runDestroy(); + } + + if (this.isPaused) + { + return; + } + + var eventEmitter = this.events; + + // Global Managers like Input and Sound update in the prestep + + eventEmitter.emit(Events.PRE_STEP, time, delta); + + // This is mostly meant for user-land code and plugins + + eventEmitter.emit(Events.STEP, time, delta); + + // Update the Scene Manager and all active Scenes + + this.scene.update(time, delta); + + // Our final event before rendering starts + + eventEmitter.emit(Events.POST_STEP, time, delta); + + var renderer = this.renderer; + + // Run the Pre-render (clearing the canvas, setting background colors, etc) + + renderer.preRender(); + + eventEmitter.emit(Events.PRE_RENDER, renderer, time, delta); + + // The main render loop. Iterates all Scenes and all Cameras in those scenes, rendering to the renderer instance. + + this.scene.render(renderer); + + // The Post-Render call. Tidies up loose end, takes snapshots, etc. + + renderer.postRender(); + + // The final event before the step repeats. Your last chance to do anything to the canvas before it all starts again. + + eventEmitter.emit(Events.POST_RENDER, renderer, time, delta); }, /** - * Generates a transform matrix based on the given position, scale and rotation. + * A special version of the Game Step for the HEADLESS renderer only. * - * @method Phaser.Math.Matrix4#transform - * @since 3.50.0 + * The main Game Step. Called automatically by the Time Step, once per browser frame (typically as a result of + * Request Animation Frame, or Set Timeout on very old browsers.) * - * @param {Phaser.Math.Vector3} position - The position vector. - * @param {Phaser.Math.Vector3} scale - The scale vector. - * @param {Phaser.Math.Quaternion} rotation - The rotation quaternion. + * The step will update the global managers first, then proceed to update each Scene in turn, via the Scene Manager. * - * @return {this} This Matrix4. + * This process emits `prerender` and `postrender` events, even though nothing actually displays. + * + * @method Phaser.Game#headlessStep + * @fires Phaser.Game#PRE_RENDER + * @fires Phaser.Game#POST_RENDER + * @since 3.2.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ - transform: function (position, scale, rotation) + headlessStep: function (time, delta) { - var rotMatrix = _tempMat1.fromQuat(rotation); + if (this.pendingDestroy) + { + return this.runDestroy(); + } - var rm = rotMatrix.val; + if (this.isPaused) + { + return; + } - var sx = scale.x; - var sy = scale.y; - var sz = scale.z; + var eventEmitter = this.events; - return this.setValues( - rm[0] * sx, - rm[1] * sx, - rm[2] * sx, - 0, + // Global Managers like Input and Sound update in the prestep - rm[4] * sy, - rm[5] * sy, - rm[6] * sy, - 0, + eventEmitter.emit(Events.PRE_STEP, time, delta); - rm[8] * sz, - rm[9] * sz, - rm[10] * sz, - 0, + // This is mostly meant for user-land code and plugins - position.x, - position.y, - position.z, - 1 - ); + eventEmitter.emit(Events.STEP, time, delta); + + // Update the Scene Manager and all active Scenes + + this.scene.update(time, delta); + + // Our final event before rendering starts + + eventEmitter.emit(Events.POST_STEP, time, delta); + + // Render + this.scene.isProcessing = false; + + eventEmitter.emit(Events.PRE_RENDER, null, time, delta); + + eventEmitter.emit(Events.POST_RENDER, null, time, delta); }, /** - * Set the `x`, `y` and `z` values of this Matrix. + * Called automatically by the Visibility Handler. + * This will pause the main loop and then emit a pause event. * - * @method Phaser.Math.Matrix4#xyz + * @method Phaser.Game#onHidden + * @protected + * @fires Phaser.Core.Events#PAUSE * @since 3.0.0 - * - * @param {number} x - The x value. - * @param {number} y - The y value. - * @param {number} z - The z value. - * - * @return {this} This Matrix4. */ - xyz: function (x, y, z) + onHidden: function () { - this.identity(); - - var out = this.val; - - out[12] = x; - out[13] = y; - out[14] = z; + this.loop.pause(); - return this; + this.events.emit(Events.PAUSE); }, /** - * Set the scaling values of this Matrix. + * This will pause the entire game and emit a `PAUSE` event. * - * @method Phaser.Math.Matrix4#scaling - * @since 3.0.0 + * All of Phaser's internal systems will be paused and the game will not re-render. * - * @param {number} x - The x scaling value. - * @param {number} y - The y scaling value. - * @param {number} z - The z scaling value. + * Note that it does not pause any Loader requests that are currently in-flight. * - * @return {this} This Matrix4. + * @method Phaser.Game#pause + * @fires Phaser.Core.Events#PAUSE + * @since 3.60.0 */ - scaling: function (x, y, z) + pause: function () { - this.zero(); - - var out = this.val; + var wasPaused = this.isPaused; - out[0] = x; - out[5] = y; - out[10] = z; - out[15] = 1; + this.isPaused = true; - return this; + if (!wasPaused) + { + this.events.emit(Events.PAUSE); + } }, /** - * Reset this Matrix to an identity (default) matrix. + * Called automatically by the Visibility Handler. + * This will resume the main loop and then emit a resume event. * - * @method Phaser.Math.Matrix4#identity + * @method Phaser.Game#onVisible + * @protected + * @fires Phaser.Core.Events#RESUME * @since 3.0.0 - * - * @return {this} This Matrix4. */ - identity: function () + onVisible: function () { - return this.setValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + this.loop.resume(); + + this.events.emit(Events.RESUME); }, /** - * Transpose this Matrix. + * This will resume the entire game and emit a `RESUME` event. * - * @method Phaser.Math.Matrix4#transpose - * @since 3.0.0 + * All of Phaser's internal systems will be resumed and the game will start rendering again. * - * @return {this} This Matrix4. + * @method Phaser.Game#resume + * @fires Phaser.Core.Events#RESUME + * @since 3.60.0 */ - transpose: function () + resume: function () { - var a = this.val; + var wasPaused = this.isPaused; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a12 = a[6]; - var a13 = a[7]; - var a23 = a[11]; + this.isPaused = false; - a[1] = a[4]; - a[2] = a[8]; - a[3] = a[12]; - a[4] = a01; - a[6] = a[9]; - a[7] = a[13]; - a[8] = a02; - a[9] = a12; - a[11] = a[14]; - a[12] = a03; - a[13] = a13; - a[14] = a23; + if (wasPaused) + { + this.events.emit(Events.RESUME); + } + }, - return this; + /** + * Called automatically by the Visibility Handler. + * This will set the main loop into a 'blurred' state, which pauses it. + * + * @method Phaser.Game#onBlur + * @protected + * @since 3.0.0 + */ + onBlur: function () + { + this.hasFocus = false; + + this.loop.blur(); }, /** - * Copies the given Matrix4 into this Matrix and then inverses it. + * Called automatically by the Visibility Handler. + * This will set the main loop into a 'focused' state, which resumes it. * - * @method Phaser.Math.Matrix4#getInverse - * @since 3.50.0 + * @method Phaser.Game#onFocus + * @protected + * @since 3.0.0 + */ + onFocus: function () + { + this.hasFocus = true; + + this.loop.focus(); + }, + + /** + * Returns the current game frame. * - * @param {Phaser.Math.Matrix4} m - The Matrix4 to invert into this Matrix4. + * When the game starts running, the frame is incremented every time Request Animation Frame, or Set Timeout, fires. * - * @return {this} This Matrix4. + * @method Phaser.Game#getFrame + * @since 3.16.0 + * + * @return {number} The current game frame. */ - getInverse: function (m) + getFrame: function () { - this.copy(m); + return this.loop.frame; + }, - return this.invert(); + /** + * Returns the time that the current game step started at, as based on `performance.now`. + * + * @method Phaser.Game#getTime + * @since 3.16.0 + * + * @return {number} The current game timestamp. + */ + getTime: function () + { + return this.loop.now; }, /** - * Invert this Matrix. + * Flags this Game instance as needing to be destroyed on the _next frame_, making this an asynchronous operation. * - * @method Phaser.Math.Matrix4#invert + * It will wait until the current frame has completed and then call `runDestroy` internally. + * + * If you need to react to the games eventual destruction, listen for the `DESTROY` event. + * + * If you **do not** need to run Phaser again on the same web page you can set the `noReturn` argument to `true` and it will free-up + * memory being held by the core Phaser plugins. If you do need to create another game instance on the same page, leave this as `false`. + * + * @method Phaser.Game#destroy + * @fires Phaser.Core.Events#DESTROY * @since 3.0.0 * - * @return {this} This Matrix4. + * @param {boolean} removeCanvas - Set to `true` if you would like the parent canvas element removed from the DOM, or `false` to leave it in place. + * @param {boolean} [noReturn=false] - If `true` all the core Phaser plugins are destroyed. You cannot create another instance of Phaser on the same web page if you do this. */ - invert: function () + destroy: function (removeCanvas, noReturn) { - var a = this.val; + if (noReturn === undefined) { noReturn = false; } - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; + this.pendingDestroy = true; - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; + this.removeCanvas = removeCanvas; + this.noReturn = noReturn; + }, - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; + /** + * Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes. + * + * @method Phaser.Game#runDestroy + * @private + * @since 3.5.0 + */ + runDestroy: function () + { + this.scene.destroy(); - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; + this.events.emit(Events.DESTROY); - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; + this.events.removeAllListeners(); - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; + if (this.renderer) + { + this.renderer.destroy(); + } - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; + if (this.removeCanvas && this.canvas) + { + CanvasPool.remove(this.canvas); - // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (this.canvas.parentNode) + { + this.canvas.parentNode.removeChild(this.canvas); + } + } - if (!det) + if (this.domContainer) { - return this; + this.domContainer.parentNode.removeChild(this.domContainer); } - det = 1 / det; + this.loop.destroy(); - return this.setValues( - (a11 * b11 - a12 * b10 + a13 * b09) * det, - (a02 * b10 - a01 * b11 - a03 * b09) * det, - (a31 * b05 - a32 * b04 + a33 * b03) * det, - (a22 * b04 - a21 * b05 - a23 * b03) * det, - (a12 * b08 - a10 * b11 - a13 * b07) * det, - (a00 * b11 - a02 * b08 + a03 * b07) * det, - (a32 * b02 - a30 * b05 - a33 * b01) * det, - (a20 * b05 - a22 * b02 + a23 * b01) * det, - (a10 * b10 - a11 * b08 + a13 * b06) * det, - (a01 * b08 - a00 * b10 - a03 * b06) * det, - (a30 * b04 - a31 * b02 + a33 * b00) * det, - (a21 * b02 - a20 * b04 - a23 * b00) * det, - (a11 * b07 - a10 * b09 - a12 * b06) * det, - (a00 * b09 - a01 * b07 + a02 * b06) * det, - (a31 * b01 - a30 * b03 - a32 * b00) * det, - (a20 * b03 - a21 * b01 + a22 * b00) * det - ); - }, + this.pendingDestroy = false; + } - /** - * Calculate the adjoint, or adjugate, of this Matrix. - * - * @method Phaser.Math.Matrix4#adjoint - * @since 3.0.0 - * - * @return {this} This Matrix4. - */ - adjoint: function () - { - var a = this.val; +}); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; +module.exports = Game; - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; +/** + * "Computers are good at following instructions, but not at reading your mind." - Donald Knuth + */ - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; +/***/ }), - return this.setValues( - (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)), - -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)), - (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)), - -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)), - -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)), - (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)), - -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)), - (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)), - (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)), - -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)), - (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)), - -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)), - -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)), - (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)), - -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)), - (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)) - ); - }, +/***/ 26617: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Calculate the determinant of this Matrix. - * - * @method Phaser.Math.Matrix4#determinant - * @since 3.0.0 - * - * @return {number} The determinant of this Matrix. - */ - determinant: function () +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var GetValue = __webpack_require__(10850); +var NOOP = __webpack_require__(72283); +var RequestAnimationFrame = __webpack_require__(27385); + +// http://www.testufo.com/#test=animation-time-graph + +/** + * @classdesc + * The core runner class that Phaser uses to handle the game loop. It can use either Request Animation Frame, + * or SetTimeout, based on browser support and config settings, to create a continuous loop within the browser. + * + * Each time the loop fires, `TimeStep.step` is called and this is then passed onto the core Game update loop, + * it is the core heartbeat of your game. It will fire as often as Request Animation Frame is capable of handling + * on the target device. + * + * Note that there are lots of situations where a browser will stop updating your game. Such as if the player + * switches tabs, or covers up the browser window with another application. In these cases, the 'heartbeat' + * of your game will pause, and only resume when focus is returned to it by the player. There is no way to avoid + * this situation, all you can do is use the visibility events the browser, and Phaser, provide to detect when + * it has happened and then gracefully recover. + * + * @class TimeStep + * @memberof Phaser.Core + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this Time Step. + * @param {Phaser.Types.Core.FPSConfig} config + */ +var TimeStep = new Class({ + + initialize: + + function TimeStep (game, config) { - var a = this.val; + /** + * A reference to the Phaser.Game instance. + * + * @name Phaser.Core.TimeStep#game + * @type {Phaser.Game} + * @readonly + * @since 3.0.0 + */ + this.game = game; - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; + /** + * The Request Animation Frame DOM Event handler. + * + * @name Phaser.Core.TimeStep#raf + * @type {Phaser.DOM.RequestAnimationFrame} + * @readonly + * @since 3.0.0 + */ + this.raf = new RequestAnimationFrame(); - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; + /** + * A flag that is set once the TimeStep has started running and toggled when it stops. + * + * @name Phaser.Core.TimeStep#started + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.started = false; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; + /** + * A flag that is set once the TimeStep has started running and toggled when it stops. + * The difference between this value and `started` is that `running` is toggled when + * the TimeStep is sent to sleep, where-as `started` remains `true`, only changing if + * the TimeStep is actually stopped, not just paused. + * + * @name Phaser.Core.TimeStep#running + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.running = false; - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; + /** + * The minimum fps rate you want the Time Step to run at. + * + * Setting this cannot guarantee the browser runs at this rate, it merely influences + * the internal timing values to help the Timestep know when it has gone out of sync. + * + * @name Phaser.Core.TimeStep#minFps + * @type {number} + * @default 5 + * @since 3.0.0 + */ + this.minFps = GetValue(config, 'min', 5); - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; + /** + * The target fps rate for the Time Step to run at. + * + * Setting this value will not actually change the speed at which the browser runs, that is beyond + * the control of Phaser. Instead, it allows you to determine performance issues and if the Time Step + * is spiraling out of control. + * + * @name Phaser.Core.TimeStep#targetFps + * @type {number} + * @default 60 + * @since 3.0.0 + */ + this.targetFps = GetValue(config, 'target', 60); - // Calculate the determinant - return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - }, + /** + * Enforce a frame rate limit. This forces how often the Game step will run. By default it is zero, + * which means it will run at whatever limit the browser (via RequestAnimationFrame) can handle, which + * is the optimum rate for fast-action or responsive games. + * + * However, if you are building a non-game app, like a graphics generator, or low-intensity game that doesn't + * require 60fps, then you can lower the step rate via this Game Config value: + * + * ```js + * fps: { + * limit: 30 + * } + * ``` + * + * Setting this _beyond_ the rate of RequestAnimationFrame will make no difference at all. + * + * Use it purely to _restrict_ updates in low-intensity situations only. + * + * @name Phaser.Core.TimeStep#fpsLimit + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.fpsLimit = GetValue(config, 'limit', 0); - /** - * Multiply this Matrix by the given Matrix. - * - * @method Phaser.Math.Matrix4#multiply - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix to multiply this Matrix by. - * - * @return {this} This Matrix4. - */ - multiply: function (src) - { - var a = this.val; + /** + * Is the FPS rate limited? + * + * This is set by setting the Game Config `limit` value to a value above zero. + * + * Consider this property as read-only. + * + * @name Phaser.Core.TimeStep#hasFpsLimit + * @type {boolean} + * @default false + * @since 3.60.0 + */ + this.hasFpsLimit = (this.fpsLimit > 0); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; + /** + * Internal value holding the fps rate limit in ms. + * + * @name Phaser.Core.TimeStep#_limitRate + * @type {number} + * @private + * @since 3.60.0 + */ + this._limitRate = (this.hasFpsLimit) ? (1000 / this.fpsLimit) : 0; - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; + /** + * The minimum fps value in ms. + * + * Defaults to 200ms between frames (i.e. super slow!) + * + * @name Phaser.Core.TimeStep#_min + * @type {number} + * @private + * @since 3.0.0 + */ + this._min = 1000 / this.minFps; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; + /** + * The target fps value in ms. + * + * Defaults to 16.66ms between frames (i.e. normal) + * + * @name Phaser.Core.TimeStep#_target + * @type {number} + * @private + * @since 3.0.0 + */ + this._target = 1000 / this.targetFps; - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; + /** + * An exponential moving average of the frames per second. + * + * @name Phaser.Core.TimeStep#actualFps + * @type {number} + * @readonly + * @default 60 + * @since 3.0.0 + */ + this.actualFps = this.targetFps; - var b = src.val; + /** + * The time at which the next fps rate update will take place. + * + * When an fps update happens, the `framesThisSecond` value is reset. + * + * @name Phaser.Core.TimeStep#nextFpsUpdate + * @type {number} + * @readonly + * @default 0 + * @since 3.0.0 + */ + this.nextFpsUpdate = 0; - // Cache only the current line of the second matrix - var b0 = b[0]; - var b1 = b[1]; - var b2 = b[2]; - var b3 = b[3]; + /** + * The number of frames processed this second. + * + * @name Phaser.Core.TimeStep#framesThisSecond + * @type {number} + * @readonly + * @default 0 + * @since 3.0.0 + */ + this.framesThisSecond = 0; - a[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + /** + * A callback to be invoked each time the TimeStep steps. + * + * @name Phaser.Core.TimeStep#callback + * @type {Phaser.Types.Core.TimeStepCallback} + * @default NOOP + * @since 3.0.0 + */ + this.callback = NOOP; - b0 = b[4]; - b1 = b[5]; - b2 = b[6]; - b3 = b[7]; + /** + * You can force the TimeStep to use SetTimeOut instead of Request Animation Frame by setting + * the `forceSetTimeOut` property to `true` in the Game Configuration object. It cannot be changed at run-time. + * + * @name Phaser.Core.TimeStep#forceSetTimeOut + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.forceSetTimeOut = GetValue(config, 'forceSetTimeOut', false); - a[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + /** + * The time, updated each step by adding the elapsed delta time to the previous value. + * + * This differs from the `TimeStep.now` value, which is the high resolution time value + * as provided by Request Animation Frame. + * + * @name Phaser.Core.TimeStep#time + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.time = 0; - b0 = b[8]; - b1 = b[9]; - b2 = b[10]; - b3 = b[11]; + /** + * The time at which the game started running. + * + * This value is adjusted if the game is then paused and resumes. + * + * @name Phaser.Core.TimeStep#startTime + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.startTime = 0; - a[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + /** + * The time of the previous step. + * + * This is typically a high resolution timer value, as provided by Request Animation Frame. + * + * @name Phaser.Core.TimeStep#lastTime + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.lastTime = 0; - b0 = b[12]; - b1 = b[13]; - b2 = b[14]; - b3 = b[15]; + /** + * The current frame the game is on. This counter is incremented once every game step, regardless of how much + * time has passed and is unaffected by delta smoothing. + * + * @name Phaser.Core.TimeStep#frame + * @type {number} + * @readonly + * @default 0 + * @since 3.0.0 + */ + this.frame = 0; - a[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - a[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - a[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - a[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + /** + * Is the browser currently considered in focus by the Page Visibility API? + * + * This value is set in the `blur` method, which is called automatically by the Game instance. + * + * @name Phaser.Core.TimeStep#inFocus + * @type {boolean} + * @readonly + * @default true + * @since 3.0.0 + */ + this.inFocus = true; - return this; - }, + /** + * The timestamp at which the game became paused, as determined by the Page Visibility API. + * + * @name Phaser.Core.TimeStep#_pauseTime + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._pauseTime = 0; - /** - * Multiply the values of this Matrix4 by those given in the `src` argument. - * - * @method Phaser.Math.Matrix4#multiplyLocal - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} src - The source Matrix4 that this Matrix4 is multiplied by. - * - * @return {this} This Matrix4. - */ - multiplyLocal: function (src) - { - var a = this.val; - var b = src.val; + /** + * An internal counter to allow for the browser 'cooling down' after coming back into focus. + * + * @name Phaser.Core.TimeStep#_coolDown + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._coolDown = 0; - return this.setValues( - a[0] * b[0] + a[1] * b[4] + a[2] * b[8] + a[3] * b[12], - a[0] * b[1] + a[1] * b[5] + a[2] * b[9] + a[3] * b[13], - a[0] * b[2] + a[1] * b[6] + a[2] * b[10] + a[3] * b[14], - a[0] * b[3] + a[1] * b[7] + a[2] * b[11] + a[3] * b[15], + /** + * The delta time, in ms, since the last game step. This is a clamped and smoothed average value. + * + * @name Phaser.Core.TimeStep#delta + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.delta = 0; - a[4] * b[0] + a[5] * b[4] + a[6] * b[8] + a[7] * b[12], - a[4] * b[1] + a[5] * b[5] + a[6] * b[9] + a[7] * b[13], - a[4] * b[2] + a[5] * b[6] + a[6] * b[10] + a[7] * b[14], - a[4] * b[3] + a[5] * b[7] + a[6] * b[11] + a[7] * b[15], + /** + * Internal index of the delta history position. + * + * @name Phaser.Core.TimeStep#deltaIndex + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.deltaIndex = 0; - a[8] * b[0] + a[9] * b[4] + a[10] * b[8] + a[11] * b[12], - a[8] * b[1] + a[9] * b[5] + a[10] * b[9] + a[11] * b[13], - a[8] * b[2] + a[9] * b[6] + a[10] * b[10] + a[11] * b[14], - a[8] * b[3] + a[9] * b[7] + a[10] * b[11] + a[11] * b[15], + /** + * Internal array holding the previous delta values, used for delta smoothing. + * + * @name Phaser.Core.TimeStep#deltaHistory + * @type {number[]} + * @since 3.0.0 + */ + this.deltaHistory = []; - a[12] * b[0] + a[13] * b[4] + a[14] * b[8] + a[15] * b[12], - a[12] * b[1] + a[13] * b[5] + a[14] * b[9] + a[15] * b[13], - a[12] * b[2] + a[13] * b[6] + a[14] * b[10] + a[15] * b[14], - a[12] * b[3] + a[13] * b[7] + a[14] * b[11] + a[15] * b[15] - ); + /** + * The maximum number of delta values that are retained in order to calculate a smoothed moving average. + * + * This can be changed in the Game Config via the `fps.deltaHistory` property. The default is 10. + * + * @name Phaser.Core.TimeStep#deltaSmoothingMax + * @type {number} + * @default 10 + * @since 3.0.0 + */ + this.deltaSmoothingMax = GetValue(config, 'deltaHistory', 10); + + /** + * The number of frames that the cooldown is set to after the browser panics over the FPS rate, usually + * as a result of switching tabs and regaining focus. + * + * This can be changed in the Game Config via the `fps.panicMax` property. The default is 120. + * + * @name Phaser.Core.TimeStep#panicMax + * @type {number} + * @default 120 + * @since 3.0.0 + */ + this.panicMax = GetValue(config, 'panicMax', 120); + + /** + * The actual elapsed time in ms between one update and the next. + * + * Unlike with `delta`, no smoothing, capping, or averaging is applied to this value. + * So please be careful when using this value in math calculations. + * + * @name Phaser.Core.TimeStep#rawDelta + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.rawDelta = 0; + + /** + * The time, set at the start of the current step. + * + * This is typically a high resolution timer value, as provided by Request Animation Frame. + * + * This can differ from the `time` value in that it isn't calculated based on the delta value. + * + * @name Phaser.Core.TimeStep#now + * @type {number} + * @default 0 + * @since 3.18.0 + */ + this.now = 0; + + /** + * Apply smoothing to the delta value used within Phasers internal calculations? + * + * This can be changed in the Game Config via the `fps.smoothStep` property. The default is `true`. + * + * Smoothing helps settle down the delta values after browser tab switches, or other situations + * which could cause significant delta spikes or dips. By default it has been enabled in Phaser 3 + * since the first version, but is now exposed under this property (and the corresponding game config + * `smoothStep` value), to allow you to easily disable it, should you require. + * + * @name Phaser.Core.TimeStep#smoothStep + * @type {boolean} + * @since 3.22.0 + */ + this.smoothStep = GetValue(config, 'smoothStep', true); }, /** - * Multiplies the given Matrix4 object with this Matrix. - * - * This is the same as calling `multiplyMatrices(m, this)`. - * - * @method Phaser.Math.Matrix4#premultiply - * @since 3.50.0 - * - * @param {Phaser.Math.Matrix4} m - The Matrix4 to multiply with this one. + * Called by the Game instance when the DOM window.onBlur event triggers. * - * @return {this} This Matrix4. + * @method Phaser.Core.TimeStep#blur + * @since 3.0.0 */ - premultiply: function (m) + blur: function () { - return this.multiplyMatrices(m, this); + this.inFocus = false; }, /** - * Multiplies the two given Matrix4 objects and stores the results in this Matrix. - * - * @method Phaser.Math.Matrix4#multiplyMatrices - * @since 3.50.0 - * - * @param {Phaser.Math.Matrix4} a - The first Matrix4 to multiply. - * @param {Phaser.Math.Matrix4} b - The second Matrix4 to multiply. + * Called by the Game instance when the DOM window.onFocus event triggers. * - * @return {this} This Matrix4. + * @method Phaser.Core.TimeStep#focus + * @since 3.0.0 */ - multiplyMatrices: function (a, b) + focus: function () { - var am = a.val; - var bm = b.val; - - var a11 = am[0]; - var a12 = am[4]; - var a13 = am[8]; - var a14 = am[12]; - var a21 = am[1]; - var a22 = am[5]; - var a23 = am[9]; - var a24 = am[13]; - var a31 = am[2]; - var a32 = am[6]; - var a33 = am[10]; - var a34 = am[14]; - var a41 = am[3]; - var a42 = am[7]; - var a43 = am[11]; - var a44 = am[15]; - - var b11 = bm[0]; - var b12 = bm[4]; - var b13 = bm[8]; - var b14 = bm[12]; - var b21 = bm[1]; - var b22 = bm[5]; - var b23 = bm[9]; - var b24 = bm[13]; - var b31 = bm[2]; - var b32 = bm[6]; - var b33 = bm[10]; - var b34 = bm[14]; - var b41 = bm[3]; - var b42 = bm[7]; - var b43 = bm[11]; - var b44 = bm[15]; + this.inFocus = true; - return this.setValues( - a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41, - a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41, - a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41, - a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41, - a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42, - a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42, - a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42, - a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42, - a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43, - a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43, - a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43, - a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43, - a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44, - a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44, - a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44, - a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44 - ); + this.resetDelta(); }, /** - * Translate this Matrix using the given Vector. + * Called when the visibility API says the game is 'hidden' (tab switch out of view, etc) * - * @method Phaser.Math.Matrix4#translate + * @method Phaser.Core.TimeStep#pause * @since 3.0.0 - * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. - * - * @return {this} This Matrix4. */ - translate: function (v) + pause: function () { - return this.translateXYZ(v.x, v.y, v.z); + this._pauseTime = window.performance.now(); }, /** - * Translate this Matrix using the given values. - * - * @method Phaser.Math.Matrix4#translateXYZ - * @since 3.16.0 + * Called when the visibility API says the game is 'visible' again (tab switch back into view, etc) * - * @param {number} x - The x component. - * @param {number} y - The y component. - * @param {number} z - The z component. + * @method Phaser.Core.TimeStep#resume + * @since 3.0.0 + */ + resume: function () + { + this.resetDelta(); + + this.startTime += this.time - this._pauseTime; + }, + + /** + * Resets the time, lastTime, fps averages and delta history. + * Called automatically when a browser sleeps them resumes. * - * @return {this} This Matrix4. + * @method Phaser.Core.TimeStep#resetDelta + * @since 3.0.0 */ - translateXYZ: function (x, y, z) + resetDelta: function () { - var a = this.val; + var now = window.performance.now(); - a[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - a[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - a[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - a[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + this.time = now; + this.lastTime = now; + this.nextFpsUpdate = now + 1000; + this.framesThisSecond = 0; - return this; + // Pre-populate smoothing array + + for (var i = 0; i < this.deltaSmoothingMax; i++) + { + this.deltaHistory[i] = Math.min(this._target, this.deltaHistory[i]); + } + + this.delta = 0; + this.deltaIndex = 0; + + this._coolDown = this.panicMax; }, /** - * Apply a scale transformation to this Matrix. - * - * Uses the `x`, `y` and `z` components of the given Vector to scale the Matrix. + * Starts the Time Step running, if it is not already doing so. + * Called automatically by the Game Boot process. * - * @method Phaser.Math.Matrix4#scale + * @method Phaser.Core.TimeStep#start * @since 3.0.0 * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. - * - * @return {this} This Matrix4. + * @param {Phaser.Types.Core.TimeStepCallback} callback - The callback to be invoked each time the Time Step steps. */ - scale: function (v) + start: function (callback) { - return this.scaleXYZ(v.x, v.y, v.z); + if (this.started) + { + return this; + } + + this.started = true; + this.running = true; + + for (var i = 0; i < this.deltaSmoothingMax; i++) + { + this.deltaHistory[i] = this._target; + } + + this.resetDelta(); + + this.startTime = window.performance.now(); + + this.callback = callback; + + var step = (this.hasFpsLimit) ? this.stepLimitFPS.bind(this) : this.step.bind(this); + + this.raf.start(step, this.forceSetTimeOut, this._target); }, /** - * Apply a scale transformation to this Matrix. + * Takes the delta value and smooths it based on the previous frames. * - * @method Phaser.Math.Matrix4#scaleXYZ - * @since 3.16.0 + * Called automatically as part of the step. * - * @param {number} x - The x component. - * @param {number} y - The y component. - * @param {number} z - The z component. + * @method Phaser.Core.TimeStep#smoothDelta + * @since 3.60.0 * - * @return {this} This Matrix4. + * @param {number} delta - The delta value for this step. + * + * @return {number} The smoothed delta value. */ - scaleXYZ: function (x, y, z) + smoothDelta: function (delta) { - var a = this.val; + var idx = this.deltaIndex; + var history = this.deltaHistory; + var max = this.deltaSmoothingMax; - a[0] = a[0] * x; - a[1] = a[1] * x; - a[2] = a[2] * x; - a[3] = a[3] * x; + if (this._coolDown > 0 || !this.inFocus) + { + this._coolDown--; - a[4] = a[4] * y; - a[5] = a[5] * y; - a[6] = a[6] * y; - a[7] = a[7] * y; + delta = Math.min(delta, this._target); + } - a[8] = a[8] * z; - a[9] = a[9] * z; - a[10] = a[10] * z; - a[11] = a[11] * z; + if (delta > this._min) + { + // Probably super bad start time or browser tab context loss, + // so use the last 'sane' delta value - return this; + delta = history[idx]; + + // Clamp delta to min (in case history has become corrupted somehow) + delta = Math.min(delta, this._min); + } + + // Smooth out the delta over the previous X frames + + // add the delta to the smoothing array + history[idx] = delta; + + // adjusts the delta history array index based on the smoothing count + // this stops the array growing beyond the size of deltaSmoothingMax + this.deltaIndex++; + + if (this.deltaIndex >= max) + { + this.deltaIndex = 0; + } + + // Loop the history array, adding the delta values together + var avg = 0; + + for (var i = 0; i < max; i++) + { + avg += history[i]; + } + + // Then divide by the array length to get the average delta + avg /= max; + + return avg; }, /** - * Derive a rotation matrix around the given axis. + * Update the estimate of the frame rate, `fps`. Every second, the number + * of frames that occurred in that second are included in an exponential + * moving average of all frames per second, with an alpha of 0.25. This + * means that more recent seconds affect the estimated frame rate more than + * older seconds. * - * @method Phaser.Math.Matrix4#makeRotationAxis - * @since 3.0.0 + * When a browser window is NOT minimized, but is covered up (i.e. you're using + * another app which has spawned a window over the top of the browser), then it + * will start to throttle the raf callback time. It waits for a while, and then + * starts to drop the frame rate at 1 frame per second until it's down to just over 1fps. + * So if the game was running at 60fps, and the player opens a new window, then + * after 60 seconds (+ the 'buffer time') it'll be down to 1fps, so rafin'g at 1Hz. * - * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis. - * @param {number} angle - The rotation angle in radians. + * When they make the game visible again, the frame rate is increased at a rate of + * approx. 8fps, back up to 60fps (or the max it can obtain) * - * @return {this} This Matrix4. + * There is no easy way to determine if this drop in frame rate is because the + * browser is throttling raf, or because the game is struggling with performance + * because you're asking it to do too much on the device. + * + * Compute the new exponential moving average with an alpha of 0.25. + * + * @method Phaser.Core.TimeStep#updateFPS + * @since 3.60.0 + * + * @param {number} time - The timestamp passed in from RequestAnimationFrame or setTimeout. */ - makeRotationAxis: function (axis, angle) + updateFPS: function (time) { - // Based on http://www.gamedev.net/reference/articles/article1199.asp - - var c = Math.cos(angle); - var s = Math.sin(angle); - var t = 1 - c; - var x = axis.x; - var y = axis.y; - var z = axis.z; - var tx = t * x; - var ty = t * y; - - return this.setValues( - tx * x + c, tx * y - s * z, tx * z + s * y, 0, - tx * y + s * z, ty * y + c, ty * z - s * x, 0, - tx * z - s * y, ty * z + s * x, t * z * z + c, 0, - 0, 0, 0, 1 - ); + this.actualFps = 0.25 * this.framesThisSecond + 0.75 * this.actualFps; + this.nextFpsUpdate = time + 1000; + this.framesThisSecond = 0; }, /** - * Apply a rotation transformation to this Matrix. - * - * @method Phaser.Math.Matrix4#rotate - * @since 3.0.0 + * The main step method with an fps limiter. This is called each time the browser updates, either by Request Animation Frame, + * or by Set Timeout. It is responsible for calculating the delta values, frame totals, cool down history and more. + * You generally should never call this method directly. * - * @param {number} rad - The angle in radians to rotate by. - * @param {Phaser.Math.Vector3} axis - The axis to rotate upon. + * @method Phaser.Core.TimeStep#stepLimitFPS + * @since 3.60.0 * - * @return {this} This Matrix4. + * @param {number} time - The timestamp passed in from RequestAnimationFrame or setTimeout. */ - rotate: function (rad, axis) + stepLimitFPS: function (time) { - var a = this.val; - var x = axis.x; - var y = axis.y; - var z = axis.z; - var len = Math.sqrt(x * x + y * y + z * z); + this.now = time; - if (Math.abs(len) < EPSILON) + // delta time (time is in ms) + // Math.max because Chrome will sometimes give negative deltas + var delta = Math.max(0, time - this.lastTime); + + this.rawDelta = delta; + + // Real-world timer advance + this.time += this.rawDelta; + + if (this.smoothStep) { - return this; + delta = this.smoothDelta(delta); } - len = 1 / len; - x *= len; - y *= len; - z *= len; + // Set as the world delta value (after smoothing, if applied) + this.delta += delta; - var s = Math.sin(rad); - var c = Math.cos(rad); - var t = 1 - c; + if (time >= this.nextFpsUpdate) + { + this.updateFPS(time); + } - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; + this.framesThisSecond++; - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; - - // Construct the elements of the rotation matrix - var b00 = x * x * t + c; - var b01 = y * x * t + z * s; - var b02 = z * x * t - y * s; + if (this.delta >= this._limitRate) + { + this.callback(time, this.delta); - var b10 = x * y * t - z * s; - var b11 = y * y * t + c; - var b12 = z * y * t + x * s; + this.delta = 0; + } - var b20 = x * z * t + y * s; - var b21 = y * z * t - x * s; - var b22 = z * z * t + c; + // Shift time value over + this.lastTime = time; - // Perform rotation-specific matrix multiplication - return this.setValues( - a00 * b00 + a10 * b01 + a20 * b02, - a01 * b00 + a11 * b01 + a21 * b02, - a02 * b00 + a12 * b01 + a22 * b02, - a03 * b00 + a13 * b01 + a23 * b02, - a00 * b10 + a10 * b11 + a20 * b12, - a01 * b10 + a11 * b11 + a21 * b12, - a02 * b10 + a12 * b11 + a22 * b12, - a03 * b10 + a13 * b11 + a23 * b12, - a00 * b20 + a10 * b21 + a20 * b22, - a01 * b20 + a11 * b21 + a21 * b22, - a02 * b20 + a12 * b21 + a22 * b22, - a03 * b20 + a13 * b21 + a23 * b22, - a30, a31, a32, a33 - ); + this.frame++; }, /** - * Rotate this matrix on its X axis. + * The main step method. This is called each time the browser updates, either by Request Animation Frame, + * or by Set Timeout. It is responsible for calculating the delta values, frame totals, cool down history and more. + * You generally should never call this method directly. * - * @method Phaser.Math.Matrix4#rotateX + * @method Phaser.Core.TimeStep#step * @since 3.0.0 * - * @param {number} rad - The angle in radians to rotate by. - * - * @return {this} This Matrix4. + * @param {number} time - The timestamp passed in from RequestAnimationFrame or setTimeout. */ - rotateX: function (rad) + step: function (time) { - var a = this.val; - var s = Math.sin(rad); - var c = Math.cos(rad); + this.now = time; - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; + // delta time (time is in ms) + // Math.max because Chrome will sometimes give negative deltas + var delta = Math.max(0, time - this.lastTime); - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; + this.rawDelta = delta; - // Perform axis-specific matrix multiplication - a[4] = a10 * c + a20 * s; - a[5] = a11 * c + a21 * s; - a[6] = a12 * c + a22 * s; - a[7] = a13 * c + a23 * s; - a[8] = a20 * c - a10 * s; - a[9] = a21 * c - a11 * s; - a[10] = a22 * c - a12 * s; - a[11] = a23 * c - a13 * s; + // Real-world timer advance + this.time += this.rawDelta; - return this; - }, + if (this.smoothStep) + { + delta = this.smoothDelta(delta); + } - /** - * Rotate this matrix on its Y axis. - * - * @method Phaser.Math.Matrix4#rotateY - * @since 3.0.0 - * - * @param {number} rad - The angle to rotate by, in radians. - * - * @return {this} This Matrix4. - */ - rotateY: function (rad) - { - var a = this.val; - var s = Math.sin(rad); - var c = Math.cos(rad); + // Set as the world delta value (after smoothing, if applied) + this.delta = delta; - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; + if (time >= this.nextFpsUpdate) + { + this.updateFPS(time); + } - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; + this.framesThisSecond++; - // Perform axis-specific matrix multiplication - a[0] = a00 * c - a20 * s; - a[1] = a01 * c - a21 * s; - a[2] = a02 * c - a22 * s; - a[3] = a03 * c - a23 * s; - a[8] = a00 * s + a20 * c; - a[9] = a01 * s + a21 * c; - a[10] = a02 * s + a22 * c; - a[11] = a03 * s + a23 * c; + this.callback(time, delta); - return this; + // Shift time value over + this.lastTime = time; + + this.frame++; }, /** - * Rotate this matrix on its Z axis. + * Manually calls `TimeStep.step`. * - * @method Phaser.Math.Matrix4#rotateZ + * @method Phaser.Core.TimeStep#tick * @since 3.0.0 - * - * @param {number} rad - The angle to rotate by, in radians. - * - * @return {this} This Matrix4. */ - rotateZ: function (rad) + tick: function () { - var a = this.val; - var s = Math.sin(rad); - var c = Math.cos(rad); - - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - - // Perform axis-specific matrix multiplication - a[0] = a00 * c + a10 * s; - a[1] = a01 * c + a11 * s; - a[2] = a02 * c + a12 * s; - a[3] = a03 * c + a13 * s; - a[4] = a10 * c - a00 * s; - a[5] = a11 * c - a01 * s; - a[6] = a12 * c - a02 * s; - a[7] = a13 * c - a03 * s; + var now = window.performance.now(); - return this; + if (this.hasFpsLimit) + { + this.stepLimitFPS(now); + } + else + { + this.step(now); + } }, /** - * Set the values of this Matrix from the given rotation Quaternion and translation Vector. + * Sends the TimeStep to sleep, stopping Request Animation Frame (or SetTimeout) and toggling the `running` flag to false. * - * @method Phaser.Math.Matrix4#fromRotationTranslation + * @method Phaser.Core.TimeStep#sleep * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set rotation from. - * @param {Phaser.Math.Vector3} v - The Vector to set translation from. - * - * @return {this} This Matrix4. */ - fromRotationTranslation: function (q, v) + sleep: function () { - // Quaternion math - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; - - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - - return this.setValues( - 1 - (yy + zz), - xy + wz, - xz - wy, - 0, - - xy - wz, - 1 - (xx + zz), - yz + wx, - 0, - - xz + wy, - yz - wx, - 1 - (xx + yy), - 0, + if (this.running) + { + this.raf.stop(); - v.x, - v.y, - v.z, - 1 - ); + this.running = false; + } }, /** - * Set the values of this Matrix from the given Quaternion. + * Wakes-up the TimeStep, restarting Request Animation Frame (or SetTimeout) and toggling the `running` flag to true. + * The `seamless` argument controls if the wake-up should adjust the start time or not. * - * @method Phaser.Math.Matrix4#fromQuat + * @method Phaser.Core.TimeStep#wake * @since 3.0.0 * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. - * - * @return {this} This Matrix4. + * @param {boolean} [seamless=false] - Adjust the startTime based on the lastTime values. */ - fromQuat: function (q) + wake: function (seamless) { - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; - - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; + if (seamless === undefined) { seamless = false; } - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; + var now = window.performance.now(); - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; + if (this.running) + { + return; + } + else if (seamless) + { + this.startTime += -this.lastTime + (this.lastTime + now); + } - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + var step = (this.hasFpsLimit) ? this.stepLimitFPS.bind(this) : this.step.bind(this); - return this.setValues( - 1 - (yy + zz), - xy + wz, - xz - wy, - 0, + this.raf.start(step, this.forceSetTimeOut, this._target); - xy - wz, - 1 - (xx + zz), - yz + wx, - 0, + this.running = true; - xz + wy, - yz - wx, - 1 - (xx + yy), - 0, + this.nextFpsUpdate = now + 1000; + this.framesThisSecond = 0; + this.fpsLimitTriggered = false; - 0, - 0, - 0, - 1 - ); + this.tick(); }, /** - * Generate a frustum matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#frustum - * @since 3.0.0 + * Gets the duration which the game has been running, in seconds. * - * @param {number} left - The left bound of the frustum. - * @param {number} right - The right bound of the frustum. - * @param {number} bottom - The bottom bound of the frustum. - * @param {number} top - The top bound of the frustum. - * @param {number} near - The near bound of the frustum. - * @param {number} far - The far bound of the frustum. + * @method Phaser.Core.TimeStep#getDuration + * @since 3.17.0 * - * @return {this} This Matrix4. + * @return {number} The duration in seconds. */ - frustum: function (left, right, bottom, top, near, far) + getDuration: function () { - var rl = 1 / (right - left); - var tb = 1 / (top - bottom); - var nf = 1 / (near - far); - - return this.setValues( - (near * 2) * rl, - 0, - 0, - 0, - - 0, - (near * 2) * tb, - 0, - 0, - - (right + left) * rl, - (top + bottom) * tb, - (far + near) * nf, - -1, - - 0, - 0, - (far * near * 2) * nf, - 0 - ); + return Math.round(this.lastTime - this.startTime) / 1000; }, /** - * Generate a perspective projection matrix with the given bounds. - * - * @method Phaser.Math.Matrix4#perspective - * @since 3.0.0 + * Gets the duration which the game has been running, in ms. * - * @param {number} fovy - Vertical field of view in radians - * @param {number} aspect - Aspect ratio. Typically viewport width /height. - * @param {number} near - Near bound of the frustum. - * @param {number} far - Far bound of the frustum. + * @method Phaser.Core.TimeStep#getDurationMS + * @since 3.17.0 * - * @return {this} This Matrix4. + * @return {number} The duration in ms. */ - perspective: function (fovy, aspect, near, far) + getDurationMS: function () { - var f = 1.0 / Math.tan(fovy / 2); - var nf = 1 / (near - far); - - return this.setValues( - f / aspect, - 0, - 0, - 0, - - 0, - f, - 0, - 0, - - 0, - 0, - (far + near) * nf, - -1, - - 0, - 0, - (2 * far * near) * nf, - 0 - ); + return Math.round(this.lastTime - this.startTime); }, /** - * Generate a perspective projection matrix with the given bounds. + * Stops the TimeStep running. * - * @method Phaser.Math.Matrix4#perspectiveLH + * @method Phaser.Core.TimeStep#stop * @since 3.0.0 * - * @param {number} width - The width of the frustum. - * @param {number} height - The height of the frustum. - * @param {number} near - Near bound of the frustum. - * @param {number} far - Far bound of the frustum. - * - * @return {this} This Matrix4. + * @return {this} The TimeStep object. */ - perspectiveLH: function (width, height, near, far) + stop: function () { - return this.setValues( - (2 * near) / width, - 0, - 0, - 0, - - 0, - (2 * near) / height, - 0, - 0, + this.running = false; + this.started = false; - 0, - 0, - -far / (near - far), - 1, + this.raf.stop(); - 0, - 0, - (near * far) / (near - far), - 0 - ); + return this; }, /** - * Generate an orthogonal projection matrix with the given bounds. + * Destroys the TimeStep. This will stop Request Animation Frame, stop the step, clear the callbacks and null + * any objects. * - * @method Phaser.Math.Matrix4#ortho + * @method Phaser.Core.TimeStep#destroy * @since 3.0.0 - * - * @param {number} left - The left bound of the frustum. - * @param {number} right - The right bound of the frustum. - * @param {number} bottom - The bottom bound of the frustum. - * @param {number} top - The top bound of the frustum. - * @param {number} near - The near bound of the frustum. - * @param {number} far - The far bound of the frustum. - * - * @return {this} This Matrix4. */ - ortho: function (left, right, bottom, top, near, far) + destroy: function () { - var lr = left - right; - var bt = bottom - top; - var nf = near - far; - - // Avoid division by zero - lr = (lr === 0) ? lr : 1 / lr; - bt = (bt === 0) ? bt : 1 / bt; - nf = (nf === 0) ? nf : 1 / nf; - - return this.setValues( - -2 * lr, - 0, - 0, - 0, - - 0, - -2 * bt, - 0, - 0, - - 0, - 0, - 2 * nf, - 0, - - (left + right) * lr, - (top + bottom) * bt, - (far + near) * nf, - 1 - ); - }, + this.stop(); - /** - * Generate a right-handed look-at matrix with the given eye position, target and up axis. - * - * @method Phaser.Math.Matrix4#lookAtRH - * @since 3.50.0 - * - * @param {Phaser.Math.Vector3} eye - Position of the viewer. - * @param {Phaser.Math.Vector3} target - Point the viewer is looking at. - * @param {Phaser.Math.Vector3} up - vec3 pointing up. - * - * @return {this} This Matrix4. - */ - lookAtRH: function (eye, target, up) - { - var m = this.val; + this.raf.destroy(); - _z.subVectors(eye, target); + this.raf = null; + this.game = null; + this.callback = null; + } - if (_z.getLengthSquared() === 0) - { - // eye and target are in the same position - _z.z = 1; - } +}); - _z.normalize(); - _x.crossVectors(up, _z); +module.exports = TimeStep; - if (_x.getLengthSquared() === 0) - { - // up and z are parallel - if (Math.abs(up.z) === 1) - { - _z.x += 0.0001; - } - else - { - _z.z += 0.0001; - } +/***/ }), - _z.normalize(); - _x.crossVectors(up, _z); - } +/***/ 26493: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - _x.normalize(); - _y.crossVectors(_z, _x); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - m[0] = _x.x; - m[1] = _x.y; - m[2] = _x.z; - m[4] = _y.x; - m[5] = _y.y; - m[6] = _y.z; - m[8] = _z.x; - m[9] = _z.y; - m[10] = _z.z; +var Events = __webpack_require__(97081); - return this; - }, +/** + * The Visibility Handler is responsible for listening out for document level visibility change events. + * This includes `visibilitychange` if the browser supports it, and blur and focus events. It then uses + * the provided Event Emitter and fires the related events. + * + * @function Phaser.Core.VisibilityHandler + * @fires Phaser.Core.Events#BLUR + * @fires Phaser.Core.Events#FOCUS + * @fires Phaser.Core.Events#HIDDEN + * @fires Phaser.Core.Events#VISIBLE + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Game instance this Visibility Handler is working on. + */ +var VisibilityHandler = function (game) +{ + var hiddenVar; + var eventEmitter = game.events; - /** - * Generate a look-at matrix with the given eye position, focal point, and up axis. - * - * @method Phaser.Math.Matrix4#lookAt - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} eye - Position of the viewer - * @param {Phaser.Math.Vector3} center - Point the viewer is looking at - * @param {Phaser.Math.Vector3} up - vec3 pointing up. - * - * @return {this} This Matrix4. - */ - lookAt: function (eye, center, up) + if (document.hidden !== undefined) { - var eyex = eye.x; - var eyey = eye.y; - var eyez = eye.z; - - var upx = up.x; - var upy = up.y; - var upz = up.z; - - var centerx = center.x; - var centery = center.y; - var centerz = center.z; - - if (Math.abs(eyex - centerx) < EPSILON && - Math.abs(eyey - centery) < EPSILON && - Math.abs(eyez - centerz) < EPSILON) - { - return this.identity(); - } - - var z0 = eyex - centerx; - var z1 = eyey - centery; - var z2 = eyez - centerz; - - var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); - - z0 *= len; - z1 *= len; - z2 *= len; - - var x0 = upy * z2 - upz * z1; - var x1 = upz * z0 - upx * z2; - var x2 = upx * z1 - upy * z0; - - len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + hiddenVar = 'visibilitychange'; + } + else + { + var vendors = [ 'webkit', 'moz', 'ms' ]; - if (!len) - { - x0 = 0; - x1 = 0; - x2 = 0; - } - else + vendors.forEach(function (prefix) { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } + if (document[prefix + 'Hidden'] !== undefined) + { + document.hidden = function () + { + return document[prefix + 'Hidden']; + }; - var y0 = z1 * x2 - z2 * x1; - var y1 = z2 * x0 - z0 * x2; - var y2 = z0 * x1 - z1 * x0; + hiddenVar = prefix + 'visibilitychange'; + } - len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + }); + } - if (!len) + var onChange = function (event) + { + if (document.hidden || event.type === 'pause') { - y0 = 0; - y1 = 0; - y2 = 0; + eventEmitter.emit(Events.HIDDEN); } else { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; + eventEmitter.emit(Events.VISIBLE); } + }; - return this.setValues( - x0, - y0, - z0, - 0, - - x1, - y1, - z1, - 0, - - x2, - y2, - z2, - 0, - - -(x0 * eyex + x1 * eyey + x2 * eyez), - -(y0 * eyex + y1 * eyey + y2 * eyez), - -(z0 * eyex + z1 * eyey + z2 * eyez), - 1 - ); - }, - - /** - * Set the values of this matrix from the given `yaw`, `pitch` and `roll` values. - * - * @method Phaser.Math.Matrix4#yawPitchRoll - * @since 3.0.0 - * - * @param {number} yaw - The yaw value. - * @param {number} pitch - The pitch value. - * @param {number} roll - The roll value. - * - * @return {this} This Matrix4. - */ - yawPitchRoll: function (yaw, pitch, roll) + if (hiddenVar) { - this.zero(); - _tempMat1.zero(); - _tempMat2.zero(); - - var m0 = this.val; - var m1 = _tempMat1.val; - var m2 = _tempMat2.val; - - // Rotate Z - var s = Math.sin(roll); - var c = Math.cos(roll); - - m0[10] = 1; - m0[15] = 1; - m0[0] = c; - m0[1] = s; - m0[4] = -s; - m0[5] = c; - - // Rotate X - s = Math.sin(pitch); - c = Math.cos(pitch); - - m1[0] = 1; - m1[15] = 1; - m1[5] = c; - m1[10] = c; - m1[9] = -s; - m1[6] = s; - - // Rotate Y - s = Math.sin(yaw); - c = Math.cos(yaw); - - m2[5] = 1; - m2[15] = 1; - m2[0] = c; - m2[2] = -s; - m2[8] = s; - m2[10] = c; - - this.multiplyLocal(_tempMat1); - this.multiplyLocal(_tempMat2); - - return this; - }, + document.addEventListener(hiddenVar, onChange, false); + } - /** - * Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix. - * - * @method Phaser.Math.Matrix4#setWorldMatrix - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} rotation - The rotation of the world matrix. - * @param {Phaser.Math.Vector3} position - The position of the world matrix. - * @param {Phaser.Math.Vector3} scale - The scale of the world matrix. - * @param {Phaser.Math.Matrix4} [viewMatrix] - The view matrix. - * @param {Phaser.Math.Matrix4} [projectionMatrix] - The projection matrix. - * - * @return {this} This Matrix4. - */ - setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) + window.onblur = function () { - this.yawPitchRoll(rotation.y, rotation.x, rotation.z); - - _tempMat1.scaling(scale.x, scale.y, scale.z); - _tempMat2.xyz(position.x, position.y, position.z); - - this.multiplyLocal(_tempMat1); - this.multiplyLocal(_tempMat2); - - if (viewMatrix) - { - this.multiplyLocal(viewMatrix); - } - - if (projectionMatrix) - { - this.multiplyLocal(projectionMatrix); - } + eventEmitter.emit(Events.BLUR); + }; - return this; - }, + window.onfocus = function () + { + eventEmitter.emit(Events.FOCUS); + }; - /** - * Multiplies this Matrix4 by the given `src` Matrix4 and stores the results in the `out` Matrix4. - * - * @method Phaser.Math.Matrix4#multiplyToMat4 - * @since 3.50.0 - * - * @param {Phaser.Math.Matrix4} src - The Matrix4 to multiply with this one. - * @param {Phaser.Math.Matrix4} out - The receiving Matrix. - * - * @return {Phaser.Math.Matrix4} This `out` Matrix4. - */ - multiplyToMat4: function (src, out) + // Automatically give the window focus unless config says otherwise + if (window.focus && game.config.autoFocus) { - var a = this.val; - var b = src.val; + window.focus(); + } +}; - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; +module.exports = VisibilityHandler; - var b00 = b[0]; - var b01 = b[1]; - var b02 = b[2]; - var b03 = b[3]; - var b10 = b[4]; - var b11 = b[5]; - var b12 = b[6]; - var b13 = b[7]; - var b20 = b[8]; - var b21 = b[9]; - var b22 = b[10]; - var b23 = b[11]; - var b30 = b[12]; - var b31 = b[13]; - var b32 = b[14]; - var b33 = b[15]; - return out.setValues( - b00 * a00 + b01 * a10 + b02 * a20 + b03 * a30, - b01 * a01 + b01 * a11 + b02 * a21 + b03 * a31, - b02 * a02 + b01 * a12 + b02 * a22 + b03 * a32, - b03 * a03 + b01 * a13 + b02 * a23 + b03 * a33, +/***/ }), - b10 * a00 + b11 * a10 + b12 * a20 + b13 * a30, - b10 * a01 + b11 * a11 + b12 * a21 + b13 * a31, - b10 * a02 + b11 * a12 + b12 * a22 + b13 * a32, - b10 * a03 + b11 * a13 + b12 * a23 + b13 * a33, +/***/ 41651: +/***/ ((module) => { - b20 * a00 + b21 * a10 + b22 * a20 + b23 * a30, - b20 * a01 + b21 * a11 + b22 * a21 + b23 * a31, - b20 * a02 + b21 * a12 + b22 * a22 + b23 * a32, - b20 * a03 + b21 * a13 + b22 * a23 + b23 * a33, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - b30 * a00 + b31 * a10 + b32 * a20 + b33 * a30, - b30 * a01 + b31 * a11 + b32 * a21 + b33 * a31, - b30 * a02 + b31 * a12 + b32 * a22 + b33 * a32, - b30 * a03 + b31 * a13 + b32 * a23 + b33 * a33 - ); - }, +/** + * The Game Blur Event. + * + * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded + * enters a blurred state. The blur event is raised when the window loses focus. This can happen if a user swaps + * tab, or if they simply remove focus from the browser to another app. + * + * @event Phaser.Core.Events#BLUR + * @type {string} + * @since 3.0.0 + */ +module.exports = 'blur'; - /** - * Takes the rotation and position vectors and builds this Matrix4 from them. - * - * @method Phaser.Math.Matrix4#fromRotationXYTranslation - * @since 3.50.0 - * - * @param {Phaser.Math.Vector3} rotation - The rotation vector. - * @param {Phaser.Math.Vector3} position - The position vector. - * @param {boolean} translateFirst - Should the operation translate then rotate (`true`), or rotate then translate? (`false`) - * - * @return {this} This Matrix4. - */ - fromRotationXYTranslation: function (rotation, position, translateFirst) - { - var x = position.x; - var y = position.y; - var z = position.z; - var sx = Math.sin(rotation.x); - var cx = Math.cos(rotation.x); +/***/ }), - var sy = Math.sin(rotation.y); - var cy = Math.cos(rotation.y); +/***/ 5520: +/***/ ((module) => { - var a30 = x; - var a31 = y; - var a32 = z; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Rotate X +/** + * The Game Boot Event. + * + * This event is dispatched when the Phaser Game instance has finished booting, but before it is ready to start running. + * The global systems use this event to know when to set themselves up, dispatching their own `ready` events as required. + * + * @event Phaser.Core.Events#BOOT + * @type {string} + * @since 3.0.0 + */ +module.exports = 'boot'; - var b21 = -sx; - // Rotate Y +/***/ }), - var c01 = 0 - b21 * sy; +/***/ 51673: +/***/ ((module) => { - var c02 = 0 - cx * sy; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var c21 = b21 * cy; +/** + * The Game Context Lost Event. + * + * This event is dispatched by the Game if the WebGL Renderer it is using encounters a WebGL Context Lost event from the browser. + * + * The renderer halts all rendering and cannot resume after this happens. + * + * @event Phaser.Core.Events#CONTEXT_LOST + * @type {string} + * @since 3.19.0 + */ +module.exports = 'contextlost'; - var c22 = cx * cy; - // Translate - if (!translateFirst) - { - // a30 = cy * x + 0 * y + sy * z; - a30 = cy * x + sy * z; - a31 = c01 * x + cx * y + c21 * z; - a32 = c02 * x + sx * y + c22 * z; - } +/***/ }), - return this.setValues( - cy, - c01, - c02, - 0, - 0, - cx, - sx, - 0, - sy, - c21, - c22, - 0, - a30, - a31, - a32, - 1 - ); - }, +/***/ 25055: +/***/ ((module) => { - /** - * Returns the maximum axis scale from this Matrix4. - * - * @method Phaser.Math.Matrix4#getMaxScaleOnAxis - * @since 3.50.0 - * - * @return {number} The maximum axis scale. - */ - getMaxScaleOnAxis: function () - { - var m = this.val; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var scaleXSq = m[0] * m[0] + m[1] * m[1] + m[2] * m[2]; - var scaleYSq = m[4] * m[4] + m[5] * m[5] + m[6] * m[6]; - var scaleZSq = m[8] * m[8] + m[9] * m[9] + m[10] * m[10]; +/** + * The Game Destroy Event. + * + * This event is dispatched when the game instance has been told to destroy itself. + * Lots of internal systems listen to this event in order to clear themselves out. + * Custom plugins and game code should also do the same. + * + * @event Phaser.Core.Events#DESTROY + * @type {string} + * @since 3.0.0 + */ +module.exports = 'destroy'; - return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq)); - } -}); +/***/ }), -/** - * @ignore - */ -var _tempMat1 = new Matrix4(); +/***/ 23767: +/***/ ((module) => { /** - * @ignore + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var _tempMat2 = new Matrix4(); /** - * @ignore + * The Game Focus Event. + * + * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded + * enters a focused state. The focus event is raised when the window re-gains focus, having previously lost it. + * + * @event Phaser.Core.Events#FOCUS + * @type {string} + * @since 3.0.0 */ -var _x = new Vector3(); +module.exports = 'focus'; + + +/***/ }), + +/***/ 57564: +/***/ ((module) => { /** - * @ignore + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var _y = new Vector3(); /** - * @ignore + * The Game Hidden Event. + * + * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded + * enters a hidden state. Only browsers that support the Visibility API will cause this event to be emitted. + * + * In most modern browsers, when the document enters a hidden state, the Request Animation Frame and setTimeout, which + * control the main game loop, will automatically pause. There is no way to stop this from happening. It is something + * your game should account for in its own code, should the pause be an issue (i.e. for multiplayer games) + * + * @event Phaser.Core.Events#HIDDEN + * @type {string} + * @since 3.0.0 */ -var _z = new Vector3(); - -module.exports = Matrix4; +module.exports = 'hidden'; /***/ }), -/* 70 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 38327: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @namespace Phaser.Sound.Events + * The Game Pause Event. + * + * This event is dispatched when the Game loop enters a paused state, usually as a result of the Visibility Handler. + * + * @event Phaser.Core.Events#PAUSE + * @type {string} + * @since 3.0.0 */ - -module.exports = { - - COMPLETE: __webpack_require__(987), - DECODED: __webpack_require__(988), - DECODED_ALL: __webpack_require__(989), - DESTROY: __webpack_require__(990), - DETUNE: __webpack_require__(991), - GLOBAL_DETUNE: __webpack_require__(992), - GLOBAL_MUTE: __webpack_require__(993), - GLOBAL_RATE: __webpack_require__(994), - GLOBAL_VOLUME: __webpack_require__(995), - LOOP: __webpack_require__(996), - LOOPED: __webpack_require__(997), - MUTE: __webpack_require__(998), - PAN: __webpack_require__(999), - PAUSE_ALL: __webpack_require__(1000), - PAUSE: __webpack_require__(1001), - PLAY: __webpack_require__(1002), - RATE: __webpack_require__(1003), - RESUME_ALL: __webpack_require__(1004), - RESUME: __webpack_require__(1005), - SEEK: __webpack_require__(1006), - STOP_ALL: __webpack_require__(1007), - STOP: __webpack_require__(1008), - UNLOCKED: __webpack_require__(1009), - VOLUME: __webpack_require__(1010) - -}; +module.exports = 'pause'; /***/ }), -/* 71 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 43807: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); - /** - * @classdesc - * A single Image File suitable for loading by the Loader. + * The Game Post-Render Event. * - * These are created when you use the Phaser.Loader.LoaderPlugin#image method and are not typically created directly. + * This event is dispatched right at the end of the render process. * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#image. + * Every Scene will have rendered and been drawn to the canvas by the time this event is fired. + * Use it for any last minute post-processing before the next game step begins. * - * @class ImageFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor + * @event Phaser.Core.Events#POST_RENDER + * @type {string} * @since 3.0.0 * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - * @param {Phaser.Types.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. Only provided for, and used by, Sprite Sheets. + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer being used by the Game instance. */ -var ImageFile = new Class({ - - Extends: File, - - initialize: - - function ImageFile (loader, key, url, xhrSettings, frameConfig) - { - var extension = 'png'; - var normalMapURL; +module.exports = 'postrender'; - if (IsPlainObject(key)) - { - var config = key; - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - normalMapURL = GetFastValue(config, 'normalMap'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - frameConfig = GetFastValue(config, 'frameConfig'); - } +/***/ }), - if (Array.isArray(url)) - { - normalMapURL = url[1]; - url = url[0]; - } +/***/ 73652: +/***/ ((module) => { - var fileConfig = { - type: 'image', - cache: loader.textureManager, - extension: extension, - responseType: 'blob', - key: key, - url: url, - xhrSettings: xhrSettings, - config: frameConfig - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - File.call(this, loader, fileConfig); +/** + * The Game Post-Step Event. + * + * This event is dispatched after the Scene Manager has updated. + * Hook into it from plugins or systems that need to do things before the render starts. + * + * @event Phaser.Core.Events#POST_STEP + * @type {string} + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'poststep'; - // Do we have a normal map to load as well? - if (normalMapURL) - { - var normalMap = new ImageFile(loader, this.key, normalMapURL, xhrSettings, frameConfig); - normalMap.type = 'normalMap'; +/***/ }), - this.setLink(normalMap); +/***/ 780: +/***/ ((module) => { - loader.addFile(normalMap); - } - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. - * - * @method Phaser.Loader.FileTypes.ImageFile#onProcess - * @since 3.7.0 - */ - onProcess: function () - { - this.state = CONST.FILE_PROCESSING; +/** + * The Game Pre-Render Event. + * + * This event is dispatched immediately before any of the Scenes have started to render. + * + * The renderer will already have been initialized this frame, clearing itself and preparing to receive the Scenes for rendering, but it won't have actually drawn anything yet. + * + * @event Phaser.Core.Events#PRE_RENDER + * @type {string} + * @since 3.0.0 + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer being used by the Game instance. + */ +module.exports = 'prerender'; - this.data = new Image(); - this.data.crossOrigin = this.crossOrigin; +/***/ }), - var _this = this; +/***/ 13781: +/***/ ((module) => { - this.data.onload = function () - { - File.revokeObjectURL(_this.data); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - _this.onProcessComplete(); - }; +/** + * The Game Pre-Step Event. + * + * This event is dispatched before the main Game Step starts. By this point in the game cycle none of the Scene updates have yet happened. + * Hook into it from plugins or systems that need to update before the Scene Manager does. + * + * @event Phaser.Core.Events#PRE_STEP + * @type {string} + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'prestep'; - this.data.onerror = function () - { - File.revokeObjectURL(_this.data); - _this.onProcessError(); - }; +/***/ }), - File.createObjectURL(this.data, this.xhrLoader.response, 'image/png'); - }, +/***/ 38247: +/***/ ((module) => { - /** - * Adds this file to its target cache upon successful loading and processing. - * - * @method Phaser.Loader.FileTypes.ImageFile#addToCache - * @since 3.7.0 - */ - addToCache: function () - { - var texture; - var linkFile = this.linkFile; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (linkFile && linkFile.state === CONST.FILE_COMPLETE) - { - if (this.type === 'image') - { - texture = this.cache.addImage(this.key, this.data, linkFile.data); - } - else - { - texture = this.cache.addImage(linkFile.key, linkFile.data, this.data); - } +/** + * The Game Ready Event. + * + * This event is dispatched when the Phaser Game instance has finished booting, the Texture Manager is fully ready, + * and all local systems are now able to start. + * + * @event Phaser.Core.Events#READY + * @type {string} + * @since 3.0.0 + */ +module.exports = 'ready'; - this.pendingDestroy(texture); - linkFile.pendingDestroy(texture); - } - else if (!linkFile) - { - texture = this.cache.addImage(this.key, this.data); +/***/ }), - this.pendingDestroy(texture); - } - } +/***/ 29129: +/***/ ((module) => { -}); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ /** - * Adds an Image, or array of Images, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.image('logo', 'images/phaserLogo.png'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. - * If you try to load an animated gif only the first frame will be rendered. Browsers do not natively support playback - * of animated gifs to Canvas elements. - * - * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Texture Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.image({ - * key: 'logo', - * url: 'images/AtariLogo.png' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.ImageFileConfig` for more details. - * - * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key: - * - * ```javascript - * this.load.image('logo', 'images/AtariLogo.png'); - * // and later in your game ... - * this.add.image(x, y, 'logo'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and - * this is what you would use to retrieve the image from the Texture Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, - * then you can specify it by providing an array as the `url` where the second element is the normal map: - * - * ```javascript - * this.load.image('logo', [ 'images/AtariLogo.png', 'images/AtariLogo-n.png' ]); - * ``` - * - * Or, if you are using a config object use the `normalMap` property: - * - * ```javascript - * this.load.image({ - * key: 'logo', - * url: 'images/AtariLogo.png', - * normalMap: 'images/AtariLogo-n.png' - * }); - * ``` - * - * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. - * Normal maps are a WebGL only feature. + * The Game Resume Event. * - * Note: The ability to load this type of file will only be available if the Image File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. + * This event is dispatched when the game loop leaves a paused state and resumes running. * - * @method Phaser.Loader.LoaderPlugin#image - * @fires Phaser.Loader.LoaderPlugin#ADD + * @event Phaser.Core.Events#RESUME + * @type {string} * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig|Phaser.Types.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. */ -FileTypesManager.register('image', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new ImageFile(this, key[i])); - } - } - else - { - this.addFile(new ImageFile(this, key, url, xhrSettings)); - } - - return this; -}); - -module.exports = ImageFile; +module.exports = 'resume'; /***/ }), -/* 72 */ -/***/ (function(module, exports) { + +/***/ 34994: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Internally used method to set the colliding state of a tile. This does not recalculate - * interesting faces. + * The Game Step Event. * - * @function Phaser.Tilemaps.Components.SetTileCollision + * This event is dispatched after the Game Pre-Step and before the Scene Manager steps. + * Hook into it from plugins or systems that need to update before the Scene Manager does, but after the core Systems have. + * + * @event Phaser.Core.Events#STEP + * @type {string} * @since 3.0.0 * - * @param {Phaser.Tilemaps.Tile} tile - The Tile to set the collision on. - * @param {boolean} [collides=true] - Should the tile index collide or not? + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ -var SetTileCollision = function (tile, collides) -{ - if (collides) - { - tile.setCollision(true, true, true, true, false); - } - else - { - tile.resetCollision(false); - } -}; - -module.exports = SetTileCollision; +module.exports = 'step'; /***/ }), -/* 73 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 98704: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AnimationState = __webpack_require__(164); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(15); -var SpriteRender = __webpack_require__(1065); - /** - * @classdesc - * A Sprite Game Object. + * The Game Visible Event. * - * A Sprite Game Object is used for the display of both static and animated images in your game. - * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled - * and animated. + * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded + * enters a visible state, previously having been hidden. * - * The main difference between a Sprite and an Image Game Object is that you cannot animate Images. - * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation - * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases. + * Only browsers that support the Visibility API will cause this event to be emitted. * - * @class Sprite - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor + * @event Phaser.Core.Events#VISIBLE + * @type {string} * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.TextureCrop - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ -var Sprite = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.Depth, - Components.Flip, - Components.GetBounds, - Components.Mask, - Components.Origin, - Components.Pipeline, - Components.ScrollFactor, - Components.Size, - Components.TextureCrop, - Components.Tint, - Components.Transform, - Components.Visible, - SpriteRender - ], - - initialize: - - function Sprite (scene, x, y, texture, frame) - { - GameObject.call(this, scene, 'Sprite'); - - /** - * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. - * - * @name Phaser.GameObjects.Sprite#_crop - * @type {object} - * @private - * @since 3.11.0 - */ - this._crop = this.resetCropObject(); - - /** - * The Animation State component of this Sprite. - * - * This component provides features to apply animations to this Sprite. - * It is responsible for playing, loading, queuing animations for later playback, - * mixing between animations and setting the current animation frame to this Sprite. - * - * @name Phaser.GameObjects.Sprite#anims - * @type {Phaser.Animations.AnimationState} - * @since 3.0.0 - */ - this.anims = new AnimationState(this); - - this.setTexture(texture, frame); - this.setPosition(x, y); - this.setSizeToFrame(); - this.setOriginFromFrame(); - this.initPipeline(); - }, - - // Overrides Game Object method - addedToScene: function () - { - this.scene.sys.updateList.add(this); - }, +module.exports = 'visible'; - // Overrides Game Object method - removedFromScene: function () - { - this.scene.sys.updateList.remove(this); - }, - /** - * Update this Sprite's animations. - * - * @method Phaser.GameObjects.Sprite#preUpdate - * @protected - * @since 3.0.0 - * - * @param {number} time - The current timestamp. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. - */ - preUpdate: function (time, delta) - { - this.anims.update(time, delta); - }, +/***/ }), - /** - * Start playing the given animation on this Sprite. - * - * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. - * - * The benefit of a global animation is that multiple Sprites can all play the same animation, without - * having to duplicate the data. You can just create it once and then play it on any Sprite. - * - * The following code shows how to create a global repeating animation. The animation will be created - * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': - * - * ```javascript - * var config = { - * key: 'run', - * frames: 'muybridge', - * frameRate: 15, - * repeat: -1 - * }; - * - * // This code should be run from within a Scene: - * this.anims.create(config); - * ``` - * - * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, - * you can call the `Animation.create` method instead. It accepts the exact same parameters as when - * creating a global animation, however the resulting data is kept locally in this Sprite. - * - * With the animation created, either globally or locally, you can now play it on this Sprite: - * - * ```javascript - * this.add.sprite(x, y).play('run'); - * ``` - * - * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config - * object instead: - * - * ```javascript - * this.add.sprite(x, y).play({ key: 'run', frameRate: 24 }); - * ``` - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * If you need a Sprite to be able to play both local and global animations, make sure they don't - * have conflicting keys. - * - * See the documentation for the `PlayAnimationConfig` config object for more details about this. - * - * Also, see the documentation in the Animation Manager for further details on creating animations. - * - * @method Phaser.GameObjects.Sprite#play - * @fires Phaser.Animations.Events#ANIMATION_START - * @since 3.0.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. - * - * @return {this} This Game Object. - */ - play: function (key, ignoreIfPlaying) - { - return this.anims.play(key, ignoreIfPlaying); - }, +/***/ 97081: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Start playing the given animation on this Sprite, in reverse. - * - * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. - * - * The benefit of a global animation is that multiple Sprites can all play the same animation, without - * having to duplicate the data. You can just create it once and then play it on any Sprite. - * - * The following code shows how to create a global repeating animation. The animation will be created - * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': - * - * ```javascript - * var config = { - * key: 'run', - * frames: 'muybridge', - * frameRate: 15, - * repeat: -1 - * }; - * - * // This code should be run from within a Scene: - * this.anims.create(config); - * ``` - * - * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, - * you can call the `Animation.create` method instead. It accepts the exact same parameters as when - * creating a global animation, however the resulting data is kept locally in this Sprite. - * - * With the animation created, either globally or locally, you can now play it on this Sprite: - * - * ```javascript - * this.add.sprite(x, y).playReverse('run'); - * ``` - * - * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config - * object instead: - * - * ```javascript - * this.add.sprite(x, y).playReverse({ key: 'run', frameRate: 24 }); - * ``` - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * If you need a Sprite to be able to play both local and global animations, make sure they don't - * have conflicting keys. - * - * See the documentation for the `PlayAnimationConfig` config object for more details about this. - * - * Also, see the documentation in the Animation Manager for further details on creating animations. - * - * @method Phaser.GameObjects.Sprite#playReverse - * @fires Phaser.Animations.Events#ANIMATION_START - * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. - * - * @return {this} This Game Object. - */ - playReverse: function (key, ignoreIfPlaying) - { - return this.anims.playReverse(key, ignoreIfPlaying); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Waits for the specified delay, in milliseconds, then starts playback of the given animation. - * - * If the animation _also_ has a delay value set in its config, it will be **added** to the delay given here. - * - * If an animation is already running and a new animation is given to this method, it will wait for - * the given delay before starting the new animation. - * - * If no animation is currently running, the given one begins after the delay. - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * Prior to Phaser 3.50 this method was called 'delayedPlay'. - * - * @method Phaser.GameObjects.Sprite#playAfterDelay - * @fires Phaser.Animations.Events#ANIMATION_START - * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {number} delay - The delay, in milliseconds, to wait before starting the animation playing. - * - * @return {this} This Game Object. - */ - playAfterDelay: function (key, delay) - { - return this.anims.playAfterDelay(key, delay); - }, +/** + * @namespace Phaser.Core.Events + */ - /** - * Waits for the current animation to complete the `repeatCount` number of repeat cycles, then starts playback - * of the given animation. - * - * You can use this to ensure there are no harsh jumps between two sets of animations, i.e. going from an - * idle animation to a walking animation, by making them blend smoothly into each other. - * - * If no animation is currently running, the given one will start immediately. - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * @method Phaser.GameObjects.Sprite#playAfterRepeat - * @fires Phaser.Animations.Events#ANIMATION_START - * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {number} [repeatCount=1] - How many times should the animation repeat before the next one starts? - * - * @return {this} This Game Object. - */ - playAfterRepeat: function (key, repeatCount) - { - return this.anims.playAfterRepeat(key, repeatCount); - }, +module.exports = { - /** - * Sets an animation, or an array of animations, to be played immediately after the current one completes or stops. - * - * The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, - * or have the `stop` method called directly on it. - * - * An animation set to repeat forever will never enter a completed state. - * - * You can chain a new animation at any point, including before the current one starts playing, during it, - * or when it ends (via its `animationcomplete` event). - * - * Chained animations are specific to a Game Object, meaning different Game Objects can have different chained - * animations without impacting the animation they're playing. - * - * Call this method with no arguments to reset all currently chained animations. - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * @method Phaser.GameObjects.Sprite#chain - * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig|string[]|Phaser.Animations.Animation[]|Phaser.Types.Animations.PlayAnimationConfig[])} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object, or an array of them. - * - * @return {this} This Game Object. - */ - chain: function (key) - { - return this.anims.chain(key); - }, + BLUR: __webpack_require__(41651), + BOOT: __webpack_require__(5520), + CONTEXT_LOST: __webpack_require__(51673), + DESTROY: __webpack_require__(25055), + FOCUS: __webpack_require__(23767), + HIDDEN: __webpack_require__(57564), + PAUSE: __webpack_require__(38327), + POST_RENDER: __webpack_require__(43807), + POST_STEP: __webpack_require__(73652), + PRE_RENDER: __webpack_require__(780), + PRE_STEP: __webpack_require__(13781), + READY: __webpack_require__(38247), + RESUME: __webpack_require__(29129), + STEP: __webpack_require__(34994), + VISIBLE: __webpack_require__(98704) - /** - * Immediately stops the current animation from playing and dispatches the `ANIMATION_STOP` events. - * - * If no animation is playing, no event will be dispatched. - * - * If there is another animation queued (via the `chain` method) then it will start playing immediately. - * - * @method Phaser.GameObjects.Sprite#stop - * @fires Phaser.Animations.Events#ANIMATION_STOP - * @since 3.50.0 - * - * @return {this} This Game Object. - */ - stop: function () - { - return this.anims.stop(); - }, +}; - /** - * Stops the current animation from playing after the specified time delay, given in milliseconds. - * - * It then dispatches the `ANIMATION_STOP` event. - * - * If no animation is running, no events will be dispatched. - * - * If there is another animation in the queue (set via the `chain` method) then it will start playing, - * when the current one stops. - * - * @method Phaser.GameObjects.Sprite#stopAfterDelay - * @fires Phaser.Animations.Events#ANIMATION_STOP - * @since 3.50.0 - * - * @param {number} delay - The number of milliseconds to wait before stopping this animation. - * - * @return {this} This Game Object. - */ - stopAfterDelay: function (delay) - { - return this.anims.stopAfterDelay(delay); - }, - /** - * Stops the current animation from playing after the given number of repeats. - * - * It then dispatches the `ANIMATION_STOP` event. - * - * If no animation is running, no events will be dispatched. - * - * If there is another animation in the queue (set via the `chain` method) then it will start playing, - * when the current one stops. - * - * @method Phaser.GameObjects.Sprite#stopAfterRepeat - * @fires Phaser.Animations.Events#ANIMATION_STOP - * @since 3.50.0 - * - * @param {number} [repeatCount=1] - How many times should the animation repeat before stopping? - * - * @return {this} This Game Object. - */ - stopAfterRepeat: function (repeatCount) - { - return this.anims.stopAfterRepeat(repeatCount); - }, +/***/ }), - /** - * Stops the current animation from playing when it next sets the given frame. - * If this frame doesn't exist within the animation it will not stop it from playing. - * - * It then dispatches the `ANIMATION_STOP` event. - * - * If no animation is running, no events will be dispatched. - * - * If there is another animation in the queue (set via the `chain` method) then it will start playing, - * when the current one stops. - * - * @method Phaser.GameObjects.Sprite#stopOnFrame - * @fires Phaser.Animations.Events#ANIMATION_STOP - * @since 3.50.0 - * - * @param {Phaser.Animations.AnimationFrame} frame - The frame to check before stopping this animation. - * - * @return {this} This Game Object. - */ - stopOnFrame: function (frame) - { - return this.anims.stopOnFrame(frame); - }, +/***/ 80293: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Build a JSON representation of this Sprite. - * - * @method Phaser.GameObjects.Sprite#toJSON - * @since 3.0.0 - * - * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. - */ - toJSON: function () - { - return Components.ToJSON(this); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Handles the pre-destroy step for the Sprite, which removes the Animation component. - * - * @method Phaser.GameObjects.Sprite#preDestroy - * @private - * @since 3.14.0 - */ - preDestroy: function () - { - this.anims.destroy(); +/** + * @namespace Phaser.Core + */ - this.anims = undefined; - } +module.exports = { -}); + Config: __webpack_require__(14033), + CreateRenderer: __webpack_require__(50150), + DebugHeader: __webpack_require__(77291), + Events: __webpack_require__(97081), + TimeStep: __webpack_require__(26617), + VisibilityHandler: __webpack_require__(26493) -module.exports = Sprite; +}; /***/ }), -/* 74 */ -/***/ (function(module, exports) { + +/***/ 52780: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Arne16 = __webpack_require__(81543); +var CanvasPool = __webpack_require__(61068); +var GetValue = __webpack_require__(10850); + /** - * Removes a single item from an array and returns it without creating gc, like the native splice does. - * Based on code by Mike Reinstein. + * Generates a texture based on the given Create configuration object. * - * @function Phaser.Utils.Array.SpliceOne + * The texture is drawn using a fixed-size indexed palette of 16 colors, where the hex value in the + * data cells map to a single color. For example, if the texture config looked like this: + * + * ```javascript + * var star = [ + * '.....828.....', + * '....72227....', + * '....82228....', + * '...7222227...', + * '2222222222222', + * '8222222222228', + * '.72222222227.', + * '..787777787..', + * '..877777778..', + * '.78778887787.', + * '.27887.78872.', + * '.787.....787.' + * ]; + * + * this.textures.generate('star', { data: star, pixelWidth: 4 }); + * ``` + * + * Then it would generate a texture that is 52 x 48 pixels in size, because each cell of the data array + * represents 1 pixel multiplied by the `pixelWidth` value. The cell values, such as `8`, maps to color + * number 8 in the palette. If a cell contains a period character `.` then it is transparent. + * + * The default palette is Arne16, but you can specify your own using the `palette` property. + * + * @function Phaser.Create.GenerateTexture * @since 3.0.0 * - * @param {array} array - The array to splice from. - * @param {number} index - The index of the item which should be spliced. + * @param {Phaser.Types.Create.GenerateTextureConfig} config - The Generate Texture Configuration object. * - * @return {*} The item which was spliced (removed). + * @return {HTMLCanvasElement} An HTMLCanvasElement which contains the generated texture drawn to it. */ -var SpliceOne = function (array, index) +var GenerateTexture = function (config) { - if (index >= array.length) + var data = GetValue(config, 'data', []); + var canvas = GetValue(config, 'canvas', null); + var palette = GetValue(config, 'palette', Arne16); + var pixelWidth = GetValue(config, 'pixelWidth', 1); + var pixelHeight = GetValue(config, 'pixelHeight', pixelWidth); + var resizeCanvas = GetValue(config, 'resizeCanvas', true); + var clearCanvas = GetValue(config, 'clearCanvas', true); + var preRender = GetValue(config, 'preRender', null); + var postRender = GetValue(config, 'postRender', null); + + var width = Math.floor(Math.abs(data[0].length * pixelWidth)); + var height = Math.floor(Math.abs(data.length * pixelHeight)); + + if (!canvas) { - return; + canvas = CanvasPool.create2D(this, width, height); + resizeCanvas = false; + clearCanvas = false; } - var len = array.length - 1; + if (resizeCanvas) + { + canvas.width = width; + canvas.height = height; + } - var item = array[index]; + var ctx = canvas.getContext('2d', { willReadFrequently: true }); - for (var i = index; i < len; i++) + if (clearCanvas) { - array[i] = array[i + 1]; + ctx.clearRect(0, 0, width, height); } - array.length = len; + // preRender Callback? + if (preRender) + { + preRender(canvas, ctx); + } - return item; + // Draw it + for (var y = 0; y < data.length; y++) + { + var row = data[y]; + + for (var x = 0; x < row.length; x++) + { + var d = row[x]; + + if (d !== '.' && d !== ' ') + { + ctx.fillStyle = palette[d]; + ctx.fillRect(x * pixelWidth, y * pixelHeight, pixelWidth, pixelHeight); + } + } + } + + // postRender Callback? + if (postRender) + { + postRender(canvas, ctx); + } + + return canvas; }; -module.exports = SpliceOne; +module.exports = GenerateTexture; /***/ }), -/* 75 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 84106: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @namespace Phaser.GameObjects.Events + * @namespace Phaser.Create */ module.exports = { - ADDED_TO_SCENE: __webpack_require__(643), - DESTROY: __webpack_require__(644), - REMOVED_FROM_SCENE: __webpack_require__(645), - VIDEO_COMPLETE: __webpack_require__(646), - VIDEO_CREATED: __webpack_require__(647), - VIDEO_ERROR: __webpack_require__(648), - VIDEO_LOOP: __webpack_require__(649), - VIDEO_PLAY: __webpack_require__(650), - VIDEO_SEEKED: __webpack_require__(651), - VIDEO_SEEKING: __webpack_require__(652), - VIDEO_STOP: __webpack_require__(653), - VIDEO_TIMEOUT: __webpack_require__(654), - VIDEO_UNLOCKED: __webpack_require__(655) + GenerateTexture: __webpack_require__(52780), + Palettes: __webpack_require__(25235) }; /***/ }), -/* 76 */ -/***/ (function(module, exports) { + +/***/ 81543: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Snap a value to nearest grid slice, using floor. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. - * As will `14` snap to `10`... but `16` will snap to `15`. + * A 16 color palette by [Arne](http://androidarts.com/palette/16pal.htm) * - * @function Phaser.Math.Snap.Floor + * @name Phaser.Create.Palettes.ARNE16 * @since 3.0.0 * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. + * @type {Phaser.Types.Create.Palette} */ -var SnapFloor = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } - - if (gap === 0) - { - return value; - } - - value -= start; - value = gap * Math.floor(value / gap); - - return (divide) ? (start + value) / gap : start + value; +module.exports = { + 0: '#000', + 1: '#9D9D9D', + 2: '#FFF', + 3: '#BE2633', + 4: '#E06F8B', + 5: '#493C2B', + 6: '#A46422', + 7: '#EB8931', + 8: '#F7E26B', + 9: '#2F484E', + A: '#44891A', + B: '#A3CE27', + C: '#1B2632', + D: '#005784', + E: '#31A2F2', + F: '#B2DCEF' }; -module.exports = SnapFloor; - /***/ }), -/* 77 */ -/***/ (function(module, exports) { + +/***/ 75846: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Shallow Object Clone. Will not clone nested objects. + * A 16 color palette inspired by the Commodore 64. * - * @function Phaser.Utils.Objects.Clone + * @name Phaser.Create.Palettes.C64 * @since 3.0.0 * - * @param {object} obj - The object to clone. - * - * @return {object} A new object with the same properties as the input object. + * @type {Phaser.Types.Create.Palette} */ -var Clone = function (obj) -{ - var clone = {}; - - for (var key in obj) - { - if (Array.isArray(obj[key])) - { - clone[key] = obj[key].slice(0); - } - else - { - clone[key] = obj[key]; - } - } - - return clone; +module.exports = { + 0: '#000', + 1: '#fff', + 2: '#8b4131', + 3: '#7bbdc5', + 4: '#8b41ac', + 5: '#6aac41', + 6: '#3931a4', + 7: '#d5de73', + 8: '#945a20', + 9: '#5a4100', + A: '#bd736a', + B: '#525252', + C: '#838383', + D: '#acee8b', + E: '#7b73de', + F: '#acacac' }; -module.exports = Clone; - /***/ }), -/* 78 */ -/***/ (function(module, exports) { + +/***/ 83206: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Tests if the start and end indexes are a safe range for the given array. - * - * @function Phaser.Utils.Array.SafeRange - * @since 3.4.0 + * A 16 color CGA inspired palette by [Arne](http://androidarts.com/palette/16pal.htm) * - * @param {array} array - The array to check. - * @param {number} startIndex - The start index. - * @param {number} endIndex - The end index. - * @param {boolean} [throwError=true] - Throw an error if the range is out of bounds. + * @name Phaser.Create.Palettes.CGA + * @since 3.0.0 * - * @return {boolean} True if the range is safe, otherwise false. + * @type {Phaser.Types.Create.Palette} */ -var SafeRange = function (array, startIndex, endIndex, throwError) -{ - var len = array.length; - - if (startIndex < 0 || - startIndex > len || - startIndex >= endIndex || - endIndex > len || - startIndex + endIndex > len) - { - if (throwError) - { - throw new Error('Range Error: Values outside acceptable range'); - } - - return false; - } - else - { - return true; - } +module.exports = { + 0: '#000', + 1: '#2234d1', + 2: '#0c7e45', + 3: '#44aacc', + 4: '#8a3622', + 5: '#5c2e78', + 6: '#aa5c3d', + 7: '#b5b5b5', + 8: '#5e606e', + 9: '#4c81fb', + A: '#6cd947', + B: '#7be2f9', + C: '#eb8a60', + D: '#e23d69', + E: '#ffd93f', + F: '#fff' }; -module.exports = SafeRange; - /***/ }), -/* 79 */ -/***/ (function(module, exports) { + +/***/ 13194: +/***/ ((module) => { /** * @author Richard Davey - * @author Angry Bytes (and contributors) - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The comparator function. - * - * @ignore - * - * @param {*} a - The first item to test. - * @param {*} b - The second itemt to test. - * - * @return {boolean} True if they localCompare, otherwise false. - */ -function Compare (a, b) -{ - return String(a).localeCompare(b); -} - -/** - * Process the array contents. - * - * @ignore + * A 16 color JMP palette by [Arne](http://androidarts.com/palette/16pal.htm) * - * @param {array} array - The array to process. - * @param {function} compare - The comparison function. + * @name Phaser.Create.Palettes.JMP + * @since 3.0.0 * - * @return {array} - The processed array. + * @type {Phaser.Types.Create.Palette} */ -function Process (array, compare) -{ - // Short-circuit when there's nothing to sort. - var len = array.length; - - if (len <= 1) - { - return array; - } - - // Rather than dividing input, simply iterate chunks of 1, 2, 4, 8, etc. - // Chunks are the size of the left or right hand in merge sort. - // Stop when the left-hand covers all of the array. - var buffer = new Array(len); - - for (var chk = 1; chk < len; chk *= 2) - { - RunPass(array, compare, chk, buffer); +module.exports = { + 0: '#000', + 1: '#191028', + 2: '#46af45', + 3: '#a1d685', + 4: '#453e78', + 5: '#7664fe', + 6: '#833129', + 7: '#9ec2e8', + 8: '#dc534b', + 9: '#e18d79', + A: '#d6b97b', + B: '#e9d8a1', + C: '#216c4b', + D: '#d365c8', + E: '#afaab9', + F: '#f5f4eb' +}; - var tmp = array; - array = buffer; +/***/ }), - buffer = tmp; - } +/***/ 50686: +/***/ ((module) => { - return array; -} +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ /** - * Run a single pass with the given chunk size. + * A 16 color palette inspired by Japanese computers like the MSX. * - * @ignore + * @name Phaser.Create.Palettes.MSX + * @since 3.0.0 * - * @param {array} arr - The array to run the pass on. - * @param {function} comp - The comparison function. - * @param {number} chk - The number of iterations. - * @param {array} result - The array to store the result in. + * @type {Phaser.Types.Create.Palette} */ -function RunPass (arr, comp, chk, result) -{ - var len = arr.length; - var i = 0; - - // Step size / double chunk size. - var dbl = chk * 2; - - // Bounds of the left and right chunks. - var l, r, e; - - // Iterators over the left and right chunk. - var li, ri; - - // Iterate over pairs of chunks. - for (l = 0; l < len; l += dbl) - { - r = l + chk; - e = r + chk; +module.exports = { + 0: '#000', + 1: '#191028', + 2: '#46af45', + 3: '#a1d685', + 4: '#453e78', + 5: '#7664fe', + 6: '#833129', + 7: '#9ec2e8', + 8: '#dc534b', + 9: '#e18d79', + A: '#d6b97b', + B: '#e9d8a1', + C: '#216c4b', + D: '#d365c8', + E: '#afaab9', + F: '#fff' +}; - if (r > len) - { - r = len; - } - if (e > len) - { - e = len; - } +/***/ }), - // Iterate both chunks in parallel. - li = l; - ri = r; +/***/ 25235: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - while (true) - { - // Compare the chunks. - if (li < r && ri < e) - { - // This works for a regular `sort()` compatible comparator, - // but also for a simple comparator like: `a > b` - if (comp(arr[li], arr[ri]) <= 0) - { - result[i++] = arr[li++]; - } - else - { - result[i++] = arr[ri++]; - } - } - else if (li < r) - { - // Nothing to compare, just flush what's left. - result[i++] = arr[li++]; - } - else if (ri < e) - { - result[i++] = arr[ri++]; - } - else - { - // Both iterators are at the chunk ends. - break; - } - } - } -} +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ /** - * An in-place stable array sort, because `Array#sort()` is not guaranteed stable. - * - * This is an implementation of merge sort, without recursion. - * - * Function based on the Two-Screen/stable sort 0.1.8 from https://github.com/Two-Screen/stable - * - * @function Phaser.Utils.Array.StableSort - * @since 3.0.0 - * - * @param {array} array - The input array to be sorted. - * @param {function} [compare] - The comparison function. - * - * @return {array} The sorted result. + * @namespace Phaser.Create.Palettes */ -var StableSort = function (array, compare) -{ - if (compare === undefined) { compare = Compare; } - var result = Process(array, compare); +module.exports = { - // This simply copies back if the result isn't in the original array, which happens on an odd number of passes. - if (result !== array) - { - RunPass(result, null, array.length, array); - } + ARNE16: __webpack_require__(81543), + C64: __webpack_require__(75846), + CGA: __webpack_require__(83206), + JMP: __webpack_require__(13194), + MSX: __webpack_require__(50686) - return array; }; -module.exports = StableSort; - /***/ }), -/* 80 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 63120: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var EaseMap = __webpack_require__(134); -var UppercaseFirst = __webpack_require__(205); +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + +var Class = __webpack_require__(56694); +var CubicBezier = __webpack_require__(34631); +var Curve = __webpack_require__(38517); +var Vector2 = __webpack_require__(93736); /** - * This internal function is used to return the correct ease function for a Tween. - * - * It can take a variety of input, including an EaseMap based string, or a custom function. + * @classdesc + * A higher-order Bézier curve constructed of four points. * - * @function Phaser.Tweens.Builders.GetEaseFunction + * @class CubicBezier + * @extends Phaser.Curves.Curve + * @memberof Phaser.Curves + * @constructor * @since 3.0.0 * - * @param {(string|function)} ease - The ease to find. This can be either a string from the EaseMap, or a custom function. - * @param {number[]} [easeParams] - An optional array of ease parameters to go with the ease. - * - * @return {function} The ease function. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector2[])} p0 - Start point, or an array of point pairs. + * @param {Phaser.Math.Vector2} p1 - Control Point 1. + * @param {Phaser.Math.Vector2} p2 - Control Point 2. + * @param {Phaser.Math.Vector2} p3 - End Point. */ -var GetEaseFunction = function (ease, easeParams) -{ - // Default ease function - var easeFunction = EaseMap.Power0; +var CubicBezierCurve = new Class({ - // Prepare ease function - if (typeof ease === 'string') + Extends: Curve, + + initialize: + + function CubicBezierCurve (p0, p1, p2, p3) { - // String based look-up + Curve.call(this, 'CubicBezierCurve'); - // 1) They specified it correctly - if (EaseMap.hasOwnProperty(ease)) + if (Array.isArray(p0)) { - easeFunction = EaseMap[ease]; + p3 = new Vector2(p0[6], p0[7]); + p2 = new Vector2(p0[4], p0[5]); + p1 = new Vector2(p0[2], p0[3]); + p0 = new Vector2(p0[0], p0[1]); } - else - { - // Do some string manipulation to try and find it - var direction = ''; - if (ease.indexOf('.')) - { - // quad.in = Quad.easeIn - // quad.out = Quad.easeOut - // quad.inout = Quad.easeInOut + /** + * The start point of this curve. + * + * @name Phaser.Curves.CubicBezier#p0 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p0 = p0; - direction = ease.substr(ease.indexOf('.') + 1); + /** + * The first control point of this curve. + * + * @name Phaser.Curves.CubicBezier#p1 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p1 = p1; - if (direction.toLowerCase() === 'in') - { - direction = 'easeIn'; - } - else if (direction.toLowerCase() === 'out') - { - direction = 'easeOut'; - } - else if (direction.toLowerCase() === 'inout') - { - direction = 'easeInOut'; - } - } + /** + * The second control point of this curve. + * + * @name Phaser.Curves.CubicBezier#p2 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p2 = p2; - ease = UppercaseFirst(ease.substr(0, ease.indexOf('.') + 1) + direction); + /** + * The end point of this curve. + * + * @name Phaser.Curves.CubicBezier#p3 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p3 = p3; + }, - if (EaseMap.hasOwnProperty(ease)) - { - easeFunction = EaseMap[ease]; - } - } - } - else if (typeof ease === 'function') + /** + * Gets the starting point on the curve. + * + * @method Phaser.Curves.CubicBezier#getStartPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + */ + getStartPoint: function (out) { - // Custom function - easeFunction = ease; - } - else if (Array.isArray(ease) && ease.length === 4) + if (out === undefined) { out = new Vector2(); } + + return out.copy(this.p0); + }, + + /** + * Returns the resolution of this curve. + * + * @method Phaser.Curves.CubicBezier#getResolution + * @since 3.0.0 + * + * @param {number} divisions - The amount of divisions used by this curve. + * + * @return {number} The resolution of the curve. + */ + getResolution: function (divisions) { - // Bezier function (TODO) - } + return divisions; + }, - // No custom ease parameters? - if (!easeParams) + /** + * Get point at relative position in curve according to length. + * + * @method Phaser.Curves.CubicBezier#getPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + */ + getPoint: function (t, out) { - // Return ease function - return easeFunction; - } + if (out === undefined) { out = new Vector2(); } - var cloneParams = easeParams.slice(0); + var p0 = this.p0; + var p1 = this.p1; + var p2 = this.p2; + var p3 = this.p3; - cloneParams.unshift(0); + return out.set(CubicBezier(t, p0.x, p1.x, p2.x, p3.x), CubicBezier(t, p0.y, p1.y, p2.y, p3.y)); + }, - // Return ease function with custom ease parameters - return function (v) + /** + * Draws this curve to the specified graphics object. + * + * @method Phaser.Curves.CubicBezier#draw + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] + * + * @param {Phaser.GameObjects.Graphics} graphics - The graphics object this curve should be drawn to. + * @param {number} [pointsTotal=32] - The number of intermediary points that make up this curve. A higher number of points will result in a smoother curve. + * + * @return {Phaser.GameObjects.Graphics} The graphics object this curve was drawn to. Useful for method chaining. + */ + draw: function (graphics, pointsTotal) { - cloneParams[0] = v; + if (pointsTotal === undefined) { pointsTotal = 32; } - return easeFunction.apply(this, cloneParams); - }; -}; + var points = this.getPoints(pointsTotal); -module.exports = GetEaseFunction; + graphics.beginPath(); + graphics.moveTo(this.p0.x, this.p0.y); + for (var i = 1; i < points.length; i++) + { + graphics.lineTo(points[i].x, points[i].y); + } -/***/ }), -/* 81 */ -/***/ (function(module, exports, __webpack_require__) { + graphics.strokePath(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // So you can chain graphics calls + return graphics; + }, + + /** + * Returns a JSON object that describes this curve. + * + * @method Phaser.Curves.CubicBezier#toJSON + * @since 3.0.0 + * + * @return {Phaser.Types.Curves.JSONCurve} The JSON object containing this curve data. + */ + toJSON: function () + { + return { + type: this.type, + points: [ + this.p0.x, this.p0.y, + this.p1.x, this.p1.y, + this.p2.x, this.p2.y, + this.p3.x, this.p3.y + ] + }; + } -var Utils = __webpack_require__(12); +}); /** - * Renders a stroke outline around the given Shape. + * Generates a curve from a JSON object. * - * @method Phaser.GameObjects.Shape#StrokePathWebGL - * @since 3.13.0 - * @private + * @function Phaser.Curves.CubicBezier.fromJSON + * @since 3.0.0 * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The WebGL Pipeline used to render this Shape. - * @param {Phaser.GameObjects.Shape} src - The Game Object shape being rendered in this call. - * @param {number} alpha - The base alpha value. - * @param {number} dx - The source displayOriginX. - * @param {number} dy - The source displayOriginY. + * @param {Phaser.Types.Curves.JSONCurve} data - The JSON object containing this curve data. + * + * @return {Phaser.Curves.CubicBezier} The curve generated from the JSON object. */ -var StrokePathWebGL = function (pipeline, src, alpha, dx, dy) +CubicBezierCurve.fromJSON = function (data) { - var strokeTint = pipeline.strokeTint; - var strokeTintColor = Utils.getTintAppendFloatAlpha(src.strokeColor, src.strokeAlpha * alpha); - - strokeTint.TL = strokeTintColor; - strokeTint.TR = strokeTintColor; - strokeTint.BL = strokeTintColor; - strokeTint.BR = strokeTintColor; - - var path = src.pathData; - var pathLength = path.length - 1; - var lineWidth = src.lineWidth; - var halfLineWidth = lineWidth / 2; - - var px1 = path[0] - dx; - var py1 = path[1] - dy; - - if (!src.closePath) - { - pathLength -= 2; - } - - for (var i = 2; i < pathLength; i += 2) - { - var px2 = path[i] - dx; - var py2 = path[i + 1] - dy; + var points = data.points; - pipeline.batchLine( - px1, - py1, - px2, - py2, - halfLineWidth, - halfLineWidth, - lineWidth, - i - 2, - (src.closePath) ? (i === pathLength - 1) : false - ); + var p0 = new Vector2(points[0], points[1]); + var p1 = new Vector2(points[2], points[3]); + var p2 = new Vector2(points[4], points[5]); + var p3 = new Vector2(points[6], points[7]); - px1 = px2; - py1 = py2; - } + return new CubicBezierCurve(p0, p1, p2, p3); }; -module.exports = StrokePathWebGL; +module.exports = CubicBezierCurve; /***/ }), -/* 82 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 38517: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Contains = __webpack_require__(115); -var GetPoint = __webpack_require__(476); -var GetPoints = __webpack_require__(477); -var GEOM_CONST = __webpack_require__(56); -var Line = __webpack_require__(47); -var Random = __webpack_require__(181); +var Class = __webpack_require__(56694); +var FromPoints = __webpack_require__(80222); +var Rectangle = __webpack_require__(74118); +var Vector2 = __webpack_require__(93736); /** * @classdesc - * A triangle is a plane created by connecting three points. - * The first two arguments specify the first point, the middle two arguments - * specify the second point, and the last two arguments specify the third point. + * A Base Curve class, which all other curve types extend. * - * @class Triangle - * @memberof Phaser.Geom + * Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + * + * @class Curve + * @memberof Phaser.Curves * @constructor * @since 3.0.0 * - * @param {number} [x1=0] - `x` coordinate of the first point. - * @param {number} [y1=0] - `y` coordinate of the first point. - * @param {number} [x2=0] - `x` coordinate of the second point. - * @param {number} [y2=0] - `y` coordinate of the second point. - * @param {number} [x3=0] - `x` coordinate of the third point. - * @param {number} [y3=0] - `y` coordinate of the third point. + * @param {string} type - The curve type. */ -var Triangle = new Class({ +var Curve = new Class({ initialize: - function Triangle (x1, y1, x2, y2, x3, y3) + function Curve (type) { - if (x1 === undefined) { x1 = 0; } - if (y1 === undefined) { y1 = 0; } - if (x2 === undefined) { x2 = 0; } - if (y2 === undefined) { y2 = 0; } - if (x3 === undefined) { x3 = 0; } - if (y3 === undefined) { y3 = 0; } + /** + * String based identifier for the type of curve. + * + * @name Phaser.Curves.Curve#type + * @type {string} + * @since 3.0.0 + */ + this.type = type; /** - * The geometry constant type of this object: `GEOM_CONST.TRIANGLE`. - * Used for fast type comparisons. + * The default number of divisions within the curve. * - * @name Phaser.Geom.Triangle#type + * @name Phaser.Curves.Curve#defaultDivisions * @type {number} - * @readonly - * @since 3.19.0 + * @default 5 + * @since 3.0.0 */ - this.type = GEOM_CONST.TRIANGLE; + this.defaultDivisions = 5; /** - * `x` coordinate of the first point. + * The quantity of arc length divisions within the curve. * - * @name Phaser.Geom.Triangle#x1 + * @name Phaser.Curves.Curve#arcLengthDivisions * @type {number} - * @default 0 + * @default 100 * @since 3.0.0 */ - this.x1 = x1; + this.arcLengthDivisions = 100; /** - * `y` coordinate of the first point. + * An array of cached arc length values. * - * @name Phaser.Geom.Triangle#y1 - * @type {number} - * @default 0 + * @name Phaser.Curves.Curve#cacheArcLengths + * @type {number[]} + * @default [] * @since 3.0.0 */ - this.y1 = y1; + this.cacheArcLengths = []; /** - * `x` coordinate of the second point. + * Does the data of this curve need updating? * - * @name Phaser.Geom.Triangle#x2 - * @type {number} - * @default 0 + * @name Phaser.Curves.Curve#needsUpdate + * @type {boolean} + * @default true * @since 3.0.0 */ - this.x2 = x2; + this.needsUpdate = true; /** - * `y` coordinate of the second point. + * For a curve on a Path, `false` means the Path will ignore this curve. * - * @name Phaser.Geom.Triangle#y2 - * @type {number} - * @default 0 + * @name Phaser.Curves.Curve#active + * @type {boolean} + * @default true * @since 3.0.0 */ - this.y2 = y2; + this.active = true; /** - * `x` coordinate of the third point. + * A temporary calculation Vector. * - * @name Phaser.Geom.Triangle#x3 - * @type {number} - * @default 0 + * @name Phaser.Curves.Curve#_tmpVec2A + * @type {Phaser.Math.Vector2} + * @private * @since 3.0.0 */ - this.x3 = x3; + this._tmpVec2A = new Vector2(); /** - * `y` coordinate of the third point. + * A temporary calculation Vector. * - * @name Phaser.Geom.Triangle#y3 - * @type {number} - * @default 0 + * @name Phaser.Curves.Curve#_tmpVec2B + * @type {Phaser.Math.Vector2} + * @private * @since 3.0.0 */ - this.y3 = y3; + this._tmpVec2B = new Vector2(); }, /** - * Checks whether a given points lies within the triangle. + * Draws this curve on the given Graphics object. * - * @method Phaser.Geom.Triangle#contains + * The curve is drawn using `Graphics.strokePoints` so will be drawn at whatever the present Graphics stroke color is. + * The Graphics object is not cleared before the draw, so the curve will appear on-top of anything else already rendered to it. + * + * @method Phaser.Curves.Curve#draw * @since 3.0.0 * - * @param {number} x - The x coordinate of the point to check. - * @param {number} y - The y coordinate of the point to check. + * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] * - * @return {boolean} `true` if the coordinate pair is within the triangle, otherwise `false`. + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics instance onto which this curve will be drawn. + * @param {number} [pointsTotal=32] - The resolution of the curve. The higher the value the smoother it will render, at the cost of rendering performance. + * + * @return {Phaser.GameObjects.Graphics} The Graphics object to which the curve was drawn. */ - contains: function (x, y) + draw: function (graphics, pointsTotal) { - return Contains(this, x, y); + if (pointsTotal === undefined) { pointsTotal = 32; } + + // So you can chain graphics calls + return graphics.strokePoints(this.getPoints(pointsTotal)); }, /** - * Returns a specific point on the triangle. + * Returns a Rectangle where the position and dimensions match the bounds of this Curve. * - * @method Phaser.Geom.Triangle#getPoint - * @since 3.0.0 + * You can control the accuracy of the bounds. The value given is used to work out how many points + * to plot across the curve. Higher values are more accurate at the cost of calculation speed. * - * @generic {Phaser.Geom.Point} O - [output,$return] + * @method Phaser.Curves.Curve#getBounds + * @since 3.0.0 * - * @param {number} position - Position as float within `0` and `1`. `0` equals the first point. - * @param {(Phaser.Geom.Point|object)} [output] - Optional Point, or point-like object, that the calculated point will be written to. + * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the bounds in. If falsey a new object will be created. + * @param {number} [accuracy=16] - The accuracy of the bounds calculations. * - * @return {(Phaser.Geom.Point|object)} Calculated `Point` that represents the requested position. It is the same as `output` when this parameter has been given. + * @return {Phaser.Geom.Rectangle} A Rectangle object holding the bounds of this curve. If `out` was given it will be this object. */ - getPoint: function (position, output) + getBounds: function (out, accuracy) { - return GetPoint(this, position, output); + if (!out) { out = new Rectangle(); } + if (accuracy === undefined) { accuracy = 16; } + + var len = this.getLength(); + + if (accuracy > len) + { + accuracy = len / 2; + } + + // The length of the curve in pixels + // So we'll have 1 spaced point per 'accuracy' pixels + + var spaced = Math.max(1, Math.round(len / accuracy)); + + return FromPoints(this.getSpacedPoints(spaced), out); }, /** - * Calculates a list of evenly distributed points on the triangle. It is either possible to pass an amount of points to be generated (`quantity`) or the distance between two points (`stepRate`). + * Returns an array of points, spaced out X distance pixels apart. + * The smaller the distance, the larger the array will be. * - * @method Phaser.Geom.Triangle#getPoints + * @method Phaser.Curves.Curve#getDistancePoints * @since 3.0.0 * - * @generic {Phaser.Geom.Point[]} O - [output,$return] - * - * @param {number} quantity - Number of points to be generated. Can be falsey when `stepRate` should be used. All points have the same distance along the triangle. - * @param {number} [stepRate] - Distance between two points. Will only be used when `quantity` is falsey. - * @param {(array|Phaser.Geom.Point[])} [output] - Optional Array for writing the calculated points into. Otherwise a new array will be created. + * @param {number} distance - The distance, in pixels, between each point along the curve. * - * @return {(array|Phaser.Geom.Point[])} Returns a list of calculated `Point` instances or the filled array passed as parameter `output`. + * @return {Phaser.Geom.Point[]} An Array of Point objects. */ - getPoints: function (quantity, stepRate, output) + getDistancePoints: function (distance) { - return GetPoints(this, quantity, stepRate, output); + var len = this.getLength(); + + var spaced = Math.max(1, len / distance); + + return this.getSpacedPoints(spaced); }, /** - * Returns a random point along the triangle. + * Get a point at the end of the curve. * - * @method Phaser.Geom.Triangle#getRandomPoint + * @method Phaser.Curves.Curve#getEndPoint * @since 3.0.0 * - * @generic {Phaser.Geom.Point} O - [point,$return] + * @param {Phaser.Math.Vector2} [out] - Optional Vector object to store the result in. * - * @param {Phaser.Geom.Point} [point] - Optional `Point` that should be modified. Otherwise a new one will be created. + * @return {Phaser.Math.Vector2} Vector2 containing the coordinates of the curves end point. + */ + getEndPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + return this.getPointAt(1, out); + }, + + /** + * Get total curve arc length * - * @return {Phaser.Geom.Point} Random `Point`. When parameter `point` has been provided it will be returned. + * @method Phaser.Curves.Curve#getLength + * @since 3.0.0 + * + * @return {number} The total length of the curve. */ - getRandomPoint: function (point) + getLength: function () { - return Random(this, point); + var lengths = this.getLengths(); + + return lengths[lengths.length - 1]; }, + /** - * Sets all three points of the triangle. Leaving out any coordinate sets it to be `0`. + * Get a list of cumulative segment lengths. * - * @method Phaser.Geom.Triangle#setTo + * These lengths are + * + * - [0] 0 + * - [1] The first segment + * - [2] The first and second segment + * - ... + * - [divisions] All segments + * + * @method Phaser.Curves.Curve#getLengths * @since 3.0.0 * - * @param {number} [x1=0] - `x` coordinate of the first point. - * @param {number} [y1=0] - `y` coordinate of the first point. - * @param {number} [x2=0] - `x` coordinate of the second point. - * @param {number} [y2=0] - `y` coordinate of the second point. - * @param {number} [x3=0] - `x` coordinate of the third point. - * @param {number} [y3=0] - `y` coordinate of the third point. + * @param {number} [divisions] - The number of divisions or segments. * - * @return {this} This Triangle object. + * @return {number[]} An array of cumulative lengths. */ - setTo: function (x1, y1, x2, y2, x3, y3) + getLengths: function (divisions) { - if (x1 === undefined) { x1 = 0; } - if (y1 === undefined) { y1 = 0; } - if (x2 === undefined) { x2 = 0; } - if (y2 === undefined) { y2 = 0; } - if (x3 === undefined) { x3 = 0; } - if (y3 === undefined) { y3 = 0; } + if (divisions === undefined) { divisions = this.arcLengthDivisions; } - this.x1 = x1; - this.y1 = y1; + if ((this.cacheArcLengths.length === divisions + 1) && !this.needsUpdate) + { + return this.cacheArcLengths; + } - this.x2 = x2; - this.y2 = y2; + this.needsUpdate = false; - this.x3 = x3; - this.y3 = y3; + var cache = []; + var current; + var last = this.getPoint(0, this._tmpVec2A); + var sum = 0; - return this; + cache.push(0); + + for (var p = 1; p <= divisions; p++) + { + current = this.getPoint(p / divisions, this._tmpVec2B); + + sum += current.distance(last); + + cache.push(sum); + + last.copy(current); + } + + this.cacheArcLengths = cache; + + return cache; // { sums: cache, sum:sum }; Sum is in the last element. }, + // Get point at relative position in curve according to arc length + + // - u [0 .. 1] + /** - * Returns a Line object that corresponds to Line A of this Triangle. + * Get a point at a relative position on the curve, by arc length. * - * @method Phaser.Geom.Triangle#getLineA + * @method Phaser.Curves.Curve#getPointAt * @since 3.0.0 * - * @generic {Phaser.Geom.Line} O - [line,$return] + * @generic {Phaser.Math.Vector2} O - [out,$return] * - * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. + * @param {number} u - The relative position, [0..1]. + * @param {Phaser.Math.Vector2} [out] - A point to store the result in. * - * @return {Phaser.Geom.Line} A Line object that corresponds to line A of this Triangle. + * @return {Phaser.Math.Vector2} The point. */ - getLineA: function (line) + getPointAt: function (u, out) { - if (line === undefined) { line = new Line(); } - - line.setTo(this.x1, this.y1, this.x2, this.y2); + var t = this.getUtoTmapping(u); - return line; + return this.getPoint(t, out); }, + // Get sequence of points using getPoint( t ) + /** - * Returns a Line object that corresponds to Line B of this Triangle. + * Get a sequence of evenly spaced points from the curve. * - * @method Phaser.Geom.Triangle#getLineB + * You can pass `divisions`, `stepRate`, or neither. + * + * The number of divisions will be + * + * 1. `divisions`, if `divisions` > 0; or + * 2. `this.getLength / stepRate`, if `stepRate` > 0; or + * 3. `this.defaultDivisions` + * + * `1 + divisions` points will be returned. + * + * @method Phaser.Curves.Curve#getPoints * @since 3.0.0 * - * @generic {Phaser.Geom.Line} O - [line,$return] + * @generic {Phaser.Math.Vector2[]} O - [out,$return] * - * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. + * @param {number} [divisions] - The number of divisions to make. + * @param {number} [stepRate] - The curve distance between points, implying `divisions`. + * @param {(array|Phaser.Math.Vector2[])} [out] - An optional array to store the points in. * - * @return {Phaser.Geom.Line} A Line object that corresponds to line B of this Triangle. + * @return {(array|Phaser.Math.Vector2[])} An array of Points from the curve. */ - getLineB: function (line) + getPoints: function (divisions, stepRate, out) { - if (line === undefined) { line = new Line(); } + if (out === undefined) { out = []; } - line.setTo(this.x2, this.y2, this.x3, this.y3); + // If divisions is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!divisions) + { + if (!stepRate) + { + divisions = this.defaultDivisions; + } + else + { + divisions = this.getLength() / stepRate; + } + } - return line; + for (var d = 0; d <= divisions; d++) + { + out.push(this.getPoint(d / divisions)); + } + + return out; }, /** - * Returns a Line object that corresponds to Line C of this Triangle. + * Get a random point from the curve. * - * @method Phaser.Geom.Triangle#getLineC + * @method Phaser.Curves.Curve#getRandomPoint * @since 3.0.0 * - * @generic {Phaser.Geom.Line} O - [line,$return] + * @generic {Phaser.Math.Vector2} O - [out,$return] * - * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. + * @param {Phaser.Math.Vector2} [out] - A point object to store the result in. * - * @return {Phaser.Geom.Line} A Line object that corresponds to line C of this Triangle. + * @return {Phaser.Math.Vector2} The point. */ - getLineC: function (line) + getRandomPoint: function (out) { - if (line === undefined) { line = new Line(); } - - line.setTo(this.x3, this.y3, this.x1, this.y1); + if (out === undefined) { out = new Vector2(); } - return line; + return this.getPoint(Math.random(), out); }, + // Get sequence of points using getPointAt( u ) + /** - * Left most X coordinate of the triangle. Setting it moves the triangle on the X axis accordingly. + * Get a sequence of equally spaced points (by arc distance) from the curve. * - * @name Phaser.Geom.Triangle#left - * @type {number} + * `1 + divisions` points will be returned. + * + * @method Phaser.Curves.Curve#getSpacedPoints * @since 3.0.0 + * + * @param {number} [divisions=this.defaultDivisions] - The number of divisions to make. + * @param {number} [stepRate] - Step between points. Used to calculate the number of points to return when divisions is falsy. Ignored if divisions is positive. + * @param {(array|Phaser.Math.Vector2[])} [out] - An optional array to store the points in. + * + * @return {Phaser.Math.Vector2[]} An array of points. */ - left: { - - get: function () - { - return Math.min(this.x1, this.x2, this.x3); - }, + getSpacedPoints: function (divisions, stepRate, out) + { + if (out === undefined) { out = []; } - set: function (value) + // If divisions is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!divisions) { - var diff = 0; - - if (this.x1 <= this.x2 && this.x1 <= this.x3) - { - diff = this.x1 - value; - } - else if (this.x2 <= this.x1 && this.x2 <= this.x3) + if (!stepRate) { - diff = this.x2 - value; + divisions = this.defaultDivisions; } else { - diff = this.x3 - value; + divisions = this.getLength() / stepRate; } + } - this.x1 -= diff; - this.x2 -= diff; - this.x3 -= diff; + for (var d = 0; d <= divisions; d++) + { + var t = this.getUtoTmapping(d / divisions, null, divisions); + + out.push(this.getPoint(t)); } + return out; }, /** - * Right most X coordinate of the triangle. Setting it moves the triangle on the X axis accordingly. + * Get a point at the start of the curve. * - * @name Phaser.Geom.Triangle#right - * @type {number} + * @method Phaser.Curves.Curve#getStartPoint * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - A point to store the result in. + * + * @return {Phaser.Math.Vector2} The point. */ - right: { - - get: function () - { - return Math.max(this.x1, this.x2, this.x3); - }, - - set: function (value) - { - var diff = 0; - - if (this.x1 >= this.x2 && this.x1 >= this.x3) - { - diff = this.x1 - value; - } - else if (this.x2 >= this.x1 && this.x2 >= this.x3) - { - diff = this.x2 - value; - } - else - { - diff = this.x3 - value; - } - - this.x1 -= diff; - this.x2 -= diff; - this.x3 -= diff; - } + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + return this.getPointAt(0, out); }, /** - * Top most Y coordinate of the triangle. Setting it moves the triangle on the Y axis accordingly. + * Get a unit vector tangent at a relative position on the curve. + * In case any sub curve does not implement its tangent derivation, + * 2 points a small delta apart will be used to find its gradient + * which seems to give a reasonable approximation * - * @name Phaser.Geom.Triangle#top - * @type {number} + * @method Phaser.Curves.Curve#getTangent * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The relative position on the curve, [0..1]. + * @param {Phaser.Math.Vector2} [out] - A vector to store the result in. + * + * @return {Phaser.Math.Vector2} Vector approximating the tangent line at the point t (delta +/- 0.0001) */ - top: { + getTangent: function (t, out) + { + if (out === undefined) { out = new Vector2(); } - get: function () - { - return Math.min(this.y1, this.y2, this.y3); - }, + var delta = 0.0001; + var t1 = t - delta; + var t2 = t + delta; - set: function (value) - { - var diff = 0; + // Capping in case of danger - if (this.y1 <= this.y2 && this.y1 <= this.y3) - { - diff = this.y1 - value; - } - else if (this.y2 <= this.y1 && this.y2 <= this.y3) - { - diff = this.y2 - value; - } - else - { - diff = this.y3 - value; - } + if (t1 < 0) + { + t1 = 0; + } - this.y1 -= diff; - this.y2 -= diff; - this.y3 -= diff; + if (t2 > 1) + { + t2 = 1; } + this.getPoint(t1, this._tmpVec2A); + this.getPoint(t2, out); + + return out.subtract(this._tmpVec2A).normalize(); }, /** - * Bottom most Y coordinate of the triangle. Setting it moves the triangle on the Y axis accordingly. + * Get a unit vector tangent at a relative position on the curve, by arc length. * - * @name Phaser.Geom.Triangle#bottom - * @type {number} + * @method Phaser.Curves.Curve#getTangentAt * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} u - The relative position on the curve, [0..1]. + * @param {Phaser.Math.Vector2} [out] - A vector to store the result in. + * + * @return {Phaser.Math.Vector2} The tangent vector. */ - bottom: { - - get: function () - { - return Math.max(this.y1, this.y2, this.y3); - }, + getTangentAt: function (u, out) + { + var t = this.getUtoTmapping(u); - set: function (value) - { - var diff = 0; - - if (this.y1 >= this.y2 && this.y1 >= this.y3) - { - diff = this.y1 - value; - } - else if (this.y2 >= this.y1 && this.y2 >= this.y3) - { - diff = this.y2 - value; - } - else - { - diff = this.y3 - value; - } - - this.y1 -= diff; - this.y2 -= diff; - this.y3 -= diff; - } - - } - -}); - -module.exports = Triangle; - - -/***/ }), -/* 83 */ -/***/ (function(module, exports) { - -/** -* The `Matter.Vector` module contains methods for creating and manipulating vectors. -* Vectors are the basis of all the geometry related operations in the engine. -* A `Matter.Vector` object is of the form `{ x: 0, y: 0 }`. -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class Vector -*/ - -// TODO: consider params for reusing vector objects - -var Vector = {}; - -module.exports = Vector; - -(function() { - - /** - * Creates a new vector. - * @method create - * @param {number} x - * @param {number} y - * @return {vector} A new vector - */ - Vector.create = function(x, y) { - return { x: x || 0, y: y || 0 }; - }; - - /** - * Returns a new vector with `x` and `y` copied from the given `vector`. - * @method clone - * @param {vector} vector - * @return {vector} A new cloned vector - */ - Vector.clone = function(vector) { - return { x: vector.x, y: vector.y }; - }; - - /** - * Returns the magnitude (length) of a vector. - * @method magnitude - * @param {vector} vector - * @return {number} The magnitude of the vector - */ - Vector.magnitude = function(vector) { - return Math.sqrt((vector.x * vector.x) + (vector.y * vector.y)); - }; - - /** - * Returns the magnitude (length) of a vector (therefore saving a `sqrt` operation). - * @method magnitudeSquared - * @param {vector} vector - * @return {number} The squared magnitude of the vector - */ - Vector.magnitudeSquared = function(vector) { - return (vector.x * vector.x) + (vector.y * vector.y); - }; - - /** - * Rotates the vector about (0, 0) by specified angle. - * @method rotate - * @param {vector} vector - * @param {number} angle - * @param {vector} [output] - * @return {vector} The vector rotated about (0, 0) - */ - Vector.rotate = function(vector, angle, output) { - var cos = Math.cos(angle), sin = Math.sin(angle); - if (!output) output = {}; - var x = vector.x * cos - vector.y * sin; - output.y = vector.x * sin + vector.y * cos; - output.x = x; - return output; - }; - - /** - * Rotates the vector about a specified point by specified angle. - * @method rotateAbout - * @param {vector} vector - * @param {number} angle - * @param {vector} point - * @param {vector} [output] - * @return {vector} A new vector rotated about the point - */ - Vector.rotateAbout = function(vector, angle, point, output) { - var cos = Math.cos(angle), sin = Math.sin(angle); - if (!output) output = {}; - var x = point.x + ((vector.x - point.x) * cos - (vector.y - point.y) * sin); - output.y = point.y + ((vector.x - point.x) * sin + (vector.y - point.y) * cos); - output.x = x; - return output; - }; - - /** - * Normalises a vector (such that its magnitude is `1`). - * @method normalise - * @param {vector} vector - * @return {vector} A new vector normalised - */ - Vector.normalise = function(vector) { - var magnitude = Vector.magnitude(vector); - if (magnitude === 0) - return { x: 0, y: 0 }; - return { x: vector.x / magnitude, y: vector.y / magnitude }; - }; - - /** - * Returns the dot-product of two vectors. - * @method dot - * @param {vector} vectorA - * @param {vector} vectorB - * @return {number} The dot product of the two vectors - */ - Vector.dot = function(vectorA, vectorB) { - return (vectorA.x * vectorB.x) + (vectorA.y * vectorB.y); - }; + return this.getTangent(t, out); + }, /** - * Returns the cross-product of two vectors. - * @method cross - * @param {vector} vectorA - * @param {vector} vectorB - * @return {number} The cross product of the two vectors + * Given a distance in pixels, get a t to find p. + * + * @method Phaser.Curves.Curve#getTFromDistance + * @since 3.0.0 + * + * @param {number} distance - The distance, in pixels. + * @param {number} [divisions] - Optional amount of divisions. + * + * @return {number} The distance. */ - Vector.cross = function(vectorA, vectorB) { - return (vectorA.x * vectorB.y) - (vectorA.y * vectorB.x); - }; + getTFromDistance: function (distance, divisions) + { + if (distance <= 0) + { + return 0; + } - /** - * Returns the cross-product of three vectors. - * @method cross3 - * @param {vector} vectorA - * @param {vector} vectorB - * @param {vector} vectorC - * @return {number} The cross product of the three vectors - */ - Vector.cross3 = function(vectorA, vectorB, vectorC) { - return (vectorB.x - vectorA.x) * (vectorC.y - vectorA.y) - (vectorB.y - vectorA.y) * (vectorC.x - vectorA.x); - }; + return this.getUtoTmapping(0, distance, divisions); + }, /** - * Adds the two vectors. - * @method add - * @param {vector} vectorA - * @param {vector} vectorB - * @param {vector} [output] - * @return {vector} A new vector of vectorA and vectorB added + * Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant. + * + * @method Phaser.Curves.Curve#getUtoTmapping + * @since 3.0.0 + * + * @param {number} u - A float between 0 and 1. + * @param {number} distance - The distance, in pixels. + * @param {number} [divisions] - Optional amount of divisions. + * + * @return {number} The equidistant value. */ - Vector.add = function(vectorA, vectorB, output) { - if (!output) output = {}; - output.x = vectorA.x + vectorB.x; - output.y = vectorA.y + vectorB.y; - return output; - }; + getUtoTmapping: function (u, distance, divisions) + { + var arcLengths = this.getLengths(divisions); - /** - * Subtracts the two vectors. - * @method sub - * @param {vector} vectorA - * @param {vector} vectorB - * @param {vector} [output] - * @return {vector} A new vector of vectorA and vectorB subtracted - */ - Vector.sub = function(vectorA, vectorB, output) { - if (!output) output = {}; - output.x = vectorA.x - vectorB.x; - output.y = vectorA.y - vectorB.y; - return output; - }; + var i = 0; + var il = arcLengths.length; - /** - * Multiplies a vector and a scalar. - * @method mult - * @param {vector} vector - * @param {number} scalar - * @return {vector} A new vector multiplied by scalar - */ - Vector.mult = function(vector, scalar) { - return { x: vector.x * scalar, y: vector.y * scalar }; - }; + var targetArcLength; // The targeted u distance value to get - /** - * Divides a vector and a scalar. - * @method div - * @param {vector} vector - * @param {number} scalar - * @return {vector} A new vector divided by scalar - */ - Vector.div = function(vector, scalar) { - return { x: vector.x / scalar, y: vector.y / scalar }; - }; + if (distance) + { + // Cannot overshoot the curve + targetArcLength = Math.min(distance, arcLengths[il - 1]); + } + else + { + targetArcLength = u * arcLengths[il - 1]; + } - /** - * Returns the perpendicular vector. Set `negate` to true for the perpendicular in the opposite direction. - * @method perp - * @param {vector} vector - * @param {bool} [negate=false] - * @return {vector} The perpendicular vector - */ - Vector.perp = function(vector, negate) { - negate = negate === true ? -1 : 1; - return { x: negate * -vector.y, y: negate * vector.x }; - }; + // binary search for the index with largest value smaller than target u distance - /** - * Negates both components of a vector such that it points in the opposite direction. - * @method neg - * @param {vector} vector - * @return {vector} The negated vector - */ - Vector.neg = function(vector) { - return { x: -vector.x, y: -vector.y }; - }; + var low = 0; + var high = il - 1; + var comparison; - /** - * Returns the angle between the vector `vectorB - vectorA` and the x-axis in radians. - * @method angle - * @param {vector} vectorA - * @param {vector} vectorB - * @return {number} The angle in radians - */ - Vector.angle = function(vectorA, vectorB) { - return Math.atan2(vectorB.y - vectorA.y, vectorB.x - vectorA.x); - }; + while (low <= high) + { + i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats - /** - * Temporary vector pool (not thread-safe). - * @property _temp - * @type {vector[]} - * @private - */ - Vector._temp = [ - Vector.create(), Vector.create(), - Vector.create(), Vector.create(), - Vector.create(), Vector.create() - ]; + comparison = arcLengths[i] - targetArcLength; -})(); + if (comparison < 0) + { + low = i + 1; + } + else if (comparison > 0) + { + high = i - 1; + } + else + { + high = i; + break; + } + } -/***/ }), -/* 84 */ -/***/ (function(module, exports) { + i = high; -/** -* The `Matter.Bounds` module contains methods for creating and manipulating axis-aligned bounding boxes (AABB). -* -* @class Bounds -*/ + if (arcLengths[i] === targetArcLength) + { + return i / (il - 1); + } -var Bounds = {}; + // we could get finer grain at lengths, or use simple interpolation between two points -module.exports = Bounds; + var lengthBefore = arcLengths[i]; + var lengthAfter = arcLengths[i + 1]; -(function() { + var segmentLength = lengthAfter - lengthBefore; - /** - * Creates a new axis-aligned bounding box (AABB) for the given vertices. - * @method create - * @param {vertices} vertices - * @return {bounds} A new bounds object - */ - Bounds.create = function(vertices) { - var bounds = { - min: { x: 0, y: 0 }, - max: { x: 0, y: 0 } - }; + // determine where we are between the 'before' and 'after' points - if (vertices) - Bounds.update(bounds, vertices); - - return bounds; - }; + var segmentFraction = (targetArcLength - lengthBefore) / segmentLength; - /** - * Updates bounds using the given vertices and extends the bounds given a velocity. - * @method update - * @param {bounds} bounds - * @param {vertices} vertices - * @param {vector} velocity - */ - Bounds.update = function(bounds, vertices, velocity) { - bounds.min.x = Infinity; - bounds.max.x = -Infinity; - bounds.min.y = Infinity; - bounds.max.y = -Infinity; + // add that fractional amount to t - for (var i = 0; i < vertices.length; i++) { - var vertex = vertices[i]; - if (vertex.x > bounds.max.x) bounds.max.x = vertex.x; - if (vertex.x < bounds.min.x) bounds.min.x = vertex.x; - if (vertex.y > bounds.max.y) bounds.max.y = vertex.y; - if (vertex.y < bounds.min.y) bounds.min.y = vertex.y; - } - - if (velocity) { - if (velocity.x > 0) { - bounds.max.x += velocity.x; - } else { - bounds.min.x += velocity.x; - } - - if (velocity.y > 0) { - bounds.max.y += velocity.y; - } else { - bounds.min.y += velocity.y; - } - } - }; + return (i + segmentFraction) / (il - 1); + }, /** - * Returns true if the bounds contains the given point. - * @method contains - * @param {bounds} bounds - * @param {vector} point - * @return {boolean} True if the bounds contain the point, otherwise false + * Calculate and cache the arc lengths. + * + * @method Phaser.Curves.Curve#updateArcLengths + * @since 3.0.0 + * + * @see Phaser.Curves.Curve#getLengths() */ - Bounds.contains = function(bounds, point) { - return point.x >= bounds.min.x && point.x <= bounds.max.x - && point.y >= bounds.min.y && point.y <= bounds.max.y; - }; + updateArcLengths: function () + { + this.needsUpdate = true; - /** - * Returns true if the two bounds intersect. - * @method overlaps - * @param {bounds} boundsA - * @param {bounds} boundsB - * @return {boolean} True if the bounds overlap, otherwise false - */ - Bounds.overlaps = function(boundsA, boundsB) { - return (boundsA.min.x <= boundsB.max.x && boundsA.max.x >= boundsB.min.x - && boundsA.max.y >= boundsB.min.y && boundsA.min.y <= boundsB.max.y); - }; + this.getLengths(); + } - /** - * Translates the bounds by the given vector. - * @method translate - * @param {bounds} bounds - * @param {vector} vector - */ - Bounds.translate = function(bounds, vector) { - bounds.min.x += vector.x; - bounds.max.x += vector.x; - bounds.min.y += vector.y; - bounds.max.y += vector.y; - }; +}); - /** - * Shifts the bounds to the given position. - * @method shift - * @param {bounds} bounds - * @param {vector} position - */ - Bounds.shift = function(bounds, position) { - var deltaX = bounds.max.x - bounds.min.x, - deltaY = bounds.max.y - bounds.min.y; - - bounds.min.x = position.x; - bounds.max.x = position.x + deltaX; - bounds.min.y = position.y; - bounds.max.y = position.y + deltaY; - }; - -})(); +module.exports = Curve; /***/ }), -/* 85 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 48835: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(29); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var Rectangle = __webpack_require__(502); +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + +var Class = __webpack_require__(56694); +var Curve = __webpack_require__(38517); +var DegToRad = __webpack_require__(75606); +var GetValue = __webpack_require__(10850); +var RadToDeg = __webpack_require__(23701); +var Vector2 = __webpack_require__(93736); /** * @classdesc - * A Tile is a representation of a single tile within the Tilemap. This is a lightweight data - * representation, so its position information is stored without factoring in scroll, layer - * scale or layer position. + * An Elliptical Curve derived from the Base Curve class. + * + * See https://en.wikipedia.org/wiki/Elliptic_curve for more details. * - * @class Tile - * @memberof Phaser.Tilemaps + * @class Ellipse + * @extends Phaser.Curves.Curve + * @memberof Phaser.Curves * @constructor * @since 3.0.0 * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Tilemaps.LayerData} layer - The LayerData object in the Tilemap that this tile belongs to. - * @param {number} index - The unique index of this tile within the map. - * @param {number} x - The x coordinate of this tile in tile coordinates. - * @param {number} y - The y coordinate of this tile in tile coordinates. - * @param {number} width - Width of the tile in pixels. - * @param {number} height - Height of the tile in pixels. - * @param {number} baseWidth - The base width a tile in the map (in pixels). Tiled maps support - * multiple tileset sizes within one map, but they are still placed at intervals of the base - * tile width. - * @param {number} baseHeight - The base height of the tile in pixels (in pixels). Tiled maps - * support multiple tileset sizes within one map, but they are still placed at intervals of the - * base tile height. + * @param {(number|Phaser.Types.Curves.EllipseCurveConfig)} [x=0] - The x coordinate of the ellipse, or an Ellipse Curve configuration object. + * @param {number} [y=0] - The y coordinate of the ellipse. + * @param {number} [xRadius=0] - The horizontal radius of ellipse. + * @param {number} [yRadius=0] - The vertical radius of ellipse. + * @param {number} [startAngle=0] - The start angle of the ellipse, in degrees. + * @param {number} [endAngle=360] - The end angle of the ellipse, in degrees. + * @param {boolean} [clockwise=false] - Whether the ellipse angles are given as clockwise (`true`) or counter-clockwise (`false`). + * @param {number} [rotation=0] - The rotation of the ellipse, in degrees. */ -var Tile = new Class({ +var EllipseCurve = new Class({ - Mixins: [ - Components.Alpha, - Components.Flip, - Components.Visible - ], + Extends: Curve, initialize: - function Tile (layer, index, x, y, width, height, baseWidth, baseHeight) + function EllipseCurve (x, y, xRadius, yRadius, startAngle, endAngle, clockwise, rotation) { - /** - * The LayerData in the Tilemap data that this tile belongs to. - * - * @name Phaser.Tilemaps.Tile#layer - * @type {Phaser.Tilemaps.LayerData} - * @since 3.0.0 - */ - this.layer = layer; - - /** - * The index of this tile within the map data corresponding to the tileset, or -1 if this - * represents a blank tile. - * - * @name Phaser.Tilemaps.Tile#index - * @type {number} - * @since 3.0.0 - */ - this.index = index; + if (typeof x === 'object') + { + var config = x; - /** - * The x map coordinate of this tile in tile units. - * - * @name Phaser.Tilemaps.Tile#x - * @type {number} - * @since 3.0.0 - */ - this.x = x; + x = GetValue(config, 'x', 0); + y = GetValue(config, 'y', 0); + xRadius = GetValue(config, 'xRadius', 0); + yRadius = GetValue(config, 'yRadius', xRadius); + startAngle = GetValue(config, 'startAngle', 0); + endAngle = GetValue(config, 'endAngle', 360); + clockwise = GetValue(config, 'clockwise', false); + rotation = GetValue(config, 'rotation', 0); + } + else + { + if (yRadius === undefined) { yRadius = xRadius; } + if (startAngle === undefined) { startAngle = 0; } + if (endAngle === undefined) { endAngle = 360; } + if (clockwise === undefined) { clockwise = false; } + if (rotation === undefined) { rotation = 0; } + } - /** - * The y map coordinate of this tile in tile units. - * - * @name Phaser.Tilemaps.Tile#y - * @type {number} - * @since 3.0.0 - */ - this.y = y; + Curve.call(this, 'EllipseCurve'); - /** - * The width of the tile in pixels. - * - * @name Phaser.Tilemaps.Tile#width - * @type {number} - * @since 3.0.0 - */ - this.width = width; + // Center point /** - * The height of the tile in pixels. + * The center point of the ellipse. Used for calculating rotation. * - * @name Phaser.Tilemaps.Tile#height - * @type {number} + * @name Phaser.Curves.Ellipse#p0 + * @type {Phaser.Math.Vector2} * @since 3.0.0 */ - this.height = height; - - /** - * The right of the tile in pixels. - * - * Set in the `updatePixelXY` method. - * - * @name Phaser.Tilemaps.Tile#right - * @type {number} - * @since 3.50.0 - */ - this.right; - - /** - * The bottom of the tile in pixels. - * - * Set in the `updatePixelXY` method. - * - * @name Phaser.Tilemaps.Tile#bottom - * @type {number} - * @since 3.50.0 - */ - this.bottom; + this.p0 = new Vector2(x, y); /** - * The maps base width of a tile in pixels. Tiled maps support multiple tileset sizes - * within one map, but they are still placed at intervals of the base tile size. + * The horizontal radius of the ellipse. * - * @name Phaser.Tilemaps.Tile#baseWidth + * @name Phaser.Curves.Ellipse#_xRadius * @type {number} + * @private * @since 3.0.0 */ - this.baseWidth = (baseWidth !== undefined) ? baseWidth : width; + this._xRadius = xRadius; /** - * The maps base height of a tile in pixels. Tiled maps support multiple tileset sizes - * within one map, but they are still placed at intervals of the base tile size. + * The vertical radius of the ellipse. * - * @name Phaser.Tilemaps.Tile#baseHeight + * @name Phaser.Curves.Ellipse#_yRadius * @type {number} + * @private * @since 3.0.0 */ - this.baseHeight = (baseHeight !== undefined) ? baseHeight : height; + this._yRadius = yRadius; - /** - * The x coordinate of the top left of this tile in pixels. This is relative to the top left - * of the layer this tile is being rendered within. This property does NOT factor in camera - * scroll, layer scale or layer position. - * - * @name Phaser.Tilemaps.Tile#pixelX - * @type {number} - * @since 3.0.0 - */ - this.pixelX = 0; + // Radians /** - * The y coordinate of the top left of this tile in pixels. This is relative to the top left - * of the layer this tile is being rendered within. This property does NOT factor in camera - * scroll, layer scale or layer position. + * The starting angle of the ellipse in radians. * - * @name Phaser.Tilemaps.Tile#pixelY + * @name Phaser.Curves.Ellipse#_startAngle * @type {number} + * @private * @since 3.0.0 */ - this.pixelY = 0; - - this.updatePixelXY(); - - /** - * Tile specific properties. These usually come from Tiled. - * - * @name Phaser.Tilemaps.Tile#properties - * @type {any} - * @since 3.0.0 - */ - this.properties = {}; + this._startAngle = DegToRad(startAngle); /** - * The rotation angle of this tile. + * The end angle of the ellipse in radians. * - * @name Phaser.Tilemaps.Tile#rotation + * @name Phaser.Curves.Ellipse#_endAngle * @type {number} + * @private * @since 3.0.0 */ - this.rotation = 0; - - /** - * Whether the tile should collide with any object on the left side. - * - * This property is used by Arcade Physics only, however, you can also use it - * in your own checks. - * - * @name Phaser.Tilemaps.Tile#collideLeft - * @type {boolean} - * @since 3.0.0 - */ - this.collideLeft = false; - - /** - * Whether the tile should collide with any object on the right side. - * - * This property is used by Arcade Physics only, however, you can also use it - * in your own checks. - * - * @name Phaser.Tilemaps.Tile#collideRight - * @type {boolean} - * @since 3.0.0 - */ - this.collideRight = false; - - /** - * Whether the tile should collide with any object on the top side. - * - * This property is used by Arcade Physics only, however, you can also use it - * in your own checks. - * - * @name Phaser.Tilemaps.Tile#collideUp - * @type {boolean} - * @since 3.0.0 - */ - this.collideUp = false; - - /** - * Whether the tile should collide with any object on the bottom side. - * - * This property is used by Arcade Physics only, however, you can also use it - * in your own checks. - * - * @name Phaser.Tilemaps.Tile#collideDown - * @type {boolean} - * @since 3.0.0 - */ - this.collideDown = false; - - /** - * Whether the tiles left edge is interesting for collisions. - * - * @name Phaser.Tilemaps.Tile#faceLeft - * @type {boolean} - * @since 3.0.0 - */ - this.faceLeft = false; - - /** - * Whether the tiles right edge is interesting for collisions. - * - * @name Phaser.Tilemaps.Tile#faceRight - * @type {boolean} - * @since 3.0.0 - */ - this.faceRight = false; - - /** - * Whether the tiles top edge is interesting for collisions. - * - * @name Phaser.Tilemaps.Tile#faceTop - * @type {boolean} - * @since 3.0.0 - */ - this.faceTop = false; + this._endAngle = DegToRad(endAngle); /** - * Whether the tiles bottom edge is interesting for collisions. + * Anti-clockwise direction. * - * @name Phaser.Tilemaps.Tile#faceBottom + * @name Phaser.Curves.Ellipse#_clockwise * @type {boolean} + * @private * @since 3.0.0 */ - this.faceBottom = false; - - /** - * Tile collision callback. - * - * @name Phaser.Tilemaps.Tile#collisionCallback - * @type {function} - * @since 3.0.0 - */ - this.collisionCallback = undefined; - - /** - * The context in which the collision callback will be called. - * - * @name Phaser.Tilemaps.Tile#collisionCallbackContext - * @type {object} - * @since 3.0.0 - */ - this.collisionCallbackContext = this; + this._clockwise = clockwise; /** - * The tint to apply to this tile. Note: tint is currently a single color value instead of - * the 4 corner tint component on other GameObjects. + * The rotation of the arc. * - * @name Phaser.Tilemaps.Tile#tint + * @name Phaser.Curves.Ellipse#_rotation * @type {number} - * @default - * @since 3.0.0 - */ - this.tint = 0xffffff; - - /** - * An empty object where physics-engine specific information (e.g. bodies) may be stored. - * - * @name Phaser.Tilemaps.Tile#physics - * @type {object} + * @private * @since 3.0.0 */ - this.physics = {}; + this._rotation = DegToRad(rotation); }, /** - * Check if the given x and y world coordinates are within this Tile. This does not factor in - * camera scroll, layer scale or layer position. + * Gets the starting point on the curve. * - * @method Phaser.Tilemaps.Tile#containsPoint + * @method Phaser.Curves.Ellipse#getStartPoint * @since 3.0.0 * - * @param {number} x - The x coordinate to test. - * @param {number} y - The y coordinate to test. + * @generic {Phaser.Math.Vector2} O - [out,$return] * - * @return {boolean} True if the coordinates are within this Tile, otherwise false. + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. */ - containsPoint: function (x, y) + getStartPoint: function (out) { - return !(x < this.pixelX || y < this.pixelY || x > this.right || y > this.bottom); + if (out === undefined) { out = new Vector2(); } + + return this.getPoint(0, out); }, /** - * Copies the tile data & properties from the given tile to this tile. This copies everything - * except for position and interesting faces. + * Get the resolution of the curve. * - * @method Phaser.Tilemaps.Tile#copy + * @method Phaser.Curves.Ellipse#getResolution * @since 3.0.0 * - * @param {Phaser.Tilemaps.Tile} tile - The tile to copy from. + * @param {number} divisions - Optional divisions value. * - * @return {this} This Tile object instance. + * @return {number} The curve resolution. */ - copy: function (tile) + getResolution: function (divisions) { - this.index = tile.index; - this.alpha = tile.alpha; - this.properties = tile.properties; - this.visible = tile.visible; - this.setFlip(tile.flipX, tile.flipY); - this.tint = tile.tint; - this.rotation = tile.rotation; - this.collideUp = tile.collideUp; - this.collideDown = tile.collideDown; - this.collideLeft = tile.collideLeft; - this.collideRight = tile.collideRight; - this.collisionCallback = tile.collisionCallback; - this.collisionCallbackContext = tile.collisionCallbackContext; - - return this; + return divisions * 2; }, /** - * The collision group for this Tile, defined within the Tileset. This returns a reference to - * the collision group stored within the Tileset, so any modification of the returned object - * will impact all tiles that have the same index as this tile. + * Get point at relative position in curve according to length. * - * @method Phaser.Tilemaps.Tile#getCollisionGroup + * @method Phaser.Curves.Ellipse#getPoint * @since 3.0.0 * - * @return {?object} The collision group for this Tile, as defined in the Tileset, or `null` if no group was defined. + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. */ - getCollisionGroup: function () + getPoint: function (t, out) { - return this.tileset ? this.tileset.getTileCollisionGroup(this.index) : null; + if (out === undefined) { out = new Vector2(); } + + var twoPi = Math.PI * 2; + var deltaAngle = this._endAngle - this._startAngle; + var samePoints = Math.abs(deltaAngle) < Number.EPSILON; + + // ensures that deltaAngle is 0 .. 2 PI + while (deltaAngle < 0) + { + deltaAngle += twoPi; + } + + while (deltaAngle > twoPi) + { + deltaAngle -= twoPi; + } + + if (deltaAngle < Number.EPSILON) + { + if (samePoints) + { + deltaAngle = 0; + } + else + { + deltaAngle = twoPi; + } + } + + if (this._clockwise && !samePoints) + { + if (deltaAngle === twoPi) + { + deltaAngle = - twoPi; + } + else + { + deltaAngle = deltaAngle - twoPi; + } + } + + var angle = this._startAngle + t * deltaAngle; + var x = this.p0.x + this._xRadius * Math.cos(angle); + var y = this.p0.y + this._yRadius * Math.sin(angle); + + if (this._rotation !== 0) + { + var cos = Math.cos(this._rotation); + var sin = Math.sin(this._rotation); + + var tx = x - this.p0.x; + var ty = y - this.p0.y; + + // Rotate the point about the center of the ellipse. + x = tx * cos - ty * sin + this.p0.x; + y = tx * sin + ty * cos + this.p0.y; + } + + return out.set(x, y); }, /** - * The tile data for this Tile, defined within the Tileset. This typically contains Tiled - * collision data, tile animations and terrain information. This returns a reference to the tile - * data stored within the Tileset, so any modification of the returned object will impact all - * tiles that have the same index as this tile. + * Sets the horizontal radius of this curve. * - * @method Phaser.Tilemaps.Tile#getTileData + * @method Phaser.Curves.Ellipse#setXRadius * @since 3.0.0 * - * @return {?object} The tile data for this Tile, as defined in the Tileset, or `null` if no data was defined. + * @param {number} value - The horizontal radius of this curve. + * + * @return {this} This curve object. */ - getTileData: function () + setXRadius: function (value) { - return this.tileset ? this.tileset.getTileData(this.index) : null; + this.xRadius = value; + + return this; }, /** - * Gets the world X position of the left side of the tile, factoring in the layers position, - * scale and scroll. + * Sets the vertical radius of this curve. * - * @method Phaser.Tilemaps.Tile#getLeft + * @method Phaser.Curves.Ellipse#setYRadius * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * @param {number} value - The vertical radius of this curve. * - * @return {number} The left (x) value of this tile. + * @return {this} This curve object. */ - getLeft: function (camera) + setYRadius: function (value) { - var tilemapLayer = this.tilemapLayer; + this.yRadius = value; - return (tilemapLayer) ? tilemapLayer.tileToWorldX(this.x, camera) : this.x * this.baseWidth; + return this; }, /** - * Gets the world X position of the right side of the tile, factoring in the layer's position, - * scale and scroll. + * Sets the width of this curve. * - * @method Phaser.Tilemaps.Tile#getRight + * @method Phaser.Curves.Ellipse#setWidth * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * @param {number} value - The width of this curve. * - * @return {number} The right (x) value of this tile. + * @return {this} This curve object. */ - getRight: function (camera) + setWidth: function (value) { - var tilemapLayer = this.tilemapLayer; + this.xRadius = value / 2; - return (tilemapLayer) ? this.getLeft(camera) + this.width * tilemapLayer.scaleX : this.getLeft(camera) + this.width; + return this; }, /** - * Gets the world Y position of the top side of the tile, factoring in the layer's position, - * scale and scroll. + * Sets the height of this curve. * - * @method Phaser.Tilemaps.Tile#getTop + * @method Phaser.Curves.Ellipse#setHeight * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * @param {number} value - The height of this curve. * - * @return {number} The top (y) value of this tile. + * @return {this} This curve object. */ - getTop: function (camera) + setHeight: function (value) { - var tilemapLayer = this.tilemapLayer; + this.yRadius = value / 2; - // Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile in grid - // units is the bottom left, so the y coordinate needs to be adjusted by the difference - // between the base size and this tile's size. - return tilemapLayer - ? tilemapLayer.tileToWorldY(this.y, camera) - (this.height - this.baseHeight) * tilemapLayer.scaleY - : this.y * this.baseHeight - (this.height - this.baseHeight); + return this; }, /** - * Gets the world Y position of the bottom side of the tile, factoring in the layer's position, - * scale and scroll. - - * @method Phaser.Tilemaps.Tile#getBottom + * Sets the start angle of this curve. + * + * @method Phaser.Curves.Ellipse#setStartAngle * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * @param {number} value - The start angle of this curve, in radians. * - * @return {number} The bottom (y) value of this tile. + * @return {this} This curve object. */ - getBottom: function (camera) + setStartAngle: function (value) { - var tilemapLayer = this.tilemapLayer; + this.startAngle = value; - return tilemapLayer - ? this.getTop(camera) + this.height * tilemapLayer.scaleY - : this.getTop(camera) + this.height; + return this; }, - /** - * Gets the world rectangle bounding box for the tile, factoring in the layers position, - * scale and scroll. + * Sets the end angle of this curve. * - * @method Phaser.Tilemaps.Tile#getBounds + * @method Phaser.Curves.Ellipse#setEndAngle * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. - * @param {Phaser.Geom.Rectangle} [output] - Optional Rectangle object to store the results in. + * @param {number} value - The end angle of this curve, in radians. * - * @return {(Phaser.Geom.Rectangle|object)} The bounds of this Tile. + * @return {this} This curve object. */ - getBounds: function (camera, output) + setEndAngle: function (value) { - if (output === undefined) { output = new Rectangle(); } - - output.x = this.getLeft(); - output.y = this.getTop(); - output.width = this.getRight() - output.x; - output.height = this.getBottom() - output.y; + this.endAngle = value; - return output; + return this; }, /** - * Gets the world X position of the center of the tile, factoring in the layer's position, - * scale and scroll. + * Sets if this curve extends clockwise or anti-clockwise. * - * @method Phaser.Tilemaps.Tile#getCenterX + * @method Phaser.Curves.Ellipse#setClockwise * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * @param {boolean} value - The clockwise state of this curve. * - * @return {number} The center x position of this Tile. + * @return {this} This curve object. */ - getCenterX: function (camera) + setClockwise: function (value) { - return (this.getLeft(camera) + this.getRight(camera)) / 2; + this.clockwise = value; + + return this; }, /** - * Gets the world Y position of the center of the tile, factoring in the layer's position, - * scale and scroll. + * Sets the rotation of this curve. * - * @method Phaser.Tilemaps.Tile#getCenterY + * @method Phaser.Curves.Ellipse#setRotation * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * @param {number} value - The rotation of this curve, in radians. * - * @return {number} The center y position of this Tile. + * @return {this} This curve object. */ - getCenterY: function (camera) + setRotation: function (value) { - return (this.getTop(camera) + this.getBottom(camera)) / 2; + this.rotation = value; + + return this; }, /** - * Check for intersection with this tile. This does not factor in camera scroll, layer scale or - * layer position. + * The x coordinate of the center of the ellipse. * - * @method Phaser.Tilemaps.Tile#intersects + * @name Phaser.Curves.Ellipse#x + * @type {number} * @since 3.0.0 - * - * @param {number} x - The x axis in pixels. - * @param {number} y - The y axis in pixels. - * @param {number} right - The right point. - * @param {number} bottom - The bottom point. - * - * @return {boolean} `true` if the Tile intersects with the given dimensions, otherwise `false`. */ - intersects: function (x, y, right, bottom) - { - return !( - right <= this.pixelX || bottom <= this.pixelY || - x >= this.right || y >= this.bottom - ); - }, + x: { - /** - * Checks if the tile is interesting. - * - * @method Phaser.Tilemaps.Tile#isInteresting - * @since 3.0.0 - * - * @param {boolean} collides - If true, will consider the tile interesting if it collides on any side. - * @param {boolean} faces - If true, will consider the tile interesting if it has an interesting face. - * - * @return {boolean} True if the Tile is interesting, otherwise false. - */ - isInteresting: function (collides, faces) - { - if (collides && faces) - { - return (this.canCollide || this.hasInterestingFace); - } - else if (collides) + get: function () { - return this.collides; - } - else if (faces) + return this.p0.x; + }, + + set: function (value) { - return this.hasInterestingFace; + this.p0.x = value; } - return false; }, /** - * Reset collision status flags. + * The y coordinate of the center of the ellipse. * - * @method Phaser.Tilemaps.Tile#resetCollision + * @name Phaser.Curves.Ellipse#y + * @type {number} * @since 3.0.0 - * - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate interesting faces for this tile and its neighbors. - * - * @return {this} This Tile object instance. */ - resetCollision: function (recalculateFaces) - { - if (recalculateFaces === undefined) { recalculateFaces = true; } - - this.collideLeft = false; - this.collideRight = false; - this.collideUp = false; - this.collideDown = false; - - this.faceTop = false; - this.faceBottom = false; - this.faceLeft = false; - this.faceRight = false; + y: { - if (recalculateFaces) + get: function () { - var tilemapLayer = this.tilemapLayer; + return this.p0.y; + }, - if (tilemapLayer) - { - this.tilemapLayer.calculateFacesAt(this.x, this.y); - } + set: function (value) + { + this.p0.y = value; } - return this; - }, - - /** - * Reset faces. - * - * @method Phaser.Tilemaps.Tile#resetFaces - * @since 3.0.0 - * - * @return {this} This Tile object instance. - */ - resetFaces: function () - { - this.faceTop = false; - this.faceBottom = false; - this.faceLeft = false; - this.faceRight = false; - - return this; }, /** - * Sets the collision flags for each side of this tile and updates the interesting faces list. + * The horizontal radius of the ellipse. * - * @method Phaser.Tilemaps.Tile#setCollision + * @name Phaser.Curves.Ellipse#xRadius + * @type {number} * @since 3.0.0 - * - * @param {boolean} left - Indicating collide with any object on the left. - * @param {boolean} [right] - Indicating collide with any object on the right. - * @param {boolean} [up] - Indicating collide with any object on the top. - * @param {boolean} [down] - Indicating collide with any object on the bottom. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate interesting faces for this tile and its neighbors. - * - * @return {this} This Tile object instance. */ - setCollision: function (left, right, up, down, recalculateFaces) - { - if (right === undefined) { right = left; } - if (up === undefined) { up = left; } - if (down === undefined) { down = left; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - - this.collideLeft = left; - this.collideRight = right; - this.collideUp = up; - this.collideDown = down; - - this.faceLeft = left; - this.faceRight = right; - this.faceTop = up; - this.faceBottom = down; + xRadius: { - if (recalculateFaces) + get: function () { - var tilemapLayer = this.tilemapLayer; - - if (tilemapLayer) - { - this.tilemapLayer.calculateFacesAt(this.x, this.y); - } - } - - return this; - }, + return this._xRadius; + }, - /** - * Set a callback to be called when this tile is hit by an object. The callback must true for - * collision processing to take place. - * - * @method Phaser.Tilemaps.Tile#setCollisionCallback - * @since 3.0.0 - * - * @param {function} callback - Callback function. - * @param {object} context - Callback will be called within this context. - * - * @return {this} This Tile object instance. - */ - setCollisionCallback: function (callback, context) - { - if (callback === null) - { - this.collisionCallback = undefined; - this.collisionCallbackContext = undefined; - } - else + set: function (value) { - this.collisionCallback = callback; - this.collisionCallbackContext = context; + this._xRadius = value; } - return this; - }, - - /** - * Sets the size of the tile and updates its pixelX and pixelY. - * - * @method Phaser.Tilemaps.Tile#setSize - * @since 3.0.0 - * - * @param {number} tileWidth - The width of the tile in pixels. - * @param {number} tileHeight - The height of the tile in pixels. - * @param {number} baseWidth - The base width a tile in the map (in pixels). - * @param {number} baseHeight - The base height of the tile in pixels (in pixels). - * - * @return {this} This Tile object instance. - */ - setSize: function (tileWidth, tileHeight, baseWidth, baseHeight) - { - if (tileWidth !== undefined) { this.width = tileWidth; } - if (tileHeight !== undefined) { this.height = tileHeight; } - if (baseWidth !== undefined) { this.baseWidth = baseWidth; } - if (baseHeight !== undefined) { this.baseHeight = baseHeight; } - - this.updatePixelXY(); - - return this; }, /** - * Used internally. Updates the tiles world XY position based on the current tile size. + * The vertical radius of the ellipse. * - * @method Phaser.Tilemaps.Tile#updatePixelXY + * @name Phaser.Curves.Ellipse#yRadius + * @type {number} * @since 3.0.0 - * - * @return {this} This Tile object instance. */ - updatePixelXY: function () - { - var orientation = this.layer.orientation; - - if (orientation === CONST.ORTHOGONAL) - { - // In orthogonal mode, Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the - // bottom left, while the Phaser renderer assumes the origin is the top left. The y - // coordinate needs to be adjusted by the difference. + yRadius: { - this.pixelX = this.x * this.baseWidth; - this.pixelY = this.y * this.baseHeight; - } - else if (orientation === CONST.ISOMETRIC) + get: function () { - // Reminder: For the tilemap to be centered we have to move the image to the right with the camera! - // This is crucial for wordtotile, tiletoworld to work. + return this._yRadius; + }, - this.pixelX = (this.x - this.y) * this.baseWidth * 0.5; - this.pixelY = (this.x + this.y) * this.baseHeight * 0.5; - } - else if (orientation === CONST.STAGGERED) - { - this.pixelX = this.x * this.baseWidth + this.y % 2 * (this.baseWidth / 2); - this.pixelY = this.y * (this.baseHeight / 2); - } - else if (orientation === CONST.HEXAGONAL) + set: function (value) { - var len = this.layer.hexSideLength; - var rowHeight = ((this.baseHeight - len) / 2 + len); - - this.pixelX = this.x * this.baseWidth + this.y % 2 * (this.baseWidth / 2); - this.pixelY = this.y * rowHeight; + this._yRadius = value; } - this.right = this.pixelX + this.baseWidth; - this.bottom = this.pixelY + this.baseHeight; - - return this; - }, - - /** - * Clean up memory. - * - * @method Phaser.Tilemaps.Tile#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.collisionCallback = undefined; - this.collisionCallbackContext = undefined; - this.properties = undefined; }, /** - * True if this tile can collide on any of its faces or has a collision callback set. + * The start angle of the ellipse in degrees. * - * @name Phaser.Tilemaps.Tile#canCollide - * @type {boolean} - * @readonly + * @name Phaser.Curves.Ellipse#startAngle + * @type {number} * @since 3.0.0 */ - canCollide: { + startAngle: { get: function () { - return (this.collideLeft || this.collideRight || this.collideUp || this.collideDown || (this.collisionCallback !== undefined)); + return RadToDeg(this._startAngle); + }, + + set: function (value) + { + this._startAngle = DegToRad(value); } }, /** - * True if this tile can collide on any of its faces. + * The end angle of the ellipse in degrees. * - * @name Phaser.Tilemaps.Tile#collides - * @type {boolean} - * @readonly + * @name Phaser.Curves.Ellipse#endAngle + * @type {number} * @since 3.0.0 */ - collides: { + endAngle: { get: function () { - return (this.collideLeft || this.collideRight || this.collideUp || this.collideDown); + return RadToDeg(this._endAngle); + }, + + set: function (value) + { + this._endAngle = DegToRad(value); } }, /** - * True if this tile has any interesting faces. + * `true` if the ellipse rotation is clockwise or `false` if anti-clockwise. * - * @name Phaser.Tilemaps.Tile#hasInterestingFace + * @name Phaser.Curves.Ellipse#clockwise * @type {boolean} - * @readonly * @since 3.0.0 */ - hasInterestingFace: { + clockwise: { get: function () { - return (this.faceTop || this.faceBottom || this.faceLeft || this.faceRight); + return this._clockwise; + }, + + set: function (value) + { + this._clockwise = value; } }, /** - * The tileset that contains this Tile. This is null if accessed from a LayerData instance - * before the tile is placed in a TilemapLayer, or if the tile has an index that doesn't correspond - * to any of the maps tilesets. + * The rotation of the ellipse, relative to the center, in degrees. * - * @name Phaser.Tilemaps.Tile#tileset - * @type {?Phaser.Tilemaps.Tileset} - * @readonly - * @since 3.0.0 + * @name Phaser.Curves.Ellipse#angle + * @type {number} + * @since 3.14.0 */ - tileset: { + angle: { get: function () { - var tilemapLayer = this.layer.tilemapLayer; - - if (tilemapLayer) - { - var tileset = tilemapLayer.gidMap[this.index]; - - if (tileset) - { - return tileset; - } - } + return RadToDeg(this._rotation); + }, - return null; + set: function (value) + { + this._rotation = DegToRad(value); } }, /** - * The tilemap layer that contains this Tile. This will only return null if accessed from a - * LayerData instance before the tile is placed within a TilemapLayer. + * The rotation of the ellipse, relative to the center, in radians. * - * @name Phaser.Tilemaps.Tile#tilemapLayer - * @type {?Phaser.Tilemaps.TilemapLayer} - * @readonly + * @name Phaser.Curves.Ellipse#rotation + * @type {number} * @since 3.0.0 */ - tilemapLayer: { + rotation: { get: function () { - return this.layer.tilemapLayer; + return this._rotation; + }, + + set: function (value) + { + this._rotation = value; } }, /** - * The tilemap that contains this Tile. This will only return null if accessed from a LayerData - * instance before the tile is placed within a TilemapLayer. + * JSON serialization of the curve. * - * @name Phaser.Tilemaps.Tile#tilemap - * @type {?Phaser.Tilemaps.Tilemap} - * @readonly + * @method Phaser.Curves.Ellipse#toJSON * @since 3.0.0 + * + * @return {Phaser.Types.Curves.JSONEllipseCurve} The JSON object containing this curve data. */ - tilemap: { - - get: function () - { - var tilemapLayer = this.tilemapLayer; - - return tilemapLayer ? tilemapLayer.tilemap : null; - } - + toJSON: function () + { + return { + type: this.type, + x: this.p0.x, + y: this.p0.y, + xRadius: this._xRadius, + yRadius: this._yRadius, + startAngle: RadToDeg(this._startAngle), + endAngle: RadToDeg(this._endAngle), + clockwise: this._clockwise, + rotation: RadToDeg(this._rotation) + }; } }); -module.exports = Tile; +/** + * Creates a curve from the provided Ellipse Curve Configuration object. + * + * @function Phaser.Curves.Ellipse.fromJSON + * @since 3.0.0 + * + * @param {Phaser.Types.Curves.JSONEllipseCurve} data - The JSON object containing this curve data. + * + * @return {Phaser.Curves.Ellipse} The ellipse curve constructed from the configuration object. + */ +EllipseCurve.fromJSON = function (data) +{ + return new EllipseCurve(data); +}; + +module.exports = EllipseCurve; /***/ }), -/* 86 */ -/***/ (function(module, exports, __webpack_require__) { -/** -* The `Matter.Bodies` module contains factory methods for creating rigid body models -* with commonly used body configurations (such as rectangles, circles and other polygons). -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class Bodies -*/ +/***/ 58084: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -// TODO: true circle bodies +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -var Bodies = {}; +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) -module.exports = Bodies; +var Class = __webpack_require__(56694); +var Curve = __webpack_require__(38517); +var FromPoints = __webpack_require__(80222); +var Rectangle = __webpack_require__(74118); +var Vector2 = __webpack_require__(93736); -var Vertices = __webpack_require__(64); -var Common = __webpack_require__(32); -var Body = __webpack_require__(41); -var Bounds = __webpack_require__(84); -var Vector = __webpack_require__(83); -var decomp = __webpack_require__(1393); +/** + * @classdesc + * A LineCurve is a "curve" comprising exactly two points (a line segment). + * + * @class Line + * @extends Phaser.Curves.Curve + * @memberof Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|number[])} p0 - The first endpoint. + * @param {Phaser.Math.Vector2} [p1] - The second endpoint. + */ +var LineCurve = new Class({ -(function() { + Extends: Curve, - /** - * Creates a new rigid body model with a rectangle hull. - * The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method rectangle - * @param {number} x - * @param {number} y - * @param {number} width - * @param {number} height - * @param {object} [options] - * @return {body} A new rectangle body - */ - Bodies.rectangle = function(x, y, width, height, options) { - options = options || {}; + initialize: - var rectangle = { - label: 'Rectangle Body', - position: { x: x, y: y }, - vertices: Vertices.fromPath('L 0 0 L ' + width + ' 0 L ' + width + ' ' + height + ' L 0 ' + height) - }; + // vec2s or array + function LineCurve (p0, p1) + { + Curve.call(this, 'LineCurve'); - if (options.chamfer) { - var chamfer = options.chamfer; - rectangle.vertices = Vertices.chamfer(rectangle.vertices, chamfer.radius, - chamfer.quality, chamfer.qualityMin, chamfer.qualityMax); - delete options.chamfer; + if (Array.isArray(p0)) + { + p1 = new Vector2(p0[2], p0[3]); + p0 = new Vector2(p0[0], p0[1]); } - return Body.create(Common.extend({}, rectangle, options)); - }; - - /** - * Creates a new rigid body model with a trapezoid hull. - * The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method trapezoid - * @param {number} x - * @param {number} y - * @param {number} width - * @param {number} height - * @param {number} slope - * @param {object} [options] - * @return {body} A new trapezoid body - */ - Bodies.trapezoid = function(x, y, width, height, slope, options) { - options = options || {}; - - slope *= 0.5; - var roof = (1 - (slope * 2)) * width; - - var x1 = width * slope, - x2 = x1 + roof, - x3 = x2 + x1, - verticesPath; - - if (slope < 0.5) { - verticesPath = 'L 0 0 L ' + x1 + ' ' + (-height) + ' L ' + x2 + ' ' + (-height) + ' L ' + x3 + ' 0'; - } else { - verticesPath = 'L 0 0 L ' + x2 + ' ' + (-height) + ' L ' + x3 + ' 0'; - } + /** + * The first endpoint. + * + * @name Phaser.Curves.Line#p0 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p0 = p0; - var trapezoid = { - label: 'Trapezoid Body', - position: { x: x, y: y }, - vertices: Vertices.fromPath(verticesPath) - }; + /** + * The second endpoint. + * + * @name Phaser.Curves.Line#p1 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p1 = p1; - if (options.chamfer) { - var chamfer = options.chamfer; - trapezoid.vertices = Vertices.chamfer(trapezoid.vertices, chamfer.radius, - chamfer.quality, chamfer.qualityMin, chamfer.qualityMax); - delete options.chamfer; - } + // Override default Curve.arcLengthDivisions - return Body.create(Common.extend({}, trapezoid, options)); - }; + /** + * The quantity of arc length divisions within the curve. + * + * @name Phaser.Curves.Line#arcLengthDivisions + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.arcLengthDivisions = 1; + }, /** - * Creates a new rigid body model with a circle hull. - * The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method circle - * @param {number} x - * @param {number} y - * @param {number} radius - * @param {object} [options] - * @param {number} [maxSides] - * @return {body} A new circle body + * Returns a Rectangle where the position and dimensions match the bounds of this Curve. + * + * @method Phaser.Curves.Line#getBounds + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * + * @param {Phaser.Geom.Rectangle} [out] - A Rectangle object to store the bounds in. If not given a new Rectangle will be created. + * + * @return {Phaser.Geom.Rectangle} A Rectangle object holding the bounds of this curve. If `out` was given it will be this object. */ - Bodies.circle = function(x, y, radius, options, maxSides) { - options = options || {}; - - var circle = { - label: 'Circle Body', - circleRadius: radius - }; - - // approximate circles with polygons until true circles implemented in SAT - maxSides = maxSides || 25; - var sides = Math.ceil(Math.max(10, Math.min(maxSides, radius))); - - // optimisation: always use even number of sides (half the number of unique axes) - if (sides % 2 === 1) - sides += 1; + getBounds: function (out) + { + if (out === undefined) { out = new Rectangle(); } - return Bodies.polygon(x, y, sides, radius, Common.extend({}, circle, options)); - }; + return FromPoints([ this.p0, this.p1 ], out); + }, /** - * Creates a new rigid body model with a regular polygon hull with the given number of sides. - * The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method polygon - * @param {number} x - * @param {number} y - * @param {number} sides - * @param {number} radius - * @param {object} [options] - * @return {body} A new regular polygon body + * Gets the starting point on the curve. + * + * @method Phaser.Curves.Line#getStartPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. */ - Bodies.polygon = function(x, y, sides, radius, options) { - options = options || {}; - - if (sides < 3) - return Bodies.circle(x, y, radius, options); - - var theta = 2 * Math.PI / sides, - path = '', - offset = theta * 0.5; - - for (var i = 0; i < sides; i += 1) { - var angle = offset + (i * theta), - xx = Math.cos(angle) * radius, - yy = Math.sin(angle) * radius; - - path += 'L ' + xx.toFixed(3) + ' ' + yy.toFixed(3) + ' '; - } - - var polygon = { - label: 'Polygon Body', - position: { x: x, y: y }, - vertices: Vertices.fromPath(path) - }; - - if (options.chamfer) { - var chamfer = options.chamfer; - polygon.vertices = Vertices.chamfer(polygon.vertices, chamfer.radius, - chamfer.quality, chamfer.qualityMin, chamfer.qualityMax); - delete options.chamfer; - } + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } - return Body.create(Common.extend({}, polygon, options)); - }; + return out.copy(this.p0); + }, /** - * Creates a body using the supplied vertices (or an array containing multiple sets of vertices). - * If the vertices are convex, they will pass through as supplied. - * Otherwise if the vertices are concave, they will be decomposed if [poly-decomp.js](https://github.com/schteppe/poly-decomp.js) is available. - * Note that this process is not guaranteed to support complex sets of vertices (e.g. those with holes may fail). - * By default the decomposition will discard collinear edges (to improve performance). - * It can also optionally discard any parts that have an area less than `minimumArea`. - * If the vertices can not be decomposed, the result will fall back to using the convex hull. - * The options parameter is an object that specifies any `Matter.Body` properties you wish to override the defaults. - * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. - * @method fromVertices - * @param {number} x - * @param {number} y - * @param [[vector]] vertexSets - * @param {object} [options] - * @param {bool} [flagInternal=false] - * @param {number} [removeCollinear=0.01] - * @param {number} [minimumArea=10] - * @return {body} + * Gets the resolution of the line. + * + * @method Phaser.Curves.Line#getResolution + * @since 3.0.0 + * + * @param {number} [divisions=1] - The number of divisions to consider. + * + * @return {number} The resolution. Equal to the number of divisions. */ - Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea) { - var body, - parts, - isConvex, - vertices, - i, - j, - k, - v, - z; + getResolution: function (divisions) + { + if (divisions === undefined) { divisions = 1; } - options = options || {}; - parts = []; + return divisions; + }, - flagInternal = typeof flagInternal !== 'undefined' ? flagInternal : false; - removeCollinear = typeof removeCollinear !== 'undefined' ? removeCollinear : 0.01; - minimumArea = typeof minimumArea !== 'undefined' ? minimumArea : 10; + /** + * Get point at relative position in curve according to length. + * + * @method Phaser.Curves.Line#getPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } - if (!decomp) { - Common.warn('Bodies.fromVertices: poly-decomp.js required. Could not decompose vertices. Fallback to convex hull.'); + if (t === 1) + { + return out.copy(this.p1); } - // ensure vertexSets is an array of arrays - if (!Common.isArray(vertexSets[0])) { - vertexSets = [vertexSets]; - } + out.copy(this.p1).subtract(this.p0).scale(t).add(this.p0); - for (v = 0; v < vertexSets.length; v += 1) { - vertices = vertexSets[v]; - isConvex = Vertices.isConvex(vertices); + return out; + }, - if (isConvex || !decomp) { - if (isConvex) { - vertices = Vertices.clockwiseSort(vertices); - } else { - // fallback to convex hull when decomposition is not possible - vertices = Vertices.hull(vertices); - } + // Line curve is linear, so we can overwrite default getPointAt - parts.push({ - position: { x: x, y: y }, - vertices: vertices - }); - } else { - // initialise a decomposition - var concave = vertices.map(function(vertex) { - return [vertex.x, vertex.y]; - }); + /** + * Gets a point at a given position on the line. + * + * @method Phaser.Curves.Line#getPointAt + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} u - The position along the curve to return. Where 0 is the start and 1 is the end. + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + */ + getPointAt: function (u, out) + { + return this.getPoint(u, out); + }, - // vertices are concave and simple, we can decompose into parts - decomp.makeCCW(concave); - if (removeCollinear !== false) - decomp.removeCollinearPoints(concave, removeCollinear); + /** + * Gets the slope of the line as a unit vector. + * + * @method Phaser.Curves.Line#getTangent + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} [t] - The relative position on the line, [0..1]. + * @param {Phaser.Math.Vector2} [out] - A vector to store the result in. + * + * @return {Phaser.Math.Vector2} The tangent vector. + */ + getTangent: function (t, out) + { + if (out === undefined) { out = new Vector2(); } - // use the quick decomposition algorithm (Bayazit) - var decomposed = decomp.quickDecomp(concave); + out.copy(this.p1).subtract(this.p0).normalize(); - // for each decomposed chunk - for (i = 0; i < decomposed.length; i++) { - var chunk = decomposed[i]; + return out; + }, - // convert vertices into the correct structure - var chunkVertices = chunk.map(function(vertices) { - return { - x: vertices[0], - y: vertices[1] - }; - }); + /** + * Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant. + * + * @method Phaser.Curves.Line#getUtoTmapping + * @since 3.0.0 + * + * @param {number} u - A float between 0 and 1. + * @param {number} distance - The distance, in pixels. + * @param {number} [divisions] - Optional amount of divisions. + * + * @return {number} The equidistant value. + */ + getUtoTmapping: function (u, distance, divisions) + { + var t; - // skip small chunks - if (minimumArea > 0 && Vertices.area(chunkVertices) < minimumArea) - continue; + if (distance) + { + var arcLengths = this.getLengths(divisions); + var lineLength = arcLengths[arcLengths.length - 1]; - // create a compound part - parts.push({ - position: Vertices.centre(chunkVertices), - vertices: chunkVertices - }); - } - } - } + // Cannot overshoot the curve + var targetLineLength = Math.min(distance, lineLength); - // create body parts - for (i = 0; i < parts.length; i++) { - parts[i] = Body.create(Common.extend(parts[i], options)); + t = targetLineLength / lineLength; } - - if (flagInternal) + else { - Bodies.flagCoincidentParts(parts, 5); + t = u; } - if (parts.length > 1) { - // create the parent body to be returned, that contains generated compound parts - body = Body.create(Common.extend({ parts: parts.slice(0) }, options)); - Body.setPosition(body, { x: x, y: y }); + return t; + }, - return body; - } else { - return parts[0]; - } - }; + // Override default Curve.draw because this is better than calling getPoints on a line! /** - * Takes an array of Body objects and flags all internal edges (coincident parts) based on the maxDistance - * value. The array is changed in-place and returned, so you can pass this function a `Body.parts` property. - * - * @method flagCoincidentParts - * @param {body[]} parts - The Body parts, or array of bodies, to flag. - * @param {number} [maxDistance=5] - * @return {body[]} The modified `parts` parameter. + * Draws this curve on the given Graphics object. + * + * The curve is drawn using `Graphics.lineBetween` so will be drawn at whatever the present Graphics line color is. + * The Graphics object is not cleared before the draw, so the curve will appear on-top of anything else already rendered to it. + * + * @method Phaser.Curves.Line#draw + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] + * + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics instance onto which this curve will be drawn. + * + * @return {Phaser.GameObjects.Graphics} The Graphics object to which the curve was drawn. */ - Bodies.flagCoincidentParts = function (parts, maxDistance) + draw: function (graphics) { - if (maxDistance === undefined) { maxDistance = 5; } - - for (var i = 0; i < parts.length; i++) - { - var partA = parts[i]; - - for (var j = i + 1; j < parts.length; j++) - { - var partB = parts[j]; - - if (Bounds.overlaps(partA.bounds, partB.bounds)) - { - var pav = partA.vertices; - var pbv = partB.vertices; - - // iterate vertices of both parts - for (var k = 0; k < partA.vertices.length; k++) - { - for (var z = 0; z < partB.vertices.length; z++) - { - // find distances between the vertices - var da = Vector.magnitudeSquared(Vector.sub(pav[(k + 1) % pav.length], pbv[z])); - var db = Vector.magnitudeSquared(Vector.sub(pav[k], pbv[(z + 1) % pbv.length])); - - // if both vertices are very close, consider the edge concident (internal) - if (da < maxDistance && db < maxDistance) - { - pav[k].isInternal = true; - pbv[z].isInternal = true; - } - } - } - } - } - } - - return parts; - }; - -})(); - - -/***/ }), -/* 87 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Returns the center x coordinate from the bounds of the Game Object. - * - * @function Phaser.Display.Bounds.GetCenterX - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * - * @return {number} The center x coordinate of the bounds of the Game Object. - */ -var GetCenterX = function (gameObject) -{ - return gameObject.x - (gameObject.width * gameObject.originX) + (gameObject.width * 0.5); -}; - -module.exports = GetCenterX; + graphics.lineBetween(this.p0.x, this.p0.y, this.p1.x, this.p1.y); + // So you can chain graphics calls + return graphics; + }, -/***/ }), -/* 88 */ -/***/ (function(module, exports) { + /** + * Gets a JSON representation of the line. + * + * @method Phaser.Curves.Line#toJSON + * @since 3.0.0 + * + * @return {Phaser.Types.Curves.JSONCurve} The JSON object containing this curve data. + */ + toJSON: function () + { + return { + type: this.type, + points: [ + this.p0.x, this.p0.y, + this.p1.x, this.p1.y + ] + }; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +}); /** - * Positions the Game Object so that the center top of its bounds aligns with the given coordinate. + * Configures this line from a JSON representation. * - * @function Phaser.Display.Bounds.SetCenterX + * @function Phaser.Curves.Line.fromJSON * @since 3.0.0 * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. - * @param {number} x - The coordinate to position the Game Object bounds on. + * @param {Phaser.Types.Curves.JSONCurve} data - The JSON object containing this curve data. * - * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. + * @return {Phaser.Curves.Line} A new LineCurve object. */ -var SetCenterX = function (gameObject, x) +LineCurve.fromJSON = function (data) { - var offsetX = gameObject.width * gameObject.originX; + var points = data.points; - gameObject.x = (x + offsetX) - (gameObject.width * 0.5); + var p0 = new Vector2(points[0], points[1]); + var p1 = new Vector2(points[2], points[3]); - return gameObject; + return new LineCurve(p0, p1); }; -module.exports = SetCenterX; +module.exports = LineCurve; /***/ }), -/* 89 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Returns the center y coordinate from the bounds of the Game Object. - * - * @function Phaser.Display.Bounds.GetCenterY - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * - * @return {number} The center y coordinate of the bounds of the Game Object. - */ -var GetCenterY = function (gameObject) -{ - return gameObject.y - (gameObject.height * gameObject.originY) + (gameObject.height * 0.5); -}; -module.exports = GetCenterY; - - -/***/ }), -/* 90 */ -/***/ (function(module, exports) { +/***/ 64761: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var Curve = __webpack_require__(38517); +var QuadraticBezierInterpolation = __webpack_require__(16252); +var Vector2 = __webpack_require__(93736); + /** - * Positions the Game Object so that the center top of its bounds aligns with the given coordinate. - * - * @function Phaser.Display.Bounds.SetCenterY - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * @classdesc + * A quadratic Bézier curve constructed from two control points. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. - * @param {number} y - The coordinate to position the Game Object bounds on. + * @class QuadraticBezier + * @extends Phaser.Curves.Curve + * @memberof Phaser.Curves + * @constructor + * @since 3.2.0 * - * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. + * @param {(Phaser.Math.Vector2|number[])} p0 - Start point, or an array of point pairs. + * @param {Phaser.Math.Vector2} p1 - Control Point 1. + * @param {Phaser.Math.Vector2} p2 - Control Point 2. */ -var SetCenterY = function (gameObject, y) -{ - var offsetY = gameObject.height * gameObject.originY; - - gameObject.y = (y + offsetY) - (gameObject.height * 0.5); - - return gameObject; -}; - -module.exports = SetCenterY; +var QuadraticBezier = new Class({ + Extends: Curve, -/***/ }), -/* 91 */ -/***/ (function(module, exports, __webpack_require__) { + initialize: -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + function QuadraticBezier (p0, p1, p2) + { + Curve.call(this, 'QuadraticBezierCurve'); -/** - * @namespace Phaser.Renderer.Events - */ + if (Array.isArray(p0)) + { + p2 = new Vector2(p0[4], p0[5]); + p1 = new Vector2(p0[2], p0[3]); + p0 = new Vector2(p0[0], p0[1]); + } -module.exports = { + /** + * The start point. + * + * @name Phaser.Curves.QuadraticBezier#p0 + * @type {Phaser.Math.Vector2} + * @since 3.2.0 + */ + this.p0 = p0; - POST_RENDER: __webpack_require__(628), - PRE_RENDER: __webpack_require__(629), - RENDER: __webpack_require__(630), - RESIZE: __webpack_require__(631) + /** + * The first control point. + * + * @name Phaser.Curves.QuadraticBezier#p1 + * @type {Phaser.Math.Vector2} + * @since 3.2.0 + */ + this.p1 = p1; -}; + /** + * The second control point. + * + * @name Phaser.Curves.QuadraticBezier#p2 + * @type {Phaser.Math.Vector2} + * @since 3.2.0 + */ + this.p2 = p2; + }, + /** + * Gets the starting point on the curve. + * + * @method Phaser.Curves.QuadraticBezier#getStartPoint + * @since 3.2.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + */ + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } -/***/ }), -/* 92 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return out.copy(this.p0); + }, -var PIPELINE_CONST = { + /** + * Get the resolution of the curve. + * + * @method Phaser.Curves.QuadraticBezier#getResolution + * @since 3.2.0 + * + * @param {number} divisions - Optional divisions value. + * + * @return {number} The curve resolution. + */ + getResolution: function (divisions) + { + return divisions; + }, /** - * The Bitmap Mask Pipeline. + * Get point at relative position in curve according to length. * - * @name Phaser.Renderer.WebGL.Pipelines.BITMAPMASK_PIPELINE - * @type {string} - * @const - * @since 3.50.0 + * @method Phaser.Curves.QuadraticBezier#getPoint + * @since 3.2.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. */ - BITMAPMASK_PIPELINE: 'BitmapMaskPipeline', + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } + + var p0 = this.p0; + var p1 = this.p1; + var p2 = this.p2; + + return out.set( + QuadraticBezierInterpolation(t, p0.x, p1.x, p2.x), + QuadraticBezierInterpolation(t, p0.y, p1.y, p2.y) + ); + }, /** - * The Light 2D Pipeline. + * Draws this curve on the given Graphics object. * - * @name Phaser.Renderer.WebGL.Pipelines.LIGHT_PIPELINE - * @type {string} - * @const - * @since 3.50.0 + * The curve is drawn using `Graphics.strokePoints` so will be drawn at whatever the present Graphics stroke color is. + * The Graphics object is not cleared before the draw, so the curve will appear on-top of anything else already rendered to it. + * + * @method Phaser.Curves.QuadraticBezier#draw + * @since 3.2.0 + * + * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] + * + * @param {Phaser.GameObjects.Graphics} graphics - `Graphics` object to draw onto. + * @param {number} [pointsTotal=32] - Number of points to be used for drawing the curve. Higher numbers result in smoother curve but require more processing. + * + * @return {Phaser.GameObjects.Graphics} `Graphics` object that was drawn to. */ - LIGHT_PIPELINE: 'Light2D', + draw: function (graphics, pointsTotal) + { + if (pointsTotal === undefined) { pointsTotal = 32; } + + var points = this.getPoints(pointsTotal); + + graphics.beginPath(); + graphics.moveTo(this.p0.x, this.p0.y); + + for (var i = 1; i < points.length; i++) + { + graphics.lineTo(points[i].x, points[i].y); + } + + graphics.strokePath(); + + // So you can chain graphics calls + return graphics; + }, /** - * The Point Light Pipeline. + * Converts the curve into a JSON compatible object. * - * @name Phaser.Renderer.WebGL.Pipelines.POINTLIGHT_PIPELINE - * @type {string} - * @const - * @since 3.50.0 + * @method Phaser.Curves.QuadraticBezier#toJSON + * @since 3.2.0 + * + * @return {Phaser.Types.Curves.JSONCurve} The JSON object containing this curve data. */ - POINTLIGHT_PIPELINE: 'PointLightPipeline', + toJSON: function () + { + return { + type: this.type, + points: [ + this.p0.x, this.p0.y, + this.p1.x, this.p1.y, + this.p2.x, this.p2.y + ] + }; + } + +}); + +/** + * Creates a curve from a JSON object, e. g. created by `toJSON`. + * + * @function Phaser.Curves.QuadraticBezier.fromJSON + * @since 3.2.0 + * + * @param {Phaser.Types.Curves.JSONCurve} data - The JSON object containing this curve data. + * + * @return {Phaser.Curves.QuadraticBezier} The created curve instance. + */ +QuadraticBezier.fromJSON = function (data) +{ + var points = data.points; + + var p0 = new Vector2(points[0], points[1]); + var p1 = new Vector2(points[2], points[3]); + var p2 = new Vector2(points[4], points[5]); + + return new QuadraticBezier(p0, p1, p2); +}; + +module.exports = QuadraticBezier; + + +/***/ }), + +/***/ 11956: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + +var CatmullRom = __webpack_require__(14976); +var Class = __webpack_require__(56694); +var Curve = __webpack_require__(38517); +var Vector2 = __webpack_require__(93736); + +/** + * @classdesc + * Create a smooth 2d spline curve from a series of points. + * + * @class Spline + * @extends Phaser.Curves.Curve + * @memberof Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2[]|number[]|number[][])} [points] - The points that configure the curve. + */ +var SplineCurve = new Class({ + + Extends: Curve, + + initialize: + + function SplineCurve (points) + { + if (points === undefined) { points = []; } + + Curve.call(this, 'SplineCurve'); + + /** + * The Vector2 points that configure the curve. + * + * @name Phaser.Curves.Spline#points + * @type {Phaser.Math.Vector2[]} + * @default [] + * @since 3.0.0 + */ + this.points = []; + + this.addPoints(points); + }, /** - * The Single Texture Pipeline. + * Add a list of points to the current list of Vector2 points of the curve. * - * @name Phaser.Renderer.WebGL.Pipelines.SINGLE_PIPELINE - * @type {string} - * @const - * @since 3.50.0 + * @method Phaser.Curves.Spline#addPoints + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2[]|number[]|number[][])} points - The points that configure the curve. + * + * @return {this} This curve object. */ - SINGLE_PIPELINE: 'SinglePipeline', + addPoints: function (points) + { + for (var i = 0; i < points.length; i++) + { + var p = new Vector2(); + + if (typeof points[i] === 'number') + { + p.x = points[i]; + p.y = points[i + 1]; + i++; + } + else if (Array.isArray(points[i])) + { + // An array of arrays? + p.x = points[i][0]; + p.y = points[i][1]; + } + else + { + p.x = points[i].x; + p.y = points[i].y; + } + + this.points.push(p); + } + + return this; + }, /** - * The Multi Texture Pipeline. + * Add a point to the current list of Vector2 points of the curve. * - * @name Phaser.Renderer.WebGL.Pipelines.MULTI_PIPELINE - * @type {string} - * @const - * @since 3.50.0 + * @method Phaser.Curves.Spline#addPoint + * @since 3.0.0 + * + * @param {number} x - The x coordinate of this curve + * @param {number} y - The y coordinate of this curve + * + * @return {Phaser.Math.Vector2} The new Vector2 added to the curve */ - MULTI_PIPELINE: 'MultiPipeline', + addPoint: function (x, y) + { + var vec = new Vector2(x, y); + + this.points.push(vec); + + return vec; + }, /** - * The Rope Pipeline. + * Gets the starting point on the curve. * - * @name Phaser.Renderer.WebGL.Pipelines.ROPE_PIPELINE - * @type {string} - * @const - * @since 3.50.0 + * @method Phaser.Curves.Spline#getStartPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. */ - ROPE_PIPELINE: 'RopePipeline', + getStartPoint: function (out) + { + if (out === undefined) { out = new Vector2(); } + + return out.copy(this.points[0]); + }, /** - * The Graphics and Shapes Pipeline. + * Get the resolution of the curve. * - * @name Phaser.Renderer.WebGL.Pipelines.GRAPHICS_PIPELINE - * @type {string} - * @const - * @since 3.50.0 + * @method Phaser.Curves.Spline#getResolution + * @since 3.0.0 + * + * @param {number} divisions - Optional divisions value. + * + * @return {number} The curve resolution. */ - GRAPHICS_PIPELINE: 'GraphicsPipeline', + getResolution: function (divisions) + { + return divisions * this.points.length; + }, /** - * The Post FX Pipeline. + * Get point at relative position in curve according to length. * - * @name Phaser.Renderer.WebGL.Pipelines.POSTFX_PIPELINE - * @type {string} - * @const - * @since 3.50.0 + * @method Phaser.Curves.Spline#getPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. */ - POSTFX_PIPELINE: 'PostFXPipeline', + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } + + var points = this.points; + + var point = (points.length - 1) * t; + + var intPoint = Math.floor(point); + + var weight = point - intPoint; + + var p0 = points[(intPoint === 0) ? intPoint : intPoint - 1]; + var p1 = points[intPoint]; + var p2 = points[(intPoint > points.length - 2) ? points.length - 1 : intPoint + 1]; + var p3 = points[(intPoint > points.length - 3) ? points.length - 1 : intPoint + 2]; + + return out.set(CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), CatmullRom(weight, p0.y, p1.y, p2.y, p3.y)); + }, /** - * The Utility Pipeline. + * Exports a JSON object containing this curve data. * - * @name Phaser.Renderer.WebGL.Pipelines.UTILITY_PIPELINE - * @type {string} - * @const - * @since 3.50.0 + * @method Phaser.Curves.Spline#toJSON + * @since 3.0.0 + * + * @return {Phaser.Types.Curves.JSONCurve} The JSON object containing this curve data. */ - UTILITY_PIPELINE: 'UtilityPipeline' + toJSON: function () + { + var points = []; + + for (var i = 0; i < this.points.length; i++) + { + points.push(this.points[i].x); + points.push(this.points[i].y); + } + + return { + type: this.type, + points: points + }; + } + +}); + +/** + * Imports a JSON object containing this curve data. + * + * @function Phaser.Curves.Spline.fromJSON + * @since 3.0.0 + * + * @param {Phaser.Types.Curves.JSONCurve} data - The JSON object containing this curve data. + * + * @return {Phaser.Curves.Spline} The spline curve created. + */ +SplineCurve.fromJSON = function (data) +{ + return new SplineCurve(data.points); }; -module.exports = PIPELINE_CONST; +module.exports = SplineCurve; /***/ }), -/* 93 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 73962: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SpliceOne = __webpack_require__(74); - /** - * Removes the given item, or array of items, from the array. - * - * The array is modified in-place. - * - * You can optionally specify a callback to be invoked for each item successfully removed from the array. - * - * @function Phaser.Utils.Array.Remove - * @since 3.4.0 - * - * @param {array} array - The array to be modified. - * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array. - * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array. - * @param {object} [context] - The context in which the callback is invoked. - * - * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array. + * @namespace Phaser.Curves */ -var Remove = function (array, item, callback, context) -{ - if (context === undefined) { context = array; } - var index; +module.exports = { + Path: __webpack_require__(12822), + MoveTo: __webpack_require__(53639), - // Fast path to avoid array mutation and iteration - if (!Array.isArray(item)) - { - index = array.indexOf(item); + CubicBezier: __webpack_require__(63120), + Curve: __webpack_require__(38517), + Ellipse: __webpack_require__(48835), + Line: __webpack_require__(58084), + QuadraticBezier: __webpack_require__(64761), + Spline: __webpack_require__(11956) +}; - if (index !== -1) - { - SpliceOne(array, index); - if (callback) - { - callback.call(context, item); - } +/***/ }), - return item; - } - else - { - return null; - } - } +/***/ 53639: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // If we got this far, we have an array of items to remove +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var itemLength = item.length - 1; - var removed = []; +var Class = __webpack_require__(56694); +var Vector2 = __webpack_require__(93736); - while (itemLength >= 0) +/** + * @classdesc + * A MoveTo Curve is a very simple curve consisting of only a single point. + * Its intended use is to move the ending point in a Path. + * + * @class MoveTo + * @memberof Phaser.Curves + * @constructor + * @since 3.0.0 + * + * @param {number} [x=0] - `x` pixel coordinate. + * @param {number} [y=0] - `y` pixel coordinate. + */ +var MoveTo = new Class({ + + initialize: + + function MoveTo (x, y) { - var entry = item[itemLength]; + /** + * Denotes that this Curve does not influence the bounds, points, and drawing of its parent Path. Must be `false` or some methods in the parent Path will throw errors. + * + * @name Phaser.Curves.MoveTo#active + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.active = false; - index = array.indexOf(entry); + /** + * The lone point which this curve consists of. + * + * @name Phaser.Curves.MoveTo#p0 + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.p0 = new Vector2(x, y); + }, - if (index !== -1) - { - SpliceOne(array, index); + /** + * Get point at relative position in curve according to length. + * + * @method Phaser.Curves.MoveTo#getPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. + * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * + * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } - removed.push(entry); + return out.copy(this.p0); + }, - if (callback) - { - callback.call(context, entry); - } - } + /** + * Retrieves the point at given position in the curve. This will always return this curve's only point. + * + * @method Phaser.Curves.MoveTo#getPointAt + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} u - The position in the path to retrieve, between 0 and 1. Not used. + * @param {Phaser.Math.Vector2} [out] - An optional vector in which to store the point. + * + * @return {Phaser.Math.Vector2} The modified `out` vector, or a new `Vector2` if none was provided. + */ + getPointAt: function (u, out) + { + return this.getPoint(u, out); + }, - itemLength--; + /** + * Gets the resolution of this curve. + * + * @method Phaser.Curves.MoveTo#getResolution + * @since 3.0.0 + * + * @return {number} The resolution of this curve. For a MoveTo the value is always 1. + */ + getResolution: function () + { + return 1; + }, + + /** + * Gets the length of this curve. + * + * @method Phaser.Curves.MoveTo#getLength + * @since 3.0.0 + * + * @return {number} The length of this curve. For a MoveTo the value is always 0. + */ + getLength: function () + { + return 0; + }, + + /** + * Converts this curve into a JSON-serializable object. + * + * @method Phaser.Curves.MoveTo#toJSON + * @since 3.0.0 + * + * @return {Phaser.Types.Curves.JSONCurve} A primitive object with the curve's type and only point. + */ + toJSON: function () + { + return { + type: 'MoveTo', + points: [ + this.p0.x, this.p0.y + ] + }; } - return removed; -}; +}); -module.exports = Remove; +module.exports = MoveTo; /***/ }), -/* 94 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 12822: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var FromPoints = __webpack_require__(199); -var Rectangle = __webpack_require__(10); -var Vector2 = __webpack_require__(3); +// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + +var Class = __webpack_require__(56694); +var CubicBezierCurve = __webpack_require__(63120); +var EllipseCurve = __webpack_require__(48835); +var GameObjectFactory = __webpack_require__(61286); +var LineCurve = __webpack_require__(58084); +var MovePathTo = __webpack_require__(53639); +var QuadraticBezierCurve = __webpack_require__(64761); +var Rectangle = __webpack_require__(74118); +var SplineCurve = __webpack_require__(11956); +var Vector2 = __webpack_require__(93736); +var MATH_CONST = __webpack_require__(83392); /** * @classdesc - * A Base Curve class, which all other curve types extend. + * A Path combines multiple Curves into one continuous compound curve. + * It does not matter how many Curves are in the Path or what type they are. * - * Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + * A Curve in a Path does not have to start where the previous Curve ends - that is to say, a Path does not + * have to be an uninterrupted curve. Only the order of the Curves influences the actual points on the Path. * - * @class Curve + * @class Path * @memberof Phaser.Curves * @constructor * @since 3.0.0 * - * @param {string} type - The curve type. + * @param {number} [x=0] - The X coordinate of the Path's starting point or a {@link Phaser.Types.Curves.JSONPath}. + * @param {number} [y=0] - The Y coordinate of the Path's starting point. */ -var Curve = new Class({ +var Path = new Class({ initialize: - function Curve (type) + function Path (x, y) { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + /** - * String based identifier for the type of curve. + * The name of this Path. + * Empty by default and never populated by Phaser, this is left for developers to use. * - * @name Phaser.Curves.Curve#type + * @name Phaser.Curves.Path#name * @type {string} + * @default '' * @since 3.0.0 */ - this.type = type; + this.name = ''; /** - * The default number of divisions within the curve. + * The list of Curves which make up this Path. * - * @name Phaser.Curves.Curve#defaultDivisions - * @type {number} - * @default 5 + * @name Phaser.Curves.Path#curves + * @type {Phaser.Curves.Curve[]} + * @default [] * @since 3.0.0 */ - this.defaultDivisions = 5; + this.curves = []; /** - * The quantity of arc length divisions within the curve. + * The cached length of each Curve in the Path. * - * @name Phaser.Curves.Curve#arcLengthDivisions - * @type {number} - * @default 100 - * @since 3.0.0 - */ - this.arcLengthDivisions = 100; - - /** - * An array of cached arc length values. + * Used internally by {@link #getCurveLengths}. * - * @name Phaser.Curves.Curve#cacheArcLengths + * @name Phaser.Curves.Path#cacheLengths * @type {number[]} * @default [] * @since 3.0.0 */ - this.cacheArcLengths = []; + this.cacheLengths = []; /** - * Does the data of this curve need updating? + * Automatically closes the path. * - * @name Phaser.Curves.Curve#needsUpdate + * @name Phaser.Curves.Path#autoClose * @type {boolean} - * @default true + * @default false * @since 3.0.0 */ - this.needsUpdate = true; + this.autoClose = false; /** - * For a curve on a Path, `false` means the Path will ignore this curve. + * The starting point of the Path. * - * @name Phaser.Curves.Curve#active - * @type {boolean} - * @default true + * This is not necessarily equivalent to the starting point of the first Curve in the Path. In an empty Path, it's also treated as the ending point. + * + * @name Phaser.Curves.Path#startPoint + * @type {Phaser.Math.Vector2} * @since 3.0.0 */ - this.active = true; + this.startPoint = new Vector2(); /** - * A temporary calculation Vector. + * A temporary vector used to avoid object creation when adding a Curve to the Path. * - * @name Phaser.Curves.Curve#_tmpVec2A + * @name Phaser.Curves.Path#_tmpVec2A * @type {Phaser.Math.Vector2} * @private * @since 3.0.0 @@ -48366,912 +45910,823 @@ var Curve = new Class({ this._tmpVec2A = new Vector2(); /** - * A temporary calculation Vector. + * A temporary vector used to avoid object creation when adding a Curve to the Path. * - * @name Phaser.Curves.Curve#_tmpVec2B + * @name Phaser.Curves.Path#_tmpVec2B * @type {Phaser.Math.Vector2} * @private * @since 3.0.0 */ this._tmpVec2B = new Vector2(); - }, - - /** - * Draws this curve on the given Graphics object. - * - * The curve is drawn using `Graphics.strokePoints` so will be drawn at whatever the present Graphics stroke color is. - * The Graphics object is not cleared before the draw, so the curve will appear on-top of anything else already rendered to it. - * - * @method Phaser.Curves.Curve#draw - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] - * - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics instance onto which this curve will be drawn. - * @param {number} [pointsTotal=32] - The resolution of the curve. The higher the value the smoother it will render, at the cost of rendering performance. - * - * @return {Phaser.GameObjects.Graphics} The Graphics object to which the curve was drawn. - */ - draw: function (graphics, pointsTotal) - { - if (pointsTotal === undefined) { pointsTotal = 32; } - // So you can chain graphics calls - return graphics.strokePoints(this.getPoints(pointsTotal)); + if (typeof x === 'object') + { + this.fromJSON(x); + } + else + { + this.startPoint.set(x, y); + } }, /** - * Returns a Rectangle where the position and dimensions match the bounds of this Curve. + * Appends a Curve to the end of the Path. * - * You can control the accuracy of the bounds. The value given is used to work out how many points - * to plot across the curve. Higher values are more accurate at the cost of calculation speed. + * The Curve does not have to start where the Path ends or, for an empty Path, at its defined starting point. * - * @method Phaser.Curves.Curve#getBounds + * @method Phaser.Curves.Path#add * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the bounds in. If falsey a new object will be created. - * @param {number} [accuracy=16] - The accuracy of the bounds calculations. + * @param {Phaser.Curves.Curve} curve - The Curve to append. * - * @return {Phaser.Geom.Rectangle} A Rectangle object holding the bounds of this curve. If `out` was given it will be this object. + * @return {this} This Path object. */ - getBounds: function (out, accuracy) + add: function (curve) { - if (!out) { out = new Rectangle(); } - if (accuracy === undefined) { accuracy = 16; } - - var len = this.getLength(); - - if (accuracy > len) - { - accuracy = len / 2; - } - - // The length of the curve in pixels - // So we'll have 1 spaced point per 'accuracy' pixels - - var spaced = Math.max(1, Math.round(len / accuracy)); + this.curves.push(curve); - return FromPoints(this.getSpacedPoints(spaced), out); + return this; }, /** - * Returns an array of points, spaced out X distance pixels apart. - * The smaller the distance, the larger the array will be. + * Creates a circular Ellipse Curve positioned at the end of the Path. * - * @method Phaser.Curves.Curve#getDistancePoints + * @method Phaser.Curves.Path#circleTo * @since 3.0.0 * - * @param {number} distance - The distance, in pixels, between each point along the curve. + * @param {number} radius - The radius of the circle. + * @param {boolean} [clockwise=false] - `true` to create a clockwise circle as opposed to a counter-clockwise circle. + * @param {number} [rotation=0] - The rotation of the circle in degrees. * - * @return {Phaser.Geom.Point[]} An Array of Point objects. + * @return {this} This Path object. */ - getDistancePoints: function (distance) + circleTo: function (radius, clockwise, rotation) { - var len = this.getLength(); - - var spaced = Math.max(1, len / distance); + if (clockwise === undefined) { clockwise = false; } - return this.getSpacedPoints(spaced); + return this.ellipseTo(radius, radius, 0, 360, clockwise, rotation); }, /** - * Get a point at the end of the curve. - * - * @method Phaser.Curves.Curve#getEndPoint - * @since 3.0.0 + * Ensures that the Path is closed. * - * @param {Phaser.Math.Vector2} [out] - Optional Vector object to store the result in. + * A closed Path starts and ends at the same point. If the Path is not closed, a straight Line Curve will be created from the ending point directly to the starting point. During the check, the actual starting point of the Path, i.e. the starting point of the first Curve, will be used as opposed to the Path's defined {@link startPoint}, which could differ. * - * @return {Phaser.Math.Vector2} Vector2 containing the coordinates of the curves end point. - */ - getEndPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } - - return this.getPointAt(1, out); - }, - - /** - * Get total curve arc length + * Calling this method on an empty Path will result in an error. * - * @method Phaser.Curves.Curve#getLength + * @method Phaser.Curves.Path#closePath * @since 3.0.0 * - * @return {number} The total length of the curve. + * @return {this} This Path object. */ - getLength: function () + closePath: function () { - var lengths = this.getLengths(); + // Add a line curve if start and end of lines are not connected + var startPoint = this.curves[0].getPoint(0); + var endPoint = this.curves[this.curves.length - 1].getPoint(1); - return lengths[lengths.length - 1]; - }, + if (!startPoint.equals(endPoint)) + { + // This will copy a reference to the vectors, which probably isn't sensible + this.curves.push(new LineCurve(endPoint, startPoint)); + } + return this; + }, /** - * Get a list of cumulative segment lengths. - * - * These lengths are - * - * - [0] 0 - * - [1] The first segment - * - [2] The first and second segment - * - ... - * - [divisions] All segments + * Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points. * - * @method Phaser.Curves.Curve#getLengths + * @method Phaser.Curves.Path#cubicBezierTo * @since 3.0.0 * - * @param {number} [divisions] - The number of divisions or segments. + * @param {(number|Phaser.Math.Vector2)} x - The x coordinate of the end point. Or, if a Vector2, the p1 value. + * @param {(number|Phaser.Math.Vector2)} y - The y coordinate of the end point. Or, if a Vector2, the p2 value. + * @param {(number|Phaser.Math.Vector2)} control1X - The x coordinate of the first control point. Or, if a Vector2, the p3 value. + * @param {number} [control1Y] - The y coordinate of the first control point. Not used if Vector2s are provided as the first 3 arguments. + * @param {number} [control2X] - The x coordinate of the second control point. Not used if Vector2s are provided as the first 3 arguments. + * @param {number} [control2Y] - The y coordinate of the second control point. Not used if Vector2s are provided as the first 3 arguments. * - * @return {number[]} An array of cumulative lengths. + * @return {this} This Path object. */ - getLengths: function (divisions) + cubicBezierTo: function (x, y, control1X, control1Y, control2X, control2Y) { - if (divisions === undefined) { divisions = this.arcLengthDivisions; } + var p0 = this.getEndPoint(); + var p1; + var p2; + var p3; - if ((this.cacheArcLengths.length === divisions + 1) && !this.needsUpdate) + // Assume they're all Vector2s + if (x instanceof Vector2) { - return this.cacheArcLengths; + p1 = x; + p2 = y; + p3 = control1X; } - - this.needsUpdate = false; - - var cache = []; - var current; - var last = this.getPoint(0, this._tmpVec2A); - var sum = 0; - - cache.push(0); - - for (var p = 1; p <= divisions; p++) + else { - current = this.getPoint(p / divisions, this._tmpVec2B); - - sum += current.distance(last); - - cache.push(sum); - - last.copy(current); + p1 = new Vector2(control1X, control1Y); + p2 = new Vector2(control2X, control2Y); + p3 = new Vector2(x, y); } - this.cacheArcLengths = cache; - - return cache; // { sums: cache, sum:sum }; Sum is in the last element. + return this.add(new CubicBezierCurve(p0, p1, p2, p3)); }, - // Get point at relative position in curve according to arc length - - // - u [0 .. 1] + // Creates a quadratic bezier curve starting at the previous end point and ending at p2, using p1 as a control point /** - * Get a point at a relative position on the curve, by arc length. - * - * @method Phaser.Curves.Curve#getPointAt - * @since 3.0.0 + * Creates a Quadratic Bezier Curve starting at the ending point of the Path. * - * @generic {Phaser.Math.Vector2} O - [out,$return] + * @method Phaser.Curves.Path#quadraticBezierTo + * @since 3.2.0 * - * @param {number} u - The relative position, [0..1]. - * @param {Phaser.Math.Vector2} [out] - A point to store the result in. + * @param {(number|Phaser.Math.Vector2[])} x - The X coordinate of the second control point or, if it's a `Vector2`, the first control point. + * @param {number} [y] - The Y coordinate of the second control point or, if `x` is a `Vector2`, the second control point. + * @param {number} [controlX] - If `x` is not a `Vector2`, the X coordinate of the first control point. + * @param {number} [controlY] - If `x` is not a `Vector2`, the Y coordinate of the first control point. * - * @return {Phaser.Math.Vector2} The point. + * @return {this} This Path object. */ - getPointAt: function (u, out) + quadraticBezierTo: function (x, y, controlX, controlY) { - var t = this.getUtoTmapping(u); + var p0 = this.getEndPoint(); + var p1; + var p2; - return this.getPoint(t, out); - }, + // Assume they're all Vector2s + if (x instanceof Vector2) + { + p1 = x; + p2 = y; + } + else + { + p1 = new Vector2(controlX, controlY); + p2 = new Vector2(x, y); + } - // Get sequence of points using getPoint( t ) + return this.add(new QuadraticBezierCurve(p0, p1, p2)); + }, /** - * Get a sequence of evenly spaced points from the curve. - * - * You can pass `divisions`, `stepRate`, or neither. - * - * The number of divisions will be - * - * 1. `divisions`, if `divisions` > 0; or - * 2. `this.getLength / stepRate`, if `stepRate` > 0; or - * 3. `this.defaultDivisions` - * - * `1 + divisions` points will be returned. + * Draws all Curves in the Path to a Graphics Game Object. * - * @method Phaser.Curves.Curve#getPoints + * @method Phaser.Curves.Path#draw * @since 3.0.0 * - * @generic {Phaser.Math.Vector2[]} O - [out,$return] + * @generic {Phaser.GameObjects.Graphics} G - [out,$return] * - * @param {number} [divisions] - The number of divisions to make. - * @param {number} [stepRate] - The curve distance between points, implying `divisions`. - * @param {(array|Phaser.Math.Vector2[])} [out] - An optional array to store the points in. + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics Game Object to draw to. + * @param {number} [pointsTotal=32] - The number of points to draw for each Curve. Higher numbers result in a smoother curve but require more processing. * - * @return {(array|Phaser.Math.Vector2[])} An array of Points from the curve. + * @return {Phaser.GameObjects.Graphics} The Graphics object which was drawn to. */ - getPoints: function (divisions, stepRate, out) + draw: function (graphics, pointsTotal) { - if (out === undefined) { out = []; } - - // If divisions is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!divisions) + for (var i = 0; i < this.curves.length; i++) { - if (!stepRate) - { - divisions = this.defaultDivisions; - } - else + var curve = this.curves[i]; + + if (!curve.active) { - divisions = this.getLength() / stepRate; + continue; } - } - for (var d = 0; d <= divisions; d++) - { - out.push(this.getPoint(d / divisions)); + curve.draw(graphics, pointsTotal); } - return out; + return graphics; }, /** - * Get a random point from the curve. + * Creates an ellipse curve positioned at the previous end point, using the given parameters. * - * @method Phaser.Curves.Curve#getRandomPoint + * @method Phaser.Curves.Path#ellipseTo * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - A point object to store the result in. + * @param {number} [xRadius=0] - The horizontal radius of ellipse. + * @param {number} [yRadius=0] - The vertical radius of ellipse. + * @param {number} [startAngle=0] - The start angle of the ellipse, in degrees. + * @param {number} [endAngle=360] - The end angle of the ellipse, in degrees. + * @param {boolean} [clockwise=false] - Whether the ellipse angles are given as clockwise (`true`) or counter-clockwise (`false`). + * @param {number} [rotation=0] - The rotation of the ellipse, in degrees. * - * @return {Phaser.Math.Vector2} The point. + * @return {this} This Path object. */ - getRandomPoint: function (out) + ellipseTo: function (xRadius, yRadius, startAngle, endAngle, clockwise, rotation) { - if (out === undefined) { out = new Vector2(); } + var ellipse = new EllipseCurve(0, 0, xRadius, yRadius, startAngle, endAngle, clockwise, rotation); - return this.getPoint(Math.random(), out); - }, + var end = this.getEndPoint(this._tmpVec2A); - // Get sequence of points using getPointAt( u ) + // Calculate where to center the ellipse + var start = ellipse.getStartPoint(this._tmpVec2B); + + end.subtract(start); + + ellipse.x = end.x; + ellipse.y = end.y; + + return this.add(ellipse); + }, /** - * Get a sequence of equally spaced points (by arc distance) from the curve. + * Creates a Path from a Path Configuration object. * - * `1 + divisions` points will be returned. + * The provided object should be a {@link Phaser.Types.Curves.JSONPath}, as returned by {@link #toJSON}. Providing a malformed object may cause errors. * - * @method Phaser.Curves.Curve#getSpacedPoints + * @method Phaser.Curves.Path#fromJSON * @since 3.0.0 * - * @param {number} [divisions=this.defaultDivisions] - The number of divisions to make. - * @param {number} [stepRate] - Step between points. Used to calculate the number of points to return when divisions is falsy. Ignored if divisions is positive. - * @param {(array|Phaser.Math.Vector2[])} [out] - An optional array to store the points in. + * @param {Phaser.Types.Curves.JSONPath} data - The JSON object containing the Path data. * - * @return {Phaser.Math.Vector2[]} An array of points. + * @return {this} This Path object. */ - getSpacedPoints: function (divisions, stepRate, out) + fromJSON: function (data) { - if (out === undefined) { out = []; } + // data should be an object matching the Path.toJSON object structure. - // If divisions is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!divisions) + this.curves = []; + this.cacheLengths = []; + + this.startPoint.set(data.x, data.y); + + this.autoClose = data.autoClose; + + for (var i = 0; i < data.curves.length; i++) { - if (!stepRate) - { - divisions = this.defaultDivisions; - } - else + var curve = data.curves[i]; + + switch (curve.type) { - divisions = this.getLength() / stepRate; - } - } + case 'LineCurve': + this.add(LineCurve.fromJSON(curve)); + break; - for (var d = 0; d <= divisions; d++) - { - var t = this.getUtoTmapping(d / divisions, null, divisions); + case 'EllipseCurve': + this.add(EllipseCurve.fromJSON(curve)); + break; - out.push(this.getPoint(t)); + case 'SplineCurve': + this.add(SplineCurve.fromJSON(curve)); + break; + + case 'CubicBezierCurve': + this.add(CubicBezierCurve.fromJSON(curve)); + break; + + case 'QuadraticBezierCurve': + this.add(QuadraticBezierCurve.fromJSON(curve)); + break; + } } - return out; + return this; }, /** - * Get a point at the start of the curve. + * Returns a Rectangle with a position and size matching the bounds of this Path. * - * @method Phaser.Curves.Curve#getStartPoint + * @method Phaser.Curves.Path#getBounds * @since 3.0.0 * * @generic {Phaser.Math.Vector2} O - [out,$return] * - * @param {Phaser.Math.Vector2} [out] - A point to store the result in. + * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the bounds in. + * @param {number} [accuracy=16] - The accuracy of the bounds calculations. Higher values are more accurate at the cost of calculation speed. * - * @return {Phaser.Math.Vector2} The point. + * @return {Phaser.Geom.Rectangle} The modified `out` Rectangle, or a new Rectangle if none was provided. */ - getStartPoint: function (out) + getBounds: function (out, accuracy) { - if (out === undefined) { out = new Vector2(); } - - return this.getPointAt(0, out); - }, + if (out === undefined) { out = new Rectangle(); } + if (accuracy === undefined) { accuracy = 16; } + + out.x = Number.MAX_VALUE; + out.y = Number.MAX_VALUE; + + var bounds = new Rectangle(); + var maxRight = MATH_CONST.MIN_SAFE_INTEGER; + var maxBottom = MATH_CONST.MIN_SAFE_INTEGER; + + for (var i = 0; i < this.curves.length; i++) + { + var curve = this.curves[i]; + + if (!curve.active) + { + continue; + } + + curve.getBounds(bounds, accuracy); + + out.x = Math.min(out.x, bounds.x); + out.y = Math.min(out.y, bounds.y); + + maxRight = Math.max(maxRight, bounds.right); + maxBottom = Math.max(maxBottom, bounds.bottom); + } + + out.right = maxRight; + out.bottom = maxBottom; + + return out; + }, /** - * Get a unit vector tangent at a relative position on the curve. - * In case any sub curve does not implement its tangent derivation, - * 2 points a small delta apart will be used to find its gradient - * which seems to give a reasonable approximation - * - * @method Phaser.Curves.Curve#getTangent - * @since 3.0.0 + * Returns an array containing the length of the Path at the end of each Curve. * - * @generic {Phaser.Math.Vector2} O - [out,$return] + * The result of this method will be cached to avoid recalculating it in subsequent calls. The cache is only invalidated when the {@link #curves} array changes in length, leading to potential inaccuracies if a Curve in the Path is changed, or if a Curve is removed and another is added in its place. * - * @param {number} t - The relative position on the curve, [0..1]. - * @param {Phaser.Math.Vector2} [out] - A vector to store the result in. + * @method Phaser.Curves.Path#getCurveLengths + * @since 3.0.0 * - * @return {Phaser.Math.Vector2} Vector approximating the tangent line at the point t (delta +/- 0.0001) + * @return {number[]} An array containing the length of the Path at the end of each one of its Curves. */ - getTangent: function (t, out) + getCurveLengths: function () { - if (out === undefined) { out = new Vector2(); } - - var delta = 0.0001; - var t1 = t - delta; - var t2 = t + delta; - - // Capping in case of danger + // We use cache values if curves and cache array are same length - if (t1 < 0) + if (this.cacheLengths.length === this.curves.length) { - t1 = 0; + return this.cacheLengths; } - if (t2 > 1) + // Get length of sub-curve + // Push sums into cached array + + var lengths = []; + var sums = 0; + + for (var i = 0; i < this.curves.length; i++) { - t2 = 1; + sums += this.curves[i].getLength(); + + lengths.push(sums); } - this.getPoint(t1, this._tmpVec2A); - this.getPoint(t2, out); + this.cacheLengths = lengths; - return out.subtract(this._tmpVec2A).normalize(); + return lengths; }, /** - * Get a unit vector tangent at a relative position on the curve, by arc length. - * - * @method Phaser.Curves.Curve#getTangentAt - * @since 3.0.0 + * Returns the Curve that forms the Path at the given normalized location (between 0 and 1). * - * @generic {Phaser.Math.Vector2} O - [out,$return] + * @method Phaser.Curves.Path#getCurveAt + * @since 3.60.0 * - * @param {number} u - The relative position on the curve, [0..1]. - * @param {Phaser.Math.Vector2} [out] - A vector to store the result in. + * @param {number} t - The normalized location on the Path, between 0 and 1. * - * @return {Phaser.Math.Vector2} The tangent vector. + * @return {?Phaser.Curves.Curve} The Curve that is part of this Path at a given location, or `null` if no curve was found. */ - getTangentAt: function (u, out) + getCurveAt: function (t) { - var t = this.getUtoTmapping(u); + var d = t * this.getLength(); + var curveLengths = this.getCurveLengths(); + var i = 0; - return this.getTangent(t, out); + while (i < curveLengths.length) + { + if (curveLengths[i] >= d) + { + return this.curves[i]; + } + + i++; + } + + return null; }, /** - * Given a distance in pixels, get a t to find p. + * Returns the ending point of the Path. * - * @method Phaser.Curves.Curve#getTFromDistance + * A Path's ending point is equivalent to the ending point of the last Curve in the Path. For an empty Path, the ending point is at the Path's defined {@link #startPoint}. + * + * @method Phaser.Curves.Path#getEndPoint * @since 3.0.0 * - * @param {number} distance - The distance, in pixels. - * @param {number} [divisions] - Optional amount of divisions. + * @generic {Phaser.Math.Vector2} O - [out,$return] * - * @return {number} The distance. + * @param {Phaser.Math.Vector2} [out] - The object to store the point in. + * + * @return {Phaser.Math.Vector2} The modified `out` object, or a new Vector2 if none was provided. */ - getTFromDistance: function (distance, divisions) + getEndPoint: function (out) { - if (distance <= 0) + if (out === undefined) { out = new Vector2(); } + + if (this.curves.length > 0) { - return 0; + this.curves[this.curves.length - 1].getPoint(1, out); + } + else + { + out.copy(this.startPoint); } - return this.getUtoTmapping(0, distance, divisions); + return out; }, /** - * Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant. + * Returns the total length of the Path. * - * @method Phaser.Curves.Curve#getUtoTmapping - * @since 3.0.0 + * @see {@link #getCurveLengths} * - * @param {number} u - A float between 0 and 1. - * @param {number} distance - The distance, in pixels. - * @param {number} [divisions] - Optional amount of divisions. + * @method Phaser.Curves.Path#getLength + * @since 3.0.0 * - * @return {number} The equidistant value. + * @return {number} The total length of the Path. */ - getUtoTmapping: function (u, distance, divisions) + getLength: function () { - var arcLengths = this.getLengths(divisions); + var lens = this.getCurveLengths(); - var i = 0; - var il = arcLengths.length; + return lens[lens.length - 1]; + }, - var targetArcLength; // The targeted u distance value to get + // To get accurate point with reference to + // entire path distance at time t, + // following has to be done: - if (distance) - { - // Cannot overshoot the curve - targetArcLength = Math.min(distance, arcLengths[il - 1]); - } - else - { - targetArcLength = u * arcLengths[il - 1]; - } + // 1. Length of each sub path have to be known + // 2. Locate and identify type of curve + // 3. Get t for the curve + // 4. Return curve.getPointAt(t') - // binary search for the index with largest value smaller than target u distance + /** + * Calculates the coordinates of the point at the given normalized location (between 0 and 1) on the Path. + * + * The location is relative to the entire Path, not to an individual Curve. A location of 0.5 is always in the middle of the Path and is thus an equal distance away from both its starting and ending points. In a Path with one Curve, it would be in the middle of the Curve; in a Path with two Curves, it could be anywhere on either one of them depending on their lengths. + * + * @method Phaser.Curves.Path#getPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The location of the point to return, between 0 and 1. + * @param {Phaser.Math.Vector2} [out] - The object in which to store the calculated point. + * + * @return {?Phaser.Math.Vector2} The modified `out` object, or a new `Vector2` if none was provided. + */ + getPoint: function (t, out) + { + if (out === undefined) { out = new Vector2(); } - var low = 0; - var high = il - 1; - var comparison; + var d = t * this.getLength(); + var curveLengths = this.getCurveLengths(); + var i = 0; - while (low <= high) + while (i < curveLengths.length) { - i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats + if (curveLengths[i] >= d) + { + var diff = curveLengths[i] - d; + var curve = this.curves[i]; - comparison = arcLengths[i] - targetArcLength; + var segmentLength = curve.getLength(); + var u = (segmentLength === 0) ? 0 : 1 - diff / segmentLength; - if (comparison < 0) - { - low = i + 1; - } - else if (comparison > 0) - { - high = i - 1; - } - else - { - high = i; - break; + return curve.getPointAt(u, out); } - } - - i = high; - if (arcLengths[i] === targetArcLength) - { - return i / (il - 1); + i++; } - // we could get finer grain at lengths, or use simple interpolation between two points - - var lengthBefore = arcLengths[i]; - var lengthAfter = arcLengths[i + 1]; - - var segmentLength = lengthAfter - lengthBefore; - - // determine where we are between the 'before' and 'after' points - - var segmentFraction = (targetArcLength - lengthBefore) / segmentLength; - - // add that fractional amount to t - - return (i + segmentFraction) / (il - 1); + // loop where sum != 0, sum > d , sum+1 - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Loader.Events - */ - -module.exports = { - - ADD: __webpack_require__(968), - COMPLETE: __webpack_require__(969), - FILE_COMPLETE: __webpack_require__(970), - FILE_KEY_COMPLETE: __webpack_require__(971), - FILE_LOAD_ERROR: __webpack_require__(972), - FILE_LOAD: __webpack_require__(973), - FILE_PROGRESS: __webpack_require__(974), - POST_PROCESS: __webpack_require__(975), - PROGRESS: __webpack_require__(976), - START: __webpack_require__(977) + if (divisions === undefined) { divisions = 12; } -}; + var points = []; + var last; + for (var i = 0; i < this.curves.length; i++) + { + var curve = this.curves[i]; -/***/ }), -/* 96 */ -/***/ (function(module, exports, __webpack_require__) { + if (!curve.active) + { + continue; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var resolution = curve.getResolution(divisions); -var Point = __webpack_require__(4); + var pts = curve.getPoints(resolution); -// This is based off an explanation and expanded math presented by Paul Bourke: -// See http:'local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ + for (var j = 0; j < pts.length; j++) + { + var point = pts[j]; -/** - * Checks if two Lines intersect. If the Lines are identical, they will be treated as parallel and thus non-intersecting. - * - * @function Phaser.Geom.Intersects.LineToLine - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line1 - The first Line to check. - * @param {Phaser.Geom.Line} line2 - The second Line to check. - * @param {Phaser.Geom.Point} [out] - A Point in which to optionally store the point of intersection. - * - * @return {boolean} `true` if the two Lines intersect, and the `out` object will be populated, if given. Otherwise, `false`. - */ -var LineToLine = function (line1, line2, out) -{ - if (out === undefined) { out = new Point(); } + if (last && last.equals(point)) + { + // ensures no consecutive points are duplicates + continue; + } - var x1 = line1.x1; - var y1 = line1.y1; - var x2 = line1.x2; - var y2 = line1.y2; + points.push(point); - var x3 = line2.x1; - var y3 = line2.y1; - var x4 = line2.x2; - var y4 = line2.y2; + last = point; + } + } - var numA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3); - var numB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3); - var deNom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); + if (this.autoClose && points.length > 1 && !points[points.length - 1].equals(points[0])) + { + points.push(points[0]); + } - // Make sure there is not a division by zero - this also indicates that the lines are parallel. - // If numA and numB were both equal to zero the lines would be on top of each other (coincidental). - // This check is not done because it is not necessary for this implementation (the parallel check accounts for this). + return points; + }, - if (deNom === 0) + /** + * Returns a randomly chosen point anywhere on the path. This follows the same rules as `getPoint` in that it may return a point on any Curve inside this path. + * + * When calling this method multiple times, the points are not guaranteed to be equally spaced spatially. + * + * @method Phaser.Curves.Path#getRandomPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - `Vector2` instance that should be used for storing the result. If `undefined` a new `Vector2` will be created. + * + * @return {Phaser.Math.Vector2} The modified `out` object, or a new `Vector2` if none was provided. + */ + getRandomPoint: function (out) { - return false; - } - - // Calculate the intermediate fractional point that the lines potentially intersect. - - var uA = numA / deNom; - var uB = numB / deNom; + if (out === undefined) { out = new Vector2(); } - // The fractional point will be between 0 and 1 inclusive if the lines intersect. - // If the fractional calculation is larger than 1 or smaller than 0 the lines would need to be longer to intersect. + return this.getPoint(Math.random(), out); + }, - if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) + /** + * Divides this Path into a set of equally spaced points, + * + * The resulting points are equally spaced with respect to the points' position on the path, but not necessarily equally spaced spatially. + * + * @method Phaser.Curves.Path#getSpacedPoints + * @since 3.0.0 + * + * @param {number} [divisions=40] - The amount of points to divide this Path into. + * + * @return {Phaser.Math.Vector2[]} A list of the points this path was subdivided into. + */ + getSpacedPoints: function (divisions) { - out.x = x1 + (uA * (x2 - x1)); - out.y = y1 + (uA * (y2 - y1)); - - return true; - } - - return false; -}; - -module.exports = LineToLine; - - -/***/ }), -/* 97 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Calculate the angle of the line in radians. - * - * @function Phaser.Geom.Line.Angle - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The line to calculate the angle of. - * - * @return {number} The angle of the line, in radians. - */ -var Angle = function (line) -{ - return Math.atan2(line.y2 - line.y1, line.x2 - line.x1); -}; - -module.exports = Angle; - - -/***/ }), -/* 98 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Clamp = __webpack_require__(18); - -/** - * Return a value based on the range between `min` and `max` and the percentage given. - * - * @function Phaser.Math.FromPercent - * @since 3.0.0 - * - * @param {number} percent - A value between 0 and 1 representing the percentage. - * @param {number} min - The minimum value. - * @param {number} [max] - The maximum value. - * - * @return {number} The value that is `percent` percent between `min` and `max`. - */ -var FromPercent = function (percent, min, max) -{ - percent = Clamp(percent, 0, 1); - - return (max - min) * percent + min; -}; + if (divisions === undefined) { divisions = 40; } -module.exports = FromPercent; + var points = []; + for (var i = 0; i <= divisions; i++) + { + points.push(this.getPoint(i / divisions)); + } -/***/ }), -/* 99 */ -/***/ (function(module, exports) { + if (this.autoClose) + { + points.push(points[0]); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return points; + }, -/** - * Retrieves the value of the given key from an object. - * - * @function Phaser.Tweens.Builders.GetBoolean - * @since 3.0.0 - * - * @param {object} source - The object to retrieve the value from. - * @param {string} key - The key to look for in the `source` object. - * @param {*} defaultValue - The default value to return if the `key` doesn't exist or if no `source` object is provided. - * - * @return {*} The retrieved value. - */ -var GetBoolean = function (source, key, defaultValue) -{ - if (!source) - { - return defaultValue; - } - else if (source.hasOwnProperty(key)) - { - return source[key]; - } - else + /** + * Returns the starting point of the Path. + * + * @method Phaser.Curves.Path#getStartPoint + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Math.Vector2} [out] - `Vector2` instance that should be used for storing the result. If `undefined` a new `Vector2` will be created. + * + * @return {Phaser.Math.Vector2} The modified `out` object, or a new Vector2 if none was provided. + */ + getStartPoint: function (out) { - return defaultValue; - } -}; + if (out === undefined) { out = new Vector2(); } -module.exports = GetBoolean; + return out.copy(this.startPoint); + }, + /** + * Gets a unit vector tangent at a relative position on the path. + * + * @method Phaser.Curves.Path#getTangent + * @since 3.23.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {number} t - The relative position on the path, [0..1]. + * @param {Phaser.Math.Vector2} [out] - A vector to store the result in. + * + * @return {Phaser.Math.Vector2} Vector approximating the tangent line at the point t (delta +/- 0.0001) + */ + getTangent: function (t, out) + { + if (out === undefined) { out = new Vector2(); } -/***/ }), -/* 100 */ -/***/ (function(module, exports) { + var d = t * this.getLength(); + var curveLengths = this.getCurveLengths(); + var i = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + while (i < curveLengths.length) + { + if (curveLengths[i] >= d) + { + var diff = curveLengths[i] - d; + var curve = this.curves[i]; -var TWEEN_CONST = { + var segmentLength = curve.getLength(); + var u = (segmentLength === 0) ? 0 : 1 - diff / segmentLength; - /** - * TweenData state. - * - * @name Phaser.Tweens.CREATED - * @type {number} - * @since 3.0.0 - */ - CREATED: 0, + return curve.getTangentAt(u, out); + } - /** - * TweenData state. - * - * @name Phaser.Tweens.INIT - * @type {number} - * @since 3.0.0 - */ - INIT: 1, + i++; + } - /** - * TweenData state. - * - * @name Phaser.Tweens.DELAY - * @type {number} - * @since 3.0.0 - */ - DELAY: 2, + return null; + }, /** - * TweenData state. - * - * @name Phaser.Tweens.OFFSET_DELAY - * @type {number} + * Creates a line curve from the previous end point to x/y. + * + * @method Phaser.Curves.Path#lineTo * @since 3.0.0 + * + * @param {(number|Phaser.Math.Vector2)} x - The X coordinate of the line's end point, or a `Vector2` containing the entire end point. + * @param {number} [y] - The Y coordinate of the line's end point, if a number was passed as the X parameter. + * + * @return {this} This Path object. */ - OFFSET_DELAY: 3, + lineTo: function (x, y) + { + if (x instanceof Vector2) + { + this._tmpVec2B.copy(x); + } + else + { + this._tmpVec2B.set(x, y); + } - /** - * TweenData state. - * - * @name Phaser.Tweens.PENDING_RENDER - * @type {number} - * @since 3.0.0 - */ - PENDING_RENDER: 4, + var end = this.getEndPoint(this._tmpVec2A); - /** - * TweenData state. - * - * @name Phaser.Tweens.PLAYING_FORWARD - * @type {number} - * @since 3.0.0 - */ - PLAYING_FORWARD: 5, + return this.add(new LineCurve([ end.x, end.y, this._tmpVec2B.x, this._tmpVec2B.y ])); + }, /** - * TweenData state. - * - * @name Phaser.Tweens.PLAYING_BACKWARD - * @type {number} + * Creates a spline curve starting at the previous end point, using the given points on the curve. + * + * @method Phaser.Curves.Path#splineTo * @since 3.0.0 + * + * @param {Phaser.Math.Vector2[]} points - The points the newly created spline curve should consist of. + * + * @return {this} This Path object. */ - PLAYING_BACKWARD: 6, + splineTo: function (points) + { + points.unshift(this.getEndPoint()); - /** - * TweenData state. - * - * @name Phaser.Tweens.HOLD_DELAY - * @type {number} - * @since 3.0.0 - */ - HOLD_DELAY: 7, + return this.add(new SplineCurve(points)); + }, /** - * TweenData state. - * - * @name Phaser.Tweens.REPEAT_DELAY - * @type {number} + * Creates a "gap" in this path from the path's current end point to the given coordinates. + * + * After calling this function, this Path's end point will be equal to the given coordinates + * + * @method Phaser.Curves.Path#moveTo * @since 3.0.0 + * + * @param {(number|Phaser.Math.Vector2)} x - The X coordinate of the position to move the path's end point to, or a `Vector2` containing the entire new end point. + * @param {number} [y] - The Y coordinate of the position to move the path's end point to, if a number was passed as the X coordinate. + * + * @return {this} This Path object. */ - REPEAT_DELAY: 8, + moveTo: function (x, y) + { + if (x instanceof Vector2) + { + return this.add(new MovePathTo(x.x, x.y)); + } + else + { + return this.add(new MovePathTo(x, y)); + } + }, /** - * TweenData state. - * - * @name Phaser.Tweens.COMPLETE - * @type {number} + * Converts this Path to a JSON object containing the path information and its constituent curves. + * + * @method Phaser.Curves.Path#toJSON * @since 3.0.0 + * + * @return {Phaser.Types.Curves.JSONPath} The JSON object containing this path's data. */ - COMPLETE: 9, - - // Tween specific (starts from 20 to cleanly allow extra TweenData consts in the future) + toJSON: function () + { + var out = []; - /** - * Tween state. - * - * @name Phaser.Tweens.PENDING_ADD - * @type {number} - * @since 3.0.0 - */ - PENDING_ADD: 20, + for (var i = 0; i < this.curves.length; i++) + { + out.push(this.curves[i].toJSON()); + } - /** - * Tween state. - * - * @name Phaser.Tweens.PAUSED - * @type {number} - * @since 3.0.0 - */ - PAUSED: 21, + return { + type: 'Path', + x: this.startPoint.x, + y: this.startPoint.y, + autoClose: this.autoClose, + curves: out + }; + }, /** - * Tween state. - * - * @name Phaser.Tweens.LOOP_DELAY - * @type {number} + * cacheLengths must be recalculated. + * + * @method Phaser.Curves.Path#updateArcLengths * @since 3.0.0 */ - LOOP_DELAY: 22, + updateArcLengths: function () + { + this.cacheLengths = []; - /** - * Tween state. - * - * @name Phaser.Tweens.ACTIVE - * @type {number} - * @since 3.0.0 - */ - ACTIVE: 23, + this.getCurveLengths(); + }, /** - * Tween state. - * - * @name Phaser.Tweens.COMPLETE_DELAY - * @type {number} + * Disposes of this Path, clearing its internal references to objects so they can be garbage-collected. + * + * @method Phaser.Curves.Path#destroy * @since 3.0.0 */ - COMPLETE_DELAY: 24, + destroy: function () + { + this.curves.length = 0; + this.cacheLengths.length = 0; + this.startPoint = undefined; + } - /** - * Tween state. - * - * @name Phaser.Tweens.PENDING_REMOVE - * @type {number} - * @since 3.0.0 - */ - PENDING_REMOVE: 25, +}); - /** - * Tween state. - * - * @name Phaser.Tweens.REMOVED - * @type {number} - * @since 3.0.0 - */ - REMOVED: 26 +/** + * Creates a new Path Object. + * + * @method Phaser.GameObjects.GameObjectFactory#path + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Path. + * @param {number} y - The vertical position of this Path. + * + * @return {Phaser.Curves.Path} The Path Object that was created. + */ +GameObjectFactory.register('path', function (x, y) +{ + return new Path(x, y); +}); -}; +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns -module.exports = TWEEN_CONST; +module.exports = Path; /***/ }), -/* 101 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 81078: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Events = __webpack_require__(315); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(35026); /** * @callback DataEachCallback @@ -49518,10 +46973,13 @@ var DataManager = new Class({ * @fires Phaser.Data.Events#CHANGE_DATA_KEY * @since 3.0.0 * - * @param {(string|object)} key - The key to set the value for. Or an object or key value pairs. If an object the `data` argument is ignored. - * @param {*} data - The value to set for the given key. If an object is provided as the key this argument is ignored. + * @generic {any} T + * @genericUse {(string|T)} - [key] + * + * @param {(string|object)} key - The key to set the value for. Or an object of key value pairs. If an object the `data` argument is ignored. + * @param {*} [data] - The value to set for the given key. If an object is provided as the key this argument is ignored. * - * @return {this} This DataManager object. + * @return {this} This Data Manager instance. */ set: function (key, data) { @@ -49556,10 +47014,13 @@ var DataManager = new Class({ * @fires Phaser.Data.Events#CHANGE_DATA_KEY * @since 3.23.0 * + * @generic {any} T + * @genericUse {(string|T)} - [key] + * * @param {(string|object)} key - The key to increase the value for. - * @param {*} [data] - The value to increase for the given key. + * @param {number} [data=1] - The amount to increase the given key by. Pass a negative value to decrease the key. * - * @return {Phaser.Data.DataManager} This DataManager object. + * @return {this} This Data Manager instance. */ inc: function (key, data) { @@ -49574,6 +47035,7 @@ var DataManager = new Class({ } var value = this.get(key); + if (value === undefined) { value = 0; @@ -49595,9 +47057,12 @@ var DataManager = new Class({ * @fires Phaser.Data.Events#CHANGE_DATA_KEY * @since 3.23.0 * + * @generic {any} T + * @genericUse {(string|T)} - [key] + * * @param {(string|object)} key - The key to toggle the value for. * - * @return {Phaser.Data.DataManager} This DataManager object. + * @return {this} This Data Manager instance. */ toggle: function (key) { @@ -49624,7 +47089,7 @@ var DataManager = new Class({ * @param {string} key - The key to set the value for. * @param {*} data - The value to set. * - * @return {this} This DataManager object. + * @return {this} This Data Manager instance. */ setValue: function (key, data) { @@ -49688,7 +47153,7 @@ var DataManager = new Class({ * @param {*} [context] - Value to use as `this` when executing callback. * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data. * - * @return {this} This DataManager object. + * @return {this} This Data Manager instance. */ each: function (callback, context) { @@ -49725,7 +47190,7 @@ var DataManager = new Class({ * @param {Object.} data - The data to merge. * @param {boolean} [overwrite=true] - Whether to overwrite existing data. Defaults to true. * - * @return {this} This DataManager object. + * @return {this} This Data Manager instance. */ merge: function (data, overwrite) { @@ -49761,7 +47226,7 @@ var DataManager = new Class({ * * @param {(string|string[])} key - The key to remove, or an array of keys to remove. * - * @return {this} This DataManager object. + * @return {this} This Data Manager instance. */ remove: function (key) { @@ -49795,7 +47260,7 @@ var DataManager = new Class({ * * @param {string} key - The key to set the value for. * - * @return {this} This DataManager object. + * @return {this} This Data Manager instance. */ removeValue: function (key) { @@ -49867,7 +47332,7 @@ var DataManager = new Class({ * * @param {boolean} value - Whether to freeze or unfreeze the Data Manager. * - * @return {this} This DataManager object. + * @return {this} This Data Manager instance. */ setFreeze: function (value) { @@ -49882,7 +47347,7 @@ var DataManager = new Class({ * @method Phaser.Data.DataManager#reset * @since 3.0.0 * - * @return {this} This DataManager object. + * @return {this} This Data Manager instance. */ reset: function () { @@ -49968,443 +47433,1095 @@ module.exports = DataManager; /***/ }), -/* 102 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 76508: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); - -/** - * @callback EachMapCallback - * - * @param {string} key - The key of the Map entry. - * @param {E} entry - The value of the Map entry. - * - * @return {?boolean} The callback result. - */ +var Class = __webpack_require__(56694); +var DataManager = __webpack_require__(81078); +var PluginCache = __webpack_require__(91963); +var SceneEvents = __webpack_require__(7599); /** * @classdesc - * The keys of a Map can be arbitrary values. - * - * ```javascript - * var map = new Map([ - * [ 1, 'one' ], - * [ 2, 'two' ], - * [ 3, 'three' ] - * ]); - * ``` + * The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin. + * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter, + * or have a property called `events` that is an instance of it. * - * @class Map - * @memberof Phaser.Structs + * @class DataManagerPlugin + * @extends Phaser.Data.DataManager + * @memberof Phaser.Data * @constructor * @since 3.0.0 * - * @generic K - * @generic V - * @genericUse {V[]} - [elements] - * - * @param {Array.<*>} elements - An optional array of key-value pairs to populate this Map with. + * @param {Phaser.Scene} scene - A reference to the Scene that this DataManager belongs to. */ -var Map = new Class({ +var DataManagerPlugin = new Class({ + + Extends: DataManager, initialize: - function Map (elements) + function DataManagerPlugin (scene) { + DataManager.call(this, scene, scene.sys.events); + /** - * The entries in this Map. - * - * @genericUse {Object.} - [$type] + * A reference to the Scene that this DataManager belongs to. * - * @name Phaser.Structs.Map#entries - * @type {Object.} - * @default {} + * @name Phaser.Data.DataManagerPlugin#scene + * @type {Phaser.Scene} * @since 3.0.0 */ - this.entries = {}; + this.scene = scene; /** - * The number of key / value pairs in this Map. + * A reference to the Scene's Systems. * - * @name Phaser.Structs.Map#size - * @type {number} - * @default 0 + * @name Phaser.Data.DataManagerPlugin#systems + * @type {Phaser.Scenes.Systems} * @since 3.0.0 */ - this.size = 0; + this.systems = scene.sys; - if (Array.isArray(elements)) - { - for (var i = 0; i < elements.length; i++) - { - this.set(elements[i][0], elements[i][1]); - } - } + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** - * Adds an element with a specified `key` and `value` to this Map. - * If the `key` already exists, the value will be replaced. - * - * @method Phaser.Structs.Map#set - * @since 3.0.0 - * - * @genericUse {K} - [key] - * @genericUse {V} - [value] - * @genericUse {Phaser.Structs.Map.} - [$return] - * - * @param {string} key - The key of the element to be added to this Map. - * @param {*} value - The value of the element to be added to this Map. + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. * - * @return {Phaser.Structs.Map} This Map object. + * @method Phaser.Data.DataManagerPlugin#boot + * @private + * @since 3.5.1 */ - set: function (key, value) + boot: function () { - if (!this.has(key)) - { - this.size++; - } - - this.entries[key] = value; + this.events = this.systems.events; - return this; + this.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** - * Returns the value associated to the `key`, or `undefined` if there is none. - * - * @method Phaser.Structs.Map#get - * @since 3.0.0 - * - * @genericUse {K} - [key] - * @genericUse {V} - [$return] - * - * @param {string} key - The key of the element to return from the `Map` object. + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. * - * @return {*} The element associated with the specified key or `undefined` if the key can't be found in this Map object. + * @method Phaser.Data.DataManagerPlugin#start + * @private + * @since 3.5.0 */ - get: function (key) + start: function () { - if (this.has(key)) - { - return this.entries[key]; - } + this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * Returns an `Array` of all the values stored in this Map. - * - * @method Phaser.Structs.Map#getArray - * @since 3.0.0 - * - * @genericUse {V[]} - [$return] + * The Scene that owns this plugin is shutting down. + * We need to kill and reset all internal properties as well as stop listening to Scene events. * - * @return {Array.<*>} An array of the values stored in this Map. + * @method Phaser.Data.DataManagerPlugin#shutdown + * @private + * @since 3.5.0 */ - getArray: function () + shutdown: function () { - var output = []; - var entries = this.entries; - - for (var key in entries) - { - output.push(entries[key]); - } - - return output; + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * Returns a boolean indicating whether an element with the specified key exists or not. - * - * @method Phaser.Structs.Map#has - * @since 3.0.0 - * - * @genericUse {K} - [key] - * - * @param {string} key - The key of the element to test for presence of in this Map. + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. * - * @return {boolean} Returns `true` if an element with the specified key exists in this Map, otherwise `false`. + * @method Phaser.Data.DataManagerPlugin#destroy + * @since 3.5.0 */ - has: function (key) + destroy: function () { - return (this.entries.hasOwnProperty(key)); - }, + DataManager.prototype.destroy.call(this); - /** - * Delete the specified element from this Map. - * - * @method Phaser.Structs.Map#delete - * @since 3.0.0 - * - * @genericUse {K} - [key] - * @genericUse {Phaser.Structs.Map.} - [$return] - * - * @param {string} key - The key of the element to delete from this Map. - * - * @return {Phaser.Structs.Map} This Map object. - */ - delete: function (key) - { - if (this.has(key)) - { - delete this.entries[key]; - this.size--; - } + this.events.off(SceneEvents.START, this.start, this); - return this; - }, + this.scene = null; + this.systems = null; + } - /** - * Delete all entries from this Map. - * - * @method Phaser.Structs.Map#clear - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.Map.} - [$return] - * - * @return {Phaser.Structs.Map} This Map object. - */ - clear: function () - { - Object.keys(this.entries).forEach(function (prop) - { - delete this.entries[prop]; +}); - }, this); +PluginCache.register('DataManagerPlugin', DataManagerPlugin, 'data'); - this.size = 0; +module.exports = DataManagerPlugin; - return this; - }, - /** - * Returns all entries keys in this Map. - * - * @method Phaser.Structs.Map#keys - * @since 3.0.0 - * - * @genericUse {K[]} - [$return] - * - * @return {string[]} Array containing entries' keys. - */ - keys: function () - { - return Object.keys(this.entries); - }, +/***/ }), - /** - * Returns an `Array` of all entries. - * - * @method Phaser.Structs.Map#values - * @since 3.0.0 - * - * @genericUse {V[]} - [$return] - * - * @return {Array.<*>} An `Array` of entries. - */ - values: function () - { - var output = []; - var entries = this.entries; +/***/ 73569: +/***/ ((module) => { - for (var key in entries) - { - output.push(entries[key]); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return output; - }, +/** + * The Change Data Event. + * + * This event is dispatched by a Data Manager when an item in the data store is changed. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * a change data event from a Game Object you would use: `sprite.on('changedata', listener)`. + * + * This event is dispatched for all items that change in the Data Manager. + * To listen for the change of a specific item, use the `CHANGE_DATA_KEY_EVENT` event. + * + * @event Phaser.Data.Events#CHANGE_DATA + * @type {string} + * @since 3.0.0 + * + * @param {any} parent - A reference to the object that the Data Manager responsible for this event belongs to. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} value - The new value of the item in the Data Manager. + * @param {any} previousValue - The previous value of the item in the Data Manager. + */ +module.exports = 'changedata'; - /** - * Dumps the contents of this Map to the console via `console.group`. - * - * @method Phaser.Structs.Map#dump - * @since 3.0.0 - */ - dump: function () - { - var entries = this.entries; - // eslint-disable-next-line no-console - console.group('Map'); +/***/ }), - for (var key in entries) - { - console.log(key, entries[key]); - } +/***/ 15590: +/***/ ((module) => { - // eslint-disable-next-line no-console - console.groupEnd(); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Iterates through all entries in this Map, passing each one to the given callback. - * - * If the callback returns `false`, the iteration will break. - * - * @method Phaser.Structs.Map#each - * @since 3.0.0 - * - * @genericUse {EachMapCallback.} - [callback] - * @genericUse {Phaser.Structs.Map.} - [$return] - * - * @param {EachMapCallback} callback - The callback which will receive the keys and entries held in this Map. - * - * @return {Phaser.Structs.Map} This Map object. - */ - each: function (callback) +/** + * The Change Data Key Event. + * + * This event is dispatched by a Data Manager when an item in the data store is changed. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the change of a specific data item from a Game Object you would use: `sprite.on('changedata-key', listener)`, + * where `key` is the unique string key of the data item. For example, if you have a data item stored called `gold` + * then you can listen for `sprite.on('changedata-gold')`. + * + * @event Phaser.Data.Events#CHANGE_DATA_KEY + * @type {string} + * @since 3.16.1 + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {any} value - The item that was updated in the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + * @param {any} previousValue - The previous item that was updated in the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'changedata-'; + + +/***/ }), + +/***/ 37669: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Data Manager Destroy Event. + * + * The Data Manager will listen for the destroy event from its parent, and then close itself down. + * + * @event Phaser.Data.Events#DESTROY + * @type {string} + * @since 3.50.0 + */ +module.exports = 'destroy'; + + +/***/ }), + +/***/ 87090: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Remove Data Event. + * + * This event is dispatched by a Data Manager when an item is removed from it. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the removal of a data item on a Game Object you would use: `sprite.on('removedata', listener)`. + * + * @event Phaser.Data.Events#REMOVE_DATA + * @type {string} + * @since 3.0.0 + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} data - The item that was removed from the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'removedata'; + + +/***/ }), + +/***/ 90142: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Set Data Event. + * + * This event is dispatched by a Data Manager when a new item is added to the data store. + * + * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for + * the addition of a new data item on a Game Object you would use: `sprite.on('setdata', listener)`. + * + * @event Phaser.Data.Events#SET_DATA + * @type {string} + * @since 3.0.0 + * + * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. + * @param {string} key - The unique key of the data item within the Data Manager. + * @param {any} data - The item that was added to the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. + */ +module.exports = 'setdata'; + + +/***/ }), + +/***/ 35026: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Data.Events + */ + +module.exports = { + + CHANGE_DATA: __webpack_require__(73569), + CHANGE_DATA_KEY: __webpack_require__(15590), + DESTROY: __webpack_require__(37669), + REMOVE_DATA: __webpack_require__(87090), + SET_DATA: __webpack_require__(90142) + +}; + + +/***/ }), + +/***/ 1999: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Data + */ + +module.exports = { + + DataManager: __webpack_require__(81078), + DataManagerPlugin: __webpack_require__(76508), + Events: __webpack_require__(35026) + +}; + + +/***/ }), + +/***/ 10720: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Browser = __webpack_require__(1350); + +/** + * Determines the audio playback capabilities of the device running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.audio` from within any Scene. + * + * @typedef {object} Phaser.Device.Audio + * @since 3.0.0 + * + * @property {boolean} audioData - Can this device play HTML Audio tags? + * @property {boolean} dolby - Can this device play EC-3 Dolby Digital Plus files? + * @property {boolean} m4a - Can this device can play m4a files. + * @property {boolean} aac - Can this device can play aac files. + * @property {boolean} flac - Can this device can play flac files. + * @property {boolean} mp3 - Can this device play mp3 files? + * @property {boolean} ogg - Can this device play ogg files? + * @property {boolean} opus - Can this device play opus files? + * @property {boolean} wav - Can this device play wav files? + * @property {boolean} webAudio - Does this device have the Web Audio API? + * @property {boolean} webm - Can this device play webm files? + */ +var Audio = { + + flac: false, + aac: false, + audioData: false, + dolby: false, + m4a: false, + mp3: false, + ogg: false, + opus: false, + wav: false, + webAudio: false, + webm: false + +}; + +function init () +{ + if (typeof importScripts === 'function') { - var entries = this.entries; + return Audio; + } - for (var key in entries) + Audio.audioData = !!(window['Audio']); + + Audio.webAudio = !!(window['AudioContext'] || window['webkitAudioContext']); + + var audioElement = document.createElement('audio'); + var result = !!audioElement.canPlayType; + + try + { + if (result) { - if (callback(key, entries[key]) === false) + var CanPlay = function (type1, type2) { - break; + var canPlayType1 = audioElement.canPlayType('audio/' + type1).replace(/^no$/, ''); + + if (type2) + { + return Boolean(canPlayType1 || audioElement.canPlayType('audio/' + type2).replace(/^no$/, '')); + } + else + { + return Boolean(canPlayType1); + } + }; + + // wav Mimetypes accepted: + // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements + + Audio.ogg = CanPlay('ogg; codecs="vorbis"'); + Audio.opus = CanPlay('ogg; codecs="opus"', 'opus'); + Audio.mp3 = CanPlay('mpeg'); + Audio.wav = CanPlay('wav'); + Audio.m4a = CanPlay('x-m4a'); + Audio.aac = CanPlay('aac'); + Audio.flac = CanPlay('flac', 'x-flac'); + Audio.webm = CanPlay('webm; codecs="vorbis"'); + + if (audioElement.canPlayType('audio/mp4; codecs="ec-3"') !== '') + { + if (Browser.edge) + { + Audio.dolby = true; + } + else if (Browser.safari && Browser.safariVersion >= 9) + { + if ((/Mac OS X (\d+)_(\d+)/).test(navigator.userAgent)) + { + var major = parseInt(RegExp.$1, 10); + var minor = parseInt(RegExp.$2, 10); + + if ((major === 10 && minor >= 11) || major > 10) + { + Audio.dolby = true; + } + } + } } } + } + catch (e) + { + // Nothing to do here + } - return this; - }, + return Audio; +} - /** - * Returns `true` if the value exists within this Map. Otherwise, returns `false`. - * - * @method Phaser.Structs.Map#contains - * @since 3.0.0 - * - * @genericUse {V} - [value] - * - * @param {*} value - The value to search for. - * - * @return {boolean} `true` if the value is found, otherwise `false`. - */ - contains: function (value) +module.exports = init(); + + +/***/ }), + +/***/ 1350: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var OS = __webpack_require__(36580); + +/** + * Determines the browser type and version running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.browser` from within any Scene. + * + * @typedef {object} Phaser.Device.Browser + * @since 3.0.0 + * + * @property {boolean} chrome - Set to true if running in Chrome. + * @property {boolean} edge - Set to true if running in Microsoft Edge browser. + * @property {boolean} firefox - Set to true if running in Firefox. + * @property {boolean} ie - Set to true if running in Internet Explorer 11 or less (not Edge). + * @property {boolean} mobileSafari - Set to true if running in Mobile Safari. + * @property {boolean} opera - Set to true if running in Opera. + * @property {boolean} safari - Set to true if running in Safari. + * @property {boolean} silk - Set to true if running in the Silk browser (as used on the Amazon Kindle) + * @property {boolean} trident - Set to true if running a Trident version of Internet Explorer (IE11+) + * @property {number} chromeVersion - If running in Chrome this will contain the major version number. + * @property {number} firefoxVersion - If running in Firefox this will contain the major version number. + * @property {number} ieVersion - If running in Internet Explorer this will contain the major version number. Beyond IE10 you should use Browser.trident and Browser.tridentVersion. + * @property {number} safariVersion - If running in Safari this will contain the major version number. + * @property {number} tridentVersion - If running in Internet Explorer 11 this will contain the major version number. See {@link http://msdn.microsoft.com/en-us/library/ie/ms537503(v=vs.85).aspx} + */ +var Browser = { + + chrome: false, + chromeVersion: 0, + edge: false, + firefox: false, + firefoxVersion: 0, + ie: false, + ieVersion: 0, + mobileSafari: false, + opera: false, + safari: false, + safariVersion: 0, + silk: false, + trident: false, + tridentVersion: 0, + es2019: false + +}; + +function init () +{ + var ua = navigator.userAgent; + + if ((/Edg\/\d+/).test(ua)) { - var entries = this.entries; + Browser.edge = true; + Browser.es2019 = true; + } + else if ((/OPR/).test(ua)) + { + Browser.opera = true; + Browser.es2019 = true; + } + else if ((/Chrome\/(\d+)/).test(ua) && !OS.windowsPhone) + { + Browser.chrome = true; + Browser.chromeVersion = parseInt(RegExp.$1, 10); + Browser.es2019 = (Browser.chromeVersion > 69); + } + else if ((/Firefox\D+(\d+)/).test(ua)) + { + Browser.firefox = true; + Browser.firefoxVersion = parseInt(RegExp.$1, 10); + Browser.es2019 = (Browser.firefoxVersion > 10); + } + else if ((/AppleWebKit/).test(ua) && OS.iOS) + { + Browser.mobileSafari = true; + } + else if ((/MSIE (\d+\.\d+);/).test(ua)) + { + Browser.ie = true; + Browser.ieVersion = parseInt(RegExp.$1, 10); + } + else if ((/Version\/(\d+\.\d+) Safari/).test(ua) && !OS.windowsPhone) + { + Browser.safari = true; + Browser.safariVersion = parseInt(RegExp.$1, 10); + Browser.es2019 = (Browser.safariVersion > 10); + } + else if ((/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/).test(ua)) + { + Browser.ie = true; + Browser.trident = true; + Browser.tridentVersion = parseInt(RegExp.$1, 10); + Browser.ieVersion = parseInt(RegExp.$3, 10); + } - for (var key in entries) + // Silk gets its own if clause because its ua also contains 'Safari' + if ((/Silk/).test(ua)) + { + Browser.silk = true; + } + + return Browser; +} + +module.exports = init(); + + +/***/ }), + +/***/ 98581: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CanvasPool = __webpack_require__(61068); + +/** + * Determines the canvas features of the browser running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.canvasFeatures` from within any Scene. + * + * @typedef {object} Phaser.Device.CanvasFeatures + * @since 3.0.0 + * + * @property {boolean} supportInverseAlpha - Set to true if the browser supports inversed alpha. + * @property {boolean} supportNewBlendModes - Set to true if the browser supports new canvas blend modes. + */ +var CanvasFeatures = { + + supportInverseAlpha: false, + supportNewBlendModes: false + +}; + +function checkBlendMode () +{ + var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; + var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; + + var magenta = new Image(); + + magenta.onload = function () + { + var yellow = new Image(); + + yellow.onload = function () { - if (entries[key] === value) + var canvas = CanvasPool.create2D(yellow, 6); + var context = canvas.getContext('2d', { willReadFrequently: true }); + + context.globalCompositeOperation = 'multiply'; + + context.drawImage(magenta, 0, 0); + context.drawImage(yellow, 2, 0); + + if (!context.getImageData(2, 0, 1, 1)) { - return true; + return false; } - } + var data = context.getImageData(2, 0, 1, 1).data; + + CanvasPool.remove(yellow); + + CanvasFeatures.supportNewBlendModes = (data[0] === 255 && data[1] === 0 && data[2] === 0); + }; + + yellow.src = pngHead + '/wCKxvRF' + pngEnd; + }; + + magenta.src = pngHead + 'AP804Oa6' + pngEnd; + + return false; +} + +function checkInverseAlpha () +{ + var canvas = CanvasPool.create2D(this, 2); + var context = canvas.getContext('2d', { willReadFrequently: true }); + + context.fillStyle = 'rgba(10, 20, 30, 0.5)'; + + // Draw a single pixel + context.fillRect(0, 0, 1, 1); + + // Get the color values + var s1 = context.getImageData(0, 0, 1, 1); + + if (s1 === null) + { return false; - }, + } - /** - * Merges all new keys from the given Map into this one. - * If it encounters a key that already exists it will be skipped unless override is set to `true`. - * - * @method Phaser.Structs.Map#merge - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.Map.} - [map,$return] - * - * @param {Phaser.Structs.Map} map - The Map to merge in to this Map. - * @param {boolean} [override=false] - Set to `true` to replace values in this Map with those from the source map, or `false` to skip them. - * - * @return {Phaser.Structs.Map} This Map object. - */ - merge: function (map, override) + // Plot them to x2 + context.putImageData(s1, 1, 0); + + // Get those values + var s2 = context.getImageData(1, 0, 1, 1); + + var result = (s2.data[0] === s1.data[0] && s2.data[1] === s1.data[1] && s2.data[2] === s1.data[2] && s2.data[3] === s1.data[3]); + + CanvasPool.remove(this); + + // Compare and return + return result; +} + +function init () +{ + if (typeof importScripts !== 'function' && document !== undefined) { - if (override === undefined) { override = false; } + CanvasFeatures.supportNewBlendModes = checkBlendMode(); + CanvasFeatures.supportInverseAlpha = checkInverseAlpha(); + } - var local = this.entries; - var source = map.entries; + return CanvasFeatures; +} - for (var key in source) +module.exports = init(); + + +/***/ }), + +/***/ 90185: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var OS = __webpack_require__(36580); +var Browser = __webpack_require__(1350); +var CanvasPool = __webpack_require__(61068); + +/** + * Determines the features of the browser running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.features` from within any Scene. + * + * @typedef {object} Phaser.Device.Features + * @since 3.0.0 + * + * @property {boolean} canvas - Is canvas available? + * @property {?boolean} canvasBitBltShift - True if canvas supports a 'copy' bitblt onto itself when the source and destination regions overlap. + * @property {boolean} file - Is file available? + * @property {boolean} fileSystem - Is fileSystem available? + * @property {boolean} getUserMedia - Does the device support the getUserMedia API? + * @property {boolean} littleEndian - Is the device big or little endian? (only detected if the browser supports TypedArrays) + * @property {boolean} localStorage - Is localStorage available? + * @property {boolean} pointerLock - Is Pointer Lock available? + * @property {boolean} stableSort - Is Array.sort stable? + * @property {boolean} support32bit - Does the device context support 32bit pixel manipulation using array buffer views? + * @property {boolean} vibration - Does the device support the Vibration API? + * @property {boolean} webGL - Is webGL available? + * @property {boolean} worker - Is worker available? + */ +var Features = { + + canvas: false, + canvasBitBltShift: null, + file: false, + fileSystem: false, + getUserMedia: true, + littleEndian: false, + localStorage: false, + pointerLock: false, + stableSort: false, + support32bit: false, + vibration: false, + webGL: false, + worker: false + +}; + +// Check Little or Big Endian system. +// @author Matt DesLauriers (@mattdesl) +function checkIsLittleEndian () +{ + var a = new ArrayBuffer(4); + var b = new Uint8Array(a); + var c = new Uint32Array(a); + + b[0] = 0xa1; + b[1] = 0xb2; + b[2] = 0xc3; + b[3] = 0xd4; + + if (c[0] === 0xd4c3b2a1) + { + return true; + } + + if (c[0] === 0xa1b2c3d4) + { + return false; + } + else + { + // Could not determine endianness + return null; + } +} + +function init () +{ + if (typeof importScripts === 'function') + { + return Features; + } + + Features.canvas = !!window['CanvasRenderingContext2D']; + + try + { + Features.localStorage = !!localStorage.getItem; + } + catch (error) + { + Features.localStorage = false; + } + + Features.file = !!window['File'] && !!window['FileReader'] && !!window['FileList'] && !!window['Blob']; + Features.fileSystem = !!window['requestFileSystem']; + + var isUint8 = false; + + var testWebGL = function () + { + if (window['WebGLRenderingContext']) { - if (local.hasOwnProperty(key) && override) + try { - local[key] = source[key]; + var canvas = CanvasPool.createWebGL(this); + + var ctx = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); + + var canvas2D = CanvasPool.create2D(this); + + var ctx2D = canvas2D.getContext('2d', { willReadFrequently: true }); + + // Can't be done on a webgl context + var image = ctx2D.createImageData(1, 1); + + // Test to see if ImageData uses CanvasPixelArray or Uint8ClampedArray. + // @author Matt DesLauriers (@mattdesl) + isUint8 = image.data instanceof Uint8ClampedArray; + + CanvasPool.remove(canvas); + CanvasPool.remove(canvas2D); + + return !!ctx; } - else + catch (e) { - this.set(key, source[key]); + return false; } } - return this; + return false; + }; + + Features.webGL = testWebGL(); + + Features.worker = !!window['Worker']; + + Features.pointerLock = 'pointerLockElement' in document || 'mozPointerLockElement' in document || 'webkitPointerLockElement' in document; + + navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia; + + window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL; + + Features.getUserMedia = Features.getUserMedia && !!navigator.getUserMedia && !!window.URL; + + // Older versions of firefox (< 21) apparently claim support but user media does not actually work + if (Browser.firefox && Browser.firefoxVersion < 21) + { + Features.getUserMedia = false; } -}); + // Excludes iOS versions as they generally wrap UIWebView (eg. Safari WebKit) and it + // is safer to not try and use the fast copy-over method. + if (!OS.iOS && (Browser.ie || Browser.firefox || Browser.chrome)) + { + Features.canvasBitBltShift = true; + } -module.exports = Map; + // Known not to work + if (Browser.safari || Browser.mobileSafari) + { + Features.canvasBitBltShift = false; + } + + navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate; + + if (navigator.vibrate) + { + Features.vibration = true; + } + + if (typeof ArrayBuffer !== 'undefined' && typeof Uint8Array !== 'undefined' && typeof Uint32Array !== 'undefined') + { + Features.littleEndian = checkIsLittleEndian(); + } + + Features.support32bit = ( + typeof ArrayBuffer !== 'undefined' && + typeof Uint8ClampedArray !== 'undefined' && + typeof Int32Array !== 'undefined' && + Features.littleEndian !== null && + isUint8 + ); + + return Features; +} + +module.exports = init(); /***/ }), -/* 103 */ -/***/ (function(module, exports) { + +/***/ 33553: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Given 3 separate color values this will return an integer representation of it. + * Determines the full screen support of the browser running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.fullscreen` from within any Scene. * - * @function Phaser.Display.Color.GetColor + * @typedef {object} Phaser.Device.Fullscreen * @since 3.0.0 * - * @param {number} red - The red color value. A number between 0 and 255. - * @param {number} green - The green color value. A number between 0 and 255. - * @param {number} blue - The blue color value. A number between 0 and 255. - * - * @return {number} The combined color value. + * @property {boolean} available - Does the browser support the Full Screen API? + * @property {boolean} keyboard - Does the browser support access to the Keyboard during Full Screen mode? + * @property {string} cancel - If the browser supports the Full Screen API this holds the call you need to use to cancel it. + * @property {string} request - If the browser supports the Full Screen API this holds the call you need to use to activate it. */ -var GetColor = function (red, green, blue) -{ - return red << 16 | green << 8 | blue; +var Fullscreen = { + + available: false, + cancel: '', + keyboard: false, + request: '' + }; -module.exports = GetColor; +/** +* Checks for support of the Full Screen API. +* +* @ignore +*/ +function init () +{ + if (typeof importScripts === 'function') + { + return Fullscreen; + } + + var i; + + var suffix1 = 'Fullscreen'; + var suffix2 = 'FullScreen'; + + var fs = [ + 'request' + suffix1, + 'request' + suffix2, + 'webkitRequest' + suffix1, + 'webkitRequest' + suffix2, + 'msRequest' + suffix1, + 'msRequest' + suffix2, + 'mozRequest' + suffix2, + 'mozRequest' + suffix1 + ]; + + for (i = 0; i < fs.length; i++) + { + if (document.documentElement[fs[i]]) + { + Fullscreen.available = true; + Fullscreen.request = fs[i]; + break; + } + } + + var cfs = [ + 'cancel' + suffix2, + 'exit' + suffix1, + 'webkitCancel' + suffix2, + 'webkitExit' + suffix1, + 'msCancel' + suffix2, + 'msExit' + suffix1, + 'mozCancel' + suffix2, + 'mozExit' + suffix1 + ]; + + if (Fullscreen.available) + { + for (i = 0; i < cfs.length; i++) + { + if (document[cfs[i]]) + { + Fullscreen.cancel = cfs[i]; + break; + } + } + } + + // Keyboard Input? + // Safari 5.1 says it supports fullscreen keyboard, but is lying. + if (window['Element'] && Element['ALLOW_KEYBOARD_INPUT'] && !(/ Version\/5\.1(?:\.\d+)? Safari\//).test(navigator.userAgent)) + { + Fullscreen.keyboard = true; + } + + Object.defineProperty(Fullscreen, 'active', { get: function () { return !!(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement); } }); + + return Fullscreen; +} + +module.exports = init(); /***/ }), -/* 104 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 95872: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Browser = __webpack_require__(1350); + /** - * @namespace Phaser.Scale.Events + * Determines the input support of the browser running this Phaser Game instance. + * These values are read-only and populated during the boot sequence of the game. + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.input` from within any Scene. + * + * @typedef {object} Phaser.Device.Input + * @since 3.0.0 + * + * @property {?string} wheelType - The newest type of Wheel/Scroll event supported: 'wheel', 'mousewheel', 'DOMMouseScroll' + * @property {boolean} gamepads - Is navigator.getGamepads available? + * @property {boolean} mspointer - Is mspointer available? + * @property {boolean} touch - Is touch available? */ +var Input = { -module.exports = { - - ENTER_FULLSCREEN: __webpack_require__(800), - FULLSCREEN_FAILED: __webpack_require__(801), - FULLSCREEN_UNSUPPORTED: __webpack_require__(802), - LEAVE_FULLSCREEN: __webpack_require__(803), - ORIENTATION_CHANGE: __webpack_require__(804), - RESIZE: __webpack_require__(805) + gamepads: false, + mspointer: false, + touch: false, + wheelEvent: null }; +function init () +{ + if (typeof importScripts === 'function') + { + return Input; + } + + if ('ontouchstart' in document.documentElement || (navigator.maxTouchPoints && navigator.maxTouchPoints >= 1)) + { + Input.touch = true; + } + + if (navigator.msPointerEnabled || navigator.pointerEnabled) + { + Input.mspointer = true; + } + + if (navigator.getGamepads) + { + Input.gamepads = true; + } + + // See https://developer.mozilla.org/en-US/docs/Web/Events/wheel + if ('onwheel' in window || (Browser.ie && 'WheelEvent' in window)) + { + // DOM3 Wheel Event: FF 17+, IE 9+, Chrome 31+, Safari 7+ + Input.wheelEvent = 'wheel'; + } + else if ('onmousewheel' in window) + { + // Non-FF legacy: IE 6-9, Chrome 1-31, Safari 5-7. + Input.wheelEvent = 'mousewheel'; + } + else if (Browser.firefox && 'MouseScrollEvent' in window) + { + // FF prior to 17. This should probably be scrubbed. + Input.wheelEvent = 'DOMMouseScroll'; + } + + return Input; +} + +module.exports = init(); + /***/ }), -/* 105 */ -/***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(process) {/** +/***/ 36580: +/***/ ((module) => { + +/** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ @@ -50589,14432 +48706,13473 @@ function init () module.exports = init(); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(807))) /***/ }), -/* 106 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 53861: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var GetFastValue = __webpack_require__(72632); + /** - * @namespace Phaser.Textures.Events + * Determines the video support of the browser running this Phaser Game instance. + * + * These values are read-only and populated during the boot sequence of the game. + * + * They are then referenced by internal game systems and are available for you to access + * via `this.sys.game.device.video` from within any Scene. + * + * In Phaser 3.20 the properties were renamed to drop the 'Video' suffix. + * + * @typedef {object} Phaser.Device.Video + * @since 3.0.0 + * + * @property {boolean} h264 - Can this device play h264 mp4 video files? + * @property {boolean} hls - Can this device play hls video files? + * @property {boolean} mp4 - Can this device play h264 mp4 video files? + * @property {boolean} m4v - Can this device play m4v (typically mp4) video files? + * @property {boolean} ogg - Can this device play ogg video files? + * @property {boolean} vp9 - Can this device play vp9 video files? + * @property {boolean} webm - Can this device play webm video files? + * @property {function} getVideoURL - Returns the first video URL that can be played by this browser. */ +var Video = { -module.exports = { - - ADD: __webpack_require__(861), - ERROR: __webpack_require__(862), - LOAD: __webpack_require__(863), - READY: __webpack_require__(864), - REMOVE: __webpack_require__(865) + h264: false, + hls: false, + mp4: false, + m4v: false, + ogg: false, + vp9: false, + webm: false, + hasRequestVideoFrame: false }; +function init () +{ + if (typeof importScripts === 'function') + { + return Video; + } -/***/ }), -/* 107 */ -/***/ (function(module, exports) { + var videoElement = document.createElement('video'); + var result = !!videoElement.canPlayType; + var no = /^no$/; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + try + { + if (result) + { + if (videoElement.canPlayType('video/ogg; codecs="theora"').replace(no, '')) + { + Video.ogg = true; + } -var WEBGL_CONST = { + if (videoElement.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(no, '')) + { + // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546 + Video.h264 = true; + Video.mp4 = true; + } - /** - * 8-bit twos complement signed integer. - * - * @name Phaser.Renderer.WebGL.BYTE - * @type {Phaser.Types.Renderer.WebGL.WebGLConst} - * @since 3.50.0 - */ - BYTE: { enum: 0x1400, size: 1 }, + if (videoElement.canPlayType('video/x-m4v').replace(no, '')) + { + Video.m4v = true; + } - /** - * 8-bit twos complement unsigned integer. - * - * @name Phaser.Renderer.WebGL.UNSIGNED_BYTE - * @type {Phaser.Types.Renderer.WebGL.WebGLConst} - * @since 3.50.0 - */ - UNSIGNED_BYTE: { enum: 0x1401, size: 1 }, + if (videoElement.canPlayType('video/webm; codecs="vp8, vorbis"').replace(no, '')) + { + Video.webm = true; + } - /** - * 16-bit twos complement signed integer. - * - * @name Phaser.Renderer.WebGL.SHORT - * @type {Phaser.Types.Renderer.WebGL.WebGLConst} - * @since 3.50.0 - */ - SHORT: { enum: 0x1402, size: 2 }, + if (videoElement.canPlayType('video/webm; codecs="vp9"').replace(no, '')) + { + Video.vp9 = true; + } - /** - * 16-bit twos complement unsigned integer. - * - * @name Phaser.Renderer.WebGL.UNSIGNED_SHORT - * @type {Phaser.Types.Renderer.WebGL.WebGLConst} - * @since 3.50.0 - */ - UNSIGNED_SHORT: { enum: 0x1403, size: 2 }, + if (videoElement.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(no, '')) + { + Video.hls = true; + } + } + } + catch (e) + { + // Nothing to do + } - /** - * 32-bit twos complement signed integer. - * - * @name Phaser.Renderer.WebGL.INT - * @type {Phaser.Types.Renderer.WebGL.WebGLConst} - * @since 3.50.0 - */ - INT: { enum: 0x1404, size: 4 }, + if (videoElement.parentNode) + { + videoElement.parentNode.removeChild(videoElement); + } - /** - * 32-bit twos complement unsigned integer. - * - * @name Phaser.Renderer.WebGL.UNSIGNED_INT - * @type {Phaser.Types.Renderer.WebGL.WebGLConst} - * @since 3.50.0 - */ - UNSIGNED_INT: { enum: 0x1405, size: 4 }, + Video.getVideoURL = function (urls) + { + if (!Array.isArray(urls)) + { + urls = [ urls ]; + } - /** - * 32-bit IEEE floating point number. - * - * @name Phaser.Renderer.WebGL.FLOAT - * @type {Phaser.Types.Renderer.WebGL.WebGLConst} - * @since 3.50.0 - */ - FLOAT: { enum: 0x1406, size: 4 } + for (var i = 0; i < urls.length; i++) + { + var url = GetFastValue(urls[i], 'url', urls[i]); -}; + if (url.indexOf('blob:') === 0) + { + return { + url: url, + type: '' + }; + } -module.exports = WEBGL_CONST; + var videoType; + + if (url.indexOf('data:') === 0) + { + videoType = url.split(',')[0].match(/\/(.*?);/); + } + else + { + videoType = url.match(/\.([a-zA-Z0-9]+)($|\?)/); + } + + videoType = GetFastValue(urls[i], 'type', (videoType) ? videoType[1] : '').toLowerCase(); + + if (Video[videoType]) + { + return { + url: url, + type: videoType + }; + } + } + + return null; + }; + + return Video; +} + +module.exports = init(); /***/ }), -/* 108 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 77290: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Earcut = __webpack_require__(59); -var GetFastValue = __webpack_require__(2); -var ShaderSourceFS = __webpack_require__(878); -var ShaderSourceVS = __webpack_require__(879); -var TransformMatrix = __webpack_require__(25); -var Utils = __webpack_require__(12); -var WEBGL_CONST = __webpack_require__(107); -var WebGLPipeline = __webpack_require__(58); +// This singleton is instantiated as soon as Phaser loads, +// before a Phaser.Game instance has even been created. +// Which means all instances of Phaser Games can share it, +// without having to re-poll the device all over again /** - * @classdesc - * The Multi Pipeline is the core 2D texture rendering pipeline used by Phaser in WebGL. - * Virtually all Game Objects use this pipeline by default, including Sprites, Graphics - * and Tilemaps. It handles the batching of quads and tris, as well as methods for - * drawing and batching geometry data. - * - * Prior to Phaser v3.50 this pipeline was called the `TextureTintPipeline`. - * - * In previous versions of Phaser only one single texture unit was supported at any one time. - * The Multi Pipeline is an evolution of the old Texture Tint Pipeline, updated to support - * multi-textures for increased performance. - * - * The fragment shader it uses can be found in `shaders/src/Multi.frag`. - * The vertex shader it uses can be found in `shaders/src/Multi.vert`. - * - * The default shader attributes for this pipeline are: - * - * `inPosition` (vec2, offset 0) - * `inTexCoord` (vec2, offset 8) - * `inTexId` (float, offset 16) - * `inTintEffect` (float, offset 20) - * `inTint` (vec4, offset 24, normalized) - * - * The default shader uniforms for this pipeline are: - * - * `uProjectionMatrix` (mat4) - * `uMainSampler` (sampler2D array) - * - * If you wish to create a custom pipeline extending from this one, you can use two string - * declarations in your fragment shader source: `%count%` and `%forloop%`, where `count` is - * used to set the number of `sampler2Ds` available, and `forloop` is a block of GLSL code - * that will get the currently bound texture unit. - * - * This pipeline will automatically inject that code for you, should those values exist - * in your shader source. If you wish to handle this yourself, you can also use the - * function `Utils.parseFragmentShaderMaxTextures`. - * - * If you wish to create a pipeline that works from a single texture, or that doesn't have - * internal texture iteration, please see the `SinglePipeline` instead. - * - * @class MultiPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines - * @constructor - * @since 3.50.0 + * @namespace Phaser.Device + * @since 3.0.0 + */ + +/** + * @typedef {object} Phaser.DeviceConf * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + * @property {Phaser.Device.OS} os - The OS Device functions. + * @property {Phaser.Device.Browser} browser - The Browser Device functions. + * @property {Phaser.Device.Features} features - The Features Device functions. + * @property {Phaser.Device.Input} input - The Input Device functions. + * @property {Phaser.Device.Audio} audio - The Audio Device functions. + * @property {Phaser.Device.Video} video - The Video Device functions. + * @property {Phaser.Device.Fullscreen} fullscreen - The Fullscreen Device functions. + * @property {Phaser.Device.CanvasFeatures} canvasFeatures - The Canvas Device functions. */ -var MultiPipeline = new Class({ - Extends: WebGLPipeline, +module.exports = { - initialize: + os: __webpack_require__(36580), + browser: __webpack_require__(1350), + features: __webpack_require__(90185), + input: __webpack_require__(95872), + audio: __webpack_require__(10720), + video: __webpack_require__(53861), + fullscreen: __webpack_require__(33553), + canvasFeatures: __webpack_require__(98581) - function MultiPipeline (config) - { - var renderer = config.game.renderer; +}; - var fragmentShaderSource = GetFastValue(config, 'fragShader', ShaderSourceFS); - config.fragShader = Utils.parseFragmentShaderMaxTextures(fragmentShaderSource, renderer.maxTextures); - config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); - config.attributes = GetFastValue(config, 'attributes', [ - { - name: 'inPosition', - size: 2 - }, - { - name: 'inTexCoord', - size: 2 - }, - { - name: 'inTexId' - }, - { - name: 'inTintEffect' - }, - { - name: 'inTint', - size: 4, - type: WEBGL_CONST.UNSIGNED_BYTE, - normalized: true - } - ]); +/***/ }), - WebGLPipeline.call(this, config); +/***/ 65246: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix1 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 - */ - this._tempMatrix1 = new TransformMatrix(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix2 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 - */ - this._tempMatrix2 = new TransformMatrix(); +var Class = __webpack_require__(56694); - /** - * A temporary Transform Matrix, re-used internally during batching. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix3 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 - */ - this._tempMatrix3 = new TransformMatrix(); +var tempMatrix = new Float32Array(20); - /** - * A temporary Transform Matrix, re-used internally during batching by the - * Shape Game Objects. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#calcMatrix - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.55.0 - */ - this.calcMatrix = new TransformMatrix(); +/** + * @classdesc + * The ColorMatrix class creates a 5x4 matrix that can be used in shaders and graphics + * operations. It provides methods required to modify the color values, such as adjusting + * the brightness, setting a sepia tone, hue rotation and more. + * + * Use the method `getData` to return a Float32Array containing the current color values. + * + * @class ColorMatrix + * @memberof Phaser.Display + * @constructor + * @since 3.50.0 + */ +var ColorMatrix = new Class({ - /** - * Used internally to draw stroked triangles. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#tempTriangle - * @type {array} - * @private - * @since 3.55.0 - */ - this.tempTriangle = [ - { x: 0, y: 0, width: 0 }, - { x: 0, y: 0, width: 0 }, - { x: 0, y: 0, width: 0 }, - { x: 0, y: 0, width: 0 } - ]; + initialize: + function ColorMatrix () + { /** - * Cached stroke tint. + * Internal ColorMatrix array. * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#strokeTint - * @type {object} + * @name Phaser.Display.ColorMatrix#_matrix + * @type {Float32Array} * @private - * @since 3.55.0 + * @since 3.50.0 */ - this.strokeTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; + this._matrix = new Float32Array(20); /** - * Cached fill tint. + * The value that determines how much of the original color is used + * when mixing the colors. A value between 0 (all original) and 1 (all final) * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#fillTint - * @type {object} - * @private - * @since 3.55.0 + * @name Phaser.Display.ColorMatrix#alpha + * @type {number} + * @since 3.50.0 */ - this.fillTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; + this.alpha = 1; /** - * Internal texture frame reference. + * Is the ColorMatrix array dirty? * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#currentFrame - * @type {Phaser.Textures.Frame} + * @name Phaser.Display.ColorMatrix#_dirty + * @type {boolean} * @private - * @since 3.55.0 + * @since 3.50.0 */ - this.currentFrame = { u0: 0, v0: 0, u1: 1, v1: 1 }; + this._dirty = true; /** - * Internal path quad cache. + * The matrix data as a Float32Array. * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#firstQuad - * @type {number[]} - * @private - * @since 3.55.0 - */ - this.firstQuad = [ 0, 0, 0, 0, 0 ]; - - /** - * Internal path quad cache. + * Returned by the `getData` method. * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#prevQuad - * @type {number[]} + * @name Phaser.Display.ColorMatrix#data + * @type {Float32Array} * @private - * @since 3.55.0 + * @since 3.50.0 */ - this.prevQuad = [ 0, 0, 0, 0, 0 ]; + this._data = new Float32Array(20); - /** - * Used internally for triangulating a polygon. - * - * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#polygonCache - * @type {array} - * @private - * @since 3.55.0 - */ - this.polygonCache = []; + this.reset(); }, /** - * Called every time the pipeline is bound by the renderer. - * Sets the shader program, vertex buffer and other resources. - * Should only be called when changing pipeline. + * Sets this ColorMatrix from the given array of color values. * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#bind + * @method Phaser.Display.ColorMatrix#set * @since 3.50.0 * - * @return {this} This WebGLPipeline instance. + * @param {(number[]|Float32Array)} value - The ColorMatrix values to set. Must have 20 elements. + * + * @return {this} This ColorMatrix instance. */ - boot: function () + set: function (value) { - WebGLPipeline.prototype.boot.call(this); + this._matrix.set(value); - this.currentShader.set1iv('uMainSampler', this.renderer.textureIndexes); + this._dirty = true; + + return this; }, /** - * Takes a Sprite Game Object, or any object that extends it, and adds it to the batch. + * Resets the ColorMatrix to default values and also resets + * the `alpha` property back to 1. * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchSprite - * @since 3.0.0 + * @method Phaser.Display.ColorMatrix#reset + * @since 3.50.0 * - * @param {(Phaser.GameObjects.Image|Phaser.GameObjects.Sprite)} gameObject - The texture based Game Object to add to the batch. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set. + * @return {this} This ColorMatrix instance. */ - batchSprite: function (gameObject, camera, parentTransformMatrix) + reset: function () { - this.manager.set(this, gameObject); + var m = this._matrix; - var camMatrix = this._tempMatrix1; - var spriteMatrix = this._tempMatrix2; - var calcMatrix = this._tempMatrix3; + m.fill(0); - var frame = gameObject.frame; - var texture = frame.glTexture; + m[0] = 1; + m[6] = 1; + m[12] = 1; + m[18] = 1; - var u0 = frame.u0; - var v0 = frame.v0; - var u1 = frame.u1; - var v1 = frame.v1; - var frameX = frame.x; - var frameY = frame.y; - var frameWidth = frame.cutWidth; - var frameHeight = frame.cutHeight; - var customPivot = frame.customPivot; + this.alpha = 1; - var displayOriginX = gameObject.displayOriginX; - var displayOriginY = gameObject.displayOriginY; + this._dirty = true; - var x = -displayOriginX + frameX; - var y = -displayOriginY + frameY; + return this; + }, - if (gameObject.isCropped) + /** + * Gets the ColorMatrix as a Float32Array. + * + * Can be used directly as a 1fv shader uniform value. + * + * @method Phaser.Display.ColorMatrix#getData + * @since 3.50.0 + * + * @return {Float32Array} The ColorMatrix as a Float32Array. + */ + getData: function () + { + var data = this._data; + + if (this._dirty) { - var crop = gameObject._crop; + data.set(this._matrix); - if (crop.flipX !== gameObject.flipX || crop.flipY !== gameObject.flipY) - { - frame.updateCropUVs(crop, gameObject.flipX, gameObject.flipY); - } + data[4] /= 255; + data[9] /= 255; + data[14] /= 255; + data[19] /= 255; - u0 = crop.u0; - v0 = crop.v0; - u1 = crop.u1; - v1 = crop.v1; + this._dirty = false; + } - frameWidth = crop.width; - frameHeight = crop.height; + return data; + }, - frameX = crop.x; - frameY = crop.y; + /** + * Changes the brightness of this ColorMatrix by the given amount. + * + * @method Phaser.Display.ColorMatrix#brightness + * @since 3.50.0 + * + * @param {number} [value=0] - The amount of brightness to apply to this ColorMatrix. Between 0 (black) and 1. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + brightness: function (value, multiply) + { + if (value === undefined) { value = 0; } + if (multiply === undefined) { multiply = false; } - x = -displayOriginX + frameX; - y = -displayOriginY + frameY; - } + var b = value; - var flipX = 1; - var flipY = 1; + return this.multiply([ + b, 0, 0, 0, 0, + 0, b, 0, 0, 0, + 0, 0, b, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, - if (gameObject.flipX) - { - if (!customPivot) - { - x += (-frame.realWidth + (displayOriginX * 2)); - } + /** + * Changes the saturation of this ColorMatrix by the given amount. + * + * @method Phaser.Display.ColorMatrix#saturate + * @since 3.50.0 + * + * @param {number} [value=0] - The amount of saturation to apply to this ColorMatrix. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + saturate: function (value, multiply) + { + if (value === undefined) { value = 0; } + if (multiply === undefined) { multiply = false; } - flipX = -1; - } + var x = (value * 2 / 3) + 1; + var y = ((x - 1) * -0.5); - // Auto-invert the flipY if this is coming from a GLTexture + return this.multiply([ + x, y, y, 0, 0, + y, x, y, 0, 0, + y, y, x, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, - if (gameObject.flipY || (frame.source.isGLTexture && !texture.flipY)) - { - if (!customPivot) - { - y += (-frame.realHeight + (displayOriginY * 2)); - } + /** + * Desaturates this ColorMatrix (removes color from it). + * + * @method Phaser.Display.ColorMatrix#saturation + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + desaturate: function (multiply) + { + if (multiply === undefined) { multiply = false; } - flipY = -1; - } + return this.saturate(-1, multiply); + }, - spriteMatrix.applyITRS(gameObject.x, gameObject.y, gameObject.rotation, gameObject.scaleX * flipX, gameObject.scaleY * flipY); + /** + * Rotates the hues of this ColorMatrix by the value given. + * + * @method Phaser.Display.ColorMatrix#hue + * @since 3.50.0 + * + * @param {number} [rotation=0] - The amount of hue rotation to apply to this ColorMatrix, in degrees. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + hue: function (rotation, multiply) + { + if (rotation === undefined) { rotation = 0; } + if (multiply === undefined) { multiply = false; } - camMatrix.copyFrom(camera.matrix); + rotation = rotation / 180 * Math.PI; - if (parentTransformMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * gameObject.scrollFactorX, -camera.scrollY * gameObject.scrollFactorY); + var cos = Math.cos(rotation); + var sin = Math.sin(rotation); + var lumR = 0.213; + var lumG = 0.715; + var lumB = 0.072; - // Undo the camera scroll - spriteMatrix.e = gameObject.x; - spriteMatrix.f = gameObject.y; - } - else - { - spriteMatrix.e -= camera.scrollX * gameObject.scrollFactorX; - spriteMatrix.f -= camera.scrollY * gameObject.scrollFactorY; - } + return this.multiply([ + lumR + cos * (1 - lumR) + sin * (-lumR),lumG + cos * (-lumG) + sin * (-lumG),lumB + cos * (-lumB) + sin * (1 - lumB), 0, 0, + lumR + cos * (-lumR) + sin * (0.143),lumG + cos * (1 - lumG) + sin * (0.140),lumB + cos * (-lumB) + sin * (-0.283), 0, 0, + lumR + cos * (-lumR) + sin * (-(1 - lumR)),lumG + cos * (-lumG) + sin * (lumG),lumB + cos * (1 - lumB) + sin * (lumB), 0, 0, + 0, 0, 0, 1, 0 + ], multiply); + }, - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); + /** + * Sets this ColorMatrix to be grayscale. + * + * @method Phaser.Display.ColorMatrix#grayscale + * @since 3.50.0 + * + * @param {number} [value=1] - The grayscale scale (0 is black). + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + grayscale: function (value, multiply) + { + if (value === undefined) { value = 1; } + if (multiply === undefined) { multiply = false; } - var xw = x + frameWidth; - var yh = y + frameHeight; + return this.saturate(-value, multiply); + }, - var roundPixels = camera.roundPixels; + /** + * Sets this ColorMatrix to be black and white. + * + * @method Phaser.Display.ColorMatrix#blackWhite + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + blackWhite: function (multiply) + { + if (multiply === undefined) { multiply = false; } - var tx0 = calcMatrix.getXRound(x, y, roundPixels); - var ty0 = calcMatrix.getYRound(x, y, roundPixels); + return this.multiply(ColorMatrix.BLACK_WHITE, multiply); + }, - var tx1 = calcMatrix.getXRound(x, yh, roundPixels); - var ty1 = calcMatrix.getYRound(x, yh, roundPixels); + /** + * Change the contrast of this ColorMatrix by the amount given. + * + * @method Phaser.Display.ColorMatrix#contrast + * @since 3.50.0 + * + * @param {number} [value=0] - The amount of contrast to apply to this ColorMatrix. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + contrast: function (value, multiply) + { + if (value === undefined) { value = 0; } + if (multiply === undefined) { multiply = false; } - var tx2 = calcMatrix.getXRound(xw, yh, roundPixels); - var ty2 = calcMatrix.getYRound(xw, yh, roundPixels); + var v = value + 1; + var o = -0.5 * (v - 1); - var tx3 = calcMatrix.getXRound(xw, y, roundPixels); - var ty3 = calcMatrix.getYRound(xw, y, roundPixels); + return this.multiply([ + v, 0, 0, 0, o, + 0, v, 0, 0, o, + 0, 0, v, 0, o, + 0, 0, 0, 1, 0 + ], multiply); + }, - var getTint = Utils.getTintAppendFloatAlpha; - var cameraAlpha = camera.alpha; + /** + * Converts this ColorMatrix to have negative values. + * + * @method Phaser.Display.ColorMatrix#negative + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + negative: function (multiply) + { + if (multiply === undefined) { multiply = false; } - var tintTL = getTint(gameObject.tintTopLeft, cameraAlpha * gameObject._alphaTL); - var tintTR = getTint(gameObject.tintTopRight, cameraAlpha * gameObject._alphaTR); - var tintBL = getTint(gameObject.tintBottomLeft, cameraAlpha * gameObject._alphaBL); - var tintBR = getTint(gameObject.tintBottomRight, cameraAlpha * gameObject._alphaBR); + return this.multiply(ColorMatrix.NEGATIVE, multiply); + }, - if (this.shouldFlush(6)) - { - this.flush(); - } + /** + * Apply a desaturated luminance to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#desaturateLuminance + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + desaturateLuminance: function (multiply) + { + if (multiply === undefined) { multiply = false; } - var unit = this.setGameObject(gameObject, frame); + return this.multiply(ColorMatrix.DESATURATE_LUMINANCE, multiply); + }, - this.manager.preBatch(gameObject); + /** + * Applies a sepia tone to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#sepia + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + sepia: function (multiply) + { + if (multiply === undefined) { multiply = false; } - this.batchQuad(gameObject, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, gameObject.tintFill, texture, unit); + return this.multiply(ColorMatrix.SEPIA, multiply); + }, - this.manager.postBatch(gameObject); + /** + * Applies a night vision tone to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#night + * @since 3.50.0 + * + * @param {number} [intensity=0.1] - The intensity of this effect. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + night: function (intensity, multiply) + { + if (intensity === undefined) { intensity = 0.1; } + if (multiply === undefined) { multiply = false; } + + return this.multiply([ + intensity * (-2.0), -intensity, 0, 0, 0, + -intensity, 0, intensity, 0, 0, + 0, intensity, intensity * 2.0, 0, 0, + 0, 0, 0, 1, 0 + ], multiply); }, /** - * Generic function for batching a textured quad using argument values instead of a Game Object. + * Applies a trippy color tone to this ColorMatrix. * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTexture - * @since 3.0.0 + * @method Phaser.Display.ColorMatrix#lsd + * @since 3.50.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject. - * @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad. - * @param {number} textureWidth - Real texture width. - * @param {number} textureHeight - Real texture height. - * @param {number} srcX - X coordinate of the quad. - * @param {number} srcY - Y coordinate of the quad. - * @param {number} srcWidth - Width of the quad. - * @param {number} srcHeight - Height of the quad. - * @param {number} scaleX - X component of scale. - * @param {number} scaleY - Y component of scale. - * @param {number} rotation - Rotation of the quad. - * @param {boolean} flipX - Indicates if the quad is horizontally flipped. - * @param {boolean} flipY - Indicates if the quad is vertically flipped. - * @param {number} scrollFactorX - By which factor is the quad affected by the camera horizontal scroll. - * @param {number} scrollFactorY - By which factor is the quad effected by the camera vertical scroll. - * @param {number} displayOriginX - Horizontal origin in pixels. - * @param {number} displayOriginY - Vertical origin in pixels. - * @param {number} frameX - X coordinate of the texture frame. - * @param {number} frameY - Y coordinate of the texture frame. - * @param {number} frameWidth - Width of the texture frame. - * @param {number} frameHeight - Height of the texture frame. - * @param {number} tintTL - Tint for top left. - * @param {number} tintTR - Tint for top right. - * @param {number} tintBL - Tint for bottom left. - * @param {number} tintBR - Tint for bottom right. - * @param {number} tintEffect - The tint effect. - * @param {number} uOffset - Horizontal offset on texture coordinate. - * @param {number} vOffset - Vertical offset on texture coordinate. - * @param {Phaser.Cameras.Scene2D.Camera} camera - Current used camera. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - Parent container. - * @param {boolean} [skipFlip=false] - Skip the renderTexture check. - * @param {number} [textureUnit] - Use the currently bound texture unit? + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. */ - batchTexture: function ( - gameObject, - texture, - textureWidth, textureHeight, - srcX, srcY, - srcWidth, srcHeight, - scaleX, scaleY, - rotation, - flipX, flipY, - scrollFactorX, scrollFactorY, - displayOriginX, displayOriginY, - frameX, frameY, frameWidth, frameHeight, - tintTL, tintTR, tintBL, tintBR, tintEffect, - uOffset, vOffset, - camera, - parentTransformMatrix, - skipFlip, - textureUnit) + lsd: function (multiply) { - this.manager.set(this, gameObject); + if (multiply === undefined) { multiply = false; } - var camMatrix = this._tempMatrix1; - var spriteMatrix = this._tempMatrix2; - var calcMatrix = this._tempMatrix3; + return this.multiply(ColorMatrix.LSD, multiply); + }, - var u0 = (frameX / textureWidth) + uOffset; - var v0 = (frameY / textureHeight) + vOffset; - var u1 = (frameX + frameWidth) / textureWidth + uOffset; - var v1 = (frameY + frameHeight) / textureHeight + vOffset; + /** + * Applies a brown tone to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#brown + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + brown: function (multiply) + { + if (multiply === undefined) { multiply = false; } - var width = srcWidth; - var height = srcHeight; + return this.multiply(ColorMatrix.BROWN, multiply); + }, - var x = -displayOriginX; - var y = -displayOriginY; + /** + * Applies a vintage pinhole color effect to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#vintagePinhole + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + vintagePinhole: function (multiply) + { + if (multiply === undefined) { multiply = false; } - if (gameObject.isCropped) - { - var crop = gameObject._crop; + return this.multiply(ColorMatrix.VINTAGE, multiply); + }, - var cropWidth = crop.width; - var cropHeight = crop.height; + /** + * Applies a kodachrome color effect to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#kodachrome + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + kodachrome: function (multiply) + { + if (multiply === undefined) { multiply = false; } - width = cropWidth; - height = cropHeight; + return this.multiply(ColorMatrix.KODACHROME, multiply); + }, - srcWidth = cropWidth; - srcHeight = cropHeight; + /** + * Applies a technicolor color effect to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#technicolor + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + technicolor: function (multiply) + { + if (multiply === undefined) { multiply = false; } - frameX = crop.x; - frameY = crop.y; + return this.multiply(ColorMatrix.TECHNICOLOR, multiply); + }, - var ox = frameX; - var oy = frameY; + /** + * Applies a polaroid color effect to this ColorMatrix. + * + * @method Phaser.Display.ColorMatrix#polaroid + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + polaroid: function (multiply) + { + if (multiply === undefined) { multiply = false; } - if (flipX) - { - ox = (frameWidth - crop.x - cropWidth); - } + return this.multiply(ColorMatrix.POLAROID, multiply); + }, - if (flipY) - { - oy = (frameHeight - crop.y - cropHeight); - } + /** + * Shifts the values of this ColorMatrix into BGR order. + * + * @method Phaser.Display.ColorMatrix#shiftToBGR + * @since 3.50.0 + * + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + shiftToBGR: function (multiply) + { + if (multiply === undefined) { multiply = false; } - u0 = (ox / textureWidth) + uOffset; - v0 = (oy / textureHeight) + vOffset; - u1 = (ox + cropWidth) / textureWidth + uOffset; - v1 = (oy + cropHeight) / textureHeight + vOffset; + return this.multiply(ColorMatrix.SHIFT_BGR, multiply); + }, - x = -displayOriginX + frameX; - y = -displayOriginY + frameY; - } + /** + * Multiplies the two given matrices. + * + * @method Phaser.Display.ColorMatrix#multiply + * @since 3.50.0 + * + * @param {number[]} a - The 5x4 array to multiply with ColorMatrix._matrix. + * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * + * @return {this} This ColorMatrix instance. + */ + multiply: function (a, multiply) + { + if (multiply === undefined) { multiply = false; } - // Invert the flipY if this is a RenderTexture - flipY = flipY ^ (!skipFlip && texture.isRenderTexture ? 1 : 0); + // Duplicate _matrix into c - if (flipX) + if (!multiply) { - width *= -1; - x += srcWidth; + this.reset(); } - if (flipY) - { - height *= -1; - y += srcHeight; - } + var m = this._matrix; + var c = tempMatrix; + + // copy _matrix to tempMatrox + c.set(m); + + m.set([ + // R + (c[0] * a[0]) + (c[1] * a[5]) + (c[2] * a[10]) + (c[3] * a[15]), + (c[0] * a[1]) + (c[1] * a[6]) + (c[2] * a[11]) + (c[3] * a[16]), + (c[0] * a[2]) + (c[1] * a[7]) + (c[2] * a[12]) + (c[3] * a[17]), + (c[0] * a[3]) + (c[1] * a[8]) + (c[2] * a[13]) + (c[3] * a[18]), + (c[0] * a[4]) + (c[1] * a[9]) + (c[2] * a[14]) + (c[3] * a[19]) + c[4], + + // G + (c[5] * a[0]) + (c[6] * a[5]) + (c[7] * a[10]) + (c[8] * a[15]), + (c[5] * a[1]) + (c[6] * a[6]) + (c[7] * a[11]) + (c[8] * a[16]), + (c[5] * a[2]) + (c[6] * a[7]) + (c[7] * a[12]) + (c[8] * a[17]), + (c[5] * a[3]) + (c[6] * a[8]) + (c[7] * a[13]) + (c[8] * a[18]), + (c[5] * a[4]) + (c[6] * a[9]) + (c[7] * a[14]) + (c[8] * a[19]) + c[9], + + // B + (c[10] * a[0]) + (c[11] * a[5]) + (c[12] * a[10]) + (c[13] * a[15]), + (c[10] * a[1]) + (c[11] * a[6]) + (c[12] * a[11]) + (c[13] * a[16]), + (c[10] * a[2]) + (c[11] * a[7]) + (c[12] * a[12]) + (c[13] * a[17]), + (c[10] * a[3]) + (c[11] * a[8]) + (c[12] * a[13]) + (c[13] * a[18]), + (c[10] * a[4]) + (c[11] * a[9]) + (c[12] * a[14]) + (c[13] * a[19]) + c[14], + + // A + (c[15] * a[0]) + (c[16] * a[5]) + (c[17] * a[10]) + (c[18] * a[15]), + (c[15] * a[1]) + (c[16] * a[6]) + (c[17] * a[11]) + (c[18] * a[16]), + (c[15] * a[2]) + (c[16] * a[7]) + (c[17] * a[12]) + (c[18] * a[17]), + (c[15] * a[3]) + (c[16] * a[8]) + (c[17] * a[13]) + (c[18] * a[18]), + (c[15] * a[4]) + (c[16] * a[9]) + (c[17] * a[14]) + (c[18] * a[19]) + c[19] - var xw = x + width; - var yh = y + height; + ]); - spriteMatrix.applyITRS(srcX, srcY, rotation, scaleX, scaleY); + this._dirty = true; - camMatrix.copyFrom(camera.matrix); + return this; + } - if (parentTransformMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY); +}); - // Undo the camera scroll - spriteMatrix.e = srcX; - spriteMatrix.f = srcY; - } - else - { - spriteMatrix.e -= camera.scrollX * scrollFactorX; - spriteMatrix.f -= camera.scrollY * scrollFactorY; - } +/** + * A constant array used by the ColorMatrix class for black_white operations. + * + * @name Phaser.Display.ColorMatrix.BLACK_WHITE + * @const + * @type {number[]} + * @since 3.60.0 + */ +ColorMatrix.BLACK_WHITE = [ 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 ]; - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(spriteMatrix, calcMatrix); +/** + * A constant array used by the ColorMatrix class for negative operations. + * + * @name Phaser.Display.ColorMatrix.NEGATIVE + * @const + * @type {number[]} + * @since 3.60.0 + */ +ColorMatrix.NEGATIVE = [ -1, 0, 0, 1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 0, 1, 0 ]; - var roundPixels = camera.roundPixels; +/** + * A constant array used by the ColorMatrix class for desatured luminance operations. + * + * @name Phaser.Display.ColorMatrix.DESATURATE_LUMINANCE + * @const + * @type {number[]} + * @since 3.60.0 + */ +ColorMatrix.DESATURATE_LUMINANCE = [ 0.2764723, 0.9297080, 0.0938197, 0, -37.1, 0.2764723, 0.9297080, 0.0938197, 0, -37.1, 0.2764723, 0.9297080, 0.0938197, 0, -37.1, 0, 0, 0, 1, 0 ]; - var tx0 = calcMatrix.getXRound(x, y, roundPixels); - var ty0 = calcMatrix.getYRound(x, y, roundPixels); +/** + * A constant array used by the ColorMatrix class for sepia operations. + * + * @name Phaser.Display.ColorMatrix.SEPIA + * @const + * @type {number[]} + * @since 3.60.0 + */ +ColorMatrix.SEPIA = [ 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 ]; - var tx1 = calcMatrix.getXRound(x, yh, roundPixels); - var ty1 = calcMatrix.getYRound(x, yh, roundPixels); +/** + * A constant array used by the ColorMatrix class for lsd operations. + * + * @name Phaser.Display.ColorMatrix.LSD + * @const + * @type {number[]} + * @since 3.60.0 + */ +ColorMatrix.LSD = [ 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 ]; - var tx2 = calcMatrix.getXRound(xw, yh, roundPixels); - var ty2 = calcMatrix.getYRound(xw, yh, roundPixels); +/** + * A constant array used by the ColorMatrix class for brown operations. + * + * @name Phaser.Display.ColorMatrix.BROWN + * @const + * @type {number[]} + * @since 3.60.0 + */ +ColorMatrix.BROWN = [ 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 ]; - var tx3 = calcMatrix.getXRound(xw, y, roundPixels); - var ty3 = calcMatrix.getYRound(xw, y, roundPixels); +/** + * A constant array used by the ColorMatrix class for vintage pinhole operations. + * + * @name Phaser.Display.ColorMatrix.VINTAGE + * @const + * @type {number[]} + * @since 3.60.0 + */ +ColorMatrix.VINTAGE = [ 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 ]; - if (textureUnit === undefined) - { - textureUnit = this.renderer.setTexture2D(texture); - } +/** + * A constant array used by the ColorMatrix class for kodachrome operations. + * + * @name Phaser.Display.ColorMatrix.KODACHROME + * @const + * @type {number[]} + * @since 3.60.0 + */ +ColorMatrix.KODACHROME = [ 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 ]; - if (gameObject) - { - this.manager.preBatch(gameObject); - } +/** + * A constant array used by the ColorMatrix class for technicolor operations. + * + * @name Phaser.Display.ColorMatrix.TECHNICOLOR + * @const + * @type {number[]} + * @since 3.60.0 + */ +ColorMatrix.TECHNICOLOR = [ 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.batchQuad(gameObject, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); +/** + * A constant array used by the ColorMatrix class for polaroid shift operations. + * + * @name Phaser.Display.ColorMatrix.POLAROID + * @const + * @type {number[]} + * @since 3.60.0 + */ +ColorMatrix.POLAROID = [ 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 ]; - if (gameObject) - { - this.manager.postBatch(gameObject); - } - }, +/** + * A constant array used by the ColorMatrix class for shift BGR operations. + * + * @name Phaser.Display.ColorMatrix.SHIFT_BGR + * @const + * @type {number[]} + * @since 3.60.0 + */ +ColorMatrix.SHIFT_BGR = [ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]; - /** - * Adds a Texture Frame into the batch for rendering. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTextureFrame - * @since 3.12.0 - * - * @param {Phaser.Textures.Frame} frame - The Texture Frame to be rendered. - * @param {number} x - The horizontal position to render the texture at. - * @param {number} y - The vertical position to render the texture at. - * @param {number} tint - The tint color. - * @param {number} alpha - The alpha value. - * @param {Phaser.GameObjects.Components.TransformMatrix} transformMatrix - The Transform Matrix to use for the texture. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - A parent Transform Matrix. - */ - batchTextureFrame: function ( - frame, - x, y, - tint, alpha, - transformMatrix, - parentTransformMatrix - ) - { - this.manager.set(this); +module.exports = ColorMatrix; - var spriteMatrix = this._tempMatrix1.copyFrom(transformMatrix); - var calcMatrix = this._tempMatrix2; - var xw = x + frame.width; - var yh = y + frame.height; +/***/ }), - if (parentTransformMatrix) - { - spriteMatrix.multiply(parentTransformMatrix, calcMatrix); - } - else - { - calcMatrix = spriteMatrix; - } +/***/ 39298: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var tx0 = calcMatrix.getX(x, y); - var ty0 = calcMatrix.getY(x, y); +var Class = __webpack_require__(56694); +var NOOP = __webpack_require__(72283); - var tx1 = calcMatrix.getX(x, yh); - var ty1 = calcMatrix.getY(x, yh); +/** + * @classdesc + * The RGB class holds a single color value and allows for easy modification and reading of it, + * with optional on-change callback notification and a dirty flag. + * + * @class RGB + * @memberof Phaser.Display + * @constructor + * @since 3.50.0 + * + * @param {number} [red=0] - The red color value. A number between 0 and 1. + * @param {number} [green=0] - The green color value. A number between 0 and 1. + * @param {number} [blue=0] - The blue color value. A number between 0 and 1. + */ +var RGB = new Class({ - var tx2 = calcMatrix.getX(xw, yh); - var ty2 = calcMatrix.getY(xw, yh); + initialize: - var tx3 = calcMatrix.getX(xw, y); - var ty3 = calcMatrix.getY(xw, y); + function RGB (red, green, blue) + { + /** + * Cached RGB values. + * + * @name Phaser.Display.RGB#_rgb + * @type {number[]} + * @private + * @since 3.50.0 + */ + this._rgb = [ 0, 0, 0 ]; - var unit = this.renderer.setTextureSource(frame.source); + /** + * This callback will be invoked each time one of the RGB color values change. + * + * The callback is sent the new color values as the parameters. + * + * @name Phaser.Display.RGB#onChangeCallback + * @type {function} + * @since 3.50.0 + */ + this.onChangeCallback = NOOP; - tint = Utils.getTintAppendFloatAlpha(tint, alpha); + /** + * Is this color dirty? + * + * @name Phaser.Display.RGB#dirty + * @type {boolean} + * @since 3.50.0 + */ + this.dirty = false; - this.batchQuad(null, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, 0, frame.glTexture, unit); + this.set(red, green, blue); }, /** - * Pushes a filled rectangle into the vertex batch. + * Sets the red, green and blue values of this RGB object, flags it as being + * dirty and then invokes the `onChangeCallback`, if set. * - * Rectangle factors in the given transform matrices before adding to the batch. + * @method Phaser.Display.RGB#set + * @since 3.50.0 * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchFillRect - * @since 3.55.0 + * @param {number} [red=0] - The red color value. A number between 0 and 1. + * @param {number} [green=0] - The green color value. A number between 0 and 1. + * @param {number} [blue=0] - The blue color value. A number between 0 and 1. * - * @param {number} x - Horizontal top left coordinate of the rectangle. - * @param {number} y - Vertical top left coordinate of the rectangle. - * @param {number} width - Width of the rectangle. - * @param {number} height - Height of the rectangle. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + * @return {this} This RGB instance. */ - batchFillRect: function (x, y, width, height, currentMatrix, parentMatrix) + set: function (red, green, blue) { - this.renderer.pipelines.set(this); - - var calcMatrix = this.calcMatrix; - - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) - { - parentMatrix.multiply(currentMatrix, calcMatrix); - } - - var xw = x + width; - var yh = y + height; - - var x0 = calcMatrix.getX(x, y); - var y0 = calcMatrix.getY(x, y); - - var x1 = calcMatrix.getX(x, yh); - var y1 = calcMatrix.getY(x, yh); - - var x2 = calcMatrix.getX(xw, yh); - var y2 = calcMatrix.getY(xw, yh); + if (red === undefined) { red = 0; } + if (green === undefined) { green = 0; } + if (blue === undefined) { blue = 0; } - var x3 = calcMatrix.getX(xw, y); - var y3 = calcMatrix.getY(xw, y); + this._rgb = [ red, green, blue ]; - var tint = this.fillTint; + this.onChange(); - this.batchQuad(null, x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint.TL, tint.TR, tint.BL, tint.BR, 2); + return this; }, /** - * Pushes a filled triangle into the vertex batch. + * Compares the given rgb parameters with those in this object and returns + * a boolean `true` value if they are equal, otherwise it returns `false`. * - * Triangle factors in the given transform matrices before adding to the batch. + * @method Phaser.Display.RGB#equals + * @since 3.50.0 * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchFillTriangle - * @since 3.55.0 + * @param {number} red - The red value to compare with this object. + * @param {number} green - The green value to compare with this object. + * @param {number} blue - The blue value to compare with this object. * - * @param {number} x0 - Point 0 x coordinate. - * @param {number} y0 - Point 0 y coordinate. - * @param {number} x1 - Point 1 x coordinate. - * @param {number} y1 - Point 1 y coordinate. - * @param {number} x2 - Point 2 x coordinate. - * @param {number} y2 - Point 2 y coordinate. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + * @return {boolean} `true` if the given values match those in this object, otherwise `false`. */ - batchFillTriangle: function (x0, y0, x1, y1, x2, y2, currentMatrix, parentMatrix) + equals: function (red, green, blue) { - this.renderer.pipelines.set(this); - - var calcMatrix = this.calcMatrix; - - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) - { - parentMatrix.multiply(currentMatrix, calcMatrix); - } - - var tx0 = calcMatrix.getX(x0, y0); - var ty0 = calcMatrix.getY(x0, y0); - - var tx1 = calcMatrix.getX(x1, y1); - var ty1 = calcMatrix.getY(x1, y1); - - var tx2 = calcMatrix.getX(x2, y2); - var ty2 = calcMatrix.getY(x2, y2); - - var tint = this.fillTint; + var rgb = this._rgb; - this.batchTri(null, tx0, ty0, tx1, ty1, tx2, ty2, 0, 0, 1, 1, tint.TL, tint.TR, tint.BL, 2); + return (rgb[0] === red && rgb[1] === green && rgb[2] === blue); }, /** - * Pushes a stroked triangle into the vertex batch. - * - * Triangle factors in the given transform matrices before adding to the batch. + * Internal on change handler. Sets this object as being dirty and + * then invokes the `onChangeCallback`, if set, passing in the + * new RGB values. * - * The triangle is created from 3 lines and drawn using the `batchStrokePath` method. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchStrokeTriangle - * @since 3.55.0 - * - * @param {number} x0 - Point 0 x coordinate. - * @param {number} y0 - Point 0 y coordinate. - * @param {number} x1 - Point 1 x coordinate. - * @param {number} y1 - Point 1 y coordinate. - * @param {number} x2 - Point 2 x coordinate. - * @param {number} y2 - Point 2 y coordinate. - * @param {number} lineWidth - The width of the line in pixels. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + * @method Phaser.Display.RGB#onChange + * @since 3.50.0 */ - batchStrokeTriangle: function (x0, y0, x1, y1, x2, y2, lineWidth, currentMatrix, parentMatrix) + onChange: function () { - var tempTriangle = this.tempTriangle; - - tempTriangle[0].x = x0; - tempTriangle[0].y = y0; - tempTriangle[0].width = lineWidth; - - tempTriangle[1].x = x1; - tempTriangle[1].y = y1; - tempTriangle[1].width = lineWidth; - - tempTriangle[2].x = x2; - tempTriangle[2].y = y2; - tempTriangle[2].width = lineWidth; + this.dirty = true; - tempTriangle[3].x = x0; - tempTriangle[3].y = y0; - tempTriangle[3].width = lineWidth; + var rgb = this._rgb; - this.batchStrokePath(tempTriangle, lineWidth, false, currentMatrix, parentMatrix); + this.onChangeCallback.call(this, rgb[0], rgb[1], rgb[2]); }, /** - * Adds the given path to the vertex batch for rendering. - * - * It works by taking the array of path data and then passing it through Earcut, which - * creates a list of polygons. Each polygon is then added to the batch. - * - * The path is always automatically closed because it's filled. + * The red color value. Between 0 and 1. * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchFillPath - * @since 3.55.0 + * Changing this property will flag this RGB object as being dirty + * and invoke the `onChangeCallback` , if set. * - * @param {Phaser.Types.Math.Vector2Like[]} path - Collection of points that represent the path. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + * @name Phaser.Display.RGB#r + * @type {number} + * @since 3.50.0 */ - batchFillPath: function (path, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); + r: { - var calcMatrix = this.calcMatrix; + get: function () + { + return this._rgb[0]; + }, - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) + set: function (value) { - parentMatrix.multiply(currentMatrix, calcMatrix); + this._rgb[0] = value; + this.onChange(); } - var length = path.length; - var polygonCache = this.polygonCache; - var polygonIndexArray; - var point; + }, - var tintTL = this.fillTint.TL; - var tintTR = this.fillTint.TR; - var tintBL = this.fillTint.BL; + /** + * The green color value. Between 0 and 1. + * + * Changing this property will flag this RGB object as being dirty + * and invoke the `onChangeCallback` , if set. + * + * @name Phaser.Display.RGB#g + * @type {number} + * @since 3.50.0 + */ + g: { - for (var pathIndex = 0; pathIndex < length; ++pathIndex) + get: function () { - point = path[pathIndex]; - polygonCache.push(point.x, point.y); - } - - polygonIndexArray = Earcut(polygonCache); - length = polygonIndexArray.length; + return this._rgb[1]; + }, - for (var index = 0; index < length; index += 3) + set: function (value) { - var p0 = polygonIndexArray[index + 0] * 2; - var p1 = polygonIndexArray[index + 1] * 2; - var p2 = polygonIndexArray[index + 2] * 2; - - var x0 = polygonCache[p0 + 0]; - var y0 = polygonCache[p0 + 1]; - var x1 = polygonCache[p1 + 0]; - var y1 = polygonCache[p1 + 1]; - var x2 = polygonCache[p2 + 0]; - var y2 = polygonCache[p2 + 1]; - - var tx0 = calcMatrix.getX(x0, y0); - var ty0 = calcMatrix.getY(x0, y0); - - var tx1 = calcMatrix.getX(x1, y1); - var ty1 = calcMatrix.getY(x1, y1); - - var tx2 = calcMatrix.getX(x2, y2); - var ty2 = calcMatrix.getY(x2, y2); - - this.batchTri(null, tx0, ty0, tx1, ty1, tx2, ty2, 0, 0, 1, 1, tintTL, tintTR, tintBL, 2); + this._rgb[1] = value; + this.onChange(); } - polygonCache.length = 0; }, /** - * Adds the given path to the vertex batch for rendering. - * - * It works by taking the array of path data and calling `batchLine` for each section - * of the path. - * - * The path is optionally closed at the end. + * The blue color value. Between 0 and 1. * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchStrokePath - * @since 3.55.0 + * Changing this property will flag this RGB object as being dirty + * and invoke the `onChangeCallback` , if set. * - * @param {Phaser.Types.Math.Vector2Like[]} path - Collection of points that represent the path. - * @param {number} lineWidth - The width of the line segments in pixels. - * @param {boolean} pathOpen - Indicates if the path should be closed or left open. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + * @name Phaser.Display.RGB#b + * @type {number} + * @since 3.50.0 */ - batchStrokePath: function (path, lineWidth, pathOpen, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); - - // Reset the closePath booleans - this.prevQuad[4] = 0; - this.firstQuad[4] = 0; - - var pathLength = path.length - 1; + b: { - for (var pathIndex = 0; pathIndex < pathLength; pathIndex++) + get: function () { - var point0 = path[pathIndex]; - var point1 = path[pathIndex + 1]; + return this._rgb[2]; + }, - this.batchLine( - point0.x, - point0.y, - point1.x, - point1.y, - point0.width / 2, - point1.width / 2, - lineWidth, - pathIndex, - !pathOpen && (pathIndex === pathLength - 1), - currentMatrix, - parentMatrix - ); + set: function (value) + { + this._rgb[2] = value; + this.onChange(); } + }, /** - * Creates a line out of 4 quads and adds it to the vertex batch based on the given line values. - * - * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchLine - * @since 3.55.0 + * Nulls any external references this object contains. * - * @param {number} ax - x coordinate of the start of the line. - * @param {number} ay - y coordinate of the start of the line. - * @param {number} bx - x coordinate of the end of the line. - * @param {number} by - y coordinate of the end of the line. - * @param {number} aLineWidth - Width of the start of the line. - * @param {number} bLineWidth - Width of the end of the line. - * @param {number} index - If this line is part of a multi-line draw, the index of the line in the draw. - * @param {boolean} closePath - Does this line close a multi-line path? - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + * @method Phaser.Display.RGB#destroy + * @since 3.50.0 */ - batchLine: function (ax, ay, bx, by, aLineWidth, bLineWidth, lineWidth, index, closePath, currentMatrix, parentMatrix) + destroy: function () { - this.renderer.pipelines.set(this); + this.onChangeCallback = null; + } - var calcMatrix = this.calcMatrix; +}); - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) - { - parentMatrix.multiply(currentMatrix, calcMatrix); - } +module.exports = RGB; - var dx = bx - ax; - var dy = by - ay; - var len = Math.sqrt(dx * dx + dy * dy); - var al0 = aLineWidth * (by - ay) / len; - var al1 = aLineWidth * (ax - bx) / len; - var bl0 = bLineWidth * (by - ay) / len; - var bl1 = bLineWidth * (ax - bx) / len; +/***/ }), - var lx0 = bx - bl0; - var ly0 = by - bl1; - var lx1 = ax - al0; - var ly1 = ay - al1; - var lx2 = bx + bl0; - var ly2 = by + bl1; - var lx3 = ax + al0; - var ly3 = ay + al1; +/***/ 84093: +/***/ ((module) => { - // tx0 = bottom right - var brX = calcMatrix.getX(lx0, ly0); - var brY = calcMatrix.getY(lx0, ly0); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // tx1 = bottom left - var blX = calcMatrix.getX(lx1, ly1); - var blY = calcMatrix.getY(lx1, ly1); +var ALIGN_CONST = { - // tx2 = top right - var trX = calcMatrix.getX(lx2, ly2); - var trY = calcMatrix.getY(lx2, ly2); + /** + * A constant representing a top-left alignment or position. + * @constant + * @name Phaser.Display.Align.TOP_LEFT + * @since 3.0.0 + * @type {number} + */ + TOP_LEFT: 0, - // tx3 = top left - var tlX = calcMatrix.getX(lx3, ly3); - var tlY = calcMatrix.getY(lx3, ly3); + /** + * A constant representing a top-center alignment or position. + * @constant + * @name Phaser.Display.Align.TOP_CENTER + * @since 3.0.0 + * @type {number} + */ + TOP_CENTER: 1, - var tint = this.strokeTint; + /** + * A constant representing a top-right alignment or position. + * @constant + * @name Phaser.Display.Align.TOP_RIGHT + * @since 3.0.0 + * @type {number} + */ + TOP_RIGHT: 2, - var tintTL = tint.TL; - var tintTR = tint.TR; - var tintBL = tint.BL; - var tintBR = tint.BR; + /** + * A constant representing a left-top alignment or position. + * @constant + * @name Phaser.Display.Align.LEFT_TOP + * @since 3.0.0 + * @type {number} + */ + LEFT_TOP: 3, - // TL, BL, BR, TR - this.batchQuad(null, tlX, tlY, blX, blY, brX, brY, trX, trY, 0, 0, 1, 1, tintTL, tintTR, tintBL, tintBR, 2); + /** + * A constant representing a left-center alignment or position. + * @constant + * @name Phaser.Display.Align.LEFT_CENTER + * @since 3.0.0 + * @type {number} + */ + LEFT_CENTER: 4, - if (lineWidth <= 2) - { - // No point doing a linejoin if the line isn't thick enough - return; - } + /** + * A constant representing a left-bottom alignment or position. + * @constant + * @name Phaser.Display.Align.LEFT_BOTTOM + * @since 3.0.0 + * @type {number} + */ + LEFT_BOTTOM: 5, - var prev = this.prevQuad; - var first = this.firstQuad; + /** + * A constant representing a center alignment or position. + * @constant + * @name Phaser.Display.Align.CENTER + * @since 3.0.0 + * @type {number} + */ + CENTER: 6, - if (index > 0 && prev[4]) - { - this.batchQuad(null, tlX, tlY, blX, blY, prev[0], prev[1], prev[2], prev[3], 0, 0, 1, 1, tintTL, tintTR, tintBL, tintBR, 2); - } - else - { - first[0] = tlX; - first[1] = tlY; - first[2] = blX; - first[3] = blY; - first[4] = 1; - } + /** + * A constant representing a right-top alignment or position. + * @constant + * @name Phaser.Display.Align.RIGHT_TOP + * @since 3.0.0 + * @type {number} + */ + RIGHT_TOP: 7, - if (closePath && first[4]) - { - // Add a join for the final path segment - this.batchQuad(null, brX, brY, trX, trY, first[0], first[1], first[2], first[3], 0, 0, 1, 1, tintTL, tintTR, tintBL, tintBR, 2); - } - else - { - // Store it + /** + * A constant representing a right-center alignment or position. + * @constant + * @name Phaser.Display.Align.RIGHT_CENTER + * @since 3.0.0 + * @type {number} + */ + RIGHT_CENTER: 8, - prev[0] = brX; - prev[1] = brY; - prev[2] = trX; - prev[3] = trY; - prev[4] = 1; - } - } + /** + * A constant representing a right-bottom alignment or position. + * @constant + * @name Phaser.Display.Align.RIGHT_BOTTOM + * @since 3.0.0 + * @type {number} + */ + RIGHT_BOTTOM: 9, -}); + /** + * A constant representing a bottom-left alignment or position. + * @constant + * @name Phaser.Display.Align.BOTTOM_LEFT + * @since 3.0.0 + * @type {number} + */ + BOTTOM_LEFT: 10, -module.exports = MultiPipeline; + /** + * A constant representing a bottom-center alignment or position. + * @constant + * @name Phaser.Display.Align.BOTTOM_CENTER + * @since 3.0.0 + * @type {number} + */ + BOTTOM_CENTER: 11, + + /** + * A constant representing a bottom-right alignment or position. + * @constant + * @name Phaser.Display.Align.BOTTOM_RIGHT + * @since 3.0.0 + * @type {number} + */ + BOTTOM_RIGHT: 12 + +}; + +module.exports = ALIGN_CONST; /***/ }), -/* 109 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 32058: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Clamp = __webpack_require__(18); -var Extend = __webpack_require__(17); +var GetBottom = __webpack_require__(97328); +var GetCenterX = __webpack_require__(59994); +var SetBottom = __webpack_require__(73174); +var SetCenterX = __webpack_require__(28417); /** - * @classdesc - * A Frame is a section of a Texture. + * Takes given Game Object and aligns it so that it is positioned in the bottom center of the other. * - * @class Frame - * @memberof Phaser.Textures - * @constructor + * @function Phaser.Display.Align.In.BottomCenter * @since 3.0.0 * - * @param {Phaser.Textures.Texture} texture - The Texture this Frame is a part of. - * @param {(number|string)} name - The name of this Frame. The name is unique within the Texture. - * @param {number} sourceIndex - The index of the TextureSource that this Frame is a part of. - * @param {number} x - The x coordinate of the top-left of this Frame. - * @param {number} y - The y coordinate of the top-left of this Frame. - * @param {number} width - The width of this Frame. - * @param {number} height - The height of this Frame. + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. */ -var Frame = new Class({ - - initialize: +var BottomCenter = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - function Frame (texture, name, sourceIndex, x, y, width, height) - { - /** - * The Texture this Frame is a part of. - * - * @name Phaser.Textures.Frame#texture - * @type {Phaser.Textures.Texture} - * @since 3.0.0 - */ - this.texture = texture; + SetCenterX(gameObject, GetCenterX(alignIn) + offsetX); + SetBottom(gameObject, GetBottom(alignIn) + offsetY); - /** - * The name of this Frame. - * The name is unique within the Texture. - * - * @name Phaser.Textures.Frame#name - * @type {string} - * @since 3.0.0 - */ - this.name = name; + return gameObject; +}; - /** - * The TextureSource this Frame is part of. - * - * @name Phaser.Textures.Frame#source - * @type {Phaser.Textures.TextureSource} - * @since 3.0.0 - */ - this.source = texture.source[sourceIndex]; +module.exports = BottomCenter; - /** - * The index of the TextureSource in the Texture sources array. - * - * @name Phaser.Textures.Frame#sourceIndex - * @type {number} - * @since 3.0.0 - */ - this.sourceIndex = sourceIndex; - /** - * A reference to the Texture Source WebGL Texture that this Frame is using. - * - * @name Phaser.Textures.Frame#glTexture - * @type {?WebGLTexture} - * @default null - * @since 3.11.0 - */ - this.glTexture = this.source.glTexture; +/***/ }), - /** - * X position within the source image to cut from. - * - * @name Phaser.Textures.Frame#cutX - * @type {number} - * @since 3.0.0 - */ - this.cutX; +/***/ 85535: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Y position within the source image to cut from. - * - * @name Phaser.Textures.Frame#cutY - * @type {number} - * @since 3.0.0 - */ - this.cutY; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The width of the area in the source image to cut. - * - * @name Phaser.Textures.Frame#cutWidth - * @type {number} - * @since 3.0.0 - */ - this.cutWidth; +var GetBottom = __webpack_require__(97328); +var GetLeft = __webpack_require__(40163); +var SetBottom = __webpack_require__(73174); +var SetLeft = __webpack_require__(74465); - /** - * The height of the area in the source image to cut. - * - * @name Phaser.Textures.Frame#cutHeight - * @type {number} - * @since 3.0.0 - */ - this.cutHeight; +/** + * Takes given Game Object and aligns it so that it is positioned in the bottom left of the other. + * + * @function Phaser.Display.Align.In.BottomLeft + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var BottomLeft = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * The X rendering offset of this Frame, taking trim into account. - * - * @name Phaser.Textures.Frame#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.x = 0; + SetLeft(gameObject, GetLeft(alignIn) - offsetX); + SetBottom(gameObject, GetBottom(alignIn) + offsetY); - /** - * The Y rendering offset of this Frame, taking trim into account. - * - * @name Phaser.Textures.Frame#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; + return gameObject; +}; - /** - * The rendering width of this Frame, taking trim into account. - * - * @name Phaser.Textures.Frame#width - * @type {number} - * @since 3.0.0 - */ - this.width; +module.exports = BottomLeft; - /** - * The rendering height of this Frame, taking trim into account. - * - * @name Phaser.Textures.Frame#height - * @type {number} - * @since 3.0.0 - */ - this.height; - /** - * Half the width, floored. - * Precalculated for the renderer. - * - * @name Phaser.Textures.Frame#halfWidth - * @type {number} - * @since 3.0.0 - */ - this.halfWidth; +/***/ }), - /** - * Half the height, floored. - * Precalculated for the renderer. - * - * @name Phaser.Textures.Frame#halfHeight - * @type {number} - * @since 3.0.0 - */ - this.halfHeight; +/***/ 9605: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The x center of this frame, floored. - * - * @name Phaser.Textures.Frame#centerX - * @type {number} - * @since 3.0.0 - */ - this.centerX; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The y center of this frame, floored. - * - * @name Phaser.Textures.Frame#centerY - * @type {number} - * @since 3.0.0 - */ - this.centerY; +var GetBottom = __webpack_require__(97328); +var GetRight = __webpack_require__(70271); +var SetBottom = __webpack_require__(73174); +var SetRight = __webpack_require__(19298); - /** - * The horizontal pivot point of this Frame. - * - * @name Phaser.Textures.Frame#pivotX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.pivotX = 0; +/** + * Takes given Game Object and aligns it so that it is positioned in the bottom right of the other. + * + * @function Phaser.Display.Align.In.BottomRight + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var BottomRight = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * The vertical pivot point of this Frame. - * - * @name Phaser.Textures.Frame#pivotY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.pivotY = 0; + SetRight(gameObject, GetRight(alignIn) + offsetX); + SetBottom(gameObject, GetBottom(alignIn) + offsetY); - /** - * Does this Frame have a custom pivot point? - * - * @name Phaser.Textures.Frame#customPivot - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.customPivot = false; + return gameObject; +}; - /** - * **CURRENTLY UNSUPPORTED** - * - * Is this frame is rotated or not in the Texture? - * Rotation allows you to use rotated frames in texture atlas packing. - * It has nothing to do with Sprite rotation. - * - * @name Phaser.Textures.Frame#rotated - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.rotated = false; +module.exports = BottomRight; - /** - * Over-rides the Renderer setting. - * -1 = use Renderer Setting - * 0 = No rounding - * 1 = Round - * - * @name Phaser.Textures.Frame#autoRound - * @type {number} - * @default -1 - * @since 3.0.0 - */ - this.autoRound = -1; - /** - * Any Frame specific custom data can be stored here. - * - * @name Phaser.Textures.Frame#customData - * @type {object} - * @since 3.0.0 - */ - this.customData = {}; +/***/ }), - /** - * WebGL UV u0 value. - * - * @name Phaser.Textures.Frame#u0 - * @type {number} - * @default 0 - * @since 3.11.0 - */ - this.u0 = 0; +/***/ 22529: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * WebGL UV v0 value. - * - * @name Phaser.Textures.Frame#v0 - * @type {number} - * @default 0 - * @since 3.11.0 - */ - this.v0 = 0; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * WebGL UV u1 value. - * - * @name Phaser.Textures.Frame#u1 - * @type {number} - * @default 0 - * @since 3.11.0 - */ - this.u1 = 0; +var CenterOn = __webpack_require__(21843); +var GetCenterX = __webpack_require__(59994); +var GetCenterY = __webpack_require__(29568); - /** - * WebGL UV v1 value. - * - * @name Phaser.Textures.Frame#v1 - * @type {number} - * @default 0 - * @since 3.11.0 - */ - this.v1 = 0; +/** + * Takes given Game Object and aligns it so that it is positioned in the center of the other. + * + * @function Phaser.Display.Align.In.Center + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var Center = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * The un-modified source frame, trim and UV data. - * - * @name Phaser.Textures.Frame#data - * @type {object} - * @private - * @since 3.0.0 - */ - this.data = { - cut: { - x: 0, - y: 0, - w: 0, - h: 0, - r: 0, - b: 0 - }, - trim: false, - sourceSize: { - w: 0, - h: 0 - }, - spriteSourceSize: { - x: 0, - y: 0, - w: 0, - h: 0, - r: 0, - b: 0 - }, - radius: 0, - drawImage: { - x: 0, - y: 0, - width: 0, - height: 0 - } - }; + CenterOn(gameObject, GetCenterX(alignIn) + offsetX, GetCenterY(alignIn) + offsetY); - this.setSize(width, height, x, y); - }, + return gameObject; +}; - /** - * Sets the width, height, x and y of this Frame. - * - * This is called automatically by the constructor - * and should rarely be changed on-the-fly. - * - * @method Phaser.Textures.Frame#setSize - * @since 3.7.0 - * - * @param {number} width - The width of the frame before being trimmed. - * @param {number} height - The height of the frame before being trimmed. - * @param {number} [x=0] - The x coordinate of the top-left of this Frame. - * @param {number} [y=0] - The y coordinate of the top-left of this Frame. - * - * @return {Phaser.Textures.Frame} This Frame object. - */ - setSize: function (width, height, x, y) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } +module.exports = Center; - this.cutX = x; - this.cutY = y; - this.cutWidth = width; - this.cutHeight = height; - this.width = width; - this.height = height; +/***/ }), - this.halfWidth = Math.floor(width * 0.5); - this.halfHeight = Math.floor(height * 0.5); +/***/ 5739: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.centerX = Math.floor(width / 2); - this.centerY = Math.floor(height / 2); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var data = this.data; - var cut = data.cut; +var GetCenterY = __webpack_require__(29568); +var GetLeft = __webpack_require__(40163); +var SetCenterY = __webpack_require__(81711); +var SetLeft = __webpack_require__(74465); - cut.x = x; - cut.y = y; - cut.w = width; - cut.h = height; - cut.r = x + width; - cut.b = y + height; +/** + * Takes given Game Object and aligns it so that it is positioned in the left center of the other. + * + * @function Phaser.Display.Align.In.LeftCenter + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var LeftCenter = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - data.sourceSize.w = width; - data.sourceSize.h = height; + SetLeft(gameObject, GetLeft(alignIn) - offsetX); + SetCenterY(gameObject, GetCenterY(alignIn) + offsetY); - data.spriteSourceSize.w = width; - data.spriteSourceSize.h = height; + return gameObject; +}; - data.radius = 0.5 * Math.sqrt(width * width + height * height); +module.exports = LeftCenter; - var drawImage = data.drawImage; - drawImage.x = x; - drawImage.y = y; - drawImage.width = width; - drawImage.height = height; +/***/ }), - return this.updateUVs(); - }, +/***/ 40327: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * If the frame was trimmed when added to the Texture Atlas, this records the trim and source data. - * - * @method Phaser.Textures.Frame#setTrim - * @since 3.0.0 - * - * @param {number} actualWidth - The width of the frame before being trimmed. - * @param {number} actualHeight - The height of the frame before being trimmed. - * @param {number} destX - The destination X position of the trimmed frame for display. - * @param {number} destY - The destination Y position of the trimmed frame for display. - * @param {number} destWidth - The destination width of the trimmed frame for display. - * @param {number} destHeight - The destination height of the trimmed frame for display. - * - * @return {Phaser.Textures.Frame} This Frame object. - */ - setTrim: function (actualWidth, actualHeight, destX, destY, destWidth, destHeight) - { - var data = this.data; - var ss = data.spriteSourceSize; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Store actual values +var ALIGN_CONST = __webpack_require__(84093); - data.trim = true; +var AlignInMap = []; - data.sourceSize.w = actualWidth; - data.sourceSize.h = actualHeight; +AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(32058); +AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(85535); +AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(9605); +AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(22529); +AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(5739); +AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(27683); +AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(96439); +AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(81447); +AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(47888); +AlignInMap[ALIGN_CONST.LEFT_BOTTOM] = AlignInMap[ALIGN_CONST.BOTTOM_LEFT]; +AlignInMap[ALIGN_CONST.LEFT_TOP] = AlignInMap[ALIGN_CONST.TOP_LEFT]; +AlignInMap[ALIGN_CONST.RIGHT_BOTTOM] = AlignInMap[ALIGN_CONST.BOTTOM_RIGHT]; +AlignInMap[ALIGN_CONST.RIGHT_TOP] = AlignInMap[ALIGN_CONST.TOP_RIGHT]; - ss.x = destX; - ss.y = destY; - ss.w = destWidth; - ss.h = destHeight; - ss.r = destX + destWidth; - ss.b = destY + destHeight; +/** + * Takes given Game Object and aligns it so that it is positioned relative to the other. + * The alignment used is based on the `position` argument, which is an `ALIGN_CONST` value, such as `LEFT_CENTER` or `TOP_RIGHT`. + * + * @function Phaser.Display.Align.In.QuickSet + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [child,$return] + * + * @param {Phaser.GameObjects.GameObject} child - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} position - The position to align the Game Object with. This is an align constant, such as `ALIGN_CONST.LEFT_CENTER`. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var QuickSet = function (child, alignIn, position, offsetX, offsetY) +{ + return AlignInMap[position](child, alignIn, offsetX, offsetY); +}; - // Adjust properties - this.x = destX; - this.y = destY; +module.exports = QuickSet; - this.width = destWidth; - this.height = destHeight; - this.halfWidth = destWidth * 0.5; - this.halfHeight = destHeight * 0.5; +/***/ }), - this.centerX = Math.floor(destWidth / 2); - this.centerY = Math.floor(destHeight / 2); +/***/ 27683: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this.updateUVs(); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Takes a crop data object and, based on the rectangular region given, calculates the - * required UV coordinates in order to crop this Frame for WebGL and Canvas rendering. - * - * This is called directly by the Game Object Texture Components `setCrop` method. - * Please use that method to crop a Game Object. - * - * @method Phaser.Textures.Frame#setCropUVs - * @since 3.11.0 - * - * @param {object} crop - The crop data object. This is the `GameObject._crop` property. - * @param {number} x - The x coordinate to start the crop from. Cannot be negative or exceed the Frame width. - * @param {number} y - The y coordinate to start the crop from. Cannot be negative or exceed the Frame height. - * @param {number} width - The width of the crop rectangle. Cannot exceed the Frame width. - * @param {number} height - The height of the crop rectangle. Cannot exceed the Frame height. - * @param {boolean} flipX - Does the parent Game Object have flipX set? - * @param {boolean} flipY - Does the parent Game Object have flipY set? - * - * @return {object} The updated crop data object. - */ - setCropUVs: function (crop, x, y, width, height, flipX, flipY) - { - // Clamp the input values +var GetCenterY = __webpack_require__(29568); +var GetRight = __webpack_require__(70271); +var SetCenterY = __webpack_require__(81711); +var SetRight = __webpack_require__(19298); - var cx = this.cutX; - var cy = this.cutY; - var cw = this.cutWidth; - var ch = this.cutHeight; - var rw = this.realWidth; - var rh = this.realHeight; +/** + * Takes given Game Object and aligns it so that it is positioned in the right center of the other. + * + * @function Phaser.Display.Align.In.RightCenter + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var RightCenter = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - x = Clamp(x, 0, rw); - y = Clamp(y, 0, rh); + SetRight(gameObject, GetRight(alignIn) + offsetX); + SetCenterY(gameObject, GetCenterY(alignIn) + offsetY); - width = Clamp(width, 0, rw - x); - height = Clamp(height, 0, rh - y); + return gameObject; +}; - var ox = cx + x; - var oy = cy + y; - var ow = width; - var oh = height; +module.exports = RightCenter; - var data = this.data; - if (data.trim) - { - var ss = data.spriteSourceSize; +/***/ }), - // Need to check for intersection between the cut area and the crop area - // If there is none, we set UV to be empty, otherwise set it to be the intersection area +/***/ 96439: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - width = Clamp(width, 0, cw - x); - height = Clamp(height, 0, ch - y); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var cropRight = x + width; - var cropBottom = y + height; +var GetCenterX = __webpack_require__(59994); +var GetTop = __webpack_require__(47196); +var SetCenterX = __webpack_require__(28417); +var SetTop = __webpack_require__(84349); - var intersects = !(ss.r < x || ss.b < y || ss.x > cropRight || ss.y > cropBottom); +/** + * Takes given Game Object and aligns it so that it is positioned in the top center of the other. + * + * @function Phaser.Display.Align.In.TopCenter + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopCenter = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - if (intersects) - { - var ix = Math.max(ss.x, x); - var iy = Math.max(ss.y, y); - var iw = Math.min(ss.r, cropRight) - ix; - var ih = Math.min(ss.b, cropBottom) - iy; + SetCenterX(gameObject, GetCenterX(alignIn) + offsetX); + SetTop(gameObject, GetTop(alignIn) - offsetY); - ow = iw; - oh = ih; + return gameObject; +}; - if (flipX) - { - ox = cx + (cw - (ix - ss.x) - iw); - } - else - { - ox = cx + (ix - ss.x); - } +module.exports = TopCenter; - if (flipY) - { - oy = cy + (ch - (iy - ss.y) - ih); - } - else - { - oy = cy + (iy - ss.y); - } - x = ix; - y = iy; +/***/ }), - width = iw; - height = ih; - } - else - { - ox = 0; - oy = 0; - ow = 0; - oh = 0; - } - } - else - { - if (flipX) - { - ox = cx + (cw - x - width); - } +/***/ 81447: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (flipY) - { - oy = cy + (ch - y - height); - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var tw = this.source.width; - var th = this.source.height; +var GetLeft = __webpack_require__(40163); +var GetTop = __webpack_require__(47196); +var SetLeft = __webpack_require__(74465); +var SetTop = __webpack_require__(84349); - // Map the given coordinates into UV space, clamping to the 0-1 range. +/** + * Takes given Game Object and aligns it so that it is positioned in the top left of the other. + * + * @function Phaser.Display.Align.In.TopLeft + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopLeft = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - crop.u0 = Math.max(0, ox / tw); - crop.v0 = Math.max(0, oy / th); - crop.u1 = Math.min(1, (ox + ow) / tw); - crop.v1 = Math.min(1, (oy + oh) / th); + SetLeft(gameObject, GetLeft(alignIn) - offsetX); + SetTop(gameObject, GetTop(alignIn) - offsetY); - crop.x = x; - crop.y = y; + return gameObject; +}; - crop.cx = ox; - crop.cy = oy; - crop.cw = ow; - crop.ch = oh; +module.exports = TopLeft; - crop.width = width; - crop.height = height; - crop.flipX = flipX; - crop.flipY = flipY; +/***/ }), - return crop; - }, +/***/ 47888: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Takes a crop data object and recalculates the UVs based on the dimensions inside the crop object. - * Called automatically by `setFrame`. - * - * @method Phaser.Textures.Frame#updateCropUVs - * @since 3.11.0 - * - * @param {object} crop - The crop data object. This is the `GameObject._crop` property. - * @param {boolean} flipX - Does the parent Game Object have flipX set? - * @param {boolean} flipY - Does the parent Game Object have flipY set? - * - * @return {object} The updated crop data object. - */ - updateCropUVs: function (crop, flipX, flipY) - { - return this.setCropUVs(crop, crop.x, crop.y, crop.width, crop.height, flipX, flipY); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Directly sets the canvas and WebGL UV data for this frame. - * - * Use this if you need to override the values that are generated automatically - * when the Frame is created. - * - * @method Phaser.Textures.Frame#setUVs - * @since 3.50.0 - * - * @param {number} width - Width of this frame for the Canvas data. - * @param {number} height - Height of this frame for the Canvas data. - * @param {number} u0 - UV u0 value. - * @param {number} v0 - UV v0 value. - * @param {number} u1 - UV u1 value. - * @param {number} v1 - UV v1 value. - * - * @return {Phaser.Textures.Frame} This Frame object. - */ - setUVs: function (width, height, u0, v0, u1, v1) - { - // Canvas data +var GetRight = __webpack_require__(70271); +var GetTop = __webpack_require__(47196); +var SetRight = __webpack_require__(19298); +var SetTop = __webpack_require__(84349); - var cd = this.data.drawImage; +/** + * Takes given Game Object and aligns it so that it is positioned in the top right of the other. + * + * @function Phaser.Display.Align.In.TopRight + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopRight = function (gameObject, alignIn, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - cd.width = width; - cd.height = height; + SetRight(gameObject, GetRight(alignIn) + offsetX); + SetTop(gameObject, GetTop(alignIn) - offsetY); - // WebGL data + return gameObject; +}; - this.u0 = u0; - this.v0 = v0; +module.exports = TopRight; - this.u1 = u1; - this.v1 = v1; - return this; - }, +/***/ }), - /** - * Updates the internal WebGL UV cache and the drawImage cache. - * - * @method Phaser.Textures.Frame#updateUVs - * @since 3.0.0 - * - * @return {Phaser.Textures.Frame} This Frame object. - */ - updateUVs: function () - { - var cx = this.cutX; - var cy = this.cutY; - var cw = this.cutWidth; - var ch = this.cutHeight; +/***/ 46997: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Canvas data +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var cd = this.data.drawImage; +/** + * @namespace Phaser.Display.Align.In + */ - cd.width = cw; - cd.height = ch; +module.exports = { - // WebGL data + BottomCenter: __webpack_require__(32058), + BottomLeft: __webpack_require__(85535), + BottomRight: __webpack_require__(9605), + Center: __webpack_require__(22529), + LeftCenter: __webpack_require__(5739), + QuickSet: __webpack_require__(40327), + RightCenter: __webpack_require__(27683), + TopCenter: __webpack_require__(96439), + TopLeft: __webpack_require__(81447), + TopRight: __webpack_require__(47888) - var tw = this.source.width; - var th = this.source.height; +}; - this.u0 = cx / tw; - this.v0 = cy / th; - this.u1 = (cx + cw) / tw; - this.v1 = (cy + ch) / th; +/***/ }), - return this; - }, +/***/ 93545: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Updates the internal WebGL UV cache. - * - * @method Phaser.Textures.Frame#updateUVsInverted - * @since 3.0.0 - * - * @return {Phaser.Textures.Frame} This Frame object. - */ - updateUVsInverted: function () - { - var tw = this.source.width; - var th = this.source.height; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.u0 = (this.cutX + this.cutHeight) / tw; - this.v0 = this.cutY / th; +var CONST = __webpack_require__(84093); +var Extend = __webpack_require__(98611); - this.u1 = this.cutX / tw; - this.v1 = (this.cutY + this.cutWidth) / th; +/** + * @namespace Phaser.Display.Align + */ - return this; - }, +var Align = { - /** - * Clones this Frame into a new Frame object. - * - * @method Phaser.Textures.Frame#clone - * @since 3.0.0 - * - * @return {Phaser.Textures.Frame} A clone of this Frame. - */ - clone: function () - { - var clone = new Frame(this.texture, this.name, this.sourceIndex); + In: __webpack_require__(46997), + To: __webpack_require__(86639) - clone.cutX = this.cutX; - clone.cutY = this.cutY; - clone.cutWidth = this.cutWidth; - clone.cutHeight = this.cutHeight; +}; - clone.x = this.x; - clone.y = this.y; +// Merge in the consts +Align = Extend(false, Align, CONST); - clone.width = this.width; - clone.height = this.height; +module.exports = Align; - clone.halfWidth = this.halfWidth; - clone.halfHeight = this.halfHeight; - clone.centerX = this.centerX; - clone.centerY = this.centerY; +/***/ }), - clone.rotated = this.rotated; +/***/ 27118: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - clone.data = Extend(true, clone.data, this.data); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - clone.updateUVs(); +var GetBottom = __webpack_require__(97328); +var GetCenterX = __webpack_require__(59994); +var SetCenterX = __webpack_require__(28417); +var SetTop = __webpack_require__(84349); - return clone; - }, +/** + * Takes given Game Object and aligns it so that it is positioned next to the bottom center position of the other. + * + * @function Phaser.Display.Align.To.BottomCenter + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var BottomCenter = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * Destroys this Frame by nulling its reference to the parent Texture and and data objects. - * - * @method Phaser.Textures.Frame#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.source = null; - this.texture = null; - this.glTexture = null; - this.customData = null; - this.data = null; - }, + SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); - /** - * The width of the Frame in its un-trimmed, un-padded state, as prepared in the art package, - * before being packed. - * - * @name Phaser.Textures.Frame#realWidth - * @type {number} - * @readonly - * @since 3.0.0 - */ - realWidth: { + return gameObject; +}; - get: function () - { - return this.data.sourceSize.w; - } +module.exports = BottomCenter; - }, - /** - * The height of the Frame in its un-trimmed, un-padded state, as prepared in the art package, - * before being packed. - * - * @name Phaser.Textures.Frame#realHeight - * @type {number} - * @readonly - * @since 3.0.0 - */ - realHeight: { +/***/ }), - get: function () - { - return this.data.sourceSize.h; - } +/***/ 84469: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The radius of the Frame (derived from sqrt(w * w + h * h) / 2) - * - * @name Phaser.Textures.Frame#radius - * @type {number} - * @readonly - * @since 3.0.0 - */ - radius: { +var GetBottom = __webpack_require__(97328); +var GetLeft = __webpack_require__(40163); +var SetLeft = __webpack_require__(74465); +var SetTop = __webpack_require__(84349); - get: function () - { - return this.data.radius; - } +/** + * Takes given Game Object and aligns it so that it is positioned next to the bottom left position of the other. + * + * @function Phaser.Display.Align.To.BottomLeft + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var BottomLeft = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - }, + SetLeft(gameObject, GetLeft(alignTo) - offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); - /** - * Is the Frame trimmed or not? - * - * @name Phaser.Textures.Frame#trimmed - * @type {boolean} - * @readonly - * @since 3.0.0 - */ - trimmed: { + return gameObject; +}; - get: function () - { - return this.data.trim; - } +module.exports = BottomLeft; - }, - /** - * The Canvas drawImage data object. - * - * @name Phaser.Textures.Frame#canvasData - * @type {object} - * @readonly - * @since 3.0.0 - */ - canvasData: { +/***/ }), - get: function () - { - return this.data.drawImage; - } +/***/ 51577: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -}); +var GetBottom = __webpack_require__(97328); +var GetRight = __webpack_require__(70271); +var SetRight = __webpack_require__(19298); +var SetTop = __webpack_require__(84349); -module.exports = Frame; +/** + * Takes given Game Object and aligns it so that it is positioned next to the bottom right position of the other. + * + * @function Phaser.Display.Align.To.BottomRight + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var BottomRight = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } + + SetRight(gameObject, GetRight(alignTo) + offsetX); + SetTop(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = BottomRight; /***/ }), -/* 110 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 90271: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayUtils = __webpack_require__(208); -var Class = __webpack_require__(0); -var NOOP = __webpack_require__(1); -var StableSort = __webpack_require__(79); +var GetBottom = __webpack_require__(97328); +var GetLeft = __webpack_require__(40163); +var SetBottom = __webpack_require__(73174); +var SetRight = __webpack_require__(19298); /** - * @callback EachListCallback + * Takes given Game Object and aligns it so that it is positioned next to the left bottom position of the other. * - * @param {I} item - The item which is currently being processed. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + * @function Phaser.Display.Align.To.LeftBottom + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var LeftBottom = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } + + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetBottom(gameObject, GetBottom(alignTo) + offsetY); + + return gameObject; +}; + +module.exports = LeftBottom; + + +/***/ }), + +/***/ 30466: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var GetCenterY = __webpack_require__(29568); +var GetLeft = __webpack_require__(40163); +var SetCenterY = __webpack_require__(81711); +var SetRight = __webpack_require__(19298); + /** - * @classdesc - * List is a generic implementation of an ordered list which contains utility methods for retrieving, manipulating, and iterating items. + * Takes given Game Object and aligns it so that it is positioned next to the left center position of the other. * - * @class List - * @memberof Phaser.Structs - * @constructor + * @function Phaser.Display.Align.To.LeftCenter * @since 3.0.0 * - * @generic T + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] * - * @param {*} parent - The parent of this list. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. */ -var List = new Class({ +var LeftCenter = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - initialize: + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); - function List (parent) - { - /** - * The parent of this list. - * - * @name Phaser.Structs.List#parent - * @type {*} - * @since 3.0.0 - */ - this.parent = parent; + return gameObject; +}; - /** - * The objects that belong to this collection. - * - * @genericUse {T[]} - [$type] - * - * @name Phaser.Structs.List#list - * @type {Array.<*>} - * @default [] - * @since 3.0.0 - */ - this.list = []; +module.exports = LeftCenter; - /** - * The index of the current element. - * - * This is used internally when iterating through the list with the {@link #first}, {@link #last}, {@link #get}, and {@link #previous} properties. - * - * @name Phaser.Structs.List#position - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.position = 0; - /** - * A callback that is invoked every time a child is added to this list. - * - * @name Phaser.Structs.List#addCallback - * @type {function} - * @since 3.4.0 - */ - this.addCallback = NOOP; +/***/ }), - /** - * A callback that is invoked every time a child is removed from this list. - * - * @name Phaser.Structs.List#removeCallback - * @type {function} - * @since 3.4.0 - */ - this.removeCallback = NOOP; +/***/ 50087: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The property key to sort by. - * - * @name Phaser.Structs.List#_sortKey - * @type {string} - * @since 3.4.0 - */ - this._sortKey = ''; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Adds the given item to the end of the list. Each item must be unique. - * - * @method Phaser.Structs.List#add - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*|Array.<*>} child - The item, or array of items, to add to the list. - * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully. - * - * @return {*} The list's underlying array. - */ - add: function (child, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.Add(this.list, child); - } - else - { - return ArrayUtils.Add(this.list, child, 0, this.addCallback, this); - } - }, +var GetLeft = __webpack_require__(40163); +var GetTop = __webpack_require__(47196); +var SetRight = __webpack_require__(19298); +var SetTop = __webpack_require__(84349); - /** - * Adds an item to list, starting at a specified index. Each item must be unique within the list. - * - * @method Phaser.Structs.List#addAt - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item, or array of items, to add to the list. - * @param {number} [index=0] - The index in the list at which the element(s) will be inserted. - * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully. - * - * @return {*} The List's underlying array. - */ - addAt: function (child, index, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.AddAt(this.list, child, index); - } - else - { - return ArrayUtils.AddAt(this.list, child, index, 0, this.addCallback, this); - } - }, +/** + * Takes given Game Object and aligns it so that it is positioned next to the left top position of the other. + * + * @function Phaser.Display.Align.To.LeftTop + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var LeftTop = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * Retrieves the item at a given position inside the List. - * - * @method Phaser.Structs.List#getAt - * @since 3.0.0 - * - * @genericUse {T} - [$return] - * - * @param {number} index - The index of the item. - * - * @return {*} The retrieved item, or `undefined` if it's outside the List's bounds. - */ - getAt: function (index) - { - return this.list[index]; - }, + SetRight(gameObject, GetLeft(alignTo) - offsetX); + SetTop(gameObject, GetTop(alignTo) - offsetY); - /** - * Locates an item within the List and returns its index. - * - * @method Phaser.Structs.List#getIndex - * @since 3.0.0 - * - * @genericUse {T} - [child] - * - * @param {*} child - The item to locate. - * - * @return {number} The index of the item within the List, or -1 if it's not in the List. - */ - getIndex: function (child) - { - // Return -1 if given child isn't a child of this display list - return this.list.indexOf(child); - }, + return gameObject; +}; - /** - * Sort the contents of this List so the items are in order based on the given property. - * For example, `sort('alpha')` would sort the List contents based on the value of their `alpha` property. - * - * @method Phaser.Structs.List#sort - * @since 3.0.0 - * - * @genericUse {T[]} - [children,$return] - * - * @param {string} property - The property to lexically sort by. - * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. - * - * @return {Phaser.Structs.List} This List object. - */ - sort: function (property, handler) - { - if (!property) - { - return this; - } +module.exports = LeftTop; - if (handler === undefined) - { - handler = function (childA, childB) - { - return childA[property] - childB[property]; - }; - } - StableSort(this.list, handler); +/***/ }), - return this; - }, +/***/ 82590: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Searches for the first instance of a child with its `name` - * property matching the given argument. Should more than one child have - * the same name only the first is returned. - * - * @method Phaser.Structs.List#getByName - * @since 3.0.0 - * - * @genericUse {T | null} - [$return] - * - * @param {string} name - The name to search for. - * - * @return {?*} The first child with a matching name, or null if none were found. - */ - getByName: function (name) - { - return ArrayUtils.GetFirst(this.list, 'name', name); - }, +/** + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Returns a random child from the group. - * - * @method Phaser.Structs.List#getRandom - * @since 3.0.0 - * - * @genericUse {T | null} - [$return] - * - * @param {number} [startIndex=0] - Offset from the front of the group (lowest child). - * @param {number} [length=(to top)] - Restriction on the number of values you want to randomly select from. - * - * @return {?*} A random child of this Group. - */ - getRandom: function (startIndex, length) - { - return ArrayUtils.GetRandom(this.list, startIndex, length); - }, +var ALIGN_CONST = __webpack_require__(84093); - /** - * Returns the first element in a given part of the List which matches a specific criterion. - * - * @method Phaser.Structs.List#getFirst - * @since 3.0.0 - * - * @genericUse {T | null} - [$return] - * - * @param {string} property - The name of the property to test or a falsey value to have no criterion. - * @param {*} value - The value to test the `property` against, or `undefined` to allow any value and only check for existence. - * @param {number} [startIndex=0] - The position in the List to start the search at. - * @param {number} [endIndex] - The position in the List to optionally stop the search at. It won't be checked. - * - * @return {?*} The first item which matches the given criterion, or `null` if no such item exists. - */ - getFirst: function (property, value, startIndex, endIndex) - { - return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); - }, +var AlignToMap = []; - /** - * Returns all children in this List. - * - * You can optionally specify a matching criteria using the `property` and `value` arguments. - * - * For example: `getAll('parent')` would return only children that have a property called `parent`. - * - * You can also specify a value to compare the property to: - * - * `getAll('visible', true)` would return only children that have their visible property set to `true`. - * - * Optionally you can specify a start and end index. For example if this List had 100 children, - * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only - * the first 50 children in the List. - * - * @method Phaser.Structs.List#getAll - * @since 3.0.0 - * - * @genericUse {T} - [value] - * @genericUse {T[]} - [$return] - * - * @param {string} [property] - An optional property to test against the value argument. - * @param {*} [value] - If property is set then Child.property must strictly equal this value to be included in the results. - * @param {number} [startIndex] - The first child index to start the search from. - * @param {number} [endIndex] - The last child index to search up until. - * - * @return {Array.<*>} All items of the List which match the given criterion, if any. - */ - getAll: function (property, value, startIndex, endIndex) - { - return ArrayUtils.GetAll(this.list, property, value, startIndex, endIndex); - }, +AlignToMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(27118); +AlignToMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(84469); +AlignToMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(51577); +AlignToMap[ALIGN_CONST.LEFT_BOTTOM] = __webpack_require__(90271); +AlignToMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(30466); +AlignToMap[ALIGN_CONST.LEFT_TOP] = __webpack_require__(50087); +AlignToMap[ALIGN_CONST.RIGHT_BOTTOM] = __webpack_require__(13555); +AlignToMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(99049); +AlignToMap[ALIGN_CONST.RIGHT_TOP] = __webpack_require__(67788); +AlignToMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(78170); +AlignToMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(54145); +AlignToMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(75548); - /** - * Returns the total number of items in the List which have a property matching the given value. - * - * @method Phaser.Structs.List#count - * @since 3.0.0 - * - * @genericUse {T} - [value] - * - * @param {string} property - The property to test on each item. - * @param {*} value - The value to test the property against. - * - * @return {number} The total number of matching elements. - */ - count: function (property, value) - { - return ArrayUtils.CountAllMatching(this.list, property, value); - }, +/** + * Takes a Game Object and aligns it next to another, at the given position. + * The alignment used is based on the `position` argument, which is a `Phaser.Display.Align` property such as `LEFT_CENTER` or `TOP_RIGHT`. + * + * @function Phaser.Display.Align.To.QuickSet + * @since 3.22.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [child,$return] + * + * @param {Phaser.GameObjects.GameObject} child - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} position - The position to align the Game Object with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var QuickSet = function (child, alignTo, position, offsetX, offsetY) +{ + return AlignToMap[position](child, alignTo, offsetX, offsetY); +}; - /** - * Swaps the positions of two items in the list. - * - * @method Phaser.Structs.List#swap - * @since 3.0.0 - * - * @genericUse {T} - [child1,child2] - * - * @param {*} child1 - The first item to swap. - * @param {*} child2 - The second item to swap. - */ - swap: function (child1, child2) - { - ArrayUtils.Swap(this.list, child1, child2); - }, +module.exports = QuickSet; - /** - * Moves an item in the List to a new position. - * - * @method Phaser.Structs.List#moveTo - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to move. - * @param {number} index - Moves an item in the List to a new position. - * - * @return {*} The item that was moved. - */ - moveTo: function (child, index) - { - return ArrayUtils.MoveTo(this.list, child, index); - }, - /** - * Moves the given array element above another one in the array. - * - * @method Phaser.Structs.List#moveAbove - * @since 3.55.0 - * - * @genericUse {T} - [child1,child2] - * - * @param {*} child1 - The element to move above base element. - * @param {*} child2 - The base element. - */ - moveAbove: function (child1, child2) - { - return ArrayUtils.MoveAbove(this.list, child1, child2); - }, +/***/ }), - /** - * Moves the given array element below another one in the array. - * - * @method Phaser.Structs.List#moveBelow - * @since 3.55.0 - * - * @genericUse {T} - [child1,child2] - * - * @param {*} child1 - The element to move below base element. - * @param {*} child2 - The base element. - */ - moveBelow: function (child1, child2) - { - return ArrayUtils.MoveBelow(this.list, child1, child2); - }, +/***/ 13555: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Removes one or many items from the List. - * - * @method Phaser.Structs.List#remove - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item, or array of items, to remove. - * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. - * - * @return {*} The item, or array of items, which were successfully removed from the List. - */ - remove: function (child, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.Remove(this.list, child); - } - else - { - return ArrayUtils.Remove(this.list, child, this.removeCallback, this); - } - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Removes the item at the given position in the List. - * - * @method Phaser.Structs.List#removeAt - * @since 3.0.0 - * - * @genericUse {T} - [$return] - * - * @param {number} index - The position to remove the item from. - * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. - * - * @return {*} The item that was removed. - */ - removeAt: function (index, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.RemoveAt(this.list, index); - } - else - { - return ArrayUtils.RemoveAt(this.list, index, this.removeCallback, this); - } - }, +var GetBottom = __webpack_require__(97328); +var GetRight = __webpack_require__(70271); +var SetBottom = __webpack_require__(73174); +var SetLeft = __webpack_require__(74465); - /** - * Removes the items within the given range in the List. - * - * @method Phaser.Structs.List#removeBetween - * @since 3.0.0 - * - * @genericUse {T[]} - [$return] - * - * @param {number} [startIndex=0] - The index to start removing from. - * @param {number} [endIndex] - The position to stop removing at. The item at this position won't be removed. - * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. - * - * @return {Array.<*>} An array of the items which were removed. - */ - removeBetween: function (startIndex, endIndex, skipCallback) - { - if (skipCallback) - { - return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex); - } - else - { - return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex, this.removeCallback, this); - } - }, +/** + * Takes given Game Object and aligns it so that it is positioned next to the right bottom position of the other. + * + * @function Phaser.Display.Align.To.RightBottom + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var RightBottom = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * Removes all the items. - * - * @method Phaser.Structs.List#removeAll - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.List.} - [$return] - * - * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. - * - * @return {Phaser.Structs.List} This List object. - */ - removeAll: function (skipCallback) - { - var i = this.list.length; + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetBottom(gameObject, GetBottom(alignTo) + offsetY); - while (i--) - { - this.remove(this.list[i], skipCallback); - } + return gameObject; +}; - return this; - }, +module.exports = RightBottom; - /** - * Brings the given child to the top of this List. - * - * @method Phaser.Structs.List#bringToTop - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to bring to the top of the List. - * - * @return {*} The item which was moved. - */ - bringToTop: function (child) - { - return ArrayUtils.BringToTop(this.list, child); - }, - /** - * Sends the given child to the bottom of this List. - * - * @method Phaser.Structs.List#sendToBack - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to send to the back of the list. - * - * @return {*} The item which was moved. - */ - sendToBack: function (child) - { - return ArrayUtils.SendToBack(this.list, child); - }, +/***/ }), - /** - * Moves the given child up one place in this group unless it's already at the top. - * - * @method Phaser.Structs.List#moveUp - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to move up. - * - * @return {*} The item which was moved. - */ - moveUp: function (child) - { - ArrayUtils.MoveUp(this.list, child); +/***/ 99049: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return child; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Moves the given child down one place in this group unless it's already at the bottom. - * - * @method Phaser.Structs.List#moveDown - * @since 3.0.0 - * - * @genericUse {T} - [child,$return] - * - * @param {*} child - The item to move down. - * - * @return {*} The item which was moved. - */ - moveDown: function (child) - { - ArrayUtils.MoveDown(this.list, child); +var GetCenterY = __webpack_require__(29568); +var GetRight = __webpack_require__(70271); +var SetCenterY = __webpack_require__(81711); +var SetLeft = __webpack_require__(74465); - return child; - }, +/** + * Takes given Game Object and aligns it so that it is positioned next to the right center position of the other. + * + * @function Phaser.Display.Align.To.RightCenter + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var RightCenter = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * Reverses the order of all children in this List. - * - * @method Phaser.Structs.List#reverse - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.List.} - [$return] - * - * @return {Phaser.Structs.List} This List object. - */ - reverse: function () - { - this.list.reverse(); + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); - return this; - }, + return gameObject; +}; - /** - * Shuffles the items in the list. - * - * @method Phaser.Structs.List#shuffle - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.List.} - [$return] - * - * @return {Phaser.Structs.List} This List object. - */ - shuffle: function () - { - ArrayUtils.Shuffle(this.list); +module.exports = RightCenter; - return this; - }, - /** - * Replaces a child of this List with the given newChild. The newChild cannot be a member of this List. - * - * @method Phaser.Structs.List#replace - * @since 3.0.0 - * - * @genericUse {T} - [oldChild,newChild,$return] - * - * @param {*} oldChild - The child in this List that will be replaced. - * @param {*} newChild - The child to be inserted into this List. - * - * @return {*} Returns the oldChild that was replaced within this group. - */ - replace: function (oldChild, newChild) - { - return ArrayUtils.Replace(this.list, oldChild, newChild); - }, +/***/ }), - /** - * Checks if an item exists within the List. - * - * @method Phaser.Structs.List#exists - * @since 3.0.0 - * - * @genericUse {T} - [child] - * - * @param {*} child - The item to check for the existence of. - * - * @return {boolean} `true` if the item is found in the list, otherwise `false`. - */ - exists: function (child) - { - return (this.list.indexOf(child) > -1); - }, +/***/ 67788: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Sets the property `key` to the given value on all members of this List. - * - * @method Phaser.Structs.List#setAll - * @since 3.0.0 - * - * @genericUse {T} - [value] - * - * @param {string} property - The name of the property to set. - * @param {*} value - The value to set the property to. - * @param {number} [startIndex] - The first child index to start the search from. - * @param {number} [endIndex] - The last child index to search up until. - */ - setAll: function (property, value, startIndex, endIndex) - { - ArrayUtils.SetAll(this.list, property, value, startIndex, endIndex); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var GetRight = __webpack_require__(70271); +var GetTop = __webpack_require__(47196); +var SetLeft = __webpack_require__(74465); +var SetTop = __webpack_require__(84349); - /** - * Passes all children to the given callback. - * - * @method Phaser.Structs.List#each - * @since 3.0.0 - * - * @genericUse {EachListCallback.} - [callback] - * - * @param {EachListCallback} callback - The function to call. - * @param {*} [context] - Value to use as `this` when executing callback. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. - */ - each: function (callback, context) - { - var args = [ null ]; +/** + * Takes given Game Object and aligns it so that it is positioned next to the right top position of the other. + * + * @function Phaser.Display.Align.To.RightTop + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var RightTop = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - for (var i = 2; i < arguments.length; i++) - { - args.push(arguments[i]); - } + SetLeft(gameObject, GetRight(alignTo) + offsetX); + SetTop(gameObject, GetTop(alignTo) - offsetY); - for (i = 0; i < this.list.length; i++) - { - args[0] = this.list[i]; + return gameObject; +}; - callback.apply(context, args); - } - }, +module.exports = RightTop; - /** - * Clears the List and recreates its internal array. - * - * @method Phaser.Structs.List#shutdown - * @since 3.0.0 - */ - shutdown: function () - { - this.removeAll(); - this.list = []; - }, +/***/ }), - /** - * Destroys this List. - * - * @method Phaser.Structs.List#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.removeAll(); +/***/ 78170: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.parent = null; - this.addCallback = null; - this.removeCallback = null; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The number of items inside the List. - * - * @name Phaser.Structs.List#length - * @type {number} - * @readonly - * @since 3.0.0 - */ - length: { +var GetCenterX = __webpack_require__(59994); +var GetTop = __webpack_require__(47196); +var SetBottom = __webpack_require__(73174); +var SetCenterX = __webpack_require__(28417); - get: function () - { - return this.list.length; - } +/** + * Takes given Game Object and aligns it so that it is positioned next to the top center position of the other. + * + * @function Phaser.Display.Align.To.TopCenter + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopCenter = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - }, + SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); - /** - * The first item in the List or `null` for an empty List. - * - * @name Phaser.Structs.List#first - * @genericUse {T} - [$type] - * @type {*} - * @readonly - * @since 3.0.0 - */ - first: { + return gameObject; +}; - get: function () - { - this.position = 0; +module.exports = TopCenter; - if (this.list.length > 0) - { - return this.list[0]; - } - else - { - return null; - } - } - }, +/***/ }), - /** - * The last item in the List, or `null` for an empty List. - * - * @name Phaser.Structs.List#last - * @genericUse {T} - [$type] - * @type {*} - * @readonly - * @since 3.0.0 - */ - last: { +/***/ 54145: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - get: function () - { - if (this.list.length > 0) - { - this.position = this.list.length - 1; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this.list[this.position]; - } - else - { - return null; - } - } +var GetLeft = __webpack_require__(40163); +var GetTop = __webpack_require__(47196); +var SetBottom = __webpack_require__(73174); +var SetLeft = __webpack_require__(74465); - }, +/** + * Takes given Game Object and aligns it so that it is positioned next to the top left position of the other. + * + * @function Phaser.Display.Align.To.TopLeft + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopLeft = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - /** - * The next item in the List, or `null` if the entire List has been traversed. - * - * This property can be read successively after reading {@link #first} or manually setting the {@link #position} to iterate the List. - * - * @name Phaser.Structs.List#next - * @genericUse {T} - [$type] - * @type {*} - * @readonly - * @since 3.0.0 - */ - next: { + SetLeft(gameObject, GetLeft(alignTo) - offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); - get: function () - { - if (this.position < this.list.length) - { - this.position++; + return gameObject; +}; - return this.list[this.position]; - } - else - { - return null; - } - } +module.exports = TopLeft; - }, - /** - * The previous item in the List, or `null` if the entire List has been traversed. - * - * This property can be read successively after reading {@link #last} or manually setting the {@link #position} to iterate the List backwards. - * - * @name Phaser.Structs.List#previous - * @genericUse {T} - [$type] - * @type {*} - * @readonly - * @since 3.0.0 - */ - previous: { +/***/ }), - get: function () - { - if (this.position > 0) - { - this.position--; +/***/ 75548: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this.list[this.position]; - } - else - { - return null; - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - } +var GetRight = __webpack_require__(70271); +var GetTop = __webpack_require__(47196); +var SetBottom = __webpack_require__(73174); +var SetRight = __webpack_require__(19298); -}); +/** + * Takes given Game Object and aligns it so that it is positioned next to the top right position of the other. + * + * @function Phaser.Display.Align.To.TopRight + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. + * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. + * @param {number} [offsetX=0] - Optional horizontal offset from the position. + * @param {number} [offsetY=0] - Optional vertical offset from the position. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + */ +var TopRight = function (gameObject, alignTo, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } -module.exports = List; + SetRight(gameObject, GetRight(alignTo) + offsetX); + SetBottom(gameObject, GetTop(alignTo) - offsetY); + + return gameObject; +}; + +module.exports = TopRight; + + +/***/ }), + +/***/ 86639: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Display.Align.To + */ + +module.exports = { + + BottomCenter: __webpack_require__(27118), + BottomLeft: __webpack_require__(84469), + BottomRight: __webpack_require__(51577), + LeftBottom: __webpack_require__(90271), + LeftCenter: __webpack_require__(30466), + LeftTop: __webpack_require__(50087), + QuickSet: __webpack_require__(82590), + RightBottom: __webpack_require__(13555), + RightCenter: __webpack_require__(99049), + RightTop: __webpack_require__(67788), + TopCenter: __webpack_require__(78170), + TopLeft: __webpack_require__(54145), + TopRight: __webpack_require__(75548) + +}; /***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 21843: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Contains = __webpack_require__(112); -var GetPoint = __webpack_require__(445); -var GetPoints = __webpack_require__(446); -var GEOM_CONST = __webpack_require__(56); -var Random = __webpack_require__(180); +var SetCenterX = __webpack_require__(28417); +var SetCenterY = __webpack_require__(81711); /** - * @classdesc - * An Ellipse object. - * - * This is a geometry object, containing numerical values and related methods to inspect and modify them. - * It is not a Game Object, in that you cannot add it to the display list, and it has no texture. - * To render an Ellipse you should look at the capabilities of the Graphics class. + * Positions the Game Object so that it is centered on the given coordinates. * - * @class Ellipse - * @memberof Phaser.Geom - * @constructor + * @function Phaser.Display.Bounds.CenterOn * @since 3.0.0 * - * @param {number} [x=0] - The x position of the center of the ellipse. - * @param {number} [y=0] - The y position of the center of the ellipse. - * @param {number} [width=0] - The width of the ellipse. - * @param {number} [height=0] - The height of the ellipse. + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. + * @param {number} x - The horizontal coordinate to position the Game Object on. + * @param {number} y - The vertical coordinate to position the Game Object on. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. */ -var Ellipse = new Class({ +var CenterOn = function (gameObject, x, y) +{ + SetCenterX(gameObject, x); - initialize: + return SetCenterY(gameObject, y); +}; - function Ellipse (x, y, width, height) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = 0; } - if (height === undefined) { height = 0; } +module.exports = CenterOn; - /** - * The geometry constant type of this object: `GEOM_CONST.ELLIPSE`. - * Used for fast type comparisons. - * - * @name Phaser.Geom.Ellipse#type - * @type {number} - * @readonly - * @since 3.19.0 - */ - this.type = GEOM_CONST.ELLIPSE; - /** - * The x position of the center of the ellipse. - * - * @name Phaser.Geom.Ellipse#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.x = x; +/***/ }), - /** - * The y position of the center of the ellipse. - * - * @name Phaser.Geom.Ellipse#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = y; +/***/ 97328: +/***/ ((module) => { - /** - * The width of the ellipse. - * - * @name Phaser.Geom.Ellipse#width - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.width = width; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The height of the ellipse. - * - * @name Phaser.Geom.Ellipse#height - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.height = height; - }, +/** + * Returns the bottom coordinate from the bounds of the Game Object. + * + * @function Phaser.Display.Bounds.GetBottom + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. + * + * @return {number} The bottom coordinate of the bounds of the Game Object. + */ +var GetBottom = function (gameObject) +{ + return (gameObject.y + gameObject.height) - (gameObject.height * gameObject.originY); +}; - /** - * Check to see if the Ellipse contains the given x / y coordinates. - * - * @method Phaser.Geom.Ellipse#contains - * @since 3.0.0 - * - * @param {number} x - The x coordinate to check within the ellipse. - * @param {number} y - The y coordinate to check within the ellipse. - * - * @return {boolean} True if the coordinates are within the ellipse, otherwise false. - */ - contains: function (x, y) - { - return Contains(this, x, y); - }, +module.exports = GetBottom; - /** - * Returns a Point object containing the coordinates of a point on the circumference of the Ellipse - * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point - * at 180 degrees around the circle. - * - * @method Phaser.Geom.Ellipse#getPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse. - * @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created. - * - * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the ellipse. - */ - getPoint: function (position, point) - { - return GetPoint(this, position, point); - }, - /** - * Returns an array of Point objects containing the coordinates of the points around the circumference of the Ellipse, - * based on the given quantity or stepRate values. - * - * @method Phaser.Geom.Ellipse#getPoints - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point[]} O - [output,$return] - * - * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. - * @param {number} [stepRate] - Sets the quantity by getting the circumference of the ellipse and dividing it by the stepRate. - * @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created. - * - * @return {(array|Phaser.Geom.Point[])} An array of Point objects pertaining to the points around the circumference of the ellipse. - */ - getPoints: function (quantity, stepRate, output) - { - return GetPoints(this, quantity, stepRate, output); - }, +/***/ }), - /** - * Returns a uniformly distributed random point from anywhere within the given Ellipse. - * - * @method Phaser.Geom.Ellipse#getRandomPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [point,$return] - * - * @param {(Phaser.Geom.Point|object)} [point] - A Point or point-like object to set the random `x` and `y` values in. - * - * @return {(Phaser.Geom.Point|object)} A Point object with the random values set in the `x` and `y` properties. - */ - getRandomPoint: function (point) - { - return Random(this, point); - }, +/***/ 7126: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Sets the x, y, width and height of this ellipse. - * - * @method Phaser.Geom.Ellipse#setTo - * @since 3.0.0 - * - * @param {number} x - The x position of the center of the ellipse. - * @param {number} y - The y position of the center of the ellipse. - * @param {number} width - The width of the ellipse. - * @param {number} height - The height of the ellipse. - * - * @return {this} This Ellipse object. - */ - setTo: function (x, y, width, height) - { - this.x = x; - this.y = y; - this.width = width; - this.height = height; +/** + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var GetBottom = __webpack_require__(97328); +var GetLeft = __webpack_require__(40163); +var GetRight = __webpack_require__(70271); +var GetTop = __webpack_require__(47196); +var Rectangle = __webpack_require__(74118); - /** - * Sets this Ellipse to be empty with a width and height of zero. - * Does not change its position. - * - * @method Phaser.Geom.Ellipse#setEmpty - * @since 3.0.0 - * - * @return {this} This Ellipse object. - */ - setEmpty: function () - { - this.width = 0; - this.height = 0; +/** + * Returns the unrotated bounds of the Game Object as a rectangle. + * + * @function Phaser.Display.Bounds.GetBounds + * @since 3.24.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. + * @param {(Phaser.Geom.Rectangle|object)} [output] - An object to store the values in. If not provided a new Rectangle will be created. + * + * @return {(Phaser.Geom.Rectangle|object)} - The bounds of the Game Object. + */ +var GetBounds = function (gameObject, output) +{ + if (output === undefined) { output = new Rectangle(); } - return this; - }, + var left = GetLeft(gameObject); + var top = GetTop(gameObject); - /** - * Sets the position of this Ellipse. - * - * @method Phaser.Geom.Ellipse#setPosition - * @since 3.0.0 - * - * @param {number} x - The x position of the center of the ellipse. - * @param {number} y - The y position of the center of the ellipse. - * - * @return {this} This Ellipse object. - */ - setPosition: function (x, y) - { - if (y === undefined) { y = x; } + output.x = left; + output.y = top; + output.width = GetRight(gameObject) - left; + output.height = GetBottom(gameObject) - top; - this.x = x; - this.y = y; + return output; +}; - return this; - }, +module.exports = GetBounds; - /** - * Sets the size of this Ellipse. - * Does not change its position. - * - * @method Phaser.Geom.Ellipse#setSize - * @since 3.0.0 - * - * @param {number} width - The width of the ellipse. - * @param {number} [height=width] - The height of the ellipse. - * - * @return {this} This Ellipse object. - */ - setSize: function (width, height) - { - if (height === undefined) { height = width; } - this.width = width; - this.height = height; +/***/ }), - return this; - }, +/***/ 59994: +/***/ ((module) => { - /** - * Checks to see if the Ellipse is empty: has a width or height equal to zero. - * - * @method Phaser.Geom.Ellipse#isEmpty - * @since 3.0.0 - * - * @return {boolean} True if the Ellipse is empty, otherwise false. - */ - isEmpty: function () - { - return (this.width <= 0 || this.height <= 0); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Returns the minor radius of the ellipse. Also known as the Semi Minor Axis. - * - * @method Phaser.Geom.Ellipse#getMinorRadius - * @since 3.0.0 - * - * @return {number} The minor radius. - */ - getMinorRadius: function () - { - return Math.min(this.width, this.height) / 2; - }, +/** + * Returns the center x coordinate from the bounds of the Game Object. + * + * @function Phaser.Display.Bounds.GetCenterX + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. + * + * @return {number} The center x coordinate of the bounds of the Game Object. + */ +var GetCenterX = function (gameObject) +{ + return gameObject.x - (gameObject.width * gameObject.originX) + (gameObject.width * 0.5); +}; - /** - * Returns the major radius of the ellipse. Also known as the Semi Major Axis. - * - * @method Phaser.Geom.Ellipse#getMajorRadius - * @since 3.0.0 - * - * @return {number} The major radius. - */ - getMajorRadius: function () - { - return Math.max(this.width, this.height) / 2; - }, +module.exports = GetCenterX; - /** - * The left position of the Ellipse. - * - * @name Phaser.Geom.Ellipse#left - * @type {number} - * @since 3.0.0 - */ - left: { - get: function () - { - return this.x - (this.width / 2); - }, +/***/ }), - set: function (value) - { - this.x = value + (this.width / 2); - } +/***/ 29568: +/***/ ((module) => { - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The right position of the Ellipse. - * - * @name Phaser.Geom.Ellipse#right - * @type {number} - * @since 3.0.0 - */ - right: { +/** + * Returns the center y coordinate from the bounds of the Game Object. + * + * @function Phaser.Display.Bounds.GetCenterY + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. + * + * @return {number} The center y coordinate of the bounds of the Game Object. + */ +var GetCenterY = function (gameObject) +{ + return gameObject.y - (gameObject.height * gameObject.originY) + (gameObject.height * 0.5); +}; - get: function () - { - return this.x + (this.width / 2); - }, +module.exports = GetCenterY; - set: function (value) - { - this.x = value - (this.width / 2); - } - }, +/***/ }), - /** - * The top position of the Ellipse. - * - * @name Phaser.Geom.Ellipse#top - * @type {number} - * @since 3.0.0 - */ - top: { +/***/ 40163: +/***/ ((module) => { - get: function () - { - return this.y - (this.height / 2); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - set: function (value) - { - this.y = value + (this.height / 2); - } +/** + * Returns the left coordinate from the bounds of the Game Object. + * + * @function Phaser.Display.Bounds.GetLeft + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. + * + * @return {number} The left coordinate of the bounds of the Game Object. + */ +var GetLeft = function (gameObject) +{ + return gameObject.x - (gameObject.width * gameObject.originX); +}; - }, +module.exports = GetLeft; - /** - * The bottom position of the Ellipse. - * - * @name Phaser.Geom.Ellipse#bottom - * @type {number} - * @since 3.0.0 - */ - bottom: { - get: function () - { - return this.y + (this.height / 2); - }, +/***/ }), - set: function (value) - { - this.y = value - (this.height / 2); - } +/***/ 52088: +/***/ ((module) => { - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -}); +/** + * Returns the amount the Game Object is visually offset from its x coordinate. + * This is the same as `width * origin.x`. + * This value will only be > 0 if `origin.x` is not equal to zero. + * + * @function Phaser.Display.Bounds.GetOffsetX + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. + * + * @return {number} The horizontal offset of the Game Object. + */ +var GetOffsetX = function (gameObject) +{ + return gameObject.width * gameObject.originX; +}; -module.exports = Ellipse; +module.exports = GetOffsetX; /***/ }), -/* 112 */ -/***/ (function(module, exports) { + +/***/ 23379: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Check to see if the Ellipse contains the given x / y coordinates. + * Returns the amount the Game Object is visually offset from its y coordinate. + * This is the same as `width * origin.y`. + * This value will only be > 0 if `origin.y` is not equal to zero. * - * @function Phaser.Geom.Ellipse.Contains + * @function Phaser.Display.Bounds.GetOffsetY * @since 3.0.0 * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to check. - * @param {number} x - The x coordinate to check within the ellipse. - * @param {number} y - The y coordinate to check within the ellipse. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. * - * @return {boolean} True if the coordinates are within the ellipse, otherwise false. + * @return {number} The vertical offset of the Game Object. */ -var Contains = function (ellipse, x, y) +var GetOffsetY = function (gameObject) { - if (ellipse.width <= 0 || ellipse.height <= 0) - { - return false; - } - - // Normalize the coords to an ellipse with center 0,0 and a radius of 0.5 - var normx = ((x - ellipse.x) / ellipse.width); - var normy = ((y - ellipse.y) / ellipse.height); - - normx *= normx; - normy *= normy; - - return (normx + normy < 0.25); + return gameObject.height * gameObject.originY; }; -module.exports = Contains; +module.exports = GetOffsetY; /***/ }), -/* 113 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 70271: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Actions = __webpack_require__(275); -var Class = __webpack_require__(0); -var Events = __webpack_require__(75); -var EventEmitter = __webpack_require__(9); -var GetAll = __webpack_require__(207); -var GetFastValue = __webpack_require__(2); -var GetValue = __webpack_require__(6); -var IsPlainObject = __webpack_require__(7); -var Range = __webpack_require__(437); -var Set = __webpack_require__(149); -var Sprite = __webpack_require__(73); - /** - * @classdesc - * A Group is a way for you to create, manipulate, or recycle similar Game Objects. - * - * Group membership is non-exclusive. A Game Object can belong to several groups, one group, or none. - * - * Groups themselves aren't displayable, and can't be positioned, rotated, scaled, or hidden. + * Returns the right coordinate from the bounds of the Game Object. * - * @class Group - * @memberof Phaser.GameObjects - * @extends Phaser.Events.EventEmitter - * @constructor + * @function Phaser.Display.Bounds.GetRight * @since 3.0.0 - * @param {Phaser.Scene} scene - The scene this group belongs to. - * @param {(Phaser.GameObjects.GameObject[]|Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. - * @param {Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} [config] - Settings for this group. If `key` is set, Phaser.GameObjects.Group#createMultiple is also called with these settings. * - * @see Phaser.Physics.Arcade.Group - * @see Phaser.Physics.Arcade.StaticGroup + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. + * + * @return {number} The right coordinate of the bounds of the Game Object. */ -var Group = new Class({ +var GetRight = function (gameObject) +{ + return (gameObject.x + gameObject.width) - (gameObject.width * gameObject.originX); +}; - Extends: EventEmitter, +module.exports = GetRight; - initialize: - function Group (scene, children, config) - { - EventEmitter.call(this); +/***/ }), - // They can pass in any of the following as the first argument: +/***/ 47196: +/***/ ((module) => { - // 1) A single child - // 2) An array of children - // 3) A config object - // 4) An array of config objects +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Or they can pass in a child, or array of children AND a config object +/** + * Returns the top coordinate from the bounds of the Game Object. + * + * @function Phaser.Display.Bounds.GetTop + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. + * + * @return {number} The top coordinate of the bounds of the Game Object. + */ +var GetTop = function (gameObject) +{ + return gameObject.y - (gameObject.height * gameObject.originY); +}; - if (config) - { - // config has been set, are the children an array? +module.exports = GetTop; - if (children && !Array.isArray(children)) - { - children = [ children ]; - } - } - else if (Array.isArray(children)) - { - // No config, so let's check the children argument - if (IsPlainObject(children[0])) - { - // It's an array of plain config objects - config = children; - children = null; - } - } - else if (IsPlainObject(children)) - { - // Children isn't an array. Is it a config object though? - config = children; - children = null; - } +/***/ }), - /** - * This scene this group belongs to. - * - * @name Phaser.GameObjects.Group#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; +/***/ 73174: +/***/ ((module) => { - /** - * Members of this group. - * - * @name Phaser.GameObjects.Group#children - * @type {Phaser.Structs.Set.} - * @since 3.0.0 - */ - this.children = new Set(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * A flag identifying this object as a group. - * - * @name Phaser.GameObjects.Group#isParent - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.isParent = true; +/** + * Positions the Game Object so that the bottom of its bounds aligns with the given coordinate. + * + * @function Phaser.Display.Bounds.SetBottom + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. + * @param {number} value - The coordinate to position the Game Object bounds on. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. + */ +var SetBottom = function (gameObject, value) +{ + gameObject.y = (value - gameObject.height) + (gameObject.height * gameObject.originY); - /** - * A textual representation of this Game Object. - * Used internally by Phaser but is available for your own custom classes to populate. - * - * @name Phaser.GameObjects.Group#type - * @type {string} - * @default 'Group' - * @since 3.21.0 - */ - this.type = 'Group'; + return gameObject; +}; - /** - * The class to create new group members from. - * - * @name Phaser.GameObjects.Group#classType - * @type {Function} - * @since 3.0.0 - * @default Phaser.GameObjects.Sprite - */ - this.classType = GetFastValue(config, 'classType', Sprite); +module.exports = SetBottom; - /** - * The name of this group. - * Empty by default and never populated by Phaser, this is left for developers to use. - * - * @name Phaser.GameObjects.Group#name - * @type {string} - * @default '' - * @since 3.18.0 - */ - this.name = GetFastValue(config, 'name', ''); - /** - * Whether this group runs its {@link Phaser.GameObjects.Group#preUpdate} method (which may update any members). - * - * @name Phaser.GameObjects.Group#active - * @type {boolean} - * @since 3.0.0 - */ - this.active = GetFastValue(config, 'active', true); +/***/ }), - /** - * The maximum size of this group, if used as a pool. -1 is no limit. - * - * @name Phaser.GameObjects.Group#maxSize - * @type {number} - * @since 3.0.0 - * @default -1 - */ - this.maxSize = GetFastValue(config, 'maxSize', -1); +/***/ 28417: +/***/ ((module) => { - /** - * A default texture key to use when creating new group members. - * - * This is used in {@link Phaser.GameObjects.Group#create} - * but not in {@link Phaser.GameObjects.Group#createMultiple}. - * - * @name Phaser.GameObjects.Group#defaultKey - * @type {string} - * @since 3.0.0 - */ - this.defaultKey = GetFastValue(config, 'defaultKey', null); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * A default texture frame to use when creating new group members. - * - * @name Phaser.GameObjects.Group#defaultFrame - * @type {(string|number)} - * @since 3.0.0 - */ - this.defaultFrame = GetFastValue(config, 'defaultFrame', null); +/** + * Positions the Game Object so that the center top of its bounds aligns with the given coordinate. + * + * @function Phaser.Display.Bounds.SetCenterX + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. + * @param {number} x - The coordinate to position the Game Object bounds on. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. + */ +var SetCenterX = function (gameObject, x) +{ + var offsetX = gameObject.width * gameObject.originX; - /** - * Whether to call the update method of any members. - * - * @name Phaser.GameObjects.Group#runChildUpdate - * @type {boolean} - * @default false - * @since 3.0.0 - * @see Phaser.GameObjects.Group#preUpdate - */ - this.runChildUpdate = GetFastValue(config, 'runChildUpdate', false); + gameObject.x = (x + offsetX) - (gameObject.width * 0.5); - /** - * A function to be called when adding or creating group members. - * - * @name Phaser.GameObjects.Group#createCallback - * @type {?Phaser.Types.GameObjects.Group.GroupCallback} - * @since 3.0.0 - */ - this.createCallback = GetFastValue(config, 'createCallback', null); + return gameObject; +}; - /** - * A function to be called when removing group members. - * - * @name Phaser.GameObjects.Group#removeCallback - * @type {?Phaser.Types.GameObjects.Group.GroupCallback} - * @since 3.0.0 - */ - this.removeCallback = GetFastValue(config, 'removeCallback', null); +module.exports = SetCenterX; - /** - * A function to be called when creating several group members at once. - * - * @name Phaser.GameObjects.Group#createMultipleCallback - * @type {?Phaser.Types.GameObjects.Group.GroupMultipleCreateCallback} - * @since 3.0.0 - */ - this.createMultipleCallback = GetFastValue(config, 'createMultipleCallback', null); - /** - * A function to be called when adding or creating group members. - * For internal use only by a Group, or any class that extends it. - * - * @name Phaser.GameObjects.Group#internalCreateCallback - * @type {?Phaser.Types.GameObjects.Group.GroupCallback} - * @private - * @since 3.22.0 - */ - this.internalCreateCallback = GetFastValue(config, 'internalCreateCallback', null); +/***/ }), - /** - * A function to be called when removing group members. - * For internal use only by a Group, or any class that extends it. - * - * @name Phaser.GameObjects.Group#internalRemoveCallback - * @type {?Phaser.Types.GameObjects.Group.GroupCallback} - * @private - * @since 3.22.0 - */ - this.internalRemoveCallback = GetFastValue(config, 'internalRemoveCallback', null); +/***/ 81711: +/***/ ((module) => { - if (children) - { - this.addMultiple(children); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (config) - { - this.createMultiple(config); - } +/** + * Positions the Game Object so that the center top of its bounds aligns with the given coordinate. + * + * @function Phaser.Display.Bounds.SetCenterY + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. + * @param {number} y - The coordinate to position the Game Object bounds on. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. + */ +var SetCenterY = function (gameObject, y) +{ + var offsetY = gameObject.height * gameObject.originY; - this.on(Events.ADDED_TO_SCENE, this.addedToScene, this); - this.on(Events.REMOVED_FROM_SCENE, this.removedFromScene, this); - }, + gameObject.y = (y + offsetY) - (gameObject.height * 0.5); - // Overrides Game Object method - addedToScene: function () - { - this.scene.sys.updateList.add(this); - }, + return gameObject; +}; - // Overrides Game Object method - removedFromScene: function () - { - this.scene.sys.updateList.remove(this); - }, +module.exports = SetCenterY; - /** - * Creates a new Game Object and adds it to this group, unless the group {@link Phaser.GameObjects.Group#isFull is full}. - * - * Calls {@link Phaser.GameObjects.Group#createCallback}. - * - * @method Phaser.GameObjects.Group#create - * @since 3.0.0 - * - * @param {number} [x=0] - The horizontal position of the new Game Object in the world. - * @param {number} [y=0] - The vertical position of the new Game Object in the world. - * @param {string} [key=defaultKey] - The texture key of the new Game Object. - * @param {(string|number)} [frame=defaultFrame] - The texture frame of the new Game Object. - * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of the new Game Object. - * @param {boolean} [active=true] - The {@link Phaser.GameObjects.GameObject#active} state of the new Game Object. - * - * @return {any} The new Game Object (usually a Sprite, etc.). - */ - create: function (x, y, key, frame, visible, active) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (key === undefined) { key = this.defaultKey; } - if (frame === undefined) { frame = this.defaultFrame; } - if (visible === undefined) { visible = true; } - if (active === undefined) { active = true; } - // Pool? - if (this.isFull()) - { - return null; - } +/***/ }), - var child = new this.classType(this.scene, x, y, key, frame); +/***/ 74465: +/***/ ((module) => { - child.addToDisplayList(this.scene.sys.displayList); - child.addToUpdateList(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - child.visible = visible; - child.setActive(active); +/** + * Positions the Game Object so that the left of its bounds aligns with the given coordinate. + * + * @function Phaser.Display.Bounds.SetLeft + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. + * @param {number} value - The coordinate to position the Game Object bounds on. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. + */ +var SetLeft = function (gameObject, value) +{ + gameObject.x = value + (gameObject.width * gameObject.originX); - this.add(child); + return gameObject; +}; - return child; - }, +module.exports = SetLeft; - /** - * Creates several Game Objects and adds them to this group. - * - * If the group becomes {@link Phaser.GameObjects.Group#isFull}, no further Game Objects are created. - * - * Calls {@link Phaser.GameObjects.Group#createMultipleCallback} and {@link Phaser.GameObjects.Group#createCallback}. - * - * @method Phaser.GameObjects.Group#createMultiple - * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.Group.GroupCreateConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig[]} config - Creation settings. This can be a single configuration object or an array of such objects, which will be applied in turn. - * - * @return {any[]} The newly created Game Objects. - */ - createMultiple: function (config) - { - if (this.isFull()) - { - return []; - } - if (!Array.isArray(config)) - { - config = [ config ]; - } +/***/ }), - var output = []; +/***/ 19298: +/***/ ((module) => { - if (config[0].key) - { - for (var i = 0; i < config.length; i++) - { - var entries = this.createFromConfig(config[i]); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - output = output.concat(entries); - } - } +/** + * Positions the Game Object so that the left of its bounds aligns with the given coordinate. + * + * @function Phaser.Display.Bounds.SetRight + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. + * @param {number} value - The coordinate to position the Game Object bounds on. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. + */ +var SetRight = function (gameObject, value) +{ + gameObject.x = (value - gameObject.width) + (gameObject.width * gameObject.originX); - return output; - }, + return gameObject; +}; - /** - * A helper for {@link Phaser.GameObjects.Group#createMultiple}. - * - * @method Phaser.GameObjects.Group#createFromConfig - * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.Group.GroupCreateConfig} options - Creation settings. - * - * @return {any[]} The newly created Game Objects. - */ - createFromConfig: function (options) - { - if (this.isFull()) - { - return []; - } +module.exports = SetRight; - this.classType = GetFastValue(options, 'classType', this.classType); - var key = GetFastValue(options, 'key', undefined); - var frame = GetFastValue(options, 'frame', null); - var visible = GetFastValue(options, 'visible', true); - var active = GetFastValue(options, 'active', true); +/***/ }), - var entries = []; +/***/ 84349: +/***/ ((module) => { - // Can't do anything without at least a key - if (key === undefined) - { - return entries; - } - else - { - if (!Array.isArray(key)) - { - key = [ key ]; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (!Array.isArray(frame)) - { - frame = [ frame ]; - } - } +/** + * Positions the Game Object so that the top of its bounds aligns with the given coordinate. + * + * @function Phaser.Display.Bounds.SetTop + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. + * @param {number} value - The coordinate to position the Game Object bounds on. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. + */ +var SetTop = function (gameObject, value) +{ + gameObject.y = value + (gameObject.height * gameObject.originY); - // Build an array of key frame pairs to loop through + return gameObject; +}; - var repeat = GetFastValue(options, 'repeat', 0); - var randomKey = GetFastValue(options, 'randomKey', false); - var randomFrame = GetFastValue(options, 'randomFrame', false); - var yoyo = GetFastValue(options, 'yoyo', false); - var quantity = GetFastValue(options, 'quantity', false); - var frameQuantity = GetFastValue(options, 'frameQuantity', 1); - var max = GetFastValue(options, 'max', 0); +module.exports = SetTop; - // If a quantity value is set we use that to override the frameQuantity - var range = Range(key, frame, { - max: max, - qty: (quantity) ? quantity : frameQuantity, - random: randomKey, - randomB: randomFrame, - repeat: repeat, - yoyo: yoyo - }); +/***/ }), - if (options.createCallback) - { - this.createCallback = options.createCallback; - } +/***/ 15252: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (options.removeCallback) - { - this.removeCallback = options.removeCallback; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - for (var c = 0; c < range.length; c++) - { - var created = this.create(0, 0, range[c].a, range[c].b, visible, active); +/** + * @namespace Phaser.Display.Bounds + */ - if (!created) - { - break; - } +module.exports = { - entries.push(created); - } + CenterOn: __webpack_require__(21843), + GetBottom: __webpack_require__(97328), + GetBounds: __webpack_require__(7126), + GetCenterX: __webpack_require__(59994), + GetCenterY: __webpack_require__(29568), + GetLeft: __webpack_require__(40163), + GetOffsetX: __webpack_require__(52088), + GetOffsetY: __webpack_require__(23379), + GetRight: __webpack_require__(70271), + GetTop: __webpack_require__(47196), + SetBottom: __webpack_require__(73174), + SetCenterX: __webpack_require__(28417), + SetCenterY: __webpack_require__(81711), + SetLeft: __webpack_require__(74465), + SetRight: __webpack_require__(19298), + SetTop: __webpack_require__(84349) - // Post-creation options (applied only to those items created in this call): +}; - var x = GetValue(options, 'setXY.x', 0); - var y = GetValue(options, 'setXY.y', 0); - var stepX = GetValue(options, 'setXY.stepX', 0); - var stepY = GetValue(options, 'setXY.stepY', 0); - Actions.SetXY(entries, x, y, stepX, stepY); +/***/ }), - var rotation = GetValue(options, 'setRotation.value', 0); - var stepRotation = GetValue(options, 'setRotation.step', 0); +/***/ 70616: +/***/ ((module) => { - Actions.SetRotation(entries, rotation, stepRotation); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var scaleX = GetValue(options, 'setScale.x', 1); - var scaleY = GetValue(options, 'setScale.y', scaleX); - var stepScaleX = GetValue(options, 'setScale.stepX', 0); - var stepScaleY = GetValue(options, 'setScale.stepY', 0); +/** + * @namespace Phaser.Display.Canvas.CanvasInterpolation + * @since 3.0.0 + */ +var CanvasInterpolation = { - Actions.SetScale(entries, scaleX, scaleY, stepScaleX, stepScaleY); + /** + * Sets the CSS image-rendering property on the given canvas to be 'crisp' (aka 'optimize contrast' on webkit). + * + * @function Phaser.Display.Canvas.CanvasInterpolation.setCrisp + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The canvas object to have the style set on. + * + * @return {HTMLCanvasElement} The canvas. + */ + setCrisp: function (canvas) + { + var types = [ 'optimizeSpeed', '-moz-crisp-edges', '-o-crisp-edges', '-webkit-optimize-contrast', 'optimize-contrast', 'crisp-edges', 'pixelated' ]; - var originX = GetValue(options, 'setOrigin.x', 0.5); - var originY = GetValue(options, 'setOrigin.y', originX); - var stepOriginX = GetValue(options, 'setOrigin.stepX', 0); - var stepOriginY = GetValue(options, 'setOrigin.stepY', 0); + types.forEach(function (type) + { + canvas.style['image-rendering'] = type; + }); - Actions.SetOrigin(entries, originX, originY, stepOriginX, stepOriginY); + canvas.style.msInterpolationMode = 'nearest-neighbor'; - var alpha = GetValue(options, 'setAlpha.value', 1); - var stepAlpha = GetValue(options, 'setAlpha.step', 0); + return canvas; + }, - Actions.SetAlpha(entries, alpha, stepAlpha); + /** + * Sets the CSS image-rendering property on the given canvas to be 'bicubic' (aka 'auto'). + * + * @function Phaser.Display.Canvas.CanvasInterpolation.setBicubic + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The canvas object to have the style set on. + * + * @return {HTMLCanvasElement} The canvas. + */ + setBicubic: function (canvas) + { + canvas.style['image-rendering'] = 'auto'; + canvas.style.msInterpolationMode = 'bicubic'; - var depth = GetValue(options, 'setDepth.value', 0); - var stepDepth = GetValue(options, 'setDepth.step', 0); + return canvas; + } - Actions.SetDepth(entries, depth, stepDepth); +}; - var scrollFactorX = GetValue(options, 'setScrollFactor.x', 1); - var scrollFactorY = GetValue(options, 'setScrollFactor.y', scrollFactorX); - var stepScrollFactorX = GetValue(options, 'setScrollFactor.stepX', 0); - var stepScrollFactorY = GetValue(options, 'setScrollFactor.stepY', 0); +module.exports = CanvasInterpolation; - Actions.SetScrollFactor(entries, scrollFactorX, scrollFactorY, stepScrollFactorX, stepScrollFactorY); - var hitArea = GetFastValue(options, 'hitArea', null); - var hitAreaCallback = GetFastValue(options, 'hitAreaCallback', null); +/***/ }), - if (hitArea) - { - Actions.SetHitArea(entries, hitArea, hitAreaCallback); - } +/***/ 61068: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var grid = GetFastValue(options, 'gridAlign', false); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (grid) - { - Actions.GridAlign(entries, grid); - } +var CONST = __webpack_require__(86459); +var Smoothing = __webpack_require__(8213); - if (this.createMultipleCallback) - { - this.createMultipleCallback.call(this, entries); - } +// The pool into which the canvas elements are placed. +var pool = []; - return entries; - }, +// Automatically apply smoothing(false) to created Canvas elements +var _disableContextSmoothing = false; +/** + * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements. + * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again, + * which is useless for some of the Phaser pipelines / renderer. + * + * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created. + * Which means all instances of Phaser Games on the same page can share the one single pool. + * + * @namespace Phaser.Display.Canvas.CanvasPool + * @since 3.0.0 + */ +var CanvasPool = function () +{ /** - * Updates any group members, if {@link Phaser.GameObjects.Group#runChildUpdate} is enabled. + * Creates a new Canvas DOM element, or pulls one from the pool if free. * - * @method Phaser.GameObjects.Group#preUpdate + * @function Phaser.Display.Canvas.CanvasPool.create * @since 3.0.0 * - * @param {number} time - The current timestamp. - * @param {number} delta - The delta time elapsed since the last frame. + * @param {*} parent - The parent of the Canvas object. + * @param {number} [width=1] - The width of the Canvas. + * @param {number} [height=1] - The height of the Canvas. + * @param {number} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent? + * + * @return {HTMLCanvasElement} The canvas element that was created or pulled from the pool */ - preUpdate: function (time, delta) + var create = function (parent, width, height, canvasType, selfParent) { - if (!this.runChildUpdate || this.children.size === 0) - { - return; - } + if (width === undefined) { width = 1; } + if (height === undefined) { height = 1; } + if (canvasType === undefined) { canvasType = CONST.CANVAS; } + if (selfParent === undefined) { selfParent = false; } - // Because a Group child may mess with the length of the Group during its update - var temp = this.children.entries.slice(); + var canvas; + var container = first(canvasType); - for (var i = 0; i < temp.length; i++) + if (container === null) { - var item = temp[i]; + container = { + parent: parent, + canvas: document.createElement('canvas'), + type: canvasType + }; - if (item.active) + if (canvasType === CONST.CANVAS) { - item.update(time, delta); + pool.push(container); } - } - }, - /** - * Adds a Game Object to this group. - * - * Calls {@link Phaser.GameObjects.Group#createCallback}. - * - * @method Phaser.GameObjects.Group#add - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} child - The Game Object to add. - * @param {boolean} [addToScene=false] - Also add the Game Object to the scene. - * - * @return {this} This Group object. - */ - add: function (child, addToScene) - { - if (addToScene === undefined) { addToScene = false; } - - if (this.isFull()) - { - return this; + canvas = container.canvas; } - - this.children.set(child); - - if (this.internalCreateCallback) + else { - this.internalCreateCallback.call(this, child); + container.parent = parent; + + canvas = container.canvas; } - if (this.createCallback) + if (selfParent) { - this.createCallback.call(this, child); + container.parent = canvas; } - if (addToScene) + canvas.width = width; + canvas.height = height; + + if (_disableContextSmoothing && canvasType === CONST.CANVAS) { - child.addToDisplayList(this.scene.sys.displayList); - child.addToUpdateList(); + Smoothing.disable(canvas.getContext('2d', { willReadFrequently: false })); } - child.on(Events.DESTROY, this.remove, this); - - return this; - }, + return canvas; + }; /** - * Adds several Game Objects to this group. - * - * Calls {@link Phaser.GameObjects.Group#createCallback}. + * Creates a new Canvas DOM element, or pulls one from the pool if free. * - * @method Phaser.GameObjects.Group#addMultiple + * @function Phaser.Display.Canvas.CanvasPool.create2D * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject[]} children - The Game Objects to add. - * @param {boolean} [addToScene=false] - Also add the Game Objects to the scene. + * @param {*} parent - The parent of the Canvas object. + * @param {number} [width=1] - The width of the Canvas. + * @param {number} [height=1] - The height of the Canvas. * - * @return {this} This group. + * @return {HTMLCanvasElement} The created canvas. */ - addMultiple: function (children, addToScene) + var create2D = function (parent, width, height) { - if (addToScene === undefined) { addToScene = false; } - - if (Array.isArray(children)) - { - for (var i = 0; i < children.length; i++) - { - this.add(children[i], addToScene); - } - } - - return this; - }, + return create(parent, width, height, CONST.CANVAS); + }; /** - * Removes a member of this Group and optionally removes it from the Scene and / or destroys it. - * - * Calls {@link Phaser.GameObjects.Group#removeCallback}. + * Creates a new Canvas DOM element, or pulls one from the pool if free. * - * @method Phaser.GameObjects.Group#remove + * @function Phaser.Display.Canvas.CanvasPool.createWebGL * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} child - The Game Object to remove. - * @param {boolean} [removeFromScene=false] - Optionally remove the Group member from the Scene it belongs to. - * @param {boolean} [destroyChild=false] - Optionally call destroy on the removed Group member. + * @param {*} parent - The parent of the Canvas object. + * @param {number} [width=1] - The width of the Canvas. + * @param {number} [height=1] - The height of the Canvas. * - * @return {this} This Group object. + * @return {HTMLCanvasElement} The created WebGL canvas. */ - remove: function (child, removeFromScene, destroyChild) + var createWebGL = function (parent, width, height) { - if (removeFromScene === undefined) { removeFromScene = false; } - if (destroyChild === undefined) { destroyChild = false; } - - if (!this.children.contains(child)) - { - return this; - } + return create(parent, width, height, CONST.WEBGL); + }; - this.children.delete(child); + /** + * Gets the first free canvas index from the pool. + * + * @function Phaser.Display.Canvas.CanvasPool.first + * @since 3.0.0 + * + * @param {number} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`. + * + * @return {HTMLCanvasElement} The first free canvas, or `null` if a WebGL canvas was requested or if the pool doesn't have free canvases. + */ + var first = function (canvasType) + { + if (canvasType === undefined) { canvasType = CONST.CANVAS; } - if (this.internalRemoveCallback) + if (canvasType === CONST.WEBGL) { - this.internalRemoveCallback.call(this, child); + return null; } - if (this.removeCallback) + for (var i = 0; i < pool.length; i++) { - this.removeCallback.call(this, child); - } - - child.off(Events.DESTROY, this.remove, this); + var container = pool[i]; - if (destroyChild) - { - child.destroy(); - } - else if (removeFromScene) - { - child.removeFromDisplayList(); - child.removeFromUpdateList(); + if (!container.parent && container.type === canvasType) + { + return container; + } } - return this; - }, + return null; + }; /** - * Removes all members of this Group and optionally removes them from the Scene and / or destroys them. - * - * Does not call {@link Phaser.GameObjects.Group#removeCallback}. + * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use. + * The canvas has its width and height set to 1, and its parent attribute nulled. * - * @method Phaser.GameObjects.Group#clear + * @function Phaser.Display.Canvas.CanvasPool.remove * @since 3.0.0 * - * @param {boolean} [removeFromScene=false] - Optionally remove each Group member from the Scene. - * @param {boolean} [destroyChild=false] - Optionally call destroy on the removed Group members. - * - * @return {this} This group. + * @param {*} parent - The canvas or the parent of the canvas to free. */ - clear: function (removeFromScene, destroyChild) + var remove = function (parent) { - if (removeFromScene === undefined) { removeFromScene = false; } - if (destroyChild === undefined) { destroyChild = false; } - - var children = this.children; + // Check to see if the parent is a canvas object + var isCanvas = parent instanceof HTMLCanvasElement; - for (var i = 0; i < children.size; i++) + pool.forEach(function (container) { - var gameObject = children.entries[i]; - - gameObject.off(Events.DESTROY, this.remove, this); - - if (destroyChild) - { - gameObject.destroy(); - } - else if (removeFromScene) + if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent)) { - gameObject.removeFromDisplayList(); - gameObject.removeFromUpdateList(); + container.parent = null; + container.canvas.width = 1; + container.canvas.height = 1; } - } - - this.children.clear(); - - return this; - }, + }); + }; /** - * Tests if a Game Object is a member of this group. + * Gets the total number of used canvas elements in the pool. * - * @method Phaser.GameObjects.Group#contains + * @function Phaser.Display.Canvas.CanvasPool.total * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} child - A Game Object. - * - * @return {boolean} True if the Game Object is a member of this group. + * @return {number} The number of used canvases. */ - contains: function (child) + var total = function () { - return this.children.contains(child); - }, + var c = 0; + + pool.forEach(function (container) + { + if (container.parent) + { + c++; + } + }); + + return c; + }; /** - * All members of the group. + * Gets the total number of free canvas elements in the pool. * - * @method Phaser.GameObjects.Group#getChildren + * @function Phaser.Display.Canvas.CanvasPool.free * @since 3.0.0 * - * @return {Phaser.GameObjects.GameObject[]} The group members. + * @return {number} The number of free canvases. */ - getChildren: function () + var free = function () { - return this.children.entries; - }, + return pool.length - total(); + }; /** - * The number of members of the group. + * Disable context smoothing on any new Canvas element created. * - * @method Phaser.GameObjects.Group#getLength + * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing * @since 3.0.0 - * - * @return {number} */ - getLength: function () + var disableSmoothing = function () { - return this.children.size; - }, + _disableContextSmoothing = true; + }; /** - * Returns all children in this Group that match the given criteria based on the `property` and `value` arguments. - * - * For example: `getMatching('visible', true)` would return only children that have their `visible` property set. - * - * Optionally, you can specify a start and end index. For example if the Group has 100 elements, - * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only - * the first 50. - * - * @method Phaser.GameObjects.Group#getMatching - * @since 3.50.0 - * - * @param {string} [property] - The property to test on each array element. - * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {number} [startIndex] - An optional start index to search from. - * @param {number} [endIndex] - An optional end index to search to. + * Enable context smoothing on any new Canvas element created. * - * @return {any[]} An array of matching Group members. The array will be empty if nothing matched. + * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing + * @since 3.0.0 */ - getMatching: function (property, value, startIndex, endIndex) + var enableSmoothing = function () { - return GetAll(this.children.entries, property, value, startIndex, endIndex); - }, + _disableContextSmoothing = false; + }; + + return { + create2D: create2D, + create: create, + createWebGL: createWebGL, + disableSmoothing: disableSmoothing, + enableSmoothing: enableSmoothing, + first: first, + free: free, + pool: pool, + remove: remove, + total: total + }; +}; + +// If we export the called function here, it'll only be invoked once (not every time it's required). +module.exports = CanvasPool(); + + +/***/ }), + +/***/ 8213: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Browser specific prefix, so not going to change between contexts, only between browsers +var prefix = ''; +/** + * @namespace Phaser.Display.Canvas.Smoothing + * @since 3.0.0 + */ +var Smoothing = function () +{ /** - * Scans the Group, from top to bottom, for the first member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument, - * assigns `x` and `y`, and returns the member. - * - * If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`. - * Unless a new member is created, `key`, `frame`, and `visible` are ignored. + * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set. * - * @method Phaser.GameObjects.Group#getFirst + * @function Phaser.Display.Canvas.Smoothing.getPrefix * @since 3.0.0 * - * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. - * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. - * @param {number} [x] - The horizontal position of the Game Object in the world. - * @param {number} [y] - The vertical position of the Game Object in the world. - * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). - * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The canvas context to check. * - * @return {?any} The first matching group member, or a newly created member, or null. + * @return {string} The name of the property on the context which controls image smoothing (either `imageSmoothingEnabled` or a vendor-prefixed version thereof), or `null` if not supported. */ - getFirst: function (state, createIfNull, x, y, key, frame, visible) + var getPrefix = function (context) { - return this.getHandler(true, 1, state, createIfNull, x, y, key, frame, visible); - }, + var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ]; + + for (var i = 0; i < vendors.length; i++) + { + var s = vendors[i] + 'mageSmoothingEnabled'; + + if (s in context) + { + return s; + } + } + + return null; + }; /** - * Scans the Group, from top to bottom, for the nth member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument, - * assigns `x` and `y`, and returns the member. - * - * If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`. - * Unless a new member is created, `key`, `frame`, and `visible` are ignored. + * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. + * By default browsers have image smoothing enabled, which isn't always what you visually want, especially + * when using pixel art in a game. Note that this sets the property on the context itself, so that any image + * drawn to the context will be affected. This sets the property across all current browsers but support is + * patchy on earlier browsers, especially on mobile. * - * @method Phaser.GameObjects.Group#getFirstNth - * @since 3.6.0 + * @function Phaser.Display.Canvas.Smoothing.enable + * @since 3.0.0 * - * @param {number} nth - The nth matching Group member to search for. - * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. - * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. - * @param {number} [x] - The horizontal position of the Game Object in the world. - * @param {number} [y] - The vertical position of the Game Object in the world. - * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). - * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to enable smoothing. * - * @return {?any} The first matching group member, or a newly created member, or null. + * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. */ - getFirstNth: function (nth, state, createIfNull, x, y, key, frame, visible) + var enable = function (context) { - return this.getHandler(true, nth, state, createIfNull, x, y, key, frame, visible); - }, + if (prefix === '') + { + prefix = getPrefix(context); + } + + if (prefix) + { + context[prefix] = true; + } + + return context; + }; /** - * Scans the Group for the last member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument, - * assigns `x` and `y`, and returns the member. + * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. + * By default browsers have image smoothing enabled, which isn't always what you visually want, especially + * when using pixel art in a game. Note that this sets the property on the context itself, so that any image + * drawn to the context will be affected. This sets the property across all current browsers but support is + * patchy on earlier browsers, especially on mobile. * - * If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`. - * Unless a new member is created, `key`, `frame`, and `visible` are ignored. + * @function Phaser.Display.Canvas.Smoothing.disable + * @since 3.0.0 * - * @method Phaser.GameObjects.Group#getLast - * @since 3.6.0 - * - * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. - * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. - * @param {number} [x] - The horizontal position of the Game Object in the world. - * @param {number} [y] - The vertical position of the Game Object in the world. - * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). - * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to disable smoothing. * - * @return {?any} The first matching group member, or a newly created member, or null. + * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. */ - getLast: function (state, createIfNull, x, y, key, frame, visible) + var disable = function (context) { - return this.getHandler(false, 1, state, createIfNull, x, y, key, frame, visible); - }, + if (prefix === '') + { + prefix = getPrefix(context); + } + + if (prefix) + { + context[prefix] = false; + } + + return context; + }; /** - * Scans the Group for the last nth member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument, - * assigns `x` and `y`, and returns the member. - * - * If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`. - * Unless a new member is created, `key`, `frame`, and `visible` are ignored. + * Returns `true` if the given context has image smoothing enabled, otherwise returns `false`. + * Returns null if no smoothing prefix is available. * - * @method Phaser.GameObjects.Group#getLastNth - * @since 3.6.0 + * @function Phaser.Display.Canvas.Smoothing.isEnabled + * @since 3.0.0 * - * @param {number} nth - The nth matching Group member to search for. - * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. - * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. - * @param {number} [x] - The horizontal position of the Game Object in the world. - * @param {number} [y] - The vertical position of the Game Object in the world. - * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). - * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). + * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context to check. * - * @return {?any} The first matching group member, or a newly created member, or null. + * @return {?boolean} `true` if smoothing is enabled on the context, otherwise `false`. `null` if not supported. */ - getLastNth: function (nth, state, createIfNull, x, y, key, frame, visible) + var isEnabled = function (context) { - return this.getHandler(false, nth, state, createIfNull, x, y, key, frame, visible); - }, + return (prefix !== null) ? context[prefix] : null; + }; - /** - * Scans the group for the last member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument, - * assigns `x` and `y`, and returns the member. - * - * If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`. - * Unless a new member is created, `key`, `frame`, and `visible` are ignored. - * - * @method Phaser.GameObjects.Group#getHandler - * @private - * @since 3.6.0 - * - * @param {boolean} forwards - Search front to back or back to front? - * @param {number} nth - Stop matching after nth successful matches. - * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. - * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. - * @param {number} [x] - The horizontal position of the Game Object in the world. - * @param {number} [y] - The vertical position of the Game Object in the world. - * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). - * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). - * - * @return {?any} The first matching group member, or a newly created member, or null. - */ - getHandler: function (forwards, nth, state, createIfNull, x, y, key, frame, visible) + return { + disable: disable, + enable: enable, + getPrefix: getPrefix, + isEnabled: isEnabled + }; + +}; + +module.exports = Smoothing(); + + +/***/ }), + +/***/ 59271: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Sets the touch-action property on the canvas style. Can be used to disable default browser touch actions. + * + * @function Phaser.Display.Canvas.TouchAction + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to. + * @param {string} [value='none'] - The touch action value to set on the canvas. Set to `none` to disable touch actions. + * + * @return {HTMLCanvasElement} The canvas element. + */ +var TouchAction = function (canvas, value) +{ + if (value === undefined) { value = 'none'; } + + canvas.style['msTouchAction'] = value; + canvas.style['ms-touch-action'] = value; + canvas.style['touch-action'] = value; + + return canvas; +}; + +module.exports = TouchAction; + + +/***/ }), + +/***/ 36505: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Sets the user-select property on the canvas style. Can be used to disable default browser selection actions. + * + * @function Phaser.Display.Canvas.UserSelect + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to. + * @param {string} [value='none'] - The touch callout value to set on the canvas. Set to `none` to disable touch callouts. + * + * @return {HTMLCanvasElement} The canvas element. + */ +var UserSelect = function (canvas, value) +{ + if (value === undefined) { value = 'none'; } + + var vendors = [ + '-webkit-', + '-khtml-', + '-moz-', + '-ms-', + '' + ]; + + vendors.forEach(function (vendor) { - if (state === undefined) { state = false; } - if (createIfNull === undefined) { createIfNull = false; } + canvas.style[vendor + 'user-select'] = value; + }); - var gameObject; + canvas.style['-webkit-touch-callout'] = value; + canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)'; - var i; - var total = 0; - var children = this.children.entries; + return canvas; +}; - if (forwards) - { - for (i = 0; i < children.length; i++) - { - gameObject = children[i]; +module.exports = UserSelect; - if (gameObject.active === state) - { - total++; - if (total === nth) - { - break; - } - } - else - { - gameObject = null; - } - } - } - else - { - for (i = children.length - 1; i >= 0; i--) - { - gameObject = children[i]; +/***/ }), - if (gameObject.active === state) - { - total++; +/***/ 23514: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (total === nth) - { - break; - } - } - else - { - gameObject = null; - } - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (gameObject) - { - if (typeof(x) === 'number') - { - gameObject.x = x; - } +/** + * @namespace Phaser.Display.Canvas + */ - if (typeof(y) === 'number') - { - gameObject.y = y; - } +module.exports = { - return gameObject; - } + CanvasInterpolation: __webpack_require__(70616), + CanvasPool: __webpack_require__(61068), + Smoothing: __webpack_require__(8213), + TouchAction: __webpack_require__(59271), + UserSelect: __webpack_require__(36505) - // Got this far? We need to create or bail - if (createIfNull) - { - return this.create(x, y, key, frame, visible); - } - else - { - return null; - } - }, +}; - /** - * Scans the group for the first member that has an {@link Phaser.GameObjects.GameObject#active} state set to `false`, - * assigns `x` and `y`, and returns the member. - * - * If no inactive member is found and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`. - * The new Game Object will have its active state set to `true`. - * Unless a new member is created, `key`, `frame`, and `visible` are ignored. - * - * @method Phaser.GameObjects.Group#get - * @since 3.0.0 - * - * @param {number} [x] - The horizontal position of the Game Object in the world. - * @param {number} [y] - The vertical position of the Game Object in the world. - * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). - * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). - * - * @return {?any} The first inactive group member, or a newly created member, or null. - */ - get: function (x, y, key, frame, visible) + +/***/ }), + +/***/ 27119: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var GetColor = __webpack_require__(22946); +var GetColor32 = __webpack_require__(5657); +var HSVToRGB = __webpack_require__(24650); +var RGBToHSV = __webpack_require__(68033); + +/** + * @namespace Phaser.Display.Color + */ + +/** + * @classdesc + * The Color class holds a single color value and allows for easy modification and reading of it. + * + * @class Color + * @memberof Phaser.Display + * @constructor + * @since 3.0.0 + * + * @param {number} [red=0] - The red color value. A number between 0 and 255. + * @param {number} [green=0] - The green color value. A number between 0 and 255. + * @param {number} [blue=0] - The blue color value. A number between 0 and 255. + * @param {number} [alpha=255] - The alpha value. A number between 0 and 255. + */ +var Color = new Class({ + + initialize: + + function Color (red, green, blue, alpha) { - return this.getFirst(false, true, x, y, key, frame, visible); + if (red === undefined) { red = 0; } + if (green === undefined) { green = 0; } + if (blue === undefined) { blue = 0; } + if (alpha === undefined) { alpha = 255; } + + /** + * The internal red color value. + * + * @name Phaser.Display.Color#r + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this.r = 0; + + /** + * The internal green color value. + * + * @name Phaser.Display.Color#g + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this.g = 0; + + /** + * The internal blue color value. + * + * @name Phaser.Display.Color#b + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this.b = 0; + + /** + * The internal alpha color value. + * + * @name Phaser.Display.Color#a + * @type {number} + * @private + * @default 255 + * @since 3.0.0 + */ + this.a = 255; + + /** + * The hue color value. A number between 0 and 1. + * This is the base color. + * + * @name Phaser.Display.Color#_h + * @type {number} + * @default 0 + * @private + * @since 3.13.0 + */ + this._h = 0; + + /** + * The saturation color value. A number between 0 and 1. + * This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white. + * + * @name Phaser.Display.Color#_s + * @type {number} + * @default 0 + * @private + * @since 3.13.0 + */ + this._s = 0; + + /** + * The lightness color value. A number between 0 and 1. + * This controls how dark the color is. Where 1 is as bright as possible and 0 is black. + * + * @name Phaser.Display.Color#_v + * @type {number} + * @default 0 + * @private + * @since 3.13.0 + */ + this._v = 0; + + /** + * Is this color update locked? + * + * @name Phaser.Display.Color#_locked + * @type {boolean} + * @private + * @since 3.13.0 + */ + this._locked = false; + + /** + * An array containing the calculated color values for WebGL use. + * + * @name Phaser.Display.Color#gl + * @type {number[]} + * @since 3.0.0 + */ + this.gl = [ 0, 0, 0, 1 ]; + + /** + * Pre-calculated internal color value. + * + * @name Phaser.Display.Color#_color + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._color = 0; + + /** + * Pre-calculated internal color32 value. + * + * @name Phaser.Display.Color#_color32 + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._color32 = 0; + + /** + * Pre-calculated internal color rgb string value. + * + * @name Phaser.Display.Color#_rgba + * @type {string} + * @private + * @default '' + * @since 3.0.0 + */ + this._rgba = ''; + + this.setTo(red, green, blue, alpha); }, /** - * Scans the group for the first member that has an {@link Phaser.GameObjects.GameObject#active} state set to `true`, - * assigns `x` and `y`, and returns the member. - * - * If no active member is found and `createIfNull` is `true` and the group isn't full then it will create a new one using `x`, `y`, `key`, `frame`, and `visible`. - * Unless a new member is created, `key`, `frame`, and `visible` are ignored. + * Sets this color to be transparent. Sets all values to zero. * - * @method Phaser.GameObjects.Group#getFirstAlive + * @method Phaser.Display.Color#transparent * @since 3.0.0 * - * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. - * @param {number} [x] - The horizontal position of the Game Object in the world. - * @param {number} [y] - The vertical position of the Game Object in the world. - * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). - * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). - * - * @return {any} The first active group member, or a newly created member, or null. + * @return {Phaser.Display.Color} This Color object. */ - getFirstAlive: function (createIfNull, x, y, key, frame, visible) + transparent: function () { - return this.getFirst(true, createIfNull, x, y, key, frame, visible); + this._locked = true; + + this.red = 0; + this.green = 0; + this.blue = 0; + this.alpha = 0; + + this._locked = false; + + return this.update(true); }, /** - * Scans the group for the first member that has an {@link Phaser.GameObjects.GameObject#active} state set to `false`, - * assigns `x` and `y`, and returns the member. - * - * If no inactive member is found and `createIfNull` is `true` and the group isn't full then it will create a new one using `x`, `y`, `key`, `frame`, and `visible`. - * The new Game Object will have an active state set to `true`. - * Unless a new member is created, `key`, `frame`, and `visible` are ignored. + * Sets the color of this Color component. * - * @method Phaser.GameObjects.Group#getFirstDead + * @method Phaser.Display.Color#setTo * @since 3.0.0 * - * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. - * @param {number} [x] - The horizontal position of the Game Object in the world. - * @param {number} [y] - The vertical position of the Game Object in the world. - * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). - * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). - * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). + * @param {number} red - The red color value. A number between 0 and 255. + * @param {number} green - The green color value. A number between 0 and 255. + * @param {number} blue - The blue color value. A number between 0 and 255. + * @param {number} [alpha=255] - The alpha value. A number between 0 and 255. + * @param {boolean} [updateHSV=true] - Update the HSV values after setting the RGB values? * - * @return {any} The first inactive group member, or a newly created member, or null. + * @return {Phaser.Display.Color} This Color object. */ - getFirstDead: function (createIfNull, x, y, key, frame, visible) + setTo: function (red, green, blue, alpha, updateHSV) { - return this.getFirst(false, createIfNull, x, y, key, frame, visible); + if (alpha === undefined) { alpha = 255; } + if (updateHSV === undefined) { updateHSV = true; } + + this._locked = true; + + this.red = red; + this.green = green; + this.blue = blue; + this.alpha = alpha; + + this._locked = false; + + return this.update(updateHSV); }, /** - * {@link Phaser.GameObjects.Components.Animation#play Plays} an animation for all members of this group. + * Sets the red, green, blue and alpha GL values of this Color component. * - * @method Phaser.GameObjects.Group#playAnimation + * @method Phaser.Display.Color#setGLTo * @since 3.0.0 * - * @param {string} key - The string-based key of the animation to play. - * @param {string} [startFrame=0] - Optionally start the animation playing from this frame index. + * @param {number} red - The red color value. A number between 0 and 1. + * @param {number} green - The green color value. A number between 0 and 1. + * @param {number} blue - The blue color value. A number between 0 and 1. + * @param {number} [alpha=1] - The alpha value. A number between 0 and 1. * - * @return {this} This Group object. + * @return {Phaser.Display.Color} This Color object. */ - playAnimation: function (key, startFrame) + setGLTo: function (red, green, blue, alpha) { - Actions.PlayAnimation(this.children.entries, key, startFrame); + if (alpha === undefined) { alpha = 1; } - return this; - }, + this._locked = true; - /** - * Whether this group's size at its {@link Phaser.GameObjects.Group#maxSize maximum}. - * - * @method Phaser.GameObjects.Group#isFull - * @since 3.0.0 - * - * @return {boolean} True if the number of members equals {@link Phaser.GameObjects.Group#maxSize}. - */ - isFull: function () - { - if (this.maxSize === -1) - { - return false; - } - else - { - return (this.children.size >= this.maxSize); - } + this.redGL = red; + this.greenGL = green; + this.blueGL = blue; + this.alphaGL = alpha; + + this._locked = false; + + return this.update(true); }, /** - * Counts the number of active (or inactive) group members. + * Sets the color based on the color object given. * - * @method Phaser.GameObjects.Group#countActive + * @method Phaser.Display.Color#setFromRGB * @since 3.0.0 * - * @param {boolean} [value=true] - Count active (true) or inactive (false) group members. + * @param {Phaser.Types.Display.InputColorObject} color - An object containing `r`, `g`, `b` and optionally `a` values in the range 0 to 255. * - * @return {number} The number of group members with an active state matching the `active` argument. + * @return {Phaser.Display.Color} This Color object. */ - countActive: function (value) + setFromRGB: function (color) { - if (value === undefined) { value = true; } + this._locked = true; - var total = 0; + this.red = color.r; + this.green = color.g; + this.blue = color.b; - for (var i = 0; i < this.children.size; i++) + if (color.hasOwnProperty('a')) { - if (this.children.entries[i].active === value) - { - total++; - } + this.alpha = color.a; } - return total; + this._locked = false; + + return this.update(true); }, /** - * Counts the number of in-use (active) group members. + * Sets the color based on the hue, saturation and lightness values given. * - * @method Phaser.GameObjects.Group#getTotalUsed - * @since 3.0.0 + * @method Phaser.Display.Color#setFromHSV + * @since 3.13.0 * - * @return {number} The number of group members with an active state of true. + * @param {number} h - The hue, in the range 0 - 1. This is the base color. + * @param {number} s - The saturation, in the range 0 - 1. This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white. + * @param {number} v - The value, in the range 0 - 1. This controls how dark the color is. Where 1 is as bright as possible and 0 is black. + * + * @return {Phaser.Display.Color} This Color object. */ - getTotalUsed: function () + setFromHSV: function (h, s, v) { - return this.countActive(); + return HSVToRGB(h, s, v, this); }, /** - * The difference of {@link Phaser.GameObjects.Group#maxSize} and the number of active group members. - * - * This represents the number of group members that could be created or reactivated before reaching the size limit. + * Updates the internal cache values. * - * @method Phaser.GameObjects.Group#getTotalFree + * @method Phaser.Display.Color#update + * @private * @since 3.0.0 * - * @return {number} maxSize minus the number of active group numbers; or a large number (if maxSize is -1). + * @return {Phaser.Display.Color} This Color object. */ - getTotalFree: function () + update: function (updateHSV) { - var used = this.getTotalUsed(); - var capacity = (this.maxSize === -1) ? 999999999999 : this.maxSize; + if (updateHSV === undefined) { updateHSV = false; } - return (capacity - used); - }, + if (this._locked) + { + return this; + } - /** - * Sets the `active` property of this Group. - * When active, this Group runs its `preUpdate` method. - * - * @method Phaser.GameObjects.Group#setActive - * @since 3.24.0 - * - * @param {boolean} value - True if this Group should be set as active, false if not. - * - * @return {this} This Group object. - */ - setActive: function (value) - { - this.active = value; + var r = this.r; + var g = this.g; + var b = this.b; + var a = this.a; + + this._color = GetColor(r, g, b); + this._color32 = GetColor32(r, g, b, a); + this._rgba = 'rgba(' + r + ',' + g + ',' + b + ',' + (a / 255) + ')'; + + if (updateHSV) + { + RGBToHSV(r, g, b, this); + } return this; }, /** - * Sets the `name` property of this Group. - * The `name` property is not populated by Phaser and is presented for your own use. - * - * @method Phaser.GameObjects.Group#setName - * @since 3.24.0 + * Updates the internal hsv cache values. * - * @param {string} value - The name to be given to this Group. + * @method Phaser.Display.Color#updateHSV + * @private + * @since 3.13.0 * - * @return {this} This Group object. + * @return {Phaser.Display.Color} This Color object. */ - setName: function (value) + updateHSV: function () { - this.name = value; + var r = this.r; + var g = this.g; + var b = this.b; + + RGBToHSV(r, g, b, this); return this; }, /** - * Sets the property as defined in `key` of each group member to the given value. - * - * @method Phaser.GameObjects.Group#propertyValueSet - * @since 3.21.0 + * Returns a new Color component using the values from this one. * - * @param {string} key - The property to be updated. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @method Phaser.Display.Color#clone + * @since 3.0.0 * - * @return {this} This Group object. + * @return {Phaser.Display.Color} A new Color object. */ - propertyValueSet: function (key, value, step, index, direction) + clone: function () { - Actions.PropertyValueSet(this.children.entries, key, value, step, index, direction); - - return this; + return new Color(this.r, this.g, this.b, this.a); }, /** - * Adds the given value to the property as defined in `key` of each group member. - * - * @method Phaser.GameObjects.Group#propertyValueInc - * @since 3.21.0 + * Sets this Color object to be grayscaled based on the shade value given. * - * @param {string} key - The property to be updated. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @method Phaser.Display.Color#gray + * @since 3.13.0 + * + * @param {number} shade - A value between 0 and 255. * - * @return {this} This Group object. + * @return {Phaser.Display.Color} This Color object. */ - propertyValueInc: function (key, value, step, index, direction) + gray: function (shade) { - Actions.PropertyValueInc(this.children.entries, key, value, step, index, direction); - - return this; + return this.setTo(shade, shade, shade); }, /** - * Sets the x of each group member. - * - * @method Phaser.GameObjects.Group#setX - * @since 3.21.0 + * Sets this Color object to be a random color between the `min` and `max` values given. * - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @method Phaser.Display.Color#random + * @since 3.13.0 + * + * @param {number} [min=0] - The minimum random color value. Between 0 and 255. + * @param {number} [max=255] - The maximum random color value. Between 0 and 255. * - * @return {this} This Group object. + * @return {Phaser.Display.Color} This Color object. */ - setX: function (value, step) + random: function (min, max) { - Actions.SetX(this.children.entries, value, step); + if (min === undefined) { min = 0; } + if (max === undefined) { max = 255; } - return this; + var r = Math.floor(min + Math.random() * (max - min)); + var g = Math.floor(min + Math.random() * (max - min)); + var b = Math.floor(min + Math.random() * (max - min)); + + return this.setTo(r, g, b); }, /** - * Sets the y of each group member. - * - * @method Phaser.GameObjects.Group#setY - * @since 3.21.0 + * Sets this Color object to be a random grayscale color between the `min` and `max` values given. * - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @method Phaser.Display.Color#randomGray + * @since 3.13.0 + * + * @param {number} [min=0] - The minimum random color value. Between 0 and 255. + * @param {number} [max=255] - The maximum random color value. Between 0 and 255. * - * @return {this} This Group object. + * @return {Phaser.Display.Color} This Color object. */ - setY: function (value, step) + randomGray: function (min, max) { - Actions.SetY(this.children.entries, value, step); + if (min === undefined) { min = 0; } + if (max === undefined) { max = 255; } - return this; + var s = Math.floor(min + Math.random() * (max - min)); + + return this.setTo(s, s, s); }, /** - * Sets the x, y of each group member. - * - * @method Phaser.GameObjects.Group#setXY - * @since 3.21.0 + * Increase the saturation of this Color by the percentage amount given. + * The saturation is the amount of the base color in the hue. * - * @param {number} x - The amount to set the `x` property to. - * @param {number} [y=x] - The amount to set the `y` property to. If `undefined` or `null` it uses the `x` value. - * @param {number} [stepX=0] - This is added to the `x` amount, multiplied by the iteration counter. - * @param {number} [stepY=0] - This is added to the `y` amount, multiplied by the iteration counter. + * @method Phaser.Display.Color#saturate + * @since 3.13.0 + * + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * - * @return {this} This Group object. + * @return {Phaser.Display.Color} This Color object. */ - setXY: function (x, y, stepX, stepY) + saturate: function (amount) { - Actions.SetXY(this.children.entries, x, y, stepX, stepY); + this.s += amount / 100; return this; }, /** - * Adds the given value to the x of each group member. - * - * @method Phaser.GameObjects.Group#incX - * @since 3.21.0 + * Decrease the saturation of this Color by the percentage amount given. + * The saturation is the amount of the base color in the hue. * - * @param {number} value - The amount to be added to the `x` property. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @method Phaser.Display.Color#desaturate + * @since 3.13.0 + * + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * - * @return {this} This Group object. + * @return {Phaser.Display.Color} This Color object. */ - incX: function (value, step) + desaturate: function (amount) { - Actions.IncX(this.children.entries, value, step); + this.s -= amount / 100; return this; }, /** - * Adds the given value to the y of each group member. - * - * @method Phaser.GameObjects.Group#incY - * @since 3.21.0 + * Increase the lightness of this Color by the percentage amount given. * - * @param {number} value - The amount to be added to the `y` property. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @method Phaser.Display.Color#lighten + * @since 3.13.0 + * + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * - * @return {this} This Group object. + * @return {Phaser.Display.Color} This Color object. */ - incY: function (value, step) + lighten: function (amount) { - Actions.IncY(this.children.entries, value, step); + this.v += amount / 100; return this; }, /** - * Adds the given value to the x, y of each group member. - * - * @method Phaser.GameObjects.Group#incXY - * @since 3.21.0 + * Decrease the lightness of this Color by the percentage amount given. * - * @param {number} x - The amount to be added to the `x` property. - * @param {number} [y=x] - The amount to be added to the `y` property. If `undefined` or `null` it uses the `x` value. - * @param {number} [stepX=0] - This is added to the `x` amount, multiplied by the iteration counter. - * @param {number} [stepY=0] - This is added to the `y` amount, multiplied by the iteration counter. + * @method Phaser.Display.Color#darken + * @since 3.13.0 + * + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * - * @return {this} This Group object. + * @return {Phaser.Display.Color} This Color object. */ - incXY: function (x, y, stepX, stepY) + darken: function (amount) { - Actions.IncXY(this.children.entries, x, y, stepX, stepY); + this.v -= amount / 100; return this; }, /** - * Iterate through the group members changing the position of each element to be that of the element that came before - * it in the array (or after it if direction = 1) - * - * The first group member position is set to x/y. - * - * @method Phaser.GameObjects.Group#shiftPosition - * @since 3.21.0 + * Brighten this Color by the percentage amount given. * - * @param {number} x - The x coordinate to place the first item in the array at. - * @param {number} y - The y coordinate to place the first item in the array at. - * @param {number} [direction=0] - The iteration direction. 0 = first to last and 1 = last to first. + * @method Phaser.Display.Color#brighten + * @since 3.13.0 + * + * @param {number} amount - The percentage amount to change this color by. A value between 0 and 100. * - * @return {this} This Group object. + * @return {Phaser.Display.Color} This Color object. */ - shiftPosition: function (x, y, direction) + brighten: function (amount) { - Actions.ShiftPosition(this.children.entries, x, y, direction); + var r = this.r; + var g = this.g; + var b = this.b; - return this; + r = Math.max(0, Math.min(255, r - Math.round(255 * - (amount / 100)))); + g = Math.max(0, Math.min(255, g - Math.round(255 * - (amount / 100)))); + b = Math.max(0, Math.min(255, b - Math.round(255 * - (amount / 100)))); + + return this.setTo(r, g, b); }, /** - * Sets the angle of each group member. - * - * @method Phaser.GameObjects.Group#angle - * @since 3.21.0 - * - * @param {number} value - The amount to set the angle to, in degrees. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * The color of this Color component, not including the alpha channel. * - * @return {this} This Group object. + * @name Phaser.Display.Color#color + * @type {number} + * @readonly + * @since 3.0.0 */ - angle: function (value, step) - { - Actions.Angle(this.children.entries, value, step); + color: { + + get: function () + { + return this._color; + } - return this; }, /** - * Sets the rotation of each group member. - * - * @method Phaser.GameObjects.Group#rotate - * @since 3.21.0 - * - * @param {number} value - The amount to set the rotation to, in radians. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * The color of this Color component, including the alpha channel. * - * @return {this} This Group object. + * @name Phaser.Display.Color#color32 + * @type {number} + * @readonly + * @since 3.0.0 */ - rotate: function (value, step) - { - Actions.Rotate(this.children.entries, value, step); + color32: { + + get: function () + { + return this._color32; + } - return this; }, /** - * Rotates each group member around the given point by the given angle. - * - * @method Phaser.GameObjects.Group#rotateAround - * @since 3.21.0 - * - * @param {Phaser.Types.Math.Vector2Like} point - Any object with public `x` and `y` properties. - * @param {number} angle - The angle to rotate by, in radians. + * The color of this Color component as a string which can be used in CSS color values. * - * @return {this} This Group object. + * @name Phaser.Display.Color#rgba + * @type {string} + * @readonly + * @since 3.0.0 */ - rotateAround: function (point, angle) - { - Actions.RotateAround(this.children.entries, point, angle); + rgba: { + + get: function () + { + return this._rgba; + } - return this; }, /** - * Rotates each group member around the given point by the given angle and distance. - * - * @method Phaser.GameObjects.Group#rotateAroundDistance - * @since 3.21.0 - * - * @param {Phaser.Types.Math.Vector2Like} point - Any object with public `x` and `y` properties. - * @param {number} angle - The angle to rotate by, in radians. - * @param {number} distance - The distance from the point of rotation in pixels. + * The red color value, normalized to the range 0 to 1. * - * @return {this} This Group object. + * @name Phaser.Display.Color#redGL + * @type {number} + * @since 3.0.0 */ - rotateAroundDistance: function (point, angle, distance) - { - Actions.RotateAroundDistance(this.children.entries, point, angle, distance); + redGL: { + + get: function () + { + return this.gl[0]; + }, + + set: function (value) + { + this.gl[0] = Math.min(Math.abs(value), 1); + + this.r = Math.floor(this.gl[0] * 255); + + this.update(true); + } - return this; }, /** - * Sets the alpha of each group member. - * - * @method Phaser.GameObjects.Group#setAlpha - * @since 3.21.0 - * - * @param {number} value - The amount to set the alpha to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * The green color value, normalized to the range 0 to 1. * - * @return {this} This Group object. + * @name Phaser.Display.Color#greenGL + * @type {number} + * @since 3.0.0 */ - setAlpha: function (value, step) - { - Actions.SetAlpha(this.children.entries, value, step); + greenGL: { + + get: function () + { + return this.gl[1]; + }, + + set: function (value) + { + this.gl[1] = Math.min(Math.abs(value), 1); + + this.g = Math.floor(this.gl[1] * 255); + + this.update(true); + } - return this; }, /** - * Sets the tint of each group member. - * - * @method Phaser.GameObjects.Group#setTint - * @since 3.21.0 - * - * @param {number} topLeft - The tint being applied to top-left corner of item. If other parameters are given no value, this tint will be applied to whole item. - * @param {number} [topRight] - The tint to be applied to top-right corner of item. - * @param {number} [bottomLeft] - The tint to be applied to the bottom-left corner of item. - * @param {number} [bottomRight] - The tint to be applied to the bottom-right corner of item. + * The blue color value, normalized to the range 0 to 1. * - * @return {this} This Group object. + * @name Phaser.Display.Color#blueGL + * @type {number} + * @since 3.0.0 */ - setTint: function (topLeft, topRight, bottomLeft, bottomRight) - { - Actions.SetTint(this.children.entries, topLeft, topRight, bottomLeft, bottomRight); + blueGL: { + + get: function () + { + return this.gl[2]; + }, + + set: function (value) + { + this.gl[2] = Math.min(Math.abs(value), 1); + + this.b = Math.floor(this.gl[2] * 255); + + this.update(true); + } - return this; }, /** - * Sets the originX, originY of each group member. - * - * @method Phaser.GameObjects.Group#setOrigin - * @since 3.21.0 - * - * @param {number} originX - The amount to set the `originX` property to. - * @param {number} [originY] - The amount to set the `originY` property to. If `undefined` or `null` it uses the `originX` value. - * @param {number} [stepX=0] - This is added to the `originX` amount, multiplied by the iteration counter. - * @param {number} [stepY=0] - This is added to the `originY` amount, multiplied by the iteration counter. + * The alpha color value, normalized to the range 0 to 1. * - * @return {this} This Group object. + * @name Phaser.Display.Color#alphaGL + * @type {number} + * @since 3.0.0 */ - setOrigin: function (originX, originY, stepX, stepY) - { - Actions.SetOrigin(this.children.entries, originX, originY, stepX, stepY); + alphaGL: { - return this; - }, + get: function () + { + return this.gl[3]; + }, - /** - * Sets the scaleX of each group member. - * - * @method Phaser.GameObjects.Group#scaleX - * @since 3.21.0 - * - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * - * @return {this} This Group object. - */ - scaleX: function (value, step) - { - Actions.ScaleX(this.children.entries, value, step); + set: function (value) + { + this.gl[3] = Math.min(Math.abs(value), 1); - return this; - }, + this.a = Math.floor(this.gl[3] * 255); - /** - * Sets the scaleY of each group member. - * - * @method Phaser.GameObjects.Group#scaleY - * @since 3.21.0 - * - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * - * @return {this} This Group object. - */ - scaleY: function (value, step) - { - Actions.ScaleY(this.children.entries, value, step); + this.update(); + } - return this; }, /** - * Sets the scaleX, scaleY of each group member. - * - * @method Phaser.GameObjects.Group#scaleXY - * @since 3.21.0 - * - * @param {number} scaleX - The amount to be added to the `scaleX` property. - * @param {number} [scaleY] - The amount to be added to the `scaleY` property. If `undefined` or `null` it uses the `scaleX` value. - * @param {number} [stepX=0] - This is added to the `scaleX` amount, multiplied by the iteration counter. - * @param {number} [stepY=0] - This is added to the `scaleY` amount, multiplied by the iteration counter. + * The red color value, normalized to the range 0 to 255. * - * @return {this} This Group object. + * @name Phaser.Display.Color#red + * @type {number} + * @since 3.0.0 */ - scaleXY: function (scaleX, scaleY, stepX, stepY) - { - Actions.ScaleXY(this.children.entries, scaleX, scaleY, stepX, stepY); + red: { - return this; - }, + get: function () + { + return this.r; + }, - /** - * Sets the depth of each group member. - * - * @method Phaser.GameObjects.Group#setDepth - * @since 3.0.0 - * - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * - * @return {this} This Group object. - */ - setDepth: function (value, step) - { - Actions.SetDepth(this.children.entries, value, step); + set: function (value) + { + value = Math.floor(Math.abs(value)); - return this; - }, + this.r = Math.min(value, 255); - /** - * Sets the blendMode of each group member. - * - * @method Phaser.GameObjects.Group#setBlendMode - * @since 3.21.0 - * - * @param {number} value - The amount to set the property to. - * - * @return {this} This Group object. - */ - setBlendMode: function (value) - { - Actions.SetBlendMode(this.children.entries, value); + this.gl[0] = value / 255; + + this.update(true); + } - return this; }, /** - * Passes all group members to the Input Manager to enable them for input with identical areas and callbacks. - * - * @method Phaser.GameObjects.Group#setHitArea - * @since 3.21.0 - * - * @param {*} hitArea - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. - * @param {Phaser.Types.Input.HitAreaCallback} hitAreaCallback - A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback. + * The green color value, normalized to the range 0 to 255. * - * @return {this} This Group object. + * @name Phaser.Display.Color#green + * @type {number} + * @since 3.0.0 */ - setHitArea: function (hitArea, hitAreaCallback) - { - Actions.SetHitArea(this.children.entries, hitArea, hitAreaCallback); + green: { - return this; - }, + get: function () + { + return this.g; + }, - /** - * Shuffles the group members in place. - * - * @method Phaser.GameObjects.Group#shuffle - * @since 3.21.0 - * - * @return {this} This Group object. - */ - shuffle: function () - { - Actions.Shuffle(this.children.entries); + set: function (value) + { + value = Math.floor(Math.abs(value)); + + this.g = Math.min(value, 255); + + this.gl[1] = value / 255; + + this.update(true); + } - return this; }, /** - * Deactivates a member of this group. + * The blue color value, normalized to the range 0 to 255. * - * @method Phaser.GameObjects.Group#kill + * @name Phaser.Display.Color#blue + * @type {number} * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - A member of this group. */ - kill: function (gameObject) - { - if (this.children.contains(gameObject)) + blue: { + + get: function () { - gameObject.setActive(false); + return this.b; + }, + + set: function (value) + { + value = Math.floor(Math.abs(value)); + + this.b = Math.min(value, 255); + + this.gl[2] = value / 255; + + this.update(true); } + }, /** - * Deactivates and hides a member of this group. + * The alpha color value, normalized to the range 0 to 255. * - * @method Phaser.GameObjects.Group#killAndHide + * @name Phaser.Display.Color#alpha + * @type {number} * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - A member of this group. */ - killAndHide: function (gameObject) - { - if (this.children.contains(gameObject)) + alpha: { + + get: function () { - gameObject.setActive(false); - gameObject.setVisible(false); + return this.a; + }, + + set: function (value) + { + value = Math.floor(Math.abs(value)); + + this.a = Math.min(value, 255); + + this.gl[3] = value / 255; + + this.update(); } + }, /** - * Sets the visible of each group member. - * - * @method Phaser.GameObjects.Group#setVisible - * @since 3.21.0 - * - * @param {boolean} value - The value to set the property to. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * The hue color value. A number between 0 and 1. + * This is the base color. * - * @return {this} This Group object. + * @name Phaser.Display.Color#h + * @type {number} + * @since 3.13.0 */ - setVisible: function (value, index, direction) - { - Actions.SetVisible(this.children.entries, value, index, direction); + h: { + + get: function () + { + return this._h; + }, + + set: function (value) + { + this._h = value; + + HSVToRGB(value, this._s, this._v, this); + } - return this; }, /** - * Toggles (flips) the visible state of each member of this group. - * - * @method Phaser.GameObjects.Group#toggleVisible - * @since 3.0.0 + * The saturation color value. A number between 0 and 1. + * This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white. * - * @return {this} This Group object. + * @name Phaser.Display.Color#s + * @type {number} + * @since 3.13.0 */ - toggleVisible: function () - { - Actions.ToggleVisible(this.children.entries); + s: { + + get: function () + { + return this._s; + }, + + set: function (value) + { + this._s = value; + + HSVToRGB(this._h, value, this._v, this); + } - return this; }, /** - * Empties this Group of all children and removes it from the Scene. - * - * Does not call {@link Phaser.GameObjects.Group#removeCallback}. - * - * Children of this Group will _not_ be removed from the Scene by calling this method - * unless you specify the `removeFromScene` parameter. - * - * Children of this Group will also _not_ be destroyed by calling this method - * unless you specify the `destroyChildren` parameter. - * - * @method Phaser.GameObjects.Group#destroy - * @since 3.0.0 + * The lightness color value. A number between 0 and 1. + * This controls how dark the color is. Where 1 is as bright as possible and 0 is black. * - * @param {boolean} [destroyChildren=false] - Also {@link Phaser.GameObjects.GameObject#destroy} each Group member. - * @param {boolean} [removeFromScene=false] - Optionally remove each Group member from the Scene. + * @name Phaser.Display.Color#v + * @type {number} + * @since 3.13.0 */ - destroy: function (destroyChildren, removeFromScene) - { - if (destroyChildren === undefined) { destroyChildren = false; } - if (removeFromScene === undefined) { removeFromScene = false; } + v: { - // This Game Object had already been destroyed - if (!this.scene || this.ignoreDestroy) + get: function () { - return; - } - - this.emit(Events.DESTROY, this); - - this.removeAllListeners(); + return this._v; + }, - this.scene.sys.updateList.remove(this); + set: function (value) + { + this._v = value; - this.clear(removeFromScene, destroyChildren); + HSVToRGB(this._h, this._s, value, this); + } - this.scene = undefined; - this.children = undefined; } }); -module.exports = Group; +module.exports = Color; /***/ }), -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 30245: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(12); +var GetColor = __webpack_require__(22946); /** - * Renders a filled path for the given Shape. + * Return an array of Colors in a Color Spectrum. * - * @method Phaser.GameObjects.Shape#FillPathWebGL - * @since 3.13.0 - * @private + * The spectrum colors flow in the order: red, yellow, green, blue. * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The WebGL Pipeline used to render this Shape. - * @param {Phaser.GameObjects.Components.TransformMatrix} calcMatrix - The transform matrix used to get the position values. - * @param {Phaser.GameObjects.Shape} src - The Game Object shape being rendered in this call. - * @param {number} alpha - The base alpha value. - * @param {number} dx - The source displayOriginX. - * @param {number} dy - The source displayOriginY. + * By default this function will return an array with 1024 elements in. + * + * However, you can reduce this to a smaller quantity if needed, by specitying the `limit` parameter. + * + * @function Phaser.Display.Color.ColorSpectrum + * @since 3.50.0 + * + * @param {number} [limit=1024] - How many colors should be returned? The maximum is 1024 but you can set a smaller quantity if required. + * + * @return {Phaser.Types.Display.ColorObject[]} An array containing `limit` parameter number of elements, where each contains a Color Object. */ -var FillPathWebGL = function (pipeline, calcMatrix, src, alpha, dx, dy) +var ColorSpectrum = function (limit) { - var fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); + if (limit === undefined) { limit = 1024; } - var path = src.pathData; - var pathIndexes = src.pathIndexes; + var colors = []; - for (var i = 0; i < pathIndexes.length; i += 3) + var range = 255; + + var i; + var r = 255; + var g = 0; + var b = 0; + + // Red to Yellow + for (i = 0; i <= range; i++) { - var p0 = pathIndexes[i] * 2; - var p1 = pathIndexes[i + 1] * 2; - var p2 = pathIndexes[i + 2] * 2; + colors.push({ r: r, g: i, b: b, color: GetColor(r, i, b) }); + } - var x0 = path[p0 + 0] - dx; - var y0 = path[p0 + 1] - dy; - var x1 = path[p1 + 0] - dx; - var y1 = path[p1 + 1] - dy; - var x2 = path[p2 + 0] - dx; - var y2 = path[p2 + 1] - dy; + g = 255; - var tx0 = calcMatrix.getX(x0, y0); - var ty0 = calcMatrix.getY(x0, y0); + // Yellow to Green + for (i = range; i >= 0; i--) + { + colors.push({ r: i, g: g, b: b, color: GetColor(i, g, b) }); + } - var tx1 = calcMatrix.getX(x1, y1); - var ty1 = calcMatrix.getY(x1, y1); + r = 0; - var tx2 = calcMatrix.getX(x2, y2); - var ty2 = calcMatrix.getY(x2, y2); + // Green to Blue + for (i = 0; i <= range; i++, g--) + { + colors.push({ r: r, g: g, b: i, color: GetColor(r, g, i) }); + } - pipeline.batchTri(src, tx0, ty0, tx1, ty1, tx2, ty2, 0, 0, 1, 1, fillTintColor, fillTintColor, fillTintColor, 2); + g = 0; + b = 255; + + // Blue to Red + for (i = 0; i <= range; i++, b--, r++) + { + colors.push({ r: r, g: g, b: b, color: GetColor(r, g, b) }); + } + + if (limit === 1024) + { + return colors; + } + else + { + var out = []; + + var t = 0; + var inc = 1024 / limit; + + for (i = 0; i < limit; i++) + { + out.push(colors[Math.floor(t)]); + + t += inc; + } + + return out; } }; -module.exports = FillPathWebGL; +module.exports = ColorSpectrum; /***/ }), -/* 115 */ -/***/ (function(module, exports) { + +/***/ 86672: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// http://www.blackpawn.com/texts/pointinpoly/ - /** - * Checks if a point (as a pair of coordinates) is inside a Triangle's bounds. + * Converts the given color value into an Object containing r,g,b and a properties. * - * @function Phaser.Geom.Triangle.Contains + * @function Phaser.Display.Color.ColorToRGBA * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to check. - * @param {number} x - The X coordinate of the point to check. - * @param {number} y - The Y coordinate of the point to check. + * @param {number} color - A color value, optionally including the alpha value. * - * @return {boolean} `true` if the point is inside the Triangle, otherwise `false`. + * @return {Phaser.Types.Display.ColorObject} An object containing the parsed color values. */ -var Contains = function (triangle, x, y) +var ColorToRGBA = function (color) { - var v0x = triangle.x3 - triangle.x1; - var v0y = triangle.y3 - triangle.y1; + var output = { + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF, + a: 255 + }; - var v1x = triangle.x2 - triangle.x1; - var v1y = triangle.y2 - triangle.y1; + if (color > 16777215) + { + output.a = color >>> 24; + } - var v2x = x - triangle.x1; - var v2y = y - triangle.y1; + return output; +}; - var dot00 = (v0x * v0x) + (v0y * v0y); - var dot01 = (v0x * v1x) + (v0y * v1y); - var dot02 = (v0x * v2x) + (v0y * v2y); - var dot11 = (v1x * v1x) + (v1y * v1y); - var dot12 = (v1x * v2x) + (v1y * v2y); +module.exports = ColorToRGBA; - // Compute barycentric coordinates - var b = ((dot00 * dot11) - (dot01 * dot01)); - var inv = (b === 0) ? 0 : (1 / b); - var u = ((dot11 * dot02) - (dot01 * dot12)) * inv; - var v = ((dot00 * dot12) - (dot01 * dot02)) * inv; - return (u >= 0 && v >= 0 && (u + v < 1)); +/***/ }), + +/***/ 25409: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Returns a string containing a hex representation of the given color component. + * + * @function Phaser.Display.Color.ComponentToHex + * @since 3.0.0 + * + * @param {number} color - The color channel to get the hex value for, must be a value between 0 and 255. + * + * @return {string} A string of length 2 characters, i.e. 255 = ff, 100 = 64. + */ +var ComponentToHex = function (color) +{ + var hex = color.toString(16); + + return (hex.length === 1) ? '0' + hex : hex; }; -module.exports = Contains; +module.exports = ComponentToHex; /***/ }), -/* 116 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 22946: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Rectangle = __webpack_require__(10); -var Vector2 = __webpack_require__(3); - /** - * Returns the length of the line. + * Given 3 separate color values this will return an integer representation of it. * - * @ignore - * @private + * @function Phaser.Display.Color.GetColor + * @since 3.0.0 * - * @param {number} x1 - The x1 coordinate. - * @param {number} y1 - The y1 coordinate. - * @param {number} x2 - The x2 coordinate. - * @param {number} y2 - The y2 coordinate. + * @param {number} red - The red color value. A number between 0 and 255. + * @param {number} green - The green color value. A number between 0 and 255. + * @param {number} blue - The blue color value. A number between 0 and 255. * - * @return {number} The length of the line. + * @return {number} The combined color value. */ -function GetLength (x1, y1, x2, y2) +var GetColor = function (red, green, blue) { - var x = x1 - x2; - var y = y1 - y2; - var magnitude = (x * x) + (y * y); + return red << 16 | green << 8 | blue; +}; - return Math.sqrt(magnitude); -} +module.exports = GetColor; + + +/***/ }), + +/***/ 5657: +/***/ ((module) => { /** - * @classdesc - * A Face Geometry Object. - * - * A Face is used by the Mesh Game Object. A Mesh consists of one, or more, faces that are - * used to render the Mesh Game Objects in WebGL. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Given an alpha and 3 color values this will return an integer representation of it. * - * A Face consists of 3 Vertex instances, for the 3 corners of the face and methods to help - * you modify and test them. + * @function Phaser.Display.Color.GetColor32 + * @since 3.0.0 * - * @class Face - * @memberof Phaser.Geom.Mesh - * @constructor - * @since 3.50.0 + * @param {number} red - The red color value. A number between 0 and 255. + * @param {number} green - The green color value. A number between 0 and 255. + * @param {number} blue - The blue color value. A number between 0 and 255. + * @param {number} alpha - The alpha color value. A number between 0 and 255. * - * @param {Phaser.Geom.Mesh.Vertex} vertex1 - The first vertex of the Face. - * @param {Phaser.Geom.Mesh.Vertex} vertex2 - The second vertex of the Face. - * @param {Phaser.Geom.Mesh.Vertex} vertex3 - The third vertex of the Face. + * @return {number} The combined color value. */ -var Face = new Class({ +var GetColor32 = function (red, green, blue, alpha) +{ + return alpha << 24 | red << 16 | green << 8 | blue; +}; - initialize: +module.exports = GetColor32; - function Face (vertex1, vertex2, vertex3) - { - /** - * The first vertex in this Face. - * - * @name Phaser.Geom.Mesh.Face#vertex1 - * @type {Phaser.Geom.Mesh.Vertex} - * @since 3.50.0 - */ - this.vertex1 = vertex1; - /** - * The second vertex in this Face. - * - * @name Phaser.Geom.Mesh.Face#vertex2 - * @type {Phaser.Geom.Mesh.Vertex} - * @since 3.50.0 - */ - this.vertex2 = vertex2; +/***/ }), - /** - * The third vertex in this Face. - * - * @name Phaser.Geom.Mesh.Face#vertex3 - * @type {Phaser.Geom.Mesh.Vertex} - * @since 3.50.0 - */ - this.vertex3 = vertex3; +/***/ 74777: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The bounds of this Face. - * - * Be sure to call the `Face.updateBounds` method _before_ using this property. - * - * @name Phaser.Geom.Mesh.Face#bounds - * @type {Phaser.Geom.Rectangle} - * @since 3.50.0 - */ - this.bounds = new Rectangle(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The face inCenter. Do not access directly, instead use the `getInCenter` method. - * - * @name Phaser.Geom.Mesh.Face#_inCenter - * @type {Phaser.Math.Vector2} - * @private - * @since 3.50.0 - */ - this._inCenter = new Vector2(); - }, +var Color = __webpack_require__(27119); +var HueToComponent = __webpack_require__(59998); - /** - * Calculates and returns the in-center position of this Face. - * - * @method Phaser.Geom.Mesh.Face#getInCenter - * @since 3.50.0 - * - * @param {boolean} [local=true] Return the in center from the un-transformed vertex positions (`true`), or transformed? (`false`) - * - * @return {Phaser.Math.Vector2} A Vector2 containing the in center position of this Face. - */ - getInCenter: function (local) - { - if (local === undefined) { local = true; } +/** + * Converts HSL (hue, saturation and lightness) values to a Phaser Color object. + * + * @function Phaser.Display.Color.HSLToColor + * @since 3.0.0 + * + * @param {number} h - The hue value in the range 0 to 1. + * @param {number} s - The saturation value in the range 0 to 1. + * @param {number} l - The lightness value in the range 0 to 1. + * + * @return {Phaser.Display.Color} A Color object created from the results of the h, s and l values. + */ +var HSLToColor = function (h, s, l) +{ + // achromatic by default + var r = l; + var g = l; + var b = l; - var v1 = this.vertex1; - var v2 = this.vertex2; - var v3 = this.vertex3; + if (s !== 0) + { + var q = (l < 0.5) ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; - var v1x; - var v1y; + r = HueToComponent(p, q, h + 1 / 3); + g = HueToComponent(p, q, h); + b = HueToComponent(p, q, h - 1 / 3); + } - var v2x; - var v2y; + var color = new Color(); - var v3x; - var v3y; + return color.setGLTo(r, g, b, 1); +}; - if (local) - { - v1x = v1.x; - v1y = v1.y; +module.exports = HSLToColor; - v2x = v2.x; - v2y = v2.y; - v3x = v3.x; - v3y = v3.y; - } - else - { - v1x = v1.vx; - v1y = v1.vy; +/***/ }), - v2x = v2.vx; - v2y = v2.vy; +/***/ 89263: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - v3x = v3.vx; - v3y = v3.vy; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var d1 = GetLength(v3x, v3y, v2x, v2y); - var d2 = GetLength(v1x, v1y, v3x, v3y); - var d3 = GetLength(v2x, v2y, v1x, v1y); +var HSVToRGB = __webpack_require__(24650); - var p = d1 + d2 + d3; +/** + * Generates an HSV color wheel which is an array of 360 Color objects, for each step of the wheel. + * + * @function Phaser.Display.Color.HSVColorWheel + * @since 3.0.0 + * + * @param {number} [s=1] - The saturation, in the range 0 - 1. + * @param {number} [v=1] - The value, in the range 0 - 1. + * + * @return {Phaser.Types.Display.ColorObject[]} An array containing 360 ColorObject elements, where each element contains a Color object corresponding to the color at that point in the HSV color wheel. + */ +var HSVColorWheel = function (s, v) +{ + if (s === undefined) { s = 1; } + if (v === undefined) { v = 1; } - return this._inCenter.set( - (v1x * d1 + v2x * d2 + v3x * d3) / p, - (v1y * d1 + v2y * d2 + v3y * d3) / p - ); - }, + var colors = []; - /** - * Checks if the given coordinates are within this Face. - * - * You can optionally provide a transform matrix. If given, the Face vertices - * will be transformed first, before being checked against the coordinates. - * - * @method Phaser.Geom.Mesh.Face#contains - * @since 3.50.0 - * - * @param {number} x - The horizontal position to check. - * @param {number} y - The vertical position to check. - * @param {Phaser.GameObjects.Components.TransformMatrix} [calcMatrix] - Optional transform matrix to apply to the vertices before comparison. - * - * @return {boolean} `true` if the coordinates lay within this Face, otherwise `false`. - */ - contains: function (x, y, calcMatrix) + for (var c = 0; c <= 359; c++) { - var vertex1 = this.vertex1; - var vertex2 = this.vertex2; - var vertex3 = this.vertex3; - - var v1x = vertex1.vx; - var v1y = vertex1.vy; + colors.push(HSVToRGB(c / 359, s, v)); + } - var v2x = vertex2.vx; - var v2y = vertex2.vy; + return colors; +}; - var v3x = vertex3.vx; - var v3y = vertex3.vy; +module.exports = HSVColorWheel; - if (calcMatrix) - { - var a = calcMatrix.a; - var b = calcMatrix.b; - var c = calcMatrix.c; - var d = calcMatrix.d; - var e = calcMatrix.e; - var f = calcMatrix.f; - v1x = vertex1.vx * a + vertex1.vy * c + e; - v1y = vertex1.vx * b + vertex1.vy * d + f; +/***/ }), - v2x = vertex2.vx * a + vertex2.vy * c + e; - v2y = vertex2.vx * b + vertex2.vy * d + f; +/***/ 24650: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - v3x = vertex3.vx * a + vertex3.vy * c + e; - v3y = vertex3.vx * b + vertex3.vy * d + f; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var t0x = v3x - v1x; - var t0y = v3y - v1y; +var GetColor = __webpack_require__(22946); - var t1x = v2x - v1x; - var t1y = v2y - v1y; +/** + * RGB space conversion. + * + * @ignore + * + * @param {number} n - The value to convert. + * @param {number} h - The h value. + * @param {number} s - The s value. + * @param {number} v - The v value. + * + * @return {number} The converted value. + */ +function ConvertValue (n, h, s, v) +{ + var k = (n + h * 6) % 6; - var t2x = x - v1x; - var t2y = y - v1y; + var min = Math.min(k, 4 - k, 1); - var dot00 = (t0x * t0x) + (t0y * t0y); - var dot01 = (t0x * t1x) + (t0y * t1y); - var dot02 = (t0x * t2x) + (t0y * t2y); - var dot11 = (t1x * t1x) + (t1y * t1y); - var dot12 = (t1x * t2x) + (t1y * t2y); + return Math.round(255 * (v - v * s * Math.max(0, min))); +} - // Compute barycentric coordinates - var bc = ((dot00 * dot11) - (dot01 * dot01)); - var inv = (bc === 0) ? 0 : (1 / bc); - var u = ((dot11 * dot02) - (dot01 * dot12)) * inv; - var v = ((dot00 * dot12) - (dot01 * dot02)) * inv; +/** + * Converts a HSV (hue, saturation and value) color set to RGB. + * + * Conversion formula from https://en.wikipedia.org/wiki/HSL_and_HSV + * + * Assumes HSV values are contained in the set [0, 1]. + * + * @function Phaser.Display.Color.HSVToRGB + * @since 3.0.0 + * + * @param {number} h - The hue, in the range 0 - 1. This is the base color. + * @param {number} s - The saturation, in the range 0 - 1. This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white. + * @param {number} v - The value, in the range 0 - 1. This controls how dark the color is. Where 1 is as bright as possible and 0 is black. + * @param {(Phaser.Types.Display.ColorObject|Phaser.Display.Color)} [out] - A Color object to store the results in. If not given a new ColorObject will be created. + * + * @return {(Phaser.Types.Display.ColorObject|Phaser.Display.Color)} An object with the red, green and blue values set in the r, g and b properties. + */ +var HSVToRGB = function (h, s, v, out) +{ + if (s === undefined) { s = 1; } + if (v === undefined) { v = 1; } - return (u >= 0 && v >= 0 && (u + v < 1)); - }, + var r = ConvertValue(5, h, s, v); + var g = ConvertValue(3, h, s, v); + var b = ConvertValue(1, h, s, v); - /** - * Checks if the vertices in this Face are orientated counter-clockwise, or not. - * - * It checks the transformed position of the vertices, not the local one. - * - * @method Phaser.Geom.Mesh.Face#isCounterClockwise - * @since 3.50.0 - * - * @param {number} z - The z-axis value to test against. Typically the `Mesh.modelPosition.z`. - * - * @return {boolean} `true` if the vertices in this Face run counter-clockwise, otherwise `false`. - */ - isCounterClockwise: function (z) + if (!out) { - var v1 = this.vertex1; - var v2 = this.vertex2; - var v3 = this.vertex3; + return { r: r, g: g, b: b, color: GetColor(r, g, b) }; + } + else if (out.setTo) + { + return out.setTo(r, g, b, out.alpha, true); + } + else + { + out.r = r; + out.g = g; + out.b = b; + out.color = GetColor(r, g, b); - var d = (v2.vx - v1.vx) * (v3.vy - v1.vy) - (v2.vy - v1.vy) * (v3.vx - v1.vx); + return out; + } +}; - return (z <= 0) ? d >= 0 : d < 0; - }, +module.exports = HSVToRGB; - /** - * Loads the data from this Vertex into the given Typed Arrays. - * - * @method Phaser.Geom.Mesh.Face#load - * @since 3.50.0 - * - * @param {Float32Array} F32 - A Float32 Array to insert the position, UV and unit data in to. - * @param {Uint32Array} U32 - A Uint32 Array to insert the color and alpha data in to. - * @param {number} offset - The index of the array to insert this Vertex to. - * @param {number} textureUnit - The texture unit currently in use. - * @param {number} tintEffect - The tint effect to use. - * - * @return {number} The new vertex index array offset. - */ - load: function (F32, U32, offset, textureUnit, tintEffect) - { - offset = this.vertex1.load(F32, U32, offset, textureUnit, tintEffect); - offset = this.vertex2.load(F32, U32, offset, textureUnit, tintEffect); - offset = this.vertex3.load(F32, U32, offset, textureUnit, tintEffect); - return offset; - }, +/***/ }), - /** - * Transforms all Face vertices by the given matrix, storing the results in their `vx`, `vy` and `vz` properties. - * - * @method Phaser.Geom.Mesh.Face#transformCoordinatesLocal - * @since 3.50.0 - * - * @param {Phaser.Math.Matrix4} transformMatrix - The transform matrix to apply to this vertex. - * @param {number} width - The width of the parent Mesh. - * @param {number} height - The height of the parent Mesh. - * @param {number} cameraZ - The z position of the MeshCamera. - * - * @return {this} This Face instance. - */ - transformCoordinatesLocal: function (transformMatrix, width, height, cameraZ) - { - this.vertex1.transformCoordinatesLocal(transformMatrix, width, height, cameraZ); - this.vertex2.transformCoordinatesLocal(transformMatrix, width, height, cameraZ); - this.vertex3.transformCoordinatesLocal(transformMatrix, width, height, cameraZ); +/***/ 91487: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Updates the bounds of this Face, based on the translated values of the vertices. - * - * Call this method prior to accessing the `Face.bounds` property. - * - * @method Phaser.Geom.Mesh.Face#updateBounds - * @since 3.50.0 - * - * @return {this} This Face instance. - */ - updateBounds: function () - { - var v1 = this.vertex1; - var v2 = this.vertex2; - var v3 = this.vertex3; +var Color = __webpack_require__(27119); - var bounds = this.bounds; +/** + * Converts a hex string into a Phaser Color object. + * + * The hex string can supplied as `'#0033ff'` or the short-hand format of `'#03f'`; it can begin with an optional "#" or "0x", or be unprefixed. + * + * An alpha channel is _not_ supported. + * + * @function Phaser.Display.Color.HexStringToColor + * @since 3.0.0 + * + * @param {string} hex - The hex color value to convert, such as `#0033ff` or the short-hand format: `#03f`. + * + * @return {Phaser.Display.Color} A Color object populated by the values of the given string. + */ +var HexStringToColor = function (hex) +{ + var color = new Color(); - bounds.x = Math.min(v1.vx, v2.vx, v3.vx); - bounds.y = Math.min(v1.vy, v2.vy, v3.vy); - bounds.width = Math.max(v1.vx, v2.vx, v3.vx) - bounds.x; - bounds.height = Math.max(v1.vy, v2.vy, v3.vy) - bounds.y; + // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") + hex = hex.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i, function (m, r, g, b) + { + return r + r + g + g + b + b; + }); - return this; - }, + var result = (/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i).exec(hex); - /** - * Checks if this Face is within the view of the given Camera. - * - * This method is called in the `MeshWebGLRenderer` function. It performs the following tasks: - * - * First, the `Vertex.update` method is called on each of the vertices. This populates them - * with the new translated values, updating their `tx`, `ty` and `ta` properties. - * - * Then it tests to see if this face is visible due to the alpha values, if not, it returns. - * - * After this, if `hideCCW` is set, it calls `isCounterClockwise` and returns if not. - * - * Finally, it will update the `Face.bounds` based on the newly translated vertex values - * and return the results of an intersection test between the bounds and the camera world view - * rectangle. - * - * @method Phaser.Geom.Mesh.Face#isInView - * @since 3.50.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against. - * @param {boolean} hideCCW - Test the counter-clockwise orientation of the verts? - * @param {number} z - The Cameras z position, used in the CCW test. - * @param {number} alpha - The alpha of the parent object. - * @param {number} a - The parent transform matrix data a component. - * @param {number} b - The parent transform matrix data b component. - * @param {number} c - The parent transform matrix data c component. - * @param {number} d - The parent transform matrix data d component. - * @param {number} e - The parent transform matrix data e component. - * @param {number} f - The parent transform matrix data f component. - * @param {boolean} roundPixels - Round the vertex position or not? - * - * @return {boolean} `true` if this Face can be seen by the Camera. - */ - isInView: function (camera, hideCCW, z, alpha, a, b, c, d, e, f, roundPixels) + if (result) { - var v1 = this.vertex1.update(a, b, c, d, e, f, roundPixels, alpha); - var v2 = this.vertex2.update(a, b, c, d, e, f, roundPixels, alpha); - var v3 = this.vertex3.update(a, b, c, d, e, f, roundPixels, alpha); + var r = parseInt(result[1], 16); + var g = parseInt(result[2], 16); + var b = parseInt(result[3], 16); - // Alpha check first - if (v1.ta <= 0 && v2.ta <= 0 && v3.ta <= 0) - { - return false; - } + color.setTo(r, g, b); + } - // CCW check - if (hideCCW && !this.isCounterClockwise(z)) - { - return false; - } + return color; +}; - // Bounds check - var bounds = this.bounds; +module.exports = HexStringToColor; - bounds.x = Math.min(v1.tx, v2.tx, v3.tx); - bounds.y = Math.min(v1.ty, v2.ty, v3.ty); - bounds.width = Math.max(v1.tx, v2.tx, v3.tx) - bounds.x; - bounds.height = Math.max(v1.ty, v2.ty, v3.ty) - bounds.y; - var cr = camera.x + camera.width; - var cb = camera.y + camera.height; +/***/ }), - if (bounds.width <= 0 || bounds.height <= 0 || camera.width <= 0 || camera.height <= 0) - { - return false; - } +/***/ 59998: +/***/ ((module) => { - return !(bounds.right < camera.x || bounds.bottom < camera.y || bounds.x > cr || bounds.y > cb); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Translates the vertices of this Face by the given amounts. - * - * The actual vertex positions are adjusted, not their transformed position. - * - * Therefore, this updates the vertex data directly. - * - * @method Phaser.Geom.Mesh.Face#translate - * @since 3.50.0 - * - * @param {number} x - The amount to horizontally translate by. - * @param {number} [y=0] - The amount to vertically translate by. - * - * @return {this} This Face instance. - */ - translate: function (x, y) +/** + * Converts a hue to an RGB color. + * Based on code by Michael Jackson (https://github.com/mjijackson) + * + * @function Phaser.Display.Color.HueToComponent + * @since 3.0.0 + * + * @param {number} p + * @param {number} q + * @param {number} t + * + * @return {number} The combined color value. + */ +var HueToComponent = function (p, q, t) +{ + if (t < 0) { - if (y === undefined) { y = 0; } + t += 1; + } - var v1 = this.vertex1; - var v2 = this.vertex2; - var v3 = this.vertex3; + if (t > 1) + { + t -= 1; + } - v1.x += x; - v1.y += y; + if (t < 1 / 6) + { + return p + (q - p) * 6 * t; + } - v2.x += x; - v2.y += y; + if (t < 1 / 2) + { + return q; + } - v3.x += x; - v3.y += y; + if (t < 2 / 3) + { + return p + (q - p) * (2 / 3 - t) * 6; + } - return this; - }, + return p; +}; - /** - * The x coordinate of this Face, based on the in center position of the Face. - * - * @name Phaser.Geom.Mesh.Face#x - * @type {number} - * @since 3.50.0 - */ - x: { +module.exports = HueToComponent; - get: function () - { - return this.getInCenter().x; - }, - set: function (value) - { - var current = this.getInCenter(); +/***/ }), - this.translate(value - current.x, 0); - } +/***/ 74853: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The y coordinate of this Face, based on the in center position of the Face. - * - * @name Phaser.Geom.Mesh.Face#y - * @type {number} - * @since 3.50.0 - */ - y: { +var Color = __webpack_require__(27119); +var IntegerToRGB = __webpack_require__(15978); - get: function () - { - return this.getInCenter().y; - }, +/** + * Converts the given color value into an instance of a Color object. + * + * @function Phaser.Display.Color.IntegerToColor + * @since 3.0.0 + * + * @param {number} input - The color value to convert into a Color object. + * + * @return {Phaser.Display.Color} A Color object. + */ +var IntegerToColor = function (input) +{ + var rgb = IntegerToRGB(input); - set: function (value) - { - var current = this.getInCenter(); + return new Color(rgb.r, rgb.g, rgb.b, rgb.a); +}; - this.translate(0, value - current.y); - } +module.exports = IntegerToColor; - }, - /** - * Set the alpha value of this Face. - * - * Each vertex is given the same value. If you need to adjust the alpha on a per-vertex basis - * then use the `Vertex.alpha` property instead. - * - * When getting the alpha of this Face, it will return an average of the alpha - * component of all three vertices. - * - * @name Phaser.Geom.Mesh.Face#alpha - * @type {number} - * @since 3.50.0 - */ - alpha: { +/***/ }), - get: function () - { - var v1 = this.vertex1; - var v2 = this.vertex2; - var v3 = this.vertex3; +/***/ 15978: +/***/ ((module) => { - return (v1.alpha + v2.alpha + v3.alpha) / 3; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - set: function (value) - { - this.vertex1.alpha = value; - this.vertex2.alpha = value; - this.vertex3.alpha = value; - } +/** + * Return the component parts of a color as an Object with the properties alpha, red, green, blue. + * + * Alpha will only be set if it exists in the given color (0xAARRGGBB) + * + * @function Phaser.Display.Color.IntegerToRGB + * @since 3.0.0 + * + * @param {number} input - The color value to convert into a Color object. + * + * @return {Phaser.Types.Display.ColorObject} An object with the red, green and blue values set in the r, g and b properties. + */ +var IntegerToRGB = function (color) +{ + if (color > 16777215) + { + // The color value has an alpha component + return { + a: color >>> 24, + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF + }; + } + else + { + return { + a: 255, + r: color >> 16 & 0xFF, + g: color >> 8 & 0xFF, + b: color & 0xFF + }; + } +}; - }, +module.exports = IntegerToRGB; - /** - * The depth of this Face, which is an average of the z component of all three vertices. - * - * The depth is calculated based on the transformed z value, not the local one. - * - * @name Phaser.Geom.Mesh.Face#depth - * @type {number} - * @readonly - * @since 3.50.0 - */ - depth: { - get: function () - { - var v1 = this.vertex1; - var v2 = this.vertex2; - var v3 = this.vertex3; +/***/ }), - return (v1.vz + v2.vz + v3.vz) / 3; - } +/***/ 53756: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Destroys this Face and nulls the references to the vertices. - * - * @method Phaser.Geom.Mesh.Face#destroy - * @since 3.50.0 - */ - destroy: function () - { - this.vertex1 = null; - this.vertex2 = null; - this.vertex3 = null; - } +var Linear = __webpack_require__(42798); -}); +/** + * @namespace Phaser.Display.Color.Interpolate + * @memberof Phaser.Display.Color + * @since 3.0.0 + */ -module.exports = Face; +/** + * Interpolates between the two given color ranges over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.RGBWithRGB + * @memberof Phaser.Display.Color.Interpolate + * @static + * @since 3.0.0 + * + * @param {number} r1 - Red value. + * @param {number} g1 - Blue value. + * @param {number} b1 - Green value. + * @param {number} r2 - Red value. + * @param {number} g2 - Blue value. + * @param {number} b2 - Green value. + * @param {number} [length=100] - Distance to interpolate over. + * @param {number} [index=0] - Index to start from. + * + * @return {Phaser.Types.Display.ColorObject} An object containing the interpolated color values. + */ +var RGBWithRGB = function (r1, g1, b1, r2, g2, b2, length, index) +{ + if (length === undefined) { length = 100; } + if (index === undefined) { index = 0; } + var t = index / length; -/***/ }), -/* 117 */ -/***/ (function(module, exports, __webpack_require__) { + return { + r: Linear(r1, r2, t), + g: Linear(g1, g2, t), + b: Linear(b1, b2, t) + }; +}; /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Interpolates between the two given color objects over the length supplied. + * + * @function Phaser.Display.Color.Interpolate.ColorWithColor + * @memberof Phaser.Display.Color.Interpolate + * @static + * @since 3.0.0 + * + * @param {Phaser.Display.Color} color1 - The first Color object. + * @param {Phaser.Display.Color} color2 - The second Color object. + * @param {number} [length=100] - Distance to interpolate over. + * @param {number} [index=0] - Index to start from. + * + * @return {Phaser.Types.Display.ColorObject} An object containing the interpolated color values. */ +var ColorWithColor = function (color1, color2, length, index) +{ + if (length === undefined) { length = 100; } + if (index === undefined) { index = 0; } -var Class = __webpack_require__(0); -var Utils = __webpack_require__(12); -var Vector3 = __webpack_require__(39); + return RGBWithRGB(color1.r, color1.g, color1.b, color2.r, color2.g, color2.b, length, index); +}; /** - * @classdesc - * A Vertex Geometry Object. - * - * This class consists of all the information required for a single vertex within a Face Geometry Object. + * Interpolates between the Color object and color values over the length supplied. * - * Faces, and thus Vertex objects, are used by the Mesh Game Object in order to render objects in WebGL. + * @function Phaser.Display.Color.Interpolate.ColorWithRGB + * @memberof Phaser.Display.Color.Interpolate + * @static + * @since 3.0.0 * - * @class Vertex - * @memberof Phaser.Geom.Mesh - * @constructor - * @extends Phaser.Math.Vector3 - * @since 3.50.0 + * @param {Phaser.Display.Color} color1 - The first Color object. + * @param {number} r - Red value. + * @param {number} g - Blue value. + * @param {number} b - Green value. + * @param {number} [length=100] - Distance to interpolate over. + * @param {number} [index=0] - Index to start from. * - * @param {number} x - The x position of the vertex. - * @param {number} y - The y position of the vertex. - * @param {number} z - The z position of the vertex. - * @param {number} u - The UV u coordinate of the vertex. - * @param {number} v - The UV v coordinate of the vertex. - * @param {number} [color=0xffffff] - The color value of the vertex. - * @param {number} [alpha=1] - The alpha value of the vertex. - * @param {number} [nx=0] - The x normal value of the vertex. - * @param {number} [ny=0] - The y normal value of the vertex. - * @param {number} [nz=0] - The z normal value of the vertex. + * @return {Phaser.Types.Display.ColorObject} An object containing the interpolated color values. */ -var Vertex = new Class({ +var ColorWithRGB = function (color, r, g, b, length, index) +{ + if (length === undefined) { length = 100; } + if (index === undefined) { index = 0; } - Extends: Vector3, + return RGBWithRGB(color.r, color.g, color.b, r, g, b, length, index); +}; - initialize: +module.exports = { - function Vertex (x, y, z, u, v, color, alpha, nx, ny, nz) - { - if (color === undefined) { color = 0xffffff; } - if (alpha === undefined) { alpha = 1; } - if (nx === undefined) { nx = 0; } - if (ny === undefined) { ny = 0; } - if (nz === undefined) { nz = 0; } + RGBWithRGB: RGBWithRGB, + ColorWithRGB: ColorWithRGB, + ColorWithColor: ColorWithColor - Vector3.call(this, x, y, z); +}; - /** - * The projected x coordinate of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#vx - * @type {number} - * @since 3.50.0 - */ - this.vx = 0; - /** - * The projected y coordinate of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#vy - * @type {number} - * @since 3.50.0 - */ - this.vy = 0; +/***/ }), - /** - * The projected z coordinate of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#vz - * @type {number} - * @since 3.50.0 - */ - this.vz = 0; +/***/ 73904: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The projected x coordinate of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#nx - * @type {number} - * @since 3.50.0 - */ - this.nx = nx; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The projected y coordinate of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#ny - * @type {number} - * @since 3.50.0 - */ - this.ny = ny; +var Color = __webpack_require__(27119); - /** - * The projected z coordinate of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#nz - * @type {number} - * @since 3.50.0 - */ - this.nz = nz; +/** + * Converts an object containing `r`, `g`, `b` and `a` properties into a Color class instance. + * + * @function Phaser.Display.Color.ObjectToColor + * @since 3.0.0 + * + * @param {Phaser.Types.Display.InputColorObject} input - An object containing `r`, `g`, `b` and `a` properties in the range 0 to 255. + * + * @return {Phaser.Display.Color} A Color object. + */ +var ObjectToColor = function (input) +{ + return new Color(input.r, input.g, input.b, input.a); +}; - /** - * UV u coordinate of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#u - * @type {number} - * @since 3.50.0 - */ - this.u = u; +module.exports = ObjectToColor; - /** - * UV v coordinate of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#v - * @type {number} - * @since 3.50.0 - */ - this.v = v; - /** - * The color value of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#color - * @type {number} - * @since 3.50.0 - */ - this.color = color; +/***/ }), - /** - * The alpha value of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#alpha - * @type {number} - * @since 3.50.0 - */ - this.alpha = alpha; +/***/ 26841: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The translated x coordinate of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#tx - * @type {number} - * @since 3.50.0 - */ - this.tx = 0; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The translated y coordinate of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#ty - * @type {number} - * @since 3.50.0 - */ - this.ty = 0; +var Color = __webpack_require__(27119); - /** - * The translated alpha value of this vertex. - * - * @name Phaser.Geom.Mesh.Vertex#ta - * @type {number} - * @since 3.50.0 - */ - this.ta = 0; - }, +/** + * Converts a CSS 'web' string into a Phaser Color object. + * + * The web string can be in the format `'rgb(r,g,b)'` or `'rgba(r,g,b,a)'` where r/g/b are in the range [0..255] and a is in the range [0..1]. + * + * @function Phaser.Display.Color.RGBStringToColor + * @since 3.0.0 + * + * @param {string} rgb - The CSS format color string, using the `rgb` or `rgba` format. + * + * @return {Phaser.Display.Color} A Color object. + */ +var RGBStringToColor = function (rgb) +{ + var color = new Color(); - /** - * Sets the U and V properties. - * - * @method Phaser.Geom.Mesh.Vertex#setUVs - * @since 3.50.0 - * - * @param {number} u - The UV u coordinate of the vertex. - * @param {number} v - The UV v coordinate of the vertex. - * - * @return {this} This Vertex. - */ - setUVs: function (u, v) + var result = (/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/).exec(rgb.toLowerCase()); + + if (result) { - this.u = u; - this.v = v; + var r = parseInt(result[1], 10); + var g = parseInt(result[2], 10); + var b = parseInt(result[3], 10); + var a = (result[4] !== undefined) ? parseFloat(result[4]) : 1; - return this; - }, + color.setTo(r, g, b, a * 255); + } - /** - * Transforms this vertex by the given matrix, storing the results in `vx`, `vy` and `vz`. - * - * @method Phaser.Geom.Mesh.Vertex#transformCoordinatesLocal - * @since 3.50.0 - * - * @param {Phaser.Math.Matrix4} transformMatrix - The transform matrix to apply to this vertex. - * @param {number} width - The width of the parent Mesh. - * @param {number} height - The height of the parent Mesh. - * @param {number} cameraZ - The z position of the MeshCamera. - */ - transformCoordinatesLocal: function (transformMatrix, width, height, cameraZ) - { - var x = this.x; - var y = this.y; - var z = this.z; + return color; +}; - var m = transformMatrix.val; +module.exports = RGBStringToColor; - var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; - var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; - var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; - var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; - this.vx = (tx / tw) * width; - this.vy = -(ty / tw) * height; +/***/ }), - if (cameraZ <= 0) +/***/ 68033: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts an RGB color value to HSV (hue, saturation and value). + * Conversion formula from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes RGB values are contained in the set [0, 255] and returns h, s and v in the set [0, 1]. + * Based on code by Michael Jackson (https://github.com/mjijackson) + * + * @function Phaser.Display.Color.RGBToHSV + * @since 3.0.0 + * + * @param {number} r - The red color value. A number between 0 and 255. + * @param {number} g - The green color value. A number between 0 and 255. + * @param {number} b - The blue color value. A number between 0 and 255. + * @param {(Phaser.Types.Display.HSVColorObject|Phaser.Display.Color)} [out] - An object to store the color values in. If not given an HSV Color Object will be created. + * + * @return {(Phaser.Types.Display.HSVColorObject|Phaser.Display.Color)} An object with the properties `h`, `s` and `v` set. + */ +var RGBToHSV = function (r, g, b, out) +{ + if (out === undefined) { out = { h: 0, s: 0, v: 0 }; } + + r /= 255; + g /= 255; + b /= 255; + + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var d = max - min; + + // achromatic by default + var h = 0; + var s = (max === 0) ? 0 : d / max; + var v = max; + + if (max !== min) + { + if (max === r) { - this.vz = (tz / tw); + h = (g - b) / d + ((g < b) ? 6 : 0); } - else + else if (max === g) { - this.vz = -(tz / tw); + h = (b - r) / d + 2; } - }, - - /** - * Updates this Vertex based on the given transform. - * - * @method Phaser.Geom.Mesh.Vertex#update - * @since 3.50.0 - * - * @param {number} a - The parent transform matrix data a component. - * @param {number} b - The parent transform matrix data b component. - * @param {number} c - The parent transform matrix data c component. - * @param {number} d - The parent transform matrix data d component. - * @param {number} e - The parent transform matrix data e component. - * @param {number} f - The parent transform matrix data f component. - * @param {boolean} roundPixels - Round the vertex position or not? - * @param {number} alpha - The alpha of the parent object. - * - * @return {this} This Vertex. - */ - update: function (a, b, c, d, e, f, roundPixels, alpha) - { - var tx = this.vx * a + this.vy * c + e; - var ty = this.vx * b + this.vy * d + f; - - if (roundPixels) + else if (max === b) { - tx = Math.round(tx); - ty = Math.round(ty); + h = (r - g) / d + 4; } - this.tx = tx; - this.ty = ty; - this.ta = this.alpha * alpha; - - return this; - }, + h /= 6; + } - /** - * Loads the data from this Vertex into the given Typed Arrays. - * - * @method Phaser.Geom.Mesh.Vertex#load - * @since 3.50.0 - * - * @param {Float32Array} F32 - A Float32 Array to insert the position, UV and unit data in to. - * @param {Uint32Array} U32 - A Uint32 Array to insert the color and alpha data in to. - * @param {number} offset - The index of the array to insert this Vertex to. - * @param {number} textureUnit - The texture unit currently in use. - * @param {number} tintEffect - The tint effect to use. - * - * @return {number} The new array offset. - */ - load: function (F32, U32, offset, textureUnit, tintEffect) + if (out.hasOwnProperty('_h')) { - F32[++offset] = this.tx; - F32[++offset] = this.ty; - F32[++offset] = this.u; - F32[++offset] = this.v; - F32[++offset] = textureUnit; - F32[++offset] = tintEffect; - U32[++offset] = Utils.getTintAppendFloatAlpha(this.color, this.ta); - - return offset; + out._h = h; + out._s = s; + out._v = v; + } + else + { + out.h = h; + out.s = s; + out.v = v; } -}); + return out; +}; -module.exports = Vertex; +module.exports = RGBToHSV; /***/ }), -/* 118 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 4880: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** -* The `Matter.Composite` module contains methods for creating and manipulating composite bodies. -* A composite body is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`, therefore composites form a tree structure. -* It is important to use the functions in this module to modify composites, rather than directly modifying their properties. -* Note that the `Matter.World` object is also a type of `Matter.Composite` and as such all composite methods here can also operate on a `Matter.World`. -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class Composite -*/ + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -var Composite = {}; +var ComponentToHex = __webpack_require__(25409); -module.exports = Composite; +/** + * Converts the color values into an HTML compatible color string, prefixed with either `#` or `0x`. + * + * @function Phaser.Display.Color.RGBToString + * @since 3.0.0 + * + * @param {number} r - The red color value. A number between 0 and 255. + * @param {number} g - The green color value. A number between 0 and 255. + * @param {number} b - The blue color value. A number between 0 and 255. + * @param {number} [a=255] - The alpha value. A number between 0 and 255. + * @param {string} [prefix=#] - The prefix of the string. Either `#` or `0x`. + * + * @return {string} A string-based representation of the color values. + */ +var RGBToString = function (r, g, b, a, prefix) +{ + if (a === undefined) { a = 255; } + if (prefix === undefined) { prefix = '#'; } -var Events = __webpack_require__(166); -var Common = __webpack_require__(32); -var Bounds = __webpack_require__(84); -var Body = __webpack_require__(41); + if (prefix === '#') + { + return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1, 7); + } + else + { + return '0x' + ComponentToHex(a) + ComponentToHex(r) + ComponentToHex(g) + ComponentToHex(b); + } +}; -(function() { +module.exports = RGBToString; - /** - * Creates a new composite. The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properites section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {} [options] - * @return {composite} A new composite - */ - Composite.create = function(options) { - return Common.extend({ - id: Common.nextId(), - type: 'composite', - parent: null, - isModified: false, - bodies: [], - constraints: [], - composites: [], - label: 'Composite', - plugin: {} - }, options); - }; - /** - * Sets the composite's `isModified` flag. - * If `updateParents` is true, all parents will be set (default: false). - * If `updateChildren` is true, all children will be set (default: false). - * @method setModified - * @param {composite} composite - * @param {boolean} isModified - * @param {boolean} [updateParents=false] - * @param {boolean} [updateChildren=false] - */ - Composite.setModified = function(composite, isModified, updateParents, updateChildren) { +/***/ }), - Events.trigger(composite, 'compositeModified', composite); +/***/ 37243: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - composite.isModified = isModified; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (updateParents && composite.parent) { - Composite.setModified(composite.parent, isModified, updateParents, updateChildren); - } +var Between = __webpack_require__(17489); +var Color = __webpack_require__(27119); - if (updateChildren) { - for(var i = 0; i < composite.composites.length; i++) { - var childComposite = composite.composites[i]; - Composite.setModified(childComposite, isModified, updateParents, updateChildren); - } - } - }; +/** + * Creates a new Color object where the r, g, and b values have been set to random values + * based on the given min max values. + * + * @function Phaser.Display.Color.RandomRGB + * @since 3.0.0 + * + * @param {number} [min=0] - The minimum value to set the random range from (between 0 and 255) + * @param {number} [max=255] - The maximum value to set the random range from (between 0 and 255) + * + * @return {Phaser.Display.Color} A Color object. + */ +var RandomRGB = function (min, max) +{ + if (min === undefined) { min = 0; } + if (max === undefined) { max = 255; } - /** - * Generic add function. Adds one or many body(s), constraint(s) or a composite(s) to the given composite. - * Triggers `beforeAdd` and `afterAdd` events on the `composite`. - * @method add - * @param {composite} composite - * @param {} object - * @return {composite} The original composite with the objects added - */ - Composite.add = function(composite, object) { - var objects = [].concat(object); + return new Color(Between(min, max), Between(min, max), Between(min, max)); +}; - Events.trigger(composite, 'beforeAdd', { object: object }); +module.exports = RandomRGB; - for (var i = 0; i < objects.length; i++) { - var obj = objects[i]; - switch (obj.type) { +/***/ }), - case 'body': - // skip adding compound parts - if (obj.parent !== obj) { - Common.warn('Composite.add: skipped adding a compound body part (you must add its parent instead)'); - break; - } +/***/ 93222: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - Composite.addBody(composite, obj); - break; - case 'constraint': - Composite.addConstraint(composite, obj); - break; - case 'composite': - Composite.addComposite(composite, obj); - break; - case 'mouseConstraint': - Composite.addConstraint(composite, obj.constraint); - break; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var HexStringToColor = __webpack_require__(91487); +var IntegerToColor = __webpack_require__(74853); +var ObjectToColor = __webpack_require__(73904); +var RGBStringToColor = __webpack_require__(26841); + +/** + * Converts the given source color value into an instance of a Color class. + * The value can be either a string, prefixed with `rgb` or a hex string, a number or an Object. + * + * @function Phaser.Display.Color.ValueToColor + * @since 3.0.0 + * + * @param {(string|number|Phaser.Types.Display.InputColorObject)} input - The source color value to convert. + * + * @return {Phaser.Display.Color} A Color object. + */ +var ValueToColor = function (input) +{ + var t = typeof input; + + switch (t) + { + case 'string': + if (input.substr(0, 3).toLowerCase() === 'rgb') + { + return RGBStringToColor(input); + } + else + { + return HexStringToColor(input); } - } - Events.trigger(composite, 'afterAdd', { object: object }); + case 'number': - return composite; - }; + return IntegerToColor(input); - /** - * Generic remove function. Removes one or many body(s), constraint(s) or a composite(s) to the given composite. - * Optionally searching its children recursively. - * Triggers `beforeRemove` and `afterRemove` events on the `composite`. - * @method remove - * @param {composite} composite - * @param {} object - * @param {boolean} [deep=false] - * @return {composite} The original composite with the objects removed - */ - Composite.remove = function(composite, object, deep) { - var objects = [].concat(object); + case 'object': - Events.trigger(composite, 'beforeRemove', { object: object }); + return ObjectToColor(input); + } +}; - for (var i = 0; i < objects.length; i++) { - var obj = objects[i]; +module.exports = ValueToColor; - switch (obj.type) { - case 'body': - Composite.removeBody(composite, obj, deep); - break; - case 'constraint': - Composite.removeConstraint(composite, obj, deep); - break; - case 'composite': - Composite.removeComposite(composite, obj, deep); - break; - case 'mouseConstraint': - Composite.removeConstraint(composite, obj.constraint); - break; +/***/ }), - } - } +/***/ 95509: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - Events.trigger(composite, 'afterRemove', { object: object }); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return composite; - }; +var Color = __webpack_require__(27119); - /** - * Adds a composite to the given composite. - * @private - * @method addComposite - * @param {composite} compositeA - * @param {composite} compositeB - * @return {composite} The original compositeA with the objects from compositeB added - */ - Composite.addComposite = function(compositeA, compositeB) { - compositeA.composites.push(compositeB); - compositeB.parent = compositeA; - Composite.setModified(compositeA, true, true, false); - return compositeA; - }; +Color.ColorSpectrum = __webpack_require__(30245); +Color.ColorToRGBA = __webpack_require__(86672); +Color.ComponentToHex = __webpack_require__(25409); +Color.GetColor = __webpack_require__(22946); +Color.GetColor32 = __webpack_require__(5657); +Color.HexStringToColor = __webpack_require__(91487); +Color.HSLToColor = __webpack_require__(74777); +Color.HSVColorWheel = __webpack_require__(89263); +Color.HSVToRGB = __webpack_require__(24650); +Color.HueToComponent = __webpack_require__(59998); +Color.IntegerToColor = __webpack_require__(74853); +Color.IntegerToRGB = __webpack_require__(15978); +Color.Interpolate = __webpack_require__(53756); +Color.ObjectToColor = __webpack_require__(73904); +Color.RandomRGB = __webpack_require__(37243); +Color.RGBStringToColor = __webpack_require__(26841); +Color.RGBToHSV = __webpack_require__(68033); +Color.RGBToString = __webpack_require__(4880); +Color.ValueToColor = __webpack_require__(93222); - /** - * Removes a composite from the given composite, and optionally searching its children recursively. - * @private - * @method removeComposite - * @param {composite} compositeA - * @param {composite} compositeB - * @param {boolean} [deep=false] - * @return {composite} The original compositeA with the composite removed - */ - Composite.removeComposite = function(compositeA, compositeB, deep) { - var position = compositeA.composites.indexOf(compositeB); - if (position !== -1) { - Composite.removeCompositeAt(compositeA, position); - Composite.setModified(compositeA, true, true, false); - } +module.exports = Color; - if (deep) { - for (var i = 0; i < compositeA.composites.length; i++){ - Composite.removeComposite(compositeA.composites[i], compositeB, true); - } - } - return compositeA; - }; +/***/ }), - /** - * Removes a composite from the given composite. - * @private - * @method removeCompositeAt - * @param {composite} composite - * @param {number} position - * @return {composite} The original composite with the composite removed - */ - Composite.removeCompositeAt = function(composite, position) { - composite.composites.splice(position, 1); - Composite.setModified(composite, true, true, false); - return composite; - }; +/***/ 24816: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Adds a body to the given composite. - * @private - * @method addBody - * @param {composite} composite - * @param {body} body - * @return {composite} The original composite with the body added - */ - Composite.addBody = function(composite, body) { - composite.bodies.push(body); - Composite.setModified(composite, true, true, false); - return composite; - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Removes a body from the given composite, and optionally searching its children recursively. - * @private - * @method removeBody - * @param {composite} composite - * @param {body} body - * @param {boolean} [deep=false] - * @return {composite} The original composite with the body removed - */ - Composite.removeBody = function(composite, body, deep) { - var position = composite.bodies.indexOf(body); - if (position !== -1) { - Composite.removeBodyAt(composite, position); - Composite.setModified(composite, true, true, false); - } +/** + * @namespace Phaser.Display + */ - if (deep) { - for (var i = 0; i < composite.composites.length; i++){ - Composite.removeBody(composite.composites[i], body, true); - } - } +module.exports = { - return composite; - }; + Align: __webpack_require__(93545), + BaseShader: __webpack_require__(31053), + Bounds: __webpack_require__(15252), + Canvas: __webpack_require__(23514), + Color: __webpack_require__(95509), + ColorMatrix: __webpack_require__(65246), + Masks: __webpack_require__(93310), + RGB: __webpack_require__(39298) - /** - * Removes a body from the given composite. - * @private - * @method removeBodyAt - * @param {composite} composite - * @param {number} position - * @return {composite} The original composite with the body removed - */ - Composite.removeBodyAt = function(composite, position) { - composite.bodies.splice(position, 1); - Composite.setModified(composite, true, true, false); - return composite; - }; +}; - /** - * Adds a constraint to the given composite. - * @private - * @method addConstraint - * @param {composite} composite - * @param {constraint} constraint - * @return {composite} The original composite with the constraint added - */ - Composite.addConstraint = function(composite, constraint) { - composite.constraints.push(constraint); - Composite.setModified(composite, true, true, false); - return composite; - }; - /** - * Removes a constraint from the given composite, and optionally searching its children recursively. - * @private - * @method removeConstraint - * @param {composite} composite - * @param {constraint} constraint - * @param {boolean} [deep=false] - * @return {composite} The original composite with the constraint removed - */ - Composite.removeConstraint = function(composite, constraint, deep) { - var position = composite.constraints.indexOf(constraint); - if (position !== -1) { - Composite.removeConstraintAt(composite, position); - } +/***/ }), - if (deep) { - for (var i = 0; i < composite.composites.length; i++){ - Composite.removeConstraint(composite.composites[i], constraint, true); - } - } +/***/ 76756: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return composite; - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Removes a body from the given composite. - * @private - * @method removeConstraintAt - * @param {composite} composite - * @param {number} position - * @return {composite} The original composite with the constraint removed - */ - Composite.removeConstraintAt = function(composite, position) { - composite.constraints.splice(position, 1); - Composite.setModified(composite, true, true, false); - return composite; - }; +var Class = __webpack_require__(56694); +var GameObjectFactory = __webpack_require__(61286); - /** - * Removes all bodies, constraints and composites from the given composite. - * Optionally clearing its children recursively. - * @method clear - * @param {composite} composite - * @param {boolean} keepStatic - * @param {boolean} [deep=false] - */ - Composite.clear = function(composite, keepStatic, deep) { - if (deep) { - for (var i = 0; i < composite.composites.length; i++){ - Composite.clear(composite.composites[i], keepStatic, true); - } - } - - if (keepStatic) { - composite.bodies = composite.bodies.filter(function(body) { return body.isStatic; }); - } else { - composite.bodies.length = 0; +/** + * @classdesc + * A Bitmap Mask combines the alpha (opacity) of a masked pixel with the alpha of another pixel. + * Unlike the Geometry Mask, which is a clipping path, a Bitmap Mask behaves like an alpha mask, + * not a clipping path. It is only available when using the WebGL Renderer. + * + * A Bitmap Mask can use any Game Object or Dynamic Texture to determine the alpha of each pixel of the masked Game Object(s). + * For any given point of a masked Game Object's texture, the pixel's alpha will be multiplied by the alpha + * of the pixel at the same position in the Bitmap Mask's Game Object. The color of the pixel from the + * Bitmap Mask doesn't matter. + * + * For example, if a pure blue pixel with an alpha of 0.95 is masked with a pure red pixel with an + * alpha of 0.5, the resulting pixel will be pure blue with an alpha of 0.475. Naturally, this means + * that a pixel in the mask with an alpha of 0 will hide the corresponding pixel in all masked Game Objects. + * A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the + * corresponding pixel in the mask. + * + * Note: You cannot combine Bitmap Masks and Blend Modes on the same Game Object. You can, however, + * combine Geometry Masks and Blend Modes together. + * + * The Bitmap Mask's location matches the location of its Game Object, not the location of the + * masked objects. Moving or transforming the underlying Game Object will change the mask + * (and affect the visibility of any masked objects), whereas moving or transforming a masked object + * will not affect the mask. + * + * The Bitmap Mask will not render its Game Object by itself. If the Game Object is not in a + * Scene's display list, it will only be used for the mask and its full texture will not be directly + * visible. Adding the underlying Game Object to a Scene will not cause any problems - it will + * render as a normal Game Object and will also serve as a mask. + * + * @class BitmapMask + * @memberof Phaser.Display.Masks + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to which this mask is being added. + * @param {(Phaser.GameObjects.GameObject|Phaser.Textures.DynamicTexture)} [maskObject] - The Game Object or Dynamic Texture that will be used as the mask. If `null` it will generate an Image Game Object using the rest of the arguments. + * @param {number} [x] - If creating a Game Object, the horizontal position in the world. + * @param {number} [y] - If creating a Game Object, the vertical position in the world. + * @param {(string|Phaser.Textures.Texture)} [texture] - If creating a Game Object, the key, or instance of the Texture it will use to render with, as stored in the Texture Manager. + * @param {(string|number|Phaser.Textures.Frame)} [frame] - If creating a Game Object, an optional frame from the Texture this Game Object is rendering with. + */ +var BitmapMask = new Class({ + + initialize: + + function BitmapMask (scene, maskObject, x, y, texture, frame) + { + if (!maskObject) + { + maskObject = scene.sys.make.image({ x: x, y: y, key: texture, frame: frame, add: false }); } - composite.constraints.length = 0; - composite.composites.length = 0; - Composite.setModified(composite, true, true, false); + /** + * The Game Object that is used as the mask. Must use a texture, such as a Sprite. + * + * @name Phaser.Display.Masks.BitmapMask#bitmapMask + * @type {(Phaser.GameObjects.GameObject|Phaser.Textures.DynamicTexture)} + * @since 3.0.0 + */ + this.bitmapMask = maskObject; - return composite; - }; + /** + * Whether to invert the masks alpha. + * + * If `true`, the alpha of the masking pixel will be inverted before it's multiplied with the masked pixel. + * + * Essentially, this means that a masked area will be visible only if the corresponding area in the mask is invisible. + * + * @name Phaser.Display.Masks.BitmapMask#invertAlpha + * @type {boolean} + * @since 3.1.2 + */ + this.invertAlpha = false; + + /** + * Is this mask a stencil mask? This is false by default and should not be changed. + * + * @name Phaser.Display.Masks.BitmapMask#isStencil + * @type {boolean} + * @readonly + * @since 3.17.0 + */ + this.isStencil = false; + }, /** - * Returns all bodies in the given composite, including all bodies in its children, recursively. - * @method allBodies - * @param {composite} composite - * @return {body[]} All the bodies + * Sets a new Game Object or Dynamic Texture for this Bitmap Mask to use. + * + * If a Game Object it must have a texture, such as a Sprite. + * + * You can update the source of the mask as often as you like. + * + * @method Phaser.Display.Masks.BitmapMask#setBitmap + * @since 3.0.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.Textures.DynamicTexture)} maskObject - The Game Object or Dynamic Texture that will be used as the mask. If a Game Object, it must have a texture, such as a Sprite. */ - Composite.allBodies = function(composite) { - var bodies = [].concat(composite.bodies); - - for (var i = 0; i < composite.composites.length; i++) - bodies = bodies.concat(Composite.allBodies(composite.composites[i])); + setBitmap: function (maskObject) + { + this.bitmapMask = maskObject; + }, - return bodies; - }; + /** + * Prepares the WebGL Renderer to render a Game Object with this mask applied. + * + * This renders the masking Game Object to the mask framebuffer and switches to the main framebuffer so that the masked Game Object will be rendered to it instead of being rendered directly to the frame. + * + * @method Phaser.Display.Masks.BitmapMask#preRenderWebGL + * @since 3.0.0 + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The WebGL Renderer to prepare. + * @param {Phaser.GameObjects.GameObject} maskedObject - The masked Game Object which will be drawn. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. + */ + preRenderWebGL: function (renderer, maskedObject, camera) + { + renderer.pipelines.BITMAPMASK_PIPELINE.beginMask(this, maskedObject, camera); + }, /** - * Returns all constraints in the given composite, including all constraints in its children, recursively. - * @method allConstraints - * @param {composite} composite - * @return {constraint[]} All the constraints + * Finalizes rendering of a masked Game Object. + * + * This resets the previously bound framebuffer and switches the WebGL Renderer to the Bitmap Mask Pipeline, which uses a special fragment shader to apply the masking effect. + * + * @method Phaser.Display.Masks.BitmapMask#postRenderWebGL + * @since 3.0.0 + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The WebGL Renderer to clean up. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. + * @param {Phaser.Renderer.WebGL.RenderTarget} [renderTarget] - Optional WebGL RenderTarget. */ - Composite.allConstraints = function(composite) { - var constraints = [].concat(composite.constraints); + postRenderWebGL: function (renderer, camera, renderTarget) + { + renderer.pipelines.BITMAPMASK_PIPELINE.endMask(this, camera, renderTarget); + }, - for (var i = 0; i < composite.composites.length; i++) - constraints = constraints.concat(Composite.allConstraints(composite.composites[i])); + /** + * This is a NOOP method. Bitmap Masks are not supported by the Canvas Renderer. + * + * @method Phaser.Display.Masks.BitmapMask#preRenderCanvas + * @since 3.0.0 + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Canvas Renderer which would be rendered to. + * @param {Phaser.GameObjects.GameObject} mask - The masked Game Object which would be rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. + */ + preRenderCanvas: function () + { + // NOOP + }, - return constraints; - }; + /** + * This is a NOOP method. Bitmap Masks are not supported by the Canvas Renderer. + * + * @method Phaser.Display.Masks.BitmapMask#postRenderCanvas + * @since 3.0.0 + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Canvas Renderer which would be rendered to. + */ + postRenderCanvas: function () + { + // NOOP + }, /** - * Returns all composites in the given composite, including all composites in its children, recursively. - * @method allComposites - * @param {composite} composite - * @return {composite[]} All the composites + * Destroys this BitmapMask and nulls any references it holds. + * + * Note that if a Game Object is currently using this mask it will _not_ automatically detect you have destroyed it, + * so be sure to call `clearMask` on any Game Object using it, before destroying it. + * + * @method Phaser.Display.Masks.BitmapMask#destroy + * @since 3.7.0 */ - Composite.allComposites = function(composite) { - var composites = [].concat(composite.composites); + destroy: function () + { + this.bitmapMask = null; + } - for (var i = 0; i < composite.composites.length; i++) - composites = composites.concat(Composite.allComposites(composite.composites[i])); +}); - return composites; - }; +/** + * A Bitmap Mask combines the alpha (opacity) of a masked pixel with the alpha of another pixel. + * Unlike the Geometry Mask, which is a clipping path, a Bitmap Mask behaves like an alpha mask, + * not a clipping path. It is only available when using the WebGL Renderer. + * + * A Bitmap Mask can use any Game Object, or Dynamic Texture, to determine the alpha of each pixel of the masked Game Object(s). + * For any given point of a masked Game Object's texture, the pixel's alpha will be multiplied by the alpha + * of the pixel at the same position in the Bitmap Mask's Game Object. The color of the pixel from the + * Bitmap Mask doesn't matter. + * + * For example, if a pure blue pixel with an alpha of 0.95 is masked with a pure red pixel with an + * alpha of 0.5, the resulting pixel will be pure blue with an alpha of 0.475. Naturally, this means + * that a pixel in the mask with an alpha of 0 will hide the corresponding pixel in all masked Game Objects + * A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the + * corresponding pixel in the mask. + * + * Note: You cannot combine Bitmap Masks and Blend Modes on the same Game Object. You can, however, + * combine Geometry Masks and Blend Modes together. + * + * The Bitmap Mask's location matches the location of its Game Object, not the location of the + * masked objects. Moving or transforming the underlying Game Object will change the mask + * (and affect the visibility of any masked objects), whereas moving or transforming a masked object + * will not affect the mask. + * + * The Bitmap Mask will not render its Game Object by itself. If the Game Object is not in a + * Scene's display list, it will only be used for the mask and its full texture will not be directly + * visible. Adding the underlying Game Object to a Scene will not cause any problems - it will + * render as a normal Game Object and will also serve as a mask. + * + * @method Phaser.GameObjects.GameObjectFactory#bitmapMask + * @since 3.60.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.Textures.DynamicTexture)} [maskObject] - The Game Object or Texture that will be used as the mask. If `null` it will generate an Image Game Object using the rest of the arguments. + * @param {number} [x] - If creating a Game Object, the horizontal position in the world. + * @param {number} [y] - If creating a Game Object, the vertical position in the world. + * @param {(string|Phaser.Textures.Texture)} [texture] - If creating a Game Object, the key, or instance of the Texture it will use to render with, as stored in the Texture Manager. + * @param {(string|number|Phaser.Textures.Frame)} [frame] - If creating a Game Object, an optional frame from the Texture this Game Object is rendering with. + * + * @return {Phaser.Display.Masks.BitmapMask} The Bitmap Mask that was created. + */ +GameObjectFactory.register('bitmapMask', function (maskObject, x, y, key, frame) +{ + return new BitmapMask(this.scene, maskObject, x, y, key, frame); +}); - /** - * Searches the composite recursively for an object matching the type and id supplied, null if not found. - * @method get - * @param {composite} composite - * @param {number} id - * @param {string} type - * @return {object} The requested object, if found - */ - Composite.get = function(composite, id, type) { - var objects, - object; +module.exports = BitmapMask; - switch (type) { - case 'body': - objects = Composite.allBodies(composite); - break; - case 'constraint': - objects = Composite.allConstraints(composite); - break; - case 'composite': - objects = Composite.allComposites(composite).concat(composite); - break; - } - if (!objects) - return null; +/***/ }), - object = objects.filter(function(object) { - return object.id.toString() === id.toString(); - }); +/***/ 63037: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return object.length === 0 ? null : object[0]; - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add). - * @method move - * @param {compositeA} compositeA - * @param {object[]} objects - * @param {compositeB} compositeB - * @return {composite} Returns compositeA - */ - Composite.move = function(compositeA, objects, compositeB) { - Composite.remove(compositeA, objects); - Composite.add(compositeB, objects); - return compositeA; - }; +var Class = __webpack_require__(56694); - /** - * Assigns new ids for all objects in the composite, recursively. - * @method rebase - * @param {composite} composite - * @return {composite} Returns composite - */ - Composite.rebase = function(composite) { - var objects = Composite.allBodies(composite) - .concat(Composite.allConstraints(composite)) - .concat(Composite.allComposites(composite)); +/** + * @classdesc + * A Geometry Mask can be applied to a Game Object to hide any pixels of it which don't intersect + * a visible pixel from the geometry mask. The mask is essentially a clipping path which can only + * make a masked pixel fully visible or fully invisible without changing its alpha (opacity). + * + * A Geometry Mask uses a Graphics Game Object to determine which pixels of the masked Game Object(s) + * should be clipped. For any given point of a masked Game Object's texture, the pixel will only be displayed + * if the Graphics Game Object of the Geometry Mask has a visible pixel at the same position. The color and + * alpha of the pixel from the Geometry Mask do not matter. + * + * The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects. + * Moving or transforming the underlying Graphics object will change the mask (and affect the visibility + * of any masked objects), whereas moving or transforming a masked object will not affect the mask. + * You can think of the Geometry Mask (or rather, of its Graphics object) as an invisible curtain placed + * in front of all masked objects which has its own visual properties and, naturally, respects the camera's + * visual properties, but isn't affected by and doesn't follow the masked objects by itself. + * + * @class GeometryMask + * @memberof Phaser.Display.Masks + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - This parameter is not used. + * @param {Phaser.GameObjects.Graphics} graphicsGeometry - The Graphics Game Object to use for the Geometry Mask. Doesn't have to be in the Display List. + */ +var GeometryMask = new Class({ - for (var i = 0; i < objects.length; i++) { - objects[i].id = Common.nextId(); - } + initialize: - Composite.setModified(composite, true, true, false); + function GeometryMask (scene, graphicsGeometry) + { + /** + * The Graphics object which describes the Geometry Mask. + * + * @name Phaser.Display.Masks.GeometryMask#geometryMask + * @type {Phaser.GameObjects.Graphics} + * @since 3.0.0 + */ + this.geometryMask = graphicsGeometry; - return composite; - }; + /** + * Similar to the BitmapMasks invertAlpha setting this to true will then hide all pixels + * drawn to the Geometry Mask. + * + * This is a WebGL only feature. + * + * @name Phaser.Display.Masks.GeometryMask#invertAlpha + * @type {boolean} + * @since 3.16.0 + */ + this.invertAlpha = false; + + /** + * Is this mask a stencil mask? + * + * @name Phaser.Display.Masks.GeometryMask#isStencil + * @type {boolean} + * @readonly + * @since 3.17.0 + */ + this.isStencil = true; + + /** + * The current stencil level. This can change dynamically at runtime + * and is set in the applyStencil method. + * + * @name Phaser.Display.Masks.GeometryMask#level + * @type {boolean} + * @since 3.17.0 + */ + this.level = 0; + }, /** - * Translates all children in the composite by a given vector relative to their current positions, - * without imparting any velocity. - * @method translate - * @param {composite} composite - * @param {vector} translation - * @param {bool} [recursive=true] + * Sets a new Graphics object for the Geometry Mask. + * + * @method Phaser.Display.Masks.GeometryMask#setShape + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Graphics} graphicsGeometry - The Graphics object which will be used for the Geometry Mask. + * + * @return {this} This Geometry Mask */ - Composite.translate = function(composite, translation, recursive) { - var bodies = recursive ? Composite.allBodies(composite) : composite.bodies; + setShape: function (graphicsGeometry) + { + this.geometryMask = graphicsGeometry; - for (var i = 0; i < bodies.length; i++) { - Body.translate(bodies[i], translation); - } + return this; + }, - Composite.setModified(composite, true, true, false); + /** + * Sets the `invertAlpha` property of this Geometry Mask. + * + * Inverting the alpha essentially flips the way the mask works. + * + * This is a WebGL only feature. + * + * @method Phaser.Display.Masks.GeometryMask#setInvertAlpha + * @since 3.17.0 + * + * @param {boolean} [value=true] - Invert the alpha of this mask? + * + * @return {this} This Geometry Mask + */ + setInvertAlpha: function (value) + { + if (value === undefined) { value = true; } - return composite; - }; + this.invertAlpha = value; + + return this; + }, /** - * Rotates all children in the composite by a given angle about the given point, without imparting any angular velocity. - * @method rotate - * @param {composite} composite - * @param {number} rotation - * @param {vector} point - * @param {bool} [recursive=true] + * Renders the Geometry Mask's underlying Graphics object to the OpenGL stencil buffer and enables the stencil test, which clips rendered pixels according to the mask. + * + * @method Phaser.Display.Masks.GeometryMask#preRenderWebGL + * @since 3.0.0 + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer instance to draw to. + * @param {Phaser.GameObjects.GameObject} child - The Game Object being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera the Game Object is being rendered through. */ - Composite.rotate = function(composite, rotation, point, recursive) { - var cos = Math.cos(rotation), - sin = Math.sin(rotation), - bodies = recursive ? Composite.allBodies(composite) : composite.bodies; + preRenderWebGL: function (renderer, child, camera) + { + var gl = renderer.gl; - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - dx = body.position.x - point.x, - dy = body.position.y - point.y; - - Body.setPosition(body, { - x: point.x + (dx * cos - dy * sin), - y: point.y + (dx * sin + dy * cos) - }); + // Force flushing before drawing to stencil buffer + renderer.flush(); - Body.rotate(body, rotation); + if (renderer.maskStack.length === 0) + { + gl.enable(gl.STENCIL_TEST); + gl.clear(gl.STENCIL_BUFFER_BIT); + + renderer.maskCount = 0; } - Composite.setModified(composite, true, true, false); + if (renderer.currentCameraMask.mask !== this) + { + renderer.currentMask.mask = this; + } - return composite; - }; + renderer.maskStack.push({ mask: this, camera: camera }); + + this.applyStencil(renderer, camera, true); + + renderer.maskCount++; + }, /** - * Scales all children in the composite, including updating physical properties (mass, area, axes, inertia), from a world-space point. - * @method scale - * @param {composite} composite - * @param {number} scaleX - * @param {number} scaleY - * @param {vector} point - * @param {bool} [recursive=true] + * Applies the current stencil mask to the renderer. + * + * @method Phaser.Display.Masks.GeometryMask#applyStencil + * @since 3.17.0 + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer instance to draw to. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera the Game Object is being rendered through. + * @param {boolean} inc - Is this an INCR stencil or a DECR stencil? */ - Composite.scale = function(composite, scaleX, scaleY, point, recursive) { - var bodies = recursive ? Composite.allBodies(composite) : composite.bodies; + applyStencil: function (renderer, camera, inc) + { + var gl = renderer.gl; + var geometryMask = this.geometryMask; + var level = renderer.maskCount; + var mask = 0xff; - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - dx = body.position.x - point.x, - dy = body.position.y - point.y; - - Body.setPosition(body, { - x: point.x + dx * scaleX, - y: point.y + dy * scaleY - }); + gl.colorMask(false, false, false, false); - Body.scale(body, scaleX, scaleY); + if (inc) + { + gl.stencilFunc(gl.EQUAL, level, mask); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR); + + // Do this _after_ we set the stencilFunc + level++; + } + else + { + gl.stencilFunc(gl.EQUAL, level + 1, mask); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR); } - Composite.setModified(composite, true, true, false); + this.level = level; - return composite; - }; + // Write stencil buffer + geometryMask.renderWebGL(renderer, geometryMask, camera); + + renderer.flush(); + + gl.colorMask(true, true, true, true); + gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); + + if (this.invertAlpha) + { + gl.stencilFunc(gl.NOTEQUAL, level, mask); + } + else + { + gl.stencilFunc(gl.EQUAL, level, mask); + } + }, /** - * Returns the union of the bounds of all of the composite's bodies. - * @method bounds - * @param {composite} composite The composite. - * @returns {bounds} The composite bounds. + * Flushes all rendered pixels and disables the stencil test of a WebGL context, thus disabling the mask for it. + * + * @method Phaser.Display.Masks.GeometryMask#postRenderWebGL + * @since 3.0.0 + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer instance to draw flush. */ - Composite.bounds = function(composite) { - var bodies = Composite.allBodies(composite), - vertices = []; + postRenderWebGL: function (renderer) + { + var gl = renderer.gl; - for (var i = 0; i < bodies.length; i += 1) { - var body = bodies[i]; - vertices.push(body.bounds.min, body.bounds.max); - } + renderer.maskStack.pop(); - return Bounds.create(vertices); - }; + renderer.maskCount--; - /* - * - * Events Documentation - * - */ + // Force flush before disabling stencil test + renderer.flush(); - /** - * Fired when a call to `Composite.add` is made, before objects have been added. - * - * @event beforeAdd - * @param {} event An event object - * @param {} event.object The object(s) to be added (may be a single body, constraint, composite or a mixed array of these) - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ + var current = renderer.currentMask; - /** - * Fired when a call to `Composite.add` is made, after objects have been added. - * - * @event afterAdd - * @param {} event An event object - * @param {} event.object The object(s) that have been added (may be a single body, constraint, composite or a mixed array of these) - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ + if (renderer.maskStack.length === 0) + { + // If this is the only mask in the stack, flush and disable + current.mask = null; - /** - * Fired when a call to `Composite.remove` is made, before objects have been removed. - * - * @event beforeRemove - * @param {} event An event object - * @param {} event.object The object(s) to be removed (may be a single body, constraint, composite or a mixed array of these) - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ + gl.disable(gl.STENCIL_TEST); + } + else + { + var prev = renderer.maskStack[renderer.maskStack.length - 1]; - /** - * Fired when a call to `Composite.remove` is made, after objects have been removed. - * - * @event afterRemove - * @param {} event An event object - * @param {} event.object The object(s) that have been removed (may be a single body, constraint, composite or a mixed array of these) - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ + prev.mask.applyStencil(renderer, prev.camera, false); - /* - * - * Properties Documentation - * - */ + if (renderer.currentCameraMask.mask !== prev.mask) + { + current.mask = prev.mask; + current.camera = prev.camera; + } + else + { + current.mask = null; + } + } + }, /** - * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * Sets the clipping path of a 2D canvas context to the Geometry Mask's underlying Graphics object. * - * @property id - * @type number - */ - - /** - * A `String` denoting the type of object. + * @method Phaser.Display.Masks.GeometryMask#preRenderCanvas + * @since 3.0.0 * - * @property type - * @type string - * @default "composite" - * @readOnly + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - The Canvas Renderer instance to set the clipping path on. + * @param {Phaser.GameObjects.GameObject} mask - The Game Object being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera the Game Object is being rendered through. */ + preRenderCanvas: function (renderer, mask, camera) + { + var geometryMask = this.geometryMask; - /** - * An arbitrary `String` name to help the user identify and manage composites. - * - * @property label - * @type string - * @default "Composite" - */ + renderer.currentContext.save(); - /** - * A flag that specifies whether the composite has been modified during the current step. - * Most `Matter.Composite` methods will automatically set this flag to `true` to inform the engine of changes to be handled. - * If you need to change it manually, you should use the `Composite.setModified` method. - * - * @property isModified - * @type boolean - * @default false - */ + geometryMask.renderCanvas(renderer, geometryMask, camera, null, null, true); - /** - * The `Composite` that is the parent of this composite. It is automatically managed by the `Matter.Composite` methods. - * - * @property parent - * @type composite - * @default null - */ + renderer.currentContext.clip(); + }, /** - * An array of `Body` that are _direct_ children of this composite. - * To add or remove bodies you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. - * If you wish to recursively find all descendants, you should use the `Composite.allBodies` method. + * Restore the canvas context's previous clipping path, thus turning off the mask for it. * - * @property bodies - * @type body[] - * @default [] - */ - - /** - * An array of `Constraint` that are _direct_ children of this composite. - * To add or remove constraints you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. - * If you wish to recursively find all descendants, you should use the `Composite.allConstraints` method. + * @method Phaser.Display.Masks.GeometryMask#postRenderCanvas + * @since 3.0.0 * - * @property constraints - * @type constraint[] - * @default [] + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - The Canvas Renderer instance being restored. */ + postRenderCanvas: function (renderer) + { + renderer.currentContext.restore(); + }, /** - * An array of `Composite` that are _direct_ children of this composite. - * To add or remove composites you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. - * If you wish to recursively find all descendants, you should use the `Composite.allComposites` method. + * Destroys this GeometryMask and nulls any references it holds. * - * @property composites - * @type composite[] - * @default [] - */ - - /** - * An object reserved for storing plugin-specific properties. + * Note that if a Game Object is currently using this mask it will _not_ automatically detect you have destroyed it, + * so be sure to call `clearMask` on any Game Object using it, before destroying it. * - * @property plugin - * @type {} + * @method Phaser.Display.Masks.GeometryMask#destroy + * @since 3.7.0 */ + destroy: function () + { + this.geometryMask = null; + } -})(); +}); + +module.exports = GeometryMask; /***/ }), -/* 119 */ -/***/ (function(module, exports) { + +/***/ 93310: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Checks if the given tile coordinates are within the bounds of the layer. - * - * @function Phaser.Tilemaps.Components.IsInLayerBounds - * @since 3.0.0 - * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {boolean} `true` if the tile coordinates are within the bounds of the layer, otherwise `false`. + * @namespace Phaser.Display.Masks */ -var IsInLayerBounds = function (tileX, tileY, layer) -{ - return (tileX >= 0 && tileX < layer.width && tileY >= 0 && tileY < layer.height); -}; -module.exports = IsInLayerBounds; +module.exports = { + + BitmapMask: __webpack_require__(76756), + GeometryMask: __webpack_require__(63037) + +}; /***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 31053: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(29); -var GetFastValue = __webpack_require__(2); +var Class = __webpack_require__(56694); /** * @classdesc - * A class for representing data about about a layer in a map. Maps are parsed from CSV, Tiled, - * etc. into this format. Tilemap and TilemapLayer objects have a reference - * to this data and use it to look up and perform operations on tiles. + * A BaseShader is a small resource class that contains the data required for a WebGL Shader to be created. * - * @class LayerData - * @memberof Phaser.Tilemaps + * It contains the raw source code to the fragment and vertex shader, as well as an object that defines + * the uniforms the shader requires, if any. + * + * BaseShaders are stored in the Shader Cache, available in a Scene via `this.cache.shaders` and are referenced + * by a unique key-based string. Retrieve them via `this.cache.shaders.get(key)`. + * + * BaseShaders are created automatically by the GLSL File Loader when loading an external shader resource. + * They can also be created at runtime, allowing you to use dynamically generated shader source code. + * + * Default fragment and vertex source is used if not provided in the constructor, setting-up a basic shader, + * suitable for debug rendering. + * + * @class BaseShader + * @memberof Phaser.Display * @constructor - * @since 3.0.0 + * @since 3.17.0 * - * @param {Phaser.Types.Tilemaps.LayerDataConfig} [config] - The Layer Data configuration object. + * @param {string} key - The key of this shader. Must be unique within the shader cache. + * @param {string} [fragmentSrc] - The fragment source for the shader. + * @param {string} [vertexSrc] - The vertex source for the shader. + * @param {any} [uniforms] - Optional object defining the uniforms the shader uses. */ -var LayerData = new Class({ +var BaseShader = new Class({ initialize: - function LayerData (config) + function BaseShader (key, fragmentSrc, vertexSrc, uniforms) { - if (config === undefined) { config = {}; } + if (!fragmentSrc || fragmentSrc === '') + { + fragmentSrc = [ + 'precision mediump float;', - /** - * The name of the layer, if specified in Tiled. - * - * @name Phaser.Tilemaps.LayerData#name - * @type {string} - * @since 3.0.0 - */ - this.name = GetFastValue(config, 'name', 'layer'); + 'uniform vec2 resolution;', - /** - * The x offset of where to draw from the top left. - * - * @name Phaser.Tilemaps.LayerData#x - * @type {number} - * @since 3.0.0 - */ - this.x = GetFastValue(config, 'x', 0); + 'varying vec2 fragCoord;', - /** - * The y offset of where to draw from the top left. - * - * @name Phaser.Tilemaps.LayerData#y - * @type {number} - * @since 3.0.0 - */ - this.y = GetFastValue(config, 'y', 0); + 'void main () {', + ' vec2 uv = fragCoord / resolution.xy;', + ' gl_FragColor = vec4(uv.xyx, 1.0);', + '}' + ].join('\n'); + } - /** - * The width of the layer in tiles. - * - * @name Phaser.Tilemaps.LayerData#width - * @type {number} - * @since 3.0.0 - */ - this.width = GetFastValue(config, 'width', 0); + if (!vertexSrc || vertexSrc === '') + { + vertexSrc = [ + 'precision mediump float;', - /** - * The height of the layer in tiles. - * - * @name Phaser.Tilemaps.LayerData#height - * @type {number} - * @since 3.0.0 - */ - this.height = GetFastValue(config, 'height', 0); + 'uniform mat4 uProjectionMatrix;', + 'uniform mat4 uViewMatrix;', + 'uniform vec2 uResolution;', - /** - * The pixel width of the tiles. - * - * @name Phaser.Tilemaps.LayerData#tileWidth - * @type {number} - * @since 3.0.0 - */ - this.tileWidth = GetFastValue(config, 'tileWidth', 0); + 'attribute vec2 inPosition;', - /** - * The pixel height of the tiles. - * - * @name Phaser.Tilemaps.LayerData#tileHeight - * @type {number} - * @since 3.0.0 - */ - this.tileHeight = GetFastValue(config, 'tileHeight', 0); + 'varying vec2 fragCoord;', + 'varying vec2 outTexCoord;', - /** - * The base tile width. - * - * @name Phaser.Tilemaps.LayerData#baseTileWidth - * @type {number} - * @since 3.0.0 - */ - this.baseTileWidth = GetFastValue(config, 'baseTileWidth', this.tileWidth); + 'void main () {', + ' gl_Position = uProjectionMatrix * uViewMatrix * vec4(inPosition, 1.0, 1.0);', + ' fragCoord = vec2(inPosition.x, uResolution.y - inPosition.y);', + ' outTexCoord = vec2(inPosition.x / uResolution.x, fragCoord.y / uResolution.y);', + '}' + ].join('\n'); + } - /** - * The base tile height. - * - * @name Phaser.Tilemaps.LayerData#baseTileHeight - * @type {number} - * @since 3.0.0 - */ - this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight); + if (uniforms === undefined) { uniforms = null; } /** - * The layers orientation, necessary to be able to determine a tiles pixelX and pixelY as well as the layers width and height. + * The key of this shader, unique within the shader cache of this Phaser game instance. * - * @name Phaser.Tilemaps.LayerData#orientation - * @type {Phaser.Tilemaps.OrientationType} - * @since 3.50.0 + * @name Phaser.Display.BaseShader#key + * @type {string} + * @since 3.17.0 */ - this.orientation = GetFastValue(config, 'orientation', CONST.ORTHOGONAL); + this.key = key; /** - * The width in pixels of the entire layer. + * The source code, as a string, of the fragment shader being used. * - * @name Phaser.Tilemaps.LayerData#widthInPixels - * @type {number} - * @since 3.0.0 + * @name Phaser.Display.BaseShader#fragmentSrc + * @type {string} + * @since 3.17.0 */ - this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.baseTileWidth); + this.fragmentSrc = fragmentSrc; /** - * The height in pixels of the entire layer. + * The source code, as a string, of the vertex shader being used. * - * @name Phaser.Tilemaps.LayerData#heightInPixels - * @type {number} - * @since 3.0.0 + * @name Phaser.Display.BaseShader#vertexSrc + * @type {string} + * @since 3.17.0 */ - this.heightInPixels = GetFastValue(config, 'heightInPixels', this.height * this.baseTileHeight); + this.vertexSrc = vertexSrc; /** - * The alpha value of the layer. + * The default uniforms for this shader. * - * @name Phaser.Tilemaps.LayerData#alpha - * @type {number} - * @since 3.0.0 + * @name Phaser.Display.BaseShader#uniforms + * @type {?any} + * @since 3.17.0 */ - this.alpha = GetFastValue(config, 'alpha', 1); + this.uniforms = uniforms; + } - /** - * Is the layer visible or not? - * - * @name Phaser.Tilemaps.LayerData#visible - * @type {boolean} - * @since 3.0.0 - */ - this.visible = GetFastValue(config, 'visible', true); +}); - /** - * Layer specific properties (can be specified in Tiled) - * - * @name Phaser.Tilemaps.LayerData#properties - * @type {object[]} - * @since 3.0.0 - */ - this.properties = GetFastValue(config, 'properties', []); +module.exports = BaseShader; - /** - * Tile ID index map. - * - * @name Phaser.Tilemaps.LayerData#indexes - * @type {array} - * @since 3.0.0 - */ - this.indexes = GetFastValue(config, 'indexes', []); - /** - * Tile Collision ID index map. - * - * @name Phaser.Tilemaps.LayerData#collideIndexes - * @type {array} - * @since 3.0.0 - */ - this.collideIndexes = GetFastValue(config, 'collideIndexes', []); +/***/ }), - /** - * An array of callbacks. - * - * @name Phaser.Tilemaps.LayerData#callbacks - * @type {array} - * @since 3.0.0 - */ - this.callbacks = GetFastValue(config, 'callbacks', []); +/***/ 99584: +/***/ ((module) => { - /** - * An array of physics bodies. - * - * @name Phaser.Tilemaps.LayerData#bodies - * @type {array} - * @since 3.0.0 - */ - this.bodies = GetFastValue(config, 'bodies', []); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * An array of the tile data indexes. - * - * @name Phaser.Tilemaps.LayerData#data - * @type {Phaser.Tilemaps.Tile[][]} - * @since 3.0.0 - */ - this.data = GetFastValue(config, 'data', []); +/** + * Adds the given element to the DOM. If a parent is provided the element is added as a child of the parent, providing it was able to access it. + * If no parent was given it falls back to using `document.body`. + * + * @function Phaser.DOM.AddToDOM + * @since 3.0.0 + * + * @param {HTMLElement} element - The element to be added to the DOM. Usually a Canvas object. + * @param {(string|HTMLElement)} [parent] - The parent in which to add the element. Can be a string which is passed to `getElementById` or an actual DOM object. + * + * @return {HTMLElement} The element that was added to the DOM. + */ +var AddToDOM = function (element, parent) +{ + var target; - /** - * A reference to the Tilemap layer that owns this data. - * - * @name Phaser.Tilemaps.LayerData#tilemapLayer - * @type {Phaser.Tilemaps.TilemapLayer} - * @since 3.0.0 - */ - this.tilemapLayer = GetFastValue(config, 'tilemapLayer', null); + if (parent) + { + if (typeof parent === 'string') + { + // Hopefully an element ID + target = document.getElementById(parent); + } + else if (typeof parent === 'object' && parent.nodeType === 1) + { + // Quick test for a HTMLElement + target = parent; + } + } + else if (element.parentElement || parent === null) + { + return element; + } - /** - * The length of the horizontal sides of the hexagon. - * Only used for hexagonal orientation Tilemaps. - * - * @name Phaser.Tilemaps.LayerData#hexSideLength - * @type {number} - * @since 3.50.0 - */ - this.hexSideLength = GetFastValue(config, 'hexSideLength', 0); + // Fallback, covers an invalid ID and a non HTMLElement object + if (!target) + { + target = document.body; } -}); + target.appendChild(element); -module.exports = LayerData; + return element; +}; + +module.exports = AddToDOM; /***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 85178: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(29); -var GetFastValue = __webpack_require__(2); +var AddToDOM = __webpack_require__(99584); -/** - * @classdesc - * A class for representing data about a map. Maps are parsed from CSV, Tiled, etc. into this - * format. A Tilemap object get a copy of this data and then unpacks the needed properties into - * itself. +var CreateDOMContainer = function (game) +{ + var config = game.config; + + if (!config.parent || !config.domCreateContainer) + { + return; + } + + // DOM Element Container + var div = document.createElement('div'); + + div.style.cssText = [ + 'display: block;', + 'width: ' + game.scale.width + 'px;', + 'height: ' + game.scale.height + 'px;', + 'padding: 0; margin: 0;', + 'position: absolute;', + 'overflow: hidden;', + 'pointer-events: ' + config.domPointerEvents + ';', + 'transform: scale(1);', + 'transform-origin: left top;' + ].join(' '); + + game.domContainer = div; + + AddToDOM(div, config.parent); +}; + +module.exports = CreateDOMContainer; + + +/***/ }), + +/***/ 21546: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var OS = __webpack_require__(36580); + +/** + * @callback ContentLoadedCallback + */ + +/** + * Inspects the readyState of the document. If the document is already complete then it invokes the given callback. + * If not complete it sets up several event listeners such as `deviceready`, and once those fire, it invokes the callback. + * Called automatically by the Phaser.Game instance. Should not usually be accessed directly. * - * @class MapData - * @memberof Phaser.Tilemaps - * @constructor + * @function Phaser.DOM.DOMContentLoaded * @since 3.0.0 * - * @param {Phaser.Types.Tilemaps.MapDataConfig} [config] - The Map configuration object. + * @param {ContentLoadedCallback} callback - The callback to be invoked when the device is ready and the DOM content is loaded. */ -var MapData = new Class({ +var DOMContentLoaded = function (callback) +{ + if (document.readyState === 'complete' || document.readyState === 'interactive') + { + callback(); - initialize: + return; + } - function MapData (config) + var check = function () { - if (config === undefined) { config = {}; } + document.removeEventListener('deviceready', check, true); + document.removeEventListener('DOMContentLoaded', check, true); + window.removeEventListener('load', check, true); - /** - * The key in the Phaser cache that corresponds to the loaded tilemap data. - * - * @name Phaser.Tilemaps.MapData#name - * @type {string} - * @since 3.0.0 - */ - this.name = GetFastValue(config, 'name', 'map'); + callback(); + }; - /** - * The width of the entire tilemap. - * - * @name Phaser.Tilemaps.MapData#width - * @type {number} - * @since 3.0.0 - */ - this.width = GetFastValue(config, 'width', 0); + if (!document.body) + { + window.setTimeout(check, 20); + } + else if (OS.cordova) + { + // Ref. http://docs.phonegap.com/en/3.5.0/cordova_events_events.md.html#deviceready + document.addEventListener('deviceready', check, false); + } + else + { + document.addEventListener('DOMContentLoaded', check, true); + window.addEventListener('load', check, true); + } +}; - /** - * The height of the entire tilemap. - * - * @name Phaser.Tilemaps.MapData#height - * @type {number} - * @since 3.0.0 - */ - this.height = GetFastValue(config, 'height', 0); +module.exports = DOMContentLoaded; - /** - * If the map is infinite or not. - * - * @name Phaser.Tilemaps.MapData#infinite - * @type {boolean} - * @since 3.17.0 - */ - this.infinite = GetFastValue(config, 'infinite', false); - /** - * The width of the tiles. - * - * @name Phaser.Tilemaps.MapData#tileWidth - * @type {number} - * @since 3.0.0 - */ - this.tileWidth = GetFastValue(config, 'tileWidth', 0); +/***/ }), - /** - * The height of the tiles. - * - * @name Phaser.Tilemaps.MapData#tileHeight - * @type {number} - * @since 3.0.0 - */ - this.tileHeight = GetFastValue(config, 'tileHeight', 0); +/***/ 74181: +/***/ ((module) => { - /** - * The width in pixels of the entire tilemap. - * - * @name Phaser.Tilemaps.MapData#widthInPixels - * @type {number} - * @since 3.0.0 - */ - this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.tileWidth); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The height in pixels of the entire tilemap. - * - * @name Phaser.Tilemaps.MapData#heightInPixels - * @type {number} - * @since 3.0.0 - */ - this.heightInPixels = GetFastValue(config, 'heightInPixels', this.height * this.tileHeight); +/** + * Attempts to determine the document inner height across iOS and standard devices. + * Based on code by @tylerjpeterson + * + * @function Phaser.DOM.GetInnerHeight + * @since 3.16.0 + * + * @param {boolean} iOS - Is this running on iOS? + * + * @return {number} The inner height value. + */ +var GetInnerHeight = function (iOS) +{ - /** - * The format of the map data. - * - * @name Phaser.Tilemaps.MapData#format - * @type {number} - * @since 3.0.0 - */ - this.format = GetFastValue(config, 'format', null); + if (!iOS) + { + return window.innerHeight; + } - /** - * The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. - * - * @name Phaser.Tilemaps.MapData#orientation - * @type {Phaser.Tilemaps.OrientationType} - * @since 3.50.0 - */ - this.orientation = GetFastValue(config, 'orientation', CONST.ORTHOGONAL); + var axis = Math.abs(window.orientation); - /** - * Determines the draw order of tilemap. Default is right-down - * - * 0, or 'right-down' - * 1, or 'left-down' - * 2, or 'right-up' - * 3, or 'left-up' - * - * @name Phaser.Tilemaps.MapData#renderOrder - * @type {string} - * @since 3.12.0 - */ - this.renderOrder = GetFastValue(config, 'renderOrder', 'right-down'); + var size = { w: 0, h: 0 }; - /** - * The version of the map data (as specified in Tiled). - * - * @name Phaser.Tilemaps.MapData#version - * @type {string} - * @since 3.0.0 - */ - this.version = GetFastValue(config, 'version', '1'); + var ruler = document.createElement('div'); - /** - * Map specific properties (can be specified in Tiled) - * - * @name Phaser.Tilemaps.MapData#properties - * @type {object} - * @since 3.0.0 - */ - this.properties = GetFastValue(config, 'properties', {}); + ruler.setAttribute('style', 'position: fixed; height: 100vh; width: 0; top: 0'); - /** - * An array with all the layers configured to the MapData. - * - * @name Phaser.Tilemaps.MapData#layers - * @type {(Phaser.Tilemaps.LayerData[]|Phaser.Tilemaps.ObjectLayer)} - * @since 3.0.0 - */ - this.layers = GetFastValue(config, 'layers', []); + document.documentElement.appendChild(ruler); - /** - * An array of Tiled Image Layers. - * - * @name Phaser.Tilemaps.MapData#images - * @type {array} - * @since 3.0.0 - */ - this.images = GetFastValue(config, 'images', []); + size.w = (axis === 90) ? ruler.offsetHeight : window.innerWidth; + size.h = (axis === 90) ? window.innerWidth : ruler.offsetHeight; - /** - * An object of Tiled Object Layers. - * - * @name Phaser.Tilemaps.MapData#objects - * @type {object} - * @since 3.0.0 - */ - this.objects = GetFastValue(config, 'objects', {}); + document.documentElement.removeChild(ruler); - /** - * An object of collision data. Must be created as physics object or will return undefined. - * - * @name Phaser.Tilemaps.MapData#collision - * @type {object} - * @since 3.0.0 - */ - this.collision = GetFastValue(config, 'collision', {}); + ruler = null; - /** - * An array of Tilesets. - * - * @name Phaser.Tilemaps.MapData#tilesets - * @type {Phaser.Tilemaps.Tileset[]} - * @since 3.0.0 - */ - this.tilesets = GetFastValue(config, 'tilesets', []); + if (Math.abs(window.orientation) !== 90) + { + return size.h; + } + else + { + return size.w; + } +}; - /** - * The collection of images the map uses(specified in Tiled) - * - * @name Phaser.Tilemaps.MapData#imageCollections - * @type {array} - * @since 3.0.0 - */ - this.imageCollections = GetFastValue(config, 'imageCollections', []); +module.exports = GetInnerHeight; - /** - * An array of tile instances. - * - * @name Phaser.Tilemaps.MapData#tiles - * @type {array} - * @since 3.0.0 - */ - this.tiles = GetFastValue(config, 'tiles', []); - /** - * The length of the horizontal sides of the hexagon. - * Only used for hexagonal orientation Tilemaps. - * - * @name Phaser.Tilemaps.MapData#hexSideLength - * @type {number} - * @since 3.50.0 - */ - this.hexSideLength = GetFastValue(config, 'hexSideLength', 0); +/***/ }), + +/***/ 9229: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(55301); + +/** + * Attempts to determine the screen orientation using the Orientation API. + * + * @function Phaser.DOM.GetScreenOrientation + * @since 3.16.0 + * + * @param {number} width - The width of the viewport. + * @param {number} height - The height of the viewport. + * + * @return {string} The orientation. + */ +var GetScreenOrientation = function (width, height) +{ + var screen = window.screen; + var orientation = (screen) ? screen.orientation || screen.mozOrientation || screen.msOrientation : false; + + if (orientation && typeof orientation.type === 'string') + { + // Screen Orientation API specification + return orientation.type; + } + else if (typeof orientation === 'string') + { + // moz / ms-orientation are strings + return orientation; } -}); + if (typeof window.orientation === 'number') + { + // Do this check first, as iOS supports this, but also has an incomplete window.screen implementation + // This may change by device based on "natural" orientation. + return (window.orientation === 0 || window.orientation === 180) ? CONST.ORIENTATION.PORTRAIT : CONST.ORIENTATION.LANDSCAPE; + } + else if (window.matchMedia) + { + if (window.matchMedia('(orientation: portrait)').matches) + { + return CONST.ORIENTATION.PORTRAIT; + } + else if (window.matchMedia('(orientation: landscape)').matches) + { + return CONST.ORIENTATION.LANDSCAPE; + } + } + else + { + return (height > width) ? CONST.ORIENTATION.PORTRAIT : CONST.ORIENTATION.LANDSCAPE; + } +}; -module.exports = MapData; +module.exports = GetScreenOrientation; /***/ }), -/* 122 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 2893: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); +/** + * Attempts to get the target DOM element based on the given value, which can be either + * a string, in which case it will be looked-up by ID, or an element node. If nothing + * can be found it will return a reference to the document.body. + * + * @function Phaser.DOM.GetTarget + * @since 3.16.0 + * + * @param {HTMLElement} element - The DOM element to look-up. + */ +var GetTarget = function (element) +{ + var target; + + if (element !== '') + { + if (typeof element === 'string') + { + // Hopefully an element ID + target = document.getElementById(element); + } + else if (element && element.nodeType === 1) + { + // Quick test for a HTMLElement + target = element; + } + } + + // Fallback to the document body. Covers an invalid ID and a non HTMLElement object. + if (!target) + { + // Use the full window + target = document.body; + } + + return target; +}; + +module.exports = GetTarget; + + +/***/ }), + +/***/ 89200: +/***/ ((module) => { /** - * @classdesc - * A Tileset is a combination of an image containing the tiles and a container for data about - * each tile. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Takes the given data string and parses it as XML. + * First tries to use the window.DOMParser and reverts to the Microsoft.XMLDOM if that fails. + * The parsed XML object is returned, or `null` if there was an error while parsing the data. * - * @class Tileset - * @memberof Phaser.Tilemaps - * @constructor + * @function Phaser.DOM.ParseXML * @since 3.0.0 * - * @param {string} name - The name of the tileset in the map data. - * @param {number} firstgid - The first tile index this tileset contains. - * @param {number} [tileWidth=32] - Width of each tile (in pixels). - * @param {number} [tileHeight=32] - Height of each tile (in pixels). - * @param {number} [tileMargin=0] - The margin around all tiles in the sheet (in pixels). - * @param {number} [tileSpacing=0] - The spacing between each tile in the sheet (in pixels). - * @param {object} [tileProperties={}] - Custom properties defined per tile in the Tileset. - * These typically are custom properties created in Tiled when editing a tileset. - * @param {object} [tileData={}] - Data stored per tile. These typically are created in Tiled - * when editing a tileset, e.g. from Tiled's tile collision editor or terrain editor. + * @param {string} data - The XML source stored in a string. + * + * @return {?(DOMParser|ActiveXObject)} The parsed XML data, or `null` if the data could not be parsed. */ -var Tileset = new Class({ +var ParseXML = function (data) +{ + var xml = ''; - initialize: + try + { + if (window['DOMParser']) + { + var domparser = new DOMParser(); + xml = domparser.parseFromString(data, 'text/xml'); + } + else + { + xml = new ActiveXObject('Microsoft.XMLDOM'); + xml.loadXML(data); + } + } + catch (e) + { + xml = null; + } - function Tileset (name, firstgid, tileWidth, tileHeight, tileMargin, tileSpacing, tileProperties, tileData) + if (!xml || !xml.documentElement || xml.getElementsByTagName('parsererror').length) { - if (tileWidth === undefined || tileWidth <= 0) { tileWidth = 32; } - if (tileHeight === undefined || tileHeight <= 0) { tileHeight = 32; } - if (tileMargin === undefined) { tileMargin = 0; } - if (tileSpacing === undefined) { tileSpacing = 0; } - if (tileProperties === undefined) { tileProperties = {}; } - if (tileData === undefined) { tileData = {}; } + return null; + } + else + { + return xml; + } +}; - /** - * The name of the Tileset. - * - * @name Phaser.Tilemaps.Tileset#name - * @type {string} - * @since 3.0.0 - */ - this.name = name; +module.exports = ParseXML; + + +/***/ }), + +/***/ 55638: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Attempts to remove the element from its parentNode in the DOM. + * + * @function Phaser.DOM.RemoveFromDOM + * @since 3.0.0 + * + * @param {HTMLElement} element - The DOM element to remove from its parent node. + */ +var RemoveFromDOM = function (element) +{ + if (element.parentNode) + { + element.parentNode.removeChild(element); + } +}; + +module.exports = RemoveFromDOM; + + +/***/ }), + +/***/ 27385: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var NOOP = __webpack_require__(72283); + +/** + * @classdesc + * Abstracts away the use of RAF or setTimeOut for the core game update loop. + * + * This is invoked automatically by the Phaser.Game instance. + * + * @class RequestAnimationFrame + * @memberof Phaser.DOM + * @constructor + * @since 3.0.0 + */ +var RequestAnimationFrame = new Class({ + + initialize: + function RequestAnimationFrame () + { /** - * The starting index of the first tile index this Tileset contains. + * True if RequestAnimationFrame is running, otherwise false. * - * @name Phaser.Tilemaps.Tileset#firstgid - * @type {number} + * @name Phaser.DOM.RequestAnimationFrame#isRunning + * @type {boolean} + * @default false * @since 3.0.0 */ - this.firstgid = firstgid; + this.isRunning = false; /** - * The width of each tile (in pixels). Use setTileSize to change. + * The callback to be invoked each step. * - * @name Phaser.Tilemaps.Tileset#tileWidth - * @type {number} - * @readonly + * @name Phaser.DOM.RequestAnimationFrame#callback + * @type {FrameRequestCallback} * @since 3.0.0 */ - this.tileWidth = tileWidth; + this.callback = NOOP; /** - * The height of each tile (in pixels). Use setTileSize to change. + * True if the step is using setTimeout instead of RAF. * - * @name Phaser.Tilemaps.Tileset#tileHeight - * @type {number} - * @readonly + * @name Phaser.DOM.RequestAnimationFrame#isSetTimeOut + * @type {boolean} + * @default false * @since 3.0.0 */ - this.tileHeight = tileHeight; + this.isSetTimeOut = false; /** - * The margin around the tiles in the sheet (in pixels). Use `setSpacing` to change. + * The setTimeout or RAF callback ID used when canceling them. * - * @name Phaser.Tilemaps.Tileset#tileMargin - * @type {number} - * @readonly + * @name Phaser.DOM.RequestAnimationFrame#timeOutID + * @type {?number} + * @default null * @since 3.0.0 */ - this.tileMargin = tileMargin; + this.timeOutID = null; /** - * The spacing between each the tile in the sheet (in pixels). Use `setSpacing` to change. + * The delay rate in ms for setTimeOut. * - * @name Phaser.Tilemaps.Tileset#tileSpacing + * @name Phaser.DOM.RequestAnimationFrame#delay * @type {number} - * @readonly - * @since 3.0.0 + * @default 0 + * @since 3.60.0 */ - this.tileSpacing = tileSpacing; + this.delay = 0; - /** - * Tileset-specific properties per tile that are typically defined in the Tiled editor in the - * Tileset editor. - * - * @name Phaser.Tilemaps.Tileset#tileProperties - * @type {object} - * @since 3.0.0 - */ - this.tileProperties = tileProperties; + var _this = this; /** - * Tileset-specific data per tile that are typically defined in the Tiled editor, e.g. within - * the Tileset collision editor. This is where collision objects and terrain are stored. + * The RAF step function. * - * @name Phaser.Tilemaps.Tileset#tileData - * @type {object} - * @since 3.0.0 - */ - this.tileData = tileData; - - /** - * The cached image that contains the individual tiles. Use setImage to set. + * Invokes the callback and schedules another call to requestAnimationFrame. * - * @name Phaser.Tilemaps.Tileset#image - * @type {?Phaser.Textures.Texture} - * @readonly + * @name Phaser.DOM.RequestAnimationFrame#step + * @type {FrameRequestCallback} * @since 3.0.0 - */ - this.image = null; - - /** - * The gl texture used by the WebGL renderer. * - * @name Phaser.Tilemaps.Tileset#glTexture - * @type {?WebGLTexture} - * @readonly - * @since 3.11.0 + * @param {number} time - The timestamp passed in from RequestAnimationFrame. */ - this.glTexture = null; + this.step = function step (time) + { + _this.callback(time); - /** - * The number of tile rows in the the tileset. - * - * @name Phaser.Tilemaps.Tileset#rows - * @type {number} - * @readonly - * @since 3.0.0 - */ - this.rows = 0; + if (_this.isRunning) + { + _this.timeOutID = window.requestAnimationFrame(step); + } + }; /** - * The number of tile columns in the tileset. + * The SetTimeout step function. * - * @name Phaser.Tilemaps.Tileset#columns - * @type {number} - * @readonly - * @since 3.0.0 - */ - this.columns = 0; - - /** - * The total number of tiles in the tileset. + * Invokes the callback and schedules another call to setTimeout. * - * @name Phaser.Tilemaps.Tileset#total - * @type {number} - * @readonly + * @name Phaser.DOM.RequestAnimationFrame#stepTimeout + * @type {function} * @since 3.0.0 */ - this.total = 0; + this.stepTimeout = function stepTimeout () + { + if (_this.isRunning) + { + // Make the next request before the callback, so that timing is maintained + _this.timeOutID = window.setTimeout(stepTimeout, _this.delay); + } - /** - * The look-up table to specific tile image texture coordinates (UV in pixels). Each element - * contains the coordinates for a tile in an object of the form {x, y}. - * - * @name Phaser.Tilemaps.Tileset#texCoordinates - * @type {object[]} - * @readonly - * @since 3.0.0 - */ - this.texCoordinates = []; + _this.callback(window.performance.now()); + }; }, /** - * Get a tiles properties that are stored in the Tileset. Returns null if tile index is not - * contained in this Tileset. This is typically defined in Tiled under the Tileset editor. + * Starts the requestAnimationFrame or setTimeout process running. * - * @method Phaser.Tilemaps.Tileset#getTileProperties + * @method Phaser.DOM.RequestAnimationFrame#start * @since 3.0.0 * - * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. - * - * @return {?(object|undefined)} + * @param {FrameRequestCallback} callback - The callback to invoke each step. + * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? + * @param {number} delay - The setTimeout delay rate in ms. */ - getTileProperties: function (tileIndex) + start: function (callback, forceSetTimeOut, delay) { - if (!this.containsTileIndex(tileIndex)) { return null; } + if (this.isRunning) + { + return; + } - return this.tileProperties[tileIndex - this.firstgid]; - }, + this.callback = callback; - /** - * Get a tile's data that is stored in the Tileset. Returns null if tile index is not contained - * in this Tileset. This is typically defined in Tiled and will contain both Tileset collision - * info and terrain mapping. - * - * @method Phaser.Tilemaps.Tileset#getTileData - * @since 3.0.0 - * - * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. - * - * @return {?object|undefined} - */ - getTileData: function (tileIndex) - { - if (!this.containsTileIndex(tileIndex)) { return null; } + this.isSetTimeOut = forceSetTimeOut; - return this.tileData[tileIndex - this.firstgid]; - }, + this.delay = delay; - /** - * Get a tile's collision group that is stored in the Tileset. Returns null if tile index is not - * contained in this Tileset. This is typically defined within Tiled's tileset collision editor. - * - * @method Phaser.Tilemaps.Tileset#getTileCollisionGroup - * @since 3.0.0 - * - * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. - * - * @return {?object} - */ - getTileCollisionGroup: function (tileIndex) - { - var data = this.getTileData(tileIndex); + this.isRunning = true; - return (data && data.objectgroup) ? data.objectgroup : null; + this.timeOutID = (forceSetTimeOut) ? window.setTimeout(this.stepTimeout, 0) : window.requestAnimationFrame(this.step); }, /** - * Returns true if and only if this Tileset contains the given tile index. + * Stops the requestAnimationFrame or setTimeout from running. * - * @method Phaser.Tilemaps.Tileset#containsTileIndex + * @method Phaser.DOM.RequestAnimationFrame#stop * @since 3.0.0 - * - * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. - * - * @return {boolean} */ - containsTileIndex: function (tileIndex) + stop: function () { - return ( - tileIndex >= this.firstgid && - tileIndex < (this.firstgid + this.total) - ); + this.isRunning = false; + + if (this.isSetTimeOut) + { + clearTimeout(this.timeOutID); + } + else + { + window.cancelAnimationFrame(this.timeOutID); + } }, /** - * Returns the texture coordinates (UV in pixels) in the Tileset image for the given tile index. - * Returns null if tile index is not contained in this Tileset. + * Stops the step from running and clears the callback reference. * - * @method Phaser.Tilemaps.Tileset#getTileTextureCoordinates + * @method Phaser.DOM.RequestAnimationFrame#destroy * @since 3.0.0 - * - * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. - * - * @return {?object} Object in the form { x, y } representing the top-left UV coordinate - * within the Tileset image. */ - getTileTextureCoordinates: function (tileIndex) + destroy: function () { - if (!this.containsTileIndex(tileIndex)) { return null; } + this.stop(); - return this.texCoordinates[tileIndex - this.firstgid]; - }, + this.callback = NOOP; + } - /** - * Sets the image associated with this Tileset and updates the tile data (rows, columns, etc.). - * - * @method Phaser.Tilemaps.Tileset#setImage - * @since 3.0.0 - * - * @param {Phaser.Textures.Texture} texture - The image that contains the tiles. - * - * @return {Phaser.Tilemaps.Tileset} This Tileset object. - */ - setImage: function (texture) - { - this.image = texture; +}); - this.glTexture = texture.get().source.glTexture; +module.exports = RequestAnimationFrame; - this.updateTileData(this.image.source[0].width, this.image.source[0].height); - return this; - }, +/***/ }), - /** - * Sets the tile width & height and updates the tile data (rows, columns, etc.). - * - * @method Phaser.Tilemaps.Tileset#setTileSize - * @since 3.0.0 - * - * @param {number} [tileWidth] - The width of a tile in pixels. - * @param {number} [tileHeight] - The height of a tile in pixels. - * - * @return {Phaser.Tilemaps.Tileset} This Tileset object. - */ - setTileSize: function (tileWidth, tileHeight) - { - if (tileWidth !== undefined) { this.tileWidth = tileWidth; } - if (tileHeight !== undefined) { this.tileHeight = tileHeight; } +/***/ 3590: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (this.image) - { - this.updateTileData(this.image.source[0].width, this.image.source[0].height); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; +/** + * @namespace Phaser.DOM + */ + +var Dom = { + + AddToDOM: __webpack_require__(99584), + DOMContentLoaded: __webpack_require__(21546), + GetInnerHeight: __webpack_require__(74181), + GetScreenOrientation: __webpack_require__(9229), + GetTarget: __webpack_require__(2893), + ParseXML: __webpack_require__(89200), + RemoveFromDOM: __webpack_require__(55638), + RequestAnimationFrame: __webpack_require__(27385) + +}; + +module.exports = Dom; + + +/***/ }), + +/***/ 78491: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var EE = __webpack_require__(6659); +var PluginCache = __webpack_require__(91963); + +/** + * @classdesc + * EventEmitter is a Scene Systems plugin compatible version of eventemitter3. + * + * @class EventEmitter + * @memberof Phaser.Events + * @constructor + * @since 3.0.0 + */ +var EventEmitter = new Class({ + + Extends: EE, + + initialize: + + function EventEmitter () + { + EE.call(this); }, /** - * Sets the tile margin & spacing and updates the tile data (rows, columns, etc.). + * Removes all listeners. * - * @method Phaser.Tilemaps.Tileset#setSpacing + * @method Phaser.Events.EventEmitter#shutdown * @since 3.0.0 - * - * @param {number} [margin] - The margin around the tiles in the sheet (in pixels). - * @param {number} [spacing] - The spacing between the tiles in the sheet (in pixels). - * - * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ - setSpacing: function (margin, spacing) + shutdown: function () { - if (margin !== undefined) { this.tileMargin = margin; } - if (spacing !== undefined) { this.tileSpacing = spacing; } - - if (this.image) - { - this.updateTileData(this.image.source[0].width, this.image.source[0].height); - } - - return this; + this.removeAllListeners(); }, /** - * Updates tile texture coordinates and tileset data. + * Removes all listeners. * - * @method Phaser.Tilemaps.Tileset#updateTileData + * @method Phaser.Events.EventEmitter#destroy * @since 3.0.0 - * - * @param {number} imageWidth - The (expected) width of the image to slice. - * @param {number} imageHeight - The (expected) height of the image to slice. - * - * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ - updateTileData: function (imageWidth, imageHeight) + destroy: function () { - var rowCount = (imageHeight - this.tileMargin * 2 + this.tileSpacing) / (this.tileHeight + this.tileSpacing); - var colCount = (imageWidth - this.tileMargin * 2 + this.tileSpacing) / (this.tileWidth + this.tileSpacing); + this.removeAllListeners(); + } - if (rowCount % 1 !== 0 || colCount % 1 !== 0) - { - console.warn('Image tile area not tile size multiple in: ' + this.name); - } +}); - // In Tiled a tileset image that is not an even multiple of the tile dimensions is truncated - // - hence the floor when calculating the rows/columns. - rowCount = Math.floor(rowCount); - colCount = Math.floor(colCount); +/** + * Return an array listing the events for which the emitter has registered listeners. + * + * @method Phaser.Events.EventEmitter#eventNames + * @since 3.0.0 + * + * @return {Array.} + */ - this.rows = rowCount; - this.columns = colCount; +/** + * Return the listeners registered for a given event. + * + * @method Phaser.Events.EventEmitter#listeners + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * + * @return {Function[]} The registered listeners. + */ - // In Tiled, "empty" spaces in a tileset count as tiles and hence count towards the gid - this.total = rowCount * colCount; +/** + * Return the number of listeners listening to a given event. + * + * @method Phaser.Events.EventEmitter#listenerCount + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * + * @return {number} The number of listeners. + */ - this.texCoordinates.length = 0; +/** + * Calls each of the listeners registered for a given event. + * + * @method Phaser.Events.EventEmitter#emit + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {...*} [args] - Additional arguments that will be passed to the event handler. + * + * @return {boolean} `true` if the event had listeners, else `false`. + */ - var tx = this.tileMargin; - var ty = this.tileMargin; +/** + * Add a listener for a given event. + * + * @method Phaser.Events.EventEmitter#on + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {this} `this`. + */ - for (var y = 0; y < this.rows; y++) - { - for (var x = 0; x < this.columns; x++) - { - this.texCoordinates.push({ x: tx, y: ty }); - tx += this.tileWidth + this.tileSpacing; - } +/** + * Add a listener for a given event. + * + * @method Phaser.Events.EventEmitter#addListener + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {this} `this`. + */ - tx = this.tileMargin; - ty += this.tileHeight + this.tileSpacing; - } +/** + * Add a one-time listener for a given event. + * + * @method Phaser.Events.EventEmitter#once + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} fn - The listener function. + * @param {*} [context=this] - The context to invoke the listener with. + * + * @return {this} `this`. + */ - return this; - } +/** + * Remove the listeners of a given event. + * + * @method Phaser.Events.EventEmitter#removeListener + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} [fn] - Only remove the listeners that match this function. + * @param {*} [context] - Only remove the listeners that have this context. + * @param {boolean} [once] - Only remove one-time listeners. + * + * @return {this} `this`. + */ -}); +/** + * Remove the listeners of a given event. + * + * @method Phaser.Events.EventEmitter#off + * @since 3.0.0 + * + * @param {(string|symbol)} event - The event name. + * @param {function} [fn] - Only remove the listeners that match this function. + * @param {*} [context] - Only remove the listeners that have this context. + * @param {boolean} [once] - Only remove one-time listeners. + * + * @return {this} `this`. + */ -module.exports = Tileset; +/** + * Remove all listeners, or those of the specified event. + * + * @method Phaser.Events.EventEmitter#removeAllListeners + * @since 3.0.0 + * + * @param {(string|symbol)} [event] - The event name. + * + * @return {this} `this`. + */ + +PluginCache.register('EventEmitter', EventEmitter, 'events'); + +module.exports = EventEmitter; /***/ }), -/* 123 */ -/***/ (function(module, exports) { + +/***/ 95146: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ALIGN_CONST = { +/** + * @namespace Phaser.Events + */ - /** - * A constant representing a top-left alignment or position. - * @constant - * @name Phaser.Display.Align.TOP_LEFT - * @since 3.0.0 - * @type {number} - */ - TOP_LEFT: 0, - - /** - * A constant representing a top-center alignment or position. - * @constant - * @name Phaser.Display.Align.TOP_CENTER - * @since 3.0.0 - * @type {number} - */ - TOP_CENTER: 1, - - /** - * A constant representing a top-right alignment or position. - * @constant - * @name Phaser.Display.Align.TOP_RIGHT - * @since 3.0.0 - * @type {number} - */ - TOP_RIGHT: 2, - - /** - * A constant representing a left-top alignment or position. - * @constant - * @name Phaser.Display.Align.LEFT_TOP - * @since 3.0.0 - * @type {number} - */ - LEFT_TOP: 3, - - /** - * A constant representing a left-center alignment or position. - * @constant - * @name Phaser.Display.Align.LEFT_CENTER - * @since 3.0.0 - * @type {number} - */ - LEFT_CENTER: 4, - - /** - * A constant representing a left-bottom alignment or position. - * @constant - * @name Phaser.Display.Align.LEFT_BOTTOM - * @since 3.0.0 - * @type {number} - */ - LEFT_BOTTOM: 5, - - /** - * A constant representing a center alignment or position. - * @constant - * @name Phaser.Display.Align.CENTER - * @since 3.0.0 - * @type {number} - */ - CENTER: 6, - - /** - * A constant representing a right-top alignment or position. - * @constant - * @name Phaser.Display.Align.RIGHT_TOP - * @since 3.0.0 - * @type {number} - */ - RIGHT_TOP: 7, - - /** - * A constant representing a right-center alignment or position. - * @constant - * @name Phaser.Display.Align.RIGHT_CENTER - * @since 3.0.0 - * @type {number} - */ - RIGHT_CENTER: 8, - - /** - * A constant representing a right-bottom alignment or position. - * @constant - * @name Phaser.Display.Align.RIGHT_BOTTOM - * @since 3.0.0 - * @type {number} - */ - RIGHT_BOTTOM: 9, - - /** - * A constant representing a bottom-left alignment or position. - * @constant - * @name Phaser.Display.Align.BOTTOM_LEFT - * @since 3.0.0 - * @type {number} - */ - BOTTOM_LEFT: 10, - - /** - * A constant representing a bottom-center alignment or position. - * @constant - * @name Phaser.Display.Align.BOTTOM_CENTER - * @since 3.0.0 - * @type {number} - */ - BOTTOM_CENTER: 11, - - /** - * A constant representing a bottom-right alignment or position. - * @constant - * @name Phaser.Display.Align.BOTTOM_RIGHT - * @since 3.0.0 - * @type {number} - */ - BOTTOM_RIGHT: 12 - -}; - -module.exports = ALIGN_CONST; +module.exports = { EventEmitter: __webpack_require__(78491) }; /***/ }), -/* 124 */ -/***/ (function(module, exports) { + +/***/ 20170: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); + /** - * Check whether the given values are fuzzily equal. + * @classdesc + * The Barrel FX Controller. * - * Two numbers are fuzzily equal if their difference is less than `epsilon`. + * This FX controller manages the barrel distortion effect for a Game Object. * - * @function Phaser.Math.Fuzzy.Equal - * @since 3.0.0 + * A barrel effect allows you to apply either a 'pinch' or 'expand' distortion to + * a Game Object. The amount of the effect can be modified in real-time. * - * @param {number} a - The first value. - * @param {number} b - The second value. - * @param {number} [epsilon=0.0001] - The epsilon. + * A Barrel effect is added to a Game Object via the FX component: * - * @return {boolean} `true` if the values are fuzzily equal, otherwise `false`. - */ -var Equal = function (a, b, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return Math.abs(a - b) < epsilon; -}; - -module.exports = Equal; - - -/***/ }), -/* 125 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(15); -var ImageRender = __webpack_require__(1068); - -/** - * @classdesc - * An Image Game Object. + * ```js + * const sprite = this.add.sprite(); * - * An Image is a light-weight Game Object useful for the display of static images in your game, - * such as logos, backgrounds, scenery or other non-animated elements. Images can have input - * events and physics bodies, or be tweened, tinted or scrolled. The main difference between an - * Image and a Sprite is that you cannot animate an Image as they do not have the Animation component. + * sprite.preFX.addBarrel(); + * sprite.postFX.addBarrel(); + * ``` * - * @class Image - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects + * @class Barrel + * @extends Phaser.FX.Controller + * @memberof Phaser.FX * @constructor - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.TextureCrop - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible + * @since 3.60.0 * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {number} [amount=1] - The amount of distortion applied to the barrel effect. A value of 1 is no distortion. Typically keep this within +- 1. */ -var Image = new Class({ - - Extends: GameObject, +var Barrel = new Class({ - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.Depth, - Components.Flip, - Components.GetBounds, - Components.Mask, - Components.Origin, - Components.Pipeline, - Components.ScrollFactor, - Components.Size, - Components.TextureCrop, - Components.Tint, - Components.Transform, - Components.Visible, - ImageRender - ], + Extends: Controller, initialize: - function Image (scene, x, y, texture, frame) + function Barrel (gameObject, amount) { - GameObject.call(this, scene, 'Image'); + if (amount === undefined) { amount = 1; } + + Controller.call(this, FX_CONST.BARREL, gameObject); /** - * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. + * The amount of distortion applied to the barrel effect. * - * @name Phaser.GameObjects.Image#_crop - * @type {object} - * @private - * @since 3.11.0 + * Typically keep this within the range 1 (no distortion) to +- 1. + * + * @name Phaser.FX.Barrel#amount + * @type {number} + * @since 3.60.0 */ - this._crop = this.resetCropObject(); - - this.setTexture(texture, frame); - this.setPosition(x, y); - this.setSizeToFrame(); - this.setOriginFromFrame(); - this.initPipeline(); + this.amount = amount; } }); -module.exports = Image; +module.exports = Barrel; /***/ }), -/* 126 */ -/***/ (function(module, exports) { + +/***/ 51182: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); + /** - * Determine whether the source object has a property with the specified key. + * @classdesc + * The Bloom FX Controller. * - * @function Phaser.Utils.Objects.HasValue - * @since 3.0.0 + * This FX controller manages the bloom effect for a Game Object. * - * @param {object} source - The source object to be checked. - * @param {string} key - The property to check for within the object + * Bloom is an effect used to reproduce an imaging artifact of real-world cameras. + * The effect produces fringes of light extending from the borders of bright areas in an image, + * contributing to the illusion of an extremely bright light overwhelming the + * camera or eye capturing the scene. * - * @return {boolean} `true` if the provided `key` exists on the `source` object, otherwise `false`. - */ -var HasValue = function (source, key) -{ - return (source.hasOwnProperty(key)); -}; - -module.exports = HasValue; - - -/***/ }), -/* 127 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Clone = __webpack_require__(77); - -/** - * Creates a new Object using all values from obj1 and obj2. - * If a value exists in both obj1 and obj2, the value in obj1 is used. - * - * This is only a shallow copy. Deeply nested objects are not cloned, so be sure to only use this - * function on shallow objects. + * A Bloom effect is added to a Game Object via the FX component: * - * @function Phaser.Utils.Objects.Merge - * @since 3.0.0 + * ```js + * const sprite = this.add.sprite(); * - * @param {object} obj1 - The first object. - * @param {object} obj2 - The second object. + * sprite.preFX.addBloom(); + * sprite.postFX.addBloom(); + * ``` * - * @return {object} A new object containing the union of obj1's and obj2's properties. + * @class Bloom + * @extends Phaser.FX.Controller + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {number} [color=0xffffff] - The color of the Bloom, as a hex value. + * @param {number} [offsetX=1] - The horizontal offset of the bloom effect. + * @param {number} [offsetY=1] - The vertical offset of the bloom effect. + * @param {number} [blurStrength=1] - The strength of the blur process of the bloom effect. + * @param {number} [strength=1] - The strength of the blend process of the bloom effect. + * @param {number} [steps=4] - The number of steps to run the Bloom effect for. This value should always be an integer. */ -var Merge = function (obj1, obj2) -{ - var clone = Clone(obj1); - - for (var key in obj2) - { - if (!clone.hasOwnProperty(key)) - { - clone[key] = obj2[key]; - } - } - - return clone; -}; - -module.exports = Merge; - - -/***/ }), -/* 128 */ -/***/ (function(module, exports, __webpack_require__) { - -/** -* The `Matter.Constraint` module contains methods for creating and manipulating constraints. -* Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position). -* The stiffness of constraints can be modified to create springs or elastic. -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class Constraint -*/ +var Bloom = new Class({ -var Constraint = {}; + Extends: Controller, -module.exports = Constraint; + initialize: -var Vertices = __webpack_require__(64); -var Vector = __webpack_require__(83); -var Sleeping = __webpack_require__(165); -var Bounds = __webpack_require__(84); -var Axes = __webpack_require__(271); -var Common = __webpack_require__(32); + function Bloom (gameObject, color, offsetX, offsetY, blurStrength, strength, steps) + { + if (offsetX === undefined) { offsetX = 1; } + if (offsetY === undefined) { offsetY = 1; } + if (blurStrength === undefined) { blurStrength = 1; } + if (strength === undefined) { strength = 1; } + if (steps === undefined) { steps = 4; } -(function() { + Controller.call(this, FX_CONST.BLOOM, gameObject); - Constraint._warming = 0.4; - Constraint._torqueDampen = 1; - Constraint._minLength = 0.000001; + /** + * The number of steps to run the Bloom effect for. + * + * This value should always be an integer. + * + * It defaults to 4. The higher the value, the smoother the Bloom, + * but at the cost of exponentially more gl operations. + * + * Keep this to the lowest possible number you can have it, while + * still looking correct for your game. + * + * @name Phaser.FX.Bloom#steps + * @type {number} + * @since 3.60.0 + */ + this.steps = steps; - /** - * Creates a new constraint. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` value (e.g. `0.7` or above). - * If the constraint is unstable, try lowering the `stiffness` value and / or increasing `engine.constraintIterations`. - * For compound bodies, constraints must be applied to the parent body (not one of its parts). - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {} options - * @return {constraint} constraint - */ - Constraint.create = function(options) { - var constraint = options; + /** + * The horizontal offset of the bloom effect. + * + * @name Phaser.FX.Bloom#offsetX + * @type {number} + * @since 3.60.0 + */ + this.offsetX = offsetX; - // if bodies defined but no points, use body centre - if (constraint.bodyA && !constraint.pointA) - constraint.pointA = { x: 0, y: 0 }; - if (constraint.bodyB && !constraint.pointB) - constraint.pointB = { x: 0, y: 0 }; + /** + * The vertical offset of the bloom effect. + * + * @name Phaser.FX.Bloom#offsetY + * @type {number} + * @since 3.60.0 + */ + this.offsetY = offsetY; - // calculate static length using initial world space points - var initialPointA = constraint.bodyA ? Vector.add(constraint.bodyA.position, constraint.pointA) : constraint.pointA, - initialPointB = constraint.bodyB ? Vector.add(constraint.bodyB.position, constraint.pointB) : constraint.pointB, - length = Vector.magnitude(Vector.sub(initialPointA, initialPointB)); - - constraint.length = typeof constraint.length !== 'undefined' ? constraint.length : length; + /** + * The strength of the blur process of the bloom effect. + * + * @name Phaser.FX.Bloom#blurStrength + * @type {number} + * @since 3.60.0 + */ + this.blurStrength = blurStrength; - // option defaults - constraint.id = constraint.id || Common.nextId(); - constraint.label = constraint.label || 'Constraint'; - constraint.type = 'constraint'; - constraint.stiffness = constraint.stiffness || (constraint.length > 0 ? 1 : 0.7); - constraint.damping = constraint.damping || 0; - constraint.angularStiffness = constraint.angularStiffness || 0; - constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA; - constraint.angleB = constraint.bodyB ? constraint.bodyB.angle : constraint.angleB; - constraint.plugin = {}; + /** + * The strength of the blend process of the bloom effect. + * + * @name Phaser.FX.Bloom#strength + * @type {number} + * @since 3.60.0 + */ + this.strength = strength; - // render - var render = { - visible: true, - type: 'line', - anchors: true, - lineColor: null, // custom Phaser property - lineOpacity: null, // custom Phaser property - lineThickness: null, // custom Phaser property - pinSize: null, // custom Phaser property - anchorColor: null, // custom Phaser property - anchorSize: null // custom Phaser property - }; + /** + * The internal gl color array. + * + * @name Phaser.FX.Bloom#glcolor + * @type {number[]} + * @since 3.60.0 + */ + this.glcolor = [ 1, 1, 1 ]; - if (constraint.length === 0 && constraint.stiffness > 0.1) { - render.type = 'pin'; - render.anchors = false; - } else if (constraint.stiffness < 0.9) { - render.type = 'spring'; + if (color !== undefined && color !== null) + { + this.color = color; } - - constraint.render = Common.extend(render, constraint.render); - - return constraint; - }; + }, /** - * Prepares for solving by constraint warming. - * @private - * @method preSolveAll - * @param {body[]} bodies + * The color of the bloom as a number value. + * + * @name Phaser.FX.Bloom#color + * @type {number} + * @since 3.60.0 */ - Constraint.preSolveAll = function(bodies) { - for (var i = 0; i < bodies.length; i += 1) { - var body = bodies[i], - impulse = body.constraintImpulse; - - if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) { - continue; - } - - body.position.x += impulse.x; - body.position.y += impulse.y; - body.angle += impulse.angle; - } - }; + color: { - /** - * Solves all constraints in a list of collisions. - * @private - * @method solveAll - * @param {constraint[]} constraints - * @param {number} timeScale - */ - Constraint.solveAll = function(constraints, timeScale) { - // Solve fixed constraints first. - for (var i = 0; i < constraints.length; i += 1) { - var constraint = constraints[i], - fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic), - fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic); + get: function () + { + var color = this.glcolor; - if (fixedA || fixedB) { - Constraint.solve(constraints[i], timeScale); - } - } + return (((color[0] * 255) << 16) + ((color[1] * 255) << 8) + (color[2] * 255 | 0)); + }, - // Solve free constraints last. - for (i = 0; i < constraints.length; i += 1) { - constraint = constraints[i]; - fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic); - fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic); + set: function (value) + { + var color = this.glcolor; - if (!fixedA && !fixedB) { - Constraint.solve(constraints[i], timeScale); - } + color[0] = ((value >> 16) & 0xFF) / 255; + color[1] = ((value >> 8) & 0xFF) / 255; + color[2] = (value & 0xFF) / 255; } - }; - - /** - * Solves a distance constraint with Gauss-Siedel method. - * @private - * @method solve - * @param {constraint} constraint - * @param {number} timeScale - */ - Constraint.solve = function(constraint, timeScale) { - var bodyA = constraint.bodyA, - bodyB = constraint.bodyB, - pointA = constraint.pointA, - pointB = constraint.pointB; - if (!bodyA && !bodyB) - return; + } - // update reference angle - if (bodyA && !bodyA.isStatic) { - Vector.rotate(pointA, bodyA.angle - constraint.angleA, pointA); - constraint.angleA = bodyA.angle; - } - - // update reference angle - if (bodyB && !bodyB.isStatic) { - Vector.rotate(pointB, bodyB.angle - constraint.angleB, pointB); - constraint.angleB = bodyB.angle; - } +}); - var pointAWorld = pointA, - pointBWorld = pointB; +module.exports = Bloom; - if (bodyA) pointAWorld = Vector.add(bodyA.position, pointA); - if (bodyB) pointBWorld = Vector.add(bodyB.position, pointB); - if (!pointAWorld || !pointBWorld) - return; +/***/ }), - var delta = Vector.sub(pointAWorld, pointBWorld), - currentLength = Vector.magnitude(delta); +/***/ 51498: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // prevent singularity - if (currentLength < Constraint._minLength) { - currentLength = Constraint._minLength; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // solve distance constraint with Gauss-Siedel method - var difference = (currentLength - constraint.length) / currentLength, - stiffness = constraint.stiffness < 1 ? constraint.stiffness * timeScale : constraint.stiffness, - force = Vector.mult(delta, difference * stiffness), - massTotal = (bodyA ? bodyA.inverseMass : 0) + (bodyB ? bodyB.inverseMass : 0), - inertiaTotal = (bodyA ? bodyA.inverseInertia : 0) + (bodyB ? bodyB.inverseInertia : 0), - resistanceTotal = massTotal + inertiaTotal, - torque, - share, - normal, - normalVelocity, - relativeVelocity; +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); - if (constraint.damping) { - var zero = Vector.create(); - normal = Vector.div(delta, currentLength); +/** + * @classdesc + * The Blur FX Controller. + * + * This FX controller manages the blur effect for a Game Object. + * + * A Gaussian blur is the result of blurring an image by a Gaussian function. It is a widely used effect, + * typically to reduce image noise and reduce detail. The visual effect of this blurring technique is a + * smooth blur resembling that of viewing the image through a translucent screen, distinctly different + * from the bokeh effect produced by an out-of-focus lens or the shadow of an object under usual illumination. + * + * A Blur effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.preFX.addBlur(); + * sprite.postFX.addBlur(); + * ``` + * + * @class Blur + * @extends Phaser.FX.Controller + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {number} [quality=0] - The quality of the blur effect. Can be either 0 for Low Quality, 1 for Medium Quality or 2 for High Quality. + * @param {number} [x=2] - The horizontal offset of the blur effect. + * @param {number} [y=2] - The vertical offset of the blur effect. + * @param {number} [strength=1] - The strength of the blur effect. + * @param {number} [color=0xffffff] - The color of the blur, as a hex value. + * @param {number} [steps=4] - The number of steps to run the blur effect for. This value should always be an integer. + */ +var Blur = new Class({ - relativeVelocity = Vector.sub( - bodyB && Vector.sub(bodyB.position, bodyB.positionPrev) || zero, - bodyA && Vector.sub(bodyA.position, bodyA.positionPrev) || zero - ); + Extends: Controller, - normalVelocity = Vector.dot(normal, relativeVelocity); - } + initialize: - if (bodyA && !bodyA.isStatic) { - share = bodyA.inverseMass / massTotal; + function Blur (gameObject, quality, x, y, strength, color, steps) + { + if (quality === undefined) { quality = 0; } + if (x === undefined) { x = 2; } + if (y === undefined) { y = 2; } + if (strength === undefined) { strength = 1; } + if (steps === undefined) { steps = 4; } - // keep track of applied impulses for post solving - bodyA.constraintImpulse.x -= force.x * share; - bodyA.constraintImpulse.y -= force.y * share; + Controller.call(this, FX_CONST.BLUR, gameObject); - // apply forces - bodyA.position.x -= force.x * share; - bodyA.position.y -= force.y * share; + /** + * The quality of the blur effect. + * + * This can be: + * + * 0 for Low Quality + * 1 for Medium Quality + * 2 for High Quality + * + * The higher the quality, the more complex shader is used + * and the more processing time is spent on the GPU calculating + * the final blur. This value is used in conjunction with the + * `steps` value, as one has a direct impact on the other. + * + * Keep this value as low as you can, while still achieving the + * desired effect you need for your game. + * + * @name Phaser.FX.Blur#quality + * @type {number} + * @since 3.60.0 + */ + this.quality = 0; - // apply damping - if (constraint.damping) { - bodyA.positionPrev.x -= constraint.damping * normal.x * normalVelocity * share; - bodyA.positionPrev.y -= constraint.damping * normal.y * normalVelocity * share; - } + /** + * The horizontal offset of the blur effect. + * + * @name Phaser.FX.Blur#x + * @type {number} + * @since 3.60.0 + */ + this.x = x; - // apply torque - torque = (Vector.cross(pointA, force) / resistanceTotal) * Constraint._torqueDampen * bodyA.inverseInertia * (1 - constraint.angularStiffness); - bodyA.constraintImpulse.angle -= torque; - bodyA.angle -= torque; - } + /** + * The vertical offset of the blur effect. + * + * @name Phaser.FX.Blur#y + * @type {number} + * @since 3.60.0 + */ + this.y = y; - if (bodyB && !bodyB.isStatic) { - share = bodyB.inverseMass / massTotal; + /** + * The number of steps to run the Blur effect for. + * + * This value should always be an integer. + * + * It defaults to 4. The higher the value, the smoother the blur, + * but at the cost of exponentially more gl operations. + * + * Keep this to the lowest possible number you can have it, while + * still looking correct for your game. + * + * @name Phaser.FX.Blur#steps + * @type {number} + * @since 3.60.0 + */ + this.steps = steps; - // keep track of applied impulses for post solving - bodyB.constraintImpulse.x += force.x * share; - bodyB.constraintImpulse.y += force.y * share; - - // apply forces - bodyB.position.x += force.x * share; - bodyB.position.y += force.y * share; + /** + * The strength of the blur effect. + * + * @name Phaser.FX.Blur#strength + * @type {number} + * @since 3.60.0 + */ + this.strength = strength; - // apply damping - if (constraint.damping) { - bodyB.positionPrev.x += constraint.damping * normal.x * normalVelocity * share; - bodyB.positionPrev.y += constraint.damping * normal.y * normalVelocity * share; - } + /** + * The internal gl color array. + * + * @name Phaser.FX.Blur#glcolor + * @type {number[]} + * @since 3.60.0 + */ + this.glcolor = [ 1, 1, 1 ]; - // apply torque - torque = (Vector.cross(pointB, force) / resistanceTotal) * Constraint._torqueDampen * bodyB.inverseInertia * (1 - constraint.angularStiffness); - bodyB.constraintImpulse.angle += torque; - bodyB.angle += torque; + if (color !== undefined && color !== null) + { + this.color = color; } - - }; + }, /** - * Performs body updates required after solving constraints. - * @private - * @method postSolveAll - * @param {body[]} bodies + * The color of the blur as a number value. + * + * @name Phaser.FX.Blur#color + * @type {number} + * @since 3.60.0 */ - Constraint.postSolveAll = function(bodies) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - impulse = body.constraintImpulse; - - if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) { - continue; - } - - Sleeping.set(body, false); - - // update geometry and reset - for (var j = 0; j < body.parts.length; j++) { - var part = body.parts[j]; - - Vertices.translate(part.vertices, impulse); + color: { - if (j > 0) { - part.position.x += impulse.x; - part.position.y += impulse.y; - } + get: function () + { + var color = this.glcolor; - if (impulse.angle !== 0) { - Vertices.rotate(part.vertices, impulse.angle, body.position); - Axes.rotate(part.axes, impulse.angle); - if (j > 0) { - Vector.rotateAbout(part.position, impulse.angle, body.position, part.position); - } - } + return (((color[0] * 255) << 16) + ((color[1] * 255) << 8) + (color[2] * 255 | 0)); + }, - Bounds.update(part.bounds, part.vertices, body.velocity); - } + set: function (value) + { + var color = this.glcolor; - // dampen the cached impulse for warming next step - impulse.angle *= Constraint._warming; - impulse.x *= Constraint._warming; - impulse.y *= Constraint._warming; + color[0] = ((value >> 16) & 0xFF) / 255; + color[1] = ((value >> 8) & 0xFF) / 255; + color[2] = (value & 0xFF) / 255; } - }; - /** - * Returns the world-space position of `constraint.pointA`, accounting for `constraint.bodyA`. - * @method pointAWorld - * @param {constraint} constraint - * @returns {vector} the world-space position - */ - Constraint.pointAWorld = function(constraint) { - return { - x: (constraint.bodyA ? constraint.bodyA.position.x : 0) + constraint.pointA.x, - y: (constraint.bodyA ? constraint.bodyA.position.y : 0) + constraint.pointA.y - }; - }; + } - /** - * Returns the world-space position of `constraint.pointB`, accounting for `constraint.bodyB`. - * @method pointBWorld - * @param {constraint} constraint - * @returns {vector} the world-space position - */ - Constraint.pointBWorld = function(constraint) { - return { - x: (constraint.bodyB ? constraint.bodyB.position.x : 0) + constraint.pointB.x, - y: (constraint.bodyB ? constraint.bodyB.position.y : 0) + constraint.pointB.y - }; - }; +}); - /* - * - * Properties Documentation - * - */ +module.exports = Blur; - /** - * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. - * - * @property id - * @type number - */ - /** - * A `String` denoting the type of object. - * - * @property type - * @type string - * @default "constraint" - * @readOnly - */ +/***/ }), - /** - * An arbitrary `String` name to help the user identify and manage bodies. - * - * @property label - * @type string - * @default "Constraint" - */ +/***/ 12042: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. - * - * @property render - * @type object - */ +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * A flag that indicates if the constraint should be rendered. - * - * @property render.visible - * @type boolean - * @default true - */ +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); - /** - * A `Number` that defines the line width to use when rendering the constraint outline. - * A value of `0` means no outline will be rendered. - * - * @property render.lineWidth - * @type number - * @default 2 - */ +/** + * @classdesc + * The Bokeh FX Controller. + * + * This FX controller manages the bokeh effect for a Game Object. + * + * Bokeh refers to a visual effect that mimics the photographic technique of creating a shallow depth of field. + * This effect is used to emphasize the game's main subject or action, by blurring the background or foreground + * elements, resulting in a more immersive and visually appealing experience. It is achieved through rendering + * techniques that simulate the out-of-focus areas, giving a sense of depth and realism to the game's graphics. + * + * This effect can also be used to generate a Tilt Shift effect, which is a technique used to create a miniature + * effect by blurring everything except a small area of the image. This effect is achieved by blurring the + * top and bottom elements, while keeping the center area in focus. + * + * A Bokeh effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.preFX.addBokeh(); + * sprite.postFX.addBokeh(); + * ``` + * + * @class Bokeh + * @extends Phaser.FX.Controller + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {number} [radius=0.5] - The radius of the bokeh effect. + * @param {number} [amount=1] - The amount of the bokeh effect. + * @param {number} [contrast=0.2] - The color contrast of the bokeh effect. + * @param {boolean} [isTiltShift=false] - Is this a bokeh or Tile Shift effect? + * @param {number} [blurX=1] - If Tilt Shift, the amount of horizontal blur. + * @param {number} [blurY=1] - If Tilt Shift, the amount of vertical blur. + * @param {number} [strength=1] - If Tilt Shift, the strength of the blur. + */ +var Bokeh = new Class({ - /** - * A `String` that defines the stroke style to use when rendering the constraint outline. - * It is the same as when using a canvas, so it accepts CSS style property values. - * - * @property render.strokeStyle - * @type string - * @default a random colour - */ + Extends: Controller, - /** - * A `String` that defines the constraint rendering type. - * The possible values are 'line', 'pin', 'spring'. - * An appropriate render type will be automatically chosen unless one is given in options. - * - * @property render.type - * @type string - * @default 'line' - */ + initialize: - /** - * A `Boolean` that defines if the constraint's anchor points should be rendered. - * - * @property render.anchors - * @type boolean - * @default true - */ + function Bokeh (gameObject, radius, amount, contrast, isTiltShift, blurX, blurY, strength) + { + if (radius === undefined) { radius = 0.5; } + if (amount === undefined) { amount = 1; } + if (contrast === undefined) { contrast = 0.2; } + if (isTiltShift === undefined) { isTiltShift = false; } + if (blurX === undefined) { blurX = 1; } + if (blurY === undefined) { blurY = 1; } + if (strength === undefined) { strength = 1; } - /** - * The first possible `Body` that this constraint is attached to. - * - * @property bodyA - * @type body - * @default null - */ + Controller.call(this, FX_CONST.BOKEH, gameObject); - /** - * The second possible `Body` that this constraint is attached to. - * - * @property bodyB - * @type body - * @default null - */ + /** + * The radius of the bokeh effect. + * + * This is a float value, where a radius of 0 will result in no effect being applied, + * and a radius of 1 will result in a strong bokeh. However, you can exceed this value + * for even stronger effects. + * + * @name Phaser.FX.Bokeh#radius + * @type {number} + * @since 3.60.0 + */ + this.radius = radius; - /** - * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. - * - * @property pointA - * @type vector - * @default { x: 0, y: 0 } - */ + /** + * The amount, or strength, of the bokeh effect. Defaults to 1. + * + * @name Phaser.FX.Bokeh#amount + * @type {number} + * @since 3.60.0 + */ + this.amount = amount; - /** - * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyB` if defined, otherwise a world-space position. - * - * @property pointB - * @type vector - * @default { x: 0, y: 0 } - */ + /** + * The color contrast, or brightness, of the bokeh effect. Defaults to 0.2. + * + * @name Phaser.FX.Bokeh#contrast + * @type {number} + * @since 3.60.0 + */ + this.contrast = contrast; - /** - * A `Number` that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. - * A value of `1` means the constraint should be very stiff. - * A value of `0.2` means the constraint acts like a soft spring. - * - * @property stiffness - * @type number - * @default 1 - */ + /** + * Is this a Tilt Shift effect or a standard bokeh effect? + * + * @name Phaser.FX.Bokeh#isTiltShift + * @type {boolean} + * @since 3.60.0 + */ + this.isTiltShift = isTiltShift; - /** - * A `Number` that specifies the damping of the constraint, - * i.e. the amount of resistance applied to each body based on their velocities to limit the amount of oscillation. - * Damping will only be apparent when the constraint also has a very low `stiffness`. - * A value of `0.1` means the constraint will apply heavy damping, resulting in little to no oscillation. - * A value of `0` means the constraint will apply no damping. - * - * @property damping - * @type number - * @default 0 - */ + /** + * If a Tilt Shift effect this controls the strength of the blur. + * + * Setting this value on a non-Tilt Shift effect will have no effect. + * + * @name Phaser.FX.Bokeh#strength + * @type {number} + * @since 3.60.0 + */ + this.strength = strength; - /** - * A `Number` that specifies the target resting length of the constraint. - * It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. - * - * @property length - * @type number - */ + /** + * If a Tilt Shift effect this controls the amount of horizontal blur. + * + * Setting this value on a non-Tilt Shift effect will have no effect. + * + * @name Phaser.FX.Bokeh#blurX + * @type {number} + * @since 3.60.0 + */ + this.blurX = blurX; - /** - * An object reserved for storing plugin-specific properties. - * - * @property plugin - * @type {} - */ + /** + * If a Tilt Shift effect this controls the amount of vertical blur. + * + * Setting this value on a non-Tilt Shift effect will have no effect. + * + * @name Phaser.FX.Bokeh#blurY + * @type {number} + * @since 3.60.0 + */ + this.blurY = blurY; + } -})(); +}); + +module.exports = Bokeh; /***/ }), -/* 129 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 69900: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlendModes = __webpack_require__(35); -var Circle = __webpack_require__(65); -var CircleContains = __webpack_require__(66); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(15); -var Rectangle = __webpack_require__(10); -var RectangleContains = __webpack_require__(57); +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); /** * @classdesc - * A Zone Game Object. + * The Circle FX Controller. * - * A Zone is a non-rendering rectangular Game Object that has a position and size. - * It has no texture and never displays, but does live on the display list and - * can be moved, scaled and rotated like any other Game Object. + * This FX controller manages the circle effect for a Game Object. * - * Its primary use is for creating Drop Zones and Input Hit Areas and it has a couple of helper methods - * specifically for this. It is also useful for object overlap checks, or as a base for your own - * non-displaying Game Objects. - - * The default origin is 0.5, the center of the Zone, the same as with Game Objects. + * This effect will draw a circle around the texture of the Game Object, effectively masking off + * any area outside of the circle without the need for an actual mask. You can control the thickness + * of the circle, the color of the circle and the color of the background, should the texture be + * transparent. You can also control the feathering applied to the circle, allowing for a harsh or soft edge. * - * @class Zone - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor - * @since 3.0.0 + * Please note that adding this effect to a Game Object will not change the input area or physics body of + * the Game Object, should it have one. * - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Visible + * A Circle effect is added to a Game Object via the FX component: * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {number} [width=1] - The width of the Game Object. - * @param {number} [height=1] - The height of the Game Object. + * ```js + * const sprite = this.add.sprite(); + * + * sprite.preFX.addCircle(); + * sprite.postFX.addCircle(); + * ``` + * + * @class Circle + * @extends Phaser.FX.Controller + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {number} [thickness=8] - The width of the circle around the texture, in pixels. + * @param {number} [color=0xfeedb6] - The color of the circular ring, given as a number value. + * @param {number} [backgroundColor=0xff0000] - The color of the background, behind the texture, given as a number value. + * @param {number} [scale=1] - The scale of the circle. The default scale is 1, which is a circle the full size of the underlying texture. + * @param {number} [feather=0.005] - The amount of feathering to apply to the circle from the ring. */ -var Zone = new Class({ - - Extends: GameObject, +var Circle = new Class({ - Mixins: [ - Components.Depth, - Components.GetBounds, - Components.Origin, - Components.Transform, - Components.ScrollFactor, - Components.Visible - ], + Extends: Controller, initialize: - function Zone (scene, x, y, width, height) + function Circle (gameObject, thickness, color, backgroundColor, scale, feather) { - if (width === undefined) { width = 1; } - if (height === undefined) { height = width; } - - GameObject.call(this, scene, 'Zone'); + if (thickness === undefined) { thickness = 8; } + if (scale === undefined) { scale = 1; } + if (feather === undefined) { feather = 0.005; } - this.setPosition(x, y); + Controller.call(this, FX_CONST.CIRCLE, gameObject); /** - * The native (un-scaled) width of this Game Object. + * The scale of the circle. The default scale is 1, which is a circle + * the full size of the underlying texture. Reduce this value to create + * a smaller circle, or increase it to create a circle that extends off + * the edges of the texture. * - * @name Phaser.GameObjects.Zone#width + * @name Phaser.FX.Circle#scale * @type {number} - * @since 3.0.0 + * @since 3.60.0 */ - this.width = width; + this.scale = scale; /** - * The native (un-scaled) height of this Game Object. + * The amount of feathering to apply to the circle from the ring, + * extending into the middle of the circle. The default is 0.005, + * which is a very low amount of feathering just making sure the ring + * has a smooth edge. Increase this amount to a value such as 0.5 + * or 0.025 for larger amounts of feathering. * - * @name Phaser.GameObjects.Zone#height + * @name Phaser.FX.Circle#feather * @type {number} - * @since 3.0.0 + * @since 3.60.0 */ - this.height = height; + this.feather = feather; /** - * The Blend Mode of the Game Object. - * Although a Zone never renders, it still has a blend mode to allow it to fit seamlessly into - * display lists without causing a batch flush. + * The width of the circle around the texture, in pixels. This value + * doesn't factor in the feather, which can extend the thickness + * internally depending on its value. * - * @name Phaser.GameObjects.Zone#blendMode + * @name Phaser.FX.Circle#thickness * @type {number} - * @since 3.0.0 + * @since 3.60.0 */ - this.blendMode = BlendModes.NORMAL; + this.thickness = thickness; - this.updateDisplayOrigin(); + /** + * The internal gl color array for the ring color. + * + * @name Phaser.FX.Circle#glcolor + * @type {number[]} + * @since 3.60.0 + */ + this.glcolor = [ 1, 0.2, 0.7 ]; + + /** + * The internal gl color array for the background color. + * + * @name Phaser.FX.Circle#glcolor2 + * @type {number[]} + * @since 3.60.0 + */ + this.glcolor2 = [ 1, 0, 0, 0.4 ]; + + if (color !== undefined && color !== null) + { + this.color = color; + } + + if (backgroundColor !== undefined && backgroundColor !== null) + { + this.backgroundColor = backgroundColor; + } }, /** - * The displayed width of this Game Object. - * This value takes into account the scale factor. + * The color of the circular ring, given as a number value. * - * @name Phaser.GameObjects.Zone#displayWidth + * @name Phaser.FX.Circle#color * @type {number} - * @since 3.0.0 + * @since 3.60.0 */ - displayWidth: { + color: { get: function () { - return this.scaleX * this.width; + var color = this.glcolor; + + return (((color[0] * 255) << 16) + ((color[1] * 255) << 8) + (color[2] * 255 | 0)); }, set: function (value) { - this.scaleX = value / this.width; + var color = this.glcolor; + + color[0] = ((value >> 16) & 0xFF) / 255; + color[1] = ((value >> 8) & 0xFF) / 255; + color[2] = (value & 0xFF) / 255; } }, /** - * The displayed height of this Game Object. - * This value takes into account the scale factor. + * The color of the background, behind the texture, given as a number value. * - * @name Phaser.GameObjects.Zone#displayHeight + * @name Phaser.FX.Circle#backgroundColor * @type {number} - * @since 3.0.0 + * @since 3.60.0 */ - displayHeight: { + backgroundColor: { get: function () { - return this.scaleY * this.height; + var color = this.glcolor2; + + return (((color[0] * 255) << 16) + ((color[1] * 255) << 8) + (color[2] * 255 | 0)); }, set: function (value) { - this.scaleY = value / this.height; + var color = this.glcolor2; + + color[0] = ((value >> 16) & 0xFF) / 255; + color[1] = ((value >> 8) & 0xFF) / 255; + color[2] = (value & 0xFF) / 255; } - }, + } - /** - * Sets the size of this Game Object. - * - * @method Phaser.GameObjects.Zone#setSize - * @since 3.0.0 - * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. - * @param {boolean} [resizeInput=true] - If this Zone has a Rectangle for a hit area this argument will resize the hit area as well. - * - * @return {this} This Game Object. - */ - setSize: function (width, height, resizeInput) - { - if (resizeInput === undefined) { resizeInput = true; } +}); - this.width = width; - this.height = height; +module.exports = Circle; - this.updateDisplayOrigin(); - var input = this.input; +/***/ }), - if (resizeInput && input && !input.customHitArea) - { - input.hitArea.width = width; - input.hitArea.height = height; - } +/***/ 48991: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets the display size of this Game Object. - * Calling this will adjust the scale. - * - * @method Phaser.GameObjects.Zone#setDisplaySize - * @since 3.0.0 - * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. - * - * @return {this} This Game Object. - */ - setDisplaySize: function (width, height) +var Class = __webpack_require__(56694); +var BaseColorMatrix = __webpack_require__(65246); +var FX_CONST = __webpack_require__(47406); + +/** + * @classdesc + * The ColorMatrix FX Controller. + * + * This FX controller manages the color matrix effect for a Game Object. + * + * The color matrix effect is a visual technique that involves manipulating the colors of an image + * or scene using a mathematical matrix. This process can adjust hue, saturation, brightness, and contrast, + * allowing developers to create various stylistic appearances or mood settings within the game. + * Common applications include simulating different lighting conditions, applying color filters, + * or achieving a specific visual style. + * + * A ColorMatrix effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.preFX.addColorMatrix(); + * sprite.postFX.addColorMatrix(); + * ``` + * + * @class ColorMatrix + * @extends Phaser.Display.ColorMatrix + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + */ +var ColorMatrix = new Class({ + + Extends: BaseColorMatrix, + + initialize: + + function ColorMatrix (gameObject) { - this.displayWidth = width; - this.displayHeight = height; + BaseColorMatrix.call(this); - return this; - }, + /** + * The FX_CONST type of this effect. + * + * @name Phaser.FX.ColorMatrix#type + * @type {number} + * @since 3.60.0 + */ + this.type = FX_CONST.COLOR_MATRIX; - /** - * Sets this Zone to be a Circular Drop Zone. - * The circle is centered on this Zones `x` and `y` coordinates. - * - * @method Phaser.GameObjects.Zone#setCircleDropZone - * @since 3.0.0 - * - * @param {number} radius - The radius of the Circle that will form the Drop Zone. - * - * @return {this} This Game Object. - */ - setCircleDropZone: function (radius) - { - return this.setDropZone(new Circle(0, 0, radius), CircleContains); - }, + /** + * A reference to the Game Object that owns this effect. + * + * @name Phaser.FX.ColorMatrix#gameObject + * @type {Phaser.GameObjects.GameObject} + * @since 3.60.0 + */ + this.gameObject = gameObject; - /** - * Sets this Zone to be a Rectangle Drop Zone. - * The rectangle is centered on this Zones `x` and `y` coordinates. - * - * @method Phaser.GameObjects.Zone#setRectangleDropZone - * @since 3.0.0 - * - * @param {number} width - The width of the rectangle drop zone. - * @param {number} height - The height of the rectangle drop zone. - * - * @return {this} This Game Object. - */ - setRectangleDropZone: function (width, height) - { - return this.setDropZone(new Rectangle(0, 0, width, height), RectangleContains); + /** + * Toggle this boolean to enable or disable this effect, + * without removing and adding it from the Game Object. + * + * @name Phaser.FX.ColorMatrix#active + * @type {boolean} + * @since 3.60.0 + */ + this.active = true; }, - /** - * Allows you to define your own Geometry shape to be used as a Drop Zone. - * - * @method Phaser.GameObjects.Zone#setDropZone - * @since 3.0.0 - * - * @param {object} hitArea - A Geometry shape instance, such as Phaser.Geom.Ellipse, or your own custom shape. - * @param {Phaser.Types.Input.HitAreaCallback} hitAreaCallback - A function that will return `true` if the given x/y coords it is sent are within the shape. - * - * @return {this} This Game Object. - */ - setDropZone: function (hitArea, hitAreaCallback) + destroy: function () { - if (hitArea === undefined) - { - this.setRectangleDropZone(this.width, this.height); - } - else if (!this.input) - { - this.setInteractive(hitArea, hitAreaCallback, true); - } + this.gameObject = null; + this._matrix = null; + this._data = null; + } - return this; - }, +}); - /** - * A NOOP method so you can pass a Zone to a Container. - * Calling this method will do nothing. It is intentionally empty. - * - * @method Phaser.GameObjects.Zone#setAlpha - * @private - * @since 3.11.0 - */ - setAlpha: function () - { - }, +module.exports = ColorMatrix; - /** - * A NOOP method so you can pass a Zone to a Container in Canvas. - * Calling this method will do nothing. It is intentionally empty. - * - * @method Phaser.GameObjects.Zone#setBlendMode - * @private - * @since 3.16.2 - */ - setBlendMode: function () + +/***/ }), + +/***/ 47551: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); + +/** + * @classdesc + * FX Controller is the base class that all built-in FX use. + * + * You should not normally create an instance of this class directly, but instead use one of the built-in FX that extend it. + * + * @class Controller + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {number} type - The FX Type constant. + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + */ +var Controller = new Class({ + + initialize: + + function Controller (type, gameObject) { + /** + * The FX_CONST type of this effect. + * + * @name Phaser.FX.Controller#type + * @type {number} + * @since 3.60.0 + */ + this.type = type; + + /** + * A reference to the Game Object that owns this effect. + * + * @name Phaser.FX.Controller#gameObject + * @type {Phaser.GameObjects.GameObject} + * @since 3.60.0 + */ + this.gameObject = gameObject; + + /** + * Toggle this boolean to enable or disable this effect, + * without removing and adding it from the Game Object. + * + * Only works for Pre FX. + * + * Post FX are always active. + * + * @name Phaser.FX.Controller#active + * @type {boolean} + * @since 3.60.0 + */ + this.active = true; }, /** - * A Zone does not render. + * Sets the active state of this FX Controller. * - * @method Phaser.GameObjects.Zone#renderCanvas - * @private - * @since 3.53.0 + * A disabled FX Controller will not be updated. * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @method Phaser.FX.Controller#setActive + * @since 3.60.0 + * + * @param {boolean} value - `true` to enable this FX Controller, or `false` to disable it. + * + * @return {this} This FX Controller instance. */ - renderCanvas: function (renderer, src, camera) + setActive: function (value) { - camera.addToRenderList(src); + this.active = value; + + return this; }, /** - * A Zone does not render. - * - * @method Phaser.GameObjects.Zone#renderWebGL - * @private - * @since 3.53.0 + * Destroys this FX Controller. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @method Phaser.FX.Controller#destroy + * @since 3.60.0 */ - renderWebGL: function (renderer, src, camera) + destroy: function () { - camera.addToRenderList(src); + this.gameObject = null; + this.active = false; } }); -module.exports = Zone; +module.exports = Controller; /***/ }), -/* 130 */ -/***/ (function(module, exports) { + +/***/ 47909: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); + /** - * Calculates the perimeter of a Rectangle. + * @classdesc + * The Displacement FX Controller. * - * @function Phaser.Geom.Rectangle.Perimeter - * @since 3.0.0 + * This FX controller manages the displacement effect for a Game Object. * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to use. + * The displacement effect is a visual technique that alters the position of pixels in an image + * or texture based on the values of a displacement map. This effect is used to create the illusion + * of depth, surface irregularities, or distortion in otherwise flat elements. It can be applied to + * characters, objects, or backgrounds to enhance realism, convey movement, or achieve various + * stylistic appearances. * - * @return {number} The perimeter of the Rectangle, equal to `(width * 2) + (height * 2)`. + * A Displacement effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.preFX.addDisplacement(); + * sprite.postFX.addDisplacement(); + * ``` + * + * @class Displacement + * @extends Phaser.FX.Controller + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {string} [texture='__WHITE'] - The unique string-based key of the texture to use for displacement, which must exist in the Texture Manager. + * @param {number} [x=0.005] - The amount of horizontal displacement to apply. A very small float number, such as 0.005. + * @param {number} [y=0.005] - The amount of vertical displacement to apply. A very small float number, such as 0.005. */ -var Perimeter = function (rect) -{ - return 2 * (rect.width + rect.height); -}; +var Displacement = new Class({ -module.exports = Perimeter; + Extends: Controller, + + initialize: + + function Displacement (gameObject, texture, x, y) + { + if (texture === undefined) { texture = '__WHITE'; } + if (x === undefined) { x = 0.005; } + if (y === undefined) { y = 0.005; } + + Controller.call(this, FX_CONST.DISPLACEMENT, gameObject); + + /** + * The amount of horizontal displacement to apply. + * + * @name Phaser.FX.Displacement#x + * @type {number} + * @since 3.60.0 + */ + this.x = x; + + /** + * The amount of vertical displacement to apply. + * + * @name Phaser.FX.Displacement#y + * @type {number} + * @since 3.60.0 + */ + this.y = y; + + /** + * The underlying WebGLTexture used for displacement. + * + * @name Phaser.FX.Displacement#glTexture + * @type {WebGLTexture} + * @since 3.60.0 + */ + this.glTexture; + + this.setTexture(texture); + }, + + /** + * Sets the Texture to be used for the displacement effect. + * + * You can only use a whole texture, not a frame from a texture atlas or sprite sheet. + * + * @method Phaser.GameObjects.Components.FX#setTexture + * @since 3.60.0 + * + * @param {string} [texture='__WHITE'] - The unique string-based key of the texture to use for displacement, which must exist in the Texture Manager. + * + * @return {this} This FX Controller. + */ + setTexture: function (texture) + { + var phaserTexture = this.gameObject.scene.sys.textures.getFrame(texture); + + if (phaserTexture) + { + this.glTexture = phaserTexture.glTexture; + } + + return this; + } + +}); + +module.exports = Displacement; /***/ }), -/* 131 */ -/***/ (function(module, exports) { + +/***/ 18919: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); + /** - * Shuffles the contents of the given array using the Fisher-Yates implementation. + * @classdesc + * The Glow FX Controller. * - * The original array is modified directly and returned. + * This FX controller manages the glow effect for a Game Object. * - * @function Phaser.Utils.Array.Shuffle - * @since 3.0.0 + * The glow effect is a visual technique that creates a soft, luminous halo around game objects, + * characters, or UI elements. This effect is used to emphasize importance, enhance visual appeal, + * or convey a sense of energy, magic, or otherworldly presence. The effect can also be set on + * the inside of the Game Object. The color and strength of the glow can be modified. * - * @generic T - * @genericUse {T[]} - [array,$return] + * A Glow effect is added to a Game Object via the FX component: * - * @param {T[]} array - The array to shuffle. This array is modified in place. + * ```js + * const sprite = this.add.sprite(); * - * @return {T[]} The shuffled array. + * sprite.preFX.addGlow(); + * sprite.postFX.addGlow(); + * ``` + * + * @class Glow + * @extends Phaser.FX.Controller + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {number} [color=0xffffff] - The color of the glow effect as a number value. + * @param {number} [outerStrength=4] - The strength of the glow outward from the edge of the Sprite. + * @param {number} [innerStrength=0] - The strength of the glow inward from the edge of the Sprite. + * @param {boolean} [knockout=false] - If `true` only the glow is drawn, not the texture itself. */ -var Shuffle = function (array) -{ - for (var i = array.length - 1; i > 0; i--) +var Glow = new Class({ + + Extends: Controller, + + initialize: + + function Glow (gameObject, color, outerStrength, innerStrength, knockout) { - var j = Math.floor(Math.random() * (i + 1)); - var temp = array[i]; - array[i] = array[j]; - array[j] = temp; - } + if (outerStrength === undefined) { outerStrength = 4; } + if (innerStrength === undefined) { innerStrength = 0; } + if (knockout === undefined) { knockout = false; } - return array; -}; + Controller.call(this, FX_CONST.GLOW, gameObject); -module.exports = Shuffle; + /** + * The strength of the glow outward from the edge of the Sprite. + * + * @name Phaser.FX.Glow#outerStrength + * @type {number} + * @since 3.60.0 + */ + this.outerStrength = outerStrength; + /** + * The strength of the glow inward from the edge of the Sprite. + * + * @name Phaser.FX.Glow#innerStrength + * @type {number} + * @since 3.60.0 + */ + this.innerStrength = innerStrength; -/***/ }), -/* 132 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * If `true` only the glow is drawn, not the texture itself. + * + * @name Phaser.FX.Glow#knockout + * @type {number} + * @since 3.60.0 + */ + this.knockout = knockout; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A 4 element array of gl color values. + * + * @name Phaser.FX.Glow#glcolor + * @type {number[]} + * @since 3.60.0 + */ + this.glcolor = [ 1, 1, 1, 1 ]; -/** - * @namespace Phaser.Animations.Events - */ + if (color !== undefined) + { + this.color = color; + } + }, -module.exports = { + /** + * The color of the glow as a number value. + * + * @name Phaser.FX.Glow#color + * @type {number} + * @since 3.60.0 + */ + color: { + + get: function () + { + var color = this.glcolor; - ADD_ANIMATION: __webpack_require__(724), - ANIMATION_COMPLETE: __webpack_require__(725), - ANIMATION_COMPLETE_KEY: __webpack_require__(726), - ANIMATION_REPEAT: __webpack_require__(727), - ANIMATION_RESTART: __webpack_require__(728), - ANIMATION_START: __webpack_require__(729), - ANIMATION_STOP: __webpack_require__(730), - ANIMATION_UPDATE: __webpack_require__(731), - PAUSE_ALL: __webpack_require__(732), - REMOVE_ANIMATION: __webpack_require__(733), - RESUME_ALL: __webpack_require__(734) + return (((color[0] * 255) << 16) + ((color[1] * 255) << 8) + (color[2] * 255 | 0)); + }, -}; + set: function (value) + { + var color = this.glcolor; + + color[0] = ((value >> 16) & 0xFF) / 255; + color[1] = ((value >> 8) & 0xFF) / 255; + color[2] = (value & 0xFF) / 255; + } + + } + +}); + +module.exports = Glow; /***/ }), -/* 133 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 62494: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var DegToRad = __webpack_require__(36); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(37); -var Rectangle = __webpack_require__(10); -var TransformMatrix = __webpack_require__(25); -var ValueToColor = __webpack_require__(187); -var Vector2 = __webpack_require__(3); +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); /** * @classdesc - * A Base Camera class. - * - * The Camera is the way in which all games are rendered in Phaser. They provide a view into your game world, - * and can be positioned, rotated, zoomed and scrolled accordingly. - * - * A Camera consists of two elements: The viewport and the scroll values. + * The Gradient FX Controller. * - * The viewport is the physical position and size of the Camera within your game. Cameras, by default, are - * created the same size as your game, but their position and size can be set to anything. This means if you - * wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game, - * you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`). + * This FX controller manages the gradient effect for a Game Object. * - * If you wish to change where the Camera is looking in your game, then you scroll it. You can do this - * via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the - * viewport, and changing the viewport has no impact on the scrolling. + * The gradient overlay effect is a visual technique where a smooth color transition is applied over Game Objects, + * such as sprites or UI components. This effect is used to enhance visual appeal, emphasize depth, or create + * stylistic and atmospheric variations. It can also be utilized to convey information, such as representing + * progress or health status through color changes. * - * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, - * allowing you to filter Game Objects out on a per-Camera basis. + * A Gradient effect is added to a Game Object via the FX component: * - * The Base Camera is extended by the Camera class, which adds in special effects including Fade, - * Flash and Camera Shake, as well as the ability to follow Game Objects. + * ```js + * const sprite = this.add.sprite(); * - * The Base Camera was introduced in Phaser 3.12. It was split off from the Camera class, to allow - * you to isolate special effects as needed. Therefore the 'since' values for properties of this class relate - * to when they were added to the Camera class. + * sprite.preFX.addGradient(); + * sprite.postFX.addGradient(); + * ``` * - * @class BaseCamera - * @memberof Phaser.Cameras.Scene2D + * @class Gradient + * @extends Phaser.FX.Controller + * @memberof Phaser.FX * @constructor - * @since 3.12.0 - * - * @extends Phaser.Events.EventEmitter - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.Visible + * @since 3.60.0 * - * @param {number} x - The x position of the Camera, relative to the top-left of the game canvas. - * @param {number} y - The y position of the Camera, relative to the top-left of the game canvas. - * @param {number} width - The width of the Camera, in pixels. - * @param {number} height - The height of the Camera, in pixels. + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {number} [color1=0xff0000] - The first gradient color, given as a number value. + * @param {number} [color2=0x00ff00] - The second gradient color, given as a number value. + * @param {number} [alpha=0.2] - The alpha value of the gradient effect. + * @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. + * @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. + * @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. + * @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. + * @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect. */ -var BaseCamera = new Class({ +var Gradient = new Class({ - Extends: EventEmitter, - - Mixins: [ - Components.Alpha, - Components.Visible - ], + Extends: Controller, initialize: - function BaseCamera (x, y, width, height) + function Gradient (gameObject, color1, color2, alpha, fromX, fromY, toX, toY, size) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = 0; } - if (height === undefined) { height = 0; } + if (alpha === undefined) { alpha = 0.2; } + if (fromX === undefined) { fromX = 0; } + if (fromY === undefined) { fromY = 0; } + if (toX === undefined) { toX = 0; } + if (toY === undefined) { toY = 1; } + if (size === undefined) { size = 0; } - EventEmitter.call(this); + Controller.call(this, FX_CONST.GRADIENT, gameObject); /** - * A reference to the Scene this camera belongs to. + * The alpha value of the gradient effect. * - * @name Phaser.Cameras.Scene2D.BaseCamera#scene - * @type {Phaser.Scene} - * @since 3.0.0 + * @name Phaser.FX.Gradient#alpha + * @type {number} + * @since 3.60.0 */ - this.scene; + this.alpha = alpha; /** - * A reference to the Game Scene Manager. + * Sets how many 'chunks' the gradient is divided in to, as spread over the + * entire height of the texture. Leave this at zero for a smooth gradient, + * or set to a higher number to split the gradient into that many sections, giving + * a more banded 'retro' effect. * - * @name Phaser.Cameras.Scene2D.BaseCamera#sceneManager - * @type {Phaser.Scenes.SceneManager} - * @since 3.12.0 + * @name Phaser.FX.Gradient#size + * @type {number} + * @since 3.60.0 */ - this.sceneManager; + this.size = size; /** - * A reference to the Game Scale Manager. + * The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * - * @name Phaser.Cameras.Scene2D.BaseCamera#scaleManager - * @type {Phaser.Scale.ScaleManager} - * @since 3.16.0 + * @name Phaser.FX.Gradient#fromX + * @type {number} + * @since 3.60.0 */ - this.scaleManager; + this.fromX = fromX; /** - * A reference to the Scene's Camera Manager to which this Camera belongs. + * The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * - * @name Phaser.Cameras.Scene2D.BaseCamera#cameraManager - * @type {Phaser.Cameras.Scene2D.CameraManager} - * @since 3.17.0 + * @name Phaser.FX.Gradient#fromY + * @type {number} + * @since 3.60.0 */ - this.cameraManager; + this.fromY = fromY; /** - * The Camera ID. Assigned by the Camera Manager and used to handle camera exclusion. - * This value is a bitmask. + * The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels. * - * @name Phaser.Cameras.Scene2D.BaseCamera#id + * @name Phaser.FX.Gradient#toX * @type {number} - * @readonly - * @since 3.11.0 + * @since 3.60.0 */ - this.id = 0; + this.toX = toX; /** - * The name of the Camera. This is left empty for your own use. + * The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels. * - * @name Phaser.Cameras.Scene2D.BaseCamera#name - * @type {string} - * @default '' - * @since 3.0.0 + * @name Phaser.FX.Gradient#toY + * @type {number} + * @since 3.60.0 */ - this.name = ''; + this.toY = toY; /** - * Should this camera round its pixel values to integers? + * The internal gl color array for the starting color. * - * @name Phaser.Cameras.Scene2D.BaseCamera#roundPixels - * @type {boolean} - * @default false - * @since 3.0.0 + * @name Phaser.FX.Gradient#glcolor1 + * @type {number[]} + * @since 3.60.0 */ - this.roundPixels = false; + this.glcolor1 = [ 255, 0, 0 ]; /** - * Is this Camera visible or not? - * - * A visible camera will render and perform input tests. - * An invisible camera will not render anything and will skip input tests. + * The internal gl color array for the ending color. * - * @name Phaser.Cameras.Scene2D.BaseCamera#visible - * @type {boolean} - * @default true - * @since 3.10.0 + * @name Phaser.FX.Gradient#glcolor2 + * @type {number[]} + * @since 3.60.0 */ + this.glcolor2 = [ 0, 255, 0 ]; - /** - * Is this Camera using a bounds to restrict scrolling movement? - * - * Set this property along with the bounds via `Camera.setBounds`. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#useBounds - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.useBounds = false; + if (color1 !== undefined && color1 !== null) + { + this.color1 = color1; + } - /** - * The World View is a Rectangle that defines the area of the 'world' the Camera is currently looking at. - * This factors in the Camera viewport size, zoom and scroll position and is updated in the Camera preRender step. - * If you have enabled Camera bounds the worldview will be clamped to those bounds accordingly. - * You can use it for culling or intersection checks. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#worldView - * @type {Phaser.Geom.Rectangle} - * @readonly - * @since 3.11.0 - */ - this.worldView = new Rectangle(); + if (color2 !== undefined && color2 !== null) + { + this.color2 = color2; + } + }, - /** - * Is this Camera dirty? - * - * A dirty Camera has had either its viewport size, bounds, scroll, rotation or zoom levels changed since the last frame. - * - * This flag is cleared during the `postRenderCamera` method of the renderer. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#dirty - * @type {boolean} - * @default true - * @since 3.11.0 - */ - this.dirty = true; + /** + * The first gradient color, given as a number value. + * + * @name Phaser.FX.Gradient#color1 + * @type {number} + * @since 3.60.0 + */ + color1: { + + get: function () + { + var color = this.glcolor1; + + return (((color[0]) << 16) + ((color[1]) << 8) + (color[2] | 0)); + }, + + set: function (value) + { + var color = this.glcolor1; + + color[0] = ((value >> 16) & 0xFF); + color[1] = ((value >> 8) & 0xFF); + color[2] = (value & 0xFF); + } + + }, + + /** + * The second gradient color, given as a number value. + * + * @name Phaser.FX.Gradient#color2 + * @type {number} + * @since 3.60.0 + */ + color2: { + + get: function () + { + var color = this.glcolor2; + + return (((color[0]) << 16) + ((color[1]) << 8) + (color[2] | 0)); + }, + + set: function (value) + { + var color = this.glcolor2; + + color[0] = ((value >> 16) & 0xFF); + color[1] = ((value >> 8) & 0xFF); + color[2] = (value & 0xFF); + } + + } + +}); + +module.exports = Gradient; + + +/***/ }), + +/***/ 68897: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); + +/** + * @classdesc + * The Pixelate FX Controller. + * + * This FX controller manages the pixelate effect for a Game Object. + * + * The pixelate effect is a visual technique that deliberately reduces the resolution or detail of an image, + * creating a blocky or mosaic appearance composed of large, visible pixels. This effect can be used for stylistic + * purposes, as a homage to retro gaming, or as a means to obscure certain elements within the game, such as + * during a transition or to censor specific content. + * + * A Pixelate effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.preFX.addPixelate(); + * sprite.postFX.addPixelate(); + * ``` + * + * @class Pixelate + * @extends Phaser.FX.Controller + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {number} [amount=1] - The amount of pixelation to apply. + */ +var Pixelate = new Class({ + + Extends: Controller, + + initialize: + + function Pixelate (gameObject, amount) + { + if (amount === undefined) { amount = 1; } + + Controller.call(this, FX_CONST.PIXELATE, gameObject); /** - * The x position of the Camera viewport, relative to the top-left of the game canvas. - * The viewport is the area into which the camera renders. - * To adjust the position the camera is looking at in the game world, see the `scrollX` value. + * The amount of pixelation to apply. * - * @name Phaser.Cameras.Scene2D.BaseCamera#_x + * @name Phaser.FX.Pixelate#amount * @type {number} - * @private - * @since 3.0.0 + * @since 3.60.0 */ - this._x = x; + this.amount = amount; + } + +}); + +module.exports = Pixelate; + + +/***/ }), + +/***/ 58575: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); + +/** + * @classdesc + * The Shadow FX Controller. + * + * This FX controller manages the shadow effect for a Game Object. + * + * The shadow effect is a visual technique used to create the illusion of depth and realism by adding darker, + * offset silhouettes or shapes beneath game objects, characters, or environments. These simulated shadows + * help to enhance the visual appeal and immersion, making the 2D game world appear more dynamic and three-dimensional. + * + * A Shadow effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.preFX.addShadow(); + * sprite.postFX.addShadow(); + * ``` + * + * @class Shadow + * @extends Phaser.FX.Controller + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {number} [x=0] - The horizontal offset of the shadow effect. + * @param {number} [y=0] - The vertical offset of the shadow effect. + * @param {number} [decay=0.1] - The amount of decay for shadow effect. + * @param {number} [power=1] - The power of the shadow effect. + * @param {number} [color=0x000000] - The color of the shadow. + * @param {number} [samples=6] - The number of samples that the shadow effect will run for. An integer between 1 and 12. + * @param {number} [intensity=1] - The intensity of the shadow effect. + */ +var Shadow = new Class({ + + Extends: Controller, + + initialize: + + function Shadow (gameObject, x, y, decay, power, color, samples, intensity) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (decay === undefined) { decay = 0.1; } + if (power === undefined) { power = 1; } + if (samples === undefined) { samples = 6; } + if (intensity === undefined) { intensity = 1; } + + Controller.call(this, FX_CONST.SHADOW, gameObject); /** - * The y position of the Camera, relative to the top-left of the game canvas. - * The viewport is the area into which the camera renders. - * To adjust the position the camera is looking at in the game world, see the `scrollY` value. + * The horizontal offset of the shadow effect. * - * @name Phaser.Cameras.Scene2D.BaseCamera#_y + * @name Phaser.FX.Shadow#x * @type {number} - * @private - * @since 3.0.0 + * @since 3.60.0 */ - this._y = y; + this.x = x; /** - * The width of the Camera viewport, in pixels. - * - * The viewport is the area into which the Camera renders. Setting the viewport does - * not restrict where the Camera can scroll to. + * The vertical offset of the shadow effect. * - * @name Phaser.Cameras.Scene2D.BaseCamera#_width + * @name Phaser.FX.Shadow#y * @type {number} - * @private - * @since 3.11.0 + * @since 3.60.0 */ - this._width = width; + this.y = y; /** - * The height of the Camera viewport, in pixels. - * - * The viewport is the area into which the Camera renders. Setting the viewport does - * not restrict where the Camera can scroll to. + * The amount of decay for the shadow effect. * - * @name Phaser.Cameras.Scene2D.BaseCamera#_height + * @name Phaser.FX.Shadow#decay * @type {number} - * @private - * @since 3.11.0 + * @since 3.60.0 */ - this._height = height; + this.decay = decay; /** - * The bounds the camera is restrained to during scrolling. + * The power of the shadow effect. * - * @name Phaser.Cameras.Scene2D.BaseCamera#_bounds - * @type {Phaser.Geom.Rectangle} - * @private - * @since 3.0.0 + * @name Phaser.FX.Shadow#power + * @type {number} + * @since 3.60.0 */ - this._bounds = new Rectangle(); + this.power = power; /** - * The horizontal scroll position of this Camera. - * - * Change this value to cause the Camera to scroll around your Scene. - * - * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, - * will automatically adjust the Camera scroll values accordingly. + * The internal gl color array. * - * You can set the bounds within which the Camera can scroll via the `setBounds` method. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollX - * @type {number} - * @private - * @default 0 - * @since 3.11.0 + * @name Phaser.FX.Shadow#glcolor + * @type {number[]} + * @since 3.60.0 */ - this._scrollX = 0; + this.glcolor = [ 0, 0, 0, 1 ]; /** - * The vertical scroll position of this Camera. - * - * Change this value to cause the Camera to scroll around your Scene. + * The number of samples that the shadow effect will run for. * - * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, - * will automatically adjust the Camera scroll values accordingly. - * - * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * This should be an integer with a minimum value of 1 and a maximum of 12. * - * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollY + * @name Phaser.FX.Shadow#samples * @type {number} - * @private - * @default 0 - * @since 3.11.0 + * @since 3.60.0 */ - this._scrollY = 0; + this.samples = samples; /** - * The Camera horizontal zoom value. Change this value to zoom in, or out of, a Scene. - * - * A value of 0.5 would zoom the Camera out, so you can now see twice as much - * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel - * now takes up 2 pixels when rendered. - * - * Set to 1 to return to the default zoom level. + * The intensity of the shadow effect. * - * Be careful to never set this value to zero. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_zoomX + * @name Phaser.FX.Shadow#intensity * @type {number} - * @private - * @default 1 - * @since 3.50.0 + * @since 3.60.0 */ - this._zoomX = 1; + this.intensity = intensity; + + if (color !== undefined) + { + this.color = color; + } + }, + + /** + * The color of the shadow. + * + * @name Phaser.FX.Shadow#color + * @type {number} + * @since 3.60.0 + */ + color: { + + get: function () + { + var color = this.glcolor; + + return (((color[0] * 255) << 16) + ((color[1] * 255) << 8) + (color[2] * 255 | 0)); + }, + + set: function (value) + { + var color = this.glcolor; + + color[0] = ((value >> 16) & 0xFF) / 255; + color[1] = ((value >> 8) & 0xFF) / 255; + color[2] = (value & 0xFF) / 255; + } + + } + +}); + +module.exports = Shadow; + + +/***/ }), + +/***/ 33755: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); + +/** + * @classdesc + * The Shine FX Controller. + * + * This FX controller manages the shift effect for a Game Object. + * + * The shine effect is a visual technique that simulates the appearance of reflective + * or glossy surfaces by passing a light beam across a Game Object. This effect is used to + * enhance visual appeal, emphasize certain features, and create a sense of depth or + * material properties. + * + * A Shine effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.preFX.addShine(); + * sprite.postFX.addShine(); + * ``` + * + * @class Shine + * @extends Phaser.FX.Controller + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {number} [speed=0.5] - The speed of the Shine effect. + * @param {number} [lineWidth=0.5] - The line width of the Shine effect. + * @param {number} [gradient=3] - The gradient of the Shine effect. + * @param {boolean} [reveal=false] - Does this Shine effect reveal or get added to its target? + */ +var Shine = new Class({ + + Extends: Controller, + + initialize: + + function Shine (gameObject, speed, lineWidth, gradient, reveal) + { + if (speed === undefined) { speed = 0.5; } + if (lineWidth === undefined) { lineWidth = 0.5; } + if (gradient === undefined) { gradient = 3; } + if (reveal === undefined) { reveal = false; } + + Controller.call(this, FX_CONST.SHINE, gameObject); /** - * The Camera vertical zoom value. Change this value to zoom in, or out of, a Scene. - * - * A value of 0.5 would zoom the Camera out, so you can now see twice as much - * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel - * now takes up 2 pixels when rendered. + * The speed of the Shine effect. * - * Set to 1 to return to the default zoom level. - * - * Be careful to never set this value to zero. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#_zoomY + * @name Phaser.FX.Shine#speed * @type {number} - * @private - * @default 1 - * @since 3.50.0 + * @since 3.60.0 */ - this._zoomY = 1; + this.speed = speed; /** - * The rotation of the Camera in radians. - * - * Camera rotation always takes place based on the Camera viewport. By default, rotation happens - * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. - * - * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not - * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. + * The line width of the Shine effect. * - * @name Phaser.Cameras.Scene2D.BaseCamera#_rotation + * @name Phaser.FX.Shine#lineWidth * @type {number} - * @private - * @default 0 - * @since 3.11.0 + * @since 3.60.0 */ - this._rotation = 0; + this.lineWidth = lineWidth; /** - * A local transform matrix used for internal calculations. + * The gradient of the Shine effect. * - * @name Phaser.Cameras.Scene2D.BaseCamera#matrix - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @private - * @since 3.0.0 + * @name Phaser.FX.Shine#gradient + * @type {number} + * @since 3.60.0 */ - this.matrix = new TransformMatrix(); + this.gradient = gradient; /** - * Does this Camera have a transparent background? + * Does this Shine effect reveal or get added to its target? * - * @name Phaser.Cameras.Scene2D.BaseCamera#transparent + * @name Phaser.FX.Shine#reveal * @type {boolean} - * @default true - * @since 3.0.0 + * @since 3.60.0 */ - this.transparent = true; + this.reveal = reveal; + } - /** - * The background color of this Camera. Only used if `transparent` is `false`. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#backgroundColor - * @type {Phaser.Display.Color} - * @since 3.0.0 - */ - this.backgroundColor = ValueToColor('rgba(0,0,0,0)'); +}); + +module.exports = Shine; + + +/***/ }), + +/***/ 24949: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); + +/** + * @classdesc + * The Vignette FX Controller. + * + * This FX controller manages the vignette effect for a Game Object. + * + * The vignette effect is a visual technique where the edges of the screen, or a Game Object, gradually darken or blur, + * creating a frame-like appearance. This effect is used to draw the player's focus towards the central action or subject, + * enhance immersion, and provide a cinematic or artistic quality to the game's visuals. + * + * A Vignette effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.preFX.addVignette(); + * sprite.postFX.addVignette(); + * ``` + * + * @class Vignette + * @extends Phaser.FX.Controller + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {number} [x=0.5] - The horizontal offset of the vignette effect. This value is normalized to the range 0 to 1. + * @param {number} [y=0.5] - The vertical offset of the vignette effect. This value is normalized to the range 0 to 1. + * @param {number} [radius=0.5] - The radius of the vignette effect. This value is normalized to the range 0 to 1. + * @param {number} [strength=0.5] - The strength of the vignette effect. + */ +var Vignette = new Class({ + + Extends: Controller, + + initialize: + + function Vignette (gameObject, x, y, radius, strength) + { + if (x === undefined) { x = 0.5; } + if (y === undefined) { y = 0.5; } + if (radius === undefined) { radius = 0.5; } + if (strength === undefined) { strength = 0.5; } + + Controller.call(this, FX_CONST.VIGNETTE, gameObject); /** - * The Camera alpha value. Setting this property impacts every single object that this Camera - * renders. You can either set the property directly, i.e. via a Tween, to fade a Camera in or out, - * or via the chainable `setAlpha` method instead. + * The horizontal offset of the vignette effect. This value is normalized to the range 0 to 1. * - * @name Phaser.Cameras.Scene2D.BaseCamera#alpha + * @name Phaser.FX.Vignette#x * @type {number} - * @default 1 - * @since 3.11.0 + * @since 3.60.0 */ + this.x = x; /** - * Should the camera cull Game Objects before checking them for input hit tests? - * In some special cases it may be beneficial to disable this. + * The vertical offset of the vignette effect. This value is normalized to the range 0 to 1. * - * @name Phaser.Cameras.Scene2D.BaseCamera#disableCull - * @type {boolean} - * @default false - * @since 3.0.0 + * @name Phaser.FX.Vignette#y + * @type {number} + * @since 3.60.0 */ - this.disableCull = false; + this.y = y; /** - * A temporary array of culled objects. + * The radius of the vignette effect. This value is normalized to the range 0 to 1. * - * @name Phaser.Cameras.Scene2D.BaseCamera#culledObjects - * @type {Phaser.GameObjects.GameObject[]} - * @default [] - * @private - * @since 3.0.0 + * @name Phaser.FX.Vignette#radius + * @type {number} + * @since 3.60.0 */ - this.culledObjects = []; + this.radius = radius; /** - * The mid-point of the Camera in 'world' coordinates. - * - * Use it to obtain exactly where in the world the center of the camera is currently looking. - * - * This value is updated in the preRender method, after the scroll values and follower - * have been processed. + * The strength of the vignette effect. * - * @name Phaser.Cameras.Scene2D.BaseCamera#midPoint - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.11.0 + * @name Phaser.FX.Vignette#strength + * @type {number} + * @since 3.60.0 */ - this.midPoint = new Vector2(width / 2, height / 2); + this.strength = strength; + } + +}); + +module.exports = Vignette; + + +/***/ }), + +/***/ 66241: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var Controller = __webpack_require__(47551); +var FX_CONST = __webpack_require__(47406); + +/** + * @classdesc + * The Wipe FX Controller. + * + * This FX controller manages the wipe effect for a Game Object. + * + * The wipe or reveal effect is a visual technique that gradually uncovers or conceals elements + * in the game, such as images, text, or scene transitions. This effect is often used to create + * a sense of progression, reveal hidden content, or provide a smooth and visually appealing transition + * between game states. + * + * You can set both the direction and the axis of the wipe effect. The following combinations are possible: + * + * * left to right: direction 0, axis 0 + * * right to left: direction 1, axis 0 + * * top to bottom: direction 1, axis 1 + * * bottom to top: direction 1, axis 0 + * + * It is up to you to set the `progress` value yourself, i.e. via a Tween, in order to transition the effect. + * + * A Wipe effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.preFX.addWipe(); + * sprite.postFX.addWipe(); + * sprite.preFX.addReveal(); + * sprite.postFX.addReveal(); + * ``` + * + * @class Wipe + * @extends Phaser.FX.Controller + * @memberof Phaser.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that has this fx. + * @param {number} [wipeWidth=0.1] - The width of the wipe effect. This value is normalized in the range 0 to 1. + * @param {number} [direction=0] - The direction of the wipe effect. Either 0 or 1. Set in conjunction with the axis property. + * @param {number} [axis=0] - The axis of the wipe effect. Either 0 or 1. Set in conjunction with the direction property. + * @param {boolean} [reveal=false] - Is this a reveal (true) or a fade (false) effect? + */ +var Wipe = new Class({ + + Extends: Controller, + + initialize: + + function Wipe (gameObject, wipeWidth, direction, axis, reveal) + { + if (wipeWidth === undefined) { wipeWidth = 0.1; } + if (direction === undefined) { direction = 0; } + if (axis === undefined) { axis = 0; } + if (reveal === undefined) { reveal = false; } + + Controller.call(this, FX_CONST.WIPE, gameObject); /** - * The horizontal origin of rotation for this Camera. - * - * By default the camera rotates around the center of the viewport. + * The progress of the Wipe effect. This value is normalized to the range 0 to 1. * - * Changing the origin allows you to adjust the point in the viewport from which rotation happens. - * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. - * - * See `setOrigin` to set both origins in a single, chainable call. + * Adjust this value to make the wipe transition (i.e. via a Tween) * - * @name Phaser.Cameras.Scene2D.BaseCamera#originX + * @name Phaser.FX.Wipe#progress * @type {number} - * @default 0.5 - * @since 3.11.0 + * @since 3.60.0 */ - this.originX = 0.5; + this.progress = 0; /** - * The vertical origin of rotation for this Camera. - * - * By default the camera rotates around the center of the viewport. - * - * Changing the origin allows you to adjust the point in the viewport from which rotation happens. - * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. - * - * See `setOrigin` to set both origins in a single, chainable call. + * The width of the wipe effect. This value is normalized in the range 0 to 1. * - * @name Phaser.Cameras.Scene2D.BaseCamera#originY + * @name Phaser.FX.Wipe#wipeWidth * @type {number} - * @default 0.5 - * @since 3.11.0 + * @since 3.60.0 */ - this.originY = 0.5; + this.wipeWidth = wipeWidth; /** - * Does this Camera have a custom viewport? + * The direction of the wipe effect. Either 0 or 1. Set in conjunction with the axis property. * - * @name Phaser.Cameras.Scene2D.BaseCamera#_customViewport - * @type {boolean} - * @private - * @default false - * @since 3.12.0 + * @name Phaser.FX.Wipe#direction + * @type {number} + * @since 3.60.0 */ - this._customViewport = false; + this.direction = direction; /** - * The Mask this Camera is using during render. - * Set the mask using the `setMask` method. Remove the mask using the `clearMask` method. + * The axis of the wipe effect. Either 0 or 1. Set in conjunction with the direction property. * - * @name Phaser.Cameras.Scene2D.BaseCamera#mask - * @type {?(Phaser.Display.Masks.BitmapMask|Phaser.Display.Masks.GeometryMask)} - * @since 3.17.0 + * @name Phaser.FX.Wipe#axis + * @type {number} + * @since 3.60.0 */ - this.mask = null; + this.axis = axis; /** - * The Camera that this Camera uses for translation during masking. - * - * If the mask is fixed in position this will be a reference to - * the CameraManager.default instance. Otherwise, it'll be a reference - * to itself. + * Is this a reveal (true) or a fade (false) effect? * - * @name Phaser.Cameras.Scene2D.BaseCamera#_maskCamera - * @type {?Phaser.Cameras.Scene2D.BaseCamera} - * @private - * @since 3.17.0 + * @name Phaser.FX.Wipe#reveal + * @type {boolean} + * @since 3.60.0 */ - this._maskCamera = null; + this.reveal = reveal; + } - /** - * This array is populated with all of the Game Objects that this Camera has rendered - * in the previous (or current, depending on when you inspect it) frame. - * - * It is cleared at the start of `Camera.preUpdate`, or if the Camera is destroyed. - * - * You should not modify this array as it is used internally by the input system, - * however you can read it as required. Note that Game Objects may appear in this - * list multiple times if they belong to multiple non-exclusive Containers. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#renderList - * @type {Phaser.GameObjects.GameObject[]} - * @since 3.52.0 - */ - this.renderList = []; - }, +}); + +module.exports = Wipe; + + +/***/ }), + +/***/ 47406: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var FX_CONST = { /** - * Adds the given Game Object to this cameras render list. - * - * This is invoked during the rendering stage. Only objects that are actually rendered - * will appear in the render list. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#addToRenderList - * @since 3.52.0 + * The Glow FX. * - * @param {Phaser.GameObjects.GameObject} child - The Game Object to add to the render list. + * @name Phaser.FX.GLOW + * @type {number} + * @const + * @since 3.60.0 */ - addToRenderList: function (child) - { - this.renderList.push(child); - }, + GLOW: 4, /** - * Set the Alpha level of this Camera. The alpha controls the opacity of the Camera as it renders. - * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setAlpha - * @since 3.11.0 + * The Shadow FX. * - * @param {number} [value=1] - The Camera alpha value. + * @name Phaser.FX.SHADOW + * @type {number} + * @const + * @since 3.60.0 + */ + SHADOW: 5, + + /** + * The Pixelate FX. * - * @return {this} This Camera instance. + * @name Phaser.FX.PIXELATE + * @type {number} + * @const + * @since 3.60.0 */ + PIXELATE: 6, /** - * Sets the rotation origin of this Camera. + * The Vignette FX. * - * The values are given in the range 0 to 1 and are only used when calculating Camera rotation. + * @name Phaser.FX.VIGNETTE + * @type {number} + * @const + * @since 3.60.0 + */ + VIGNETTE: 7, + + /** + * The Shine FX. * - * By default the camera rotates around the center of the viewport. + * @name Phaser.FX.SHINE + * @type {number} + * @const + * @since 3.60.0 + */ + SHINE: 8, + + /** + * The Blur FX. * - * Changing the origin allows you to adjust the point in the viewport from which rotation happens. - * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right. + * @name Phaser.FX.BLUR + * @type {number} + * @const + * @since 3.60.0 + */ + BLUR: 9, // uses 3 shaders, slots 9, 10 and 11 + + /** + * The Gradient FX. * - * @method Phaser.Cameras.Scene2D.BaseCamera#setOrigin - * @since 3.11.0 + * @name Phaser.FX.GRADIENT + * @type {number} + * @const + * @since 3.60.0 + */ + GRADIENT: 12, + + /** + * The Bloom FX. * - * @param {number} [x=0.5] - The horizontal origin value. - * @param {number} [y=x] - The vertical origin value. If not defined it will be set to the value of `x`. + * @name Phaser.FX.BLOOM + * @type {number} + * @const + * @since 3.60.0 + */ + BLOOM: 13, + + /** + * The Color Matrix FX. * - * @return {this} This Camera instance. + * @name Phaser.FX.COLOR_MATRIX + * @type {number} + * @const + * @since 3.60.0 */ - setOrigin: function (x, y) - { - if (x === undefined) { x = 0.5; } - if (y === undefined) { y = x; } + COLOR_MATRIX: 14, - this.originX = x; - this.originY = y; + /** + * The Circle FX. + * + * @name Phaser.FX.CIRCLE + * @type {number} + * @const + * @since 3.60.0 + */ + CIRCLE: 15, - return this; - }, + /** + * The Barrel FX. + * + * @name Phaser.FX.BARREL + * @type {number} + * @const + * @since 3.60.0 + */ + BARREL: 16, /** - * Calculates what the Camera.scrollX and scrollY values would need to be in order to move - * the Camera so it is centered on the given x and y coordinates, without actually moving - * the Camera there. The results are clamped based on the Camera bounds, if set. + * The Displacement FX. * - * @method Phaser.Cameras.Scene2D.BaseCamera#getScroll - * @since 3.11.0 + * @name Phaser.FX.DISPLACEMENT + * @type {number} + * @const + * @since 3.60.0 + */ + DISPLACEMENT: 17, + + /** + * The Wipe FX. * - * @param {number} x - The horizontal coordinate to center on. - * @param {number} y - The vertical coordinate to center on. - * @param {Phaser.Math.Vector2} [out] - A Vector2 to store the values in. If not given a new Vector2 is created. + * @name Phaser.FX.WIPE + * @type {number} + * @const + * @since 3.60.0 + */ + WIPE: 18, + + /** + * The Bokeh and Tilt Shift FX. * - * @return {Phaser.Math.Vector2} The scroll coordinates stored in the `x` and `y` properties. + * @name Phaser.FX.BOKEH + * @type {number} + * @const + * @since 3.60.0 */ - getScroll: function (x, y, out) - { - if (out === undefined) { out = new Vector2(); } + BOKEH: 19 - var originX = this.width * 0.5; - var originY = this.height * 0.5; +}; - out.x = x - originX; - out.y = y - originY; +module.exports = FX_CONST; - if (this.useBounds) - { - out.x = this.clampX(out.x); - out.y = this.clampY(out.y); - } - return out; - }, +/***/ }), - /** - * Moves the Camera horizontally so that it is centered on the given x coordinate, bounds allowing. - * Calling this does not change the scrollY value. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnX - * @since 3.16.0 - * - * @param {number} x - The horizontal coordinate to center on. - * - * @return {this} This Camera instance. - */ - centerOnX: function (x) - { - var originX = this.width * 0.5; +/***/ 96910: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.midPoint.x = x; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.scrollX = x - originX; +var Extend = __webpack_require__(98611); +var FX_CONST = __webpack_require__(47406); - if (this.useBounds) - { - this.scrollX = this.clampX(this.scrollX); - } +/** + * @namespace Phaser.FX + */ - return this; - }, +var FX = { - /** - * Moves the Camera vertically so that it is centered on the given y coordinate, bounds allowing. - * Calling this does not change the scrollX value. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnY - * @since 3.16.0 - * - * @param {number} y - The vertical coordinate to center on. - * - * @return {this} This Camera instance. - */ - centerOnY: function (y) - { - var originY = this.height * 0.5; + Barrel: __webpack_require__(20170), + Controller: __webpack_require__(47551), + Bloom: __webpack_require__(51182), + Blur: __webpack_require__(51498), + Bokeh: __webpack_require__(12042), + Circle: __webpack_require__(69900), + ColorMatrix: __webpack_require__(48991), + Displacement: __webpack_require__(47909), + Glow: __webpack_require__(18919), + Gradient: __webpack_require__(62494), + Pixelate: __webpack_require__(68897), + Shadow: __webpack_require__(58575), + Shine: __webpack_require__(33755), + Vignette: __webpack_require__(24949), + Wipe: __webpack_require__(66241) - this.midPoint.y = y; +}; - this.scrollY = y - originY; +FX = Extend(false, FX, FX_CONST); - if (this.useBounds) - { - this.scrollY = this.clampY(this.scrollY); - } +module.exports = FX; - return this; - }, - /** - * Moves the Camera so that it is centered on the given coordinates, bounds allowing. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#centerOn - * @since 3.11.0 - * - * @param {number} x - The horizontal coordinate to center on. - * @param {number} y - The vertical coordinate to center on. - * - * @return {this} This Camera instance. - */ - centerOn: function (x, y) - { - this.centerOnX(x); - this.centerOnY(y); +/***/ }), - return this; - }, +/***/ 88933: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Moves the Camera so that it is looking at the center of the Camera Bounds, if enabled. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#centerToBounds - * @since 3.0.0 - * - * @return {this} This Camera instance. - */ - centerToBounds: function () - { - if (this.useBounds) - { - var bounds = this._bounds; - var originX = this.width * 0.5; - var originY = this.height * 0.5; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.midPoint.set(bounds.centerX, bounds.centerY); +var BlendModes = __webpack_require__(95723); +var GetAdvancedValue = __webpack_require__(20494); - this.scrollX = bounds.centerX - originX; - this.scrollY = bounds.centerY - originY; - } +/** + * Builds a Game Object using the provided configuration object. + * + * @function Phaser.GameObjects.BuildGameObject + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - A reference to the Scene. + * @param {Phaser.GameObjects.GameObject} gameObject - The initial GameObject. + * @param {Phaser.Types.GameObjects.GameObjectConfig} config - The config to build the GameObject with. + * + * @return {Phaser.GameObjects.GameObject} The built Game Object. + */ +var BuildGameObject = function (scene, gameObject, config) +{ + // Position - return this; - }, + gameObject.x = GetAdvancedValue(config, 'x', 0); + gameObject.y = GetAdvancedValue(config, 'y', 0); + gameObject.depth = GetAdvancedValue(config, 'depth', 0); - /** - * Moves the Camera so that it is re-centered based on its viewport size. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#centerToSize - * @since 3.0.0 - * - * @return {this} This Camera instance. - */ - centerToSize: function () + // Flip + + gameObject.flipX = GetAdvancedValue(config, 'flipX', false); + gameObject.flipY = GetAdvancedValue(config, 'flipY', false); + + // Scale + // Either: { scale: 2 } or { scale: { x: 2, y: 2 }} + + var scale = GetAdvancedValue(config, 'scale', null); + + if (typeof scale === 'number') { - this.scrollX = this.width * 0.5; - this.scrollY = this.height * 0.5; + gameObject.setScale(scale); + } + else if (scale !== null) + { + gameObject.scaleX = GetAdvancedValue(scale, 'x', 1); + gameObject.scaleY = GetAdvancedValue(scale, 'y', 1); + } - return this; - }, + // ScrollFactor + // Either: { scrollFactor: 2 } or { scrollFactor: { x: 2, y: 2 }} - /** - * Takes an array of Game Objects and returns a new array featuring only those objects - * visible by this camera. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#cull - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [renderableObjects,$return] - * - * @param {Phaser.GameObjects.GameObject[]} renderableObjects - An array of Game Objects to cull. - * - * @return {Phaser.GameObjects.GameObject[]} An array of Game Objects visible to this Camera. - */ - cull: function (renderableObjects) + var scrollFactor = GetAdvancedValue(config, 'scrollFactor', null); + + if (typeof scrollFactor === 'number') { - if (this.disableCull) - { - return renderableObjects; - } + gameObject.setScrollFactor(scrollFactor); + } + else if (scrollFactor !== null) + { + gameObject.scrollFactorX = GetAdvancedValue(scrollFactor, 'x', 1); + gameObject.scrollFactorY = GetAdvancedValue(scrollFactor, 'y', 1); + } - var cameraMatrix = this.matrix.matrix; + // Rotation - var mva = cameraMatrix[0]; - var mvb = cameraMatrix[1]; - var mvc = cameraMatrix[2]; - var mvd = cameraMatrix[3]; + gameObject.rotation = GetAdvancedValue(config, 'rotation', 0); - /* First Invert Matrix */ - var determinant = (mva * mvd) - (mvb * mvc); + var angle = GetAdvancedValue(config, 'angle', null); - if (!determinant) - { - return renderableObjects; - } + if (angle !== null) + { + gameObject.angle = angle; + } - var mve = cameraMatrix[4]; - var mvf = cameraMatrix[5]; + // Alpha - var scrollX = this.scrollX; - var scrollY = this.scrollY; - var cameraW = this.width; - var cameraH = this.height; - var cullTop = this.y; - var cullBottom = cullTop + cameraH; - var cullLeft = this.x; - var cullRight = cullLeft + cameraW; - var culledObjects = this.culledObjects; - var length = renderableObjects.length; + gameObject.alpha = GetAdvancedValue(config, 'alpha', 1); - determinant = 1 / determinant; + // Origin + // Either: { origin: 0.5 } or { origin: { x: 0.5, y: 0.5 }} - culledObjects.length = 0; + var origin = GetAdvancedValue(config, 'origin', null); - for (var index = 0; index < length; ++index) - { - var object = renderableObjects[index]; + if (typeof origin === 'number') + { + gameObject.setOrigin(origin); + } + else if (origin !== null) + { + var ox = GetAdvancedValue(origin, 'x', 0.5); + var oy = GetAdvancedValue(origin, 'y', 0.5); - if (!object.hasOwnProperty('width') || object.parentContainer) - { - culledObjects.push(object); - continue; - } + gameObject.setOrigin(ox, oy); + } - var objectW = object.width; - var objectH = object.height; - var objectX = (object.x - (scrollX * object.scrollFactorX)) - (objectW * object.originX); - var objectY = (object.y - (scrollY * object.scrollFactorY)) - (objectH * object.originY); - var tx = (objectX * mva + objectY * mvc + mve); - var ty = (objectX * mvb + objectY * mvd + mvf); - var tw = ((objectX + objectW) * mva + (objectY + objectH) * mvc + mve); - var th = ((objectX + objectW) * mvb + (objectY + objectH) * mvd + mvf); + // BlendMode - if ((tw > cullLeft && tx < cullRight) && (th > cullTop && ty < cullBottom)) - { - culledObjects.push(object); - } - } + gameObject.blendMode = GetAdvancedValue(config, 'blendMode', BlendModes.NORMAL); - return culledObjects; - }, + // Visible - /** - * Converts the given `x` and `y` coordinates into World space, based on this Cameras transform. - * You can optionally provide a Vector2, or similar object, to store the results in. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#getWorldPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [output,$return] - * - * @param {number} x - The x position to convert to world space. - * @param {number} y - The y position to convert to world space. - * @param {(object|Phaser.Math.Vector2)} [output] - An optional object to store the results in. If not provided a new Vector2 will be created. - * - * @return {Phaser.Math.Vector2} An object holding the converted values in its `x` and `y` properties. - */ - getWorldPoint: function (x, y, output) - { - if (output === undefined) { output = new Vector2(); } + gameObject.visible = GetAdvancedValue(config, 'visible', true); - var cameraMatrix = this.matrix.matrix; + // Add to Scene - var mva = cameraMatrix[0]; - var mvb = cameraMatrix[1]; - var mvc = cameraMatrix[2]; - var mvd = cameraMatrix[3]; - var mve = cameraMatrix[4]; - var mvf = cameraMatrix[5]; + var add = GetAdvancedValue(config, 'add', true); - // Invert Matrix - var determinant = (mva * mvd) - (mvb * mvc); + if (add) + { + scene.sys.displayList.add(gameObject); + } - if (!determinant) - { - output.x = x; - output.y = y; + if (gameObject.preUpdate) + { + scene.sys.updateList.add(gameObject); + } - return output; - } + return gameObject; +}; - determinant = 1 / determinant; +module.exports = BuildGameObject; - var ima = mvd * determinant; - var imb = -mvb * determinant; - var imc = -mvc * determinant; - var imd = mva * determinant; - var ime = (mvc * mvf - mvd * mve) * determinant; - var imf = (mvb * mve - mva * mvf) * determinant; - var c = Math.cos(this.rotation); - var s = Math.sin(this.rotation); +/***/ }), - var zoomX = this.zoomX; - var zoomY = this.zoomY; +/***/ 32291: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var scrollX = this.scrollX; - var scrollY = this.scrollY; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var sx = x + ((scrollX * c - scrollY * s) * zoomX); - var sy = y + ((scrollX * s + scrollY * c) * zoomY); +var GetAdvancedValue = __webpack_require__(20494); - // Apply transform to point - output.x = (sx * ima + sy * imc) + ime; - output.y = (sx * imb + sy * imd) + imf; +/** + * Adds an Animation component to a Sprite and populates it based on the given config. + * + * @function Phaser.GameObjects.BuildGameObjectAnimation + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Sprite} sprite - The sprite to add an Animation component to. + * @param {object} config - The animation config. + * + * @return {Phaser.GameObjects.Sprite} The updated Sprite. + */ +var BuildGameObjectAnimation = function (sprite, config) +{ + var animConfig = GetAdvancedValue(config, 'anims', null); - return output; - }, + if (animConfig === null) + { + return sprite; + } - /** - * Given a Game Object, or an array of Game Objects, it will update all of their camera filter settings - * so that they are ignored by this Camera. This means they will not be rendered by this Camera. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#ignore - * @since 3.0.0 - * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group)} entries - The Game Object, or array of Game Objects, to be ignored by this Camera. - * - * @return {this} This Camera instance. - */ - ignore: function (entries) + if (typeof animConfig === 'string') { - var id = this.id; + // { anims: 'key' } + sprite.anims.play(animConfig); + } + else if (typeof animConfig === 'object') + { + // { anims: { + // key: string + // startFrame: [string|number] + // delay: [float] + // repeat: [integer] + // repeatDelay: [float] + // yoyo: [boolean] + // play: [boolean] + // delayedPlay: [boolean] + // } + // } - if (!Array.isArray(entries)) - { - entries = [ entries ]; - } + var anims = sprite.anims; - for (var i = 0; i < entries.length; i++) + var key = GetAdvancedValue(animConfig, 'key', undefined); + + if (key) { - var entry = entries[i]; + var startFrame = GetAdvancedValue(animConfig, 'startFrame', undefined); - if (Array.isArray(entry)) + var delay = GetAdvancedValue(animConfig, 'delay', 0); + var repeat = GetAdvancedValue(animConfig, 'repeat', 0); + var repeatDelay = GetAdvancedValue(animConfig, 'repeatDelay', 0); + var yoyo = GetAdvancedValue(animConfig, 'yoyo', false); + + var play = GetAdvancedValue(animConfig, 'play', false); + var delayedPlay = GetAdvancedValue(animConfig, 'delayedPlay', 0); + + var playConfig = { + key: key, + delay: delay, + repeat: repeat, + repeatDelay: repeatDelay, + yoyo: yoyo, + startFrame: startFrame + }; + + if (play) { - this.ignore(entry); + anims.play(playConfig); } - else if (entry.isParent) + else if (delayedPlay > 0) { - this.ignore(entry.getChildren()); + anims.playAfterDelay(playConfig, delayedPlay); } else { - entry.cameraFilter |= id; + anims.load(playConfig); } } + } - return this; - }, + return sprite; +}; - /** - * Internal preRender step. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#preRender - * @protected - * @since 3.0.0 - */ - preRender: function () - { - this.renderList.length = 0; +module.exports = BuildGameObjectAnimation; - var width = this.width; - var height = this.height; - var halfWidth = width * 0.5; - var halfHeight = height * 0.5; +/***/ }), - var zoomX = this.zoomX; - var zoomY = this.zoomY; - var matrix = this.matrix; +/***/ 91713: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var originX = width * this.originX; - var originY = height * this.originY; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var sx = this.scrollX; - var sy = this.scrollY; +var Class = __webpack_require__(56694); +var List = __webpack_require__(71207); +var PluginCache = __webpack_require__(91963); +var GameObjectEvents = __webpack_require__(56631); +var SceneEvents = __webpack_require__(7599); +var StableSort = __webpack_require__(17922); - if (this.useBounds) - { - sx = this.clampX(sx); - sy = this.clampY(sy); - } +/** + * @classdesc + * The Display List plugin. + * + * Display Lists belong to a Scene and maintain the list of Game Objects to render every frame. + * + * Some of these Game Objects may also be part of the Scene's [Update List]{@link Phaser.GameObjects.UpdateList}, for updating. + * + * @class DisplayList + * @extends Phaser.Structs.List. + * @memberof Phaser.GameObjects + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene that this Display List belongs to. + */ +var DisplayList = new Class({ - if (this.roundPixels) - { - originX = Math.round(originX); - originY = Math.round(originY); - } + Extends: List, - // Values are in pixels and not impacted by zooming the Camera - this.scrollX = sx; - this.scrollY = sy; + initialize: - var midX = sx + halfWidth; - var midY = sy + halfHeight; + function DisplayList (scene) + { + List.call(this, scene); - // The center of the camera, in world space, so taking zoom into account - // Basically the pixel value of what it's looking at in the middle of the cam - this.midPoint.set(midX, midY); + /** + * The flag the determines whether Game Objects should be sorted when `depthSort()` is called. + * + * @name Phaser.GameObjects.DisplayList#sortChildrenFlag + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.sortChildrenFlag = false; - var displayWidth = width / zoomX; - var displayHeight = height / zoomY; + /** + * The Scene that this Display List belongs to. + * + * @name Phaser.GameObjects.DisplayList#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; - this.worldView.setTo( - midX - (displayWidth / 2), - midY - (displayHeight / 2), - displayWidth, - displayHeight - ); + /** + * The Scene's Systems. + * + * @name Phaser.GameObjects.DisplayList#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; - matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoomX, zoomY); - matrix.translate(-originX, -originY); + /** + * The Scene's Event Emitter. + * + * @name Phaser.GameObjects.DisplayList#events + * @type {Phaser.Events.EventEmitter} + * @since 3.50.0 + */ + this.events = scene.sys.events; + + // Set the List callbacks + this.addCallback = this.addChildCallback; + this.removeCallback = this.removeChildCallback; + + this.events.once(SceneEvents.BOOT, this.boot, this); + this.events.on(SceneEvents.START, this.start, this); }, /** - * Takes an x value and checks it's within the range of the Camera bounds, adjusting if required. - * Do not call this method if you are not using camera bounds. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#clampX - * @since 3.11.0 - * - * @param {number} x - The value to horizontally scroll clamp. + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. * - * @return {number} The adjusted value to use as scrollX. + * @method Phaser.GameObjects.DisplayList#boot + * @private + * @since 3.5.1 */ - clampX: function (x) + boot: function () { - var bounds = this._bounds; - - var dw = this.displayWidth; - - var bx = bounds.x + ((dw - this.width) / 2); - var bw = Math.max(bx, bx + bounds.width - dw); - - if (x < bx) - { - x = bx; - } - else if (x > bw) - { - x = bw; - } - - return x; + this.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** - * Takes a y value and checks it's within the range of the Camera bounds, adjusting if required. - * Do not call this method if you are not using camera bounds. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#clampY - * @since 3.11.0 + * Internal method called from `List.addCallback`. * - * @param {number} y - The value to vertically scroll clamp. + * @method Phaser.GameObjects.DisplayList#addChildCallback + * @private + * @fires Phaser.Scenes.Events#ADDED_TO_SCENE + * @fires Phaser.GameObjects.Events#ADDED_TO_SCENE + * @since 3.50.0 * - * @return {number} The adjusted value to use as scrollY. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was added to the list. */ - clampY: function (y) + addChildCallback: function (gameObject) { - var bounds = this._bounds; - - var dh = this.displayHeight; - - var by = bounds.y + ((dh - this.height) / 2); - var bh = Math.max(by, by + bounds.height - dh); - - if (y < by) + if (gameObject.displayList && gameObject.displayList !== this) { - y = by; + gameObject.removeFromDisplayList(); } - else if (y > bh) + + if (gameObject.parentContainer) { - y = bh; + gameObject.parentContainer.remove(gameObject); } - return y; - }, - - /* - var gap = this._zoomInversed; - return gap * Math.round((src.x - this.scrollX * src.scrollFactorX) / gap); - */ - - /** - * If this Camera has previously had movement bounds set on it, this will remove them. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#removeBounds - * @since 3.0.0 - * - * @return {this} This Camera instance. - */ - removeBounds: function () - { - this.useBounds = false; - - this.dirty = true; - - this._bounds.setEmpty(); - - return this; - }, + if (!gameObject.displayList) + { + this.queueDepthSort(); - /** - * Set the rotation of this Camera. This causes everything it renders to appear rotated. - * - * Rotating a camera does not rotate the viewport itself, it is applied during rendering. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setAngle - * @since 3.0.0 - * - * @param {number} [value=0] - The cameras angle of rotation, given in degrees. - * - * @return {this} This Camera instance. - */ - setAngle: function (value) - { - if (value === undefined) { value = 0; } + gameObject.displayList = this; - this.rotation = DegToRad(value); + gameObject.emit(GameObjectEvents.ADDED_TO_SCENE, gameObject, this.scene); - return this; + this.events.emit(SceneEvents.ADDED_TO_SCENE, gameObject, this.scene); + } }, /** - * Sets the background color for this Camera. - * - * By default a Camera has a transparent background but it can be given a solid color, with any level - * of transparency, via this method. - * - * The color value can be specified using CSS color notation, hex or numbers. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setBackgroundColor - * @since 3.0.0 + * Internal method called from `List.removeCallback`. * - * @param {(string|number|Phaser.Types.Display.InputColorObject)} [color='rgba(0,0,0,0)'] - The color value. In CSS, hex or numeric color notation. + * @method Phaser.GameObjects.DisplayList#removeChildCallback + * @private + * @fires Phaser.Scenes.Events#REMOVED_FROM_SCENE + * @fires Phaser.GameObjects.Events#REMOVED_FROM_SCENE + * @since 3.50.0 * - * @return {this} This Camera instance. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was removed from the list. */ - setBackgroundColor: function (color) + removeChildCallback: function (gameObject) { - if (color === undefined) { color = 'rgba(0,0,0,0)'; } + this.queueDepthSort(); - this.backgroundColor = ValueToColor(color); + gameObject.displayList = null; - this.transparent = (this.backgroundColor.alpha === 0); + gameObject.emit(GameObjectEvents.REMOVED_FROM_SCENE, gameObject, this.scene); - return this; + this.events.emit(SceneEvents.REMOVED_FROM_SCENE, gameObject, this.scene); }, /** - * Set the bounds of the Camera. The bounds are an axis-aligned rectangle. - * - * The Camera bounds controls where the Camera can scroll to, stopping it from scrolling off the - * edges and into blank space. It does not limit the placement of Game Objects, or where - * the Camera viewport can be positioned. - * - * Temporarily disable the bounds by changing the boolean `Camera.useBounds`. - * - * Clear the bounds entirely by calling `Camera.removeBounds`. - * - * If you set bounds that are smaller than the viewport it will stop the Camera from being - * able to scroll. The bounds can be positioned where-ever you wish. By default they are from - * 0x0 to the canvas width x height. This means that the coordinate 0x0 is the top left of - * the Camera bounds. However, you can position them anywhere. So if you wanted a game world - * that was 2048x2048 in size, with 0x0 being the center of it, you can set the bounds x/y - * to be -1024, -1024, with a width and height of 2048. Depending on your game you may find - * it easier for 0x0 to be the top-left of the bounds, or you may wish 0x0 to be the middle. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setBounds - * @since 3.0.0 - * - * @param {number} x - The top-left x coordinate of the bounds. - * @param {number} y - The top-left y coordinate of the bounds. - * @param {number} width - The width of the bounds, in pixels. - * @param {number} height - The height of the bounds, in pixels. - * @param {boolean} [centerOn=false] - If `true` the Camera will automatically be centered on the new bounds. + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. * - * @return {this} This Camera instance. + * @method Phaser.GameObjects.DisplayList#start + * @private + * @since 3.5.0 */ - setBounds: function (x, y, width, height, centerOn) + start: function () { - if (centerOn === undefined) { centerOn = false; } - - this._bounds.setTo(x, y, width, height); - - this.dirty = true; - this.useBounds = true; - - if (centerOn) - { - this.centerToBounds(); - } - else - { - this.scrollX = this.clampX(this.scrollX); - this.scrollY = this.clampY(this.scrollY); - } - - return this; + this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * Returns a rectangle containing the bounds of the Camera. - * - * If the Camera does not have any bounds the rectangle will be empty. - * - * The rectangle is a copy of the bounds, so is safe to modify. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#getBounds - * @since 3.16.0 - * - * @param {Phaser.Geom.Rectangle} [out] - An optional Rectangle to store the bounds in. If not given, a new Rectangle will be created. + * Force a sort of the display list on the next call to depthSort. * - * @return {Phaser.Geom.Rectangle} A rectangle containing the bounds of this Camera. + * @method Phaser.GameObjects.DisplayList#queueDepthSort + * @since 3.0.0 */ - getBounds: function (out) + queueDepthSort: function () { - if (out === undefined) { out = new Rectangle(); } - - var source = this._bounds; - - out.setTo(source.x, source.y, source.width, source.height); - - return out; + this.sortChildrenFlag = true; }, /** - * Sets the name of this Camera. - * This value is for your own use and isn't used internally. + * Immediately sorts the display list if the flag is set. * - * @method Phaser.Cameras.Scene2D.BaseCamera#setName + * @method Phaser.GameObjects.DisplayList#depthSort * @since 3.0.0 - * - * @param {string} [value=''] - The name of the Camera. - * - * @return {this} This Camera instance. */ - setName: function (value) + depthSort: function () { - if (value === undefined) { value = ''; } - - this.name = value; + if (this.sortChildrenFlag) + { + StableSort(this.list, this.sortByDepth); - return this; + this.sortChildrenFlag = false; + } }, /** - * Set the position of the Camera viewport within the game. - * - * This does not change where the camera is 'looking'. See `setScroll` to control that. + * Compare the depth of two Game Objects. * - * @method Phaser.Cameras.Scene2D.BaseCamera#setPosition + * @method Phaser.GameObjects.DisplayList#sortByDepth * @since 3.0.0 * - * @param {number} x - The top-left x coordinate of the Camera viewport. - * @param {number} [y=x] - The top-left y coordinate of the Camera viewport. + * @param {Phaser.GameObjects.GameObject} childA - The first Game Object. + * @param {Phaser.GameObjects.GameObject} childB - The second Game Object. * - * @return {this} This Camera instance. + * @return {number} The difference between the depths of each Game Object. */ - setPosition: function (x, y) + sortByDepth: function (childA, childB) { - if (y === undefined) { y = x; } - - this.x = x; - this.y = y; - - return this; + return childA._depth - childB._depth; }, /** - * Set the rotation of this Camera. This causes everything it renders to appear rotated. - * - * Rotating a camera does not rotate the viewport itself, it is applied during rendering. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setRotation - * @since 3.0.0 + * Returns an array which contains all objects currently on the Display List. + * This is a reference to the main list array, not a copy of it, so be careful not to modify it. * - * @param {number} [value=0] - The rotation of the Camera, in radians. + * @method Phaser.GameObjects.DisplayList#getChildren + * @since 3.12.0 * - * @return {this} This Camera instance. + * @return {Phaser.GameObjects.GameObject[]} The group members. */ - setRotation: function (value) + getChildren: function () { - if (value === undefined) { value = 0; } - - this.rotation = value; - - return this; + return this.list; }, /** - * Should the Camera round pixel values to whole integers when rendering Game Objects? + * The Scene that owns this plugin is shutting down. * - * In some types of game, especially with pixel art, this is required to prevent sub-pixel aliasing. + * We need to kill and reset all internal properties as well as stop listening to Scene events. * - * @method Phaser.Cameras.Scene2D.BaseCamera#setRoundPixels + * @method Phaser.GameObjects.DisplayList#shutdown + * @private * @since 3.0.0 - * - * @param {boolean} value - `true` to round Camera pixels, `false` to not. - * - * @return {this} This Camera instance. */ - setRoundPixels: function (value) + shutdown: function () { - this.roundPixels = value; + var list = this.list; - return this; + while (list.length) + { + list[0].destroy(true); + } + + this.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * Sets the Scene the Camera is bound to. + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. * - * @method Phaser.Cameras.Scene2D.BaseCamera#setScene + * @method Phaser.GameObjects.DisplayList#destroy + * @private * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene the camera is bound to. - * - * @return {this} This Camera instance. */ - setScene: function (scene) + destroy: function () { - if (this.scene && this._customViewport) - { - this.sceneManager.customViewports--; - } + this.shutdown(); - this.scene = scene; + this.events.off(SceneEvents.START, this.start, this); - var sys = scene.sys; + this.scene = null; + this.systems = null; + this.events = null; + } - this.sceneManager = sys.game.scene; - this.scaleManager = sys.scale; - this.cameraManager = sys.cameras; +}); - this.updateSystem(); +PluginCache.register('DisplayList', DisplayList, 'displayList'); - return this; - }, +module.exports = DisplayList; - /** - * Set the position of where the Camera is looking within the game. - * You can also modify the properties `Camera.scrollX` and `Camera.scrollY` directly. - * Use this method, or the scroll properties, to move your camera around the game world. - * - * This does not change where the camera viewport is placed. See `setPosition` to control that. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setScroll - * @since 3.0.0 - * - * @param {number} x - The x coordinate of the Camera in the game world. - * @param {number} [y=x] - The y coordinate of the Camera in the game world. - * - * @return {this} This Camera instance. - */ - setScroll: function (x, y) - { - if (y === undefined) { y = x; } - this.scrollX = x; - this.scrollY = y; +/***/ }), - return this; - }, +/***/ 89980: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Set the size of the Camera viewport. - * - * By default a Camera is the same size as the game, but can be made smaller via this method, - * allowing you to create mini-cam style effects by creating and positioning a smaller Camera - * viewport within your game. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setSize - * @since 3.0.0 - * - * @param {number} width - The width of the Camera viewport. - * @param {number} [height=width] - The height of the Camera viewport. - * - * @return {this} This Camera instance. - */ - setSize: function (width, height) - { - if (height === undefined) { height = width; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.width = width; - this.height = height; +var Class = __webpack_require__(56694); +var ComponentsToJSON = __webpack_require__(48129); +var DataManager = __webpack_require__(81078); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(56631); +var SceneEvents = __webpack_require__(7599); - return this; - }, +/** + * @classdesc + * The base class that all Game Objects extend. + * You don't create GameObjects directly and they cannot be added to the display list. + * Instead, use them as the base for your own custom classes. + * + * @class GameObject + * @memberof Phaser.GameObjects + * @extends Phaser.Events.EventEmitter + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. + * @param {string} type - A textual representation of the type of Game Object, i.e. `sprite`. + */ +var GameObject = new Class({ - /** - * This method sets the position and size of the Camera viewport in a single call. - * - * If you're trying to change where the Camera is looking at in your game, then see - * the method `Camera.setScroll` instead. This method is for changing the viewport - * itself, not what the camera can see. - * - * By default a Camera is the same size as the game, but can be made smaller via this method, - * allowing you to create mini-cam style effects by creating and positioning a smaller Camera - * viewport within your game. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setViewport - * @since 3.0.0 - * - * @param {number} x - The top-left x coordinate of the Camera viewport. - * @param {number} y - The top-left y coordinate of the Camera viewport. - * @param {number} width - The width of the Camera viewport. - * @param {number} [height=width] - The height of the Camera viewport. - * - * @return {this} This Camera instance. - */ - setViewport: function (x, y, width, height) - { - this.x = x; - this.y = y; - this.width = width; - this.height = height; + Extends: EventEmitter, - return this; - }, + initialize: - /** - * Set the zoom value of the Camera. - * - * Changing to a smaller value, such as 0.5, will cause the camera to 'zoom out'. - * Changing to a larger value, such as 2, will cause the camera to 'zoom in'. - * - * A value of 1 means 'no zoom' and is the default. - * - * Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering. - * - * As of Phaser 3.50 you can now set the horizontal and vertical zoom values independently. - * - * @method Phaser.Cameras.Scene2D.BaseCamera#setZoom - * @since 3.0.0 - * - * @param {number} [x=1] - The horizontal zoom value of the Camera. The minimum it can be is 0.001. - * @param {number} [y=x] - The vertical zoom value of the Camera. The minimum it can be is 0.001. - * - * @return {this} This Camera instance. - */ - setZoom: function (x, y) + function GameObject (scene, type) { - if (x === undefined) { x = 1; } - if (y === undefined) { y = x; } - - if (x === 0) - { - x = 0.001; - } + EventEmitter.call(this); - if (y === 0) - { - y = 0.001; - } + /** + * A reference to the Scene to which this Game Object belongs. + * + * Game Objects can only belong to one Scene. + * + * You should consider this property as being read-only. You cannot move a + * Game Object to another Scene by simply changing it. + * + * @name Phaser.GameObjects.GameObject#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; - this.zoomX = x; - this.zoomY = y; + /** + * Holds a reference to the Display List that contains this Game Object. + * + * This is set automatically when this Game Object is added to a Scene or Layer. + * + * You should treat this property as being read-only. + * + * @name Phaser.GameObjects.GameObject#displayList + * @type {(Phaser.GameObjects.DisplayList|Phaser.GameObjects.Layer)} + * @default null + * @since 3.50.0 + */ + this.displayList = null; - return this; - }, + /** + * A textual representation of this Game Object, i.e. `sprite`. + * Used internally by Phaser but is available for your own custom classes to populate. + * + * @name Phaser.GameObjects.GameObject#type + * @type {string} + * @since 3.0.0 + */ + this.type = type; + + /** + * The current state of this Game Object. + * + * Phaser itself will never modify this value, although plugins may do so. + * + * Use this property to track the state of a Game Object during its lifetime. For example, it could change from + * a state of 'moving', to 'attacking', to 'dead'. The state value should be an integer (ideally mapped to a constant + * in your game code), or a string. These are recommended to keep it light and simple, with fast comparisons. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @name Phaser.GameObjects.GameObject#state + * @type {(number|string)} + * @since 3.16.0 + */ + this.state = 0; + + /** + * The parent Container of this Game Object, if it has one. + * + * @name Phaser.GameObjects.GameObject#parentContainer + * @type {Phaser.GameObjects.Container} + * @since 3.4.0 + */ + this.parentContainer = null; + + /** + * The name of this Game Object. + * Empty by default and never populated by Phaser, this is left for developers to use. + * + * @name Phaser.GameObjects.GameObject#name + * @type {string} + * @default '' + * @since 3.0.0 + */ + this.name = ''; + + /** + * The active state of this Game Object. + * A Game Object with an active state of `true` is processed by the Scenes UpdateList, if added to it. + * An active object is one which is having its logic and internal systems updated. + * + * @name Phaser.GameObjects.GameObject#active + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.active = true; + + /** + * The Tab Index of the Game Object. + * Reserved for future use by plugins and the Input Manager. + * + * @name Phaser.GameObjects.GameObject#tabIndex + * @type {number} + * @default -1 + * @since 3.0.0 + */ + this.tabIndex = -1; + + /** + * A Data Manager. + * It allows you to store, query and get key/value paired information specific to this Game Object. + * `null` by default. Automatically created if you use `getData` or `setData` or `setDataEnabled`. + * + * @name Phaser.GameObjects.GameObject#data + * @type {Phaser.Data.DataManager} + * @default null + * @since 3.0.0 + */ + this.data = null; + + /** + * The flags that are compared against `RENDER_MASK` to determine if this Game Object will render or not. + * The bits are 0001 | 0010 | 0100 | 1000 set by the components Visible, Alpha, Transform and Texture respectively. + * If those components are not used by your custom class then you can use this bitmask as you wish. + * + * @name Phaser.GameObjects.GameObject#renderFlags + * @type {number} + * @default 15 + * @since 3.0.0 + */ + this.renderFlags = 15; + + /** + * A bitmask that controls if this Game Object is drawn by a Camera or not. + * Not usually set directly, instead call `Camera.ignore`, however you can + * set this property directly using the Camera.id property: + * + * @example + * this.cameraFilter |= camera.id + * + * @name Phaser.GameObjects.GameObject#cameraFilter + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.cameraFilter = 0; + + /** + * If this Game Object is enabled for input then this property will contain an InteractiveObject instance. + * Not usually set directly. Instead call `GameObject.setInteractive()`. + * + * @name Phaser.GameObjects.GameObject#input + * @type {?Phaser.Types.Input.InteractiveObject} + * @default null + * @since 3.0.0 + */ + this.input = null; + + /** + * If this Game Object is enabled for Arcade or Matter Physics then this property will contain a reference to a Physics Body. + * + * @name Phaser.GameObjects.GameObject#body + * @type {?(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody|MatterJS.BodyType)} + * @default null + * @since 3.0.0 + */ + this.body = null; + + /** + * This Game Object will ignore all calls made to its destroy method if this flag is set to `true`. + * This includes calls that may come from a Group, Container or the Scene itself. + * While it allows you to persist a Game Object across Scenes, please understand you are entirely + * responsible for managing references to and from this Game Object. + * + * @name Phaser.GameObjects.GameObject#ignoreDestroy + * @type {boolean} + * @default false + * @since 3.5.0 + */ + this.ignoreDestroy = false; + + this.on(Events.ADDED_TO_SCENE, this.addedToScene, this); + this.on(Events.REMOVED_FROM_SCENE, this.removedFromScene, this); + + // Tell the Scene to re-sort the children + scene.sys.queueDepthSort(); + }, /** - * Sets the mask to be applied to this Camera during rendering. - * - * The mask must have been previously created and can be either a GeometryMask or a BitmapMask. - * - * Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. - * - * If a mask is already set on this Camera it will be immediately replaced. - * - * Masks have no impact on physics or input detection. They are purely a rendering component - * that allows you to limit what is visible during the render pass. + * Sets the `active` property of this Game Object and returns this Game Object for further chaining. + * A Game Object with its `active` property set to `true` will be updated by the Scenes UpdateList. * - * @method Phaser.Cameras.Scene2D.BaseCamera#setMask - * @since 3.17.0 + * @method Phaser.GameObjects.GameObject#setActive + * @since 3.0.0 * - * @param {(Phaser.Display.Masks.BitmapMask|Phaser.Display.Masks.GeometryMask)} mask - The mask this Camera will use when rendering. - * @param {boolean} [fixedPosition=true] - Should the mask translate along with the Camera, or be fixed in place and not impacted by the Cameras transform? + * @param {boolean} value - True if this Game Object should be set as active, false if not. * - * @return {this} This Camera instance. + * @return {this} This GameObject. */ - setMask: function (mask, fixedPosition) + setActive: function (value) { - if (fixedPosition === undefined) { fixedPosition = true; } - - this.mask = mask; - - this._maskCamera = (fixedPosition) ? this.cameraManager.default : this; + this.active = value; return this; }, /** - * Clears the mask that this Camera was using. + * Sets the `name` property of this Game Object and returns this Game Object for further chaining. + * The `name` property is not populated by Phaser and is presented for your own use. * - * @method Phaser.Cameras.Scene2D.BaseCamera#clearMask - * @since 3.17.0 + * @method Phaser.GameObjects.GameObject#setName + * @since 3.0.0 * - * @param {boolean} [destroyMask=false] - Destroy the mask before clearing it? + * @param {string} value - The name to be given to this Game Object. * - * @return {this} This Camera instance. + * @return {this} This GameObject. */ - clearMask: function (destroyMask) + setName: function (value) { - if (destroyMask === undefined) { destroyMask = false; } - - if (destroyMask && this.mask) - { - this.mask.destroy(); - } - - this.mask = null; + this.name = value; return this; }, /** - * Sets the visibility of this Camera. + * Sets the current state of this Game Object. * - * An invisible Camera will skip rendering and input tests of everything it can see. + * Phaser itself will never modify the State of a Game Object, although plugins may do so. * - * @method Phaser.Cameras.Scene2D.BaseCamera#setVisible - * @since 3.10.0 + * For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'. + * The state value should typically be an integer (ideally mapped to a constant + * in your game code), but could also be a string. It is recommended to keep it light and simple. + * If you need to store complex data about your Game Object, look at using the Data Component instead. * - * @param {boolean} value - The visible state of the Camera. + * @method Phaser.GameObjects.GameObject#setState + * @since 3.16.0 * - * @return {this} This Camera instance. + * @param {(number|string)} value - The state of the Game Object. + * + * @return {this} This GameObject. */ + setState: function (value) + { + this.state = value; + + return this; + }, /** - * Returns an Object suitable for JSON storage containing all of the Camera viewport and rendering properties. + * Adds a Data Manager component to this Game Object. * - * @method Phaser.Cameras.Scene2D.BaseCamera#toJSON + * @method Phaser.GameObjects.GameObject#setDataEnabled * @since 3.0.0 + * @see Phaser.Data.DataManager * - * @return {Phaser.Types.Cameras.Scene2D.JSONCamera} A well-formed object suitable for conversion to JSON. + * @return {this} This GameObject. */ - toJSON: function () + setDataEnabled: function () { - var output = { - name: this.name, - x: this.x, - y: this.y, - width: this.width, - height: this.height, - zoom: this.zoom, - rotation: this.rotation, - roundPixels: this.roundPixels, - scrollX: this.scrollX, - scrollY: this.scrollY, - backgroundColor: this.backgroundColor.rgba - }; - - if (this.useBounds) + if (!this.data) { - output['bounds'] = { - x: this._bounds.x, - y: this._bounds.y, - width: this._bounds.width, - height: this._bounds.height - }; + this.data = new DataManager(this); } - return output; + return this; }, /** - * Internal method called automatically by the Camera Manager. + * Allows you to store a key value pair within this Game Objects Data Manager. * - * @method Phaser.Cameras.Scene2D.BaseCamera#update - * @protected + * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled + * before setting the value. + * + * If the key doesn't already exist in the Data Manager then it is created. + * + * ```javascript + * sprite.setData('name', 'Red Gem Stone'); + * ``` + * + * You can also pass in an object of key value pairs as the first argument: + * + * ```javascript + * sprite.setData({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 }); + * ``` + * + * To get a value back again you can call `getData`: + * + * ```javascript + * sprite.getData('gold'); + * ``` + * + * Or you can access the value directly via the `values` property, where it works like any other variable: + * + * ```javascript + * sprite.data.values.gold += 50; + * ``` + * + * When the value is first set, a `setdata` event is emitted from this Game Object. + * + * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. + * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. + * + * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. + * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. + * + * @method Phaser.GameObjects.GameObject#setData * @since 3.0.0 * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @generic {any} T + * @genericUse {(string|T)} - [key] + * + * @param {(string|object)} key - The key to set the value for. Or an object of key value pairs. If an object the `data` argument is ignored. + * @param {*} [data] - The value to set for the given key. If an object is provided as the key this argument is ignored. + * + * @return {this} This GameObject. */ - update: function () + setData: function (key, value) { - // NOOP + if (!this.data) + { + this.data = new DataManager(this); + } + + this.data.set(key, value); + + return this; }, /** - * Internal method called automatically when the viewport changes. + * Increase a value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is increased from 0. * - * @method Phaser.Cameras.Scene2D.BaseCamera#updateSystem - * @private - * @since 3.12.0 + * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled + * before setting the value. + * + * If the key doesn't already exist in the Data Manager then it is created. + * + * When the value is first set, a `setdata` event is emitted from this Game Object. + * + * @method Phaser.GameObjects.GameObject#incData + * @since 3.23.0 + * + * @generic {any} T + * @genericUse {(string|T)} - [key] + * + * @param {(string|object)} key - The key to increase the value for. + * @param {*} [data] - The value to increase for the given key. + * + * @return {this} This GameObject. */ - updateSystem: function () + incData: function (key, value) { - if (!this.scaleManager) + if (!this.data) { - return; + this.data = new DataManager(this); } - var custom = (this._x !== 0 || this._y !== 0 || this.scaleManager.width !== this._width || this.scaleManager.height !== this._height); - - var sceneManager = this.sceneManager; - - if (custom && !this._customViewport) - { - // We need a custom viewport for this Camera - sceneManager.customViewports++; - } - else if (!custom && this._customViewport) - { - // We're turning off a custom viewport for this Camera - sceneManager.customViewports--; - } + this.data.inc(key, value); - this.dirty = true; - this._customViewport = custom; + return this; }, /** - * Destroys this Camera instance and its internal properties and references. - * Once destroyed you cannot use this Camera again, even if re-added to a Camera Manager. + * Toggle a boolean value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is toggled from false. * - * This method is called automatically by `CameraManager.remove` if that methods `runDestroy` argument is `true`, which is the default. + * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled + * before setting the value. * - * Unless you have a specific reason otherwise, always use `CameraManager.remove` and allow it to handle the camera destruction, - * rather than calling this method directly. + * If the key doesn't already exist in the Data Manager then it is created. * - * @method Phaser.Cameras.Scene2D.BaseCamera#destroy - * @fires Phaser.Cameras.Scene2D.Events#DESTROY - * @since 3.0.0 + * When the value is first set, a `setdata` event is emitted from this Game Object. + * + * @method Phaser.GameObjects.GameObject#toggleData + * @since 3.23.0 + * + * @generic {any} T + * @genericUse {(string|T)} - [key] + * + * @param {(string|object)} key - The key to toggle the value for. + * + * @return {this} This GameObject. */ - destroy: function () + toggleData: function (key) { - this.emit(Events.DESTROY, this); - - this.removeAllListeners(); - - this.matrix.destroy(); - - this.culledObjects = []; - - if (this._customViewport) + if (!this.data) { - // We're turning off a custom viewport for this Camera - this.sceneManager.customViewports--; + this.data = new DataManager(this); } - this.renderList = []; - - this._bounds = null; + this.data.toggle(key); - this.scene = null; - this.scaleManager = null; - this.sceneManager = null; - this.cameraManager = null; + return this; }, /** - * The x position of the Camera viewport, relative to the top-left of the game canvas. - * The viewport is the area into which the camera renders. - * To adjust the position the camera is looking at in the game world, see the `scrollX` value. + * Retrieves the value for the given key in this Game Objects Data Manager, or undefined if it doesn't exist. * - * @name Phaser.Cameras.Scene2D.BaseCamera#x - * @type {number} + * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either: + * + * ```javascript + * sprite.getData('gold'); + * ``` + * + * Or access the value directly: + * + * ```javascript + * sprite.data.values.gold; + * ``` + * + * You can also pass in an array of keys, in which case an array of values will be returned: + * + * ```javascript + * sprite.getData([ 'gold', 'armor', 'health' ]); + * ``` + * + * This approach is useful for destructuring arrays in ES6. + * + * @method Phaser.GameObjects.GameObject#getData * @since 3.0.0 + * + * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys. + * + * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array. */ - x: { - - get: function () - { - return this._x; - }, - - set: function (value) + getData: function (key) + { + if (!this.data) { - this._x = value; - this.updateSystem(); + this.data = new DataManager(this); } + return this.data.get(key); }, /** - * The y position of the Camera viewport, relative to the top-left of the game canvas. - * The viewport is the area into which the camera renders. - * To adjust the position the camera is looking at in the game world, see the `scrollY` value. + * Pass this Game Object to the Input Manager to enable it for Input. * - * @name Phaser.Cameras.Scene2D.BaseCamera#y - * @type {number} + * Input works by using hit areas, these are nearly always geometric shapes, such as rectangles or circles, that act as the hit area + * for the Game Object. However, you can provide your own hit area shape and callback, should you wish to handle some more advanced + * input detection. + * + * If no arguments are provided it will try and create a rectangle hit area based on the texture frame the Game Object is using. If + * this isn't a texture-bound object, such as a Graphics or BitmapText object, this will fail, and you'll need to provide a specific + * shape for it to use. + * + * You can also provide an Input Configuration Object as the only argument to this method. + * + * @example + * sprite.setInteractive(); + * + * @example + * sprite.setInteractive(new Phaser.Geom.Circle(45, 46, 45), Phaser.Geom.Circle.Contains); + * + * @example + * graphics.setInteractive(new Phaser.Geom.Rectangle(0, 0, 128, 128), Phaser.Geom.Rectangle.Contains); + * + * @method Phaser.GameObjects.GameObject#setInteractive * @since 3.0.0 + * + * @param {(Phaser.Types.Input.InputConfiguration|any)} [hitArea] - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not given it will try to create a Rectangle based on the texture frame. + * @param {Phaser.Types.Input.HitAreaCallback} [callback] - The callback that determines if the pointer is within the Hit Area shape or not. If you provide a shape you must also provide a callback. + * @param {boolean} [dropZone=false] - Should this Game Object be treated as a drop zone target? + * + * @return {this} This GameObject. */ - y: { - - get: function () - { - return this._y; - }, - - set: function (value) - { - this._y = value; - this.updateSystem(); - } + setInteractive: function (hitArea, hitAreaCallback, dropZone) + { + this.scene.sys.input.enable(this, hitArea, hitAreaCallback, dropZone); + return this; }, /** - * The width of the Camera viewport, in pixels. + * If this Game Object has previously been enabled for input, this will disable it. * - * The viewport is the area into which the Camera renders. Setting the viewport does - * not restrict where the Camera can scroll to. + * An object that is disabled for input stops processing or being considered for + * input events, but can be turned back on again at any time by simply calling + * `setInteractive()` with no arguments provided. * - * @name Phaser.Cameras.Scene2D.BaseCamera#width - * @type {number} - * @since 3.0.0 + * If want to completely remove interaction from this Game Object then use `removeInteractive` instead. + * + * @method Phaser.GameObjects.GameObject#disableInteractive + * @since 3.7.0 + * + * @return {this} This GameObject. */ - width: { - - get: function () - { - return this._width; - }, - - set: function (value) - { - this._width = value; - this.updateSystem(); - } + disableInteractive: function () + { + this.scene.sys.input.disable(this); + return this; }, /** - * The height of the Camera viewport, in pixels. + * If this Game Object has previously been enabled for input, this will queue it + * for removal, causing it to no longer be interactive. The removal happens on + * the next game step, it is not immediate. * - * The viewport is the area into which the Camera renders. Setting the viewport does - * not restrict where the Camera can scroll to. + * The Interactive Object that was assigned to this Game Object will be destroyed, + * removed from the Input Manager and cleared from this Game Object. * - * @name Phaser.Cameras.Scene2D.BaseCamera#height - * @type {number} - * @since 3.0.0 + * If you wish to re-enable this Game Object at a later date you will need to + * re-create its InteractiveObject by calling `setInteractive` again. + * + * If you wish to only temporarily stop an object from receiving input then use + * `disableInteractive` instead, as that toggles the interactive state, where-as + * this erases it completely. + * + * If you wish to resize a hit area, don't remove and then set it as being + * interactive. Instead, access the hitarea object directly and resize the shape + * being used. I.e.: `sprite.input.hitArea.setSize(width, height)` (assuming the + * shape is a Rectangle, which it is by default.) + * + * @method Phaser.GameObjects.GameObject#removeInteractive + * @since 3.7.0 + * + * @return {this} This GameObject. */ - height: { + removeInteractive: function () + { + this.scene.sys.input.clear(this); - get: function () - { - return this._height; - }, + this.input = undefined; - set: function (value) - { - this._height = value; - this.updateSystem(); - } + return this; + }, + /** + * This callback is invoked when this Game Object is added to a Scene. + * + * Can be overriden by custom Game Objects, but be aware of some Game Objects that + * will use this, such as Sprites, to add themselves into the Update List. + * + * You can also listen for the `ADDED_TO_SCENE` event from this Game Object. + * + * @method Phaser.GameObjects.GameObject#addedToScene + * @since 3.50.0 + */ + addedToScene: function () + { }, /** - * The horizontal scroll position of this Camera. + * This callback is invoked when this Game Object is removed from a Scene. * - * Change this value to cause the Camera to scroll around your Scene. + * Can be overriden by custom Game Objects, but be aware of some Game Objects that + * will use this, such as Sprites, to removed themselves from the Update List. * - * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, - * will automatically adjust the Camera scroll values accordingly. + * You can also listen for the `REMOVED_FROM_SCENE` event from this Game Object. * - * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * @method Phaser.GameObjects.GameObject#removedFromScene + * @since 3.50.0 + */ + removedFromScene: function () + { + }, + + /** + * To be overridden by custom GameObjects. Allows base objects to be used in a Pool. * - * @name Phaser.Cameras.Scene2D.BaseCamera#scrollX - * @type {number} - * @default 0 + * @method Phaser.GameObjects.GameObject#update * @since 3.0.0 + * + * @param {...*} [args] - args */ - scrollX: { + update: function () + { + }, - get: function () - { - return this._scrollX; - }, + /** + * Returns a JSON representation of the Game Object. + * + * @method Phaser.GameObjects.GameObject#toJSON + * @since 3.0.0 + * + * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. + */ + toJSON: function () + { + return ComponentsToJSON(this); + }, - set: function (value) - { - this._scrollX = value; - this.dirty = true; - } + /** + * Compares the renderMask with the renderFlags to see if this Game Object will render or not. + * Also checks the Game Object against the given Cameras exclusion list. + * + * @method Phaser.GameObjects.GameObject#willRender + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against this Game Object. + * + * @return {boolean} True if the Game Object should be rendered, otherwise false. + */ + willRender: function (camera) + { + var listWillRender = (this.displayList && this.displayList.active) ? this.displayList.willRender(camera) : true; + return !(!listWillRender || GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); }, /** - * The vertical scroll position of this Camera. - * - * Change this value to cause the Camera to scroll around your Scene. + * Returns an array containing the display list index of either this Game Object, or if it has one, + * its parent Container. It then iterates up through all of the parent containers until it hits the + * root of the display list (which is index 0 in the returned array). * - * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method, - * will automatically adjust the Camera scroll values accordingly. + * Used internally by the InputPlugin but also useful if you wish to find out the display depth of + * this Game Object and all of its ancestors. * - * You can set the bounds within which the Camera can scroll via the `setBounds` method. + * @method Phaser.GameObjects.GameObject#getIndexList + * @since 3.4.0 * - * @name Phaser.Cameras.Scene2D.BaseCamera#scrollY - * @type {number} - * @default 0 - * @since 3.0.0 + * @return {number[]} An array of display list position indexes. */ - scrollY: { + getIndexList: function () + { + // eslint-disable-next-line consistent-this + var child = this; + var parent = this.parentContainer; - get: function () + var indexes = []; + + while (parent) { - return this._scrollY; - }, + indexes.unshift(parent.getIndex(child)); - set: function (value) + child = parent; + + if (!parent.parentContainer) + { + break; + } + else + { + parent = parent.parentContainer; + } + } + + if (this.displayList) { - this._scrollY = value; - this.dirty = true; + indexes.unshift(this.displayList.getIndex(child)); + } + else + { + indexes.unshift(this.scene.sys.displayList.getIndex(child)); } + return indexes; }, /** - * The Camera zoom value. Change this value to zoom in, or out of, a Scene. + * Adds this Game Object to the given Display List. * - * A value of 0.5 would zoom the Camera out, so you can now see twice as much - * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel - * now takes up 2 pixels when rendered. + * If no Display List is specified, it will default to the Display List owned by the Scene to which + * this Game Object belongs. * - * Set to 1 to return to the default zoom level. + * A Game Object can only exist on one Display List at any given time, but may move freely between them. * - * Be careful to never set this value to zero. + * If this Game Object is already on another Display List when this method is called, it will first + * be removed from it, before being added to the new list. * - * @name Phaser.Cameras.Scene2D.BaseCamera#zoom - * @type {number} - * @default 1 - * @since 3.0.0 + * You can query which list it is on by looking at the `Phaser.GameObjects.GameObject#displayList` property. + * + * If a Game Object isn't on any display list, it will not be rendered. If you just wish to temporarly + * disable it from rendering, consider using the `setVisible` method, instead. + * + * @method Phaser.GameObjects.GameObject#addToDisplayList + * @fires Phaser.Scenes.Events#ADDED_TO_SCENE + * @fires Phaser.GameObjects.Events#ADDED_TO_SCENE + * @since 3.53.0 + * + * @param {(Phaser.GameObjects.DisplayList|Phaser.GameObjects.Layer)} [displayList] - The Display List to add to. Defaults to the Scene Display List. + * + * @return {this} This Game Object. */ - zoom: { + addToDisplayList: function (displayList) + { + if (displayList === undefined) { displayList = this.scene.sys.displayList; } - get: function () + if (this.displayList && this.displayList !== displayList) { - return (this._zoomX + this._zoomY) / 2; - }, + this.removeFromDisplayList(); + } - set: function (value) + // Don't repeat if it's already on this list + if (!displayList.exists(this)) { - this._zoomX = value; - this._zoomY = value; + this.displayList = displayList; - this.dirty = true; + displayList.add(this, true); + + displayList.queueDepthSort(); + + this.emit(Events.ADDED_TO_SCENE, this, this.scene); + + displayList.events.emit(SceneEvents.ADDED_TO_SCENE, this, this.scene); } + return this; }, /** - * The Camera horizontal zoom value. Change this value to zoom in, or out of, a Scene. + * Adds this Game Object to the Update List belonging to the Scene. * - * A value of 0.5 would zoom the Camera out, so you can now see twice as much - * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel - * now takes up 2 pixels when rendered. + * When a Game Object is added to the Update List it will have its `preUpdate` method called + * every game frame. This method is passed two parameters: `delta` and `time`. * - * Set to 1 to return to the default zoom level. + * If you wish to run your own logic within `preUpdate` then you should always call + * `super.preUpdate(delta, time)` within it, or it may fail to process required operations, + * such as Sprite animations. * - * Be careful to never set this value to zero. + * @method Phaser.GameObjects.GameObject#addToUpdateList + * @since 3.53.0 * - * @name Phaser.Cameras.Scene2D.BaseCamera#zoomX - * @type {number} - * @default 1 - * @since 3.50.0 + * @return {this} This Game Object. */ - zoomX: { - - get: function () - { - return this._zoomX; - }, - - set: function (value) + addToUpdateList: function () + { + if (this.scene && this.preUpdate) { - this._zoomX = value; - this.dirty = true; + this.scene.sys.updateList.add(this); } + return this; }, /** - * The Camera vertical zoom value. Change this value to zoom in, or out of, a Scene. + * Removes this Game Object from the Display List it is currently on. * - * A value of 0.5 would zoom the Camera out, so you can now see twice as much - * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel - * now takes up 2 pixels when rendered. + * A Game Object can only exist on one Display List at any given time, but may move freely removed + * and added back at a later stage. * - * Set to 1 to return to the default zoom level. + * You can query which list it is on by looking at the `Phaser.GameObjects.GameObject#displayList` property. * - * Be careful to never set this value to zero. + * If a Game Object isn't on any Display List, it will not be rendered. If you just wish to temporarly + * disable it from rendering, consider using the `setVisible` method, instead. * - * @name Phaser.Cameras.Scene2D.BaseCamera#zoomY - * @type {number} - * @default 1 - * @since 3.50.0 + * @method Phaser.GameObjects.GameObject#removeFromDisplayList + * @fires Phaser.Scenes.Events#REMOVED_FROM_SCENE + * @fires Phaser.GameObjects.Events#REMOVED_FROM_SCENE + * @since 3.53.0 + * + * @return {this} This Game Object. */ - zoomY: { + removeFromDisplayList: function () + { + var displayList = this.displayList || this.scene.sys.displayList; - get: function () + if (displayList && displayList.exists(this)) { - return this._zoomY; - }, + displayList.remove(this, true); - set: function (value) - { - this._zoomY = value; - this.dirty = true; + displayList.queueDepthSort(); + + this.displayList = null; + + this.emit(Events.REMOVED_FROM_SCENE, this, this.scene); + + displayList.events.emit(SceneEvents.REMOVED_FROM_SCENE, this, this.scene); } + return this; }, /** - * The rotation of the Camera in radians. + * Removes this Game Object from the Scene's Update List. * - * Camera rotation always takes place based on the Camera viewport. By default, rotation happens - * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. + * When a Game Object is on the Update List, it will have its `preUpdate` method called + * every game frame. Calling this method will remove it from the list, preventing this. * - * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not - * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. + * Removing a Game Object from the Update List will stop most internal functions working. + * For example, removing a Sprite from the Update List will prevent it from being able to + * run animations. * - * @name Phaser.Cameras.Scene2D.BaseCamera#rotation - * @type {number} - * @private - * @default 0 - * @since 3.11.0 + * @method Phaser.GameObjects.GameObject#removeFromUpdateList + * @since 3.53.0 + * + * @return {this} This Game Object. */ - rotation: { - - get: function () - { - return this._rotation; - }, - - set: function (value) + removeFromUpdateList: function () + { + if (this.scene && this.preUpdate) { - this._rotation = value; - this.dirty = true; + this.scene.sys.updateList.remove(this); } + return this; }, /** - * The horizontal position of the center of the Camera's viewport, relative to the left of the game canvas. + * Destroys this Game Object removing it from the Display List and Update List and + * severing all ties to parent resources. * - * @name Phaser.Cameras.Scene2D.BaseCamera#centerX - * @type {number} - * @readonly - * @since 3.10.0 + * Also removes itself from the Input Manager and Physics Manager if previously enabled. + * + * Use this to remove a Game Object from your game if you don't ever plan to use it again. + * As long as no reference to it exists within your own code it should become free for + * garbage collection by the browser. + * + * If you just want to temporarily disable an object then look at using the + * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected. + * + * @method Phaser.GameObjects.GameObject#destroy + * @fires Phaser.GameObjects.Events#DESTROY + * @since 3.0.0 + * + * @param {boolean} [fromScene=false] - `True` if this Game Object is being destroyed by the Scene, `false` if not. */ - centerX: { + destroy: function (fromScene) + { + // This Game Object has already been destroyed + if (!this.scene || this.ignoreDestroy) + { + return; + } - get: function () + if (fromScene === undefined) { fromScene = false; } + + if (this.preDestroy) { - return this.x + (0.5 * this.width); + this.preDestroy.call(this); } - }, + this.emit(Events.DESTROY, this, fromScene); - /** - * The vertical position of the center of the Camera's viewport, relative to the top of the game canvas. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#centerY - * @type {number} - * @readonly - * @since 3.10.0 - */ - centerY: { + this.removeAllListeners(); - get: function () + if (this.postPipelines) { - return this.y + (0.5 * this.height); + this.resetPostPipeline(true); } - }, + this.removeFromDisplayList(); + this.removeFromUpdateList(); - /** - * The displayed width of the camera viewport, factoring in the camera zoom level. - * - * If a camera has a viewport width of 800 and a zoom of 0.5 then its display width - * would be 1600, as it's displaying twice as many pixels as zoom level 1. - * - * Equally, a camera with a width of 800 and zoom of 2 would have a display width - * of 400 pixels. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#displayWidth - * @type {number} - * @readonly - * @since 3.11.0 - */ - displayWidth: { + if (this.input) + { + this.scene.sys.input.clear(this); - get: function () + this.input = undefined; + } + + if (this.data) { - return this.width / this.zoomX; + this.data.destroy(); + + this.data = undefined; } - }, + if (this.body) + { + this.body.destroy(); - /** - * The displayed height of the camera viewport, factoring in the camera zoom level. - * - * If a camera has a viewport height of 600 and a zoom of 0.5 then its display height - * would be 1200, as it's displaying twice as many pixels as zoom level 1. - * - * Equally, a camera with a height of 600 and zoom of 2 would have a display height - * of 300 pixels. - * - * @name Phaser.Cameras.Scene2D.BaseCamera#displayHeight - * @type {number} - * @readonly - * @since 3.11.0 - */ - displayHeight: { + this.body = undefined; + } - get: function () + if (this.preFX) { - return this.height / this.zoomY; + this.preFX.destroy(); + + this.preFX = undefined; + } + + if (this.postFX) + { + this.postFX.destroy(); + + this.postFX = undefined; } + this.active = false; + this.visible = false; + + this.scene = undefined; + this.parentContainer = undefined; } }); -module.exports = BaseCamera; +/** + * The bitmask that `GameObject.renderFlags` is compared against to determine if the Game Object will render or not. + * + * @constant {number} RENDER_MASK + * @memberof Phaser.GameObjects.GameObject + * @default + */ +GameObject.RENDER_MASK = 15; + +module.exports = GameObject; /***/ }), -/* 134 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 99325: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Back = __webpack_require__(334); -var Bounce = __webpack_require__(335); -var Circular = __webpack_require__(336); -var Cubic = __webpack_require__(337); -var Elastic = __webpack_require__(338); -var Expo = __webpack_require__(339); -var Linear = __webpack_require__(340); -var Quadratic = __webpack_require__(341); -var Quartic = __webpack_require__(342); -var Quintic = __webpack_require__(343); -var Sine = __webpack_require__(344); -var Stepped = __webpack_require__(345); +var Class = __webpack_require__(56694); +var PluginCache = __webpack_require__(91963); +var SceneEvents = __webpack_require__(7599); -// EaseMap -module.exports = { +/** + * @classdesc + * The Game Object Creator is a Scene plugin that allows you to quickly create many common + * types of Game Objects and return them using a configuration object, rather than + * having to specify a limited set of parameters such as with the GameObjectFactory. + * + * Game Objects made via this class are automatically added to the Scene and Update List + * unless you explicitly set the `add` property in the configuration object to `false`. + * + * @class GameObjectCreator + * @memberof Phaser.GameObjects + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object Factory belongs. + */ +var GameObjectCreator = new Class({ - Power0: Linear, - Power1: Quadratic.Out, - Power2: Cubic.Out, - Power3: Quartic.Out, - Power4: Quintic.Out, + initialize: - Linear: Linear, - Quad: Quadratic.Out, - Cubic: Cubic.Out, - Quart: Quartic.Out, - Quint: Quintic.Out, - Sine: Sine.Out, - Expo: Expo.Out, - Circ: Circular.Out, - Elastic: Elastic.Out, - Back: Back.Out, - Bounce: Bounce.Out, - Stepped: Stepped, + function GameObjectCreator (scene) + { + /** + * The Scene to which this Game Object Creator belongs. + * + * @name Phaser.GameObjects.GameObjectCreator#scene + * @type {Phaser.Scene} + * @protected + * @since 3.0.0 + */ + this.scene = scene; - 'Quad.easeIn': Quadratic.In, - 'Cubic.easeIn': Cubic.In, - 'Quart.easeIn': Quartic.In, - 'Quint.easeIn': Quintic.In, - 'Sine.easeIn': Sine.In, - 'Expo.easeIn': Expo.In, - 'Circ.easeIn': Circular.In, - 'Elastic.easeIn': Elastic.In, - 'Back.easeIn': Back.In, - 'Bounce.easeIn': Bounce.In, + /** + * A reference to the Scene.Systems. + * + * @name Phaser.GameObjects.GameObjectCreator#systems + * @type {Phaser.Scenes.Systems} + * @protected + * @since 3.0.0 + */ + this.systems = scene.sys; - 'Quad.easeOut': Quadratic.Out, - 'Cubic.easeOut': Cubic.Out, - 'Quart.easeOut': Quartic.Out, - 'Quint.easeOut': Quintic.Out, - 'Sine.easeOut': Sine.Out, - 'Expo.easeOut': Expo.Out, - 'Circ.easeOut': Circular.Out, - 'Elastic.easeOut': Elastic.Out, - 'Back.easeOut': Back.Out, - 'Bounce.easeOut': Bounce.Out, + /** + * A reference to the Scene Event Emitter. + * + * @name Phaser.GameObjects.GameObjectCreator#events + * @type {Phaser.Events.EventEmitter} + * @protected + * @since 3.50.0 + */ + this.events = scene.sys.events; - 'Quad.easeInOut': Quadratic.InOut, - 'Cubic.easeInOut': Cubic.InOut, - 'Quart.easeInOut': Quartic.InOut, - 'Quint.easeInOut': Quintic.InOut, - 'Sine.easeInOut': Sine.InOut, - 'Expo.easeInOut': Expo.InOut, - 'Circ.easeInOut': Circular.InOut, - 'Elastic.easeInOut': Elastic.InOut, - 'Back.easeInOut': Back.InOut, - 'Bounce.easeInOut': Bounce.InOut + /** + * A reference to the Scene Display List. + * + * @name Phaser.GameObjects.GameObjectCreator#displayList + * @type {Phaser.GameObjects.DisplayList} + * @protected + * @since 3.0.0 + */ + this.displayList; -}; + /** + * A reference to the Scene Update List. + * + * @name Phaser.GameObjects.GameObjectCreator#updateList + * @type {Phaser.GameObjects.UpdateList} + * @protected + * @since 3.0.0 + */ + this.updateList; + this.events.once(SceneEvents.BOOT, this.boot, this); + this.events.on(SceneEvents.START, this.start, this); + }, -/***/ }), -/* 135 */ -/***/ (function(module, exports) { + /** + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. + * + * @method Phaser.GameObjects.GameObjectCreator#boot + * @private + * @since 3.5.1 + */ + boot: function () + { + this.displayList = this.systems.displayList; + this.updateList = this.systems.updateList; + + this.events.once(SceneEvents.DESTROY, this.destroy, this); + }, + + /** + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. + * + * @method Phaser.GameObjects.GameObjectCreator#start + * @private + * @since 3.5.0 + */ + start: function () + { + this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); + }, + + /** + * The Scene that owns this plugin is shutting down. + * We need to kill and reset all internal properties as well as stop listening to Scene events. + * + * @method Phaser.GameObjects.GameObjectCreator#shutdown + * @private + * @since 3.0.0 + */ + shutdown: function () + { + this.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); + }, + + /** + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. + * + * @method Phaser.GameObjects.GameObjectCreator#destroy + * @private + * @since 3.0.0 + */ + destroy: function () + { + this.shutdown(); + + this.events.off(SceneEvents.START, this.start, this); + + this.scene = null; + this.systems = null; + this.events = null; + + this.displayList = null; + this.updateList = null; + } + +}); /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Static method called directly by the Game Object creator functions. + * With this method you can register a custom GameObject factory in the GameObjectCreator, + * providing a name (`factoryType`) and the constructor (`factoryFunction`) in order + * to be called when you invoke Phaser.Scene.make[ factoryType ] method. + * + * @method Phaser.GameObjects.GameObjectCreator.register + * @static + * @since 3.0.0 + * + * @param {string} factoryType - The key of the factory that you will use to call to Phaser.Scene.make[ factoryType ] method. + * @param {function} factoryFunction - The constructor function to be called when you invoke to the Phaser.Scene.make method. */ +GameObjectCreator.register = function (factoryType, factoryFunction) +{ + if (!GameObjectCreator.prototype.hasOwnProperty(factoryType)) + { + GameObjectCreator.prototype[factoryType] = factoryFunction; + } +}; /** - * Calculates a linear (interpolation) value over t. + * Static method called directly by the Game Object Creator functions. * - * @function Phaser.Math.Linear - * @since 3.0.0 + * With this method you can remove a custom Game Object Creator that has been previously + * registered in the Game Object Creator. Pass in its `factoryType` in order to remove it. * - * @param {number} p0 - The first point. - * @param {number} p1 - The second point. - * @param {number} t - The percentage between p0 and p1 to return, represented as a number between 0 and 1. + * @method Phaser.GameObjects.GameObjectCreator.remove + * @static + * @since 3.0.0 * - * @return {number} The step t% of the way between p0 and p1. + * @param {string} factoryType - The key of the factory that you want to remove from the GameObjectCreator. */ -var Linear = function (p0, p1, t) +GameObjectCreator.remove = function (factoryType) { - return (p1 - p0) * t + p0; + if (GameObjectCreator.prototype.hasOwnProperty(factoryType)) + { + delete GameObjectCreator.prototype[factoryType]; + } }; -module.exports = Linear; +PluginCache.register('GameObjectCreator', GameObjectCreator, 'make'); + +module.exports = GameObjectCreator; /***/ }), -/* 136 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 61286: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var OS = __webpack_require__(105); +var Class = __webpack_require__(56694); +var PluginCache = __webpack_require__(91963); +var SceneEvents = __webpack_require__(7599); /** - * Determines the browser type and version running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.browser` from within any Scene. - * - * @typedef {object} Phaser.Device.Browser + * @classdesc + * The Game Object Factory is a Scene plugin that allows you to quickly create many common + * types of Game Objects and have them automatically registered with the Scene. + * + * Game Objects directly register themselves with the Factory and inject their own creation + * methods into the class. + * + * @class GameObjectFactory + * @memberof Phaser.GameObjects + * @constructor * @since 3.0.0 - * - * @property {boolean} chrome - Set to true if running in Chrome. - * @property {boolean} edge - Set to true if running in Microsoft Edge browser. - * @property {boolean} firefox - Set to true if running in Firefox. - * @property {boolean} ie - Set to true if running in Internet Explorer 11 or less (not Edge). - * @property {boolean} mobileSafari - Set to true if running in Mobile Safari. - * @property {boolean} opera - Set to true if running in Opera. - * @property {boolean} safari - Set to true if running in Safari. - * @property {boolean} silk - Set to true if running in the Silk browser (as used on the Amazon Kindle) - * @property {boolean} trident - Set to true if running a Trident version of Internet Explorer (IE11+) - * @property {number} chromeVersion - If running in Chrome this will contain the major version number. - * @property {number} firefoxVersion - If running in Firefox this will contain the major version number. - * @property {number} ieVersion - If running in Internet Explorer this will contain the major version number. Beyond IE10 you should use Browser.trident and Browser.tridentVersion. - * @property {number} safariVersion - If running in Safari this will contain the major version number. - * @property {number} tridentVersion - If running in Internet Explorer 11 this will contain the major version number. See {@link http://msdn.microsoft.com/en-us/library/ie/ms537503(v=vs.85).aspx} + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object Factory belongs. */ -var Browser = { +var GameObjectFactory = new Class({ - chrome: false, - chromeVersion: 0, - edge: false, - firefox: false, - firefoxVersion: 0, - ie: false, - ieVersion: 0, - mobileSafari: false, - opera: false, - safari: false, - safariVersion: 0, - silk: false, - trident: false, - tridentVersion: 0 + initialize: -}; + function GameObjectFactory (scene) + { + /** + * The Scene to which this Game Object Factory belongs. + * + * @name Phaser.GameObjects.GameObjectFactory#scene + * @type {Phaser.Scene} + * @protected + * @since 3.0.0 + */ + this.scene = scene; -function init () -{ - var ua = navigator.userAgent; + /** + * A reference to the Scene.Systems. + * + * @name Phaser.GameObjects.GameObjectFactory#systems + * @type {Phaser.Scenes.Systems} + * @protected + * @since 3.0.0 + */ + this.systems = scene.sys; - if ((/Edge\/\d+/).test(ua)) - { - Browser.edge = true; - } - else if ((/Chrome\/(\d+)/).test(ua) && !OS.windowsPhone) - { - Browser.chrome = true; - Browser.chromeVersion = parseInt(RegExp.$1, 10); - } - else if ((/Firefox\D+(\d+)/).test(ua)) - { - Browser.firefox = true; - Browser.firefoxVersion = parseInt(RegExp.$1, 10); - } - else if ((/AppleWebKit/).test(ua) && OS.iOS) - { - Browser.mobileSafari = true; - } - else if ((/MSIE (\d+\.\d+);/).test(ua)) - { - Browser.ie = true; - Browser.ieVersion = parseInt(RegExp.$1, 10); - } - else if ((/Opera/).test(ua)) + /** + * A reference to the Scene Event Emitter. + * + * @name Phaser.GameObjects.GameObjectFactory#events + * @type {Phaser.Events.EventEmitter} + * @protected + * @since 3.50.0 + */ + this.events = scene.sys.events; + + /** + * A reference to the Scene Display List. + * + * @name Phaser.GameObjects.GameObjectFactory#displayList + * @type {Phaser.GameObjects.DisplayList} + * @protected + * @since 3.0.0 + */ + this.displayList; + + /** + * A reference to the Scene Update List. + * + * @name Phaser.GameObjects.GameObjectFactory#updateList + * @type {Phaser.GameObjects.UpdateList} + * @protected + * @since 3.0.0 + */ + this.updateList; + + this.events.once(SceneEvents.BOOT, this.boot, this); + this.events.on(SceneEvents.START, this.start, this); + }, + + /** + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. + * + * @method Phaser.GameObjects.GameObjectFactory#boot + * @private + * @since 3.5.1 + */ + boot: function () { - Browser.opera = true; - } - else if ((/Safari/).test(ua) && !OS.windowsPhone) + this.displayList = this.systems.displayList; + this.updateList = this.systems.updateList; + + this.events.once(SceneEvents.DESTROY, this.destroy, this); + }, + + /** + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. + * + * @method Phaser.GameObjects.GameObjectFactory#start + * @private + * @since 3.5.0 + */ + start: function () { - Browser.safari = true; - } - else if ((/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/).test(ua)) + this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); + }, + + /** + * Adds an existing Game Object to this Scene. + * + * If the Game Object renders, it will be added to the Display List. + * If it has a `preUpdate` method, it will be added to the Update List. + * + * @method Phaser.GameObjects.GameObjectFactory#existing + * @since 3.0.0 + * + * @generic {(Phaser.GameObjects.GameObject|Phaser.GameObjects.Group|Phaser.GameObjects.Layer)} G - [child,$return] + * + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.Group|Phaser.GameObjects.Layer)} child - The child to be added to this Scene. + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was added. + */ + existing: function (child) { - Browser.ie = true; - Browser.trident = true; - Browser.tridentVersion = parseInt(RegExp.$1, 10); - Browser.ieVersion = parseInt(RegExp.$3, 10); - } + if (child.renderCanvas || child.renderWebGL) + { + this.displayList.add(child); + } - // Silk gets its own if clause because its ua also contains 'Safari' - if ((/Silk/).test(ua)) + // For when custom objects have overridden `preUpdate` but don't hook into the ADDED_TO_SCENE event: + // Adding to the list multiple times is safe, as it won't add duplicates into the list anyway. + if (child.preUpdate) + { + this.updateList.add(child); + } + + return child; + }, + + /** + * The Scene that owns this plugin is shutting down. + * We need to kill and reset all internal properties as well as stop listening to Scene events. + * + * @method Phaser.GameObjects.GameObjectFactory#shutdown + * @private + * @since 3.0.0 + */ + shutdown: function () { - Browser.silk = true; - } + this.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); + }, - return Browser; -} + /** + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. + * + * @method Phaser.GameObjects.GameObjectFactory#destroy + * @private + * @since 3.0.0 + */ + destroy: function () + { + this.shutdown(); -module.exports = init(); + this.events.off(SceneEvents.START, this.start, this); + this.scene = null; + this.systems = null; + this.events = null; -/***/ }), -/* 137 */ -/***/ (function(module, exports) { + this.displayList = null; + this.updateList = null; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +}); /** - * Generate a random floating point number between the two given bounds, minimum inclusive, maximum exclusive. + * Static method called directly by the Game Object factory functions. + * With this method you can register a custom GameObject factory in the GameObjectFactory, + * providing a name (`factoryType`) and the constructor (`factoryFunction`) in order + * to be called when you call to Phaser.Scene.add[ factoryType ] method. * - * @function Phaser.Math.FloatBetween + * @method Phaser.GameObjects.GameObjectFactory.register + * @static * @since 3.0.0 * - * @param {number} min - The lower bound for the float, inclusive. - * @param {number} max - The upper bound for the float exclusive. - * - * @return {number} A random float within the given range. + * @param {string} factoryType - The key of the factory that you will use to call to Phaser.Scene.add[ factoryType ] method. + * @param {function} factoryFunction - The constructor function to be called when you invoke to the Phaser.Scene.add method. */ -var FloatBetween = function (min, max) +GameObjectFactory.register = function (factoryType, factoryFunction) { - return Math.random() * (max - min) + min; + if (!GameObjectFactory.prototype.hasOwnProperty(factoryType)) + { + GameObjectFactory.prototype[factoryType] = factoryFunction; + } }; -module.exports = FloatBetween; - - -/***/ }), -/* 138 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - /** - * Checks if the given `width` and `height` are a power of two. - * Useful for checking texture dimensions. + * Static method called directly by the Game Object factory functions. + * With this method you can remove a custom GameObject factory registered in the GameObjectFactory, + * providing a its `factoryType`. * - * @function Phaser.Math.Pow2.IsSize + * @method Phaser.GameObjects.GameObjectFactory.remove + * @static * @since 3.0.0 * - * @param {number} width - The width. - * @param {number} height - The height. - * - * @return {boolean} `true` if `width` and `height` are a power of two, otherwise `false`. + * @param {string} factoryType - The key of the factory that you want to remove from the GameObjectFactory. */ -var IsSizePowerOfTwo = function (width, height) +GameObjectFactory.remove = function (factoryType) { - return (width > 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0); + if (GameObjectFactory.prototype.hasOwnProperty(factoryType)) + { + delete GameObjectFactory.prototype[factoryType]; + } }; -module.exports = IsSizePowerOfTwo; +PluginCache.register('GameObjectFactory', GameObjectFactory, 'add'); + +module.exports = GameObjectFactory; /***/ }), -/* 139 */ -/***/ (function(module, exports) { + +/***/ 73329: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var TransformMatrix = __webpack_require__(69360); + +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); + +var result = { camera: tempMatrix1, sprite: tempMatrix2, calc: tempMatrix3 }; + /** - * Snap a value to nearest grid slice, using ceil. + * Calculates the Transform Matrix of the given Game Object and Camera, factoring in + * the parent matrix if provided. * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`. - * As will `14` snap to `15`... but `16` will snap to `20`. + * Note that the object this results contains _references_ to the Transform Matrices, + * not new instances of them. Therefore, you should use their values immediately, or + * copy them to your own matrix, as they will be replaced as soon as another Game + * Object is rendered. * - * @function Phaser.Math.Snap.Ceil - * @since 3.0.0 + * @function Phaser.GameObjects.GetCalcMatrix + * @memberof Phaser.GameObjects + * @since 3.50.0 * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * @param {Phaser.GameObjects.GameObject} src - The Game Object to calculate the transform matrix for. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera being used to render the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - The transform matrix of the parent container, if any. * - * @return {number} The snapped value. + * @return {Phaser.Types.GameObjects.GetCalcMatrixResults} The results object containing the updated transform matrices. */ -var SnapCeil = function (value, gap, start, divide) +var GetCalcMatrix = function (src, camera, parentMatrix) { - if (start === undefined) { start = 0; } + var camMatrix = tempMatrix1; + var spriteMatrix = tempMatrix2; + var calcMatrix = tempMatrix3; - if (gap === 0) + spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); + + camMatrix.copyFrom(camera.matrix); + + if (parentMatrix) { - return value; + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = src.x; + spriteMatrix.f = src.y; + } + else + { + spriteMatrix.e -= camera.scrollX * src.scrollFactorX; + spriteMatrix.f -= camera.scrollY * src.scrollFactorY; } - value -= start; - value = gap * Math.ceil(value / gap); + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); - return (divide) ? (start + value) / gap : start + value; + return result; }; -module.exports = SnapCeil; +module.exports = GetCalcMatrix; /***/ }), -/* 140 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 92034: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - -var Class = __webpack_require__(0); +var Class = __webpack_require__(56694); +var ProcessQueue = __webpack_require__(74623); +var PluginCache = __webpack_require__(91963); +var SceneEvents = __webpack_require__(7599); /** * @classdesc - * A representation of a vector in 4D space. + * The Update List plugin. * - * A four-component vector. + * Update Lists belong to a Scene and maintain the list Game Objects to be updated every frame. * - * @class Vector4 - * @memberof Phaser.Math + * Some or all of these Game Objects may also be part of the Scene's [Display List]{@link Phaser.GameObjects.DisplayList}, for Rendering. + * + * @class UpdateList + * @extends Phaser.Structs.ProcessQueue. + * @memberof Phaser.GameObjects * @constructor * @since 3.0.0 * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - * @param {number} [w] - The w component. + * @param {Phaser.Scene} scene - The Scene that the Update List belongs to. */ -var Vector4 = new Class({ +var UpdateList = new Class({ + + Extends: ProcessQueue, initialize: - function Vector4 (x, y, z, w) + function UpdateList (scene) { + ProcessQueue.call(this); + + // No duplicates in this list + this.checkQueue = true; + /** - * The x component of this Vector. + * The Scene that the Update List belongs to. * - * @name Phaser.Math.Vector4#x - * @type {number} - * @default 0 + * @name Phaser.GameObjects.UpdateList#scene + * @type {Phaser.Scene} * @since 3.0.0 */ - this.x = 0; + this.scene = scene; /** - * The y component of this Vector. + * The Scene's Systems. * - * @name Phaser.Math.Vector4#y - * @type {number} - * @default 0 + * @name Phaser.GameObjects.UpdateList#systems + * @type {Phaser.Scenes.Systems} * @since 3.0.0 */ - this.y = 0; + this.systems = scene.sys; /** - * The z component of this Vector. + * The `pending` list is a selection of items which are due to be made 'active' in the next update. * - * @name Phaser.Math.Vector4#z - * @type {number} - * @default 0 - * @since 3.0.0 + * @name Phaser.GameObjects.UpdateList#_pending + * @type {Array.<*>} + * @private + * @default [] + * @since 3.20.0 */ - this.z = 0; /** - * The w component of this Vector. + * The `active` list is a selection of items which are considered active and should be updated. * - * @name Phaser.Math.Vector4#w + * @name Phaser.GameObjects.UpdateList#_active + * @type {Array.<*>} + * @private + * @default [] + * @since 3.20.0 + */ + + /** + * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. + * + * @name Phaser.GameObjects.UpdateList#_destroy + * @type {Array.<*>} + * @private + * @default [] + * @since 3.20.0 + */ + + /** + * The total number of items awaiting processing. + * + * @name Phaser.GameObjects.UpdateList#_toProcess * @type {number} + * @private * @default 0 * @since 3.0.0 */ - this.w = 0; - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - this.w = x.w || 0; - } - else - { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = w || 0; - } + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** - * Make a clone of this Vector4. - * - * @method Phaser.Math.Vector4#clone - * @since 3.0.0 + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. * - * @return {Phaser.Math.Vector4} A clone of this Vector4. + * @method Phaser.GameObjects.UpdateList#boot + * @private + * @since 3.5.1 */ - clone: function () + boot: function () { - return new Vector4(this.x, this.y, this.z, this.w); + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** - * Copy the components of a given Vector into this Vector. - * - * @method Phaser.Math.Vector4#copy - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} src - The Vector to copy the components from. + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. * - * @return {Phaser.Math.Vector4} This Vector4. + * @method Phaser.GameObjects.UpdateList#start + * @private + * @since 3.5.0 */ - copy: function (src) + start: function () { - this.x = src.x; - this.y = src.y; - this.z = src.z || 0; - this.w = src.w || 0; + var eventEmitter = this.systems.events; - return this; + eventEmitter.on(SceneEvents.PRE_UPDATE, this.update, this); + eventEmitter.on(SceneEvents.UPDATE, this.sceneUpdate, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * Check whether this Vector is equal to a given Vector. - * - * Performs a strict quality check against each Vector's components. + * The update step. * - * @method Phaser.Math.Vector4#equals - * @since 3.0.0 + * Pre-updates every active Game Object in the list. * - * @param {Phaser.Math.Vector4} v - The vector to check equality with. + * @method Phaser.GameObjects.UpdateList#sceneUpdate + * @since 3.20.0 * - * @return {boolean} A boolean indicating whether the two Vectors are equal or not. + * @param {number} time - The current timestamp. + * @param {number} delta - The delta time elapsed since the last frame. */ - equals: function (v) + sceneUpdate: function (time, delta) { - return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z) && (this.w === v.w)); - }, + var list = this._active; + var length = list.length; - /** - * Set the `x`, `y`, `z` and `w` components of the this Vector to the given `x`, `y`, `z` and `w` values. - * - * @method Phaser.Math.Vector4#set - * @since 3.0.0 - * - * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y, z and w components. - * @param {number} y - The y value to set for this Vector. - * @param {number} z - The z value to set for this Vector. - * @param {number} w - The z value to set for this Vector. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - set: function (x, y, z, w) - { - if (typeof x === 'object') - { - this.x = x.x || 0; - this.y = x.y || 0; - this.z = x.z || 0; - this.w = x.w || 0; - } - else + for (var i = 0; i < length; i++) { - this.x = x || 0; - this.y = y || 0; - this.z = z || 0; - this.w = w || 0; - } + var gameObject = list[i]; - return this; + if (gameObject.active) + { + gameObject.preUpdate.call(gameObject, time, delta); + } + } }, /** - * Add a given Vector to this Vector. Addition is component-wise. - * - * @method Phaser.Math.Vector4#add - * @since 3.0.0 + * The Scene that owns this plugin is shutting down. * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to add to this Vector. + * We need to kill and reset all internal properties as well as stop listening to Scene events. * - * @return {Phaser.Math.Vector4} This Vector4. + * @method Phaser.GameObjects.UpdateList#shutdown + * @since 3.0.0 */ - add: function (v) + shutdown: function () { - this.x += v.x; - this.y += v.y; - this.z += v.z || 0; - this.w += v.w || 0; + var i = this._active.length; - return this; - }, + while (i--) + { + this._active[i].destroy(true); + } - /** - * Subtract the given Vector from this Vector. Subtraction is component-wise. - * - * @method Phaser.Math.Vector4#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to subtract from this Vector. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - subtract: function (v) - { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z || 0; - this.w -= v.w || 0; + i = this._pending.length; - return this; - }, + while (i--) + { + this._pending[i].destroy(true); + } - /** - * Scale this Vector by the given value. - * - * @method Phaser.Math.Vector4#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Vector by. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - scale: function (scale) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; + i = this._destroy.length; - return this; - }, + while (i--) + { + this._destroy[i].destroy(true); + } - /** - * Calculate the length (or magnitude) of this Vector. - * - * @method Phaser.Math.Vector4#length - * @since 3.0.0 - * - * @return {number} The length of this Vector. - */ - length: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; + this._toProcess = 0; - return Math.sqrt(x * x + y * y + z * z + w * w); - }, + this._pending = []; + this._active = []; + this._destroy = []; - /** - * Calculate the length of this Vector squared. - * - * @method Phaser.Math.Vector4#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Vector, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; + this.removeAllListeners(); - return x * x + y * y + z * z + w * w; + var eventEmitter = this.systems.events; + + eventEmitter.off(SceneEvents.PRE_UPDATE, this.update, this); + eventEmitter.off(SceneEvents.UPDATE, this.sceneUpdate, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * Normalize this Vector. + * The Scene that owns this plugin is being destroyed. * - * Makes the vector a unit length vector (magnitude of 1) in the same direction. + * We need to shutdown and then kill off all external references. * - * @method Phaser.Math.Vector4#normalize + * @method Phaser.GameObjects.UpdateList#destroy * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4. */ - normalize: function () + destroy: function () { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - var len = x * x + y * y + z * z + w * w; - - if (len > 0) - { - len = 1 / Math.sqrt(len); + this.shutdown(); - this.x = x * len; - this.y = y * len; - this.z = z * len; - this.w = w * len; - } + this.systems.events.off(SceneEvents.START, this.start, this); - return this; - }, + this.scene = null; + this.systems = null; + } /** - * Calculate the dot product of this Vector and the given Vector. + * Adds a new item to the Update List. * - * @method Phaser.Math.Vector4#dot + * The item is added to the pending list and made active in the next update. + * + * @method Phaser.GameObjects.UpdateList#add * @since 3.0.0 * - * @param {Phaser.Math.Vector4} v - The Vector4 to dot product with this Vector4. + * @param {*} item - The item to add to the queue. * - * @return {number} The dot product of this Vector and the given Vector. + * @return {*} The item that was added. */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - }, /** - * Linearly interpolate between this Vector and the given Vector. + * Removes an item from the Update List. * - * Interpolates this Vector towards the given Vector. + * The item is added to the pending destroy and fully removed in the next update. * - * @method Phaser.Math.Vector4#lerp + * @method Phaser.GameObjects.UpdateList#remove * @since 3.0.0 * - * @param {Phaser.Math.Vector4} v - The Vector4 to interpolate towards. - * @param {number} [t=0] - The interpolation percentage, between 0 and 1. + * @param {*} item - The item to be removed from the queue. * - * @return {Phaser.Math.Vector4} This Vector4. + * @return {*} The item that was removed. */ - lerp: function (v, t) - { - if (t === undefined) { t = 0; } - - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; - - this.x = ax + t * (v.x - ax); - this.y = ay + t * (v.y - ay); - this.z = az + t * (v.z - az); - this.w = aw + t * (v.w - aw); - - return this; - }, /** - * Perform a component-wise multiplication between this Vector and the given Vector. - * - * Multiplies this Vector by the given Vector. + * Removes all active items from this Update List. * - * @method Phaser.Math.Vector4#multiply - * @since 3.0.0 + * All the items are marked as 'pending destroy' and fully removed in the next update. * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to multiply this Vector by. + * @method Phaser.GameObjects.UpdateList#removeAll + * @since 3.20.0 * - * @return {Phaser.Math.Vector4} This Vector4. + * @return {this} This Update List object. */ - multiply: function (v) - { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z || 1; - this.w *= v.w || 1; - - return this; - }, /** - * Perform a component-wise division between this Vector and the given Vector. + * Update this queue. First it will process any items awaiting destruction, and remove them. * - * Divides this Vector by the given Vector. + * Then it will check to see if there are any items pending insertion, and move them to an + * active state. Finally, it will return a list of active items for further processing. * - * @method Phaser.Math.Vector4#divide + * @method Phaser.GameObjects.UpdateList#update * @since 3.0.0 * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to divide this Vector by. - * - * @return {Phaser.Math.Vector4} This Vector4. + * @return {Array.<*>} A list of active items. */ - divide: function (v) - { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z || 1; - this.w /= v.w || 1; - - return this; - }, /** - * Calculate the distance between this Vector and the given Vector. + * Returns the current list of active items. * - * @method Phaser.Math.Vector4#distance - * @since 3.0.0 + * This method returns a reference to the active list array, not a copy of it. + * Therefore, be careful to not modify this array outside of the ProcessQueue. * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. + * @method Phaser.GameObjects.UpdateList#getActive + * @since 3.0.0 * - * @return {number} The distance from this Vector to the given Vector. + * @return {Array.<*>} A list of active items. */ - distance: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - var dw = v.w - this.w || 0; - - return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw); - }, /** - * Calculate the distance between this Vector and the given Vector, squared. - * - * @method Phaser.Math.Vector4#distanceSq - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. + * The number of entries in the active list. * - * @return {number} The distance from this Vector to the given Vector, squared. + * @name Phaser.GameObjects.UpdateList#length + * @type {number} + * @readonly + * @since 3.20.0 */ - distanceSq: function (v) - { - var dx = v.x - this.x; - var dy = v.y - this.y; - var dz = v.z - this.z || 0; - var dw = v.w - this.w || 0; +}); - return dx * dx + dy * dy + dz * dz + dw * dw; - }, +PluginCache.register('UpdateList', UpdateList, 'updateList'); - /** - * Negate the `x`, `y`, `z` and `w` components of this Vector. - * - * @method Phaser.Math.Vector4#negate - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - negate: function () - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - this.w = -this.w; +module.exports = UpdateList; - return this; - }, - /** - * Transform this Vector with the given Matrix. - * - * @method Phaser.Math.Vector4#transformMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector4 with. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - transformMat4: function (mat) - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - var m = mat.val; - - this.x = m[0] * x + m[4] * y + m[8] * z + m[12] * w; - this.y = m[1] * x + m[5] * y + m[9] * z + m[13] * w; - this.z = m[2] * x + m[6] * y + m[10] * z + m[14] * w; - this.w = m[3] * x + m[7] * y + m[11] * z + m[15] * w; +/***/ }), - return this; - }, +/***/ 8810: +/***/ ((module) => { - /** - * Transform this Vector with the given Quaternion. - * - * @method Phaser.Math.Vector4#transformQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - transformQuat: function (q) - { - var x = this.x; - var y = this.y; - var z = this.z; - var qx = q.x; - var qy = q.y; - var qz = q.z; - var qw = q.w; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // calculate quat * vec - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = -qx * x - qy * y - qz * z; +/** + * Renders one character of the Bitmap Text to the WebGL Pipeline. + * + * @function BatchChar + * @since 3.50.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The WebGLPipeline. Must have a `batchQuad` method. + * @param {Phaser.GameObjects.BitmapText} src - The BitmapText Game Object. + * @param {Phaser.Types.GameObjects.BitmapText.BitmapTextCharacter} char - The character to render. + * @param {Phaser.Types.GameObjects.BitmapText.BitmapFontCharacterData} glyph - The character glyph. + * @param {number} offsetX - The x offset. + * @param {number} offsetY - The y offset. + * @param {Phaser.GameObjects.Components.TransformMatrix} calcMatrix - The transform matrix. + * @param {boolean} roundPixels - Round the transform values or not? + * @param {number} tintTL - Top-left tint value. + * @param {number} tintTR - Top-right tint value. + * @param {number} tintBL - Bottom-left tint value. + * @param {number} tintBR - Bottom-right tint value. + * @param {number} tintEffect - The tint effect mode. + * @param {WebGLTexture} texture - The WebGL texture. + * @param {number} textureUnit - The texture unit. + */ +var BatchChar = function (pipeline, src, char, glyph, offsetX, offsetY, calcMatrix, roundPixels, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit) +{ + var x = (char.x - src.displayOriginX) + offsetX; + var y = (char.y - src.displayOriginY) + offsetY; - // calculate result * inverse quat - this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; - this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; - this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; + var xw = x + char.w; + var yh = y + char.h; - return this; - }, + var tx0 = calcMatrix.getXRound(x, y, roundPixels); + var ty0 = calcMatrix.getYRound(x, y, roundPixels); - /** - * Make this Vector the zero vector (0, 0, 0, 0). - * - * @method Phaser.Math.Vector4#reset - * @since 3.0.0 - * - * @return {Phaser.Math.Vector4} This Vector4. - */ - reset: function () - { - this.x = 0; - this.y = 0; - this.z = 0; - this.w = 0; + var tx1 = calcMatrix.getXRound(x, yh, roundPixels); + var ty1 = calcMatrix.getYRound(x, yh, roundPixels); - return this; - } + var tx2 = calcMatrix.getXRound(xw, yh, roundPixels); + var ty2 = calcMatrix.getYRound(xw, yh, roundPixels); -}); + var tx3 = calcMatrix.getXRound(xw, y, roundPixels); + var ty3 = calcMatrix.getYRound(xw, y, roundPixels); -Vector4.prototype.sub = Vector4.prototype.subtract; -Vector4.prototype.mul = Vector4.prototype.multiply; -Vector4.prototype.div = Vector4.prototype.divide; -Vector4.prototype.dist = Vector4.prototype.distance; -Vector4.prototype.distSq = Vector4.prototype.distanceSq; -Vector4.prototype.len = Vector4.prototype.length; -Vector4.prototype.lenSq = Vector4.prototype.lengthSq; + pipeline.batchQuad(src, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, glyph.u0, glyph.v0, glyph.u1, glyph.v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); +}; -module.exports = Vector4; +module.exports = BatchChar; /***/ }), -/* 141 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 82173: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Events = __webpack_require__(91); - /** - * @classdesc - * A Render Target encapsulates a WebGL framebuffer and the WebGL Texture that displays it. + * Calculate the full bounds, in local and world space, of a BitmapText Game Object. * - * Instances of this class are typically created by, and belong to WebGL Pipelines, however - * other Game Objects and classes can take advantage of Render Targets as well. + * Returns a BitmapTextSize object that contains global and local variants of the Game Objects x and y coordinates and + * its width and height. Also includes an array of the line lengths and all word positions. * - * @class RenderTarget - * @memberof Phaser.Renderer.WebGL - * @constructor - * @since 3.50.0 + * The global position and size take into account the Game Object's position and scale. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the WebGLRenderer. - * @param {number} width - The width of this Render Target. - * @param {number} height - The height of this Render Target. - * @param {number} [scale=1] - A value between 0 and 1. Controls the size of this Render Target in relation to the Renderer. - * @param {number} [minFilter=0] - The minFilter mode of the texture when created. 0 is `LINEAR`, 1 is `NEAREST`. - * @param {boolean} [autoClear=true] - Automatically clear this framebuffer when bound? - * @param {boolean} [autoResize=false] - Automatically resize this Render Target if the WebGL Renderer resizes? + * The local position and size just takes into account the font data. + * + * @function GetBitmapTextSize + * @since 3.0.0 + * @private + * + * @param {(Phaser.GameObjects.DynamicBitmapText|Phaser.GameObjects.BitmapText)} src - The BitmapText to calculate the bounds values for. + * @param {boolean} [round=false] - Whether to round the positions to the nearest integer. + * @param {boolean} [updateOrigin=false] - Whether to update the origin of the BitmapText after bounds calculations? + * @param {object} [out] - Object to store the results in, to save constant object creation. If not provided an empty object is returned. + * + * @return {Phaser.Types.GameObjects.BitmapText.BitmapTextSize} The calculated bounds values of the BitmapText. */ -var RenderTarget = new Class({ +var GetBitmapTextSize = function (src, round, updateOrigin, out) +{ + if (updateOrigin === undefined) { updateOrigin = false; } - initialize: + if (out === undefined) + { + out = { + local: { + x: 0, + y: 0, + width: 0, + height: 0 + }, + global: { + x: 0, + y: 0, + width: 0, + height: 0 + }, + lines: { + shortest: 0, + longest: 0, + lengths: null, + height: 0 + }, + wrappedText: '', + words: [], + characters: [], + scaleX: 0, + scaleY: 0 + }; + + return out; + } + + var text = src.text; + var textLength = text.length; + var maxWidth = src.maxWidth; + var wordWrapCharCode = src.wordWrapCharCode; + + var bx = Number.MAX_VALUE; + var by = Number.MAX_VALUE; + var bw = 0; + var bh = 0; + + var chars = src.fontData.chars; + var lineHeight = src.fontData.lineHeight; + var letterSpacing = src.letterSpacing; + var lineSpacing = src.lineSpacing; + + var xAdvance = 0; + var yAdvance = 0; + + var charCode = 0; + + var glyph = null; + + var align = src._align; + + var x = 0; + var y = 0; + + var scale = (src.fontSize / src.fontData.size); + var sx = scale * src.scaleX; + var sy = scale * src.scaleY; + + var lastGlyph = null; + var lastCharCode = 0; + var lineWidths = []; + var shortestLine = Number.MAX_VALUE; + var longestLine = 0; + var currentLine = 0; + var currentLineWidth = 0; + + var i; + var words = []; + var characters = []; + var current = null; - function RenderTarget (renderer, width, height, scale, minFilter, autoClear, autoResize) + // Scan for breach of maxWidth and insert carriage-returns + if (maxWidth > 0) { - if (scale === undefined) { scale = 1; } - if (minFilter === undefined) { minFilter = 0; } - if (autoClear === undefined) { autoClear = true; } - if (autoResize === undefined) { autoResize = false; } + for (i = 0; i < textLength; i++) + { + charCode = text.charCodeAt(i); - /** - * A reference to the WebGLRenderer instance. - * - * @name Phaser.Renderer.WebGL.RenderTarget#renderer - * @type {Phaser.Renderer.WebGL.WebGLRenderer} - * @since 3.50.0 - */ - this.renderer = renderer; + if (charCode === 10) + { + if (current !== null) + { + words.push({ + word: current.word, + i: current.i, + x: current.x * sx, + y: current.y * sy, + w: current.w * sx, + h: current.h * sy, + cr: true + }); - /** - * The WebGLFramebuffer of this Render Target. - * - * This is created in the `RenderTarget.resize` method. - * - * @name Phaser.Renderer.WebGL.RenderTarget#framebuffer - * @type {WebGLFramebuffer} - * @since 3.50.0 - */ - this.framebuffer = null; + current = null; + } - /** - * The WebGLTexture of this Render Target. - * - * This is created in the `RenderTarget.resize` method. - * - * @name Phaser.Renderer.WebGL.RenderTarget#texture - * @type {WebGLTexture} - * @since 3.50.0 - */ - this.texture = null; + xAdvance = 0; + yAdvance += lineHeight + lineSpacing; + lastGlyph = null; - /** - * The width of the texture. - * - * @name Phaser.Renderer.WebGL.RenderTarget#width - * @type {number} - * @readonly - * @since 3.50.0 - */ - this.width = 0; + continue; + } - /** - * The height of the texture. - * - * @name Phaser.Renderer.WebGL.RenderTarget#height - * @type {number} - * @readonly - * @since 3.50.0 - */ - this.height = 0; + glyph = chars[charCode]; - /** - * A value between 0 and 1. Controls the size of this Render Target in relation to the Renderer. - * - * A value of 1 matches it. 0.5 makes the Render Target half the size of the renderer, etc. - * - * @name Phaser.Renderer.WebGL.RenderTarget#scale - * @type {number} - * @since 3.50.0 - */ - this.scale = scale; + if (!glyph) + { + continue; + } - /** - * The minFilter mode of the texture. 0 is `LINEAR`, 1 is `NEAREST`. - * - * @name Phaser.Renderer.WebGL.RenderTarget#minFilter - * @type {number} - * @since 3.50.0 - */ - this.minFilter = minFilter; + if (lastGlyph !== null) + { + var glyphKerningOffset = glyph.kerning[lastCharCode]; + } - /** - * Controls if this Render Target is automatically cleared (via `gl.COLOR_BUFFER_BIT`) - * during the `RenderTarget.bind` method. - * - * If you need more control over how, or if, the target is cleared, you can disable - * this via the config on creation, or even toggle it directly at runtime. - * - * @name Phaser.Renderer.WebGL.RenderTarget#autoClear - * @type {boolean} - * @since 3.50.0 - */ - this.autoClear = autoClear; + if (charCode === wordWrapCharCode) + { + if (current !== null) + { + words.push({ + word: current.word, + i: current.i, + x: current.x * sx, + y: current.y * sy, + w: current.w * sx, + h: current.h * sy, + cr: false + }); - /** - * Does this Render Target automatically resize when the WebGL Renderer does? - * - * Modify this property via the `setAutoResize` method. - * - * @name Phaser.Renderer.WebGL.RenderTarget#autoResize - * @type {boolean} - * @readonly - * @since 3.50.0 - */ - this.autoResize = false; + current = null; + } + } + else + { + if (current === null) + { + // We're starting a new word, recording the starting index, etc + current = { word: '', i: i, x: xAdvance, y: yAdvance, w: 0, h: lineHeight, cr: false }; + } - this.resize(width, height); + current.word = current.word.concat(text[i]); + current.w += glyph.xOffset + glyph.xAdvance + ((glyphKerningOffset !== undefined) ? glyphKerningOffset : 0); + } - if (autoResize) + xAdvance += glyph.xAdvance + letterSpacing; + lastGlyph = glyph; + lastCharCode = charCode; + } + + // Last word + if (current !== null) { - this.setAutoResize(true); + words.push({ + word: current.word, + i: current.i, + x: current.x * sx, + y: current.y * sy, + w: current.w * sx, + h: current.h * sy, + cr: false + }); } - }, - /** - * Sets if this Render Target should automatically resize when the WebGL Renderer - * emits a resize event. - * - * @method Phaser.Renderer.WebGL.RenderTarget#setAutoResize - * @since 3.50.0 - * - * @param {boolean} autoResize - Automatically resize this Render Target when the WebGL Renderer resizes? - * - * @return {this} This RenderTarget instance. - */ - setAutoResize: function (autoResize) - { - if (autoResize && !this.autoResize) + // Reset for the next loop + xAdvance = 0; + yAdvance = 0; + lastGlyph = null; + lastCharCode = 0; + + // Loop through the words array and see if we've got any > maxWidth + var prev; + var offset = 0; + var crs = []; + + for (i = 0; i < words.length; i++) { - this.renderer.on(Events.RESIZE, this.resize, this); + var entry = words[i]; + var left = entry.x; + var right = entry.x + entry.w; - this.autoResize = true; + if (prev) + { + var diff = left - (prev.x + prev.w); + + offset = left - (diff + prev.w); + + prev = null; + } + + var checkLeft = left - offset; + var checkRight = right - offset; + + if (checkLeft > maxWidth || checkRight > maxWidth) + { + crs.push(entry.i - 1); + + if (entry.cr) + { + crs.push(entry.i + entry.word.length); + + offset = 0; + prev = null; + } + else + { + prev = entry; + } + } + else if (entry.cr) + { + crs.push(entry.i + entry.word.length); + + offset = 0; + prev = null; + } } - else if (!autoResize && this.autoResize) + + var stringInsert = function (str, index, value) { - this.renderer.off(Events.RESIZE, this.resize, this); + return str.substr(0, index) + value + str.substr(index + 1); + }; - this.autoResize = false; + for (i = crs.length - 1; i >= 0; i--) + { + // eslint-disable-next-line quotes + text = stringInsert(text, crs[i], "\n"); } - return this; - }, + out.wrappedText = text; - /** - * Resizes this Render Target. - * - * Deletes both the frame buffer and texture, if they exist and then re-creates - * them using the new sizes. - * - * This method is called automatically by the pipeline during its resize handler. - * - * @method Phaser.Renderer.WebGL.RenderTarget#resize - * @since 3.50.0 - * - * @param {number} width - The new width of this Render Target. - * @param {number} height - The new height of this Render Target. - * - * @return {this} This RenderTarget instance. - */ - resize: function (width, height) + textLength = text.length; + + // Recalculated in the next loop + words = []; + current = null; + } + + var charIndex = 0; + + for (i = 0; i < textLength; i++) { - var scaledWidth = width * this.scale; - var scaledHeight = height * this.scale; + charCode = text.charCodeAt(i); - if (scaledWidth !== this.width || scaledHeight !== this.height) + if (charCode === 10) { - var renderer = this.renderer; - - renderer.deleteFramebuffer(this.framebuffer); + if (current !== null) + { + words.push({ + word: current.word, + i: current.i, + x: current.x * sx, + y: current.y * sy, + w: current.w * sx, + h: current.h * sy + }); - renderer.deleteTexture(this.texture); + current = null; + } - width *= this.scale; - height *= this.scale; + xAdvance = 0; + yAdvance += lineHeight + lineSpacing; + lastGlyph = null; - width = Math.round(width); - height = Math.round(height); + lineWidths[currentLine] = currentLineWidth; - if (width <= 0) + if (currentLineWidth > longestLine) { - width = 1; + longestLine = currentLineWidth; } - if (height <= 0) + if (currentLineWidth < shortestLine) { - height = 1; + shortestLine = currentLineWidth; } - this.texture = renderer.createTextureFromSource(null, width, height, this.minFilter); - this.framebuffer = renderer.createFramebuffer(width, height, this.texture, false); + currentLine++; + currentLineWidth = 0; - this.width = width; - this.height = height; + continue; } - return this; - }, + glyph = chars[charCode]; - /** - * Pushes this Render Target as the current frame buffer of the renderer. - * - * If `autoClear` is set, then clears the texture. - * - * If `adjustViewport` is `true` then it will flush the renderer and then adjust the GL viewport. - * - * @method Phaser.Renderer.WebGL.RenderTarget#bind - * @since 3.50.0 - * - * @param {boolean} [adjustViewport=false] - Adjust the GL viewport by calling `RenderTarget.adjustViewport` ? - * @param {number} [width] - Optional new width of this Render Target. - * @param {number} [height] - Optional new height of this Render Target. - */ - bind: function (adjustViewport, width, height) - { - if (adjustViewport === undefined) { adjustViewport = false; } + if (!glyph) + { + continue; + } - if (adjustViewport) + x = xAdvance; + y = yAdvance; + + if (lastGlyph !== null) { - this.renderer.flush(); + var kerningOffset = glyph.kerning[lastCharCode]; + + x += (kerningOffset !== undefined) ? kerningOffset : 0; } - if (width && height) + if (bx > x) { - this.resize(width, height); + bx = x; } - this.renderer.pushFramebuffer(this.framebuffer, false, false, false); + if (by > y) + { + by = y; + } - if (adjustViewport) + var gw = x + glyph.xAdvance; + var gh = y + lineHeight; + + if (bw < gw) { - this.adjustViewport(); + bw = gw; } - if (this.autoClear) + if (bh < gh) { - var gl = this.renderer.gl; + bh = gh; + } - gl.clearColor(0, 0, 0, 0); + var charWidth = glyph.xOffset + glyph.xAdvance + ((kerningOffset !== undefined) ? kerningOffset : 0); - gl.clear(gl.COLOR_BUFFER_BIT); + if (charCode === wordWrapCharCode) + { + if (current !== null) + { + words.push({ + word: current.word, + i: current.i, + x: current.x * sx, + y: current.y * sy, + w: current.w * sx, + h: current.h * sy + }); + + current = null; + } } - }, + else + { + if (current === null) + { + // We're starting a new word, recording the starting index, etc + current = { word: '', i: charIndex, x: xAdvance, y: yAdvance, w: 0, h: lineHeight }; + } - /** - * Adjusts the GL viewport to match the width and height of this Render Target. - * - * Also disables `SCISSOR_TEST`. - * - * @method Phaser.Renderer.WebGL.RenderTarget#adjustViewport - * @since 3.50.0 - */ - adjustViewport: function () - { - var gl = this.renderer.gl; + current.word = current.word.concat(text[i]); + current.w += charWidth; + } - gl.viewport(0, 0, this.width, this.height); + characters.push({ + i: charIndex, + idx: i, + char: text[i], + code: charCode, + x: (glyph.xOffset + x) * scale, + y: (glyph.yOffset + yAdvance) * scale, + w: glyph.width * scale, + h: glyph.height * scale, + t: yAdvance * scale, + r: gw * scale, + b: lineHeight * scale, + line: currentLine, + glyph: glyph + }); - gl.disable(gl.SCISSOR_TEST); - }, + xAdvance += glyph.xAdvance + letterSpacing + ((kerningOffset !== undefined) ? kerningOffset : 0); + lastGlyph = glyph; + lastCharCode = charCode; + currentLineWidth = gw * scale; + charIndex++; + } - /** - * Clears this Render Target. - * - * @method Phaser.Renderer.WebGL.RenderTarget#clear - * @since 3.50.0 - */ - clear: function () + // Last word + if (current !== null) { - var renderer = this.renderer; - var gl = renderer.gl; + words.push({ + word: current.word, + i: current.i, + x: current.x * sx, + y: current.y * sy, + w: current.w * sx, + h: current.h * sy + }); + } - renderer.pushFramebuffer(this.framebuffer); + lineWidths[currentLine] = currentLineWidth; - gl.disable(gl.SCISSOR_TEST); + if (currentLineWidth > longestLine) + { + longestLine = currentLineWidth; + } - gl.clearColor(0, 0, 0, 0); + if (currentLineWidth < shortestLine) + { + shortestLine = currentLineWidth; + } - gl.clear(gl.COLOR_BUFFER_BIT); + // Adjust all of the character positions based on alignment + if (align > 0) + { + for (var c = 0; c < characters.length; c++) + { + var currentChar = characters[c]; - renderer.popFramebuffer(); + if (align === 1) + { + var ax1 = ((longestLine - lineWidths[currentChar.line]) / 2); - renderer.resetScissor(); - }, + currentChar.x += ax1; + currentChar.r += ax1; + } + else if (align === 2) + { + var ax2 = (longestLine - lineWidths[currentChar.line]); - /** - * Unbinds this Render Target and optionally flushes the WebGL Renderer first. - * - * @name Phaser.Renderer.WebGL.RenderTarget#unbind - * @since 3.50.0 - * - * @param {boolean} [flush=false] - Flush the WebGL Renderer before unbinding? - * - * @return {WebGLFramebuffer} The Framebuffer that was set, or `null` if there aren't any more in the stack. - */ - unbind: function (flush) - { - if (flush === undefined) { flush = false; } + currentChar.x += ax2; + currentChar.r += ax2; + } + } + } - var renderer = this.renderer; + var local = out.local; + var global = out.global; + var lines = out.lines; - if (flush) - { - renderer.flush(); - } + local.x = bx * scale; + local.y = by * scale; + local.width = bw * scale; + local.height = bh * scale; - return renderer.popFramebuffer(); - }, + global.x = (src.x - src._displayOriginX) + (bx * sx); + global.y = (src.y - src._displayOriginY) + (by * sy); - /** - * Removes all external references from this class and deletes the - * WebGL framebuffer and texture instances. - * - * Does not remove this Render Target from the parent pipeline. - * - * @name Phaser.Renderer.WebGL.RenderTarget#destroy - * @since 3.50.0 - */ - destroy: function () + global.width = bw * sx; + global.height = bh * sy; + + lines.shortest = shortestLine; + lines.longest = longestLine; + lines.lengths = lineWidths; + + if (round) { - var renderer = this.renderer; + local.x = Math.ceil(local.x); + local.y = Math.ceil(local.y); + local.width = Math.ceil(local.width); + local.height = Math.ceil(local.height); - renderer.deleteFramebuffer(this.framebuffer); - renderer.deleteTexture(this.texture); + global.x = Math.ceil(global.x); + global.y = Math.ceil(global.y); + global.width = Math.ceil(global.width); + global.height = Math.ceil(global.height); - renderer.off(Events.RESIZE, this.resize, this); + lines.shortest = Math.ceil(shortestLine); + lines.longest = Math.ceil(longestLine); + } - this.renderer = null; - this.framebuffer = null; - this.texture = null; + if (updateOrigin) + { + src._displayOriginX = (src.originX * local.width); + src._displayOriginY = (src.originY * local.height); + + global.x = src.x - (src._displayOriginX * src.scaleX); + global.y = src.y - (src._displayOriginY * src.scaleY); + + if (round) + { + global.x = Math.ceil(global.x); + global.y = Math.ceil(global.y); + } } -}); + out.words = words; + out.characters = characters; + out.lines.height = lineHeight; + out.scale = scale; + out.scaleX = src.scaleX; + out.scaleY = src.scaleY; -module.exports = RenderTarget; + return out; +}; + +module.exports = GetBitmapTextSize; /***/ }), -/* 142 */ -/***/ (function(module, exports) { + +/***/ 68298: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var ParseXMLBitmapFont = __webpack_require__(31476); + /** - * Adds the given element to the DOM. If a parent is provided the element is added as a child of the parent, providing it was able to access it. - * If no parent was given it falls back to using `document.body`. + * Parse an XML Bitmap Font from an Atlas. * - * @function Phaser.DOM.AddToDOM + * Adds the parsed Bitmap Font data to the cache with the `fontName` key. + * + * @function ParseFromAtlas * @since 3.0.0 + * @private * - * @param {HTMLElement} element - The element to be added to the DOM. Usually a Canvas object. - * @param {(string|HTMLElement)} [parent] - The parent in which to add the element. Can be a string which is passed to `getElementById` or an actual DOM object. + * @param {Phaser.Scene} scene - The Scene to parse the Bitmap Font for. + * @param {string} fontName - The key of the font to add to the Bitmap Font cache. + * @param {string} textureKey - The key of the BitmapFont's texture. + * @param {string} frameKey - The key of the BitmapFont texture's frame. + * @param {string} xmlKey - The key of the XML data of the font to parse. + * @param {number} [xSpacing] - The x-axis spacing to add between each letter. + * @param {number} [ySpacing] - The y-axis spacing to add to the line height. * - * @return {HTMLElement} The element that was added to the DOM. + * @return {boolean} Whether the parsing was successful or not. */ -var AddToDOM = function (element, parent) +var ParseFromAtlas = function (scene, fontName, textureKey, frameKey, xmlKey, xSpacing, ySpacing) { - var target; + var texture = scene.sys.textures.get(textureKey); + var frame = texture.get(frameKey); + var xml = scene.sys.cache.xml.get(xmlKey); - if (parent) - { - if (typeof parent === 'string') - { - // Hopefully an element ID - target = document.getElementById(parent); - } - else if (typeof parent === 'object' && parent.nodeType === 1) - { - // Quick test for a HTMLElement - target = parent; - } - } - else if (element.parentElement || parent === null) + if (frame && xml) { - return element; - } + var data = ParseXMLBitmapFont(xml, frame, xSpacing, ySpacing, texture); - // Fallback, covers an invalid ID and a non HTMLElement object - if (!target) + scene.sys.cache.bitmapFont.add(fontName, { data: data, texture: textureKey, frame: frameKey, fromAtlas: true }); + + return true; + } + else { - target = document.body; + return false; } - - target.appendChild(element); - - return element; }; -module.exports = AddToDOM; +module.exports = ParseFromAtlas; /***/ }), -/* 143 */ -/***/ (function(module, exports) { + +/***/ 39860: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var GetValue = __webpack_require__(10850); + /** - * Keyboard Codes. + * Parses a Retro Font configuration object so you can pass it to the BitmapText constructor + * and create a BitmapText object using a fixed-width retro font. * - * @namespace Phaser.Input.Keyboard.KeyCodes - * @memberof Phaser.Input.Keyboard + * @function Phaser.GameObjects.RetroFont.Parse * @since 3.0.0 + * + * @param {Phaser.Scene} scene - A reference to the Phaser Scene. + * @param {Phaser.Types.GameObjects.BitmapText.RetroFontConfig} config - The font configuration object. + * + * @return {Phaser.Types.GameObjects.BitmapText.BitmapFontData} A parsed Bitmap Font data entry for the Bitmap Font cache. */ +var ParseRetroFont = function (scene, config) +{ + var w = config.width; + var h = config.height; -var KeyCodes = { - - /** - * The BACKSPACE key. - * - * @name Phaser.Input.Keyboard.KeyCodes.BACKSPACE - * @type {number} - * @since 3.0.0 - */ - BACKSPACE: 8, + var cx = Math.floor(w / 2); + var cy = Math.floor(h / 2); - /** - * The TAB key. - * - * @name Phaser.Input.Keyboard.KeyCodes.TAB - * @type {number} - * @since 3.0.0 - */ - TAB: 9, + var letters = GetValue(config, 'chars', ''); - /** - * The ENTER key. - * - * @name Phaser.Input.Keyboard.KeyCodes.ENTER - * @type {number} - * @since 3.0.0 - */ - ENTER: 13, + if (letters === '') + { + return; + } - /** - * The SHIFT key. - * - * @name Phaser.Input.Keyboard.KeyCodes.SHIFT - * @type {number} - * @since 3.0.0 - */ - SHIFT: 16, + var key = GetValue(config, 'image', ''); - /** - * The CTRL key. - * - * @name Phaser.Input.Keyboard.KeyCodes.CTRL - * @type {number} - * @since 3.0.0 - */ - CTRL: 17, + var frame = scene.sys.textures.getFrame(key); + var textureX = frame.cutX; + var textureY = frame.cutY; + var textureWidth = frame.source.width; + var textureHeight = frame.source.height; - /** - * The ALT key. - * - * @name Phaser.Input.Keyboard.KeyCodes.ALT - * @type {number} - * @since 3.0.0 - */ - ALT: 18, + var offsetX = GetValue(config, 'offset.x', 0); + var offsetY = GetValue(config, 'offset.y', 0); + var spacingX = GetValue(config, 'spacing.x', 0); + var spacingY = GetValue(config, 'spacing.y', 0); + var lineSpacing = GetValue(config, 'lineSpacing', 0); - /** - * The PAUSE key. - * - * @name Phaser.Input.Keyboard.KeyCodes.PAUSE - * @type {number} - * @since 3.0.0 - */ - PAUSE: 19, + var charsPerRow = GetValue(config, 'charsPerRow', null); - /** - * The CAPS_LOCK key. - * - * @name Phaser.Input.Keyboard.KeyCodes.CAPS_LOCK - * @type {number} - * @since 3.0.0 - */ - CAPS_LOCK: 20, + if (charsPerRow === null) + { + charsPerRow = textureWidth / w; - /** - * The ESC key. - * - * @name Phaser.Input.Keyboard.KeyCodes.ESC - * @type {number} - * @since 3.0.0 - */ - ESC: 27, + if (charsPerRow > letters.length) + { + charsPerRow = letters.length; + } + } - /** - * The SPACE key. - * - * @name Phaser.Input.Keyboard.KeyCodes.SPACE - * @type {number} - * @since 3.0.0 - */ - SPACE: 32, + var x = offsetX; + var y = offsetY; - /** - * The PAGE_UP key. - * - * @name Phaser.Input.Keyboard.KeyCodes.PAGE_UP - * @type {number} - * @since 3.0.0 - */ - PAGE_UP: 33, + var data = { + retroFont: true, + font: key, + size: w, + lineHeight: h + lineSpacing, + chars: {} + }; - /** - * The PAGE_DOWN key. - * - * @name Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN - * @type {number} - * @since 3.0.0 - */ - PAGE_DOWN: 34, + var r = 0; - /** - * The END key. - * - * @name Phaser.Input.Keyboard.KeyCodes.END - * @type {number} - * @since 3.0.0 - */ - END: 35, + for (var i = 0; i < letters.length; i++) + { + var charCode = letters.charCodeAt(i); - /** - * The HOME key. - * - * @name Phaser.Input.Keyboard.KeyCodes.HOME - * @type {number} - * @since 3.0.0 - */ - HOME: 36, + var u0 = (textureX + x) / textureWidth; + var v0 = (textureY + y) / textureHeight; + var u1 = (textureX + x + w) / textureWidth; + var v1 = (textureY + y + h) / textureHeight; - /** - * The LEFT key. - * - * @name Phaser.Input.Keyboard.KeyCodes.LEFT - * @type {number} - * @since 3.0.0 - */ - LEFT: 37, + data.chars[charCode] = + { + x: x, + y: y, + width: w, + height: h, + centerX: cx, + centerY: cy, + xOffset: 0, + yOffset: 0, + xAdvance: w, + data: {}, + kerning: {}, + u0: u0, + v0: v0, + u1: u1, + v1: v1 + }; - /** - * The UP key. - * - * @name Phaser.Input.Keyboard.KeyCodes.UP - * @type {number} - * @since 3.0.0 - */ - UP: 38, + r++; - /** - * The RIGHT key. - * - * @name Phaser.Input.Keyboard.KeyCodes.RIGHT - * @type {number} - * @since 3.0.0 - */ - RIGHT: 39, + if (r === charsPerRow) + { + r = 0; + x = offsetX; + y += h + spacingY; + } + else + { + x += w + spacingX; + } + } - /** - * The DOWN key. - * - * @name Phaser.Input.Keyboard.KeyCodes.DOWN - * @type {number} - * @since 3.0.0 - */ - DOWN: 40, + var entry = { + data: data, + frame: null, + texture: key + }; - /** - * The PRINT_SCREEN key. - * - * @name Phaser.Input.Keyboard.KeyCodes.PRINT_SCREEN - * @type {number} - * @since 3.0.0 - */ - PRINT_SCREEN: 42, + return entry; +}; - /** - * The INSERT key. - * - * @name Phaser.Input.Keyboard.KeyCodes.INSERT - * @type {number} - * @since 3.0.0 - */ - INSERT: 45, +module.exports = ParseRetroFont; - /** - * The DELETE key. - * - * @name Phaser.Input.Keyboard.KeyCodes.DELETE - * @type {number} - * @since 3.0.0 - */ - DELETE: 46, - /** - * The ZERO key. - * - * @name Phaser.Input.Keyboard.KeyCodes.ZERO - * @type {number} - * @since 3.0.0 - */ - ZERO: 48, +/***/ }), - /** - * The ONE key. - * - * @name Phaser.Input.Keyboard.KeyCodes.ONE - * @type {number} - * @since 3.0.0 - */ - ONE: 49, +/***/ 31476: +/***/ ((module) => { - /** - * The TWO key. - * - * @name Phaser.Input.Keyboard.KeyCodes.TWO - * @type {number} - * @since 3.0.0 - */ - TWO: 50, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The THREE key. - * - * @name Phaser.Input.Keyboard.KeyCodes.THREE - * @type {number} - * @since 3.0.0 - */ - THREE: 51, +/** + * Read an integer value from an XML Node. + * + * @function getValue + * @since 3.0.0 + * @private + * + * @param {Node} node - The XML Node. + * @param {string} attribute - The attribute to read. + * + * @return {number} The parsed value. + */ +function getValue (node, attribute) +{ + return parseInt(node.getAttribute(attribute), 10); +} - /** - * The FOUR key. - * - * @name Phaser.Input.Keyboard.KeyCodes.FOUR - * @type {number} - * @since 3.0.0 - */ - FOUR: 52, +/** + * Parse an XML font to Bitmap Font data for the Bitmap Font cache. + * + * @function ParseXMLBitmapFont + * @since 3.0.0 + * @private + * + * @param {XMLDocument} xml - The XML Document to parse the font from. + * @param {Phaser.Textures.Frame} frame - The texture frame to take into account when creating the uv data. + * @param {number} [xSpacing=0] - The x-axis spacing to add between each letter. + * @param {number} [ySpacing=0] - The y-axis spacing to add to the line height. + * @param {Phaser.Textures.Texture} [texture] - If provided, each glyph in the Bitmap Font will be added to this texture as a frame. + * + * @return {Phaser.Types.GameObjects.BitmapText.BitmapFontData} The parsed Bitmap Font data. + */ +var ParseXMLBitmapFont = function (xml, frame, xSpacing, ySpacing, texture) +{ + if (xSpacing === undefined) { xSpacing = 0; } + if (ySpacing === undefined) { ySpacing = 0; } - /** - * The FIVE key. - * - * @name Phaser.Input.Keyboard.KeyCodes.FIVE - * @type {number} - * @since 3.0.0 - */ - FIVE: 53, + var textureX = frame.cutX; + var textureY = frame.cutY; + var textureWidth = frame.source.width; + var textureHeight = frame.source.height; + var sourceIndex = frame.sourceIndex; - /** - * The SIX key. - * - * @name Phaser.Input.Keyboard.KeyCodes.SIX - * @type {number} - * @since 3.0.0 - */ - SIX: 54, + var data = {}; + var info = xml.getElementsByTagName('info')[0]; + var common = xml.getElementsByTagName('common')[0]; - /** - * The SEVEN key. - * - * @name Phaser.Input.Keyboard.KeyCodes.SEVEN - * @type {number} - * @since 3.0.0 - */ - SEVEN: 55, + data.font = info.getAttribute('face'); + data.size = getValue(info, 'size'); + data.lineHeight = getValue(common, 'lineHeight') + ySpacing; + data.chars = {}; - /** - * The EIGHT key. - * - * @name Phaser.Input.Keyboard.KeyCodes.EIGHT - * @type {number} - * @since 3.0.0 - */ - EIGHT: 56, + var letters = xml.getElementsByTagName('char'); - /** - * The NINE key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NINE - * @type {number} - * @since 3.0.0 - */ - NINE: 57, + var adjustForTrim = (frame !== undefined && frame.trimmed); - /** - * The NUMPAD_ZERO key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ZERO - * @type {number} - * @since 3.0.0 - */ - NUMPAD_ZERO: 96, + if (adjustForTrim) + { + var top = frame.height; + var left = frame.width; + } - /** - * The NUMPAD_ONE key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ONE - * @type {number} - * @since 3.0.0 - */ - NUMPAD_ONE: 97, + for (var i = 0; i < letters.length; i++) + { + var node = letters[i]; - /** - * The NUMPAD_TWO key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_TWO - * @type {number} - * @since 3.0.0 - */ - NUMPAD_TWO: 98, + var charCode = getValue(node, 'id'); + var letter = String.fromCharCode(charCode); + var gx = getValue(node, 'x'); + var gy = getValue(node, 'y'); + var gw = getValue(node, 'width'); + var gh = getValue(node, 'height'); - /** - * The NUMPAD_THREE key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_THREE - * @type {number} - * @since 3.0.0 - */ - NUMPAD_THREE: 99, + // Handle frame trim issues - /** - * The NUMPAD_FOUR key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FOUR - * @type {number} - * @since 3.0.0 - */ - NUMPAD_FOUR: 100, + if (adjustForTrim) + { + if (gx < left) + { + left = gx; + } - /** - * The NUMPAD_FIVE key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FIVE - * @type {number} - * @since 3.0.0 - */ - NUMPAD_FIVE: 101, + if (gy < top) + { + top = gy; + } + } - /** - * The NUMPAD_SIX key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SIX - * @type {number} - * @since 3.0.0 - */ - NUMPAD_SIX: 102, + if (adjustForTrim && top !== 0 && left !== 0) + { + // Now we know the top and left coordinates of the glyphs in the original data + // so we can work out how much to adjust the glyphs by - /** - * The NUMPAD_SEVEN key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SEVEN - * @type {number} - * @since 3.0.0 - */ - NUMPAD_SEVEN: 103, + gx -= frame.x; + gy -= frame.y; + } - /** - * The NUMPAD_EIGHT key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_EIGHT - * @type {number} - * @since 3.0.0 - */ - NUMPAD_EIGHT: 104, + var u0 = (textureX + gx) / textureWidth; + var v0 = (textureY + gy) / textureHeight; + var u1 = (textureX + gx + gw) / textureWidth; + var v1 = (textureY + gy + gh) / textureHeight; - /** - * The NUMPAD_NINE key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_NINE - * @type {number} - * @since 3.0.0 - */ - NUMPAD_NINE: 105, + data.chars[charCode] = + { + x: gx, + y: gy, + width: gw, + height: gh, + centerX: Math.floor(gw / 2), + centerY: Math.floor(gh / 2), + xOffset: getValue(node, 'xoffset'), + yOffset: getValue(node, 'yoffset'), + xAdvance: getValue(node, 'xadvance') + xSpacing, + data: {}, + kerning: {}, + u0: u0, + v0: v0, + u1: u1, + v1: v1 + }; - /** - * The Numpad Addition (+) key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ADD - * @type {number} - * @since 3.21.0 - */ - NUMPAD_ADD: 107, + if (texture && gw !== 0 && gh !== 0) + { + var charFrame = texture.add(letter, sourceIndex, gx, gy, gw, gh); - /** - * The Numpad Subtraction (-) key. - * - * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SUBTRACT - * @type {number} - * @since 3.21.0 - */ - NUMPAD_SUBTRACT: 109, + if (charFrame) + { + charFrame.setUVs(gw, gh, u0, v0, u1, v1); + } + } + } - /** - * The A key. - * - * @name Phaser.Input.Keyboard.KeyCodes.A - * @type {number} - * @since 3.0.0 - */ - A: 65, + var kernings = xml.getElementsByTagName('kerning'); - /** - * The B key. - * - * @name Phaser.Input.Keyboard.KeyCodes.B - * @type {number} - * @since 3.0.0 - */ - B: 66, + for (i = 0; i < kernings.length; i++) + { + var kern = kernings[i]; - /** - * The C key. - * - * @name Phaser.Input.Keyboard.KeyCodes.C - * @type {number} - * @since 3.0.0 - */ - C: 67, + var first = getValue(kern, 'first'); + var second = getValue(kern, 'second'); + var amount = getValue(kern, 'amount'); - /** - * The D key. - * - * @name Phaser.Input.Keyboard.KeyCodes.D - * @type {number} - * @since 3.0.0 - */ - D: 68, + data.chars[second].kerning[first] = amount; + } - /** - * The E key. - * - * @name Phaser.Input.Keyboard.KeyCodes.E - * @type {number} - * @since 3.0.0 - */ - E: 69, + return data; +}; - /** - * The F key. - * - * @name Phaser.Input.Keyboard.KeyCodes.F - * @type {number} - * @since 3.0.0 - */ - F: 70, +module.exports = ParseXMLBitmapFont; - /** - * The G key. - * - * @name Phaser.Input.Keyboard.KeyCodes.G - * @type {number} - * @since 3.0.0 - */ - G: 71, - /** - * The H key. - * - * @name Phaser.Input.Keyboard.KeyCodes.H - * @type {number} - * @since 3.0.0 - */ - H: 72, +/***/ }), - /** - * The I key. - * - * @name Phaser.Input.Keyboard.KeyCodes.I - * @type {number} - * @since 3.0.0 - */ - I: 73, +/***/ 55873: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The J key. - * - * @name Phaser.Input.Keyboard.KeyCodes.J - * @type {number} - * @since 3.0.0 - */ - J: 74, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The K key. - * - * @name Phaser.Input.Keyboard.KeyCodes.K - * @type {number} - * @since 3.0.0 - */ - K: 75, +var RETRO_FONT_CONST = __webpack_require__(66863); +var Extend = __webpack_require__(98611); - /** - * The L key. - * - * @name Phaser.Input.Keyboard.KeyCodes.L - * @type {number} - * @since 3.0.0 - */ - L: 76, +/** + * @namespace Phaser.GameObjects.RetroFont + * @since 3.6.0 + */ - /** - * The M key. - * - * @name Phaser.Input.Keyboard.KeyCodes.M - * @type {number} - * @since 3.0.0 - */ - M: 77, +var RetroFont = { Parse: __webpack_require__(39860) }; - /** - * The N key. - * - * @name Phaser.Input.Keyboard.KeyCodes.N - * @type {number} - * @since 3.0.0 - */ - N: 78, +// Merge in the consts +RetroFont = Extend(false, RetroFont, RETRO_FONT_CONST); - /** - * The O key. - * - * @name Phaser.Input.Keyboard.KeyCodes.O - * @type {number} - * @since 3.0.0 - */ - O: 79, +module.exports = RetroFont; - /** - * The P key. - * - * @name Phaser.Input.Keyboard.KeyCodes.P - * @type {number} - * @since 3.0.0 - */ - P: 80, - /** - * The Q key. - * - * @name Phaser.Input.Keyboard.KeyCodes.Q - * @type {number} - * @since 3.0.0 - */ - Q: 81, +/***/ }), - /** - * The R key. - * - * @name Phaser.Input.Keyboard.KeyCodes.R - * @type {number} - * @since 3.0.0 - */ - R: 82, +/***/ 66863: +/***/ ((module) => { - /** - * The S key. - * - * @name Phaser.Input.Keyboard.KeyCodes.S - * @type {number} - * @since 3.0.0 - */ - S: 83, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The T key. - * - * @name Phaser.Input.Keyboard.KeyCodes.T - * @type {number} - * @since 3.0.0 - */ - T: 84, +var RETRO_FONT_CONST = { /** - * The U key. + * Text Set 1 = !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ * - * @name Phaser.Input.Keyboard.KeyCodes.U - * @type {number} - * @since 3.0.0 + * @name Phaser.GameObjects.RetroFont.TEXT_SET1 + * @type {string} + * @since 3.6.0 */ - U: 85, + TEXT_SET1: ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~', /** - * The V key. + * Text Set 2 = !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ * - * @name Phaser.Input.Keyboard.KeyCodes.V - * @type {number} - * @since 3.0.0 + * @name Phaser.GameObjects.RetroFont.TEXT_SET2 + * @type {string} + * @since 3.6.0 */ - V: 86, + TEXT_SET2: ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ', /** - * The W key. + * Text Set 3 = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 * - * @name Phaser.Input.Keyboard.KeyCodes.W - * @type {number} - * @since 3.0.0 + * @name Phaser.GameObjects.RetroFont.TEXT_SET3 + * @type {string} + * @since 3.6.0 */ - W: 87, + TEXT_SET3: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ', /** - * The X key. + * Text Set 4 = ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 * - * @name Phaser.Input.Keyboard.KeyCodes.X - * @type {number} - * @since 3.0.0 + * @name Phaser.GameObjects.RetroFont.TEXT_SET4 + * @type {string} + * @since 3.6.0 */ - X: 88, + TEXT_SET4: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789', /** - * The Y key. + * Text Set 5 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789 * - * @name Phaser.Input.Keyboard.KeyCodes.Y - * @type {number} - * @since 3.0.0 + * @name Phaser.GameObjects.RetroFont.TEXT_SET5 + * @type {string} + * @since 3.6.0 */ - Y: 89, + TEXT_SET5: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() \'!?-*:0123456789', /** - * The Z key. + * Text Set 6 = ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789"(),-.' * - * @name Phaser.Input.Keyboard.KeyCodes.Z - * @type {number} - * @since 3.0.0 + * @name Phaser.GameObjects.RetroFont.TEXT_SET6 + * @type {string} + * @since 3.6.0 */ - Z: 90, + TEXT_SET6: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789"(),-.\' ', /** - * The F1 key. + * Text Set 7 = AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW")28FLRX-'39 * - * @name Phaser.Input.Keyboard.KeyCodes.F1 - * @type {number} - * @since 3.0.0 + * @name Phaser.GameObjects.RetroFont.TEXT_SET7 + * @type {string} + * @since 3.6.0 */ - F1: 112, + TEXT_SET7: 'AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW")28FLRX-\'39', /** - * The F2 key. + * Text Set 8 = 0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ * - * @name Phaser.Input.Keyboard.KeyCodes.F2 - * @type {number} - * @since 3.0.0 + * @name Phaser.GameObjects.RetroFont.TEXT_SET8 + * @type {string} + * @since 3.6.0 */ - F2: 113, + TEXT_SET8: '0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ', /** - * The F3 key. + * Text Set 9 = ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'"?! * - * @name Phaser.Input.Keyboard.KeyCodes.F3 - * @type {number} - * @since 3.0.0 + * @name Phaser.GameObjects.RetroFont.TEXT_SET9 + * @type {string} + * @since 3.6.0 */ - F3: 114, + TEXT_SET9: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,\'"?!', /** - * The F4 key. + * Text Set 10 = ABCDEFGHIJKLMNOPQRSTUVWXYZ * - * @name Phaser.Input.Keyboard.KeyCodes.F4 - * @type {number} - * @since 3.0.0 + * @name Phaser.GameObjects.RetroFont.TEXT_SET10 + * @type {string} + * @since 3.6.0 */ - F4: 115, + TEXT_SET10: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', /** - * The F5 key. + * Text Set 11 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"-+!?()':;0123456789 * - * @name Phaser.Input.Keyboard.KeyCodes.F5 - * @type {number} - * @since 3.0.0 + * @name Phaser.GameObjects.RetroFont.TEXT_SET11 + * @since 3.6.0 + * @type {string} */ - F5: 116, + TEXT_SET11: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"-+!?()\':;0123456789' - /** - * The F6 key. - * - * @name Phaser.Input.Keyboard.KeyCodes.F6 - * @type {number} - * @since 3.0.0 - */ - F6: 117, +}; - /** - * The F7 key. - * - * @name Phaser.Input.Keyboard.KeyCodes.F7 - * @type {number} - * @since 3.0.0 - */ - F7: 118, +module.exports = RETRO_FONT_CONST; - /** - * The F8 key. - * - * @name Phaser.Input.Keyboard.KeyCodes.F8 - * @type {number} - * @since 3.0.0 - */ - F8: 119, - /** - * The F9 key. - * - * @name Phaser.Input.Keyboard.KeyCodes.F9 - * @type {number} - * @since 3.0.0 - */ - F9: 120, +/***/ }), - /** - * The F10 key. - * - * @name Phaser.Input.Keyboard.KeyCodes.F10 - * @type {number} - * @since 3.0.0 - */ - F10: 121, +/***/ 13468: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The F11 key. - * - * @name Phaser.Input.Keyboard.KeyCodes.F11 - * @type {number} - * @since 3.0.0 - */ - F11: 122, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The F12 key. - * - * @name Phaser.Input.Keyboard.KeyCodes.F12 - * @type {number} - * @since 3.0.0 - */ - F12: 123, +var BitmapText = __webpack_require__(44616); +var Class = __webpack_require__(56694); +var Render = __webpack_require__(88899); - /** - * The SEMICOLON key. - * - * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON - * @type {number} - * @since 3.0.0 - */ - SEMICOLON: 186, +/** + * @classdesc + * BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure. + * + * During rendering for each letter of the text is rendered to the display, proportionally spaced out and aligned to + * match the font structure. + * + * Dynamic Bitmap Text objects are different from Static Bitmap Text in that they invoke a callback for each + * letter being rendered during the render pass. This callback allows you to manipulate the properties of + * each letter being rendered, such as its position, scale or tint, allowing you to create interesting effects + * like jiggling text, which can't be done with Static text. This means that Dynamic Text takes more processing + * time, so only use them if you require the callback ability they have. + * + * BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability + * to use Web Fonts, however you trade this flexibility for rendering speed. You can also create visually compelling BitmapTexts by + * processing the font texture in an image editor, applying fills and any other effects required. + * + * To create multi-line text insert \r, \n or \r\n escape codes into the text string. + * + * To create a BitmapText data files you need a 3rd party app such as: + * + * BMFont (Windows, free): {@link http://www.angelcode.com/products/bmfont/|http://www.angelcode.com/products/bmfont/} + * Glyph Designer (OS X, commercial): {@link http://www.71squared.com/en/glyphdesigner|http://www.71squared.com/en/glyphdesigner} + * Snow BMF (Web-based, free): {@link https://snowb.org//|https://snowb.org/} + * Littera (Flash-based, free): {@link http://kvazars.com/littera/|http://kvazars.com/littera/} + * + * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of + * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: {@link http://codebeautify.org/xmltojson|http://codebeautify.org/xmltojson} + * + * @class DynamicBitmapText + * @extends Phaser.GameObjects.BitmapText + * @memberof Phaser.GameObjects + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time. + * @param {number} x - The x coordinate of this Game Object in world space. + * @param {number} y - The y coordinate of this Game Object in world space. + * @param {string} font - The key of the font to use from the Bitmap Font cache. + * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text. + * @param {number} [size] - The font size of this Bitmap Text. + * @param {number} [align=0] - The alignment of the text in a multi-line BitmapText object. + */ +var DynamicBitmapText = new Class({ - /** - * The PLUS key. - * - * @name Phaser.Input.Keyboard.KeyCodes.PLUS - * @type {number} - * @since 3.0.0 - */ - PLUS: 187, + Extends: BitmapText, - /** - * The COMMA key. - * - * @name Phaser.Input.Keyboard.KeyCodes.COMMA - * @type {number} - * @since 3.0.0 - */ - COMMA: 188, + Mixins: [ + Render + ], - /** - * The MINUS key. - * - * @name Phaser.Input.Keyboard.KeyCodes.MINUS - * @type {number} - * @since 3.0.0 - */ - MINUS: 189, + initialize: - /** - * The PERIOD key. - * - * @name Phaser.Input.Keyboard.KeyCodes.PERIOD - * @type {number} - * @since 3.0.0 - */ - PERIOD: 190, + function DynamicBitmapText (scene, x, y, font, text, size, align) + { + BitmapText.call(this, scene, x, y, font, text, size, align); - /** - * The FORWARD_SLASH key. - * - * @name Phaser.Input.Keyboard.KeyCodes.FORWARD_SLASH - * @type {number} - * @since 3.0.0 - */ - FORWARD_SLASH: 191, + this.type = 'DynamicBitmapText'; - /** - * The BACK_SLASH key. - * - * @name Phaser.Input.Keyboard.KeyCodes.BACK_SLASH - * @type {number} - * @since 3.0.0 - */ - BACK_SLASH: 220, + /** + * The horizontal scroll position of the Bitmap Text. + * + * @name Phaser.GameObjects.DynamicBitmapText#scrollX + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.scrollX = 0; + + /** + * The vertical scroll position of the Bitmap Text. + * + * @name Phaser.GameObjects.DynamicBitmapText#scrollY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.scrollY = 0; + + /** + * The crop width of the Bitmap Text. + * + * @name Phaser.GameObjects.DynamicBitmapText#cropWidth + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.cropWidth = 0; + + /** + * The crop height of the Bitmap Text. + * + * @name Phaser.GameObjects.DynamicBitmapText#cropHeight + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.cropHeight = 0; + + /** + * A callback that alters how each character of the Bitmap Text is rendered. + * + * @name Phaser.GameObjects.DynamicBitmapText#displayCallback + * @type {Phaser.Types.GameObjects.BitmapText.DisplayCallback} + * @since 3.0.0 + */ + this.displayCallback; + + /** + * The data object that is populated during rendering, then passed to the displayCallback. + * You should modify this object then return it back from the callback. It's updated values + * will be used to render the specific glyph. + * + * Please note that if you need a reference to this object locally in your game code then you + * should shallow copy it, as it's updated and re-used for every glyph in the text. + * + * @name Phaser.GameObjects.DynamicBitmapText#callbackData + * @type {Phaser.Types.GameObjects.BitmapText.DisplayCallbackConfig} + * @since 3.11.0 + */ + this.callbackData = { + parent: this, + color: 0, + tint: { + topLeft: 0, + topRight: 0, + bottomLeft: 0, + bottomRight: 0 + }, + index: 0, + charCode: 0, + x: 0, + y: 0, + scale: 0, + rotation: 0, + data: 0 + }; + }, /** - * The QUOTES key. - * - * @name Phaser.Input.Keyboard.KeyCodes.QUOTES - * @type {number} + * Set the crop size of this Bitmap Text. + * + * @method Phaser.GameObjects.DynamicBitmapText#setSize * @since 3.0.0 + * + * @param {number} width - The width of the crop. + * @param {number} height - The height of the crop. + * + * @return {this} This Game Object. */ - QUOTES: 222, + setSize: function (width, height) + { + this.cropWidth = width; + this.cropHeight = height; + + return this; + }, /** - * The BACKTICK key. - * - * @name Phaser.Input.Keyboard.KeyCodes.BACKTICK - * @type {number} + * Set a callback that alters how each character of the Bitmap Text is rendered. + * + * The callback receives a {@link Phaser.Types.GameObjects.BitmapText.DisplayCallbackConfig} object that contains information about the character that's + * about to be rendered. + * + * It should return an object with `x`, `y`, `scale` and `rotation` properties that will be used instead of the + * usual values when rendering. + * + * @method Phaser.GameObjects.DynamicBitmapText#setDisplayCallback * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.BitmapText.DisplayCallback} callback - The display callback to set. + * + * @return {this} This Game Object. */ - BACKTICK: 192, + setDisplayCallback: function (callback) + { + this.displayCallback = callback; + + return this; + }, /** - * The OPEN_BRACKET key. - * - * @name Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET - * @type {number} + * Set the horizontal scroll position of this Bitmap Text. + * + * @method Phaser.GameObjects.DynamicBitmapText#setScrollX * @since 3.0.0 + * + * @param {number} value - The horizontal scroll position to set. + * + * @return {this} This Game Object. */ - OPEN_BRACKET: 219, + setScrollX: function (value) + { + this.scrollX = value; + + return this; + }, /** - * The CLOSED_BRACKET key. - * - * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET - * @type {number} + * Set the vertical scroll position of this Bitmap Text. + * + * @method Phaser.GameObjects.DynamicBitmapText#setScrollY * @since 3.0.0 + * + * @param {number} value - The vertical scroll position to set. + * + * @return {this} This Game Object. */ - CLOSED_BRACKET: 221, - - /** - * The SEMICOLON_FIREFOX key. - * - * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON_FIREFOX - * @type {number} - * @since 3.0.0 - */ - SEMICOLON_FIREFOX: 59, - - /** - * The COLON key. - * - * @name Phaser.Input.Keyboard.KeyCodes.COLON - * @type {number} - * @since 3.0.0 - */ - COLON: 58, - - /** - * The COMMA_FIREFOX_WINDOWS key. - * - * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX_WINDOWS - * @type {number} - * @since 3.0.0 - */ - COMMA_FIREFOX_WINDOWS: 60, - - /** - * The COMMA_FIREFOX key. - * - * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX - * @type {number} - * @since 3.0.0 - */ - COMMA_FIREFOX: 62, + setScrollY: function (value) + { + this.scrollY = value; - /** - * The BRACKET_RIGHT_FIREFOX key. - * - * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_RIGHT_FIREFOX - * @type {number} - * @since 3.0.0 - */ - BRACKET_RIGHT_FIREFOX: 174, + return this; + } - /** - * The BRACKET_LEFT_FIREFOX key. - * - * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_LEFT_FIREFOX - * @type {number} - * @since 3.0.0 - */ - BRACKET_LEFT_FIREFOX: 175 -}; +}); -module.exports = KeyCodes; +module.exports = DynamicBitmapText; /***/ }), -/* 144 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Scene consts. - * - * @ignore - */ - -var CONST = { - - /** - * Scene state. - * - * @name Phaser.Scenes.PENDING - * @readonly - * @type {number} - * @since 3.0.0 - */ - PENDING: 0, - - /** - * Scene state. - * - * @name Phaser.Scenes.INIT - * @readonly - * @type {number} - * @since 3.0.0 - */ - INIT: 1, - - /** - * Scene state. - * - * @name Phaser.Scenes.START - * @readonly - * @type {number} - * @since 3.0.0 - */ - START: 2, - - /** - * Scene state. - * - * @name Phaser.Scenes.LOADING - * @readonly - * @type {number} - * @since 3.0.0 - */ - LOADING: 3, - - /** - * Scene state. - * - * @name Phaser.Scenes.CREATING - * @readonly - * @type {number} - * @since 3.0.0 - */ - CREATING: 4, - - /** - * Scene state. - * - * @name Phaser.Scenes.RUNNING - * @readonly - * @type {number} - * @since 3.0.0 - */ - RUNNING: 5, - - /** - * Scene state. - * - * @name Phaser.Scenes.PAUSED - * @readonly - * @type {number} - * @since 3.0.0 - */ - PAUSED: 6, - - /** - * Scene state. - * - * @name Phaser.Scenes.SLEEPING - * @readonly - * @type {number} - * @since 3.0.0 - */ - SLEEPING: 7, - - /** - * Scene state. - * - * @name Phaser.Scenes.SHUTDOWN - * @readonly - * @type {number} - * @since 3.0.0 - */ - SHUTDOWN: 8, - - /** - * Scene state. - * - * @name Phaser.Scenes.DESTROYED - * @readonly - * @type {number} - * @since 3.0.0 - */ - DESTROYED: 9 - -}; - -module.exports = CONST; - -/***/ }), -/* 145 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ 93438: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Clone = __webpack_require__(77); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(70); -var GameEvents = __webpack_require__(22); -var NOOP = __webpack_require__(1); -var GetAll = __webpack_require__(207); -var GetFirst = __webpack_require__(428); +var SetTransform = __webpack_require__(49584); /** - * @classdesc - * Base class for other Sound Manager classes. + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @class BaseSoundManager - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Sound - * @constructor + * @method Phaser.GameObjects.DynamicBitmapText#renderCanvas * @since 3.0.0 + * @private * - * @param {Phaser.Game} game - Reference to the current game instance. - * - * @see Phaser.Sound.HTML5AudioSoundManager - * @see Phaser.Sound.NoAudioSoundManager - * @see Phaser.Sound.WebAudioSoundManager + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.DynamicBitmapText} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var BaseSoundManager = new Class({ - - Extends: EventEmitter, +var DynamicBitmapTextCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + var text = src._text; + var textLength = text.length; - initialize: + var ctx = renderer.currentContext; - function BaseSoundManager (game) + if (textLength === 0 || !SetTransform(renderer, ctx, src, camera, parentMatrix)) { - EventEmitter.call(this); - - /** - * Local reference to game. - * - * @name Phaser.Sound.BaseSoundManager#game - * @type {Phaser.Game} - * @readonly - * @since 3.0.0 - */ - this.game = game; - - /** - * Local reference to the JSON Cache, as used by Audio Sprites. - * - * @name Phaser.Sound.BaseSoundManager#jsonCache - * @type {Phaser.Cache.BaseCache} - * @readonly - * @since 3.7.0 - */ - this.jsonCache = game.cache.json; - - /** - * An array containing all added sounds. - * - * @name Phaser.Sound.BaseSoundManager#sounds - * @type {Phaser.Sound.BaseSound[]} - * @default [] - * @private - * @since 3.0.0 - */ - this.sounds = []; - - /** - * Global mute setting. - * - * @name Phaser.Sound.BaseSoundManager#mute - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.mute = false; + return; + } - /** - * Global volume setting. - * - * @name Phaser.Sound.BaseSoundManager#volume - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.volume = 1; + camera.addToRenderList(src); - /** - * Flag indicating if sounds should be paused when game looses focus, - * for instance when user switches to another tab/program/app. - * - * @name Phaser.Sound.BaseSoundManager#pauseOnBlur - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.pauseOnBlur = true; + var textureFrame = src.fromAtlas + ? src.frame + : src.texture.frames['__BASE']; - /** - * Property that actually holds the value of global playback rate. - * - * @name Phaser.Sound.BaseSoundManager#_rate - * @type {number} - * @private - * @default 1 - * @since 3.0.0 - */ - this._rate = 1; + var displayCallback = src.displayCallback; + var callbackData = src.callbackData; - /** - * Property that actually holds the value of global detune. - * - * @name Phaser.Sound.BaseSoundManager#_detune - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._detune = 0; + var chars = src.fontData.chars; + var lineHeight = src.fontData.lineHeight; + var letterSpacing = src._letterSpacing; - /** - * Mobile devices require sounds to be triggered from an explicit user action, - * such as a tap, before any sound can be loaded/played on a web page. - * Set to true if the audio system is currently locked awaiting user interaction. - * - * @name Phaser.Sound.BaseSoundManager#locked - * @type {boolean} - * @readonly - * @since 3.0.0 - */ - this.locked = this.locked || false; + var xAdvance = 0; + var yAdvance = 0; - /** - * Flag used internally for handling when the audio system - * has been unlocked, if there ever was a need for it. - * - * @name Phaser.Sound.BaseSoundManager#unlocked - * @type {boolean} - * @default false - * @private - * @since 3.0.0 - */ - this.unlocked = false; + var charCode = 0; - game.events.on(GameEvents.BLUR, this.onGameBlur, this); - game.events.on(GameEvents.FOCUS, this.onGameFocus, this); - game.events.on(GameEvents.PRE_STEP, this.update, this); - game.events.once(GameEvents.DESTROY, this.destroy, this); - }, + var glyph = null; + var glyphX = 0; + var glyphY = 0; + var glyphW = 0; + var glyphH = 0; - /** - * Adds a new sound into the sound manager. - * - * @method Phaser.Sound.BaseSoundManager#add - * @override - * @since 3.0.0 - * - * @param {string} key - Asset key for the sound. - * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. - * - * @return {Phaser.Sound.BaseSound} The new sound instance. - */ - add: NOOP, + var x = 0; + var y = 0; - /** - * Adds a new audio sprite sound into the sound manager. - * Audio Sprites are a combination of audio files and a JSON configuration. - * The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite - * - * @method Phaser.Sound.BaseSoundManager#addAudioSprite - * @since 3.0.0 - * - * @param {string} key - Asset key for the sound. - * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. - * - * @return {(Phaser.Sound.HTML5AudioSound|Phaser.Sound.WebAudioSound)} The new audio sprite sound instance. - */ - addAudioSprite: function (key, config) - { - if (config === undefined) { config = {}; } + var lastGlyph = null; + var lastCharCode = 0; - var sound = this.add(key, config); + var image = src.frame.source.image; - sound.spritemap = this.jsonCache.get(key).spritemap; + var textureX = textureFrame.cutX; + var textureY = textureFrame.cutY; - for (var markerName in sound.spritemap) - { - if (!sound.spritemap.hasOwnProperty(markerName)) - { - continue; - } + var rotation = 0; + var scale = 0; + var baseScale = (src._fontSize / src.fontData.size); - var markerConfig = Clone(config); + var align = src._align; + var currentLine = 0; + var lineOffsetX = 0; - var marker = sound.spritemap[markerName]; + // Update the bounds - skipped internally if not dirty + src.getTextBounds(false); - markerConfig.loop = (marker.hasOwnProperty('loop')) ? marker.loop : false; + var lineData = src._bounds.lines; - sound.addMarker({ - name: markerName, - start: marker.start, - duration: marker.end - marker.start, - config: markerConfig - }); - } + if (align === 1) + { + lineOffsetX = (lineData.longest - lineData.lengths[0]) / 2; + } + else if (align === 2) + { + lineOffsetX = (lineData.longest - lineData.lengths[0]); + } - return sound; - }, + ctx.translate(-src.displayOriginX, -src.displayOriginY); - /** - * Gets the first sound in the manager matching the given key, if any. - * - * @method Phaser.Sound.BaseSoundManager#get - * @since 3.23.0 - * - * @param {string} key - Sound asset key. - * - * @return {?Phaser.Sound.BaseSound} - The sound, or null. - */ - get: function (key) - { - return GetFirst(this.sounds, 'key', key); - }, + var roundPixels = camera.roundPixels; - /** - * Gets any sounds in the manager matching the given key. - * - * @method Phaser.Sound.BaseSoundManager#getAll - * @since 3.23.0 - * - * @param {string} key - Sound asset key. - * - * @return {Phaser.Sound.BaseSound[]} - The sounds, or an empty array. - */ - getAll: function (key) + if (src.cropWidth > 0 && src.cropHeight > 0) { - return GetAll(this.sounds, 'key', key); - }, + ctx.beginPath(); + ctx.rect(0, 0, src.cropWidth, src.cropHeight); + ctx.clip(); + } - /** - * Adds a new sound to the sound manager and plays it. - * The sound will be automatically removed (destroyed) once playback ends. - * This lets you play a new sound on the fly without the need to keep a reference to it. - * - * @method Phaser.Sound.BaseSoundManager#play - * @listens Phaser.Sound.Events#COMPLETE - * @since 3.0.0 - * - * @param {string} key - Asset key for the sound. - * @param {(Phaser.Types.Sound.SoundConfig|Phaser.Types.Sound.SoundMarker)} [extra] - An optional additional object containing settings to be applied to the sound. It could be either config or marker object. - * - * @return {boolean} Whether the sound started playing successfully. - */ - play: function (key, extra) + for (var i = 0; i < textLength; i++) { - var sound = this.add(key); + // Reset the scale (in case the callback changed it) + scale = baseScale; + rotation = 0; - sound.once(Events.COMPLETE, sound.destroy, sound); + charCode = text.charCodeAt(i); - if (extra) + if (charCode === 10) { - if (extra.name) - { - sound.addMarker(extra); + currentLine++; - return sound.play(extra.name); + if (align === 1) + { + lineOffsetX = (lineData.longest - lineData.lengths[currentLine]) / 2; } - else + else if (align === 2) { - return sound.play(extra); + lineOffsetX = (lineData.longest - lineData.lengths[currentLine]); } - } - else - { - return sound.play(); - } - }, - - /** - * Adds a new audio sprite sound to the sound manager and plays it. - * The sprite will be automatically removed (destroyed) once playback ends. - * This lets you play a new sound on the fly without the need to keep a reference to it. - * - * @method Phaser.Sound.BaseSoundManager#playAudioSprite - * @listens Phaser.Sound.Events#COMPLETE - * @since 3.0.0 - * - * @param {string} key - Asset key for the sound. - * @param {string} spriteName - The name of the sound sprite to play. - * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. - * - * @return {boolean} Whether the audio sprite sound started playing successfully. - */ - playAudioSprite: function (key, spriteName, config) - { - var sound = this.addAudioSprite(key); - sound.once(Events.COMPLETE, sound.destroy, sound); + xAdvance = 0; + yAdvance += lineHeight; + lastGlyph = null; - return sound.play(spriteName, config); - }, + continue; + } - /** - * Removes a sound from the sound manager. - * The removed sound is destroyed before removal. - * - * @method Phaser.Sound.BaseSoundManager#remove - * @since 3.0.0 - * - * @param {Phaser.Sound.BaseSound} sound - The sound object to remove. - * - * @return {boolean} True if the sound was removed successfully, otherwise false. - */ - remove: function (sound) - { - var index = this.sounds.indexOf(sound); + glyph = chars[charCode]; - if (index !== -1) + if (!glyph) { - sound.destroy(); - - this.sounds.splice(index, 1); - - return true; + continue; } - return false; - }, - - - /** - * Removes all sounds from the manager, destroying the sounds. - * - * @method Phaser.Sound.BaseSoundManager#removeAll - * @since 3.23.0 - */ - removeAll: function () - { - this.sounds.forEach(function (sound) - { - sound.destroy(); - }); + glyphX = textureX + glyph.x; + glyphY = textureY + glyph.y; - this.sounds.length = 0; - }, + glyphW = glyph.width; + glyphH = glyph.height; - /** - * Removes all sounds from the sound manager that have an asset key matching the given value. - * The removed sounds are destroyed before removal. - * - * @method Phaser.Sound.BaseSoundManager#removeByKey - * @since 3.0.0 - * - * @param {string} key - The key to match when removing sound objects. - * - * @return {number} The number of matching sound objects that were removed. - */ - removeByKey: function (key) - { - var removed = 0; + x = (glyph.xOffset + xAdvance) - src.scrollX; + y = (glyph.yOffset + yAdvance) - src.scrollY; - for (var i = this.sounds.length - 1; i >= 0; i--) + if (lastGlyph !== null) { - var sound = this.sounds[i]; + var kerningOffset = glyph.kerning[lastCharCode]; + x += (kerningOffset !== undefined) ? kerningOffset : 0; + } - if (sound.key === key) - { - sound.destroy(); + if (displayCallback) + { + callbackData.index = i; + callbackData.charCode = charCode; + callbackData.x = x; + callbackData.y = y; + callbackData.scale = scale; + callbackData.rotation = rotation; + callbackData.data = glyph.data; - this.sounds.splice(i, 1); + var output = displayCallback(callbackData); - removed++; - } + x = output.x; + y = output.y; + scale = output.scale; + rotation = output.rotation; } - return removed; - }, + x *= scale; + y *= scale; - /** - * Pauses all the sounds in the game. - * - * @method Phaser.Sound.BaseSoundManager#pauseAll - * @fires Phaser.Sound.Events#PAUSE_ALL - * @since 3.0.0 - */ - pauseAll: function () - { - this.forEachActiveSound(function (sound) - { - sound.pause(); - }); + x += lineOffsetX; - this.emit(Events.PAUSE_ALL, this); - }, + xAdvance += glyph.xAdvance + letterSpacing + ((kerningOffset !== undefined) ? kerningOffset : 0); + lastGlyph = glyph; + lastCharCode = charCode; - /** - * Resumes all the sounds in the game. - * - * @method Phaser.Sound.BaseSoundManager#resumeAll - * @fires Phaser.Sound.Events#RESUME_ALL - * @since 3.0.0 - */ - resumeAll: function () - { - this.forEachActiveSound(function (sound) + // Nothing to render or a space? Then skip to the next glyph + if (glyphW === 0 || glyphH === 0 || charCode === 32) { - sound.resume(); - }); - - this.emit(Events.RESUME_ALL, this); - }, + continue; + } - /** - * Stops all the sounds in the game. - * - * @method Phaser.Sound.BaseSoundManager#stopAll - * @fires Phaser.Sound.Events#STOP_ALL - * @since 3.0.0 - */ - stopAll: function () - { - this.forEachActiveSound(function (sound) + if (roundPixels) { - sound.stop(); - }); - - this.emit(Events.STOP_ALL, this); - }, - - - /** - * Stops any sounds matching the given key. - * - * @method Phaser.Sound.BaseSoundManager#stopByKey - * @since 3.23.0 - * - * @param {string} key - Sound asset key. - * - * @return {number} - How many sounds were stopped. - */ - stopByKey: function (key) - { - var stopped = 0; + x = Math.round(x); + y = Math.round(y); + } - this.getAll(key).forEach(function (sound) - { - if (sound.stop()) { stopped++; } - }); + ctx.save(); - return stopped; - }, + ctx.translate(x, y); - /** - * Method used internally for unlocking audio playback on devices that - * require user interaction before any sound can be played on a web page. - * - * Read more about how this issue is handled here in [this article](https://medium.com/@pgoloskokovic/unlocking-web-audio-the-smarter-way-8858218c0e09). - * - * @method Phaser.Sound.BaseSoundManager#unlock - * @override - * @protected - * @since 3.0.0 - */ - unlock: NOOP, + ctx.rotate(rotation); - /** - * Method used internally for pausing sound manager if - * Phaser.Sound.BaseSoundManager#pauseOnBlur is set to true. - * - * @method Phaser.Sound.BaseSoundManager#onBlur - * @override - * @protected - * @since 3.0.0 - */ - onBlur: NOOP, + ctx.scale(scale, scale); - /** - * Method used internally for resuming sound manager if - * Phaser.Sound.BaseSoundManager#pauseOnBlur is set to true. - * - * @method Phaser.Sound.BaseSoundManager#onFocus - * @override - * @protected - * @since 3.0.0 - */ - onFocus: NOOP, + ctx.drawImage(image, glyphX, glyphY, glyphW, glyphH, 0, 0, glyphW, glyphH); - /** - * Internal handler for Phaser.Core.Events#BLUR. - * - * @method Phaser.Sound.BaseSoundManager#onGameBlur - * @private - * @since 3.23.0 - */ - onGameBlur: function () - { - if (this.pauseOnBlur) - { - this.onBlur(); - } - }, + ctx.restore(); + } - /** - * Internal handler for Phaser.Core.Events#FOCUS. - * - * @method Phaser.Sound.BaseSoundManager#onGameFocus - * @private - * @since 3.23.0 - */ - onGameFocus: function () - { - if (this.pauseOnBlur) - { - this.onFocus(); - } - }, + ctx.restore(); +}; - /** - * Update method called on every game step. - * Removes destroyed sounds and updates every active sound in the game. - * - * @method Phaser.Sound.BaseSoundManager#update - * @protected - * @fires Phaser.Sound.Events#UNLOCKED - * @since 3.0.0 - * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time elapsed since the last frame. - */ - update: function (time, delta) - { - if (this.unlocked) - { - this.unlocked = false; - this.locked = false; +module.exports = DynamicBitmapTextCanvasRenderer; - this.emit(Events.UNLOCKED, this); - } - for (var i = this.sounds.length - 1; i >= 0; i--) - { - if (this.sounds[i].pendingRemove) - { - this.sounds.splice(i, 1); - } - } +/***/ }), - this.sounds.forEach(function (sound) - { - sound.update(time, delta); - }); - }, +/***/ 67513: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - /** - * Destroys all the sounds in the game and all associated events. - * - * @method Phaser.Sound.BaseSoundManager#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.game.events.off(GameEvents.BLUR, this.onGameBlur, this); - this.game.events.off(GameEvents.FOCUS, this.onGameFocus, this); - this.game.events.off(GameEvents.PRE_STEP, this.update, this); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.removeAllListeners(); +var BitmapText = __webpack_require__(13468); +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); - this.removeAll(); +/** + * Creates a new Dynamic Bitmap Text Game Object and returns it. + * + * Note: This method will only be available if the Dynamic Bitmap Text Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#dynamicBitmapText + * @since 3.0.0 + *² + * @param {Phaser.Types.GameObjects.BitmapText.BitmapTextConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.DynamicBitmapText} The Game Object that was created. + */ +GameObjectCreator.register('dynamicBitmapText', function (config, addToScene) +{ + if (config === undefined) { config = {}; } - this.sounds.length = 0; - this.sounds = null; + var font = GetAdvancedValue(config, 'font', ''); + var text = GetAdvancedValue(config, 'text', ''); + var size = GetAdvancedValue(config, 'size', false); - this.game = null; - }, + var bitmapText = new BitmapText(this.scene, 0, 0, font, text, size); - /** - * Method used internally for iterating only over active sounds and skipping sounds that are marked for removal. - * - * @method Phaser.Sound.BaseSoundManager#forEachActiveSound - * @private - * @since 3.0.0 - * - * @param {Phaser.Types.Sound.EachActiveSoundCallback} callback - Callback function. (manager: Phaser.Sound.BaseSoundManager, sound: Phaser.Sound.BaseSound, index: number, sounds: Phaser.Manager.BaseSound[]) => void - * @param {*} [scope] - Callback context. - */ - forEachActiveSound: function (callback, scope) + if (addToScene !== undefined) { - var _this = this; + config.add = addToScene; + } - this.sounds.forEach(function (sound, index) - { - if (sound && !sound.pendingRemove) - { - callback.call(scope || _this, sound, index, _this.sounds); - } - }); - }, + BuildGameObject(this.scene, bitmapText, config); - /** - * Sets the global playback rate at which all the sounds will be played. - * - * For example, a value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed - * and 2.0 doubles the audios playback speed. - * - * @method Phaser.Sound.BaseSoundManager#setRate - * @fires Phaser.Sound.Events#GLOBAL_RATE - * @since 3.3.0 - * - * @param {number} value - Global playback rate at which all the sounds will be played. - * - * @return {Phaser.Sound.BaseSoundManager} This Sound Manager. - */ - setRate: function (value) - { - this.rate = value; + return bitmapText; +}); - return this; - }, +// When registering a factory function 'this' refers to the GameObjectCreator context. - /** - * Global playback rate at which all the sounds will be played. - * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed - * and 2.0 doubles the audio's playback speed. - * - * @name Phaser.Sound.BaseSoundManager#rate - * @type {number} - * @default 1 - * @since 3.0.0 - */ - rate: { - get: function () - { - return this._rate; - }, +/***/ }), - set: function (value) - { - this._rate = value; +/***/ 94145: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - this.forEachActiveSound(function (sound) - { - sound.calculateRate(); - }); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.emit(Events.GLOBAL_RATE, this, value); - } +var DynamicBitmapText = __webpack_require__(13468); +var GameObjectFactory = __webpack_require__(61286); - }, +/** + * Creates a new Dynamic Bitmap Text Game Object and adds it to the Scene. + * + * BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure. + * + * During rendering for each letter of the text is rendered to the display, proportionally spaced out and aligned to + * match the font structure. + * + * Dynamic Bitmap Text objects are different from Static Bitmap Text in that they invoke a callback for each + * letter being rendered during the render pass. This callback allows you to manipulate the properties of + * each letter being rendered, such as its position, scale or tint, allowing you to create interesting effects + * like jiggling text, which can't be done with Static text. This means that Dynamic Text takes more processing + * time, so only use them if you require the callback ability they have. + * + * BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability + * to use Web Fonts, however you trade this flexibility for rendering speed. You can also create visually compelling BitmapTexts by + * processing the font texture in an image editor, applying fills and any other effects required. + * + * To create multi-line text insert \r, \n or \r\n escape codes into the text string. + * + * To create a BitmapText data files you need a 3rd party app such as: + * + * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/ + * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner + * Littera (Web-based, free): http://kvazars.com/littera/ + * + * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of + * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson + * + * Note: This method will only be available if the Dynamic Bitmap Text Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#dynamicBitmapText + * @since 3.0.0 + * + * @param {number} x - The x position of the Game Object. + * @param {number} y - The y position of the Game Object. + * @param {string} font - The key of the font to use from the BitmapFont cache. + * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text. + * @param {number} [size] - The font size to set. + * + * @return {Phaser.GameObjects.DynamicBitmapText} The Game Object that was created. + */ +GameObjectFactory.register('dynamicBitmapText', function (x, y, font, text, size) +{ + return this.displayList.add(new DynamicBitmapText(this.scene, x, y, font, text, size)); +}); - /** - * Sets the global detuning of all sounds in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). - * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). - * - * @method Phaser.Sound.BaseSoundManager#setDetune - * @fires Phaser.Sound.Events#GLOBAL_DETUNE - * @since 3.3.0 - * - * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). - * - * @return {Phaser.Sound.BaseSoundManager} This Sound Manager. - */ - setDetune: function (value) - { - this.detune = value; +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns - return this; - }, - /** - * Global detuning of all sounds in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). - * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). - * - * @name Phaser.Sound.BaseSoundManager#detune - * @type {number} - * @default 0 - * @since 3.0.0 - */ - detune: { +/***/ }), - get: function () - { - return this._detune; - }, +/***/ 88899: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - set: function (value) - { - this._detune = value; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.forEachActiveSound(function (sound) - { - sound.calculateRate(); - }); +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - this.emit(Events.GLOBAL_DETUNE, this, value); - } +if (true) +{ + renderWebGL = __webpack_require__(16873); +} - } +if (true) +{ + renderCanvas = __webpack_require__(93438); +} -}); +module.exports = { -module.exports = BaseSoundManager; + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; /***/ }), -/* 146 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 16873: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(70); -var Extend = __webpack_require__(17); -var NOOP = __webpack_require__(1); +var GetCalcMatrix = __webpack_require__(73329); +var TransformMatrix = __webpack_require__(69360); +var Utils = __webpack_require__(75512); + +var tempMatrix = new TransformMatrix(); /** - * @classdesc - * Class containing all the shared state and behavior of a sound object, independent of the implementation. + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @class BaseSound - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Sound - * @constructor + * @method Phaser.GameObjects.DynamicBitmapText#renderWebGL * @since 3.0.0 + * @private * - * @param {Phaser.Sound.BaseSoundManager} manager - Reference to the current sound manager instance. - * @param {string} key - Asset key for the sound. - * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.DynamicBitmapText} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var BaseSound = new Class({ - - Extends: EventEmitter, - - initialize: +var DynamicBitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + var text = src.text; + var textLength = text.length; - function BaseSound (manager, key, config) + if (textLength === 0) { - EventEmitter.call(this); - - /** - * Local reference to the sound manager. - * - * @name Phaser.Sound.BaseSound#manager - * @type {Phaser.Sound.BaseSoundManager} - * @private - * @since 3.0.0 - */ - this.manager = manager; - - /** - * Asset key for the sound. - * - * @name Phaser.Sound.BaseSound#key - * @type {string} - * @readonly - * @since 3.0.0 - */ - this.key = key; - - /** - * Flag indicating if sound is currently playing. - * - * @name Phaser.Sound.BaseSound#isPlaying - * @type {boolean} - * @default false - * @readonly - * @since 3.0.0 - */ - this.isPlaying = false; - - /** - * Flag indicating if sound is currently paused. - * - * @name Phaser.Sound.BaseSound#isPaused - * @type {boolean} - * @default false - * @readonly - * @since 3.0.0 - */ - this.isPaused = false; - - /** - * A property that holds the value of sound's actual playback rate, - * after its rate and detune values has been combined with global - * rate and detune values. - * - * @name Phaser.Sound.BaseSound#totalRate - * @type {number} - * @default 1 - * @readonly - * @since 3.0.0 - */ - this.totalRate = 1; - - /** - * A value representing the duration, in seconds. - * It could be total sound duration or a marker duration. - * - * @name Phaser.Sound.BaseSound#duration - * @type {number} - * @readonly - * @since 3.0.0 - */ - this.duration = this.duration || 0; - - /** - * The total duration of the sound in seconds. - * - * @name Phaser.Sound.BaseSound#totalDuration - * @type {number} - * @readonly - * @since 3.0.0 - */ - this.totalDuration = this.totalDuration || 0; - - /** - * A config object used to store default sound settings' values. - * Default values will be set by properties' setters. - * - * @name Phaser.Sound.BaseSound#config - * @type {Phaser.Types.Sound.SoundConfig} - * @private - * @since 3.0.0 - */ - this.config = { + return; + } - mute: false, - volume: 1, - rate: 1, - detune: 0, - seek: 0, - loop: false, - delay: 0, - pan: 0 + camera.addToRenderList(src); - }; + var pipeline = renderer.pipelines.set(src.pipeline, src); - /** - * Reference to the currently used config. - * It could be default config or marker config. - * - * @name Phaser.Sound.BaseSound#currentConfig - * @type {Phaser.Types.Sound.SoundConfig} - * @private - * @since 3.0.0 - */ - this.currentConfig = this.config; + var result = GetCalcMatrix(src, camera, parentMatrix); - this.config = Extend(this.config, config); + // This causes a flush if the BitmapText has a Post Pipeline + renderer.pipelines.preBatch(src); - /** - * Object containing markers definitions. - * - * @name Phaser.Sound.BaseSound#markers - * @type {Object.} - * @default {} - * @readonly - * @since 3.0.0 - */ - this.markers = {}; + var spriteMatrix = result.sprite; + var calcMatrix = result.calc; - /** - * Currently playing marker. - * 'null' if whole sound is playing. - * - * @name Phaser.Sound.BaseSound#currentMarker - * @type {Phaser.Types.Sound.SoundMarker} - * @default null - * @readonly - * @since 3.0.0 - */ - this.currentMarker = null; + var fontMatrix = tempMatrix; - /** - * Flag indicating if destroy method was called on this sound. - * - * @name Phaser.Sound.BaseSound#pendingRemove - * @type {boolean} - * @private - * @default false - * @since 3.0.0 - */ - this.pendingRemove = false; - }, + var crop = (src.cropWidth > 0 || src.cropHeight > 0); - /** - * Adds a marker into the current sound. A marker is represented by name, start time, duration, and optionally config object. - * This allows you to bundle multiple sounds together into a single audio file and use markers to jump between them for playback. - * - * @method Phaser.Sound.BaseSound#addMarker - * @since 3.0.0 - * - * @param {Phaser.Types.Sound.SoundMarker} marker - Marker object. - * - * @return {boolean} Whether the marker was added successfully. - */ - addMarker: function (marker) + if (crop) { - if (!marker || !marker.name || typeof marker.name !== 'string') - { - return false; - } - - if (this.markers[marker.name]) - { - // eslint-disable-next-line no-console - console.error('addMarker ' + marker.name + ' already exists in Sound'); - - return false; - } + pipeline.flush(); - marker = Extend(true, { - name: '', - start: 0, - duration: this.totalDuration - (marker.start || 0), - config: { - mute: false, - volume: 1, - rate: 1, - detune: 0, - seek: 0, - loop: false, - delay: 0, - pan: 0 - } - }, marker); + renderer.pushScissor( + calcMatrix.tx, + calcMatrix.ty, + src.cropWidth * calcMatrix.scaleX, + src.cropHeight * calcMatrix.scaleY + ); + } - this.markers[marker.name] = marker; + var frame = src.frame; + var texture = frame.glTexture; - return true; - }, + var tintEffect = src.tintFill; + var tintTL = Utils.getTintAppendFloatAlpha(src.tintTopLeft, camera.alpha * src._alphaTL); + var tintTR = Utils.getTintAppendFloatAlpha(src.tintTopRight, camera.alpha * src._alphaTR); + var tintBL = Utils.getTintAppendFloatAlpha(src.tintBottomLeft, camera.alpha * src._alphaBL); + var tintBR = Utils.getTintAppendFloatAlpha(src.tintBottomRight, camera.alpha * src._alphaBR); - /** - * Updates previously added marker. - * - * @method Phaser.Sound.BaseSound#updateMarker - * @since 3.0.0 - * - * @param {Phaser.Types.Sound.SoundMarker} marker - Marker object with updated values. - * - * @return {boolean} Whether the marker was updated successfully. - */ - updateMarker: function (marker) - { - if (!marker || !marker.name || typeof marker.name !== 'string') - { - return false; - } + var textureUnit = pipeline.setGameObject(src); - if (!this.markers[marker.name]) - { - // eslint-disable-next-line no-console - console.warn('Audio Marker: ' + marker.name + ' missing in Sound: ' + this.key); + var xAdvance = 0; + var yAdvance = 0; + var charCode = 0; + var lastCharCode = 0; + var letterSpacing = src.letterSpacing; + var glyph; + var glyphW = 0; + var glyphH = 0; + var lastGlyph; + var scrollX = src.scrollX; + var scrollY = src.scrollY; - return false; - } + var fontData = src.fontData; + var chars = fontData.chars; + var lineHeight = fontData.lineHeight; + var scale = (src.fontSize / fontData.size); + var rotation = 0; - this.markers[marker.name] = Extend(true, this.markers[marker.name], marker); + var align = src._align; + var currentLine = 0; + var lineOffsetX = 0; - return true; - }, + // Update the bounds - skipped internally if not dirty + var bounds = src.getTextBounds(false); - /** - * Removes a marker from the sound. - * - * @method Phaser.Sound.BaseSound#removeMarker - * @since 3.0.0 - * - * @param {string} markerName - The name of the marker to remove. - * - * @return {?Phaser.Types.Sound.SoundMarker} Removed marker object or 'null' if there was no marker with provided name. - */ - removeMarker: function (markerName) + // In case the method above changed it (word wrapping) + if (src.maxWidth > 0) { - var marker = this.markers[markerName]; + text = bounds.wrappedText; + textLength = text.length; + } - if (!marker) - { - return null; - } + var lineData = src._bounds.lines; - this.markers[markerName] = null; + if (align === 1) + { + lineOffsetX = (lineData.longest - lineData.lengths[0]) / 2; + } + else if (align === 2) + { + lineOffsetX = (lineData.longest - lineData.lengths[0]); + } - return marker; - }, + var roundPixels = camera.roundPixels; + var displayCallback = src.displayCallback; + var callbackData = src.callbackData; - /** - * Play this sound, or a marked section of it. - * It always plays the sound from the start. If you want to start playback from a specific time - * you can set 'seek' setting of the config object, provided to this call, to that value. - * - * @method Phaser.Sound.BaseSound#play - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Sound.SoundConfig)} [markerName=''] - If you want to play a marker then provide the marker name here. Alternatively, this parameter can be a SoundConfig object. - * @param {Phaser.Types.Sound.SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound. - * - * @return {boolean} Whether the sound started playing successfully. - */ - play: function (markerName, config) + for (var i = 0; i < textLength; i++) { - if (markerName === undefined) { markerName = ''; } - - if (typeof markerName === 'object') - { - config = markerName; - markerName = ''; - } + charCode = text.charCodeAt(i); - if (typeof markerName !== 'string') + // Carriage-return + if (charCode === 10) { - return false; - } + currentLine++; - if (!markerName) - { - this.currentMarker = null; - this.currentConfig = this.config; - this.duration = this.totalDuration; - } - else - { - if (!this.markers[markerName]) + if (align === 1) { - // eslint-disable-next-line no-console - console.warn('Marker: ' + markerName + ' missing in Sound: ' + this.key); - - return false; + lineOffsetX = (lineData.longest - lineData.lengths[currentLine]) / 2; + } + else if (align === 2) + { + lineOffsetX = (lineData.longest - lineData.lengths[currentLine]); } - this.currentMarker = this.markers[markerName]; - this.currentConfig = this.currentMarker.config; - this.duration = this.currentMarker.duration; + xAdvance = 0; + yAdvance += lineHeight; + lastGlyph = null; + + continue; } - this.resetConfig(); + glyph = chars[charCode]; - this.currentConfig = Extend(this.currentConfig, config); + if (!glyph) + { + continue; + } - this.isPlaying = true; - this.isPaused = false; + glyphW = glyph.width; + glyphH = glyph.height; - return true; - }, + var x = (glyph.xOffset + xAdvance) - scrollX; + var y = (glyph.yOffset + yAdvance) - scrollY; - /** - * Pauses the sound. - * - * @method Phaser.Sound.BaseSound#pause - * @since 3.0.0 - * - * @return {boolean} Whether the sound was paused successfully. - */ - pause: function () - { - if (this.isPaused || !this.isPlaying) + if (lastGlyph !== null) { - return false; + var kerningOffset = glyph.kerning[lastCharCode]; + x += (kerningOffset !== undefined) ? kerningOffset : 0; } - this.isPlaying = false; - this.isPaused = true; - - return true; - }, + xAdvance += glyph.xAdvance + letterSpacing; + lastGlyph = glyph; + lastCharCode = charCode; - /** - * Resumes the sound. - * - * @method Phaser.Sound.BaseSound#resume - * @since 3.0.0 - * - * @return {boolean} Whether the sound was resumed successfully. - */ - resume: function () - { - if (!this.isPaused || this.isPlaying) + // Nothing to render or a space? Then skip to the next glyph + if (glyphW === 0 || glyphH === 0 || charCode === 32) { - return false; + continue; } - this.isPlaying = true; - this.isPaused = false; - - return true; - }, + scale = (src.fontSize / src.fontData.size); + rotation = 0; - /** - * Stop playing this sound. - * - * @method Phaser.Sound.BaseSound#stop - * @since 3.0.0 - * - * @return {boolean} Whether the sound was stopped successfully. - */ - stop: function () - { - if (!this.isPaused && !this.isPlaying) + if (displayCallback) { - return false; - } + callbackData.color = 0; + callbackData.tint.topLeft = tintTL; + callbackData.tint.topRight = tintTR; + callbackData.tint.bottomLeft = tintBL; + callbackData.tint.bottomRight = tintBR; + callbackData.index = i; + callbackData.charCode = charCode; + callbackData.x = x; + callbackData.y = y; + callbackData.scale = scale; + callbackData.rotation = rotation; + callbackData.data = glyph.data; - this.isPlaying = false; - this.isPaused = false; + var output = displayCallback(callbackData); - this.resetConfig(); + x = output.x; + y = output.y; + scale = output.scale; + rotation = output.rotation; - return true; - }, + if (output.color) + { + tintTL = output.color; + tintTR = output.color; + tintBL = output.color; + tintBR = output.color; + } + else + { + tintTL = output.tint.topLeft; + tintTR = output.tint.topRight; + tintBL = output.tint.bottomLeft; + tintBR = output.tint.bottomRight; + } - /** - * Method used internally for applying config values to some of the sound properties. - * - * @method Phaser.Sound.BaseSound#applyConfig - * @protected - * @since 3.0.0 - */ - applyConfig: function () - { - this.mute = this.currentConfig.mute; - this.volume = this.currentConfig.volume; - this.rate = this.currentConfig.rate; - this.detune = this.currentConfig.detune; - this.loop = this.currentConfig.loop; - this.pan = this.currentConfig.pan; - }, + tintTL = Utils.getTintAppendFloatAlpha(tintTL, camera.alpha * src._alphaTL); + tintTR = Utils.getTintAppendFloatAlpha(tintTR, camera.alpha * src._alphaTR); + tintBL = Utils.getTintAppendFloatAlpha(tintBL, camera.alpha * src._alphaBL); + tintBR = Utils.getTintAppendFloatAlpha(tintBR, camera.alpha * src._alphaBR); + } - /** - * Method used internally for resetting values of some of the config properties. - * - * @method Phaser.Sound.BaseSound#resetConfig - * @protected - * @since 3.0.0 - */ - resetConfig: function () - { - this.currentConfig.seek = 0; - this.currentConfig.delay = 0; - }, + x *= scale; + y *= scale; - /** - * Update method called automatically by sound manager on every game step. - * - * @method Phaser.Sound.BaseSound#update - * @override - * @protected - * @since 3.0.0 - * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time elapsed since the last frame. - */ - update: NOOP, + x -= src.displayOriginX; + y -= src.displayOriginY; - /** - * Method used internally to calculate total playback rate of the sound. - * - * @method Phaser.Sound.BaseSound#calculateRate - * @protected - * @since 3.0.0 - */ - calculateRate: function () - { - var cent = 1.0005777895065548; // Math.pow(2, 1/1200); - var totalDetune = this.currentConfig.detune + this.manager.detune; - var detuneRate = Math.pow(cent, totalDetune); + x += lineOffsetX; - this.totalRate = this.currentConfig.rate * this.manager.rate * detuneRate; - }, + fontMatrix.applyITRS(x, y, rotation, scale, scale); - /** - * Destroys this sound and all associated events and marks it for removal from the sound manager. - * - * @method Phaser.Sound.BaseSound#destroy - * @fires Phaser.Sound.Events#DESTROY - * @since 3.0.0 - */ - destroy: function () - { - if (this.pendingRemove) - { - return; - } + calcMatrix.multiply(fontMatrix, spriteMatrix); - this.emit(Events.DESTROY, this); - this.pendingRemove = true; - this.manager = null; - this.key = ''; - this.removeAllListeners(); - this.isPlaying = false; - this.isPaused = false; - this.config = null; - this.currentConfig = null; - this.markers = null; - this.currentMarker = null; - } + var u0 = glyph.u0; + var v0 = glyph.v0; + var u1 = glyph.u1; + var v1 = glyph.v1; -}); + var xw = glyphW; + var yh = glyphH; -module.exports = BaseSound; + var tx0 = spriteMatrix.e; + var ty0 = spriteMatrix.f; + var tx1 = yh * spriteMatrix.c + spriteMatrix.e; + var ty1 = yh * spriteMatrix.d + spriteMatrix.f; -/***/ }), -/* 147 */ -/***/ (function(module, exports, __webpack_require__) { + var tx2 = xw * spriteMatrix.a + yh * spriteMatrix.c + spriteMatrix.e; + var ty2 = xw * spriteMatrix.b + yh * spriteMatrix.d + spriteMatrix.f; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var tx3 = xw * spriteMatrix.a + spriteMatrix.e; + var ty3 = xw * spriteMatrix.b + spriteMatrix.f; -var CheckMatrix = __webpack_require__(209); -var TransposeMatrix = __webpack_require__(435); + if (roundPixels) + { + tx0 = Math.round(tx0); + ty0 = Math.round(ty0); -/** - * Rotates the array matrix based on the given rotation value. - * - * The value can be given in degrees: 90, -90, 270, -270 or 180, - * or a string command: `rotateLeft`, `rotateRight` or `rotate180`. - * - * Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}. - * - * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) - * have the same length. There must be at least two rows. This is an example matrix: - * - * ``` - * [ - * [ 1, 1, 1, 1, 1, 1 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 2, 0, 1, 2, 0, 4 ], - * [ 2, 0, 3, 4, 0, 4 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 3, 3, 3, 3, 3, 3 ] - * ] - * ``` - * - * @function Phaser.Utils.Array.Matrix.RotateMatrix - * @since 3.0.0 - * - * @generic T - * @genericUse {T[][]} - [matrix,$return] - * - * @param {T[][]} [matrix] - The array to rotate. - * @param {(number|string)} [direction=90] - The amount to rotate the matrix by. - * - * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. - */ -var RotateMatrix = function (matrix, direction) -{ - if (direction === undefined) { direction = 90; } + tx1 = Math.round(tx1); + ty1 = Math.round(ty1); - if (!CheckMatrix(matrix)) - { - return null; - } + tx2 = Math.round(tx2); + ty2 = Math.round(ty2); - if (typeof direction !== 'string') - { - direction = ((direction % 360) + 360) % 360; - } + tx3 = Math.round(tx3); + ty3 = Math.round(ty3); + } - if (direction === 90 || direction === -270 || direction === 'rotateLeft') - { - matrix = TransposeMatrix(matrix); - matrix.reverse(); - } - else if (direction === -90 || direction === 270 || direction === 'rotateRight') - { - matrix.reverse(); - matrix = TransposeMatrix(matrix); + pipeline.batchQuad(src, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); } - else if (Math.abs(direction) === 180 || direction === 'rotate180') + + if (crop) { - for (var i = 0; i < matrix.length; i++) - { - matrix[i].reverse(); - } + pipeline.flush(); - matrix.reverse(); + renderer.popScissor(); } - return matrix; + renderer.pipelines.postBatch(src); }; -module.exports = RotateMatrix; +module.exports = DynamicBitmapTextWebGLRenderer; /***/ }), -/* 148 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 44616: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Clamp = __webpack_require__(18); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(15); -var GetBitmapTextSize = __webpack_require__(1043); -var ParseFromAtlas = __webpack_require__(1044); -var ParseXMLBitmapFont = __webpack_require__(212); -var Rectangle = __webpack_require__(10); -var Render = __webpack_require__(1045); +var Class = __webpack_require__(56694); +var Clamp = __webpack_require__(82897); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var GetBitmapTextSize = __webpack_require__(82173); +var ParseFromAtlas = __webpack_require__(68298); +var ParseXMLBitmapFont = __webpack_require__(31476); +var Rectangle = __webpack_require__(74118); +var Render = __webpack_require__(84557); /** * @classdesc @@ -65033,7 +62191,8 @@ var Render = __webpack_require__(1045); * * BMFont (Windows, free): {@link http://www.angelcode.com/products/bmfont/|http://www.angelcode.com/products/bmfont/} * Glyph Designer (OS X, commercial): {@link http://www.71squared.com/en/glyphdesigner|http://www.71squared.com/en/glyphdesigner} - * Littera (Web-based, free): {@link http://kvazars.com/littera/|http://kvazars.com/littera/} + * Snow BMF (Web-based, free): {@link https://snowb.org//|https://snowb.org/} + * Littera (Flash-based, free): {@link http://kvazars.com/littera/|http://kvazars.com/littera/} * * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: {@link http://codebeautify.org/xmltojson|http://codebeautify.org/xmltojson} @@ -65047,9 +62206,11 @@ var Render = __webpack_require__(1045); * @extends Phaser.GameObjects.Components.Alpha * @extends Phaser.GameObjects.Components.BlendMode * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.GetBounds * @extends Phaser.GameObjects.Components.Mask * @extends Phaser.GameObjects.Components.Origin * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline * @extends Phaser.GameObjects.Components.ScrollFactor * @extends Phaser.GameObjects.Components.Texture * @extends Phaser.GameObjects.Components.Tint @@ -65072,9 +62233,11 @@ var BitmapText = new Class({ Components.Alpha, Components.BlendMode, Components.Depth, + Components.GetBounds, Components.Mask, Components.Origin, Components.Pipeline, + Components.PostPipeline, Components.ScrollFactor, Components.Texture, Components.Tint, @@ -65152,6 +62315,18 @@ var BitmapText = new Class({ */ this._letterSpacing = 0; + /** + * Adds / Removes line spacing in a multiline BitmapText object. + * + * Can be a negative or positive number. + * + * @name Phaser.GameObjects.BitmapText#_lineSpacing + * @type {number} + * @private + * @since 3.60.0 + */ + this._lineSpacing = 0; + /** * Controls the alignment of each line of text in this BitmapText object. * Only has any effect when this BitmapText contains multiple lines of text, split with carriage-returns. @@ -65280,6 +62455,7 @@ var BitmapText = new Class({ this.setPosition(x, y); this.setOrigin(0, 0); this.initPipeline(); + this.initPostPipeline(); this.setText(text); }, @@ -65380,6 +62556,30 @@ var BitmapText = new Class({ return this; }, + /** + * Sets the line spacing value. This value is added to the font height to + * calculate the overall line height. + * + * Spacing can be a negative or positive number. + * + * Only has an effect if this BitmapText object contains multiple lines of text. + * + * @method Phaser.GameObjects.BitmapText#setLineSpacing + * @since 3.60.0 + * + * @param {number} [spacing=0] - The amount of space to add between each line in multi-line text. + * + * @return {this} This BitmapText Object. + */ + setLineSpacing: function (spacing) + { + if (spacing === undefined) { spacing = 0; } + + this.lineSpacing = spacing; + + return this; + }, + /** * Set the textual content of this BitmapText. * @@ -65921,6 +63121,32 @@ var BitmapText = new Class({ }, + /** + * Adds / Removes spacing between lines. + * + * Can be a negative or positive number. + * + * You can also use the method `setLineSpacing` if you want a chainable way to change the line spacing. + * + * @name Phaser.GameObjects.BitmapText#lineSpacing + * @type {number} + * @since 3.60.0 + */ + lineSpacing: { + + set: function (value) + { + this._lineSpacing = value; + this._dirty = true; + }, + + get: function () + { + return this._lineSpacing; + } + + }, + /** * The maximum display width of this BitmapText in pixels. * @@ -65953,6 +63179,8 @@ var BitmapText = new Class({ /** * The width of this Bitmap Text. * + * This property is read-only. + * * @name Phaser.GameObjects.BitmapText#width * @type {number} * @readonly @@ -65970,7 +63198,9 @@ var BitmapText = new Class({ }, /** - * The height of this bitmap text. + * The height of this Bitmap text. + * + * This property is read-only. * * @name Phaser.GameObjects.BitmapText#height * @type {number} @@ -65988,6 +63218,48 @@ var BitmapText = new Class({ }, + /** + * The displayed width of this Bitmap Text. + * + * This value takes into account the scale factor. + * + * This property is read-only. + * + * @name Phaser.GameObjects.BitmapText#displayWidth + * @type {number} + * @readonly + * @since 3.60.0 + */ + displayWidth: { + + get: function () + { + return this.width; + } + + }, + + /** + * The displayed height of this Bitmap Text. + * + * This value takes into account the scale factor. + * + * This property is read-only. + * + * @name Phaser.GameObjects.BitmapText#displayHeight + * @type {number} + * @readonly + * @since 3.60.0 + */ + displayHeight: { + + get: function () + { + return this.height; + } + + }, + /** * Build a JSON representation of this Bitmap Text. * @@ -66007,6 +63279,7 @@ var BitmapText = new Class({ text: this.text, fontSize: this.fontSize, letterSpacing: this.letterSpacing, + lineSpacing: this.lineSpacing, align: this.align }; @@ -66097,11996 +63370,12254 @@ module.exports = BitmapText; /***/ }), -/* 149 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 97545: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); - -/** - * @callback EachSetCallback - * - * @param {E} entry - The Set entry. - * @param {number} index - The index of the entry within the Set. - * - * @return {?boolean} The callback result. - */ +var SetTransform = __webpack_require__(49584); /** - * @classdesc - * A Set is a collection of unique elements. + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @class Set - * @memberof Phaser.Structs - * @constructor + * @method Phaser.GameObjects.BitmapText#renderCanvas * @since 3.0.0 + * @private * - * @generic T - * @genericUse {T[]} - [elements] - * - * @param {Array.<*>} [elements] - An optional array of elements to insert into this Set. + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.BitmapText} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var Set = new Class({ +var BitmapTextCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + var text = src._text; + var textLength = text.length; - initialize: + var ctx = renderer.currentContext; - function Set (elements) + if (textLength === 0 || !SetTransform(renderer, ctx, src, camera, parentMatrix)) { - /** - * The entries of this Set. Stored internally as an array. - * - * @genericUse {T[]} - [$type] - * - * @name Phaser.Structs.Set#entries - * @type {Array.<*>} - * @default [] - * @since 3.0.0 - */ - this.entries = []; + return; + } - if (Array.isArray(elements)) - { - for (var i = 0; i < elements.length; i++) - { - this.set(elements[i]); - } - } - }, + camera.addToRenderList(src); - /** - * Inserts the provided value into this Set. If the value is already contained in this Set this method will have no effect. - * - * @method Phaser.Structs.Set#set - * @since 3.0.0 - * - * @genericUse {T} - [value] - * @genericUse {Phaser.Structs.Set.} - [$return] - * - * @param {*} value - The value to insert into this Set. - * - * @return {Phaser.Structs.Set} This Set object. - */ - set: function (value) + var textureFrame = src.fromAtlas + ? src.frame + : src.texture.frames['__BASE']; + + var chars = src.fontData.chars; + var lineHeight = src.fontData.lineHeight; + var letterSpacing = src._letterSpacing; + var lineSpacing = src._lineSpacing; + + var xAdvance = 0; + var yAdvance = 0; + + var charCode = 0; + + var glyph = null; + var glyphX = 0; + var glyphY = 0; + var glyphW = 0; + var glyphH = 0; + + var x = 0; + var y = 0; + + var lastGlyph = null; + var lastCharCode = 0; + + var image = textureFrame.source.image; + + var textureX = textureFrame.cutX; + var textureY = textureFrame.cutY; + + var scale = (src._fontSize / src.fontData.size); + + var align = src._align; + var currentLine = 0; + var lineOffsetX = 0; + + // Update the bounds - skipped internally if not dirty + var bounds = src.getTextBounds(false); + + // In case the method above changed it (word wrapping) + if (src.maxWidth > 0) { - if (this.entries.indexOf(value) === -1) - { - this.entries.push(value); - } + text = bounds.wrappedText; + textLength = text.length; + } - return this; - }, + var lineData = src._bounds.lines; - /** - * Get an element of this Set which has a property of the specified name, if that property is equal to the specified value. - * If no elements of this Set satisfy the condition then this method will return `null`. - * - * @method Phaser.Structs.Set#get - * @since 3.0.0 - * - * @genericUse {T} - [value,$return] - * - * @param {string} property - The property name to check on the elements of this Set. - * @param {*} value - The value to check for. - * - * @return {*} The first element of this Set that meets the required condition, or `null` if this Set contains no elements that meet the condition. - */ - get: function (property, value) + if (align === 1) { - for (var i = 0; i < this.entries.length; i++) + lineOffsetX = (lineData.longest - lineData.lengths[0]) / 2; + } + else if (align === 2) + { + lineOffsetX = (lineData.longest - lineData.lengths[0]); + } + + ctx.translate(-src.displayOriginX, -src.displayOriginY); + + var roundPixels = camera.roundPixels; + + for (var i = 0; i < textLength; i++) + { + charCode = text.charCodeAt(i); + + if (charCode === 10) { - var entry = this.entries[i]; + currentLine++; - if (entry[property] === value) + if (align === 1) { - return entry; + lineOffsetX = (lineData.longest - lineData.lengths[currentLine]) / 2; + } + else if (align === 2) + { + lineOffsetX = (lineData.longest - lineData.lengths[currentLine]); } - } - }, - /** - * Returns an array containing all the values in this Set. - * - * @method Phaser.Structs.Set#getArray - * @since 3.0.0 - * - * @genericUse {T[]} - [$return] - * - * @return {Array.<*>} An array containing all the values in this Set. - */ - getArray: function () - { - return this.entries.slice(0); - }, + xAdvance = 0; + yAdvance += lineHeight + lineSpacing; - /** - * Removes the given value from this Set if this Set contains that value. - * - * @method Phaser.Structs.Set#delete - * @since 3.0.0 - * - * @genericUse {T} - [value] - * @genericUse {Phaser.Structs.Set.} - [$return] - * - * @param {*} value - The value to remove from the Set. - * - * @return {Phaser.Structs.Set} This Set object. - */ - delete: function (value) - { - var index = this.entries.indexOf(value); + lastGlyph = null; - if (index > -1) + continue; + } + + glyph = chars[charCode]; + + if (!glyph) { - this.entries.splice(index, 1); + continue; } - return this; - }, + glyphX = textureX + glyph.x; + glyphY = textureY + glyph.y; - /** - * Dumps the contents of this Set to the console via `console.group`. - * - * @method Phaser.Structs.Set#dump - * @since 3.0.0 - */ - dump: function () - { - // eslint-disable-next-line no-console - console.group('Set'); + glyphW = glyph.width; + glyphH = glyph.height; - for (var i = 0; i < this.entries.length; i++) + x = glyph.xOffset + xAdvance; + y = glyph.yOffset + yAdvance; + + if (lastGlyph !== null) { - var entry = this.entries[i]; - console.log(entry); + var kerningOffset = glyph.kerning[lastCharCode]; + x += (kerningOffset !== undefined) ? kerningOffset : 0; } - // eslint-disable-next-line no-console - console.groupEnd(); - }, + x *= scale; + y *= scale; - /** - * Passes each value in this Set to the given callback. - * Use this function when you know this Set will be modified during the iteration, otherwise use `iterate`. - * - * @method Phaser.Structs.Set#each - * @since 3.0.0 - * - * @genericUse {EachSetCallback.} - [callback] - * @genericUse {Phaser.Structs.Set.} - [$return] - * - * @param {EachSetCallback} callback - The callback to be invoked and passed each value this Set contains. - * @param {*} [callbackScope] - The scope of the callback. - * - * @return {Phaser.Structs.Set} This Set object. - */ - each: function (callback, callbackScope) - { - var i; - var temp = this.entries.slice(); - var len = temp.length; + x += lineOffsetX; - if (callbackScope) + xAdvance += glyph.xAdvance + letterSpacing + ((kerningOffset !== undefined) ? kerningOffset : 0); + lastGlyph = glyph; + lastCharCode = charCode; + + // Nothing to render or a space? Then skip to the next glyph + if (glyphW === 0 || glyphH === 0 || charCode === 32) { - for (i = 0; i < len; i++) - { - if (callback.call(callbackScope, temp[i], i) === false) - { - break; - } - } + continue; } - else + + if (roundPixels) { - for (i = 0; i < len; i++) - { - if (callback(temp[i], i) === false) - { - break; - } - } + x = Math.round(x); + y = Math.round(y); } - return this; - }, + ctx.save(); - /** - * Passes each value in this Set to the given callback. - * For when you absolutely know this Set won't be modified during the iteration. - * - * @method Phaser.Structs.Set#iterate - * @since 3.0.0 - * - * @genericUse {EachSetCallback.} - [callback] - * @genericUse {Phaser.Structs.Set.} - [$return] - * - * @param {EachSetCallback} callback - The callback to be invoked and passed each value this Set contains. - * @param {*} [callbackScope] - The scope of the callback. - * - * @return {Phaser.Structs.Set} This Set object. - */ - iterate: function (callback, callbackScope) - { - var i; - var len = this.entries.length; + ctx.translate(x, y); - if (callbackScope) - { - for (i = 0; i < len; i++) - { - if (callback.call(callbackScope, this.entries[i], i) === false) - { - break; - } - } - } - else - { - for (i = 0; i < len; i++) - { - if (callback(this.entries[i], i) === false) - { - break; - } - } - } + ctx.scale(scale, scale); - return this; - }, + ctx.drawImage(image, glyphX, glyphY, glyphW, glyphH, 0, 0, glyphW, glyphH); - /** - * Goes through each entry in this Set and invokes the given function on them, passing in the arguments. - * - * @method Phaser.Structs.Set#iterateLocal - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.Set.} - [$return] - * - * @param {string} callbackKey - The key of the function to be invoked on each Set entry. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. - * - * @return {Phaser.Structs.Set} This Set object. - */ - iterateLocal: function (callbackKey) - { - var i; - var args = []; + ctx.restore(); + } - for (i = 1; i < arguments.length; i++) - { - args.push(arguments[i]); - } + ctx.restore(); +}; - var len = this.entries.length; +module.exports = BitmapTextCanvasRenderer; - for (i = 0; i < len; i++) - { - var entry = this.entries[i]; - entry[callbackKey].apply(entry, args); - } +/***/ }), - return this; - }, +/***/ 95499: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - /** - * Clears this Set so that it no longer contains any values. - * - * @method Phaser.Structs.Set#clear - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.Set.} - [$return] - * - * @return {Phaser.Structs.Set} This Set object. - */ - clear: function () - { - this.entries.length = 0; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var BitmapText = __webpack_require__(44616); +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var GetValue = __webpack_require__(10850); - /** - * Returns `true` if this Set contains the given value, otherwise returns `false`. - * - * @method Phaser.Structs.Set#contains - * @since 3.0.0 - * - * @genericUse {T} - [value] - * - * @param {*} value - The value to check for in this Set. - * - * @return {boolean} `true` if the given value was found in this Set, otherwise `false`. - */ - contains: function (value) - { - return (this.entries.indexOf(value) > -1); - }, +/** + * Creates a new Bitmap Text Game Object and returns it. + * + * Note: This method will only be available if the Bitmap Text Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#bitmapText + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.BitmapText.BitmapTextConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.BitmapText} The Game Object that was created. + */ +GameObjectCreator.register('bitmapText', function (config, addToScene) +{ + if (config === undefined) { config = {}; } - /** - * Returns a new Set containing all values that are either in this Set or in the Set provided as an argument. - * - * @method Phaser.Structs.Set#union - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.Set.} - [set,$return] - * - * @param {Phaser.Structs.Set} set - The Set to perform the union with. - * - * @return {Phaser.Structs.Set} A new Set containing all the values in this Set and the Set provided as an argument. - */ - union: function (set) + var font = GetValue(config, 'font', ''); + var text = GetAdvancedValue(config, 'text', ''); + var size = GetAdvancedValue(config, 'size', false); + var align = GetValue(config, 'align', 0); + + var bitmapText = new BitmapText(this.scene, 0, 0, font, text, size, align); + + if (addToScene !== undefined) { - var newSet = new Set(); + config.add = addToScene; + } - set.entries.forEach(function (value) - { - newSet.set(value); - }); + BuildGameObject(this.scene, bitmapText, config); - this.entries.forEach(function (value) - { - newSet.set(value); - }); + return bitmapText; +}); - return newSet; - }, +// When registering a factory function 'this' refers to the GameObjectCreator context. - /** - * Returns a new Set that contains only the values which are in this Set and that are also in the given Set. - * - * @method Phaser.Structs.Set#intersect - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.Set.} - [set,$return] - * - * @param {Phaser.Structs.Set} set - The Set to intersect this set with. - * - * @return {Phaser.Structs.Set} The result of the intersection, as a new Set. - */ - intersect: function (set) + +/***/ }), + +/***/ 21797: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BitmapText = __webpack_require__(44616); +var GameObjectFactory = __webpack_require__(61286); + +/** + * Creates a new Bitmap Text Game Object and adds it to the Scene. + * + * BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure. + * + * During rendering for each letter of the text is rendered to the display, proportionally spaced out and aligned to + * match the font structure. + * + * BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability + * to use Web Fonts, however you trade this flexibility for rendering speed. You can also create visually compelling BitmapTexts by + * processing the font texture in an image editor, applying fills and any other effects required. + * + * To create multi-line text insert \r, \n or \r\n escape codes into the text string. + * + * To create a BitmapText data files you need a 3rd party app such as: + * + * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/ + * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner + * Littera (Web-based, free): http://kvazars.com/littera/ + * + * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of + * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson + * + * Note: This method will only be available if the Bitmap Text Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#bitmapText + * @since 3.0.0 + * + * @param {number} x - The x position of the Game Object. + * @param {number} y - The y position of the Game Object. + * @param {string} font - The key of the font to use from the BitmapFont cache. + * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text. + * @param {number} [size] - The font size to set. + * @param {number} [align=0] - The alignment of the text in a multi-line BitmapText object. + * + * @return {Phaser.GameObjects.BitmapText} The Game Object that was created. + */ +GameObjectFactory.register('bitmapText', function (x, y, font, text, size, align) +{ + return this.displayList.add(new BitmapText(this.scene, x, y, font, text, size, align)); +}); + +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns + + +/***/ }), + +/***/ 84557: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(26372); +} + +if (true) +{ + renderCanvas = __webpack_require__(97545); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), + +/***/ 26372: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BatchChar = __webpack_require__(8810); +var GetCalcMatrix = __webpack_require__(73329); +var Utils = __webpack_require__(75512); + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.BitmapText#renderWebGL + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.BitmapText} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var BitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + var text = src._text; + var textLength = text.length; + + if (textLength === 0) { - var newSet = new Set(); + return; + } - this.entries.forEach(function (value) - { - if (set.contains(value)) - { - newSet.set(value); - } - }); + camera.addToRenderList(src); - return newSet; - }, + var pipeline = renderer.pipelines.set(src.pipeline, src); - /** - * Returns a new Set containing all the values in this Set which are *not* also in the given Set. - * - * @method Phaser.Structs.Set#difference - * @since 3.0.0 - * - * @genericUse {Phaser.Structs.Set.} - [set,$return] - * - * @param {Phaser.Structs.Set} set - The Set to perform the difference with. - * - * @return {Phaser.Structs.Set} A new Set containing all the values in this Set that are not also in the Set provided as an argument to this method. - */ - difference: function (set) + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + + // This causes a flush if the BitmapText has a Post Pipeline + renderer.pipelines.preBatch(src); + + var roundPixels = camera.roundPixels; + + var cameraAlpha = camera.alpha; + + var charColors = src.charColors; + + var tintEffect = src.tintFill; + + var getTint = Utils.getTintAppendFloatAlpha; + + var tintTL = getTint(src.tintTopLeft, cameraAlpha * src._alphaTL); + var tintTR = getTint(src.tintTopRight, cameraAlpha * src._alphaTR); + var tintBL = getTint(src.tintBottomLeft, cameraAlpha * src._alphaBL); + var tintBR = getTint(src.tintBottomRight, cameraAlpha * src._alphaBR); + + var texture = src.frame.glTexture; + var textureUnit = pipeline.setGameObject(src); + + // Update the bounds - skipped internally if not dirty + var bounds = src.getTextBounds(false); + + var i; + var char; + var glyph; + + var characters = bounds.characters; + + var dropShadowX = src.dropShadowX; + var dropShadowY = src.dropShadowY; + + var dropShadow = (dropShadowX !== 0 || dropShadowY !== 0); + + if (dropShadow) { - var newSet = new Set(); + var srcShadowColor = src.dropShadowColor; + var srcShadowAlpha = src.dropShadowAlpha; - this.entries.forEach(function (value) + var shadowTL = getTint(srcShadowColor, cameraAlpha * srcShadowAlpha * src._alphaTL); + var shadowTR = getTint(srcShadowColor, cameraAlpha * srcShadowAlpha * src._alphaTR); + var shadowBL = getTint(srcShadowColor, cameraAlpha * srcShadowAlpha * src._alphaBL); + var shadowBR = getTint(srcShadowColor, cameraAlpha * srcShadowAlpha * src._alphaBR); + + for (i = 0; i < characters.length; i++) { - if (!set.contains(value)) + char = characters[i]; + glyph = char.glyph; + + if (char.code === 32 || glyph.width === 0 || glyph.height === 0) { - newSet.set(value); + continue; } - }); - return newSet; - }, + BatchChar(pipeline, src, char, glyph, dropShadowX, dropShadowY, calcMatrix, roundPixels, shadowTL, shadowTR, shadowBL, shadowBR, 1, texture, textureUnit); + } + } - /** - * The size of this Set. This is the number of entries within it. - * Changing the size will truncate the Set if the given value is smaller than the current size. - * Increasing the size larger than the current size has no effect. - * - * @name Phaser.Structs.Set#size - * @type {number} - * @since 3.0.0 - */ - size: { + for (i = 0; i < characters.length; i++) + { + char = characters[i]; + glyph = char.glyph; - get: function () + if (char.code === 32 || glyph.width === 0 || glyph.height === 0) { - return this.entries.length; - }, + continue; + } - set: function (value) + if (charColors[char.i]) { - if (value < this.entries.length) - { - return this.entries.length = value; - } - else - { - return this.entries.length; - } + var color = charColors[char.i]; + + var charTintEffect = color.tintEffect; + var charTintTL = getTint(color.tintTL, cameraAlpha * src._alphaTL); + var charTintTR = getTint(color.tintTR, cameraAlpha * src._alphaTR); + var charTintBL = getTint(color.tintBL, cameraAlpha * src._alphaBL); + var charTintBR = getTint(color.tintBR, cameraAlpha * src._alphaBR); + + BatchChar(pipeline, src, char, glyph, 0, 0, calcMatrix, roundPixels, charTintTL, charTintTR, charTintBL, charTintBR, charTintEffect, texture, textureUnit); + } + else + { + BatchChar(pipeline, src, char, glyph, 0, 0, calcMatrix, roundPixels, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); } + // Debug test if the characters are in the correct place when rendered: + // pipeline.drawFillRect(tx0, ty0, tx2 - tx0, ty2 - ty0, 0x00ff00, 0.5); } -}); + renderer.pipelines.postBatch(src); +}; -module.exports = Set; +module.exports = BitmapTextWebGLRenderer; /***/ }), -/* 150 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 52816: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(15); -var IntegerToColor = __webpack_require__(189); -var PIPELINES_CONST = __webpack_require__(92); -var Render = __webpack_require__(1182); +var BlitterRender = __webpack_require__(92246); +var Bob = __webpack_require__(41664); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var Frame = __webpack_require__(82047); +var GameObject = __webpack_require__(89980); +var List = __webpack_require__(71207); /** - * @classdesc - * The Point Light Game Object provides a way to add a point light effect into your game, - * without the expensive shader processing requirements of the traditional Light Game Object. - * - * The difference is that the Point Light renders using a custom shader, designed to give the - * impression of a point light source, of variable radius, intensity and color, in your game. - * However, unlike the Light Game Object, it does not impact any other Game Objects, or use their - * normal maps for calcuations. This makes them extremely fast to render compared to Lights - * and perfect for special effects, such as flickering torches or muzzle flashes. + * @callback CreateCallback * - * For maximum performance you should batch Point Light Game Objects together. This means - * ensuring they follow each other consecutively on the display list. Ideally, use a Layer - * Game Object and then add just Point Lights to it, so that it can batch together the rendering - * of the lights. You don't _have_ to do this, and if you've only a handful of Point Lights in - * your game then it's perfectly safe to mix them into the dislay list as normal. However, if - * you're using a large number of them, please consider how they are mixed into the display list. + * @param {Phaser.GameObjects.Bob} bob - The Bob that was created by the Blitter. + * @param {number} index - The position of the Bob within the Blitter display list. + */ + +/** + * @classdesc + * A Blitter Game Object. * - * The renderer will automatically cull Point Lights. Those with a radius that does not intersect - * with the Camera will be skipped in the rendering list. This happens automatically and the - * culled state is refreshed every frame, for every camera. + * The Blitter Game Object is a special kind of container that creates, updates and manages Bob objects. + * Bobs are designed for rendering speed rather than flexibility. They consist of a texture, or frame from a texture, + * a position and an alpha value. You cannot scale or rotate them. They use a batched drawing method for speed + * during rendering. * - * The origin of a Point Light is always 0.5 and it cannot be changed. + * A Blitter Game Object has one texture bound to it. Bobs created by the Blitter can use any Frame from this + * Texture to render with, but they cannot use any other Texture. It is this single texture-bind that allows + * them their speed. * - * Point Lights are a WebGL only feature and do not have a Canvas counterpart. + * If you have a need to blast a large volume of frames around the screen then Blitter objects are well worth + * investigating. They are especially useful for using as a base for your own special effects systems. * - * @class PointLight + * @class Blitter * @extends Phaser.GameObjects.GameObject * @memberof Phaser.GameObjects * @constructor - * @since 3.50.0 + * @since 3.0.0 * - * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.Alpha * @extends Phaser.GameObjects.Components.BlendMode * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.GetBounds * @extends Phaser.GameObjects.Components.Mask * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Texture * @extends Phaser.GameObjects.Components.Transform * @extends Phaser.GameObjects.Components.Visible * - * @param {Phaser.Scene} scene - The Scene to which this Point Light belongs. A Point Light can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Point Light in the world. - * @param {number} y - The vertical position of this Point Light in the world. - * @param {number} [color=0xffffff] - The color of the Point Light, given as a hex value. - * @param {number} [radius=128] - The radius of the Point Light. - * @param {number} [intensity=1] - The intensity, or colr blend, of the Point Light. - * @param {number} [attenuation=0.1] - The attenuation of the Point Light. This is the reduction of light from the center point. + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time. + * @param {number} [x=0] - The x coordinate of this Game Object in world space. + * @param {number} [y=0] - The y coordinate of this Game Object in world space. + * @param {string} [texture='__DEFAULT'] - The key of the texture this Game Object will use for rendering. The Texture must already exist in the Texture Manager. + * @param {(string|number)} [frame=0] - The Frame of the Texture that this Game Object will use. Only set if the Texture has multiple frames, such as a Texture Atlas or Sprite Sheet. */ -var PointLight = new Class({ +var Blitter = new Class({ Extends: GameObject, Mixins: [ - Components.AlphaSingle, + Components.Alpha, Components.BlendMode, Components.Depth, - Components.GetBounds, Components.Mask, Components.Pipeline, + Components.PostPipeline, Components.ScrollFactor, + Components.Size, + Components.Texture, Components.Transform, Components.Visible, - Render + BlitterRender ], initialize: - function PointLight (scene, x, y, color, radius, intensity, attenuation) + function Blitter (scene, x, y, texture, frame) { - if (color === undefined) { color = 0xffffff; } - if (radius === undefined) { radius = 128; } - if (intensity === undefined) { intensity = 1; } - if (attenuation === undefined) { attenuation = 0.1; } - - GameObject.call(this, scene, 'PointLight'); - - this.initPipeline(PIPELINES_CONST.POINTLIGHT_PIPELINE); + GameObject.call(this, scene, 'Blitter'); + this.setTexture(texture, frame); this.setPosition(x, y); + this.initPipeline(); + this.initPostPipeline(); /** - * The color of this Point Light. This property is an instance of a - * Color object, so you can use the methods within it, such as `setTo(r, g, b)` - * to change the color value. + * The children of this Blitter. + * This List contains all of the Bob objects created by the Blitter. * - * @name Phaser.GameObjects.PointLight#color - * @type {Phaser.Display.Color} - * @since 3.50.0 + * @name Phaser.GameObjects.Blitter#children + * @type {Phaser.Structs.List.} + * @since 3.0.0 */ - this.color = IntegerToColor(color); + this.children = new List(); /** - * The intensity of the Point Light. - * - * The colors of the light are multiplied by this value during rendering. + * A transient array that holds all of the Bobs that will be rendered this frame. + * The array is re-populated whenever the dirty flag is set. * - * @name Phaser.GameObjects.PointLight#intensity - * @type {number} - * @since 3.50.0 + * @name Phaser.GameObjects.Blitter#renderList + * @type {Phaser.GameObjects.Bob[]} + * @default [] + * @private + * @since 3.0.0 */ - this.intensity = intensity; + this.renderList = []; /** - * The attenuation of the Point Light. - * - * This value controls the force with which the light falls-off from the center of the light. - * - * Use small float-based values, i.e. 0.1. + * Is the Blitter considered dirty? + * A 'dirty' Blitter has had its child count changed since the last frame. * - * @name Phaser.GameObjects.PointLight#attenuation - * @type {number} - * @since 3.50.0 + * @name Phaser.GameObjects.Blitter#dirty + * @type {boolean} + * @since 3.0.0 */ - this.attenuation = attenuation; - - // read only: - this.width = radius * 2; - this.height = radius * 2; - - this._radius = radius; + this.dirty = false; }, /** - * The radius of the Point Light. + * Creates a new Bob in this Blitter. * - * @name Phaser.GameObjects.PointLight#radius - * @type {number} - * @since 3.50.0 + * The Bob is created at the given coordinates, relative to the Blitter and uses the given frame. + * A Bob can use any frame belonging to the texture bound to the Blitter. + * + * @method Phaser.GameObjects.Blitter#create + * @since 3.0.0 + * + * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. + * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. + * @param {(string|number|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. + * @param {boolean} [visible=true] - Should the created Bob render or not? + * @param {number} [index] - The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list. + * + * @return {Phaser.GameObjects.Bob} The newly created Bob object. */ - radius: { + create: function (x, y, frame, visible, index) + { + if (visible === undefined) { visible = true; } + if (index === undefined) { index = this.children.length; } - get: function () + if (frame === undefined) { - return this._radius; - }, - - set: function (value) + frame = this.frame; + } + else if (!(frame instanceof Frame)) { - this._radius = value; - this.width = value * 2; - this.height = value * 2; + frame = this.texture.get(frame); } + var bob = new Bob(this, x, y, frame, visible); + + this.children.addAt(bob, index, false); + + this.dirty = true; + + return bob; }, - originX: { + /** + * Creates multiple Bob objects within this Blitter and then passes each of them to the specified callback. + * + * @method Phaser.GameObjects.Blitter#createFromCallback + * @since 3.0.0 + * + * @param {CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. + * @param {number} quantity - The quantity of Bob objects to create. + * @param {(string|number|Phaser.Textures.Frame|string[]|number[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. + * @param {boolean} [visible=true] - Should the created Bob render or not? + * + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. + */ + createFromCallback: function (callback, quantity, frame, visible) + { + var bobs = this.createMultiple(quantity, frame, visible); - get: function () + for (var i = 0; i < bobs.length; i++) { - return 0.5; + var bob = bobs[i]; + + callback.call(this, bob, i); } + return bobs; }, - originY: { + /** + * Creates multiple Bobs in one call. + * + * The amount created is controlled by a combination of the `quantity` argument and the number of frames provided. + * + * If the quantity is set to 10 and you provide 2 frames, then 20 Bobs will be created. 10 with the first + * frame and 10 with the second. + * + * @method Phaser.GameObjects.Blitter#createMultiple + * @since 3.0.0 + * + * @param {number} quantity - The quantity of Bob objects to create. + * @param {(string|number|Phaser.Textures.Frame|string[]|number[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. + * @param {boolean} [visible=true] - Should the created Bob render or not? + * + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. + */ + createMultiple: function (quantity, frame, visible) + { + if (frame === undefined) { frame = this.frame.name; } + if (visible === undefined) { visible = true; } - get: function () + if (!Array.isArray(frame)) { - return 0.5; + frame = [ frame ]; } + var bobs = []; + var _this = this; + + frame.forEach(function (singleFrame) + { + for (var i = 0; i < quantity; i++) + { + bobs.push(_this.create(0, 0, singleFrame, visible)); + } + }); + + return bobs; }, - displayOriginX: { + /** + * Checks if the given child can render or not, by checking its `visible` and `alpha` values. + * + * @method Phaser.GameObjects.Blitter#childCanRender + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Bob} child - The Bob to check for rendering. + * + * @return {boolean} Returns `true` if the given child can render, otherwise `false`. + */ + childCanRender: function (child) + { + return (child.visible && child.alpha > 0); + }, - get: function () + /** + * Returns an array of Bobs to be rendered. + * If the Blitter is dirty then a new list is generated and stored in `renderList`. + * + * @method Phaser.GameObjects.Blitter#getRenderList + * @since 3.0.0 + * + * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that will be rendered this frame. + */ + getRenderList: function () + { + if (this.dirty) { - return this._radius; + this.renderList = this.children.list.filter(this.childCanRender, this); + this.dirty = false; } + return this.renderList; }, - displayOriginY: { + /** + * Removes all Bobs from the children List and clears the dirty flag. + * + * @method Phaser.GameObjects.Blitter#clear + * @since 3.0.0 + */ + clear: function () + { + this.children.removeAll(); + this.dirty = true; + }, - get: function () - { - return this._radius; - } + /** + * Internal destroy handler, called as part of the destroy process. + * + * @method Phaser.GameObjects.Blitter#preDestroy + * @protected + * @since 3.9.0 + */ + preDestroy: function () + { + this.children.destroy(); + this.renderList = []; } }); -module.exports = PointLight; +module.exports = Blitter; /***/ }), -/* 151 */ -/***/ (function(module, exports) { + +/***/ 33177: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Checks for intersection between a circle and a rectangle. + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @function Phaser.Geom.Intersects.CircleToRectangle + * @method Phaser.GameObjects.Blitter#renderCanvas * @since 3.0.0 + * @private * - * @param {Phaser.Geom.Circle} circle - The circle to be checked. - * @param {Phaser.Geom.Rectangle} rect - The rectangle to be checked. - * - * @return {boolean} `true` if the two objects intersect, otherwise `false`. + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Blitter} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var CircleToRectangle = function (circle, rect) +var BlitterCanvasRenderer = function (renderer, src, camera, parentMatrix) { - var halfWidth = rect.width / 2; - var halfHeight = rect.height / 2; + var list = src.getRenderList(); - var cx = Math.abs(circle.x - rect.x - halfWidth); - var cy = Math.abs(circle.y - rect.y - halfHeight); - var xDist = halfWidth + circle.radius; - var yDist = halfHeight + circle.radius; + if (list.length === 0) + { + return; + } - if (cx > xDist || cy > yDist) + var ctx = renderer.currentContext; + + var alpha = camera.alpha * src.alpha; + + if (alpha === 0) { - return false; + // Nothing to see, so abort early + return; } - else if (cx <= halfWidth || cy <= halfHeight) + + camera.addToRenderList(src); + + // Blend Mode + Scale Mode + ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; + + ctx.imageSmoothingEnabled = !src.frame.source.scaleMode; + + var cameraScrollX = src.x - camera.scrollX * src.scrollFactorX; + var cameraScrollY = src.y - camera.scrollY * src.scrollFactorY; + + ctx.save(); + + if (parentMatrix) { - return true; + parentMatrix.copyToContext(ctx); } - else + + var roundPixels = camera.roundPixels; + + // Render bobs + for (var i = 0; i < list.length; i++) { - var xCornerDist = cx - halfWidth; - var yCornerDist = cy - halfHeight; - var xCornerDistSq = xCornerDist * xCornerDist; - var yCornerDistSq = yCornerDist * yCornerDist; - var maxCornerDistSq = circle.radius * circle.radius; + var bob = list[i]; + var flip = (bob.flipX || bob.flipY); + var frame = bob.frame; + var cd = frame.canvasData; + var dx = frame.x; + var dy = frame.y; + var fx = 1; + var fy = 1; - return (xCornerDistSq + yCornerDistSq <= maxCornerDistSq); + var bobAlpha = bob.alpha * alpha; + + if (bobAlpha === 0) + { + continue; + } + + ctx.globalAlpha = bobAlpha; + + if (!flip) + { + if (roundPixels) + { + dx = Math.round(dx); + dy = Math.round(dy); + } + + if (cd.width > 0 && cd.height > 0) + { + ctx.drawImage( + frame.source.image, + cd.x, + cd.y, + cd.width, + cd.height, + dx + bob.x + cameraScrollX, + dy + bob.y + cameraScrollY, + cd.width, + cd.height + ); + } + } + else + { + if (bob.flipX) + { + fx = -1; + dx -= cd.width; + } + + if (bob.flipY) + { + fy = -1; + dy -= cd.height; + } + + if (cd.width > 0 && cd.height > 0) + { + ctx.save(); + ctx.translate(bob.x + cameraScrollX, bob.y + cameraScrollY); + ctx.scale(fx, fy); + ctx.drawImage(frame.source.image, cd.x, cd.y, cd.width, cd.height, dx, dy, cd.width, cd.height); + ctx.restore(); + } + } } + + ctx.restore(); }; -module.exports = CircleToRectangle; +module.exports = BlitterCanvasRenderer; /***/ }), -/* 152 */ -/***/ (function(module, exports) { + +/***/ 68452: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Blitter = __webpack_require__(52816); +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); + /** - * Checks if two Rectangles intersect. + * Creates a new Blitter Game Object and returns it. * - * A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. - * As such, the two Rectangles are considered "solid". - * A Rectangle with no width or no height will never intersect another Rectangle. + * Note: This method will only be available if the Blitter Game Object has been built into Phaser. * - * @function Phaser.Geom.Intersects.RectangleToRectangle + * @method Phaser.GameObjects.GameObjectCreator#blitter * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check for intersection. - * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check for intersection. + * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * - * @return {boolean} `true` if the two Rectangles intersect, otherwise `false`. + * @return {Phaser.GameObjects.Blitter} The Game Object that was created. */ -var RectangleToRectangle = function (rectA, rectB) +GameObjectCreator.register('blitter', function (config, addToScene) { - if (rectA.width <= 0 || rectA.height <= 0 || rectB.width <= 0 || rectB.height <= 0) - { - return false; - } + if (config === undefined) { config = {}; } - return !(rectA.right < rectB.x || rectA.bottom < rectB.y || rectA.x > rectB.right || rectA.y > rectB.bottom); -}; + var key = GetAdvancedValue(config, 'key', null); + var frame = GetAdvancedValue(config, 'frame', null); -module.exports = RectangleToRectangle; + var blitter = new Blitter(this.scene, 0, 0, key, frame); + if (addToScene !== undefined) + { + config.add = addToScene; + } -/***/ }), -/* 153 */ -/***/ (function(module, exports, __webpack_require__) { + BuildGameObject(this.scene, blitter, config); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return blitter; +}); -var GetValue = __webpack_require__(6); +// When registering a factory function 'this' refers to the GameObjectCreator context. -// Contains the plugins that Phaser uses globally and locally. -// These are the source objects, not instantiated. -var inputPlugins = {}; -/** - * @namespace Phaser.Input.InputPluginCache - */ +/***/ }), -var InputPluginCache = {}; +/***/ 38906: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** - * Static method called directly by the Core internal Plugins. - * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) - * Plugin is the object to instantiate to create the plugin - * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input) - * - * @function Phaser.Input.InputPluginCache.register - * @static - * @since 3.10.0 - * - * @param {string} key - A reference used to get this plugin from the plugin cache. - * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. - * @param {string} mapping - If this plugin is to be injected into the Input Plugin, this is the property key used. - * @param {string} settingsKey - The key in the Scene Settings to check to see if this plugin should install or not. - * @param {string} configKey - The key in the Game Config to check to see if this plugin should install or not. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -InputPluginCache.register = function (key, plugin, mapping, settingsKey, configKey) -{ - inputPlugins[key] = { plugin: plugin, mapping: mapping, settingsKey: settingsKey, configKey: configKey }; -}; -/** - * Returns the input plugin object from the cache based on the given key. - * - * @function Phaser.Input.InputPluginCache.getPlugin - * @static - * @since 3.10.0 - * - * @param {string} key - The key of the input plugin to get. - * - * @return {Phaser.Types.Input.InputPluginContainer} The input plugin object. - */ -InputPluginCache.getPlugin = function (key) -{ - return inputPlugins[key]; -}; +var Blitter = __webpack_require__(52816); +var GameObjectFactory = __webpack_require__(61286); /** - * Installs all of the registered Input Plugins into the given target. + * Creates a new Blitter Game Object and adds it to the Scene. * - * @function Phaser.Input.InputPluginCache.install - * @static - * @since 3.10.0 + * Note: This method will only be available if the Blitter Game Object has been built into Phaser. * - * @param {Phaser.Input.InputPlugin} target - The target InputPlugin to install the plugins into. - */ -InputPluginCache.install = function (target) -{ - var sys = target.scene.sys; - var settings = sys.settings.input; - var config = sys.game.config; - - for (var key in inputPlugins) - { - var source = inputPlugins[key].plugin; - var mapping = inputPlugins[key].mapping; - var settingsKey = inputPlugins[key].settingsKey; - var configKey = inputPlugins[key].configKey; - - if (GetValue(settings, settingsKey, config[configKey])) - { - target[mapping] = new source(target); - } - } -}; - -/** - * Removes an input plugin based on the given key. + * @method Phaser.GameObjects.GameObjectFactory#blitter + * @since 3.0.0 * - * @function Phaser.Input.InputPluginCache.remove - * @static - * @since 3.10.0 + * @param {number} x - The x position of the Game Object. + * @param {number} y - The y position of the Game Object. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - The default Frame children of the Blitter will use. * - * @param {string} key - The key of the input plugin to remove. + * @return {Phaser.GameObjects.Blitter} The Game Object that was created. */ -InputPluginCache.remove = function (key) +GameObjectFactory.register('blitter', function (x, y, texture, frame) { - if (inputPlugins.hasOwnProperty(key)) - { - delete inputPlugins[key]; - } -}; + return this.displayList.add(new Blitter(this.scene, x, y, texture, frame)); +}); -module.exports = InputPluginCache; +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns /***/ }), -/* 154 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 92246: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @namespace Phaser.Input.Keyboard.Events - */ +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(89165); +} + +if (true) +{ + renderCanvas = __webpack_require__(33177); +} module.exports = { - ANY_KEY_DOWN: __webpack_require__(1323), - ANY_KEY_UP: __webpack_require__(1324), - COMBO_MATCH: __webpack_require__(1325), - DOWN: __webpack_require__(1326), - KEY_DOWN: __webpack_require__(1327), - KEY_UP: __webpack_require__(1328), - UP: __webpack_require__(1329) + renderWebGL: renderWebGL, + renderCanvas: renderCanvas }; /***/ }), -/* 155 */ -/***/ (function(module, exports) { + +/***/ 89165: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var TransformMatrix = __webpack_require__(69360); +var Utils = __webpack_require__(75512); + +var tempMatrix = new TransformMatrix(); + /** - * Given a File and a baseURL value this returns the URL the File will use to download from. + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @function Phaser.Loader.GetURL + * @method Phaser.GameObjects.Blitter#renderWebGL * @since 3.0.0 + * @private * - * @param {Phaser.Loader.File} file - The File object. - * @param {string} baseURL - A default base URL. - * - * @return {string} The URL the File will use. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Blitter} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var GetURL = function (file, baseURL) +var BlitterWebGLRenderer = function (renderer, src, camera, parentMatrix) { - if (!file.url) - { - return false; - } + var list = src.getRenderList(); + var alpha = camera.alpha * src.alpha; - if (file.url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/)) + if (list.length === 0 || alpha === 0) { - return file.url; + // Nothing to see, so abort early + return; } - else + + camera.addToRenderList(src); + + var pipeline = renderer.pipelines.set(this.pipeline, src); + + var cameraScrollX = camera.scrollX * src.scrollFactorX; + var cameraScrollY = camera.scrollY * src.scrollFactorY; + + var calcMatrix = tempMatrix.copyFrom(camera.matrix); + + if (parentMatrix) { - return baseURL + file.url; - } -}; + calcMatrix.multiplyWithOffset(parentMatrix, -cameraScrollX, -cameraScrollY); -module.exports = GetURL; + cameraScrollX = 0; + cameraScrollY = 0; + } + var blitterX = src.x - cameraScrollX; + var blitterY = src.y - cameraScrollY; + var prevTextureSourceIndex = -1; + var tintEffect = false; + var roundPixels = camera.roundPixels; -/***/ }), -/* 156 */ -/***/ (function(module, exports) { + renderer.pipelines.preBatch(src); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (var i = 0; i < list.length; i++) + { + var bob = list[i]; + var frame = bob.frame; + var bobAlpha = bob.alpha * alpha; -/** - * Creates an XHRSettings Object with default values. - * - * @function Phaser.Loader.XHRSettings - * @since 3.0.0 - * - * @param {XMLHttpRequestResponseType} [responseType=''] - The responseType, such as 'text'. - * @param {boolean} [async=true] - Should the XHR request use async or not? - * @param {string} [user=''] - Optional username for the XHR request. - * @param {string} [password=''] - Optional password for the XHR request. - * @param {number} [timeout=0] - Optional XHR timeout value. - * @param {boolean} [withCredentials=false] - Optional XHR withCredentials value. - * - * @return {Phaser.Types.Loader.XHRSettingsObject} The XHRSettings object as used by the Loader. - */ -var XHRSettings = function (responseType, async, user, password, timeout, withCredentials) -{ - if (responseType === undefined) { responseType = ''; } - if (async === undefined) { async = true; } - if (user === undefined) { user = ''; } - if (password === undefined) { password = ''; } - if (timeout === undefined) { timeout = 0; } - if (withCredentials === undefined) { withCredentials = false; } + if (bobAlpha === 0) + { + continue; + } - // Before sending a request, set the xhr.responseType to "text", - // "arraybuffer", "blob", or "document", depending on your data needs. - // Note, setting xhr.responseType = '' (or omitting) will default the response to "text". + var width = frame.width; + var height = frame.height; - return { + var x = blitterX + bob.x + frame.x; + var y = blitterY + bob.y + frame.y; - // Ignored by the Loader, only used by File. - responseType: responseType, + if (bob.flipX) + { + width *= -1; + x += frame.width; + } - async: async, + if (bob.flipY) + { + height *= -1; + y += frame.height; + } - // credentials - user: user, - password: password, + var quad = calcMatrix.setQuad(x, y, x + width, y + height, roundPixels); - // timeout in ms (0 = no timeout) - timeout: timeout, + var tint = Utils.getTintAppendFloatAlpha(bob.tint, bobAlpha); - // setRequestHeader - headers: undefined, - header: undefined, - headerValue: undefined, - requestedWith: false, + // Bind texture only if the Texture Source is different from before + if (frame.sourceIndex !== prevTextureSourceIndex) + { + var textureUnit = pipeline.setGameObject(src, frame); - // overrideMimeType - overrideMimeType: undefined, + prevTextureSourceIndex = frame.sourceIndex; + } - // withCredentials - withCredentials: withCredentials + if (pipeline.batchQuad(src, quad[0], quad[1], quad[2], quad[3], quad[4], quad[5], quad[6], quad[7], frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, frame.glTexture, textureUnit)) + { + prevTextureSourceIndex = -1; + } + } - }; + renderer.pipelines.postBatch(src); }; -module.exports = XHRSettings; +module.exports = BlitterWebGLRenderer; /***/ }), -/* 157 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 41664: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Components = __webpack_require__(243); -var Sprite = __webpack_require__(73); +var Class = __webpack_require__(56694); +var Frame = __webpack_require__(82047); /** * @classdesc - * An Arcade Physics Sprite is a Sprite with an Arcade Physics body and related components. - * The body can be dynamic or static. + * A Bob Game Object. * - * The main difference between an Arcade Sprite and an Arcade Image is that you cannot animate an Arcade Image. - * If you do not require animation then you can safely use Arcade Images instead of Arcade Sprites. + * A Bob belongs to a Blitter Game Object. The Blitter is responsible for managing and rendering this object. * - * @class Sprite - * @extends Phaser.GameObjects.Sprite - * @memberof Phaser.Physics.Arcade + * A Bob has a position, alpha value and a frame from a texture that it uses to render with. You can also toggle + * the flipped and visible state of the Bob. The Frame the Bob uses to render can be changed dynamically, but it + * must be a Frame within the Texture used by the parent Blitter. + * + * Bob positions are relative to the Blitter parent. So if you move the Blitter parent, all Bob children will + * have their positions impacted by this change as well. + * + * You can manipulate Bob objects directly from your game code, but the creation and destruction of them should be + * handled via the Blitter parent. + * + * @class Bob + * @memberof Phaser.GameObjects * @constructor * @since 3.0.0 * - * @extends Phaser.Physics.Arcade.Components.Acceleration - * @extends Phaser.Physics.Arcade.Components.Angular - * @extends Phaser.Physics.Arcade.Components.Bounce - * @extends Phaser.Physics.Arcade.Components.Debug - * @extends Phaser.Physics.Arcade.Components.Drag - * @extends Phaser.Physics.Arcade.Components.Enable - * @extends Phaser.Physics.Arcade.Components.Friction - * @extends Phaser.Physics.Arcade.Components.Gravity - * @extends Phaser.Physics.Arcade.Components.Immovable - * @extends Phaser.Physics.Arcade.Components.Mass - * @extends Phaser.Physics.Arcade.Components.Pushable - * @extends Phaser.Physics.Arcade.Components.Size - * @extends Phaser.Physics.Arcade.Components.Velocity - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {Phaser.GameObjects.Blitter} blitter - The parent Blitter object is responsible for updating this Bob. + * @param {number} x - The horizontal position of this Game Object in the world, relative to the parent Blitter position. + * @param {number} y - The vertical position of this Game Object in the world, relative to the parent Blitter position. + * @param {(string|number)} frame - The Frame this Bob will render with, as defined in the Texture the parent Blitter is using. + * @param {boolean} visible - Should the Bob render visible or not to start with? */ -var ArcadeSprite = new Class({ - - Extends: Sprite, - - Mixins: [ - Components.Acceleration, - Components.Angular, - Components.Bounce, - Components.Debug, - Components.Drag, - Components.Enable, - Components.Friction, - Components.Gravity, - Components.Immovable, - Components.Mass, - Components.Pushable, - Components.Size, - Components.Velocity - ], +var Bob = new Class({ initialize: - function ArcadeSprite (scene, x, y, texture, frame) + function Bob (blitter, x, y, frame, visible) { - Sprite.call(this, scene, x, y, texture, frame); + /** + * The Blitter object that this Bob belongs to. + * + * @name Phaser.GameObjects.Bob#parent + * @type {Phaser.GameObjects.Blitter} + * @since 3.0.0 + */ + this.parent = blitter; /** - * This Game Object's Physics Body. + * The x position of this Bob, relative to the x position of the Blitter. * - * @name Phaser.Physics.Arcade.Sprite#body - * @type {?(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} - * @default null + * @name Phaser.GameObjects.Bob#x + * @type {number} * @since 3.0.0 */ - this.body = null; - } + this.x = x; -}); + /** + * The y position of this Bob, relative to the y position of the Blitter. + * + * @name Phaser.GameObjects.Bob#y + * @type {number} + * @since 3.0.0 + */ + this.y = y; -module.exports = ArcadeSprite; + /** + * The frame that the Bob uses to render with. + * To change the frame use the `Bob.setFrame` method. + * + * @name Phaser.GameObjects.Bob#frame + * @type {Phaser.Textures.Frame} + * @protected + * @since 3.0.0 + */ + this.frame = frame; + + /** + * A blank object which can be used to store data related to this Bob in. + * + * @name Phaser.GameObjects.Bob#data + * @type {object} + * @default {} + * @since 3.0.0 + */ + this.data = {}; + /** + * The tint value of this Bob. + * + * @name Phaser.GameObjects.Bob#tint + * @type {number} + * @default 0xffffff + * @since 3.20.0 + */ + this.tint = 0xffffff; -/***/ }), -/* 158 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The visible state of this Bob. + * + * @name Phaser.GameObjects.Bob#_visible + * @type {boolean} + * @private + * @since 3.0.0 + */ + this._visible = visible; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The alpha value of this Bob. + * + * @name Phaser.GameObjects.Bob#_alpha + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + this._alpha = 1; -var IsInLayerBounds = __webpack_require__(119); + /** + * The horizontally flipped state of the Bob. + * A Bob that is flipped horizontally will render inversed on the horizontal axis. + * Flipping always takes place from the middle of the texture. + * + * @name Phaser.GameObjects.Bob#flipX + * @type {boolean} + * @since 3.0.0 + */ + this.flipX = false; -/** - * Gets a tile at the given tile coordinates from the given layer. - * - * @function Phaser.Tilemaps.Components.GetTileAt - * @since 3.0.0 - * - * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). - * @param {boolean} nonNull - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. - */ -var GetTileAt = function (tileX, tileY, nonNull, layer) -{ - if (nonNull === undefined) { nonNull = false; } + /** + * The vertically flipped state of the Bob. + * A Bob that is flipped vertically will render inversed on the vertical axis (i.e. upside down) + * Flipping always takes place from the middle of the texture. + * + * @name Phaser.GameObjects.Bob#flipY + * @type {boolean} + * @since 3.0.0 + */ + this.flipY = false; - if (IsInLayerBounds(tileX, tileY, layer)) - { - var tile = layer.data[tileY][tileX] || null; + /** + * Private read-only property used to allow Bobs to have physics bodies. + * + * @name Phaser.GameObjects.Bob#hasTransformComponent + * @type {boolean} + * @private + * @readonly + * @since 3.60.0 + */ + this.hasTransformComponent = true; + }, - if (!tile) + /** + * Changes the Texture Frame being used by this Bob. + * The frame must be part of the Texture the parent Blitter is using. + * If no value is given it will use the default frame of the Blitter parent. + * + * @method Phaser.GameObjects.Bob#setFrame + * @since 3.0.0 + * + * @param {(string|number|Phaser.Textures.Frame)} [frame] - The frame to be used during rendering. + * + * @return {this} This Bob Game Object. + */ + setFrame: function (frame) + { + if (frame === undefined) { - return null; + this.frame = this.parent.frame; } - else if (tile.index === -1) + else if (frame instanceof Frame && frame.texture === this.parent.texture) { - return nonNull ? tile : null; + this.frame = frame; } else { - return tile; + this.frame = this.parent.texture.get(frame); } - } - else - { - return null; - } -}; -module.exports = GetTileAt; + return this; + }, + + /** + * Resets the horizontal and vertical flipped state of this Bob back to their default un-flipped state. + * + * @method Phaser.GameObjects.Bob#resetFlip + * @since 3.0.0 + * + * @return {this} This Bob Game Object. + */ + resetFlip: function () + { + this.flipX = false; + this.flipY = false; + return this; + }, -/***/ }), -/* 159 */ -/***/ (function(module, exports) { + /** + * Resets this Bob. + * + * Changes the position to the values given, and optionally changes the frame. + * + * Also resets the flipX and flipY values, sets alpha back to 1 and visible to true. + * + * @method Phaser.GameObjects.Bob#reset + * @since 3.0.0 + * + * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. + * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. + * @param {(string|number|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. + * + * @return {this} This Bob Game Object. + */ + reset: function (x, y, frame) + { + this.x = x; + this.y = y; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.flipX = false; + this.flipY = false; -/** - * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. - * - * @function Phaser.Tilemaps.Components.RunCull - * @since 3.50.0 - * - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {object} bounds - An object containing the `left`, `right`, `top` and `bottom` bounds. - * @param {number} renderOrder - The rendering order constant. - * @param {array} outputArray - The array to store the Tile objects within. - * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. - */ -var RunCull = function (layer, bounds, renderOrder, outputArray) -{ - var mapData = layer.data; - var mapWidth = layer.width; - var mapHeight = layer.height; + this._alpha = 1; + this._visible = true; - var tilemapLayer = layer.tilemapLayer; + this.parent.dirty = true; - var drawLeft = Math.max(0, bounds.left); - var drawRight = Math.min(mapWidth, bounds.right); - var drawTop = Math.max(0, bounds.top); - var drawBottom = Math.min(mapHeight, bounds.bottom); + if (frame) + { + this.setFrame(frame); + } - var x; - var y; - var tile; + return this; + }, - if (renderOrder === 0) + /** + * Changes the position of this Bob to the values given. + * + * @method Phaser.GameObjects.Bob#setPosition + * @since 3.20.0 + * + * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. + * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. + * + * @return {this} This Bob Game Object. + */ + setPosition: function (x, y) { - // right-down + this.x = x; + this.y = y; - for (y = drawTop; y < drawBottom; y++) - { - for (x = drawLeft; mapData[y] && x < drawRight; x++) - { - tile = mapData[y][x]; + return this; + }, - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } + /** + * Sets the horizontal flipped state of this Bob. + * + * @method Phaser.GameObjects.Bob#setFlipX + * @since 3.0.0 + * + * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. + * + * @return {this} This Bob Game Object. + */ + setFlipX: function (value) + { + this.flipX = value; - outputArray.push(tile); - } - } - } - else if (renderOrder === 1) + return this; + }, + + /** + * Sets the vertical flipped state of this Bob. + * + * @method Phaser.GameObjects.Bob#setFlipY + * @since 3.0.0 + * + * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. + * + * @return {this} This Bob Game Object. + */ + setFlipY: function (value) { - // left-down + this.flipY = value; - for (y = drawTop; y < drawBottom; y++) - { - for (x = drawRight; mapData[y] && x >= drawLeft; x--) - { - tile = mapData[y][x]; + return this; + }, - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } + /** + * Sets the horizontal and vertical flipped state of this Bob. + * + * @method Phaser.GameObjects.Bob#setFlip + * @since 3.0.0 + * + * @param {boolean} x - The horizontal flipped state. `false` for no flip, or `true` to be flipped. + * @param {boolean} y - The horizontal flipped state. `false` for no flip, or `true` to be flipped. + * + * @return {this} This Bob Game Object. + */ + setFlip: function (x, y) + { + this.flipX = x; + this.flipY = y; - outputArray.push(tile); - } - } - } - else if (renderOrder === 2) + return this; + }, + + /** + * Sets the visibility of this Bob. + * + * An invisible Bob will skip rendering. + * + * @method Phaser.GameObjects.Bob#setVisible + * @since 3.0.0 + * + * @param {boolean} value - The visible state of the Game Object. + * + * @return {this} This Bob Game Object. + */ + setVisible: function (value) { - // right-up + this.visible = value; - for (y = drawBottom; y >= drawTop; y--) - { - for (x = drawLeft; mapData[y] && x < drawRight; x++) - { - tile = mapData[y][x]; + return this; + }, - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } + /** + * Set the Alpha level of this Bob. The alpha controls the opacity of the Game Object as it renders. + * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. + * + * A Bob with alpha 0 will skip rendering. + * + * @method Phaser.GameObjects.Bob#setAlpha + * @since 3.0.0 + * + * @param {number} value - The alpha value used for this Bob. Between 0 and 1. + * + * @return {this} This Bob Game Object. + */ + setAlpha: function (value) + { + this.alpha = value; - outputArray.push(tile); - } - } - } - else if (renderOrder === 3) + return this; + }, + + /** + * Sets the tint of this Bob. + * + * @method Phaser.GameObjects.Bob#setTint + * @since 3.20.0 + * + * @param {number} value - The tint value used for this Bob. Between 0 and 0xffffff. + * + * @return {this} This Bob Game Object. + */ + setTint: function (value) { - // left-up + this.tint = value; - for (y = drawBottom; y >= drawTop; y--) - { - for (x = drawRight; mapData[y] && x >= drawLeft; x--) - { - tile = mapData[y][x]; + return this; + }, - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } + /** + * Destroys this Bob instance. + * Removes itself from the Blitter and clears the parent, frame and data properties. + * + * @method Phaser.GameObjects.Bob#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.parent.dirty = true; - outputArray.push(tile); - } - } - } + this.parent.children.remove(this); - tilemapLayer.tilesDrawn = outputArray.length; - tilemapLayer.tilesTotal = mapWidth * mapHeight; + this.parent = undefined; + this.frame = undefined; + this.data = undefined; + }, - return outputArray; -}; + /** + * The visible state of the Bob. + * + * An invisible Bob will skip rendering. + * + * @name Phaser.GameObjects.Bob#visible + * @type {boolean} + * @since 3.0.0 + */ + visible: { -module.exports = RunCull; + get: function () + { + return this._visible; + }, + set: function (value) + { + this.parent.dirty |= (this._visible !== value); + this._visible = value; + } -/***/ }), -/* 160 */ -/***/ (function(module, exports) { + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The alpha value of the Bob, between 0 and 1. + * + * A Bob with alpha 0 will skip rendering. + * + * @name Phaser.GameObjects.Bob#alpha + * @type {number} + * @since 3.0.0 + */ + alpha: { -/** - * Internally used method to keep track of the tile indexes that collide within a layer. This - * updates LayerData.collideIndexes to either contain or not contain the given `tileIndex`. - * - * @function Phaser.Tilemaps.Components.SetLayerCollisionIndex - * @since 3.0.0 - * - * @param {number} tileIndex - The tile index to set the collision boolean for. - * @param {boolean} collides - Should the tile index collide or not? - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var SetLayerCollisionIndex = function (tileIndex, collides, layer) -{ - var loc = layer.collideIndexes.indexOf(tileIndex); + get: function () + { + return this._alpha; + }, + + set: function (value) + { + this.parent.dirty |= ((this._alpha > 0) !== (value > 0)); + this._alpha = value; + } - if (collides && loc === -1) - { - layer.collideIndexes.push(tileIndex); - } - else if (!collides && loc !== -1) - { - layer.collideIndexes.splice(loc, 1); } -}; -module.exports = SetLayerCollisionIndex; +}); + +module.exports = Bob; /***/ }), -/* 161 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 97123: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @author Seth Berrier - * @copyright 2020 Photon Storm Ltd. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetFastValue = __webpack_require__(2); +var Clamp = __webpack_require__(82897); + +// bitmask flag for GameObject.renderMask +var _FLAG = 2; // 0010 /** - * Parse a Tiled group layer and create a state object for inheriting. - * - * @function Phaser.Tilemaps.Parsers.Tiled.CreateGroupLayer - * @since 3.21.0 - * - * @param {object} json - The Tiled JSON object. - * @param {object} [currentl] - The current group layer from the Tiled JSON file. - * @param {object} [parentstate] - The state of the parent group (if any). + * Provides methods used for setting the alpha properties of a Game Object. + * Should be applied as a mixin and not used directly. * - * @return {object} A group state object with proper values for updating children layers. + * @namespace Phaser.GameObjects.Components.Alpha + * @since 3.0.0 */ -var CreateGroupLayer = function (json, groupl, parentstate) -{ - if (!groupl) - { - // Return a default group state object - return { - i: 0, // Current layer array iterator - layers: json.layers, // Current array of layers - - // Values inherited from parent group - name: '', - opacity: 1, - visible: true, - x: 0, - y: 0 - }; - } - // Compute group layer x, y - var layerX = groupl.x + GetFastValue(groupl, 'startx', 0) * json.tilewidth + GetFastValue(groupl, 'offsetx', 0); - var layerY = groupl.y + GetFastValue(groupl, 'starty', 0) * json.tileheight + GetFastValue(groupl, 'offsety', 0); +var Alpha = { - // Compute next state inherited from group - return { - i: 0, - layers: groupl.layers, - name: parentstate.name + groupl.name + '/', - opacity: parentstate.opacity * groupl.opacity, - visible: parentstate.visible && groupl.visible, - x: parentstate.x + layerX, - y: parentstate.y + layerY - }; -}; + /** + * Private internal value. Holds the global alpha value. + * + * @name Phaser.GameObjects.Components.Alpha#_alpha + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + _alpha: 1, -module.exports = CreateGroupLayer; + /** + * Private internal value. Holds the top-left alpha value. + * + * @name Phaser.GameObjects.Components.Alpha#_alphaTL + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + _alphaTL: 1, + /** + * Private internal value. Holds the top-right alpha value. + * + * @name Phaser.GameObjects.Components.Alpha#_alphaTR + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + _alphaTR: 1, -/***/ }), -/* 162 */ -/***/ (function(module, exports) { + /** + * Private internal value. Holds the bottom-left alpha value. + * + * @name Phaser.GameObjects.Components.Alpha#_alphaBL + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + _alphaBL: 1, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Private internal value. Holds the bottom-right alpha value. + * + * @name Phaser.GameObjects.Components.Alpha#_alphaBR + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + _alphaBR: 1, -/** - * Internal function used by the Tween Builder to create a function that will return - * the given value from the source. - * - * @function Phaser.Tweens.Builders.GetNewValue - * @since 3.0.0 - * - * @param {any} source - The source object to get the value from. - * @param {string} key - The property to get from the source. - * @param {any} defaultValue - A default value to return should the source not have the property set. - * - * @return {function} A function which when called will return the property value from the source. - */ -var GetNewValue = function (source, key, defaultValue) -{ - var valueCallback; + /** + * Clears all alpha values associated with this Game Object. + * + * Immediately sets the alpha levels back to 1 (fully opaque). + * + * @method Phaser.GameObjects.Components.Alpha#clearAlpha + * @since 3.0.0 + * + * @return {this} This Game Object instance. + */ + clearAlpha: function () + { + return this.setAlpha(1); + }, - if (source.hasOwnProperty(key)) + /** + * Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders. + * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. + * + * If your game is running under WebGL you can optionally specify four different alpha values, each of which + * correspond to the four corners of the Game Object. Under Canvas only the `topLeft` value given is used. + * + * @method Phaser.GameObjects.Components.Alpha#setAlpha + * @since 3.0.0 + * + * @param {number} [topLeft=1] - The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object. + * @param {number} [topRight] - The alpha value used for the top-right of the Game Object. WebGL only. + * @param {number} [bottomLeft] - The alpha value used for the bottom-left of the Game Object. WebGL only. + * @param {number} [bottomRight] - The alpha value used for the bottom-right of the Game Object. WebGL only. + * + * @return {this} This Game Object instance. + */ + setAlpha: function (topLeft, topRight, bottomLeft, bottomRight) { - var t = typeof(source[key]); + if (topLeft === undefined) { topLeft = 1; } - if (t === 'function') + // Treat as if there is only one alpha value for the whole Game Object + if (topRight === undefined) { - valueCallback = function (target, targetKey, value, targetIndex, totalTargets, tween) - { - return source[key](target, targetKey, value, targetIndex, totalTargets, tween); - }; + this.alpha = topLeft; } else { - valueCallback = function () - { - return source[key]; - }; + this._alphaTL = Clamp(topLeft, 0, 1); + this._alphaTR = Clamp(topRight, 0, 1); + this._alphaBL = Clamp(bottomLeft, 0, 1); + this._alphaBR = Clamp(bottomRight, 0, 1); } - } - else if (typeof defaultValue === 'function') - { - valueCallback = defaultValue; - } - else - { - valueCallback = function () - { - return defaultValue; - }; - } - - return valueCallback; -}; - -module.exports = GetNewValue; + return this; + }, -/***/ }), -/* 163 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The alpha value of the Game Object. + * + * This is a global value, impacting the entire Game Object, not just a region of it. + * + * @name Phaser.GameObjects.Components.Alpha#alpha + * @type {number} + * @since 3.0.0 + */ + alpha: { -var Defaults = __webpack_require__(265); -var GetAdvancedValue = __webpack_require__(13); -var GetBoolean = __webpack_require__(99); -var GetEaseFunction = __webpack_require__(80); -var GetNewValue = __webpack_require__(162); -var GetProps = __webpack_require__(583); -var GetTargets = __webpack_require__(263); -var GetValue = __webpack_require__(6); -var GetValueOp = __webpack_require__(264); -var Tween = __webpack_require__(266); -var TweenData = __webpack_require__(268); + get: function () + { + return this._alpha; + }, -/** - * Creates a new Tween. - * - * @function Phaser.Tweens.Builders.TweenBuilder - * @since 3.0.0 - * - * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - The owner of the new Tween. - * @param {Phaser.Types.Tweens.TweenBuilderConfig|object} config - Configuration for the new Tween. - * @param {Phaser.Types.Tweens.TweenConfigDefaults} defaults - Tween configuration defaults. - * - * @return {Phaser.Tweens.Tween} The new tween. - */ -var TweenBuilder = function (parent, config, defaults) -{ - if (defaults === undefined) - { - defaults = Defaults; - } + set: function (value) + { + var v = Clamp(value, 0, 1); - // Create arrays of the Targets and the Properties - var targets = (defaults.targets) ? defaults.targets : GetTargets(config); + this._alpha = v; + this._alphaTL = v; + this._alphaTR = v; + this._alphaBL = v; + this._alphaBR = v; - // var props = (defaults.props) ? defaults.props : GetProps(config); - var props = GetProps(config); + if (v === 0) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } + } - // Default Tween values - var delay = GetNewValue(config, 'delay', defaults.delay); - var duration = GetNewValue(config, 'duration', defaults.duration); - var easeParams = GetValue(config, 'easeParams', defaults.easeParams); - var ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), easeParams); - var hold = GetNewValue(config, 'hold', defaults.hold); - var repeat = GetNewValue(config, 'repeat', defaults.repeat); - var repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay); - var yoyo = GetBoolean(config, 'yoyo', defaults.yoyo); - var flipX = GetBoolean(config, 'flipX', defaults.flipX); - var flipY = GetBoolean(config, 'flipY', defaults.flipY); + }, - var data = []; + /** + * The alpha value starting from the top-left of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Alpha#alphaTopLeft + * @type {number} + * @webglOnly + * @since 3.0.0 + */ + alphaTopLeft: { - // Loop through every property defined in the Tween, i.e.: props { x, y, alpha } - for (var p = 0; p < props.length; p++) - { - var key = props[p].key; - var value = props[p].value; + get: function () + { + return this._alphaTL; + }, - // Create 1 TweenData per target, per property - for (var t = 0; t < targets.length; t++) + set: function (value) { - var ops = GetValueOp(key, value); + var v = Clamp(value, 0, 1); - var tweenData = TweenData( - targets[t], - t, - key, - ops.getEnd, - ops.getStart, - ops.getActive, - GetEaseFunction(GetValue(value, 'ease', ease), GetValue(value, 'easeParams', easeParams)), - GetNewValue(value, 'delay', delay), - GetNewValue(value, 'duration', duration), - GetBoolean(value, 'yoyo', yoyo), - GetNewValue(value, 'hold', hold), - GetNewValue(value, 'repeat', repeat), - GetNewValue(value, 'repeatDelay', repeatDelay), - GetBoolean(value, 'flipX', flipX), - GetBoolean(value, 'flipY', flipY) - ); + this._alphaTL = v; - data.push(tweenData); + if (v !== 0) + { + this.renderFlags |= _FLAG; + } } - } - - var tween = new Tween(parent, data, targets); - tween.offset = GetAdvancedValue(config, 'offset', null); - tween.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); - tween.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); - tween.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); - tween.paused = GetBoolean(config, 'paused', false); - tween.useFrames = GetBoolean(config, 'useFrames', false); + }, - // Set the Callbacks - var scope = GetValue(config, 'callbackScope', tween); + /** + * The alpha value starting from the top-right of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Alpha#alphaTopRight + * @type {number} + * @webglOnly + * @since 3.0.0 + */ + alphaTopRight: { - // Callback parameters: 0 = a reference to the Tween itself, 1 = the target/s of the Tween, ... your own params - var tweenArray = [ tween, null ]; + get: function () + { + return this._alphaTR; + }, - var callbacks = Tween.TYPES; + set: function (value) + { + var v = Clamp(value, 0, 1); - for (var i = 0; i < callbacks.length; i++) - { - var type = callbacks[i]; + this._alphaTR = v; - var callback = GetValue(config, type, false); + if (v !== 0) + { + this.renderFlags |= _FLAG; + } + } - if (callback) - { - var callbackScope = GetValue(config, type + 'Scope', scope); - var callbackParams = GetValue(config, type + 'Params', []); + }, - // The null is reset to be the Tween target - tween.setCallback(type, callback, tweenArray.concat(callbackParams), callbackScope); - } - } + /** + * The alpha value starting from the bottom-left of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Alpha#alphaBottomLeft + * @type {number} + * @webglOnly + * @since 3.0.0 + */ + alphaBottomLeft: { - return tween; -}; + get: function () + { + return this._alphaBL; + }, -module.exports = TweenBuilder; + set: function (value) + { + var v = Clamp(value, 0, 1); + this._alphaBL = v; -/***/ }), -/* 164 */ -/***/ (function(module, exports, __webpack_require__) { + if (v !== 0) + { + this.renderFlags |= _FLAG; + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + }, -var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(102); -var GetFastValue = __webpack_require__(2); -var Events = __webpack_require__(132); -var Animation = __webpack_require__(185); + /** + * The alpha value starting from the bottom-right of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * + * @name Phaser.GameObjects.Components.Alpha#alphaBottomRight + * @type {number} + * @webglOnly + * @since 3.0.0 + */ + alphaBottomRight: { -/** - * @classdesc - * The Animation State Component. - * - * This component provides features to apply animations to Game Objects. It is responsible for - * loading, queuing animations for later playback, mixing between animations and setting - * the current animation frame to the Game Object that owns this component. - * - * This component lives as an instance within any Game Object that has it defined, such as Sprites. - * - * You can access its properties and methods via the `anims` property, i.e. `Sprite.anims`. - * - * As well as playing animations stored in the global Animation Manager, this component - * can also create animations that are stored locally within it. See the `create` method - * for more details. - * - * Prior to Phaser 3.50 this component was called just `Animation` and lived in the - * `Phaser.GameObjects.Components` namespace. It was renamed to `AnimationState` - * in 3.50 to help better identify its true purpose when browsing the documentation. - * - * @class AnimationState - * @memberof Phaser.Animations - * @constructor - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} parent - The Game Object to which this animation component belongs. - */ -var AnimationState = new Class({ + get: function () + { + return this._alphaBR; + }, - initialize: + set: function (value) + { + var v = Clamp(value, 0, 1); - function AnimationState (parent) - { - /** - * The Game Object to which this animation component belongs. - * - * You can typically access this component from the Game Object - * via the `this.anims` property. - * - * @name Phaser.Animations.AnimationState#parent - * @type {Phaser.GameObjects.GameObject} - * @since 3.0.0 - */ - this.parent = parent; + this._alphaBR = v; - /** - * A reference to the global Animation Manager. - * - * @name Phaser.Animations.AnimationState#animationManager - * @type {Phaser.Animations.AnimationManager} - * @since 3.0.0 - */ - this.animationManager = parent.scene.sys.anims; + if (v !== 0) + { + this.renderFlags |= _FLAG; + } + } - this.animationManager.on(Events.REMOVE_ANIMATION, this.globalRemove, this); + } - /** - * A reference to the Texture Manager. - * - * @name Phaser.Animations.AnimationState#textureManager - * @type {Phaser.Textures.TextureManager} - * @protected - * @since 3.50.0 - */ - this.textureManager = this.animationManager.textureManager; +}; - /** - * The Animations stored locally in this Animation component. - * - * Do not modify the contents of this Map directly, instead use the - * `add`, `create` and `remove` methods of this class instead. - * - * @name Phaser.Animations.AnimationState#anims - * @type {Phaser.Structs.Map.} - * @protected - * @since 3.50.0 - */ - this.anims = null; +module.exports = Alpha; - /** - * Is an animation currently playing or not? - * - * @name Phaser.Animations.AnimationState#isPlaying - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.isPlaying = false; - /** - * Has the current animation started playing, or is it waiting for a delay to expire? - * - * @name Phaser.Animations.AnimationState#hasStarted - * @type {boolean} - * @default false - * @since 3.50.0 - */ - this.hasStarted = false; +/***/ }), - /** - * The current Animation loaded into this Animation component. - * - * Will by `null` if no animation is yet loaded. - * - * @name Phaser.Animations.AnimationState#currentAnim - * @type {?Phaser.Animations.Animation} - * @default null - * @since 3.0.0 - */ - this.currentAnim = null; +/***/ 15720: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The current AnimationFrame being displayed by this Animation component. - * - * Will by `null` if no animation is yet loaded. - * - * @name Phaser.Animations.AnimationState#currentFrame - * @type {?Phaser.Animations.AnimationFrame} - * @default null - * @since 3.0.0 - */ - this.currentFrame = null; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The key, instance, or config of the next Animation to be loaded into this Animation component - * when the current animation completes. - * - * Will by `null` if no animation has been queued. - * - * @name Phaser.Animations.AnimationState#nextAnim - * @type {?(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} - * @default null - * @since 3.16.0 - */ - this.nextAnim = null; +var Clamp = __webpack_require__(82897); - /** - * A queue of Animations to be loaded into this Animation component when the current animation completes. - * - * Populate this queue via the `chain` method. - * - * @name Phaser.Animations.AnimationState#nextAnimsQueue - * @type {array} - * @since 3.24.0 - */ - this.nextAnimsQueue = []; +// bitmask flag for GameObject.renderMask +var _FLAG = 2; // 0010 - /** - * The Time Scale factor. - * - * You can adjust this value to modify the passage of time for the animation that is currently - * playing. For example, setting it to 2 will make the animation play twice as fast. Or setting - * it to 0.5 will slow the animation down. - * - * You can change this value at run-time, or set it via the `PlayAnimationConfig`. - * - * Prior to Phaser 3.50 this property was private and called `_timeScale`. - * - * @name Phaser.Animations.AnimationState#timeScale - * @type {number} - * @default 1 - * @since 3.50.0 - */ - this.timeScale = 1; +/** + * Provides methods used for setting the alpha property of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @namespace Phaser.GameObjects.Components.AlphaSingle + * @since 3.22.0 + */ - /** - * The frame rate of playback, of the current animation, in frames per second. - * - * This value is set when a new animation is loaded into this component and should - * be treated as read-only, as changing it once playback has started will not alter - * the animation. To change the frame rate, provide a new value in the `PlayAnimationConfig` object. - * - * @name Phaser.Animations.AnimationState#frameRate - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.frameRate = 0; +var AlphaSingle = { - /** - * The duration of the current animation, in milliseconds. - * - * This value is set when a new animation is loaded into this component and should - * be treated as read-only, as changing it once playback has started will not alter - * the animation. To change the duration, provide a new value in the `PlayAnimationConfig` object. - * - * @name Phaser.Animations.AnimationState#duration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.duration = 0; + /** + * Private internal value. Holds the global alpha value. + * + * @name Phaser.GameObjects.Components.AlphaSingle#_alpha + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + _alpha: 1, - /** - * The number of milliseconds per frame, not including frame specific modifiers that may be present in the - * Animation data. - * - * This value is calculated when a new animation is loaded into this component and should - * be treated as read-only. Changing it will not alter playback speed. - * - * @name Phaser.Animations.AnimationState#msPerFrame - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.msPerFrame = 0; + /** + * Clears all alpha values associated with this Game Object. + * + * Immediately sets the alpha levels back to 1 (fully opaque). + * + * @method Phaser.GameObjects.Components.AlphaSingle#clearAlpha + * @since 3.0.0 + * + * @return {this} This Game Object instance. + */ + clearAlpha: function () + { + return this.setAlpha(1); + }, - /** - * Skip frames if the time lags, or always advanced anyway? - * - * @name Phaser.Animations.AnimationState#skipMissedFrames - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.skipMissedFrames = true; + /** + * Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders. + * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. + * + * @method Phaser.GameObjects.Components.AlphaSingle#setAlpha + * @since 3.0.0 + * + * @param {number} [value=1] - The alpha value applied across the whole Game Object. + * + * @return {this} This Game Object instance. + */ + setAlpha: function (value) + { + if (value === undefined) { value = 1; } - /** - * The delay before starting playback of the current animation, in milliseconds. - * - * This value is set when a new animation is loaded into this component and should - * be treated as read-only, as changing it once playback has started will not alter - * the animation. To change the delay, provide a new value in the `PlayAnimationConfig` object. - * - * Prior to Phaser 3.50 this property was private and called `_delay`. - * - * @name Phaser.Animations.AnimationState#delay - * @type {number} - * @default 0 - * @since 3.50.0 - */ - this.delay = 0; + this.alpha = value; - /** - * The number of times to repeat playback of the current animation. - * - * If -1, it means the animation will repeat forever. - * - * This value is set when a new animation is loaded into this component and should - * be treated as read-only, as changing it once playback has started will not alter - * the animation. To change the number of repeats, provide a new value in the `PlayAnimationConfig` object. - * - * Prior to Phaser 3.50 this property was private and called `_repeat`. - * - * @name Phaser.Animations.AnimationState#repeat - * @type {number} - * @default 0 - * @since 3.50.0 - */ - this.repeat = 0; + return this; + }, - /** - * The number of milliseconds to wait before starting the repeat playback of the current animation. - * - * This value is set when a new animation is loaded into this component, but can also be modified - * at run-time. - * - * You can change the repeat delay by providing a new value in the `PlayAnimationConfig` object. - * - * Prior to Phaser 3.50 this property was private and called `_repeatDelay`. - * - * @name Phaser.Animations.AnimationState#repeatDelay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.repeatDelay = 0; + /** + * The alpha value of the Game Object. + * + * This is a global value, impacting the entire Game Object, not just a region of it. + * + * @name Phaser.GameObjects.Components.AlphaSingle#alpha + * @type {number} + * @since 3.0.0 + */ + alpha: { - /** - * Should the current animation yoyo? An animation that yoyos will play in reverse, from the end - * to the start, before then repeating or completing. An animation that does not yoyo will just - * play from the start to the end. - * - * This value is set when a new animation is loaded into this component, but can also be modified - * at run-time. - * - * You can change the yoyo by providing a new value in the `PlayAnimationConfig` object. - * - * Prior to Phaser 3.50 this property was private and called `_yoyo`. - * - * @name Phaser.Animations.AnimationState#yoyo - * @type {boolean} - * @default false - * @since 3.50.0 - */ - this.yoyo = false; + get: function () + { + return this._alpha; + }, - /** - * Should the GameObject's `visible` property be set to `true` when the animation starts to play? - * - * This will happen _after_ any delay that may have been set. - * - * This value is set when a new animation is loaded into this component, but can also be modified - * at run-time, assuming the animation is currently delayed. - * - * @name Phaser.Animations.AnimationState#showOnStart - * @type {boolean} - * @since 3.50.0 - */ - this.showOnStart = false; + set: function (value) + { + var v = Clamp(value, 0, 1); - /** - * Should the GameObject's `visible` property be set to `false` when the animation completes? - * - * This value is set when a new animation is loaded into this component, but can also be modified - * at run-time, assuming the animation is still actively playing. - * - * @name Phaser.Animations.AnimationState#hideOnComplete - * @type {boolean} - * @since 3.50.0 - */ - this.hideOnComplete = false; + this._alpha = v; - /** - * Is the playhead moving forwards (`true`) or in reverse (`false`) ? - * - * @name Phaser.Animations.AnimationState#forward - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.forward = true; + if (v === 0) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } + } - /** - * An internal trigger that tells the component if it should plays the animation - * in reverse mode ('true') or not ('false'). This is used because `forward` can - * be changed by the `yoyo` feature. - * - * Prior to Phaser 3.50 this property was private and called `_reverse`. - * - * @name Phaser.Animations.AnimationState#inReverse - * @type {boolean} - * @default false - * @since 3.50.0 - */ - this.inReverse = false; + } - /** - * Internal time overflow accumulator. - * - * This has the `delta` time added to it as part of the `update` step. - * - * @name Phaser.Animations.AnimationState#accumulator - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.accumulator = 0; +}; - /** - * The time point at which the next animation frame will change. - * - * This value is compared against the `accumulator` as part of the `update` step. - * - * @name Phaser.Animations.AnimationState#nextTick - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.nextTick = 0; +module.exports = AlphaSingle; - /** - * A counter keeping track of how much delay time, in milliseconds, is left before playback begins. - * - * This is set via the `playAfterDelay` method, although it can be modified at run-time - * if required, as long as the animation has not already started playing. - * - * @name Phaser.Animations.AnimationState#delayCounter - * @type {number} - * @default 0 - * @since 3.50.0 - */ - this.delayCounter = 0; - /** - * A counter that keeps track of how many repeats are left to run. - * - * This value is set when a new animation is loaded into this component, but can also be modified - * at run-time. - * - * @name Phaser.Animations.AnimationState#repeatCounter - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.repeatCounter = 0; +/***/ }), - /** - * An internal flag keeping track of pending repeats. - * - * @name Phaser.Animations.AnimationState#pendingRepeat - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.pendingRepeat = false; +/***/ 69732: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Is the Animation paused? - * - * @name Phaser.Animations.AnimationState#_paused - * @type {boolean} - * @private - * @default false - * @since 3.0.0 - */ - this._paused = false; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Was the animation previously playing before being paused? - * - * @name Phaser.Animations.AnimationState#_wasPlaying - * @type {boolean} - * @private - * @default false - * @since 3.0.0 - */ - this._wasPlaying = false; +var BlendModes = __webpack_require__(95723); - /** - * Internal property tracking if this Animation is waiting to stop. - * - * 0 = No - * 1 = Waiting for ms to pass - * 2 = Waiting for repeat - * 3 = Waiting for specific frame - * - * @name Phaser.Animations.AnimationState#_pendingStop - * @type {number} - * @private - * @since 3.4.0 - */ - this._pendingStop = 0; +/** + * Provides methods used for setting the blend mode of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @namespace Phaser.GameObjects.Components.BlendMode + * @since 3.0.0 + */ - /** - * Internal property used by _pendingStop. - * - * @name Phaser.Animations.AnimationState#_pendingStopValue - * @type {any} - * @private - * @since 3.4.0 - */ - this._pendingStopValue; - }, +var BlendMode = { /** - * Sets an animation, or an array of animations, to be played in the future, after the current one completes or stops. + * Private internal value. Holds the current blend mode. * - * The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, - * or have one of the `stop` methods called. + * @name Phaser.GameObjects.Components.BlendMode#_blendMode + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + _blendMode: BlendModes.NORMAL, + + /** + * Sets the Blend Mode being used by this Game Object. * - * An animation set to repeat forever will never enter a completed state unless stopped. + * This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay) * - * You can chain a new animation at any point, including before the current one starts playing, during it, or when it ends (via its `animationcomplete` event). + * Under WebGL only the following Blend Modes are available: * - * Chained animations are specific to a Game Object, meaning different Game Objects can have different chained animations without impacting the global animation they're playing. + * * NORMAL + * * ADD + * * MULTIPLY + * * SCREEN + * * ERASE * - * Call this method with no arguments to reset all currently chained animations. + * Canvas has more available depending on browser support. * - * @method Phaser.Animations.AnimationState#chain - * @since 3.16.0 + * You can also create your own custom Blend Modes in WebGL. * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig|string[]|Phaser.Animations.Animation[]|Phaser.Types.Animations.PlayAnimationConfig[])} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object, or an array of them. + * Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending + * on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these + * reasons try to be careful about the construction of your Scene and the frequency of which blend modes + * are used. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @name Phaser.GameObjects.Components.BlendMode#blendMode + * @type {(Phaser.BlendModes|string|number)} + * @since 3.0.0 */ - chain: function (key) - { - var parent = this.parent; - - if (key === undefined) - { - this.nextAnimsQueue.length = 0; - this.nextAnim = null; - - return parent; - } + blendMode: { - if (!Array.isArray(key)) + get: function () { - key = [ key ]; - } + return this._blendMode; + }, - for (var i = 0; i < key.length; i++) + set: function (value) { - var anim = key[i]; - - if (this.nextAnim === null) + if (typeof value === 'string') { - this.nextAnim = anim; + value = BlendModes[value]; } - else + + value |= 0; + + if (value >= -1) { - this.nextAnimsQueue.push(anim); + this._blendMode = value; } } - return this.parent; }, /** - * Returns the key of the animation currently loaded into this component. + * Sets the Blend Mode being used by this Game Object. * - * Prior to Phaser 3.50 this method was called `getCurrentKey`. + * This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay) * - * @method Phaser.Animations.AnimationState#getName - * @since 3.50.0 + * Under WebGL only the following Blend Modes are available: * - * @return {string} The key of the Animation currently loaded into this component, or an empty string if none loaded. - */ - getName: function () - { - return (this.currentAnim) ? this.currentAnim.key : ''; - }, - - /** - * Returns the key of the animation frame currently displayed by this component. + * * NORMAL + * * ADD + * * MULTIPLY + * * SCREEN + * * ERASE (only works when rendering to a framebuffer, like a Render Texture) * - * @method Phaser.Animations.AnimationState#getFrameName - * @since 3.50.0 + * Canvas has more available depending on browser support. * - * @return {string} The key of the Animation Frame currently displayed by this component, or an empty string if no animation has been loaded. - */ - getFrameName: function () - { - return (this.currentFrame) ? this.currentFrame.textureFrame : ''; - }, - - /** - * Internal method used to load an animation into this component. + * You can also create your own custom Blend Modes in WebGL. * - * @method Phaser.Animations.AnimationState#load - * @protected + * Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending + * on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these + * reasons try to be careful about the construction of your Scene and the frequency in which blend modes + * are used. + * + * @method Phaser.GameObjects.Components.BlendMode#setBlendMode * @since 3.0.0 * - * @param {(string|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or a `PlayAnimationConfig` object. + * @param {(string|Phaser.BlendModes|number)} value - The BlendMode value. Either a string, a CONST or a number. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @return {this} This Game Object instance. */ - load: function (key) + setBlendMode: function (value) { - if (this.isPlaying) - { - this.stop(); - } - - var manager = this.animationManager; - var animKey = (typeof key === 'string') ? key : GetFastValue(key, 'key', null); - - // Get the animation, first from the local map and, if not found, from the Animation Manager - var anim = (this.exists(animKey)) ? this.get(animKey) : manager.get(animKey); - - if (!anim) - { - console.warn('Missing animation: ' + animKey); - } - else - { - this.currentAnim = anim; - - // And now override the animation values, if set in the config. + this.blendMode = value; - var totalFrames = anim.getTotalFrames(); - var frameRate = GetFastValue(key, 'frameRate', anim.frameRate); - var duration = GetFastValue(key, 'duration', anim.duration); + return this; + } - anim.calculateDuration(this, totalFrames, duration, frameRate); +}; - this.delay = GetFastValue(key, 'delay', anim.delay); - this.repeat = GetFastValue(key, 'repeat', anim.repeat); - this.repeatDelay = GetFastValue(key, 'repeatDelay', anim.repeatDelay); - this.yoyo = GetFastValue(key, 'yoyo', anim.yoyo); - this.showOnStart = GetFastValue(key, 'showOnStart', anim.showOnStart); - this.hideOnComplete = GetFastValue(key, 'hideOnComplete', anim.hideOnComplete); - this.skipMissedFrames = GetFastValue(key, 'skipMissedFrames', anim.skipMissedFrames); +module.exports = BlendMode; - this.timeScale = GetFastValue(key, 'timeScale', this.timeScale); - var startFrame = GetFastValue(key, 'startFrame', 0); +/***/ }), - if (startFrame > anim.getTotalFrames()) - { - startFrame = 0; - } +/***/ 28284: +/***/ ((module) => { - var frame = anim.frames[startFrame]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (startFrame === 0 && !this.forward) - { - frame = anim.getLastFrame(); - } +/** + * Provides methods used for calculating and setting the size of a non-Frame based Game Object. + * Should be applied as a mixin and not used directly. + * + * @namespace Phaser.GameObjects.Components.ComputedSize + * @since 3.0.0 + */ - this.currentFrame = frame; - } +var ComputedSize = { - return this.parent; - }, + /** + * The native (un-scaled) width of this Game Object. + * + * Changing this value will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or use + * the `displayWidth` property. + * + * @name Phaser.GameObjects.Components.ComputedSize#width + * @type {number} + * @since 3.0.0 + */ + width: 0, /** - * Pause the current animation and set the `isPlaying` property to `false`. - * You can optionally pause it at a specific frame. + * The native (un-scaled) height of this Game Object. * - * @method Phaser.Animations.AnimationState#pause + * Changing this value will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or use + * the `displayHeight` property. + * + * @name Phaser.GameObjects.Components.ComputedSize#height + * @type {number} * @since 3.0.0 + */ + height: 0, + + /** + * The displayed width of this Game Object. * - * @param {Phaser.Animations.AnimationFrame} [atFrame] - An optional frame to set after pausing the animation. + * This value takes into account the scale factor. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * Setting this value will adjust the Game Object's scale property. + * + * @name Phaser.GameObjects.Components.ComputedSize#displayWidth + * @type {number} + * @since 3.0.0 */ - pause: function (atFrame) - { - if (!this._paused) + displayWidth: { + + get: function () { - this._paused = true; - this._wasPlaying = this.isPlaying; - this.isPlaying = false; - } + return this.scaleX * this.width; + }, - if (atFrame !== undefined) + set: function (value) { - this.setCurrentFrame(atFrame); + this.scaleX = value / this.width; } - return this.parent; }, /** - * Resumes playback of a paused animation and sets the `isPlaying` property to `true`. - * You can optionally tell it to start playback from a specific frame. + * The displayed height of this Game Object. * - * @method Phaser.Animations.AnimationState#resume - * @since 3.0.0 + * This value takes into account the scale factor. * - * @param {Phaser.Animations.AnimationFrame} [fromFrame] - An optional frame to set before restarting playback. + * Setting this value will adjust the Game Object's scale property. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @name Phaser.GameObjects.Components.ComputedSize#displayHeight + * @type {number} + * @since 3.0.0 */ - resume: function (fromFrame) - { - if (this._paused) + displayHeight: { + + get: function () { - this._paused = false; - this.isPlaying = this._wasPlaying; - } + return this.scaleY * this.height; + }, - if (fromFrame !== undefined) + set: function (value) { - this.setCurrentFrame(fromFrame); + this.scaleY = value / this.height; } - return this.parent; }, /** - * Waits for the specified delay, in milliseconds, then starts playback of the given animation. + * Sets the internal size of this Game Object, as used for frame or physics body creation. * - * If the animation _also_ has a delay value set in its config, it will be **added** to the delay given here. + * This will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or call the + * `setDisplaySize` method, which is the same thing as changing the scale but allows you + * to do so by giving pixel values. * - * If an animation is already running and a new animation is given to this method, it will wait for - * the given delay before starting the new animation. + * If you have enabled this Game Object for input, changing the size will _not_ change the + * size of the hit area. To do this you should adjust the `input.hitArea` object directly. * - * If no animation is currently running, the given one begins after the delay. + * @method Phaser.GameObjects.Components.ComputedSize#setSize + * @since 3.4.0 * - * Prior to Phaser 3.50 this method was called 'delayedPlay' and the parameters were in the reverse order. + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. * - * @method Phaser.Animations.AnimationState#playAfterDelay - * @fires Phaser.Animations.Events#ANIMATION_START - * @since 3.50.0 + * @return {this} This Game Object instance. + */ + setSize: function (width, height) + { + this.width = width; + this.height = height; + + return this; + }, + + /** + * Sets the display size of this Game Object. * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {number} delay - The delay, in milliseconds, to wait before starting the animation playing. + * Calling this will adjust the scale. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @method Phaser.GameObjects.Components.ComputedSize#setDisplaySize + * @since 3.4.0 + * + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {this} This Game Object instance. */ - playAfterDelay: function (key, delay) + setDisplaySize: function (width, height) { - if (!this.isPlaying) - { - this.delayCounter = delay; + this.displayWidth = width; + this.displayHeight = height; - this.play(key, true); - } - else - { - // If we've got a nextAnim, move it to the queue - var nextAnim = this.nextAnim; - var queue = this.nextAnimsQueue; + return this; + } - if (nextAnim) - { - queue.unshift(nextAnim); - } +}; - this.nextAnim = key; +module.exports = ComputedSize; - this._pendingStop = 1; - this._pendingStopValue = delay; - } - return this.parent; - }, +/***/ }), + +/***/ 85293: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods used for getting and setting the texture of a Game Object. + * + * @namespace Phaser.GameObjects.Components.Crop + * @since 3.12.0 + */ + +var Crop = { /** - * Waits for the current animation to complete the `repeatCount` number of repeat cycles, then starts playback - * of the given animation. + * The Texture this Game Object is using to render with. * - * You can use this to ensure there are no harsh jumps between two sets of animations, i.e. going from an - * idle animation to a walking animation, by making them blend smoothly into each other. + * @name Phaser.GameObjects.Components.Crop#texture + * @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture} + * @since 3.0.0 + */ + texture: null, + + /** + * The Texture Frame this Game Object is using to render with. * - * If no animation is currently running, the given one will start immediately. + * @name Phaser.GameObjects.Components.Crop#frame + * @type {Phaser.Textures.Frame} + * @since 3.0.0 + */ + frame: null, + + /** + * A boolean flag indicating if this Game Object is being cropped or not. + * You can toggle this at any time after `setCrop` has been called, to turn cropping on or off. + * Equally, calling `setCrop` with no arguments will reset the crop and disable it. * - * @method Phaser.Animations.AnimationState#playAfterRepeat - * @fires Phaser.Animations.Events#ANIMATION_START - * @since 3.50.0 + * @name Phaser.GameObjects.Components.Crop#isCropped + * @type {boolean} + * @since 3.11.0 + */ + isCropped: false, + + /** + * Applies a crop to a texture based Game Object, such as a Sprite or Image. * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {number} [repeatCount=1] - How many times should the animation repeat before the next one starts? + * The crop is a rectangle that limits the area of the texture frame that is visible during rendering. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * Cropping a Game Object does not change its size, dimensions, physics body or hit area, it just + * changes what is shown when rendered. + * + * The crop coordinates are relative to the texture frame, not the Game Object, meaning 0 x 0 is the top-left. + * + * Therefore, if you had a Game Object that had an 800x600 sized texture, and you wanted to show only the left + * half of it, you could call `setCrop(0, 0, 400, 600)`. + * + * It is also scaled to match the Game Object scale automatically. Therefore a crop rect of 100x50 would crop + * an area of 200x100 when applied to a Game Object that had a scale factor of 2. + * + * You can either pass in numeric values directly, or you can provide a single Rectangle object as the first argument. + * + * Call this method with no arguments at all to reset the crop, or toggle the property `isCropped` to `false`. + * + * You should do this if the crop rectangle becomes the same size as the frame itself, as it will allow + * the renderer to skip several internal calculations. + * + * @method Phaser.GameObjects.Components.Crop#setCrop + * @since 3.11.0 + * + * @param {(number|Phaser.Geom.Rectangle)} [x] - The x coordinate to start the crop from. Or a Phaser.Geom.Rectangle object, in which case the rest of the arguments are ignored. + * @param {number} [y] - The y coordinate to start the crop from. + * @param {number} [width] - The width of the crop rectangle in pixels. + * @param {number} [height] - The height of the crop rectangle in pixels. + * + * @return {this} This Game Object instance. */ - playAfterRepeat: function (key, repeatCount) + setCrop: function (x, y, width, height) { - if (repeatCount === undefined) { repeatCount = 1; } - - if (!this.isPlaying) + if (x === undefined) { - this.play(key); + this.isCropped = false; } - else + else if (this.frame) { - // If we've got a nextAnim, move it to the queue - var nextAnim = this.nextAnim; - var queue = this.nextAnimsQueue; - - if (nextAnim) + if (typeof x === 'number') { - queue.unshift(nextAnim); + this.frame.setCropUVs(this._crop, x, y, width, height, this.flipX, this.flipY); } - - if (this.repeatCounter !== -1 && repeatCount > this.repeatCounter) + else { - repeatCount = this.repeatCounter; - } + var rect = x; - this.nextAnim = key; + this.frame.setCropUVs(this._crop, rect.x, rect.y, rect.width, rect.height, this.flipX, this.flipY); + } - this._pendingStop = 2; - this._pendingStopValue = repeatCount; + this.isCropped = true; } - return this.parent; + return this; }, /** - * Start playing the given animation on this Sprite. + * Internal method that returns a blank, well-formed crop object for use by a Game Object. * - * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. - * - * The benefit of a global animation is that multiple Sprites can all play the same animation, without - * having to duplicate the data. You can just create it once and then play it on any Sprite. - * - * The following code shows how to create a global repeating animation. The animation will be created - * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': - * - * ```javascript - * var config = { - * key: 'run', - * frames: 'muybridge', - * frameRate: 15, - * repeat: -1 - * }; - * - * // This code should be run from within a Scene: - * this.anims.create(config); - * ``` - * - * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, - * you can call the `Animation.create` method instead. It accepts the exact same parameters as when - * creating a global animation, however the resulting data is kept locally in this Sprite. - * - * With the animation created, either globally or locally, you can now play it on this Sprite: - * - * ```javascript - * this.add.sprite(x, y).play('run'); - * ``` - * - * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config - * object instead: - * - * ```javascript - * this.add.sprite(x, y).play({ key: 'run', frameRate: 24 }); - * ``` - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * If you need a Sprite to be able to play both local and global animations, make sure they don't - * have conflicting keys. - * - * See the documentation for the `PlayAnimationConfig` config object for more details about this. - * - * Also, see the documentation in the Animation Manager for further details on creating animations. - * - * @method Phaser.Animations.AnimationState#play - * @fires Phaser.Animations.Events#ANIMATION_START - * @since 3.0.0 - * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {boolean} [ignoreIfPlaying=false] - If this animation is already playing then ignore this call. + * @method Phaser.GameObjects.Components.Crop#resetCropObject + * @private + * @since 3.12.0 * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @return {object} The crop object. */ - play: function (key, ignoreIfPlaying) + resetCropObject: function () { - if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } + return { u0: 0, v0: 0, u1: 0, v1: 0, width: 0, height: 0, x: 0, y: 0, flipX: false, flipY: false, cx: 0, cy: 0, cw: 0, ch: 0 }; + } - var currentAnim = this.currentAnim; - var parent = this.parent; +}; - // Must be either an Animation instance, or a PlayAnimationConfig object - var animKey = (typeof key === 'string') ? key : key.key; +module.exports = Crop; - if (ignoreIfPlaying && this.isPlaying && currentAnim.key === animKey) - { - return parent; - } - // Are we mixing? - if (currentAnim && this.isPlaying) - { - var mix = this.animationManager.getMix(currentAnim.key, key); +/***/ }), - if (mix > 0) - { - return this.playAfterDelay(key, mix); - } - } +/***/ 14975: +/***/ ((module) => { - this.forward = true; - this.inReverse = false; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this._paused = false; - this._wasPlaying = true; +/** + * Provides methods used for setting the depth of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @namespace Phaser.GameObjects.Components.Depth + * @since 3.0.0 + */ - return this.startAnimation(key); - }, +var Depth = { /** - * Start playing the given animation on this Sprite, in reverse. - * - * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. - * - * The benefit of a global animation is that multiple Sprites can all play the same animation, without - * having to duplicate the data. You can just create it once and then play it on any Sprite. - * - * The following code shows how to create a global repeating animation. The animation will be created - * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': - * - * ```javascript - * var config = { - * key: 'run', - * frames: 'muybridge', - * frameRate: 15, - * repeat: -1 - * }; - * - * // This code should be run from within a Scene: - * this.anims.create(config); - * ``` - * - * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, - * you can call the `Animation.create` method instead. It accepts the exact same parameters as when - * creating a global animation, however the resulting data is kept locally in this Sprite. - * - * With the animation created, either globally or locally, you can now play it on this Sprite: - * - * ```javascript - * this.add.sprite(x, y).playReverse('run'); - * ``` - * - * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config - * object instead: - * - * ```javascript - * this.add.sprite(x, y).playReverse({ key: 'run', frameRate: 24 }); - * ``` - * - * When playing an animation on a Sprite it will first check to see if it can find a matching key - * locally within the Sprite. If it can, it will play the local animation. If not, it will then - * search the global Animation Manager and look for it there. - * - * If you need a Sprite to be able to play both local and global animations, make sure they don't - * have conflicting keys. + * Private internal value. Holds the depth of the Game Object. * - * See the documentation for the `PlayAnimationConfig` config object for more details about this. + * @name Phaser.GameObjects.Components.Depth#_depth + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + _depth: 0, + + /** + * The depth of this Game Object within the Scene. Ensure this value is only ever set to a number data-type. * - * Also, see the documentation in the Animation Manager for further details on creating animations. + * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order + * of Game Objects, without actually moving their position in the display list. * - * @method Phaser.Animations.AnimationState#playReverse - * @fires Phaser.Animations.Events#ANIMATION_START - * @since 3.12.0 + * The default depth is zero. A Game Object with a higher depth + * value will always render in front of one with a lower value. * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. + * Setting the depth will queue a depth sort event within the Scene. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @name Phaser.GameObjects.Components.Depth#depth + * @type {number} + * @since 3.0.0 */ - playReverse: function (key, ignoreIfPlaying) - { - if (ignoreIfPlaying === undefined) { ignoreIfPlaying = false; } - - // Must be either an Animation instance, or a PlayAnimationConfig object - var animKey = (typeof key === 'string') ? key : key.key; + depth: { - if (ignoreIfPlaying && this.isPlaying && this.currentAnim.key === animKey) + get: function () { - return this.parent; - } + return this._depth; + }, - this.forward = false; - this.inReverse = true; + set: function (value) + { + if (this.displayList) + { + this.displayList.queueDepthSort(); + } - this._paused = false; - this._wasPlaying = true; + this._depth = value; + } - return this.startAnimation(key); }, /** - * Load the animation based on the key and set-up all of the internal values - * needed for playback to start. If there is no delay, it will also fire the start events. + * The depth of this Game Object within the Scene. * - * @method Phaser.Animations.AnimationState#startAnimation - * @fires Phaser.Animations.Events#ANIMATION_START - * @since 3.50.0 + * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order + * of Game Objects, without actually moving their position in the display list. * - * @param {(string|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or a `PlayAnimationConfig` object. + * The default depth is zero. A Game Object with a higher depth + * value will always render in front of one with a lower value. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * Setting the depth will queue a depth sort event within the Scene. + * + * @method Phaser.GameObjects.Components.Depth#setDepth + * @since 3.0.0 + * + * @param {number} value - The depth of this Game Object. Ensure this value is only ever a number data-type. + * + * @return {this} This Game Object instance. */ - startAnimation: function (key) + setDepth: function (value) { - this.load(key); - - var anim = this.currentAnim; - var gameObject = this.parent; - - if (!anim) - { - return gameObject; - } + if (value === undefined) { value = 0; } - // Should give us 9,007,199,254,740,991 safe repeats - this.repeatCounter = (this.repeat === -1) ? Number.MAX_VALUE : this.repeat; + this.depth = value; - anim.getFirstTick(this); + return this; + } - this.isPlaying = true; - this.pendingRepeat = false; - this.hasStarted = false; +}; - this._pendingStop = 0; - this._pendingStopValue = 0; - this._paused = false; +module.exports = Depth; - // Add any delay the animation itself may have had as well - this.delayCounter += this.delay; - if (this.delayCounter === 0) - { - this.handleStart(); - } +/***/ }), - return gameObject; - }, +/***/ 88677: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Handles the start of an animation playback. - * - * @method Phaser.Animations.AnimationState#handleStart - * @private - * @since 3.50.0 - */ - handleStart: function () - { - if (this.showOnStart) - { - this.parent.setVisible(true); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.setCurrentFrame(this.currentFrame); +var Class = __webpack_require__(56694); +var Effects = __webpack_require__(96910); +var SpliceOne = __webpack_require__(72677); - this.hasStarted = true; +/** + * @classdesc + * The FX Component features a set of methods used for applying a range of special built-in effects to a Game Object. + * + * The effects include the following: + * + * * Barrel Distortion + * * Bloom + * * Blur + * * Bokeh / Tilt Shift + * * Circle Outline + * * Color Matrix + * * Glow + * * Displacement + * * Gradient + * * Pixelate + * * Shine + * * Shadow + * * Vignette + * * Wipe / Reveal + * + * All Game Objects support Post FX. These are effects applied after the Game Object has been rendered. + * + * Texture-based Game Objects also support Pre FX, including: + * + * * Image + * * Sprite + * * TileSprite + * * Text + * * RenderTexture + * * Video + * + * And any Game Object that extends the above. + * + * The difference between Pre FX and Post FX are that all Post FX take place in a canvas (renderer) sized frame buffer, + * after the Game Object has been rendered. Pre FX, however, take place in a texture sized frame buffer, which is sized + * based on the Game Object itself. The end result is then composited back to the main game canvas. For intensive effects, + * such as blur, bloom or glow, which can require many iterations, this is a much more efficient way to apply the effect, + * as only it only has to work on a Game Object sized texture and not all pixels in the canvas. + * + * In short, you should always try and use a Pre FX if you can. + * + * Due to the way that FX work they can be stacked-up. For example, you can apply a blur to a Game Object, then apply + * a bloom effect to the same Game Object. The bloom effect will be applied to the blurred texture, not the original. + * Keep the order in mind when stacking effects. + * + * All effects are WebGL only and do not have canvas counterparts. + * + * As you can appreciate, some effects are more expensive than others. For example, a bloom effect is going to be more + * expensive than a simple color matrix effect, so please consider using them wisely and performance test your target + * platforms early on in production. + * + * This component is created automatically by the `PostPipeline` class and does not need to be instantiated directly. + * + * @class FX + * @memberof Phaser.GameObjects.Components + * @constructor + * @since 3.60.0 + * @webglOnly + * + * @param {Phaser.GameObjects.GameObject} gameObject - A reference to the Game Object that owns this FX Component. + * @param {boolean} isPost - Is this a Pre or Post FX Component? + */ +var FX = new Class({ - this.emitEvents(Events.ANIMATION_START); - }, + initialize: - /** - * Handles the repeat of an animation. - * - * @method Phaser.Animations.AnimationState#handleRepeat - * @private - * @since 3.50.0 - */ - handleRepeat: function () + function FX (gameObject, isPost) { - this.pendingRepeat = false; + /** + * A reference to the Game Object that owns this FX Component. + * + * @name Phaser.GameObjects.Components.FX#gameObject + * @type {Phaser.GameObjects.GameObject} + * @readonly + * @since 3.60.0 + */ + this.gameObject = gameObject; - this.emitEvents(Events.ANIMATION_REPEAT); - }, + /** + * Is this a Post FX Controller? or a Pre FX Controller? + * + * @name Phaser.GameObjects.Components.FX#isPost + * @type {boolean} + * @readonly + * @since 3.60.0 + */ + this.isPost = isPost; - /** - * Handles the stop of an animation playback. - * - * @method Phaser.Animations.AnimationState#handleStop - * @private - * @since 3.50.0 - */ - handleStop: function () - { - this._pendingStop = 0; + /** + * Has this FX Component been enabled? + * + * You should treat this property as read-only, although it is toggled + * automaticaly during internal use. + * + * @name Phaser.GameObjects.Components.FX#enabled + * @type {boolean} + * @since 3.60.0 + */ + this.enabled = false; - this.isPlaying = false; + /** + * An array containing all of the Pre FX Controllers that + * have been added to this FX Component. They are processed in + * the order they are added. + * + * This array is empty if this is a Post FX Component. + * + * @name Phaser.GameObjects.Components.FX#list + * @type {Phaser.FX.Controller[]} + * @since 3.60.0 + */ + this.list = []; - this.emitEvents(Events.ANIMATION_STOP); + /** + * The amount of extra padding to be applied to this Game Object + * when it is being rendered by a PreFX Pipeline. + * + * Lots of FX require additional spacing added to the texture the + * Game Object uses, for example a glow or shadow effect, and this + * method allows you to control how much extra padding is included + * in addition to the texture size. + * + * You do not need to set this if you're only using Post FX. + * + * @name Phaser.GameObjects.Components.FX#padding + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.padding = 0; }, /** - * Handles the completion of an animation playback. + * Sets the amount of extra padding to be applied to this Game Object + * when it is being rendered by a PreFX Pipeline. * - * @method Phaser.Animations.AnimationState#handleComplete - * @private - * @since 3.50.0 + * Lots of FX require additional spacing added to the texture the + * Game Object uses, for example a glow or shadow effect, and this + * method allows you to control how much extra padding is included + * in addition to the texture size. + * + * You do not need to set this if you're only using Post FX. + * + * @method Phaser.GameObjects.Components.FX#setPadding + * @webglOnly + * @since 3.60.0 + * + * @param {number} [padding=0] - The amount of padding to add to this Game Object. + * + * @return {this} This Game Object instance. */ - handleComplete: function () + setPadding: function (padding) { - this._pendingStop = 0; - - this.isPlaying = false; + if (padding === undefined) { padding = 0; } - if (this.hideOnComplete) - { - this.parent.setVisible(false); - } + this.padding = padding; - this.emitEvents(Events.ANIMATION_COMPLETE, Events.ANIMATION_COMPLETE_KEY); + return this.gameObject; }, /** - * Fires the given animation event. + * This callback is invoked when this Game Object is copied by a PreFX Pipeline. * - * @method Phaser.Animations.AnimationState#emitEvents - * @private - * @since 3.50.0 + * This happens when the pipeline uses its `copySprite` method. * - * @param {string} event - The Animation Event to dispatch. + * It's invoked prior to the copy, allowing you to set shader uniforms, etc on the pipeline. + * + * @method Phaser.GameObjects.Components.FX#onFXCopy + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.Pipelines.PreFXPipeline} pipeline - The PreFX Pipeline that invoked this callback. */ - emitEvents: function (event, keyEvent) + onFXCopy: function () { - var anim = this.currentAnim; - var frame = this.currentFrame; - var gameObject = this.parent; - - var frameKey = frame.textureFrame; - - gameObject.emit(event, anim, frame, gameObject, frameKey); - - if (keyEvent) - { - gameObject.emit(keyEvent + anim.key, anim, frame, gameObject, frameKey); - } }, /** - * Reverse the Animation that is already playing on the Game Object. + * This callback is invoked when this Game Object is rendered by a PreFX Pipeline. * - * @method Phaser.Animations.AnimationState#reverse - * @since 3.12.0 + * This happens when the pipeline uses its `drawSprite` method. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * It's invoked prior to the draw, allowing you to set shader uniforms, etc on the pipeline. + * + * @method Phaser.GameObjects.Components.FX#onFX + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.Pipelines.PreFXPipeline} pipeline - The PreFX Pipeline that invoked this callback. */ - reverse: function () + onFX: function () { - if (this.isPlaying) - { - this.inReverse = !this.inReverse; - - this.forward = !this.forward; - } - - return this.parent; }, /** - * Returns a value between 0 and 1 indicating how far this animation is through, ignoring repeats and yoyos. + * Enables this FX Component and applies the FXPipeline to the parent Game Object. * - * The value is based on the current frame and how far that is in the animation, it is not based on - * the duration of the animation. + * This is called automatically whenever you call a method such as `addBloom`, etc. * - * @method Phaser.Animations.AnimationState#getProgress - * @since 3.4.0 + * You can check the `enabled` property to see if the Game Object is already enabled, or not. * - * @return {number} The progress of the current animation in frames, between 0 and 1. + * This only applies to Pre FX. Post FX are always enabled. + * + * @method Phaser.GameObjects.Components.FX#enable + * @since 3.60.0 + * + * @param {number} [padding=0] - The amount of padding to add to this Game Object. */ - getProgress: function () + enable: function (padding) { - var frame = this.currentFrame; - - if (!frame) + if (this.isPost) { - return 0; + return; } - var p = frame.progress; + var renderer = this.gameObject.scene.sys.renderer; - if (this.inReverse) + if (renderer && renderer.pipelines) { - p *= -1; - } + this.gameObject.pipeline = renderer.pipelines.FX_PIPELINE; - return p; + if (padding !== undefined) + { + this.padding = padding; + } + + this.enabled = true; + } + else + { + this.enabled = false; + } }, /** - * Takes a value between 0 and 1 and uses it to set how far this animation is through playback. - * - * Does not factor in repeats or yoyos, but does handle playing forwards or backwards. + * Destroys and removes all FX Controllers that are part of this FX Component, + * then disables it. * - * The value is based on the current frame and how far that is in the animation, it is not based on - * the duration of the animation. + * If this is a Pre FX Component it will only remove Pre FX. + * If this is a Post FX Component it will only remove Post FX. * - * @method Phaser.Animations.AnimationState#setProgress - * @since 3.4.0 + * To remove both at once use the `GameObject.clearFX` method instead. * - * @param {number} [value=0] - The progress value, between 0 and 1. + * @method Phaser.GameObjects.Components.FX#clear + * @since 3.60.0 * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @return {this} This Game Object instance. */ - setProgress: function (value) + clear: function () { - if (!this.forward) + if (this.isPost) { - value = 1 - value; + this.gameObject.resetPostPipeline(true); } + else + { + var list = this.list; - this.setCurrentFrame(this.currentAnim.getFrameByProgress(value)); + for (var i = 0; i < list.length; i++) + { + list[i].destroy(); + } - return this.parent; + this.list = []; + } + + this.enabled = false; + + return this.gameObject; }, /** - * Sets the number of times that the animation should repeat after its first play through. - * For example, if repeat is 1, the animation will play a total of twice: the initial play plus 1 repeat. + * Searches for the given FX Controller within this FX Component. * - * To repeat indefinitely, use -1. - * The value should always be an integer. + * If found, the controller is removed from this component and then destroyed. * - * Calling this method only works if the animation is already running. Otherwise, any - * value specified here will be overwritten when the next animation loads in. To avoid this, - * use the `repeat` property of the `PlayAnimationConfig` object instead. + * @method Phaser.GameObjects.Components.FX#remove + * @since 3.60.0 * - * @method Phaser.Animations.AnimationState#setRepeat - * @since 3.4.0 + * @generic {Phaser.FX.Controller} T + * @genericUse {T} - [fx] * - * @param {number} value - The number of times that the animation should repeat. + * @param {Phaser.FX.Controller} fx - The FX Controller to remove from this FX Component. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @return {this} This Game Object instance. */ - setRepeat: function (value) + remove: function (fx) { - this.repeatCounter = (value === -1) ? Number.MAX_VALUE : value; + var i; - return this.parent; - }, + if (this.isPost) + { + var pipelines = this.gameObject.getPostPipeline(String(fx.type)); - /** - * Handle the removal of an animation from the Animation Manager. - * - * @method Phaser.Animations.AnimationState#globalRemove - * @since 3.50.0 - * - * @param {string} [key] - The key of the removed Animation. - * @param {Phaser.Animations.Animation} [animation] - The removed Animation. - */ - globalRemove: function (key, animation) - { - if (animation === undefined) { animation = this.currentAnim; } + if (!Array.isArray(pipelines)) + { + pipelines = [ pipelines ]; + } - if (this.isPlaying && animation.key === this.currentAnim.key) + for (i = 0; i < pipelines.length; i++) + { + var pipeline = pipelines[i]; + + if (pipeline.controller === fx) + { + this.gameObject.removePostPipeline(pipeline); + + fx.destroy(); + + break; + } + } + } + else { - this.stop(); + var list = this.list; - this.setCurrentFrame(this.currentAnim.frames[0]); + for (i = 0; i < list.length; i++) + { + if (list[i] === fx) + { + SpliceOne(list, i); + + fx.destroy(); + } + } } + + return this.gameObject; }, /** - * Restarts the current animation from its beginning. + * Disables this FX Component. * - * You can optionally reset the delay and repeat counters as well. + * This will reset the pipeline on the Game Object that owns this component back to its + * default and flag this component as disabled. * - * Calling this will fire the `ANIMATION_RESTART` event immediately. + * You can re-enable it again by calling `enable` for Pre FX or by adding an FX for Post FX. * - * If you `includeDelay` then it will also fire the `ANIMATION_START` event once - * the delay has expired, otherwise, playback will just begin immediately. + * Optionally, set `clear` to destroy all current FX Controllers. * - * @method Phaser.Animations.AnimationState#restart - * @fires Phaser.Animations.Events#ANIMATION_RESTART - * @since 3.0.0 + * @method Phaser.GameObjects.Components.FX#disable + * @since 3.60.0 * - * @param {boolean} [includeDelay=false] - Whether to include the delay value of the animation when restarting. - * @param {boolean} [resetRepeats=false] - Whether to reset the repeat counter or not? + * @param {boolean} [clear=false] - Destroy and remove all FX Controllers that are part of this component. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @return {this} This Game Object instance. */ - restart: function (includeDelay, resetRepeats) + disable: function (clear) { - if (includeDelay === undefined) { includeDelay = false; } - if (resetRepeats === undefined) { resetRepeats = false; } + if (clear === undefined) { clear = false; } - var anim = this.currentAnim; - var gameObject = this.parent; - - if (!anim) + if (!this.isPost) { - return gameObject; + this.gameObject.resetPipeline(); } - if (resetRepeats) + this.enabled = false; + + if (clear) { - this.repeatCounter = (this.repeat === -1) ? Number.MAX_VALUE : this.repeat; + this.clear(); } - anim.getFirstTick(this); - - this.emitEvents(Events.ANIMATION_RESTART); - - this.isPlaying = true; - this.pendingRepeat = false; - - // Set this to `true` if there is no delay to include, so it skips the `hasStarted` check in `update`. - this.hasStarted = !includeDelay; - - this._pendingStop = 0; - this._pendingStopValue = 0; - this._paused = false; - - this.setCurrentFrame(anim.frames[0]); - - return this.parent; + return this.gameObject; }, /** - * The current animation has completed. This dispatches the `ANIMATION_COMPLETE` event. + * Adds the given FX Controler to this FX Component. * - * This method is called by the Animation instance and should not usually be invoked directly. + * Note that adding an FX Controller does not remove any existing FX. They all stack-up + * on-top of each other. If you don't want this, make sure to call either `remove` or + * `clear` first. * - * If no animation is loaded, no events will be dispatched. + * @method Phaser.GameObjects.Components.FX#add + * @since 3.60.0 * - * If another animation has been queued for playback, it will be started after the events fire. + * @generic {Phaser.FX.Controller} T + * @genericUse {T} - [fx] * - * @method Phaser.Animations.AnimationState#complete - * @fires Phaser.Animations.Events#ANIMATION_COMPLETE - * @since 3.50.0 + * @param {Phaser.FX.Controller} fx - The FX Controller to add to this FX Component. + * @param {object} [config] - Optional configuration object that is passed to the pipeline during instantiation. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @return {Phaser.FX.Controller} The FX Controller. */ - complete: function () + add: function (fx, config) { - this._pendingStop = 0; + if (this.isPost) + { + var type = String(fx.type); - this.isPlaying = false; + this.gameObject.setPostPipeline(type, config); - if (this.currentAnim) - { - this.handleComplete(); - } + var pipeline = this.gameObject.getPostPipeline(type); - if (this.nextAnim) - { - var key = this.nextAnim; + if (pipeline) + { + if (Array.isArray(pipeline)) + { + pipeline = pipeline.pop(); + } - this.nextAnim = (this.nextAnimsQueue.length > 0) ? this.nextAnimsQueue.shift() : null; + pipeline.controller = fx; - this.play(key); + return fx; + } } + else + { + if (!this.enabled) + { + this.enable(); + } - return this.parent; + this.list.push(fx); + + return fx; + } }, /** - * Immediately stops the current animation from playing and dispatches the `ANIMATION_STOP` event. + * Adds a Glow effect. * - * If no animation is running, no events will be dispatched. + * The glow effect is a visual technique that creates a soft, luminous halo around game objects, + * characters, or UI elements. This effect is used to emphasize importance, enhance visual appeal, + * or convey a sense of energy, magic, or otherworldly presence. The effect can also be set on + * the inside of the Game Object. The color and strength of the glow can be modified. * - * If there is another animation in the queue (set via the `chain` method) then it will start playing. + * @method Phaser.GameObjects.Components.FX#addGlow + * @since 3.60.0 * - * @method Phaser.Animations.AnimationState#stop - * @fires Phaser.Animations.Events#ANIMATION_STOP - * @since 3.0.0 + * @param {number} [color=0xffffff] - The color of the glow effect as a number value. + * @param {number} [outerStrength=4] - The strength of the glow outward from the edge of the Sprite. + * @param {number} [innerStrength=0] - The strength of the glow inward from the edge of the Sprite. + * @param {boolean} [knockout=false] - If `true` only the glow is drawn, not the texture itself. + * @param {number} [quality=0.1] - Only available for PostFX. Sets the quality of this Glow effect. Default is 0.1. Cannot be changed post-creation. + * @param {number} [distance=10] - Only available for PostFX. Sets the distance of this Glow effect. Default is 10. Cannot be changed post-creation. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @return {Phaser.FX.Glow} The Glow FX Controller. */ - stop: function () + addGlow: function (color, outerStrength, innerStrength, knockout, quality, distance) { - this._pendingStop = 0; - - this.isPlaying = false; - - if (this.currentAnim) - { - this.handleStop(); - } - - if (this.nextAnim) - { - var key = this.nextAnim; - - this.nextAnim = this.nextAnimsQueue.shift(); - - this.play(key); - } - - return this.parent; + return this.add(new Effects.Glow(this.gameObject, color, outerStrength, innerStrength, knockout), { quality: quality, distance: distance }); }, /** - * Stops the current animation from playing after the specified time delay, given in milliseconds. - * - * It then dispatches the `ANIMATION_STOP` event. - * - * If no animation is running, no events will be dispatched. + * Adds a Shadow effect. * - * If there is another animation in the queue (set via the `chain` method) then it will start playing, - * when the current one stops. + * The shadow effect is a visual technique used to create the illusion of depth and realism by adding darker, + * offset silhouettes or shapes beneath game objects, characters, or environments. These simulated shadows + * help to enhance the visual appeal and immersion, making the 2D game world appear more dynamic and three-dimensional. * - * @method Phaser.Animations.AnimationState#stopAfterDelay - * @fires Phaser.Animations.Events#ANIMATION_STOP - * @since 3.4.0 + * @method Phaser.GameObjects.Components.FX#addShadow + * @since 3.60.0 * - * @param {number} delay - The number of milliseconds to wait before stopping this animation. + * @param {number} [x=0] - The horizontal offset of the shadow effect. + * @param {number} [y=0] - The vertical offset of the shadow effect. + * @param {number} [decay=0.1] - The amount of decay for shadow effect. + * @param {number} [power=1] - The power of the shadow effect. + * @param {number} [color=0x000000] - The color of the shadow. + * @param {number} [samples=6] - The number of samples that the shadow effect will run for. An integer between 1 and 12. + * @param {number} [intensity=1] - The intensity of the shadow effect. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @return {Phaser.FX.Shadow} The Shadow FX Controller. */ - stopAfterDelay: function (delay) + addShadow: function (x, y, decay, power, color, samples, intensity) { - this._pendingStop = 1; - this._pendingStopValue = delay; - - return this.parent; + return this.add(new Effects.Shadow(this.gameObject, x, y, decay, power, color, samples, intensity)); }, /** - * Stops the current animation from playing when it next repeats. + * Adds a Pixelate effect. * - * It then dispatches the `ANIMATION_STOP` event. - * - * If no animation is running, no events will be dispatched. - * - * If there is another animation in the queue (set via the `chain` method) then it will start playing, - * when the current one stops. - * - * Prior to Phaser 3.50 this method was called `stopOnRepeat` and had no parameters. + * The pixelate effect is a visual technique that deliberately reduces the resolution or detail of an image, + * creating a blocky or mosaic appearance composed of large, visible pixels. This effect can be used for stylistic + * purposes, as a homage to retro gaming, or as a means to obscure certain elements within the game, such as + * during a transition or to censor specific content. * - * @method Phaser.Animations.AnimationState#stopAfterRepeat - * @fires Phaser.Animations.Events#ANIMATION_STOP - * @since 3.50.0 + * @method Phaser.GameObjects.Components.FX#addPixelate + * @since 3.60.0 * - * @param {number} [repeatCount=1] - How many times should the animation repeat before stopping? + * @param {number} [amount=1] - The amount of pixelation to apply. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @return {Phaser.FX.Pixelate} The Pixelate FX Controller. */ - stopAfterRepeat: function (repeatCount) + addPixelate: function (amount) { - if (repeatCount === undefined) { repeatCount = 1; } - - if (this.repeatCounter !== -1 && repeatCount > this.repeatCounter) - { - repeatCount = this.repeatCounter; - } - - this._pendingStop = 2; - this._pendingStopValue = repeatCount; - - return this.parent; + return this.add(new Effects.Pixelate(this.gameObject, amount)); }, /** - * Stops the current animation from playing when it next sets the given frame. - * If this frame doesn't exist within the animation it will not stop it from playing. - * - * It then dispatches the `ANIMATION_STOP` event. - * - * If no animation is running, no events will be dispatched. + * Adds a Vignette effect. * - * If there is another animation in the queue (set via the `chain` method) then it will start playing, - * when the current one stops. + * The vignette effect is a visual technique where the edges of the screen, or a Game Object, gradually darken or blur, + * creating a frame-like appearance. This effect is used to draw the player's focus towards the central action or subject, + * enhance immersion, and provide a cinematic or artistic quality to the game's visuals. * - * @method Phaser.Animations.AnimationState#stopOnFrame - * @fires Phaser.Animations.Events#ANIMATION_STOP - * @since 3.4.0 + * @method Phaser.GameObjects.Components.FX#addVignette + * @since 3.60.0 * - * @param {Phaser.Animations.AnimationFrame} frame - The frame to check before stopping this animation. + * @param {number} [x=0.5] - The horizontal offset of the vignette effect. This value is normalized to the range 0 to 1. + * @param {number} [y=0.5] - The vertical offset of the vignette effect. This value is normalized to the range 0 to 1. + * @param {number} [radius=0.5] - The radius of the vignette effect. This value is normalized to the range 0 to 1. + * @param {number} [strength=0.5] - The strength of the vignette effect. * - * @return {Phaser.GameObjects.GameObject} The Game Object that owns this Animation Component. + * @return {Phaser.FX.Vignette} The Vignette FX Controller. */ - stopOnFrame: function (frame) + addVignette: function (x, y, radius, strength) { - this._pendingStop = 3; - this._pendingStopValue = frame; - - return this.parent; + return this.add(new Effects.Vignette(this.gameObject, x, y, radius, strength)); }, /** - * Returns the total number of frames in this animation, or returns zero if no - * animation has been loaded. + * Adds a Shine effect. * - * @method Phaser.Animations.AnimationState#getTotalFrames - * @since 3.4.0 + * The shine effect is a visual technique that simulates the appearance of reflective + * or glossy surfaces by passing a light beam across a Game Object. This effect is used to + * enhance visual appeal, emphasize certain features, and create a sense of depth or + * material properties. * - * @return {number} The total number of frames in the current animation, or zero if no animation has been loaded. + * @method Phaser.GameObjects.Components.FX#addShine + * @since 3.60.0 + * + * @param {number} [speed=0.5] - The speed of the Shine effect. + * @param {number} [lineWidth=0.5] - The line width of the Shine effect. + * @param {number} [gradient=3] - The gradient of the Shine effect. + * @param {boolean} [reveal=false] - Does this Shine effect reveal or get added to its target? + * + * @return {Phaser.FX.Shine} The Shine FX Controller. */ - getTotalFrames: function () + addShine: function (speed, lineWidth, gradient, reveal) { - return (this.currentAnim) ? this.currentAnim.getTotalFrames() : 0; + return this.add(new Effects.Shine(this.gameObject, speed, lineWidth, gradient, reveal)); }, /** - * The internal update loop for the AnimationState Component. + * Adds a Blur effect. * - * This is called automatically by the `Sprite.preUpdate` method. + * A Gaussian blur is the result of blurring an image by a Gaussian function. It is a widely used effect, + * typically to reduce image noise and reduce detail. The visual effect of this blurring technique is a + * smooth blur resembling that of viewing the image through a translucent screen, distinctly different + * from the bokeh effect produced by an out-of-focus lens or the shadow of an object under usual illumination. * - * @method Phaser.Animations.AnimationState#update - * @since 3.0.0 + * @method Phaser.GameObjects.Components.FX#addBlur + * @since 3.60.0 * - * @param {number} time - The current timestamp. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @param {number} [quality=0] - The quality of the blur effect. Can be either 0 for Low Quality, 1 for Medium Quality or 2 for High Quality. + * @param {number} [x=2] - The horizontal offset of the blur effect. + * @param {number} [y=2] - The vertical offset of the blur effect. + * @param {number} [strength=1] - The strength of the blur effect. + * @param {number} [color=0xffffff] - The color of the blur, as a hex value. + * @param {number} [steps=4] - The number of steps to run the blur effect for. This value should always be an integer. + * + * @return {Phaser.FX.Blur} The Blur FX Controller. */ - update: function (time, delta) + addBlur: function (quality, x, y, strength, color, steps) { - var anim = this.currentAnim; - - if (!this.isPlaying || !anim || anim.paused) - { - return; - } - - this.accumulator += delta * this.timeScale; - - if (this._pendingStop === 1) - { - this._pendingStopValue -= delta; - - if (this._pendingStopValue <= 0) - { - return this.stop(); - } - } - - if (!this.hasStarted) - { - if (this.accumulator >= this.delayCounter) - { - this.accumulator -= this.delayCounter; - - this.handleStart(); - } - } - else if (this.accumulator >= this.nextTick) - { - // Process one frame advance as standard - - if (this.forward) - { - anim.nextFrame(this); - } - else - { - anim.previousFrame(this); - } - - // And only do more if we're skipping frames and have time left - if (this.isPlaying && this._pendingStop === 0 && this.skipMissedFrames && this.accumulator > this.nextTick) - { - var safetyNet = 0; - - do - { - if (this.forward) - { - anim.nextFrame(this); - } - else - { - anim.previousFrame(this); - } - - safetyNet++; - - } while (this.isPlaying && this.accumulator > this.nextTick && safetyNet < 60); - } - } + return this.add(new Effects.Blur(this.gameObject, quality, x, y, strength, color, steps)); }, /** - * Sets the given Animation Frame as being the current frame - * and applies it to the parent Game Object, adjusting size and origin as needed. + * Adds a Gradient effect. * - * @method Phaser.Animations.AnimationState#setCurrentFrame - * @fires Phaser.Animations.Events#ANIMATION_UPDATE - * @fires Phaser.Animations.Events#ANIMATION_STOP - * @since 3.4.0 + * The gradient overlay effect is a visual technique where a smooth color transition is applied over Game Objects, + * such as sprites or UI components. This effect is used to enhance visual appeal, emphasize depth, or create + * stylistic and atmospheric variations. It can also be utilized to convey information, such as representing + * progress or health status through color changes. * - * @param {Phaser.Animations.AnimationFrame} animationFrame - The animation frame to change to. + * @method Phaser.GameObjects.Components.FX#addGradient + * @since 3.60.0 * - * @return {Phaser.GameObjects.GameObject} The Game Object this Animation Component belongs to. + * @param {number} [color1=0xff0000] - The first gradient color, given as a number value. + * @param {number} [color2=0x00ff00] - The second gradient color, given as a number value. + * @param {number} [alpha=0.2] - The alpha value of the gradient effect. + * @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. + * @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. + * @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. + * @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. + * @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect. + * + * @return {Phaser.FX.Gradient} The Gradient FX Controller. */ - setCurrentFrame: function (animationFrame) + addGradient: function (color1, color2, alpha, fromX, fromY, toX, toY, size) { - var gameObject = this.parent; - - this.currentFrame = animationFrame; - - gameObject.texture = animationFrame.frame.texture; - gameObject.frame = animationFrame.frame; - - if (gameObject.isCropped) - { - gameObject.frame.updateCropUVs(gameObject._crop, gameObject.flipX, gameObject.flipY); - } - - if (animationFrame.setAlpha) - { - gameObject.alpha = animationFrame.alpha; - } - - gameObject.setSizeToFrame(); - - if (gameObject._originComponent) - { - if (animationFrame.frame.customPivot) - { - gameObject.setOrigin(animationFrame.frame.pivotX, animationFrame.frame.pivotY); - } - else - { - gameObject.updateDisplayOrigin(); - } - } - - if (this.isPlaying && this.hasStarted) - { - this.emitEvents(Events.ANIMATION_UPDATE); - - if (this._pendingStop === 3 && this._pendingStopValue === animationFrame) - { - this.stop(); - } - } - - return gameObject; + return this.add(new Effects.Gradient(this.gameObject, color1, color2, alpha, fromX, fromY, toX, toY, size)); }, /** - * Advances the animation to the next frame, regardless of the time or animation state. - * If the animation is set to repeat, or yoyo, this will still take effect. + * Adds a Bloom effect. * - * Calling this does not change the direction of the animation. I.e. if it was currently - * playing in reverse, calling this method doesn't then change the direction to forwards. + * Bloom is an effect used to reproduce an imaging artifact of real-world cameras. + * The effect produces fringes of light extending from the borders of bright areas in an image, + * contributing to the illusion of an extremely bright light overwhelming the + * camera or eye capturing the scene. * - * @method Phaser.Animations.AnimationState#nextFrame - * @since 3.16.0 + * @method Phaser.GameObjects.Components.FX#addBloom + * @since 3.60.0 * - * @return {Phaser.GameObjects.GameObject} The Game Object this Animation Component belongs to. + * @param {number} [color] - The color of the Bloom, as a hex value. + * @param {number} [offsetX=1] - The horizontal offset of the bloom effect. + * @param {number} [offsetY=1] - The vertical offset of the bloom effect. + * @param {number} [blurStrength=1] - The strength of the blur process of the bloom effect. + * @param {number} [strength=1] - The strength of the blend process of the bloom effect. + * @param {number} [steps=4] - The number of steps to run the Bloom effect for. This value should always be an integer. + * + * @return {Phaser.FX.Bloom} The Bloom FX Controller. */ - nextFrame: function () + addBloom: function (color, offsetX, offsetY, blurStrength, strength, steps) { - if (this.currentAnim) - { - this.currentAnim.nextFrame(this); - } - - return this.parent; + return this.add(new Effects.Bloom(this.gameObject, color, offsetX, offsetY, blurStrength, strength, steps)); }, /** - * Advances the animation to the previous frame, regardless of the time or animation state. - * If the animation is set to repeat, or yoyo, this will still take effect. + * Adds a ColorMatrix effect. * - * Calling this does not change the direction of the animation. I.e. if it was currently - * playing in forwards, calling this method doesn't then change the direction to backwards. + * The color matrix effect is a visual technique that involves manipulating the colors of an image + * or scene using a mathematical matrix. This process can adjust hue, saturation, brightness, and contrast, + * allowing developers to create various stylistic appearances or mood settings within the game. + * Common applications include simulating different lighting conditions, applying color filters, + * or achieving a specific visual style. * - * @method Phaser.Animations.AnimationState#previousFrame - * @since 3.16.0 + * @method Phaser.GameObjects.Components.FX#addColorMatrix + * @since 3.60.0 * - * @return {Phaser.GameObjects.GameObject} The Game Object this Animation Component belongs to. + * @return {Phaser.FX.ColorMatrix} The ColorMatrix FX Controller. */ - previousFrame: function () + addColorMatrix: function () { - if (this.currentAnim) - { - this.currentAnim.previousFrame(this); - } - - return this.parent; + return this.add(new Effects.ColorMatrix(this.gameObject)); }, /** - * Get an Animation instance that has been created locally on this Sprite. + * Adds a Circle effect. * - * See the `create` method for more details. + * This effect will draw a circle around the texture of the Game Object, effectively masking off + * any area outside of the circle without the need for an actual mask. You can control the thickness + * of the circle, the color of the circle and the color of the background, should the texture be + * transparent. You can also control the feathering applied to the circle, allowing for a harsh or soft edge. * - * @method Phaser.Animations.AnimationState#get - * @since 3.50.0 + * Please note that adding this effect to a Game Object will not change the input area or physics body of + * the Game Object, should it have one. * - * @param {string} key - The key of the Animation to retrieve. + * @method Phaser.GameObjects.Components.FX#addCircle + * @since 3.60.0 * - * @return {Phaser.Animations.Animation} The Animation, or `null` if the key is invalid. + * @param {number} [thickness=8] - The width of the circle around the texture, in pixels. + * @param {number} [color=0xfeedb6] - The color of the circular ring, given as a number value. + * @param {number} [backgroundColor=0xff0000] - The color of the background, behind the texture, given as a number value. + * @param {number} [scale=1] - The scale of the circle. The default scale is 1, which is a circle the full size of the underlying texture. + * @param {number} [feather=0.005] - The amount of feathering to apply to the circle from the ring. + * + * @return {Phaser.FX.Circle} The Circle FX Controller. */ - get: function (key) + addCircle: function (thickness, color, backgroundColor, scale, feather) { - return (this.anims) ? this.anims.get(key) : null; + return this.add(new Effects.Circle(this.gameObject, thickness, color, backgroundColor, scale, feather)); }, /** - * Checks to see if the given key is already used locally within the animations stored on this Sprite. + * Adds a Barrel effect. * - * @method Phaser.Animations.AnimationState#exists - * @since 3.50.0 + * A barrel effect allows you to apply either a 'pinch' or 'expand' distortion to + * a Game Object. The amount of the effect can be modified in real-time. * - * @param {string} key - The key of the Animation to check. + * @method Phaser.GameObjects.Components.FX#addBarrel + * @since 3.60.0 * - * @return {boolean} `true` if the Animation exists locally, or `false` if the key is available, or there are no local animations. + * @param {number} [amount=1] - The amount of distortion applied to the barrel effect. A value of 1 is no distortion. Typically keep this within +- 1. + * + * @return {Phaser.FX.Barrel} The Barrel FX Controller. */ - exists: function (key) + addBarrel: function (amount) { - return (this.anims) ? this.anims.has(key) : false; + return this.add(new Effects.Barrel(this.gameObject, amount)); }, /** - * Creates a new Animation that is local specifically to this Sprite. - * - * When a Sprite owns an animation, it is kept out of the global Animation Manager, which means - * you're free to use keys that may be already defined there. Unless you specifically need a Sprite - * to have a unique animation, you should favor using global animations instead, as they allow for - * the same animation to be used across multiple Sprites, saving on memory. However, if this Sprite - * is the only one to use this animation, it's sensible to create it here. - * - * If an invalid key is given this method will return `false`. - * - * If you pass the key of an animation that already exists locally, that animation will be returned. - * - * A brand new animation is only created if the key is valid and not already in use by this Sprite. + * Adds a Displacement effect. * - * If you wish to re-use an existing key, call the `remove` method first, then this method. + * The displacement effect is a visual technique that alters the position of pixels in an image + * or texture based on the values of a displacement map. This effect is used to create the illusion + * of depth, surface irregularities, or distortion in otherwise flat elements. It can be applied to + * characters, objects, or backgrounds to enhance realism, convey movement, or achieve various + * stylistic appearances. * - * @method Phaser.Animations.AnimationState#create - * @since 3.50.0 + * @method Phaser.GameObjects.Components.FX#addDisplacement + * @since 3.60.0 * - * @param {Phaser.Types.Animations.Animation} config - The configuration settings for the Animation. + * @param {string} [texture='__WHITE'] - The unique string-based key of the texture to use for displacement, which must exist in the Texture Manager. + * @param {number} [x=0.005] - The amount of horizontal displacement to apply. A very small float number, such as 0.005. + * @param {number} [y=0.005] - The amount of vertical displacement to apply. A very small float number, such as 0.005. * - * @return {(Phaser.Animations.Animation|false)} The Animation that was created, or `false` if the key is already in use. + * @return {Phaser.FX.Displacement} The Displacement FX Controller. */ - create: function (config) + addDisplacement: function (texture, x, y) { - var key = config.key; - - var anim = false; - - if (key) - { - anim = this.get(key); - - if (!anim) - { - anim = new Animation(this, key, config); - - if (!this.anims) - { - this.anims = new CustomMap(); - } - - this.anims.set(key, anim); - } - } - - return anim; + return this.add(new Effects.Displacement(this.gameObject, texture, x, y)); }, /** - * Generate an array of {@link Phaser.Types.Animations.AnimationFrame} objects from a texture key and configuration object. - * - * Generates objects with string based frame names, as configured by the given {@link Phaser.Types.Animations.GenerateFrameNames}. + * Adds a Wipe effect. * - * It's a helper method, designed to make it easier for you to extract all of the frame names from texture atlases. - * If you're working with a sprite sheet, see the `generateFrameNumbers` method instead. - * - * Example: + * The wipe or reveal effect is a visual technique that gradually uncovers or conceals elements + * in the game, such as images, text, or scene transitions. This effect is often used to create + * a sense of progression, reveal hidden content, or provide a smooth and visually appealing transition + * between game states. * - * If you have a texture atlases loaded called `gems` and it contains 6 frames called `ruby_0001`, `ruby_0002`, and so on, - * then you can call this method using: `this.anims.generateFrameNames('gems', { prefix: 'ruby_', end: 6, zeroPad: 4 })`. - * - * The `end` value tells it to look for 6 frames, incrementally numbered, all starting with the prefix `ruby_`. The `zeroPad` - * value tells it how many zeroes pad out the numbers. To create an animation using this method, you can do: + * You can set both the direction and the axis of the wipe effect. The following combinations are possible: * - * ```javascript - * this.anims.create({ - * key: 'ruby', - * repeat: -1, - * frames: this.anims.generateFrameNames('gems', { - * prefix: 'ruby_', - * end: 6, - * zeroPad: 4 - * }) - * }); - * ``` + * * left to right: direction 0, axis 0 + * * right to left: direction 1, axis 0 + * * top to bottom: direction 1, axis 1 + * * bottom to top: direction 1, axis 0 * - * Please see the animation examples for further details. + * It is up to you to set the `progress` value yourself, i.e. via a Tween, in order to transition the effect. * - * @method Phaser.Animations.AnimationState#generateFrameNames - * @since 3.50.0 + * @method Phaser.GameObjects.Components.FX#addWipe + * @since 3.60.0 * - * @param {string} key - The key for the texture containing the animation frames. - * @param {Phaser.Types.Animations.GenerateFrameNames} [config] - The configuration object for the animation frame names. + * @param {number} [wipeWidth=0.1] - The width of the wipe effect. This value is normalized in the range 0 to 1. + * @param {number} [direction=0] - The direction of the wipe effect. Either 0 or 1. Set in conjunction with the axis property. + * @param {number} [axis=0] - The axis of the wipe effect. Either 0 or 1. Set in conjunction with the direction property. * - * @return {Phaser.Types.Animations.AnimationFrame[]} The array of {@link Phaser.Types.Animations.AnimationFrame} objects. + * @return {Phaser.FX.Wipe} The Wipe FX Controller. */ - generateFrameNames: function (key, config) + addWipe: function (wipeWidth, direction, axis) { - return this.animationManager.generateFrameNames(key, config); + return this.add(new Effects.Wipe(this.gameObject, wipeWidth, direction, axis)); }, /** - * Generate an array of {@link Phaser.Types.Animations.AnimationFrame} objects from a texture key and configuration object. - * - * Generates objects with numbered frame names, as configured by the given {@link Phaser.Types.Animations.GenerateFrameNumbers}. - * - * If you're working with a texture atlas, see the `generateFrameNames` method instead. - * - * It's a helper method, designed to make it easier for you to extract frames from sprite sheets. - * If you're working with a texture atlas, see the `generateFrameNames` method instead. + * Adds a Reveal Wipe effect. * - * Example: + * The wipe or reveal effect is a visual technique that gradually uncovers or conceals elements + * in the game, such as images, text, or scene transitions. This effect is often used to create + * a sense of progression, reveal hidden content, or provide a smooth and visually appealing transition + * between game states. * - * If you have a sprite sheet loaded called `explosion` and it contains 12 frames, then you can call this method using: - * `this.anims.generateFrameNumbers('explosion', { start: 0, end: 12 })`. + * You can set both the direction and the axis of the wipe effect. The following combinations are possible: * - * The `end` value tells it to stop after 12 frames. To create an animation using this method, you can do: + * * left to right: direction 0, axis 0 + * * right to left: direction 1, axis 0 + * * top to bottom: direction 1, axis 1 + * * bottom to top: direction 1, axis 0 * - * ```javascript - * this.anims.create({ - * key: 'boom', - * frames: this.anims.generateFrameNames('explosion', { - * start: 0, - * end: 12 - * }) - * }); - * ``` + * It is up to you to set the `progress` value yourself, i.e. via a Tween, in order to transition the effect. * - * Note that `start` is optional and you don't need to include it if the animation starts from frame 0. + * @method Phaser.GameObjects.Components.FX#addReveal + * @since 3.60.0 * - * To specify an animation in reverse, swap the `start` and `end` values. + * @param {number} [wipeWidth=0.1] - The width of the wipe effect. This value is normalized in the range 0 to 1. + * @param {number} [direction=0] - The direction of the wipe effect. Either 0 or 1. Set in conjunction with the axis property. + * @param {number} [axis=0] - The axis of the wipe effect. Either 0 or 1. Set in conjunction with the direction property. * - * If the frames are not sequential, you may pass an array of frame numbers instead, for example: + * @return {Phaser.FX.Wipe} The Wipe FX Controller. + */ + addReveal: function (wipeWidth, direction, axis) + { + return this.add(new Effects.Wipe(this.gameObject, wipeWidth, direction, axis, true)); + }, + + /** + * Adds a Bokeh effect. * - * `this.anims.generateFrameNumbers('explosion', { frames: [ 0, 1, 2, 1, 2, 3, 4, 0, 1, 2 ] })` + * Bokeh refers to a visual effect that mimics the photographic technique of creating a shallow depth of field. + * This effect is used to emphasize the game's main subject or action, by blurring the background or foreground + * elements, resulting in a more immersive and visually appealing experience. It is achieved through rendering + * techniques that simulate the out-of-focus areas, giving a sense of depth and realism to the game's graphics. * - * Please see the animation examples and `GenerateFrameNumbers` config docs for further details. + * See also Tilt Shift. * - * @method Phaser.Animations.AnimationState#generateFrameNumbers - * @since 3.50.0 + * @method Phaser.GameObjects.Components.FX#addBokeh + * @since 3.60.0 * - * @param {string} key - The key for the texture containing the animation frames. - * @param {Phaser.Types.Animations.GenerateFrameNumbers} config - The configuration object for the animation frames. + * @param {number} [radius=0.5] - The radius of the bokeh effect. + * @param {number} [amount=1] - The amount of the bokeh effect. + * @param {number} [contrast=0.2] - The color contrast of the bokeh effect. * - * @return {Phaser.Types.Animations.AnimationFrame[]} The array of {@link Phaser.Types.Animations.AnimationFrame} objects. + * @return {Phaser.FX.Bokeh} The Bokeh FX Controller. */ - generateFrameNumbers: function (key, config) + addBokeh: function (radius, amount, contrast) { - return this.animationManager.generateFrameNumbers(key, config); + return this.add(new Effects.Bokeh(this.gameObject, radius, amount, contrast)); }, /** - * Removes a locally created Animation from this Sprite, based on the given key. + * Adds a Tilt Shift effect. * - * Once an Animation has been removed, this Sprite cannot play it again without re-creating it. + * This Bokeh effect can also be used to generate a Tilt Shift effect, which is a technique used to create a miniature + * effect by blurring everything except a small area of the image. This effect is achieved by blurring the + * top and bottom elements, while keeping the center area in focus. * - * @method Phaser.Animations.AnimationState#remove - * @since 3.50.0 + * See also Bokeh. * - * @param {string} key - The key of the animation to remove. + * @method Phaser.GameObjects.Components.FX#addTiltShift + * @since 3.60.0 * - * @return {Phaser.Animations.Animation} The Animation instance that was removed from this Sprite, if the key was valid. + * @param {number} [radius=0.5] - The radius of the bokeh effect. + * @param {number} [amount=1] - The amount of the bokeh effect. + * @param {number} [contrast=0.2] - The color contrast of the bokeh effect. + * @param {number} [blurX=1] - The amount of horizontal blur. + * @param {number} [blurY=1] - The amount of vertical blur. + * @param {number} [strength=1] - The strength of the blur. + * + * @return {Phaser.FX.Bokeh} The Bokeh TiltShift FX Controller. */ - remove: function (key) + addTiltShift: function (radius, amount, contrast, blurX, blurY, strength) { - var anim = this.get(key); - - if (anim) - { - if (this.currentAnim === anim) - { - this.stop(); - } - - this.anims.delete(key); - } - - return anim; + return this.add(new Effects.Bokeh(this.gameObject, radius, amount, contrast, true, blurX, blurY, strength)); }, /** - * Destroy this Animation component. + * Destroys this FX Component. * - * Unregisters event listeners and cleans up its references. + * Called automatically when Game Objects are destroyed. * - * @method Phaser.Animations.AnimationState#destroy - * @since 3.0.0 + * @method Phaser.GameObjects.Components.FX#destroy + * @since 3.60.0 */ destroy: function () { - this.animationManager.off(Events.REMOVE_ANIMATION, this.globalRemove, this); - - if (this.anims) - { - this.anims.clear(); - } - - this.animationManager = null; - this.parent = null; - this.nextAnim = null; - this.nextAnimsQueue.length = 0; - - this.currentAnim = null; - this.currentFrame = null; - }, - - /** - * `true` if the current animation is paused, otherwise `false`. - * - * @name Phaser.Animations.AnimationState#isPaused - * @readonly - * @type {boolean} - * @since 3.4.0 - */ - isPaused: { - - get: function () - { - return this._paused; - } + this.clear(); + this.gameObject = null; } }); -module.exports = AnimationState; +module.exports = FX; /***/ }), -/* 165 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 92972: +/***/ ((module) => { /** -* The `Matter.Sleeping` module contains methods to manage the sleeping state of bodies. -* -* @class Sleeping -*/ + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -var Sleeping = {}; +/** + * Provides methods used for visually flipping a Game Object. + * Should be applied as a mixin and not used directly. + * + * @namespace Phaser.GameObjects.Components.Flip + * @since 3.0.0 + */ -module.exports = Sleeping; - -var Events = __webpack_require__(166); - -(function() { - - Sleeping._motionWakeThreshold = 0.18; - Sleeping._motionSleepThreshold = 0.08; - Sleeping._minBias = 0.9; +var Flip = { /** - * Puts bodies to sleep or wakes them up depending on their motion. - * @method update - * @param {body[]} bodies - * @param {number} timeScale + * The horizontally flipped state of the Game Object. + * + * A Game Object that is flipped horizontally will render inversed on the horizontal axis. + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. + * + * @name Phaser.GameObjects.Components.Flip#flipX + * @type {boolean} + * @default false + * @since 3.0.0 */ - Sleeping.update = function(bodies, timeScale) { - var timeFactor = timeScale * timeScale * timeScale; - - // update bodies sleeping status - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - motion = body.speed * body.speed + body.angularSpeed * body.angularSpeed; - - // wake up bodies if they have a force applied - if (body.force.x !== 0 || body.force.y !== 0) { - Sleeping.set(body, false); - continue; - } - - var minMotion = Math.min(body.motion, motion), - maxMotion = Math.max(body.motion, motion); - - // biased average motion estimation between frames - body.motion = Sleeping._minBias * minMotion + (1 - Sleeping._minBias) * maxMotion; - - if (body.sleepThreshold > 0 && body.motion < Sleeping._motionSleepThreshold * timeFactor) { - body.sleepCounter += 1; - - if (body.sleepCounter >= body.sleepThreshold) - Sleeping.set(body, true); - } else if (body.sleepCounter > 0) { - body.sleepCounter -= 1; - } - } - }; + flipX: false, /** - * Given a set of colliding pairs, wakes the sleeping bodies involved. - * @method afterCollisions - * @param {pair[]} pairs - * @param {number} timeScale + * The vertically flipped state of the Game Object. + * + * A Game Object that is flipped vertically will render inversed on the vertical axis (i.e. upside down) + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. + * + * @name Phaser.GameObjects.Components.Flip#flipY + * @type {boolean} + * @default false + * @since 3.0.0 */ - Sleeping.afterCollisions = function(pairs, timeScale) { - var timeFactor = timeScale * timeScale * timeScale; - - // wake up bodies involved in collisions - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i]; - - // don't wake inactive pairs - if (!pair.isActive) - continue; - - var collision = pair.collision, - bodyA = collision.bodyA.parent, - bodyB = collision.bodyB.parent; - - // don't wake if at least one body is static - if ((bodyA.isSleeping && bodyB.isSleeping) || bodyA.isStatic || bodyB.isStatic) - continue; - - if (bodyA.isSleeping || bodyB.isSleeping) { - var sleepingBody = (bodyA.isSleeping && !bodyA.isStatic) ? bodyA : bodyB, - movingBody = sleepingBody === bodyA ? bodyB : bodyA; + flipY: false, - if (!sleepingBody.isStatic && movingBody.motion > Sleeping._motionWakeThreshold * timeFactor) { - Sleeping.set(sleepingBody, false); - } - } - } - }; - /** - * Set a body as sleeping or awake. - * @method set - * @param {body} body - * @param {boolean} isSleeping + * Toggles the horizontal flipped state of this Game Object. + * + * A Game Object that is flipped horizontally will render inversed on the horizontal axis. + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. + * + * @method Phaser.GameObjects.Components.Flip#toggleFlipX + * @since 3.0.0 + * + * @return {this} This Game Object instance. */ - Sleeping.set = function(body, isSleeping) { - var wasSleeping = body.isSleeping; - - if (isSleeping) { - body.isSleeping = true; - body.sleepCounter = body.sleepThreshold; - - body.positionImpulse.x = 0; - body.positionImpulse.y = 0; - - body.positionPrev.x = body.position.x; - body.positionPrev.y = body.position.y; - - body.anglePrev = body.angle; - body.speed = 0; - body.angularSpeed = 0; - body.motion = 0; - - if (!wasSleeping) { - Events.trigger(body, 'sleepStart'); - } - } else { - body.isSleeping = false; - body.sleepCounter = 0; - - if (wasSleeping) { - Events.trigger(body, 'sleepEnd'); - } - } - }; - -})(); - - -/***/ }), -/* 166 */ -/***/ (function(module, exports, __webpack_require__) { - -/** -* The `Matter.Events` module contains methods to fire and listen to events on other objects. -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class Events -*/ - -var Events = {}; - -module.exports = Events; - -var Common = __webpack_require__(32); + toggleFlipX: function () + { + this.flipX = !this.flipX; -(function() { + return this; + }, /** - * Subscribes a callback function to the given object's `eventName`. - * @method on - * @param {} object - * @param {string} eventNames - * @param {function} callback + * Toggles the vertical flipped state of this Game Object. + * + * @method Phaser.GameObjects.Components.Flip#toggleFlipY + * @since 3.0.0 + * + * @return {this} This Game Object instance. */ - Events.on = function(object, eventNames, callback) { - var names = eventNames.split(' '), - name; - - for (var i = 0; i < names.length; i++) { - name = names[i]; - object.events = object.events || {}; - object.events[name] = object.events[name] || []; - object.events[name].push(callback); - } + toggleFlipY: function () + { + this.flipY = !this.flipY; - return callback; - }; + return this; + }, /** - * Removes the given event callback. If no callback, clears all callbacks in `eventNames`. If no `eventNames`, clears all events. - * @method off - * @param {} object - * @param {string} eventNames - * @param {function} callback + * Sets the horizontal flipped state of this Game Object. + * + * A Game Object that is flipped horizontally will render inversed on the horizontal axis. + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. + * + * @method Phaser.GameObjects.Components.Flip#setFlipX + * @since 3.0.0 + * + * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. + * + * @return {this} This Game Object instance. */ - Events.off = function(object, eventNames, callback) { - if (!eventNames) { - object.events = {}; - return; - } - - // handle Events.off(object, callback) - if (typeof eventNames === 'function') { - callback = eventNames; - eventNames = Common.keys(object.events).join(' '); - } - - var names = eventNames.split(' '); + setFlipX: function (value) + { + this.flipX = value; - for (var i = 0; i < names.length; i++) { - var callbacks = object.events[names[i]], - newCallbacks = []; + return this; + }, - if (callback && callbacks) { - for (var j = 0; j < callbacks.length; j++) { - if (callbacks[j] !== callback) - newCallbacks.push(callbacks[j]); - } - } + /** + * Sets the vertical flipped state of this Game Object. + * + * @method Phaser.GameObjects.Components.Flip#setFlipY + * @since 3.0.0 + * + * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. + * + * @return {this} This Game Object instance. + */ + setFlipY: function (value) + { + this.flipY = value; - object.events[names[i]] = newCallbacks; - } - }; + return this; + }, /** - * Fires all the callbacks subscribed to the given object's `eventName`, in the order they subscribed, if any. - * @method trigger - * @param {} object - * @param {string} eventNames - * @param {} event + * Sets the horizontal and vertical flipped state of this Game Object. + * + * A Game Object that is flipped will render inversed on the flipped axis. + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. + * + * @method Phaser.GameObjects.Components.Flip#setFlip + * @since 3.0.0 + * + * @param {boolean} x - The horizontal flipped state. `false` for no flip, or `true` to be flipped. + * @param {boolean} y - The horizontal flipped state. `false` for no flip, or `true` to be flipped. + * + * @return {this} This Game Object instance. */ - Events.trigger = function(object, eventNames, event) { - var names, - name, - callbacks, - eventClone; - - var events = object.events; - - if (events && Common.keys(events).length > 0) { - if (!event) - event = {}; + setFlip: function (x, y) + { + this.flipX = x; + this.flipY = y; - names = eventNames.split(' '); + return this; + }, - for (var i = 0; i < names.length; i++) { - name = names[i]; - callbacks = events[name]; + /** + * Resets the horizontal and vertical flipped state of this Game Object back to their default un-flipped state. + * + * @method Phaser.GameObjects.Components.Flip#resetFlip + * @since 3.0.0 + * + * @return {this} This Game Object instance. + */ + resetFlip: function () + { + this.flipX = false; + this.flipY = false; - if (callbacks) { - eventClone = Common.clone(event, false); - eventClone.name = name; - eventClone.source = object; + return this; + } - for (var j = 0; j < callbacks.length; j++) { - callbacks[j].apply(object, [eventClone]); - } - } - } - } - }; +}; -})(); +module.exports = Flip; /***/ }), -/* 167 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 80693: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DeepCopy = __webpack_require__(175); -var PIPELINE_CONST = __webpack_require__(92); -var SpliceOne = __webpack_require__(74); +var Rectangle = __webpack_require__(74118); +var RotateAround = __webpack_require__(2386); +var Vector2 = __webpack_require__(93736); /** - * Provides methods used for setting the WebGL rendering pipeline of a Game Object. + * Provides methods used for obtaining the bounds of a Game Object. + * Should be applied as a mixin and not used directly. * - * @namespace Phaser.GameObjects.Components.Pipeline - * @webglOnly + * @namespace Phaser.GameObjects.Components.GetBounds * @since 3.0.0 */ -var Pipeline = { +var GetBounds = { /** - * The initial WebGL pipeline of this Game Object. + * Processes the bounds output vector before returning it. * - * If you call `resetPipeline` on this Game Object, the pipeline is reset to this default. + * @method Phaser.GameObjects.Components.GetBounds#prepareBoundsOutput + * @private + * @since 3.18.0 * - * @name Phaser.GameObjects.Components.Pipeline#defaultPipeline - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @default null - * @webglOnly - * @since 3.0.0 - */ - defaultPipeline: null, - - /** - * The current WebGL pipeline of this Game Object. + * @generic {Phaser.Types.Math.Vector2Like} O - [output,$return] * - * @name Phaser.GameObjects.Components.Pipeline#pipeline - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @default null - * @webglOnly - * @since 3.0.0 - */ - pipeline: null, - - /** - * Does this Game Object have any Post Pipelines set? + * @param {Phaser.Types.Math.Vector2Like} output - An object to store the values in. If not provided a new Vector2 will be created. + * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? * - * @name Phaser.GameObjects.Components.Pipeline#hasPostPipeline - * @type {boolean} - * @webglOnly - * @since 3.50.0 + * @return {Phaser.Types.Math.Vector2Like} The values stored in the output object. */ - hasPostPipeline: false, + prepareBoundsOutput: function (output, includeParent) + { + if (includeParent === undefined) { includeParent = false; } + + if (this.rotation !== 0) + { + RotateAround(output, this.x, this.y, this.rotation); + } + + if (includeParent && this.parentContainer) + { + var parentMatrix = this.parentContainer.getBoundsTransformMatrix(); + + parentMatrix.transformPoint(output.x, output.y, output); + } + + return output; + }, /** - * The WebGL Post FX Pipelines this Game Object uses for post-render effects. + * Gets the center coordinate of this Game Object, regardless of origin. * - * The pipelines are processed in the order in which they appear in this array. + * The returned point is calculated in local space and does not factor in any parent Containers, + * unless the `includeParent` argument is set to `true`. * - * If you modify this array directly, be sure to set the - * `hasPostPipeline` property accordingly. + * @method Phaser.GameObjects.Components.GetBounds#getCenter + * @since 3.0.0 * - * @name Phaser.GameObjects.Components.Pipeline#postPipelines - * @type {Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[]} - * @webglOnly - * @since 3.50.0 - */ - postPipelines: null, - - /** - * An object to store pipeline specific data in, to be read by the pipelines this Game Object uses. + * @generic {Phaser.Types.Math.Vector2Like} O - [output,$return] * - * @name Phaser.GameObjects.Components.Pipeline#pipelineData - * @type {object} - * @webglOnly - * @since 3.50.0 + * @param {Phaser.Types.Math.Vector2Like} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? + * + * @return {Phaser.Types.Math.Vector2Like} The values stored in the output object. */ - pipelineData: null, + getCenter: function (output, includeParent) + { + if (output === undefined) { output = new Vector2(); } + + output.x = this.x - (this.displayWidth * this.originX) + (this.displayWidth / 2); + output.y = this.y - (this.displayHeight * this.originY) + (this.displayHeight / 2); + + return this.prepareBoundsOutput(output, includeParent); + }, /** - * Sets the initial WebGL Pipeline of this Game Object. + * Gets the top-left corner coordinate of this Game Object, regardless of origin. * - * This should only be called during the instantiation of the Game Object. After that, use `setPipeline`. + * The returned point is calculated in local space and does not factor in any parent Containers, + * unless the `includeParent` argument is set to `true`. * - * @method Phaser.GameObjects.Components.Pipeline#initPipeline - * @webglOnly + * @method Phaser.GameObjects.Components.GetBounds#getTopLeft * @since 3.0.0 * - * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline, or a pipeline instance to set. + * @generic {Phaser.Types.Math.Vector2Like} O - [output,$return] * - * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. + * @param {Phaser.Types.Math.Vector2Like} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? + * + * @return {Phaser.Types.Math.Vector2Like} The values stored in the output object. */ - initPipeline: function (pipeline) + getTopLeft: function (output, includeParent) { - if (pipeline === undefined) { pipeline = PIPELINE_CONST.MULTI_PIPELINE; } - - var renderer = this.scene.sys.renderer; - - if (!renderer) - { - return false; - } - - var pipelines = renderer.pipelines; - - this.postPipelines = []; - this.pipelineData = {}; - - if (pipelines) - { - var instance = pipelines.get(pipeline); - - if (instance) - { - this.defaultPipeline = instance; - this.pipeline = instance; + if (!output) { output = new Vector2(); } - return true; - } - } + output.x = this.x - (this.displayWidth * this.originX); + output.y = this.y - (this.displayHeight * this.originY); - return false; + return this.prepareBoundsOutput(output, includeParent); }, /** - * Sets the main WebGL Pipeline of this Game Object. + * Gets the top-center coordinate of this Game Object, regardless of origin. * - * Also sets the `pipelineData` property, if the parameter is given. + * The returned point is calculated in local space and does not factor in any parent Containers, + * unless the `includeParent` argument is set to `true`. * - * Both the pipeline and post pipelines share the same pipeline data object. + * @method Phaser.GameObjects.Components.GetBounds#getTopCenter + * @since 3.18.0 * - * @method Phaser.GameObjects.Components.Pipeline#setPipeline - * @webglOnly - * @since 3.0.0 + * @generic {Phaser.Types.Math.Vector2Like} O - [output,$return] * - * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline, or a pipeline instance to set. - * @param {object} [pipelineData] - Optional pipeline data object that is _deep copied_ into the `pipelineData` property of this Game Object. - * @param {boolean} [copyData=true] - Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. + * @param {Phaser.Types.Math.Vector2Like} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? * - * @return {this} This Game Object instance. + * @return {Phaser.Types.Math.Vector2Like} The values stored in the output object. */ - setPipeline: function (pipeline, pipelineData, copyData) + getTopCenter: function (output, includeParent) { - var renderer = this.scene.sys.renderer; - - if (!renderer) - { - return this; - } - - var pipelines = renderer.pipelines; - - if (pipelines) - { - var instance = pipelines.get(pipeline); - - if (instance) - { - this.pipeline = instance; - } + if (!output) { output = new Vector2(); } - if (pipelineData) - { - this.pipelineData = (copyData) ? DeepCopy(pipelineData) : pipelineData; - } - } + output.x = (this.x - (this.displayWidth * this.originX)) + (this.displayWidth / 2); + output.y = this.y - (this.displayHeight * this.originY); - return this; + return this.prepareBoundsOutput(output, includeParent); }, /** - * Sets one, or more, Post Pipelines on this Game Object. - * - * Post Pipelines are invoked after this Game Object has rendered to its target and - * are commonly used for post-fx. - * - * The post pipelines are appended to the `postPipelines` array belonging to this - * Game Object. When the renderer processes this Game Object, it iterates through the post - * pipelines in the order in which they appear in the array. If you are stacking together - * multiple effects, be aware that the order is important. - * - * If you call this method multiple times, the new pipelines will be appended to any existing - * post pipelines already set. Use the `resetPostPipeline` method to clear them first, if required. + * Gets the top-right corner coordinate of this Game Object, regardless of origin. * - * You can optionally also sets the `pipelineData` property, if the parameter is given. + * The returned point is calculated in local space and does not factor in any parent Containers, + * unless the `includeParent` argument is set to `true`. * - * Both the pipeline and post pipelines share the pipeline data object together. + * @method Phaser.GameObjects.Components.GetBounds#getTopRight + * @since 3.0.0 * - * @method Phaser.GameObjects.Components.Pipeline#setPostPipeline - * @webglOnly - * @since 3.50.0 + * @generic {Phaser.Types.Math.Vector2Like} O - [output,$return] * - * @param {(string|string[]|function|function[]|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[])} pipelines - Either the string-based name of the pipeline, or a pipeline instance, or class, or an array of them. - * @param {object} [pipelineData] - Optional pipeline data object that is _deep copied_ into the `pipelineData` property of this Game Object. - * @param {boolean} [copyData=true] - Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. + * @param {Phaser.Types.Math.Vector2Like} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? * - * @return {this} This Game Object instance. + * @return {Phaser.Types.Math.Vector2Like} The values stored in the output object. */ - setPostPipeline: function (pipelines, pipelineData, copyData) + getTopRight: function (output, includeParent) { - var renderer = this.scene.sys.renderer; - - if (!renderer) - { - return this; - } - - var pipelineManager = renderer.pipelines; - - if (pipelineManager) - { - if (!Array.isArray(pipelines)) - { - pipelines = [ pipelines ]; - } - - for (var i = 0; i < pipelines.length; i++) - { - var instance = pipelineManager.getPostPipeline(pipelines[i], this); - - if (instance) - { - this.postPipelines.push(instance); - } - } - - if (pipelineData) - { - this.pipelineData = (copyData) ? DeepCopy(pipelineData) : pipelineData; - } - } + if (!output) { output = new Vector2(); } - this.hasPostPipeline = (this.postPipelines.length > 0); + output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; + output.y = this.y - (this.displayHeight * this.originY); - return this; + return this.prepareBoundsOutput(output, includeParent); }, /** - * Adds an entry to the `pipelineData` object belonging to this Game Object. - * - * If the 'key' already exists, its value is updated. If it doesn't exist, it is created. + * Gets the left-center coordinate of this Game Object, regardless of origin. * - * If `value` is undefined, and `key` exists, `key` is removed from the data object. + * The returned point is calculated in local space and does not factor in any parent Containers, + * unless the `includeParent` argument is set to `true`. * - * Both the pipeline and post pipelines share the pipeline data object together. + * @method Phaser.GameObjects.Components.GetBounds#getLeftCenter + * @since 3.18.0 * - * @method Phaser.GameObjects.Components.Pipeline#setPipelineData - * @webglOnly - * @since 3.50.0 + * @generic {Phaser.Types.Math.Vector2Like} O - [output,$return] * - * @param {string} key - The key of the pipeline data to set, update, or delete. - * @param {any} [value] - The value to be set with the key. If `undefined` then `key` will be deleted from the object. + * @param {Phaser.Types.Math.Vector2Like} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? * - * @return {this} This Game Object instance. + * @return {Phaser.Types.Math.Vector2Like} The values stored in the output object. */ - setPipelineData: function (key, value) + getLeftCenter: function (output, includeParent) { - var data = this.pipelineData; + if (!output) { output = new Vector2(); } - if (value === undefined) - { - delete data[key]; - } - else - { - data[key] = value; - } + output.x = this.x - (this.displayWidth * this.originX); + output.y = (this.y - (this.displayHeight * this.originY)) + (this.displayHeight / 2); - return this; + return this.prepareBoundsOutput(output, includeParent); }, /** - * Gets a Post Pipeline instance from this Game Object, based on the given name, and returns it. + * Gets the right-center coordinate of this Game Object, regardless of origin. * - * @method Phaser.GameObjects.Components.Pipeline#getPostPipeline - * @webglOnly - * @since 3.50.0 + * The returned point is calculated in local space and does not factor in any parent Containers, + * unless the `includeParent` argument is set to `true`. * - * @param {(string|function|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline)} pipeline - The string-based name of the pipeline, or a pipeline class. + * @method Phaser.GameObjects.Components.GetBounds#getRightCenter + * @since 3.18.0 * - * @return {(Phaser.Renderer.WebGL.Pipelines.PostFXPipeline|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[])} The Post Pipeline/s matching the name, or undefined if no match. If more than one match they are returned in an array. + * @generic {Phaser.Types.Math.Vector2Like} O - [output,$return] + * + * @param {Phaser.Types.Math.Vector2Like} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? + * + * @return {Phaser.Types.Math.Vector2Like} The values stored in the output object. */ - getPostPipeline: function (pipeline) + getRightCenter: function (output, includeParent) { - var pipelines = this.postPipelines; - - var results = []; - - for (var i = 0; i < pipelines.length; i++) - { - var instance = pipelines[i]; + if (!output) { output = new Vector2(); } - if ((typeof pipeline === 'string' && instance.name === pipeline) || instance instanceof pipeline) - { - results.push(instance); - } - } + output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; + output.y = (this.y - (this.displayHeight * this.originY)) + (this.displayHeight / 2); - return (results.length === 1) ? results[0] : results; + return this.prepareBoundsOutput(output, includeParent); }, /** - * Resets the WebGL Pipeline of this Game Object back to the default it was created with. + * Gets the bottom-left corner coordinate of this Game Object, regardless of origin. * - * @method Phaser.GameObjects.Components.Pipeline#resetPipeline - * @webglOnly + * The returned point is calculated in local space and does not factor in any parent Containers, + * unless the `includeParent` argument is set to `true`. + * + * @method Phaser.GameObjects.Components.GetBounds#getBottomLeft * @since 3.0.0 * - * @param {boolean} [resetPostPipelines=false] - Reset all of the post pipelines? - * @param {boolean} [resetData=false] - Reset the `pipelineData` object to being an empty object? + * @generic {Phaser.Types.Math.Vector2Like} O - [output,$return] * - * @return {boolean} `true` if the pipeline was reset successfully, otherwise `false`. + * @param {Phaser.Types.Math.Vector2Like} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? + * + * @return {Phaser.Types.Math.Vector2Like} The values stored in the output object. */ - resetPipeline: function (resetPostPipelines, resetData) + getBottomLeft: function (output, includeParent) { - if (resetPostPipelines === undefined) { resetPostPipelines = false; } - if (resetData === undefined) { resetData = false; } - - this.pipeline = this.defaultPipeline; - - if (resetPostPipelines) - { - this.postPipelines = []; - this.hasPostPipeline = false; - } + if (!output) { output = new Vector2(); } - if (resetData) - { - this.pipelineData = {}; - } + output.x = this.x - (this.displayWidth * this.originX); + output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; - return (this.pipeline !== null); + return this.prepareBoundsOutput(output, includeParent); }, /** - * Resets the WebGL Post Pipelines of this Game Object. It does this by calling - * the `destroy` method on each post pipeline and then clearing the local array. + * Gets the bottom-center coordinate of this Game Object, regardless of origin. * - * @method Phaser.GameObjects.Components.Pipeline#resetPostPipeline - * @webglOnly - * @since 3.50.0 + * The returned point is calculated in local space and does not factor in any parent Containers, + * unless the `includeParent` argument is set to `true`. * - * @param {boolean} [resetData=false] - Reset the `pipelineData` object to being an empty object? + * @method Phaser.GameObjects.Components.GetBounds#getBottomCenter + * @since 3.18.0 + * + * @generic {Phaser.Types.Math.Vector2Like} O - [output,$return] + * + * @param {Phaser.Types.Math.Vector2Like} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? + * + * @return {Phaser.Types.Math.Vector2Like} The values stored in the output object. */ - resetPostPipeline: function (resetData) + getBottomCenter: function (output, includeParent) { - if (resetData === undefined) { resetData = false; } - - var pipelines = this.postPipelines; - - for (var i = 0; i < pipelines.length; i++) - { - pipelines[i].destroy(); - } + if (!output) { output = new Vector2(); } - this.postPipelines = []; - this.hasPostPipeline = false; + output.x = (this.x - (this.displayWidth * this.originX)) + (this.displayWidth / 2); + output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; - if (resetData) - { - this.pipelineData = {}; - } + return this.prepareBoundsOutput(output, includeParent); }, /** - * Removes a type of Post Pipeline instances from this Game Object, based on the given name, and destroys them. + * Gets the bottom-right corner coordinate of this Game Object, regardless of origin. * - * If you wish to remove all Post Pipelines use the `resetPostPipeline` method instead. + * The returned point is calculated in local space and does not factor in any parent Containers, + * unless the `includeParent` argument is set to `true`. * - * @method Phaser.GameObjects.Components.Pipeline#removePostPipeline - * @webglOnly - * @since 3.50.0 + * @method Phaser.GameObjects.Components.GetBounds#getBottomRight + * @since 3.0.0 * - * @param {string|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline} pipeline - The string-based name of the pipeline, or a pipeline class. + * @generic {Phaser.Types.Math.Vector2Like} O - [output,$return] * - * @return {this} This Game Object. + * @param {Phaser.Types.Math.Vector2Like} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? + * + * @return {Phaser.Types.Math.Vector2Like} The values stored in the output object. */ - removePostPipeline: function (pipeline) + getBottomRight: function (output, includeParent) { - var pipelines = this.postPipelines; - - for (var i = pipelines.length - 1; i >= 0; i--) - { - var instance = pipelines[i]; - - if ( - (typeof pipeline === 'string' && instance.name === pipeline) || - (typeof pipeline !== 'string' && instance instanceof pipeline)) - { - instance.destroy(); - - SpliceOne(pipelines, i); - } - } + if (!output) { output = new Vector2(); } - this.hasPostPipeline = (this.postPipelines.length > 0); + output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; + output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; - return this; + return this.prepareBoundsOutput(output, includeParent); }, /** - * Gets the name of the WebGL Pipeline this Game Object is currently using. + * Gets the bounds of this Game Object, regardless of origin. * - * @method Phaser.GameObjects.Components.Pipeline#getPipelineName - * @webglOnly + * The values are stored and returned in a Rectangle, or Rectangle-like, object. + * + * @method Phaser.GameObjects.Components.GetBounds#getBounds * @since 3.0.0 * - * @return {string} The string-based name of the pipeline being used by this Game Object. + * @generic {Phaser.Geom.Rectangle} O - [output,$return] + * + * @param {(Phaser.Geom.Rectangle|object)} [output] - An object to store the values in. If not provided a new Rectangle will be created. + * + * @return {(Phaser.Geom.Rectangle|object)} The values stored in the output object. */ - getPipelineName: function () + getBounds: function (output) { - return this.pipeline.name; - } + if (output === undefined) { output = new Rectangle(); } -}; + // We can use the output object to temporarily store the x/y coords in: -module.exports = Pipeline; + var TLx, TLy, TRx, TRy, BLx, BLy, BRx, BRy; + // Instead of doing a check if parent container is + // defined per corner we only do it once. + if (this.parentContainer) + { + var parentMatrix = this.parentContainer.getBoundsTransformMatrix(); -/***/ }), -/* 168 */ -/***/ (function(module, exports) { + this.getTopLeft(output); + parentMatrix.transformPoint(output.x, output.y, output); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + TLx = output.x; + TLy = output.y; -/** - * Phaser Scale Modes. - * - * @namespace Phaser.ScaleModes - * @since 3.0.0 - */ + this.getTopRight(output); + parentMatrix.transformPoint(output.x, output.y, output); -var ScaleModes = { + TRx = output.x; + TRy = output.y; - /** - * Default Scale Mode (Linear). - * - * @name Phaser.ScaleModes.DEFAULT - * @type {number} - * @readonly - * @since 3.0.0 - */ - DEFAULT: 0, + this.getBottomLeft(output); + parentMatrix.transformPoint(output.x, output.y, output); - /** - * Linear Scale Mode. - * - * @name Phaser.ScaleModes.LINEAR - * @type {number} - * @readonly - * @since 3.0.0 - */ - LINEAR: 0, + BLx = output.x; + BLy = output.y; - /** - * Nearest Scale Mode. - * - * @name Phaser.ScaleModes.NEAREST - * @type {number} - * @readonly - * @since 3.0.0 - */ - NEAREST: 1 + this.getBottomRight(output); + parentMatrix.transformPoint(output.x, output.y, output); -}; + BRx = output.x; + BRy = output.y; + } + else + { + this.getTopLeft(output); -module.exports = ScaleModes; + TLx = output.x; + TLy = output.y; + this.getTopRight(output); -/***/ }), -/* 169 */ -/***/ (function(module, exports, __webpack_require__) { + TRx = output.x; + TRy = output.y; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.getBottomLeft(output); -var Point = __webpack_require__(4); + BLx = output.x; + BLy = output.y; -/** - * Returns a Point object containing the coordinates of a point on the circumference of the Circle based on the given angle. - * - * @function Phaser.Geom.Circle.CircumferencePoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on. - * @param {number} angle - The angle from the center of the Circle to the circumference to return the point from. Given in radians. - * @param {(Phaser.Geom.Point|object)} [out] - A Point, or point-like object, to store the results in. If not given a Point will be created. - * - * @return {(Phaser.Geom.Point|object)} A Point object where the `x` and `y` properties are the point on the circumference. - */ -var CircumferencePoint = function (circle, angle, out) -{ - if (out === undefined) { out = new Point(); } + this.getBottomRight(output); - out.x = circle.x + (circle.radius * Math.cos(angle)); - out.y = circle.y + (circle.radius * Math.sin(angle)); + BRx = output.x; + BRy = output.y; + } + + output.x = Math.min(TLx, TRx, BLx, BRx); + output.y = Math.min(TLy, TRy, BLy, BRy); + output.width = Math.max(TLx, TRx, BLx, BRx) - output.x; + output.height = Math.max(TLy, TRy, BLy, BRy) - output.y; + + return output; + } - return out; }; -module.exports = CircumferencePoint; +module.exports = GetBounds; /***/ }), -/* 170 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 39171: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Point = __webpack_require__(4); +var BitmapMask = __webpack_require__(76756); +var GeometryMask = __webpack_require__(63037); /** - * Returns a uniformly distributed random point from anywhere within the given Circle. + * Provides methods used for getting and setting the mask of a Game Object. * - * @function Phaser.Geom.Circle.Random + * @namespace Phaser.GameObjects.Components.Mask * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Circle} circle - The Circle to get a random point from. - * @param {(Phaser.Geom.Point|object)} [out] - A Point or point-like object to set the random `x` and `y` values in. - * - * @return {(Phaser.Geom.Point|object)} A Point object with the random values set in the `x` and `y` properties. */ -var Random = function (circle, out) -{ - if (out === undefined) { out = new Point(); } - var t = 2 * Math.PI * Math.random(); - var u = Math.random() + Math.random(); - var r = (u > 1) ? 2 - u : u; - var x = r * Math.cos(t); - var y = r * Math.sin(t); - - out.x = circle.x + (x * circle.radius); - out.y = circle.y + (y * circle.radius); +var Mask = { - return out; -}; + /** + * The Mask this Game Object is using during render. + * + * @name Phaser.GameObjects.Components.Mask#mask + * @type {Phaser.Display.Masks.BitmapMask|Phaser.Display.Masks.GeometryMask} + * @since 3.0.0 + */ + mask: null, -module.exports = Random; + /** + * Sets the mask that this Game Object will use to render with. + * + * The mask must have been previously created and can be either a GeometryMask or a BitmapMask. + * Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. + * + * If a mask is already set on this Game Object it will be immediately replaced. + * + * Masks are positioned in global space and are not relative to the Game Object to which they + * are applied. The reason for this is that multiple Game Objects can all share the same mask. + * + * Masks have no impact on physics or input detection. They are purely a rendering component + * that allows you to limit what is visible during the render pass. + * + * @method Phaser.GameObjects.Components.Mask#setMask + * @since 3.6.2 + * + * @param {Phaser.Display.Masks.BitmapMask|Phaser.Display.Masks.GeometryMask} mask - The mask this Game Object will use when rendering. + * + * @return {this} This Game Object instance. + */ + setMask: function (mask) + { + this.mask = mask; + return this; + }, -/***/ }), -/* 171 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Clears the mask that this Game Object was using. + * + * @method Phaser.GameObjects.Components.Mask#clearMask + * @since 3.6.2 + * + * @param {boolean} [destroyMask=false] - Destroy the mask before clearing it? + * + * @return {this} This Game Object instance. + */ + clearMask: function (destroyMask) + { + if (destroyMask === undefined) { destroyMask = false; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (destroyMask && this.mask) + { + this.mask.destroy(); + } -var Perimeter = __webpack_require__(130); -var Point = __webpack_require__(4); + this.mask = null; -/** - * Calculates the coordinates of a point at a certain `position` on the Rectangle's perimeter. - * - * The `position` is a fraction between 0 and 1 which defines how far into the perimeter the point is. - * - * A value of 0 or 1 returns the point at the top left corner of the rectangle, while a value of 0.5 returns the point at the bottom right corner of the rectangle. Values between 0 and 0.5 are on the top or the right side and values between 0.5 and 1 are on the bottom or the left side. - * - * @function Phaser.Geom.Rectangle.GetPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle to get the perimeter point from. - * @param {number} position - The normalized distance into the Rectangle's perimeter to return. - * @param {(Phaser.Geom.Point|object)} [out] - An object to update with the `x` and `y` coordinates of the point. - * - * @return {Phaser.Geom.Point} The updated `output` object, or a new Point if no `output` object was given. - */ -var GetPoint = function (rectangle, position, out) -{ - if (out === undefined) { out = new Point(); } + return this; + }, - if (position <= 0 || position >= 1) + /** + * Creates and returns a Bitmap Mask. This mask can be used by any Game Object, + * including this one, or a Dynamic Texture. + * + * Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. + * + * To create the mask you need to pass in a reference to a renderable Game Object. + * A renderable Game Object is one that uses a texture to render with, such as an + * Image, Sprite, Render Texture or BitmapText. + * + * If you do not provide a renderable object, and this Game Object has a texture, + * it will use itself as the object. This means you can call this method to create + * a Bitmap Mask from any renderable texture-based Game Object. + * + * @method Phaser.GameObjects.Components.Mask#createBitmapMask + * @since 3.6.2 + * + * @generic {Phaser.GameObjects.GameObject} G + * @generic {Phaser.Textures.DynamicTexture} T + * @genericUse {(G|T|null)} [maskObject] + * + * @param {(Phaser.GameObjects.GameObject|Phaser.Textures.DynamicTexture)} [maskObject] - The Game Object or Dynamic Texture that will be used as the mask. If `null` it will generate an Image Game Object using the rest of the arguments. + * @param {number} [x] - If creating a Game Object, the horizontal position in the world. + * @param {number} [y] - If creating a Game Object, the vertical position in the world. + * @param {(string|Phaser.Textures.Texture)} [texture] - If creating a Game Object, the key, or instance of the Texture it will use to render with, as stored in the Texture Manager. + * @param {(string|number|Phaser.Textures.Frame)} [frame] - If creating a Game Object, an optional frame from the Texture this Game Object is rendering with. + * + * @return {Phaser.Display.Masks.BitmapMask} This Bitmap Mask that was created. + */ + createBitmapMask: function (maskObject, x, y, texture, frame) { - out.x = rectangle.x; - out.y = rectangle.y; - - return out; - } + if (maskObject === undefined && (this.texture || this.shader || this.geom)) + { + // eslint-disable-next-line consistent-this + maskObject = this; + } - var p = Perimeter(rectangle) * position; + return new BitmapMask(this.scene, maskObject, x, y, texture, frame); + }, - if (position > 0.5) + /** + * Creates and returns a Geometry Mask. This mask can be used by any Game Object, + * including this one. + * + * To create the mask you need to pass in a reference to a Graphics Game Object. + * + * If you do not provide a graphics object, and this Game Object is an instance + * of a Graphics object, then it will use itself to create the mask. + * + * This means you can call this method to create a Geometry Mask from any Graphics Game Object. + * + * @method Phaser.GameObjects.Components.Mask#createGeometryMask + * @since 3.6.2 + * + * @generic {Phaser.GameObjects.Graphics} G + * @generic {Phaser.GameObjects.Shape} S + * @genericUse {(G|S)} [graphics] + * + * @param {Phaser.GameObjects.Graphics|Phaser.GameObjects.Shape} [graphics] - A Graphics Game Object, or any kind of Shape Game Object. The geometry within it will be used as the mask. + * + * @return {Phaser.Display.Masks.GeometryMask} This Geometry Mask that was created. + */ + createGeometryMask: function (graphics) { - p -= (rectangle.width + rectangle.height); - - if (p <= rectangle.width) - { - // Face 3 - out.x = rectangle.right - p; - out.y = rectangle.bottom; - } - else + if (graphics === undefined && (this.type === 'Graphics' || this.geom)) { - // Face 4 - out.x = rectangle.x; - out.y = rectangle.bottom - (p - rectangle.width); + // eslint-disable-next-line consistent-this + graphics = this; } - } - else if (p <= rectangle.width) - { - // Face 1 - out.x = rectangle.x + p; - out.y = rectangle.y; - } - else - { - // Face 2 - out.x = rectangle.right; - out.y = rectangle.y + (p - rectangle.width); + + return new GeometryMask(this.scene, graphics); } - return out; }; -module.exports = GetPoint; +module.exports = Mask; /***/ }), -/* 172 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 28072: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(67); -var Point = __webpack_require__(4); - /** - * Get a number of points along a line's length. - * - * Provide a `quantity` to get an exact number of points along the line. + * Provides methods used for getting and setting the origin of a Game Object. + * Values are normalized, given in the range 0 to 1. + * Display values contain the calculated pixel values. + * Should be applied as a mixin and not used directly. * - * Provide a `stepRate` to ensure a specific distance between each point on the line. Set `quantity` to `0` when - * providing a `stepRate`. - * - * @function Phaser.Geom.Line.GetPoints + * @namespace Phaser.GameObjects.Components.Origin * @since 3.0.0 - * - * @generic {Phaser.Geom.Point[]} O - [out,$return] - * - * @param {Phaser.Geom.Line} line - The line. - * @param {number} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead. - * @param {number} [stepRate] - The distance between each point on the line. When set, `quantity` is implied and should be set to `0`. - * @param {(array|Phaser.Geom.Point[])} [out] - An optional array of Points, or point-like objects, to store the coordinates of the points on the line. - * - * @return {(array|Phaser.Geom.Point[])} An array of Points, or point-like objects, containing the coordinates of the points on the line. */ -var GetPoints = function (line, quantity, stepRate, out) -{ - if (out === undefined) { out = []; } - // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!quantity && stepRate > 0) - { - quantity = Length(line) / stepRate; - } +var Origin = { - var x1 = line.x1; - var y1 = line.y1; + /** + * A property indicating that a Game Object has this component. + * + * @name Phaser.GameObjects.Components.Origin#_originComponent + * @type {boolean} + * @private + * @default true + * @since 3.2.0 + */ + _originComponent: true, - var x2 = line.x2; - var y2 = line.y2; + /** + * The horizontal origin of this Game Object. + * The origin maps the relationship between the size and position of the Game Object. + * The default value is 0.5, meaning all Game Objects are positioned based on their center. + * Setting the value to 0 means the position now relates to the left of the Game Object. + * Set this value with `setOrigin()`. + * + * @name Phaser.GameObjects.Components.Origin#originX + * @type {number} + * @readonly + * @default 0.5 + * @since 3.0.0 + */ + originX: 0.5, - for (var i = 0; i < quantity; i++) - { - var position = i / quantity; + /** + * The vertical origin of this Game Object. + * The origin maps the relationship between the size and position of the Game Object. + * The default value is 0.5, meaning all Game Objects are positioned based on their center. + * Setting the value to 0 means the position now relates to the top of the Game Object. + * Set this value with `setOrigin()`. + * + * @name Phaser.GameObjects.Components.Origin#originY + * @type {number} + * @readonly + * @default 0.5 + * @since 3.0.0 + */ + originY: 0.5, - var x = x1 + (x2 - x1) * position; - var y = y1 + (y2 - y1) * position; + // private + read only + _displayOriginX: 0, + _displayOriginY: 0, - out.push(new Point(x, y)); - } + /** + * The horizontal display origin of this Game Object. + * The origin is a normalized value between 0 and 1. + * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. + * + * @name Phaser.GameObjects.Components.Origin#displayOriginX + * @type {number} + * @since 3.0.0 + */ + displayOriginX: { - return out; -}; + get: function () + { + return this._displayOriginX; + }, -module.exports = GetPoints; + set: function (value) + { + this._displayOriginX = value; + this.originX = value / this.width; + } + }, -/***/ }), -/* 173 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The vertical display origin of this Game Object. + * The origin is a normalized value between 0 and 1. + * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. + * + * @name Phaser.GameObjects.Components.Origin#displayOriginY + * @type {number} + * @since 3.0.0 + */ + displayOriginY: { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + get: function () + { + return this._displayOriginY; + }, -var Point = __webpack_require__(4); + set: function (value) + { + this._displayOriginY = value; + this.originY = value / this.height; + } -/** - * Returns a random point on a given Line. - * - * @function Phaser.Geom.Line.Random - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Line} line - The Line to calculate the random Point on. - * @param {(Phaser.Geom.Point|object)} [out] - An instance of a Point to be modified. - * - * @return {(Phaser.Geom.Point|object)} A random Point on the Line. - */ -var Random = function (line, out) -{ - if (out === undefined) { out = new Point(); } + }, - var t = Math.random(); + /** + * Sets the origin of this Game Object. + * + * The values are given in the range 0 to 1. + * + * @method Phaser.GameObjects.Components.Origin#setOrigin + * @since 3.0.0 + * + * @param {number} [x=0.5] - The horizontal origin value. + * @param {number} [y=x] - The vertical origin value. If not defined it will be set to the value of `x`. + * + * @return {this} This Game Object instance. + */ + setOrigin: function (x, y) + { + if (x === undefined) { x = 0.5; } + if (y === undefined) { y = x; } - out.x = line.x1 + t * (line.x2 - line.x1); - out.y = line.y1 + t * (line.y2 - line.y1); + this.originX = x; + this.originY = y; - return out; -}; + return this.updateDisplayOrigin(); + }, -module.exports = Random; + /** + * Sets the origin of this Game Object based on the Pivot values in its Frame. + * + * @method Phaser.GameObjects.Components.Origin#setOriginFromFrame + * @since 3.0.0 + * + * @return {this} This Game Object instance. + */ + setOriginFromFrame: function () + { + if (!this.frame || !this.frame.customPivot) + { + return this.setOrigin(); + } + else + { + this.originX = this.frame.pivotX; + this.originY = this.frame.pivotY; + } + return this.updateDisplayOrigin(); + }, -/***/ }), -/* 174 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Sets the display origin of this Game Object. + * The difference between this and setting the origin is that you can use pixel values for setting the display origin. + * + * @method Phaser.GameObjects.Components.Origin#setDisplayOrigin + * @since 3.0.0 + * + * @param {number} [x=0] - The horizontal display origin value. + * @param {number} [y=x] - The vertical display origin value. If not defined it will be set to the value of `x`. + * + * @return {this} This Game Object instance. + */ + setDisplayOrigin: function (x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = x; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.displayOriginX = x; + this.displayOriginY = y; -var Point = __webpack_require__(4); + return this; + }, -/** - * Returns a random point within a Rectangle. - * - * @function Phaser.Geom.Rectangle.Random - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to return a point from. - * @param {Phaser.Geom.Point} out - The object to update with the point's coordinates. - * - * @return {Phaser.Geom.Point} The modified `out` object, or a new Point if none was provided. - */ -var Random = function (rect, out) -{ - if (out === undefined) { out = new Point(); } + /** + * Updates the Display Origin cached values internally stored on this Game Object. + * You don't usually call this directly, but it is exposed for edge-cases where you may. + * + * @method Phaser.GameObjects.Components.Origin#updateDisplayOrigin + * @since 3.0.0 + * + * @return {this} This Game Object instance. + */ + updateDisplayOrigin: function () + { + this._displayOriginX = this.originX * this.width; + this._displayOriginY = this.originY * this.height; - out.x = rect.x + (Math.random() * rect.width); - out.y = rect.y + (Math.random() * rect.height); + return this; + } - return out; }; -module.exports = Random; +module.exports = Origin; /***/ }), -/* 175 */ -/***/ (function(module, exports) { + +/***/ 54211: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var DegToRad = __webpack_require__(75606); +var GetBoolean = __webpack_require__(63130); +var GetValue = __webpack_require__(10850); +var TWEEN_CONST = __webpack_require__(55303); +var Vector2 = __webpack_require__(93736); + /** - * Deep Copy the given object or array. - * - * @function Phaser.Utils.Objects.DeepCopy - * @since 3.50.0 - * - * @param {object} obj - The object to deep copy. + * Provides methods used for managing a Game Object following a Path. + * Should be applied as a mixin and not used directly. * - * @return {object} A deep copy of the original object. + * @namespace Phaser.GameObjects.Components.PathFollower + * @since 3.17.0 */ -var DeepCopy = function (inObject) -{ - var outObject; - var value; - var key; - if (typeof inObject !== 'object' || inObject === null) - { - // inObject is not an object - return inObject; - } +var PathFollower = { - // Create an array or object to hold the values - outObject = Array.isArray(inObject) ? [] : {}; + /** + * The Path this PathFollower is following. It can only follow one Path at a time. + * + * @name Phaser.GameObjects.Components.PathFollower#path + * @type {Phaser.Curves.Path} + * @since 3.0.0 + */ + path: null, - for (key in inObject) - { - value = inObject[key]; + /** + * Should the PathFollower automatically rotate to point in the direction of the Path? + * + * @name Phaser.GameObjects.Components.PathFollower#rotateToPath + * @type {boolean} + * @default false + * @since 3.0.0 + */ + rotateToPath: false, - // Recursively (deep) copy for nested objects, including arrays - outObject[key] = DeepCopy(value); - } + /** + * If the PathFollower is rotating to match the Path (@see Phaser.GameObjects.PathFollower#rotateToPath) + * this value is added to the rotation value. This allows you to rotate objects to a path but control + * the angle of the rotation as well. + * + * @name Phaser.GameObjects.PathFollower#pathRotationOffset + * @type {number} + * @default 0 + * @since 3.0.0 + */ + pathRotationOffset: 0, - return outObject; -}; + /** + * An additional vector to add to the PathFollowers position, allowing you to offset it from the + * Path coordinates. + * + * @name Phaser.GameObjects.PathFollower#pathOffset + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + pathOffset: null, -module.exports = DeepCopy; + /** + * A Vector2 that stores the current point of the path the follower is on. + * + * @name Phaser.GameObjects.PathFollower#pathVector + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + pathVector: null, + /** + * The distance the follower has traveled from the previous point to the current one, at the last update. + * + * @name Phaser.GameObjects.PathFollower#pathDelta + * @type {Phaser.Math.Vector2} + * @since 3.23.0 + */ + pathDelta: null, -/***/ }), -/* 176 */ -/***/ (function(module, exports) { + /** + * The Tween used for following the Path. + * + * @name Phaser.GameObjects.PathFollower#pathTween + * @type {Phaser.Tweens.Tween} + * @since 3.0.0 + */ + pathTween: null, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Settings for the PathFollower. + * + * @name Phaser.GameObjects.PathFollower#pathConfig + * @type {?Phaser.Types.GameObjects.PathFollower.PathConfig} + * @default null + * @since 3.0.0 + */ + pathConfig: null, -/** - * Build a JSON representation of the given Game Object. - * - * This is typically extended further by Game Object specific implementations. - * - * @method Phaser.GameObjects.Components.ToJSON - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to export as JSON. - * - * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. - */ -var ToJSON = function (gameObject) -{ - var out = { - name: gameObject.name, - type: gameObject.type, - x: gameObject.x, - y: gameObject.y, - depth: gameObject.depth, - scale: { - x: gameObject.scaleX, - y: gameObject.scaleY - }, - origin: { - x: gameObject.originX, - y: gameObject.originY - }, - flipX: gameObject.flipX, - flipY: gameObject.flipY, - rotation: gameObject.rotation, - alpha: gameObject.alpha, - visible: gameObject.visible, - blendMode: gameObject.blendMode, - textureKey: '', - frameKey: '', - data: {} - }; + /** + * Records the direction of the follower so it can change direction. + * + * @name Phaser.GameObjects.PathFollower#_prevDirection + * @type {number} + * @private + * @since 3.0.0 + */ + _prevDirection: TWEEN_CONST.PLAYING_FORWARD, - if (gameObject.texture) + /** + * Set the Path that this PathFollower should follow. + * + * Optionally accepts {@link Phaser.Types.GameObjects.PathFollower.PathConfig} settings. + * + * @method Phaser.GameObjects.Components.PathFollower#setPath + * @since 3.0.0 + * + * @param {Phaser.Curves.Path} path - The Path this PathFollower is following. It can only follow one Path at a time. + * @param {(number|Phaser.Types.GameObjects.PathFollower.PathConfig|Phaser.Types.Tweens.NumberTweenBuilderConfig)} [config] - Settings for the PathFollower. + * + * @return {this} This Game Object. + */ + setPath: function (path, config) { - out.textureKey = gameObject.texture.key; - out.frameKey = gameObject.frame.name; - } - - return out; -}; - -module.exports = ToJSON; - + if (config === undefined) { config = this.pathConfig; } -/***/ }), -/* 177 */ -/***/ (function(module, exports, __webpack_require__) { + var tween = this.pathTween; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (tween && tween.isPlaying()) + { + tween.stop(); + } -var Vector2 = __webpack_require__(3); + this.path = path; -/** - * Takes the `x` and `y` coordinates and transforms them into the same space as - * defined by the position, rotation and scale values. - * - * @function Phaser.Math.TransformXY - * @since 3.0.0 - * - * @param {number} x - The x coordinate to be transformed. - * @param {number} y - The y coordinate to be transformed. - * @param {number} positionX - Horizontal position of the transform point. - * @param {number} positionY - Vertical position of the transform point. - * @param {number} rotation - Rotation of the transform point, in radians. - * @param {number} scaleX - Horizontal scale of the transform point. - * @param {number} scaleY - Vertical scale of the transform point. - * @param {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} [output] - The output vector, point or object for the translated coordinates. - * - * @return {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} The translated point. - */ -var TransformXY = function (x, y, positionX, positionY, rotation, scaleX, scaleY, output) -{ - if (output === undefined) { output = new Vector2(); } + if (config) + { + this.startFollow(config); + } - var radianSin = Math.sin(rotation); - var radianCos = Math.cos(rotation); + return this; + }, - // Rotate and Scale - var a = radianCos * scaleX; - var b = radianSin * scaleX; - var c = -radianSin * scaleY; - var d = radianCos * scaleY; + /** + * Set whether the PathFollower should automatically rotate to point in the direction of the Path. + * + * @method Phaser.GameObjects.Components.PathFollower#setRotateToPath + * @since 3.0.0 + * + * @param {boolean} value - Whether the PathFollower should automatically rotate to point in the direction of the Path. + * @param {number} [offset=0] - Rotation offset in degrees. + * + * @return {this} This Game Object. + */ + setRotateToPath: function (value, offset) + { + if (offset === undefined) { offset = 0; } - // Invert - var id = 1 / ((a * d) + (c * -b)); + this.rotateToPath = value; - output.x = (d * id * x) + (-c * id * y) + (((positionY * c) - (positionX * d)) * id); - output.y = (a * id * y) + (-b * id * x) + (((-positionY * a) + (positionX * b)) * id); + this.pathRotationOffset = offset; - return output; -}; + return this; + }, -module.exports = TransformXY; + /** + * Is this PathFollower actively following a Path or not? + * + * To be considered as `isFollowing` it must be currently moving on a Path, and not paused. + * + * @method Phaser.GameObjects.Components.PathFollower#isFollowing + * @since 3.0.0 + * + * @return {boolean} `true` is this PathFollower is actively following a Path, otherwise `false`. + */ + isFollowing: function () + { + var tween = this.pathTween; + return (tween && tween.isPlaying()); + }, -/***/ }), -/* 178 */ -/***/ (function(module, exports) { + /** + * Starts this PathFollower following its given Path. + * + * @method Phaser.GameObjects.Components.PathFollower#startFollow + * @since 3.3.0 + * + * @param {(number|Phaser.Types.GameObjects.PathFollower.PathConfig|Phaser.Types.Tweens.NumberTweenBuilderConfig)} [config={}] - The duration of the follow, or a PathFollower config object. + * @param {number} [startAt=0] - Optional start position of the follow, between 0 and 1. + * + * @return {this} This Game Object. + */ + startFollow: function (config, startAt) + { + if (config === undefined) { config = {}; } + if (startAt === undefined) { startAt = 0; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var tween = this.pathTween; -/** - * Moves the element at the start of the array to the end, shifting all items in the process. - * The "rotation" happens to the left. - * - * @function Phaser.Utils.Array.RotateLeft - * @since 3.0.0 - * - * @param {array} array - The array to shift to the left. This array is modified in place. - * @param {number} [total=1] - The number of times to shift the array. - * - * @return {*} The most recently shifted element. - */ -var RotateLeft = function (array, total) -{ - if (total === undefined) { total = 1; } + if (tween && tween.isPlaying()) + { + tween.stop(); + } - var element = null; + if (typeof config === 'number') + { + config = { duration: config }; + } - for (var i = 0; i < total; i++) - { - element = array.shift(); - array.push(element); - } + // Override in case they've been specified in the config + config.from = GetValue(config, 'from', 0); + config.to = GetValue(config, 'to', 1); - return element; -}; + var positionOnPath = GetBoolean(config, 'positionOnPath', false); -module.exports = RotateLeft; + this.rotateToPath = GetBoolean(config, 'rotateToPath', false); + this.pathRotationOffset = GetValue(config, 'rotationOffset', 0); + // This works, but it's not an ideal way of doing it as the follower jumps position + var seek = GetValue(config, 'startAt', startAt); -/***/ }), -/* 179 */ -/***/ (function(module, exports) { + if (seek) + { + config.onStart = function (tween) + { + var tweenData = tween.data[0]; + tweenData.progress = seek; + tweenData.elapsed = tweenData.duration * seek; + var v = tweenData.ease(tweenData.progress); + tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); + tweenData.setTargetValue(); + }; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (!this.pathOffset) + { + this.pathOffset = new Vector2(this.x, this.y); + } -/** - * Moves the element at the end of the array to the start, shifting all items in the process. - * The "rotation" happens to the right. - * - * @function Phaser.Utils.Array.RotateRight - * @since 3.0.0 - * - * @param {array} array - The array to shift to the right. This array is modified in place. - * @param {number} [total=1] - The number of times to shift the array. - * - * @return {*} The most recently shifted element. - */ -var RotateRight = function (array, total) -{ - if (total === undefined) { total = 1; } + if (!this.pathVector) + { + this.pathVector = new Vector2(); + } - var element = null; + if (!this.pathDelta) + { + this.pathDelta = new Vector2(); + } - for (var i = 0; i < total; i++) - { - element = array.pop(); - array.unshift(element); - } + this.pathDelta.reset(); - return element; -}; + config.persist = true; -module.exports = RotateRight; + this.pathTween = this.scene.sys.tweens.addCounter(config); + // The starting point of the path, relative to this follower + this.path.getStartPoint(this.pathOffset); -/***/ }), -/* 180 */ -/***/ (function(module, exports, __webpack_require__) { + if (positionOnPath) + { + this.x = this.pathOffset.x; + this.y = this.pathOffset.y; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.pathOffset.x = this.x - this.pathOffset.x; + this.pathOffset.y = this.y - this.pathOffset.y; -var Point = __webpack_require__(4); + this._prevDirection = TWEEN_CONST.PLAYING_FORWARD; -/** - * Returns a uniformly distributed random point from anywhere within the given Ellipse. - * - * @function Phaser.Geom.Ellipse.Random - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get a random point from. - * @param {(Phaser.Geom.Point|object)} [out] - A Point or point-like object to set the random `x` and `y` values in. - * - * @return {(Phaser.Geom.Point|object)} A Point object with the random values set in the `x` and `y` properties. - */ -var Random = function (ellipse, out) -{ - if (out === undefined) { out = new Point(); } + if (this.rotateToPath) + { + // Set the rotation now (in case the tween has a delay on it, etc) + var nextPoint = this.path.getPoint(0.1); - var p = Math.random() * Math.PI * 2; - var s = Math.sqrt(Math.random()); + this.rotation = Math.atan2(nextPoint.y - this.y, nextPoint.x - this.x) + DegToRad(this.pathRotationOffset); + } - out.x = ellipse.x + ((s * Math.cos(p)) * ellipse.width / 2); - out.y = ellipse.y + ((s * Math.sin(p)) * ellipse.height / 2); + this.pathConfig = config; - return out; -}; + return this; + }, -module.exports = Random; + /** + * Pauses this PathFollower. It will still continue to render, but it will remain motionless at the + * point on the Path at which you paused it. + * + * @method Phaser.GameObjects.Components.PathFollower#pauseFollow + * @since 3.3.0 + * + * @return {this} This Game Object. + */ + pauseFollow: function () + { + var tween = this.pathTween; + if (tween && tween.isPlaying()) + { + tween.pause(); + } -/***/ }), -/* 181 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Resumes a previously paused PathFollower. + * + * If the PathFollower was not paused this has no effect. + * + * @method Phaser.GameObjects.Components.PathFollower#resumeFollow + * @since 3.3.0 + * + * @return {this} This Game Object. + */ + resumeFollow: function () + { + var tween = this.pathTween; -var Point = __webpack_require__(4); + if (tween && tween.isPaused()) + { + tween.resume(); + } -/** - * Returns a random Point from within the area of the given Triangle. - * - * @function Phaser.Geom.Triangle.Random - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to get a random point from. - * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. - * - * @return {Phaser.Geom.Point} A Point object holding the coordinates of a random position within the Triangle. - */ -var Random = function (triangle, out) -{ - if (out === undefined) { out = new Point(); } + return this; + }, - // Basis vectors - var ux = triangle.x2 - triangle.x1; - var uy = triangle.y2 - triangle.y1; + /** + * Stops this PathFollower from following the path any longer. + * + * This will invoke any 'stop' conditions that may exist on the Path, or for the follower. + * + * @method Phaser.GameObjects.Components.PathFollower#stopFollow + * @since 3.3.0 + * + * @return {this} This Game Object. + */ + stopFollow: function () + { + var tween = this.pathTween; - var vx = triangle.x3 - triangle.x1; - var vy = triangle.y3 - triangle.y1; + if (tween && tween.isPlaying()) + { + tween.stop(); + } - // Random point within the unit square - var r = Math.random(); - var s = Math.random(); + return this; + }, - // Point outside the triangle? Remap it. - if (r + s >= 1) + /** + * Internal update handler that advances this PathFollower along the path. + * + * Called automatically by the Scene step, should not typically be called directly. + * + * @method Phaser.GameObjects.Components.PathFollower#pathUpdate + * @since 3.17.0 + */ + pathUpdate: function () { - r = 1 - r; - s = 1 - s; - } + var tween = this.pathTween; - out.x = triangle.x1 + ((ux * r) + (vx * s)); - out.y = triangle.y1 + ((uy * r) + (vy * s)); + if (tween) + { + var tweenData = tween.data[0]; + var pathDelta = this.pathDelta; + var pathVector = this.pathVector; - return out; -}; + pathDelta.copy(pathVector).negate(); -module.exports = Random; + if (tweenData.state === TWEEN_CONST.COMPLETE) + { + this.path.getPoint(tweenData.end, pathVector); + pathDelta.add(pathVector); + pathVector.add(this.pathOffset); -/***/ }), -/* 182 */ -/***/ (function(module, exports) { + this.setPosition(pathVector.x, pathVector.y); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return; + } + else if (tweenData.state !== TWEEN_CONST.PLAYING_FORWARD && tweenData.state !== TWEEN_CONST.PLAYING_BACKWARD) + { + // If delayed, etc then bail out + return; + } -/** - * Rotate a `point` around `x` and `y` by the given `angle` and `distance`. - * - * In polar notation, this maps a point from (r, t) to (distance, t + angle), vs. the origin (x, y). - * - * @function Phaser.Math.RotateAroundDistance - * @since 3.0.0 - * - * @generic {Phaser.Types.Math.Vector2Like} T - [point,$return] - * - * @param {(Phaser.Geom.Point|object)} point - The point to be rotated. - * @param {number} x - The horizontal coordinate to rotate around. - * @param {number} y - The vertical coordinate to rotate around. - * @param {number} angle - The angle of rotation in radians. - * @param {number} distance - The distance from (x, y) to place the point at. - * - * @return {Phaser.Types.Math.Vector2Like} The given point. - */ -var RotateAroundDistance = function (point, x, y, angle, distance) -{ - var t = angle + Math.atan2(point.y - y, point.x - x); + this.path.getPoint(tween.getValue(), pathVector); - point.x = x + (distance * Math.cos(t)); - point.y = y + (distance * Math.sin(t)); + pathDelta.add(pathVector); + pathVector.add(this.pathOffset); - return point; -}; + var oldX = this.x; + var oldY = this.y; -module.exports = RotateAroundDistance; + this.setPosition(pathVector.x, pathVector.y); + var speedX = this.x - oldX; + var speedY = this.y - oldY; -/***/ }), -/* 183 */ -/***/ (function(module, exports) { + if (speedX === 0 && speedY === 0) + { + // Bail out early + return; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (tweenData.state !== this._prevDirection) + { + // We've changed direction, so don't do a rotate this frame + this._prevDirection = tweenData.state; -/** - * Calculate a smoother interpolation percentage of `x` between `min` and `max`. - * - * The function receives the number `x` as an argument and returns 0 if `x` is less than or equal to the left edge, - * 1 if `x` is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, - * between 0 and 1 otherwise. - * - * Produces an even smoother interpolation than {@link Phaser.Math.SmoothStep}. - * - * @function Phaser.Math.SmootherStep - * @since 3.0.0 - * @see {@link https://en.wikipedia.org/wiki/Smoothstep#Variations} - * - * @param {number} x - The input value. - * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. - * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. - * - * @return {number} The percentage of interpolation, between 0 and 1. - */ -var SmootherStep = function (x, min, max) -{ - x = Math.max(0, Math.min(1, (x - min) / (max - min))); + return; + } + + if (this.rotateToPath) + { + this.rotation = Math.atan2(speedY, speedX) + DegToRad(this.pathRotationOffset); + } + } + } - return x * x * x * (x * (x * 6 - 15) + 10); }; -module.exports = SmootherStep; +module.exports = PathFollower; /***/ }), -/* 184 */ -/***/ (function(module, exports) { + +/***/ 58210: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var DeepCopy = __webpack_require__(28699); + /** - * Calculate a smooth interpolation percentage of `x` between `min` and `max`. - * - * The function receives the number `x` as an argument and returns 0 if `x` is less than or equal to the left edge, - * 1 if `x` is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, - * between 0 and 1 otherwise. + * Provides methods used for setting the WebGL rendering pipeline of a Game Object. * - * @function Phaser.Math.SmoothStep + * @namespace Phaser.GameObjects.Components.Pipeline + * @webglOnly * @since 3.0.0 - * @see {@link https://en.wikipedia.org/wiki/Smoothstep} - * - * @param {number} x - The input value. - * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. - * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. - * - * @return {number} The percentage of interpolation, between 0 and 1. */ -var SmoothStep = function (x, min, max) -{ - if (x <= min) - { - return 0; - } - if (x >= max) - { - return 1; - } +var Pipeline = { - x = (x - min) / (max - min); + /** + * The initial WebGL pipeline of this Game Object. + * + * If you call `resetPipeline` on this Game Object, the pipeline is reset to this default. + * + * @name Phaser.GameObjects.Components.Pipeline#defaultPipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @default null + * @webglOnly + * @since 3.0.0 + */ + defaultPipeline: null, - return x * x * (3 - 2 * x); -}; + /** + * The current WebGL pipeline of this Game Object. + * + * @name Phaser.GameObjects.Components.Pipeline#pipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @default null + * @webglOnly + * @since 3.0.0 + */ + pipeline: null, -module.exports = SmoothStep; + /** + * An object to store pipeline specific data in, to be read by the pipelines this Game Object uses. + * + * @name Phaser.GameObjects.Components.Pipeline#pipelineData + * @type {object} + * @webglOnly + * @since 3.50.0 + */ + pipelineData: null, + /** + * Sets the initial WebGL Pipeline of this Game Object. + * + * This should only be called during the instantiation of the Game Object. After that, use `setPipeline`. + * + * @method Phaser.GameObjects.Components.Pipeline#initPipeline + * @webglOnly + * @since 3.0.0 + * + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} [pipeline] - Either the string-based name of the pipeline, or a pipeline instance to set. + * + * @return {boolean} `true` if the pipeline was set successfully, otherwise `false`. + */ + initPipeline: function (pipeline) + { + this.pipelineData = {}; -/***/ }), -/* 185 */ -/***/ (function(module, exports, __webpack_require__) { + var renderer = this.scene.sys.renderer; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (!renderer) + { + return false; + } -var Clamp = __webpack_require__(18); -var Class = __webpack_require__(0); -var Events = __webpack_require__(132); -var FindClosestInSorted = __webpack_require__(318); -var Frame = __webpack_require__(319); -var GetValue = __webpack_require__(6); -var SortByDigits = __webpack_require__(320); + var pipelines = renderer.pipelines; -/** - * @classdesc - * A Frame based Animation. - * - * Animations in Phaser consist of a sequence of `AnimationFrame` objects, which are managed by - * this class, along with properties that impact playback, such as the animations frame rate - * or delay. - * - * This class contains all of the properties and methods needed to handle playback of the animation - * directly to an `AnimationState` instance, which is owned by a Sprite, or similar Game Object. - * - * You don't typically create an instance of this class directly, but instead go via - * either the `AnimationManager` or the `AnimationState` and use their `create` methods, - * depending on if you need a global animation, or local to a specific Sprite. - * - * @class Animation - * @memberof Phaser.Animations - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Animations.AnimationManager} manager - A reference to the global Animation Manager - * @param {string} key - The unique identifying string for this animation. - * @param {Phaser.Types.Animations.Animation} config - The Animation configuration. - */ -var Animation = new Class({ + if (pipelines) + { + if (pipeline === undefined) + { + pipeline = pipelines.default; + } - initialize: + var instance = pipelines.get(pipeline); - function Animation (manager, key, config) - { - /** - * A reference to the global Animation Manager. - * - * @name Phaser.Animations.Animation#manager - * @type {Phaser.Animations.AnimationManager} - * @since 3.0.0 - */ - this.manager = manager; + if (instance) + { + this.defaultPipeline = instance; + this.pipeline = instance; - /** - * The unique identifying string for this animation. - * - * @name Phaser.Animations.Animation#key - * @type {string} - * @since 3.0.0 - */ - this.key = key; - - /** - * A frame based animation (as opposed to a bone based animation) - * - * @name Phaser.Animations.Animation#type - * @type {string} - * @default frame - * @since 3.0.0 - */ - this.type = 'frame'; - - /** - * Extract all the frame data into the frames array. - * - * @name Phaser.Animations.Animation#frames - * @type {Phaser.Animations.AnimationFrame[]} - * @since 3.0.0 - */ - this.frames = this.getFrames( - manager.textureManager, - GetValue(config, 'frames', []), - GetValue(config, 'defaultTextureKey', null), - GetValue(config, 'sortFrames', true) - ); - - /** - * The frame rate of playback in frames per second (default 24 if duration is null) - * - * @name Phaser.Animations.Animation#frameRate - * @type {number} - * @default 24 - * @since 3.0.0 - */ - this.frameRate = GetValue(config, 'frameRate', null); - - /** - * How long the animation should play for, in milliseconds. - * If the `frameRate` property has been set then it overrides this value, - * otherwise the `frameRate` is derived from `duration`. - * - * @name Phaser.Animations.Animation#duration - * @type {number} - * @since 3.0.0 - */ - this.duration = GetValue(config, 'duration', null); - - /** - * How many ms per frame, not including frame specific modifiers. - * - * @name Phaser.Animations.Animation#msPerFrame - * @type {number} - * @since 3.0.0 - */ - this.msPerFrame; - - /** - * Skip frames if the time lags, or always advanced anyway? - * - * @name Phaser.Animations.Animation#skipMissedFrames - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.skipMissedFrames = GetValue(config, 'skipMissedFrames', true); - - /** - * The delay in ms before the playback will begin. - * - * @name Phaser.Animations.Animation#delay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.delay = GetValue(config, 'delay', 0); - - /** - * Number of times to repeat the animation. Set to -1 to repeat forever. - * - * @name Phaser.Animations.Animation#repeat - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.repeat = GetValue(config, 'repeat', 0); - - /** - * The delay in ms before the a repeat play starts. - * - * @name Phaser.Animations.Animation#repeatDelay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.repeatDelay = GetValue(config, 'repeatDelay', 0); - - /** - * Should the animation yoyo (reverse back down to the start) before repeating? - * - * @name Phaser.Animations.Animation#yoyo - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.yoyo = GetValue(config, 'yoyo', false); - - /** - * Should the GameObject's `visible` property be set to `true` when the animation starts to play? - * - * @name Phaser.Animations.Animation#showOnStart - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.showOnStart = GetValue(config, 'showOnStart', false); - - /** - * Should the GameObject's `visible` property be set to `false` when the animation finishes? - * - * @name Phaser.Animations.Animation#hideOnComplete - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.hideOnComplete = GetValue(config, 'hideOnComplete', false); - - /** - * Global pause. All Game Objects using this Animation instance are impacted by this property. - * - * @name Phaser.Animations.Animation#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; - - this.calculateDuration(this, this.getTotalFrames(), this.duration, this.frameRate); - - if (this.manager.on) - { - this.manager.on(Events.PAUSE_ALL, this.pause, this); - this.manager.on(Events.RESUME_ALL, this.resume, this); + return true; + } } - }, - /** - * Gets the total number of frames in this animation. - * - * @method Phaser.Animations.Animation#getTotalFrames - * @since 3.50.0 - * - * @return {number} The total number of frames in this animation. - */ - getTotalFrames: function () - { - return this.frames.length; + return false; }, /** - * Calculates the duration, frame rate and msPerFrame values. - * - * @method Phaser.Animations.Animation#calculateDuration - * @since 3.50.0 + * Sets the main WebGL Pipeline of this Game Object. * - * @param {Phaser.Animations.Animation} target - The target to set the values on. - * @param {number} totalFrames - The total number of frames in the animation. - * @param {number} duration - The duration to calculate the frame rate from. - * @param {number} frameRate - The frame ate to calculate the duration from. - */ - calculateDuration: function (target, totalFrames, duration, frameRate) - { - if (duration === null && frameRate === null) - { - // No duration or frameRate given, use default frameRate of 24fps - target.frameRate = 24; - target.duration = (24 / totalFrames) * 1000; - } - else if (duration && frameRate === null) - { - // Duration given but no frameRate, so set the frameRate based on duration - // I.e. 12 frames in the animation, duration = 4000 ms - // So frameRate is 12 / (4000 / 1000) = 3 fps - target.duration = duration; - target.frameRate = totalFrames / (duration / 1000); - } - else - { - // frameRate given, derive duration from it (even if duration also specified) - // I.e. 15 frames in the animation, frameRate = 30 fps - // So duration is 15 / 30 = 0.5 * 1000 (half a second, or 500ms) - target.frameRate = frameRate; - target.duration = (totalFrames / frameRate) * 1000; - } - - target.msPerFrame = 1000 / target.frameRate; - }, - - /** - * Add frames to the end of the animation. + * Also sets the `pipelineData` property, if the parameter is given. * - * @method Phaser.Animations.Animation#addFrame + * @method Phaser.GameObjects.Components.Pipeline#setPipeline + * @webglOnly * @since 3.0.0 * - * @param {(string|Phaser.Types.Animations.AnimationFrame[])} config - Either a string, in which case it will use all frames from a texture with the matching key, or an array of Animation Frame configuration objects. + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline, or a pipeline instance to set. + * @param {object} [pipelineData] - Optional pipeline data object that is set in to the `pipelineData` property of this Game Object. + * @param {boolean} [copyData=true] - Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. * - * @return {this} This Animation object. + * @return {this} This Game Object instance. */ - addFrame: function (config) + setPipeline: function (pipeline, pipelineData, copyData) { - return this.addFrameAt(this.frames.length, config); - }, + var renderer = this.scene.sys.renderer; - /** - * Add frame/s into the animation. - * - * @method Phaser.Animations.Animation#addFrameAt - * @since 3.0.0 - * - * @param {number} index - The index to insert the frame at within the animation. - * @param {(string|Phaser.Types.Animations.AnimationFrame[])} config - Either a string, in which case it will use all frames from a texture with the matching key, or an array of Animation Frame configuration objects. - * - * @return {this} This Animation object. - */ - addFrameAt: function (index, config) - { - var newFrames = this.getFrames(this.manager.textureManager, config); + if (!renderer) + { + return this; + } - if (newFrames.length > 0) + var pipelines = renderer.pipelines; + + if (pipelines) { - if (index === 0) - { - this.frames = newFrames.concat(this.frames); - } - else if (index === this.frames.length) + var instance = pipelines.get(pipeline); + + if (instance) { - this.frames = this.frames.concat(newFrames); + this.pipeline = instance; } - else - { - var pre = this.frames.slice(0, index); - var post = this.frames.slice(index); - this.frames = pre.concat(newFrames, post); + if (pipelineData) + { + this.pipelineData = (copyData) ? DeepCopy(pipelineData) : pipelineData; } - - this.updateFrameSequence(); } return this; }, /** - * Check if the given frame index is valid. + * Adds an entry to the `pipelineData` object belonging to this Game Object. * - * @method Phaser.Animations.Animation#checkFrame - * @since 3.0.0 + * If the 'key' already exists, its value is updated. If it doesn't exist, it is created. * - * @param {number} index - The index to be checked. + * If `value` is undefined, and `key` exists, `key` is removed from the data object. * - * @return {boolean} `true` if the index is valid, otherwise `false`. - */ - checkFrame: function (index) - { - return (index >= 0 && index < this.frames.length); - }, - - /** - * Called internally when this Animation first starts to play. - * Sets the accumulator and nextTick properties. + * @method Phaser.GameObjects.Components.Pipeline#setPipelineData + * @webglOnly + * @since 3.50.0 * - * @method Phaser.Animations.Animation#getFirstTick - * @protected - * @since 3.0.0 + * @param {string} key - The key of the pipeline data to set, update, or delete. + * @param {any} [value] - The value to be set with the key. If `undefined` then `key` will be deleted from the object. * - * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. + * @return {this} This Game Object instance. */ - getFirstTick: function (state) + setPipelineData: function (key, value) { - // When is the first update due? - state.accumulator = 0; + var data = this.pipelineData; - state.nextTick = state.msPerFrame + state.currentFrame.duration; + if (value === undefined) + { + delete data[key]; + } + else + { + data[key] = value; + } + + return this; }, /** - * Returns the AnimationFrame at the provided index + * Resets the WebGL Pipeline of this Game Object back to the default it was created with. * - * @method Phaser.Animations.Animation#getFrameAt - * @protected + * @method Phaser.GameObjects.Components.Pipeline#resetPipeline + * @webglOnly * @since 3.0.0 * - * @param {number} index - The index in the AnimationFrame array + * @param {boolean} [resetData=false] - Reset the `pipelineData` object to being an empty object? * - * @return {Phaser.Animations.AnimationFrame} The frame at the index provided from the animation sequence + * @return {boolean} `true` if the pipeline was reset successfully, otherwise `false`. */ - getFrameAt: function (index) + resetPipeline: function (resetData) { - return this.frames[index]; + if (resetData === undefined) { resetData = false; } + + this.pipeline = this.defaultPipeline; + + if (resetData) + { + this.pipelineData = {}; + } + + return (this.pipeline !== null); }, /** - * Creates AnimationFrame instances based on the given frame data. + * Gets the name of the WebGL Pipeline this Game Object is currently using. * - * @method Phaser.Animations.Animation#getFrames + * @method Phaser.GameObjects.Components.Pipeline#getPipelineName + * @webglOnly * @since 3.0.0 * - * @param {Phaser.Textures.TextureManager} textureManager - A reference to the global Texture Manager. - * @param {(string|Phaser.Types.Animations.AnimationFrame[])} frames - Either a string, in which case it will use all frames from a texture with the matching key, or an array of Animation Frame configuration objects. - * @param {string} [defaultTextureKey] - The key to use if no key is set in the frame configuration object. - * - * @return {Phaser.Animations.AnimationFrame[]} An array of newly created AnimationFrame instances. + * @return {string} The string-based name of the pipeline being used by this Game Object. */ - getFrames: function (textureManager, frames, defaultTextureKey, sortFrames) + getPipelineName: function () { - if (sortFrames === undefined) { sortFrames = true; } - - var out = []; - var prev; - var animationFrame; - var index = 1; - var i; - var textureKey; - - // if frames is a string, we'll get all the frames from the texture manager as if it's a sprite sheet - if (typeof frames === 'string') - { - textureKey = frames; - - var texture = textureManager.get(textureKey); - var frameKeys = texture.getFrameNames(); - - if (sortFrames) - { - SortByDigits(frameKeys); - } - - frames = []; - - frameKeys.forEach(function (value) - { - frames.push({ key: textureKey, frame: value }); - }); - } - - if (!Array.isArray(frames) || frames.length === 0) - { - return out; - } - - for (i = 0; i < frames.length; i++) - { - var item = frames[i]; - - var key = GetValue(item, 'key', defaultTextureKey); - - if (!key) - { - continue; - } - - // Could be an integer or a string - var frame = GetValue(item, 'frame', 0); - - // The actual texture frame - var textureFrame = textureManager.getFrame(key, frame); - - animationFrame = new Frame(key, frame, index, textureFrame); - - animationFrame.duration = GetValue(item, 'duration', 0); - - animationFrame.isFirst = (!prev); - - // The previously created animationFrame - if (prev) - { - prev.nextFrame = animationFrame; - - animationFrame.prevFrame = prev; - } + return this.pipeline.name; + } - out.push(animationFrame); +}; - prev = animationFrame; +module.exports = Pipeline; - index++; - } - if (out.length > 0) - { - animationFrame.isLast = true; +/***/ }), - // Link them end-to-end, so they loop - animationFrame.nextFrame = out[0]; +/***/ 44086: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - out[0].prevFrame = animationFrame; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Generate the progress data +var DeepCopy = __webpack_require__(28699); +var FX = __webpack_require__(88677); +var SpliceOne = __webpack_require__(72677); - var slice = 1 / (out.length - 1); +/** + * Provides methods used for setting the WebGL rendering post pipeline of a Game Object. + * + * @namespace Phaser.GameObjects.Components.PostPipeline + * @webglOnly + * @since 3.60.0 + */ - for (i = 0; i < out.length; i++) - { - out[i].progress = i * slice; - } - } +var PostPipeline = { - return out; - }, + /** + * Does this Game Object have any Post Pipelines set? + * + * @name Phaser.GameObjects.Components.PostPipeline#hasPostPipeline + * @type {boolean} + * @webglOnly + * @since 3.60.0 + */ + hasPostPipeline: false, /** - * Called internally. Sets the accumulator and nextTick values of the current Animation. + * The WebGL Post FX Pipelines this Game Object uses for post-render effects. * - * @method Phaser.Animations.Animation#getNextTick - * @since 3.0.0 + * The pipelines are processed in the order in which they appear in this array. * - * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. + * If you modify this array directly, be sure to set the + * `hasPostPipeline` property accordingly. + * + * @name Phaser.GameObjects.Components.PostPipeline#postPipelines + * @type {Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[]} + * @webglOnly + * @since 3.60.0 */ - getNextTick: function (state) - { - state.accumulator -= state.nextTick; + postPipelines: null, - state.nextTick = state.msPerFrame + state.currentFrame.duration; - }, + /** + * An object to store pipeline specific data in, to be read by the pipelines this Game Object uses. + * + * @name Phaser.GameObjects.Components.PostPipeline#postPipelineData + * @type {object} + * @webglOnly + * @since 3.60.0 + */ + postPipelineData: null, /** - * Returns the frame closest to the given progress value between 0 and 1. + * The Pre FX component of this Game Object. * - * @method Phaser.Animations.Animation#getFrameByProgress - * @since 3.4.0 + * This component allows you to apply a variety of built-in effects to this Game Object, such + * as glow, blur, bloom, displacements, vignettes and more. You access them via this property, + * for example: * - * @param {number} value - A value between 0 and 1. + * ```js + * const player = this.add.sprite(); + * player.preFX.addBloom(); + * ``` * - * @return {Phaser.Animations.AnimationFrame} The frame closest to the given progress value. + * Only the following Game Objects support Pre FX: + * + * * Image + * * Sprite + * * TileSprite + * * Text + * * RenderTexture + * * Video + * + * All FX are WebGL only and do not have Canvas counterparts. + * + * Please see the FX Class for more details and available methods. + * + * @name Phaser.GameObjects.Components.PostPipeline#preFX + * @type {?Phaser.GameObjects.Components.FX} + * @webglOnly + * @since 3.60.0 */ - getFrameByProgress: function (value) - { - value = Clamp(value, 0, 1); - - return FindClosestInSorted(value, this.frames, 'progress'); - }, + preFX: null, /** - * Advance the animation frame. + * The Post FX component of this Game Object. * - * @method Phaser.Animations.Animation#nextFrame - * @since 3.0.0 + * This component allows you to apply a variety of built-in effects to this Game Object, such + * as glow, blur, bloom, displacements, vignettes and more. You access them via this property, + * for example: * - * @param {Phaser.Animations.AnimationState} state - The Animation State to advance. + * ```js + * const player = this.add.sprite(); + * player.postFX.addBloom(); + * ``` + * + * All FX are WebGL only and do not have Canvas counterparts. + * + * Please see the FX Class for more details and available methods. + * + * This property is always `null` until the `initPostPipeline` method is called. + * + * @name Phaser.GameObjects.Components.PostPipeline#postFX + * @type {Phaser.GameObjects.Components.FX} + * @webglOnly + * @since 3.60.0 */ - nextFrame: function (state) - { - var frame = state.currentFrame; - - if (frame.isLast) - { - // We're at the end of the animation - - // Yoyo? (happens before repeat) - if (state.yoyo) - { - this.handleYoyoFrame(state, false); - } - else if (state.repeatCounter > 0) - { - // Repeat (happens before complete) - - if (state.inReverse && state.forward) - { - state.forward = false; - } - else - { - this.repeatAnimation(state); - } - } - else - { - state.complete(); - } - } - else - { - this.updateAndGetNextTick(state, frame.nextFrame); - } - }, + postFX: null, /** - * Handle the yoyo functionality in nextFrame and previousFrame methods. + * This should only be called during the instantiation of the Game Object. * - * @method Phaser.Animations.Animation#handleYoyoFrame - * @private - * @since 3.12.0 + * It is called by default by all core Game Objects and doesn't need + * calling again. * - * @param {Phaser.Animations.AnimationState} state - The Animation State to advance. - * @param {boolean} isReverse - Is animation in reverse mode? (Default: false) + * After that, use `setPostPipeline`. + * + * @method Phaser.GameObjects.Components.PostPipeline#initPostPipeline + * @webglOnly + * @since 3.60.0 + * + * @param {boolean} [preFX=false] - Does this Game Object support Pre FX? */ - handleYoyoFrame: function (state, isReverse) + initPostPipeline: function (preFX) { - if (!isReverse) { isReverse = false; } - - if (state.inReverse === !isReverse && state.repeatCounter > 0) - { - if (state.repeatDelay === 0 || state.pendingRepeat) - { - state.forward = isReverse; - } - - this.repeatAnimation(state); + this.postPipelines = []; + this.postPipelineData = {}; - return; - } + this.postFX = new FX(this, true); - if (state.inReverse !== isReverse && state.repeatCounter === 0) + if (preFX) { - state.complete(); - - return; + this.preFX = new FX(this, false); } - - state.forward = isReverse; - - var frame = (isReverse) ? state.currentFrame.nextFrame : state.currentFrame.prevFrame; - - this.updateAndGetNextTick(state, frame); }, /** - * Returns the animation last frame. + * Sets one, or more, Post Pipelines on this Game Object. * - * @method Phaser.Animations.Animation#getLastFrame - * @since 3.12.0 + * Post Pipelines are invoked after this Game Object has rendered to its target and + * are commonly used for post-fx. * - * @return {Phaser.Animations.AnimationFrame} The last Animation Frame. - */ - getLastFrame: function () - { - return this.frames[this.frames.length - 1]; - }, - - /** - * Called internally when the Animation is playing backwards. - * Sets the previous frame, causing a yoyo, repeat, complete or update, accordingly. + * The post pipelines are appended to the `postPipelines` array belonging to this + * Game Object. When the renderer processes this Game Object, it iterates through the post + * pipelines in the order in which they appear in the array. If you are stacking together + * multiple effects, be aware that the order is important. * - * @method Phaser.Animations.Animation#previousFrame - * @since 3.0.0 + * If you call this method multiple times, the new pipelines will be appended to any existing + * post pipelines already set. Use the `resetPostPipeline` method to clear them first, if required. * - * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. + * You can optionally also set the `postPipelineData` property, if the parameter is given. + * + * @method Phaser.GameObjects.Components.PostPipeline#setPostPipeline + * @webglOnly + * @since 3.60.0 + * + * @param {(string|string[]|function|function[]|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[])} pipelines - Either the string-based name of the pipeline, or a pipeline instance, or class, or an array of them. + * @param {object} [pipelineData] - Optional pipeline data object that is set in to the `postPipelineData` property of this Game Object. + * @param {boolean} [copyData=true] - Should the pipeline data object be _deep copied_ into the `postPipelineData` property of this Game Object? If `false` it will be set by reference instead. + * + * @return {this} This Game Object instance. */ - previousFrame: function (state) + setPostPipeline: function (pipelines, pipelineData, copyData) { - var frame = state.currentFrame; + var renderer = this.scene.sys.renderer; - if (frame.isFirst) + if (!renderer) { - // We're at the start of the animation - if (state.yoyo) + return this; + } + + var pipelineManager = renderer.pipelines; + + if (pipelineManager) + { + if (!Array.isArray(pipelines)) { - this.handleYoyoFrame(state, true); + pipelines = [ pipelines ]; } - else if (state.repeatCounter > 0) + + for (var i = 0; i < pipelines.length; i++) { - if (state.inReverse && !state.forward) - { - this.repeatAnimation(state); - } - else - { - // Repeat (happens before complete) - state.forward = true; + var instance = pipelineManager.getPostPipeline(pipelines[i], this, pipelineData); - this.repeatAnimation(state); + if (instance) + { + this.postPipelines.push(instance); } } - else + + if (pipelineData) { - state.complete(); + this.postPipelineData = (copyData) ? DeepCopy(pipelineData) : pipelineData; } } - else - { - this.updateAndGetNextTick(state, frame.prevFrame); - } - }, - /** - * Update Frame and Wait next tick. - * - * @method Phaser.Animations.Animation#updateAndGetNextTick - * @private - * @since 3.12.0 - * - * @param {Phaser.Animations.AnimationState} state - The Animation State. - * @param {Phaser.Animations.AnimationFrame} frame - An Animation frame. - */ - updateAndGetNextTick: function (state, frame) - { - state.setCurrentFrame(frame); + this.hasPostPipeline = (this.postPipelines.length > 0); - this.getNextTick(state); + return this; }, /** - * Removes the given AnimationFrame from this Animation instance. - * This is a global action. Any Game Object using this Animation will be impacted by this change. + * Adds an entry to the `postPipelineData` object belonging to this Game Object. * - * @method Phaser.Animations.Animation#removeFrame - * @since 3.0.0 + * If the 'key' already exists, its value is updated. If it doesn't exist, it is created. * - * @param {Phaser.Animations.AnimationFrame} frame - The AnimationFrame to be removed. + * If `value` is undefined, and `key` exists, `key` is removed from the data object. * - * @return {this} This Animation object. + * @method Phaser.GameObjects.Components.PostPipeline#setPostPipelineData + * @webglOnly + * @since 3.60.0 + * + * @param {string} key - The key of the pipeline data to set, update, or delete. + * @param {any} [value] - The value to be set with the key. If `undefined` then `key` will be deleted from the object. + * + * @return {this} This Game Object instance. */ - removeFrame: function (frame) + setPostPipelineData: function (key, value) { - var index = this.frames.indexOf(frame); + var data = this.postPipelineData; - if (index !== -1) + if (value === undefined) { - this.removeFrameAt(index); + delete data[key]; + } + else + { + data[key] = value; } return this; }, /** - * Removes a frame from the AnimationFrame array at the provided index - * and updates the animation accordingly. + * Gets a Post Pipeline instance from this Game Object, based on the given name, and returns it. * - * @method Phaser.Animations.Animation#removeFrameAt - * @since 3.0.0 + * @method Phaser.GameObjects.Components.PostPipeline#getPostPipeline + * @webglOnly + * @since 3.60.0 * - * @param {number} index - The index in the AnimationFrame array + * @param {(string|function|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline)} pipeline - The string-based name of the pipeline, or a pipeline class. * - * @return {this} This Animation object. + * @return {(Phaser.Renderer.WebGL.Pipelines.PostFXPipeline|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[])} An array of all the Post Pipelines matching the name. This array will be empty if there was no match. If there was only one single match, that pipeline is returned directly, not in an array. */ - removeFrameAt: function (index) + getPostPipeline: function (pipeline) { - this.frames.splice(index, 1); - - this.updateFrameSequence(); + var isString = (typeof pipeline === 'string'); - return this; - }, + var pipelines = this.postPipelines; - /** - * Called internally during playback. Forces the animation to repeat, providing there are enough counts left - * in the repeat counter. - * - * @method Phaser.Animations.Animation#repeatAnimation - * @fires Phaser.Animations.Events#ANIMATION_REPEAT - * @fires Phaser.Animations.Events#SPRITE_ANIMATION_REPEAT - * @fires Phaser.Animations.Events#SPRITE_ANIMATION_KEY_REPEAT - * @since 3.0.0 - * - * @param {Phaser.Animations.AnimationState} state - The Animation State belonging to the Game Object invoking this call. - */ - repeatAnimation: function (state) - { - if (state._pendingStop === 2) - { - if (state._pendingStopValue === 0) - { - return state.stop(); - } - else - { - state._pendingStopValue--; - } - } + var results = []; - if (state.repeatDelay > 0 && !state.pendingRepeat) - { - state.pendingRepeat = true; - state.accumulator -= state.nextTick; - state.nextTick += state.repeatDelay; - } - else + for (var i = 0; i < pipelines.length; i++) { - state.repeatCounter--; - - if (state.forward) - { - state.setCurrentFrame(state.currentFrame.nextFrame); - } - else - { - state.setCurrentFrame(state.currentFrame.prevFrame); - } + var instance = pipelines[i]; - if (state.isPlaying) + if ((isString && instance.name === pipeline) || (!isString && instance instanceof pipeline)) { - this.getNextTick(state); - - state.handleRepeat(); + results.push(instance); } } + + return (results.length === 1) ? results[0] : results; }, /** - * Converts the animation data to JSON. + * Resets the WebGL Post Pipelines of this Game Object. It does this by calling + * the `destroy` method on each post pipeline and then clearing the local array. * - * @method Phaser.Animations.Animation#toJSON - * @since 3.0.0 + * @method Phaser.GameObjects.Components.PostPipeline#resetPostPipeline + * @webglOnly + * @since 3.60.0 * - * @return {Phaser.Types.Animations.JSONAnimation} The resulting JSONAnimation formatted object. + * @param {boolean} [resetData=false] - Reset the `postPipelineData` object to being an empty object? */ - toJSON: function () + resetPostPipeline: function (resetData) { - var output = { - key: this.key, - type: this.type, - frames: [], - frameRate: this.frameRate, - duration: this.duration, - skipMissedFrames: this.skipMissedFrames, - delay: this.delay, - repeat: this.repeat, - repeatDelay: this.repeatDelay, - yoyo: this.yoyo, - showOnStart: this.showOnStart, - hideOnComplete: this.hideOnComplete - }; + if (resetData === undefined) { resetData = false; } - this.frames.forEach(function (frame) + var pipelines = this.postPipelines; + + for (var i = 0; i < pipelines.length; i++) { - output.frames.push(frame.toJSON()); - }); + pipelines[i].destroy(); + } - return output; + this.postPipelines = []; + this.hasPostPipeline = false; + + if (resetData) + { + this.postPipelineData = {}; + } }, /** - * Called internally whenever frames are added to, or removed from, this Animation. + * Removes a type of Post Pipeline instances from this Game Object, based on the given name, and destroys them. * - * @method Phaser.Animations.Animation#updateFrameSequence - * @since 3.0.0 + * If you wish to remove all Post Pipelines use the `resetPostPipeline` method instead. * - * @return {this} This Animation object. + * @method Phaser.GameObjects.Components.PostPipeline#removePostPipeline + * @webglOnly + * @since 3.60.0 + * + * @param {string|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline} pipeline - The string-based name of the pipeline, or a pipeline class. + * + * @return {this} This Game Object. */ - updateFrameSequence: function () + removePostPipeline: function (pipeline) { - var len = this.frames.length; - var slice = 1 / (len - 1); + var isString = (typeof pipeline === 'string'); - var frame; + var pipelines = this.postPipelines; - for (var i = 0; i < len; i++) + for (var i = pipelines.length - 1; i >= 0; i--) { - frame = this.frames[i]; - - frame.index = i + 1; - frame.isFirst = false; - frame.isLast = false; - frame.progress = i * slice; + var instance = pipelines[i]; - if (i === 0) + if ( + (isString && instance.name === pipeline) || + (!isString && instance === pipeline)) { - frame.isFirst = true; + instance.destroy(); - if (len === 1) - { - frame.isLast = true; - frame.nextFrame = frame; - frame.prevFrame = frame; - } - else - { - frame.isLast = false; - frame.prevFrame = this.frames[len - 1]; - frame.nextFrame = this.frames[i + 1]; - } - } - else if (i === len - 1 && len > 1) - { - frame.isLast = true; - frame.prevFrame = this.frames[len - 2]; - frame.nextFrame = this.frames[0]; - } - else if (len > 1) - { - frame.prevFrame = this.frames[i - 1]; - frame.nextFrame = this.frames[i + 1]; + SpliceOne(pipelines, i); } } - return this; - }, - - /** - * Pauses playback of this Animation. The paused state is set immediately. - * - * @method Phaser.Animations.Animation#pause - * @since 3.0.0 - * - * @return {this} This Animation object. - */ - pause: function () - { - this.paused = true; + this.hasPostPipeline = (this.postPipelines.length > 0); return this; }, /** - * Resumes playback of this Animation. The paused state is reset immediately. + * Removes all Pre and Post FX Controllers from this Game Object. * - * @method Phaser.Animations.Animation#resume - * @since 3.0.0 + * If you wish to remove a single controller, use the `preFX.remove(fx)` or `postFX.remove(fx)` methods instead. * - * @return {this} This Animation object. - */ - resume: function () - { - this.paused = false; - - return this; - }, - - /** - * Destroys this Animation instance. It will remove all event listeners, - * remove this animation and its key from the global Animation Manager, - * and then destroy all Animation Frames in turn. + * If you wish to clear a single controller, use the `preFX.clear()` or `postFX.clear()` methods instead. * - * @method Phaser.Animations.Animation#destroy - * @since 3.0.0 + * @method Phaser.GameObjects.Components.PostPipeline#clearFX + * @webglOnly + * @since 3.60.0 + * + * @return {this} This Game Object. */ - destroy: function () + clearFX: function () { - if (this.manager.off) + if (this.preFX) { - this.manager.off(Events.PAUSE_ALL, this.pause, this); - this.manager.off(Events.RESUME_ALL, this.resume, this); + this.preFX.clear(); } - this.manager.remove(this.key); - - for (var i = 0; i < this.frames.length; i++) + if (this.postFX) { - this.frames[i].destroy(); + this.postFX.clear(); } - this.frames = []; - - this.manager = null; + return this; } -}); +}; -module.exports = Animation; +module.exports = PostPipeline; /***/ }), -/* 186 */ -/***/ (function(module, exports) { + +/***/ 45900: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Takes the given string and pads it out, to the length required, using the character - * specified. For example if you need a string to be 6 characters long, you can call: - * - * `pad('bob', 6, '-', 2)` - * - * This would return: `bob---` as it has padded it out to 6 characters, using the `-` on the right. - * - * You can also use it to pad numbers (they are always returned as strings): - * - * `pad(512, 6, '0', 1)` - * - * Would return: `000512` with the string padded to the left. - * - * If you don't specify a direction it'll pad to both sides: - * - * `pad('c64', 7, '*')` - * - * Would return: `**c64**` + * Provides methods used for getting and setting the Scroll Factor of a Game Object. * - * @function Phaser.Utils.String.Pad + * @namespace Phaser.GameObjects.Components.ScrollFactor * @since 3.0.0 - * - * @param {string|number|object} str - The target string. `toString()` will be called on the string, which means you can also pass in common data types like numbers. - * @param {number} [len=0] - The number of characters to be added. - * @param {string} [pad=" "] - The string to pad it out with (defaults to a space). - * @param {number} [dir=3] - The direction dir = 1 (left), 2 (right), 3 (both). - * - * @return {string} The padded string. */ -var Pad = function (str, len, pad, dir) -{ - if (len === undefined) { len = 0; } - if (pad === undefined) { pad = ' '; } - if (dir === undefined) { dir = 3; } - str = str.toString(); +var ScrollFactor = { - var padlen = 0; + /** + * The horizontal scroll factor of this Game Object. + * + * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * + * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. + * It does not change the Game Objects actual position values. + * + * A value of 1 means it will move exactly in sync with a camera. + * A value of 0 means it will not move at all, even if the camera moves. + * Other values control the degree to which the camera movement is mapped to this Game Object. + * + * Please be aware that scroll factor values other than 1 are not taken in to consideration when + * calculating physics collisions. Bodies always collide based on their world position, but changing + * the scroll factor is a visual adjustment to where the textures are rendered, which can offset + * them from physics bodies if not accounted for in your code. + * + * @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorX + * @type {number} + * @default 1 + * @since 3.0.0 + */ + scrollFactorX: 1, - if (len + 1 >= str.length) + /** + * The vertical scroll factor of this Game Object. + * + * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * + * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. + * It does not change the Game Objects actual position values. + * + * A value of 1 means it will move exactly in sync with a camera. + * A value of 0 means it will not move at all, even if the camera moves. + * Other values control the degree to which the camera movement is mapped to this Game Object. + * + * Please be aware that scroll factor values other than 1 are not taken in to consideration when + * calculating physics collisions. Bodies always collide based on their world position, but changing + * the scroll factor is a visual adjustment to where the textures are rendered, which can offset + * them from physics bodies if not accounted for in your code. + * + * @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorY + * @type {number} + * @default 1 + * @since 3.0.0 + */ + scrollFactorY: 1, + + /** + * Sets the scroll factor of this Game Object. + * + * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * + * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. + * It does not change the Game Objects actual position values. + * + * A value of 1 means it will move exactly in sync with a camera. + * A value of 0 means it will not move at all, even if the camera moves. + * Other values control the degree to which the camera movement is mapped to this Game Object. + * + * Please be aware that scroll factor values other than 1 are not taken in to consideration when + * calculating physics collisions. Bodies always collide based on their world position, but changing + * the scroll factor is a visual adjustment to where the textures are rendered, which can offset + * them from physics bodies if not accounted for in your code. + * + * @method Phaser.GameObjects.Components.ScrollFactor#setScrollFactor + * @since 3.0.0 + * + * @param {number} x - The horizontal scroll factor of this Game Object. + * @param {number} [y=x] - The vertical scroll factor of this Game Object. If not set it will use the `x` value. + * + * @return {this} This Game Object instance. + */ + setScrollFactor: function (x, y) { - switch (dir) - { - case 1: - str = new Array(len + 1 - str.length).join(pad) + str; - break; + if (y === undefined) { y = x; } - case 3: - var right = Math.ceil((padlen = len - str.length) / 2); - var left = padlen - right; - str = new Array(left + 1).join(pad) + str + new Array(right + 1).join(pad); - break; + this.scrollFactorX = x; + this.scrollFactorY = y; - default: - str = str + new Array(len + 1 - str.length).join(pad); - break; - } + return this; } - return str; }; -module.exports = Pad; +module.exports = ScrollFactor; /***/ }), -/* 187 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 31654: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var HexStringToColor = __webpack_require__(327); -var IntegerToColor = __webpack_require__(189); -var ObjectToColor = __webpack_require__(331); -var RGBStringToColor = __webpack_require__(332); - /** - * Converts the given source color value into an instance of a Color class. - * The value can be either a string, prefixed with `rgb` or a hex string, a number or an Object. + * Provides methods used for getting and setting the size of a Game Object. * - * @function Phaser.Display.Color.ValueToColor + * @namespace Phaser.GameObjects.Components.Size * @since 3.0.0 - * - * @param {(string|number|Phaser.Types.Display.InputColorObject)} input - The source color value to convert. - * - * @return {Phaser.Display.Color} A Color object. */ -var ValueToColor = function (input) -{ - var t = typeof input; - switch (t) - { - case 'string': +var Size = { - if (input.substr(0, 3).toLowerCase() === 'rgb') - { - return RGBStringToColor(input); - } - else - { - return HexStringToColor(input); - } + /** + * A property indicating that a Game Object has this component. + * + * @name Phaser.GameObjects.Components.Size#_sizeComponent + * @type {boolean} + * @private + * @default true + * @since 3.2.0 + */ + _sizeComponent: true, - case 'number': + /** + * The native (un-scaled) width of this Game Object. + * + * Changing this value will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or use + * the `displayWidth` property. + * + * @name Phaser.GameObjects.Components.Size#width + * @type {number} + * @since 3.0.0 + */ + width: 0, - return IntegerToColor(input); + /** + * The native (un-scaled) height of this Game Object. + * + * Changing this value will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or use + * the `displayHeight` property. + * + * @name Phaser.GameObjects.Components.Size#height + * @type {number} + * @since 3.0.0 + */ + height: 0, - case 'object': + /** + * The displayed width of this Game Object. + * + * This value takes into account the scale factor. + * + * Setting this value will adjust the Game Object's scale property. + * + * @name Phaser.GameObjects.Components.Size#displayWidth + * @type {number} + * @since 3.0.0 + */ + displayWidth: { - return ObjectToColor(input); - } -}; + get: function () + { + return Math.abs(this.scaleX * this.frame.realWidth); + }, -module.exports = ValueToColor; + set: function (value) + { + this.scaleX = value / this.frame.realWidth; + } + }, -/***/ }), -/* 188 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The displayed height of this Game Object. + * + * This value takes into account the scale factor. + * + * Setting this value will adjust the Game Object's scale property. + * + * @name Phaser.GameObjects.Components.Size#displayHeight + * @type {number} + * @since 3.0.0 + */ + displayHeight: { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + get: function () + { + return Math.abs(this.scaleY * this.frame.realHeight); + }, -var GetColor = __webpack_require__(103); + set: function (value) + { + this.scaleY = value / this.frame.realHeight; + } -/** - * RGB space conversion. - * - * @ignore - * - * @param {number} n - The value to convert. - * @param {number} h - The h value. - * @param {number} s - The s value. - * @param {number} v - The v value. - * - * @return {number} The converted value. - */ -function ConvertValue (n, h, s, v) -{ - var k = (n + h * 6) % 6; + }, - var min = Math.min(k, 4 - k, 1); + /** + * Sets the size of this Game Object to be that of the given Frame. + * + * This will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or call the + * `setDisplaySize` method, which is the same thing as changing the scale but allows you + * to do so by giving pixel values. + * + * If you have enabled this Game Object for input, changing the size will _not_ change the + * size of the hit area. To do this you should adjust the `input.hitArea` object directly. + * + * @method Phaser.GameObjects.Components.Size#setSizeToFrame + * @since 3.0.0 + * + * @param {Phaser.Textures.Frame|boolean} [frame] - The frame to base the size of this Game Object on. + * + * @return {this} This Game Object instance. + */ + setSizeToFrame: function (frame) + { + if (!frame) { frame = this.frame; } - return Math.round(255 * (v - v * s * Math.max(0, min))); -} + this.width = frame.realWidth; + this.height = frame.realHeight; -/** - * Converts a HSV (hue, saturation and value) color set to RGB. - * - * Conversion formula from https://en.wikipedia.org/wiki/HSL_and_HSV - * - * Assumes HSV values are contained in the set [0, 1]. - * - * @function Phaser.Display.Color.HSVToRGB - * @since 3.0.0 - * - * @param {number} h - The hue, in the range 0 - 1. This is the base color. - * @param {number} s - The saturation, in the range 0 - 1. This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white. - * @param {number} v - The value, in the range 0 - 1. This controls how dark the color is. Where 1 is as bright as possible and 0 is black. - * @param {(Phaser.Types.Display.ColorObject|Phaser.Display.Color)} [out] - A Color object to store the results in. If not given a new ColorObject will be created. - * - * @return {(Phaser.Types.Display.ColorObject|Phaser.Display.Color)} An object with the red, green and blue values set in the r, g and b properties. - */ -var HSVToRGB = function (h, s, v, out) -{ - if (s === undefined) { s = 1; } - if (v === undefined) { v = 1; } + var input = this.input; - var r = ConvertValue(5, h, s, v); - var g = ConvertValue(3, h, s, v); - var b = ConvertValue(1, h, s, v); + if (input && !input.customHitArea) + { + input.hitArea.width = this.width; + input.hitArea.height = this.height; + } - if (!out) - { - return { r: r, g: g, b: b, color: GetColor(r, g, b) }; - } - else if (out.setTo) + return this; + }, + + /** + * Sets the internal size of this Game Object, as used for frame or physics body creation. + * + * This will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or call the + * `setDisplaySize` method, which is the same thing as changing the scale but allows you + * to do so by giving pixel values. + * + * If you have enabled this Game Object for input, changing the size will _not_ change the + * size of the hit area. To do this you should adjust the `input.hitArea` object directly. + * + * @method Phaser.GameObjects.Components.Size#setSize + * @since 3.0.0 + * + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {this} This Game Object instance. + */ + setSize: function (width, height) { - return out.setTo(r, g, b, out.alpha, false); - } - else + this.width = width; + this.height = height; + + return this; + }, + + /** + * Sets the display size of this Game Object. + * + * Calling this will adjust the scale. + * + * @method Phaser.GameObjects.Components.Size#setDisplaySize + * @since 3.0.0 + * + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {this} This Game Object instance. + */ + setDisplaySize: function (width, height) { - out.r = r; - out.g = g; - out.b = b; - out.color = GetColor(r, g, b); + this.displayWidth = width; + this.displayHeight = height; - return out; + return this; } + }; -module.exports = HSVToRGB; +module.exports = Size; /***/ }), -/* 189 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 82081: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(38); -var IntegerToRGB = __webpack_require__(330); +var Frame = __webpack_require__(82047); + +// bitmask flag for GameObject.renderMask +var _FLAG = 8; // 1000 /** - * Converts the given color value into an instance of a Color object. + * Provides methods used for getting and setting the texture of a Game Object. * - * @function Phaser.Display.Color.IntegerToColor + * @namespace Phaser.GameObjects.Components.Texture * @since 3.0.0 - * - * @param {number} input - The color value to convert into a Color object. - * - * @return {Phaser.Display.Color} A Color object. */ -var IntegerToColor = function (input) -{ - var rgb = IntegerToRGB(input); - return new Color(rgb.r, rgb.g, rgb.b, rgb.a); -}; +var Texture = { -module.exports = IntegerToColor; + /** + * The Texture this Game Object is using to render with. + * + * @name Phaser.GameObjects.Components.Texture#texture + * @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture} + * @since 3.0.0 + */ + texture: null, + /** + * The Texture Frame this Game Object is using to render with. + * + * @name Phaser.GameObjects.Components.Texture#frame + * @type {Phaser.Textures.Frame} + * @since 3.0.0 + */ + frame: null, -/***/ }), -/* 190 */ -/***/ (function(module, exports) { + /** + * Internal flag. Not to be set by this Game Object. + * + * @name Phaser.GameObjects.Components.Texture#isCropped + * @type {boolean} + * @private + * @since 3.11.0 + */ + isCropped: false, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Sets the texture and frame this Game Object will use to render with. + * + * Textures are referenced by their string-based keys, as stored in the Texture Manager. + * + * @method Phaser.GameObjects.Components.Texture#setTexture + * @since 3.0.0 + * + * @param {(string|Phaser.Textures.Texture)} key - The key of the texture to be used, as stored in the Texture Manager, or a Texture instance. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. + * + * @return {this} This Game Object instance. + */ + setTexture: function (key, frame) + { + this.texture = this.scene.sys.textures.get(key); -// Centers this Rectangle so that the center coordinates match the given x and y values. + return this.setFrame(frame); + }, -/** - * Moves the top-left corner of a Rectangle so that its center is at the given coordinates. - * - * @function Phaser.Geom.Rectangle.CenterOn - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [rect,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to be centered. - * @param {number} x - The X coordinate of the Rectangle's center. - * @param {number} y - The Y coordinate of the Rectangle's center. - * - * @return {Phaser.Geom.Rectangle} The centered rectangle. - */ -var CenterOn = function (rect, x, y) -{ - rect.x = x - (rect.width / 2); - rect.y = y - (rect.height / 2); + /** + * Sets the frame this Game Object will use to render with. + * + * If you pass a string or index then the Frame has to belong to the current Texture being used + * by this Game Object. + * + * If you pass a Frame instance, then the Texture being used by this Game Object will also be updated. + * + * Calling `setFrame` will modify the `width` and `height` properties of your Game Object. + * + * It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer. + * + * @method Phaser.GameObjects.Components.Texture#setFrame + * @since 3.0.0 + * + * @param {(string|number|Phaser.Textures.Frame)} frame - The name or index of the frame within the Texture, or a Frame instance. + * @param {boolean} [updateSize=true] - Should this call adjust the size of the Game Object? + * @param {boolean} [updateOrigin=true] - Should this call adjust the origin of the Game Object? + * + * @return {this} This Game Object instance. + */ + setFrame: function (frame, updateSize, updateOrigin) + { + if (updateSize === undefined) { updateSize = true; } + if (updateOrigin === undefined) { updateOrigin = true; } + + if (frame instanceof Frame) + { + this.texture = this.scene.sys.textures.get(frame.texture.key); + + this.frame = frame; + } + else + { + this.frame = this.texture.get(frame); + } + + if (!this.frame.cutWidth || !this.frame.cutHeight) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } + + if (this._sizeComponent && updateSize) + { + this.setSizeToFrame(); + } + + if (this._originComponent && updateOrigin) + { + if (this.frame.customPivot) + { + this.setOrigin(this.frame.pivotX, this.frame.pivotY); + } + else + { + this.updateDisplayOrigin(); + } + } + + return this; + } - return rect; }; -module.exports = CenterOn; +module.exports = Texture; /***/ }), -/* 191 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 21850: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var OS = __webpack_require__(105); -var Browser = __webpack_require__(136); -var CanvasPool = __webpack_require__(31); +var Frame = __webpack_require__(82047); + +// bitmask flag for GameObject.renderMask +var _FLAG = 8; // 1000 /** - * Determines the features of the browser running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.features` from within any Scene. + * Provides methods used for getting and setting the texture of a Game Object. * - * @typedef {object} Phaser.Device.Features + * @namespace Phaser.GameObjects.Components.TextureCrop * @since 3.0.0 - * - * @property {?boolean} canvasBitBltShift - True if canvas supports a 'copy' bitblt onto itself when the source and destination regions overlap. - * @property {boolean} canvas - Is canvas available? - * @property {boolean} file - Is file available? - * @property {boolean} fileSystem - Is fileSystem available? - * @property {boolean} getUserMedia - Does the device support the getUserMedia API? - * @property {boolean} littleEndian - Is the device big or little endian? (only detected if the browser supports TypedArrays) - * @property {boolean} localStorage - Is localStorage available? - * @property {boolean} pointerLock - Is Pointer Lock available? - * @property {boolean} support32bit - Does the device context support 32bit pixel manipulation using array buffer views? - * @property {boolean} vibration - Does the device support the Vibration API? - * @property {boolean} webGL - Is webGL available? - * @property {boolean} worker - Is worker available? */ -var Features = { - canvas: false, - canvasBitBltShift: null, - file: false, - fileSystem: false, - getUserMedia: true, - littleEndian: false, - localStorage: false, - pointerLock: false, - support32bit: false, - vibration: false, - webGL: false, - worker: false +var TextureCrop = { -}; + /** + * The Texture this Game Object is using to render with. + * + * @name Phaser.GameObjects.Components.TextureCrop#texture + * @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture} + * @since 3.0.0 + */ + texture: null, -// Check Little or Big Endian system. -// @author Matt DesLauriers (@mattdesl) -function checkIsLittleEndian () -{ - var a = new ArrayBuffer(4); - var b = new Uint8Array(a); - var c = new Uint32Array(a); + /** + * The Texture Frame this Game Object is using to render with. + * + * @name Phaser.GameObjects.Components.TextureCrop#frame + * @type {Phaser.Textures.Frame} + * @since 3.0.0 + */ + frame: null, - b[0] = 0xa1; - b[1] = 0xb2; - b[2] = 0xc3; - b[3] = 0xd4; + /** + * A boolean flag indicating if this Game Object is being cropped or not. + * You can toggle this at any time after `setCrop` has been called, to turn cropping on or off. + * Equally, calling `setCrop` with no arguments will reset the crop and disable it. + * + * @name Phaser.GameObjects.Components.TextureCrop#isCropped + * @type {boolean} + * @since 3.11.0 + */ + isCropped: false, - if (c[0] === 0xd4c3b2a1) + /** + * Applies a crop to a texture based Game Object, such as a Sprite or Image. + * + * The crop is a rectangle that limits the area of the texture frame that is visible during rendering. + * + * Cropping a Game Object does not change its size, dimensions, physics body or hit area, it just + * changes what is shown when rendered. + * + * The crop coordinates are relative to the texture frame, not the Game Object, meaning 0 x 0 is the top-left. + * + * Therefore, if you had a Game Object that had an 800x600 sized texture, and you wanted to show only the left + * half of it, you could call `setCrop(0, 0, 400, 600)`. + * + * It is also scaled to match the Game Object scale automatically. Therefore a crop rect of 100x50 would crop + * an area of 200x100 when applied to a Game Object that had a scale factor of 2. + * + * You can either pass in numeric values directly, or you can provide a single Rectangle object as the first argument. + * + * Call this method with no arguments at all to reset the crop, or toggle the property `isCropped` to `false`. + * + * You should do this if the crop rectangle becomes the same size as the frame itself, as it will allow + * the renderer to skip several internal calculations. + * + * @method Phaser.GameObjects.Components.TextureCrop#setCrop + * @since 3.11.0 + * + * @param {(number|Phaser.Geom.Rectangle)} [x] - The x coordinate to start the crop from. Or a Phaser.Geom.Rectangle object, in which case the rest of the arguments are ignored. + * @param {number} [y] - The y coordinate to start the crop from. + * @param {number} [width] - The width of the crop rectangle in pixels. + * @param {number} [height] - The height of the crop rectangle in pixels. + * + * @return {this} This Game Object instance. + */ + setCrop: function (x, y, width, height) { - return true; - } + if (x === undefined) + { + this.isCropped = false; + } + else if (this.frame) + { + if (typeof x === 'number') + { + this.frame.setCropUVs(this._crop, x, y, width, height, this.flipX, this.flipY); + } + else + { + var rect = x; - if (c[0] === 0xa1b2c3d4) - { - return false; - } - else - { - // Could not determine endianness - return null; - } -} + this.frame.setCropUVs(this._crop, rect.x, rect.y, rect.width, rect.height, this.flipX, this.flipY); + } -function init () -{ - if (typeof importScripts === 'function') - { - return Features; - } + this.isCropped = true; + } - Features.canvas = !!window['CanvasRenderingContext2D']; + return this; + }, - try - { - Features.localStorage = !!localStorage.getItem; - } - catch (error) + /** + * Sets the texture and frame this Game Object will use to render with. + * + * Textures are referenced by their string-based keys, as stored in the Texture Manager. + * + * @method Phaser.GameObjects.Components.TextureCrop#setTexture + * @since 3.0.0 + * + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. + * + * @return {this} This Game Object instance. + */ + setTexture: function (key, frame) { - Features.localStorage = false; - } - - Features.file = !!window['File'] && !!window['FileReader'] && !!window['FileList'] && !!window['Blob']; - Features.fileSystem = !!window['requestFileSystem']; + this.texture = this.scene.sys.textures.get(key); - var isUint8 = false; + return this.setFrame(frame); + }, - var testWebGL = function () + /** + * Sets the frame this Game Object will use to render with. + * + * If you pass a string or index then the Frame has to belong to the current Texture being used + * by this Game Object. + * + * If you pass a Frame instance, then the Texture being used by this Game Object will also be updated. + * + * Calling `setFrame` will modify the `width` and `height` properties of your Game Object. + * + * It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer. + * + * @method Phaser.GameObjects.Components.TextureCrop#setFrame + * @since 3.0.0 + * + * @param {(string|number|Phaser.Textures.Frame)} frame - The name or index of the frame within the Texture, or a Frame instance. + * @param {boolean} [updateSize=true] - Should this call adjust the size of the Game Object? + * @param {boolean} [updateOrigin=true] - Should this call adjust the origin of the Game Object? + * + * @return {this} This Game Object instance. + */ + setFrame: function (frame, updateSize, updateOrigin) { - if (window['WebGLRenderingContext']) - { - try - { - var canvas = CanvasPool.createWebGL(this); - - var ctx = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); - - var canvas2D = CanvasPool.create2D(this); + if (updateSize === undefined) { updateSize = true; } + if (updateOrigin === undefined) { updateOrigin = true; } - var ctx2D = canvas2D.getContext('2d'); + if (frame instanceof Frame) + { + this.texture = this.scene.sys.textures.get(frame.texture.key); - // Can't be done on a webgl context - var image = ctx2D.createImageData(1, 1); + this.frame = frame; + } + else + { + this.frame = this.texture.get(frame); + } - // Test to see if ImageData uses CanvasPixelArray or Uint8ClampedArray. - // @author Matt DesLauriers (@mattdesl) - isUint8 = image.data instanceof Uint8ClampedArray; + if (!this.frame.cutWidth || !this.frame.cutHeight) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } - CanvasPool.remove(canvas); - CanvasPool.remove(canvas2D); + if (this._sizeComponent && updateSize) + { + this.setSizeToFrame(); + } - return !!ctx; + if (this._originComponent && updateOrigin) + { + if (this.frame.customPivot) + { + this.setOrigin(this.frame.pivotX, this.frame.pivotY); } - catch (e) + else { - return false; + this.updateDisplayOrigin(); } } - return false; - }; - - Features.webGL = testWebGL(); - - Features.worker = !!window['Worker']; - - Features.pointerLock = 'pointerLockElement' in document || 'mozPointerLockElement' in document || 'webkitPointerLockElement' in document; - - navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia; - - window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL; - - Features.getUserMedia = Features.getUserMedia && !!navigator.getUserMedia && !!window.URL; - - // Older versions of firefox (< 21) apparently claim support but user media does not actually work - if (Browser.firefox && Browser.firefoxVersion < 21) - { - Features.getUserMedia = false; - } - - // Excludes iOS versions as they generally wrap UIWebView (eg. Safari WebKit) and it - // is safer to not try and use the fast copy-over method. - if (!OS.iOS && (Browser.ie || Browser.firefox || Browser.chrome)) - { - Features.canvasBitBltShift = true; - } - - // Known not to work - if (Browser.safari || Browser.mobileSafari) - { - Features.canvasBitBltShift = false; - } - - navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate; + if (this.isCropped) + { + this.frame.updateCropUVs(this._crop, this.flipX, this.flipY); + } - if (navigator.vibrate) - { - Features.vibration = true; - } + return this; + }, - if (typeof ArrayBuffer !== 'undefined' && typeof Uint8Array !== 'undefined' && typeof Uint32Array !== 'undefined') + /** + * Internal method that returns a blank, well-formed crop object for use by a Game Object. + * + * @method Phaser.GameObjects.Components.TextureCrop#resetCropObject + * @private + * @since 3.12.0 + * + * @return {object} The crop object. + */ + resetCropObject: function () { - Features.littleEndian = checkIsLittleEndian(); + return { u0: 0, v0: 0, u1: 0, v1: 0, width: 0, height: 0, x: 0, y: 0, flipX: false, flipY: false, cx: 0, cy: 0, cw: 0, ch: 0 }; } - Features.support32bit = ( - typeof ArrayBuffer !== 'undefined' && - typeof Uint8ClampedArray !== 'undefined' && - typeof Int32Array !== 'undefined' && - Features.littleEndian !== null && - isUint8 - ); - - return Features; -} +}; -module.exports = init(); +module.exports = TextureCrop; /***/ }), -/* 192 */ -/***/ (function(module, exports) { + +/***/ 58072: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Browser specific prefix, so not going to change between contexts, only between browsers -var prefix = ''; - /** - * @namespace Phaser.Display.Canvas.Smoothing + * Provides methods used for setting the tint of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @namespace Phaser.GameObjects.Components.Tint + * @webglOnly * @since 3.0.0 */ -var Smoothing = function () -{ + +var Tint = { + /** - * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set. + * The tint value being applied to the top-left vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. * - * @function Phaser.Display.Canvas.Smoothing.getPrefix + * @name Phaser.GameObjects.Components.Tint#tintTopLeft + * @type {number} + * @default 0xffffff * @since 3.0.0 + */ + tintTopLeft: 0xffffff, + + /** + * The tint value being applied to the top-right vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The canvas context to check. + * @name Phaser.GameObjects.Components.Tint#tintTopRight + * @type {number} + * @default 0xffffff + * @since 3.0.0 + */ + tintTopRight: 0xffffff, + + /** + * The tint value being applied to the bottom-left vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. * - * @return {string} The name of the property on the context which controls image smoothing (either `imageSmoothingEnabled` or a vendor-prefixed version thereof), or `null` if not supported. + * @name Phaser.GameObjects.Components.Tint#tintBottomLeft + * @type {number} + * @default 0xffffff + * @since 3.0.0 */ - var getPrefix = function (context) - { - var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ]; + tintBottomLeft: 0xffffff, - for (var i = 0; i < vendors.length; i++) - { - var s = vendors[i] + 'mageSmoothingEnabled'; + /** + * The tint value being applied to the bottom-right vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. + * + * @name Phaser.GameObjects.Components.Tint#tintBottomRight + * @type {number} + * @default 0xffffff + * @since 3.0.0 + */ + tintBottomRight: 0xffffff, - if (s in context) - { - return s; - } - } + /** + * The tint fill mode. + * + * `false` = An additive tint (the default), where vertices colors are blended with the texture. + * `true` = A fill tint, where the vertices colors replace the texture, but respects texture alpha. + * + * @name Phaser.GameObjects.Components.Tint#tintFill + * @type {boolean} + * @default false + * @since 3.11.0 + */ + tintFill: false, - return null; - }; + /** + * Clears all tint values associated with this Game Object. + * + * Immediately sets the color values back to 0xffffff and the tint type to 'additive', + * which results in no visible change to the texture. + * + * @method Phaser.GameObjects.Components.Tint#clearTint + * @webglOnly + * @since 3.0.0 + * + * @return {this} This Game Object instance. + */ + clearTint: function () + { + this.setTint(0xffffff); + + return this; + }, /** - * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. - * By default browsers have image smoothing enabled, which isn't always what you visually want, especially - * when using pixel art in a game. Note that this sets the property on the context itself, so that any image - * drawn to the context will be affected. This sets the property across all current browsers but support is - * patchy on earlier browsers, especially on mobile. + * Sets an additive tint on this Game Object. * - * @function Phaser.Display.Canvas.Smoothing.enable + * The tint works by taking the pixel color values from the Game Objects texture, and then + * multiplying it by the color value of the tint. You can provide either one color value, + * in which case the whole Game Object will be tinted in that color. Or you can provide a color + * per corner. The colors are blended together across the extent of the Game Object. + * + * To modify the tint color once set, either call this method again with new values or use the + * `tint` property to set all colors at once. Or, use the properties `tintTopLeft`, `tintTopRight, + * `tintBottomLeft` and `tintBottomRight` to set the corner color values independently. + * + * To remove a tint call `clearTint`. + * + * To swap this from being an additive tint to a fill based tint set the property `tintFill` to `true`. + * + * @method Phaser.GameObjects.Components.Tint#setTint + * @webglOnly * @since 3.0.0 * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to enable smoothing. + * @param {number} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If no other values are given this value is applied evenly, tinting the whole Game Object. + * @param {number} [topRight] - The tint being applied to the top-right of the Game Object. + * @param {number} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. + * @param {number} [bottomRight] - The tint being applied to the bottom-right of the Game Object. * - * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. + * @return {this} This Game Object instance. */ - var enable = function (context) + setTint: function (topLeft, topRight, bottomLeft, bottomRight) { - if (prefix === '') - { - prefix = getPrefix(context); - } + if (topLeft === undefined) { topLeft = 0xffffff; } - if (prefix) + if (topRight === undefined) { - context[prefix] = true; + topRight = topLeft; + bottomLeft = topLeft; + bottomRight = topLeft; } - return context; - }; + this.tintTopLeft = topLeft; + this.tintTopRight = topRight; + this.tintBottomLeft = bottomLeft; + this.tintBottomRight = bottomRight; + + this.tintFill = false; + + return this; + }, /** - * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing. - * By default browsers have image smoothing enabled, which isn't always what you visually want, especially - * when using pixel art in a game. Note that this sets the property on the context itself, so that any image - * drawn to the context will be affected. This sets the property across all current browsers but support is - * patchy on earlier browsers, especially on mobile. + * Sets a fill-based tint on this Game Object. * - * @function Phaser.Display.Canvas.Smoothing.disable - * @since 3.0.0 + * Unlike an additive tint, a fill-tint literally replaces the pixel colors from the texture + * with those in the tint. You can use this for effects such as making a player flash 'white' + * if hit by something. You can provide either one color value, in which case the whole + * Game Object will be rendered in that color. Or you can provide a color per corner. The colors + * are blended together across the extent of the Game Object. * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context on which to disable smoothing. + * To modify the tint color once set, either call this method again with new values or use the + * `tint` property to set all colors at once. Or, use the properties `tintTopLeft`, `tintTopRight, + * `tintBottomLeft` and `tintBottomRight` to set the corner color values independently. * - * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context. + * To remove a tint call `clearTint`. + * + * To swap this from being a fill-tint to an additive tint set the property `tintFill` to `false`. + * + * @method Phaser.GameObjects.Components.Tint#setTintFill + * @webglOnly + * @since 3.11.0 + * + * @param {number} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If not other values are given this value is applied evenly, tinting the whole Game Object. + * @param {number} [topRight] - The tint being applied to the top-right of the Game Object. + * @param {number} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. + * @param {number} [bottomRight] - The tint being applied to the bottom-right of the Game Object. + * + * @return {this} This Game Object instance. */ - var disable = function (context) + setTintFill: function (topLeft, topRight, bottomLeft, bottomRight) { - if (prefix === '') - { - prefix = getPrefix(context); - } + this.setTint(topLeft, topRight, bottomLeft, bottomRight); - if (prefix) - { - context[prefix] = false; - } + this.tintFill = true; - return context; - }; + return this; + }, /** - * Returns `true` if the given context has image smoothing enabled, otherwise returns `false`. - * Returns null if no smoothing prefix is available. + * The tint value being applied to the whole of the Game Object. + * This property is a setter-only. Use the properties `tintTopLeft` etc to read the current tint value. * - * @function Phaser.Display.Canvas.Smoothing.isEnabled + * @name Phaser.GameObjects.Components.Tint#tint + * @type {number} + * @webglOnly * @since 3.0.0 + */ + tint: { + + set: function (value) + { + this.setTint(value, value, value, value); + } + }, + + /** + * Does this Game Object have a tint applied? * - * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - The context to check. + * It checks to see if the 4 tint properties are set to the value 0xffffff + * and that the `tintFill` property is `false`. This indicates that a Game Object isn't tinted. * - * @return {?boolean} `true` if smoothing is enabled on the context, otherwise `false`. `null` if not supported. + * @name Phaser.GameObjects.Components.Tint#isTinted + * @type {boolean} + * @webglOnly + * @readonly + * @since 3.11.0 */ - var isEnabled = function (context) - { - return (prefix !== null) ? context[prefix] : null; - }; + isTinted: { - return { - disable: disable, - enable: enable, - getPrefix: getPrefix, - isEnabled: isEnabled - }; + get: function () + { + var white = 0xffffff; + + return ( + this.tintFill || + this.tintTopLeft !== white || + this.tintTopRight !== white || + this.tintBottomLeft !== white || + this.tintBottomRight !== white + ); + } + + } }; -module.exports = Smoothing(); +module.exports = Tint; /***/ }), -/* 193 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 48129: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(14); -var Extend = __webpack_require__(17); - /** - * @namespace Phaser.Math + * Build a JSON representation of the given Game Object. + * + * This is typically extended further by Game Object specific implementations. + * + * @method Phaser.GameObjects.Components.ToJSON + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to export as JSON. + * + * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. */ +var ToJSON = function (gameObject) +{ + var out = { + name: gameObject.name, + type: gameObject.type, + x: gameObject.x, + y: gameObject.y, + depth: gameObject.depth, + scale: { + x: gameObject.scaleX, + y: gameObject.scaleY + }, + origin: { + x: gameObject.originX, + y: gameObject.originY + }, + flipX: gameObject.flipX, + flipY: gameObject.flipY, + rotation: gameObject.rotation, + alpha: gameObject.alpha, + visible: gameObject.visible, + blendMode: gameObject.blendMode, + textureKey: '', + frameKey: '', + data: {} + }; -var PhaserMath = { - - // Collections of functions - Angle: __webpack_require__(812), - Distance: __webpack_require__(821), - Easing: __webpack_require__(826), - Fuzzy: __webpack_require__(827), - Interpolation: __webpack_require__(830), - Pow2: __webpack_require__(835), - Snap: __webpack_require__(837), - - // Expose the RNG Class - RandomDataGenerator: __webpack_require__(839), - - // Single functions - Average: __webpack_require__(840), - Bernstein: __webpack_require__(356), - Between: __webpack_require__(195), - CatmullRom: __webpack_require__(194), - CeilTo: __webpack_require__(841), - Clamp: __webpack_require__(18), - DegToRad: __webpack_require__(36), - Difference: __webpack_require__(842), - Euler: __webpack_require__(843), - Factorial: __webpack_require__(357), - FloatBetween: __webpack_require__(137), - FloorTo: __webpack_require__(844), - FromPercent: __webpack_require__(98), - GetSpeed: __webpack_require__(845), - IsEven: __webpack_require__(846), - IsEvenStrict: __webpack_require__(847), - Linear: __webpack_require__(135), - MaxAdd: __webpack_require__(848), - Median: __webpack_require__(849), - MinSub: __webpack_require__(850), - Percent: __webpack_require__(851), - RadToDeg: __webpack_require__(196), - RandomXY: __webpack_require__(852), - RandomXYZ: __webpack_require__(853), - RandomXYZW: __webpack_require__(854), - Rotate: __webpack_require__(362), - RotateAround: __webpack_require__(308), - RotateAroundDistance: __webpack_require__(182), - RotateTo: __webpack_require__(855), - RoundAwayFromZero: __webpack_require__(363), - RoundTo: __webpack_require__(856), - SinCosTableGenerator: __webpack_require__(857), - SmootherStep: __webpack_require__(183), - SmoothStep: __webpack_require__(184), - ToXY: __webpack_require__(858), - TransformXY: __webpack_require__(177), - Within: __webpack_require__(859), - Wrap: __webpack_require__(68), - - // Vector classes - Vector2: __webpack_require__(3), - Vector3: __webpack_require__(39), - Vector4: __webpack_require__(140), - Matrix3: __webpack_require__(364), - Matrix4: __webpack_require__(69), - Quaternion: __webpack_require__(365), - RotateVec3: __webpack_require__(860) + if (gameObject.texture) + { + out.textureKey = gameObject.texture.key; + out.frameKey = gameObject.frame.name; + } + return out; }; -// Merge in the consts - -PhaserMath = Extend(false, PhaserMath, CONST); - -// Export it - -module.exports = PhaserMath; +module.exports = ToJSON; /***/ }), -/* 194 */ -/***/ (function(module, exports) { + +/***/ 56584: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var MATH_CONST = __webpack_require__(83392); +var TransformMatrix = __webpack_require__(69360); +var TransformXY = __webpack_require__(64462); +var WrapAngle = __webpack_require__(35786); +var WrapAngleDegrees = __webpack_require__(62138); +var Vector2 = __webpack_require__(93736); + +// global bitmask flag for GameObject.renderMask (used by Scale) +var _FLAG = 4; // 0100 + /** - * Calculates a Catmull-Rom value from the given points, based on an alpha of 0.5. + * Provides methods used for getting and setting the position, scale and rotation of a Game Object. * - * @function Phaser.Math.CatmullRom + * @namespace Phaser.GameObjects.Components.Transform * @since 3.0.0 - * - * @param {number} t - The amount to interpolate by. - * @param {number} p0 - The first control point. - * @param {number} p1 - The second control point. - * @param {number} p2 - The third control point. - * @param {number} p3 - The fourth control point. - * - * @return {number} The Catmull-Rom value. - */ -var CatmullRom = function (t, p0, p1, p2, p3) -{ - var v0 = (p2 - p0) * 0.5; - var v1 = (p3 - p1) * 0.5; - var t2 = t * t; - var t3 = t * t2; - - return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; -}; - -module.exports = CatmullRom; - - -/***/ }), -/* 195 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Compute a random integer between the `min` and `max` values, inclusive. - * - * @function Phaser.Math.Between - * @since 3.0.0 - * - * @param {number} min - The minimum value. - * @param {number} max - The maximum value. - * - * @return {number} The random integer. - */ -var Between = function (min, max) -{ - return Math.floor(Math.random() * (max - min + 1) + min); -}; - -module.exports = Between; - - -/***/ }), -/* 196 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CONST = __webpack_require__(14); - -/** - * Convert the given angle in radians, to the equivalent angle in degrees. - * - * @function Phaser.Math.RadToDeg - * @since 3.0.0 - * - * @param {number} radians - The angle in radians to convert ot degrees. - * - * @return {number} The given angle converted to degrees. - */ -var RadToDeg = function (radians) -{ - return radians * CONST.RAD_TO_DEG; -}; - -module.exports = RadToDeg; - - -/***/ }), -/* 197 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * The Default Plugins. - * - * @namespace Phaser.Plugins.DefaultPlugins - * @memberof Phaser.Plugins - * @since 3.0.0 - */ +var Transform = { -var DefaultPlugins = { + /** + * A property indicating that a Game Object has this component. + * + * @name Phaser.GameObjects.Components.Transform#hasTransformComponent + * @type {boolean} + * @readonly + * @default true + * @since 3.60.0 + */ + hasTransformComponent: true, /** - * These are the Global Managers that are created by the Phaser.Game instance. - * They are referenced from Scene.Systems so that plugins can use them. + * Private internal value. Holds the horizontal scale value. * - * @name Phaser.Plugins.DefaultPlugins.Global - * @type {array} + * @name Phaser.GameObjects.Components.Transform#_scaleX + * @type {number} + * @private + * @default 1 * @since 3.0.0 */ - Global: [ - - 'game', - 'anims', - 'cache', - 'plugins', - 'registry', - 'scale', - 'sound', - 'textures', - 'renderer' - - ], + _scaleX: 1, /** - * These are the core plugins that are installed into every Scene.Systems instance, no matter what. - * They are optionally exposed in the Scene as well (see the InjectionMap for details) - * - * They are created in the order in which they appear in this array and EventEmitter is always first. + * Private internal value. Holds the vertical scale value. * - * @name Phaser.Plugins.DefaultPlugins.CoreScene - * @type {array} + * @name Phaser.GameObjects.Components.Transform#_scaleY + * @type {number} + * @private + * @default 1 * @since 3.0.0 */ - CoreScene: [ - - 'EventEmitter', - - 'CameraManager', - 'GameObjectCreator', - 'GameObjectFactory', - 'ScenePlugin', - 'DisplayList', - 'UpdateList' - - ], + _scaleY: 1, /** - * These plugins are created in Scene.Systems in addition to the CoreScenePlugins. - * - * You can elect not to have these plugins by either creating a DefaultPlugins object as part - * of the Game Config, by creating a Plugins object as part of a Scene Config, or by modifying this array - * and building your own bundle. - * - * They are optionally exposed in the Scene as well (see the InjectionMap for details) - * - * They are always created in the order in which they appear in the array. + * Private internal value. Holds the rotation value in radians. * - * @name Phaser.Plugins.DefaultPlugins.DefaultScene - * @type {array} + * @name Phaser.GameObjects.Components.Transform#_rotation + * @type {number} + * @private + * @default 0 * @since 3.0.0 */ - DefaultScene: [ - - 'Clock', - 'DataManagerPlugin', - 'InputPlugin', - 'Loader', - 'TweenManager', - 'LightsPlugin' - - ] - -}; - -if (false) -{} - -if (false) -{} - -module.exports = DefaultPlugins; - - -/***/ }), -/* 198 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); - -/** - * @classdesc - * The ColorMatrix class creates a 5x4 matrix that can be used in shaders and graphics - * operations. It provides methods required to modify the color values, such as adjusting - * the brightness, setting a sepia tone, hue rotation and more. - * - * Use the method `getData` to return a Float32Array containing the current color values. - * - * @class ColorMatrix - * @memberof Phaser.Display - * @constructor - * @since 3.50.0 - */ -var ColorMatrix = new Class({ - - initialize: - - function ColorMatrix () - { - /** - * Internal ColorMatrix array. - * - * @name Phaser.Display.ColorMatrix#_matrix - * @type {number[]} - * @private - * @since 3.50.0 - */ - this._matrix = [ - 1, 0, 0, 0, 0, - 0, 1, 0, 0, 0, - 0, 0, 1, 0, 0, - 0, 0, 0, 1, 0 - ]; - - /** - * The value that determines how much of the original color is used - * when mixing the colors. A value between 0 (all original) and 1 (all final) - * - * @name Phaser.Display.ColorMatrix#alpha - * @type {number} - * @since 3.50.0 - */ - this.alpha = 1; - - /** - * Is the ColorMatrix array dirty? - * - * @name Phaser.Display.ColorMatrix#_dirty - * @type {boolean} - * @private - * @since 3.50.0 - */ - this._dirty = true; + _rotation: 0, - /** - * The matrix data as a Float32Array. - * - * Returned by the `getData` method. - * - * @name Phaser.Display.ColorMatrix#data - * @type {Float32Array} - * @private - * @since 3.50.0 - */ - this._data; - }, + /** + * The x position of this Game Object. + * + * @name Phaser.GameObjects.Components.Transform#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + x: 0, /** - * Sets this ColorMatrix from the given array of color values. + * The y position of this Game Object. * - * @method Phaser.Display.ColorMatrix#set - * @since 3.50.0 + * @name Phaser.GameObjects.Components.Transform#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + y: 0, + + /** + * The z position of this Game Object. * - * @param {number[]} value - The ColorMatrix values to set. + * Note: The z position does not control the rendering order of 2D Game Objects. Use + * {@link Phaser.GameObjects.Components.Depth#depth} instead. * - * @return {this} This ColorMatrix instance. + * @name Phaser.GameObjects.Components.Transform#z + * @type {number} + * @default 0 + * @since 3.0.0 */ - set: function (value) - { - this._matrix = value; - - this._dirty = true; + z: 0, - return this; - }, + /** + * The w position of this Game Object. + * + * @name Phaser.GameObjects.Components.Transform#w + * @type {number} + * @default 0 + * @since 3.0.0 + */ + w: 0, /** - * Resets the ColorMatrix. + * This is a special setter that allows you to set both the horizontal and vertical scale of this Game Object + * to the same value, at the same time. When reading this value the result returned is `(scaleX + scaleY) / 2`. * - * @method Phaser.Display.ColorMatrix#reset - * @since 3.50.0 + * Use of this property implies you wish the horizontal and vertical scales to be equal to each other. If this + * isn't the case, use the `scaleX` or `scaleY` properties instead. * - * @return {this} This ColorMatrix instance. + * @name Phaser.GameObjects.Components.Transform#scale + * @type {number} + * @default 1 + * @since 3.18.0 */ - reset: function () - { - // Long-winded, but saves on gc, which happens a lot in Post FX Shaders - // that reset the ColorMatrix every frame. - - var m = this._matrix; - - m[0] = 1; - m[1] = 0; - m[2] = 0; - m[3] = 0; - m[4] = 0; - - m[5] = 0; - m[6] = 1; - m[7] = 0; - m[8] = 0; - m[9] = 0; + scale: { - m[10] = 0; - m[11] = 0; - m[12] = 1; - m[13] = 0; - m[14] = 0; + get: function () + { + return (this._scaleX + this._scaleY) / 2; + }, - m[15] = 0; - m[16] = 0; - m[17] = 0; - m[18] = 1; - m[19] = 0; + set: function (value) + { + this._scaleX = value; + this._scaleY = value; - this._dirty = true; + if (value === 0) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } + } - return this; }, /** - * Gets the ColorMatrix as a Float32Array. - * - * Can be used directly as a 1fv shader uniform value. - * - * @method Phaser.Display.ColorMatrix#getData - * @since 3.50.0 + * The horizontal scale of this Game Object. * - * @return {Float32Array} The ColorMatrix as a Float32Array. + * @name Phaser.GameObjects.Components.Transform#scaleX + * @type {number} + * @default 1 + * @since 3.0.0 */ - getData: function () - { - if (this._dirty) - { - var f32 = new Float32Array(this._matrix); + scaleX: { - f32[4] /= 255; - f32[9] /= 255; - f32[14] /= 255; - f32[19] /= 255; + get: function () + { + return this._scaleX; + }, - this._data = f32; + set: function (value) + { + this._scaleX = value; - this._dirty = false; + if (value === 0) + { + this.renderFlags &= ~_FLAG; + } + else if (this._scaleY !== 0) + { + this.renderFlags |= _FLAG; + } } - return this._data; }, /** - * Changes the brightness of this ColorMatrix by the given amount. - * - * @method Phaser.Display.ColorMatrix#brightness - * @since 3.50.0 - * - * @param {number} [value=0] - The amount of brightness to apply to this ColorMatrix. Between 0 (black) and 1. - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * The vertical scale of this Game Object. * - * @return {this} This ColorMatrix instance. + * @name Phaser.GameObjects.Components.Transform#scaleY + * @type {number} + * @default 1 + * @since 3.0.0 */ - brightness: function (value, multiply) - { - if (value === undefined) { value = 0; } - if (multiply === undefined) { multiply = false; } + scaleY: { - var b = value; + get: function () + { + return this._scaleY; + }, + + set: function (value) + { + this._scaleY = value; + + if (value === 0) + { + this.renderFlags &= ~_FLAG; + } + else if (this._scaleX !== 0) + { + this.renderFlags |= _FLAG; + } + } - return this.multiply([ - b, 0, 0, 0, 0, - 0, b, 0, 0, 0, - 0, 0, b, 0, 0, - 0, 0, 0, 1, 0 - ], multiply); }, /** - * Changes the saturation of this ColorMatrix by the given amount. + * The angle of this Game Object as expressed in degrees. * - * @method Phaser.Display.ColorMatrix#saturate - * @since 3.50.0 + * Phaser uses a right-hand clockwise rotation system, where 0 is right, 90 is down, 180/-180 is left + * and -90 is up. * - * @param {number} [value=0] - The amount of saturation to apply to this ColorMatrix. - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * If you prefer to work in radians, see the `rotation` property instead. * - * @return {this} This ColorMatrix instance. + * @name Phaser.GameObjects.Components.Transform#angle + * @type {number} + * @default 0 + * @since 3.0.0 */ - saturate: function (value, multiply) - { - if (value === undefined) { value = 0; } - if (multiply === undefined) { multiply = false; } + angle: { - var x = (value * 2 / 3) + 1; - var y = ((x - 1) * -0.5); + get: function () + { + return WrapAngleDegrees(this._rotation * MATH_CONST.RAD_TO_DEG); + }, - return this.multiply([ - x, y, y, 0, 0, - y, x, y, 0, 0, - y, y, x, 0, 0, - 0, 0, 0, 1, 0 - ], multiply); + set: function (value) + { + // value is in degrees + this.rotation = WrapAngleDegrees(value) * MATH_CONST.DEG_TO_RAD; + } }, /** - * Desaturates this ColorMatrix (removes color from it). + * The angle of this Game Object in radians. * - * @method Phaser.Display.ColorMatrix#saturation - * @since 3.50.0 + * Phaser uses a right-hand clockwise rotation system, where 0 is right, PI/2 is down, +-PI is left + * and -PI/2 is up. * - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * If you prefer to work in degrees, see the `angle` property instead. * - * @return {this} This ColorMatrix instance. + * @name Phaser.GameObjects.Components.Transform#rotation + * @type {number} + * @default 1 + * @since 3.0.0 */ - desaturate: function (multiply) - { - if (multiply === undefined) { multiply = false; } + rotation: { - return this.saturate(-1, multiply); + get: function () + { + return this._rotation; + }, + + set: function (value) + { + // value is in radians + this._rotation = WrapAngle(value); + } }, /** - * Rotates the hues of this ColorMatrix by the value given. + * Sets the position of this Game Object. * - * @method Phaser.Display.ColorMatrix#hue - * @since 3.50.0 + * @method Phaser.GameObjects.Components.Transform#setPosition + * @since 3.0.0 * - * @param {number} [rotation=0] - The amount of hue rotation to apply to this ColorMatrix, in degrees. - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * @param {number} [x=0] - The x position of this Game Object. + * @param {number} [y=x] - The y position of this Game Object. If not set it will use the `x` value. + * @param {number} [z=0] - The z position of this Game Object. + * @param {number} [w=0] - The w position of this Game Object. * - * @return {this} This ColorMatrix instance. + * @return {this} This Game Object instance. */ - hue: function (rotation, multiply) + setPosition: function (x, y, z, w) { - if (rotation === undefined) { rotation = 0; } - if (multiply === undefined) { multiply = false; } - - rotation = rotation / 180 * Math.PI; + if (x === undefined) { x = 0; } + if (y === undefined) { y = x; } + if (z === undefined) { z = 0; } + if (w === undefined) { w = 0; } - var cos = Math.cos(rotation); - var sin = Math.sin(rotation); - var lumR = 0.213; - var lumG = 0.715; - var lumB = 0.072; + this.x = x; + this.y = y; + this.z = z; + this.w = w; - return this.multiply([ - lumR + cos * (1 - lumR) + sin * (-lumR),lumG + cos * (-lumG) + sin * (-lumG),lumB + cos * (-lumB) + sin * (1 - lumB), 0, 0, - lumR + cos * (-lumR) + sin * (0.143),lumG + cos * (1 - lumG) + sin * (0.140),lumB + cos * (-lumB) + sin * (-0.283), 0, 0, - lumR + cos * (-lumR) + sin * (-(1 - lumR)),lumG + cos * (-lumG) + sin * (lumG),lumB + cos * (1 - lumB) + sin * (lumB), 0, 0, - 0, 0, 0, 1, 0 - ], multiply); + return this; }, /** - * Sets this ColorMatrix to be grayscale. + * Copies an object's coordinates to this Game Object's position. * - * @method Phaser.Display.ColorMatrix#grayscale + * @method Phaser.GameObjects.Components.Transform#copyPosition * @since 3.50.0 * - * @param {number} [value=1] - The grayscale scale (0 is black). - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * @param {(Phaser.Types.Math.Vector2Like|Phaser.Types.Math.Vector3Like|Phaser.Types.Math.Vector4Like)} source - An object with numeric 'x', 'y', 'z', or 'w' properties. Undefined values are not copied. * - * @return {this} This ColorMatrix instance. + * @return {this} This Game Object instance. */ - grayscale: function (value, multiply) + copyPosition: function (source) { - if (value === undefined) { value = 1; } - if (multiply === undefined) { multiply = false; } + if (source.x !== undefined) { this.x = source.x; } + if (source.y !== undefined) { this.y = source.y; } + if (source.z !== undefined) { this.z = source.z; } + if (source.w !== undefined) { this.w = source.w; } - return this.saturate(-value, multiply); + return this; }, /** - * Sets this ColorMatrix to be black and white. - * - * @method Phaser.Display.ColorMatrix#blackWhite - * @since 3.50.0 + * Sets the position of this Game Object to be a random position within the confines of + * the given area. * - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * If no area is specified a random position between 0 x 0 and the game width x height is used instead. * - * @return {this} This ColorMatrix instance. - */ - blackWhite: function (multiply) - { - if (multiply === undefined) { multiply = false; } - - return this.multiply([ - 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 - ], multiply); - }, - - /** - * Change the contrast of this ColorMatrix by the amount given. + * The position does not factor in the size of this Game Object, meaning that only the origin is + * guaranteed to be within the area. * - * @method Phaser.Display.ColorMatrix#contrast - * @since 3.50.0 + * @method Phaser.GameObjects.Components.Transform#setRandomPosition + * @since 3.8.0 * - * @param {number} [value=0] - The amount of contrast to apply to this ColorMatrix. - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * @param {number} [x=0] - The x position of the top-left of the random area. + * @param {number} [y=0] - The y position of the top-left of the random area. + * @param {number} [width] - The width of the random area. + * @param {number} [height] - The height of the random area. * - * @return {this} This ColorMatrix instance. + * @return {this} This Game Object instance. */ - contrast: function (value, multiply) + setRandomPosition: function (x, y, width, height) { - if (value === undefined) { value = 0; } - if (multiply === undefined) { multiply = false; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } - var v = value + 1; - var o = -0.5 * (v - 1); + this.x = x + (Math.random() * width); + this.y = y + (Math.random() * height); - return this.multiply([ - v, 0, 0, 0, o, - 0, v, 0, 0, o, - 0, 0, v, 0, o, - 0, 0, 0, 1, 0 - ], multiply); + return this; }, /** - * Converts this ColorMatrix to have negative values. + * Sets the rotation of this Game Object. * - * @method Phaser.Display.ColorMatrix#negative - * @since 3.50.0 + * @method Phaser.GameObjects.Components.Transform#setRotation + * @since 3.0.0 * - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * @param {number} [radians=0] - The rotation of this Game Object, in radians. * - * @return {this} This ColorMatrix instance. + * @return {this} This Game Object instance. */ - negative: function (multiply) + setRotation: function (radians) { - if (multiply === undefined) { multiply = false; } + if (radians === undefined) { radians = 0; } - return this.multiply([ - -1, 0, 0, 1, 0, - 0, -1, 0, 1, 0, - 0, 0, -1, 1, 0, - 0, 0, 0, 1, 0 - ], multiply); + this.rotation = radians; + + return this; }, /** - * Apply a desaturated luminance to this ColorMatrix. + * Sets the angle of this Game Object. * - * @method Phaser.Display.ColorMatrix#desaturateLuminance - * @since 3.50.0 + * @method Phaser.GameObjects.Components.Transform#setAngle + * @since 3.0.0 * - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * @param {number} [degrees=0] - The rotation of this Game Object, in degrees. * - * @return {this} This ColorMatrix instance. + * @return {this} This Game Object instance. */ - desaturateLuminance: function (multiply) + setAngle: function (degrees) { - if (multiply === undefined) { multiply = false; } + if (degrees === undefined) { degrees = 0; } - return this.multiply([ - 0.2764723, 0.9297080, 0.0938197, 0, -37.1, - 0.2764723, 0.9297080, 0.0938197, 0, -37.1, - 0.2764723, 0.9297080, 0.0938197, 0, -37.1, - 0, 0, 0, 1, 0 - ], multiply); + this.angle = degrees; + + return this; }, /** - * Applies a sepia tone to this ColorMatrix. + * Sets the scale of this Game Object. * - * @method Phaser.Display.ColorMatrix#sepia - * @since 3.50.0 + * @method Phaser.GameObjects.Components.Transform#setScale + * @since 3.0.0 * - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * @param {number} [x=1] - The horizontal scale of this Game Object. + * @param {number} [y=x] - The vertical scale of this Game Object. If not set it will use the `x` value. * - * @return {this} This ColorMatrix instance. + * @return {this} This Game Object instance. */ - sepia: function (multiply) + setScale: function (x, y) { - if (multiply === undefined) { multiply = false; } + if (x === undefined) { x = 1; } + if (y === undefined) { y = x; } - return this.multiply([ - 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 - ], multiply); + this.scaleX = x; + this.scaleY = y; + + return this; }, /** - * Applies a night vision tone to this ColorMatrix. + * Sets the x position of this Game Object. * - * @method Phaser.Display.ColorMatrix#night - * @since 3.50.0 + * @method Phaser.GameObjects.Components.Transform#setX + * @since 3.0.0 * - * @param {number} [intensity=0.1] - The intensity of this effect. - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * @param {number} [value=0] - The x position of this Game Object. * - * @return {this} This ColorMatrix instance. + * @return {this} This Game Object instance. */ - night: function (intensity, multiply) + setX: function (value) { - if (intensity === undefined) { intensity = 0.1; } - if (multiply === undefined) { multiply = false; } + if (value === undefined) { value = 0; } - return this.multiply([ - intensity * (-2.0), -intensity, 0, 0, 0, - -intensity, 0, intensity, 0, 0, - 0, intensity, intensity * 2.0, 0, 0, - 0, 0, 0, 1, 0 - ], multiply); + this.x = value; + + return this; }, /** - * Applies a trippy color tone to this ColorMatrix. + * Sets the y position of this Game Object. * - * @method Phaser.Display.ColorMatrix#lsd - * @since 3.50.0 + * @method Phaser.GameObjects.Components.Transform#setY + * @since 3.0.0 * - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * @param {number} [value=0] - The y position of this Game Object. * - * @return {this} This ColorMatrix instance. + * @return {this} This Game Object instance. */ - lsd: function (multiply) + setY: function (value) { - if (multiply === undefined) { multiply = false; } + if (value === undefined) { value = 0; } - return this.multiply([ - 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 - ], multiply); + this.y = value; + + return this; }, /** - * Applies a brown tone to this ColorMatrix. + * Sets the z position of this Game Object. * - * @method Phaser.Display.ColorMatrix#brown - * @since 3.50.0 + * Note: The z position does not control the rendering order of 2D Game Objects. Use + * {@link Phaser.GameObjects.Components.Depth#setDepth} instead. * - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * @method Phaser.GameObjects.Components.Transform#setZ + * @since 3.0.0 * - * @return {this} This ColorMatrix instance. + * @param {number} [value=0] - The z position of this Game Object. + * + * @return {this} This Game Object instance. */ - brown: function (multiply) + setZ: function (value) { - if (multiply === undefined) { multiply = false; } + if (value === undefined) { value = 0; } - return this.multiply([ - 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 - ], multiply); + this.z = value; + + return this; }, /** - * Applies a vintage pinhole color effect to this ColorMatrix. + * Sets the w position of this Game Object. * - * @method Phaser.Display.ColorMatrix#vintagePinhole - * @since 3.50.0 + * @method Phaser.GameObjects.Components.Transform#setW + * @since 3.0.0 * - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * @param {number} [value=0] - The w position of this Game Object. * - * @return {this} This ColorMatrix instance. + * @return {this} This Game Object instance. */ - vintagePinhole: function (multiply) + setW: function (value) { - if (multiply === undefined) { multiply = false; } + if (value === undefined) { value = 0; } - return this.multiply([ - 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 - ], multiply); + this.w = value; + + return this; }, /** - * Applies a kodachrome color effect to this ColorMatrix. + * Gets the local transform matrix for this Game Object. * - * @method Phaser.Display.ColorMatrix#kodachrome - * @since 3.50.0 + * @method Phaser.GameObjects.Components.Transform#getLocalTransformMatrix + * @since 3.4.0 * - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * @param {Phaser.GameObjects.Components.TransformMatrix} [tempMatrix] - The matrix to populate with the values from this Game Object. * - * @return {this} This ColorMatrix instance. + * @return {Phaser.GameObjects.Components.TransformMatrix} The populated Transform Matrix. */ - kodachrome: function (multiply) + getLocalTransformMatrix: function (tempMatrix) { - if (multiply === undefined) { multiply = false; } + if (tempMatrix === undefined) { tempMatrix = new TransformMatrix(); } - return this.multiply([ - 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 - ], multiply); + return tempMatrix.applyITRS(this.x, this.y, this._rotation, this._scaleX, this._scaleY); }, /** - * Applies a technicolor color effect to this ColorMatrix. + * Gets the world transform matrix for this Game Object, factoring in any parent Containers. * - * @method Phaser.Display.ColorMatrix#technicolor - * @since 3.50.0 + * @method Phaser.GameObjects.Components.Transform#getWorldTransformMatrix + * @since 3.4.0 * - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? + * @param {Phaser.GameObjects.Components.TransformMatrix} [tempMatrix] - The matrix to populate with the values from this Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - A temporary matrix to hold parent values during the calculations. * - * @return {this} This ColorMatrix instance. + * @return {Phaser.GameObjects.Components.TransformMatrix} The populated Transform Matrix. */ - technicolor: function (multiply) + getWorldTransformMatrix: function (tempMatrix, parentMatrix) { - if (multiply === undefined) { multiply = false; } + if (tempMatrix === undefined) { tempMatrix = new TransformMatrix(); } - return this.multiply([ - 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 - ], multiply); - }, + var parent = this.parentContainer; - /** - * Applies a polaroid color effect to this ColorMatrix. - * - * @method Phaser.Display.ColorMatrix#polaroid - * @since 3.50.0 - * - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? - * - * @return {this} This ColorMatrix instance. - */ - polaroid: function (multiply) - { - if (multiply === undefined) { multiply = false; } + if (!parent) + { + return this.getLocalTransformMatrix(tempMatrix); + } - return this.multiply([ - 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 - ], multiply); - }, + if (!parentMatrix) + { + parentMatrix = new TransformMatrix(); + } - /** - * Shifts the values of this ColorMatrix into BGR order. - * - * @method Phaser.Display.ColorMatrix#shiftToBGR - * @since 3.50.0 - * - * @param {boolean} [multiply=false] - Multiply the resulting ColorMatrix (`true`), or set it (`false`) ? - * - * @return {this} This ColorMatrix instance. - */ - shiftToBGR: function (multiply) - { - if (multiply === undefined) { multiply = false; } + tempMatrix.applyITRS(this.x, this.y, this._rotation, this._scaleX, this._scaleY); - return this.multiply([ - 0, 0, 1, 0, 0, - 0, 1, 0, 0, 0, - 1, 0, 0, 0, 0, - 0, 0, 0, 1, 0 - ], multiply); + while (parent) + { + parentMatrix.applyITRS(parent.x, parent.y, parent._rotation, parent._scaleX, parent._scaleY); + + parentMatrix.multiply(tempMatrix, tempMatrix); + + parent = parent.parentContainer; + } + + return tempMatrix; }, /** - * Multiplies the two given matrices. + * Takes the given `x` and `y` coordinates and converts them into local space for this + * Game Object, taking into account parent and local transforms, and the Display Origin. * - * @method Phaser.Display.ColorMatrix#multiply + * The returned Vector2 contains the translated point in its properties. + * + * A Camera needs to be provided in order to handle modified scroll factors. If no + * camera is specified, it will use the `main` camera from the Scene to which this + * Game Object belongs. + * + * @method Phaser.GameObjects.Components.Transform#getLocalPoint * @since 3.50.0 * - * @param {number[]} a - The 5x4 array to multiply with ColorMatrix._matrix. + * @param {number} x - The x position to translate. + * @param {number} y - The y position to translate. + * @param {Phaser.Math.Vector2} [point] - A Vector2, or point-like object, to store the results in. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera which is being tested against. If not given will use the Scene default camera. * - * @return {this} This ColorMatrix instance. + * @return {Phaser.Math.Vector2} The translated point. */ - multiply: function (a, multiply) + getLocalPoint: function (x, y, point, camera) { - // Duplicate _matrix into c + if (!point) { point = new Vector2(); } + if (!camera) { camera = this.scene.sys.cameras.main; } - if (!multiply) + var csx = camera.scrollX; + var csy = camera.scrollY; + + var px = x + (csx * this.scrollFactorX) - csx; + var py = y + (csy * this.scrollFactorY) - csy; + + if (this.parentContainer) { - this.reset(); + this.getWorldTransformMatrix().applyInverse(px, py, point); + } + else + { + TransformXY(px, py, this.x, this.y, this.rotation, this.scaleX, this.scaleY, point); } - var m = this._matrix; - var c = []; - - for (var i = 0; i < 20; i++) + // Normalize origin + if (this._originComponent) { - c[i] = m[i]; + point.x += this._displayOriginX; + point.y += this._displayOriginY; } - // R - m[0] = (c[0] * a[0]) + (c[1] * a[5]) + (c[2] * a[10]) + (c[3] * a[15]); - m[1] = (c[0] * a[1]) + (c[1] * a[6]) + (c[2] * a[11]) + (c[3] * a[16]); - m[2] = (c[0] * a[2]) + (c[1] * a[7]) + (c[2] * a[12]) + (c[3] * a[17]); - m[3] = (c[0] * a[3]) + (c[1] * a[8]) + (c[2] * a[13]) + (c[3] * a[18]); - m[4] = (c[0] * a[4]) + (c[1] * a[9]) + (c[2] * a[14]) + (c[3] * a[19]) + c[4]; + return point; + }, - // G - m[5] = (c[5] * a[0]) + (c[6] * a[5]) + (c[7] * a[10]) + (c[8] * a[15]); - m[6] = (c[5] * a[1]) + (c[6] * a[6]) + (c[7] * a[11]) + (c[8] * a[16]); - m[7] = (c[5] * a[2]) + (c[6] * a[7]) + (c[7] * a[12]) + (c[8] * a[17]); - m[8] = (c[5] * a[3]) + (c[6] * a[8]) + (c[7] * a[13]) + (c[8] * a[18]); - m[9] = (c[5] * a[4]) + (c[6] * a[9]) + (c[7] * a[14]) + (c[8] * a[19]) + c[9]; + /** + * Gets the sum total rotation of all of this Game Objects parent Containers. + * + * The returned value is in radians and will be zero if this Game Object has no parent container. + * + * @method Phaser.GameObjects.Components.Transform#getParentRotation + * @since 3.18.0 + * + * @return {number} The sum total rotation, in radians, of all parent containers of this Game Object. + */ + getParentRotation: function () + { + var rotation = 0; - // B - m[10] = (c[10] * a[0]) + (c[11] * a[5]) + (c[12] * a[10]) + (c[13] * a[15]); - m[11] = (c[10] * a[1]) + (c[11] * a[6]) + (c[12] * a[11]) + (c[13] * a[16]); - m[12] = (c[10] * a[2]) + (c[11] * a[7]) + (c[12] * a[12]) + (c[13] * a[17]); - m[13] = (c[10] * a[3]) + (c[11] * a[8]) + (c[12] * a[13]) + (c[13] * a[18]); - m[14] = (c[10] * a[4]) + (c[11] * a[9]) + (c[12] * a[14]) + (c[13] * a[19]) + c[14]; + var parent = this.parentContainer; - // A - m[15] = (c[15] * a[0]) + (c[16] * a[5]) + (c[17] * a[10]) + (c[18] * a[15]); - m[16] = (c[15] * a[1]) + (c[16] * a[6]) + (c[17] * a[11]) + (c[18] * a[16]); - m[17] = (c[15] * a[2]) + (c[16] * a[7]) + (c[17] * a[12]) + (c[18] * a[17]); - m[18] = (c[15] * a[3]) + (c[16] * a[8]) + (c[17] * a[13]) + (c[18] * a[18]); - m[19] = (c[15] * a[4]) + (c[16] * a[9]) + (c[17] * a[14]) + (c[18] * a[19]) + c[19]; + while (parent) + { + rotation += parent.rotation; - this._dirty = true; + parent = parent.parentContainer; + } - return this; + return rotation; } -}); +}; -module.exports = ColorMatrix; +module.exports = Transform; /***/ }), -/* 199 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 69360: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Rectangle = __webpack_require__(10); -var MATH_CONST = __webpack_require__(14); - -// points is an array of Point-like objects, -// either 2 dimensional arrays, or objects with public x/y properties: -// var points = [ -// [100, 200], -// [200, 400], -// { x: 30, y: 60 } -// ] +var Class = __webpack_require__(56694); +var MATH_CONST = __webpack_require__(83392); +var Vector2 = __webpack_require__(93736); /** - * Constructs new Rectangle or repositions and resizes an existing Rectangle so that all of the given points are on or within its bounds. + * @classdesc + * A Matrix used for display transformations for rendering. * - * @function Phaser.Geom.Rectangle.FromPoints - * @since 3.0.0 + * It is represented like so: * - * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * ``` + * | a | c | tx | + * | b | d | ty | + * | 0 | 0 | 1 | + * ``` * - * @param {array} points - An array of points (either arrays with two elements corresponding to the X and Y coordinate or an object with public `x` and `y` properties) which should be surrounded by the Rectangle. - * @param {Phaser.Geom.Rectangle} [out] - Optional Rectangle to adjust. + * @class TransformMatrix + * @memberof Phaser.GameObjects.Components + * @constructor + * @since 3.0.0 * - * @return {Phaser.Geom.Rectangle} The adjusted `out` Rectangle, or a new Rectangle if none was provided. + * @param {number} [a=1] - The Scale X value. + * @param {number} [b=0] - The Skew Y value. + * @param {number} [c=0] - The Skew X value. + * @param {number} [d=1] - The Scale Y value. + * @param {number} [tx=0] - The Translate X value. + * @param {number} [ty=0] - The Translate Y value. */ -var FromPoints = function (points, out) -{ - if (out === undefined) { out = new Rectangle(); } +var TransformMatrix = new Class({ - if (points.length === 0) + initialize: + + function TransformMatrix (a, b, c, d, tx, ty) { - return out; - } + if (a === undefined) { a = 1; } + if (b === undefined) { b = 0; } + if (c === undefined) { c = 0; } + if (d === undefined) { d = 1; } + if (tx === undefined) { tx = 0; } + if (ty === undefined) { ty = 0; } - var minX = Number.MAX_VALUE; - var minY = Number.MAX_VALUE; + /** + * The matrix values. + * + * @name Phaser.GameObjects.Components.TransformMatrix#matrix + * @type {Float32Array} + * @since 3.0.0 + */ + this.matrix = new Float32Array([ a, b, c, d, tx, ty, 0, 0, 1 ]); - var maxX = MATH_CONST.MIN_SAFE_INTEGER; - var maxY = MATH_CONST.MIN_SAFE_INTEGER; + /** + * The decomposed matrix. + * + * @name Phaser.GameObjects.Components.TransformMatrix#decomposedMatrix + * @type {object} + * @since 3.0.0 + */ + this.decomposedMatrix = { + translateX: 0, + translateY: 0, + scaleX: 1, + scaleY: 1, + rotation: 0 + }; - var p; - var px; - var py; + /** + * The temporary quad value cache. + * + * @name Phaser.GameObjects.Components.TransformMatrix#quad + * @type {Float32Array} + * @since 3.60.0 + */ + this.quad = new Float32Array(8); + }, - for (var i = 0; i < points.length; i++) - { - p = points[i]; + /** + * The Scale X value. + * + * @name Phaser.GameObjects.Components.TransformMatrix#a + * @type {number} + * @since 3.4.0 + */ + a: { - if (Array.isArray(p)) + get: function () { - px = p[0]; - py = p[1]; - } - else + return this.matrix[0]; + }, + + set: function (value) { - px = p.x; - py = p.y; + this.matrix[0] = value; } - minX = Math.min(minX, px); - minY = Math.min(minY, py); + }, - maxX = Math.max(maxX, px); - maxY = Math.max(maxY, py); - } + /** + * The Skew Y value. + * + * @name Phaser.GameObjects.Components.TransformMatrix#b + * @type {number} + * @since 3.4.0 + */ + b: { - out.x = minX; - out.y = minY; - out.width = maxX - minX; - out.height = maxY - minY; + get: function () + { + return this.matrix[1]; + }, - return out; -}; + set: function (value) + { + this.matrix[1] = value; + } -module.exports = FromPoints; - - -/***/ }), -/* 200 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var NOOP = __webpack_require__(1); - -/** - * @classdesc - * The RGB class holds a single color value and allows for easy modification and reading of it, - * with optional on-change callback notification and a dirty flag. - * - * @class RGB - * @memberof Phaser.Display - * @constructor - * @since 3.50.0 - * - * @param {number} [red=0] - The red color value. A number between 0 and 1. - * @param {number} [green=0] - The green color value. A number between 0 and 1. - * @param {number} [blue=0] - The blue color value. A number between 0 and 1. - */ -var RGB = new Class({ - - initialize: - - function RGB (red, green, blue) - { - /** - * Cached RGB values. - * - * @name Phaser.Display.RGB#_rgb - * @type {number[]} - * @private - * @since 3.50.0 - */ - this._rgb = [ 0, 0, 0 ]; - - /** - * This callback will be invoked each time one of the RGB color values change. - * - * The callback is sent the new color values as the parameters. - * - * @name Phaser.Display.RGB#onChangeCallback - * @type {function} - * @since 3.50.0 - */ - this.onChangeCallback = NOOP; - - /** - * Is this color dirty? - * - * @name Phaser.Display.RGB#dirty - * @type {boolean} - * @since 3.50.0 - */ - this.dirty = false; - - this.set(red, green, blue); - }, + }, /** - * Sets the red, green and blue values of this RGB object, flags it as being - * dirty and then invokes the `onChangeCallback`, if set. - * - * @method Phaser.Display.RGB#set - * @since 3.50.0 - * - * @param {number} [red=0] - The red color value. A number between 0 and 1. - * @param {number} [green=0] - The green color value. A number between 0 and 1. - * @param {number} [blue=0] - The blue color value. A number between 0 and 1. + * The Skew X value. * - * @return {this} This RGB instance. + * @name Phaser.GameObjects.Components.TransformMatrix#c + * @type {number} + * @since 3.4.0 */ - set: function (red, green, blue) - { - if (red === undefined) { red = 0; } - if (green === undefined) { green = 0; } - if (blue === undefined) { blue = 0; } + c: { - this._rgb = [ red, green, blue ]; + get: function () + { + return this.matrix[2]; + }, - this.onChange(); + set: function (value) + { + this.matrix[2] = value; + } - return this; }, /** - * Compares the given rgb parameters with those in this object and returns - * a boolean `true` value if they are equal, otherwise it returns `false`. - * - * @method Phaser.Display.RGB#equals - * @since 3.50.0 - * - * @param {number} red - The red value to compare with this object. - * @param {number} green - The green value to compare with this object. - * @param {number} blue - The blue value to compare with this object. + * The Scale Y value. * - * @return {boolean} `true` if the given values match those in this object, otherwise `false`. + * @name Phaser.GameObjects.Components.TransformMatrix#d + * @type {number} + * @since 3.4.0 */ - equals: function (red, green, blue) - { - var rgb = this._rgb; + d: { + + get: function () + { + return this.matrix[3]; + }, + + set: function (value) + { + this.matrix[3] = value; + } - return (rgb.r === red && rgb.g === green && rgb.b === blue); }, /** - * Internal on change handler. Sets this object as being dirty and - * then invokes the `onChangeCallback`, if set, passing in the - * new RGB values. + * The Translate X value. * - * @method Phaser.Display.RGB#onChange - * @since 3.50.0 + * @name Phaser.GameObjects.Components.TransformMatrix#e + * @type {number} + * @since 3.11.0 */ - onChange: function () - { - this.dirty = true; + e: { - var rgb = this._rgb; + get: function () + { + return this.matrix[4]; + }, + + set: function (value) + { + this.matrix[4] = value; + } - this.onChangeCallback.call(this, rgb[0], rgb[1], rgb[2]); }, /** - * The red color value. Between 0 and 1. - * - * Changing this property will flag this RGB object as being dirty - * and invoke the `onChangeCallback` , if set. + * The Translate Y value. * - * @name Phaser.Display.RGB#r + * @name Phaser.GameObjects.Components.TransformMatrix#f * @type {number} - * @since 3.50.0 + * @since 3.11.0 */ - r: { + f: { get: function () { - return this._rgb[0]; + return this.matrix[5]; }, set: function (value) { - this._rgb[0] = value; - this.onChange(); + this.matrix[5] = value; } }, /** - * The green color value. Between 0 and 1. - * - * Changing this property will flag this RGB object as being dirty - * and invoke the `onChangeCallback` , if set. + * The Translate X value. * - * @name Phaser.Display.RGB#g + * @name Phaser.GameObjects.Components.TransformMatrix#tx * @type {number} - * @since 3.50.0 + * @since 3.4.0 */ - g: { + tx: { get: function () { - return this._rgb[1]; + return this.matrix[4]; }, set: function (value) { - this._rgb[1] = value; - this.onChange(); + this.matrix[4] = value; } }, /** - * The blue color value. Between 0 and 1. - * - * Changing this property will flag this RGB object as being dirty - * and invoke the `onChangeCallback` , if set. + * The Translate Y value. * - * @name Phaser.Display.RGB#b + * @name Phaser.GameObjects.Components.TransformMatrix#ty * @type {number} - * @since 3.50.0 + * @since 3.4.0 */ - b: { + ty: { get: function () { - return this._rgb[2]; + return this.matrix[5]; }, set: function (value) { - this._rgb[2] = value; - this.onChange(); + this.matrix[5] = value; } }, /** - * Nulls any external references this object contains. + * The rotation of the Matrix. Value is in radians. * - * @method Phaser.Display.RGB#destroy - * @since 3.50.0 + * @name Phaser.GameObjects.Components.TransformMatrix#rotation + * @type {number} + * @readonly + * @since 3.4.0 */ - destroy: function () - { - this.onChangeCallback = null; - } - -}); - -module.exports = RGB; - - -/***/ }), -/* 201 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CONST = { - - CENTER: __webpack_require__(403), - ORIENTATION: __webpack_require__(404), - SCALE_MODE: __webpack_require__(405), - ZOOM: __webpack_require__(406) - -}; - -module.exports = CONST; - - -/***/ }), -/* 202 */ -/***/ (function(module, exports) { + rotation: { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + get: function () + { + return Math.acos(this.a / this.scaleX) * ((Math.atan(-this.c / this.a) < 0) ? -1 : 1); + } -/** - * Attempts to remove the element from its parentNode in the DOM. - * - * @function Phaser.DOM.RemoveFromDOM - * @since 3.0.0 - * - * @param {HTMLElement} element - The DOM element to remove from its parent node. - */ -var RemoveFromDOM = function (element) -{ - if (element.parentNode) - { - element.parentNode.removeChild(element); - } -}; + }, -module.exports = RemoveFromDOM; + /** + * The rotation of the Matrix, normalized to be within the Phaser right-handed + * clockwise rotation space. Value is in radians. + * + * @name Phaser.GameObjects.Components.TransformMatrix#rotationNormalized + * @type {number} + * @readonly + * @since 3.19.0 + */ + rotationNormalized: { + get: function () + { + var matrix = this.matrix; -/***/ }), -/* 203 */ -/***/ (function(module, exports) { + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (a || b) + { + // var r = Math.sqrt(a * a + b * b); -var INPUT_CONST = { + return (b > 0) ? Math.acos(a / this.scaleX) : -Math.acos(a / this.scaleX); + } + else if (c || d) + { + // var s = Math.sqrt(c * c + d * d); - /** - * The mouse pointer is being held down. - * - * @name Phaser.Input.MOUSE_DOWN - * @type {number} - * @since 3.10.0 - */ - MOUSE_DOWN: 0, + return MATH_CONST.TAU - ((d > 0) ? Math.acos(-c / this.scaleY) : -Math.acos(c / this.scaleY)); + } + else + { + return 0; + } + } - /** - * The mouse pointer is being moved. - * - * @name Phaser.Input.MOUSE_MOVE - * @type {number} - * @since 3.10.0 - */ - MOUSE_MOVE: 1, + }, /** - * The mouse pointer is released. - * - * @name Phaser.Input.MOUSE_UP + * The decomposed horizontal scale of the Matrix. This value is always positive. + * + * @name Phaser.GameObjects.Components.TransformMatrix#scaleX * @type {number} - * @since 3.10.0 + * @readonly + * @since 3.4.0 */ - MOUSE_UP: 2, + scaleX: { - /** - * A touch pointer has been started. - * - * @name Phaser.Input.TOUCH_START - * @type {number} - * @since 3.10.0 - */ - TOUCH_START: 3, + get: function () + { + return Math.sqrt((this.a * this.a) + (this.b * this.b)); + } - /** - * A touch pointer has been started. - * - * @name Phaser.Input.TOUCH_MOVE - * @type {number} - * @since 3.10.0 - */ - TOUCH_MOVE: 4, + }, /** - * A touch pointer has been started. - * - * @name Phaser.Input.TOUCH_END + * The decomposed vertical scale of the Matrix. This value is always positive. + * + * @name Phaser.GameObjects.Components.TransformMatrix#scaleY * @type {number} - * @since 3.10.0 + * @readonly + * @since 3.4.0 */ - TOUCH_END: 5, + scaleY: { - /** - * The pointer lock has changed. - * - * @name Phaser.Input.POINTER_LOCK_CHANGE - * @type {number} - * @since 3.10.0 - */ - POINTER_LOCK_CHANGE: 6, + get: function () + { + return Math.sqrt((this.c * this.c) + (this.d * this.d)); + } - /** - * A touch pointer has been been cancelled by the browser. - * - * @name Phaser.Input.TOUCH_CANCEL - * @type {number} - * @since 3.15.0 - */ - TOUCH_CANCEL: 7, + }, /** - * The mouse wheel changes. - * - * @name Phaser.Input.MOUSE_WHEEL - * @type {number} - * @since 3.18.0 + * Reset the Matrix to an identity matrix. + * + * @method Phaser.GameObjects.Components.TransformMatrix#loadIdentity + * @since 3.0.0 + * + * @return {this} This TransformMatrix. */ - MOUSE_WHEEL: 8 - -}; - -module.exports = INPUT_CONST; - - -/***/ }), -/* 204 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var CONST = __webpack_require__(144); -var DefaultPlugins = __webpack_require__(197); -var Events = __webpack_require__(20); -var GetPhysicsPlugins = __webpack_require__(419); -var GetScenePlugins = __webpack_require__(420); -var GLOBAL_CONST = __webpack_require__(33); -var NOOP = __webpack_require__(1); -var Settings = __webpack_require__(421); - -/** - * @classdesc - * The Scene Systems class. - * - * This class is available from within a Scene under the property `sys`. - * It is responsible for managing all of the plugins a Scene has running, including the display list, and - * handling the update step and renderer. It also contains references to global systems belonging to Game. - * - * @class Systems - * @memberof Phaser.Scenes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene that owns this Systems instance. - * @param {(string|Phaser.Types.Scenes.SettingsConfig)} config - Scene specific configuration settings. - */ -var Systems = new Class({ - - initialize: - - function Systems (scene, config) + loadIdentity: function () { - /** - * A reference to the Scene that these Systems belong to. - * - * @name Phaser.Scenes.Systems#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; - - /** - * A reference to the Phaser Game instance. - * - * @name Phaser.Scenes.Systems#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game; - - /** - * A reference to either the Canvas or WebGL Renderer that this Game is using. - * - * @name Phaser.Scenes.Systems#renderer - * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} - * @since 3.17.0 - */ - this.renderer; - - if (false) - {} - - /** - * The Scene Configuration object, as passed in when creating the Scene. - * - * @name Phaser.Scenes.Systems#config - * @type {(string|Phaser.Types.Scenes.SettingsConfig)} - * @since 3.0.0 - */ - this.config = config; - - /** - * The Scene Settings. This is the parsed output based on the Scene configuration. - * - * @name Phaser.Scenes.Systems#settings - * @type {Phaser.Types.Scenes.SettingsObject} - * @since 3.0.0 - */ - this.settings = Settings.create(config); - - /** - * A handy reference to the Scene canvas / context. - * - * @name Phaser.Scenes.Systems#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas; - - /** - * A reference to the Canvas Rendering Context being used by the renderer. - * - * @name Phaser.Scenes.Systems#context - * @type {CanvasRenderingContext2D} - * @since 3.0.0 - */ - this.context; - - // Global Systems - these are single-instance global managers that belong to Game - - /** - * A reference to the global Animations Manager. - * - * In the default set-up you can access this from within a Scene via the `this.anims` property. - * - * @name Phaser.Scenes.Systems#anims - * @type {Phaser.Animations.AnimationManager} - * @since 3.0.0 - */ - this.anims; - - /** - * A reference to the global Cache. The Cache stores all files bought in to Phaser via - * the Loader, with the exception of images. Images are stored in the Texture Manager. - * - * In the default set-up you can access this from within a Scene via the `this.cache` property. - * - * @name Phaser.Scenes.Systems#cache - * @type {Phaser.Cache.CacheManager} - * @since 3.0.0 - */ - this.cache; - - /** - * A reference to the global Plugins Manager. - * - * In the default set-up you can access this from within a Scene via the `this.plugins` property. - * - * @name Phaser.Scenes.Systems#plugins - * @type {Phaser.Plugins.PluginManager} - * @since 3.0.0 - */ - this.plugins; - - /** - * A reference to the global registry. This is a game-wide instance of the Data Manager, allowing - * you to exchange data between Scenes via a universal and shared point. - * - * In the default set-up you can access this from within a Scene via the `this.registry` property. - * - * @name Phaser.Scenes.Systems#registry - * @type {Phaser.Data.DataManager} - * @since 3.0.0 - */ - this.registry; - - /** - * A reference to the global Scale Manager. - * - * In the default set-up you can access this from within a Scene via the `this.scale` property. - * - * @name Phaser.Scenes.Systems#scale - * @type {Phaser.Scale.ScaleManager} - * @since 3.15.0 - */ - this.scale; - - /** - * A reference to the global Sound Manager. - * - * In the default set-up you can access this from within a Scene via the `this.sound` property. - * - * @name Phaser.Scenes.Systems#sound - * @type {(Phaser.Sound.NoAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager|Phaser.Sound.WebAudioSoundManager)} - * @since 3.0.0 - */ - this.sound; - - /** - * A reference to the global Texture Manager. - * - * In the default set-up you can access this from within a Scene via the `this.textures` property. - * - * @name Phaser.Scenes.Systems#textures - * @type {Phaser.Textures.TextureManager} - * @since 3.0.0 - */ - this.textures; - - // Core Plugins - these are non-optional Scene plugins, needed by lots of the other systems - - /** - * A reference to the Scene's Game Object Factory. - * - * Use this to quickly and easily create new Game Object's. - * - * In the default set-up you can access this from within a Scene via the `this.add` property. - * - * @name Phaser.Scenes.Systems#add - * @type {Phaser.GameObjects.GameObjectFactory} - * @since 3.0.0 - */ - this.add; - - /** - * A reference to the Scene's Camera Manager. - * - * Use this to manipulate and create Cameras for this specific Scene. - * - * In the default set-up you can access this from within a Scene via the `this.cameras` property. - * - * @name Phaser.Scenes.Systems#cameras - * @type {Phaser.Cameras.Scene2D.CameraManager} - * @since 3.0.0 - */ - this.cameras; - - /** - * A reference to the Scene's Display List. - * - * Use this to organize the children contained in the display list. - * - * In the default set-up you can access this from within a Scene via the `this.children` property. - * - * @name Phaser.Scenes.Systems#displayList - * @type {Phaser.GameObjects.DisplayList} - * @since 3.0.0 - */ - this.displayList; - - /** - * A reference to the Scene's Event Manager. - * - * Use this to listen for Scene specific events, such as `pause` and `shutdown`. - * - * In the default set-up you can access this from within a Scene via the `this.events` property. - * - * @name Phaser.Scenes.Systems#events - * @type {Phaser.Events.EventEmitter} - * @since 3.0.0 - */ - this.events; - - /** - * A reference to the Scene's Game Object Creator. - * - * Use this to quickly and easily create new Game Object's. The difference between this and the - * Game Object Factory, is that the Creator just creates and returns Game Object instances, it - * doesn't then add them to the Display List or Update List. - * - * In the default set-up you can access this from within a Scene via the `this.make` property. - * - * @name Phaser.Scenes.Systems#make - * @type {Phaser.GameObjects.GameObjectCreator} - * @since 3.0.0 - */ - this.make; - - /** - * A reference to the Scene Manager Plugin. - * - * Use this to manipulate both this and other Scene's in your game, for example to launch a parallel Scene, - * or pause or resume a Scene, or switch from this Scene to another. - * - * In the default set-up you can access this from within a Scene via the `this.scene` property. - * - * @name Phaser.Scenes.Systems#scenePlugin - * @type {Phaser.Scenes.ScenePlugin} - * @since 3.0.0 - */ - this.scenePlugin; + var matrix = this.matrix; - /** - * A reference to the Scene's Update List. - * - * Use this to organize the children contained in the update list. - * - * The Update List is responsible for managing children that need their `preUpdate` methods called, - * in order to process so internal components, such as Sprites with Animations. - * - * In the default set-up there is no reference to this from within the Scene itself. - * - * @name Phaser.Scenes.Systems#updateList - * @type {Phaser.GameObjects.UpdateList} - * @since 3.0.0 - */ - this.updateList; + matrix[0] = 1; + matrix[1] = 0; + matrix[2] = 0; + matrix[3] = 1; + matrix[4] = 0; + matrix[5] = 0; - /** - * The Scene Update function. - * - * This starts out as NOOP during init, preload and create, and at the end of create - * it swaps to be whatever the Scene.update function is. - * - * @name Phaser.Scenes.Systems#sceneUpdate - * @type {function} - * @private - * @since 3.10.0 - */ - this.sceneUpdate = NOOP; + return this; }, /** - * This method is called only once by the Scene Manager when the Scene is instantiated. - * It is responsible for setting up all of the Scene plugins and references. - * It should never be called directly. + * Translate the Matrix. * - * @method Phaser.Scenes.Systems#init - * @protected - * @fires Phaser.Scenes.Events#BOOT + * @method Phaser.GameObjects.Components.TransformMatrix#translate * @since 3.0.0 * - * @param {Phaser.Game} game - A reference to the Phaser Game instance. + * @param {number} x - The horizontal translation value. + * @param {number} y - The vertical translation value. + * + * @return {this} This TransformMatrix. */ - init: function (game) + translate: function (x, y) { - this.settings.status = CONST.INIT; - - // This will get replaced by the SceneManager with the actual update function, if it exists, once create is over. - this.sceneUpdate = NOOP; - - this.game = game; - this.renderer = game.renderer; - - this.canvas = game.canvas; - this.context = game.context; - - var pluginManager = game.plugins; - - this.plugins = pluginManager; - - pluginManager.addToScene(this, DefaultPlugins.Global, [ DefaultPlugins.CoreScene, GetScenePlugins(this), GetPhysicsPlugins(this) ]); + var matrix = this.matrix; - this.events.emit(Events.BOOT, this); + matrix[4] = matrix[0] * x + matrix[2] * y + matrix[4]; + matrix[5] = matrix[1] * x + matrix[3] * y + matrix[5]; - this.settings.isBooted = true; + return this; }, /** - * A single game step. Called automatically by the Scene Manager as a result of a Request Animation - * Frame or Set Timeout call to the main Game instance. + * Scale the Matrix. * - * @method Phaser.Scenes.Systems#step - * @fires Phaser.Scenes.Events#PRE_UPDATE - * @fires Phaser.Scenes.Events#UPDATE - * @fires Phaser.Scenes.Events#POST_UPDATE + * @method Phaser.GameObjects.Components.TransformMatrix#scale * @since 3.0.0 * - * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). - * @param {number} delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class. + * @param {number} x - The horizontal scale value. + * @param {number} y - The vertical scale value. + * + * @return {this} This TransformMatrix. */ - step: function (time, delta) + scale: function (x, y) { - var events = this.events; - - events.emit(Events.PRE_UPDATE, time, delta); - - events.emit(Events.UPDATE, time, delta); + var matrix = this.matrix; - this.sceneUpdate.call(this.scene, time, delta); + matrix[0] *= x; + matrix[1] *= x; + matrix[2] *= y; + matrix[3] *= y; - events.emit(Events.POST_UPDATE, time, delta); + return this; }, /** - * Called automatically by the Scene Manager. - * Instructs the Scene to render itself via its Camera Manager to the renderer given. + * Rotate the Matrix. * - * @method Phaser.Scenes.Systems#render - * @fires Phaser.Scenes.Events#PRE_RENDER - * @fires Phaser.Scenes.Events#RENDER + * @method Phaser.GameObjects.Components.TransformMatrix#rotate * @since 3.0.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that invoked the render call. + * @param {number} angle - The angle of rotation in radians. + * + * @return {this} This TransformMatrix. */ - render: function (renderer) + rotate: function (angle) { - var displayList = this.displayList; + var sin = Math.sin(angle); + var cos = Math.cos(angle); - displayList.depthSort(); + var matrix = this.matrix; - this.events.emit(Events.PRE_RENDER, renderer); + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; - this.cameras.render(renderer, displayList); + matrix[0] = a * cos + c * sin; + matrix[1] = b * cos + d * sin; + matrix[2] = a * -sin + c * cos; + matrix[3] = b * -sin + d * cos; - this.events.emit(Events.RENDER, renderer); + return this; }, /** - * Force a sort of the display list on the next render. + * Multiply this Matrix by the given Matrix. * - * @method Phaser.Scenes.Systems#queueDepthSort - * @since 3.0.0 - */ - queueDepthSort: function () - { - this.displayList.queueDepthSort(); - }, - - /** - * Immediately sorts the display list if the flag is set. + * If an `out` Matrix is given then the results will be stored in it. + * If it is not given, this matrix will be updated in place instead. + * Use an `out` Matrix if you do not wish to mutate this matrix. * - * @method Phaser.Scenes.Systems#depthSort + * @method Phaser.GameObjects.Components.TransformMatrix#multiply * @since 3.0.0 + * + * @param {Phaser.GameObjects.Components.TransformMatrix} rhs - The Matrix to multiply by. + * @param {Phaser.GameObjects.Components.TransformMatrix} [out] - An optional Matrix to store the results in. + * + * @return {(this|Phaser.GameObjects.Components.TransformMatrix)} Either this TransformMatrix, or the `out` Matrix, if given in the arguments. */ - depthSort: function () + multiply: function (rhs, out) { - this.displayList.depthSort(); + var matrix = this.matrix; + var source = rhs.matrix; + + var localA = matrix[0]; + var localB = matrix[1]; + var localC = matrix[2]; + var localD = matrix[3]; + var localE = matrix[4]; + var localF = matrix[5]; + + var sourceA = source[0]; + var sourceB = source[1]; + var sourceC = source[2]; + var sourceD = source[3]; + var sourceE = source[4]; + var sourceF = source[5]; + + var destinationMatrix = (out === undefined) ? matrix : out.matrix; + + destinationMatrix[0] = (sourceA * localA) + (sourceB * localC); + destinationMatrix[1] = (sourceA * localB) + (sourceB * localD); + destinationMatrix[2] = (sourceC * localA) + (sourceD * localC); + destinationMatrix[3] = (sourceC * localB) + (sourceD * localD); + destinationMatrix[4] = (sourceE * localA) + (sourceF * localC) + localE; + destinationMatrix[5] = (sourceE * localB) + (sourceF * localD) + localF; + + return destinationMatrix; }, /** - * Pause this Scene. - * A paused Scene still renders, it just doesn't run ANY of its update handlers or systems. + * Multiply this Matrix by the matrix given, including the offset. * - * @method Phaser.Scenes.Systems#pause - * @fires Phaser.Scenes.Events#PAUSE - * @since 3.0.0 + * The offsetX is added to the tx value: `offsetX * a + offsetY * c + tx`. + * The offsetY is added to the ty value: `offsetY * b + offsetY * d + ty`. * - * @param {object} [data] - A data object that will be passed in the 'pause' event. + * @method Phaser.GameObjects.Components.TransformMatrix#multiplyWithOffset + * @since 3.11.0 * - * @return {Phaser.Scenes.Systems} This Systems object. + * @param {Phaser.GameObjects.Components.TransformMatrix} src - The source Matrix to copy from. + * @param {number} offsetX - Horizontal offset to factor in to the multiplication. + * @param {number} offsetY - Vertical offset to factor in to the multiplication. + * + * @return {this} This TransformMatrix. */ - pause: function (data) + multiplyWithOffset: function (src, offsetX, offsetY) { - var events = this.events; - var settings = this.settings; + var matrix = this.matrix; + var otherMatrix = src.matrix; - if (this.settings.active) - { - settings.status = CONST.PAUSED; + var a0 = matrix[0]; + var b0 = matrix[1]; + var c0 = matrix[2]; + var d0 = matrix[3]; + var tx0 = matrix[4]; + var ty0 = matrix[5]; - settings.active = false; + var pse = offsetX * a0 + offsetY * c0 + tx0; + var psf = offsetX * b0 + offsetY * d0 + ty0; - events.emit(Events.PAUSE, this, data); - } + var a1 = otherMatrix[0]; + var b1 = otherMatrix[1]; + var c1 = otherMatrix[2]; + var d1 = otherMatrix[3]; + var tx1 = otherMatrix[4]; + var ty1 = otherMatrix[5]; + + matrix[0] = a1 * a0 + b1 * c0; + matrix[1] = a1 * b0 + b1 * d0; + matrix[2] = c1 * a0 + d1 * c0; + matrix[3] = c1 * b0 + d1 * d0; + matrix[4] = tx1 * a0 + ty1 * c0 + pse; + matrix[5] = tx1 * b0 + ty1 * d0 + psf; return this; }, /** - * Resume this Scene from a paused state. + * Transform the Matrix. * - * @method Phaser.Scenes.Systems#resume - * @fires Phaser.Scenes.Events#RESUME + * @method Phaser.GameObjects.Components.TransformMatrix#transform * @since 3.0.0 * - * @param {object} [data] - A data object that will be passed in the 'resume' event. + * @param {number} a - The Scale X value. + * @param {number} b - The Shear Y value. + * @param {number} c - The Shear X value. + * @param {number} d - The Scale Y value. + * @param {number} tx - The Translate X value. + * @param {number} ty - The Translate Y value. * - * @return {Phaser.Scenes.Systems} This Systems object. + * @return {this} This TransformMatrix. */ - resume: function (data) + transform: function (a, b, c, d, tx, ty) { - var events = this.events; - var settings = this.settings; - - if (!this.settings.active) - { - settings.status = CONST.RUNNING; + var matrix = this.matrix; - settings.active = true; + var a0 = matrix[0]; + var b0 = matrix[1]; + var c0 = matrix[2]; + var d0 = matrix[3]; + var tx0 = matrix[4]; + var ty0 = matrix[5]; - events.emit(Events.RESUME, this, data); - } + matrix[0] = a * a0 + b * c0; + matrix[1] = a * b0 + b * d0; + matrix[2] = c * a0 + d * c0; + matrix[3] = c * b0 + d * d0; + matrix[4] = tx * a0 + ty * c0 + tx0; + matrix[5] = tx * b0 + ty * d0 + ty0; return this; }, /** - * Send this Scene to sleep. - * - * A sleeping Scene doesn't run its update step or render anything, but it also isn't shut down - * or has any of its systems or children removed, meaning it can be re-activated at any point and - * will carry on from where it left off. It also keeps everything in memory and events and callbacks - * from other Scenes may still invoke changes within it, so be careful what is left active. + * Transform a point in to the local space of this Matrix. * - * @method Phaser.Scenes.Systems#sleep - * @fires Phaser.Scenes.Events#SLEEP + * @method Phaser.GameObjects.Components.TransformMatrix#transformPoint * @since 3.0.0 * - * @param {object} [data] - A data object that will be passed in the 'sleep' event. + * @param {number} x - The x coordinate of the point to transform. + * @param {number} y - The y coordinate of the point to transform. + * @param {Phaser.Types.Math.Vector2Like} [point] - Optional Point object to store the transformed coordinates in. * - * @return {Phaser.Scenes.Systems} This Systems object. + * @return {Phaser.Types.Math.Vector2Like} The Point containing the transformed coordinates. */ - sleep: function (data) + transformPoint: function (x, y, point) { - var events = this.events; - var settings = this.settings; + if (point === undefined) { point = { x: 0, y: 0 }; } - settings.status = CONST.SLEEPING; + var matrix = this.matrix; - settings.active = false; - settings.visible = false; + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; + var tx = matrix[4]; + var ty = matrix[5]; - events.emit(Events.SLEEP, this, data); + point.x = x * a + y * c + tx; + point.y = x * b + y * d + ty; - return this; + return point; }, /** - * Wake-up this Scene if it was previously asleep. + * Invert the Matrix. * - * @method Phaser.Scenes.Systems#wake - * @fires Phaser.Scenes.Events#WAKE + * @method Phaser.GameObjects.Components.TransformMatrix#invert * @since 3.0.0 * - * @param {object} [data] - A data object that will be passed in the 'wake' event. - * - * @return {Phaser.Scenes.Systems} This Systems object. + * @return {this} This TransformMatrix. */ - wake: function (data) + invert: function () { - var events = this.events; - var settings = this.settings; - - settings.status = CONST.RUNNING; + var matrix = this.matrix; - settings.active = true; - settings.visible = true; + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; + var tx = matrix[4]; + var ty = matrix[5]; - events.emit(Events.WAKE, this, data); + var n = a * d - b * c; - if (settings.isTransition) - { - events.emit(Events.TRANSITION_WAKE, settings.transitionFrom, settings.transitionDuration); - } + matrix[0] = d / n; + matrix[1] = -b / n; + matrix[2] = -c / n; + matrix[3] = a / n; + matrix[4] = (c * ty - d * tx) / n; + matrix[5] = -(a * ty - b * tx) / n; return this; }, /** - * Returns any data that was sent to this Scene by another Scene. + * Set the values of this Matrix to copy those of the matrix given. * - * The data is also passed to `Scene.init` and in various Scene events, but - * you can access it at any point via this method. + * @method Phaser.GameObjects.Components.TransformMatrix#copyFrom + * @since 3.11.0 * - * @method Phaser.Scenes.Systems#getData - * @since 3.22.0 + * @param {Phaser.GameObjects.Components.TransformMatrix} src - The source Matrix to copy from. * - * @return {any} + * @return {this} This TransformMatrix. */ - getData: function () + copyFrom: function (src) { - return this.settings.data; + var matrix = this.matrix; + + matrix[0] = src.a; + matrix[1] = src.b; + matrix[2] = src.c; + matrix[3] = src.d; + matrix[4] = src.e; + matrix[5] = src.f; + + return this; }, /** - * Is this Scene sleeping? + * Set the values of this Matrix to copy those of the array given. + * Where array indexes 0, 1, 2, 3, 4 and 5 are mapped to a, b, c, d, e and f. * - * @method Phaser.Scenes.Systems#isSleeping - * @since 3.0.0 + * @method Phaser.GameObjects.Components.TransformMatrix#copyFromArray + * @since 3.11.0 * - * @return {boolean} `true` if this Scene is asleep, otherwise `false`. + * @param {array} src - The array of values to set into this matrix. + * + * @return {this} This TransformMatrix. */ - isSleeping: function () + copyFromArray: function (src) { - return (this.settings.status === CONST.SLEEPING); + var matrix = this.matrix; + + matrix[0] = src[0]; + matrix[1] = src[1]; + matrix[2] = src[2]; + matrix[3] = src[3]; + matrix[4] = src[4]; + matrix[5] = src[5]; + + return this; }, /** - * Is this Scene running? + * Copy the values from this Matrix to the given Canvas Rendering Context. + * This will use the Context.transform method. * - * @method Phaser.Scenes.Systems#isActive - * @since 3.0.0 + * @method Phaser.GameObjects.Components.TransformMatrix#copyToContext + * @since 3.12.0 * - * @return {boolean} `true` if this Scene is running, otherwise `false`. + * @param {CanvasRenderingContext2D} ctx - The Canvas Rendering Context to copy the matrix values to. + * + * @return {CanvasRenderingContext2D} The Canvas Rendering Context. */ - isActive: function () + copyToContext: function (ctx) { - return (this.settings.status === CONST.RUNNING); + var matrix = this.matrix; + + ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); + + return ctx; }, /** - * Is this Scene paused? + * Copy the values from this Matrix to the given Canvas Rendering Context. + * This will use the Context.setTransform method. * - * @method Phaser.Scenes.Systems#isPaused - * @since 3.13.0 + * @method Phaser.GameObjects.Components.TransformMatrix#setToContext + * @since 3.12.0 * - * @return {boolean} `true` if this Scene is paused, otherwise `false`. + * @param {CanvasRenderingContext2D} ctx - The Canvas Rendering Context to copy the matrix values to. + * + * @return {CanvasRenderingContext2D} The Canvas Rendering Context. */ - isPaused: function () + setToContext: function (ctx) { - return (this.settings.status === CONST.PAUSED); + var matrix = this.matrix; + + ctx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); + + return ctx; }, /** - * Is this Scene currently transitioning out to, or in from another Scene? + * Copy the values in this Matrix to the array given. * - * @method Phaser.Scenes.Systems#isTransitioning - * @since 3.5.0 + * Where array indexes 0, 1, 2, 3, 4 and 5 are mapped to a, b, c, d, e and f. * - * @return {boolean} `true` if this Scene is currently transitioning, otherwise `false`. + * @method Phaser.GameObjects.Components.TransformMatrix#copyToArray + * @since 3.12.0 + * + * @param {array} [out] - The array to copy the matrix values in to. + * + * @return {array} An array where elements 0 to 5 contain the values from this matrix. */ - isTransitioning: function () + copyToArray: function (out) { - return (this.settings.isTransition || this.scenePlugin._target !== null); + var matrix = this.matrix; + + if (out === undefined) + { + out = [ matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5] ]; + } + else + { + out[0] = matrix[0]; + out[1] = matrix[1]; + out[2] = matrix[2]; + out[3] = matrix[3]; + out[4] = matrix[4]; + out[5] = matrix[5]; + } + + return out; }, /** - * Is this Scene currently transitioning out from itself to another Scene? + * Set the values of this Matrix. * - * @method Phaser.Scenes.Systems#isTransitionOut - * @since 3.5.0 + * @method Phaser.GameObjects.Components.TransformMatrix#setTransform + * @since 3.0.0 * - * @return {boolean} `true` if this Scene is in transition to another Scene, otherwise `false`. + * @param {number} a - The Scale X value. + * @param {number} b - The Shear Y value. + * @param {number} c - The Shear X value. + * @param {number} d - The Scale Y value. + * @param {number} tx - The Translate X value. + * @param {number} ty - The Translate Y value. + * + * @return {this} This TransformMatrix. */ - isTransitionOut: function () + setTransform: function (a, b, c, d, tx, ty) { - return (this.scenePlugin._target !== null && this.scenePlugin._duration > 0); + var matrix = this.matrix; + + matrix[0] = a; + matrix[1] = b; + matrix[2] = c; + matrix[3] = d; + matrix[4] = tx; + matrix[5] = ty; + + return this; }, /** - * Is this Scene currently transitioning in from another Scene? + * Decompose this Matrix into its translation, scale and rotation values using QR decomposition. * - * @method Phaser.Scenes.Systems#isTransitionIn - * @since 3.5.0 + * The result must be applied in the following order to reproduce the current matrix: * - * @return {boolean} `true` if this Scene is transitioning in from another Scene, otherwise `false`. + * translate -> rotate -> scale + * + * @method Phaser.GameObjects.Components.TransformMatrix#decomposeMatrix + * @since 3.0.0 + * + * @return {Phaser.Types.GameObjects.DecomposeMatrixResults} The decomposed Matrix. */ - isTransitionIn: function () + decomposeMatrix: function () { - return (this.settings.isTransition); + var decomposedMatrix = this.decomposedMatrix; + + var matrix = this.matrix; + + // a = scale X (1) + // b = shear Y (0) + // c = shear X (0) + // d = scale Y (1) + + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; + + var determ = a * d - b * c; + + decomposedMatrix.translateX = matrix[4]; + decomposedMatrix.translateY = matrix[5]; + + if (a || b) + { + var r = Math.sqrt(a * a + b * b); + + decomposedMatrix.rotation = (b > 0) ? Math.acos(a / r) : -Math.acos(a / r); + decomposedMatrix.scaleX = r; + decomposedMatrix.scaleY = determ / r; + } + else if (c || d) + { + var s = Math.sqrt(c * c + d * d); + + decomposedMatrix.rotation = Math.PI * 0.5 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)); + decomposedMatrix.scaleX = determ / s; + decomposedMatrix.scaleY = s; + } + else + { + decomposedMatrix.rotation = 0; + decomposedMatrix.scaleX = 0; + decomposedMatrix.scaleY = 0; + } + + return decomposedMatrix; }, /** - * Is this Scene visible and rendering? + * Apply the identity, translate, rotate and scale operations on the Matrix. * - * @method Phaser.Scenes.Systems#isVisible + * @method Phaser.GameObjects.Components.TransformMatrix#applyITRS * @since 3.0.0 * - * @return {boolean} `true` if this Scene is visible, otherwise `false`. + * @param {number} x - The horizontal translation. + * @param {number} y - The vertical translation. + * @param {number} rotation - The angle of rotation in radians. + * @param {number} scaleX - The horizontal scale. + * @param {number} scaleY - The vertical scale. + * + * @return {this} This TransformMatrix. */ - isVisible: function () + applyITRS: function (x, y, rotation, scaleX, scaleY) { - return this.settings.visible; + var matrix = this.matrix; + + var radianSin = Math.sin(rotation); + var radianCos = Math.cos(rotation); + + // Translate + matrix[4] = x; + matrix[5] = y; + + // Rotate and Scale + matrix[0] = radianCos * scaleX; + matrix[1] = radianSin * scaleX; + matrix[2] = -radianSin * scaleY; + matrix[3] = radianCos * scaleY; + + return this; }, /** - * Sets the visible state of this Scene. - * An invisible Scene will not render, but will still process updates. + * Takes the `x` and `y` values and returns a new position in the `output` vector that is the inverse of + * the current matrix with its transformation applied. * - * @method Phaser.Scenes.Systems#setVisible - * @since 3.0.0 + * Can be used to translate points from world to local space. * - * @param {boolean} value - `true` to render this Scene, otherwise `false`. + * @method Phaser.GameObjects.Components.TransformMatrix#applyInverse + * @since 3.12.0 * - * @return {Phaser.Scenes.Systems} This Systems object. + * @param {number} x - The x position to translate. + * @param {number} y - The y position to translate. + * @param {Phaser.Math.Vector2} [output] - A Vector2, or point-like object, to store the results in. + * + * @return {Phaser.Math.Vector2} The coordinates, inverse-transformed through this matrix. */ - setVisible: function (value) + applyInverse: function (x, y, output) { - this.settings.visible = value; + if (output === undefined) { output = new Vector2(); } - return this; + var matrix = this.matrix; + + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; + var tx = matrix[4]; + var ty = matrix[5]; + + var id = 1 / ((a * d) + (c * -b)); + + output.x = (d * id * x) + (-c * id * y) + (((ty * c) - (tx * d)) * id); + output.y = (a * id * y) + (-b * id * x) + (((-ty * a) + (tx * b)) * id); + + return output; }, /** - * Set the active state of this Scene. + * Performs the 8 calculations required to create the vertices of + * a quad based on this matrix and the given x/y/xw/yh values. * - * An active Scene will run its core update loop. + * The result is stored in `TransformMatrix.quad`, which is returned + * from this method. * - * @method Phaser.Scenes.Systems#setActive - * @since 3.0.0 + * @method Phaser.GameObjects.Components.TransformMatrix#setQuad + * @since 3.60.0 * - * @param {boolean} value - If `true` the Scene will be resumed, if previously paused. If `false` it will be paused. - * @param {object} [data] - A data object that will be passed in the 'resume' or 'pause' events. + * @param {number} x - The x value. + * @param {number} y - The y value. + * @param {number} xw - The xw value. + * @param {number} yh - The yh value. + * @param {boolean} roundPixels - Pass the results via Math.round? + * @param {Float32Array} [quad] - Optional Float32Array to store the results in. Otherwises uses the local quad array. * - * @return {Phaser.Scenes.Systems} This Systems object. + * @return {Float32Array} The quad Float32Array. */ - setActive: function (value, data) + setQuad: function (x, y, xw, yh, roundPixels, quad) { - if (value) - { - return this.resume(data); - } - else + if (quad === undefined) { quad = this.quad; } + + var matrix = this.matrix; + + var a = matrix[0]; + var b = matrix[1]; + var c = matrix[2]; + var d = matrix[3]; + var e = matrix[4]; + var f = matrix[5]; + + quad[0] = x * a + y * c + e; + quad[1] = x * b + y * d + f; + + quad[2] = x * a + yh * c + e; + quad[3] = x * b + yh * d + f; + + quad[4] = xw * a + yh * c + e; + quad[5] = xw * b + yh * d + f; + + quad[6] = xw * a + y * c + e; + quad[7] = xw * b + y * d + f; + + if (roundPixels) { - return this.pause(data); + quad.forEach(function (value, index) + { + quad[index] = Math.round(value); + }); } + + return quad; }, /** - * Start this Scene running and rendering. - * Called automatically by the SceneManager. + * Returns the X component of this matrix multiplied by the given values. + * This is the same as `x * a + y * c + e`. * - * @method Phaser.Scenes.Systems#start - * @fires Phaser.Scenes.Events#START - * @fires Phaser.Scenes.Events#READY - * @since 3.0.0 + * @method Phaser.GameObjects.Components.TransformMatrix#getX + * @since 3.12.0 * - * @param {object} data - Optional data object that may have been passed to this Scene from another. + * @param {number} x - The x value. + * @param {number} y - The y value. + * + * @return {number} The calculated x value. */ - start: function (data) + getX: function (x, y) { - var events = this.events; - var settings = this.settings; + return x * this.a + y * this.c + this.e; + }, - if (data) + /** + * Returns the Y component of this matrix multiplied by the given values. + * This is the same as `x * b + y * d + f`. + * + * @method Phaser.GameObjects.Components.TransformMatrix#getY + * @since 3.12.0 + * + * @param {number} x - The x value. + * @param {number} y - The y value. + * + * @return {number} The calculated y value. + */ + getY: function (x, y) + { + return x * this.b + y * this.d + this.f; + }, + + /** + * Returns the X component of this matrix multiplied by the given values. + * + * This is the same as `x * a + y * c + e`, optionally passing via `Math.round`. + * + * @method Phaser.GameObjects.Components.TransformMatrix#getXRound + * @since 3.50.0 + * + * @param {number} x - The x value. + * @param {number} y - The y value. + * @param {boolean} [round=false] - Math.round the resulting value? + * + * @return {number} The calculated x value. + */ + getXRound: function (x, y, round) + { + var v = this.getX(x, y); + + if (round) { - settings.data = data; + v = Math.round(v); } - settings.status = CONST.START; + return v; + }, - settings.active = true; - settings.visible = true; + /** + * Returns the Y component of this matrix multiplied by the given values. + * + * This is the same as `x * b + y * d + f`, optionally passing via `Math.round`. + * + * @method Phaser.GameObjects.Components.TransformMatrix#getYRound + * @since 3.50.0 + * + * @param {number} x - The x value. + * @param {number} y - The y value. + * @param {boolean} [round=false] - Math.round the resulting value? + * + * @return {number} The calculated y value. + */ + getYRound: function (x, y, round) + { + var v = this.getY(x, y); - // For plugins to listen out for - events.emit(Events.START, this); + if (round) + { + v = Math.round(v); + } - // For user-land code to listen out for - events.emit(Events.READY, this, data); + return v; }, /** - * Shutdown this Scene and send a shutdown event to all of its systems. - * A Scene that has been shutdown will not run its update loop or render, but it does - * not destroy any of its plugins or references. It is put into hibernation for later use. - * If you don't ever plan to use this Scene again, then it should be destroyed instead - * to free-up resources. + * Returns a string that can be used in a CSS Transform call as a `matrix` property. * - * @method Phaser.Scenes.Systems#shutdown - * @fires Phaser.Scenes.Events#SHUTDOWN - * @since 3.0.0 + * @method Phaser.GameObjects.Components.TransformMatrix#getCSSMatrix + * @since 3.12.0 * - * @param {object} [data] - A data object that will be passed in the 'shutdown' event. + * @return {string} A string containing the CSS Transform matrix values. */ - shutdown: function (data) + getCSSMatrix: function () { - var events = this.events; - var settings = this.settings; + var m = this.matrix; - events.off(Events.TRANSITION_INIT); - events.off(Events.TRANSITION_START); - events.off(Events.TRANSITION_COMPLETE); - events.off(Events.TRANSITION_OUT); + return 'matrix(' + m[0] + ',' + m[1] + ',' + m[2] + ',' + m[3] + ',' + m[4] + ',' + m[5] + ')'; + }, - settings.status = CONST.SHUTDOWN; + /** + * Destroys this Transform Matrix. + * + * @method Phaser.GameObjects.Components.TransformMatrix#destroy + * @since 3.4.0 + */ + destroy: function () + { + this.matrix = null; + this.quad = null; + this.decomposedMatrix = null; + } - settings.active = false; - settings.visible = false; +}); - if (this.renderer === GLOBAL_CONST.WEBGL) - { - this.renderer.resetTextures(true); - } +module.exports = TransformMatrix; - events.emit(Events.SHUTDOWN, this, data); - }, + +/***/ }), + +/***/ 59694: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// bitmask flag for GameObject.renderMask +var _FLAG = 1; // 0001 + +/** + * Provides methods used for setting the visibility of a Game Object. + * Should be applied as a mixin and not used directly. + * + * @namespace Phaser.GameObjects.Components.Visible + * @since 3.0.0 + */ + +var Visible = { /** - * Destroy this Scene and send a destroy event all of its systems. - * A destroyed Scene cannot be restarted. - * You should not call this directly, instead use `SceneManager.remove`. + * Private internal value. Holds the visible value. * - * @method Phaser.Scenes.Systems#destroy + * @name Phaser.GameObjects.Components.Visible#_visible + * @type {boolean} * @private - * @fires Phaser.Scenes.Events#DESTROY + * @default true * @since 3.0.0 */ - destroy: function () - { - var events = this.events; - var settings = this.settings; + _visible: true, - settings.status = CONST.DESTROYED; + /** + * The visible state of the Game Object. + * + * An invisible Game Object will skip rendering, but will still process update logic. + * + * @name Phaser.GameObjects.Components.Visible#visible + * @type {boolean} + * @since 3.0.0 + */ + visible: { - settings.active = false; - settings.visible = false; + get: function () + { + return this._visible; + }, - events.emit(Events.DESTROY, this); + set: function (value) + { + if (value) + { + this._visible = true; + this.renderFlags |= _FLAG; + } + else + { + this._visible = false; + this.renderFlags &= ~_FLAG; + } + } - events.removeAllListeners(); + }, - var props = [ 'scene', 'game', 'anims', 'cache', 'plugins', 'registry', 'sound', 'textures', 'add', 'camera', 'displayList', 'events', 'make', 'scenePlugin', 'updateList' ]; + /** + * Sets the visibility of this Game Object. + * + * An invisible Game Object will skip rendering, but will still process update logic. + * + * @method Phaser.GameObjects.Components.Visible#setVisible + * @since 3.0.0 + * + * @param {boolean} value - The visible state of the Game Object. + * + * @return {this} This Game Object instance. + */ + setVisible: function (value) + { + this.visible = value; - for (var i = 0; i < props.length; i++) - { - this[props[i]] = null; - } + return this; } +}; -}); - -module.exports = Systems; +module.exports = Visible; /***/ }), -/* 205 */ -/***/ (function(module, exports) { + +/***/ 64937: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Capitalizes the first letter of a string if there is one. - * @example - * UppercaseFirst('abc'); - * // returns 'Abc' - * @example - * UppercaseFirst('the happy family'); - * // returns 'The happy family' - * @example - * UppercaseFirst(''); - * // returns '' - * - * @function Phaser.Utils.String.UppercaseFirst - * @since 3.0.0 - * - * @param {string} str - The string to capitalize. - * - * @return {string} A new string, same as the first, but with the first letter capitalized. + * @namespace Phaser.GameObjects.Components */ -var UppercaseFirst = function (str) -{ - return str && str[0].toUpperCase() + str.slice(1); -}; -module.exports = UppercaseFirst; +module.exports = { + + Alpha: __webpack_require__(97123), + AlphaSingle: __webpack_require__(15720), + BlendMode: __webpack_require__(69732), + ComputedSize: __webpack_require__(28284), + Crop: __webpack_require__(85293), + Depth: __webpack_require__(14975), + Flip: __webpack_require__(92972), + FX: __webpack_require__(88677), + GetBounds: __webpack_require__(80693), + Mask: __webpack_require__(39171), + Origin: __webpack_require__(28072), + PathFollower: __webpack_require__(54211), + Pipeline: __webpack_require__(58210), + PostPipeline: __webpack_require__(44086), + ScrollFactor: __webpack_require__(45900), + Size: __webpack_require__(31654), + Texture: __webpack_require__(82081), + TextureCrop: __webpack_require__(21850), + Tint: __webpack_require__(58072), + ToJSON: __webpack_require__(48129), + Transform: __webpack_require__(56584), + TransformMatrix: __webpack_require__(69360), + Visible: __webpack_require__(59694) + +}; /***/ }), -/* 206 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 70339: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(33); -var Class = __webpack_require__(0); -var Frame = __webpack_require__(109); -var TextureSource = __webpack_require__(424); - -var TEXTURE_MISSING_ERROR = 'Texture.frame missing: '; +var ArrayUtils = __webpack_require__(59959); +var BlendModes = __webpack_require__(95723); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var Events = __webpack_require__(56631); +var GameObject = __webpack_require__(89980); +var Rectangle = __webpack_require__(74118); +var Render = __webpack_require__(98524); +var Union = __webpack_require__(58795); +var Vector2 = __webpack_require__(93736); /** * @classdesc - * A Texture consists of a source, usually an Image from the Cache, and a collection of Frames. - * The Frames represent the different areas of the Texture. For example a texture atlas - * may have many Frames, one for each element within the atlas. Where-as a single image would have - * just one frame, that encompasses the whole image. + * A Container Game Object. * - * Every Texture, no matter where it comes from, always has at least 1 frame called the `__BASE` frame. - * This frame represents the entirety of the source image. + * A Container, as the name implies, can 'contain' other types of Game Object. + * When a Game Object is added to a Container, the Container becomes responsible for the rendering of it. + * By default it will be removed from the Display List and instead added to the Containers own internal list. * - * Textures are managed by the global TextureManager. This is a singleton class that is - * responsible for creating and delivering Textures and their corresponding Frames to Game Objects. + * The position of the Game Object automatically becomes relative to the position of the Container. * - * Sprites and other Game Objects get the texture data they need from the TextureManager. + * The transform point of a Container is 0x0 (in local space) and that cannot be changed. The children you add to the + * Container should be positioned with this value in mind. I.e. you should treat 0x0 as being the center of + * the Container, and position children positively and negative around it as required. * - * @class Texture - * @memberof Phaser.Textures + * When the Container is rendered, all of its children are rendered as well, in the order in which they exist + * within the Container. Container children can be repositioned using methods such as `MoveUp`, `MoveDown` and `SendToBack`. + * + * If you modify a transform property of the Container, such as `Container.x` or `Container.rotation` then it will + * automatically influence all children as well. + * + * Containers can include other Containers for deeply nested transforms. + * + * Containers can have masks set on them and can be used as a mask too. However, Container children cannot be masked. + * The masks do not 'stack up'. Only a Container on the root of the display list will use its mask. + * + * Containers can be enabled for input. Because they do not have a texture you need to provide a shape for them + * to use as their hit area. Container children can also be enabled for input, independent of the Container. + * + * If input enabling a _child_ you should not set both the `origin` and a **negative** scale factor on the child, + * or the input area will become misaligned. + * + * Containers can be given a physics body for either Arcade Physics, Impact Physics or Matter Physics. However, + * if Container _children_ are enabled for physics you may get unexpected results, such as offset bodies, + * if the Container itself, or any of its ancestors, is positioned anywhere other than at 0 x 0. Container children + * with physics do not factor in the Container due to the excessive extra calculations needed. Please structure + * your game to work around this. + * + * It's important to understand the impact of using Containers. They add additional processing overhead into + * every one of their children. The deeper you nest them, the more the cost escalates. This is especially true + * for input events. You also loose the ability to set the display depth of Container children in the same + * flexible manner as those not within them. In short, don't use them for the sake of it. You pay a small cost + * every time you create one, try to structure your game around avoiding that where possible. + * + * @class Container + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects * @constructor - * @since 3.0.0 + * @since 3.4.0 * - * @param {Phaser.Textures.TextureManager} manager - A reference to the Texture Manager this Texture belongs to. - * @param {string} key - The unique string-based key of this Texture. - * @param {(HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[])} source - An array of sources that are used to create the texture. Usually Images, but can also be a Canvas. - * @param {number} [width] - The width of the Texture. This is optional and automatically derived from the source images. - * @param {number} [height] - The height of the Texture. This is optional and automatically derived from the source images. + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.ComputedSize + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Container. */ -var Texture = new Class({ +var Container = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.ComputedSize, + Components.Depth, + Components.Mask, + Components.PostPipeline, + Components.Transform, + Components.Visible, + Render + ], initialize: - function Texture (manager, key, source, width, height) + function Container (scene, x, y, children) { - if (!Array.isArray(source)) - { - source = [ source ]; - } + GameObject.call(this, scene, 'Container'); /** - * A reference to the Texture Manager this Texture belongs to. + * An array holding the children of this Container. * - * @name Phaser.Textures.Texture#manager - * @type {Phaser.Textures.TextureManager} - * @since 3.0.0 + * @name Phaser.GameObjects.Container#list + * @type {Phaser.GameObjects.GameObject[]} + * @since 3.4.0 */ - this.manager = manager; + this.list = []; /** - * The unique string-based key of this Texture. + * Does this Container exclusively manage its children? * - * @name Phaser.Textures.Texture#key - * @type {string} - * @since 3.0.0 + * The default is `true` which means a child added to this Container cannot + * belong in another Container, which includes the Scene display list. + * + * If you disable this then this Container will no longer exclusively manage its children. + * This allows you to create all kinds of interesting graphical effects, such as replicating + * Game Objects without reparenting them all over the Scene. + * However, doing so will prevent children from receiving any kind of input event or have + * their physics bodies work by default, as they're no longer a single entity on the + * display list, but are being replicated where-ever this Container is. + * + * @name Phaser.GameObjects.Container#exclusive + * @type {boolean} + * @default true + * @since 3.4.0 */ - this.key = key; + this.exclusive = true; /** - * An array of TextureSource instances. - * These are unique to this Texture and contain the actual Image (or Canvas) data. + * Containers can have an optional maximum size. If set to anything above 0 it + * will constrict the addition of new Game Objects into the Container, capping off + * the maximum limit the Container can grow in size to. * - * @name Phaser.Textures.Texture#source - * @type {Phaser.Textures.TextureSource[]} - * @since 3.0.0 + * @name Phaser.GameObjects.Container#maxSize + * @type {number} + * @default -1 + * @since 3.4.0 */ - this.source = []; + this.maxSize = -1; /** - * An array of TextureSource data instances. - * Used to store additional data images, such as normal maps or specular maps. + * The cursor position. * - * @name Phaser.Textures.Texture#dataSource - * @type {array} - * @since 3.0.0 + * @name Phaser.GameObjects.Container#position + * @type {number} + * @since 3.4.0 */ - this.dataSource = []; + this.position = 0; /** - * A key-value object pair associating the unique Frame keys with the Frames objects. + * Internal Transform Matrix used for local space conversion. * - * @name Phaser.Textures.Texture#frames - * @type {object} - * @since 3.0.0 + * @name Phaser.GameObjects.Container#localTransform + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.4.0 */ - this.frames = {}; + this.localTransform = new Components.TransformMatrix(); /** - * Any additional data that was set in the source JSON (if any), - * or any extra data you'd like to store relating to this texture + * Internal temporary Transform Matrix used to avoid object creation. * - * @name Phaser.Textures.Texture#customData - * @type {object} - * @since 3.0.0 + * @name Phaser.GameObjects.Container#tempTransformMatrix + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @private + * @since 3.4.0 */ - this.customData = {}; + this.tempTransformMatrix = new Components.TransformMatrix(); /** - * The name of the first frame of the Texture. + * The property key to sort by. * - * @name Phaser.Textures.Texture#firstFrame + * @name Phaser.GameObjects.Container#_sortKey * @type {string} - * @since 3.0.0 + * @private + * @since 3.4.0 */ - this.firstFrame = '__BASE'; + this._sortKey = ''; /** - * The total number of Frames in this Texture, including the `__BASE` frame. + * A reference to the Scene Systems Event Emitter. * - * A Texture will always contain at least 1 frame because every Texture contains a `__BASE` frame by default, - * in addition to any extra frames that have been added to it, such as when parsing a Sprite Sheet or Texture Atlas. + * @name Phaser.GameObjects.Container#_sysEvents + * @type {Phaser.Events.EventEmitter} + * @private + * @since 3.9.0 + */ + this._sysEvents = scene.sys.events; + + /** + * The horizontal scroll factor of this Container. * - * @name Phaser.Textures.Texture#frameTotal + * The scroll factor controls the influence of the movement of a Camera upon this Container. + * + * When a camera scrolls it will change the location at which this Container is rendered on-screen. + * It does not change the Containers actual position values. + * + * For a Container, setting this value will only update the Container itself, not its children. + * If you wish to change the scrollFactor of the children as well, use the `setScrollFactor` method. + * + * A value of 1 means it will move exactly in sync with a camera. + * A value of 0 means it will not move at all, even if the camera moves. + * Other values control the degree to which the camera movement is mapped to this Container. + * + * Please be aware that scroll factor values other than 1 are not taken in to consideration when + * calculating physics collisions. Bodies always collide based on their world position, but changing + * the scroll factor is a visual adjustment to where the textures are rendered, which can offset + * them from physics bodies if not accounted for in your code. + * + * @name Phaser.GameObjects.Container#scrollFactorX * @type {number} - * @default 0 - * @since 3.0.0 + * @default 1 + * @since 3.4.0 */ - this.frameTotal = 0; + this.scrollFactorX = 1; - // Load the Sources - for (var i = 0; i < source.length; i++) + /** + * The vertical scroll factor of this Container. + * + * The scroll factor controls the influence of the movement of a Camera upon this Container. + * + * When a camera scrolls it will change the location at which this Container is rendered on-screen. + * It does not change the Containers actual position values. + * + * For a Container, setting this value will only update the Container itself, not its children. + * If you wish to change the scrollFactor of the children as well, use the `setScrollFactor` method. + * + * A value of 1 means it will move exactly in sync with a camera. + * A value of 0 means it will not move at all, even if the camera moves. + * Other values control the degree to which the camera movement is mapped to this Container. + * + * Please be aware that scroll factor values other than 1 are not taken in to consideration when + * calculating physics collisions. Bodies always collide based on their world position, but changing + * the scroll factor is a visual adjustment to where the textures are rendered, which can offset + * them from physics bodies if not accounted for in your code. + * + * @name Phaser.GameObjects.Container#scrollFactorY + * @type {number} + * @default 1 + * @since 3.4.0 + */ + this.scrollFactorY = 1; + + this.initPostPipeline(); + + this.setPosition(x, y); + + this.setBlendMode(BlendModes.SKIP_CHECK); + + if (children) { - this.source.push(new TextureSource(this, source[i], width, height)); + this.add(children); } }, /** - * Adds a new Frame to this Texture. - * - * A Frame is a rectangular region of a TextureSource with a unique index or string-based key. - * - * The name given must be unique within this Texture. If it already exists, this method will return `null`. - * - * @method Phaser.Textures.Texture#add - * @since 3.0.0 - * - * @param {(number|string)} name - The name of this Frame. The name is unique within the Texture. - * @param {number} sourceIndex - The index of the TextureSource that this Frame is a part of. - * @param {number} x - The x coordinate of the top-left of this Frame. - * @param {number} y - The y coordinate of the top-left of this Frame. - * @param {number} width - The width of this Frame. - * @param {number} height - The height of this Frame. + * Internal value to allow Containers to be used for input and physics. + * Do not change this value. It has no effect other than to break things. * - * @return {?Phaser.Textures.Frame} The Frame that was added to this Texture, or `null` if the given name already exists. + * @name Phaser.GameObjects.Container#originX + * @type {number} + * @readonly + * @override + * @since 3.4.0 */ - add: function (name, sourceIndex, x, y, width, height) - { - if (this.has(name)) + originX: { + + get: function () { - return null; + return 0.5; } - var frame = new Frame(this, name, sourceIndex, x, y, width, height); + }, - this.frames[name] = frame; + /** + * Internal value to allow Containers to be used for input and physics. + * Do not change this value. It has no effect other than to break things. + * + * @name Phaser.GameObjects.Container#originY + * @type {number} + * @readonly + * @override + * @since 3.4.0 + */ + originY: { - // Set the first frame of the Texture (other than __BASE) - // This is used to ensure we don't spam the display with entire - // atlases of sprite sheets, but instead just the first frame of them - // should the dev incorrectly specify the frame index - if (this.firstFrame === '__BASE') + get: function () { - this.firstFrame = name; + return 0.5; } - this.frameTotal++; - - return frame; }, /** - * Removes the given Frame from this Texture. The Frame is destroyed immediately. - * - * Any Game Objects using this Frame should stop using it _before_ you remove it, - * as it does not happen automatically. - * - * @method Phaser.Textures.Texture#remove - * @since 3.19.0 - * - * @param {string} name - The key of the Frame to remove. + * Internal value to allow Containers to be used for input and physics. + * Do not change this value. It has no effect other than to break things. * - * @return {boolean} True if a Frame with the matching key was removed from this Texture. + * @name Phaser.GameObjects.Container#displayOriginX + * @type {number} + * @readonly + * @override + * @since 3.4.0 */ - remove: function (name) - { - if (this.has(name)) + displayOriginX: { + + get: function () { - var frame = this.get(name); + return this.width * 0.5; + } - frame.destroy(); + }, - delete this.frames[name]; + /** + * Internal value to allow Containers to be used for input and physics. + * Do not change this value. It has no effect other than to break things. + * + * @name Phaser.GameObjects.Container#displayOriginY + * @type {number} + * @readonly + * @override + * @since 3.4.0 + */ + displayOriginY: { - return true; + get: function () + { + return this.height * 0.5; } - return false; }, /** - * Checks to see if a Frame matching the given key exists within this Texture. + * Does this Container exclusively manage its children? * - * @method Phaser.Textures.Texture#has - * @since 3.0.0 + * The default is `true` which means a child added to this Container cannot + * belong in another Container, which includes the Scene display list. * - * @param {string} name - The key of the Frame to check for. + * If you disable this then this Container will no longer exclusively manage its children. + * This allows you to create all kinds of interesting graphical effects, such as replicating + * Game Objects without reparenting them all over the Scene. + * However, doing so will prevent children from receiving any kind of input event or have + * their physics bodies work by default, as they're no longer a single entity on the + * display list, but are being replicated where-ever this Container is. * - * @return {boolean} True if a Frame with the matching key exists in this Texture. + * @method Phaser.GameObjects.Container#setExclusive + * @since 3.4.0 + * + * @param {boolean} [value=true] - The exclusive state of this Container. + * + * @return {this} This Container. */ - has: function (name) + setExclusive: function (value) { - return (this.frames[name]); + if (value === undefined) { value = true; } + + this.exclusive = value; + + return this; }, /** - * Gets a Frame from this Texture based on either the key or the index of the Frame. + * Gets the bounds of this Container. It works by iterating all children of the Container, + * getting their respective bounds, and then working out a min-max rectangle from that. + * It does not factor in if the children render or not, all are included. * - * In a Texture Atlas Frames are typically referenced by a key. - * In a Sprite Sheet Frames are referenced by an index. - * Passing no value for the name returns the base texture. + * Some children are unable to return their bounds, such as Graphics objects, in which case + * they are skipped. * - * @method Phaser.Textures.Texture#get - * @since 3.0.0 + * Depending on the quantity of children in this Container it could be a really expensive call, + * so cache it and only poll it as needed. * - * @param {(string|number)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. + * The values are stored and returned in a Rectangle object. * - * @return {Phaser.Textures.Frame} The Texture Frame. + * @method Phaser.GameObjects.Container#getBounds + * @since 3.4.0 + * + * @param {Phaser.Geom.Rectangle} [output] - A Geom.Rectangle object to store the values in. If not provided a new Rectangle will be created. + * + * @return {Phaser.Geom.Rectangle} The values stored in the output object. */ - get: function (name) + getBounds: function (output) { - // null, undefined, empty string, zero - if (!name) - { - name = this.firstFrame; - } + if (output === undefined) { output = new Rectangle(); } - var frame = this.frames[name]; + output.setTo(this.x, this.y, 0, 0); - if (!frame) + if (this.parentContainer) { - console.warn(TEXTURE_MISSING_ERROR + name); + var parentMatrix = this.parentContainer.getBoundsTransformMatrix(); + var transformedPosition = parentMatrix.transformPoint(this.x, this.y); - frame = this.frames[this.firstFrame]; + output.setTo(transformedPosition.x, transformedPosition.y, 0, 0); } - return frame; - }, - - /** - * Takes the given TextureSource and returns the index of it within this Texture. - * If it's not in this Texture, it returns -1. - * Unless this Texture has multiple TextureSources, such as with a multi-atlas, this - * method will always return zero or -1. - * - * @method Phaser.Textures.Texture#getTextureSourceIndex - * @since 3.0.0 - * - * @param {Phaser.Textures.TextureSource} source - The TextureSource to check. - * - * @return {number} The index of the TextureSource within this Texture, or -1 if not in this Texture. - */ - getTextureSourceIndex: function (source) - { - for (var i = 0; i < this.source.length; i++) + if (this.list.length > 0) { - if (this.source[i] === source) + var children = this.list; + var tempRect = new Rectangle(); + var hasSetFirst = false; + + output.setEmpty(); + + for (var i = 0; i < children.length; i++) { - return i; + var entry = children[i]; + + if (entry.getBounds) + { + entry.getBounds(tempRect); + + if (!hasSetFirst) + { + output.setTo(tempRect.x, tempRect.y, tempRect.width, tempRect.height); + hasSetFirst = true; + } + else + { + Union(tempRect, output, output); + } + } } } - return -1; + return output; }, /** - * Returns an array of all the Frames in the given TextureSource. - * - * @method Phaser.Textures.Texture#getFramesFromTextureSource - * @since 3.0.0 + * Internal add handler. * - * @param {number} sourceIndex - The index of the TextureSource to get the Frames from. - * @param {boolean} [includeBase=false] - Include the `__BASE` Frame in the output array? + * @method Phaser.GameObjects.Container#addHandler + * @private + * @since 3.4.0 * - * @return {Phaser.Textures.Frame[]} An array of Texture Frames. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was just added to this Container. */ - getFramesFromTextureSource: function (sourceIndex, includeBase) + addHandler: function (gameObject) { - if (includeBase === undefined) { includeBase = false; } - - var out = []; + gameObject.once(Events.DESTROY, this.remove, this); - for (var frameName in this.frames) + if (this.exclusive) { - if (frameName === '__BASE' && !includeBase) + if (gameObject.parentContainer) { - continue; + gameObject.parentContainer.remove(gameObject); } - var frame = this.frames[frameName]; + gameObject.parentContainer = this; - if (frame.sourceIndex === sourceIndex) - { - out.push(frame); - } - } + gameObject.removeFromDisplayList(); - return out; + gameObject.addedToScene(); + } }, /** - * Returns an array with all of the names of the Frames in this Texture. + * Internal remove handler. * - * Useful if you want to randomly assign a Frame to a Game Object, as you can - * pick a random element from the returned array. + * @method Phaser.GameObjects.Container#removeHandler + * @private + * @since 3.4.0 * - * @method Phaser.Textures.Texture#getFrameNames - * @since 3.0.0 - * - * @param {boolean} [includeBase=false] - Include the `__BASE` Frame in the output array? - * - * @return {string[]} An array of all Frame names in this Texture. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was just removed from this Container. */ - getFrameNames: function (includeBase) + removeHandler: function (gameObject) { - if (includeBase === undefined) { includeBase = false; } + gameObject.off(Events.DESTROY, this.remove, this); - var out = Object.keys(this.frames); - - if (!includeBase) + if (this.exclusive) { - var idx = out.indexOf('__BASE'); + gameObject.parentContainer = null; - if (idx !== -1) - { - out.splice(idx, 1); - } - } + gameObject.removedFromScene(); - return out; + gameObject.addToDisplayList(); + } }, /** - * Given a Frame name, return the source image it uses to render with. - * - * This will return the actual DOM Image or Canvas element. + * Takes a Point-like object, such as a Vector2, Geom.Point or object with public x and y properties, + * and transforms it into the space of this Container, then returns it in the output object. * - * @method Phaser.Textures.Texture#getSourceImage - * @since 3.0.0 + * @method Phaser.GameObjects.Container#pointToContainer + * @since 3.4.0 * - * @param {(string|number)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. + * @param {Phaser.Types.Math.Vector2Like} source - The Source Point to be transformed. + * @param {Phaser.Types.Math.Vector2Like} [output] - A destination object to store the transformed point in. If none given a Vector2 will be created and returned. * - * @return {(HTMLImageElement|HTMLCanvasElement|Phaser.GameObjects.RenderTexture)} The DOM Image, Canvas Element or Render Texture. + * @return {Phaser.Types.Math.Vector2Like} The transformed point. */ - getSourceImage: function (name) + pointToContainer: function (source, output) { - if (name === undefined || name === null || this.frameTotal === 1) - { - name = '__BASE'; - } - - var frame = this.frames[name]; + if (output === undefined) { output = new Vector2(); } - if (frame) + if (this.parentContainer) { - return frame.source.image; + this.parentContainer.pointToContainer(source, output); } else { - console.warn(TEXTURE_MISSING_ERROR + name); - - return this.frames['__BASE'].source.image; + output.x = source.x; + output.y = source.y; } + + var tempMatrix = this.tempTransformMatrix; + + // No need to loadIdentity because applyITRS overwrites every value anyway + tempMatrix.applyITRS(this.x, this.y, this.rotation, this.scaleX, this.scaleY); + + tempMatrix.invert(); + + tempMatrix.transformPoint(source.x, source.y, output); + + return output; }, /** - * Given a Frame name, return the data source image it uses to render with. - * You can use this to get the normal map for an image for example. - * - * This will return the actual DOM Image. + * Returns the world transform matrix as used for Bounds checks. * - * @method Phaser.Textures.Texture#getDataSourceImage - * @since 3.7.0 + * The returned matrix is temporal and shouldn't be stored. * - * @param {(string|number)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. + * @method Phaser.GameObjects.Container#getBoundsTransformMatrix + * @since 3.4.0 * - * @return {(HTMLImageElement|HTMLCanvasElement)} The DOM Image or Canvas Element. + * @return {Phaser.GameObjects.Components.TransformMatrix} The world transform matrix. */ - getDataSourceImage: function (name) + getBoundsTransformMatrix: function () { - if (name === undefined || name === null || this.frameTotal === 1) - { - name = '__BASE'; - } - - var frame = this.frames[name]; - var idx; - - if (!frame) - { - console.warn(TEXTURE_MISSING_ERROR + name); - - idx = this.frames['__BASE'].sourceIndex; - } - else - { - idx = frame.sourceIndex; - } - - return this.dataSource[idx].image; + return this.getWorldTransformMatrix(this.tempTransformMatrix, this.localTransform); }, /** - * Adds a data source image to this Texture. + * Adds the given Game Object, or array of Game Objects, to this Container. * - * An example of a data source image would be a normal map, where all of the Frames for this Texture - * equally apply to the normal map. + * Each Game Object must be unique within the Container. * - * @method Phaser.Textures.Texture#setDataSource - * @since 3.0.0 + * @method Phaser.GameObjects.Container#add + * @since 3.4.0 * - * @param {(HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[])} data - The source image. + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {(T|T[])} - [child] + * + * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Object, or array of Game Objects, to add to the Container. + * + * @return {this} This Container instance. */ - setDataSource: function (data) + add: function (child) { - if (!Array.isArray(data)) - { - data = [ data ]; - } - - for (var i = 0; i < data.length; i++) - { - var source = this.source[i]; + ArrayUtils.Add(this.list, child, this.maxSize, this.addHandler, this); - this.dataSource.push(new TextureSource(this, data[i], source.width, source.height)); - } + return this; }, /** - * Sets the Filter Mode for this Texture. + * Adds the given Game Object, or array of Game Objects, to this Container at the specified position. * - * The mode can be either Linear, the default, or Nearest. + * Existing Game Objects in the Container are shifted up. * - * For pixel-art you should use Nearest. + * Each Game Object must be unique within the Container. * - * The mode applies to the entire Texture, not just a specific Frame of it. + * @method Phaser.GameObjects.Container#addAt + * @since 3.4.0 * - * @method Phaser.Textures.Texture#setFilter - * @since 3.0.0 + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {(T|T[])} - [child] * - * @param {Phaser.Textures.FilterMode} filterMode - The Filter Mode. + * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Object, or array of Game Objects, to add to the Container. + * @param {number} [index=0] - The position to insert the Game Object/s at. + * + * @return {this} This Container instance. */ - setFilter: function (filterMode) + addAt: function (child, index) { - var i; + ArrayUtils.AddAt(this.list, child, index, this.maxSize, this.addHandler, this); - for (i = 0; i < this.source.length; i++) - { - this.source[i].setFilter(filterMode); - } + return this; + }, - for (i = 0; i < this.dataSource.length; i++) - { - this.dataSource[i].setFilter(filterMode); - } + /** + * Returns the Game Object at the given position in this Container. + * + * @method Phaser.GameObjects.Container#getAt + * @since 3.4.0 + * + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [$return] + * + * @param {number} index - The position to get the Game Object from. + * + * @return {?Phaser.GameObjects.GameObject} The Game Object at the specified index, or `null` if none found. + */ + getAt: function (index) + { + return this.list[index]; }, /** - * Destroys this Texture and releases references to its sources and frames. + * Returns the index of the given Game Object in this Container. * - * @method Phaser.Textures.Texture#destroy - * @since 3.0.0 + * @method Phaser.GameObjects.Container#getIndex + * @since 3.4.0 + * + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [child] + * + * @param {Phaser.GameObjects.GameObject} child - The Game Object to search for in this Container. + * + * @return {number} The index of the Game Object in this Container, or -1 if not found. */ - destroy: function () + getIndex: function (child) { - var i; + return this.list.indexOf(child); + }, - for (i = 0; i < this.source.length; i++) + /** + * Sort the contents of this Container so the items are in order based on the given property. + * For example: `sort('alpha')` would sort the elements based on the value of their `alpha` property. + * + * @method Phaser.GameObjects.Container#sort + * @since 3.4.0 + * + * @param {string} property - The property to lexically sort by. + * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. + * + * @return {this} This Container instance. + */ + sort: function (property, handler) + { + if (!property) { - this.source[i].destroy(); + return this; } - for (i = 0; i < this.dataSource.length; i++) + if (handler === undefined) { - this.dataSource[i].destroy(); + handler = function (childA, childB) + { + return childA[property] - childB[property]; + }; } - for (var frameName in this.frames) - { - var frame = this.frames[frameName]; + ArrayUtils.StableSort(this.list, handler); - frame.destroy(); - } + return this; + }, - this.source = []; - this.dataSource = []; - this.frames = {}; + /** + * Searches for the first instance of a child with its `name` property matching the given argument. + * Should more than one child have the same name only the first is returned. + * + * @method Phaser.GameObjects.Container#getByName + * @since 3.4.0 + * + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [$return] + * + * @param {string} name - The name to search for. + * + * @return {?Phaser.GameObjects.GameObject} The first child with a matching name, or `null` if none were found. + */ + getByName: function (name) + { + return ArrayUtils.GetFirst(this.list, 'name', name); + }, - this.manager.removeKey(this.key); + /** + * Returns a random Game Object from this Container. + * + * @method Phaser.GameObjects.Container#getRandom + * @since 3.4.0 + * + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [$return] + * + * @param {number} [startIndex=0] - An optional start index. + * @param {number} [length] - An optional length, the total number of elements (from the startIndex) to choose from. + * + * @return {?Phaser.GameObjects.GameObject} A random child from the Container, or `null` if the Container is empty. + */ + getRandom: function (startIndex, length) + { + return ArrayUtils.GetRandom(this.list, startIndex, length); + }, - var renderer = this.manager.game.renderer; + /** + * Gets the first Game Object in this Container. + * + * You can also specify a property and value to search for, in which case it will return the first + * Game Object in this Container with a matching property and / or value. + * + * For example: `getFirst('visible', true)` would return the first Game Object that had its `visible` property set. + * + * You can limit the search to the `startIndex` - `endIndex` range. + * + * @method Phaser.GameObjects.Container#getFirst + * @since 3.4.0 + * + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [$return] + * + * @param {string} property - The property to test on each Game Object in the Container. + * @param {*} value - The value to test the property against. Must pass a strict (`===`) comparison check. + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) + * + * @return {?Phaser.GameObjects.GameObject} The first matching Game Object, or `null` if none was found. + */ + getFirst: function (property, value, startIndex, endIndex) + { + return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); + }, - if (renderer && renderer.type === CONST.WEBGL) - { - renderer.resetTextures(true); - } + /** + * Returns all Game Objects in this Container. + * + * You can optionally specify a matching criteria using the `property` and `value` arguments. + * + * For example: `getAll('body')` would return only Game Objects that have a body property. + * + * You can also specify a value to compare the property to: + * + * `getAll('visible', true)` would return only Game Objects that have their visible property set to `true`. + * + * Optionally you can specify a start and end index. For example if this Container had 100 Game Objects, + * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only + * the first 50 Game Objects. + * + * @method Phaser.GameObjects.Container#getAll + * @since 3.4.0 + * + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T[]} - [$return] + * + * @param {string} [property] - The property to test on each Game Object in the Container. + * @param {any} [value] - If property is set then the `property` must strictly equal this value to be included in the results. + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) + * + * @return {Phaser.GameObjects.GameObject[]} An array of matching Game Objects from this Container. + */ + getAll: function (property, value, startIndex, endIndex) + { + return ArrayUtils.GetAll(this.list, property, value, startIndex, endIndex); + }, - this.manager = null; - } + /** + * Returns the total number of Game Objects in this Container that have a property + * matching the given value. + * + * For example: `count('visible', true)` would count all the elements that have their visible property set. + * + * You can optionally limit the operation to the `startIndex` - `endIndex` range. + * + * @method Phaser.GameObjects.Container#count + * @since 3.4.0 + * + * @param {string} property - The property to check. + * @param {any} value - The value to check. + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) + * + * @return {number} The total number of Game Objects in this Container with a property matching the given value. + */ + count: function (property, value, startIndex, endIndex) + { + return ArrayUtils.CountAllMatching(this.list, property, value, startIndex, endIndex); + }, -}); + /** + * Swaps the position of two Game Objects in this Container. + * Both Game Objects must belong to this Container. + * + * @method Phaser.GameObjects.Container#swap + * @since 3.4.0 + * + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [child1,child2] + * + * @param {Phaser.GameObjects.GameObject} child1 - The first Game Object to swap. + * @param {Phaser.GameObjects.GameObject} child2 - The second Game Object to swap. + * + * @return {this} This Container instance. + */ + swap: function (child1, child2) + { + ArrayUtils.Swap(this.list, child1, child2); -module.exports = Texture; + return this; + }, + /** + * Moves a Game Object to a new position within this Container. + * + * The Game Object must already be a child of this Container. + * + * The Game Object is removed from its old position and inserted into the new one. + * Therefore the Container size does not change. Other children will change position accordingly. + * + * @method Phaser.GameObjects.Container#moveTo + * @since 3.4.0 + * + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [child] + * + * @param {Phaser.GameObjects.GameObject} child - The Game Object to move. + * @param {number} index - The new position of the Game Object in this Container. + * + * @return {this} This Container instance. + */ + moveTo: function (child, index) + { + ArrayUtils.MoveTo(this.list, child, index); -/***/ }), -/* 207 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Moves a Game Object above another one within this Container. + * + * These 2 Game Objects must already be children of this Container. + * + * @method Phaser.GameObjects.Container#moveAbove + * @since 3.55.0 + * + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [child1,child2] + * + * @param {Phaser.GameObjects.GameObject} child1 - The Game Object to move above base Game Object. + * @param {Phaser.GameObjects.GameObject} child2 - The base Game Object. + * + * @return {this} This Container instance. + */ + moveAbove: function (child1, child2) + { + ArrayUtils.MoveAbove(this.list, child1, child2); -var SafeRange = __webpack_require__(78); + return this; + }, -/** - * Returns all elements in the array. - * - * You can optionally specify a matching criteria using the `property` and `value` arguments. - * - * For example: `getAll('visible', true)` would return only elements that have their visible property set. - * - * Optionally you can specify a start and end index. For example if the array had 100 elements, - * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only - * the first 50 elements. - * - * @function Phaser.Utils.Array.GetAll - * @since 3.4.0 - * - * @param {array} array - The array to search. - * @param {string} [property] - The property to test on each array element. - * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {number} [startIndex] - An optional start index to search from. - * @param {number} [endIndex] - An optional end index to search to. - * - * @return {array} All matching elements from the array. - */ -var GetAll = function (array, property, value, startIndex, endIndex) -{ - if (startIndex === undefined) { startIndex = 0; } - if (endIndex === undefined) { endIndex = array.length; } + /** + * Moves a Game Object below another one within this Container. + * + * These 2 Game Objects must already be children of this Container. + * + * @method Phaser.GameObjects.Container#moveBelow + * @since 3.55.0 + * + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [child1,child2] + * + * @param {Phaser.GameObjects.GameObject} child1 - The Game Object to move below base Game Object. + * @param {Phaser.GameObjects.GameObject} child2 - The base Game Object. + * + * @return {this} This Container instance. + */ + moveBelow: function (child1, child2) + { + ArrayUtils.MoveBelow(this.list, child1, child2); - var output = []; + return this; + }, - if (SafeRange(array, startIndex, endIndex)) + /** + * Removes the given Game Object, or array of Game Objects, from this Container. + * + * The Game Objects must already be children of this Container. + * + * You can also optionally call `destroy` on each Game Object that is removed from the Container. + * + * @method Phaser.GameObjects.Container#remove + * @since 3.4.0 + * + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {(T|T[])} - [child] + * + * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Object, or array of Game Objects, to be removed from the Container. + * @param {boolean} [destroyChild=false] - Optionally call `destroy` on each child successfully removed from this Container. + * + * @return {this} This Container instance. + */ + remove: function (child, destroyChild) { - for (var i = startIndex; i < endIndex; i++) + var removed = ArrayUtils.Remove(this.list, child, this.removeHandler, this); + + if (destroyChild && removed) { - var child = array[i]; + if (!Array.isArray(removed)) + { + removed = [ removed ]; + } - if (!property || - (property && value === undefined && child.hasOwnProperty(property)) || - (property && value !== undefined && child[property] === value)) + for (var i = 0; i < removed.length; i++) { - output.push(child); + removed[i].destroy(); } } - } - - return output; -}; - -module.exports = GetAll; - - -/***/ }), -/* 208 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Utils.Array - */ - -module.exports = { - - Matrix: __webpack_require__(1013), - - Add: __webpack_require__(1021), - AddAt: __webpack_require__(1022), - BringToTop: __webpack_require__(1023), - CountAllMatching: __webpack_require__(1024), - Each: __webpack_require__(1025), - EachInRange: __webpack_require__(1026), - FindClosestInSorted: __webpack_require__(318), - GetAll: __webpack_require__(207), - GetFirst: __webpack_require__(428), - GetRandom: __webpack_require__(210), - MoveDown: __webpack_require__(1027), - MoveTo: __webpack_require__(1028), - MoveUp: __webpack_require__(1029), - MoveAbove: __webpack_require__(1030), - MoveBelow: __webpack_require__(1031), - NumberArray: __webpack_require__(322), - NumberArrayStep: __webpack_require__(1032), - QuickSelect: __webpack_require__(436), - Range: __webpack_require__(437), - Remove: __webpack_require__(93), - RemoveAt: __webpack_require__(1033), - RemoveBetween: __webpack_require__(1034), - RemoveRandomElement: __webpack_require__(1035), - Replace: __webpack_require__(1036), - RotateLeft: __webpack_require__(178), - RotateRight: __webpack_require__(179), - SafeRange: __webpack_require__(78), - SendToBack: __webpack_require__(1037), - SetAll: __webpack_require__(1038), - Shuffle: __webpack_require__(131), - SortByDigits: __webpack_require__(320), - SpliceOne: __webpack_require__(74), - StableSort: __webpack_require__(79), - Swap: __webpack_require__(1039) - -}; - - -/***/ }), -/* 209 */ -/***/ (function(module, exports) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -/** - * Checks if an array can be used as a matrix. - * - * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) - * have the same length. There must be at least two rows. This is an example matrix: - * - * ``` - * [ - * [ 1, 1, 1, 1, 1, 1 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 2, 0, 1, 2, 0, 4 ], - * [ 2, 0, 3, 4, 0, 4 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 3, 3, 3, 3, 3, 3 ] - * ] - * ``` - * - * @function Phaser.Utils.Array.Matrix.CheckMatrix - * @since 3.0.0 - * - * @generic T - * @genericUse {T[][]} - [matrix] - * - * @param {T[][]} [matrix] - The array to check. - * - * @return {boolean} `true` if the given `matrix` array is a valid matrix. - */ -var CheckMatrix = function (matrix) -{ - if (!Array.isArray(matrix) || matrix.length < 2 || !Array.isArray(matrix[0])) + /** + * Removes the Game Object at the given position in this Container. + * + * You can also optionally call `destroy` on the Game Object, if one is found. + * + * @method Phaser.GameObjects.Container#removeAt + * @since 3.4.0 + * + * @param {number} index - The index of the Game Object to be removed. + * @param {boolean} [destroyChild=false] - Optionally call `destroy` on the Game Object if successfully removed from this Container. + * + * @return {this} This Container instance. + */ + removeAt: function (index, destroyChild) { - return false; - } - - // How long is the first row? - var size = matrix[0].length; + var removed = ArrayUtils.RemoveAt(this.list, index, this.removeHandler, this); - // Validate the rest of the rows are the same length - for (var i = 1; i < matrix.length; i++) - { - if (matrix[i].length !== size) + if (destroyChild && removed) { - return false; + removed.destroy(); } - } - - return true; -}; - -module.exports = CheckMatrix; - - -/***/ }), -/* 210 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Returns a Random element from the array. - * - * @function Phaser.Utils.Array.GetRandom - * @since 3.0.0 - * - * @param {array} array - The array to select the random entry from. - * @param {number} [startIndex=0] - An optional start index. - * @param {number} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from. - * - * @return {*} A random element from the array, or `null` if no element could be found in the range given. - */ -var GetRandom = function (array, startIndex, length) -{ - if (startIndex === undefined) { startIndex = 0; } - if (length === undefined) { length = array.length; } - - var randomIndex = startIndex + Math.floor(Math.random() * length); - - return (array[randomIndex] === undefined) ? null : array[randomIndex]; -}; - -module.exports = GetRandom; - - -/***/ }), -/* 211 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(438); + return this; + }, -/** - * @classdesc - * A Process Queue maintains three internal lists. - * - * The `pending` list is a selection of items which are due to be made 'active' in the next update. - * The `active` list is a selection of items which are considered active and should be updated. - * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. - * - * When new items are added to a Process Queue they are put in the pending list, rather than being added - * immediately the active list. Equally, items that are removed are put into the destroy list, rather than - * being destroyed immediately. This allows the Process Queue to carefully process each item at a specific, fixed - * time, rather than at the time of the request from the API. - * - * @class ProcessQueue - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Structs - * @constructor - * @since 3.0.0 - * - * @generic T - */ -var ProcessQueue = new Class({ + /** + * Removes the Game Objects between the given positions in this Container. + * + * You can also optionally call `destroy` on each Game Object that is removed from the Container. + * + * @method Phaser.GameObjects.Container#removeBetween + * @since 3.4.0 + * + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {boolean} [destroyChild=false] - Optionally call `destroy` on each Game Object successfully removed from this Container. + * + * @return {this} This Container instance. + */ + removeBetween: function (startIndex, endIndex, destroyChild) + { + var removed = ArrayUtils.RemoveBetween(this.list, startIndex, endIndex, this.removeHandler, this); - Extends: EventEmitter, + if (destroyChild) + { + for (var i = 0; i < removed.length; i++) + { + removed[i].destroy(); + } + } - initialize: + return this; + }, - function ProcessQueue () + /** + * Removes all Game Objects from this Container. + * + * You can also optionally call `destroy` on each Game Object that is removed from the Container. + * + * @method Phaser.GameObjects.Container#removeAll + * @since 3.4.0 + * + * @param {boolean} [destroyChild=false] - Optionally call `destroy` on each Game Object successfully removed from this Container. + * + * @return {this} This Container instance. + */ + removeAll: function (destroyChild) { - EventEmitter.call(this); - - /** - * The `pending` list is a selection of items which are due to be made 'active' in the next update. - * - * @genericUse {T[]} - [$type] - * - * @name Phaser.Structs.ProcessQueue#_pending - * @type {Array.<*>} - * @private - * @default [] - * @since 3.0.0 - */ - this._pending = []; + var list = this.list; - /** - * The `active` list is a selection of items which are considered active and should be updated. - * - * @genericUse {T[]} - [$type] - * - * @name Phaser.Structs.ProcessQueue#_active - * @type {Array.<*>} - * @private - * @default [] - * @since 3.0.0 - */ - this._active = []; + if (destroyChild) + { + for (var i = 0; i < list.length; i++) + { + if (list[i] && list[i].scene) + { + list[i].off(Events.DESTROY, this.remove, this); - /** - * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. - * - * @genericUse {T[]} - [$type] - * - * @name Phaser.Structs.ProcessQueue#_destroy - * @type {Array.<*>} - * @private - * @default [] - * @since 3.0.0 - */ - this._destroy = []; + list[i].destroy(); + } + } - /** - * The total number of items awaiting processing. - * - * @name Phaser.Structs.ProcessQueue#_toProcess - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._toProcess = 0; + this.list = []; + } + else + { + ArrayUtils.RemoveBetween(list, 0, list.length, this.removeHandler, this); + } - /** - * If `true` only unique objects will be allowed in the queue. - * - * @name Phaser.Structs.ProcessQueue#checkQueue - * @type {boolean} - * @since 3.50.0 - */ - this.checkQueue = false; + return this; }, /** - * Adds a new item to the Process Queue. - * - * The item is added to the pending list and made active in the next update. + * Brings the given Game Object to the top of this Container. + * This will cause it to render on-top of any other objects in the Container. * - * @method Phaser.Structs.ProcessQueue#add - * @since 3.0.0 + * @method Phaser.GameObjects.Container#bringToTop + * @since 3.4.0 * - * @genericUse {T} - [item] - * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [child] * - * @param {*} item - The item to add to the queue. + * @param {Phaser.GameObjects.GameObject} child - The Game Object to bring to the top of the Container. * - * @return {*} The item that was added. + * @return {this} This Container instance. */ - add: function (item) + bringToTop: function (child) { - this._pending.push(item); - - this._toProcess++; + ArrayUtils.BringToTop(this.list, child); - return item; + return this; }, /** - * Removes an item from the Process Queue. - * - * The item is added to the pending destroy and fully removed in the next update. + * Sends the given Game Object to the bottom of this Container. + * This will cause it to render below any other objects in the Container. * - * @method Phaser.Structs.ProcessQueue#remove - * @since 3.0.0 + * @method Phaser.GameObjects.Container#sendToBack + * @since 3.4.0 * - * @genericUse {T} - [item] - * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [child] * - * @param {*} item - The item to be removed from the queue. + * @param {Phaser.GameObjects.GameObject} child - The Game Object to send to the bottom of the Container. * - * @return {*} The item that was removed. + * @return {this} This Container instance. */ - remove: function (item) + sendToBack: function (child) { - this._destroy.push(item); - - this._toProcess++; + ArrayUtils.SendToBack(this.list, child); - return item; + return this; }, /** - * Removes all active items from this Process Queue. + * Moves the given Game Object up one place in this Container, unless it's already at the top. * - * All the items are marked as 'pending destroy' and fully removed in the next update. + * @method Phaser.GameObjects.Container#moveUp + * @since 3.4.0 * - * @method Phaser.Structs.ProcessQueue#removeAll - * @since 3.20.0 + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [child] * - * @return {this} This Process Queue object. + * @param {Phaser.GameObjects.GameObject} child - The Game Object to be moved in the Container. + * + * @return {this} This Container instance. */ - removeAll: function () + moveUp: function (child) { - var list = this._active; - var destroy = this._destroy; - var i = list.length; - - while (i--) - { - destroy.push(list[i]); - - this._toProcess++; - } + ArrayUtils.MoveUp(this.list, child); return this; }, /** - * Update this queue. First it will process any items awaiting destruction, and remove them. + * Moves the given Game Object down one place in this Container, unless it's already at the bottom. * - * Then it will check to see if there are any items pending insertion, and move them to an - * active state. Finally, it will return a list of active items for further processing. + * @method Phaser.GameObjects.Container#moveDown + * @since 3.4.0 * - * @method Phaser.Structs.ProcessQueue#update - * @since 3.0.0 + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [child] * - * @genericUse {T[]} - [$return] + * @param {Phaser.GameObjects.GameObject} child - The Game Object to be moved in the Container. * - * @return {Array.<*>} A list of active items. + * @return {this} This Container instance. */ - update: function () + moveDown: function (child) { - if (this._toProcess === 0) - { - // Quick bail - return this._active; - } - - var list = this._destroy; - var active = this._active; - var i; - var item; - - // Clear the 'destroy' list - for (i = 0; i < list.length; i++) - { - item = list[i]; + ArrayUtils.MoveDown(this.list, child); - // Remove from the 'active' array - var idx = active.indexOf(item); + return this; + }, - if (idx !== -1) - { - active.splice(idx, 1); + /** + * Reverses the order of all Game Objects in this Container. + * + * @method Phaser.GameObjects.Container#reverse + * @since 3.4.0 + * + * @return {this} This Container instance. + */ + reverse: function () + { + this.list.reverse(); - this.emit(Events.PROCESS_QUEUE_REMOVE, item); - } - } + return this; + }, - list.length = 0; + /** + * Shuffles the all Game Objects in this Container using the Fisher-Yates implementation. + * + * @method Phaser.GameObjects.Container#shuffle + * @since 3.4.0 + * + * @return {this} This Container instance. + */ + shuffle: function () + { + ArrayUtils.Shuffle(this.list); - // Process the pending addition list - // This stops callbacks and out of sync events from populating the active array mid-way during an update + return this; + }, - list = this._pending; + /** + * Replaces a Game Object in this Container with the new Game Object. + * The new Game Object cannot already be a child of this Container. + * + * @method Phaser.GameObjects.Container#replace + * @since 3.4.0 + * + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [oldChild,newChild] + * + * @param {Phaser.GameObjects.GameObject} oldChild - The Game Object in this Container that will be replaced. + * @param {Phaser.GameObjects.GameObject} newChild - The Game Object to be added to this Container. + * @param {boolean} [destroyChild=false] - Optionally call `destroy` on the Game Object if successfully removed from this Container. + * + * @return {this} This Container instance. + */ + replace: function (oldChild, newChild, destroyChild) + { + var moved = ArrayUtils.Replace(this.list, oldChild, newChild); - for (i = 0; i < list.length; i++) + if (moved) { - item = list[i]; + this.addHandler(newChild); + this.removeHandler(oldChild); - if (!this.checkQueue || (this.checkQueue && active.indexOf(item) === -1)) + if (destroyChild) { - active.push(item); - - this.emit(Events.PROCESS_QUEUE_ADD, item); + oldChild.destroy(); } } - list.length = 0; - - this._toProcess = 0; - - // The owner of this queue can now safely do whatever it needs to with the active list - return active; + return this; }, /** - * Returns the current list of active items. + * Returns `true` if the given Game Object is a direct child of this Container. * - * This method returns a reference to the active list array, not a copy of it. - * Therefore, be careful to not modify this array outside of the ProcessQueue. + * This check does not scan nested Containers. * - * @method Phaser.Structs.ProcessQueue#getActive - * @since 3.0.0 + * @method Phaser.GameObjects.Container#exists + * @since 3.4.0 * - * @genericUse {T[]} - [$return] + * @generic {Phaser.GameObjects.GameObject} T + * @genericUse {T} - [child] * - * @return {Array.<*>} A list of active items. + * @param {Phaser.GameObjects.GameObject} child - The Game Object to check for within this Container. + * + * @return {boolean} True if the Game Object is an immediate child of this Container, otherwise false. */ - getActive: function () + exists: function (child) { - return this._active; + return (this.list.indexOf(child) > -1); }, /** - * The number of entries in the active list. + * Sets the property to the given value on all Game Objects in this Container. * - * @name Phaser.Structs.ProcessQueue#length - * @type {number} - * @readonly - * @since 3.20.0 + * Optionally you can specify a start and end index. For example if this Container had 100 Game Objects, + * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only + * the first 50 Game Objects. + * + * @method Phaser.GameObjects.Container#setAll + * @since 3.4.0 + * + * @param {string} property - The property that must exist on the Game Object. + * @param {any} value - The value to get the property to. + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) + * + * @return {this} This Container instance. */ - length: { - - get: function () - { - return this._active.length; - } + setAll: function (property, value, startIndex, endIndex) + { + ArrayUtils.SetAll(this.list, property, value, startIndex, endIndex); + return this; }, /** - * Immediately destroys this process queue, clearing all of its internal arrays and resetting the process totals. + * @callback EachContainerCallback + * @generic I - [item] * - * @method Phaser.Structs.ProcessQueue#destroy - * @since 3.0.0 + * @param {*} item - The child Game Object of the Container. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. */ - destroy: function () - { - this._toProcess = 0; - this._pending = []; - this._active = []; - this._destroy = []; - } + /** + * Passes all Game Objects in this Container to the given callback. + * + * A copy of the Container is made before passing each entry to your callback. + * This protects against the callback itself modifying the Container. + * + * If you know for sure that the callback will not change the size of this Container + * then you can use the more performant `Container.iterate` method instead. + * + * @method Phaser.GameObjects.Container#each + * @since 3.4.0 + * + * @param {function} callback - The function to call. + * @param {object} [context] - Value to use as `this` when executing callback. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + * + * @return {this} This Container instance. + */ + each: function (callback, context) + { + var args = [ null ]; + var i; + var temp = this.list.slice(); + var len = temp.length; -}); + for (i = 2; i < arguments.length; i++) + { + args.push(arguments[i]); + } -module.exports = ProcessQueue; + for (i = 0; i < len; i++) + { + args[0] = temp[i]; + callback.apply(context, args); + } -/***/ }), -/* 212 */ -/***/ (function(module, exports) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Passes all Game Objects in this Container to the given callback. + * + * Only use this method when you absolutely know that the Container will not be modified during + * the iteration, i.e. by removing or adding to its contents. + * + * @method Phaser.GameObjects.Container#iterate + * @since 3.4.0 + * + * @param {function} callback - The function to call. + * @param {object} [context] - Value to use as `this` when executing callback. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + * + * @return {this} This Container instance. + */ + iterate: function (callback, context) + { + var args = [ null ]; + var i; -/** - * Read an integer value from an XML Node. - * - * @function getValue - * @since 3.0.0 - * @private - * - * @param {Node} node - The XML Node. - * @param {string} attribute - The attribute to read. - * - * @return {number} The parsed value. - */ -function getValue (node, attribute) -{ - return parseInt(node.getAttribute(attribute), 10); -} + for (i = 2; i < arguments.length; i++) + { + args.push(arguments[i]); + } -/** - * Parse an XML font to Bitmap Font data for the Bitmap Font cache. - * - * @function ParseXMLBitmapFont - * @since 3.0.0 - * @private - * - * @param {XMLDocument} xml - The XML Document to parse the font from. - * @param {Phaser.Textures.Frame} frame - The texture frame to take into account when creating the uv data. - * @param {number} [xSpacing=0] - The x-axis spacing to add between each letter. - * @param {number} [ySpacing=0] - The y-axis spacing to add to the line height. - * @param {Phaser.Textures.Texture} [texture] - If provided, each glyph in the Bitmap Font will be added to this texture as a frame. - * - * @return {Phaser.Types.GameObjects.BitmapText.BitmapFontData} The parsed Bitmap Font data. - */ -var ParseXMLBitmapFont = function (xml, frame, xSpacing, ySpacing, texture) -{ - if (xSpacing === undefined) { xSpacing = 0; } - if (ySpacing === undefined) { ySpacing = 0; } + for (i = 0; i < this.list.length; i++) + { + args[0] = this.list[i]; - var textureX = frame.cutX; - var textureY = frame.cutY; - var textureWidth = frame.source.width; - var textureHeight = frame.source.height; - var sourceIndex = frame.sourceIndex; + callback.apply(context, args); + } - var data = {}; - var info = xml.getElementsByTagName('info')[0]; - var common = xml.getElementsByTagName('common')[0]; + return this; + }, - data.font = info.getAttribute('face'); - data.size = getValue(info, 'size'); - data.lineHeight = getValue(common, 'lineHeight') + ySpacing; - data.chars = {}; + /** + * Sets the scroll factor of this Container and optionally all of its children. + * + * The scroll factor controls the influence of the movement of a Camera upon this Game Object. + * + * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. + * It does not change the Game Objects actual position values. + * + * A value of 1 means it will move exactly in sync with a camera. + * A value of 0 means it will not move at all, even if the camera moves. + * Other values control the degree to which the camera movement is mapped to this Game Object. + * + * Please be aware that scroll factor values other than 1 are not taken in to consideration when + * calculating physics collisions. Bodies always collide based on their world position, but changing + * the scroll factor is a visual adjustment to where the textures are rendered, which can offset + * them from physics bodies if not accounted for in your code. + * + * @method Phaser.GameObjects.Container#setScrollFactor + * @since 3.4.0 + * + * @param {number} x - The horizontal scroll factor of this Game Object. + * @param {number} [y=x] - The vertical scroll factor of this Game Object. If not set it will use the `x` value. + * @param {boolean} [updateChildren=false] - Apply this scrollFactor to all Container children as well? + * + * @return {this} This Game Object instance. + */ + setScrollFactor: function (x, y, updateChildren) + { + if (y === undefined) { y = x; } + if (updateChildren === undefined) { updateChildren = false; } - var letters = xml.getElementsByTagName('char'); + this.scrollFactorX = x; + this.scrollFactorY = y; - var adjustForTrim = (frame !== undefined && frame.trimmed); + if (updateChildren) + { + ArrayUtils.SetAll(this.list, 'scrollFactorX', x); + ArrayUtils.SetAll(this.list, 'scrollFactorY', y); + } - if (adjustForTrim) - { - var top = frame.height; - var left = frame.width; - } + return this; + }, - for (var i = 0; i < letters.length; i++) - { - var node = letters[i]; + /** + * The number of Game Objects inside this Container. + * + * @name Phaser.GameObjects.Container#length + * @type {number} + * @readonly + * @since 3.4.0 + */ + length: { - var charCode = getValue(node, 'id'); - var letter = String.fromCharCode(charCode); - var gx = getValue(node, 'x'); - var gy = getValue(node, 'y'); - var gw = getValue(node, 'width'); - var gh = getValue(node, 'height'); + get: function () + { + return this.list.length; + } - // Handle frame trim issues + }, - if (adjustForTrim) + /** + * Returns the first Game Object within the Container, or `null` if it is empty. + * + * You can move the cursor by calling `Container.next` and `Container.previous`. + * + * @name Phaser.GameObjects.Container#first + * @type {?Phaser.GameObjects.GameObject} + * @readonly + * @since 3.4.0 + */ + first: { + + get: function () { - if (gx < left) + this.position = 0; + + if (this.list.length > 0) { - left = gx; + return this.list[0]; } - - if (gy < top) + else { - top = gy; + return null; } } - if (adjustForTrim && top !== 0 && left !== 0) + }, + + /** + * Returns the last Game Object within the Container, or `null` if it is empty. + * + * You can move the cursor by calling `Container.next` and `Container.previous`. + * + * @name Phaser.GameObjects.Container#last + * @type {?Phaser.GameObjects.GameObject} + * @readonly + * @since 3.4.0 + */ + last: { + + get: function () { - // Now we know the top and left coordinates of the glyphs in the original data - // so we can work out how much to adjust the glyphs by + if (this.list.length > 0) + { + this.position = this.list.length - 1; - gx -= frame.x; - gy -= frame.y; + return this.list[this.position]; + } + else + { + return null; + } } - var u0 = (textureX + gx) / textureWidth; - var v0 = (textureY + gy) / textureHeight; - var u1 = (textureX + gx + gw) / textureWidth; - var v1 = (textureY + gy + gh) / textureHeight; + }, - data.chars[charCode] = + /** + * Returns the next Game Object within the Container, or `null` if it is empty. + * + * You can move the cursor by calling `Container.next` and `Container.previous`. + * + * @name Phaser.GameObjects.Container#next + * @type {?Phaser.GameObjects.GameObject} + * @readonly + * @since 3.4.0 + */ + next: { + + get: function () { - x: gx, - y: gy, - width: gw, - height: gh, - centerX: Math.floor(gw / 2), - centerY: Math.floor(gh / 2), - xOffset: getValue(node, 'xoffset'), - yOffset: getValue(node, 'yoffset'), - xAdvance: getValue(node, 'xadvance') + xSpacing, - data: {}, - kerning: {}, - u0: u0, - v0: v0, - u1: u1, - v1: v1 - }; + if (this.position < this.list.length) + { + this.position++; - if (texture && gw !== 0 && gh !== 0) + return this.list[this.position]; + } + else + { + return null; + } + } + + }, + + /** + * Returns the previous Game Object within the Container, or `null` if it is empty. + * + * You can move the cursor by calling `Container.next` and `Container.previous`. + * + * @name Phaser.GameObjects.Container#previous + * @type {?Phaser.GameObjects.GameObject} + * @readonly + * @since 3.4.0 + */ + previous: { + + get: function () { - var charFrame = texture.add(letter, sourceIndex, gx, gy, gw, gh); + if (this.position > 0) + { + this.position--; - if (charFrame) + return this.list[this.position]; + } + else { - charFrame.setUVs(gw, gh, u0, v0, u1, v1); + return null; } } + + }, + + /** + * Internal destroy handler, called as part of the destroy process. + * + * @method Phaser.GameObjects.Container#preDestroy + * @protected + * @since 3.9.0 + */ + preDestroy: function () + { + this.removeAll(!!this.exclusive); + + this.localTransform.destroy(); + this.tempTransformMatrix.destroy(); + + this.list = []; } - var kernings = xml.getElementsByTagName('kerning'); +}); - for (i = 0; i < kernings.length; i++) +module.exports = Container; + + +/***/ }), + +/***/ 13916: +/***/ ((module) => { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Container#renderCanvas + * @since 3.4.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Container} container - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var ContainerCanvasRenderer = function (renderer, container, camera, parentMatrix) +{ + camera.addToRenderList(container); + + var children = container.list; + + if (children.length === 0) { - var kern = kernings[i]; + return; + } - var first = getValue(kern, 'first'); - var second = getValue(kern, 'second'); - var amount = getValue(kern, 'amount'); + var transformMatrix = container.localTransform; - data.chars[second].kerning[first] = amount; + if (parentMatrix) + { + transformMatrix.loadIdentity(); + transformMatrix.multiply(parentMatrix); + transformMatrix.translate(container.x, container.y); + transformMatrix.rotate(container.rotation); + transformMatrix.scale(container.scaleX, container.scaleY); + } + else + { + transformMatrix.applyITRS(container.x, container.y, container.rotation, container.scaleX, container.scaleY); } - return data; + var containerHasBlendMode = (container.blendMode !== -1); + + if (!containerHasBlendMode) + { + // If Container is SKIP_TEST then set blend mode to be Normal + renderer.setBlendMode(0); + } + + var alpha = container._alpha; + var scrollFactorX = container.scrollFactorX; + var scrollFactorY = container.scrollFactorY; + + if (container.mask) + { + container.mask.preRenderCanvas(renderer, null, camera); + } + + for (var i = 0; i < children.length; i++) + { + var child = children[i]; + + if (!child.willRender(camera)) + { + continue; + } + + var childAlpha = child.alpha; + var childScrollFactorX = child.scrollFactorX; + var childScrollFactorY = child.scrollFactorY; + + if (!containerHasBlendMode && child.blendMode !== renderer.currentBlendMode) + { + // If Container doesn't have its own blend mode, then a child can have one + renderer.setBlendMode(child.blendMode); + } + + // Set parent values + child.setScrollFactor(childScrollFactorX * scrollFactorX, childScrollFactorY * scrollFactorY); + child.setAlpha(childAlpha * alpha); + + // Render + child.renderCanvas(renderer, child, camera, transformMatrix); + + // Restore original values + child.setAlpha(childAlpha); + child.setScrollFactor(childScrollFactorX, childScrollFactorY); + } + + if (container.mask) + { + container.mask.postRenderCanvas(renderer); + } }; -module.exports = ParseXMLBitmapFont; +module.exports = ContainerCanvasRenderer; /***/ }), -/* 213 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 44516: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlitterRender = __webpack_require__(1049); -var Bob = __webpack_require__(440); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var Frame = __webpack_require__(109); -var GameObject = __webpack_require__(15); -var List = __webpack_require__(110); +var BuildGameObject = __webpack_require__(88933); +var Container = __webpack_require__(70339); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); /** - * @callback CreateCallback + * Creates a new Container Game Object and returns it. * - * @param {Phaser.GameObjects.Bob} bob - The Bob that was created by the Blitter. - * @param {number} index - The position of the Bob within the Blitter display list. + * Note: This method will only be available if the Container Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#container + * @since 3.4.0 + * + * @param {Phaser.Types.GameObjects.Container.ContainerConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Container} The Game Object that was created. + */ +GameObjectCreator.register('container', function (config, addToScene) +{ + if (config === undefined) { config = {}; } + + var x = GetAdvancedValue(config, 'x', 0); + var y = GetAdvancedValue(config, 'y', 0); + var children = GetAdvancedValue(config, 'children', null); + + var container = new Container(this.scene, x, y, children); + + if (addToScene !== undefined) + { + config.add = addToScene; + } + + BuildGameObject(this.scene, container, config); + + return container; +}); + + +/***/ }), + +/***/ 23400: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Container = __webpack_require__(70339); +var GameObjectFactory = __webpack_require__(61286); + /** - * @classdesc - * A Blitter Game Object. + * Creates a new Container Game Object and adds it to the Scene. * - * The Blitter Game Object is a special kind of container that creates, updates and manages Bob objects. - * Bobs are designed for rendering speed rather than flexibility. They consist of a texture, or frame from a texture, - * a position and an alpha value. You cannot scale or rotate them. They use a batched drawing method for speed - * during rendering. + * Note: This method will only be available if the Container Game Object has been built into Phaser. * - * A Blitter Game Object has one texture bound to it. Bobs created by the Blitter can use any Frame from this - * Texture to render with, but they cannot use any other Texture. It is this single texture-bind that allows - * them their speed. + * @method Phaser.GameObjects.GameObjectFactory#container + * @since 3.4.0 * - * If you have a need to blast a large volume of frames around the screen then Blitter objects are well worth - * investigating. They are especially useful for using as a base for your own special effects systems. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Container. * - * @class Blitter - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor - * @since 3.0.0 + * @return {Phaser.GameObjects.Container} The Game Object that was created. + */ +GameObjectFactory.register('container', function (x, y, children) +{ + return this.displayList.add(new Container(this.scene, x, y, children)); +}); + + +/***/ }), + +/***/ 98524: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(36934); +} + +if (true) +{ + renderCanvas = __webpack_require__(13916); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), + +/***/ 36934: +/***/ ((module) => { + +/** + * @author Richard Davey + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible + * @method Phaser.GameObjects.Container#renderWebGL + * @since 3.4.0 + * @private * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time. - * @param {number} [x=0] - The x coordinate of this Game Object in world space. - * @param {number} [y=0] - The y coordinate of this Game Object in world space. - * @param {string} [texture='__DEFAULT'] - The key of the texture this Game Object will use for rendering. The Texture must already exist in the Texture Manager. - * @param {(string|number)} [frame=0] - The Frame of the Texture that this Game Object will use. Only set if the Texture has multiple frames, such as a Texture Atlas or Sprite Sheet. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Container} container - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var Blitter = new Class({ +var ContainerWebGLRenderer = function (renderer, container, camera, parentMatrix) +{ + camera.addToRenderList(container); - Extends: GameObject, + var children = container.list; + var childCount = children.length; - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.Depth, - Components.Mask, - Components.Pipeline, - Components.ScrollFactor, - Components.Size, - Components.Texture, - Components.Transform, - Components.Visible, - BlitterRender - ], + if (childCount === 0) + { + return; + } - initialize: + var transformMatrix = container.localTransform; - function Blitter (scene, x, y, texture, frame) + if (parentMatrix) { - GameObject.call(this, scene, 'Blitter'); + transformMatrix.loadIdentity(); + transformMatrix.multiply(parentMatrix); + transformMatrix.translate(container.x, container.y); + transformMatrix.rotate(container.rotation); + transformMatrix.scale(container.scaleX, container.scaleY); + } + else + { + transformMatrix.applyITRS(container.x, container.y, container.rotation, container.scaleX, container.scaleY); + } - this.setTexture(texture, frame); - this.setPosition(x, y); - this.initPipeline(); + renderer.pipelines.preBatch(container); - /** - * The children of this Blitter. - * This List contains all of the Bob objects created by the Blitter. - * - * @name Phaser.GameObjects.Blitter#children - * @type {Phaser.Structs.List.} - * @since 3.0.0 - */ - this.children = new List(); + var containerHasBlendMode = (container.blendMode !== -1); - /** - * A transient array that holds all of the Bobs that will be rendered this frame. - * The array is re-populated whenever the dirty flag is set. - * - * @name Phaser.GameObjects.Blitter#renderList - * @type {Phaser.GameObjects.Bob[]} - * @default [] - * @private - * @since 3.0.0 - */ - this.renderList = []; + if (!containerHasBlendMode) + { + // If Container is SKIP_TEST then set blend mode to be Normal + renderer.setBlendMode(0); + } - /** - * Is the Blitter considered dirty? - * A 'dirty' Blitter has had its child count changed since the last frame. - * - * @name Phaser.GameObjects.Blitter#dirty - * @type {boolean} - * @since 3.0.0 - */ - this.dirty = false; - }, + var alpha = container.alpha; - /** - * Creates a new Bob in this Blitter. - * - * The Bob is created at the given coordinates, relative to the Blitter and uses the given frame. - * A Bob can use any frame belonging to the texture bound to the Blitter. - * - * @method Phaser.GameObjects.Blitter#create - * @since 3.0.0 - * - * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. - * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. - * @param {(string|number|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. - * @param {boolean} [visible=true] - Should the created Bob render or not? - * @param {number} [index] - The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list. - * - * @return {Phaser.GameObjects.Bob} The newly created Bob object. - */ - create: function (x, y, frame, visible, index) + var scrollFactorX = container.scrollFactorX; + var scrollFactorY = container.scrollFactorY; + + for (var i = 0; i < childCount; i++) { - if (visible === undefined) { visible = true; } - if (index === undefined) { index = this.children.length; } + var child = children[i]; - if (frame === undefined) + if (!child.willRender(camera)) { - frame = this.frame; + continue; } - else if (!(frame instanceof Frame)) + + var childAlphaTopLeft; + var childAlphaTopRight; + var childAlphaBottomLeft; + var childAlphaBottomRight; + + if (child.alphaTopLeft !== undefined) { - frame = this.texture.get(frame); + childAlphaTopLeft = child.alphaTopLeft; + childAlphaTopRight = child.alphaTopRight; + childAlphaBottomLeft = child.alphaBottomLeft; + childAlphaBottomRight = child.alphaBottomRight; } + else + { + var childAlpha = child.alpha; - var bob = new Bob(this, x, y, frame, visible); - - this.children.addAt(bob, index, false); + childAlphaTopLeft = childAlpha; + childAlphaTopRight = childAlpha; + childAlphaBottomLeft = childAlpha; + childAlphaBottomRight = childAlpha; + } - this.dirty = true; + var childScrollFactorX = child.scrollFactorX; + var childScrollFactorY = child.scrollFactorY; - return bob; - }, + if (!containerHasBlendMode && child.blendMode !== renderer.currentBlendMode) + { + // If Container doesn't have its own blend mode, then a child can have one + renderer.setBlendMode(child.blendMode); + } - /** - * Creates multiple Bob objects within this Blitter and then passes each of them to the specified callback. - * - * @method Phaser.GameObjects.Blitter#createFromCallback - * @since 3.0.0 - * - * @param {CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. - * @param {number} quantity - The quantity of Bob objects to create. - * @param {(string|number|Phaser.Textures.Frame|string[]|number[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. - * @param {boolean} [visible=true] - Should the created Bob render or not? - * - * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. - */ - createFromCallback: function (callback, quantity, frame, visible) - { - var bobs = this.createMultiple(quantity, frame, visible); + var mask = child.mask; - for (var i = 0; i < bobs.length; i++) + if (mask) { - var bob = bobs[i]; - - callback.call(this, bob, i); + mask.preRenderWebGL(renderer, child, camera); } - return bobs; - }, - - /** - * Creates multiple Bobs in one call. - * - * The amount created is controlled by a combination of the `quantity` argument and the number of frames provided. - * - * If the quantity is set to 10 and you provide 2 frames, then 20 Bobs will be created. 10 with the first - * frame and 10 with the second. - * - * @method Phaser.GameObjects.Blitter#createMultiple - * @since 3.0.0 - * - * @param {number} quantity - The quantity of Bob objects to create. - * @param {(string|number|Phaser.Textures.Frame|string[]|number[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. - * @param {boolean} [visible=true] - Should the created Bob render or not? - * - * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created. - */ - createMultiple: function (quantity, frame, visible) - { - if (frame === undefined) { frame = this.frame.name; } - if (visible === undefined) { visible = true; } + var type = child.type; - if (!Array.isArray(frame)) + if (type !== renderer.currentType) { - frame = [ frame ]; + renderer.newType = true; + renderer.currentType = type; } - var bobs = []; - var _this = this; + renderer.nextTypeMatch = (i < childCount - 1) ? (children[i + 1].type === renderer.currentType) : false; - frame.forEach(function (singleFrame) - { - for (var i = 0; i < quantity; i++) - { - bobs.push(_this.create(0, 0, singleFrame, visible)); - } - }); + // Set parent values + child.setScrollFactor(childScrollFactorX * scrollFactorX, childScrollFactorY * scrollFactorY); - return bobs; - }, + child.setAlpha(childAlphaTopLeft * alpha, childAlphaTopRight * alpha, childAlphaBottomLeft * alpha, childAlphaBottomRight * alpha); - /** - * Checks if the given child can render or not, by checking its `visible` and `alpha` values. - * - * @method Phaser.GameObjects.Blitter#childCanRender - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Bob} child - The Bob to check for rendering. - * - * @return {boolean} Returns `true` if the given child can render, otherwise `false`. - */ - childCanRender: function (child) - { - return (child.visible && child.alpha > 0); - }, + // Render + child.renderWebGL(renderer, child, camera, transformMatrix, container); - /** - * Returns an array of Bobs to be rendered. - * If the Blitter is dirty then a new list is generated and stored in `renderList`. - * - * @method Phaser.GameObjects.Blitter#getRenderList - * @since 3.0.0 - * - * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that will be rendered this frame. - */ - getRenderList: function () - { - if (this.dirty) + // Restore original values + + child.setAlpha(childAlphaTopLeft, childAlphaTopRight, childAlphaBottomLeft, childAlphaBottomRight); + + child.setScrollFactor(childScrollFactorX, childScrollFactorY); + + if (mask) { - this.renderList = this.children.list.filter(this.childCanRender, this); - this.dirty = false; + mask.postRenderWebGL(renderer, camera); } - return this.renderList; - }, + renderer.newType = false; + } - /** - * Removes all Bobs from the children List and clears the dirty flag. - * - * @method Phaser.GameObjects.Blitter#clear - * @since 3.0.0 - */ - clear: function () - { - this.children.removeAll(); - this.dirty = true; - }, + renderer.pipelines.postBatch(container); +}; - /** - * Internal destroy handler, called as part of the destroy process. - * - * @method Phaser.GameObjects.Blitter#preDestroy - * @protected - * @since 3.9.0 - */ - preDestroy: function () - { - this.children.destroy(); +module.exports = ContainerWebGLRenderer; - this.renderList = []; - } -}); +/***/ }), -module.exports = Blitter; +/***/ 2452: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Phaser Blend Modes to CSS Blend Modes Map. + * + * @name Phaser.CSSBlendModes + * @ignore + * @enum {string} + * @memberof Phaser + * @readonly + * @since 3.12.0 + */ + +module.exports = [ + 'normal', + 'multiply', + 'multiply', + 'screen', + 'overlay', + 'darken', + 'lighten', + 'color-dodge', + 'color-burn', + 'hard-light', + 'soft-light', + 'difference', + 'exclusion', + 'hue', + 'saturation', + 'color', + 'luminosity' +]; /***/ }), -/* 214 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 38943: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayUtils = __webpack_require__(208); -var BlendModes = __webpack_require__(35); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var Events = __webpack_require__(75); -var GameObject = __webpack_require__(15); -var Rectangle = __webpack_require__(10); -var Render = __webpack_require__(1052); -var Union = __webpack_require__(441); -var Vector2 = __webpack_require__(3); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var DOMElementRender = __webpack_require__(11603); +var GameObject = __webpack_require__(89980); +var IsPlainObject = __webpack_require__(42911); +var RemoveFromDOM = __webpack_require__(55638); +var SCENE_EVENTS = __webpack_require__(7599); +var Vector4 = __webpack_require__(51729); /** * @classdesc - * A Container Game Object. + * DOM Element Game Objects are a way to control and manipulate HTML Elements over the top of your game. * - * A Container, as the name implies, can 'contain' other types of Game Object. - * When a Game Object is added to a Container, the Container becomes responsible for the rendering of it. - * By default it will be removed from the Display List and instead added to the Containers own internal list. + * In order for DOM Elements to display you have to enable them by adding the following to your game + * configuration object: * - * The position of the Game Object automatically becomes relative to the position of the Container. + * ```javascript + * dom { + * createContainer: true + * } + * ``` * - * The transform point of a Container is 0x0 (in local space) and that cannot be changed. The children you add to the - * Container should be positioned with this value in mind. I.e. you should treat 0x0 as being the center of - * the Container, and position children positively and negative around it as required. + * You must also have a parent container for Phaser. This is specified by the `parent` property in the + * game config. * - * When the Container is rendered, all of its children are rendered as well, in the order in which they exist - * within the Container. Container children can be repositioned using methods such as `MoveUp`, `MoveDown` and `SendToBack`. + * When these two things are added, Phaser will automatically create a DOM Container div that is positioned + * over the top of the game canvas. This div is sized to match the canvas, and if the canvas size changes, + * as a result of settings within the Scale Manager, the dom container is resized accordingly. * - * If you modify a transform property of the Container, such as `Container.x` or `Container.rotation` then it will - * automatically influence all children as well. + * If you have not already done so, you have to provide a `parent` in the Game Configuration, or the DOM + * Container will fail to be created. * - * Containers can include other Containers for deeply nested transforms. + * You can create a DOM Element by either passing in DOMStrings, or by passing in a reference to an existing + * Element that you wish to be placed under the control of Phaser. For example: * - * Containers can have masks set on them and can be used as a mask too. However, Container children cannot be masked. - * The masks do not 'stack up'. Only a Container on the root of the display list will use its mask. + * ```javascript + * this.add.dom(x, y, 'div', 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser'); + * ``` * - * Containers can be enabled for input. Because they do not have a texture you need to provide a shape for them - * to use as their hit area. Container children can also be enabled for input, independent of the Container. + * The above code will insert a div element into the DOM Container at the given x/y coordinate. The DOMString in + * the 4th argument sets the initial CSS style of the div and the final argument is the inner text. In this case, + * it will create a lime colored div that is 220px by 100px in size with the text Phaser in it, in an Arial font. * - * If input enabling a _child_ you should not set both the `origin` and a **negative** scale factor on the child, - * or the input area will become misaligned. + * You should nearly always, without exception, use explicitly sized HTML Elements, in order to fully control + * alignment and positioning of the elements next to regular game content. * - * Containers can be given a physics body for either Arcade Physics, Impact Physics or Matter Physics. However, - * if Container _children_ are enabled for physics you may get unexpected results, such as offset bodies, - * if the Container itself, or any of its ancestors, is positioned anywhere other than at 0 x 0. Container children - * with physics do not factor in the Container due to the excessive extra calculations needed. Please structure - * your game to work around this. + * Rather than specify the CSS and HTML directly you can use the `load.html` File Loader to load it into the + * cache and then use the `createFromCache` method instead. You can also use `createFromHTML` and various other + * methods available in this class to help construct your elements. * - * It's important to understand the impact of using Containers. They add additional processing overhead into - * every one of their children. The deeper you nest them, the more the cost escalates. This is especially true - * for input events. You also loose the ability to set the display depth of Container children in the same - * flexible manner as those not within them. In short, don't use them for the sake of it. You pay a small cost - * every time you create one, try to structure your game around avoiding that where possible. + * Once the element has been created you can then control it like you would any other Game Object. You can set its + * position, scale, rotation, alpha and other properties. It will move as the main Scene Camera moves and be clipped + * at the edge of the canvas. It's important to remember some limitations of DOM Elements: The obvious one is that + * they appear above or below your game canvas. You cannot blend them into the display list, meaning you cannot have + * a DOM Element, then a Sprite, then another DOM Element behind it. * - * @class Container + * They also cannot be enabled for input. To do that, you have to use the `addListener` method to add native event + * listeners directly. The final limitation is to do with cameras. The DOM Container is sized to match the game canvas + * entirely and clipped accordingly. DOM Elements respect camera scrolling and scrollFactor settings, but if you + * change the size of the camera so it no longer matches the size of the canvas, they won't be clipped accordingly. + * + * Also, all DOM Elements are inserted into the same DOM Container, regardless of which Scene they are created in. + * + * Note that you should only have DOM Elements in a Scene with a _single_ Camera. If you require multiple cameras, + * use parallel scenes to achieve this. + * + * DOM Elements are a powerful way to align native HTML with your Phaser Game Objects. For example, you can insert + * a login form for a multiplayer game directly into your title screen. Or a text input box for a highscore table. + * Or a banner ad from a 3rd party service. Or perhaps you'd like to use them for high resolution text display and + * UI. The choice is up to you, just remember that you're dealing with standard HTML and CSS floating over the top + * of your game, and should treat it accordingly. + * + * @class DOMElement * @extends Phaser.GameObjects.GameObject * @memberof Phaser.GameObjects * @constructor - * @since 3.4.0 + * @since 3.17.0 * * @extends Phaser.GameObjects.Components.AlphaSingle * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.ComputedSize * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.ScrollFactor * @extends Phaser.GameObjects.Components.Transform * @extends Phaser.GameObjects.Components.Visible * * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Container. + * @param {number} [x=0] - The horizontal position of this DOM Element in the world. + * @param {number} [y=0] - The vertical position of this DOM Element in the world. + * @param {(Element|string)} [element] - An existing DOM element, or a string. If a string starting with a # it will do a `getElementById` look-up on the string (minus the hash). Without a hash, it represents the type of element to create, i.e. 'div'. + * @param {(string|any)} [style] - If a string, will be set directly as the elements `style` property value. If a plain object, will be iterated and the values transferred. In both cases the values replacing whatever CSS styles may have been previously set. + * @param {string} [innerText] - If given, will be set directly as the elements `innerText` property value, replacing whatever was there before. */ -var Container = new Class({ +var DOMElement = new Class({ Extends: GameObject, Mixins: [ Components.AlphaSingle, Components.BlendMode, - Components.ComputedSize, Components.Depth, - Components.Mask, - Components.Pipeline, + Components.Origin, + Components.ScrollFactor, Components.Transform, Components.Visible, - Render + DOMElementRender ], initialize: - function Container (scene, x, y, children) + function DOMElement (scene, x, y, element, style, innerText) { - GameObject.call(this, scene, 'Container'); + GameObject.call(this, scene, 'DOMElement'); /** - * An array holding the children of this Container. + * A reference to the parent DOM Container that the Game instance created when it started. * - * @name Phaser.GameObjects.Container#list - * @type {Phaser.GameObjects.GameObject[]} - * @since 3.4.0 + * @name Phaser.GameObjects.DOMElement#parent + * @type {Element} + * @since 3.17.0 */ - this.list = []; + this.parent = scene.sys.game.domContainer; /** - * Does this Container exclusively manage its children? - * - * The default is `true` which means a child added to this Container cannot - * belong in another Container, which includes the Scene display list. - * - * If you disable this then this Container will no longer exclusively manage its children. - * This allows you to create all kinds of interesting graphical effects, such as replicating - * Game Objects without reparenting them all over the Scene. - * However, doing so will prevent children from receiving any kind of input event or have - * their physics bodies work by default, as they're no longer a single entity on the - * display list, but are being replicated where-ever this Container is. + * A reference to the HTML Cache. * - * @name Phaser.GameObjects.Container#exclusive - * @type {boolean} - * @default true - * @since 3.4.0 + * @name Phaser.GameObjects.DOMElement#cache + * @type {Phaser.Cache.BaseCache} + * @since 3.17.0 */ - this.exclusive = true; + this.cache = scene.sys.cache.html; /** - * Containers can have an optional maximum size. If set to anything above 0 it - * will constrict the addition of new Game Objects into the Container, capping off - * the maximum limit the Container can grow in size to. + * The actual DOM Element that this Game Object is bound to. For example, if you've created a `
` + * then this property is a direct reference to that element within the dom. * - * @name Phaser.GameObjects.Container#maxSize - * @type {number} - * @default -1 - * @since 3.4.0 + * @name Phaser.GameObjects.DOMElement#node + * @type {Element} + * @since 3.17.0 */ - this.maxSize = -1; + this.node; /** - * The cursor position. + * By default a DOM Element will have its transform, display, opacity, zIndex and blend mode properties + * updated when its rendered. If, for some reason, you don't want any of these changed other than the + * CSS transform, then set this flag to `true`. When `true` only the CSS Transform is applied and it's + * up to you to keep track of and set the other properties as required. * - * @name Phaser.GameObjects.Container#position - * @type {number} - * @since 3.4.0 + * This can be handy if, for example, you've a nested DOM Element and you don't want the opacity to be + * picked-up by any of its children. + * + * @name Phaser.GameObjects.DOMElement#transformOnly + * @type {boolean} + * @since 3.17.0 */ - this.position = 0; + this.transformOnly = false; /** - * Internal Transform Matrix used for local space conversion. + * The angle, in radians, by which to skew the DOM Element on the horizontal axis. * - * @name Phaser.GameObjects.Container#localTransform - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.4.0 + * https://developer.mozilla.org/en-US/docs/Web/CSS/transform + * + * @name Phaser.GameObjects.DOMElement#skewX + * @type {number} + * @since 3.17.0 */ - this.localTransform = new Components.TransformMatrix(); + this.skewX = 0; /** - * Internal temporary Transform Matrix used to avoid object creation. + * The angle, in radians, by which to skew the DOM Element on the vertical axis. * - * @name Phaser.GameObjects.Container#tempTransformMatrix - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @private - * @since 3.4.0 + * https://developer.mozilla.org/en-US/docs/Web/CSS/transform + * + * @name Phaser.GameObjects.DOMElement#skewY + * @type {number} + * @since 3.17.0 */ - this.tempTransformMatrix = new Components.TransformMatrix(); + this.skewY = 0; /** - * The property key to sort by. + * A Vector4 that contains the 3D rotation of this DOM Element around a fixed axis in 3D space. * - * @name Phaser.GameObjects.Container#_sortKey - * @type {string} - * @private - * @since 3.4.0 + * All values in the Vector4 are treated as degrees, unless the `rotate3dAngle` property is changed. + * + * For more details see the following MDN page: + * + * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate3d + * + * @name Phaser.GameObjects.DOMElement#rotate3d + * @type {Phaser.Math.Vector4} + * @since 3.17.0 */ - this._sortKey = ''; + this.rotate3d = new Vector4(); /** - * A reference to the Scene Systems Event Emitter. + * The unit that represents the 3D rotation values. By default this is `deg` for degrees, but can + * be changed to any supported unit. See this page for further details: * - * @name Phaser.GameObjects.Container#_sysEvents - * @type {Phaser.Events.EventEmitter} - * @private - * @since 3.9.0 + * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate3d + * + * @name Phaser.GameObjects.DOMElement#rotate3dAngle + * @type {string} + * @since 3.17.0 */ - this._sysEvents = scene.sys.events; + this.rotate3dAngle = 'deg'; /** - * The horizontal scroll factor of this Container. - * - * The scroll factor controls the influence of the movement of a Camera upon this Container. + * Sets the CSS `pointerEvents` attribute on the DOM Element during rendering. * - * When a camera scrolls it will change the location at which this Container is rendered on-screen. - * It does not change the Containers actual position values. + * This is 'auto' by default. Changing it may have unintended side-effects with + * internal Phaser input handling, such as dragging, so only change this if you + * understand the implications. * - * For a Container, setting this value will only update the Container itself, not its children. - * If you wish to change the scrollFactor of the children as well, use the `setScrollFactor` method. + * @name Phaser.GameObjects.DOMElement#pointerEvents + * @type {string} + * @since 3.55.0 + */ + this.pointerEvents = 'auto'; + + /** + * The native (un-scaled) width of this Game Object. * - * A value of 1 means it will move exactly in sync with a camera. - * A value of 0 means it will not move at all, even if the camera moves. - * Other values control the degree to which the camera movement is mapped to this Container. + * For a DOM Element this property is read-only. * - * Please be aware that scroll factor values other than 1 are not taken in to consideration when - * calculating physics collisions. Bodies always collide based on their world position, but changing - * the scroll factor is a visual adjustment to where the textures are rendered, which can offset - * them from physics bodies if not accounted for in your code. + * The property `displayWidth` holds the computed bounds of this DOM Element, factoring in scaling. * - * @name Phaser.GameObjects.Container#scrollFactorX + * @name Phaser.GameObjects.DOMElement#width * @type {number} - * @default 1 - * @since 3.4.0 + * @readonly + * @since 3.17.0 */ - this.scrollFactorX = 1; + this.width = 0; /** - * The vertical scroll factor of this Container. + * The native (un-scaled) height of this Game Object. * - * The scroll factor controls the influence of the movement of a Camera upon this Container. + * For a DOM Element this property is read-only. * - * When a camera scrolls it will change the location at which this Container is rendered on-screen. - * It does not change the Containers actual position values. + * The property `displayHeight` holds the computed bounds of this DOM Element, factoring in scaling. * - * For a Container, setting this value will only update the Container itself, not its children. - * If you wish to change the scrollFactor of the children as well, use the `setScrollFactor` method. + * @name Phaser.GameObjects.DOMElement#height + * @type {number} + * @readonly + * @since 3.17.0 + */ + this.height = 0; + + /** + * The computed display width of this Game Object, based on the `getBoundingClientRect` DOM call. * - * A value of 1 means it will move exactly in sync with a camera. - * A value of 0 means it will not move at all, even if the camera moves. - * Other values control the degree to which the camera movement is mapped to this Container. + * The property `width` holds the un-scaled width of this DOM Element. * - * Please be aware that scroll factor values other than 1 are not taken in to consideration when - * calculating physics collisions. Bodies always collide based on their world position, but changing - * the scroll factor is a visual adjustment to where the textures are rendered, which can offset - * them from physics bodies if not accounted for in your code. + * @name Phaser.GameObjects.DOMElement#displayWidth + * @type {number} + * @readonly + * @since 3.17.0 + */ + this.displayWidth = 0; + + /** + * The computed display height of this Game Object, based on the `getBoundingClientRect` DOM call. * - * @name Phaser.GameObjects.Container#scrollFactorY + * The property `height` holds the un-scaled height of this DOM Element. + * + * @name Phaser.GameObjects.DOMElement#displayHeight * @type {number} - * @default 1 - * @since 3.4.0 + * @readonly + * @since 3.17.0 */ - this.scrollFactorY = 1; + this.displayHeight = 0; - this.initPipeline(); + /** + * Internal native event handler. + * + * @name Phaser.GameObjects.DOMElement#handler + * @type {number} + * @private + * @since 3.17.0 + */ + this.handler = this.dispatchNativeEvent.bind(this); this.setPosition(x, y); - this.clearAlpha(); - - this.setBlendMode(BlendModes.SKIP_CHECK); - - if (children) + if (typeof element === 'string') { - this.add(children); + // hash? + if (element[0] === '#') + { + this.setElement(element.substr(1), style, innerText); + } + else + { + this.createElement(element, style, innerText); + } } - }, - - /** - * Internal value to allow Containers to be used for input and physics. - * Do not change this value. It has no effect other than to break things. - * - * @name Phaser.GameObjects.Container#originX - * @type {number} - * @readonly - * @override - * @since 3.4.0 - */ - originX: { - - get: function () + else if (element) { - return 0.5; + this.setElement(element, style, innerText); } + scene.sys.events.on(SCENE_EVENTS.SLEEP, this.handleSceneEvent, this); + scene.sys.events.on(SCENE_EVENTS.WAKE, this.handleSceneEvent, this); + scene.sys.events.on(SCENE_EVENTS.PRE_RENDER, this.preRender, this); }, /** - * Internal value to allow Containers to be used for input and physics. - * Do not change this value. It has no effect other than to break things. + * Handles a Scene Sleep and Wake event. * - * @name Phaser.GameObjects.Container#originY - * @type {number} - * @readonly - * @override - * @since 3.4.0 - */ - originY: { - - get: function () - { - return 0.5; - } - - }, - - /** - * Internal value to allow Containers to be used for input and physics. - * Do not change this value. It has no effect other than to break things. + * @method Phaser.GameObjects.DOMElement#handleSceneEvent + * @private + * @since 3.22.0 * - * @name Phaser.GameObjects.Container#displayOriginX - * @type {number} - * @readonly - * @override - * @since 3.4.0 + * @param {Phaser.Scenes.Systems} sys - The Scene Systems. */ - displayOriginX: { + handleSceneEvent: function (sys) + { + var node = this.node; + var style = node.style; - get: function () + if (node) { - return this.width * 0.5; + style.display = (sys.settings.visible) ? 'block' : 'none'; } - }, /** - * Internal value to allow Containers to be used for input and physics. - * Do not change this value. It has no effect other than to break things. + * Sets the horizontal and vertical skew values of this DOM Element. * - * @name Phaser.GameObjects.Container#displayOriginY - * @type {number} - * @readonly - * @override - * @since 3.4.0 + * For more information see: https://developer.mozilla.org/en-US/docs/Web/CSS/transform + * + * @method Phaser.GameObjects.DOMElement#setSkew + * @since 3.17.0 + * + * @param {number} [x=0] - The angle, in radians, by which to skew the DOM Element on the horizontal axis. + * @param {number} [y=x] - The angle, in radians, by which to skew the DOM Element on the vertical axis. + * + * @return {this} This DOM Element instance. */ - displayOriginY: { + setSkew: function (x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = x; } - get: function () - { - return this.height * 0.5; - } + this.skewX = x; + this.skewY = y; + return this; }, /** - * Does this Container exclusively manage its children? + * Sets the perspective CSS property of the _parent DOM Container_. This determines the distance between the z=0 + * plane and the user in order to give a 3D-positioned element some perspective. Each 3D element with + * z > 0 becomes larger; each 3D-element with z < 0 becomes smaller. The strength of the effect is determined + * by the value of this property. * - * The default is `true` which means a child added to this Container cannot - * belong in another Container, which includes the Scene display list. + * For more information see: https://developer.mozilla.org/en-US/docs/Web/CSS/perspective * - * If you disable this then this Container will no longer exclusively manage its children. - * This allows you to create all kinds of interesting graphical effects, such as replicating - * Game Objects without reparenting them all over the Scene. - * However, doing so will prevent children from receiving any kind of input event or have - * their physics bodies work by default, as they're no longer a single entity on the - * display list, but are being replicated where-ever this Container is. + * **Changing this value changes it globally for all DOM Elements, as they all share the same parent container.** * - * @method Phaser.GameObjects.Container#setExclusive - * @since 3.4.0 + * @method Phaser.GameObjects.DOMElement#setPerspective + * @since 3.17.0 * - * @param {boolean} [value=true] - The exclusive state of this Container. + * @param {number} value - The perspective value, in pixels, that determines the distance between the z plane and the user. * - * @return {this} This Container. + * @return {this} This DOM Element instance. */ - setExclusive: function (value) + setPerspective: function (value) { - if (value === undefined) { value = true; } - - this.exclusive = value; + this.parent.style.perspective = value + 'px'; return this; }, /** - * Gets the bounds of this Container. It works by iterating all children of the Container, - * getting their respective bounds, and then working out a min-max rectangle from that. - * It does not factor in if the children render or not, all are included. - * - * Some children are unable to return their bounds, such as Graphics objects, in which case - * they are skipped. - * - * Depending on the quantity of children in this Container it could be a really expensive call, - * so cache it and only poll it as needed. - * - * The values are stored and returned in a Rectangle object. + * The perspective CSS property value of the _parent DOM Container_. This determines the distance between the z=0 + * plane and the user in order to give a 3D-positioned element some perspective. Each 3D element with + * z > 0 becomes larger; each 3D-element with z < 0 becomes smaller. The strength of the effect is determined + * by the value of this property. * - * @method Phaser.GameObjects.Container#getBounds - * @since 3.4.0 + * For more information see: https://developer.mozilla.org/en-US/docs/Web/CSS/perspective * - * @param {Phaser.Geom.Rectangle} [output] - A Geom.Rectangle object to store the values in. If not provided a new Rectangle will be created. + * **Changing this value changes it globally for all DOM Elements, as they all share the same parent container.** * - * @return {Phaser.Geom.Rectangle} The values stored in the output object. + * @name Phaser.GameObjects.DOMElement#perspective + * @type {number} + * @since 3.17.0 */ - getBounds: function (output) - { - if (output === undefined) { output = new Rectangle(); } - - output.setTo(this.x, this.y, 0, 0); + perspective: { - if (this.parentContainer) + get: function () { - var parentMatrix = this.parentContainer.getBoundsTransformMatrix(); - var transformedPosition = parentMatrix.transformPoint(this.x, this.y); - - output.setTo(transformedPosition.x, transformedPosition.y, 0, 0); - } + return parseFloat(this.parent.style.perspective); + }, - if (this.list.length > 0) + set: function (value) { - var children = this.list; - var tempRect = new Rectangle(); - var hasSetFirst = false; - - output.setEmpty(); - - for (var i = 0; i < children.length; i++) - { - var entry = children[i]; - - if (entry.getBounds) - { - entry.getBounds(tempRect); - - if (!hasSetFirst) - { - output.setTo(tempRect.x, tempRect.y, tempRect.width, tempRect.height); - hasSetFirst = true; - } - else - { - Union(tempRect, output, output); - } - } - } + this.parent.style.perspective = value + 'px'; } - return output; }, /** - * Internal add handler. + * Adds one or more native DOM event listeners onto the underlying Element of this Game Object. + * The event is then dispatched via this Game Objects standard event emitter. * - * @method Phaser.GameObjects.Container#addHandler - * @private - * @since 3.4.0 + * For example: * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was just added to this Container. + * ```javascript + * var div = this.add.dom(x, y, element); + * + * div.addListener('click'); + * + * div.on('click', handler); + * ``` + * + * @method Phaser.GameObjects.DOMElement#addListener + * @since 3.17.0 + * + * @param {string} events - The DOM event/s to listen for. You can specify multiple events by separating them with spaces. + * + * @return {this} This DOM Element instance. */ - addHandler: function (gameObject) + addListener: function (events) { - gameObject.once(Events.DESTROY, this.remove, this); - - if (this.exclusive) + if (this.node) { - if (gameObject.parentContainer) + events = events.split(' '); + + for (var i = 0; i < events.length; i++) { - gameObject.parentContainer.remove(gameObject); + this.node.addEventListener(events[i], this.handler, false); } - - gameObject.removeFromDisplayList(); - - gameObject.parentContainer = this; } + + return this; }, /** - * Internal remove handler. + * Removes one or more native DOM event listeners from the underlying Element of this Game Object. * - * @method Phaser.GameObjects.Container#removeHandler - * @private - * @since 3.4.0 + * @method Phaser.GameObjects.DOMElement#removeListener + * @since 3.17.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was just removed from this Container. + * @param {string} events - The DOM event/s to stop listening for. You can specify multiple events by separating them with spaces. + * + * @return {this} This DOM Element instance. */ - removeHandler: function (gameObject) + removeListener: function (events) { - gameObject.off(Events.DESTROY, this.remove); - - if (this.exclusive) + if (this.node) { - gameObject.parentContainer = null; + events = events.split(' '); - gameObject.addToDisplayList(); + for (var i = 0; i < events.length; i++) + { + this.node.removeEventListener(events[i], this.handler); + } } + + return this; }, /** - * Takes a Point-like object, such as a Vector2, Geom.Point or object with public x and y properties, - * and transforms it into the space of this Container, then returns it in the output object. - * - * @method Phaser.GameObjects.Container#pointToContainer - * @since 3.4.0 + * Internal event proxy to dispatch native DOM Events via this Game Object. * - * @param {(object|Phaser.Geom.Point|Phaser.Math.Vector2)} source - The Source Point to be transformed. - * @param {(object|Phaser.Geom.Point|Phaser.Math.Vector2)} [output] - A destination object to store the transformed point in. If none given a Vector2 will be created and returned. + * @method Phaser.GameObjects.DOMElement#dispatchNativeEvent + * @private + * @since 3.17.0 * - * @return {(object|Phaser.Geom.Point|Phaser.Math.Vector2)} The transformed point. + * @param {any} event - The native DOM event. */ - pointToContainer: function (source, output) + dispatchNativeEvent: function (event) { - if (output === undefined) { output = new Vector2(); } - - if (this.parentContainer) - { - this.parentContainer.pointToContainer(source, output); - } - else - { - output = new Vector2(source.x, source.y); - } - - var tempMatrix = this.tempTransformMatrix; - - // No need to loadIdentity because applyITRS overwrites every value anyway - tempMatrix.applyITRS(this.x, this.y, this.rotation, this.scaleX, this.scaleY); - - tempMatrix.invert(); - - tempMatrix.transformPoint(source.x, source.y, output); - - return output; + this.emit(event.type, event); }, /** - * Returns the world transform matrix as used for Bounds checks. + * Creates a native DOM Element, adds it to the parent DOM Container and then binds it to this Game Object, + * so you can control it. The `tagName` should be a string and is passed to `document.createElement`: * - * The returned matrix is temporal and shouldn't be stored. + * ```javascript + * this.add.dom().createElement('div'); + * ``` * - * @method Phaser.GameObjects.Container#getBoundsTransformMatrix - * @since 3.4.0 + * For more details on acceptable tag names see: https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement * - * @return {Phaser.GameObjects.Components.TransformMatrix} The world transform matrix. - */ - getBoundsTransformMatrix: function () - { - return this.getWorldTransformMatrix(this.tempTransformMatrix, this.localTransform); - }, - - /** - * Adds the given Game Object, or array of Game Objects, to this Container. + * You can also pass in a DOMString or style object to set the CSS on the created element, and an optional `innerText` + * value as well. Here is an example of a DOMString: * - * Each Game Object must be unique within the Container. + * ```javascript + * this.add.dom().createElement('div', 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser'); + * ``` * - * @method Phaser.GameObjects.Container#add - * @since 3.4.0 + * And using a style object: * - * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Object, or array of Game Objects, to add to the Container. + * ```javascript + * var style = { + * 'background-color': 'lime'; + * 'width': '200px'; + * 'height': '100px'; + * 'font': '48px Arial'; + * }; * - * @return {this} This Container instance. + * this.add.dom().createElement('div', style, 'Phaser'); + * ``` + * + * If this Game Object already has an Element, it is removed from the DOM entirely first. + * Any event listeners you may have previously created will need to be re-created after this call. + * + * @method Phaser.GameObjects.DOMElement#createElement + * @since 3.17.0 + * + * @param {string} tagName - A string that specifies the type of element to be created. The nodeName of the created element is initialized with the value of tagName. Don't use qualified names (like "html:a") with this method. + * @param {(string|any)} [style] - Either a DOMString that holds the CSS styles to be applied to the created element, or an object the styles will be ready from. + * @param {string} [innerText] - A DOMString that holds the text that will be set as the innerText of the created element. + * + * @return {this} This DOM Element instance. */ - add: function (child) + createElement: function (tagName, style, innerText) { - ArrayUtils.Add(this.list, child, this.maxSize, this.addHandler, this); - - return this; + return this.setElement(document.createElement(tagName), style, innerText); }, /** - * Adds the given Game Object, or array of Game Objects, to this Container at the specified position. + * Binds a new DOM Element to this Game Object. If this Game Object already has an Element it is removed from the DOM + * entirely first. Any event listeners you may have previously created will need to be re-created on the new element. * - * Existing Game Objects in the Container are shifted up. + * The `element` argument you pass to this method can be either a string tagName: * - * Each Game Object must be unique within the Container. + * ```javascript + *

Phaser

* - * @method Phaser.GameObjects.Container#addAt - * @since 3.4.0 + * this.add.dom().setElement('heading'); + * ``` * - * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Object, or array of Game Objects, to add to the Container. - * @param {number} [index=0] - The position to insert the Game Object/s at. + * Or a reference to an Element instance: * - * @return {this} This Container instance. - */ - addAt: function (child, index) - { - ArrayUtils.AddAt(this.list, child, index, this.maxSize, this.addHandler, this); - - return this; - }, - - /** - * Returns the Game Object at the given position in this Container. + * ```javascript + *

Phaser

* - * @method Phaser.GameObjects.Container#getAt - * @since 3.4.0 + * var h1 = document.getElementById('heading'); * - * @param {number} index - The position to get the Game Object from. + * this.add.dom().setElement(h1); + * ``` * - * @return {?Phaser.GameObjects.GameObject} The Game Object at the specified index, or `null` if none found. - */ - getAt: function (index) - { - return this.list[index]; - }, - - /** - * Returns the index of the given Game Object in this Container. + * You can also pass in a DOMString or style object to set the CSS on the created element, and an optional `innerText` + * value as well. Here is an example of a DOMString: * - * @method Phaser.GameObjects.Container#getIndex - * @since 3.4.0 + * ```javascript + * this.add.dom().setElement(h1, 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser'); + * ``` * - * @param {Phaser.GameObjects.GameObject} child - The Game Object to search for in this Container. + * And using a style object: * - * @return {number} The index of the Game Object in this Container, or -1 if not found. - */ - getIndex: function (child) - { - return this.list.indexOf(child); - }, - - /** - * Sort the contents of this Container so the items are in order based on the given property. - * For example: `sort('alpha')` would sort the elements based on the value of their `alpha` property. + * ```javascript + * var style = { + * 'background-color': 'lime'; + * 'width': '200px'; + * 'height': '100px'; + * 'font': '48px Arial'; + * }; * - * @method Phaser.GameObjects.Container#sort - * @since 3.4.0 + * this.add.dom().setElement(h1, style, 'Phaser'); + * ``` * - * @param {string} property - The property to lexically sort by. - * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. + * @method Phaser.GameObjects.DOMElement#setElement + * @since 3.17.0 * - * @return {this} This Container instance. + * @param {(string|Element)} element - If a string it is passed to `getElementById()`, or it should be a reference to an existing Element. + * @param {(string|any)} [style] - Either a DOMString that holds the CSS styles to be applied to the created element, or an object the styles will be ready from. + * @param {string} [innerText] - A DOMString that holds the text that will be set as the innerText of the created element. + * + * @return {this} This DOM Element instance. */ - sort: function (property, handler) + setElement: function (element, style, innerText) { - if (!property) + // Already got an element? Remove it first + this.removeElement(); + + var target; + + if (typeof element === 'string') + { + // hash? + if (element[0] === '#') + { + element = element.substr(1); + } + + target = document.getElementById(element); + } + else if (typeof element === 'object' && element.nodeType === 1) + { + target = element; + } + + if (!target) { return this; } - if (handler === undefined) + this.node = target; + + // style can be empty, a string or a plain object + if (style && IsPlainObject(style)) { - handler = function (childA, childB) + for (var key in style) { - return childA[property] - childB[property]; - }; + target.style[key] = style[key]; + } + } + else if (typeof style === 'string') + { + target.style = style; } - ArrayUtils.StableSort(this.list, handler); + // Add / Override the values we need - return this; + target.style.zIndex = '0'; + target.style.display = 'inline'; + target.style.position = 'absolute'; + + // Node handler + + target.phaser = this; + + if (this.parent) + { + this.parent.appendChild(target); + } + + // InnerText + + if (innerText) + { + target.innerText = innerText; + } + + return this.updateSize(); }, /** - * Searches for the first instance of a child with its `name` property matching the given argument. - * Should more than one child have the same name only the first is returned. - * - * @method Phaser.GameObjects.Container#getByName - * @since 3.4.0 + * Takes a block of html from the HTML Cache, that has previously been preloaded into the game, and then + * creates a DOM Element from it. The loaded HTML is set as the `innerHTML` property of the created + * element. * - * @param {string} name - The name to search for. + * Assume the following html is stored in a file called `loginform.html`: * - * @return {?Phaser.GameObjects.GameObject} The first child with a matching name, or `null` if none were found. - */ - getByName: function (name) - { - return ArrayUtils.GetFirst(this.list, 'name', name); - }, - - /** - * Returns a random Game Object from this Container. + * ```html + * + * + * ``` * - * @method Phaser.GameObjects.Container#getRandom - * @since 3.4.0 + * Which is loaded into your game using the cache key 'login': * - * @param {number} [startIndex=0] - An optional start index. - * @param {number} [length] - An optional length, the total number of elements (from the startIndex) to choose from. + * ```javascript + * this.load.html('login', 'assets/loginform.html'); + * ``` * - * @return {?Phaser.GameObjects.GameObject} A random child from the Container, or `null` if the Container is empty. - */ - getRandom: function (startIndex, length) - { - return ArrayUtils.GetRandom(this.list, startIndex, length); - }, - - /** - * Gets the first Game Object in this Container. + * You can create a DOM Element from it using the cache key: * - * You can also specify a property and value to search for, in which case it will return the first - * Game Object in this Container with a matching property and / or value. + * ```javascript + * this.add.dom().createFromCache('login'); + * ``` * - * For example: `getFirst('visible', true)` would return the first Game Object that had its `visible` property set. + * The optional `elementType` argument controls the container that is created, into which the loaded html is inserted. + * The default is a plain `div` object, but any valid tagName can be given. * - * You can limit the search to the `startIndex` - `endIndex` range. + * If this Game Object already has an Element, it is removed from the DOM entirely first. + * Any event listeners you may have previously created will need to be re-created after this call. * - * @method Phaser.GameObjects.Container#getFirst - * @since 3.4.0 + * @method Phaser.GameObjects.DOMElement#createFromCache + * @since 3.17.0 * - * @param {string} property - The property to test on each Game Object in the Container. - * @param {*} value - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {number} [startIndex=0] - An optional start index to search from. - * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {string} The key of the html cache entry to use for this DOM Element. + * @param {string} [tagName='div'] - The tag name of the element into which all of the loaded html will be inserted. Defaults to a plain div tag. * - * @return {?Phaser.GameObjects.GameObject} The first matching Game Object, or `null` if none was found. + * @return {this} This DOM Element instance. */ - getFirst: function (property, value, startIndex, endIndex) + createFromCache: function (key, tagName) { - return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); + var html = this.cache.get(key); + + if (html) + { + this.createFromHTML(html, tagName); + } + + return this; }, /** - * Returns all Game Objects in this Container. + * Takes a string of html and then creates a DOM Element from it. The HTML is set as the `innerHTML` + * property of the created element. * - * You can optionally specify a matching criteria using the `property` and `value` arguments. + * ```javascript + * let form = ` + * + * + * `; + * ``` * - * For example: `getAll('body')` would return only Game Objects that have a body property. + * You can create a DOM Element from it using the string: * - * You can also specify a value to compare the property to: + * ```javascript + * this.add.dom().createFromHTML(form); + * ``` * - * `getAll('visible', true)` would return only Game Objects that have their visible property set to `true`. + * The optional `elementType` argument controls the type of container that is created, into which the html is inserted. + * The default is a plain `div` object, but any valid tagName can be given. * - * Optionally you can specify a start and end index. For example if this Container had 100 Game Objects, - * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only - * the first 50 Game Objects. + * If this Game Object already has an Element, it is removed from the DOM entirely first. + * Any event listeners you may have previously created will need to be re-created after this call. * - * @method Phaser.GameObjects.Container#getAll - * @since 3.4.0 + * @method Phaser.GameObjects.DOMElement#createFromHTML + * @since 3.17.0 * - * @param {string} [property] - The property to test on each Game Object in the Container. - * @param {any} [value] - If property is set then the `property` must strictly equal this value to be included in the results. - * @param {number} [startIndex=0] - An optional start index to search from. - * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @param {string} html - A string of html to be set as the `innerHTML` property of the created element. + * @param {string} [tagName='div'] - The tag name of the element into which all of the html will be inserted. Defaults to a plain div tag. * - * @return {Phaser.GameObjects.GameObject[]} An array of matching Game Objects from this Container. + * @return {this} This DOM Element instance. */ - getAll: function (property, value, startIndex, endIndex) + createFromHTML: function (html, tagName) { - return ArrayUtils.GetAll(this.list, property, value, startIndex, endIndex); + if (tagName === undefined) { tagName = 'div'; } + + // Already got an element? Remove it first + this.removeElement(); + + var element = document.createElement(tagName); + + this.node = element; + + element.style.zIndex = '0'; + element.style.display = 'inline'; + element.style.position = 'absolute'; + + // Node handler + + element.phaser = this; + + if (this.parent) + { + this.parent.appendChild(element); + } + + element.innerHTML = html; + + return this.updateSize(); }, /** - * Returns the total number of Game Objects in this Container that have a property - * matching the given value. - * - * For example: `count('visible', true)` would count all the elements that have their visible property set. - * - * You can optionally limit the operation to the `startIndex` - `endIndex` range. - * - * @method Phaser.GameObjects.Container#count - * @since 3.4.0 + * Removes the current DOM Element bound to this Game Object from the DOM entirely and resets the + * `node` property of this Game Object to be `null`. * - * @param {string} property - The property to check. - * @param {any} value - The value to check. - * @param {number} [startIndex=0] - An optional start index to search from. - * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) + * @method Phaser.GameObjects.DOMElement#removeElement + * @since 3.17.0 * - * @return {number} The total number of Game Objects in this Container with a property matching the given value. + * @return {this} This DOM Element instance. */ - count: function (property, value, startIndex, endIndex) + removeElement: function () { - return ArrayUtils.CountAllMatching(this.list, property, value, startIndex, endIndex); + if (this.node) + { + RemoveFromDOM(this.node); + + this.node = null; + } + + return this; }, /** - * Swaps the position of two Game Objects in this Container. - * Both Game Objects must belong to this Container. + * Internal method that calls `getBoundingClientRect` on the `node` and then sets the bounds width + * and height into the `displayWidth` and `displayHeight` properties, and the `clientWidth` and `clientHeight` + * values into the `width` and `height` properties respectively. * - * @method Phaser.GameObjects.Container#swap - * @since 3.4.0 + * This is called automatically whenever a new element is created or set. * - * @param {Phaser.GameObjects.GameObject} child1 - The first Game Object to swap. - * @param {Phaser.GameObjects.GameObject} child2 - The second Game Object to swap. + * @method Phaser.GameObjects.DOMElement#updateSize + * @since 3.17.0 * - * @return {this} This Container instance. + * @return {this} This DOM Element instance. */ - swap: function (child1, child2) + updateSize: function () { - ArrayUtils.Swap(this.list, child1, child2); + var node = this.node; + + var nodeBounds = node.getBoundingClientRect(); + + this.width = node.clientWidth; + this.height = node.clientHeight; + + this.displayWidth = nodeBounds.width || 0; + this.displayHeight = nodeBounds.height || 0; return this; }, /** - * Moves a Game Object to a new position within this Container. - * - * The Game Object must already be a child of this Container. - * - * The Game Object is removed from its old position and inserted into the new one. - * Therefore the Container size does not change. Other children will change position accordingly. + * Gets all children from this DOM Elements node, using `querySelectorAll('*')` and then iterates through + * them, looking for the first one that has a property matching the given key and value. It then returns this child + * if found, or `null` if not. * - * @method Phaser.GameObjects.Container#moveTo - * @since 3.4.0 + * @method Phaser.GameObjects.DOMElement#getChildByProperty + * @since 3.17.0 * - * @param {Phaser.GameObjects.GameObject} child - The Game Object to move. - * @param {number} index - The new position of the Game Object in this Container. + * @param {string} property - The property to search the children for. + * @param {string} value - The value the property must strictly equal. * - * @return {this} This Container instance. + * @return {?Element} The first matching child DOM Element, or `null` if not found. */ - moveTo: function (child, index) + getChildByProperty: function (property, value) { - ArrayUtils.MoveTo(this.list, child, index); + if (this.node) + { + var children = this.node.querySelectorAll('*'); - return this; + for (var i = 0; i < children.length; i++) + { + if (children[i][property] === value) + { + return children[i]; + } + } + } + + return null; }, /** - * Moves a Game Object above another one within this Container. + * Gets all children from this DOM Elements node, using `querySelectorAll('*')` and then iterates through + * them, looking for the first one that has a matching id. It then returns this child if found, or `null` if not. * - * These 2 Game Objects must already be children of this Container. + * Be aware that class and id names are case-sensitive. * - * @method Phaser.GameObjects.Container#moveAbove - * @since 3.55.0 + * @method Phaser.GameObjects.DOMElement#getChildByID + * @since 3.17.0 * - * @param {Phaser.GameObjects.GameObject} child1 - The Game Object to move above base Game Object. - * @param {Phaser.GameObjects.GameObject} child2 - The base Game Object. + * @param {string} id - The id to search the children for. * - * @return {this} This Container instance. + * @return {?Element} The first matching child DOM Element, or `null` if not found. */ - moveAbove: function (child1, child2) + getChildByID: function (id) { - ArrayUtils.MoveAbove(this.list, child1, child2); - - return this; + return this.getChildByProperty('id', id); }, /** - * Moves a Game Object below another one within this Container. + * Gets all children from this DOM Elements node, using `querySelectorAll('*')` and then iterates through + * them, looking for the first one that has a matching name. It then returns this child if found, or `null` if not. * - * These 2 Game Objects must already be children of this Container. + * Be aware that class and id names are case-sensitive. * - * @method Phaser.GameObjects.Container#moveBelow - * @since 3.55.0 + * @method Phaser.GameObjects.DOMElement#getChildByName + * @since 3.17.0 * - * @param {Phaser.GameObjects.GameObject} child1 - The Game Object to move below base Game Object. - * @param {Phaser.GameObjects.GameObject} child2 - The base Game Object. + * @param {string} name - The name to search the children for. * - * @return {this} This Container instance. + * @return {?Element} The first matching child DOM Element, or `null` if not found. */ - moveBelow: function (child1, child2) + getChildByName: function (name) { - ArrayUtils.MoveBelow(this.list, child1, child2); - - return this; + return this.getChildByProperty('name', name); }, /** - * Removes the given Game Object, or array of Game Objects, from this Container. - * - * The Game Objects must already be children of this Container. - * - * You can also optionally call `destroy` on each Game Object that is removed from the Container. + * Sets the `className` property of the DOM Element node and updates the internal sizes. * - * @method Phaser.GameObjects.Container#remove - * @since 3.4.0 + * @method Phaser.GameObjects.DOMElement#setClassName + * @since 3.17.0 * - * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Object, or array of Game Objects, to be removed from the Container. - * @param {boolean} [destroyChild=false] - Optionally call `destroy` on each child successfully removed from this Container. + * @param {string} className - A string representing the class or space-separated classes of the element. * - * @return {this} This Container instance. + * @return {this} This DOM Element instance. */ - remove: function (child, destroyChild) + setClassName: function (className) { - var removed = ArrayUtils.Remove(this.list, child, this.removeHandler, this); - - if (destroyChild && removed) + if (this.node) { - if (!Array.isArray(removed)) - { - removed = [ removed ]; - } + this.node.className = className; - for (var i = 0; i < removed.length; i++) - { - removed[i].destroy(); - } + this.updateSize(); } return this; }, /** - * Removes the Game Object at the given position in this Container. + * Sets the `innerText` property of the DOM Element node and updates the internal sizes. * - * You can also optionally call `destroy` on the Game Object, if one is found. + * Note that only certain types of Elements can have `innerText` set on them. * - * @method Phaser.GameObjects.Container#removeAt - * @since 3.4.0 + * @method Phaser.GameObjects.DOMElement#setText + * @since 3.17.0 * - * @param {number} index - The index of the Game Object to be removed. - * @param {boolean} [destroyChild=false] - Optionally call `destroy` on the Game Object if successfully removed from this Container. + * @param {string} text - A DOMString representing the rendered text content of the element. * - * @return {this} This Container instance. + * @return {this} This DOM Element instance. */ - removeAt: function (index, destroyChild) + setText: function (text) { - var removed = ArrayUtils.RemoveAt(this.list, index, this.removeHandler, this); - - if (destroyChild && removed) + if (this.node) { - removed.destroy(); + this.node.innerText = text; + + this.updateSize(); } return this; }, /** - * Removes the Game Objects between the given positions in this Container. - * - * You can also optionally call `destroy` on each Game Object that is removed from the Container. + * Sets the `innerHTML` property of the DOM Element node and updates the internal sizes. * - * @method Phaser.GameObjects.Container#removeBetween - * @since 3.4.0 + * @method Phaser.GameObjects.DOMElement#setHTML + * @since 3.17.0 * - * @param {number} [startIndex=0] - An optional start index to search from. - * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) - * @param {boolean} [destroyChild=false] - Optionally call `destroy` on each Game Object successfully removed from this Container. + * @param {string} html - A DOMString of html to be set as the `innerHTML` property of the element. * - * @return {this} This Container instance. + * @return {this} This DOM Element instance. */ - removeBetween: function (startIndex, endIndex, destroyChild) + setHTML: function (html) { - var removed = ArrayUtils.RemoveBetween(this.list, startIndex, endIndex, this.removeHandler, this); - - if (destroyChild) + if (this.node) { - for (var i = 0; i < removed.length; i++) - { - removed[i].destroy(); - } + this.node.innerHTML = html; + + this.updateSize(); } return this; }, /** - * Removes all Game Objects from this Container. - * - * You can also optionally call `destroy` on each Game Object that is removed from the Container. - * - * @method Phaser.GameObjects.Container#removeAll - * @since 3.4.0 - * - * @param {boolean} [destroyChild=false] - Optionally call `destroy` on each Game Object successfully removed from this Container. + * Runs internal update tasks. * - * @return {this} This Container instance. + * @method Phaser.GameObjects.DOMElement#preRender + * @private + * @since 3.60.0 */ - removeAll: function (destroyChild) + preRender: function () { - var removed = ArrayUtils.RemoveBetween(this.list, 0, this.list.length, this.removeHandler, this); - - if (destroyChild) + var parent = this.parentContainer; + var node = this.node; + + if (node && parent && !parent.willRender()) { - for (var i = 0; i < removed.length; i++) - { - removed[i].destroy(); - } + node.style.display = 'none'; } - - return this; }, /** - * Brings the given Game Object to the top of this Container. - * This will cause it to render on-top of any other objects in the Container. + * Compares the renderMask with the renderFlags to see if this Game Object will render or not. * - * @method Phaser.GameObjects.Container#bringToTop - * @since 3.4.0 + * DOMElements always return `true` as they need to still set values during the render pass, even if not visible. * - * @param {Phaser.GameObjects.GameObject} child - The Game Object to bring to the top of the Container. + * @method Phaser.GameObjects.DOMElement#willRender + * @since 3.17.0 * - * @return {this} This Container instance. + * @return {boolean} `true` if the Game Object should be rendered, otherwise `false`. */ - bringToTop: function (child) + willRender: function () { - ArrayUtils.BringToTop(this.list, child); - - return this; + return true; }, /** - * Sends the given Game Object to the bottom of this Container. - * This will cause it to render below any other objects in the Container. - * - * @method Phaser.GameObjects.Container#sendToBack - * @since 3.4.0 - * - * @param {Phaser.GameObjects.GameObject} child - The Game Object to send to the bottom of the Container. + * Handles the pre-destroy step for the DOM Element, which removes the underlying node from the DOM. * - * @return {this} This Container instance. + * @method Phaser.GameObjects.DOMElement#preDestroy + * @private + * @since 3.17.0 */ - sendToBack: function (child) + preDestroy: function () { - ArrayUtils.SendToBack(this.list, child); + this.removeElement(); - return this; - }, + this.scene.sys.events.off(SCENE_EVENTS.SLEEP, this.handleSceneEvent, this); + this.scene.sys.events.off(SCENE_EVENTS.WAKE, this.handleSceneEvent, this); + this.scene.sys.events.off(SCENE_EVENTS.PRE_RENDER, this.preRender, this); + } - /** - * Moves the given Game Object up one place in this Container, unless it's already at the top. - * - * @method Phaser.GameObjects.Container#moveUp - * @since 3.4.0 - * - * @param {Phaser.GameObjects.GameObject} child - The Game Object to be moved in the Container. - * - * @return {this} This Container instance. - */ - moveUp: function (child) - { - ArrayUtils.MoveUp(this.list, child); +}); - return this; - }, +module.exports = DOMElement; - /** - * Moves the given Game Object down one place in this Container, unless it's already at the bottom. - * - * @method Phaser.GameObjects.Container#moveDown - * @since 3.4.0 - * - * @param {Phaser.GameObjects.GameObject} child - The Game Object to be moved in the Container. - * - * @return {this} This Container instance. - */ - moveDown: function (child) - { - ArrayUtils.MoveDown(this.list, child); - return this; - }, +/***/ }), - /** - * Reverses the order of all Game Objects in this Container. - * - * @method Phaser.GameObjects.Container#reverse - * @since 3.4.0 - * - * @return {this} This Container instance. - */ - reverse: function () - { - this.list.reverse(); +/***/ 66070: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Shuffles the all Game Objects in this Container using the Fisher-Yates implementation. - * - * @method Phaser.GameObjects.Container#shuffle - * @since 3.4.0 - * - * @return {this} This Container instance. - */ - shuffle: function () - { - ArrayUtils.Shuffle(this.list); +var CSSBlendModes = __webpack_require__(2452); +var GameObject = __webpack_require__(89980); +var TransformMatrix = __webpack_require__(69360); - return this; - }, +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); - /** - * Replaces a Game Object in this Container with the new Game Object. - * The new Game Object cannot already be a child of this Container. - * - * @method Phaser.GameObjects.Container#replace - * @since 3.4.0 - * - * @param {Phaser.GameObjects.GameObject} oldChild - The Game Object in this Container that will be replaced. - * @param {Phaser.GameObjects.GameObject} newChild - The Game Object to be added to this Container. - * @param {boolean} [destroyChild=false] - Optionally call `destroy` on the Game Object if successfully removed from this Container. - * - * @return {this} This Container instance. - */ - replace: function (oldChild, newChild, destroyChild) +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.DOMElement#renderWebGL + * @since 3.17.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active renderer. + * @param {Phaser.GameObjects.DOMElement} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var DOMElementCSSRenderer = function (renderer, src, camera, parentMatrix) +{ + if (!src.node) { - var moved = ArrayUtils.Replace(this.list, oldChild, newChild); - - if (moved) - { - this.addHandler(newChild); - this.removeHandler(oldChild); - - if (destroyChild) - { - oldChild.destroy(); - } - } - - return this; - }, + return; + } - /** - * Returns `true` if the given Game Object is a direct child of this Container. - * - * This check does not scan nested Containers. - * - * @method Phaser.GameObjects.Container#exists - * @since 3.4.0 - * - * @param {Phaser.GameObjects.GameObject} child - The Game Object to check for within this Container. - * - * @return {boolean} True if the Game Object is an immediate child of this Container, otherwise false. - */ - exists: function (child) - { - return (this.list.indexOf(child) > -1); - }, + var style = src.node.style; + var settings = src.scene.sys.settings; - /** - * Sets the property to the given value on all Game Objects in this Container. - * - * Optionally you can specify a start and end index. For example if this Container had 100 Game Objects, - * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only - * the first 50 Game Objects. - * - * @method Phaser.GameObjects.Container#setAll - * @since 3.4.0 - * - * @param {string} property - The property that must exist on the Game Object. - * @param {any} value - The value to get the property to. - * @param {number} [startIndex=0] - An optional start index to search from. - * @param {number} [endIndex=Container.length] - An optional end index to search up to (but not included) - * - * @return {this} This Container instance. - */ - setAll: function (property, value, startIndex, endIndex) + if (!style || !settings.visible || GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter !== 0 && (src.cameraFilter & camera.id)) || (src.parentContainer && !src.parentContainer.willRender())) { - ArrayUtils.SetAll(this.list, property, value, startIndex, endIndex); + style.display = 'none'; - return this; - }, + return; + } - /** - * @callback EachContainerCallback - * @generic I - [item] - * - * @param {*} item - The child Game Object of the Container. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. - */ + var parent = src.parentContainer; + var alpha = camera.alpha * src.alpha; - /** - * Passes all Game Objects in this Container to the given callback. - * - * A copy of the Container is made before passing each entry to your callback. - * This protects against the callback itself modifying the Container. - * - * If you know for sure that the callback will not change the size of this Container - * then you can use the more performant `Container.iterate` method instead. - * - * @method Phaser.GameObjects.Container#each - * @since 3.4.0 - * - * @param {function} callback - The function to call. - * @param {object} [context] - Value to use as `this` when executing callback. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. - * - * @return {this} This Container instance. - */ - each: function (callback, context) + if (parent) { - var args = [ null ]; - var i; - var temp = this.list.slice(); - var len = temp.length; - - for (i = 2; i < arguments.length; i++) - { - args.push(arguments[i]); - } + alpha *= parent.alpha; + } - for (i = 0; i < len; i++) - { - args[0] = temp[i]; + var camMatrix = tempMatrix1; + var srcMatrix = tempMatrix2; + var calcMatrix = tempMatrix3; - callback.apply(context, args); - } + var dx = 0; + var dy = 0; - return this; - }, + var tx = '0%'; + var ty = '0%'; - /** - * Passes all Game Objects in this Container to the given callback. - * - * Only use this method when you absolutely know that the Container will not be modified during - * the iteration, i.e. by removing or adding to its contents. - * - * @method Phaser.GameObjects.Container#iterate - * @since 3.4.0 - * - * @param {function} callback - The function to call. - * @param {object} [context] - Value to use as `this` when executing callback. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. - * - * @return {this} This Container instance. - */ - iterate: function (callback, context) + if (parentMatrix) { - var args = [ null ]; - var i; + dx = (src.width * src.scaleX) * src.originX; + dy = (src.height * src.scaleY) * src.originY; - for (i = 2; i < arguments.length; i++) - { - args.push(arguments[i]); - } + srcMatrix.applyITRS(src.x - dx, src.y - dy, src.rotation, src.scaleX, src.scaleY); - for (i = 0; i < this.list.length; i++) - { - args[0] = this.list[i]; + camMatrix.copyFrom(camera.matrix); - callback.apply(context, args); - } + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); - return this; - }, + // Undo the camera scroll + srcMatrix.e = src.x - dx; + srcMatrix.f = src.y - dy; - /** - * Sets the scroll factor of this Container and optionally all of its children. - * - * The scroll factor controls the influence of the movement of a Camera upon this Game Object. - * - * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. - * It does not change the Game Objects actual position values. - * - * A value of 1 means it will move exactly in sync with a camera. - * A value of 0 means it will not move at all, even if the camera moves. - * Other values control the degree to which the camera movement is mapped to this Game Object. - * - * Please be aware that scroll factor values other than 1 are not taken in to consideration when - * calculating physics collisions. Bodies always collide based on their world position, but changing - * the scroll factor is a visual adjustment to where the textures are rendered, which can offset - * them from physics bodies if not accounted for in your code. - * - * @method Phaser.GameObjects.Container#setScrollFactor - * @since 3.4.0 - * - * @param {number} x - The horizontal scroll factor of this Game Object. - * @param {number} [y=x] - The vertical scroll factor of this Game Object. If not set it will use the `x` value. - * @param {boolean} [updateChildren=false] - Apply this scrollFactor to all Container children as well? - * - * @return {this} This Game Object instance. - */ - setScrollFactor: function (x, y, updateChildren) + // Multiply by the src matrix, store result in calcMatrix + camMatrix.multiply(srcMatrix, calcMatrix); + } + else { - if (y === undefined) { y = x; } - if (updateChildren === undefined) { updateChildren = false; } + dx = (src.width) * src.originX; + dy = (src.height) * src.originY; - this.scrollFactorX = x; - this.scrollFactorY = y; + srcMatrix.applyITRS(src.x - dx, src.y - dy, src.rotation, src.scaleX, src.scaleY); - if (updateChildren) - { - ArrayUtils.SetAll(this.list, 'scrollFactorX', x); - ArrayUtils.SetAll(this.list, 'scrollFactorY', y); - } + camMatrix.copyFrom(camera.matrix); - return this; - }, + tx = (100 * src.originX) + '%'; + ty = (100 * src.originY) + '%'; - /** - * The number of Game Objects inside this Container. - * - * @name Phaser.GameObjects.Container#length - * @type {number} - * @readonly - * @since 3.4.0 - */ - length: { + srcMatrix.e -= camera.scrollX * src.scrollFactorX; + srcMatrix.f -= camera.scrollY * src.scrollFactorY; - get: function () - { - return this.list.length; - } + // Multiply by the src matrix, store result in calcMatrix + camMatrix.multiply(srcMatrix, calcMatrix); + } - }, + if (!src.transformOnly) + { + style.display = 'block'; + style.opacity = alpha; + style.zIndex = src._depth; + style.pointerEvents = src.pointerEvents; + style.mixBlendMode = CSSBlendModes[src._blendMode]; + } - /** - * Returns the first Game Object within the Container, or `null` if it is empty. - * - * You can move the cursor by calling `Container.next` and `Container.previous`. - * - * @name Phaser.GameObjects.Container#first - * @type {?Phaser.GameObjects.GameObject} - * @readonly - * @since 3.4.0 - */ - first: { + // https://developer.mozilla.org/en-US/docs/Web/CSS/transform - get: function () - { - this.position = 0; + style.transform = + calcMatrix.getCSSMatrix() + + ' skew(' + src.skewX + 'rad, ' + src.skewY + 'rad)' + + ' rotate3d(' + src.rotate3d.x + ',' + src.rotate3d.y + ',' + src.rotate3d.z + ',' + src.rotate3d.w + src.rotate3dAngle + ')'; - if (this.list.length > 0) - { - return this.list[0]; - } - else - { - return null; - } - } + style.transformOrigin = tx + ' ' + ty; +}; - }, +module.exports = DOMElementCSSRenderer; - /** - * Returns the last Game Object within the Container, or `null` if it is empty. - * - * You can move the cursor by calling `Container.next` and `Container.previous`. - * - * @name Phaser.GameObjects.Container#last - * @type {?Phaser.GameObjects.GameObject} - * @readonly - * @since 3.4.0 - */ - last: { - get: function () - { - if (this.list.length > 0) - { - this.position = this.list.length - 1; +/***/ }), - return this.list[this.position]; - } - else - { - return null; - } - } +/***/ 66788: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Returns the next Game Object within the Container, or `null` if it is empty. - * - * You can move the cursor by calling `Container.next` and `Container.previous`. - * - * @name Phaser.GameObjects.Container#next - * @type {?Phaser.GameObjects.GameObject} - * @readonly - * @since 3.4.0 - */ - next: { +var DOMElement = __webpack_require__(38943); +var GameObjectFactory = __webpack_require__(61286); - get: function () - { - if (this.position < this.list.length) - { - this.position++; +/** + * DOM Element Game Objects are a way to control and manipulate HTML Elements over the top of your game. + * + * In order for DOM Elements to display you have to enable them by adding the following to your game + * configuration object: + * + * ```javascript + * dom { + * createContainer: true + * } + * ``` + * + * When this is added, Phaser will automatically create a DOM Container div that is positioned over the top + * of the game canvas. This div is sized to match the canvas, and if the canvas size changes, as a result of + * settings within the Scale Manager, the dom container is resized accordingly. + * + * You can create a DOM Element by either passing in DOMStrings, or by passing in a reference to an existing + * Element that you wish to be placed under the control of Phaser. For example: + * + * ```javascript + * this.add.dom(x, y, 'div', 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser'); + * ``` + * + * The above code will insert a div element into the DOM Container at the given x/y coordinate. The DOMString in + * the 4th argument sets the initial CSS style of the div and the final argument is the inner text. In this case, + * it will create a lime colored div that is 220px by 100px in size with the text Phaser in it, in an Arial font. + * + * You should nearly always, without exception, use explicitly sized HTML Elements, in order to fully control + * alignment and positioning of the elements next to regular game content. + * + * Rather than specify the CSS and HTML directly you can use the `load.html` File Loader to load it into the + * cache and then use the `createFromCache` method instead. You can also use `createFromHTML` and various other + * methods available in this class to help construct your elements. + * + * Once the element has been created you can then control it like you would any other Game Object. You can set its + * position, scale, rotation, alpha and other properties. It will move as the main Scene Camera moves and be clipped + * at the edge of the canvas. It's important to remember some limitations of DOM Elements: The obvious one is that + * they appear above or below your game canvas. You cannot blend them into the display list, meaning you cannot have + * a DOM Element, then a Sprite, then another DOM Element behind it. + * + * They also cannot be enabled for input. To do that, you have to use the `addListener` method to add native event + * listeners directly. The final limitation is to do with cameras. The DOM Container is sized to match the game canvas + * entirely and clipped accordingly. DOM Elements respect camera scrolling and scrollFactor settings, but if you + * change the size of the camera so it no longer matches the size of the canvas, they won't be clipped accordingly. + * + * Also, all DOM Elements are inserted into the same DOM Container, regardless of which Scene they are created in. + * + * DOM Elements are a powerful way to align native HTML with your Phaser Game Objects. For example, you can insert + * a login form for a multiplayer game directly into your title screen. Or a text input box for a highscore table. + * Or a banner ad from a 3rd party service. Or perhaps you'd like to use them for high resolution text display and + * UI. The choice is up to you, just remember that you're dealing with standard HTML and CSS floating over the top + * of your game, and should treat it accordingly. + * + * Note: This method will only be available if the DOM Element Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#dom + * @since 3.17.0 + * + * @param {number} x - The horizontal position of this DOM Element in the world. + * @param {number} y - The vertical position of this DOM Element in the world. + * @param {(HTMLElement|string)} [element] - An existing DOM element, or a string. If a string starting with a # it will do a `getElementById` look-up on the string (minus the hash). Without a hash, it represents the type of element to create, i.e. 'div'. + * @param {(string|any)} [style] - If a string, will be set directly as the elements `style` property value. If a plain object, will be iterated and the values transferred. In both cases the values replacing whatever CSS styles may have been previously set. + * @param {string} [innerText] - If given, will be set directly as the elements `innerText` property value, replacing whatever was there before. + * + * @return {Phaser.GameObjects.DOMElement} The Game Object that was created. + */ +GameObjectFactory.register('dom', function (x, y, element, style, innerText) +{ + var gameObject = new DOMElement(this.scene, x, y, element, style, innerText); - return this.list[this.position]; - } - else - { - return null; - } - } + this.displayList.add(gameObject); - }, + return gameObject; +}); - /** - * Returns the previous Game Object within the Container, or `null` if it is empty. - * - * You can move the cursor by calling `Container.next` and `Container.previous`. - * - * @name Phaser.GameObjects.Container#previous - * @type {?Phaser.GameObjects.GameObject} - * @readonly - * @since 3.4.0 - */ - previous: { - get: function () - { - if (this.position > 0) - { - this.position--; +/***/ }), - return this.list[this.position]; - } - else - { - return null; - } - } +/***/ 11603: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Internal destroy handler, called as part of the destroy process. - * - * @method Phaser.GameObjects.Container#preDestroy - * @protected - * @since 3.9.0 - */ - preDestroy: function () - { - this.removeAll(!!this.exclusive); +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - this.localTransform.destroy(); - this.tempTransformMatrix.destroy(); +if (true) +{ + renderWebGL = __webpack_require__(66070); +} - this.list = []; - } +if (true) +{ + renderCanvas = __webpack_require__(66070); +} -}); +module.exports = { -module.exports = Container; + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; /***/ }), -/* 215 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 65492: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapText = __webpack_require__(148); -var Class = __webpack_require__(0); -var Render = __webpack_require__(1057); - /** - * @classdesc - * BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure. - * - * During rendering for each letter of the text is rendered to the display, proportionally spaced out and aligned to - * match the font structure. + * The Game Object Added to Scene Event. * - * Dynamic Bitmap Text objects are different from Static Bitmap Text in that they invoke a callback for each - * letter being rendered during the render pass. This callback allows you to manipulate the properties of - * each letter being rendered, such as its position, scale or tint, allowing you to create interesting effects - * like jiggling text, which can't be done with Static text. This means that Dynamic Text takes more processing - * time, so only use them if you require the callback ability they have. + * This event is dispatched when a Game Object is added to a Scene. * - * BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability - * to use Web Fonts, however you trade this flexibility for rendering speed. You can also create visually compelling BitmapTexts by - * processing the font texture in an image editor, applying fills and any other effects required. + * Listen for it on a Game Object instance using `GameObject.on('addedtoscene', listener)`. * - * To create multi-line text insert \r, \n or \r\n escape codes into the text string. + * @event Phaser.GameObjects.Events#ADDED_TO_SCENE + * @type {string} + * @since 3.50.0 * - * To create a BitmapText data files you need a 3rd party app such as: + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was added to the Scene. + * @param {Phaser.Scene} scene - The Scene to which the Game Object was added. + */ +module.exports = 'addedtoscene'; + + +/***/ }), + +/***/ 98398: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Game Object Destroy Event. * - * BMFont (Windows, free): {@link http://www.angelcode.com/products/bmfont/|http://www.angelcode.com/products/bmfont/} - * Glyph Designer (OS X, commercial): {@link http://www.71squared.com/en/glyphdesigner|http://www.71squared.com/en/glyphdesigner} - * Littera (Web-based, free): {@link http://kvazars.com/littera/|http://kvazars.com/littera/} + * This event is dispatched when a Game Object instance is being destroyed. * - * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of - * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: {@link http://codebeautify.org/xmltojson|http://codebeautify.org/xmltojson} + * Listen for it on a Game Object instance using `GameObject.on('destroy', listener)`. * - * @class DynamicBitmapText - * @extends Phaser.GameObjects.BitmapText - * @memberof Phaser.GameObjects - * @constructor + * @event Phaser.GameObjects.Events#DESTROY + * @type {string} * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time. - * @param {number} x - The x coordinate of this Game Object in world space. - * @param {number} y - The y coordinate of this Game Object in world space. - * @param {string} font - The key of the font to use from the Bitmap Font cache. - * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text. - * @param {number} [size] - The font size of this Bitmap Text. - * @param {number} [align=0] - The alignment of the text in a multi-line BitmapText object. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object which is being destroyed. + * @param {boolean} fromScene - `True` if this Game Object is being destroyed by the Scene, `false` if not. */ -var DynamicBitmapText = new Class({ - - Extends: BitmapText, +module.exports = 'destroy'; - Mixins: [ - Render - ], - initialize: +/***/ }), - function DynamicBitmapText (scene, x, y, font, text, size, align) - { - BitmapText.call(this, scene, x, y, font, text, size, align); +/***/ 40239: +/***/ ((module) => { - this.type = 'DynamicBitmapText'; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The horizontal scroll position of the Bitmap Text. - * - * @name Phaser.GameObjects.DynamicBitmapText#scrollX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.scrollX = 0; +/** + * The Game Object Removed from Scene Event. + * + * This event is dispatched when a Game Object is removed from a Scene. + * + * Listen for it on a Game Object instance using `GameObject.on('removedfromscene', listener)`. + * + * @event Phaser.GameObjects.Events#REMOVED_FROM_SCENE + * @type {string} + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was removed from the Scene. + * @param {Phaser.Scene} scene - The Scene from which the Game Object was removed. + */ +module.exports = 'removedfromscene'; - /** - * The vertical scroll position of the Bitmap Text. - * - * @name Phaser.GameObjects.DynamicBitmapText#scrollY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.scrollY = 0; - /** - * The crop width of the Bitmap Text. - * - * @name Phaser.GameObjects.DynamicBitmapText#cropWidth - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.cropWidth = 0; +/***/ }), - /** - * The crop height of the Bitmap Text. - * - * @name Phaser.GameObjects.DynamicBitmapText#cropHeight - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.cropHeight = 0; +/***/ 17286: +/***/ ((module) => { - /** - * A callback that alters how each character of the Bitmap Text is rendered. - * - * @name Phaser.GameObjects.DynamicBitmapText#displayCallback - * @type {Phaser.Types.GameObjects.BitmapText.DisplayCallback} - * @since 3.0.0 - */ - this.displayCallback; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The data object that is populated during rendering, then passed to the displayCallback. - * You should modify this object then return it back from the callback. It's updated values - * will be used to render the specific glyph. - * - * Please note that if you need a reference to this object locally in your game code then you - * should shallow copy it, as it's updated and re-used for every glyph in the text. - * - * @name Phaser.GameObjects.DynamicBitmapText#callbackData - * @type {Phaser.Types.GameObjects.BitmapText.DisplayCallbackConfig} - * @since 3.11.0 - */ - this.callbackData = { - parent: this, - color: 0, - tint: { - topLeft: 0, - topRight: 0, - bottomLeft: 0, - bottomRight: 0 - }, - index: 0, - charCode: 0, - x: 0, - y: 0, - scale: 0, - rotation: 0, - data: 0 - }; - }, +/** + * The Video Game Object Complete Event. + * + * This event is dispatched when a Video finishes playback by reaching the end of its duration. It + * is also dispatched if a video marker sequence is being played and reaches the end. + * + * Note that not all videos can fire this event. Live streams, for example, have no fixed duration, + * so never technically 'complete'. + * + * If a video is stopped from playback, via the `Video.stop` method, it will emit the + * `VIDEO_STOP` event instead of this one. + * + * Listen for it from a Video Game Object instance using `Video.on('complete', listener)`. + * + * @event Phaser.GameObjects.Events#VIDEO_COMPLETE + * @type {string} + * @since 3.20.0 + * + * @param {Phaser.GameObjects.Video} video - The Video Game Object which completed playback. + */ +module.exports = 'complete'; - /** - * Set the crop size of this Bitmap Text. - * - * @method Phaser.GameObjects.DynamicBitmapText#setSize - * @since 3.0.0 - * - * @param {number} width - The width of the crop. - * @param {number} height - The height of the crop. - * - * @return {this} This Game Object. - */ - setSize: function (width, height) - { - this.cropWidth = width; - this.cropHeight = height; - return this; - }, +/***/ }), - /** - * Set a callback that alters how each character of the Bitmap Text is rendered. - * - * The callback receives a {@link Phaser.Types.GameObjects.BitmapText.DisplayCallbackConfig} object that contains information about the character that's - * about to be rendered. - * - * It should return an object with `x`, `y`, `scale` and `rotation` properties that will be used instead of the - * usual values when rendering. - * - * @method Phaser.GameObjects.DynamicBitmapText#setDisplayCallback - * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.BitmapText.DisplayCallback} callback - The display callback to set. - * - * @return {this} This Game Object. - */ - setDisplayCallback: function (callback) - { - this.displayCallback = callback; +/***/ 31496: +/***/ ((module) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Set the horizontal scroll position of this Bitmap Text. - * - * @method Phaser.GameObjects.DynamicBitmapText#setScrollX - * @since 3.0.0 - * - * @param {number} value - The horizontal scroll position to set. - * - * @return {this} This Game Object. - */ - setScrollX: function (value) - { - this.scrollX = value; +/** + * The Video Game Object Created Event. + * + * This event is dispatched when the texture for a Video has been created. This happens + * when enough of the video source has been loaded that the browser is able to render a + * frame from it. + * + * Listen for it from a Video Game Object instance using `Video.on('created', listener)`. + * + * @event Phaser.GameObjects.Events#VIDEO_CREATED + * @type {string} + * @since 3.20.0 + * + * @param {Phaser.GameObjects.Video} video - The Video Game Object which raised the event. + * @param {number} width - The width of the video. + * @param {number} height - The height of the video. + */ +module.exports = 'created'; - return this; - }, - /** - * Set the vertical scroll position of this Bitmap Text. - * - * @method Phaser.GameObjects.DynamicBitmapText#setScrollY - * @since 3.0.0 - * - * @param {number} value - The vertical scroll position to set. - * - * @return {this} This Game Object. - */ - setScrollY: function (value) - { - this.scrollY = value; +/***/ }), - return this; - } +/***/ 89587: +/***/ ((module) => { -}); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = DynamicBitmapText; +/** + * The Video Game Object Error Event. + * + * This event is dispatched when a Video tries to play a source that does not exist, or is the wrong file type. + * + * Listen for it from a Video Game Object instance using `Video.on('error', listener)`. + * + * @event Phaser.GameObjects.Events#VIDEO_ERROR + * @type {string} + * @since 3.20.0 + * + * @param {Phaser.GameObjects.Video} video - The Video Game Object which threw the error. + * @param {DOMException|string} event - The native DOM event the browser raised during playback. + */ +module.exports = 'error'; /***/ }), -/* 216 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 59792: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseCamera = __webpack_require__(133); -var Class = __webpack_require__(0); -var Commands = __webpack_require__(217); -var ComponentsAlpha = __webpack_require__(303); -var ComponentsBlendMode = __webpack_require__(304); -var ComponentsDepth = __webpack_require__(305); -var ComponentsMask = __webpack_require__(309); -var ComponentsPipeline = __webpack_require__(167); -var ComponentsScrollFactor = __webpack_require__(312); -var ComponentsTransform = __webpack_require__(313); -var ComponentsVisible = __webpack_require__(314); -var Ellipse = __webpack_require__(111); -var GameObject = __webpack_require__(15); -var GetFastValue = __webpack_require__(2); -var GetValue = __webpack_require__(6); -var MATH_CONST = __webpack_require__(14); -var Render = __webpack_require__(1063); - /** - * @classdesc - * A Graphics object is a way to draw primitive shapes to your game. Primitives include forms of geometry, such as - * Rectangles, Circles, and Polygons. They also include lines, arcs and curves. When you initially create a Graphics - * object it will be empty. + * The Video Game Object Locked Event. * - * To draw to it you must first specify a line style or fill style (or both), draw shapes using paths, and finally - * fill or stroke them. For example: + * This event is dispatched when a Video was attempted to be played, but the browser prevented it + * from doing so due to the Media Engagement Interaction policy. * - * ```javascript - * graphics.lineStyle(5, 0xFF00FF, 1.0); - * graphics.beginPath(); - * graphics.moveTo(100, 100); - * graphics.lineTo(200, 200); - * graphics.closePath(); - * graphics.strokePath(); - * ``` + * If you get this event you will need to wait for the user to interact with the browser before + * the video will play. This is a browser security measure to prevent autoplaying videos with + * audio. An interaction includes a mouse click, a touch, or a key press. * - * There are also many helpful methods that draw and fill/stroke common shapes for you. + * Listen for it from a Video Game Object instance using `Video.on('locked', listener)`. * - * ```javascript - * graphics.lineStyle(5, 0xFF00FF, 1.0); - * graphics.fillStyle(0xFFFFFF, 1.0); - * graphics.fillRect(50, 50, 400, 200); - * graphics.strokeRect(50, 50, 400, 200); - * ``` + * @event Phaser.GameObjects.Events#VIDEO_LOCKED + * @type {string} + * @since 3.60.0 * - * When a Graphics object is rendered it will render differently based on if the game is running under Canvas or WebGL. - * Under Canvas it will use the HTML Canvas context drawing operations to draw the path. - * Under WebGL the graphics data is decomposed into polygons. Both of these are expensive processes, especially with - * complex shapes. + * @param {Phaser.GameObjects.Video} video - The Video Game Object which raised the event. + */ +module.exports = 'locked'; + + +/***/ }), + +/***/ 96342: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Video Game Object Loop Event. * - * If your Graphics object doesn't change much (or at all) once you've drawn your shape to it, then you will help - * performance by calling {@link Phaser.GameObjects.Graphics#generateTexture}. This will 'bake' the Graphics object into - * a Texture, and return it. You can then use this Texture for Sprites or other display objects. If your Graphics object - * updates frequently then you should avoid doing this, as it will constantly generate new textures, which will consume - * memory. + * This event is dispatched when a Video that is currently playing has looped. This only + * happens if the `loop` parameter was specified, or the `setLoop` method was called, + * and if the video has a fixed duration. Video streams, for example, cannot loop, as + * they have no duration. * - * As you can tell, Graphics objects are a bit of a trade-off. While they are extremely useful, you need to be careful - * in their complexity and quantity of them in your game. + * Looping is based on the result of the Video `timeupdate` event. This event is not + * frame-accurate, due to the way browsers work, so please do not rely on this loop + * event to be time or frame precise. * - * @class Graphics - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor - * @since 3.0.0 + * Listen for it from a Video Game Object instance using `Video.on('loop', listener)`. * - * @extends Phaser.GameObjects.Components.AlphaSingle - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * @extends Phaser.GameObjects.Components.ScrollFactor + * @event Phaser.GameObjects.Events#VIDEO_LOOP + * @type {string} + * @since 3.20.0 * - * @param {Phaser.Scene} scene - The Scene to which this Graphics object belongs. - * @param {Phaser.Types.GameObjects.Graphics.Options} [options] - Options that set the position and default style of this Graphics object. + * @param {Phaser.GameObjects.Video} video - The Video Game Object which has looped. */ -var Graphics = new Class({ +module.exports = 'loop'; - Extends: GameObject, - Mixins: [ - ComponentsAlpha, - ComponentsBlendMode, - ComponentsDepth, - ComponentsMask, - ComponentsPipeline, - ComponentsTransform, - ComponentsVisible, - ComponentsScrollFactor, - Render - ], +/***/ }), - initialize: +/***/ 6017: +/***/ ((module) => { - function Graphics (scene, options) - { - var x = GetValue(options, 'x', 0); - var y = GetValue(options, 'y', 0); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - GameObject.call(this, scene, 'Graphics'); +/** + * The Video Game Object Playing Event. + * + * The playing event is fired after playback is first started, + * and whenever it is restarted. For example it is fired when playback + * resumes after having been paused or delayed due to lack of data. + * + * Listen for it from a Video Game Object instance using `Video.on('playing', listener)`. + * + * @event Phaser.GameObjects.Events#VIDEO_PLAYING + * @type {string} + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Video} video - The Video Game Object which started playback. + */ +module.exports = 'playing'; - this.setPosition(x, y); - this.initPipeline(); - /** - * The horizontal display origin of the Graphics. - * - * @name Phaser.GameObjects.Graphics#displayOriginX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.displayOriginX = 0; +/***/ }), - /** - * The vertical display origin of the Graphics. - * - * @name Phaser.GameObjects.Graphics#displayOriginY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.displayOriginY = 0; +/***/ 49614: +/***/ ((module) => { - /** - * The array of commands used to render the Graphics. - * - * @name Phaser.GameObjects.Graphics#commandBuffer - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.commandBuffer = []; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The default fill color for shapes rendered by this Graphics object. - * - * @name Phaser.GameObjects.Graphics#defaultFillColor - * @type {number} - * @default -1 +/** + * The Video Game Object Play Event. + * + * This event is dispatched when a Video begins playback. For videos that do not require + * interaction unlocking, this is usually as soon as the `Video.play` method is called. + * However, for videos that require unlocking, it is fired once playback begins after + * they've been unlocked. + * + * Listen for it from a Video Game Object instance using `Video.on('play', listener)`. + * + * @event Phaser.GameObjects.Events#VIDEO_PLAY + * @type {string} + * @since 3.20.0 + * + * @param {Phaser.GameObjects.Video} video - The Video Game Object which started playback. + */ +module.exports = 'play'; + + +/***/ }), + +/***/ 24418: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Video Game Object Seeked Event. + * + * This event is dispatched when a Video completes seeking to a new point in its timeline. + * + * Listen for it from a Video Game Object instance using `Video.on('seeked', listener)`. + * + * @event Phaser.GameObjects.Events#VIDEO_SEEKED + * @type {string} + * @since 3.20.0 + * + * @param {Phaser.GameObjects.Video} video - The Video Game Object which completed seeking. + */ +module.exports = 'seeked'; + + +/***/ }), + +/***/ 87318: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Video Game Object Seeking Event. + * + * This event is dispatched when a Video _begins_ seeking to a new point in its timeline. + * When the seek is complete, it will dispatch the `VIDEO_SEEKED` event to conclude. + * + * Listen for it from a Video Game Object instance using `Video.on('seeking', listener)`. + * + * @event Phaser.GameObjects.Events#VIDEO_SEEKING + * @type {string} + * @since 3.20.0 + * + * @param {Phaser.GameObjects.Video} video - The Video Game Object which started seeking. + */ +module.exports = 'seeking'; + + +/***/ }), + +/***/ 50009: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Video Game Object Stalled Event. + * + * This event is dispatched by a Video Game Object when the video playback stalls. + * + * This can happen if the video is buffering. + * + * If will fire for any of the following native DOM events: + * + * `stalled` + * `suspend` + * `waiting` + * + * Listen for it from a Video Game Object instance using `Video.on('stalled', listener)`. + * + * Note that being stalled isn't always a negative thing. A video can be stalled if it + * has downloaded enough data in to its buffer to not need to download any more until + * the current batch of frames have rendered. + * + * @event Phaser.GameObjects.Events#VIDEO_STALLED + * @type {string} + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Video} video - The Video Game Object which threw the error. + * @param {Event} event - The native DOM event the browser raised during playback. + */ +module.exports = 'stalled'; + + +/***/ }), + +/***/ 61922: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Video Game Object Stopped Event. + * + * This event is dispatched when a Video is stopped from playback via a call to the `Video.stop` method, + * either directly via game code, or indirectly as the result of changing a video source or destroying it. + * + * Listen for it from a Video Game Object instance using `Video.on('stop', listener)`. + * + * @event Phaser.GameObjects.Events#VIDEO_STOP + * @type {string} + * @since 3.20.0 + * + * @param {Phaser.GameObjects.Video} video - The Video Game Object which stopped playback. + */ +module.exports = 'stop'; + + +/***/ }), + +/***/ 79501: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Video Game Object Texture Ready Event. + * + * This event is dispatched by a Video Game Object when it has finished creating its texture. + * + * This happens when the video has finished loading enough data for its first frame. + * + * If you wish to use the Video texture elsewhere in your game, such as as a Sprite texture, + * then you should listen for this event first, before creating the Sprites that use it. + * + * Listen for it from a Video Game Object instance using `Video.on('textureready', listener)`. + * + * @event Phaser.GameObjects.Events#VIDEO_TEXTURE + * @type {string} + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Video} video - The Video Game Object that emitted the event. + * @param {Phaser.Textures.Texture} texture - The Texture that was created. + */ +module.exports = 'textureready'; + + +/***/ }), + +/***/ 4052: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Video Game Object Unlocked Event. + * + * This event is dispatched when a Video that was prevented from playback due to the browsers + * Media Engagement Interaction policy, is unlocked by a user gesture. + * + * Listen for it from a Video Game Object instance using `Video.on('unlocked', listener)`. + * + * @event Phaser.GameObjects.Events#VIDEO_UNLOCKED + * @type {string} + * @since 3.20.0 + * + * @param {Phaser.GameObjects.Video} video - The Video Game Object which raised the event. + */ +module.exports = 'unlocked'; + + +/***/ }), + +/***/ 54857: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Video Game Object Unsupported Event. + * + * This event is dispatched by a Video Game Object if the media source + * (which may be specified as a MediaStream, MediaSource, Blob, or File, + * for example) doesn't represent a supported media format. + * + * Listen for it from a Video Game Object instance using `Video.on('unsupported', listener)`. + * + * @event Phaser.GameObjects.Events#VIDEO_UNSUPPORTED + * @type {string} + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Video} video - The Video Game Object which started playback. + * @param {DOMException|string} event - The native DOM event the browser raised during playback. + */ +module.exports = 'unsupported'; + + +/***/ }), + +/***/ 56631: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.GameObjects.Events + */ + +module.exports = { + + ADDED_TO_SCENE: __webpack_require__(65492), + DESTROY: __webpack_require__(98398), + REMOVED_FROM_SCENE: __webpack_require__(40239), + VIDEO_COMPLETE: __webpack_require__(17286), + VIDEO_CREATED: __webpack_require__(31496), + VIDEO_ERROR: __webpack_require__(89587), + VIDEO_LOCKED: __webpack_require__(59792), + VIDEO_LOOP: __webpack_require__(96342), + VIDEO_PLAY: __webpack_require__(49614), + VIDEO_PLAYING: __webpack_require__(6017), + VIDEO_SEEKED: __webpack_require__(24418), + VIDEO_SEEKING: __webpack_require__(87318), + VIDEO_STALLED: __webpack_require__(50009), + VIDEO_STOP: __webpack_require__(61922), + VIDEO_TEXTURE: __webpack_require__(79501), + VIDEO_UNLOCKED: __webpack_require__(4052), + VIDEO_UNSUPPORTED: __webpack_require__(54857) + +}; + + +/***/ }), + +/***/ 39419: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var ExternRender = __webpack_require__(79394); + +/** + * @classdesc + * An Extern Game Object is a special type of Game Object that allows you to pass + * rendering off to a 3rd party. + * + * When you create an Extern and place it in the display list of a Scene, the renderer will + * process the list as usual. When it finds an Extern it will flush the current batch, + * clear down the pipeline and prepare a transform matrix which your render function can + * take advantage of, if required. + * + * The WebGL context is then left in a 'clean' state, ready for you to bind your own shaders, + * or draw to it, whatever you wish to do. This should all take place in the `render` method. + * The correct way to deploy an Extern object is to create a class that extends it, then + * override the `render` (and optionally `preUpdate`) methods and pass off control to your + * 3rd party libraries or custom WebGL code there. + * + * Once you've finished, you should free-up any of your resources. + * The Extern will then rebind the Phaser pipeline and carry on rendering the display list. + * + * Although this object has lots of properties such as Alpha, Blend Mode and Tint, none of + * them are used during rendering unless you take advantage of them in your own render code. + * + * @class Extern + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.16.0 + * + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + */ +var Extern = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.Depth, + Components.Flip, + Components.Origin, + Components.ScrollFactor, + Components.Size, + Components.Texture, + Components.Tint, + Components.Transform, + Components.Visible, + ExternRender + ], + + initialize: + + function Extern (scene) + { + GameObject.call(this, scene, 'Extern'); + }, + + // Overrides Game Object method + addedToScene: function () + { + this.scene.sys.updateList.add(this); + }, + + // Overrides Game Object method + removedFromScene: function () + { + this.scene.sys.updateList.remove(this); + }, + + preUpdate: function () + { + // override this! + // Arguments: time, delta + }, + + render: function () + { + // override this! + // Arguments: renderer, camera, calcMatrix + } + +}); + +module.exports = Extern; + + +/***/ }), + +/***/ 96699: +/***/ (() => { + + + +/***/ }), + +/***/ 41155: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Extern = __webpack_require__(39419); +var GameObjectFactory = __webpack_require__(61286); + +/** + * Creates a new Extern Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Extern Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#extern + * @since 3.16.0 + * + * @return {Phaser.GameObjects.Extern} The Game Object that was created. + */ +GameObjectFactory.register('extern', function () +{ + var extern = new Extern(this.scene); + + this.displayList.add(extern); + + return extern; +}); + +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns + + +/***/ }), + +/***/ 79394: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(81410); +} + +if (true) +{ + renderCanvas = __webpack_require__(96699); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), + +/***/ 81410: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetCalcMatrix = __webpack_require__(73329); + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Extern#renderWebGL + * @since 3.16.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Extern} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var ExternWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + renderer.pipelines.clear(); + + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + + src.render.call(src, renderer, camera, calcMatrix); + + renderer.pipelines.rebind(); +}; + +module.exports = ExternWebGLRenderer; + + +/***/ }), + +/***/ 36266: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +module.exports = { + + ARC: 0, + BEGIN_PATH: 1, + CLOSE_PATH: 2, + FILL_RECT: 3, + LINE_TO: 4, + MOVE_TO: 5, + LINE_STYLE: 6, + FILL_STYLE: 7, + FILL_PATH: 8, + STROKE_PATH: 9, + FILL_TRIANGLE: 10, + STROKE_TRIANGLE: 11, + SAVE: 14, + RESTORE: 15, + TRANSLATE: 16, + SCALE: 17, + ROTATE: 18, + GRADIENT_FILL_STYLE: 21, + GRADIENT_LINE_STYLE: 22 + +}; + + +/***/ }), + +/***/ 33182: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BaseCamera = __webpack_require__(51052); +var Class = __webpack_require__(56694); +var Commands = __webpack_require__(36266); +var Components = __webpack_require__(64937); +var Ellipse = __webpack_require__(95669); +var GameObject = __webpack_require__(89980); +var GetFastValue = __webpack_require__(72632); +var GetValue = __webpack_require__(10850); +var MATH_CONST = __webpack_require__(83392); +var Render = __webpack_require__(60898); + +/** + * @classdesc + * A Graphics object is a way to draw primitive shapes to your game. Primitives include forms of geometry, such as + * Rectangles, Circles, and Polygons. They also include lines, arcs and curves. When you initially create a Graphics + * object it will be empty. + * + * To draw to it you must first specify a line style or fill style (or both), draw shapes using paths, and finally + * fill or stroke them. For example: + * + * ```javascript + * graphics.lineStyle(5, 0xFF00FF, 1.0); + * graphics.beginPath(); + * graphics.moveTo(100, 100); + * graphics.lineTo(200, 200); + * graphics.closePath(); + * graphics.strokePath(); + * ``` + * + * There are also many helpful methods that draw and fill/stroke common shapes for you. + * + * ```javascript + * graphics.lineStyle(5, 0xFF00FF, 1.0); + * graphics.fillStyle(0xFFFFFF, 1.0); + * graphics.fillRect(50, 50, 400, 200); + * graphics.strokeRect(50, 50, 400, 200); + * ``` + * + * When a Graphics object is rendered it will render differently based on if the game is running under Canvas or WebGL. + * Under Canvas it will use the HTML Canvas context drawing operations to draw the path. + * Under WebGL the graphics data is decomposed into polygons. Both of these are expensive processes, especially with + * complex shapes. + * + * If your Graphics object doesn't change much (or at all) once you've drawn your shape to it, then you will help + * performance by calling {@link Phaser.GameObjects.Graphics#generateTexture}. This will 'bake' the Graphics object into + * a Texture, and return it. You can then use this Texture for Sprites or other display objects. If your Graphics object + * updates frequently then you should avoid doing this, as it will constantly generate new textures, which will consume + * memory. + * + * As you can tell, Graphics objects are a bit of a trade-off. While they are extremely useful, you need to be careful + * in their complexity and quantity of them in your game. + * + * @class Graphics + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.0.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * @extends Phaser.GameObjects.Components.ScrollFactor + * + * @param {Phaser.Scene} scene - The Scene to which this Graphics object belongs. + * @param {Phaser.Types.GameObjects.Graphics.Options} [options] - Options that set the position and default style of this Graphics object. + */ +var Graphics = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.Mask, + Components.Pipeline, + Components.PostPipeline, + Components.Transform, + Components.Visible, + Components.ScrollFactor, + Render + ], + + initialize: + + function Graphics (scene, options) + { + var x = GetValue(options, 'x', 0); + var y = GetValue(options, 'y', 0); + + GameObject.call(this, scene, 'Graphics'); + + this.setPosition(x, y); + this.initPipeline(); + this.initPostPipeline(); + + /** + * The horizontal display origin of the Graphics. + * + * @name Phaser.GameObjects.Graphics#displayOriginX + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.displayOriginX = 0; + + /** + * The vertical display origin of the Graphics. + * + * @name Phaser.GameObjects.Graphics#displayOriginY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.displayOriginY = 0; + + /** + * The array of commands used to render the Graphics. + * + * @name Phaser.GameObjects.Graphics#commandBuffer + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.commandBuffer = []; + + /** + * The default fill color for shapes rendered by this Graphics object. + * Set this value with `setDefaultStyles()`. + * + * @name Phaser.GameObjects.Graphics#defaultFillColor + * @type {number} + * @readonly + * @default -1 * @since 3.0.0 */ this.defaultFillColor = -1; /** * The default fill alpha for shapes rendered by this Graphics object. + * Set this value with `setDefaultStyles()`. * * @name Phaser.GameObjects.Graphics#defaultFillAlpha * @type {number} + * @readonly * @default 1 * @since 3.0.0 */ @@ -78094,9 +75625,11 @@ var Graphics = new Class({ /** * The default stroke width for shapes rendered by this Graphics object. + * Set this value with `setDefaultStyles()`. * * @name Phaser.GameObjects.Graphics#defaultStrokeWidth * @type {number} + * @readonly * @default 1 * @since 3.0.0 */ @@ -78104,9 +75637,11 @@ var Graphics = new Class({ /** * The default stroke color for shapes rendered by this Graphics object. + * Set this value with `setDefaultStyles()`. * * @name Phaser.GameObjects.Graphics#defaultStrokeColor * @type {number} + * @readonly * @default -1 * @since 3.0.0 */ @@ -78114,9 +75649,11 @@ var Graphics = new Class({ /** * The default stroke alpha for shapes rendered by this Graphics object. + * Set this value with `setDefaultStyles()`. * * @name Phaser.GameObjects.Graphics#defaultStrokeAlpha * @type {number} + * @readonly * @default 1 * @since 3.0.0 */ @@ -78168,7 +75705,7 @@ var Graphics = new Class({ }, /** - * Set the current line style. + * Set the current line style. Used for all 'stroke' related functions. * * @method Phaser.GameObjects.Graphics#lineStyle * @since 3.0.0 @@ -78194,7 +75731,7 @@ var Graphics = new Class({ }, /** - * Set the current fill style. + * Set the current fill style. Used for all 'fill' related functions. * * @method Phaser.GameObjects.Graphics#fillStyle * @since 3.0.0 @@ -78585,7 +76122,7 @@ var Graphics = new Class({ * @param {number} y - The y coordinate of the top-left of the rectangle. * @param {number} width - The width of the rectangle. * @param {number} height - The height of the rectangle. - * @param {(Phaser.Types.GameObjects.Graphics.RoundedRectRadius|number)} [radius=20] - The corner radius; It can also be an object to specify different radii for corners. + * @param {(Phaser.Types.GameObjects.Graphics.RoundedRectRadius|number)} [radius=20] - The corner radius; It can also be an object to specify different radius for corners. * * @return {this} This Game Object. */ @@ -78606,16 +76143,62 @@ var Graphics = new Class({ br = GetFastValue(radius, 'br', 20); } + var convexTL = (tl >= 0); + var convexTR = (tr >= 0); + var convexBL = (bl >= 0); + var convexBR = (br >= 0); + + tl = Math.abs(tl); + tr = Math.abs(tr); + bl = Math.abs(bl); + br = Math.abs(br); + this.beginPath(); this.moveTo(x + tl, y); this.lineTo(x + width - tr, y); - this.arc(x + width - tr, y + tr, tr, -MATH_CONST.TAU, 0); + + if (convexTR) + { + this.arc(x + width - tr, y + tr, tr, -MATH_CONST.TAU, 0); + } + else + { + this.arc(x + width, y, tr, Math.PI, MATH_CONST.TAU, true); + } + this.lineTo(x + width, y + height - br); - this.arc(x + width - br, y + height - br, br, 0, MATH_CONST.TAU); + + if (convexBR) + { + this.arc(x + width - br, y + height - br, br, 0, MATH_CONST.TAU); + } + else + { + this.arc(x + width, y + height, br, -MATH_CONST.TAU, Math.PI, true); + } + this.lineTo(x + bl, y + height); - this.arc(x + bl, y + height - bl, bl, MATH_CONST.TAU, Math.PI); + + if (convexBL) + { + this.arc(x + bl, y + height - bl, bl, MATH_CONST.TAU, Math.PI); + } + else + { + this.arc(x, y + height, bl, 0, -MATH_CONST.TAU, true); + } + this.lineTo(x, y + tl); - this.arc(x + tl, y + tl, tl, -Math.PI, -MATH_CONST.TAU); + + if (convexTL) + { + this.arc(x + tl, y + tl, tl, -Math.PI, -MATH_CONST.TAU); + } + else + { + this.arc(x, y, tl, MATH_CONST.TAU, 0, true); + } + this.fillPath(); return this; @@ -78644,6 +76227,8 @@ var Graphics = new Class({ var bl = radius; var br = radius; + var maxRadius = Math.min(width, height) / 2; + if (typeof radius !== 'number') { tl = GetFastValue(radius, 'tl', 20); @@ -78652,20 +76237,66 @@ var Graphics = new Class({ br = GetFastValue(radius, 'br', 20); } + var convexTL = (tl >= 0); + var convexTR = (tr >= 0); + var convexBL = (bl >= 0); + var convexBR = (br >= 0); + + tl = Math.min(Math.abs(tl), maxRadius); + tr = Math.min(Math.abs(tr), maxRadius); + bl = Math.min(Math.abs(bl), maxRadius); + br = Math.min(Math.abs(br), maxRadius); + this.beginPath(); this.moveTo(x + tl, y); this.lineTo(x + width - tr, y); this.moveTo(x + width - tr, y); - this.arc(x + width - tr, y + tr, tr, -MATH_CONST.TAU, 0); + + if (convexTR) + { + this.arc(x + width - tr, y + tr, tr, -MATH_CONST.TAU, 0); + } + else + { + this.arc(x + width, y, tr, Math.PI, MATH_CONST.TAU, true); + } + this.lineTo(x + width, y + height - br); this.moveTo(x + width, y + height - br); - this.arc(x + width - br, y + height - br, br, 0, MATH_CONST.TAU); + + if (convexBR) + { + this.arc(x + width - br, y + height - br, br, 0, MATH_CONST.TAU); + } + else + { + this.arc(x + width, y + height, br, -MATH_CONST.TAU, Math.PI, true); + } + this.lineTo(x + bl, y + height); this.moveTo(x + bl, y + height); - this.arc(x + bl, y + height - bl, bl, MATH_CONST.TAU, Math.PI); + + if (convexBL) + { + this.arc(x + bl, y + height - bl, bl, MATH_CONST.TAU, Math.PI); + } + else + { + this.arc(x, y + height, bl, 0, -MATH_CONST.TAU, true); + } + this.lineTo(x, y + tl); this.moveTo(x, y + tl); - this.arc(x + tl, y + tl, tl, -Math.PI, -MATH_CONST.TAU); + + if (convexTL) + { + this.arc(x + tl, y + tl, tl, -Math.PI, -MATH_CONST.TAU); + } + else + { + this.arc(x, y, tl, MATH_CONST.TAU, 0, true); + } + this.strokePath(); return this; @@ -79331,6 +76962,7 @@ var Graphics = new Class({ var texture; var ctx; + var willRead = { willReadFrequently: true }; if (typeof key === 'string') { @@ -79344,7 +76976,7 @@ var Graphics = new Class({ if (src instanceof HTMLCanvasElement) { - ctx = src.getContext('2d'); + ctx = src.getContext('2d', willRead); } } else @@ -79353,14 +76985,14 @@ var Graphics = new Class({ texture = sys.textures.createCanvas(key, width, height); - ctx = texture.getSourceImage().getContext('2d'); + ctx = texture.getSourceImage().getContext('2d', willRead); } } else if (key instanceof HTMLCanvasElement) { // Key is a Canvas, so draw to it - ctx = key.getContext('2d'); + ctx = key.getContext('2d', willRead); } if (ctx) @@ -79404,6548 +77036,5484 @@ module.exports = Graphics; /***/ }), -/* 217 */ -/***/ (function(module, exports) { + +/***/ 91543: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -module.exports = { +var Commands = __webpack_require__(36266); +var SetTransform = __webpack_require__(49584); - ARC: 0, - BEGIN_PATH: 1, - CLOSE_PATH: 2, - FILL_RECT: 3, - LINE_TO: 4, - MOVE_TO: 5, - LINE_STYLE: 6, - FILL_STYLE: 7, - FILL_PATH: 8, - STROKE_PATH: 9, - FILL_TRIANGLE: 10, - STROKE_TRIANGLE: 11, - SAVE: 14, - RESTORE: 15, - TRANSLATE: 16, - SCALE: 17, - ROTATE: 18, - GRADIENT_FILL_STYLE: 21, - GRADIENT_LINE_STYLE: 22 +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Graphics#renderCanvas + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Graphics} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @param {CanvasRenderingContext2D} [renderTargetCtx] - The target rendering context. + * @param {boolean} allowClip - If `true` then path operations will be used instead of fill operations. + */ +var GraphicsCanvasRenderer = function (renderer, src, camera, parentMatrix, renderTargetCtx, allowClip) +{ + var commandBuffer = src.commandBuffer; + var commandBufferLength = commandBuffer.length; + + var ctx = renderTargetCtx || renderer.currentContext; + + if (commandBufferLength === 0 || !SetTransform(renderer, ctx, src, camera, parentMatrix)) + { + return; + } + + camera.addToRenderList(src); + + var lineAlpha = 1; + var fillAlpha = 1; + var lineColor = 0; + var fillColor = 0; + var lineWidth = 1; + var red = 0; + var green = 0; + var blue = 0; + + // Reset any currently active paths + ctx.beginPath(); + + for (var index = 0; index < commandBufferLength; ++index) + { + var commandID = commandBuffer[index]; + + switch (commandID) + { + case Commands.ARC: + ctx.arc( + commandBuffer[index + 1], + commandBuffer[index + 2], + commandBuffer[index + 3], + commandBuffer[index + 4], + commandBuffer[index + 5], + commandBuffer[index + 6] + ); + + // +7 because overshoot is the 7th value, not used in Canvas + index += 7; + break; + + case Commands.LINE_STYLE: + lineWidth = commandBuffer[index + 1]; + lineColor = commandBuffer[index + 2]; + lineAlpha = commandBuffer[index + 3]; + red = ((lineColor & 0xFF0000) >>> 16); + green = ((lineColor & 0xFF00) >>> 8); + blue = (lineColor & 0xFF); + ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + lineAlpha + ')'; + ctx.lineWidth = lineWidth; + index += 3; + break; + + case Commands.FILL_STYLE: + fillColor = commandBuffer[index + 1]; + fillAlpha = commandBuffer[index + 2]; + red = ((fillColor & 0xFF0000) >>> 16); + green = ((fillColor & 0xFF00) >>> 8); + blue = (fillColor & 0xFF); + ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')'; + index += 2; + break; + + case Commands.BEGIN_PATH: + ctx.beginPath(); + break; + + case Commands.CLOSE_PATH: + ctx.closePath(); + break; + + case Commands.FILL_PATH: + if (!allowClip) + { + ctx.fill(); + } + break; + + case Commands.STROKE_PATH: + if (!allowClip) + { + ctx.stroke(); + } + break; + + case Commands.FILL_RECT: + if (!allowClip) + { + ctx.fillRect( + commandBuffer[index + 1], + commandBuffer[index + 2], + commandBuffer[index + 3], + commandBuffer[index + 4] + ); + } + else + { + ctx.rect( + commandBuffer[index + 1], + commandBuffer[index + 2], + commandBuffer[index + 3], + commandBuffer[index + 4] + ); + } + index += 4; + break; + + case Commands.FILL_TRIANGLE: + ctx.beginPath(); + ctx.moveTo(commandBuffer[index + 1], commandBuffer[index + 2]); + ctx.lineTo(commandBuffer[index + 3], commandBuffer[index + 4]); + ctx.lineTo(commandBuffer[index + 5], commandBuffer[index + 6]); + ctx.closePath(); + if (!allowClip) + { + ctx.fill(); + } + index += 6; + break; + + case Commands.STROKE_TRIANGLE: + ctx.beginPath(); + ctx.moveTo(commandBuffer[index + 1], commandBuffer[index + 2]); + ctx.lineTo(commandBuffer[index + 3], commandBuffer[index + 4]); + ctx.lineTo(commandBuffer[index + 5], commandBuffer[index + 6]); + ctx.closePath(); + if (!allowClip) + { + ctx.stroke(); + } + index += 6; + break; + + case Commands.LINE_TO: + ctx.lineTo( + commandBuffer[index + 1], + commandBuffer[index + 2] + ); + index += 2; + break; + + case Commands.MOVE_TO: + ctx.moveTo( + commandBuffer[index + 1], + commandBuffer[index + 2] + ); + index += 2; + break; + + case Commands.LINE_FX_TO: + ctx.lineTo( + commandBuffer[index + 1], + commandBuffer[index + 2] + ); + index += 5; + break; + + case Commands.MOVE_FX_TO: + ctx.moveTo( + commandBuffer[index + 1], + commandBuffer[index + 2] + ); + index += 5; + break; + + case Commands.SAVE: + ctx.save(); + break; + + case Commands.RESTORE: + ctx.restore(); + break; + + case Commands.TRANSLATE: + ctx.translate( + commandBuffer[index + 1], + commandBuffer[index + 2] + ); + index += 2; + break; + + case Commands.SCALE: + ctx.scale( + commandBuffer[index + 1], + commandBuffer[index + 2] + ); + index += 2; + break; + + case Commands.ROTATE: + ctx.rotate( + commandBuffer[index + 1] + ); + index += 1; + break; + + case Commands.GRADIENT_FILL_STYLE: + index += 5; + break; + + case Commands.GRADIENT_LINE_STYLE: + index += 6; + break; + } + } + // Restore the context saved in SetTransform + ctx.restore(); }; +module.exports = GraphicsCanvasRenderer; + /***/ }), -/* 218 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 41286: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Point = __webpack_require__(4); +var GameObjectCreator = __webpack_require__(99325); +var Graphics = __webpack_require__(33182); /** - * Returns a Point object containing the coordinates of a point on the circumference of the Ellipse based on the given angle. + * Creates a new Graphics Game Object and returns it. * - * @function Phaser.Geom.Ellipse.CircumferencePoint - * @since 3.0.0 + * Note: This method will only be available if the Graphics Game Object has been built into Phaser. * - * @generic {Phaser.Geom.Point} O - [out,$return] + * @method Phaser.GameObjects.GameObjectCreator#graphics + * @since 3.0.0 * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the circumference point on. - * @param {number} angle - The angle from the center of the Ellipse to the circumference to return the point from. Given in radians. - * @param {(Phaser.Geom.Point|object)} [out] - A Point, or point-like object, to store the results in. If not given a Point will be created. + * @param {Phaser.Types.GameObjects.Graphics.Options} [config] - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * - * @return {(Phaser.Geom.Point|object)} A Point object where the `x` and `y` properties are the point on the circumference. + * @return {Phaser.GameObjects.Graphics} The Game Object that was created. */ -var CircumferencePoint = function (ellipse, angle, out) +GameObjectCreator.register('graphics', function (config, addToScene) { - if (out === undefined) { out = new Point(); } + if (config === undefined) { config = {}; } - var halfWidth = ellipse.width / 2; - var halfHeight = ellipse.height / 2; + if (addToScene !== undefined) + { + config.add = addToScene; + } - out.x = ellipse.x + halfWidth * Math.cos(angle); - out.y = ellipse.y + halfHeight * Math.sin(angle); + var graphics = new Graphics(this.scene, config); - return out; -}; + if (config.add) + { + this.scene.sys.displayList.add(graphics); + } -module.exports = CircumferencePoint; + return graphics; +}); + +// When registering a factory function 'this' refers to the GameObjectCreator context. /***/ }), -/* 219 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 13122: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlendModes = __webpack_require__(35); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var ComponentsToJSON = __webpack_require__(176); -var DataManager = __webpack_require__(101); -var EventEmitter = __webpack_require__(9); -var GameObjectEvents = __webpack_require__(75); -var List = __webpack_require__(110); -var Render = __webpack_require__(1071); -var SceneEvents = __webpack_require__(20); -var StableSort = __webpack_require__(79); +var Graphics = __webpack_require__(33182); +var GameObjectFactory = __webpack_require__(61286); /** - * @classdesc - * A Layer Game Object. - * - * A Layer is a special type of Game Object that acts as a Display List. You can add any type of Game Object - * to a Layer, just as you would to a Scene. Layers can be used to visually group together 'layers' of Game - * Objects: - * - * ```javascript - * const spaceman = this.add.sprite(150, 300, 'spaceman'); - * const bunny = this.add.sprite(400, 300, 'bunny'); - * const elephant = this.add.sprite(650, 300, 'elephant'); - * - * const layer = this.add.layer(); + * Creates a new Graphics Game Object and adds it to the Scene. * - * layer.add([ spaceman, bunny, elephant ]); - * ``` + * Note: This method will only be available if the Graphics Game Object has been built into Phaser. * - * The 3 sprites in the example above will now be managed by the Layer they were added to. Therefore, - * if you then set `layer.setVisible(false)` they would all vanish from the display. + * @method Phaser.GameObjects.GameObjectFactory#graphics + * @since 3.0.0 * - * You can also control the depth of the Game Objects within the Layer. For example, calling the - * `setDepth` method of a child of a Layer will allow you to adjust the depth of that child _within the - * Layer itself_, rather than the whole Scene. The Layer, too, can have its depth set as well. + * @param {Phaser.Types.GameObjects.Graphics.Options} [config] - The Graphics configuration. * - * The Layer class also offers many different methods for manipulating the list, such as the - * methods `moveUp`, `moveDown`, `sendToBack`, `bringToTop` and so on. These allow you to change the - * display list position of the Layers children, causing it to adjust the order in which they are - * rendered. Using `setDepth` on a child allows you to override this. + * @return {Phaser.GameObjects.Graphics} The Game Object that was created. + */ +GameObjectFactory.register('graphics', function (config) +{ + return this.displayList.add(new Graphics(this.scene, config)); +}); + +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns + + +/***/ }), + +/***/ 60898: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(34429); + + // Needed for Graphics.generateTexture + renderCanvas = __webpack_require__(91543); +} + +if (true) +{ + renderCanvas = __webpack_require__(91543); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), + +/***/ 34429: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Commands = __webpack_require__(36266); +var GetCalcMatrix = __webpack_require__(73329); +var TransformMatrix = __webpack_require__(69360); +var Utils = __webpack_require__(75512); + +var Point = function (x, y, width) +{ + this.x = x; + this.y = y; + this.width = width; +}; + +var Path = function (x, y, width) +{ + this.points = []; + this.pointsLength = 1; + this.points[0] = new Point(x, y, width); +}; + +var matrixStack = []; +var tempMatrix = new TransformMatrix(); + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * Layers can have Post FX Pipelines set, which allows you to easily enable a post pipeline across - * a whole range of children, which, depending on the effect, can often be far more efficient that doing so - * on a per-child basis. + * @method Phaser.GameObjects.Graphics#renderWebGL + * @since 3.0.0 + * @private * - * Layers have no position or size within the Scene. This means you cannot enable a Layer for - * physics or input, or change the position, rotation or scale of a Layer. They also have no scroll - * factor, texture, tint, origin, crop or bounds. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Graphics} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var GraphicsWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + if (src.commandBuffer.length === 0) + { + return; + } + + camera.addToRenderList(src); + + var pipeline = renderer.pipelines.set(src.pipeline, src); + + renderer.pipelines.preBatch(src); + + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + + var currentMatrix = tempMatrix.loadIdentity(); + + var commands = src.commandBuffer; + var alpha = camera.alpha * src.alpha; + + var lineWidth = 1; + var fillTint = pipeline.fillTint; + var strokeTint = pipeline.strokeTint; + + var tx = 0; + var ty = 0; + var ta = 0; + var iterStep = 0.01; + var PI2 = Math.PI * 2; + + var cmd; + + var path = []; + var pathIndex = 0; + var pathOpen = true; + var lastPath = null; + + var getTint = Utils.getTintAppendFloatAlpha; + + for (var cmdIndex = 0; cmdIndex < commands.length; cmdIndex++) + { + cmd = commands[cmdIndex]; + + switch (cmd) + { + case Commands.BEGIN_PATH: + { + path.length = 0; + lastPath = null; + pathOpen = true; + break; + } + + case Commands.CLOSE_PATH: + { + pathOpen = false; + + if (lastPath && lastPath.points.length) + { + lastPath.points.push(lastPath.points[0]); + } + break; + } + + case Commands.FILL_PATH: + { + for (pathIndex = 0; pathIndex < path.length; pathIndex++) + { + pipeline.batchFillPath( + path[pathIndex].points, + currentMatrix, + calcMatrix + ); + } + break; + } + + case Commands.STROKE_PATH: + { + for (pathIndex = 0; pathIndex < path.length; pathIndex++) + { + pipeline.batchStrokePath( + path[pathIndex].points, + lineWidth, + pathOpen, + currentMatrix, + calcMatrix + ); + } + break; + } + + case Commands.LINE_STYLE: + { + lineWidth = commands[++cmdIndex]; + var strokeColor = commands[++cmdIndex]; + var strokeAlpha = commands[++cmdIndex] * alpha; + var strokeTintColor = getTint(strokeColor, strokeAlpha); + strokeTint.TL = strokeTintColor; + strokeTint.TR = strokeTintColor; + strokeTint.BL = strokeTintColor; + strokeTint.BR = strokeTintColor; + break; + } + + case Commands.FILL_STYLE: + { + var fillColor = commands[++cmdIndex]; + var fillAlpha = commands[++cmdIndex] * alpha; + var fillTintColor = getTint(fillColor, fillAlpha); + fillTint.TL = fillTintColor; + fillTint.TR = fillTintColor; + fillTint.BL = fillTintColor; + fillTint.BR = fillTintColor; + break; + } + + case Commands.GRADIENT_FILL_STYLE: + { + var alphaTL = commands[++cmdIndex] * alpha; + var alphaTR = commands[++cmdIndex] * alpha; + var alphaBL = commands[++cmdIndex] * alpha; + var alphaBR = commands[++cmdIndex] * alpha; + + fillTint.TL = getTint(commands[++cmdIndex], alphaTL); + fillTint.TR = getTint(commands[++cmdIndex], alphaTR); + fillTint.BL = getTint(commands[++cmdIndex], alphaBL); + fillTint.BR = getTint(commands[++cmdIndex], alphaBR); + break; + } + + case Commands.GRADIENT_LINE_STYLE: + { + lineWidth = commands[++cmdIndex]; + var gradientLineAlpha = commands[++cmdIndex] * alpha; + strokeTint.TL = getTint(commands[++cmdIndex], gradientLineAlpha); + strokeTint.TR = getTint(commands[++cmdIndex], gradientLineAlpha); + strokeTint.BL = getTint(commands[++cmdIndex], gradientLineAlpha); + strokeTint.BR = getTint(commands[++cmdIndex], gradientLineAlpha); + break; + } + + case Commands.ARC: + { + var iteration = 0; + var x = commands[++cmdIndex]; + var y = commands[++cmdIndex]; + var radius = commands[++cmdIndex]; + var startAngle = commands[++cmdIndex]; + var endAngle = commands[++cmdIndex]; + var anticlockwise = commands[++cmdIndex]; + var overshoot = commands[++cmdIndex]; + + endAngle -= startAngle; + + if (anticlockwise) + { + if (endAngle < -PI2) + { + endAngle = -PI2; + } + else if (endAngle > 0) + { + endAngle = -PI2 + endAngle % PI2; + } + } + else if (endAngle > PI2) + { + endAngle = PI2; + } + else if (endAngle < 0) + { + endAngle = PI2 + endAngle % PI2; + } + + if (lastPath === null) + { + lastPath = new Path(x + Math.cos(startAngle) * radius, y + Math.sin(startAngle) * radius, lineWidth); + path.push(lastPath); + iteration += iterStep; + } + + while (iteration < 1 + overshoot) + { + ta = endAngle * iteration + startAngle; + tx = x + Math.cos(ta) * radius; + ty = y + Math.sin(ta) * radius; + + lastPath.points.push(new Point(tx, ty, lineWidth)); + + iteration += iterStep; + } + + ta = endAngle + startAngle; + tx = x + Math.cos(ta) * radius; + ty = y + Math.sin(ta) * radius; + + lastPath.points.push(new Point(tx, ty, lineWidth)); + + break; + } + + case Commands.FILL_RECT: + { + pipeline.batchFillRect( + commands[++cmdIndex], + commands[++cmdIndex], + commands[++cmdIndex], + commands[++cmdIndex], + currentMatrix, + calcMatrix + ); + break; + } + + case Commands.FILL_TRIANGLE: + { + pipeline.batchFillTriangle( + commands[++cmdIndex], + commands[++cmdIndex], + commands[++cmdIndex], + commands[++cmdIndex], + commands[++cmdIndex], + commands[++cmdIndex], + currentMatrix, + calcMatrix + ); + break; + } + + case Commands.STROKE_TRIANGLE: + { + pipeline.batchStrokeTriangle( + commands[++cmdIndex], + commands[++cmdIndex], + commands[++cmdIndex], + commands[++cmdIndex], + commands[++cmdIndex], + commands[++cmdIndex], + lineWidth, + currentMatrix, + calcMatrix + ); + break; + } + + case Commands.LINE_TO: + { + if (lastPath !== null) + { + lastPath.points.push(new Point(commands[++cmdIndex], commands[++cmdIndex], lineWidth)); + } + else + { + lastPath = new Path(commands[++cmdIndex], commands[++cmdIndex], lineWidth); + path.push(lastPath); + } + break; + } + + case Commands.MOVE_TO: + { + lastPath = new Path(commands[++cmdIndex], commands[++cmdIndex], lineWidth); + path.push(lastPath); + break; + } + + case Commands.SAVE: + { + matrixStack.push(currentMatrix.copyToArray()); + break; + } + + case Commands.RESTORE: + { + currentMatrix.copyFromArray(matrixStack.pop()); + break; + } + + case Commands.TRANSLATE: + { + x = commands[++cmdIndex]; + y = commands[++cmdIndex]; + currentMatrix.translate(x, y); + break; + } + + case Commands.SCALE: + { + x = commands[++cmdIndex]; + y = commands[++cmdIndex]; + currentMatrix.scale(x, y); + break; + } + + case Commands.ROTATE: + { + currentMatrix.rotate(commands[++cmdIndex]); + break; + } + } + } + + renderer.pipelines.postBatch(src); +}; + +module.exports = GraphicsWebGLRenderer; + + +/***/ }), + +/***/ 59192: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Actions = __webpack_require__(83979); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(56631); +var EventEmitter = __webpack_require__(6659); +var GetAll = __webpack_require__(71608); +var GetFastValue = __webpack_require__(72632); +var GetValue = __webpack_require__(10850); +var HasValue = __webpack_require__(19256); +var IsPlainObject = __webpack_require__(42911); +var Range = __webpack_require__(75757); +var Set = __webpack_require__(58403); +var Sprite = __webpack_require__(13747); + +/** + * @classdesc + * A Group is a way for you to create, manipulate, or recycle similar Game Objects. * - * If you need those kind of features then you should use a Container instead. Containers can be added - * to Layers, but Layers cannot be added to Containers. + * Group membership is non-exclusive. A Game Object can belong to several groups, one group, or none. * - * However, you can set the Alpha, Blend Mode, Depth, Mask and Visible state of a Layer. These settings - * will impact all children being rendered by the Layer. + * Groups themselves aren't displayable, and can't be positioned, rotated, scaled, or hidden. * - * @class Layer - * @extends Phaser.Structs.List. + * @class Group * @memberof Phaser.GameObjects + * @extends Phaser.Events.EventEmitter * @constructor - * @since 3.50.0 - * - * @extends Phaser.GameObjects.Components.AlphaSingle - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.Visible + * @since 3.0.0 + * @param {Phaser.Scene} scene - The scene this group belongs to. + * @param {(Phaser.GameObjects.GameObject[]|Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. + * @param {Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} [config] - Settings for this group. If `key` is set, Phaser.GameObjects.Group#createMultiple is also called with these settings. * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Layer. + * @see Phaser.Physics.Arcade.Group + * @see Phaser.Physics.Arcade.StaticGroup */ -var Layer = new Class({ - - Extends: List, +var Group = new Class({ - Mixins: [ - Components.AlphaSingle, - Components.BlendMode, - Components.Depth, - Components.Mask, - Components.Pipeline, - Components.Visible, - EventEmitter, - Render - ], + Extends: EventEmitter, initialize: - function Layer (scene, children) + function Group (scene, children, config) { - List.call(this, scene); EventEmitter.call(this); + // They can pass in any of the following as the first argument: + + // 1) A single child + // 2) An array of children + // 3) A config object + // 4) An array of config objects + + // Or they can pass in a child, or array of children AND a config object + + if (config) + { + // config has been set, are the children an array? + + if (children && !Array.isArray(children)) + { + children = [ children ]; + } + } + else if (Array.isArray(children)) + { + // No config, so let's check the children argument + + if (IsPlainObject(children[0])) + { + // It's an array of plain config objects + config = children; + children = null; + } + } + else if (IsPlainObject(children)) + { + // Children isn't an array. Is it a config object though? + config = children; + children = null; + } + /** - * A reference to the Scene to which this Game Object belongs. - * - * Game Objects can only belong to one Scene. - * - * You should consider this property as being read-only. You cannot move a - * Game Object to another Scene by simply changing it. + * This scene this group belongs to. * - * @name Phaser.GameObjects.Layer#scene + * @name Phaser.GameObjects.Group#scene * @type {Phaser.Scene} - * @since 3.50.0 + * @since 3.0.0 */ this.scene = scene; /** - * Holds a reference to the Display List that contains this Game Object. - * - * This is set automatically when this Game Object is added to a Scene or Layer. - * - * You should treat this property as being read-only. + * Members of this group. * - * @name Phaser.GameObjects.Layer#displayList - * @type {(Phaser.GameObjects.DisplayList|Phaser.GameObjects.Layer)} - * @default null - * @since 3.50.0 + * @name Phaser.GameObjects.Group#children + * @type {Phaser.Structs.Set.} + * @since 3.0.0 */ - this.displayList = null; + this.children = new Set(); /** - * A textual representation of this Game Object, i.e. `sprite`. - * Used internally by Phaser but is available for your own custom classes to populate. + * A flag identifying this object as a group. * - * @name Phaser.GameObjects.Layer#type - * @type {string} - * @since 3.50.0 + * @name Phaser.GameObjects.Group#isParent + * @type {boolean} + * @default true + * @since 3.0.0 */ - this.type = 'Layer'; + this.isParent = true; /** - * The current state of this Game Object. - * - * Phaser itself will never modify this value, although plugins may do so. - * - * Use this property to track the state of a Game Object during its lifetime. For example, it could change from - * a state of 'moving', to 'attacking', to 'dead'. The state value should be an integer (ideally mapped to a constant - * in your game code), or a string. These are recommended to keep it light and simple, with fast comparisons. - * If you need to store complex data about your Game Object, look at using the Data Component instead. + * A textual representation of this Game Object. + * Used internally by Phaser but is available for your own custom classes to populate. * - * @name Phaser.GameObjects.Layer#state - * @type {(number|string)} - * @since 3.50.0 + * @name Phaser.GameObjects.Group#type + * @type {string} + * @default 'Group' + * @since 3.21.0 */ - this.state = 0; + this.type = 'Group'; /** - * A Layer cannot be placed inside a Container. - * - * This property is kept purely so a Layer has the same - * shape as a Game Object. + * The class to create new group members from. * - * @name Phaser.GameObjects.Layer#parentContainer - * @type {Phaser.GameObjects.Container} - * @since 3.51.0 + * @name Phaser.GameObjects.Group#classType + * @type {function} + * @since 3.0.0 + * @default Phaser.GameObjects.Sprite + * @see Phaser.Types.GameObjects.Group.GroupClassTypeConstructor */ - this.parentContainer = null; + this.classType = GetFastValue(config, 'classType', Sprite); /** - * The name of this Game Object. + * The name of this group. * Empty by default and never populated by Phaser, this is left for developers to use. * - * @name Phaser.GameObjects.Layer#name + * @name Phaser.GameObjects.Group#name * @type {string} * @default '' - * @since 3.50.0 + * @since 3.18.0 */ - this.name = ''; + this.name = GetFastValue(config, 'name', ''); /** - * The active state of this Game Object. - * A Game Object with an active state of `true` is processed by the Scenes UpdateList, if added to it. - * An active object is one which is having its logic and internal systems updated. + * Whether this group runs its {@link Phaser.GameObjects.Group#preUpdate} method (which may update any members). * - * @name Phaser.GameObjects.Layer#active + * @name Phaser.GameObjects.Group#active * @type {boolean} - * @default true - * @since 3.50.0 + * @since 3.0.0 */ - this.active = true; + this.active = GetFastValue(config, 'active', true); /** - * The Tab Index of the Game Object. - * Reserved for future use by plugins and the Input Manager. + * The maximum size of this group, if used as a pool. -1 is no limit. * - * @name Phaser.GameObjects.Layer#tabIndex + * @name Phaser.GameObjects.Group#maxSize * @type {number} + * @since 3.0.0 * @default -1 - * @since 3.51.0 */ - this.tabIndex = -1; + this.maxSize = GetFastValue(config, 'maxSize', -1); /** - * A Data Manager. - * It allows you to store, query and get key/value paired information specific to this Game Object. - * `null` by default. Automatically created if you use `getData` or `setData` or `setDataEnabled`. + * A default texture key to use when creating new group members. * - * @name Phaser.GameObjects.Layer#data - * @type {Phaser.Data.DataManager} - * @default null - * @since 3.50.0 - */ - this.data = null; - - /** - * The flags that are compared against `RENDER_MASK` to determine if this Game Object will render or not. - * The bits are 0001 | 0010 | 0100 | 1000 set by the components Visible, Alpha, Transform and Texture respectively. - * If those components are not used by your custom class then you can use this bitmask as you wish. + * This is used in {@link Phaser.GameObjects.Group#create} + * but not in {@link Phaser.GameObjects.Group#createMultiple}. * - * @name Phaser.GameObjects.Layer#renderFlags - * @type {number} - * @default 15 - * @since 3.50.0 + * @name Phaser.GameObjects.Group#defaultKey + * @type {string} + * @since 3.0.0 */ - this.renderFlags = 15; + this.defaultKey = GetFastValue(config, 'defaultKey', null); /** - * A bitmask that controls if this Game Object is drawn by a Camera or not. - * Not usually set directly, instead call `Camera.ignore`, however you can - * set this property directly using the Camera.id property: - * - * @example - * this.cameraFilter |= camera.id + * A default texture frame to use when creating new group members. * - * @name Phaser.GameObjects.Layer#cameraFilter - * @type {number} - * @default 0 - * @since 3.50.0 + * @name Phaser.GameObjects.Group#defaultFrame + * @type {(string|number)} + * @since 3.0.0 */ - this.cameraFilter = 0; + this.defaultFrame = GetFastValue(config, 'defaultFrame', null); /** - * This property is kept purely so a Layer has the same - * shape as a Game Object. You cannot input enable a Layer. + * Whether to call the update method of any members. * - * @name Phaser.GameObjects.Layer#input - * @type {?Phaser.Types.Input.InteractiveObject} - * @default null - * @since 3.51.0 + * @name Phaser.GameObjects.Group#runChildUpdate + * @type {boolean} + * @default false + * @since 3.0.0 + * @see Phaser.GameObjects.Group#preUpdate */ - this.input = null; + this.runChildUpdate = GetFastValue(config, 'runChildUpdate', false); /** - * This property is kept purely so a Layer has the same - * shape as a Game Object. You cannot give a Layer a physics body. + * A function to be called when adding or creating group members. * - * @name Phaser.GameObjects.Layer#body - * @type {?(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody|MatterJS.BodyType)} - * @default null - * @since 3.51.0 + * @name Phaser.GameObjects.Group#createCallback + * @type {?Phaser.Types.GameObjects.Group.GroupCallback} + * @since 3.0.0 */ - this.body = null; + this.createCallback = GetFastValue(config, 'createCallback', null); /** - * This Game Object will ignore all calls made to its destroy method if this flag is set to `true`. - * This includes calls that may come from a Group, Container or the Scene itself. - * While it allows you to persist a Game Object across Scenes, please understand you are entirely - * responsible for managing references to and from this Game Object. + * A function to be called when removing group members. * - * @name Phaser.GameObjects.Layer#ignoreDestroy - * @type {boolean} - * @default false - * @since 3.50.0 + * @name Phaser.GameObjects.Group#removeCallback + * @type {?Phaser.Types.GameObjects.Group.GroupCallback} + * @since 3.0.0 */ - this.ignoreDestroy = false; + this.removeCallback = GetFastValue(config, 'removeCallback', null); /** - * A reference to the Scene Systems. + * A function to be called when creating several group members at once. * - * @name Phaser.GameObjects.Layer#systems - * @type {Phaser.Scenes.Systems} - * @since 3.50.0 + * @name Phaser.GameObjects.Group#createMultipleCallback + * @type {?Phaser.Types.GameObjects.Group.GroupMultipleCreateCallback} + * @since 3.0.0 */ - this.systems = scene.sys; + this.createMultipleCallback = GetFastValue(config, 'createMultipleCallback', null); /** - * A reference to the Scene Event Emitter. + * A function to be called when adding or creating group members. + * For internal use only by a Group, or any class that extends it. * - * @name Phaser.GameObjects.Layer#events - * @type {Phaser.Events.EventEmitter} - * @since 3.50.0 + * @name Phaser.GameObjects.Group#internalCreateCallback + * @type {?Phaser.Types.GameObjects.Group.GroupCallback} + * @private + * @since 3.22.0 */ - this.events = scene.sys.events; + this.internalCreateCallback = GetFastValue(config, 'internalCreateCallback', null); /** - * The flag the determines whether Game Objects should be sorted when `depthSort()` is called. + * A function to be called when removing group members. + * For internal use only by a Group, or any class that extends it. * - * @name Phaser.GameObjects.Layer#sortChildrenFlag - * @type {boolean} - * @default false - * @since 3.50.0 + * @name Phaser.GameObjects.Group#internalRemoveCallback + * @type {?Phaser.Types.GameObjects.Group.GroupCallback} + * @private + * @since 3.22.0 */ - this.sortChildrenFlag = false; - - // Set the List callbacks - this.addCallback = this.addChildCallback; - this.removeCallback = this.removeChildCallback; - - this.initPipeline(); - - this.clearAlpha(); - - this.setBlendMode(BlendModes.SKIP_CHECK); + this.internalRemoveCallback = GetFastValue(config, 'internalRemoveCallback', null); if (children) { - this.add(children); + this.addMultiple(children); } - // Tell the Scene to re-sort the children - scene.sys.queueDepthSort(); + if (config) + { + this.createMultiple(config); + } + + this.on(Events.ADDED_TO_SCENE, this.addedToScene, this); + this.on(Events.REMOVED_FROM_SCENE, this.removedFromScene, this); }, - /** - * Sets the `active` property of this Game Object and returns this Game Object for further chaining. - * A Game Object with its `active` property set to `true` will be updated by the Scenes UpdateList. - * - * @method Phaser.GameObjects.Layer#setActive - * @since 3.50.0 - * - * @param {boolean} value - True if this Game Object should be set as active, false if not. - * - * @return {this} This GameObject. - */ - setActive: function (value) + // Overrides Game Object method + addedToScene: function () { - this.active = value; - - return this; + this.scene.sys.updateList.add(this); }, - /** - * Sets the `name` property of this Game Object and returns this Game Object for further chaining. - * The `name` property is not populated by Phaser and is presented for your own use. - * - * @method Phaser.GameObjects.Layer#setName - * @since 3.50.0 - * - * @param {string} value - The name to be given to this Game Object. - * - * @return {this} This GameObject. - */ - setName: function (value) + // Overrides Game Object method + removedFromScene: function () { - this.name = value; - - return this; + this.scene.sys.updateList.remove(this); }, /** - * Sets the current state of this Game Object. - * - * Phaser itself will never modify the State of a Game Object, although plugins may do so. + * Creates a new Game Object and adds it to this group, unless the group {@link Phaser.GameObjects.Group#isFull is full}. * - * For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'. - * The state value should typically be an integer (ideally mapped to a constant - * in your game code), but could also be a string. It is recommended to keep it light and simple. - * If you need to store complex data about your Game Object, look at using the Data Component instead. + * Calls {@link Phaser.GameObjects.Group#createCallback}. * - * @method Phaser.GameObjects.Layer#setState - * @since 3.50.0 + * @method Phaser.GameObjects.Group#create + * @since 3.0.0 * - * @param {(number|string)} value - The state of the Game Object. + * @param {number} [x=0] - The horizontal position of the new Game Object in the world. + * @param {number} [y=0] - The vertical position of the new Game Object in the world. + * @param {string} [key=defaultKey] - The texture key of the new Game Object. + * @param {(string|number)} [frame=defaultFrame] - The texture frame of the new Game Object. + * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of the new Game Object. + * @param {boolean} [active=true] - The {@link Phaser.GameObjects.GameObject#active} state of the new Game Object. * - * @return {this} This GameObject. + * @return {any} The new Game Object (usually a Sprite, etc.). */ - setState: function (value) + create: function (x, y, key, frame, visible, active) { - this.state = value; - - return this; - }, + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (key === undefined) { key = this.defaultKey; } + if (frame === undefined) { frame = this.defaultFrame; } + if (visible === undefined) { visible = true; } + if (active === undefined) { active = true; } - /** - * Adds a Data Manager component to this Game Object. - * - * @method Phaser.GameObjects.Layer#setDataEnabled - * @since 3.50.0 - * @see Phaser.Data.DataManager - * - * @return {this} This GameObject. - */ - setDataEnabled: function () - { - if (!this.data) + // Pool? + if (this.isFull()) { - this.data = new DataManager(this); + return null; } - return this; - }, + var child = new this.classType(this.scene, x, y, key, frame); - /** - * Allows you to store a key value pair within this Game Objects Data Manager. - * - * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled - * before setting the value. - * - * If the key doesn't already exist in the Data Manager then it is created. - * - * ```javascript - * sprite.setData('name', 'Red Gem Stone'); - * ``` - * - * You can also pass in an object of key value pairs as the first argument: - * - * ```javascript - * sprite.setData({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 }); - * ``` - * - * To get a value back again you can call `getData`: - * - * ```javascript - * sprite.getData('gold'); - * ``` - * - * Or you can access the value directly via the `values` property, where it works like any other variable: - * - * ```javascript - * sprite.data.values.gold += 50; - * ``` - * - * When the value is first set, a `setdata` event is emitted from this Game Object. - * - * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. - * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. - * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. - * - * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. - * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. - * - * @method Phaser.GameObjects.Layer#setData - * @since 3.50.0 - * - * @param {(string|object)} key - The key to set the value for. Or an object of key value pairs. If an object the `data` argument is ignored. - * @param {*} [data] - The value to set for the given key. If an object is provided as the key this argument is ignored. - * - * @return {this} This GameObject. - */ - setData: function (key, value) - { - if (!this.data) - { - this.data = new DataManager(this); - } + child.addToDisplayList(this.scene.sys.displayList); + child.addToUpdateList(); - this.data.set(key, value); + child.visible = visible; + child.setActive(active); - return this; + this.add(child); + + return child; }, /** - * Increase a value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is increased from 0. - * - * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled - * before setting the value. + * Creates several Game Objects and adds them to this group. * - * If the key doesn't already exist in the Data Manager then it is created. + * If the group becomes {@link Phaser.GameObjects.Group#isFull}, no further Game Objects are created. * - * When the value is first set, a `setdata` event is emitted from this Game Object. + * Calls {@link Phaser.GameObjects.Group#createMultipleCallback} and {@link Phaser.GameObjects.Group#createCallback}. * - * @method Phaser.GameObjects.Layer#incData - * @since 3.50.0 + * @method Phaser.GameObjects.Group#createMultiple + * @since 3.0.0 * - * @param {(string|object)} key - The key to increase the value for. - * @param {*} [data] - The value to increase for the given key. + * @param {Phaser.Types.GameObjects.Group.GroupCreateConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig[]} config - Creation settings. This can be a single configuration object or an array of such objects, which will be applied in turn. * - * @return {this} This GameObject. + * @return {any[]} The newly created Game Objects. */ - incData: function (key, value) + createMultiple: function (config) { - if (!this.data) + if (this.isFull()) { - this.data = new DataManager(this); + return []; } - this.data.inc(key, value); + if (!Array.isArray(config)) + { + config = [ config ]; + } - return this; - }, + var output = []; - /** - * Toggle a boolean value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is toggled from false. - * - * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled - * before setting the value. - * - * If the key doesn't already exist in the Data Manager then it is created. - * - * When the value is first set, a `setdata` event is emitted from this Game Object. - * - * @method Phaser.GameObjects.Layer#toggleData - * @since 3.50.0 - * - * @param {(string|object)} key - The key to toggle the value for. - * - * @return {this} This GameObject. - */ - toggleData: function (key) - { - if (!this.data) + if (config[0].key) { - this.data = new DataManager(this); - } + for (var i = 0; i < config.length; i++) + { + var entries = this.createFromConfig(config[i]); - this.data.toggle(key); + output = output.concat(entries); + } + } - return this; + return output; }, /** - * Retrieves the value for the given key in this Game Objects Data Manager, or undefined if it doesn't exist. - * - * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either: - * - * ```javascript - * sprite.getData('gold'); - * ``` - * - * Or access the value directly: - * - * ```javascript - * sprite.data.values.gold; - * ``` - * - * You can also pass in an array of keys, in which case an array of values will be returned: - * - * ```javascript - * sprite.getData([ 'gold', 'armor', 'health' ]); - * ``` - * - * This approach is useful for destructuring arrays in ES6. + * A helper for {@link Phaser.GameObjects.Group#createMultiple}. * - * @method Phaser.GameObjects.Layer#getData - * @since 3.50.0 + * @method Phaser.GameObjects.Group#createFromConfig + * @since 3.0.0 * - * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys. + * @param {Phaser.Types.GameObjects.Group.GroupCreateConfig} options - Creation settings. * - * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array. + * @return {any[]} The newly created Game Objects. */ - getData: function (key) + createFromConfig: function (options) { - if (!this.data) + if (this.isFull()) { - this.data = new DataManager(this); + return []; } - return this.data.get(key); - }, - - /** - * A Layer cannot be enabled for input. - * - * This method does nothing and is kept to ensure - * the Layer has the same shape as a Game Object. - * - * @method Phaser.GameObjects.Layer#setInteractive - * @since 3.51.0 - * - * @return {this} This GameObject. - */ - setInteractive: function () - { - return this; - }, + this.classType = GetFastValue(options, 'classType', this.classType); - /** - * A Layer cannot be enabled for input. - * - * This method does nothing and is kept to ensure - * the Layer has the same shape as a Game Object. - * - * @method Phaser.GameObjects.Layer#disableInteractive - * @since 3.51.0 - * - * @return {this} This GameObject. - */ - disableInteractive: function () - { - return this; - }, + var key = GetFastValue(options, 'key', undefined); + var frame = GetFastValue(options, 'frame', null); + var visible = GetFastValue(options, 'visible', true); + var active = GetFastValue(options, 'active', true); - /** - * A Layer cannot be enabled for input. - * - * This method does nothing and is kept to ensure - * the Layer has the same shape as a Game Object. - * - * @method Phaser.GameObjects.Layer#removeInteractive - * @since 3.51.0 - * - * @return {this} This GameObject. - */ - removeInteractive: function () - { - return this; - }, + var entries = []; - /** - * This callback is invoked when this Game Object is added to a Scene. - * - * Can be overriden by custom Game Objects, but be aware of some Game Objects that - * will use this, such as Sprites, to add themselves into the Update List. - * - * You can also listen for the `ADDED_TO_SCENE` event from this Game Object. - * - * @method Phaser.GameObjects.Layer#addedToScene - * @since 3.50.0 - */ - addedToScene: function () - { - }, + // Can't do anything without at least a key + if (key === undefined) + { + return entries; + } + else + { + if (!Array.isArray(key)) + { + key = [ key ]; + } - /** - * This callback is invoked when this Game Object is removed from a Scene. - * - * Can be overriden by custom Game Objects, but be aware of some Game Objects that - * will use this, such as Sprites, to removed themselves from the Update List. - * - * You can also listen for the `REMOVED_FROM_SCENE` event from this Game Object. - * - * @method Phaser.GameObjects.Layer#removedFromScene - * @since 3.50.0 - */ - removedFromScene: function () - { - }, + if (!Array.isArray(frame)) + { + frame = [ frame ]; + } + } - /** - * To be overridden by custom GameObjects. Allows base objects to be used in a Pool. - * - * @method Phaser.GameObjects.Layer#update - * @since 3.50.0 - * - * @param {...*} [args] - args - */ - update: function () - { - }, + // Build an array of key frame pairs to loop through - /** - * Returns a JSON representation of the Game Object. - * - * @method Phaser.GameObjects.Layer#toJSON - * @since 3.50.0 - * - * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. - */ - toJSON: function () - { - return ComponentsToJSON(this); - }, + var repeat = GetFastValue(options, 'repeat', 0); + var randomKey = GetFastValue(options, 'randomKey', false); + var randomFrame = GetFastValue(options, 'randomFrame', false); + var yoyo = GetFastValue(options, 'yoyo', false); + var quantity = GetFastValue(options, 'quantity', false); + var frameQuantity = GetFastValue(options, 'frameQuantity', 1); + var max = GetFastValue(options, 'max', 0); - /** - * Compares the renderMask with the renderFlags to see if this Game Object will render or not. - * Also checks the Game Object against the given Cameras exclusion list. - * - * @method Phaser.GameObjects.Layer#willRender - * @since 3.50.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against this Game Object. - * - * @return {boolean} True if the Game Object should be rendered, otherwise false. - */ - willRender: function (camera) - { - return !(this.renderFlags !== 15 || this.list.length === 0 || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); - }, + // If a quantity value is set we use that to override the frameQuantity - /** - * Returns an array containing the display list index of either this Game Object, or if it has one, - * its parent Container. It then iterates up through all of the parent containers until it hits the - * root of the display list (which is index 0 in the returned array). - * - * Used internally by the InputPlugin but also useful if you wish to find out the display depth of - * this Game Object and all of its ancestors. - * - * @method Phaser.GameObjects.Layer#getIndexList - * @since 3.51.0 - * - * @return {number[]} An array of display list position indexes. - */ - getIndexList: function () - { - // eslint-disable-next-line consistent-this - var child = this; - var parent = this.parentContainer; + var range = Range(key, frame, { + max: max, + qty: (quantity) ? quantity : frameQuantity, + random: randomKey, + randomB: randomFrame, + repeat: repeat, + yoyo: yoyo + }); - var indexes = []; + if (options.createCallback) + { + this.createCallback = options.createCallback; + } - while (parent) + if (options.removeCallback) { - indexes.unshift(parent.getIndex(child)); + this.removeCallback = options.removeCallback; + } - child = parent; + for (var c = 0; c < range.length; c++) + { + var created = this.create(0, 0, range[c].a, range[c].b, visible, active); - if (!parent.parentContainer) + if (!created) { break; } - else - { - parent = parent.parentContainer; - } + + entries.push(created); } - indexes.unshift(this.displayList.getIndex(child)); + // Post-creation options (applied only to those items created in this call): - return indexes; - }, + if (HasValue(options, 'setXY')) + { + var x = GetValue(options, 'setXY.x', 0); + var y = GetValue(options, 'setXY.y', 0); + var stepX = GetValue(options, 'setXY.stepX', 0); + var stepY = GetValue(options, 'setXY.stepY', 0); - /** - * Internal method called from `List.addCallback`. - * - * @method Phaser.GameObjects.Layer#addChildCallback - * @private - * @fires Phaser.Scenes.Events#ADDED_TO_SCENE - * @fires Phaser.GameObjects.Events#ADDED_TO_SCENE - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was added to the list. - */ - addChildCallback: function (gameObject) - { - if (gameObject.displayList && gameObject.displayList !== this) + Actions.SetXY(entries, x, y, stepX, stepY); + } + + if (HasValue(options, 'setRotation')) { - gameObject.removeFromDisplayList(); + var rotation = GetValue(options, 'setRotation.value', 0); + var stepRotation = GetValue(options, 'setRotation.step', 0); + + Actions.SetRotation(entries, rotation, stepRotation); } - if (!gameObject.displayList) + if (HasValue(options, 'setScale')) { - this.queueDepthSort(); + var scaleX = GetValue(options, 'setScale.x', 1); + var scaleY = GetValue(options, 'setScale.y', scaleX); + var stepScaleX = GetValue(options, 'setScale.stepX', 0); + var stepScaleY = GetValue(options, 'setScale.stepY', 0); - gameObject.displayList = this; + Actions.SetScale(entries, scaleX, scaleY, stepScaleX, stepScaleY); + } - gameObject.emit(GameObjectEvents.ADDED_TO_SCENE, gameObject, this.scene); + if (HasValue(options, 'setOrigin')) + { + var originX = GetValue(options, 'setOrigin.x', 0.5); + var originY = GetValue(options, 'setOrigin.y', originX); + var stepOriginX = GetValue(options, 'setOrigin.stepX', 0); + var stepOriginY = GetValue(options, 'setOrigin.stepY', 0); - this.events.emit(SceneEvents.ADDED_TO_SCENE, gameObject, this.scene); + Actions.SetOrigin(entries, originX, originY, stepOriginX, stepOriginY); } - }, - /** - * Internal method called from `List.removeCallback`. - * - * @method Phaser.GameObjects.Layer#removeChildCallback - * @private - * @fires Phaser.Scenes.Events#REMOVED_FROM_SCENE - * @fires Phaser.GameObjects.Events#REMOVED_FROM_SCENE - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was removed from the list. - */ - removeChildCallback: function (gameObject) - { - this.queueDepthSort(); + if (HasValue(options, 'setAlpha')) + { + var alpha = GetValue(options, 'setAlpha.value', 1); + var stepAlpha = GetValue(options, 'setAlpha.step', 0); - gameObject.displayList = null; + Actions.SetAlpha(entries, alpha, stepAlpha); + } - gameObject.emit(GameObjectEvents.REMOVED_FROM_SCENE, gameObject, this.scene); + if (HasValue(options, 'setDepth')) + { + var depth = GetValue(options, 'setDepth.value', 0); + var stepDepth = GetValue(options, 'setDepth.step', 0); - this.events.emit(SceneEvents.REMOVED_FROM_SCENE, gameObject, this.scene); - }, + Actions.SetDepth(entries, depth, stepDepth); + } - /** - * Force a sort of the display list on the next call to depthSort. - * - * @method Phaser.GameObjects.Layer#queueDepthSort - * @since 3.50.0 - */ - queueDepthSort: function () - { - this.sortChildrenFlag = true; - }, + if (HasValue(options, 'setScrollFactor')) + { + var scrollFactorX = GetValue(options, 'setScrollFactor.x', 1); + var scrollFactorY = GetValue(options, 'setScrollFactor.y', scrollFactorX); + var stepScrollFactorX = GetValue(options, 'setScrollFactor.stepX', 0); + var stepScrollFactorY = GetValue(options, 'setScrollFactor.stepY', 0); - /** - * Immediately sorts the display list if the flag is set. - * - * @method Phaser.GameObjects.Layer#depthSort - * @since 3.50.0 - */ - depthSort: function () - { - if (this.sortChildrenFlag) + Actions.SetScrollFactor(entries, scrollFactorX, scrollFactorY, stepScrollFactorX, stepScrollFactorY); + } + + var hitArea = GetFastValue(options, 'hitArea', null); + var hitAreaCallback = GetFastValue(options, 'hitAreaCallback', null); + + if (hitArea) { - StableSort(this.list, this.sortByDepth); + Actions.SetHitArea(entries, hitArea, hitAreaCallback); + } - this.sortChildrenFlag = false; + var grid = GetFastValue(options, 'gridAlign', false); + + if (grid) + { + Actions.GridAlign(entries, grid); } - }, - /** - * Compare the depth of two Game Objects. - * - * @method Phaser.GameObjects.Layer#sortByDepth - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} childA - The first Game Object. - * @param {Phaser.GameObjects.GameObject} childB - The second Game Object. - * - * @return {number} The difference between the depths of each Game Object. - */ - sortByDepth: function (childA, childB) - { - return childA._depth - childB._depth; + if (this.createMultipleCallback) + { + this.createMultipleCallback.call(this, entries); + } + + return entries; }, /** - * Returns an array which contains all Game Objects within this Layer. - * - * This is a reference to the main list array, not a copy of it, so be careful not to modify it. + * Updates any group members, if {@link Phaser.GameObjects.Group#runChildUpdate} is enabled. * - * @method Phaser.GameObjects.Layer#getChildren - * @since 3.50.0 + * @method Phaser.GameObjects.Group#preUpdate + * @since 3.0.0 * - * @return {Phaser.GameObjects.GameObject[]} The group members. + * @param {number} time - The current timestamp. + * @param {number} delta - The delta time elapsed since the last frame. */ - getChildren: function () + preUpdate: function (time, delta) { - return this.list; + if (!this.runChildUpdate || this.children.size === 0) + { + return; + } + + // Because a Group child may mess with the length of the Group during its update + var temp = this.children.entries.slice(); + + for (var i = 0; i < temp.length; i++) + { + var item = temp[i]; + + if (item.active) + { + item.update(time, delta); + } + } }, /** - * Destroys this Layer removing it from the Display List and Update List and - * severing all ties to parent resources. + * Adds a Game Object to this group. * - * Also destroys all children of this Layer. If you do not wish for the - * children to be destroyed, you should move them from this Layer first. + * Calls {@link Phaser.GameObjects.Group#createCallback}. * - * Use this to remove this Layer from your game if you don't ever plan to use it again. - * As long as no reference to it exists within your own code it should become free for - * garbage collection by the browser. + * @method Phaser.GameObjects.Group#add + * @since 3.0.0 * - * If you just want to temporarily disable an object then look at using the - * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected. + * @param {Phaser.GameObjects.GameObject} child - The Game Object to add. + * @param {boolean} [addToScene=false] - Also add the Game Object to the scene. * - * @method Phaser.GameObjects.Layer#destroy - * @fires Phaser.GameObjects.Events#DESTROY - * @since 3.50.0 + * @return {this} This Group object. */ - destroy: function () + add: function (child, addToScene) { - // This Game Object has already been destroyed - if (!this.scene || this.ignoreDestroy) - { - return; - } - - this.emit(GameObjectEvents.DESTROY, this); - - var i = this.list.length; + if (addToScene === undefined) { addToScene = false; } - while (i--) + if (this.isFull()) { - this.list[i].destroy(); + return this; } - this.removeAllListeners(); - - this.resetPostPipeline(true); - - if (this.displayList) - { - this.displayList.remove(this, true); - - this.displayList.queueDepthSort(); - } + this.children.set(child); - if (this.data) + if (this.internalCreateCallback) { - this.data.destroy(); - - this.data = undefined; + this.internalCreateCallback.call(this, child); } - this.active = false; - this.visible = false; - - this.list = undefined; - this.scene = undefined; - this.displayList = undefined; - this.systems = undefined; - this.events = undefined; - } - -}); - -module.exports = Layer; - - -/***/ }), -/* 220 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(15); -var GravityWell = __webpack_require__(450); -var List = __webpack_require__(110); -var ParticleEmitter = __webpack_require__(452); -var Render = __webpack_require__(1075); - -/** - * @classdesc - * A Particle Emitter Manager creates and controls {@link Phaser.GameObjects.Particles.ParticleEmitter Particle Emitters} and {@link Phaser.GameObjects.Particles.GravityWell Gravity Wells}. - * - * @class ParticleEmitterManager - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects.Particles - * @constructor - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - The Scene to which this Emitter Manager belongs. - * @param {string} texture - The key of the Texture this Emitter Manager will use to render particles, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Emitter Manager will use to render particles. - * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig|Phaser.Types.GameObjects.Particles.ParticleEmitterConfig[]} [emitters] - Configuration settings for one or more emitters to create. - */ -var ParticleEmitterManager = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Depth, - Components.Mask, - Components.Pipeline, - Components.Transform, - Components.Visible, - Render - ], - - initialize: - - // frame is optional and can contain the emitters array or object if skipped - function ParticleEmitterManager (scene, texture, frame, emitters) - { - GameObject.call(this, scene, 'ParticleEmitterManager'); - - /** - * The blend mode applied to all emitters and particles. - * - * @name Phaser.GameObjects.Particles.ParticleEmitterManager#blendMode - * @type {number} - * @default -1 - * @private - * @since 3.0.0 - */ - this.blendMode = -1; - - /** - * The time scale applied to all emitters and particles, affecting flow rate, lifespan, and movement. - * Values larger than 1 are faster than normal. - * This is multiplied with any timeScale set on each individual emitter. - * - * @name Phaser.GameObjects.Particles.ParticleEmitterManager#timeScale - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.timeScale = 1; - - /** - * The texture used to render this Emitter Manager's particles. - * - * @name Phaser.GameObjects.Particles.ParticleEmitterManager#texture - * @type {Phaser.Textures.Texture} - * @default null - * @since 3.0.0 - */ - this.texture = null; - - /** - * The texture frame used to render this Emitter Manager's particles. - * - * @name Phaser.GameObjects.Particles.ParticleEmitterManager#frame - * @type {Phaser.Textures.Frame} - * @default null - * @since 3.0.0 - */ - this.frame = null; - - /** - * Names of this Emitter Manager's texture frames. - * - * @name Phaser.GameObjects.Particles.ParticleEmitterManager#frameNames - * @type {string[]} - * @since 3.0.0 - */ - this.frameNames = []; - - // frame is optional and can contain the emitters array or object if skipped - if (frame !== null && (typeof frame === 'object' || Array.isArray(frame))) + if (this.createCallback) { - emitters = frame; - frame = null; + this.createCallback.call(this, child); } - this.setTexture(texture, frame); - - this.initPipeline(); - - /** - * A list of Emitters being managed by this Emitter Manager. - * - * @name Phaser.GameObjects.Particles.ParticleEmitterManager#emitters - * @type {Phaser.Structs.List.} - * @since 3.0.0 - */ - this.emitters = new List(this); - - /** - * A list of Gravity Wells being managed by this Emitter Manager. - * - * @name Phaser.GameObjects.Particles.ParticleEmitterManager#wells - * @type {Phaser.Structs.List.} - * @since 3.0.0 - */ - this.wells = new List(this); - - if (emitters) + if (addToScene) { - // An array of emitter configs? - if (!Array.isArray(emitters)) - { - emitters = [ emitters ]; - } - - for (var i = 0; i < emitters.length; i++) - { - this.createEmitter(emitters[i]); - } + child.addToDisplayList(this.scene.sys.displayList); + child.addToUpdateList(); } - }, - // Overrides Game Object method - addedToScene: function () - { - this.scene.sys.updateList.add(this); - }, + child.on(Events.DESTROY, this.remove, this); - // Overrides Game Object method - removedFromScene: function () - { - this.scene.sys.updateList.remove(this); + return this; }, /** - * Sets the texture and frame this Emitter Manager will use to render with. + * Adds several Game Objects to this group. * - * Textures are referenced by their string-based keys, as stored in the Texture Manager. + * Calls {@link Phaser.GameObjects.Group#createCallback}. * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setTexture + * @method Phaser.GameObjects.Group#addMultiple * @since 3.0.0 * - * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|number)} [frame] - The name or index of the frame within the Texture. + * @param {Phaser.GameObjects.GameObject[]} children - The Game Objects to add. + * @param {boolean} [addToScene=false] - Also add the Game Objects to the scene. * - * @return {this} This Emitter Manager. + * @return {this} This group. */ - setTexture: function (key, frame) + addMultiple: function (children, addToScene) { - this.texture = this.scene.sys.textures.get(key); + if (addToScene === undefined) { addToScene = false; } - return this.setFrame(frame); + if (Array.isArray(children)) + { + for (var i = 0; i < children.length; i++) + { + this.add(children[i], addToScene); + } + } + + return this; }, /** - * Sets the frame this Emitter Manager will use to render with. - * - * The Frame has to belong to the current Texture being used. + * Removes a member of this Group and optionally removes it from the Scene and / or destroys it. * - * It can be either a string or an index. + * Calls {@link Phaser.GameObjects.Group#removeCallback}. * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setFrame + * @method Phaser.GameObjects.Group#remove * @since 3.0.0 * - * @param {(string|number)} [frame] - The name or index of the frame within the Texture. + * @param {Phaser.GameObjects.GameObject} child - The Game Object to remove. + * @param {boolean} [removeFromScene=false] - Optionally remove the Group member from the Scene it belongs to. + * @param {boolean} [destroyChild=false] - Optionally call destroy on the removed Group member. * - * @return {this} This Emitter Manager. + * @return {this} This Group object. */ - setFrame: function (frame) + remove: function (child, removeFromScene, destroyChild) { - this.frame = this.texture.get(frame); + if (removeFromScene === undefined) { removeFromScene = false; } + if (destroyChild === undefined) { destroyChild = false; } - var frames = this.texture.getFramesFromTextureSource(this.frame.sourceIndex); + if (!this.children.contains(child)) + { + return this; + } - var names = []; + this.children.delete(child); - frames.forEach(function (sourceFrame) + if (this.internalRemoveCallback) { - names.push(sourceFrame.name); - }); + this.internalRemoveCallback.call(this, child); + } + + if (this.removeCallback) + { + this.removeCallback.call(this, child); + } - this.frameNames = names; + child.off(Events.DESTROY, this.remove, this); - this.defaultFrame = this.frame; + if (destroyChild) + { + child.destroy(); + } + else if (removeFromScene) + { + child.removeFromDisplayList(); + child.removeFromUpdateList(); + } return this; }, /** - * Assigns texture frames to an emitter. + * Removes all members of this Group and optionally removes them from the Scene and / or destroys them. + * + * Does not call {@link Phaser.GameObjects.Group#removeCallback}. * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setEmitterFrames + * @method Phaser.GameObjects.Group#clear * @since 3.0.0 * - * @param {(Phaser.Textures.Frame|Phaser.Textures.Frame[])} frames - The texture frames. - * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The particle emitter to modify. + * @param {boolean} [removeFromScene=false] - Optionally remove each Group member from the Scene. + * @param {boolean} [destroyChild=false] - Optionally call destroy on the removed Group members. * - * @return {this} This Emitter Manager. + * @return {this} This group. */ - setEmitterFrames: function (frames, emitter) + clear: function (removeFromScene, destroyChild) { - if (!Array.isArray(frames)) - { - frames = [ frames ]; - } - - var out = emitter.frames; + if (removeFromScene === undefined) { removeFromScene = false; } + if (destroyChild === undefined) { destroyChild = false; } - out.length = 0; + var children = this.children; - for (var i = 0; i < frames.length; i++) + for (var i = 0; i < children.size; i++) { - var frame = frames[i]; + var gameObject = children.entries[i]; + + gameObject.off(Events.DESTROY, this.remove, this); - if (this.frameNames.indexOf(frame) !== -1) + if (destroyChild) + { + gameObject.destroy(); + } + else if (removeFromScene) { - out.push(this.texture.get(frame)); + gameObject.removeFromDisplayList(); + gameObject.removeFromUpdateList(); } } - if (out.length > 0) - { - emitter.defaultFrame = out[0]; - } - else - { - emitter.defaultFrame = this.defaultFrame; - } + this.children.clear(); return this; }, /** - * Adds an existing Particle Emitter to this Emitter Manager. + * Tests if a Game Object is a member of this group. * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#addEmitter + * @method Phaser.GameObjects.Group#contains * @since 3.0.0 * - * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The Particle Emitter to add to this Emitter Manager. + * @param {Phaser.GameObjects.GameObject} child - A Game Object. * - * @return {Phaser.GameObjects.Particles.ParticleEmitter} The Particle Emitter that was added to this Emitter Manager. + * @return {boolean} True if the Game Object is a member of this group. */ - addEmitter: function (emitter) + contains: function (child) { - return this.emitters.add(emitter); + return this.children.contains(child); }, /** - * Creates a new Particle Emitter object, adds it to this Emitter Manager and returns a reference to it. + * All members of the group. * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#createEmitter + * @method Phaser.GameObjects.Group#getChildren * @since 3.0.0 * - * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig} config - Configuration settings for the Particle Emitter to create. - * - * @return {Phaser.GameObjects.Particles.ParticleEmitter} The Particle Emitter that was created. + * @return {Phaser.GameObjects.GameObject[]} The group members. */ - createEmitter: function (config) + getChildren: function () { - return this.addEmitter(new ParticleEmitter(this, config)); + return this.children.entries; }, /** - * Removes a Particle Emitter from this Emitter Manager, if the Emitter belongs to this Manager. - * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#removeEmitter - * @since 3.22.0 + * The number of members of the group. * - * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter + * @method Phaser.GameObjects.Group#getLength + * @since 3.0.0 * - * @return {?Phaser.GameObjects.Particles.ParticleEmitter} The Particle Emitter if it was removed or null if it was not. + * @return {number} */ - removeEmitter: function (emitter) + getLength: function () { - return this.emitters.remove(emitter, true); + return this.children.size; }, /** - * Adds an existing Gravity Well object to this Emitter Manager. - * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#addGravityWell - * @since 3.0.0 + * Returns all children in this Group that match the given criteria based on the `property` and `value` arguments. * - * @param {Phaser.GameObjects.Particles.GravityWell} well - The Gravity Well to add to this Emitter Manager. + * For example: `getMatching('visible', true)` would return only children that have their `visible` property set. * - * @return {Phaser.GameObjects.Particles.GravityWell} The Gravity Well that was added to this Emitter Manager. - */ - addGravityWell: function (well) - { - return this.wells.add(well); - }, - - /** - * Creates a new Gravity Well, adds it to this Emitter Manager and returns a reference to it. + * Optionally, you can specify a start and end index. For example if the Group has 100 elements, + * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only + * the first 50. * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#createGravityWell - * @since 3.0.0 + * @method Phaser.GameObjects.Group#getMatching + * @since 3.50.0 * - * @param {Phaser.Types.GameObjects.Particles.GravityWellConfig} config - Configuration settings for the Gravity Well to create. + * @param {string} [property] - The property to test on each array element. + * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. + * @param {number} [startIndex] - An optional start index to search from. + * @param {number} [endIndex] - An optional end index to search to. * - * @return {Phaser.GameObjects.Particles.GravityWell} The Gravity Well that was created. + * @return {any[]} An array of matching Group members. The array will be empty if nothing matched. */ - createGravityWell: function (config) + getMatching: function (property, value, startIndex, endIndex) { - return this.addGravityWell(new GravityWell(config)); + return GetAll(this.children.entries, property, value, startIndex, endIndex); }, /** - * Emits particles from each active emitter. + * Scans the Group, from top to bottom, for the first member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument, + * assigns `x` and `y`, and returns the member. * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#emitParticle + * If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`. + * Unless a new member is created, `key`, `frame`, and `visible` are ignored. + * + * @method Phaser.GameObjects.Group#getFirst * @since 3.0.0 * - * @param {number} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. - * @param {number} [x] - The x-coordinate to to emit particles from. The default is the x-coordinate of the emitter's current location. - * @param {number} [y] - The y-coordinate to to emit particles from. The default is the y-coordinate of the emitter's current location. + * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. + * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. + * @param {number} [x] - The horizontal position of the Game Object in the world. + * @param {number} [y] - The vertical position of the Game Object in the world. + * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * - * @return {this} This Emitter Manager. + * @return {?any} The first matching group member, or a newly created member, or null. */ - emitParticle: function (count, x, y) + getFirst: function (state, createIfNull, x, y, key, frame, visible) { - var emitters = this.emitters.list; - - for (var i = 0; i < emitters.length; i++) - { - var emitter = emitters[i]; - - if (emitter.active) - { - emitter.emitParticle(count, x, y); - } - } - - return this; + return this.getHandler(true, 1, state, createIfNull, x, y, key, frame, visible); }, /** - * Emits particles from each active emitter. + * Scans the Group, from top to bottom, for the nth member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument, + * assigns `x` and `y`, and returns the member. * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#emitParticleAt - * @since 3.0.0 + * If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`. + * Unless a new member is created, `key`, `frame`, and `visible` are ignored. * - * @param {number} [x] - The x-coordinate to to emit particles from. The default is the x-coordinate of the emitter's current location. - * @param {number} [y] - The y-coordinate to to emit particles from. The default is the y-coordinate of the emitter's current location. - * @param {number} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. + * @method Phaser.GameObjects.Group#getFirstNth + * @since 3.6.0 + * + * @param {number} nth - The nth matching Group member to search for. + * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. + * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. + * @param {number} [x] - The horizontal position of the Game Object in the world. + * @param {number} [y] - The vertical position of the Game Object in the world. + * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * - * @return {this} This Emitter Manager. + * @return {?any} The first matching group member, or a newly created member, or null. */ - emitParticleAt: function (x, y, count) + getFirstNth: function (nth, state, createIfNull, x, y, key, frame, visible) { - return this.emitParticle(count, x, y); + return this.getHandler(true, nth, state, createIfNull, x, y, key, frame, visible); }, /** - * Pauses this Emitter Manager. + * Scans the Group for the last member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument, + * assigns `x` and `y`, and returns the member. * - * This has the effect of pausing all emitters, and all particles of those emitters, currently under its control. + * If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`. + * Unless a new member is created, `key`, `frame`, and `visible` are ignored. * - * The particles will still render, but they will not have any of their logic updated. + * @method Phaser.GameObjects.Group#getLast + * @since 3.6.0 * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#pause - * @since 3.0.0 + * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. + * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. + * @param {number} [x] - The horizontal position of the Game Object in the world. + * @param {number} [y] - The vertical position of the Game Object in the world. + * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * - * @return {this} This Emitter Manager. + * @return {?any} The first matching group member, or a newly created member, or null. */ - pause: function () + getLast: function (state, createIfNull, x, y, key, frame, visible) { - this.active = false; - - return this; + return this.getHandler(false, 1, state, createIfNull, x, y, key, frame, visible); }, /** - * Resumes this Emitter Manager, should it have been previously paused. + * Scans the Group for the last nth member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument, + * assigns `x` and `y`, and returns the member. * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#resume - * @since 3.0.0 + * If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`. + * Unless a new member is created, `key`, `frame`, and `visible` are ignored. * - * @return {this} This Emitter Manager. - */ - resume: function () - { - this.active = true; - - return this; - }, - - /** - * Gets all active particle processors (gravity wells). + * @method Phaser.GameObjects.Group#getLastNth + * @since 3.6.0 * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#getProcessors - * @since 3.0.0 + * @param {number} nth - The nth matching Group member to search for. + * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. + * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. + * @param {number} [x] - The horizontal position of the Game Object in the world. + * @param {number} [y] - The vertical position of the Game Object in the world. + * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * - * @return {Phaser.GameObjects.Particles.GravityWell[]} - The active gravity wells. + * @return {?any} The first matching group member, or a newly created member, or null. */ - getProcessors: function () + getLastNth: function (nth, state, createIfNull, x, y, key, frame, visible) { - return this.wells.getAll('active', true); + return this.getHandler(false, nth, state, createIfNull, x, y, key, frame, visible); }, /** - * Updates all active emitters. + * Scans the group for the last member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument, + * assigns `x` and `y`, and returns the member. * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#preUpdate - * @since 3.0.0 - * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. - */ - preUpdate: function (time, delta) - { - // Scale the delta - delta *= this.timeScale; - - var emitters = this.emitters.list; - - for (var i = 0; i < emitters.length; i++) - { - var emitter = emitters[i]; - - if (emitter.active) - { - emitter.preUpdate(time, delta); - } - } - }, - - /** - * A NOOP method so you can pass an EmitterManager to a Container. - * Calling this method will do nothing. It is intentionally empty. + * If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`. + * Unless a new member is created, `key`, `frame`, and `visible` are ignored. * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setAlpha + * @method Phaser.GameObjects.Group#getHandler * @private - * @since 3.10.0 - */ - setAlpha: function () - { - }, - - /** - * A NOOP method so you can pass an EmitterManager to a Container. - * Calling this method will do nothing. It is intentionally empty. + * @since 3.6.0 * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setScrollFactor - * @private - * @since 3.10.0 - */ - setScrollFactor: function () - { - }, - - /** - * A NOOP method so you can pass an EmitterManager to a Container. - * Calling this method will do nothing. It is intentionally empty. + * @param {boolean} forwards - Search front to back or back to front? + * @param {number} nth - Stop matching after nth successful matches. + * @param {boolean} [state=false] - The {@link Phaser.GameObjects.GameObject#active} value to match. + * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. + * @param {number} [x] - The horizontal position of the Game Object in the world. + * @param {number} [y] - The vertical position of the Game Object in the world. + * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * - * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setBlendMode - * @private - * @since 3.15.0 + * @return {?any} The first matching group member, or a newly created member, or null. */ - setBlendMode: function () - { - } - -}); - -module.exports = ParticleEmitterManager; - - -/***/ }), -/* 221 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var BlendModes = __webpack_require__(35); -var Camera = __webpack_require__(133); -var CanvasPool = __webpack_require__(31); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var CONST = __webpack_require__(33); -var Frame = __webpack_require__(109); -var GameObject = __webpack_require__(15); -var NOOP = __webpack_require__(1); -var PIPELINE_CONST = __webpack_require__(92); -var Render = __webpack_require__(1079); -var RenderTarget = __webpack_require__(141); -var Utils = __webpack_require__(12); -var UUID = __webpack_require__(222); - -/** - * @classdesc - * A Render Texture. - * - * A Render Texture is a special texture that allows any number of Game Objects to be drawn to it. You can take many complex objects and - * draw them all to this one texture, which can they be used as the texture for other Game Object's. It's a way to generate dynamic - * textures at run-time that are WebGL friendly and don't invoke expensive GPU uploads. - * - * Note that under WebGL a FrameBuffer, which is what the Render Texture uses internally, cannot be anti-aliased. This means - * that when drawing objects such as Shapes to a Render Texture they will appear to be drawn with no aliasing, however this - * is a technical limitation of WebGL. To get around it, create your shape as a texture in an art package, then draw that - * to the Render Texture. - * - * @class RenderTexture - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor - * @since 3.2.0 - * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.ComputedSize - * @extends Phaser.GameObjects.Components.Crop - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [width=32] - The width of the Render Texture. - * @param {number} [height=32] - The height of the Render Texture. - * @param {string} [key] - The texture key to make the RenderTexture from. - * @param {string} [frame] - The frame to make the RenderTexture from. - */ -var RenderTexture = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.ComputedSize, - Components.Crop, - Components.Depth, - Components.Flip, - Components.GetBounds, - Components.Mask, - Components.Origin, - Components.Pipeline, - Components.ScrollFactor, - Components.Tint, - Components.Transform, - Components.Visible, - Render - ], - - initialize: - - function RenderTexture (scene, x, y, width, height, key, frame) + getHandler: function (forwards, nth, state, createIfNull, x, y, key, frame, visible) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = 32; } - if (height === undefined) { height = 32; } - - GameObject.call(this, scene, 'RenderTexture'); - - /** - * A reference to either the Canvas or WebGL Renderer that the Game instance is using. - * - * @name Phaser.GameObjects.RenderTexture#renderer - * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} - * @since 3.2.0 - */ - this.renderer = scene.sys.renderer; - - /** - * A reference to the Texture Manager. - * - * @name Phaser.GameObjects.RenderTexture#textureManager - * @type {Phaser.Textures.TextureManager} - * @since 3.12.0 - */ - this.textureManager = scene.sys.textures; - - /** - * The tint of the Render Texture when rendered. - * - * @name Phaser.GameObjects.RenderTexture#globalTint - * @type {number} - * @default 0xffffff - * @since 3.2.0 - */ - this.globalTint = 0xffffff; - - /** - * The alpha of the Render Texture when rendered. - * - * @name Phaser.GameObjects.RenderTexture#globalAlpha - * @type {number} - * @default 1 - * @since 3.2.0 - */ - this.globalAlpha = 1; - - /** - * The HTML Canvas Element that the Render Texture is drawing to when using the Canvas Renderer. - * - * @name Phaser.GameObjects.RenderTexture#canvas - * @type {HTMLCanvasElement} - * @since 3.2.0 - */ - this.canvas = null; - - /** - * Is this Render Texture dirty or not? If not it won't spend time clearing or filling itself. - * - * @name Phaser.GameObjects.RenderTexture#dirty - * @type {boolean} - * @since 3.12.0 - */ - this.dirty = false; - - /** - * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. - * - * @name Phaser.GameObjects.RenderTexture#_crop - * @type {object} - * @private - * @since 3.12.0 - */ - this._crop = this.resetCropObject(); - - /** - * The Texture corresponding to this Render Texture. - * - * @name Phaser.GameObjects.RenderTexture#texture - * @type {Phaser.Textures.Texture} - * @since 3.12.0 - */ - this.texture = null; + if (state === undefined) { state = false; } + if (createIfNull === undefined) { createIfNull = false; } - /** - * The Frame corresponding to this Render Texture. - * - * @name Phaser.GameObjects.RenderTexture#frame - * @type {Phaser.Textures.Frame} - * @since 3.12.0 - */ - this.frame = null; + var gameObject; - /** - * Internal saved texture flag. - * - * @name Phaser.GameObjects.RenderTexture#_saved - * @type {boolean} - * @private - * @since 3.12.0 - */ - this._saved = false; + var i; + var total = 0; + var children = this.children.entries; - if (key === undefined) + if (forwards) { - this.canvas = CanvasPool.create2D(this, width, height); + for (i = 0; i < children.length; i++) + { + gameObject = children[i]; - // Create a new Texture for this RenderTexture object - this.texture = scene.sys.textures.addCanvas(UUID(), this.canvas); + if (gameObject.active === state) + { + total++; - // Get the frame - this.frame = this.texture.get(); + if (total === nth) + { + break; + } + } + else + { + gameObject = null; + } + } } else { - this.texture = scene.sys.textures.get(key); - - // Get the frame - this.frame = this.texture.get(frame); - - this.canvas = this.frame.source.image; - this._saved = true; + for (i = children.length - 1; i >= 0; i--) + { + gameObject = children[i]; - this.dirty = true; + if (gameObject.active === state) + { + total++; - this.width = this.frame.cutWidth; - this.height = this.frame.cutHeight; + if (total === nth) + { + break; + } + } + else + { + gameObject = null; + } + } } - /** - * A reference to the Rendering Context belonging to the Canvas Element this Render Texture is drawing to. - * - * @name Phaser.GameObjects.RenderTexture#context - * @type {CanvasRenderingContext2D} - * @since 3.2.0 - */ - this.context = this.canvas.getContext('2d'); - - /** - * Internal erase mode flag. - * - * @name Phaser.GameObjects.RenderTexture#_eraseMode - * @type {boolean} - * @private - * @since 3.16.0 - */ - this._eraseMode = false; - - /** - * An internal Camera that can be used to move around the Render Texture. - * Control it just like you would any Scene Camera. The difference is that it only impacts the placement of what - * is drawn to the Render Texture. You can scroll, zoom and rotate this Camera. - * - * @name Phaser.GameObjects.RenderTexture#camera - * @type {Phaser.Cameras.Scene2D.BaseCamera} - * @since 3.12.0 - */ - this.camera = new Camera(0, 0, width, height); - - /** - * The Render Target that belongs to this Render Texture. - * - * A Render Target encapsulates a framebuffer and texture for the WebGL Renderer. - * - * This property remains `null` under Canvas. - * - * @name Phaser.GameObjects.RenderTexture#renderTarget - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @since 3.50.0 - */ - this.renderTarget = null; + if (gameObject) + { + if (typeof(x) === 'number') + { + gameObject.x = x; + } - var renderer = this.renderer; + if (typeof(y) === 'number') + { + gameObject.y = y; + } - if (!renderer) - { - this.drawGameObject = NOOP; + return gameObject; } - else if (renderer.type === CONST.WEBGL) - { - this.drawGameObject = this.batchGameObjectWebGL; - this.renderTarget = new RenderTarget(renderer, width, height, 1, 0, false); - } - else if (renderer.type === CONST.CANVAS) + // Got this far? We need to create or bail + if (createIfNull) { - this.drawGameObject = this.batchGameObjectCanvas; + return this.create(x, y, key, frame, visible); } - - this.camera.setScene(scene); - - this.setPosition(x, y); - - if (key === undefined) + else { - this.setSize(width, height); + return null; } - - this.setOrigin(0, 0); - - this.initPipeline(PIPELINE_CONST.SINGLE_PIPELINE); }, /** - * Sets the size of this Game Object. + * Scans the group for the first member that has an {@link Phaser.GameObjects.GameObject#active} state set to `false`, + * assigns `x` and `y`, and returns the member. * - * @method Phaser.GameObjects.RenderTexture#setSize + * If no inactive member is found and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`. + * The new Game Object will have its active state set to `true`. + * Unless a new member is created, `key`, `frame`, and `visible` are ignored. + * + * @method Phaser.GameObjects.Group#get * @since 3.0.0 * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. + * @param {number} [x] - The horizontal position of the Game Object in the world. + * @param {number} [y] - The vertical position of the Game Object in the world. + * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * - * @return {this} This Game Object instance. + * @return {?any} The first inactive group member, or a newly created member, or null. */ - setSize: function (width, height) + get: function (x, y, key, frame, visible) { - return this.resize(width, height); + return this.getFirst(false, true, x, y, key, frame, visible); }, /** - * Resizes the Render Texture to the new dimensions given. + * Scans the group for the first member that has an {@link Phaser.GameObjects.GameObject#active} state set to `true`, + * assigns `x` and `y`, and returns the member. * - * If Render Texture was created from specific frame, only the size of the frame will be changed. The size of the source - * texture will not change. + * If no active member is found and `createIfNull` is `true` and the group isn't full then it will create a new one using `x`, `y`, `key`, `frame`, and `visible`. + * Unless a new member is created, `key`, `frame`, and `visible` are ignored. * - * If Render Texture was not created from specific frame, the following will happen: + * @method Phaser.GameObjects.Group#getFirstAlive + * @since 3.0.0 * - * In WebGL it will destroy and then re-create the frame buffer being used by the Render Texture. - * In Canvas it will resize the underlying canvas element. + * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. + * @param {number} [x] - The horizontal position of the Game Object in the world. + * @param {number} [y] - The vertical position of the Game Object in the world. + * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * - * Both approaches will erase everything currently drawn to the Render Texture. + * @return {any} The first active group member, or a newly created member, or null. + */ + getFirstAlive: function (createIfNull, x, y, key, frame, visible) + { + return this.getFirst(true, createIfNull, x, y, key, frame, visible); + }, + + /** + * Scans the group for the first member that has an {@link Phaser.GameObjects.GameObject#active} state set to `false`, + * assigns `x` and `y`, and returns the member. * - * If the dimensions given are the same as those already being used, calling this method will do nothing. + * If no inactive member is found and `createIfNull` is `true` and the group isn't full then it will create a new one using `x`, `y`, `key`, `frame`, and `visible`. + * The new Game Object will have an active state set to `true`. + * Unless a new member is created, `key`, `frame`, and `visible` are ignored. * - * @method Phaser.GameObjects.RenderTexture#resize - * @since 3.10.0 + * @method Phaser.GameObjects.Group#getFirstDead + * @since 3.0.0 * - * @param {number} width - The new width of the Render Texture. - * @param {number} [height=width] - The new height of the Render Texture. If not specified, will be set the same as the `width`. + * @param {boolean} [createIfNull=false] - Create a new Game Object if no matching members are found, using the following arguments. + * @param {number} [x] - The horizontal position of the Game Object in the world. + * @param {number} [y] - The vertical position of the Game Object in the world. + * @param {string} [key=defaultKey] - The texture key assigned to a new Game Object (if one is created). + * @param {(string|number)} [frame=defaultFrame] - A texture frame assigned to a new Game Object (if one is created). + * @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). * - * @return {this} This Render Texture. + * @return {any} The first inactive group member, or a newly created member, or null. */ - resize: function (width, height) + getFirstDead: function (createIfNull, x, y, key, frame, visible) { - if (height === undefined) { height = width; } - - var frame = this.frame; - - if (width !== this.width || height !== this.height) - { - if (frame.name === '__BASE') - { - // Resize the texture - - this.canvas.width = width; - this.canvas.height = height; - - this.texture.width = width; - this.texture.height = height; - - var renderTarget = this.renderTarget; - - if (renderTarget) - { - renderTarget.resize(width, height); - - frame.glTexture = renderTarget.texture; - - frame.source.isRenderTexture = true; - frame.source.isGLTexture = true; - frame.source.glTexture = renderTarget.texture; - } - - this.camera.setSize(width, height); + return this.getFirst(false, createIfNull, x, y, key, frame, visible); + }, - frame.source.width = width; - frame.source.height = height; + /** + * {@link Phaser.GameObjects.Components.Animation#play Plays} an animation for all members of this group. + * + * @method Phaser.GameObjects.Group#playAnimation + * @since 3.0.0 + * + * @param {string} key - The string-based key of the animation to play. + * @param {string} [startFrame=0] - Optionally start the animation playing from this frame index. + * + * @return {this} This Group object. + */ + playAnimation: function (key, startFrame) + { + Actions.PlayAnimation(this.children.entries, key, startFrame); - frame.setSize(width, height); + return this; + }, - this.width = width; - this.height = height; - } + /** + * Whether this group's size at its {@link Phaser.GameObjects.Group#maxSize maximum}. + * + * @method Phaser.GameObjects.Group#isFull + * @since 3.0.0 + * + * @return {boolean} True if the number of members equals {@link Phaser.GameObjects.Group#maxSize}. + */ + isFull: function () + { + if (this.maxSize === -1) + { + return false; } else { - // Resize the frame + return (this.children.size >= this.maxSize); + } + }, - var baseFrame = this.texture.getSourceImage(); + /** + * Counts the number of active (or inactive) group members. + * + * @method Phaser.GameObjects.Group#countActive + * @since 3.0.0 + * + * @param {boolean} [value=true] - Count active (true) or inactive (false) group members. + * + * @return {number} The number of group members with an active state matching the `active` argument. + */ + countActive: function (value) + { + if (value === undefined) { value = true; } - if (frame.cutX + width > baseFrame.width) - { - width = baseFrame.width - frame.cutX; - } + var total = 0; - if (frame.cutY + height > baseFrame.height) + for (var i = 0; i < this.children.size; i++) + { + if (this.children.entries[i].active === value) { - height = baseFrame.height - frame.cutY; + total++; } - - frame.setSize(width, height, frame.cutX, frame.cutY); } - this.updateDisplayOrigin(); + return total; + }, - var input = this.input; + /** + * Counts the number of in-use (active) group members. + * + * @method Phaser.GameObjects.Group#getTotalUsed + * @since 3.0.0 + * + * @return {number} The number of group members with an active state of true. + */ + getTotalUsed: function () + { + return this.countActive(); + }, - if (input && !input.customHitArea) - { - input.hitArea.width = width; - input.hitArea.height = height; - } + /** + * The difference of {@link Phaser.GameObjects.Group#maxSize} and the number of active group members. + * + * This represents the number of group members that could be created or reactivated before reaching the size limit. + * + * @method Phaser.GameObjects.Group#getTotalFree + * @since 3.0.0 + * + * @return {number} maxSize minus the number of active group numbers; or a large number (if maxSize is -1). + */ + getTotalFree: function () + { + var used = this.getTotalUsed(); + var capacity = (this.maxSize === -1) ? 999999999999 : this.maxSize; - return this; + return (capacity - used); }, /** - * Set the tint to use when rendering this Render Texture. + * Sets the `active` property of this Group. + * When active, this Group runs its `preUpdate` method. * - * @method Phaser.GameObjects.RenderTexture#setGlobalTint - * @since 3.2.0 + * @method Phaser.GameObjects.Group#setActive + * @since 3.24.0 * - * @param {number} tint - The tint value. + * @param {boolean} value - True if this Group should be set as active, false if not. * - * @return {this} This Render Texture. + * @return {this} This Group object. */ - setGlobalTint: function (tint) + setActive: function (value) { - this.globalTint = tint; + this.active = value; return this; }, /** - * Set the alpha to use when rendering this Render Texture. + * Sets the `name` property of this Group. + * The `name` property is not populated by Phaser and is presented for your own use. * - * @method Phaser.GameObjects.RenderTexture#setGlobalAlpha - * @since 3.2.0 + * @method Phaser.GameObjects.Group#setName + * @since 3.24.0 * - * @param {number} alpha - The alpha value. + * @param {string} value - The name to be given to this Group. * - * @return {this} This Render Texture. + * @return {this} This Group object. */ - setGlobalAlpha: function (alpha) + setName: function (value) { - this.globalAlpha = alpha; + this.name = value; return this; }, /** - * Stores a copy of this Render Texture in the Texture Manager using the given key. - * - * After doing this, any texture based Game Object, such as a Sprite, can use the contents of this - * Render Texture by using the texture key: - * - * ```javascript - * var rt = this.add.renderTexture(0, 0, 128, 128); + * Sets the property as defined in `key` of each group member to the given value. * - * // Draw something to the Render Texture + * @method Phaser.GameObjects.Group#propertyValueSet + * @since 3.21.0 * - * rt.saveTexture('doodle'); + * @param {string} key - The property to be updated. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * - * this.add.image(400, 300, 'doodle'); - * ``` + * @return {this} This Group object. + */ + propertyValueSet: function (key, value, step, index, direction) + { + Actions.PropertyValueSet(this.children.entries, key, value, step, index, direction); + + return this; + }, + + /** + * Adds the given value to the property as defined in `key` of each group member. * - * Updating the contents of this Render Texture will automatically update _any_ Game Object - * that is using it as a texture. Calling `saveTexture` again will not save another copy - * of the same texture, it will just rename the key of the existing copy. + * @method Phaser.GameObjects.Group#propertyValueInc + * @since 3.21.0 * - * By default it will create a single base texture. You can add frames to the texture - * by using the `Texture.add` method. After doing this, you can then allow Game Objects - * to use a specific frame from a Render Texture. + * @param {string} key - The property to be updated. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. * - * If you destroy this Render Texture, any Game Object using it via the Texture Manager will - * stop rendering. Ensure you remove the texture from the Texture Manager and any Game Objects - * using it first, before destroying this Render Texture. + * @return {this} This Group object. + */ + propertyValueInc: function (key, value, step, index, direction) + { + Actions.PropertyValueInc(this.children.entries, key, value, step, index, direction); + + return this; + }, + + /** + * Sets the x of each group member. * - * @method Phaser.GameObjects.RenderTexture#saveTexture - * @since 3.12.0 + * @method Phaser.GameObjects.Group#setX + * @since 3.21.0 * - * @param {string} key - The unique key to store the texture as within the global Texture Manager. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. * - * @return {Phaser.Textures.Texture} The Texture that was saved. + * @return {this} This Group object. */ - saveTexture: function (key) + setX: function (value, step) { - this.textureManager.renameTexture(this.texture.key, key); - - this._saved = true; + Actions.SetX(this.children.entries, value, step); - return this.texture; + return this; }, /** - * Fills the Render Texture with the given color. + * Sets the y of each group member. * - * @method Phaser.GameObjects.RenderTexture#fill - * @since 3.2.0 + * @method Phaser.GameObjects.Group#setY + * @since 3.21.0 * - * @param {number} rgb - The color to fill the Render Texture with. - * @param {number} [alpha=1] - The alpha value used by the fill. - * @param {number} [x=0] - The left coordinate of the fill rectangle. - * @param {number} [y=0] - The top coordinate of the fill rectangle. - * @param {number} [width=this.frame.cutWidth] - The width of the fill rectangle. - * @param {number} [height=this.frame.cutHeight] - The height of the fill rectangle. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. * - * @return {this} This Render Texture instance. + * @return {this} This Group object. */ - fill: function (rgb, alpha, x, y, width, height) + setY: function (value, step) { - var frame = this.frame; - var camera = this.camera; - var renderer = this.renderer; - - if (alpha === undefined) { alpha = 1; } - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = frame.cutWidth; } - if (height === undefined) { height = frame.cutHeight; } - - var r = (rgb >> 16 & 0xFF) / 255; - var g = (rgb >> 8 & 0xFF) / 255; - var b = (rgb & 0xFF) / 255; - - var renderTarget = this.renderTarget; - - camera.preRender(); - - if (renderTarget) - { - renderTarget.bind(true); - - var pipeline = this.pipeline; - - pipeline.manager.set(pipeline); - - var tw = renderTarget.width; - var th = renderTarget.height; - - var rw = renderer.width; - var rh = renderer.height; - - var sx = rw / tw; - var sy = rh / th; - - pipeline.drawFillRect( - x * sx, y * sy, width * sx, height * sy, - Utils.getTintFromFloats(b, g, r, 1), - alpha - ); - - renderTarget.unbind(true); - } - else - { - var ctx = this.context; - - renderer.setContext(ctx); - - ctx.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + alpha + ')'; - ctx.fillRect(x + frame.cutX, y + frame.cutY, width, height); - - renderer.setContext(); - } - - this.dirty = true; + Actions.SetY(this.children.entries, value, step); return this; }, /** - * Clears the Render Texture. + * Sets the x, y of each group member. * - * @method Phaser.GameObjects.RenderTexture#clear - * @since 3.2.0 + * @method Phaser.GameObjects.Group#setXY + * @since 3.21.0 * - * @return {this} This Render Texture instance. + * @param {number} x - The amount to set the `x` property to. + * @param {number} [y=x] - The amount to set the `y` property to. If `undefined` or `null` it uses the `x` value. + * @param {number} [stepX=0] - This is added to the `x` amount, multiplied by the iteration counter. + * @param {number} [stepY=0] - This is added to the `y` amount, multiplied by the iteration counter. + * + * @return {this} This Group object. */ - clear: function () + setXY: function (x, y, stepX, stepY) { - if (this.dirty) - { - var renderTarget = this.renderTarget; - - if (renderTarget) - { - renderTarget.clear(); - } - else - { - var ctx = this.context; + Actions.SetXY(this.children.entries, x, y, stepX, stepY); - ctx.save(); - ctx.setTransform(1, 0, 0, 1, 0, 0); - ctx.clearRect(this.frame.cutX, this.frame.cutY, this.frame.cutWidth, this.frame.cutHeight); - ctx.restore(); - } + return this; + }, - this.dirty = false; - } + /** + * Adds the given value to the x of each group member. + * + * @method Phaser.GameObjects.Group#incX + * @since 3.21.0 + * + * @param {number} value - The amount to be added to the `x` property. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. + * + * @return {this} This Group object. + */ + incX: function (value, step) + { + Actions.IncX(this.children.entries, value, step); return this; }, /** - * Draws the given object, or an array of objects, to this Render Texture using a blend mode of ERASE. - * This has the effect of erasing any filled pixels in the objects from this Render Texture. - * - * It can accept any of the following: + * Adds the given value to the y of each group member. * - * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite. - * * Tilemap Layers. - * * A Group. The contents of which will be iterated and drawn in turn. - * * A Container. The contents of which will be iterated fully, and drawn in turn. - * * A Scene's Display List. Pass in `Scene.children` to draw the whole list. - * * Another Render Texture. - * * A Texture Frame instance. - * * A string. This is used to look-up a texture from the Texture Manager. + * @method Phaser.GameObjects.Group#incY + * @since 3.21.0 * - * Note: You cannot erase a Render Texture from itself. + * @param {number} value - The amount to be added to the `y` property. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. * - * If passing in a Group or Container it will only draw children that return `true` - * when their `willRender()` method is called. I.e. a Container with 10 children, - * 5 of which have `visible=false` will only draw the 5 visible ones. + * @return {this} This Group object. + */ + incY: function (value, step) + { + Actions.IncY(this.children.entries, value, step); + + return this; + }, + + /** + * Adds the given value to the x, y of each group member. * - * If passing in an array of Game Objects it will draw them all, regardless if - * they pass a `willRender` check or not. + * @method Phaser.GameObjects.Group#incXY + * @since 3.21.0 * - * You can pass in a string in which case it will look for a texture in the Texture - * Manager matching that string, and draw the base frame. + * @param {number} x - The amount to be added to the `x` property. + * @param {number} [y=x] - The amount to be added to the `y` property. If `undefined` or `null` it uses the `x` value. + * @param {number} [stepX=0] - This is added to the `x` amount, multiplied by the iteration counter. + * @param {number} [stepY=0] - This is added to the `y` amount, multiplied by the iteration counter. * - * You can pass in the `x` and `y` coordinates to draw the objects at. The use of - * the coordinates differ based on what objects are being drawn. If the object is - * a Group, Container or Display List, the coordinates are _added_ to the positions - * of the children. For all other types of object, the coordinates are exact. + * @return {this} This Group object. + */ + incXY: function (x, y, stepX, stepY) + { + Actions.IncXY(this.children.entries, x, y, stepX, stepY); + + return this; + }, + + /** + * Iterate through the group members changing the position of each element to be that of the element that came before + * it in the array (or after it if direction = 1) * - * Calling this method causes the WebGL batch to flush, so it can write the texture - * data to the framebuffer being used internally. The batch is flushed at the end, - * after the entries have been iterated. So if you've a bunch of objects to draw, - * try and pass them in an array in one single call, rather than making lots of - * separate calls. + * The first group member position is set to x/y. * - * @method Phaser.GameObjects.RenderTexture#erase - * @since 3.16.0 + * @method Phaser.GameObjects.Group#shiftPosition + * @since 3.21.0 * - * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, other Render Texture, Texture Frame or an array of any of these. - * @param {number} [x] - The x position to draw the Frame at, or the offset applied to the object. - * @param {number} [y] - The y position to draw the Frame at, or the offset applied to the object. + * @param {number} x - The x coordinate to place the first item in the array at. + * @param {number} y - The y coordinate to place the first item in the array at. + * @param {number} [direction=0] - The iteration direction. 0 = first to last and 1 = last to first. * - * @return {this} This Render Texture instance. + * @return {this} This Group object. */ - erase: function (entries, x, y) + shiftPosition: function (x, y, direction) { - this._eraseMode = true; - - this.draw(entries, x, y, 1, 16777215); - - this._eraseMode = false; + Actions.ShiftPosition(this.children.entries, x, y, direction); return this; }, /** - * Draws the given object, or an array of objects, to this Render Texture. + * Sets the angle of each group member. * - * It can accept any of the following: + * @method Phaser.GameObjects.Group#angle + * @since 3.21.0 * - * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite. - * * Tilemap Layers. - * * A Group. The contents of which will be iterated and drawn in turn. - * * A Container. The contents of which will be iterated fully, and drawn in turn. - * * A Scene's Display List. Pass in `Scene.children` to draw the whole list. - * * Another Render Texture. - * * A Texture Frame instance. - * * A string. This is used to look-up a texture from the Texture Manager. + * @param {number} value - The amount to set the angle to, in degrees. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. * - * Note: You cannot draw a Render Texture to itself. + * @return {this} This Group object. + */ + angle: function (value, step) + { + Actions.Angle(this.children.entries, value, step); + + return this; + }, + + /** + * Sets the rotation of each group member. * - * If passing in a Group or Container it will only draw children that return `true` - * when their `willRender()` method is called. I.e. a Container with 10 children, - * 5 of which have `visible=false` will only draw the 5 visible ones. + * @method Phaser.GameObjects.Group#rotate + * @since 3.21.0 * - * If passing in an array of Game Objects it will draw them all, regardless if - * they pass a `willRender` check or not. + * @param {number} value - The amount to set the rotation to, in radians. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. * - * You can pass in a string in which case it will look for a texture in the Texture - * Manager matching that string, and draw the base frame. If you need to specify - * exactly which frame to draw then use the method `drawFrame` instead. + * @return {this} This Group object. + */ + rotate: function (value, step) + { + Actions.Rotate(this.children.entries, value, step); + + return this; + }, + + /** + * Rotates each group member around the given point by the given angle. * - * You can pass in the `x` and `y` coordinates to draw the objects at. The use of - * the coordinates differ based on what objects are being drawn. If the object is - * a Group, Container or Display List, the coordinates are _added_ to the positions - * of the children. For all other types of object, the coordinates are exact. + * @method Phaser.GameObjects.Group#rotateAround + * @since 3.21.0 * - * The `alpha` and `tint` values are only used by Texture Frames. - * Game Objects use their own alpha and tint values when being drawn. + * @param {Phaser.Types.Math.Vector2Like} point - Any object with public `x` and `y` properties. + * @param {number} angle - The angle to rotate by, in radians. * - * Calling this method causes the WebGL batch to flush, so it can write the texture - * data to the framebuffer being used internally. The batch is flushed at the end, - * after the entries have been iterated. So if you've a bunch of objects to draw, - * try and pass them in an array in one single call, rather than making lots of - * separate calls. + * @return {this} This Group object. + */ + rotateAround: function (point, angle) + { + Actions.RotateAround(this.children.entries, point, angle); + + return this; + }, + + /** + * Rotates each group member around the given point by the given angle and distance. * - * @method Phaser.GameObjects.RenderTexture#draw - * @since 3.2.0 + * @method Phaser.GameObjects.Group#rotateAroundDistance + * @since 3.21.0 * - * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, other Render Texture, Texture Frame or an array of any of these. - * @param {number} [x] - The x position to draw the Frame at, or the offset applied to the object. - * @param {number} [y] - The y position to draw the Frame at, or the offset applied to the object. - * @param {number} [alpha] - The alpha value. Only used for Texture Frames and if not specified defaults to the `globalAlpha` property. Game Objects use their own current alpha value. - * @param {number} [tint] - WebGL only. The tint color value. Only used for Texture Frames and if not specified defaults to the `globalTint` property. Game Objects use their own current tint value. + * @param {Phaser.Types.Math.Vector2Like} point - Any object with public `x` and `y` properties. + * @param {number} angle - The angle to rotate by, in radians. + * @param {number} distance - The distance from the point of rotation in pixels. * - * @return {this} This Render Texture instance. + * @return {this} This Group object. */ - draw: function (entries, x, y, alpha, tint) + rotateAroundDistance: function (point, angle, distance) { - this.beginDraw(); - this.batchDraw(entries, x, y, alpha, tint); - this.endDraw(); + Actions.RotateAroundDistance(this.children.entries, point, angle, distance); return this; }, /** - * Draws the Texture Frame to the Render Texture at the given position. - * - * Textures are referenced by their string-based keys, as stored in the Texture Manager. - * - * ```javascript - * var rt = this.add.renderTexture(0, 0, 800, 600); - * rt.drawFrame(key, frame); - * ``` + * Sets the alpha of each group member. * - * You can optionally provide a position, alpha and tint value to apply to the frame - * before it is drawn. + * @method Phaser.GameObjects.Group#setAlpha + * @since 3.21.0 * - * Calling this method will cause a batch flush, so if you've got a stack of things to draw - * in a tight loop, try using the `draw` method instead. + * @param {number} value - The amount to set the alpha to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. * - * If you need to draw a Sprite to this Render Texture, use the `draw` method instead. + * @return {this} This Group object. + */ + setAlpha: function (value, step) + { + Actions.SetAlpha(this.children.entries, value, step); + + return this; + }, + + /** + * Sets the tint of each group member. * - * @method Phaser.GameObjects.RenderTexture#drawFrame - * @since 3.12.0 + * @method Phaser.GameObjects.Group#setTint + * @since 3.21.0 * - * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|number)} [frame] - The name or index of the frame within the Texture. - * @param {number} [x=0] - The x position to draw the frame at. - * @param {number} [y=0] - The y position to draw the frame at. - * @param {number} [alpha] - The alpha to use. If not specified it uses the `globalAlpha` property. - * @param {number} [tint] - WebGL only. The tint color to use. If not specified it uses the `globalTint` property. + * @param {number} topLeft - The tint being applied to top-left corner of item. If other parameters are given no value, this tint will be applied to whole item. + * @param {number} [topRight] - The tint to be applied to top-right corner of item. + * @param {number} [bottomLeft] - The tint to be applied to the bottom-left corner of item. + * @param {number} [bottomRight] - The tint to be applied to the bottom-right corner of item. * - * @return {this} This Render Texture instance. + * @return {this} This Group object. */ - drawFrame: function (key, frame, x, y, alpha, tint) + setTint: function (topLeft, topRight, bottomLeft, bottomRight) { - this.beginDraw(); - this.batchDrawFrame(key, frame, x, y, alpha, tint); - this.endDraw(); + Actions.SetTint(this.children.entries, topLeft, topRight, bottomLeft, bottomRight); return this; }, /** - * Use this method if you need to batch draw a large number of Game Objects to - * this Render Texture in a single go, or on a frequent basis. + * Sets the originX, originY of each group member. * - * This method starts the beginning of a batched draw. + * @method Phaser.GameObjects.Group#setOrigin + * @since 3.21.0 * - * It is faster than calling `draw`, but you must be very careful to manage the - * flow of code and remember to call `endDraw()`. If you don't need to draw large - * numbers of objects it's much safer and easier to use the `draw` method instead. + * @param {number} originX - The amount to set the `originX` property to. + * @param {number} [originY] - The amount to set the `originY` property to. If `undefined` or `null` it uses the `originX` value. + * @param {number} [stepX=0] - This is added to the `originX` amount, multiplied by the iteration counter. + * @param {number} [stepY=0] - This is added to the `originY` amount, multiplied by the iteration counter. * - * The flow should be: + * @return {this} This Group object. + */ + setOrigin: function (originX, originY, stepX, stepY) + { + Actions.SetOrigin(this.children.entries, originX, originY, stepX, stepY); + + return this; + }, + + /** + * Sets the scaleX of each group member. * - * ```javascript - * // Call once: - * RenderTexture.beginDraw(); + * @method Phaser.GameObjects.Group#scaleX + * @since 3.21.0 * - * // repeat n times: - * RenderTexture.batchDraw(); - * // or - * RenderTexture.batchDrawFrame(); + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. * - * // Call once: - * RenderTexture.endDraw(); - * ``` + * @return {this} This Group object. + */ + scaleX: function (value, step) + { + Actions.ScaleX(this.children.entries, value, step); + + return this; + }, + + /** + * Sets the scaleY of each group member. * - * Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you - * have started a batch. Also, be very careful not to destroy this Render Texture while the - * batch is still open, or call `beginDraw` again. + * @method Phaser.GameObjects.Group#scaleY + * @since 3.21.0 * - * @method Phaser.GameObjects.RenderTexture#beginDraw - * @since 3.50.0 + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. * - * @return {this} This Render Texture instance. + * @return {this} This Group object. */ - beginDraw: function () + scaleY: function (value, step) { - var camera = this.camera; - var renderer = this.renderer; - var renderTarget = this.renderTarget; + Actions.ScaleY(this.children.entries, value, step); - camera.preRender(); + return this; + }, - if (renderTarget) - { - renderer.beginCapture(renderTarget.width, renderTarget.height); - } - else - { - renderer.setContext(this.context); - } + /** + * Sets the scaleX, scaleY of each group member. + * + * @method Phaser.GameObjects.Group#scaleXY + * @since 3.21.0 + * + * @param {number} scaleX - The amount to be added to the `scaleX` property. + * @param {number} [scaleY] - The amount to be added to the `scaleY` property. If `undefined` or `null` it uses the `scaleX` value. + * @param {number} [stepX=0] - This is added to the `scaleX` amount, multiplied by the iteration counter. + * @param {number} [stepY=0] - This is added to the `scaleY` amount, multiplied by the iteration counter. + * + * @return {this} This Group object. + */ + scaleXY: function (scaleX, scaleY, stepX, stepY) + { + Actions.ScaleXY(this.children.entries, scaleX, scaleY, stepX, stepY); return this; }, /** - * Use this method if you have already called `beginDraw` and need to batch - * draw a large number of objects to this Render Texture. + * Sets the depth of each group member. * - * This method batches the drawing of the given objects to this Render Texture, - * without causing a bind or batch flush. + * @method Phaser.GameObjects.Group#setDepth + * @since 3.0.0 * - * It is faster than calling `draw`, but you must be very careful to manage the - * flow of code and remember to call `endDraw()`. If you don't need to draw large - * numbers of objects it's much safer and easier to use the `draw` method instead. + * @param {number} value - The amount to set the property to. + * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. * - * The flow should be: + * @return {this} This Group object. + */ + setDepth: function (value, step) + { + Actions.SetDepth(this.children.entries, value, step); + + return this; + }, + + /** + * Sets the blendMode of each group member. * - * ```javascript - * // Call once: - * RenderTexture.beginDraw(); + * @method Phaser.GameObjects.Group#setBlendMode + * @since 3.21.0 * - * // repeat n times: - * RenderTexture.batchDraw(); - * // or - * RenderTexture.batchDrawFrame(); - * - * // Call once: - * RenderTexture.endDraw(); - * ``` - * - * Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you - * have started a batch. Also, be very careful not to destroy this Render Texture while the - * batch is still open, or call `beginDraw` again. - * - * Draws the given object, or an array of objects, to this Render Texture. - * - * It can accept any of the following: - * - * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite. - * * Tilemap Layers. - * * A Group. The contents of which will be iterated and drawn in turn. - * * A Container. The contents of which will be iterated fully, and drawn in turn. - * * A Scene's Display List. Pass in `Scene.children` to draw the whole list. - * * Another Render Texture. - * * A Texture Frame instance. - * * A string. This is used to look-up a texture from the Texture Manager. - * - * Note: You cannot draw a Render Texture to itself. - * - * If passing in a Group or Container it will only draw children that return `true` - * when their `willRender()` method is called. I.e. a Container with 10 children, - * 5 of which have `visible=false` will only draw the 5 visible ones. - * - * If passing in an array of Game Objects it will draw them all, regardless if - * they pass a `willRender` check or not. - * - * You can pass in a string in which case it will look for a texture in the Texture - * Manager matching that string, and draw the base frame. If you need to specify - * exactly which frame to draw then use the method `drawFrame` instead. - * - * You can pass in the `x` and `y` coordinates to draw the objects at. The use of - * the coordinates differ based on what objects are being drawn. If the object is - * a Group, Container or Display List, the coordinates are _added_ to the positions - * of the children. For all other types of object, the coordinates are exact. - * - * The `alpha` and `tint` values are only used by Texture Frames. - * Game Objects use their own alpha and tint values when being drawn. - * - * @method Phaser.GameObjects.RenderTexture#batchDraw - * @since 3.50.0 - * - * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, other Render Texture, Texture Frame or an array of any of these. - * @param {number} [x] - The x position to draw the Frame at, or the offset applied to the object. - * @param {number} [y] - The y position to draw the Frame at, or the offset applied to the object. - * @param {number} [alpha] - The alpha value. Only used for Texture Frames and if not specified defaults to the `globalAlpha` property. Game Objects use their own current alpha value. - * @param {number} [tint] - WebGL only. The tint color value. Only used for Texture Frames and if not specified defaults to the `globalTint` property. Game Objects use their own current tint value. + * @param {number} value - The amount to set the property to. * - * @return {this} This Render Texture instance. + * @return {this} This Group object. */ - batchDraw: function (entries, x, y, alpha, tint) + setBlendMode: function (value) { - if (alpha === undefined) { alpha = this.globalAlpha; } - - if (tint === undefined) - { - tint = (this.globalTint >> 16) + (this.globalTint & 0xff00) + ((this.globalTint & 0xff) << 16); - } - else - { - tint = (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16); - } - - if (!Array.isArray(entries)) - { - entries = [ entries ]; - } - - this.batchList(entries, x, y, alpha, tint); + Actions.SetBlendMode(this.children.entries, value); return this; }, /** - * Use this method if you have already called `beginDraw` and need to batch - * draw a large number of texture frames to this Render Texture. - * - * This method batches the drawing of the given frames to this Render Texture, - * without causing a bind or batch flush. - * - * It is faster than calling `drawFrame`, but you must be very careful to manage the - * flow of code and remember to call `endDraw()`. If you don't need to draw large - * numbers of frames it's much safer and easier to use the `drawFrame` method instead. - * - * The flow should be: - * - * ```javascript - * // Call once: - * RenderTexture.beginDraw(); - * - * // repeat n times: - * RenderTexture.batchDraw(); - * // or - * RenderTexture.batchDrawFrame(); - * - * // Call once: - * RenderTexture.endDraw(); - * ``` - * - * Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you - * have started a batch. Also, be very careful not to destroy this Render Texture while the - * batch is still open, or call `beginDraw` again. - * - * Draws the Texture Frame to the Render Texture at the given position. - * - * Textures are referenced by their string-based keys, as stored in the Texture Manager. - * - * ```javascript - * var rt = this.add.renderTexture(0, 0, 800, 600); - * rt.drawFrame(key, frame); - * ``` - * - * You can optionally provide a position, alpha and tint value to apply to the frame - * before it is drawn. - * - * Calling this method will cause a batch flush, so if you've got a stack of things to draw - * in a tight loop, try using the `draw` method instead. - * - * If you need to draw a Sprite to this Render Texture, use the `draw` method instead. + * Passes all group members to the Input Manager to enable them for input with identical areas and callbacks. * - * @method Phaser.GameObjects.RenderTexture#batchDrawFrame - * @since 3.50.0 + * @method Phaser.GameObjects.Group#setHitArea + * @since 3.21.0 * - * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|number)} [frame] - The name or index of the frame within the Texture. - * @param {number} [x=0] - The x position to draw the frame at. - * @param {number} [y=0] - The y position to draw the frame at. - * @param {number} [alpha] - The alpha to use. If not specified it uses the `globalAlpha` property. - * @param {number} [tint] - WebGL only. The tint color to use. If not specified it uses the `globalTint` property. + * @param {*} hitArea - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. + * @param {Phaser.Types.Input.HitAreaCallback} hitAreaCallback - A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback. * - * @return {this} This Render Texture instance. + * @return {this} This Group object. */ - batchDrawFrame: function (key, frame, x, y, alpha, tint) + setHitArea: function (hitArea, hitAreaCallback) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (alpha === undefined) { alpha = this.globalAlpha; } - - if (tint === undefined) - { - tint = (this.globalTint >> 16) + (this.globalTint & 0xff00) + ((this.globalTint & 0xff) << 16); - } - else - { - tint = (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16); - } - - var textureFrame = this.textureManager.getFrame(key, frame); - - if (textureFrame) - { - if (this.renderTarget) - { - this.pipeline.batchTextureFrame(textureFrame, x, y, tint, alpha, this.camera.matrix, null); - } - else - { - this.batchTextureFrame(textureFrame, x + this.frame.cutX, y + this.frame.cutY, alpha, tint); - } - } + Actions.SetHitArea(this.children.entries, hitArea, hitAreaCallback); return this; }, /** - * Use this method to finish batch drawing to this Render Texture. - * - * Never call this method without first calling `beginDraw`. - * - * It is faster than calling `draw`, but you must be very careful to manage the - * flow of code and remember to call `endDraw()`. If you don't need to draw large - * numbers of objects it's much safer and easier to use the `draw` method instead. - * - * The flow should be: - * - * ```javascript - * // Call once: - * RenderTexture.beginDraw(); - * - * // repeat n times: - * RenderTexture.batchDraw(); - * // or - * RenderTexture.batchDrawFrame(); - * - * // Call once: - * RenderTexture.endDraw(); - * ``` - * - * Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you - * have started a batch. Also, be very careful not to destroy this Render Texture while the - * batch is still open, or call `beginDraw` again. - * - * @method Phaser.GameObjects.RenderTexture#endDraw - * @since 3.50.0 + * Shuffles the group members in place. * - * @param {boolean} [erase=false] - Draws all objects in this batch using a blend mode of ERASE. This has the effect of erasing any filled pixels in the objects being drawn. + * @method Phaser.GameObjects.Group#shuffle + * @since 3.21.0 * - * @return {this} This Render Texture instance. + * @return {this} This Group object. */ - endDraw: function (erase) + shuffle: function () { - if (erase === undefined) { erase = this._eraseMode; } - - var renderer = this.renderer; - - var renderTarget = this.renderTarget; - - if (renderTarget) - { - var canvasTarget = renderer.endCapture(); - - var util = renderer.pipelines.setUtility(); - - util.blitFrame(canvasTarget, renderTarget, 1, false, false, erase); - - renderer.resetScissor(); - renderer.resetViewport(); - } - else - { - renderer.setContext(); - } - - this.dirty = true; + Actions.Shuffle(this.children.entries); return this; }, /** - * Internal method that handles the drawing of an array of children. + * Deactivates a member of this group. * - * @method Phaser.GameObjects.RenderTexture#batchList - * @private - * @since 3.12.0 + * @method Phaser.GameObjects.Group#kill + * @since 3.0.0 * - * @param {array} children - The array of Game Objects to draw. - * @param {number} [x] - The x position to offset the Game Object by. - * @param {number} [y] - The y position to offset the Game Object by. - * @param {number} [alpha] - The alpha to use. If not specified it uses the `globalAlpha` property. - * @param {number} [tint] - The tint color to use. If not specified it uses the `globalTint` property. + * @param {Phaser.GameObjects.GameObject} gameObject - A member of this group. */ - batchList: function (children, x, y, alpha, tint) + kill: function (gameObject) { - for (var i = 0; i < children.length; i++) + if (this.children.contains(gameObject)) { - var entry = children[i]; - - if (!entry || entry === this) - { - continue; - } - - if (entry.renderWebGL || entry.renderCanvas) - { - // Game Objects - this.drawGameObject(entry, x, y); - } - else if (entry.isParent || entry.list) - { - // Groups / Display Lists - this.batchGroup(entry.getChildren(), x, y); - } - else if (typeof entry === 'string') - { - // Texture key - this.batchTextureFrameKey(entry, null, x, y, alpha, tint); - } - else if (entry instanceof Frame) - { - // Texture Frame instance - this.batchTextureFrame(entry, x, y, alpha, tint); - } - else if (Array.isArray(entry)) - { - // Another Array - this.batchList(entry, x, y, alpha, tint); - } + gameObject.setActive(false); } }, /** - * Internal method that handles drawing a Phaser Group contents. + * Deactivates and hides a member of this group. * - * @method Phaser.GameObjects.RenderTexture#batchGroup - * @private - * @since 3.12.0 + * @method Phaser.GameObjects.Group#killAndHide + * @since 3.0.0 * - * @param {array} children - The array of Game Objects to draw. - * @param {number} [x=0] - The x position to offset the Game Object by. - * @param {number} [y=0] - The y position to offset the Game Object by. + * @param {Phaser.GameObjects.GameObject} gameObject - A member of this group. */ - batchGroup: function (children, x, y) + killAndHide: function (gameObject) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - - x += this.frame.cutX; - y += this.frame.cutY; - - for (var i = 0; i < children.length; i++) + if (this.children.contains(gameObject)) { - var entry = children[i]; - - if (entry.willRender(this.camera)) - { - var tx = entry.x + x; - var ty = entry.y + y; - - this.drawGameObject(entry, tx, ty); - } + gameObject.setActive(false); + gameObject.setVisible(false); } }, /** - * Internal method that handles drawing a single Phaser Game Object to this Render Texture using WebGL. + * Sets the visible of each group member. * - * @method Phaser.GameObjects.RenderTexture#batchGameObjectWebGL - * @private - * @since 3.12.0 + * @method Phaser.GameObjects.Group#setVisible + * @since 3.21.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to draw. - * @param {number} [x] - The x position to draw the Game Object at. - * @param {number} [y] - The y position to draw the Game Object at. + * @param {boolean} value - The value to set the property to. + * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * + * @return {this} This Group object. */ - batchGameObjectWebGL: function (gameObject, x, y) + setVisible: function (value, index, direction) { - if (x === undefined) { x = gameObject.x; } - if (y === undefined) { y = gameObject.y; } - - var prevX = gameObject.x; - var prevY = gameObject.y; - - gameObject.setPosition(x + this.frame.cutX, y + this.frame.cutY); - - if (gameObject.renderDirect) - { - gameObject.renderDirect(this.renderer, gameObject, this.camera); - } - else - { - gameObject.renderWebGL(this.renderer, gameObject, this.camera); - } + Actions.SetVisible(this.children.entries, value, index, direction); - gameObject.setPosition(prevX, prevY); + return this; }, /** - * Internal method that handles drawing a single Phaser Game Object to this Render Texture using Canvas. + * Toggles (flips) the visible state of each member of this group. * - * @method Phaser.GameObjects.RenderTexture#batchGameObjectCanvas - * @private - * @since 3.12.0 + * @method Phaser.GameObjects.Group#toggleVisible + * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to draw. - * @param {number} [x] - The x position to draw the Game Object at. - * @param {number} [y] - The y position to draw the Game Object at. + * @return {this} This Group object. */ - batchGameObjectCanvas: function (gameObject, x, y) + toggleVisible: function () { - if (x === undefined) { x = gameObject.x; } - if (y === undefined) { y = gameObject.y; } - - var prevX = gameObject.x; - var prevY = gameObject.y; - - if (this._eraseMode) - { - var blendMode = gameObject.blendMode; - - gameObject.blendMode = BlendModes.ERASE; - } - - gameObject.setPosition(x + this.frame.cutX, y + this.frame.cutY); - - gameObject.renderCanvas(this.renderer, gameObject, this.camera, null); - - gameObject.setPosition(prevX, prevY); + Actions.ToggleVisible(this.children.entries); - if (this._eraseMode) - { - gameObject.blendMode = blendMode; - } + return this; }, /** - * Internal method that handles the drawing of an array of children. + * Empties this Group of all children and removes it from the Scene. * - * @method Phaser.GameObjects.RenderTexture#batchTextureFrameKey - * @private - * @since 3.12.0 + * Does not call {@link Phaser.GameObjects.Group#removeCallback}. * - * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|number)} [frame] - The name or index of the frame within the Texture. - * @param {number} [x=0] - The x position to offset the Game Object by. - * @param {number} [y=0] - The y position to offset the Game Object by. - * @param {number} [alpha] - The alpha to use. If not specified it uses the `globalAlpha` property. - * @param {number} [tint] - The tint color to use. If not specified it uses the `globalTint` property. - */ - batchTextureFrameKey: function (key, frame, x, y, alpha, tint) - { - var textureFrame = this.textureManager.getFrame(key, frame); - - if (textureFrame) - { - this.batchTextureFrame(textureFrame, x, y, alpha, tint); - } - }, - - /** - * Internal method that handles the drawing of a Texture Frame to this Render Texture. + * Children of this Group will _not_ be removed from the Scene by calling this method + * unless you specify the `removeFromScene` parameter. * - * @method Phaser.GameObjects.RenderTexture#batchTextureFrame - * @private - * @since 3.12.0 + * Children of this Group will also _not_ be destroyed by calling this method + * unless you specify the `destroyChildren` parameter. * - * @param {Phaser.Textures.Frame} textureFrame - The Texture Frame to draw. - * @param {number} [x=0] - The x position to draw the Frame at. - * @param {number} [y=0] - The y position to draw the Frame at. - * @param {number} [tint] - A tint color to be applied to the frame drawn to the Render Texture. + * @method Phaser.GameObjects.Group#destroy + * @since 3.0.0 + * + * @param {boolean} [destroyChildren=false] - Also {@link Phaser.GameObjects.GameObject#destroy} each Group member. + * @param {boolean} [removeFromScene=false] - Optionally remove each Group member from the Scene. */ - batchTextureFrame: function (textureFrame, x, y, alpha, tint) + destroy: function (destroyChildren, removeFromScene) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - - x += this.frame.cutX; - y += this.frame.cutY; - - var renderTarget = this.renderTarget; + if (destroyChildren === undefined) { destroyChildren = false; } + if (removeFromScene === undefined) { removeFromScene = false; } - if (renderTarget) + // This Game Object had already been destroyed + if (!this.scene || this.ignoreDestroy) { - this.pipeline.batchTextureFrame(textureFrame, x, y, tint, alpha, this.camera.matrix, null); + return; } - else - { - var ctx = this.context; - var cd = textureFrame.canvasData; - var source = textureFrame.source.image; - - var matrix = this.camera.matrix; - - ctx.save(); - - ctx.globalCompositeOperation = (this._eraseMode) ? 'destination-out' : 'source-over'; - - ctx.globalAlpha = alpha; - - matrix.setToContext(ctx); - ctx.drawImage(source, cd.x, cd.y, cd.width, cd.height, x, y, cd.width, cd.height); + this.emit(Events.DESTROY, this); - ctx.restore(); - } - }, + this.removeAllListeners(); - /** - * Takes a snapshot of the given area of this Render Texture. - * - * The snapshot is taken immediately. - * - * To capture the whole Render Texture see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. - * - * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. - * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, - * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, - * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. - * - * @method Phaser.GameObjects.RenderTexture#snapshotArea - * @since 3.19.0 - * - * @param {number} x - The x coordinate to grab from. - * @param {number} y - The y coordinate to grab from. - * @param {number} width - The width of the area to grab. - * @param {number} height - The height of the area to grab. - * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. - * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. - * - * @return {this} This Render Texture instance. - */ - snapshotArea: function (x, y, width, height, callback, type, encoderOptions) - { - if (this.renderTarget) - { - this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer, this.width, this.height, callback, false, x, y, width, height, type, encoderOptions); - } - else - { - this.renderer.snapshotCanvas(this.canvas, callback, false, x, y, width, height, type, encoderOptions); - } + this.scene.sys.updateList.remove(this); - return this; - }, + this.clear(removeFromScene, destroyChildren); - /** - * Takes a snapshot of the whole of this Render Texture. - * - * The snapshot is taken immediately. - * - * To capture just a portion of the Render Texture see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. - * - * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. - * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, - * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, - * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. - * - * @method Phaser.GameObjects.RenderTexture#snapshot - * @since 3.19.0 - * - * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. - * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. - * - * @return {this} This Render Texture instance. - */ - snapshot: function (callback, type, encoderOptions) - { - if (this.renderTarget) - { - this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer, this.width, this.height, callback, false, 0, 0, this.width, this.height, type, encoderOptions); - } - else - { - this.renderer.snapshotCanvas(this.canvas, callback, false, 0, 0, this.width, this.height, type, encoderOptions); - } + this.scene = undefined; + this.children = undefined; + } - return this; - }, +}); - /** - * Takes a snapshot of the given pixel from this Render Texture. - * - * The snapshot is taken immediately. - * - * To capture the whole Render Texture see the `snapshot` method. To capture a specific portion, see `snapshotArea`. - * - * Unlike the other two snapshot methods, this one will send your callback a `Color` object containing the color data for - * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, - * using less memory, than the other snapshot methods. - * - * @method Phaser.GameObjects.RenderTexture#snapshotPixel - * @since 3.19.0 - * - * @param {number} x - The x coordinate of the pixel to get. - * @param {number} y - The y coordinate of the pixel to get. - * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. - * - * @return {this} This Render Texture instance. - */ - snapshotPixel: function (x, y, callback) - { - if (this.renderTarget) - { - this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer, this.width, this.height, callback, true, x, y); - } - else - { - this.renderer.snapshotCanvas(this.canvas, callback, true, x, y); - } +module.exports = Group; - return this; - }, - /** - * Internal destroy handler, called as part of the destroy process. - * - * @method Phaser.GameObjects.RenderTexture#preDestroy - * @protected - * @since 3.9.0 - */ - preDestroy: function () - { - if (!this._saved) - { - CanvasPool.remove(this.canvas); +/***/ }), - if (this.renderTarget) - { - this.renderTarget.destroy(); - } +/***/ 61295: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - this.texture.destroy(); - this.camera.destroy(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.canvas = null; - this.context = null; - this.texture = null; - } - } +var GameObjectCreator = __webpack_require__(99325); +var Group = __webpack_require__(59192); +/** + * Creates a new Group Game Object and returns it. + * + * Note: This method will only be available if the Group Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#group + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} config - The configuration object this Game Object will use to create itself. + * + * @return {Phaser.GameObjects.Group} The Game Object that was created. + */ +GameObjectCreator.register('group', function (config) +{ + return new Group(this.scene, null, config); }); -module.exports = RenderTexture; +// When registering a factory function 'this' refers to the GameObjectCreator context. /***/ }), -/* 222 */ -/***/ (function(module, exports) { + +/***/ 62598: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Group = __webpack_require__(59192); +var GameObjectFactory = __webpack_require__(61286); + /** - * Creates and returns an RFC4122 version 4 compliant UUID. - * - * The string is in the form: `xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx` where each `x` is replaced with a random - * hexadecimal digit from 0 to f, and `y` is replaced with a random hexadecimal digit from 8 to b. + * Creates a new Group Game Object and adds it to the Scene. * - * @function Phaser.Utils.String.UUID - * @since 3.12.0 + * Note: This method will only be available if the Group Game Object has been built into Phaser. * - * @return {string} The UUID string. + * @method Phaser.GameObjects.GameObjectFactory#group + * @since 3.0.0 + * + * @param {(Phaser.GameObjects.GameObject[]|Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupConfig[]|Phaser.Types.GameObjects.Group.GroupCreateConfig)} [children] - Game Objects to add to this Group; or the `config` argument. + * @param {Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} [config] - A Group Configuration object. + * + * @return {Phaser.GameObjects.Group} The Game Object that was created. */ -var UUID = function () +GameObjectFactory.register('group', function (children, config) { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) - { - var r = Math.random() * 16 | 0; - var v = (c === 'x') ? r : (r & 0x3 | 0x8); - - return v.toString(16); - }); -}; - -module.exports = UUID; + return this.updateList.add(new Group(this.scene, children, config)); +}); /***/ }), -/* 223 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 1539: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AnimationState = __webpack_require__(164); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(15); -var PIPELINE_CONST = __webpack_require__(92); -var RopeRender = __webpack_require__(1085); -var Vector2 = __webpack_require__(3); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var ImageRender = __webpack_require__(57322); /** * @classdesc - * A Rope Game Object. - * - * The Rope object is WebGL only and does not have a Canvas counterpart. - * - * A Rope is a special kind of Game Object that has a texture that repeats along its entire length. - * Unlike a Sprite, it isn't restricted to using just a quad and can have as many vertices as you define - * when creating it. The vertices can be arranged in a horizontal or vertical strip and have their own - * color and alpha values as well. + * An Image Game Object. * - * A Ropes origin is always 0.5 x 0.5 and cannot be changed. + * An Image is a light-weight Game Object useful for the display of static images in your game, + * such as logos, backgrounds, scenery or other non-animated elements. Images can have input + * events and physics bodies, or be tweened, tinted or scrolled. The main difference between an + * Image and a Sprite is that you cannot animate an Image as they do not have the Animation component. * - * @class Rope + * @class Image * @extends Phaser.GameObjects.GameObject * @memberof Phaser.GameObjects * @constructor - * @webglOnly - * @since 3.23.0 + * @since 3.0.0 * - * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.Alpha * @extends Phaser.GameObjects.Components.BlendMode * @extends Phaser.GameObjects.Components.Depth * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.TextureCrop + * @extends Phaser.GameObjects.Components.Tint * @extends Phaser.GameObjects.Components.Transform * @extends Phaser.GameObjects.Components.Visible - * @extends Phaser.GameObjects.Components.ScrollFactor * * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {string} [texture] - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. If not given, `__DEFAULT` is used. - * @param {(string|number|null)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {(number|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. See `setPoints` to set this post-creation. - * @param {boolean} [horizontal=true] - Should the vertices of this Rope be aligned horizontally (`true`), or vertically (`false`)? - * @param {number[]} [colors] - An optional array containing the color data for this Rope. You should provide one color value per pair of vertices. - * @param {number[]} [alphas] - An optional array containing the alpha data for this Rope. You should provide one alpha value per pair of vertices. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ -var Rope = new Class({ +var Image = new Class({ Extends: GameObject, Mixins: [ - Components.AlphaSingle, + Components.Alpha, Components.BlendMode, Components.Depth, Components.Flip, + Components.GetBounds, Components.Mask, + Components.Origin, Components.Pipeline, + Components.PostPipeline, + Components.ScrollFactor, Components.Size, - Components.Texture, + Components.TextureCrop, + Components.Tint, Components.Transform, Components.Visible, - Components.ScrollFactor, - RopeRender + ImageRender ], initialize: - function Rope (scene, x, y, texture, frame, points, horizontal, colors, alphas) + function Image (scene, x, y, texture, frame) { - if (texture === undefined) { texture = '__DEFAULT'; } - if (points === undefined) { points = 2; } - if (horizontal === undefined) { horizontal = true; } - - GameObject.call(this, scene, 'Rope'); + GameObject.call(this, scene, 'Image'); /** - * The Animation State of this Rope. + * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. * - * @name Phaser.GameObjects.Rope#anims - * @type {Phaser.Animations.AnimationState} - * @since 3.23.0 + * @name Phaser.GameObjects.Image#_crop + * @type {object} + * @private + * @since 3.11.0 */ - this.anims = new AnimationState(this); + this._crop = this.resetCropObject(); - /** - * An array containing the points data for this Rope. - * - * Each point should be given as a Vector2Like object (i.e. a Vector2, Geom.Point or object with public x/y properties). - * - * The point coordinates are given in local space, where 0 x 0 is the start of the Rope strip. - * - * You can modify the contents of this array directly in real-time to create interesting effects. - * If you do so, be sure to call `setDirty` _after_ modifying this array, so that the vertices data is - * updated before the next render. Alternatively, you can use the `setPoints` method instead. - * - * Should you need to change the _size_ of this array, then you should always use the `setPoints` method. - * - * @name Phaser.GameObjects.Rope#points - * @type {Phaser.Types.Math.Vector2Like[]} - * @since 3.23.0 - */ - this.points = points; + this.setTexture(texture, frame); + this.setPosition(x, y); + this.setSizeToFrame(); + this.setOriginFromFrame(); + this.initPipeline(); + this.initPostPipeline(true); + } - /** - * An array containing the vertices data for this Rope. - * - * This data is calculated automatically in the `updateVertices` method, based on the points provided. - * - * @name Phaser.GameObjects.Rope#vertices - * @type {Float32Array} - * @since 3.23.0 - */ - this.vertices; +}); - /** - * An array containing the uv data for this Rope. - * - * This data is calculated automatically in the `setPoints` method, based on the points provided. - * - * @name Phaser.GameObjects.Rope#uv - * @type {Float32Array} - * @since 3.23.0 - */ - this.uv; +module.exports = Image; - /** - * An array containing the color data for this Rope. - * - * Colors should be given as numeric RGB values, such as 0xff0000. - * You should provide _two_ color values for every point in the Rope, one for the top and one for the bottom of each quad. - * - * You can modify the contents of this array directly in real-time, however, should you need to change the _size_ - * of the array, then you should use the `setColors` method instead. - * - * @name Phaser.GameObjects.Rope#colors - * @type {Uint32Array} - * @since 3.23.0 - */ - this.colors; - /** - * An array containing the alpha data for this Rope. - * - * Alphas should be given as float values, such as 0.5. - * You should provide _two_ alpha values for every point in the Rope, one for the top and one for the bottom of each quad. - * - * You can modify the contents of this array directly in real-time, however, should you need to change the _size_ - * of the array, then you should use the `setAlphas` method instead. - * - * @name Phaser.GameObjects.Rope#alphas - * @type {Float32Array} - * @since 3.23.0 - */ - this.alphas; +/***/ }), - /** - * The tint fill mode. - * - * `false` = An additive tint (the default), where vertices colors are blended with the texture. - * `true` = A fill tint, where the vertices colors replace the texture, but respects texture alpha. - * - * @name Phaser.GameObjects.Rope#tintFill - * @type {boolean} - * @since 3.23.0 - */ - this.tintFill = (texture === '__DEFAULT') ? true : false; +/***/ 57786: +/***/ ((module) => { - /** - * If the Rope is marked as `dirty` it will automatically recalculate its vertices - * the next time it renders. You can also force this by calling `updateVertices`. - * - * @name Phaser.GameObjects.Rope#dirty - * @type {boolean} - * @since 3.23.0 - */ - this.dirty = false; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Are the Rope vertices aligned horizontally, in a strip, or vertically, in a column? - * - * This property is set during instantiation and cannot be changed directly. - * See the `setVertical` and `setHorizontal` methods. - * - * @name Phaser.GameObjects.Rope#horizontal - * @type {boolean} - * @readonly - * @since 3.23.0 - */ - this.horizontal = horizontal; +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Image#renderCanvas + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var ImageCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - /** - * The horizontally flipped state of the Game Object. - * - * A Game Object that is flipped horizontally will render inversed on the horizontal axis. - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. - * - * @name Phaser.GameObjects.Rope#_flipX - * @type {boolean} - * @default false - * @private - * @since 3.23.0 - */ - this._flipX = false; + renderer.batchSprite(src, src.frame, camera, parentMatrix); +}; - /** - * The vertically flipped state of the Game Object. - * - * A Game Object that is flipped vertically will render inversed on the vertical axis (i.e. upside down) - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. - * - * @name Phaser.GameObjects.Rope#_flipY - * @type {boolean} - * @default false - * @private - * @since 3.23.0 - */ - this._flipY = false; +module.exports = ImageCanvasRenderer; - /** - * Internal Vector2 used for vertices updates. - * - * @name Phaser.GameObjects.Rope#_perp - * @type {Phaser.Math.Vector2} - * @private - * @since 3.23.0 - */ - this._perp = new Vector2(); - /** - * You can optionally choose to render the vertices of this Rope to a Graphics instance. - * - * Achieve this by setting the `debugCallback` and the `debugGraphic` properties. - * - * You can do this in a single call via the `Rope.setDebug` method, which will use the - * built-in debug function. You can also set it to your own callback. The callback - * will be invoked _once per render_ and sent the following parameters: - * - * `debugCallback(src, meshLength, verts)` - * - * `src` is the Rope instance being debugged. - * `meshLength` is the number of mesh vertices in total. - * `verts` is an array of the translated vertex coordinates. - * - * To disable rendering, set this property back to `null`. - * - * @name Phaser.GameObjects.Rope#debugCallback - * @type {function} - * @since 3.23.0 - */ - this.debugCallback = null; +/***/ }), - /** - * The Graphics instance that the debug vertices will be drawn to, if `setDebug` has - * been called. - * - * @name Phaser.GameObjects.Rope#debugGraphic - * @type {Phaser.GameObjects.Graphics} - * @since 3.23.0 - */ - this.debugGraphic = null; +/***/ 83556: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - this.setTexture(texture, frame); - this.setPosition(x, y); - this.setSizeToFrame(); - this.initPipeline(PIPELINE_CONST.ROPE_PIPELINE); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (Array.isArray(points)) - { - this.resizeArrays(points.length); - } +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var Image = __webpack_require__(1539); - this.setPoints(points, colors, alphas); +/** + * Creates a new Image Game Object and returns it. + * + * Note: This method will only be available if the Image Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#image + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Image} The Game Object that was created. + */ +GameObjectCreator.register('image', function (config, addToScene) +{ + if (config === undefined) { config = {}; } - this.updateVertices(); - }, + var key = GetAdvancedValue(config, 'key', null); + var frame = GetAdvancedValue(config, 'frame', null); - // Overrides Game Object method - addedToScene: function () - { - this.scene.sys.updateList.add(this); - }, + var image = new Image(this.scene, 0, 0, key, frame); - // Overrides Game Object method - removedFromScene: function () + if (addToScene !== undefined) { - this.scene.sys.updateList.remove(this); - }, + config.add = addToScene; + } - /** - * The Rope update loop. - * - * @method Phaser.GameObjects.Rope#preUpdate - * @protected - * @since 3.23.0 - * - * @param {number} time - The current timestamp. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. - */ - preUpdate: function (time, delta) - { - var prevFrame = this.anims.currentFrame; + BuildGameObject(this.scene, image, config); - this.anims.update(time, delta); + return image; +}); - if (this.anims.currentFrame !== prevFrame) - { - this.updateUVs(); - this.updateVertices(); - } - }, +// When registering a factory function 'this' refers to the GameObjectCreator context. - /** - * Start playing the given animation. - * - * @method Phaser.GameObjects.Rope#play - * @since 3.23.0 - * - * @param {string} key - The string-based key of the animation to play. - * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. - * @param {number} [startFrame=0] - Optionally start the animation playing from this frame index. - * - * @return {this} This Game Object. - */ - play: function (key, ignoreIfPlaying, startFrame) - { - this.anims.play(key, ignoreIfPlaying, startFrame); - return this; - }, +/***/ }), - /** - * Flags this Rope as being dirty. A dirty rope will recalculate all of its vertices data - * the _next_ time it renders. You should set this rope as dirty if you update the points - * array directly. - * - * @method Phaser.GameObjects.Rope#setDirty - * @since 3.23.0 - * - * @return {this} This Game Object instance. - */ - setDirty: function () - { - this.dirty = true; +/***/ 20927: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets the alignment of the points in this Rope to be horizontal, in a strip format. - * - * Calling this method will reset this Rope. The current points, vertices, colors and alpha - * values will be reset to thoes values given as parameters. - * - * @method Phaser.GameObjects.Rope#setHorizontal - * @since 3.23.0 - * - * @param {(number|Phaser.Types.Math.Vector2Like[])} [points] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided the current points length is used. - * @param {(number|number[])} [colors] - Either a single color value, or an array of values. - * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. - * - * @return {this} This Game Object instance. - */ - setHorizontal: function (points, colors, alphas) - { - if (points === undefined) { points = this.points.length; } +var Image = __webpack_require__(1539); +var GameObjectFactory = __webpack_require__(61286); - if (this.horizontal) - { - return this; - } +/** + * Creates a new Image Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Image Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#image + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * + * @return {Phaser.GameObjects.Image} The Game Object that was created. + */ +GameObjectFactory.register('image', function (x, y, texture, frame) +{ + return this.displayList.add(new Image(this.scene, x, y, texture, frame)); +}); - this.horizontal = true; +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns - return this.setPoints(points, colors, alphas); - }, - /** - * Sets the alignment of the points in this Rope to be vertical, in a column format. - * - * Calling this method will reset this Rope. The current points, vertices, colors and alpha - * values will be reset to thoes values given as parameters. - * - * @method Phaser.GameObjects.Rope#setVertical - * @since 3.23.0 - * - * @param {(number|Phaser.Types.Math.Vector2Like[])} [points] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided the current points length is used. - * @param {(number|number[])} [colors] - Either a single color value, or an array of values. - * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. - * - * @return {this} This Game Object instance. - */ - setVertical: function (points, colors, alphas) - { - if (points === undefined) { points = this.points.length; } +/***/ }), - if (!this.horizontal) - { - return this; - } +/***/ 57322: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.horizontal = false; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this.setPoints(points, colors, alphas); - }, +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - /** - * Sets the tint fill mode. - * - * Mode 0 (`false`) is an additive tint, the default, which blends the vertices colors with the texture. - * This mode respects the texture alpha. - * - * Mode 1 (`true`) is a fill tint. Unlike an additive tint, a fill-tint literally replaces the pixel colors - * from the texture with those in the tint. You can use this for effects such as making a player flash 'white' - * if hit by something. This mode respects the texture alpha. - * - * See the `setColors` method for details of how to color each of the vertices. - * - * @method Phaser.GameObjects.Rope#setTintFill - * @webglOnly - * @since 3.23.0 - * - * @param {boolean} [value=false] - Set to `false` for an Additive tint or `true` fill tint with alpha. - * - * @return {this} This Game Object instance. - */ - setTintFill: function (value) - { - if (value === undefined) { value = false; } +if (true) +{ + renderWebGL = __webpack_require__(59390); +} - this.tintFill = value; +if (true) +{ + renderCanvas = __webpack_require__(57786); +} - return this; - }, +module.exports = { - /** - * Set the alpha values used by the Rope during rendering. - * - * You can provide the values in a number of ways: - * - * 1) One single numeric value: `setAlphas(0.5)` - This will set a single alpha for the whole Rope. - * 2) Two numeric value: `setAlphas(1, 0.5)` - This will set a 'top' and 'bottom' alpha value across the whole Rope. - * 3) An array of values: `setAlphas([ 1, 0.5, 0.2 ])` - * - * If you provide an array of values and the array has exactly the same number of values as `points` in the Rope, it - * will use each alpha value per rope segment. - * - * If the provided array has a different number of values than `points` then it will use the values in order, from - * the first Rope segment and on, until it runs out of values. This allows you to control the alpha values at all - * vertices in the Rope. - * - * Note this method is called `setAlphas` (plural) and not `setAlpha`. - * - * @method Phaser.GameObjects.Rope#setAlphas - * @since 3.23.0 - * - * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. If nothing is provided alpha is reset to 1. - * @param {number} [bottomAlpha] - An optional bottom alpha value. See the method description for details. - * - * @return {this} This Game Object instance. - */ - setAlphas: function (alphas, bottomAlpha) - { - var total = this.points.length; + renderWebGL: renderWebGL, + renderCanvas: renderCanvas - if (total < 1) - { - return this; - } +}; - var currentAlphas = this.alphas; - if (alphas === undefined) - { - alphas = [ 1 ]; - } - else if (!Array.isArray(alphas) && bottomAlpha === undefined) - { - alphas = [ alphas ]; - } +/***/ }), - var i; - var index = 0; +/***/ 59390: +/***/ ((module) => { - if (bottomAlpha !== undefined) - { - // Top / Bottom alpha pair - for (i = 0; i < total; i++) - { - index = i * 2; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - currentAlphas[index] = alphas; - currentAlphas[index + 1] = bottomAlpha; - } - } - else if (alphas.length === total) - { - // If there are exactly the same number of alphas as points, we'll combine the alphas - for (i = 0; i < total; i++) - { - index = i * 2; +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Image#renderWebGL + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var ImageWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - currentAlphas[index] = alphas[i]; - currentAlphas[index + 1] = alphas[i]; - } - } - else - { - var prevAlpha = alphas[0]; + this.pipeline.batchSprite(src, camera, parentMatrix); +}; - for (i = 0; i < total; i++) - { - index = i * 2; +module.exports = ImageWebGLRenderer; - if (alphas.length > index) - { - prevAlpha = alphas[index]; - } - currentAlphas[index] = prevAlpha; +/***/ }), - if (alphas.length > index + 1) - { - prevAlpha = alphas[index + 1]; - } +/***/ 48013: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - currentAlphas[index + 1] = prevAlpha; - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; +/** + * @namespace Phaser.GameObjects + */ - }, +var GameObjects = { - /** - * Set the color values used by the Rope during rendering. - * - * Colors are used to control the level of tint applied across the Rope texture. - * - * You can provide the values in a number of ways: - * - * * One single numeric value: `setColors(0xff0000)` - This will set a single color tint for the whole Rope. - * * An array of values: `setColors([ 0xff0000, 0x00ff00, 0x0000ff ])` - * - * If you provide an array of values and the array has exactly the same number of values as `points` in the Rope, it - * will use each color per rope segment. - * - * If the provided array has a different number of values than `points` then it will use the values in order, from - * the first Rope segment and on, until it runs out of values. This allows you to control the color values at all - * vertices in the Rope. - * - * @method Phaser.GameObjects.Rope#setColors - * @since 3.23.0 - * - * @param {(number|number[])} [colors] - Either a single color value, or an array of values. If nothing is provided color is reset to 0xffffff. - * - * @return {this} This Game Object instance. - */ - setColors: function (colors) - { - var total = this.points.length; + Events: __webpack_require__(56631), + + DisplayList: __webpack_require__(91713), + GameObjectCreator: __webpack_require__(99325), + GameObjectFactory: __webpack_require__(61286), + UpdateList: __webpack_require__(92034), + + Components: __webpack_require__(64937), + GetCalcMatrix: __webpack_require__(73329), + + BuildGameObject: __webpack_require__(88933), + BuildGameObjectAnimation: __webpack_require__(32291), + GameObject: __webpack_require__(89980), + BitmapText: __webpack_require__(44616), + Blitter: __webpack_require__(52816), + Bob: __webpack_require__(41664), + Container: __webpack_require__(70339), + DOMElement: __webpack_require__(38943), + DynamicBitmapText: __webpack_require__(13468), + Extern: __webpack_require__(39419), + Graphics: __webpack_require__(33182), + Group: __webpack_require__(59192), + Image: __webpack_require__(1539), + Layer: __webpack_require__(85305), + Particles: __webpack_require__(27684), + PathFollower: __webpack_require__(29598), + RenderTexture: __webpack_require__(15996), + RetroFont: __webpack_require__(55873), + Rope: __webpack_require__(79968), + Sprite: __webpack_require__(13747), + + Text: __webpack_require__(76555), + GetTextSize: __webpack_require__(32979), + MeasureText: __webpack_require__(27030), + TextStyle: __webpack_require__(74744), + + TileSprite: __webpack_require__(35856), + Zone: __webpack_require__(71030), + Video: __webpack_require__(8630), - if (total < 1) - { - return this; - } + // Shapes - var currentColors = this.colors; + Shape: __webpack_require__(91461), + Arc: __webpack_require__(28593), + Curve: __webpack_require__(15220), + Ellipse: __webpack_require__(28591), + Grid: __webpack_require__(39169), + IsoBox: __webpack_require__(4415), + IsoTriangle: __webpack_require__(65159), + Line: __webpack_require__(579), + Polygon: __webpack_require__(91249), + Rectangle: __webpack_require__(517), + Star: __webpack_require__(77843), + Triangle: __webpack_require__(21873), - if (colors === undefined) - { - colors = [ 0xffffff ]; - } - else if (!Array.isArray(colors)) - { - colors = [ colors ]; - } + // Game Object Factories - var i; - var index = 0; + Factories: { + Blitter: __webpack_require__(38906), + Container: __webpack_require__(23400), + DOMElement: __webpack_require__(66788), + DynamicBitmapText: __webpack_require__(94145), + Extern: __webpack_require__(41155), + Graphics: __webpack_require__(13122), + Group: __webpack_require__(62598), + Image: __webpack_require__(20927), + Layer: __webpack_require__(17676), + Particles: __webpack_require__(81212), + PathFollower: __webpack_require__(19626), + RenderTexture: __webpack_require__(29599), + Rope: __webpack_require__(31982), + Sprite: __webpack_require__(66135), + StaticBitmapText: __webpack_require__(21797), + Text: __webpack_require__(94627), + TileSprite: __webpack_require__(20509), + Zone: __webpack_require__(34546), + Video: __webpack_require__(215), - if (colors.length === total) - { - // If there are exactly the same number of colors as points, we'll combine the colors - for (i = 0; i < total; i++) - { - index = i * 2; + // Shapes + Arc: __webpack_require__(10369), + Curve: __webpack_require__(10147), + Ellipse: __webpack_require__(99869), + Grid: __webpack_require__(9326), + IsoBox: __webpack_require__(88154), + IsoTriangle: __webpack_require__(67765), + Line: __webpack_require__(85665), + Polygon: __webpack_require__(88203), + Rectangle: __webpack_require__(94355), + Star: __webpack_require__(23962), + Triangle: __webpack_require__(79296) + }, - currentColors[index] = colors[i]; - currentColors[index + 1] = colors[i]; - } - } - else - { - var prevColor = colors[0]; + Creators: { + Blitter: __webpack_require__(68452), + Container: __webpack_require__(44516), + DynamicBitmapText: __webpack_require__(67513), + Graphics: __webpack_require__(41286), + Group: __webpack_require__(61295), + Image: __webpack_require__(83556), + Layer: __webpack_require__(56378), + Particles: __webpack_require__(765), + RenderTexture: __webpack_require__(85692), + Rope: __webpack_require__(96027), + Sprite: __webpack_require__(89219), + StaticBitmapText: __webpack_require__(95499), + Text: __webpack_require__(75397), + TileSprite: __webpack_require__(63950), + Zone: __webpack_require__(24067), + Video: __webpack_require__(65601) + } - for (i = 0; i < total; i++) - { - index = i * 2; +}; - if (colors.length > index) - { - prevColor = colors[index]; - } +// WebGL only Game Objects +if (true) +{ + GameObjects.Shader = __webpack_require__(27902); + GameObjects.Mesh = __webpack_require__(83321); + GameObjects.NineSlice = __webpack_require__(44139); + GameObjects.PointLight = __webpack_require__(13171); + GameObjects.Plane = __webpack_require__(33412); + + GameObjects.Factories.Shader = __webpack_require__(51979); + GameObjects.Factories.Mesh = __webpack_require__(8767); + GameObjects.Factories.NineSlice = __webpack_require__(53778); + GameObjects.Factories.PointLight = __webpack_require__(91201); + GameObjects.Factories.Plane = __webpack_require__(58322); + + GameObjects.Creators.Shader = __webpack_require__(13908); + GameObjects.Creators.Mesh = __webpack_require__(41839); + GameObjects.Creators.NineSlice = __webpack_require__(40964); + GameObjects.Creators.PointLight = __webpack_require__(162); + GameObjects.Creators.Plane = __webpack_require__(10912); + + GameObjects.Light = __webpack_require__(14455); + GameObjects.LightsManager = __webpack_require__(26193); + GameObjects.LightsPlugin = __webpack_require__(50296); +} - currentColors[index] = prevColor; +module.exports = GameObjects; - if (colors.length > index + 1) - { - prevColor = colors[index + 1]; - } - currentColors[index + 1] = prevColor; - } - } +/***/ }), - return this; - }, +/***/ 85305: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Sets the points used by this Rope. - * - * The points should be provided as an array of Vector2, or vector2-like objects (i.e. those with public x/y properties). - * - * Each point corresponds to one segment of the Rope. The more points in the array, the more segments the rope has. - * - * Point coordinates are given in local-space, not world-space, and are directly related to the size of the texture - * this Rope object is using. - * - * For example, a Rope using a 512 px wide texture, split into 4 segments (128px each) would use the following points: - * - * ```javascript - * rope.setPoints([ - * { x: 0, y: 0 }, - * { x: 128, y: 0 }, - * { x: 256, y: 0 }, - * { x: 384, y: 0 } - * ]); - * ``` - * - * Or, you can provide an integer to do the same thing: - * - * ```javascript - * rope.setPoints(4); - * ``` - * - * Which will divide the Rope into 4 equally sized segments based on the frame width. - * - * Note that calling this method with a different number of points than the Rope has currently will - * _reset_ the color and alpha values, unless you provide them as arguments to this method. - * - * @method Phaser.GameObjects.Rope#setPoints - * @since 3.23.0 - * - * @param {(number|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. - * @param {(number|number[])} [colors] - Either a single color value, or an array of values. - * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. - * - * @return {this} This Game Object instance. - */ - setPoints: function (points, colors, alphas) - { - if (points === undefined) { points = 2; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (typeof points === 'number') - { - // Generate an array based on the points - var segments = points; +var BlendModes = __webpack_require__(95723); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var ComponentsToJSON = __webpack_require__(48129); +var DataManager = __webpack_require__(81078); +var EventEmitter = __webpack_require__(6659); +var GameObjectEvents = __webpack_require__(56631); +var List = __webpack_require__(71207); +var Render = __webpack_require__(58010); +var SceneEvents = __webpack_require__(7599); +var StableSort = __webpack_require__(17922); - if (segments < 2) - { - segments = 2; - } +/** + * @classdesc + * A Layer Game Object. + * + * A Layer is a special type of Game Object that acts as a Display List. You can add any type of Game Object + * to a Layer, just as you would to a Scene. Layers can be used to visually group together 'layers' of Game + * Objects: + * + * ```javascript + * const spaceman = this.add.sprite(150, 300, 'spaceman'); + * const bunny = this.add.sprite(400, 300, 'bunny'); + * const elephant = this.add.sprite(650, 300, 'elephant'); + * + * const layer = this.add.layer(); + * + * layer.add([ spaceman, bunny, elephant ]); + * ``` + * + * The 3 sprites in the example above will now be managed by the Layer they were added to. Therefore, + * if you then set `layer.setVisible(false)` they would all vanish from the display. + * + * You can also control the depth of the Game Objects within the Layer. For example, calling the + * `setDepth` method of a child of a Layer will allow you to adjust the depth of that child _within the + * Layer itself_, rather than the whole Scene. The Layer, too, can have its depth set as well. + * + * The Layer class also offers many different methods for manipulating the list, such as the + * methods `moveUp`, `moveDown`, `sendToBack`, `bringToTop` and so on. These allow you to change the + * display list position of the Layers children, causing it to adjust the order in which they are + * rendered. Using `setDepth` on a child allows you to override this. + * + * Layers can have Post FX Pipelines set, which allows you to easily enable a post pipeline across + * a whole range of children, which, depending on the effect, can often be far more efficient that doing so + * on a per-child basis. + * + * Layers have no position or size within the Scene. This means you cannot enable a Layer for + * physics or input, or change the position, rotation or scale of a Layer. They also have no scroll + * factor, texture, tint, origin, crop or bounds. + * + * If you need those kind of features then you should use a Container instead. Containers can be added + * to Layers, but Layers cannot be added to Containers. + * + * However, you can set the Alpha, Blend Mode, Depth, Mask and Visible state of a Layer. These settings + * will impact all children being rendered by the Layer. + * + * @class Layer + * @extends Phaser.Structs.List. + * @memberof Phaser.GameObjects + * @constructor + * @since 3.50.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Layer. + */ +var Layer = new Class({ - points = []; + Extends: List, - var s; - var frameSegment; - var offset; + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.Mask, + Components.PostPipeline, + Components.Visible, + EventEmitter, + Render + ], - if (this.horizontal) - { - offset = -(this.frame.halfWidth); - frameSegment = this.frame.width / (segments - 1); + initialize: - for (s = 0; s < segments; s++) - { - points.push({ x: offset + s * frameSegment, y: 0 }); - } - } - else - { - offset = -(this.frame.halfHeight); - frameSegment = this.frame.height / (segments - 1); + function Layer (scene, children) + { + List.call(this, scene); + EventEmitter.call(this); - for (s = 0; s < segments; s++) - { - points.push({ x: 0, y: offset + s * frameSegment }); - } - } - } + /** + * A reference to the Scene to which this Game Object belongs. + * + * Game Objects can only belong to one Scene. + * + * You should consider this property as being read-only. You cannot move a + * Game Object to another Scene by simply changing it. + * + * @name Phaser.GameObjects.Layer#scene + * @type {Phaser.Scene} + * @since 3.50.0 + */ + this.scene = scene; - var total = points.length; - var currentTotal = this.points.length; + /** + * Holds a reference to the Display List that contains this Game Object. + * + * This is set automatically when this Game Object is added to a Scene or Layer. + * + * You should treat this property as being read-only. + * + * @name Phaser.GameObjects.Layer#displayList + * @type {(Phaser.GameObjects.DisplayList|Phaser.GameObjects.Layer)} + * @default null + * @since 3.50.0 + */ + this.displayList = null; - if (total < 1) - { - console.warn('Rope: Not enough points given'); + /** + * A textual representation of this Game Object, i.e. `sprite`. + * Used internally by Phaser but is available for your own custom classes to populate. + * + * @name Phaser.GameObjects.Layer#type + * @type {string} + * @since 3.50.0 + */ + this.type = 'Layer'; - return this; - } - else if (total === 1) - { - points.unshift({ x: 0, y: 0 }); - total++; - } + /** + * The current state of this Game Object. + * + * Phaser itself will never modify this value, although plugins may do so. + * + * Use this property to track the state of a Game Object during its lifetime. For example, it could change from + * a state of 'moving', to 'attacking', to 'dead'. The state value should be an integer (ideally mapped to a constant + * in your game code), or a string. These are recommended to keep it light and simple, with fast comparisons. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @name Phaser.GameObjects.Layer#state + * @type {(number|string)} + * @since 3.50.0 + */ + this.state = 0; - if (currentTotal !== total) - { - this.resizeArrays(total); - } + /** + * A Layer cannot be placed inside a Container. + * + * This property is kept purely so a Layer has the same + * shape as a Game Object. + * + * @name Phaser.GameObjects.Layer#parentContainer + * @type {Phaser.GameObjects.Container} + * @since 3.51.0 + */ + this.parentContainer = null; - this.points = points; + /** + * The name of this Game Object. + * Empty by default and never populated by Phaser, this is left for developers to use. + * + * @name Phaser.GameObjects.Layer#name + * @type {string} + * @default '' + * @since 3.50.0 + */ + this.name = ''; - this.updateUVs(); + /** + * The active state of this Game Object. + * A Game Object with an active state of `true` is processed by the Scenes UpdateList, if added to it. + * An active object is one which is having its logic and internal systems updated. + * + * @name Phaser.GameObjects.Layer#active + * @type {boolean} + * @default true + * @since 3.50.0 + */ + this.active = true; - if (colors !== undefined && colors !== null) - { - this.setColors(colors); - } + /** + * The Tab Index of the Game Object. + * Reserved for future use by plugins and the Input Manager. + * + * @name Phaser.GameObjects.Layer#tabIndex + * @type {number} + * @default -1 + * @since 3.51.0 + */ + this.tabIndex = -1; - if (alphas !== undefined && alphas !== null) - { - this.setAlphas(alphas); - } + /** + * A Data Manager. + * It allows you to store, query and get key/value paired information specific to this Game Object. + * `null` by default. Automatically created if you use `getData` or `setData` or `setDataEnabled`. + * + * @name Phaser.GameObjects.Layer#data + * @type {Phaser.Data.DataManager} + * @default null + * @since 3.50.0 + */ + this.data = null; - return this; - }, + /** + * The flags that are compared against `RENDER_MASK` to determine if this Game Object will render or not. + * The bits are 0001 | 0010 | 0100 | 1000 set by the components Visible, Alpha, Transform and Texture respectively. + * If those components are not used by your custom class then you can use this bitmask as you wish. + * + * @name Phaser.GameObjects.Layer#renderFlags + * @type {number} + * @default 15 + * @since 3.50.0 + */ + this.renderFlags = 15; - /** - * Updates all of the UVs based on the Rope.points and `flipX` and `flipY` settings. - * - * @method Phaser.GameObjects.Rope#updateUVs - * @since 3.23.0 - * - * @return {this} This Game Object instance. - */ - updateUVs: function () - { - var currentUVs = this.uv; - var total = this.points.length; + /** + * A bitmask that controls if this Game Object is drawn by a Camera or not. + * Not usually set directly, instead call `Camera.ignore`, however you can + * set this property directly using the Camera.id property: + * + * @example + * this.cameraFilter |= camera.id + * + * @name Phaser.GameObjects.Layer#cameraFilter + * @type {number} + * @default 0 + * @since 3.50.0 + */ + this.cameraFilter = 0; - var u0 = this.frame.u0; - var v0 = this.frame.v0; - var u1 = this.frame.u1; - var v1 = this.frame.v1; + /** + * This property is kept purely so a Layer has the same + * shape as a Game Object. You cannot input enable a Layer. + * + * @name Phaser.GameObjects.Layer#input + * @type {?Phaser.Types.Input.InteractiveObject} + * @default null + * @since 3.51.0 + */ + this.input = null; - var partH = (u1 - u0) / (total - 1); - var partV = (v1 - v0) / (total - 1); + /** + * This property is kept purely so a Layer has the same + * shape as a Game Object. You cannot give a Layer a physics body. + * + * @name Phaser.GameObjects.Layer#body + * @type {?(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody|MatterJS.BodyType)} + * @default null + * @since 3.51.0 + */ + this.body = null; - for (var i = 0; i < total; i++) - { - var index = i * 4; + /** + * This Game Object will ignore all calls made to its destroy method if this flag is set to `true`. + * This includes calls that may come from a Group, Container or the Scene itself. + * While it allows you to persist a Game Object across Scenes, please understand you are entirely + * responsible for managing references to and from this Game Object. + * + * @name Phaser.GameObjects.Layer#ignoreDestroy + * @type {boolean} + * @default false + * @since 3.50.0 + */ + this.ignoreDestroy = false; - var uv0; - var uv1; - var uv2; - var uv3; + /** + * A reference to the Scene Systems. + * + * @name Phaser.GameObjects.Layer#systems + * @type {Phaser.Scenes.Systems} + * @since 3.50.0 + */ + this.systems = scene.sys; - if (this.horizontal) - { - if (this._flipX) - { - uv0 = u1 - (i * partH); - uv2 = u1 - (i * partH); - } - else - { - uv0 = u0 + (i * partH); - uv2 = u0 + (i * partH); - } + /** + * A reference to the Scene Event Emitter. + * + * @name Phaser.GameObjects.Layer#events + * @type {Phaser.Events.EventEmitter} + * @since 3.50.0 + */ + this.events = scene.sys.events; - if (this._flipY) - { - uv1 = v1; - uv3 = v0; - } - else - { - uv1 = v0; - uv3 = v1; - } - } - else - { - if (this._flipX) - { - uv0 = u0; - uv2 = u1; - } - else - { - uv0 = u1; - uv2 = u0; - } + /** + * The flag the determines whether Game Objects should be sorted when `depthSort()` is called. + * + * @name Phaser.GameObjects.Layer#sortChildrenFlag + * @type {boolean} + * @default false + * @since 3.50.0 + */ + this.sortChildrenFlag = false; - if (this._flipY) - { - uv1 = v1 - (i * partV); - uv3 = v1 - (i * partV); - } - else - { - uv1 = v0 + (i * partV); - uv3 = v0 + (i * partV); - } - } + // Set the List callbacks + this.addCallback = this.addChildCallback; + this.removeCallback = this.removeChildCallback; - currentUVs[index + 0] = uv0; - currentUVs[index + 1] = uv1; - currentUVs[index + 2] = uv2; - currentUVs[index + 3] = uv3; + this.initPostPipeline(); + + this.clearAlpha(); + + this.setBlendMode(BlendModes.SKIP_CHECK); + + if (children) + { + this.add(children); } - return this; + // Tell the Scene to re-sort the children + scene.sys.queueDepthSort(); }, /** - * Resizes all of the internal arrays: `vertices`, `uv`, `colors` and `alphas` to the new - * given Rope segment total. + * Sets the `active` property of this Game Object and returns this Game Object for further chaining. + * A Game Object with its `active` property set to `true` will be updated by the Scenes UpdateList. * - * @method Phaser.GameObjects.Rope#resizeArrays - * @since 3.23.0 + * @method Phaser.GameObjects.Layer#setActive + * @since 3.50.0 * - * @param {number} newSize - The amount of segments to split the Rope in to. + * @param {boolean} value - True if this Game Object should be set as active, false if not. * - * @return {this} This Game Object instance. + * @return {this} This GameObject. */ - resizeArrays: function (newSize) + setActive: function (value) { - var colors = this.colors; - var alphas = this.alphas; - - this.vertices = new Float32Array(newSize * 4); - this.uv = new Float32Array(newSize * 4); - - colors = new Uint32Array(newSize * 2); - alphas = new Float32Array(newSize * 2); - - for (var i = 0; i < newSize * 2; i++) - { - colors[i] = 0xffffff; - alphas[i] = 1; - } - - this.colors = colors; - this.alphas = alphas; - - // updateVertices during next render - this.dirty = true; + this.active = value; return this; }, /** - * Updates the vertices based on the Rope points. + * Sets the `name` property of this Game Object and returns this Game Object for further chaining. + * The `name` property is not populated by Phaser and is presented for your own use. * - * This method is called automatically during rendering if `Rope.dirty` is `true`, which is set - * by the `setPoints` and `setDirty` methods. You should flag the Rope as being dirty if you modify - * the Rope points directly. + * @method Phaser.GameObjects.Layer#setName + * @since 3.50.0 * - * @method Phaser.GameObjects.Rope#updateVertices - * @since 3.23.0 + * @param {string} value - The name to be given to this Game Object. * - * @return {this} This Game Object instance. + * @return {this} This GameObject. */ - updateVertices: function () + setName: function (value) { - var perp = this._perp; - var points = this.points; - var vertices = this.vertices; - - var total = points.length; - - this.dirty = false; + this.name = value; - if (total < 1) - { - return; - } + return this; + }, - var nextPoint; - var lastPoint = points[0]; + /** + * Sets the current state of this Game Object. + * + * Phaser itself will never modify the State of a Game Object, although plugins may do so. + * + * For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'. + * The state value should typically be an integer (ideally mapped to a constant + * in your game code), but could also be a string. It is recommended to keep it light and simple. + * If you need to store complex data about your Game Object, look at using the Data Component instead. + * + * @method Phaser.GameObjects.Layer#setState + * @since 3.50.0 + * + * @param {(number|string)} value - The state of the Game Object. + * + * @return {this} This GameObject. + */ + setState: function (value) + { + this.state = value; - var frameSize = (this.horizontal) ? this.frame.halfHeight : this.frame.halfWidth; + return this; + }, - for (var i = 0; i < total; i++) + /** + * Adds a Data Manager component to this Game Object. + * + * @method Phaser.GameObjects.Layer#setDataEnabled + * @since 3.50.0 + * @see Phaser.Data.DataManager + * + * @return {this} This GameObject. + */ + setDataEnabled: function () + { + if (!this.data) { - var point = points[i]; - var index = i * 4; - - if (i < total - 1) - { - nextPoint = points[i + 1]; - } - else - { - nextPoint = point; - } - - perp.x = nextPoint.y - lastPoint.y; - perp.y = -(nextPoint.x - lastPoint.x); - - var perpLength = perp.length(); - - perp.x /= perpLength; - perp.y /= perpLength; - - perp.x *= frameSize; - perp.y *= frameSize; - - vertices[index] = point.x + perp.x; - vertices[index + 1] = point.y + perp.y; - vertices[index + 2] = point.x - perp.x; - vertices[index + 3] = point.y - perp.y; - - lastPoint = point; + this.data = new DataManager(this); } return this; }, /** - * This method enables rendering of the Rope vertices to the given Graphics instance. + * Allows you to store a key value pair within this Game Objects Data Manager. * - * If you enable this feature, you **must** call `Graphics.clear()` in your Scene `update`, - * otherwise the Graphics instance you provide to debug will fill-up with draw calls, - * eventually crashing the browser. This is not done automatically to allow you to debug - * draw multiple Rope objects to a single Graphics instance. + * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled + * before setting the value. * - * The Rope class has a built-in debug rendering callback `Rope.renderDebugVerts`, however - * you can also provide your own callback to be used instead. Do this by setting the `callback` parameter. + * If the key doesn't already exist in the Data Manager then it is created. * - * The callback is invoked _once per render_ and sent the following parameters: + * ```javascript + * sprite.setData('name', 'Red Gem Stone'); + * ``` * - * `callback(src, meshLength, verts)` + * You can also pass in an object of key value pairs as the first argument: * - * `src` is the Rope instance being debugged. - * `meshLength` is the number of mesh vertices in total. - * `verts` is an array of the translated vertex coordinates. + * ```javascript + * sprite.setData({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 }); + * ``` * - * If using your own callback you do not have to provide a Graphics instance to this method. + * To get a value back again you can call `getData`: * - * To disable debug rendering, to either your own callback or the built-in one, call this method - * with no arguments. + * ```javascript + * sprite.getData('gold'); + * ``` * - * @method Phaser.GameObjects.Rope#setDebug - * @since 3.23.0 + * Or you can access the value directly via the `values` property, where it works like any other variable: * - * @param {Phaser.GameObjects.Graphics} [graphic] - The Graphic instance to render to if using the built-in callback. - * @param {function} [callback] - The callback to invoke during debug render. Leave as undefined to use the built-in callback. + * ```javascript + * sprite.data.values.gold += 50; + * ``` * - * @return {this} This Game Object instance. + * When the value is first set, a `setdata` event is emitted from this Game Object. + * + * If the key already exists, a `changedata` event is emitted instead, along an event named after the key. + * For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`. + * These events will be emitted regardless if you use this method to set the value, or the direct `values` setter. + * + * Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings. + * This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager. + * + * @method Phaser.GameObjects.Layer#setData + * @since 3.50.0 + * + * @param {(string|object)} key - The key to set the value for. Or an object of key value pairs. If an object the `data` argument is ignored. + * @param {*} [data] - The value to set for the given key. If an object is provided as the key this argument is ignored. + * + * @return {this} This GameObject. */ - setDebug: function (graphic, callback) + setData: function (key, value) { - this.debugGraphic = graphic; - - if (!graphic && !callback) - { - this.debugCallback = null; - } - else if (!callback) - { - this.debugCallback = this.renderDebugVerts; - } - else + if (!this.data) { - this.debugCallback = callback; + this.data = new DataManager(this); } + this.data.set(key, value); + return this; }, /** - * The built-in Rope vertices debug rendering method. + * Increase a value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is increased from 0. * - * See `Rope.setDebug` for more details. + * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled + * before setting the value. * - * @method Phaser.GameObjects.Rope#renderDebugVerts - * @since 3.23.0 + * If the key doesn't already exist in the Data Manager then it is created. * - * @param {Phaser.GameObjects.Rope} src - The Rope object being rendered. - * @param {number} meshLength - The number of vertices in the mesh. - * @param {number[]} verts - An array of translated vertex coordinates. + * When the value is first set, a `setdata` event is emitted from this Game Object. + * + * @method Phaser.GameObjects.Layer#incData + * @since 3.50.0 + * + * @param {(string|object)} key - The key to increase the value for. + * @param {*} [data] - The value to increase for the given key. + * + * @return {this} This GameObject. */ - renderDebugVerts: function (src, meshLength, verts) + incData: function (key, value) { - var graphic = src.debugGraphic; - - var px0 = verts[0]; - var py0 = verts[1]; - var px1 = verts[2]; - var py1 = verts[3]; - - graphic.lineBetween(px0, py0, px1, py1); - - for (var i = 4; i < meshLength; i += 4) + if (!this.data) { - var x0 = verts[i + 0]; - var y0 = verts[i + 1]; - var x1 = verts[i + 2]; - var y1 = verts[i + 3]; + this.data = new DataManager(this); + } - graphic.lineBetween(px0, py0, x0, y0); - graphic.lineBetween(px1, py1, x1, y1); - graphic.lineBetween(px1, py1, x0, y0); - graphic.lineBetween(x0, y0, x1, y1); + this.data.inc(key, value); - px0 = x0; - py0 = y0; - px1 = x1; - py1 = y1; - } + return this; }, /** - * Handles the pre-destroy step for the Rope, which removes the Animation component and typed arrays. + * Toggle a boolean value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is toggled from false. * - * @method Phaser.GameObjects.Rope#preDestroy - * @private - * @since 3.23.0 + * If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled + * before setting the value. + * + * If the key doesn't already exist in the Data Manager then it is created. + * + * When the value is first set, a `setdata` event is emitted from this Game Object. + * + * @method Phaser.GameObjects.Layer#toggleData + * @since 3.50.0 + * + * @param {(string|object)} key - The key to toggle the value for. + * + * @return {this} This GameObject. */ - preDestroy: function () + toggleData: function (key) { - this.anims.destroy(); - - this.anims = undefined; + if (!this.data) + { + this.data = new DataManager(this); + } - this.points = null; - this.vertices = null; - this.uv = null; - this.colors = null; - this.alphas = null; + this.data.toggle(key); - this.debugCallback = null; - this.debugGraphic = null; + return this; }, /** - * The horizontally flipped state of the Game Object. + * Retrieves the value for the given key in this Game Objects Data Manager, or undefined if it doesn't exist. * - * A Game Object that is flipped horizontally will render inversed on the horizontal axis. - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. + * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either: * - * @name Phaser.GameObjects.Rope#flipX - * @type {boolean} - * @default false - * @since 3.23.0 + * ```javascript + * sprite.getData('gold'); + * ``` + * + * Or access the value directly: + * + * ```javascript + * sprite.data.values.gold; + * ``` + * + * You can also pass in an array of keys, in which case an array of values will be returned: + * + * ```javascript + * sprite.getData([ 'gold', 'armor', 'health' ]); + * ``` + * + * This approach is useful for destructuring arrays in ES6. + * + * @method Phaser.GameObjects.Layer#getData + * @since 3.50.0 + * + * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys. + * + * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array. */ - flipX: { - - get: function () - { - return this._flipX; - }, - - set: function (value) + getData: function (key) + { + if (!this.data) { - this._flipX = value; - - return this.updateUVs(); + this.data = new DataManager(this); } + return this.data.get(key); }, /** - * The vertically flipped state of the Game Object. + * A Layer cannot be enabled for input. * - * A Game Object that is flipped vertically will render inversed on the vertical axis (i.e. upside down) - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. + * This method does nothing and is kept to ensure + * the Layer has the same shape as a Game Object. * - * @name Phaser.GameObjects.Rope#flipY - * @type {boolean} - * @default false - * @since 3.23.0 - */ - flipY: { - - get: function () - { - return this._flipY; - }, - - set: function (value) - { - this._flipY = value; - - return this.updateUVs(); - } - - } - -}); - -module.exports = Rope; - - -/***/ }), -/* 224 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var AddToDOM = __webpack_require__(142); -var CanvasPool = __webpack_require__(31); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameEvents = __webpack_require__(22); -var GameObject = __webpack_require__(15); -var GetTextSize = __webpack_require__(458); -var GetValue = __webpack_require__(6); -var RemoveFromDOM = __webpack_require__(202); -var TextRender = __webpack_require__(1088); -var TextStyle = __webpack_require__(459); - -/** - * @classdesc - * A Text Game Object. - * - * Text objects work by creating their own internal hidden Canvas and then renders text to it using - * the standard Canvas `fillText` API. It then creates a texture from this canvas which is rendered - * to your game during the render pass. - * - * Because it uses the Canvas API you can take advantage of all the features this offers, such as - * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts - * loaded externally, such as Google or TypeKit Web fonts. - * - * **Important:** The font name must be quoted if it contains certain combinations of digits or - * special characters, either when creating the Text object, or when setting the font via `setFont` - * or `setFontFamily`, e.g.: - * - * ```javascript - * this.add.text(0, 0, 'Hello World', { fontFamily: 'Georgia, "Goudy Bookletter 1911", Times, serif' }); - * ``` - * - * ```javascript - * this.add.text(0, 0, 'Hello World', { font: '"Press Start 2P"' }); - * ``` - * - * You can only display fonts that are currently loaded and available to the browser: therefore fonts must - * be pre-loaded. Phaser does not do ths for you, so you will require the use of a 3rd party font loader, - * or have the fonts ready available in the CSS on the page in which your Phaser game resides. - * - * See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts - * across mobile browsers. - * - * A note on performance: Every time the contents of a Text object changes, i.e. changing the text being - * displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the - * new texture to the GPU. This can be an expensive operation if used often, or with large quantities of - * Text objects in your game. If you run into performance issues you would be better off using Bitmap Text - * instead, as it benefits from batching and avoids expensive Canvas API calls. - * - * @class Text - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.ComputedSize - * @extends Phaser.GameObjects.Components.Crop - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|string[])} text - The text this Text object will display. - * @param {Phaser.Types.GameObjects.Text.TextStyle} style - The text style configuration object. - * - * @see https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#Valid_family_names - */ -var Text = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.ComputedSize, - Components.Crop, - Components.Depth, - Components.Flip, - Components.GetBounds, - Components.Mask, - Components.Origin, - Components.Pipeline, - Components.ScrollFactor, - Components.Tint, - Components.Transform, - Components.Visible, - TextRender - ], - - initialize: - - function Text (scene, x, y, text, style) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - - GameObject.call(this, scene, 'Text'); - - /** - * The renderer in use by this Text object. - * - * @name Phaser.GameObjects.Text#renderer - * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} - * @since 3.12.0 - */ - this.renderer = scene.sys.renderer; - - this.setPosition(x, y); - this.setOrigin(0, 0); - this.initPipeline(); - - /** - * The canvas element that the text is rendered to. - * - * @name Phaser.GameObjects.Text#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas = CanvasPool.create(this); - - /** - * The context of the canvas element that the text is rendered to. - * - * @name Phaser.GameObjects.Text#context - * @type {CanvasRenderingContext2D} - * @since 3.0.0 - */ - this.context = this.canvas.getContext('2d'); - - /** - * The Text Style object. - * - * Manages the style of this Text object. - * - * @name Phaser.GameObjects.Text#style - * @type {Phaser.GameObjects.TextStyle} - * @since 3.0.0 - */ - this.style = new TextStyle(this, style); - - /** - * Whether to automatically round line positions. - * - * @name Phaser.GameObjects.Text#autoRound - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.autoRound = true; - - /** - * The Regular Expression that is used to split the text up into lines, in - * multi-line text. By default this is `/(?:\r\n|\r|\n)/`. - * You can change this RegExp to be anything else that you may need. - * - * @name Phaser.GameObjects.Text#splitRegExp - * @type {object} - * @since 3.0.0 - */ - this.splitRegExp = /(?:\r\n|\r|\n)/; - - /** - * The text to display. - * - * @name Phaser.GameObjects.Text#_text - * @type {string} - * @private - * @since 3.12.0 - */ - this._text = undefined; - - /** - * Specify a padding value which is added to the line width and height when calculating the Text size. - * Allows you to add extra spacing if the browser is unable to accurately determine the true font dimensions. - * - * @name Phaser.GameObjects.Text#padding - * @type {Phaser.Types.GameObjects.Text.TextPadding} - * @since 3.0.0 - */ - this.padding = { left: 0, right: 0, top: 0, bottom: 0 }; - - /** - * The width of this Text object. - * - * @name Phaser.GameObjects.Text#width - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.width = 1; - - /** - * The height of this Text object. - * - * @name Phaser.GameObjects.Text#height - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.height = 1; - - /** - * The line spacing value. - * This value is added to the font height to calculate the overall line height. - * Only has an effect if this Text object contains multiple lines of text. - * - * If you update this property directly, instead of using the `setLineSpacing` method, then - * be sure to call `updateText` after, or you won't see the change reflected in the Text object. - * - * @name Phaser.GameObjects.Text#lineSpacing - * @type {number} - * @since 3.13.0 - */ - this.lineSpacing = 0; - - /** - * Whether the text or its settings have changed and need updating. - * - * @name Phaser.GameObjects.Text#dirty - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.dirty = false; - - // If resolution wasn't set, force it to 1 - if (this.style.resolution === 0) - { - this.style.resolution = 1; - } - - /** - * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. - * - * @name Phaser.GameObjects.Text#_crop - * @type {object} - * @private - * @since 3.12.0 - */ - this._crop = this.resetCropObject(); - - // Create a Texture for this Text object - this.texture = scene.sys.textures.addCanvas(null, this.canvas, true); - - // Get the frame - this.frame = this.texture.get(); - - // Set the resolution - this.frame.source.resolution = this.style.resolution; - - if (this.renderer && this.renderer.gl) - { - // Clear the default 1x1 glTexture, as we override it later - this.renderer.deleteTexture(this.frame.source.glTexture); - - this.frame.source.glTexture = null; - } - - this.initRTL(); - - this.setText(text); - - if (style && style.padding) - { - this.setPadding(style.padding); - } - - if (style && style.lineSpacing) - { - this.setLineSpacing(style.lineSpacing); - } - - scene.sys.game.events.on(GameEvents.CONTEXT_RESTORED, function () - { - this.dirty = true; - }, this); - }, - - /** - * Initialize right to left text. + * @method Phaser.GameObjects.Layer#setInteractive + * @since 3.51.0 * - * @method Phaser.GameObjects.Text#initRTL - * @since 3.0.0 + * @return {this} This GameObject. */ - initRTL: function () + setInteractive: function () { - if (!this.style.rtl) - { - return; - } - - // Here is where the crazy starts. - // - // Due to browser implementation issues, you cannot fillText BiDi text to a canvas - // that is not part of the DOM. It just completely ignores the direction property. - - this.canvas.dir = 'rtl'; - - // Experimental atm, but one day ... - this.context.direction = 'rtl'; - - // Add it to the DOM, but hidden within the parent canvas. - this.canvas.style.display = 'none'; - - AddToDOM(this.canvas, this.scene.sys.canvas); - - // And finally we set the x origin - this.originX = 1; + return this; }, /** - * Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal - * bounds. + * A Layer cannot be enabled for input. * - * @method Phaser.GameObjects.Text#runWordWrap - * @since 3.0.0 + * This method does nothing and is kept to ensure + * the Layer has the same shape as a Game Object. * - * @param {string} text - The text to perform word wrap detection against. + * @method Phaser.GameObjects.Layer#disableInteractive + * @since 3.51.0 * - * @return {string} The text after wrapping has been applied. + * @return {this} This GameObject. */ - runWordWrap: function (text) + disableInteractive: function () { - var style = this.style; - - if (style.wordWrapCallback) - { - var wrappedLines = style.wordWrapCallback.call(style.wordWrapCallbackScope, text, this); - - if (Array.isArray(wrappedLines)) - { - wrappedLines = wrappedLines.join('\n'); - } - - return wrappedLines; - } - else if (style.wordWrapWidth) - { - if (style.wordWrapUseAdvanced) - { - return this.advancedWordWrap(text, this.context, this.style.wordWrapWidth); - } - else - { - return this.basicWordWrap(text, this.context, this.style.wordWrapWidth); - } - } - else - { - return text; - } + return this; }, /** - * Advanced wrapping algorithm that will wrap words as the line grows longer than its horizontal - * bounds. Consecutive spaces will be collapsed and replaced with a single space. Lines will be - * trimmed of white space before processing. Throws an error if wordWrapWidth is less than a - * single character. + * A Layer cannot be enabled for input. * - * @method Phaser.GameObjects.Text#advancedWordWrap - * @since 3.0.0 + * This method does nothing and is kept to ensure + * the Layer has the same shape as a Game Object. * - * @param {string} text - The text to perform word wrap detection against. - * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. - * @param {number} wordWrapWidth - The word wrap width. + * @method Phaser.GameObjects.Layer#removeInteractive + * @since 3.51.0 * - * @return {string} The wrapped text. + * @return {this} This GameObject. */ - advancedWordWrap: function (text, context, wordWrapWidth) + removeInteractive: function () { - var output = ''; - - // Condense consecutive spaces and split into lines - var lines = text - .replace(/ +/gi, ' ') - .split(this.splitRegExp); - - var linesCount = lines.length; - - for (var i = 0; i < linesCount; i++) - { - var line = lines[i]; - var out = ''; - - // Trim whitespace - line = line.replace(/^ *|\s*$/gi, ''); - - // If entire line is less than wordWrapWidth append the entire line and exit early - var lineWidth = context.measureText(line).width; - - if (lineWidth < wordWrapWidth) - { - output += line + '\n'; - continue; - } - - // Otherwise, calculate new lines - var currentLineWidth = wordWrapWidth; - - // Split into words - var words = line.split(' '); - - for (var j = 0; j < words.length; j++) - { - var word = words[j]; - var wordWithSpace = word + ' '; - var wordWidth = context.measureText(wordWithSpace).width; - - if (wordWidth > currentLineWidth) - { - // Break word - if (j === 0) - { - // Shave off letters from word until it's small enough - var newWord = wordWithSpace; - - while (newWord.length) - { - newWord = newWord.slice(0, -1); - wordWidth = context.measureText(newWord).width; - - if (wordWidth <= currentLineWidth) - { - break; - } - } - - // If wordWrapWidth is too small for even a single letter, shame user - // failure with a fatal error - if (!newWord.length) - { - throw new Error('This text\'s wordWrapWidth setting is less than a single character!'); - } - - // Replace current word in array with remainder - var secondPart = word.substr(newWord.length); - - words[j] = secondPart; - - // Append first piece to output - out += newWord; - } - - // If existing word length is 0, don't include it - var offset = (words[j].length) ? j : j + 1; - - // Collapse rest of sentence and remove any trailing white space - var remainder = words.slice(offset).join(' ') - .replace(/[ \n]*$/gi, ''); - - // Prepend remainder to next line - lines[i + 1] = remainder + ' ' + (lines[i + 1] || ''); - linesCount = lines.length; - - break; // Processing on this line - - // Append word with space to output - } - else - { - out += wordWithSpace; - currentLineWidth -= wordWidth; - } - } - - // Append processed line to output - output += out.replace(/[ \n]*$/gi, '') + '\n'; - } - - // Trim the end of the string - output = output.replace(/[\s|\n]*$/gi, ''); - - return output; + return this; }, /** - * Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal - * bounds. Spaces are not collapsed and whitespace is not trimmed. + * This callback is invoked when this Game Object is added to a Scene. * - * @method Phaser.GameObjects.Text#basicWordWrap - * @since 3.0.0 + * Can be overriden by custom Game Objects, but be aware of some Game Objects that + * will use this, such as Sprites, to add themselves into the Update List. * - * @param {string} text - The text to perform word wrap detection against. - * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. - * @param {number} wordWrapWidth - The word wrap width. + * You can also listen for the `ADDED_TO_SCENE` event from this Game Object. * - * @return {string} The wrapped text. + * @method Phaser.GameObjects.Layer#addedToScene + * @since 3.50.0 */ - basicWordWrap: function (text, context, wordWrapWidth) + addedToScene: function () { - var result = ''; - var lines = text.split(this.splitRegExp); - var lastLineIndex = lines.length - 1; - var whiteSpaceWidth = context.measureText(' ').width; - - for (var i = 0; i <= lastLineIndex; i++) - { - var spaceLeft = wordWrapWidth; - var words = lines[i].split(' '); - var lastWordIndex = words.length - 1; - - for (var j = 0; j <= lastWordIndex; j++) - { - var word = words[j]; - var wordWidth = context.measureText(word).width; - var wordWidthWithSpace = wordWidth; - - if (j < lastWordIndex) - { - wordWidthWithSpace += whiteSpaceWidth; - } - - if (wordWidthWithSpace > spaceLeft) - { - // Skip printing the newline if it's the first word of the line that is greater - // than the word wrap width. - if (j > 0) - { - result += '\n'; - spaceLeft = wordWrapWidth; - } - } - - result += word; - - if (j < lastWordIndex) - { - result += ' '; - spaceLeft -= wordWidthWithSpace; - } - else - { - spaceLeft -= wordWidth; - } - } - - if (i < lastLineIndex) - { - result += '\n'; - } - } - - return result; }, /** - * Runs the given text through this Text objects word wrapping and returns the results as an - * array, where each element of the array corresponds to a wrapped line of text. + * This callback is invoked when this Game Object is removed from a Scene. * - * @method Phaser.GameObjects.Text#getWrappedText - * @since 3.0.0 + * Can be overriden by custom Game Objects, but be aware of some Game Objects that + * will use this, such as Sprites, to removed themselves from the Update List. * - * @param {string} text - The text for which the wrapping will be calculated. If unspecified, the Text objects current text will be used. + * You can also listen for the `REMOVED_FROM_SCENE` event from this Game Object. * - * @return {string[]} An array of strings with the pieces of wrapped text. + * @method Phaser.GameObjects.Layer#removedFromScene + * @since 3.50.0 */ - getWrappedText: function (text) + removedFromScene: function () { - if (text === undefined) { text = this._text; } - - this.style.syncFont(this.canvas, this.context); - - var wrappedLines = this.runWordWrap(text); - - return wrappedLines.split(this.splitRegExp); }, /** - * Set the text to display. - * - * An array of strings will be joined with `\n` line breaks. - * - * @method Phaser.GameObjects.Text#setText - * @since 3.0.0 + * To be overridden by custom GameObjects. Allows base objects to be used in a Pool. * - * @param {(string|string[])} value - The string, or array of strings, to be set as the content of this Text object. + * @method Phaser.GameObjects.Layer#update + * @since 3.50.0 * - * @return {this} This Text object. + * @param {...*} [args] - args */ - setText: function (value) + update: function () { - if (!value && value !== 0) - { - value = ''; - } - - if (Array.isArray(value)) - { - value = value.join('\n'); - } - - if (value !== this._text) - { - this._text = value.toString(); - - this.updateText(); - } - - return this; }, /** - * Set the text style. - * - * @example - * text.setStyle({ - * fontSize: '64px', - * fontFamily: 'Arial', - * color: '#ffffff', - * align: 'center', - * backgroundColor: '#ff00ff' - * }); - * - * @method Phaser.GameObjects.Text#setStyle - * @since 3.0.0 + * Returns a JSON representation of the Game Object. * - * @param {object} style - The style settings to set. + * @method Phaser.GameObjects.Layer#toJSON + * @since 3.50.0 * - * @return {this} This Text object. + * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. */ - setStyle: function (style) + toJSON: function () { - return this.style.setStyle(style); + return ComponentsToJSON(this); }, /** - * Set the font. - * - * If a string is given, the font family is set. - * - * If an object is given, the `fontFamily`, `fontSize` and `fontStyle` - * properties of that object are set. - * - * **Important:** The font name must be quoted if it contains certain combinations of digits or - * special characters: - * - * ```javascript - * Text.setFont('"Press Start 2P"'); - * ``` - * - * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all - * quoted properly, too: - * - * ```javascript - * Text.setFont('Georgia, "Goudy Bookletter 1911", Times, serif'); - * ``` - * - * @method Phaser.GameObjects.Text#setFont - * @since 3.0.0 + * Compares the renderMask with the renderFlags to see if this Game Object will render or not. + * Also checks the Game Object against the given Cameras exclusion list. * - * @param {string} font - The font family or font settings to set. + * @method Phaser.GameObjects.Layer#willRender + * @since 3.50.0 * - * @return {this} This Text object. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against this Game Object. * - * @see https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#Valid_family_names + * @return {boolean} True if the Game Object should be rendered, otherwise false. */ - setFont: function (font) + willRender: function (camera) { - return this.style.setFont(font); + return !(this.renderFlags !== 15 || this.list.length === 0 || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); }, /** - * Set the font family. - * - * **Important:** The font name must be quoted if it contains certain combinations of digits or - * special characters: - * - * ```javascript - * Text.setFont('"Press Start 2P"'); - * ``` - * - * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all - * quoted properly, too: - * - * ```javascript - * Text.setFont('Georgia, "Goudy Bookletter 1911", Times, serif'); - * ``` - * - * @method Phaser.GameObjects.Text#setFontFamily - * @since 3.0.0 + * Returns an array containing the display list index of either this Game Object, or if it has one, + * its parent Container. It then iterates up through all of the parent containers until it hits the + * root of the display list (which is index 0 in the returned array). * - * @param {string} family - The font family. + * Used internally by the InputPlugin but also useful if you wish to find out the display depth of + * this Game Object and all of its ancestors. * - * @return {this} This Text object. + * @method Phaser.GameObjects.Layer#getIndexList + * @since 3.51.0 * - * @see https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#Valid_family_names + * @return {number[]} An array of display list position indexes. */ - setFontFamily: function (family) + getIndexList: function () { - return this.style.setFontFamily(family); - }, + // eslint-disable-next-line consistent-this + var child = this; + var parent = this.parentContainer; - /** - * Set the font size. - * - * @method Phaser.GameObjects.Text#setFontSize - * @since 3.0.0 - * - * @param {number} size - The font size. - * - * @return {this} This Text object. - */ - setFontSize: function (size) - { - return this.style.setFontSize(size); + var indexes = []; + + while (parent) + { + indexes.unshift(parent.getIndex(child)); + + child = parent; + + if (!parent.parentContainer) + { + break; + } + else + { + parent = parent.parentContainer; + } + } + + indexes.unshift(this.displayList.getIndex(child)); + + return indexes; }, /** - * Set the font style. - * - * @method Phaser.GameObjects.Text#setFontStyle - * @since 3.0.0 + * Internal method called from `List.addCallback`. * - * @param {string} style - The font style. + * @method Phaser.GameObjects.Layer#addChildCallback + * @private + * @fires Phaser.Scenes.Events#ADDED_TO_SCENE + * @fires Phaser.GameObjects.Events#ADDED_TO_SCENE + * @since 3.50.0 * - * @return {this} This Text object. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was added to the list. */ - setFontStyle: function (style) + addChildCallback: function (gameObject) { - return this.style.setFontStyle(style); + if (gameObject.displayList && gameObject.displayList !== this) + { + gameObject.removeFromDisplayList(); + } + + if (!gameObject.displayList) + { + this.queueDepthSort(); + + gameObject.displayList = this; + + gameObject.emit(GameObjectEvents.ADDED_TO_SCENE, gameObject, this.scene); + + this.events.emit(SceneEvents.ADDED_TO_SCENE, gameObject, this.scene); + } }, /** - * Set a fixed width and height for the text. - * - * Pass in `0` for either of these parameters to disable fixed width or height respectively. - * - * @method Phaser.GameObjects.Text#setFixedSize - * @since 3.0.0 + * Internal method called from `List.removeCallback`. * - * @param {number} width - The fixed width to set. `0` disables fixed width. - * @param {number} height - The fixed height to set. `0` disables fixed height. + * @method Phaser.GameObjects.Layer#removeChildCallback + * @private + * @fires Phaser.Scenes.Events#REMOVED_FROM_SCENE + * @fires Phaser.GameObjects.Events#REMOVED_FROM_SCENE + * @since 3.50.0 * - * @return {this} This Text object. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was removed from the list. */ - setFixedSize: function (width, height) + removeChildCallback: function (gameObject) { - return this.style.setFixedSize(width, height); + this.queueDepthSort(); + + gameObject.displayList = null; + + gameObject.emit(GameObjectEvents.REMOVED_FROM_SCENE, gameObject, this.scene); + + this.events.emit(SceneEvents.REMOVED_FROM_SCENE, gameObject, this.scene); }, /** - * Set the background color. - * - * @method Phaser.GameObjects.Text#setBackgroundColor - * @since 3.0.0 - * - * @param {string} color - The background color. + * Force a sort of the display list on the next call to depthSort. * - * @return {this} This Text object. + * @method Phaser.GameObjects.Layer#queueDepthSort + * @since 3.50.0 */ - setBackgroundColor: function (color) + queueDepthSort: function () { - return this.style.setBackgroundColor(color); + this.sortChildrenFlag = true; }, /** - * Set the fill style to be used by the Text object. - * - * This can be any valid CanvasRenderingContext2D fillStyle value, such as - * a color (in hex, rgb, rgba, hsl or named values), a gradient or a pattern. - * - * See the [MDN fillStyle docs](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle) for more details. - * - * @method Phaser.GameObjects.Text#setFill - * @since 3.0.0 - * - * @param {(string|any)} color - The text fill style. Can be any valid CanvasRenderingContext `fillStyle` value. + * Immediately sorts the display list if the flag is set. * - * @return {this} This Text object. + * @method Phaser.GameObjects.Layer#depthSort + * @since 3.50.0 */ - setFill: function (fillStyle) + depthSort: function () { - return this.style.setFill(fillStyle); + if (this.sortChildrenFlag) + { + StableSort(this.list, this.sortByDepth); + + this.sortChildrenFlag = false; + } }, /** - * Set the text fill color. + * Compare the depth of two Game Objects. * - * @method Phaser.GameObjects.Text#setColor - * @since 3.0.0 + * @method Phaser.GameObjects.Layer#sortByDepth + * @since 3.50.0 * - * @param {string} color - The text fill color. + * @param {Phaser.GameObjects.GameObject} childA - The first Game Object. + * @param {Phaser.GameObjects.GameObject} childB - The second Game Object. * - * @return {this} This Text object. + * @return {number} The difference between the depths of each Game Object. */ - setColor: function (color) + sortByDepth: function (childA, childB) { - return this.style.setColor(color); + return childA._depth - childB._depth; }, /** - * Set the stroke settings. + * Returns an array which contains all Game Objects within this Layer. * - * @method Phaser.GameObjects.Text#setStroke - * @since 3.0.0 + * This is a reference to the main list array, not a copy of it, so be careful not to modify it. * - * @param {string} color - The stroke color. - * @param {number} thickness - The stroke thickness. + * @method Phaser.GameObjects.Layer#getChildren + * @since 3.50.0 * - * @return {this} This Text object. + * @return {Phaser.GameObjects.GameObject[]} The group members. */ - setStroke: function (color, thickness) + getChildren: function () { - return this.style.setStroke(color, thickness); + return this.list; }, /** - * Set the shadow settings. - * - * @method Phaser.GameObjects.Text#setShadow - * @since 3.0.0 + * Adds this Layer to the given Display List. * - * @param {number} [x=0] - The horizontal shadow offset. - * @param {number} [y=0] - The vertical shadow offset. - * @param {string} [color='#000'] - The shadow color. - * @param {number} [blur=0] - The shadow blur radius. - * @param {boolean} [shadowStroke=false] - Whether to stroke the shadow. - * @param {boolean} [shadowFill=true] - Whether to fill the shadow. + * If no Display List is specified, it will default to the Display List owned by the Scene to which + * this Layer belongs. * - * @return {this} This Text object. - */ - setShadow: function (x, y, color, blur, shadowStroke, shadowFill) - { - return this.style.setShadow(x, y, color, blur, shadowStroke, shadowFill); - }, - - /** - * Set the shadow offset. + * A Layer can only exist on one Display List at any given time, but may move freely between them. * - * @method Phaser.GameObjects.Text#setShadowOffset - * @since 3.0.0 + * If this Layer is already on another Display List when this method is called, it will first + * be removed from it, before being added to the new list. * - * @param {number} x - The horizontal shadow offset. - * @param {number} y - The vertical shadow offset. + * You can query which list it is on by looking at the `Phaser.GameObjects.Layer#displayList` property. * - * @return {this} This Text object. - */ - setShadowOffset: function (x, y) - { - return this.style.setShadowOffset(x, y); - }, - - /** - * Set the shadow color. + * If a Layer isn't on any display list, it will not be rendered. If you just wish to temporarily + * disable it from rendering, consider using the `setVisible` method, instead. * - * @method Phaser.GameObjects.Text#setShadowColor - * @since 3.0.0 + * @method Phaser.GameObjects.Layer#addToDisplayList + * @fires Phaser.Scenes.Events#ADDED_TO_SCENE + * @fires Phaser.GameObjects.Events#ADDED_TO_SCENE + * @since 3.60.0 * - * @param {string} color - The shadow color. + * @param {(Phaser.GameObjects.DisplayList|Phaser.GameObjects.Layer)} [displayList] - The Display List to add to. Defaults to the Scene Display List. * - * @return {this} This Text object. + * @return {this} This Layer. */ - setShadowColor: function (color) + addToDisplayList: function (displayList) { - return this.style.setShadowColor(color); + if (displayList === undefined) { displayList = this.scene.sys.displayList; } + + if (this.displayList && this.displayList !== displayList) + { + this.removeFromDisplayList(); + } + + // Don't repeat if it's already on this list + if (!displayList.exists(this)) + { + this.displayList = displayList; + + displayList.add(this, true); + + displayList.queueDepthSort(); + + this.emit(GameObjectEvents.ADDED_TO_SCENE, this, this.scene); + + displayList.events.emit(SceneEvents.ADDED_TO_SCENE, this, this.scene); + } + + return this; }, /** - * Set the shadow blur radius. - * - * @method Phaser.GameObjects.Text#setShadowBlur - * @since 3.0.0 + * Removes this Layer from the Display List it is currently on. * - * @param {number} blur - The shadow blur radius. + * A Layer can only exist on one Display List at any given time, but may move freely removed + * and added back at a later stage. * - * @return {this} This Text object. - */ - setShadowBlur: function (blur) - { - return this.style.setShadowBlur(blur); - }, - - /** - * Enable or disable shadow stroke. + * You can query which list it is on by looking at the `Phaser.GameObjects.GameObject#displayList` property. * - * @method Phaser.GameObjects.Text#setShadowStroke - * @since 3.0.0 + * If a Layer isn't on any Display List, it will not be rendered. If you just wish to temporarily + * disable it from rendering, consider using the `setVisible` method, instead. * - * @param {boolean} enabled - Whether shadow stroke is enabled or not. + * @method Phaser.GameObjects.Layer#removeFromDisplayList + * @fires Phaser.Scenes.Events#REMOVED_FROM_SCENE + * @fires Phaser.GameObjects.Events#REMOVED_FROM_SCENE + * @since 3.60.0 * - * @return {this} This Text object. + * @return {this} This Layer. */ - setShadowStroke: function (enabled) + removeFromDisplayList: function () { - return this.style.setShadowStroke(enabled); + var displayList = this.displayList || this.scene.sys.displayList; + + if (displayList.exists(this)) + { + displayList.remove(this, true); + + displayList.queueDepthSort(); + + this.displayList = null; + + this.emit(GameObjectEvents.REMOVED_FROM_SCENE, this, this.scene); + + displayList.events.emit(SceneEvents.REMOVED_FROM_SCENE, this, this.scene); + } + + return this; }, /** - * Enable or disable shadow fill. + * Destroys this Layer removing it from the Display List and Update List and + * severing all ties to parent resources. * - * @method Phaser.GameObjects.Text#setShadowFill - * @since 3.0.0 + * Also destroys all children of this Layer. If you do not wish for the + * children to be destroyed, you should move them from this Layer first. * - * @param {boolean} enabled - Whether shadow fill is enabled or not. + * Use this to remove this Layer from your game if you don't ever plan to use it again. + * As long as no reference to it exists within your own code it should become free for + * garbage collection by the browser. * - * @return {this} This Text object. + * If you just want to temporarily disable an object then look at using the + * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected. + * + * @method Phaser.GameObjects.Layer#destroy + * @fires Phaser.GameObjects.Events#DESTROY + * @since 3.50.0 + * + * @param {boolean} [fromScene=false] - `True` if this Game Object is being destroyed by the Scene, `false` if not. */ - setShadowFill: function (enabled) + destroy: function (fromScene) { - return this.style.setShadowFill(enabled); - }, + // This Game Object has already been destroyed + if (!this.scene || this.ignoreDestroy) + { + return; + } - /** - * Set the width (in pixels) to use for wrapping lines. Pass in null to remove wrapping by width. - * - * @method Phaser.GameObjects.Text#setWordWrapWidth - * @since 3.0.0 - * - * @param {?number} width - The maximum width of a line in pixels. Set to null to remove wrapping. - * @param {boolean} [useAdvancedWrap=false] - Whether or not to use the advanced wrapping - * algorithm. If true, spaces are collapsed and whitespace is trimmed from lines. If false, - * spaces and whitespace are left as is. - * - * @return {this} This Text object. - */ - setWordWrapWidth: function (width, useAdvancedWrap) - { - return this.style.setWordWrapWidth(width, useAdvancedWrap); - }, + this.emit(GameObjectEvents.DESTROY, this); - /** - * Set a custom callback for wrapping lines. Pass in null to remove wrapping by callback. - * - * @method Phaser.GameObjects.Text#setWordWrapCallback - * @since 3.0.0 - * - * @param {TextStyleWordWrapCallback} callback - A custom function that will be responsible for wrapping the - * text. It will receive two arguments: text (the string to wrap), textObject (this Text - * instance). It should return the wrapped lines either as an array of lines or as a string with - * newline characters in place to indicate where breaks should happen. - * @param {object} [scope=null] - The scope that will be applied when the callback is invoked. - * - * @return {this} This Text object. - */ - setWordWrapCallback: function (callback, scope) - { - return this.style.setWordWrapCallback(callback, scope); - }, + var list = this.list; - /** - * Set the alignment of the text in this Text object. - * - * The argument can be one of: `left`, `right`, `center` or `justify`. - * - * Alignment only works if the Text object has more than one line of text. - * - * @method Phaser.GameObjects.Text#setAlign - * @since 3.0.0 - * - * @param {string} [align='left'] - The text alignment for multi-line text. - * - * @return {this} This Text object. - */ - setAlign: function (align) - { - return this.style.setAlign(align); - }, + while (list.length) + { + list[0].destroy(fromScene); + } - /** - * Set the resolution used by this Text object. - * - * By default it will be set to match the resolution set in the Game Config, - * but you can override it via this method, or by specifying it in the Text style configuration object. - * - * It allows for much clearer text on High DPI devices, at the cost of memory because it uses larger - * internal Canvas textures for the Text. - * - * Therefore, please use with caution, as the more high res Text you have, the more memory it uses. - * - * @method Phaser.GameObjects.Text#setResolution - * @since 3.12.0 - * - * @param {number} value - The resolution for this Text object to use. - * - * @return {this} This Text object. - */ - setResolution: function (value) - { - return this.style.setResolution(value); - }, + this.removeAllListeners(); - /** - * Sets the line spacing value. - * - * This value is _added_ to the height of the font when calculating the overall line height. - * This only has an effect if this Text object consists of multiple lines of text. - * - * @method Phaser.GameObjects.Text#setLineSpacing - * @since 3.13.0 - * - * @param {number} value - The amount to add to the font height to achieve the overall line height. - * - * @return {this} This Text object. - */ - setLineSpacing: function (value) - { - this.lineSpacing = value; + this.resetPostPipeline(true); - return this.updateText(); - }, + if (this.displayList) + { + this.displayList.remove(this, true); - /** - * Set the text padding. - * - * 'left' can be an object. - * - * If only 'left' and 'top' are given they are treated as 'x' and 'y'. - * - * @method Phaser.GameObjects.Text#setPadding - * @since 3.0.0 - * - * @param {(number|Phaser.Types.GameObjects.Text.TextPadding)} left - The left padding value, or a padding config object. - * @param {number} [top] - The top padding value. - * @param {number} [right] - The right padding value. - * @param {number} [bottom] - The bottom padding value. - * - * @return {this} This Text object. - */ - setPadding: function (left, top, right, bottom) - { - if (typeof left === 'object') + this.displayList.queueDepthSort(); + } + + if (this.data) { - var config = left; + this.data.destroy(); - // If they specify x and/or y this applies to all - var x = GetValue(config, 'x', null); + this.data = undefined; + } - if (x !== null) - { - left = x; - right = x; - } - else - { - left = GetValue(config, 'left', 0); - right = GetValue(config, 'right', left); - } + this.active = false; + this.visible = false; - var y = GetValue(config, 'y', null); + this.list = undefined; + this.scene = undefined; + this.displayList = undefined; + this.systems = undefined; + this.events = undefined; + } - if (y !== null) - { - top = y; - bottom = y; - } - else - { - top = GetValue(config, 'top', 0); - bottom = GetValue(config, 'bottom', top); - } - } - else - { - if (left === undefined) { left = 0; } - if (top === undefined) { top = left; } - if (right === undefined) { right = left; } - if (bottom === undefined) { bottom = top; } - } +}); - this.padding.left = left; - this.padding.top = top; - this.padding.right = right; - this.padding.bottom = bottom; +module.exports = Layer; - return this.updateText(); - }, - /** - * Set the maximum number of lines to draw. - * - * @method Phaser.GameObjects.Text#setMaxLines - * @since 3.0.0 - * - * @param {number} [max=0] - The maximum number of lines to draw. - * - * @return {this} This Text object. - */ - setMaxLines: function (max) +/***/ }), + +/***/ 834: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Layer#renderCanvas + * @since 3.50.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Layer} layer - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var LayerCanvasRenderer = function (renderer, layer, camera) +{ + var children = layer.list; + + if (children.length === 0) { - return this.style.setMaxLines(max); - }, + return; + } - /** - * Update the displayed text. - * - * @method Phaser.GameObjects.Text#updateText - * @since 3.0.0 - * - * @return {this} This Text object. - */ - updateText: function () + layer.depthSort(); + + var layerHasBlendMode = (layer.blendMode !== -1); + + if (!layerHasBlendMode) { - var canvas = this.canvas; - var context = this.context; - var style = this.style; - var resolution = style.resolution; - var size = style.metrics; + // If Layer is SKIP_TEST then set blend mode to be Normal + renderer.setBlendMode(0); + } - style.syncFont(canvas, context); + var alpha = layer._alpha; - var outputText = this._text; + if (layer.mask) + { + layer.mask.preRenderCanvas(renderer, null, camera); + } - if (style.wordWrapWidth || style.wordWrapCallback) + for (var i = 0; i < children.length; i++) + { + var child = children[i]; + + if (!child.willRender(camera)) { - outputText = this.runWordWrap(this._text); + continue; } - // Split text into lines - var lines = outputText.split(this.splitRegExp); + var childAlpha = child.alpha; - var textSize = GetTextSize(this, size, lines); + if (!layerHasBlendMode && child.blendMode !== renderer.currentBlendMode) + { + // If Layer doesn't have its own blend mode, then a child can have one + renderer.setBlendMode(child.blendMode); + } - var padding = this.padding; + // Set parent values + child.setAlpha(childAlpha * alpha); - var textWidth; + // Render + child.renderCanvas(renderer, child, camera); - if (style.fixedWidth === 0) - { - this.width = textSize.width + padding.left + padding.right; + // Restore original values + child.setAlpha(childAlpha); + } - textWidth = textSize.width; - } - else - { - this.width = style.fixedWidth; + if (layer.mask) + { + layer.mask.postRenderCanvas(renderer); + } +}; - textWidth = this.width - padding.left - padding.right; +module.exports = LayerCanvasRenderer; - if (textWidth < textSize.width) - { - textWidth = textSize.width; - } - } - if (style.fixedHeight === 0) - { - this.height = textSize.height + padding.top + padding.bottom; - } - else - { - this.height = style.fixedHeight; - } +/***/ }), - var w = this.width; - var h = this.height; +/***/ 56378: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - this.updateDisplayOrigin(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - w *= resolution; - h *= resolution; +var BuildGameObject = __webpack_require__(88933); +var Layer = __webpack_require__(85305); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); - w = Math.max(w, 1); - h = Math.max(h, 1); +/** + * Creates a new Layer Game Object and returns it. + * + * Note: This method will only be available if the Layer Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#layer + * @since 3.50.0 + * + * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Layer} The Game Object that was created. + */ +GameObjectCreator.register('layer', function (config, addToScene) +{ + if (config === undefined) { config = {}; } - if (canvas.width !== w || canvas.height !== h) - { - canvas.width = w; - canvas.height = h; + var children = GetAdvancedValue(config, 'children', null); - this.frame.setSize(w, h); + var layer = new Layer(this.scene, children); - // Because resizing the canvas resets the context - style.syncFont(canvas, context); - } - else - { - context.clearRect(0, 0, w, h); - } + if (addToScene !== undefined) + { + config.add = addToScene; + } - context.save(); + BuildGameObject(this.scene, layer, config); - context.scale(resolution, resolution); + return layer; +}); - if (style.backgroundColor) - { - context.fillStyle = style.backgroundColor; - context.fillRect(0, 0, w, h); - } - style.syncStyle(canvas, context); +/***/ }), - context.textBaseline = 'alphabetic'; +/***/ 17676: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - // Apply padding - context.translate(padding.left, padding.top); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var linePositionX; - var linePositionY; +var Layer = __webpack_require__(85305); +var GameObjectFactory = __webpack_require__(61286); - // Draw text line by line - for (var i = 0; i < textSize.lines; i++) - { - linePositionX = style.strokeThickness / 2; - linePositionY = (style.strokeThickness / 2 + i * textSize.lineHeight) + size.ascent; +/** + * Creates a new Layer Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Layer Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#layer + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Layer. + * + * @return {Phaser.GameObjects.Layer} The Game Object that was created. + */ +GameObjectFactory.register('layer', function (children) +{ + return this.displayList.add(new Layer(this.scene, children)); +}); - if (i > 0) - { - linePositionY += (textSize.lineSpacing * i); - } - if (style.rtl) - { - linePositionX = w - linePositionX; - } - else if (style.align === 'right') - { - linePositionX += textWidth - textSize.lineWidths[i]; - } - else if (style.align === 'center') - { - linePositionX += (textWidth - textSize.lineWidths[i]) / 2; - } - else if (style.align === 'justify') - { - // To justify text line its width must be no less than 85% of defined width - var minimumLengthToApplyJustification = 0.85; +/***/ }), - if (textSize.lineWidths[i] / textSize.width >= minimumLengthToApplyJustification) - { - var extraSpace = textSize.width - textSize.lineWidths[i]; - var spaceSize = context.measureText(' ').width; - var trimmedLine = lines[i].trim(); - var array = trimmedLine.split(' '); +/***/ 58010: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - extraSpace += (lines[i].length - trimmedLine.length) * spaceSize; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var extraSpaceCharacters = Math.floor(extraSpace / spaceSize); - var idx = 0; +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - while (extraSpaceCharacters > 0) - { - array[idx] += ' '; - idx = (idx + 1) % (array.length - 1 || 1); - --extraSpaceCharacters; - } +if (true) +{ + renderWebGL = __webpack_require__(17576); +} - lines[i] = array.join(' '); - } - } +if (true) +{ + renderCanvas = __webpack_require__(834); +} - if (this.autoRound) - { - linePositionX = Math.round(linePositionX); - linePositionY = Math.round(linePositionY); - } +module.exports = { - if (style.strokeThickness) - { - this.style.syncShadow(context, style.shadowStroke); + renderWebGL: renderWebGL, + renderCanvas: renderCanvas - context.strokeText(lines[i], linePositionX, linePositionY); - } +}; - if (style.color) - { - this.style.syncShadow(context, style.shadowFill); - context.fillText(lines[i], linePositionX, linePositionY); - } - } +/***/ }), - context.restore(); +/***/ 17576: +/***/ ((module) => { - if (this.renderer && this.renderer.gl) - { - this.frame.source.glTexture = this.renderer.canvasToTexture(canvas, this.frame.source.glTexture, true); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.frame.glTexture = this.frame.source.glTexture; - } +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Layer#renderWebGL + * @since 3.50.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Layer} layer - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var LayerWebGLRenderer = function (renderer, layer, camera) +{ + var children = layer.list; + var childCount = children.length; - this.dirty = true; + if (childCount === 0) + { + return; + } - var input = this.input; + layer.depthSort(); - if (input && !input.customHitArea) - { - input.hitArea.width = this.width; - input.hitArea.height = this.height; - } + renderer.pipelines.preBatch(layer); - return this; - }, + var layerHasBlendMode = (layer.blendMode !== -1); - /** - * Get the current text metrics. - * - * @method Phaser.GameObjects.Text#getTextMetrics - * @since 3.0.0 - * - * @return {Phaser.Types.GameObjects.Text.TextMetrics} The text metrics. - */ - getTextMetrics: function () + if (!layerHasBlendMode) { - return this.style.getTextMetrics(); - }, + // If Layer is SKIP_TEST then set blend mode to be Normal + renderer.setBlendMode(0); + } - /** - * The text string being rendered by this Text Game Object. - * - * @name Phaser.GameObjects.Text#text - * @type {string} - * @since 3.0.0 - */ - text: { + var alpha = layer.alpha; - get: function () - { - return this._text; - }, + for (var i = 0; i < childCount; i++) + { + var child = children[i]; - set: function (value) + if (!child.willRender(camera)) { - this.setText(value); + continue; } - }, + var childAlphaTopLeft; + var childAlphaTopRight; + var childAlphaBottomLeft; + var childAlphaBottomRight; - /** - * Build a JSON representation of the Text object. - * - * @method Phaser.GameObjects.Text#toJSON - * @since 3.0.0 - * - * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Text object. - */ - toJSON: function () - { - var out = Components.ToJSON(this); + if (child.alphaTopLeft !== undefined) + { + childAlphaTopLeft = child.alphaTopLeft; + childAlphaTopRight = child.alphaTopRight; + childAlphaBottomLeft = child.alphaBottomLeft; + childAlphaBottomRight = child.alphaBottomRight; + } + else + { + var childAlpha = child.alpha; - // Extra Text data is added here + childAlphaTopLeft = childAlpha; + childAlphaTopRight = childAlpha; + childAlphaBottomLeft = childAlpha; + childAlphaBottomRight = childAlpha; + } - var data = { - autoRound: this.autoRound, - text: this._text, - style: this.style.toJSON(), - padding: { - left: this.padding.left, - right: this.padding.right, - top: this.padding.top, - bottom: this.padding.bottom - } - }; + if (!layerHasBlendMode && child.blendMode !== renderer.currentBlendMode) + { + // If Layer doesn't have its own blend mode, then a child can have one + renderer.setBlendMode(child.blendMode); + } - out.data = data; + var mask = child.mask; - return out; - }, + if (mask) + { + mask.preRenderWebGL(renderer, child, camera); + } - /** - * Internal destroy handler, called as part of the destroy process. - * - * @method Phaser.GameObjects.Text#preDestroy - * @protected - * @since 3.0.0 - */ - preDestroy: function () - { - if (this.style.rtl) + var type = child.type; + + if (type !== renderer.currentType) { - RemoveFromDOM(this.canvas); + renderer.newType = true; + renderer.currentType = type; } - CanvasPool.remove(this.canvas); + renderer.nextTypeMatch = (i < childCount - 1) ? (children[i + 1].type === renderer.currentType) : false; - this.texture.destroy(); - } + child.setAlpha(childAlphaTopLeft * alpha, childAlphaTopRight * alpha, childAlphaBottomLeft * alpha, childAlphaBottomRight * alpha); - /** - * The horizontal origin of this Game Object. - * The origin maps the relationship between the size and position of the Game Object. - * The default value is 0.5, meaning all Game Objects are positioned based on their center. - * Setting the value to 0 means the position now relates to the left of the Game Object. - * - * @name Phaser.GameObjects.Text#originX - * @type {number} - * @default 0 - * @since 3.0.0 - */ + // Render + child.renderWebGL(renderer, child, camera); - /** - * The vertical origin of this Game Object. - * The origin maps the relationship between the size and position of the Game Object. - * The default value is 0.5, meaning all Game Objects are positioned based on their center. - * Setting the value to 0 means the position now relates to the top of the Game Object. - * - * @name Phaser.GameObjects.Text#originY - * @type {number} - * @default 0 - * @since 3.0.0 - */ + // Restore original values + child.setAlpha(childAlphaTopLeft, childAlphaTopRight, childAlphaBottomLeft, childAlphaBottomRight); -}); + if (mask) + { + mask.postRenderWebGL(renderer, camera); + } -module.exports = Text; + renderer.newType = false; + } + + renderer.pipelines.postBatch(layer); +}; + +module.exports = LayerWebGLRenderer; /***/ }), -/* 225 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 14455: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(31); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameEvents = __webpack_require__(22); -var GameObject = __webpack_require__(15); -var GetPowerOfTwo = __webpack_require__(361); -var Smoothing = __webpack_require__(192); -var TileSpriteRender = __webpack_require__(1091); -var Vector2 = __webpack_require__(3); - -// bitmask flag for GameObject.renderMask -var _FLAG = 8; // 1000 +var Circle = __webpack_require__(26673); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var RGB = __webpack_require__(39298); +var Utils = __webpack_require__(75512); /** * @classdesc - * A TileSprite is a Sprite that has a repeating texture. + * A 2D point light. * - * The texture can be scrolled and scaled independently of the TileSprite itself. Textures will automatically wrap and - * are designed so that you can create game backdrops using seamless textures as a source. + * These are typically created by a {@link Phaser.GameObjects.LightsManager}, available from within a scene via `this.lights`. * - * You shouldn't ever create a TileSprite any larger than your actual canvas size. If you want to create a large repeating background - * that scrolls across the whole map of your game, then you create a TileSprite that fits the canvas size and then use the `tilePosition` - * property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will - * consume huge amounts of memory and cause performance issues. Remember: use `tilePosition` to scroll your texture and `tileScale` to - * adjust the scale of the texture - don't resize the sprite itself or make it larger than it needs. + * Any Game Objects using the Light2D pipeline will then be affected by these Lights as long as they have a normal map. * - * An important note about Tile Sprites and NPOT textures: Internally, TileSprite textures use GL_REPEAT to provide - * seamless repeating of the textures. This, combined with the way in which the textures are handled in WebGL, means - * they need to be POT (power-of-two) sizes in order to wrap. If you provide a NPOT (non power-of-two) texture to a - * TileSprite it will generate a POT sized canvas and draw your texture to it, scaled up to the POT size. It's then - * scaled back down again during rendering to the original dimensions. While this works, in that it allows you to use - * any size texture for a Tile Sprite, it does mean that NPOT textures are going to appear anti-aliased when rendered, - * due to the interpolation that took place when it was resized into a POT texture. This is especially visible in - * pixel art graphics. If you notice it and it becomes an issue, the only way to avoid it is to ensure that you - * provide POT textures for Tile Sprites. + * They can also simply be used to represent a point light for your own purposes. * - * @class TileSprite - * @extends Phaser.GameObjects.GameObject + * As of Phaser 3.60 this Game Object now has the Transform and Origin components. However, changing the scale, + * rotation or origin properties will not make any difference to the Light. They are simply present to allow you + * to add this Light to a Container, or enable it for Physics. + * + * @class Light + * @extends Phaser.Geom.Circle * @memberof Phaser.GameObjects * @constructor * @since 3.0.0 * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.ComputedSize - * @extends Phaser.GameObjects.Components.Crop - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Mask * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Tint * @extends Phaser.GameObjects.Components.Transform * @extends Phaser.GameObjects.Components.Visible * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {number} width - The width of the Game Object. If zero it will use the size of the texture frame. - * @param {number} height - The height of the Game Object. If zero it will use the size of the texture frame. - * @param {string} textureKey - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frameKey] - An optional frame from the Texture this Game Object is rendering with. + * @param {number} x - The horizontal position of the light. + * @param {number} y - The vertical position of the light. + * @param {number} radius - The radius of the light. + * @param {number} r - The red color of the light. A value between 0 and 1. + * @param {number} g - The green color of the light. A value between 0 and 1. + * @param {number} b - The blue color of the light. A value between 0 and 1. + * @param {number} intensity - The intensity of the light. */ -var TileSprite = new Class({ +var Light = new Class({ - Extends: GameObject, + Extends: Circle, Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.ComputedSize, - Components.Crop, - Components.Depth, - Components.Flip, - Components.GetBounds, - Components.Mask, Components.Origin, - Components.Pipeline, Components.ScrollFactor, - Components.Tint, Components.Transform, - Components.Visible, - TileSpriteRender + Components.Visible ], initialize: - function TileSprite (scene, x, y, width, height, textureKey, frameKey) + function Light (x, y, radius, r, g, b, intensity) { - var renderer = scene.sys.renderer; - - GameObject.call(this, scene, 'TileSprite'); - - var displayTexture = scene.sys.textures.get(textureKey); - var displayFrame = displayTexture.get(frameKey); - - if (!width || !height) - { - width = displayFrame.width; - height = displayFrame.height; - } - else - { - width = Math.floor(width); - height = Math.floor(height); - } + Circle.call(this, x, y, radius); /** - * Internal tile position vector. + * The color of the light. * - * @name Phaser.GameObjects.TileSprite#_tilePosition - * @type {Phaser.Math.Vector2} - * @private - * @since 3.12.0 + * @name Phaser.GameObjects.Light#color + * @type {Phaser.Display.RGB} + * @since 3.50.0 */ - this._tilePosition = new Vector2(); + this.color = new RGB(r, g, b); /** - * Internal tile scale vector. + * The intensity of the light. * - * @name Phaser.GameObjects.TileSprite#_tileScale - * @type {Phaser.Math.Vector2} - * @private - * @since 3.12.0 + * @name Phaser.GameObjects.Light#intensity + * @type {number} + * @since 3.50.0 */ - this._tileScale = new Vector2(1, 1); + this.intensity = intensity; /** - * Whether the Tile Sprite has changed in some way, requiring an re-render of its tile texture. - * - * Such changes include the texture frame and scroll position of the Tile Sprite. + * The flags that are compared against `RENDER_MASK` to determine if this Game Object will render or not. + * The bits are 0001 | 0010 | 0100 | 1000 set by the components Visible, Alpha, Transform and Texture respectively. + * If those components are not used by your custom class then you can use this bitmask as you wish. * - * @name Phaser.GameObjects.TileSprite#dirty - * @type {boolean} - * @default false + * @name Phaser.GameObjects.Light#renderFlags + * @type {number} + * @default 15 * @since 3.0.0 */ - this.dirty = false; + this.renderFlags = 15; /** - * The renderer in use by this Tile Sprite. + * A bitmask that controls if this Game Object is drawn by a Camera or not. + * Not usually set directly, instead call `Camera.ignore`, however you can + * set this property directly using the Camera.id property: * - * @name Phaser.GameObjects.TileSprite#renderer - * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} + * @example + * this.cameraFilter |= camera.id + * + * @name Phaser.GameObjects.Light#cameraFilter + * @type {number} + * @default 0 * @since 3.0.0 */ - this.renderer = renderer; + this.cameraFilter = 0; - /** - * The Canvas element that the TileSprite renders its fill pattern in to. - * Only used in Canvas mode. - * - * @name Phaser.GameObjects.TileSprite#canvas - * @type {?HTMLCanvasElement} - * @since 3.12.0 - */ - this.canvas = CanvasPool.create(this, width, height); + this.setScrollFactor(1, 1); + this.setOrigin(); + this.setDisplayOrigin(radius); + }, - /** - * The Context of the Canvas element that the TileSprite renders its fill pattern in to. - * Only used in Canvas mode. - * - * @name Phaser.GameObjects.TileSprite#context - * @type {CanvasRenderingContext2D} - * @since 3.12.0 - */ - this.context = this.canvas.getContext('2d'); + /** + * The width of this Light Game Object. This is the same as `Light.diameter`. + * + * @name Phaser.GameObjects.Light#displayWidth + * @type {number} + * @since 3.60.0 + */ + displayWidth: { - /** - * The Texture the TileSprite is using as its fill pattern. - * - * @name Phaser.GameObjects.TileSprite#displayTexture - * @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture} - * @private - * @since 3.12.0 - */ - this.displayTexture = displayTexture; + get: function () + { + return this.diameter; + }, - /** - * The Frame the TileSprite is using as its fill pattern. - * - * @name Phaser.GameObjects.TileSprite#displayFrame - * @type {Phaser.Textures.Frame} - * @private - * @since 3.12.0 - */ - this.displayFrame = displayFrame; + set: function (value) + { + this.diameter = value; + } - /** - * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. - * - * @name Phaser.GameObjects.TileSprite#_crop - * @type {object} - * @private - * @since 3.12.0 - */ - this._crop = this.resetCropObject(); + }, - /** - * The Texture this Game Object is using to render with. - * - * @name Phaser.GameObjects.TileSprite#texture - * @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture} - * @since 3.0.0 - */ - this.texture = scene.sys.textures.addCanvas(null, this.canvas, true); + /** + * The height of this Light Game Object. This is the same as `Light.diameter`. + * + * @name Phaser.GameObjects.Light#displayHeight + * @type {number} + * @since 3.60.0 + */ + displayHeight: { - /** - * The Texture Frame this Game Object is using to render with. - * - * @name Phaser.GameObjects.TileSprite#frame - * @type {Phaser.Textures.Frame} - * @since 3.0.0 - */ - this.frame = this.texture.get(); + get: function () + { + return this.diameter; + }, - /** - * The next power of two value from the width of the Fill Pattern frame. - * - * @name Phaser.GameObjects.TileSprite#potWidth - * @type {number} - * @since 3.0.0 - */ - this.potWidth = GetPowerOfTwo(displayFrame.width); + set: function (value) + { + this.diameter = value; + } - /** - * The next power of two value from the height of the Fill Pattern frame. - * - * @name Phaser.GameObjects.TileSprite#potHeight - * @type {number} - * @since 3.0.0 - */ - this.potHeight = GetPowerOfTwo(displayFrame.height); + }, - /** - * The Canvas that the TileSprites texture is rendered to. - * This is used to create a WebGL texture from. - * - * @name Phaser.GameObjects.TileSprite#fillCanvas - * @type {HTMLCanvasElement} - * @since 3.12.0 - */ - this.fillCanvas = CanvasPool.create2D(this, this.potWidth, this.potHeight); + /** + * The width of this Light Game Object. This is the same as `Light.diameter`. + * + * @name Phaser.GameObjects.Light#width + * @type {number} + * @since 3.60.0 + */ + width: { - /** - * The Canvas Context used to render the TileSprites texture. - * - * @name Phaser.GameObjects.TileSprite#fillContext - * @type {CanvasRenderingContext2D} - * @since 3.12.0 - */ - this.fillContext = this.fillCanvas.getContext('2d'); + get: function () + { + return this.diameter; + }, - /** - * The texture that the Tile Sprite is rendered to, which is then rendered to a Scene. - * In WebGL this is a WebGLTexture. In Canvas it's a Canvas Fill Pattern. - * - * @name Phaser.GameObjects.TileSprite#fillPattern - * @type {?(WebGLTexture|CanvasPattern)} - * @since 3.12.0 - */ - this.fillPattern = null; + set: function (value) + { + this.diameter = value; + } - this.setPosition(x, y); - this.setSize(width, height); - this.setFrame(frameKey); - this.setOriginFromFrame(); - this.initPipeline(); + }, + + /** + * The height of this Light Game Object. This is the same as `Light.diameter`. + * + * @name Phaser.GameObjects.Light#height + * @type {number} + * @since 3.60.0 + */ + height: { - scene.sys.game.events.on(GameEvents.CONTEXT_RESTORED, function (renderer) + get: function () { - if (!renderer) - { - return; - } - - var gl = renderer.gl; + return this.diameter; + }, - this.dirty = true; - this.fillPattern = null; - this.fillPattern = renderer.createTexture2D(0, gl.LINEAR, gl.LINEAR, gl.REPEAT, gl.REPEAT, gl.RGBA, this.fillCanvas, this.potWidth, this.potHeight); + set: function (value) + { + this.diameter = value; + } - }, this); }, /** - * Sets the texture and frame this Game Object will use to render with. - * - * Textures are referenced by their string-based keys, as stored in the Texture Manager. + * Compares the renderMask with the renderFlags to see if this Game Object will render or not. + * Also checks the Game Object against the given Cameras exclusion list. * - * @method Phaser.GameObjects.TileSprite#setTexture - * @since 3.0.0 + * @method Phaser.GameObjects.Light#willRender + * @since 3.50.0 * - * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|number)} [frame] - The name or index of the frame within the Texture. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against this Game Object. * - * @return {this} This Game Object instance. + * @return {boolean} True if the Game Object should be rendered, otherwise false. */ - setTexture: function (key, frame) + willRender: function (camera) { - this.displayTexture = this.scene.sys.textures.get(key); - - return this.setFrame(frame); + return !(Light.RENDER_MASK !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); }, /** - * Sets the frame this Game Object will use to render with. - * - * The Frame has to belong to the current Texture being used. - * - * It can be either a string or an index. + * Set the color of the light from a single integer RGB value. * - * @method Phaser.GameObjects.TileSprite#setFrame + * @method Phaser.GameObjects.Light#setColor * @since 3.0.0 * - * @param {(string|number)} frame - The name or index of the frame within the Texture. + * @param {number} rgb - The integer RGB color of the light. * - * @return {this} This Game Object instance. + * @return {this} This Light object. */ - setFrame: function (frame) + setColor: function (rgb) { - var newFrame = this.displayTexture.get(frame); - - this.potWidth = GetPowerOfTwo(newFrame.width); - this.potHeight = GetPowerOfTwo(newFrame.height); - - // So updateCanvas is triggered - this.canvas.width = 0; - - if (!newFrame.cutWidth || !newFrame.cutHeight) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } - - this.displayFrame = newFrame; - - this.dirty = true; + var color = Utils.getFloatsFromUintRGB(rgb); - this.updateTileTexture(); + this.color.set(color[0], color[1], color[2]); return this; }, /** - * Sets {@link Phaser.GameObjects.TileSprite#tilePositionX} and {@link Phaser.GameObjects.TileSprite#tilePositionY}. + * Set the intensity of the light. * - * @method Phaser.GameObjects.TileSprite#setTilePosition - * @since 3.3.0 + * @method Phaser.GameObjects.Light#setIntensity + * @since 3.0.0 * - * @param {number} [x] - The x position of this sprite's tiling texture. - * @param {number} [y] - The y position of this sprite's tiling texture. + * @param {number} intensity - The intensity of the light. * - * @return {this} This Tile Sprite instance. + * @return {this} This Light object. */ - setTilePosition: function (x, y) + setIntensity: function (intensity) { - if (x !== undefined) - { - this.tilePositionX = x; - } - - if (y !== undefined) - { - this.tilePositionY = y; - } + this.intensity = intensity; return this; }, /** - * Sets {@link Phaser.GameObjects.TileSprite#tileScaleX} and {@link Phaser.GameObjects.TileSprite#tileScaleY}. + * Set the radius of the light. * - * @method Phaser.GameObjects.TileSprite#setTileScale - * @since 3.12.0 + * @method Phaser.GameObjects.Light#setRadius + * @since 3.0.0 * - * @param {number} [x] - The horizontal scale of the tiling texture. If not given it will use the current `tileScaleX` value. - * @param {number} [y=x] - The vertical scale of the tiling texture. If not given it will use the `x` value. + * @param {number} radius - The radius of the light. * - * @return {this} This Tile Sprite instance. + * @return {this} This Light object. */ - setTileScale: function (x, y) + setRadius: function (radius) { - if (x === undefined) { x = this.tileScaleX; } - if (y === undefined) { y = x; } - - this.tileScaleX = x; - this.tileScaleY = y; + this.radius = radius; return this; - }, + } - /** - * Render the tile texture if it is dirty, or if the frame has changed. - * - * @method Phaser.GameObjects.TileSprite#updateTileTexture - * @private - * @since 3.0.0 - */ - updateTileTexture: function () - { - if (!this.dirty || !this.renderer) - { - return; - } +}); - // Draw the displayTexture to our fillCanvas +/** + * The bitmask that `GameObject.renderFlags` is compared against to determine if the Game Object will render or not. + * + * @constant {number} RENDER_MASK + * @memberof Phaser.GameObjects.Light + * @default + */ +Light.RENDER_MASK = 15; - var frame = this.displayFrame; +module.exports = Light; - if (frame.source.isRenderTexture || frame.source.isGLTexture) - { - console.warn('TileSprites can only use Image or Canvas based textures'); - this.dirty = false; +/***/ }), - return; - } +/***/ 26193: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var ctx = this.fillContext; - var canvas = this.fillCanvas; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var fw = this.potWidth; - var fh = this.potHeight; +var CircleToRectangle = __webpack_require__(26535); +var Class = __webpack_require__(56694); +var DistanceBetween = __webpack_require__(53996); +var Light = __webpack_require__(14455); +var PointLight = __webpack_require__(13171); +var RGB = __webpack_require__(39298); +var SpliceOne = __webpack_require__(72677); +var StableSort = __webpack_require__(17922); +var Utils = __webpack_require__(75512); - if (!this.renderer || !this.renderer.gl) - { - fw = frame.cutWidth; - fh = frame.cutHeight; - } +/** + * @callback LightForEach + * + * @param {Phaser.GameObjects.Light} light - The Light. + */ - ctx.clearRect(0, 0, fw, fh); +/** + * @classdesc + * Manages Lights for a Scene. + * + * Affects the rendering of Game Objects using the `Light2D` pipeline. + * + * @class LightsManager + * @memberof Phaser.GameObjects + * @constructor + * @since 3.0.0 + */ +var LightsManager = new Class({ - canvas.width = fw; - canvas.height = fh; + initialize: - ctx.drawImage( - frame.source.image, - frame.cutX, frame.cutY, - frame.cutWidth, frame.cutHeight, - 0, 0, - fw, fh - ); + function LightsManager () + { + /** + * The Lights in the Scene. + * + * @name Phaser.GameObjects.LightsManager#lights + * @type {Phaser.GameObjects.Light[]} + * @default [] + * @since 3.0.0 + */ + this.lights = []; - if (this.renderer && this.renderer.gl) - { - this.fillPattern = this.renderer.canvasToTexture(canvas, this.fillPattern); - } - else - { - this.fillPattern = ctx.createPattern(canvas, 'repeat'); - } + /** + * The ambient color. + * + * @name Phaser.GameObjects.LightsManager#ambientColor + * @type {Phaser.Display.RGB} + * @since 3.50.0 + */ + this.ambientColor = new RGB(0.1, 0.1, 0.1); - this.updateCanvas(); + /** + * Whether the Lights Manager is enabled. + * + * @name Phaser.GameObjects.LightsManager#active + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.active = false; - this.dirty = false; + /** + * The maximum number of lights that a single Camera and the lights shader can process. + * Change this via the `maxLights` property in your game config, as it cannot be changed at runtime. + * + * @name Phaser.GameObjects.LightsManager#maxLights + * @type {number} + * @readonly + * @since 3.15.0 + */ + this.maxLights = -1; + + /** + * The number of lights that the LightPipeline processed in the _previous_ frame. + * + * @name Phaser.GameObjects.LightsManager#visibleLights + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.visibleLights = 0; }, /** - * Draw the fill pattern to the internal canvas. + * Creates a new Point Light Game Object and adds it to the Scene. * - * @method Phaser.GameObjects.TileSprite#updateCanvas - * @private - * @since 3.12.0 + * Note: This method will only be available if the Point Light Game Object has been built into Phaser. + * + * The Point Light Game Object provides a way to add a point light effect into your game, + * without the expensive shader processing requirements of the traditional Light Game Object. + * + * The difference is that the Point Light renders using a custom shader, designed to give the + * impression of a point light source, of variable radius, intensity and color, in your game. + * However, unlike the Light Game Object, it does not impact any other Game Objects, or use their + * normal maps for calcuations. This makes them extremely fast to render compared to Lights + * and perfect for special effects, such as flickering torches or muzzle flashes. + * + * For maximum performance you should batch Point Light Game Objects together. This means + * ensuring they follow each other consecutively on the display list. Ideally, use a Layer + * Game Object and then add just Point Lights to it, so that it can batch together the rendering + * of the lights. You don't _have_ to do this, and if you've only a handful of Point Lights in + * your game then it's perfectly safe to mix them into the dislay list as normal. However, if + * you're using a large number of them, please consider how they are mixed into the display list. + * + * The renderer will automatically cull Point Lights. Those with a radius that does not intersect + * with the Camera will be skipped in the rendering list. This happens automatically and the + * culled state is refreshed every frame, for every camera. + * + * The origin of a Point Light is always 0.5 and it cannot be changed. + * + * Point Lights are a WebGL only feature and do not have a Canvas counterpart. + * + * @method Phaser.GameObjects.LightsManager#addPointLight + * @since 3.50.0 + * + * @param {number} x - The horizontal position of this Point Light in the world. + * @param {number} y - The vertical position of this Point Light in the world. + * @param {number} [color=0xffffff] - The color of the Point Light, given as a hex value. + * @param {number} [radius=128] - The radius of the Point Light. + * @param {number} [intensity=1] - The intensity, or color blend, of the Point Light. + * @param {number} [attenuation=0.1] - The attenuation of the Point Light. This is the reduction of light from the center point. + * + * @return {Phaser.GameObjects.PointLight} The Game Object that was created. */ - updateCanvas: function () + addPointLight: function (x, y, color, radius, intensity, attenuation) { - var canvas = this.canvas; + return this.systems.displayList.add(new PointLight(this.scene, x, y, color, radius, intensity, attenuation)); + }, - if (canvas.width !== this.width || canvas.height !== this.height) + /** + * Enable the Lights Manager. + * + * @method Phaser.GameObjects.LightsManager#enable + * @since 3.0.0 + * + * @return {this} This Lights Manager instance. + */ + enable: function () + { + if (this.maxLights === -1) { - canvas.width = this.width; - canvas.height = this.height; + this.maxLights = this.systems.renderer.config.maxLights; + } - this.frame.setSize(this.width, this.height); - this.updateDisplayOrigin(); + this.active = true; - this.dirty = true; - } + return this; + }, - if (!this.dirty || this.renderer && this.renderer.gl) - { - this.dirty = false; - return; - } + /** + * Disable the Lights Manager. + * + * @method Phaser.GameObjects.LightsManager#disable + * @since 3.0.0 + * + * @return {this} This Lights Manager instance. + */ + disable: function () + { + this.active = false; - var ctx = this.context; + return this; + }, - if (!this.scene.sys.game.config.antialias) + /** + * Get all lights that can be seen by the given Camera. + * + * It will automatically cull lights that are outside the world view of the Camera. + * + * If more lights are returned than supported by the pipeline, the lights are then culled + * based on the distance from the center of the camera. Only those closest are rendered. + * + * @method Phaser.GameObjects.LightsManager#getLights + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to cull Lights for. + * + * @return {Phaser.GameObjects.Light[]} The culled Lights. + */ + getLights: function (camera) + { + var lights = this.lights; + var worldView = camera.worldView; + + var visibleLights = []; + + for (var i = 0; i < lights.length; i++) { - Smoothing.disable(ctx); + var light = lights[i]; + + if (light.willRender(camera) && CircleToRectangle(light, worldView)) + { + visibleLights.push({ + light: light, + distance: DistanceBetween(light.x, light.y, worldView.centerX, worldView.centerY) + }); + } } - var scaleX = this._tileScale.x; - var scaleY = this._tileScale.y; + if (visibleLights.length > this.maxLights) + { + // We've got too many lights, so sort by distance from camera and cull those far away + // This isn't ideal because it doesn't factor in the radius of the lights, but it'll do for now + // and is significantly better than we had before! - var positionX = this._tilePosition.x; - var positionY = this._tilePosition.y; + StableSort(visibleLights, this.sortByDistance); - ctx.clearRect(0, 0, this.width, this.height); + visibleLights = visibleLights.slice(0, this.maxLights); + } - ctx.save(); + this.visibleLights = visibleLights.length; - ctx.scale(scaleX, scaleY); + return visibleLights; + }, - ctx.translate(-positionX, -positionY); + sortByDistance: function (a, b) + { + return (a.distance >= b.distance); + }, - ctx.fillStyle = this.fillPattern; + /** + * Set the ambient light color. + * + * @method Phaser.GameObjects.LightsManager#setAmbientColor + * @since 3.0.0 + * + * @param {number} rgb - The integer RGB color of the ambient light. + * + * @return {this} This Lights Manager instance. + */ + setAmbientColor: function (rgb) + { + var color = Utils.getFloatsFromUintRGB(rgb); - ctx.fillRect(positionX, positionY, this.width / scaleX, this.height / scaleY); + this.ambientColor.set(color[0], color[1], color[2]); - ctx.restore(); + return this; + }, - this.dirty = false; + /** + * Returns the maximum number of Lights allowed to appear at once. + * + * @method Phaser.GameObjects.LightsManager#getMaxVisibleLights + * @since 3.0.0 + * + * @return {number} The maximum number of Lights allowed to appear at once. + */ + getMaxVisibleLights: function () + { + return this.maxLights; }, /** - * Internal destroy handler, called as part of the destroy process. + * Get the number of Lights managed by this Lights Manager. * - * @method Phaser.GameObjects.TileSprite#preDestroy - * @protected - * @since 3.9.0 + * @method Phaser.GameObjects.LightsManager#getLightCount + * @since 3.0.0 + * + * @return {number} The number of Lights managed by this Lights Manager. */ - preDestroy: function () + getLightCount: function () { - if (this.renderer && this.renderer.gl) - { - this.renderer.deleteTexture(this.fillPattern); - } + return this.lights.length; + }, - CanvasPool.remove(this.canvas); - CanvasPool.remove(this.fillCanvas); + /** + * Add a Light. + * + * @method Phaser.GameObjects.LightsManager#addLight + * @since 3.0.0 + * + * @param {number} [x=0] - The horizontal position of the Light. + * @param {number} [y=0] - The vertical position of the Light. + * @param {number} [radius=128] - The radius of the Light. + * @param {number} [rgb=0xffffff] - The integer RGB color of the light. + * @param {number} [intensity=1] - The intensity of the Light. + * + * @return {Phaser.GameObjects.Light} The Light that was added. + */ + addLight: function (x, y, radius, rgb, intensity) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (radius === undefined) { radius = 128; } + if (rgb === undefined) { rgb = 0xffffff; } + if (intensity === undefined) { intensity = 1; } - this.fillPattern = null; - this.fillContext = null; - this.fillCanvas = null; + var color = Utils.getFloatsFromUintRGB(rgb); - this.displayTexture = null; - this.displayFrame = null; + var light = new Light(x, y, radius, color[0], color[1], color[2], intensity); - this.texture.destroy(); + this.lights.push(light); - this.renderer = null; + return light; }, /** - * The horizontal scroll position of the Tile Sprite. + * Remove a Light. * - * @name Phaser.GameObjects.TileSprite#tilePositionX - * @type {number} - * @default 0 + * @method Phaser.GameObjects.LightsManager#removeLight * @since 3.0.0 + * + * @param {Phaser.GameObjects.Light} light - The Light to remove. + * + * @return {this} This Lights Manager instance. */ - tilePositionX: { - - get: function () - { - return this._tilePosition.x; - }, + removeLight: function (light) + { + var index = this.lights.indexOf(light); - set: function (value) + if (index >= 0) { - this._tilePosition.x = value; - this.dirty = true; + SpliceOne(this.lights, index); } + return this; }, /** - * The vertical scroll position of the Tile Sprite. + * Shut down the Lights Manager. * - * @name Phaser.GameObjects.TileSprite#tilePositionY - * @type {number} - * @default 0 + * Recycles all active Lights into the Light pool, resets ambient light color and clears the lists of Lights and + * culled Lights. + * + * @method Phaser.GameObjects.LightsManager#shutdown * @since 3.0.0 */ - tilePositionY: { - - get: function () - { - return this._tilePosition.y; - }, - - set: function (value) - { - this._tilePosition.y = value; - this.dirty = true; - } - + shutdown: function () + { + this.lights.length = 0; }, /** - * The horizontal scale of the Tile Sprite texture. + * Destroy the Lights Manager. * - * @name Phaser.GameObjects.TileSprite#tileScaleX - * @type {number} - * @default 1 - * @since 3.11.0 + * Cleans up all references by calling {@link Phaser.GameObjects.LightsManager#shutdown}. + * + * @method Phaser.GameObjects.LightsManager#destroy + * @since 3.0.0 */ - tileScaleX: { + destroy: function () + { + this.shutdown(); + } - get: function () - { - return this._tileScale.x; - }, +}); - set: function (value) +module.exports = LightsManager; + + +/***/ }), + +/***/ 50296: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var LightsManager = __webpack_require__(26193); +var PluginCache = __webpack_require__(91963); +var SceneEvents = __webpack_require__(7599); + +/** + * @classdesc + * A Scene plugin that provides a {@link Phaser.GameObjects.LightsManager} for the Light2D pipeline. + * + * Available from within a Scene via `this.lights`. + * + * Add Lights using the {@link Phaser.GameObjects.LightsManager#addLight} method: + * + * ```javascript + * // Enable the Lights Manager because it is disabled by default + * this.lights.enable(); + * + * // Create a Light at [400, 300] with a radius of 200 + * this.lights.addLight(400, 300, 200); + * ``` + * + * For Game Objects to be affected by the Lights when rendered, you will need to set them to use the `Light2D` pipeline like so: + * + * ```javascript + * sprite.setPipeline('Light2D'); + * ``` + * + * Note that you cannot use this pipeline on Graphics Game Objects or Shape Game Objects. + * + * @class LightsPlugin + * @extends Phaser.GameObjects.LightsManager + * @memberof Phaser.GameObjects + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene that this Lights Plugin belongs to. + */ +var LightsPlugin = new Class({ + + Extends: LightsManager, + + initialize: + + function LightsPlugin (scene) + { + /** + * A reference to the Scene that this Lights Plugin belongs to. + * + * @name Phaser.GameObjects.LightsPlugin#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; + + /** + * A reference to the Scene's systems. + * + * @name Phaser.GameObjects.LightsPlugin#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; + + if (!scene.sys.settings.isBooted) { - this._tileScale.x = value; - this.dirty = true; + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); } + LightsManager.call(this); }, /** - * The vertical scale of the Tile Sprite texture. + * Boot the Lights Plugin. * - * @name Phaser.GameObjects.TileSprite#tileScaleY - * @type {number} - * @default 1 - * @since 3.11.0 + * @method Phaser.GameObjects.LightsPlugin#boot + * @since 3.0.0 */ - tileScaleY: { + boot: function () + { + var eventEmitter = this.systems.events; - get: function () - { - return this._tileScale.y; - }, + eventEmitter.on(SceneEvents.SHUTDOWN, this.shutdown, this); + eventEmitter.on(SceneEvents.DESTROY, this.destroy, this); + }, - set: function (value) - { - this._tileScale.y = value; - this.dirty = true; - } + /** + * Destroy the Lights Plugin. + * + * Cleans up all references. + * + * @method Phaser.GameObjects.LightsPlugin#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.shutdown(); + this.scene = undefined; + this.systems = undefined; } }); -module.exports = TileSprite; +PluginCache.register('LightsPlugin', LightsPlugin, 'lights'); + +module.exports = LightsPlugin; /***/ }), -/* 226 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 83321: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Clamp = __webpack_require__(18); -var Components = __webpack_require__(11); -var Events = __webpack_require__(75); -var GameEvents = __webpack_require__(22); -var InputEvents = __webpack_require__(51); -var GameObject = __webpack_require__(15); -var SoundEvents = __webpack_require__(70); -var UUID = __webpack_require__(222); -var VideoRender = __webpack_require__(1094); -var MATH_CONST = __webpack_require__(14); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var DegToRad = __webpack_require__(75606); +var Face = __webpack_require__(18693); +var GameObject = __webpack_require__(89980); +var GenerateObjVerts = __webpack_require__(53267); +var GenerateVerts = __webpack_require__(67623); +var GetCalcMatrix = __webpack_require__(73329); +var Matrix4 = __webpack_require__(16650); +var MeshRender = __webpack_require__(23464); +var RadToDeg = __webpack_require__(23701); +var StableSort = __webpack_require__(17922); +var Vector3 = __webpack_require__(70015); +var Vertex = __webpack_require__(85769); /** * @classdesc - * A Video Game Object. - * - * This Game Object is capable of handling playback of a previously loaded video from the Phaser Video Cache, - * or playing a video based on a given URL. Videos can be either local, or streamed. - * - * ```javascript - * preload () { - * this.load.video('pixar', 'nemo.mp4'); - * } - * - * create () { - * this.add.video(400, 300, 'pixar'); - * } - * ``` - * - * To all intents and purposes, a video is a standard Game Object, just like a Sprite. And as such, you can do - * all the usual things to it, such as scaling, rotating, cropping, tinting, making interactive, giving a - * physics body, etc. - * - * Transparent videos are also possible via the WebM file format. Providing the video file has was encoded with - * an alpha channel, and providing the browser supports WebM playback (not all of them do), then it will render - * in-game with full transparency. - * - * ### Autoplaying Videos + * A Mesh Game Object. * - * Videos can only autoplay if the browser has been unlocked with an interaction, or satisfies the MEI settings. - * The policies that control autoplaying are vast and vary between browser. - * You can, and should, read more about it here: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide + * The Mesh Game Object allows you to render a group of textured vertices and manipulate + * the view of those vertices, such as rotation, translation or scaling. * - * If your video doesn't contain any audio, then set the `noAudio` parameter to `true` when the video is _loaded_, - * and it will often allow the video to play immediately: + * Support for generating mesh data from grids, model data or Wavefront OBJ Files is included. * - * ```javascript - * preload () { - * this.load.video('pixar', 'nemo.mp4', 'loadeddata', false, true); - * } - * ``` + * Although you can use this to render 3D objects, its primary use is for displaying more complex + * Sprites, or Sprites where you need fine-grained control over the vertex positions in order to + * achieve special effects in your games. Note that rendering still takes place using Phaser's + * orthographic camera (after being transformed via `projectionMesh`, see `setPerspective`, + * `setOrtho`, and `panZ` methods). As a result, all depth and face tests are done in an eventually + * orthographic space. * - * The 5th parameter in the load call tells Phaser that the video doesn't contain any audio tracks. Video without - * audio can autoplay without requiring a user interaction. Video with audio cannot do this unless it satisfies - * the browsers MEI settings. See the MDN Autoplay Guide for further details. + * The rendering process will iterate through the faces of this Mesh and render out each face + * that is considered as being in view of the camera. No depth buffer is used, and because of this, + * you should be careful not to use model data with too many vertices, or overlapping geometry, + * or you'll probably encounter z-depth fighting. The Mesh was designed to allow for more advanced + * 2D layouts, rather than displaying 3D objects, even though it can do this to a degree. * - * Note that due to a bug in IE11 you cannot play a video texture to a Sprite in WebGL. For IE11 force Canvas mode. + * In short, if you want to remake Crysis, use a 3D engine, not a Mesh. However, if you want + * to easily add some small fun 3D elements into your game, or create some special effects involving + * vertex warping, this is the right object for you. Mesh data becomes part of the WebGL batch, + * just like standard Sprites, so doesn't introduce any additional shader overhead. Because + * the Mesh just generates vertices into the WebGL batch, like any other Sprite, you can use all of + * the common Game Object components on a Mesh too, such as a custom pipeline, mask, blend mode + * or texture. * - * More details about video playback and the supported media formats can be found on MDN: + * Note that the Mesh object is WebGL only and does not have a Canvas counterpart. * - * https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement - * https://developer.mozilla.org/en-US/docs/Web/Media/Formats + * The Mesh origin is always 0.5 x 0.5 and cannot be changed. * - * @class Video + * @class Mesh * @extends Phaser.GameObjects.GameObject * @memberof Phaser.GameObjects * @constructor - * @since 3.20.0 + * @webglOnly + * @since 3.0.0 * - * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.AlphaSingle * @extends Phaser.GameObjects.Components.BlendMode * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Origin * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline * @extends Phaser.GameObjects.Components.ScrollFactor * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.TextureCrop - * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Texture * @extends Phaser.GameObjects.Components.Transform * @extends Phaser.GameObjects.Components.Visible * * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {string} [key] - Optional key of the Video this Game Object will play, as stored in the Video Cache. + * @param {number} [x] - The horizontal position of this Game Object in the world. + * @param {number} [y] - The vertical position of this Game Object in the world. + * @param {string|Phaser.Textures.Texture} [texture] - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|number} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {number[]} [vertices] - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true` (but see note). + * @param {number[]} [uvs] - The UVs pairs array. + * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? Note: If not, it will be assumed `z=0`, see method `panZ` or `setOrtho`. + * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. */ -var Video = new Class({ +var Mesh = new Class({ Extends: GameObject, Mixins: [ - Components.Alpha, + Components.AlphaSingle, Components.BlendMode, Components.Depth, - Components.Flip, - Components.GetBounds, Components.Mask, - Components.Origin, Components.Pipeline, + Components.PostPipeline, Components.ScrollFactor, Components.Size, - Components.TextureCrop, - Components.Tint, + Components.Texture, Components.Transform, Components.Visible, - VideoRender + MeshRender ], initialize: - function Video (scene, x, y, key) + function Mesh (scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas) { - GameObject.call(this, scene, 'Video'); + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (texture === undefined) { texture = '__WHITE'; } - /** - * A reference to the HTML Video Element this Video Game Object is playing. - * Will be `null` until a video is loaded for playback. - * - * @name Phaser.GameObjects.Video#video - * @type {?HTMLVideoElement} - * @since 3.20.0 - */ - this.video = null; + GameObject.call(this, scene, 'Mesh'); /** - * The Phaser Texture this Game Object is using to render the video to. - * Will be `null` until a video is loaded for playback. + * An array containing the Face instances belonging to this Mesh. * - * @name Phaser.GameObjects.Video#videoTexture - * @type {?Phaser.Textures.Texture} - * @since 3.20.0 - */ - this.videoTexture = null; - - /** - * A reference to the TextureSource belong to the `videoTexture` Texture object. - * Will be `null` until a video is loaded for playback. + * A Face consists of 3 Vertex objects. * - * @name Phaser.GameObjects.Video#videoTextureSource - * @type {?Phaser.Textures.TextureSource} - * @since 3.20.0 + * This array is populated during calls such as `addVertices` or `addOBJ`. + * + * @name Phaser.GameObjects.Mesh#faces + * @type {Phaser.Geom.Mesh.Face[]} + * @since 3.50.0 */ - this.videoTextureSource = null; + this.faces = []; /** - * A Phaser CanvasTexture instance that holds the most recent snapshot taken from the video. - * This will only be set if `snapshot` or `snapshotArea` have been called, and will be `null` until that point. + * An array containing Vertex instances. One instance per vertex in this Mesh. * - * @name Phaser.GameObjects.Video#snapshotTexture - * @type {?Phaser.Textures.CanvasTexture} - * @since 3.20.0 + * This array is populated during calls such as `addVertex` or `addOBJ`. + * + * @name Phaser.GameObjects.Mesh#vertices + * @type {Phaser.Geom.Mesh.Vertex[]} + * @since 3.50.0 */ - this.snapshotTexture = null; + this.vertices = []; /** - * If you have saved this video to a texture via the `saveTexture` method, this controls if the video - * is rendered with `flipY` in WebGL or not. You often need to set this if you wish to use the video texture - * as the input source for a shader. If you find your video is appearing upside down within a shader or - * custom pipeline, flip this property. + * The tint fill mode. * - * @name Phaser.GameObjects.Video#flipY + * `false` = An additive tint (the default), where vertices colors are blended with the texture. + * `true` = A fill tint, where the vertex colors replace the texture, but respects texture alpha. + * + * @name Phaser.GameObjects.Mesh#tintFill * @type {boolean} - * @since 3.20.0 + * @default false + * @since 3.50.0 */ - this.flipY = false; + this.tintFill = false; /** - * The key used by the texture as stored in the Texture Manager. + * You can optionally choose to render the vertices of this Mesh to a Graphics instance. * - * @name Phaser.GameObjects.Video#_key - * @type {string} - * @private - * @since 3.20.0 + * Achieve this by setting the `debugCallback` and the `debugGraphic` properties. + * + * You can do this in a single call via the `Mesh.setDebug` method, which will use the + * built-in debug function. You can also set it to your own callback. The callback + * will be invoked _once per render_ and sent the following parameters: + * + * `debugCallback(src, meshLength, verts)` + * + * `src` is the Mesh instance being debugged. + * `meshLength` is the number of mesh vertices in total. + * `verts` is an array of the translated vertex coordinates. + * + * To disable rendering, set this property back to `null`. + * + * Please note that high vertex count Meshes will struggle to debug properly. + * + * @name Phaser.GameObjects.Mesh#debugCallback + * @type {function} + * @since 3.50.0 */ - this._key = UUID(); + this.debugCallback = null; /** - * An internal flag holding the current state of the video lock, should document interaction be required - * before playback can begin. + * The Graphics instance that the debug vertices will be drawn to, if `setDebug` has + * been called. * - * @name Phaser.GameObjects.Video#touchLocked - * @type {boolean} - * @since 3.20.0 + * @name Phaser.GameObjects.Mesh#debugGraphic + * @type {Phaser.GameObjects.Graphics} + * @since 3.50.0 */ - this.touchLocked = true; + this.debugGraphic = null; /** - * Should the video auto play when document interaction is required and happens? + * When rendering, skip any Face that isn't counter clockwise? * - * @name Phaser.GameObjects.Video#playWhenUnlocked + * Enable this to hide backward-facing Faces during rendering. + * + * Disable it to render all Faces. + * + * @name Phaser.GameObjects.Mesh#hideCCW * @type {boolean} - * @since 3.20.0 + * @since 3.50.0 */ - this.playWhenUnlocked = false; + this.hideCCW = true; /** - * When starting playback of a video Phaser will monitor its `readyState` using a `setTimeout` call. - * The `setTimeout` happens once every `Video.retryInterval` ms. It will carry on monitoring the video - * state in this manner until the `retryLimit` is reached and then abort. + * A Vector3 containing the 3D position of the vertices in this Mesh. * - * @name Phaser.GameObjects.Video#retryLimit - * @type {number} - * @since 3.20.0 - */ - this.retryLimit = 20; - - /** - * The current retry attempt. + * Modifying the components of this property will allow you to reposition where + * the vertices are rendered within the Mesh. This happens in the `preUpdate` phase, + * where each vertex is transformed using the view and projection matrices. * - * @name Phaser.GameObjects.Video#retry - * @type {number} - * @since 3.20.0 - */ - this.retry = 0; - - /** - * The number of ms between each retry while monitoring the ready state of a downloading video. + * Changing this property will impact all vertices being rendered by this Mesh. * - * @name Phaser.GameObjects.Video#retryInterval - * @type {number} - * @since 3.20.0 - */ - this.retryInterval = 500; - - /** - * The setTimeout callback ID. + * You can also adjust the 'view' by using the `pan` methods. * - * @name Phaser.GameObjects.Video#_retryID - * @type {number} - * @private - * @since 3.20.0 + * @name Phaser.GameObjects.Mesh#modelPosition + * @type {Phaser.Math.Vector3} + * @since 3.50.0 */ - this._retryID = null; + this.modelPosition = new Vector3(); /** - * The video was muted due to a system event, such as the game losing focus. + * A Vector3 containing the 3D scale of the vertices in this Mesh. * - * @name Phaser.GameObjects.Video#_systemMuted - * @type {boolean} - * @private - * @since 3.20.0 - */ - this._systemMuted = false; - - /** - * The video was muted due to game code, not a system event. + * Modifying the components of this property will allow you to scale + * the vertices within the Mesh. This happens in the `preUpdate` phase, + * where each vertex is transformed using the view and projection matrices. * - * @name Phaser.GameObjects.Video#_codeMuted - * @type {boolean} - * @private - * @since 3.20.0 + * Changing this property will impact all vertices being rendered by this Mesh. + * + * @name Phaser.GameObjects.Mesh#modelScale + * @type {Phaser.Math.Vector3} + * @since 3.50.0 */ - this._codeMuted = false; + this.modelScale = new Vector3(1, 1, 1); /** - * The video was paused due to a system event, such as the game losing focus. + * A Vector3 containing the 3D rotation of the vertices in this Mesh. * - * @name Phaser.GameObjects.Video#_systemPaused - * @type {boolean} - * @private - * @since 3.20.0 + * The values should be given in radians, i.e. to rotate the vertices by 90 + * degrees you can use `modelRotation.x = Phaser.Math.DegToRad(90)`. + * + * Modifying the components of this property will allow you to rotate + * the vertices within the Mesh. This happens in the `preUpdate` phase, + * where each vertex is transformed using the view and projection matrices. + * + * Changing this property will impact all vertices being rendered by this Mesh. + * + * @name Phaser.GameObjects.Mesh#modelRotation + * @type {Phaser.Math.Vector3} + * @since 3.50.0 */ - this._systemPaused = false; + this.modelRotation = new Vector3(); /** - * The video was paused due to game code, not a system event. + * An internal cache, used to compare position, rotation, scale and face data + * each frame, to avoid math calculations in `preUpdate`. * - * @name Phaser.GameObjects.Video#_codePaused - * @type {boolean} + * Cache structure = position xyz | rotation xyz | scale xyz | face count | view | ortho + * + * @name Phaser.GameObjects.Mesh#dirtyCache + * @type {number[]} * @private - * @since 3.20.0 + * @since 3.50.0 */ - this._codePaused = false; + this.dirtyCache = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; /** - * The locally bound event callback handlers. + * The transformation matrix for this Mesh. * - * @name Phaser.GameObjects.Video#_callbacks - * @type {any} - * @private - * @since 3.20.0 + * @name Phaser.GameObjects.Mesh#transformMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 */ - this._callbacks = { - play: this.playHandler.bind(this), - error: this.loadErrorHandler.bind(this), - end: this.completeHandler.bind(this), - time: this.timeUpdateHandler.bind(this), - seeking: this.seekingHandler.bind(this), - seeked: this.seekedHandler.bind(this) - }; + this.transformMatrix = new Matrix4(); /** - * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. + * The view position for this Mesh. * - * @name Phaser.GameObjects.Video#_crop - * @type {object} - * @private - * @since 3.20.0 + * Use the methods`panX`, `panY` and `panZ` to adjust the view. + * + * @name Phaser.GameObjects.Mesh#viewPosition + * @type {Phaser.Math.Vector3} + * @since 3.50.0 */ - this._crop = this.resetCropObject(); + this.viewPosition = new Vector3(); /** - * An object containing in and out markers for sequence playback. + * The view matrix for this Mesh. * - * @name Phaser.GameObjects.Video#markers - * @type {any} - * @since 3.20.0 + * @name Phaser.GameObjects.Mesh#viewMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 */ - this.markers = {}; + this.viewMatrix = new Matrix4(); /** - * The in marker. + * The projection matrix for this Mesh. * - * @name Phaser.GameObjects.Video#_markerIn - * @type {number} - * @private - * @since 3.20.0 + * Update it with the `setPerspective` or `setOrtho` methods. + * + * @name Phaser.GameObjects.Mesh#projectionMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 */ - this._markerIn = -1; + this.projectionMatrix = new Matrix4(); /** - * The out marker. + * How many faces were rendered by this Mesh Game Object in the last + * draw? This is reset in the `preUpdate` method and then incremented + * each time a face is drawn. Note that in multi-camera Scenes this + * value may exceed that found in `Mesh.getFaceCount` due to + * cameras drawing the same faces more than once. * - * @name Phaser.GameObjects.Video#_markerOut + * @name Phaser.GameObjects.Mesh#totalRendered * @type {number} - * @private - * @since 3.20.0 + * @readonly + * @since 3.50.0 */ - this._markerOut = MATH_CONST.MAX_SAFE_INTEGER; + this.totalRendered = 0; /** - * The last time the TextureSource was updated. + * Internal cache var for the total number of faces rendered this frame. * - * @name Phaser.GameObjects.Video#_lastUpdate + * See `totalRendered` instead for the actual value. + * + * @name Phaser.GameObjects.Mesh#totalFrame * @type {number} * @private - * @since 3.20.0 + * @since 3.50.0 */ - this._lastUpdate = 0; + this.totalFrame = 0; /** - * The key of the video being played from the Video cache, if any. + * By default, the Mesh will check to see if its model or view transform has + * changed each frame and only recalculate the vertex positions if they have. * - * @name Phaser.GameObjects.Video#_cacheKey - * @type {string} - * @private - * @since 3.20.0 - */ - this._cacheKey = ''; - - /** - * Is the video currently seeking? + * This avoids lots of additional math in the `preUpdate` step when not required. + * + * However, if you are performing per-Face or per-Vertex manipulation on this Mesh, + * such as tweening a Face, or moving it without moving the rest of the Mesh, + * then you may need to disable the dirty cache in order for the Mesh to re-render + * correctly. You can toggle this property to do that. Please note that leaving + * this set to `true` will cause the Mesh to recalculate the position of every single + * vertex in it, every single frame. So only really do this if you know you + * need it. * - * @name Phaser.GameObjects.Video#_isSeeking + * @name Phaser.GameObjects.Mesh#ignoreDirtyCache * @type {boolean} - * @private - * @since 3.20.0 + * @since 3.50.0 */ - this._isSeeking = false; + this.ignoreDirtyCache = false; /** - * Should the Video element that this Video is using, be removed from the DOM - * when this Video is destroyed? + * The Camera fov (field of view) in degrees. * - * @name Phaser.GameObjects.Video#removeVideoElementOnDestroy - * @type {boolean} - * @since 3.21.0 + * This is set automatically as part of the `Mesh.setPerspective` call, but exposed + * here for additional math. + * + * Do not modify this property directly, doing so will not change the fov. For that, + * call the respective Mesh methods. + * + * @name Phaser.GameObjects.Mesh#fov + * @type {number} + * @readonly + * @since 3.60.0 */ - this.removeVideoElementOnDestroy = false; + this.fov; - this.setPosition(x, y); - this.initPipeline(); - - if (key) - { - this.changeSource(key, false); - } + // Set these to allow setInteractive to work + this.displayOriginX = 0; + this.displayOriginY = 0; - var game = scene.sys.game.events; + var renderer = scene.sys.renderer; - game.on(GameEvents.PAUSE, this.globalPause, this); - game.on(GameEvents.RESUME, this.globalResume, this); + this.setPosition(x, y); + this.setTexture(texture, frame); + this.setSize(renderer.width, renderer.height); + this.initPipeline(); + this.initPostPipeline(); - var sound = scene.sys.sound; + this.setPerspective(renderer.width, renderer.height); - if (sound) + if (vertices) { - sound.on(SoundEvents.GLOBAL_MUTE, this.globalMute, this); + this.addVertices(vertices, uvs, indicies, containsZ, normals, colors, alphas); } }, @@ -85962,62651 +82530,58384 @@ var Video = new Class({ }, /** - * Starts this video playing. - * - * If the video is already playing, or has been queued to play with `changeSource` then this method just returns. - * - * Videos can only autoplay if the browser has been unlocked. This happens if you have interacted with the browser, i.e. - * by clicking on it or pressing a key, or due to server settings. The policies that control autoplaying are vast and - * vary between browser. You can read more here: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide - * - * If your video doesn't contain any audio, then set the `noAudio` parameter to `true` when the video is loaded, - * and it will often allow the video to play immediately: - * - * ```javascript - * preload () { - * this.load.video('pixar', 'nemo.mp4', 'loadeddata', false, true); - * } - * ``` - * - * The 5th parameter in the load call tells Phaser that the video doesn't contain any audio tracks. Video without - * audio can autoplay without requiring a user interaction. Video with audio cannot do this unless it satisfies - * the browsers MEI settings. See the MDN Autoplay Guide for details. - * - * If you need audio in your videos, then you'll have to consider the fact that the video cannot start playing until the - * user has interacted with the browser, into your game flow. - * - * @method Phaser.GameObjects.Video#play - * @since 3.20.0 + * Translates the view position of this Mesh on the x axis by the given amount. * - * @param {boolean} [loop=false] - Should the video loop automatically when it reaches the end? Please note that not all browsers support _seamless_ video looping for all encoding formats. - * @param {number} [markerIn] - Optional in marker time, in seconds, for playback of a sequence of the video. - * @param {number} [markerOut] - Optional out marker time, in seconds, for playback of a sequence of the video. + * @method Phaser.GameObjects.Mesh#panX + * @since 3.50.0 * - * @return {this} This Video Game Object for method chaining. + * @param {number} v - The amount to pan by. */ - play: function (loop, markerIn, markerOut) + panX: function (v) { - if ((this.touchLocked && this.playWhenUnlocked) || this.isPlaying()) - { - return this; - } + this.viewPosition.addScale(Vector3.LEFT, v); - var video = this.video; + this.dirtyCache[10] = 1; - if (!video) - { - console.warn('Video not loaded'); + return this; + }, - return this; - } - - if (loop === undefined) { loop = video.loop; } - - var sound = this.scene.sys.sound; - - if (sound && sound.mute) - { - // Mute will be set based on the global mute state of the Sound Manager (if there is one) - this.setMute(true); - } - - if (!isNaN(markerIn)) - { - this._markerIn = markerIn; - } - - if (!isNaN(markerOut) && markerOut > markerIn) - { - this._markerOut = markerOut; - } - - video.loop = loop; - - var callbacks = this._callbacks; - - var playPromise = video.play(); - - if (playPromise !== undefined) - { - playPromise.then(this.playPromiseSuccessHandler.bind(this)).catch(this.playPromiseErrorHandler.bind(this)); - } - else - { - // Old-school browsers with no Promises - video.addEventListener('playing', callbacks.play, true); - - // If video hasn't downloaded properly yet ... - if (video.readyState < 2) - { - this.retry = this.retryLimit; - - this._retryID = window.setTimeout(this.checkVideoProgress.bind(this), this.retryInterval); - } - } + /** + * Translates the view position of this Mesh on the y axis by the given amount. + * + * @method Phaser.GameObjects.Mesh#panY + * @since 3.50.0 + * + * @param {number} v - The amount to pan by. + */ + panY: function (v) + { + this.viewPosition.y += Vector3.DOWN.y * v; - // Set these _after_ calling `play` or they don't fire (useful, thanks browsers) - video.addEventListener('ended', callbacks.end, true); - video.addEventListener('timeupdate', callbacks.time, true); - video.addEventListener('seeking', callbacks.seeking, true); - video.addEventListener('seeked', callbacks.seeked, true); + this.dirtyCache[10] = 1; return this; }, /** - * This method allows you to change the source of the current video element. It works by first stopping the - * current video, if playing. Then deleting the video texture, if one has been created. Finally, it makes a - * new video texture and starts playback of the new source through the existing video element. + * Translates the view position of this Mesh on the z axis by the given amount. * - * The reason you may wish to do this is because videos that require interaction to unlock, remain in an unlocked - * state, even if you change the source of the video. By changing the source to a new video you avoid having to - * go through the unlock process again. + * As the default `panZ` value is 0, vertices with `z=0` (the default) need special + * care or else they will not display as they are "behind" the camera. * - * @method Phaser.GameObjects.Video#changeSource - * @since 3.20.0 + * Consider using `mesh.panZ(mesh.height / (2 * Math.tan(Math.PI / 16)))`, + * which will interpret vertex geometry 1:1 with pixel geometry (or see `setOrtho`). * - * @param {string} key - The key of the Video this Game Object will swap to playing, as stored in the Video Cache. - * @param {boolean} [autoplay=true] - Should the video start playing immediately, once the swap is complete? - * @param {boolean} [loop=false] - Should the video loop automatically when it reaches the end? Please note that not all browsers support _seamless_ video looping for all encoding formats. - * @param {number} [markerIn] - Optional in marker time, in seconds, for playback of a sequence of the video. - * @param {number} [markerOut] - Optional out marker time, in seconds, for playback of a sequence of the video. + * @method Phaser.GameObjects.Mesh#panZ + * @since 3.50.0 * - * @return {this} This Video Game Object for method chaining. + * @param {number} v - The amount to pan by. */ - changeSource: function (key, autoplay, loop, markerIn, markerOut) + panZ: function (amount) { - if (autoplay === undefined) { autoplay = true; } - - var currentVideo = this.video; - - if (currentVideo) - { - this.stop(); - } - - var newVideo = this.scene.sys.cache.video.get(key); - - if (newVideo) - { - this.video = newVideo; - - this._cacheKey = key; - - this._codePaused = newVideo.paused; - this._codeMuted = newVideo.muted; - - if (this.videoTexture) - { - this.scene.sys.textures.remove(this._key); + this.viewPosition.z += amount; - this.videoTexture = this.scene.sys.textures.create(this._key, newVideo, newVideo.videoWidth, newVideo.videoHeight); - this.videoTextureSource = this.videoTexture.source[0]; - this.videoTexture.add('__BASE', 0, 0, 0, newVideo.videoWidth, newVideo.videoHeight); + this.dirtyCache[10] = 1; - this.setTexture(this.videoTexture); - this.setSizeToFrame(); - this.updateDisplayOrigin(); + return this; + }, - this.emit(Events.VIDEO_CREATED, this, newVideo.videoWidth, newVideo.videoHeight); - } - else - { - this.updateTexture(); - } + /** + * Builds a new perspective projection matrix from the given values. + * + * These are also the initial projection matrix and parameters for `Mesh` (see `Mesh.panZ` for more discussion). + * + * See also `setOrtho`. + * + * @method Phaser.GameObjects.Mesh#setPerspective + * @since 3.50.0 + * + * @param {number} width - The width of the projection matrix. Typically the same as the Mesh and/or Renderer. + * @param {number} height - The height of the projection matrix. Typically the same as the Mesh and/or Renderer. + * @param {number} [fov=45] - The field of view, in degrees. + * @param {number} [near=0.01] - The near value of the view. + * @param {number} [far=1000] - The far value of the view. + */ + setPerspective: function (width, height, fov, near, far) + { + if (fov === undefined) { fov = 45; } + if (near === undefined) { near = 0.01; } + if (far === undefined) { far = 1000; } - newVideo.currentTime = 0; + this.fov = fov; - this._lastUpdate = 0; + this.projectionMatrix.perspective(DegToRad(fov), width / height, near, far); - if (autoplay) - { - this.play(loop, markerIn, markerOut); - } - } - else - { - this.video = null; - } + this.dirtyCache[10] = 1; + this.dirtyCache[11] = 0; return this; }, /** - * Adds a sequence marker to this video. + * Builds a new orthographic projection matrix from the given values. * - * Markers allow you to split a video up into sequences, delineated by a start and end time, given in seconds. + * If using this mode you will often need to set `Mesh.hideCCW` to `false` as well. * - * You can then play back specific markers via the `playMarker` method. + * By default, calling this method with no parameters will set the scaleX value to + * match the renderer's aspect ratio. If you would like to render vertex positions 1:1 + * to pixel positions, consider calling as `mesh.setOrtho(mesh.width, mesh.height)`. * - * Note that marker timing is _not_ frame-perfect. You should construct your videos in such a way that you allow for - * plenty of extra padding before and after each sequence to allow for discrepancies in browser seek and currentTime accuracy. + * See also `setPerspective`. * - * See https://github.com/w3c/media-and-entertainment/issues/4 for more details about this issue. + * @method Phaser.GameObjects.Mesh#setOrtho + * @since 3.50.0 * - * @method Phaser.GameObjects.Video#addMarker - * @since 3.20.0 + * @param {number} [scaleX=1] - The default horizontal scale in relation to the Mesh / Renderer dimensions. + * @param {number} [scaleY=1] - The default vertical scale in relation to the Mesh / Renderer dimensions. + * @param {number} [near=-1000] - The near value of the view. + * @param {number} [far=1000] - The far value of the view. + */ + setOrtho: function (scaleX, scaleY, near, far) + { + if (scaleX === undefined) { scaleX = this.scene.sys.renderer.getAspectRatio(); } + if (scaleY === undefined) { scaleY = 1; } + if (near === undefined) { near = -1000; } + if (far === undefined) { far = 1000; } + + this.fov = 0; + + this.projectionMatrix.ortho(-scaleX, scaleX, -scaleY, scaleY, near, far); + + this.dirtyCache[10] = 1; + this.dirtyCache[11] = 1; + + return this; + }, + + /** + * Iterates and destroys all current Faces in this Mesh, then resets the + * `faces` and `vertices` arrays. * - * @param {string} key - A unique name to give this marker. - * @param {number} markerIn - The time, in seconds, representing the start of this marker. - * @param {number} markerOut - The time, in seconds, representing the end of this marker. + * @method Phaser.GameObjects.Mesh#clear + * @since 3.50.0 * - * @return {this} This Video Game Object for method chaining. + * @return {this} This Mesh Game Object. */ - addMarker: function (key, markerIn, markerOut) + clear: function () { - if (!isNaN(markerIn) && markerIn >= 0 && !isNaN(markerOut)) + this.faces.forEach(function (face) { - this.markers[key] = [ markerIn, markerOut ]; - } + face.destroy(); + }); + + this.faces = []; + this.vertices = []; return this; }, /** - * Plays a pre-defined sequence in this video. + * This method will add the data from a triangulated Wavefront OBJ model file to this Mesh. * - * Markers allow you to split a video up into sequences, delineated by a start and end time, given in seconds and - * specified via the `addMarker` method. + * The data should have been loaded via the OBJFile: * - * Note that marker timing is _not_ frame-perfect. You should construct your videos in such a way that you allow for - * plenty of extra padding before and after each sequence to allow for discrepancies in browser seek and currentTime accuracy. + * ```javascript + * this.load.obj(key, url); + * ``` * - * See https://github.com/w3c/media-and-entertainment/issues/4 for more details about this issue. + * Then use the same `key` as the first parameter to this method. * - * @method Phaser.GameObjects.Video#playMarker - * @since 3.20.0 + * Multiple Mesh Game Objects can use the same model data without impacting on each other. * - * @param {string} key - The name of the marker sequence to play. - * @param {boolean} [loop=false] - Should the video loop automatically when it reaches the end? Please note that not all browsers support _seamless_ video looping for all encoding formats. + * Make sure your 3D package has triangulated the model data prior to exporting it. * - * @return {this} This Video Game Object for method chaining. + * You can add multiple models to a single Mesh, although they will act as one when + * moved or rotated. You can scale the model data, should it be too small, or too large, to see. + * You can also offset the vertices of the model via the `x`, `y` and `z` parameters. + * + * @method Phaser.GameObjects.Mesh#addVerticesFromObj + * @since 3.50.0 + * + * @param {string} key - The key of the model data in the OBJ Cache to add to this Mesh. + * @param {number} [scale=1] - An amount to scale the model data by. Use this if the model has exported too small, or large, to see. + * @param {number} [x=0] - Translate the model x position by this amount. + * @param {number} [y=0] - Translate the model y position by this amount. + * @param {number} [z=0] - Translate the model z position by this amount. + * @param {number} [rotateX=0] - Rotate the model on the x axis by this amount, in radians. + * @param {number} [rotateY=0] - Rotate the model on the y axis by this amount, in radians. + * @param {number} [rotateZ=0] - Rotate the model on the z axis by this amount, in radians. + * @param {boolean} [zIsUp=true] - Is the z axis up (true), or is y axis up (false)? + * + * @return {this} This Mesh Game Object. */ - playMarker: function (key, loop) + addVerticesFromObj: function (key, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp) { - var marker = this.markers[key]; + var data = this.scene.sys.cache.obj.get(key); + var parsedData; - if (marker) + if (data) { - this.play(loop, marker[0], marker[1]); + parsedData = GenerateObjVerts(data, this, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp); + } + + if (!parsedData || parsedData.verts.length === 0) + { + console.warn('Mesh.addVerticesFromObj data empty:', key); } return this; }, /** - * Removes a previously set marker from this video. + * Compare the depth of two Faces. * - * If the marker is currently playing it will _not_ stop playback. + * @method Phaser.GameObjects.Mesh#sortByDepth + * @since 3.50.0 * - * @method Phaser.GameObjects.Video#removeMarker - * @since 3.20.0 + * @param {Phaser.Geom.Mesh.Face} faceA - The first Face. + * @param {Phaser.Geom.Mesh.Face} faceB - The second Face. * - * @param {string} key - The name of the marker to remove. + * @return {number} The difference between the depths of each Face. + */ + sortByDepth: function (faceA, faceB) + { + return faceA.depth - faceB.depth; + }, + + /** + * Runs a depth sort across all Faces in this Mesh, comparing their averaged depth. * - * @return {this} This Video Game Object for method chaining. + * This is called automatically if you use any of the `rotate` methods, but you can + * also invoke it to sort the Faces should you manually position them. + * + * @method Phaser.GameObjects.Mesh#depthSort + * @since 3.50.0 + * + * @return {this} This Mesh Game Object. */ - removeMarker: function (key) + depthSort: function () { - delete this.markers[key]; + StableSort(this.faces, this.sortByDepth); return this; }, /** - * Takes a snapshot of the current frame of the video and renders it to a CanvasTexture object, - * which is then returned. You can optionally resize the grab by passing a width and height. + * Adds a new Vertex into the vertices array of this Mesh. * - * This method returns a reference to the `Video.snapshotTexture` object. Calling this method - * multiple times will overwrite the previous snapshot with the most recent one. + * Just adding a vertex isn't enough to render it. You need to also + * make it part of a Face, with 3 Vertex instances per Face. * - * @method Phaser.GameObjects.Video#snapshot - * @since 3.20.0 + * @method Phaser.GameObjects.Mesh#addVertex + * @since 3.50.0 * - * @param {number} [width] - The width of the resulting CanvasTexture. - * @param {number} [height] - The height of the resulting CanvasTexture. + * @param {number} x - The x position of the vertex. + * @param {number} y - The y position of the vertex. + * @param {number} z - The z position of the vertex. + * @param {number} u - The UV u coordinate of the vertex. + * @param {number} v - The UV v coordinate of the vertex. + * @param {number} [color=0xffffff] - The color value of the vertex. + * @param {number} [alpha=1] - The alpha value of the vertex. * - * @return {Phaser.Textures.CanvasTexture} + * @return {this} This Mesh Game Object. */ - snapshot: function (width, height) + addVertex: function (x, y, z, u, v, color, alpha) { - if (width === undefined) { width = this.width; } - if (height === undefined) { height = this.height; } + var vert = new Vertex(x, y, z, u, v, color, alpha); - return this.snapshotArea(0, 0, this.width, this.height, width, height); + this.vertices.push(vert); + + return vert; }, /** - * Takes a snapshot of the specified area of the current frame of the video and renders it to a CanvasTexture object, - * which is then returned. You can optionally resize the grab by passing a different `destWidth` and `destHeight`. + * Adds a new Face into the faces array of this Mesh. * - * This method returns a reference to the `Video.snapshotTexture` object. Calling this method - * multiple times will overwrite the previous snapshot with the most recent one. + * A Face consists of references to 3 Vertex instances, which must be provided. * - * @method Phaser.GameObjects.Video#snapshotArea - * @since 3.20.0 + * @method Phaser.GameObjects.Mesh#addFace + * @since 3.50.0 * - * @param {number} [x=0] - The horizontal location of the top-left of the area to grab from. - * @param {number} [y=0] - The vertical location of the top-left of the area to grab from. - * @param {number} [srcWidth] - The width of area to grab from the video. If not given it will grab the full video dimensions. - * @param {number} [srcHeight] - The height of area to grab from the video. If not given it will grab the full video dimensions. - * @param {number} [destWidth] - The destination width of the grab, allowing you to resize it. - * @param {number} [destHeight] - The destination height of the grab, allowing you to resize it. + * @param {Phaser.Geom.Mesh.Vertex} vertex1 - The first vertex of the Face. + * @param {Phaser.Geom.Mesh.Vertex} vertex2 - The second vertex of the Face. + * @param {Phaser.Geom.Mesh.Vertex} vertex3 - The third vertex of the Face. * - * @return {Phaser.Textures.CanvasTexture} + * @return {this} This Mesh Game Object. */ - snapshotArea: function (x, y, srcWidth, srcHeight, destWidth, destHeight) + addFace: function (vertex1, vertex2, vertex3) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (srcWidth === undefined) { srcWidth = this.width; } - if (srcHeight === undefined) { srcHeight = this.height; } - if (destWidth === undefined) { destWidth = srcWidth; } - if (destHeight === undefined) { destHeight = srcHeight; } - - var video = this.video; - var snap = this.snapshotTexture; - - if (!snap) - { - snap = this.scene.sys.textures.createCanvas(UUID(), destWidth, destHeight); - - this.snapshotTexture = snap; + var face = new Face(vertex1, vertex2, vertex3); - if (video) - { - snap.context.drawImage(video, x, y, srcWidth, srcHeight, 0, 0, destWidth, destHeight); - } - } - else - { - snap.setSize(destWidth, destHeight); + this.faces.push(face); - if (video) - { - snap.context.drawImage(video, x, y, srcWidth, srcHeight, 0, 0, destWidth, destHeight); - } - } + this.dirtyCache[9] = -1; - return snap.update(); + return face; }, /** - * Stores a copy of this Videos `snapshotTexture` in the Texture Manager using the given key. + * Adds new vertices to this Mesh by parsing the given data. * - * This texture is created when the `snapshot` or `snapshotArea` methods are called. + * This method will take vertex data in one of two formats, based on the `containsZ` parameter. * - * After doing this, any texture based Game Object, such as a Sprite, can use the contents of the - * snapshot by using the texture key: + * If your vertex data are `x`, `y` pairs, then `containsZ` should be `false` (this is the default, and will result in `z=0` for each vertex). + * + * If your vertex data is groups of `x`, `y` and `z` values, then the `containsZ` parameter must be true. + * + * The `uvs` parameter is a numeric array consisting of `u` and `v` pairs. + * + * The `normals` parameter is a numeric array consisting of `x`, `y` vertex normal values and, if `containsZ` is true, `z` values as well. + * + * The `indicies` parameter is an optional array that, if given, is an indexed list of vertices to be added. + * + * The `colors` parameter is an optional array, or single value, that if given sets the color of each vertex created. + * + * The `alphas` parameter is an optional array, or single value, that if given sets the alpha of each vertex created. + * + * When providing indexed data it is assumed that _all_ of the arrays are indexed, not just the vertices. + * + * The following example will create a 256 x 256 sized quad using an index array: * * ```javascript - * var vid = this.add.video(0, 0, 'intro'); + * let mesh = new Mesh(this); // Assuming `this` is a scene! + * const vertices = [ + * -128, 128, + * 128, 128, + * -128, -128, + * 128, -128 + * ]; * - * vid.snapshot(); + * const uvs = [ + * 0, 1, + * 1, 1, + * 0, 0, + * 1, 0 + * ]; * - * vid.saveSnapshotTexture('doodle'); + * const indices = [ 0, 2, 1, 2, 3, 1 ]; * - * this.add.image(400, 300, 'doodle'); + * mesh.addVertices(vertices, uvs, indicies); + * // Note: Otherwise the added points will be "behind" the camera! This value will project vertex `x` & `y` values 1:1 to pixel values. + * mesh.hideCCW = false; + * mesh.setOrtho(mesh.width, mesh.height); * ``` * - * Updating the contents of the `snapshotTexture`, for example by calling `snapshot` again, - * will automatically update _any_ Game Object that is using it as a texture. - * Calling `saveSnapshotTexture` again will not save another copy of the same texture, - * it will just rename the existing one. - * - * By default it will create a single base texture. You can add frames to the texture - * by using the `Texture.add` method. After doing this, you can then allow Game Objects - * to use a specific frame. + * If the data is not indexed, it's assumed that the arrays all contain sequential data. * - * @method Phaser.GameObjects.Video#saveSnapshotTexture - * @since 3.20.0 + * @method Phaser.GameObjects.Mesh#addVertices + * @since 3.50.0 * - * @param {string} key - The unique key to store the texture as within the global Texture Manager. + * @param {number[]} vertices - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. + * @param {number[]} uvs - The UVs pairs array. + * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? If not, it will be assumed `z=0`, see methods `panZ` or `setOrtho`. + * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. * - * @return {Phaser.Textures.CanvasTexture} The Texture that was saved. + * @return {this} This Mesh Game Object. */ - saveSnapshotTexture: function (key) + addVertices: function (vertices, uvs, indicies, containsZ, normals, colors, alphas) { - if (this.snapshotTexture) + var result = GenerateVerts(vertices, uvs, indicies, containsZ, normals, colors, alphas); + + if (result) { - this.scene.sys.textures.renameTexture(this.snapshotTexture.key, key); + this.faces = this.faces.concat(result.faces); + this.vertices = this.vertices.concat(result.vertices); } else { - this.snapshotTexture = this.scene.sys.textures.createCanvas(key, this.width, this.height); + console.warn('Mesh.addVertices data empty or invalid'); } - return this.snapshotTexture; + this.dirtyCache[9] = -1; + + return this; }, /** - * Loads a Video from the given URL, ready for playback with the `Video.play` method. + * Returns the total number of Faces in this Mesh Game Object. * - * You can control at what point the browser determines the video as being ready for playback via - * the `loadEvent` parameter. See https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement - * for more details. + * @method Phaser.GameObjects.Mesh#getFaceCount + * @since 3.50.0 * - * @method Phaser.GameObjects.Video#loadURL - * @since 3.20.0 + * @return {number} The number of Faces in this Mesh Game Object. + */ + getFaceCount: function () + { + return this.faces.length; + }, + + /** + * Returns the total number of Vertices in this Mesh Game Object. * - * @param {string} url - The URL of the video to load or be streamed. - * @param {string} [loadEvent='loadeddata'] - The load event to listen for. Either `loadeddata`, `canplay` or `canplaythrough`. - * @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it. + * @method Phaser.GameObjects.Mesh#getVertexCount + * @since 3.50.0 * - * @return {this} This Video Game Object for method chaining. + * @return {number} The number of Vertices in this Mesh Game Object. */ - loadURL: function (url, loadEvent, noAudio) + getVertexCount: function () { - if (loadEvent === undefined) { loadEvent = 'loadeddata'; } - if (noAudio === undefined) { noAudio = false; } + return this.vertices.length; + }, - if (this.video) - { - this.stop(); - } + /** + * Returns the Face at the given index in this Mesh Game Object. + * + * @method Phaser.GameObjects.Mesh#getFace + * @since 3.50.0 + * + * @param {number} index - The index of the Face to get. + * + * @return {Phaser.Geom.Mesh.Face} The Face at the given index, or `undefined` if index out of range. + */ + getFace: function (index) + { + return this.faces[index]; + }, - if (this.videoTexture) - { - this.scene.sys.textures.remove(this._key); - } + /** + * Tests to see if _any_ face in this Mesh intersects with the given coordinates. + * + * The given position is translated through the matrix of this Mesh and the given Camera, + * before being compared against the vertices. + * + * @method Phaser.GameObjects.Mesh#hasFaceAt + * @since 3.60.0 + * + * @param {number} x - The x position to check against. + * @param {number} y - The y position to check against. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The camera to pass the coordinates through. If not give, the default Scene Camera is used. + * + * @return {boolean} Returns `true` if _any_ face of this Mesh intersects with the given coordinate, otherwise `false`. + */ + hasFaceAt: function (x, y, camera) + { + if (camera === undefined) { camera = this.scene.sys.cameras.main; } - var video = document.createElement('video'); + var calcMatrix = GetCalcMatrix(this, camera).calc; - video.controls = false; + var faces = this.faces; - if (noAudio) + for (var i = 0; i < faces.length; i++) { - video.muted = true; - video.defaultMuted = true; + var face = faces[i]; - video.setAttribute('autoplay', 'autoplay'); + if (face.contains(x, y, calcMatrix)) + { + return true; + } } - video.setAttribute('playsinline', 'playsinline'); - video.setAttribute('preload', 'auto'); - - video.addEventListener('error', this._callbacks.error, true); - - video.src = url; - - video.load(); - - this.video = video; - - return this; + return false; }, /** - * Loads a Video from the given MediaStream object, ready for playback with the `Video.play` method. + * Return an array of Face objects from this Mesh that intersect with the given coordinates. * - * You can control at what point the browser determines the video as being ready for playback via - * the `loadEvent` parameter. See https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement - * for more details. + * The given position is translated through the matrix of this Mesh and the given Camera, + * before being compared against the vertices. * - * @method Phaser.GameObjects.Video#loadMediaStream + * If more than one Face intersects, they will all be returned in the array, but the array will + * be depth sorted first, so the first element will always be that closest to the camera. + * + * @method Phaser.GameObjects.Mesh#getFaceAt * @since 3.50.0 * - * @param {string} stream - The MediaStream object. - * @param {string} [loadEvent='loadeddata'] - The load event to listen for. Either `loadeddata`, `canplay` or `canplaythrough`. - * @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it. + * @param {number} x - The x position to check against. + * @param {number} y - The y position to check against. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The camera to pass the coordinates through. If not give, the default Scene Camera is used. * - * @return {this} This Video Game Object for method chaining. + * @return {Phaser.Geom.Mesh.Face[]} An array of Face objects that intersect with the given point, ordered by depth. */ - loadMediaStream: function (stream, loadEvent, noAudio) + getFaceAt: function (x, y, camera) { - if (loadEvent === undefined) { loadEvent = 'loadeddata'; } - if (noAudio === undefined) { noAudio = false; } - - if (this.video) - { - this.stop(); - } - - if (this.videoTexture) - { - this.scene.sys.textures.remove(this._key); - } + if (camera === undefined) { camera = this.scene.sys.cameras.main; } - var video = document.createElement('video'); + var calcMatrix = GetCalcMatrix(this, camera).calc; - video.controls = false; + var faces = this.faces; + var results = []; - if (noAudio) + for (var i = 0; i < faces.length; i++) { - video.muted = true; - video.defaultMuted = true; - - video.setAttribute('autoplay', 'autoplay'); - } - - video.setAttribute('playsinline', 'playsinline'); - video.setAttribute('preload', 'auto'); - - video.addEventListener('error', this._callbacks.error, true); + var face = faces[i]; - try - { - video.srcObject = stream; - } - catch (error) - { - video.src = window.URL.createObjectURL(stream); + if (face.contains(x, y, calcMatrix)) + { + results.push(face); + } } - video.load(); - - this.video = video; - - return this; + return StableSort(results, this.sortByDepth); }, /** - * This internal method is called automatically if the playback Promise resolves successfully. + * This method enables rendering of the Mesh vertices to the given Graphics instance. * - * @method Phaser.GameObjects.Video#playPromiseSuccessHandler - * @fires Phaser.GameObjects.Events#VIDEO_PLAY - * @private - * @since 3.20.0 + * If you enable this feature, you **must** call `Graphics.clear()` in your Scene `update`, + * otherwise the Graphics instance you provide to debug will fill-up with draw calls, + * eventually crashing the browser. This is not done automatically to allow you to debug + * draw multiple Mesh objects to a single Graphics instance. + * + * The Mesh class has a built-in debug rendering callback `Mesh.renderDebug`, however + * you can also provide your own callback to be used instead. Do this by setting the `callback` parameter. + * + * The callback is invoked _once per render_ and sent the following parameters: + * + * `callback(src, faces)` + * + * `src` is the Mesh instance being debugged. + * `faces` is an array of the Faces that were rendered. + * + * You can get the final drawn vertex position from a Face object like this: + * + * ```javascript + * let face = faces[i]; + * + * let x0 = face.vertex1.tx; + * let y0 = face.vertex1.ty; + * let x1 = face.vertex2.tx; + * let y1 = face.vertex2.ty; + * let x2 = face.vertex3.tx; + * let y2 = face.vertex3.ty; + * + * graphic.strokeTriangle(x0, y0, x1, y1, x2, y2); + * ``` + * + * If using your own callback you do not have to provide a Graphics instance to this method. + * + * To disable debug rendering, to either your own callback or the built-in one, call this method + * with no arguments. + * + * @method Phaser.GameObjects.Mesh#setDebug + * @since 3.50.0 + * + * @param {Phaser.GameObjects.Graphics} [graphic] - The Graphic instance to render to if using the built-in callback. + * @param {function} [callback] - The callback to invoke during debug render. Leave as undefined to use the built-in callback. + * + * @return {this} This Game Object instance. */ - playPromiseSuccessHandler: function () + setDebug: function (graphic, callback) { - this._codePaused = false; - this.touchLocked = false; - - this.emit(Events.VIDEO_PLAY, this); + this.debugGraphic = graphic; - if (this._markerIn > -1) + if (!graphic && !callback) { - this.video.currentTime = this._markerIn; + this.debugCallback = null; + } + else if (!callback) + { + this.debugCallback = this.renderDebug; + } + else + { + this.debugCallback = callback; } + + return this; }, /** - * This internal method is called automatically if the playback Promise fails to resolve. + * Checks if the transformation data in this mesh is dirty. * - * @method Phaser.GameObjects.Video#playPromiseErrorHandler - * @fires Phaser.GameObjects.Events#VIDEO_ERROR - * @private - * @since 3.20.0 + * This is used internally by the `preUpdate` step to determine if the vertices should + * be recalculated or not. + * + * @method Phaser.GameObjects.Mesh#isDirty + * @since 3.50.0 * - * @param {any} error - The Promise resolution error. + * @return {boolean} Returns `true` if the data of this mesh is dirty, otherwise `false`. */ - playPromiseErrorHandler: function (error) + isDirty: function () { - this.scene.sys.input.once(InputEvents.POINTER_DOWN, this.unlockHandler, this); + var position = this.modelPosition; + var rotation = this.modelRotation; + var scale = this.modelScale; + var dirtyCache = this.dirtyCache; + + var px = position.x; + var py = position.y; + var pz = position.z; - this.touchLocked = true; - this.playWhenUnlocked = true; + var rx = rotation.x; + var ry = rotation.y; + var rz = rotation.z; - this.emit(Events.VIDEO_ERROR, this, error); - }, + var sx = scale.x; + var sy = scale.y; + var sz = scale.z; - /** - * Called when the video emits a `playing` event during load. - * - * This is only listened for if the browser doesn't support Promises. - * - * @method Phaser.GameObjects.Video#playHandler - * @fires Phaser.GameObjects.Events#VIDEO_PLAY - * @since 3.20.0 - */ - playHandler: function () - { - this._codePaused = false; - this.touchLocked = false; + var faces = this.getFaceCount(); - this.emit(Events.VIDEO_PLAY, this); + var pxCached = dirtyCache[0]; + var pyCached = dirtyCache[1]; + var pzCached = dirtyCache[2]; - this.video.removeEventListener('playing', this._callbacks.play, true); - }, + var rxCached = dirtyCache[3]; + var ryCached = dirtyCache[4]; + var rzCached = dirtyCache[5]; - /** - * This internal method is called automatically if the video fails to load. - * - * @method Phaser.GameObjects.Video#loadErrorHandler - * @fires Phaser.GameObjects.Events#VIDEO_ERROR - * @private - * @since 3.20.0 - * - * @param {Event} event - The error Event. - */ - loadErrorHandler: function (event) - { - this.stop(); + var sxCached = dirtyCache[6]; + var syCached = dirtyCache[7]; + var szCached = dirtyCache[8]; - this.emit(Events.VIDEO_ERROR, this, event); - }, + var fCached = dirtyCache[9]; - /** - * This internal method is called if the video couldn't be played because it was interaction locked - * by the browser, but an input event has since been received. - * - * @method Phaser.GameObjects.Video#unlockHandler - * @fires Phaser.GameObjects.Events#VIDEO_UNLOCKED - * @fires Phaser.GameObjects.Events#VIDEO_PLAY - * @private - * @since 3.20.0 - * - * @param {any} error - The Promise resolution error. - */ - unlockHandler: function () - { - this.touchLocked = false; - this.playWhenUnlocked = false; + dirtyCache[0] = px; + dirtyCache[1] = py; + dirtyCache[2] = pz; - this.emit(Events.VIDEO_UNLOCKED, this); + dirtyCache[3] = rx; + dirtyCache[4] = ry; + dirtyCache[5] = rz; - if (this._markerIn > -1) - { - this.video.currentTime = this._markerIn; - } + dirtyCache[6] = sx; + dirtyCache[7] = sy; + dirtyCache[8] = sz; - this.video.play(); + dirtyCache[9] = faces; - this.emit(Events.VIDEO_PLAY, this); + return ( + pxCached !== px || pyCached !== py || pzCached !== pz || + rxCached !== rx || ryCached !== ry || rzCached !== rz || + sxCached !== sx || syCached !== sy || szCached !== sz || + fCached !== faces + ); }, /** - * Called when the video completes playback, i.e. reaches an `ended` state. + * The Mesh update loop. The following takes place in this method: * - * This will never happen if the video is coming from a live stream, where the duration is `Infinity`. + * First, the `totalRendered` and `totalFrame` properties are set. * - * @method Phaser.GameObjects.Video#completeHandler - * @fires Phaser.GameObjects.Events#VIDEO_COMPLETE - * @since 3.20.0 - */ - completeHandler: function () - { - this.emit(Events.VIDEO_COMPLETE, this); - }, - - /** - * Called when the video emits a `timeUpdate` event during playback. + * If the view matrix of this Mesh isn't dirty, and the model position, rotate or scale properties are + * all clean, then the method returns at this point. * - * This event is too slow and irregular to be used for actual video timing or texture updating, - * but we can use it to determine if a video has looped. + * Otherwise, if the viewPosition is dirty (i.e. from calling a method like `panZ`), then it will + * refresh the viewMatrix. * - * @method Phaser.GameObjects.Video#timeUpdateHandler - * @fires Phaser.GameObjects.Events#VIDEO_LOOP - * @since 3.20.0 - */ - timeUpdateHandler: function () - { - if (this.video && this.video.currentTime < this._lastUpdate) - { - this.emit(Events.VIDEO_LOOP, this); - - this._lastUpdate = 0; - } - }, - - /** - * The internal update step. + * After this, a new transformMatrix is built and it then iterates through all Faces in this + * Mesh, calling `transformCoordinatesLocal` on all of them. Internally, this updates every + * vertex, calculating its new transformed position, based on the new transform matrix. * - * @method Phaser.GameObjects.Video#preUpdate - * @private - * @since 3.20.0 + * Finally, the faces are depth sorted. + * + * @method Phaser.GameObjects.Mesh#preUpdate + * @protected + * @since 3.50.0 + * + * @param {number} time - The current timestamp. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ preUpdate: function () { - var video = this.video; + this.totalRendered = this.totalFrame; + this.totalFrame = 0; - if (video) + var dirty = this.dirtyCache; + + if (!this.ignoreDirtyCache && !dirty[10] && !this.isDirty()) { - var currentTime = video.currentTime; + // If neither the view or the mesh is dirty we can bail out and save lots of math + return; + } - // Don't render a new frame unless the video has actually changed time - if (currentTime !== this._lastUpdate) - { - this._lastUpdate = currentTime; + var width = this.width; + var height = this.height; - this.updateTexture(); + var viewMatrix = this.viewMatrix; + var viewPosition = this.viewPosition; - if (currentTime >= this._markerOut) - { - if (video.loop) - { - video.currentTime = this._markerIn; + if (dirty[10]) + { + viewMatrix.identity(); + viewMatrix.translate(viewPosition); + viewMatrix.invert(); - this.updateTexture(); + dirty[10] = 0; + } - this._lastUpdate = currentTime; + var transformMatrix = this.transformMatrix; - this.emit(Events.VIDEO_LOOP, this); - } - else - { - this.emit(Events.VIDEO_COMPLETE, this); + transformMatrix.setWorldMatrix( + this.modelRotation, + this.modelPosition, + this.modelScale, + this.viewMatrix, + this.projectionMatrix + ); - this.stop(); - } - } - } - } - }, + var z = viewPosition.z; - /** - * Internal callback that monitors the download progress of a video after changing its source. - * - * @method Phaser.GameObjects.Video#checkVideoProgress - * @fires Phaser.GameObjects.Events#VIDEO_TIMEOUT - * @private - * @since 3.20.0 - */ - checkVideoProgress: function () - { - if (this.video.readyState >= 2) + var faces = this.faces; + + for (var i = 0; i < faces.length; i++) { - // We've got enough data to update the texture for playback - this.updateTexture(); + faces[i].transformCoordinatesLocal(transformMatrix, width, height, z); } - else - { - this.retry--; - if (this.retry > 0) - { - this._retryID = window.setTimeout(this.checkVideoProgress.bind(this), this.retryInterval); - } - else - { - this.emit(Events.VIDEO_TIMEOUT, this); - } - } + this.depthSort(); }, /** - * Internal method that is called when enough video data has been received in order to create a texture - * from it. The texture is assigned to the `Video.videoTexture` property and given a base frame that - * encompases the whole video size. + * The built-in Mesh debug rendering method. * - * @method Phaser.GameObjects.Video#updateTexture - * @since 3.20.0 + * See `Mesh.setDebug` for more details. + * + * @method Phaser.GameObjects.Mesh#renderDebug + * @since 3.50.0 + * + * @param {Phaser.GameObjects.Mesh} src - The Mesh object being rendered. + * @param {Phaser.Geom.Mesh.Face[]} faces - An array of Faces. */ - updateTexture: function () + renderDebug: function (src, faces) { - var video = this.video; - - var width = video.videoWidth; - var height = video.videoHeight; + var graphic = src.debugGraphic; - if (!this.videoTexture) + for (var i = 0; i < faces.length; i++) { - this.videoTexture = this.scene.sys.textures.create(this._key, video, width, height); - this.videoTextureSource = this.videoTexture.source[0]; - this.videoTexture.add('__BASE', 0, 0, 0, width, height); + var face = faces[i]; - this.setTexture(this.videoTexture); - this.setSizeToFrame(); - this.updateDisplayOrigin(); + var x0 = face.vertex1.tx; + var y0 = face.vertex1.ty; + var x1 = face.vertex2.tx; + var y1 = face.vertex2.ty; + var x2 = face.vertex3.tx; + var y2 = face.vertex3.ty; - this.emit(Events.VIDEO_CREATED, this, width, height); + graphic.strokeTriangle(x0, y0, x1, y1, x2, y2); } - else - { - var textureSource = this.videoTextureSource; + }, - if (textureSource.source !== video) - { - textureSource.source = video; - textureSource.width = width; - textureSource.height = height; - } + /** + * Handles the pre-destroy step for the Mesh, which removes the vertices and debug callbacks. + * + * @method Phaser.GameObjects.Mesh#preDestroy + * @private + * @since 3.50.0 + */ + preDestroy: function () + { + this.clear(); - textureSource.update(); - } + this.debugCallback = null; + this.debugGraphic = null; }, /** - * Returns the key of the currently played video, as stored in the Video Cache. - * If the video did not come from the cache this will return an empty string. + * Clears all tint values associated with this Game Object. * - * @method Phaser.GameObjects.Video#getVideoKey - * @since 3.20.0 + * Immediately sets the color values back to 0xffffff on all vertices, + * which results in no visible change to the texture. * - * @return {string} The key of the video being played from the Video Cache, if any. + * @method Phaser.GameObjects.Mesh#clearTint + * @webglOnly + * @since 3.60.0 + * + * @return {this} This Game Object instance. */ - getVideoKey: function () + clearTint: function () { - return this._cacheKey; + return this.setTint(); }, /** - * Seeks to a given point in the video. The value is given as a float between 0 and 1, - * where 0 represents the start of the video and 1 represents the end. - * - * Seeking only works if the video has a duration, so will not work for live streams. - * - * When seeking begins, this video will emit a `seeking` event. When the video completes - * seeking (i.e. reaches its designated timestamp) it will emit a `seeked` event. + * Pass this Mesh Game Object to the Input Manager to enable it for Input. * - * If you wish to seek based on time instead, use the `Video.setCurrentTime` method. + * Unlike other Game Objects, the Mesh Game Object uses its own special hit area callback, which you cannot override. * - * @method Phaser.GameObjects.Video#seekTo - * @since 3.20.0 + * @example + * mesh.setInteractive(); * - * @param {number} value - The point in the video to seek to. A value between 0 and 1. + * @method Phaser.GameObjects.Mesh#setInteractive + * @since 3.60.0 * - * @return {this} This Video Game Object for method chaining. + * @return {this} This GameObject. */ - seekTo: function (value) + setInteractive: function () { - var video = this.video; + var faces = this.faces; - if (video) + var hitAreaCallback = function (area, x, y) { - var duration = video.duration; - - if (duration !== Infinity && !isNaN(duration)) + for (var i = 0; i < faces.length; i++) { - var seekTime = duration * value; + var face = faces[i]; - this.setCurrentTime(seekTime); + // Don't pass a calcMatrix, as the x/y are already transformed + if (face.contains(x, y)) + { + return true; + } } - } + + return false; + }; + + this.scene.sys.input.enable(this, hitAreaCallback); return this; }, /** - * A double-precision floating-point value indicating the current playback time in seconds. - * If the media has not started to play and has not been seeked, this value is the media's initial playback time. + * Sets an additive tint on all vertices of this Mesh Game Object. * - * @method Phaser.GameObjects.Video#getCurrentTime - * @since 3.20.0 + * The tint works by taking the pixel color values from the Game Objects texture, and then + * multiplying it by the color value of the tint. * - * @return {number} A double-precision floating-point value indicating the current playback time in seconds. + * To modify the tint color once set, either call this method again with new values or use the + * `tint` property to set all colors at once. + * + * To remove a tint call `clearTint`. + * + * @method Phaser.GameObjects.Mesh#setTint + * @webglOnly + * @since 3.60.0 + * + * @param {number} [tint=0xffffff] - The tint being applied to all vertices of this Mesh Game Object. + * + * @return {this} This Game Object instance. */ - getCurrentTime: function () + setTint: function (tint) { - return (this.video) ? this.video.currentTime : 0; + if (tint === undefined) { tint = 0xffffff; } + + var vertices = this.vertices; + + for (var i = 0; i < vertices.length; i++) + { + vertices[i].color = tint; + } + + return this; }, /** - * Seeks to a given playback time in the video. The value is given in _seconds_ or as a string. + * Scrolls the UV texture coordinates of all faces in this Mesh by + * adding the given x/y amounts to them. * - * Seeking only works if the video has a duration, so will not work for live streams. + * If you only wish to scroll one coordinate, pass a value of zero + * to the other. * - * When seeking begins, this video will emit a `seeking` event. When the video completes - * seeking (i.e. reaches its designated timestamp) it will emit a `seeked` event. + * Use small values for scrolling. UVs are set from the range 0 + * to 1, so you should increment (or decrement) them by suitably + * small values, such as 0.01. * - * You can provide a string prefixed with either a `+` or a `-`, such as `+2.5` or `-2.5`. - * In this case it will seek to +/- the value given, relative to the _current time_. + * Due to a limitation in WebGL1 you can only UV scroll textures + * that are a power-of-two in size. Scrolling NPOT textures will + * work but will result in clamping the pixels to the edges. * - * If you wish to seek based on a duration percentage instead, use the `Video.seekTo` method. + * Note that if this Mesh is using a _frame_ from a texture atlas + * then you will be unable to UV scroll its texture. * - * @method Phaser.GameObjects.Video#setCurrentTime - * @since 3.20.0 + * @method Phaser.GameObjects.Mesh#uvScroll + * @webglOnly + * @since 3.60.0 * - * @param {(string|number)} value - The playback time to seek to in seconds. Can be expressed as a string, such as `+2` to seek 2 seconds ahead from the current time. + * @param {number} x - The amount to horizontally shift the UV coordinates by. + * @param {number} y - The amount to vertically shift the UV coordinates by. * - * @return {this} This Video Game Object for method chaining. + * @return {this} This Game Object instance. */ - setCurrentTime: function (value) + uvScroll: function (x, y) { - var video = this.video; + var faces = this.faces; - if (video) + for (var i = 0; i < faces.length; i++) { - if (typeof value === 'string') - { - var op = value[0]; - var num = parseFloat(value.substr(1)); - - if (op === '+') - { - value = video.currentTime + num; - } - else if (op === '-') - { - value = video.currentTime - num; - } - } - - video.currentTime = value; - - this._lastUpdate = value; + faces[i].scrollUV(x, y); } return this; }, /** - * Returns a boolean indicating if this Video is currently seeking, or not. + * Scales the UV texture coordinates of all faces in this Mesh by + * the exact given amounts. * - * @method Phaser.GameObjects.Video#isSeeking - * @since 3.20.0 + * If you only wish to scale one coordinate, pass a value of one + * to the other. + * + * Due to a limitation in WebGL1 you can only UV scale textures + * that are a power-of-two in size. Scaling NPOT textures will + * work but will result in clamping the pixels to the edges if + * you scale beyond a value of 1. Scaling below 1 will work + * regardless of texture size. + * + * Note that if this Mesh is using a _frame_ from a texture atlas + * then you will be unable to UV scale its texture. * - * @return {boolean} A boolean indicating if this Video is currently seeking, or not. + * @method Phaser.GameObjects.Mesh#uvScale + * @webglOnly + * @since 3.60.0 + * + * @param {number} x - The amount to horizontally scale the UV coordinates by. + * @param {number} y - The amount to vertically scale the UV coordinates by. + * + * @return {this} This Game Object instance. */ - isSeeking: function () + uvScale: function (x, y) { - return this._isSeeking; + var faces = this.faces; + + for (var i = 0; i < faces.length; i++) + { + faces[i].scaleUV(x, y); + } + + return this; }, /** - * Internal seeking handler. + * The tint value being applied to the whole of the Game Object. + * This property is a setter-only. * - * @method Phaser.GameObjects.Video#seekingHandler - * @fires Phaser.GameObjects.Events#VIDEO_SEEKING - * @private - * @since 3.20.0 + * @method Phaser.GameObjects.Mesh#tint + * @type {number} + * @webglOnly + * @since 3.60.0 */ - seekingHandler: function () - { - this._isSeeking = true; + tint: { - this.emit(Events.VIDEO_SEEKING, this); + set: function (value) + { + this.setTint(value); + } }, /** - * Internal seeked handler. + * The x rotation of the Model in 3D space, as specified in degrees. * - * @method Phaser.GameObjects.Video#seekedHandler - * @fires Phaser.GameObjects.Events#VIDEO_SEEKED - * @private - * @since 3.20.0 + * If you need the value in radians use the `modelRotation.x` property directly. + * + * @method Phaser.GameObjects.Mesh#rotateX + * @type {number} + * @since 3.60.0 */ - seekedHandler: function () - { - this._isSeeking = false; - - this.emit(Events.VIDEO_SEEKED, this); + rotateX: { - var video = this.video; + get: function () + { + return RadToDeg(this.modelRotation.x); + }, - if (video) + set: function (value) { - this.updateTexture(); + this.modelRotation.x = DegToRad(value); } + }, /** - * Returns the current progress of the video. Progress is defined as a value between 0 (the start) - * and 1 (the end). + * The y rotation of the Model in 3D space, as specified in degrees. * - * Progress can only be returned if the video has a duration, otherwise it will always return zero. + * If you need the value in radians use the `modelRotation.y` property directly. * - * @method Phaser.GameObjects.Video#getProgress - * @since 3.20.0 - * - * @return {number} The current progress of playback. If the video has no duration, will always return zero. + * @method Phaser.GameObjects.Mesh#rotateY + * @type {number} + * @since 3.60.0 */ - getProgress: function () - { - var video = this.video; + rotateY: { - if (video) + get: function () { - var now = video.currentTime; - var duration = video.duration; + return RadToDeg(this.modelRotation.y); + }, - if (duration !== Infinity && !isNaN(duration)) - { - return now / duration; - } + set: function (value) + { + this.modelRotation.y = DegToRad(value); } - return 0; }, /** - * A double-precision floating-point value which indicates the duration (total length) of the media in seconds, - * on the media's timeline. If no media is present on the element, or the media is not valid, the returned value is NaN. - * - * If the media has no known end (such as for live streams of unknown duration, web radio, media incoming from WebRTC, - * and so forth), this value is +Infinity. + * The z rotation of the Model in 3D space, as specified in degrees. * - * @method Phaser.GameObjects.Video#getDuration - * @since 3.20.0 + * If you need the value in radians use the `modelRotation.z` property directly. * - * @return {number} A double-precision floating-point value indicating the duration of the media in seconds. + * @method Phaser.GameObjects.Mesh#rotateZ + * @type {number} + * @since 3.60.0 */ - getDuration: function () + rotateZ: { + + get: function () + { + return RadToDeg(this.modelRotation.z); + }, + + set: function (value) + { + this.modelRotation.z = DegToRad(value); + } + + } + +}); + +module.exports = Mesh; + + +/***/ }), + +/***/ 6317: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * This is a stub function for Mesh.Render. There is no Canvas renderer for Mesh objects. + * + * @method Phaser.GameObjects.Mesh#renderCanvas + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var MeshCanvasRenderer = function () +{ +}; + +module.exports = MeshCanvasRenderer; + + +/***/ }), + +/***/ 41839: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var GetValue = __webpack_require__(10850); +var Mesh = __webpack_require__(83321); + +/** + * Creates a new Mesh Game Object and returns it. + * + * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#mesh + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.Mesh.MeshConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Mesh} The Game Object that was created. + */ +GameObjectCreator.register('mesh', function (config, addToScene) +{ + if (config === undefined) { config = {}; } + + var key = GetAdvancedValue(config, 'key', null); + var frame = GetAdvancedValue(config, 'frame', null); + var vertices = GetValue(config, 'vertices', []); + var uvs = GetValue(config, 'uvs', []); + var indicies = GetValue(config, 'indicies', []); + var containsZ = GetValue(config, 'containsZ', false); + var normals = GetValue(config, 'normals', []); + var colors = GetValue(config, 'colors', 0xffffff); + var alphas = GetValue(config, 'alphas', 1); + + var mesh = new Mesh(this.scene, 0, 0, key, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas); + + if (addToScene !== undefined) { - return (this.video) ? this.video.duration : 0; - }, + config.add = addToScene; + } - /** - * Sets the muted state of the currently playing video, if one is loaded. - * - * @method Phaser.GameObjects.Video#setMute - * @since 3.20.0 - * - * @param {boolean} [value=true] - The mute value. `true` if the video should be muted, otherwise `false`. - * - * @return {this} This Video Game Object for method chaining. - */ - setMute: function (value) + BuildGameObject(this.scene, mesh, config); + + return mesh; +}); + + +/***/ }), + +/***/ 8767: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Mesh = __webpack_require__(83321); +var GameObjectFactory = __webpack_require__(61286); + +/** + * Creates a new Mesh Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#mesh + * @webglOnly + * @since 3.0.0 + * + * @param {number} [x] - The horizontal position of this Game Object in the world. + * @param {number} [y] - The vertical position of this Game Object in the world. + * @param {string|Phaser.Textures.Texture} [texture] - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {string|number} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {number[]} [vertices] - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. + * @param {number[]} [uvs] - The UVs pairs array. + * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? + * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. + * + * @return {Phaser.GameObjects.Mesh} The Game Object that was created. + */ +if (true) +{ + GameObjectFactory.register('mesh', function (x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas) { - if (value === undefined) { value = true; } + return this.displayList.add(new Mesh(this.scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas)); + }); +} - this._codeMuted = value; - var video = this.video; +/***/ }), - if (video) - { - video.muted = (this._systemMuted) ? true : value; - } +/***/ 23464: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Returns a boolean indicating if this Video is currently muted. - * - * @method Phaser.GameObjects.Video#isMuted - * @since 3.20.0 - * - * @return {boolean} A boolean indicating if this Video is currently muted, or not. - */ - isMuted: function () +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(57410); +} + +if (true) +{ + renderCanvas = __webpack_require__(6317); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), + +/***/ 57410: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetCalcMatrix = __webpack_require__(73329); + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Mesh#renderWebGL + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var MeshWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + var faces = src.faces; + var totalFaces = faces.length; + + if (totalFaces === 0) { - return this._codeMuted; - }, + return; + } - /** - * Internal global mute handler. Will mute the video, if playing, if the global sound system mutes. - * - * @method Phaser.GameObjects.Video#globalMute - * @private - * @since 3.20.0 - * - * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the Sound Manager that emitted the event. - * @param {boolean} mute - The mute value. `true` if the Sound Manager is now muted, otherwise `false`. - */ - globalMute: function (soundManager, value) + camera.addToRenderList(src); + + var pipeline = renderer.pipelines.set(src.pipeline, src); + + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + + // This causes a flush if the Mesh has a Post Pipeline + renderer.pipelines.preBatch(src); + + var textureUnit = pipeline.setGameObject(src); + + var F32 = pipeline.vertexViewF32; + var U32 = pipeline.vertexViewU32; + + var vertexOffset = (pipeline.vertexCount * pipeline.currentShader.vertexComponentCount) - 1; + + var tintEffect = src.tintFill; + + var debugFaces = []; + var debugCallback = src.debugCallback; + + var a = calcMatrix.a; + var b = calcMatrix.b; + var c = calcMatrix.c; + var d = calcMatrix.d; + var e = calcMatrix.e; + var f = calcMatrix.f; + + var z = src.viewPosition.z; + + var hideCCW = src.hideCCW; + var roundPixels = camera.roundPixels; + var alpha = camera.alpha * src.alpha; + + var totalFacesRendered = 0; + + for (var i = 0; i < totalFaces; i++) { - this._systemMuted = value; + var face = faces[i]; - var video = this.video; + // If face has alpha <= 0, or hideCCW + clockwise, or isn't in camera view, then don't draw it + if (!face.isInView(camera, hideCCW, z, alpha, a, b, c, d, e, f, roundPixels)) + { + continue; + } - if (video) + if (pipeline.shouldFlush(3)) { - video.muted = (this._codeMuted) ? true : value; + pipeline.flush(); + + textureUnit = pipeline.setGameObject(src); + + vertexOffset = 0; } - }, - /** - * Internal global pause handler. Will pause the video if the Game itself pauses. - * - * @method Phaser.GameObjects.Video#globalPause - * @private - * @since 3.20.0 - */ - globalPause: function () - { - this._systemPaused = true; + vertexOffset = face.load(F32, U32, vertexOffset, textureUnit, tintEffect); - if (this.video) + totalFacesRendered++; + + pipeline.vertexCount += 3; + + pipeline.currentBatch.count = (pipeline.vertexCount - pipeline.currentBatch.start); + + if (debugCallback) { - this.video.pause(); + debugFaces.push(face); } - }, + } - /** - * Internal global resume handler. Will resume a paused video if the Game itself resumes. - * - * @method Phaser.GameObjects.Video#globalResume - * @private - * @since 3.20.0 - */ - globalResume: function () + src.totalFrame += totalFacesRendered; + + if (debugCallback) { - this._systemPaused = false; + debugCallback.call(src, src, debugFaces); + } + + renderer.pipelines.postBatch(src); +}; + +module.exports = MeshWebGLRenderer; + + +/***/ }), + +/***/ 44139: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var NineSliceRender = __webpack_require__(94456); +var Vertex = __webpack_require__(85769); + +/** + * @classdesc + * A Nine Slice Game Object allows you to display a texture-based object that + * can be stretched both horizontally and vertically, but that retains + * fixed-sized corners. The dimensions of the corners are set via the + * parameters to this class. + * + * This is extremely useful for UI and button like elements, where you need + * them to expand to accommodate the content without distorting the texture. + * + * The texture you provide for this Game Object should be based on the + * following layout structure: + * + * ``` + * A B + * +---+----------------------+---+ + * C | 1 | 2 | 3 | + * +---+----------------------+---+ + * | | | | + * | 4 | 5 | 6 | + * | | | | + * +---+----------------------+---+ + * D | 7 | 8 | 9 | + * +---+----------------------+---+ + * ``` + * + * When changing this objects width and / or height: + * + * areas 1, 3, 7 and 9 (the corners) will remain unscaled + * areas 2 and 8 will be stretched horizontally only + * areas 4 and 6 will be stretched vertically only + * area 5 will be stretched both horizontally and vertically + * + * You can also create a 3 slice Game Object: + * + * This works in a similar way, except you can only stretch it horizontally. + * Therefore, it requires less configuration: + * + * ``` + * A B + * +---+----------------------+---+ + * | | | | + * C | 1 | 2 | 3 | + * | | | | + * +---+----------------------+---+ + * ``` + * + * When changing this objects width (you cannot change its height) + * + * areas 1 and 3 will remain unscaled + * area 2 will be stretched horizontally + * + * The above configuration concept is adapted from the Pixi NineSlicePlane. + * + * To specify a 3 slice object instead of a 9 slice you should only + * provide the `leftWidth` and `rightWidth` parameters. To create a 9 slice + * you must supply all parameters. + * + * The _minimum_ width this Game Object can be is the total of + * `leftWidth` + `rightWidth`. The _minimum_ height this Game Object + * can be is the total of `topHeight` + `bottomHeight`. + * If you need to display this object at a smaller size, you can scale it. + * + * In terms of performance, using a 3 slice Game Object is the equivalent of + * having 3 Sprites in a row. Using a 9 slice Game Object is the equivalent + * of having 9 Sprites in a row. The vertices of this object are all batched + * together and can co-exist with other Sprites and graphics on the display + * list, without incurring any additional overhead. + * + * As of Phaser 3.60 this Game Object is WebGL only. + * + * @class NineSlice + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.60.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of the center of this Game Object in the world. + * @param {number} y - The vertical position of the center of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {number} [width=256] - The width of the Nine Slice Game Object. You can adjust the width post-creation. + * @param {number} [height=256] - The height of the Nine Slice Game Object. If this is a 3 slice object the height will be fixed to the height of the texture and cannot be changed. + * @param {number} [leftWidth=10] - The size of the left vertical column (A). + * @param {number} [rightWidth=10] - The size of the right vertical column (B). + * @param {number} [topHeight=0] - The size of the top horiztonal row (C). Set to zero or undefined to create a 3 slice object. + * @param {number} [bottomHeight=0] - The size of the bottom horiztonal row (D). Set to zero or undefined to create a 3 slice object. + */ +var NineSlice = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.GetBounds, + Components.Mask, + Components.Origin, + Components.Pipeline, + Components.PostPipeline, + Components.ScrollFactor, + Components.Texture, + Components.Transform, + Components.Visible, + NineSliceRender + ], + + initialize: + + function NineSlice (scene, x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight) + { + if (width === undefined) { width = 256; } + if (height === undefined) { height = 256; } + + if (leftWidth === undefined) { leftWidth = 10; } + if (rightWidth === undefined) { rightWidth = 10; } + if (topHeight === undefined) { topHeight = 0; } + if (bottomHeight === undefined) { bottomHeight = 0; } + + GameObject.call(this, scene, 'NineSlice'); + + /** + * Internal width value. Do not modify this property directly. + * + * @name Phaser.GameObjects.NineSlice#_width + * @private + * @type {number} + * @since 3.60.0 + */ + this._width; + + /** + * Internal height value. Do not modify this property directly. + * + * @name Phaser.GameObjects.NineSlice#_height + * @private + * @type {number} + * @since 3.60.0 + */ + this._height; + + /** + * Internal originX value. Do not modify this property directly. + * + * @name Phaser.GameObjects.NineSlice#_originX + * @private + * @type {number} + * @since 3.60.0 + */ + this._originX = 0.5; + + /** + * Internal originY value. Do not modify this property directly. + * + * @name Phaser.GameObjects.NineSlice#_originY + * @private + * @type {number} + * @since 3.60.0 + */ + this._originY = 0.5; + + /** + * Internal component value. Do not modify this property directly. + * + * @name Phaser.GameObjects.NineSlice#_sizeComponent + * @private + * @type {boolean} + * @since 3.60.0 + */ + this._sizeComponent = true; + + /** + * An array of Vertex objects that correspond to the quads that make-up + * this Nine Slice Game Object. They are stored in the following order: + * + * Top Left - Indexes 0 - 5 + * Top Center - Indexes 6 - 11 + * Top Right - Indexes 12 - 17 + * Center Left - Indexes 18 - 23 + * Center - Indexes 24 - 29 + * Center Right - Indexes 30 - 35 + * Bottom Left - Indexes 36 - 41 + * Bottom Center - Indexes 42 - 47 + * Bottom Right - Indexes 48 - 53 + * + * Each quad is represented by 6 Vertex instances. + * + * This array will contain 18 elements for a 3 slice object + * and 54 for a nine slice object. + * + * You should never modify this array once it has been populated. + * + * @name Phaser.GameObjects.NineSlice#vertices + * @type {Phaser.Geom.Mesh.Vertex[]} + * @since 3.60.0 + */ + this.vertices = []; + + /** + * The size of the left vertical bar (A). + * + * @name Phaser.GameObjects.NineSlice#leftWidth + * @type {number} + * @readonly + * @since 3.60.0 + */ + this.leftWidth; + + /** + * The size of the right vertical bar (B). + * + * @name Phaser.GameObjects.NineSlice#rightWidth + * @type {number} + * @readonly + * @since 3.60.0 + */ + this.rightWidth; + + /** + * The size of the top horizontal bar (C). + * + * If this is a 3 slice object this property will be set to the + * height of the texture being used. + * + * @name Phaser.GameObjects.NineSlice#topHeight + * @type {number} + * @readonly + * @since 3.60.0 + */ + this.topHeight; + + /** + * The size of the bottom horizontal bar (D). + * + * If this is a 3 slice object this property will be set to zero. + * + * @name Phaser.GameObjects.NineSlice#bottomHeight + * @type {number} + * @readonly + * @since 3.60.0 + */ + this.bottomHeight; + + /** + * The tint value being applied to the top-left vertice of the Game Object. + * This value is interpolated from the corner to the center of the Game Object. + * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. + * + * @name Phaser.GameObjects.NineSlice#tint + * @type {number} + * @default 0xffffff + * @since 3.60.0 + */ + this.tint = 0xffffff; + + /** + * The tint fill mode. + * + * `false` = An additive tint (the default), where vertices colors are blended with the texture. + * `true` = A fill tint, where the vertices colors replace the texture, but respects texture alpha. + * + * @name Phaser.GameObjects.NineSlice#tintFill + * @type {boolean} + * @default false + * @since 3.60.0 + */ + this.tintFill = false; + + /** + * This property is `true` if this Nine Slice Game Object was configured + * with just `leftWidth` and `rightWidth` values, making it a 3-slice + * instead of a 9-slice object. + * + * @name Phaser.GameObjects.NineSlice#is3Slice + * @type {boolean} + * @since 3.60.0 + */ + this.is3Slice = (topHeight === 0 && bottomHeight === 0); - if (this.video && !this._codePaused) + var size = this.is3Slice ? 18 : 54; + + for (var i = 0; i < size; i++) { - this.video.play(); + this.vertices.push(new Vertex()); } + + this.setPosition(x, y); + + this.setTexture(texture, frame); + + this.setSlices(width, height, leftWidth, rightWidth, topHeight, bottomHeight); + + this.setOrigin(0.5, 0.5); + + this.initPipeline(); + this.initPostPipeline(); }, /** - * Sets the paused state of the currently loaded video. + * Resets the width, height and slices for this NineSlice Game Object. * - * If the video is playing, calling this method with `true` will pause playback. - * If the video is paused, calling this method with `false` will resume playback. + * This allows you to modify the texture being used by this object and then reset the slice configuration, + * to avoid having to destroy this Game Object in order to use it for a different game element. * - * If no video is loaded, this method does nothing. + * Please note that you cannot change a 9-slice to a 3-slice or vice versa. * - * @method Phaser.GameObjects.Video#setPaused - * @since 3.20.0 + * @method Phaser.GameObjects.NineSlice#setSlices + * @since 3.60.0 * - * @param {boolean} [value=true] - The paused value. `true` if the video should be paused, `false` to resume it. + * @param {number} [width=256] - The width of the Nine Slice Game Object. You can adjust the width post-creation. + * @param {number} [height=256] - The height of the Nine Slice Game Object. If this is a 3 slice object the height will be fixed to the height of the texture and cannot be changed. + * @param {number} [leftWidth=10] - The size of the left vertical column (A). + * @param {number} [rightWidth=10] - The size of the right vertical column (B). + * @param {number} [topHeight=0] - The size of the top horiztonal row (C). Set to zero or undefined to create a 3 slice object. + * @param {number} [bottomHeight=0] - The size of the bottom horiztonal row (D). Set to zero or undefined to create a 3 slice object. * - * @return {this} This Video Game Object for method chaining. + * @return {this} This Game Object instance. */ - setPaused: function (value) + setSlices: function (width, height, leftWidth, rightWidth, topHeight, bottomHeight) { - if (value === undefined) { value = true; } + if (width === undefined) { width = 256; } + if (height === undefined) { height = 256; } - var video = this.video; + if (leftWidth === undefined) { leftWidth = 10; } + if (rightWidth === undefined) { rightWidth = 10; } + if (topHeight === undefined) { topHeight = 0; } + if (bottomHeight === undefined) { bottomHeight = 0; } - this._codePaused = value; + var is3Slice = (topHeight === 0 && bottomHeight === 0); - if (video) + if (this.is3Slice !== is3Slice) { - if (value) - { - if (!video.paused) - { - video.pause(); - } - } - else if (!value) + console.warn('Cannot change 9 slice to 3 slice'); + } + else + { + this._width = width; + this._height = height; + + this.leftWidth = leftWidth; + this.rightWidth = rightWidth; + this.topHeight = topHeight; + this.bottomHeight = bottomHeight; + + if (this.is3Slice) { - if (video.paused && !this._systemPaused) - { - video.play(); - } + height = this.frame.height; + + this._height = height; + this.topHeight = height; + this.bottomHeight = 0; } + + this.updateVertices(); + this.updateUVs(); } return this; }, /** - * Returns a double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). + * Updates all of the vertice UV coordinates. This is called automatically + * when the NineSlice Game Object is created, or if the texture frame changes. * - * @method Phaser.GameObjects.Video#getVolume - * @since 3.20.0 + * Unlike with the `updateVertice` method, you do not need to call this + * method if the Nine Slice changes size. Only if it changes texture frame. * - * @return {number} A double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). + * @method Phaser.GameObjects.NineSlice#updateUVs + * @since 3.60.0 */ - getVolume: function () + updateUVs: function () { - return (this.video) ? this.video.volume : 1; + var left = this.leftWidth; + var right = this.rightWidth; + var top = this.topHeight; + var bot = this.bottomHeight; + + var width = this.frame.width; + var height = this.frame.height; + + this.updateQuadUVs(0, 0, 0, left / width, top / height); + this.updateQuadUVs(6, left / width, 0, 1 - (right / width), top / height); + this.updateQuadUVs(12, 1 - (right / width), 0, 1, top / height); + + if (!this.is3Slice) + { + this.updateQuadUVs(18, 0, top / height, left / width, 1 - (bot / height)); + this.updateQuadUVs(24, left / width, top / height, 1 - right / width, 1 - (bot / height)); + this.updateQuadUVs(30, 1 - right / width, top / height, 1, 1 - (bot / height)); + this.updateQuadUVs(36, 0, 1 - bot / height, left / width, 1); + this.updateQuadUVs(42, left / width, 1 - bot / height, 1 - right / width, 1); + this.updateQuadUVs(48, 1 - right / width, 1 - bot / height, 1, 1); + } }, /** - * Sets the volume of the currently playing video. - * - * The value given is a double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). + * Recalculates all of the vertices in this Nine Slice Game Object + * based on the `leftWidth`, `rightWidth`, `topHeight` and `bottomHeight` + * properties, combined with the Game Object size. * - * @method Phaser.GameObjects.Video#setVolume - * @since 3.20.0 + * This method is called automatically when this object is created + * or if it's origin is changed. * - * @param {number} [value=1] - A double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). + * You should not typically need to call this method directly, but it + * is left public should you find a need to modify one of those properties + * after creation. * - * @return {this} This Video Game Object for method chaining. + * @method Phaser.GameObjects.NineSlice#updateVertices + * @since 3.60.0 */ - setVolume: function (value) + updateVertices: function () { - if (value === undefined) { value = 1; } + var left = this.leftWidth; + var right = this.rightWidth; + var top = this.topHeight; + var bot = this.bottomHeight; - if (this.video) + var width = this.width; + var height = this.height; + + this.updateQuad(0, -0.5, 0.5, -0.5 + (left / width), 0.5 - (top / height)); + this.updateQuad(6, -0.5 + (left / width), 0.5, 0.5 - (right / width), 0.5 - (top / height)); + this.updateQuad(12, 0.5 - (right / width), 0.5, 0.5, 0.5 - (top / height)); + + if (!this.is3Slice) { - this.video.volume = Clamp(value, 0, 1); + this.updateQuad(18, -0.5, 0.5 - (top / height), -0.5 + (left / width), -0.5 + (bot / height)); + this.updateQuad(24, -0.5 + (left / width), 0.5 - (top / height), 0.5 - (right / width), -0.5 + (bot / height)); + this.updateQuad(30, 0.5 - (right / width), 0.5 - (top / height), 0.5, -0.5 + (bot / height)); + this.updateQuad(36, -0.5, -0.5 + (bot / height), -0.5 + (left / width), -0.5); + this.updateQuad(42, -0.5 + (left / width), -0.5 + (bot / height), 0.5 - (right / width), -0.5); + this.updateQuad(48, 0.5 - (right / width), -0.5 + (bot / height), 0.5, -0.5); } - - return this; }, /** - * Returns a double that indicates the rate at which the media is being played back. + * Internally updates the position coordinates across all vertices of the + * given quad offset. * - * @method Phaser.GameObjects.Video#getPlaybackRate - * @since 3.20.0 + * You should not typically need to call this method directly, but it + * is left public should an extended class require it. * - * @return {number} A double that indicates the rate at which the media is being played back. + * @method Phaser.GameObjects.NineSlice#updateQuad + * @since 3.60.0 + * + * @param {number} offset - The offset in the vertices array of the quad to update. + * @param {number} x1 - The top-left quad coordinate. + * @param {number} y1 - The top-left quad coordinate. + * @param {number} x2 - The bottom-right quad coordinate. + * @param {number} y2 - The bottom-right quad coordinate. */ - getPlaybackRate: function () + updateQuad: function (offset, x1, y1, x2, y2) { - return (this.video) ? this.video.playbackRate : 1; + var width = this.width; + var height = this.height; + var originX = this.originX; + var originY = this.originY; + + var verts = this.vertices; + + verts[offset + 0].resize(x1, y1, width, height, originX, originY); + verts[offset + 1].resize(x1, y2, width, height, originX, originY); + verts[offset + 2].resize(x2, y1, width, height, originX, originY); + verts[offset + 3].resize(x1, y2, width, height, originX, originY); + verts[offset + 4].resize(x2, y2, width, height, originX, originY); + verts[offset + 5].resize(x2, y1, width, height, originX, originY); }, /** - * Sets the playback rate of the current video. - * - * The value given is a double that indicates the rate at which the media is being played back. + * Internally updates the UV coordinates across all vertices of the + * given quad offset, based on the frame size. * - * @method Phaser.GameObjects.Video#setPlaybackRate - * @since 3.20.0 + * You should not typically need to call this method directly, but it + * is left public should an extended class require it. * - * @param {number} [rate] - A double that indicates the rate at which the media is being played back. + * @method Phaser.GameObjects.NineSlice#updateQuadUVs + * @since 3.60.0 * - * @return {this} This Video Game Object for method chaining. + * @param {number} offset - The offset in the vertices array of the quad to update. + * @param {number} u1 - The top-left UV coordinate. + * @param {number} v1 - The top-left UV coordinate. + * @param {number} u2 - The bottom-right UV coordinate. + * @param {number} v2 - The bottom-right UV coordinate. */ - setPlaybackRate: function (rate) + updateQuadUVs: function (offset, u1, v1, u2, v2) { - if (this.video) + var verts = this.vertices; + + // Adjust for frame offset + // Incoming values will always be in the range 0-1 + var frame = this.frame; + + var fu1 = frame.u0; + var fv1 = frame.v0; + var fu2 = frame.u1; + var fv2 = frame.v1; + + if (fu1 !== 0 || fu2 !== 1) { - this.video.playbackRate = rate; + // adjust horizontal + var udiff = fu2 - fu1; + u1 = fu1 + u1 * udiff; + u2 = fu1 + u2 * udiff; } - return this; + if (fv1 !== 0 || fv2 !== 1) + { + // adjust vertical + var vdiff = fv2 - fv1; + v1 = fv1 + v1 * vdiff; + v2 = fv1 + v2 * vdiff; + } + + verts[offset + 0].setUVs(u1, v1); + verts[offset + 1].setUVs(u1, v2); + verts[offset + 2].setUVs(u2, v1); + verts[offset + 3].setUVs(u1, v2); + verts[offset + 4].setUVs(u2, v2); + verts[offset + 5].setUVs(u2, v1); }, /** - * Returns a boolean which indicates whether the media element should start over when it reaches the end. + * Clears all tint values associated with this Game Object. * - * @method Phaser.GameObjects.Video#getLoop - * @since 3.20.0 + * Immediately sets the color values back to 0xffffff and the tint type to 'additive', + * which results in no visible change to the texture. * - * @return {boolean} A boolean which indicates whether the media element will start over when it reaches the end. + * @method Phaser.GameObjects.NineSlice#clearTint + * @webglOnly + * @since 3.60.0 + * + * @return {this} This Game Object instance. */ - getLoop: function () + clearTint: function () { - return (this.video) ? this.video.loop : false; + this.setTint(0xffffff); + + return this; }, /** - * Sets the loop state of the current video. + * Sets an additive tint on this Game Object. * - * The value given is a boolean which indicates whether the media element will start over when it reaches the end. + * The tint works by taking the pixel color values from the Game Objects texture, and then + * multiplying it by the color value of the tint. * - * Not all videos can loop, for example live streams. + * To modify the tint color once set, either call this method again with new values or use the + * `tint` property. * - * Please note that not all browsers support _seamless_ video looping for all encoding formats. + * To remove a tint call `clearTint`, or call this method with no parameters. * - * @method Phaser.GameObjects.Video#setLoop - * @since 3.20.0 + * To swap this from being an additive tint to a fill based tint set the property `tintFill` to `true`. * - * @param {boolean} [value=true] - A boolean which indicates whether the media element will start over when it reaches the end. + * @method Phaser.GameObjects.NineSlice#setTint + * @webglOnly + * @since 3.60.0 * - * @return {this} This Video Game Object for method chaining. + * @param {number} [color=0xffffff] - The tint being applied to the entire Game Object. + * + * @return {this} This Game Object instance. */ - setLoop: function (value) + setTint: function (color) { - if (value === undefined) { value = true; } + if (color === undefined) { color = 0xffffff; } - if (this.video) - { - this.video.loop = value; - } + this.tint = color; + + this.tintFill = false; return this; }, /** - * Returns a boolean which indicates whether the video is currently playing. + * Sets a fill-based tint on this Game Object. * - * @method Phaser.GameObjects.Video#isPlaying - * @since 3.20.0 + * Unlike an additive tint, a fill-tint literally replaces the pixel colors from the texture + * with those in the tint. You can use this for effects such as making a player flash 'white' + * if hit by something. The whole Game Object will be rendered in the given color. * - * @return {boolean} A boolean which indicates whether the video is playing, or not. + * To modify the tint color once set, either call this method again with new values or use the + * `tint` property. + * + * To remove a tint call `clearTint`, or call this method with no parameters. + * + * To swap this from being a fill-tint to an additive tint set the property `tintFill` to `false`. + * + * @method Phaser.GameObjects.NineSlice#setTintFill + * @webglOnly + * @since 3.60.0 + * + * @param {number} [color=0xffffff] - The tint being applied to the entire Game Object. + * + * @return {this} This Game Object instance. */ - isPlaying: function () + setTintFill: function (color) { - return (this.video) ? !(this.video.paused || this.video.ended) : false; + this.setTint(color); + + this.tintFill = true; + + return this; }, /** - * Returns a boolean which indicates whether the video is currently paused. + * Does this Game Object have a tint applied? * - * @method Phaser.GameObjects.Video#isPaused - * @since 3.20.0 + * It checks to see if the tint property is set to a value other than 0xffffff. + * This indicates that a Game Object is tinted. * - * @return {boolean} A boolean which indicates whether the video is paused, or not. + * @name Phaser.GameObjects.NineSlice#isTinted + * @type {boolean} + * @webglOnly + * @readonly + * @since 3.60.0 */ - isPaused: function () - { - return ((this.video && this.video.paused) || this._codePaused || this._systemPaused); + isTinted: { + + get: function () + { + return (this.tint !== 0xffffff); + } + }, /** - * Stores this Video in the Texture Manager using the given key as a dynamic texture, - * which any texture-based Game Object, such as a Sprite, can use as its texture: - * - * ```javascript - * var vid = this.add.video(0, 0, 'intro'); + * The displayed width of this Game Object. * - * vid.play(); + * Setting this value will adjust the way in which this Nine Slice + * object scales horizontally, if configured to do so. * - * vid.saveTexture('doodle'); + * The _minimum_ width this Game Object can be is the total of + * `leftWidth` + `rightWidth`. If you need to display this object + * at a smaller size, you can also scale it. * - * this.add.image(400, 300, 'doodle'); - * ``` + * @name Phaser.GameObjects.NineSlice#width + * @type {number} + * @since 3.60.0 + */ + width: { + + get: function () + { + return this._width; + }, + + set: function (value) + { + this._width = Math.max(value, this.leftWidth + this.rightWidth); + + this.updateVertices(); + } + + }, + + /** + * The displayed height of this Game Object. * - * The saved texture is automatically updated as the video plays. If you pause this video, - * or change its source, then the saved texture updates instantly. + * Setting this value will adjust the way in which this Nine Slice + * object scales vertically, if configured to do so. * - * Calling `saveTexture` again will not save another copy of the same texture, it will just rename the existing one. + * The _minimum_ height this Game Object can be is the total of + * `topHeight` + `bottomHeight`. If you need to display this object + * at a smaller size, you can also scale it. * - * By default it will create a single base texture. You can add frames to the texture - * by using the `Texture.add` method. After doing this, you can then allow Game Objects - * to use a specific frame. + * If this is a 3-slice object, you can only stretch it horizontally + * and changing the height will be ignored. * - * If you intend to save the texture so you can use it as the input for a Shader, you may need to set the - * `flipY` parameter to `true` if you find the video renders upside down in your shader. + * @name Phaser.GameObjects.NineSlice#height + * @type {number} + * @since 3.60.0 + */ + height: { + + get: function () + { + return this._height; + }, + + set: function (value) + { + if (!this.is3Slice) + { + this._height = Math.max(value, this.topHeight + this.bottomHeight); + + this.updateVertices(); + } + } + + }, + + /** + * The displayed width of this Game Object. * - * @method Phaser.GameObjects.Video#saveTexture - * @since 3.20.0 + * This value takes into account the scale factor. * - * @param {string} key - The unique key to store the texture as within the global Texture Manager. - * @param {boolean} [flipY=false] - Should the WebGL Texture set `UNPACK_MULTIPLY_FLIP_Y` during upload? + * Setting this value will adjust the Game Object's scale property. * - * @return {Phaser.Textures.Texture} The Texture that was saved. + * @name Phaser.GameObjects.NineSlice#displayWidth + * @type {number} + * @since 3.60.0 */ - saveTexture: function (key, flipY) - { - if (flipY === undefined) { flipY = false; } + displayWidth: { - if (this.videoTexture) + get: function () { - this.scene.sys.textures.renameTexture(this._key, key); + return this.scaleX * this.width; + }, + + set: function (value) + { + this.scaleX = value / this.width; } - this._key = key; + }, - this.flipY = flipY; + /** + * The displayed height of this Game Object. + * + * This value takes into account the scale factor. + * + * Setting this value will adjust the Game Object's scale property. + * + * @name Phaser.GameObjects.NineSlice#displayHeight + * @type {number} + * @since 3.60.0 + */ + displayHeight: { - if (this.videoTextureSource) + get: function () { - this.videoTextureSource.setFlipY(flipY); + return this.scaleY * this.height; + }, + + set: function (value) + { + this.scaleY = value / this.height; } - return this.videoTexture; }, /** - * Stops the video playing and clears all internal event listeners. + * Sets the size of this Game Object. * - * If you only wish to pause playback of the video, and resume it a later time, use the `Video.pause` method instead. + * For a Nine Slice Game Object this means it will be stretched (or shrunk) horizontally + * and vertically depending on the dimensions given to this method, in accordance with + * how it has been configured for the various corner sizes. * - * If the video hasn't finished downloading, calling this method will not abort the download. To do that you need to - * call `destroy` instead. + * If this is a 3-slice object, you can only stretch it horizontally + * and changing the height will be ignored. * - * @method Phaser.GameObjects.Video#stop - * @fires Phaser.GameObjects.Events#VIDEO_STOP - * @since 3.20.0 + * If you have enabled this Game Object for input, changing the size will also change the + * size of the hit area. * - * @return {this} This Video Game Object for method chaining. + * @method Phaser.GameObjects.NineSlice#setSize + * @since 3.60.0 + * + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {this} This Game Object instance. */ - stop: function () + setSize: function (width, height) { - var video = this.video; - - if (video) - { - var callbacks = this._callbacks; - - for (var callback in callbacks) - { - video.removeEventListener(callback, callbacks[callback], true); - } + this.width = width; + this.height = height; - video.pause(); - } + var input = this.input; - if (this._retryID) + if (input && !input.customHitArea) { - window.clearTimeout(this._retryID); + input.hitArea.width = this.width; + input.hitArea.height = this.height; } - this.emit(Events.VIDEO_STOP, this); - return this; }, /** - * Removes the Video element from the DOM by calling parentNode.removeChild on itself. + * Sets the display size of this Game Object. * - * Also removes the autoplay and src attributes and nulls the Video reference. + * Calling this will adjust the scale. * - * You should not call this method if you were playing a video from the Video Cache that - * you wish to play again in your game, or if another Video object is also using the same - * video. + * @method Phaser.GameObjects.NineSlice#setDisplaySize + * @since 3.60.0 * - * If you loaded an external video via `Video.loadURL` then you should call this function - * to clear up once you are done with the instance. + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. * - * @method Phaser.GameObjects.Video#removeVideoElement - * @since 3.20.0 + * @return {this} This Game Object instance. */ - removeVideoElement: function () + setDisplaySize: function (width, height) { - var video = this.video; + this.displayWidth = width; + this.displayHeight = height; - if (!video) + return this; + }, + + /** + * The horizontal origin of this Game Object. + * The origin maps the relationship between the size and position of the Game Object. + * The default value is 0.5, meaning all Game Objects are positioned based on their center. + * Setting the value to 0 means the position now relates to the left of the Game Object. + * + * @name Phaser.GameObjects.NineSlice#originX + * @type {number} + * @since 3.60.0 + */ + originX: { + + get: function () { - return; - } + return this._originX; + }, - if (video.parentNode) + set: function (value) { - video.parentNode.removeChild(video); + this._originX = value; + this.updateVertices(); } - while (video.hasChildNodes()) + }, + + /** + * The vertical origin of this Game Object. + * The origin maps the relationship between the size and position of the Game Object. + * The default value is 0.5, meaning all Game Objects are positioned based on their center. + * Setting the value to 0 means the position now relates to the top of the Game Object. + * + * @name Phaser.GameObjects.NineSlice#originY + * @type {number} + * @since 3.60.0 + */ + originY: { + + get: function () { - video.removeChild(video.firstChild); - } + return this._originY; + }, - video.removeAttribute('autoplay'); - video.removeAttribute('src'); + set: function (value) + { + this._originY = value; + this.updateVertices(); + } - this.video = null; }, /** - * Handles the pre-destroy step for the Video object. + * Sets the origin of this Game Object. * - * This calls `Video.stop` and optionally `Video.removeVideoElement`. + * The values are given in the range 0 to 1. * - * If any Sprites are using this Video as their texture it is up to you to manage those. + * @method Phaser.GameObjects.NineSlice#setOrigin + * @since 3.60.0 * - * @method Phaser.GameObjects.Video#preDestroy - * @private - * @since 3.21.0 + * @param {number} [x=0.5] - The horizontal origin value. + * @param {number} [y=x] - The vertical origin value. If not defined it will be set to the value of `x`. + * + * @return {this} This Game Object instance. */ - preDestroy: function () + setOrigin: function (x, y) { - this.stop(); - - if (this.removeVideoElementOnDestroy) - { - this.removeVideoElement(); - } + if (x === undefined) { x = 0.5; } + if (y === undefined) { y = x; } - var game = this.scene.sys.game.events; + this._originX = x; + this._originY = y; - game.off(GameEvents.PAUSE, this.globalPause, this); - game.off(GameEvents.RESUME, this.globalResume, this); + this.updateVertices(); - var sound = this.scene.sys.sound; + return this.updateDisplayOrigin(); + }, - if (sound) + /** + * This method is included but does nothing for the Nine Slice Game Object, + * because the size of the object isn't based on the texture frame. + * + * You should not call this method. + * + * @method Phaser.GameObjects.NineSlice#setSizeToFrame + * @since 3.60.0 + * + * @return {this} This Game Object instance. + */ + setSizeToFrame: function () + { + if (this.is3Slice) { - sound.off(SoundEvents.GLOBAL_MUTE, this.globalMute, this); - } + var height = this.frame.height; - if (this._retryID) - { - window.clearTimeout(this._retryID); + this._height = height; + this.topHeight = height; + this.bottomHeight = 0; } + + this.updateUVs(); + + return this; + }, + + /** + * Handles the pre-destroy step for the Nine Slice, which removes the vertices. + * + * @method Phaser.GameObjects.NineSlice#preDestroy + * @private + * @since 3.60.0 + */ + preDestroy: function () + { + this.vertices = []; } }); -module.exports = Video; +module.exports = NineSlice; /***/ }), -/* 227 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 40964: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Contains = __webpack_require__(228); -var GetPoints = __webpack_require__(470); -var GEOM_CONST = __webpack_require__(56); +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var GetValue = __webpack_require__(10850); +var NineSlice = __webpack_require__(44139); /** - * @classdesc - * A Polygon object + * Creates a new Nine Slice Game Object and returns it. * - * The polygon is a closed shape consists of a series of connected straight lines defined by list of ordered points. - * Several formats are supported to define the list of points, check the setTo method for details. - * This is a geometry object allowing you to define and inspect the shape. - * It is not a Game Object, in that you cannot add it to the display list, and it has no texture. - * To render a Polygon you should look at the capabilities of the Graphics class. + * Note: This method will only be available if the Nine Slice Game Object and WebGL support have been built into Phaser. * - * @class Polygon - * @memberof Phaser.Geom - * @constructor - * @since 3.0.0 + * @method Phaser.GameObjects.GameObjectCreator#nineslice + * @since 3.60.0 * - * @param {(string|number[]|Phaser.Types.Math.Vector2Like[])} [points] - List of points defining the perimeter of this Polygon. Several formats are supported: - * - A string containing paired x y values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'` - * - An array of Point objects: `[new Phaser.Point(x1, y1), ...]` - * - An array of objects with public x y properties: `[obj1, obj2, ...]` - * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]` - * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]` + * @param {Phaser.Types.GameObjects.NineSlice.NineSliceConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.NineSlice} The Game Object that was created. */ -var Polygon = new Class({ +GameObjectCreator.register('nineslice', function (config, addToScene) +{ + if (config === undefined) { config = {}; } - initialize: + var key = GetAdvancedValue(config, 'key', null); + var frame = GetAdvancedValue(config, 'frame', null); + var width = GetValue(config, 'width', 256); + var height = GetValue(config, 'height', 256); + var leftWidth = GetValue(config, 'leftWidth', 10); + var rightWidth = GetValue(config, 'rightWidth', 10); + var topHeight = GetValue(config, 'topHeight', 0); + var bottomHeight = GetValue(config, 'bottomHeight', 0); - function Polygon (points) + var nineslice = new NineSlice(this.scene, 0, 0, key, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight); + + if (addToScene !== undefined) { - /** - * The geometry constant type of this object: `GEOM_CONST.POLYGON`. - * Used for fast type comparisons. - * - * @name Phaser.Geom.Polygon#type - * @type {number} - * @readonly - * @since 3.19.0 - */ - this.type = GEOM_CONST.POLYGON; + config.add = addToScene; + } - /** - * The area of this Polygon. - * - * @name Phaser.Geom.Polygon#area - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.area = 0; + BuildGameObject(this.scene, nineslice, config); - /** - * An array of number pair objects that make up this polygon. I.e. [ {x,y}, {x,y}, {x,y} ] - * - * @name Phaser.Geom.Polygon#points - * @type {Phaser.Geom.Point[]} - * @since 3.0.0 - */ - this.points = []; + return nineslice; +}); - if (points) - { - this.setTo(points); - } - }, - /** - * Check to see if the Polygon contains the given x / y coordinates. - * - * @method Phaser.Geom.Polygon#contains - * @since 3.0.0 - * - * @param {number} x - The x coordinate to check within the polygon. - * @param {number} y - The y coordinate to check within the polygon. - * - * @return {boolean} `true` if the coordinates are within the polygon, otherwise `false`. - */ - contains: function (x, y) - { - return Contains(this, x, y); - }, +/***/ }), - /** - * Sets this Polygon to the given points. - * - * The points can be set from a variety of formats: - * - * - A string containing paired values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'` - * - An array of Point objects: `[new Phaser.Point(x1, y1), ...]` - * - An array of objects with public x/y properties: `[obj1, obj2, ...]` - * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]` - * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]` - * - * `setTo` may also be called without any arguments to remove all points. - * - * @method Phaser.Geom.Polygon#setTo - * @since 3.0.0 - * - * @param {(string|number[]|Phaser.Types.Math.Vector2Like[])} [points] - Points defining the perimeter of this polygon. Please check function description above for the different supported formats. - * - * @return {this} This Polygon object. - */ - setTo: function (points) - { - this.area = 0; - this.points = []; - - if (typeof points === 'string') - { - points = points.split(' '); - } - - if (!Array.isArray(points)) - { - return this; - } - - var p; - var y0 = Number.MAX_VALUE; - - // The points argument is an array, so iterate through it - for (var i = 0; i < points.length; i++) - { - p = { x: 0, y: 0 }; - - if (typeof points[i] === 'number' || typeof points[i] === 'string') - { - p.x = parseFloat(points[i]); - p.y = parseFloat(points[i + 1]); - i++; - } - else if (Array.isArray(points[i])) - { - // An array of arrays? - p.x = points[i][0]; - p.y = points[i][1]; - } - else - { - p.x = points[i].x; - p.y = points[i].y; - } - - this.points.push(p); - - // Lowest boundary - if (p.y < y0) - { - y0 = p.y; - } - } +/***/ 53778: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - this.calculateArea(y0); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var NineSlice = __webpack_require__(44139); +var GameObjectFactory = __webpack_require__(61286); - /** - * Calculates the area of the Polygon. This is available in the property Polygon.area - * - * @method Phaser.Geom.Polygon#calculateArea - * @since 3.0.0 - * - * @return {number} The area of the polygon. - */ - calculateArea: function () +/** + * A Nine Slice Game Object allows you to display a texture-based object that + * can be stretched both horizontally and vertically, but that retains + * fixed-sized corners. The dimensions of the corners are set via the + * parameters to this class. + * + * This is extremely useful for UI and button like elements, where you need + * them to expand to accommodate the content without distorting the texture. + * + * The texture you provide for this Game Object should be based on the + * following layout structure: + * + * ``` + * A B + * +---+----------------------+---+ + * C | 1 | 2 | 3 | + * +---+----------------------+---+ + * | | | | + * | 4 | 5 | 6 | + * | | | | + * +---+----------------------+---+ + * D | 7 | 8 | 9 | + * +---+----------------------+---+ + * ``` + * + * When changing this objects width and / or height: + * + * areas 1, 3, 7 and 9 (the corners) will remain unscaled + * areas 2 and 8 will be stretched horizontally only + * areas 4 and 6 will be stretched vertically only + * area 5 will be stretched both horizontally and vertically + * + * You can also create a 3 slice Game Object: + * + * This works in a similar way, except you can only stretch it horizontally. + * Therefore, it requires less configuration: + * + * ``` + * A B + * +---+----------------------+---+ + * | | | | + * C | 1 | 2 | 3 | + * | | | | + * +---+----------------------+---+ + * ``` + * + * When changing this objects width (you cannot change its height) + * + * areas 1 and 3 will remain unscaled + * area 2 will be stretched horizontally + * + * The above configuration concept is adapted from the Pixi NineSlicePlane. + * + * To specify a 3 slice object instead of a 9 slice you should only + * provide the `leftWidth` and `rightWidth` parameters. To create a 9 slice + * you must supply all parameters. + * + * The _minimum_ width this Game Object can be is the total of + * `leftWidth` + `rightWidth`. The _minimum_ height this Game Object + * can be is the total of `topHeight` + `bottomHeight`. + * If you need to display this object at a smaller size, you can scale it. + * + * In terms of performance, using a 3 slice Game Object is the equivalent of + * having 3 Sprites in a row. Using a 9 slice Game Object is the equivalent + * of having 9 Sprites in a row. The vertices of this object are all batched + * together and can co-exist with other Sprites and graphics on the display + * list, without incurring any additional overhead. + * + * As of Phaser 3.60 this Game Object is WebGL only. + * + * @method Phaser.GameObjects.GameObjectFactory#nineslice + * @webglOnly + * @since 3.60.0 + * + * @param {number} x - The horizontal position of the center of this Game Object in the world. + * @param {number} y - The vertical position of the center of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {number} [width=256] - The width of the Nine Slice Game Object. You can adjust the width post-creation. + * @param {number} [height=256] - The height of the Nine Slice Game Object. If this is a 3 slice object the height will be fixed to the height of the texture and cannot be changed. + * @param {number} [leftWidth=10] - The size of the left vertical column (A). + * @param {number} [rightWidth=10] - The size of the right vertical column (B). + * @param {number} [topHeight=0] - The size of the top horiztonal row (C). Set to zero or undefined to create a 3 slice object. + * @param {number} [bottomHeight=0] - The size of the bottom horiztonal row (D). Set to zero or undefined to create a 3 slice object. + * + * @return {Phaser.GameObjects.NineSlice} The Game Object that was created. + */ +if (true) +{ + GameObjectFactory.register('nineslice', function (x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight) { - if (this.points.length < 3) - { - this.area = 0; - - return this.area; - } + return this.displayList.add(new NineSlice(this.scene, x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight)); + }); +} - var sum = 0; - var p1; - var p2; - for (var i = 0; i < this.points.length - 1; i++) - { - p1 = this.points[i]; - p2 = this.points[i + 1]; +/***/ }), - sum += (p2.x - p1.x) * (p1.y + p2.y); - } +/***/ 94456: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - p1 = this.points[0]; - p2 = this.points[this.points.length - 1]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - sum += (p1.x - p2.x) * (p2.y + p1.y); +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - this.area = -sum * 0.5; +if (true) +{ + renderWebGL = __webpack_require__(27420); +} - return this.area; - }, +if (true) +{ + // renderCanvas = require('./MeshCanvasRenderer'); +} - /** - * Returns an array of Point objects containing the coordinates of the points around the perimeter of the Polygon, - * based on the given quantity or stepRate values. - * - * @method Phaser.Geom.Polygon#getPoints - * @since 3.12.0 - * - * @generic {Phaser.Geom.Point[]} O - [output,$return] - * - * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. - * @param {number} [stepRate] - Sets the quantity by getting the perimeter of the Polygon and dividing it by the stepRate. - * @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created. - * - * @return {(array|Phaser.Geom.Point[])} An array of Point objects pertaining to the points around the perimeter of the Polygon. - */ - getPoints: function (quantity, step, output) - { - return GetPoints(this, quantity, step, output); - } +module.exports = { -}); + renderWebGL: renderWebGL, + renderCanvas: renderCanvas -module.exports = Polygon; +}; /***/ }), -/* 228 */ -/***/ (function(module, exports) { + +/***/ 27420: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Checks whether the x and y coordinates are contained within this polygon. -// Adapted from http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html by Jonas Raoni Soares Silva +var GetCalcMatrix = __webpack_require__(73329); +var Utils = __webpack_require__(75512); /** - * Checks if a point is within the bounds of a Polygon. + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @function Phaser.Geom.Polygon.Contains + * @method Phaser.GameObjects.Mesh#renderWebGL * @since 3.0.0 + * @private * - * @param {Phaser.Geom.Polygon} polygon - The Polygon to check against. - * @param {number} x - The X coordinate of the point to check. - * @param {number} y - The Y coordinate of the point to check. - * - * @return {boolean} `true` if the point is within the bounds of the Polygon, otherwise `false`. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var Contains = function (polygon, x, y) +var NineSliceWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var inside = false; + var verts = src.vertices; + var totalVerts = verts.length; - for (var i = -1, j = polygon.points.length - 1; ++i < polygon.points.length; j = i) + if (totalVerts === 0) { - var ix = polygon.points[i].x; - var iy = polygon.points[i].y; + return; + } - var jx = polygon.points[j].x; - var jy = polygon.points[j].y; + camera.addToRenderList(src); - if (((iy <= y && y < jy) || (jy <= y && y < iy)) && (x < (jx - ix) * (y - iy) / (jy - iy) + ix)) + var pipeline = renderer.pipelines.set(src.pipeline, src); + + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix, false).calc; + + // This causes a flush if the NineSlice has a Post Pipeline + renderer.pipelines.preBatch(src); + + var textureUnit = pipeline.setGameObject(src); + + var F32 = pipeline.vertexViewF32; + var U32 = pipeline.vertexViewU32; + + var vertexOffset = (pipeline.vertexCount * pipeline.currentShader.vertexComponentCount) - 1; + + var roundPixels = camera.roundPixels; + + var tintEffect = src.tintFill; + var alpha = camera.alpha * src.alpha; + var color = Utils.getTintAppendFloatAlpha(src.tint, alpha); + + var available = pipeline.vertexAvailable(); + var flushCount = -1; + + if (available < totalVerts) + { + flushCount = available; + } + + for (var i = 0; i < totalVerts; i++) + { + var vert = verts[i]; + + if (i === flushCount) { - inside = !inside; + pipeline.flush(); + + textureUnit = pipeline.setGameObject(src); + + vertexOffset = 0; } + + F32[++vertexOffset] = calcMatrix.getXRound(vert.vx, vert.vy, roundPixels); + F32[++vertexOffset] = calcMatrix.getYRound(vert.vx, vert.vy, roundPixels); + F32[++vertexOffset] = vert.u; + F32[++vertexOffset] = vert.v; + F32[++vertexOffset] = textureUnit; + F32[++vertexOffset] = tintEffect; + U32[++vertexOffset] = color; + + pipeline.vertexCount++; + + pipeline.currentBatch.count = (pipeline.vertexCount - pipeline.currentBatch.start); } - return inside; + renderer.pipelines.postBatch(src); }; -module.exports = Contains; +module.exports = NineSliceWebGLRenderer; /***/ }), -/* 229 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 19737: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(15); -var GetFastValue = __webpack_require__(2); -var Extend = __webpack_require__(17); -var SetValue = __webpack_require__(478); -var ShaderRender = __webpack_require__(1176); -var TransformMatrix = __webpack_require__(25); +var Class = __webpack_require__(56694); +var EmitterOp = __webpack_require__(93025); +var GetColor = __webpack_require__(22946); +var GetEaseFunction = __webpack_require__(21902); +var GetInterpolationFunction = __webpack_require__(4840); +var IntegerToRGB = __webpack_require__(15978); /** * @classdesc - * A Shader Game Object. - * - * This Game Object allows you to easily add a quad with its own shader into the display list, and manipulate it - * as you would any other Game Object, including scaling, rotating, positioning and adding to Containers. Shaders - * can be masked with either Bitmap or Geometry masks and can also be used as a Bitmap Mask for a Camera or other - * Game Object. They can also be made interactive and used for input events. - * - * It works by taking a reference to a `Phaser.Display.BaseShader` instance, as found in the Shader Cache. These can - * be created dynamically at runtime, or loaded in via the GLSL File Loader: - * - * ```javascript - * function preload () - * { - * this.load.glsl('fire', 'shaders/fire.glsl.js'); - * } - * - * function create () - * { - * this.add.shader('fire', 400, 300, 512, 512); - * } - * ``` + * This class is responsible for taking control over the color property + * in the Particle class and managing its emission and updating functions. * - * Please see the Phaser 3 Examples GitHub repo for examples of loading and creating shaders dynamically. - * - * Due to the way in which they work, you cannot directly change the alpha or blend mode of a Shader. This should - * be handled via exposed uniforms in the shader code itself. - * - * By default a Shader will be created with a standard set of uniforms. These were added to match those - * found on sites such as ShaderToy or GLSLSandbox, and provide common functionality a shader may need, - * such as the timestamp, resolution or pointer position. You can replace them by specifying your own uniforms - * in the Base Shader. - * - * These Shaders work by halting the current pipeline during rendering, creating a viewport matched to the - * size of this Game Object and then renders a quad using the bound shader. At the end, the pipeline is restored. - * - * Because it blocks the pipeline it means it will interrupt any batching that is currently going on, so you should - * use these Game Objects sparingly. If you need to have a fully batched custom shader, then please look at using - * a custom pipeline instead. However, for background or special masking effects, they are extremely effective. + * See the `ParticleEmitter` class for more details on emitter op configuration. * - * @class Shader - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects + * @class EmitterColorOp + * @memberof Phaser.GameObjects.Particles * @constructor - * @webglOnly - * @since 3.17.0 - * - * @extends Phaser.GameObjects.Components.ComputedSize - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible + * @since 3.60.0 * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {(string|Phaser.Display.BaseShader)} key - The key of the shader to use from the shader cache, or a BaseShader instance. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [width=128] - The width of the Game Object. - * @param {number} [height=128] - The height of the Game Object. - * @param {string[]} [textures] - Optional array of texture keys to bind to the iChannel0...3 uniforms. The textures must already exist in the Texture Manager. - * @param {any} [textureData] - Additional texture data if you want to create shader with none NPOT textures. + * @param {string} key - The name of the property. */ -var Shader = new Class({ - - Extends: GameObject, +var EmitterColorOp = new Class({ - Mixins: [ - Components.ComputedSize, - Components.Depth, - Components.GetBounds, - Components.Mask, - Components.Origin, - Components.ScrollFactor, - Components.Transform, - Components.Visible, - ShaderRender - ], + Extends: EmitterOp, initialize: - function Shader (scene, key, x, y, width, height, textures, textureData) + function EmitterColorOp (key) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = 128; } - if (height === undefined) { height = 128; } + EmitterOp.call(this, key, null, false); - GameObject.call(this, scene, 'Shader'); + this.active = false; - /** - * This Game Object cannot have a blend mode, so skip all checks. - * - * @name Phaser.GameObjects.Shader#blendMode - * @type {number} - * @private - * @since 3.17.0 - */ - this.blendMode = -1; + this.easeName = 'Linear'; /** - * The underlying shader object being used. - * Empty by default and set during a call to the `setShader` method. + * An array containing the red color values. * - * @name Phaser.GameObjects.Shader#shader - * @type {Phaser.Display.BaseShader} - * @since 3.17.0 + * Populated during the `setMethods` method. + * + * @name Phaser.GameObjects.Particles.EmitterColorOp#r + * @type {number[]} + * @since 3.60.0 */ - this.shader; - - var renderer = scene.sys.renderer; + this.r = []; /** - * A reference to the current renderer. - * Shaders only work with the WebGL Renderer. + * An array containing the green color values. * - * @name Phaser.GameObjects.Shader#renderer - * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} - * @since 3.17.0 + * Populated during the `setMethods` method. + * + * @name Phaser.GameObjects.Particles.EmitterColorOp#g + * @type {number[]} + * @since 3.60.0 */ - this.renderer = renderer; + this.g = []; /** - * The WebGL context belonging to the renderer. + * An array containing the blue color values. * - * @name Phaser.GameObjects.Shader#gl - * @type {WebGLRenderingContext} - * @since 3.17.0 + * Populated during the `setMethods` method. + * + * @name Phaser.GameObjects.Particles.EmitterColorOp#b + * @type {number[]} + * @since 3.60.0 */ - this.gl = renderer.gl; + this.b = []; + }, + + /** + * Checks the type of `EmitterOp.propertyValue` to determine which + * method is required in order to return values from this op function. + * + * @method Phaser.GameObjects.Particles.EmitterColorOp#getMethod + * @since 3.60.0 + * + * @return {number} A number between 0 and 9 which should be passed to `setMethods`. + */ + getMethod: function () + { + return (this.propertyValue === null) ? 0 : 9; + }, + + /** + * Sets the EmitterColorOp method values, if in use. + * + * @method Phaser.GameObjects.Particles.EmitterColorOp#setMethods + * @since 3.60.0 + * + * @return {this} This Emitter Op object. + */ + setMethods: function () + { + var value = this.propertyValue; + var current = value; + + var onEmit = this.defaultEmit; + var onUpdate = this.defaultUpdate; + + if (this.method === 9) + { + this.start = value[0]; + this.ease = GetEaseFunction('Linear'); + this.interpolation = GetInterpolationFunction('linear'); + + onEmit = this.easedValueEmit; + onUpdate = this.easeValueUpdate; + current = value[0]; + + this.active = true; + + // Populate the r,g,b arrays + for (var i = 0; i < value.length; i++) + { + // in hex format 0xff0000 + var color = IntegerToRGB(value[i]); + + this.r.push(color.r); + this.g.push(color.g); + this.b.push(color.b); + } + } + + this.onEmit = onEmit; + this.onUpdate = onUpdate; + this.current = current; + + return this; + }, + + /** + * Sets the Ease function to use for Color interpolation. + * + * @method Phaser.GameObjects.Particles.EmitterColorOp#setEase + * @since 3.60.0 + * + * @param {string} ease - The string-based name of the Ease function to use. + */ + setEase: function (value) + { + this.easeName = value; + + this.ease = GetEaseFunction(value); + }, + + /** + * An `onEmit` callback for an eased property. + * + * It prepares the particle for easing by {@link Phaser.GameObjects.Particles.EmitterColorOp#easeValueUpdate}. + * + * @method Phaser.GameObjects.Particles.EmitterColorOp#easedValueEmit + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The name of the property. + * + * @return {number} {@link Phaser.GameObjects.Particles.EmitterColorOp#start}, as the new value of the property. + */ + easedValueEmit: function () + { + this.current = this.start; + + return this.start; + }, + + /** + * An `onUpdate` callback that returns an eased value between the + * {@link Phaser.GameObjects.Particles.EmitterColorOp#start} and {@link Phaser.GameObjects.Particles.EmitterColorOp#end} + * range. + * + * @method Phaser.GameObjects.Particles.EmitterColorOp#easeValueUpdate + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The name of the property. + * @param {number} t - The current normalized lifetime of the particle, between 0 (birth) and 1 (death). + * + * @return {number} The new value of the property. + */ + easeValueUpdate: function (particle, key, t) + { + var v = this.ease(t); + + var r = this.interpolation(this.r, v); + var g = this.interpolation(this.g, v); + var b = this.interpolation(this.b, v); + + var current = GetColor(r, g, b); + + this.current = current; + + return current; + } + +}); + +module.exports = EmitterColorOp; + + +/***/ }), + +/***/ 93025: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Between = __webpack_require__(17489); +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var FloatBetween = __webpack_require__(61616); +var GetEaseFunction = __webpack_require__(21902); +var GetFastValue = __webpack_require__(72632); +var GetInterpolationFunction = __webpack_require__(4840); +var SnapTo = __webpack_require__(88462); +var Wrap = __webpack_require__(1071); + +/** + * @classdesc + * This class is responsible for taking control over a single property + * in the Particle class and managing its emission and updating functions. + * + * Particles properties such as `x`, `y`, `scaleX`, `lifespan` and others all use + * EmitterOp instances to manage them, as they can be given in a variety of + * formats: from simple values, to functions, to dynamic callbacks. + * + * See the `ParticleEmitter` class for more details on emitter op configuration. + * + * @class EmitterOp + * @memberof Phaser.GameObjects.Particles + * @constructor + * @since 3.0.0 + * + * @param {string} key - The name of the property. + * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} defaultValue - The default value of the property. + * @param {boolean} [emitOnly=false] - Whether the property can only be modified when a Particle is emitted. + */ +var EmitterOp = new Class({ + + initialize: + + function EmitterOp (key, defaultValue, emitOnly) + { + if (emitOnly === undefined) { emitOnly = false; } /** - * Raw byte buffer of vertices this Shader uses. + * The name of this property. * - * @name Phaser.GameObjects.Shader#vertexData - * @type {ArrayBuffer} - * @since 3.17.0 + * @name Phaser.GameObjects.Particles.EmitterOp#propertyKey + * @type {string} + * @since 3.0.0 */ - this.vertexData = new ArrayBuffer(6 * (Float32Array.BYTES_PER_ELEMENT * 2)); + this.propertyKey = key; /** - * The WebGL vertex buffer object this shader uses. + * The current value of this property. * - * @name Phaser.GameObjects.Shader#vertexBuffer - * @type {WebGLBuffer} - * @since 3.17.0 + * This can be a simple value, an array, a function or an onEmit + * configuration object. + * + * @name Phaser.GameObjects.Particles.EmitterOp#propertyValue + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.0.0 */ - this.vertexBuffer = renderer.createVertexBuffer(this.vertexData.byteLength, this.gl.STREAM_DRAW); + this.propertyValue = defaultValue; /** - * The WebGL shader program this shader uses. + * The default value of this property. * - * @name Phaser.GameObjects.Shader#program - * @type {WebGLProgram} - * @since 3.17.0 + * This can be a simple value, an array, a function or an onEmit + * configuration object. + * + * @name Phaser.GameObjects.Particles.EmitterOp#defaultValue + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.0.0 */ - this.program = null; + this.defaultValue = defaultValue; /** - * Uint8 view to the vertex raw buffer. Used for uploading vertex buffer resources to the GPU. + * The number of steps for stepped easing between {@link Phaser.GameObjects.Particles.EmitterOp#start} and + * {@link Phaser.GameObjects.Particles.EmitterOp#end} values, per emit. * - * @name Phaser.GameObjects.Shader#bytes - * @type {Uint8Array} - * @since 3.17.0 + * @name Phaser.GameObjects.Particles.EmitterOp#steps + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.bytes = new Uint8Array(this.vertexData); + this.steps = 0; /** - * Float32 view of the array buffer containing the shaders vertices. + * The step counter for stepped easing, per emit. * - * @name Phaser.GameObjects.Shader#vertexViewF32 - * @type {Float32Array} - * @since 3.17.0 + * @name Phaser.GameObjects.Particles.EmitterOp#counter + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.vertexViewF32 = new Float32Array(this.vertexData); + this.counter = 0; /** - * A temporary Transform Matrix, re-used internally during batching. + * When the step counter reaches it's maximum, should it then + * yoyo back to the start again, or flip over to it? * - * @name Phaser.GameObjects.Shader#_tempMatrix1 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.17.0 + * @name Phaser.GameObjects.Particles.EmitterOp#yoyo + * @type {boolean} + * @default false + * @since 3.60.0 */ - this._tempMatrix1 = new TransformMatrix(); + this.yoyo = false; /** - * A temporary Transform Matrix, re-used internally during batching. + * The counter direction. 0 for up and 1 for down. * - * @name Phaser.GameObjects.Shader#_tempMatrix2 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.17.0 + * @name Phaser.GameObjects.Particles.EmitterOp#direction + * @type {number} + * @default 0 + * @since 3.60.0 */ - this._tempMatrix2 = new TransformMatrix(); + this.direction = 0; /** - * A temporary Transform Matrix, re-used internally during batching. + * The start value for this property to ease between. * - * @name Phaser.GameObjects.Shader#_tempMatrix3 - * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.17.0 + * If an interpolation this holds a reference to the number data array. + * + * @name Phaser.GameObjects.Particles.EmitterOp#start + * @type {number|number[]} + * @default 0 + * @since 3.0.0 */ - this._tempMatrix3 = new TransformMatrix(); + this.start = 0; /** - * The view matrix the shader uses during rendering. + * The most recently calculated value. Updated every time an + * emission or update method is called. Treat as read-only. * - * @name Phaser.GameObjects.Shader#viewMatrix - * @type {Float32Array} - * @readonly - * @since 3.17.0 + * @name Phaser.GameObjects.Particles.EmitterOp#current + * @type {number} + * @since 3.60.0 */ - this.viewMatrix = new Float32Array([ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); + this.current = 0; /** - * The projection matrix the shader uses during rendering. + * The end value for this property to ease between. * - * @name Phaser.GameObjects.Shader#projectionMatrix - * @type {Float32Array} - * @readonly - * @since 3.17.0 + * @name Phaser.GameObjects.Particles.EmitterOp#end + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.projectionMatrix = new Float32Array([ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); + this.end = 0; /** - * The default uniform mappings. These can be added to (or replaced) by specifying your own uniforms when - * creating this shader game object. The uniforms are updated automatically during the render step. - * - * The defaults are: + * The easing function to use for updating this property, if any. * - * `resolution` (2f) - Set to the size of this shader. - * `time` (1f) - The elapsed game time, in seconds. - * `mouse` (2f) - If a pointer has been bound (with `setPointer`), this uniform contains its position each frame. - * `date` (4fv) - A vec4 containing the year, month, day and time in seconds. - * `sampleRate` (1f) - Sound sample rate. 44100 by default. - * `iChannel0...3` (sampler2D) - Input channels 0 to 3. `null` by default. - * - * @name Phaser.GameObjects.Shader#uniforms - * @type {any} - * @since 3.17.0 + * @name Phaser.GameObjects.Particles.EmitterOp#ease + * @type {?function} + * @since 3.0.0 */ - this.uniforms = {}; + this.ease = null; /** - * The pointer bound to this shader, if any. - * Set via the chainable `setPointer` method, or by modifying this property directly. + * The interpolation function to use for updating this property, if any. * - * @name Phaser.GameObjects.Shader#pointer - * @type {Phaser.Input.Pointer} - * @since 3.17.0 + * @name Phaser.GameObjects.Particles.EmitterOp#interpolation + * @type {?function} + * @since 3.60.0 */ - this.pointer = null; + this.interpolation = null; /** - * The cached width of the renderer. + * Whether this property can only be modified when a Particle is emitted. * - * @name Phaser.GameObjects.Shader#_rendererWidth - * @type {number} - * @private - * @since 3.17.0 + * Set to `true` to allow only {@link Phaser.GameObjects.Particles.EmitterOp#onEmit} callbacks to be set and + * affect this property. + * + * Set to `false` to allow both {@link Phaser.GameObjects.Particles.EmitterOp#onEmit} and + * {@link Phaser.GameObjects.Particles.EmitterOp#onUpdate} callbacks to be set and affect this property. + * + * @name Phaser.GameObjects.Particles.EmitterOp#emitOnly + * @type {boolean} + * @since 3.0.0 */ - this._rendererWidth = renderer.width; + this.emitOnly = emitOnly; /** - * The cached height of the renderer. + * The callback to run for Particles when they are emitted from the Particle Emitter. * - * @name Phaser.GameObjects.Shader#_rendererHeight - * @type {number} - * @private - * @since 3.17.0 + * @name Phaser.GameObjects.Particles.EmitterOp#onEmit + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitCallback} + * @since 3.0.0 */ - this._rendererHeight = renderer.height; + this.onEmit = this.defaultEmit; /** - * Internal texture count tracker. + * The callback to run for Particles when they are updated. * - * @name Phaser.GameObjects.Shader#_textureCount - * @type {number} - * @private - * @since 3.17.0 + * @name Phaser.GameObjects.Particles.EmitterOp#onUpdate + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateCallback} + * @since 3.0.0 */ - this._textureCount = 0; + this.onUpdate = this.defaultUpdate; /** - * A reference to the GL Frame Buffer this Shader is drawing to. - * This property is only set if you have called `Shader.setRenderToTexture`. + * Set to `false` to disable this EmitterOp. * - * @name Phaser.GameObjects.Shader#framebuffer - * @type {?WebGLFramebuffer} - * @since 3.19.0 + * @name Phaser.GameObjects.Particles.EmitterOp#active + * @type {boolean} + * @since 3.60.0 */ - this.framebuffer = null; + this.active = true; /** - * A reference to the WebGLTexture this Shader is rendering to. - * This property is only set if you have called `Shader.setRenderToTexture`. + * The onEmit method type of this EmitterOp. * - * @name Phaser.GameObjects.Shader#glTexture - * @type {?WebGLTexture} - * @since 3.19.0 + * Set as part of `setMethod` and cached here to avoid + * re-setting when only the value changes. + * + * @name Phaser.GameObjects.Particles.EmitterOp#method + * @type {number} + * @since 3.60.0 */ - this.glTexture = null; + this.method = 0; /** - * A flag that indicates if this Shader has been set to render to a texture instead of the display list. - * - * This property is `true` if you have called `Shader.setRenderToTexture`, otherwise it's `false`. - * - * A Shader that is rendering to a texture _does not_ appear on the display list. + * The callback to run for Particles when they are emitted from the Particle Emitter. + * This is set during `setMethods` and used by `proxyEmit`. * - * @name Phaser.GameObjects.Shader#renderToTexture - * @type {boolean} - * @readonly - * @since 3.19.0 + * @name Phaser.GameObjects.Particles.EmitterOp#_onEmit + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitCallback} + * @private + * @since 3.60.0 */ - this.renderToTexture = false; + this._onEmit; /** - * A reference to the Phaser.Textures.Texture that has been stored in the Texture Manager for this Shader. - * - * This property is only set if you have called `Shader.setRenderToTexture`, otherwise it is `null`. + * The callback to run for Particles when they are updated. + * This is set during `setMethods` and used by `proxyUpdate`. * - * @name Phaser.GameObjects.Shader#texture - * @type {Phaser.Textures.Texture} - * @since 3.19.0 + * @name Phaser.GameObjects.Particles.EmitterOp#_onUpdate + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateCallback} + * @private + * @since 3.60.0 */ - this.texture = null; - - this.setPosition(x, y); - this.setSize(width, height); - this.setOrigin(0.5, 0.5); - this.setShader(key, textures, textureData); + this._onUpdate; }, /** - * Compares the renderMask with the renderFlags to see if this Game Object will render or not. - * Also checks the Game Object against the given Cameras exclusion list. + * Load the property from a Particle Emitter configuration object. * - * @method Phaser.GameObjects.Shader#willRender - * @since 3.0.0 + * Optionally accepts a new property key to use, replacing the current one. * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against this Game Object. + * @method Phaser.GameObjects.Particles.EmitterOp#loadConfig + * @since 3.0.0 * - * @return {boolean} True if the Game Object should be rendered, otherwise false. + * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig} [config] - Settings for the Particle Emitter that owns this property. + * @param {string} [newKey] - The new key to use for this property, if any. */ - willRender: function (camera) + loadConfig: function (config, newKey) { - if (this.renderToTexture) + if (config === undefined) { - return true; + config = {}; } - else + + if (newKey) { - return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); + this.propertyKey = newKey; + } + + this.propertyValue = GetFastValue( + config, + this.propertyKey, + this.defaultValue + ); + + this.method = this.getMethod(); + + this.setMethods(); + + if (this.emitOnly) + { + // Reset it back again + this.onUpdate = this.defaultUpdate; } }, /** - * Changes this Shader so instead of rendering to the display list it renders to a - * WebGL Framebuffer and WebGL Texture instead. This allows you to use the output - * of this shader as an input for another shader, by mapping a sampler2D uniform - * to it. - * - * After calling this method the `Shader.framebuffer` and `Shader.glTexture` properties - * are populated. - * - * Additionally, you can provide a key to this method. Doing so will create a Phaser Texture - * from this Shader and save it into the Texture Manager, allowing you to then use it for - * any texture-based Game Object, such as a Sprite or Image: - * - * ```javascript - * var shader = this.add.shader('myShader', x, y, width, height); - * - * shader.setRenderToTexture('doodle'); - * - * this.add.image(400, 300, 'doodle'); - * ``` - * - * Note that it stores an active reference to this Shader. That means as this shader updates, - * so does the texture and any object using it to render with. Also, if you destroy this - * shader, be sure to clear any objects that may have been using it as a texture too. + * Build a JSON representation of this Particle Emitter property. * - * You can access the Phaser Texture that is created via the `Shader.texture` property. + * @method Phaser.GameObjects.Particles.EmitterOp#toJSON + * @since 3.0.0 * - * By default it will create a single base texture. You can add frames to the texture - * by using the `Texture.add` method. After doing this, you can then allow Game Objects - * to use a specific frame from a Render Texture. + * @return {object} A JSON representation of this Particle Emitter property. + */ + toJSON: function () + { + return JSON.stringify(this.propertyValue); + }, + + /** + * Change the current value of the property and update its callback methods. * - * @method Phaser.GameObjects.Shader#setRenderToTexture - * @since 3.19.0 + * @method Phaser.GameObjects.Particles.EmitterOp#onChange + * @since 3.0.0 * - * @param {string} [key] - The unique key to store the texture as within the global Texture Manager. - * @param {boolean} [flipY=false] - Does this texture need vertically flipping before rendering? This should usually be set to `true` if being fed from a buffer. + * @param {number} value - The new numeric value of this property. * - * @return {this} This Shader instance. + * @return {this} This Emitter Op object. */ - setRenderToTexture: function (key, flipY) + onChange: function (value) { - if (flipY === undefined) { flipY = false; } + var current; - if (!this.renderToTexture) + switch (this.method) { - var width = this.width; - var height = this.height; - var renderer = this.renderer; - - this.glTexture = renderer.createTextureFromSource(null, width, height, 0); - - this.glTexture.flipY = flipY; - - this.framebuffer = renderer.createFramebuffer(width, height, this.glTexture, false); + // Number + // Custom Callback (onEmit only) + // Custom onEmit and/or onUpdate callbacks + case 1: + case 3: + case 8: + current = value; + break; - this._rendererWidth = width; - this._rendererHeight = height; + // Random Array + case 2: + if (this.propertyValue.indexOf(value) >= 0) + { + current = value; + } + break; - this.renderToTexture = true; + // Stepped start/end + case 4: + var step = (this.end - this.start) / this.steps; + current = SnapTo(value, step); + this.counter = current; + break; - this.projOrtho(0, this.width, this.height, 0); + // Eased start/end + // min/max (random float or int) + // Random object (random integer) + case 5: + case 6: + case 7: + current = Clamp(value, this.start, this.end); + break; - if (key) - { - this.texture = this.scene.sys.textures.addGLTexture(key, this.glTexture, width, height); - } + // Interpolation + case 9: + current = this.start[0]; + break; } - // And now render at least once, so our texture isn't blank on the first update - - if (this.shader) - { - renderer.pipelines.clear(); - - this.load(); - this.flush(); - - renderer.pipelines.rebind(); - } + this.current = current; return this; }, /** - * Sets the fragment and, optionally, the vertex shader source code that this Shader will use. - * This will immediately delete the active shader program, if set, and then create a new one - * with the given source. Finally, the shader uniforms are initialized. - * - * @method Phaser.GameObjects.Shader#setShader - * @since 3.17.0 + * Checks the type of `EmitterOp.propertyValue` to determine which + * method is required in order to return values from this op function. * - * @param {(string|Phaser.Display.BaseShader)} key - The key of the shader to use from the shader cache, or a BaseShader instance. - * @param {string[]} [textures] - Optional array of texture keys to bind to the iChannel0...3 uniforms. The textures must already exist in the Texture Manager. - * @param {any} [textureData] - Additional texture data. + * @method Phaser.GameObjects.Particles.EmitterOp#getMethod + * @since 3.60.0 * - * @return {this} This Shader instance. + * @return {number} A number between 0 and 9 which should be passed to `setMethods`. */ - setShader: function (key, textures, textureData) + getMethod: function () { - if (textures === undefined) { textures = []; } - - if (typeof key === 'string') - { - var cache = this.scene.sys.cache.shader; - - if (!cache.has(key)) - { - console.warn('Shader missing: ' + key); - return this; - } + var value = this.propertyValue; - this.shader = cache.get(key); - } - else + // `moveToX` and `moveToY` are null by default + if (value === null) { - this.shader = key; + return 0; } - var gl = this.gl; - var renderer = this.renderer; + var t = typeof value; - if (this.program) + if (t === 'number') { - gl.deleteProgram(this.program); + // Number + return 1; } - - var program = renderer.createProgram(this.shader.vertexSrc, this.shader.fragmentSrc); - - // The default uniforms available within the vertex shader - gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uViewMatrix'), false, this.viewMatrix); - gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uProjectionMatrix'), false, this.projectionMatrix); - gl.uniform2f(gl.getUniformLocation(program, 'uResolution'), this.width, this.height); - - this.program = program; - - var d = new Date(); - - // The default uniforms available within the fragment shader - var defaultUniforms = { - resolution: { type: '2f', value: { x: this.width, y: this.height } }, - time: { type: '1f', value: 0 }, - mouse: { type: '2f', value: { x: this.width / 2, y: this.height / 2 } }, - date: { type: '4fv', value: [ d.getFullYear(), d.getMonth(), d.getDate(), d.getHours() * 60 * 60 + d.getMinutes() * 60 + d.getSeconds() ] }, - sampleRate: { type: '1f', value: 44100.0 }, - iChannel0: { type: 'sampler2D', value: null, textureData: { repeat: true } }, - iChannel1: { type: 'sampler2D', value: null, textureData: { repeat: true } }, - iChannel2: { type: 'sampler2D', value: null, textureData: { repeat: true } }, - iChannel3: { type: 'sampler2D', value: null, textureData: { repeat: true } } - }; - - if (this.shader.uniforms) + else if (Array.isArray(value)) { - this.uniforms = Extend(true, {}, this.shader.uniforms, defaultUniforms); + // Random Array + return 2; } - else + else if (t === 'function') { - this.uniforms = defaultUniforms; + // Custom Callback + return 3; } - - for (var i = 0; i < 4; i++) + else if (t === 'object') { - if (textures[i]) + if (this.hasBoth(value, 'start', 'end')) { - this.setSampler2D('iChannel' + i, textures[i], i, textureData); + if (this.has(value, 'steps')) + { + // Stepped start/end + return 4; + } + else + { + // Eased start/end + return 5; + } + } + else if (this.hasBoth(value, 'min', 'max')) + { + // min/max + return 6; + } + else if (this.has(value, 'random')) + { + // Random object + return 7; + } + else if (this.hasEither(value, 'onEmit', 'onUpdate')) + { + // Custom onEmit onUpdate + return 8; + } + else if (this.has(value, 'interpolation')) + { + // Interpolation + return 9; } } - this.initUniforms(); - - this.projOrtho(0, this._rendererWidth, this._rendererHeight, 0); - - return this; - }, - - /** - * Binds a Phaser Pointer object to this Shader. - * - * The screen position of the pointer will be set in to the shaders `mouse` uniform - * automatically every frame. Call this method with no arguments to unbind the pointer. - * - * @method Phaser.GameObjects.Shader#setPointer - * @since 3.17.0 - * - * @param {Phaser.Input.Pointer} [pointer] - The Pointer to bind to this shader. - * - * @return {this} This Shader instance. - */ - setPointer: function (pointer) - { - this.pointer = pointer; - - return this; + return 0; }, /** - * Sets this shader to use an orthographic projection matrix. - * This matrix is stored locally in the `projectionMatrix` property, - * as well as being bound to the `uProjectionMatrix` uniform. + * Update the {@link Phaser.GameObjects.Particles.EmitterOp#onEmit} and + * {@link Phaser.GameObjects.Particles.EmitterOp#onUpdate} callbacks based on the method returned + * from `getMethod`. The method is stored in the `EmitterOp.method` property + * and is a number between 0 and 9 inclusively. * - * @method Phaser.GameObjects.Shader#projOrtho - * @since 3.17.0 + * @method Phaser.GameObjects.Particles.EmitterOp#setMethods + * @since 3.0.0 * - * @param {number} left - The left value. - * @param {number} right - The right value. - * @param {number} bottom - The bottom value. - * @param {number} top - The top value. + * @return {this} This Emitter Op object. */ - projOrtho: function (left, right, bottom, top) + setMethods: function () { - var near = -1000; - var far = 1000; - - var leftRight = 1 / (left - right); - var bottomTop = 1 / (bottom - top); - var nearFar = 1 / (near - far); + var value = this.propertyValue; + var current = value; - var pm = this.projectionMatrix; + var onEmit = this.defaultEmit; + var onUpdate = this.defaultUpdate; - pm[0] = -2 * leftRight; - pm[5] = -2 * bottomTop; - pm[10] = 2 * nearFar; - pm[12] = (left + right) * leftRight; - pm[13] = (top + bottom) * bottomTop; - pm[14] = (far + near) * nearFar; + switch (this.method) + { + // Number + case 1: + onEmit = this.staticValueEmit; + break; - var program = this.program; + // Random Array + case 2: + onEmit = this.randomStaticValueEmit; + current = value[0]; + break; - var gl = this.gl; - var renderer = this.renderer; + // Custom Callback (onEmit only) + case 3: + this._onEmit = value; + onEmit = this.proxyEmit; + break; - renderer.setProgram(program); + // Stepped start/end + case 4: + this.start = value.start; + this.end = value.end; + this.steps = value.steps; + this.counter = this.start; + this.yoyo = this.has(value, 'yoyo') ? value.yoyo : false; + this.direction = 0; + onEmit = this.steppedEmit; + current = this.start; + break; - gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uProjectionMatrix'), false, this.projectionMatrix); + // Eased start/end + case 5: + this.start = value.start; + this.end = value.end; + var easeType = this.has(value, 'ease') ? value.ease : 'Linear'; + this.ease = GetEaseFunction(easeType, value.easeParams); + onEmit = (this.has(value, 'random') && value.random) ? this.randomRangedValueEmit : this.easedValueEmit; + onUpdate = this.easeValueUpdate; + current = this.start; + break; - this._rendererWidth = right; - this._rendererHeight = bottom; - }, + // min/max (random float or int) + case 6: + this.start = value.min; + this.end = value.max; + onEmit = (this.has(value, 'int') && value.int) ? this.randomRangedIntEmit : this.randomRangedValueEmit; + current = this.start; + break; - // Uniforms are specified in the GLSL_ES Specification: http://www.khronos.org/registry/webgl/specs/latest/1.0/ - // http://www.khronos.org/registry/gles/specs/2.0/GLSL_ES_Specification_1.0.17.pdf + // Random object (random integer) + case 7: + var rnd = value.random; - /** - * Initializes all of the uniforms this shader uses. - * - * @method Phaser.GameObjects.Shader#initUniforms - * @private - * @since 3.17.0 - */ - initUniforms: function () - { - var gl = this.gl; - var map = this.renderer.glFuncMap; - var program = this.program; + if (Array.isArray(rnd)) + { + this.start = rnd[0]; + this.end = rnd[1]; + } - this._textureCount = 0; + onEmit = this.randomRangedIntEmit; + current = this.start; + break; - for (var key in this.uniforms) - { - var uniform = this.uniforms[key]; + // Custom onEmit and/or onUpdate callbacks + case 8: + this._onEmit = (this.has(value, 'onEmit')) ? value.onEmit : this.defaultEmit; + this._onUpdate = (this.has(value, 'onUpdate')) ? value.onUpdate : this.defaultUpdate; + onEmit = this.proxyEmit; + onUpdate = this.proxyUpdate; + break; - var type = uniform.type; - var data = map[type]; + // Interpolation + case 9: + this.start = value.values; + var easeTypeI = this.has(value, 'ease') ? value.ease : 'Linear'; + this.ease = GetEaseFunction(easeTypeI, value.easeParams); + this.interpolation = GetInterpolationFunction(value.interpolation); + onEmit = this.easedValueEmit; + onUpdate = this.easeValueUpdate; + current = this.start[0]; + break; + } - uniform.uniformLocation = gl.getUniformLocation(program, key); + this.onEmit = onEmit; + this.onUpdate = onUpdate; + this.current = current; - if (type !== 'sampler2D') - { - uniform.glMatrix = data.matrix; - uniform.glValueLength = data.length; - uniform.glFunc = data.func; - } - } + return this; }, /** - * Sets a sampler2D uniform on this shader where the source texture is a WebGLTexture. - * - * This allows you to feed the output from one Shader into another: - * - * ```javascript - * let shader1 = this.add.shader(baseShader1, 0, 0, 512, 512).setRenderToTexture(); - * let shader2 = this.add.shader(baseShader2, 0, 0, 512, 512).setRenderToTexture('output'); + * Check whether an object has the given property. * - * shader1.setSampler2DBuffer('iChannel0', shader2.glTexture, 512, 512); - * shader2.setSampler2DBuffer('iChannel0', shader1.glTexture, 512, 512); - * ``` + * @method Phaser.GameObjects.Particles.EmitterOp#has + * @since 3.0.0 * - * In the above code, the result of baseShader1 is fed into Shader2 as the `iChannel0` sampler2D uniform. - * The result of baseShader2 is then fed back into shader1 again, creating a feedback loop. + * @param {object} object - The object to check. + * @param {string} key - The key of the property to look for in the object. * - * If you wish to use an image from the Texture Manager as a sampler2D input for this shader, - * see the `Shader.setSampler2D` method. + * @return {boolean} `true` if the property exists in the object, `false` otherwise. + */ + has: function (object, key) + { + return object.hasOwnProperty(key); + }, + + /** + * Check whether an object has both of the given properties. * - * @method Phaser.GameObjects.Shader#setSampler2DBuffer - * @since 3.19.0 + * @method Phaser.GameObjects.Particles.EmitterOp#hasBoth + * @since 3.0.0 * - * @param {string} uniformKey - The key of the sampler2D uniform to be updated, i.e. `iChannel0`. - * @param {WebGLTexture} texture - A WebGLTexture reference. - * @param {number} width - The width of the texture. - * @param {number} height - The height of the texture. - * @param {number} [textureIndex=0] - The texture index. - * @param {any} [textureData] - Additional texture data. + * @param {object} object - The object to check. + * @param {string} key1 - The key of the first property to check the object for. + * @param {string} key2 - The key of the second property to check the object for. * - * @return {this} This Shader instance. + * @return {boolean} `true` if both properties exist in the object, `false` otherwise. */ - setSampler2DBuffer: function (uniformKey, texture, width, height, textureIndex, textureData) + hasBoth: function (object, key1, key2) { - if (textureIndex === undefined) { textureIndex = 0; } - if (textureData === undefined) { textureData = {}; } - - var uniform = this.uniforms[uniformKey]; - - uniform.value = texture; - - textureData.width = width; - textureData.height = height; - - uniform.textureData = textureData; - - this._textureCount = textureIndex; - - this.initSampler2D(uniform); - - return this; - }, + return object.hasOwnProperty(key1) && object.hasOwnProperty(key2); + }, /** - * Sets a sampler2D uniform on this shader. - * - * The textureKey given is the key from the Texture Manager cache. You cannot use a single frame - * from a texture, only the full image. Also, lots of shaders expect textures to be power-of-two sized. - * - * If you wish to use another Shader as a sampler2D input for this shader, see the `Shader.setSampler2DBuffer` method. + * Check whether an object has at least one of the given properties. * - * @method Phaser.GameObjects.Shader#setSampler2D - * @since 3.17.0 + * @method Phaser.GameObjects.Particles.EmitterOp#hasEither + * @since 3.0.0 * - * @param {string} uniformKey - The key of the sampler2D uniform to be updated, i.e. `iChannel0`. - * @param {string} textureKey - The key of the texture, as stored in the Texture Manager. Must already be loaded. - * @param {number} [textureIndex=0] - The texture index. - * @param {any} [textureData] - Additional texture data. + * @param {object} object - The object to check. + * @param {string} key1 - The key of the first property to check the object for. + * @param {string} key2 - The key of the second property to check the object for. * - * @return {this} This Shader instance. + * @return {boolean} `true` if at least one of the properties exists in the object, `false` if neither exist. */ - setSampler2D: function (uniformKey, textureKey, textureIndex, textureData) + hasEither: function (object, key1, key2) { - if (textureIndex === undefined) { textureIndex = 0; } - - var textureManager = this.scene.sys.textures; - - if (textureManager.exists(textureKey)) - { - var frame = textureManager.getFrame(textureKey); - - if (frame.glTexture && frame.glTexture.isRenderTexture) - { - return this.setSampler2DBuffer(uniformKey, frame.glTexture, frame.width, frame.height, textureIndex, textureData); - } - - var uniform = this.uniforms[uniformKey]; - var source = frame.source; - - uniform.textureKey = textureKey; - uniform.source = source.image; - uniform.value = frame.glTexture; - - if (source.isGLTexture) - { - if (!textureData) - { - textureData = {}; - } - - textureData.width = source.width; - textureData.height = source.height; - } - - if (textureData) - { - uniform.textureData = textureData; - } - - this._textureCount = textureIndex; - - this.initSampler2D(uniform); - } - - return this; + return object.hasOwnProperty(key1) || object.hasOwnProperty(key2); }, /** - * Sets a property of a uniform already present on this shader. - * - * To modify the value of a uniform such as a 1f or 1i use the `value` property directly: - * - * ```javascript - * shader.setUniform('size.value', 16); - * ``` - * - * You can use dot notation to access deeper values, for example: - * - * ```javascript - * shader.setUniform('resolution.value.x', 512); - * ``` - * - * The change to the uniform will take effect the next time the shader is rendered. + * The returned value sets what the property will be at the START of the particles life, on emit. * - * @method Phaser.GameObjects.Shader#setUniform - * @since 3.17.0 + * @method Phaser.GameObjects.Particles.EmitterOp#defaultEmit + * @since 3.0.0 * - * @param {string} key - The key of the uniform to modify. Use dots for deep properties, i.e. `resolution.value.x`. - * @param {any} value - The value to set into the uniform. + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The name of the property. + * @param {number} [value] - The current value of the property. * - * @return {this} This Shader instance. + * @return {number} The new value of the property. */ - setUniform: function (key, value) + defaultEmit: function (particle, key, value) { - SetValue(this.uniforms, key, value); - - return this; + return value; }, /** - * Returns the uniform object for the given key, or `null` if the uniform couldn't be found. + * The returned value updates the property for the duration of the particles life. * - * @method Phaser.GameObjects.Shader#getUniform - * @since 3.17.0 + * @method Phaser.GameObjects.Particles.EmitterOp#defaultUpdate + * @since 3.0.0 * - * @param {string} key - The key of the uniform to return the value for. + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The name of the property. + * @param {number} t - The current normalized lifetime of the particle, between 0 (birth) and 1 (death). + * @param {number} value - The current value of the property. * - * @return {any} A reference to the uniform object. This is not a copy, so modifying it will update the original object also. + * @return {number} The new value of the property. */ - getUniform: function (key) + defaultUpdate: function (particle, key, t, value) { - return GetFastValue(this.uniforms, key, null); + return value; }, /** - * A short-cut method that will directly set the texture being used by the `iChannel0` sampler2D uniform. + * The returned value sets what the property will be at the START of the particles life, on emit. * - * The textureKey given is the key from the Texture Manager cache. You cannot use a single frame - * from a texture, only the full image. Also, lots of shaders expect textures to be power-of-two sized. + * This method is only used when you have provided a custom emit callback. * - * @method Phaser.GameObjects.Shader#setChannel0 - * @since 3.17.0 + * @method Phaser.GameObjects.Particles.EmitterOp#proxyEmit + * @since 3.60.0 * - * @param {string} textureKey - The key of the texture, as stored in the Texture Manager. Must already be loaded. - * @param {any} [textureData] - Additional texture data. + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The name of the property. + * @param {number} [value] - The current value of the property. * - * @return {this} This Shader instance. + * @return {number} The new value of the property. */ - setChannel0: function (textureKey, textureData) + proxyEmit: function (particle, key, value) { - return this.setSampler2D('iChannel0', textureKey, 0, textureData); + var result = this._onEmit(particle, key, value); + + this.current = result; + + return result; }, /** - * A short-cut method that will directly set the texture being used by the `iChannel1` sampler2D uniform. + * The returned value updates the property for the duration of the particles life. * - * The textureKey given is the key from the Texture Manager cache. You cannot use a single frame - * from a texture, only the full image. Also, lots of shaders expect textures to be power-of-two sized. + * This method is only used when you have provided a custom update callback. * - * @method Phaser.GameObjects.Shader#setChannel1 - * @since 3.17.0 + * @method Phaser.GameObjects.Particles.EmitterOp#proxyUpdate + * @since 3.60.0 * - * @param {string} textureKey - The key of the texture, as stored in the Texture Manager. Must already be loaded. - * @param {any} [textureData] - Additional texture data. + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The name of the property. + * @param {number} t - The current normalized lifetime of the particle, between 0 (birth) and 1 (death). + * @param {number} value - The current value of the property. * - * @return {this} This Shader instance. + * @return {number} The new value of the property. */ - setChannel1: function (textureKey, textureData) + proxyUpdate: function (particle, key, t, value) { - return this.setSampler2D('iChannel1', textureKey, 1, textureData); + var result = this._onUpdate(particle, key, t, value); + + this.current = result; + + return result; }, /** - * A short-cut method that will directly set the texture being used by the `iChannel2` sampler2D uniform. - * - * The textureKey given is the key from the Texture Manager cache. You cannot use a single frame - * from a texture, only the full image. Also, lots of shaders expect textures to be power-of-two sized. - * - * @method Phaser.GameObjects.Shader#setChannel2 - * @since 3.17.0 + * An `onEmit` callback that returns the current value of the property. * - * @param {string} textureKey - The key of the texture, as stored in the Texture Manager. Must already be loaded. - * @param {any} [textureData] - Additional texture data. + * @method Phaser.GameObjects.Particles.EmitterOp#staticValueEmit + * @since 3.0.0 * - * @return {this} This Shader instance. + * @return {number} The current value of the property. */ - setChannel2: function (textureKey, textureData) + staticValueEmit: function () { - return this.setSampler2D('iChannel2', textureKey, 2, textureData); + return this.current; }, /** - * A short-cut method that will directly set the texture being used by the `iChannel3` sampler2D uniform. - * - * The textureKey given is the key from the Texture Manager cache. You cannot use a single frame - * from a texture, only the full image. Also, lots of shaders expect textures to be power-of-two sized. - * - * @method Phaser.GameObjects.Shader#setChannel3 - * @since 3.17.0 + * An `onUpdate` callback that returns the current value of the property. * - * @param {string} textureKey - The key of the texture, as stored in the Texture Manager. Must already be loaded. - * @param {any} [textureData] - Additional texture data. + * @method Phaser.GameObjects.Particles.EmitterOp#staticValueUpdate + * @since 3.0.0 * - * @return {this} This Shader instance. + * @return {number} The current value of the property. */ - setChannel3: function (textureKey, textureData) + staticValueUpdate: function () { - return this.setSampler2D('iChannel3', textureKey, 3, textureData); + return this.current; }, /** - * Internal method that takes a sampler2D uniform and prepares it for use by setting the - * gl texture parameters. + * An `onEmit` callback that returns a random value from the current value array. * - * @method Phaser.GameObjects.Shader#initSampler2D - * @private - * @since 3.17.0 + * @method Phaser.GameObjects.Particles.EmitterOp#randomStaticValueEmit + * @since 3.0.0 * - * @param {any} uniform - The sampler2D uniform to process. + * @return {number} The new value of the property. */ - initSampler2D: function (uniform) + randomStaticValueEmit: function () { - if (!uniform.value) - { - return; - } - - var gl = this.gl; + var randomIndex = Math.floor(Math.random() * this.propertyValue.length); - gl.activeTexture(gl.TEXTURE0 + this._textureCount); - gl.bindTexture(gl.TEXTURE_2D, uniform.value); + this.current = this.propertyValue[randomIndex]; - // Extended texture data + return this.current; + }, - var data = uniform.textureData; + /** + * An `onEmit` callback that returns a value between the {@link Phaser.GameObjects.Particles.EmitterOp#start} and + * {@link Phaser.GameObjects.Particles.EmitterOp#end} range. + * + * @method Phaser.GameObjects.Particles.EmitterOp#randomRangedValueEmit + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The key of the property. + * + * @return {number} The new value of the property. + */ + randomRangedValueEmit: function (particle, key) + { + var value = FloatBetween(this.start, this.end); - if (data && !uniform.value.isRenderTexture) + if (particle && particle.data[key]) { - // https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D - - // mag / minFilter can be: gl.LINEAR, gl.LINEAR_MIPMAP_LINEAR or gl.NEAREST - // wrapS/T can be: gl.CLAMP_TO_EDGE or gl.REPEAT - // format can be: gl.LUMINANCE or gl.RGBA - - var magFilter = gl[GetFastValue(data, 'magFilter', 'linear').toUpperCase()]; - var minFilter = gl[GetFastValue(data, 'minFilter', 'linear').toUpperCase()]; - var wrapS = gl[GetFastValue(data, 'wrapS', 'repeat').toUpperCase()]; - var wrapT = gl[GetFastValue(data, 'wrapT', 'repeat').toUpperCase()]; - var format = gl[GetFastValue(data, 'format', 'rgba').toUpperCase()]; - - if (data.repeat) - { - wrapS = gl.REPEAT; - wrapT = gl.REPEAT; - } + particle.data[key].min = value; + particle.data[key].max = this.end; + } - gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, !!data.flipY); + this.current = value; - if (data.width) - { - var width = GetFastValue(data, 'width', 512); - var height = GetFastValue(data, 'height', 2); - var border = GetFastValue(data, 'border', 0); + return value; + }, - // texImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, ArrayBufferView? pixels) - gl.texImage2D(gl.TEXTURE_2D, 0, format, width, height, border, format, gl.UNSIGNED_BYTE, null); - } - else - { - // texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, ImageData? pixels) - gl.texImage2D(gl.TEXTURE_2D, 0, format, gl.RGBA, gl.UNSIGNED_BYTE, uniform.source); - } + /** + * An `onEmit` callback that returns a value between the {@link Phaser.GameObjects.Particles.EmitterOp#start} and + * {@link Phaser.GameObjects.Particles.EmitterOp#end} range. + * + * @method Phaser.GameObjects.Particles.EmitterOp#randomRangedIntEmit + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The key of the property. + * + * @return {number} The new value of the property. + */ + randomRangedIntEmit: function (particle, key) + { + var value = Between(this.start, this.end); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapS); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrapT); + if (particle && particle.data[key]) + { + particle.data[key].min = value; + particle.data[key].max = this.end; } - this.renderer.setProgram(this.program); - - gl.uniform1i(uniform.uniformLocation, this._textureCount); + this.current = value; - this._textureCount++; + return value; }, /** - * Synchronizes all of the uniforms this shader uses. - * Each uniforms gl function is called in turn. + * An `onEmit` callback that returns a stepped value between the + * {@link Phaser.GameObjects.Particles.EmitterOp#start} and {@link Phaser.GameObjects.Particles.EmitterOp#end} + * range. * - * @method Phaser.GameObjects.Shader#syncUniforms - * @private - * @since 3.17.0 + * @method Phaser.GameObjects.Particles.EmitterOp#steppedEmit + * @since 3.0.0 + * + * @return {number} The new value of the property. */ - syncUniforms: function () + steppedEmit: function () { - var gl = this.gl; + var current = this.counter; - var uniforms = this.uniforms; - var uniform; - var length; - var glFunc; - var location; - var value; - var textureCount = 0; + var next = current; - for (var key in uniforms) - { - uniform = uniforms[key]; + var step = (this.end - this.start) / this.steps; - glFunc = uniform.glFunc; - length = uniform.glValueLength; - location = uniform.uniformLocation; - value = uniform.value; + if (this.yoyo) + { + var over; - if (value === null) + if (this.direction === 0) { - continue; - } + // Add step to the current value + next += step; - if (length === 1) - { - if (uniform.glMatrix) - { - glFunc.call(gl, location, uniform.transpose, value); - } - else + if (next >= this.end) { - glFunc.call(gl, location, value); + over = next - this.end; + + next = this.end - over; + + this.direction = 1; } } - else if (length === 2) - { - glFunc.call(gl, location, value.x, value.y); - } - else if (length === 3) - { - glFunc.call(gl, location, value.x, value.y, value.z); - } - else if (length === 4) - { - glFunc.call(gl, location, value.x, value.y, value.z, value.w); - } - else if (uniform.type === 'sampler2D') + else { - gl.activeTexture(gl.TEXTURE0 + textureCount); + // Down + next -= step; - gl.bindTexture(gl.TEXTURE_2D, value); + if (next <= this.start) + { + over = this.start - next; - gl.uniform1i(location, textureCount); + next = this.start + over; - textureCount++; + this.direction = 0; + } } + + this.counter = next; + } + else + { + this.counter = Wrap(next + step, this.start, this.end); } + + this.current = current; + + return current; }, /** - * Called automatically during render. + * An `onEmit` callback for an eased property. * - * This method performs matrix ITRS and then stores the resulting value in the `uViewMatrix` uniform. - * It then sets up the vertex buffer and shader, updates and syncs the uniforms ready - * for flush to be called. + * It prepares the particle for easing by {@link Phaser.GameObjects.Particles.EmitterOp#easeValueUpdate}. * - * @method Phaser.GameObjects.Shader#load - * @since 3.17.0 + * @method Phaser.GameObjects.Particles.EmitterOp#easedValueEmit + * @since 3.0.0 * - * @param {Phaser.GameObjects.Components.TransformMatrix} [matrix2D] - The transform matrix to use during rendering. + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The name of the property. + * + * @return {number} {@link Phaser.GameObjects.Particles.EmitterOp#start}, as the new value of the property. */ - load: function (matrix2D) + easedValueEmit: function (particle, key) { - // ITRS - - var gl = this.gl; - var width = this.width; - var height = this.height; - var renderer = this.renderer; - var program = this.program; - var vm = this.viewMatrix; - - if (!this.renderToTexture) + if (particle && particle.data[key]) { - var x = -this._displayOriginX; - var y = -this._displayOriginY; + var data = particle.data[key]; - vm[0] = matrix2D[0]; - vm[1] = matrix2D[1]; - vm[4] = matrix2D[2]; - vm[5] = matrix2D[3]; - vm[8] = matrix2D[4]; - vm[9] = matrix2D[5]; - vm[12] = vm[0] * x + vm[4] * y; - vm[13] = vm[1] * x + vm[5] * y; + data.min = this.start; + data.max = this.end; } - // Update vertex shader uniforms - - gl.useProgram(program); - - gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uViewMatrix'), false, vm); - gl.uniform2f(gl.getUniformLocation(program, 'uResolution'), this.width, this.height); - - // Update fragment shader uniforms - - var uniforms = this.uniforms; - var res = uniforms.resolution; + this.current = this.start; - res.value.x = width; - res.value.y = height; + return this.start; + }, - uniforms.time.value = renderer.game.loop.getDuration(); + /** + * An `onUpdate` callback that returns an eased value between the + * {@link Phaser.GameObjects.Particles.EmitterOp#start} and {@link Phaser.GameObjects.Particles.EmitterOp#end} + * range. + * + * @method Phaser.GameObjects.Particles.EmitterOp#easeValueUpdate + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The name of the property. + * @param {number} t - The current normalized lifetime of the particle, between 0 (birth) and 1 (death). + * + * @return {number} The new value of the property. + */ + easeValueUpdate: function (particle, key, t) + { + var data = particle.data[key]; - var pointer = this.pointer; + var current; + var v = this.ease(t); - if (pointer) + if (this.interpolation) { - var mouse = uniforms.mouse; - - var px = pointer.x / width; - var py = 1 - pointer.y / height; - - mouse.value.x = px.toFixed(2); - mouse.value.y = py.toFixed(2); + current = this.interpolation(this.start, v); + } + else + { + current = (data.max - data.min) * v + data.min; } - this.syncUniforms(); + this.current = current; + + return current; }, /** - * Called automatically during render. + * Destroys this EmitterOp instance and all of its references. * - * Sets the active shader, loads the vertex buffer and then draws. + * Called automatically when the ParticleEmitter that owns this + * EmitterOp is destroyed. * - * @method Phaser.GameObjects.Shader#flush - * @since 3.17.0 + * @method Phaser.GameObjects.Particles.EmitterOp#destroy + * @since 3.60.0 */ - flush: function () + destroy: function () { - // Bind + this.propertyValue = null; + this.defaultValue = null; + this.ease = null; + this.interpolation = null; + this._onEmit = null; + this._onUpdate = null; + } +}); - var width = this.width; - var height = this.height; - var program = this.program; +module.exports = EmitterOp; - var gl = this.gl; - var vertexBuffer = this.vertexBuffer; - var renderer = this.renderer; - var vertexSize = Float32Array.BYTES_PER_ELEMENT * 2; - if (this.renderToTexture) - { - renderer.setFramebuffer(this.framebuffer); +/***/ }), - gl.clearColor(0, 0, 0, 0); +/***/ 87811: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - gl.clear(gl.COLOR_BUFFER_BIT); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); +var Class = __webpack_require__(56694); +var GetFastValue = __webpack_require__(72632); +var ParticleProcessor = __webpack_require__(30891); - var location = gl.getAttribLocation(program, 'inPosition'); +/** + * @classdesc + * The Gravity Well Particle Processor applies a force on the particles to draw + * them towards, or repel them from, a single point. + * + * The force applied is inversely proportional to the square of the distance + * from the particle to the point, in accordance with Newton's law of gravity. + * + * This simulates the effect of gravity over large distances (as between planets, for example). + * + * @class GravityWell + * @extends Phaser.GameObjects.Particles.ParticleProcessor + * @memberof Phaser.GameObjects.Particles + * @constructor + * @since 3.0.0 + * + * @param {(number|Phaser.Types.GameObjects.Particles.GravityWellConfig)} [x=0] - The x coordinate of the Gravity Well, in world space. + * @param {number} [y=0] - The y coordinate of the Gravity Well, in world space. + * @param {number} [power=0] - The strength of the gravity force - larger numbers produce a stronger force. + * @param {number} [epsilon=100] - The minimum distance for which the gravity force is calculated. + * @param {number} [gravity=50] - The gravitational force of this Gravity Well. + */ +var GravityWell = new Class({ - if (location !== -1) + Extends: ParticleProcessor, + + initialize: + + function GravityWell (x, y, power, epsilon, gravity) + { + if (typeof x === 'object') { - gl.enableVertexAttribArray(location); + var config = x; - gl.vertexAttribPointer(location, 2, gl.FLOAT, false, vertexSize, 0); + x = GetFastValue(config, 'x', 0); + y = GetFastValue(config, 'y', 0); + power = GetFastValue(config, 'power', 0); + epsilon = GetFastValue(config, 'epsilon', 100); + gravity = GetFastValue(config, 'gravity', 50); + } + else + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (power === undefined) { power = 0; } + if (epsilon === undefined) { epsilon = 100; } + if (gravity === undefined) { gravity = 50; } } - // Draw + ParticleProcessor.call(this, x, y, true); - var vf = this.vertexViewF32; + /** + * Internal gravity value. + * + * @name Phaser.GameObjects.Particles.GravityWell#_gravity + * @type {number} + * @private + * @since 3.0.0 + */ + this._gravity = gravity; - vf[3] = height; - vf[4] = width; - vf[5] = height; - vf[8] = width; - vf[9] = height; - vf[10] = width; + /** + * Internal power value. + * + * @name Phaser.GameObjects.Particles.GravityWell#_power + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._power = power * gravity; - // Flush + /** + * Internal epsilon value. + * + * @name Phaser.GameObjects.Particles.GravityWell#_epsilon + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._epsilon = epsilon * epsilon; + }, - var vertexCount = 6; + /** + * Takes a Particle and updates it based on the properties of this Gravity Well. + * + * @method Phaser.GameObjects.Particles.GravityWell#update + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The Particle to update. + * @param {number} delta - The delta time in ms. + * @param {number} step - The delta value divided by 1000. + */ + update: function (particle, delta) + { + var x = this.x - particle.x; + var y = this.y - particle.y; + var dSq = x * x + y * y; - gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); + if (dSq === 0) + { + return; + } - gl.drawArrays(gl.TRIANGLES, 0, vertexCount); + var d = Math.sqrt(dSq); - if (this.renderToTexture) + if (dSq < this._epsilon) { - renderer.setFramebuffer(null, false); + dSq = this._epsilon; } + + var factor = ((this._power * delta) / (dSq * d)) * 100; + + particle.velocityX += x * factor; + particle.velocityY += y * factor; }, /** - * A NOOP method so you can pass a Shader to a Container. - * Calling this method will do nothing. It is intentionally empty. + * The minimum distance for which the gravity force is calculated. * - * @method Phaser.GameObjects.Shader#setAlpha - * @private - * @since 3.17.0 + * Defaults to 100. + * + * @name Phaser.GameObjects.Particles.GravityWell#epsilon + * @type {number} + * @since 3.0.0 */ - setAlpha: function () - { + epsilon: { + + get: function () + { + return Math.sqrt(this._epsilon); + }, + + set: function (value) + { + this._epsilon = value * value; + } + }, /** - * A NOOP method so you can pass a Shader to a Container. - * Calling this method will do nothing. It is intentionally empty. + * The strength of the gravity force - larger numbers produce a stronger force. * - * @method Phaser.GameObjects.Shader#setBlendMode - * @private - * @since 3.17.0 + * Defaults to 0. + * + * @name Phaser.GameObjects.Particles.GravityWell#power + * @type {number} + * @since 3.0.0 */ - setBlendMode: function () - { + power: { + + get: function () + { + return this._power / this._gravity; + }, + + set: function (value) + { + this._power = value * this._gravity; + } + }, /** - * Internal destroy handler, called as part of the destroy process. + * The gravitational force of this Gravity Well. * - * @method Phaser.GameObjects.Shader#preDestroy - * @protected - * @since 3.17.0 + * Defaults to 50. + * + * @name Phaser.GameObjects.Particles.GravityWell#gravity + * @type {number} + * @since 3.0.0 */ - preDestroy: function () - { - var gl = this.gl; - - gl.deleteProgram(this.program); - gl.deleteBuffer(this.vertexBuffer); + gravity: { - if (this.renderToTexture) + get: function () { - this.renderer.deleteFramebuffer(this.framebuffer); - - this.texture.destroy(); + return this._gravity; + }, - this.framebuffer = null; - this.glTexture = null; - this.texture = null; + set: function (value) + { + var pwr = this.power; + this._gravity = value; + this.power = pwr; } + } }); -module.exports = Shader; +module.exports = GravityWell; /***/ }), -/* 230 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 14909: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var DegToRad = __webpack_require__(36); -var Face = __webpack_require__(116); -var GameObject = __webpack_require__(15); -var GenerateVerts = __webpack_require__(479); -var GenerateObjVerts = __webpack_require__(480); -var GetCalcMatrix = __webpack_require__(19); -var Matrix4 = __webpack_require__(69); -var MeshRender = __webpack_require__(1179); -var StableSort = __webpack_require__(79); -var Vector3 = __webpack_require__(39); -var Vertex = __webpack_require__(117); +var AnimationState = __webpack_require__(16569); +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var DegToRad = __webpack_require__(75606); +var Rectangle = __webpack_require__(74118); +var RotateAround = __webpack_require__(2386); +var Vector2 = __webpack_require__(93736); /** * @classdesc - * A Mesh Game Object. - * - * The Mesh Game Object allows you to render a group of textured vertices and manipulate - * the view of those vertices, such as rotation, translation or scaling. - * - * Support for generating mesh data from grids, model data or Wavefront OBJ Files is included. - * - * Although you can use this to render 3D objects, its primary use is for displaying more complex - * Sprites, or Sprites where you need fine-grained control over the vertex positions in order to - * achieve special effects in your games. Note that rendering still takes place using Phaser's - * orthographic camera (after being transformed via `projectionMesh`, see `setPerspective`, - * `setOrtho`, and `panZ` methods). As a result, all depth and face tests are done in an eventually - * orthographic space. - * - * The rendering process will iterate through the faces of this Mesh and render out each face - * that is considered as being in view of the camera. No depth buffer is used, and because of this, - * you should be careful not to use model data with too many vertices, or overlapping geometry, - * or you'll probably encounter z-depth fighting. The Mesh was designed to allow for more advanced - * 2D layouts, rather than displaying 3D objects, even though it can do this to a degree. - * - * In short, if you want to remake Crysis, use a 3D engine, not a Mesh. However, if you want - * to easily add some small fun 3D elements into your game, or create some special effects involving - * vertex warping, this is the right object for you. Mesh data becomes part of the WebGL batch, - * just like standard Sprites, so doesn't introduce any additional shader overhead. Because - * the Mesh just generates vertices into the WebGL batch, like any other Sprite, you can use all of - * the common Game Object components on a Mesh too, such as a custom pipeline, mask, blend mode - * or texture. - * - * Note that the Mesh object is WebGL only and does not have a Canvas counterpart. + * A Particle is a simple object owned and controlled by a Particle Emitter. * - * The Mesh origin is always 0.5 x 0.5 and cannot be changed. + * It encapsulates all of the properties required to move and update according + * to the Emitters operations. * - * @class Mesh - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects + * @class Particle + * @memberof Phaser.GameObjects.Particles * @constructor - * @webglOnly * @since 3.0.0 * - * @extends Phaser.GameObjects.Components.AlphaSingle - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * @extends Phaser.GameObjects.Components.ScrollFactor - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x] - The horizontal position of this Game Object in the world. - * @param {number} [y] - The vertical position of this Game Object in the world. - * @param {string|Phaser.Textures.Texture} [texture] - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {string|number} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {number[]} [vertices] - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true` (but see note). - * @param {number[]} [uvs] - The UVs pairs array. - * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. - * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? Note: If not, it will be assumed `z=0`, see method `panZ` or `setOrtho`. - * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. - * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. - * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. + * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The Emitter to which this Particle belongs. */ -var Mesh = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.AlphaSingle, - Components.BlendMode, - Components.Depth, - Components.Mask, - Components.Pipeline, - Components.Size, - Components.Texture, - Components.Transform, - Components.Visible, - Components.ScrollFactor, - MeshRender - ], +var Particle = new Class({ initialize: - function Mesh (scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas) + function Particle (emitter) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (texture === undefined) { texture = '__WHITE'; } - - GameObject.call(this, scene, 'Mesh'); - /** - * An array containing the Face instances belonging to this Mesh. - * - * A Face consists of 3 Vertex objects. + * The Emitter to which this Particle belongs. * - * This array is populated during calls such as `addVertices` or `addOBJ`. + * A Particle can only belong to a single Emitter and is created, updated and destroyed by it. * - * @name Phaser.GameObjects.Mesh#faces - * @type {Phaser.Geom.Mesh.Face[]} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#emitter + * @type {Phaser.GameObjects.Particles.ParticleEmitter} + * @since 3.0.0 */ - this.faces = []; + this.emitter = emitter; /** - * An array containing Vertex instances. One instance per vertex in this Mesh. - * - * This array is populated during calls such as `addVertex` or `addOBJ`. + * The texture used by this Particle when it renders. * - * @name Phaser.GameObjects.Mesh#vertices - * @type {Phaser.Geom.Mesh.Vertex[]} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#texture + * @type {Phaser.Textures.Texture} + * @default null + * @since 3.60.0 */ - this.vertices = []; + this.texture = null; /** - * The tint fill mode. + * The texture frame used by this Particle when it renders. * - * `false` = An additive tint (the default), where vertices colors are blended with the texture. - * `true` = A fill tint, where the vertex colors replace the texture, but respects texture alpha. - * - * @name Phaser.GameObjects.Mesh#tintFill - * @type {boolean} - * @default false - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#frame + * @type {Phaser.Textures.Frame} + * @default null + * @since 3.0.0 */ - this.tintFill = false; + this.frame = null; /** - * You can optionally choose to render the vertices of this Mesh to a Graphics instance. - * - * Achieve this by setting the `debugCallback` and the `debugGraphic` properties. - * - * You can do this in a single call via the `Mesh.setDebug` method, which will use the - * built-in debug function. You can also set it to your own callback. The callback - * will be invoked _once per render_ and sent the following parameters: - * - * `debugCallback(src, meshLength, verts)` - * - * `src` is the Mesh instance being debugged. - * `meshLength` is the number of mesh vertices in total. - * `verts` is an array of the translated vertex coordinates. - * - * To disable rendering, set this property back to `null`. - * - * Please note that high vertex count Meshes will struggle to debug properly. + * The x coordinate of this Particle. * - * @name Phaser.GameObjects.Mesh#debugCallback - * @type {function} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#x + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.debugCallback = null; + this.x = 0; /** - * The Graphics instance that the debug vertices will be drawn to, if `setDebug` has - * been called. + * The y coordinate of this Particle. * - * @name Phaser.GameObjects.Mesh#debugGraphic - * @type {Phaser.GameObjects.Graphics} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#y + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.debugGraphic = null; + this.y = 0; /** - * When rendering, skip any Face that isn't counter clockwise? - * - * Enable this to hide backward-facing Faces during rendering. + * The coordinates of this Particle in world space. * - * Disable it to render all Faces. + * Updated as part of `computeVelocity`. * - * @name Phaser.GameObjects.Mesh#hideCCW - * @type {boolean} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#worldPosition + * @type {Phaser.Math.Vector2} + * @since 3.60.0 */ - this.hideCCW = true; + this.worldPosition = new Vector2(); /** - * A Vector3 containing the 3D position of the vertices in this Mesh. - * - * Modifying the components of this property will allow you to reposition where - * the vertices are rendered within the Mesh. This happens in the `preUpdate` phase, - * where each vertex is transformed using the view and projection matrices. - * - * Changing this property will impact all vertices being rendered by this Mesh. - * - * You can also adjust the 'view' by using the `pan` methods. + * The x velocity of this Particle. * - * @name Phaser.GameObjects.Mesh#modelPosition - * @type {Phaser.Math.Vector3} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#velocityX + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.modelPosition = new Vector3(); + this.velocityX = 0; /** - * A Vector3 containing the 3D scale of the vertices in this Mesh. - * - * Modifying the components of this property will allow you to scale - * the vertices within the Mesh. This happens in the `preUpdate` phase, - * where each vertex is transformed using the view and projection matrices. - * - * Changing this property will impact all vertices being rendered by this Mesh. + * The y velocity of this Particle. * - * @name Phaser.GameObjects.Mesh#modelScale - * @type {Phaser.Math.Vector3} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#velocityY + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.modelScale = new Vector3(1, 1, 1); + this.velocityY = 0; /** - * A Vector3 containing the 3D rotation of the vertices in this Mesh. - * - * The values should be given in radians, i.e. to rotate the vertices by 90 - * degrees you can use `modelRotation.x = Phaser.Math.DegToRad(90)`. - * - * Modifying the components of this property will allow you to rotate - * the vertices within the Mesh. This happens in the `preUpdate` phase, - * where each vertex is transformed using the view and projection matrices. - * - * Changing this property will impact all vertices being rendered by this Mesh. + * The x acceleration of this Particle. * - * @name Phaser.GameObjects.Mesh#modelRotation - * @type {Phaser.Math.Vector3} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#accelerationX + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.modelRotation = new Vector3(); + this.accelerationX = 0; /** - * An internal cache, used to compare position, rotation, scale and face data - * each frame, to avoid math calculations in `preUpdate`. - * - * Cache structure = position xyz | rotation xyz | scale xyz | face count | view | ortho + * The y acceleration of this Particle. * - * @name Phaser.GameObjects.Mesh#dirtyCache - * @type {number[]} - * @private - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#accelerationY + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.dirtyCache = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + this.accelerationY = 0; /** - * The transformation matrix for this Mesh. + * The maximum horizontal velocity this Particle can travel at. * - * @name Phaser.GameObjects.Mesh#transformMatrix - * @type {Phaser.Math.Matrix4} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#maxVelocityX + * @type {number} + * @default 10000 + * @since 3.0.0 */ - this.transformMatrix = new Matrix4(); + this.maxVelocityX = 10000; /** - * The view position for this Mesh. - * - * Use the methods`panX`, `panY` and `panZ` to adjust the view. + * The maximum vertical velocity this Particle can travel at. * - * @name Phaser.GameObjects.Mesh#viewPosition - * @type {Phaser.Math.Vector3} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#maxVelocityY + * @type {number} + * @default 10000 + * @since 3.0.0 */ - this.viewPosition = new Vector3(); + this.maxVelocityY = 10000; /** - * The view matrix for this Mesh. + * The bounciness, or restitution, of this Particle. * - * @name Phaser.GameObjects.Mesh#viewMatrix - * @type {Phaser.Math.Matrix4} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#bounce + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.viewMatrix = new Matrix4(); + this.bounce = 0; /** - * The projection matrix for this Mesh. - * - * Update it with the `setPerspective` or `setOrtho` methods. + * The horizontal scale of this Particle. * - * @name Phaser.GameObjects.Mesh#projectionMatrix - * @type {Phaser.Math.Matrix4} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#scaleX + * @type {number} + * @default 1 + * @since 3.0.0 */ - this.projectionMatrix = new Matrix4(); + this.scaleX = 1; /** - * How many faces were rendered by this Mesh Game Object in the last - * draw? This is reset in the `preUpdate` method and then incremented - * each time a face is drawn. Note that in multi-camera Scenes this - * value may exceed that found in `Mesh.getFaceCount` due to - * cameras drawing the same faces more than once. + * The vertical scale of this Particle. * - * @name Phaser.GameObjects.Mesh#totalRendered + * @name Phaser.GameObjects.Particles.Particle#scaleY * @type {number} - * @readonly - * @since 3.50.0 + * @default 1 + * @since 3.0.0 */ - this.totalRendered = 0; + this.scaleY = 1; /** - * Internal cache var for the total number of faces rendered this frame. - * - * See `totalRendered` instead for the actual value. + * The alpha value of this Particle. * - * @name Phaser.GameObjects.Mesh#totalFrame + * @name Phaser.GameObjects.Particles.Particle#alpha * @type {number} - * @private - * @since 3.50.0 + * @default 1 + * @since 3.0.0 */ - this.totalFrame = 0; + this.alpha = 1; /** - * By default, the Mesh will check to see if its model or view transform has - * changed each frame and only recalculate the vertex positions if they have. - * - * This avoids lots of additional math in the `preUpdate` step when not required. - * - * However, if you are performing per-Face or per-Vertex manipulation on this Mesh, - * such as tweening a Face, or moving it without moving the rest of the Mesh, - * then you may need to disable the dirty cache in order for the Mesh to re-render - * correctly. You can toggle this property to do that. Please note that leaving - * this set to `true` will cause the Mesh to recalculate the position of every single - * vertex in it, every single frame. So only really do this if you know you - * need it. + * The angle of this Particle in degrees. * - * @name Phaser.GameObjects.Mesh#ignoreDirtyCache - * @type {boolean} - * @since 3.50.0 + * @name Phaser.GameObjects.Particles.Particle#angle + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.ignoreDirtyCache = false; + this.angle = 0; - var renderer = scene.sys.renderer; + /** + * The angle of this Particle in radians. + * + * @name Phaser.GameObjects.Particles.Particle#rotation + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.rotation = 0; - this.setPosition(x, y); - this.setTexture(texture, frame); - this.setSize(renderer.width, renderer.height); - this.initPipeline(); + /** + * The tint applied to this Particle. + * + * @name Phaser.GameObjects.Particles.Particle#tint + * @type {number} + * @webglOnly + * @since 3.0.0 + */ + this.tint = 0xffffff; - this.setPerspective(renderer.width, renderer.height); + /** + * The lifespan of this Particle in ms. + * + * @name Phaser.GameObjects.Particles.Particle#life + * @type {number} + * @default 1000 + * @since 3.0.0 + */ + this.life = 1000; - if (vertices) - { - this.addVertices(vertices, uvs, indicies, containsZ, normals, colors, alphas); - } - }, + /** + * The current life of this Particle in ms. + * + * @name Phaser.GameObjects.Particles.Particle#lifeCurrent + * @type {number} + * @default 1000 + * @since 3.0.0 + */ + this.lifeCurrent = 1000; - // Overrides Game Object method - addedToScene: function () - { - this.scene.sys.updateList.add(this); - }, + /** + * The delay applied to this Particle upon emission, in ms. + * + * @name Phaser.GameObjects.Particles.Particle#delayCurrent + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.delayCurrent = 0; - // Overrides Game Object method - removedFromScene: function () - { - this.scene.sys.updateList.remove(this); - }, + /** + * The hold applied to this Particle before it expires, in ms. + * + * @name Phaser.GameObjects.Particles.Particle#holdCurrent + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.holdCurrent = 0; - /** - * Translates the view position of this Mesh on the x axis by the given amount. - * - * @method Phaser.GameObjects.Mesh#panX - * @since 3.50.0 - * - * @param {number} v - The amount to pan by. - */ - panX: function (v) - { - this.viewPosition.addScale(Vector3.LEFT, v); + /** + * The normalized lifespan T value, where 0 is the start and 1 is the end. + * + * @name Phaser.GameObjects.Particles.Particle#lifeT + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.lifeT = 0; - this.dirtyCache[10] = 1; + /** + * The data used by the ease equation. + * + * @name Phaser.GameObjects.Particles.Particle#data + * @type {object} + * @since 3.0.0 + */ + this.data = { + tint: { min: 0xffffff, max: 0xffffff }, + alpha: { min: 1, max: 1 }, + rotate: { min: 0, max: 0 }, + scaleX: { min: 1, max: 1 }, + scaleY: { min: 1, max: 1 }, + x: { min: 0, max: 0 }, + y: { min: 0, max: 0 }, + accelerationX: { min: 0, max: 0 }, + accelerationY: { min: 0, max: 0 }, + maxVelocityX: { min: 0, max: 0 }, + maxVelocityY: { min: 0, max: 0 }, + moveToX: { min: 0, max: 0 }, + moveToY: { min: 0, max: 0 }, + bounce: { min: 0, max: 0 } + }; - return this; - }, + /** + * Interal private value. + * + * @name Phaser.GameObjects.Particles.Particle#isCropped + * @type {boolean} + * @private + * @readonly + * @since 3.60.0 + */ + this.isCropped = false; - /** - * Translates the view position of this Mesh on the y axis by the given amount. - * - * @method Phaser.GameObjects.Mesh#panY - * @since 3.50.0 - * - * @param {number} v - The amount to pan by. - */ - panY: function (v) - { - this.viewPosition.y += Vector3.DOWN.y * v; + /** + * A reference to the Scene to which this Game Object belongs. + * + * Game Objects can only belong to one Scene. + * + * You should consider this property as being read-only. You cannot move a + * Game Object to another Scene by simply changing it. + * + * @name Phaser.GameObjects.Particles.Particle#scene + * @type {Phaser.Scene} + * @since 3.60.0 + */ + this.scene = emitter.scene; - this.dirtyCache[10] = 1; + /** + * The Animation State component of this Particle. + * + * This component provides features to apply animations to this Particle. + * It is responsible for playing, loading, queuing animations for later playback, + * mixing between animations and setting the current animation frame to this Particle. + * + * @name Phaser.GameObjects.Particles.Particle#anims + * @type {Phaser.Animations.AnimationState} + * @since 3.60.0 + */ + this.anims = new AnimationState(this); - return this; + /** + * A rectangle that holds the bounds of this Particle after a call to + * the `Particle.getBounds` method has been made. + * + * @name Phaser.GameObjects.Particles.Particle#bounds + * @type {Phaser.Geom.Rectangle} + * @since 3.60.0 + */ + this.bounds = new Rectangle(); }, /** - * Translates the view position of this Mesh on the z axis by the given amount. + * The Event Emitter proxy. * - * As the default `panZ` value is 0, vertices with `z=0` (the default) need special care or else they will not display as they are behind the camera. - * Consider using `mesh.panZ(mesh.height / (2 * Math.tan(Math.PI / 16)))`, which will interpret vertex geometry 1:1 with pixel geometry (or see `setOrtho`). + * Passes on all parameters to the `ParticleEmitter` to emit directly. * - * @method Phaser.GameObjects.Mesh#panZ - * @since 3.50.0 + * @method Phaser.GameObjects.Particles.Particle#emit + * @since 3.60.0 * - * @param {number} v - The amount to pan by. + * @param {(string|Symbol)} event - The event name. + * @param {any} [a1] - Optional argument 1. + * @param {any} [a2] - Optional argument 2. + * @param {any} [a3] - Optional argument 3. + * @param {any} [a4] - Optional argument 4. + * @param {any} [a5] - Optional argument 5. + * + * @return {boolean} `true` if the event had listeners, else `false`. */ - panZ: function (amount) + emit: function (event, a1, a2, a3, a4, a5) { - this.viewPosition.z += amount; - - this.dirtyCache[10] = 1; - - return this; + return this.emitter.emit(event, a1, a2, a3, a4, a5); }, /** - * Builds a new perspective projection matrix from the given values. - * - * These are also the initial projection matrix & parameters for `Mesh` (and see `panZ` for more discussion). - * - * See also `setOrtho`. + * Checks to see if this Particle is alive and updating. * - * @method Phaser.GameObjects.Mesh#setPerspective - * @since 3.50.0 + * @method Phaser.GameObjects.Particles.Particle#isAlive + * @since 3.0.0 * - * @param {number} width - The width of the projection matrix. Typically the same as the Mesh and/or Renderer. - * @param {number} height - The height of the projection matrix. Typically the same as the Mesh and/or Renderer. - * @param {number} [fov=45] - The field of view, in degrees. - * @param {number} [near=0.01] - The near value of the view. - * @param {number} [far=1000] - The far value of the view. + * @return {boolean} `true` if this Particle is alive and updating, otherwise `false`. */ - setPerspective: function (width, height, fov, near, far) + isAlive: function () { - if (fov === undefined) { fov = 45; } - if (near === undefined) { near = 0.01; } - if (far === undefined) { far = 1000; } - - this.projectionMatrix.perspective(DegToRad(fov), width / height, near, far); - - this.dirtyCache[10] = 1; - this.dirtyCache[11] = 0; - - return this; + return (this.lifeCurrent > 0); }, /** - * Builds a new orthographic projection matrix from the given values. - * - * If using this mode you will often need to set `Mesh.hideCCW` to `false` as well. - * - * By default, calling this method with no parameters will set the scaleX value to - * match the renderer's aspect ratio. If you would like to render vertex positions 1:1 - * to pixel positions, consider calling as `mesh.setOrtho(mesh.width, mesh.height)`. - * - * See also `setPerspective`. - * - * @method Phaser.GameObjects.Mesh#setOrtho - * @since 3.50.0 + * Kills this particle. This sets the `lifeCurrent` value to 0, which forces + * the Particle to be removed the next time its parent Emitter runs an update. * - * @param {number} [scaleX=1] - The default horizontal scale in relation to the Mesh / Renderer dimensions. - * @param {number} [scaleY=1] - The default vertical scale in relation to the Mesh / Renderer dimensions. - * @param {number} [near=-1000] - The near value of the view. - * @param {number} [far=1000] - The far value of the view. + * @method Phaser.GameObjects.Particles.Particle#kill + * @since 3.60.0 */ - setOrtho: function (scaleX, scaleY, near, far) + kill: function () { - if (scaleX === undefined) { scaleX = this.scene.sys.renderer.getAspectRatio(); } - if (scaleY === undefined) { scaleY = 1; } - if (near === undefined) { near = -1000; } - if (far === undefined) { far = 1000; } - - this.projectionMatrix.ortho(-scaleX, scaleX, -scaleY, scaleY, near, far); - - this.dirtyCache[10] = 1; - this.dirtyCache[11] = 1; - - return this; + this.lifeCurrent = 0; }, /** - * Iterates and destroys all current Faces in this Mesh, then resets the - * `faces` and `vertices` arrays. + * Sets the position of this particle to the given x/y coordinates. * - * @method Phaser.GameObjects.Mesh#clear - * @since 3.50.0 + * If the parameters are left undefined, it resets the particle back to 0x0. * - * @return {this} This Mesh Game Object. + * @method Phaser.GameObjects.Particles.Particle#setPosition + * @since 3.60.0 + * + * @param {number} [x=0] - The x coordinate to set this Particle to. + * @param {number} [y=0] - The y coordinate to set this Particle to. */ - clear: function () + setPosition: function (x, y) { - this.faces.forEach(function (face) - { - face.destroy(); - }); - - this.faces = []; - this.vertices = []; + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } - return this; + this.x = x; + this.y = y; }, /** - * This method will add the data from a triangulated Wavefront OBJ model file to this Mesh. - * - * The data should have been loaded via the OBJFile: - * - * ```javascript - * this.load.obj(key, url); - * ``` - * - * Then use the same `key` as the first parameter to this method. - * - * Multiple Mesh Game Objects can use the same model data without impacting on each other. - * - * Make sure your 3D package has triangulated the model data prior to exporting it. - * - * You can add multiple models to a single Mesh, although they will act as one when - * moved or rotated. You can scale the model data, should it be too small, or too large, to see. - * You can also offset the vertices of the model via the `x`, `y` and `z` parameters. + * Starts this Particle from the given coordinates. * - * @method Phaser.GameObjects.Mesh#addVerticesFromObj - * @since 3.50.0 + * @method Phaser.GameObjects.Particles.Particle#fire + * @since 3.0.0 * - * @param {string} key - The key of the model data in the OBJ Cache to add to this Mesh. - * @param {number} [scale=1] - An amount to scale the model data by. Use this if the model has exported too small, or large, to see. - * @param {number} [x=0] - Translate the model x position by this amount. - * @param {number} [y=0] - Translate the model y position by this amount. - * @param {number} [z=0] - Translate the model z position by this amount. - * @param {number} [rotateX=0] - Rotate the model on the x axis by this amount, in radians. - * @param {number} [rotateY=0] - Rotate the model on the y axis by this amount, in radians. - * @param {number} [rotateZ=0] - Rotate the model on the z axis by this amount, in radians. - * @param {boolean} [zIsUp=true] - Is the z axis up (true), or is y axis up (false)? + * @param {number} [x] - The x coordinate to launch this Particle from. + * @param {number} [y] - The y coordinate to launch this Particle from. * - * @return {this} This Mesh Game Object. + * @return {boolean} `true` if the Particle is alive, or `false` if it was spawned inside a DeathZone. */ - addVerticesFromObj: function (key, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp) + fire: function (x, y) { - var data = this.scene.sys.cache.obj.get(key); + var emitter = this.emitter; + var ops = emitter.ops; - if (data) + var anim = emitter.getAnim(); + + if (anim) { - GenerateObjVerts(data, this, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp); + this.anims.play(anim); + } + else + { + this.frame = emitter.getFrame(); + this.texture = this.frame.texture; } - return this; - }, - - /** - * Compare the depth of two Faces. - * - * @method Phaser.GameObjects.Mesh#sortByDepth - * @since 3.50.0 - * - * @param {Phaser.Geom.Mesh.Face} faceA - The first Face. - * @param {Phaser.Geom.Mesh.Face} faceB - The second Face. - * - * @return {number} The difference between the depths of each Face. - */ - sortByDepth: function (faceA, faceB) - { - return faceA.depth - faceB.depth; - }, - - /** - * Runs a depth sort across all Faces in this Mesh, comparing their averaged depth. - * - * This is called automatically if you use any of the `rotate` methods, but you can - * also invoke it to sort the Faces should you manually position them. - * - * @method Phaser.GameObjects.Mesh#depthSort - * @since 3.50.0 - * - * @return {this} This Mesh Game Object. - */ - depthSort: function () - { - StableSort(this.faces, this.sortByDepth); + if (!this.frame) + { + throw new Error('Particle has no texture frame'); + } - return this; - }, + // Updates particle.x and particle.y during this call + emitter.getEmitZone(this); - /** - * Adds a new Vertex into the vertices array of this Mesh. - * - * Just adding a vertex isn't enough to render it. You need to also - * make it part of a Face, with 3 Vertex instances per Face. - * - * @method Phaser.GameObjects.Mesh#addVertex - * @since 3.50.0 - * - * @param {number} x - The x position of the vertex. - * @param {number} y - The y position of the vertex. - * @param {number} z - The z position of the vertex. - * @param {number} u - The UV u coordinate of the vertex. - * @param {number} v - The UV v coordinate of the vertex. - * @param {number} [color=0xffffff] - The color value of the vertex. - * @param {number} [alpha=1] - The alpha value of the vertex. - * - * @return {this} This Mesh Game Object. - */ - addVertex: function (x, y, z, u, v, color, alpha) - { - var vert = new Vertex(x, y, z, u, v, color, alpha); + if (x === undefined) + { + this.x += ops.x.onEmit(this, 'x'); + } + else if (ops.x.steps > 0) + { + // EmitterOp is stepped but x was forced (follower?) so use it + this.x += x + ops.x.onEmit(this, 'x'); + } + else + { + this.x += x; + } - this.vertices.push(vert); + if (y === undefined) + { + this.y += ops.y.onEmit(this, 'y'); + } + else if (ops.y.steps > 0) + { + // EmitterOp is stepped but y was forced (follower?) so use it + this.y += y + ops.y.onEmit(this, 'y'); + } + else + { + this.y += y; + } - return vert; - }, + this.life = ops.lifespan.onEmit(this, 'lifespan'); + this.lifeCurrent = this.life; + this.lifeT = 0; - /** - * Adds a new Face into the faces array of this Mesh. - * - * A Face consists of references to 3 Vertex instances, which must be provided. - * - * @method Phaser.GameObjects.Mesh#addFace - * @since 3.50.0 - * - * @param {Phaser.Geom.Mesh.Vertex} vertex1 - The first vertex of the Face. - * @param {Phaser.Geom.Mesh.Vertex} vertex2 - The second vertex of the Face. - * @param {Phaser.Geom.Mesh.Vertex} vertex3 - The third vertex of the Face. - * - * @return {this} This Mesh Game Object. - */ - addFace: function (vertex1, vertex2, vertex3) - { - var face = new Face(vertex1, vertex2, vertex3); + this.delayCurrent = ops.delay.onEmit(this, 'delay'); + this.holdCurrent = ops.hold.onEmit(this, 'hold'); - this.faces.push(face); + this.scaleX = ops.scaleX.onEmit(this, 'scaleX'); + this.scaleY = (ops.scaleY.active) ? ops.scaleY.onEmit(this, 'scaleY') : this.scaleX; - this.dirtyCache[9] = -1; + this.angle = ops.rotate.onEmit(this, 'rotate'); - return face; - }, + this.rotation = DegToRad(this.angle); - /** - * Adds new vertices to this Mesh by parsing the given data. - * - * This method will take vertex data in one of two formats, based on the `containsZ` parameter. - * - * If your vertex data are `x`, `y` pairs, then `containsZ` should be `false` (this is the default, and will result in `z=0` for each vertex). - * - * If your vertex data is groups of `x`, `y` and `z` values, then the `containsZ` parameter must be true. - * - * The `uvs` parameter is a numeric array consisting of `u` and `v` pairs. - * - * The `normals` parameter is a numeric array consisting of `x`, `y` vertex normal values and, if `containsZ` is true, `z` values as well. - * - * The `indicies` parameter is an optional array that, if given, is an indexed list of vertices to be added. - * - * The `colors` parameter is an optional array, or single value, that if given sets the color of each vertex created. - * - * The `alphas` parameter is an optional array, or single value, that if given sets the alpha of each vertex created. - * - * When providing indexed data it is assumed that _all_ of the arrays are indexed, not just the vertices. - * - * The following example will create a 256 x 256 sized quad using an index array: - * - * ```javascript - * let mesh = new Mesh(this); // Assuming `this` is a scene! - * const vertices = [ - * -128, 128, - * 128, 128, - * -128, -128, - * 128, -128 - * ]; - * - * const uvs = [ - * 0, 1, - * 1, 1, - * 0, 0, - * 1, 0 - * ]; - * - * const indices = [ 0, 2, 1, 2, 3, 1 ]; - * - * mesh.addVertices(vertices, uvs, indicies); - * // Note: Otherwise the added points will be "behind" the camera! This value will project vertex `x` & `y` values 1:1 to pixel values. - * mesh.hideCCW = false; - * mesh.setOrtho(mesh.width, mesh.height); - * ``` - * - * If the data is not indexed, it's assumed that the arrays all contain sequential data. - * - * @method Phaser.GameObjects.Mesh#addVertices - * @since 3.50.0 - * - * @param {number[]} vertices - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. - * @param {number[]} uvs - The UVs pairs array. - * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. - * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? If not, it will be assumed `z=0`, see methods `panZ` or `setOrtho`. - * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. - * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. - * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. - * - * @return {this} This Mesh Game Object. - */ - addVertices: function (vertices, uvs, indicies, containsZ, normals, colors, alphas) - { - var result = GenerateVerts(vertices, uvs, indicies, containsZ, normals, colors, alphas); + emitter.worldMatrix.transformPoint(this.x, this.y, this.worldPosition); - if (result) + // Check we didn't spawn in the middle of a DeathZone + if (this.delayCurrent === 0 && emitter.getDeathZone(this)) { - this.faces = this.faces.concat(result.faces); - this.vertices = this.vertices.concat(result.vertices); + this.lifeCurrent = 0; + + return false; } - this.dirtyCache[9] = -1; + var sx = ops.speedX.onEmit(this, 'speedX'); + var sy = (ops.speedY.active) ? ops.speedY.onEmit(this, 'speedY') : sx; - return this; - }, + if (emitter.radial) + { + var rad = DegToRad(ops.angle.onEmit(this, 'angle')); - /** - * Returns the total number of Faces in this Mesh Game Object. - * - * @method Phaser.GameObjects.Mesh#getFaceCount - * @since 3.50.0 - * - * @return {number} The number of Faces in this Mesh Game Object. - */ - getFaceCount: function () - { - return this.faces.length; - }, + this.velocityX = Math.cos(rad) * Math.abs(sx); + this.velocityY = Math.sin(rad) * Math.abs(sy); + } + else if (emitter.moveTo) + { + var mx = ops.moveToX.onEmit(this, 'moveToX'); + var my = ops.moveToY.onEmit(this, 'moveToY'); + var lifeS = this.life / 1000; - /** - * Returns the total number of Vertices in this Mesh Game Object. - * - * @method Phaser.GameObjects.Mesh#getVertexCount - * @since 3.50.0 - * - * @return {number} The number of Vertices in this Mesh Game Object. - */ - getVertexCount: function () - { - return this.vertices.length; - }, + this.velocityX = (mx - this.x) / lifeS; + this.velocityY = (my - this.y) / lifeS; + } + else + { + this.velocityX = sx; + this.velocityY = sy; + } - /** - * Returns the Face at the given index in this Mesh Game Object. - * - * @method Phaser.GameObjects.Mesh#getFace - * @since 3.50.0 - * - * @param {number} index - The index of the Face to get. - * - * @return {Phaser.Geom.Mesh.Face} The Face at the given index, or `undefined` if index out of range. - */ - getFace: function (index) - { - return this.faces[index]; - }, + if (emitter.acceleration) + { + this.accelerationX = ops.accelerationX.onEmit(this, 'accelerationX'); + this.accelerationY = ops.accelerationY.onEmit(this, 'accelerationY'); + } - /** - * Return an array of Face objects from this Mesh that intersect with the given coordinates. - * - * The given position is translated through the matrix of this Mesh and the given Camera, - * before being compared against the vertices. - * - * If more than one Face intersects, they will all be returned in the array, but the array will - * be depth sorted first, so the first element will always be that closest to the camera. - * - * @method Phaser.GameObjects.Mesh#getFaceAt - * @since 3.50.0 - * - * @param {number} x - The x position to check against. - * @param {number} y - The y position to check against. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The camera to pass the coordinates through. If not give, the default Scene Camera is used. - * - * @return {Phaser.Geom.Mesh.Face[]} An array of Face objects that intersect with the given point, ordered by depth. - */ - getFaceAt: function (x, y, camera) - { - if (camera === undefined) { camera = this.scene.sys.cameras.main; } + this.maxVelocityX = ops.maxVelocityX.onEmit(this, 'maxVelocityX'); + this.maxVelocityY = ops.maxVelocityY.onEmit(this, 'maxVelocityY'); - var calcMatrix = GetCalcMatrix(this, camera).calc; + this.bounce = ops.bounce.onEmit(this, 'bounce'); - var faces = this.faces; - var results = []; + this.alpha = ops.alpha.onEmit(this, 'alpha'); - for (var i = 0; i < faces.length; i++) + if (ops.color.active) { - var face = faces[i]; - - if (face.contains(x, y, calcMatrix)) - { - results.push(face); - } + this.tint = ops.color.onEmit(this, 'tint'); + } + else + { + this.tint = ops.tint.onEmit(this, 'tint'); } - return StableSort(results, this.sortByDepth); + return true; }, /** - * This method enables rendering of the Mesh vertices to the given Graphics instance. - * - * If you enable this feature, you **must** call `Graphics.clear()` in your Scene `update`, - * otherwise the Graphics instance you provide to debug will fill-up with draw calls, - * eventually crashing the browser. This is not done automatically to allow you to debug - * draw multiple Mesh objects to a single Graphics instance. - * - * The Mesh class has a built-in debug rendering callback `Mesh.renderDebug`, however - * you can also provide your own callback to be used instead. Do this by setting the `callback` parameter. - * - * The callback is invoked _once per render_ and sent the following parameters: - * - * `callback(src, faces)` - * - * `src` is the Mesh instance being debugged. - * `faces` is an array of the Faces that were rendered. - * - * You can get the final drawn vertex position from a Face object like this: - * - * ```javascript - * let face = faces[i]; - * - * let x0 = face.vertex1.tx; - * let y0 = face.vertex1.ty; - * let x1 = face.vertex2.tx; - * let y1 = face.vertex2.ty; - * let x2 = face.vertex3.tx; - * let y2 = face.vertex3.ty; - * - * graphic.strokeTriangle(x0, y0, x1, y1, x2, y2); - * ``` - * - * If using your own callback you do not have to provide a Graphics instance to this method. + * The main update method for this Particle. * - * To disable debug rendering, to either your own callback or the built-in one, call this method - * with no arguments. + * Updates its life values, computes the velocity and repositions the Particle. * - * @method Phaser.GameObjects.Mesh#setDebug - * @since 3.50.0 + * @method Phaser.GameObjects.Particles.Particle#update + * @since 3.0.0 * - * @param {Phaser.GameObjects.Graphics} [graphic] - The Graphic instance to render to if using the built-in callback. - * @param {function} [callback] - The callback to invoke during debug render. Leave as undefined to use the built-in callback. + * @param {number} delta - The delta time in ms. + * @param {number} step - The delta value divided by 1000. + * @param {Phaser.GameObjects.Particles.ParticleProcessor[]} processors - An array of all active Particle Processors. * - * @return {this} This Game Object instance. + * @return {boolean} Returns `true` if this Particle has now expired and should be removed, otherwise `false` if still active. */ - setDebug: function (graphic, callback) + update: function (delta, step, processors) { - this.debugGraphic = graphic; - - if (!graphic && !callback) + if (this.lifeCurrent <= 0) { - this.debugCallback = null; - } - else if (!callback) - { - this.debugCallback = this.renderDebug; + // Particle is dead via `Particle.kill` method, or being held + if (this.holdCurrent > 0) + { + this.holdCurrent -= delta; + + return (this.holdCurrent <= 0); + } + else + { + return true; + } } - else + + if (this.delayCurrent > 0) { - this.debugCallback = callback; + this.delayCurrent -= delta; + + return false; } - return this; - }, + this.anims.update(0, delta); - /** - * Checks if the transformation data in this mesh is dirty. - * - * This is used internally by the `preUpdate` step to determine if the vertices should - * be recalculated or not. - * - * @method Phaser.GameObjects.Mesh#isDirty - * @since 3.50.0 - * - * @return {boolean} Returns `true` if the data of this mesh is dirty, otherwise `false`. - */ - isDirty: function () - { - var position = this.modelPosition; - var rotation = this.modelRotation; - var scale = this.modelScale; - var dirtyCache = this.dirtyCache; + var emitter = this.emitter; + var ops = emitter.ops; - var px = position.x; - var py = position.y; - var pz = position.z; + // How far along in life is this particle? (t = 0 to 1) + var t = 1 - (this.lifeCurrent / this.life); - var rx = rotation.x; - var ry = rotation.y; - var rz = rotation.z; + this.lifeT = t; - var sx = scale.x; - var sy = scale.y; - var sz = scale.z; + this.x = ops.x.onUpdate(this, 'x', t, this.x); + this.y = ops.y.onUpdate(this, 'y', t, this.y); - var faces = this.getFaceCount(); + if (emitter.moveTo) + { + var mx = ops.moveToX.onUpdate(this, 'moveToX', t, emitter.moveToX); + var my = ops.moveToY.onUpdate(this, 'moveToY', t, emitter.moveToY); + var lifeS = this.lifeCurrent / 1000; - var pxCached = dirtyCache[0]; - var pyCached = dirtyCache[1]; - var pzCached = dirtyCache[2]; + this.velocityX = (mx - this.x) / lifeS; + this.velocityY = (my - this.y) / lifeS; + } - var rxCached = dirtyCache[3]; - var ryCached = dirtyCache[4]; - var rzCached = dirtyCache[5]; + this.computeVelocity(emitter, delta, step, processors, t); - var sxCached = dirtyCache[6]; - var syCached = dirtyCache[7]; - var szCached = dirtyCache[8]; + this.scaleX = ops.scaleX.onUpdate(this, 'scaleX', t, this.scaleX); + this.scaleY = this.scaleX; - var fCached = dirtyCache[9]; + if (ops.scaleY.active) + { + this.scaleY = ops.scaleY.onUpdate(this, 'scaleY', t, this.scaleY); + } - dirtyCache[0] = px; - dirtyCache[1] = py; - dirtyCache[2] = pz; + this.angle = ops.rotate.onUpdate(this, 'rotate', t, this.angle); - dirtyCache[3] = rx; - dirtyCache[4] = ry; - dirtyCache[5] = rz; + this.rotation = DegToRad(this.angle); - dirtyCache[6] = sx; - dirtyCache[7] = sy; - dirtyCache[8] = sz; + if (emitter.getDeathZone(this)) + { + this.lifeCurrent = 0; - dirtyCache[9] = faces; + // No need to go any further, particle has been killed + return true; + } - return ( - pxCached !== px || pyCached !== py || pzCached !== pz || - rxCached !== rx || ryCached !== ry || rzCached !== rz || - sxCached !== sx || syCached !== sy || szCached !== sz || - fCached !== faces - ); + this.alpha = ops.alpha.onUpdate(this, 'alpha', t, this.alpha); + + if (ops.color.active) + { + this.tint = ops.color.onUpdate(this, 'color', t, this.tint); + } + else + { + this.tint = ops.tint.onUpdate(this, 'tint', t, this.tint); + } + + this.lifeCurrent -= delta; + + return (this.lifeCurrent <= 0 && this.holdCurrent <= 0); }, /** - * The Mesh update loop. The following takes place in this method: - * - * First, the `totalRendered` and `totalFrame` properties are set. - * - * If the view matrix of this Mesh isn't dirty, and the model position, rotate or scale properties are - * all clean, then the method returns at this point. - * - * Otherwise, if the viewPosition is dirty (i.e. from calling a method like `panZ`), then it will - * refresh the viewMatrix. - * - * After this, a new transformMatrix is built and it then iterates through all Faces in this - * Mesh, calling `transformCoordinatesLocal` on all of them. Internally, this updates every - * vertex, calculating its new transformed position, based on the new transform matrix. - * - * Finally, the faces are depth sorted. + * An internal method that calculates the velocity of the Particle and + * its world position. It also runs it against any active Processors + * that are set on the Emitter. * - * @method Phaser.GameObjects.Mesh#preUpdate - * @protected - * @since 3.50.0 + * @method Phaser.GameObjects.Particles.Particle#computeVelocity + * @since 3.0.0 * - * @param {number} time - The current timestamp. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The Emitter that is updating this Particle. + * @param {number} delta - The delta time in ms. + * @param {number} step - The delta value divided by 1000. + * @param {Phaser.GameObjects.Particles.ParticleProcessor[]} processors - An array of all active Particle Processors. + * @param {number} t - The current normalized lifetime of the particle, between 0 (birth) and 1 (death). */ - preUpdate: function () + computeVelocity: function (emitter, delta, step, processors, t) { - this.totalRendered = this.totalFrame; - this.totalFrame = 0; - - var dirty = this.dirtyCache; + var ops = emitter.ops; - if (!this.ignoreDirtyCache && !dirty[10] && !this.isDirty()) - { - // If neither the view or the mesh is dirty we can bail out and save lots of math - return; - } + var vx = this.velocityX; + var vy = this.velocityY; - var width = this.width; - var height = this.height; + var ax = ops.accelerationX.onUpdate(this, 'accelerationX', t, this.accelerationX); + var ay = ops.accelerationY.onUpdate(this, 'accelerationY', t, this.accelerationY); - var viewMatrix = this.viewMatrix; - var viewPosition = this.viewPosition; + var mx = ops.maxVelocityX.onUpdate(this, 'maxVelocityX', t, this.maxVelocityX); + var my = ops.maxVelocityY.onUpdate(this, 'maxVelocityY', t, this.maxVelocityY); - if (dirty[10]) - { - viewMatrix.identity(); - viewMatrix.translate(viewPosition); - viewMatrix.invert(); + this.bounce = ops.bounce.onUpdate(this, 'bounce', t, this.bounce); - dirty[10] = 0; - } + vx += (emitter.gravityX * step) + (ax * step); + vy += (emitter.gravityY * step) + (ay * step); - var transformMatrix = this.transformMatrix; + vx = Clamp(vx, -mx, mx); + vy = Clamp(vy, -my, my); - transformMatrix.setWorldMatrix( - this.modelRotation, - this.modelPosition, - this.modelScale, - this.viewMatrix, - this.projectionMatrix - ); + this.velocityX = vx; + this.velocityY = vy; - var z = viewPosition.z; + // Integrate back in to the position + this.x += vx * step; + this.y += vy * step; - var faces = this.faces; + emitter.worldMatrix.transformPoint(this.x, this.y, this.worldPosition); - for (var i = 0; i < faces.length; i++) + // Apply any additional processors (these can update velocity and/or position) + for (var i = 0; i < processors.length; i++) { - faces[i].transformCoordinatesLocal(transformMatrix, width, height, z); + var processor = processors[i]; + + if (processor.active) + { + processor.update(this, delta, step, t); + } } + }, - this.depthSort(); + /** + * This is a NOOP method and does nothing when called. + * + * @method Phaser.GameObjects.Particles.Particle#setSizeToFrame + * @since 3.60.0 + */ + setSizeToFrame: function () + { + // NOOP }, /** - * The built-in Mesh debug rendering method. + * Gets the bounds of this particle as a Geometry Rectangle, factoring in any + * transforms of the parent emitter and anything else above it in the display list. * - * See `Mesh.setDebug` for more details. + * Once calculated the bounds can be accessed via the `Particle.bounds` property. * - * @method Phaser.GameObjects.Mesh#renderDebug - * @since 3.50.0 + * @method Phaser.GameObjects.Particles.Particle#getBounds + * @since 3.60.0 * - * @param {Phaser.GameObjects.Mesh} src - The Mesh object being rendered. - * @param {Phaser.Geom.Mesh.Face[]} faces - An array of Faces. + * @param {Phaser.GameObjects.Components.TransformMatrix} [matrix] - Optional transform matrix to apply to this particle. + * + * @return {Phaser.Geom.Rectangle} A Rectangle containing the transformed bounds of this particle. */ - renderDebug: function (src, faces) + getBounds: function (matrix) { - var graphic = src.debugGraphic; + if (matrix === undefined) { matrix = this.emitter.getWorldTransformMatrix(); } - for (var i = 0; i < faces.length; i++) - { - var face = faces[i]; + var sx = Math.abs(matrix.scaleX) * this.scaleX; + var sy = Math.abs(matrix.scaleY) * this.scaleY; - var x0 = face.vertex1.tx; - var y0 = face.vertex1.ty; - var x1 = face.vertex2.tx; - var y1 = face.vertex2.ty; - var x2 = face.vertex3.tx; - var y2 = face.vertex3.ty; + var x = this.x; + var y = this.y; + var rotation = this.rotation; + var width = (this.frame.width * sx) / 2; + var height = (this.frame.height * sy) / 2; - graphic.strokeTriangle(x0, y0, x1, y1, x2, y2); + var bounds = this.bounds; + + var topLeft = new Vector2(x - width, y - height); + var topRight = new Vector2(x + width, y - height); + var bottomLeft = new Vector2(x - width, y + height); + var bottomRight = new Vector2(x + width, y + height); + + if (rotation !== 0) + { + RotateAround(topLeft, x, y, rotation); + RotateAround(topRight, x, y, rotation); + RotateAround(bottomLeft, x, y, rotation); + RotateAround(bottomRight, x, y, rotation); } + + matrix.transformPoint(topLeft.x, topLeft.y, topLeft); + matrix.transformPoint(topRight.x, topRight.y, topRight); + matrix.transformPoint(bottomLeft.x, bottomLeft.y, bottomLeft); + matrix.transformPoint(bottomRight.x, bottomRight.y, bottomRight); + + bounds.x = Math.min(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x); + bounds.y = Math.min(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y); + bounds.width = Math.max(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x) - bounds.x; + bounds.height = Math.max(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y) - bounds.y; + + return bounds; }, /** - * Handles the pre-destroy step for the Mesh, which removes the Animation component and typed arrays. + * Destroys this Particle. * - * @method Phaser.GameObjects.Mesh#preDestroy - * @private - * @since 3.50.0 + * @method Phaser.GameObjects.Particles.Particle#destroy + * @since 3.60.0 */ - preDestroy: function () + destroy: function () { - this.clear(); + this.anims.destroy(); - this.debugCallback = null; - this.debugGraphic = null; + this.anims = null; + this.emitter = null; + this.texture = null; + this.frame = null; + this.scene = null; } }); -module.exports = Mesh; +module.exports = Particle; /***/ }), -/* 231 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 73106: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var DistanceBetween = __webpack_require__(50); +var Class = __webpack_require__(56694); +var ParticleProcessor = __webpack_require__(30891); +var Rectangle = __webpack_require__(74118); /** - * Checks if two Circles intersect. + * @classdesc + * The Particle Bounds Processor. * - * @function Phaser.Geom.Intersects.CircleToCircle - * @since 3.0.0 + * Defines a rectangular region, in world space, within which particle movement + * is restrained. * - * @param {Phaser.Geom.Circle} circleA - The first Circle to check for intersection. - * @param {Phaser.Geom.Circle} circleB - The second Circle to check for intersection. + * Use the properties `collideLeft`, `collideRight`, `collideTop` and + * `collideBottom` to control if a particle will rebound off the sides + * of this boundary, or not. * - * @return {boolean} `true` if the two Circles intersect, otherwise `false`. - */ -var CircleToCircle = function (circleA, circleB) -{ - return (DistanceBetween(circleA.x, circleA.y, circleB.x, circleB.y) <= (circleA.radius + circleB.radius)); -}; - -module.exports = CircleToCircle; - - -/***/ }), -/* 232 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Florian Vazelle - * @author Geoffrey Glaive - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Point = __webpack_require__(4); -var LineToCircle = __webpack_require__(233); - -/** - * Checks for intersection between the line segment and circle, - * and returns the intersection points as a Point object array. + * This happens when the particles worldPosition x/y coordinate hits the boundary. * - * @function Phaser.Geom.Intersects.GetLineToCircle - * @since 3.0.0 + * The strength of the rebound is determined by the `Particle.bounce` property. * - * @param {Phaser.Geom.Line} line - The line segment to check. - * @param {Phaser.Geom.Circle} circle - The circle to check against the line. - * @param {array} [out] - An optional array in which to store the points of intersection. + * @class ParticleBounds + * @extends Phaser.GameObjects.Particles.ParticleProcessor + * @memberof Phaser.GameObjects.Particles + * @constructor + * @since 3.60.0 * - * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. + * @param {number} x - The x position (top-left) of the bounds, in world space. + * @param {number} y - The y position (top-left) of the bounds, in world space. + * @param {number} width - The width of the bounds. + * @param {number} height - The height of the bounds. + * @param {boolean} [collideLeft=true] - Whether particles interact with the left edge of the bounds. + * @param {boolean} [collideRight=true] - Whether particles interact with the right edge of the bounds. + * @param {boolean} [collideTop=true] - Whether particles interact with the top edge of the bounds. + * @param {boolean} [collideBottom=true] - Whether particles interact with the bottom edge of the bounds. */ -var GetLineToCircle = function (line, circle, out) -{ - if (out === undefined) { out = []; } +var ParticleBounds = new Class({ - if (LineToCircle(line, circle)) + Extends: ParticleProcessor, + + initialize: + + function ParticleBounds (x, y, width, height, collideLeft, collideRight, collideTop, collideBottom) { - var lx1 = line.x1; - var ly1 = line.y1; + if (collideLeft === undefined) { collideLeft = true; } + if (collideRight === undefined) { collideRight = true; } + if (collideTop === undefined) { collideTop = true; } + if (collideBottom === undefined) { collideBottom = true; } - var lx2 = line.x2; - var ly2 = line.y2; + ParticleProcessor.call(this, x, y, true); - var cx = circle.x; - var cy = circle.y; - var cr = circle.radius; + /** + * A rectangular boundary constraining particle movement. Use the Emitter properties `collideLeft`, + * `collideRight`, `collideTop` and `collideBottom` to control if a particle will rebound off + * the sides of this boundary, or not. This happens when the particles x/y coordinate hits + * the boundary. + * + * @name Phaser.GameObjects.Particles.ParticleBounds#bounds + * @type {Phaser.Geom.Rectangle} + * @since 3.60.0 + */ + this.bounds = new Rectangle(x, y, width, height); - var lDirX = lx2 - lx1; - var lDirY = ly2 - ly1; - var oDirX = lx1 - cx; - var oDirY = ly1 - cy; + /** + * Whether particles interact with the left edge of the emitter {@link Phaser.GameObjects.Particles.ParticleEmitter#bounds}. + * + * @name Phaser.GameObjects.Particles.ParticleBounds#collideLeft + * @type {boolean} + * @default true + * @since 3.60.0 + */ + this.collideLeft = collideLeft; - var coefficientA = lDirX * lDirX + lDirY * lDirY; - var coefficientB = 2 * (lDirX * oDirX + lDirY * oDirY); - var coefficientC = oDirX * oDirX + oDirY * oDirY - cr * cr; + /** + * Whether particles interact with the right edge of the emitter {@link Phaser.GameObjects.Particles.ParticleBounds#bounds}. + * + * @name Phaser.GameObjects.Particles.ParticleBounds#collideRight + * @type {boolean} + * @default true + * @since 3.60.0 + */ + this.collideRight = collideRight; - var lambda = (coefficientB * coefficientB) - (4 * coefficientA * coefficientC); + /** + * Whether particles interact with the top edge of the emitter {@link Phaser.GameObjects.Particles.ParticleBounds#bounds}. + * + * @name Phaser.GameObjects.Particles.ParticleBounds#collideTop + * @type {boolean} + * @default true + * @since 3.60.0 + */ + this.collideTop = collideTop; - var x, y; + /** + * Whether particles interact with the bottom edge of the emitter {@link Phaser.GameObjects.Particles.ParticleBounds#bounds}. + * + * @name Phaser.GameObjects.Particles.ParticleBounds#collideBottom + * @type {boolean} + * @default true + * @since 3.60.0 + */ + this.collideBottom = collideBottom; + }, - if (lambda === 0) + /** + * Takes a Particle and updates it against the bounds. + * + * @method Phaser.GameObjects.Particles.ParticleBounds#update + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The Particle to update. + */ + update: function (particle) + { + var bounds = this.bounds; + var bounce = -particle.bounce; + var pos = particle.worldPosition; + + if (pos.x < bounds.x && this.collideLeft) { - var root = -coefficientB / (2 * coefficientA); - x = lx1 + root * lDirX; - y = ly1 + root * lDirY; - if (root >= 0 && root <= 1) - { - out.push(new Point(x, y)); - } + particle.x += bounds.x - pos.x; + particle.velocityX *= bounce; } - else if (lambda > 0) + else if (pos.x > bounds.right && this.collideRight) { - var root1 = (-coefficientB - Math.sqrt(lambda)) / (2 * coefficientA); - x = lx1 + root1 * lDirX; - y = ly1 + root1 * lDirY; - if (root1 >= 0 && root1 <= 1) - { - out.push(new Point(x, y)); - } + particle.x -= pos.x - bounds.right; + particle.velocityX *= bounce; + } - var root2 = (-coefficientB + Math.sqrt(lambda)) / (2 * coefficientA); - x = lx1 + root2 * lDirX; - y = ly1 + root2 * lDirY; - if (root2 >= 0 && root2 <= 1) - { - out.push(new Point(x, y)); - } + if (pos.y < bounds.y && this.collideTop) + { + particle.y += bounds.y - pos.y; + particle.velocityY *= bounce; + } + else if (pos.y > bounds.bottom && this.collideBottom) + { + particle.y -= pos.y - bounds.bottom; + particle.velocityY *= bounce; } } - return out; -}; +}); -module.exports = GetLineToCircle; +module.exports = ParticleBounds; /***/ }), -/* 233 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 9216: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(66); -var Point = __webpack_require__(4); - -var tmp = new Point(); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var ComponentsToJSON = __webpack_require__(48129); +var CopyFrom = __webpack_require__(29538); +var DeathZone = __webpack_require__(69361); +var EdgeZone = __webpack_require__(54213); +var EmitterColorOp = __webpack_require__(19737); +var EmitterOp = __webpack_require__(93025); +var Events = __webpack_require__(40629); +var GameObject = __webpack_require__(89980); +var GetFastValue = __webpack_require__(72632); +var GetRandom = __webpack_require__(72861); +var GravityWell = __webpack_require__(87811); +var HasAny = __webpack_require__(53523); +var HasValue = __webpack_require__(19256); +var Inflate = __webpack_require__(7782); +var List = __webpack_require__(71207); +var MergeRect = __webpack_require__(14655); +var Particle = __webpack_require__(14909); +var RandomZone = __webpack_require__(68433); +var Rectangle = __webpack_require__(74118); +var RectangleToRectangle = __webpack_require__(90205); +var Remove = __webpack_require__(66458); +var Render = __webpack_require__(69116); +var StableSort = __webpack_require__(17922); +var TransformMatrix = __webpack_require__(69360); +var Vector2 = __webpack_require__(93736); +var Wrap = __webpack_require__(1071); +var ParticleBounds = __webpack_require__(73106); /** - * Checks for intersection between the line segment and circle. + * Names of simple configuration properties. * - * Based on code by [Matt DesLauriers](https://github.com/mattdesl/line-circle-collision/blob/master/LICENSE.md). - * - * @function Phaser.Geom.Intersects.LineToCircle - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The line segment to check. - * @param {Phaser.Geom.Circle} circle - The circle to check against the line. - * @param {(Phaser.Geom.Point|any)} [nearest] - An optional Point-like object. If given the closest point on the Line where the circle intersects will be stored in this object. - * - * @return {boolean} `true` if the two objects intersect, otherwise `false`. + * @ignore */ -var LineToCircle = function (line, circle, nearest) -{ - if (nearest === undefined) { nearest = tmp; } - - if (Contains(circle, line.x1, line.y1)) - { - nearest.x = line.x1; - nearest.y = line.y1; - - return true; - } - - if (Contains(circle, line.x2, line.y2)) - { - nearest.x = line.x2; - nearest.y = line.y2; - - return true; - } - - var dx = line.x2 - line.x1; - var dy = line.y2 - line.y1; - - var lcx = circle.x - line.x1; - var lcy = circle.y - line.y1; - - // project lc onto d, resulting in vector p - var dLen2 = (dx * dx) + (dy * dy); - var px = dx; - var py = dy; - - if (dLen2 > 0) - { - var dp = ((lcx * dx) + (lcy * dy)) / dLen2; - - px *= dp; - py *= dp; - } - - nearest.x = line.x1 + px; - nearest.y = line.y1 + py; - - // len2 of p - var pLen2 = (px * px) + (py * py); - - return ( - pLen2 <= dLen2 && - ((px * dx) + (py * dy)) >= 0 && - Contains(circle, nearest.x, nearest.y) - ); -}; - -module.exports = LineToCircle; - - -/***/ }), -/* 234 */ -/***/ (function(module, exports, __webpack_require__) { +var configFastMap = [ + 'active', + 'advance', + 'blendMode', + 'colorEase', + 'deathCallback', + 'deathCallbackScope', + 'duration', + 'emitCallback', + 'emitCallbackScope', + 'follow', + 'frequency', + 'gravityX', + 'gravityY', + 'maxAliveParticles', + 'maxParticles', + 'name', + 'emitting', + 'particleBringToTop', + 'particleClass', + 'radial', + 'sortCallback', + 'sortOrderAsc', + 'sortProperty', + 'stopAfter', + 'tintFill', + 'timeScale', + 'trackVisible', + 'visible' +]; /** - * @author Florian Vazelle - * @author Geoffrey Glaive - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Names of complex configuration properties. + * + * @ignore */ - -var Point = __webpack_require__(4); -var LineToLine = __webpack_require__(96); -var LineToRectangle = __webpack_require__(488); +var configOpMap = [ + 'accelerationX', + 'accelerationY', + 'alpha', + 'angle', + 'bounce', + 'color', + 'delay', + 'hold', + 'lifespan', + 'maxVelocityX', + 'maxVelocityY', + 'moveToX', + 'moveToY', + 'quantity', + 'rotate', + 'scaleX', + 'scaleY', + 'speedX', + 'speedY', + 'tint', + 'x', + 'y' +]; /** - * Checks for intersection between the Line and a Rectangle shape, - * and returns the intersection points as a Point object array. + * @classdesc + * A Particle Emitter is a special kind of Game Object that controls a pool of {@link Phaser.GameObjects.Particles.Particle Particles}. * - * @function Phaser.Geom.Intersects.GetLineToRectangle - * @since 3.0.0 + * Particle Emitters are created via a configuration object. The properties of this object + * can be specified in a variety of formats, given you plenty of scope over the values they + * return, leading to complex visual effects. Here are the different forms of configuration + * value you can give: * - * @param {Phaser.Geom.Line} line - The Line to check for intersection. - * @param {(Phaser.Geom.Rectangle|object)} rect - The Rectangle to check for intersection. - * @param {array} [out] - An optional array in which to store the points of intersection. + * ## An explicit static value: * - * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. - */ -var GetLineToRectangle = function (line, rect, out) -{ - if (out === undefined) { out = []; } - - if (LineToRectangle(line, rect)) - { - var lineA = rect.getLineA(); - var lineB = rect.getLineB(); - var lineC = rect.getLineC(); - var lineD = rect.getLineD(); - - var output = [ new Point(), new Point(), new Point(), new Point() ]; + * ```js + * x: 400 + * ``` + * + * The x value will always be 400 when the particle is spawned. + * + * ## A random value: + * + * ```js + * x: [ 100, 200, 300, 400 ] + * ``` + * + * The x value will be one of the 4 elements in the given array, picked at random on emission. + * + * ## A custom callback: + * + * ```js + * x: (particle, key, t, value) => { + * return value + 50; + * } + * ``` + * + * The x value is the result of calling this function. This is only used when the + * particle is emitted, so it provides it's initial starting value. It is not used + * when the particle is updated (see the onUpdate callback for that) + * + * ## A start / end object: + * + * This allows you to control the change in value between the given start and + * end parameters over the course of the particles lifetime: + * + * ```js + * scale: { start: 0, end: 1 } + * ``` + * + * The particle scale will start at 0 when emitted and ease to a scale of 1 + * over the course of its lifetime. You can also specify the ease function + * used for this change (the default is Linear): + * + * ```js + * scale: { start: 0, end: 1, ease: 'bounce.out' } + * ``` + * + * ## A start / end random object: + * + * The start and end object can have an optional `random` parameter. + * This forces it to pick a random value between the two values and use + * this as the starting value, then easing to the 'end' parameter over + * its lifetime. + * + * ```js + * scale: { start: 4, end: 0.5, random: true } + * ``` + * + * The particle will start with a random scale between 0.5 and 4 and then + * scale to the end value over its lifetime. You can combine the above + * with the `ease` parameter as well to control the value easing. + * + * ## An interpolation object: + * + * You can provide an array of values which will be used for interpolation + * during the particles lifetime. You can also define the interpolation + * function to be used. There are three provided: `linear` (the default), + * `bezier` and `catmull`, or you can provide your own function. + * + * ```js + * x: { values: [ 50, 500, 200, 800 ], interpolation: 'catmull' } + * ``` + * + * The particle scale will interpolate from 50 when emitted to 800 via the other + * points over the course of its lifetime. You can also specify an ease function + * used to control the rate of change through the values (the default is Linear): + * + * ```js + * x: { values: [ 50, 500, 200, 800 ], interpolation: 'catmull', ease: 'bounce.out } + * ``` + * + * ## A stepped emitter object: + * + * The `steps` parameter allows you to control the placement of sequential + * particles across the start-end range: + * + * ```js + * x: { steps: 32, start: 0, end: 576 } + * ``` + * + * Here we have a range of 576 (start to end). This is divided into 32 steps. + * + * The first particle will emit at the x position of 0. The next will emit + * at the next 'step' along, which would be 18. The following particle will emit + * at the next step, which is 36, and so on. Because the range of 576 has been + * divided by 32, creating 18 pixels steps. When a particle reaches the 'end' + * value the next one will start from the beginning again. + * + * ## A stepped emitter object with yoyo: + * + * You can add the optional `yoyo` property to a stepped object: + * + * ```js + * x: { steps: 32, start: 0, end: 576, yoyo: true } + * ``` + * + * As with the stepped emitter, particles are emitted in sequence, from 'start' + * to 'end' in step sized jumps. Normally, when a stepped emitter reaches the + * end it snaps around to the start value again. However, if you provide the 'yoyo' + * parameter then when it reaches the end it will reverse direction and start + * emitting back down to 'start' again. Depending on the effect you require this + * can often look better. + * + * ## A min / max object: + * + * This allows you to pick a random float value between the min and max properties: + * + * ```js + * x: { min: 100, max: 700 } + * ``` + * + * The x value will be a random float between min and max. + * + * You can force it select an integer by setting the 'int' flag: + * + * ```js + * x: { min: 100, max: 700, int: true } + * ``` + * + * Or, you could use the 'random' array approach (see below) + * + * ## A random object: + * + * This allows you to pick a random integer value between the first and second array elements: + * + * ```js + * x: { random: [ 100, 700 ] } + * ``` + * + * The x value will be a random integer between 100 and 700 as it takes the first + * element in the 'random' array as the 'min' value and the 2nd element as the 'max' value. + * + * ## Custom onEmit and onUpdate callbacks: + * + * If the above won't give you the effect you're after, you can provide your own + * callbacks that will be used when the particle is both emitted and updated: + * + * ```js + * x: { + * onEmit: (particle, key, t, value) => { + * return value; + * }, + * onUpdate: (particle, key, t, value) => { + * return value; + * } + * } + * ``` + * + * You can provide either one or both functions. The `onEmit` is called at the + * start of the particles life and defines the value of the property on birth. + * + * The `onUpdate` function is called every time the Particle Emitter updates + * until the particle dies. Both must return a value. + * + * The properties are: + * + * particle - A reference to the Particle instance. + * key - The string based key of the property, i.e. 'x' or 'lifespan'. + * t - The current normalized lifetime of the particle, between 0 (birth) and 1 (death). + * value - The current property value. At a minimum you should return this. + * + * By using the above configuration options you have an unlimited about of + * control over how your particles behave. + * + * ## v3.55 Differences + * + * Prior to v3.60 Phaser used a `ParticleEmitterManager`. This was removed in v3.60 + * and now calling `this.add.particles` returns a `ParticleEmitter` instance instead. + * + * In order to streamline memory and the display list we have removed the + * `ParticleEmitterManager` entirely. When you call `this.add.particles` you're now + * creating a `ParticleEmitter` instance, which is being added directly to the + * display list and can be manipulated just like any other Game Object, i.e. + * scaled, rotated, positioned, added to a Container, etc. It now extends the + * `GameObject` base class, meaning it's also an event emitter, which allowed us + * to create some handy new events for particles. + * + * So, to create an emitter, you now give it an xy coordinate, a texture and an + * emitter configuration object (you can also set this later, but most commonly + * you'd do it on creation). I.e.: + * + * ```js + * const emitter = this.add.particles(100, 300, 'flares', { + * frame: 'red', + * angle: { min: -30, max: 30 }, + * speed: 150 + * }); + * ``` + * + * This will create a 'red flare' emitter at 100 x 300. + * + * Please update your code to ensure it adheres to the new function signatures. + * + * @class ParticleEmitter + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects.Particles + * @constructor + * @since 3.60.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig} config - Settings for this emitter. + */ +var ParticleEmitter = new Class({ - var result = [ - LineToLine(lineA, line, output[0]), - LineToLine(lineB, line, output[1]), - LineToLine(lineC, line, output[2]), - LineToLine(lineD, line, output[3]) - ]; + Extends: GameObject, - for (var i = 0; i < 4; i++) - { - if (result[i]) { out.push(output[i]); } - } - } + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.Mask, + Components.Pipeline, + Components.PostPipeline, + Components.ScrollFactor, + Components.Texture, + Components.Transform, + Components.Visible, + Render + ], - return out; -}; + initialize: -module.exports = GetLineToRectangle; + function ParticleEmitter (scene, x, y, texture, config) + { + GameObject.call(this, scene, 'ParticleEmitter'); + /** + * The Particle Class which will be emitted by this Emitter. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#particleClass + * @type {function} + * @default Phaser.GameObjects.Particles.Particle + * @since 3.0.0 + * @see Phaser.Types.GameObjects.Particles.ParticleClassConstructor + */ + this.particleClass = Particle; -/***/ }), -/* 235 */ -/***/ (function(module, exports) { + /** + * An internal object holding all of the EmitterOp instances. + * + * These are populated as part of the Emitter configuration parsing. + * + * You typically do not access them directly, but instead use the + * provided getters and setters on this class, such as `ParticleEmitter.speedX` etc. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#ops + * @type {Phaser.Types.GameObjects.Particles.ParticleEmitterOps} + * @since 3.60.0 + */ + this.ops = { + accelerationX: new EmitterOp('accelerationX', 0), + accelerationY: new EmitterOp('accelerationY', 0), + alpha: new EmitterOp('alpha', 1), + angle: new EmitterOp('angle', { min: 0, max: 360 }, true), + bounce: new EmitterOp('bounce', 0), + color: new EmitterColorOp('color'), + delay: new EmitterOp('delay', 0, true), + hold: new EmitterOp('hold', 0, true), + lifespan: new EmitterOp('lifespan', 1000, true), + maxVelocityX: new EmitterOp('maxVelocityX', 10000), + maxVelocityY: new EmitterOp('maxVelocityY', 10000), + moveToX: new EmitterOp('moveToX', 0), + moveToY: new EmitterOp('moveToY', 0), + quantity: new EmitterOp('quantity', 1, true), + rotate: new EmitterOp('rotate', 0), + scaleX: new EmitterOp('scaleX', 1), + scaleY: new EmitterOp('scaleY', 1), + speedX: new EmitterOp('speedX', 0, true), + speedY: new EmitterOp('speedY', 0, true), + tint: new EmitterOp('tint', 0xffffff), + x: new EmitterOp('x', 0), + y: new EmitterOp('y', 0) + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A radial emitter will emit particles in all directions between angle min and max, + * using {@link Phaser.GameObjects.Particles.ParticleEmitter#speed} as the value. If set to false then this acts as a point Emitter. + * A point emitter will emit particles only in the direction derived from the speedX and speedY values. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#radial + * @type {boolean} + * @default true + * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setRadial + */ + this.radial = true; -// http://www.blackpawn.com/texts/pointinpoly/ + /** + * Horizontal acceleration applied to emitted particles, in pixels per second squared. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#gravityX + * @type {number} + * @default 0 + * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setGravity + */ + this.gravityX = 0; -// points is an array of Point-like objects with public x/y properties -// returns an array containing all points that are within the triangle, or an empty array if none -// if 'returnFirst' is true it will return after the first point within the triangle is found + /** + * Vertical acceleration applied to emitted particles, in pixels per second squared. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#gravityY + * @type {number} + * @default 0 + * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setGravity + */ + this.gravityY = 0; -/** - * Filters an array of point-like objects to only those contained within a triangle. - * If `returnFirst` is true, will return an array containing only the first point in the provided array that is within the triangle (or an empty array if there are no such points). - * - * @function Phaser.Geom.Triangle.ContainsArray - * @since 3.0.0 - * - * @param {Phaser.Geom.Triangle} triangle - The triangle that the points are being checked in. - * @param {Phaser.Geom.Point[]} points - An array of point-like objects (objects that have an `x` and `y` property) - * @param {boolean} [returnFirst=false] - If `true`, return an array containing only the first point found that is within the triangle. - * @param {array} [out] - If provided, the points that are within the triangle will be appended to this array instead of being added to a new array. If `returnFirst` is true, only the first point found within the triangle will be appended. This array will also be returned by this function. - * - * @return {Phaser.Geom.Point[]} An array containing all the points from `points` that are within the triangle, if an array was provided as `out`, points will be appended to that array and it will also be returned here. - */ -var ContainsArray = function (triangle, points, returnFirst, out) -{ - if (returnFirst === undefined) { returnFirst = false; } - if (out === undefined) { out = []; } + /** + * Whether accelerationX and accelerationY are non-zero. Set automatically during configuration. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#acceleration + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.acceleration = false; - var v0x = triangle.x3 - triangle.x1; - var v0y = triangle.y3 - triangle.y1; + /** + * Whether moveToX and moveToY are set. Set automatically during configuration. + * + * When true the particles move toward the moveToX and moveToY coordinates and arrive at the end of their life. + * Emitter angle, speedX, and speedY are ignored. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#moveTo + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.moveTo = false; - var v1x = triangle.x2 - triangle.x1; - var v1y = triangle.y2 - triangle.y1; + /** + * A function to call when a particle is emitted. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallback + * @type {?Phaser.Types.GameObjects.Particles.ParticleEmitterCallback} + * @default null + * @since 3.0.0 + */ + this.emitCallback = null; - var dot00 = (v0x * v0x) + (v0y * v0y); - var dot01 = (v0x * v1x) + (v0y * v1y); - var dot11 = (v1x * v1x) + (v1y * v1y); + /** + * The calling context for {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallback}. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope + * @type {?*} + * @default null + * @since 3.0.0 + */ + this.emitCallbackScope = null; - // Compute barycentric coordinates - var b = ((dot00 * dot11) - (dot01 * dot01)); - var inv = (b === 0) ? 0 : (1 / b); + /** + * A function to call when a particle dies. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallback + * @type {?Phaser.Types.GameObjects.Particles.ParticleDeathCallback} + * @default null + * @since 3.0.0 + */ + this.deathCallback = null; - var u; - var v; - var v2x; - var v2y; - var dot02; - var dot12; + /** + * The calling context for {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallback}. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope + * @type {?*} + * @default null + * @since 3.0.0 + */ + this.deathCallbackScope = null; - var x1 = triangle.x1; - var y1 = triangle.y1; + /** + * Set to hard limit the amount of particle objects this emitter is allowed to create + * in total. This is the number of `Particle` instances it can create, not the number + * of 'alive' particles. + * + * 0 means unlimited. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#maxParticles + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.maxParticles = 0; - for (var i = 0; i < points.length; i++) - { - v2x = points[i].x - x1; - v2y = points[i].y - y1; + /** + * The maximum number of alive and rendering particles this emitter will update. + * When this limit is reached, a particle needs to die before another can be emitted. + * + * 0 means no limits. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#maxAliveParticles + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.maxAliveParticles = 0; - dot02 = (v0x * v2x) + (v0y * v2y); - dot12 = (v1x * v2x) + (v1y * v2y); + /** + * If set, either via the Emitter config, or by directly setting this property, + * the Particle Emitter will stop emitting particles once this total has been + * reached. It will then enter a 'stopped' state, firing the `STOP` + * event. Note that entering a stopped state doesn't mean all the particles + * have finished, just that it's not emitting any further ones. + * + * To know when the final particle expires, listen for the COMPLETE event. + * + * Use this if you wish to launch an exact number of particles and then stop + * your emitter afterwards. + * + * The counter is reset each time the `ParticleEmitter.start` method is called. + * + * 0 means the emitter will not stop based on total emitted particles. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#stopAfter + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.stopAfter = 0; - u = ((dot11 * dot02) - (dot01 * dot12)) * inv; - v = ((dot00 * dot12) - (dot01 * dot02)) * inv; - - if (u >= 0 && v >= 0 && (u + v < 1)) - { - out.push({ x: points[i].x, y: points[i].y }); + /** + * The number of milliseconds this emitter will emit particles for when in flow mode, + * before it stops emission. A value of 0 (the default) means there is no duration. + * + * When the duration expires the `STOP` event is emitted. Note that entering a + * stopped state doesn't mean all the particles have finished, just that it's + * not emitting any further ones. + * + * To know when the final particle expires, listen for the COMPLETE event. + * + * The counter is reset each time the `ParticleEmitter.start` method is called. + * + * 0 means the emitter will not stop based on duration. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#duration + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.duration = 0; - if (returnFirst) - { - break; - } - } - } + /** + * For a flow emitter, the time interval (>= 0) between particle flow cycles in ms. + * A value of 0 means there is one particle flow cycle for each logic update (the maximum flow frequency). This is the default setting. + * For an exploding emitter, this value will be -1. + * Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#flow} also puts the emitter in flow mode (frequency >= 0). + * Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} also puts the emitter in explode mode (frequency = -1). + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#frequency + * @type {number} + * @default 0 + * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrequency + */ + this.frequency = 0; - return out; -}; + /** + * Controls if the emitter is currently emitting a particle flow (when frequency >= 0). + * + * Already alive particles will continue to update until they expire. + * + * Controlled by {@link Phaser.GameObjects.Particles.ParticleEmitter#start} and {@link Phaser.GameObjects.Particles.ParticleEmitter#stop}. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#emitting + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.emitting = true; -module.exports = ContainsArray; + /** + * Newly emitted particles are added to the top of the particle list, i.e. rendered above those already alive. + * + * Set to false to send them to the back. + * + * Also see the `sortOrder` property for more complex particle sorting. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#particleBringToTop + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.particleBringToTop = true; + /** + * The time rate applied to active particles, affecting lifespan, movement, and tweens. Values larger than 1 are faster than normal. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#timeScale + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.timeScale = 1; -/***/ }), -/* 236 */ -/***/ (function(module, exports) { + /** + * An array containing Particle Emission Zones. These can be either EdgeZones or RandomZones. + * + * Particles are emitted from a randomly selected zone from this array. + * + * Prior to Phaser v3.60 an Emitter could only have one single Emission Zone. + * In 3.60 they can now have an array of Emission Zones. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#emitZones + * @type {Phaser.GameObjects.Particles.Zones.EdgeZone[]|Phaser.GameObjects.Particles.Zones.RandomZone[]} + * @since 3.60.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone + */ + this.emitZones = []; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * An array containing Particle Death Zone objects. A particle is immediately killed as soon as its x/y coordinates + * intersect with any of the configured Death Zones. + * + * Prior to Phaser v3.60 an Emitter could only have one single Death Zone. + * In 3.60 they can now have an array of Death Zones. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#deathZones + * @type {Phaser.GameObjects.Particles.Zones.DeathZone[]} + * @since 3.60.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setDeathZone + */ + this.deathZones = []; -/** - * Rotate a line around the given coordinates by the given angle in radians. - * - * @function Phaser.Geom.Line.RotateAroundXY - * @since 3.0.0 - * - * @generic {Phaser.Geom.Line} O - [line,$return] - * - * @param {Phaser.Geom.Line} line - The line to rotate. - * @param {number} x - The horizontal coordinate to rotate the line around. - * @param {number} y - The vertical coordinate to rotate the line around. - * @param {number} angle - The angle of rotation in radians. - * - * @return {Phaser.Geom.Line} The rotated line. - */ -var RotateAroundXY = function (line, x, y, angle) -{ - var c = Math.cos(angle); - var s = Math.sin(angle); + /** + * An optional Rectangle object that is used during rendering to cull Particles from + * display. For example, if your particles are limited to only move within a 300x300 + * sized area from their origin, then you can set this Rectangle to those dimensions. + * + * The renderer will check to see if the `viewBounds` Rectangle intersects with the + * Camera bounds during the render step and if not it will skip rendering the Emitter + * entirely. + * + * This allows you to create many emitters in a Scene without the cost of + * rendering if the contents aren't visible. + * + * Note that the Emitter will not perform any checks to see if the Particles themselves + * are outside of these bounds, or not. It will simply check the bounds against the + * camera. Use the `getBounds` method with the `advance` parameter to help define + * the location and placement of the view bounds. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#viewBounds + * @type {?Phaser.Geom.Rectangle} + * @default null + * @since 3.60.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setViewBounds + */ + this.viewBounds = null; - var tx = line.x1 - x; - var ty = line.y1 - y; + /** + * A Game Object whose position is used as the particle origin. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#follow + * @type {?Phaser.GameObjects.GameObject} + * @default null + * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#startFollow + * @see Phaser.GameObjects.Particles.ParticleEmitter#stopFollow + */ + this.follow = null; - line.x1 = tx * c - ty * s + x; - line.y1 = tx * s + ty * c + y; + /** + * The offset of the particle origin from the {@link Phaser.GameObjects.Particles.ParticleEmitter#follow} target. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#followOffset + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#startFollow + */ + this.followOffset = new Vector2(); - tx = line.x2 - x; - ty = line.y2 - y; + /** + * Whether the emitter's {@link Phaser.GameObjects.Particles.ParticleEmitter#visible} state will track + * the {@link Phaser.GameObjects.Particles.ParticleEmitter#follow} target's visibility state. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#trackVisible + * @type {boolean} + * @default false + * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#startFollow + */ + this.trackVisible = false; - line.x2 = tx * c - ty * s + x; - line.y2 = tx * s + ty * c + y; + /** + * The texture frames assigned to particles. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#frames + * @type {Phaser.Textures.Frame[]} + * @since 3.0.0 + */ + this.frames = []; - return line; -}; + /** + * Whether texture {@link Phaser.GameObjects.Particles.ParticleEmitter#frames} are selected at random. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#randomFrame + * @type {boolean} + * @default true + * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setEmitterFrame + */ + this.randomFrame = true; -module.exports = RotateAroundXY; + /** + * The number of consecutive particles that receive a single texture frame (per frame cycle). + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#frameQuantity + * @type {number} + * @default 1 + * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setEmitterFrame + */ + this.frameQuantity = 1; + /** + * The animations assigned to particles. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#anims + * @type {string[]} + * @since 3.60.0 + */ + this.anims = []; -/***/ }), -/* 237 */ -/***/ (function(module, exports) { + /** + * Whether animations {@link Phaser.GameObjects.Particles.ParticleEmitter#anims} are selected at random. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#randomAnim + * @type {boolean} + * @default true + * @since 3.60.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setAnim + */ + this.randomAnim = true; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The number of consecutive particles that receive a single animation (per frame cycle). + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#animQuantity + * @type {number} + * @default 1 + * @since 3.60.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setAnim + */ + this.animQuantity = 1; -/** - * Calculates the width/height ratio of a rectangle. - * - * @function Phaser.Geom.Rectangle.GetAspectRatio - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rect - The rectangle. - * - * @return {number} The width/height ratio of the rectangle. - */ -var GetAspectRatio = function (rect) -{ - return (rect.height === 0) ? NaN : rect.width / rect.height; -}; + /** + * An array containing all currently inactive Particle instances. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#dead + * @type {Phaser.GameObjects.Particles.Particle[]} + * @private + * @since 3.0.0 + */ + this.dead = []; -module.exports = GetAspectRatio; + /** + * An array containing all currently live and rendering Particle instances. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#alive + * @type {Phaser.GameObjects.Particles.Particle[]} + * @private + * @since 3.0.0 + */ + this.alive = []; + /** + * Internal array that holds counter data: + * + * 0 - flowCounter - The time until next flow cycle. + * 1 - frameCounter - Counts up to {@link Phaser.GameObjects.Particles.ParticleEmitter#frameQuantity}. + * 2 - animCounter - Counts up to animQuantity. + * 3 - elapsed - The time remaining until the `duration` limit is reached. + * 4 - stopCounter - The number of particles remaining until `stopAfter` limit is reached. + * 5 - completeFlag - Has the COMPLETE event been emitted? + * 6 - zoneIndex - The emit zone index counter. + * 7 - zoneTotal - The emit zone total counter. + * 8 - currentFrame - The current texture frame, as an index of {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. + * 9 - currentAnim - The current animation, as an index of {@link Phaser.GameObjects.Particles.ParticleEmitter#anims}. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#counters + * @type {Float32Array} + * @private + * @since 3.60.0 + */ + this.counters = new Float32Array(10); -/***/ }), -/* 238 */ -/***/ (function(module, exports) { + /** + * An internal property used to tell when the emitter is in fast-forwarc mode. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#skipping + * @type {boolean} + * @default true + * @since 3.60.0 + */ + this.skipping = false; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * An internal Transform Matrix used to cache this emitters world matrix. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#worldMatrix + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.60.0 + */ + this.worldMatrix = new TransformMatrix(); -/** - * Rotates an entire Triangle at a given angle about a specific point. - * - * @function Phaser.Geom.Triangle.RotateAroundXY - * @since 3.0.0 - * - * @generic {Phaser.Geom.Triangle} O - [triangle,$return] - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. - * @param {number} x - The X coordinate of the point to rotate the Triangle about. - * @param {number} y - The Y coordinate of the point to rotate the Triangle about. - * @param {number} angle - The angle by which to rotate the Triangle, in radians. - * - * @return {Phaser.Geom.Triangle} The rotated Triangle. - */ -var RotateAroundXY = function (triangle, x, y, angle) -{ - var c = Math.cos(angle); - var s = Math.sin(angle); + /** + * Optionally sort the particles before they render based on this + * property. The property must exist on the `Particle` class, such + * as `y`, `lifeT`, `scaleX`, etc. + * + * When set this overrides the `particleBringToTop` setting. + * + * To reset this and disable sorting, so this property to an empty string. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#sortProperty + * @type {string} + * @since 3.60.0 + */ + this.sortProperty = ''; - var tx = triangle.x1 - x; - var ty = triangle.y1 - y; + /** + * When `sortProperty` is defined this controls the sorting order, + * either ascending or descending. Toggle to control the visual effect. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#sortOrderAsc + * @type {boolean} + * @since 3.60.0 + */ + this.sortOrderAsc = true; - triangle.x1 = tx * c - ty * s + x; - triangle.y1 = tx * s + ty * c + y; + /** + * The callback used to sort the particles. Only used if `sortProperty` + * has been set. Set this via the `setSortCallback` method. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#sortCallback + * @type {?Phaser.Types.GameObjects.Particles.ParticleSortCallback} + * @since 3.60.0 + */ + this.sortCallback = this.depthSortCallback; - tx = triangle.x2 - x; - ty = triangle.y2 - y; + /** + * A list of Particle Processors being managed by this Emitter. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#processors + * @type {Phaser.Structs.List.} + * @since 3.60.0 + */ + this.processors = new List(this); - triangle.x2 = tx * c - ty * s + x; - triangle.y2 = tx * s + ty * c + y; + /** + * The tint fill mode used by the Particles in this Emitter. + * + * `false` = An additive tint (the default), where vertices colors are blended with the texture. + * `true` = A fill tint, where the vertices colors replace the texture, but respects texture alpha. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#tintFill + * @type {boolean} + * @default false + * @since 3.60.0 + */ + this.tintFill = false; - tx = triangle.x3 - x; - ty = triangle.y3 - y; + this.initPipeline(); + this.initPostPipeline(); - triangle.x3 = tx * c - ty * s + x; - triangle.y3 = tx * s + ty * c + y; + this.setPosition(x, y); + this.setTexture(texture); - return triangle; -}; + if (config) + { + this.setConfig(config); + } + }, -module.exports = RotateAroundXY; + // Overrides Game Object method + addedToScene: function () + { + this.scene.sys.updateList.add(this); + }, + // Overrides Game Object method + removedFromScene: function () + { + this.scene.sys.updateList.remove(this); + }, -/***/ }), -/* 239 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Takes an Emitter Configuration file and resets this Emitter, using any + * properties defined in the config to then set it up again. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setConfig + * @since 3.60.0 + * + * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig} config - Settings for this emitter. + * + * @return {this} This Particle Emitter. + */ + setConfig: function (config) + { + if (!config) + { + return this; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var i = 0; + var key = ''; -/** - * @namespace Phaser.Input.Gamepad.Events - */ + var ops = this.ops; -module.exports = { + for (i = 0; i < configOpMap.length; i++) + { + key = configOpMap[i]; - BUTTON_DOWN: __webpack_require__(1310), - BUTTON_UP: __webpack_require__(1311), - CONNECTED: __webpack_require__(1312), - DISCONNECTED: __webpack_require__(1313), - GAMEPAD_BUTTON_DOWN: __webpack_require__(1314), - GAMEPAD_BUTTON_UP: __webpack_require__(1315) + ops[key].loadConfig(config); + } -}; + for (i = 0; i < configFastMap.length; i++) + { + key = configFastMap[i]; + // Only update properties from their current state if they exist in the given config + if (HasValue(config, key)) + { + this[key] = GetFastValue(config, key); + } + } -/***/ }), -/* 240 */ -/***/ (function(module, exports, __webpack_require__) { + this.acceleration = (this.accelerationX !== 0 || this.accelerationY !== 0); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.moveTo = (this.moveToX !== 0 && this.moveToY !== 0); -var Extend = __webpack_require__(17); -var XHRSettings = __webpack_require__(156); + // Special 'speed' override -/** - * Takes two XHRSettings Objects and creates a new XHRSettings object from them. - * - * The new object is seeded by the values given in the global settings, but any setting in - * the local object overrides the global ones. - * - * @function Phaser.Loader.MergeXHRSettings - * @since 3.0.0 - * - * @param {Phaser.Types.Loader.XHRSettingsObject} global - The global XHRSettings object. - * @param {Phaser.Types.Loader.XHRSettingsObject} local - The local XHRSettings object. - * - * @return {Phaser.Types.Loader.XHRSettingsObject} A newly formed XHRSettings object. - */ -var MergeXHRSettings = function (global, local) -{ - var output = (global === undefined) ? XHRSettings() : Extend({}, global); + if (HasValue(config, 'speed')) + { + ops.speedX.loadConfig(config, 'speed'); + ops.speedY.active = false; + } - if (local) - { - for (var setting in local) + // If you specify speedX, speedY or moveTo then it changes the emitter from radial to a point emitter + if (HasAny(config, [ 'speedX', 'speedY' ]) || this.moveTo) { - if (local[setting] !== undefined) - { - output[setting] = local[setting]; - } + this.radial = false; } - } - return output; -}; + // Special 'scale' override -module.exports = MergeXHRSettings; + if (HasValue(config, 'scale')) + { + ops.scaleX.loadConfig(config, 'scale'); + ops.scaleY.active = false; + } + if (HasValue(config, 'callbackScope')) + { + var callbackScope = GetFastValue(config, 'callbackScope', null); -/***/ }), -/* 241 */ -/***/ (function(module, exports, __webpack_require__) { + this.emitCallbackScope = callbackScope; + this.deathCallbackScope = callbackScope; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (HasValue(config, 'emitZone')) + { + this.addEmitZone(config.emitZone); + } -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); -var ParseXML = __webpack_require__(408); + if (HasValue(config, 'deathZone')) + { + this.addDeathZone(config.deathZone); + } -/** - * @classdesc - * A single XML File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#xml method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#xml. - * - * @class XMLFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.XMLFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var XMLFile = new Class({ + if (HasValue(config, 'bounds')) + { + var bounds = this.addParticleBounds(config.bounds); - Extends: File, + bounds.collideLeft = GetFastValue(config, 'collideLeft', true); + bounds.collideRight = GetFastValue(config, 'collideRight', true); + bounds.collideTop = GetFastValue(config, 'collideTop', true); + bounds.collideBottom = GetFastValue(config, 'collideBottom', true); + } - initialize: + if (HasValue(config, 'followOffset')) + { + this.followOffset.setFromObject(GetFastValue(config, 'followOffset', 0)); + } - function XMLFile (loader, key, url, xhrSettings) - { - var extension = 'xml'; + if (HasValue(config, 'texture')) + { + this.setTexture(config.texture); + } - if (IsPlainObject(key)) + if (HasValue(config, 'frame')) { - var config = key; + this.setEmitterFrame(config.frame); + } + else if (HasValue(config, 'anim')) + { + this.setAnim(config.anim); + } - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); + if (HasValue(config, 'reserve')) + { + this.reserve(config.reserve); } - var fileConfig = { - type: 'xml', - cache: loader.cacheManager.xml, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings - }; + if (HasValue(config, 'advance')) + { + this.fastForward(config.advance); + } - File.call(this, loader, fileConfig); + this.resetCounters(this.frequency, this.emitting); + + if (this.emitting) + { + this.emit(Events.START, this); + } + + return this; }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * Creates a description of this emitter suitable for JSON serialization. * - * @method Phaser.Loader.FileTypes.XMLFile#onProcess - * @since 3.7.0 + * @method Phaser.GameObjects.Particles.ParticleEmitter#toJSON + * @since 3.0.0 + * + * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. */ - onProcess: function () + toJSON: function () { - this.state = CONST.FILE_PROCESSING; + var output = ComponentsToJSON(this); - this.data = ParseXML(this.xhrLoader.responseText); + var i = 0; + var key = ''; - if (this.data) - { - this.onProcessComplete(); - } - else + for (i = 0; i < configFastMap.length; i++) { - console.warn('Invalid XMLFile: ' + this.key); - - this.onProcessError(); - } - } - -}); + key = configFastMap[i]; -/** - * Adds an XML file, or array of XML files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.xml('wavedata', 'files/AlienWaveData.xml'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global XML Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the XML Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the XML Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.xml({ - * key: 'wavedata', - * url: 'files/AlienWaveData.xml' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.XMLFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.xml('wavedata', 'files/AlienWaveData.xml'); - * // and later in your game ... - * var data = this.cache.xml.get('wavedata'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and - * this is what you would use to retrieve the text from the XML Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" - * and no URL is given then the Loader will set the URL to be "data.xml". It will always add `.xml` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the XML File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#xml - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.XMLFileConfig|Phaser.Types.Loader.FileTypes.XMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('xml', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new XMLFile(this, key[i])); + output[key] = this[key]; } - } - else - { - this.addFile(new XMLFile(this, key, url, xhrSettings)); - } - - return this; -}); -module.exports = XMLFile; + var ops = this.ops; + for (i = 0; i < configOpMap.length; i++) + { + key = configOpMap[i]; -/***/ }), -/* 242 */ -/***/ (function(module, exports, __webpack_require__) { + if (ops[key]) + { + output[key] = ops[key].toJSON(); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // special handlers + if (!ops.speedY.active) + { + delete output.speedX; + output.speed = ops.speedX.toJSON(); + } -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); + if (this.scaleX === this.scaleY) + { + delete output.scaleX; + delete output.scaleY; + output.scale = ops.scaleX.toJSON(); + } -/** - * @classdesc - * A single Text File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#text method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#text. - * - * @class TextFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var TextFile = new Class({ + return output; + }, - Extends: File, + /** + * Resets the internal counter trackers. + * + * You shouldn't ever need to call this directly. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#resetCounters + * @since 3.60.0 + * + * @param {number} frequency - The frequency counter. + * @param {boolean} on - Set the complete flag. + */ + resetCounters: function (frequency, on) + { + var counters = this.counters; - initialize: + counters.fill(0); - function TextFile (loader, key, url, xhrSettings) - { - var type = 'text'; - var extension = 'txt'; - var cache = loader.cacheManager.text; + counters[0] = frequency; - if (IsPlainObject(key)) + if (on) { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - type = GetFastValue(config, 'type', type); - cache = GetFastValue(config, 'cache', cache); + counters[5] = 1; } - - var fileConfig = { - type: type, - cache: cache, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings - }; - - File.call(this, loader, fileConfig); }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * Continuously moves the particle origin to follow a Game Object's position. * - * @method Phaser.Loader.FileTypes.TextFile#onProcess - * @since 3.7.0 + * @method Phaser.GameObjects.Particles.ParticleEmitter#startFollow + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} target - The Game Object to follow. + * @param {number} [offsetX=0] - Horizontal offset of the particle origin from the Game Object. + * @param {number} [offsetY=0] - Vertical offset of the particle origin from the Game Object. + * @param {boolean} [trackVisible=false] - Whether the emitter's visible state will track the target's visible state. + * + * @return {this} This Particle Emitter. */ - onProcess: function () + startFollow: function (target, offsetX, offsetY, trackVisible) { - this.state = CONST.FILE_PROCESSING; + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } + if (trackVisible === undefined) { trackVisible = false; } - this.data = this.xhrLoader.responseText; + this.follow = target; + this.followOffset.set(offsetX, offsetY); + this.trackVisible = trackVisible; - this.onProcessComplete(); - } + return this; + }, -}); + /** + * Stops following a Game Object. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#stopFollow + * @since 3.0.0 + * + * @return {this} This Particle Emitter. + */ + stopFollow: function () + { + this.follow = null; + this.followOffset.set(0, 0); + this.trackVisible = false; -/** - * Adds a Text file, or array of Text files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.text('story', 'files/IntroStory.txt'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Text Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Text Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Text Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.text({ - * key: 'story', - * url: 'files/IntroStory.txt' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.TextFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.text('story', 'files/IntroStory.txt'); - * // and later in your game ... - * var data = this.cache.text.get('story'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and - * this is what you would use to retrieve the text from the Text Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" - * and no URL is given then the Loader will set the URL to be "story.txt". It will always add `.txt` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Text File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#text - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig|Phaser.Types.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('text', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) + return this; + }, + + /** + * Chooses a texture frame from {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#getFrame + * @since 3.0.0 + * + * @return {Phaser.Textures.Frame} The texture frame. + */ + getFrame: function () { - for (var i = 0; i < key.length; i++) + var frames = this.frames; + var len = frames.length; + var current; + + if (len === 1) { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new TextFile(this, key[i])); + current = frames[0]; } - } - else - { - this.addFile(new TextFile(this, key, url, xhrSettings)); - } + else if (this.randomFrame) + { + current = GetRandom(frames); + } + else + { + current = frames[this.currentFrame]; - return this; -}); + this.frameCounter++; -module.exports = TextFile; + if (this.frameCounter === this.frameQuantity) + { + this.frameCounter = 0; + this.currentFrame++; -/***/ }), -/* 243 */ -/***/ (function(module, exports, __webpack_require__) { + if (this.currentFrame === len) + { + this.currentFrame = 0; + } + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this.texture.get(current); + }, -/** - * @namespace Phaser.Physics.Arcade.Components - */ + /** + * Sets a pattern for assigning texture frames to emitted particles. The `frames` configuration can be any of: + * + * frame: 0 + * frame: 'red' + * frame: [ 0, 1, 2, 3 ] + * frame: [ 'red', 'green', 'blue', 'pink', 'white' ] + * frame: { frames: [ 'red', 'green', 'blue', 'pink', 'white' ], [cycle: bool], [quantity: int] } + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitterFrame + * @since 3.0.0 + * + * @param {(array|string|number|Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig)} frames - One or more texture frames, or a configuration object. + * @param {boolean} [pickRandom=true] - Whether frames should be assigned at random from `frames`. + * @param {number} [quantity=1] - The number of consecutive particles that will receive each frame. + * + * @return {this} This Particle Emitter. + */ + setEmitterFrame: function (frames, pickRandom, quantity) + { + if (pickRandom === undefined) { pickRandom = true; } + if (quantity === undefined) { quantity = 1; } -module.exports = { + this.randomFrame = pickRandom; + this.frameQuantity = quantity; - Acceleration: __webpack_require__(1368), - Angular: __webpack_require__(1369), - Bounce: __webpack_require__(1370), - Debug: __webpack_require__(1371), - Drag: __webpack_require__(1372), - Enable: __webpack_require__(1373), - Friction: __webpack_require__(1374), - Gravity: __webpack_require__(1375), - Immovable: __webpack_require__(1376), - Mass: __webpack_require__(1377), - OverlapCirc: __webpack_require__(523), - OverlapRect: __webpack_require__(244), - Pushable: __webpack_require__(1378), - Size: __webpack_require__(1379), - Velocity: __webpack_require__(1380) + this.currentFrame = 0; -}; + var t = typeof (frames); + this.frames.length = 0; -/***/ }), -/* 244 */ -/***/ (function(module, exports) { + if (Array.isArray(frames)) + { + this.frames = this.frames.concat(frames); + } + else if (t === 'string' || t === 'number') + { + this.frames.push(frames); + } + else if (t === 'object') + { + var frameConfig = frames; -/** - * This method will search the given rectangular area and return an array of all physics bodies that - * overlap with it. It can return either Dynamic, Static bodies or a mixture of both. - * - * A body only has to intersect with the search area to be considered, it doesn't have to be fully - * contained within it. - * - * If Arcade Physics is set to use the RTree (which it is by default) then the search for is extremely fast, - * otherwise the search is O(N) for Dynamic Bodies. - * - * @function Phaser.Physics.Arcade.Components.OverlapRect - * @since 3.17.0 - * - * @param {number} x - The top-left x coordinate of the area to search within. - * @param {number} y - The top-left y coordinate of the area to search within. - * @param {number} width - The width of the area to search within. - * @param {number} height - The height of the area to search within. - * @param {boolean} [includeDynamic=true] - Should the search include Dynamic Bodies? - * @param {boolean} [includeStatic=false] - Should the search include Static Bodies? - * - * @return {(Phaser.Physics.Arcade.Body[]|Phaser.Physics.Arcade.StaticBody[])} An array of bodies that overlap with the given area. - */ -var OverlapRect = function (world, x, y, width, height, includeDynamic, includeStatic) -{ - if (includeDynamic === undefined) { includeDynamic = true; } - if (includeStatic === undefined) { includeStatic = false; } + frames = GetFastValue(frameConfig, 'frames', null); - var dynamicBodies = []; - var staticBodies = []; + if (frames) + { + this.frames = this.frames.concat(frames); + } - var minMax = world.treeMinMax; + var isCycle = GetFastValue(frameConfig, 'cycle', false); - minMax.minX = x; - minMax.minY = y; - minMax.maxX = x + width; - minMax.maxY = y + height; + this.randomFrame = (isCycle) ? false : true; - if (includeStatic) - { - staticBodies = world.staticTree.search(minMax); - } + this.frameQuantity = GetFastValue(frameConfig, 'quantity', quantity); + } - if (includeDynamic && world.useTree) - { - dynamicBodies = world.tree.search(minMax); - } - else if (includeDynamic) + if (this.frames.length === 1) + { + this.frameQuantity = 1; + this.randomFrame = false; + } + + return this; + }, + + /** + * Chooses an animation from {@link Phaser.GameObjects.Particles.ParticleEmitter#anims}, if populated. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#getAnim + * @since 3.60.0 + * + * @return {string} The animation to play, or `null` if there aren't any. + */ + getAnim: function () { - var bodies = world.bodies; + var anims = this.anims; + var len = anims.length; - var fakeBody = + if (len === 0) { - position: { - x: x, - y: y - }, - left: x, - top: y, - right: x + width, - bottom: y + height, - isCircle: false - }; + return null; + } + else if (len === 1) + { + return anims[0]; + } + else if (this.randomAnim) + { + return GetRandom(anims); + } + else + { + var anim = anims[this.currentAnim]; - var intersects = world.intersects; + this.animCounter++; - bodies.iterate(function (target) - { - if (intersects(target, fakeBody)) + if (this.animCounter >= this.animQuantity) { - dynamicBodies.push(target); + this.animCounter = 0; + this.currentAnim = Wrap(this.currentAnim + 1, 0, len - 1); } - }); - } + return anim; + } + }, - return staticBodies.concat(dynamicBodies); -}; + /** + * Sets a pattern for assigning animations to emitted particles. The `anims` configuration can be any of: + * + * anim: 'red' + * anim: [ 'red', 'green', 'blue', 'pink', 'white' ] + * anim: { anims: [ 'red', 'green', 'blue', 'pink', 'white' ], [cycle: bool], [quantity: int] } + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setAnim + * @since 3.60.0 + * + * @param {(array|string|Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig)} anims - One or more animations, or a configuration object. + * @param {boolean} [pickRandom=true] - Whether animations should be assigned at random from `anims`. + * @param {number} [quantity=1] - The number of consecutive particles that will receive each animation. + * + * @return {this} This Particle Emitter. + */ + setAnim: function (anims, pickRandom, quantity) + { + if (pickRandom === undefined) { pickRandom = true; } + if (quantity === undefined) { quantity = 1; } -module.exports = OverlapRect; + this.randomAnim = pickRandom; + this.animQuantity = quantity; + this.currentAnim = 0; -/***/ }), -/* 245 */ -/***/ (function(module, exports, __webpack_require__) { + var t = typeof (anims); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.anims.length = 0; -/** - * @namespace Phaser.Physics.Arcade.Events - */ + if (Array.isArray(anims)) + { + this.anims = this.anims.concat(anims); + } + else if (t === 'string') + { + this.anims.push(anims); + } + else if (t === 'object') + { + var animConfig = anims; -module.exports = { + anims = GetFastValue(animConfig, 'anims', null); - COLLIDE: __webpack_require__(1381), - OVERLAP: __webpack_require__(1382), - PAUSE: __webpack_require__(1383), - RESUME: __webpack_require__(1384), - TILE_COLLIDE: __webpack_require__(1385), - TILE_OVERLAP: __webpack_require__(1386), - WORLD_BOUNDS: __webpack_require__(1387), - WORLD_STEP: __webpack_require__(1388) + if (anims) + { + this.anims = this.anims.concat(anims); + } -}; + var isCycle = GetFastValue(animConfig, 'cycle', false); + this.randomAnim = (isCycle) ? false : true; -/***/ }), -/* 246 */ -/***/ (function(module, exports, __webpack_require__) { + this.animQuantity = GetFastValue(animConfig, 'quantity', quantity); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.anims.length === 1) + { + this.animQuantity = 1; + this.randomAnim = false; + } -var CONST = __webpack_require__(62); + return this; + }, -/** - * Calculates and returns the horizontal overlap between two arcade physics bodies and sets their properties - * accordingly, including: `touching.left`, `touching.right`, `touching.none` and `overlapX'. - * - * @function Phaser.Physics.Arcade.GetOverlapX - * @since 3.0.0 - * - * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. - * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. - * @param {boolean} overlapOnly - Is this an overlap only check, or part of separation? - * @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding). - * - * @return {number} The amount of overlap. - */ -var GetOverlapX = function (body1, body2, overlapOnly, bias) -{ - var overlap = 0; - var maxOverlap = body1.deltaAbsX() + body2.deltaAbsX() + bias; + /** + * Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle movement on or off. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setRadial + * @since 3.0.0 + * + * @param {boolean} [value=true] - Radial mode (true) or point mode (true). + * + * @return {this} This Particle Emitter. + */ + setRadial: function (value) + { + if (value === undefined) { value = true; } - if (body1._dx === 0 && body2._dx === 0) + this.radial = value; + + return this; + }, + + /** + * Creates a Particle Bounds processor and adds it to this Emitter. + * + * This processor will check to see if any of the active Particles hit + * the defined boundary, as specified by a Rectangle shape in world-space. + * + * If so, they are 'rebounded' back again by having their velocity adjusted. + * + * The strength of the rebound is controlled by the `Particle.bounce` + * property. + * + * You should be careful to ensure that you emit particles within a bounds, + * if set, otherwise it will lead to unpredictable visual results as the + * particles are hastily repositioned. + * + * The Particle Bounds processor is returned from this method. If you wish + * to modify the area you can directly change its `bounds` property, along + * with the `collideLeft` etc values. + * + * To disable the bounds you can either set its `active` property to `false`, + * or if you no longer require it, call `ParticleEmitter.removeParticleProcessor`. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#addParticleBounds + * @since 3.60.0 + * + * @param {(number|Phaser.Types.GameObjects.Particles.ParticleEmitterBounds|Phaser.Types.GameObjects.Particles.ParticleEmitterBoundsAlt)} x - The x-coordinate of the left edge of the boundary, or an object representing a rectangle. + * @param {number} [y] - The y-coordinate of the top edge of the boundary. + * @param {number} [width] - The width of the boundary. + * @param {number} [height] - The height of the boundary. + * @param {boolean} [collideLeft=true] - Whether particles interact with the left edge of the bounds. + * @param {boolean} [collideRight=true] - Whether particles interact with the right edge of the bounds. + * @param {boolean} [collideTop=true] - Whether particles interact with the top edge of the bounds. + * @param {boolean} [collideBottom=true] - Whether particles interact with the bottom edge of the bounds. + * + * @return {Phaser.GameObjects.Particles.ParticleBounds} The Particle Bounds processor. + */ + addParticleBounds: function (x, y, width, height, collideLeft, collideRight, collideTop, collideBottom) { - // They overlap but neither of them are moving - body1.embedded = true; - body2.embedded = true; - } - else if (body1._dx > body2._dx) + if (typeof x === 'object') + { + var obj = x; + + x = obj.x; + y = obj.y; + width = (HasValue(obj, 'w')) ? obj.w : obj.width; + height = (HasValue(obj, 'h')) ? obj.h : obj.height; + } + + return this.addParticleProcessor(new ParticleBounds(x, y, width, height, collideLeft, collideRight, collideTop, collideBottom)); + }, + + /** + * Sets the initial radial speed of emitted particles. + * + * Changes the emitter to radial mode. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setParticleSpeed + * @since 3.60.0 + * + * @param {number} x - The horizontal speed of the emitted Particles. + * @param {number} [y=x] - The vertical speed of emitted Particles. If not set it will use the `x` value. + * + * @return {this} This Particle Emitter. + */ + setParticleSpeed: function (x, y) { - // Body1 is moving right and / or Body2 is moving left - overlap = body1.right - body2.x; + if (y === undefined) { y = x; } - if ((overlap > maxOverlap && !overlapOnly) || body1.checkCollision.right === false || body2.checkCollision.left === false) + this.ops.speedX.onChange(x); + + if (x === y) { - overlap = 0; + this.ops.speedY.active = false; } else { - body1.touching.none = false; - body1.touching.right = true; + this.ops.speedY.onChange(y); + } - body2.touching.none = false; - body2.touching.left = true; + // If you specify speedX and Y then it changes the emitter from radial to a point emitter + this.radial = true; - if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) - { - body1.blocked.none = false; - body1.blocked.right = true; - } + return this; + }, - if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) - { - body2.blocked.none = false; - body2.blocked.left = true; - } - } - } - else if (body1._dx < body2._dx) + /** + * Sets the vertical and horizontal scale of the emitted particles. + * + * You can also set the scale of the entire emitter via `setScale`. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setParticleScale + * @since 3.60.0 + * + * @param {number} [x=1] - The horizontal scale of the emitted Particles. + * @param {number} [y=x] - The vertical scale of emitted Particles. If not set it will use the `x` value. + * + * @return {this} This Particle Emitter. + */ + setParticleScale: function (x, y) { - // Body1 is moving left and/or Body2 is moving right - overlap = body1.x - body2.width - body2.x; + if (x === undefined) { x = 1; } + if (y === undefined) { y = x; } - if ((-overlap > maxOverlap && !overlapOnly) || body1.checkCollision.left === false || body2.checkCollision.right === false) - { - overlap = 0; - } - else - { - body1.touching.none = false; - body1.touching.left = true; + this.ops.scaleX.onChange(x); + this.ops.scaleY.onChange(y); - body2.touching.none = false; - body2.touching.right = true; + return this; + }, - if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) - { - body1.blocked.none = false; - body1.blocked.left = true; - } + /** + * Sets the gravity applied to emitted particles. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setParticleGravity + * @since 3.60.0 + * + * @param {number} x - Horizontal acceleration due to gravity, in pixels per second squared. Set to zero for no gravity. + * @param {number} y - Vertical acceleration due to gravity, in pixels per second squared. Set to zero for no gravity. + * + * @return {this} This Particle Emitter. + */ + setParticleGravity: function (x, y) + { + this.gravityX = x; + this.gravityY = y; - if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) - { - body2.blocked.none = false; - body2.blocked.right = true; - } - } - } + return this; + }, - // Resets the overlapX to zero if there is no overlap, or to the actual pixel value if there is - body1.overlapX = overlap; - body2.overlapX = overlap; + /** + * Sets the opacity (alpha) of emitted particles. + * + * You can also set the alpha of the entire emitter via `setAlpha`. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setParticleAlpha + * @since 3.60.0 + * + * @param {(Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType)} value - A value between 0 (transparent) and 1 (opaque). + * + * @return {this} This Particle Emitter. + */ + setParticleAlpha: function (value) + { + this.ops.alpha.onChange(value); - return overlap; -}; + return this; + }, -module.exports = GetOverlapX; + /** + * Sets the color tint of emitted particles. + * + * This is a WebGL only feature. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setParticleTint + * @since 3.60.0 + * @webglOnly + * + * @param {(Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType)} value - A value between 0 and 0xffffff. + * + * @return {this} This Particle Emitter. + */ + setParticleTint: function (value) + { + this.ops.tint.onChange(value); + return this; + }, -/***/ }), -/* 247 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Sets the angle of a {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle stream. + * + * The value is given in degrees using Phaser's right-handed coordinate system. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitterAngle + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} value - The angle of the initial velocity of emitted particles, in degrees. + * + * @return {this} This Particle Emitter. + */ + setEmitterAngle: function (value) + { + this.ops.angle.onChange(value); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -var CONST = __webpack_require__(62); + /** + * Sets the lifespan of newly emitted particles in milliseconds. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setParticleLifespan + * @since 3.60.0 + * + * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} value - The lifespan of a particle, in ms. + * + * @return {this} This Particle Emitter. + */ + setParticleLifespan: function (value) + { + this.ops.lifespan.onChange(value); -/** - * Calculates and returns the vertical overlap between two arcade physics bodies and sets their properties - * accordingly, including: `touching.up`, `touching.down`, `touching.none` and `overlapY'. - * - * @function Phaser.Physics.Arcade.GetOverlapY - * @since 3.0.0 - * - * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. - * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. - * @param {boolean} overlapOnly - Is this an overlap only check, or part of separation? - * @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding). - * - * @return {number} The amount of overlap. - */ -var GetOverlapY = function (body1, body2, overlapOnly, bias) -{ - var overlap = 0; - var maxOverlap = body1.deltaAbsY() + body2.deltaAbsY() + bias; + return this; + }, - if (body1._dy === 0 && body2._dy === 0) + /** + * Sets the number of particles released at each flow cycle or explosion. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setQuantity + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} quantity - The number of particles to release at each flow cycle or explosion. + * + * @return {this} This Particle Emitter. + */ + setQuantity: function (quantity) { - // They overlap but neither of them are moving - body1.embedded = true; - body2.embedded = true; - } - else if (body1._dy > body2._dy) + this.quantity = quantity; + + return this; + }, + + /** + * Sets the emitter's {@link Phaser.GameObjects.Particles.ParticleEmitter#frequency} + * and {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setFrequency + * @since 3.0.0 + * + * @param {number} frequency - The time interval (>= 0) of each flow cycle, in ms; or -1 to put the emitter in explosion mode. + * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} [quantity] - The number of particles to release at each flow cycle or explosion. + * + * @return {this} This Particle Emitter. + */ + setFrequency: function (frequency, quantity) { - // Body1 is moving down and/or Body2 is moving up - overlap = body1.bottom - body2.y; + this.frequency = frequency; - if ((overlap > maxOverlap && !overlapOnly) || body1.checkCollision.down === false || body2.checkCollision.up === false) + this.flowCounter = (frequency > 0) ? frequency : 0; + + if (quantity) { - overlap = 0; + this.quantity = quantity; } - else + + return this; + }, + + /** + * Adds a new Particle Death Zone to this Emitter. + * + * A particle is immediately killed as soon as its x/y coordinates intersect + * with any of the configured Death Zones. + * + * The `source` can be a Geometry Shape, such as a Circle, Rectangle or Triangle. + * Any valid object from the `Phaser.Geometry` namespace is allowed, as long as + * it supports a `contains` function. You can set the `type` to be either `onEnter` + * or `onLeave`. + * + * A single Death Zone instance can only exist once within this Emitter, but can belong + * to multiple Emitters. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#addDeathZone + * @since 3.60.0 + * + * @param {Phaser.Types.GameObjects.Particles.DeathZoneObject|Phaser.Types.GameObjects.Particles.DeathZoneObject[]} config - A Death Zone configuration object, a Death Zone instance, a valid Geometry object or an array of them. + * + * @return {Phaser.GameObjects.Particles.Zones.DeathZone} The Death Zone that was added to this Emitter. + */ + addDeathZone: function (config) + { + if (!Array.isArray(config)) { - body1.touching.none = false; - body1.touching.down = true; + config = [ config ]; + } - body2.touching.none = false; - body2.touching.up = true; + var zone; + var deathZones = this.deathZones; - if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) + for (var i = 0; i < config.length; i++) + { + zone = config[i]; + + if (zone instanceof DeathZone) { - body1.blocked.none = false; - body1.blocked.down = true; + deathZones.push(zone); } + else if (typeof zone.contains === 'function') + { + zone = new DeathZone(zone, true); - if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) + deathZones.push(zone); + } + else { - body2.blocked.none = false; - body2.blocked.up = true; + var type = GetFastValue(zone, 'type', 'onEnter'); + var source = GetFastValue(zone, 'source', null); + + if (source && typeof source.contains === 'function') + { + var killOnEnter = (type === 'onEnter') ? true : false; + + zone = new DeathZone(source, killOnEnter); + + deathZones.push(zone); + } } } - } - else if (body1._dy < body2._dy) + + return zone; + }, + + /** + * Removes the given Particle Death Zone from this Emitter. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#removeDeathZone + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Particles.Zones.DeathZone} zone - The Death Zone that should be removed from this Emitter. + * + * @return {this} This Particle Emitter. + */ + removeDeathZone: function (zone) { - // Body1 is moving up and/or Body2 is moving down - overlap = body1.y - body2.bottom; + Remove(this.deathZones, zone); - if ((-overlap > maxOverlap && !overlapOnly) || body1.checkCollision.up === false || body2.checkCollision.down === false) + return this; + }, + + /** + * Adds a new Particle Emission Zone to this Emitter. + * + * An {@link Phaser.Types.GameObjects.Particles.ParticleEmitterEdgeZoneConfig EdgeZone} places particles on its edges. + * Its {@link Phaser.Types.GameObjects.Particles.EdgeZoneSource source} can be a Curve, Path, Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; + * or any object with a suitable {@link Phaser.Types.GameObjects.Particles.EdgeZoneSourceCallback getPoints} method. + * + * A {@link Phaser.Types.GameObjects.Particles.ParticleEmitterRandomZoneConfig RandomZone} places the particles randomly within its interior. + * Its {@link RandomZoneSource source} can be a Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable {@link Phaser.Types.GameObjects.Particles.RandomZoneSourceCallback getRandomPoint} method. + * + * An Emission Zone can only exist once within this Emitter. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#addEmitZone + * @since 3.60.0 + * + * @param {Phaser.Types.GameObjects.Particles.EmitZoneObject|Phaser.Types.GameObjects.Particles.EmitZoneObject[]} zone - An Emission Zone configuration object, a RandomZone or EdgeZone instance, or an array of them. + * + * @return {Phaser.GameObjects.Particles.Zones.EdgeZone[]|Phaser.GameObjects.Particles.Zones.RandomZone[]} An array of the Emission Zones that were added to this Emitter. + */ + addEmitZone: function (config) + { + if (!Array.isArray(config)) { - overlap = 0; + config = [ config ]; } - else - { - body1.touching.none = false; - body1.touching.up = true; - body2.touching.none = false; - body2.touching.down = true; + var zone; + var emitZones = this.emitZones; + var output = []; - if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) - { - body1.blocked.none = false; - body1.blocked.up = true; - } + for (var i = 0; i < config.length; i++) + { + zone = config[i]; - if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) + if (zone instanceof RandomZone || zone instanceof EdgeZone) { - body2.blocked.none = false; - body2.blocked.down = true; + emitZones.push(zone); } - } - } + else + { + // Where source = Geom like Circle, or a Path or Curve + // emitZone: { type: 'random', source: X } + // emitZone: { type: 'edge', source: X, quantity: 32, [stepRate=0], [yoyo=false], [seamless=true], [total=1] } - // Resets the overlapY to zero if there is no overlap, or to the actual pixel value if there is - body1.overlapY = overlap; - body2.overlapY = overlap; + var type = GetFastValue(zone, 'type', 'random'); + var source = GetFastValue(zone, 'source', null); - return overlap; -}; + if (type === 'random') + { + zone = new RandomZone(source); + } + else if (type === 'edge') + { + var quantity = GetFastValue(zone, 'quantity', 1); + var stepRate = GetFastValue(zone, 'stepRate', 0); + var yoyo = GetFastValue(zone, 'yoyo', false); + var seamless = GetFastValue(zone, 'seamless', true); + var total = GetFastValue(zone, 'total', -1); -module.exports = GetOverlapY; + zone = new EdgeZone(source, quantity, stepRate, yoyo, seamless, total); + } + if (zone) + { + emitZones.push(zone); + } + } -/***/ }), -/* 248 */ -/***/ (function(module, exports) { + output.push(zone); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return output; + }, -/** - * Checks for intersection between the given tile rectangle-like object and an Arcade Physics body. - * - * @function Phaser.Physics.Arcade.Tilemap.TileIntersectsBody - * @since 3.0.0 - * - * @param {{ left: number, right: number, top: number, bottom: number }} tileWorldRect - A rectangle object that defines the tile placement in the world. - * @param {Phaser.Physics.Arcade.Body} body - The body to check for intersection against. - * - * @return {boolean} Returns `true` of the tile intersects with the body, otherwise `false`. - */ -var TileIntersectsBody = function (tileWorldRect, body) -{ - // Currently, all bodies are treated as rectangles when colliding with a Tile. + /** + * Removes the given Particle Emission Zone from this Emitter. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#removeEmitZone + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Particles.Zones.EdgeZone|Phaser.GameObjects.Particles.Zones.RandomZone} zone - The Emission Zone that should be removed from this Emitter. + * + * @return {this} This Particle Emitter. + */ + removeEmitZone: function (zone) + { + Remove(this.emitZones, zone); - return !( - body.right <= tileWorldRect.left || - body.bottom <= tileWorldRect.top || - body.position.x >= tileWorldRect.right || - body.position.y >= tileWorldRect.bottom - ); -}; + this.zoneIndex = 0; -module.exports = TileIntersectsBody; + return this; + }, + /** + * Takes the given particle and sets its x/y coordinates to match the next available + * emission zone, if any have been configured. This method is called automatically + * as part of the `Particle.fire` process. + * + * The Emit Zones are iterated in sequence. Once a zone has had a particle emitted + * from it, then the next zone is used and so on, in a loop. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#getEmitZone + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle to set the emission zone for. + */ + getEmitZone: function (particle) + { + var zones = this.emitZones; + var len = zones.length; -/***/ }), -/* 249 */ -/***/ (function(module, exports, __webpack_require__) { + if (len === 0) + { + return; + } + else + { + var zone = zones[this.zoneIndex]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + zone.getPoint(particle); -/** - * @namespace Phaser.Physics.Matter.Components - */ + if (zone.total > -1) + { + this.zoneTotal++; -module.exports = { + if (this.zoneTotal === zone.total) + { + this.zoneTotal = 0; - Bounce: __webpack_require__(1495), - Collision: __webpack_require__(1496), - Force: __webpack_require__(1497), - Friction: __webpack_require__(1498), - Gravity: __webpack_require__(1499), - Mass: __webpack_require__(1500), - Sensor: __webpack_require__(1501), - SetBody: __webpack_require__(1502), - Sleep: __webpack_require__(1503), - Static: __webpack_require__(1520), - Transform: __webpack_require__(1521), - Velocity: __webpack_require__(1522) + this.zoneIndex++; -}; + if (this.zoneIndex === len) + { + this.zoneIndex = 0; + } + } + } + } + }, + /** + * Takes the given particle and checks to see if any of the configured Death Zones + * will kill it and returns the result. This method is called automatically as part + * of the `Particle.update` process. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#getDeathZone + * @fires Phaser.GameObjects.Particles.Events#DEATH_ZONE + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle to test against the Death Zones. + * + * @return {boolean} `true` if the particle should be killed, otherwise `false`. + */ + getDeathZone: function (particle) + { + var zones = this.deathZones; -/***/ }), -/* 250 */ -/***/ (function(module, exports) { + for (var i = 0; i < zones.length; i++) + { + var zone = zones[i]; -/** -* The `Matter.Pair` module contains methods for creating and manipulating collision pairs. -* -* @class Pair -*/ + if (zone.willKill(particle)) + { + this.emit(Events.DEATH_ZONE, this, particle, zone); -var Pair = {}; + return true; + } + } -module.exports = Pair; + return false; + }, -(function() { - /** - * Creates a pair. - * @method create - * @param {collision} collision - * @param {number} timestamp - * @return {pair} A new pair + * Changes the currently active Emission Zone. The zones should have already + * been added to this Emitter either via the emitter config, or the + * `addEmitZone` method. + * + * Call this method by passing either a numeric zone index value, or + * the zone instance itself. + * + * Prior to v3.60 an Emitter could only have a single Emit Zone and this + * method was how you set it. From 3.60 and up it now performs a different + * function and swaps between all available active zones. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone + * @since 3.0.0 + * + * @param {number|Phaser.GameObjects.Particles.Zones.EdgeZone|Phaser.GameObjects.Particles.Zones.RandomZone} zone - The Emit Zone to set as the active zone. + * + * @return {this} This Particle Emitter. */ - Pair.create = function(collision, timestamp) { - var bodyA = collision.bodyA, - bodyB = collision.bodyB; + setEmitZone: function (zone) + { + var index; - var pair = { - id: Pair.id(bodyA, bodyB), - bodyA: bodyA, - bodyB: bodyB, - activeContacts: [], - separation: 0, - isActive: true, - confirmedActive: true, - isSensor: bodyA.isSensor || bodyB.isSensor, - timeCreated: timestamp, - timeUpdated: timestamp, - collision: null, - inverseMass: 0, - friction: 0, - frictionStatic: 0, - restitution: 0, - slop: 0 - }; + if (isFinite(zone)) + { + index = zone; + } + else + { + index = this.emitZones.indexOf(zone); + } - Pair.update(pair, collision, timestamp); + if (index >= 0) + { + this.zoneIndex = index; + } - return pair; - }; + return this; + }, /** - * Updates a pair given a collision. - * @method update - * @param {pair} pair - * @param {collision} collision - * @param {number} timestamp + * Adds a Particle Processor, such as a Gravity Well, to this Emitter. + * + * It will start processing particles from the next update as long as its `active` + * property is set. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#addParticleProcessor + * @since 3.60.0 + * + * @generic {Phaser.GameObjects.Particles.ParticleProcessor} T + * @param {T} processor - The Particle Processor to add to this Emitter Manager. + * + * @return {T} The Particle Processor that was added to this Emitter Manager. */ - Pair.update = function(pair, collision, timestamp) { - pair.collision = collision; - - if (collision.collided) { - var supports = collision.supports, - activeContacts = pair.activeContacts, - parentA = collision.parentA, - parentB = collision.parentB; - - pair.inverseMass = parentA.inverseMass + parentB.inverseMass; - pair.friction = Math.min(parentA.friction, parentB.friction); - pair.frictionStatic = Math.max(parentA.frictionStatic, parentB.frictionStatic); - pair.restitution = Math.max(parentA.restitution, parentB.restitution); - pair.slop = Math.max(parentA.slop, parentB.slop); - - for (var i = 0; i < supports.length; i++) { - activeContacts[i] = supports[i].contact; + addParticleProcessor: function (processor) + { + if (!this.processors.exists(processor)) + { + if (processor.emitter) + { + processor.emitter.removeParticleProcessor(processor); } - // optimise array size - var supportCount = supports.length; - if (supportCount < activeContacts.length) { - activeContacts.length = supportCount; - } + this.processors.add(processor); - pair.separation = collision.depth; - Pair.setActive(pair, true, timestamp); - } else { - if (pair.isActive === true) - Pair.setActive(pair, false, timestamp); + processor.emitter = this; } - }; - + + return processor; + }, + /** - * Set a pair as active or inactive. - * @method setActive - * @param {pair} pair - * @param {bool} isActive - * @param {number} timestamp + * Removes a Particle Processor from this Emitter. + * + * The Processor must belong to this Emitter to be removed. + * + * It is not destroyed when removed, allowing you to move it to another Emitter Manager, + * so if you no longer require it you should call its `destroy` method directly. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#removeParticleProcessor + * @since 3.60.0 + * + * @generic {Phaser.GameObjects.Particles.ParticleProcessor} T + * @param {T} processor - The Particle Processor to remove from this Emitter Manager. + * + * @return {?T} The Particle Processor that was removed, or null if it could not be found. */ - Pair.setActive = function(pair, isActive, timestamp) { - if (isActive) { - pair.isActive = true; - pair.timeUpdated = timestamp; - } else { - pair.isActive = false; - pair.activeContacts.length = 0; + removeParticleProcessor: function (processor) + { + if (this.processors.exists(processor)) + { + this.processors.remove(processor, true); + + processor.emitter = null; } - }; + + return processor; + }, /** - * Get the id for the given pair. - * @method id - * @param {body} bodyA - * @param {body} bodyB - * @return {string} Unique pairId + * Gets all active Particle Processors. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#getProcessors + * @since 3.60.0 + * + * @return {Phaser.GameObjects.Particles.ParticleProcessor[]} - An array of active Particle Processors. */ - Pair.id = function(bodyA, bodyB) { - if (bodyA.id < bodyB.id) { - return 'A' + bodyA.id + 'B' + bodyB.id; - } else { - return 'A' + bodyB.id + 'B' + bodyA.id; - } - }; + getProcessors: function () + { + return this.processors.getAll('active', true); + }, -})(); + /** + * Creates a new Gravity Well, adds it to this Emitter and returns a reference to it. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#createGravityWell + * @since 3.60.0 + * + * @param {Phaser.Types.GameObjects.Particles.GravityWellConfig} config - Configuration settings for the Gravity Well to create. + * + * @return {Phaser.GameObjects.Particles.GravityWell} The Gravity Well that was created. + */ + createGravityWell: function (config) + { + return this.addParticleProcessor(new GravityWell(config)); + }, + /** + * Creates inactive particles and adds them to this emitter's pool. + * + * If `ParticleEmitter.maxParticles` is set it will limit the + * value passed to this method to make sure it's not exceeded. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#reserve + * @since 3.0.0 + * + * @param {number} count - The number of particles to create. + * + * @return {this} This Particle Emitter. + */ + reserve: function (count) + { + var dead = this.dead; -/***/ }), -/* 251 */ -/***/ (function(module, exports, __webpack_require__) { + if (this.maxParticles > 0) + { + var total = this.getParticleCount(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (total + count > this.maxParticles) + { + count = this.maxParticles - (total + count); + } + } -/** - * @namespace Phaser.Tilemaps.Components - */ + for (var i = 0; i < count; i++) + { + dead.push(new this.particleClass(this)); + } -module.exports = { + return this; + }, - CalculateFacesAt: __webpack_require__(252), - CalculateFacesWithin: __webpack_require__(63), - CheckIsoBounds: __webpack_require__(541), - Copy: __webpack_require__(1420), - CreateFromTiles: __webpack_require__(1421), - CullBounds: __webpack_require__(543), - CullTiles: __webpack_require__(544), - Fill: __webpack_require__(1422), - FilterTiles: __webpack_require__(1423), - FindByIndex: __webpack_require__(1424), - FindTile: __webpack_require__(1425), - ForEachTile: __webpack_require__(1426), - GetCullTilesFunction: __webpack_require__(1427), - GetTileAt: __webpack_require__(158), - GetTileAtWorldXY: __webpack_require__(1428), - GetTilesWithin: __webpack_require__(26), - GetTilesWithinShape: __webpack_require__(1429), - GetTilesWithinWorldXY: __webpack_require__(529), - GetTileToWorldXFunction: __webpack_require__(1430), - GetTileToWorldXYFunction: __webpack_require__(1431), - GetTileToWorldYFunction: __webpack_require__(1432), - GetWorldToTileXFunction: __webpack_require__(1433), - GetWorldToTileXYFunction: __webpack_require__(1434), - GetWorldToTileYFunction: __webpack_require__(1435), - HasTileAt: __webpack_require__(562), - HasTileAtWorldXY: __webpack_require__(1436), - HexagonalCullBounds: __webpack_require__(546), - HexagonalCullTiles: __webpack_require__(545), - HexagonalTileToWorldXY: __webpack_require__(550), - HexagonalTileToWorldY: __webpack_require__(554), - HexagonalWorldToTileXY: __webpack_require__(556), - HexagonalWorldToTileY: __webpack_require__(560), - IsInLayerBounds: __webpack_require__(119), - IsometricCullTiles: __webpack_require__(547), - IsometricTileToWorldXY: __webpack_require__(551), - IsometricWorldToTileXY: __webpack_require__(557), - PutTileAt: __webpack_require__(257), - PutTileAtWorldXY: __webpack_require__(1437), - PutTilesAt: __webpack_require__(1438), - Randomize: __webpack_require__(1439), - RemoveTileAt: __webpack_require__(563), - RemoveTileAtWorldXY: __webpack_require__(1440), - RenderDebug: __webpack_require__(1441), - ReplaceByIndex: __webpack_require__(542), - RunCull: __webpack_require__(159), - SetCollision: __webpack_require__(1442), - SetCollisionBetween: __webpack_require__(1443), - SetCollisionByExclusion: __webpack_require__(1444), - SetCollisionByProperty: __webpack_require__(1445), - SetCollisionFromCollisionGroup: __webpack_require__(1446), - SetLayerCollisionIndex: __webpack_require__(160), - SetTileCollision: __webpack_require__(72), - SetTileIndexCallback: __webpack_require__(1447), - SetTileLocationCallback: __webpack_require__(1448), - Shuffle: __webpack_require__(1449), - StaggeredCullBounds: __webpack_require__(549), - StaggeredCullTiles: __webpack_require__(548), - StaggeredTileToWorldXY: __webpack_require__(552), - StaggeredTileToWorldY: __webpack_require__(555), - StaggeredWorldToTileXY: __webpack_require__(558), - StaggeredWorldToTileY: __webpack_require__(561), - SwapByIndex: __webpack_require__(1450), - TileToWorldX: __webpack_require__(253), - TileToWorldXY: __webpack_require__(553), - TileToWorldY: __webpack_require__(254), - WeightedRandomize: __webpack_require__(1451), - WorldToTileX: __webpack_require__(255), - WorldToTileXY: __webpack_require__(559), - WorldToTileY: __webpack_require__(256) - -}; - - -/***/ }), -/* 252 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var GetTileAt = __webpack_require__(158); + /** + * Gets the number of active (in-use) particles in this emitter. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#getAliveParticleCount + * @since 3.0.0 + * + * @return {number} The number of particles with `active=true`. + */ + getAliveParticleCount: function () + { + return this.alive.length; + }, -/** - * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting - * faces are used internally for optimizing collisions against tiles. This method is mostly used - * internally to optimize recalculating faces when only one tile has been changed. - * - * @function Phaser.Tilemaps.Components.CalculateFacesAt - * @since 3.0.0 - * - * @param {number} tileX - The x coordinate. - * @param {number} tileY - The y coordinate. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var CalculateFacesAt = function (tileX, tileY, layer) -{ - var tile = GetTileAt(tileX, tileY, true, layer); - var above = GetTileAt(tileX, tileY - 1, true, layer); - var below = GetTileAt(tileX, tileY + 1, true, layer); - var left = GetTileAt(tileX - 1, tileY, true, layer); - var right = GetTileAt(tileX + 1, tileY, true, layer); - var tileCollides = tile && tile.collides; + /** + * Gets the number of inactive (available) particles in this emitter. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#getDeadParticleCount + * @since 3.0.0 + * + * @return {number} The number of particles with `active=false`. + */ + getDeadParticleCount: function () + { + return this.dead.length; + }, - // Assume the changed tile has all interesting edges - if (tileCollides) + /** + * Gets the total number of particles in this emitter. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#getParticleCount + * @since 3.0.0 + * + * @return {number} The number of particles, including both alive and dead. + */ + getParticleCount: function () { - tile.faceTop = true; - tile.faceBottom = true; - tile.faceLeft = true; - tile.faceRight = true; - } + return this.getAliveParticleCount() + this.getDeadParticleCount(); + }, - // Reset edges that are shared between tile and its neighbors - if (above && above.collides) + /** + * Whether this emitter is at either its hard-cap limit (maxParticles), if set, or + * the max allowed number of 'alive' particles (maxAliveParticles). + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#atLimit + * @since 3.0.0 + * + * @return {boolean} Returns `true` if this Emitter is at its limit, or `false` if no limit, or below the `maxParticles` level. + */ + atLimit: function () { - if (tileCollides) + if (this.maxParticles > 0 && this.getParticleCount() >= this.maxParticles) { - tile.faceTop = false; + return true; } - above.faceBottom = !tileCollides; - } + return (this.maxAliveParticles > 0 && this.getAliveParticleCount() >= this.maxAliveParticles); + }, - if (below && below.collides) + /** + * Sets a function to call for each newly emitted particle. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleEmit + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterCallback} callback - The function. + * @param {*} [context] - The calling context. + * + * @return {this} This Particle Emitter. + */ + onParticleEmit: function (callback, context) { - if (tileCollides) + if (callback === undefined) { - tile.faceBottom = false; + // Clear any previously set callback + this.emitCallback = null; + this.emitCallbackScope = null; } - - below.faceTop = !tileCollides; - } - - if (left && left.collides) - { - if (tileCollides) + else if (typeof callback === 'function') { - tile.faceLeft = false; + this.emitCallback = callback; + + if (context) + { + this.emitCallbackScope = context; + } } - left.faceRight = !tileCollides; - } + return this; + }, - if (right && right.collides) + /** + * Sets a function to call for each particle death. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleDeath + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.Particles.ParticleDeathCallback} callback - The function. + * @param {*} [context] - The function's calling context. + * + * @return {this} This Particle Emitter. + */ + onParticleDeath: function (callback, context) { - if (tileCollides) + if (callback === undefined) { - tile.faceRight = false; + // Clear any previously set callback + this.deathCallback = null; + this.deathCallbackScope = null; } + else if (typeof callback === 'function') + { + this.deathCallback = callback; - right.faceLeft = !tileCollides; - } + if (context) + { + this.deathCallbackScope = context; + } + } - if (tile && !tile.collides) - { - tile.resetFaces(); - } + return this; + }, - return tile; -}; + /** + * Deactivates every particle in this emitter immediately. + * + * This particles are killed but do not emit an event or callback. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#killAll + * @since 3.0.0 + * + * @return {this} This Particle Emitter. + */ + killAll: function () + { + var dead = this.dead; + var alive = this.alive; -module.exports = CalculateFacesAt; + while (alive.length > 0) + { + dead.push(alive.pop()); + } + return this; + }, -/***/ }), -/* 253 */ -/***/ (function(module, exports) { + /** + * Calls a function for each active particle in this emitter. The function is + * sent two parameters: a reference to the Particle instance and to this Emitter. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#forEachAlive + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterCallback} callback - The function. + * @param {*} context - The functions calling context. + * + * @return {this} This Particle Emitter. + */ + forEachAlive: function (callback, context) + { + var alive = this.alive; + var length = alive.length; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (var i = 0; i < length; i++) + { + // Sends the Particle and the Emitter + callback.call(context, alive[i], this); + } -/** - * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the - * layer's position, scale and scroll. - * - * @function Phaser.Tilemaps.Components.TileToWorldX - * @since 3.0.0 - * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {number} - */ -var TileToWorldX = function (tileX, camera, layer) -{ - var tileWidth = layer.baseTileWidth; - var tilemapLayer = layer.tilemapLayer; - var layerWorldX = 0; + return this; + }, - if (tilemapLayer) + /** + * Calls a function for each inactive particle in this emitter. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#forEachDead + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterCallback} callback - The function. + * @param {*} context - The functions calling context. + * + * @return {this} This Particle Emitter. + */ + forEachDead: function (callback, context) { - if (!camera) { camera = tilemapLayer.scene.cameras.main; } + var dead = this.dead; + var length = dead.length; - layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + for (var i = 0; i < length; i++) + { + callback.call(context, dead[i], this); + } - tileWidth *= tilemapLayer.scaleX; - } + return this; + }, - return layerWorldX + tileX * tileWidth; -}; + /** + * Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#on} the emitter and resets the flow counter. + * + * If this emitter is in flow mode (frequency >= 0; the default), the particle flow will start (or restart). + * + * If this emitter is in explode mode (frequency = -1), nothing will happen. + * Use {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} or {@link Phaser.GameObjects.Particles.ParticleEmitter#flow} instead. + * + * Calling this method will emit the `START` event. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#start + * @fires Phaser.GameObjects.Particles.Events#START + * @since 3.0.0 + * + * @param {number} [advance=0] - Advance this number of ms in time through the emitter. + * @param {number} [duration=0] - Limit this emitter to only emit particles for the given number of ms. Setting this parameter will override any duration already set in the Emitter configuration object. + * + * @return {this} This Particle Emitter. + */ + start: function (advance, duration) + { + if (advance === undefined) { advance = 0; } -module.exports = TileToWorldX; + if (!this.emitting) + { + if (advance > 0) + { + this.fastForward(advance); + } + this.emitting = true; -/***/ }), -/* 254 */ -/***/ (function(module, exports) { + this.resetCounters(this.frequency, true); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (duration !== undefined) + { + this.duration = Math.abs(duration); + } -/** - * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the - * layer's position, scale and scroll. - * - * @function Phaser.Tilemaps.Components.TileToWorldY - * @since 3.0.0 - * - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {number} The Y location in world coordinates. - */ -var TileToWorldY = function (tileY, camera, layer) -{ - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; - var layerWorldY = 0; + this.emit(Events.START, this); + } - if (tilemapLayer) - { - if (!camera) { camera = tilemapLayer.scene.cameras.main; } + return this; + }, - layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + /** + * Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#emitting off} the emitter and + * stops it from emitting further particles. Currently alive particles will remain + * active until they naturally expire unless you set the `kill` parameter to `true`. + * + * Calling this method will emit the `STOP` event. When the final particle has + * expired the `COMPLETE` event will be emitted. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#stop + * @fires Phaser.GameObjects.Particles.Events#STOP + * @since 3.11.0 + * + * @param {boolean} [kill=false] - Kill all particles immediately (true), or leave them to die after their lifespan expires? (false, the default) + * + * @return {this} This Particle Emitter. + */ + stop: function (kill) + { + if (kill === undefined) { kill = false; } - tileHeight *= tilemapLayer.scaleY; - } + if (this.emitting) + { + this.emitting = false; - return layerWorldY + tileY * tileHeight; -}; + if (kill) + { + this.killAll(); + } -module.exports = TileToWorldY; + this.emit(Events.STOP, this); + } + return this; + }, -/***/ }), -/* 255 */ -/***/ (function(module, exports) { + /** + * {@link Phaser.GameObjects.Particles.ParticleEmitter#active Deactivates} the emitter. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#pause + * @since 3.0.0 + * + * @return {this} This Particle Emitter. + */ + pause: function () + { + this.active = false; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -/** - * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the - * layer's position, scale and scroll. - * - * @function Phaser.Tilemaps.Components.WorldToTileX - * @since 3.0.0 - * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. - * @param {?Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {number} The X location in tile units. - */ -var WorldToTileX = function (worldX, snapToFloor, camera, layer) -{ - if (snapToFloor === undefined) { snapToFloor = true; } + /** + * {@link Phaser.GameObjects.Particles.ParticleEmitter#active Activates} the emitter. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#resume + * @since 3.0.0 + * + * @return {this} This Particle Emitter. + */ + resume: function () + { + this.active = true; - var tileWidth = layer.baseTileWidth; - var tilemapLayer = layer.tilemapLayer; + return this; + }, - if (tilemapLayer) + /** + * Set the property by which active particles are sorted prior to be rendered. + * + * It allows you to control the rendering order of the particles. + * + * This can be any valid property of the `Particle` class, such as `y`, `alpha` + * or `lifeT`. + * + * The 'alive' particles array is sorted in place each game frame. Setting a + * sort property will override the `particleBringToTop` setting. + * + * If you wish to use your own sorting function, see `setSortCallback` instead. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setSortProperty + * @since 3.60.0 + * + * @param {string} [property] - The property on the `Particle` class to sort by. + * @param {boolean} [ascending=true] - Should the particles be sorted in ascending or descending order? + * + * @return {this} This Particle Emitter. + */ + setSortProperty: function (property, ascending) { - if (!camera) { camera = tilemapLayer.scene.cameras.main; } + if (property === undefined) { property = ''; } + if (ascending === undefined) { ascending = this.true; } - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's horizontal scroll - worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + this.sortProperty = property; + this.sortOrderAsc = ascending; + this.sortCallback = this.depthSortCallback; - tileWidth *= tilemapLayer.scaleX; - } + return this; + }, - return (snapToFloor) ? Math.floor(worldX / tileWidth) : worldX / tileWidth; -}; + /** + * Sets a callback to be used to sort the particles before rendering each frame. + * + * This allows you to define your own logic and behavior in the callback. + * + * The callback will be sent two parameters: the two Particles being compared, + * and must adhere to the criteria of the `compareFn` in `Array.sort`: + * + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description + * + * Call this method with no parameters to reset the sort callback. + * + * Setting your own callback will override both the `particleBringToTop` and + * `sortProperty` settings of this Emitter. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#setSortCallback + * @since 3.60.0 + * + * @param {Phaser.Types.GameObjects.Particles.ParticleSortCallback} [callback] - The callback to invoke when the particles are sorted. Leave undefined to reset to the default. + * + * @return {this} This Particle Emitter. + */ + setSortCallback: function (callback) + { + if (this.sortProperty !== '') + { + callback = this.depthSortCallback; + } + else + { + callback = null; + } -module.exports = WorldToTileX; + this.sortCallback = callback; + return this; + }, -/***/ }), -/* 256 */ -/***/ (function(module, exports) { + /** + * Sorts active particles with {@link Phaser.GameObjects.Particles.ParticleEmitter#depthSortCallback}. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#depthSort + * @since 3.0.0 + * + * @return {this} This Particle Emitter. + */ + depthSort: function () + { + StableSort(this.alive, this.sortCallback.bind(this)); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -/** - * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the - * layer's position, scale and scroll. - * - * @function Phaser.Tilemaps.Components.WorldToTileY - * @since 3.0.0 - * - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. - * @param {?Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {number} The Y location in tile units. - */ -var WorldToTileY = function (worldY, snapToFloor, camera, layer) -{ - if (snapToFloor === undefined) { snapToFloor = true; } + /** + * Calculates the difference of two particles, for sorting them by depth. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#depthSortCallback + * @since 3.0.0 + * + * @param {object} a - The first particle. + * @param {object} b - The second particle. + * + * @return {number} The difference of a and b's y coordinates. + */ + depthSortCallback: function (a, b) + { + var key = this.sortProperty; - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; + if (this.sortOrderAsc) + { + return a[key] - b[key]; + } + else + { + return b[key] - a[key]; + } + }, - if (tilemapLayer) + /** + * Puts the emitter in flow mode (frequency >= 0) and starts (or restarts) a particle flow. + * + * To resume a flow at the current frequency and quantity, use {@link Phaser.GameObjects.Particles.ParticleEmitter#start} instead. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#flow + * @fires Phaser.GameObjects.Particles.Events#START + * @since 3.0.0 + * + * @param {number} frequency - The time interval (>= 0) of each flow cycle, in ms. + * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} [count=1] - The number of particles to emit at each flow cycle. + * @param {number} [stopAfter] - Stop this emitter from firing any more particles once this value is reached. Set to zero for unlimited. Setting this parameter will override any `stopAfter` value already set in the Emitter configuration object. + * + * @return {this} This Particle Emitter. + */ + flow: function (frequency, count, stopAfter) { - if (!camera) { camera = tilemapLayer.scene.cameras.main; } + if (count === undefined) { count = 1; } - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's vertical scroll - worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + this.emitting = false; - tileHeight *= tilemapLayer.scaleY; - } + this.frequency = frequency; + this.quantity = count; - return (snapToFloor) ? Math.floor(worldY / tileHeight) : worldY / tileHeight; -}; + if (stopAfter !== undefined) + { + this.stopAfter = stopAfter; + } -module.exports = WorldToTileY; + return this.start(); + }, + /** + * Puts the emitter in explode mode (frequency = -1), stopping any current particle flow, and emits several particles all at once. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#explode + * @fires Phaser.GameObjects.Particles.Events#EXPLODE + * @since 3.0.0 + * + * @param {number} [count=this.quantity] - The number of Particles to emit. + * @param {number} [x=this.x] - The x coordinate to emit the Particles from. + * @param {number} [y=this.x] - The y coordinate to emit the Particles from. + * + * @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle. + */ + explode: function (count, x, y) + { + this.frequency = -1; -/***/ }), -/* 257 */ -/***/ (function(module, exports, __webpack_require__) { + this.resetCounters(-1, true); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var particle = this.emitParticle(count, x, y); -var Tile = __webpack_require__(85); -var IsInLayerBounds = __webpack_require__(119); -var CalculateFacesAt = __webpack_require__(252); -var SetTileCollision = __webpack_require__(72); + this.emit(Events.EXPLODE, this, particle); -/** - * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index - * or a Tile object. If you pass in a Tile, all attributes will be copied over to the specified - * location. If you pass in an index, only the index at the specified location will be changed. - * Collision information will be recalculated at the specified location. - * - * @function Phaser.Tilemaps.Components.PutTileAt - * @since 3.0.0 - * - * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map. - */ -var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer) -{ - if (recalculateFaces === undefined) { recalculateFaces = true; } + return particle; + }, - if (!IsInLayerBounds(tileX, tileY, layer)) + /** + * Emits particles at the given position. If no position is given, it will + * emit from this Emitters current location. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#emitParticleAt + * @since 3.0.0 + * + * @param {number} [x=this.x] - The x coordinate to emit the Particles from. + * @param {number} [y=this.x] - The y coordinate to emit the Particles from. + * @param {number} [count=this.quantity] - The number of Particles to emit. + * + * @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle. + */ + emitParticleAt: function (x, y, count) { - return null; - } - - var oldTile = layer.data[tileY][tileX]; - var oldTileCollides = oldTile && oldTile.collides; + return this.emitParticle(count, x, y); + }, - if (tile instanceof Tile) + /** + * Emits particles at a given position (or the emitters current position). + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#emitParticle + * @since 3.0.0 + * + * @param {number} [count=this.quantity] - The number of Particles to emit. + * @param {number} [x=this.x] - The x coordinate to emit the Particles from. + * @param {number} [y=this.x] - The y coordinate to emit the Particles from. + * + * @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle. + * + * @see Phaser.GameObjects.Particles.Particle#fire + */ + emitParticle: function (count, x, y) { - if (layer.data[tileY][tileX] === null) + if (this.atLimit()) { - layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, layer.tileWidth, layer.tileHeight); + return; } - layer.data[tileY][tileX].copy(tile); - } - else - { - var index = tile; - - if (layer.data[tileY][tileX] === null) - { - layer.data[tileY][tileX] = new Tile(layer, index, tileX, tileY, layer.tileWidth, layer.tileHeight); - } - else + if (count === undefined) { - layer.data[tileY][tileX].index = index; + count = this.ops.quantity.onEmit(); } - } - // Updating colliding flag on the new tile - var newTile = layer.data[tileY][tileX]; - var collides = layer.collideIndexes.indexOf(newTile.index) !== -1; + var dead = this.dead; + var stopAfter = this.stopAfter; - SetTileCollision(newTile, collides); + var followX = (this.follow) ? this.follow.x + this.followOffset.x : x; + var followY = (this.follow) ? this.follow.y + this.followOffset.y : y; - // Recalculate faces only if the colliding flag at (tileX, tileY) has changed - if (recalculateFaces && (oldTileCollides !== newTile.collides)) - { - CalculateFacesAt(tileX, tileY, layer); - } + for (var i = 0; i < count; i++) + { + var particle = dead.pop(); - return newTile; -}; + if (!particle) + { + particle = new this.particleClass(this); + } -module.exports = PutTileAt; + if (particle.fire(followX, followY)) + { + if (this.particleBringToTop) + { + this.alive.push(particle); + } + else + { + this.alive.unshift(particle); + } + if (this.emitCallback) + { + this.emitCallback.call(this.emitCallbackScope, particle, this); + } + } + else + { + this.dead.push(particle); + } -/***/ }), -/* 258 */ -/***/ (function(module, exports, __webpack_require__) { + if (stopAfter > 0) + { + this.stopCounter++; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.stopCounter >= stopAfter) + { + break; + } + } -var CONST = __webpack_require__(29); + if (this.atLimit()) + { + break; + } + } -/** - * Get the Tilemap orientation from the given string. - * - * @function Phaser.Tilemaps.Parsers.FromOrientationString - * @since 3.50.0 - * - * @param {string} [orientation] - The orientation type as a string. - * - * @return {Phaser.Tilemaps.OrientationType} The Tilemap Orientation type. - */ -var FromOrientationString = function (orientation) -{ - orientation = orientation.toLowerCase(); + return particle; + }, - if (orientation === 'isometric') - { - return CONST.ISOMETRIC; - } - else if (orientation === 'staggered') - { - return CONST.STAGGERED; - } - else if (orientation === 'hexagonal') - { - return CONST.HEXAGONAL; - } - else + /** + * Fast forwards this Particle Emitter and all of its particles. + * + * Works by running the Emitter `preUpdate` handler in a loop until the `time` + * has been reached at `delta` steps per loop. + * + * All callbacks and emitter related events that would normally be fired + * will still be invoked. + * + * You can make an emitter 'fast forward' via the emitter config using the + * `advance` property. Set this value to the number of ms you wish the + * emitter to be fast-forwarded by. Or, call this method post-creation. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#fastForward + * @since 3.60.0 + * + * @param {number} time - The number of ms to advance the Particle Emitter by. + * @param {number} [delta] - The amount of delta to use for each step. Defaults to 1000 / 60. + * + * @return {this} This Particle Emitter. + */ + fastForward: function (time, delta) { - return CONST.ORTHOGONAL; - } -}; - -module.exports = FromOrientationString; + if (delta === undefined) { delta = 1000 / 60; } + var total = 0; -/***/ }), -/* 259 */ -/***/ (function(module, exports, __webpack_require__) { + this.skipping = true; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + while (total < Math.abs(time)) + { + this.preUpdate(0, delta); -var Formats = __webpack_require__(40); -var LayerData = __webpack_require__(120); -var MapData = __webpack_require__(121); -var Tile = __webpack_require__(85); + total += delta; + } -/** - * Parses a 2D array of tile indexes into a new MapData object with a single layer. - * - * @function Phaser.Tilemaps.Parsers.Parse2DArray - * @since 3.0.0 - * - * @param {string} name - The name of the tilemap, used to set the name on the MapData. - * @param {number[][]} data - 2D array, CSV string or Tiled JSON object. - * @param {number} tileWidth - The width of a tile in pixels. - * @param {number} tileHeight - The height of a tile in pixels. - * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map - * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty - * location will get a Tile object with an index of -1. If you've a large sparsely populated map and - * the tile data doesn't need to change then setting this value to `true` will help with memory - * consumption. However if your map is small or you need to update the tiles dynamically, then leave - * the default value set. - * - * @return {Phaser.Tilemaps.MapData} The MapData object. - */ -var Parse2DArray = function (name, data, tileWidth, tileHeight, insertNull) -{ - var layerData = new LayerData({ - tileWidth: tileWidth, - tileHeight: tileHeight - }); - - var mapData = new MapData({ - name: name, - tileWidth: tileWidth, - tileHeight: tileHeight, - format: Formats.ARRAY_2D, - layers: [ layerData ] - }); + this.skipping = false; - var tiles = []; - var height = data.length; - var width = 0; + return this; + }, - for (var y = 0; y < data.length; y++) + /** + * Updates this emitter and its particles. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#preUpdate + * @fires Phaser.GameObjects.Particles.Events#COMPLETE + * @since 3.0.0 + * + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. + */ + preUpdate: function (time, delta) { - tiles[y] = []; - var row = data[y]; + // Scale the delta + delta *= this.timeScale; - for (var x = 0; x < row.length; x++) + var step = (delta / 1000); + + if (this.trackVisible) { - var tileIndex = parseInt(row[x], 10); + this.visible = this.follow.visible; + } - if (isNaN(tileIndex) || tileIndex === -1) - { - tiles[y][x] = insertNull - ? null - : new Tile(layerData, -1, x, y, tileWidth, tileHeight); - } - else + this.getWorldTransformMatrix(this.worldMatrix); + + // Any particle processors? + var processors = this.getProcessors(); + + var particles = this.alive; + var dead = this.dead; + + var i = 0; + var rip = []; + var length = particles.length; + + for (i = 0; i < length; i++) + { + var particle = particles[i]; + + // update returns `true` if the particle is now dead (lifeCurrent <= 0) + if (particle.update(delta, step, processors)) { - tiles[y][x] = new Tile(layerData, tileIndex, x, y, tileWidth, tileHeight); + rip.push({ index: i, particle: particle }); } } - if (width === 0) - { - width = row.length; - } - } + // Move dead particles to the dead array + length = rip.length; - mapData.width = layerData.width = width; - mapData.height = layerData.height = height; - mapData.widthInPixels = layerData.widthInPixels = width * tileWidth; - mapData.heightInPixels = layerData.heightInPixels = height * tileHeight; - layerData.data = tiles; + if (length > 0) + { + var deathCallback = this.deathCallback; + var deathCallbackScope = this.deathCallbackScope; - return mapData; -}; + for (i = length - 1; i >= 0; i--) + { + var entry = rip[i]; -module.exports = Parse2DArray; + // Remove from particles array + particles.splice(entry.index, 1); + // Add to dead array + dead.push(entry.particle); -/***/ }), -/* 260 */ -/***/ (function(module, exports, __webpack_require__) { + // Callback + if (deathCallback) + { + deathCallback.call(deathCallbackScope, entry.particle); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + entry.particle.setPosition(); + } + } -var Pick = __webpack_require__(571); -var ParseGID = __webpack_require__(261); + if (!this.emitting && !this.skipping) + { + if (this.completeFlag === 1 && particles.length === 0) + { + this.completeFlag = 0; -var copyPoints = function (p) { return { x: p.x, y: p.y }; }; + this.emit(Events.COMPLETE, this); + } -var commonObjectProps = [ 'id', 'name', 'type', 'rotation', 'properties', 'visible', 'x', 'y', 'width', 'height' ]; + return; + } -/** - * Convert a Tiled object to an internal parsed object normalising and copying properties over, while applying optional x and y offsets. The parsed object will always have the properties `id`, `name`, `type`, `rotation`, `properties`, `visible`, `x`, `y`, `width` and `height`. Other properties will be added according to the object type (such as text, polyline, gid etc.) - * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseObject - * @since 3.0.0 - * - * @param {object} tiledObject - Tiled object to convert to an internal parsed object normalising and copying properties over. - * @param {number} [offsetX=0] - Optional additional offset to apply to the object's x property. Defaults to 0. - * @param {number} [offsetY=0] - Optional additional offset to apply to the object's y property. Defaults to 0. - * - * @return {object} The parsed object containing properties read from the Tiled object according to it's type with x and y values updated according to the given offsets. - */ -var ParseObject = function (tiledObject, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (this.frequency === 0) + { + this.emitParticle(); + } + else if (this.frequency > 0) + { + this.flowCounter -= delta; - var parsedObject = Pick(tiledObject, commonObjectProps); + while (this.flowCounter <= 0) + { + // Emits the 'quantity' number of particles + this.emitParticle(); - parsedObject.x += offsetX; - parsedObject.y += offsetY; + // counter = frequency - remainder from previous delta + this.flowCounter += this.frequency; + } + } - if (tiledObject.gid) - { - // Object tiles - var gidInfo = ParseGID(tiledObject.gid); - parsedObject.gid = gidInfo.gid; - parsedObject.flippedHorizontal = gidInfo.flippedHorizontal; - parsedObject.flippedVertical = gidInfo.flippedVertical; - parsedObject.flippedAntiDiagonal = gidInfo.flippedAntiDiagonal; - } - else if (tiledObject.polyline) - { - parsedObject.polyline = tiledObject.polyline.map(copyPoints); - } - else if (tiledObject.polygon) - { - parsedObject.polygon = tiledObject.polygon.map(copyPoints); - } - else if (tiledObject.ellipse) - { - parsedObject.ellipse = tiledObject.ellipse; - } - else if (tiledObject.text) - { - parsedObject.text = tiledObject.text; - } - else if (tiledObject.point) - { - parsedObject.point = true; - } - else - { - // Otherwise, assume it is a rectangle - parsedObject.rectangle = true; - } + // Duration or stopAfter set? + if (!this.skipping) + { + if (this.duration > 0) + { + // elapsed + this.elapsed += delta; - return parsedObject; -}; + if (this.elapsed >= this.duration) + { + this.stop(); + } + } -module.exports = ParseObject; + if (this.stopAfter > 0 && this.stopCounter >= this.stopAfter) + { + this.stop(); + } + } + }, + /** + * Takes either a Rectangle Geometry object or an Arcade Physics Body and tests + * to see if it intersects with any currently alive Particle in this Emitter. + * + * Overlapping particles are returned in an array, where you can perform further + * processing on them. If nothing overlaps then the array will be empty. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#overlap + * @since 3.60.0 + * + * @param {(Phaser.Geom.Rectangle|Phaser.Physics.Arcade.Body)} target - A Rectangle or Arcade Physics Body to check for intersection against all alive particles. + * + * @return {Phaser.GameObjects.Particles.Particle[]} An array of Particles that overlap with the given target. + */ + overlap: function (target) + { + var matrix = this.getWorldTransformMatrix(); -/***/ }), -/* 261 */ -/***/ (function(module, exports) { + var alive = this.alive; + var length = alive.length; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var output = []; -var FLIPPED_HORIZONTAL = 0x80000000; -var FLIPPED_VERTICAL = 0x40000000; -var FLIPPED_ANTI_DIAGONAL = 0x20000000; // Top-right is swapped with bottom-left corners + for (var i = 0; i < length; i++) + { + var particle = alive[i]; -/** - * See Tiled documentation on tile flipping: - * http://docs.mapeditor.org/en/latest/reference/tmx-map-format/ - * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseGID - * @since 3.0.0 - * - * @param {number} gid - A Tiled GID. - * - * @return {Phaser.Types.Tilemaps.GIDData} The GID Data. - */ -var ParseGID = function (gid) -{ - var flippedHorizontal = Boolean(gid & FLIPPED_HORIZONTAL); - var flippedVertical = Boolean(gid & FLIPPED_VERTICAL); - var flippedAntiDiagonal = Boolean(gid & FLIPPED_ANTI_DIAGONAL); - gid = gid & ~(FLIPPED_HORIZONTAL | FLIPPED_VERTICAL | FLIPPED_ANTI_DIAGONAL); + if (RectangleToRectangle(target, particle.getBounds(matrix))) + { + output.push(particle); + } + } - // Parse the flip flags into something Phaser can use - var rotation = 0; - var flipped = false; + return output; + }, - if (flippedHorizontal && flippedVertical && flippedAntiDiagonal) - { - rotation = Math.PI / 2; - flipped = true; - } - else if (flippedHorizontal && flippedVertical && !flippedAntiDiagonal) - { - rotation = Math.PI; - flipped = false; - } - else if (flippedHorizontal && !flippedVertical && flippedAntiDiagonal) - { - rotation = Math.PI / 2; - flipped = false; - } - else if (flippedHorizontal && !flippedVertical && !flippedAntiDiagonal) - { - rotation = 0; - flipped = true; - } - else if (!flippedHorizontal && flippedVertical && flippedAntiDiagonal) - { - rotation = 3 * Math.PI / 2; - flipped = false; - } - else if (!flippedHorizontal && flippedVertical && !flippedAntiDiagonal) - { - rotation = Math.PI; - flipped = true; - } - else if (!flippedHorizontal && !flippedVertical && flippedAntiDiagonal) - { - rotation = 3 * Math.PI / 2; - flipped = true; - } - else if (!flippedHorizontal && !flippedVertical && !flippedAntiDiagonal) + /** + * Returns a bounds Rectangle calculated from the bounds of all currently + * _active_ Particles in this Emitter. If this Emitter has only just been + * created and not yet rendered, then calling this method will return a Rectangle + * with a max safe integer for dimensions. Use the `advance` parameter to + * avoid this. + * + * Typically it takes a few seconds for a flow Emitter to 'warm up'. You can + * use the `advance` and `delta` parameters to force the Emitter to + * 'fast forward' in time to try and allow the bounds to be more accurate, + * as it will calculate the bounds based on the particle bounds across all + * timesteps, giving a better result. + * + * You can also use the `padding` parameter to increase the size of the + * bounds. Emitters with a lot of randomness in terms of direction or lifespan + * can often return a bounds smaller than their possible maximum. By using + * the `padding` (and `advance` if needed) you can help limit this. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#getBounds + * @since 3.60.0 + * + * @param {number} [padding] - The amount of padding, in pixels, to add to the bounds Rectangle. + * @param {number} [advance] - The number of ms to advance the Particle Emitter by. Defaults to 0, i.e. not used. + * @param {number} [delta] - The amount of delta to use for each step. Defaults to 1000 / 60. + * @param {Phaser.Geom.Rectangle} [output] - The Rectangle to store the results in. If not given a new one will be created. + * + * @return {Phaser.Geom.Rectangle} A Rectangle containing the calculated bounds of this Emitter. + */ + getBounds: function (padding, advance, delta, output) { - rotation = 0; - flipped = false; - } + if (padding === undefined) { padding = 0; } + if (advance === undefined) { advance = 0; } + if (delta === undefined) { delta = 1000 / 60; } + if (output === undefined) { output = new Rectangle(); } - return { - gid: gid, - flippedHorizontal: flippedHorizontal, - flippedVertical: flippedVertical, - flippedAntiDiagonal: flippedAntiDiagonal, - rotation: rotation, - flipped: flipped - }; -}; + var matrix = this.getWorldTransformMatrix(); -module.exports = ParseGID; + var i; + var bounds; + var alive = this.alive; + var setFirst = false; + output.setTo(0, 0, 0, 0); -/***/ }), -/* 262 */ -/***/ (function(module, exports, __webpack_require__) { + if (advance > 0) + { + var total = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.skipping = true; -var Formats = __webpack_require__(40); -var MapData = __webpack_require__(121); -var Parse = __webpack_require__(564); -var Tilemap = __webpack_require__(580); + while (total < Math.abs(advance)) + { + this.preUpdate(0, delta); -/** - * Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When - * loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing from - * a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map data. For - * an empty map, you should specify tileWidth, tileHeight, width & height. - * - * @function Phaser.Tilemaps.ParseToTilemap - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene to which this Tilemap belongs. - * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. - * @param {number} [tileWidth=32] - The width of a tile in pixels. - * @param {number} [tileHeight=32] - The height of a tile in pixels. - * @param {number} [width=10] - The width of the map in tiles. - * @param {number} [height=10] - The height of the map in tiles. - * @param {number[][]} [data] - Instead of loading from the cache, you can also load directly from - * a 2D array of tile indexes. - * @param {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the - * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty - * location will get a Tile object with an index of -1. If you've a large sparsely populated map and - * the tile data doesn't need to change then setting this value to `true` will help with memory - * consumption. However if your map is small or you need to update the tiles dynamically, then leave - * the default value set. - * - * @return {Phaser.Tilemaps.Tilemap} - */ -var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height, data, insertNull) -{ - if (tileWidth === undefined) { tileWidth = 32; } - if (tileHeight === undefined) { tileHeight = 32; } - if (width === undefined) { width = 10; } - if (height === undefined) { height = 10; } - if (insertNull === undefined) { insertNull = false; } + for (i = 0; i < alive.length; i++) + { + bounds = alive[i].getBounds(matrix); - var mapData = null; + if (!setFirst) + { + setFirst = true; - if (Array.isArray(data)) - { - var name = key !== undefined ? key : 'map'; - mapData = Parse(name, Formats.ARRAY_2D, data, tileWidth, tileHeight, insertNull); - } - else if (key !== undefined) - { - var tilemapData = scene.cache.tilemap.get(key); + CopyFrom(bounds, output); + } + else + { + MergeRect(output, bounds); + } + } - if (!tilemapData) - { - console.warn('No map data found for key ' + key); + total += delta; + } + + this.skipping = false; } else { - mapData = Parse(key, tilemapData.format, tilemapData.data, tileWidth, tileHeight, insertNull); + for (i = 0; i < alive.length; i++) + { + bounds = alive[i].getBounds(matrix); + + if (!setFirst) + { + setFirst = true; + + CopyFrom(bounds, output); + } + else + { + MergeRect(output, bounds); + } + } } - } - if (mapData === null) - { - mapData = new MapData({ - tileWidth: tileWidth, - tileHeight: tileHeight, - width: width, - height: height - }); - } + if (padding > 0) + { + Inflate(output, padding, padding); + } - return new Tilemap(scene, mapData); -}; + return output; + }, -module.exports = ParseToTilemap; + /** + * Prints a warning to the console if you mistakenly call this function + * thinking it works the same way as Phaser v3.55. + * + * @method Phaser.GameObjects.Particles.ParticleEmitter#createEmitter + * @since 3.60.0 + */ + createEmitter: function () + { + throw new Error('createEmitter removed. See ParticleEmitter docs for info'); + }, + /** + * The x coordinate the particles are emitted from. + * + * This is relative to the Emitters x coordinate and that of any parent. + * + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#particleX + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 + */ + particleX: { -/***/ }), -/* 263 */ -/***/ (function(module, exports, __webpack_require__) { + get: function () + { + return this.ops.x.current; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + set: function (value) + { + this.ops.x.onChange(value); + } -var GetValue = __webpack_require__(6); + }, -/** - * Extracts an array of targets from a Tween configuration object. - * - * The targets will be looked for in a `targets` property. If it's a function, its return value will be used as the result. - * - * @function Phaser.Tweens.Builders.GetTargets - * @since 3.0.0 - * - * @param {object} config - The configuration object to use. - * - * @return {array} An array of targets (may contain only one element), or `null` if no targets were specified. - */ -var GetTargets = function (config) -{ - var targets = GetValue(config, 'targets', null); + /** + * The y coordinate the particles are emitted from. + * + * This is relative to the Emitters x coordinate and that of any parent. + * + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#particleY + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 + */ + particleY: { - if (targets === null) - { - return targets; - } + get: function () + { + return this.ops.y.current; + }, - if (typeof targets === 'function') - { - targets = targets.call(); - } + set: function (value) + { + this.ops.y.onChange(value); + } - if (!Array.isArray(targets)) - { - targets = [ targets ]; - } + }, - return targets; -}; + /** + * The horizontal acceleration applied to emitted particles, in pixels per second squared. + * + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#accelerationX + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 + */ + accelerationX: { -module.exports = GetTargets; + get: function () + { + return this.ops.accelerationX.current; + }, + set: function (value) + { + this.ops.accelerationX.onChange(value); + } -/***/ }), -/* 264 */ -/***/ (function(module, exports) { + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @ignore - */ -function hasGetActive (def) -{ - return (!!def.getActive && typeof def.getActive === 'function'); -} - -/** - * @ignore - */ -function hasGetStart (def) -{ - return (!!def.getStart && typeof def.getStart === 'function'); -} - -/** - * @ignore - */ -function hasGetEnd (def) -{ - return (!!def.getEnd && typeof def.getEnd === 'function'); -} - -/** - * @ignore - */ -function hasGetters (def) -{ - return hasGetStart(def) || hasGetEnd(def) || hasGetActive(def); -} - -/** - * Returns `getActive`, `getStart` and `getEnd` functions for a TweenData based on a target property and end value. - * - * `getActive` if not null, is invoked _immediately_ as soon as the TweenData is running, and is set on the target property. - * `getEnd` is invoked once any start delays have expired and returns what the value should tween to. - * `getStart` is invoked when the tween reaches the end and needs to either repeat or yoyo, it returns the value to go back to. - * - * If the end value is a number, it will be treated as an absolute value and the property will be tweened to it. - * A string can be provided to specify a relative end value which consists of an operation - * (`+=` to add to the current value, `-=` to subtract from the current value, `*=` to multiply the current - * value, or `/=` to divide the current value) followed by its operand. - * - * A function can be provided to allow greater control over the end value; it will receive the target - * object being tweened, the name of the property being tweened, and the current value of the property - * as its arguments. - * - * If both the starting and the ending values need to be controlled, an object with `getStart` and `getEnd` - * callbacks, which will receive the same arguments, can be provided instead. If an object with a `value` - * property is provided, the property will be used as the effective value under the same rules described here. - * - * @function Phaser.Tweens.Builders.GetValueOp - * @since 3.0.0 - * - * @param {string} key - The name of the property to modify. - * @param {*} propertyValue - The ending value of the property, as described above. - * - * @return {function} An array of functions, `getActive`, `getStart` and `getEnd`, which return the starting and the ending value of the property based on the provided value. - */ -var GetValueOp = function (key, propertyValue) -{ - var callbacks; - - // The returned value sets what the property will be at the END of the Tween (usually called at the start of the Tween) - var getEnd = function (target, key, value) { return value; }; - - // The returned value sets what the property will be at the START of the Tween (usually called at the end of the Tween) - var getStart = function (target, key, value) { return value; }; - - // What to set the property to the moment the TweenData is invoked - var getActive = null; - - var t = typeof(propertyValue); - - if (t === 'number') - { - // props: { - // x: 400, - // y: 300 - // } + /** + * The vertical acceleration applied to emitted particles, in pixels per second squared. + * + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#accelerationY + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 + */ + accelerationY: { - getEnd = function () + get: function () { - return propertyValue; - }; - } - else if (t === 'string') - { - // props: { - // x: '+=400', - // y: '-=300', - // z: '*=2', - // w: '/=2' - // } - - var op = propertyValue[0]; - var num = parseFloat(propertyValue.substr(2)); + return this.ops.accelerationY.current; + }, - switch (op) + set: function (value) { - case '+': - getEnd = function (target, key, value) - { - return value + num; - }; - break; - - case '-': - getEnd = function (target, key, value) - { - return value - num; - }; - break; - - case '*': - getEnd = function (target, key, value) - { - return value * num; - }; - break; - - case '/': - getEnd = function (target, key, value) - { - return value / num; - }; - break; - - default: - getEnd = function () - { - return parseFloat(propertyValue); - }; + this.ops.accelerationY.onChange(value); } - } - else if (t === 'function') - { - // The same as setting just the getEnd function and no getStart - - // props: { - // x: function (target, key, value, targetIndex, totalTargets, tween) { return value + 50); }, - // } - - getEnd = propertyValue; - } - else if (t === 'object') - { - if (hasGetters(propertyValue)) - { - /* - x: { - // Called the moment Tween is active. The returned value sets the property on the target immediately. - getActive: function (target, key, value, targetIndex, totalTargets, tween) - { - return value; - }, - - // Called at the start of the Tween. The returned value sets what the property will be at the END of the Tween. - getEnd: function (target, key, value, targetIndex, totalTargets, tween) - { - return value; - }, - - // Called at the end of the Tween. The returned value sets what the property will be at the START of the Tween. - getStart: function (target, key, value, targetIndex, totalTargets, tween) - { - return value; - } - } - */ - if (hasGetActive(propertyValue)) - { - getActive = propertyValue.getActive; - } + }, - if (hasGetEnd(propertyValue)) - { - getEnd = propertyValue.getEnd; - } + /** + * The maximum horizontal velocity emitted particles can reach, in pixels per second squared. + * + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityX + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 + * @default 10000 + */ + maxVelocityX: { - if (hasGetStart(propertyValue)) - { - getStart = propertyValue.getStart; - } - } - else if (propertyValue.hasOwnProperty('value')) + get: function () { - // 'value' may still be a string, function or a number - // props: { - // x: { value: 400, ... }, - // y: { value: 300, ... } - // } + return this.ops.maxVelocityX.current; + }, - callbacks = GetValueOp(key, propertyValue.value); - } - else + set: function (value) { - // 'from' and 'to' may still be a string, function or a number - // props: { - // x: { from: 400, to: 600 }, - // y: { from: 300, to: 500 } - // } - - // Same as above, but the 'start' value is set immediately on the target - // props: { - // x: { start: 400, to: 600 }, - // y: { start: 300, to: 500 } - // } - - // 'start' value is set immediately, then it goes 'from' to 'to' during the tween - // props: { - // x: { start: 200, from: 400, to: 600 }, - // y: { start: 300, from: 300, to: 500 } - // } - - var hasTo = propertyValue.hasOwnProperty('to'); - var hasFrom = propertyValue.hasOwnProperty('from'); - var hasStart = propertyValue.hasOwnProperty('start'); - - if (hasTo && (hasFrom || hasStart)) - { - callbacks = GetValueOp(key, propertyValue.to); - - if (hasStart) - { - var startCallbacks = GetValueOp(key, propertyValue.start); - - callbacks.getActive = startCallbacks.getEnd; - } - - if (hasFrom) - { - var fromCallbacks = GetValueOp(key, propertyValue.from); - - callbacks.getStart = fromCallbacks.getEnd; - } - } + this.ops.maxVelocityX.onChange(value); } - } - - // If callback not set by the else if block above then set it here and return it - if (!callbacks) - { - callbacks = { - getActive: getActive, - getEnd: getEnd, - getStart: getStart - }; - } - - return callbacks; -}; - -module.exports = GetValueOp; - - -/***/ }), -/* 265 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @typedef {object} Phaser.Types.Tweens.TweenConfigDefaults - * @since 3.0.0 - * - * @property {(object|object[])} targets - The object, or an array of objects, to run the tween on. - * @property {number} [delay=0] - The number of milliseconds to delay before the tween will start. - * @property {number} [duration=1000] - The duration of the tween in milliseconds. - * @property {string} [ease='Power0'] - The easing equation to use for the tween. - * @property {array} [easeParams] - Optional easing parameters. - * @property {number} [hold=0] - The number of milliseconds to hold the tween for before yoyo'ing. - * @property {number} [repeat=0] - The number of times to repeat the tween. - * @property {number} [repeatDelay=0] - The number of milliseconds to pause before a tween will repeat. - * @property {boolean} [yoyo=false] - Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take `duration` milliseconds to complete. - * @property {boolean} [flipX=false] - Horizontally flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipX` property. - * @property {boolean} [flipY=false] - Vertically flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipY` property. - */ - -var TWEEN_DEFAULTS = { - targets: null, - delay: 0, - duration: 1000, - ease: 'Power0', - easeParams: null, - hold: 0, - repeat: 0, - repeatDelay: 0, - yoyo: false, - flipX: false, - flipY: false -}; - -module.exports = TWEEN_DEFAULTS; - - -/***/ }), -/* 266 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(267); -var GameObjectCreator = __webpack_require__(16); -var GameObjectFactory = __webpack_require__(5); -var TWEEN_CONST = __webpack_require__(100); -var MATH_CONST = __webpack_require__(14); - -/** - * @classdesc - * A Tween is able to manipulate the properties of one or more objects to any given value, based - * on a duration and type of ease. They are rarely instantiated directly and instead should be - * created via the TweenManager. - * - * @class Tween - * @memberof Phaser.Tweens - * @extends Phaser.Events.EventEmitter - * @constructor - * @since 3.0.0 - * - * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - A reference to the parent of this Tween. Either the Tween Manager or a Tween Timeline instance. - * @param {Phaser.Types.Tweens.TweenDataConfig[]} data - An array of TweenData objects, each containing a unique property to be tweened. - * @param {array} targets - An array of targets to be tweened. - */ -var Tween = new Class({ - - Extends: EventEmitter, - - initialize: - - function Tween (parent, data, targets) - { - EventEmitter.call(this); - - /** - * A reference to the parent of this Tween. - * Either the Tween Manager or a Tween Timeline instance. - * - * @name Phaser.Tweens.Tween#parent - * @type {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} - * @since 3.0.0 - */ - this.parent = parent; - - /** - * Is the parent of this Tween a Timeline? - * - * @name Phaser.Tweens.Tween#parentIsTimeline - * @type {boolean} - * @since 3.0.0 - */ - this.parentIsTimeline = parent.hasOwnProperty('isTimeline'); - - /** - * An array of TweenData objects, each containing a unique property and target being tweened. - * - * @name Phaser.Tweens.Tween#data - * @type {Phaser.Types.Tweens.TweenDataConfig[]} - * @since 3.0.0 - */ - this.data = data; - - /** - * The cached length of the data array. - * - * @name Phaser.Tweens.Tween#totalData - * @type {number} - * @since 3.0.0 - */ - this.totalData = data.length; - - /** - * An array of references to the target/s this Tween is operating on. - * - * @name Phaser.Tweens.Tween#targets - * @type {object[]} - * @since 3.0.0 - */ - this.targets = targets; - - /** - * Cached target total (not necessarily the same as the data total) - * - * @name Phaser.Tweens.Tween#totalTargets - * @type {number} - * @since 3.0.0 - */ - this.totalTargets = targets.length; - - /** - * If `true` then duration, delay, etc values are all frame totals. - * - * @name Phaser.Tweens.Tween#useFrames - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.useFrames = false; - - /** - * Scales the time applied to this Tween. A value of 1 runs in real-time. A value of 0.5 runs 50% slower, and so on. - * Value isn't used when calculating total duration of the tween, it's a run-time delta adjustment only. - * - * @name Phaser.Tweens.Tween#timeScale - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.timeScale = 1; - - /** - * Loop this tween? Can be -1 for an infinite loop, or an integer. - * When enabled it will play through ALL TweenDatas again. Use TweenData.repeat to loop a single element. - * - * @name Phaser.Tweens.Tween#loop - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loop = 0; - - /** - * Time in ms/frames before the tween loops. - * - * @name Phaser.Tweens.Tween#loopDelay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loopDelay = 0; - - /** - * How many loops are left to run? - * - * @name Phaser.Tweens.Tween#loopCounter - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loopCounter = 0; - - /** - * Time in ms/frames before the 'onStart' event fires. - * This is the shortest `delay` value across all of the TweenDatas of this Tween. - * - * @name Phaser.Tweens.Tween#startDelay - * @type {number} - * @default 0 - * @since 3.19.0 - */ - this.startDelay = 0; - - /** - * Has this Tween started playback yet? - * This boolean is toggled when the Tween leaves the 'delayed' state and starts running. - * - * @name Phaser.Tweens.Tween#hasStarted - * @type {boolean} - * @readonly - * @since 3.19.0 - */ - this.hasStarted = false; - - /** - * Is this Tween currently seeking? - * This boolean is toggled in the `Tween.seek` method. - * When a tween is seeking it will not dispatch any events or callbacks. - * - * @name Phaser.Tweens.Tween#isSeeking - * @type {boolean} - * @readonly - * @since 3.19.0 - */ - this.isSeeking = false; - - /** - * Time in ms/frames before the 'onComplete' event fires. This never fires if loop = -1 (as it never completes) - * - * @name Phaser.Tweens.Tween#completeDelay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.completeDelay = 0; - - /** - * Countdown timer (used by timeline offset, loopDelay and completeDelay) - * - * @name Phaser.Tweens.Tween#countdown - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.countdown = 0; - /** - * Set only if this Tween is part of a Timeline. - * - * @name Phaser.Tweens.Tween#offset - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.offset = 0; + }, - /** - * Set only if this Tween is part of a Timeline. The calculated offset amount. - * - * @name Phaser.Tweens.Tween#calculatedOffset - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.calculatedOffset = 0; + /** + * The maximum vertical velocity emitted particles can reach, in pixels per second squared. + * + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityY + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 + * @default 10000 + */ + maxVelocityY: { - /** - * The current state of the tween - * - * @name Phaser.Tweens.Tween#state - * @type {number} - * @since 3.0.0 - */ - this.state = TWEEN_CONST.PENDING_ADD; + get: function () + { + return this.ops.maxVelocityY.current; + }, - /** - * The state of the tween when it was paused (used by Resume) - * - * @name Phaser.Tweens.Tween#_pausedState - * @type {number} - * @private - * @since 3.0.0 - */ - this._pausedState = TWEEN_CONST.INIT; + set: function (value) + { + this.ops.maxVelocityY.onChange(value); + } - /** - * Does the Tween start off paused? (if so it needs to be started with Tween.play) - * - * @name Phaser.Tweens.Tween#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; + }, - /** - * Elapsed time in ms/frames of this run through the Tween. - * - * @name Phaser.Tweens.Tween#elapsed - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.elapsed = 0; + /** + * The initial speed of emitted particles, in pixels per second. + * + * If using this as a getter it will return the `speedX` value. + * + * If using it as a setter it will update both `speedX` and `speedY` to the + * given value. + * + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#speed + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 + */ + speed: { - /** - * Total elapsed time in ms/frames of the entire Tween, including looping. - * - * @name Phaser.Tweens.Tween#totalElapsed - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalElapsed = 0; + get: function () + { + return this.ops.speedX.current; + }, - /** - * Time in ms/frames for the whole Tween to play through once, excluding loop amounts and loop delays. - * - * @name Phaser.Tweens.Tween#duration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.duration = 0; + set: function (value) + { + this.ops.speedX.onChange(value); + this.ops.speedY.onChange(value); + } - /** - * Value between 0 and 1. The amount through the Tween, excluding loops. - * - * @name Phaser.Tweens.Tween#progress - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.progress = 0; + }, - /** - * Time in ms/frames for the Tween to complete (including looping) - * - * @name Phaser.Tweens.Tween#totalDuration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalDuration = 0; + /** + * The initial horizontal speed of emitted particles, in pixels per second. + * + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#speedX + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 + */ + speedX: { - /** - * Value between 0 and 1. The amount through the entire Tween, including looping. - * - * @name Phaser.Tweens.Tween#totalProgress - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalProgress = 0; + get: function () + { + return this.ops.speedX.current; + }, - /** - * An object containing the different Tween callback functions. - * - * You can either set these in the Tween config, or by calling the `Tween.setCallback` method. - * - * `onActive` When the Tween is moved from the pending to the active list in the Tween Manager, even if playback paused. - * `onStart` When the Tween starts playing after a delayed state. Will happen at the same time as `onActive` if it has no delay. - * `onYoyo` When a TweenData starts a yoyo. This happens _after_ the `hold` delay expires, if set. - * `onRepeat` When a TweenData repeats playback. This happens _after_ the `repeatDelay` expires, if set. - * `onComplete` When the Tween finishes playback fully. Never invoked if tween is set to repeat infinitely. - * `onUpdate` When a TweenData updates a property on a source target during playback. - * `onLoop` When a Tween loops. This happens _after_ the `loopDelay` expires, if set. - * - * @name Phaser.Tweens.Tween#callbacks - * @type {object} - * @since 3.0.0 - */ - this.callbacks = { - onActive: null, - onComplete: null, - onLoop: null, - onRepeat: null, - onStart: null, - onStop: null, - onUpdate: null, - onYoyo: null - }; + set: function (value) + { + this.ops.speedX.onChange(value); + } - /** - * The context in which all callbacks are invoked. - * - * @name Phaser.Tweens.Tween#callbackScope - * @type {any} - * @since 3.0.0 - */ - this.callbackScope; }, /** - * Returns the current value of the specified Tween Data. + * The initial vertical speed of emitted particles, in pixels per second. * - * @method Phaser.Tweens.Tween#getValue - * @since 3.0.0 - * - * @param {number} [index=0] - The Tween Data to return the value from. + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. * - * @return {number} The value of the requested Tween Data. + * @name Phaser.GameObjects.Particles.ParticleEmitter#speedY + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 */ - getValue: function (index) - { - if (index === undefined) { index = 0; } + speedY: { + + get: function () + { + return this.ops.speedY.current; + }, + + set: function (value) + { + this.ops.speedY.onChange(value); + } - return this.data[index].current; }, /** - * Set the scale the time applied to this Tween. A value of 1 runs in real-time. A value of 0.5 runs 50% slower, and so on. - * - * @method Phaser.Tweens.Tween#setTimeScale - * @since 3.0.0 + * The x coordinate emitted particles move toward, when {@link Phaser.GameObjects.Particles.ParticleEmitter#moveTo} is true. * - * @param {number} value - The scale factor for timescale. + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. * - * @return {this} - This Tween instance. + * @name Phaser.GameObjects.Particles.ParticleEmitter#moveToX + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 */ - setTimeScale: function (value) - { - this.timeScale = value; + moveToX: { + + get: function () + { + return this.ops.moveToX.current; + }, + + set: function (value) + { + this.ops.moveToX.onChange(value); + } - return this; }, /** - * Returns the scale of the time applied to this Tween. + * The y coordinate emitted particles move toward, when {@link Phaser.GameObjects.Particles.ParticleEmitter#moveTo} is true. * - * @method Phaser.Tweens.Tween#getTimeScale - * @since 3.0.0 + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. * - * @return {number} The timescale of this tween (between 0 and 1) + * @name Phaser.GameObjects.Particles.ParticleEmitter#moveToY + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 */ - getTimeScale: function () - { - return this.timeScale; + moveToY: { + + get: function () + { + return this.ops.moveToY.current; + }, + + set: function (value) + { + this.ops.moveToY.onChange(value); + } + }, /** - * Checks if the Tween is currently active. + * The amount of velocity particles will use when rebounding off the + * emitter bounds, if set. A value of 0 means no bounce. A value of 1 + * means a full rebound. * - * @method Phaser.Tweens.Tween#isPlaying - * @since 3.0.0 + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. * - * @return {boolean} `true` if the Tween is active, otherwise `false`. + * @name Phaser.GameObjects.Particles.ParticleEmitter#bounce + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 */ - isPlaying: function () - { - return (this.state === TWEEN_CONST.ACTIVE); + bounce: { + + get: function () + { + return this.ops.bounce.current; + }, + + set: function (value) + { + this.ops.bounce.onChange(value); + } + }, /** - * Checks if the Tween is currently paused. + * The horizontal scale of emitted particles. * - * @method Phaser.Tweens.Tween#isPaused - * @since 3.0.0 + * This is relative to the Emitters scale and that of any parent. * - * @return {boolean} `true` if the Tween is paused, otherwise `false`. + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#particleScaleX + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 */ - isPaused: function () - { - return (this.state === TWEEN_CONST.PAUSED); + particleScaleX: { + + get: function () + { + return this.ops.scaleX.current; + }, + + set: function (value) + { + this.ops.scaleX.onChange(value); + } + }, /** - * See if this Tween is currently acting upon the given target. + * The vertical scale of emitted particles. * - * @method Phaser.Tweens.Tween#hasTarget - * @since 3.0.0 + * This is relative to the Emitters scale and that of any parent. * - * @param {object} target - The target to check against this Tween. + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. * - * @return {boolean} `true` if the given target is a target of this Tween, otherwise `false`. + * @name Phaser.GameObjects.Particles.ParticleEmitter#particleScaleY + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 */ - hasTarget: function (target) - { - return (this.targets.indexOf(target) !== -1); + particleScaleY: { + + get: function () + { + return this.ops.scaleY.current; + }, + + set: function (value) + { + this.ops.scaleY.onChange(value); + } + }, /** - * Updates the 'end' value of the given property across all matching targets. + * A color tint value that is applied to the texture of the emitted + * particle. The value should be given in hex format, i.e. 0xff0000 + * for a red tint, and should not include the alpha channel. * - * Calling this does not adjust the duration of the tween, or the current progress. + * Tints are additive, meaning a tint value of white (0xffffff) will + * effectively reset the tint to nothing. * - * You can optionally tell it to set the 'start' value to be the current value (before the change). + * Modify the `ParticleEmitter.tintFill` property to change between + * an additive and replacement tint mode. * - * @method Phaser.Tweens.Tween#updateTo - * @since 3.0.0 + * When you define the color via the Emitter config you should give + * it as an array of color values. The Particle will then interpolate + * through these colors over the course of its lifespan. Setting this + * will override any `tint` value that may also be given. * - * @param {string} key - The property to set the new value for. - * @param {*} value - The new value of the property. - * @param {boolean} [startToCurrent=false] - Should this change set the start value to be the current value? + * This is a WebGL only feature. * - * @return {this} - This Tween instance. + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#particleColor + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 */ - updateTo: function (key, value, startToCurrent) - { - if (startToCurrent === undefined) { startToCurrent = false; } + particleColor: { - for (var i = 0; i < this.totalData; i++) + get: function () { - var tweenData = this.data[i]; - - if (tweenData.key === key) - { - tweenData.end = value; + return this.ops.color.current; + }, - if (startToCurrent) - { - tweenData.start = tweenData.current; - } - } + set: function (value) + { + this.ops.color.onChange(value); } - return this; }, /** - * Restarts the tween from the beginning. + * Controls the easing function used when you have created an + * Emitter that uses the `color` property to interpolate the + * tint of Particles over their lifetime. * - * @method Phaser.Tweens.Tween#restart - * @since 3.0.0 + * Setting this has no effect if you haven't also applied a + * `particleColor` to this Emitter. * - * @return {this} This Tween instance. + * @name Phaser.GameObjects.Particles.ParticleEmitter#colorEase + * @type {string} + * @since 3.60.0 */ - restart: function () - { - // Reset these so they're ready for the next update - this.elapsed = 0; - this.progress = 0; - this.totalElapsed = 0; - this.totalProgress = 0; + colorEase: { - if (this.state === TWEEN_CONST.ACTIVE) - { - return this.seek(0); - } - else if (this.state === TWEEN_CONST.REMOVED) + get: function () { - this.seek(0); - this.parent.makeActive(this); + return this.ops.color.easeName; + }, - return this; - } - else if (this.state === TWEEN_CONST.PENDING_ADD) - { - return this; - } - else + set: function (value) { - return this.play(); + this.ops.color.setEase(value); } + }, /** - * Internal method that calculates the overall duration of the Tween. + * A color tint value that is applied to the texture of the emitted + * particle. The value should be given in hex format, i.e. 0xff0000 + * for a red tint, and should not include the alpha channel. * - * @method Phaser.Tweens.Tween#calcDuration - * @since 3.0.0 + * Tints are additive, meaning a tint value of white (0xffffff) will + * effectively reset the tint to nothing. + * + * Modify the `ParticleEmitter.tintFill` property to change between + * an additive and replacement tint mode. + * + * The `tint` value will be overriden if a `color` array is provided. + * + * This is a WebGL only feature. + * + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#particleTint + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 */ - calcDuration: function () - { - var maxDuration = 0; - var minDelay = MATH_CONST.MAX_SAFE_INTEGER; + particleTint: { - var data = this.data; - - for (var i = 0; i < this.totalData; i++) + get: function () { - var tweenData = data[i]; - - // Set t1 (duration + hold + yoyo) - tweenData.t1 = tweenData.duration + tweenData.hold; - - if (tweenData.yoyo) - { - tweenData.t1 += tweenData.duration; - } - - // Set t2 (repeatDelay + duration + hold + yoyo) - tweenData.t2 = tweenData.t1 + tweenData.repeatDelay; - - // Total Duration - tweenData.totalDuration = tweenData.delay + tweenData.t1; - - if (tweenData.repeat === -1) - { - tweenData.totalDuration += (tweenData.t2 * 999999999999); - } - else if (tweenData.repeat > 0) - { - tweenData.totalDuration += (tweenData.t2 * tweenData.repeat); - } - - if (tweenData.totalDuration > maxDuration) - { - // Get the longest TweenData from the Tween, used to calculate the Tween TD - maxDuration = tweenData.totalDuration; - } + return this.ops.tint.current; + }, - if (tweenData.delay < minDelay) - { - minDelay = tweenData.delay; - } + set: function (value) + { + this.ops.tint.onChange(value); } - // Excludes loop values - - // If duration has been set to 0 then we give it a super-low value so that it always - // renders at least 1 frame, but no more, without causing divided by zero errors elsewhere. - this.duration = Math.max(maxDuration, 0.001); + }, - this.loopCounter = (this.loop === -1) ? 999999999999 : this.loop; + /** + * The alpha value of the emitted particles. This is a value + * between 0 and 1. Particles with alpha zero are invisible + * and are therefore not rendered, but are still processed + * by the Emitter. + * + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#particleAlpha + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 + */ + particleAlpha: { - if (this.loopCounter > 0) + get: function () { - this.totalDuration = this.duration + this.completeDelay + ((this.duration + this.loopDelay) * this.loopCounter); - } - else + return this.ops.alpha.current; + }, + + set: function (value) { - this.totalDuration = this.duration + this.completeDelay; + this.ops.alpha.onChange(value); } - // How long before this Tween starts playback? - this.startDelay = minDelay; }, /** - * Called by TweenManager.preUpdate as part of its loop to check pending and active tweens. - * Should not be called directly. + * The lifespan of the emitted particles. This value is given + * in milliseconds and defaults to 1000ms (1 second). When a + * particle reaches this amount it is killed. * - * @method Phaser.Tweens.Tween#init - * @since 3.0.0 + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. * - * @return {boolean} Returns `true` if this Tween should be moved from the pending list to the active list by the Tween Manager. + * @name Phaser.GameObjects.Particles.ParticleEmitter#lifespan + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 */ - init: function () - { - // You can't have a paused Tween if it's part of a Timeline - if (this.paused && !this.parentIsTimeline) + lifespan: { + + get: function () { - this.state = TWEEN_CONST.PENDING_ADD; - this._pausedState = TWEEN_CONST.INIT; + return this.ops.lifespan.current; + }, - return false; + set: function (value) + { + this.ops.lifespan.onChange(value); } - var data = this.data; - var totalTargets = this.totalTargets; + }, - for (var i = 0; i < this.totalData; i++) - { - var tweenData = data[i]; - var target = tweenData.target; - var gen = tweenData.gen; - var key = tweenData.key; - var targetIndex = tweenData.index; + /** + * The angle at which the particles are emitted. The values are + * given in degrees. This allows you to control the direction + * of the emitter. If you wish instead to change the rotation + * of the particles themselves, see the `particleRotate` property. + * + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#particleAngle + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 + */ + particleAngle: { - // Old function signature: i, totalTargets, target - // New function signature: target, key, value, index, total, tween + get: function () + { + return this.ops.angle.current; + }, - tweenData.delay = gen.delay(target, key, 0, targetIndex, totalTargets, this); - tweenData.duration = Math.max(gen.duration(target, key, 0, targetIndex, totalTargets, this), 0.001); - tweenData.hold = gen.hold(target, key, 0, targetIndex, totalTargets, this); - tweenData.repeat = gen.repeat(target, key, 0, targetIndex, totalTargets, this); - tweenData.repeatDelay = gen.repeatDelay(target, key, 0, targetIndex, totalTargets, this); + set: function (value) + { + this.ops.angle.onChange(value); } - this.calcDuration(); - - this.progress = 0; - this.totalProgress = 0; - this.elapsed = 0; - this.totalElapsed = 0; - - this.state = TWEEN_CONST.INIT; - - return true; }, /** - * Internal method that makes this Tween active within the TweenManager - * and emits the onActive event and callback. + * The rotation (or angle) of each particle when it is emitted. + * The value is given in degrees and uses a right-handed + * coordinate system, where 0 degrees points to the right, 90 degrees + * points down and -90 degrees points up. * - * @method Phaser.Tweens.Tween#makeActive - * @fires Phaser.Tweens.Events#TWEEN_ACTIVE - * @since 3.19.0 + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#particleRotate + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 */ - makeActive: function () - { - this.parent.makeActive(this); + particleRotate: { + + get: function () + { + return this.ops.rotate.current; + }, + + set: function (value) + { + this.ops.rotate.onChange(value); + } - this.dispatchTweenEvent(Events.TWEEN_ACTIVE, this.callbacks.onActive); }, /** - * Internal method that advances to the next state of the Tween during playback. + * The number of particles that are emitted each time an emission + * occurs, i.e. from one 'explosion' or each frame in a 'flow' cycle. * - * @method Phaser.Tweens.Tween#nextState - * @fires Phaser.Tweens.Events#TWEEN_COMPLETE - * @fires Phaser.Tweens.Events#TWEEN_LOOP - * @since 3.0.0 + * The default is 1. + * + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#quantity + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrequency + * @see Phaser.GameObjects.Particles.ParticleEmitter#setQuantity + * @since 3.60.0 */ - nextState: function () - { - if (this.loopCounter > 0) - { - this.elapsed = 0; - this.progress = 0; - this.loopCounter--; - - this.resetTweenData(true); - - if (this.loopDelay > 0) - { - this.countdown = this.loopDelay; - this.state = TWEEN_CONST.LOOP_DELAY; - } - else - { - this.state = TWEEN_CONST.ACTIVE; + quantity: { - this.dispatchTweenEvent(Events.TWEEN_LOOP, this.callbacks.onLoop); - } - } - else if (this.completeDelay > 0) + get: function () { - this.state = TWEEN_CONST.COMPLETE_DELAY; + return this.ops.quantity.current; + }, - this.countdown = this.completeDelay; - } - else + set: function (value) { - this.state = TWEEN_CONST.PENDING_REMOVE; - - this.dispatchTweenEvent(Events.TWEEN_COMPLETE, this.callbacks.onComplete); + this.ops.quantity.onChange(value); } + }, /** - * Pauses the Tween immediately. Use `resume` to continue playback. + * The number of milliseconds to wait after emission before + * the particles start updating. This allows you to emit particles + * that appear 'static' or still on-screen and then, after this value, + * begin to move. * - * @method Phaser.Tweens.Tween#pause - * @since 3.0.0 + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. * - * @return {this} - This Tween instance. + * @name Phaser.GameObjects.Particles.ParticleEmitter#delay + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 */ - pause: function () - { - if (this.state === TWEEN_CONST.PAUSED) - { - return this; - } - - this.paused = true; + delay: { - this._pausedState = this.state; + get: function () + { + return this.ops.delay.current; + }, - this.state = TWEEN_CONST.PAUSED; + set: function (value) + { + this.ops.delay.onChange(value); + } - return this; }, /** - * Starts a Tween playing. - * - * You only need to call this method if you have configured the tween to be paused on creation. - * - * If the Tween is already playing, calling this method again will have no effect. If you wish to - * restart the Tween, use `Tween.restart` instead. - * - * Calling this method after the Tween has completed will start the Tween playing again from the start. - * This is the same as calling `Tween.seek(0)` and then `Tween.play()`. + * The number of milliseconds to wait after a particle has finished + * its life before it will be removed. This allows you to 'hold' a + * particle on the screen once it has reached its final state + * before it then vanishes. * - * @method Phaser.Tweens.Tween#play - * @since 3.0.0 + * Note that all particle updates will cease, including changing + * alpha, scale, movement or animation. * - * @param {boolean} [resetFromTimeline=false] - Is this Tween being played as part of a Timeline? + * Accessing this property should typically return a number. + * However, it can be set to any valid EmitterOp onEmit type. * - * @return {this} This Tween instance. + * @name Phaser.GameObjects.Particles.ParticleEmitter#hold + * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} + * @since 3.60.0 */ - play: function (resetFromTimeline) - { - if (resetFromTimeline === undefined) { resetFromTimeline = false; } - - var state = this.state; + hold: { - if (state === TWEEN_CONST.INIT && !this.parentIsTimeline) + get: function () { - this.resetTweenData(false); - - this.state = TWEEN_CONST.ACTIVE; + return this.ops.hold.current; + }, - return this; - } - else if (state === TWEEN_CONST.ACTIVE || (state === TWEEN_CONST.PENDING_ADD && this._pausedState === TWEEN_CONST.PENDING_ADD)) - { - return this; - } - else if (!this.parentIsTimeline && (state === TWEEN_CONST.PENDING_REMOVE || state === TWEEN_CONST.REMOVED)) + set: function (value) { - this.seek(0); - this.parent.makeActive(this); - - return this; + this.ops.hold.onChange(value); } - if (this.parentIsTimeline) - { - this.resetTweenData(resetFromTimeline); + }, - if (this.calculatedOffset === 0) - { - this.state = TWEEN_CONST.ACTIVE; - } - else - { - this.countdown = this.calculatedOffset; + /** + * The internal flow counter. + * + * Treat this property as read-only. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#flowCounter + * @type {number} + * @since 3.60.0 + */ + flowCounter: { - this.state = TWEEN_CONST.OFFSET_DELAY; - } - } - else if (this.paused) + get: function () { - this.paused = false; + return this.counters[0]; + }, - this.makeActive(); - } - else + set: function (value) { - this.resetTweenData(resetFromTimeline); - - this.state = TWEEN_CONST.ACTIVE; - - this.makeActive(); + this.counters[0] = value; } - return this; }, /** - * Internal method that resets all of the Tween Data, including the progress and elapsed values. + * The internal frame counter. * - * @method Phaser.Tweens.Tween#resetTweenData - * @since 3.0.0 + * Treat this property as read-only. * - * @param {boolean} resetFromLoop - Has this method been called as part of a loop? + * @name Phaser.GameObjects.Particles.ParticleEmitter#frameCounter + * @type {number} + * @since 3.60.0 */ - resetTweenData: function (resetFromLoop) - { - var data = this.data; - var total = this.totalData; - var totalTargets = this.totalTargets; + frameCounter: { - for (var i = 0; i < total; i++) + get: function () { - var tweenData = data[i]; - - var target = tweenData.target; - var key = tweenData.key; - var targetIndex = tweenData.index; - - tweenData.progress = 0; - tweenData.elapsed = 0; - - tweenData.repeatCounter = (tweenData.repeat === -1) ? 999999999999 : tweenData.repeat; - - if (resetFromLoop) - { - tweenData.start = tweenData.getStartValue(target, key, tweenData.start, targetIndex, totalTargets, this); - - tweenData.end = tweenData.getEndValue(target, key, tweenData.end, targetIndex, totalTargets, this); + return this.counters[1]; + }, - tweenData.current = tweenData.start; + set: function (value) + { + this.counters[1] = value; + } - tweenData.state = TWEEN_CONST.PLAYING_FORWARD; - } - else - { - tweenData.state = TWEEN_CONST.PENDING_RENDER; - } + }, - if (tweenData.delay > 0) - { - tweenData.elapsed = tweenData.delay; + /** + * The internal animation counter. + * + * Treat this property as read-only. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#animCounter + * @type {number} + * @since 3.60.0 + */ + animCounter: { - tweenData.state = TWEEN_CONST.DELAY; - } + get: function () + { + return this.counters[2]; + }, - if (tweenData.getActiveValue) - { - target[key] = tweenData.getActiveValue(tweenData.target, tweenData.key, tweenData.start); - } + set: function (value) + { + this.counters[2] = value; } + }, /** - * Resumes the playback of a previously paused Tween. + * The internal elasped counter. * - * @method Phaser.Tweens.Tween#resume - * @since 3.0.0 + * Treat this property as read-only. * - * @return {this} - This Tween instance. + * @name Phaser.GameObjects.Particles.ParticleEmitter#elapsed + * @type {number} + * @since 3.60.0 */ - resume: function () - { - if (this.state === TWEEN_CONST.PAUSED) + elapsed: { + + get: function () { - this.paused = false; + return this.counters[3]; + }, - this.state = this._pausedState; - } - else + set: function (value) { - this.play(); + this.counters[3] = value; } - return this; }, /** - * Seeks to a specific point in the Tween. - * - * **Note:** Be careful when seeking a Tween that repeats or loops forever, - * or that has an unusually long total duration, as it's possible to hang the browser. - * - * The given position is a value between 0 and 1 which represents how far through the Tween to seek to. - * A value of 0.5 would seek to half-way through the Tween, where-as a value of zero would seek to the start. - * - * Note that the seek takes the entire duration of the Tween into account, including delays, loops and repeats. - * For example, a Tween that lasts for 2 seconds, but that loops 3 times, would have a total duration of 6 seconds, - * so seeking to 0.5 would seek to 3 seconds into the Tween, as that's half-way through its _entire_ duration. - * - * Seeking works by resetting the Tween to its initial values and then iterating through the Tween at `delta` - * jumps per step. The longer the Tween, the longer this can take. - * - * @method Phaser.Tweens.Tween#seek - * @since 3.0.0 + * The internal stop counter. * - * @param {number} toPosition - A value between 0 and 1 which represents the progress point to seek to. - * @param {number} [delta=16.6] - The size of each step when seeking through the Tween. A higher value completes faster but at a cost of less precision. + * Treat this property as read-only. * - * @return {this} This Tween instance. + * @name Phaser.GameObjects.Particles.ParticleEmitter#stopCounter + * @type {number} + * @since 3.60.0 */ - seek: function (toPosition, delta) - { - if (delta === undefined) { delta = 16.6; } + stopCounter: { + + get: function () + { + return this.counters[4]; + }, - if (this.state === TWEEN_CONST.REMOVED) + set: function (value) { - this.makeActive(); + this.counters[4] = value; } - this.elapsed = 0; - this.progress = 0; - this.totalElapsed = 0; - this.totalProgress = 0; + }, - var data = this.data; - var totalTargets = this.totalTargets; + /** + * The internal complete flag. + * + * Treat this property as read-only. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#completeFlag + * @type {boolean} + * @since 3.60.0 + */ + completeFlag: { - for (var i = 0; i < this.totalData; i++) + get: function () { - var tweenData = data[i]; - var target = tweenData.target; - var gen = tweenData.gen; - var key = tweenData.key; - var targetIndex = tweenData.index; - - tweenData.progress = 0; - tweenData.elapsed = 0; - - tweenData.repeatCounter = (tweenData.repeat === -1) ? 999999999999 : tweenData.repeat; + return this.counters[5]; + }, - // Old function signature: i, totalTargets, target - // New function signature: target, key, value, index, total, tween + set: function (value) + { + this.counters[5] = value; + } - tweenData.delay = gen.delay(target, key, 0, targetIndex, totalTargets, this); - tweenData.duration = Math.max(gen.duration(target, key, 0, targetIndex, totalTargets, this), 0.001); - tweenData.hold = gen.hold(target, key, 0, targetIndex, totalTargets, this); - tweenData.repeat = gen.repeat(target, key, 0, targetIndex, totalTargets, this); - tweenData.repeatDelay = gen.repeatDelay(target, key, 0, targetIndex, totalTargets, this); + }, - tweenData.current = tweenData.start; - tweenData.state = TWEEN_CONST.PLAYING_FORWARD; + /** + * The internal zone index. + * + * Treat this property as read-only. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#zoneIndex + * @type {number} + * @since 3.60.0 + */ + zoneIndex: { - this.updateTweenData(this, tweenData, 0, targetIndex, totalTargets); + get: function () + { + return this.counters[6]; + }, - if (tweenData.delay > 0) - { - tweenData.elapsed = tweenData.delay; - tweenData.state = TWEEN_CONST.DELAY; - } + set: function (value) + { + this.counters[6] = value; } - this.calcDuration(); + }, - var wasPaused = false; + /** + * The internal zone total. + * + * Treat this property as read-only. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#zoneTotal + * @type {number} + * @since 3.60.0 + */ + zoneTotal: { - if (this.state === TWEEN_CONST.PAUSED) + get: function () { - wasPaused = true; + return this.counters[7]; + }, - this.state = TWEEN_CONST.ACTIVE; + set: function (value) + { + this.counters[7] = value; } - this.isSeeking = true; - - do - { - this.update(0, delta); + }, - } while (this.totalProgress < toPosition); + /** + * The current frame index. + * + * Treat this property as read-only. + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#currentFrame + * @type {number} + * @since 3.60.0 + */ + currentFrame: { - this.isSeeking = false; + get: function () + { + return this.counters[8]; + }, - if (wasPaused) + set: function (value) { - this.state = TWEEN_CONST.PAUSED; + this.counters[8] = value; } - return this; }, /** - * Sets an event based callback to be invoked during playback. - * - * Calling this method will replace a previously set callback for the given type, if any exists. + * The current animation index. * - * The types available are: - * - * `onActive` When the Tween is moved from the pending to the active list in the Tween Manager, even if playback paused. - * `onStart` When the Tween starts playing after a delayed state. Will happen at the same time as `onActive` if it has no delay. - * `onYoyo` When a TweenData starts a yoyo. This happens _after_ the `hold` delay expires, if set. - * `onRepeat` When a TweenData repeats playback. This happens _after_ the `repeatDelay` expires, if set. - * `onComplete` When the Tween finishes playback fully or `Tween.stop` is called. Never invoked if tween is set to repeat infinitely. - * `onUpdate` When a TweenData updates a property on a source target during playback. - * `onLoop` When a Tween loops. This happens _after_ the `loopDelay` expires, if set. - * - * @method Phaser.Tweens.Tween#setCallback - * @since 3.0.0 + * Treat this property as read-only. * - * @param {string} type - Type of the callback to set. - * @param {function} callback - The function to invoke when this callback happens. - * @param {array} [params] - An array of parameters for specified callbacks types. - * @param {any} [scope] - The context the callback will be invoked in. - * - * @return {this} This Tween instance. - */ - setCallback: function (type, callback, params, scope) - { - this.callbacks[type] = { func: callback, scope: scope, params: params }; - - return this; - }, - - /** - * Flags the Tween as being complete, whatever stage of progress it is at. - * - * If an onComplete callback has been defined it will automatically invoke it, unless a `delay` - * argument is provided, in which case the Tween will delay for that period of time before calling the callback. - * - * If you don't need a delay, or have an onComplete callback, then call `Tween.stop` instead. - * - * @method Phaser.Tweens.Tween#complete - * @fires Phaser.Tweens.Events#TWEEN_COMPLETE - * @since 3.2.0 - * - * @param {number} [delay=0] - The time to wait before invoking the complete callback. If zero it will fire immediately. - * - * @return {this} This Tween instance. + * @name Phaser.GameObjects.Particles.ParticleEmitter#currentAnim + * @type {number} + * @since 3.60.0 */ - complete: function (delay) - { - if (delay === undefined) { delay = 0; } + currentAnim: { - if (delay) + get: function () { - this.state = TWEEN_CONST.COMPLETE_DELAY; + return this.counters[9]; + }, - this.countdown = delay; - } - else + set: function (value) { - this.state = TWEEN_CONST.PENDING_REMOVE; - - this.dispatchTweenEvent(Events.TWEEN_COMPLETE, this.callbacks.onComplete); + this.counters[9] = value; } - return this; }, /** - * Immediately removes this Tween from the TweenManager and all of its internal arrays, - * no matter what stage it as it. Then sets the tween state to `REMOVED`. - * - * You should dispose of your reference to this tween after calling this method, to - * free it from memory. + * Destroys this Particle Emitter and all Particles it owns. * - * @method Phaser.Tweens.Tween#remove - * @since 3.17.0 - * - * @return {this} This Tween instance. + * @method Phaser.GameObjects.Particles.ParticleEmitter#preDestroy + * @since 3.60.0 */ - remove: function () + preDestroy: function () { - this.parent.remove(this); + this.texture = null; + this.frames = null; + this.anims = null; + this.emitCallback = null; + this.emitCallbackScope = null; + this.deathCallback = null; + this.deathCallbackScope = null; + this.emitZones = null; + this.deathZones = null; + this.bounds = null; + this.follow = null; + this.counters = null; - return this; - }, + var i; - /** - * Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager. - * - * @method Phaser.Tweens.Tween#stop - * @since 3.0.0 - * - * @param {number} [resetTo] - If you want to seek the tween, provide a value between 0 and 1. - * - * @return {this} This Tween instance. - */ - stop: function (resetTo) - { - if (this.state === TWEEN_CONST.ACTIVE) - { - if (resetTo !== undefined) - { - this.seek(resetTo); - } - } + var ops = this.ops; - if (this.state !== TWEEN_CONST.REMOVED) + for (i = 0; i < configOpMap.length; i++) { - if (this.state === TWEEN_CONST.PAUSED || this.state === TWEEN_CONST.PENDING_ADD) - { - if (this.parentIsTimeline) - { - this.parent.manager._destroy.push(this); - this.parent.manager._toProcess++; - } - else - { - this.parent._destroy.push(this); - this.parent._toProcess++; - } - } + var key = configOpMap[i]; - this.dispatchTweenEvent(Events.TWEEN_STOP, this.callbacks.onStop); - - this.removeAllListeners(); - - this.state = TWEEN_CONST.PENDING_REMOVE; + ops[key].destroy(); } - return this; - }, - - /** - * Internal method that advances the Tween based on the time values. - * - * @method Phaser.Tweens.Tween#update - * @fires Phaser.Tweens.Events#TWEEN_COMPLETE - * @fires Phaser.Tweens.Events#TWEEN_LOOP - * @fires Phaser.Tweens.Events#TWEEN_START - * @since 3.0.0 - * - * @param {number} timestamp - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - * - * @return {boolean} Returns `true` if this Tween has finished and should be removed from the Tween Manager, otherwise returns `false`. - */ - update: function (timestamp, delta) - { - if (this.state === TWEEN_CONST.PAUSED) + for (i = 0; i < this.alive.length; i++) { - return false; + this.alive[i].destroy(); } - if (this.useFrames) + for (i = 0; i < this.dead.length; i++) { - delta = 1 * this.parent.timeScale; + this.dead[i].destroy(); } - delta *= this.timeScale; - - this.elapsed += delta; - this.progress = Math.min(this.elapsed / this.duration, 1); - - this.totalElapsed += delta; - this.totalProgress = Math.min(this.totalElapsed / this.totalDuration, 1); - - switch (this.state) - { - case TWEEN_CONST.ACTIVE: - - if (!this.hasStarted && !this.isSeeking) - { - this.startDelay -= delta; - - if (this.startDelay <= 0) - { - this.hasStarted = true; - - this.dispatchTweenEvent(Events.TWEEN_START, this.callbacks.onStart); - } - } - - var stillRunning = false; - - for (var i = 0; i < this.totalData; i++) - { - var tweenData = this.data[i]; - - if (this.updateTweenData(this, tweenData, delta)) - { - stillRunning = true; - } - } - - // Anything still running? If not, we're done - if (!stillRunning) - { - this.nextState(); - } - - break; - - case TWEEN_CONST.LOOP_DELAY: - - this.countdown -= delta; - - if (this.countdown <= 0) - { - this.state = TWEEN_CONST.ACTIVE; - - this.dispatchTweenEvent(Events.TWEEN_LOOP, this.callbacks.onLoop); - } - - break; - - case TWEEN_CONST.OFFSET_DELAY: + this.ops = null; + this.alive = []; + this.dead = []; + this.worldMatrix.destroy(); + } - this.countdown -= delta; +}); - if (this.countdown <= 0) - { - this.state = TWEEN_CONST.ACTIVE; - } +module.exports = ParticleEmitter; - break; - case TWEEN_CONST.COMPLETE_DELAY: +/***/ }), - this.countdown -= delta; +/***/ 10456: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (this.countdown <= 0) - { - this.state = TWEEN_CONST.PENDING_REMOVE; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.dispatchTweenEvent(Events.TWEEN_COMPLETE, this.callbacks.onComplete); - } +var RectangleToRectangle = __webpack_require__(90205); +var TransformMatrix = __webpack_require__(69360); - break; - } +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); +var tempMatrix4 = new TransformMatrix(); - return (this.state === TWEEN_CONST.PENDING_REMOVE); - }, +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Particles.Emitter#renderCanvas + * @since 3.60.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var ParticleEmitterCanvasRenderer = function (renderer, emitter, camera, parentMatrix) +{ + var camMatrix = tempMatrix1; + var calcMatrix = tempMatrix2; + var particleMatrix = tempMatrix3; + var managerMatrix = tempMatrix4; - /** - * Internal method that will emit a TweenData based Event and invoke the given callback. - * - * @method Phaser.Tweens.Tween#dispatchTweenDataEvent - * @since 3.19.0 - * - * @param {Phaser.Types.Tweens.Event} event - The Event to be dispatched. - * @param {function} callback - The callback to be invoked. Can be `null` or `undefined` to skip invocation. - * @param {Phaser.Types.Tweens.TweenDataConfig} tweenData - The TweenData object that caused this event. - */ - dispatchTweenDataEvent: function (event, callback, tweenData) + if (parentMatrix) { - if (!this.isSeeking) - { - this.emit(event, this, tweenData.key, tweenData.target, tweenData.current, tweenData.previous); - - if (callback) - { - callback.params[1] = tweenData.target; - - callback.func.apply(callback.scope, callback.params); - } - } - }, - - /** - * Internal method that will emit a Tween based Event and invoke the given callback. - * - * @method Phaser.Tweens.Tween#dispatchTweenEvent - * @since 3.19.0 - * - * @param {Phaser.Types.Tweens.Event} event - The Event to be dispatched. - * @param {function} callback - The callback to be invoked. Can be `null` or `undefined` to skip invocation. - */ - dispatchTweenEvent: function (event, callback) + managerMatrix.loadIdentity(); + managerMatrix.multiply(parentMatrix); + managerMatrix.translate(emitter.x, emitter.y); + managerMatrix.rotate(emitter.rotation); + managerMatrix.scale(emitter.scaleX, emitter.scaleY); + } + else { - if (!this.isSeeking) - { - this.emit(event, this, this.targets); + managerMatrix.applyITRS(emitter.x, emitter.y, emitter.rotation, emitter.scaleX, emitter.scaleY); + } - if (callback) - { - callback.params[1] = this.targets; + var ctx = renderer.currentContext; + var roundPixels = camera.roundPixels; + var camerAlpha = camera.alpha; + var emitterAlpha = emitter.alpha; - callback.func.apply(callback.scope, callback.params); - } - } - }, + var particles = emitter.alive; + var particleCount = particles.length; + var viewBounds = emitter.viewBounds; - /** - * Internal method used as part of the playback process that sets a tween to play in reverse. - * - * @method Phaser.Tweens.Tween#setStateFromEnd - * @fires Phaser.Tweens.Events#TWEEN_REPEAT - * @fires Phaser.Tweens.Events#TWEEN_YOYO - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - The Tween to update. - * @param {Phaser.Types.Tweens.TweenDataConfig} tweenData - The TweenData property to update. - * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. - * - * @return {number} The state of this Tween. - */ - setStateFromEnd: function (tween, tweenData, diff) + if (!emitter.visible || particleCount === 0 || (viewBounds && !RectangleToRectangle(viewBounds, camera.worldView))) { - if (tweenData.yoyo) - { - // We've hit the end of a Playing Forward TweenData and we have a yoyo - - // Account for any extra time we got from the previous frame - tweenData.elapsed = diff; - tweenData.progress = diff / tweenData.duration; - - if (tweenData.flipX) - { - tweenData.target.toggleFlipX(); - } - - if (tweenData.flipY) - { - tweenData.target.toggleFlipY(); - } - - this.dispatchTweenDataEvent(Events.TWEEN_YOYO, tween.callbacks.onYoyo, tweenData); + return; + } - tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start, tweenData.index, tween.totalTargets, tween); + if (emitter.sortCallback) + { + emitter.depthSort(); + } - return TWEEN_CONST.PLAYING_BACKWARD; - } - else if (tweenData.repeatCounter > 0) - { - // We've hit the end of a Playing Forward TweenData and we have a Repeat. - // So we're going to go right back to the start to repeat it again. + camera.addToRenderList(emitter); - tweenData.repeatCounter--; + var scrollFactorX = emitter.scrollFactorX; + var scrollFactorY = emitter.scrollFactorY; - // Account for any extra time we got from the previous frame - tweenData.elapsed = diff; - tweenData.progress = diff / tweenData.duration; + ctx.save(); - if (tweenData.flipX) - { - tweenData.target.toggleFlipX(); - } + ctx.globalCompositeOperation = renderer.blendModes[emitter.blendMode]; - if (tweenData.flipY) - { - tweenData.target.toggleFlipY(); - } + for (var i = 0; i < particleCount; i++) + { + var particle = particles[i]; - tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start, tweenData.index, tween.totalTargets, tween); + var alpha = particle.alpha * emitterAlpha * camerAlpha; - tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start, tweenData.index, tween.totalTargets, tween); + if (alpha <= 0 || particle.scaleX === 0 || particle.scaleY === 0) + { + continue; + } - // Delay? - if (tweenData.repeatDelay > 0) - { - tweenData.elapsed = tweenData.repeatDelay - diff; + particleMatrix.applyITRS(particle.x, particle.y, particle.rotation, particle.scaleX, particle.scaleY); - tweenData.current = tweenData.start; + camMatrix.copyFrom(camera.matrix); - tweenData.target[tweenData.key] = tweenData.current; + camMatrix.multiplyWithOffset(managerMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY); - return TWEEN_CONST.REPEAT_DELAY; - } - else - { - this.dispatchTweenDataEvent(Events.TWEEN_REPEAT, tween.callbacks.onRepeat, tweenData); + // Undo the camera scroll + particleMatrix.e = particle.x; + particleMatrix.f = particle.y; - return TWEEN_CONST.PLAYING_FORWARD; - } - } + // Multiply by the particle matrix, store result in calcMatrix + camMatrix.multiply(particleMatrix, calcMatrix); - return TWEEN_CONST.COMPLETE; - }, + var frame = particle.frame; + var cd = frame.canvasData; - /** - * Internal method used as part of the playback process that sets a tween to play from the start. - * - * @method Phaser.Tweens.Tween#setStateFromStart - * @fires Phaser.Tweens.Events#TWEEN_REPEAT - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - The Tween to update. - * @param {Phaser.Types.Tweens.TweenDataConfig} tweenData - The TweenData property to update. - * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. - * - * @return {number} The state of this Tween. - */ - setStateFromStart: function (tween, tweenData, diff) - { - if (tweenData.repeatCounter > 0) + if (cd.width > 0 && cd.height > 0) { - tweenData.repeatCounter--; - - // Account for any extra time we got from the previous frame - tweenData.elapsed = diff; - tweenData.progress = diff / tweenData.duration; - - if (tweenData.flipX) - { - tweenData.target.toggleFlipX(); - } - - if (tweenData.flipY) - { - tweenData.target.toggleFlipY(); - } - - tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start, tweenData.index, tween.totalTargets, tween); + var x = -(frame.halfWidth); + var y = -(frame.halfHeight); - // Delay? - if (tweenData.repeatDelay > 0) - { - tweenData.elapsed = tweenData.repeatDelay - diff; + ctx.globalAlpha = alpha; - tweenData.current = tweenData.start; + ctx.save(); - tweenData.target[tweenData.key] = tweenData.current; + calcMatrix.setToContext(ctx); - return TWEEN_CONST.REPEAT_DELAY; - } - else + if (roundPixels) { - this.dispatchTweenDataEvent(Events.TWEEN_REPEAT, tween.callbacks.onRepeat, tweenData); - - return TWEEN_CONST.PLAYING_FORWARD; + x = Math.round(x); + y = Math.round(y); } - } - - return TWEEN_CONST.COMPLETE; - }, - - /** - * Internal method that advances the TweenData based on the time value given. - * - * @method Phaser.Tweens.Tween#updateTweenData - * @fires Phaser.Tweens.Events#TWEEN_UPDATE - * @fires Phaser.Tweens.Events#TWEEN_REPEAT - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - The Tween to update. - * @param {Phaser.Types.Tweens.TweenDataConfig} tweenData - The TweenData property to update. - * @param {number} delta - Either a value in ms, or 1 if Tween.useFrames is true. - * - * @return {boolean} True if the tween is not complete (e.g., playing), or false if the tween is complete. - */ - updateTweenData: function (tween, tweenData, delta) - { - var target = tweenData.target; - - switch (tweenData.state) - { - case TWEEN_CONST.PLAYING_FORWARD: - case TWEEN_CONST.PLAYING_BACKWARD: - - if (!target) - { - tweenData.state = TWEEN_CONST.COMPLETE; - break; - } - - var elapsed = tweenData.elapsed; - var duration = tweenData.duration; - var diff = 0; - - elapsed += delta; - - if (elapsed > duration) - { - diff = elapsed - duration; - elapsed = duration; - } - - var forward = (tweenData.state === TWEEN_CONST.PLAYING_FORWARD); - var progress = elapsed / duration; - - tweenData.elapsed = elapsed; - tweenData.progress = progress; - tweenData.previous = tweenData.current; - - if (progress === 1) - { - if (forward) - { - tweenData.current = tweenData.end; - target[tweenData.key] = tweenData.end; - - if (tweenData.hold > 0) - { - tweenData.elapsed = tweenData.hold - diff; - - tweenData.state = TWEEN_CONST.HOLD_DELAY; - } - else - { - tweenData.state = this.setStateFromEnd(tween, tweenData, diff); - } - } - else - { - tweenData.current = tweenData.start; - target[tweenData.key] = tweenData.start; - - tweenData.state = this.setStateFromStart(tween, tweenData, diff); - } - } - else - { - var v = (forward) ? tweenData.ease(progress) : tweenData.ease(1 - progress); - - tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); - - target[tweenData.key] = tweenData.current; - } - - this.dispatchTweenDataEvent(Events.TWEEN_UPDATE, tween.callbacks.onUpdate, tweenData); - - break; - - case TWEEN_CONST.DELAY: - - tweenData.elapsed -= delta; - - if (tweenData.elapsed <= 0) - { - tweenData.elapsed = Math.abs(tweenData.elapsed); - - tweenData.state = TWEEN_CONST.PENDING_RENDER; - } - - break; - - case TWEEN_CONST.REPEAT_DELAY: - - tweenData.elapsed -= delta; - - if (tweenData.elapsed <= 0) - { - tweenData.elapsed = Math.abs(tweenData.elapsed); - - tweenData.state = TWEEN_CONST.PLAYING_FORWARD; - - this.dispatchTweenDataEvent(Events.TWEEN_REPEAT, tween.callbacks.onRepeat, tweenData); - } - - break; - - case TWEEN_CONST.HOLD_DELAY: - - tweenData.elapsed -= delta; - - if (tweenData.elapsed <= 0) - { - tweenData.state = this.setStateFromEnd(tween, tweenData, Math.abs(tweenData.elapsed)); - } - break; - - case TWEEN_CONST.PENDING_RENDER: - - if (target) - { - tweenData.start = tweenData.getStartValue(target, tweenData.key, target[tweenData.key], tweenData.index, tween.totalTargets, tween); - - tweenData.end = tweenData.getEndValue(target, tweenData.key, tweenData.start, tweenData.index, tween.totalTargets, tween); - - tweenData.current = tweenData.start; - - target[tweenData.key] = tweenData.start; + ctx.imageSmoothingEnabled = !frame.source.scaleMode; - tweenData.state = TWEEN_CONST.PLAYING_FORWARD; - } - else - { - tweenData.state = TWEEN_CONST.COMPLETE; - } + ctx.drawImage(frame.source.image, cd.x, cd.y, cd.width, cd.height, x, y, cd.width, cd.height); - break; + ctx.restore(); } - - // Return TRUE if this TweenData still playing, otherwise return FALSE - return (tweenData.state !== TWEEN_CONST.COMPLETE); } -}); - -// onActive = 'active' event = When the Tween is moved from the pending to the active list in the manager, even if playback delayed -// onStart = 'start' event = When the Tween starts playing from a delayed state (will happen same time as onActive if no delay) -// onStop = 'stop' event = When the Tween is stopped -// onYoyo = 'yoyo' event = When the Tween starts a yoyo -// onRepeat = 'repeat' event = When a TweenData repeats playback (if any) -// onComplete = 'complete' event = When the Tween finishes all playback (can sometimes never happen if repeat -1), also when 'stop' called -// onUpdate = 'update' event = When the Tween updates a TweenData during playback (expensive!) -// onLoop = 'loop' event = Used to loop ALL TweenDatas in a Tween - -Tween.TYPES = [ - 'onActive', - 'onComplete', - 'onLoop', - 'onRepeat', - 'onStart', - 'onStop', - 'onUpdate', - 'onYoyo' -]; - -/** - * Creates a new Tween object. - * - * Note: This method will only be available if Tweens have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#tween - * @since 3.0.0 - * - * @param {Phaser.Types.Tweens.TweenBuilderConfig|object} config - The Tween configuration. - * - * @return {Phaser.Tweens.Tween} The Tween that was created. - */ -GameObjectFactory.register('tween', function (config) -{ - return this.scene.sys.tweens.add(config); -}); - -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns - -/** - * Creates a new Tween object and returns it. - * - * Note: This method will only be available if Tweens have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectCreator#tween - * @since 3.0.0 - * - * @param {Phaser.Types.Tweens.TweenBuilderConfig|object} config - The Tween configuration. - * - * @return {Phaser.Tweens.Tween} The Tween that was created. - */ -GameObjectCreator.register('tween', function (config) -{ - return this.scene.sys.tweens.create(config); -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. + ctx.restore(); +}; -module.exports = Tween; +module.exports = ParticleEmitterCanvasRenderer; /***/ }), -/* 267 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Tweens.Events - */ - -module.exports = { - - TIMELINE_COMPLETE: __webpack_require__(1466), - TIMELINE_LOOP: __webpack_require__(1467), - TIMELINE_PAUSE: __webpack_require__(1468), - TIMELINE_RESUME: __webpack_require__(1469), - TIMELINE_START: __webpack_require__(1470), - TIMELINE_UPDATE: __webpack_require__(1471), - TWEEN_ACTIVE: __webpack_require__(1472), - TWEEN_COMPLETE: __webpack_require__(1473), - TWEEN_LOOP: __webpack_require__(1474), - TWEEN_REPEAT: __webpack_require__(1475), - TWEEN_START: __webpack_require__(1476), - TWEEN_STOP: __webpack_require__(1477), - TWEEN_UPDATE: __webpack_require__(1478), - TWEEN_YOYO: __webpack_require__(1479) - -}; - -/***/ }), -/* 268 */ -/***/ (function(module, exports) { +/***/ 765: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var GetFastValue = __webpack_require__(72632); +var ParticleEmitter = __webpack_require__(9216); + /** - * Returns a TweenDataConfig object that describes the tween data for a unique property of a unique target. - * A single Tween consists of multiple TweenDatas, depending on how many properties are being changed by the Tween. + * Creates a new Particle Emitter Game Object and returns it. * - * This is an internal function used by the TweenBuilder and should not be accessed directly, instead, - * Tweens should be created using the GameObjectFactory or GameObjectCreator. + * Prior to Phaser v3.60 this function would create a `ParticleEmitterManager`. These were removed + * in v3.60 and replaced with creating a `ParticleEmitter` instance directly. Please see the + * updated function parameters and class documentation for more details. + * + * Note: This method will only be available if the Particles Game Object has been built into Phaser. * - * @function Phaser.Tweens.TweenData + * @method Phaser.GameObjects.GameObjectCreator#particles * @since 3.0.0 * - * @param {any} target - The target to tween. - * @param {number} index - The target index within the Tween targets array. - * @param {string} key - The property of the target to tween. - * @param {function} getEnd - What the property will be at the END of the Tween. - * @param {function} getStart - What the property will be at the START of the Tween. - * @param {?function} getActive - If not null, is invoked _immediately_ as soon as the TweenData is running, and is set on the target property. - * @param {function} ease - The ease function this tween uses. - * @param {number} delay - Time in ms/frames before tween will start. - * @param {number} duration - Duration of the tween in ms/frames. - * @param {boolean} yoyo - Determines whether the tween should return back to its start value after hold has expired. - * @param {number} hold - Time in ms/frames the tween will pause before repeating or returning to its starting value if yoyo is set to true. - * @param {number} repeat - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. - * @param {number} repeatDelay - Time in ms/frames before the repeat will start. - * @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens? - * @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens? + * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterCreatorConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * - * @return {Phaser.Types.Tweens.TweenDataConfig} The config object describing this TweenData. + * @return {Phaser.GameObjects.Particles.ParticleEmitter} The Game Object that was created. */ -var TweenData = function (target, index, key, getEnd, getStart, getActive, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY) +GameObjectCreator.register('particles', function (config, addToScene) { - return { - - // The target to tween - target: target, - - // The index of the target within the tween targets array - index: index, - - // The property of the target to tween - key: key, - - // What to set the property to the moment the TweenData is invoked. - getActiveValue: getActive, - - // The returned value sets what the property will be at the END of the Tween. - getEndValue: getEnd, - - // The returned value sets what the property will be at the START of the Tween. - getStartValue: getStart, - - // The ease function this tween uses. - ease: ease, - - // Duration of the tween in ms/frames, excludes time for yoyo or repeats. - duration: 0, - - // The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo) - totalDuration: 0, - - // Time in ms/frames before tween will start. - delay: 0, - - // Cause the tween to return back to its start value after hold has expired. - yoyo: yoyo, - - // Time in ms/frames the tween will pause before running the yoyo or starting a repeat. - hold: 0, - - // Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. - repeat: 0, - - // Time in ms/frames before the repeat will start. - repeatDelay: 0, - - // Automatically call toggleFlipX when the TweenData yoyos or repeats - flipX: flipX, - - // Automatically call toggleFlipY when the TweenData yoyos or repeats - flipY: flipY, - - // Between 0 and 1 showing completion of this TweenData. - progress: 0, - - // Delta counter. - elapsed: 0, - - // How many repeats are left to run? - repeatCounter: 0, + if (config === undefined) { config = {}; } - // Ease Value Data: + var key = GetAdvancedValue(config, 'key', null); + var emitterConfig = GetFastValue(config, 'config', null); - start: 0, - previous: 0, - current: 0, - end: 0, + var emitter = new ParticleEmitter(this.scene, 0, 0, key); - // Time Durations - t1: 0, - t2: 0, + if (addToScene !== undefined) + { + config.add = addToScene; + } - // LoadValue generation functions - gen: { - delay: delay, - duration: duration, - hold: hold, - repeat: repeat, - repeatDelay: repeatDelay - }, + BuildGameObject(this.scene, emitter, config); - // TWEEN_CONST.CREATED - state: 0 - }; -}; + if (emitterConfig) + { + emitter.setConfig(emitterConfig); + } -module.exports = TweenData; + return emitter; +}); /***/ }), -/* 269 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 81212: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MathWrap = __webpack_require__(68); +var GameObjectFactory = __webpack_require__(61286); +var ParticleEmitter = __webpack_require__(9216); /** - * Wrap an angle. + * Creates a new Particle Emitter Game Object and adds it to the Scene. * - * Wraps the angle to a value in the range of -PI to PI. + * If you wish to configure the Emitter after creating it, use the `ParticleEmitter.setConfig` method. * - * @function Phaser.Math.Angle.Wrap - * @since 3.0.0 + * Prior to Phaser v3.60 this function would create a `ParticleEmitterManager`. These were removed + * in v3.60 and replaced with creating a `ParticleEmitter` instance directly. Please see the + * updated function parameters and class documentation for more details. * - * @param {number} angle - The angle to wrap, in radians. + * Note: This method will only be available if the Particles Game Object has been built into Phaser. * - * @return {number} The wrapped angle, in radians. + * @method Phaser.GameObjects.GameObjectFactory#particles + * @since 3.60.0 + * + * @param {number} [x] - The horizontal position of this Game Object in the world. + * @param {number} [y] - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} [texture] - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig} [config] - Configuration settings for the Particle Emitter. + * + * @return {Phaser.GameObjects.Particles.ParticleEmitter} The Game Object that was created. */ -var Wrap = function (angle) +GameObjectFactory.register('particles', function (x, y, texture, config) { - return MathWrap(angle, -Math.PI, Math.PI); -}; + if (x !== undefined && typeof x === 'string') + { + console.warn('ParticleEmitterManager was removed in Phaser 3.60. See documentation for details'); + } -module.exports = Wrap; + return this.displayList.add(new ParticleEmitter(this.scene, x, y, texture, config)); +}); /***/ }), -/* 270 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 69116: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Wrap = __webpack_require__(68); +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; -/** - * Wrap an angle in degrees. - * - * Wraps the angle to a value in the range of -180 to 180. - * - * @function Phaser.Math.Angle.WrapDegrees - * @since 3.0.0 - * - * @param {number} angle - The angle to wrap, in degrees. - * - * @return {number} The wrapped angle, in degrees. - */ -var WrapDegrees = function (angle) +if (true) { - return Wrap(angle, -180, 180); -}; - -module.exports = WrapDegrees; - - -/***/ }), -/* 271 */ -/***/ (function(module, exports, __webpack_require__) { - -/** -* The `Matter.Axes` module contains methods for creating and manipulating sets of axes. -* -* @class Axes -*/ - -var Axes = {}; - -module.exports = Axes; - -var Vector = __webpack_require__(83); -var Common = __webpack_require__(32); - -(function() { - - /** - * Creates a new set of axes from the given vertices. - * @method fromVertices - * @param {vertices} vertices - * @return {axes} A new axes from the given vertices - */ - Axes.fromVertices = function(vertices) { - var axes = {}; - - // find the unique axes, using edge normal gradients - for (var i = 0; i < vertices.length; i++) { - var j = (i + 1) % vertices.length, - normal = Vector.normalise({ - x: vertices[j].y - vertices[i].y, - y: vertices[i].x - vertices[j].x - }), - gradient = (normal.y === 0) ? Infinity : (normal.x / normal.y); - - // limit precision - gradient = gradient.toFixed(3).toString(); - axes[gradient] = normal; - } + renderWebGL = __webpack_require__(10275); +} - return Common.values(axes); - }; +if (true) +{ + renderCanvas = __webpack_require__(10456); +} - /** - * Rotates a set of axes by the given angle. - * @method rotate - * @param {axes} axes - * @param {number} angle - */ - Axes.rotate = function(axes, angle) { - if (angle === 0) - return; - - var cos = Math.cos(angle), - sin = Math.sin(angle); +module.exports = { - for (var i = 0; i < axes.length; i++) { - var axis = axes[i], - xx; - xx = axis.x * cos - axis.y * sin; - axis.y = axis.x * sin + axis.y * cos; - axis.x = xx; - } - }; + renderWebGL: renderWebGL, + renderCanvas: renderCanvas -})(); +}; /***/ }), -/* 272 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 10275: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @namespace Phaser.Physics.Matter.Events - */ - -module.exports = { - - AFTER_ADD: __webpack_require__(1504), - AFTER_REMOVE: __webpack_require__(1505), - AFTER_UPDATE: __webpack_require__(1506), - BEFORE_ADD: __webpack_require__(1507), - BEFORE_REMOVE: __webpack_require__(1508), - BEFORE_UPDATE: __webpack_require__(1509), - COLLISION_ACTIVE: __webpack_require__(1510), - COLLISION_END: __webpack_require__(1511), - COLLISION_START: __webpack_require__(1512), - DRAG_END: __webpack_require__(1513), - DRAG: __webpack_require__(1514), - DRAG_START: __webpack_require__(1515), - PAUSE: __webpack_require__(1516), - RESUME: __webpack_require__(1517), - SLEEP_END: __webpack_require__(1518), - SLEEP_START: __webpack_require__(1519) - -}; - +var RectangleToRectangle = __webpack_require__(90205); +var TransformMatrix = __webpack_require__(69360); +var Utils = __webpack_require__(75512); -/***/ }), -/* 273 */ -/***/ (function(module, exports, __webpack_require__) { +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); +var tempMatrix4 = new TransformMatrix(); /** -* The `Matter.Detector` module contains methods for detecting collisions given a set of pairs. -* -* @class Detector -*/ - -// TODO: speculative contacts - -var Detector = {}; - -module.exports = Detector; - -var SAT = __webpack_require__(274); -var Pair = __webpack_require__(250); -var Bounds = __webpack_require__(84); - -(function() { - - /** - * Finds all collisions given a list of pairs. - * @method collisions - * @param {pair[]} broadphasePairs - * @param {engine} engine - * @return {array} collisions - */ - Detector.collisions = function(broadphasePairs, engine) { - var collisions = [], - pairsTable = engine.pairs.table; - - // @if DEBUG - var metrics = engine.metrics; - // @endif - - for (var i = 0; i < broadphasePairs.length; i++) { - var bodyA = broadphasePairs[i][0], - bodyB = broadphasePairs[i][1]; - - if ((bodyA.isStatic || bodyA.isSleeping) && (bodyB.isStatic || bodyB.isSleeping)) - continue; - - if (!Detector.canCollide(bodyA.collisionFilter, bodyB.collisionFilter)) - continue; - - // @if DEBUG - metrics.midphaseTests += 1; - // @endif - - // mid phase - if (Bounds.overlaps(bodyA.bounds, bodyB.bounds)) { - for (var j = bodyA.parts.length > 1 ? 1 : 0; j < bodyA.parts.length; j++) { - var partA = bodyA.parts[j]; - - for (var k = bodyB.parts.length > 1 ? 1 : 0; k < bodyB.parts.length; k++) { - var partB = bodyB.parts[k]; - - if ((partA === bodyA && partB === bodyB) || Bounds.overlaps(partA.bounds, partB.bounds)) { - // find a previous collision we could reuse - var pairId = Pair.id(partA, partB), - pair = pairsTable[pairId], - previousCollision; - - if (pair && pair.isActive) { - previousCollision = pair.collision; - } else { - previousCollision = null; - } - - // narrow phase - var collision = SAT.collides(partA, partB, previousCollision); + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Particles.Emitter#renderWebGL + * @since 3.60.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var ParticleEmitterWebGLRenderer = function (renderer, emitter, camera, parentMatrix) +{ + var pipeline = renderer.pipelines.set(emitter.pipeline); - // @if DEBUG - metrics.narrowphaseTests += 1; - if (collision.reused) - metrics.narrowReuseCount += 1; - // @endif + var camMatrix = tempMatrix1; + var calcMatrix = tempMatrix2; + var particleMatrix = tempMatrix3; + var managerMatrix = tempMatrix4; - if (collision.collided) { - collisions.push(collision); - // @if DEBUG - metrics.narrowDetections += 1; - // @endif - } - } - } - } - } - } + if (parentMatrix) + { + managerMatrix.loadIdentity(); + managerMatrix.multiply(parentMatrix); + managerMatrix.translate(emitter.x, emitter.y); + managerMatrix.rotate(emitter.rotation); + managerMatrix.scale(emitter.scaleX, emitter.scaleY); + } + else + { + managerMatrix.applyITRS(emitter.x, emitter.y, emitter.rotation, emitter.scaleX, emitter.scaleY); + } - return collisions; - }; + var roundPixels = camera.roundPixels; + var getTint = Utils.getTintAppendFloatAlpha; + var camerAlpha = camera.alpha; + var emitterAlpha = emitter.alpha; + var texture = emitter.frame.glTexture; - /** - * Returns `true` if both supplied collision filters will allow a collision to occur. - * See `body.collisionFilter` for more information. - * @method canCollide - * @param {} filterA - * @param {} filterB - * @return {bool} `true` if collision can occur - */ - Detector.canCollide = function(filterA, filterB) { - if (filterA.group === filterB.group && filterA.group !== 0) - return filterA.group > 0; + renderer.pipelines.preBatch(emitter); - return (filterA.mask & filterB.category) !== 0 && (filterB.mask & filterA.category) !== 0; - }; + var particles = emitter.alive; + var particleCount = particles.length; + var viewBounds = emitter.viewBounds; -})(); + if (particleCount === 0 || (viewBounds && !RectangleToRectangle(viewBounds, camera.worldView))) + { + return; + } + if (emitter.sortCallback) + { + emitter.depthSort(); + } -/***/ }), -/* 274 */ -/***/ (function(module, exports, __webpack_require__) { + var textureUnit = pipeline.setGameObject(emitter, emitter.frame); -/** -* The `Matter.SAT` module contains methods for detecting collisions using the Separating Axis Theorem. -* -* @class SAT -*/ + camera.addToRenderList(emitter); -// TODO: true circles and curves + camMatrix.copyFrom(camera.matrix); -var SAT = {}; + camMatrix.multiplyWithOffset(managerMatrix, -camera.scrollX * emitter.scrollFactorX, -camera.scrollY * emitter.scrollFactorY); -module.exports = SAT; + renderer.setBlendMode(emitter.blendMode); -var Vertices = __webpack_require__(64); -var Vector = __webpack_require__(83); + if (emitter.mask) + { + emitter.mask.preRenderWebGL(renderer, emitter, camera); -(function() { + renderer.pipelines.set(emitter.pipeline); + } - /** - * Detect collision between two bodies using the Separating Axis Theorem. - * @method collides - * @param {body} bodyA - * @param {body} bodyB - * @param {collision} previousCollision - * @return {collision} collision - */ - SAT.collides = function(bodyA, bodyB, previousCollision) { - var overlapAB, - overlapBA, - minOverlap, - collision, - canReusePrevCol = false; + var tintEffect = emitter.tintFill; - if (previousCollision) { - // estimate total motion - var parentA = bodyA.parent, - parentB = bodyB.parent, - motion = parentA.speed * parentA.speed + parentA.angularSpeed * parentA.angularSpeed - + parentB.speed * parentB.speed + parentB.angularSpeed * parentB.angularSpeed; + for (var i = 0; i < particleCount; i++) + { + var particle = particles[i]; - // we may be able to (partially) reuse collision result - // but only safe if collision was resting - canReusePrevCol = previousCollision && previousCollision.collided && motion < 0.2; + var alpha = particle.alpha * emitterAlpha * camerAlpha; - // reuse collision object - collision = previousCollision; - } else { - collision = { collided: false, bodyA: bodyA, bodyB: bodyB }; + if (alpha <= 0 || particle.scaleX === 0 || particle.scaleY === 0) + { + continue; } - if (previousCollision && canReusePrevCol) { - // if we can reuse the collision result - // we only need to test the previously found axis - var axisBodyA = collision.axisBody, - axisBodyB = axisBodyA === bodyA ? bodyB : bodyA, - axes = [axisBodyA.axes[previousCollision.axisNumber]]; - - minOverlap = SAT._overlapAxes(axisBodyA.vertices, axisBodyB.vertices, axes); - collision.reused = true; - - if (minOverlap.overlap <= 0) { - collision.collided = false; - return collision; - } - } else { - // if we can't reuse a result, perform a full SAT test - - overlapAB = SAT._overlapAxes(bodyA.vertices, bodyB.vertices, bodyA.axes); + particleMatrix.applyITRS(particle.x, particle.y, particle.rotation, particle.scaleX, particle.scaleY); - if (overlapAB.overlap <= 0) { - collision.collided = false; - return collision; - } + // Undo the camera scroll + particleMatrix.e = particle.x; + particleMatrix.f = particle.y; - overlapBA = SAT._overlapAxes(bodyB.vertices, bodyA.vertices, bodyB.axes); + // Multiply by the particle matrix, store result in calcMatrix + camMatrix.multiply(particleMatrix, calcMatrix); - if (overlapBA.overlap <= 0) { - collision.collided = false; - return collision; - } + var frame = particle.frame; - if (overlapAB.overlap < overlapBA.overlap) { - minOverlap = overlapAB; - collision.axisBody = bodyA; - } else { - minOverlap = overlapBA; - collision.axisBody = bodyB; - } + var x = -frame.halfWidth; + var y = -frame.halfHeight; - // important for reuse later - collision.axisNumber = minOverlap.axisNumber; - } + var quad = calcMatrix.setQuad(x, y, x + frame.width, y + frame.height, roundPixels); - collision.bodyA = bodyA.id < bodyB.id ? bodyA : bodyB; - collision.bodyB = bodyA.id < bodyB.id ? bodyB : bodyA; - collision.collided = true; - collision.depth = minOverlap.overlap; - collision.parentA = collision.bodyA.parent; - collision.parentB = collision.bodyB.parent; - - bodyA = collision.bodyA; - bodyB = collision.bodyB; + var tint = getTint(particle.tint, alpha); - // ensure normal is facing away from bodyA - if (Vector.dot(minOverlap.axis, Vector.sub(bodyB.position, bodyA.position)) < 0) { - collision.normal = { - x: minOverlap.axis.x, - y: minOverlap.axis.y - }; - } else { - collision.normal = { - x: -minOverlap.axis.x, - y: -minOverlap.axis.y - }; + if (pipeline.shouldFlush(6)) + { + pipeline.flush(); + textureUnit = pipeline.setGameObject(emitter, emitter.frame); } - collision.tangent = Vector.perp(collision.normal); + pipeline.batchQuad(emitter, quad[0], quad[1], quad[2], quad[3], quad[4], quad[5], quad[6], quad[7], frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, texture, textureUnit); + } - collision.penetration = collision.penetration || {}; - collision.penetration.x = collision.normal.x * collision.depth; - collision.penetration.y = collision.normal.y * collision.depth; + if (emitter.mask) + { + emitter.mask.postRenderWebGL(renderer, camera); + } - // find support points, there is always either exactly one or two - var verticesB = SAT._findSupports(bodyA, bodyB, collision.normal), - supports = []; + renderer.pipelines.postBatch(emitter); +}; - // find the supports from bodyB that are inside bodyA - if (Vertices.contains(bodyA.vertices, verticesB[0])) - supports.push(verticesB[0]); +module.exports = ParticleEmitterWebGLRenderer; - if (Vertices.contains(bodyA.vertices, verticesB[1])) - supports.push(verticesB[1]); - // find the supports from bodyA that are inside bodyB - if (supports.length < 2) { - var verticesA = SAT._findSupports(bodyB, bodyA, Vector.neg(collision.normal)); - - if (Vertices.contains(bodyB.vertices, verticesA[0])) - supports.push(verticesA[0]); +/***/ }), - if (supports.length < 2 && Vertices.contains(bodyB.vertices, verticesA[1])) - supports.push(verticesA[1]); - } +/***/ 30891: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // account for the edge case of overlapping but no vertex containment - if (supports.length < 1) - supports = [verticesB[0]]; - - collision.supports = supports; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return collision; - }; +var Class = __webpack_require__(56694); - /** - * Find the overlap between two sets of vertices. - * @method _overlapAxes - * @private - * @param {} verticesA - * @param {} verticesB - * @param {} axes - * @return result - */ - SAT._overlapAxes = function(verticesA, verticesB, axes) { - var projectionA = Vector._temp[0], - projectionB = Vector._temp[1], - result = { overlap: Number.MAX_VALUE }, - overlap, - axis; +/** + * @classdesc + * This class provides the structured required for all Particle Processors. + * + * You should extend it and add the functionality required for your processor, + * including tidying up any resources this may create in the `destroy` method. + * + * See the GravityWell for an example of a processor. + * + * @class ParticleProcessor + * @memberof Phaser.GameObjects.Particles + * @constructor + * @since 3.60.0 + * + * @param {number} [x=0] - The x coordinate of the Particle Processor, in world space. + * @param {number} [y=0] - The y coordinate of the Particle Processor, in world space. + * @param {boolean} [active=true] - The active state of this Particle Processor. + */ +var ParticleProcessor = new Class({ - for (var i = 0; i < axes.length; i++) { - axis = axes[i]; + initialize: - SAT._projectToAxis(projectionA, verticesA, axis); - SAT._projectToAxis(projectionB, verticesB, axis); + function ParticleProcessor (x, y, active) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (active === undefined) { active = true; } - overlap = Math.min(projectionA.max - projectionB.min, projectionB.max - projectionA.min); + /** + * A reference to the Particle Emitter that owns this Processor. + * This is set automatically when the Processor is added to an Emitter + * and nulled when removed or destroyed. + * + * @name Phaser.GameObjects.Particles.ParticleProcessor#manager + * @type {Phaser.GameObjects.Particles.ParticleEmitter} + * @since 3.60.0 + */ + this.emitter; - if (overlap <= 0) { - result.overlap = overlap; - return result; - } + /** + * The x coordinate of the Particle Processor, in world space. + * + * @name Phaser.GameObjects.Particles.ParticleProcessor#x + * @type {number} + * @since 3.60.0 + */ + this.x = x; - if (overlap < result.overlap) { - result.overlap = overlap; - result.axis = axis; - result.axisNumber = i; - } - } + /** + * The y coordinate of the Particle Processor, in world space. + * + * @name Phaser.GameObjects.Particles.ParticleProcessor#y + * @type {number} + * @since 3.60.0 + */ + this.y = y; - return result; - }; + /** + * The active state of the Particle Processor. + * + * An inactive Particle Processor will be skipped for processing by + * its parent Emitter. + * + * @name Phaser.GameObjects.Particles.ParticleProcessor#active + * @type {boolean} + * @since 3.60.0 + */ + this.active = active; + }, /** - * Projects vertices on an axis and returns an interval. - * @method _projectToAxis - * @private - * @param {} projection - * @param {} vertices - * @param {} axis + * The Particle Processor update method should be overriden by your own + * method and handle the processing of the particles, typically modifying + * their velocityX/Y values based on the criteria of this processor. + * + * @method Phaser.GameObjects.Particles.ParticleProcessor#update + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The Particle to update. + * @param {number} delta - The delta time in ms. + * @param {number} step - The delta value divided by 1000. + * @param {number} t - The current normalized lifetime of the particle, between 0 (birth) and 1 (death). */ - SAT._projectToAxis = function(projection, vertices, axis) { - var min = Vector.dot(vertices[0], axis), - max = min; - - for (var i = 1; i < vertices.length; i += 1) { - var dot = Vector.dot(vertices[i], axis); - - if (dot > max) { - max = dot; - } else if (dot < min) { - min = dot; - } - } + update: function () + { + }, - projection.min = min; - projection.max = max; - }; - /** - * Finds supporting vertices given two bodies along a given direction using hill-climbing. - * @method _findSupports - * @private - * @param {} bodyA - * @param {} bodyB - * @param {} normal - * @return [vector] + * Destroys this Particle Processor by removing all external references. + * + * This is called automatically when the owning Particle Emitter is destroyed. + * + * @method Phaser.GameObjects.Particles.ParticleProcessor#destroy + * @since 3.60.0 */ - SAT._findSupports = function(bodyA, bodyB, normal) { - var nearestDistance = Number.MAX_VALUE, - vertexToBody = Vector._temp[0], - vertices = bodyB.vertices, - bodyAPosition = bodyA.position, - distance, - vertex, - vertexA, - vertexB; - - // find closest vertex on bodyB - for (var i = 0; i < vertices.length; i++) { - vertex = vertices[i]; - vertexToBody.x = vertex.x - bodyAPosition.x; - vertexToBody.y = vertex.y - bodyAPosition.y; - distance = -Vector.dot(normal, vertexToBody); - - if (distance < nearestDistance) { - nearestDistance = distance; - vertexA = vertex; - } - } - - // find next closest vertex using the two connected to it - var prevIndex = vertexA.index - 1 >= 0 ? vertexA.index - 1 : vertices.length - 1; - vertex = vertices[prevIndex]; - vertexToBody.x = vertex.x - bodyAPosition.x; - vertexToBody.y = vertex.y - bodyAPosition.y; - nearestDistance = -Vector.dot(normal, vertexToBody); - vertexB = vertex; - - var nextIndex = (vertexA.index + 1) % vertices.length; - vertex = vertices[nextIndex]; - vertexToBody.x = vertex.x - bodyAPosition.x; - vertexToBody.y = vertex.y - bodyAPosition.y; - distance = -Vector.dot(normal, vertexToBody); - if (distance < nearestDistance) { - vertexB = vertex; - } + destroy: function () + { + this.emitter = null; + } - return [vertexA, vertexB]; - }; +}); -})(); +module.exports = ParticleProcessor; /***/ }), -/* 275 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 76100: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @namespace Phaser.Actions + * The Particle Emitter Complete Event. + * + * This event is dispatched when the final particle, emitted from a Particle Emitter that + * has been stopped, dies. Upon receipt of this event you know that no particles are + * still rendering at this point in time. + * + * Listen for it on a Particle Emitter instance using `ParticleEmitter.on('complete', listener)`. + * + * @event Phaser.GameObjects.Particles.Events#COMPLETE + * @type {string} + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - A reference to the Particle Emitter that just completed. */ +module.exports = 'complete'; -module.exports = { - AlignTo: __webpack_require__(601), - Angle: __webpack_require__(602), - Call: __webpack_require__(603), - GetFirst: __webpack_require__(604), - GetLast: __webpack_require__(605), - GridAlign: __webpack_require__(606), - IncAlpha: __webpack_require__(678), - IncX: __webpack_require__(679), - IncXY: __webpack_require__(680), - IncY: __webpack_require__(681), - PlaceOnCircle: __webpack_require__(682), - PlaceOnEllipse: __webpack_require__(683), - PlaceOnLine: __webpack_require__(684), - PlaceOnRectangle: __webpack_require__(685), - PlaceOnTriangle: __webpack_require__(686), - PlayAnimation: __webpack_require__(687), - PropertyValueInc: __webpack_require__(46), - PropertyValueSet: __webpack_require__(27), - RandomCircle: __webpack_require__(688), - RandomEllipse: __webpack_require__(689), - RandomLine: __webpack_require__(690), - RandomRectangle: __webpack_require__(691), - RandomTriangle: __webpack_require__(692), - Rotate: __webpack_require__(693), - RotateAround: __webpack_require__(694), - RotateAroundDistance: __webpack_require__(695), - ScaleX: __webpack_require__(696), - ScaleXY: __webpack_require__(697), - ScaleY: __webpack_require__(698), - SetAlpha: __webpack_require__(699), - SetBlendMode: __webpack_require__(700), - SetDepth: __webpack_require__(701), - SetHitArea: __webpack_require__(702), - SetOrigin: __webpack_require__(703), - SetRotation: __webpack_require__(704), - SetScale: __webpack_require__(705), - SetScaleX: __webpack_require__(706), - SetScaleY: __webpack_require__(707), - SetScrollFactor: __webpack_require__(708), - SetScrollFactorX: __webpack_require__(709), - SetScrollFactorY: __webpack_require__(710), - SetTint: __webpack_require__(711), - SetVisible: __webpack_require__(712), - SetX: __webpack_require__(713), - SetXY: __webpack_require__(714), - SetY: __webpack_require__(715), - ShiftPosition: __webpack_require__(716), - Shuffle: __webpack_require__(717), - SmootherStep: __webpack_require__(718), - SmoothStep: __webpack_require__(719), - Spread: __webpack_require__(720), - ToggleVisible: __webpack_require__(721), - WrapInRectangle: __webpack_require__(722) - -}; - - -/***/ }), -/* 276 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ }), + +/***/ 26677: +/***/ ((module) => { /** - * @author samme - * @copyright 2020 Photon Storm Ltd. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ALIGN_CONST = __webpack_require__(123); - -var AlignToMap = []; - -AlignToMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(277); -AlignToMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(278); -AlignToMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(279); -AlignToMap[ALIGN_CONST.LEFT_BOTTOM] = __webpack_require__(280); -AlignToMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(281); -AlignToMap[ALIGN_CONST.LEFT_TOP] = __webpack_require__(282); -AlignToMap[ALIGN_CONST.RIGHT_BOTTOM] = __webpack_require__(283); -AlignToMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(284); -AlignToMap[ALIGN_CONST.RIGHT_TOP] = __webpack_require__(285); -AlignToMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(286); -AlignToMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(287); -AlignToMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(288); - /** - * Takes a Game Object and aligns it next to another, at the given position. - * The alignment used is based on the `position` argument, which is a `Phaser.Display.Align` property such as `LEFT_CENTER` or `TOP_RIGHT`. + * The Particle Emitter Death Zone Event. * - * @function Phaser.Display.Align.To.QuickSet - * @since 3.22.0 + * This event is dispatched when a Death Zone kills a Particle instance. * - * @generic {Phaser.GameObjects.GameObject} G - [child,$return] + * Listen for it on a Particle Emitter instance using `ParticleEmitter.on('deathzone', listener)`. * - * @param {Phaser.GameObjects.GameObject} child - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} position - The position to align the Game Object with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. + * If you wish to know when the final particle is killed, see the `COMPLETE` event. * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @event Phaser.GameObjects.Particles.Events#DEATH_ZONE + * @type {string} + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - A reference to the Particle Emitter that owns the Particle and Death Zone. + * @param {Phaser.GameObjects.Particles.Particle} particle - The Particle that has been killed. + * @param {Phaser.GameObjects.Particles.Zones.DeathZone} zone - The Death Zone that killed the particle. */ -var QuickSet = function (child, alignTo, position, offsetX, offsetY) -{ - return AlignToMap[position](child, alignTo, offsetX, offsetY); -}; - -module.exports = QuickSet; +module.exports = 'deathzone'; /***/ }), -/* 277 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 62736: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(42); -var GetCenterX = __webpack_require__(87); -var SetCenterX = __webpack_require__(88); -var SetTop = __webpack_require__(52); - /** - * Takes given Game Object and aligns it so that it is positioned next to the bottom center position of the other. + * The Particle Emitter Explode Event. * - * @function Phaser.Display.Align.To.BottomCenter - * @since 3.0.0 + * This event is dispatched when a Particle Emitter explodes a set of particles. * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * Listen for it on a Particle Emitter instance using `ParticleEmitter.on('explode', listener)`. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. + * @event Phaser.GameObjects.Particles.Events#EXPLODE + * @type {string} + * @since 3.60.0 * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - A reference to the Particle Emitter that just completed. + * @param {Phaser.GameObjects.Particles.Particle} particle - The most recently emitted Particle. */ -var BottomCenter = function (gameObject, alignTo, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = BottomCenter; +module.exports = 'explode'; /***/ }), -/* 278 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 56490: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(42); -var GetLeft = __webpack_require__(43); -var SetLeft = __webpack_require__(53); -var SetTop = __webpack_require__(52); - /** - * Takes given Game Object and aligns it so that it is positioned next to the bottom left position of the other. + * The Particle Emitter Start Event. * - * @function Phaser.Display.Align.To.BottomLeft - * @since 3.0.0 + * This event is dispatched when a Particle Emitter starts emission of particles. * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * Listen for it on a Particle Emitter instance using `ParticleEmitter.on('start', listener)`. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. + * @event Phaser.GameObjects.Particles.Events#START + * @type {string} + * @since 3.60.0 * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - A reference to the Particle Emitter that just completed. */ -var BottomLeft = function (gameObject, alignTo, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetLeft(gameObject, GetLeft(alignTo) - offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = BottomLeft; +module.exports = 'start'; /***/ }), -/* 279 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 85715: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(42); -var GetRight = __webpack_require__(44); -var SetRight = __webpack_require__(54); -var SetTop = __webpack_require__(52); - /** - * Takes given Game Object and aligns it so that it is positioned next to the bottom right position of the other. + * The Particle Emitter Stop Event. * - * @function Phaser.Display.Align.To.BottomRight - * @since 3.0.0 + * This event is dispatched when a Particle Emitter is stopped. This can happen either + * when you directly call the `ParticleEmitter.stop` method, or if the emitter has + * been configured to stop after a set time via the `duration` property, or after a + * set number of particles via the `stopAfter` property. * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * Listen for it on a Particle Emitter instance using `ParticleEmitter.on('stop', listener)`. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. + * Note that just because the emitter has stopped, that doesn't mean there aren't still + * particles alive and rendering. It just means the emitter has stopped emitting particles. * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * If you wish to know when the final particle is killed, see the `COMPLETE` event. + * + * @event Phaser.GameObjects.Particles.Events#STOP + * @type {string} + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - A reference to the Particle Emitter that just completed. */ -var BottomRight = function (gameObject, alignTo, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetRight(gameObject, GetRight(alignTo) + offsetX); - SetTop(gameObject, GetBottom(alignTo) + offsetY); - - return gameObject; -}; - -module.exports = BottomRight; +module.exports = 'stop'; /***/ }), -/* 280 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 40629: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(42); -var GetLeft = __webpack_require__(43); -var SetBottom = __webpack_require__(55); -var SetRight = __webpack_require__(54); - /** - * Takes given Game Object and aligns it so that it is positioned next to the left bottom position of the other. - * - * @function Phaser.Display.Align.To.LeftBottom - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @namespace Phaser.GameObjects.Particles.Events */ -var LeftBottom = function (gameObject, alignTo, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetBottom(gameObject, GetBottom(alignTo) + offsetY); +module.exports = { - return gameObject; -}; + COMPLETE: __webpack_require__(76100), + DEATH_ZONE: __webpack_require__(26677), + EXPLODE: __webpack_require__(62736), + START: __webpack_require__(56490), + STOP: __webpack_require__(85715) -module.exports = LeftBottom; +}; /***/ }), -/* 281 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 27684: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterY = __webpack_require__(89); -var GetLeft = __webpack_require__(43); -var SetCenterY = __webpack_require__(90); -var SetRight = __webpack_require__(54); - /** - * Takes given Game Object and aligns it so that it is positioned next to the left center position of the other. - * - * @function Phaser.Display.Align.To.LeftCenter - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @namespace Phaser.GameObjects.Particles */ -var LeftCenter = function (gameObject, alignTo, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); +module.exports = { - return gameObject; -}; + EmitterColorOp: __webpack_require__(19737), + EmitterOp: __webpack_require__(93025), + Events: __webpack_require__(40629), + GravityWell: __webpack_require__(87811), + Particle: __webpack_require__(14909), + ParticleBounds: __webpack_require__(73106), + ParticleEmitter: __webpack_require__(9216), + ParticleProcessor: __webpack_require__(30891), + Zones: __webpack_require__(25962) -module.exports = LeftCenter; +}; /***/ }), -/* 282 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 69361: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetLeft = __webpack_require__(43); -var GetTop = __webpack_require__(45); -var SetRight = __webpack_require__(54); -var SetTop = __webpack_require__(52); +var Class = __webpack_require__(56694); /** - * Takes given Game Object and aligns it so that it is positioned next to the left top position of the other. + * @classdesc + * A Death Zone. * - * @function Phaser.Display.Align.To.LeftTop - * @since 3.0.0 + * A Death Zone is a special type of zone that will kill a Particle as soon as it either enters, or leaves, the zone. * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * The zone consists of a `source` which could be a Geometric shape, such as a Rectangle or Ellipse, or your own + * object as long as it includes a `contains` method for which the Particles can be tested against. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. + * @class DeathZone + * @memberof Phaser.GameObjects.Particles.Zones + * @constructor + * @since 3.0.0 * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @param {Phaser.Types.GameObjects.Particles.DeathZoneSource} source - An object instance that has a `contains` method that returns a boolean when given `x` and `y` arguments. + * @param {boolean} killOnEnter - Should the Particle be killed when it enters the zone? `true` or leaves it? `false` */ -var LeftTop = function (gameObject, alignTo, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetRight(gameObject, GetLeft(alignTo) - offsetX); - SetTop(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; - -module.exports = LeftTop; +var DeathZone = new Class({ + initialize: -/***/ }), -/* 283 */ -/***/ (function(module, exports, __webpack_require__) { + function DeathZone (source, killOnEnter) + { + /** + * An object instance that has a `contains` method that returns a boolean when given `x` and `y` arguments. + * This could be a Geometry shape, such as `Phaser.Geom.Circle`, or your own custom object. + * + * @name Phaser.GameObjects.Particles.Zones.DeathZone#source + * @type {Phaser.Types.GameObjects.Particles.DeathZoneSource} + * @since 3.0.0 + */ + this.source = source; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Set to `true` if the Particle should be killed if it enters this zone. + * Set to `false` to kill the Particle if it leaves this zone. + * + * @name Phaser.GameObjects.Particles.Zones.DeathZone#killOnEnter + * @type {boolean} + * @since 3.0.0 + */ + this.killOnEnter = killOnEnter; + }, -var GetBottom = __webpack_require__(42); -var GetRight = __webpack_require__(44); -var SetBottom = __webpack_require__(55); -var SetLeft = __webpack_require__(53); + /** + * Checks if the given Particle will be killed or not by this zone. + * + * @method Phaser.GameObjects.Particles.Zones.DeathZone#willKill + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle to test against this Death Zones. + * + * @return {boolean} Return `true` if the Particle is to be killed, otherwise return `false`. + */ + willKill: function (particle) + { + var pos = particle.worldPosition; -/** - * Takes given Game Object and aligns it so that it is positioned next to the right bottom position of the other. - * - * @function Phaser.Display.Align.To.RightBottom - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var RightBottom = function (gameObject, alignTo, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + var withinZone = this.source.contains(pos.x, pos.y); - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetBottom(gameObject, GetBottom(alignTo) + offsetY); + return (withinZone && this.killOnEnter || !withinZone && !this.killOnEnter); + } - return gameObject; -}; +}); -module.exports = RightBottom; +module.exports = DeathZone; /***/ }), -/* 284 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 54213: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCenterY = __webpack_require__(89); -var GetRight = __webpack_require__(44); -var SetCenterY = __webpack_require__(90); -var SetLeft = __webpack_require__(53); +var Class = __webpack_require__(56694); /** - * Takes given Game Object and aligns it so that it is positioned next to the right center position of the other. + * @classdesc + * A zone that places particles on a shape's edges. * - * @function Phaser.Display.Align.To.RightCenter + * @class EdgeZone + * @memberof Phaser.GameObjects.Particles.Zones + * @constructor * @since 3.0.0 * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @param {Phaser.Types.GameObjects.Particles.EdgeZoneSource} source - An object instance with a `getPoints(quantity, stepRate)` method returning an array of points. + * @param {number} quantity - The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. + * @param {number} stepRate - The distance between each particle. When set, `quantity` is implied and should be set to 0. + * @param {boolean} [yoyo=false] - Whether particles are placed from start to end and then end to start. + * @param {boolean} [seamless=true] - Whether one endpoint will be removed if it's identical to the other. + * @param {number} [total=-1] - The total number of particles this zone will emit before passing over to the next emission zone in the Emitter. -1 means it will never pass over and you must use `setEmitZone` to change it. */ -var RightCenter = function (gameObject, alignTo, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } +var EdgeZone = new Class({ - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetCenterY(gameObject, GetCenterY(alignTo) + offsetY); + initialize: - return gameObject; -}; + function EdgeZone (source, quantity, stepRate, yoyo, seamless, total) + { + if (yoyo === undefined) { yoyo = false; } + if (seamless === undefined) { seamless = true; } + if (total === undefined) { total = -1; } -module.exports = RightCenter; + /** + * An object instance with a `getPoints(quantity, stepRate)` method returning an array of points. + * + * @name Phaser.GameObjects.Particles.Zones.EdgeZone#source + * @type {Phaser.Types.GameObjects.Particles.EdgeZoneSource|Phaser.Types.GameObjects.Particles.RandomZoneSource} + * @since 3.0.0 + */ + this.source = source; + /** + * The points placed on the source edge. + * + * @name Phaser.GameObjects.Particles.Zones.EdgeZone#points + * @type {Phaser.Geom.Point[]} + * @default [] + * @since 3.0.0 + */ + this.points = []; -/***/ }), -/* 285 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. + * + * @name Phaser.GameObjects.Particles.Zones.EdgeZone#quantity + * @type {number} + * @since 3.0.0 + */ + this.quantity = quantity; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The distance between each particle. When set, `quantity` is implied and should be set to 0. + * + * @name Phaser.GameObjects.Particles.Zones.EdgeZone#stepRate + * @type {number} + * @since 3.0.0 + */ + this.stepRate = stepRate; -var GetRight = __webpack_require__(44); -var GetTop = __webpack_require__(45); -var SetLeft = __webpack_require__(53); -var SetTop = __webpack_require__(52); + /** + * Whether particles are placed from start to end and then end to start. + * + * @name Phaser.GameObjects.Particles.Zones.EdgeZone#yoyo + * @type {boolean} + * @since 3.0.0 + */ + this.yoyo = yoyo; -/** - * Takes given Game Object and aligns it so that it is positioned next to the right top position of the other. - * - * @function Phaser.Display.Align.To.RightTop - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var RightTop = function (gameObject, alignTo, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + /** + * The counter used for iterating the EdgeZone's points. + * + * @name Phaser.GameObjects.Particles.Zones.EdgeZone#counter + * @type {number} + * @default -1 + * @since 3.0.0 + */ + this.counter = -1; - SetLeft(gameObject, GetRight(alignTo) + offsetX); - SetTop(gameObject, GetTop(alignTo) - offsetY); + /** + * Whether one endpoint will be removed if it's identical to the other. + * + * @name Phaser.GameObjects.Particles.Zones.EdgeZone#seamless + * @type {boolean} + * @since 3.0.0 + */ + this.seamless = seamless; - return gameObject; -}; + /** + * An internal count of the points belonging to this EdgeZone. + * + * @name Phaser.GameObjects.Particles.Zones.EdgeZone#_length + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._length = 0; -module.exports = RightTop; + /** + * An internal value used to keep track of the current iteration direction for the EdgeZone's points. + * + * 0 = forwards, 1 = backwards + * + * @name Phaser.GameObjects.Particles.Zones.EdgeZone#_direction + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._direction = 0; + /** + * The total number of particles this zone will emit before the Emitter + * transfers control over to the next zone in its emission zone list. + * + * By default this is -1, meaning it will never pass over from this + * zone to another one. You can call the `ParticleEmitter.setEmitZone` + * method to change it, or set this value to something else via the + * config, or directly at runtime. + * + * A value of 1 would mean the zones rotate in order, but it can + * be set to any integer value. + * + * @name Phaser.GameObjects.Particles.Zones.EdgeZone#total + * @type {number} + * @since 3.60.0 + */ + this.total = total; -/***/ }), -/* 286 */ -/***/ (function(module, exports, __webpack_require__) { + this.updateSource(); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Update the {@link Phaser.GameObjects.Particles.Zones.EdgeZone#points} from the EdgeZone's + * {@link Phaser.GameObjects.Particles.Zones.EdgeZone#source}. + * + * Also updates internal properties. + * + * @method Phaser.GameObjects.Particles.Zones.EdgeZone#updateSource + * @since 3.0.0 + * + * @return {this} This Edge Zone. + */ + updateSource: function () + { + this.points = this.source.getPoints(this.quantity, this.stepRate); -var GetCenterX = __webpack_require__(87); -var GetTop = __webpack_require__(45); -var SetBottom = __webpack_require__(55); -var SetCenterX = __webpack_require__(88); + // Remove ends? + if (this.seamless) + { + var a = this.points[0]; + var b = this.points[this.points.length - 1]; -/** - * Takes given Game Object and aligns it so that it is positioned next to the top center position of the other. - * - * @function Phaser.Display.Align.To.TopCenter - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var TopCenter = function (gameObject, alignTo, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (a.x === b.x && a.y === b.y) + { + this.points.pop(); + } + } - SetCenterX(gameObject, GetCenterX(alignTo) + offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); + var oldLength = this._length; - return gameObject; -}; + this._length = this.points.length; -module.exports = TopCenter; + // Adjust counter if we now have less points than before + if (this._length < oldLength && this.counter > this._length) + { + this.counter = this._length - 1; + } + return this; + }, -/***/ }), -/* 287 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Change the source of the EdgeZone. + * + * @method Phaser.GameObjects.Particles.Zones.EdgeZone#changeSource + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.Particles.EdgeZoneSource} source - An object instance with a `getPoints(quantity, stepRate)` method returning an array of points. + * + * @return {this} This Edge Zone. + */ + changeSource: function (source) + { + this.source = source; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this.updateSource(); + }, -var GetLeft = __webpack_require__(43); -var GetTop = __webpack_require__(45); -var SetBottom = __webpack_require__(55); -var SetLeft = __webpack_require__(53); + /** + * Get the next point in the Zone and set its coordinates on the given Particle. + * + * @method Phaser.GameObjects.Particles.Zones.EdgeZone#getPoint + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The Particle. + */ + getPoint: function (particle) + { + if (this._direction === 0) + { + this.counter++; -/** - * Takes given Game Object and aligns it so that it is positioned next to the top left position of the other. - * - * @function Phaser.Display.Align.To.TopLeft - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var TopLeft = function (gameObject, alignTo, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (this.counter >= this._length) + { + if (this.yoyo) + { + this._direction = 1; + this.counter = this._length - 1; + } + else + { + this.counter = 0; + } + } + } + else + { + this.counter--; - SetLeft(gameObject, GetLeft(alignTo) - offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); + if (this.counter === -1) + { + if (this.yoyo) + { + this._direction = 0; + this.counter = 0; + } + else + { + this.counter = this._length - 1; + } + } + } - return gameObject; -}; + var point = this.points[this.counter]; -module.exports = TopLeft; + if (point) + { + particle.x = point.x; + particle.y = point.y; + } + } + +}); + +module.exports = EdgeZone; /***/ }), -/* 288 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 68433: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetRight = __webpack_require__(44); -var GetTop = __webpack_require__(45); -var SetBottom = __webpack_require__(55); -var SetRight = __webpack_require__(54); +var Class = __webpack_require__(56694); +var Vector2 = __webpack_require__(93736); /** - * Takes given Game Object and aligns it so that it is positioned next to the top right position of the other. + * @classdesc + * A zone that places particles randomly within a shapes area. * - * @function Phaser.Display.Align.To.TopRight + * @class RandomZone + * @memberof Phaser.GameObjects.Particles.Zones + * @constructor * @since 3.0.0 * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignTo - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @param {Phaser.Types.GameObjects.Particles.RandomZoneSource} source - An object instance with a `getRandomPoint(point)` method. */ -var TopRight = function (gameObject, alignTo, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetRight(gameObject, GetRight(alignTo) + offsetX); - SetBottom(gameObject, GetTop(alignTo) - offsetY); - - return gameObject; -}; +var RandomZone = new Class({ -module.exports = TopRight; + initialize: + function RandomZone (source) + { + /** + * An object instance with a `getRandomPoint(point)` method. + * + * @name Phaser.GameObjects.Particles.Zones.RandomZone#source + * @type {Phaser.Types.GameObjects.Particles.RandomZoneSource} + * @since 3.0.0 + */ + this.source = source; -/***/ }), -/* 289 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Internal calculation vector. + * + * @name Phaser.GameObjects.Particles.Zones.RandomZone#_tempVec + * @type {Phaser.Math.Vector2} + * @private + * @since 3.0.0 + */ + this._tempVec = new Vector2(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The total number of particles this zone will emit before the Emitter + * transfers control over to the next zone in its emission zone list. + * + * By default this is -1, meaning it will never pass over from this + * zone to another one. You can call the `ParticleEmitter.setEmitZone` + * method to change it, or set this value to something else via the + * config, or directly at runtime. + * + * A value of 1 would mean the zones rotate in order, but it can + * be set to any integer value. + * + * @name Phaser.GameObjects.Particles.Zones.RandomZone#total + * @type {number} + * @since 3.60.0 + */ + this.total = -1; + }, -var ALIGN_CONST = __webpack_require__(123); + /** + * Get the next point in the Zone and set its coordinates on the given Particle. + * + * @method Phaser.GameObjects.Particles.Zones.RandomZone#getPoint + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Particles.Particle} particle - The Particle. + */ + getPoint: function (particle) + { + var vec = this._tempVec; -var AlignInMap = []; + this.source.getRandomPoint(vec); -AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = __webpack_require__(290); -AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = __webpack_require__(291); -AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = __webpack_require__(292); -AlignInMap[ALIGN_CONST.CENTER] = __webpack_require__(293); -AlignInMap[ALIGN_CONST.LEFT_CENTER] = __webpack_require__(295); -AlignInMap[ALIGN_CONST.RIGHT_CENTER] = __webpack_require__(296); -AlignInMap[ALIGN_CONST.TOP_CENTER] = __webpack_require__(297); -AlignInMap[ALIGN_CONST.TOP_LEFT] = __webpack_require__(298); -AlignInMap[ALIGN_CONST.TOP_RIGHT] = __webpack_require__(299); -AlignInMap[ALIGN_CONST.LEFT_BOTTOM] = AlignInMap[ALIGN_CONST.BOTTOM_LEFT]; -AlignInMap[ALIGN_CONST.LEFT_TOP] = AlignInMap[ALIGN_CONST.TOP_LEFT]; -AlignInMap[ALIGN_CONST.RIGHT_BOTTOM] = AlignInMap[ALIGN_CONST.BOTTOM_RIGHT]; -AlignInMap[ALIGN_CONST.RIGHT_TOP] = AlignInMap[ALIGN_CONST.TOP_RIGHT]; + particle.x = vec.x; + particle.y = vec.y; + } -/** - * Takes given Game Object and aligns it so that it is positioned relative to the other. - * The alignment used is based on the `position` argument, which is an `ALIGN_CONST` value, such as `LEFT_CENTER` or `TOP_RIGHT`. - * - * @function Phaser.Display.Align.In.QuickSet - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [child,$return] - * - * @param {Phaser.GameObjects.GameObject} child - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} position - The position to align the Game Object with. This is an align constant, such as `ALIGN_CONST.LEFT_CENTER`. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var QuickSet = function (child, alignIn, position, offsetX, offsetY) -{ - return AlignInMap[position](child, alignIn, offsetX, offsetY); -}; +}); -module.exports = QuickSet; +module.exports = RandomZone; /***/ }), -/* 290 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 25962: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(42); -var GetCenterX = __webpack_require__(87); -var SetBottom = __webpack_require__(55); -var SetCenterX = __webpack_require__(88); - /** - * Takes given Game Object and aligns it so that it is positioned in the bottom center of the other. - * - * @function Phaser.Display.Align.In.BottomCenter - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @namespace Phaser.GameObjects.Particles.Zones */ -var BottomCenter = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - SetCenterX(gameObject, GetCenterX(alignIn) + offsetX); - SetBottom(gameObject, GetBottom(alignIn) + offsetY); +module.exports = { - return gameObject; -}; + DeathZone: __webpack_require__(69361), + EdgeZone: __webpack_require__(54213), + RandomZone: __webpack_require__(68433) -module.exports = BottomCenter; +}; /***/ }), -/* 291 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 29598: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetBottom = __webpack_require__(42); -var GetLeft = __webpack_require__(43); -var SetBottom = __webpack_require__(55); -var SetLeft = __webpack_require__(53); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var Sprite = __webpack_require__(13747); /** - * Takes given Game Object and aligns it so that it is positioned in the bottom left of the other. + * @classdesc + * A PathFollower Game Object. * - * @function Phaser.Display.Align.In.BottomLeft - * @since 3.0.0 + * A PathFollower is a Sprite Game Object with some extra helpers to allow it to follow a Path automatically. * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * Anything you can do with a standard Sprite can be done with this PathFollower, such as animate it, tint it, + * scale it and so on. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. + * PathFollowers are bound to a single Path at any one time and can traverse the length of the Path, from start + * to finish, forwards or backwards, or from any given point on the Path to its end. They can optionally rotate + * to face the direction of the path, be offset from the path coordinates or rotate independently of the Path. * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @class PathFollower + * @extends Phaser.GameObjects.Sprite + * @memberof Phaser.GameObjects + * @constructor + * @since 3.0.0 + * + * @extends Phaser.GameObjects.Components.PathFollower + * + * @param {Phaser.Scene} scene - The Scene to which this PathFollower belongs. + * @param {Phaser.Curves.Path} path - The Path this PathFollower is following. It can only follow one Path at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ -var BottomLeft = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - - SetLeft(gameObject, GetLeft(alignIn) - offsetX); - SetBottom(gameObject, GetBottom(alignIn) + offsetY); - - return gameObject; -}; - -module.exports = BottomLeft; +var PathFollower = new Class({ + Extends: Sprite, -/***/ }), -/* 292 */ -/***/ (function(module, exports, __webpack_require__) { + Mixins: [ + Components.PathFollower + ], -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + initialize: -var GetBottom = __webpack_require__(42); -var GetRight = __webpack_require__(44); -var SetBottom = __webpack_require__(55); -var SetRight = __webpack_require__(54); + function PathFollower (scene, path, x, y, texture, frame) + { + Sprite.call(this, scene, x, y, texture, frame); -/** - * Takes given Game Object and aligns it so that it is positioned in the bottom right of the other. - * - * @function Phaser.Display.Align.In.BottomRight - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var BottomRight = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + this.path = path; + }, - SetRight(gameObject, GetRight(alignIn) + offsetX); - SetBottom(gameObject, GetBottom(alignIn) + offsetY); + /** + * Internal update handler that advances this PathFollower along the path. + * + * Called automatically by the Scene step, should not typically be called directly. + * + * @method Phaser.GameObjects.PathFollower#preUpdate + * @protected + * @since 3.0.0 + * + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. + */ + preUpdate: function (time, delta) + { + this.anims.update(time, delta); + this.pathUpdate(time); + } - return gameObject; -}; +}); -module.exports = BottomRight; +module.exports = PathFollower; /***/ }), -/* 293 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 19626: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CenterOn = __webpack_require__(294); -var GetCenterX = __webpack_require__(87); -var GetCenterY = __webpack_require__(89); +var GameObjectFactory = __webpack_require__(61286); +var PathFollower = __webpack_require__(29598); /** - * Takes given Game Object and aligns it so that it is positioned in the center of the other. + * Creates a new PathFollower Game Object and adds it to the Scene. * - * @function Phaser.Display.Align.In.Center - * @since 3.0.0 + * Note: This method will only be available if the PathFollower Game Object has been built into Phaser. * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * @method Phaser.GameObjects.GameObjectFactory#follower + * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. + * @param {Phaser.Curves.Path} path - The Path this PathFollower is connected to. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. + * @return {Phaser.GameObjects.PathFollower} The Game Object that was created. */ -var Center = function (gameObject, alignIn, offsetX, offsetY) +GameObjectFactory.register('follower', function (path, x, y, key, frame) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + var sprite = new PathFollower(this.scene, path, x, y, key, frame); - CenterOn(gameObject, GetCenterX(alignIn) + offsetX, GetCenterY(alignIn) + offsetY); + this.displayList.add(sprite); + this.updateList.add(sprite); - return gameObject; -}; + return sprite; +}); -module.exports = Center; +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns /***/ }), -/* 294 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 33412: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetCenterX = __webpack_require__(88); -var SetCenterY = __webpack_require__(90); +var AnimationState = __webpack_require__(16569); +var Class = __webpack_require__(56694); +var GenerateGridVerts = __webpack_require__(99425); +var IntegerToRGB = __webpack_require__(15978); +var Mesh = __webpack_require__(83321); +var UUID = __webpack_require__(76583); /** - * Positions the Game Object so that it is centered on the given coordinates. + * @classdesc + * A Plane Game Object. * - * @function Phaser.Display.Bounds.CenterOn - * @since 3.0.0 + * The Plane Game Object is a helper class that takes the Mesh Game Object and extends it, + * allowing for fast and easy creation of Planes. A Plane is a one-sided grid of cells, + * where you specify the number of cells in each dimension. The Plane can have a texture + * that is either repeated (tiled) across each cell, or applied to the full Plane. * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * The Plane can then be manipulated in 3D space, with rotation across all 3 axis. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned. - * @param {number} x - The horizontal coordinate to position the Game Object on. - * @param {number} y - The vertical coordinate to position the Game Object on. + * This allows you to create effects not possible with regular Sprites, such as perspective + * distortion. You can also adjust the vertices on a per-vertex basis. Plane data becomes + * part of the WebGL batch, just like standard Sprites, so doesn't introduce any additional + * shader overhead. Because the Plane just generates vertices into the WebGL batch, like any + * other Sprite, you can use all of the common Game Object components on a Plane too, + * such as a custom pipeline, mask, blend mode or texture. * - * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned. + * You can use the `uvScroll` and `uvScale` methods to adjust the placement and scaling + * of the texture if this Plane is using a single texture, and not a frame from a texture + * atlas or sprite sheet. + * + * The Plane Game Object also has the Animation component, allowing you to play animations + * across the Plane just as you would with a Sprite. + * + * Note that the Plane object is WebGL only and does not have a Canvas counterpart. + * + * The Plane origin is always 0.5 x 0.5 and cannot be changed. + * + * @class Plane + * @extends Phaser.GameObjects.Mesh + * @memberof Phaser.GameObjects + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Plane belongs. A Plane can only belong to one Scene at a time. + * @param {number} [x] - The horizontal position of this Plane in the world. + * @param {number} [y] - The vertical position of this Plane in the world. + * @param {string|Phaser.Textures.Texture} [texture] - The key, or instance of the Texture this Plane will use to render with, as stored in the Texture Manager. + * @param {string|number} [frame] - An optional frame from the Texture this Plane is rendering with. + * @param {number} [width=8] - The width of this Plane, in cells, not pixels. + * @param {number} [height=8] - The height of this Plane, in cells, not pixels. + * @param {boolean} [tile=false] - Is the texture tiled? I.e. repeated across each cell. */ -var CenterOn = function (gameObject, x, y) -{ - SetCenterX(gameObject, x); - - return SetCenterY(gameObject, y); -}; +var Plane = new Class({ -module.exports = CenterOn; + Extends: Mesh, + initialize: -/***/ }), -/* 295 */ -/***/ (function(module, exports, __webpack_require__) { + function Plane (scene, x, y, texture, frame, width, height, tile) + { + if (!texture) { texture = '__DEFAULT'; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + Mesh.call(this, scene, x, y, texture, frame); -var GetCenterY = __webpack_require__(89); -var GetLeft = __webpack_require__(43); -var SetCenterY = __webpack_require__(90); -var SetLeft = __webpack_require__(53); + this.type = 'Plane'; -/** - * Takes given Game Object and aligns it so that it is positioned in the left center of the other. - * - * @function Phaser.Display.Align.In.LeftCenter - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var LeftCenter = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + /** + * The Animation State component of this Sprite. + * + * This component provides features to apply animations to this Sprite. + * It is responsible for playing, loading, queuing animations for later playback, + * mixing between animations and setting the current animation frame to this Sprite. + * + * @name Phaser.GameObjects.Plane#anims + * @type {Phaser.Animations.AnimationState} + * @since 3.60.0 + */ + this.anims = new AnimationState(this); - SetLeft(gameObject, GetLeft(alignIn) - offsetX); - SetCenterY(gameObject, GetCenterY(alignIn) + offsetY); + /** + * The width of this Plane in cells, not pixels. + * + * This value is read-only. To adjust it, see the `setGridSize` method. + * + * @name Phaser.GameObjects.Plane#gridWidth + * @type {number} + * @readonly + * @since 3.60.0 + */ + this.gridWidth; - return gameObject; -}; + /** + * The height of this Plane in cells, not pixels. + * + * This value is read-only. To adjust it, see the `setGridSize` method. + * + * @name Phaser.GameObjects.Plane#gridHeight + * @type {number} + * @readonly + * @since 3.60.0 + */ + this.gridHeight; -module.exports = LeftCenter; + /** + * Is the texture of this Plane tiled across all cells, or not? + * + * This value is read-only. To adjust it, see the `setGridSize` method. + * + * @name Phaser.GameObjects.Plane#isTiled + * @type {boolean} + * @readonly + * @since 3.60.0 + */ + this.isTiled; + /** + * If this Plane has a checkboard texture, this is a reference to + * the WebGLTexture being used. Otherwise, it's null. + * + * @name Phaser.GameObjects.Plane#_checkerboard + * @type {?WebGLTexture} + * @private + * @since 3.60.0 + */ + this._checkerboard = null; -/***/ }), -/* 296 */ -/***/ (function(module, exports, __webpack_require__) { + this.hideCCW = false; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.setGridSize(width, height, tile); + this.setSizeToFrame(false); + this.setViewHeight(); + }, -var GetCenterY = __webpack_require__(89); -var GetRight = __webpack_require__(44); -var SetCenterY = __webpack_require__(90); -var SetRight = __webpack_require__(54); + /** + * Modifies the layout of this Plane by adjusting the grid dimensions to the + * given width and height. The values are given in cells, not pixels. + * + * The `tile` parameter allows you to control if the texture is tiled, or + * applied across the entire Plane? A tiled texture will repeat with one + * iteration per cell. A non-tiled texture will be applied across the whole + * Plane. + * + * Note that if this Plane is using a single texture, not from a texture atlas + * or sprite sheet, then you can use the `Plane.uvScale` method to have much + * more fine-grained control over the texture tiling. + * + * @method Phaser.GameObjects.Plane#preDestroy + * @since 3.60.0 + * + * @param {number} [width=8] - The width of this Plane, in cells, not pixels. + * @param {number} [height=8] - The height of this Plane, in cells, not pixels. + * @param {boolean} [tile=false] - Is the texture tiled? I.e. repeated across each cell. + */ + setGridSize: function (width, height, tile) + { + if (width === undefined) { width = 8; } + if (height === undefined) { height = 8; } + if (tile === undefined) { tile = false; } -/** - * Takes given Game Object and aligns it so that it is positioned in the right center of the other. - * - * @function Phaser.Display.Align.In.RightCenter - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var RightCenter = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + var flipY = false; - SetRight(gameObject, GetRight(alignIn) + offsetX); - SetCenterY(gameObject, GetCenterY(alignIn) + offsetY); + if (tile) + { + flipY = true; + } - return gameObject; -}; + this.gridWidth = width; + this.gridHeight = height; + this.isTiled = tile; -module.exports = RightCenter; + this.clear(); + GenerateGridVerts({ + mesh: this, + widthSegments: width, + heightSegments: height, + isOrtho: false, + tile: tile, + flipY: flipY + }); -/***/ }), -/* 297 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * An internal method that resets the perspective projection for this Plane + * when it changes texture or frame, and also resets the cell UV coordinates, + * if required. + * + * @method Phaser.GameObjects.Plane#setSizeToFrame + * @since 3.60.0 + * @override + * + * @param {boolean} [resetUV=true] - Reset all of the cell UV coordinates? + * + * @return {this} This Game Object instance. + */ + setSizeToFrame: function (resetUV) + { + if (resetUV === undefined) { resetUV = true; } -var GetCenterX = __webpack_require__(87); -var GetTop = __webpack_require__(45); -var SetCenterX = __webpack_require__(88); -var SetTop = __webpack_require__(52); + var frame = this.frame; -/** - * Takes given Game Object and aligns it so that it is positioned in the top center of the other. - * - * @function Phaser.Display.Align.In.TopCenter - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var TopCenter = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + this.setPerspective(this.width / frame.width, this.height / frame.height); - SetCenterX(gameObject, GetCenterX(alignIn) + offsetX); - SetTop(gameObject, GetTop(alignIn) - offsetY); + if (this._checkerboard && this._checkerboard !== this.texture) + { + this.removeCheckerboard(); + } - return gameObject; -}; + if (!resetUV) + { + return this; + } -module.exports = TopCenter; + // Reset UV coordinates if frame has changed + var gridX = this.gridWidth; + var gridY = this.gridHeight; -/***/ }), -/* 298 */ -/***/ (function(module, exports, __webpack_require__) { + var verts = this.vertices; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var frameU0 = frame.u0; + var frameU1 = frame.u1; + var frameV0 = frame.v0; + var frameV1 = frame.v1; -var GetLeft = __webpack_require__(43); -var GetTop = __webpack_require__(45); -var SetLeft = __webpack_require__(53); -var SetTop = __webpack_require__(52); + var x; + var y; + var i = 0; -/** - * Takes given Game Object and aligns it so that it is positioned in the top left of the other. - * - * @function Phaser.Display.Align.In.TopLeft - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var TopLeft = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + if (this.isTiled) + { + // flipY + frameV0 = frame.v1; + frameV1 = frame.v0; - SetLeft(gameObject, GetLeft(alignIn) - offsetX); - SetTop(gameObject, GetTop(alignIn) - offsetY); + for (y = 0; y < gridY; y++) + { + for (x = 0; x < gridX; x++) + { + verts[i++].setUVs(frameU0, frameV1); + verts[i++].setUVs(frameU0, frameV0); + verts[i++].setUVs(frameU1, frameV1); + verts[i++].setUVs(frameU0, frameV0); + verts[i++].setUVs(frameU1, frameV0); + verts[i++].setUVs(frameU1, frameV1); + } + } + } + else + { + var gridX1 = gridX + 1; + var gridY1 = gridY + 1; - return gameObject; -}; + var frameU = frameU1 - frameU0; + var frameV = frameV1 - frameV0; -module.exports = TopLeft; + var uvs = []; + for (y = 0; y < gridY1; y++) + { + for (x = 0; x < gridX1; x++) + { + var tu = frameU0 + frameU * (x / gridX); + var tv = frameV0 + frameV * (y / gridY); -/***/ }), -/* 299 */ -/***/ (function(module, exports, __webpack_require__) { + uvs.push(tu, tv); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (y = 0; y < gridY; y++) + { + for (x = 0; x < gridX; x++) + { + var a = (x + gridX1 * y) * 2; + var b = (x + gridX1 * (y + 1)) * 2; + var c = ((x + 1) + gridX1 * (y + 1)) * 2; + var d = ((x + 1) + gridX1 * y) * 2; + + verts[i++].setUVs(uvs[a], uvs[a + 1]); + verts[i++].setUVs(uvs[b], uvs[b + 1]); + verts[i++].setUVs(uvs[d], uvs[d + 1]); + verts[i++].setUVs(uvs[b], uvs[b + 1]); + verts[i++].setUVs(uvs[c], uvs[c + 1]); + verts[i++].setUVs(uvs[d], uvs[d + 1]); + } + } + } -var GetRight = __webpack_require__(44); -var GetTop = __webpack_require__(45); -var SetRight = __webpack_require__(54); -var SetTop = __webpack_require__(52); + return this; + }, -/** - * Takes given Game Object and aligns it so that it is positioned in the top right of the other. - * - * @function Phaser.Display.Align.In.TopRight - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be positioned. - * @param {Phaser.GameObjects.GameObject} alignIn - The Game Object to base the alignment position on. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. - * - * @return {Phaser.GameObjects.GameObject} The Game Object that was aligned. - */ -var TopRight = function (gameObject, alignIn, offsetX, offsetY) -{ - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } + /** + * Sets the height of this Plane to match the given value, in pixels. + * + * This adjusts the `Plane.viewPosition.z` value to achieve this. + * + * If no `value` parameter is given, it will set the view height to match + * that of the current texture frame the Plane is using. + * + * @method Phaser.GameObjects.Plane#setViewHeight + * @since 3.60.0 + * + * @param {number} [value] - The height, in pixels, to set this Plane view height to. + */ + setViewHeight: function (value) + { + if (value === undefined) { value = this.frame.height; } - SetRight(gameObject, GetRight(alignIn) + offsetX); - SetTop(gameObject, GetTop(alignIn) - offsetY); + var vFOV = this.fov * (Math.PI / 180); - return gameObject; -}; + this.viewPosition.z = (this.height / value) / (Math.tan(vFOV / 2)); -module.exports = TopRight; + this.dirtyCache[10] = 1; + }, + /** + * Creates a checkerboard style texture, based on the given colors and alpha + * values and applies it to this Plane, replacing any current texture it may + * have. + * + * The colors are used in an alternating pattern, like a chess board. + * + * Calling this method generates a brand new 16x16 pixel WebGLTexture internally + * and applies it to this Plane. While quite fast to do, you should still be + * mindful of calling this method either extensively, or in tight parts of + * your game. + * + * @method Phaser.GameObjects.Plane#createCheckerboard + * @since 3.60.0 + * + * @param {number} [color1=0xffffff] - The odd cell color, specified as a hex value. + * @param {number} [color2=0x0000ff] - The even cell color, specified as a hex value. + * @param {number} [alpha1=255] - The odd cell alpha value, specified as a number between 0 and 255. + * @param {number} [alpha2=255] - The even cell alpha value, specified as a number between 0 and 255. + * @param {number} [height=128] - The view height of the Plane after creation, in pixels. + */ + createCheckerboard: function (color1, color2, alpha1, alpha2, height) + { + if (color1 === undefined) { color1 = 0xffffff; } + if (color2 === undefined) { color2 = 0x0000ff; } + if (alpha1 === undefined) { alpha1 = 255; } + if (alpha2 === undefined) { alpha2 = 255; } + if (height === undefined) { height = 128; } -/***/ }), -/* 300 */ -/***/ (function(module, exports, __webpack_require__) { + var gl = this.scene.sys.renderer.gl; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var glTexture = gl.createTexture(); -var CircumferencePoint = __webpack_require__(169); -var FromPercent = __webpack_require__(98); -var MATH_CONST = __webpack_require__(14); -var Point = __webpack_require__(4); + gl.activeTexture(gl.TEXTURE0); -/** - * Returns a Point object containing the coordinates of a point on the circumference of the Circle - * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point - * at 180 degrees around the circle. - * - * @function Phaser.Geom.Circle.GetPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on. - * @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle. - * @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created. - * - * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the circle. - */ -var GetPoint = function (circle, position, out) -{ - if (out === undefined) { out = new Point(); } + gl.bindTexture(gl.TEXTURE_2D, glTexture); - var angle = FromPercent(position, 0, MATH_CONST.PI2); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); - return CircumferencePoint(circle, angle, out); -}; + // Let's assume 16x16 for our texture size and 8x8 cell size -module.exports = GetPoint; + var c1 = IntegerToRGB(color1); + var c2 = IntegerToRGB(color2); + var colors = []; -/***/ }), -/* 301 */ -/***/ (function(module, exports, __webpack_require__) { + for (var h = 0; h < 16; h++) + { + for (var w = 0; w < 16; w++) + { + if ((h < 8 && w < 8) || (h > 7 && w > 7)) + { + colors.push(c1.r, c1.g, c1.b, alpha1); + } + else + { + colors.push(c2.r, c2.g, c2.b, alpha2); + } + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(colors)); -var Circumference = __webpack_require__(302); -var CircumferencePoint = __webpack_require__(169); -var FromPercent = __webpack_require__(98); -var MATH_CONST = __webpack_require__(14); + glTexture.isAlphaPremultiplied = true; + glTexture.isRenderTexture = false; + glTexture.width = 16; + glTexture.height = 16; -/** - * Returns an array of Point objects containing the coordinates of the points around the circumference of the Circle, - * based on the given quantity or stepRate values. - * - * @function Phaser.Geom.Circle.GetPoints - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the points from. - * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. - * @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate. - * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created. - * - * @return {Phaser.Geom.Point[]} An array of Point objects pertaining to the points around the circumference of the circle. - */ -var GetPoints = function (circle, quantity, stepRate, out) -{ - if (out === undefined) { out = []; } + var texture = this.scene.sys.textures.addGLTexture(UUID(), glTexture, 16, 16); - // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!quantity && stepRate > 0) - { - quantity = Circumference(circle) / stepRate; - } + this.removeCheckerboard(); - for (var i = 0; i < quantity; i++) - { - var angle = FromPercent(i / quantity, 0, MATH_CONST.PI2); + this._checkerboard = texture; - out.push(CircumferencePoint(circle, angle)); - } + gl.bindTexture(gl.TEXTURE_2D, null); - return out; -}; + this.setTexture(texture); -module.exports = GetPoints; + this.setSizeToFrame(); + this.setViewHeight(height); -/***/ }), -/* 302 */ -/***/ (function(module, exports) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Returns the circumference of the given Circle. - * - * @function Phaser.Geom.Circle.Circumference - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference of. - * - * @return {number} The circumference of the Circle. - */ -var Circumference = function (circle) -{ - return 2 * (Math.PI * circle.radius); -}; - -module.exports = Circumference; - - -/***/ }), -/* 303 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * If this Plane has a Checkerboard Texture, this method will destroy it + * and reset the internal flag for it. + * + * @method Phaser.GameObjects.Plane#removeCheckerboard + * @since 3.60.0 + */ + removeCheckerboard: function () + { + if (this._checkerboard) + { + this._checkerboard.destroy(); -var Clamp = __webpack_require__(18); + this._checkerboard = null; + } + }, -// bitmask flag for GameObject.renderMask -var _FLAG = 2; // 0010 + /** + * Start playing the given animation on this Plane. + * + * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Plane. + * + * The benefit of a global animation is that multiple Game Objects can all play the same animation, without + * having to duplicate the data. You can just create it once and then play it on any animating Game Object. + * + * The following code shows how to create a global repeating animation. The animation will be created + * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': + * + * ```javascript + * var config = { + * key: 'run', + * frames: 'muybridge', + * frameRate: 15, + * repeat: -1 + * }; + * + * // This code should be run from within a Scene: + * this.anims.create(config); + * ``` + * + * However, if you wish to create an animation that is unique to this Plane, and this Plane alone, + * you can call the `Animation.create` method instead. It accepts the exact same parameters as when + * creating a global animation, however the resulting data is kept locally in this Plane. + * + * With the animation created, either globally or locally, you can now play it on this Plane: + * + * ```javascript + * const plane = this.add.plane(...); + * plane.play('run'); + * ``` + * + * Alternatively, if you wish to run it at a different frame rate for example, you can pass a config + * object instead: + * + * ```javascript + * const plane = this.add.plane(...); + * plane.play({ key: 'run', frameRate: 24 }); + * ``` + * + * When playing an animation on a Plane it will first check to see if it can find a matching key + * locally within the Plane. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * If you need a Plane to be able to play both local and global animations, make sure they don't + * have conflicting keys. + * + * See the documentation for the `PlayAnimationConfig` config object for more details about this. + * + * Also, see the documentation in the Animation Manager for further details on creating animations. + * + * @method Phaser.GameObjects.Plane#play + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.60.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. + * + * @return {this} This Game Object. + */ + play: function (key, ignoreIfPlaying) + { + return this.anims.play(key, ignoreIfPlaying); + }, -/** - * Provides methods used for setting the alpha property of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @namespace Phaser.GameObjects.Components.AlphaSingle - * @since 3.22.0 - */ + /** + * Start playing the given animation on this Plane, in reverse. + * + * Animations in Phaser can either belong to the global Animation Manager, or specifically to a Game Object. + * + * The benefit of a global animation is that multiple Game Objects can all play the same animation, without + * having to duplicate the data. You can just create it once and then play it on any animating Game Object. + * + * The following code shows how to create a global repeating animation. The animation will be created + * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': + * + * ```javascript + * var config = { + * key: 'run', + * frames: 'muybridge', + * frameRate: 15, + * repeat: -1 + * }; + * + * // This code should be run from within a Scene: + * this.anims.create(config); + * ``` + * + * However, if you wish to create an animation that is unique to this Game Object, and this Game Object alone, + * you can call the `Animation.create` method instead. It accepts the exact same parameters as when + * creating a global animation, however the resulting data is kept locally in this Game Object. + * + * With the animation created, either globally or locally, you can now play it on this Game Object: + * + * ```javascript + * const plane = this.add.plane(...); + * plane.playReverse('run'); + * ``` + * + * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config + * object instead: + * + * ```javascript + * const plane = this.add.plane(...); + * plane.playReverse({ key: 'run', frameRate: 24 }); + * ``` + * + * When playing an animation on a Game Object it will first check to see if it can find a matching key + * locally within the Game Object. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * If you need a Game Object to be able to play both local and global animations, make sure they don't + * have conflicting keys. + * + * See the documentation for the `PlayAnimationConfig` config object for more details about this. + * + * Also, see the documentation in the Animation Manager for further details on creating animations. + * + * @method Phaser.GameObjects.Plane#playReverse + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.60.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. + * + * @return {this} This Game Object. + */ + playReverse: function (key, ignoreIfPlaying) + { + return this.anims.playReverse(key, ignoreIfPlaying); + }, -var AlphaSingle = { + /** + * Waits for the specified delay, in milliseconds, then starts playback of the given animation. + * + * If the animation _also_ has a delay value set in its config, it will be **added** to the delay given here. + * + * If an animation is already running and a new animation is given to this method, it will wait for + * the given delay before starting the new animation. + * + * If no animation is currently running, the given one begins after the delay. + * + * When playing an animation on a Game Object it will first check to see if it can find a matching key + * locally within the Game Object. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * @method Phaser.GameObjects.Plane#playAfterDelay + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.60.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {number} delay - The delay, in milliseconds, to wait before starting the animation playing. + * + * @return {this} This Game Object. + */ + playAfterDelay: function (key, delay) + { + return this.anims.playAfterDelay(key, delay); + }, /** - * Private internal value. Holds the global alpha value. + * Waits for the current animation to complete the `repeatCount` number of repeat cycles, then starts playback + * of the given animation. * - * @name Phaser.GameObjects.Components.AlphaSingle#_alpha - * @type {number} - * @private - * @default 1 - * @since 3.0.0 + * You can use this to ensure there are no harsh jumps between two sets of animations, i.e. going from an + * idle animation to a walking animation, by making them blend smoothly into each other. + * + * If no animation is currently running, the given one will start immediately. + * + * When playing an animation on a Game Object it will first check to see if it can find a matching key + * locally within the Game Object. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * @method Phaser.GameObjects.Plane#playAfterRepeat + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.60.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {number} [repeatCount=1] - How many times should the animation repeat before the next one starts? + * + * @return {this} This Game Object. */ - _alpha: 1, + playAfterRepeat: function (key, repeatCount) + { + return this.anims.playAfterRepeat(key, repeatCount); + }, /** - * Clears all alpha values associated with this Game Object. + * Immediately stops the current animation from playing and dispatches the `ANIMATION_STOP` events. * - * Immediately sets the alpha levels back to 1 (fully opaque). + * If no animation is playing, no event will be dispatched. * - * @method Phaser.GameObjects.Components.AlphaSingle#clearAlpha - * @since 3.0.0 + * If there is another animation queued (via the `chain` method) then it will start playing immediately. * - * @return {this} This Game Object instance. + * @method Phaser.GameObjects.Plane#stop + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.60.0 + * + * @return {this} This Game Object. */ - clearAlpha: function () + stop: function () { - return this.setAlpha(1); + return this.anims.stop(); }, /** - * Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders. - * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. + * Stops the current animation from playing after the specified time delay, given in milliseconds. * - * @method Phaser.GameObjects.Components.AlphaSingle#setAlpha - * @since 3.0.0 + * It then dispatches the `ANIMATION_STOP` event. * - * @param {number} [value=1] - The alpha value applied across the whole Game Object. + * If no animation is running, no events will be dispatched. * - * @return {this} This Game Object instance. + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * @method Phaser.GameObjects.Plane#stopAfterDelay + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.60.0 + * + * @param {number} delay - The number of milliseconds to wait before stopping this animation. + * + * @return {this} This Game Object. */ - setAlpha: function (value) + stopAfterDelay: function (delay) { - if (value === undefined) { value = 1; } + return this.anims.stopAfterDelay(delay); + }, - this.alpha = value; + /** + * Stops the current animation from playing after the given number of repeats. + * + * It then dispatches the `ANIMATION_STOP` event. + * + * If no animation is running, no events will be dispatched. + * + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * @method Phaser.GameObjects.Plane#stopAfterRepeat + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.60.0 + * + * @param {number} [repeatCount=1] - How many times should the animation repeat before stopping? + * + * @return {this} This Game Object. + */ + stopAfterRepeat: function (repeatCount) + { + return this.anims.stopAfterRepeat(repeatCount); + }, - return this; + /** + * Stops the current animation from playing when it next sets the given frame. + * If this frame doesn't exist within the animation it will not stop it from playing. + * + * It then dispatches the `ANIMATION_STOP` event. + * + * If no animation is running, no events will be dispatched. + * + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * @method Phaser.GameObjects.Plane#stopOnFrame + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.60.0 + * + * @param {Phaser.Animations.AnimationFrame} frame - The frame to check before stopping this animation. + * + * @return {this} This Game Object. + */ + stopOnFrame: function (frame) + { + return this.anims.stopOnFrame(frame); }, /** - * The alpha value of the Game Object. + * Runs the preUpdate for this Plane, which will check its Animation State, + * if one is playing, and refresh view / model matrices, if updated. * - * This is a global value, impacting the entire Game Object, not just a region of it. + * @method Phaser.GameObjects.Plane#preUpdate + * @protected + * @since 3.60.0 * - * @name Phaser.GameObjects.Components.AlphaSingle#alpha - * @type {number} - * @since 3.0.0 + * @param {number} time - The current timestamp. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - alpha: { + preUpdate: function (time, delta) + { + Mesh.prototype.preUpdate.call(this, time, delta); - get: function () - { - return this._alpha; - }, + this.anims.update(time, delta); + }, - set: function (value) - { - var v = Clamp(value, 0, 1); + /** + * Handles the pre-destroy step for the Plane, which removes the vertices and debug callbacks. + * + * @method Phaser.GameObjects.Plane#preDestroy + * @private + * @since 3.60.0 + */ + preDestroy: function () + { + this.clear(); + this.removeCheckerboard(); - this._alpha = v; + this.anims.destroy(); - if (v === 0) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } - } + this.anims = undefined; + this.debugCallback = null; + this.debugGraphic = null; } -}; +}); -module.exports = AlphaSingle; +module.exports = Plane; /***/ }), -/* 304 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 10912: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BlendModes = __webpack_require__(35); +var BuildGameObject = __webpack_require__(88933); +var BuildGameObjectAnimation = __webpack_require__(32291); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var GetValue = __webpack_require__(10850); +var Plane = __webpack_require__(33412); /** - * Provides methods used for setting the blend mode of a Game Object. - * Should be applied as a mixin and not used directly. + * Creates a new Plane Game Object and returns it. * - * @namespace Phaser.GameObjects.Components.BlendMode - * @since 3.0.0 + * Note: This method will only be available if the Plane Game Object and WebGL support have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#plane + * @since 3.60.0 + * + * @param {Phaser.Types.GameObjects.Plane.PlaneConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Plane} The Game Object that was created. */ +GameObjectCreator.register('plane', function (config, addToScene) +{ + if (config === undefined) { config = {}; } -var BlendMode = { + var key = GetAdvancedValue(config, 'key', null); + var frame = GetAdvancedValue(config, 'frame', null); + var width = GetValue(config, 'width', 8); + var height = GetValue(config, 'height', 8); + var tile = GetValue(config, 'tile', false); - /** - * Private internal value. Holds the current blend mode. - * - * @name Phaser.GameObjects.Components.BlendMode#_blendMode - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - _blendMode: BlendModes.NORMAL, + var plane = new Plane(this.scene, 0, 0, key, frame, width, height, tile); - /** - * Sets the Blend Mode being used by this Game Object. - * - * This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay) - * - * Under WebGL only the following Blend Modes are available: - * - * * ADD - * * MULTIPLY - * * SCREEN - * * ERASE - * - * Canvas has more available depending on browser support. - * - * You can also create your own custom Blend Modes in WebGL. - * - * Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending - * on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these - * reasons try to be careful about the construction of your Scene and the frequency of which blend modes - * are used. - * - * @name Phaser.GameObjects.Components.BlendMode#blendMode - * @type {(Phaser.BlendModes|string)} - * @since 3.0.0 - */ - blendMode: { + if (addToScene !== undefined) + { + config.add = addToScene; + } - get: function () - { - return this._blendMode; - }, + var checkerboard = GetValue(config, 'checkerboard', null); - set: function (value) - { - if (typeof value === 'string') - { - value = BlendModes[value]; - } + if (checkerboard) + { + var color1 = GetValue(checkerboard, 'color1', 0xffffff); + var color2 = GetValue(checkerboard, 'color2', 0x0000ff); + var alpha1 = GetValue(checkerboard, 'alpha1', 255); + var alpha2 = GetValue(checkerboard, 'alpha2', 255); + var checkheight = GetValue(checkerboard, 'height', 128); - value |= 0; + plane.createCheckerboard(color1, color2, alpha1, alpha2, checkheight); + } - if (value >= -1) - { - this._blendMode = value; - } - } + BuildGameObject(this.scene, plane, config); - }, + BuildGameObjectAnimation(plane, config); - /** - * Sets the Blend Mode being used by this Game Object. - * - * This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay) - * - * Under WebGL only the following Blend Modes are available: - * - * * ADD - * * MULTIPLY - * * SCREEN - * * ERASE (only works when rendering to a framebuffer, like a Render Texture) - * - * Canvas has more available depending on browser support. - * - * You can also create your own custom Blend Modes in WebGL. - * - * Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending - * on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these - * reasons try to be careful about the construction of your Scene and the frequency in which blend modes - * are used. - * - * @method Phaser.GameObjects.Components.BlendMode#setBlendMode - * @since 3.0.0 - * - * @param {(string|Phaser.BlendModes)} value - The BlendMode value. Either a string or a CONST. - * - * @return {this} This Game Object instance. - */ - setBlendMode: function (value) - { - this.blendMode = value; + return plane; +}); - return this; - } -}; +/***/ }), -module.exports = BlendMode; +/***/ 58322: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Plane = __webpack_require__(33412); +var GameObjectFactory = __webpack_require__(61286); + +/** + * Creates a new Plane Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Plane Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#plane + * @since 3.60.0 + * + * @param {number} [x] - The horizontal position of this Plane in the world. + * @param {number} [y] - The vertical position of this Plane in the world. + * @param {string|Phaser.Textures.Texture} [texture] - The key, or instance of the Texture this Plane will use to render with, as stored in the Texture Manager. + * @param {string|number} [frame] - An optional frame from the Texture this Plane is rendering with. + * @param {number} [width=8] - The width of this Plane, in cells, not pixels. + * @param {number} [height=8] - The height of this Plane, in cells, not pixels. + * @param {boolean} [tile=false] - Is the texture tiled? I.e. repeated across each cell. + * + * @return {Phaser.GameObjects.Plane} The Plane Game Object that was created. + */ +GameObjectFactory.register('plane', function (x, y, texture, frame, width, height, tile) +{ + return this.displayList.add(new Plane(this.scene, x, y, texture, frame, width, height, tile)); +}); /***/ }), -/* 305 */ -/***/ (function(module, exports) { + +/***/ 13171: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var IntegerToColor = __webpack_require__(74853); +var PIPELINES_CONST = __webpack_require__(65641); +var Render = __webpack_require__(71606); + /** - * Provides methods used for setting the depth of a Game Object. - * Should be applied as a mixin and not used directly. + * @classdesc + * The Point Light Game Object provides a way to add a point light effect into your game, + * without the expensive shader processing requirements of the traditional Light Game Object. * - * @namespace Phaser.GameObjects.Components.Depth - * @since 3.0.0 + * The difference is that the Point Light renders using a custom shader, designed to give the + * impression of a point light source, of variable radius, intensity and color, in your game. + * However, unlike the Light Game Object, it does not impact any other Game Objects, or use their + * normal maps for calcuations. This makes them extremely fast to render compared to Lights + * and perfect for special effects, such as flickering torches or muzzle flashes. + * + * For maximum performance you should batch Point Light Game Objects together. This means + * ensuring they follow each other consecutively on the display list. Ideally, use a Layer + * Game Object and then add just Point Lights to it, so that it can batch together the rendering + * of the lights. You don't _have_ to do this, and if you've only a handful of Point Lights in + * your game then it's perfectly safe to mix them into the dislay list as normal. However, if + * you're using a large number of them, please consider how they are mixed into the display list. + * + * The renderer will automatically cull Point Lights. Those with a radius that does not intersect + * with the Camera will be skipped in the rendering list. This happens automatically and the + * culled state is refreshed every frame, for every camera. + * + * The origin of a Point Light is always 0.5 and it cannot be changed. + * + * Point Lights are a WebGL only feature and do not have a Canvas counterpart. + * + * @class PointLight + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.50.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Point Light belongs. A Point Light can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Point Light in the world. + * @param {number} y - The vertical position of this Point Light in the world. + * @param {number} [color=0xffffff] - The color of the Point Light, given as a hex value. + * @param {number} [radius=128] - The radius of the Point Light. + * @param {number} [intensity=1] - The intensity, or color blend, of the Point Light. + * @param {number} [attenuation=0.1] - The attenuation of the Point Light. This is the reduction of light from the center point. */ +var PointLight = new Class({ -var Depth = { + Extends: GameObject, - /** - * Private internal value. Holds the depth of the Game Object. - * - * @name Phaser.GameObjects.Components.Depth#_depth - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - _depth: 0, + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.Mask, + Components.Pipeline, + Components.PostPipeline, + Components.ScrollFactor, + Components.Transform, + Components.Visible, + Render + ], + + initialize: + + function PointLight (scene, x, y, color, radius, intensity, attenuation) + { + if (color === undefined) { color = 0xffffff; } + if (radius === undefined) { radius = 128; } + if (intensity === undefined) { intensity = 1; } + if (attenuation === undefined) { attenuation = 0.1; } + + GameObject.call(this, scene, 'PointLight'); + + this.initPipeline(PIPELINES_CONST.POINTLIGHT_PIPELINE); + this.initPostPipeline(); + + this.setPosition(x, y); + + /** + * The color of this Point Light. This property is an instance of a + * Color object, so you can use the methods within it, such as `setTo(r, g, b)` + * to change the color value. + * + * @name Phaser.GameObjects.PointLight#color + * @type {Phaser.Display.Color} + * @since 3.50.0 + */ + this.color = IntegerToColor(color); + + /** + * The intensity of the Point Light. + * + * The colors of the light are multiplied by this value during rendering. + * + * @name Phaser.GameObjects.PointLight#intensity + * @type {number} + * @since 3.50.0 + */ + this.intensity = intensity; + + /** + * The attenuation of the Point Light. + * + * This value controls the force with which the light falls-off from the center of the light. + * + * Use small float-based values, i.e. 0.1. + * + * @name Phaser.GameObjects.PointLight#attenuation + * @type {number} + * @since 3.50.0 + */ + this.attenuation = attenuation; + + // read only: + this.width = radius * 2; + this.height = radius * 2; + + this._radius = radius; + }, /** - * The depth of this Game Object within the Scene. - * - * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order - * of Game Objects, without actually moving their position in the display list. - * - * The default depth is zero. A Game Object with a higher depth - * value will always render in front of one with a lower value. - * - * Setting the depth will queue a depth sort event within the Scene. + * The radius of the Point Light. * - * @name Phaser.GameObjects.Components.Depth#depth + * @name Phaser.GameObjects.PointLight#radius * @type {number} - * @since 3.0.0 + * @since 3.50.0 */ - depth: { + radius: { get: function () { - return this._depth; + return this._radius; }, set: function (value) { - if (this.displayList) - { - this.displayList.queueDepthSort(); - } + this._radius = value; + this.width = value * 2; + this.height = value * 2; + } - this._depth = value; + }, + + originX: { + + get: function () + { + return 0.5; } }, - /** - * The depth of this Game Object within the Scene. - * - * The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order - * of Game Objects, without actually moving their position in the display list. - * - * The default depth is zero. A Game Object with a higher depth - * value will always render in front of one with a lower value. - * - * Setting the depth will queue a depth sort event within the Scene. - * - * @method Phaser.GameObjects.Components.Depth#setDepth - * @since 3.0.0 - * - * @param {number} value - The depth of this Game Object. - * - * @return {this} This Game Object instance. - */ - setDepth: function (value) - { - if (value === undefined) { value = 0; } + originY: { - this.depth = value; + get: function () + { + return 0.5; + } + + }, + + displayOriginX: { + + get: function () + { + return this._radius; + } + + }, + + displayOriginY: { + + get: function () + { + return this._radius; + } - return this; } -}; +}); -module.exports = Depth; +module.exports = PointLight; /***/ }), -/* 306 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 162: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetPoint = __webpack_require__(171); -var Perimeter = __webpack_require__(130); - -// Return an array of points from the perimeter of the rectangle -// each spaced out based on the quantity or step required +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var PointLight = __webpack_require__(13171); /** - * Return an array of points from the perimeter of the rectangle, each spaced out based on the quantity or step required. + * Creates a new Point Light Game Object and returns it. * - * @function Phaser.Geom.Rectangle.GetPoints - * @since 3.0.0 + * Note: This method will only be available if the Point Light Game Object has been built into Phaser. * - * @generic {Phaser.Geom.Point[]} O - [out,$return] + * @method Phaser.GameObjects.GameObjectCreator#pointlight + * @since 3.50.0 * - * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle object to get the points from. - * @param {number} step - Step between points. Used to calculate the number of points to return when quantity is falsey. Ignored if quantity is positive. - * @param {number} quantity - The number of evenly spaced points from the rectangles perimeter to return. If falsey, step param will be used to calculate the number of points. - * @param {(array|Phaser.Geom.Point[])} [out] - An optional array to store the points in. + * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * - * @return {(array|Phaser.Geom.Point[])} An array of Points from the perimeter of the rectangle. + * @return {Phaser.GameObjects.PointLight} The Game Object that was created. */ -var GetPoints = function (rectangle, quantity, stepRate, out) +GameObjectCreator.register('pointlight', function (config, addToScene) { - if (out === undefined) { out = []; } + if (config === undefined) { config = {}; } - // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!quantity && stepRate > 0) - { - quantity = Perimeter(rectangle) / stepRate; - } + var color = GetAdvancedValue(config, 'color', 0xffffff); + var radius = GetAdvancedValue(config, 'radius', 128); + var intensity = GetAdvancedValue(config, 'intensity', 1); + var attenuation = GetAdvancedValue(config, 'attenuation', 0.1); - for (var i = 0; i < quantity; i++) - { - var position = i / quantity; + var layer = new PointLight(this.scene, 0, 0, color, radius, intensity, attenuation); - out.push(GetPoint(rectangle, position)); + if (addToScene !== undefined) + { + config.add = addToScene; } - return out; -}; + BuildGameObject(this.scene, layer, config); -module.exports = GetPoints; + return layer; +}); /***/ }), -/* 307 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 91201: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Point = __webpack_require__(4); +var GameObjectFactory = __webpack_require__(61286); +var PointLight = __webpack_require__(13171); /** - * Get a point on a line that's a given percentage along its length. + * Creates a new Point Light Game Object and adds it to the Scene. * - * @function Phaser.Geom.Line.GetPoint - * @since 3.0.0 + * Note: This method will only be available if the Point Light Game Object has been built into Phaser. * - * @generic {Phaser.Geom.Point} O - [out,$return] + * The Point Light Game Object provides a way to add a point light effect into your game, + * without the expensive shader processing requirements of the traditional Light Game Object. * - * @param {Phaser.Geom.Line} line - The line. - * @param {number} position - A value between 0 and 1, where 0 is the start, 0.5 is the middle and 1 is the end of the line. - * @param {(Phaser.Geom.Point|object)} [out] - An optional point, or point-like object, to store the coordinates of the point on the line. + * The difference is that the Point Light renders using a custom shader, designed to give the + * impression of a point light source, of variable radius, intensity and color, in your game. + * However, unlike the Light Game Object, it does not impact any other Game Objects, or use their + * normal maps for calcuations. This makes them extremely fast to render compared to Lights + * and perfect for special effects, such as flickering torches or muzzle flashes. * - * @return {(Phaser.Geom.Point|object)} The point on the line. + * For maximum performance you should batch Point Light Game Objects together. This means + * ensuring they follow each other consecutively on the display list. Ideally, use a Layer + * Game Object and then add just Point Lights to it, so that it can batch together the rendering + * of the lights. You don't _have_ to do this, and if you've only a handful of Point Lights in + * your game then it's perfectly safe to mix them into the dislay list as normal. However, if + * you're using a large number of them, please consider how they are mixed into the display list. + * + * The renderer will automatically cull Point Lights. Those with a radius that does not intersect + * with the Camera will be skipped in the rendering list. This happens automatically and the + * culled state is refreshed every frame, for every camera. + * + * The origin of a Point Light is always 0.5 and it cannot be changed. + * + * Point Lights are a WebGL only feature and do not have a Canvas counterpart. + * + * @method Phaser.GameObjects.GameObjectFactory#pointlight + * @since 3.50.0 + * + * @param {number} x - The horizontal position of this Point Light in the world. + * @param {number} y - The vertical position of this Point Light in the world. + * @param {number} [color=0xffffff] - The color of the Point Light, given as a hex value. + * @param {number} [radius=128] - The radius of the Point Light. + * @param {number} [intensity=1] - The intensity, or color blend, of the Point Light. + * @param {number} [attenuation=0.1] - The attenuation of the Point Light. This is the reduction of light from the center point. + * + * @return {Phaser.GameObjects.PointLight} The Game Object that was created. */ -var GetPoint = function (line, position, out) +GameObjectFactory.register('pointlight', function (x, y, color, radius, intensity, attenuation) { - if (out === undefined) { out = new Point(); } - - out.x = line.x1 + (line.x2 - line.x1) * position; - out.y = line.y1 + (line.y2 - line.y1) * position; - - return out; -}; - -module.exports = GetPoint; + return this.displayList.add(new PointLight(this.scene, x, y, color, radius, intensity, attenuation)); +}); /***/ }), -/* 308 */ -/***/ (function(module, exports) { + +/***/ 71606: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * Rotate a `point` around `x` and `y` to the given `angle`, at the same distance. - * - * In polar notation, this maps a point from (r, t) to (r, angle), vs. the origin (x, y). - * - * @function Phaser.Math.RotateAround - * @since 3.0.0 - * - * @generic {Phaser.Types.Math.Vector2Like} T - [point,$return] - * - * @param {(Phaser.Geom.Point|object)} point - The point to be rotated. - * @param {number} x - The horizontal coordinate to rotate around. - * @param {number} y - The vertical coordinate to rotate around. - * @param {number} angle - The angle of rotation in radians. - * - * @return {Phaser.Types.Math.Vector2Like} The given point. - */ -var RotateAround = function (point, x, y, angle) +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) { - var c = Math.cos(angle); - var s = Math.sin(angle); + renderWebGL = __webpack_require__(80590); +} - var tx = point.x - x; - var ty = point.y - y; +module.exports = { - point.x = tx * c - ty * s + x; - point.y = tx * s + ty * c + y; + renderWebGL: renderWebGL, + renderCanvas: renderCanvas - return point; }; -module.exports = RotateAround; - /***/ }), -/* 309 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 80590: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapMask = __webpack_require__(310); -var GeometryMask = __webpack_require__(311); +var GetCalcMatrix = __webpack_require__(73329); /** - * Provides methods used for getting and setting the mask of a Game Object. + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @namespace Phaser.GameObjects.Components.Mask - * @since 3.0.0 + * @method Phaser.GameObjects.PointLight#renderWebGL + * @since 3.50.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.PointLight} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ +var PointLightWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); -var Mask = { + var pipeline = renderer.pipelines.set(src.pipeline); - /** - * The Mask this Game Object is using during render. - * - * @name Phaser.GameObjects.Components.Mask#mask - * @type {Phaser.Display.Masks.BitmapMask|Phaser.Display.Masks.GeometryMask} - * @since 3.0.0 - */ - mask: null, + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; - /** - * Sets the mask that this Game Object will use to render with. - * - * The mask must have been previously created and can be either a GeometryMask or a BitmapMask. - * Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. - * - * If a mask is already set on this Game Object it will be immediately replaced. - * - * Masks are positioned in global space and are not relative to the Game Object to which they - * are applied. The reason for this is that multiple Game Objects can all share the same mask. - * - * Masks have no impact on physics or input detection. They are purely a rendering component - * that allows you to limit what is visible during the render pass. - * - * @method Phaser.GameObjects.Components.Mask#setMask - * @since 3.6.2 - * - * @param {Phaser.Display.Masks.BitmapMask|Phaser.Display.Masks.GeometryMask} mask - The mask this Game Object will use when rendering. - * - * @return {this} This Game Object instance. - */ - setMask: function (mask) - { - this.mask = mask; + var width = src.width; + var height = src.height; - return this; - }, + var x = -src._radius; + var y = -src._radius; - /** - * Clears the mask that this Game Object was using. - * - * @method Phaser.GameObjects.Components.Mask#clearMask - * @since 3.6.2 - * - * @param {boolean} [destroyMask=false] - Destroy the mask before clearing it? - * - * @return {this} This Game Object instance. - */ - clearMask: function (destroyMask) - { - if (destroyMask === undefined) { destroyMask = false; } + var xw = x + width; + var yh = y + height; - if (destroyMask && this.mask) - { - this.mask.destroy(); - } + var lightX = calcMatrix.getX(0, 0); + var lightY = calcMatrix.getY(0, 0); - this.mask = null; + var tx0 = calcMatrix.getX(x, y); + var ty0 = calcMatrix.getY(x, y); - return this; - }, + var tx1 = calcMatrix.getX(x, yh); + var ty1 = calcMatrix.getY(x, yh); - /** - * Creates and returns a Bitmap Mask. This mask can be used by any Game Object, - * including this one. - * - * Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. - * - * To create the mask you need to pass in a reference to a renderable Game Object. - * A renderable Game Object is one that uses a texture to render with, such as an - * Image, Sprite, Render Texture or BitmapText. - * - * If you do not provide a renderable object, and this Game Object has a texture, - * it will use itself as the object. This means you can call this method to create - * a Bitmap Mask from any renderable Game Object. - * - * @method Phaser.GameObjects.Components.Mask#createBitmapMask - * @since 3.6.2 - * - * @param {Phaser.GameObjects.GameObject} [renderable] - A renderable Game Object that uses a texture, such as a Sprite. - * - * @return {Phaser.Display.Masks.BitmapMask} This Bitmap Mask that was created. - */ - createBitmapMask: function (renderable) - { - if (renderable === undefined && (this.texture || this.shader)) - { - // eslint-disable-next-line consistent-this - renderable = this; - } + var tx2 = calcMatrix.getX(xw, yh); + var ty2 = calcMatrix.getY(xw, yh); - return new BitmapMask(this.scene, renderable); - }, + var tx3 = calcMatrix.getX(xw, y); + var ty3 = calcMatrix.getY(xw, y); - /** - * Creates and returns a Geometry Mask. This mask can be used by any Game Object, - * including this one. - * - * To create the mask you need to pass in a reference to a Graphics Game Object. - * - * If you do not provide a graphics object, and this Game Object is an instance - * of a Graphics object, then it will use itself to create the mask. - * - * This means you can call this method to create a Geometry Mask from any Graphics Game Object. - * - * @method Phaser.GameObjects.Components.Mask#createGeometryMask - * @since 3.6.2 - * - * @param {Phaser.GameObjects.Graphics} [graphics] - A Graphics Game Object. The geometry within it will be used as the mask. - * - * @return {Phaser.Display.Masks.GeometryMask} This Geometry Mask that was created. - */ - createGeometryMask: function (graphics) - { - if (graphics === undefined && this.type === 'Graphics') - { - // eslint-disable-next-line consistent-this - graphics = this; - } + renderer.pipelines.preBatch(src); - return new GeometryMask(this.scene, graphics); - } + pipeline.batchPointLight(src, camera, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, lightX, lightY); + renderer.pipelines.postBatch(src); }; -module.exports = Mask; +module.exports = PointLightWebGLRenderer; /***/ }), -/* 310 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 15996: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var GameEvents = __webpack_require__(22); -var RenderEvents = __webpack_require__(91); +var Class = __webpack_require__(56694); +var DynamicTexture = __webpack_require__(845); +var Image = __webpack_require__(1539); /** * @classdesc - * A Bitmap Mask combines the alpha (opacity) of a masked pixel with the alpha of another pixel. - * Unlike the Geometry Mask, which is a clipping path, a Bitmap Mask behaves like an alpha mask, - * not a clipping path. It is only available when using the WebGL Renderer. + * A Render Texture is a combination of Dynamic Texture and an Image Game Object, that uses the + * Dynamic Texture to display itself with. * - * A Bitmap Mask can use any Game Object to determine the alpha of each pixel of the masked Game Object(s). - * For any given point of a masked Game Object's texture, the pixel's alpha will be multiplied by the alpha - * of the pixel at the same position in the Bitmap Mask's Game Object. The color of the pixel from the - * Bitmap Mask doesn't matter. + * A Dynamic Texture is a special texture that allows you to draw textures, frames and most kind of + * Game Objects directly to it. * - * For example, if a pure blue pixel with an alpha of 0.95 is masked with a pure red pixel with an - * alpha of 0.5, the resulting pixel will be pure blue with an alpha of 0.475. Naturally, this means - * that a pixel in the mask with an alpha of 0 will hide the corresponding pixel in all masked Game Objects - * A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the - * corresponding pixel in the mask. + * You can take many complex objects and draw them to this one texture, which can then be used as the + * base texture for other Game Objects, such as Sprites. Should you then update this texture, all + * Game Objects using it will instantly be updated as well, reflecting the changes immediately. * - * Note: You cannot combine Bitmap Masks and Blend Modes on the same Game Object. You can, however, - * combine Geometry Masks and Blend Modes together. + * It's a powerful way to generate dynamic textures at run-time that are WebGL friendly and don't invoke + * expensive GPU uploads on each change. * - * The Bitmap Mask's location matches the location of its Game Object, not the location of the - * masked objects. Moving or transforming the underlying Game Object will change the mask - * (and affect the visibility of any masked objects), whereas moving or transforming a masked object - * will not affect the mask. + * In versions of Phaser before 3.60 a Render Texture was the only way you could create a texture + * like this, that had the ability to be drawn on. But in 3.60 we split the core functions out to + * the Dynamic Texture class as it made a lot more sense for them to reside in there. As a result, + * the Render Texture is now a light-weight shim that sits on-top of an Image Game Object and offers + * proxy methods to the features available from a Dynamic Texture. * - * The Bitmap Mask will not render its Game Object by itself. If the Game Object is not in a - * Scene's display list, it will only be used for the mask and its full texture will not be directly - * visible. Adding the underlying Game Object to a Scene will not cause any problems - it will - * render as a normal Game Object and will also serve as a mask. + * **When should you use a Render Texture vs. a Dynamic Texture?** * - * @class BitmapMask - * @memberof Phaser.Display.Masks + * You should use a Dynamic Texture if the texture is going to be used by multiple Game Objects, + * or you want to use it across multiple Scenes, because textures are globally stored. + * + * You should use a Dynamic Texture if the texture isn't going to be displayed in-game, but is + * instead going to be used for something like a mask or shader. + * + * You should use a Render Texture if you need to display the texture in-game on a single Game Object, + * as it provides the convenience of wrapping an Image and Dynamic Texture together for you. + * + * Under WebGL1, a FrameBuffer, which is what this Dynamic Texture uses internally, cannot be anti-aliased. + * This means that when drawing objects such as Shapes or Graphics instances to this texture, they may appear + * to be drawn with no aliasing around the edges. This is a technical limitation of WebGL1. To get around it, + * create your shape as a texture in an art package, then draw that to this texture. + * + * @class RenderTexture + * @extends Phaser.GameObjects.Image + * @memberof Phaser.GameObjects * @constructor - * @since 3.0.0 + * @since 3.2.0 * - * @param {Phaser.Scene} scene - The Scene which this Bitmap Mask will be used in. - * @param {Phaser.GameObjects.GameObject} renderable - A renderable Game Object that uses a texture, such as a Sprite. + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [width=32] - The width of the Render Texture. + * @param {number} [height=32] - The height of the Render Texture. */ -var BitmapMask = new Class({ +var RenderTexture = new Class({ + + Extends: Image, initialize: - function BitmapMask (scene, renderable) + function RenderTexture (scene, x, y, width, height) { - var renderer = scene.sys.renderer; + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 32; } + if (height === undefined) { height = 32; } - /** - * A reference to either the Canvas or WebGL Renderer that this Mask is using. - * - * @name Phaser.Display.Masks.BitmapMask#renderer - * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} - * @since 3.11.0 - */ - this.renderer = renderer; + var dynamicTexture = new DynamicTexture(scene.sys.textures, '', width, height); - /** - * A renderable Game Object that uses a texture, such as a Sprite. - * - * @name Phaser.Display.Masks.BitmapMask#bitmapMask - * @type {Phaser.GameObjects.GameObject} - * @since 3.0.0 - */ - this.bitmapMask = renderable; + Image.call(this, scene, x, y, dynamicTexture); - /** - * The texture used for the masks framebuffer. - * - * @name Phaser.Display.Masks.BitmapMask#maskTexture - * @type {WebGLTexture} - * @default null - * @since 3.0.0 - */ - this.maskTexture = null; + this.type = 'RenderTexture'; /** - * The texture used for the main framebuffer. + * An internal Camera that can be used to move around this Render Texture. * - * @name Phaser.Display.Masks.BitmapMask#mainTexture - * @type {WebGLTexture} - * @default null - * @since 3.0.0 - */ - this.mainTexture = null; - - /** - * Whether the Bitmap Mask is dirty and needs to be updated. + * Control it just like you would any Scene Camera. The difference is that it only impacts + * the placement of Game Objects that you then draw to this texture. * - * @name Phaser.Display.Masks.BitmapMask#dirty - * @type {boolean} - * @default true - * @since 3.0.0 + * You can scroll, zoom and rotate this Camera. + * + * This property is a reference to `RenderTexture.texture.camera`. + * + * @name Phaser.GameObjects.RenderTexture#camera + * @type {Phaser.Cameras.Scene2D.BaseCamera} + * @since 3.12.0 */ - this.dirty = true; + this.camera = this.texture.camera; /** - * The framebuffer to which a masked Game Object is rendered. + * Internal saved texture flag. * - * @name Phaser.Display.Masks.BitmapMask#mainFramebuffer - * @type {WebGLFramebuffer} - * @since 3.0.0 + * @name Phaser.GameObjects.RenderTexture#_saved + * @type {boolean} + * @private + * @since 3.12.0 */ - this.mainFramebuffer = null; + this._saved = false; + }, - /** - * The framebuffer to which the Bitmap Mask's masking Game Object is rendered. - * - * @name Phaser.Display.Masks.BitmapMask#maskFramebuffer - * @type {WebGLFramebuffer} - * @since 3.0.0 - */ - this.maskFramebuffer = null; - - /** - * Whether to invert the masks alpha. - * - * If `true`, the alpha of the masking pixel will be inverted before it's multiplied with the masked pixel. - * Essentially, this means that a masked area will be visible only if the corresponding area in the mask is invisible. - * - * @name Phaser.Display.Masks.BitmapMask#invertAlpha - * @type {boolean} - * @since 3.1.2 - */ - this.invertAlpha = false; + /** + * Sets the internal size of this Render Texture, as used for frame or physics body creation. + * + * This will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or call the + * `setDisplaySize` method, which is the same thing as changing the scale but allows you + * to do so by giving pixel values. + * + * If you have enabled this Game Object for input, changing the size will _not_ change the + * size of the hit area. To do this you should adjust the `input.hitArea` object directly. + * + * @method Phaser.GameObjects.RenderTexture#setSize + * @since 3.0.0 + * + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {this} This Game Object instance. + */ + setSize: function (width, height) + { + this.width = width; + this.height = height; - /** - * Is this mask a stencil mask? - * - * @name Phaser.Display.Masks.BitmapMask#isStencil - * @type {boolean} - * @readonly - * @since 3.17.0 - */ - this.isStencil = false; + this.texture.setSize(width, height); - this.createMask(); + this.updateDisplayOrigin(); - scene.sys.game.events.on(GameEvents.CONTEXT_RESTORED, this.createMask, this); + var input = this.input; - if (renderer) + if (input && !input.customHitArea) { - renderer.on(RenderEvents.RESIZE, this.createMask, this); + input.hitArea.width = width; + input.hitArea.height = height; } + + return this; }, /** - * Creates the WebGL Texture2D objects and Framebuffers required for this - * mask. If this mask has already been created, then `clearMask` is called first. + * Resizes the Render Texture to the new dimensions given. * - * @method Phaser.Display.Masks.BitmapMask#createMask - * @since 3.50.0 + * In WebGL it will destroy and then re-create the frame buffer being used by the Render Texture. + * In Canvas it will resize the underlying canvas element. + * + * Both approaches will erase everything currently drawn to the Render Texture. + * + * If the dimensions given are the same as those already being used, calling this method will do nothing. + * + * @method Phaser.GameObjects.RenderTexture#resize + * @since 3.10.0 + * + * @param {number} width - The new width of the Render Texture. + * @param {number} [height=width] - The new height of the Render Texture. If not specified, will be set the same as the `width`. + * + * @return {this} This Render Texture. */ - createMask: function () + resize: function (width, height) { - var renderer = this.renderer; - - if (!renderer || !renderer.gl) - { - return; - } - - if (this.mainTexture) - { - this.clearMask(); - } - - var width = renderer.width; - var height = renderer.height; - var pot = ((width & (width - 1)) === 0 && (height & (height - 1)) === 0); - var gl = renderer.gl; - var wrap = pot ? gl.REPEAT : gl.CLAMP_TO_EDGE; - var filter = gl.LINEAR; + this.setSize(width, height); - this.mainTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height); - this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, true); - this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, true); + return this; }, /** - * Deletes the `mainTexture` and `maskTexture` WebGL Textures and deletes - * the `mainFramebuffer` and `maskFramebuffer` too, nulling all references. + * Stores a copy of this Render Texture in the Texture Manager using the given key. * - * This is called when this mask is destroyed, or if you try to creat a new - * mask from this object when one is already set. + * After doing this, any texture based Game Object, such as a Sprite, can use the contents of this + * Render Texture by using the texture key: * - * @method Phaser.Display.Masks.BitmapMask#clearMask - * @since 3.50.0 + * ```javascript + * var rt = this.add.renderTexture(0, 0, 128, 128); + * + * // Draw something to the Render Texture + * + * rt.saveTexture('doodle'); + * + * this.add.image(400, 300, 'doodle'); + * ``` + * + * Updating the contents of this Render Texture will automatically update _any_ Game Object + * that is using it as a texture. Calling `saveTexture` again will not save another copy + * of the same texture, it will just rename the key of the existing copy. + * + * By default it will create a single base texture. You can add frames to the texture + * by using the `Texture.add` method. After doing this, you can then allow Game Objects + * to use a specific frame from a Render Texture. + * + * If you destroy this Render Texture, any Game Object using it via the Texture Manager will + * stop rendering. Ensure you remove the texture from the Texture Manager and any Game Objects + * using it first, before destroying this Render Texture. + * + * @method Phaser.GameObjects.RenderTexture#saveTexture + * @since 3.12.0 + * + * @param {string} key - The unique key to store the texture as within the global Texture Manager. + * + * @return {Phaser.Textures.DynamicTexture} The Texture that was saved. */ - clearMask: function () + saveTexture: function (key) { - var renderer = this.renderer; + var texture = this.texture; - if (!renderer || !renderer.gl || !this.mainTexture) + texture.key = key; + + if (texture.manager.addDynamicTexture(texture)) { - return; + this._saved = true; } - renderer.deleteTexture(this.mainTexture); - renderer.deleteTexture(this.maskTexture); - renderer.deleteFramebuffer(this.mainFramebuffer); - renderer.deleteFramebuffer(this.maskFramebuffer); - - this.mainTexture = null; - this.maskTexture = null; - this.mainFramebuffer = null; - this.maskFramebuffer = null; + return texture; }, /** - * Sets a new masking Game Object for the Bitmap Mask. + * Fills this Render Texture with the given color. * - * @method Phaser.Display.Masks.BitmapMask#setBitmap - * @since 3.0.0 + * By default it will fill the entire texture, however you can set it to fill a specific + * rectangular area by using the x, y, width and height arguments. + * + * The color should be given in hex format, i.e. 0xff0000 for red, 0x00ff00 for green, etc. * - * @param {Phaser.GameObjects.GameObject} renderable - A renderable Game Object that uses a texture, such as a Sprite. + * @method Phaser.GameObjects.RenderTexture#fill + * @since 3.2.0 + * + * @param {number} rgb - The color to fill this Render Texture with, such as 0xff0000 for red. + * @param {number} [alpha=1] - The alpha value used by the fill. + * @param {number} [x=0] - The left coordinate of the fill rectangle. + * @param {number} [y=0] - The top coordinate of the fill rectangle. + * @param {number} [width=this.width] - The width of the fill rectangle. + * @param {number} [height=this.height] - The height of the fill rectangle. + * + * @return {this} This Render Texture instance. */ - setBitmap: function (renderable) + fill: function (rgb, alpha, x, y, width, height) { - this.bitmapMask = renderable; + this.texture.fill(rgb, alpha, x, y, width, height); + + return this; }, /** - * Prepares the WebGL Renderer to render a Game Object with this mask applied. + * Fully clears this Render Texture, erasing everything from it and resetting it back to + * a blank, transparent, texture. * - * This renders the masking Game Object to the mask framebuffer and switches to the main framebuffer so that the masked Game Object will be rendered to it instead of being rendered directly to the frame. - * - * @method Phaser.Display.Masks.BitmapMask#preRenderWebGL - * @since 3.0.0 + * @method Phaser.GameObjects.RenderTexture#clear + * @since 3.2.0 * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The WebGL Renderer to prepare. - * @param {Phaser.GameObjects.GameObject} maskedObject - The masked Game Object which will be drawn. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. + * @return {this} This Render Texture instance. */ - preRenderWebGL: function (renderer, maskedObject, camera) + clear: function () { - renderer.pipelines.BITMAPMASK_PIPELINE.beginMask(this, maskedObject, camera); + this.texture.clear(); + + return this; }, /** - * Finalizes rendering of a masked Game Object. + * Takes the given texture key and frame and then stamps it at the given + * x and y coordinates. You can use the optional 'config' argument to provide + * lots more options about how the stamp is applied, including the alpha, + * tint, angle, scale and origin. * - * This resets the previously bound framebuffer and switches the WebGL Renderer to the Bitmap Mask Pipeline, which uses a special fragment shader to apply the masking effect. + * By default, the frame will stamp on the x/y coordinates based on its center. * - * @method Phaser.Display.Masks.BitmapMask#postRenderWebGL - * @since 3.0.0 + * If you wish to stamp from the top-left, set the config `originX` and + * `originY` properties both to zero. * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The WebGL Renderer to clean up. + * @method Phaser.GameObjects.RenderTexture#stamp + * @since 3.60.0 + * + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. Set to `null` to skip this argument if not required. + * @param {number} [x=0] - The x position to draw the frame at. + * @param {number} [y=0] - The y position to draw the frame at. + * @param {Phaser.Types.Textures.StampConfig} [config] - The stamp configuration object, allowing you to set the alpha, tint, angle, scale and origin of the stamp. + * + * @return {this} This Render Texture instance. */ - postRenderWebGL: function (renderer, camera) + stamp: function (key, frame, x, y, config) { - renderer.pipelines.BITMAPMASK_PIPELINE.endMask(this, camera); + this.texture.stamp(key, frame, x, y, config); + + return this; }, /** - * This is a NOOP method. Bitmap Masks are not supported by the Canvas Renderer. + * Draws the given object, or an array of objects, to this Render Texture using a blend mode of ERASE. + * This has the effect of erasing any filled pixels present in the objects from this texture. * - * @method Phaser.Display.Masks.BitmapMask#preRenderCanvas - * @since 3.0.0 + * It can accept any of the following: * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Canvas Renderer which would be rendered to. - * @param {Phaser.GameObjects.GameObject} mask - The masked Game Object which would be rendered. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. + * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite. + * * Tilemap Layers. + * * A Group. The contents of which will be iterated and drawn in turn. + * * A Container. The contents of which will be iterated fully, and drawn in turn. + * * A Scene Display List. Pass in `Scene.children` to draw the whole list. + * * Another Dynamic Texture, or a Render Texture. + * * A Texture Frame instance. + * * A string. This is used to look-up the texture from the Texture Manager. + * + * Note: You cannot erase a Render Texture from itself. + * + * If passing in a Group or Container it will only draw children that return `true` + * when their `willRender()` method is called. I.e. a Container with 10 children, + * 5 of which have `visible=false` will only draw the 5 visible ones. + * + * If passing in an array of Game Objects it will draw them all, regardless if + * they pass a `willRender` check or not. + * + * You can pass in a string in which case it will look for a texture in the Texture + * Manager matching that string, and draw the base frame. + * + * You can pass in the `x` and `y` coordinates to draw the objects at. The use of + * the coordinates differ based on what objects are being drawn. If the object is + * a Group, Container or Display List, the coordinates are _added_ to the positions + * of the children. For all other types of object, the coordinates are exact. + * + * Calling this method causes the WebGL batch to flush, so it can write the texture + * data to the framebuffer being used internally. The batch is flushed at the end, + * after the entries have been iterated. So if you've a bunch of objects to draw, + * try and pass them in an array in one single call, rather than making lots of + * separate calls. + * + * @method Phaser.GameObjects.RenderTexture#erase + * @since 3.16.0 + * + * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, Render Texture, Texture Frame, or an array of any of these. + * @param {number} [x=0] - The x position to draw the Frame at, or the offset applied to the object. + * @param {number} [y=0] - The y position to draw the Frame at, or the offset applied to the object. + * + * @return {this} This Render Texture instance. */ - preRenderCanvas: function () + erase: function (entries, x, y) { - // NOOP + this.texture.erase(entries, x, y); + + return this; }, /** - * This is a NOOP method. Bitmap Masks are not supported by the Canvas Renderer. + * Draws the given object, or an array of objects, to this Render Texture. * - * @method Phaser.Display.Masks.BitmapMask#postRenderCanvas - * @since 3.0.0 + * It can accept any of the following: * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Canvas Renderer which would be rendered to. + * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite. + * * Tilemap Layers. + * * A Group. The contents of which will be iterated and drawn in turn. + * * A Container. The contents of which will be iterated fully, and drawn in turn. + * * A Scene Display List. Pass in `Scene.children` to draw the whole list. + * * Another Dynamic Texture, or a Render Texture. + * * A Texture Frame instance. + * * A string. This is used to look-up the texture from the Texture Manager. + * + * Note 1: You cannot draw a Render Texture to itself. + * + * Note 2: For Game Objects that have Post FX Pipelines, the pipeline _cannot_ be + * used when drawn to this texture. + * + * If passing in a Group or Container it will only draw children that return `true` + * when their `willRender()` method is called. I.e. a Container with 10 children, + * 5 of which have `visible=false` will only draw the 5 visible ones. + * + * If passing in an array of Game Objects it will draw them all, regardless if + * they pass a `willRender` check or not. + * + * You can pass in a string in which case it will look for a texture in the Texture + * Manager matching that string, and draw the base frame. If you need to specify + * exactly which frame to draw then use the method `drawFrame` instead. + * + * You can pass in the `x` and `y` coordinates to draw the objects at. The use of + * the coordinates differ based on what objects are being drawn. If the object is + * a Group, Container or Display List, the coordinates are _added_ to the positions + * of the children. For all other types of object, the coordinates are exact. + * + * The `alpha` and `tint` values are only used by Texture Frames. + * Game Objects use their own alpha and tint values when being drawn. + * + * Calling this method causes the WebGL batch to flush, so it can write the texture + * data to the framebuffer being used internally. The batch is flushed at the end, + * after the entries have been iterated. So if you've a bunch of objects to draw, + * try and pass them in an array in one single call, rather than making lots of + * separate calls. + * + * @method Phaser.GameObjects.RenderTexture#draw + * @since 3.2.0 + * + * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, other Render Texture, Texture Frame or an array of any of these. + * @param {number} [x=0] - The x position to draw the Frame at, or the offset applied to the object. + * @param {number} [y=0] - The y position to draw the Frame at, or the offset applied to the object. + * @param {number} [alpha=1] - The alpha value. Only used when drawing Texture Frames to this texture. Game Objects use their own alpha. + * @param {number} [tint=0xffffff] - The tint color value. Only used when drawing Texture Frames to this texture. Game Objects use their own tint. WebGL only. + * + * @return {this} This Render Texture instance. */ - postRenderCanvas: function () + draw: function (entries, x, y, alpha, tint) { - // NOOP + this.texture.draw(entries, x, y, alpha, tint); + + return this; }, /** - * Destroys this BitmapMask and nulls any references it holds. + * Draws the Texture Frame to the Render Texture at the given position. * - * Note that if a Game Object is currently using this mask it will _not_ automatically detect you have destroyed it, - * so be sure to call `clearMask` on any Game Object using it, before destroying it. + * Textures are referenced by their string-based keys, as stored in the Texture Manager. * - * @method Phaser.Display.Masks.BitmapMask#destroy - * @since 3.7.0 + * ```javascript + * var rt = this.add.renderTexture(0, 0, 800, 600); + * rt.drawFrame(key, frame); + * ``` + * + * You can optionally provide a position, alpha and tint value to apply to the frame + * before it is drawn. + * + * Calling this method will cause a batch flush, so if you've got a stack of things to draw + * in a tight loop, try using the `draw` method instead. + * + * If you need to draw a Sprite to this Render Texture, use the `draw` method instead. + * + * @method Phaser.GameObjects.RenderTexture#drawFrame + * @since 3.12.0 + * + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. Set to `null` to skip this argument if not required. + * @param {number} [x=0] - The x position to draw the frame at. + * @param {number} [y=0] - The y position to draw the frame at. + * @param {number} [alpha=1] - The alpha value. Only used when drawing Texture Frames to this texture. + * @param {number} [tint=0xffffff] - The tint color value. Only used when drawing Texture Frames to this texture. WebGL only. + * + * @return {this} This Render Texture instance. */ - destroy: function () + drawFrame: function (key, frame, x, y, alpha, tint) { - this.clearMask(); - - if (this.renderer) - { - this.renderer.off(RenderEvents.RESIZE, this.createMask, this); - } - - this.bitmapMask = null; - this.prevFramebuffer = null; - this.renderer = null; - } - -}); - -module.exports = BitmapMask; - - -/***/ }), -/* 311 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); - -/** - * @classdesc - * A Geometry Mask can be applied to a Game Object to hide any pixels of it which don't intersect - * a visible pixel from the geometry mask. The mask is essentially a clipping path which can only - * make a masked pixel fully visible or fully invisible without changing its alpha (opacity). - * - * A Geometry Mask uses a Graphics Game Object to determine which pixels of the masked Game Object(s) - * should be clipped. For any given point of a masked Game Object's texture, the pixel will only be displayed - * if the Graphics Game Object of the Geometry Mask has a visible pixel at the same position. The color and - * alpha of the pixel from the Geometry Mask do not matter. - * - * The Geometry Mask's location matches the location of its Graphics object, not the location of the masked objects. - * Moving or transforming the underlying Graphics object will change the mask (and affect the visibility - * of any masked objects), whereas moving or transforming a masked object will not affect the mask. - * You can think of the Geometry Mask (or rather, of its Graphics object) as an invisible curtain placed - * in front of all masked objects which has its own visual properties and, naturally, respects the camera's - * visual properties, but isn't affected by and doesn't follow the masked objects by itself. - * - * @class GeometryMask - * @memberof Phaser.Display.Masks - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - This parameter is not used. - * @param {Phaser.GameObjects.Graphics} graphicsGeometry - The Graphics Game Object to use for the Geometry Mask. Doesn't have to be in the Display List. - */ -var GeometryMask = new Class({ + this.texture.drawFrame(key, frame, x, y, alpha, tint); - initialize: + return this; + }, - function GeometryMask (scene, graphicsGeometry) + /** + * Takes the given Texture Frame and draws it to this Render Texture as a fill pattern, + * i.e. in a grid-layout based on the frame dimensions. + * + * Textures are referenced by their string-based keys, as stored in the Texture Manager. + * + * You can optionally provide a position, width, height, alpha and tint value to apply to + * the frames before they are drawn. The position controls the top-left where the repeating + * fill will start from. The width and height control the size of the filled area. + * + * The position can be negative if required, but the dimensions cannot. + * + * Calling this method will cause a batch flush by default. Use the `skipBatch` argument + * to disable this if this call is part of a larger batch draw. + * + * @method Phaser.GameObjects.RenderTexture#repeat + * @since 3.60.0 + * + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. Set to `null` to skip this argument if not required. + * @param {number} [x=0] - The x position to start drawing the frames from (can be negative to offset). + * @param {number} [y=0] - The y position to start drawing the frames from (can be negative to offset). + * @param {number} [width=this.width] - The width of the area to repeat the frame within. Defaults to the width of this Dynamic Texture. + * @param {number} [height=this.height] - The height of the area to repeat the frame within. Defaults to the height of this Dynamic Texture. + * @param {number} [alpha=1] - The alpha to use. Defaults to 1, no alpha. + * @param {number} [tint=0xffffff] - WebGL only. The tint color to use. Leave as undefined, or 0xffffff to have no tint. + * @param {boolean} [skipBatch=false] - Skip beginning and ending a batch with this call. Use if this is part of a bigger batched draw. + * + * @return {this} This Render Texture instance. + */ + repeat: function (key, frame, x, y, width, height, alpha, tint, skipBatch) { - /** - * The Graphics object which describes the Geometry Mask. - * - * @name Phaser.Display.Masks.GeometryMask#geometryMask - * @type {Phaser.GameObjects.Graphics} - * @since 3.0.0 - */ - this.geometryMask = graphicsGeometry; - - /** - * Similar to the BitmapMasks invertAlpha setting this to true will then hide all pixels - * drawn to the Geometry Mask. - * - * This is a WebGL only feature. - * - * @name Phaser.Display.Masks.GeometryMask#invertAlpha - * @type {boolean} - * @since 3.16.0 - */ - this.invertAlpha = false; - - /** - * Is this mask a stencil mask? - * - * @name Phaser.Display.Masks.GeometryMask#isStencil - * @type {boolean} - * @readonly - * @since 3.17.0 - */ - this.isStencil = true; + this.texture.repeat(key, frame, x, y, width, height, alpha, tint, skipBatch); - /** - * The current stencil level. - * - * @name Phaser.Display.Masks.GeometryMask#level - * @type {boolean} - * @private - * @since 3.17.0 - */ - this.level = 0; + return this; }, /** - * Sets a new Graphics object for the Geometry Mask. + * Use this method if you need to batch draw a large number of Game Objects to + * this Render Texture in a single pass, or on a frequent basis. This is especially + * useful under WebGL, however, if your game is using Canvas only, it will not make + * any speed difference in that situation. * - * @method Phaser.Display.Masks.GeometryMask#setShape - * @since 3.0.0 + * This method starts the beginning of a batched draw, unless one is already open. * - * @param {Phaser.GameObjects.Graphics} graphicsGeometry - The Graphics object which will be used for the Geometry Mask. + * Batched drawing is faster than calling `draw` in loop, but you must be careful + * to manage the flow of code and remember to call `endDraw()` when you're finished. * - * @return {this} This Geometry Mask + * If you don't need to draw large numbers of objects it's much safer and easier + * to use the `draw` method instead. + * + * The flow should be: + * + * ```javascript + * // Call once: + * RenderTexture.beginDraw(); + * + * // repeat n times: + * RenderTexture.batchDraw(); + * // or + * RenderTexture.batchDrawFrame(); + * + * // Call once: + * RenderTexture.endDraw(); + * ``` + * + * Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you + * have started a batch. Also, be very careful not to destroy this Render Texture while the + * batch is still open. Doing so will cause a run-time error in the WebGL Renderer. + * + * You can use the `RenderTexture.texture.isDrawing` boolean property to tell if a batch is + * currently open, or not. + * + * @method Phaser.GameObjects.RenderTexture#beginDraw + * @since 3.50.0 + * + * @return {this} This Render Texture instance. */ - setShape: function (graphicsGeometry) + beginDraw: function () { - this.geometryMask = graphicsGeometry; + this.texture.beginDraw(); return this; }, /** - * Sets the `invertAlpha` property of this Geometry Mask. + * Use this method if you have already called `beginDraw` and need to batch + * draw a large number of objects to this Render Texture. * - * Inverting the alpha essentially flips the way the mask works. + * This method batches the drawing of the given objects to this texture, + * without causing a WebGL bind or batch flush for each one. * - * This is a WebGL only feature. + * It is faster than calling `draw`, but you must be careful to manage the + * flow of code and remember to call `endDraw()`. If you don't need to draw large + * numbers of objects it's much safer and easier to use the `draw` method instead. * - * @method Phaser.Display.Masks.GeometryMask#setInvertAlpha - * @since 3.17.0 + * The flow should be: * - * @param {boolean} [value=true] - Invert the alpha of this mask? + * ```javascript + * // Call once: + * RenderTexture.beginDraw(); * - * @return {this} This Geometry Mask + * // repeat n times: + * RenderTexture.batchDraw(); + * // or + * RenderTexture.batchDrawFrame(); + * + * // Call once: + * RenderTexture.endDraw(); + * ``` + * + * Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you + * have started a batch. Also, be very careful not to destroy this Render Texture while the + * batch is still open. Doing so will cause a run-time error in the WebGL Renderer. + * + * You can use the `RenderTexture.texture.isDrawing` boolean property to tell if a batch is + * currently open, or not. + * + * This method can accept any of the following: + * + * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite. + * * Tilemap Layers. + * * A Group. The contents of which will be iterated and drawn in turn. + * * A Container. The contents of which will be iterated fully, and drawn in turn. + * * A Scene's Display List. Pass in `Scene.children` to draw the whole list. + * * Another Dynamic Texture or Render Texture. + * * A Texture Frame instance. + * * A string. This is used to look-up a texture from the Texture Manager. + * + * Note: You cannot draw a Render Texture to itself. + * + * If passing in a Group or Container it will only draw children that return `true` + * when their `willRender()` method is called. I.e. a Container with 10 children, + * 5 of which have `visible=false` will only draw the 5 visible ones. + * + * If passing in an array of Game Objects it will draw them all, regardless if + * they pass a `willRender` check or not. + * + * You can pass in a string in which case it will look for a texture in the Texture + * Manager matching that string, and draw the base frame. If you need to specify + * exactly which frame to draw then use the method `drawFrame` instead. + * + * You can pass in the `x` and `y` coordinates to draw the objects at. The use of + * the coordinates differ based on what objects are being drawn. If the object is + * a Group, Container or Display List, the coordinates are _added_ to the positions + * of the children. For all other types of object, the coordinates are exact. + * + * The `alpha` and `tint` values are only used by Texture Frames. + * Game Objects use their own alpha and tint values when being drawn. + * + * @method Phaser.GameObjects.RenderTexture#batchDraw + * @since 3.50.0 + * + * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, other Dynamic or Texture, Texture Frame or an array of any of these. + * @param {number} [x=0] - The x position to draw the Frame at, or the offset applied to the object. + * @param {number} [y=0] - The y position to draw the Frame at, or the offset applied to the object. + * @param {number} [alpha=1] - The alpha value. Only used when drawing Texture Frames to this texture. Game Objects use their own alpha. + * @param {number} [tint=0xffffff] - The tint color value. Only used when drawing Texture Frames to this texture. Game Objects use their own tint. WebGL only. + * + * @return {this} This Render Texture instance. */ - setInvertAlpha: function (value) + batchDraw: function (entries, x, y, alpha, tint) { - if (value === undefined) { value = true; } - - this.invertAlpha = value; + this.texture.batchDraw(entries, x, y, alpha, tint); return this; }, /** - * Renders the Geometry Mask's underlying Graphics object to the OpenGL stencil buffer and enables the stencil test, which clips rendered pixels according to the mask. + * Use this method if you have already called `beginDraw` and need to batch + * draw a large number of texture frames to this Render Texture. * - * @method Phaser.Display.Masks.GeometryMask#preRenderWebGL - * @since 3.0.0 + * This method batches the drawing of the given frames to this Render Texture, + * without causing a WebGL bind or batch flush for each one. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer instance to draw to. - * @param {Phaser.GameObjects.GameObject} child - The Game Object being rendered. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera the Game Object is being rendered through. + * It is faster than calling `drawFrame`, but you must be careful to manage the + * flow of code and remember to call `endDraw()`. If you don't need to draw large + * numbers of frames it's much safer and easier to use the `drawFrame` method instead. + * + * The flow should be: + * + * ```javascript + * // Call once: + * RenderTexture.beginDraw(); + * + * // repeat n times: + * RenderTexture.batchDraw(); + * // or + * RenderTexture.batchDrawFrame(); + * + * // Call once: + * RenderTexture.endDraw(); + * ``` + * + * Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you + * have started a batch. Also, be very careful not to destroy this Render Texture while the + * batch is still open. Doing so will cause a run-time error in the WebGL Renderer. + * + * You can use the `RenderTexture.texture.isDrawing` boolean property to tell if a batch is + * currently open, or not. + * + * Textures are referenced by their string-based keys, as stored in the Texture Manager. + * + * You can optionally provide a position, alpha and tint value to apply to the frame + * before it is drawn. + * + * @method Phaser.GameObjects.RenderTexture#batchDrawFrame + * @since 3.50.0 + * + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. + * @param {number} [x=0] - The x position to draw the frame at. + * @param {number} [y=0] - The y position to draw the frame at. + * @param {number} [alpha=1] - The alpha value. Only used when drawing Texture Frames to this texture. Game Objects use their own alpha. + * @param {number} [tint=0xffffff] - The tint color value. Only used when drawing Texture Frames to this texture. Game Objects use their own tint. WebGL only. + * + * @return {this} This Render Texture instance. */ - preRenderWebGL: function (renderer, child, camera) + batchDrawFrame: function (key, frame, x, y, alpha, tint) { - var gl = renderer.gl; - - // Force flushing before drawing to stencil buffer - renderer.flush(); - - if (renderer.maskStack.length === 0) - { - gl.enable(gl.STENCIL_TEST); - gl.clear(gl.STENCIL_BUFFER_BIT); - - renderer.maskCount = 0; - } - - if (renderer.currentCameraMask.mask !== this) - { - renderer.currentMask.mask = this; - } - - renderer.maskStack.push({ mask: this, camera: camera }); - - this.applyStencil(renderer, camera, true); + this.texture.batchDrawFrame(key, frame, x, y, alpha, tint); - renderer.maskCount++; + return this; }, /** - * Applies the current stencil mask to the renderer. + * Use this method to finish batch drawing to this Render Texture. * - * @method Phaser.Display.Masks.GeometryMask#applyStencil - * @since 3.17.0 + * Doing so will stop the WebGL Renderer from capturing draws and then blit the + * framebuffer to the Render Target owned by this texture. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer instance to draw to. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera the Game Object is being rendered through. - * @param {boolean} inc - Is this an INCR stencil or a DECR stencil? + * Calling this method without first calling `beginDraw` will have no effect. + * + * Batch drawing is faster than calling `draw`, but you must be careful to manage the + * flow of code and remember to call `endDraw()` when you're finished. + * + * If you don't need to draw large numbers of objects it's much safer and easier + * to use the `draw` method instead. + * + * The flow should be: + * + * ```javascript + * // Call once: + * RenderTexture.beginDraw(); + * + * // repeat n times: + * RenderTexture.batchDraw(); + * // or + * RenderTexture.batchDrawFrame(); + * + * // Call once: + * RenderTexture.endDraw(); + * ``` + * + * Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you + * have started a batch. Also, be very careful not to destroy this Render Texture while the + * batch is still open. Doing so will cause a run-time error in the WebGL Renderer. + * + * You can use the `RenderTexture.texture.isDrawing` boolean property to tell if a batch is + * currently open, or not. + * + * @method Phaser.GameObjects.RenderTexture#endDraw + * @since 3.50.0 + * + * @param {boolean} [erase=false] - Draws all objects in this batch using a blend mode of ERASE. This has the effect of erasing any filled pixels in the objects being drawn. + * + * @return {this} This Render Texture instance. */ - applyStencil: function (renderer, camera, inc) + endDraw: function (erase) { - var gl = renderer.gl; - var geometryMask = this.geometryMask; - var level = renderer.maskCount; - - gl.colorMask(false, false, false, false); - - if (inc) - { - gl.stencilFunc(gl.EQUAL, level, 0xFF); - gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR); - } - else - { - gl.stencilFunc(gl.EQUAL, level + 1, 0xFF); - gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR); - } - - // Write stencil buffer - geometryMask.renderWebGL(renderer, geometryMask, camera); + this.texture.endDraw(erase); - renderer.flush(); - - gl.colorMask(true, true, true, true); - gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); - - if (inc) - { - if (this.invertAlpha) - { - gl.stencilFunc(gl.NOTEQUAL, level + 1, 0xFF); - } - else - { - gl.stencilFunc(gl.EQUAL, level + 1, 0xFF); - } - } - else if (this.invertAlpha) - { - gl.stencilFunc(gl.NOTEQUAL, level, 0xFF); - } - else - { - gl.stencilFunc(gl.EQUAL, level, 0xFF); - } + return this; }, /** - * Flushes all rendered pixels and disables the stencil test of a WebGL context, thus disabling the mask for it. + * Takes a snapshot of the given area of this Render Texture. * - * @method Phaser.Display.Masks.GeometryMask#postRenderWebGL - * @since 3.0.0 + * The snapshot is taken immediately, but the results are returned via the given callback. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer instance to draw flush. + * To capture the whole Render Texture see the `snapshot` method. + * To capture just a specific pixel, see the `snapshotPixel` method. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer + * into an ArrayBufferView. It then parses this, copying the contents to a temporary Canvas and finally + * creating an Image object from it, which is the image returned to the callback provided. + * + * All in all, this is a computationally expensive and blocking process, which gets more expensive + * the larger the resolution this Render Texture has, so please be careful how you employ this in your game. + * + * @method Phaser.GameObjects.RenderTexture#snapshotArea + * @since 3.19.0 + * + * @param {number} x - The x coordinate to grab from. + * @param {number} y - The y coordinate to grab from. + * @param {number} width - The width of the area to grab. + * @param {number} height - The height of the area to grab. + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This Render Texture instance. */ - postRenderWebGL: function (renderer) + snapshotArea: function (x, y, width, height, callback, type, encoderOptions) { - var gl = renderer.gl; - - renderer.maskStack.pop(); - - renderer.maskCount--; - - // Force flush before disabling stencil test - renderer.flush(); - - var current = renderer.currentMask; - - if (renderer.maskStack.length === 0) - { - // If this is the only mask in the stack, flush and disable - current.mask = null; - - gl.disable(gl.STENCIL_TEST); - } - else - { - var prev = renderer.maskStack[renderer.maskStack.length - 1]; - - prev.mask.applyStencil(renderer, prev.camera, false); + this.texture.snapshotArea(x, y, width, height, callback, type, encoderOptions); - if (renderer.currentCameraMask.mask !== prev.mask) - { - current.mask = prev.mask; - current.camera = prev.camera; - } - else - { - current.mask = null; - } - } + return this; }, /** - * Sets the clipping path of a 2D canvas context to the Geometry Mask's underlying Graphics object. + * Takes a snapshot of the whole of this Render Texture. * - * @method Phaser.Display.Masks.GeometryMask#preRenderCanvas - * @since 3.0.0 + * The snapshot is taken immediately, but the results are returned via the given callback. * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - The Canvas Renderer instance to set the clipping path on. - * @param {Phaser.GameObjects.GameObject} mask - The Game Object being rendered. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera the Game Object is being rendered through. + * To capture a portion of this Render Texture see the `snapshotArea` method. + * To capture just a specific pixel, see the `snapshotPixel` method. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer + * into an ArrayBufferView. It then parses this, copying the contents to a temporary Canvas and finally + * creating an Image object from it, which is the image returned to the callback provided. + * + * All in all, this is a computationally expensive and blocking process, which gets more expensive + * the larger the resolution this Render Texture has, so please be careful how you employ this in your game. + * + * @method Phaser.GameObjects.RenderTexture#snapshot + * @since 3.19.0 + * + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This Render Texture instance. */ - preRenderCanvas: function (renderer, mask, camera) + snapshot: function (callback, type, encoderOptions) { - var geometryMask = this.geometryMask; - - renderer.currentContext.save(); - - geometryMask.renderCanvas(renderer, geometryMask, camera, null, null, true); - - renderer.currentContext.clip(); + return this.snapshotArea(0, 0, this.width, this.height, callback, type, encoderOptions); }, /** - * Restore the canvas context's previous clipping path, thus turning off the mask for it. + * Takes a snapshot of the given pixel from this Render Texture. * - * @method Phaser.Display.Masks.GeometryMask#postRenderCanvas - * @since 3.0.0 + * The snapshot is taken immediately, but the results are returned via the given callback. * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - The Canvas Renderer instance being restored. + * To capture the whole Render Texture see the `snapshot` method. + * To capture a portion of this Render Texture see the `snapshotArea` method. + * + * Unlike the two other snapshot methods, this one will send your callback a `Color` object + * containing the color data for the requested pixel. It doesn't need to create an internal + * Canvas or Image object, so is a lot faster to execute, using less memory than the other snapshot methods. + * + * @method Phaser.GameObjects.RenderTexture#snapshotPixel + * @since 3.19.0 + * + * @param {number} x - The x coordinate of the pixel to get. + * @param {number} y - The y coordinate of the pixel to get. + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * + * @return {this} This Render Texture instance. */ - postRenderCanvas: function (renderer) + snapshotPixel: function (x, y, callback) { - renderer.currentContext.restore(); + return this.snapshotArea(x, y, 1, 1, callback, 'pixel'); }, /** - * Destroys this GeometryMask and nulls any references it holds. - * - * Note that if a Game Object is currently using this mask it will _not_ automatically detect you have destroyed it, - * so be sure to call `clearMask` on any Game Object using it, before destroying it. + * Internal destroy handler, called as part of the destroy process. * - * @method Phaser.Display.Masks.GeometryMask#destroy - * @since 3.7.0 + * @method Phaser.GameObjects.RenderTexture#preDestroy + * @protected + * @since 3.9.0 */ - destroy: function () + preDestroy: function () { - this.geometryMask = null; + if (!this._saved) + { + this.texture.destroy(); + } } }); -module.exports = GeometryMask; +module.exports = RenderTexture; /***/ }), -/* 312 */ -/***/ (function(module, exports) { + +/***/ 85692: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var RenderTexture = __webpack_require__(15996); + /** - * Provides methods used for getting and setting the Scroll Factor of a Game Object. + * Creates a new Render Texture Game Object and returns it. * - * @namespace Phaser.GameObjects.Components.ScrollFactor - * @since 3.0.0 + * Note: This method will only be available if the Render Texture Game Object has been built into Phaser. + * + * A Render Texture is a combination of Dynamic Texture and an Image Game Object, that uses the + * Dynamic Texture to display itself with. + * + * A Dynamic Texture is a special texture that allows you to draw textures, frames and most kind of + * Game Objects directly to it. + * + * You can take many complex objects and draw them to this one texture, which can then be used as the + * base texture for other Game Objects, such as Sprites. Should you then update this texture, all + * Game Objects using it will instantly be updated as well, reflecting the changes immediately. + * + * It's a powerful way to generate dynamic textures at run-time that are WebGL friendly and don't invoke + * expensive GPU uploads on each change. + * + * @method Phaser.GameObjects.GameObjectCreator#renderTexture + * @since 3.2.0 + * + * @param {Phaser.Types.GameObjects.RenderTexture.RenderTextureConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.RenderTexture} The Game Object that was created. */ +GameObjectCreator.register('renderTexture', function (config, addToScene) +{ + if (config === undefined) { config = {}; } -var ScrollFactor = { - - /** - * The horizontal scroll factor of this Game Object. - * - * The scroll factor controls the influence of the movement of a Camera upon this Game Object. - * - * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. - * It does not change the Game Objects actual position values. - * - * A value of 1 means it will move exactly in sync with a camera. - * A value of 0 means it will not move at all, even if the camera moves. - * Other values control the degree to which the camera movement is mapped to this Game Object. - * - * Please be aware that scroll factor values other than 1 are not taken in to consideration when - * calculating physics collisions. Bodies always collide based on their world position, but changing - * the scroll factor is a visual adjustment to where the textures are rendered, which can offset - * them from physics bodies if not accounted for in your code. - * - * @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorX - * @type {number} - * @default 1 - * @since 3.0.0 - */ - scrollFactorX: 1, + var x = GetAdvancedValue(config, 'x', 0); + var y = GetAdvancedValue(config, 'y', 0); + var width = GetAdvancedValue(config, 'width', 32); + var height = GetAdvancedValue(config, 'height', 32); - /** - * The vertical scroll factor of this Game Object. - * - * The scroll factor controls the influence of the movement of a Camera upon this Game Object. - * - * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. - * It does not change the Game Objects actual position values. - * - * A value of 1 means it will move exactly in sync with a camera. - * A value of 0 means it will not move at all, even if the camera moves. - * Other values control the degree to which the camera movement is mapped to this Game Object. - * - * Please be aware that scroll factor values other than 1 are not taken in to consideration when - * calculating physics collisions. Bodies always collide based on their world position, but changing - * the scroll factor is a visual adjustment to where the textures are rendered, which can offset - * them from physics bodies if not accounted for in your code. - * - * @name Phaser.GameObjects.Components.ScrollFactor#scrollFactorY - * @type {number} - * @default 1 - * @since 3.0.0 - */ - scrollFactorY: 1, + var renderTexture = new RenderTexture(this.scene, x, y, width, height); - /** - * Sets the scroll factor of this Game Object. - * - * The scroll factor controls the influence of the movement of a Camera upon this Game Object. - * - * When a camera scrolls it will change the location at which this Game Object is rendered on-screen. - * It does not change the Game Objects actual position values. - * - * A value of 1 means it will move exactly in sync with a camera. - * A value of 0 means it will not move at all, even if the camera moves. - * Other values control the degree to which the camera movement is mapped to this Game Object. - * - * Please be aware that scroll factor values other than 1 are not taken in to consideration when - * calculating physics collisions. Bodies always collide based on their world position, but changing - * the scroll factor is a visual adjustment to where the textures are rendered, which can offset - * them from physics bodies if not accounted for in your code. - * - * @method Phaser.GameObjects.Components.ScrollFactor#setScrollFactor - * @since 3.0.0 - * - * @param {number} x - The horizontal scroll factor of this Game Object. - * @param {number} [y=x] - The vertical scroll factor of this Game Object. If not set it will use the `x` value. - * - * @return {this} This Game Object instance. - */ - setScrollFactor: function (x, y) + if (addToScene !== undefined) { - if (y === undefined) { y = x; } - - this.scrollFactorX = x; - this.scrollFactorY = y; - - return this; + config.add = addToScene; } -}; + BuildGameObject(this.scene, renderTexture, config); -module.exports = ScrollFactor; + return renderTexture; +}); /***/ }), -/* 313 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 29599: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MATH_CONST = __webpack_require__(14); -var TransformMatrix = __webpack_require__(25); -var TransformXY = __webpack_require__(177); -var WrapAngle = __webpack_require__(269); -var WrapAngleDegrees = __webpack_require__(270); -var Vector2 = __webpack_require__(3); - -// global bitmask flag for GameObject.renderMask (used by Scale) -var _FLAG = 4; // 0100 +var GameObjectFactory = __webpack_require__(61286); +var RenderTexture = __webpack_require__(15996); /** - * Provides methods used for getting and setting the position, scale and rotation of a Game Object. + * Creates a new Render Texture Game Object and adds it to the Scene. * - * @namespace Phaser.GameObjects.Components.Transform - * @since 3.0.0 + * Note: This method will only be available if the Render Texture Game Object has been built into Phaser. + * + * A Render Texture is a combination of Dynamic Texture and an Image Game Object, that uses the + * Dynamic Texture to display itself with. + * + * A Dynamic Texture is a special texture that allows you to draw textures, frames and most kind of + * Game Objects directly to it. + * + * You can take many complex objects and draw them to this one texture, which can then be used as the + * base texture for other Game Objects, such as Sprites. Should you then update this texture, all + * Game Objects using it will instantly be updated as well, reflecting the changes immediately. + * + * It's a powerful way to generate dynamic textures at run-time that are WebGL friendly and don't invoke + * expensive GPU uploads on each change. + * + * @method Phaser.GameObjects.GameObjectFactory#renderTexture + * @since 3.2.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {number} [width=32] - The width of the Render Texture. + * @param {number} [height=32] - The height of the Render Texture. + * + * @return {Phaser.GameObjects.RenderTexture} The Game Object that was created. */ +GameObjectFactory.register('renderTexture', function (x, y, width, height) +{ + return this.displayList.add(new RenderTexture(this.scene, x, y, width, height)); +}); -var Transform = { - - /** - * Private internal value. Holds the horizontal scale value. - * - * @name Phaser.GameObjects.Components.Transform#_scaleX - * @type {number} - * @private - * @default 1 - * @since 3.0.0 - */ - _scaleX: 1, - /** - * Private internal value. Holds the vertical scale value. - * - * @name Phaser.GameObjects.Components.Transform#_scaleY - * @type {number} - * @private - * @default 1 - * @since 3.0.0 - */ - _scaleY: 1, +/***/ }), - /** - * Private internal value. Holds the rotation value in radians. - * - * @name Phaser.GameObjects.Components.Transform#_rotation - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - _rotation: 0, +/***/ 79968: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The x position of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - x: 0, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The y position of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - y: 0, +var AnimationState = __webpack_require__(16569); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var PIPELINE_CONST = __webpack_require__(65641); +var RopeRender = __webpack_require__(58912); +var Vector2 = __webpack_require__(93736); - /** - * The z position of this Game Object. - * - * Note: The z position does not control the rendering order of 2D Game Objects. Use - * {@link Phaser.GameObjects.Components.Depth#depth} instead. - * - * @name Phaser.GameObjects.Components.Transform#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - z: 0, +/** + * @classdesc + * A Rope Game Object. + * + * The Rope object is WebGL only and does not have a Canvas counterpart. + * + * A Rope is a special kind of Game Object that has a texture is stretched along its entire length. + * + * Unlike a Sprite, it isn't restricted to using just a quad and can have as many vertices as you define + * when creating it. The vertices can be arranged in a horizontal or vertical strip and have their own + * color and alpha values as well. + * + * A Ropes origin is always 0.5 x 0.5 and cannot be changed. + * + * @class Rope + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @webglOnly + * @since 3.23.0 + * + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * @extends Phaser.GameObjects.Components.ScrollFactor + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {string} [texture] - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. If not given, `__DEFAULT` is used. + * @param {(string|number|null)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {(number|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. See `setPoints` to set this post-creation. + * @param {boolean} [horizontal=true] - Should the vertices of this Rope be aligned horizontally (`true`), or vertically (`false`)? + * @param {number[]} [colors] - An optional array containing the color data for this Rope. You should provide one color value per pair of vertices. + * @param {number[]} [alphas] - An optional array containing the alpha data for this Rope. You should provide one alpha value per pair of vertices. + */ +var Rope = new Class({ - /** - * The w position of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#w - * @type {number} - * @default 0 - * @since 3.0.0 - */ - w: 0, + Extends: GameObject, - /** - * This is a special setter that allows you to set both the horizontal and vertical scale of this Game Object - * to the same value, at the same time. When reading this value the result returned is `(scaleX + scaleY) / 2`. - * - * Use of this property implies you wish the horizontal and vertical scales to be equal to each other. If this - * isn't the case, use the `scaleX` or `scaleY` properties instead. - * - * @name Phaser.GameObjects.Components.Transform#scale - * @type {number} - * @default 1 - * @since 3.18.0 - */ - scale: { - - get: function () - { - return (this._scaleX + this._scaleY) / 2; - }, + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.Flip, + Components.Mask, + Components.Pipeline, + Components.PostPipeline, + Components.Size, + Components.Texture, + Components.Transform, + Components.Visible, + Components.ScrollFactor, + RopeRender + ], - set: function (value) - { - this._scaleX = value; - this._scaleY = value; + initialize: - if (value === 0) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } - } + function Rope (scene, x, y, texture, frame, points, horizontal, colors, alphas) + { + if (texture === undefined) { texture = '__DEFAULT'; } + if (points === undefined) { points = 2; } + if (horizontal === undefined) { horizontal = true; } - }, + GameObject.call(this, scene, 'Rope'); - /** - * The horizontal scale of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#scaleX - * @type {number} - * @default 1 - * @since 3.0.0 - */ - scaleX: { + /** + * The Animation State of this Rope. + * + * @name Phaser.GameObjects.Rope#anims + * @type {Phaser.Animations.AnimationState} + * @since 3.23.0 + */ + this.anims = new AnimationState(this); - get: function () - { - return this._scaleX; - }, + /** + * An array containing the points data for this Rope. + * + * Each point should be given as a Vector2Like object (i.e. a Vector2, Geom.Point or object with public x/y properties). + * + * The point coordinates are given in local space, where 0 x 0 is the start of the Rope strip. + * + * You can modify the contents of this array directly in real-time to create interesting effects. + * If you do so, be sure to call `setDirty` _after_ modifying this array, so that the vertices data is + * updated before the next render. Alternatively, you can use the `setPoints` method instead. + * + * Should you need to change the _size_ of this array, then you should always use the `setPoints` method. + * + * @name Phaser.GameObjects.Rope#points + * @type {Phaser.Types.Math.Vector2Like[]} + * @since 3.23.0 + */ + this.points = points; - set: function (value) - { - this._scaleX = value; + /** + * An array containing the vertices data for this Rope. + * + * This data is calculated automatically in the `updateVertices` method, based on the points provided. + * + * @name Phaser.GameObjects.Rope#vertices + * @type {Float32Array} + * @since 3.23.0 + */ + this.vertices; - if (value === 0) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } - } + /** + * An array containing the uv data for this Rope. + * + * This data is calculated automatically in the `setPoints` method, based on the points provided. + * + * @name Phaser.GameObjects.Rope#uv + * @type {Float32Array} + * @since 3.23.0 + */ + this.uv; - }, + /** + * An array containing the color data for this Rope. + * + * Colors should be given as numeric RGB values, such as 0xff0000. + * You should provide _two_ color values for every point in the Rope, one for the top and one for the bottom of each quad. + * + * You can modify the contents of this array directly in real-time, however, should you need to change the _size_ + * of the array, then you should use the `setColors` method instead. + * + * @name Phaser.GameObjects.Rope#colors + * @type {Uint32Array} + * @since 3.23.0 + */ + this.colors; - /** - * The vertical scale of this Game Object. - * - * @name Phaser.GameObjects.Components.Transform#scaleY - * @type {number} - * @default 1 - * @since 3.0.0 - */ - scaleY: { + /** + * An array containing the alpha data for this Rope. + * + * Alphas should be given as float values, such as 0.5. + * You should provide _two_ alpha values for every point in the Rope, one for the top and one for the bottom of each quad. + * + * You can modify the contents of this array directly in real-time, however, should you need to change the _size_ + * of the array, then you should use the `setAlphas` method instead. + * + * @name Phaser.GameObjects.Rope#alphas + * @type {Float32Array} + * @since 3.23.0 + */ + this.alphas; - get: function () - { - return this._scaleY; - }, + /** + * The tint fill mode. + * + * `false` = An additive tint (the default), where vertices colors are blended with the texture. + * `true` = A fill tint, where the vertices colors replace the texture, but respects texture alpha. + * + * @name Phaser.GameObjects.Rope#tintFill + * @type {boolean} + * @since 3.23.0 + */ + this.tintFill = (texture === '__DEFAULT') ? true : false; - set: function (value) - { - this._scaleY = value; + /** + * If the Rope is marked as `dirty` it will automatically recalculate its vertices + * the next time it renders. You can also force this by calling `updateVertices`. + * + * @name Phaser.GameObjects.Rope#dirty + * @type {boolean} + * @since 3.23.0 + */ + this.dirty = false; - if (value === 0) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } - } + /** + * Are the Rope vertices aligned horizontally, in a strip, or vertically, in a column? + * + * This property is set during instantiation and cannot be changed directly. + * See the `setVertical` and `setHorizontal` methods. + * + * @name Phaser.GameObjects.Rope#horizontal + * @type {boolean} + * @readonly + * @since 3.23.0 + */ + this.horizontal = horizontal; - }, + /** + * The horizontally flipped state of the Game Object. + * + * A Game Object that is flipped horizontally will render inversed on the horizontal axis. + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. + * + * @name Phaser.GameObjects.Rope#_flipX + * @type {boolean} + * @default false + * @private + * @since 3.23.0 + */ + this._flipX = false; - /** - * The angle of this Game Object as expressed in degrees. - * - * Phaser uses a right-hand clockwise rotation system, where 0 is right, 90 is down, 180/-180 is left - * and -90 is up. - * - * If you prefer to work in radians, see the `rotation` property instead. - * - * @name Phaser.GameObjects.Components.Transform#angle - * @type {number} - * @default 0 - * @since 3.0.0 - */ - angle: { + /** + * The vertically flipped state of the Game Object. + * + * A Game Object that is flipped vertically will render inversed on the vertical axis (i.e. upside down) + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. + * + * @name Phaser.GameObjects.Rope#_flipY + * @type {boolean} + * @default false + * @private + * @since 3.23.0 + */ + this._flipY = false; - get: function () - { - return WrapAngleDegrees(this._rotation * MATH_CONST.RAD_TO_DEG); - }, + /** + * Internal Vector2 used for vertices updates. + * + * @name Phaser.GameObjects.Rope#_perp + * @type {Phaser.Math.Vector2} + * @private + * @since 3.23.0 + */ + this._perp = new Vector2(); - set: function (value) - { - // value is in degrees - this.rotation = WrapAngleDegrees(value) * MATH_CONST.DEG_TO_RAD; - } - }, + /** + * You can optionally choose to render the vertices of this Rope to a Graphics instance. + * + * Achieve this by setting the `debugCallback` and the `debugGraphic` properties. + * + * You can do this in a single call via the `Rope.setDebug` method, which will use the + * built-in debug function. You can also set it to your own callback. The callback + * will be invoked _once per render_ and sent the following parameters: + * + * `debugCallback(src, meshLength, verts)` + * + * `src` is the Rope instance being debugged. + * `meshLength` is the number of mesh vertices in total. + * `verts` is an array of the translated vertex coordinates. + * + * To disable rendering, set this property back to `null`. + * + * @name Phaser.GameObjects.Rope#debugCallback + * @type {function} + * @since 3.23.0 + */ + this.debugCallback = null; - /** - * The angle of this Game Object in radians. - * - * Phaser uses a right-hand clockwise rotation system, where 0 is right, PI/2 is down, +-PI is left - * and -PI/2 is up. - * - * If you prefer to work in degrees, see the `angle` property instead. - * - * @name Phaser.GameObjects.Components.Transform#rotation - * @type {number} - * @default 1 - * @since 3.0.0 - */ - rotation: { + /** + * The Graphics instance that the debug vertices will be drawn to, if `setDebug` has + * been called. + * + * @name Phaser.GameObjects.Rope#debugGraphic + * @type {Phaser.GameObjects.Graphics} + * @since 3.23.0 + */ + this.debugGraphic = null; - get: function () - { - return this._rotation; - }, + this.setTexture(texture, frame); + this.setPosition(x, y); + this.setSizeToFrame(); + this.initPipeline(PIPELINE_CONST.ROPE_PIPELINE); - set: function (value) + if (Array.isArray(points)) { - // value is in radians - this._rotation = WrapAngle(value); + this.resizeArrays(points.length); } - }, - - /** - * Sets the position of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setPosition - * @since 3.0.0 - * - * @param {number} [x=0] - The x position of this Game Object. - * @param {number} [y=x] - The y position of this Game Object. If not set it will use the `x` value. - * @param {number} [z=0] - The z position of this Game Object. - * @param {number} [w=0] - The w position of this Game Object. - * - * @return {this} This Game Object instance. - */ - setPosition: function (x, y, z, w) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = x; } - if (z === undefined) { z = 0; } - if (w === undefined) { w = 0; } - this.x = x; - this.y = y; - this.z = z; - this.w = w; + this.setPoints(points, colors, alphas); - return this; + this.updateVertices(); }, - /** - * Copies an object's coordinates to this Game Object's position. - * - * @method Phaser.GameObjects.Components.Transform#copyPosition - * @since 3.50.0 - * - * @param {(Phaser.Types.Math.Vector2Like|Phaser.Types.Math.Vector3Like|Phaser.Types.Math.Vector4Like)} source - An object with numeric 'x', 'y', 'z', or 'w' properties. Undefined values are not copied. - * - * @return {this} This Game Object instance. - */ - copyPosition: function (source) + // Overrides Game Object method + addedToScene: function () { - if (source.x !== undefined) { this.x = source.x; } - if (source.y !== undefined) { this.y = source.y; } - if (source.z !== undefined) { this.z = source.z; } - if (source.w !== undefined) { this.w = source.w; } - - return this; + this.scene.sys.updateList.add(this); }, - /** - * Sets the position of this Game Object to be a random position within the confines of - * the given area. - * - * If no area is specified a random position between 0 x 0 and the game width x height is used instead. - * - * The position does not factor in the size of this Game Object, meaning that only the origin is - * guaranteed to be within the area. - * - * @method Phaser.GameObjects.Components.Transform#setRandomPosition - * @since 3.8.0 - * - * @param {number} [x=0] - The x position of the top-left of the random area. - * @param {number} [y=0] - The y position of the top-left of the random area. - * @param {number} [width] - The width of the random area. - * @param {number} [height] - The height of the random area. - * - * @return {this} This Game Object instance. - */ - setRandomPosition: function (x, y, width, height) + // Overrides Game Object method + removedFromScene: function () { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = this.scene.sys.scale.width; } - if (height === undefined) { height = this.scene.sys.scale.height; } - - this.x = x + (Math.random() * width); - this.y = y + (Math.random() * height); - - return this; + this.scene.sys.updateList.remove(this); }, /** - * Sets the rotation of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setRotation - * @since 3.0.0 + * The Rope update loop. * - * @param {number} [radians=0] - The rotation of this Game Object, in radians. + * @method Phaser.GameObjects.Rope#preUpdate + * @protected + * @since 3.23.0 * - * @return {this} This Game Object instance. + * @param {number} time - The current timestamp. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - setRotation: function (radians) + preUpdate: function (time, delta) { - if (radians === undefined) { radians = 0; } + var prevFrame = this.anims.currentFrame; - this.rotation = radians; + this.anims.update(time, delta); - return this; + if (this.anims.currentFrame !== prevFrame) + { + this.updateUVs(); + this.updateVertices(); + } }, /** - * Sets the angle of this Game Object. + * Start playing the given animation. * - * @method Phaser.GameObjects.Components.Transform#setAngle - * @since 3.0.0 + * @method Phaser.GameObjects.Rope#play + * @since 3.23.0 * - * @param {number} [degrees=0] - The rotation of this Game Object, in degrees. + * @param {string} key - The string-based key of the animation to play. + * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. + * @param {number} [startFrame=0] - Optionally start the animation playing from this frame index. * - * @return {this} This Game Object instance. + * @return {this} This Game Object. */ - setAngle: function (degrees) + play: function (key, ignoreIfPlaying, startFrame) { - if (degrees === undefined) { degrees = 0; } - - this.angle = degrees; + this.anims.play(key, ignoreIfPlaying, startFrame); return this; }, /** - * Sets the scale of this Game Object. - * - * @method Phaser.GameObjects.Components.Transform#setScale - * @since 3.0.0 + * Flags this Rope as being dirty. A dirty rope will recalculate all of its vertices data + * the _next_ time it renders. You should set this rope as dirty if you update the points + * array directly. * - * @param {number} x - The horizontal scale of this Game Object. - * @param {number} [y=x] - The vertical scale of this Game Object. If not set it will use the `x` value. + * @method Phaser.GameObjects.Rope#setDirty + * @since 3.23.0 * * @return {this} This Game Object instance. */ - setScale: function (x, y) + setDirty: function () { - if (x === undefined) { x = 1; } - if (y === undefined) { y = x; } - - this.scaleX = x; - this.scaleY = y; + this.dirty = true; return this; }, /** - * Sets the x position of this Game Object. + * Sets the alignment of the points in this Rope to be horizontal, in a strip format. * - * @method Phaser.GameObjects.Components.Transform#setX - * @since 3.0.0 + * Calling this method will reset this Rope. The current points, vertices, colors and alpha + * values will be reset to thoes values given as parameters. * - * @param {number} [value=0] - The x position of this Game Object. + * @method Phaser.GameObjects.Rope#setHorizontal + * @since 3.23.0 + * + * @param {(number|Phaser.Types.Math.Vector2Like[])} [points] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided the current points length is used. + * @param {(number|number[])} [colors] - Either a single color value, or an array of values. + * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. * * @return {this} This Game Object instance. */ - setX: function (value) + setHorizontal: function (points, colors, alphas) { - if (value === undefined) { value = 0; } + if (points === undefined) { points = this.points.length; } - this.x = value; + if (this.horizontal) + { + return this; + } - return this; + this.horizontal = true; + + return this.setPoints(points, colors, alphas); }, /** - * Sets the y position of this Game Object. + * Sets the alignment of the points in this Rope to be vertical, in a column format. * - * @method Phaser.GameObjects.Components.Transform#setY - * @since 3.0.0 + * Calling this method will reset this Rope. The current points, vertices, colors and alpha + * values will be reset to thoes values given as parameters. * - * @param {number} [value=0] - The y position of this Game Object. + * @method Phaser.GameObjects.Rope#setVertical + * @since 3.23.0 + * + * @param {(number|Phaser.Types.Math.Vector2Like[])} [points] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided the current points length is used. + * @param {(number|number[])} [colors] - Either a single color value, or an array of values. + * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. * * @return {this} This Game Object instance. */ - setY: function (value) + setVertical: function (points, colors, alphas) { - if (value === undefined) { value = 0; } + if (points === undefined) { points = this.points.length; } - this.y = value; + if (!this.horizontal) + { + return this; + } - return this; + this.horizontal = false; + + return this.setPoints(points, colors, alphas); }, /** - * Sets the z position of this Game Object. - * - * Note: The z position does not control the rendering order of 2D Game Objects. Use - * {@link Phaser.GameObjects.Components.Depth#setDepth} instead. + * Sets the tint fill mode. * - * @method Phaser.GameObjects.Components.Transform#setZ - * @since 3.0.0 + * Mode 0 (`false`) is an additive tint, the default, which blends the vertices colors with the texture. + * This mode respects the texture alpha. * - * @param {number} [value=0] - The z position of this Game Object. + * Mode 1 (`true`) is a fill tint. Unlike an additive tint, a fill-tint literally replaces the pixel colors + * from the texture with those in the tint. You can use this for effects such as making a player flash 'white' + * if hit by something. This mode respects the texture alpha. * - * @return {this} This Game Object instance. - */ - setZ: function (value) - { - if (value === undefined) { value = 0; } - - this.z = value; - - return this; - }, - - /** - * Sets the w position of this Game Object. + * See the `setColors` method for details of how to color each of the vertices. * - * @method Phaser.GameObjects.Components.Transform#setW - * @since 3.0.0 + * @method Phaser.GameObjects.Rope#setTintFill + * @webglOnly + * @since 3.23.0 * - * @param {number} [value=0] - The w position of this Game Object. + * @param {boolean} [value=false] - Set to `false` for an Additive tint or `true` fill tint with alpha. * * @return {this} This Game Object instance. */ - setW: function (value) + setTintFill: function (value) { - if (value === undefined) { value = 0; } + if (value === undefined) { value = false; } - this.w = value; + this.tintFill = value; return this; }, /** - * Gets the local transform matrix for this Game Object. + * Set the alpha values used by the Rope during rendering. * - * @method Phaser.GameObjects.Components.Transform#getLocalTransformMatrix - * @since 3.4.0 + * You can provide the values in a number of ways: * - * @param {Phaser.GameObjects.Components.TransformMatrix} [tempMatrix] - The matrix to populate with the values from this Game Object. + * 1) One single numeric value: `setAlphas(0.5)` - This will set a single alpha for the whole Rope. + * 2) Two numeric value: `setAlphas(1, 0.5)` - This will set a 'top' and 'bottom' alpha value across the whole Rope. + * 3) An array of values: `setAlphas([ 1, 0.5, 0.2 ])` * - * @return {Phaser.GameObjects.Components.TransformMatrix} The populated Transform Matrix. - */ - getLocalTransformMatrix: function (tempMatrix) - { - if (tempMatrix === undefined) { tempMatrix = new TransformMatrix(); } - - return tempMatrix.applyITRS(this.x, this.y, this._rotation, this._scaleX, this._scaleY); - }, - - /** - * Gets the world transform matrix for this Game Object, factoring in any parent Containers. + * If you provide an array of values and the array has exactly the same number of values as `points` in the Rope, it + * will use each alpha value per rope segment. * - * @method Phaser.GameObjects.Components.Transform#getWorldTransformMatrix - * @since 3.4.0 + * If the provided array has a different number of values than `points` then it will use the values in order, from + * the first Rope segment and on, until it runs out of values. This allows you to control the alpha values at all + * vertices in the Rope. * - * @param {Phaser.GameObjects.Components.TransformMatrix} [tempMatrix] - The matrix to populate with the values from this Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - A temporary matrix to hold parent values during the calculations. + * Note this method is called `setAlphas` (plural) and not `setAlpha`. * - * @return {Phaser.GameObjects.Components.TransformMatrix} The populated Transform Matrix. + * @method Phaser.GameObjects.Rope#setAlphas + * @since 3.23.0 + * + * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. If nothing is provided alpha is reset to 1. + * @param {number} [bottomAlpha] - An optional bottom alpha value. See the method description for details. + * + * @return {this} This Game Object instance. */ - getWorldTransformMatrix: function (tempMatrix, parentMatrix) + setAlphas: function (alphas, bottomAlpha) { - if (tempMatrix === undefined) { tempMatrix = new TransformMatrix(); } - if (parentMatrix === undefined) { parentMatrix = new TransformMatrix(); } + var total = this.points.length; - var parent = this.parentContainer; + if (total < 1) + { + return this; + } - if (!parent) + var currentAlphas = this.alphas; + + if (alphas === undefined) { - return this.getLocalTransformMatrix(tempMatrix); + alphas = [ 1 ]; + } + else if (!Array.isArray(alphas) && bottomAlpha === undefined) + { + alphas = [ alphas ]; } - tempMatrix.applyITRS(this.x, this.y, this._rotation, this._scaleX, this._scaleY); + var i; + var index = 0; - while (parent) + if (bottomAlpha !== undefined) { - parentMatrix.applyITRS(parent.x, parent.y, parent._rotation, parent._scaleX, parent._scaleY); + // Top / Bottom alpha pair + for (i = 0; i < total; i++) + { + index = i * 2; - parentMatrix.multiply(tempMatrix, tempMatrix); + currentAlphas[index] = alphas; + currentAlphas[index + 1] = bottomAlpha; + } + } + else if (alphas.length === total) + { + // If there are exactly the same number of alphas as points, we'll combine the alphas + for (i = 0; i < total; i++) + { + index = i * 2; - parent = parent.parentContainer; + currentAlphas[index] = alphas[i]; + currentAlphas[index + 1] = alphas[i]; + } } + else + { + var prevAlpha = alphas[0]; + + for (i = 0; i < total; i++) + { + index = i * 2; + + if (alphas.length > index) + { + prevAlpha = alphas[index]; + } + + currentAlphas[index] = prevAlpha; + + if (alphas.length > index + 1) + { + prevAlpha = alphas[index + 1]; + } + + currentAlphas[index + 1] = prevAlpha; + } + } + + return this; - return tempMatrix; }, /** - * Takes the given `x` and `y` coordinates and converts them into local space for this - * Game Object, taking into account parent and local transforms, and the Display Origin. + * Set the color values used by the Rope during rendering. * - * The returned Vector2 contains the translated point in its properties. + * Colors are used to control the level of tint applied across the Rope texture. * - * A Camera needs to be provided in order to handle modified scroll factors. If no - * camera is specified, it will use the `main` camera from the Scene to which this - * Game Object belongs. + * You can provide the values in a number of ways: * - * @method Phaser.GameObjects.Components.Transform#getLocalPoint - * @since 3.50.0 + * * One single numeric value: `setColors(0xff0000)` - This will set a single color tint for the whole Rope. + * * An array of values: `setColors([ 0xff0000, 0x00ff00, 0x0000ff ])` * - * @param {number} x - The x position to translate. - * @param {number} y - The y position to translate. - * @param {Phaser.Math.Vector2} [point] - A Vector2, or point-like object, to store the results in. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera which is being tested against. If not given will use the Scene default camera. + * If you provide an array of values and the array has exactly the same number of values as `points` in the Rope, it + * will use each color per rope segment. * - * @return {Phaser.Math.Vector2} The translated point. + * If the provided array has a different number of values than `points` then it will use the values in order, from + * the first Rope segment and on, until it runs out of values. This allows you to control the color values at all + * vertices in the Rope. + * + * @method Phaser.GameObjects.Rope#setColors + * @since 3.23.0 + * + * @param {(number|number[])} [colors] - Either a single color value, or an array of values. If nothing is provided color is reset to 0xffffff. + * + * @return {this} This Game Object instance. */ - getLocalPoint: function (x, y, point, camera) + setColors: function (colors) { - if (!point) { point = new Vector2(); } - if (!camera) { camera = this.scene.sys.cameras.main; } + var total = this.points.length; - var csx = camera.scrollX; - var csy = camera.scrollY; + if (total < 1) + { + return this; + } - var px = x + (csx * this.scrollFactorX) - csx; - var py = y + (csy * this.scrollFactorY) - csy; + var currentColors = this.colors; - if (this.parentContainer) + if (colors === undefined) { - this.getWorldTransformMatrix().applyInverse(px, py, point); + colors = [ 0xffffff ]; } - else + else if (!Array.isArray(colors)) { - TransformXY(px, py, this.x, this.y, this.rotation, this.scaleX, this.scaleY, point); + colors = [ colors ]; } - // Normalize origin - if (this._originComponent) + var i; + var index = 0; + + if (colors.length === total) { - point.x += this._displayOriginX; - point.y += this._displayOriginY; + // If there are exactly the same number of colors as points, we'll combine the colors + for (i = 0; i < total; i++) + { + index = i * 2; + + currentColors[index] = colors[i]; + currentColors[index + 1] = colors[i]; + } + } + else + { + var prevColor = colors[0]; + + for (i = 0; i < total; i++) + { + index = i * 2; + + if (colors.length > index) + { + prevColor = colors[index]; + } + + currentColors[index] = prevColor; + + if (colors.length > index + 1) + { + prevColor = colors[index + 1]; + } + + currentColors[index + 1] = prevColor; + } } - return point; + return this; }, /** - * Gets the sum total rotation of all of this Game Objects parent Containers. + * Sets the points used by this Rope. * - * The returned value is in radians and will be zero if this Game Object has no parent container. + * The points should be provided as an array of Vector2, or vector2-like objects (i.e. those with public x/y properties). * - * @method Phaser.GameObjects.Components.Transform#getParentRotation - * @since 3.18.0 + * Each point corresponds to one segment of the Rope. The more points in the array, the more segments the rope has. * - * @return {number} The sum total rotation, in radians, of all parent containers of this Game Object. + * Point coordinates are given in local-space, not world-space, and are directly related to the size of the texture + * this Rope object is using. + * + * For example, a Rope using a 512 px wide texture, split into 4 segments (128px each) would use the following points: + * + * ```javascript + * rope.setPoints([ + * { x: 0, y: 0 }, + * { x: 128, y: 0 }, + * { x: 256, y: 0 }, + * { x: 384, y: 0 } + * ]); + * ``` + * + * Or, you can provide an integer to do the same thing: + * + * ```javascript + * rope.setPoints(4); + * ``` + * + * Which will divide the Rope into 4 equally sized segments based on the frame width. + * + * Note that calling this method with a different number of points than the Rope has currently will + * _reset_ the color and alpha values, unless you provide them as arguments to this method. + * + * @method Phaser.GameObjects.Rope#setPoints + * @since 3.23.0 + * + * @param {(number|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. + * @param {(number|number[])} [colors] - Either a single color value, or an array of values. + * @param {(number|number[])} [alphas] - Either a single alpha value, or an array of values. + * + * @return {this} This Game Object instance. */ - getParentRotation: function () + setPoints: function (points, colors, alphas) { - var rotation = 0; - - var parent = this.parentContainer; + if (points === undefined) { points = 2; } - while (parent) + if (typeof points === 'number') { - rotation += parent.rotation; + // Generate an array based on the points + var segments = points; - parent = parent.parentContainer; - } + if (segments < 2) + { + segments = 2; + } - return rotation; - } + points = []; -}; + var s; + var frameSegment; + var offset; -module.exports = Transform; + if (this.horizontal) + { + offset = -(this.frame.halfWidth); + frameSegment = this.frame.width / (segments - 1); + for (s = 0; s < segments; s++) + { + points.push({ x: offset + s * frameSegment, y: 0 }); + } + } + else + { + offset = -(this.frame.halfHeight); + frameSegment = this.frame.height / (segments - 1); -/***/ }), -/* 314 */ -/***/ (function(module, exports) { + for (s = 0; s < segments; s++) + { + points.push({ x: 0, y: offset + s * frameSegment }); + } + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var total = points.length; + var currentTotal = this.points.length; -// bitmask flag for GameObject.renderMask -var _FLAG = 1; // 0001 + if (total < 1) + { + console.warn('Rope: Not enough points given'); -/** - * Provides methods used for setting the visibility of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @namespace Phaser.GameObjects.Components.Visible - * @since 3.0.0 - */ + return this; + } + else if (total === 1) + { + points.unshift({ x: 0, y: 0 }); + total++; + } -var Visible = { + if (currentTotal !== total) + { + this.resizeArrays(total); + } - /** - * Private internal value. Holds the visible value. - * - * @name Phaser.GameObjects.Components.Visible#_visible - * @type {boolean} - * @private - * @default true - * @since 3.0.0 - */ - _visible: true, + this.dirty = true; - /** - * The visible state of the Game Object. - * - * An invisible Game Object will skip rendering, but will still process update logic. - * - * @name Phaser.GameObjects.Components.Visible#visible - * @type {boolean} - * @since 3.0.0 - */ - visible: { + this.points = points; - get: function () + this.updateUVs(); + + if (colors !== undefined && colors !== null) { - return this._visible; - }, + this.setColors(colors); + } - set: function (value) + if (alphas !== undefined && alphas !== null) { - if (value) - { - this._visible = true; - this.renderFlags |= _FLAG; - } - else - { - this._visible = false; - this.renderFlags &= ~_FLAG; - } + this.setAlphas(alphas); } + return this; }, /** - * Sets the visibility of this Game Object. - * - * An invisible Game Object will skip rendering, but will still process update logic. + * Updates all of the UVs based on the Rope.points and `flipX` and `flipY` settings. * - * @method Phaser.GameObjects.Components.Visible#setVisible - * @since 3.0.0 + * @method Phaser.GameObjects.Rope#updateUVs + * @since 3.23.0 * - * @param {boolean} value - The visible state of the Game Object. - * * @return {this} This Game Object instance. */ - setVisible: function (value) + updateUVs: function () { - this.visible = value; - - return this; - } -}; - -module.exports = Visible; - - -/***/ }), -/* 315 */ -/***/ (function(module, exports, __webpack_require__) { + var currentUVs = this.uv; + var total = this.points.length; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var u0 = this.frame.u0; + var v0 = this.frame.v0; + var u1 = this.frame.u1; + var v1 = this.frame.v1; -/** - * @namespace Phaser.Data.Events - */ + var partH = (u1 - u0) / (total - 1); + var partV = (v1 - v0) / (total - 1); -module.exports = { + for (var i = 0; i < total; i++) + { + var index = i * 4; - CHANGE_DATA: __webpack_require__(638), - CHANGE_DATA_KEY: __webpack_require__(639), - DESTROY: __webpack_require__(640), - REMOVE_DATA: __webpack_require__(641), - SET_DATA: __webpack_require__(642) + var uv0; + var uv1; + var uv2; + var uv3; -}; + if (this.horizontal) + { + if (this._flipX) + { + uv0 = u1 - (i * partH); + uv2 = u1 - (i * partH); + } + else + { + uv0 = u0 + (i * partH); + uv2 = u0 + (i * partH); + } + if (this._flipY) + { + uv1 = v1; + uv3 = v0; + } + else + { + uv1 = v0; + uv3 = v1; + } + } + else + { + if (this._flipX) + { + uv0 = u0; + uv2 = u1; + } + else + { + uv0 = u1; + uv2 = u0; + } -/***/ }), -/* 316 */ -/***/ (function(module, exports, __webpack_require__) { + if (this._flipY) + { + uv1 = v1 - (i * partV); + uv3 = v1 - (i * partV); + } + else + { + uv1 = v0 + (i * partV); + uv3 = v0 + (i * partV); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + currentUVs[index + 0] = uv0; + currentUVs[index + 1] = uv1; + currentUVs[index + 2] = uv2; + currentUVs[index + 3] = uv3; + } -var Perimeter = __webpack_require__(130); -var Point = __webpack_require__(4); + return this; + }, + /** + * Resizes all of the internal arrays: `vertices`, `uv`, `colors` and `alphas` to the new + * given Rope segment total. + * + * @method Phaser.GameObjects.Rope#resizeArrays + * @since 3.23.0 + * + * @param {number} newSize - The amount of segments to split the Rope in to. + * + * @return {this} This Game Object instance. + */ + resizeArrays: function (newSize) + { + var colors = this.colors; + var alphas = this.alphas; -/** - * Returns an array of points from the perimeter of the Rectangle, where each point is spaced out based - * on either the `step` value, or the `quantity`. - * - * @function Phaser.Geom.Rectangle.MarchingAnts - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point[]} O - [out,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the perimeter points from. - * @param {number} [step] - The distance between each point of the perimeter. Set to `null` if you wish to use the `quantity` parameter instead. - * @param {number} [quantity] - The total number of points to return. The step is then calculated based on the length of the Rectangle, divided by this value. - * @param {(array|Phaser.Geom.Point[])} [out] - An array in which the perimeter points will be stored. If not given, a new array instance is created. - * - * @return {(array|Phaser.Geom.Point[])} An array containing the perimeter points from the Rectangle. - */ -var MarchingAnts = function (rect, step, quantity, out) -{ - if (out === undefined) { out = []; } + this.vertices = new Float32Array(newSize * 4); + this.uv = new Float32Array(newSize * 4); - if (!step && !quantity) - { - // Bail out - return out; - } + colors = new Uint32Array(newSize * 2); + alphas = new Float32Array(newSize * 2); - // If step is a falsey value (false, null, 0, undefined, etc) then we calculate - // it based on the quantity instead, otherwise we always use the step value - if (!step) + for (var i = 0; i < newSize * 2; i++) + { + colors[i] = 0xffffff; + alphas[i] = 1; + } + + this.colors = colors; + this.alphas = alphas; + + // updateVertices during next render + this.dirty = true; + + return this; + }, + + /** + * Updates the vertices based on the Rope points. + * + * This method is called automatically during rendering if `Rope.dirty` is `true`, which is set + * by the `setPoints` and `setDirty` methods. You should flag the Rope as being dirty if you modify + * the Rope points directly. + * + * @method Phaser.GameObjects.Rope#updateVertices + * @since 3.23.0 + * + * @return {this} This Game Object instance. + */ + updateVertices: function () { - step = Perimeter(rect) / quantity; - } - else + var perp = this._perp; + var points = this.points; + var vertices = this.vertices; + + var total = points.length; + + this.dirty = false; + + if (total < 1) + { + return; + } + + var nextPoint; + var lastPoint = points[0]; + + var frameSize = (this.horizontal) ? this.frame.halfHeight : this.frame.halfWidth; + + for (var i = 0; i < total; i++) + { + var point = points[i]; + var index = i * 4; + + if (i < total - 1) + { + nextPoint = points[i + 1]; + } + else + { + nextPoint = point; + } + + perp.x = nextPoint.y - lastPoint.y; + perp.y = -(nextPoint.x - lastPoint.x); + + var perpLength = perp.length(); + + perp.x /= perpLength; + perp.y /= perpLength; + + perp.x *= frameSize; + perp.y *= frameSize; + + vertices[index] = point.x + perp.x; + vertices[index + 1] = point.y + perp.y; + vertices[index + 2] = point.x - perp.x; + vertices[index + 3] = point.y - perp.y; + + lastPoint = point; + } + + return this; + }, + + /** + * This method enables rendering of the Rope vertices to the given Graphics instance. + * + * If you enable this feature, you **must** call `Graphics.clear()` in your Scene `update`, + * otherwise the Graphics instance you provide to debug will fill-up with draw calls, + * eventually crashing the browser. This is not done automatically to allow you to debug + * draw multiple Rope objects to a single Graphics instance. + * + * The Rope class has a built-in debug rendering callback `Rope.renderDebugVerts`, however + * you can also provide your own callback to be used instead. Do this by setting the `callback` parameter. + * + * The callback is invoked _once per render_ and sent the following parameters: + * + * `callback(src, meshLength, verts)` + * + * `src` is the Rope instance being debugged. + * `meshLength` is the number of mesh vertices in total. + * `verts` is an array of the translated vertex coordinates. + * + * If using your own callback you do not have to provide a Graphics instance to this method. + * + * To disable debug rendering, to either your own callback or the built-in one, call this method + * with no arguments. + * + * @method Phaser.GameObjects.Rope#setDebug + * @since 3.23.0 + * + * @param {Phaser.GameObjects.Graphics} [graphic] - The Graphic instance to render to if using the built-in callback. + * @param {function} [callback] - The callback to invoke during debug render. Leave as undefined to use the built-in callback. + * + * @return {this} This Game Object instance. + */ + setDebug: function (graphic, callback) { - quantity = Math.round(Perimeter(rect) / step); - } + this.debugGraphic = graphic; - var x = rect.x; - var y = rect.y; - var face = 0; + if (!graphic && !callback) + { + this.debugCallback = null; + } + else if (!callback) + { + this.debugCallback = this.renderDebugVerts; + } + else + { + this.debugCallback = callback; + } - // Loop across each face of the rectangle + return this; + }, - for (var i = 0; i < quantity; i++) + /** + * The built-in Rope vertices debug rendering method. + * + * See `Rope.setDebug` for more details. + * + * @method Phaser.GameObjects.Rope#renderDebugVerts + * @since 3.23.0 + * + * @param {Phaser.GameObjects.Rope} src - The Rope object being rendered. + * @param {number} meshLength - The number of vertices in the mesh. + * @param {number[]} verts - An array of translated vertex coordinates. + */ + renderDebugVerts: function (src, meshLength, verts) { - out.push(new Point(x, y)); + var graphic = src.debugGraphic; - switch (face) + var px0 = verts[0]; + var py0 = verts[1]; + var px1 = verts[2]; + var py1 = verts[3]; + + graphic.lineBetween(px0, py0, px1, py1); + + for (var i = 4; i < meshLength; i += 4) { + var x0 = verts[i + 0]; + var y0 = verts[i + 1]; + var x1 = verts[i + 2]; + var y1 = verts[i + 3]; - // Top face - case 0: - x += step; + graphic.lineBetween(px0, py0, x0, y0); + graphic.lineBetween(px1, py1, x1, y1); + graphic.lineBetween(px1, py1, x0, y0); + graphic.lineBetween(x0, y0, x1, y1); - if (x >= rect.right) - { - face = 1; - y += (x - rect.right); - x = rect.right; - } - break; + px0 = x0; + py0 = y0; + px1 = x1; + py1 = y1; + } + }, - // Right face - case 1: - y += step; + /** + * Handles the pre-destroy step for the Rope, which removes the Animation component and typed arrays. + * + * @method Phaser.GameObjects.Rope#preDestroy + * @private + * @since 3.23.0 + */ + preDestroy: function () + { + this.anims.destroy(); - if (y >= rect.bottom) - { - face = 2; - x -= (y - rect.bottom); - y = rect.bottom; - } - break; + this.anims = undefined; - // Bottom face - case 2: - x -= step; + this.points = null; + this.vertices = null; + this.uv = null; + this.colors = null; + this.alphas = null; - if (x <= rect.left) - { - face = 3; - y -= (rect.left - x); - x = rect.left; - } - break; + this.debugCallback = null; + this.debugGraphic = null; + }, - // Left face - case 3: - y -= step; + /** + * The horizontally flipped state of the Game Object. + * + * A Game Object that is flipped horizontally will render inversed on the horizontal axis. + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. + * + * @name Phaser.GameObjects.Rope#flipX + * @type {boolean} + * @default false + * @since 3.23.0 + */ + flipX: { - if (y <= rect.top) - { - face = 0; - y = rect.top; - } - break; + get: function () + { + return this._flipX; + }, + + set: function (value) + { + this._flipX = value; + + return this.updateUVs(); + } + + }, + + /** + * The vertically flipped state of the Game Object. + * + * A Game Object that is flipped vertically will render inversed on the vertical axis (i.e. upside down) + * Flipping always takes place from the middle of the texture and does not impact the scale value. + * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. + * + * @name Phaser.GameObjects.Rope#flipY + * @type {boolean} + * @default false + * @since 3.23.0 + */ + flipY: { + + get: function () + { + return this._flipY; + }, + + set: function (value) + { + this._flipY = value; + + return this.updateUVs(); } + } - return out; -}; +}); -module.exports = MarchingAnts; +module.exports = Rope; /***/ }), -/* 317 */ -/***/ (function(module, exports) { + +/***/ 44598: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Using Bresenham's line algorithm this will return an array of all coordinates on this line. - * - * The `start` and `end` points are rounded before this runs as the algorithm works on integers. - * - * @function Phaser.Geom.Line.BresenhamPoints - * @since 3.0.0 + * This is a stub function for Rope.Render. There is no Canvas renderer for Rope objects. * - * @param {Phaser.Geom.Line} line - The line. - * @param {number} [stepRate=1] - The optional step rate for the points on the line. - * @param {Phaser.Types.Math.Vector2Like[]} [results] - An optional array to push the resulting coordinates into. + * @method Phaser.GameObjects.Rope#renderCanvas + * @since 3.23.0 + * @private * - * @return {Phaser.Types.Math.Vector2Like[]} The array of coordinates on the line. + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Rope} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. */ -var BresenhamPoints = function (line, stepRate, results) +var RopeCanvasRenderer = function () { - if (stepRate === undefined) { stepRate = 1; } - if (results === undefined) { results = []; } +}; - var x1 = Math.round(line.x1); - var y1 = Math.round(line.y1); - var x2 = Math.round(line.x2); - var y2 = Math.round(line.y2); +module.exports = RopeCanvasRenderer; - var dx = Math.abs(x2 - x1); - var dy = Math.abs(y2 - y1); - var sx = (x1 < x2) ? 1 : -1; - var sy = (y1 < y2) ? 1 : -1; - var err = dx - dy; - results.push({ x: x1, y: y1 }); +/***/ }), - var i = 1; +/***/ 96027: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - while (!((x1 === x2) && (y1 === y2))) - { - var e2 = err << 1; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (e2 > -dy) - { - err -= dy; - x1 += sx; - } +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var GetValue = __webpack_require__(10850); +var Rope = __webpack_require__(79968); - if (e2 < dx) - { - err += dx; - y1 += sy; - } +/** + * Creates a new Rope Game Object and returns it. + * + * Note: This method will only be available if the Rope Game Object and WebGL support have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#rope + * @since 3.23.0 + * + * @param {Phaser.Types.GameObjects.Rope.RopeConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Rope} The Game Object that was created. + */ +GameObjectCreator.register('rope', function (config, addToScene) +{ + if (config === undefined) { config = {}; } - if (i % stepRate === 0) - { - results.push({ x: x1, y: y1 }); - } + var key = GetAdvancedValue(config, 'key', null); + var frame = GetAdvancedValue(config, 'frame', null); + var horizontal = GetAdvancedValue(config, 'horizontal', true); + var points = GetValue(config, 'points', undefined); + var colors = GetValue(config, 'colors', undefined); + var alphas = GetValue(config, 'alphas', undefined); - i++; + var rope = new Rope(this.scene, 0, 0, key, frame, points, horizontal, colors, alphas); + + if (addToScene !== undefined) + { + config.add = addToScene; } - return results; -}; + BuildGameObject(this.scene, rope, config); -module.exports = BresenhamPoints; + return rope; +}); + +// When registering a factory function 'this' refers to the GameObjectCreator context. /***/ }), -/* 318 */ -/***/ (function(module, exports) { + +/***/ 31982: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Rope = __webpack_require__(79968); +var GameObjectFactory = __webpack_require__(61286); + /** - * Searches a pre-sorted array for the closet value to the given number. + * Creates a new Rope Game Object and adds it to the Scene. * - * If the `key` argument is given it will assume the array contains objects that all have the required `key` property name, - * and will check for the closest value of those to the given number. + * Note: This method will only be available if the Rope Game Object and WebGL support have been built into Phaser. * - * @function Phaser.Utils.Array.FindClosestInSorted - * @since 3.0.0 + * @method Phaser.GameObjects.GameObjectFactory#rope + * @webglOnly + * @since 3.23.0 * - * @param {number} value - The value to search for in the array. - * @param {array} array - The array to search, which must be sorted. - * @param {string} [key] - An optional property key. If specified the array elements property will be checked against value. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {Phaser.Types.Math.Vector2Like[]} [points] - An array containing the vertices data for this Rope. If none is provided a simple quad is created. See `setPoints` to set this post-creation. + * @param {boolean} [horizontal=true] - Should the vertices of this Rope be aligned horizontally (`true`), or vertically (`false`)? + * @param {number[]} [colors] - An optional array containing the color data for this Rope. You should provide one color value per pair of vertices. + * @param {number[]} [alphas] - An optional array containing the alpha data for this Rope. You should provide one alpha value per pair of vertices. * - * @return {(number|any)} The nearest value found in the array, or if a `key` was given, the nearest object with the matching property value. + * @return {Phaser.GameObjects.Rope} The Game Object that was created. */ -var FindClosestInSorted = function (value, array, key) +if (true) { - if (!array.length) + GameObjectFactory.register('rope', function (x, y, texture, frame, points, horizontal, colors, alphas) { - return NaN; - } - else if (array.length === 1) + return this.displayList.add(new Rope(this.scene, x, y, texture, frame, points, horizontal, colors, alphas)); + }); +} + + +/***/ }), + +/***/ 58912: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(49489); +} + +if (true) +{ + renderCanvas = __webpack_require__(44598); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), + +/***/ 49489: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetCalcMatrix = __webpack_require__(73329); +var Utils = __webpack_require__(75512); + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Rope#renderWebGL + * @since 3.23.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Rope} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var RopeWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); + + var pipeline = renderer.pipelines.set(src.pipeline, src); + + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + + var vertices = src.vertices; + var uvs = src.uv; + var colors = src.colors; + var alphas = src.alphas; + var alpha = src.alpha; + var getTint = Utils.getTintAppendFloatAlpha; + var roundPixels = camera.roundPixels; + + var meshVerticesLength = vertices.length; + var vertexCount = Math.floor(meshVerticesLength * 0.5); + + // Because it's a triangle strip and we don't want lots of degenerate triangles joining things up + pipeline.flush(); + + renderer.pipelines.preBatch(src); + + var textureUnit = pipeline.setGameObject(src); + + var vertexViewF32 = pipeline.vertexViewF32; + var vertexViewU32 = pipeline.vertexViewU32; + + var vertexOffset = (pipeline.vertexCount * pipeline.currentShader.vertexComponentCount) - 1; + + var colorIndex = 0; + + var tintEffect = src.tintFill; + + if (src.dirty) { - return array[0]; + src.updateVertices(); } - var i = 1; - var low; - var high; + var debugCallback = src.debugCallback; + var debugVerts = []; - if (key) + for (var i = 0; i < meshVerticesLength; i += 2) { - if (value < array[0][key]) - { - return array[0]; - } + var x = vertices[i + 0]; + var y = vertices[i + 1]; - while (array[i][key] < value) + var tx = x * calcMatrix.a + y * calcMatrix.c + calcMatrix.e; + var ty = x * calcMatrix.b + y * calcMatrix.d + calcMatrix.f; + + if (roundPixels) { - i++; + tx = Math.round(tx); + ty = Math.round(ty); } - } - else - { - while (array[i] < value) + + vertexViewF32[++vertexOffset] = tx; + vertexViewF32[++vertexOffset] = ty; + vertexViewF32[++vertexOffset] = uvs[i + 0]; + vertexViewF32[++vertexOffset] = uvs[i + 1]; + vertexViewF32[++vertexOffset] = textureUnit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = getTint(colors[colorIndex], camera.alpha * (alphas[colorIndex] * alpha)); + + colorIndex++; + + if (debugCallback) { - i++; + debugVerts[i + 0] = tx; + debugVerts[i + 1] = ty; } } - if (i > array.length) + if (debugCallback) { - i = array.length; + debugCallback.call(src, src, meshVerticesLength, debugVerts); } - if (key) - { - low = array[i - 1][key]; - high = array[i][key]; + pipeline.vertexCount += vertexCount; - return ((high - value) <= (value - low)) ? array[i] : array[i - 1]; - } - else - { - low = array[i - 1]; - high = array[i]; + pipeline.currentBatch.count = (pipeline.vertexCount - pipeline.currentBatch.start); - return ((high - value) <= (value - low)) ? high : low; - } + renderer.pipelines.postBatch(src); }; -module.exports = FindClosestInSorted; +module.exports = RopeWebGLRenderer; /***/ }), -/* 319 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 27902: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var GetFastValue = __webpack_require__(72632); +var Extend = __webpack_require__(98611); +var SetValue = __webpack_require__(22440); +var ShaderRender = __webpack_require__(24252); +var TransformMatrix = __webpack_require__(69360); /** * @classdesc - * A single frame in an Animation sequence. + * A Shader Game Object. * - * An AnimationFrame consists of a reference to the Texture it uses for rendering, references to other - * frames in the animation, and index data. It also has the ability to modify the animation timing. + * This Game Object allows you to easily add a quad with its own shader into the display list, and manipulate it + * as you would any other Game Object, including scaling, rotating, positioning and adding to Containers. Shaders + * can be masked with either Bitmap or Geometry masks and can also be used as a Bitmap Mask for a Camera or other + * Game Object. They can also be made interactive and used for input events. * - * AnimationFrames are generated automatically by the Animation class. + * It works by taking a reference to a `Phaser.Display.BaseShader` instance, as found in the Shader Cache. These can + * be created dynamically at runtime, or loaded in via the GLSL File Loader: * - * @class AnimationFrame - * @memberof Phaser.Animations + * ```javascript + * function preload () + * { + * this.load.glsl('fire', 'shaders/fire.glsl.js'); + * } + * + * function create () + * { + * this.add.shader('fire', 400, 300, 512, 512); + * } + * ``` + * + * Please see the Phaser 3 Examples GitHub repo for examples of loading and creating shaders dynamically. + * + * Due to the way in which they work, you cannot directly change the alpha or blend mode of a Shader. This should + * be handled via exposed uniforms in the shader code itself. + * + * By default a Shader will be created with a standard set of uniforms. These were added to match those + * found on sites such as ShaderToy or GLSLSandbox, and provide common functionality a shader may need, + * such as the timestamp, resolution or pointer position. You can replace them by specifying your own uniforms + * in the Base Shader. + * + * These Shaders work by halting the current pipeline during rendering, creating a viewport matched to the + * size of this Game Object and then renders a quad using the bound shader. At the end, the pipeline is restored. + * + * Because it blocks the pipeline it means it will interrupt any batching that is currently going on, so you should + * use these Game Objects sparingly. If you need to have a fully batched custom shader, then please look at using + * a custom pipeline instead. However, for background or special masking effects, they are extremely effective. + * + * @class Shader + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects * @constructor - * @since 3.0.0 + * @webglOnly + * @since 3.17.0 * - * @param {string} textureKey - The key of the Texture this AnimationFrame uses. - * @param {(string|number)} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses. - * @param {number} index - The index of this AnimationFrame within the Animation sequence. - * @param {Phaser.Textures.Frame} frame - A reference to the Texture Frame this AnimationFrame uses for rendering. - * @param {boolean} [isKeyFrame=false] - Is this Frame a Keyframe within the Animation? + * @extends Phaser.GameObjects.Components.ComputedSize + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {(string|Phaser.Display.BaseShader)} key - The key of the shader to use from the shader cache, or a BaseShader instance. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [width=128] - The width of the Game Object. + * @param {number} [height=128] - The height of the Game Object. + * @param {string[]} [textures] - Optional array of texture keys to bind to the iChannel0...3 uniforms. The textures must already exist in the Texture Manager. + * @param {any} [textureData] - Additional texture data if you want to create shader with none NPOT textures. */ -var AnimationFrame = new Class({ +var Shader = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.ComputedSize, + Components.Depth, + Components.GetBounds, + Components.Mask, + Components.Origin, + Components.ScrollFactor, + Components.Transform, + Components.Visible, + ShaderRender + ], initialize: - function AnimationFrame (textureKey, textureFrame, index, frame, isKeyFrame) + function Shader (scene, key, x, y, width, height, textures, textureData) { - if (isKeyFrame === undefined) { isKeyFrame = false; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 128; } + if (height === undefined) { height = 128; } + + GameObject.call(this, scene, 'Shader'); /** - * The key of the Texture this AnimationFrame uses. + * This Game Object cannot have a blend mode, so skip all checks. * - * @name Phaser.Animations.AnimationFrame#textureKey - * @type {string} - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#blendMode + * @type {number} + * @private + * @since 3.17.0 */ - this.textureKey = textureKey; + this.blendMode = -1; /** - * The key of the Frame within the Texture that this AnimationFrame uses. + * The underlying shader object being used. + * Empty by default and set during a call to the `setShader` method. * - * @name Phaser.Animations.AnimationFrame#textureFrame - * @type {(string|number)} - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#shader + * @type {Phaser.Display.BaseShader} + * @since 3.17.0 */ - this.textureFrame = textureFrame; + this.shader; + + var renderer = scene.sys.renderer; /** - * The index of this AnimationFrame within the Animation sequence. + * A reference to the current renderer. + * Shaders only work with the WebGL Renderer. * - * @name Phaser.Animations.AnimationFrame#index - * @type {number} - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#renderer + * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} + * @since 3.17.0 */ - this.index = index; + this.renderer = renderer; /** - * A reference to the Texture Frame this AnimationFrame uses for rendering. + * The WebGL context belonging to the renderer. * - * @name Phaser.Animations.AnimationFrame#frame - * @type {Phaser.Textures.Frame} - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#gl + * @type {WebGLRenderingContext} + * @since 3.17.0 */ - this.frame = frame; + this.gl = renderer.gl; /** - * Is this the first frame in an animation sequence? + * Raw byte buffer of vertices this Shader uses. * - * @name Phaser.Animations.AnimationFrame#isFirst - * @type {boolean} - * @default false - * @readonly - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#vertexData + * @type {ArrayBuffer} + * @since 3.17.0 */ - this.isFirst = false; + this.vertexData = new ArrayBuffer(6 * (Float32Array.BYTES_PER_ELEMENT * 2)); /** - * Is this the last frame in an animation sequence? + * The WebGL vertex buffer object this shader uses. * - * @name Phaser.Animations.AnimationFrame#isLast - * @type {boolean} - * @default false - * @readonly - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#vertexBuffer + * @type {WebGLBuffer} + * @since 3.17.0 */ - this.isLast = false; + this.vertexBuffer = renderer.createVertexBuffer(this.vertexData.byteLength, this.gl.STREAM_DRAW); /** - * A reference to the AnimationFrame that comes before this one in the animation, if any. + * The WebGL shader program this shader uses. * - * @name Phaser.Animations.AnimationFrame#prevFrame - * @type {?Phaser.Animations.AnimationFrame} - * @default null - * @readonly - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#program + * @type {WebGLProgram} + * @since 3.17.0 */ - this.prevFrame = null; + this.program = null; /** - * A reference to the AnimationFrame that comes after this one in the animation, if any. + * Uint8 view to the vertex raw buffer. Used for uploading vertex buffer resources to the GPU. * - * @name Phaser.Animations.AnimationFrame#nextFrame - * @type {?Phaser.Animations.AnimationFrame} - * @default null - * @readonly - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#bytes + * @type {Uint8Array} + * @since 3.17.0 */ - this.nextFrame = null; + this.bytes = new Uint8Array(this.vertexData); /** - * Additional time (in ms) that this frame should appear for during playback. - * The value is added onto the msPerFrame set by the animation. + * Float32 view of the array buffer containing the shaders vertices. * - * @name Phaser.Animations.AnimationFrame#duration - * @type {number} - * @default 0 - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#vertexViewF32 + * @type {Float32Array} + * @since 3.17.0 */ - this.duration = 0; + this.vertexViewF32 = new Float32Array(this.vertexData); /** - * What % through the animation does this frame come? - * This value is generated when the animation is created and cached here. + * A temporary Transform Matrix, re-used internally during batching. * - * @name Phaser.Animations.AnimationFrame#progress - * @type {number} - * @default 0 - * @readonly - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#_tempMatrix1 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.17.0 */ - this.progress = 0; + this._tempMatrix1 = new TransformMatrix(); /** - * Is this Frame a KeyFrame within the Animation? + * A temporary Transform Matrix, re-used internally during batching. * - * @name Phaser.Animations.AnimationFrame#isKeyFrame - * @type {boolean} - * @since 3.50.0 + * @name Phaser.GameObjects.Shader#_tempMatrix2 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.17.0 */ - this.isKeyFrame = isKeyFrame; - }, - - /** - * Generates a JavaScript object suitable for converting to JSON. - * - * @method Phaser.Animations.AnimationFrame#toJSON - * @since 3.0.0 - * - * @return {Phaser.Types.Animations.JSONAnimationFrame} The AnimationFrame data. - */ - toJSON: function () - { - return { - key: this.textureKey, - frame: this.textureFrame, - duration: this.duration, - keyframe: this.isKeyFrame - }; - }, - - /** - * Destroys this object by removing references to external resources and callbacks. - * - * @method Phaser.Animations.AnimationFrame#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.frame = undefined; - } - -}); - -module.exports = AnimationFrame; - - -/***/ }), -/* 320 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Takes the given array and runs a numeric sort on it, ignoring any non-digits that - * may be in the entries. - * - * You should only run this on arrays containing strings. - * - * @function Phaser.Utils.Array.SortByDigits - * @since 3.50.0 - * - * @param {string[]} array - The input array of strings. - * - * @return {string[]} The sorted input array. - */ -var SortByDigits = function (array) -{ - var re = /\D/g; - - array.sort(function (a, b) - { - return (parseInt(a.replace(re, ''), 10) - parseInt(b.replace(re, ''), 10)); - }); - - return array; -}; - -module.exports = SortByDigits; - - -/***/ }), -/* 321 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Animation = __webpack_require__(185); -var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(102); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(132); -var GameEvents = __webpack_require__(22); -var GetFastValue = __webpack_require__(2); -var GetValue = __webpack_require__(6); -var Pad = __webpack_require__(186); -var NumberArray = __webpack_require__(322); - -/** - * @classdesc - * The Animation Manager. - * - * Animations are managed by the global Animation Manager. This is a singleton class that is - * responsible for creating and delivering animations and their corresponding data to all Game Objects. - * Unlike plugins it is owned by the Game instance, not the Scene. - * - * Sprites and other Game Objects get the data they need from the AnimationManager. - * - * @class AnimationManager - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Animations - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - A reference to the Phaser.Game instance. - */ -var AnimationManager = new Class({ - - Extends: EventEmitter, - - initialize: - - function AnimationManager (game) - { - EventEmitter.call(this); + this._tempMatrix2 = new TransformMatrix(); /** - * A reference to the Phaser.Game instance. + * A temporary Transform Matrix, re-used internally during batching. * - * @name Phaser.Animations.AnimationManager#game - * @type {Phaser.Game} - * @protected - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#_tempMatrix3 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.17.0 */ - this.game = game; + this._tempMatrix3 = new TransformMatrix(); /** - * A reference to the Texture Manager. + * The view matrix the shader uses during rendering. * - * @name Phaser.Animations.AnimationManager#textureManager - * @type {Phaser.Textures.TextureManager} - * @protected - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#viewMatrix + * @type {Float32Array} + * @readonly + * @since 3.17.0 */ - this.textureManager = null; + this.viewMatrix = new Float32Array([ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); /** - * The global time scale of the Animation Manager. - * - * This scales the time delta between two frames, thus influencing the speed of time for the Animation Manager. + * The projection matrix the shader uses during rendering. * - * @name Phaser.Animations.AnimationManager#globalTimeScale - * @type {number} - * @default 1 - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#projectionMatrix + * @type {Float32Array} + * @readonly + * @since 3.17.0 */ - this.globalTimeScale = 1; + this.projectionMatrix = new Float32Array([ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]); /** - * The Animations registered in the Animation Manager. + * The default uniform mappings. These can be added to (or replaced) by specifying your own uniforms when + * creating this shader game object. The uniforms are updated automatically during the render step. * - * This map should be modified with the {@link #add} and {@link #create} methods of the Animation Manager. + * The defaults are: * - * @name Phaser.Animations.AnimationManager#anims - * @type {Phaser.Structs.Map.} - * @protected - * @since 3.0.0 + * `resolution` (2f) - Set to the size of this shader. + * `time` (1f) - The elapsed game time, in seconds. + * `mouse` (2f) - If a pointer has been bound (with `setPointer`), this uniform contains its position each frame. + * `date` (4fv) - A vec4 containing the year, month, day and time in seconds. + * `sampleRate` (1f) - Sound sample rate. 44100 by default. + * `iChannel0...3` (sampler2D) - Input channels 0 to 3. `null` by default. + * + * @name Phaser.GameObjects.Shader#uniforms + * @type {any} + * @since 3.17.0 */ - this.anims = new CustomMap(); + this.uniforms = {}; /** - * A list of animation mix times. - * - * See the {@link #setMix} method for more details. + * The pointer bound to this shader, if any. + * Set via the chainable `setPointer` method, or by modifying this property directly. * - * @name Phaser.Animations.AnimationManager#mixes - * @type {Phaser.Structs.Map.} - * @since 3.50.0 + * @name Phaser.GameObjects.Shader#pointer + * @type {Phaser.Input.Pointer} + * @since 3.17.0 */ - this.mixes = new CustomMap(); + this.pointer = null; /** - * Whether the Animation Manager is paused along with all of its Animations. + * The cached width of the renderer. * - * @name Phaser.Animations.AnimationManager#paused - * @type {boolean} - * @default false - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#_rendererWidth + * @type {number} + * @private + * @since 3.17.0 */ - this.paused = false; + this._rendererWidth = renderer.width; /** - * The name of this Animation Manager. + * The cached height of the renderer. * - * @name Phaser.Animations.AnimationManager#name - * @type {string} - * @since 3.0.0 + * @name Phaser.GameObjects.Shader#_rendererHeight + * @type {number} + * @private + * @since 3.17.0 */ - this.name = 'AnimationManager'; + this._rendererHeight = renderer.height; - game.events.once(GameEvents.BOOT, this.boot, this); + /** + * Internal texture count tracker. + * + * @name Phaser.GameObjects.Shader#_textureCount + * @type {number} + * @private + * @since 3.17.0 + */ + this._textureCount = 0; + + /** + * A reference to the GL Frame Buffer this Shader is drawing to. + * This property is only set if you have called `Shader.setRenderToTexture`. + * + * @name Phaser.GameObjects.Shader#framebuffer + * @type {?WebGLFramebuffer} + * @since 3.19.0 + */ + this.framebuffer = null; + + /** + * A reference to the WebGLTexture this Shader is rendering to. + * This property is only set if you have called `Shader.setRenderToTexture`. + * + * @name Phaser.GameObjects.Shader#glTexture + * @type {?WebGLTexture} + * @since 3.19.0 + */ + this.glTexture = null; + + /** + * A flag that indicates if this Shader has been set to render to a texture instead of the display list. + * + * This property is `true` if you have called `Shader.setRenderToTexture`, otherwise it's `false`. + * + * A Shader that is rendering to a texture _does not_ appear on the display list. + * + * @name Phaser.GameObjects.Shader#renderToTexture + * @type {boolean} + * @readonly + * @since 3.19.0 + */ + this.renderToTexture = false; + + /** + * A reference to the Phaser.Textures.Texture that has been stored in the Texture Manager for this Shader. + * + * This property is only set if you have called `Shader.setRenderToTexture`, otherwise it is `null`. + * + * @name Phaser.GameObjects.Shader#texture + * @type {Phaser.Textures.Texture} + * @since 3.19.0 + */ + this.texture = null; + + this.setPosition(x, y); + this.setSize(width, height); + this.setOrigin(0.5, 0.5); + this.setShader(key, textures, textureData); }, /** - * Registers event listeners after the Game boots. + * Compares the renderMask with the renderFlags to see if this Game Object will render or not. + * Also checks the Game Object against the given Cameras exclusion list. * - * @method Phaser.Animations.AnimationManager#boot - * @listens Phaser.Core.Events#DESTROY + * @method Phaser.GameObjects.Shader#willRender * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against this Game Object. + * + * @return {boolean} True if the Game Object should be rendered, otherwise false. */ - boot: function () + willRender: function (camera) { - this.textureManager = this.game.textures; - - this.game.events.once(GameEvents.DESTROY, this.destroy, this); + if (this.renderToTexture) + { + return true; + } + else + { + return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); + } }, /** - * Adds a mix between two animations. + * Changes this Shader so instead of rendering to the display list it renders to a + * WebGL Framebuffer and WebGL Texture instead. This allows you to use the output + * of this shader as an input for another shader, by mapping a sampler2D uniform + * to it. * - * Mixing allows you to specify a unique delay between a pairing of animations. + * After calling this method the `Shader.framebuffer` and `Shader.glTexture` properties + * are populated. * - * When playing Animation A on a Game Object, if you then play Animation B, and a - * mix exists, it will wait for the specified delay to be over before playing Animation B. + * Additionally, you can provide a key to this method. Doing so will create a Phaser Texture + * from this Shader and save it into the Texture Manager, allowing you to then use it for + * any texture-based Game Object, such as a Sprite or Image: * - * This allows you to customise smoothing between different types of animation, such - * as blending between an idle and a walk state, or a running and a firing state. + * ```javascript + * var shader = this.add.shader('myShader', x, y, width, height); * - * Note that mixing is only applied if you use the `Sprite.play` method. If you opt to use - * `playAfterRepeat` or `playAfterDelay` instead, those will take priority and the mix - * delay will not be used. + * shader.setRenderToTexture('doodle'); * - * To update an existing mix, just call this method with the new delay. + * this.add.image(400, 300, 'doodle'); + * ``` * - * To remove a mix pairing, see the `removeMix` method. + * Note that it stores an active reference to this Shader. That means as this shader updates, + * so does the texture and any object using it to render with. Also, if you destroy this + * shader, be sure to clear any objects that may have been using it as a texture too. * - * @method Phaser.Animations.AnimationManager#addMix - * @since 3.50.0 + * You can access the Phaser Texture that is created via the `Shader.texture` property. * - * @param {(string|Phaser.Animations.Animation)} animA - The string-based key, or instance of, Animation A. - * @param {(string|Phaser.Animations.Animation)} animB - The string-based key, or instance of, Animation B. - * @param {number} delay - The delay, in milliseconds, to wait when transitioning from Animation A to B. + * By default it will create a single base texture. You can add frames to the texture + * by using the `Texture.add` method. After doing this, you can then allow Game Objects + * to use a specific frame from a Render Texture. * - * @return {this} This Animation Manager. + * @method Phaser.GameObjects.Shader#setRenderToTexture + * @since 3.19.0 + * + * @param {string} [key] - The unique key to store the texture as within the global Texture Manager. + * @param {boolean} [flipY=false] - Does this texture need vertically flipping before rendering? This should usually be set to `true` if being fed from a buffer. + * + * @return {this} This Shader instance. */ - addMix: function (animA, animB, delay) + setRenderToTexture: function (key, flipY) { - var anims = this.anims; - var mixes = this.mixes; - - var keyA = (typeof(animA) === 'string') ? animA : animA.key; - var keyB = (typeof(animB) === 'string') ? animB : animB.key; + if (flipY === undefined) { flipY = false; } - if (anims.has(keyA) && anims.has(keyB)) + if (!this.renderToTexture) { - var mixObj = mixes.get(keyA); + var width = this.width; + var height = this.height; + var renderer = this.renderer; - if (!mixObj) + this.glTexture = renderer.createTextureFromSource(null, width, height, 0); + + this.glTexture.flipY = flipY; + + this.framebuffer = renderer.createFramebuffer(width, height, this.glTexture, false); + + this._rendererWidth = width; + this._rendererHeight = height; + + this.renderToTexture = true; + + this.projOrtho(0, this.width, this.height, 0); + + if (key) { - mixObj = {}; + this.texture = this.scene.sys.textures.addGLTexture(key, this.glTexture, width, height); } + } - mixObj[keyB] = delay; + // And now render at least once, so our texture isn't blank on the first update - mixes.set(keyA, mixObj); + if (this.shader) + { + renderer.pipelines.clear(); + + this.load(); + this.flush(); + + renderer.pipelines.rebind(); } return this; }, /** - * Removes a mix between two animations. - * - * Mixing allows you to specify a unique delay between a pairing of animations. - * - * Calling this method lets you remove those pairings. You can either remove - * it between `animA` and `animB`, or if you do not provide the `animB` parameter, - * it will remove all `animA` mixes. - * - * If you wish to update an existing mix instead, call the `addMix` method with the - * new delay. + * Sets the fragment and, optionally, the vertex shader source code that this Shader will use. + * This will immediately delete the active shader program, if set, and then create a new one + * with the given source. Finally, the shader uniforms are initialized. * - * @method Phaser.Animations.AnimationManager#removeMix - * @since 3.50.0 + * @method Phaser.GameObjects.Shader#setShader + * @since 3.17.0 * - * @param {(string|Phaser.Animations.Animation)} animA - The string-based key, or instance of, Animation A. - * @param {(string|Phaser.Animations.Animation)} [animB] - The string-based key, or instance of, Animation B. If not given, all mixes for Animation A will be removed. + * @param {(string|Phaser.Display.BaseShader)} key - The key of the shader to use from the shader cache, or a BaseShader instance. + * @param {string[]} [textures] - Optional array of texture keys to bind to the iChannel0...3 uniforms. The textures must already exist in the Texture Manager. + * @param {any} [textureData] - Additional texture data. * - * @return {this} This Animation Manager. + * @return {this} This Shader instance. */ - removeMix: function (animA, animB) + setShader: function (key, textures, textureData) { - var mixes = this.mixes; - - var keyA = (typeof(animA) === 'string') ? animA : animA.key; - - var mixObj = mixes.get(keyA); + if (textures === undefined) { textures = []; } - if (mixObj) + if (typeof key === 'string') { - if (animB) - { - var keyB = (typeof(animB) === 'string') ? animB : animB.key; + var cache = this.scene.sys.cache.shader; - if (mixObj.hasOwnProperty(keyB)) - { - // Remove just this pairing - delete mixObj[keyB]; - } - } - else if (!animB) + if (!cache.has(key)) { - // Remove everything for animA - mixes.delete(keyA); + console.warn('Shader missing: ' + key); + return this; } + + this.shader = cache.get(key); + } + else + { + this.shader = key; } - return this; - }, + var gl = this.gl; + var renderer = this.renderer; - /** - * Returns the mix delay between two animations. - * - * If no mix has been set-up, this method will return zero. - * - * If you wish to create, or update, a new mix, call the `addMix` method. - * If you wish to remove a mix, call the `removeMix` method. - * - * @method Phaser.Animations.AnimationManager#getMix - * @since 3.50.0 - * - * @param {(string|Phaser.Animations.Animation)} animA - The string-based key, or instance of, Animation A. - * @param {(string|Phaser.Animations.Animation)} animB - The string-based key, or instance of, Animation B. - * - * @return {number} The mix duration, or zero if no mix exists. - */ - getMix: function (animA, animB) - { - var mixes = this.mixes; + if (this.program) + { + gl.deleteProgram(this.program); + } - var keyA = (typeof(animA) === 'string') ? animA : animA.key; - var keyB = (typeof(animB) === 'string') ? animB : animB.key; + var program = renderer.createProgram(this.shader.vertexSrc, this.shader.fragmentSrc); - var mixObj = mixes.get(keyA); + // The default uniforms available within the vertex shader + gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uViewMatrix'), false, this.viewMatrix); + gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uProjectionMatrix'), false, this.projectionMatrix); + gl.uniform2f(gl.getUniformLocation(program, 'uResolution'), this.width, this.height); - if (mixObj && mixObj.hasOwnProperty(keyB)) + this.program = program; + + var d = new Date(); + + // The default uniforms available within the fragment shader + var defaultUniforms = { + resolution: { type: '2f', value: { x: this.width, y: this.height } }, + time: { type: '1f', value: 0 }, + mouse: { type: '2f', value: { x: this.width / 2, y: this.height / 2 } }, + date: { type: '4fv', value: [ d.getFullYear(), d.getMonth(), d.getDate(), d.getHours() * 60 * 60 + d.getMinutes() * 60 + d.getSeconds() ] }, + sampleRate: { type: '1f', value: 44100.0 }, + iChannel0: { type: 'sampler2D', value: null, textureData: { repeat: true } }, + iChannel1: { type: 'sampler2D', value: null, textureData: { repeat: true } }, + iChannel2: { type: 'sampler2D', value: null, textureData: { repeat: true } }, + iChannel3: { type: 'sampler2D', value: null, textureData: { repeat: true } } + }; + + if (this.shader.uniforms) { - return mixObj[keyB]; + this.uniforms = Extend(true, {}, this.shader.uniforms, defaultUniforms); } else { - return 0; + this.uniforms = defaultUniforms; } - }, - /** - * Adds an existing Animation to the Animation Manager. - * - * @method Phaser.Animations.AnimationManager#add - * @fires Phaser.Animations.Events#ADD_ANIMATION - * @since 3.0.0 - * - * @param {string} key - The key under which the Animation should be added. The Animation will be updated with it. Must be unique. - * @param {Phaser.Animations.Animation} animation - The Animation which should be added to the Animation Manager. - * - * @return {this} This Animation Manager. - */ - add: function (key, animation) - { - if (this.anims.has(key)) + for (var i = 0; i < 4; i++) { - console.warn('Animation key exists: ' + key); - - return this; + if (textures[i]) + { + this.setSampler2D('iChannel' + i, textures[i], i, textureData); + } } - animation.key = key; - - this.anims.set(key, animation); + this.initUniforms(); - this.emit(Events.ADD_ANIMATION, key, animation); + this.projOrtho(0, this._rendererWidth, this._rendererHeight, 0); return this; }, /** - * Checks to see if the given key is already in use within the Animation Manager or not. + * Binds a Phaser Pointer object to this Shader. * - * Animations are global. Keys created in one scene can be used from any other Scene in your game. They are not Scene specific. + * The screen position of the pointer will be set in to the shaders `mouse` uniform + * automatically every frame. Call this method with no arguments to unbind the pointer. * - * @method Phaser.Animations.AnimationManager#exists - * @since 3.16.0 + * @method Phaser.GameObjects.Shader#setPointer + * @since 3.17.0 * - * @param {string} key - The key of the Animation to check. + * @param {Phaser.Input.Pointer} [pointer] - The Pointer to bind to this shader. * - * @return {boolean} `true` if the Animation already exists in the Animation Manager, or `false` if the key is available. + * @return {this} This Shader instance. */ - exists: function (key) + setPointer: function (pointer) { - return this.anims.has(key); + this.pointer = pointer; + + return this; }, /** - * Create one, or more animations from a loaded Aseprite JSON file. - * - * Aseprite is a powerful animated sprite editor and pixel art tool. - * - * You can find more details at https://www.aseprite.org/ - * - * To export a compatible JSON file in Aseprite, please do the following: - * - * 1. Go to "File - Export Sprite Sheet" - * - * 2. On the **Layout** tab: - * 2a. Set the "Sheet type" to "Packed" - * 2b. Set the "Constraints" to "None" - * 2c. Check the "Merge Duplicates" checkbox - * - * 3. On the **Sprite** tab: - * 3a. Set "Layers" to "Visible layers" - * 3b. Set "Frames" to "All frames", unless you only wish to export a sub-set of tags - * - * 4. On the **Borders** tab: - * 4a. Check the "Trim Sprite" and "Trim Cells" options - * 4b. Ensure "Border Padding", "Spacing" and "Inner Padding" are all > 0 (1 is usually enough) - * - * 5. On the **Output** tab: - * 5a. Check "Output File", give your image a name and make sure you choose "png files" as the file type - * 5b. Check "JSON Data" and give your json file a name - * 5c. The JSON Data type can be either a Hash or Array, Phaser doesn't mind. - * 5d. Make sure "Tags" is checked in the Meta options - * 5e. In the "Item Filename" input box, make sure it says just "{frame}" and nothing more. - * - * 6. Click export - * - * This was tested with Aseprite 1.2.25. - * - * This will export a png and json file which you can load using the Aseprite Loader, i.e.: - * - * ```javascript - * function preload () - * { - * this.load.path = 'assets/animations/aseprite/'; - * this.load.aseprite('paladin', 'paladin.png', 'paladin.json'); - * } - * ``` - * - * Once loaded, you can call this method from within a Scene with the 'atlas' key: - * - * ```javascript - * this.anims.createFromAseprite('paladin'); - * ``` - * - * Any animations defined in the JSON will now be available to use in Phaser and you play them - * via their Tag name. For example, if you have an animation called 'War Cry' on your Aseprite timeline, - * you can play it in Phaser using that Tag name: - * - * ```javascript - * this.add.sprite(400, 300).play('War Cry'); - * ``` - * - * When calling this method you can optionally provide an array of tag names, and only those animations - * will be created. For example: - * - * ```javascript - * this.anims.createFromAseprite('paladin', [ 'step', 'War Cry', 'Magnum Break' ]); - * ``` - * - * This will only create the 3 animations defined. Note that the tag names are case-sensitive. - * - * @method Phaser.Animations.AnimationManager#createFromAseprite - * @since 3.50.0 + * Sets this shader to use an orthographic projection matrix. + * This matrix is stored locally in the `projectionMatrix` property, + * as well as being bound to the `uProjectionMatrix` uniform. * - * @param {string} key - The key of the loaded Aseprite atlas. It must have been loaded prior to calling this method. - * @param {string[]} [tags] - An array of Tag names. If provided, only animations found in this array will be created. + * @method Phaser.GameObjects.Shader#projOrtho + * @since 3.17.0 * - * @return {Phaser.Animations.Animation[]} An array of Animation instances that were successfully created. + * @param {number} left - The left value. + * @param {number} right - The right value. + * @param {number} bottom - The bottom value. + * @param {number} top - The top value. */ - createFromAseprite: function (key, tags) + projOrtho: function (left, right, bottom, top) { - var output = []; - - var data = this.game.cache.json.get(key); - - if (!data) - { - return output; - } - - var _this = this; - - var meta = GetValue(data, 'meta', null); - var frames = GetValue(data, 'frames', null); - - if (meta && frames) - { - var frameTags = GetValue(meta, 'frameTags', []); - - frameTags.forEach(function (tag) - { - var animFrames = []; - - var name = GetFastValue(tag, 'name', null); - var from = GetFastValue(tag, 'from', 0); - var to = GetFastValue(tag, 'to', 0); - var direction = GetFastValue(tag, 'direction', 'forward'); - - if (!name) - { - // Skip if no name - return; - } - - if (!tags || (tags && tags.indexOf(name) > -1)) - { - // Get all the frames for this tag - var tempFrames = []; - var minDuration = Number.MAX_SAFE_INTEGER; - - for (var i = from; i <= to; i++) - { - var frameKey = i.toString(); - var frame = frames[frameKey]; - - if (frame) - { - var frameDuration = GetFastValue(frame, 'duration', Number.MAX_SAFE_INTEGER); - - if (frameDuration < minDuration) - { - minDuration = frameDuration; - } + var near = -1000; + var far = 1000; - tempFrames.push({ frame: frameKey, duration: frameDuration }); - } - } + var leftRight = 1 / (left - right); + var bottomTop = 1 / (bottom - top); + var nearFar = 1 / (near - far); - tempFrames.forEach(function (entry) - { - animFrames.push({ - key: key, - frame: entry.frame, - duration: (minDuration - entry.duration) - }); - }); + var pm = this.projectionMatrix; - var totalDuration = (minDuration * animFrames.length); + pm[0] = -2 * leftRight; + pm[5] = -2 * bottomTop; + pm[10] = 2 * nearFar; + pm[12] = (left + right) * leftRight; + pm[13] = (top + bottom) * bottomTop; + pm[14] = (far + near) * nearFar; - if (direction === 'reverse') - { - animFrames = animFrames.reverse(); - } + var program = this.program; - // Create the animation - var createConfig = { - key: name, - frames: animFrames, - duration: totalDuration, - yoyo: (direction === 'pingpong') - }; + var gl = this.gl; + var renderer = this.renderer; - var result = _this.create(createConfig); + renderer.setProgram(program); - if (result) - { - output.push(result); - } - } - }); - } + gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uProjectionMatrix'), false, this.projectionMatrix); - return output; + this._rendererWidth = right; + this._rendererHeight = bottom; }, + // Uniforms are specified in the GLSL_ES Specification: http://www.khronos.org/registry/webgl/specs/latest/1.0/ + // http://www.khronos.org/registry/gles/specs/2.0/GLSL_ES_Specification_1.0.17.pdf + /** - * Creates a new Animation and adds it to the Animation Manager. - * - * Animations are global. Once created, you can use them in any Scene in your game. They are not Scene specific. - * - * If an invalid key is given this method will return `false`. - * - * If you pass the key of an animation that already exists in the Animation Manager, that animation will be returned. - * - * A brand new animation is only created if the key is valid and not already in use. - * - * If you wish to re-use an existing key, call `AnimationManager.remove` first, then this method. - * - * @method Phaser.Animations.AnimationManager#create - * @fires Phaser.Animations.Events#ADD_ANIMATION - * @since 3.0.0 - * - * @param {Phaser.Types.Animations.Animation} config - The configuration settings for the Animation. + * Initializes all of the uniforms this shader uses. * - * @return {(Phaser.Animations.Animation|false)} The Animation that was created, or `false` if the key is already in use. + * @method Phaser.GameObjects.Shader#initUniforms + * @private + * @since 3.17.0 */ - create: function (config) + initUniforms: function () { - var key = config.key; + var gl = this.gl; + var map = this.renderer.glFuncMap; + var program = this.program; - var anim = false; + this._textureCount = 0; - if (key) + for (var key in this.uniforms) { - anim = this.get(key); + var uniform = this.uniforms[key]; - if (!anim) - { - anim = new Animation(this, key, config); + var type = uniform.type; + var data = map[type]; - this.anims.set(key, anim); + uniform.uniformLocation = gl.getUniformLocation(program, key); - this.emit(Events.ADD_ANIMATION, key, anim); + if (type !== 'sampler2D') + { + uniform.glMatrix = data.matrix; + uniform.glValueLength = data.length; + uniform.glFunc = data.func; } } - - return anim; }, /** - * Loads this Animation Manager's Animations and settings from a JSON object. + * Sets a sampler2D uniform on this shader where the source texture is a WebGLTexture. * - * @method Phaser.Animations.AnimationManager#fromJSON - * @since 3.0.0 + * This allows you to feed the output from one Shader into another: * - * @param {(string|Phaser.Types.Animations.JSONAnimations|Phaser.Types.Animations.JSONAnimation)} data - The JSON object to parse. - * @param {boolean} [clearCurrentAnimations=false] - If set to `true`, the current animations will be removed (`anims.clear()`). If set to `false` (default), the animations in `data` will be added. + * ```javascript + * let shader1 = this.add.shader(baseShader1, 0, 0, 512, 512).setRenderToTexture(); + * let shader2 = this.add.shader(baseShader2, 0, 0, 512, 512).setRenderToTexture('output'); * - * @return {Phaser.Animations.Animation[]} An array containing all of the Animation objects that were created as a result of this call. + * shader1.setSampler2DBuffer('iChannel0', shader2.glTexture, 512, 512); + * shader2.setSampler2DBuffer('iChannel0', shader1.glTexture, 512, 512); + * ``` + * + * In the above code, the result of baseShader1 is fed into Shader2 as the `iChannel0` sampler2D uniform. + * The result of baseShader2 is then fed back into shader1 again, creating a feedback loop. + * + * If you wish to use an image from the Texture Manager as a sampler2D input for this shader, + * see the `Shader.setSampler2D` method. + * + * @method Phaser.GameObjects.Shader#setSampler2DBuffer + * @since 3.19.0 + * + * @param {string} uniformKey - The key of the sampler2D uniform to be updated, i.e. `iChannel0`. + * @param {WebGLTexture} texture - A WebGLTexture reference. + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {number} [textureIndex=0] - The texture index. + * @param {any} [textureData] - Additional texture data. + * + * @return {this} This Shader instance. */ - fromJSON: function (data, clearCurrentAnimations) + setSampler2DBuffer: function (uniformKey, texture, width, height, textureIndex, textureData) { - if (clearCurrentAnimations === undefined) { clearCurrentAnimations = false; } + if (textureIndex === undefined) { textureIndex = 0; } + if (textureData === undefined) { textureData = {}; } - if (clearCurrentAnimations) - { - this.anims.clear(); - } + var uniform = this.uniforms[uniformKey]; - // Do we have a String (i.e. from JSON, or an Object?) - if (typeof data === 'string') - { - data = JSON.parse(data); - } + uniform.value = texture; - var output = []; + textureData.width = width; + textureData.height = height; - // Array of animations, or a single animation? - if (data.hasOwnProperty('anims') && Array.isArray(data.anims)) - { - for (var i = 0; i < data.anims.length; i++) - { - output.push(this.create(data.anims[i])); - } + uniform.textureData = textureData; - if (data.hasOwnProperty('globalTimeScale')) - { - this.globalTimeScale = data.globalTimeScale; - } - } - else if (data.hasOwnProperty('key') && data.type === 'frame') - { - output.push(this.create(data)); - } + this._textureCount = textureIndex; - return output; + this.initSampler2D(uniform); + + return this; }, /** - * Generate an array of {@link Phaser.Types.Animations.AnimationFrame} objects from a texture key and configuration object. - * - * Generates objects with string based frame names, as configured by the given {@link Phaser.Types.Animations.GenerateFrameNames}. - * - * It's a helper method, designed to make it easier for you to extract all of the frame names from texture atlases. - * If you're working with a sprite sheet, see the `generateFrameNumbers` method instead. - * - * Example: - * - * If you have a texture atlases loaded called `gems` and it contains 6 frames called `ruby_0001`, `ruby_0002`, and so on, - * then you can call this method using: `this.anims.generateFrameNames('gems', { prefix: 'ruby_', end: 6, zeroPad: 4 })`. - * - * The `end` value tells it to look for 6 frames, incrementally numbered, all starting with the prefix `ruby_`. The `zeroPad` - * value tells it how many zeroes pad out the numbers. To create an animation using this method, you can do: + * Sets a sampler2D uniform on this shader. * - * ```javascript - * this.anims.create({ - * key: 'ruby', - * repeat: -1, - * frames: this.anims.generateFrameNames('gems', { - * prefix: 'ruby_', - * end: 6, - * zeroPad: 4 - * }) - * }); - * ``` + * The textureKey given is the key from the Texture Manager cache. You cannot use a single frame + * from a texture, only the full image. Also, lots of shaders expect textures to be power-of-two sized. * - * Please see the animation examples for further details. + * If you wish to use another Shader as a sampler2D input for this shader, see the `Shader.setSampler2DBuffer` method. * - * @method Phaser.Animations.AnimationManager#generateFrameNames - * @since 3.0.0 + * @method Phaser.GameObjects.Shader#setSampler2D + * @since 3.17.0 * - * @param {string} key - The key for the texture containing the animation frames. - * @param {Phaser.Types.Animations.GenerateFrameNames} [config] - The configuration object for the animation frame names. + * @param {string} uniformKey - The key of the sampler2D uniform to be updated, i.e. `iChannel0`. + * @param {string} textureKey - The key of the texture, as stored in the Texture Manager. Must already be loaded. + * @param {number} [textureIndex=0] - The texture index. + * @param {any} [textureData] - Additional texture data. * - * @return {Phaser.Types.Animations.AnimationFrame[]} The array of {@link Phaser.Types.Animations.AnimationFrame} objects. + * @return {this} This Shader instance. */ - generateFrameNames: function (key, config) + setSampler2D: function (uniformKey, textureKey, textureIndex, textureData) { - var prefix = GetValue(config, 'prefix', ''); - var start = GetValue(config, 'start', 0); - var end = GetValue(config, 'end', 0); - var suffix = GetValue(config, 'suffix', ''); - var zeroPad = GetValue(config, 'zeroPad', 0); - var out = GetValue(config, 'outputArray', []); - var frames = GetValue(config, 'frames', false); + if (textureIndex === undefined) { textureIndex = 0; } - var texture = this.textureManager.get(key); + var textureManager = this.scene.sys.textures; - if (!texture) + if (textureManager.exists(textureKey)) { - return out; - } + var frame = textureManager.getFrame(textureKey); - var i; + if (frame.glTexture && frame.glTexture.isRenderTexture) + { + return this.setSampler2DBuffer(uniformKey, frame.glTexture, frame.width, frame.height, textureIndex, textureData); + } - if (!config) - { - // Use every frame in the atlas - frames = texture.getFrameNames(); + var uniform = this.uniforms[uniformKey]; + var source = frame.source; - for (i = 0; i < frames.length; i++) + uniform.textureKey = textureKey; + uniform.source = source.image; + uniform.value = frame.glTexture; + + if (source.isGLTexture) { - out.push({ key: key, frame: frames[i] }); + if (!textureData) + { + textureData = {}; + } + + textureData.width = source.width; + textureData.height = source.height; } - } - else - { - if (!frames) + + if (textureData) { - frames = NumberArray(start, end); + uniform.textureData = textureData; } - for (i = 0; i < frames.length; i++) - { - var frame = prefix + Pad(frames[i], zeroPad, '0', 1) + suffix; + this._textureCount = textureIndex; - if (texture.has(frame)) - { - out.push({ key: key, frame: frame }); - } - else - { - console.warn('generateFrameNames: Frame missing: ' + frame + ' from texture: ' + key); - } - } + this.initSampler2D(uniform); } - return out; + return this; }, /** - * Generate an array of {@link Phaser.Types.Animations.AnimationFrame} objects from a texture key and configuration object. - * - * Generates objects with numbered frame names, as configured by the given {@link Phaser.Types.Animations.GenerateFrameNumbers}. - * - * If you're working with a texture atlas, see the `generateFrameNames` method instead. - * - * It's a helper method, designed to make it easier for you to extract frames from sprite sheets. - * If you're working with a texture atlas, see the `generateFrameNames` method instead. - * - * Example: - * - * If you have a sprite sheet loaded called `explosion` and it contains 12 frames, then you can call this method using: - * - * `this.anims.generateFrameNumbers('explosion', { start: 0, end: 11 })`. - * - * The `end` value of 11 tells it to stop after the 12th frame has been added, because it started at zero. + * Sets a property of a uniform already present on this shader. * - * To create an animation using this method, you can do: + * To modify the value of a uniform such as a 1f or 1i use the `value` property directly: * * ```javascript - * this.anims.create({ - * key: 'boom', - * frames: this.anims.generateFrameNames('explosion', { - * start: 0, - * end: 11 - * }) - * }); + * shader.setUniform('size.value', 16); * ``` * - * Note that `start` is optional and you don't need to include it if the animation starts from frame 0. - * - * To specify an animation in reverse, swap the `start` and `end` values. - * - * If the frames are not sequential, you may pass an array of frame numbers instead, for example: + * You can use dot notation to access deeper values, for example: * - * `this.anims.generateFrameNumbers('explosion', { frames: [ 0, 1, 2, 1, 2, 3, 4, 0, 1, 2 ] })` + * ```javascript + * shader.setUniform('resolution.value.x', 512); + * ``` * - * Please see the animation examples and `GenerateFrameNumbers` config docs for further details. + * The change to the uniform will take effect the next time the shader is rendered. * - * @method Phaser.Animations.AnimationManager#generateFrameNumbers - * @since 3.0.0 + * @method Phaser.GameObjects.Shader#setUniform + * @since 3.17.0 * - * @param {string} key - The key for the texture containing the animation frames. - * @param {Phaser.Types.Animations.GenerateFrameNumbers} config - The configuration object for the animation frames. + * @param {string} key - The key of the uniform to modify. Use dots for deep properties, i.e. `resolution.value.x`. + * @param {any} value - The value to set into the uniform. * - * @return {Phaser.Types.Animations.AnimationFrame[]} The array of {@link Phaser.Types.Animations.AnimationFrame} objects. + * @return {this} This Shader instance. */ - generateFrameNumbers: function (key, config) + setUniform: function (key, value) { - var start = GetValue(config, 'start', 0); - var end = GetValue(config, 'end', -1); - var first = GetValue(config, 'first', false); - var out = GetValue(config, 'outputArray', []); - var frames = GetValue(config, 'frames', false); - - var texture = this.textureManager.get(key); - - if (!texture) - { - return out; - } - - if (first && texture.has(first)) - { - out.push({ key: key, frame: first }); - } - - // No 'frames' array? Then generate one automatically - if (!frames) - { - if (end === -1) - { - // -1 because of __BASE, which we don't want in our results - // and -1 because frames are zero based - end = texture.frameTotal - 2; - } - - frames = NumberArray(start, end); - } - - for (var i = 0; i < frames.length; i++) - { - if (texture.has(frames[i])) - { - out.push({ key: key, frame: frames[i] }); - } - else - { - console.warn('generateFrameNumbers: Frame ' + i + ' missing from texture: ' + key); - } - } + SetValue(this.uniforms, key, value); - return out; + return this; }, /** - * Get an Animation. + * Returns the uniform object for the given key, or `null` if the uniform couldn't be found. * - * @method Phaser.Animations.AnimationManager#get - * @since 3.0.0 + * @method Phaser.GameObjects.Shader#getUniform + * @since 3.17.0 * - * @param {string} key - The key of the Animation to retrieve. + * @param {string} key - The key of the uniform to return the value for. * - * @return {Phaser.Animations.Animation} The Animation. + * @return {any} A reference to the uniform object. This is not a copy, so modifying it will update the original object also. */ - get: function (key) + getUniform: function (key) { - return this.anims.get(key); + return GetFastValue(this.uniforms, key, null); }, /** - * Pause all animations. + * A short-cut method that will directly set the texture being used by the `iChannel0` sampler2D uniform. * - * @method Phaser.Animations.AnimationManager#pauseAll - * @fires Phaser.Animations.Events#PAUSE_ALL - * @since 3.0.0 + * The textureKey given is the key from the Texture Manager cache. You cannot use a single frame + * from a texture, only the full image. Also, lots of shaders expect textures to be power-of-two sized. * - * @return {this} This Animation Manager. + * @method Phaser.GameObjects.Shader#setChannel0 + * @since 3.17.0 + * + * @param {string} textureKey - The key of the texture, as stored in the Texture Manager. Must already be loaded. + * @param {any} [textureData] - Additional texture data. + * + * @return {this} This Shader instance. */ - pauseAll: function () + setChannel0: function (textureKey, textureData) { - if (!this.paused) - { - this.paused = true; - - this.emit(Events.PAUSE_ALL); - } - - return this; + return this.setSampler2D('iChannel0', textureKey, 0, textureData); }, /** - * Play an animation on the given Game Objects that have an Animation Component. + * A short-cut method that will directly set the texture being used by the `iChannel1` sampler2D uniform. * - * @method Phaser.Animations.AnimationManager#play - * @since 3.0.0 + * The textureKey given is the key from the Texture Manager cache. You cannot use a single frame + * from a texture, only the full image. Also, lots of shaders expect textures to be power-of-two sized. * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} children - An array of Game Objects to play the animation on. They must have an Animation Component. + * @method Phaser.GameObjects.Shader#setChannel1 + * @since 3.17.0 * - * @return {this} This Animation Manager. + * @param {string} textureKey - The key of the texture, as stored in the Texture Manager. Must already be loaded. + * @param {any} [textureData] - Additional texture data. + * + * @return {this} This Shader instance. */ - play: function (key, children) + setChannel1: function (textureKey, textureData) { - if (!Array.isArray(children)) - { - children = [ children ]; - } - - for (var i = 0; i < children.length; i++) - { - children[i].anims.play(key); - } - - return this; + return this.setSampler2D('iChannel1', textureKey, 1, textureData); }, /** - * Takes an array of Game Objects that have an Animation Component and then - * starts the given animation playing on them. The start time of each Game Object - * is offset, incrementally, by the `stagger` amount. + * A short-cut method that will directly set the texture being used by the `iChannel2` sampler2D uniform. * - * For example, if you pass an array with 4 children and a stagger time of 1000, - * the delays will be: + * The textureKey given is the key from the Texture Manager cache. You cannot use a single frame + * from a texture, only the full image. Also, lots of shaders expect textures to be power-of-two sized. * - * child 1: 1000ms delay - * child 2: 2000ms delay - * child 3: 3000ms delay - * child 4: 4000ms delay + * @method Phaser.GameObjects.Shader#setChannel2 + * @since 3.17.0 * - * If you set the `staggerFirst` parameter to `false` they would be: + * @param {string} textureKey - The key of the texture, as stored in the Texture Manager. Must already be loaded. + * @param {any} [textureData] - Additional texture data. * - * child 1: 0ms delay - * child 2: 1000ms delay - * child 3: 2000ms delay - * child 4: 3000ms delay + * @return {this} This Shader instance. + */ + setChannel2: function (textureKey, textureData) + { + return this.setSampler2D('iChannel2', textureKey, 2, textureData); + }, + + /** + * A short-cut method that will directly set the texture being used by the `iChannel3` sampler2D uniform. * - * You can also set `stagger` to be a negative value. If it was -1000, the above would be: + * The textureKey given is the key from the Texture Manager cache. You cannot use a single frame + * from a texture, only the full image. Also, lots of shaders expect textures to be power-of-two sized. * - * child 1: 3000ms delay - * child 2: 2000ms delay - * child 3: 1000ms delay - * child 4: 0ms delay + * @method Phaser.GameObjects.Shader#setChannel3 + * @since 3.17.0 * - * @method Phaser.Animations.AnimationManager#staggerPlay - * @since 3.0.0 + * @param {string} textureKey - The key of the texture, as stored in the Texture Manager. Must already be loaded. + * @param {any} [textureData] - Additional texture data. * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * @return {this} This Shader instance. + */ + setChannel3: function (textureKey, textureData) + { + return this.setSampler2D('iChannel3', textureKey, 3, textureData); + }, + + /** + * Internal method that takes a sampler2D uniform and prepares it for use by setting the + * gl texture parameters. * - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} children - An array of Game Objects to play the animation on. They must have an Animation Component. - * @param {number} stagger - The amount of time, in milliseconds, to offset each play time by. If a negative value is given, it's applied to the children in reverse order. - * @param {boolean} [staggerFirst=true] -Should the first child be staggered as well? + * @method Phaser.GameObjects.Shader#initSampler2D + * @private + * @since 3.17.0 * - * @return {this} This Animation Manager. + * @param {any} uniform - The sampler2D uniform to process. */ - staggerPlay: function (key, children, stagger, staggerFirst) + initSampler2D: function (uniform) { - if (stagger === undefined) { stagger = 0; } - if (staggerFirst === undefined) { staggerFirst = true; } - - if (!Array.isArray(children)) + if (!uniform.value) { - children = [ children ]; + return; } - var len = children.length; + var gl = this.gl; - if (!staggerFirst) - { - len--; - } + gl.activeTexture(gl.TEXTURE0 + this._textureCount); + gl.bindTexture(gl.TEXTURE_2D, uniform.value); - for (var i = 0; i < children.length; i++) + // Extended texture data + + var data = uniform.textureData; + + if (data && !uniform.value.isRenderTexture) { - var time = (stagger < 0) ? Math.abs(stagger) * (len - i) : stagger * i; + // https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D - children[i].anims.playAfterDelay(key, time); - } + // mag / minFilter can be: gl.LINEAR, gl.LINEAR_MIPMAP_LINEAR or gl.NEAREST + // wrapS/T can be: gl.CLAMP_TO_EDGE or gl.REPEAT + // format can be: gl.LUMINANCE or gl.RGBA - return this; - }, + var magFilter = gl[GetFastValue(data, 'magFilter', 'linear').toUpperCase()]; + var minFilter = gl[GetFastValue(data, 'minFilter', 'linear').toUpperCase()]; + var wrapS = gl[GetFastValue(data, 'wrapS', 'repeat').toUpperCase()]; + var wrapT = gl[GetFastValue(data, 'wrapT', 'repeat').toUpperCase()]; + var format = gl[GetFastValue(data, 'format', 'rgba').toUpperCase()]; - /** - * Removes an Animation from this Animation Manager, based on the given key. - * - * This is a global action. Once an Animation has been removed, no Game Objects - * can carry on using it. - * - * @method Phaser.Animations.AnimationManager#remove - * @fires Phaser.Animations.Events#REMOVE_ANIMATION - * @since 3.0.0 - * - * @param {string} key - The key of the animation to remove. + if (data.repeat) + { + wrapS = gl.REPEAT; + wrapT = gl.REPEAT; + } + + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, !!data.flipY); + + if (data.width) + { + var width = GetFastValue(data, 'width', 512); + var height = GetFastValue(data, 'height', 2); + var border = GetFastValue(data, 'border', 0); + + // texImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, ArrayBufferView? pixels) + gl.texImage2D(gl.TEXTURE_2D, 0, format, width, height, border, format, gl.UNSIGNED_BYTE, null); + } + else + { + // texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, ImageData? pixels) + gl.texImage2D(gl.TEXTURE_2D, 0, format, gl.RGBA, gl.UNSIGNED_BYTE, uniform.source); + } + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapS); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrapT); + } + + this.renderer.setProgram(this.program); + + gl.uniform1i(uniform.uniformLocation, this._textureCount); + + this._textureCount++; + }, + + /** + * Synchronizes all of the uniforms this shader uses. + * Each uniforms gl function is called in turn. * - * @return {Phaser.Animations.Animation} The Animation instance that was removed from the Animation Manager. + * @method Phaser.GameObjects.Shader#syncUniforms + * @private + * @since 3.17.0 */ - remove: function (key) + syncUniforms: function () { - var anim = this.get(key); + var gl = this.gl; - if (anim) + var uniforms = this.uniforms; + var uniform; + var length; + var glFunc; + var location; + var value; + var textureCount = 0; + + for (var key in uniforms) { - this.emit(Events.REMOVE_ANIMATION, key, anim); + uniform = uniforms[key]; - this.anims.delete(key); + glFunc = uniform.glFunc; + length = uniform.glValueLength; + location = uniform.uniformLocation; + value = uniform.value; - this.removeMix(key); - } + if (value === null) + { + continue; + } - return anim; + if (length === 1) + { + if (uniform.glMatrix) + { + glFunc.call(gl, location, uniform.transpose, value); + } + else + { + glFunc.call(gl, location, value); + } + } + else if (length === 2) + { + glFunc.call(gl, location, value.x, value.y); + } + else if (length === 3) + { + glFunc.call(gl, location, value.x, value.y, value.z); + } + else if (length === 4) + { + glFunc.call(gl, location, value.x, value.y, value.z, value.w); + } + else if (uniform.type === 'sampler2D') + { + gl.activeTexture(gl.TEXTURE0 + textureCount); + + gl.bindTexture(gl.TEXTURE_2D, value); + + gl.uniform1i(location, textureCount); + + textureCount++; + } + } }, /** - * Resume all paused animations. + * Called automatically during render. * - * @method Phaser.Animations.AnimationManager#resumeAll - * @fires Phaser.Animations.Events#RESUME_ALL - * @since 3.0.0 + * This method performs matrix ITRS and then stores the resulting value in the `uViewMatrix` uniform. + * It then sets up the vertex buffer and shader, updates and syncs the uniforms ready + * for flush to be called. * - * @return {this} This Animation Manager. + * @method Phaser.GameObjects.Shader#load + * @since 3.17.0 + * + * @param {Phaser.GameObjects.Components.TransformMatrix} [matrix2D] - The transform matrix to use during rendering. */ - resumeAll: function () + load: function (matrix2D) { - if (this.paused) + // ITRS + + var gl = this.gl; + var width = this.width; + var height = this.height; + var renderer = this.renderer; + var program = this.program; + var vm = this.viewMatrix; + + if (!this.renderToTexture) { - this.paused = false; + var x = -this._displayOriginX; + var y = -this._displayOriginY; - this.emit(Events.RESUME_ALL); + vm[0] = matrix2D[0]; + vm[1] = matrix2D[1]; + vm[4] = matrix2D[2]; + vm[5] = matrix2D[3]; + vm[8] = matrix2D[4]; + vm[9] = matrix2D[5]; + vm[12] = vm[0] * x + vm[4] * y; + vm[13] = vm[1] * x + vm[5] * y; } - return this; + // Update vertex shader uniforms + + gl.useProgram(program); + + gl.uniformMatrix4fv(gl.getUniformLocation(program, 'uViewMatrix'), false, vm); + gl.uniform2f(gl.getUniformLocation(program, 'uResolution'), this.width, this.height); + + // Update fragment shader uniforms + + var uniforms = this.uniforms; + var res = uniforms.resolution; + + res.value.x = width; + res.value.y = height; + + uniforms.time.value = renderer.game.loop.getDuration(); + + var pointer = this.pointer; + + if (pointer) + { + var mouse = uniforms.mouse; + + var px = pointer.x / width; + var py = 1 - pointer.y / height; + + mouse.value.x = px.toFixed(2); + mouse.value.y = py.toFixed(2); + } + + this.syncUniforms(); }, /** - * Returns the Animation data as JavaScript object based on the given key. - * Or, if not key is defined, it will return the data of all animations as array of objects. - * - * @method Phaser.Animations.AnimationManager#toJSON - * @since 3.0.0 + * Called automatically during render. * - * @param {string} [key] - The animation to get the JSONAnimation data from. If not provided, all animations are returned as an array. + * Sets the active shader, loads the vertex buffer and then draws. * - * @return {Phaser.Types.Animations.JSONAnimations} The resulting JSONAnimations formatted object. + * @method Phaser.GameObjects.Shader#flush + * @since 3.17.0 */ - toJSON: function (key) + flush: function () { - var output = { - anims: [], - globalTimeScale: this.globalTimeScale - }; + // Bind - if (key !== undefined && key !== '') + var width = this.width; + var height = this.height; + var program = this.program; + + var gl = this.gl; + var vertexBuffer = this.vertexBuffer; + var renderer = this.renderer; + var vertexSize = Float32Array.BYTES_PER_ELEMENT * 2; + + if (this.renderToTexture) { - output.anims.push(this.anims.get(key).toJSON()); + renderer.setFramebuffer(this.framebuffer); + + gl.clearColor(0, 0, 0, 0); + + gl.clear(gl.COLOR_BUFFER_BIT); } - else + + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); + + var location = gl.getAttribLocation(program, 'inPosition'); + + if (location !== -1) { - this.anims.each(function (animationKey, animation) - { - output.anims.push(animation.toJSON()); - }); + gl.enableVertexAttribArray(location); + + gl.vertexAttribPointer(location, 2, gl.FLOAT, false, vertexSize, 0); } - return output; + // Draw + + var vf = this.vertexViewF32; + + vf[3] = height; + vf[4] = width; + vf[5] = height; + vf[8] = width; + vf[9] = height; + vf[10] = width; + + // Flush + + var vertexCount = 6; + + gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); + + gl.drawArrays(gl.TRIANGLES, 0, vertexCount); + + if (this.renderToTexture) + { + renderer.setFramebuffer(null, false); + } }, /** - * Destroy this Animation Manager and clean up animation definitions and references to other objects. - * This method should not be called directly. It will be called automatically as a response to a `destroy` event from the Phaser.Game instance. + * A NOOP method so you can pass a Shader to a Container. + * Calling this method will do nothing. It is intentionally empty. * - * @method Phaser.Animations.AnimationManager#destroy - * @since 3.0.0 + * @method Phaser.GameObjects.Shader#setAlpha + * @private + * @since 3.17.0 */ - destroy: function () + setAlpha: function () { - this.anims.clear(); - this.mixes.clear(); + }, - this.textureManager = null; + /** + * A NOOP method so you can pass a Shader to a Container. + * Calling this method will do nothing. It is intentionally empty. + * + * @method Phaser.GameObjects.Shader#setBlendMode + * @private + * @since 3.17.0 + */ + setBlendMode: function () + { + }, - this.game = null; + /** + * Internal destroy handler, called as part of the destroy process. + * + * @method Phaser.GameObjects.Shader#preDestroy + * @protected + * @since 3.17.0 + */ + preDestroy: function () + { + var gl = this.gl; + + gl.deleteProgram(this.program); + gl.deleteBuffer(this.vertexBuffer); + + if (this.renderToTexture) + { + this.renderer.deleteFramebuffer(this.framebuffer); + + this.texture.destroy(); + + this.framebuffer = null; + this.glTexture = null; + this.texture = null; + } } }); -module.exports = AnimationManager; +module.exports = Shader; /***/ }), -/* 322 */ -/***/ (function(module, exports) { + +/***/ 10612: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Create an array representing the range of numbers (usually integers), between, and inclusive of, - * the given `start` and `end` arguments. For example: - * - * `var array = Phaser.Utils.Array.NumberArray(2, 4); // array = [2, 3, 4]` - * `var array = Phaser.Utils.Array.NumberArray(0, 9); // array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]` - * `var array = Phaser.Utils.Array.NumberArray(8, 2); // array = [8, 7, 6, 5, 4, 3, 2]` + * This is a stub function for Shader.Render. There is no Canvas renderer for Shader objects. * - * This is equivalent to `Phaser.Utils.Array.NumberArrayStep(start, end, 1)`. + * @method Phaser.GameObjects.Shader#renderCanvas + * @since 3.17.0 + * @private * - * You can optionally provide a prefix and / or suffix string. If given the array will contain - * strings, not integers. For example: + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Shader} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + */ +var ShaderCanvasRenderer = function () +{ +}; + +module.exports = ShaderCanvasRenderer; + + +/***/ }), + +/***/ 13908: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var Shader = __webpack_require__(27902); + +/** + * Creates a new Shader Game Object and returns it. * - * `var array = Phaser.Utils.Array.NumberArray(1, 4, 'Level '); // array = ["Level 1", "Level 2", "Level 3", "Level 4"]` - * `var array = Phaser.Utils.Array.NumberArray(5, 7, 'HD-', '.png'); // array = ["HD-5.png", "HD-6.png", "HD-7.png"]` + * Note: This method will only be available if the Shader Game Object and WebGL support have been built into Phaser. * - * @function Phaser.Utils.Array.NumberArray - * @since 3.0.0 + * @method Phaser.GameObjects.GameObjectCreator#shader + * @since 3.17.0 * - * @param {number} start - The minimum value the array starts with. - * @param {number} end - The maximum value the array contains. - * @param {string} [prefix] - Optional prefix to place before the number. If provided the array will contain strings, not integers. - * @param {string} [suffix] - Optional suffix to place after the number. If provided the array will contain strings, not integers. + * @param {Phaser.Types.GameObjects.Shader.ShaderConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * - * @return {(number[]|string[])} The array of number values, or strings if a prefix or suffix was provided. + * @return {Phaser.GameObjects.Shader} The Game Object that was created. */ -var NumberArray = function (start, end, prefix, suffix) +GameObjectCreator.register('shader', function (config, addToScene) { - var result = []; + if (config === undefined) { config = {}; } - var i; - var asString = false; + var key = GetAdvancedValue(config, 'key', null); + var x = GetAdvancedValue(config, 'x', 0); + var y = GetAdvancedValue(config, 'y', 0); + var width = GetAdvancedValue(config, 'width', 128); + var height = GetAdvancedValue(config, 'height', 128); - if (prefix || suffix) + var shader = new Shader(this.scene, key, x, y, width, height); + + if (addToScene !== undefined) { - asString = true; + config.add = addToScene; + } - if (!prefix) - { - prefix = ''; - } + BuildGameObject(this.scene, shader, config); - if (!suffix) - { - suffix = ''; - } + return shader; +}); + +// When registering a factory function 'this' refers to the GameObjectCreator context. + + +/***/ }), + +/***/ 51979: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Shader = __webpack_require__(27902); +var GameObjectFactory = __webpack_require__(61286); + +/** + * Creates a new Shader Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Shader Game Object and WebGL support have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#shader + * @webglOnly + * @since 3.17.0 + * + * @param {(string|Phaser.Display.BaseShader)} key - The key of the shader to use from the shader cache, or a BaseShader instance. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [width=128] - The width of the Game Object. + * @param {number} [height=128] - The height of the Game Object. + * @param {string[]} [textures] - Optional array of texture keys to bind to the iChannel0...3 uniforms. The textures must already exist in the Texture Manager. + * @param {object} [textureData] - Optional additional texture data. + * + * @return {Phaser.GameObjects.Shader} The Game Object that was created. + */ +if (true) +{ + GameObjectFactory.register('shader', function (key, x, y, width, height, textures, textureData) + { + return this.displayList.add(new Shader(this.scene, key, x, y, width, height, textures, textureData)); + }); +} + + +/***/ }), + +/***/ 24252: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(19782); +} + +if (true) +{ + renderCanvas = __webpack_require__(10612); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), + +/***/ 19782: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetCalcMatrix = __webpack_require__(73329); + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Shader#renderWebGL + * @since 3.17.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Shader} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var ShaderWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + if (!src.shader) + { + return; } - if (end < start) + camera.addToRenderList(src); + + renderer.pipelines.clear(); + + if (src.renderToTexture) { - for (i = start; i >= end; i--) - { - if (asString) - { - result.push(prefix + i.toString() + suffix); - } - else - { - result.push(i); - } - } + src.load(); + src.flush(); } else { - for (i = start; i <= end; i++) + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + + // Renderer size changed? + if (renderer.width !== src._rendererWidth || renderer.height !== src._rendererHeight) { - if (asString) - { - result.push(prefix + i.toString() + suffix); - } - else - { - result.push(i); - } + src.projOrtho(0, renderer.width, renderer.height, 0); } + + src.load(calcMatrix.matrix); + src.flush(); } - return result; + renderer.pipelines.rebind(); }; -module.exports = NumberArray; +module.exports = ShaderWebGLRenderer; /***/ }), -/* 323 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 19543: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var CustomMap = __webpack_require__(102); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(324); +var Utils = __webpack_require__(75512); /** - * @classdesc - * The BaseCache is a base Cache class that can be used for storing references to any kind of data. - * - * Data can be added, retrieved and removed based on the given keys. + * Renders a filled path for the given Shape. * - * Keys are string-based. + * @method Phaser.GameObjects.Shape#FillPathWebGL + * @since 3.13.0 + * @private * - * @class BaseCache - * @memberof Phaser.Cache - * @constructor - * @since 3.0.0 + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The WebGL Pipeline used to render this Shape. + * @param {Phaser.GameObjects.Components.TransformMatrix} calcMatrix - The transform matrix used to get the position values. + * @param {Phaser.GameObjects.Shape} src - The Game Object shape being rendered in this call. + * @param {number} alpha - The base alpha value. + * @param {number} dx - The source displayOriginX. + * @param {number} dy - The source displayOriginY. */ -var BaseCache = new Class({ - - initialize: - - function BaseCache () - { - /** - * The Map in which the cache objects are stored. - * - * You can query the Map directly or use the BaseCache methods. - * - * @name Phaser.Cache.BaseCache#entries - * @type {Phaser.Structs.Map.} - * @since 3.0.0 - */ - this.entries = new CustomMap(); +var FillPathWebGL = function (pipeline, calcMatrix, src, alpha, dx, dy) +{ + var fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); - /** - * An instance of EventEmitter used by the cache to emit related events. - * - * @name Phaser.Cache.BaseCache#events - * @type {Phaser.Events.EventEmitter} - * @since 3.0.0 - */ - this.events = new EventEmitter(); - }, + var path = src.pathData; + var pathIndexes = src.pathIndexes; - /** - * Adds an item to this cache. The item is referenced by a unique string, which you are responsible - * for setting and keeping track of. The item can only be retrieved by using this string. - * - * @method Phaser.Cache.BaseCache#add - * @fires Phaser.Cache.Events#ADD - * @since 3.0.0 - * - * @param {string} key - The unique key by which the data added to the cache will be referenced. - * @param {*} data - The data to be stored in the cache. - * - * @return {this} This BaseCache object. - */ - add: function (key, data) + for (var i = 0; i < pathIndexes.length; i += 3) { - this.entries.set(key, data); + var p0 = pathIndexes[i] * 2; + var p1 = pathIndexes[i + 1] * 2; + var p2 = pathIndexes[i + 2] * 2; - this.events.emit(Events.ADD, this, key, data); + var x0 = path[p0 + 0] - dx; + var y0 = path[p0 + 1] - dy; + var x1 = path[p1 + 0] - dx; + var y1 = path[p1 + 1] - dy; + var x2 = path[p2 + 0] - dx; + var y2 = path[p2 + 1] - dy; - return this; - }, + var tx0 = calcMatrix.getX(x0, y0); + var ty0 = calcMatrix.getY(x0, y0); - /** - * Checks if this cache contains an item matching the given key. - * This performs the same action as `BaseCache.exists`. - * - * @method Phaser.Cache.BaseCache#has - * @since 3.0.0 - * - * @param {string} key - The unique key of the item to be checked in this cache. - * - * @return {boolean} Returns `true` if the cache contains an item matching the given key, otherwise `false`. - */ - has: function (key) - { - return this.entries.has(key); - }, + var tx1 = calcMatrix.getX(x1, y1); + var ty1 = calcMatrix.getY(x1, y1); - /** - * Checks if this cache contains an item matching the given key. - * This performs the same action as `BaseCache.has` and is called directly by the Loader. - * - * @method Phaser.Cache.BaseCache#exists - * @since 3.7.0 - * - * @param {string} key - The unique key of the item to be checked in this cache. - * - * @return {boolean} Returns `true` if the cache contains an item matching the given key, otherwise `false`. - */ - exists: function (key) - { - return this.entries.has(key); - }, + var tx2 = calcMatrix.getX(x2, y2); + var ty2 = calcMatrix.getY(x2, y2); - /** - * Gets an item from this cache based on the given key. - * - * @method Phaser.Cache.BaseCache#get - * @since 3.0.0 - * - * @param {string} key - The unique key of the item to be retrieved from this cache. - * - * @return {*} The item in the cache, or `null` if no item matching the given key was found. - */ - get: function (key) - { - return this.entries.get(key); - }, + pipeline.batchTri(src, tx0, ty0, tx1, ty1, tx2, ty2, 0, 0, 1, 1, fillTintColor, fillTintColor, fillTintColor, 2); + } +}; - /** - * Removes and item from this cache based on the given key. - * - * If an entry matching the key is found it is removed from the cache and a `remove` event emitted. - * No additional checks are done on the item removed. If other systems or parts of your game code - * are relying on this item, it is up to you to sever those relationships prior to removing the item. - * - * @method Phaser.Cache.BaseCache#remove - * @fires Phaser.Cache.Events#REMOVE - * @since 3.0.0 - * - * @param {string} key - The unique key of the item to remove from the cache. - * - * @return {this} This BaseCache object. - */ - remove: function (key) - { - var entry = this.get(key); +module.exports = FillPathWebGL; - if (entry) - { - this.entries.delete(key); - this.events.emit(Events.REMOVE, this, key, entry.data); - } +/***/ }), - return this; - }, +/***/ 15608: +/***/ ((module) => { - /** - * Returns all keys in use in this cache. - * - * @method Phaser.Cache.BaseCache#getKeys - * @since 3.17.0 - * - * @return {string[]} Array containing all the keys. - */ - getKeys: function () - { - return this.entries.keys(); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Destroys this cache and all items within it. - * - * @method Phaser.Cache.BaseCache#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.entries.clear(); - this.events.removeAllListeners(); +/** + * Sets the fillStyle on the target context based on the given Shape. + * + * @method Phaser.GameObjects.Shape#FillStyleCanvas + * @since 3.13.0 + * @private + * + * @param {CanvasRenderingContext2D} ctx - The context to set the fill style on. + * @param {Phaser.GameObjects.Shape} src - The Game Object to set the fill style from. + * @param {number} [altColor] - An alternative color to render with. + * @param {number} [altAlpha] - An alternative alpha to render with. + */ +var FillStyleCanvas = function (ctx, src, altColor, altAlpha) +{ + var fillColor = (altColor) ? altColor : src.fillColor; + var fillAlpha = (altAlpha) ? altAlpha : src.fillAlpha; - this.entries = null; - this.events = null; - } + var red = ((fillColor & 0xFF0000) >>> 16); + var green = ((fillColor & 0xFF00) >>> 8); + var blue = (fillColor & 0xFF); -}); + ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')'; +}; -module.exports = BaseCache; +module.exports = FillStyleCanvas; /***/ }), -/* 324 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 17876: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @namespace Phaser.Cache.Events + * Sets the strokeStyle and lineWidth on the target context based on the given Shape. + * + * @method Phaser.GameObjects.Shape#LineStyleCanvas + * @since 3.13.0 + * @private + * + * @param {CanvasRenderingContext2D} ctx - The context to set the stroke style on. + * @param {Phaser.GameObjects.Shape} src - The Game Object to set the stroke style from. + * @param {number} [altColor] - An alternative color to render with. + * @param {number} [altAlpha] - An alternative alpha to render with. */ +var LineStyleCanvas = function (ctx, src, altColor, altAlpha) +{ + var strokeColor = (altColor) ? altColor : src.strokeColor; + var strokeAlpha = (altAlpha) ? altAlpha : src.strokeAlpha; -module.exports = { - - ADD: __webpack_require__(736), - REMOVE: __webpack_require__(737) + var red = ((strokeColor & 0xFF0000) >>> 16); + var green = ((strokeColor & 0xFF00) >>> 8); + var blue = (strokeColor & 0xFF); + ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + strokeAlpha + ')'; + ctx.lineWidth = src.lineWidth; }; +module.exports = LineStyleCanvas; + /***/ }), -/* 325 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 91461: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseCache = __webpack_require__(323); -var Class = __webpack_require__(0); -var GameEvents = __webpack_require__(22); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var Line = __webpack_require__(88829); /** * @classdesc - * The Cache Manager is the global cache owned and maintained by the Game instance. - * - * Various systems, such as the file Loader, rely on this cache in order to store the files - * it has loaded. The manager itself doesn't store any files, but instead owns multiple BaseCache - * instances, one per type of file. You can also add your own custom caches. + * The Shape Game Object is a base class for the various different shapes, such as the Arc, Star or Polygon. + * You cannot add a Shape directly to your Scene, it is meant as a base for your own custom Shape classes. * - * @class CacheManager - * @memberof Phaser.Cache + * @class Shape + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects * @constructor - * @since 3.0.0 + * @since 3.13.0 * - * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this CacheManager. + * @extends Phaser.GameObjects.Components.AlphaSingle + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {string} [type] - The internal type of the Shape. + * @param {any} [data] - The data of the source shape geometry, if any. */ -var CacheManager = new Class({ +var Shape = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.AlphaSingle, + Components.BlendMode, + Components.Depth, + Components.GetBounds, + Components.Mask, + Components.Origin, + Components.Pipeline, + Components.PostPipeline, + Components.ScrollFactor, + Components.Transform, + Components.Visible + ], initialize: - function CacheManager (game) + function Shape (scene, type, data) { + if (type === undefined) { type = 'Shape'; } + + GameObject.call(this, scene, type); + /** - * A reference to the Phaser.Game instance that owns this CacheManager. + * The source Shape data. Typically a geometry object. + * You should not manipulate this directly. * - * @name Phaser.Cache.CacheManager#game - * @type {Phaser.Game} - * @protected - * @since 3.0.0 + * @name Phaser.GameObjects.Shape#geom + * @type {any} + * @readonly + * @since 3.13.0 */ - this.game = game; + this.geom = data; /** - * A Cache storing all binary files, typically added via the Loader. + * Holds the polygon path data for filled rendering. * - * @name Phaser.Cache.CacheManager#binary - * @type {Phaser.Cache.BaseCache} - * @since 3.0.0 + * @name Phaser.GameObjects.Shape#pathData + * @type {number[]} + * @readonly + * @since 3.13.0 */ - this.binary = new BaseCache(); + this.pathData = []; /** - * A Cache storing all bitmap font data files, typically added via the Loader. - * Only the font data is stored in this cache, the textures are part of the Texture Manager. + * Holds the earcut polygon path index data for filled rendering. * - * @name Phaser.Cache.CacheManager#bitmapFont - * @type {Phaser.Cache.BaseCache} - * @since 3.0.0 + * @name Phaser.GameObjects.Shape#pathIndexes + * @type {number[]} + * @readonly + * @since 3.13.0 */ - this.bitmapFont = new BaseCache(); + this.pathIndexes = []; /** - * A Cache storing all JSON data files, typically added via the Loader. + * The fill color used by this Shape. * - * @name Phaser.Cache.CacheManager#json - * @type {Phaser.Cache.BaseCache} - * @since 3.0.0 + * @name Phaser.GameObjects.Shape#fillColor + * @type {number} + * @since 3.13.0 */ - this.json = new BaseCache(); + this.fillColor = 0xffffff; /** - * A Cache storing all physics data files, typically added via the Loader. + * The fill alpha value used by this Shape. * - * @name Phaser.Cache.CacheManager#physics - * @type {Phaser.Cache.BaseCache} - * @since 3.0.0 + * @name Phaser.GameObjects.Shape#fillAlpha + * @type {number} + * @since 3.13.0 */ - this.physics = new BaseCache(); + this.fillAlpha = 1; /** - * A Cache storing all shader source files, typically added via the Loader. + * The stroke color used by this Shape. * - * @name Phaser.Cache.CacheManager#shader - * @type {Phaser.Cache.BaseCache} - * @since 3.0.0 + * @name Phaser.GameObjects.Shape#strokeColor + * @type {number} + * @since 3.13.0 */ - this.shader = new BaseCache(); + this.strokeColor = 0xffffff; /** - * A Cache storing all non-streaming audio files, typically added via the Loader. + * The stroke alpha value used by this Shape. * - * @name Phaser.Cache.CacheManager#audio - * @type {Phaser.Cache.BaseCache} - * @since 3.0.0 + * @name Phaser.GameObjects.Shape#strokeAlpha + * @type {number} + * @since 3.13.0 */ - this.audio = new BaseCache(); + this.strokeAlpha = 1; /** - * A Cache storing all non-streaming video files, typically added via the Loader. + * The stroke line width used by this Shape. * - * @name Phaser.Cache.CacheManager#video - * @type {Phaser.Cache.BaseCache} - * @since 3.20.0 + * @name Phaser.GameObjects.Shape#lineWidth + * @type {number} + * @since 3.13.0 */ - this.video = new BaseCache(); + this.lineWidth = 1; /** - * A Cache storing all text files, typically added via the Loader. + * Controls if this Shape is filled or not. + * Note that some Shapes do not support being filled (such as Line shapes) * - * @name Phaser.Cache.CacheManager#text - * @type {Phaser.Cache.BaseCache} - * @since 3.0.0 + * @name Phaser.GameObjects.Shape#isFilled + * @type {boolean} + * @since 3.13.0 */ - this.text = new BaseCache(); + this.isFilled = false; /** - * A Cache storing all html files, typically added via the Loader. + * Controls if this Shape is stroked or not. + * Note that some Shapes do not support being stroked (such as Iso Box shapes) * - * @name Phaser.Cache.CacheManager#html - * @type {Phaser.Cache.BaseCache} - * @since 3.12.0 + * @name Phaser.GameObjects.Shape#isStroked + * @type {boolean} + * @since 3.13.0 */ - this.html = new BaseCache(); + this.isStroked = false; /** - * A Cache storing all WaveFront OBJ files, typically added via the Loader. + * Controls if this Shape path is closed during rendering when stroked. + * Note that some Shapes are always closed when stroked (such as Ellipse shapes) * - * @name Phaser.Cache.CacheManager#obj - * @type {Phaser.Cache.BaseCache} - * @since 3.0.0 + * @name Phaser.GameObjects.Shape#closePath + * @type {boolean} + * @since 3.13.0 */ - this.obj = new BaseCache(); + this.closePath = true; /** - * A Cache storing all tilemap data files, typically added via the Loader. - * Only the data is stored in this cache, the textures are part of the Texture Manager. + * Private internal value. + * A Line used when parsing internal path data to avoid constant object re-creation. * - * @name Phaser.Cache.CacheManager#tilemap - * @type {Phaser.Cache.BaseCache} - * @since 3.0.0 + * @name Phaser.GameObjects.Shape#_tempLine + * @type {Phaser.Geom.Line} + * @private + * @since 3.13.0 */ - this.tilemap = new BaseCache(); + this._tempLine = new Line(); /** - * A Cache storing all xml data files, typically added via the Loader. + * The native (un-scaled) width of this Game Object. * - * @name Phaser.Cache.CacheManager#xml - * @type {Phaser.Cache.BaseCache} - * @since 3.0.0 + * Changing this value will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or use + * the `displayWidth` property. + * + * @name Phaser.GameObjects.Shape#width + * @type {number} + * @since 3.13.0 */ - this.xml = new BaseCache(); + this.width = 0; /** - * An object that contains your own custom BaseCache entries. - * Add to this via the `addCustom` method. + * The native (un-scaled) height of this Game Object. * - * @name Phaser.Cache.CacheManager#custom - * @type {Object.} + * Changing this value will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or use + * the `displayHeight` property. + * + * @name Phaser.GameObjects.Shape#height + * @type {number} * @since 3.0.0 */ - this.custom = {}; + this.height = 0; - this.game.events.once(GameEvents.DESTROY, this.destroy, this); + this.initPipeline(); + this.initPostPipeline(); }, /** - * Add your own custom Cache for storing your own files. - * The cache will be available under `Cache.custom.key`. - * The cache will only be created if the key is not already in use. + * Sets the fill color and alpha for this Shape. * - * @method Phaser.Cache.CacheManager#addCustom - * @since 3.0.0 + * If you wish for the Shape to not be filled then call this method with no arguments, or just set `isFilled` to `false`. * - * @param {string} key - The unique key of your custom cache. + * Note that some Shapes do not support fill colors, such as the Line shape. * - * @return {Phaser.Cache.BaseCache} A reference to the BaseCache that was created. If the key was already in use, a reference to the existing cache is returned instead. + * This call can be chained. + * + * @method Phaser.GameObjects.Shape#setFillStyle + * @since 3.13.0 + * + * @param {number} [color] - The color used to fill this shape. If not provided the Shape will not be filled. + * @param {number} [alpha=1] - The alpha value used when filling this shape, if a fill color is given. + * + * @return {this} This Game Object instance. */ - addCustom: function (key) + setFillStyle: function (color, alpha) { - if (!this.custom.hasOwnProperty(key)) + if (alpha === undefined) { alpha = 1; } + + if (color === undefined) { - this.custom[key] = new BaseCache(); + this.isFilled = false; + } + else + { + this.fillColor = color; + this.fillAlpha = alpha; + this.isFilled = true; } - return this.custom[key]; + return this; }, /** - * Removes all entries from all BaseCaches and destroys all custom caches. + * Sets the stroke color and alpha for this Shape. * - * @method Phaser.Cache.CacheManager#destroy - * @since 3.0.0 + * If you wish for the Shape to not be stroked then call this method with no arguments, or just set `isStroked` to `false`. + * + * Note that some Shapes do not support being stroked, such as the Iso Box shape. + * + * This call can be chained. + * + * @method Phaser.GameObjects.Shape#setStrokeStyle + * @since 3.13.0 + * + * @param {number} [lineWidth] - The width of line to stroke with. If not provided or undefined the Shape will not be stroked. + * @param {number} [color] - The color used to stroke this shape. If not provided the Shape will not be stroked. + * @param {number} [alpha=1] - The alpha value used when stroking this shape, if a stroke color is given. + * + * @return {this} This Game Object instance. */ - destroy: function () + setStrokeStyle: function (lineWidth, color, alpha) { - var keys = [ - 'binary', - 'bitmapFont', - 'json', - 'physics', - 'shader', - 'audio', - 'video', - 'text', - 'html', - 'obj', - 'tilemap', - 'xml' - ]; + if (alpha === undefined) { alpha = 1; } - for (var i = 0; i < keys.length; i++) + if (lineWidth === undefined) { - this[keys[i]].destroy(); - this[keys[i]] = null; + this.isStroked = false; + } + else + { + this.lineWidth = lineWidth; + this.strokeColor = color; + this.strokeAlpha = alpha; + this.isStroked = true; } - for (var key in this.custom) + return this; + }, + + /** + * Sets if this Shape path is closed during rendering when stroked. + * Note that some Shapes are always closed when stroked (such as Ellipse shapes) + * + * This call can be chained. + * + * @method Phaser.GameObjects.Shape#setClosePath + * @since 3.13.0 + * + * @param {boolean} value - Set to `true` if the Shape should be closed when stroked, otherwise `false`. + * + * @return {this} This Game Object instance. + */ + setClosePath: function (value) + { + this.closePath = value; + + return this; + }, + + /** + * Sets the internal size of this Game Object, as used for frame or physics body creation. + * + * This will not change the size that the Game Object is rendered in-game. + * For that you need to either set the scale of the Game Object (`setScale`) or call the + * `setDisplaySize` method, which is the same thing as changing the scale but allows you + * to do so by giving pixel values. + * + * If you have enabled this Game Object for input, changing the size will _not_ change the + * size of the hit area. To do this you should adjust the `input.hitArea` object directly. + * + * @method Phaser.GameObjects.Shape#setSize + * @private + * @since 3.13.0 + * + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {this} This Game Object instance. + */ + setSize: function (width, height) + { + this.width = width; + this.height = height; + + return this; + }, + + /** + * Sets the display size of this Shape. + * + * Calling this will adjust the scale. + * + * @method Phaser.GameObjects.Shape#setDisplaySize + * @since 3.53.0 + * + * @param {number} width - The display width of this Shape. + * @param {number} height - The display height of this Shape. + * + * @return {this} This Shape instance. + */ + setDisplaySize: function (width, height) + { + this.displayWidth = width; + this.displayHeight = height; + + return this; + }, + + /** + * Internal destroy handler, called as part of the destroy process. + * + * @method Phaser.GameObjects.Shape#preDestroy + * @protected + * @since 3.13.0 + */ + preDestroy: function () + { + this.geom = null; + this._tempLine = null; + this.pathData = []; + this.pathIndexes = []; + }, + + /** + * The displayed width of this Game Object. + * + * This value takes into account the scale factor. + * + * Setting this value will adjust the Game Object's scale property. + * + * @name Phaser.GameObjects.Shape#displayWidth + * @type {number} + * @since 3.13.0 + */ + displayWidth: { + + get: function () { - this.custom[key].destroy(); + return this.scaleX * this.width; + }, + + set: function (value) + { + this.scaleX = value / this.width; } - this.custom = null; + }, + + /** + * The displayed height of this Game Object. + * + * This value takes into account the scale factor. + * + * Setting this value will adjust the Game Object's scale property. + * + * @name Phaser.GameObjects.Shape#displayHeight + * @type {number} + * @since 3.13.0 + */ + displayHeight: { + + get: function () + { + return this.scaleY * this.height; + }, + + set: function (value) + { + this.scaleY = value / this.height; + } - this.game = null; } }); -module.exports = CacheManager; +module.exports = Shape; /***/ }), -/* 326 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 50262: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseCamera = __webpack_require__(133); -var CenterOn = __webpack_require__(190); -var Clamp = __webpack_require__(18); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var Effects = __webpack_require__(333); -var Events = __webpack_require__(37); -var Linear = __webpack_require__(135); -var Rectangle = __webpack_require__(10); -var Vector2 = __webpack_require__(3); +var Utils = __webpack_require__(75512); /** - * @classdesc - * A Camera. - * - * The Camera is the way in which all games are rendered in Phaser. They provide a view into your game world, - * and can be positioned, rotated, zoomed and scrolled accordingly. + * Renders a stroke outline around the given Shape. * - * A Camera consists of two elements: The viewport and the scroll values. + * @method Phaser.GameObjects.Shape#StrokePathWebGL + * @since 3.13.0 + * @private * - * The viewport is the physical position and size of the Camera within your game. Cameras, by default, are - * created the same size as your game, but their position and size can be set to anything. This means if you - * wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game, - * you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`). + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The WebGL Pipeline used to render this Shape. + * @param {Phaser.GameObjects.Shape} src - The Game Object shape being rendered in this call. + * @param {number} alpha - The base alpha value. + * @param {number} dx - The source displayOriginX. + * @param {number} dy - The source displayOriginY. + */ +var StrokePathWebGL = function (pipeline, src, alpha, dx, dy) +{ + var strokeTint = pipeline.strokeTint; + var strokeTintColor = Utils.getTintAppendFloatAlpha(src.strokeColor, src.strokeAlpha * alpha); + + strokeTint.TL = strokeTintColor; + strokeTint.TR = strokeTintColor; + strokeTint.BL = strokeTintColor; + strokeTint.BR = strokeTintColor; + + var path = src.pathData; + var pathLength = path.length - 1; + var lineWidth = src.lineWidth; + var halfLineWidth = lineWidth / 2; + + var px1 = path[0] - dx; + var py1 = path[1] - dy; + + if (!src.closePath) + { + pathLength -= 2; + } + + for (var i = 2; i < pathLength; i += 2) + { + var px2 = path[i] - dx; + var py2 = path[i + 1] - dy; + + pipeline.batchLine( + px1, + py1, + px2, + py2, + halfLineWidth, + halfLineWidth, + lineWidth, + i - 2, + (src.closePath) ? (i === pathLength - 1) : false + ); + + px1 = px2; + py1 = py2; + } +}; + +module.exports = StrokePathWebGL; + + +/***/ }), + +/***/ 28593: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var ArcRender = __webpack_require__(2213); +var Class = __webpack_require__(56694); +var DegToRad = __webpack_require__(75606); +var Earcut = __webpack_require__(11117); +var GeomCircle = __webpack_require__(26673); +var MATH_CONST = __webpack_require__(83392); +var Shape = __webpack_require__(91461); + +/** + * @classdesc + * The Arc Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. * - * If you wish to change where the Camera is looking in your game, then you scroll it. You can do this - * via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the - * viewport, and changing the viewport has no impact on the scrolling. + * This shape supports both fill and stroke colors. * - * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, - * allowing you to filter Game Objects out on a per-Camera basis. + * When it renders it displays an arc shape. You can control the start and end angles of the arc, + * as well as if the angles are winding clockwise or anti-clockwise. With the default settings + * it renders as a complete circle. By changing the angles you can create other arc shapes, + * such as half-circles. * - * A Camera also has built-in special effects including Fade, Flash and Camera Shake. + * Arcs also have an `iterations` property and corresponding `setIterations` method. This allows + * you to control how smooth the shape renders in WebGL, by controlling the number of iterations + * that take place during construction. * - * @class Camera - * @memberof Phaser.Cameras.Scene2D + * @class Arc + * @extends Phaser.GameObjects.Shape + * @memberof Phaser.GameObjects * @constructor - * @since 3.0.0 - * - * @extends Phaser.Cameras.Scene2D.BaseCamera - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Pipeline + * @since 3.13.0 * - * @param {number} x - The x position of the Camera, relative to the top-left of the game canvas. - * @param {number} y - The y position of the Camera, relative to the top-left of the game canvas. - * @param {number} width - The width of the Camera, in pixels. - * @param {number} height - The height of the Camera, in pixels. + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [radius=128] - The radius of the arc. + * @param {number} [startAngle=0] - The start angle of the arc, in degrees. + * @param {number} [endAngle=360] - The end angle of the arc, in degrees. + * @param {boolean} [anticlockwise=false] - The winding order of the start and end angles. + * @param {number} [fillColor] - The color the arc will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the arc will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. */ -var Camera = new Class({ +var Arc = new Class({ - Extends: BaseCamera, + Extends: Shape, Mixins: [ - Components.Flip, - Components.Tint, - Components.Pipeline + ArcRender ], initialize: - function Camera (x, y, width, height) + function Arc (scene, x, y, radius, startAngle, endAngle, anticlockwise, fillColor, fillAlpha) { - BaseCamera.call(this, x, y, width, height); - - this.postPipelines = []; - this.pipelineData = {}; - - /** - * Does this Camera allow the Game Objects it renders to receive input events? - * - * @name Phaser.Cameras.Scene2D.Camera#inputEnabled - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.inputEnabled = true; - - /** - * The Camera Fade effect handler. - * To fade this camera see the `Camera.fade` methods. - * - * @name Phaser.Cameras.Scene2D.Camera#fadeEffect - * @type {Phaser.Cameras.Scene2D.Effects.Fade} - * @since 3.5.0 - */ - this.fadeEffect = new Effects.Fade(this); + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (radius === undefined) { radius = 128; } + if (startAngle === undefined) { startAngle = 0; } + if (endAngle === undefined) { endAngle = 360; } + if (anticlockwise === undefined) { anticlockwise = false; } - /** - * The Camera Flash effect handler. - * To flash this camera see the `Camera.flash` method. - * - * @name Phaser.Cameras.Scene2D.Camera#flashEffect - * @type {Phaser.Cameras.Scene2D.Effects.Flash} - * @since 3.5.0 - */ - this.flashEffect = new Effects.Flash(this); + Shape.call(this, scene, 'Arc', new GeomCircle(0, 0, radius)); /** - * The Camera Shake effect handler. - * To shake this camera see the `Camera.shake` method. + * Private internal value. Holds the start angle in degrees. * - * @name Phaser.Cameras.Scene2D.Camera#shakeEffect - * @type {Phaser.Cameras.Scene2D.Effects.Shake} - * @since 3.5.0 + * @name Phaser.GameObjects.Arc#_startAngle + * @type {number} + * @private + * @since 3.13.0 */ - this.shakeEffect = new Effects.Shake(this); + this._startAngle = startAngle; /** - * The Camera Pan effect handler. - * To pan this camera see the `Camera.pan` method. + * Private internal value. Holds the end angle in degrees. * - * @name Phaser.Cameras.Scene2D.Camera#panEffect - * @type {Phaser.Cameras.Scene2D.Effects.Pan} - * @since 3.11.0 + * @name Phaser.GameObjects.Arc#_endAngle + * @type {number} + * @private + * @since 3.13.0 */ - this.panEffect = new Effects.Pan(this); + this._endAngle = endAngle; /** - * The Camera Rotate To effect handler. - * To rotate this camera see the `Camera.rotateTo` method. + * Private internal value. Holds the winding order of the start and end angles. * - * @name Phaser.Cameras.Scene2D.Camera#rotateToEffect - * @type {Phaser.Cameras.Scene2D.Effects.RotateTo} - * @since 3.23.0 + * @name Phaser.GameObjects.Arc#_anticlockwise + * @type {boolean} + * @private + * @since 3.13.0 */ - this.rotateToEffect = new Effects.RotateTo(this); + this._anticlockwise = anticlockwise; /** - * The Camera Zoom effect handler. - * To zoom this camera see the `Camera.zoom` method. + * Private internal value. Holds the number of iterations used when drawing the arc. * - * @name Phaser.Cameras.Scene2D.Camera#zoomEffect - * @type {Phaser.Cameras.Scene2D.Effects.Zoom} - * @since 3.11.0 + * @name Phaser.GameObjects.Arc#_iterations + * @type {number} + * @default 0.01 + * @private + * @since 3.13.0 */ - this.zoomEffect = new Effects.Zoom(this); + this._iterations = 0.01; - /** - * The linear interpolation value to use when following a target. - * - * Can also be set via `setLerp` or as part of the `startFollow` call. - * - * The default values of 1 means the camera will instantly snap to the target coordinates. - * A lower value, such as 0.1 means the camera will more slowly track the target, giving - * a smooth transition. You can set the horizontal and vertical values independently, and also - * adjust this value in real-time during your game. - * - * Be sure to keep the value between 0 and 1. A value of zero will disable tracking on that axis. - * - * @name Phaser.Cameras.Scene2D.Camera#lerp - * @type {Phaser.Math.Vector2} - * @since 3.9.0 - */ - this.lerp = new Vector2(1, 1); + this.setPosition(x, y); - /** - * The values stored in this property are subtracted from the Camera targets position, allowing you to - * offset the camera from the actual target x/y coordinates by this amount. - * Can also be set via `setFollowOffset` or as part of the `startFollow` call. - * - * @name Phaser.Cameras.Scene2D.Camera#followOffset - * @type {Phaser.Math.Vector2} - * @since 3.9.0 - */ - this.followOffset = new Vector2(); + var diameter = this.geom.radius * 2; + this.setSize(diameter, diameter); - /** - * The Camera dead zone. - * - * The deadzone is only used when the camera is following a target. - * - * It defines a rectangular region within which if the target is present, the camera will not scroll. - * If the target moves outside of this area, the camera will begin scrolling in order to follow it. - * - * The `lerp` values that you can set for a follower target also apply when using a deadzone. - * - * You can directly set this property to be an instance of a Rectangle. Or, you can use the - * `setDeadzone` method for a chainable approach. - * - * The rectangle you provide can have its dimensions adjusted dynamically, however, please - * note that its position is updated every frame, as it is constantly re-centered on the cameras mid point. - * - * Calling `setDeadzone` with no arguments will reset an active deadzone, as will setting this property - * to `null`. - * - * @name Phaser.Cameras.Scene2D.Camera#deadzone - * @type {?Phaser.Geom.Rectangle} - * @since 3.11.0 - */ - this.deadzone = null; + if (fillColor !== undefined) + { + this.setFillStyle(fillColor, fillAlpha); + } - /** - * Internal follow target reference. - * - * @name Phaser.Cameras.Scene2D.Camera#_follow - * @type {?any} - * @private - * @default null - * @since 3.0.0 - */ - this._follow = null; + this.updateDisplayOrigin(); + this.updateData(); }, /** - * Sets the Camera dead zone. - * - * The deadzone is only used when the camera is following a target. - * - * It defines a rectangular region within which if the target is present, the camera will not scroll. - * If the target moves outside of this area, the camera will begin scrolling in order to follow it. - * - * The deadzone rectangle is re-positioned every frame so that it is centered on the mid-point - * of the camera. This allows you to use the object for additional game related checks, such as - * testing if an object is within it or not via a Rectangle.contains call. - * - * The `lerp` values that you can set for a follower target also apply when using a deadzone. - * - * Calling this method with no arguments will reset an active deadzone. - * - * @method Phaser.Cameras.Scene2D.Camera#setDeadzone - * @since 3.11.0 - * - * @param {number} [width] - The width of the deadzone rectangle in pixels. If not specified the deadzone is removed. - * @param {number} [height] - The height of the deadzone rectangle in pixels. + * The number of iterations used when drawing the arc. + * Increase this value for smoother arcs, at the cost of more polygons being rendered. + * Modify this value by small amounts, such as 0.01. * - * @return {this} This Camera instance. + * @name Phaser.GameObjects.Arc#iterations + * @type {number} + * @default 0.01 + * @since 3.13.0 */ - setDeadzone: function (width, height) - { - if (width === undefined) - { - this.deadzone = null; - } - else - { - if (this.deadzone) - { - this.deadzone.width = width; - this.deadzone.height = height; - } - else - { - this.deadzone = new Rectangle(0, 0, width, height); - } - - if (this._follow) - { - var originX = this.width / 2; - var originY = this.height / 2; - - var fx = this._follow.x - this.followOffset.x; - var fy = this._follow.y - this.followOffset.y; + iterations: { - this.midPoint.set(fx, fy); + get: function () + { + return this._iterations; + }, - this.scrollX = fx - originX; - this.scrollY = fy - originY; - } + set: function (value) + { + this._iterations = value; - CenterOn(this.deadzone, this.midPoint.x, this.midPoint.y); + this.updateData(); } - return this; }, /** - * Fades the Camera in from the given color over the duration specified. - * - * @method Phaser.Cameras.Scene2D.Camera#fadeIn - * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START - * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE - * @since 3.3.0 - * - * @param {number} [duration=1000] - The duration of the effect in milliseconds. - * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. - * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * The radius of the arc. * - * @return {this} This Camera instance. + * @name Phaser.GameObjects.Arc#radius + * @type {number} + * @since 3.13.0 */ - fadeIn: function (duration, red, green, blue, callback, context) - { - return this.fadeEffect.start(false, duration, red, green, blue, true, callback, context); - }, + radius: { + + get: function () + { + return this.geom.radius; + }, + + set: function (value) + { + this.geom.radius = value; + + var diameter = value * 2; + this.setSize(diameter, diameter); + this.updateDisplayOrigin(); + this.updateData(); + } - /** - * Fades the Camera out to the given color over the duration specified. - * This is an alias for Camera.fade that forces the fade to start, regardless of existing fades. - * - * @method Phaser.Cameras.Scene2D.Camera#fadeOut - * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START - * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE - * @since 3.3.0 - * - * @param {number} [duration=1000] - The duration of the effect in milliseconds. - * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. - * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. - * - * @return {this} This Camera instance. - */ - fadeOut: function (duration, red, green, blue, callback, context) - { - return this.fadeEffect.start(true, duration, red, green, blue, true, callback, context); }, /** - * Fades the Camera from the given color to transparent over the duration specified. - * - * @method Phaser.Cameras.Scene2D.Camera#fadeFrom - * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START - * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE - * @since 3.5.0 - * - * @param {number} [duration=1000] - The duration of the effect in milliseconds. - * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. - * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. - * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * The start angle of the arc, in degrees. * - * @return {this} This Camera instance. + * @name Phaser.GameObjects.Arc#startAngle + * @type {number} + * @since 3.13.0 */ - fadeFrom: function (duration, red, green, blue, force, callback, context) - { - return this.fadeEffect.start(false, duration, red, green, blue, force, callback, context); + startAngle: { + + get: function () + { + return this._startAngle; + }, + + set: function (value) + { + this._startAngle = value; + + this.updateData(); + } + }, /** - * Fades the Camera from transparent to the given color over the duration specified. - * - * @method Phaser.Cameras.Scene2D.Camera#fade - * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START - * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE - * @since 3.0.0 - * - * @param {number} [duration=1000] - The duration of the effect in milliseconds. - * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. - * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. - * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * The end angle of the arc, in degrees. * - * @return {this} This Camera instance. + * @name Phaser.GameObjects.Arc#endAngle + * @type {number} + * @since 3.13.0 */ - fade: function (duration, red, green, blue, force, callback, context) - { - return this.fadeEffect.start(true, duration, red, green, blue, force, callback, context); + endAngle: { + + get: function () + { + return this._endAngle; + }, + + set: function (value) + { + this._endAngle = value; + + this.updateData(); + } + }, /** - * Flashes the Camera by setting it to the given color immediately and then fading it away again quickly over the duration specified. - * - * @method Phaser.Cameras.Scene2D.Camera#flash - * @fires Phaser.Cameras.Scene2D.Events#FLASH_START - * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE - * @since 3.0.0 - * - * @param {number} [duration=250] - The duration of the effect in milliseconds. - * @param {number} [red=255] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {number} [green=255] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {number} [blue=255] - The amount to fade the blue channel towards. A value between 0 and 255. - * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. - * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * The winding order of the start and end angles. * - * @return {this} This Camera instance. + * @name Phaser.GameObjects.Arc#anticlockwise + * @type {boolean} + * @since 3.13.0 */ - flash: function (duration, red, green, blue, force, callback, context) - { - return this.flashEffect.start(duration, red, green, blue, force, callback, context); + anticlockwise: { + + get: function () + { + return this._anticlockwise; + }, + + set: function (value) + { + this._anticlockwise = value; + + this.updateData(); + } + }, /** - * Shakes the Camera by the given intensity over the duration specified. + * Sets the radius of the arc. + * This call can be chained. * - * @method Phaser.Cameras.Scene2D.Camera#shake - * @fires Phaser.Cameras.Scene2D.Events#SHAKE_START - * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE - * @since 3.0.0 + * @method Phaser.GameObjects.Arc#setRadius + * @since 3.13.0 * - * @param {number} [duration=100] - The duration of the effect in milliseconds. - * @param {(number|Phaser.Math.Vector2)} [intensity=0.05] - The intensity of the shake. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. - * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * @param {number} value - The value to set the radius to. * - * @return {this} This Camera instance. + * @return {this} This Game Object instance. */ - shake: function (duration, intensity, force, callback, context) + setRadius: function (value) { - return this.shakeEffect.start(duration, intensity, force, callback, context); + this.radius = value; + + return this; }, /** - * This effect will scroll the Camera so that the center of its viewport finishes at the given destination, - * over the duration and with the ease specified. + * Sets the number of iterations used when drawing the arc. + * Increase this value for smoother arcs, at the cost of more polygons being rendered. + * Modify this value by small amounts, such as 0.01. + * This call can be chained. * - * @method Phaser.Cameras.Scene2D.Camera#pan - * @fires Phaser.Cameras.Scene2D.Events#PAN_START - * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE - * @since 3.11.0 + * @method Phaser.GameObjects.Arc#setIterations + * @since 3.13.0 * - * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. - * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. - * @param {number} [duration=1000] - The duration of the effect in milliseconds. - * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. - * @param {Phaser.Types.Cameras.Scene2D.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, - * the current camera scroll x coordinate and the current camera scroll y coordinate. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * @param {number} value - The value to set the iterations to. * - * @return {this} This Camera instance. + * @return {this} This Game Object instance. */ - pan: function (x, y, duration, ease, force, callback, context) + setIterations: function (value) { - return this.panEffect.start(x, y, duration, ease, force, callback, context); + if (value === undefined) { value = 0.01; } + + this.iterations = value; + + return this; }, /** - * This effect will rotate the Camera so that the viewport finishes at the given angle in radians, - * over the duration and with the ease specified. + * Sets the starting angle of the arc, in degrees. + * This call can be chained. * - * @method Phaser.Cameras.Scene2D.Camera#rotateTo - * @since 3.23.0 + * @method Phaser.GameObjects.Arc#setStartAngle + * @since 3.13.0 * - * @param {number} radians - The destination angle in radians to rotate the Camera viewport to. If the angle is positive then the rotation is clockwise else anticlockwise - * @param {boolean} [shortestPath=false] - If shortest path is set to true the camera will rotate in the quickest direction clockwise or anti-clockwise. - * @param {number} [duration=1000] - The duration of the effect in milliseconds. - * @param {(string|function)} [ease='Linear'] - The ease to use for the rotation. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the rotation effect to start immediately, even if already running. - * @param {CameraRotateCallback} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, - * the current camera rotation angle in radians. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * @param {number} value - The value to set the starting angle to. * - * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance. + * @return {this} This Game Object instance. */ - rotateTo: function (radians, shortestPath, duration, ease, force, callback, context) + setStartAngle: function (angle, anticlockwise) { - return this.rotateToEffect.start(radians, shortestPath, duration, ease, force, callback, context); + this._startAngle = angle; + + if (anticlockwise !== undefined) + { + this._anticlockwise = anticlockwise; + } + + return this.updateData(); }, /** - * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. + * Sets the ending angle of the arc, in degrees. + * This call can be chained. * - * @method Phaser.Cameras.Scene2D.Camera#zoomTo - * @fires Phaser.Cameras.Scene2D.Events#ZOOM_START - * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE - * @since 3.11.0 + * @method Phaser.GameObjects.Arc#setEndAngle + * @since 3.13.0 * - * @param {number} zoom - The target Camera zoom value. - * @param {number} [duration=1000] - The duration of the effect in milliseconds. - * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. - * @param {Phaser.Types.Cameras.Scene2D.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, - * the current camera scroll x coordinate and the current camera scroll y coordinate. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * @param {number} value - The value to set the ending angle to. * - * @return {this} This Camera instance. + * @return {this} This Game Object instance. */ - zoomTo: function (zoom, duration, ease, force, callback, context) + setEndAngle: function (angle, anticlockwise) { - return this.zoomEffect.start(zoom, duration, ease, force, callback, context); + this._endAngle = angle; + + if (anticlockwise !== undefined) + { + this._anticlockwise = anticlockwise; + } + + return this.updateData(); }, /** - * Internal preRender step. + * Internal method that updates the data and path values. * - * @method Phaser.Cameras.Scene2D.Camera#preRender - * @protected - * @since 3.0.0 + * @method Phaser.GameObjects.Arc#updateData + * @private + * @since 3.13.0 + * + * @return {this} This Game Object instance. */ - preRender: function () + updateData: function () { - this.renderList.length = 0; - - var width = this.width; - var height = this.height; - - var halfWidth = width * 0.5; - var halfHeight = height * 0.5; - - var zoom = this.zoom; - var matrix = this.matrix; - - var originX = width * this.originX; - var originY = height * this.originY; - - var follow = this._follow; - var deadzone = this.deadzone; + var step = this._iterations; + var iteration = step; - var sx = this.scrollX; - var sy = this.scrollY; + var radius = this.geom.radius; + var startAngle = DegToRad(this._startAngle); + var endAngle = DegToRad(this._endAngle); + var anticlockwise = this._anticlockwise; - if (deadzone) - { - CenterOn(deadzone, this.midPoint.x, this.midPoint.y); - } + var x = radius; + var y = radius; - var emitFollowEvent = false; + endAngle -= startAngle; - if (follow && !this.panEffect.isRunning) + if (anticlockwise) { - var fx = (follow.x - this.followOffset.x); - var fy = (follow.y - this.followOffset.y); - - if (deadzone) + if (endAngle < -MATH_CONST.PI2) { - if (fx < deadzone.x) - { - sx = Linear(sx, sx - (deadzone.x - fx), this.lerp.x); - } - else if (fx > deadzone.right) - { - sx = Linear(sx, sx + (fx - deadzone.right), this.lerp.x); - } - - if (fy < deadzone.y) - { - sy = Linear(sy, sy - (deadzone.y - fy), this.lerp.y); - } - else if (fy > deadzone.bottom) - { - sy = Linear(sy, sy + (fy - deadzone.bottom), this.lerp.y); - } + endAngle = -MATH_CONST.PI2; } - else + else if (endAngle > 0) { - sx = Linear(sx, fx - originX, this.lerp.x); - sy = Linear(sy, fy - originY, this.lerp.y); + endAngle = -MATH_CONST.PI2 + endAngle % MATH_CONST.PI2; } - - emitFollowEvent = true; } - - if (this.useBounds) + else if (endAngle > MATH_CONST.PI2) { - sx = this.clampX(sx); - sy = this.clampY(sy); + endAngle = MATH_CONST.PI2; } - - if (this.roundPixels) + else if (endAngle < 0) { - originX = Math.round(originX); - originY = Math.round(originY); - - sx = Math.round(sx); - sy = Math.round(sy); + endAngle = MATH_CONST.PI2 + endAngle % MATH_CONST.PI2; } - // Values are in pixels and not impacted by zooming the Camera - this.scrollX = sx; - this.scrollY = sy; - - var midX = sx + halfWidth; - var midY = sy + halfHeight; - - // The center of the camera, in world space, so taking zoom into account - // Basically the pixel value of what it's looking at in the middle of the cam - this.midPoint.set(midX, midY); - - var displayWidth = width / zoom; - var displayHeight = height / zoom; + var path = [ x + Math.cos(startAngle) * radius, y + Math.sin(startAngle) * radius ]; - var vwx = midX - (displayWidth / 2); - var vwy = midY - (displayHeight / 2); + var ta; - if (this.roundPixels) + while (iteration < 1) { - vwx = Math.round(vwx); - vwy = Math.round(vwy); - } - - this.worldView.setTo(vwx, vwy, displayWidth, displayHeight); - - matrix.applyITRS(this.x + originX, this.y + originY, this.rotation, zoom, zoom); - matrix.translate(-originX, -originY); + ta = endAngle * iteration + startAngle; - this.shakeEffect.preRender(); + path.push(x + Math.cos(ta) * radius, y + Math.sin(ta) * radius); - if (emitFollowEvent) - { - this.emit(Events.FOLLOW_UPDATE, this, follow); + iteration += step; } - }, - - /** - * Sets the linear interpolation value to use when following a target. - * - * The default values of 1 means the camera will instantly snap to the target coordinates. - * A lower value, such as 0.1 means the camera will more slowly track the target, giving - * a smooth transition. You can set the horizontal and vertical values independently, and also - * adjust this value in real-time during your game. - * - * Be sure to keep the value between 0 and 1. A value of zero will disable tracking on that axis. - * - * @method Phaser.Cameras.Scene2D.Camera#setLerp - * @since 3.9.0 - * - * @param {number} [x=1] - The amount added to the horizontal linear interpolation of the follow target. - * @param {number} [y=1] - The amount added to the vertical linear interpolation of the follow target. - * - * @return {this} This Camera instance. - */ - setLerp: function (x, y) - { - if (x === undefined) { x = 1; } - if (y === undefined) { y = x; } - this.lerp.set(x, y); + ta = endAngle + startAngle; - return this; - }, + path.push(x + Math.cos(ta) * radius, y + Math.sin(ta) * radius); - /** - * Sets the horizontal and vertical offset of the camera from its follow target. - * The values are subtracted from the targets position during the Cameras update step. - * - * @method Phaser.Cameras.Scene2D.Camera#setFollowOffset - * @since 3.9.0 - * - * @param {number} [x=0] - The horizontal offset from the camera follow target.x position. - * @param {number} [y=0] - The vertical offset from the camera follow target.y position. - * - * @return {this} This Camera instance. - */ - setFollowOffset: function (x, y) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } + path.push(x + Math.cos(startAngle) * radius, y + Math.sin(startAngle) * radius); - this.followOffset.set(x, y); + this.pathIndexes = Earcut(path); + this.pathData = path; return this; - }, + } - /** - * Sets the Camera to follow a Game Object. - * - * When enabled the Camera will automatically adjust its scroll position to keep the target Game Object - * in its center. - * - * You can set the linear interpolation value used in the follow code. - * Use low lerp values (such as 0.1) to automatically smooth the camera motion. - * - * If you find you're getting a slight "jitter" effect when following an object it's probably to do with sub-pixel - * rendering of the targets position. This can be rounded by setting the `roundPixels` argument to `true` to - * force full pixel rounding rendering. Note that this can still be broken if you have specified a non-integer zoom - * value on the camera. So be sure to keep the camera zoom to integers. - * - * @method Phaser.Cameras.Scene2D.Camera#startFollow - * @since 3.0.0 - * - * @param {(Phaser.GameObjects.GameObject|object)} target - The target for the Camera to follow. - * @param {boolean} [roundPixels=false] - Round the camera position to whole integers to avoid sub-pixel rendering? - * @param {number} [lerpX=1] - A value between 0 and 1. This value specifies the amount of linear interpolation to use when horizontally tracking the target. The closer the value to 1, the faster the camera will track. - * @param {number} [lerpY=1] - A value between 0 and 1. This value specifies the amount of linear interpolation to use when vertically tracking the target. The closer the value to 1, the faster the camera will track. - * @param {number} [offsetX=0] - The horizontal offset from the camera follow target.x position. - * @param {number} [offsetY=0] - The vertical offset from the camera follow target.y position. - * - * @return {this} This Camera instance. - */ - startFollow: function (target, roundPixels, lerpX, lerpY, offsetX, offsetY) - { - if (roundPixels === undefined) { roundPixels = false; } - if (lerpX === undefined) { lerpX = 1; } - if (lerpY === undefined) { lerpY = lerpX; } - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = offsetX; } +}); - this._follow = target; +module.exports = Arc; - this.roundPixels = roundPixels; - lerpX = Clamp(lerpX, 0, 1); - lerpY = Clamp(lerpY, 0, 1); +/***/ }), - this.lerp.set(lerpX, lerpY); +/***/ 23560: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.followOffset.set(offsetX, offsetY); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var originX = this.width / 2; - var originY = this.height / 2; +var DegToRad = __webpack_require__(75606); +var FillStyleCanvas = __webpack_require__(15608); +var LineStyleCanvas = __webpack_require__(17876); +var SetTransform = __webpack_require__(49584); - var fx = target.x - offsetX; - var fy = target.y - offsetY; - - this.midPoint.set(fx, fy); - - this.scrollX = fx - originX; - this.scrollY = fy - originY; - - if (this.useBounds) - { - this.scrollX = this.clampX(this.scrollX); - this.scrollY = this.clampY(this.scrollY); - } +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Arc#renderCanvas + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Arc} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var ArcCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - return this; - }, + var ctx = renderer.currentContext; - /** - * Stops a Camera from following a Game Object, if previously set via `Camera.startFollow`. - * - * @method Phaser.Cameras.Scene2D.Camera#stopFollow - * @since 3.0.0 - * - * @return {this} This Camera instance. - */ - stopFollow: function () + if (SetTransform(renderer, ctx, src, camera, parentMatrix)) { - this._follow = null; - - return this; - }, + var radius = src.radius; - /** - * Resets any active FX, such as a fade, flash or shake. Useful to call after a fade in order to - * remove the fade. - * - * @method Phaser.Cameras.Scene2D.Camera#resetFX - * @since 3.0.0 - * - * @return {this} This Camera instance. - */ - resetFX: function () - { - this.rotateToEffect.reset(); - this.panEffect.reset(); - this.shakeEffect.reset(); - this.flashEffect.reset(); - this.fadeEffect.reset(); + ctx.beginPath(); - return this; - }, + ctx.arc( + (radius) - src.originX * (radius * 2), + (radius) - src.originY * (radius * 2), + radius, + DegToRad(src._startAngle), + DegToRad(src._endAngle), + src.anticlockwise + ); - /** - * Internal method called automatically by the Camera Manager. - * - * @method Phaser.Cameras.Scene2D.Camera#update - * @protected - * @since 3.0.0 - * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. - */ - update: function (time, delta) - { - if (this.visible) + if (src.closePath) { - this.rotateToEffect.update(time, delta); - this.panEffect.update(time, delta); - this.zoomEffect.update(time, delta); - this.shakeEffect.update(time, delta); - this.flashEffect.update(time, delta); - this.fadeEffect.update(time, delta); + ctx.closePath(); } - }, - /** - * Destroys this Camera instance. You rarely need to call this directly. - * - * Called by the Camera Manager. If you wish to destroy a Camera please use `CameraManager.remove` as - * cameras are stored in a pool, ready for recycling later, and calling this directly will prevent that. - * - * @method Phaser.Cameras.Scene2D.Camera#destroy - * @fires Phaser.Cameras.Scene2D.Events#DESTROY - * @since 3.0.0 - */ - destroy: function () - { - this.resetFX(); + if (src.isFilled) + { + FillStyleCanvas(ctx, src); - BaseCamera.prototype.destroy.call(this); + ctx.fill(); + } - this._follow = null; + if (src.isStroked) + { + LineStyleCanvas(ctx, src); - this.deadzone = null; - } + ctx.stroke(); + } -}); + // Restore the context saved in SetTransform + ctx.restore(); + } +}; -module.exports = Camera; +module.exports = ArcCanvasRenderer; /***/ }), -/* 327 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 10369: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(38); +var Arc = __webpack_require__(28593); +var GameObjectFactory = __webpack_require__(61286); /** - * Converts a hex string into a Phaser Color object. - * - * The hex string can supplied as `'#0033ff'` or the short-hand format of `'#03f'`; it can begin with an optional "#" or "0x", or be unprefixed. + * Creates a new Arc Shape Game Object and adds it to the Scene. * - * An alpha channel is _not_ supported. + * Note: This method will only be available if the Arc Game Object has been built into Phaser. * - * @function Phaser.Display.Color.HexStringToColor - * @since 3.0.0 + * The Arc Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. * - * @param {string} hex - The hex color value to convert, such as `#0033ff` or the short-hand format: `#03f`. + * This shape supports both fill and stroke colors. * - * @return {Phaser.Display.Color} A Color object populated by the values of the given string. + * When it renders it displays an arc shape. You can control the start and end angles of the arc, + * as well as if the angles are winding clockwise or anti-clockwise. With the default settings + * it renders as a complete circle. By changing the angles you can create other arc shapes, + * such as half-circles. + * + * @method Phaser.GameObjects.GameObjectFactory#arc + * @since 3.13.0 + * + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [radius=128] - The radius of the arc. + * @param {number} [startAngle=0] - The start angle of the arc, in degrees. + * @param {number} [endAngle=360] - The end angle of the arc, in degrees. + * @param {boolean} [anticlockwise=false] - The winding order of the start and end angles. + * @param {number} [fillColor] - The color the arc will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the arc will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * + * @return {Phaser.GameObjects.Arc} The Game Object that was created. */ -var HexStringToColor = function (hex) +GameObjectFactory.register('arc', function (x, y, radius, startAngle, endAngle, anticlockwise, fillColor, fillAlpha) { - var color = new Color(); + return this.displayList.add(new Arc(this.scene, x, y, radius, startAngle, endAngle, anticlockwise, fillColor, fillAlpha)); +}); - // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") - hex = hex.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i, function (m, r, g, b) - { - return r + r + g + g + b + b; - }); +/** + * Creates a new Circle Shape Game Object and adds it to the Scene. + * + * A Circle is an Arc with no defined start and end angle, making it render as a complete circle. + * + * Note: This method will only be available if the Arc Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#circle + * @since 3.13.0 + * + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [radius=128] - The radius of the circle. + * @param {number} [fillColor] - The color the circle will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the circle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * + * @return {Phaser.GameObjects.Arc} The Game Object that was created. + */ +GameObjectFactory.register('circle', function (x, y, radius, fillColor, fillAlpha) +{ + return this.displayList.add(new Arc(this.scene, x, y, radius, 0, 360, false, fillColor, fillAlpha)); +}); - var result = (/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i).exec(hex); - if (result) - { - var r = parseInt(result[1], 16); - var g = parseInt(result[2], 16); - var b = parseInt(result[3], 16); +/***/ }), - color.setTo(r, g, b); - } +/***/ 2213: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return color; -}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = HexStringToColor; +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(58356); +} + +if (true) +{ + renderCanvas = __webpack_require__(23560); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; /***/ }), -/* 328 */ -/***/ (function(module, exports) { + +/***/ 58356: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var GetCalcMatrix = __webpack_require__(73329); +var FillPathWebGL = __webpack_require__(19543); +var StrokePathWebGL = __webpack_require__(50262); + /** - * Given an alpha and 3 color values this will return an integer representation of it. - * - * @function Phaser.Display.Color.GetColor32 - * @since 3.0.0 + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @param {number} red - The red color value. A number between 0 and 255. - * @param {number} green - The green color value. A number between 0 and 255. - * @param {number} blue - The blue color value. A number between 0 and 255. - * @param {number} alpha - The alpha color value. A number between 0 and 255. + * @method Phaser.GameObjects.Arc#renderWebGL + * @since 3.13.0 + * @private * - * @return {number} The combined color value. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Arc} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var GetColor32 = function (red, green, blue, alpha) +var ArcWebGLRenderer = function (renderer, src, camera, parentMatrix) { - return alpha << 24 | red << 16 | green << 8 | blue; + camera.addToRenderList(src); + + var pipeline = renderer.pipelines.set(src.pipeline); + + var result = GetCalcMatrix(src, camera, parentMatrix); + + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); + + var dx = src._displayOriginX; + var dy = src._displayOriginY; + + var alpha = camera.alpha * src.alpha; + + renderer.pipelines.preBatch(src); + + if (src.isFilled) + { + FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); + } + + if (src.isStroked) + { + StrokePathWebGL(pipeline, src, alpha, dx, dy); + } + + renderer.pipelines.postBatch(src); }; -module.exports = GetColor32; +module.exports = ArcWebGLRenderer; /***/ }), -/* 329 */ -/***/ (function(module, exports) { + +/***/ 15220: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var CurveRender = __webpack_require__(87203); +var Earcut = __webpack_require__(11117); +var Rectangle = __webpack_require__(74118); +var Shape = __webpack_require__(91461); + /** - * Converts an RGB color value to HSV (hue, saturation and value). - * Conversion formula from http://en.wikipedia.org/wiki/HSL_color_space. - * Assumes RGB values are contained in the set [0, 255] and returns h, s and v in the set [0, 1]. - * Based on code by Michael Jackson (https://github.com/mjijackson) + * @classdesc + * The Curve Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. * - * @function Phaser.Display.Color.RGBToHSV - * @since 3.0.0 + * This shape supports both fill and stroke colors. * - * @param {number} r - The red color value. A number between 0 and 255. - * @param {number} g - The green color value. A number between 0 and 255. - * @param {number} b - The blue color value. A number between 0 and 255. - * @param {(Phaser.Types.Display.HSVColorObject|Phaser.Display.Color)} [out] - An object to store the color values in. If not given an HSV Color Object will be created. + * To render a Curve Shape you must first create a `Phaser.Curves.Curve` object, then pass it to + * the Curve Shape in the constructor. * - * @return {(Phaser.Types.Display.HSVColorObject|Phaser.Display.Color)} An object with the properties `h`, `s` and `v` set. + * The Curve shape also has a `smoothness` property and corresponding `setSmoothness` method. + * This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations + * that take place during construction. Increase and decrease the default value for smoother, or more + * jagged, shapes. + * + * @class Curve + * @extends Phaser.GameObjects.Shape + * @memberof Phaser.GameObjects + * @constructor + * @since 3.13.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {Phaser.Curves.Curve} [curve] - The Curve object to use to create the Shape. + * @param {number} [fillColor] - The color the curve will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the curve will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. */ -var RGBToHSV = function (r, g, b, out) -{ - if (out === undefined) { out = { h: 0, s: 0, v: 0 }; } +var Curve = new Class({ - r /= 255; - g /= 255; - b /= 255; + Extends: Shape, - var min = Math.min(r, g, b); - var max = Math.max(r, g, b); - var d = max - min; + Mixins: [ + CurveRender + ], - // achromatic by default - var h = 0; - var s = (max === 0) ? 0 : d / max; - var v = max; + initialize: - if (max !== min) + function Curve (scene, x, y, curve, fillColor, fillAlpha) { - if (max === r) + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + Shape.call(this, scene, 'Curve', curve); + + /** + * Private internal value. + * The number of points used to draw the curve. Higher values create smoother renders at the cost of more triangles being drawn. + * + * @name Phaser.GameObjects.Curve#_smoothness + * @type {number} + * @private + * @since 3.13.0 + */ + this._smoothness = 32; + + /** + * Private internal value. + * The Curve bounds rectangle. + * + * @name Phaser.GameObjects.Curve#_curveBounds + * @type {Phaser.Geom.Rectangle} + * @private + * @since 3.13.0 + */ + this._curveBounds = new Rectangle(); + + this.closePath = false; + + this.setPosition(x, y); + + if (fillColor !== undefined) { - h = (g - b) / d + ((g < b) ? 6 : 0); + this.setFillStyle(fillColor, fillAlpha); } - else if (max === g) + + this.updateData(); + }, + + /** + * The smoothness of the curve. The number of points used when rendering it. + * Increase this value for smoother curves, at the cost of more polygons being rendered. + * + * @name Phaser.GameObjects.Curve#smoothness + * @type {number} + * @default 32 + * @since 3.13.0 + */ + smoothness: { + + get: function () { - h = (b - r) / d + 2; - } - else if (max === b) + return this._smoothness; + }, + + set: function (value) { - h = (r - g) / d + 4; + this._smoothness = value; + + this.updateData(); } - h /= 6; - } + }, - if (out.hasOwnProperty('_h')) + /** + * Sets the smoothness of the curve. The number of points used when rendering it. + * Increase this value for smoother curves, at the cost of more polygons being rendered. + * This call can be chained. + * + * @method Phaser.GameObjects.Curve#setSmoothness + * @since 3.13.0 + * + * @param {number} value - The value to set the smoothness to. + * + * @return {this} This Game Object instance. + */ + setSmoothness: function (value) { - out._h = h; - out._s = s; - out._v = v; - } - else + this._smoothness = value; + + return this.updateData(); + }, + + /** + * Internal method that updates the data and path values. + * + * @method Phaser.GameObjects.Curve#updateData + * @private + * @since 3.13.0 + * + * @return {this} This Game Object instance. + */ + updateData: function () { - out.h = h; - out.s = s; - out.v = v; + var bounds = this._curveBounds; + var smoothness = this._smoothness; + + // Update the bounds in case the underlying data has changed + this.geom.getBounds(bounds, smoothness); + + this.setSize(bounds.width, bounds.height); + this.updateDisplayOrigin(); + + var path = []; + var points = this.geom.getPoints(smoothness); + + for (var i = 0; i < points.length; i++) + { + path.push(points[i].x, points[i].y); + } + + path.push(points[0].x, points[0].y); + + this.pathIndexes = Earcut(path); + this.pathData = path; + + return this; } - return out; -}; +}); -module.exports = RGBToHSV; +module.exports = Curve; /***/ }), -/* 330 */ -/***/ (function(module, exports) { + +/***/ 4024: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var FillStyleCanvas = __webpack_require__(15608); +var LineStyleCanvas = __webpack_require__(17876); +var SetTransform = __webpack_require__(49584); + /** - * Return the component parts of a color as an Object with the properties alpha, red, green, blue. - * - * Alpha will only be set if it exists in the given color (0xAARRGGBB) - * - * @function Phaser.Display.Color.IntegerToRGB - * @since 3.0.0 + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @param {number} input - The color value to convert into a Color object. + * @method Phaser.GameObjects.Curve#renderCanvas + * @since 3.13.0 + * @private * - * @return {Phaser.Types.Display.ColorObject} An object with the red, green and blue values set in the r, g and b properties. + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Curve} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var IntegerToRGB = function (color) +var CurveCanvasRenderer = function (renderer, src, camera, parentMatrix) { - if (color > 16777215) - { - // The color value has an alpha component - return { - a: color >>> 24, - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF - }; - } - else + camera.addToRenderList(src); + + var ctx = renderer.currentContext; + + if (SetTransform(renderer, ctx, src, camera, parentMatrix)) { - return { - a: 255, - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF - }; + var dx = src._displayOriginX + src._curveBounds.x; + var dy = src._displayOriginY + src._curveBounds.y; + + var path = src.pathData; + var pathLength = path.length - 1; + + var px1 = path[0] - dx; + var py1 = path[1] - dy; + + ctx.beginPath(); + + ctx.moveTo(px1, py1); + + if (!src.closePath) + { + pathLength -= 2; + } + + for (var i = 2; i < pathLength; i += 2) + { + var px2 = path[i] - dx; + var py2 = path[i + 1] - dy; + + ctx.lineTo(px2, py2); + } + + if (src.closePath) + { + ctx.closePath(); + } + + if (src.isFilled) + { + FillStyleCanvas(ctx, src); + + ctx.fill(); + } + + if (src.isStroked) + { + LineStyleCanvas(ctx, src); + + ctx.stroke(); + } + + // Restore the context saved in SetTransform + ctx.restore(); } }; -module.exports = IntegerToRGB; +module.exports = CurveCanvasRenderer; /***/ }), -/* 331 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 10147: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(38); +var GameObjectFactory = __webpack_require__(61286); +var Curve = __webpack_require__(15220); /** - * Converts an object containing `r`, `g`, `b` and `a` properties into a Color class instance. + * Creates a new Curve Shape Game Object and adds it to the Scene. * - * @function Phaser.Display.Color.ObjectToColor - * @since 3.0.0 + * Note: This method will only be available if the Curve Game Object has been built into Phaser. * - * @param {Phaser.Types.Display.InputColorObject} input - An object containing `r`, `g`, `b` and `a` properties in the range 0 to 255. + * The Curve Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. * - * @return {Phaser.Display.Color} A Color object. + * This shape supports both fill and stroke colors. + * + * To render a Curve Shape you must first create a `Phaser.Curves.Curve` object, then pass it to + * the Curve Shape in the constructor. + * + * The Curve shape also has a `smoothness` property and corresponding `setSmoothness` method. + * This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations + * that take place during construction. Increase and decrease the default value for smoother, or more + * jagged, shapes. + * + * @method Phaser.GameObjects.GameObjectFactory#curve + * @since 3.13.0 + * + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {Phaser.Curves.Curve} [curve] - The Curve object to use to create the Shape. + * @param {number} [fillColor] - The color the curve will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the curve will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * + * @return {Phaser.GameObjects.Curve} The Game Object that was created. */ -var ObjectToColor = function (input) +GameObjectFactory.register('curve', function (x, y, curve, fillColor, fillAlpha) { - return new Color(input.r, input.g, input.b, input.a); -}; - -module.exports = ObjectToColor; + return this.displayList.add(new Curve(this.scene, x, y, curve, fillColor, fillAlpha)); +}); /***/ }), -/* 332 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 87203: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Color = __webpack_require__(38); +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; -/** - * Converts a CSS 'web' string into a Phaser Color object. - * - * The web string can be in the format `'rgb(r,g,b)'` or `'rgba(r,g,b,a)'` where r/g/b are in the range [0..255] and a is in the range [0..1]. - * - * @function Phaser.Display.Color.RGBStringToColor - * @since 3.0.0 - * - * @param {string} rgb - The CSS format color string, using the `rgb` or `rgba` format. - * - * @return {Phaser.Display.Color} A Color object. - */ -var RGBStringToColor = function (rgb) +if (true) { - var color = new Color(); + renderWebGL = __webpack_require__(82958); +} - var result = (/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/).exec(rgb.toLowerCase()); +if (true) +{ + renderCanvas = __webpack_require__(4024); +} - if (result) - { - var r = parseInt(result[1], 10); - var g = parseInt(result[2], 10); - var b = parseInt(result[3], 10); - var a = (result[4] !== undefined) ? parseFloat(result[4]) : 1; +module.exports = { - color.setTo(r, g, b, a * 255); - } + renderWebGL: renderWebGL, + renderCanvas: renderCanvas - return color; }; -module.exports = RGBStringToColor; - /***/ }), -/* 333 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 82958: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var FillPathWebGL = __webpack_require__(19543); +var GetCalcMatrix = __webpack_require__(73329); +var StrokePathWebGL = __webpack_require__(50262); + /** - * @namespace Phaser.Cameras.Scene2D.Effects + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Curve#renderWebGL + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Curve} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ +var CurveWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); -module.exports = { - - Fade: __webpack_require__(761), - Flash: __webpack_require__(762), - Pan: __webpack_require__(763), - Shake: __webpack_require__(796), - RotateTo: __webpack_require__(797), - Zoom: __webpack_require__(798) + var pipeline = renderer.pipelines.set(src.pipeline); -}; + var result = GetCalcMatrix(src, camera, parentMatrix); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); -/***/ }), -/* 334 */ -/***/ (function(module, exports, __webpack_require__) { + var dx = src._displayOriginX + src._curveBounds.x; + var dy = src._displayOriginY + src._curveBounds.y; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var alpha = camera.alpha * src.alpha; -/** - * @namespace Phaser.Math.Easing.Back - */ + renderer.pipelines.preBatch(src); -module.exports = { + if (src.isFilled) + { + FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); + } - In: __webpack_require__(764), - Out: __webpack_require__(765), - InOut: __webpack_require__(766) + if (src.isStroked) + { + StrokePathWebGL(pipeline, src, alpha, dx, dy); + } + renderer.pipelines.postBatch(src); }; +module.exports = CurveWebGLRenderer; + /***/ }), -/* 335 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 28591: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var Earcut = __webpack_require__(11117); +var EllipseRender = __webpack_require__(84171); +var GeomEllipse = __webpack_require__(95669); +var Shape = __webpack_require__(91461); + /** - * @namespace Phaser.Math.Easing.Bounce + * @classdesc + * The Ellipse Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. + * + * This shape supports both fill and stroke colors. + * + * When it renders it displays an ellipse shape. You can control the width and height of the ellipse. + * If the width and height match it will render as a circle. If the width is less than the height, + * it will look more like an egg shape. + * + * The Ellipse shape also has a `smoothness` property and corresponding `setSmoothness` method. + * This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations + * that take place during construction. Increase and decrease the default value for smoother, or more + * jagged, shapes. + * + * @class Ellipse + * @extends Phaser.GameObjects.Shape + * @memberof Phaser.GameObjects + * @constructor + * @since 3.13.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [width=128] - The width of the ellipse. An ellipse with equal width and height renders as a circle. + * @param {number} [height=128] - The height of the ellipse. An ellipse with equal width and height renders as a circle. + * @param {number} [fillColor] - The color the ellipse will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the ellipse will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. */ +var Ellipse = new Class({ -module.exports = { + Extends: Shape, - In: __webpack_require__(767), - Out: __webpack_require__(768), - InOut: __webpack_require__(769) + Mixins: [ + EllipseRender + ], -}; + initialize: + function Ellipse (scene, x, y, width, height, fillColor, fillAlpha) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 128; } + if (height === undefined) { height = 128; } -/***/ }), -/* 336 */ -/***/ (function(module, exports, __webpack_require__) { + Shape.call(this, scene, 'Ellipse', new GeomEllipse(width / 2, height / 2, width, height)); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Private internal value. + * The number of points used to draw the curve. Higher values create smoother renders at the cost of more triangles being drawn. + * + * @name Phaser.GameObjects.Ellipse#_smoothness + * @type {number} + * @private + * @since 3.13.0 + */ + this._smoothness = 64; -/** - * @namespace Phaser.Math.Easing.Circular - */ + this.setPosition(x, y); -module.exports = { + this.width = width; + this.height = height; - In: __webpack_require__(770), - Out: __webpack_require__(771), - InOut: __webpack_require__(772) + if (fillColor !== undefined) + { + this.setFillStyle(fillColor, fillAlpha); + } -}; + this.updateDisplayOrigin(); + this.updateData(); + }, + + /** + * The smoothness of the ellipse. The number of points used when rendering it. + * Increase this value for a smoother ellipse, at the cost of more polygons being rendered. + * + * @name Phaser.GameObjects.Ellipse#smoothness + * @type {number} + * @default 64 + * @since 3.13.0 + */ + smoothness: { + get: function () + { + return this._smoothness; + }, -/***/ }), -/* 337 */ -/***/ (function(module, exports, __webpack_require__) { + set: function (value) + { + this._smoothness = value; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.updateData(); + } -/** - * @namespace Phaser.Math.Easing.Cubic - */ + }, -module.exports = { + /** + * Sets the size of the ellipse by changing the underlying geometry data, rather than scaling the object. + * This call can be chained. + * + * @method Phaser.GameObjects.Ellipse#setSize + * @since 3.13.0 + * + * @param {number} width - The width of the ellipse. + * @param {number} height - The height of the ellipse. + * + * @return {this} This Game Object instance. + */ + setSize: function (width, height) + { + this.width = width; + this.height = height; + this.geom.setPosition(width / 2, height / 2); + this.geom.setSize(width, height); - In: __webpack_require__(773), - Out: __webpack_require__(774), - InOut: __webpack_require__(775) + return this.updateData(); + }, -}; + /** + * Sets the smoothness of the ellipse. The number of points used when rendering it. + * Increase this value for a smoother ellipse, at the cost of more polygons being rendered. + * This call can be chained. + * + * @method Phaser.GameObjects.Ellipse#setSmoothness + * @since 3.13.0 + * + * @param {number} value - The value to set the smoothness to. + * + * @return {this} This Game Object instance. + */ + setSmoothness: function (value) + { + this._smoothness = value; + return this.updateData(); + }, -/***/ }), -/* 338 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Internal method that updates the data and path values. + * + * @method Phaser.GameObjects.Ellipse#updateData + * @private + * @since 3.13.0 + * + * @return {this} This Game Object instance. + */ + updateData: function () + { + var path = []; + var points = this.geom.getPoints(this._smoothness); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (var i = 0; i < points.length; i++) + { + path.push(points[i].x, points[i].y); + } -/** - * @namespace Phaser.Math.Easing.Elastic - */ + path.push(points[0].x, points[0].y); -module.exports = { + this.pathIndexes = Earcut(path); + this.pathData = path; + + return this; + } - In: __webpack_require__(776), - Out: __webpack_require__(777), - InOut: __webpack_require__(778) +}); -}; +module.exports = Ellipse; /***/ }), -/* 339 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 55881: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var FillStyleCanvas = __webpack_require__(15608); +var LineStyleCanvas = __webpack_require__(17876); +var SetTransform = __webpack_require__(49584); + /** - * @namespace Phaser.Math.Easing.Expo + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Ellipse#renderCanvas + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Ellipse} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ +var EllipseCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); -module.exports = { + var ctx = renderer.currentContext; - In: __webpack_require__(779), - Out: __webpack_require__(780), - InOut: __webpack_require__(781) + if (SetTransform(renderer, ctx, src, camera, parentMatrix)) + { + var dx = src._displayOriginX; + var dy = src._displayOriginY; -}; + var path = src.pathData; + var pathLength = path.length - 1; + var px1 = path[0] - dx; + var py1 = path[1] - dy; -/***/ }), -/* 340 */ -/***/ (function(module, exports, __webpack_require__) { + ctx.beginPath(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + ctx.moveTo(px1, py1); -module.exports = __webpack_require__(782); + if (!src.closePath) + { + pathLength -= 2; + } + for (var i = 2; i < pathLength; i += 2) + { + var px2 = path[i] - dx; + var py2 = path[i + 1] - dy; -/***/ }), -/* 341 */ -/***/ (function(module, exports, __webpack_require__) { + ctx.lineTo(px2, py2); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + ctx.closePath(); -/** - * @namespace Phaser.Math.Easing.Quadratic - */ + if (src.isFilled) + { + FillStyleCanvas(ctx, src); -module.exports = { + ctx.fill(); + } + + if (src.isStroked) + { + LineStyleCanvas(ctx, src); - In: __webpack_require__(783), - Out: __webpack_require__(784), - InOut: __webpack_require__(785) + ctx.stroke(); + } + // Restore the context saved in SetTransform + ctx.restore(); + } }; +module.exports = EllipseCanvasRenderer; + /***/ }), -/* 342 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 99869: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Ellipse = __webpack_require__(28591); +var GameObjectFactory = __webpack_require__(61286); + /** - * @namespace Phaser.Math.Easing.Quartic + * Creates a new Ellipse Shape Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Ellipse Game Object has been built into Phaser. + * + * The Ellipse Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. + * + * This shape supports both fill and stroke colors. + * + * When it renders it displays an ellipse shape. You can control the width and height of the ellipse. + * If the width and height match it will render as a circle. If the width is less than the height, + * it will look more like an egg shape. + * + * The Ellipse shape also has a `smoothness` property and corresponding `setSmoothness` method. + * This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations + * that take place during construction. Increase and decrease the default value for smoother, or more + * jagged, shapes. + * + * @method Phaser.GameObjects.GameObjectFactory#ellipse + * @since 3.13.0 + * + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [width=128] - The width of the ellipse. An ellipse with equal width and height renders as a circle. + * @param {number} [height=128] - The height of the ellipse. An ellipse with equal width and height renders as a circle. + * @param {number} [fillColor] - The color the ellipse will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the ellipse will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * + * @return {Phaser.GameObjects.Ellipse} The Game Object that was created. */ - -module.exports = { - - In: __webpack_require__(786), - Out: __webpack_require__(787), - InOut: __webpack_require__(788) - -}; +GameObjectFactory.register('ellipse', function (x, y, width, height, fillColor, fillAlpha) +{ + return this.displayList.add(new Ellipse(this.scene, x, y, width, height, fillColor, fillAlpha)); +}); /***/ }), -/* 343 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 84171: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @namespace Phaser.Math.Easing.Quintic - */ +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(17554); +} + +if (true) +{ + renderCanvas = __webpack_require__(55881); +} module.exports = { - In: __webpack_require__(789), - Out: __webpack_require__(790), - InOut: __webpack_require__(791) + renderWebGL: renderWebGL, + renderCanvas: renderCanvas }; /***/ }), -/* 344 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 17554: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var FillPathWebGL = __webpack_require__(19543); +var GetCalcMatrix = __webpack_require__(73329); +var StrokePathWebGL = __webpack_require__(50262); + /** - * @namespace Phaser.Math.Easing.Sine + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Ellipse#renderWebGL + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Ellipse} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ +var EllipseWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); -module.exports = { + var pipeline = renderer.pipelines.set(src.pipeline); - In: __webpack_require__(792), - Out: __webpack_require__(793), - InOut: __webpack_require__(794) + var result = GetCalcMatrix(src, camera, parentMatrix); -}; + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); + var dx = src._displayOriginX; + var dy = src._displayOriginY; -/***/ }), -/* 345 */ -/***/ (function(module, exports, __webpack_require__) { + var alpha = camera.alpha * src.alpha; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + renderer.pipelines.preBatch(src); -/** - * @namespace Phaser.Math.Easing.Stepped - */ + if (src.isFilled) + { + FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); + } + + if (src.isStroked) + { + StrokePathWebGL(pipeline, src, alpha, dx, dy); + } + + renderer.pipelines.postBatch(src); +}; -module.exports = __webpack_require__(795); +module.exports = EllipseWebGLRenderer; /***/ }), -/* 346 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 39169: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(33); -var Device = __webpack_require__(347); -var GetFastValue = __webpack_require__(2); -var GetValue = __webpack_require__(6); -var IsPlainObject = __webpack_require__(7); -var PhaserMath = __webpack_require__(193); -var NOOP = __webpack_require__(1); -var DefaultPlugins = __webpack_require__(197); -var ValueToColor = __webpack_require__(187); +var Class = __webpack_require__(56694); +var Shape = __webpack_require__(91461); +var GridRender = __webpack_require__(88059); /** * @classdesc - * The active game configuration settings, parsed from a {@link Phaser.Types.Core.GameConfig} object. + * The Grid Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. * - * @class Config - * @memberof Phaser.Core - * @constructor - * @since 3.0.0 + * This shape supports only fill colors and cannot be stroked. * - * @param {Phaser.Types.Core.GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. + * A Grid Shape allows you to display a grid in your game, where you can control the size of the + * grid as well as the width and height of the grid cells. You can set a fill color for each grid + * cell as well as an alternate fill color. When the alternate fill color is set then the grid + * cells will alternate the fill colors as they render, creating a chess-board effect. You can + * also optionally have an outline fill color. If set, this draws lines between the grid cells + * in the given color. If you specify an outline color with an alpha of zero, then it will draw + * the cells spaced out, but without the lines between them. * - * @see Phaser.Game#config + * @class Grid + * @extends Phaser.GameObjects.Shape + * @memberof Phaser.GameObjects + * @constructor + * @since 3.13.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [width=128] - The width of the grid. + * @param {number} [height=128] - The height of the grid. + * @param {number} [cellWidth=32] - The width of one cell in the grid. + * @param {number} [cellHeight=32] - The height of one cell in the grid. + * @param {number} [fillColor] - The color the grid cells will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * @param {number} [outlineFillColor] - The color of the lines between the grid cells. See the `setOutline` method. + * @param {number} [outlineFillAlpha] - The alpha of the lines between the grid cells. */ -var Config = new Class({ +var Grid = new Class({ + + Extends: Shape, + + Mixins: [ + GridRender + ], initialize: - function Config (config) + function Grid (scene, x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha) { - if (config === undefined) { config = {}; } - - var defaultBannerColor = [ - '#ff0000', - '#ffff00', - '#00ff00', - '#00ffff', - '#000000' - ]; + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 128; } + if (height === undefined) { height = 128; } + if (cellWidth === undefined) { cellWidth = 32; } + if (cellHeight === undefined) { cellHeight = 32; } - var defaultBannerTextColor = '#ffffff'; + Shape.call(this, scene, 'Grid', null); /** - * @const {(number|string)} Phaser.Core.Config#width - The width of the underlying canvas, in pixels. + * The width of each grid cell. + * Must be a positive value. + * + * @name Phaser.GameObjects.Grid#cellWidth + * @type {number} + * @since 3.13.0 */ - this.width = GetValue(config, 'width', 1024); + this.cellWidth = cellWidth; /** - * @const {(number|string)} Phaser.Core.Config#height - The height of the underlying canvas, in pixels. + * The height of each grid cell. + * Must be a positive value. + * + * @name Phaser.GameObjects.Grid#cellHeight + * @type {number} + * @since 3.13.0 */ - this.height = GetValue(config, 'height', 768); + this.cellHeight = cellHeight; /** - * @const {(Phaser.Scale.ZoomType|number)} Phaser.Core.Config#zoom - The zoom factor, as used by the Scale Manager. + * Will the grid render its cells in the `fillColor`? + * + * @name Phaser.GameObjects.Grid#showCells + * @type {boolean} + * @since 3.13.0 */ - this.zoom = GetValue(config, 'zoom', 1); + this.showCells = true; /** - * @const {?*} Phaser.Core.Config#parent - A parent DOM element into which the canvas created by the renderer will be injected. + * The color of the lines between each grid cell. + * + * @name Phaser.GameObjects.Grid#outlineFillColor + * @type {number} + * @since 3.13.0 */ - this.parent = GetValue(config, 'parent', undefined); + this.outlineFillColor = 0; /** - * @const {Phaser.Scale.ScaleModeType} Phaser.Core.Config#scaleMode - The scale mode as used by the Scale Manager. The default is zero, which is no scaling. + * The alpha value for the color of the lines between each grid cell. + * + * @name Phaser.GameObjects.Grid#outlineFillAlpha + * @type {number} + * @since 3.13.0 */ - this.scaleMode = GetValue(config, 'scaleMode', 0); + this.outlineFillAlpha = 0; /** - * @const {boolean} Phaser.Core.Config#expandParent - Is the Scale Manager allowed to adjust the CSS height property of the parent to be 100%? + * Will the grid display the lines between each cell when it renders? + * + * @name Phaser.GameObjects.Grid#showOutline + * @type {boolean} + * @since 3.13.0 */ - this.expandParent = GetValue(config, 'expandParent', true); + this.showOutline = true; /** - * @const {boolean} Phaser.Core.Config#autoRound - Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices. + * Will the grid render the alternating cells in the `altFillColor`? + * + * @name Phaser.GameObjects.Grid#showAltCells + * @type {boolean} + * @since 3.13.0 */ - this.autoRound = GetValue(config, 'autoRound', false); + this.showAltCells = false; /** - * @const {Phaser.Scale.CenterType} Phaser.Core.Config#autoCenter - Automatically center the canvas within the parent? + * The color the alternating grid cells will be filled with, i.e. 0xff0000 for red. + * + * @name Phaser.GameObjects.Grid#altFillColor + * @type {number} + * @since 3.13.0 */ - this.autoCenter = GetValue(config, 'autoCenter', 0); + this.altFillColor; /** - * @const {number} Phaser.Core.Config#resizeInterval - How many ms should elapse before checking if the browser size has changed? + * The alpha the alternating grid cells will be filled with. + * You can also set the alpha of the overall Shape using its `alpha` property. + * + * @name Phaser.GameObjects.Grid#altFillAlpha + * @type {number} + * @since 3.13.0 */ - this.resizeInterval = GetValue(config, 'resizeInterval', 500); + this.altFillAlpha; - /** - * @const {?(HTMLElement|string)} Phaser.Core.Config#fullscreenTarget - The DOM element that will be sent into full screen mode, or its `id`. If undefined Phaser will create its own div and insert the canvas into it when entering fullscreen mode. - */ - this.fullscreenTarget = GetValue(config, 'fullscreenTarget', null); + this.setPosition(x, y); + this.setSize(width, height); - /** - * @const {number} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum. - */ - this.minWidth = GetValue(config, 'minWidth', 0); + this.setFillStyle(fillColor, fillAlpha); - /** - * @const {number} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum. - */ - this.maxWidth = GetValue(config, 'maxWidth', 0); + if (outlineFillColor !== undefined) + { + this.setOutlineStyle(outlineFillColor, outlineFillAlpha); + } - /** - * @const {number} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum. - */ - this.minHeight = GetValue(config, 'minHeight', 0); + this.updateDisplayOrigin(); + }, - /** - * @const {number} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum. - */ - this.maxHeight = GetValue(config, 'maxHeight', 0); + /** + * Sets the fill color and alpha level the grid cells will use when rendering. + * + * If this method is called with no values then the grid cells will not be rendered, + * however the grid lines and alternating cells may still be. + * + * Also see the `setOutlineStyle` and `setAltFillStyle` methods. + * + * This call can be chained. + * + * @method Phaser.GameObjects.Grid#setFillStyle + * @since 3.13.0 + * + * @param {number} [fillColor] - The color the grid cells will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha=1] - The alpha the grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * + * @return {this} This Game Object instance. + */ + setFillStyle: function (fillColor, fillAlpha) + { + if (fillAlpha === undefined) { fillAlpha = 1; } + + if (fillColor === undefined) + { + this.showCells = false; + } + else + { + this.fillColor = fillColor; + this.fillAlpha = fillAlpha; + this.showCells = true; + } - // Scale Manager - Anything set in here over-rides anything set above + return this; + }, - var scaleConfig = GetValue(config, 'scale', null); + /** + * Sets the fill color and alpha level that the alternating grid cells will use. + * + * If this method is called with no values then alternating grid cells will not be rendered in a different color. + * + * Also see the `setOutlineStyle` and `setFillStyle` methods. + * + * This call can be chained. + * + * @method Phaser.GameObjects.Grid#setAltFillStyle + * @since 3.13.0 + * + * @param {number} [fillColor] - The color the alternating grid cells will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha=1] - The alpha the alternating grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * + * @return {this} This Game Object instance. + */ + setAltFillStyle: function (fillColor, fillAlpha) + { + if (fillAlpha === undefined) { fillAlpha = 1; } - if (scaleConfig) + if (fillColor === undefined) + { + this.showAltCells = false; + } + else { - this.width = GetValue(scaleConfig, 'width', this.width); - this.height = GetValue(scaleConfig, 'height', this.height); - this.zoom = GetValue(scaleConfig, 'zoom', this.zoom); - this.parent = GetValue(scaleConfig, 'parent', this.parent); - this.scaleMode = GetValue(scaleConfig, 'mode', this.scaleMode); - this.expandParent = GetValue(scaleConfig, 'expandParent', this.expandParent); - this.autoRound = GetValue(scaleConfig, 'autoRound', this.autoRound); - this.autoCenter = GetValue(scaleConfig, 'autoCenter', this.autoCenter); - this.resizeInterval = GetValue(scaleConfig, 'resizeInterval', this.resizeInterval); - this.fullscreenTarget = GetValue(scaleConfig, 'fullscreenTarget', this.fullscreenTarget); - this.minWidth = GetValue(scaleConfig, 'min.width', this.minWidth); - this.maxWidth = GetValue(scaleConfig, 'max.width', this.maxWidth); - this.minHeight = GetValue(scaleConfig, 'min.height', this.minHeight); - this.maxHeight = GetValue(scaleConfig, 'max.height', this.maxHeight); + this.altFillColor = fillColor; + this.altFillAlpha = fillAlpha; + this.showAltCells = true; } - /** - * @const {number} Phaser.Core.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default) - */ - this.renderType = GetValue(config, 'type', CONST.AUTO); + return this; + }, - /** - * @const {?HTMLCanvasElement} Phaser.Core.Config#canvas - Force Phaser to use your own Canvas element instead of creating one. - */ - this.canvas = GetValue(config, 'canvas', null); + /** + * Sets the fill color and alpha level that the lines between each grid cell will use. + * + * If this method is called with no values then the grid lines will not be rendered at all, however + * the cells themselves may still be if they have colors set. + * + * Also see the `setFillStyle` and `setAltFillStyle` methods. + * + * This call can be chained. + * + * @method Phaser.GameObjects.Grid#setOutlineStyle + * @since 3.13.0 + * + * @param {number} [fillColor] - The color the lines between the grid cells will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha=1] - The alpha the lines between the grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * + * @return {this} This Game Object instance. + */ + setOutlineStyle: function (fillColor, fillAlpha) + { + if (fillAlpha === undefined) { fillAlpha = 1; } - /** - * @const {?(CanvasRenderingContext2D|WebGLRenderingContext)} Phaser.Core.Config#context - Force Phaser to use your own Canvas context instead of creating one. - */ - this.context = GetValue(config, 'context', null); + if (fillColor === undefined) + { + this.showOutline = false; + } + else + { + this.outlineFillColor = fillColor; + this.outlineFillAlpha = fillAlpha; + this.showOutline = true; + } - /** - * @const {?string} Phaser.Core.Config#canvasStyle - Optional CSS attributes to be set on the canvas object created by the renderer. - */ - this.canvasStyle = GetValue(config, 'canvasStyle', null); + return this; + } - /** - * @const {boolean} Phaser.Core.Config#customEnvironment - Is Phaser running under a custom (non-native web) environment? If so, set this to `true` to skip internal Feature detection. If `true` the `renderType` cannot be left as `AUTO`. - */ - this.customEnvironment = GetValue(config, 'customEnvironment', false); +}); - /** - * @const {?object} Phaser.Core.Config#sceneConfig - The default Scene configuration object. - */ - this.sceneConfig = GetValue(config, 'scene', null); +module.exports = Grid; - /** - * @const {string[]} Phaser.Core.Config#seed - A seed which the Random Data Generator will use. If not given, a dynamic seed based on the time is used. - */ - this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]); - PhaserMath.RND = new PhaserMath.RandomDataGenerator(this.seed); +/***/ }), - /** - * @const {string} Phaser.Core.Config#gameTitle - The title of the game. - */ - this.gameTitle = GetValue(config, 'title', ''); +/***/ 95525: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * @const {string} Phaser.Core.Config#gameURL - The URL of the game. - */ - this.gameURL = GetValue(config, 'url', 'https://phaser.io'); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * @const {string} Phaser.Core.Config#gameVersion - The version of the game. - */ - this.gameVersion = GetValue(config, 'version', ''); +var FillStyleCanvas = __webpack_require__(15608); +var LineStyleCanvas = __webpack_require__(17876); +var SetTransform = __webpack_require__(49584); - /** - * @const {boolean} Phaser.Core.Config#autoFocus - If `true` the window will automatically be given focus immediately and on any future mousedown event. - */ - this.autoFocus = GetValue(config, 'autoFocus', true); +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Grid#renderCanvas + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Grid} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var GridCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - // DOM Element Container + var ctx = renderer.currentContext; - /** - * @const {?boolean} Phaser.Core.Config#domCreateContainer - Should the game create a div element to act as a DOM Container? Only enable if you're using DOM Element objects. You must provide a parent object if you use this feature. - */ - this.domCreateContainer = GetValue(config, 'dom.createContainer', false); + if (SetTransform(renderer, ctx, src, camera, parentMatrix)) + { + var dx = -src._displayOriginX; + var dy = -src._displayOriginY; - /** - * @const {?boolean} Phaser.Core.Config#domBehindCanvas - Should the DOM Container that is created (if `dom.createContainer` is true) be positioned behind (true) or over the top (false, the default) of the game canvas? - */ - this.domBehindCanvas = GetValue(config, 'dom.behindCanvas', false); + var alpha = camera.alpha * src.alpha; - /** - * @const {?string} Phaser.Core.Config#domPointerEvents - The default `pointerEvents` attribute set on the DOM Container. - */ - this.domPointerEvents = GetValue(config, 'dom.pointerEvents', 'none'); + // Work out the grid size - // Input + var width = src.width; + var height = src.height; - /** - * @const {boolean} Phaser.Core.Config#inputKeyboard - Enable the Keyboard Plugin. This can be disabled in games that don't need keyboard input. - */ - this.inputKeyboard = GetValue(config, 'input.keyboard', true); + var cellWidth = src.cellWidth; + var cellHeight = src.cellHeight; - /** - * @const {*} Phaser.Core.Config#inputKeyboardEventTarget - The DOM Target to listen for keyboard events on. Defaults to `window` if not specified. - */ - this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window); + var gridWidth = Math.ceil(width / cellWidth); + var gridHeight = Math.ceil(height / cellHeight); - /** - * @const {?number[]} Phaser.Core.Config#inputKeyboardCapture - `preventDefault` will be called on every non-modified key which has a key code in this array. By default, it is empty. - */ - this.inputKeyboardCapture = GetValue(config, 'input.keyboard.capture', []); + var cellWidthA = cellWidth; + var cellHeightA = cellHeight; - /** - * @const {(boolean|object)} Phaser.Core.Config#inputMouse - Enable the Mouse Plugin. This can be disabled in games that don't need mouse input. - */ - this.inputMouse = GetValue(config, 'input.mouse', true); + var cellWidthB = cellWidth - ((gridWidth * cellWidth) - width); + var cellHeightB = cellHeight - ((gridHeight * cellHeight) - height); - /** - * @const {?*} Phaser.Core.Config#inputMouseEventTarget - The DOM Target to listen for mouse events on. Defaults to the game canvas if not specified. - */ - this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null); + var showCells = src.showCells; + var showAltCells = src.showAltCells; + var showOutline = src.showOutline; - /** - * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultDown - Should `mousedown` DOM events have `preventDefault` called on them? - */ - this.inputMousePreventDefaultDown = GetValue(config, 'input.mouse.preventDefaultDown', true); + var x = 0; + var y = 0; + var r = 0; + var cw = 0; + var ch = 0; - /** - * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultUp - Should `mouseup` DOM events have `preventDefault` called on them? - */ - this.inputMousePreventDefaultUp = GetValue(config, 'input.mouse.preventDefaultUp', true); + if (showOutline) + { + // To make room for the grid lines (in case alpha < 1) + cellWidthA--; + cellHeightA--; - /** - * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultMove - Should `mousemove` DOM events have `preventDefault` called on them? - */ - this.inputMousePreventDefaultMove = GetValue(config, 'input.mouse.preventDefaultMove', true); + if (cellWidthB === cellWidth) + { + cellWidthB--; + } - /** - * @const {boolean} Phaser.Core.Config#inputMousePreventDefaultWheel - Should `wheel` DOM events have `preventDefault` called on them? - */ - this.inputMousePreventDefaultWheel = GetValue(config, 'input.mouse.preventDefaultWheel', true); + if (cellHeightB === cellHeight) + { + cellHeightB--; + } + } - /** - * @const {boolean} Phaser.Core.Config#inputTouch - Enable the Touch Plugin. This can be disabled in games that don't need touch input. - */ - this.inputTouch = GetValue(config, 'input.touch', Device.input.touch); + if (showCells && src.fillAlpha > 0) + { + FillStyleCanvas(ctx, src); - /** - * @const {?*} Phaser.Core.Config#inputTouchEventTarget - The DOM Target to listen for touch events on. Defaults to the game canvas if not specified. - */ - this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null); + for (y = 0; y < gridHeight; y++) + { + if (showAltCells) + { + r = y % 2; + } - /** - * @const {boolean} Phaser.Core.Config#inputTouchCapture - Should touch events be captured? I.e. have prevent default called on them. - */ - this.inputTouchCapture = GetValue(config, 'input.touch.capture', true); + for (x = 0; x < gridWidth; x++) + { + if (showAltCells && r) + { + r = 0; + continue; + } - /** - * @const {number} Phaser.Core.Config#inputActivePointers - The number of Pointer objects created by default. In a mouse-only, or non-multi touch game, you can leave this as 1. - */ - this.inputActivePointers = GetValue(config, 'input.activePointers', 1); + r++; - /** - * @const {number} Phaser.Core.Config#inputSmoothFactor - The smoothing factor to apply during Pointer movement. See {@link Phaser.Input.Pointer#smoothFactor}. - */ - this.inputSmoothFactor = GetValue(config, 'input.smoothFactor', 0); + cw = (x < gridWidth - 1) ? cellWidthA : cellWidthB; + ch = (y < gridHeight - 1) ? cellHeightA : cellHeightB; - /** - * @const {boolean} Phaser.Core.Config#inputWindowEvents - Should Phaser listen for input events on the Window? If you disable this, events like 'POINTER_UP_OUTSIDE' will no longer fire. - */ - this.inputWindowEvents = GetValue(config, 'input.windowEvents', true); + ctx.fillRect( + dx + x * cellWidth, + dy + y * cellHeight, + cw, + ch + ); + } + } + } - /** - * @const {boolean} Phaser.Core.Config#inputGamepad - Enable the Gamepad Plugin. This can be disabled in games that don't need gamepad input. - */ - this.inputGamepad = GetValue(config, 'input.gamepad', false); + if (showAltCells && src.altFillAlpha > 0) + { + FillStyleCanvas(ctx, src, src.altFillColor, src.altFillAlpha * alpha); - /** - * @const {*} Phaser.Core.Config#inputGamepadEventTarget - The DOM Target to listen for gamepad events on. Defaults to `window` if not specified. - */ - this.inputGamepadEventTarget = GetValue(config, 'input.gamepad.target', window); + for (y = 0; y < gridHeight; y++) + { + if (showAltCells) + { + r = y % 2; + } - /** - * @const {boolean} Phaser.Core.Config#disableContextMenu - Set to `true` to disable the right-click context menu. - */ - this.disableContextMenu = GetValue(config, 'disableContextMenu', false); + for (x = 0; x < gridWidth; x++) + { + if (showAltCells && !r) + { + r = 1; + continue; + } - /** - * @const {Phaser.Types.Core.AudioConfig} Phaser.Core.Config#audio - The Audio Configuration object. - */ - this.audio = GetValue(config, 'audio', {}); + r = 0; - // If you do: { banner: false } it won't display any banner at all + cw = (x < gridWidth - 1) ? cellWidthA : cellWidthB; + ch = (y < gridHeight - 1) ? cellHeightA : cellHeightB; - /** - * @const {boolean} Phaser.Core.Config#hideBanner - Don't write the banner line to the console.log. - */ - this.hideBanner = (GetValue(config, 'banner', null) === false); + ctx.fillRect( + dx + x * cellWidth, + dy + y * cellHeight, + cw, + ch + ); + } + } + } - /** - * @const {boolean} Phaser.Core.Config#hidePhaser - Omit Phaser's name and version from the banner. - */ - this.hidePhaser = GetValue(config, 'banner.hidePhaser', false); + if (showOutline && src.outlineFillAlpha > 0) + { + LineStyleCanvas(ctx, src, src.outlineFillColor, src.outlineFillAlpha * alpha); - /** - * @const {string} Phaser.Core.Config#bannerTextColor - The color of the banner text. - */ - this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor); + for (x = 1; x < gridWidth; x++) + { + var x1 = x * cellWidth; - /** - * @const {string[]} Phaser.Core.Config#bannerBackgroundColor - The background colors of the banner. - */ - this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor); + ctx.beginPath(); - if (this.gameTitle === '' && this.hidePhaser) - { - this.hideBanner = true; + ctx.moveTo(x1 + dx, dy); + ctx.lineTo(x1 + dx, height + dy); + + ctx.stroke(); + } + + for (y = 1; y < gridHeight; y++) + { + var y1 = y * cellHeight; + + ctx.beginPath(); + + ctx.moveTo(dx, y1 + dy); + ctx.lineTo(dx + width, y1 + dy); + + ctx.stroke(); + } } - /** - * @const {Phaser.Types.Core.FPSConfig} Phaser.Core.Config#fps - The Frame Rate Configuration object, as parsed by the Timestep class. - */ - this.fps = GetValue(config, 'fps', null); + // Restore the context saved in SetTransform + ctx.restore(); + } +}; - // Renderer Settings - // These can either be in a `render` object within the Config, or specified on their own +module.exports = GridCanvasRenderer; - var renderConfig = GetValue(config, 'render', config); - /** - * @const {Phaser.Types.Core.PipelineConfig} Phaser.Core.Config#pipeline - An object mapping WebGL names to WebGLPipeline classes. These should be class constructors, not instances. - */ - this.pipeline = GetValue(renderConfig, 'pipeline', null); +/***/ }), - /** - * @const {boolean} Phaser.Core.Config#antialias - When set to `true`, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set to `false`, WebGL uses nearest-neighbor interpolation, giving a crisper appearance. `false` also disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled. - */ - this.antialias = GetValue(renderConfig, 'antialias', true); +/***/ 9326: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - /** - * @const {boolean} Phaser.Core.Config#antialiasGL - Sets the `antialias` property when the WebGL context is created. Setting this value does not impact any subsequent textures that are created, or the canvas style attributes. - */ - this.antialiasGL = GetValue(renderConfig, 'antialiasGL', true); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * @const {string} Phaser.Core.Config#mipmapFilter - Sets the `mipmapFilter` property when the WebGL renderer is created. - */ - this.mipmapFilter = GetValue(renderConfig, 'mipmapFilter', 'LINEAR'); +var GameObjectFactory = __webpack_require__(61286); +var Grid = __webpack_require__(39169); - /** - * @const {boolean} Phaser.Core.Config#desynchronized - When set to `true` it will create a desynchronized context for both 2D and WebGL. See https://developers.google.com/web/updates/2019/05/desynchronized for details. - */ - this.desynchronized = GetValue(renderConfig, 'desynchronized', false); +/** + * Creates a new Grid Shape Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Grid Game Object has been built into Phaser. + * + * The Grid Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. + * + * This shape supports only fill colors and cannot be stroked. + * + * A Grid Shape allows you to display a grid in your game, where you can control the size of the + * grid as well as the width and height of the grid cells. You can set a fill color for each grid + * cell as well as an alternate fill color. When the alternate fill color is set then the grid + * cells will alternate the fill colors as they render, creating a chess-board effect. You can + * also optionally have an outline fill color. If set, this draws lines between the grid cells + * in the given color. If you specify an outline color with an alpha of zero, then it will draw + * the cells spaced out, but without the lines between them. + * + * @method Phaser.GameObjects.GameObjectFactory#grid + * @since 3.13.0 + * + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [width=128] - The width of the grid. + * @param {number} [height=128] - The height of the grid. + * @param {number} [cellWidth=32] - The width of one cell in the grid. + * @param {number} [cellHeight=32] - The height of one cell in the grid. + * @param {number} [fillColor] - The color the grid cells will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * @param {number} [outlineFillColor] - The color of the lines between the grid cells. + * @param {number} [outlineFillAlpha] - The alpha of the lines between the grid cells. + * + * @return {Phaser.GameObjects.Grid} The Game Object that was created. + */ +GameObjectFactory.register('grid', function (x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha) +{ + return this.displayList.add(new Grid(this.scene, x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha)); +}); - /** - * @const {boolean} Phaser.Core.Config#roundPixels - Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. - */ - this.roundPixels = GetValue(renderConfig, 'roundPixels', false); - /** - * @const {boolean} Phaser.Core.Config#pixelArt - Prevent pixel art from becoming blurred when scaled. It will remain crisp (tells the WebGL renderer to automatically create textures using a linear filter mode). - */ - this.pixelArt = GetValue(renderConfig, 'pixelArt', this.zoom !== 1); +/***/ }), - if (this.pixelArt) - { - this.antialias = false; - this.antialiasGL = false; - this.roundPixels = true; - } +/***/ 88059: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * @const {boolean} Phaser.Core.Config#transparent - Whether the game canvas will have a transparent background. - */ - this.transparent = GetValue(renderConfig, 'transparent', false); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * @const {boolean} Phaser.Core.Config#clearBeforeRender - Whether the game canvas will be cleared between each rendering frame. You can disable this if you have a full-screen background image or game object. - */ - this.clearBeforeRender = GetValue(renderConfig, 'clearBeforeRender', true); +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - /** - * @const {boolean} Phaser.Core.Config#preserveDrawingBuffer - If the value is true the WebGL buffers will not be cleared and will preserve their values until cleared or overwritten by the author. - */ - this.preserveDrawingBuffer = GetValue(renderConfig, 'preserveDrawingBuffer', false); +if (true) +{ + renderWebGL = __webpack_require__(50639); +} - /** - * @const {boolean} Phaser.Core.Config#premultipliedAlpha - In WebGL mode, sets the drawing buffer to contain colors with pre-multiplied alpha. - */ - this.premultipliedAlpha = GetValue(renderConfig, 'premultipliedAlpha', true); +if (true) +{ + renderCanvas = __webpack_require__(95525); +} - /** - * @const {boolean} Phaser.Core.Config#failIfMajorPerformanceCaveat - Let the browser abort creating a WebGL context if it judges performance would be unacceptable. - */ - this.failIfMajorPerformanceCaveat = GetValue(renderConfig, 'failIfMajorPerformanceCaveat', false); +module.exports = { - /** - * @const {string} Phaser.Core.Config#powerPreference - "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use. - */ - this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default'); + renderWebGL: renderWebGL, + renderCanvas: renderCanvas - /** - * @const {number} Phaser.Core.Config#batchSize - The default WebGL Batch size. Represents the number of _quads_ that can be added to a single batch. - */ - this.batchSize = GetValue(renderConfig, 'batchSize', 4096); +}; - /** - * @const {number} Phaser.Core.Config#maxTextures - When in WebGL mode, this sets the maximum number of GPU Textures to use. The default, -1, will use all available units. The WebGL1 spec says all browsers should provide a minimum of 8. - */ - this.maxTextures = GetValue(renderConfig, 'maxTextures', -1); - /** - * @const {number} Phaser.Core.Config#maxLights - The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. - */ - this.maxLights = GetValue(renderConfig, 'maxLights', 10); +/***/ }), - var bgc = GetValue(config, 'backgroundColor', 0); +/***/ 50639: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * @const {Phaser.Display.Color} Phaser.Core.Config#backgroundColor - The background color of the game canvas. The default is black. This value is ignored if `transparent` is set to `true`. - */ - this.backgroundColor = ValueToColor(bgc); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (this.transparent) - { - this.backgroundColor = ValueToColor(0x000000); - this.backgroundColor.alpha = 0; - } +var GetCalcMatrix = __webpack_require__(73329); +var Utils = __webpack_require__(75512); - /** - * @const {Phaser.Types.Core.BootCallback} Phaser.Core.Config#preBoot - Called before Phaser boots. Useful for initializing anything not related to Phaser that Phaser may require while booting. - */ - this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP); +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Grid#renderWebGL + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Grid} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var GridWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - /** - * @const {Phaser.Types.Core.BootCallback} Phaser.Core.Config#postBoot - A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded. - */ - this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP); + var pipeline = renderer.pipelines.set(src.pipeline); - /** - * @const {Phaser.Types.Core.PhysicsConfig} Phaser.Core.Config#physics - The Physics Configuration object. - */ - this.physics = GetValue(config, 'physics', {}); + var result = GetCalcMatrix(src, camera, parentMatrix); - /** - * @const {(boolean|string)} Phaser.Core.Config#defaultPhysicsSystem - The default physics system. It will be started for each scene. Either 'arcade', 'impact' or 'matter'. - */ - this.defaultPhysicsSystem = GetValue(this.physics, 'default', false); + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); - /** - * @const {string} Phaser.Core.Config#loaderBaseURL - A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'. - */ - this.loaderBaseURL = GetValue(config, 'loader.baseURL', ''); + calcMatrix.translate(-src._displayOriginX, -src._displayOriginY); - /** - * @const {string} Phaser.Core.Config#loaderPath - A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'. - */ - this.loaderPath = GetValue(config, 'loader.path', ''); + var alpha = camera.alpha * src.alpha; - /** - * @const {number} Phaser.Core.Config#loaderMaxParallelDownloads - Maximum parallel downloads allowed for resources (Default to 32). - */ - var defaultParallel = (Device.os.android) ? 6 : 32; + // Work out the grid size - this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', defaultParallel); + var width = src.width; + var height = src.height; - /** - * @const {(string|undefined)} Phaser.Core.Config#loaderCrossOrigin - 'anonymous', 'use-credentials', or `undefined`. If you're not making cross-origin requests, leave this as `undefined`. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes}. - */ - this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined); + var cellWidth = src.cellWidth; + var cellHeight = src.cellHeight; - /** - * @const {string} Phaser.Core.Config#loaderResponseType - The response type of the XHR request, e.g. `blob`, `text`, etc. - */ - this.loaderResponseType = GetValue(config, 'loader.responseType', ''); + var gridWidth = Math.ceil(width / cellWidth); + var gridHeight = Math.ceil(height / cellHeight); - /** - * @const {boolean} Phaser.Core.Config#loaderAsync - Should the XHR request use async or not? - */ - this.loaderAsync = GetValue(config, 'loader.async', true); + var cellWidthA = cellWidth; + var cellHeightA = cellHeight; - /** - * @const {string} Phaser.Core.Config#loaderUser - Optional username for all XHR requests. - */ - this.loaderUser = GetValue(config, 'loader.user', ''); + var cellWidthB = cellWidth - ((gridWidth * cellWidth) - width); + var cellHeightB = cellHeight - ((gridHeight * cellHeight) - height); - /** - * @const {string} Phaser.Core.Config#loaderPassword - Optional password for all XHR requests. - */ - this.loaderPassword = GetValue(config, 'loader.password', ''); + var fillTint; + var fillTintColor; - /** - * @const {number} Phaser.Core.Config#loaderTimeout - Optional XHR timeout value, in ms. - */ - this.loaderTimeout = GetValue(config, 'loader.timeout', 0); + var showCells = src.showCells; + var showAltCells = src.showAltCells; + var showOutline = src.showOutline; - /** - * @const {boolean} Phaser.Core.Config#loaderWithCredentials - Optional XHR withCredentials value. - */ - this.loaderWithCredentials = GetValue(config, 'loader.withCredentials', false); + var x = 0; + var y = 0; + var r = 0; + var cw = 0; + var ch = 0; - /* - * Allows `plugins` property to either be an array, in which case it just replaces - * the default plugins like previously, or a config object. - * - * plugins: { - * global: [ - * { key: 'TestPlugin', plugin: TestPlugin, start: true, data: { msg: 'The plugin is alive' } }, - * ], - * scene: [ - * { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } - * ], - * default: [], OR - * defaultMerge: [ - * 'ModPlayer' - * ] - * } - */ + if (showOutline) + { + // To make room for the grid lines (in case alpha < 1) + cellWidthA--; + cellHeightA--; - /** - * @const {any} Phaser.Core.Config#installGlobalPlugins - An array of global plugins to be installed. - */ - this.installGlobalPlugins = []; + if (cellWidthB === cellWidth) + { + cellWidthB--; + } - /** - * @const {any} Phaser.Core.Config#installScenePlugins - An array of Scene level plugins to be installed. - */ - this.installScenePlugins = []; + if (cellHeightB === cellHeight) + { + cellHeightB--; + } + } - var plugins = GetValue(config, 'plugins', null); - var defaultPlugins = DefaultPlugins.DefaultScene; + renderer.pipelines.preBatch(src); - if (plugins) + if (showCells && src.fillAlpha > 0) + { + fillTint = pipeline.fillTint; + fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); + + fillTint.TL = fillTintColor; + fillTint.TR = fillTintColor; + fillTint.BL = fillTintColor; + fillTint.BR = fillTintColor; + + for (y = 0; y < gridHeight; y++) { - // Old 3.7 array format? - if (Array.isArray(plugins)) + if (showAltCells) { - this.defaultPlugins = plugins; + r = y % 2; } - else if (IsPlainObject(plugins)) - { - this.installGlobalPlugins = GetFastValue(plugins, 'global', []); - this.installScenePlugins = GetFastValue(plugins, 'scene', []); - if (Array.isArray(plugins.default)) - { - defaultPlugins = plugins.default; - } - else if (Array.isArray(plugins.defaultMerge)) + for (x = 0; x < gridWidth; x++) + { + if (showAltCells && r) { - defaultPlugins = defaultPlugins.concat(plugins.defaultMerge); + r = 0; + continue; } - } - } - /** - * @const {any} Phaser.Core.Config#defaultPlugins - The plugins installed into every Scene (in addition to CoreScene and Global). - */ - this.defaultPlugins = defaultPlugins; + r++; - // Default / Missing Images - var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg'; + cw = (x < gridWidth - 1) ? cellWidthA : cellWidthB; + ch = (y < gridHeight - 1) ? cellHeightA : cellHeightB; - /** - * @const {string} Phaser.Core.Config#defaultImage - A base64 encoded PNG that will be used as the default blank texture. - */ - this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg=='); + pipeline.batchFillRect( + x * cellWidth, + y * cellHeight, + cw, + ch + ); + } + } + } - /** - * @const {string} Phaser.Core.Config#missingImage - A base64 encoded PNG that will be used as the default texture when a texture is assigned that is missing or not loaded. - */ - this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=='); + if (showAltCells && src.altFillAlpha > 0) + { + fillTint = pipeline.fillTint; + fillTintColor = Utils.getTintAppendFloatAlpha(src.altFillColor, src.altFillAlpha * alpha); - /** - * @const {string} Phaser.Core.Config#whiteImage - A base64 encoded PNG that will be used as the default texture when a texture is assigned that is white or not loaded. - */ - this.whiteImage = GetValue(config, 'images.white', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABdJREFUeNpi/P//PwMMMDEgAdwcgAADAJZuAwXJYZOzAAAAAElFTkSuQmCC'); + fillTint.TL = fillTintColor; + fillTint.TR = fillTintColor; + fillTint.BL = fillTintColor; + fillTint.BR = fillTintColor; - if (window) + for (y = 0; y < gridHeight; y++) { - if (window.FORCE_WEBGL) - { - this.renderType = CONST.WEBGL; - } - else if (window.FORCE_CANVAS) + if (showAltCells) { - this.renderType = CONST.CANVAS; + r = y % 2; } - } - } -}); + for (x = 0; x < gridWidth; x++) + { + if (showAltCells && !r) + { + r = 1; + continue; + } -module.exports = Config; + r = 0; + cw = (x < gridWidth - 1) ? cellWidthA : cellWidthB; + ch = (y < gridHeight - 1) ? cellHeightA : cellHeightB; -/***/ }), -/* 347 */ -/***/ (function(module, exports, __webpack_require__) { + pipeline.batchFillRect( + x * cellWidth, + y * cellHeight, + cw, + ch + ); + } + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (showOutline && src.outlineFillAlpha > 0) + { + var strokeTint = pipeline.strokeTint; + var color = Utils.getTintAppendFloatAlpha(src.outlineFillColor, src.outlineFillAlpha * alpha); -// This singleton is instantiated as soon as Phaser loads, -// before a Phaser.Game instance has even been created. -// Which means all instances of Phaser Games can share it, -// without having to re-poll the device all over again + strokeTint.TL = color; + strokeTint.TR = color; + strokeTint.BL = color; + strokeTint.BR = color; -/** - * @namespace Phaser.Device - * @since 3.0.0 - */ + for (x = 1; x < gridWidth; x++) + { + var x1 = x * cellWidth; -/** - * @typedef {object} Phaser.DeviceConf - * - * @property {Phaser.Device.OS} os - The OS Device functions. - * @property {Phaser.Device.Browser} browser - The Browser Device functions. - * @property {Phaser.Device.Features} features - The Features Device functions. - * @property {Phaser.Device.Input} input - The Input Device functions. - * @property {Phaser.Device.Audio} audio - The Audio Device functions. - * @property {Phaser.Device.Video} video - The Video Device functions. - * @property {Phaser.Device.Fullscreen} fullscreen - The Fullscreen Device functions. - * @property {Phaser.Device.CanvasFeatures} canvasFeatures - The Canvas Device functions. - */ + pipeline.batchLine(x1, 0, x1, height, 1, 1, 1, 0, false); + } -module.exports = { + for (y = 1; y < gridHeight; y++) + { + var y1 = y * cellHeight; - os: __webpack_require__(105), - browser: __webpack_require__(136), - features: __webpack_require__(191), - input: __webpack_require__(808), - audio: __webpack_require__(809), - video: __webpack_require__(810), - fullscreen: __webpack_require__(811), - canvasFeatures: __webpack_require__(348) + pipeline.batchLine(0, y1, width, y1, 1, 1, 1, 0, false); + } + } + renderer.pipelines.postBatch(src); }; +module.exports = GridWebGLRenderer; + /***/ }), -/* 348 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 4415: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(31); +var IsoBoxRender = __webpack_require__(72296); +var Class = __webpack_require__(56694); +var Shape = __webpack_require__(91461); /** - * Determines the canvas features of the browser running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.canvasFeatures` from within any Scene. + * @classdesc + * The IsoBox Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. * - * @typedef {object} Phaser.Device.CanvasFeatures - * @since 3.0.0 + * This shape supports only fill colors and cannot be stroked. * - * @property {boolean} supportInverseAlpha - Set to true if the browser supports inversed alpha. - * @property {boolean} supportNewBlendModes - Set to true if the browser supports new canvas blend modes. - */ -var CanvasFeatures = { - - supportInverseAlpha: false, - supportNewBlendModes: false - -}; - -function checkBlendMode () -{ - var pngHead = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABAQMAAADD8p2OAAAAA1BMVEX/'; - var pngEnd = 'AAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg=='; - - var magenta = new Image(); + * An IsoBox is an 'isometric' rectangle. Each face of it has a different fill color. You can set + * the color of the top, left and right faces of the rectangle respectively. You can also choose + * which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties. + * + * You cannot view an IsoBox from under-neath, however you can change the 'angle' by setting + * the `projection` property. + * + * @class IsoBox + * @extends Phaser.GameObjects.Shape + * @memberof Phaser.GameObjects + * @constructor + * @since 3.13.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [size=48] - The width of the iso box in pixels. The left and right faces will be exactly half this value. + * @param {number} [height=32] - The height of the iso box. The left and right faces will be this tall. The overall height of the isobox will be this value plus half the `size` value. + * @param {number} [fillTop=0xeeeeee] - The fill color of the top face of the iso box. + * @param {number} [fillLeft=0x999999] - The fill color of the left face of the iso box. + * @param {number} [fillRight=0xcccccc] - The fill color of the right face of the iso box. + */ +var IsoBox = new Class({ - magenta.onload = function () - { - var yellow = new Image(); + Extends: Shape, - yellow.onload = function () - { - var canvas = CanvasPool.create(yellow, 6, 1); - var context = canvas.getContext('2d'); + Mixins: [ + IsoBoxRender + ], - context.globalCompositeOperation = 'multiply'; + initialize: - context.drawImage(magenta, 0, 0); - context.drawImage(yellow, 2, 0); + function IsoBox (scene, x, y, size, height, fillTop, fillLeft, fillRight) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (size === undefined) { size = 48; } + if (height === undefined) { height = 32; } + if (fillTop === undefined) { fillTop = 0xeeeeee; } + if (fillLeft === undefined) { fillLeft = 0x999999; } + if (fillRight === undefined) { fillRight = 0xcccccc; } - if (!context.getImageData(2, 0, 1, 1)) - { - return false; - } + Shape.call(this, scene, 'IsoBox', null); - var data = context.getImageData(2, 0, 1, 1).data; + /** + * The projection level of the iso box. Change this to change the 'angle' at which you are looking at the box. + * + * @name Phaser.GameObjects.IsoBox#projection + * @type {number} + * @default 4 + * @since 3.13.0 + */ + this.projection = 4; - CanvasPool.remove(yellow); + /** + * The color used to fill in the top of the iso box. + * + * @name Phaser.GameObjects.IsoBox#fillTop + * @type {number} + * @since 3.13.0 + */ + this.fillTop = fillTop; - CanvasFeatures.supportNewBlendModes = (data[0] === 255 && data[1] === 0 && data[2] === 0); - }; + /** + * The color used to fill in the left-facing side of the iso box. + * + * @name Phaser.GameObjects.IsoBox#fillLeft + * @type {number} + * @since 3.13.0 + */ + this.fillLeft = fillLeft; - yellow.src = pngHead + '/wCKxvRF' + pngEnd; - }; + /** + * The color used to fill in the right-facing side of the iso box. + * + * @name Phaser.GameObjects.IsoBox#fillRight + * @type {number} + * @since 3.13.0 + */ + this.fillRight = fillRight; - magenta.src = pngHead + 'AP804Oa6' + pngEnd; + /** + * Controls if the top-face of the iso box be rendered. + * + * @name Phaser.GameObjects.IsoBox#showTop + * @type {boolean} + * @default true + * @since 3.13.0 + */ + this.showTop = true; - return false; -} + /** + * Controls if the left-face of the iso box be rendered. + * + * @name Phaser.GameObjects.IsoBox#showLeft + * @type {boolean} + * @default true + * @since 3.13.0 + */ + this.showLeft = true; -function checkInverseAlpha () -{ - var canvas = CanvasPool.create(this, 2, 1); - var context = canvas.getContext('2d'); + /** + * Controls if the right-face of the iso box be rendered. + * + * @name Phaser.GameObjects.IsoBox#showRight + * @type {boolean} + * @default true + * @since 3.13.0 + */ + this.showRight = true; - context.fillStyle = 'rgba(10, 20, 30, 0.5)'; + this.isFilled = true; - // Draw a single pixel - context.fillRect(0, 0, 1, 1); + this.setPosition(x, y); + this.setSize(size, height); - // Get the color values - var s1 = context.getImageData(0, 0, 1, 1); + this.updateDisplayOrigin(); + }, - if (s1 === null) + /** + * Sets the projection level of the iso box. Change this to change the 'angle' at which you are looking at the box. + * This call can be chained. + * + * @method Phaser.GameObjects.IsoBox#setProjection + * @since 3.13.0 + * + * @param {number} value - The value to set the projection to. + * + * @return {this} This Game Object instance. + */ + setProjection: function (value) { - return false; - } - - // Plot them to x2 - context.putImageData(s1, 1, 0); - - // Get those values - var s2 = context.getImageData(1, 0, 1, 1); + this.projection = value; - // Compare and return - return (s2.data[0] === s1.data[0] && s2.data[1] === s1.data[1] && s2.data[2] === s1.data[2] && s2.data[3] === s1.data[3]); -} + return this; + }, -function init () -{ - if (typeof importScripts !== 'function' && document !== undefined) + /** + * Sets which faces of the iso box will be rendered. + * This call can be chained. + * + * @method Phaser.GameObjects.IsoBox#setFaces + * @since 3.13.0 + * + * @param {boolean} [showTop=true] - Show the top-face of the iso box. + * @param {boolean} [showLeft=true] - Show the left-face of the iso box. + * @param {boolean} [showRight=true] - Show the right-face of the iso box. + * + * @return {this} This Game Object instance. + */ + setFaces: function (showTop, showLeft, showRight) { - CanvasFeatures.supportNewBlendModes = checkBlendMode(); - CanvasFeatures.supportInverseAlpha = checkInverseAlpha(); - } + if (showTop === undefined) { showTop = true; } + if (showLeft === undefined) { showLeft = true; } + if (showRight === undefined) { showRight = true; } - return CanvasFeatures; -} + this.showTop = showTop; + this.showLeft = showLeft; + this.showRight = showRight; -module.exports = init(); + return this; + }, + /** + * Sets the fill colors for each face of the iso box. + * This call can be chained. + * + * @method Phaser.GameObjects.IsoBox#setFillStyle + * @since 3.13.0 + * + * @param {number} [fillTop] - The color used to fill the top of the iso box. + * @param {number} [fillLeft] - The color used to fill in the left-facing side of the iso box. + * @param {number} [fillRight] - The color used to fill in the right-facing side of the iso box. + * + * @return {this} This Game Object instance. + */ + setFillStyle: function (fillTop, fillLeft, fillRight) + { + this.fillTop = fillTop; + this.fillLeft = fillLeft; + this.fillRight = fillRight; -/***/ }), -/* 349 */ -/***/ (function(module, exports) { + this.isFilled = true; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + } -/** - * Find the angle of a segment from (x1, y1) -> (x2, y2). - * - * @function Phaser.Math.Angle.Between - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The angle in radians. - */ -var Between = function (x1, y1, x2, y2) -{ - return Math.atan2(y2 - y1, x2 - x1); -}; +}); -module.exports = Between; +module.exports = IsoBox; /***/ }), -/* 350 */ -/***/ (function(module, exports) { + +/***/ 32884: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var FillStyleCanvas = __webpack_require__(15608); +var SetTransform = __webpack_require__(49584); + /** - * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). - * - * Calculates the angle of the vector from the first point to the second point. - * - * @function Phaser.Math.Angle.BetweenPoints - * @since 3.0.0 + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @param {Phaser.Types.Math.Vector2Like} point1 - The first point. - * @param {Phaser.Types.Math.Vector2Like} point2 - The second point. + * @method Phaser.GameObjects.IsoBox#renderCanvas + * @since 3.13.0 + * @private * - * @return {number} The angle in radians. + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.IsoBox} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var BetweenPoints = function (point1, point2) +var IsoBoxCanvasRenderer = function (renderer, src, camera, parentMatrix) { - return Math.atan2(point2.y - point1.y, point2.x - point1.x); -}; + camera.addToRenderList(src); -module.exports = BetweenPoints; + var ctx = renderer.currentContext; + if (SetTransform(renderer, ctx, src, camera, parentMatrix) && src.isFilled) + { + var size = src.width; + var height = src.height; -/***/ }), -/* 351 */ -/***/ (function(module, exports) { + var sizeA = size / 2; + var sizeB = size / src.projection; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Top Face -/** - * Normalize an angle to the [0, 2pi] range. - * - * @function Phaser.Math.Angle.Normalize - * @since 3.0.0 - * - * @param {number} angle - The angle to normalize, in radians. - * - * @return {number} The normalized angle, in radians. - */ -var Normalize = function (angle) -{ - angle = angle % (2 * Math.PI); + if (src.showTop) + { + FillStyleCanvas(ctx, src, src.fillTop); - if (angle >= 0) - { - return angle; - } - else - { - return angle + 2 * Math.PI; - } -}; + ctx.beginPath(); -module.exports = Normalize; + ctx.moveTo(-sizeA, -height); + ctx.lineTo(0, -sizeB - height); + ctx.lineTo(sizeA, -height); + ctx.lineTo(sizeA, -1); + ctx.lineTo(0, sizeB - 1); + ctx.lineTo(-sizeA, -1); + ctx.lineTo(-sizeA, -height); + ctx.fill(); + } -/***/ }), -/* 352 */ -/***/ (function(module, exports) { + // Left Face -/** - * @author samme - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (src.showLeft) + { + FillStyleCanvas(ctx, src, src.fillLeft); -/** - * Calculate the distance between two points. - * - * @function Phaser.Math.Distance.BetweenPoints - * @since 3.22.0 - * - * @param {Phaser.Types.Math.Vector2Like} a - The first point. - * @param {Phaser.Types.Math.Vector2Like} b - The second point. - * - * @return {number} The distance between the points. - */ -var DistanceBetweenPoints = function (a, b) -{ - var dx = a.x - b.x; - var dy = a.y - b.y; + ctx.beginPath(); - return Math.sqrt(dx * dx + dy * dy); -}; + ctx.moveTo(-sizeA, 0); + ctx.lineTo(0, sizeB); + ctx.lineTo(0, sizeB - height); + ctx.lineTo(-sizeA, -height); + ctx.lineTo(-sizeA, 0); -module.exports = DistanceBetweenPoints; + ctx.fill(); + } + // Right Face -/***/ }), -/* 353 */ -/***/ (function(module, exports) { + if (src.showRight) + { + FillStyleCanvas(ctx, src, src.fillRight); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + ctx.beginPath(); -/** - * Calculate the distance between two sets of coordinates (points), squared. - * - * @function Phaser.Math.Distance.Squared - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The distance between each point, squared. - */ -var DistanceSquared = function (x1, y1, x2, y2) -{ - var dx = x1 - x2; - var dy = y1 - y2; + ctx.moveTo(sizeA, 0); + ctx.lineTo(0, sizeB); + ctx.lineTo(0, sizeB - height); + ctx.lineTo(sizeA, -height); + ctx.lineTo(sizeA, 0); - return dx * dx + dy * dy; + ctx.fill(); + } + + // Restore the context saved in SetTransform + ctx.restore(); + } }; -module.exports = DistanceSquared; +module.exports = IsoBoxCanvasRenderer; /***/ }), -/* 354 */ -/***/ (function(module, exports) { + +/***/ 88154: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var GameObjectFactory = __webpack_require__(61286); +var IsoBox = __webpack_require__(4415); + /** - * Check whether `a` is fuzzily greater than `b`. + * Creates a new IsoBox Shape Game Object and adds it to the Scene. * - * `a` is fuzzily greater than `b` if it is more than `b - epsilon`. + * Note: This method will only be available if the IsoBox Game Object has been built into Phaser. * - * @function Phaser.Math.Fuzzy.GreaterThan - * @since 3.0.0 + * The IsoBox Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. * - * @param {number} a - The first value. - * @param {number} b - The second value. - * @param {number} [epsilon=0.0001] - The epsilon. + * This shape supports only fill colors and cannot be stroked. * - * @return {boolean} `true` if `a` is fuzzily greater than than `b`, otherwise `false`. - */ -var GreaterThan = function (a, b, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } - - return a > b - epsilon; -}; - -module.exports = GreaterThan; - - -/***/ }), -/* 355 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Check whether `a` is fuzzily less than `b`. + * An IsoBox is an 'isometric' rectangle. Each face of it has a different fill color. You can set + * the color of the top, left and right faces of the rectangle respectively. You can also choose + * which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties. * - * `a` is fuzzily less than `b` if it is less than `b + epsilon`. + * You cannot view an IsoBox from under-neath, however you can change the 'angle' by setting + * the `projection` property. * - * @function Phaser.Math.Fuzzy.LessThan - * @since 3.0.0 + * @method Phaser.GameObjects.GameObjectFactory#isobox + * @since 3.13.0 * - * @param {number} a - The first value. - * @param {number} b - The second value. - * @param {number} [epsilon=0.0001] - The epsilon. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [size=48] - The width of the iso box in pixels. The left and right faces will be exactly half this value. + * @param {number} [height=32] - The height of the iso box. The left and right faces will be this tall. The overall height of the isobox will be this value plus half the `size` value. + * @param {number} [fillTop=0xeeeeee] - The fill color of the top face of the iso box. + * @param {number} [fillLeft=0x999999] - The fill color of the left face of the iso box. + * @param {number} [fillRight=0xcccccc] - The fill color of the right face of the iso box. * - * @return {boolean} `true` if `a` is fuzzily less than `b`, otherwise `false`. + * @return {Phaser.GameObjects.IsoBox} The Game Object that was created. */ -var LessThan = function (a, b, epsilon) +GameObjectFactory.register('isobox', function (x, y, size, height, fillTop, fillLeft, fillRight) { - if (epsilon === undefined) { epsilon = 0.0001; } - - return a < b + epsilon; -}; - -module.exports = LessThan; + return this.displayList.add(new IsoBox(this.scene, x, y, size, height, fillTop, fillLeft, fillRight)); +}); /***/ }), -/* 356 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 72296: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Factorial = __webpack_require__(357); +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; -/** - * Calculates the Bernstein basis from the three factorial coefficients. - * - * @function Phaser.Math.Bernstein - * @since 3.0.0 - * - * @param {number} n - The first value. - * @param {number} i - The second value. - * - * @return {number} The Bernstein basis of Factorial(n) / Factorial(i) / Factorial(n - i) - */ -var Bernstein = function (n, i) +if (true) { - return Factorial(n) / Factorial(i) / Factorial(n - i); -}; + renderWebGL = __webpack_require__(33101); +} -module.exports = Bernstein; +if (true) +{ + renderCanvas = __webpack_require__(32884); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; /***/ }), -/* 357 */ -/***/ (function(module, exports) { + +/***/ 33101: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var GetCalcMatrix = __webpack_require__(73329); +var Utils = __webpack_require__(75512); + /** - * Calculates the factorial of a given number for integer values greater than 0. - * - * @function Phaser.Math.Factorial - * @since 3.0.0 + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @param {number} value - A positive integer to calculate the factorial of. + * @method Phaser.GameObjects.IsoBox#renderWebGL + * @since 3.13.0 + * @private * - * @return {number} The factorial of the given number. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.IsoBox} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var Factorial = function (value) +var IsoBoxWebGLRenderer = function (renderer, src, camera, parentMatrix) { - if (value === 0) - { - return 1; - } + camera.addToRenderList(src); - var res = value; + var pipeline = renderer.pipelines.set(src.pipeline); - while (--value) - { - res *= value; - } + var result = GetCalcMatrix(src, camera, parentMatrix); - return res; -}; + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); -module.exports = Factorial; + var size = src.width; + var height = src.height; + var sizeA = size / 2; + var sizeB = size / src.projection; -/***/ }), -/* 358 */ -/***/ (function(module, exports) { + var alpha = camera.alpha * src.alpha; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (!src.isFilled) + { + return; + } -/** - * @ignore - */ -function P0 (t, p) -{ - var k = 1 - t; + var tint; - return k * k * k * p; -} + var x0; + var y0; -/** - * @ignore - */ -function P1 (t, p) -{ - var k = 1 - t; + var x1; + var y1; - return 3 * k * k * t * p; -} + var x2; + var y2; -/** - * @ignore - */ -function P2 (t, p) -{ - return 3 * (1 - t) * t * t * p; -} + var x3; + var y3; -/** - * @ignore - */ -function P3 (t, p) -{ - return t * t * t * p; -} -/** - * A cubic bezier interpolation method. - * - * https://medium.com/@adrian_cooney/bezier-interpolation-13b68563313a - * - * @function Phaser.Math.Interpolation.CubicBezier - * @since 3.0.0 - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} p0 - The start point. - * @param {number} p1 - The first control point. - * @param {number} p2 - The second control point. - * @param {number} p3 - The end point. - * - * @return {number} The interpolated value. - */ -var CubicBezierInterpolation = function (t, p0, p1, p2, p3) -{ - return P0(t, p0) + P1(t, p1) + P2(t, p2) + P3(t, p3); -}; + renderer.pipelines.preBatch(src); -module.exports = CubicBezierInterpolation; + // Top Face + if (src.showTop) + { + tint = Utils.getTintAppendFloatAlpha(src.fillTop, alpha); -/***/ }), -/* 359 */ -/***/ (function(module, exports) { + x0 = calcMatrix.getX(-sizeA, -height); + y0 = calcMatrix.getY(-sizeA, -height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + x1 = calcMatrix.getX(0, -sizeB - height); + y1 = calcMatrix.getY(0, -sizeB - height); -/** - * @ignore - */ -function P0 (t, p) -{ - var k = 1 - t; + x2 = calcMatrix.getX(sizeA, -height); + y2 = calcMatrix.getY(sizeA, -height); - return k * k * p; -} + x3 = calcMatrix.getX(0, sizeB - height); + y3 = calcMatrix.getY(0, sizeB - height); -/** - * @ignore - */ -function P1 (t, p) -{ - return 2 * (1 - t) * t * p; -} + pipeline.batchQuad(src, x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); + } -/** - * @ignore - */ -function P2 (t, p) -{ - return t * t * p; -} + // Left Face -// https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js + if (src.showLeft) + { + tint = Utils.getTintAppendFloatAlpha(src.fillLeft, alpha); -/** - * A quadratic bezier interpolation method. - * - * @function Phaser.Math.Interpolation.QuadraticBezier - * @since 3.2.0 - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} p0 - The start point. - * @param {number} p1 - The control point. - * @param {number} p2 - The end point. - * - * @return {number} The interpolated value. - */ -var QuadraticBezierInterpolation = function (t, p0, p1, p2) -{ - return P0(t, p0) + P1(t, p1) + P2(t, p2); -}; + x0 = calcMatrix.getX(-sizeA, 0); + y0 = calcMatrix.getY(-sizeA, 0); -module.exports = QuadraticBezierInterpolation; + x1 = calcMatrix.getX(0, sizeB); + y1 = calcMatrix.getY(0, sizeB); + x2 = calcMatrix.getX(0, sizeB - height); + y2 = calcMatrix.getY(0, sizeB - height); -/***/ }), -/* 360 */ -/***/ (function(module, exports, __webpack_require__) { + x3 = calcMatrix.getX(-sizeA, -height); + y3 = calcMatrix.getY(-sizeA, -height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + pipeline.batchQuad(src, x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); + } -var SmoothStep = __webpack_require__(184); + // Right Face -/** - * A Smooth Step interpolation method. - * - * @function Phaser.Math.Interpolation.SmoothStep - * @since 3.9.0 - * @see {@link https://en.wikipedia.org/wiki/Smoothstep} - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. - * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. - * - * @return {number} The interpolated value. - */ -var SmoothStepInterpolation = function (t, min, max) -{ - return min + (max - min) * SmoothStep(t, 0, 1); -}; + if (src.showRight) + { + tint = Utils.getTintAppendFloatAlpha(src.fillRight, alpha); -module.exports = SmoothStepInterpolation; + x0 = calcMatrix.getX(sizeA, 0); + y0 = calcMatrix.getY(sizeA, 0); + x1 = calcMatrix.getX(0, sizeB); + y1 = calcMatrix.getY(0, sizeB); -/***/ }), -/* 361 */ -/***/ (function(module, exports) { + x2 = calcMatrix.getX(0, sizeB - height); + y2 = calcMatrix.getY(0, sizeB - height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + x3 = calcMatrix.getX(sizeA, -height); + y3 = calcMatrix.getY(sizeA, -height); -/** - * Returns the nearest power of 2 to the given `value`. - * - * @function Phaser.Math.Pow2.GetNext - * @since 3.0.0 - * - * @param {number} value - The value. - * - * @return {number} The nearest power of 2 to `value`. - */ -var GetPowerOfTwo = function (value) -{ - var index = Math.log(value) / 0.6931471805599453; + pipeline.batchQuad(src, x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); + } - return (1 << Math.ceil(index)); + renderer.pipelines.postBatch(src); }; -module.exports = GetPowerOfTwo; +module.exports = IsoBoxWebGLRenderer; /***/ }), -/* 362 */ -/***/ (function(module, exports) { + +/***/ 65159: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var IsoTriangleRender = __webpack_require__(93387); +var Shape = __webpack_require__(91461); + /** - * Rotate a given point by a given angle around the origin (0, 0), in an anti-clockwise direction. + * @classdesc + * The IsoTriangle Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. * - * @function Phaser.Math.Rotate - * @since 3.0.0 + * This shape supports only fill colors and cannot be stroked. * - * @param {(Phaser.Geom.Point|object)} point - The point to be rotated. - * @param {number} angle - The angle to be rotated by in an anticlockwise direction. + * An IsoTriangle is an 'isometric' triangle. Think of it like a pyramid. Each face has a different + * fill color. You can set the color of the top, left and right faces of the triangle respectively + * You can also choose which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties. * - * @return {Phaser.Geom.Point} The given point, rotated by the given angle in an anticlockwise direction. + * You cannot view an IsoTriangle from under-neath, however you can change the 'angle' by setting + * the `projection` property. The `reversed` property controls if the IsoTriangle is rendered upside + * down or not. + * + * @class IsoTriangle + * @extends Phaser.GameObjects.Shape + * @memberof Phaser.GameObjects + * @constructor + * @since 3.13.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [size=48] - The width of the iso triangle in pixels. The left and right faces will be exactly half this value. + * @param {number} [height=32] - The height of the iso triangle. The left and right faces will be this tall. The overall height of the iso triangle will be this value plus half the `size` value. + * @param {boolean} [reversed=false] - Is the iso triangle upside down? + * @param {number} [fillTop=0xeeeeee] - The fill color of the top face of the iso triangle. + * @param {number} [fillLeft=0x999999] - The fill color of the left face of the iso triangle. + * @param {number} [fillRight=0xcccccc] - The fill color of the right face of the iso triangle. */ -var Rotate = function (point, angle) -{ - var x = point.x; - var y = point.y; - - point.x = (x * Math.cos(angle)) - (y * Math.sin(angle)); - point.y = (x * Math.sin(angle)) + (y * Math.cos(angle)); - - return point; -}; - -module.exports = Rotate; +var IsoTriangle = new Class({ + Extends: Shape, -/***/ }), -/* 363 */ -/***/ (function(module, exports) { + Mixins: [ + IsoTriangleRender + ], -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + initialize: -/** - * Round a given number so it is further away from zero. That is, positive numbers are rounded up, and negative numbers are rounded down. - * - * @function Phaser.Math.RoundAwayFromZero - * @since 3.0.0 - * - * @param {number} value - The number to round. - * - * @return {number} The rounded number, rounded away from zero. - */ -var RoundAwayFromZero = function (value) -{ - // "Opposite" of truncate. - return (value > 0) ? Math.ceil(value) : Math.floor(value); -}; + function IsoTriangle (scene, x, y, size, height, reversed, fillTop, fillLeft, fillRight) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (size === undefined) { size = 48; } + if (height === undefined) { height = 32; } + if (reversed === undefined) { reversed = false; } + if (fillTop === undefined) { fillTop = 0xeeeeee; } + if (fillLeft === undefined) { fillLeft = 0x999999; } + if (fillRight === undefined) { fillRight = 0xcccccc; } -module.exports = RoundAwayFromZero; + Shape.call(this, scene, 'IsoTriangle', null); + /** + * The projection level of the iso box. Change this to change the 'angle' at which you are looking at the box. + * + * @name Phaser.GameObjects.IsoTriangle#projection + * @type {number} + * @default 4 + * @since 3.13.0 + */ + this.projection = 4; -/***/ }), -/* 364 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The color used to fill in the top of the iso triangle. This is only used if the triangle is reversed. + * + * @name Phaser.GameObjects.IsoTriangle#fillTop + * @type {number} + * @since 3.13.0 + */ + this.fillTop = fillTop; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The color used to fill in the left-facing side of the iso triangle. + * + * @name Phaser.GameObjects.IsoTriangle#fillLeft + * @type {number} + * @since 3.13.0 + */ + this.fillLeft = fillLeft; -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + /** + * The color used to fill in the right-facing side of the iso triangle. + * + * @name Phaser.GameObjects.IsoTriangle#fillRight + * @type {number} + * @since 3.13.0 + */ + this.fillRight = fillRight; -var Class = __webpack_require__(0); + /** + * Controls if the top-face of the iso triangle be rendered. + * + * @name Phaser.GameObjects.IsoTriangle#showTop + * @type {boolean} + * @default true + * @since 3.13.0 + */ + this.showTop = true; -/** - * @classdesc - * A three-dimensional matrix. - * - * Defaults to the identity matrix when instantiated. - * - * @class Matrix3 - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} [m] - Optional Matrix3 to copy values from. - */ -var Matrix3 = new Class({ + /** + * Controls if the left-face of the iso triangle be rendered. + * + * @name Phaser.GameObjects.IsoTriangle#showLeft + * @type {boolean} + * @default true + * @since 3.13.0 + */ + this.showLeft = true; - initialize: + /** + * Controls if the right-face of the iso triangle be rendered. + * + * @name Phaser.GameObjects.IsoTriangle#showRight + * @type {boolean} + * @default true + * @since 3.13.0 + */ + this.showRight = true; - function Matrix3 (m) - { /** - * The matrix values. + * Sets if the iso triangle will be rendered upside down or not. * - * @name Phaser.Math.Matrix3#val - * @type {Float32Array} - * @since 3.0.0 + * @name Phaser.GameObjects.IsoTriangle#isReversed + * @type {boolean} + * @default false + * @since 3.13.0 */ - this.val = new Float32Array(9); + this.isReversed = reversed; - if (m) - { - // Assume Matrix3 with val: - this.copy(m); - } - else - { - // Default to identity - this.identity(); - } + this.isFilled = true; + + this.setPosition(x, y); + this.setSize(size, height); + + this.updateDisplayOrigin(); }, /** - * Make a clone of this Matrix3. + * Sets the projection level of the iso triangle. Change this to change the 'angle' at which you are looking at the pyramid. + * This call can be chained. * - * @method Phaser.Math.Matrix3#clone - * @since 3.0.0 + * @method Phaser.GameObjects.IsoTriangle#setProjection + * @since 3.13.0 * - * @return {Phaser.Math.Matrix3} A clone of this Matrix3. + * @param {number} value - The value to set the projection to. + * + * @return {this} This Game Object instance. */ - clone: function () + setProjection: function (value) { - return new Matrix3(this); + this.projection = value; + + return this; }, /** - * This method is an alias for `Matrix3.copy`. + * Sets if the iso triangle will be rendered upside down or not. + * This call can be chained. * - * @method Phaser.Math.Matrix3#set - * @since 3.0.0 + * @method Phaser.GameObjects.IsoTriangle#setReversed + * @since 3.13.0 * - * @param {Phaser.Math.Matrix3} src - The Matrix to set the values of this Matrix's from. + * @param {boolean} reversed - Sets if the iso triangle will be rendered upside down or not. * - * @return {Phaser.Math.Matrix3} This Matrix3. + * @return {this} This Game Object instance. */ - set: function (src) + setReversed: function (reversed) { - return this.copy(src); + this.isReversed = reversed; + + return this; }, /** - * Copy the values of a given Matrix into this Matrix. + * Sets which faces of the iso triangle will be rendered. + * This call can be chained. * - * @method Phaser.Math.Matrix3#copy - * @since 3.0.0 + * @method Phaser.GameObjects.IsoTriangle#setFaces + * @since 3.13.0 * - * @param {Phaser.Math.Matrix3} src - The Matrix to copy the values from. + * @param {boolean} [showTop=true] - Show the top-face of the iso triangle (only if `reversed` is true) + * @param {boolean} [showLeft=true] - Show the left-face of the iso triangle. + * @param {boolean} [showRight=true] - Show the right-face of the iso triangle. * - * @return {Phaser.Math.Matrix3} This Matrix3. + * @return {this} This Game Object instance. */ - copy: function (src) + setFaces: function (showTop, showLeft, showRight) { - var out = this.val; - var a = src.val; + if (showTop === undefined) { showTop = true; } + if (showLeft === undefined) { showLeft = true; } + if (showRight === undefined) { showRight = true; } - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; + this.showTop = showTop; + this.showLeft = showLeft; + this.showRight = showRight; return this; }, /** - * Copy the values of a given Matrix4 into this Matrix3. + * Sets the fill colors for each face of the iso triangle. + * This call can be chained. * - * @method Phaser.Math.Matrix3#fromMat4 - * @since 3.0.0 + * @method Phaser.GameObjects.IsoTriangle#setFillStyle + * @since 3.13.0 * - * @param {Phaser.Math.Matrix4} m - The Matrix4 to copy the values from. + * @param {number} [fillTop] - The color used to fill the top of the iso triangle. + * @param {number} [fillLeft] - The color used to fill in the left-facing side of the iso triangle. + * @param {number} [fillRight] - The color used to fill in the right-facing side of the iso triangle. * - * @return {Phaser.Math.Matrix3} This Matrix3. + * @return {this} This Game Object instance. */ - fromMat4: function (m) + setFillStyle: function (fillTop, fillLeft, fillRight) { - var a = m.val; - var out = this.val; + this.fillTop = fillTop; + this.fillLeft = fillLeft; + this.fillRight = fillRight; - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[4]; - out[4] = a[5]; - out[5] = a[6]; - out[6] = a[8]; - out[7] = a[9]; - out[8] = a[10]; + this.isFilled = true; return this; - }, + } - /** - * Set the values of this Matrix from the given array. - * - * @method Phaser.Math.Matrix3#fromArray - * @since 3.0.0 - * - * @param {array} a - The array to copy the values from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - fromArray: function (a) - { - var out = this.val; +}); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; +module.exports = IsoTriangle; - return this; - }, - /** - * Reset this Matrix to an identity (default) matrix. - * - * @method Phaser.Math.Matrix3#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - identity: function () - { - var out = this.val; +/***/ }), - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; +/***/ 9923: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Transpose this Matrix. - * - * @method Phaser.Math.Matrix3#transpose - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - transpose: function () - { - var a = this.val; - var a01 = a[1]; - var a02 = a[2]; - var a12 = a[5]; +var FillStyleCanvas = __webpack_require__(15608); +var SetTransform = __webpack_require__(49584); - a[1] = a[3]; - a[2] = a[6]; - a[3] = a01; - a[5] = a[7]; - a[6] = a02; - a[7] = a12; +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.IsoTriangle#renderCanvas + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.IsoTriangle} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var IsoTriangleCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - return this; - }, + var ctx = renderer.currentContext; - /** - * Invert this Matrix. - * - * @method Phaser.Math.Matrix3#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - invert: function () + if (SetTransform(renderer, ctx, src, camera, parentMatrix) && src.isFilled) { - var a = this.val; + var size = src.width; + var height = src.height; - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - var a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; + var sizeA = size / 2; + var sizeB = size / src.projection; - var b01 = a22 * a11 - a12 * a21; - var b11 = -a22 * a10 + a12 * a20; - var b21 = a21 * a10 - a11 * a20; + var reversed = src.isReversed; - // Calculate the determinant - var det = a00 * b01 + a01 * b11 + a02 * b21; + // Top Face - if (!det) + if (src.showTop && reversed) { - return null; + FillStyleCanvas(ctx, src, src.fillTop); + + ctx.beginPath(); + + ctx.moveTo(-sizeA, -height); + ctx.lineTo(0, -sizeB - height); + ctx.lineTo(sizeA, -height); + ctx.lineTo(0, sizeB - height); + + ctx.fill(); } - det = 1 / det; + // Left Face - a[0] = b01 * det; - a[1] = (-a22 * a01 + a02 * a21) * det; - a[2] = (a12 * a01 - a02 * a11) * det; - a[3] = b11 * det; - a[4] = (a22 * a00 - a02 * a20) * det; - a[5] = (-a12 * a00 + a02 * a10) * det; - a[6] = b21 * det; - a[7] = (-a21 * a00 + a01 * a20) * det; - a[8] = (a11 * a00 - a01 * a10) * det; + if (src.showLeft) + { + FillStyleCanvas(ctx, src, src.fillLeft); - return this; - }, + ctx.beginPath(); - /** - * Calculate the adjoint, or adjugate, of this Matrix. - * - * @method Phaser.Math.Matrix3#adjoint - * @since 3.0.0 - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - adjoint: function () - { - var a = this.val; + if (reversed) + { + ctx.moveTo(-sizeA, -height); + ctx.lineTo(0, sizeB); + ctx.lineTo(0, sizeB - height); + } + else + { + ctx.moveTo(-sizeA, 0); + ctx.lineTo(0, sizeB); + ctx.lineTo(0, sizeB - height); + } - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - var a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; + ctx.fill(); + } - a[0] = (a11 * a22 - a12 * a21); - a[1] = (a02 * a21 - a01 * a22); - a[2] = (a01 * a12 - a02 * a11); - a[3] = (a12 * a20 - a10 * a22); - a[4] = (a00 * a22 - a02 * a20); - a[5] = (a02 * a10 - a00 * a12); - a[6] = (a10 * a21 - a11 * a20); - a[7] = (a01 * a20 - a00 * a21); - a[8] = (a00 * a11 - a01 * a10); + // Right Face - return this; - }, + if (src.showRight) + { + FillStyleCanvas(ctx, src, src.fillRight); - /** - * Calculate the determinant of this Matrix. - * - * @method Phaser.Math.Matrix3#determinant - * @since 3.0.0 - * - * @return {number} The determinant of this Matrix. - */ - determinant: function () - { - var a = this.val; + ctx.beginPath(); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - var a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; + if (reversed) + { + ctx.moveTo(sizeA, -height); + ctx.lineTo(0, sizeB); + ctx.lineTo(0, sizeB - height); + } + else + { + ctx.moveTo(sizeA, 0); + ctx.lineTo(0, sizeB); + ctx.lineTo(0, sizeB - height); + } - return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); - }, + ctx.fill(); + } - /** - * Multiply this Matrix by the given Matrix. - * - * @method Phaser.Math.Matrix3#multiply - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} src - The Matrix to multiply this Matrix by. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - multiply: function (src) - { - var a = this.val; + // Restore the context saved in SetTransform + ctx.restore(); + } +}; - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; - var a20 = a[6]; - var a21 = a[7]; - var a22 = a[8]; +module.exports = IsoTriangleCanvasRenderer; - var b = src.val; - var b00 = b[0]; - var b01 = b[1]; - var b02 = b[2]; - var b10 = b[3]; - var b11 = b[4]; - var b12 = b[5]; - var b20 = b[6]; - var b21 = b[7]; - var b22 = b[8]; +/***/ }), - a[0] = b00 * a00 + b01 * a10 + b02 * a20; - a[1] = b00 * a01 + b01 * a11 + b02 * a21; - a[2] = b00 * a02 + b01 * a12 + b02 * a22; +/***/ 67765: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - a[3] = b10 * a00 + b11 * a10 + b12 * a20; - a[4] = b10 * a01 + b11 * a11 + b12 * a21; - a[5] = b10 * a02 + b11 * a12 + b12 * a22; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - a[6] = b20 * a00 + b21 * a10 + b22 * a20; - a[7] = b20 * a01 + b21 * a11 + b22 * a21; - a[8] = b20 * a02 + b21 * a12 + b22 * a22; +var GameObjectFactory = __webpack_require__(61286); +var IsoTriangle = __webpack_require__(65159); - return this; - }, +/** + * Creates a new IsoTriangle Shape Game Object and adds it to the Scene. + * + * Note: This method will only be available if the IsoTriangle Game Object has been built into Phaser. + * + * The IsoTriangle Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. + * + * This shape supports only fill colors and cannot be stroked. + * + * An IsoTriangle is an 'isometric' triangle. Think of it like a pyramid. Each face has a different + * fill color. You can set the color of the top, left and right faces of the triangle respectively + * You can also choose which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties. + * + * You cannot view an IsoTriangle from under-neath, however you can change the 'angle' by setting + * the `projection` property. The `reversed` property controls if the IsoTriangle is rendered upside + * down or not. + * + * @method Phaser.GameObjects.GameObjectFactory#isotriangle + * @since 3.13.0 + * + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [size=48] - The width of the iso triangle in pixels. The left and right faces will be exactly half this value. + * @param {number} [height=32] - The height of the iso triangle. The left and right faces will be this tall. The overall height of the iso triangle will be this value plus half the `size` value. + * @param {boolean} [reversed=false] - Is the iso triangle upside down? + * @param {number} [fillTop=0xeeeeee] - The fill color of the top face of the iso triangle. + * @param {number} [fillLeft=0x999999] - The fill color of the left face of the iso triangle. + * @param {number} [fillRight=0xcccccc] - The fill color of the right face of the iso triangle. + * + * @return {Phaser.GameObjects.IsoTriangle} The Game Object that was created. + */ +GameObjectFactory.register('isotriangle', function (x, y, size, height, reversed, fillTop, fillLeft, fillRight) +{ + return this.displayList.add(new IsoTriangle(this.scene, x, y, size, height, reversed, fillTop, fillLeft, fillRight)); +}); - /** - * Translate this Matrix using the given Vector. - * - * @method Phaser.Math.Matrix3#translate - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - translate: function (v) - { - var a = this.val; - var x = v.x; - var y = v.y; - a[6] = x * a[0] + y * a[3] + a[6]; - a[7] = x * a[1] + y * a[4] + a[7]; - a[8] = x * a[2] + y * a[5] + a[8]; +/***/ }), - return this; - }, +/***/ 93387: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Apply a rotation transformation to this Matrix. - * - * @method Phaser.Math.Matrix3#rotate - * @since 3.0.0 - * - * @param {number} rad - The angle in radians to rotate by. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - rotate: function (rad) - { - var a = this.val; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a10 = a[3]; - var a11 = a[4]; - var a12 = a[5]; +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - var s = Math.sin(rad); - var c = Math.cos(rad); +if (true) +{ + renderWebGL = __webpack_require__(54946); +} - a[0] = c * a00 + s * a10; - a[1] = c * a01 + s * a11; - a[2] = c * a02 + s * a12; +if (true) +{ + renderCanvas = __webpack_require__(9923); +} - a[3] = c * a10 - s * a00; - a[4] = c * a11 - s * a01; - a[5] = c * a12 - s * a02; +module.exports = { - return this; - }, + renderWebGL: renderWebGL, + renderCanvas: renderCanvas - /** - * Apply a scale transformation to this Matrix. - * - * Uses the `x` and `y` components of the given Vector to scale the Matrix. - * - * @method Phaser.Math.Matrix3#scale - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - scale: function (v) - { - var a = this.val; - var x = v.x; - var y = v.y; +}; - a[0] = x * a[0]; - a[1] = x * a[1]; - a[2] = x * a[2]; - a[3] = y * a[3]; - a[4] = y * a[4]; - a[5] = y * a[5]; +/***/ }), - return this; - }, +/***/ 54946: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Set the values of this Matrix from the given Quaternion. - * - * @method Phaser.Math.Matrix3#fromQuat - * @since 3.0.0 - * - * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - fromQuat: function (q) - { - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; +var GetCalcMatrix = __webpack_require__(73329); +var Utils = __webpack_require__(75512); - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.IsoTriangle#renderWebGL + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.IsoTriangle} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var IsoTriangleWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; + var pipeline = renderer.pipelines.set(src.pipeline); - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + var result = GetCalcMatrix(src, camera, parentMatrix); - var out = this.val; + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); - out[0] = 1 - (yy + zz); - out[3] = xy + wz; - out[6] = xz - wy; + var size = src.width; + var height = src.height; - out[1] = xy - wz; - out[4] = 1 - (xx + zz); - out[7] = yz + wx; + var sizeA = size / 2; + var sizeB = size / src.projection; - out[2] = xz + wy; - out[5] = yz - wx; - out[8] = 1 - (xx + yy); + var reversed = src.isReversed; - return this; - }, + var alpha = camera.alpha * src.alpha; - /** - * Set the values of this Matrix3 to be normalized from the given Matrix4. - * - * @method Phaser.Math.Matrix3#normalFromMat4 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix4} m - The Matrix4 to normalize the values from. - * - * @return {Phaser.Math.Matrix3} This Matrix3. - */ - normalFromMat4: function (m) + if (!src.isFilled) { - var a = m.val; - var out = this.val; + return; + } - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; + renderer.pipelines.preBatch(src); - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; + var tint; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; + var x0; + var y0; - var a30 = a[12]; - var a31 = a[13]; - var a32 = a[14]; - var a33 = a[15]; + var x1; + var y1; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; + var x2; + var y2; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; + // Top Face - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; + if (src.showTop && reversed) + { + tint = Utils.getTintAppendFloatAlpha(src.fillTop, alpha); - // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + x0 = calcMatrix.getX(-sizeA, -height); + y0 = calcMatrix.getY(-sizeA, -height); - if (!det) + x1 = calcMatrix.getX(0, -sizeB - height); + y1 = calcMatrix.getY(0, -sizeB - height); + + x2 = calcMatrix.getX(sizeA, -height); + y2 = calcMatrix.getY(sizeA, -height); + + var x3 = calcMatrix.getX(0, sizeB - height); + var y3 = calcMatrix.getY(0, sizeB - height); + + pipeline.batchQuad(src, x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); + } + + // Left Face + + if (src.showLeft) + { + tint = Utils.getTintAppendFloatAlpha(src.fillLeft, alpha); + + if (reversed) { - return null; + x0 = calcMatrix.getX(-sizeA, -height); + y0 = calcMatrix.getY(-sizeA, -height); + + x1 = calcMatrix.getX(0, sizeB); + y1 = calcMatrix.getY(0, sizeB); + + x2 = calcMatrix.getX(0, sizeB - height); + y2 = calcMatrix.getY(0, sizeB - height); } + else + { + x0 = calcMatrix.getX(-sizeA, 0); + y0 = calcMatrix.getY(-sizeA, 0); - det = 1 / det; + x1 = calcMatrix.getX(0, sizeB); + y1 = calcMatrix.getY(0, sizeB); - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + x2 = calcMatrix.getX(0, sizeB - height); + y2 = calcMatrix.getY(0, sizeB - height); + } - out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + pipeline.batchTri(src, x0, y0, x1, y1, x2, y2, 0, 0, 1, 1, tint, tint, tint, 2); + } - out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + // Right Face - return this; + if (src.showRight) + { + tint = Utils.getTintAppendFloatAlpha(src.fillRight, alpha); + + if (reversed) + { + x0 = calcMatrix.getX(sizeA, -height); + y0 = calcMatrix.getY(sizeA, -height); + + x1 = calcMatrix.getX(0, sizeB); + y1 = calcMatrix.getY(0, sizeB); + + x2 = calcMatrix.getX(0, sizeB - height); + y2 = calcMatrix.getY(0, sizeB - height); + } + else + { + x0 = calcMatrix.getX(sizeA, 0); + y0 = calcMatrix.getY(sizeA, 0); + + x1 = calcMatrix.getX(0, sizeB); + y1 = calcMatrix.getY(0, sizeB); + + x2 = calcMatrix.getX(0, sizeB - height); + y2 = calcMatrix.getY(0, sizeB - height); + } + + pipeline.batchTri(src, x0, y0, x1, y1, x2, y2, 0, 0, 1, 1, tint, tint, tint, 2); } -}); + renderer.pipelines.postBatch(src); +}; -module.exports = Matrix3; +module.exports = IsoTriangleWebGLRenderer; /***/ }), -/* 365 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 579: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji -// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - -var Class = __webpack_require__(0); -var Matrix3 = __webpack_require__(364); -var NOOP = __webpack_require__(1); -var Vector3 = __webpack_require__(39); - -var EPSILON = 0.000001; - -// Some shared 'private' arrays -var siNext = new Int8Array([ 1, 2, 0 ]); -var tmp = new Float32Array([ 0, 0, 0 ]); - -var xUnitVec3 = new Vector3(1, 0, 0); -var yUnitVec3 = new Vector3(0, 1, 0); - -var tmpvec = new Vector3(); -var tmpMat3 = new Matrix3(); +var Class = __webpack_require__(56694); +var Shape = __webpack_require__(91461); +var GeomLine = __webpack_require__(88829); +var LineRender = __webpack_require__(52660); /** * @classdesc - * A quaternion. + * The Line Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. * - * @class Quaternion - * @memberof Phaser.Math + * This shape supports only stroke colors and cannot be filled. + * + * A Line Shape allows you to draw a line between two points in your game. You can control the + * stroke color and thickness of the line. In WebGL only you can also specify a different + * thickness for the start and end of the line, allowing you to render lines that taper-off. + * + * If you need to draw multiple lines in a sequence you may wish to use the Polygon Shape instead. + * + * Be aware that as with all Game Objects the default origin is 0.5. If you need to draw a Line + * between two points and want the x1/y1 values to match the x/y values, then set the origin to 0. + * + * @class Line + * @extends Phaser.GameObjects.Shape + * @memberof Phaser.GameObjects * @constructor - * @since 3.0.0 + * @since 3.13.0 * - * @param {number} [x=0] - The x component. - * @param {number} [y=0] - The y component. - * @param {number} [z=0] - The z component. - * @param {number} [w=1] - The w component. + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [x1=0] - The horizontal position of the start of the line. + * @param {number} [y1=0] - The vertical position of the start of the line. + * @param {number} [x2=128] - The horizontal position of the end of the line. + * @param {number} [y2=0] - The vertical position of the end of the line. + * @param {number} [strokeColor] - The color the line will be drawn in, i.e. 0xff0000 for red. + * @param {number} [strokeAlpha] - The alpha the line will be drawn in. You can also set the alpha of the overall Shape using its `alpha` property. */ -var Quaternion = new Class({ +var Line = new Class({ + + Extends: Shape, + + Mixins: [ + LineRender + ], initialize: - function Quaternion (x, y, z, w) + function Line (scene, x, y, x1, y1, x2, y2, strokeColor, strokeAlpha) { - /** - * The x component of this Quaternion. - * - * @name Phaser.Math.Quaternion#_x - * @type {number} - * @default 0 - * @private - * @since 3.50.0 - */ + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (x1 === undefined) { x1 = 0; } + if (y1 === undefined) { y1 = 0; } + if (x2 === undefined) { x2 = 128; } + if (y2 === undefined) { y2 = 0; } + + Shape.call(this, scene, 'Line', new GeomLine(x1, y1, x2, y2)); + + var width = Math.max(1, this.geom.right - this.geom.left); + var height = Math.max(1, this.geom.bottom - this.geom.top); /** - * The y component of this Quaternion. + * The width (or thickness) of the line. + * See the setLineWidth method for extra details on changing this on WebGL. * - * @name Phaser.Math.Quaternion#_y + * @name Phaser.GameObjects.Line#lineWidth * @type {number} - * @default 0 - * @private - * @since 3.50.0 + * @since 3.13.0 */ + this.lineWidth = 1; /** - * The z component of this Quaternion. + * Private internal value. Holds the start width of the line. * - * @name Phaser.Math.Quaternion#_z + * @name Phaser.GameObjects.Line#_startWidth * @type {number} - * @default 0 * @private - * @since 3.50.0 + * @since 3.13.0 */ + this._startWidth = 1; /** - * The w component of this Quaternion. + * Private internal value. Holds the end width of the line. * - * @name Phaser.Math.Quaternion#_w + * @name Phaser.GameObjects.Line#_endWidth * @type {number} - * @default 0 * @private - * @since 3.50.0 - */ - - /** - * This callback is invoked, if set, each time a value in this quaternion is changed. - * The callback is passed one argument, a reference to this quaternion. - * - * @name Phaser.Math.Quaternion#onChangeCallback - * @type {function} - * @since 3.50.0 + * @since 3.13.0 */ - this.onChangeCallback = NOOP; - - this.set(x, y, z, w); - }, - - /** - * The x component of this Quaternion. - * - * @name Phaser.Math.Quaternion#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - x: { - get: function () - { - return this._x; - }, - - set: function (value) - { - this._x = value; - - this.onChangeCallback(this); - } - }, - - /** - * The y component of this Quaternion. - * - * @name Phaser.Math.Quaternion#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - y: { - get: function () - { - return this._y; - }, - - set: function (value) - { - this._y = value; - - this.onChangeCallback(this); - } - }, + this._endWidth = 1; - /** - * The z component of this Quaternion. - * - * @name Phaser.Math.Quaternion#z - * @type {number} - * @default 0 - * @since 3.0.0 - */ - z: { - get: function () - { - return this._z; - }, + this.setPosition(x, y); + this.setSize(width, height); - set: function (value) + if (strokeColor !== undefined) { - this._z = value; - - this.onChangeCallback(this); + this.setStrokeStyle(1, strokeColor, strokeAlpha); } - }, - - /** - * The w component of this Quaternion. - * - * @name Phaser.Math.Quaternion#w - * @type {number} - * @default 0 - * @since 3.0.0 - */ - w: { - get: function () - { - return this._w; - }, - - set: function (value) - { - this._w = value; - this.onChangeCallback(this); - } + this.updateDisplayOrigin(); }, /** - * Copy the components of a given Quaternion or Vector into this Quaternion. - * - * @method Phaser.Math.Quaternion#copy - * @since 3.0.0 + * Sets the width of the line. * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} src - The Quaternion or Vector to copy the components from. + * When using the WebGL renderer you can have different start and end widths. + * When using the Canvas renderer only the `startWidth` value is used. The `endWidth` is ignored. * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - copy: function (src) - { - return this.set(src); - }, - - /** - * Set the components of this Quaternion and optionally call the `onChangeCallback`. + * This call can be chained. * - * @method Phaser.Math.Quaternion#set - * @since 3.0.0 + * @method Phaser.GameObjects.Line#setLineWidth + * @since 3.13.0 * - * @param {(number|object)} [x=0] - The x component, or an object containing x, y, z, and w components. - * @param {number} [y=0] - The y component. - * @param {number} [z=0] - The z component. - * @param {number} [w=0] - The w component. - * @param {boolean} [update=true] - Call the `onChangeCallback`? + * @param {number} startWidth - The start width of the line. + * @param {number} [endWidth] - The end width of the line. Only used in WebGL. * - * @return {Phaser.Math.Quaternion} This Quaternion. + * @return {this} This Game Object instance. */ - set: function (x, y, z, w, update) + setLineWidth: function (startWidth, endWidth) { - if (update === undefined) { update = true; } + if (endWidth === undefined) { endWidth = startWidth; } - if (typeof x === 'object') - { - this._x = x.x || 0; - this._y = x.y || 0; - this._z = x.z || 0; - this._w = x.w || 0; - } - else - { - this._x = x || 0; - this._y = y || 0; - this._z = z || 0; - this._w = w || 0; - } + this._startWidth = startWidth; + this._endWidth = endWidth; - if (update) - { - this.onChangeCallback(this); - } + this.lineWidth = startWidth; return this; }, /** - * Add a given Quaternion or Vector to this Quaternion. Addition is component-wise. + * Sets the start and end coordinates of this Line. * - * @method Phaser.Math.Quaternion#add - * @since 3.0.0 + * @method Phaser.GameObjects.Line#setTo + * @since 3.13.0 * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to add to this Quaternion. + * @param {number} [x1=0] - The horizontal position of the start of the line. + * @param {number} [y1=0] - The vertical position of the start of the line. + * @param {number} [x2=0] - The horizontal position of the end of the line. + * @param {number} [y2=0] - The vertical position of the end of the line. * - * @return {Phaser.Math.Quaternion} This Quaternion. + * @return {this} This Line object. */ - add: function (v) + setTo: function (x1, y1, x2, y2) { - this._x += v.x; - this._y += v.y; - this._z += v.z; - this._w += v.w; - - this.onChangeCallback(this); + this.geom.setTo(x1, y1, x2, y2); return this; - }, + } - /** - * Subtract a given Quaternion or Vector from this Quaternion. Subtraction is component-wise. - * - * @method Phaser.Math.Quaternion#subtract - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to subtract from this Quaternion. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - subtract: function (v) - { - this._x -= v.x; - this._y -= v.y; - this._z -= v.z; - this._w -= v.w; +}); - this.onChangeCallback(this); +module.exports = Line; - return this; - }, - /** - * Scale this Quaternion by the given value. - * - * @method Phaser.Math.Quaternion#scale - * @since 3.0.0 - * - * @param {number} scale - The value to scale this Quaternion by. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - scale: function (scale) - { - this._x *= scale; - this._y *= scale; - this._z *= scale; - this._w *= scale; +/***/ }), - this.onChangeCallback(this); +/***/ 52044: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Calculate the length of this Quaternion. - * - * @method Phaser.Math.Quaternion#length - * @since 3.0.0 - * - * @return {number} The length of this Quaternion. - */ - length: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; +var LineStyleCanvas = __webpack_require__(17876); +var SetTransform = __webpack_require__(49584); - return Math.sqrt(x * x + y * y + z * z + w * w); - }, +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Line#renderCanvas + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Line} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var LineCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - /** - * Calculate the length of this Quaternion squared. - * - * @method Phaser.Math.Quaternion#lengthSq - * @since 3.0.0 - * - * @return {number} The length of this Quaternion, squared. - */ - lengthSq: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; + var ctx = renderer.currentContext; - return x * x + y * y + z * z + w * w; - }, + if (SetTransform(renderer, ctx, src, camera, parentMatrix)) + { + var dx = src._displayOriginX; + var dy = src._displayOriginY; - /** - * Normalize this Quaternion. - * - * @method Phaser.Math.Quaternion#normalize - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - normalize: function () - { - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - var len = x * x + y * y + z * z + w * w; - - if (len > 0) + if (src.isStroked) { - len = 1 / Math.sqrt(len); + LineStyleCanvas(ctx, src); - this._x = x * len; - this._y = y * len; - this._z = z * len; - this._w = w * len; - } + ctx.beginPath(); - this.onChangeCallback(this); + ctx.moveTo(src.geom.x1 - dx, src.geom.y1 - dy); + ctx.lineTo(src.geom.x2 - dx, src.geom.y2 - dy); - return this; - }, + ctx.stroke(); + } - /** - * Calculate the dot product of this Quaternion and the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#dot - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to dot product with this Quaternion. - * - * @return {number} The dot product of this Quaternion and the given Quaternion or Vector. - */ - dot: function (v) - { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - }, + // Restore the context saved in SetTransform + ctx.restore(); + } +}; - /** - * Linearly interpolate this Quaternion towards the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#lerp - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to interpolate towards. - * @param {number} [t=0] - The percentage of interpolation. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - lerp: function (v, t) - { - if (t === undefined) { t = 0; } +module.exports = LineCanvasRenderer; - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; - return this.set( - ax + t * (v.x - ax), - ay + t * (v.y - ay), - az + t * (v.z - az), - aw + t * (v.w - aw) - ); - }, +/***/ }), - /** - * Rotates this Quaternion based on the two given vectors. - * - * @method Phaser.Math.Quaternion#rotationTo - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} a - The transform rotation vector. - * @param {Phaser.Math.Vector3} b - The target rotation vector. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - rotationTo: function (a, b) - { - var dot = a.x * b.x + a.y * b.y + a.z * b.z; +/***/ 85665: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - if (dot < -0.999999) - { - if (tmpvec.copy(xUnitVec3).cross(a).length() < EPSILON) - { - tmpvec.copy(yUnitVec3).cross(a); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - tmpvec.normalize(); +var GameObjectFactory = __webpack_require__(61286); +var Line = __webpack_require__(579); - return this.setAxisAngle(tmpvec, Math.PI); +/** + * Creates a new Line Shape Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Line Game Object has been built into Phaser. + * + * The Line Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. + * + * This shape supports only stroke colors and cannot be filled. + * + * A Line Shape allows you to draw a line between two points in your game. You can control the + * stroke color and thickness of the line. In WebGL only you can also specify a different + * thickness for the start and end of the line, allowing you to render lines that taper-off. + * + * If you need to draw multiple lines in a sequence you may wish to use the Polygon Shape instead. + * + * @method Phaser.GameObjects.GameObjectFactory#line + * @since 3.13.0 + * + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [x1=0] - The horizontal position of the start of the line. + * @param {number} [y1=0] - The vertical position of the start of the line. + * @param {number} [x2=128] - The horizontal position of the end of the line. + * @param {number} [y2=0] - The vertical position of the end of the line. + * @param {number} [strokeColor] - The color the line will be drawn in, i.e. 0xff0000 for red. + * @param {number} [strokeAlpha] - The alpha the line will be drawn in. You can also set the alpha of the overall Shape using its `alpha` property. + * + * @return {Phaser.GameObjects.Line} The Game Object that was created. + */ +GameObjectFactory.register('line', function (x, y, x1, y1, x2, y2, strokeColor, strokeAlpha) +{ + return this.displayList.add(new Line(this.scene, x, y, x1, y1, x2, y2, strokeColor, strokeAlpha)); +}); - } - else if (dot > 0.999999) - { - return this.set(0, 0, 0, 1); - } - else - { - tmpvec.copy(a).cross(b); - this._x = tmpvec.x; - this._y = tmpvec.y; - this._z = tmpvec.z; - this._w = 1 + dot; +/***/ }), - return this.normalize(); - } - }, +/***/ 52660: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Set the axes of this Quaternion. - * - * @method Phaser.Math.Quaternion#setAxes - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} view - The view axis. - * @param {Phaser.Math.Vector3} right - The right axis. - * @param {Phaser.Math.Vector3} up - The upwards axis. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - setAxes: function (view, right, up) - { - var m = tmpMat3.val; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - m[0] = right.x; - m[3] = right.y; - m[6] = right.z; +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - m[1] = up.x; - m[4] = up.y; - m[7] = up.z; +if (true) +{ + renderWebGL = __webpack_require__(46952); +} - m[2] = -view.x; - m[5] = -view.y; - m[8] = -view.z; +if (true) +{ + renderCanvas = __webpack_require__(52044); +} - return this.fromMat3(tmpMat3).normalize(); - }, +module.exports = { - /** - * Reset this Matrix to an identity (default) Quaternion. - * - * @method Phaser.Math.Quaternion#identity - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - identity: function () - { - return this.set(0, 0, 0, 1); - }, + renderWebGL: renderWebGL, + renderCanvas: renderCanvas - /** - * Set the axis angle of this Quaternion. - * - * @method Phaser.Math.Quaternion#setAxisAngle - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} axis - The axis. - * @param {number} rad - The angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - setAxisAngle: function (axis, rad) - { - rad = rad * 0.5; +}; - var s = Math.sin(rad); - return this.set( - s * axis.x, - s * axis.y, - s * axis.z, - Math.cos(rad) - ); - }, +/***/ }), - /** - * Multiply this Quaternion by the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#multiply - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to multiply this Quaternion by. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - multiply: function (b) - { - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; +/***/ 46952: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var bx = b.x; - var by = b.y; - var bz = b.z; - var bw = b.w; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this.set( - ax * bw + aw * bx + ay * bz - az * by, - ay * bw + aw * by + az * bx - ax * bz, - az * bw + aw * bz + ax * by - ay * bx, - aw * bw - ax * bx - ay * by - az * bz - ); - }, +var GetCalcMatrix = __webpack_require__(73329); +var Utils = __webpack_require__(75512); - /** - * Smoothly linearly interpolate this Quaternion towards the given Quaternion or Vector. - * - * @method Phaser.Math.Quaternion#slerp - * @since 3.0.0 - * - * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to interpolate towards. - * @param {number} t - The percentage of interpolation. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - slerp: function (b, t) - { - // benchmarks: http://jsperf.com/quaternion-slerp-implementations +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Line#renderWebGL + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Line} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var LineWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; + var pipeline = renderer.pipelines.set(src.pipeline); - var bx = b.x; - var by = b.y; - var bz = b.z; - var bw = b.w; + var result = GetCalcMatrix(src, camera, parentMatrix); - // calc cosine - var cosom = ax * bx + ay * by + az * bz + aw * bw; + pipeline.calcMatrix.copyFrom(result.calc); - // adjust signs (if necessary) - if (cosom < 0) - { - cosom = -cosom; - bx = - bx; - by = - by; - bz = - bz; - bw = - bw; - } + var dx = src._displayOriginX; + var dy = src._displayOriginY; + var alpha = camera.alpha * src.alpha; - // "from" and "to" quaternions are very close - // ... so we can do a linear interpolation - var scale0 = 1 - t; - var scale1 = t; + renderer.pipelines.preBatch(src); - // calculate coefficients - if ((1 - cosom) > EPSILON) - { - // standard case (slerp) - var omega = Math.acos(cosom); - var sinom = Math.sin(omega); + if (src.isStroked) + { + var strokeTint = pipeline.strokeTint; + var color = Utils.getTintAppendFloatAlpha(src.strokeColor, src.strokeAlpha * alpha); - scale0 = Math.sin((1.0 - t) * omega) / sinom; - scale1 = Math.sin(t * omega) / sinom; - } + strokeTint.TL = color; + strokeTint.TR = color; + strokeTint.BL = color; + strokeTint.BR = color; - // calculate final values - return this.set( - scale0 * ax + scale1 * bx, - scale0 * ay + scale1 * by, - scale0 * az + scale1 * bz, - scale0 * aw + scale1 * bw + var startWidth = src._startWidth; + var endWidth = src._endWidth; + + pipeline.batchLine( + src.geom.x1 - dx, + src.geom.y1 - dy, + src.geom.x2 - dx, + src.geom.y2 - dy, + startWidth, + endWidth, + 1, + 0, + false, + result.sprite, + result.camera ); - }, + } - /** - * Invert this Quaternion. - * - * @method Phaser.Math.Quaternion#invert - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - invert: function () - { - var a0 = this.x; - var a1 = this.y; - var a2 = this.z; - var a3 = this.w; + renderer.pipelines.postBatch(src); +}; - var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; - var invDot = (dot) ? 1 / dot : 0; +module.exports = LineWebGLRenderer; - return this.set( - -a0 * invDot, - -a1 * invDot, - -a2 * invDot, - a3 * invDot - ); - }, - /** - * Convert this Quaternion into its conjugate. - * - * Sets the x, y and z components. - * - * @method Phaser.Math.Quaternion#conjugate - * @since 3.0.0 - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - conjugate: function () - { - this._x = -this.x; - this._y = -this.y; - this._z = -this.z; +/***/ }), - this.onChangeCallback(this); +/***/ 91249: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Rotate this Quaternion on the X axis. - * - * @method Phaser.Math.Quaternion#rotateX - * @since 3.0.0 - * - * @param {number} rad - The rotation angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - rotateX: function (rad) - { - rad *= 0.5; +var PolygonRender = __webpack_require__(70573); +var Class = __webpack_require__(56694); +var Earcut = __webpack_require__(11117); +var GetAABB = __webpack_require__(14045); +var GeomPolygon = __webpack_require__(8580); +var Shape = __webpack_require__(91461); +var Smooth = __webpack_require__(18974); - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; +/** + * @classdesc + * The Polygon Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. + * + * This shape supports both fill and stroke colors. + * + * The Polygon Shape is created by providing a list of points, which are then used to create an + * internal Polygon geometry object. The points can be set from a variety of formats: + * + * - A string containing paired values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'` + * - An array of Point or Vector2 objects: `[new Phaser.Math.Vector2(x1, y1), ...]` + * - An array of objects with public x/y properties: `[obj1, obj2, ...]` + * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]` + * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]` + * + * By default the `x` and `y` coordinates of this Shape refer to the center of it. However, depending + * on the coordinates of the points provided, the final shape may be rendered offset from its origin. + * + * @class Polygon + * @extends Phaser.GameObjects.Shape + * @memberof Phaser.GameObjects + * @constructor + * @since 3.13.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {any} [points] - The points that make up the polygon. + * @param {number} [fillColor] - The color the polygon will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the polygon will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + */ +var Polygon = new Class({ - var bx = Math.sin(rad); - var bw = Math.cos(rad); + Extends: Shape, - return this.set( - ax * bw + aw * bx, - ay * bw + az * bx, - az * bw - ay * bx, - aw * bw - ax * bx - ); - }, + Mixins: [ + PolygonRender + ], - /** - * Rotate this Quaternion on the Y axis. - * - * @method Phaser.Math.Quaternion#rotateY - * @since 3.0.0 - * - * @param {number} rad - The rotation angle in radians. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - rotateY: function (rad) + initialize: + + function Polygon (scene, x, y, points, fillColor, fillAlpha) { - rad *= 0.5; + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; + Shape.call(this, scene, 'Polygon', new GeomPolygon(points)); - var by = Math.sin(rad); - var bw = Math.cos(rad); + var bounds = GetAABB(this.geom); - return this.set( - ax * bw - az * by, - ay * bw + aw * by, - az * bw + ax * by, - aw * bw - ay * by - ); + this.setPosition(x, y); + this.setSize(bounds.width, bounds.height); + + if (fillColor !== undefined) + { + this.setFillStyle(fillColor, fillAlpha); + } + + this.updateDisplayOrigin(); + this.updateData(); }, /** - * Rotate this Quaternion on the Z axis. + * Smooths the polygon over the number of iterations specified. + * The base polygon data will be updated and replaced with the smoothed values. + * This call can be chained. * - * @method Phaser.Math.Quaternion#rotateZ - * @since 3.0.0 + * @method Phaser.GameObjects.Polygon#smooth + * @since 3.13.0 * - * @param {number} rad - The rotation angle in radians. + * @param {number} [iterations=1] - The number of times to apply the polygon smoothing. * - * @return {Phaser.Math.Quaternion} This Quaternion. + * @return {this} This Game Object instance. */ - rotateZ: function (rad) + smooth: function (iterations) { - rad *= 0.5; - - var ax = this.x; - var ay = this.y; - var az = this.z; - var aw = this.w; + if (iterations === undefined) { iterations = 1; } - var bz = Math.sin(rad); - var bw = Math.cos(rad); + for (var i = 0; i < iterations; i++) + { + Smooth(this.geom); + } - return this.set( - ax * bw + ay * bz, - ay * bw - ax * bz, - az * bw + aw * bz, - aw * bw - az * bz - ); + return this.updateData(); }, /** - * Create a unit (or rotation) Quaternion from its x, y, and z components. + * Sets this Polygon to the given points. * - * Sets the w component. + * The points can be set from a variety of formats: * - * @method Phaser.Math.Quaternion#calculateW - * @since 3.0.0 + * - A string containing paired values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'` + * - An array of Point objects: `[new Phaser.Point(x1, y1), ...]` + * - An array of objects with public x/y properties: `[obj1, obj2, ...]` + * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]` + * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]` * - * @return {Phaser.Math.Quaternion} This Quaternion. + * Calling this method will reset the size (width, height) and display origin of this Shape. + * + * It also runs both GetAABB and EarCut on the given points, so please be careful not to do this + * at a high frequency, or with too many points. + * + * @method Phaser.GameObjects.Polygon#setTo + * @since 3.60.0 + * + * @param {(string|number[]|Phaser.Types.Math.Vector2Like[])} [points] - Points defining the perimeter of this polygon. Please check function description above for the different supported formats. + * + * @return {this} This Game Object instance. */ - calculateW: function () + setTo: function (points) { - var x = this.x; - var y = this.y; - var z = this.z; + this.geom.setTo(points); - this.w = -Math.sqrt(1.0 - x * x - y * y - z * z); + var bounds = GetAABB(this.geom); - return this; + this.setSize(bounds.width, bounds.height); + + this.updateDisplayOrigin(); + + return this.updateData(); }, /** - * Set this Quaternion from the given Euler, based on Euler order. - * - * @method Phaser.Math.Quaternion#setFromEuler - * @since 3.50.0 + * Internal method that updates the data and path values. * - * @param {Phaser.Math.Euler} euler - The Euler to convert from. - * @param {boolean} [update=true] - Run the `onChangeCallback`? + * @method Phaser.GameObjects.Polygon#updateData + * @private + * @since 3.13.0 * - * @return {Phaser.Math.Quaternion} This Quaternion. + * @return {this} This Game Object instance. */ - setFromEuler: function (euler, update) + updateData: function () { - var x = euler.x / 2; - var y = euler.y / 2; - var z = euler.z / 2; - - var c1 = Math.cos(x); - var c2 = Math.cos(y); - var c3 = Math.cos(z); - - var s1 = Math.sin(x); - var s2 = Math.sin(y); - var s3 = Math.sin(z); + var path = []; + var points = this.geom.points; - switch (euler.order) + for (var i = 0; i < points.length; i++) { - case 'XYZ': - { - this.set( - s1 * c2 * c3 + c1 * s2 * s3, - c1 * s2 * c3 - s1 * c2 * s3, - c1 * c2 * s3 + s1 * s2 * c3, - c1 * c2 * c3 - s1 * s2 * s3, - update - ); + path.push(points[i].x, points[i].y); + } - break; - } + path.push(points[0].x, points[0].y); - case 'YXZ': - { - this.set( - s1 * c2 * c3 + c1 * s2 * s3, - c1 * s2 * c3 - s1 * c2 * s3, - c1 * c2 * s3 - s1 * s2 * c3, - c1 * c2 * c3 + s1 * s2 * s3, - update - ); + this.pathIndexes = Earcut(path); + this.pathData = path; - break; - } + return this; + } - case 'ZXY': - { - this.set( - s1 * c2 * c3 - c1 * s2 * s3, - c1 * s2 * c3 + s1 * c2 * s3, - c1 * c2 * s3 + s1 * s2 * c3, - c1 * c2 * c3 - s1 * s2 * s3, - update - ); +}); - break; - } +module.exports = Polygon; - case 'ZYX': - { - this.set( - s1 * c2 * c3 - c1 * s2 * s3, - c1 * s2 * c3 + s1 * c2 * s3, - c1 * c2 * s3 - s1 * s2 * c3, - c1 * c2 * c3 + s1 * s2 * s3, - update - ); - break; - } +/***/ }), - case 'YZX': - { - this.set( - s1 * c2 * c3 + c1 * s2 * s3, - c1 * s2 * c3 + s1 * c2 * s3, - c1 * c2 * s3 - s1 * s2 * c3, - c1 * c2 * c3 - s1 * s2 * s3, - update - ); +/***/ 40834: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - break; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - case 'XZY': - { - this.set( - s1 * c2 * c3 - c1 * s2 * s3, - c1 * s2 * c3 - s1 * c2 * s3, - c1 * c2 * s3 + s1 * s2 * c3, - c1 * c2 * c3 + s1 * s2 * s3, - update - ); +var FillStyleCanvas = __webpack_require__(15608); +var LineStyleCanvas = __webpack_require__(17876); +var SetTransform = __webpack_require__(49584); - break; - } - } +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Polygon#renderCanvas + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Polygon} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var PolygonCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - return this; - }, + var ctx = renderer.currentContext; - /** - * Sets the rotation of this Quaternion from the given Matrix4. - * - * @method Phaser.Math.Quaternion#setFromRotationMatrix - * @since 3.50.0 - * - * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to set the rotation from. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - setFromRotationMatrix: function (mat4) + if (SetTransform(renderer, ctx, src, camera, parentMatrix)) { - var m = mat4.val; + var dx = src._displayOriginX; + var dy = src._displayOriginY; - var m11 = m[0]; - var m12 = m[4]; - var m13 = m[8]; - var m21 = m[1]; - var m22 = m[5]; - var m23 = m[9]; - var m31 = m[2]; - var m32 = m[6]; - var m33 = m[10]; + var path = src.pathData; + var pathLength = path.length - 1; - var trace = m11 + m22 + m33; - var s; + var px1 = path[0] - dx; + var py1 = path[1] - dy; - if (trace > 0) - { - s = 0.5 / Math.sqrt(trace + 1.0); + ctx.beginPath(); - this.set( - (m32 - m23) * s, - (m13 - m31) * s, - (m21 - m12) * s, - 0.25 / s - ); + ctx.moveTo(px1, py1); + + if (!src.closePath) + { + pathLength -= 2; } - else if (m11 > m22 && m11 > m33) + + for (var i = 2; i < pathLength; i += 2) { - s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33); + var px2 = path[i] - dx; + var py2 = path[i + 1] - dy; - this.set( - 0.25 * s, - (m12 + m21) / s, - (m13 + m31) / s, - (m32 - m23) / s - ); + ctx.lineTo(px2, py2); } - else if (m22 > m33) + + if (src.closePath) { - s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33); + ctx.closePath(); + } - this.set( - (m12 + m21) / s, - 0.25 * s, - (m23 + m32) / s, - (m13 - m31) / s - ); + if (src.isFilled) + { + FillStyleCanvas(ctx, src); + + ctx.fill(); } - else + + if (src.isStroked) { - s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22); + LineStyleCanvas(ctx, src); - this.set( - (m13 + m31) / s, - (m23 + m32) / s, - 0.25 * s, - (m21 - m12) / s - ); + ctx.stroke(); } - return this; - }, + // Restore the context saved in SetTransform + ctx.restore(); + } +}; - /** - * Convert the given Matrix into this Quaternion. - * - * @method Phaser.Math.Quaternion#fromMat3 - * @since 3.0.0 - * - * @param {Phaser.Math.Matrix3} mat - The Matrix to convert from. - * - * @return {Phaser.Math.Quaternion} This Quaternion. - */ - fromMat3: function (mat) - { - // benchmarks: - // http://jsperf.com/typed-array-access-speed - // http://jsperf.com/conversion-of-3x3-matrix-to-quaternion +module.exports = PolygonCanvasRenderer; - // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes - // article "Quaternion Calculus and Fast Animation". - var m = mat.val; - var fTrace = m[0] + m[4] + m[8]; - var fRoot; - if (fTrace > 0) - { - // |w| > 1/2, may as well choose w > 1/2 - fRoot = Math.sqrt(fTrace + 1.0); // 2w +/***/ }), - this.w = 0.5 * fRoot; +/***/ 88203: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - fRoot = 0.5 / fRoot; // 1/(4w) +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this._x = (m[7] - m[5]) * fRoot; - this._y = (m[2] - m[6]) * fRoot; - this._z = (m[3] - m[1]) * fRoot; - } - else - { - // |w| <= 1/2 - var i = 0; +var GameObjectFactory = __webpack_require__(61286); +var Polygon = __webpack_require__(91249); - if (m[4] > m[0]) - { - i = 1; - } +/** + * Creates a new Polygon Shape Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Polygon Game Object has been built into Phaser. + * + * The Polygon Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. + * + * This shape supports both fill and stroke colors. + * + * The Polygon Shape is created by providing a list of points, which are then used to create an + * internal Polygon geometry object. The points can be set from a variety of formats: + * + * - An array of Point or Vector2 objects: `[new Phaser.Math.Vector2(x1, y1), ...]` + * - An array of objects with public x/y properties: `[obj1, obj2, ...]` + * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]` + * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]` + * + * By default the `x` and `y` coordinates of this Shape refer to the center of it. However, depending + * on the coordinates of the points provided, the final shape may be rendered offset from its origin. + * + * @method Phaser.GameObjects.GameObjectFactory#polygon + * @since 3.13.0 + * + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {any} [points] - The points that make up the polygon. + * @param {number} [fillColor] - The color the polygon will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the polygon will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * + * @return {Phaser.GameObjects.Polygon} The Game Object that was created. + */ +GameObjectFactory.register('polygon', function (x, y, points, fillColor, fillAlpha) +{ + return this.displayList.add(new Polygon(this.scene, x, y, points, fillColor, fillAlpha)); +}); - if (m[8] > m[i * 3 + i]) - { - i = 2; - } - var j = siNext[i]; - var k = siNext[j]; +/***/ }), - // This isn't quite as clean without array access - fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); - tmp[i] = 0.5 * fRoot; +/***/ 70573: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - fRoot = 0.5 / fRoot; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - tmp[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; - tmp[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - this._x = tmp[0]; - this._y = tmp[1]; - this._z = tmp[2]; - this._w = (m[k * 3 + j] - m[j * 3 + k]) * fRoot; - } +if (true) +{ + renderWebGL = __webpack_require__(72841); +} - this.onChangeCallback(this); +if (true) +{ + renderCanvas = __webpack_require__(40834); +} - return this; - } +module.exports = { -}); + renderWebGL: renderWebGL, + renderCanvas: renderCanvas -module.exports = Quaternion; +}; /***/ }), -/* 366 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 72841: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasInterpolation = __webpack_require__(367); -var CanvasPool = __webpack_require__(31); -var CONST = __webpack_require__(33); -var Features = __webpack_require__(191); +var FillPathWebGL = __webpack_require__(19543); +var GetCalcMatrix = __webpack_require__(73329); +var StrokePathWebGL = __webpack_require__(50262); /** - * Called automatically by Phaser.Game and responsible for creating the renderer it will use. - * - * Relies upon two webpack global flags to be defined: `WEBGL_RENDERER` and `CANVAS_RENDERER` during build time, but not at run-time. + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @function Phaser.Core.CreateRenderer - * @since 3.0.0 + * @method Phaser.GameObjects.Polygon#renderWebGL + * @since 3.13.0 + * @private * - * @param {Phaser.Game} game - The Phaser.Game instance on which the renderer will be set. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Polygon} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var CreateRenderer = function (game) +var PolygonWebGLRenderer = function (renderer, src, camera, parentMatrix) { - var config = game.config; + camera.addToRenderList(src); - if ((config.customEnvironment || config.canvas) && config.renderType === CONST.AUTO) - { - throw new Error('Must set explicit renderType in custom environment'); - } + var pipeline = renderer.pipelines.set(src.pipeline); - // Not a custom environment, didn't provide their own canvas and not headless, so determine the renderer: - if (!config.customEnvironment && !config.canvas && config.renderType !== CONST.HEADLESS) - { - if (config.renderType === CONST.CANVAS || (config.renderType !== CONST.CANVAS && !Features.webGL)) - { - if (Features.canvas) - { - // They requested Canvas and their browser supports it - config.renderType = CONST.CANVAS; - } - else - { - throw new Error('Cannot create Canvas or WebGL context, aborting.'); - } - } - else - { - // Game requested WebGL and browser says it supports it - config.renderType = CONST.WEBGL; - } - } + var result = GetCalcMatrix(src, camera, parentMatrix); - // Pixel Art mode? - if (!config.antialias) - { - CanvasPool.disableSmoothing(); - } + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); - var baseSize = game.scale.baseSize; + var dx = src._displayOriginX; + var dy = src._displayOriginY; - var width = baseSize.width; - var height = baseSize.height; + var alpha = camera.alpha * src.alpha; - // Does the game config provide its own canvas element to use? - if (config.canvas) - { - game.canvas = config.canvas; + renderer.pipelines.preBatch(src); - game.canvas.width = width; - game.canvas.height = height; - } - else + if (src.isFilled) { - game.canvas = CanvasPool.create(game, width, height, config.renderType); + FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); } - // Does the game config provide some canvas css styles to use? - if (config.canvasStyle) + if (src.isStroked) { - game.canvas.style = config.canvasStyle; + StrokePathWebGL(pipeline, src, alpha, dx, dy); } - // Pixel Art mode? - if (!config.antialias) - { - CanvasInterpolation.setCrisp(game.canvas); - } + renderer.pipelines.postBatch(src); +}; - if (config.renderType === CONST.HEADLESS) - { - // Nothing more to do here - return; - } +module.exports = PolygonWebGLRenderer; - var CanvasRenderer; - var WebGLRenderer; - if (true) - { - CanvasRenderer = __webpack_require__(368); - WebGLRenderer = __webpack_require__(371); +/***/ }), - // Let the config pick the renderer type, as both are included - if (config.renderType === CONST.WEBGL) - { - game.renderer = new WebGLRenderer(game); - } - else - { - game.renderer = new CanvasRenderer(game); - game.context = game.renderer.gameContext; - } - } - - if (false) - {} - - if (false) - {} -}; - -module.exports = CreateRenderer; - - -/***/ }), -/* 367 */ -/***/ (function(module, exports) { +/***/ 517: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var GeomRectangle = __webpack_require__(74118); +var Shape = __webpack_require__(91461); +var RectangleRender = __webpack_require__(37673); + /** - * @namespace Phaser.Display.Canvas.CanvasInterpolation - * @since 3.0.0 + * @classdesc + * The Rectangle Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. + * + * This shape supports both fill and stroke colors. + * + * You can change the size of the rectangle by changing the `width` and `height` properties. + * + * @class Rectangle + * @extends Phaser.GameObjects.Shape + * @memberof Phaser.GameObjects + * @constructor + * @since 3.13.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {number} [width=128] - The width of the rectangle. + * @param {number} [height=128] - The height of the rectangle. + * @param {number} [fillColor] - The color the rectangle will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the rectangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. */ -var CanvasInterpolation = { +var Rectangle = new Class({ + + Extends: Shape, + + Mixins: [ + RectangleRender + ], + + initialize: + + function Rectangle (scene, x, y, width, height, fillColor, fillAlpha) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 128; } + if (height === undefined) { height = 128; } + + Shape.call(this, scene, 'Rectangle', new GeomRectangle(0, 0, width, height)); + + this.setPosition(x, y); + this.setSize(width, height); + + if (fillColor !== undefined) + { + this.setFillStyle(fillColor, fillAlpha); + } + + this.updateDisplayOrigin(); + this.updateData(); + }, /** - * Sets the CSS image-rendering property on the given canvas to be 'crisp' (aka 'optimize contrast' on webkit). + * Sets the internal size of this Rectangle, as used for frame or physics body creation. * - * @function Phaser.Display.Canvas.CanvasInterpolation.setCrisp - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The canvas object to have the style set on. - * - * @return {HTMLCanvasElement} The canvas. + * If you have assigned a custom input hit area for this Rectangle, changing the Rectangle size will _not_ change the + * size of the hit area. To do this you should adjust the `input.hitArea` object directly. + * + * @method Phaser.GameObjects.Rectangle#setSize + * @since 3.13.0 + * + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * + * @return {this} This Game Object instance. */ - setCrisp: function (canvas) + setSize: function (width, height) { - var types = [ 'optimizeSpeed', '-moz-crisp-edges', '-o-crisp-edges', '-webkit-optimize-contrast', 'optimize-contrast', 'crisp-edges', 'pixelated' ]; + this.width = width; + this.height = height; - types.forEach(function (type) - { - canvas.style['image-rendering'] = type; - }); + this.geom.setSize(width, height); - canvas.style.msInterpolationMode = 'nearest-neighbor'; + this.updateData(); - return canvas; + this.updateDisplayOrigin(); + + var input = this.input; + + if (input && !input.customHitArea) + { + input.hitArea.width = width; + input.hitArea.height = height; + } + + return this; }, /** - * Sets the CSS image-rendering property on the given canvas to be 'bicubic' (aka 'auto'). + * Internal method that updates the data and path values. * - * @function Phaser.Display.Canvas.CanvasInterpolation.setBicubic - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The canvas object to have the style set on. - * - * @return {HTMLCanvasElement} The canvas. + * @method Phaser.GameObjects.Rectangle#updateData + * @private + * @since 3.13.0 + * + * @return {this} This Game Object instance. */ - setBicubic: function (canvas) + updateData: function () { - canvas.style['image-rendering'] = 'auto'; - canvas.style.msInterpolationMode = 'bicubic'; + var path = []; + var rect = this.geom; + var line = this._tempLine; - return canvas; + rect.getLineA(line); + + path.push(line.x1, line.y1, line.x2, line.y2); + + rect.getLineB(line); + + path.push(line.x2, line.y2); + + rect.getLineC(line); + + path.push(line.x2, line.y2); + + rect.getLineD(line); + + path.push(line.x2, line.y2); + + this.pathData = path; + + return this; } +}); + +module.exports = Rectangle; + + +/***/ }), + +/***/ 4091: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var FillStyleCanvas = __webpack_require__(15608); +var LineStyleCanvas = __webpack_require__(17876); +var SetTransform = __webpack_require__(49584); + +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Rectangle#renderCanvas + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Rectangle} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var RectangleCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); + + var ctx = renderer.currentContext; + + if (SetTransform(renderer, ctx, src, camera, parentMatrix)) + { + var dx = src._displayOriginX; + var dy = src._displayOriginY; + + if (src.isFilled) + { + FillStyleCanvas(ctx, src); + + ctx.fillRect( + -dx, + -dy, + src.width, + src.height + ); + } + + if (src.isStroked) + { + LineStyleCanvas(ctx, src); + + ctx.beginPath(); + + ctx.rect( + -dx, + -dy, + src.width, + src.height + ); + + ctx.stroke(); + } + + // Restore the context saved in SetTransform + ctx.restore(); + } }; -module.exports = CanvasInterpolation; +module.exports = RectangleCanvasRenderer; /***/ }), -/* 368 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 94355: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CameraEvents = __webpack_require__(37); -var CanvasSnapshot = __webpack_require__(369); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(33); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(91); -var GetBlendModes = __webpack_require__(370); -var ScaleEvents = __webpack_require__(104); -var TextureEvents = __webpack_require__(106); -var TransformMatrix = __webpack_require__(25); +var GameObjectFactory = __webpack_require__(61286); +var Rectangle = __webpack_require__(517); /** - * @classdesc - * The Canvas Renderer is responsible for managing 2D canvas rendering contexts, - * including the one used by the Games canvas. It tracks the internal state of a - * given context and can renderer textured Game Objects to it, taking into - * account alpha, blending, and scaling. + * Creates a new Rectangle Shape Game Object and adds it to the Scene. * - * @class CanvasRenderer - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Renderer.Canvas - * @constructor - * @since 3.0.0 + * Note: This method will only be available if the Rectangle Game Object has been built into Phaser. * - * @param {Phaser.Game} game - The Phaser Game instance that owns this renderer. + * The Rectangle Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. + * + * This shape supports both fill and stroke colors. + * + * You can change the size of the rectangle by changing the `width` and `height` properties. + * + * @method Phaser.GameObjects.GameObjectFactory#rectangle + * @since 3.13.0 + * + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [width=128] - The width of the rectangle. + * @param {number} [height=128] - The height of the rectangle. + * @param {number} [fillColor] - The color the rectangle will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the rectangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * + * @return {Phaser.GameObjects.Rectangle} The Game Object that was created. */ -var CanvasRenderer = new Class({ +GameObjectFactory.register('rectangle', function (x, y, width, height, fillColor, fillAlpha) +{ + return this.displayList.add(new Rectangle(this.scene, x, y, width, height, fillColor, fillAlpha)); +}); - Extends: EventEmitter, - initialize: +/***/ }), - function CanvasRenderer (game) +/***/ 37673: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(43532); +} + +if (true) +{ + renderCanvas = __webpack_require__(4091); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), + +/***/ 43532: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetCalcMatrix = __webpack_require__(73329); +var StrokePathWebGL = __webpack_require__(50262); +var Utils = __webpack_require__(75512); + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Rectangle#renderWebGL + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Rectangle} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var RectangleWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); + + var pipeline = renderer.pipelines.set(src.pipeline); + + var result = GetCalcMatrix(src, camera, parentMatrix); + + pipeline.calcMatrix.copyFrom(result.calc); + + var dx = src._displayOriginX; + var dy = src._displayOriginY; + var alpha = camera.alpha * src.alpha; + + renderer.pipelines.preBatch(src); + + if (src.isFilled) { - EventEmitter.call(this); + var fillTint = pipeline.fillTint; + var fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); - var gameConfig = game.config; + fillTint.TL = fillTintColor; + fillTint.TR = fillTintColor; + fillTint.BL = fillTintColor; + fillTint.BR = fillTintColor; - /** - * The local configuration settings of the CanvasRenderer. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#config - * @type {object} - * @since 3.0.0 - */ - this.config = { - clearBeforeRender: gameConfig.clearBeforeRender, - backgroundColor: gameConfig.backgroundColor, - antialias: gameConfig.antialias, - roundPixels: gameConfig.roundPixels - }; + pipeline.batchFillRect( + -dx, + -dy, + src.width, + src.height + ); + } - /** - * The Phaser Game instance that owns this renderer. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; + if (src.isStroked) + { + StrokePathWebGL(pipeline, src, alpha, dx, dy); + } - /** - * A constant which allows the renderer to be easily identified as a Canvas Renderer. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#type - * @type {number} - * @since 3.0.0 - */ - this.type = CONST.CANVAS; + renderer.pipelines.postBatch(src); +}; - /** - * The total number of Game Objects which were rendered in a frame. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#drawCount - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.drawCount = 0; +module.exports = RectangleWebGLRenderer; - /** - * The width of the canvas being rendered to. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#width - * @type {number} - * @since 3.0.0 - */ - this.width = 0; - /** - * The height of the canvas being rendered to. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#height - * @type {number} - * @since 3.0.0 - */ - this.height = 0; +/***/ }), - /** - * The canvas element which the Game uses. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#gameCanvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.gameCanvas = game.canvas; +/***/ 77843: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var contextOptions = { - alpha: game.config.transparent, - desynchronized: game.config.desynchronized - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The canvas context used to render all Cameras in all Scenes during the game loop. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#gameContext - * @type {CanvasRenderingContext2D} - * @since 3.0.0 - */ - this.gameContext = (gameConfig.context) ? gameConfig.context : this.gameCanvas.getContext('2d', contextOptions); +var StarRender = __webpack_require__(87956); +var Class = __webpack_require__(56694); +var Earcut = __webpack_require__(11117); +var Shape = __webpack_require__(91461); - /** - * The canvas context currently used by the CanvasRenderer for all rendering operations. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#currentContext - * @type {CanvasRenderingContext2D} - * @since 3.0.0 - */ - this.currentContext = this.gameContext; +/** + * @classdesc + * The Star Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. + * + * This shape supports both fill and stroke colors. + * + * As the name implies, the Star shape will display a star in your game. You can control several + * aspects of it including the number of points that constitute the star. The default is 5. If + * you change it to 4 it will render as a diamond. If you increase them, you'll get a more spiky + * star shape. + * + * You can also control the inner and outer radius, which is how 'long' each point of the star is. + * Modify these values to create more interesting shapes. + * + * @class Star + * @extends Phaser.GameObjects.Shape + * @memberof Phaser.GameObjects + * @constructor + * @since 3.13.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [points=5] - The number of points on the star. + * @param {number} [innerRadius=32] - The inner radius of the star. + * @param {number} [outerRadius=64] - The outer radius of the star. + * @param {number} [fillColor] - The color the star will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the star will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + */ +var Star = new Class({ - /** - * Should the Canvas use Image Smoothing or not when drawing Sprites? - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#antialias - * @type {boolean} - * @since 3.20.0 - */ - this.antialias = game.config.antialias; + Extends: Shape, - /** - * The blend modes supported by the Canvas Renderer. - * - * This object maps the {@link Phaser.BlendModes} to canvas compositing operations. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#blendModes - * @type {array} - * @since 3.0.0 - */ - this.blendModes = GetBlendModes(); + Mixins: [ + StarRender + ], - /** - * Details about the currently scheduled snapshot. - * - * If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered. - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotState - * @type {Phaser.Types.Renderer.Snapshot.SnapshotState} - * @since 3.16.0 - */ - this.snapshotState = { - x: 0, - y: 0, - width: 1, - height: 1, - getPixel: false, - callback: null, - type: 'image/png', - encoder: 0.92 - }; + initialize: + + function Star (scene, x, y, points, innerRadius, outerRadius, fillColor, fillAlpha) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (points === undefined) { points = 5; } + if (innerRadius === undefined) { innerRadius = 32; } + if (outerRadius === undefined) { outerRadius = 64; } + + Shape.call(this, scene, 'Star', null); /** - * A temporary Transform Matrix, re-used internally during batching. + * Private internal value. + * The number of points in the star. * - * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix1 + * @name Phaser.GameObjects.Star#_points + * @type {number} * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 + * @since 3.13.0 */ - this._tempMatrix1 = new TransformMatrix(); + this._points = points; /** - * A temporary Transform Matrix, re-used internally during batching. + * Private internal value. + * The inner radius of the star. * - * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix2 + * @name Phaser.GameObjects.Star#_innerRadius + * @type {number} * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 + * @since 3.13.0 */ - this._tempMatrix2 = new TransformMatrix(); + this._innerRadius = innerRadius; /** - * A temporary Transform Matrix, re-used internally during batching. + * Private internal value. + * The outer radius of the star. * - * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix3 + * @name Phaser.GameObjects.Star#_outerRadius + * @type {number} * @private - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.11.0 + * @since 3.13.0 */ - this._tempMatrix3 = new TransformMatrix(); + this._outerRadius = outerRadius; - /** - * Has this renderer fully booted yet? - * - * @name Phaser.Renderer.Canvas.CanvasRenderer#isBooted - * @type {boolean} - * @since 3.50.0 - */ - this.isBooted = false; + this.setPosition(x, y); + this.setSize(outerRadius * 2, outerRadius * 2); - this.init(); - }, + if (fillColor !== undefined) + { + this.setFillStyle(fillColor, fillAlpha); + } - /** - * Prepares the game canvas for rendering. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#init - * @since 3.0.0 - */ - init: function () - { - this.game.textures.once(TextureEvents.READY, this.boot, this); + this.updateDisplayOrigin(); + this.updateData(); }, /** - * Internal boot handler. + * Sets the number of points that make up the Star shape. + * This call can be chained. * - * @method Phaser.Renderer.Canvas.CanvasRenderer#boot - * @private - * @since 3.50.0 - */ - boot: function () - { - var game = this.game; - - var baseSize = game.scale.baseSize; - - this.width = baseSize.width; - this.height = baseSize.height; - - this.isBooted = true; - - game.scale.on(ScaleEvents.RESIZE, this.onResize, this); - - this.resize(baseSize.width, baseSize.height); - }, - - /** - * The event handler that manages the `resize` event dispatched by the Scale Manager. + * @method Phaser.GameObjects.Star#setPoints + * @since 3.13.0 * - * @method Phaser.Renderer.Canvas.CanvasRenderer#onResize - * @since 3.16.0 + * @param {number} value - The amount of points the Star will have. * - * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. - * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. + * @return {this} This Game Object instance. */ - onResize: function (gameSize, baseSize) + setPoints: function (value) { - // Has the underlying canvas size changed? - if (baseSize.width !== this.width || baseSize.height !== this.height) - { - this.resize(baseSize.width, baseSize.height); - } + this._points = value; + + return this.updateData(); }, /** - * Resize the main game canvas. + * Sets the inner radius of the Star shape. + * This call can be chained. * - * @method Phaser.Renderer.Canvas.CanvasRenderer#resize - * @fires Phaser.Renderer.Events#RESIZE - * @since 3.0.0 + * @method Phaser.GameObjects.Star#setInnerRadius + * @since 3.13.0 * - * @param {number} [width] - The new width of the renderer. - * @param {number} [height] - The new height of the renderer. - */ - resize: function (width, height) - { - this.width = width; - this.height = height; - - this.emit(Events.RESIZE, width, height); - }, - - /** - * Resets the transformation matrix of the current context to the identity matrix, thus resetting any transformation. + * @param {number} value - The amount to set the inner radius to. * - * @method Phaser.Renderer.Canvas.CanvasRenderer#resetTransform - * @since 3.0.0 + * @return {this} This Game Object instance. */ - resetTransform: function () + setInnerRadius: function (value) { - this.currentContext.setTransform(1, 0, 0, 1, 0, 0); + this._innerRadius = value; + + return this.updateData(); }, /** - * Sets the blend mode (compositing operation) of the current context. + * Sets the outer radius of the Star shape. + * This call can be chained. * - * @method Phaser.Renderer.Canvas.CanvasRenderer#setBlendMode - * @since 3.0.0 + * @method Phaser.GameObjects.Star#setOuterRadius + * @since 3.13.0 * - * @param {string} blendMode - The new blend mode which should be used. + * @param {number} value - The amount to set the outer radius to. * - * @return {this} This CanvasRenderer object. + * @return {this} This Game Object instance. */ - setBlendMode: function (blendMode) + setOuterRadius: function (value) { - this.currentContext.globalCompositeOperation = blendMode; + this._outerRadius = value; - return this; + return this.updateData(); }, /** - * Changes the Canvas Rendering Context that all draw operations are performed against. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#setContext - * @since 3.12.0 - * - * @param {?CanvasRenderingContext2D} [ctx] - The new Canvas Rendering Context to draw everything to. Leave empty to reset to the Game Canvas. + * The number of points that make up the Star shape. * - * @return {this} The Canvas Renderer instance. + * @name Phaser.GameObjects.Star#points + * @type {number} + * @default 5 + * @since 3.13.0 */ - setContext: function (ctx) - { - this.currentContext = (ctx) ? ctx : this.gameContext; + points: { + + get: function () + { + return this._points; + }, + + set: function (value) + { + this._points = value; + + this.updateData(); + } - return this; }, /** - * Sets the global alpha of the current context. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#setAlpha - * @since 3.0.0 - * - * @param {number} alpha - The new alpha to use, where 0 is fully transparent and 1 is fully opaque. + * The inner radius of the Star shape. * - * @return {this} This CanvasRenderer object. + * @name Phaser.GameObjects.Star#innerRadius + * @type {number} + * @default 32 + * @since 3.13.0 */ - setAlpha: function (alpha) - { - this.currentContext.globalAlpha = alpha; + innerRadius: { + + get: function () + { + return this._innerRadius; + }, + + set: function (value) + { + this._innerRadius = value; + + this.updateData(); + } - return this; }, /** - * Called at the start of the render loop. + * The outer radius of the Star shape. * - * @method Phaser.Renderer.Canvas.CanvasRenderer#preRender - * @fires Phaser.Renderer.Events#PRE_RENDER - * @since 3.0.0 + * @name Phaser.GameObjects.Star#outerRadius + * @type {number} + * @default 64 + * @since 3.13.0 */ - preRender: function () - { - var ctx = this.gameContext; - var config = this.config; - - var width = this.width; - var height = this.height; + outerRadius: { - ctx.globalAlpha = 1; - ctx.globalCompositeOperation = 'source-over'; - ctx.setTransform(1, 0, 0, 1, 0, 0); + get: function () + { + return this._outerRadius; + }, - if (config.clearBeforeRender) + set: function (value) { - ctx.clearRect(0, 0, width, height); + this._outerRadius = value; - if (!config.transparent) - { - ctx.fillStyle = config.backgroundColor.rgba; - ctx.fillRect(0, 0, width, height); - } + this.updateData(); } - ctx.save(); - - this.drawCount = 0; - - this.emit(Events.PRE_RENDER); }, /** - * The core render step for a Scene Camera. - * - * Iterates through the given array of Game Objects and renders them with the given Camera. - * - * This is called by the `CameraManager.render` method. The Camera Manager instance belongs to a Scene, and is invoked - * by the Scene Systems.render method. - * - * This method is not called if `Camera.visible` is `false`, or `Camera.alpha` is zero. + * Internal method that updates the data and path values. * - * @method Phaser.Renderer.Canvas.CanvasRenderer#render - * @fires Phaser.Renderer.Events#RENDER - * @since 3.0.0 + * @method Phaser.GameObjects.Star#updateData + * @private + * @since 3.13.0 * - * @param {Phaser.Scene} scene - The Scene to render. - * @param {Phaser.GameObjects.GameObject[]} children - An array of filtered Game Objects that can be rendered by the given Camera. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. + * @return {this} This Game Object instance. */ - render: function (scene, children, camera) + updateData: function () { - var childCount = children.length; + var path = []; - this.emit(Events.RENDER, scene, camera); + var points = this._points; + var innerRadius = this._innerRadius; + var outerRadius = this._outerRadius; - var cx = camera.x; - var cy = camera.y; - var cw = camera.width; - var ch = camera.height; + var rot = Math.PI / 2 * 3; + var step = Math.PI / points; - var ctx = (camera.renderToTexture) ? camera.context : scene.sys.context; + // So origin 0.5 = the center of the star + var x = outerRadius; + var y = outerRadius; - // Save context pre-clip - ctx.save(); + path.push(x, y + -outerRadius); - if (this.game.scene.customViewports) + for (var i = 0; i < points; i++) { - ctx.beginPath(); - ctx.rect(cx, cy, cw, ch); - ctx.clip(); - } + path.push(x + Math.cos(rot) * outerRadius, y + Math.sin(rot) * outerRadius); - this.currentContext = ctx; + rot += step; - var mask = camera.mask; + path.push(x + Math.cos(rot) * innerRadius, y + Math.sin(rot) * innerRadius); - if (mask) - { - mask.preRenderCanvas(this, null, camera._maskCamera); + rot += step; } - if (!camera.transparent) - { - ctx.fillStyle = camera.backgroundColor.rgba; - ctx.fillRect(cx, cy, cw, ch); - } + path.push(x, y + -outerRadius); - ctx.globalAlpha = camera.alpha; + this.pathIndexes = Earcut(path); + this.pathData = path; - ctx.globalCompositeOperation = 'source-over'; + return this; + } - this.drawCount += childCount; +}); - if (camera.renderToTexture) - { - camera.emit(CameraEvents.PRE_RENDER, camera); - } +module.exports = Star; - camera.matrix.copyToContext(ctx); - for (var i = 0; i < childCount; i++) - { - var child = children[i]; +/***/ }), - if (child.mask) - { - child.mask.preRenderCanvas(this, child, camera); - } +/***/ 11401: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - child.renderCanvas(this, child, camera); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (child.mask) - { - child.mask.postRenderCanvas(this, child, camera); - } - } +var FillStyleCanvas = __webpack_require__(15608); +var LineStyleCanvas = __webpack_require__(17876); +var SetTransform = __webpack_require__(49584); - ctx.setTransform(1, 0, 0, 1, 0, 0); - ctx.globalCompositeOperation = 'source-over'; - ctx.globalAlpha = 1; +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Star#renderCanvas + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Star} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var StarCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - camera.flashEffect.postRenderCanvas(ctx); - camera.fadeEffect.postRenderCanvas(ctx); + var ctx = renderer.currentContext; - camera.dirty = false; + if (SetTransform(renderer, ctx, src, camera, parentMatrix)) + { + var dx = src._displayOriginX; + var dy = src._displayOriginY; - if (mask) + var path = src.pathData; + var pathLength = path.length - 1; + + var px1 = path[0] - dx; + var py1 = path[1] - dy; + + ctx.beginPath(); + + ctx.moveTo(px1, py1); + + if (!src.closePath) { - mask.postRenderCanvas(this); + pathLength -= 2; } - // Restore pre-clip context - ctx.restore(); - - if (camera.renderToTexture) + for (var i = 2; i < pathLength; i += 2) { - camera.emit(CameraEvents.POST_RENDER, camera); + var px2 = path[i] - dx; + var py2 = path[i + 1] - dy; - if (camera.renderToGame) - { - scene.sys.context.drawImage(camera.canvas, cx, cy); - } + ctx.lineTo(px2, py2); } - }, - - /** - * Restores the game context's global settings and takes a snapshot if one is scheduled. - * - * The post-render step happens after all Cameras in all Scenes have been rendered. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#postRender - * @fires Phaser.Renderer.Events#POST_RENDER - * @since 3.0.0 - */ - postRender: function () - { - var ctx = this.gameContext; - ctx.restore(); + ctx.closePath(); - this.emit(Events.POST_RENDER); + if (src.isFilled) + { + FillStyleCanvas(ctx, src); - var state = this.snapshotState; + ctx.fill(); + } - if (state.callback) + if (src.isStroked) { - CanvasSnapshot(this.gameCanvas, state); + LineStyleCanvas(ctx, src); - state.callback = null; + ctx.stroke(); } - }, - - /** - * Takes a snapshot of the given area of the given canvas. - * - * Unlike the other snapshot methods, this one is processed immediately and doesn't wait for the next render. - * - * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets - * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotCanvas - * @since 3.19.0 - * - * @param {HTMLCanvasElement} canvas - The canvas to grab from. - * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. - * @param {boolean} [getPixel=false] - Grab a single pixel as a Color object, or an area as an Image object? - * @param {number} [x=0] - The x coordinate to grab from. - * @param {number} [y=0] - The y coordinate to grab from. - * @param {number} [width=canvas.width] - The width of the area to grab. - * @param {number} [height=canvas.height] - The height of the area to grab. - * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. - * - * @return {this} This Canvas Renderer. - */ - snapshotCanvas: function (canvas, callback, getPixel, x, y, width, height, type, encoderOptions) - { - if (getPixel === undefined) { getPixel = false; } - this.snapshotArea(x, y, width, height, callback, type, encoderOptions); + // Restore the context saved in SetTransform + ctx.restore(); + } +}; - var state = this.snapshotState; +module.exports = StarCanvasRenderer; - state.getPixel = getPixel; - CanvasSnapshot(this.canvas, state); +/***/ }), - state.callback = null; +/***/ 23962: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. - * - * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. - * - * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then - * calling this method will override it. - * - * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets - * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot - * @since 3.0.0 - * - * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. - * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. - * - * @return {this} This WebGL Renderer. - */ - snapshot: function (callback, type, encoderOptions) - { - return this.snapshotArea(0, 0, this.gameCanvas.width, this.gameCanvas.height, callback, type, encoderOptions); - }, +var Star = __webpack_require__(77843); +var GameObjectFactory = __webpack_require__(61286); - /** - * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. - * - * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. - * - * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then - * calling this method will override it. - * - * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets - * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotArea - * @since 3.16.0 - * - * @param {number} x - The x coordinate to grab from. - * @param {number} y - The y coordinate to grab from. - * @param {number} width - The width of the area to grab. - * @param {number} height - The height of the area to grab. - * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. - * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. - * - * @return {this} This WebGL Renderer. - */ - snapshotArea: function (x, y, width, height, callback, type, encoderOptions) - { - var state = this.snapshotState; +/** + * Creates a new Star Shape Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Star Game Object has been built into Phaser. + * + * The Star Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. + * + * This shape supports both fill and stroke colors. + * + * As the name implies, the Star shape will display a star in your game. You can control several + * aspects of it including the number of points that constitute the star. The default is 5. If + * you change it to 4 it will render as a diamond. If you increase them, you'll get a more spiky + * star shape. + * + * You can also control the inner and outer radius, which is how 'long' each point of the star is. + * Modify these values to create more interesting shapes. + * + * @method Phaser.GameObjects.GameObjectFactory#star + * @since 3.13.0 + * + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [points=5] - The number of points on the star. + * @param {number} [innerRadius=32] - The inner radius of the star. + * @param {number} [outerRadius=64] - The outer radius of the star. + * @param {number} [fillColor] - The color the star will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the star will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * + * @return {Phaser.GameObjects.Star} The Game Object that was created. + */ +GameObjectFactory.register('star', function (x, y, points, innerRadius, outerRadius, fillColor, fillAlpha) +{ + return this.displayList.add(new Star(this.scene, x, y, points, innerRadius, outerRadius, fillColor, fillAlpha)); +}); - state.callback = callback; - state.type = type; - state.encoder = encoderOptions; - state.getPixel = false; - state.x = x; - state.y = y; - state.width = Math.min(width, this.gameCanvas.width); - state.height = Math.min(height, this.gameCanvas.height); - return this; - }, +/***/ }), - /** - * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. - * - * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. - * - * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then - * calling this method will override it. - * - * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for - * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, - * using less memory. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotPixel - * @since 3.16.0 - * - * @param {number} x - The x coordinate of the pixel to get. - * @param {number} y - The y coordinate of the pixel to get. - * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. - * - * @return {this} This WebGL Renderer. - */ - snapshotPixel: function (x, y, callback) - { - this.snapshotArea(x, y, 1, 1, callback); +/***/ 87956: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.snapshotState.getPixel = true; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - /** - * Takes a Sprite Game Object, or any object that extends it, and draws it to the current context. - * - * @method Phaser.Renderer.Canvas.CanvasRenderer#batchSprite - * @since 3.12.0 - * - * @param {Phaser.GameObjects.GameObject} sprite - The texture based Game Object to draw. - * @param {Phaser.Textures.Frame} frame - The frame to draw, doesn't have to be that owned by the Game Object. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set. - */ - batchSprite: function (sprite, frame, camera, parentTransformMatrix) - { - var alpha = camera.alpha * sprite.alpha; +if (true) +{ + renderWebGL = __webpack_require__(12037); +} - if (alpha === 0) - { - // Nothing to see, so abort early - return; - } +if (true) +{ + renderCanvas = __webpack_require__(11401); +} - var ctx = this.currentContext; +module.exports = { - var camMatrix = this._tempMatrix1; - var spriteMatrix = this._tempMatrix2; + renderWebGL: renderWebGL, + renderCanvas: renderCanvas - var cd = frame.canvasData; +}; - var frameX = cd.x; - var frameY = cd.y; - var frameWidth = frame.cutWidth; - var frameHeight = frame.cutHeight; - var customPivot = frame.customPivot; - var res = frame.source.resolution; +/***/ }), - var displayOriginX = sprite.displayOriginX; - var displayOriginY = sprite.displayOriginY; +/***/ 12037: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var x = -displayOriginX + frame.x; - var y = -displayOriginY + frame.y; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (sprite.isCropped) - { - var crop = sprite._crop; +var FillPathWebGL = __webpack_require__(19543); +var GetCalcMatrix = __webpack_require__(73329); +var StrokePathWebGL = __webpack_require__(50262); - if (crop.flipX !== sprite.flipX || crop.flipY !== sprite.flipY) - { - frame.updateCropUVs(crop, sprite.flipX, sprite.flipY); - } +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Star#renderWebGL + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Star} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var StarWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - frameWidth = crop.cw; - frameHeight = crop.ch; + var pipeline = renderer.pipelines.set(src.pipeline); - frameX = crop.cx; - frameY = crop.cy; + var result = GetCalcMatrix(src, camera, parentMatrix); - x = -displayOriginX + crop.x; - y = -displayOriginY + crop.y; + var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); - if (sprite.flipX) - { - if (x >= 0) - { - x = -(x + frameWidth); - } - else if (x < 0) - { - x = (Math.abs(x) - frameWidth); - } - } + var dx = src._displayOriginX; + var dy = src._displayOriginY; - if (sprite.flipY) - { - if (y >= 0) - { - y = -(y + frameHeight); - } - else if (y < 0) - { - y = (Math.abs(y) - frameHeight); - } - } - } + var alpha = camera.alpha * src.alpha; - var flipX = 1; - var flipY = 1; + renderer.pipelines.preBatch(src); - if (sprite.flipX) - { - if (!customPivot) - { - x += (-frame.realWidth + (displayOriginX * 2)); - } + if (src.isFilled) + { + FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); + } - flipX = -1; - } + if (src.isStroked) + { + StrokePathWebGL(pipeline, src, alpha, dx, dy); + } - // Auto-invert the flipY if this is coming from a GLTexture - if (sprite.flipY) - { - if (!customPivot) - { - y += (-frame.realHeight + (displayOriginY * 2)); - } + renderer.pipelines.postBatch(src); +}; - flipY = -1; - } +module.exports = StarWebGLRenderer; - spriteMatrix.applyITRS(sprite.x, sprite.y, sprite.rotation, sprite.scaleX * flipX, sprite.scaleY * flipY); - camMatrix.copyFrom(camera.matrix); +/***/ }), - if (parentTransformMatrix) - { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * sprite.scrollFactorX, -camera.scrollY * sprite.scrollFactorY); +/***/ 21873: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Undo the camera scroll - spriteMatrix.e = sprite.x; - spriteMatrix.f = sprite.y; - } - else - { - spriteMatrix.e -= camera.scrollX * sprite.scrollFactorX; - spriteMatrix.f -= camera.scrollY * sprite.scrollFactorY; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Multiply by the Sprite matrix - camMatrix.multiply(spriteMatrix); +var Class = __webpack_require__(56694); +var Shape = __webpack_require__(91461); +var GeomTriangle = __webpack_require__(66349); +var TriangleRender = __webpack_require__(70498); - ctx.save(); +/** + * @classdesc + * The Triangle Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. + * + * This shape supports both fill and stroke colors. + * + * The Triangle consists of 3 lines, joining up to form a triangular shape. You can control the + * position of each point of these lines. The triangle is always closed and cannot have an open + * face. If you require that, consider using a Polygon instead. + * + * @class Triangle + * @extends Phaser.GameObjects.Shape + * @memberof Phaser.GameObjects + * @constructor + * @since 3.13.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [x1=0] - The horizontal position of the first point in the triangle. + * @param {number} [y1=128] - The vertical position of the first point in the triangle. + * @param {number} [x2=64] - The horizontal position of the second point in the triangle. + * @param {number} [y2=0] - The vertical position of the second point in the triangle. + * @param {number} [x3=128] - The horizontal position of the third point in the triangle. + * @param {number} [y3=128] - The vertical position of the third point in the triangle. + * @param {number} [fillColor] - The color the triangle will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the triangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + */ +var Triangle = new Class({ - camMatrix.setToContext(ctx); + Extends: Shape, - ctx.globalCompositeOperation = this.blendModes[sprite.blendMode]; + Mixins: [ + TriangleRender + ], - ctx.globalAlpha = alpha; + initialize: - ctx.imageSmoothingEnabled = !(!this.antialias || frame.source.scaleMode); + function Triangle (scene, x, y, x1, y1, x2, y2, x3, y3, fillColor, fillAlpha) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (x1 === undefined) { x1 = 0; } + if (y1 === undefined) { y1 = 128; } + if (x2 === undefined) { x2 = 64; } + if (y2 === undefined) { y2 = 0; } + if (x3 === undefined) { x3 = 128; } + if (y3 === undefined) { y3 = 128; } - if (sprite.mask) - { - sprite.mask.preRenderCanvas(this, sprite, camera); - } + Shape.call(this, scene, 'Triangle', new GeomTriangle(x1, y1, x2, y2, x3, y3)); - ctx.drawImage(frame.source.image, frameX, frameY, frameWidth, frameHeight, x, y, frameWidth / res, frameHeight / res); + var width = this.geom.right - this.geom.left; + var height = this.geom.bottom - this.geom.top; - if (sprite.mask) + this.setPosition(x, y); + this.setSize(width, height); + + if (fillColor !== undefined) { - sprite.mask.postRenderCanvas(this, sprite, camera); + this.setFillStyle(fillColor, fillAlpha); } - ctx.restore(); + this.updateDisplayOrigin(); + this.updateData(); }, /** - * Destroys all object references in the Canvas Renderer. + * Sets the data for the lines that make up this Triangle shape. * - * @method Phaser.Renderer.Canvas.CanvasRenderer#destroy - * @since 3.0.0 + * @method Phaser.GameObjects.Triangle#setTo + * @since 3.13.0 + * + * @param {number} [x1=0] - The horizontal position of the first point in the triangle. + * @param {number} [y1=0] - The vertical position of the first point in the triangle. + * @param {number} [x2=0] - The horizontal position of the second point in the triangle. + * @param {number} [y2=0] - The vertical position of the second point in the triangle. + * @param {number} [x3=0] - The horizontal position of the third point in the triangle. + * @param {number} [y3=0] - The vertical position of the third point in the triangle. + * + * @return {this} This Game Object instance. */ - destroy: function () + setTo: function (x1, y1, x2, y2, x3, y3) { - this.removeAllListeners(); + this.geom.setTo(x1, y1, x2, y2, x3, y3); - this.game = null; - this.gameCanvas = null; - this.gameContext = null; + return this.updateData(); + }, + + /** + * Internal method that updates the data and path values. + * + * @method Phaser.GameObjects.Triangle#updateData + * @private + * @since 3.13.0 + * + * @return {this} This Game Object instance. + */ + updateData: function () + { + var path = []; + var tri = this.geom; + var line = this._tempLine; + + tri.getLineA(line); + + path.push(line.x1, line.y1, line.x2, line.y2); + + tri.getLineB(line); + + path.push(line.x2, line.y2); + + tri.getLineC(line); + + path.push(line.x2, line.y2); + + this.pathData = path; + + return this; } }); -module.exports = CanvasRenderer; +module.exports = Triangle; /***/ }), -/* 369 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 60213: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(31); -var Color = __webpack_require__(38); -var GetFastValue = __webpack_require__(2); +var FillStyleCanvas = __webpack_require__(15608); +var LineStyleCanvas = __webpack_require__(17876); +var SetTransform = __webpack_require__(49584); /** - * Takes a snapshot of an area from the current frame displayed by a canvas. - * - * This is then copied to an Image object. When this loads, the results are sent - * to the callback provided in the Snapshot Configuration object. + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @function Phaser.Renderer.Snapshot.Canvas - * @since 3.0.0 + * @method Phaser.GameObjects.Triangle#renderCanvas + * @since 3.13.0 + * @private * - * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. - * @param {Phaser.Types.Renderer.Snapshot.SnapshotState} config - The snapshot configuration object. + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Triangle} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var CanvasSnapshot = function (canvas, config) +var TriangleCanvasRenderer = function (renderer, src, camera, parentMatrix) { - var callback = GetFastValue(config, 'callback'); - var type = GetFastValue(config, 'type', 'image/png'); - var encoderOptions = GetFastValue(config, 'encoder', 0.92); - var x = Math.abs(Math.round(GetFastValue(config, 'x', 0))); - var y = Math.abs(Math.round(GetFastValue(config, 'y', 0))); - var width = GetFastValue(config, 'width', canvas.width); - var height = GetFastValue(config, 'height', canvas.height); - var getPixel = GetFastValue(config, 'getPixel', false); + camera.addToRenderList(src); - if (getPixel) - { - var context = canvas.getContext('2d'); - var imageData = context.getImageData(x, y, 1, 1); - var data = imageData.data; + var ctx = renderer.currentContext; - callback.call(null, new Color(data[0], data[1], data[2], data[3] / 255)); - } - else if (x !== 0 || y !== 0 || width !== canvas.width || height !== canvas.height) + if (SetTransform(renderer, ctx, src, camera, parentMatrix)) { - // Area Grab - var copyCanvas = CanvasPool.createWebGL(this, width, height); - var ctx = copyCanvas.getContext('2d'); + var dx = src._displayOriginX; + var dy = src._displayOriginY; - ctx.drawImage(canvas, x, y, width, height, 0, 0, width, height); + var x1 = src.geom.x1 - dx; + var y1 = src.geom.y1 - dy; + var x2 = src.geom.x2 - dx; + var y2 = src.geom.y2 - dy; + var x3 = src.geom.x3 - dx; + var y3 = src.geom.y3 - dy; - var image1 = new Image(); - - image1.onerror = function () - { - callback.call(null); + ctx.beginPath(); - CanvasPool.remove(copyCanvas); - }; + ctx.moveTo(x1, y1); + ctx.lineTo(x2, y2); + ctx.lineTo(x3, y3); - image1.onload = function () + ctx.closePath(); + + if (src.isFilled) { - callback.call(null, image1); + FillStyleCanvas(ctx, src); - CanvasPool.remove(copyCanvas); - }; + ctx.fill(); + } - image1.src = copyCanvas.toDataURL(type, encoderOptions); - } - else - { - // Full Grab - var image2 = new Image(); - - image2.onerror = function () + if (src.isStroked) { - callback.call(null); - }; + LineStyleCanvas(ctx, src); - image2.onload = function () - { - callback.call(null, image2); - }; + ctx.stroke(); + } - image2.src = canvas.toDataURL(type, encoderOptions); + // Restore the context saved in SetTransform + ctx.restore(); } }; -module.exports = CanvasSnapshot; +module.exports = TriangleCanvasRenderer; /***/ }), -/* 370 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 79296: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var modes = __webpack_require__(35); -var CanvasFeatures = __webpack_require__(348); +var GameObjectFactory = __webpack_require__(61286); +var Triangle = __webpack_require__(21873); /** - * Returns an array which maps the default blend modes to supported Canvas blend modes. + * Creates a new Triangle Shape Game Object and adds it to the Scene. * - * If the browser doesn't support a blend mode, it will default to the normal `source-over` blend mode. + * Note: This method will only be available if the Triangle Game Object has been built into Phaser. * - * @function Phaser.Renderer.Canvas.GetBlendModes - * @since 3.0.0 + * The Triangle Shape is a Game Object that can be added to a Scene, Group or Container. You can + * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling + * it for input or physics. It provides a quick and easy way for you to render this shape in your + * game without using a texture, while still taking advantage of being fully batched in WebGL. * - * @return {array} Which Canvas blend mode corresponds to which default Phaser blend mode. + * This shape supports both fill and stroke colors. + * + * The Triangle consists of 3 lines, joining up to form a triangular shape. You can control the + * position of each point of these lines. The triangle is always closed and cannot have an open + * face. If you require that, consider using a Polygon instead. + * + * @method Phaser.GameObjects.GameObjectFactory#triangle + * @since 3.13.0 + * + * @param {number} [x=0] - The horizontal position of this Game Object in the world. + * @param {number} [y=0] - The vertical position of this Game Object in the world. + * @param {number} [x1=0] - The horizontal position of the first point in the triangle. + * @param {number} [y1=128] - The vertical position of the first point in the triangle. + * @param {number} [x2=64] - The horizontal position of the second point in the triangle. + * @param {number} [y2=0] - The vertical position of the second point in the triangle. + * @param {number} [x3=128] - The horizontal position of the third point in the triangle. + * @param {number} [y3=128] - The vertical position of the third point in the triangle. + * @param {number} [fillColor] - The color the triangle will be filled with, i.e. 0xff0000 for red. + * @param {number} [fillAlpha] - The alpha the triangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * + * @return {Phaser.GameObjects.Triangle} The Game Object that was created. */ -var GetBlendModes = function () +GameObjectFactory.register('triangle', function (x, y, x1, y1, x2, y2, x3, y3, fillColor, fillAlpha) { - var output = []; - var useNew = CanvasFeatures.supportNewBlendModes; - var so = 'source-over'; - - output[modes.NORMAL] = so; - output[modes.ADD] = 'lighter'; - output[modes.MULTIPLY] = (useNew) ? 'multiply' : so; - output[modes.SCREEN] = (useNew) ? 'screen' : so; - output[modes.OVERLAY] = (useNew) ? 'overlay' : so; - output[modes.DARKEN] = (useNew) ? 'darken' : so; - output[modes.LIGHTEN] = (useNew) ? 'lighten' : so; - output[modes.COLOR_DODGE] = (useNew) ? 'color-dodge' : so; - output[modes.COLOR_BURN] = (useNew) ? 'color-burn' : so; - output[modes.HARD_LIGHT] = (useNew) ? 'hard-light' : so; - output[modes.SOFT_LIGHT] = (useNew) ? 'soft-light' : so; - output[modes.DIFFERENCE] = (useNew) ? 'difference' : so; - output[modes.EXCLUSION] = (useNew) ? 'exclusion' : so; - output[modes.HUE] = (useNew) ? 'hue' : so; - output[modes.SATURATION] = (useNew) ? 'saturation' : so; - output[modes.COLOR] = (useNew) ? 'color' : so; - output[modes.LUMINOSITY] = (useNew) ? 'luminosity' : so; - output[modes.ERASE] = 'destination-out'; - output[modes.SOURCE_IN] = 'source-in'; - output[modes.SOURCE_OUT] = 'source-out'; - output[modes.SOURCE_ATOP] = 'source-atop'; - output[modes.DESTINATION_OVER] = 'destination-over'; - output[modes.DESTINATION_IN] = 'destination-in'; - output[modes.DESTINATION_OUT] = 'destination-out'; - output[modes.DESTINATION_ATOP] = 'destination-atop'; - output[modes.LIGHTER] = 'lighter'; - output[modes.COPY] = 'copy'; - output[modes.XOR] = 'xor'; - - return output; -}; - -module.exports = GetBlendModes; + return this.displayList.add(new Triangle(this.scene, x, y, x1, y1, x2, y2, x3, y3, fillColor, fillAlpha)); +}); /***/ }), -/* 371 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 70498: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayRemove = __webpack_require__(93); -var CameraEvents = __webpack_require__(37); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(33); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(91); -var GameEvents = __webpack_require__(22); -var IsSizePowerOfTwo = __webpack_require__(138); -var Matrix4 = __webpack_require__(69); -var NOOP = __webpack_require__(1); -var PipelineManager = __webpack_require__(372); -var RenderTarget = __webpack_require__(141); -var ScaleEvents = __webpack_require__(104); -var TextureEvents = __webpack_require__(106); -var Utils = __webpack_require__(12); -var WebGLSnapshot = __webpack_require__(383); +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; -/** - * @callback WebGLContextCallback - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer which owns the context. - */ +if (true) +{ + renderWebGL = __webpack_require__(72291); +} -/** - * @classdesc - * WebGLRenderer is a class that contains the needed functionality to keep the - * WebGLRenderingContext state clean. The main idea of the WebGLRenderer is to keep track of - * any context change that happens for WebGL rendering inside of Phaser. This means - * if raw webgl functions are called outside the WebGLRenderer of the Phaser WebGL - * rendering ecosystem they might pollute the current WebGLRenderingContext state producing - * unexpected behavior. It's recommended that WebGL interaction is done through - * WebGLRenderer and/or WebGLPipeline. - * - * @class WebGLRenderer - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Renderer.WebGL - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - The Game instance which owns this WebGL Renderer. - */ -var WebGLRenderer = new Class({ +if (true) +{ + renderCanvas = __webpack_require__(60213); +} - Extends: EventEmitter, +module.exports = { - initialize: + renderWebGL: renderWebGL, + renderCanvas: renderCanvas - function WebGLRenderer (game) - { - EventEmitter.call(this); +}; - var gameConfig = game.config; - var contextCreationConfig = { - alpha: gameConfig.transparent, - desynchronized: gameConfig.desynchronized, - depth: false, - antialias: gameConfig.antialiasGL, - premultipliedAlpha: gameConfig.premultipliedAlpha, - stencil: true, - failIfMajorPerformanceCaveat: gameConfig.failIfMajorPerformanceCaveat, - powerPreference: gameConfig.powerPreference, - preserveDrawingBuffer: gameConfig.preserveDrawingBuffer - }; +/***/ }), - /** - * The local configuration settings of this WebGL Renderer. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#config - * @type {object} - * @since 3.0.0 - */ - this.config = { - clearBeforeRender: gameConfig.clearBeforeRender, - antialias: gameConfig.antialias, - backgroundColor: gameConfig.backgroundColor, - contextCreation: contextCreationConfig, - roundPixels: gameConfig.roundPixels, - maxTextures: gameConfig.maxTextures, - maxTextureSize: gameConfig.maxTextureSize, - batchSize: gameConfig.batchSize, - maxLights: gameConfig.maxLights, - mipmapFilter: gameConfig.mipmapFilter - }; +/***/ 72291: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The Game instance which owns this WebGL Renderer. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * A constant which allows the renderer to be easily identified as a WebGL Renderer. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#type - * @type {number} - * @since 3.0.0 - */ - this.type = CONST.WEBGL; +var GetCalcMatrix = __webpack_require__(73329); +var StrokePathWebGL = __webpack_require__(50262); +var Utils = __webpack_require__(75512); - /** - * An instance of the Pipeline Manager class, that handles all WebGL Pipelines. - * - * Use this to manage all of your interactions with pipelines, such as adding, getting, - * setting and rendering them. - * - * The Pipeline Manager class is created in the `init` method and then populated - * with pipelines during the `boot` method. - * - * Prior to Phaser v3.50.0 this was just a plain JavaScript object, not a class. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#pipelines - * @type {Phaser.Renderer.WebGL.PipelineManager} - * @since 3.50.0 - */ - this.pipelines = null; +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Triangle#renderWebGL + * @since 3.13.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Triangle} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var TriangleWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - /** - * The width of the canvas being rendered to. - * This is populated in the onResize event handler. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#width - * @type {number} - * @since 3.0.0 - */ - this.width = 0; + var pipeline = renderer.pipelines.set(src.pipeline); - /** - * The height of the canvas being rendered to. - * This is populated in the onResize event handler. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#height - * @type {number} - * @since 3.0.0 - */ - this.height = 0; + var result = GetCalcMatrix(src, camera, parentMatrix); - /** - * The canvas which this WebGL Renderer draws to. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas = game.canvas; + pipeline.calcMatrix.copyFrom(result.calc); - /** - * An array of blend modes supported by the WebGL Renderer. - * - * This array includes the default blend modes as well as any custom blend modes added through {@link #addBlendMode}. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#blendModes - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.blendModes = []; + var dx = src._displayOriginX; + var dy = src._displayOriginY; + var alpha = camera.alpha * src.alpha; - /** - * This property is set to `true` if the WebGL context of the renderer is lost. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#contextLost - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.contextLost = false; + renderer.pipelines.preBatch(src); - /** - * Details about the currently scheduled snapshot. - * - * If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#snapshotState - * @type {Phaser.Types.Renderer.Snapshot.SnapshotState} - * @since 3.0.0 - */ - this.snapshotState = { - x: 0, - y: 0, - width: 1, - height: 1, - getPixel: false, - callback: null, - type: 'image/png', - encoder: 0.92, - isFramebuffer: false, - bufferWidth: 0, - bufferHeight: 0 - }; + if (src.isFilled) + { + var fillTint = pipeline.fillTint; + var fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); - /** - * Cached value for the last texture unit that was used. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentActiveTexture - * @type {number} - * @since 3.1.0 - */ - this.currentActiveTexture = 0; + fillTint.TL = fillTintColor; + fillTint.TR = fillTintColor; + fillTint.BL = fillTintColor; + fillTint.BR = fillTintColor; - /** - * Contains the current starting active texture unit. - * This value is constantly updated and should be treated as read-only by your code. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#startActiveTexture - * @type {number} - * @since 3.50.0 - */ - this.startActiveTexture = 0; + var x1 = src.geom.x1 - dx; + var y1 = src.geom.y1 - dy; + var x2 = src.geom.x2 - dx; + var y2 = src.geom.y2 - dy; + var x3 = src.geom.x3 - dx; + var y3 = src.geom.y3 - dy; - /** - * The maximum number of textures the GPU can handle. The minimum under the WebGL1 spec is 8. - * This is set via the Game Config `maxTextures` property and should never be changed after boot. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#maxTextures - * @type {number} - * @since 3.50.0 - */ - this.maxTextures = 0; + pipeline.batchFillTriangle( + x1, + y1, + x2, + y2, + x3, + y3, + result.sprite, + result.camera + ); + } - /** - * An array of the available WebGL texture units, used to populate the uSampler uniforms. - * - * This array is populated during the init phase and should never be changed after boot. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#textureIndexes - * @type {array} - * @since 3.50.0 - */ - this.textureIndexes; + if (src.isStroked) + { + StrokePathWebGL(pipeline, src, alpha, dx, dy); + } - /** - * An array of default temporary WebGL Textures. - * - * This array is populated during the init phase and should never be changed after boot. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#tempTextures - * @type {array} - * @since 3.50.0 - */ - this.tempTextures; + renderer.pipelines.postBatch(src); +}; - /** - * The currently bound texture at texture unit zero, if any. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#textureZero - * @type {?WebGLTexture} - * @since 3.50.0 - */ - this.textureZero; +module.exports = TriangleWebGLRenderer; - /** - * The currently bound normal map texture at texture unit one, if any. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#normalTexture - * @type {?WebGLTexture} - * @since 3.50.0 - */ - this.normalTexture; - /** - * The currently bound framebuffer in use. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentFramebuffer - * @type {WebGLFramebuffer} - * @default null - * @since 3.0.0 - */ - this.currentFramebuffer = null; +/***/ }), - /** - * A stack into which the frame buffer objects are pushed and popped. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#fboStack - * @type {WebGLFramebuffer[]} - * @since 3.50.0 - */ - this.fboStack = []; +/***/ 13747: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Current WebGLProgram in use. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentProgram - * @type {WebGLProgram} - * @default null - * @since 3.0.0 - */ - this.currentProgram = null; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Current blend mode in use - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentBlendMode - * @type {number} - * @since 3.0.0 - */ - this.currentBlendMode = Infinity; +var AnimationState = __webpack_require__(16569); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var SpriteRender = __webpack_require__(20791); - /** - * Indicates if the the scissor state is enabled in WebGLRenderingContext - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissorEnabled - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.currentScissorEnabled = false; +/** + * @classdesc + * A Sprite Game Object. + * + * A Sprite Game Object is used for the display of both static and animated images in your game. + * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled + * and animated. + * + * The main difference between a Sprite and an Image Game Object is that you cannot animate Images. + * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation + * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases. + * + * @class Sprite + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.0.0 + * + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.TextureCrop + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + */ +var Sprite = new Class({ - /** - * Stores the current scissor data - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissor - * @type {Uint32Array} - * @since 3.0.0 - */ - this.currentScissor = null; + Extends: GameObject, - /** - * Stack of scissor data - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#scissorStack - * @type {Uint32Array} - * @since 3.0.0 - */ - this.scissorStack = []; + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.Depth, + Components.Flip, + Components.GetBounds, + Components.Mask, + Components.Origin, + Components.Pipeline, + Components.PostPipeline, + Components.ScrollFactor, + Components.Size, + Components.TextureCrop, + Components.Tint, + Components.Transform, + Components.Visible, + SpriteRender + ], - /** - * The handler to invoke when the context is lost. - * This should not be changed and is set in the boot method. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#contextLostHandler - * @type {function} - * @since 3.19.0 - */ - this.contextLostHandler = NOOP; + initialize: - /** - * The handler to invoke when the context is restored. - * This should not be changed and is set in the boot method. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#contextRestoredHandler - * @type {function} - * @since 3.19.0 - */ - this.contextRestoredHandler = NOOP; + function Sprite (scene, x, y, texture, frame) + { + GameObject.call(this, scene, 'Sprite'); /** - * The underlying WebGL context of the renderer. + * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. * - * @name Phaser.Renderer.WebGL.WebGLRenderer#gl - * @type {WebGLRenderingContext} - * @default null - * @since 3.0.0 + * @name Phaser.GameObjects.Sprite#_crop + * @type {object} + * @private + * @since 3.11.0 */ - this.gl = null; + this._crop = this.resetCropObject(); /** - * Array of strings that indicate which WebGL extensions are supported by the browser. - * This is populated in the `boot` method. + * The Animation State component of this Sprite. * - * @name Phaser.Renderer.WebGL.WebGLRenderer#supportedExtensions - * @type {string[]} - * @default null + * This component provides features to apply animations to this Sprite. + * It is responsible for playing, loading, queuing animations for later playback, + * mixing between animations and setting the current animation frame to this Sprite. + * + * @name Phaser.GameObjects.Sprite#anims + * @type {Phaser.Animations.AnimationState} * @since 3.0.0 */ - this.supportedExtensions = null; + this.anims = new AnimationState(this); - /** - * If the browser supports the `ANGLE_instanced_arrays` extension, this property will hold - * a reference to the glExtension for it. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#instancedArraysExtension - * @type {ANGLE_instanced_arrays} - * @default null - * @since 3.50.0 - */ - this.instancedArraysExtension = null; + this.setTexture(texture, frame); + this.setPosition(x, y); + this.setSizeToFrame(); + this.setOriginFromFrame(); + this.initPipeline(); + this.initPostPipeline(true); + }, - /** - * If the browser supports the `OES_vertex_array_object` extension, this property will hold - * a reference to the glExtension for it. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#vaoExtension - * @type {OES_vertex_array_object} - * @default null - * @since 3.50.0 - */ - this.vaoExtension = null; + // Overrides Game Object method + addedToScene: function () + { + this.scene.sys.updateList.add(this); + }, - /** - * The WebGL Extensions loaded into the current context. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#extensions - * @type {object} - * @default {} - * @since 3.0.0 - */ - this.extensions = {}; - - /** - * Stores the current WebGL component formats for further use. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#glFormats - * @type {array} - * @default [] - * @since 3.2.0 - */ - this.glFormats = []; - - /** - * Stores the supported WebGL texture compression formats. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#compression - * @type {Phaser.Types.Renderer.WebGL.WebGLTextureCompression} - * @since 3.8.0 - */ - this.compression = { - ETC1: false, - PVRTC: false, - S3TC: false - }; - - /** - * Cached drawing buffer height to reduce gl calls. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#drawingBufferHeight - * @type {number} - * @readonly - * @since 3.11.0 - */ - this.drawingBufferHeight = 0; - - /** - * A blank 32x32 transparent texture, as used by the Graphics system where needed. - * This is set in the `boot` method. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#blankTexture - * @type {WebGLTexture} - * @readonly - * @since 3.12.0 - */ - this.blankTexture = null; - - /** - * A pure white 4x4 texture, as used by the Graphics system where needed. - * This is set in the `boot` method. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#whiteTexture - * @type {WebGLTexture} - * @readonly - * @since 3.50.0 - */ - this.whiteTexture = null; - - /** - * The total number of masks currently stacked. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#maskCount - * @type {number} - * @since 3.17.0 - */ - this.maskCount = 0; - - /** - * The mask stack. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#maskStack - * @type {Phaser.Display.Masks.GeometryMask[]} - * @since 3.17.0 - */ - this.maskStack = []; - - /** - * Internal property that tracks the currently set mask. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentMask - * @type {any} - * @since 3.17.0 - */ - this.currentMask = { mask: null, camera: null }; - - /** - * Internal property that tracks the currently set camera mask. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentCameraMask - * @type {any} - * @since 3.17.0 - */ - this.currentCameraMask = { mask: null, camera: null }; - - /** - * Internal gl function mapping for uniform look-up. - * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#glFuncMap - * @type {any} - * @since 3.17.0 - */ - this.glFuncMap = null; - - /** - * The `type` of the Game Object being currently rendered. - * This can be used by advanced render functions for batching look-ahead. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#currentType - * @type {string} - * @since 3.19.0 - */ - this.currentType = ''; - - /** - * Is the `type` of the Game Object being currently rendered different than the - * type of the object before it in the display list? I.e. it's a 'new' type. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#newType - * @type {boolean} - * @since 3.19.0 - */ - this.newType = false; - - /** - * Does the `type` of the next Game Object in the display list match that - * of the object being currently rendered? - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#nextTypeMatch - * @type {boolean} - * @since 3.19.0 - */ - this.nextTypeMatch = false; - - /** - * Is the Game Object being currently rendered the final one in the list? - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#finalType - * @type {boolean} - * @since 3.50.0 - */ - this.finalType = false; - - /** - * The mipmap magFilter to be used when creating textures. - * - * You can specify this as a string in the game config, i.e.: - * - * `renderer: { mipmapFilter: 'NEAREST_MIPMAP_LINEAR' }` - * - * The 6 options for WebGL1 are, in order from least to most computationally expensive: - * - * NEAREST (for pixel art) - * LINEAR (the default) - * NEAREST_MIPMAP_NEAREST - * LINEAR_MIPMAP_NEAREST - * NEAREST_MIPMAP_LINEAR - * LINEAR_MIPMAP_LINEAR - * - * Mipmaps only work with textures that are fully power-of-two in size. - * - * For more details see https://webglfundamentals.org/webgl/lessons/webgl-3d-textures.html - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#mipmapFilter - * @type {GLenum} - * @since 3.21.0 - */ - this.mipmapFilter = null; - - /** - * The number of times the renderer had to flush this frame, due to running out of texture units. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#textureFlush - * @type {number} - * @since 3.50.0 - */ - this.textureFlush = 0; - - /** - * Are the WebGL Textures in their default state? - * - * Used to avoid constant gl binds. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#isTextureClean - * @type {boolean} - * @since 3.51.0 - */ - this.isTextureClean = false; - - /** - * The default scissor, set during `preRender` and modified during `resize`. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#defaultScissor - * @type {number[]} - * @private - * @since 3.50.0 - */ - this.defaultScissor = [ 0, 0, 0, 0 ]; - - /** - * Has this renderer fully booted yet? - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#isBooted - * @type {boolean} - * @since 3.50.0 - */ - this.isBooted = false; - - /** - * A Render Target you can use to capture the current state of the Renderer. - * - * A Render Target encapsulates a framebuffer and texture for the WebGL Renderer. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#renderTarget - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @since 3.50.0 - */ - this.renderTarget = null; - - /** - * The global game Projection matrix, used by shaders as 'uProjectionMatrix' uniform. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#projectionMatrix - * @type {Phaser.Math.Matrix4} - * @since 3.50.0 - */ - this.projectionMatrix; - - /** - * The cached width of the Projection matrix. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#projectionWidth - * @type {number} - * @since 3.50.0 - */ - this.projectionWidth = 0; - - /** - * The cached height of the Projection matrix. - * - * @name Phaser.Renderer.WebGL.WebGLRenderer#projectionHeight - * @type {number} - * @since 3.50.0 - */ - this.projectionHeight = 0; - - this.init(this.config); + // Overrides Game Object method + removedFromScene: function () + { + this.scene.sys.updateList.remove(this); }, /** - * Creates a new WebGLRenderingContext and initializes all internal state. + * Update this Sprite's animations. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#init + * @method Phaser.GameObjects.Sprite#preUpdate + * @protected * @since 3.0.0 * - * @param {object} config - The configuration object for the renderer. - * - * @return {this} This WebGLRenderer instance. + * @param {number} time - The current timestamp. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. */ - init: function (config) + preUpdate: function (time, delta) { - var gl; - var game = this.game; - var canvas = this.canvas; - var clearColor = config.backgroundColor; - - // Did they provide their own context? - if (game.config.context) - { - gl = game.config.context; - } - else - { - gl = canvas.getContext('webgl', config.contextCreation) || canvas.getContext('experimental-webgl', config.contextCreation); - } - - if (!gl || gl.isContextLost()) - { - this.contextLost = true; - - throw new Error('WebGL unsupported'); - } - - this.gl = gl; - - var _this = this; - - this.contextLostHandler = function (event) - { - _this.contextLost = true; - - _this.game.events.emit(GameEvents.CONTEXT_LOST, _this); - - event.preventDefault(); - }; - - this.contextRestoredHandler = function () - { - _this.contextLost = false; - - _this.init(_this.config); - - _this.game.events.emit(GameEvents.CONTEXT_RESTORED, _this); - }; - - canvas.addEventListener('webglcontextlost', this.contextLostHandler, false); - canvas.addEventListener('webglcontextrestored', this.contextRestoredHandler, false); - - // Set it back into the Game, so developers can access it from there too - game.context = gl; - - for (var i = 0; i <= 27; i++) - { - this.blendModes.push({ func: [ gl.ONE, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_ADD }); - } - - // ADD - this.blendModes[1].func = [ gl.ONE, gl.DST_ALPHA ]; - - // MULTIPLY - this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ]; - - // SCREEN - this.blendModes[3].func = [ gl.ONE, gl.ONE_MINUS_SRC_COLOR ]; - - // ERASE - this.blendModes[17] = { func: [ gl.ZERO, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_REVERSE_SUBTRACT }; - - this.glFormats[0] = gl.BYTE; - this.glFormats[1] = gl.SHORT; - this.glFormats[2] = gl.UNSIGNED_BYTE; - this.glFormats[3] = gl.UNSIGNED_SHORT; - this.glFormats[4] = gl.FLOAT; - - // Set the gl function map - this.glFuncMap = { - - mat2: { func: gl.uniformMatrix2fv, length: 1, matrix: true }, - mat3: { func: gl.uniformMatrix3fv, length: 1, matrix: true }, - mat4: { func: gl.uniformMatrix4fv, length: 1, matrix: true }, - - '1f': { func: gl.uniform1f, length: 1 }, - '1fv': { func: gl.uniform1fv, length: 1 }, - '1i': { func: gl.uniform1i, length: 1 }, - '1iv': { func: gl.uniform1iv, length: 1 }, - - '2f': { func: gl.uniform2f, length: 2 }, - '2fv': { func: gl.uniform2fv, length: 1 }, - '2i': { func: gl.uniform2i, length: 2 }, - '2iv': { func: gl.uniform2iv, length: 1 }, - - '3f': { func: gl.uniform3f, length: 3 }, - '3fv': { func: gl.uniform3fv, length: 1 }, - '3i': { func: gl.uniform3i, length: 3 }, - '3iv': { func: gl.uniform3iv, length: 1 }, - - '4f': { func: gl.uniform4f, length: 4 }, - '4fv': { func: gl.uniform4fv, length: 1 }, - '4i': { func: gl.uniform4i, length: 4 }, - '4iv': { func: gl.uniform4iv, length: 1 } - - }; - - // Load supported extensions - var exts = gl.getSupportedExtensions(); - - if (!config.maxTextures || config.maxTextures === -1) - { - config.maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); - } - - if (!config.maxTextureSize) - { - config.maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); - } - - var extString = 'WEBGL_compressed_texture_'; - var wkExtString = 'WEBKIT_' + extString; - - this.compression.ETC1 = gl.getExtension(extString + 'etc1') || gl.getExtension(wkExtString + 'etc1'); - this.compression.PVRTC = gl.getExtension(extString + 'pvrtc') || gl.getExtension(wkExtString + 'pvrtc'); - this.compression.S3TC = gl.getExtension(extString + 's3tc') || gl.getExtension(wkExtString + 's3tc'); - - this.supportedExtensions = exts; - - var angleString = 'ANGLE_instanced_arrays'; - - this.instancedArraysExtension = (exts.indexOf(angleString) > -1) ? gl.getExtension(angleString) : null; - - var vaoString = 'OES_vertex_array_object'; - - this.vaoExtension = (exts.indexOf(vaoString) > -1) ? gl.getExtension(vaoString) : null; - - // Setup initial WebGL state - gl.disable(gl.DEPTH_TEST); - gl.disable(gl.CULL_FACE); - - gl.enable(gl.BLEND); - - gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, clearColor.alphaGL); - - // Mipmaps - this.mipmapFilter = gl[config.mipmapFilter]; - - // Check maximum supported textures - this.maxTextures = Utils.checkShaderMax(gl, config.maxTextures); - - this.textureIndexes = []; - - // Create temporary WebGL textures - var tempTextures = this.tempTextures; - - if (Array.isArray(tempTextures)) - { - for (var t = 0; i < this.maxTextures; t++) - { - gl.deleteTexture(tempTextures[t]); - } - } - else - { - tempTextures = new Array(this.maxTextures); - } - - // Create temp textures to stop WebGL errors on mac os - for (var index = 0; index < this.maxTextures; index++) - { - var tempTexture = gl.createTexture(); - - gl.activeTexture(gl.TEXTURE0 + index); - - gl.bindTexture(gl.TEXTURE_2D, tempTexture); - - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([ 0, 0, 255, 255 ])); - - tempTextures[index] = tempTexture; - - this.textureIndexes.push(index); - } - - this.tempTextures = tempTextures; - - // Reset to texture 1 (texture zero is reserved for framebuffers) - this.currentActiveTexture = 1; - this.startActiveTexture++; - gl.activeTexture(gl.TEXTURE1); - - this.pipelines = new PipelineManager(this); - - this.setBlendMode(CONST.BlendModes.NORMAL); - - this.projectionMatrix = new Matrix4().identity(); - - game.textures.once(TextureEvents.READY, this.boot, this); - - return this; + this.anims.update(time, delta); }, /** - * Internal boot handler. Calls 'boot' on each pipeline. + * Start playing the given animation on this Sprite. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#boot - * @private - * @since 3.11.0 + * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. + * + * The benefit of a global animation is that multiple Sprites can all play the same animation, without + * having to duplicate the data. You can just create it once and then play it on any Sprite. + * + * The following code shows how to create a global repeating animation. The animation will be created + * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': + * + * ```javascript + * var config = { + * key: 'run', + * frames: 'muybridge', + * frameRate: 15, + * repeat: -1 + * }; + * + * // This code should be run from within a Scene: + * this.anims.create(config); + * ``` + * + * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, + * you can call the `Animation.create` method instead. It accepts the exact same parameters as when + * creating a global animation, however the resulting data is kept locally in this Sprite. + * + * With the animation created, either globally or locally, you can now play it on this Sprite: + * + * ```javascript + * this.add.sprite(x, y).play('run'); + * ``` + * + * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config + * object instead: + * + * ```javascript + * this.add.sprite(x, y).play({ key: 'run', frameRate: 24 }); + * ``` + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * If you need a Sprite to be able to play both local and global animations, make sure they don't + * have conflicting keys. + * + * See the documentation for the `PlayAnimationConfig` config object for more details about this. + * + * Also, see the documentation in the Animation Manager for further details on creating animations. + * + * @method Phaser.GameObjects.Sprite#play + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.0.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. + * + * @return {this} This Game Object. */ - boot: function () + play: function (key, ignoreIfPlaying) { - var game = this.game; - var pipelineManager = this.pipelines; - - var baseSize = game.scale.baseSize; - - this.width = baseSize.width; - this.height = baseSize.height; - - this.isBooted = true; - - this.renderTarget = new RenderTarget(this, this.width, this.height, 1, 0, true, true); - - // Set-up pipelines - - pipelineManager.boot(game.config.pipeline); - - // Set-up default textures, fbo and scissor - - this.blankTexture = game.textures.getFrame('__DEFAULT'); - this.whiteTexture = game.textures.getFrame('__WHITE'); - - var gl = this.gl; - - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - - gl.enable(gl.SCISSOR_TEST); - - game.scale.on(ScaleEvents.RESIZE, this.onResize, this); - - this.resize(baseSize.width, baseSize.height); + return this.anims.play(key, ignoreIfPlaying); }, /** - * The event handler that manages the `resize` event dispatched by the Scale Manager. + * Start playing the given animation on this Sprite, in reverse. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#onResize - * @since 3.16.0 + * Animations in Phaser can either belong to the global Animation Manager, or specifically to this Sprite. * - * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. - * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions. The canvas width / height values match this. + * The benefit of a global animation is that multiple Sprites can all play the same animation, without + * having to duplicate the data. You can just create it once and then play it on any Sprite. + * + * The following code shows how to create a global repeating animation. The animation will be created + * from all of the frames within the sprite sheet that was loaded with the key 'muybridge': + * + * ```javascript + * var config = { + * key: 'run', + * frames: 'muybridge', + * frameRate: 15, + * repeat: -1 + * }; + * + * // This code should be run from within a Scene: + * this.anims.create(config); + * ``` + * + * However, if you wish to create an animation that is unique to this Sprite, and this Sprite alone, + * you can call the `Animation.create` method instead. It accepts the exact same parameters as when + * creating a global animation, however the resulting data is kept locally in this Sprite. + * + * With the animation created, either globally or locally, you can now play it on this Sprite: + * + * ```javascript + * this.add.sprite(x, y).playReverse('run'); + * ``` + * + * Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config + * object instead: + * + * ```javascript + * this.add.sprite(x, y).playReverse({ key: 'run', frameRate: 24 }); + * ``` + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * If you need a Sprite to be able to play both local and global animations, make sure they don't + * have conflicting keys. + * + * See the documentation for the `PlayAnimationConfig` config object for more details about this. + * + * Also, see the documentation in the Animation Manager for further details on creating animations. + * + * @method Phaser.GameObjects.Sprite#playReverse + * @fires Phaser.Animations.Events#ANIMATION_START + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call. + * + * @return {this} This Game Object. */ - onResize: function (gameSize, baseSize) + playReverse: function (key, ignoreIfPlaying) { - // Has the underlying canvas size changed? - if (baseSize.width !== this.width || baseSize.height !== this.height) - { - this.resize(baseSize.width, baseSize.height); - } + return this.anims.playReverse(key, ignoreIfPlaying); }, /** - * Binds the WebGL Renderers Render Target, so all drawn content is now redirected to it. + * Waits for the specified delay, in milliseconds, then starts playback of the given animation. * - * Make sure to call `endCapture` when you are finished. + * If the animation _also_ has a delay value set in its config, it will be **added** to the delay given here. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#beginCapture + * If an animation is already running and a new animation is given to this method, it will wait for + * the given delay before starting the new animation. + * + * If no animation is currently running, the given one begins after the delay. + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * Prior to Phaser 3.50 this method was called 'delayedPlay'. + * + * @method Phaser.GameObjects.Sprite#playAfterDelay + * @fires Phaser.Animations.Events#ANIMATION_START * @since 3.50.0 * - * @param {number} [width] - Optional new width of the Render Target. - * @param {number} [height] - Optional new height of the Render Target. + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {number} delay - The delay, in milliseconds, to wait before starting the animation playing. + * + * @return {this} This Game Object. */ - beginCapture: function (width, height) + playAfterDelay: function (key, delay) { - if (width === undefined) { width = this.width; } - if (height === undefined) { height = this.height; } - - this.renderTarget.bind(true, width, height); - - this.setProjectionMatrix(width, height); - - this.resetTextures(); + return this.anims.playAfterDelay(key, delay); }, /** - * Unbinds the WebGL Renderers Render Target and returns it, stopping any further content being drawn to it. + * Waits for the current animation to complete the `repeatCount` number of repeat cycles, then starts playback + * of the given animation. * - * If the viewport or scissors were modified during the capture, you should reset them by calling - * `resetViewport` and `resetScissor` accordingly. + * You can use this to ensure there are no harsh jumps between two sets of animations, i.e. going from an + * idle animation to a walking animation, by making them blend smoothly into each other. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#endCapture + * If no animation is currently running, the given one will start immediately. + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * @method Phaser.GameObjects.Sprite#playAfterRepeat + * @fires Phaser.Animations.Events#ANIMATION_START * @since 3.50.0 * - * @return {Phaser.Renderer.WebGL.RenderTarget} A reference to the WebGL Renderer Render Target. + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. + * @param {number} [repeatCount=1] - How many times should the animation repeat before the next one starts? + * + * @return {this} This Game Object. */ - endCapture: function () + playAfterRepeat: function (key, repeatCount) { - this.renderTarget.unbind(true); - - this.resetProjectionMatrix(); - - return this.renderTarget; + return this.anims.playAfterRepeat(key, repeatCount); }, /** - * Resizes the drawing buffer to match that required by the Scale Manager. + * Sets an animation, or an array of animations, to be played immediately after the current one completes or stops. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#resize - * @fires Phaser.Renderer.Events#RESIZE - * @since 3.0.0 + * The current animation must enter a 'completed' state for this to happen, i.e. finish all of its repeats, delays, etc, + * or have the `stop` method called directly on it. * - * @param {number} [width] - The new width of the renderer. - * @param {number} [height] - The new height of the renderer. + * An animation set to repeat forever will never enter a completed state. * - * @return {this} This WebGLRenderer instance. + * You can chain a new animation at any point, including before the current one starts playing, during it, + * or when it ends (via its `animationcomplete` event). + * + * Chained animations are specific to a Game Object, meaning different Game Objects can have different chained + * animations without impacting the animation they're playing. + * + * Call this method with no arguments to reset all currently chained animations. + * + * When playing an animation on a Sprite it will first check to see if it can find a matching key + * locally within the Sprite. If it can, it will play the local animation. If not, it will then + * search the global Animation Manager and look for it there. + * + * @method Phaser.GameObjects.Sprite#chain + * @since 3.50.0 + * + * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig|string[]|Phaser.Animations.Animation[]|Phaser.Types.Animations.PlayAnimationConfig[])} [key] - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object, or an array of them. + * + * @return {this} This Game Object. */ - resize: function (width, height) + chain: function (key) { - var gl = this.gl; - - this.width = width; - this.height = height; - - this.setProjectionMatrix(width, height); - - gl.viewport(0, 0, width, height); - - this.drawingBufferHeight = gl.drawingBufferHeight; - - gl.scissor(0, (gl.drawingBufferHeight - height), width, height); - - this.defaultScissor[2] = width; - this.defaultScissor[3] = height; - - this.emit(Events.RESIZE, width, height); - - return this; + return this.anims.chain(key); }, /** - * Gets the aspect ratio of the WebGLRenderer dimensions. + * Immediately stops the current animation from playing and dispatches the `ANIMATION_STOP` events. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getAspectRatio + * If no animation is playing, no event will be dispatched. + * + * If there is another animation queued (via the `chain` method) then it will start playing immediately. + * + * @method Phaser.GameObjects.Sprite#stop + * @fires Phaser.Animations.Events#ANIMATION_STOP * @since 3.50.0 * - * @return {number} The aspect ratio of the WebGLRenderer dimensions. + * @return {this} This Game Object. */ - getAspectRatio: function () + stop: function () { - return this.width / this.height; + return this.anims.stop(); }, /** - * Sets the Projection Matrix of this renderer to the given dimensions. + * Stops the current animation from playing after the specified time delay, given in milliseconds. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setProjectionMatrix + * It then dispatches the `ANIMATION_STOP` event. + * + * If no animation is running, no events will be dispatched. + * + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * @method Phaser.GameObjects.Sprite#stopAfterDelay + * @fires Phaser.Animations.Events#ANIMATION_STOP * @since 3.50.0 * - * @param {number} width - The new width of the Projection Matrix. - * @param {number} height - The new height of the Projection Matrix. + * @param {number} delay - The number of milliseconds to wait before stopping this animation. * - * @return {this} This WebGLRenderer instance. + * @return {this} This Game Object. */ - setProjectionMatrix: function (width, height) + stopAfterDelay: function (delay) { - if (width !== this.projectionWidth || height !== this.projectionHeight) - { - this.projectionWidth = width; - this.projectionHeight = height; - - this.projectionMatrix.ortho(0, width, height, 0, -1000, 1000); - } - - return this; + return this.anims.stopAfterDelay(delay); }, /** - * Resets the Projection Matrix back to this renderers width and height. + * Stops the current animation from playing after the given number of repeats. * - * This is called during `endCapture`, should the matrix have been changed - * as a result of the capture process. + * It then dispatches the `ANIMATION_STOP` event. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#resetProjectionMatrix + * If no animation is running, no events will be dispatched. + * + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. + * + * @method Phaser.GameObjects.Sprite#stopAfterRepeat + * @fires Phaser.Animations.Events#ANIMATION_STOP * @since 3.50.0 + * + * @param {number} [repeatCount=1] - How many times should the animation repeat before stopping? + * + * @return {this} This Game Object. */ - resetProjectionMatrix: function () + stopAfterRepeat: function (repeatCount) { - this.projectionWidth = this.width; - this.projectionHeight = this.height; - - this.projectionMatrix.ortho(0, this.width, this.height, 0, -1000, 1000); + return this.anims.stopAfterRepeat(repeatCount); }, /** - * Checks if a WebGL extension is supported + * Stops the current animation from playing when it next sets the given frame. + * If this frame doesn't exist within the animation it will not stop it from playing. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#hasExtension - * @since 3.0.0 + * It then dispatches the `ANIMATION_STOP` event. * - * @param {string} extensionName - Name of the WebGL extension + * If no animation is running, no events will be dispatched. * - * @return {boolean} `true` if the extension is supported, otherwise `false`. - */ - hasExtension: function (extensionName) - { - return this.supportedExtensions ? this.supportedExtensions.indexOf(extensionName) : false; - }, - - /** - * Loads a WebGL extension + * If there is another animation in the queue (set via the `chain` method) then it will start playing, + * when the current one stops. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getExtension - * @since 3.0.0 + * @method Phaser.GameObjects.Sprite#stopOnFrame + * @fires Phaser.Animations.Events#ANIMATION_STOP + * @since 3.50.0 * - * @param {string} extensionName - The name of the extension to load. + * @param {Phaser.Animations.AnimationFrame} frame - The frame to check before stopping this animation. * - * @return {object} WebGL extension if the extension is supported + * @return {this} This Game Object. */ - getExtension: function (extensionName) + stopOnFrame: function (frame) { - if (!this.hasExtension(extensionName)) { return null; } - - if (!(extensionName in this.extensions)) - { - this.extensions[extensionName] = this.gl.getExtension(extensionName); - } - - return this.extensions[extensionName]; + return this.anims.stopOnFrame(frame); }, /** - * Flushes the current pipeline if the pipeline is bound + * Build a JSON representation of this Sprite. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#flush + * @method Phaser.GameObjects.Sprite#toJSON * @since 3.0.0 + * + * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Game Object. */ - flush: function () + toJSON: function () { - this.pipelines.flush(); + return Components.ToJSON(this); }, /** - * Pushes a new scissor state. This is used to set nested scissor states. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#pushScissor - * @since 3.0.0 - * - * @param {number} x - The x position of the scissor. - * @param {number} y - The y position of the scissor. - * @param {number} width - The width of the scissor. - * @param {number} height - The height of the scissor. - * @param {number} [drawingBufferHeight] - Optional drawingBufferHeight override value. + * Handles the pre-destroy step for the Sprite, which removes the Animation component. * - * @return {number[]} An array containing the scissor values. + * @method Phaser.GameObjects.Sprite#preDestroy + * @private + * @since 3.14.0 */ - pushScissor: function (x, y, width, height, drawingBufferHeight) + preDestroy: function () { - if (drawingBufferHeight === undefined) { drawingBufferHeight = this.drawingBufferHeight; } - - var scissorStack = this.scissorStack; + this.anims.destroy(); - var scissor = [ x, y, width, height ]; + this.anims = undefined; + } - scissorStack.push(scissor); +}); - this.setScissor(x, y, width, height, drawingBufferHeight); +module.exports = Sprite; - this.currentScissor = scissor; - return scissor; - }, +/***/ }), - /** - * Sets the current scissor state. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setScissor - * @since 3.0.0 - * - * @param {number} x - The x position of the scissor. - * @param {number} y - The y position of the scissor. - * @param {number} width - The width of the scissor. - * @param {number} height - The height of the scissor. - * @param {number} [drawingBufferHeight] - Optional drawingBufferHeight override value. - */ - setScissor: function (x, y, width, height, drawingBufferHeight) - { - if (drawingBufferHeight === undefined) { drawingBufferHeight = this.drawingBufferHeight; } +/***/ 27573: +/***/ ((module) => { - var gl = this.gl; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var current = this.currentScissor; +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Sprite#renderCanvas + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var SpriteCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - var setScissor = (width > 0 && height > 0); + renderer.batchSprite(src, src.frame, camera, parentMatrix); +}; - if (current && setScissor) - { - var cx = current[0]; - var cy = current[1]; - var cw = current[2]; - var ch = current[3]; +module.exports = SpriteCanvasRenderer; - setScissor = (cx !== x || cy !== y || cw !== width || ch !== height); - } - if (setScissor) - { - this.flush(); +/***/ }), - // https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/scissor - gl.scissor(x, (drawingBufferHeight - y - height), width, height); - } - }, +/***/ 89219: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - /** - * Resets the gl scissor state to be whatever the current scissor is, if there is one, without - * modifying the scissor stack. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#resetScissor - * @since 3.50.0 - */ - resetScissor: function () - { - var gl = this.gl; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - gl.enable(gl.SCISSOR_TEST); +var BuildGameObject = __webpack_require__(88933); +var BuildGameObjectAnimation = __webpack_require__(32291); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var Sprite = __webpack_require__(13747); - var current = this.currentScissor; +/** + * Creates a new Sprite Game Object and returns it. + * + * Note: This method will only be available if the Sprite Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#sprite + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Sprite} The Game Object that was created. + */ +GameObjectCreator.register('sprite', function (config, addToScene) +{ + if (config === undefined) { config = {}; } - if (current) - { - var x = current[0]; - var y = current[1]; - var width = current[2]; - var height = current[3]; + var key = GetAdvancedValue(config, 'key', null); + var frame = GetAdvancedValue(config, 'frame', null); - if (width > 0 && height > 0) - { - gl.scissor(x, (this.drawingBufferHeight - y - height), width, height); - } - } - }, + var sprite = new Sprite(this.scene, 0, 0, key, frame); - /** - * Pops the last scissor state and sets it. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#popScissor - * @since 3.0.0 - */ - popScissor: function () + if (addToScene !== undefined) { - var scissorStack = this.scissorStack; - - // Remove the current scissor - scissorStack.pop(); - - // Reset the previous scissor - var scissor = scissorStack[scissorStack.length - 1]; + config.add = addToScene; + } - if (scissor) - { - this.setScissor(scissor[0], scissor[1], scissor[2], scissor[3]); - } + BuildGameObject(this.scene, sprite, config); - this.currentScissor = scissor; - }, + // Sprite specific config options: - /** - * Is there an active stencil mask? - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#hasActiveStencilMask - * @since 3.17.0 - * - * @return {boolean} `true` if there is an active stencil mask, otherwise `false`. - */ - hasActiveStencilMask: function () - { - var mask = this.currentMask.mask; - var camMask = this.currentCameraMask.mask; + BuildGameObjectAnimation(sprite, config); - return ((mask && mask.isStencil) || (camMask && camMask.isStencil)); - }, + return sprite; +}); - /** - * Resets the gl viewport to the current renderer dimensions. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#resetViewport - * @since 3.50.0 - */ - resetViewport: function () - { - var gl = this.gl; - gl.viewport(0, 0, this.width, this.height); +/***/ }), - this.drawingBufferHeight = gl.drawingBufferHeight; - }, +/***/ 66135: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - /** - * Sets the blend mode to the value given. - * - * If the current blend mode is different from the one given, the pipeline is flushed and the new - * blend mode is enabled. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlendMode - * @since 3.0.0 - * - * @param {number} blendModeId - The blend mode to be set. Can be a `BlendModes` const or an integer value. - * @param {boolean} [force=false] - Force the blend mode to be set, regardless of the currently set blend mode. - * - * @return {boolean} `true` if the blend mode was changed as a result of this call, forcing a flush, otherwise `false`. - */ - setBlendMode: function (blendModeId, force) - { - if (force === undefined) { force = false; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var gl = this.gl; - var blendMode = this.blendModes[blendModeId]; +var GameObjectFactory = __webpack_require__(61286); +var Sprite = __webpack_require__(13747); - if (force || (blendModeId !== CONST.BlendModes.SKIP_CHECK && this.currentBlendMode !== blendModeId)) - { - this.flush(); - - gl.enable(gl.BLEND); - gl.blendEquation(blendMode.equation); +/** + * Creates a new Sprite Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Sprite Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#sprite + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * + * @return {Phaser.GameObjects.Sprite} The Game Object that was created. + */ +GameObjectFactory.register('sprite', function (x, y, texture, frame) +{ + return this.displayList.add(new Sprite(this.scene, x, y, texture, frame)); +}); - if (blendMode.func.length > 2) - { - gl.blendFuncSeparate(blendMode.func[0], blendMode.func[1], blendMode.func[2], blendMode.func[3]); - } - else - { - gl.blendFunc(blendMode.func[0], blendMode.func[1]); - } +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns - this.currentBlendMode = blendModeId; - return true; - } +/***/ }), - return false; - }, +/***/ 20791: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Creates a new custom blend mode for the renderer. - * - * See https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Blending_modes - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#addBlendMode - * @since 3.0.0 - * - * @param {GLenum[]} func - An array containing the WebGL functions to use for the source and the destination blending factors, respectively. See the possible constants for {@link WebGLRenderingContext#blendFunc()}. - * @param {GLenum} equation - The equation to use for combining the RGB and alpha components of a new pixel with a rendered one. See the possible constants for {@link WebGLRenderingContext#blendEquation()}. - * - * @return {number} The index of the new blend mode, used for referencing it in the future. - */ - addBlendMode: function (func, equation) - { - var index = this.blendModes.push({ func: func, equation: equation }); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return index - 1; - }, +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - /** - * Updates the function bound to a given custom blend mode. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#updateBlendMode - * @since 3.0.0 - * - * @param {number} index - The index of the custom blend mode. - * @param {function} func - The function to use for the blend mode. - * @param {function} equation - The equation to use for the blend mode. - * - * @return {this} This WebGLRenderer instance. - */ - updateBlendMode: function (index, func, equation) - { - if (this.blendModes[index]) - { - this.blendModes[index].func = func; +if (true) +{ + renderWebGL = __webpack_require__(21034); +} - if (equation) - { - this.blendModes[index].equation = equation; - } - } +if (true) +{ + renderCanvas = __webpack_require__(27573); +} - return this; - }, +module.exports = { - /** - * Removes a custom blend mode from the renderer. - * Any Game Objects still using this blend mode will error, so be sure to clear them first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#removeBlendMode - * @since 3.0.0 - * - * @param {number} index - The index of the custom blend mode to be removed. - * - * @return {this} This WebGLRenderer instance. - */ - removeBlendMode: function (index) - { - if (index > 17 && this.blendModes[index]) - { - this.blendModes.splice(index, 1); - } + renderWebGL: renderWebGL, + renderCanvas: renderCanvas - return this; - }, +}; - /** - * Sets the current active texture for texture unit zero to be a blank texture. - * This only happens if there isn't a texture already in use by texture unit zero. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlankTexture - * @private - * @since 3.12.0 - */ - setBlankTexture: function () - { - this.setTexture2D(this.blankTexture.glTexture); - }, - /** - * Activates the Texture Source and assigns it the next available texture unit. - * If none are available, it will flush the current pipeline first. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setTextureSource - * @since 3.50.0 - * - * @param {Phaser.Textures.TextureSource} textureSource - The Texture Source to be assigned the texture unit. - * - * @return {number} The texture unit that was assigned to the Texture Source. - */ - setTextureSource: function (textureSource) - { - if (this.pipelines.forceZero()) - { - this.setTextureZero(textureSource.glTexture, true); +/***/ }), - return 0; - } +/***/ 21034: +/***/ ((module) => { - var gl = this.gl; - var currentActiveTexture = this.currentActiveTexture; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (textureSource.glIndexCounter < this.startActiveTexture) - { - textureSource.glIndexCounter = this.startActiveTexture; +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Sprite#renderWebGL + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var SpriteWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + camera.addToRenderList(src); - if (currentActiveTexture < this.maxTextures) - { - textureSource.glIndex = currentActiveTexture; + src.pipeline.batchSprite(src, camera, parentMatrix); +}; - gl.activeTexture(gl.TEXTURE0 + currentActiveTexture); - gl.bindTexture(gl.TEXTURE_2D, textureSource.glTexture); +module.exports = SpriteWebGLRenderer; - this.currentActiveTexture++; - } - else - { - // We're out of textures, so flush the batch and reset back to 0 - this.flush(); - this.startActiveTexture++; +/***/ }), - this.textureFlush++; +/***/ 32979: +/***/ ((module) => { - textureSource.glIndexCounter = this.startActiveTexture; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - textureSource.glIndex = 1; +/** + * Returns an object containing dimensions of the Text object. + * + * @function Phaser.GameObjects.GetTextSize + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Text} text - The Text object to calculate the size from. + * @param {Phaser.Types.GameObjects.Text.TextMetrics} size - The Text metrics to use when calculating the size. + * @param {string[]} lines - The lines of text to calculate the size from. + * + * @return {Phaser.Types.GameObjects.Text.GetTextSizeObject} An object containing dimensions of the Text object. + */ +var GetTextSize = function (text, size, lines) +{ + var canvas = text.canvas; + var context = text.context; + var style = text.style; - gl.activeTexture(gl.TEXTURE1); - gl.bindTexture(gl.TEXTURE_2D, textureSource.glTexture); + var lineWidths = []; + var maxLineWidth = 0; + var drawnLines = lines.length; - this.currentActiveTexture = 2; - } - } + if (style.maxLines > 0 && style.maxLines < lines.length) + { + drawnLines = style.maxLines; + } - this.isTextureClean = false; + style.syncFont(canvas, context); - return textureSource.glIndex; - }, + // Text Width - /** - * Checks to see if the given diffuse and normal map textures are already bound, or not. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#isNewNormalMap - * @since 3.50.0 - * - * @param {WebGLTexture} texture - The WebGL diffuse texture. - * @param {WebGLTexture} normalMap - The WebGL normal map texture. - * - * @return {boolean} Returns `false` if this combination is already set, or `true` if it's a new combination. - */ - isNewNormalMap: function (texture, normalMap) + for (var i = 0; i < drawnLines; i++) { - return (this.textureZero !== texture || this.normalTexture !== normalMap); - }, + var lineWidth = style.strokeThickness; - /** - * Binds a texture directly to texture unit zero then activates it. - * If the texture is already at unit zero, it skips the bind. - * Make sure to call `clearTextureZero` after using this method. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setTextureZero - * @since 3.50.0 - * - * @param {WebGLTexture} texture - The WebGL texture that needs to be bound. - * @param {boolean} [flush=false] - Flush the pipeline if the texture is different? - */ - setTextureZero: function (texture, flush) - { - if (this.textureZero !== texture) + lineWidth += context.measureText(lines[i]).width; + + // Adjust for wrapped text + if (style.wordWrap) { - if (flush) - { - this.flush(); - } + lineWidth -= context.measureText(' ').width; + } - var gl = this.gl; + lineWidths[i] = Math.ceil(lineWidth); + maxLineWidth = Math.max(maxLineWidth, lineWidths[i]); + } - gl.activeTexture(gl.TEXTURE0); - gl.bindTexture(gl.TEXTURE_2D, texture); + // Text Height - this.textureZero = texture; - } - }, + var lineHeight = size.fontSize + style.strokeThickness; + var height = lineHeight * drawnLines; + var lineSpacing = text.lineSpacing; - /** - * Clears the texture that was directly bound to texture unit zero. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#clearTextureZero - * @since 3.50.0 - */ - clearTextureZero: function () + // Adjust for line spacing + if (drawnLines > 1) { - this.textureZero = null; - }, + height += lineSpacing * (drawnLines - 1); + } - /** - * Binds a texture directly to texture unit one then activates it. - * If the texture is already at unit one, it skips the bind. - * Make sure to call `clearNormalMap` after using this method. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setNormalMap - * @since 3.50.0 - * - * @param {WebGLTexture} texture - The WebGL texture that needs to be bound. - */ - setNormalMap: function (texture) - { - if (this.normalTexture !== texture) - { - var gl = this.gl; + return { + width: maxLineWidth, + height: height, + lines: drawnLines, + lineWidths: lineWidths, + lineSpacing: lineSpacing, + lineHeight: lineHeight + }; +}; - gl.activeTexture(gl.TEXTURE1); - gl.bindTexture(gl.TEXTURE_2D, texture); +module.exports = GetTextSize; - this.normalTexture = texture; - if (this.currentActiveTexture === 1) - { - this.currentActiveTexture = 2; - } - } - }, +/***/ }), - /** - * Clears the texture that was directly bound to texture unit one and - * increases the start active texture counter. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#clearNormalMap - * @since 3.50.0 - */ - clearNormalMap: function () - { - this.normalTexture = null; - this.startActiveTexture++; - this.currentActiveTexture = 1; +/***/ 27030: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.textureFlush++; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Activates each texture, in turn, then binds them all to `null`. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#unbindTextures - * @since 3.50.0 - * - * @param {boolean} [all=false] - Reset all textures, or just the first two? - */ - unbindTextures: function () +var CanvasPool = __webpack_require__(61068); + +/** + * Calculates the ascent, descent and fontSize of a given font style. + * + * @function Phaser.GameObjects.MeasureText + * @since 3.0.0 + * + * @param {Phaser.GameObjects.TextStyle} textStyle - The TextStyle object to measure. + * + * @return {Phaser.Types.GameObjects.Text.TextMetrics} An object containing the ascent, descent and fontSize of the TextStyle. + */ +var MeasureText = function (textStyle) +{ + var canvas = CanvasPool.create(this); + var context = canvas.getContext('2d', { willReadFrequently: true }); + + textStyle.syncFont(canvas, context); + + var metrics = context.measureText(textStyle.testString); + + if ('actualBoundingBoxAscent' in metrics) { - var gl = this.gl; - var temp = this.tempTextures; + var ascent = metrics.actualBoundingBoxAscent; + var descent = metrics.actualBoundingBoxDescent; - for (var i = 0; i < temp.length; i++) - { - gl.activeTexture(gl.TEXTURE0 + i); - gl.bindTexture(gl.TEXTURE_2D, null); - } + CanvasPool.remove(canvas); + + return { + ascent: ascent, + descent: descent, + fontSize: ascent + descent + }; + } - this.normalTexture = null; - this.textureZero = null; + var width = Math.ceil(metrics.width * textStyle.baselineX); + var baseline = width; + var height = 2 * baseline; - this.currentActiveTexture = 1; - this.startActiveTexture++; + baseline = baseline * textStyle.baselineY | 0; - this.textureFlush++; - }, + canvas.width = width; + canvas.height = height; - /** - * Flushes the current pipeline, then resets the first two textures - * back to the default temporary textures, resets the start active - * counter and sets texture unit 1 as being active. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#resetTextures - * @since 3.50.0 - * - * @param {boolean} [all=false] - Reset all textures, or just the first two? - */ - resetTextures: function (all) + context.fillStyle = '#f00'; + context.fillRect(0, 0, width, height); + + context.font = textStyle._font; + + context.textBaseline = 'alphabetic'; + context.fillStyle = '#000'; + context.fillText(textStyle.testString, 0, baseline); + + var output = { + ascent: 0, + descent: 0, + fontSize: 0 + }; + + var imagedata = context.getImageData(0, 0, width, height); + + if (!imagedata) { - if (all === undefined) { all = false; } + output.ascent = baseline; + output.descent = baseline + 6; + output.fontSize = output.ascent + output.descent; - if (this.isTextureClean) - { - // No need to do this if the textures are already clean - return; - } + CanvasPool.remove(canvas); - this.flush(); + return output; + } - var gl = this.gl; - var temp = this.tempTextures; + var pixels = imagedata.data; + var numPixels = pixels.length; + var line = width * 4; + var i; + var j; + var idx = 0; + var stop = false; - if (all) + // ascent. scan from top to bottom until we find a non red pixel + for (i = 0; i < baseline; i++) + { + for (j = 0; j < line; j += 4) { - for (var i = 0; i < temp.length; i++) + if (pixels[idx + j] !== 255) { - gl.activeTexture(gl.TEXTURE0 + i); - gl.bindTexture(gl.TEXTURE_2D, temp[i]); + stop = true; + break; } + } - gl.activeTexture(gl.TEXTURE1); - gl.bindTexture(gl.TEXTURE_2D, temp[1]); - - this.isTextureClean = true; + if (!stop) + { + idx += line; } else { - gl.activeTexture(gl.TEXTURE0); - gl.bindTexture(gl.TEXTURE_2D, temp[0]); - - gl.activeTexture(gl.TEXTURE1); - gl.bindTexture(gl.TEXTURE_2D, temp[1]); + break; } + } - this.normalTexture = null; - this.textureZero = null; - - this.currentActiveTexture = 1; - this.startActiveTexture++; + output.ascent = baseline - i; - this.textureFlush++; - }, + idx = numPixels - line; + stop = false; - /** - * Binds a texture at a texture unit. If a texture is already - * bound to that unit it will force a flush on the current pipeline. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setTexture2D - * @since 3.0.0 - * @version 2.0 - Updated in 3.50.0 to remove the `textureUnit` and `flush` parameters. - * - * @param {WebGLTexture} texture - The WebGL texture that needs to be bound. - * - * @return {number} The texture unit that was assigned to the Texture Source. - */ - setTexture2D: function (texture) + // descent. scan from bottom to top until we find a non red pixel + for (i = height; i > baseline; i--) { - if (this.pipelines.forceZero()) + for (j = 0; j < line; j += 4) { - this.setTextureZero(texture, true); + if (pixels[idx + j] !== 255) + { + stop = true; + break; + } + } - return 0; + if (!stop) + { + idx -= line; + } + else + { + break; } + } - var gl = this.gl; - var currentActiveTexture = this.currentActiveTexture; + output.descent = (i - baseline); + output.fontSize = output.ascent + output.descent; - if (texture.glIndexCounter < this.startActiveTexture) - { - texture.glIndexCounter = this.startActiveTexture; + CanvasPool.remove(canvas); - if (currentActiveTexture < this.maxTextures) - { - texture.glIndex = currentActiveTexture; + return output; +}; - gl.activeTexture(gl.TEXTURE0 + currentActiveTexture); - gl.bindTexture(gl.TEXTURE_2D, texture); +module.exports = MeasureText; - this.currentActiveTexture++; - } - else - { - // We're out of textures, so flush the batch and reset back to 1 (0 is reserved for fbos) - this.flush(); - this.startActiveTexture++; +/***/ }), - this.textureFlush++; +/***/ 76555: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - texture.glIndexCounter = this.startActiveTexture; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - texture.glIndex = 1; +var AddToDOM = __webpack_require__(99584); +var CanvasPool = __webpack_require__(61068); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var GetTextSize = __webpack_require__(32979); +var GetValue = __webpack_require__(10850); +var RemoveFromDOM = __webpack_require__(55638); +var TextRender = __webpack_require__(80032); +var TextStyle = __webpack_require__(74744); - gl.activeTexture(gl.TEXTURE1); - gl.bindTexture(gl.TEXTURE_2D, texture); +/** + * @classdesc + * A Text Game Object. + * + * Text objects work by creating their own internal hidden Canvas and then renders text to it using + * the standard Canvas `fillText` API. It then creates a texture from this canvas which is rendered + * to your game during the render pass. + * + * Because it uses the Canvas API you can take advantage of all the features this offers, such as + * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts + * loaded externally, such as Google or TypeKit Web fonts. + * + * **Important:** The font name must be quoted if it contains certain combinations of digits or + * special characters, either when creating the Text object, or when setting the font via `setFont` + * or `setFontFamily`, e.g.: + * + * ```javascript + * this.add.text(0, 0, 'Hello World', { fontFamily: 'Georgia, "Goudy Bookletter 1911", Times, serif' }); + * ``` + * + * ```javascript + * this.add.text(0, 0, 'Hello World', { font: '"Press Start 2P"' }); + * ``` + * + * You can only display fonts that are currently loaded and available to the browser: therefore fonts must + * be pre-loaded. Phaser does not do this for you, so you will require the use of a 3rd party font loader, + * or have the fonts ready available in the CSS on the page in which your Phaser game resides. + * + * See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts + * across mobile browsers. + * + * A note on performance: Every time the contents of a Text object changes, i.e. changing the text being + * displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the + * new texture to the GPU. This can be an expensive operation if used often, or with large quantities of + * Text objects in your game. If you run into performance issues you would be better off using Bitmap Text + * instead, as it benefits from batching and avoids expensive Canvas API calls. + * + * @class Text + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.0.0 + * + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.ComputedSize + * @extends Phaser.GameObjects.Components.Crop + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|string[])} text - The text this Text object will display. + * @param {Phaser.Types.GameObjects.Text.TextStyle} style - The text style configuration object. + * + * @see https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#Valid_family_names + */ +var Text = new Class({ - this.currentActiveTexture = 2; - } - } + Extends: GameObject, - this.isTextureClean = false; + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.ComputedSize, + Components.Crop, + Components.Depth, + Components.Flip, + Components.GetBounds, + Components.Mask, + Components.Origin, + Components.Pipeline, + Components.PostPipeline, + Components.ScrollFactor, + Components.Tint, + Components.Transform, + Components.Visible, + TextRender + ], - return texture.glIndex; - }, + initialize: - /** - * Pushes a new framebuffer onto the FBO stack and makes it the currently bound framebuffer. - * - * If there was another framebuffer already bound it will force a pipeline flush. - * - * Call `popFramebuffer` to remove it again. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#pushFramebuffer - * @since 3.50.0 - * - * @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound. - * @param {boolean} [updateScissor=false] - Set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. - * @param {boolean} [resetTextures=false] - Should the WebGL Textures be reset after the new framebuffer is bound? - * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? - * - * @return {this} This WebGLRenderer instance. - */ - pushFramebuffer: function (framebuffer, updateScissor, resetTextures, setViewport) + function Text (scene, x, y, text, style) { - if (framebuffer === this.currentFramebuffer) - { - return this; - } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } - this.fboStack.push(framebuffer); + GameObject.call(this, scene, 'Text'); - return this.setFramebuffer(framebuffer, updateScissor, resetTextures, setViewport); - }, + /** + * The renderer in use by this Text object. + * + * @name Phaser.GameObjects.Text#renderer + * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} + * @since 3.12.0 + */ + this.renderer = scene.sys.renderer; - /** - * Sets the given framebuffer as the active and currently bound framebuffer. - * - * If there was another framebuffer already bound it will force a pipeline flush. - * - * Typically, you should call `pushFramebuffer` instead of this method. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setFramebuffer - * @since 3.0.0 - * - * @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound. - * @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. - * @param {boolean} [resetTextures=false] - Should the WebGL Textures be reset after the new framebuffer is bound? - * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? - * - * @return {this} This WebGLRenderer instance. - */ - setFramebuffer: function (framebuffer, updateScissor, resetTextures, setViewport) - { - if (updateScissor === undefined) { updateScissor = false; } - if (resetTextures === undefined) { resetTextures = false; } - if (setViewport === undefined) { setViewport = true; } + this.setPosition(x, y); + this.setOrigin(0, 0); + this.initPipeline(); + this.initPostPipeline(true); - if (framebuffer === this.currentFramebuffer) - { - return this; - } + /** + * The canvas element that the text is rendered to. + * + * @name Phaser.GameObjects.Text#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.canvas = CanvasPool.create(this); - var gl = this.gl; + /** + * The context of the canvas element that the text is rendered to. + * + * @name Phaser.GameObjects.Text#context + * @type {CanvasRenderingContext2D} + * @since 3.0.0 + */ + this.context = this.canvas.getContext('2d', { willReadFrequently: true }); - var width = this.width; - var height = this.height; + /** + * The Text Style object. + * + * Manages the style of this Text object. + * + * @name Phaser.GameObjects.Text#style + * @type {Phaser.GameObjects.TextStyle} + * @since 3.0.0 + */ + this.style = new TextStyle(this, style); - if (framebuffer && framebuffer.renderTexture && setViewport) - { - width = framebuffer.renderTexture.width; - height = framebuffer.renderTexture.height; - } - else - { - this.flush(); - } + /** + * Whether to automatically round line positions. + * + * @name Phaser.GameObjects.Text#autoRound + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.autoRound = true; - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + /** + * The Regular Expression that is used to split the text up into lines, in + * multi-line text. By default this is `/(?:\r\n|\r|\n)/`. + * You can change this RegExp to be anything else that you may need. + * + * @name Phaser.GameObjects.Text#splitRegExp + * @type {object} + * @since 3.0.0 + */ + this.splitRegExp = /(?:\r\n|\r|\n)/; - if (setViewport) - { - gl.viewport(0, 0, width, height); - } + /** + * The text to display. + * + * @name Phaser.GameObjects.Text#_text + * @type {string} + * @private + * @since 3.12.0 + */ + this._text = undefined; - if (updateScissor) - { - if (framebuffer) - { - this.drawingBufferHeight = height; + /** + * Specify a padding value which is added to the line width and height when calculating the Text size. + * Allows you to add extra spacing if the browser is unable to accurately determine the true font dimensions. + * + * @name Phaser.GameObjects.Text#padding + * @type {Phaser.Types.GameObjects.Text.TextPadding} + * @since 3.0.0 + */ + this.padding = { left: 0, right: 0, top: 0, bottom: 0 }; - this.pushScissor(0, 0, width, height); - } - else - { - this.drawingBufferHeight = this.height; + /** + * The width of this Text object. + * + * @name Phaser.GameObjects.Text#width + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.width = 1; - this.popScissor(); - } - } + /** + * The height of this Text object. + * + * @name Phaser.GameObjects.Text#height + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.height = 1; - this.currentFramebuffer = framebuffer; + /** + * The line spacing value. + * This value is added to the font height to calculate the overall line height. + * Only has an effect if this Text object contains multiple lines of text. + * + * If you update this property directly, instead of using the `setLineSpacing` method, then + * be sure to call `updateText` after, or you won't see the change reflected in the Text object. + * + * @name Phaser.GameObjects.Text#lineSpacing + * @type {number} + * @since 3.13.0 + */ + this.lineSpacing = 0; + + /** + * Whether the text or its settings have changed and need updating. + * + * @name Phaser.GameObjects.Text#dirty + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.dirty = false; - if (resetTextures) + // If resolution wasn't set, force it to 1 + if (this.style.resolution === 0) { - this.resetTextures(); + this.style.resolution = 1; } - return this; - }, - - /** - * Pops the previous framebuffer from the fbo stack and sets it. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#popFramebuffer - * @since 3.50.0 - * - * @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. - * @param {boolean} [resetTextures=false] - Should the WebGL Textures be reset after the new framebuffer is bound? - * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? - * - * @return {WebGLFramebuffer} The Framebuffer that was set, or `null` if there aren't any more in the stack. - */ - popFramebuffer: function (updateScissor, resetTextures, setViewport) - { - if (updateScissor === undefined) { updateScissor = false; } - if (resetTextures === undefined) { resetTextures = false; } - if (setViewport === undefined) { setViewport = true; } + /** + * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. + * + * @name Phaser.GameObjects.Text#_crop + * @type {object} + * @private + * @since 3.12.0 + */ + this._crop = this.resetCropObject(); - var fboStack = this.fboStack; + // Create a Texture for this Text object + this.texture = scene.sys.textures.addCanvas(null, this.canvas, true); - // Remove the current fbo - fboStack.pop(); + // Get the frame + this.frame = this.texture.get(); - // Reset the previous framebuffer - var framebuffer = fboStack[fboStack.length - 1]; + // Set the resolution + this.frame.source.resolution = this.style.resolution; - if (!framebuffer) + if (this.renderer && this.renderer.gl) { - framebuffer = null; + // Clear the default 1x1 glTexture, as we override it later + this.renderer.deleteTexture(this.frame.source.glTexture); + + this.frame.source.glTexture = null; } - this.setFramebuffer(framebuffer, updateScissor, resetTextures, setViewport); + this.initRTL(); - return framebuffer; + this.setText(text); + + if (style && style.padding) + { + this.setPadding(style.padding); + } + + if (style && style.lineSpacing) + { + this.setLineSpacing(style.lineSpacing); + } }, /** - * Binds a shader program. - * - * If there was a different program already bound it will force a pipeline flush first. - * - * If the same program given to this method is already set as the current program, no change - * will take place and this method will return `false`. + * Initialize right to left text. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setProgram + * @method Phaser.GameObjects.Text#initRTL * @since 3.0.0 - * - * @param {WebGLProgram} program - The program that needs to be bound. - * - * @return {boolean} `true` if the given program was bound, otherwise `false`. */ - setProgram: function (program) + initRTL: function () { - if (program !== this.currentProgram) + if (!this.style.rtl) { - this.flush(); + return; + } - this.gl.useProgram(program); + // Here is where the crazy starts. + // + // Due to browser implementation issues, you cannot fillText BiDi text to a canvas + // that is not part of the DOM. It just completely ignores the direction property. - this.currentProgram = program; + this.canvas.dir = 'rtl'; - return true; - } + // Experimental atm, but one day ... + this.context.direction = 'rtl'; - return false; - }, + // Add it to the DOM, but hidden within the parent canvas. + this.canvas.style.display = 'none'; - /** - * Rebinds whatever program `WebGLRenderer.currentProgram` is set as, without - * changing anything, or flushing. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#resetProgram - * @since 3.50.0 - * - * @return {this} This WebGLRenderer instance. - */ - resetProgram: function () - { - this.gl.useProgram(this.currentProgram); + AddToDOM(this.canvas, this.scene.sys.canvas); - return this; + // And finally we set the x origin + this.originX = 1; }, /** - * Creates a texture from an image source. If the source is not valid it creates an empty texture. + * Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal + * bounds. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createTextureFromSource + * @method Phaser.GameObjects.Text#runWordWrap * @since 3.0.0 * - * @param {object} source - The source of the texture. - * @param {number} width - The width of the texture. - * @param {number} height - The height of the texture. - * @param {number} scaleMode - The scale mode to be used by the texture. + * @param {string} text - The text to perform word wrap detection against. * - * @return {?WebGLTexture} The WebGL Texture that was created, or `null` if it couldn't be created. + * @return {string} The text after wrapping has been applied. */ - createTextureFromSource: function (source, width, height, scaleMode) + runWordWrap: function (text) { - var gl = this.gl; - var minFilter = gl.NEAREST; - var magFilter = gl.NEAREST; - var wrap = gl.CLAMP_TO_EDGE; - var texture = null; - - width = source ? source.width : width; - height = source ? source.height : height; - - var pow = IsSizePowerOfTwo(width, height); + var style = this.style; - if (pow) + if (style.wordWrapCallback) { - wrap = gl.REPEAT; - } + var wrappedLines = style.wordWrapCallback.call(style.wordWrapCallbackScope, text, this); - if (scaleMode === CONST.ScaleModes.LINEAR && this.config.antialias) - { - minFilter = (pow) ? this.mipmapFilter : gl.LINEAR; - magFilter = gl.LINEAR; - } + if (Array.isArray(wrappedLines)) + { + wrappedLines = wrappedLines.join('\n'); + } - if (!source && typeof width === 'number' && typeof height === 'number') + return wrappedLines; + } + else if (style.wordWrapWidth) { - texture = this.createTexture2D(0, minFilter, magFilter, wrap, wrap, gl.RGBA, null, width, height); + if (style.wordWrapUseAdvanced) + { + return this.advancedWordWrap(text, this.context, this.style.wordWrapWidth); + } + else + { + return this.basicWordWrap(text, this.context, this.style.wordWrapWidth); + } } else { - texture = this.createTexture2D(0, minFilter, magFilter, wrap, wrap, gl.RGBA, source); + return text; } - - return texture; }, /** - * A wrapper for creating a WebGLTexture. If no pixel data is passed it will create an empty texture. + * Advanced wrapping algorithm that will wrap words as the line grows longer than its horizontal + * bounds. Consecutive spaces will be collapsed and replaced with a single space. Lines will be + * trimmed of white space before processing. Throws an error if wordWrapWidth is less than a + * single character. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createTexture2D + * @method Phaser.GameObjects.Text#advancedWordWrap * @since 3.0.0 * - * @param {number} mipLevel - Mip level of the texture. - * @param {number} minFilter - Filtering of the texture. - * @param {number} magFilter - Filtering of the texture. - * @param {number} wrapT - Wrapping mode of the texture. - * @param {number} wrapS - Wrapping mode of the texture. - * @param {number} format - Which format does the texture use. - * @param {?object} pixels - pixel data. - * @param {number} width - Width of the texture in pixels. - * @param {number} height - Height of the texture in pixels. - * @param {boolean} [pma=true] - Does the texture have premultiplied alpha? - * @param {boolean} [forceSize=false] - If `true` it will use the width and height passed to this method, regardless of the pixels dimension. - * @param {boolean} [flipY=false] - Sets the `UNPACK_FLIP_Y_WEBGL` flag the WebGL Texture uses during upload. + * @param {string} text - The text to perform word wrap detection against. + * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. + * @param {number} wordWrapWidth - The word wrap width. * - * @return {WebGLTexture} The WebGLTexture that was created. + * @return {string} The wrapped text. */ - createTexture2D: function (mipLevel, minFilter, magFilter, wrapT, wrapS, format, pixels, width, height, pma, forceSize, flipY) + advancedWordWrap: function (text, context, wordWrapWidth) { - pma = (pma === undefined || pma === null) ? true : pma; - if (forceSize === undefined) { forceSize = false; } - if (flipY === undefined) { flipY = false; } - - var gl = this.gl; - var texture = gl.createTexture(); + var output = ''; - gl.activeTexture(gl.TEXTURE0); + // Condense consecutive spaces and split into lines + var lines = text + .replace(/ +/gi, ' ') + .split(this.splitRegExp); - var currentTexture = gl.getParameter(gl.TEXTURE_BINDING_2D); + var linesCount = lines.length; - gl.bindTexture(gl.TEXTURE_2D, texture); + for (var i = 0; i < linesCount; i++) + { + var line = lines[i]; + var out = ''; - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapS); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrapT); + // Trim whitespace + line = line.replace(/^ *|\s*$/gi, ''); - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, pma); - gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY); + // If entire line is less than wordWrapWidth append the entire line and exit early + var lineWidth = context.measureText(line).width; - if (pixels === null || pixels === undefined) - { - gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, width, height, 0, format, gl.UNSIGNED_BYTE, null); - } - else - { - if (!forceSize) + if (lineWidth < wordWrapWidth) { - width = pixels.width; - height = pixels.height; + output += line + '\n'; + continue; } - gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, format, gl.UNSIGNED_BYTE, pixels); - } - - if (IsSizePowerOfTwo(width, height)) - { - gl.generateMipmap(gl.TEXTURE_2D); - } + // Otherwise, calculate new lines + var currentLineWidth = wordWrapWidth; - if (currentTexture) - { - gl.bindTexture(gl.TEXTURE_2D, currentTexture); - } + // Split into words + var words = line.split(' '); - texture.isAlphaPremultiplied = pma; - texture.isRenderTexture = false; - texture.width = width; - texture.height = height; - texture.glIndex = 0; - texture.glIndexCounter = -1; + for (var j = 0; j < words.length; j++) + { + var word = words[j]; + var wordWithSpace = word + ' '; + var wordWidth = context.measureText(wordWithSpace).width; - return texture; - }, + if (wordWidth > currentLineWidth) + { + // Break word + if (j === 0) + { + // Shave off letters from word until it's small enough + var newWord = wordWithSpace; - /** - * Creates a WebGL Framebuffer object and optionally binds a depth stencil render buffer. - * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createFramebuffer - * @since 3.0.0 - * - * @param {number} width - If `addDepthStencilBuffer` is true, this controls the width of the depth stencil. - * @param {number} height - If `addDepthStencilBuffer` is true, this controls the height of the depth stencil. - * @param {WebGLTexture} renderTexture - The color texture where the color pixels are written. - * @param {boolean} [addDepthStencilBuffer=false] - Create a Renderbuffer for the depth stencil? - * - * @return {WebGLFramebuffer} Raw WebGLFramebuffer - */ - createFramebuffer: function (width, height, renderTexture, addDepthStencilBuffer) - { - var gl = this.gl; - var framebuffer = gl.createFramebuffer(); - var complete = 0; + while (newWord.length) + { + newWord = newWord.slice(0, -1); + wordWidth = context.measureText(newWord).width; - this.setFramebuffer(framebuffer); + if (wordWidth <= currentLineWidth) + { + break; + } + } - if (addDepthStencilBuffer) - { - var depthStencilBuffer = gl.createRenderbuffer(); + // If wordWrapWidth is too small for even a single letter, shame user + // failure with a fatal error + if (!newWord.length) + { + throw new Error('wordWrapWidth < a single character'); + } - gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer); - gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height); - gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer); - } + // Replace current word in array with remainder + var secondPart = word.substr(newWord.length); - renderTexture.isRenderTexture = true; - renderTexture.isAlphaPremultiplied = false; + words[j] = secondPart; - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, renderTexture, 0); + // Append first piece to output + out += newWord; + } - complete = gl.checkFramebufferStatus(gl.FRAMEBUFFER); + // If existing word length is 0, don't include it + var offset = (words[j].length) ? j : j + 1; - if (complete !== gl.FRAMEBUFFER_COMPLETE) - { - var errors = { - 36054: 'Incomplete Attachment', - 36055: 'Missing Attachment', - 36057: 'Incomplete Dimensions', - 36061: 'Framebuffer Unsupported' - }; + // Collapse rest of sentence and remove any trailing white space + var remainder = words.slice(offset).join(' ').replace(/[ \n]*$/gi, ''); - throw new Error('Framebuffer status: ' + errors[complete]); - } + // Prepend remainder to next line + lines.splice(i + 1, 0, remainder); - framebuffer.renderTexture = renderTexture; + linesCount = lines.length; - this.setFramebuffer(null); + break; // Processing on this line - this.resetTextures(); + // Append word with space to output + } + else + { + out += wordWithSpace; + currentLineWidth -= wordWidth; + } + } - return framebuffer; + // Append processed line to output + output += out.replace(/[ \n]*$/gi, '') + '\n'; + } + + // Trim the end of the string + output = output.replace(/[\s|\n]*$/gi, ''); + + return output; }, /** - * Creates a WebGLProgram instance based on the given vertex and fragment shader source. - * - * Then compiles, attaches and links the program before returning it. + * Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal + * bounds. Spaces are not collapsed and whitespace is not trimmed. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createProgram + * @method Phaser.GameObjects.Text#basicWordWrap * @since 3.0.0 * - * @param {string} vertexShader - The vertex shader source code as a single string. - * @param {string} fragmentShader - The fragment shader source code as a single string. + * @param {string} text - The text to perform word wrap detection against. + * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. + * @param {number} wordWrapWidth - The word wrap width. * - * @return {WebGLProgram} The linked WebGLProgram created from the given shader source. + * @return {string} The wrapped text. */ - createProgram: function (vertexShader, fragmentShader) + basicWordWrap: function (text, context, wordWrapWidth) { - var gl = this.gl; - var program = gl.createProgram(); - var vs = gl.createShader(gl.VERTEX_SHADER); - var fs = gl.createShader(gl.FRAGMENT_SHADER); - - gl.shaderSource(vs, vertexShader); - gl.shaderSource(fs, fragmentShader); - gl.compileShader(vs); - gl.compileShader(fs); + var result = ''; + var lines = text.split(this.splitRegExp); + var lastLineIndex = lines.length - 1; + var whiteSpaceWidth = context.measureText(' ').width; - if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) + for (var i = 0; i <= lastLineIndex; i++) { - throw new Error('Vertex Shader failed:\n' + gl.getShaderInfoLog(vs)); - } + var spaceLeft = wordWrapWidth; + var words = lines[i].split(' '); + var lastWordIndex = words.length - 1; - if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) - { - throw new Error('Fragment Shader failed:\n' + gl.getShaderInfoLog(fs)); - } + for (var j = 0; j <= lastWordIndex; j++) + { + var word = words[j]; + var wordWidth = context.measureText(word).width; + var wordWidthWithSpace = wordWidth; - gl.attachShader(program, vs); - gl.attachShader(program, fs); - gl.linkProgram(program); + if (j < lastWordIndex) + { + wordWidthWithSpace += whiteSpaceWidth; + } - if (!gl.getProgramParameter(program, gl.LINK_STATUS)) - { - throw new Error('Link Program failed:\n' + gl.getProgramInfoLog(program)); - } + if (wordWidthWithSpace > spaceLeft) + { + // Skip printing the newline if it's the first word of the line that is greater + // than the word wrap width. + if (j > 0) + { + result += '\n'; + spaceLeft = wordWrapWidth; + } + } - gl.useProgram(program); + result += word; - return program; + if (j < lastWordIndex) + { + result += ' '; + spaceLeft -= wordWidthWithSpace; + } + else + { + spaceLeft -= wordWidth; + } + } + + if (i < lastLineIndex) + { + result += '\n'; + } + } + + return result; }, /** - * Wrapper for creating a vertex buffer. + * Runs the given text through this Text objects word wrapping and returns the results as an + * array, where each element of the array corresponds to a wrapped line of text. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createVertexBuffer + * @method Phaser.GameObjects.Text#getWrappedText * @since 3.0.0 * - * @param {ArrayBuffer} initialDataOrSize - It's either ArrayBuffer or an integer indicating the size of the vbo - * @param {number} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW + * @param {string} [text] - The text for which the wrapping will be calculated. If unspecified, the Text objects current text will be used. * - * @return {WebGLBuffer} Raw vertex buffer + * @return {string[]} An array of strings with the pieces of wrapped text. */ - createVertexBuffer: function (initialDataOrSize, bufferUsage) + getWrappedText: function (text) { - var gl = this.gl; - var vertexBuffer = gl.createBuffer(); + if (text === undefined) { text = this._text; } - gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, initialDataOrSize, bufferUsage); - gl.bindBuffer(gl.ARRAY_BUFFER, null); + this.style.syncFont(this.canvas, this.context); - return vertexBuffer; + var wrappedLines = this.runWordWrap(text); + + return wrappedLines.split(this.splitRegExp); }, /** - * Wrapper for creating a vertex buffer. + * Set the text to display. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createIndexBuffer + * An array of strings will be joined with `\n` line breaks. + * + * @method Phaser.GameObjects.Text#setText * @since 3.0.0 * - * @param {ArrayBuffer} initialDataOrSize - Either ArrayBuffer or an integer indicating the size of the vbo. - * @param {number} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW. + * @param {(string|string[])} value - The string, or array of strings, to be set as the content of this Text object. * - * @return {WebGLBuffer} Raw index buffer + * @return {this} This Text object. */ - createIndexBuffer: function (initialDataOrSize, bufferUsage) + setText: function (value) { - var gl = this.gl; - var indexBuffer = gl.createBuffer(); + if (!value && value !== 0) + { + value = ''; + } - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, initialDataOrSize, bufferUsage); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); + if (Array.isArray(value)) + { + value = value.join('\n'); + } - return indexBuffer; + if (value !== this._text) + { + this._text = value.toString(); + + this.updateText(); + } + + return this; }, /** - * Calls `GL.deleteTexture` on the given WebGLTexture and also optionally - * resets the currently defined textures. + * Appends the given text to the content already being displayed by this Text object. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteTexture - * @since 3.0.0 + * An array of strings will be joined with `\n` line breaks. * - * @param {WebGLTexture} texture - The WebGL Texture to be deleted. - * @param {boolean} [reset=false] - Call the `resetTextures` method after deleting this texture? + * @method Phaser.GameObjects.Text#appendText + * @since 3.60.0 * - * @return {this} This WebGLRenderer instance. + * @param {(string|string[])} value - The string, or array of strings, to be appended to the existing content of this Text object. + * @param {boolean} [addCR=true] - Insert a carriage-return before the string value. + * + * @return {this} This Text object. */ - deleteTexture: function (texture, reset) + appendText: function (value, addCR) { - if (reset) + if (addCR === undefined) { addCR = true; } + + if (!value && value !== 0) { - this.resetTextures(true); + value = ''; } - if (texture) + if (Array.isArray(value)) { - this.gl.deleteTexture(texture); + value = value.join('\n'); + } + + value = value.toString(); + + var newText = this._text.concat((addCR) ? '\n' + value : value); + + if (newText !== this._text) + { + this._text = newText; + + this.updateText(); } return this; }, /** - * Deletes a WebGLFramebuffer from the GL instance. + * Set the text style. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteFramebuffer + * @example + * text.setStyle({ + * fontSize: '64px', + * fontFamily: 'Arial', + * color: '#ffffff', + * align: 'center', + * backgroundColor: '#ff00ff' + * }); + * + * @method Phaser.GameObjects.Text#setStyle * @since 3.0.0 * - * @param {WebGLFramebuffer} framebuffer - The Framebuffer to be deleted. + * @param {object} style - The style settings to set. * - * @return {this} This WebGLRenderer instance. + * @return {this} This Text object. */ - deleteFramebuffer: function (framebuffer) + setStyle: function (style) { - if (framebuffer) - { - this.gl.deleteFramebuffer(framebuffer); - - ArrayRemove(this.fboStack, framebuffer); - - if (this.currentFramebuffer === framebuffer) - { - this.currentFramebuffer = null; - } - } - - return this; + return this.style.setStyle(style); }, /** - * Deletes a WebGLProgram from the GL instance. + * Set the font. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteProgram + * If a string is given, the font family is set. + * + * If an object is given, the `fontFamily`, `fontSize` and `fontStyle` + * properties of that object are set. + * + * **Important:** The font name must be quoted if it contains certain combinations of digits or + * special characters: + * + * ```javascript + * Text.setFont('"Press Start 2P"'); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * Text.setFont('Georgia, "Goudy Bookletter 1911", Times, serif'); + * ``` + * + * @method Phaser.GameObjects.Text#setFont * @since 3.0.0 * - * @param {WebGLProgram} program - The shader program to be deleted. + * @param {string} font - The font family or font settings to set. * - * @return {this} This WebGLRenderer instance. + * @return {this} This Text object. + * + * @see https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#Valid_family_names */ - deleteProgram: function (program) + setFont: function (font) { - if (program) - { - this.gl.deleteProgram(program); - } - - return this; + return this.style.setFont(font); }, /** - * Deletes a WebGLBuffer from the GL instance. + * Set the font family. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteBuffer + * **Important:** The font name must be quoted if it contains certain combinations of digits or + * special characters: + * + * ```javascript + * Text.setFont('"Press Start 2P"'); + * ``` + * + * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all + * quoted properly, too: + * + * ```javascript + * Text.setFont('Georgia, "Goudy Bookletter 1911", Times, serif'); + * ``` + * + * @method Phaser.GameObjects.Text#setFontFamily * @since 3.0.0 * - * @param {WebGLBuffer} vertexBuffer - The WebGLBuffer to be deleted. + * @param {string} family - The font family. * - * @return {this} This WebGLRenderer instance. + * @return {this} This Text object. + * + * @see https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#Valid_family_names */ - deleteBuffer: function (buffer) + setFontFamily: function (family) { - this.gl.deleteBuffer(buffer); - - return this; + return this.style.setFontFamily(family); }, /** - * Controls the pre-render operations for the given camera. - * Handles any clipping needed by the camera and renders the background color if a color is visible. + * Set the font size. Can be a string with a valid CSS unit, i.e. `16px`, or a number. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#preRenderCamera + * @method Phaser.GameObjects.Text#setFontSize * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to pre-render. + * @param {(string|number)} size - The font size. + * + * @return {this} This Text object. */ - preRenderCamera: function (camera) + setFontSize: function (size) { - var cx = camera.x; - var cy = camera.y; - var cw = camera.width; - var ch = camera.height; - - var color = camera.backgroundColor; - - camera.emit(CameraEvents.PRE_RENDER, camera); - - this.pipelines.preBatchCamera(camera); - - this.pushScissor(cx, cy, cw, ch); - - if (camera.mask) - { - this.currentCameraMask.mask = camera.mask; - this.currentCameraMask.camera = camera._maskCamera; - - camera.mask.preRenderWebGL(this, camera, camera._maskCamera); - } - - if (color.alphaGL > 0) - { - var pipeline = this.pipelines.setMulti(); - - pipeline.drawFillRect( - cx, cy, cw, ch, - Utils.getTintFromFloats(color.blueGL, color.greenGL, color.redGL, 1), - color.alphaGL - ); - } + return this.style.setFontSize(size); }, /** - * Return the current stencil mask. + * Set the font style. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getCurrentStencilMask - * @private - * @since 3.50.0 + * @method Phaser.GameObjects.Text#setFontStyle + * @since 3.0.0 + * + * @param {string} style - The font style. + * + * @return {this} This Text object. */ - getCurrentStencilMask: function () + setFontStyle: function (style) { - var prev = null; - var stack = this.maskStack; - var cameraMask = this.currentCameraMask; - - if (stack.length > 0) - { - prev = stack[stack.length - 1]; - } - else if (cameraMask.mask && cameraMask.mask.isStencil) - { - prev = cameraMask; - } - - return prev; + return this.style.setFontStyle(style); }, /** - * Controls the post-render operations for the given camera. + * Set a fixed width and height for the text. * - * Renders the foreground camera effects like flash and fading, then resets the current scissor state. + * Pass in `0` for either of these parameters to disable fixed width or height respectively. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#postRenderCamera + * @method Phaser.GameObjects.Text#setFixedSize * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to post-render. + * @param {number} width - The fixed width to set. `0` disables fixed width. + * @param {number} height - The fixed height to set. `0` disables fixed height. + * + * @return {this} This Text object. */ - postRenderCamera: function (camera) + setFixedSize: function (width, height) { - var flashEffect = camera.flashEffect; - var fadeEffect = camera.fadeEffect; - - if (flashEffect.isRunning || (fadeEffect.isRunning || fadeEffect.isComplete)) - { - var pipeline = this.pipelines.setMulti(); - - flashEffect.postRenderWebGL(pipeline, Utils.getTintFromFloats); - fadeEffect.postRenderWebGL(pipeline, Utils.getTintFromFloats); - } - - camera.dirty = false; - - this.popScissor(); - - if (camera.mask) - { - this.currentCameraMask.mask = null; - - camera.mask.postRenderWebGL(this, camera._maskCamera); - } - - this.pipelines.postBatchCamera(camera); - - camera.emit(CameraEvents.POST_RENDER, camera); + return this.style.setFixedSize(width, height); }, /** - * Clears the current vertex buffer and updates pipelines. + * Set the background color. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#preRender - * @fires Phaser.Renderer.Events#PRE_RENDER + * @method Phaser.GameObjects.Text#setBackgroundColor * @since 3.0.0 + * + * @param {string} color - The background color. + * + * @return {this} This Text object. */ - preRender: function () + setBackgroundColor: function (color) { - if (this.contextLost) { return; } - - var gl = this.gl; - - // Make sure we are bound to the main frame buffer - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - - if (this.config.clearBeforeRender) - { - var clearColor = this.config.backgroundColor; - - gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, clearColor.alphaGL); - - gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); - } - - gl.enable(gl.SCISSOR_TEST); - - this.currentScissor = this.defaultScissor; - - this.scissorStack.length = 0; - this.scissorStack.push(this.currentScissor); - - if (this.game.scene.customViewports) - { - gl.scissor(0, (this.drawingBufferHeight - this.height), this.width, this.height); - } - - this.currentMask.mask = null; - this.currentCameraMask.mask = null; - this.maskStack.length = 0; - - this.textureFlush = 0; - - this.emit(Events.PRE_RENDER); + return this.style.setBackgroundColor(color); }, /** - * The core render step for a Scene Camera. - * - * Iterates through the given array of Game Objects and renders them with the given Camera. + * Set the fill style to be used by the Text object. * - * This is called by the `CameraManager.render` method. The Camera Manager instance belongs to a Scene, and is invoked - * by the Scene Systems.render method. + * This can be any valid CanvasRenderingContext2D fillStyle value, such as + * a color (in hex, rgb, rgba, hsl or named values), a gradient or a pattern. * - * This method is not called if `Camera.visible` is `false`, or `Camera.alpha` is zero. + * See the [MDN fillStyle docs](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle) for more details. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#render - * @fires Phaser.Renderer.Events#RENDER + * @method Phaser.GameObjects.Text#setFill * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene to render. - * @param {Phaser.GameObjects.GameObject[]} children - An array of filtered Game Objects that can be rendered by the given Camera. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. + * @param {(string|any)} color - The text fill style. Can be any valid CanvasRenderingContext `fillStyle` value. + * + * @return {this} This Text object. */ - render: function (scene, children, camera) + setFill: function (fillStyle) { - if (this.contextLost) { return; } - - var childCount = children.length; - - this.emit(Events.RENDER, scene, camera); - - // Apply scissor for cam region + render background color, if not transparent - this.preRenderCamera(camera); - - // Nothing to render, so bail out - if (childCount === 0) - { - this.setBlendMode(CONST.BlendModes.NORMAL); - - // Applies camera effects and pops the scissor, if set - this.postRenderCamera(camera); - - return; - } - - // Reset the current type - this.currentType = ''; - - var current = this.currentMask; - - for (var i = 0; i < childCount; i++) - { - this.finalType = (i === childCount - 1); - - var child = children[i]; - - var mask = child.mask; - - current = this.currentMask; - - if (current.mask && current.mask !== mask) - { - // Render out the previously set mask - current.mask.postRenderWebGL(this, current.camera); - } - - if (mask && current.mask !== mask) - { - mask.preRenderWebGL(this, child, camera); - } - - if (child.blendMode !== this.currentBlendMode) - { - this.setBlendMode(child.blendMode); - } - - var type = child.type; - - if (type !== this.currentType) - { - this.newType = true; - this.currentType = type; - } - - if (!this.finalType) - { - this.nextTypeMatch = (children[i + 1].type === this.currentType); - } - else - { - this.nextTypeMatch = false; - } - - child.renderWebGL(this, child, camera); - - this.newType = false; - } - - current = this.currentMask; - - if (current.mask) - { - // Render out the previously set mask, if it was the last item in the display list - current.mask.postRenderWebGL(this, current.camera); - } - - this.setBlendMode(CONST.BlendModes.NORMAL); - - // Applies camera effects and pops the scissor, if set - this.postRenderCamera(camera); + return this.style.setFill(fillStyle); }, /** - * The post-render step happens after all Cameras in all Scenes have been rendered. + * Set the text fill color. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#postRender - * @fires Phaser.Renderer.Events#POST_RENDER + * @method Phaser.GameObjects.Text#setColor * @since 3.0.0 + * + * @param {string} color - The text fill color. + * + * @return {this} This Text object. */ - postRender: function () + setColor: function (color) { - if (this.contextLost) { return; } - - this.flush(); - - this.emit(Events.POST_RENDER); - - var state = this.snapshotState; - - if (state.callback) - { - WebGLSnapshot(this.canvas, state); - - state.callback = null; - } - - if (this.textureFlush > 0) - { - this.startActiveTexture++; - this.currentActiveTexture = 1; - } + return this.style.setColor(color); }, /** - * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. - * - * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. - * - * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then - * calling this method will override it. - * - * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. - * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, - * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, - * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * Set the stroke settings. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot + * @method Phaser.GameObjects.Text#setStroke * @since 3.0.0 * - * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. - * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * @param {string} color - The stroke color. + * @param {number} thickness - The stroke thickness. * - * @return {this} This WebGL Renderer. + * @return {this} This Text object. */ - snapshot: function (callback, type, encoderOptions) + setStroke: function (color, thickness) { - return this.snapshotArea(0, 0, this.gl.drawingBufferWidth, this.gl.drawingBufferHeight, callback, type, encoderOptions); + return this.style.setStroke(color, thickness); }, /** - * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. - * - * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. - * - * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then - * calling this method will override it. - * - * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. - * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, - * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, - * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * Set the shadow settings. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotArea - * @since 3.16.0 + * @method Phaser.GameObjects.Text#setShadow + * @since 3.0.0 * - * @param {number} x - The x coordinate to grab from. - * @param {number} y - The y coordinate to grab from. - * @param {number} width - The width of the area to grab. - * @param {number} height - The height of the area to grab. - * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. - * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * @param {number} [x=0] - The horizontal shadow offset. + * @param {number} [y=0] - The vertical shadow offset. + * @param {string} [color='#000'] - The shadow color. + * @param {number} [blur=0] - The shadow blur radius. + * @param {boolean} [shadowStroke=false] - Whether to stroke the shadow. + * @param {boolean} [shadowFill=true] - Whether to fill the shadow. * - * @return {this} This WebGL Renderer. + * @return {this} This Text object. */ - snapshotArea: function (x, y, width, height, callback, type, encoderOptions) + setShadow: function (x, y, color, blur, shadowStroke, shadowFill) { - var state = this.snapshotState; - - state.callback = callback; - state.type = type; - state.encoder = encoderOptions; - state.getPixel = false; - state.x = x; - state.y = y; - state.width = Math.min(width, this.gl.drawingBufferWidth); - state.height = Math.min(height, this.gl.drawingBufferHeight); - - return this; + return this.style.setShadow(x, y, color, blur, shadowStroke, shadowFill); }, /** - * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. - * - * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. - * - * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then - * calling this method will override it. - * - * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for - * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, - * using less memory. + * Set the shadow offset. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotPixel - * @since 3.16.0 + * @method Phaser.GameObjects.Text#setShadowOffset + * @since 3.0.0 * - * @param {number} x - The x coordinate of the pixel to get. - * @param {number} y - The y coordinate of the pixel to get. - * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * @param {number} x - The horizontal shadow offset. + * @param {number} y - The vertical shadow offset. * - * @return {this} This WebGL Renderer. + * @return {this} This Text object. */ - snapshotPixel: function (x, y, callback) + setShadowOffset: function (x, y) { - this.snapshotArea(x, y, 1, 1, callback); - - this.snapshotState.getPixel = true; - - return this; + return this.style.setShadowOffset(x, y); }, /** - * Takes a snapshot of the given area of the given frame buffer. - * - * Unlike the other snapshot methods, this one is processed immediately and doesn't wait for the next render. - * - * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. - * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, - * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, - * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * Set the shadow color. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotFramebuffer - * @since 3.19.0 + * @method Phaser.GameObjects.Text#setShadowColor + * @since 3.0.0 * - * @param {WebGLFramebuffer} framebuffer - The framebuffer to grab from. - * @param {number} bufferWidth - The width of the framebuffer. - * @param {number} bufferHeight - The height of the framebuffer. - * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. - * @param {boolean} [getPixel=false] - Grab a single pixel as a Color object, or an area as an Image object? - * @param {number} [x=0] - The x coordinate to grab from. - * @param {number} [y=0] - The y coordinate to grab from. - * @param {number} [width=bufferWidth] - The width of the area to grab. - * @param {number} [height=bufferHeight] - The height of the area to grab. - * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. - * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * @param {string} color - The shadow color. * - * @return {this} This WebGL Renderer. + * @return {this} This Text object. */ - snapshotFramebuffer: function (framebuffer, bufferWidth, bufferHeight, callback, getPixel, x, y, width, height, type, encoderOptions) + setShadowColor: function (color) { - if (getPixel === undefined) { getPixel = false; } - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = bufferWidth; } - if (height === undefined) { height = bufferHeight; } - - var currentFramebuffer = this.currentFramebuffer; - - this.snapshotArea(x, y, width, height, callback, type, encoderOptions); - - var state = this.snapshotState; - - state.getPixel = getPixel; - - state.isFramebuffer = true; - state.bufferWidth = bufferWidth; - state.bufferHeight = bufferHeight; - - this.setFramebuffer(framebuffer); - - WebGLSnapshot(this.canvas, state); - - this.setFramebuffer(currentFramebuffer); - - state.callback = null; - state.isFramebuffer = false; - - return this; + return this.style.setShadowColor(color); }, /** - * Creates a new WebGL Texture based on the given Canvas Element. - * - * If the `dstTexture` parameter is given, the WebGL Texture is updated, rather than created fresh. + * Set the shadow blur radius. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#canvasToTexture + * @method Phaser.GameObjects.Text#setShadowBlur * @since 3.0.0 * - * @param {HTMLCanvasElement} srcCanvas - The Canvas to create the WebGL Texture from - * @param {WebGLTexture} [dstTexture] - The destination WebGL Texture to set. - * @param {boolean} [noRepeat=false] - Should this canvas be allowed to set `REPEAT` (such as for Text objects?) - * @param {boolean} [flipY=false] - Should the WebGL Texture set `UNPACK_MULTIPLY_FLIP_Y`? + * @param {number} blur - The shadow blur radius. * - * @return {WebGLTexture} The newly created, or updated, WebGL Texture. + * @return {this} This Text object. */ - canvasToTexture: function (srcCanvas, dstTexture, noRepeat, flipY) + setShadowBlur: function (blur) { - if (noRepeat === undefined) { noRepeat = false; } - if (flipY === undefined) { flipY = false; } - - if (!dstTexture) - { - return this.createCanvasTexture(srcCanvas, noRepeat, flipY); - } - else - { - return this.updateCanvasTexture(srcCanvas, dstTexture, flipY); - } + return this.style.setShadowBlur(blur); }, /** - * Creates a new WebGL Texture based on the given Canvas Element. + * Enable or disable shadow stroke. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createCanvasTexture - * @since 3.20.0 + * @method Phaser.GameObjects.Text#setShadowStroke + * @since 3.0.0 * - * @param {HTMLCanvasElement} srcCanvas - The Canvas to create the WebGL Texture from - * @param {boolean} [noRepeat=false] - Should this canvas be allowed to set `REPEAT` (such as for Text objects?) - * @param {boolean} [flipY=false] - Should the WebGL Texture set `UNPACK_MULTIPLY_FLIP_Y`? + * @param {boolean} enabled - Whether shadow stroke is enabled or not. * - * @return {WebGLTexture} The newly created WebGL Texture. + * @return {this} This Text object. */ - createCanvasTexture: function (srcCanvas, noRepeat, flipY) + setShadowStroke: function (enabled) { - if (noRepeat === undefined) { noRepeat = false; } - if (flipY === undefined) { flipY = false; } - - var gl = this.gl; - var minFilter = gl.NEAREST; - var magFilter = gl.NEAREST; - - var width = srcCanvas.width; - var height = srcCanvas.height; - - var wrapping = gl.CLAMP_TO_EDGE; - - var pow = IsSizePowerOfTwo(width, height); - - if (!noRepeat && pow) - { - wrapping = gl.REPEAT; - } - - if (this.config.antialias) - { - minFilter = (pow) ? this.mipmapFilter : gl.LINEAR; - magFilter = gl.LINEAR; - } - - return this.createTexture2D(0, minFilter, magFilter, wrapping, wrapping, gl.RGBA, srcCanvas, width, height, true, false, flipY); + return this.style.setShadowStroke(enabled); }, /** - * Updates a WebGL Texture based on the given Canvas Element. + * Enable or disable shadow fill. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#updateCanvasTexture - * @since 3.20.0 + * @method Phaser.GameObjects.Text#setShadowFill + * @since 3.0.0 * - * @param {HTMLCanvasElement} srcCanvas - The Canvas to update the WebGL Texture from. - * @param {WebGLTexture} dstTexture - The destination WebGL Texture to update. - * @param {boolean} [flipY=false] - Should the WebGL Texture set `UNPACK_MULTIPLY_FLIP_Y`? + * @param {boolean} enabled - Whether shadow fill is enabled or not. * - * @return {WebGLTexture} The updated WebGL Texture. + * @return {this} This Text object. */ - updateCanvasTexture: function (srcCanvas, dstTexture, flipY) + setShadowFill: function (enabled) { - if (flipY === undefined) { flipY = false; } - - var gl = this.gl; - - var width = srcCanvas.width; - var height = srcCanvas.height; - - if (width > 0 && height > 0) - { - gl.activeTexture(gl.TEXTURE0); - var currentTexture = gl.getParameter(gl.TEXTURE_BINDING_2D); - gl.bindTexture(gl.TEXTURE_2D, dstTexture); - - gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY); - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); - - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, srcCanvas); - - dstTexture.width = width; - dstTexture.height = height; - - if (currentTexture) - { - gl.bindTexture(gl.TEXTURE_2D, currentTexture); - } - } - - return dstTexture; + return this.style.setShadowFill(enabled); }, /** - * Creates a new WebGL Texture based on the given HTML Video Element. + * Set the width (in pixels) to use for wrapping lines. Pass in null to remove wrapping by width. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#createVideoTexture - * @since 3.20.0 + * @method Phaser.GameObjects.Text#setWordWrapWidth + * @since 3.0.0 * - * @param {HTMLVideoElement} srcVideo - The Video to create the WebGL Texture from - * @param {boolean} [noRepeat=false] - Should this canvas be allowed to set `REPEAT`? - * @param {boolean} [flipY=false] - Should the WebGL Texture set `UNPACK_MULTIPLY_FLIP_Y`? + * @param {?number} width - The maximum width of a line in pixels. Set to null to remove wrapping. + * @param {boolean} [useAdvancedWrap=false] - Whether or not to use the advanced wrapping + * algorithm. If true, spaces are collapsed and whitespace is trimmed from lines. If false, + * spaces and whitespace are left as is. * - * @return {WebGLTexture} The newly created WebGL Texture. + * @return {this} This Text object. */ - createVideoTexture: function (srcVideo, noRepeat, flipY) + setWordWrapWidth: function (width, useAdvancedWrap) { - if (noRepeat === undefined) { noRepeat = false; } - if (flipY === undefined) { flipY = false; } - - var gl = this.gl; - var minFilter = gl.NEAREST; - var magFilter = gl.NEAREST; - - var width = srcVideo.videoWidth; - var height = srcVideo.videoHeight; - - var wrapping = gl.CLAMP_TO_EDGE; - - var pow = IsSizePowerOfTwo(width, height); - - if (!noRepeat && pow) - { - wrapping = gl.REPEAT; - } - - if (this.config.antialias) - { - minFilter = (pow) ? this.mipmapFilter : gl.LINEAR; - magFilter = gl.LINEAR; - } - - return this.createTexture2D(0, minFilter, magFilter, wrapping, wrapping, gl.RGBA, srcVideo, width, height, true, true, flipY); + return this.style.setWordWrapWidth(width, useAdvancedWrap); }, /** - * Updates a WebGL Texture based on the given HTML Video Element. + * Set a custom callback for wrapping lines. Pass in null to remove wrapping by callback. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#updateVideoTexture - * @since 3.20.0 + * @method Phaser.GameObjects.Text#setWordWrapCallback + * @since 3.0.0 * - * @param {HTMLVideoElement} srcVideo - The Video to update the WebGL Texture with. - * @param {WebGLTexture} dstTexture - The destination WebGL Texture to update. - * @param {boolean} [flipY=false] - Should the WebGL Texture set `UNPACK_MULTIPLY_FLIP_Y`? + * @param {TextStyleWordWrapCallback} callback - A custom function that will be responsible for wrapping the + * text. It will receive two arguments: text (the string to wrap), textObject (this Text + * instance). It should return the wrapped lines either as an array of lines or as a string with + * newline characters in place to indicate where breaks should happen. + * @param {object} [scope=null] - The scope that will be applied when the callback is invoked. * - * @return {WebGLTexture} The updated WebGL Texture. + * @return {this} This Text object. */ - updateVideoTexture: function (srcVideo, dstTexture, flipY) + setWordWrapCallback: function (callback, scope) { - if (flipY === undefined) { flipY = false; } - - var gl = this.gl; - - var width = srcVideo.videoWidth; - var height = srcVideo.videoHeight; - - if (width > 0 && height > 0) - { - gl.activeTexture(gl.TEXTURE0); - var currentTexture = gl.getParameter(gl.TEXTURE_BINDING_2D); - gl.bindTexture(gl.TEXTURE_2D, dstTexture); - - gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY); - - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, srcVideo); - - dstTexture.width = width; - dstTexture.height = height; - - if (currentTexture) - { - gl.bindTexture(gl.TEXTURE_2D, currentTexture); - } - } - - return dstTexture; + return this.style.setWordWrapCallback(callback, scope); }, /** - * Sets the minification and magnification filter for a texture. + * Set the alignment of the text in this Text object. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#setTextureFilter + * The argument can be one of: `left`, `right`, `center` or `justify`. + * + * Alignment only works if the Text object has more than one line of text. + * + * @method Phaser.GameObjects.Text#setAlign * @since 3.0.0 * - * @param {number} texture - The texture to set the filter for. - * @param {number} filter - The filter to set. 0 for linear filtering, 1 for nearest neighbor (blocky) filtering. + * @param {string} [align='left'] - The text alignment for multi-line text. * - * @return {this} This WebGL Renderer instance. + * @return {this} This Text object. */ - setTextureFilter: function (texture, filter) + setAlign: function (align) { - var gl = this.gl; - var glFilter = [ gl.LINEAR, gl.NEAREST ][filter]; - - gl.activeTexture(gl.TEXTURE0); - - var currentTexture = gl.getParameter(gl.TEXTURE_BINDING_2D); - - gl.bindTexture(gl.TEXTURE_2D, texture); - - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, glFilter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, glFilter); - - if (currentTexture) - { - gl.bindTexture(gl.TEXTURE_2D, currentTexture); - } - - return this; + return this.style.setAlign(align); }, /** - * Returns the largest texture size (either width or height) that can be created. - * Note that VRAM may not allow a texture of any given size, it just expresses - * hardware / driver support for a given size. + * Set the resolution used by this Text object. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#getMaxTextureSize - * @since 3.8.0 + * By default it will be set to match the resolution set in the Game Config, + * but you can override it via this method, or by specifying it in the Text style configuration object. * - * @return {number} The maximum supported texture size. + * It allows for much clearer text on High DPI devices, at the cost of memory because it uses larger + * internal Canvas textures for the Text. + * + * Therefore, please use with caution, as the more high res Text you have, the more memory it uses. + * + * @method Phaser.GameObjects.Text#setResolution + * @since 3.12.0 + * + * @param {number} value - The resolution for this Text object to use. + * + * @return {this} This Text object. */ - getMaxTextureSize: function () + setResolution: function (value) { - return this.config.maxTextureSize; + return this.style.setResolution(value); }, /** - * Destroy this WebGLRenderer, cleaning up all related resources such as pipelines, native textures, etc. + * Sets the line spacing value. * - * @method Phaser.Renderer.WebGL.WebGLRenderer#destroy - * @since 3.0.0 + * This value is _added_ to the height of the font when calculating the overall line height. + * This only has an effect if this Text object consists of multiple lines of text. + * + * @method Phaser.GameObjects.Text#setLineSpacing + * @since 3.13.0 + * + * @param {number} value - The amount to add to the font height to achieve the overall line height. + * + * @return {this} This Text object. */ - destroy: function () + setLineSpacing: function (value) { - this.canvas.removeEventListener('webglcontextlost', this.contextLostHandler, false); - this.canvas.removeEventListener('webglcontextrestored', this.contextRestoredHandler, false); + this.lineSpacing = value; - var gl = this.gl; - - var temp = this.tempTextures; - - for (var i = 0; i < temp.length; i++) - { - gl.deleteTexture(temp[i]); - } - - this.pipelines.destroy(); - - this.removeAllListeners(); - - this.fboStack = []; - this.maskStack = []; - this.extensions = {}; - this.textureIndexes = []; - - this.gl = null; - this.game = null; - this.canvas = null; - this.contextLost = true; - this.currentMask = null; - this.currentCameraMask = null; - } - -}); - -module.exports = WebGLRenderer; - - -/***/ }), -/* 372 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var CONST = __webpack_require__(92); -var CustomMap = __webpack_require__(102); - -// Default Phaser 3 Pipelines -var BitmapMaskPipeline = __webpack_require__(373); -var GraphicsPipeline = __webpack_require__(376); -var LightPipeline = __webpack_require__(377); -var MultiPipeline = __webpack_require__(108); -var PointLightPipeline = __webpack_require__(378); -var RopePipeline = __webpack_require__(379); -var SinglePipeline = __webpack_require__(380); -var UtilityPipeline = __webpack_require__(381); - -/** - * @classdesc - * The Pipeline Manager is responsible for the creation, activation, running and destruction - * of WebGL Pipelines and Post FX Pipelines in Phaser 3. - * - * The `WebGLRenderer` owns a single instance of the Pipeline Manager, which you can access - * via the `WebGLRenderer.pipelines` property. - * - * By default, there are 8 pipelines installed into the Pipeline Manager when Phaser boots: - * - * 1. The Multi Pipeline. Responsible for all multi-texture rendering, i.e. Sprites and Tilemaps. - * 2. The Graphics Pipeline. Responsible for rendering Graphics and Shape objects. - * 3. The Rope Pipeline. Responsible for rendering the Rope Game Object. - * 4. The Light Pipeline. Responsible for rendering the Light Game Object. - * 5. The Point Light Pipeline. Responsible for rendering the Point Light Game Object. - * 6. The Single Pipeline. Responsible for rendering Game Objects that explicitly require one bound texture. - * 7. The Bitmap Mask Pipeline. Responsible for Bitmap Mask rendering. - * 8. The Utility Pipeline. Responsible for providing lots of handy texture manipulation functions. - * - * You can add your own custom pipeline via the `PipelineManager.add` method. Pipelines are - * identified by unique string-based keys. - * - * @class PipelineManager - * @memberof Phaser.Renderer.WebGL - * @constructor - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the WebGL Renderer that owns this Pipeline Manager. - */ -var PipelineManager = new Class({ - - initialize: - - function PipelineManager (renderer) - { - /** - * A reference to the Game instance. - * - * @name Phaser.Renderer.WebGL.PipelineManager#game - * @type {Phaser.Game} - * @since 3.50.0 - */ - this.game = renderer.game; - - /** - * A reference to the WebGL Renderer instance. - * - * @name Phaser.Renderer.WebGL.PipelineManager#renderer - * @type {Phaser.Renderer.WebGL.WebGLRenderer} - * @since 3.50.0 - */ - this.renderer = renderer; - - /** - * This map stores all pipeline classes available in this manager. - * - * The Utility Class must always come first. - * - * @name Phaser.Renderer.WebGL.PipelineManager#classes - * @type {Phaser.Structs.Map.} - * @since 3.50.0 - */ - this.classes = new CustomMap([ - [ CONST.UTILITY_PIPELINE, UtilityPipeline ], - [ CONST.MULTI_PIPELINE, MultiPipeline ], - [ CONST.BITMAPMASK_PIPELINE, BitmapMaskPipeline ], - [ CONST.SINGLE_PIPELINE, SinglePipeline ], - [ CONST.ROPE_PIPELINE, RopePipeline ], - [ CONST.LIGHT_PIPELINE, LightPipeline ], - [ CONST.POINTLIGHT_PIPELINE, PointLightPipeline ], - [ CONST.GRAPHICS_PIPELINE, GraphicsPipeline ] - ]); - - /** - * This map stores all Post FX Pipeline classes available in this manager. - * - * @name Phaser.Renderer.WebGL.PipelineManager#postPipelineClasses - * @type {Phaser.Structs.Map.} - * @since 3.50.0 - */ - this.postPipelineClasses = new CustomMap(); - - /** - * This map stores all pipeline instances in this manager. - * - * This is populated with the default pipelines in the `boot` method. - * - * @name Phaser.Renderer.WebGL.PipelineManager#pipelines - * @type {Phaser.Structs.Map.} - * @since 3.50.0 - */ - this.pipelines = new CustomMap(); - - /** - * Current pipeline in use by the WebGLRenderer. - * - * @name Phaser.Renderer.WebGL.PipelineManager#current - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @default null - * @since 3.50.0 - */ - this.current = null; - - /** - * The previous WebGLPipeline that was in use. - * - * This is set when `clearPipeline` is called and restored in `rebindPipeline` if none is given. - * - * @name Phaser.Renderer.WebGL.PipelineManager#previous - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @default null - * @since 3.50.0 - */ - this.previous = null; - - /** - * A constant-style reference to the Multi Pipeline Instance. - * - * This is the default Phaser 3 pipeline and is used by the WebGL Renderer to manage - * camera effects and more. This property is set during the `boot` method. - * - * @name Phaser.Renderer.WebGL.PipelineManager#MULTI_PIPELINE - * @type {Phaser.Renderer.WebGL.Pipelines.MultiPipeline} - * @default null - * @since 3.50.0 - */ - this.MULTI_PIPELINE = null; - - /** - * A constant-style reference to the Bitmap Mask Pipeline Instance. - * - * This is the default Phaser 3 mask pipeline and is used Game Objects using - * a Bitmap Mask. This property is set during the `boot` method. - * - * @name Phaser.Renderer.WebGL.PipelineManager#BITMAPMASK_PIPELINE - * @type {Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline} - * @default null - * @since 3.50.0 - */ - this.BITMAPMASK_PIPELINE = null; - - /** - * A constant-style reference to the Utility Pipeline Instance. - * - * @name Phaser.Renderer.WebGL.PipelineManager#UTILITY_PIPELINE - * @type {Phaser.Renderer.WebGL.Pipelines.UtilityPipeline} - * @default null - * @since 3.50.0 - */ - this.UTILITY_PIPELINE = null; - - /** - * A reference to the Full Frame 1 Render Target that belongs to the - * Utility Pipeline. This property is set during the `boot` method. - * - * This Render Target is the full size of the renderer. - * - * You can use this directly in Post FX Pipelines for multi-target effects. - * However, be aware that these targets are shared between all post fx pipelines. - * - * @name Phaser.Renderer.WebGL.PipelineManager#fullFrame1 - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @default null - * @since 3.50.0 - */ - this.fullFrame1; - - /** - * A reference to the Full Frame 2 Render Target that belongs to the - * Utility Pipeline. This property is set during the `boot` method. - * - * This Render Target is the full size of the renderer. - * - * You can use this directly in Post FX Pipelines for multi-target effects. - * However, be aware that these targets are shared between all post fx pipelines. - * - * @name Phaser.Renderer.WebGL.PipelineManager#fullFrame2 - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @default null - * @since 3.50.0 - */ - this.fullFrame2; - - /** - * A reference to the Half Frame 1 Render Target that belongs to the - * Utility Pipeline. This property is set during the `boot` method. - * - * This Render Target is half the size of the renderer. - * - * You can use this directly in Post FX Pipelines for multi-target effects. - * However, be aware that these targets are shared between all post fx pipelines. - * - * @name Phaser.Renderer.WebGL.PipelineManager#halfFrame1 - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @default null - * @since 3.50.0 - */ - this.halfFrame1; - - /** - * A reference to the Half Frame 2 Render Target that belongs to the - * Utility Pipeline. This property is set during the `boot` method. - * - * This Render Target is half the size of the renderer. - * - * You can use this directly in Post FX Pipelines for multi-target effects. - * However, be aware that these targets are shared between all post fx pipelines. - * - * @name Phaser.Renderer.WebGL.PipelineManager#halfFrame2 - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @default null - * @since 3.50.0 - */ - this.halfFrame2; + return this.updateText(); }, /** - * Internal boot handler, called by the WebGLRenderer durings its boot process. + * Set the text padding. * - * Adds all of the default pipelines, based on the game config, and then calls - * the `boot` method on each one of them. + * 'left' can be an object. * - * Finally, the default pipeline is set. + * If only 'left' and 'top' are given they are treated as 'x' and 'y'. * - * @method Phaser.Renderer.WebGL.PipelineManager#boot - * @since 3.50.0 + * @method Phaser.GameObjects.Text#setPadding + * @since 3.0.0 + * + * @param {(number|Phaser.Types.GameObjects.Text.TextPadding)} left - The left padding value, or a padding config object. + * @param {number} [top] - The top padding value. + * @param {number} [right] - The right padding value. + * @param {number} [bottom] - The bottom padding value. * - * @param {Phaser.Types.Core.PipelineConfig} [pipelineConfig] - The pipeline configuration object as set in the Game Config. + * @return {this} This Text object. */ - boot: function (pipelineConfig) + setPadding: function (left, top, right, bottom) { - // Install each of the default pipelines - - var instance; - var pipelineName; - - var _this = this; - var game = this.game; - - this.classes.each(function (pipelineName, pipeline) + if (typeof left === 'object') { - instance = _this.add(pipelineName, new pipeline({ game: game })); + var config = left; - if (pipelineName === CONST.UTILITY_PIPELINE) - { - _this.UTILITY_PIPELINE = instance; + // If they specify x and/or y this applies to all + var x = GetValue(config, 'x', null); - // FBO references - _this.fullFrame1 = instance.fullFrame1; - _this.fullFrame2 = instance.fullFrame2; - _this.halfFrame1 = instance.halfFrame1; - _this.halfFrame2 = instance.halfFrame2; + if (x !== null) + { + left = x; + right = x; } - }); - - // Our const-like references - this.MULTI_PIPELINE = this.get(CONST.MULTI_PIPELINE); - this.BITMAPMASK_PIPELINE = this.get(CONST.BITMAPMASK_PIPELINE); - - // And now the ones in the config, if any - - if (pipelineConfig) - { - for (pipelineName in pipelineConfig) + else { - var pipelineClass = pipelineConfig[pipelineName]; - - instance = new pipelineClass(game); - - if (instance.isPostFX) - { - this.postPipelineClasses.set(pipelineName, pipelineClass); - } - else if (!this.has(pipelineName)) - { - this.classes.set(pipelineName, pipelineClass); - - this.add(pipelineName, instance); - } + left = GetValue(config, 'left', 0); + right = GetValue(config, 'right', left); } - } - }, - - /** - * Adds a pipeline instance to this Pipeline Manager. - * - * The name of the instance must be unique within this manager. - * - * Make sure to pass an instance to this method, not a base class. - * - * For example, you should pass it like this: - * - * ```javascript - * this.add('yourName', new CustomPipeline());` - * ``` - * - * and **not** like this: - * - * ```javascript - * this.add('yourName', CustomPipeline);` - * ``` - * - * To add a **Post Pipeline**, see `addPostPipeline` instead. - * - * @method Phaser.Renderer.WebGL.PipelineManager#add - * @since 3.50.0 - * - * @param {string} name - A unique string-based key for the pipeline within the manager. - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - A pipeline _instance_ which must extend `WebGLPipeline`. - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline instance that was passed. - */ - add: function (name, pipeline) - { - if (pipeline.isPostFX) - { - console.warn(name + ' is a Post Pipeline. Use `addPostPipeline` instead'); - - return; - } - - var pipelines = this.pipelines; - var renderer = this.renderer; - if (!pipelines.has(name)) - { - pipeline.name = name; - pipeline.manager = this; + var y = GetValue(config, 'y', null); - pipelines.set(name, pipeline); + if (y !== null) + { + top = y; + bottom = y; + } + else + { + top = GetValue(config, 'top', 0); + bottom = GetValue(config, 'bottom', top); + } } else { - console.warn('Pipeline exists: ' + name); - } - - if (!pipeline.hasBooted) - { - pipeline.boot(); + if (left === undefined) { left = 0; } + if (top === undefined) { top = left; } + if (right === undefined) { right = left; } + if (bottom === undefined) { bottom = top; } } - if (renderer.width !== 0 && renderer.height !== 0) - { - pipeline.resize(renderer.width, renderer.height); - } + this.padding.left = left; + this.padding.top = top; + this.padding.right = right; + this.padding.bottom = bottom; - return pipeline; + return this.updateText(); }, /** - * Adds a Post Pipeline to this Pipeline Manager. - * - * Make sure to pass a base class to this method, not an instance. - * - * For example, you should pass it like this: - * - * ```javascript - * this.addPostPipeline('yourName', CustomPipeline);` - * ``` - * - * and **not** like this: - * - * ```javascript - * this.addPostPipeline('yourName', new CustomPipeline());` - * ``` - * - * To add a regular pipeline, see the `add` method instead. - * - * @method Phaser.Renderer.WebGL.PipelineManager#addPostPipeline - * @since 3.50.0 + * Set the maximum number of lines to draw. * - * @param {string} name - A unique string-based key for the pipeline within the manager. - * @param {function} pipeline - A pipeline class which must extend `PostFXPipeline`. + * @method Phaser.GameObjects.Text#setMaxLines + * @since 3.0.0 * - * @return {this} This Pipeline Manager. - */ - addPostPipeline: function (name, pipeline) - { - if (!this.postPipelineClasses.has(name)) - { - this.postPipelineClasses.set(name, pipeline); - } - }, - - /** - * Flushes the current pipeline, if one is bound. + * @param {number} [max=0] - The maximum number of lines to draw. * - * @method Phaser.Renderer.WebGL.PipelineManager#flush - * @since 3.50.0 + * @return {this} This Text object. */ - flush: function () + setMaxLines: function (max) { - if (this.current) - { - this.current.flush(); - } + return this.style.setMaxLines(max); }, /** - * Checks if a pipeline is present in this Pipeline Manager. - * - * @method Phaser.Renderer.WebGL.PipelineManager#has - * @since 3.50.0 + * Update the displayed text. * - * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance to look-up. + * @method Phaser.GameObjects.Text#updateText + * @since 3.0.0 * - * @return {boolean} `true` if the given pipeline is loaded, otherwise `false`. + * @return {this} This Text object. */ - has: function (pipeline) + updateText: function () { - var pipelines = this.pipelines; - - if (typeof pipeline === 'string') - { - return pipelines.has(pipeline); - } - else if (pipelines.contains(pipeline)) - { - return true; - } + var canvas = this.canvas; + var context = this.context; + var style = this.style; + var resolution = style.resolution; + var size = style.metrics; - return false; - }, + style.syncFont(canvas, context); - /** - * Returns the pipeline instance based on the given name, or instance. - * - * If no instance, or matching name, exists in this manager, it returns `undefined`. - * - * @method Phaser.Renderer.WebGL.PipelineManager#get - * @since 3.50.0 - * - * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance to look-up. - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline instance, or `undefined` if not found. - */ - get: function (pipeline) - { - var pipelines = this.pipelines; + var outputText = this._text; - if (typeof pipeline === 'string') - { - return pipelines.get(pipeline); - } - else if (pipelines.contains(pipeline)) + if (style.wordWrapWidth || style.wordWrapCallback) { - return pipeline; + outputText = this.runWordWrap(this._text); } - }, - /** - * Returns a _new instance_ of the post pipeline based on the given name, or class. - * - * If no instance, or matching name, exists in this manager, it returns `undefined`. - * - * @method Phaser.Renderer.WebGL.PipelineManager#getPostPipeline - * @since 3.50.0 - * - * @param {(string|function|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance, or class to look-up. - * @param {Phaser.GameObjects.GameObject} [gameObject] - If this post pipeline is being installed into a Game Object or Camera, this is a reference to it. - * - * @return {Phaser.Renderer.WebGL.Pipelines.PostFXPipeline} The pipeline instance, or `undefined` if not found. - */ - getPostPipeline: function (pipeline, gameObject) - { - var pipelineClasses = this.postPipelineClasses; + // Split text into lines + var lines = outputText.split(this.splitRegExp); - var instance; + var textSize = GetTextSize(this, size, lines); - if (typeof pipeline === 'string') + var padding = this.padding; + + var textWidth; + + if (style.fixedWidth === 0) { - instance = pipelineClasses.get(pipeline); + this.width = textSize.width + padding.left + padding.right; + + textWidth = textSize.width; } - else if (typeof pipeline === 'function') + else { - // A class - if (pipelineClasses.contains(pipeline)) + this.width = style.fixedWidth; + + textWidth = this.width - padding.left - padding.right; + + if (textWidth < textSize.width) { - instance = pipeline; + textWidth = textSize.width; } } - else if (typeof pipeline === 'object') + + if (style.fixedHeight === 0) { - // Instance - instance = pipelineClasses.get(pipeline.name); + this.height = textSize.height + padding.top + padding.bottom; } - - if (instance) + else { - var newPipeline = new instance(this.game); - - if (gameObject) - { - newPipeline.gameObject = gameObject; - } - - return newPipeline; + this.height = style.fixedHeight; } - }, - /** - * Removes a pipeline instance based on the given name. - * - * If no pipeline matches the name, this method does nothing. - * - * Note that the pipeline will not be flushed or destroyed, it's simply removed from - * this manager. - * - * @method Phaser.Renderer.WebGL.PipelineManager#remove - * @since 3.50.0 - * - * @param {string} name - The name of the pipeline to be removed. - * @param {boolean} [removeClass=true] - Remove the pipeline class as well as the instance? - * @param {boolean} [removePostPipelineClass=true] - Remove the post pipeline class as well as the instance? - */ - remove: function (name, removeClass, removePostPipelineClass) - { - if (removeClass === undefined) { removeClass = true; } - if (removePostPipelineClass === undefined) { removePostPipelineClass = true; } + var w = this.width; + var h = this.height; - this.pipelines.delete(name); + this.updateDisplayOrigin(); - if (removeClass) - { - this.classes.delete(name); - } + w *= resolution; + h *= resolution; - if (removePostPipelineClass) - { - this.postPipelineClasses.delete(name); - } - }, + w = Math.max(w, 1); + h = Math.max(h, 1); - /** - * Sets the current pipeline to be used by the `WebGLRenderer`. - * - * This method accepts a pipeline instance as its parameter, not the name. - * - * If the pipeline isn't already the current one it will call `WebGLPipeline.bind` and then `onBind`. - * - * You cannot set Post FX Pipelines using this method. To use a Post FX Pipeline, you should - * apply it to either a Camera, Container or other supporting Game Object. - * - * @method Phaser.Renderer.WebGL.PipelineManager#set - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline instance to be set as current. - * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. - * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. - * - * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline that was set, or undefined if it couldn't be set. - */ - set: function (pipeline, gameObject, currentShader) - { - if (pipeline.isPostFX) + if (canvas.width !== w || canvas.height !== h) { - return; - } + canvas.width = w; + canvas.height = h; - if (!this.isCurrent(pipeline, currentShader)) - { - this.flush(); + this.frame.setSize(w, h); - if (this.current) + // Because resizing the canvas resets the context + style.syncFont(canvas, context); + + if (style.rtl) { - this.current.unbind(); + context.direction = 'rtl'; } + } + else + { + context.clearRect(0, 0, w, h); + } - this.current = pipeline; + context.save(); - pipeline.bind(currentShader); + context.scale(resolution, resolution); + + if (style.backgroundColor) + { + context.fillStyle = style.backgroundColor; + context.fillRect(0, 0, w, h); } - pipeline.updateProjectionMatrix(); + style.syncStyle(canvas, context); - pipeline.onBind(gameObject); + // Apply padding + context.translate(padding.left, padding.top); - return pipeline; - }, + var linePositionX; + var linePositionY; - /** - * This method is called by the `WebGLPipeline.batchQuad` method, right before a quad - * belonging to a Game Object is about to be added to the batch. It causes a batch - * flush, then calls the `preBatch` method on the post-fx pipelines belonging to the - * Game Object. - * - * @method Phaser.Renderer.WebGL.PipelineManager#preBatch - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object about to be batched. - */ - preBatch: function (gameObject) - { - if (gameObject.hasPostPipeline) + // Draw text line by line + for (var i = 0; i < textSize.lines; i++) { - this.flush(); + linePositionX = style.strokeThickness / 2; + linePositionY = (style.strokeThickness / 2 + i * textSize.lineHeight) + size.ascent; - var pipelines = gameObject.postPipelines; + if (i > 0) + { + linePositionY += (textSize.lineSpacing * i); + } - // Iterate in reverse because we need them stacked in the order they're in the array - for (var i = pipelines.length - 1; i >= 0; i--) + if (style.rtl) { - var pipeline = pipelines[i]; + linePositionX = w - linePositionX - padding.left - padding.right; + } + else if (style.align === 'right') + { + linePositionX += textWidth - textSize.lineWidths[i]; + } + else if (style.align === 'center') + { + linePositionX += (textWidth - textSize.lineWidths[i]) / 2; + } + else if (style.align === 'justify') + { + // To justify text line its width must be no less than 85% of defined width + var minimumLengthToApplyJustification = 0.85; - if (pipeline.active) + if (textSize.lineWidths[i] / textSize.width >= minimumLengthToApplyJustification) { - pipeline.preBatch(gameObject); - } - } - } - }, + var extraSpace = textSize.width - textSize.lineWidths[i]; + var spaceSize = context.measureText(' ').width; + var trimmedLine = lines[i].trim(); + var array = trimmedLine.split(' '); - /** - * This method is called by the `WebGLPipeline.batchQuad` method, right after a quad - * belonging to a Game Object has been added to the batch. It causes a batch - * flush, then calls the `postBatch` method on the post-fx pipelines belonging to the - * Game Object. - * - * @method Phaser.Renderer.WebGL.PipelineManager#postBatch - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was just added to the batch. - */ - postBatch: function (gameObject) - { - if (gameObject.hasPostPipeline) - { - this.flush(); + extraSpace += (lines[i].length - trimmedLine.length) * spaceSize; - var pipelines = gameObject.postPipelines; + var extraSpaceCharacters = Math.floor(extraSpace / spaceSize); + var idx = 0; - for (var i = 0; i < pipelines.length; i++) - { - var pipeline = pipelines[i]; + while (extraSpaceCharacters > 0) + { + array[idx] += ' '; + idx = (idx + 1) % (array.length - 1 || 1); + --extraSpaceCharacters; + } - if (pipeline.active) - { - pipeline.postBatch(gameObject); + lines[i] = array.join(' '); } } - } - }, - /** - * Called at the start of the `WebGLRenderer.preRenderCamera` method. - * - * If the Camera has post pipelines set, it will flush the batch and then call the - * `preBatch` method on the post-fx pipelines belonging to the Camera. - * - * @method Phaser.Renderer.WebGL.PipelineManager#preBatchCamera - * @since 3.50.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera about to be rendered. - */ - preBatchCamera: function (camera) - { - if (camera.hasPostPipeline) - { - this.flush(); + if (this.autoRound) + { + linePositionX = Math.round(linePositionX); + linePositionY = Math.round(linePositionY); + } - var pipelines = camera.postPipelines; + if (style.strokeThickness) + { + style.syncShadow(context, style.shadowStroke); - // Iterate in reverse because we need them stacked in the order they're in the array - for (var i = pipelines.length - 1; i >= 0; i--) + context.strokeText(lines[i], linePositionX, linePositionY); + } + + if (style.color) { - var pipeline = pipelines[i]; + style.syncShadow(context, style.shadowFill); - if (pipeline.active) - { - pipeline.preBatch(camera); - } + context.fillText(lines[i], linePositionX, linePositionY); } } - }, - /** - * Called at the end of the `WebGLRenderer.postRenderCamera` method. - * - * If the Camera has post pipelines set, it will flush the batch and then call the - * `postBatch` method on the post-fx pipelines belonging to the Camera. - * - * @method Phaser.Renderer.WebGL.PipelineManager#postBatchCamera - * @since 3.50.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that was just rendered. - */ - postBatchCamera: function (camera) - { - if (camera.hasPostPipeline) - { - this.flush(); + context.restore(); - var pipelines = camera.postPipelines; + if (this.renderer && this.renderer.gl) + { + this.frame.source.glTexture = this.renderer.canvasToTexture(canvas, this.frame.source.glTexture, true); - for (var i = 0; i < pipelines.length; i++) - { - var pipeline = pipelines[i]; + this.frame.glTexture = this.frame.source.glTexture; - if (pipeline.active) - { - pipeline.postBatch(camera); - } - } + if (false) + {} } - }, - /** - * Checks to see if the given pipeline is already the active pipeline, both within this - * Pipeline Manager and also has the same shader set in the Renderer. - * - * @method Phaser.Renderer.WebGL.PipelineManager#isCurrent - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline instance to be checked. - * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. - * - * @return {boolean} `true` if the given pipeline is already the current pipeline, otherwise `false`. - */ - isCurrent: function (pipeline, currentShader) - { - var renderer = this.renderer; - var current = this.current; + this.dirty = true; - if (current && !currentShader) + var input = this.input; + + if (input && !input.customHitArea) { - currentShader = current.currentShader; + input.hitArea.width = this.width; + input.hitArea.height = this.height; } - return !(current !== pipeline || currentShader.program !== renderer.currentProgram); + return this; }, /** - * Copy the `source` Render Target to the `target` Render Target. - * - * You can optionally set the brightness factor of the copy. - * - * The difference between this method and `drawFrame` is that this method - * uses a faster copy shader, where only the brightness can be modified. - * If you need color level manipulation, see `drawFrame` instead. - * - * The copy itself is handled by the Utility Pipeline. - * - * @method Phaser.Renderer.WebGL.PipelineManager#copyFrame - * @since 3.50.0 + * Get the current text metrics. * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. - * @param {number} [brightness=1] - The brightness value applied to the frame copy. - * @param {boolean} [clear=true] - Clear the target before copying? - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @method Phaser.GameObjects.Text#getTextMetrics + * @since 3.0.0 * - * @return {this} This Pipeline Manager instance. + * @return {Phaser.Types.GameObjects.Text.TextMetrics} The text metrics. */ - copyFrame: function (source, target, brightness, clear, clearAlpha) + getTextMetrics: function () { - this.setUtility(this.UTILITY_PIPELINE.copyShader).copyFrame(source, target, brightness, clear, clearAlpha); - - return this; + return this.style.getTextMetrics(); }, /** - * Pops the framebuffer from the renderers FBO stack and sets that as the active target, - * then draws the `source` Render Target to it. It then resets the renderer textures. - * - * This should be done when you need to draw the _final_ results of a pipeline to the game - * canvas, or the next framebuffer in line on the FBO stack. You should only call this once - * in the `onDraw` handler and it should be the final thing called. Be careful not to call - * this if you need to actually use the pipeline shader, instead of the copy shader. In - * those cases, use the `bindAndDraw` method. - * - * @method Phaser.Renderer.WebGL.PipelineManager#copyToGame - * @since 3.50.0 + * The text string being rendered by this Text Game Object. * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. + * @name Phaser.GameObjects.Text#text + * @type {string} + * @since 3.0.0 */ - copyToGame: function (source) - { - this.setUtility(this.UTILITY_PIPELINE.copyShader).copyToGame(source); + text: { - return this; - }, + get: function () + { + return this._text; + }, - /** - * Copy the `source` Render Target to the `target` Render Target, using the - * given Color Matrix. - * - * The difference between this method and `copyFrame` is that this method - * uses a color matrix shader, where you have full control over the luminance - * values used during the copy. If you don't need this, you can use the faster - * `copyFrame` method instead. - * - * The copy itself is handled by the Utility Pipeline. - * - * @method Phaser.Renderer.WebGL.PipelineManager#drawFrame - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? - * @param {Phaser.Display.ColorMatrix} [colorMatrix] - The Color Matrix to use when performing the draw. - * - * @return {this} This Pipeline Manager instance. - */ - drawFrame: function (source, target, clearAlpha, colorMatrix) - { - this.setUtility(this.UTILITY_PIPELINE.colorMatrixShader).drawFrame(source, target, clearAlpha, colorMatrix); + set: function (value) + { + this.setText(value); + } - return this; }, /** - * Draws the `source1` and `source2` Render Targets to the `target` Render Target - * using a linear blend effect, which is controlled by the `strength` parameter. - * - * The draw itself is handled by the Utility Pipeline. - * - * @method Phaser.Renderer.WebGL.PipelineManager#blendFrames - * @since 3.50.0 + * Build a JSON representation of the Text object. * - * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. - * @param {number} [strength=1] - The strength of the blend. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @method Phaser.GameObjects.Text#toJSON + * @since 3.0.0 * - * @return {this} This Pipeline Manager instance. + * @return {Phaser.Types.GameObjects.JSONGameObject} A JSON representation of the Text object. */ - blendFrames: function (source1, source2, target, strength, clearAlpha) + toJSON: function () { - this.setUtility(this.UTILITY_PIPELINE.linearShader).blendFrames(source1, source2, target, strength, clearAlpha); + var out = Components.ToJSON(this); - return this; - }, + // Extra Text data is added here - /** - * Draws the `source1` and `source2` Render Targets to the `target` Render Target - * using an additive blend effect, which is controlled by the `strength` parameter. - * - * The draw itself is handled by the Utility Pipeline. - * - * @method Phaser.Renderer.WebGL.PipelineManager#blendFramesAdditive - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. - * @param {number} [strength=1] - The strength of the blend. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? - * - * @return {this} This Pipeline Manager instance. - */ - blendFramesAdditive: function (source1, source2, target, strength, clearAlpha) - { - this.setUtility(this.UTILITY_PIPELINE.addShader).blendFramesAdditive(source1, source2, target, strength, clearAlpha); + var data = { + autoRound: this.autoRound, + text: this._text, + style: this.style.toJSON(), + padding: { + left: this.padding.left, + right: this.padding.right, + top: this.padding.top, + bottom: this.padding.bottom + } + }; - return this; + out.data = data; + + return out; }, /** - * Clears the given Render Target. - * - * @method Phaser.Renderer.WebGL.PipelineManager#clearFrame - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.RenderTarget} target - The Render Target to clear. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * Internal destroy handler, called as part of the destroy process. * - * @return {this} This Pipeline Manager instance. + * @method Phaser.GameObjects.Text#preDestroy + * @protected + * @since 3.0.0 */ - clearFrame: function (target, clearAlpha) + preDestroy: function () { - this.UTILITY_PIPELINE.clearFrame(target, clearAlpha); + if (this.style.rtl) + { + RemoveFromDOM(this.canvas); + } - return this; - }, + CanvasPool.remove(this.canvas); + + this.texture.destroy(); + } /** - * Copy the `source` Render Target to the `target` Render Target. - * - * The difference with this copy is that no resizing takes place. If the `source` - * Render Target is larger than the `target` then only a portion the same size as - * the `target` dimensions is copied across. - * - * You can optionally set the brightness factor of the copy. - * - * @method Phaser.Renderer.WebGL.PipelineManager#blitFrame - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. - * @param {number} [brightness=1] - The brightness value applied to the frame copy. - * @param {boolean} [clear=true] - Clear the target before copying? - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? - * @param {boolean} [eraseMode=false] - Erase source from target using ERASE Blend Mode? + * The horizontal origin of this Game Object. + * The origin maps the relationship between the size and position of the Game Object. + * The default value is 0.5, meaning all Game Objects are positioned based on their center. + * Setting the value to 0 means the position now relates to the left of the Game Object. * - * @return {this} This Pipeline Manager instance. + * @name Phaser.GameObjects.Text#originX + * @type {number} + * @default 0 + * @since 3.0.0 */ - blitFrame: function (source, target, brightness, clear, clearAlpha, eraseMode) - { - this.setUtility(this.UTILITY_PIPELINE.copyShader).blitFrame(source, target, brightness, clear, clearAlpha, eraseMode); - - return this; - }, /** - * Binds the `source` Render Target and then copies a section of it to the `target` Render Target. - * - * This method is extremely fast because it uses `gl.copyTexSubImage2D` and doesn't - * require the use of any shaders. Remember the coordinates are given in standard WebGL format, - * where x and y specify the lower-left corner of the section, not the top-left. Also, the - * copy entirely replaces the contents of the target texture, no 'merging' or 'blending' takes - * place. - * - * @method Phaser.Renderer.WebGL.PipelineManager#copyFrameRect - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. - * @param {number} x - The x coordinate of the lower left corner where to start copying. - * @param {number} y - The y coordinate of the lower left corner where to start copying. - * @param {number} width - The width of the texture. - * @param {number} height - The height of the texture. - * @param {boolean} [clear=true] - Clear the target before copying? - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * The vertical origin of this Game Object. + * The origin maps the relationship between the size and position of the Game Object. + * The default value is 0.5, meaning all Game Objects are positioned based on their center. + * Setting the value to 0 means the position now relates to the top of the Game Object. * - * @return {this} This Pipeline Manager instance. + * @name Phaser.GameObjects.Text#originY + * @type {number} + * @default 0 + * @since 3.0.0 */ - copyFrameRect: function (source, target, x, y, width, height, clear, clearAlpha) - { - this.UTILITY_PIPELINE.copyFrameRect(source, target, x, y, width, height, clear, clearAlpha); - return this; - }, - - /** - * Returns `true` if the current pipeline is forced to use texture unit zero. - * - * @method Phaser.Renderer.WebGL.PipelineManager#forceZero - * @since 3.50.0 - * - * @return {boolean} `true` if the current pipeline is forced to use texture unit zero. - */ - forceZero: function () - { - return (this.current && this.current.forceZero); - }, +}); - /** - * Sets the Multi Pipeline to be the currently bound pipeline. - * - * This is the default Phaser 3 rendering pipeline. - * - * @method Phaser.Renderer.WebGL.PipelineManager#setMulti - * @since 3.50.0 - * - * @return {Phaser.Renderer.WebGL.Pipelines.MultiPipeline} The Multi Pipeline instance. - */ - setMulti: function () - { - return this.set(this.MULTI_PIPELINE); - }, +module.exports = Text; - /** - * Sets the Utility Pipeline to be the currently bound pipeline. - * - * @method Phaser.Renderer.WebGL.PipelineManager#setUtility - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. - * - * @return {Phaser.Renderer.WebGL.Pipelines.UtilityPipeline} The Utility Pipeline instance. - */ - setUtility: function (currentShader) - { - return this.UTILITY_PIPELINE.bind(currentShader); - }, - /** - * Use this to reset the gl context to the state that Phaser requires to continue rendering. - * - * Calling this will: - * - * * Disable `DEPTH_TEST`, `CULL_FACE` and `STENCIL_TEST`. - * * Clear the depth buffer and stencil buffers. - * * Reset the viewport size. - * * Reset the blend mode. - * * Bind a blank texture as the active texture on texture unit zero. - * * Rebinds the given pipeline instance. - * - * You should call this if you have previously called `clear`, and then wish to return - * rendering control to Phaser again. - * - * @method Phaser.Renderer.WebGL.PipelineManager#rebind - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} [pipeline] - The pipeline instance to be rebound. If not given, the previous pipeline will be bound. - */ - rebind: function (pipeline) - { - if (pipeline === undefined && this.previous) - { - pipeline = this.previous; - } +/***/ }), - var renderer = this.renderer; - var gl = renderer.gl; +/***/ 71649: +/***/ ((module) => { - gl.disable(gl.DEPTH_TEST); - gl.disable(gl.CULL_FACE); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (renderer.hasActiveStencilMask()) - { - gl.clear(gl.DEPTH_BUFFER_BIT); - } - else - { - // If there wasn't a stencil mask set before this call, we can disable it safely - gl.disable(gl.STENCIL_TEST); - gl.clear(gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); - } +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.GameObjects.Text#renderCanvas + * @since 3.0.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Text} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var TextCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + if (src.width === 0 || src.height === 0) + { + return; + } - gl.viewport(0, 0, renderer.width, renderer.height); + camera.addToRenderList(src); - renderer.currentProgram = null; + renderer.batchSprite(src, src.frame, camera, parentMatrix); +}; - renderer.setBlendMode(0, true); +module.exports = TextCanvasRenderer; - var entries = this.pipelines.entries; - for (var key in entries) - { - entries[key].glReset = true; - } +/***/ }), - if (pipeline) - { - this.current = pipeline; +/***/ 75397: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - pipeline.rebind(); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - renderer.resetTextures(); - }, +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var Text = __webpack_require__(76555); - /** - * Flushes the current pipeline being used and then clears it, along with the - * the current shader program and vertex buffer from the `WebGLRenderer`. - * - * Then resets the blend mode to NORMAL. - * - * Call this before jumping to your own gl context handler, and then call `rebind` when - * you wish to return control to Phaser again. - * - * @method Phaser.Renderer.WebGL.PipelineManager#clear - * @since 3.50.0 - */ - clear: function () - { - var renderer = this.renderer; +/** + * Creates a new Text Game Object and returns it. + * + * Note: This method will only be available if the Text Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#text + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.Text.TextConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Text} The Game Object that was created. + */ +GameObjectCreator.register('text', function (config, addToScene) +{ + if (config === undefined) { config = {}; } - this.flush(); + // style Object = { + // font: [ 'font', '16px Courier' ], + // backgroundColor: [ 'backgroundColor', null ], + // fill: [ 'fill', '#fff' ], + // stroke: [ 'stroke', '#fff' ], + // strokeThickness: [ 'strokeThickness', 0 ], + // shadowOffsetX: [ 'shadow.offsetX', 0 ], + // shadowOffsetY: [ 'shadow.offsetY', 0 ], + // shadowColor: [ 'shadow.color', '#000' ], + // shadowBlur: [ 'shadow.blur', 0 ], + // shadowStroke: [ 'shadow.stroke', false ], + // shadowFill: [ 'shadow.fill', false ], + // align: [ 'align', 'left' ], + // maxLines: [ 'maxLines', 0 ], + // fixedWidth: [ 'fixedWidth', false ], + // fixedHeight: [ 'fixedHeight', false ], + // rtl: [ 'rtl', false ] + // } - if (this.current) - { - this.current.unbind(); - this.previous = this.current; - this.current = null; - } - else - { - this.previous = null; - } + var content = GetAdvancedValue(config, 'text', ''); + var style = GetAdvancedValue(config, 'style', null); - renderer.currentProgram = null; + // Padding + // { padding: 2 } + // { padding: { x: , y: }} + // { padding: { left: , top: }} + // { padding: { left: , right: , top: , bottom: }} - renderer.setBlendMode(0, true); - }, + var padding = GetAdvancedValue(config, 'padding', null); - /** - * Destroy the Pipeline Manager, cleaning up all related resources and references. - * - * @method Phaser.Renderer.WebGL.PipelineManager#destroy - * @since 3.50.0 - */ - destroy: function () + if (padding !== null) { - this.flush(); + style.padding = padding; + } - this.classes.clear(); - this.postPipelineClasses.clear(); - this.pipelines.clear(); + var text = new Text(this.scene, 0, 0, content, style); - this.renderer = null; - this.game = null; - this.classes = null; - this.postPipelineClasses = null; - this.pipelines = null; - this.current = null; - this.previous = null; + if (addToScene !== undefined) + { + config.add = addToScene; } + BuildGameObject(this.scene, text, config); + + // Text specific config options: + + text.autoRound = GetAdvancedValue(config, 'autoRound', true); + text.resolution = GetAdvancedValue(config, 'resolution', 1); + + return text; }); -module.exports = PipelineManager; +// When registering a factory function 'this' refers to the GameObjectCreator context. /***/ }), -/* 373 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 94627: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); -var ShaderSourceFS = __webpack_require__(866); -var ShaderSourceVS = __webpack_require__(867); -var WEBGL_CONST = __webpack_require__(107); -var WebGLPipeline = __webpack_require__(58); +var Text = __webpack_require__(76555); +var GameObjectFactory = __webpack_require__(61286); /** - * @classdesc - * The Bitmap Mask Pipeline handles all of the bitmap mask rendering in WebGL for applying - * alpha masks to Game Objects. It works by sampling two texture on the fragment shader and - * using the fragments alpha to clip the region. + * Creates a new Text Game Object and adds it to the Scene. * - * The fragment shader it uses can be found in `shaders/src/BitmapMask.frag`. - * The vertex shader it uses can be found in `shaders/src/BitmapMask.vert`. + * A Text Game Object. * - * The default shader attributes for this pipeline are: + * Text objects work by creating their own internal hidden Canvas and then renders text to it using + * the standard Canvas `fillText` API. It then creates a texture from this canvas which is rendered + * to your game during the render pass. * - * `inPosition` (vec2, offset 0) + * Because it uses the Canvas API you can take advantage of all the features this offers, such as + * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts + * loaded externally, such as Google or TypeKit Web fonts. * - * The default shader uniforms for this pipeline are: + * You can only display fonts that are currently loaded and available to the browser: therefore fonts must + * be pre-loaded. Phaser does not do ths for you, so you will require the use of a 3rd party font loader, + * or have the fonts ready available in the CSS on the page in which your Phaser game resides. * - * `uResolution` (vec2) - * `uMainSampler` (sampler2D) - * `uMaskSampler` (sampler2D) - * `uInvertMaskAlpha` (bool) + * See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts + * across mobile browsers. * - * @class BitmapMaskPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines - * @constructor + * A note on performance: Every time the contents of a Text object changes, i.e. changing the text being + * displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the + * new texture to the GPU. This can be an expensive operation if used often, or with large quantities of + * Text objects in your game. If you run into performance issues you would be better off using Bitmap Text + * instead, as it benefits from batching and avoids expensive Canvas API calls. + * + * Note: This method will only be available if the Text Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#text * @since 3.0.0 * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|string[])} text - The text this Text object will display. + * @param {Phaser.Types.GameObjects.Text.TextStyle} [style] - The Text style configuration object. + * + * @return {Phaser.GameObjects.Text} The Game Object that was created. */ -var BitmapMaskPipeline = new Class({ - - Extends: WebGLPipeline, - - initialize: - - function BitmapMaskPipeline (config) - { - config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS), - config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS), - config.batchSize = GetFastValue(config, 'batchSize', 1), - config.vertices = GetFastValue(config, 'vertices', [ -1, 1, -1, -7, 7, 1 ]), - config.attributes = GetFastValue(config, 'attributes', [ - { - name: 'inPosition', - size: 2, - type: WEBGL_CONST.FLOAT - } - ]); - - WebGLPipeline.call(this, config); - }, - - boot: function () - { - WebGLPipeline.prototype.boot.call(this); - - this.set1i('uMainSampler', 0); - this.set1i('uMaskSampler', 1); - }, - - resize: function (width, height) - { - WebGLPipeline.prototype.resize.call(this, width, height); - - this.set2f('uResolution', width, height); - }, - - /** - * Binds necessary resources and renders the mask to a separated framebuffer. - * The framebuffer for the masked object is also bound for further use. - * - * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#beginMask - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} mask - GameObject used as mask. - * @param {Phaser.GameObjects.GameObject} maskedObject - GameObject masked by the mask GameObject. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera rendering the current mask. - */ - beginMask: function (mask, maskedObject, camera) - { - var gl = this.gl; - - // The renderable Game Object that is being used for the bitmap mask - if (mask.bitmapMask && gl) - { - var renderer = this.renderer; - - renderer.flush(); - - renderer.pushFramebuffer(mask.mainFramebuffer); - - gl.disable(gl.STENCIL_TEST); - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - - if (renderer.currentCameraMask.mask !== mask) - { - renderer.currentMask.mask = mask; - renderer.currentMask.camera = camera; - } - } - }, - - /** - * The masked game objects framebuffer is unbound and its texture - * is bound together with the mask texture and the mask shader and - * a draw call with a single quad is processed. Here is where the - * masking effect is applied. - * - * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#endMask - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} mask - GameObject used as a mask. - */ - endMask: function (mask, camera) - { - var gl = this.gl; - var renderer = this.renderer; - - // The renderable Game Object that is being used for the bitmap mask - var bitmapMask = mask.bitmapMask; - - if (bitmapMask && gl) - { - // mask.mainFramebuffer should now contain all the Game Objects we want masked - renderer.flush(); - - // Swap to the mask framebuffer (push, in case the bitmapMask GO has a post-pipeline) - renderer.pushFramebuffer(mask.maskFramebuffer); - - // Clear it and draw the Game Object that is acting as a mask to it - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - - renderer.setBlendMode(0, true); - - bitmapMask.renderWebGL(renderer, bitmapMask, camera); - - renderer.flush(); - - // Clear the mask framebuffer + main framebuffer - renderer.popFramebuffer(); - renderer.popFramebuffer(); - - // Is there a stencil further up the stack? - var prev = renderer.getCurrentStencilMask(); - - if (prev) - { - gl.enable(gl.STENCIL_TEST); - - prev.mask.applyStencil(renderer, prev.camera, true); - } - else - { - renderer.currentMask.mask = null; - } - - // Bind this pipeline and draw - renderer.pipelines.set(this); - - gl.activeTexture(gl.TEXTURE1); - gl.bindTexture(gl.TEXTURE_2D, mask.maskTexture); - - gl.activeTexture(gl.TEXTURE0); - gl.bindTexture(gl.TEXTURE_2D, mask.mainTexture); - - this.set1i('uInvertMaskAlpha', mask.invertAlpha); - - // Finally, draw a triangle filling the whole screen - gl.drawArrays(this.topology, 0, 3); - - renderer.resetTextures(); - } - } - +GameObjectFactory.register('text', function (x, y, text, style) +{ + return this.displayList.add(new Text(this.scene, x, y, text, style)); }); -module.exports = BitmapMaskPipeline; +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns /***/ }), -/* 374 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 80032: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @namespace Phaser.Renderer.WebGL.Pipelines.Events - */ +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(76128); +} + +if (true) +{ + renderCanvas = __webpack_require__(71649); +} module.exports = { - AFTER_FLUSH: __webpack_require__(868), - BEFORE_FLUSH: __webpack_require__(869), - BIND: __webpack_require__(870), - BOOT: __webpack_require__(871), - DESTROY: __webpack_require__(872), - REBIND: __webpack_require__(873), - RESIZE: __webpack_require__(874) + renderWebGL: renderWebGL, + renderCanvas: renderCanvas }; /***/ }), -/* 375 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 74744: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); -var WEBGL_CONST = __webpack_require__(107); +var Class = __webpack_require__(56694); +var GetAdvancedValue = __webpack_require__(20494); +var GetValue = __webpack_require__(10850); +var MeasureText = __webpack_require__(27030); + +// Key: [ Object Key, Default Value ] + +var propertyMap = { + fontFamily: [ 'fontFamily', 'Courier' ], + fontSize: [ 'fontSize', '16px' ], + fontStyle: [ 'fontStyle', '' ], + backgroundColor: [ 'backgroundColor', null ], + color: [ 'color', '#fff' ], + stroke: [ 'stroke', '#fff' ], + strokeThickness: [ 'strokeThickness', 0 ], + shadowOffsetX: [ 'shadow.offsetX', 0 ], + shadowOffsetY: [ 'shadow.offsetY', 0 ], + shadowColor: [ 'shadow.color', '#000' ], + shadowBlur: [ 'shadow.blur', 0 ], + shadowStroke: [ 'shadow.stroke', false ], + shadowFill: [ 'shadow.fill', false ], + align: [ 'align', 'left' ], + maxLines: [ 'maxLines', 0 ], + fixedWidth: [ 'fixedWidth', 0 ], + fixedHeight: [ 'fixedHeight', 0 ], + resolution: [ 'resolution', 0 ], + rtl: [ 'rtl', false ], + testString: [ 'testString', '|MÉqgy' ], + baselineX: [ 'baselineX', 1.2 ], + baselineY: [ 'baselineY', 1.4 ], + wordWrapWidth: [ 'wordWrap.width', null ], + wordWrapCallback: [ 'wordWrap.callback', null ], + wordWrapCallbackScope: [ 'wordWrap.callbackScope', null ], + wordWrapUseAdvanced: [ 'wordWrap.useAdvancedWrap', false ] +}; /** * @classdesc - * Instances of the WebGLShader class belong to the WebGL Pipeline classes. When the pipeline is - * created it will create an instance of this class for each one of its shaders, as defined in - * the pipeline configuration. - * - * This class encapsulates everything needed to manage a shader in a pipeline, including the - * shader attributes and uniforms, as well as lots of handy methods such as `set2f`, for setting - * uniform values on this shader. + * A TextStyle class manages all of the style settings for a Text object. * - * Typically, you do not create an instance of this class directly, as it works in unison with - * the pipeline to which it belongs. You can gain access to this class via a pipeline's `shaders` - * array, post-creation. + * Text Game Objects create a TextStyle instance automatically, which is + * accessed via the `Text.style` property. You do not normally need to + * instantiate one yourself. * - * @class WebGLShader - * @memberof Phaser.Renderer.WebGL + * @class TextStyle + * @memberof Phaser.GameObjects * @constructor - * @since 3.50.0 + * @since 3.0.0 * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The WebGLPipeline to which this Shader belongs. - * @param {string} name - The name of this Shader. - * @param {string} vertexShader - The vertex shader source code as a single string. - * @param {string} fragmentShader - The fragment shader source code as a single string. - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineAttributeConfig[]} attributes - An array of attributes. + * @param {Phaser.GameObjects.Text} text - The Text object that this TextStyle is styling. + * @param {Phaser.Types.GameObjects.Text.TextStyle} style - The style settings to set. */ -var WebGLShader = new Class({ +var TextStyle = new Class({ initialize: - function WebGLShader (pipeline, name, vertexShader, fragmentShader, attributes) + function TextStyle (text, style) { /** - * A reference to the WebGLPipeline that owns this Shader. + * The Text object that this TextStyle is styling. * - * A Shader class can only belong to a single pipeline. + * @name Phaser.GameObjects.TextStyle#parent + * @type {Phaser.GameObjects.Text} + * @since 3.0.0 + */ + this.parent = text; + + /** + * The font family. * - * @name Phaser.Renderer.WebGL.WebGLShader#pipeline - * @type {Phaser.Renderer.WebGL.WebGLPipeline} - * @since 3.50.0 + * @name Phaser.GameObjects.TextStyle#fontFamily + * @type {string} + * @default 'Courier' + * @since 3.0.0 */ - this.pipeline = pipeline; + this.fontFamily; /** - * The name of this shader. + * The font size. * - * @name Phaser.Renderer.WebGL.WebGLShader#name + * @name Phaser.GameObjects.TextStyle#fontSize + * @type {(string|number)} + * @default '16px' + * @since 3.0.0 + */ + this.fontSize; + + /** + * The font style. + * + * @name Phaser.GameObjects.TextStyle#fontStyle * @type {string} - * @since 3.50.0 + * @since 3.0.0 */ - this.name = name; + this.fontStyle; /** - * A reference to the WebGLRenderer instance. + * The background color. * - * @name Phaser.Renderer.WebGL.WebGLShader#renderer - * @type {Phaser.Renderer.WebGL.WebGLRenderer} - * @since 3.50.0 + * @name Phaser.GameObjects.TextStyle#backgroundColor + * @type {string} + * @since 3.0.0 */ - this.renderer = pipeline.renderer; + this.backgroundColor; /** - * A reference to the WebGL Rendering Context the WebGL Renderer is using. + * The text fill color. * - * @name Phaser.Renderer.WebGL.WebGLShader#gl - * @type {WebGLRenderingContext} - * @since 3.50.0 + * @name Phaser.GameObjects.TextStyle#color + * @type {string} + * @default '#fff' + * @since 3.0.0 */ - this.gl = this.renderer.gl; + this.color; /** - * The WebGLProgram created from the vertex and fragment shaders. + * The text stroke color. * - * @name Phaser.Renderer.WebGL.WebGLShader#program - * @type {WebGLProgram} - * @since 3.50.0 + * @name Phaser.GameObjects.TextStyle#stroke + * @type {string} + * @default '#fff' + * @since 3.0.0 */ - this.program = this.renderer.createProgram(vertexShader, fragmentShader); + this.stroke; /** - * Array of objects that describe the vertex attributes. + * The text stroke thickness. * - * @name Phaser.Renderer.WebGL.WebGLShader#attributes - * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineAttribute[]} - * @since 3.50.0 + * @name Phaser.GameObjects.TextStyle#strokeThickness + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.attributes; + this.strokeThickness; /** - * The amount of vertex attribute components of 32 bit length. + * The horizontal shadow offset. * - * @name Phaser.Renderer.WebGL.WebGLShader#vertexComponentCount + * @name Phaser.GameObjects.TextStyle#shadowOffsetX * @type {number} - * @since 3.50.0 + * @default 0 + * @since 3.0.0 */ - this.vertexComponentCount = 0; + this.shadowOffsetX; /** - * The size, in bytes, of a single vertex. + * The vertical shadow offset. * - * This is derived by adding together all of the vertex attributes. + * @name Phaser.GameObjects.TextStyle#shadowOffsetY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.shadowOffsetY; + + /** + * The shadow color. * - * For example, the Multi Pipeline has the following attributes: + * @name Phaser.GameObjects.TextStyle#shadowColor + * @type {string} + * @default '#000' + * @since 3.0.0 + */ + this.shadowColor; + + /** + * The shadow blur radius. * - * inPosition - (size 2 x gl.FLOAT) = 8 - * inTexCoord - (size 2 x gl.FLOAT) = 8 - * inTexId - (size 1 x gl.FLOAT) = 4 - * inTintEffect - (size 1 x gl.FLOAT) = 4 - * inTint - (size 4 x gl.UNSIGNED_BYTE) = 4 + * @name Phaser.GameObjects.TextStyle#shadowBlur + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.shadowBlur; + + /** + * Whether shadow stroke is enabled or not. * - * The total, in this case, is 8 + 8 + 4 + 4 + 4 = 28. + * @name Phaser.GameObjects.TextStyle#shadowStroke + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.shadowStroke; + + /** + * Whether shadow fill is enabled or not. * - * This is calculated automatically during the `createAttributes` method. + * @name Phaser.GameObjects.TextStyle#shadowFill + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.shadowFill; + + /** + * The text alignment. * - * @name Phaser.Renderer.WebGL.WebGLShader#vertexSize + * @name Phaser.GameObjects.TextStyle#align + * @type {string} + * @default 'left' + * @since 3.0.0 + */ + this.align; + + /** + * The maximum number of lines to draw. + * + * @name Phaser.GameObjects.TextStyle#maxLines * @type {number} - * @readonly - * @since 3.50.0 + * @default 0 + * @since 3.0.0 */ - this.vertexSize = 0; + this.maxLines; /** - * The active uniforms that this shader has. + * The fixed width of the text. * - * This is an object that maps the uniform names to their WebGL location and cached values. + * `0` means no fixed with. * - * It is populated automatically via the `createUniforms` method. + * @name Phaser.GameObjects.TextStyle#fixedWidth + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.fixedWidth; + + /** + * The fixed height of the text. * - * @name Phaser.Renderer.WebGL.WebGLShader#uniforms - * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineUniformsConfig} - * @since 3.50.0 + * `0` means no fixed height. + * + * @name Phaser.GameObjects.TextStyle#fixedHeight + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.uniforms = {}; + this.fixedHeight; - this.createAttributes(attributes); - this.createUniforms(); + /** + * The resolution the text is rendered to its internal canvas at. + * The default is 0, which means it will use the resolution set in the Game Config. + * + * @name Phaser.GameObjects.TextStyle#resolution + * @type {number} + * @default 0 + * @since 3.12.0 + */ + this.resolution; + + /** + * Whether the text should render right to left. + * + * @name Phaser.GameObjects.TextStyle#rtl + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.rtl; + + /** + * The test string to use when measuring the font. + * + * @name Phaser.GameObjects.TextStyle#testString + * @type {string} + * @default '|MÉqgy' + * @since 3.0.0 + */ + this.testString; + + /** + * The amount of horizontal padding added to the width of the text when calculating the font metrics. + * + * @name Phaser.GameObjects.TextStyle#baselineX + * @type {number} + * @default 1.2 + * @since 3.3.0 + */ + this.baselineX; + + /** + * The amount of vertical padding added to the height of the text when calculating the font metrics. + * + * @name Phaser.GameObjects.TextStyle#baselineY + * @type {number} + * @default 1.4 + * @since 3.3.0 + */ + this.baselineY; + + /** + * The maximum width of a line of text in pixels. Null means no line wrapping. Setting this + * property directly will not re-run the word wrapping algorithm. To change the width and + * re-wrap, use {@link Phaser.GameObjects.TextStyle#setWordWrapWidth}. + * + * @name Phaser.GameObjects.TextStyle#wordWrapWidth + * @type {number | null} + * @default null + * @since 3.24.0 + */ + this.wordWrapWidth; + + /** + * A custom function that will be responsible for wrapping the text. It will receive two + * arguments: text (the string to wrap), textObject (this Text instance). It should return + * the wrapped lines either as an array of lines or as a string with newline characters in + * place to indicate where breaks should happen. Setting this directly will not re-run the + * word wrapping algorithm. To change the callback and re-wrap, use + * {@link Phaser.GameObjects.TextStyle#setWordWrapCallback}. + * + * @name Phaser.GameObjects.TextStyle#wordWrapCallback + * @type {TextStyleWordWrapCallback | null} + * @default null + * @since 3.24.0 + */ + this.wordWrapCallback; + + /** + * The scope that will be applied when the wordWrapCallback is invoked. Setting this directly will not re-run the + * word wrapping algorithm. To change the callback and re-wrap, use + * {@link Phaser.GameObjects.TextStyle#setWordWrapCallback}. + * + * @name Phaser.GameObjects.TextStyle#wordWrapCallbackScope + * @type {object | null} + * @default null + * @since 3.24.0 + */ + this.wordWrapCallbackScope; + + /** + * Whether or not to use the advanced wrapping algorithm. If true, spaces are collapsed and + * whitespace is trimmed from lines. If false, spaces and whitespace are left as is. Setting + * this property directly will not re-run the word wrapping algorithm. To change the + * advanced setting and re-wrap, use {@link Phaser.GameObjects.TextStyle#setWordWrapWidth}. + * + * @name Phaser.GameObjects.TextStyle#wordWrapUseAdvanced + * @type {boolean} + * @default false + * @since 3.24.0 + */ + this.wordWrapUseAdvanced; + + /** + * The font style, size and family. + * + * @name Phaser.GameObjects.TextStyle#_font + * @type {string} + * @private + * @since 3.0.0 + */ + this._font; + + // Set to defaults + user style + this.setStyle(style, false, true); }, /** - * Takes the vertex attributes config and parses it, creating the resulting array that is stored - * in this shaders `attributes` property, calculating the offset, normalization and location - * in the process. + * Set the text style. * - * Calling this method resets `WebGLShader.attributes`, `WebGLShader.vertexSize` and - * `WebGLShader.vertexComponentCount`. + * @example + * text.setStyle({ + * fontSize: '64px', + * fontFamily: 'Arial', + * color: '#ffffff', + * align: 'center', + * backgroundColor: '#ff00ff' + * }); * - * It is called automatically when this class is created, but can be called manually if required. + * @method Phaser.GameObjects.TextStyle#setStyle + * @since 3.0.0 * - * @method Phaser.Renderer.WebGL.WebGLShader#createAttributes - * @since 3.50.0 + * @param {Phaser.Types.GameObjects.Text.TextStyle} style - The style settings to set. + * @param {boolean} [updateText=true] - Whether to update the text immediately. + * @param {boolean} [setDefaults=false] - Use the default values is not set, or the local values. * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineAttributeConfig[]} attributes - An array of attributes configs. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - createAttributes: function (attributes) + setStyle: function (style, updateText, setDefaults) { - var count = 0; - var offset = 0; - var result = []; - - this.vertexComponentCount = 0; + if (updateText === undefined) { updateText = true; } + if (setDefaults === undefined) { setDefaults = false; } - for (var i = 0; i < attributes.length; i++) + // Avoid type mutation + // eslint-disable-next-line no-prototype-builtins + if (style && style.hasOwnProperty('fontSize') && typeof style.fontSize === 'number') { - var element = attributes[i]; - - var name = element.name; - var size = GetFastValue(element, 'size', 1); // i.e. 1 for a float, 2 for a vec2, 4 for a vec4, etc - var glType = GetFastValue(element, 'type', WEBGL_CONST.FLOAT); - var type = glType.enum; // The GLenum - var typeSize = glType.size; // The size in bytes of the type - - var normalized = (element.normalized) ? true : false; + style.fontSize = style.fontSize.toString() + 'px'; + } - result.push({ - name: name, - size: size, - type: type, - normalized: normalized, - offset: offset, - enabled: false, - location: -1 - }); + for (var key in propertyMap) + { + var value = (setDefaults) ? propertyMap[key][1] : this[key]; - if (typeSize === 4) + if (key === 'wordWrapCallback' || key === 'wordWrapCallbackScope') { - count += size; + // Callback & scope should be set without processing the values + this[key] = GetValue(style, propertyMap[key][0], value); } else { - count++; + this[key] = GetAdvancedValue(style, propertyMap[key][0], value); } + } - offset += size * typeSize; + // Allow for 'font' override + var font = GetValue(style, 'font', null); + + if (font !== null) + { + this.setFont(font, false); } - this.vertexSize = offset; - this.vertexComponentCount = count; - this.attributes = result; - }, + this._font = [ this.fontStyle, this.fontSize, this.fontFamily ].join(' ').trim(); - /** - * Sets the program this shader uses as being the active shader in the WebGL Renderer. - * - * This method is called every time the parent pipeline is made the current active pipeline. - * - * @method Phaser.Renderer.WebGL.WebGLShader#bind - * @since 3.50.0 - * - * @param {boolean} [setAttributes=false] - Should the vertex attribute pointers be set? - * @param {boolean} [flush=false] - Flush the pipeline before binding this shader? - * - * @return {this} This WebGLShader instance. - */ - bind: function (setAttributes, flush) - { - if (setAttributes === undefined) { setAttributes = false; } - if (flush === undefined) { flush = false; } + // Allow for 'fill' to be used in place of 'color' + var fill = GetValue(style, 'fill', null); - if (flush) + if (fill !== null) { - this.pipeline.flush(); + this.color = fill; } - this.renderer.setProgram(this.program); + var metrics = GetValue(style, 'metrics', false); - if (setAttributes) + // Provide optional TextMetrics in the style object to avoid the canvas look-up / scanning + // Doing this is reset if you then change the font of this TextStyle after creation + if (metrics) { - this.setAttribPointers(); + this.metrics = { + ascent: GetValue(metrics, 'ascent', 0), + descent: GetValue(metrics, 'descent', 0), + fontSize: GetValue(metrics, 'fontSize', 0) + }; + } + else if (updateText || !this.metrics) + { + this.metrics = MeasureText(this); } - return this; + if (updateText) + { + return this.parent.updateText(); + } + else + { + return this.parent; + } }, /** - * Sets the program this shader uses as being the active shader in the WebGL Renderer. + * Synchronize the font settings to the given Canvas Rendering Context. * - * Then resets all of the attribute pointers. + * @method Phaser.GameObjects.TextStyle#syncFont + * @since 3.0.0 * - * @method Phaser.Renderer.WebGL.WebGLShader#rebind - * @since 3.50.0 + * @param {HTMLCanvasElement} canvas - The Canvas Element. + * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. + */ + syncFont: function (canvas, context) + { + context.font = this._font; + }, + + /** + * Synchronize the text style settings to the given Canvas Rendering Context. * - * @return {this} This WebGLShader instance. + * @method Phaser.GameObjects.TextStyle#syncStyle + * @since 3.0.0 + * + * @param {HTMLCanvasElement} canvas - The Canvas Element. + * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. */ - rebind: function () + syncStyle: function (canvas, context) { - this.renderer.setProgram(this.program); + context.textBaseline = 'alphabetic'; - this.setAttribPointers(true); + context.fillStyle = this.color; + context.strokeStyle = this.stroke; - return this; + context.lineWidth = this.strokeThickness; + context.lineCap = 'round'; + context.lineJoin = 'round'; }, /** - * Sets the vertex attribute pointers. - * - * This should only be called after the vertex buffer has been bound. - * - * It is called automatically during the `bind` method. - * - * @method Phaser.Renderer.WebGL.WebGLShader#setAttribPointers - * @since 3.50.0 + * Synchronize the shadow settings to the given Canvas Rendering Context. * - * @param {boolean} [reset=false] - Reset the vertex attribute locations? + * @method Phaser.GameObjects.TextStyle#syncShadow + * @since 3.0.0 * - * @return {this} This WebGLShader instance. + * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. + * @param {boolean} enabled - Whether shadows are enabled or not. */ - setAttribPointers: function (reset) + syncShadow: function (context, enabled) { - if (reset === undefined) { reset = false; } - - var gl = this.gl; - var vertexSize = this.vertexSize; - var attributes = this.attributes; - var program = this.program; - - for (var i = 0; i < attributes.length; i++) + if (enabled) { - var element = attributes[i]; - - var size = element.size; - var type = element.type; - var offset = element.offset; - var enabled = element.enabled; - var location = element.location; - var normalized = (element.normalized) ? true : false; - - if (reset) - { - var attribLocation = gl.getAttribLocation(program, element.name); - - if (attribLocation >= 0) - { - gl.enableVertexAttribArray(attribLocation); - - gl.vertexAttribPointer(attribLocation, size, type, normalized, vertexSize, offset); - - element.enabled = true; - element.location = attribLocation; - } - else if (attribLocation !== -1) - { - gl.disableVertexAttribArray(attribLocation); - } - } - else if (enabled) - { - gl.vertexAttribPointer(location, size, type, normalized, vertexSize, offset); - } - else if (!enabled && location > -1) - { - gl.disableVertexAttribArray(location); - - element.location = -1; - } + context.shadowOffsetX = this.shadowOffsetX; + context.shadowOffsetY = this.shadowOffsetY; + context.shadowColor = this.shadowColor; + context.shadowBlur = this.shadowBlur; + } + else + { + context.shadowOffsetX = 0; + context.shadowOffsetY = 0; + context.shadowColor = 0; + context.shadowBlur = 0; } - - return this; }, /** - * Sets up the `WebGLShader.uniforms` object, populating it with the names - * and locations of the shader uniforms this shader requires. - * - * It works by first calling `gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS)` to - * find out how many active uniforms this shader has. It then iterates through them, - * calling `gl.getActiveUniform` to get the WebGL Active Info from each one. Finally, - * the name and location are stored in the local array. + * Update the style settings for the parent Text object. * - * This method is called automatically when this class is created. + * @method Phaser.GameObjects.TextStyle#update + * @since 3.0.0 * - * @method Phaser.Renderer.WebGL.WebGLShader#createUniforms - * @since 3.50.0 + * @param {boolean} recalculateMetrics - Whether to recalculate font and text metrics. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - createUniforms: function () + update: function (recalculateMetrics) { - var gl = this.gl; - var program = this.program; - var uniforms = this.uniforms; - - var i; - var name; - var location; - - // Look-up all active uniforms - - var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); - - for (i = 0; i < totalUniforms; i++) + if (recalculateMetrics) { - var info = gl.getActiveUniform(program, i); - - if (info) - { - name = info.name; - - location = gl.getUniformLocation(program, name); - - if (location !== null) - { - uniforms[name] = - { - name: name, - location: location, - value1: null, - value2: null, - value3: null, - value4: null - }; - } - - // If the uniform name contains [] for an array struct, - // we'll add an entry for the non-struct name as well. - // Such as uMainSampler[12] = uMainSampler - - var struct = name.indexOf('['); - - if (struct > 0) - { - name = name.substr(0, struct); - - if (!uniforms.hasOwnProperty(name)) - { - location = gl.getUniformLocation(program, name); + this._font = [ this.fontStyle, this.fontSize, this.fontFamily ].join(' ').trim(); - if (location !== null) - { - uniforms[name] = - { - name: name, - location: location, - value1: null, - value2: null, - value3: null, - value4: null - }; - } - } - } - } + this.metrics = MeasureText(this); } - return this; + return this.parent.updateText(); }, /** - * Checks to see if the given uniform name exists and is active in this shader. - * - * @method Phaser.Renderer.WebGL.WebGLShader#hasUniform - * @since 3.50.0 + * Set the font. * - * @param {string} name - The name of the uniform to check for. + * If a string is given, the font family is set. * - * @return {boolean} `true` if the uniform exists, otherwise `false`. - */ - hasUniform: function (name) - { - return this.uniforms.hasOwnProperty(name); - }, - - /** - * Resets the cached values of the given uniform. + * If an object is given, the `fontFamily`, `fontSize` and `fontStyle` + * properties of that object are set. * - * @method Phaser.Renderer.WebGL.WebGLShader#resetUniform - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setFont + * @since 3.0.0 * - * @param {string} name - The name of the uniform to reset. + * @param {(string|object)} font - The font family or font settings to set. + * @param {boolean} [updateText=true] - Whether to update the text immediately. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - resetUniform: function (name) + setFont: function (font, updateText) { - var uniform = this.uniforms[name]; + if (updateText === undefined) { updateText = true; } - if (uniform) + var fontFamily = font; + var fontSize = ''; + var fontStyle = ''; + + if (typeof font !== 'string') { - uniform.value1 = null; - uniform.value2 = null; - uniform.value3 = null; - uniform.value4 = null; + fontFamily = GetValue(font, 'fontFamily', 'Courier'); + fontSize = GetValue(font, 'fontSize', '16px'); + fontStyle = GetValue(font, 'fontStyle', ''); } + else + { + var fontSplit = font.split(' '); - return this; - }, - - /** - * Sets the given uniform value/s based on the name and GL function. - * - * This method is called internally by other methods such as `set1f` and `set3iv`. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. - * - * @method Phaser.Renderer.WebGL.WebGLShader#setUniform1 - * @since 3.50.0 - * - * @param {function} setter - The GL function to call. - * @param {string} name - The name of the uniform to set. - * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. - * @param {boolean} [skipCheck=false] - Skip the value comparison? - * - * @return {this} This WebGLShader instance. - */ - setUniform1: function (setter, name, value1, skipCheck) - { - var uniform = this.uniforms[name]; + var i = 0; - if (!uniform) - { - return this; + fontStyle = (fontSplit.length > 2) ? fontSplit[i++] : ''; + fontSize = fontSplit[i++] || '16px'; + fontFamily = fontSplit[i++] || 'Courier'; } - if (skipCheck || uniform.value1 !== value1) + if (fontFamily !== this.fontFamily || fontSize !== this.fontSize || fontStyle !== this.fontStyle) { - uniform.value1 = value1; - - this.renderer.setProgram(this.program); - - setter.call(this.gl, uniform.location, value1); + this.fontFamily = fontFamily; + this.fontSize = fontSize; + this.fontStyle = fontStyle; - this.pipeline.currentShader = this; + if (updateText) + { + this.update(true); + } } - return this; + return this.parent; }, /** - * Sets the given uniform value/s based on the name and GL function. - * - * This method is called internally by other methods such as `set1f` and `set3iv`. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Set the font family. * - * @method Phaser.Renderer.WebGL.WebGLShader#setUniform2 - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setFontFamily + * @since 3.0.0 * - * @param {function} setter - The GL function to call. - * @param {string} name - The name of the uniform to set. - * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. - * @param {(boolean|number|number[]|Float32Array)} value2 - The new value of the uniform. - * @param {boolean} [skipCheck=false] - Skip the value comparison? + * @param {string} family - The font family. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - setUniform2: function (setter, name, value1, value2, skipCheck) + setFontFamily: function (family) { - var uniform = this.uniforms[name]; - - if (!uniform) - { - return this; - } - - if (skipCheck || uniform.value1 !== value1 || uniform.value2 !== value2) + if (this.fontFamily !== family) { - uniform.value1 = value1; - uniform.value2 = value2; - - this.renderer.setProgram(this.program); - - setter.call(this.gl, uniform.location, value1, value2); + this.fontFamily = family; - this.pipeline.currentShader = this; + this.update(true); } - return this; + return this.parent; }, /** - * Sets the given uniform value/s based on the name and GL function. - * - * This method is called internally by other methods such as `set1f` and `set3iv`. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Set the font style. * - * @method Phaser.Renderer.WebGL.WebGLShader#setUniform3 - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setFontStyle + * @since 3.0.0 * - * @param {function} setter - The GL function to call. - * @param {string} name - The name of the uniform to set. - * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. - * @param {(boolean|number|number[]|Float32Array)} value2 - The new value of the uniform. - * @param {(boolean|number|number[]|Float32Array)} value3 - The new value of the uniform. - * @param {boolean} [skipCheck=false] - Skip the value comparison? + * @param {string} style - The font style. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - setUniform3: function (setter, name, value1, value2, value3, skipCheck) + setFontStyle: function (style) { - var uniform = this.uniforms[name]; - - if (!uniform) - { - return this; - } - - if (skipCheck || uniform.value1 !== value1 || uniform.value2 !== value2 || uniform.value3 !== value3) + if (this.fontStyle !== style) { - uniform.value1 = value1; - uniform.value2 = value2; - uniform.value3 = value3; - - this.renderer.setProgram(this.program); - - setter.call(this.gl, uniform.location, value1, value2, value3); + this.fontStyle = style; - this.pipeline.currentShader = this; + this.update(true); } - return this; + return this.parent; }, /** - * Sets the given uniform value/s based on the name and GL function. - * - * This method is called internally by other methods such as `set1f` and `set3iv`. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Set the font size. Can be a string with a valid CSS unit, i.e. `16px`, or a number. * - * @method Phaser.Renderer.WebGL.WebGLShader#setUniform4 - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setFontSize + * @since 3.0.0 * - * @param {function} setter - The GL function to call. - * @param {string} name - The name of the uniform to set. - * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. - * @param {(boolean|number|number[]|Float32Array)} value2 - The new value of the uniform. - * @param {(boolean|number|number[]|Float32Array)} value3 - The new value of the uniform. - * @param {(boolean|number|number[]|Float32Array)} value4 - The new value of the uniform. - * @param {boolean} [skipCheck=false] - Skip the value comparison? + * @param {(number|string)} size - The font size. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - setUniform4: function (setter, name, value1, value2, value3, value4, skipCheck) + setFontSize: function (size) { - var uniform = this.uniforms[name]; - - if (!uniform) + if (typeof size === 'number') { - return this; + size = size.toString() + 'px'; } - if (skipCheck || uniform.value1 !== value1 || uniform.value2 !== value2 || uniform.value3 !== value3 || uniform.value4 !== value4) + if (this.fontSize !== size) { - uniform.value1 = value1; - uniform.value2 = value2; - uniform.value3 = value3; - uniform.value4 = value4; - - this.renderer.setProgram(this.program); - - setter.call(this.gl, uniform.location, value1, value2, value3, value4); + this.fontSize = size; - this.pipeline.currentShader = this; + this.update(true); } - return this; + return this.parent; }, /** - * Sets a 1f uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Set the test string to use when measuring the font. * - * @method Phaser.Renderer.WebGL.WebGLShader#set1f - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setTestString + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number} x - The new value of the `float` uniform. + * @param {string} string - The test string to use when measuring the font. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set1f: function (name, x) + setTestString: function (string) { - return this.setUniform1(this.gl.uniform1f, name, x); + this.testString = string; + + return this.update(true); }, /** - * Sets a 2f uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. + * Set a fixed width and height for the text. * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Pass in `0` for either of these parameters to disable fixed width or height respectively. * - * @method Phaser.Renderer.WebGL.WebGLShader#set2f - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setFixedSize + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number} x - The new X component of the `vec2` uniform. - * @param {number} y - The new Y component of the `vec2` uniform. + * @param {number} width - The fixed width to set. + * @param {number} height - The fixed height to set. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set2f: function (name, x, y) + setFixedSize: function (width, height) { - return this.setUniform2(this.gl.uniform2f, name, x, y); + this.fixedWidth = width; + this.fixedHeight = height; + + if (width) + { + this.parent.width = width; + } + + if (height) + { + this.parent.height = height; + } + + return this.update(false); }, /** - * Sets a 3f uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Set the background color. * - * @method Phaser.Renderer.WebGL.WebGLShader#set3f - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setBackgroundColor + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number} x - The new X component of the `vec3` uniform. - * @param {number} y - The new Y component of the `vec3` uniform. - * @param {number} z - The new Z component of the `vec3` uniform. + * @param {string} color - The background color. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set3f: function (name, x, y, z) + setBackgroundColor: function (color) { - return this.setUniform3(this.gl.uniform3f, name, x, y, z); + this.backgroundColor = color; + + return this.update(false); }, /** - * Sets a 4f uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Set the text fill color. * - * @method Phaser.Renderer.WebGL.WebGLShader#set4f - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setFill + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number} x - X component of the uniform - * @param {number} y - Y component of the uniform - * @param {number} z - Z component of the uniform - * @param {number} w - W component of the uniform + * @param {string} color - The text fill color. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set4f: function (name, x, y, z, w) + setFill: function (color) { - return this.setUniform4(this.gl.uniform4f, name, x, y, z, w); + this.color = color; + + return this.update(false); }, /** - * Sets a 1fv uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Set the text fill color. * - * @method Phaser.Renderer.WebGL.WebGLShader#set1fv - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setColor + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {string} color - The text fill color. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set1fv: function (name, arr) + setColor: function (color) { - return this.setUniform1(this.gl.uniform1fv, name, arr, true); + this.color = color; + + return this.update(false); }, /** - * Sets a 2fv uniform value based on the given name on this shader. + * Set the resolution used by the Text object. * - * The uniform is only set if the value/s given are different to those previously set. + * By default it will be set to match the resolution set in the Game Config, + * but you can override it via this method. It allows for much clearer text on High DPI devices, + * at the cost of memory because it uses larger internal Canvas textures for the Text. * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Please use with caution, as the more high res Text you have, the more memory it uses up. * - * @method Phaser.Renderer.WebGL.WebGLShader#set2fv - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setResolution + * @since 3.12.0 * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {number} value - The resolution for this Text object to use. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set2fv: function (name, arr) + setResolution: function (value) { - return this.setUniform1(this.gl.uniform2fv, name, arr, true); + this.resolution = value; + + return this.update(false); }, /** - * Sets a 3fv uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Set the stroke settings. * - * @method Phaser.Renderer.WebGL.WebGLShader#set3fv - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setStroke + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {string} color - The stroke color. + * @param {number} thickness - The stroke thickness. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set3fv: function (name, arr) + setStroke: function (color, thickness) { - return this.setUniform1(this.gl.uniform3fv, name, arr, true); + if (thickness === undefined) { thickness = this.strokeThickness; } + + if (color === undefined && this.strokeThickness !== 0) + { + // Reset the stroke to zero (disabling it) + this.strokeThickness = 0; + + this.update(true); + } + else if (this.stroke !== color || this.strokeThickness !== thickness) + { + this.stroke = color; + this.strokeThickness = thickness; + + this.update(true); + } + + return this.parent; }, /** - * Sets a 4fv uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. + * Set the shadow settings. * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Calling this method always re-measures the parent Text object, + * so only call it when you actually change the shadow settings. * - * @method Phaser.Renderer.WebGL.WebGLShader#set4fv - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setShadow + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {number} [x=0] - The horizontal shadow offset. + * @param {number} [y=0] - The vertical shadow offset. + * @param {string} [color='#000'] - The shadow color. + * @param {number} [blur=0] - The shadow blur radius. + * @param {boolean} [shadowStroke=false] - Whether to stroke the shadow. + * @param {boolean} [shadowFill=true] - Whether to fill the shadow. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set4fv: function (name, arr) + setShadow: function (x, y, color, blur, shadowStroke, shadowFill) { - return this.setUniform1(this.gl.uniform4fv, name, arr, true); + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (color === undefined) { color = '#000'; } + if (blur === undefined) { blur = 0; } + if (shadowStroke === undefined) { shadowStroke = false; } + if (shadowFill === undefined) { shadowFill = true; } + + this.shadowOffsetX = x; + this.shadowOffsetY = y; + this.shadowColor = color; + this.shadowBlur = blur; + this.shadowStroke = shadowStroke; + this.shadowFill = shadowFill; + + return this.update(false); }, /** - * Sets a 1iv uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Set the shadow offset. * - * @method Phaser.Renderer.WebGL.WebGLShader#set1iv - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setShadowOffset + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {number} [x=0] - The horizontal shadow offset. + * @param {number} [y=0] - The vertical shadow offset. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set1iv: function (name, arr) + setShadowOffset: function (x, y) { - return this.setUniform1(this.gl.uniform1iv, name, arr, true); + if (x === undefined) { x = 0; } + if (y === undefined) { y = x; } + + this.shadowOffsetX = x; + this.shadowOffsetY = y; + + return this.update(false); }, /** - * Sets a 2iv uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Set the shadow color. * - * @method Phaser.Renderer.WebGL.WebGLShader#set2iv - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setShadowColor + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {string} [color='#000'] - The shadow color. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set2iv: function (name, arr) + setShadowColor: function (color) { - return this.setUniform1(this.gl.uniform2iv, name, arr, true); + if (color === undefined) { color = '#000'; } + + this.shadowColor = color; + + return this.update(false); }, /** - * Sets a 3iv uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Set the shadow blur radius. * - * @method Phaser.Renderer.WebGL.WebGLShader#set3iv - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setShadowBlur + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {number} [blur=0] - The shadow blur radius. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set3iv: function (name, arr) + setShadowBlur: function (blur) { - return this.setUniform1(this.gl.uniform3iv, name, arr, true); + if (blur === undefined) { blur = 0; } + + this.shadowBlur = blur; + + return this.update(false); }, /** - * Sets a 4iv uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Enable or disable shadow stroke. * - * @method Phaser.Renderer.WebGL.WebGLShader#set4iv - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setShadowStroke + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {boolean} enabled - Whether shadow stroke is enabled or not. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set4iv: function (name, arr) + setShadowStroke: function (enabled) { - return this.setUniform1(this.gl.uniform4iv, name, arr, true); + this.shadowStroke = enabled; + + return this.update(false); }, /** - * Sets a 1i uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Enable or disable shadow fill. * - * @method Phaser.Renderer.WebGL.WebGLShader#set1i - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setShadowFill + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number} x - The new value of the `int` uniform. + * @param {boolean} enabled - Whether shadow fill is enabled or not. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set1i: function (name, x) + setShadowFill: function (enabled) { - return this.setUniform1(this.gl.uniform1i, name, x); + this.shadowFill = enabled; + + return this.update(false); }, /** - * Sets a 2i uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. + * Set the width (in pixels) to use for wrapping lines. * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Pass in null to remove wrapping by width. * - * @method Phaser.Renderer.WebGL.WebGLShader#set2i - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setWordWrapWidth + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number} x - The new X component of the `ivec2` uniform. - * @param {number} y - The new Y component of the `ivec2` uniform. + * @param {number} width - The maximum width of a line in pixels. Set to null to remove wrapping. + * @param {boolean} [useAdvancedWrap=false] - Whether or not to use the advanced wrapping + * algorithm. If true, spaces are collapsed and whitespace is trimmed from lines. If false, + * spaces and whitespace are left as is. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set2i: function (name, x, y) + setWordWrapWidth: function (width, useAdvancedWrap) { - return this.setUniform2(this.gl.uniform2i, name, x, y); + if (useAdvancedWrap === undefined) { useAdvancedWrap = false; } + + this.wordWrapWidth = width; + this.wordWrapUseAdvanced = useAdvancedWrap; + + return this.update(false); }, /** - * Sets a 3i uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. + * Set a custom callback for wrapping lines. * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Pass in null to remove wrapping by callback. * - * @method Phaser.Renderer.WebGL.WebGLShader#set3i - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setWordWrapCallback + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number} x - The new X component of the `ivec3` uniform. - * @param {number} y - The new Y component of the `ivec3` uniform. - * @param {number} z - The new Z component of the `ivec3` uniform. + * @param {TextStyleWordWrapCallback} callback - A custom function that will be responsible for wrapping the + * text. It will receive two arguments: text (the string to wrap), textObject (this Text + * instance). It should return the wrapped lines either as an array of lines or as a string with + * newline characters in place to indicate where breaks should happen. + * @param {object} [scope=null] - The scope that will be applied when the callback is invoked. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set3i: function (name, x, y, z) + setWordWrapCallback: function (callback, scope) { - return this.setUniform3(this.gl.uniform3i, name, x, y, z); + if (scope === undefined) { scope = null; } + + this.wordWrapCallback = callback; + this.wordWrapCallbackScope = scope; + + return this.update(false); }, /** - * Sets a 4i uniform value based on the given name on this shader. + * Set the alignment of the text in this Text object. * - * The uniform is only set if the value/s given are different to those previously set. + * The argument can be one of: `left`, `right`, `center` or `justify`. * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Alignment only works if the Text object has more than one line of text. * - * @method Phaser.Renderer.WebGL.WebGLShader#set4i - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setAlign + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {number} x - X component of the uniform - * @param {number} y - Y component of the uniform - * @param {number} z - Z component of the uniform - * @param {number} w - W component of the uniform + * @param {string} [align='left'] - The text alignment for multi-line text. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - set4i: function (name, x, y, z, w) + setAlign: function (align) { - return this.setUniform4(this.gl.uniform4i, name, x, y, z, w); + if (align === undefined) { align = 'left'; } + + this.align = align; + + return this.update(false); }, /** - * Sets a matrix 2fv uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. + * Set the maximum number of lines to draw. * - * @method Phaser.Renderer.WebGL.WebGLShader#setMatrix2fv - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#setMaxLines + * @since 3.0.0 * - * @param {string} name - The name of the uniform to set. - * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. - * @param {number[]|Float32Array} matrix - The new values for the `mat2` uniform. + * @param {number} [max=0] - The maximum number of lines to draw. * - * @return {this} This WebGLShader instance. + * @return {Phaser.GameObjects.Text} The parent Text object. */ - setMatrix2fv: function (name, transpose, matrix) + setMaxLines: function (max) { - return this.setUniform2(this.gl.uniformMatrix2fv, name, transpose, matrix, true); + if (max === undefined) { max = 0; } + + this.maxLines = max; + + return this.update(false); }, /** - * Sets a matrix 3fv uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. - * - * @method Phaser.Renderer.WebGL.WebGLShader#setMatrix3fv - * @since 3.50.0 + * Get the current text metrics. * - * @param {string} name - The name of the uniform to set. - * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. - * @param {Float32Array} matrix - The new values for the `mat3` uniform. + * @method Phaser.GameObjects.TextStyle#getTextMetrics + * @since 3.0.0 * - * @return {this} This WebGLShader instance. + * @return {Phaser.Types.GameObjects.Text.TextMetrics} The text metrics. */ - setMatrix3fv: function (name, transpose, matrix) + getTextMetrics: function () { - return this.setUniform2(this.gl.uniformMatrix3fv, name, transpose, matrix, true); + var metrics = this.metrics; + + return { + ascent: metrics.ascent, + descent: metrics.descent, + fontSize: metrics.fontSize + }; }, /** - * Sets a matrix 4fv uniform value based on the given name on this shader. - * - * The uniform is only set if the value/s given are different to those previously set. - * - * This method works by first setting this shader as being the current shader within the - * WebGL Renderer, if it isn't already. It also sets this shader as being the current - * one within the pipeline it belongs to. - * - * @method Phaser.Renderer.WebGL.WebGLShader#setMatrix4fv - * @since 3.50.0 + * Build a JSON representation of this Text Style. * - * @param {string} name - The name of the uniform to set. - * @param {boolean} transpose - Should the matrix be transpose - * @param {Float32Array} matrix - Matrix data + * @method Phaser.GameObjects.TextStyle#toJSON + * @since 3.0.0 * - * @return {this} This WebGLShader instance. + * @return {object} A JSON representation of this Text Style. */ - setMatrix4fv: function (name, transpose, matrix) + toJSON: function () { - return this.setUniform2(this.gl.uniformMatrix4fv, name, transpose, matrix, true); + var output = {}; + + for (var key in propertyMap) + { + output[key] = this[key]; + } + + output.metrics = this.getTextMetrics(); + + return output; }, /** - * Removes all external references from this class and deletes the WebGL program from the WebGL context. - * - * Does not remove this shader from the parent pipeline. + * Destroy this Text Style. * - * @method Phaser.Renderer.WebGL.WebGLShader#destroy - * @since 3.50.0 + * @method Phaser.GameObjects.TextStyle#destroy + * @since 3.0.0 */ destroy: function () { - this.gl.deleteProgram(this.program); - - this.pipeline = null; - this.renderer = null; - this.gl = null; - this.program = null; - this.attributes = null; - this.uniforms = null; + this.parent = undefined; } }); -module.exports = WebGLShader; +module.exports = TextStyle; /***/ }), -/* 376 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 76128: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Earcut = __webpack_require__(59); -var GetFastValue = __webpack_require__(2); -var ShaderSourceFS = __webpack_require__(875); -var ShaderSourceVS = __webpack_require__(876); -var TransformMatrix = __webpack_require__(25); -var WEBGL_CONST = __webpack_require__(107); -var WebGLPipeline = __webpack_require__(58); +var Utils = __webpack_require__(75512); /** - * @classdesc - * The Graphics Pipeline is the rendering pipeline used by Phaser in WebGL when drawing - * primitive geometry objects, such as the Graphics Game Object, or the Shape Game Objects - * such as Arc, Line, Rectangle and Star. It handles the preperation and batching of related vertices. - * - * Prior to Phaser v3.50 the functions of this pipeline were merged with the `TextureTintPipeline`. - * - * The fragment shader it uses can be found in `shaders/src/Graphics.frag`. - * The vertex shader it uses can be found in `shaders/src/Graphics.vert`. - * - * The default shader attributes for this pipeline are: - * - * `inPosition` (vec2) - * `inColor` (vec4, normalized) - * - * The default shader uniforms for this pipeline are: - * - * `uProjectionMatrix` (mat4) + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @class GraphicsPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines - * @constructor - * @since 3.50.0 + * @method Phaser.GameObjects.Text#renderWebGL + * @since 3.0.0 + * @private * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Text} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var GraphicsPipeline = new Class({ +var TextWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + if (src.width === 0 || src.height === 0) + { + return; + } - Extends: WebGLPipeline, + camera.addToRenderList(src); - initialize: + var frame = src.frame; + var width = frame.width; + var height = frame.height; + var getTint = Utils.getTintAppendFloatAlpha; + var pipeline = renderer.pipelines.set(src.pipeline, src); - function GraphicsPipeline (config) - { - config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS); - config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); - config.attributes = GetFastValue(config, 'attributes', [ - { - name: 'inPosition', - size: 2 - }, - { - name: 'inColor', - size: 4, - type: WEBGL_CONST.UNSIGNED_BYTE, - normalized: true - } - ]); + var textureUnit = pipeline.setTexture2D(frame.glTexture, src); - WebGLPipeline.call(this, config); + pipeline.batchTexture( + src, + frame.glTexture, + width, height, + src.x, src.y, + width / src.style.resolution, height / src.style.resolution, + src.scaleX, src.scaleY, + src.rotation, + src.flipX, src.flipY, + src.scrollFactorX, src.scrollFactorY, + src.displayOriginX, src.displayOriginY, + 0, 0, width, height, + getTint(src.tintTopLeft, camera.alpha * src._alphaTL), + getTint(src.tintTopRight, camera.alpha * src._alphaTR), + getTint(src.tintBottomLeft, camera.alpha * src._alphaBL), + getTint(src.tintBottomRight, camera.alpha * src._alphaBR), + src.tintFill, + 0, 0, + camera, + parentMatrix, + false, + textureUnit + ); +}; - /** - * A temporary Transform Matrix, re-used internally during batching by the - * Shape Game Objects. - * - * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#calcMatrix - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @since 3.50.0 - */ - this.calcMatrix = new TransformMatrix(); +module.exports = TextWebGLRenderer; - /** - * Used internally to draw stroked triangles. - * - * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#tempTriangle - * @type {array} - * @private - * @since 3.50.0 - */ - this.tempTriangle = [ - { x: 0, y: 0, width: 0 }, - { x: 0, y: 0, width: 0 }, - { x: 0, y: 0, width: 0 }, - { x: 0, y: 0, width: 0 } - ]; - /** - * Cached stroke tint. - * - * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#strokeTint - * @type {object} - * @private - * @since 3.50.0 - */ - this.strokeTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; +/***/ }), + +/***/ 35856: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CanvasPool = __webpack_require__(61068); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var GetPowerOfTwo = __webpack_require__(3504); +var Smoothing = __webpack_require__(8213); +var TileSpriteRender = __webpack_require__(9271); +var Vector2 = __webpack_require__(93736); + +// bitmask flag for GameObject.renderMask +var _FLAG = 8; // 1000 + +/** + * @classdesc + * A TileSprite is a Sprite that has a repeating texture. + * + * The texture can be scrolled and scaled independently of the TileSprite itself. Textures will automatically wrap and + * are designed so that you can create game backdrops using seamless textures as a source. + * + * You shouldn't ever create a TileSprite any larger than your actual canvas size. If you want to create a large repeating background + * that scrolls across the whole map of your game, then you create a TileSprite that fits the canvas size and then use the `tilePosition` + * property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will + * consume huge amounts of memory and cause performance issues. Remember: use `tilePosition` to scroll your texture and `tileScale` to + * adjust the scale of the texture - don't resize the sprite itself or make it larger than it needs. + * + * An important note about Tile Sprites and NPOT textures: Internally, TileSprite textures use GL_REPEAT to provide + * seamless repeating of the textures. This, combined with the way in which the textures are handled in WebGL, means + * they need to be POT (power-of-two) sizes in order to wrap. If you provide a NPOT (non power-of-two) texture to a + * TileSprite it will generate a POT sized canvas and draw your texture to it, scaled up to the POT size. It's then + * scaled back down again during rendering to the original dimensions. While this works, in that it allows you to use + * any size texture for a Tile Sprite, it does mean that NPOT textures are going to appear anti-aliased when rendered, + * due to the interpolation that took place when it was resized into a POT texture. This is especially visible in + * pixel art graphics. If you notice it and it becomes an issue, the only way to avoid it is to ensure that you + * provide POT textures for Tile Sprites. + * + * @class TileSprite + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects + * @constructor + * @since 3.0.0 + * + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.ComputedSize + * @extends Phaser.GameObjects.Components.Crop + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {number} width - The width of the Game Object. If zero it will use the size of the texture frame. + * @param {number} height - The height of the Game Object. If zero it will use the size of the texture frame. + * @param {string} textureKey - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. Cannot be a DynamicTexture. + * @param {(string|number)} [frameKey] - An optional frame from the Texture this Game Object is rendering with. + */ +var TileSprite = new Class({ + + Extends: GameObject, + + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.ComputedSize, + Components.Crop, + Components.Depth, + Components.Flip, + Components.GetBounds, + Components.Mask, + Components.Origin, + Components.Pipeline, + Components.PostPipeline, + Components.ScrollFactor, + Components.Tint, + Components.Transform, + Components.Visible, + TileSpriteRender + ], + + initialize: + + function TileSprite (scene, x, y, width, height, textureKey, frameKey) + { + var renderer = scene.sys.renderer; + + GameObject.call(this, scene, 'TileSprite'); + + var displayTexture = scene.sys.textures.get(textureKey); + var displayFrame = displayTexture.get(frameKey); + + if (displayFrame.source.compressionAlgorithm) + { + console.warn('TileSprite cannot use compressed texture'); + displayTexture = scene.sys.textures.get('__MISSING'); + displayFrame = displayTexture.get(); + } + + if (displayTexture.type === 'DynamicTexture') + { + console.warn('TileSprite cannot use Dynamic Texture'); + displayTexture = scene.sys.textures.get('__MISSING'); + displayFrame = displayTexture.get(); + } + + if (!width || !height) + { + width = displayFrame.width; + height = displayFrame.height; + } + else + { + width = Math.floor(width); + height = Math.floor(height); + } /** - * Cached fill tint. + * Internal tile position vector. * - * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#fillTint - * @type {object} + * @name Phaser.GameObjects.TileSprite#_tilePosition + * @type {Phaser.Math.Vector2} * @private - * @since 3.50.0 + * @since 3.12.0 */ - this.fillTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; + this._tilePosition = new Vector2(); /** - * Internal texture frame reference. + * Internal tile scale vector. * - * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#currentFrame - * @type {Phaser.Textures.Frame} + * @name Phaser.GameObjects.TileSprite#_tileScale + * @type {Phaser.Math.Vector2} * @private - * @since 3.50.0 + * @since 3.12.0 */ - this.currentFrame = { u0: 0, v0: 0, u1: 1, v1: 1 }; + this._tileScale = new Vector2(1, 1); /** - * Internal path quad cache. + * Whether the Tile Sprite has changed in some way, requiring an re-render of its tile texture. * - * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#firstQuad - * @type {number[]} + * Such changes include the texture frame and scroll position of the Tile Sprite. + * + * @name Phaser.GameObjects.TileSprite#dirty + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.dirty = false; + + /** + * The renderer in use by this Tile Sprite. + * + * @name Phaser.GameObjects.TileSprite#renderer + * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} + * @since 3.0.0 + */ + this.renderer = renderer; + + /** + * The Canvas element that the TileSprite renders its fill pattern in to. + * Only used in Canvas mode. + * + * @name Phaser.GameObjects.TileSprite#canvas + * @type {?HTMLCanvasElement} + * @since 3.12.0 + */ + this.canvas = CanvasPool.create(this, width, height); + + /** + * The Context of the Canvas element that the TileSprite renders its fill pattern in to. + * Only used in Canvas mode. + * + * @name Phaser.GameObjects.TileSprite#context + * @type {CanvasRenderingContext2D} + * @since 3.12.0 + */ + this.context = this.canvas.getContext('2d', { willReadFrequently: false }); + + /** + * The Texture the TileSprite is using as its fill pattern. + * + * @name Phaser.GameObjects.TileSprite#displayTexture + * @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture} * @private - * @since 3.50.0 + * @since 3.12.0 */ - this.firstQuad = [ 0, 0, 0, 0, 0 ]; + this.displayTexture = displayTexture; /** - * Internal path quad cache. + * The Frame the TileSprite is using as its fill pattern. * - * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#prevQuad - * @type {number[]} + * @name Phaser.GameObjects.TileSprite#displayFrame + * @type {Phaser.Textures.Frame} * @private - * @since 3.50.0 + * @since 3.12.0 */ - this.prevQuad = [ 0, 0, 0, 0, 0 ]; + this.displayFrame = displayFrame; /** - * Used internally for triangulating a polygon. + * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. * - * @name Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#polygonCache - * @type {array} + * @name Phaser.GameObjects.TileSprite#_crop + * @type {object} * @private - * @since 3.50.0 + * @since 3.12.0 */ - this.polygonCache = []; - }, + this._crop = this.resetCropObject(); - /** - * Pushes a filled rectangle into the vertex batch. - * - * Rectangle factors in the given transform matrices before adding to the batch. - * - * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchFillRect - * @since 3.50.0 - * - * @param {number} x - Horizontal top left coordinate of the rectangle. - * @param {number} y - Vertical top left coordinate of the rectangle. - * @param {number} width - Width of the rectangle. - * @param {number} height - Height of the rectangle. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. - */ - batchFillRect: function (x, y, width, height, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); + /** + * The Texture this Game Object is using to render with. + * + * @name Phaser.GameObjects.TileSprite#texture + * @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture} + * @since 3.0.0 + */ + this.texture = scene.sys.textures.addCanvas(null, this.canvas, true); - var calcMatrix = this.calcMatrix; + /** + * The Texture Frame this Game Object is using to render with. + * + * @name Phaser.GameObjects.TileSprite#frame + * @type {Phaser.Textures.Frame} + * @since 3.0.0 + */ + this.frame = this.texture.get(); - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) - { - parentMatrix.multiply(currentMatrix, calcMatrix); - } + /** + * The next power of two value from the width of the Fill Pattern frame. + * + * @name Phaser.GameObjects.TileSprite#potWidth + * @type {number} + * @since 3.0.0 + */ + this.potWidth = GetPowerOfTwo(displayFrame.width); - var xw = x + width; - var yh = y + height; + /** + * The next power of two value from the height of the Fill Pattern frame. + * + * @name Phaser.GameObjects.TileSprite#potHeight + * @type {number} + * @since 3.0.0 + */ + this.potHeight = GetPowerOfTwo(displayFrame.height); - var x0 = calcMatrix.getX(x, y); - var y0 = calcMatrix.getY(x, y); + /** + * The Canvas that the TileSprites texture is rendered to. + * This is used to create a WebGL texture from. + * + * @name Phaser.GameObjects.TileSprite#fillCanvas + * @type {HTMLCanvasElement} + * @since 3.12.0 + */ + this.fillCanvas = CanvasPool.create2D(this, this.potWidth, this.potHeight); - var x1 = calcMatrix.getX(x, yh); - var y1 = calcMatrix.getY(x, yh); + /** + * The Canvas Context used to render the TileSprites texture. + * + * @name Phaser.GameObjects.TileSprite#fillContext + * @type {CanvasRenderingContext2D} + * @since 3.12.0 + */ + this.fillContext = this.fillCanvas.getContext('2d', { willReadFrequently: false }); - var x2 = calcMatrix.getX(xw, yh); - var y2 = calcMatrix.getY(xw, yh); + /** + * The texture that the Tile Sprite is rendered to, which is then rendered to a Scene. + * In WebGL this is a WebGLTexture. In Canvas it's a Canvas Fill Pattern. + * + * @name Phaser.GameObjects.TileSprite#fillPattern + * @type {?(WebGLTexture|CanvasPattern)} + * @since 3.12.0 + */ + this.fillPattern = null; - var x3 = calcMatrix.getX(xw, y); - var y3 = calcMatrix.getY(xw, y); + this.setPosition(x, y); + this.setSize(width, height); + this.setFrame(frameKey); + this.setOriginFromFrame(); + this.initPipeline(); + this.initPostPipeline(true); + }, - var tint = this.fillTint; + /** + * Sets the texture and frame this Game Object will use to render with. + * + * Textures are referenced by their string-based keys, as stored in the Texture Manager. + * + * @method Phaser.GameObjects.TileSprite#setTexture + * @since 3.0.0 + * + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. + * + * @return {this} This Game Object instance. + */ + setTexture: function (key, frame) + { + this.displayTexture = this.scene.sys.textures.get(key); - this.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, tint.TL, tint.TR, tint.BL, tint.BR); + return this.setFrame(frame); }, /** - * Pushes a filled triangle into the vertex batch. + * Sets the frame this Game Object will use to render with. * - * Triangle factors in the given transform matrices before adding to the batch. + * The Frame has to belong to the current Texture being used. * - * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchFillTriangle - * @since 3.50.0 + * It can be either a string or an index. * - * @param {number} x0 - Point 0 x coordinate. - * @param {number} y0 - Point 0 y coordinate. - * @param {number} x1 - Point 1 x coordinate. - * @param {number} y1 - Point 1 y coordinate. - * @param {number} x2 - Point 2 x coordinate. - * @param {number} y2 - Point 2 y coordinate. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + * @method Phaser.GameObjects.TileSprite#setFrame + * @since 3.0.0 + * + * @param {(string|number)} frame - The name or index of the frame within the Texture. + * + * @return {this} This Game Object instance. */ - batchFillTriangle: function (x0, y0, x1, y1, x2, y2, currentMatrix, parentMatrix) + setFrame: function (frame) { - this.renderer.pipelines.set(this); + var newFrame = this.displayTexture.get(frame); - var calcMatrix = this.calcMatrix; + this.potWidth = GetPowerOfTwo(newFrame.width); + this.potHeight = GetPowerOfTwo(newFrame.height); - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) + // So updateCanvas is triggered + this.canvas.width = 0; + + if (!newFrame.cutWidth || !newFrame.cutHeight) { - parentMatrix.multiply(currentMatrix, calcMatrix); + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; } - var tx0 = calcMatrix.getX(x0, y0); - var ty0 = calcMatrix.getY(x0, y0); - - var tx1 = calcMatrix.getX(x1, y1); - var ty1 = calcMatrix.getY(x1, y1); + this.displayFrame = newFrame; - var tx2 = calcMatrix.getX(x2, y2); - var ty2 = calcMatrix.getY(x2, y2); + this.dirty = true; - var tint = this.fillTint; + this.updateTileTexture(); - this.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, tint.TL, tint.TR, tint.BL); + return this; }, /** - * Pushes a stroked triangle into the vertex batch. - * - * Triangle factors in the given transform matrices before adding to the batch. + * Sets {@link Phaser.GameObjects.TileSprite#tilePositionX} and {@link Phaser.GameObjects.TileSprite#tilePositionY}. * - * The triangle is created from 3 lines and drawn using the `batchStrokePath` method. + * @method Phaser.GameObjects.TileSprite#setTilePosition + * @since 3.3.0 * - * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchStrokeTriangle - * @since 3.50.0 + * @param {number} [x] - The x position of this sprite's tiling texture. + * @param {number} [y] - The y position of this sprite's tiling texture. * - * @param {number} x0 - Point 0 x coordinate. - * @param {number} y0 - Point 0 y coordinate. - * @param {number} x1 - Point 1 x coordinate. - * @param {number} y1 - Point 1 y coordinate. - * @param {number} x2 - Point 2 x coordinate. - * @param {number} y2 - Point 2 y coordinate. - * @param {number} lineWidth - The width of the line in pixels. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + * @return {this} This Tile Sprite instance. */ - batchStrokeTriangle: function (x0, y0, x1, y1, x2, y2, lineWidth, currentMatrix, parentMatrix) + setTilePosition: function (x, y) { - var tempTriangle = this.tempTriangle; - - tempTriangle[0].x = x0; - tempTriangle[0].y = y0; - tempTriangle[0].width = lineWidth; - - tempTriangle[1].x = x1; - tempTriangle[1].y = y1; - tempTriangle[1].width = lineWidth; - - tempTriangle[2].x = x2; - tempTriangle[2].y = y2; - tempTriangle[2].width = lineWidth; + if (x !== undefined) + { + this.tilePositionX = x; + } - tempTriangle[3].x = x0; - tempTriangle[3].y = y0; - tempTriangle[3].width = lineWidth; + if (y !== undefined) + { + this.tilePositionY = y; + } - this.batchStrokePath(tempTriangle, lineWidth, false, currentMatrix, parentMatrix); + return this; }, /** - * Adds the given path to the vertex batch for rendering. - * - * It works by taking the array of path data and then passing it through Earcut, which - * creates a list of polygons. Each polygon is then added to the batch. + * Sets {@link Phaser.GameObjects.TileSprite#tileScaleX} and {@link Phaser.GameObjects.TileSprite#tileScaleY}. * - * The path is always automatically closed because it's filled. + * @method Phaser.GameObjects.TileSprite#setTileScale + * @since 3.12.0 * - * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchFillPath - * @since 3.50.0 + * @param {number} [x] - The horizontal scale of the tiling texture. If not given it will use the current `tileScaleX` value. + * @param {number} [y=x] - The vertical scale of the tiling texture. If not given it will use the `x` value. * - * @param {Phaser.Types.Math.Vector2Like[]} path - Collection of points that represent the path. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + * @return {this} This Tile Sprite instance. */ - batchFillPath: function (path, currentMatrix, parentMatrix) + setTileScale: function (x, y) { - this.renderer.pipelines.set(this); + if (x === undefined) { x = this.tileScaleX; } + if (y === undefined) { y = x; } - var calcMatrix = this.calcMatrix; + this.tileScaleX = x; + this.tileScaleY = y; - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) + return this; + }, + + /** + * Render the tile texture if it is dirty, or if the frame has changed. + * + * @method Phaser.GameObjects.TileSprite#updateTileTexture + * @private + * @since 3.0.0 + */ + updateTileTexture: function () + { + if (!this.dirty || !this.renderer) { - parentMatrix.multiply(currentMatrix, calcMatrix); + return; } - var length = path.length; - var polygonCache = this.polygonCache; - var polygonIndexArray; - var point; + // Draw the displayTexture to our fillCanvas - var tintTL = this.fillTint.TL; - var tintTR = this.fillTint.TR; - var tintBL = this.fillTint.BL; + var frame = this.displayFrame; - for (var pathIndex = 0; pathIndex < length; ++pathIndex) + if (frame.source.isRenderTexture || frame.source.isGLTexture) { - point = path[pathIndex]; - polygonCache.push(point.x, point.y); + console.warn('TileSprites can only use Image or Canvas based textures'); + + this.dirty = false; + + return; } - polygonIndexArray = Earcut(polygonCache); - length = polygonIndexArray.length; + var ctx = this.fillContext; + var canvas = this.fillCanvas; - for (var index = 0; index < length; index += 3) + var fw = this.potWidth; + var fh = this.potHeight; + + if (!this.renderer || !this.renderer.gl) { - var p0 = polygonIndexArray[index + 0] * 2; - var p1 = polygonIndexArray[index + 1] * 2; - var p2 = polygonIndexArray[index + 2] * 2; + fw = frame.cutWidth; + fh = frame.cutHeight; + } - var x0 = polygonCache[p0 + 0]; - var y0 = polygonCache[p0 + 1]; - var x1 = polygonCache[p1 + 0]; - var y1 = polygonCache[p1 + 1]; - var x2 = polygonCache[p2 + 0]; - var y2 = polygonCache[p2 + 1]; + ctx.clearRect(0, 0, fw, fh); - var tx0 = calcMatrix.getX(x0, y0); - var ty0 = calcMatrix.getY(x0, y0); + canvas.width = fw; + canvas.height = fh; - var tx1 = calcMatrix.getX(x1, y1); - var ty1 = calcMatrix.getY(x1, y1); + ctx.drawImage( + frame.source.image, + frame.cutX, frame.cutY, + frame.cutWidth, frame.cutHeight, + 0, 0, + fw, fh + ); - var tx2 = calcMatrix.getX(x2, y2); - var ty2 = calcMatrix.getY(x2, y2); + if (this.renderer && this.renderer.gl) + { + this.fillPattern = this.renderer.canvasToTexture(canvas, this.fillPattern); - this.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, tintTL, tintTR, tintBL); + if (false) + {} + } + else + { + this.fillPattern = ctx.createPattern(canvas, 'repeat'); } - polygonCache.length = 0; + this.updateCanvas(); + + this.dirty = false; }, /** - * Adds the given path to the vertex batch for rendering. - * - * It works by taking the array of path data and calling `batchLine` for each section - * of the path. - * - * The path is optionally closed at the end. - * - * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchStrokePath - * @since 3.50.0 + * Draw the fill pattern to the internal canvas. * - * @param {Phaser.Types.Math.Vector2Like[]} path - Collection of points that represent the path. - * @param {number} lineWidth - The width of the line segments in pixels. - * @param {boolean} pathOpen - Indicates if the path should be closed or left open. - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + * @method Phaser.GameObjects.TileSprite#updateCanvas + * @private + * @since 3.12.0 */ - batchStrokePath: function (path, lineWidth, pathOpen, currentMatrix, parentMatrix) + updateCanvas: function () { - this.renderer.pipelines.set(this); - - // Reset the closePath booleans - this.prevQuad[4] = 0; - this.firstQuad[4] = 0; - - var pathLength = path.length - 1; + var canvas = this.canvas; - for (var pathIndex = 0; pathIndex < pathLength; pathIndex++) + if (canvas.width !== this.width || canvas.height !== this.height) { - var point0 = path[pathIndex]; - var point1 = path[pathIndex + 1]; + canvas.width = this.width; + canvas.height = this.height; - this.batchLine( - point0.x, - point0.y, - point1.x, - point1.y, - point0.width / 2, - point1.width / 2, - lineWidth, - pathIndex, - !pathOpen && (pathIndex === pathLength - 1), - currentMatrix, - parentMatrix - ); + this.frame.setSize(this.width, this.height); + this.updateDisplayOrigin(); + + this.dirty = true; } - }, - /** - * Creates a line out of 4 quads and adds it to the vertex batch based on the given line values. - * - * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchLine - * @since 3.50.0 - * - * @param {number} ax - x coordinate of the start of the line. - * @param {number} ay - y coordinate of the start of the line. - * @param {number} bx - x coordinate of the end of the line. - * @param {number} by - y coordinate of the end of the line. - * @param {number} aLineWidth - Width of the start of the line. - * @param {number} bLineWidth - Width of the end of the line. - * @param {number} index - If this line is part of a multi-line draw, the index of the line in the draw. - * @param {boolean} closePath - Does this line close a multi-line path? - * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. - */ - batchLine: function (ax, ay, bx, by, aLineWidth, bLineWidth, lineWidth, index, closePath, currentMatrix, parentMatrix) - { - this.renderer.pipelines.set(this); + if (!this.dirty || this.renderer && this.renderer.gl) + { + this.dirty = false; + return; + } - var calcMatrix = this.calcMatrix; + var ctx = this.context; - // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix - if (parentMatrix) + if (!this.scene.sys.game.config.antialias) { - parentMatrix.multiply(currentMatrix, calcMatrix); + Smoothing.disable(ctx); } - var dx = bx - ax; - var dy = by - ay; + var scaleX = this._tileScale.x; + var scaleY = this._tileScale.y; - var len = Math.sqrt(dx * dx + dy * dy); - var al0 = aLineWidth * (by - ay) / len; - var al1 = aLineWidth * (ax - bx) / len; - var bl0 = bLineWidth * (by - ay) / len; - var bl1 = bLineWidth * (ax - bx) / len; + var positionX = this._tilePosition.x; + var positionY = this._tilePosition.y; - var lx0 = bx - bl0; - var ly0 = by - bl1; - var lx1 = ax - al0; - var ly1 = ay - al1; - var lx2 = bx + bl0; - var ly2 = by + bl1; - var lx3 = ax + al0; - var ly3 = ay + al1; + ctx.clearRect(0, 0, this.width, this.height); - // tx0 = bottom right - var brX = calcMatrix.getX(lx0, ly0); - var brY = calcMatrix.getY(lx0, ly0); + ctx.save(); - // tx1 = bottom left - var blX = calcMatrix.getX(lx1, ly1); - var blY = calcMatrix.getY(lx1, ly1); + ctx.scale(scaleX, scaleY); - // tx2 = top right - var trX = calcMatrix.getX(lx2, ly2); - var trY = calcMatrix.getY(lx2, ly2); + ctx.translate(-positionX, -positionY); - // tx3 = top left - var tlX = calcMatrix.getX(lx3, ly3); - var tlY = calcMatrix.getY(lx3, ly3); + ctx.fillStyle = this.fillPattern; - var tint = this.strokeTint; + ctx.fillRect(positionX, positionY, this.width / scaleX, this.height / scaleY); - var tintTL = tint.TL; - var tintTR = tint.TR; - var tintBL = tint.BL; - var tintBR = tint.BR; + ctx.restore(); - // TL, BL, BR, TR - this.batchQuad(tlX, tlY, blX, blY, brX, brY, trX, trY, tintTL, tintTR, tintBL, tintBR); + this.dirty = false; + }, - if (lineWidth <= 2) + /** + * Internal destroy handler, called as part of the destroy process. + * + * @method Phaser.GameObjects.TileSprite#preDestroy + * @protected + * @since 3.9.0 + */ + preDestroy: function () + { + if (this.renderer && this.renderer.gl) { - // No point doing a linejoin if the line isn't thick enough - return; + this.renderer.deleteTexture(this.fillPattern); } - var prev = this.prevQuad; - var first = this.firstQuad; + CanvasPool.remove(this.canvas); + CanvasPool.remove(this.fillCanvas); - if (index > 0 && prev[4]) - { - this.batchQuad(tlX, tlY, blX, blY, prev[0], prev[1], prev[2], prev[3], tintTL, tintTR, tintBL, tintBR); - } - else - { - first[0] = tlX; - first[1] = tlY; - first[2] = blX; - first[3] = blY; - first[4] = 1; - } + this.fillPattern = null; + this.fillContext = null; + this.fillCanvas = null; - if (closePath && first[4]) - { - // Add a join for the final path segment - this.batchQuad(brX, brY, trX, trY, first[0], first[1], first[2], first[3], tintTL, tintTR, tintBL, tintBR); - } - else - { - // Store it + this.displayTexture = null; + this.displayFrame = null; - prev[0] = brX; - prev[1] = brY; - prev[2] = trX; - prev[3] = trY; - prev[4] = 1; - } + this.texture.destroy(); + + this.renderer = null; }, /** - * Adds a single vertex to the current vertex buffer and increments the - * `vertexCount` property by 1. - * - * This method is called directly by `batchTri` and `batchQuad`. - * - * It does not perform any batch limit checking itself, so if you need to call - * this method directly, do so in the same way that `batchQuad` does, for example. - * - * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchVert - * @since 3.50.0 + * The horizontal scroll position of the Tile Sprite. * - * @param {number} x - The vertex x position. - * @param {number} y - The vertex y position. - * @param {number} tint - The tint color value. + * @name Phaser.GameObjects.TileSprite#tilePositionX + * @type {number} + * @default 0 + * @since 3.0.0 */ - batchVert: function (x, y, tint) - { - var vertexViewF32 = this.vertexViewF32; - var vertexViewU32 = this.vertexViewU32; + tilePositionX: { - var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; + get: function () + { + return this._tilePosition.x; + }, - vertexViewF32[++vertexOffset] = x; - vertexViewF32[++vertexOffset] = y; - vertexViewU32[++vertexOffset] = tint; + set: function (value) + { + this._tilePosition.x = value; + this.dirty = true; + } - this.vertexCount++; }, /** - * Adds the vertices data into the batch and flushes if full. - * - * Assumes 6 vertices in the following arrangement: - * - * ``` - * 0----3 - * |\ B| - * | \ | - * | \ | - * | A \| - * | \ - * 1----2 - * ``` - * - * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3 - * - * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchQuad - * @override - * @since 3.50.0 - * - * @param {number} x0 - The top-left x position. - * @param {number} y0 - The top-left y position. - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} tintTL - The top-left tint color value. - * @param {number} tintTR - The top-right tint color value. - * @param {number} tintBL - The bottom-left tint color value. - * @param {number} tintBR - The bottom-right tint color value. + * The vertical scroll position of the Tile Sprite. * - * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. + * @name Phaser.GameObjects.TileSprite#tilePositionY + * @type {number} + * @default 0 + * @since 3.0.0 */ - batchQuad: function (x0, y0, x1, y1, x2, y2, x3, y3, tintTL, tintTR, tintBL, tintBR) - { - var hasFlushed = false; + tilePositionY: { - if (this.shouldFlush(6)) + get: function () { - this.flush(); + return this._tilePosition.y; + }, - hasFlushed = true; + set: function (value) + { + this._tilePosition.y = value; + this.dirty = true; } - this.batchVert(x0, y0, tintTL); - this.batchVert(x1, y1, tintBL); - this.batchVert(x2, y2, tintBR); - this.batchVert(x0, y0, tintTL); - this.batchVert(x2, y2, tintBR); - this.batchVert(x3, y3, tintTR); - - return hasFlushed; }, /** - * Adds the vertices data into the batch and flushes if full. - * - * Assumes 3 vertices in the following arrangement: - * - * ``` - * 0 - * |\ - * | \ - * | \ - * | \ - * | \ - * 1-----2 - * ``` - * - * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#batchTri - * @override - * @since 3.50.0 - * - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} tintTL - The top-left tint color value. - * @param {number} tintTR - The top-right tint color value. - * @param {number} tintBL - The bottom-left tint color value. + * The horizontal scale of the Tile Sprite texture. * - * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. + * @name Phaser.GameObjects.TileSprite#tileScaleX + * @type {number} + * @default 1 + * @since 3.11.0 */ - batchTri: function (x0, y0, x1, y1, x2, y2, tintTL, tintTR, tintBL) - { - var hasFlushed = false; + tileScaleX: { - if (this.shouldFlush(3)) + get: function () { - this.flush(); + return this._tileScale.x; + }, - hasFlushed = true; + set: function (value) + { + this._tileScale.x = value; + this.dirty = true; } - this.batchVert(x0, y0, tintTL); - this.batchVert(x1, y1, tintTR); - this.batchVert(x2, y2, tintBL); - - return hasFlushed; }, /** - * Destroys all shader instances, removes all object references and nulls all external references. - * - * @method Phaser.Renderer.WebGL.Pipelines.GraphicsPipeline#destroy - * @since 3.50.0 + * The vertical scale of the Tile Sprite texture. * - * @return {this} This WebGLPipeline instance. + * @name Phaser.GameObjects.TileSprite#tileScaleY + * @type {number} + * @default 1 + * @since 3.11.0 */ - destroy: function () - { - WebGLPipeline.prototype.destroy.call(this); + tileScaleY: { - this.polygonCache = null; + get: function () + { + return this._tileScale.y; + }, + + set: function (value) + { + this._tileScale.y = value; + this.dirty = true; + } - return this; } }); -module.exports = GraphicsPipeline; +module.exports = TileSprite; /***/ }), -/* 377 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 93305: +/***/ ((module) => { /** * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); -var LightShaderSourceFS = __webpack_require__(877); -var MultiPipeline = __webpack_require__(108); -var Vec2 = __webpack_require__(3); -var WebGLPipeline = __webpack_require__(58); - -var LIGHT_COUNT = 10; -var tempVec2 = new Vec2(); - /** - * @classdesc - * The Light Pipeline is an extension of the Multi Pipeline and uses a custom shader - * designed to handle forward diffused rendering of 2D lights in a Scene. - * - * The shader works in tandem with Light Game Objects, and optionally texture normal maps, - * to provide an ambient illumination effect. - * - * If you wish to provide your own shader, you can use the `%LIGHT_COUNT%` declaration in the source, - * and it will be automatically replaced at run-time with the total number of configured lights. - * - * The maximum number of lights can be set in the Render Config `maxLights` property and defaults to 10. - * - * Prior to Phaser v3.50 this pipeline was called the `ForwardDiffuseLightPipeline`. - * - * The fragment shader it uses can be found in `shaders/src/Light.frag`. - * The vertex shader it uses can be found in `shaders/src/Multi.vert`. - * - * The default shader attributes for this pipeline are: - * - * `inPosition` (vec2, offset 0) - * `inTexCoord` (vec2, offset 8) - * `inTexId` (float, offset 16) - * `inTintEffect` (float, offset 20) - * `inTint` (vec4, offset 24, normalized) - * - * The default shader uniforms for this pipeline are those from the Multi Pipeline, plus: - * - * `uMainSampler` (sampler2D) - * `uNormSampler` (sampler2D) - * `uCamera` (vec4) - * `uResolution` (vec2) - * `uAmbientLightColor` (vec3) - * `uInverseRotationMatrix` (mat3) - * `uLights` (Light struct) + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @class LightPipeline - * @extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines - * @constructor - * @since 3.50.0 + * @method Phaser.GameObjects.TileSprite#renderCanvas + * @since 3.0.0 + * @private * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.TileSprite} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var LightPipeline = new Class({ +var TileSpriteCanvasRenderer = function (renderer, src, camera, parentMatrix) +{ + src.updateCanvas(); - Extends: MultiPipeline, + camera.addToRenderList(src); - initialize: + renderer.batchSprite(src, src.frame, camera, parentMatrix); +}; - function LightPipeline (config) - { - LIGHT_COUNT = config.game.renderer.config.maxLights; +module.exports = TileSpriteCanvasRenderer; - var fragShader = GetFastValue(config, 'fragShader', LightShaderSourceFS); - var shaders = []; +/***/ }), - for (var i = 1; i <= LIGHT_COUNT; i++) - { - shaders.push({ - name: 'lights' + i, - fragShader: fragShader.replace('%LIGHT_COUNT%', i.toString()) - }); - } +/***/ 63950: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - config.shaders = shaders; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - MultiPipeline.call(this, config); +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var TileSprite = __webpack_require__(35856); - /** - * Inverse rotation matrix for normal map rotations. - * - * @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#inverseRotationMatrix - * @type {Float32Array} - * @private - * @since 3.16.0 - */ - this.inverseRotationMatrix = new Float32Array([ - 1, 0, 0, - 0, 1, 0, - 0, 0, 1 - ]); +/** + * Creates a new TileSprite Game Object and returns it. + * + * Note: This method will only be available if the TileSprite Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#tileSprite + * @since 3.0.0 + * + * @param {Phaser.Types.GameObjects.TileSprite.TileSpriteConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.TileSprite} The Game Object that was created. + */ +GameObjectCreator.register('tileSprite', function (config, addToScene) +{ + if (config === undefined) { config = {}; } - /** - * Stores a default normal map, which is an object with a `glTexture` property that - * maps to a 1x1 texture of the color #7f7fff created in the `boot` method. - * - * @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#defaultNormalMap - * @type {object} - * @since 3.50.0 - */ - this.defaultNormalMap; + var x = GetAdvancedValue(config, 'x', 0); + var y = GetAdvancedValue(config, 'y', 0); + var width = GetAdvancedValue(config, 'width', 512); + var height = GetAdvancedValue(config, 'height', 512); + var key = GetAdvancedValue(config, 'key', ''); + var frame = GetAdvancedValue(config, 'frame', ''); - /** - * A boolean that is set automatically during `onRender` that determines - * if the Scene LightManager is active, or not. - * - * @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#lightsActive - * @type {boolean} - * @readonly - * @since 3.53.0 - */ - this.lightsActive = true; - }, + var tile = new TileSprite(this.scene, x, y, width, height, key, frame); - /** - * Called when the Game has fully booted and the Renderer has finished setting up. - * - * By this stage all Game level systems are now in place and you can perform any final - * tasks that the pipeline may need that relied on game systems such as the Texture Manager. - * - * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#boot - * @since 3.11.0 - */ - boot: function () + if (addToScene !== undefined) { - WebGLPipeline.prototype.boot.call(this); - - var gl = this.gl; + config.add = addToScene; + } - var tempTexture = gl.createTexture(); + BuildGameObject(this.scene, tile, config); - gl.activeTexture(gl.TEXTURE0); + return tile; +}); - gl.bindTexture(gl.TEXTURE_2D, tempTexture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([ 127, 127, 255, 255 ])); +/***/ }), - this.defaultNormalMap = { glTexture: tempTexture }; +/***/ 20509: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - // Set the lights shaders - for (var i = 0; i < this.shaders.length; i++) - { - this['lightShader' + (i + 1)] = this.shaders[i]; - } - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * This function sets all the needed resources for each camera pass. - * - * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#onRender - * @ignore - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene being rendered. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. - */ - onRender: function (scene, camera) - { - var lightManager = scene.sys.lights; +var TileSprite = __webpack_require__(35856); +var GameObjectFactory = __webpack_require__(61286); - this.lightsActive = false; - - if (!lightManager || !lightManager.active) - { - return; - } - - var lights = lightManager.getLights(camera); - var lightsCount = lights.length; - - if (lightsCount === 0) - { - return; - } - - // Ok, we're good to go ... - - this.lightsActive = true; - - this.setShader(this['lightShader' + lightsCount], true); - - var i; - var renderer = this.renderer; - var height = renderer.height; - var cameraMatrix = camera.matrix; - - this.set1i('uMainSampler', 0); - this.set1i('uNormSampler', 1); - this.set2f('uResolution', this.width / 2, this.height / 2); - this.set4f('uCamera', camera.x, camera.y, camera.rotation, camera.zoom); - this.set3f('uAmbientLightColor', lightManager.ambientColor.r, lightManager.ambientColor.g, lightManager.ambientColor.b); - - for (i = 0; i < lightsCount; i++) - { - var light = lights[i].light; - var color = light.color; - - var lightName = 'uLights[' + i + '].'; - - cameraMatrix.transformPoint(light.x, light.y, tempVec2); - - this.set2f(lightName + 'position', tempVec2.x - (camera.scrollX * light.scrollFactorX * camera.zoom), height - (tempVec2.y - (camera.scrollY * light.scrollFactorY) * camera.zoom)); - this.set3f(lightName + 'color', color.r, color.g, color.b); - this.set1f(lightName + 'intensity', light.intensity); - this.set1f(lightName + 'radius', light.radius); - } - - this.currentNormalMapRotation = null; - }, - - /** - * Rotates the normal map vectors inversely by the given angle. - * Only works in 2D space. - * - * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#setNormalMapRotation - * @since 3.16.0 - * - * @param {number} rotation - The angle of rotation in radians. - */ - setNormalMapRotation: function (rotation) - { - if (rotation !== this.currentNormalMapRotation || this.vertexCount === 0) - { - if (this.vertexCount > 0) - { - this.flush(); - } - - var inverseRotationMatrix = this.inverseRotationMatrix; - - if (rotation) - { - var rot = -rotation; - var c = Math.cos(rot); - var s = Math.sin(rot); - - inverseRotationMatrix[1] = s; - inverseRotationMatrix[3] = -s; - inverseRotationMatrix[0] = inverseRotationMatrix[4] = c; - } - else - { - inverseRotationMatrix[0] = inverseRotationMatrix[4] = 1; - inverseRotationMatrix[1] = inverseRotationMatrix[3] = 0; - } - - this.setMatrix3fv('uInverseRotationMatrix', false, inverseRotationMatrix); - - this.currentNormalMapRotation = rotation; - } - }, - - /** - * Assigns a texture to the current batch. If a different texture is already set it creates a new batch object. - * - * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#setTexture2D - * @ignore - * @since 3.50.0 - * - * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture. - * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object being rendered or added to the batch. - */ - setTexture2D: function (texture, gameObject) - { - var renderer = this.renderer; - - if (texture === undefined) { texture = renderer.tempTextures[0]; } - - var normalTexture = this.getNormalMap(gameObject); - - if (renderer.isNewNormalMap(texture, normalTexture)) - { - this.flush(); - - renderer.setTextureZero(texture); - renderer.setNormalMap(normalTexture); - } - - var rotation = (gameObject) ? gameObject.rotation : 0; - - this.setNormalMapRotation(rotation); - - this.currentUnit = 0; - - return 0; - }, - - /** - * Custom pipelines can use this method in order to perform any required pre-batch tasks - * for the given Game Object. It must return the texture unit the Game Object was assigned. - * - * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#setGameObject - * @ignore - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object being rendered or added to the batch. - * @param {Phaser.Textures.Frame} [frame] - Optional frame to use. Can override that of the Game Object. - * - * @return {number} The texture unit the Game Object has been assigned. - */ - setGameObject: function (gameObject, frame) - { - if (frame === undefined) { frame = gameObject.frame; } - - var renderer = this.renderer; - var texture = frame.glTexture; - var normalTexture = this.getNormalMap(gameObject); - - if (renderer.isNewNormalMap()) - { - this.flush(); - - renderer.setTextureZero(texture); - renderer.setNormalMap(normalTexture); - } - - this.setNormalMapRotation(gameObject.rotation); - - this.currentUnit = 0; +/** + * Creates a new TileSprite Game Object and adds it to the Scene. + * + * Note: This method will only be available if the TileSprite Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#tileSprite + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {number} width - The width of the Game Object. If zero it will use the size of the texture frame. + * @param {number} height - The height of the Game Object. If zero it will use the size of the texture frame. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. Cannot be a DynamicTexture. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * + * @return {Phaser.GameObjects.TileSprite} The Game Object that was created. + */ +GameObjectFactory.register('tileSprite', function (x, y, width, height, texture, frame) +{ + return this.displayList.add(new TileSprite(this.scene, x, y, width, height, texture, frame)); +}); - return 0; - }, +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns - /** - * Returns the normal map WebGLTexture from the given Game Object. - * If the Game Object doesn't have one, it returns the default normal map from this pipeline instead. - * - * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#getNormalMap - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object to get the normal map from. - * - * @return {WebGLTexture} The normal map texture. - */ - getNormalMap: function (gameObject) - { - var normalTexture; - if (!gameObject) - { - normalTexture = this.defaultNormalMap; - } - else if (gameObject.displayTexture) - { - normalTexture = gameObject.displayTexture.dataSource[gameObject.displayFrame.sourceIndex]; - } - else if (gameObject.texture) - { - normalTexture = gameObject.texture.dataSource[gameObject.frame.sourceIndex]; - } - else if (gameObject.tileset) - { - if (Array.isArray(gameObject.tileset)) - { - normalTexture = gameObject.tileset[0].image.dataSource[0]; - } - else - { - normalTexture = gameObject.tileset.image.dataSource[0]; - } - } +/***/ }), - if (!normalTexture) - { - normalTexture = this.defaultNormalMap; - } +/***/ 9271: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return normalTexture.glTexture; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Takes a Sprite Game Object, or any object that extends it, and adds it to the batch. - * - * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#batchSprite - * @since 3.50.0 - * - * @param {(Phaser.GameObjects.Image|Phaser.GameObjects.Sprite)} gameObject - The texture based Game Object to add to the batch. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set. - */ - batchSprite: function (gameObject, camera, parentTransformMatrix) - { - if (this.lightsActive) - { - MultiPipeline.prototype.batchSprite.call(this, gameObject, camera, parentTransformMatrix); - } - }, +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - /** - * Generic function for batching a textured quad using argument values instead of a Game Object. - * - * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#batchTexture - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject. - * @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad. - * @param {number} textureWidth - Real texture width. - * @param {number} textureHeight - Real texture height. - * @param {number} srcX - X coordinate of the quad. - * @param {number} srcY - Y coordinate of the quad. - * @param {number} srcWidth - Width of the quad. - * @param {number} srcHeight - Height of the quad. - * @param {number} scaleX - X component of scale. - * @param {number} scaleY - Y component of scale. - * @param {number} rotation - Rotation of the quad. - * @param {boolean} flipX - Indicates if the quad is horizontally flipped. - * @param {boolean} flipY - Indicates if the quad is vertically flipped. - * @param {number} scrollFactorX - By which factor is the quad affected by the camera horizontal scroll. - * @param {number} scrollFactorY - By which factor is the quad effected by the camera vertical scroll. - * @param {number} displayOriginX - Horizontal origin in pixels. - * @param {number} displayOriginY - Vertical origin in pixels. - * @param {number} frameX - X coordinate of the texture frame. - * @param {number} frameY - Y coordinate of the texture frame. - * @param {number} frameWidth - Width of the texture frame. - * @param {number} frameHeight - Height of the texture frame. - * @param {number} tintTL - Tint for top left. - * @param {number} tintTR - Tint for top right. - * @param {number} tintBL - Tint for bottom left. - * @param {number} tintBR - Tint for bottom right. - * @param {number} tintEffect - The tint effect. - * @param {number} uOffset - Horizontal offset on texture coordinate. - * @param {number} vOffset - Vertical offset on texture coordinate. - * @param {Phaser.Cameras.Scene2D.Camera} camera - Current used camera. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - Parent container. - * @param {boolean} [skipFlip=false] - Skip the renderTexture check. - * @param {number} [textureUnit] - Use the currently bound texture unit? - */ - batchTexture: function ( - gameObject, - texture, - textureWidth, textureHeight, - srcX, srcY, - srcWidth, srcHeight, - scaleX, scaleY, - rotation, - flipX, flipY, - scrollFactorX, scrollFactorY, - displayOriginX, displayOriginY, - frameX, frameY, frameWidth, frameHeight, - tintTL, tintTR, tintBL, tintBR, tintEffect, - uOffset, vOffset, - camera, - parentTransformMatrix, - skipFlip, - textureUnit) - { - if (this.lightsActive) - { - MultiPipeline.prototype.batchTexture.call( - this, - gameObject, - texture, - textureWidth, textureHeight, - srcX, srcY, - srcWidth, srcHeight, - scaleX, scaleY, - rotation, - flipX, flipY, - scrollFactorX, scrollFactorY, - displayOriginX, displayOriginY, - frameX, frameY, frameWidth, frameHeight, - tintTL, tintTR, tintBL, tintBR, tintEffect, - uOffset, vOffset, - camera, - parentTransformMatrix, - skipFlip, - textureUnit - ); - } - }, +if (true) +{ + renderWebGL = __webpack_require__(74287); +} - /** - * Adds a Texture Frame into the batch for rendering. - * - * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#batchTextureFrame - * @since 3.50.0 - * - * @param {Phaser.Textures.Frame} frame - The Texture Frame to be rendered. - * @param {number} x - The horizontal position to render the texture at. - * @param {number} y - The vertical position to render the texture at. - * @param {number} tint - The tint color. - * @param {number} alpha - The alpha value. - * @param {Phaser.GameObjects.Components.TransformMatrix} transformMatrix - The Transform Matrix to use for the texture. - * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - A parent Transform Matrix. - */ - batchTextureFrame: function ( - frame, - x, y, - tint, alpha, - transformMatrix, - parentTransformMatrix - ) - { - if (this.lightsActive) - { - MultiPipeline.prototype.batchTextureFrame.call( - this, - frame, - x, y, - tint, alpha, - transformMatrix, - parentTransformMatrix - ); - } - } +if (true) +{ + renderCanvas = __webpack_require__(93305); +} -}); +module.exports = { -LightPipeline.LIGHT_COUNT = LIGHT_COUNT; + renderWebGL: renderWebGL, + renderCanvas: renderCanvas -module.exports = LightPipeline; +}; /***/ }), -/* 378 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 74287: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); -var PointLightShaderSourceFS = __webpack_require__(880); -var PointLightShaderSourceVS = __webpack_require__(881); -var WebGLPipeline = __webpack_require__(58); +var Utils = __webpack_require__(75512); /** - * @classdesc - * The Point Light Pipeline handles rendering the Point Light Game Objects in WebGL. - * - * The fragment shader it uses can be found in `shaders/src/PointLight.frag`. - * The vertex shader it uses can be found in `shaders/src/PointLight.vert`. - * - * The default shader attributes for this pipeline are: - * - * `inPosition` (vec2) - * `inLightPosition` (vec2) - * `inLightRadius` (float) - * `inLightAttenuation` (float) - * `inLightColor` (vec4) - * - * The default shader uniforms for this pipeline are: - * - * `uProjectionMatrix` (mat4) - * `uResolution` (vec2) - * `uCameraZoom` (sampler2D) + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @class PointLightPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines - * @constructor - * @since 3.50.0 + * @method Phaser.GameObjects.TileSprite#renderWebGL + * @since 3.0.0 + * @private * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.TileSprite} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var PointLightPipeline = new Class({ - - Extends: WebGLPipeline, - - initialize: - - function PointLightPipeline (config) - { - config.vertShader = GetFastValue(config, 'vertShader', PointLightShaderSourceVS); - config.fragShader = GetFastValue(config, 'fragShader', PointLightShaderSourceFS); - config.attributes = GetFastValue(config, 'attributes', [ - { - name: 'inPosition', - size: 2 - }, - { - name: 'inLightPosition', - size: 2 - }, - { - name: 'inLightRadius' - }, - { - name: 'inLightAttenuation' - }, - { - name: 'inLightColor', - size: 4 - } - ]); - - WebGLPipeline.call(this, config); - }, +var TileSpriteWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + src.updateCanvas(); - onRender: function (scene, camera) - { - this.set2f('uResolution', this.width, this.height); - this.set1f('uCameraZoom', camera.zoom); - }, + var width = src.width; + var height = src.height; - /** - * Adds a Point Light Game Object to the batch, flushing if required. - * - * @method Phaser.Renderer.WebGL.Pipelines.PointLightPipeline#batchPointLight - * @since 3.50.0 - * - * @param {Phaser.GameObjects.PointLight} light - The Point Light Game Object. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera rendering the Point Light. - * @param {number} x0 - The top-left x position. - * @param {number} y0 - The top-left y position. - * @param {number} x1 - The bottom-left x position. - * @param {number} y1 - The bottom-left y position. - * @param {number} x2 - The bottom-right x position. - * @param {number} y2 - The bottom-right y position. - * @param {number} x3 - The top-right x position. - * @param {number} y3 - The top-right y position. - * @param {number} lightX - The horizontal center of the light. - * @param {number} lightY - The vertical center of the light. - */ - batchPointLight: function (light, camera, x0, y0, x1, y1, x2, y2, x3, y3, lightX, lightY) + if (width === 0 || height === 0) { - var color = light.color; - var intensity = light.intensity; - var radius = light.radius; - var attenuation = light.attenuation; - - var r = color.r * intensity; - var g = color.g * intensity; - var b = color.b * intensity; - var a = camera.alpha * light.alpha; - - if (this.shouldFlush(6)) - { - this.flush(); - } - - this.batchLightVert(x0, y0, lightX, lightY, radius, attenuation, r, g, b, a); - this.batchLightVert(x1, y1, lightX, lightY, radius, attenuation, r, g, b, a); - this.batchLightVert(x2, y2, lightX, lightY, radius, attenuation, r, g, b, a); - this.batchLightVert(x0, y0, lightX, lightY, radius, attenuation, r, g, b, a); - this.batchLightVert(x2, y2, lightX, lightY, radius, attenuation, r, g, b, a); - this.batchLightVert(x3, y3, lightX, lightY, radius, attenuation, r, g, b, a); - }, + return; + } - /** - * Adds a single Point Light vertex to the current vertex buffer and increments the - * `vertexCount` property by 1. - * - * This method is called directly by `batchPointLight`. - * - * @method Phaser.Renderer.WebGL.Pipelines.PointLightPipeline#batchLightVert - * @since 3.50.0 - * - * @param {number} x - The vertex x position. - * @param {number} y - The vertex y position. - * @param {number} lightX - The horizontal center of the light. - * @param {number} lightY - The vertical center of the light. - * @param {number} radius - The radius of the light. - * @param {number} attenuation - The attenuation of the light. - * @param {number} r - The red color channel of the light. - * @param {number} g - The green color channel of the light. - * @param {number} b - The blue color channel of the light. - * @param {number} a - The alpha color channel of the light. - */ - batchLightVert: function (x, y, lightX, lightY, radius, attenuation, r, g, b, a) - { - var vertexViewF32 = this.vertexViewF32; + camera.addToRenderList(src); - var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; + var getTint = Utils.getTintAppendFloatAlpha; - vertexViewF32[++vertexOffset] = x; - vertexViewF32[++vertexOffset] = y; - vertexViewF32[++vertexOffset] = lightX; - vertexViewF32[++vertexOffset] = lightY; - vertexViewF32[++vertexOffset] = radius; - vertexViewF32[++vertexOffset] = attenuation; - vertexViewF32[++vertexOffset] = r; - vertexViewF32[++vertexOffset] = g; - vertexViewF32[++vertexOffset] = b; - vertexViewF32[++vertexOffset] = a; + var pipeline = renderer.pipelines.set(src.pipeline, src); - this.vertexCount++; - } + var textureUnit = pipeline.setTexture2D(src.fillPattern, src); -}); + pipeline.batchTexture( + src, + src.fillPattern, + src.displayFrame.width * src.tileScaleX, src.displayFrame.height * src.tileScaleY, + src.x, src.y, + width, height, + src.scaleX, src.scaleY, + src.rotation, + src.flipX, src.flipY, + src.scrollFactorX, src.scrollFactorY, + src.originX * width, src.originY * height, + 0, 0, width, height, + getTint(src.tintTopLeft, camera.alpha * src._alphaTL), + getTint(src.tintTopRight, camera.alpha * src._alphaTR), + getTint(src.tintBottomLeft, camera.alpha * src._alphaBL), + getTint(src.tintBottomRight, camera.alpha * src._alphaBR), + src.tintFill, + (src.tilePositionX % src.displayFrame.width) / src.displayFrame.width, + (src.tilePositionY % src.displayFrame.height) / src.displayFrame.height, + camera, + parentMatrix, + false, + textureUnit + ); +}; -module.exports = PointLightPipeline; +module.exports = TileSpriteWebGLRenderer; /***/ }), -/* 379 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 8630: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); -var MultiPipeline = __webpack_require__(108); +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var Events = __webpack_require__(56631); +var GameEvents = __webpack_require__(97081); +var GameObject = __webpack_require__(89980); +var MATH_CONST = __webpack_require__(83392); +var SoundEvents = __webpack_require__(76038); +var UUID = __webpack_require__(76583); +var VideoRender = __webpack_require__(77974); /** * @classdesc - * The Rope Pipeline is a variation of the Multi Pipeline that uses a `TRIANGLE_STRIP` for - * its topology, instead of TRIANGLES. This is primarily used by the Rope Game Object, - * or anything that extends it. - * - * Prior to Phaser v3.50 this pipeline was called the `TextureTintStripPipeline`. - * - * The fragment shader it uses can be found in `shaders/src/Multi.frag`. - * The vertex shader it uses can be found in `shaders/src/Multi.vert`. - * - * The default shader attributes for this pipeline are: - * - * `inPosition` (vec2, offset 0) - * `inTexCoord` (vec2, offset 8) - * `inTexId` (float, offset 16) - * `inTintEffect` (float, offset 20) - * `inTint` (vec4, offset 24, normalized) + * A Video Game Object. * - * The default shader uniforms for this pipeline are: + * This Game Object is capable of handling playback of a video file, video stream or media stream. * - * `uProjectionMatrix` (mat4) - * `uMainSampler` (sampler2D array) + * You can optionally 'preload' the video into the Phaser Video Cache: * - * The pipeline is structurally identical to the Multi Pipeline and should be treated as such. + * ```javascript + * preload () { + * this.load.video('ripley', 'assets/aliens.mp4'); + * } * - * @class RopePipeline - * @extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines - * @constructor - * @since 3.50.0 + * create () { + * this.add.video(400, 300, 'ripley'); + * } + * ``` * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. - */ -var RopePipeline = new Class({ - - Extends: MultiPipeline, - - initialize: - - function RopePipeline (config) - { - // GLenum 5 = TRIANGLE_STRIP - config.topology = 5; - config.batchSize = GetFastValue(config, 'batchSize', 256); - - MultiPipeline.call(this, config); - } -}); - -module.exports = RopePipeline; - - -/***/ }), -/* 380 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); -var MultiPipeline = __webpack_require__(108); -var ShaderSourceFS = __webpack_require__(882); -var ShaderSourceVS = __webpack_require__(883); -var WebGLPipeline = __webpack_require__(58); - -/** - * @classdesc - * The Single Pipeline is a special version of the Multi Pipeline that only ever - * uses one texture, bound to texture unit zero. Although not as efficient as the - * Multi Pipeline, it provides an easier way to create custom pipelines that only require - * a single bound texture. + * You don't have to 'preload' the video. You can also play it directly from a URL: * - * Prior to Phaser v3.50 this pipeline didn't exist, but could be compared to the old `TextureTintPipeline`. + * ```javascript + * create () { + * this.add.video(400, 300).loadURL('assets/aliens.mp4'); + * } + * ``` * - * The fragment shader it uses can be found in `shaders/src/Single.frag`. - * The vertex shader it uses can be found in `shaders/src/Single.vert`. + * To all intents and purposes, a video is a standard Game Object, just like a Sprite. And as such, you can do + * all the usual things to it, such as scaling, rotating, cropping, tinting, making interactive, giving a + * physics body, etc. * - * The default shader attributes for this pipeline are: + * Transparent videos are also possible via the WebM file format. Providing the video file has was encoded with + * an alpha channel, and providing the browser supports WebM playback (not all of them do), then it will render + * in-game with full transparency. * - * `inPosition` (vec2, offset 0) - * `inTexCoord` (vec2, offset 8) - * `inTexId` (float, offset 16) - this value is always zero in the Single Pipeline - * `inTintEffect` (float, offset 20) - * `inTint` (vec4, offset 24, normalized) + * Playback is handled entirely via the Request Video Frame API, which is supported by most modern browsers. + * A polyfill is provided for older browsers. * - * The default shader uniforms for this pipeline are: + * ### Autoplaying Videos * - * `uProjectionMatrix` (mat4) - * `uMainSampler` (sampler2D) + * Videos can only autoplay if the browser has been unlocked with an interaction, or satisfies the MEI settings. + * The policies that control autoplaying are vast and vary between browser. You can, and should, read more about + * it here: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide * - * @class SinglePipeline - * @extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines - * @constructor - * @since 3.50.0 + * If your video doesn't contain any audio, then set the `noAudio` parameter to `true` when the video is _loaded_, + * and it will often allow the video to play immediately: * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. - */ -var SinglePipeline = new Class({ - - Extends: MultiPipeline, - - initialize: - - function SinglePipeline (config) - { - config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS), - config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS), - config.forceZero = true; - - MultiPipeline.call(this, config); - }, - - boot: function () - { - WebGLPipeline.prototype.boot.call(this); - - this.set1i('uMainSampler', 0); - } - -}); - -module.exports = SinglePipeline; - - -/***/ }), -/* 381 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var AddBlendFS = __webpack_require__(884); -var BlendModes = __webpack_require__(35); -var Class = __webpack_require__(0); -var ColorMatrix = __webpack_require__(198); -var ColorMatrixFS = __webpack_require__(885); -var CopyFS = __webpack_require__(886); -var GetFastValue = __webpack_require__(2); -var LinearBlendFS = __webpack_require__(887); -var QuadVS = __webpack_require__(382); -var WebGLPipeline = __webpack_require__(58); - -/** - * @classdesc - * The Utility Pipeline is a special-use pipeline that belongs to the Pipeline Manager. + * ```javascript + * preload () { + * this.load.video('pixar', 'nemo.mp4', true); + * } + * ``` * - * It provides 4 shaders and handy associated methods: + * The 3rd parameter in the load call tells Phaser that the video doesn't contain any audio tracks. Video without + * audio can autoplay without requiring a user interaction. Video with audio cannot do this unless it satisfies + * the browsers MEI settings. See the MDN Autoplay Guide for further details. * - * 1) Copy Shader. A fast texture to texture copy shader with optional brightness setting. - * 2) Additive Blend Mode Shader. Blends two textures using an additive blend mode. - * 3) Linear Blend Mode Shader. Blends two textures using a linear blend mode. - * 4) Color Matrix Copy Shader. Draws a texture to a target using a Color Matrix. + * Or: * - * You do not extend this pipeline, but instead get a reference to it from the Pipeline - * Manager via the `setUtility` method. You can also access methods such as `copyFrame` - * directly from the Pipeline Manager. + * ```javascript + * create () { + * this.add.video(400, 300).loadURL('assets/aliens.mp4', true); + * } + * ``` * - * This pipeline provides methods for manipulating framebuffer backed textures, such as - * copying or blending one texture to another, copying a portion of a texture, additively - * blending two textures, flipping textures and more. + * You can set the `noAudio` parameter to `true` even if the video does contain audio. It will still allow the video + * to play immediately, but the audio will not start. * - * The default shader attributes for this pipeline are: + * Note that due to a bug in IE11 you cannot play a video texture to a Sprite in WebGL. For IE11 force Canvas mode. * - * `inPosition` (vec2, offset 0) - * `inTexCoord` (vec2, offset 8) + * More details about video playback and the supported media formats can be found on MDN: * - * This pipeline has a hard-coded batch size of 1 and a hard coded set of vertices. + * https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement + * https://developer.mozilla.org/en-US/docs/Web/Media/Formats * - * @class UtilityPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines + * @class Video + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects * @constructor - * @since 3.50.0 + * @since 3.20.0 * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.TextureCrop + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {string} [key] - Optional key of the Video this Game Object will play, as stored in the Video Cache. */ -var UtilityPipeline = new Class({ +var Video = new Class({ - Extends: WebGLPipeline, + Extends: GameObject, + + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.Depth, + Components.Flip, + Components.GetBounds, + Components.Mask, + Components.Origin, + Components.Pipeline, + Components.PostPipeline, + Components.ScrollFactor, + Components.Size, + Components.TextureCrop, + Components.Tint, + Components.Transform, + Components.Visible, + VideoRender + ], initialize: - function UtilityPipeline (config) + function Video (scene, x, y, key) { - config.renderTarget = GetFastValue(config, 'renderTarget', [ - { - scale: 1 - }, - { - scale: 1 - }, - { - scale: 0.5 - }, - { - scale: 0.5 - } - ]); - - config.vertShader = GetFastValue(config, 'vertShader', QuadVS); - - config.shaders = GetFastValue(config, 'shaders', [ - { - name: 'Copy', - fragShader: CopyFS - }, - { - name: 'AddBlend', - fragShader: AddBlendFS - }, - { - name: 'LinearBlend', - fragShader: LinearBlendFS - }, - { - name: 'ColorMatrix', - fragShader: ColorMatrixFS - } - ]); - - config.attributes = GetFastValue(config, 'attributes', [ - { - name: 'inPosition', - size: 2 - }, - { - name: 'inTexCoord', - size: 2 - } - ]); - - config.vertices = [ - -1, -1, 0, 0, - -1, 1, 0, 1, - 1, 1, 1, 1, - -1, -1, 0, 0, - 1, 1, 1, 1, - 1, -1, 1, 0 - ]; - - config.batchSize = 1; - - WebGLPipeline.call(this, config); + GameObject.call(this, scene, 'Video'); /** - * A default Color Matrix, used by the Color Matrix Shader when one - * isn't provided. + * A reference to the HTML Video Element this Video Game Object is playing. * - * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#colorMatrix - * @type {Phaser.Display.ColorMatrix} - * @since 3.50.0 + * Will be `undefined` until a video is loaded for playback. + * + * @name Phaser.GameObjects.Video#video + * @type {?HTMLVideoElement} + * @since 3.20.0 */ - this.colorMatrix = new ColorMatrix(); + this.video; /** - * A reference to the Copy Shader belonging to this Utility Pipeline. + * The Phaser Texture this Game Object is using to render the video to. * - * This property is set during the `boot` method. + * Will be `undefined` until a video is loaded for playback. * - * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyShader - * @type {Phaser.Renderer.WebGL.WebGLShader} - * @default null - * @since 3.50.0 + * @name Phaser.GameObjects.Video#videoTexture + * @type {?Phaser.Textures.Texture} + * @since 3.20.0 */ - this.copyShader; + this.videoTexture; /** - * A reference to the Additive Blend Shader belonging to this Utility Pipeline. + * A reference to the TextureSource backing the `videoTexture` Texture object. * - * This property is set during the `boot` method. + * Will be `undefined` until a video is loaded for playback. * - * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#addShader - * @type {Phaser.Renderer.WebGL.WebGLShader} - * @since 3.50.0 + * @name Phaser.GameObjects.Video#videoTextureSource + * @type {?Phaser.Textures.TextureSource} + * @since 3.20.0 */ - this.addShader; + this.videoTextureSource; /** - * A reference to the Linear Blend Shader belonging to this Utility Pipeline. + * A Phaser `CanvasTexture` instance that holds the most recent snapshot taken from the video. * - * This property is set during the `boot` method. + * This will only be set if the `snapshot` or `snapshotArea` methods have been called. * - * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#linearShader - * @type {Phaser.Renderer.WebGL.WebGLShader} - * @since 3.50.0 + * Until those methods are called, this property will be `undefined`. + * + * @name Phaser.GameObjects.Video#snapshotTexture + * @type {?Phaser.Textures.CanvasTexture} + * @since 3.20.0 */ - this.linearShader; + this.snapshotTexture; /** - * A reference to the Color Matrix Shader belonging to this Utility Pipeline. - * - * This property is set during the `boot` method. + * If you have saved this video to a texture via the `saveTexture` method, this controls if the video + * is rendered with `flipY` in WebGL or not. You often need to set this if you wish to use the video texture + * as the input source for a shader. If you find your video is appearing upside down within a shader or + * custom pipeline, flip this property. * - * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#colorMatrixShader - * @type {Phaser.Renderer.WebGL.WebGLShader} - * @since 3.50.0 + * @name Phaser.GameObjects.Video#flipY + * @type {boolean} + * @since 3.20.0 */ - this.colorMatrixShader; + this.flipY = false; /** - * A reference to the Full Frame 1 Render Target. + * The key used by the texture as stored in the Texture Manager. * - * This property is set during the `boot` method. + * @name Phaser.GameObjects.Video#_key + * @type {string} + * @private + * @since 3.20.0 + */ + this._key = UUID(); + + /** + * An internal flag holding the current state of the video lock, should document interaction be required + * before playback can begin. * - * This Render Target is the full size of the renderer. + * @name Phaser.GameObjects.Video#touchLocked + * @type {boolean} + * @readonly + * @since 3.20.0 + */ + this.touchLocked = false; + + /** + * Should the video auto play when document interaction is required and happens? * - * You can use this directly in Post FX Pipelines for multi-target effects. - * However, be aware that these targets are shared between all post fx pipelines. + * @name Phaser.GameObjects.Video#playWhenUnlocked + * @type {boolean} + * @since 3.20.0 + */ + this.playWhenUnlocked = false; + + /** + * Has the video created its texture and populated it with the first frame of video? * - * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#fullFrame1 - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @since 3.50.0 + * @name Phaser.GameObjects.Video#frameReady + * @type {boolean} + * @since 3.60.0 */ - this.fullFrame1; + this.frameReady = false; /** - * A reference to the Full Frame 2 Render Target. + * This read-only property returns `true` if the video is currently stalled, i.e. it has stopped + * playing due to a lack of data, or too much data, but hasn't yet reached the end of the video. * - * This property is set during the `boot` method. + * This is set if the Video DOM element emits any of the following events: * - * This Render Target is the full size of the renderer. + * `stalled` + * `suspend` + * `waiting` * - * You can use this directly in Post FX Pipelines for multi-target effects. - * However, be aware that these targets are shared between all post fx pipelines. + * And is cleared if the Video DOM element emits the `playing` event, or handles + * a requestVideoFrame call. * - * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#fullFrame2 - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @since 3.50.0 + * Listen for the Phaser Event `VIDEO_STALLED` to be notified and inspect the event + * to see which DOM event caused it. + * + * Note that being stalled isn't always a negative thing. A video can be stalled if it + * has downloaded enough data in to its buffer to not need to download any more until + * the current batch of frames have rendered. + * + * @name Phaser.GameObjects.Video#isStalled + * @type {boolean} + * @readonly + * @since 3.60.0 */ - this.fullFrame2; + this.isStalled = false; /** - * A reference to the Half Frame 1 Render Target. + * Records the number of times the video has failed to play, + * typically because the user hasn't interacted with the page yet. * - * This property is set during the `boot` method. + * @name Phaser.GameObjects.Video#failedPlayAttempts + * @type {number} + * @since 3.60.0 + */ + this.failedPlayAttempts = 0; + + /** + * If the browser supports the Request Video Frame API then this + * property will hold the metadata that is returned from + * the callback each time it is invoked. * - * This Render Target is half the size of the renderer. + * See https://wicg.github.io/video-rvfc/#video-frame-metadata-callback + * for a complete list of all properties that will be in this object. + * Likely of most interest is the `mediaTime` property: * - * You can use this directly in Post FX Pipelines for multi-target effects. - * However, be aware that these targets are shared between all post fx pipelines. + * The media presentation timestamp (PTS) in seconds of the frame presented + * (e.g. its timestamp on the video.currentTime timeline). MAY have a zero + * value for live-streams or WebRTC applications. * - * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#halfFrame1 - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @since 3.50.0 + * If the browser doesn't support the API then this property will be undefined. + * + * @name Phaser.GameObjects.Video#metadata + * @type {VideoFrameCallbackMetadata} + * @since 3.60.0 */ - this.halfFrame1; + this.metadata; /** - * A reference to the Half Frame 2 Render Target. - * - * This property is set during the `boot` method. + * The current retry elapsed time. * - * This Render Target is half the size of the renderer. - * - * You can use this directly in Post FX Pipelines for multi-target effects. - * However, be aware that these targets are shared between all post fx pipelines. + * @name Phaser.GameObjects.Video#retry + * @type {number} + * @since 3.20.0 + */ + this.retry = 0; + + /** + * If a video fails to play due to a lack of user interaction, this is the + * amount of time, in ms, that the video will wait before trying again to + * play. The default is 500ms. * - * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#halfFrame2 - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @since 3.50.0 + * @name Phaser.GameObjects.Video#retryInterval + * @type {number} + * @since 3.20.0 */ - this.halfFrame2; - }, + this.retryInterval = 500; - boot: function () - { - WebGLPipeline.prototype.boot.call(this); + /** + * The video was muted due to a system event, such as the game losing focus. + * + * @name Phaser.GameObjects.Video#_systemMuted + * @type {boolean} + * @private + * @since 3.20.0 + */ + this._systemMuted = false; - var shaders = this.shaders; - var targets = this.renderTargets; + /** + * The video was muted due to game code, not a system event. + * + * @name Phaser.GameObjects.Video#_codeMuted + * @type {boolean} + * @private + * @since 3.20.0 + */ + this._codeMuted = false; - this.copyShader = shaders[0]; - this.addShader = shaders[1]; - this.linearShader = shaders[2]; - this.colorMatrixShader = shaders[3]; + /** + * The video was paused due to a system event, such as the game losing focus. + * + * @name Phaser.GameObjects.Video#_systemPaused + * @type {boolean} + * @private + * @since 3.20.0 + */ + this._systemPaused = false; - this.fullFrame1 = targets[0]; - this.fullFrame2 = targets[1]; - this.halfFrame1 = targets[2]; - this.halfFrame2 = targets[3]; - }, + /** + * The video was paused due to game code, not a system event. + * + * @name Phaser.GameObjects.Video#_codePaused + * @type {boolean} + * @private + * @since 3.20.0 + */ + this._codePaused = false; - /** - * Copy the `source` Render Target to the `target` Render Target. + /** + * The locally bound event callback handlers. + * + * @name Phaser.GameObjects.Video#_callbacks + * @type {any} + * @private + * @since 3.20.0 + */ + this._callbacks = { + ended: this.completeHandler.bind(this), + legacy: this.legacyPlayHandler.bind(this), + playing: this.playingHandler.bind(this), + seeked: this.seekedHandler.bind(this), + seeking: this.seekingHandler.bind(this), + stalled: this.stalledHandler.bind(this), + suspend: this.stalledHandler.bind(this), + waiting: this.stalledHandler.bind(this) + }; + + /** + * The locally bound callback handler specifically for load and load error events. + * + * @name Phaser.GameObjects.Video#_loadCallbackHandler + * @type {function} + * @private + * @since 3.60.0 + */ + this._loadCallbackHandler = this.loadErrorHandler.bind(this); + + /** + * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. + * + * @name Phaser.GameObjects.Video#_crop + * @type {object} + * @private + * @since 3.20.0 + */ + this._crop = this.resetCropObject(); + + /** + * An object containing in and out markers for sequence playback. + * + * @name Phaser.GameObjects.Video#markers + * @type {any} + * @since 3.20.0 + */ + this.markers = {}; + + /** + * The in marker. + * + * @name Phaser.GameObjects.Video#_markerIn + * @type {number} + * @private + * @since 3.20.0 + */ + this._markerIn = 0; + + /** + * The out marker. + * + * @name Phaser.GameObjects.Video#_markerOut + * @type {number} + * @private + * @since 3.20.0 + */ + this._markerOut = 0; + + /** + * Are we playing a marked segment of the video? + * + * @name Phaser.GameObjects.Video#_playingMarker + * @type {boolean} + * @private + * @since 3.60.0 + */ + this._playingMarker = false; + + /** + * The previous frames mediaTime. + * + * @name Phaser.GameObjects.Video#_lastUpdate + * @type {number} + * @private + * @since 3.60.0 + */ + this._lastUpdate = 0; + + /** + * The key of the current video as stored in the Video cache. + * + * If the video did not come from the cache this will be an empty string. + * + * @name Phaser.GameObjects.Video#cacheKey + * @type {string} + * @readonly + * @since 3.60.0 + */ + this.cacheKey = ''; + + /** + * Is the video currently seeking? + * + * This is set to `true` when the `seeking` event is fired, + * and set to `false` when the `seeked` event is fired. + * + * @name Phaser.GameObjects.Video#isSeeking + * @type {boolean} + * @readonly + * @since 3.60.0 + */ + this.isSeeking = false; + + /** + * Has Video.play been called? This is reset if a new Video is loaded. + * + * @name Phaser.GameObjects.Video#_playCalled + * @type {boolean} + * @private + * @since 3.60.0 + */ + this._playCalled = false; + + /** + * The Callback ID returned by Request Video Frame. + * + * @name Phaser.GameObjects.Video#_rfvCallbackId + * @type {number} + * @private + * @since 3.60.0 + */ + this._rfvCallbackId = 0; + + var game = scene.sys.game; + + /** + * A reference to Device.Video. + * + * @name Phaser.GameObjects.Video#_device + * @type {string[]} + * @private + * @since 3.60.0 + */ + this._device = game.device.video; + + this.setPosition(x, y); + this.setSize(256, 256); + this.initPipeline(); + this.initPostPipeline(true); + + game.events.on(GameEvents.PAUSE, this.globalPause, this); + game.events.on(GameEvents.RESUME, this.globalResume, this); + + var sound = scene.sys.sound; + + if (sound) + { + sound.on(SoundEvents.GLOBAL_MUTE, this.globalMute, this); + } + + if (key) + { + this.load(key); + } + }, + + // Overrides Game Object method + addedToScene: function () + { + this.scene.sys.updateList.add(this); + }, + + // Overrides Game Object method + removedFromScene: function () + { + this.scene.sys.updateList.remove(this); + }, + + /** + * Loads a Video from the Video Cache, ready for playback with the `Video.play` method. * - * You can optionally set the brightness factor of the copy. + * If a video is already playing, this method allows you to change the source of the current video element. + * It works by first stopping the current video and then starts playback of the new source through the existing video element. * - * The difference between this method and `drawFrame` is that this method - * uses a faster copy shader, where only the brightness can be modified. - * If you need color level manipulation, see `drawFrame` instead. + * The reason you may wish to do this is because videos that require interaction to unlock, remain in an unlocked + * state, even if you change the source of the video. By changing the source to a new video you avoid having to + * go through the unlock process again. * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyFrame - * @since 3.50.0 + * @method Phaser.GameObjects.Video#load + * @since 3.60.0 * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. - * @param {number} [brightness=1] - The brightness value applied to the frame copy. - * @param {boolean} [clear=true] - Clear the target before copying? - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {string} key - The key of the Video this Game Object will play, as stored in the Video Cache. + * + * @return {this} This Video Game Object for method chaining. */ - copyFrame: function (source, target, brightness, clear, clearAlpha) + load: function (key) { - if (brightness === undefined) { brightness = 1; } - if (clear === undefined) { clear = true; } - if (clearAlpha === undefined) { clearAlpha = true; } - - var gl = this.gl; - - this.setShader(this.copyShader); - - this.set1i('uMainSampler', 0); - this.set1f('uBrightness', brightness); - - gl.activeTexture(gl.TEXTURE0); - gl.bindTexture(gl.TEXTURE_2D, source.texture); + var video = this.scene.sys.cache.video.get(key); - if (target) + if (video) { - gl.viewport(0, 0, target.width, target.height); - gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); + this.cacheKey = key; + + this.loadHandler(video.url, video.noAudio, video.crossOrigin); } else { - gl.viewport(0, 0, source.width, source.height); + console.warn('No video in cache for key: ' + key); } - if (clear) + return this; + }, + + /** + * This method allows you to change the source of the current video element. It works by first stopping the + * current video, if playing. Then deleting the video texture, if one has been created. Finally, it makes a + * new video texture and starts playback of the new source through the existing video element. + * + * The reason you may wish to do this is because videos that require interaction to unlock, remain in an unlocked + * state, even if you change the source of the video. By changing the source to a new video you avoid having to + * go through the unlock process again. + * + * @method Phaser.GameObjects.Video#changeSource + * @since 3.20.0 + * + * @param {string} key - The key of the Video this Game Object will swap to playing, as stored in the Video Cache. + * @param {boolean} [autoplay=true] - Should the video start playing immediately, once the swap is complete? + * @param {boolean} [loop=false] - Should the video loop automatically when it reaches the end? Please note that not all browsers support _seamless_ video looping for all encoding formats. + * @param {number} [markerIn] - Optional in marker time, in seconds, for playback of a sequence of the video. + * @param {number} [markerOut] - Optional out marker time, in seconds, for playback of a sequence of the video. + * + * @return {this} This Video Game Object for method chaining. + */ + changeSource: function (key, autoplay, loop, markerIn, markerOut) + { + if (autoplay === undefined) { autoplay = true; } + if (loop === undefined) { loop = false; } + + if (this.cacheKey !== key) { - if (clearAlpha) - { - gl.clearColor(0, 0, 0, 0); - } - else + this.load(key); + + if (autoplay) { - gl.clearColor(0, 0, 0, 1); + this.play(loop, markerIn, markerOut); } + } + }, - gl.clear(gl.COLOR_BUFFER_BIT); + /** + * Returns the key of the currently played video, as stored in the Video Cache. + * + * If the video did not come from the cache this will return an empty string. + * + * @method Phaser.GameObjects.Video#getVideoKey + * @since 3.20.0 + * + * @return {string} The key of the video being played from the Video Cache, if any. + */ + getVideoKey: function () + { + return this.cacheKey; + }, + + /** + * Loads a Video from the given URL, ready for playback with the `Video.play` method. + * + * If a video is already playing, this method allows you to change the source of the current video element. + * It works by first stopping the current video and then starts playback of the new source through the existing video element. + * + * The reason you may wish to do this is because videos that require interaction to unlock, remain in an unlocked + * state, even if you change the source of the video. By changing the source to a new video you avoid having to + * go through the unlock process again. + * + * @method Phaser.GameObjects.Video#loadURL + * @since 3.60.0 + * + * @param {(string|string[]|Phaser.Types.Loader.FileTypes.VideoFileURLConfig|Phaser.Types.Loader.FileTypes.VideoFileURLConfig[])} [urls] - The absolute or relative URL to load the video files from. + * @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it. + * @param {string} [crossOrigin] - The value to use for the `crossOrigin` property in the video load request. Either undefined, `anonymous` or `use-credentials`. If no value is given, `crossorigin` will not be set in the request. + * + * @return {this} This Video Game Object for method chaining. + */ + loadURL: function (urls, noAudio, crossOrigin) + { + if (noAudio === undefined) { noAudio = false; } + + var urlConfig = this._device.getVideoURL(urls); + + if (!urlConfig) + { + console.warn('No supported video format found for ' + urls); } + else + { + this.cacheKey = ''; - gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); - gl.drawArrays(gl.TRIANGLES, 0, 6); + this.loadHandler(urlConfig.url, noAudio, crossOrigin); + } - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - gl.bindTexture(gl.TEXTURE_2D, null); + return this; }, /** - * Copy the `source` Render Target to the `target` Render Target. + * Loads a Video from the given MediaStream object, ready for playback with the `Video.play` method. * - * The difference with this copy is that no resizing takes place. If the `source` - * Render Target is larger than the `target` then only a portion the same size as - * the `target` dimensions is copied across. + * @method Phaser.GameObjects.Video#loadMediaStream + * @since 3.50.0 * - * You can optionally set the brightness factor of the copy. + * @param {string} stream - The MediaStream object. + * @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it. + * @param {string} [crossOrigin] - The value to use for the `crossOrigin` property in the video load request. Either undefined, `anonymous` or `use-credentials`. If no value is given, `crossorigin` will not be set in the request. * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#blitFrame - * @since 3.50.0 + * @return {this} This Video Game Object for method chaining. + */ + loadMediaStream: function (stream, noAudio, crossOrigin) + { + return this.loadHandler(null, noAudio, crossOrigin, stream); + }, + + /** + * Internal method that loads a Video from the given URL, ready for playback with the + * `Video.play` method. * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. - * @param {number} [brightness=1] - The brightness value applied to the frame copy. - * @param {boolean} [clear=true] - Clear the target before copying? - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? - * @param {boolean} [eraseMode=false] - Erase source from target using ERASE Blend Mode? + * Normally you don't call this method directly, but instead use the `Video.loadURL` method, + * or the `Video.load` method if you have preloaded the video. + * + * Calling this method will skip checking if the browser supports the given format in + * the URL, where-as the other two methods enforce these checks. + * + * @method Phaser.GameObjects.Video#loadHandler + * @since 3.60.0 + * + * @param {string} [url] - The absolute or relative URL to load the video file from. Set to `null` if passing in a MediaStream object. + * @param {boolean} [noAudio] - Does the video have an audio track? If not you can enable auto-playing on it. + * @param {string} [crossOrigin] - The value to use for the `crossOrigin` property in the video load request. Either undefined, `anonymous` or `use-credentials`. If no value is given, `crossorigin` will not be set in the request. + * @param {string} [stream] - A MediaStream object if this is playing a stream instead of a file. + * + * @return {this} This Video Game Object for method chaining. */ - blitFrame: function (source, target, brightness, clear, clearAlpha, eraseMode) + loadHandler: function (url, noAudio, crossOrigin, stream) { - if (brightness === undefined) { brightness = 1; } - if (clear === undefined) { clear = true; } - if (clearAlpha === undefined) { clearAlpha = true; } - if (eraseMode === undefined) { eraseMode = false; } + if (!noAudio) { noAudio = false; } - var gl = this.gl; + var video = this.video; - this.setShader(this.copyShader); + if (video) + { + // Re-use the existing video element - this.set1i('uMainSampler', 0); - this.set1f('uBrightness', brightness); + this.removeLoadEventHandlers(); - gl.activeTexture(gl.TEXTURE0); - gl.bindTexture(gl.TEXTURE_2D, source.texture); + this.stop(); + } + else + { + video = document.createElement('video'); - if (source.height > target.height) + video.controls = false; + + video.setAttribute('playsinline', 'playsinline'); + video.setAttribute('preload', 'auto'); + video.setAttribute('disablePictureInPicture', 'true'); + } + + if (noAudio) { - gl.viewport(0, 0, source.width, source.height); + video.muted = true; + video.defaultMuted = true; - this.setTargetUVs(source, target); + video.setAttribute('autoplay', 'autoplay'); } else { - var diff = target.height - source.height; + video.muted = false; + video.defaultMuted = false; - gl.viewport(0, diff, source.width, source.height); + video.removeAttribute('autoplay'); } - gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); + if (!crossOrigin) + { + video.removeAttribute('crossorigin'); + } + else + { + video.setAttribute('crossorigin', crossOrigin); + } - if (clear) + if (stream) { - if (clearAlpha) + if ('srcObject' in video) { - gl.clearColor(0, 0, 0, 0); + try + { + video.srcObject = stream; + } + catch (err) + { + if (err.name !== 'TypeError') + { + throw err; + } + + video.src = URL.createObjectURL(stream); + } } else { - gl.clearColor(0, 0, 0, 1); + video.src = URL.createObjectURL(stream); } - - gl.clear(gl.COLOR_BUFFER_BIT); } - - if (eraseMode) + else { - var blendMode = this.renderer.currentBlendMode; - - this.renderer.setBlendMode(BlendModes.ERASE); + video.src = url; } - gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); - gl.drawArrays(gl.TRIANGLES, 0, 6); + this.addLoadEventHandlers(); - if (eraseMode) - { - this.renderer.setBlendMode(blendMode); - } + this.retry = 0; + this.video = video; - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - gl.bindTexture(gl.TEXTURE_2D, null); + this._playCalled = false; - this.resetUVs(); + video.load(); + + return this; }, /** - * Binds the `source` Render Target and then copies a section of it to the `target` Render Target. + * This method handles the Request Video Frame callback. * - * This method is extremely fast because it uses `gl.copyTexSubImage2D` and doesn't - * require the use of any shaders. Remember the coordinates are given in standard WebGL format, - * where x and y specify the lower-left corner of the section, not the top-left. Also, the - * copy entirely replaces the contents of the target texture, no 'merging' or 'blending' takes - * place. + * It is called by the browser when a new video frame is ready to be displayed. * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyFrameRect - * @since 3.50.0 + * It's also responsible for the creation of the video texture, if it doesn't + * already exist. If it does, it updates the texture as required. * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. - * @param {number} x - The x coordinate of the lower left corner where to start copying. - * @param {number} y - The y coordinate of the lower left corner where to start copying. - * @param {number} width - The width of the texture. - * @param {number} height - The height of the texture. - * @param {boolean} [clear=true] - Clear the target before copying? - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * For more details about the Request Video Frame callback, see: + * https://web.dev/requestvideoframecallback-rvfc + * + * @method Phaser.GameObjects.Video#requestVideoFrame + * @fires Phaser.GameObjects.Events#VIDEO_CREATED + * @fires Phaser.GameObjects.Events#VIDEO_LOOP + * @fires Phaser.GameObjects.Events#VIDEO_COMPLETE + * @fires Phaser.GameObjects.Events#VIDEO_PLAY + * @fires Phaser.GameObjects.Events#VIDEO_TEXTURE + * @since 3.60.0 + * + * @param {DOMHighResTimeStamp} now - The current time in milliseconds. + * @param {VideoFrameCallbackMetadata} metadata - Useful metadata about the video frame that was most recently presented for composition. See https://wicg.github.io/video-rvfc/#video-frame-metadata-callback */ - copyFrameRect: function (source, target, x, y, width, height, clear, clearAlpha) + requestVideoFrame: function (now, metadata) { - if (clear === undefined) { clear = true; } - if (clearAlpha === undefined) { clearAlpha = true; } + var video = this.video; - var gl = this.gl; + if (!video) + { + return; + } - gl.bindFramebuffer(gl.FRAMEBUFFER, source.framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, source.texture, 0); + var width = metadata.width; + var height = metadata.height; - if (clear) + var texture = this.videoTexture; + var textureSource = this.videoTextureSource; + var newVideo = (!texture || textureSource.source !== video); + + if (newVideo) { - if (clearAlpha) + // First frame of a new video + this._codePaused = video.paused; + this._codeMuted = video.muted; + + if (!texture) { - gl.clearColor(0, 0, 0, 0); + texture = this.scene.sys.textures.create(this._key, video, width, height); + + texture.add('__BASE', 0, 0, 0, width, height); + + this.setTexture(texture); + + this.videoTexture = texture; + this.videoTextureSource = texture.source[0]; + + this.videoTextureSource.setFlipY(this.flipY); + + this.emit(Events.VIDEO_TEXTURE, this, texture); } else { - gl.clearColor(0, 0, 0, 1); + // Re-use the existing texture + textureSource.source = video; + textureSource.width = width; + textureSource.height = height; + + // Resize base frame + texture.get().setSize(width, height); } - gl.clear(gl.COLOR_BUFFER_BIT); + this.setSizeToFrame(); + this.updateDisplayOrigin(); + } + else + { + textureSource.update(); } - gl.activeTexture(gl.TEXTURE0); - gl.bindTexture(gl.TEXTURE_2D, target.texture); + this.isStalled = false; - gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, x, y, width, height); + this.metadata = metadata; - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - gl.bindTexture(gl.TEXTURE_2D, null); - }, + var currentTime = metadata.mediaTime; - /** - * Pops the framebuffer from the renderers FBO stack and sets that as the active target, - * then draws the `source` Render Target to it. It then resets the renderer textures. - * - * This should be done when you need to draw the _final_ results of a pipeline to the game - * canvas, or the next framebuffer in line on the FBO stack. You should only call this once - * in the `onDraw` handler and it should be the final thing called. Be careful not to call - * this if you need to actually use the pipeline shader, instead of the copy shader. In - * those cases, use the `bindAndDraw` method. - * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyToGame - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. - */ - copyToGame: function (source) - { - var gl = this.gl; + if (newVideo) + { + this._lastUpdate = currentTime; - this.setShader(this.copyShader); + this.emit(Events.VIDEO_CREATED, this, width, height); - this.set1i('uMainSampler', 0); - this.set1f('uBrightness', 1); + if (!this.frameReady) + { + this.frameReady = true; - this.renderer.popFramebuffer(); + this.emit(Events.VIDEO_PLAY, this); + } + } - gl.activeTexture(gl.TEXTURE0); - gl.bindTexture(gl.TEXTURE_2D, source.texture); + if (this._playingMarker) + { + if (currentTime >= this._markerOut) + { + if (video.loop) + { + video.currentTime = this._markerIn; - gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); - gl.drawArrays(gl.TRIANGLES, 0, 6); + this.emit(Events.VIDEO_LOOP, this); + } + else + { + this.stop(false); + + this.emit(Events.VIDEO_COMPLETE, this); + } + } + } + else if (currentTime < this._lastUpdate) + { + this.emit(Events.VIDEO_LOOP, this); + } + + this._lastUpdate = currentTime; - this.renderer.resetTextures(); + this._rfvCallbackId = this.video.requestVideoFrameCallback(this.requestVideoFrame.bind(this)); }, /** - * Copy the `source` Render Target to the `target` Render Target, using the - * given Color Matrix. + * Starts this video playing. * - * The difference between this method and `copyFrame` is that this method - * uses a color matrix shader, where you have full control over the luminance - * values used during the copy. If you don't need this, you can use the faster - * `copyFrame` method instead. + * If the video is already playing, or has been queued to play with `changeSource` then this method just returns. * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#drawFrame - * @since 3.50.0 + * Videos can only autoplay if the browser has been unlocked. This happens if you have interacted with the browser, i.e. + * by clicking on it or pressing a key, or due to server settings. The policies that control autoplaying are vast and + * vary between browser. You can read more here: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? - * @param {Phaser.Display.ColorMatrix} [colorMatrix] - The Color Matrix to use when performing the draw. + * If your video doesn't contain any audio, then set the `noAudio` parameter to `true` when the video is loaded, + * and it will often allow the video to play immediately: + * + * ```javascript + * preload () { + * this.load.video('pixar', 'nemo.mp4', true); + * } + * ``` + * + * The 3rd parameter in the load call tells Phaser that the video doesn't contain any audio tracks. Video without + * audio can autoplay without requiring a user interaction. Video with audio cannot do this unless it satisfies + * the browsers MEI settings. See the MDN Autoplay Guide for details. + * + * If you need audio in your videos, then you'll have to consider the fact that the video cannot start playing until the + * user has interacted with the browser, into your game flow. + * + * @method Phaser.GameObjects.Video#play + * @since 3.20.0 + * + * @param {boolean} [loop=false] - Should the video loop automatically when it reaches the end? Please note that not all browsers support _seamless_ video looping for all encoding formats. + * @param {number} [markerIn] - Optional in marker time, in seconds, for playback of a sequence of the video. + * @param {number} [markerOut] - Optional out marker time, in seconds, for playback of a sequence of the video. + * + * @return {this} This Video Game Object for method chaining. */ - drawFrame: function (source, target, clearAlpha, colorMatrix) + play: function (loop, markerIn, markerOut) { - if (clearAlpha === undefined) { clearAlpha = true; } - if (colorMatrix === undefined) { colorMatrix = this.colorMatrix; } + if (markerIn === undefined) { markerIn = -1; } + if (markerOut === undefined) { markerOut = MATH_CONST.MAX_SAFE_INTEGER; } - var gl = this.gl; + var video = this.video; - this.setShader(this.colorMatrixShader); + if (!video || this.isPlaying()) + { + if (!video) + { + console.warn('Video not loaded'); + } - this.set1i('uMainSampler', 0); - this.set1fv('uColorMatrix', colorMatrix.getData()); - this.set1f('uAlpha', colorMatrix.alpha); + return this; + } - gl.activeTexture(gl.TEXTURE0); - gl.bindTexture(gl.TEXTURE_2D, source.texture); + // We can reset these each time play is called, even if the video hasn't started yet - if (target) - { - gl.viewport(0, 0, target.width, target.height); - gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); - } - else - { - gl.viewport(0, 0, source.width, source.height); - } + if (loop === undefined) { loop = video.loop; } - if (clearAlpha) - { - gl.clearColor(0, 0, 0, 0); - } - else + video.loop = loop; + + this._markerIn = markerIn; + this._markerOut = markerOut; + this._playingMarker = (markerIn > -1 && markerOut > markerIn && markerOut < MATH_CONST.MAX_SAFE_INTEGER); + + // But we go no further if play has already been called + + if (!this._playCalled) { - gl.clearColor(0, 0, 0, 1); - } + this._rfvCallbackId = video.requestVideoFrameCallback(this.requestVideoFrame.bind(this)); - gl.clear(gl.COLOR_BUFFER_BIT); + this._playCalled = true; - gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); - gl.drawArrays(gl.TRIANGLES, 0, 6); + this.createPlayPromise(); + } - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - gl.bindTexture(gl.TEXTURE_2D, null); + return this; }, /** - * Draws the `source1` and `source2` Render Targets to the `target` Render Target - * using a linear blend effect, which is controlled by the `strength` parameter. - * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#blendFrames - * @since 3.50.0 + * Adds the loading specific event handlers to the video element. * - * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. - * @param {number} [strength=1] - The strength of the blend. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? - * @param {Phaser.Renderer.WebGL.WebGLShader} [blendShader] - The shader to use during the blend copy. + * @method Phaser.GameObjects.Video#addLoadEventHandlers + * @since 3.60.0 */ - blendFrames: function (source1, source2, target, strength, clearAlpha, blendShader) + addLoadEventHandlers: function () { - if (strength === undefined) { strength = 1; } - if (clearAlpha === undefined) { clearAlpha = true; } - if (blendShader === undefined) { blendShader = this.linearShader; } - - var gl = this.gl; - - this.setShader(blendShader); - - this.set1i('uMainSampler1', 0); - this.set1i('uMainSampler2', 1); - this.set1f('uStrength', strength); - - gl.activeTexture(gl.TEXTURE0); - gl.bindTexture(gl.TEXTURE_2D, source1.texture); - - gl.activeTexture(gl.TEXTURE1); - gl.bindTexture(gl.TEXTURE_2D, source2.texture); + var video = this.video; - if (target) - { - gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); - gl.viewport(0, 0, target.width, target.height); - } - else + if (video) { - gl.viewport(0, 0, source1.width, source1.height); + video.addEventListener('error', this._loadCallbackHandler); + video.addEventListener('abort', this._loadCallbackHandler); } + }, - if (clearAlpha) - { - gl.clearColor(0, 0, 0, 0); - } - else + /** + * Removes the loading specific event handlers from the video element. + * + * @method Phaser.GameObjects.Video#removeLoadEventHandlers + * @since 3.60.0 + */ + removeLoadEventHandlers: function () + { + var video = this.video; + + if (video) { - gl.clearColor(0, 0, 0, 1); + video.removeEventListener('error', this._loadCallbackHandler); + video.removeEventListener('abort', this._loadCallbackHandler); } + }, - gl.clear(gl.COLOR_BUFFER_BIT); + /** + * Adds the playback specific event handlers to the video element. + * + * @method Phaser.GameObjects.Video#addEventHandlers + * @since 3.60.0 + */ + addEventHandlers: function () + { + var video = this.video; - gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); - gl.drawArrays(gl.TRIANGLES, 0, 6); + // Set these _after_ calling `video.play` or they don't fire + // (really useful, thanks browsers!) - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - gl.bindTexture(gl.TEXTURE_2D, null); + if (video) + { + var callbacks = this._callbacks; + + for (var callback in callbacks) + { + video.addEventListener(callback, callbacks[callback]); + } + } }, /** - * Draws the `source1` and `source2` Render Targets to the `target` Render Target - * using an additive blend effect, which is controlled by the `strength` parameter. - * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#blendFramesAdditive - * @since 3.50.0 + * Removes the playback specific event handlers from the video element. * - * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. - * @param {number} [strength=1] - The strength of the blend. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @method Phaser.GameObjects.Video#removeEventHandlers + * @since 3.60.0 */ - blendFramesAdditive: function (source1, source2, target, strength, clearAlpha) + removeEventHandlers: function () { - this.blendFrames(source1, source2, target, strength, clearAlpha, this.addShader); + var video = this.video; + + if (video) + { + var callbacks = this._callbacks; + + for (var callback in callbacks) + { + video.removeEventListener(callback, callbacks[callback]); + } + } }, /** - * Clears the given Render Target. + * Creates the video.play promise and adds the success and error handlers to it. * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#clearFrame - * @since 3.50.0 + * Not all browsers support the video.play promise, so this method will fall back to + * the old-school way of handling the video.play call. * - * @param {Phaser.Renderer.WebGL.RenderTarget} target - The Render Target to clear. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * See https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play#browser_compatibility for details. + * + * @method Phaser.GameObjects.Video#createPlayPromise + * @since 3.60.0 + * + * @param {boolean} [catchError=true] - Should the error be caught and the video marked as failed to play? */ - clearFrame: function (target, clearAlpha) + createPlayPromise: function (catchError) { - if (clearAlpha === undefined) { clearAlpha = true; } - - var gl = this.gl; + if (catchError === undefined) { catchError = true; } - gl.viewport(0, 0, target.width, target.height); + var video = this.video; - gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + var playPromise = video.play(); - if (clearAlpha) + if (playPromise !== undefined) { - gl.clearColor(0, 0, 0, 0); + var success = this.playSuccess.bind(this); + var error = this.playError.bind(this); + + if (!catchError) + { + var _this = this; + + error = function () + { + _this.failedPlayAttempts++; + }; + } + + playPromise.then(success).catch(error); } else { - gl.clearColor(0, 0, 0, 1); - } + // Old-school fallback here for pre-2019 browsers + video.addEventListener('playing', this._callbacks.legacy); - gl.clear(gl.COLOR_BUFFER_BIT); - - var fbo = this.renderer.currentFramebuffer; - - gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); + if (!catchError) + { + this.failedPlayAttempts++; + } + } }, /** - * Set the UV values for the 6 vertices that make up the quad used by the shaders - * in the Utility Pipeline. + * Adds a sequence marker to this video. * - * Be sure to call `resetUVs` once you have finished manipulating the UV coordinates. + * Markers allow you to split a video up into sequences, delineated by a start and end time, given in seconds. * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#setUVs - * @since 3.50.0 + * You can then play back specific markers via the `playMarker` method. * - * @param {number} uA - The u value of vertex A. - * @param {number} vA - The v value of vertex A. - * @param {number} uB - The u value of vertex B. - * @param {number} vB - The v value of vertex B. - * @param {number} uC - The u value of vertex C. - * @param {number} vC - The v value of vertex C. - * @param {number} uD - The u value of vertex D. - * @param {number} vD - The v value of vertex D. + * Note that marker timing is _not_ frame-perfect. You should construct your videos in such a way that you allow for + * plenty of extra padding before and after each sequence to allow for discrepancies in browser seek and currentTime accuracy. + * + * See https://github.com/w3c/media-and-entertainment/issues/4 for more details about this issue. + * + * @method Phaser.GameObjects.Video#addMarker + * @since 3.20.0 + * + * @param {string} key - A unique name to give this marker. + * @param {number} markerIn - The time, in seconds, representing the start of this marker. + * @param {number} markerOut - The time, in seconds, representing the end of this marker. + * + * @return {this} This Video Game Object for method chaining. */ - setUVs: function (uA, vA, uB, vB, uC, vC, uD, vD) + addMarker: function (key, markerIn, markerOut) { - var vertexViewF32 = this.vertexViewF32; + if (!isNaN(markerIn) && markerIn >= 0 && !isNaN(markerOut) && markerOut > markerIn) + { + this.markers[key] = [ markerIn, markerOut ]; + } - vertexViewF32[2] = uA; - vertexViewF32[3] = vA; - vertexViewF32[6] = uB; - vertexViewF32[7] = vB; - vertexViewF32[10] = uC; - vertexViewF32[11] = vC; - vertexViewF32[14] = uA; - vertexViewF32[15] = vA; - vertexViewF32[18] = uC; - vertexViewF32[19] = vC; - vertexViewF32[22] = uD; - vertexViewF32[23] = vD; + return this; }, /** - * Sets the vertex UV coordinates of the quad used by the shaders in the Utility Pipeline - * so that they correctly adjust the texture coordinates for a blit frame effect. + * Plays a pre-defined sequence in this video. * - * Be sure to call `resetUVs` once you have finished manipulating the UV coordinates. + * Markers allow you to split a video up into sequences, delineated by a start and end time, given in seconds and + * specified via the `addMarker` method. * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#setTargetUVs - * @since 3.50.0 + * Note that marker timing is _not_ frame-perfect. You should construct your videos in such a way that you allow for + * plenty of extra padding before and after each sequence to allow for discrepancies in browser seek and currentTime accuracy. * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. + * See https://github.com/w3c/media-and-entertainment/issues/4 for more details about this issue. + * + * @method Phaser.GameObjects.Video#playMarker + * @since 3.20.0 + * + * @param {string} key - The name of the marker sequence to play. + * @param {boolean} [loop=false] - Should the video loop automatically when it reaches the end? Please note that not all browsers support _seamless_ video looping for all encoding formats. + * + * @return {this} This Video Game Object for method chaining. */ - setTargetUVs: function (source, target) + playMarker: function (key, loop) { - var diff = (target.height / source.height); + var marker = this.markers[key]; - if (diff > 0.5) - { - diff = 0.5 - (diff - 0.5); - } - else + if (marker) { - diff = 0.5 + (0.5 - diff); + this.play(loop, marker[0], marker[1]); } - this.setUVs(0, diff, 0, 1 + diff, 1, 1 + diff, 1, diff); + return this; }, /** - * Horizontally flips the UV coordinates of the quad used by the shaders in this - * Utility Pipeline. + * Removes a previously set marker from this video. * - * Be sure to call `resetUVs` once you have finished manipulating the UV coordinates. + * If the marker is currently playing it will _not_ stop playback. * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#flipX - * @since 3.50.0 + * @method Phaser.GameObjects.Video#removeMarker + * @since 3.20.0 + * + * @param {string} key - The name of the marker to remove. + * + * @return {this} This Video Game Object for method chaining. */ - flipX: function () + removeMarker: function (key) { - this.setUVs(1, 0, 1, 1, 0, 1, 0, 0); + delete this.markers[key]; + + return this; }, /** - * Vertically flips the UV coordinates of the quad used by the shaders in this - * Utility Pipeline. + * Takes a snapshot of the current frame of the video and renders it to a CanvasTexture object, + * which is then returned. You can optionally resize the grab by passing a width and height. * - * Be sure to call `resetUVs` once you have finished manipulating the UV coordinates. + * This method returns a reference to the `Video.snapshotTexture` object. Calling this method + * multiple times will overwrite the previous snapshot with the most recent one. * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#flipY - * @since 3.50.0 + * @method Phaser.GameObjects.Video#snapshot + * @since 3.20.0 + * + * @param {number} [width] - The width of the resulting CanvasTexture. + * @param {number} [height] - The height of the resulting CanvasTexture. + * + * @return {Phaser.Textures.CanvasTexture} */ - flipY: function () + snapshot: function (width, height) { - this.setUVs(0, 1, 0, 0, 1, 0, 1, 1); + if (width === undefined) { width = this.width; } + if (height === undefined) { height = this.height; } + + return this.snapshotArea(0, 0, this.width, this.height, width, height); }, /** - * Resets the quad vertice UV values to their default settings. + * Takes a snapshot of the specified area of the current frame of the video and renders it to a CanvasTexture object, + * which is then returned. You can optionally resize the grab by passing a different `destWidth` and `destHeight`. * - * The quad is used by all shaders of the Utility Pipeline. + * This method returns a reference to the `Video.snapshotTexture` object. Calling this method + * multiple times will overwrite the previous snapshot with the most recent one. * - * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#resetUVs - * @since 3.50.0 + * @method Phaser.GameObjects.Video#snapshotArea + * @since 3.20.0 + * + * @param {number} [x=0] - The horizontal location of the top-left of the area to grab from. + * @param {number} [y=0] - The vertical location of the top-left of the area to grab from. + * @param {number} [srcWidth] - The width of area to grab from the video. If not given it will grab the full video dimensions. + * @param {number} [srcHeight] - The height of area to grab from the video. If not given it will grab the full video dimensions. + * @param {number} [destWidth] - The destination width of the grab, allowing you to resize it. + * @param {number} [destHeight] - The destination height of the grab, allowing you to resize it. + * + * @return {Phaser.Textures.CanvasTexture} */ - resetUVs: function () + snapshotArea: function (x, y, srcWidth, srcHeight, destWidth, destHeight) { - this.setUVs(0, 0, 0, 1, 1, 1, 1, 0); - } - -}); - -module.exports = UtilityPipeline; - - -/***/ }), -/* 382 */ -/***/ (function(module, exports) { - -module.exports = [ - '#define SHADER_NAME PHASER_QUAD_VS', - '', - 'precision mediump float;', - '', - 'attribute vec2 inPosition;', - 'attribute vec2 inTexCoord;', - '', - 'varying vec2 outFragCoord;', - 'varying vec2 outTexCoord;', - '', - 'void main ()', - '{', - ' outFragCoord = inPosition.xy * 0.5 + 0.5;', - ' outTexCoord = inTexCoord;', - '', - ' gl_Position = vec4(inPosition, 0, 1);', - '}', - '' -].join('\n'); - - -/***/ }), -/* 383 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (srcWidth === undefined) { srcWidth = this.width; } + if (srcHeight === undefined) { srcHeight = this.height; } + if (destWidth === undefined) { destWidth = srcWidth; } + if (destHeight === undefined) { destHeight = srcHeight; } -var CanvasPool = __webpack_require__(31); -var Color = __webpack_require__(38); -var GetFastValue = __webpack_require__(2); + var video = this.video; + var snap = this.snapshotTexture; -/** - * Takes a snapshot of an area from the current frame displayed by a WebGL canvas. - * - * This is then copied to an Image object. When this loads, the results are sent - * to the callback provided in the Snapshot Configuration object. - * - * @function Phaser.Renderer.Snapshot.WebGL - * @since 3.0.0 - * - * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. - * @param {Phaser.Types.Renderer.Snapshot.SnapshotState} config - The snapshot configuration object. - */ -var WebGLSnapshot = function (sourceCanvas, config) -{ - var gl = sourceCanvas.getContext('experimental-webgl'); + if (!snap) + { + snap = this.scene.sys.textures.createCanvas(UUID(), destWidth, destHeight); - var callback = GetFastValue(config, 'callback'); - var type = GetFastValue(config, 'type', 'image/png'); - var encoderOptions = GetFastValue(config, 'encoder', 0.92); - var x = GetFastValue(config, 'x', 0); - var y = GetFastValue(config, 'y', 0); + this.snapshotTexture = snap; - var getPixel = GetFastValue(config, 'getPixel', false); + if (video) + { + snap.context.drawImage(video, x, y, srcWidth, srcHeight, 0, 0, destWidth, destHeight); + } + } + else + { + snap.setSize(destWidth, destHeight); - var isFramebuffer = GetFastValue(config, 'isFramebuffer', false); + if (video) + { + snap.context.drawImage(video, x, y, srcWidth, srcHeight, 0, 0, destWidth, destHeight); + } + } - var bufferWidth = (isFramebuffer) ? GetFastValue(config, 'bufferWidth', 1) : gl.drawingBufferWidth; - var bufferHeight = (isFramebuffer) ? GetFastValue(config, 'bufferHeight', 1) : gl.drawingBufferHeight; + return snap.update(); + }, - if (getPixel) + /** + * Stores a copy of this Videos `snapshotTexture` in the Texture Manager using the given key. + * + * This texture is created when the `snapshot` or `snapshotArea` methods are called. + * + * After doing this, any texture based Game Object, such as a Sprite, can use the contents of the + * snapshot by using the texture key: + * + * ```javascript + * var vid = this.add.video(0, 0, 'intro'); + * + * vid.snapshot(); + * + * vid.saveSnapshotTexture('doodle'); + * + * this.add.image(400, 300, 'doodle'); + * ``` + * + * Updating the contents of the `snapshotTexture`, for example by calling `snapshot` again, + * will automatically update _any_ Game Object that is using it as a texture. + * Calling `saveSnapshotTexture` again will not save another copy of the same texture, + * it will just rename the existing one. + * + * By default it will create a single base texture. You can add frames to the texture + * by using the `Texture.add` method. After doing this, you can then allow Game Objects + * to use a specific frame. + * + * @method Phaser.GameObjects.Video#saveSnapshotTexture + * @since 3.20.0 + * + * @param {string} key - The unique key to store the texture as within the global Texture Manager. + * + * @return {Phaser.Textures.CanvasTexture} The Texture that was saved. + */ + saveSnapshotTexture: function (key) { - var pixel = new Uint8Array(4); - - var destY = (isFramebuffer) ? y : bufferHeight - y; + if (this.snapshotTexture) + { + this.scene.sys.textures.renameTexture(this.snapshotTexture.key, key); + } + else + { + this.snapshotTexture = this.scene.sys.textures.createCanvas(key, this.width, this.height); + } - gl.readPixels(x, destY, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel); + return this.snapshotTexture; + }, - callback.call(null, new Color(pixel[0], pixel[1], pixel[2], pixel[3] / 255)); - } - else + /** + * This internal method is called automatically if the playback Promise resolves successfully. + * + * @method Phaser.GameObjects.Video#playSuccess + * @fires Phaser.GameObjects.Events#VIDEO_UNLOCKED + * @since 3.60.0 + */ + playSuccess: function () { - var width = GetFastValue(config, 'width', bufferWidth); - var height = GetFastValue(config, 'height', bufferHeight); - - var total = width * height * 4; - - var pixels = new Uint8Array(total); + if (!this._playCalled) + { + // The stop method has been called but the Promise has resolved + // after this, so we need to just abort. + return; + } - gl.readPixels(x, bufferHeight - y - height, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + this.addEventHandlers(); - var canvas = CanvasPool.createWebGL(this, width, height); - var ctx = canvas.getContext('2d'); + this._codePaused = false; - var imageData = ctx.getImageData(0, 0, width, height); + if (this.touchLocked) + { + this.touchLocked = false; - var data = imageData.data; + this.emit(Events.VIDEO_UNLOCKED, this); + } - // var destIndex = (isFramebuffer) ? total - ((py * width + (width - px)) * 4) : (py * width + px) * 4; + var sound = this.scene.sys.sound; - for (var py = 0; py < height; py++) + if (sound && sound.mute) { - for (var px = 0; px < width; px++) - { - var sourceIndex = ((height - py - 1) * width + px) * 4; - var destIndex = (py * width + px) * 4; - - data[destIndex + 0] = pixels[sourceIndex + 0]; - data[destIndex + 1] = pixels[sourceIndex + 1]; - data[destIndex + 2] = pixels[sourceIndex + 2]; - data[destIndex + 3] = pixels[sourceIndex + 3]; - } + // Mute will be set based on the global mute state of the Sound Manager (if there is one) + this.setMute(true); } - ctx.putImageData(imageData, 0, 0); + if (this._markerIn > -1) + { + this.video.currentTime = this._markerIn; + } + }, - var image = new Image(); + /** + * This internal method is called automatically if the playback Promise fails to resolve. + * + * @method Phaser.GameObjects.Video#playError + * @fires Phaser.GameObjects.Events#VIDEO_ERROR + * @fires Phaser.GameObjects.Events#VIDEO_UNSUPPORTED + * @fires Phaser.GameObjects.Events#VIDEO_LOCKED + * @since 3.60.0 + * + * @param {DOMException} error - The Promise DOM Exception error. + */ + playError: function (error) + { + var name = error.name; - image.onerror = function () + if (name === 'NotAllowedError') { - callback.call(null); + this.touchLocked = true; + this.playWhenUnlocked = true; + this.failedPlayAttempts = 1; - CanvasPool.remove(canvas); - }; + this.emit(Events.VIDEO_LOCKED, this); + } + else if (name === 'NotSupportedError') + { + this.stop(false); - image.onload = function () + this.emit(Events.VIDEO_UNSUPPORTED, this, error); + } + else { - callback.call(null, image); + this.stop(false); - CanvasPool.remove(canvas); - }; + this.emit(Events.VIDEO_ERROR, this, error); + } + }, - image.src = canvas.toDataURL(type, encoderOptions); - } -}; + /** + * Called when the video emits a `playing` event. + * + * This is the legacy handler for browsers that don't support Promise based playback. + * + * @method Phaser.GameObjects.Video#legacyPlayHandler + * @since 3.60.0 + */ + legacyPlayHandler: function () + { + var video = this.video; -module.exports = WebGLSnapshot; + if (video) + { + this.playSuccess(); + video.removeEventListener('playing', this._callbacks.legacy); + } + }, -/***/ }), -/* 384 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Called when the video emits a `playing` event. + * + * @method Phaser.GameObjects.Video#playingHandler + * @fires Phaser.GameObjects.Events#VIDEO_PLAYING + * @since 3.60.0 + */ + playingHandler: function () + { + this.isStalled = false; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.emit(Events.VIDEO_PLAYING, this); + }, -var CONST = __webpack_require__(33); + /** + * This internal method is called automatically if the video fails to load. + * + * @method Phaser.GameObjects.Video#loadErrorHandler + * @fires Phaser.GameObjects.Events#VIDEO_ERROR + * @since 3.20.0 + * + * @param {Event} event - The error Event. + */ + loadErrorHandler: function (event) + { + this.stop(false); -/** - * Called automatically by Phaser.Game and responsible for creating the console.log debug header. - * - * You can customize or disable the header via the Game Config object. - * - * @function Phaser.Core.DebugHeader - * @since 3.0.0 - * - * @param {Phaser.Game} game - The Phaser.Game instance which will output this debug header. - */ -var DebugHeader = function (game) -{ - var config = game.config; + this.emit(Events.VIDEO_ERROR, this, event); + }, - if (config.hideBanner) + /** + * This internal method is called automatically if the video stalls, for whatever reason. + * + * @method Phaser.GameObjects.Video#stalledHandler + * @fires Phaser.GameObjects.Events#VIDEO_STALLED + * @since 3.60.0 + * + * @param {Event} event - The error Event. + */ + stalledHandler: function (event) { - return; - } + this.isStalled = true; - var renderType = 'WebGL'; + this.emit(Events.VIDEO_STALLED, this, event); + }, - if (config.renderType === CONST.CANVAS) - { - renderType = 'Canvas'; - } - else if (config.renderType === CONST.HEADLESS) + /** + * Called when the video completes playback, i.e. reaches an `ended` state. + * + * This will never happen if the video is coming from a live stream, where the duration is `Infinity`. + * + * @method Phaser.GameObjects.Video#completeHandler + * @fires Phaser.GameObjects.Events#VIDEO_COMPLETE + * @since 3.20.0 + */ + completeHandler: function () { - renderType = 'Headless'; - } - - var audioConfig = config.audio; - var deviceAudio = game.device.audio; + this._playCalled = false; - var audioType; + this.emit(Events.VIDEO_COMPLETE, this); + }, - if (deviceAudio.webAudio && !audioConfig.disableWebAudio) - { - audioType = 'Web Audio'; - } - else if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData)) - { - audioType = 'No Audio'; - } - else + /** + * The internal update step. + * + * @method Phaser.GameObjects.Video#preUpdate + * @private + * @since 3.20.0 + * + * @param {number} time - The current timestamp. + * @param {number} delta - The delta time in ms since the last frame. + */ + preUpdate: function (time, delta) { - audioType = 'HTML5 Audio'; - } + var video = this.video; - if (!game.device.browser.ie) - { - var c = ''; - var args = [ c ]; + if (!video || !this._playCalled) + { + return; + } - if (Array.isArray(config.bannerBackgroundColor)) + if (this.touchLocked && this.playWhenUnlocked) { - var lastColor; + this.retry += delta; - config.bannerBackgroundColor.forEach(function (color) + if (this.retry >= this.retryInterval) { - c = c.concat('%c '); - - args.push('background: ' + color); - - lastColor = color; - - }); - - // inject the text color - args[args.length - 1] = 'color: ' + config.bannerTextColor + '; background: ' + lastColor; - } - else - { - c = c.concat('%c '); + this.createPlayPromise(false); - args.push('color: ' + config.bannerTextColor + '; background: ' + config.bannerBackgroundColor); + this.retry = 0; + } } + }, - // URL link background color (always transparent to support different browser themes) - args.push('background: transparent'); + /** + * Seeks to a given point in the video. The value is given as a float between 0 and 1, + * where 0 represents the start of the video and 1 represents the end. + * + * Seeking only works if the video has a duration, so will not work for live streams. + * + * When seeking begins, this video will emit a `seeking` event. When the video completes + * seeking (i.e. reaches its designated timestamp) it will emit a `seeked` event. + * + * If you wish to seek based on time instead, use the `Video.setCurrentTime` method. + * + * Unfortunately, the DOM video element does not guarantee frame-accurate seeking. + * This has been an ongoing subject of discussion: https://github.com/w3c/media-and-entertainment/issues/4 + * + * @method Phaser.GameObjects.Video#seekTo + * @since 3.20.0 + * + * @param {number} value - The point in the video to seek to. A value between 0 and 1. + * + * @return {this} This Video Game Object for method chaining. + */ + seekTo: function (value) + { + var video = this.video; - if (config.gameTitle) + if (video) { - c = c.concat(config.gameTitle); + var duration = video.duration; - if (config.gameVersion) + if (duration !== Infinity && !isNaN(duration)) { - c = c.concat(' v' + config.gameVersion); - } + var seekTime = duration * value; - if (!config.hidePhaser) - { - c = c.concat(' / '); + this.setCurrentTime(seekTime); } } - var fb = ( false) ? undefined : ''; - - if (!config.hidePhaser) - { - c = c.concat('Phaser v' + CONST.VERSION + fb + ' (' + renderType + ' | ' + audioType + ')'); - } - - c = c.concat(' %c ' + config.gameURL); - - // Inject the new string back into the args array - args[0] = c; + return this; + }, - console.log.apply(console, args); - } - else if (window['console']) + /** + * A double-precision floating-point value indicating the current playback time in seconds. + * + * If the media has not started to play and has not been seeked, this value is the media's initial playback time. + * + * For a more accurate value, use the `Video.metadata.mediaTime` property instead. + * + * @method Phaser.GameObjects.Video#getCurrentTime + * @since 3.20.0 + * + * @return {number} A double-precision floating-point value indicating the current playback time in seconds. + */ + getCurrentTime: function () { - console.log('Phaser v' + CONST.VERSION + ' / https://phaser.io'); - } -}; - -module.exports = DebugHeader; - - -/***/ }), -/* 385 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var GetValue = __webpack_require__(6); -var NOOP = __webpack_require__(1); -var RequestAnimationFrame = __webpack_require__(386); - -// http://www.testufo.com/#test=animation-time-graph - -/** - * @classdesc - * The core runner class that Phaser uses to handle the game loop. It can use either Request Animation Frame, - * or SetTimeout, based on browser support and config settings, to create a continuous loop within the browser. - * - * Each time the loop fires, `TimeStep.step` is called and this is then passed onto the core Game update loop, - * it is the core heartbeat of your game. It will fire as often as Request Animation Frame is capable of handling - * on the target device. - * - * Note that there are lots of situations where a browser will stop updating your game. Such as if the player - * switches tabs, or covers up the browser window with another application. In these cases, the 'heartbeat' - * of your game will pause, and only resume when focus is returned to it by the player. There is no way to avoid - * this situation, all you can do is use the visibility events the browser, and Phaser, provide to detect when - * it has happened and then gracefully recover. - * - * @class TimeStep - * @memberof Phaser.Core - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - A reference to the Phaser.Game instance that owns this Time Step. - * @param {Phaser.Types.Core.FPSConfig} config - */ -var TimeStep = new Class({ - - initialize: + return (this.video) ? this.video.currentTime : 0; + }, - function TimeStep (game, config) + /** + * Seeks to a given playback time in the video. The value is given in _seconds_ or as a string. + * + * Seeking only works if the video has a duration, so will not work for live streams. + * + * When seeking begins, this video will emit a `seeking` event. When the video completes + * seeking (i.e. reaches its designated timestamp) it will emit a `seeked` event. + * + * You can provide a string prefixed with either a `+` or a `-`, such as `+2.5` or `-2.5`. + * In this case it will seek to +/- the value given, relative to the _current time_. + * + * If you wish to seek based on a duration percentage instead, use the `Video.seekTo` method. + * + * @method Phaser.GameObjects.Video#setCurrentTime + * @since 3.20.0 + * + * @param {(string|number)} value - The playback time to seek to in seconds. Can be expressed as a string, such as `+2` to seek 2 seconds ahead from the current time. + * + * @return {this} This Video Game Object for method chaining. + */ + setCurrentTime: function (value) { - /** - * A reference to the Phaser.Game instance. - * - * @name Phaser.Core.TimeStep#game - * @type {Phaser.Game} - * @readonly - * @since 3.0.0 - */ - this.game = game; - - /** - * The Request Animation Frame DOM Event handler. - * - * @name Phaser.Core.TimeStep#raf - * @type {Phaser.DOM.RequestAnimationFrame} - * @readonly - * @since 3.0.0 - */ - this.raf = new RequestAnimationFrame(); - - /** - * A flag that is set once the TimeStep has started running and toggled when it stops. - * - * @name Phaser.Core.TimeStep#started - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.started = false; - - /** - * A flag that is set once the TimeStep has started running and toggled when it stops. - * The difference between this value and `started` is that `running` is toggled when - * the TimeStep is sent to sleep, where-as `started` remains `true`, only changing if - * the TimeStep is actually stopped, not just paused. - * - * @name Phaser.Core.TimeStep#running - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.running = false; - - /** - * The minimum fps rate you want the Time Step to run at. - * - * @name Phaser.Core.TimeStep#minFps - * @type {number} - * @default 5 - * @since 3.0.0 - */ - this.minFps = GetValue(config, 'min', 5); - - /** - * The target fps rate for the Time Step to run at. - * - * Setting this value will not actually change the speed at which the browser runs, that is beyond - * the control of Phaser. Instead, it allows you to determine performance issues and if the Time Step - * is spiraling out of control. - * - * @name Phaser.Core.TimeStep#targetFps - * @type {number} - * @default 60 - * @since 3.0.0 - */ - this.targetFps = GetValue(config, 'target', 60); - - /** - * The minFps value in ms. - * Defaults to 200ms between frames (i.e. super slow!) - * - * @name Phaser.Core.TimeStep#_min - * @type {number} - * @private - * @since 3.0.0 - */ - this._min = 1000 / this.minFps; - - /** - * The targetFps value in ms. - * Defaults to 16.66ms between frames (i.e. normal) - * - * @name Phaser.Core.TimeStep#_target - * @type {number} - * @private - * @since 3.0.0 - */ - this._target = 1000 / this.targetFps; - - /** - * An exponential moving average of the frames per second. - * - * @name Phaser.Core.TimeStep#actualFps - * @type {number} - * @readonly - * @default 60 - * @since 3.0.0 - */ - this.actualFps = this.targetFps; - - /** - * The time at which the next fps rate update will take place. - * When an fps update happens, the `framesThisSecond` value is reset. - * - * @name Phaser.Core.TimeStep#nextFpsUpdate - * @type {number} - * @readonly - * @default 0 - * @since 3.0.0 - */ - this.nextFpsUpdate = 0; - - /** - * The number of frames processed this second. - * - * @name Phaser.Core.TimeStep#framesThisSecond - * @type {number} - * @readonly - * @default 0 - * @since 3.0.0 - */ - this.framesThisSecond = 0; - - /** - * A callback to be invoked each time the Time Step steps. - * - * @name Phaser.Core.TimeStep#callback - * @type {Phaser.Types.Core.TimeStepCallback} - * @default NOOP - * @since 3.0.0 - */ - this.callback = NOOP; - - /** - * You can force the Time Step to use Set Timeout instead of Request Animation Frame by setting - * the `forceSetTimeOut` property to `true` in the Game Configuration object. It cannot be changed at run-time. - * - * @name Phaser.Core.TimeStep#forceSetTimeOut - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.forceSetTimeOut = GetValue(config, 'forceSetTimeOut', false); - - /** - * The time, calculated at the start of the current step, as smoothed by the delta value. - * - * @name Phaser.Core.TimeStep#time - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.time = 0; - - /** - * The time at which the game started running. This value is adjusted if the game is then - * paused and resumes. - * - * @name Phaser.Core.TimeStep#startTime - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.startTime = 0; - - /** - * The time, as returned by `performance.now` of the previous step. - * - * @name Phaser.Core.TimeStep#lastTime - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.lastTime = 0; - - /** - * The current frame the game is on. This counter is incremented once every game step, regardless of how much - * time has passed and is unaffected by delta smoothing. - * - * @name Phaser.Core.TimeStep#frame - * @type {number} - * @readonly - * @default 0 - * @since 3.0.0 - */ - this.frame = 0; - - /** - * Is the browser currently considered in focus by the Page Visibility API? - * This value is set in the `blur` method, which is called automatically by the Game instance. - * - * @name Phaser.Core.TimeStep#inFocus - * @type {boolean} - * @readonly - * @default true - * @since 3.0.0 - */ - this.inFocus = true; - - /** - * The timestamp at which the game became paused, as determined by the Page Visibility API. - * - * @name Phaser.Core.TimeStep#_pauseTime - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._pauseTime = 0; - - /** - * An internal counter to allow for the browser 'cooling down' after coming back into focus. - * - * @name Phaser.Core.TimeStep#_coolDown - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._coolDown = 0; - - /** - * The delta time, in ms, since the last game step. This is a clamped and smoothed average value. - * - * @name Phaser.Core.TimeStep#delta - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.delta = 0; - - /** - * Internal index of the delta history position. - * - * @name Phaser.Core.TimeStep#deltaIndex - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.deltaIndex = 0; - - /** - * Internal array holding the previous delta values, used for delta smoothing. - * - * @name Phaser.Core.TimeStep#deltaHistory - * @type {number[]} - * @since 3.0.0 - */ - this.deltaHistory = []; - - /** - * The maximum number of delta values that are retained in order to calculate a smoothed moving average. - * - * This can be changed in the Game Config via the `fps.deltaHistory` property. The default is 10. - * - * @name Phaser.Core.TimeStep#deltaSmoothingMax - * @type {number} - * @default 10 - * @since 3.0.0 - */ - this.deltaSmoothingMax = GetValue(config, 'deltaHistory', 10); + var video = this.video; - /** - * The number of frames that the cooldown is set to after the browser panics over the FPS rate, usually - * as a result of switching tabs and regaining focus. - * - * This can be changed in the Game Config via the `fps.panicMax` property. The default is 120. - * - * @name Phaser.Core.TimeStep#panicMax - * @type {number} - * @default 120 - * @since 3.0.0 - */ - this.panicMax = GetValue(config, 'panicMax', 120); + if (video) + { + if (typeof value === 'string') + { + var op = value[0]; + var num = parseFloat(value.substr(1)); - /** - * The actual elapsed time in ms between one update and the next. - * - * Unlike with `delta`, no smoothing, capping, or averaging is applied to this value. - * So please be careful when using this value in math calculations. - * - * @name Phaser.Core.TimeStep#rawDelta - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.rawDelta = 0; + if (op === '+') + { + value = video.currentTime + num; + } + else if (op === '-') + { + value = video.currentTime - num; + } + } - /** - * The time, as returned by `performance.now` at the very start of the current step. - * This can differ from the `time` value in that it isn't calculated based on the delta value. - * - * @name Phaser.Core.TimeStep#now - * @type {number} - * @default 0 - * @since 3.18.0 - */ - this.now = 0; + video.currentTime = value; + } - /** - * Apply smoothing to the delta value used within Phasers internal calculations? - * - * This can be changed in the Game Config via the `fps.smoothStep` property. The default is `true`. - * - * Smoothing helps settle down the delta values after browser tab switches, or other situations - * which could cause significant delta spikes or dips. By default it has been enabled in Phaser 3 - * since the first version, but is now exposed under this property (and the corresponding game config - * `smoothStep` value), to allow you to easily disable it, should you require. - * - * @name Phaser.Core.TimeStep#smoothStep - * @type {boolean} - * @since 3.22.0 - */ - this.smoothStep = GetValue(config, 'smoothStep', true); + return this; }, /** - * Called by the Game instance when the DOM window.onBlur event triggers. + * Internal seeking handler. * - * @method Phaser.Core.TimeStep#blur - * @since 3.0.0 + * @method Phaser.GameObjects.Video#seekingHandler + * @fires Phaser.GameObjects.Events#VIDEO_SEEKING + * @private + * @since 3.20.0 */ - blur: function () + seekingHandler: function () { - this.inFocus = false; + this.isSeeking = true; + + this.emit(Events.VIDEO_SEEKING, this); }, /** - * Called by the Game instance when the DOM window.onFocus event triggers. + * Internal seeked handler. * - * @method Phaser.Core.TimeStep#focus - * @since 3.0.0 + * @method Phaser.GameObjects.Video#seekedHandler + * @fires Phaser.GameObjects.Events#VIDEO_SEEKED + * @private + * @since 3.20.0 */ - focus: function () + seekedHandler: function () { - this.inFocus = true; + this.isSeeking = false; - this.resetDelta(); + this.emit(Events.VIDEO_SEEKED, this); }, /** - * Called when the visibility API says the game is 'hidden' (tab switch out of view, etc) + * Returns the current progress of the video as a float. * - * @method Phaser.Core.TimeStep#pause - * @since 3.0.0 + * Progress is defined as a value between 0 (the start) and 1 (the end). + * + * Progress can only be returned if the video has a duration. Some videos, + * such as those coming from a live stream, do not have a duration. In this + * case the method will return -1. + * + * @method Phaser.GameObjects.Video#getProgress + * @since 3.20.0 + * + * @return {number} The current progress of playback. If the video has no duration, will always return -1. */ - pause: function () + getProgress: function () { - this._pauseTime = window.performance.now(); + var video = this.video; + + if (video) + { + var duration = video.duration; + + if (duration !== Infinity && !isNaN(duration)) + { + return video.currentTime / duration; + } + } + + return -1; }, /** - * Called when the visibility API says the game is 'visible' again (tab switch back into view, etc) + * A double-precision floating-point value which indicates the duration (total length) of the media in seconds, + * on the media's timeline. If no media is present on the element, or the media is not valid, the returned value is NaN. * - * @method Phaser.Core.TimeStep#resume - * @since 3.0.0 + * If the media has no known end (such as for live streams of unknown duration, web radio, media incoming from WebRTC, + * and so forth), this value is +Infinity. + * + * If no video has been loaded, this method will return 0. + * + * @method Phaser.GameObjects.Video#getDuration + * @since 3.20.0 + * + * @return {number} A double-precision floating-point value indicating the duration of the media in seconds. */ - resume: function () + getDuration: function () { - this.resetDelta(); - - this.startTime += this.time - this._pauseTime; + return (this.video) ? this.video.duration : 0; }, /** - * Resets the time, lastTime, fps averages and delta history. - * Called automatically when a browser sleeps them resumes. + * Sets the muted state of the currently playing video, if one is loaded. * - * @method Phaser.Core.TimeStep#resetDelta - * @since 3.0.0 + * @method Phaser.GameObjects.Video#setMute + * @since 3.20.0 + * + * @param {boolean} [value=true] - The mute value. `true` if the video should be muted, otherwise `false`. + * + * @return {this} This Video Game Object for method chaining. */ - resetDelta: function () + setMute: function (value) { - var now = window.performance.now(); + if (value === undefined) { value = true; } - this.time = now; - this.lastTime = now; - this.nextFpsUpdate = now + 1000; - this.framesThisSecond = 0; + this._codeMuted = value; - // Pre-populate smoothing array + var video = this.video; - for (var i = 0; i < this.deltaSmoothingMax; i++) + if (video) { - this.deltaHistory[i] = Math.min(this._target, this.deltaHistory[i]); + video.muted = (this._systemMuted) ? true : value; } - this.delta = 0; - this.deltaIndex = 0; + return this; + }, - this._coolDown = this.panicMax; + /** + * Returns a boolean indicating if this Video is currently muted. + * + * @method Phaser.GameObjects.Video#isMuted + * @since 3.20.0 + * + * @return {boolean} A boolean indicating if this Video is currently muted, or not. + */ + isMuted: function () + { + return this._codeMuted; }, /** - * Starts the Time Step running, if it is not already doing so. - * Called automatically by the Game Boot process. + * Internal global mute handler. Will mute the video, if playing, if the global sound system mutes. * - * @method Phaser.Core.TimeStep#start - * @since 3.0.0 + * @method Phaser.GameObjects.Video#globalMute + * @private + * @since 3.20.0 * - * @param {Phaser.Types.Core.TimeStepCallback} callback - The callback to be invoked each time the Time Step steps. + * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the Sound Manager that emitted the event. + * @param {boolean} mute - The mute value. `true` if the Sound Manager is now muted, otherwise `false`. */ - start: function (callback) + globalMute: function (soundManager, value) { - if (this.started) - { - return this; - } + this._systemMuted = value; - this.started = true; - this.running = true; + var video = this.video; - for (var i = 0; i < this.deltaSmoothingMax; i++) + if (video) { - this.deltaHistory[i] = this._target; + video.muted = (this._codeMuted) ? true : value; } - - this.resetDelta(); - - this.startTime = window.performance.now(); - - this.callback = callback; - - this.raf.start(this.step.bind(this), this.forceSetTimeOut, this._target); }, /** - * The main step method. This is called each time the browser updates, either by Request Animation Frame, - * or by Set Timeout. It is responsible for calculating the delta values, frame totals, cool down history and more. - * You generally should never call this method directly. + * Internal global pause handler. Will pause the video if the Game itself pauses. * - * @method Phaser.Core.TimeStep#step - * @since 3.0.0 + * @method Phaser.GameObjects.Video#globalPause + * @private + * @since 3.20.0 */ - step: function () + globalPause: function () { - // Because the timestamp passed in from raf represents the beginning of the main thread frame that we’re currently in, - // not the actual time now, and as we want to compare this time value against Event timeStamps and the like, we need a - // more accurate one: + this._systemPaused = true; - var time = window.performance.now(); + if (this.video && !this.video.ended) + { + this.removeEventHandlers(); - this.now = time; + this.video.pause(); + } + }, - var before = time - this.lastTime; + /** + * Internal global resume handler. Will resume a paused video if the Game itself resumes. + * + * @method Phaser.GameObjects.Video#globalResume + * @private + * @since 3.20.0 + */ + globalResume: function () + { + this._systemPaused = false; - if (before < 0) + if (this.video && !this._codePaused && !this.video.ended) { - // Because, Chrome. - before = 0; + this.createPlayPromise(); } + }, - this.rawDelta = before; - - var idx = this.deltaIndex; - var history = this.deltaHistory; - var max = this.deltaSmoothingMax; - - // delta time (time is in ms) - var dt = before; + /** + * Sets the paused state of the currently loaded video. + * + * If the video is playing, calling this method with `true` will pause playback. + * If the video is paused, calling this method with `false` will resume playback. + * + * If no video is loaded, this method does nothing. + * + * If the video has not yet been played, `Video.play` will be called with no parameters. + * + * If the video has ended, this method will do nothing. + * + * @method Phaser.GameObjects.Video#setPaused + * @since 3.20.0 + * + * @param {boolean} [value=true] - The paused value. `true` if the video should be paused, `false` to resume it. + * + * @return {this} This Video Game Object for method chaining. + */ + setPaused: function (value) + { + if (value === undefined) { value = true; } - // Delta Average - var avg = before; + var video = this.video; - // When a browser switches tab, then comes back again, it takes around 10 frames before - // the delta time settles down so we employ a 'cooling down' period before we start - // trusting the delta values again, to avoid spikes flooding through our delta average + this._codePaused = value; - if (this.smoothStep) + if (video && !video.ended) { - if (this._coolDown > 0 || !this.inFocus) - { - this._coolDown--; - - dt = Math.min(dt, this._target); - } - - if (dt > this._min) - { - // Probably super bad start time or browser tab context loss, - // so use the last 'sane' dt value - - dt = history[idx]; - - // Clamp delta to min (in case history has become corrupted somehow) - dt = Math.min(dt, this._min); - } - - // Smooth out the delta over the previous X frames - - // add the delta to the smoothing array - history[idx] = dt; - - // adjusts the delta history array index based on the smoothing count - // this stops the array growing beyond the size of deltaSmoothingMax - this.deltaIndex++; - - if (this.deltaIndex > max) + if (value) { - this.deltaIndex = 0; + if (!video.paused) + { + this.removeEventHandlers(); + + video.pause(); + } } - - // Loop the history array, adding the delta values together - avg = 0; - - for (var i = 0; i < max; i++) + else if (!value) { - avg += history[i]; + if (!this._playCalled) + { + this.play(); + } + else if (video.paused && !this._systemPaused) + { + this.createPlayPromise(); + } } - - // Then divide by the array length to get the average delta - avg /= max; - } - - // Set as the world delta value - this.delta = avg; - - // Real-world timer advance - this.time += this.rawDelta; - - // Update the estimate of the frame rate, `fps`. Every second, the number - // of frames that occurred in that second are included in an exponential - // moving average of all frames per second, with an alpha of 0.25. This - // means that more recent seconds affect the estimated frame rate more than - // older seconds. - // - // When a browser window is NOT minimized, but is covered up (i.e. you're using - // another app which has spawned a window over the top of the browser), then it - // will start to throttle the raf callback time. It waits for a while, and then - // starts to drop the frame rate at 1 frame per second until it's down to just over 1fps. - // So if the game was running at 60fps, and the player opens a new window, then - // after 60 seconds (+ the 'buffer time') it'll be down to 1fps, so rafin'g at 1Hz. - // - // When they make the game visible again, the frame rate is increased at a rate of - // approx. 8fps, back up to 60fps (or the max it can obtain) - // - // There is no easy way to determine if this drop in frame rate is because the - // browser is throttling raf, or because the game is struggling with performance - // because you're asking it to do too much on the device. - - if (time > this.nextFpsUpdate) - { - // Compute the new exponential moving average with an alpha of 0.25. - this.actualFps = 0.25 * this.framesThisSecond + 0.75 * this.actualFps; - this.nextFpsUpdate = time + 1000; - this.framesThisSecond = 0; } - this.framesThisSecond++; - - // Interpolation - how far between what is expected and where we are? - var interpolation = avg / this._target; - - this.callback(time, avg, interpolation); - - // Shift time value over - this.lastTime = time; - - this.frame++; + return this; }, /** - * Manually calls `TimeStep.step`. + * Pauses the current Video, if one is playing. * - * @method Phaser.Core.TimeStep#tick - * @since 3.0.0 + * If no video is loaded, this method does nothing. + * + * Call `Video.resume` to resume playback. + * + * @method Phaser.GameObjects.Video#pause + * @since 3.60.0 + * + * @return {this} This Video Game Object for method chaining. */ - tick: function () + pause: function () { - this.step(); + return this.setPaused(true); }, /** - * Sends the TimeStep to sleep, stopping Request Animation Frame (or SetTimeout) and toggling the `running` flag to false. + * Resumes the current Video, if one was previously playing and has been paused. * - * @method Phaser.Core.TimeStep#sleep - * @since 3.0.0 + * If no video is loaded, this method does nothing. + * + * Call `Video.pause` to pause playback. + * + * @method Phaser.GameObjects.Video#resume + * @since 3.60.0 + * + * @return {this} This Video Game Object for method chaining. */ - sleep: function () + resume: function () { - if (this.running) - { - this.raf.stop(); + return this.setPaused(false); + }, - this.running = false; - } + /** + * Returns a double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). + * + * @method Phaser.GameObjects.Video#getVolume + * @since 3.20.0 + * + * @return {number} A double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). + */ + getVolume: function () + { + return (this.video) ? this.video.volume : 1; }, /** - * Wakes-up the TimeStep, restarting Request Animation Frame (or SetTimeout) and toggling the `running` flag to true. - * The `seamless` argument controls if the wake-up should adjust the start time or not. + * Sets the volume of the currently playing video. * - * @method Phaser.Core.TimeStep#wake - * @since 3.0.0 + * The value given is a double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). * - * @param {boolean} [seamless=false] - Adjust the startTime based on the lastTime values. + * @method Phaser.GameObjects.Video#setVolume + * @since 3.20.0 + * + * @param {number} [value=1] - A double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest). + * + * @return {this} This Video Game Object for method chaining. */ - wake: function (seamless) + setVolume: function (value) { - if (this.running) - { - return; - } - else if (seamless) + if (value === undefined) { value = 1; } + + if (this.video) { - this.startTime += -this.lastTime + (this.lastTime + window.performance.now()); + this.video.volume = Clamp(value, 0, 1); } - this.raf.start(this.step.bind(this), this.useRAF); - - this.running = true; + return this; + }, - this.step(); + /** + * Returns a double that indicates the rate at which the media is being played back. + * + * @method Phaser.GameObjects.Video#getPlaybackRate + * @since 3.20.0 + * + * @return {number} A double that indicates the rate at which the media is being played back. + */ + getPlaybackRate: function () + { + return (this.video) ? this.video.playbackRate : 1; }, /** - * Gets the duration which the game has been running, in seconds. + * Sets the playback rate of the current video. * - * @method Phaser.Core.TimeStep#getDuration - * @since 3.17.0 + * The value given is a double that indicates the rate at which the media is being played back. * - * @return {number} The duration in seconds. + * @method Phaser.GameObjects.Video#setPlaybackRate + * @since 3.20.0 + * + * @param {number} [rate] - A double that indicates the rate at which the media is being played back. + * + * @return {this} This Video Game Object for method chaining. */ - getDuration: function () + setPlaybackRate: function (rate) { - return Math.round(this.lastTime - this.startTime) / 1000; + if (this.video) + { + this.video.playbackRate = rate; + } + + return this; }, /** - * Gets the duration which the game has been running, in ms. + * Returns a boolean which indicates whether the media element should start over when it reaches the end. * - * @method Phaser.Core.TimeStep#getDurationMS - * @since 3.17.0 + * @method Phaser.GameObjects.Video#getLoop + * @since 3.20.0 * - * @return {number} The duration in ms. + * @return {boolean} A boolean which indicates whether the media element will start over when it reaches the end. */ - getDurationMS: function () + getLoop: function () { - return Math.round(this.lastTime - this.startTime); + return (this.video) ? this.video.loop : false; }, /** - * Stops the TimeStep running. + * Sets the loop state of the current video. * - * @method Phaser.Core.TimeStep#stop - * @since 3.0.0 + * The value given is a boolean which indicates whether the media element will start over when it reaches the end. * - * @return {this} The TimeStep object. + * Not all videos can loop, for example live streams. + * + * Please note that not all browsers support _seamless_ video looping for all encoding formats. + * + * @method Phaser.GameObjects.Video#setLoop + * @since 3.20.0 + * + * @param {boolean} [value=true] - A boolean which indicates whether the media element will start over when it reaches the end. + * + * @return {this} This Video Game Object for method chaining. */ - stop: function () + setLoop: function (value) { - this.running = false; - this.started = false; + if (value === undefined) { value = true; } - this.raf.stop(); + if (this.video) + { + this.video.loop = value; + } return this; }, /** - * Destroys the TimeStep. This will stop Request Animation Frame, stop the step, clear the callbacks and null - * any objects. + * Returns a boolean which indicates whether the video is currently playing. * - * @method Phaser.Core.TimeStep#destroy - * @since 3.0.0 + * @method Phaser.GameObjects.Video#isPlaying + * @since 3.20.0 + * + * @return {boolean} A boolean which indicates whether the video is playing, or not. */ - destroy: function () + isPlaying: function () { - this.stop(); - - this.callback = NOOP; - - this.raf = null; - this.game = null; - } - -}); - -module.exports = TimeStep; - - -/***/ }), -/* 386 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var NOOP = __webpack_require__(1); - -/** - * @classdesc - * Abstracts away the use of RAF or setTimeOut for the core game update loop. - * This is invoked automatically by the Phaser.Game instance. - * - * @class RequestAnimationFrame - * @memberof Phaser.DOM - * @constructor - * @since 3.0.0 - */ -var RequestAnimationFrame = new Class({ - - initialize: + return (this.video) ? !(this.video.paused || this.video.ended) : false; + }, - function RequestAnimationFrame () + /** + * Returns a boolean which indicates whether the video is currently paused. + * + * @method Phaser.GameObjects.Video#isPaused + * @since 3.20.0 + * + * @return {boolean} A boolean which indicates whether the video is paused, or not. + */ + isPaused: function () { - /** - * True if RequestAnimationFrame is running, otherwise false. - * - * @name Phaser.DOM.RequestAnimationFrame#isRunning - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.isRunning = false; + return ((this.video && this._playCalled && this.video.paused) || this._codePaused || this._systemPaused); + }, - /** - * The callback to be invoked each step. - * - * @name Phaser.DOM.RequestAnimationFrame#callback - * @type {FrameRequestCallback} - * @since 3.0.0 - */ - this.callback = NOOP; - - /** - * The most recent timestamp. Either a DOMHighResTimeStamp under RAF or `Date.now` under SetTimeout. - * - * @name Phaser.DOM.RequestAnimationFrame#tick - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.tick = 0; - - /** - * True if the step is using setTimeout instead of RAF. - * - * @name Phaser.DOM.RequestAnimationFrame#isSetTimeOut - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.isSetTimeOut = false; - - /** - * The setTimeout or RAF callback ID used when canceling them. - * - * @name Phaser.DOM.RequestAnimationFrame#timeOutID - * @type {?number} - * @default null - * @since 3.0.0 - */ - this.timeOutID = null; - - /** - * The previous time the step was called. - * - * @name Phaser.DOM.RequestAnimationFrame#lastTime - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.lastTime = 0; - - /** - * The target FPS rate in ms. - * Only used when setTimeout is used instead of RAF. - * - * @name Phaser.DOM.RequestAnimationFrame#target - * @type {number} - * @default 0 - * @since 3.21.0 - */ - this.target = 0; - - var _this = this; + /** + * Stores this Video in the Texture Manager using the given key as a dynamic texture, + * which any texture-based Game Object, such as a Sprite, can use as its source: + * + * ```javascript + * const vid = this.add.video(0, 0, 'intro'); + * + * vid.play(); + * + * vid.saveTexture('doodle'); + * + * this.add.image(400, 300, 'doodle'); + * ``` + * + * If the video is not yet playing then you need to listen for the `TEXTURE_READY` event before + * you can use this texture on a Game Object: + * + * ```javascript + * const vid = this.add.video(0, 0, 'intro'); + * + * vid.play(); + * + * vid.once('textureready', (video, texture, key) => { + * + * this.add.image(400, 300, key); + * + * }); + * + * vid.saveTexture('doodle'); + * ``` + * + * The saved texture is automatically updated as the video plays. If you pause this video, + * or change its source, then the saved texture updates instantly. + * + * Calling `saveTexture` again will not save another copy of the same texture, it will just rename the existing one. + * + * By default it will create a single base texture. You can add frames to the texture + * by using the `Texture.add` method. After doing this, you can then allow Game Objects + * to use a specific frame. + * + * If you intend to save the texture so you can use it as the input for a Shader, you may need to set the + * `flipY` parameter to `true` if you find the video renders upside down in your shader. + * + * @method Phaser.GameObjects.Video#saveTexture + * @since 3.20.0 + * + * @param {string} key - The unique key to store the texture as within the global Texture Manager. + * @param {boolean} [flipY=false] - Should the WebGL Texture set `UNPACK_MULTIPLY_FLIP_Y` during upload? + * + * @return {boolean} Returns `true` if the texture is available immediately, otherwise returns `false` and you should listen for the `TEXTURE_READY` event. + */ + saveTexture: function (key, flipY) + { + if (flipY === undefined) { flipY = false; } - /** - * The RAF step function. - * Updates the local tick value, invokes the callback and schedules another call to requestAnimationFrame. - * - * @name Phaser.DOM.RequestAnimationFrame#step - * @type {FrameRequestCallback} - * @since 3.0.0 - */ - this.step = function step () + if (this.videoTexture) { - // Because we cannot trust the time passed to this callback from the browser and need it kept in sync with event times - var timestamp = window.performance.now(); + this.scene.sys.textures.renameTexture(this._key, key); + this.videoTextureSource.setFlipY(flipY); + } - // DOMHighResTimeStamp - _this.lastTime = _this.tick; + this._key = key; + this.flipY = flipY; - _this.tick = timestamp; + return (this.videoTexture) ? true : false; + }, - _this.callback(timestamp); + /** + * Stops the video playing and clears all internal event listeners. + * + * If you only wish to pause playback of the video, and resume it a later time, use the `Video.pause` method instead. + * + * If the video hasn't finished downloading, calling this method will not abort the download. To do that you need to + * call `destroy` instead. + * + * @method Phaser.GameObjects.Video#stop + * @fires Phaser.GameObjects.Events#VIDEO_STOP + * @since 3.20.0 + * + * @param {boolean} [emitStopEvent=true] - Should the `VIDEO_STOP` event be emitted? + * + * @return {this} This Video Game Object for method chaining. + */ + stop: function (emitStopEvent) + { + if (emitStopEvent === undefined) { emitStopEvent = true; } - _this.timeOutID = window.requestAnimationFrame(step); - }; + var video = this.video; - /** - * The SetTimeout step function. - * Updates the local tick value, invokes the callback and schedules another call to setTimeout. - * - * @name Phaser.DOM.RequestAnimationFrame#stepTimeout - * @type {function} - * @since 3.0.0 - */ - this.stepTimeout = function stepTimeout () + if (video) { - var d = Date.now(); + this.removeEventHandlers(); - var delay = Math.min(Math.max(_this.target * 2 + _this.tick - d, 0), _this.target); + video.cancelVideoFrameCallback(this._rfvCallbackId); - _this.lastTime = _this.tick; + video.pause(); + } - _this.tick = d; + this.retry = 0; + this._playCalled = false; - _this.callback(d); + if (emitStopEvent) + { + this.emit(Events.VIDEO_STOP, this); + } - _this.timeOutID = window.setTimeout(stepTimeout, delay); - }; + return this; }, /** - * Starts the requestAnimationFrame or setTimeout process running. + * Removes the Video element from the DOM by calling parentNode.removeChild on itself. * - * @method Phaser.DOM.RequestAnimationFrame#start - * @since 3.0.0 + * Also removes the autoplay and src attributes and nulls the `Video.video` reference. * - * @param {FrameRequestCallback} callback - The callback to invoke each step. - * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? - * @param {number} targetFPS - The target fps rate (in ms). Only used when setTimeout is used. + * If you loaded an external video via `Video.loadURL` then you should call this function + * to clear up once you are done with the instance, but don't want to destroy this + * Video Game Object. + * + * This method is called automatically by `Video.destroy`. + * + * @method Phaser.GameObjects.Video#removeVideoElement + * @since 3.20.0 */ - start: function (callback, forceSetTimeOut, targetFPS) + removeVideoElement: function () { - if (this.isRunning) + var video = this.video; + + if (!video) { return; } - this.callback = callback; - - this.isSetTimeOut = forceSetTimeOut; + if (video.parentNode) + { + video.parentNode.removeChild(video); + } - this.target = targetFPS; + while (video.hasChildNodes()) + { + video.removeChild(video.firstChild); + } - this.isRunning = true; + video.removeAttribute('autoplay'); + video.removeAttribute('src'); - this.timeOutID = (forceSetTimeOut) ? window.setTimeout(this.stepTimeout, 0) : window.requestAnimationFrame(this.step); + this.video = null; }, /** - * Stops the requestAnimationFrame or setTimeout from running. + * Handles the pre-destroy step for the Video object. * - * @method Phaser.DOM.RequestAnimationFrame#stop - * @since 3.0.0 + * This calls `Video.stop` and optionally `Video.removeVideoElement`. + * + * If any Sprites are using this Video as their texture it is up to you to manage those. + * + * @method Phaser.GameObjects.Video#preDestroy + * @private + * @since 3.21.0 */ - stop: function () + preDestroy: function () { - this.isRunning = false; + this.stop(false); - if (this.isSetTimeOut) - { - clearTimeout(this.timeOutID); - } - else - { - window.cancelAnimationFrame(this.timeOutID); - } - }, + this.removeLoadEventHandlers(); - /** - * Stops the step from running and clears the callback reference. - * - * @method Phaser.DOM.RequestAnimationFrame#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.stop(); + this.removeVideoElement(); - this.callback = NOOP; + var game = this.scene.sys.game.events; + + game.off(GameEvents.PAUSE, this.globalPause, this); + game.off(GameEvents.RESUME, this.globalResume, this); + + var sound = this.scene.sys.sound; + + if (sound) + { + sound.off(SoundEvents.GLOBAL_MUTE, this.globalMute, this); + } } }); -module.exports = RequestAnimationFrame; +module.exports = Video; /***/ }), -/* 387 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 56933: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Events = __webpack_require__(22); - /** - * The Visibility Handler is responsible for listening out for document level visibility change events. - * This includes `visibilitychange` if the browser supports it, and blur and focus events. It then uses - * the provided Event Emitter and fires the related events. + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @function Phaser.Core.VisibilityHandler - * @fires Phaser.Core.Events#BLUR - * @fires Phaser.Core.Events#FOCUS - * @fires Phaser.Core.Events#HIDDEN - * @fires Phaser.Core.Events#VISIBLE - * @since 3.0.0 + * @method Phaser.GameObjects.Video#renderCanvas + * @since 3.20.0 + * @private * - * @param {Phaser.Game} game - The Game instance this Visibility Handler is working on. + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Video} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -var VisibilityHandler = function (game) +var VideoCanvasRenderer = function (renderer, src, camera, parentMatrix) { - var hiddenVar; - var eventEmitter = game.events; - - if (document.hidden !== undefined) + if (src.videoTexture) { - hiddenVar = 'visibilitychange'; + camera.addToRenderList(src); + + renderer.batchSprite(src, src.frame, camera, parentMatrix); } - else - { - var vendors = [ 'webkit', 'moz', 'ms' ]; +}; - vendors.forEach(function (prefix) - { - if (document[prefix + 'Hidden'] !== undefined) - { - document.hidden = function () - { - return document[prefix + 'Hidden']; - }; +module.exports = VideoCanvasRenderer; - hiddenVar = prefix + 'visibilitychange'; - } - }); - } +/***/ }), - var onChange = function (event) - { - if (document.hidden || event.type === 'pause') - { - eventEmitter.emit(Events.HIDDEN); - } - else - { - eventEmitter.emit(Events.VISIBLE); - } - }; +/***/ 65601: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - if (hiddenVar) - { - document.addEventListener(hiddenVar, onChange, false); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - window.onblur = function () - { - eventEmitter.emit(Events.BLUR); - }; +var BuildGameObject = __webpack_require__(88933); +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var Video = __webpack_require__(8630); - window.onfocus = function () - { - eventEmitter.emit(Events.FOCUS); - }; +/** + * Creates a new Video Game Object and returns it. + * + * Note: This method will only be available if the Video Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#video + * @since 3.20.0 + * + * @param {Phaser.Types.GameObjects.Video.VideoConfig} config - The configuration object this Game Object will use to create itself. + * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * + * @return {Phaser.GameObjects.Video} The Game Object that was created. + */ +GameObjectCreator.register('video', function (config, addToScene) +{ + if (config === undefined) { config = {}; } - // Automatically give the window focus unless config says otherwise - if (window.focus && game.config.autoFocus) + var key = GetAdvancedValue(config, 'key', null); + + var video = new Video(this.scene, 0, 0, key); + + if (addToScene !== undefined) { - window.focus(); + config.add = addToScene; } -}; -module.exports = VisibilityHandler; + BuildGameObject(this.scene, video, config); + + return video; +}); + +// When registering a factory function 'this' refers to the GameObjectCreator context. /***/ }), -/* 388 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 215: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Arne16 = __webpack_require__(389); -var CanvasPool = __webpack_require__(31); -var GetValue = __webpack_require__(6); +var Video = __webpack_require__(8630); +var GameObjectFactory = __webpack_require__(61286); /** - * Generates a texture based on the given Create configuration object. - * - * The texture is drawn using a fixed-size indexed palette of 16 colors, where the hex value in the - * data cells map to a single color. For example, if the texture config looked like this: + * Creates a new Video Game Object and adds it to the Scene. + * + * This Game Object is capable of handling playback of a video file, video stream or media stream. + * + * You can optionally 'preload' the video into the Phaser Video Cache: * * ```javascript - * var star = [ - * '.....828.....', - * '....72227....', - * '....82228....', - * '...7222227...', - * '2222222222222', - * '8222222222228', - * '.72222222227.', - * '..787777787..', - * '..877777778..', - * '.78778887787.', - * '.27887.78872.', - * '.787.....787.' - * ]; - * - * this.textures.generate('star', { data: star, pixelWidth: 4 }); + * preload () { + * this.load.video('ripley', 'assets/aliens.mp4'); + * } + * + * create () { + * this.add.video(400, 300, 'ripley'); + * } * ``` - * - * Then it would generate a texture that is 52 x 48 pixels in size, because each cell of the data array - * represents 1 pixel multiplied by the `pixelWidth` value. The cell values, such as `8`, maps to color - * number 8 in the palette. If a cell contains a period character `.` then it is transparent. - * - * The default palette is Arne16, but you can specify your own using the `palette` property. * - * @function Phaser.Create.GenerateTexture - * @since 3.0.0 + * You don't have to 'preload' the video. You can also play it directly from a URL: * - * @param {Phaser.Types.Create.GenerateTextureConfig} config - The Generate Texture Configuration object. + * ```javascript + * create () { + * this.add.video(400, 300).loadURL('assets/aliens.mp4'); + * } + * ``` * - * @return {HTMLCanvasElement} An HTMLCanvasElement which contains the generated texture drawn to it. + * To all intents and purposes, a video is a standard Game Object, just like a Sprite. And as such, you can do + * all the usual things to it, such as scaling, rotating, cropping, tinting, making interactive, giving a + * physics body, etc. + * + * Transparent videos are also possible via the WebM file format. Providing the video file has was encoded with + * an alpha channel, and providing the browser supports WebM playback (not all of them do), then it will render + * in-game with full transparency. + * + * ### Autoplaying Videos + * + * Videos can only autoplay if the browser has been unlocked with an interaction, or satisfies the MEI settings. + * The policies that control autoplaying are vast and vary between browser. You can, and should, read more about + * it here: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide + * + * If your video doesn't contain any audio, then set the `noAudio` parameter to `true` when the video is _loaded_, + * and it will often allow the video to play immediately: + * + * ```javascript + * preload () { + * this.load.video('pixar', 'nemo.mp4', true); + * } + * ``` + * + * The 3rd parameter in the load call tells Phaser that the video doesn't contain any audio tracks. Video without + * audio can autoplay without requiring a user interaction. Video with audio cannot do this unless it satisfies + * the browsers MEI settings. See the MDN Autoplay Guide for further details. + * + * Or: + * + * ```javascript + * create () { + * this.add.video(400, 300).loadURL('assets/aliens.mp4', true); + * } + * ``` + * + * You can set the `noAudio` parameter to `true` even if the video does contain audio. It will still allow the video + * to play immediately, but the audio will not start. + * + * Note that due to a bug in IE11 you cannot play a video texture to a Sprite in WebGL. For IE11 force Canvas mode. + * + * More details about video playback and the supported media formats can be found on MDN: + * + * https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement + * https://developer.mozilla.org/en-US/docs/Web/Media/Formats + * + * Note: This method will only be available if the Video Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#video + * @since 3.20.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {string} [key] - Optional key of the Video this Game Object will play, as stored in the Video Cache. + * + * @return {Phaser.GameObjects.Video} The Game Object that was created. */ -var GenerateTexture = function (config) +GameObjectFactory.register('video', function (x, y, key) { - var data = GetValue(config, 'data', []); - var canvas = GetValue(config, 'canvas', null); - var palette = GetValue(config, 'palette', Arne16); - var pixelWidth = GetValue(config, 'pixelWidth', 1); - var pixelHeight = GetValue(config, 'pixelHeight', pixelWidth); - var resizeCanvas = GetValue(config, 'resizeCanvas', true); - var clearCanvas = GetValue(config, 'clearCanvas', true); - var preRender = GetValue(config, 'preRender', null); - var postRender = GetValue(config, 'postRender', null); - - var width = Math.floor(Math.abs(data[0].length * pixelWidth)); - var height = Math.floor(Math.abs(data.length * pixelHeight)); + return this.displayList.add(new Video(this.scene, x, y, key)); +}); - if (!canvas) - { - canvas = CanvasPool.create2D(this, width, height); - resizeCanvas = false; - clearCanvas = false; - } - if (resizeCanvas) - { - canvas.width = width; - canvas.height = height; - } +/***/ }), - var ctx = canvas.getContext('2d'); +/***/ 77974: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (clearCanvas) - { - ctx.clearRect(0, 0, width, height); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // preRender Callback? - if (preRender) - { - preRender(canvas, ctx); - } +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; - // Draw it - for (var y = 0; y < data.length; y++) - { - var row = data[y]; +if (true) +{ + renderWebGL = __webpack_require__(83572); +} - for (var x = 0; x < row.length; x++) - { - var d = row[x]; +if (true) +{ + renderCanvas = __webpack_require__(56933); +} - if (d !== '.' && d !== ' ') - { - ctx.fillStyle = palette[d]; - ctx.fillRect(x * pixelWidth, y * pixelHeight, pixelWidth, pixelHeight); - } - } - } +module.exports = { - // postRender Callback? - if (postRender) - { - postRender(canvas, ctx); - } + renderWebGL: renderWebGL, + renderCanvas: renderCanvas - return canvas; }; -module.exports = GenerateTexture; - /***/ }), -/* 389 */ -/***/ (function(module, exports) { + +/***/ 83572: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * A 16 color palette by [Arne](http://androidarts.com/palette/16pal.htm) + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @name Phaser.Create.Palettes.ARNE16 - * @since 3.0.0 + * @method Phaser.GameObjects.Video#renderWebGL + * @since 3.20.0 + * @private * - * @type {Phaser.Types.Create.Palette} + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Video} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ -module.exports = { - 0: '#000', - 1: '#9D9D9D', - 2: '#FFF', - 3: '#BE2633', - 4: '#E06F8B', - 5: '#493C2B', - 6: '#A46422', - 7: '#EB8931', - 8: '#F7E26B', - 9: '#2F484E', - A: '#44891A', - B: '#A3CE27', - C: '#1B2632', - D: '#005784', - E: '#31A2F2', - F: '#B2DCEF' +var VideoWebGLRenderer = function (renderer, src, camera, parentMatrix) +{ + if (src.videoTexture) + { + camera.addToRenderList(src); + + src.pipeline.batchSprite(src, camera, parentMatrix); + } }; +module.exports = VideoWebGLRenderer; + /***/ }), -/* 390 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 71030: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - -var Class = __webpack_require__(0); -var CubicBezier = __webpack_require__(358); -var Curve = __webpack_require__(94); -var Vector2 = __webpack_require__(3); +var BlendModes = __webpack_require__(95723); +var Circle = __webpack_require__(26673); +var CircleContains = __webpack_require__(65650); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var Rectangle = __webpack_require__(74118); +var RectangleContains = __webpack_require__(94287); /** * @classdesc - * A higher-order Bézier curve constructed of four points. + * A Zone Game Object. * - * @class CubicBezier - * @extends Phaser.Curves.Curve - * @memberof Phaser.Curves + * A Zone is a non-rendering rectangular Game Object that has a position and size. + * It has no texture and never displays, but does live on the display list and + * can be moved, scaled and rotated like any other Game Object. + * + * Its primary use is for creating Drop Zones and Input Hit Areas and it has a couple of helper methods + * specifically for this. It is also useful for object overlap checks, or as a base for your own + * non-displaying Game Objects. + + * The default origin is 0.5, the center of the Zone, the same as with Game Objects. + * + * @class Zone + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.GameObjects * @constructor * @since 3.0.0 * - * @param {(Phaser.Math.Vector2|Phaser.Math.Vector2[])} p0 - Start point, or an array of point pairs. - * @param {Phaser.Math.Vector2} p1 - Control Point 1. - * @param {Phaser.Math.Vector2} p2 - Control Point 2. - * @param {Phaser.Math.Vector2} p3 - End Point. + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {number} [width=1] - The width of the Game Object. + * @param {number} [height=1] - The height of the Game Object. */ -var CubicBezierCurve = new Class({ +var Zone = new Class({ - Extends: Curve, + Extends: GameObject, + + Mixins: [ + Components.Depth, + Components.GetBounds, + Components.Origin, + Components.Transform, + Components.ScrollFactor, + Components.Visible + ], initialize: - function CubicBezierCurve (p0, p1, p2, p3) + function Zone (scene, x, y, width, height) { - Curve.call(this, 'CubicBezierCurve'); + if (width === undefined) { width = 1; } + if (height === undefined) { height = width; } - if (Array.isArray(p0)) - { - p3 = new Vector2(p0[6], p0[7]); - p2 = new Vector2(p0[4], p0[5]); - p1 = new Vector2(p0[2], p0[3]); - p0 = new Vector2(p0[0], p0[1]); - } + GameObject.call(this, scene, 'Zone'); - /** - * The start point of this curve. - * - * @name Phaser.Curves.CubicBezier#p0 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p0 = p0; + this.setPosition(x, y); /** - * The first control point of this curve. + * The native (un-scaled) width of this Game Object. * - * @name Phaser.Curves.CubicBezier#p1 - * @type {Phaser.Math.Vector2} + * @name Phaser.GameObjects.Zone#width + * @type {number} * @since 3.0.0 */ - this.p1 = p1; + this.width = width; /** - * The second control point of this curve. + * The native (un-scaled) height of this Game Object. * - * @name Phaser.Curves.CubicBezier#p2 - * @type {Phaser.Math.Vector2} + * @name Phaser.GameObjects.Zone#height + * @type {number} * @since 3.0.0 */ - this.p2 = p2; + this.height = height; /** - * The end point of this curve. + * The Blend Mode of the Game Object. + * Although a Zone never renders, it still has a blend mode to allow it to fit seamlessly into + * display lists without causing a batch flush. * - * @name Phaser.Curves.CubicBezier#p3 - * @type {Phaser.Math.Vector2} + * @name Phaser.GameObjects.Zone#blendMode + * @type {number} * @since 3.0.0 */ - this.p3 = p3; + this.blendMode = BlendModes.NORMAL; + + this.updateDisplayOrigin(); }, /** - * Gets the starting point on the curve. + * The displayed width of this Game Object. + * This value takes into account the scale factor. * - * @method Phaser.Curves.CubicBezier#getStartPoint + * @name Phaser.GameObjects.Zone#displayWidth + * @type {number} * @since 3.0.0 + */ + displayWidth: { + + get: function () + { + return this.scaleX * this.width; + }, + + set: function (value) + { + this.scaleX = value / this.width; + } + + }, + + /** + * The displayed height of this Game Object. + * This value takes into account the scale factor. * - * @generic {Phaser.Math.Vector2} O - [out,$return] + * @name Phaser.GameObjects.Zone#displayHeight + * @type {number} + * @since 3.0.0 + */ + displayHeight: { + + get: function () + { + return this.scaleY * this.height; + }, + + set: function (value) + { + this.scaleY = value / this.height; + } + + }, + + /** + * Sets the size of this Game Object. * - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * @method Phaser.GameObjects.Zone#setSize + * @since 3.0.0 * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. + * @param {boolean} [resizeInput=true] - If this Zone has a Rectangle for a hit area this argument will resize the hit area as well. + * + * @return {this} This Game Object. */ - getStartPoint: function (out) + setSize: function (width, height, resizeInput) { - if (out === undefined) { out = new Vector2(); } + if (resizeInput === undefined) { resizeInput = true; } - return out.copy(this.p0); + this.width = width; + this.height = height; + + this.updateDisplayOrigin(); + + var input = this.input; + + if (resizeInput && input && !input.customHitArea) + { + input.hitArea.width = width; + input.hitArea.height = height; + } + + return this; }, /** - * Returns the resolution of this curve. + * Sets the display size of this Game Object. + * Calling this will adjust the scale. * - * @method Phaser.Curves.CubicBezier#getResolution + * @method Phaser.GameObjects.Zone#setDisplaySize * @since 3.0.0 * - * @param {number} divisions - The amount of divisions used by this curve. + * @param {number} width - The width of this Game Object. + * @param {number} height - The height of this Game Object. * - * @return {number} The resolution of the curve. + * @return {this} This Game Object. */ - getResolution: function (divisions) + setDisplaySize: function (width, height) { - return divisions; + this.displayWidth = width; + this.displayHeight = height; + + return this; }, /** - * Get point at relative position in curve according to length. + * Sets this Zone to be a Circular Drop Zone. + * The circle is centered on this Zones `x` and `y` coordinates. * - * @method Phaser.Curves.CubicBezier#getPoint + * @method Phaser.GameObjects.Zone#setCircleDropZone * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * @param {number} radius - The radius of the Circle that will form the Drop Zone. * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + * @return {this} This Game Object. */ - getPoint: function (t, out) + setCircleDropZone: function (radius) { - if (out === undefined) { out = new Vector2(); } - - var p0 = this.p0; - var p1 = this.p1; - var p2 = this.p2; - var p3 = this.p3; - - return out.set(CubicBezier(t, p0.x, p1.x, p2.x, p3.x), CubicBezier(t, p0.y, p1.y, p2.y, p3.y)); + return this.setDropZone(new Circle(0, 0, radius), CircleContains); }, /** - * Draws this curve to the specified graphics object. + * Sets this Zone to be a Rectangle Drop Zone. + * The rectangle is centered on this Zones `x` and `y` coordinates. * - * @method Phaser.Curves.CubicBezier#draw + * @method Phaser.GameObjects.Zone#setRectangleDropZone * @since 3.0.0 * - * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] - * - * @param {Phaser.GameObjects.Graphics} graphics - The graphics object this curve should be drawn to. - * @param {number} [pointsTotal=32] - The number of intermediary points that make up this curve. A higher number of points will result in a smoother curve. + * @param {number} width - The width of the rectangle drop zone. + * @param {number} height - The height of the rectangle drop zone. * - * @return {Phaser.GameObjects.Graphics} The graphics object this curve was drawn to. Useful for method chaining. + * @return {this} This Game Object. */ - draw: function (graphics, pointsTotal) + setRectangleDropZone: function (width, height) { - if (pointsTotal === undefined) { pointsTotal = 32; } - - var points = this.getPoints(pointsTotal); - - graphics.beginPath(); - graphics.moveTo(this.p0.x, this.p0.y); + return this.setDropZone(new Rectangle(0, 0, width, height), RectangleContains); + }, - for (var i = 1; i < points.length; i++) + /** + * Allows you to define your own Geometry shape to be used as a Drop Zone. + * + * @method Phaser.GameObjects.Zone#setDropZone + * @since 3.0.0 + * + * @param {object} [hitArea] - A Geometry shape instance, such as Phaser.Geom.Ellipse, or your own custom shape. If not given it will try to create a Rectangle based on the size of this zone. + * @param {Phaser.Types.Input.HitAreaCallback} [hitAreaCallback] - A function that will return `true` if the given x/y coords it is sent are within the shape. If you provide a shape you must also provide a callback. + * + * @return {this} This Game Object. + */ + setDropZone: function (hitArea, hitAreaCallback) + { + if (!this.input) { - graphics.lineTo(points[i].x, points[i].y); + this.setInteractive(hitArea, hitAreaCallback, true); } - graphics.strokePath(); + return this; + }, - // So you can chain graphics calls - return graphics; + /** + * A NOOP method so you can pass a Zone to a Container. + * Calling this method will do nothing. It is intentionally empty. + * + * @method Phaser.GameObjects.Zone#setAlpha + * @private + * @since 3.11.0 + */ + setAlpha: function () + { }, /** - * Returns a JSON object that describes this curve. + * A NOOP method so you can pass a Zone to a Container in Canvas. + * Calling this method will do nothing. It is intentionally empty. * - * @method Phaser.Curves.CubicBezier#toJSON - * @since 3.0.0 + * @method Phaser.GameObjects.Zone#setBlendMode + * @private + * @since 3.16.2 + */ + setBlendMode: function () + { + }, + + /** + * A Zone does not render. * - * @return {Phaser.Types.Curves.JSONCurve} The JSON object containing this curve data. + * @method Phaser.GameObjects.Zone#renderCanvas + * @private + * @since 3.53.0 + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ - toJSON: function () + renderCanvas: function (renderer, src, camera) { - return { - type: this.type, - points: [ - this.p0.x, this.p0.y, - this.p1.x, this.p1.y, - this.p2.x, this.p2.y, - this.p3.x, this.p3.y - ] - }; + camera.addToRenderList(src); + }, + + /** + * A Zone does not render. + * + * @method Phaser.GameObjects.Zone#renderWebGL + * @private + * @since 3.53.0 + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ + renderWebGL: function (renderer, src, camera) + { + camera.addToRenderList(src); } }); +module.exports = Zone; + + +/***/ }), + +/***/ 24067: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + /** - * Generates a curve from a JSON object. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GameObjectCreator = __webpack_require__(99325); +var GetAdvancedValue = __webpack_require__(20494); +var Zone = __webpack_require__(71030); + +/** + * Creates a new Zone Game Object and returns it. * - * @function Phaser.Curves.CubicBezier.fromJSON + * Note: This method will only be available if the Zone Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#zone * @since 3.0.0 * - * @param {Phaser.Types.Curves.JSONCurve} data - The JSON object containing this curve data. + * @param {Phaser.Types.GameObjects.Zone.ZoneConfig} config - The configuration object this Game Object will use to create itself. * - * @return {Phaser.Curves.CubicBezier} The curve generated from the JSON object. + * @return {Phaser.GameObjects.Zone} The Game Object that was created. */ -CubicBezierCurve.fromJSON = function (data) +GameObjectCreator.register('zone', function (config) { - var points = data.points; + var x = GetAdvancedValue(config, 'x', 0); + var y = GetAdvancedValue(config, 'y', 0); + var width = GetAdvancedValue(config, 'width', 1); + var height = GetAdvancedValue(config, 'height', width); - var p0 = new Vector2(points[0], points[1]); - var p1 = new Vector2(points[2], points[3]); - var p2 = new Vector2(points[4], points[5]); - var p3 = new Vector2(points[6], points[7]); + return new Zone(this.scene, x, y, width, height); +}); - return new CubicBezierCurve(p0, p1, p2, p3); -}; +// When registering a factory function 'this' refers to the GameObjectCreator context. -module.exports = CubicBezierCurve; + +/***/ }), + +/***/ 34546: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Zone = __webpack_require__(71030); +var GameObjectFactory = __webpack_require__(61286); + +/** + * Creates a new Zone Game Object and adds it to the Scene. + * + * Note: This method will only be available if the Zone Game Object has been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#zone + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {number} width - The width of the Game Object. + * @param {number} height - The height of the Game Object. + * + * @return {Phaser.GameObjects.Zone} The Game Object that was created. + */ +GameObjectFactory.register('zone', function (x, y, width, height) +{ + return this.displayList.add(new Zone(this.scene, x, y, width, height)); +}); + +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns /***/ }), -/* 391 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 95847: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) +/** + * Calculates the area of the circle. + * + * @function Phaser.Geom.Circle.Area + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to get the area of. + * + * @return {number} The area of the Circle. + */ +var Area = function (circle) +{ + return (circle.radius > 0) ? Math.PI * circle.radius * circle.radius : 0; +}; + +module.exports = Area; + + +/***/ }), + +/***/ 26673: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -var Class = __webpack_require__(0); -var Curve = __webpack_require__(94); -var DegToRad = __webpack_require__(36); -var GetValue = __webpack_require__(6); -var RadToDeg = __webpack_require__(196); -var Vector2 = __webpack_require__(3); +var Class = __webpack_require__(56694); +var Contains = __webpack_require__(65650); +var GetPoint = __webpack_require__(94026); +var GetPoints = __webpack_require__(62941); +var GEOM_CONST = __webpack_require__(52394); +var Random = __webpack_require__(30977); /** * @classdesc - * An Elliptical Curve derived from the Base Curve class. - * - * See https://en.wikipedia.org/wiki/Elliptic_curve for more details. + * A Circle object. * - * @class Ellipse - * @extends Phaser.Curves.Curve - * @memberof Phaser.Curves + * This is a geometry object, containing numerical values and related methods to inspect and modify them. + * It is not a Game Object, in that you cannot add it to the display list, and it has no texture. + * To render a Circle you should look at the capabilities of the Graphics class. + * + * @class Circle + * @memberof Phaser.Geom * @constructor * @since 3.0.0 * - * @param {(number|Phaser.Types.Curves.EllipseCurveConfig)} [x=0] - The x coordinate of the ellipse, or an Ellipse Curve configuration object. - * @param {number} [y=0] - The y coordinate of the ellipse. - * @param {number} [xRadius=0] - The horizontal radius of ellipse. - * @param {number} [yRadius=0] - The vertical radius of ellipse. - * @param {number} [startAngle=0] - The start angle of the ellipse, in degrees. - * @param {number} [endAngle=360] - The end angle of the ellipse, in degrees. - * @param {boolean} [clockwise=false] - Whether the ellipse angles are given as clockwise (`true`) or counter-clockwise (`false`). - * @param {number} [rotation=0] - The rotation of the ellipse, in degrees. + * @param {number} [x=0] - The x position of the center of the circle. + * @param {number} [y=0] - The y position of the center of the circle. + * @param {number} [radius=0] - The radius of the circle. */ -var EllipseCurve = new Class({ - - Extends: Curve, +var Circle = new Class({ initialize: - function EllipseCurve (x, y, xRadius, yRadius, startAngle, endAngle, clockwise, rotation) + function Circle (x, y, radius) { - if (typeof x === 'object') - { - var config = x; - - x = GetValue(config, 'x', 0); - y = GetValue(config, 'y', 0); - xRadius = GetValue(config, 'xRadius', 0); - yRadius = GetValue(config, 'yRadius', xRadius); - startAngle = GetValue(config, 'startAngle', 0); - endAngle = GetValue(config, 'endAngle', 360); - clockwise = GetValue(config, 'clockwise', false); - rotation = GetValue(config, 'rotation', 0); - } - else - { - if (yRadius === undefined) { yRadius = xRadius; } - if (startAngle === undefined) { startAngle = 0; } - if (endAngle === undefined) { endAngle = 360; } - if (clockwise === undefined) { clockwise = false; } - if (rotation === undefined) { rotation = 0; } - } - - Curve.call(this, 'EllipseCurve'); - - // Center point + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (radius === undefined) { radius = 0; } /** - * The center point of the ellipse. Used for calculating rotation. + * The geometry constant type of this object: `GEOM_CONST.CIRCLE`. + * Used for fast type comparisons. * - * @name Phaser.Curves.Ellipse#p0 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 + * @name Phaser.Geom.Circle#type + * @type {number} + * @readonly + * @since 3.19.0 */ - this.p0 = new Vector2(x, y); + this.type = GEOM_CONST.CIRCLE; /** - * The horizontal radius of the ellipse. - * - * @name Phaser.Curves.Ellipse#_xRadius - * @type {number} - * @private - * @since 3.0.0 - */ - this._xRadius = xRadius; - - /** - * The vertical radius of the ellipse. + * The x position of the center of the circle. * - * @name Phaser.Curves.Ellipse#_yRadius + * @name Phaser.Geom.Circle#x * @type {number} - * @private + * @default 0 * @since 3.0.0 */ - this._yRadius = yRadius; - - // Radians + this.x = x; /** - * The starting angle of the ellipse in radians. + * The y position of the center of the circle. * - * @name Phaser.Curves.Ellipse#_startAngle + * @name Phaser.Geom.Circle#y * @type {number} - * @private + * @default 0 * @since 3.0.0 */ - this._startAngle = DegToRad(startAngle); + this.y = y; /** - * The end angle of the ellipse in radians. + * The internal radius of the circle. * - * @name Phaser.Curves.Ellipse#_endAngle + * @name Phaser.Geom.Circle#_radius * @type {number} * @private * @since 3.0.0 */ - this._endAngle = DegToRad(endAngle); - - /** - * Anti-clockwise direction. - * - * @name Phaser.Curves.Ellipse#_clockwise - * @type {boolean} - * @private - * @since 3.0.0 - */ - this._clockwise = clockwise; + this._radius = radius; /** - * The rotation of the arc. + * The internal diameter of the circle. * - * @name Phaser.Curves.Ellipse#_rotation + * @name Phaser.Geom.Circle#_diameter * @type {number} * @private * @since 3.0.0 */ - this._rotation = DegToRad(rotation); - }, - - /** - * Gets the starting point on the curve. - * - * @method Phaser.Curves.Ellipse#getStartPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. - * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. - */ - getStartPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } - - return this.getPoint(0, out); + this._diameter = radius * 2; }, /** - * Get the resolution of the curve. + * Check to see if the Circle contains the given x / y coordinates. * - * @method Phaser.Curves.Ellipse#getResolution + * @method Phaser.Geom.Circle#contains * @since 3.0.0 * - * @param {number} divisions - Optional divisions value. + * @param {number} x - The x coordinate to check within the circle. + * @param {number} y - The y coordinate to check within the circle. * - * @return {number} The curve resolution. + * @return {boolean} True if the coordinates are within the circle, otherwise false. */ - getResolution: function (divisions) + contains: function (x, y) { - return divisions * 2; + return Contains(this, x, y); }, /** - * Get point at relative position in curve according to length. + * Returns a Point object containing the coordinates of a point on the circumference of the Circle + * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point + * at 180 degrees around the circle. * - * @method Phaser.Curves.Ellipse#getPoint + * @method Phaser.Geom.Circle#getPoint * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [out,$return] + * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle. + * @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created. * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the circle. */ - getPoint: function (t, out) + getPoint: function (position, point) { - if (out === undefined) { out = new Vector2(); } - - var twoPi = Math.PI * 2; - var deltaAngle = this._endAngle - this._startAngle; - var samePoints = Math.abs(deltaAngle) < Number.EPSILON; - - // ensures that deltaAngle is 0 .. 2 PI - while (deltaAngle < 0) - { - deltaAngle += twoPi; - } - - while (deltaAngle > twoPi) - { - deltaAngle -= twoPi; - } - - if (deltaAngle < Number.EPSILON) - { - if (samePoints) - { - deltaAngle = 0; - } - else - { - deltaAngle = twoPi; - } - } - - if (this._clockwise && !samePoints) - { - if (deltaAngle === twoPi) - { - deltaAngle = - twoPi; - } - else - { - deltaAngle = deltaAngle - twoPi; - } - } - - var angle = this._startAngle + t * deltaAngle; - var x = this.p0.x + this._xRadius * Math.cos(angle); - var y = this.p0.y + this._yRadius * Math.sin(angle); - - if (this._rotation !== 0) - { - var cos = Math.cos(this._rotation); - var sin = Math.sin(this._rotation); - - var tx = x - this.p0.x; - var ty = y - this.p0.y; - - // Rotate the point about the center of the ellipse. - x = tx * cos - ty * sin + this.p0.x; - y = tx * sin + ty * cos + this.p0.y; - } - - return out.set(x, y); + return GetPoint(this, position, point); }, /** - * Sets the horizontal radius of this curve. + * Returns an array of Point objects containing the coordinates of the points around the circumference of the Circle, + * based on the given quantity or stepRate values. * - * @method Phaser.Curves.Ellipse#setXRadius + * @method Phaser.Geom.Circle#getPoints * @since 3.0.0 * - * @param {number} value - The horizontal radius of this curve. - * - * @return {this} This curve object. - */ - setXRadius: function (value) - { - this.xRadius = value; - - return this; - }, - - /** - * Sets the vertical radius of this curve. - * - * @method Phaser.Curves.Ellipse#setYRadius - * @since 3.0.0 + * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @param {number} value - The vertical radius of this curve. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate. + * @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created. * - * @return {this} This curve object. + * @return {(array|Phaser.Geom.Point[])} An array of Point objects pertaining to the points around the circumference of the circle. */ - setYRadius: function (value) + getPoints: function (quantity, stepRate, output) { - this.yRadius = value; - - return this; + return GetPoints(this, quantity, stepRate, output); }, /** - * Sets the width of this curve. + * Returns a uniformly distributed random point from anywhere within the Circle. * - * @method Phaser.Curves.Ellipse#setWidth + * @method Phaser.Geom.Circle#getRandomPoint * @since 3.0.0 * - * @param {number} value - The width of this curve. - * - * @return {this} This curve object. - */ - setWidth: function (value) - { - this.xRadius = value / 2; - - return this; - }, - - /** - * Sets the height of this curve. - * - * @method Phaser.Curves.Ellipse#setHeight - * @since 3.0.0 + * @generic {Phaser.Geom.Point} O - [point,$return] * - * @param {number} value - The height of this curve. + * @param {(Phaser.Geom.Point|object)} [point] - A Point or point-like object to set the random `x` and `y` values in. * - * @return {this} This curve object. + * @return {(Phaser.Geom.Point|object)} A Point object with the random values set in the `x` and `y` properties. */ - setHeight: function (value) + getRandomPoint: function (point) { - this.yRadius = value / 2; - - return this; + return Random(this, point); }, /** - * Sets the start angle of this curve. + * Sets the x, y and radius of this circle. * - * @method Phaser.Curves.Ellipse#setStartAngle + * @method Phaser.Geom.Circle#setTo * @since 3.0.0 * - * @param {number} value - The start angle of this curve, in radians. + * @param {number} [x=0] - The x position of the center of the circle. + * @param {number} [y=0] - The y position of the center of the circle. + * @param {number} [radius=0] - The radius of the circle. * - * @return {this} This curve object. + * @return {this} This Circle object. */ - setStartAngle: function (value) + setTo: function (x, y, radius) { - this.startAngle = value; + this.x = x; + this.y = y; + this._radius = radius; + this._diameter = radius * 2; return this; }, /** - * Sets the end angle of this curve. + * Sets this Circle to be empty with a radius of zero. + * Does not change its position. * - * @method Phaser.Curves.Ellipse#setEndAngle + * @method Phaser.Geom.Circle#setEmpty * @since 3.0.0 * - * @param {number} value - The end angle of this curve, in radians. - * - * @return {this} This curve object. + * @return {this} This Circle object. */ - setEndAngle: function (value) + setEmpty: function () { - this.endAngle = value; + this._radius = 0; + this._diameter = 0; return this; }, /** - * Sets if this curve extends clockwise or anti-clockwise. + * Sets the position of this Circle. * - * @method Phaser.Curves.Ellipse#setClockwise + * @method Phaser.Geom.Circle#setPosition * @since 3.0.0 * - * @param {boolean} value - The clockwise state of this curve. + * @param {number} [x=0] - The x position of the center of the circle. + * @param {number} [y=0] - The y position of the center of the circle. * - * @return {this} This curve object. + * @return {this} This Circle object. */ - setClockwise: function (value) + setPosition: function (x, y) { - this.clockwise = value; + if (y === undefined) { y = x; } + + this.x = x; + this.y = y; return this; }, /** - * Sets the rotation of this curve. + * Checks to see if the Circle is empty: has a radius of zero. * - * @method Phaser.Curves.Ellipse#setRotation + * @method Phaser.Geom.Circle#isEmpty * @since 3.0.0 * - * @param {number} value - The rotation of this curve, in radians. - * - * @return {this} This curve object. + * @return {boolean} True if the Circle is empty, otherwise false. */ - setRotation: function (value) + isEmpty: function () { - this.rotation = value; - - return this; + return (this._radius <= 0); }, /** - * The x coordinate of the center of the ellipse. + * The radius of the Circle. * - * @name Phaser.Curves.Ellipse#x + * @name Phaser.Geom.Circle#radius * @type {number} * @since 3.0.0 */ - x: { + radius: { get: function () { - return this.p0.x; + return this._radius; }, set: function (value) { - this.p0.x = value; + this._radius = value; + this._diameter = value * 2; } }, /** - * The y coordinate of the center of the ellipse. + * The diameter of the Circle. * - * @name Phaser.Curves.Ellipse#y + * @name Phaser.Geom.Circle#diameter * @type {number} * @since 3.0.0 */ - y: { + diameter: { get: function () { - return this.p0.y; + return this._diameter; }, set: function (value) { - this.p0.y = value; + this._diameter = value; + this._radius = value * 0.5; } }, /** - * The horizontal radius of the ellipse. + * The left position of the Circle. * - * @name Phaser.Curves.Ellipse#xRadius + * @name Phaser.Geom.Circle#left * @type {number} * @since 3.0.0 */ - xRadius: { + left: { get: function () { - return this._xRadius; + return this.x - this._radius; }, set: function (value) { - this._xRadius = value; + this.x = value + this._radius; } }, /** - * The vertical radius of the ellipse. + * The right position of the Circle. * - * @name Phaser.Curves.Ellipse#yRadius + * @name Phaser.Geom.Circle#right * @type {number} * @since 3.0.0 */ - yRadius: { + right: { get: function () { - return this._yRadius; + return this.x + this._radius; }, set: function (value) { - this._yRadius = value; + this.x = value - this._radius; } }, /** - * The start angle of the ellipse in degrees. + * The top position of the Circle. * - * @name Phaser.Curves.Ellipse#startAngle + * @name Phaser.Geom.Circle#top * @type {number} * @since 3.0.0 */ - startAngle: { + top: { get: function () { - return RadToDeg(this._startAngle); + return this.y - this._radius; }, set: function (value) { - this._startAngle = DegToRad(value); + this.y = value + this._radius; } }, /** - * The end angle of the ellipse in degrees. + * The bottom position of the Circle. * - * @name Phaser.Curves.Ellipse#endAngle + * @name Phaser.Geom.Circle#bottom * @type {number} * @since 3.0.0 */ - endAngle: { + bottom: { get: function () { - return RadToDeg(this._endAngle); + return this.y + this._radius; }, set: function (value) { - this._endAngle = DegToRad(value); + this.y = value - this._radius; } - }, - - /** - * `true` if the ellipse rotation is clockwise or `false` if anti-clockwise. - * - * @name Phaser.Curves.Ellipse#clockwise - * @type {boolean} - * @since 3.0.0 - */ - clockwise: { + } - get: function () - { - return this._clockwise; - }, +}); - set: function (value) - { - this._clockwise = value; - } +module.exports = Circle; - }, - /** - * The rotation of the ellipse, relative to the center, in degrees. - * - * @name Phaser.Curves.Ellipse#angle - * @type {number} - * @since 3.14.0 - */ - angle: { +/***/ }), - get: function () - { - return RadToDeg(this._rotation); - }, +/***/ 37964: +/***/ ((module) => { - set: function (value) - { - this._rotation = DegToRad(value); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - }, +/** + * Returns the circumference of the given Circle. + * + * @function Phaser.Geom.Circle.Circumference + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference of. + * + * @return {number} The circumference of the Circle. + */ +var Circumference = function (circle) +{ + return 2 * (Math.PI * circle.radius); +}; - /** - * The rotation of the ellipse, relative to the center, in radians. - * - * @name Phaser.Curves.Ellipse#rotation - * @type {number} - * @since 3.0.0 - */ - rotation: { +module.exports = Circumference; - get: function () - { - return this._rotation; - }, - set: function (value) - { - this._rotation = value; - } +/***/ }), - }, +/***/ 72233: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * JSON serialization of the curve. - * - * @method Phaser.Curves.Ellipse#toJSON - * @since 3.0.0 - * - * @return {Phaser.Types.Curves.JSONEllipseCurve} The JSON object containing this curve data. - */ - toJSON: function () - { - return { - type: this.type, - x: this.p0.x, - y: this.p0.y, - xRadius: this._xRadius, - yRadius: this._yRadius, - startAngle: RadToDeg(this._startAngle), - endAngle: RadToDeg(this._endAngle), - clockwise: this._clockwise, - rotation: RadToDeg(this._rotation) - }; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -}); +var Point = __webpack_require__(79967); /** - * Creates a curve from the provided Ellipse Curve Configuration object. + * Returns a Point object containing the coordinates of a point on the circumference of the Circle based on the given angle. * - * @function Phaser.Curves.Ellipse.fromJSON + * @function Phaser.Geom.Circle.CircumferencePoint * @since 3.0.0 * - * @param {Phaser.Types.Curves.JSONEllipseCurve} data - The JSON object containing this curve data. + * @generic {Phaser.Geom.Point} O - [out,$return] * - * @return {Phaser.Curves.Ellipse} The ellipse curve constructed from the configuration object. + * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on. + * @param {number} angle - The angle from the center of the Circle to the circumference to return the point from. Given in radians. + * @param {(Phaser.Geom.Point|object)} [out] - A Point, or point-like object, to store the results in. If not given a Point will be created. + * + * @return {(Phaser.Geom.Point|object)} A Point object where the `x` and `y` properties are the point on the circumference. */ -EllipseCurve.fromJSON = function (data) +var CircumferencePoint = function (circle, angle, out) { - return new EllipseCurve(data); + if (out === undefined) { out = new Point(); } + + out.x = circle.x + (circle.radius * Math.cos(angle)); + out.y = circle.y + (circle.radius * Math.sin(angle)); + + return out; }; -module.exports = EllipseCurve; +module.exports = CircumferencePoint; /***/ }), -/* 392 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 61761: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - -var Class = __webpack_require__(0); -var Curve = __webpack_require__(94); -var FromPoints = __webpack_require__(199); -var Rectangle = __webpack_require__(10); -var Vector2 = __webpack_require__(3); +var Circle = __webpack_require__(26673); /** - * @classdesc - * A LineCurve is a "curve" comprising exactly two points (a line segment). + * Creates a new Circle instance based on the values contained in the given source. * - * @class Line - * @extends Phaser.Curves.Curve - * @memberof Phaser.Curves - * @constructor + * @function Phaser.Geom.Circle.Clone * @since 3.0.0 * - * @param {(Phaser.Math.Vector2|number[])} p0 - The first endpoint. - * @param {Phaser.Math.Vector2} [p1] - The second endpoint. + * @param {(Phaser.Geom.Circle|object)} source - The Circle to be cloned. Can be an instance of a Circle or a circle-like object, with x, y and radius properties. + * + * @return {Phaser.Geom.Circle} A clone of the source Circle. */ -var LineCurve = new Class({ - - Extends: Curve, - - initialize: +var Clone = function (source) +{ + return new Circle(source.x, source.y, source.radius); +}; - // vec2s or array - function LineCurve (p0, p1) - { - Curve.call(this, 'LineCurve'); +module.exports = Clone; - if (Array.isArray(p0)) - { - p1 = new Vector2(p0[2], p0[3]); - p0 = new Vector2(p0[0], p0[1]); - } - /** - * The first endpoint. - * - * @name Phaser.Curves.Line#p0 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p0 = p0; +/***/ }), - /** - * The second endpoint. - * - * @name Phaser.Curves.Line#p1 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p1 = p1; +/***/ 65650: +/***/ ((module) => { - // Override default Curve.arcLengthDivisions +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The quantity of arc length divisions within the curve. - * - * @name Phaser.Curves.Line#arcLengthDivisions - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.arcLengthDivisions = 1; - }, +/** + * Check to see if the Circle contains the given x / y coordinates. + * + * @function Phaser.Geom.Circle.Contains + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to check. + * @param {number} x - The x coordinate to check within the circle. + * @param {number} y - The y coordinate to check within the circle. + * + * @return {boolean} True if the coordinates are within the circle, otherwise false. + */ +var Contains = function (circle, x, y) +{ + // Check if x/y are within the bounds first + if (circle.radius > 0 && x >= circle.left && x <= circle.right && y >= circle.top && y <= circle.bottom) + { + var dx = (circle.x - x) * (circle.x - x); + var dy = (circle.y - y) * (circle.y - y); - /** - * Returns a Rectangle where the position and dimensions match the bounds of this Curve. - * - * @method Phaser.Curves.Line#getBounds - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [out,$return] - * - * @param {Phaser.Geom.Rectangle} [out] - A Rectangle object to store the bounds in. If not given a new Rectangle will be created. - * - * @return {Phaser.Geom.Rectangle} A Rectangle object holding the bounds of this curve. If `out` was given it will be this object. - */ - getBounds: function (out) + return (dx + dy) <= (circle.radius * circle.radius); + } + else { - if (out === undefined) { out = new Rectangle(); } + return false; + } +}; - return FromPoints([ this.p0, this.p1 ], out); - }, +module.exports = Contains; - /** - * Gets the starting point on the curve. - * - * @method Phaser.Curves.Line#getStartPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. - * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. - */ - getStartPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } - return out.copy(this.p0); - }, +/***/ }), - /** - * Gets the resolution of the line. - * - * @method Phaser.Curves.Line#getResolution - * @since 3.0.0 - * - * @param {number} [divisions=1] - The number of divisions to consider. - * - * @return {number} The resolution. Equal to the number of divisions. - */ - getResolution: function (divisions) - { - if (divisions === undefined) { divisions = 1; } +/***/ 39187: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return divisions; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Get point at relative position in curve according to length. - * - * @method Phaser.Curves.Line#getPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. - * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. - */ - getPoint: function (t, out) - { - if (out === undefined) { out = new Vector2(); } +var Contains = __webpack_require__(65650); - if (t === 1) - { - return out.copy(this.p1); - } +/** + * Check to see if the Circle contains the given Point object. + * + * @function Phaser.Geom.Circle.ContainsPoint + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to check. + * @param {(Phaser.Geom.Point|object)} point - The Point object to check if it's within the Circle or not. + * + * @return {boolean} True if the Point coordinates are within the circle, otherwise false. + */ +var ContainsPoint = function (circle, point) +{ + return Contains(circle, point.x, point.y); +}; - out.copy(this.p1).subtract(this.p0).scale(t).add(this.p0); +module.exports = ContainsPoint; - return out; - }, - // Line curve is linear, so we can overwrite default getPointAt +/***/ }), - /** - * Gets a point at a given position on the line. - * - * @method Phaser.Curves.Line#getPointAt - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} u - The position along the curve to return. Where 0 is the start and 1 is the end. - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. - * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. - */ - getPointAt: function (u, out) - { - return this.getPoint(u, out); - }, +/***/ 58672: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Gets the slope of the line as a unit vector. - * - * @method Phaser.Curves.Line#getTangent - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} [t] - The relative position on the line, [0..1]. - * @param {Phaser.Math.Vector2} [out] - A vector to store the result in. - * - * @return {Phaser.Math.Vector2} The tangent vector. - */ - getTangent: function (t, out) - { - if (out === undefined) { out = new Vector2(); } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - out.copy(this.p1).subtract(this.p0).normalize(); +var Contains = __webpack_require__(65650); - return out; - }, +/** + * Check to see if the Circle contains all four points of the given Rectangle object. + * + * @function Phaser.Geom.Circle.ContainsRect + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The Circle to check. + * @param {(Phaser.Geom.Rectangle|object)} rect - The Rectangle object to check if it's within the Circle or not. + * + * @return {boolean} True if all of the Rectangle coordinates are within the circle, otherwise false. + */ +var ContainsRect = function (circle, rect) +{ + return ( + Contains(circle, rect.x, rect.y) && + Contains(circle, rect.right, rect.y) && + Contains(circle, rect.x, rect.bottom) && + Contains(circle, rect.right, rect.bottom) + ); +}; - /** - * Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant. - * - * @method Phaser.Curves.Line#getUtoTmapping - * @since 3.0.0 - * - * @param {number} u - A float between 0 and 1. - * @param {number} distance - The distance, in pixels. - * @param {number} [divisions] - Optional amount of divisions. - * - * @return {number} The equidistant value. - */ - getUtoTmapping: function (u, distance, divisions) - { - var t; +module.exports = ContainsRect; - if (distance) - { - var arcLengths = this.getLengths(divisions); - var lineLength = arcLengths[arcLengths.length - 1]; - // Cannot overshoot the curve - var targetLineLength = Math.min(distance, lineLength); +/***/ }), - t = targetLineLength / lineLength; - } - else - { - t = u; - } +/***/ 42997: +/***/ ((module) => { - return t; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Override default Curve.draw because this is better than calling getPoints on a line! +/** + * Copies the `x`, `y` and `radius` properties from the `source` Circle + * into the given `dest` Circle, then returns the `dest` Circle. + * + * @function Phaser.Geom.Circle.CopyFrom + * @since 3.0.0 + * + * @generic {Phaser.Geom.Circle} O - [dest,$return] + * + * @param {Phaser.Geom.Circle} source - The source Circle to copy the values from. + * @param {Phaser.Geom.Circle} dest - The destination Circle to copy the values to. + * + * @return {Phaser.Geom.Circle} The destination Circle. + */ +var CopyFrom = function (source, dest) +{ + return dest.setTo(source.x, source.y, source.radius); +}; - /** - * Draws this curve on the given Graphics object. - * - * The curve is drawn using `Graphics.lineBetween` so will be drawn at whatever the present Graphics line color is. - * The Graphics object is not cleared before the draw, so the curve will appear on-top of anything else already rendered to it. - * - * @method Phaser.Curves.Line#draw - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] - * - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics instance onto which this curve will be drawn. - * - * @return {Phaser.GameObjects.Graphics} The Graphics object to which the curve was drawn. - */ - draw: function (graphics) - { - graphics.lineBetween(this.p0.x, this.p0.y, this.p1.x, this.p1.y); +module.exports = CopyFrom; - // So you can chain graphics calls - return graphics; - }, - /** - * Gets a JSON representation of the line. - * - * @method Phaser.Curves.Line#toJSON - * @since 3.0.0 - * - * @return {Phaser.Types.Curves.JSONCurve} The JSON object containing this curve data. - */ - toJSON: function () - { - return { - type: this.type, - points: [ - this.p0.x, this.p0.y, - this.p1.x, this.p1.y - ] - }; - } +/***/ }), -}); +/***/ 94894: +/***/ ((module) => { /** - * Configures this line from a JSON representation. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Compares the `x`, `y` and `radius` properties of the two given Circles. + * Returns `true` if they all match, otherwise returns `false`. * - * @function Phaser.Curves.Line.fromJSON + * @function Phaser.Geom.Circle.Equals * @since 3.0.0 * - * @param {Phaser.Types.Curves.JSONCurve} data - The JSON object containing this curve data. + * @param {Phaser.Geom.Circle} circle - The first Circle to compare. + * @param {Phaser.Geom.Circle} toCompare - The second Circle to compare. * - * @return {Phaser.Curves.Line} A new LineCurve object. + * @return {boolean} `true` if the two Circles equal each other, otherwise `false`. */ -LineCurve.fromJSON = function (data) +var Equals = function (circle, toCompare) { - var points = data.points; - - var p0 = new Vector2(points[0], points[1]); - var p1 = new Vector2(points[2], points[3]); - - return new LineCurve(p0, p1); + return ( + circle.x === toCompare.x && + circle.y === toCompare.y && + circle.radius === toCompare.radius + ); }; -module.exports = LineCurve; +module.exports = Equals; /***/ }), -/* 393 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 48027: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Vector2 = __webpack_require__(3); +var Rectangle = __webpack_require__(74118); /** - * @classdesc - * A MoveTo Curve is a very simple curve consisting of only a single point. - * Its intended use is to move the ending point in a Path. + * Returns the bounds of the Circle object. * - * @class MoveTo - * @memberof Phaser.Curves - * @constructor + * @function Phaser.Geom.Circle.GetBounds * @since 3.0.0 * - * @param {number} [x=0] - `x` pixel coordinate. - * @param {number} [y=0] - `y` pixel coordinate. + * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * + * @param {Phaser.Geom.Circle} circle - The Circle to get the bounds from. + * @param {(Phaser.Geom.Rectangle|object)} [out] - A Rectangle, or rectangle-like object, to store the circle bounds in. If not given a new Rectangle will be created. + * + * @return {(Phaser.Geom.Rectangle|object)} The Rectangle object containing the Circles bounds. */ -var MoveTo = new Class({ +var GetBounds = function (circle, out) +{ + if (out === undefined) { out = new Rectangle(); } - initialize: + out.x = circle.left; + out.y = circle.top; + out.width = circle.diameter; + out.height = circle.diameter; - function MoveTo (x, y) - { - /** - * Denotes that this Curve does not influence the bounds, points, and drawing of its parent Path. Must be `false` or some methods in the parent Path will throw errors. - * - * @name Phaser.Curves.MoveTo#active - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.active = false; + return out; +}; - /** - * The lone point which this curve consists of. - * - * @name Phaser.Curves.MoveTo#p0 - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.p0 = new Vector2(x, y); - }, +module.exports = GetBounds; - /** - * Get point at relative position in curve according to length. - * - * @method Phaser.Curves.MoveTo#getPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. - * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. - */ - getPoint: function (t, out) - { - if (out === undefined) { out = new Vector2(); } - return out.copy(this.p0); - }, +/***/ }), - /** - * Retrieves the point at given position in the curve. This will always return this curve's only point. - * - * @method Phaser.Curves.MoveTo#getPointAt - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} u - The position in the path to retrieve, between 0 and 1. Not used. - * @param {Phaser.Math.Vector2} [out] - An optional vector in which to store the point. - * - * @return {Phaser.Math.Vector2} The modified `out` vector, or a new `Vector2` if none was provided. - */ - getPointAt: function (u, out) - { - return this.getPoint(u, out); - }, +/***/ 94026: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Gets the resolution of this curve. - * - * @method Phaser.Curves.MoveTo#getResolution - * @since 3.0.0 - * - * @return {number} The resolution of this curve. For a MoveTo the value is always 1. - */ - getResolution: function () - { - return 1; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Gets the length of this curve. - * - * @method Phaser.Curves.MoveTo#getLength - * @since 3.0.0 - * - * @return {number} The length of this curve. For a MoveTo the value is always 0. - */ - getLength: function () - { - return 0; - }, +var CircumferencePoint = __webpack_require__(72233); +var FromPercent = __webpack_require__(91806); +var MATH_CONST = __webpack_require__(83392); +var Point = __webpack_require__(79967); - /** - * Converts this curve into a JSON-serializable object. - * - * @method Phaser.Curves.MoveTo#toJSON - * @since 3.0.0 - * - * @return {Phaser.Types.Curves.JSONCurve} A primitive object with the curve's type and only point. - */ - toJSON: function () - { - return { - type: 'MoveTo', - points: [ - this.p0.x, this.p0.y - ] - }; - } +/** + * Returns a Point object containing the coordinates of a point on the circumference of the Circle + * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point + * at 180 degrees around the circle. + * + * @function Phaser.Geom.Circle.GetPoint + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Circle} circle - The Circle to get the circumference point on. + * @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle. + * @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created. + * + * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the circle. + */ +var GetPoint = function (circle, position, out) +{ + if (out === undefined) { out = new Point(); } -}); + var angle = FromPercent(position, 0, MATH_CONST.PI2); -module.exports = MoveTo; + return CircumferencePoint(circle, angle, out); +}; + +module.exports = GetPoint; /***/ }), -/* 394 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 62941: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Curve = __webpack_require__(94); -var QuadraticBezierInterpolation = __webpack_require__(359); -var Vector2 = __webpack_require__(3); +var Circumference = __webpack_require__(37964); +var CircumferencePoint = __webpack_require__(72233); +var FromPercent = __webpack_require__(91806); +var MATH_CONST = __webpack_require__(83392); /** - * @classdesc - * A quadratic Bézier curve constructed from two control points. + * Returns an array of Point objects containing the coordinates of the points around the circumference of the Circle, + * based on the given quantity or stepRate values. * - * @class QuadraticBezier - * @extends Phaser.Curves.Curve - * @memberof Phaser.Curves - * @constructor - * @since 3.2.0 + * @function Phaser.Geom.Circle.GetPoints + * @since 3.0.0 * - * @param {(Phaser.Math.Vector2|number[])} p0 - Start point, or an array of point pairs. - * @param {Phaser.Math.Vector2} p1 - Control Point 1. - * @param {Phaser.Math.Vector2} p2 - Control Point 2. + * @param {Phaser.Geom.Circle} circle - The Circle to get the points from. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} [stepRate] - Sets the quantity by getting the circumference of the circle and dividing it by the stepRate. + * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created. + * + * @return {Phaser.Geom.Point[]} An array of Point objects pertaining to the points around the circumference of the circle. */ -var QuadraticBezier = new Class({ - - Extends: Curve, - - initialize: +var GetPoints = function (circle, quantity, stepRate, out) +{ + if (out === undefined) { out = []; } - function QuadraticBezier (p0, p1, p2) + // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!quantity && stepRate > 0) { - Curve.call(this, 'QuadraticBezier'); - - if (Array.isArray(p0)) - { - p2 = new Vector2(p0[4], p0[5]); - p1 = new Vector2(p0[2], p0[3]); - p0 = new Vector2(p0[0], p0[1]); - } - - /** - * The start point. - * - * @name Phaser.Curves.QuadraticBezier#p0 - * @type {Phaser.Math.Vector2} - * @since 3.2.0 - */ - this.p0 = p0; - - /** - * The first control point. - * - * @name Phaser.Curves.QuadraticBezier#p1 - * @type {Phaser.Math.Vector2} - * @since 3.2.0 - */ - this.p1 = p1; - - /** - * The second control point. - * - * @name Phaser.Curves.QuadraticBezier#p2 - * @type {Phaser.Math.Vector2} - * @since 3.2.0 - */ - this.p2 = p2; - }, + quantity = Circumference(circle) / stepRate; + } - /** - * Gets the starting point on the curve. - * - * @method Phaser.Curves.QuadraticBezier#getStartPoint - * @since 3.2.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. - * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. - */ - getStartPoint: function (out) + for (var i = 0; i < quantity; i++) { - if (out === undefined) { out = new Vector2(); } + var angle = FromPercent(i / quantity, 0, MATH_CONST.PI2); - return out.copy(this.p0); - }, + out.push(CircumferencePoint(circle, angle)); + } - /** - * Get the resolution of the curve. - * - * @method Phaser.Curves.QuadraticBezier#getResolution - * @since 3.2.0 - * - * @param {number} divisions - Optional divisions value. - * - * @return {number} The curve resolution. - */ - getResolution: function (divisions) - { - return divisions; - }, + return out; +}; - /** - * Get point at relative position in curve according to length. - * - * @method Phaser.Curves.QuadraticBezier#getPoint - * @since 3.2.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. - * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. - */ - getPoint: function (t, out) - { - if (out === undefined) { out = new Vector2(); } +module.exports = GetPoints; - var p0 = this.p0; - var p1 = this.p1; - var p2 = this.p2; - return out.set( - QuadraticBezierInterpolation(t, p0.x, p1.x, p2.x), - QuadraticBezierInterpolation(t, p0.y, p1.y, p2.y) - ); - }, +/***/ }), - /** - * Draws this curve on the given Graphics object. - * - * The curve is drawn using `Graphics.strokePoints` so will be drawn at whatever the present Graphics stroke color is. - * The Graphics object is not cleared before the draw, so the curve will appear on-top of anything else already rendered to it. - * - * @method Phaser.Curves.QuadraticBezier#draw - * @since 3.2.0 - * - * @generic {Phaser.GameObjects.Graphics} G - [graphics,$return] - * - * @param {Phaser.GameObjects.Graphics} graphics - `Graphics` object to draw onto. - * @param {number} [pointsTotal=32] - Number of points to be used for drawing the curve. Higher numbers result in smoother curve but require more processing. - * - * @return {Phaser.GameObjects.Graphics} `Graphics` object that was drawn to. - */ - draw: function (graphics, pointsTotal) - { - if (pointsTotal === undefined) { pointsTotal = 32; } +/***/ 34585: +/***/ ((module) => { - var points = this.getPoints(pointsTotal); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - graphics.beginPath(); - graphics.moveTo(this.p0.x, this.p0.y); +/** + * Offsets the Circle by the values given. + * + * @function Phaser.Geom.Circle.Offset + * @since 3.0.0 + * + * @generic {Phaser.Geom.Circle} O - [circle,$return] + * + * @param {Phaser.Geom.Circle} circle - The Circle to be offset (translated.) + * @param {number} x - The amount to horizontally offset the Circle by. + * @param {number} y - The amount to vertically offset the Circle by. + * + * @return {Phaser.Geom.Circle} The Circle that was offset. + */ +var Offset = function (circle, x, y) +{ + circle.x += x; + circle.y += y; - for (var i = 1; i < points.length; i++) - { - graphics.lineTo(points[i].x, points[i].y); - } + return circle; +}; - graphics.strokePath(); +module.exports = Offset; - // So you can chain graphics calls - return graphics; - }, - /** - * Converts the curve into a JSON compatible object. - * - * @method Phaser.Curves.QuadraticBezier#toJSON - * @since 3.2.0 - * - * @return {Phaser.Types.Curves.JSONCurve} The JSON object containing this curve data. - */ - toJSON: function () - { - return { - type: this.type, - points: [ - this.p0.x, this.p0.y, - this.p1.x, this.p1.y, - this.p2.x, this.p2.y - ] - }; - } +/***/ }), -}); +/***/ 88665: +/***/ ((module) => { /** - * Creates a curve from a JSON object, e. g. created by `toJSON`. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Offsets the Circle by the values given in the `x` and `y` properties of the Point object. * - * @function Phaser.Curves.QuadraticBezier.fromJSON - * @since 3.2.0 + * @function Phaser.Geom.Circle.OffsetPoint + * @since 3.0.0 * - * @param {Phaser.Types.Curves.JSONCurve} data - The JSON object containing this curve data. + * @generic {Phaser.Geom.Circle} O - [circle,$return] * - * @return {Phaser.Curves.QuadraticBezier} The created curve instance. + * @param {Phaser.Geom.Circle} circle - The Circle to be offset (translated.) + * @param {(Phaser.Geom.Point|object)} point - The Point object containing the values to offset the Circle by. + * + * @return {Phaser.Geom.Circle} The Circle that was offset. */ -QuadraticBezier.fromJSON = function (data) +var OffsetPoint = function (circle, point) { - var points = data.points; - - var p0 = new Vector2(points[0], points[1]); - var p1 = new Vector2(points[2], points[3]); - var p2 = new Vector2(points[4], points[5]); + circle.x += point.x; + circle.y += point.y; - return new QuadraticBezier(p0, p1, p2); + return circle; }; -module.exports = QuadraticBezier; +module.exports = OffsetPoint; /***/ }), -/* 395 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 30977: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) - -var CatmullRom = __webpack_require__(194); -var Class = __webpack_require__(0); -var Curve = __webpack_require__(94); -var Vector2 = __webpack_require__(3); +var Point = __webpack_require__(79967); /** - * @classdesc - * Create a smooth 2d spline curve from a series of points. + * Returns a uniformly distributed random point from anywhere within the given Circle. * - * @class Spline - * @extends Phaser.Curves.Curve - * @memberof Phaser.Curves - * @constructor + * @function Phaser.Geom.Circle.Random * @since 3.0.0 * - * @param {(Phaser.Math.Vector2[]|number[]|number[][])} [points] - The points that configure the curve. + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Circle} circle - The Circle to get a random point from. + * @param {(Phaser.Geom.Point|object)} [out] - A Point or point-like object to set the random `x` and `y` values in. + * + * @return {(Phaser.Geom.Point|object)} A Point object with the random values set in the `x` and `y` properties. */ -var SplineCurve = new Class({ +var Random = function (circle, out) +{ + if (out === undefined) { out = new Point(); } - Extends: Curve, + var t = 2 * Math.PI * Math.random(); + var u = Math.random() + Math.random(); + var r = (u > 1) ? 2 - u : u; + var x = r * Math.cos(t); + var y = r * Math.sin(t); - initialize: + out.x = circle.x + (x * circle.radius); + out.y = circle.y + (y * circle.radius); - function SplineCurve (points) - { - if (points === undefined) { points = []; } + return out; +}; - Curve.call(this, 'SplineCurve'); +module.exports = Random; - /** - * The Vector2 points that configure the curve. - * - * @name Phaser.Curves.Spline#points - * @type {Phaser.Math.Vector2[]} - * @default [] - * @since 3.0.0 - */ - this.points = []; - this.addPoints(points); - }, +/***/ }), - /** - * Add a list of points to the current list of Vector2 points of the curve. - * - * @method Phaser.Curves.Spline#addPoints - * @since 3.0.0 - * - * @param {(Phaser.Math.Vector2[]|number[]|number[][])} points - The points that configure the curve. - * - * @return {this} This curve object. - */ - addPoints: function (points) - { - for (var i = 0; i < points.length; i++) - { - var p = new Vector2(); +/***/ 6112: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (typeof points[i] === 'number') - { - p.x = points[i]; - p.y = points[i + 1]; - i++; - } - else if (Array.isArray(points[i])) - { - // An array of arrays? - p.x = points[i][0]; - p.y = points[i][1]; - } - else - { - p.x = points[i].x; - p.y = points[i].y; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.points.push(p); - } +var Circle = __webpack_require__(26673); - return this; - }, +Circle.Area = __webpack_require__(95847); +Circle.Circumference = __webpack_require__(37964); +Circle.CircumferencePoint = __webpack_require__(72233); +Circle.Clone = __webpack_require__(61761); +Circle.Contains = __webpack_require__(65650); +Circle.ContainsPoint = __webpack_require__(39187); +Circle.ContainsRect = __webpack_require__(58672); +Circle.CopyFrom = __webpack_require__(42997); +Circle.Equals = __webpack_require__(94894); +Circle.GetBounds = __webpack_require__(48027); +Circle.GetPoint = __webpack_require__(94026); +Circle.GetPoints = __webpack_require__(62941); +Circle.Offset = __webpack_require__(34585); +Circle.OffsetPoint = __webpack_require__(88665); +Circle.Random = __webpack_require__(30977); - /** - * Add a point to the current list of Vector2 points of the curve. - * - * @method Phaser.Curves.Spline#addPoint - * @since 3.0.0 - * - * @param {number} x - The x coordinate of this curve - * @param {number} y - The y coordinate of this curve - * - * @return {Phaser.Math.Vector2} The new Vector2 added to the curve - */ - addPoint: function (x, y) - { - var vec = new Vector2(x, y); +module.exports = Circle; - this.points.push(vec); - return vec; - }, +/***/ }), + +/***/ 52394: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GEOM_CONST = { /** - * Gets the starting point on the curve. - * - * @method Phaser.Curves.Spline#getStartPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * A Circle Geometry object type. * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + * @name Phaser.Geom.CIRCLE + * @type {number} + * @since 3.19.0 */ - getStartPoint: function (out) - { - if (out === undefined) { out = new Vector2(); } - - return out.copy(this.points[0]); - }, + CIRCLE: 0, /** - * Get the resolution of the curve. - * - * @method Phaser.Curves.Spline#getResolution - * @since 3.0.0 - * - * @param {number} divisions - Optional divisions value. + * An Ellipse Geometry object type. * - * @return {number} The curve resolution. + * @name Phaser.Geom.ELLIPSE + * @type {number} + * @since 3.19.0 */ - getResolution: function (divisions) - { - return divisions * this.points.length; - }, + ELLIPSE: 1, /** - * Get point at relative position in curve according to length. - * - * @method Phaser.Curves.Spline#getPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {number} t - The position along the curve to return. Where 0 is the start and 1 is the end. - * @param {Phaser.Math.Vector2} [out] - A Vector2 object to store the result in. If not given will be created. + * A Line Geometry object type. * - * @return {Phaser.Math.Vector2} The coordinates of the point on the curve. If an `out` object was given this will be returned. + * @name Phaser.Geom.LINE + * @type {number} + * @since 3.19.0 */ - getPoint: function (t, out) - { - if (out === undefined) { out = new Vector2(); } - - var points = this.points; - - var point = (points.length - 1) * t; - - var intPoint = Math.floor(point); - - var weight = point - intPoint; - - var p0 = points[(intPoint === 0) ? intPoint : intPoint - 1]; - var p1 = points[intPoint]; - var p2 = points[(intPoint > points.length - 2) ? points.length - 1 : intPoint + 1]; - var p3 = points[(intPoint > points.length - 3) ? points.length - 1 : intPoint + 2]; - - return out.set(CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), CatmullRom(weight, p0.y, p1.y, p2.y, p3.y)); - }, + LINE: 2, /** - * Exports a JSON object containing this curve data. - * - * @method Phaser.Curves.Spline#toJSON - * @since 3.0.0 + * A Point Geometry object type. * - * @return {Phaser.Types.Curves.JSONCurve} The JSON object containing this curve data. + * @name Phaser.Geom.POINT + * @type {number} + * @since 3.19.0 */ - toJSON: function () - { - var points = []; + POINT: 3, - for (var i = 0; i < this.points.length; i++) - { - points.push(this.points[i].x); - points.push(this.points[i].y); - } + /** + * A Polygon Geometry object type. + * + * @name Phaser.Geom.POLYGON + * @type {number} + * @since 3.19.0 + */ + POLYGON: 4, - return { - type: this.type, - points: points - }; - } + /** + * A Rectangle Geometry object type. + * + * @name Phaser.Geom.RECTANGLE + * @type {number} + * @since 3.19.0 + */ + RECTANGLE: 5, -}); + /** + * A Triangle Geometry object type. + * + * @name Phaser.Geom.TRIANGLE + * @type {number} + * @since 3.19.0 + */ + TRIANGLE: 6 -/** - * Imports a JSON object containing this curve data. - * - * @function Phaser.Curves.Spline.fromJSON - * @since 3.0.0 - * - * @param {Phaser.Types.Curves.JSONCurve} data - The JSON object containing this curve data. - * - * @return {Phaser.Curves.Spline} The spline curve created. - */ -SplineCurve.fromJSON = function (data) -{ - return new SplineCurve(data.points); }; -module.exports = SplineCurve; +module.exports = GEOM_CONST; /***/ }), -/* 396 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 58605: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); - /** - * @classdesc - * A BaseShader is a small resource class that contains the data required for a WebGL Shader to be created. - * - * It contains the raw source code to the fragment and vertex shader, as well as an object that defines - * the uniforms the shader requires, if any. - * - * BaseShaders are stored in the Shader Cache, available in a Scene via `this.cache.shaders` and are referenced - * by a unique key-based string. Retrieve them via `this.cache.shaders.get(key)`. - * - * BaseShaders are created automatically by the GLSL File Loader when loading an external shader resource. - * They can also be created at runtime, allowing you to use dynamically generated shader source code. + * Calculates the area of the Ellipse. * - * Default fragment and vertex source is used if not provided in the constructor, setting-up a basic shader, - * suitable for debug rendering. + * @function Phaser.Geom.Ellipse.Area + * @since 3.0.0 * - * @class BaseShader - * @memberof Phaser.Display - * @constructor - * @since 3.17.0 + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the area of. * - * @param {string} key - The key of this shader. Must be unique within the shader cache. - * @param {string} [fragmentSrc] - The fragment source for the shader. - * @param {string} [vertexSrc] - The vertex source for the shader. - * @param {any} [uniforms] - Optional object defining the uniforms the shader uses. + * @return {number} The area of the Ellipse. */ -var BaseShader = new Class({ - - initialize: - - function BaseShader (key, fragmentSrc, vertexSrc, uniforms) +var Area = function (ellipse) +{ + if (ellipse.isEmpty()) { - if (!fragmentSrc || fragmentSrc === '') - { - fragmentSrc = [ - 'precision mediump float;', - - 'uniform vec2 resolution;', - - 'varying vec2 fragCoord;', - - 'void main () {', - ' vec2 uv = fragCoord / resolution.xy;', - ' gl_FragColor = vec4(uv.xyx, 1.0);', - '}' - ].join('\n'); - } - - if (!vertexSrc || vertexSrc === '') - { - vertexSrc = [ - 'precision mediump float;', - - 'uniform mat4 uProjectionMatrix;', - 'uniform mat4 uViewMatrix;', - 'uniform vec2 uResolution;', - - 'attribute vec2 inPosition;', - - 'varying vec2 fragCoord;', - 'varying vec2 outTexCoord;', - - 'void main () {', - ' gl_Position = uProjectionMatrix * uViewMatrix * vec4(inPosition, 1.0, 1.0);', - ' fragCoord = vec2(inPosition.x, uResolution.y - inPosition.y);', - ' outTexCoord = vec2(inPosition.x / uResolution.x, fragCoord.y / uResolution.y);', - '}' - ].join('\n'); - } - - if (uniforms === undefined) { uniforms = null; } - - /** - * The key of this shader, unique within the shader cache of this Phaser game instance. - * - * @name Phaser.Display.BaseShader#key - * @type {string} - * @since 3.17.0 - */ - this.key = key; - - /** - * The source code, as a string, of the fragment shader being used. - * - * @name Phaser.Display.BaseShader#fragmentSrc - * @type {string} - * @since 3.17.0 - */ - this.fragmentSrc = fragmentSrc; - - /** - * The source code, as a string, of the vertex shader being used. - * - * @name Phaser.Display.BaseShader#vertexSrc - * @type {string} - * @since 3.17.0 - */ - this.vertexSrc = vertexSrc; - - /** - * The default uniforms for this shader. - * - * @name Phaser.Display.BaseShader#uniforms - * @type {?any} - * @since 3.17.0 - */ - this.uniforms = uniforms; + return 0; } -}); + // units squared + return (ellipse.getMajorRadius() * ellipse.getMinorRadius() * Math.PI); +}; -module.exports = BaseShader; +module.exports = Area; /***/ }), -/* 397 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Color = __webpack_require__(38); - -Color.ColorSpectrum = __webpack_require__(909); -Color.ColorToRGBA = __webpack_require__(910); -Color.ComponentToHex = __webpack_require__(398); -Color.GetColor = __webpack_require__(103); -Color.GetColor32 = __webpack_require__(328); -Color.HexStringToColor = __webpack_require__(327); -Color.HSLToColor = __webpack_require__(911); -Color.HSVColorWheel = __webpack_require__(912); -Color.HSVToRGB = __webpack_require__(188); -Color.HueToComponent = __webpack_require__(399); -Color.IntegerToColor = __webpack_require__(189); -Color.IntegerToRGB = __webpack_require__(330); -Color.Interpolate = __webpack_require__(913); -Color.ObjectToColor = __webpack_require__(331); -Color.RandomRGB = __webpack_require__(914); -Color.RGBStringToColor = __webpack_require__(332); -Color.RGBToHSV = __webpack_require__(329); -Color.RGBToString = __webpack_require__(915); -Color.ValueToColor = __webpack_require__(187); - -module.exports = Color; - -/***/ }), -/* 398 */ -/***/ (function(module, exports) { +/***/ 39507: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Returns a string containing a hex representation of the given color component. + * Returns the circumference of the given Ellipse. * - * @function Phaser.Display.Color.ComponentToHex + * @function Phaser.Geom.Ellipse.Circumference * @since 3.0.0 * - * @param {number} color - The color channel to get the hex value for, must be a value between 0 and 255. + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the circumference of. * - * @return {string} A string of length 2 characters, i.e. 255 = ff, 100 = 64. + * @return {number} The circumference of th Ellipse. */ -var ComponentToHex = function (color) +var Circumference = function (ellipse) { - var hex = color.toString(16); + var rx = ellipse.width / 2; + var ry = ellipse.height / 2; + var h = Math.pow((rx - ry), 2) / Math.pow((rx + ry), 2); - return (hex.length === 1) ? '0' + hex : hex; + return (Math.PI * (rx + ry)) * (1 + ((3 * h) / (10 + Math.sqrt(4 - (3 * h))))); }; -module.exports = ComponentToHex; +module.exports = Circumference; /***/ }), -/* 399 */ -/***/ (function(module, exports) { + +/***/ 86998: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Point = __webpack_require__(79967); + /** - * Converts a hue to an RGB color. - * Based on code by Michael Jackson (https://github.com/mjijackson) + * Returns a Point object containing the coordinates of a point on the circumference of the Ellipse based on the given angle. * - * @function Phaser.Display.Color.HueToComponent + * @function Phaser.Geom.Ellipse.CircumferencePoint * @since 3.0.0 * - * @param {number} p - * @param {number} q - * @param {number} t + * @generic {Phaser.Geom.Point} O - [out,$return] * - * @return {number} The combined color value. + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the circumference point on. + * @param {number} angle - The angle from the center of the Ellipse to the circumference to return the point from. Given in radians. + * @param {(Phaser.Geom.Point|object)} [out] - A Point, or point-like object, to store the results in. If not given a Point will be created. + * + * @return {(Phaser.Geom.Point|object)} A Point object where the `x` and `y` properties are the point on the circumference. */ -var HueToComponent = function (p, q, t) +var CircumferencePoint = function (ellipse, angle, out) { - if (t < 0) - { - t += 1; - } - - if (t > 1) - { - t -= 1; - } - - if (t < 1 / 6) - { - return p + (q - p) * 6 * t; - } + if (out === undefined) { out = new Point(); } - if (t < 1 / 2) - { - return q; - } + var halfWidth = ellipse.width / 2; + var halfHeight = ellipse.height / 2; - if (t < 2 / 3) - { - return p + (q - p) * (2 / 3 - t) * 6; - } + out.x = ellipse.x + halfWidth * Math.cos(angle); + out.y = ellipse.y + halfHeight * Math.sin(angle); - return p; + return out; }; -module.exports = HueToComponent; +module.exports = CircumferencePoint; /***/ }), -/* 400 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 81773: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var OS = __webpack_require__(105); +var Ellipse = __webpack_require__(95669); /** - * @callback ContentLoadedCallback - */ - -/** - * Inspects the readyState of the document. If the document is already complete then it invokes the given callback. - * If not complete it sets up several event listeners such as `deviceready`, and once those fire, it invokes the callback. - * Called automatically by the Phaser.Game instance. Should not usually be accessed directly. + * Creates a new Ellipse instance based on the values contained in the given source. * - * @function Phaser.DOM.DOMContentLoaded + * @function Phaser.Geom.Ellipse.Clone * @since 3.0.0 * - * @param {ContentLoadedCallback} callback - The callback to be invoked when the device is ready and the DOM content is loaded. + * @param {Phaser.Geom.Ellipse} source - The Ellipse to be cloned. Can be an instance of an Ellipse or a ellipse-like object, with x, y, width and height properties. + * + * @return {Phaser.Geom.Ellipse} A clone of the source Ellipse. */ -var DOMContentLoaded = function (callback) +var Clone = function (source) { - if (document.readyState === 'complete' || document.readyState === 'interactive') - { - callback(); - - return; - } - - var check = function () - { - document.removeEventListener('deviceready', check, true); - document.removeEventListener('DOMContentLoaded', check, true); - window.removeEventListener('load', check, true); - - callback(); - }; - - if (!document.body) - { - window.setTimeout(check, 20); - } - else if (OS.cordova) - { - // Ref. http://docs.phonegap.com/en/3.5.0/cordova_events_events.md.html#deviceready - document.addEventListener('deviceready', check, false); - } - else - { - document.addEventListener('DOMContentLoaded', check, true); - window.addEventListener('load', check, true); - } + return new Ellipse(source.x, source.y, source.width, source.height); }; -module.exports = DOMContentLoaded; +module.exports = Clone; /***/ }), -/* 401 */ -/***/ (function(module, exports) { + +/***/ 72313: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Attempts to determine the document inner height across iOS and standard devices. - * Based on code by @tylerjpeterson + * Check to see if the Ellipse contains the given x / y coordinates. * - * @function Phaser.DOM.GetInnerHeight - * @since 3.16.0 + * @function Phaser.Geom.Ellipse.Contains + * @since 3.0.0 * - * @param {boolean} iOS - Is this running on iOS? + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to check. + * @param {number} x - The x coordinate to check within the ellipse. + * @param {number} y - The y coordinate to check within the ellipse. * - * @return {number} The inner height value. + * @return {boolean} True if the coordinates are within the ellipse, otherwise false. */ -var GetInnerHeight = function (iOS) +var Contains = function (ellipse, x, y) { - - if (!iOS) + if (ellipse.width <= 0 || ellipse.height <= 0) { - return window.innerHeight; + return false; } - var axis = Math.abs(window.orientation); - - var size = { w: 0, h: 0 }; - - var ruler = document.createElement('div'); - - ruler.setAttribute('style', 'position: fixed; height: 100vh; width: 0; top: 0'); - - document.documentElement.appendChild(ruler); - - size.w = (axis === 90) ? ruler.offsetHeight : window.innerWidth; - size.h = (axis === 90) ? window.innerWidth : ruler.offsetHeight; - - document.documentElement.removeChild(ruler); + // Normalize the coords to an ellipse with center 0,0 and a radius of 0.5 + var normx = ((x - ellipse.x) / ellipse.width); + var normy = ((y - ellipse.y) / ellipse.height); - ruler = null; + normx *= normx; + normy *= normy; - if (Math.abs(window.orientation) !== 90) - { - return size.h; - } - else - { - return size.w; - } + return (normx + normy < 0.25); }; -module.exports = GetInnerHeight; +module.exports = Contains; /***/ }), -/* 402 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 34368: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(201); +var Contains = __webpack_require__(72313); /** - * Attempts to determine the screen orientation using the Orientation API. + * Check to see if the Ellipse contains the given Point object. * - * @function Phaser.DOM.GetScreenOrientation - * @since 3.16.0 + * @function Phaser.Geom.Ellipse.ContainsPoint + * @since 3.0.0 * - * @param {number} width - The width of the viewport. - * @param {number} height - The height of the viewport. + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to check. + * @param {(Phaser.Geom.Point|object)} point - The Point object to check if it's within the Circle or not. * - * @return {string} The orientation. + * @return {boolean} True if the Point coordinates are within the circle, otherwise false. */ -var GetScreenOrientation = function (width, height) +var ContainsPoint = function (ellipse, point) { - var screen = window.screen; - var orientation = (screen) ? screen.orientation || screen.mozOrientation || screen.msOrientation : false; - - if (orientation && typeof orientation.type === 'string') - { - // Screen Orientation API specification - return orientation.type; - } - else if (typeof orientation === 'string') - { - // moz / ms-orientation are strings - return orientation; - } - - if (typeof window.orientation === 'number') - { - // Do this check first, as iOS supports this, but also has an incomplete window.screen implementation - // This may change by device based on "natural" orientation. - return (window.orientation === 0 || window.orientation === 180) ? CONST.ORIENTATION.PORTRAIT : CONST.ORIENTATION.LANDSCAPE; - } - else if (window.matchMedia) - { - if (window.matchMedia('(orientation: portrait)').matches) - { - return CONST.ORIENTATION.PORTRAIT; - } - else if (window.matchMedia('(orientation: landscape)').matches) - { - return CONST.ORIENTATION.LANDSCAPE; - } - } - else - { - return (height > width) ? CONST.ORIENTATION.PORTRAIT : CONST.ORIENTATION.LANDSCAPE; - } + return Contains(ellipse, point.x, point.y); }; -module.exports = GetScreenOrientation; +module.exports = ContainsPoint; /***/ }), -/* 403 */ -/***/ (function(module, exports) { + +/***/ 71431: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * Phaser Scale Manager constants for centering the game canvas. - * - * @namespace Phaser.Scale.Center - * @memberof Phaser.Scale - * @since 3.16.0 - */ +var Contains = __webpack_require__(72313); /** - * Phaser Scale Manager constants for centering the game canvas. - * - * To find out what each mode does please see [Phaser.Scale.Center]{@link Phaser.Scale.Center}. - * - * @typedef {Phaser.Scale.Center} Phaser.Scale.CenterType - * @memberof Phaser.Scale - * @since 3.16.0 + * Check to see if the Ellipse contains all four points of the given Rectangle object. + * + * @function Phaser.Geom.Ellipse.ContainsRect + * @since 3.0.0 + * + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to check. + * @param {(Phaser.Geom.Rectangle|object)} rect - The Rectangle object to check if it's within the Ellipse or not. + * + * @return {boolean} True if all of the Rectangle coordinates are within the ellipse, otherwise false. */ - -module.exports = { - - /** - * The game canvas is not centered within the parent by Phaser. - * You can still center it yourself via CSS. - * - * @name Phaser.Scale.Center.NO_CENTER - * @type {number} - * @const - * @since 3.16.0 - */ - NO_CENTER: 0, - - /** - * The game canvas is centered both horizontally and vertically within the parent. - * To do this, the parent has to have a bounds that can be calculated and not be empty. - * - * Centering is achieved by setting the margin left and top properties of the - * game canvas, and does not factor in any other CSS styles you may have applied. - * - * @name Phaser.Scale.Center.CENTER_BOTH - * @type {number} - * @const - * @since 3.16.0 - */ - CENTER_BOTH: 1, - - /** - * The game canvas is centered horizontally within the parent. - * To do this, the parent has to have a bounds that can be calculated and not be empty. - * - * Centering is achieved by setting the margin left and top properties of the - * game canvas, and does not factor in any other CSS styles you may have applied. - * - * @name Phaser.Scale.Center.CENTER_HORIZONTALLY - * @type {number} - * @const - * @since 3.16.0 - */ - CENTER_HORIZONTALLY: 2, - - /** - * The game canvas is centered both vertically within the parent. - * To do this, the parent has to have a bounds that can be calculated and not be empty. - * - * Centering is achieved by setting the margin left and top properties of the - * game canvas, and does not factor in any other CSS styles you may have applied. - * - * @name Phaser.Scale.Center.CENTER_VERTICALLY - * @type {number} - * @const - * @since 3.16.0 - */ - CENTER_VERTICALLY: 3 - +var ContainsRect = function (ellipse, rect) +{ + return ( + Contains(ellipse, rect.x, rect.y) && + Contains(ellipse, rect.right, rect.y) && + Contains(ellipse, rect.x, rect.bottom) && + Contains(ellipse, rect.right, rect.bottom) + ); }; +module.exports = ContainsRect; + /***/ }), -/* 404 */ -/***/ (function(module, exports) { + +/***/ 75459: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Phaser Scale Manager constants for orientation. - * - * @namespace Phaser.Scale.Orientation - * @memberof Phaser.Scale - * @since 3.16.0 - */ - -/** - * Phaser Scale Manager constants for orientation. - * - * To find out what each mode does please see [Phaser.Scale.Orientation]{@link Phaser.Scale.Orientation}. - * - * @typedef {Phaser.Scale.Orientation} Phaser.Scale.OrientationType - * @memberof Phaser.Scale - * @since 3.16.0 + * Copies the `x`, `y`, `width` and `height` properties from the `source` Ellipse + * into the given `dest` Ellipse, then returns the `dest` Ellipse. + * + * @function Phaser.Geom.Ellipse.CopyFrom + * @since 3.0.0 + * + * @generic {Phaser.Geom.Ellipse} O - [dest,$return] + * + * @param {Phaser.Geom.Ellipse} source - The source Ellipse to copy the values from. + * @param {Phaser.Geom.Ellipse} dest - The destination Ellipse to copy the values to. + * + * @return {Phaser.Geom.Ellipse} The destination Ellipse. */ - -module.exports = { - - /** - * A landscape orientation. - * - * @name Phaser.Scale.Orientation.LANDSCAPE - * @type {string} - * @const - * @since 3.16.0 - */ - LANDSCAPE: 'landscape-primary', - - /** - * A portrait orientation. - * - * @name Phaser.Scale.Orientation.PORTRAIT - * @type {string} - * @const - * @since 3.16.0 - */ - PORTRAIT: 'portrait-primary' - +var CopyFrom = function (source, dest) +{ + return dest.setTo(source.x, source.y, source.width, source.height); }; +module.exports = CopyFrom; + /***/ }), -/* 405 */ -/***/ (function(module, exports) { + +/***/ 95669: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * Phaser Scale Manager constants for the different scale modes available. - * - * @namespace Phaser.Scale.ScaleModes - * @memberof Phaser.Scale - * @since 3.16.0 - */ +var Class = __webpack_require__(56694); +var Contains = __webpack_require__(72313); +var GetPoint = __webpack_require__(95340); +var GetPoints = __webpack_require__(54978); +var GEOM_CONST = __webpack_require__(52394); +var Random = __webpack_require__(72006); /** - * Phaser Scale Manager constants for the different scale modes available. - * - * To find out what each mode does please see [Phaser.Scale.ScaleModes]{@link Phaser.Scale.ScaleModes}. - * - * @typedef {Phaser.Scale.ScaleModes} Phaser.Scale.ScaleModeType - * @memberof Phaser.Scale - * @since 3.16.0 + * @classdesc + * An Ellipse object. + * + * This is a geometry object, containing numerical values and related methods to inspect and modify them. + * It is not a Game Object, in that you cannot add it to the display list, and it has no texture. + * To render an Ellipse you should look at the capabilities of the Graphics class. + * + * @class Ellipse + * @memberof Phaser.Geom + * @constructor + * @since 3.0.0 + * + * @param {number} [x=0] - The x position of the center of the ellipse. + * @param {number} [y=0] - The y position of the center of the ellipse. + * @param {number} [width=0] - The width of the ellipse. + * @param {number} [height=0] - The height of the ellipse. */ +var Ellipse = new Class({ -module.exports = { + initialize: - /** - * No scaling happens at all. The canvas is set to the size given in the game config and Phaser doesn't change it - * again from that point on. If you change the canvas size, either via CSS, or directly via code, then you need - * to call the Scale Managers `resize` method to give the new dimensions, or input events will stop working. - * - * @name Phaser.Scale.ScaleModes.NONE - * @type {number} - * @const - * @since 3.16.0 - */ - NONE: 0, + function Ellipse (x, y, width, height) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 0; } + if (height === undefined) { height = 0; } - /** - * The height is automatically adjusted based on the width. - * - * @name Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT - * @type {number} - * @const - * @since 3.16.0 - */ - WIDTH_CONTROLS_HEIGHT: 1, - - /** - * The width is automatically adjusted based on the height. - * - * @name Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH - * @type {number} - * @const - * @since 3.16.0 - */ - HEIGHT_CONTROLS_WIDTH: 2, - - /** - * The width and height are automatically adjusted to fit inside the given target area, - * while keeping the aspect ratio. Depending on the aspect ratio there may be some space - * inside the area which is not covered. - * - * @name Phaser.Scale.ScaleModes.FIT - * @type {number} - * @const - * @since 3.16.0 - */ - FIT: 3, - - /** - * The width and height are automatically adjusted to make the size cover the entire target - * area while keeping the aspect ratio. This may extend further out than the target size. - * - * @name Phaser.Scale.ScaleModes.ENVELOP - * @type {number} - * @const - * @since 3.16.0 - */ - ENVELOP: 4, - - /** - * The Canvas is resized to fit all available _parent_ space, regardless of aspect ratio. - * - * @name Phaser.Scale.ScaleModes.RESIZE - * @type {number} - * @const - * @since 3.16.0 - */ - RESIZE: 5 - -}; - - -/***/ }), -/* 406 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Phaser Scale Manager constants for zoom modes. - * - * @namespace Phaser.Scale.Zoom - * @memberof Phaser.Scale - * @since 3.16.0 - */ - -/** - * Phaser Scale Manager constants for zoom modes. - * - * To find out what each mode does please see [Phaser.Scale.Zoom]{@link Phaser.Scale.Zoom}. - * - * @typedef {Phaser.Scale.Zoom} Phaser.Scale.ZoomType - * @memberof Phaser.Scale - * @since 3.16.0 - */ - -module.exports = { - - /** - * The game canvas will not be zoomed by Phaser. - * - * @name Phaser.Scale.Zoom.NO_ZOOM - * @type {number} - * @const - * @since 3.16.0 - */ - NO_ZOOM: 1, - - /** - * The game canvas will be 2x zoomed by Phaser. - * - * @name Phaser.Scale.Zoom.ZOOM_2X - * @type {number} - * @const - * @since 3.16.0 - */ - ZOOM_2X: 2, - - /** - * The game canvas will be 4x zoomed by Phaser. - * - * @name Phaser.Scale.Zoom.ZOOM_4X - * @type {number} - * @const - * @since 3.16.0 - */ - ZOOM_4X: 4, - - /** - * Calculate the zoom value based on the maximum multiplied game size that will - * fit into the parent, or browser window if no parent is set. - * - * @name Phaser.Scale.Zoom.MAX_ZOOM - * @type {number} - * @const - * @since 3.16.0 - */ - MAX_ZOOM: -1 - -}; - - -/***/ }), -/* 407 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Attempts to get the target DOM element based on the given value, which can be either - * a string, in which case it will be looked-up by ID, or an element node. If nothing - * can be found it will return a reference to the document.body. - * - * @function Phaser.DOM.GetTarget - * @since 3.16.0 - * - * @param {HTMLElement} element - The DOM element to look-up. - */ -var GetTarget = function (element) -{ - var target; - - if (element !== '') - { - if (typeof element === 'string') - { - // Hopefully an element ID - target = document.getElementById(element); - } - else if (element && element.nodeType === 1) - { - // Quick test for a HTMLElement - target = element; - } - } - - // Fallback to the document body. Covers an invalid ID and a non HTMLElement object. - if (!target) - { - // Use the full window - target = document.body; - } - - return target; -}; - -module.exports = GetTarget; - - -/***/ }), -/* 408 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Takes the given data string and parses it as XML. - * First tries to use the window.DOMParser and reverts to the Microsoft.XMLDOM if that fails. - * The parsed XML object is returned, or `null` if there was an error while parsing the data. - * - * @function Phaser.DOM.ParseXML - * @since 3.0.0 - * - * @param {string} data - The XML source stored in a string. - * - * @return {?(DOMParser|ActiveXObject)} The parsed XML data, or `null` if the data could not be parsed. - */ -var ParseXML = function (data) -{ - var xml = ''; - - try - { - if (window['DOMParser']) - { - var domparser = new DOMParser(); - xml = domparser.parseFromString(data, 'text/xml'); - } - else - { - xml = new ActiveXObject('Microsoft.XMLDOM'); - xml.loadXML(data); - } - } - catch (e) - { - xml = null; - } - - if (!xml || !xml.documentElement || xml.getElementsByTagName('parsererror').length) - { - return null; - } - else - { - return xml; - } -}; - -module.exports = ParseXML; - - -/***/ }), -/* 409 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var CONST = __webpack_require__(203); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(51); -var GameEvents = __webpack_require__(22); -var Keyboard = __webpack_require__(410); -var Mouse = __webpack_require__(411); -var Pointer = __webpack_require__(412); -var Touch = __webpack_require__(413); -var TransformMatrix = __webpack_require__(25); -var TransformXY = __webpack_require__(177); - -/** - * @classdesc - * The Input Manager is responsible for handling the pointer related systems in a single Phaser Game instance. - * - * Based on the Game Config it will create handlers for mouse and touch support. - * - * Keyboard and Gamepad are plugins, handled directly by the InputPlugin class. - * - * It then manages the events, pointer creation and general hit test related operations. - * - * You rarely need to interact with the Input Manager directly, and as such, all of its properties and methods - * should be considered private. Instead, you should use the Input Plugin, which is a Scene level system, responsible - * for dealing with all input events for a Scene. - * - * @class InputManager - * @memberof Phaser.Input - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - The Game instance that owns the Input Manager. - * @param {object} config - The Input Configuration object, as set in the Game Config. - */ -var InputManager = new Class({ - - initialize: - - function InputManager (game, config) - { /** - * The Game instance that owns the Input Manager. - * A Game only maintains on instance of the Input Manager at any time. - * - * @name Phaser.Input.InputManager#game - * @type {Phaser.Game} - * @readonly - * @since 3.0.0 - */ - this.game = game; - - /** - * A reference to the global Game Scale Manager. - * Used for all bounds checks and pointer scaling. - * - * @name Phaser.Input.InputManager#scaleManager - * @type {Phaser.Scale.ScaleManager} - * @since 3.16.0 - */ - this.scaleManager; - - /** - * The Canvas that is used for all DOM event input listeners. - * - * @name Phaser.Input.InputManager#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas; - - /** - * The Game Configuration object, as set during the game boot. - * - * @name Phaser.Input.InputManager#config - * @type {Phaser.Core.Config} - * @since 3.0.0 - */ - this.config = config; - - /** - * If set, the Input Manager will run its update loop every frame. - * - * @name Phaser.Input.InputManager#enabled - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.enabled = true; - - /** - * The Event Emitter instance that the Input Manager uses to emit events from. - * - * @name Phaser.Input.InputManager#events - * @type {Phaser.Events.EventEmitter} - * @since 3.0.0 - */ - this.events = new EventEmitter(); - - /** - * Are any mouse or touch pointers currently over the game canvas? - * This is updated automatically by the canvas over and out handlers. - * - * @name Phaser.Input.InputManager#isOver - * @type {boolean} - * @readonly - * @since 3.16.0 - */ - this.isOver = true; - - /** - * The default CSS cursor to be used when interacting with your game. - * - * See the `setDefaultCursor` method for more details. - * - * @name Phaser.Input.InputManager#defaultCursor - * @type {string} - * @since 3.10.0 - */ - this.defaultCursor = ''; - - /** - * A reference to the Keyboard Manager class, if enabled via the `input.keyboard` Game Config property. - * - * @name Phaser.Input.InputManager#keyboard - * @type {?Phaser.Input.Keyboard.KeyboardManager} - * @since 3.16.0 - */ - this.keyboard = (config.inputKeyboard) ? new Keyboard(this) : null; - - /** - * A reference to the Mouse Manager class, if enabled via the `input.mouse` Game Config property. - * - * @name Phaser.Input.InputManager#mouse - * @type {?Phaser.Input.Mouse.MouseManager} - * @since 3.0.0 - */ - this.mouse = (config.inputMouse) ? new Mouse(this) : null; - - /** - * A reference to the Touch Manager class, if enabled via the `input.touch` Game Config property. - * - * @name Phaser.Input.InputManager#touch - * @type {Phaser.Input.Touch.TouchManager} - * @since 3.0.0 - */ - this.touch = (config.inputTouch) ? new Touch(this) : null; - - /** - * An array of Pointers that have been added to the game. - * The first entry is reserved for the Mouse Pointer, the rest are Touch Pointers. - * - * By default there is 1 touch pointer enabled. If you need more use the `addPointer` method to start them, - * or set the `input.activePointers` property in the Game Config. - * - * @name Phaser.Input.InputManager#pointers - * @type {Phaser.Input.Pointer[]} - * @since 3.10.0 - */ - this.pointers = []; - - /** - * The number of touch objects activated and being processed each update. - * - * You can change this by either calling `addPointer` at run-time, or by - * setting the `input.activePointers` property in the Game Config. + * The geometry constant type of this object: `GEOM_CONST.ELLIPSE`. + * Used for fast type comparisons. * - * @name Phaser.Input.InputManager#pointersTotal + * @name Phaser.Geom.Ellipse#type * @type {number} * @readonly - * @since 3.10.0 - */ - this.pointersTotal = config.inputActivePointers; - - if (config.inputTouch && this.pointersTotal === 1) - { - this.pointersTotal = 2; - } - - for (var i = 0; i <= this.pointersTotal; i++) - { - var pointer = new Pointer(this, i); - - pointer.smoothFactor = config.inputSmoothFactor; - - this.pointers.push(pointer); - } - - /** - * The mouse has its own unique Pointer object, which you can reference directly if making a _desktop specific game_. - * If you are supporting both desktop and touch devices then do not use this property, instead use `activePointer` - * which will always map to the most recently interacted pointer. - * - * @name Phaser.Input.InputManager#mousePointer - * @type {?Phaser.Input.Pointer} - * @since 3.10.0 + * @since 3.19.0 */ - this.mousePointer = (config.inputMouse) ? this.pointers[0] : null; + this.type = GEOM_CONST.ELLIPSE; /** - * The most recently active Pointer object. - * - * If you've only 1 Pointer in your game then this will accurately be either the first finger touched, or the mouse. - * - * If your game doesn't need to support multi-touch then you can safely use this property in all of your game - * code and it will adapt to be either the mouse or the touch, based on device. + * The x position of the center of the ellipse. * - * @name Phaser.Input.InputManager#activePointer - * @type {Phaser.Input.Pointer} + * @name Phaser.Geom.Ellipse#x + * @type {number} + * @default 0 * @since 3.0.0 */ - this.activePointer = this.pointers[0]; + this.x = x; /** - * If the top-most Scene in the Scene List receives an input it will stop input from - * propagating any lower down the scene list, i.e. if you have a UI Scene at the top - * and click something on it, that click will not then be passed down to any other - * Scene below. Disable this to have input events passed through all Scenes, all the time. + * The y position of the center of the ellipse. * - * @name Phaser.Input.InputManager#globalTopOnly - * @type {boolean} - * @default true + * @name Phaser.Geom.Ellipse#y + * @type {number} + * @default 0 * @since 3.0.0 */ - this.globalTopOnly = true; + this.y = y; /** - * The time this Input Manager was last updated. - * This value is populated by the Game Step each frame. + * The width of the ellipse. * - * @name Phaser.Input.InputManager#time + * @name Phaser.Geom.Ellipse#width * @type {number} - * @readonly - * @since 3.16.2 - */ - this.time = 0; - - /** - * A re-cycled point-like object to store hit test values in. - * - * @name Phaser.Input.InputManager#_tempPoint - * @type {{x:number, y:number}} - * @private + * @default 0 * @since 3.0.0 */ - this._tempPoint = { x: 0, y: 0 }; + this.width = width; /** - * A re-cycled array to store hit results in. + * The height of the ellipse. * - * @name Phaser.Input.InputManager#_tempHitTest - * @type {array} - * @private - * @default [] + * @name Phaser.Geom.Ellipse#height + * @type {number} + * @default 0 * @since 3.0.0 */ - this._tempHitTest = []; - - /** - * A re-cycled matrix used in hit test calculations. - * - * @name Phaser.Input.InputManager#_tempMatrix - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @private - * @since 3.4.0 - */ - this._tempMatrix = new TransformMatrix(); - - /** - * A re-cycled matrix used in hit test calculations. - * - * @name Phaser.Input.InputManager#_tempMatrix2 - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @private - * @since 3.12.0 - */ - this._tempMatrix2 = new TransformMatrix(); - - /** - * An internal private var that records Scenes aborting event processing. - * - * @name Phaser.Input.InputManager#_tempSkip - * @type {boolean} - * @private - * @since 3.18.0 - */ - this._tempSkip = false; - - /** - * An internal private array that avoids needing to create a new array on every DOM mouse event. - * - * @name Phaser.Input.InputManager#mousePointerContainer - * @type {Phaser.Input.Pointer[]} - * @private - * @since 3.18.0 - */ - this.mousePointerContainer = [ this.mousePointer ]; - - game.events.once(GameEvents.BOOT, this.boot, this); + this.height = height; }, /** - * The Boot handler is called by Phaser.Game when it first starts up. - * The renderer is available by now. + * Check to see if the Ellipse contains the given x / y coordinates. * - * @method Phaser.Input.InputManager#boot - * @protected - * @fires Phaser.Input.Events#MANAGER_BOOT + * @method Phaser.Geom.Ellipse#contains * @since 3.0.0 + * + * @param {number} x - The x coordinate to check within the ellipse. + * @param {number} y - The y coordinate to check within the ellipse. + * + * @return {boolean} True if the coordinates are within the ellipse, otherwise false. */ - boot: function () + contains: function (x, y) { - this.canvas = this.game.canvas; - - this.scaleManager = this.game.scale; - - this.events.emit(Events.MANAGER_BOOT); - - this.game.events.on(GameEvents.PRE_RENDER, this.preRender, this); - - this.game.events.once(GameEvents.DESTROY, this.destroy, this); + return Contains(this, x, y); }, /** - * Internal canvas state change, called automatically by the Mouse Manager. + * Returns a Point object containing the coordinates of a point on the circumference of the Ellipse + * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point + * at 180 degrees around the circle. * - * @method Phaser.Input.InputManager#setCanvasOver - * @fires Phaser.Input.Events#GAME_OVER - * @private - * @since 3.16.0 + * @method Phaser.Geom.Ellipse#getPoint + * @since 3.0.0 * - * @param {(MouseEvent|TouchEvent)} event - The DOM Event. + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse. + * @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created. + * + * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the ellipse. */ - setCanvasOver: function (event) + getPoint: function (position, point) { - this.isOver = true; - - this.events.emit(Events.GAME_OVER, event); + return GetPoint(this, position, point); }, /** - * Internal canvas state change, called automatically by the Mouse Manager. + * Returns an array of Point objects containing the coordinates of the points around the circumference of the Ellipse, + * based on the given quantity or stepRate values. * - * @method Phaser.Input.InputManager#setCanvasOut - * @fires Phaser.Input.Events#GAME_OUT - * @private - * @since 3.16.0 + * @method Phaser.Geom.Ellipse#getPoints + * @since 3.0.0 * - * @param {(MouseEvent|TouchEvent)} event - The DOM Event. + * @generic {Phaser.Geom.Point[]} O - [output,$return] + * + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} [stepRate] - Sets the quantity by getting the circumference of the ellipse and dividing it by the stepRate. + * @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created. + * + * @return {(array|Phaser.Geom.Point[])} An array of Point objects pertaining to the points around the circumference of the ellipse. */ - setCanvasOut: function (event) + getPoints: function (quantity, stepRate, output) { - this.isOver = false; - - this.events.emit(Events.GAME_OUT, event); + return GetPoints(this, quantity, stepRate, output); }, /** - * Internal update, called automatically by the Game Step right at the start. + * Returns a uniformly distributed random point from anywhere within the given Ellipse. * - * @method Phaser.Input.InputManager#preRender - * @private - * @since 3.18.0 + * @method Phaser.Geom.Ellipse#getRandomPoint + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [point,$return] + * + * @param {(Phaser.Geom.Point|object)} [point] - A Point or point-like object to set the random `x` and `y` values in. + * + * @return {(Phaser.Geom.Point|object)} A Point object with the random values set in the `x` and `y` properties. */ - preRender: function () + getRandomPoint: function (point) { - var time = this.game.loop.now; - var delta = this.game.loop.delta; - var scenes = this.game.scene.getScenes(true, true); - - this.time = time; - - this.events.emit(Events.MANAGER_UPDATE); - - for (var i = 0; i < scenes.length; i++) - { - var scene = scenes[i]; - - if (scene.sys.input && scene.sys.input.updatePoll(time, delta) && this.globalTopOnly) - { - // If the Scene returns true, it means it captured some input that no other Scene should get, so we bail out - return; - } - } + return Random(this, point); }, /** - * Tells the Input system to set a custom cursor. - * - * This cursor will be the default cursor used when interacting with the game canvas. - * - * If an Interactive Object also sets a custom cursor, this is the cursor that is reset after its use. - * - * Any valid CSS cursor value is allowed, including paths to image files, i.e.: - * - * ```javascript - * this.input.setDefaultCursor('url(assets/cursors/sword.cur), pointer'); - * ``` - * - * Please read about the differences between browsers when it comes to the file formats and sizes they support: - * - * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor - * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_User_Interface/Using_URL_values_for_the_cursor_property + * Sets the x, y, width and height of this ellipse. * - * It's up to you to pick a suitable cursor format that works across the range of browsers you need to support. + * @method Phaser.Geom.Ellipse#setTo + * @since 3.0.0 * - * @method Phaser.Input.InputManager#setDefaultCursor - * @since 3.10.0 + * @param {number} x - The x position of the center of the ellipse. + * @param {number} y - The y position of the center of the ellipse. + * @param {number} width - The width of the ellipse. + * @param {number} height - The height of the ellipse. * - * @param {string} cursor - The CSS to be used when setting the default cursor. + * @return {this} This Ellipse object. */ - setDefaultCursor: function (cursor) + setTo: function (x, y, width, height) { - this.defaultCursor = cursor; + this.x = x; + this.y = y; + this.width = width; + this.height = height; - if (this.canvas.style.cursor !== cursor) - { - this.canvas.style.cursor = cursor; - } + return this; }, /** - * Called by the InputPlugin when processing over and out events. - * - * Tells the Input Manager to set a custom cursor during its postUpdate step. - * - * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor + * Sets this Ellipse to be empty with a width and height of zero. + * Does not change its position. * - * @method Phaser.Input.InputManager#setCursor - * @private - * @since 3.10.0 + * @method Phaser.Geom.Ellipse#setEmpty + * @since 3.0.0 * - * @param {Phaser.Types.Input.InteractiveObject} interactiveObject - The Interactive Object that called this method. + * @return {this} This Ellipse object. */ - setCursor: function (interactiveObject) + setEmpty: function () { - if (interactiveObject.cursor) - { - this.canvas.style.cursor = interactiveObject.cursor; - } + this.width = 0; + this.height = 0; + + return this; }, /** - * Called by the InputPlugin when processing over and out events. + * Sets the position of this Ellipse. * - * Tells the Input Manager to clear the hand cursor, if set, during its postUpdate step. + * @method Phaser.Geom.Ellipse#setPosition + * @since 3.0.0 * - * @method Phaser.Input.InputManager#resetCursor - * @private - * @since 3.10.0 + * @param {number} x - The x position of the center of the ellipse. + * @param {number} y - The y position of the center of the ellipse. * - * @param {Phaser.Types.Input.InteractiveObject} interactiveObject - The Interactive Object that called this method. + * @return {this} This Ellipse object. */ - resetCursor: function (interactiveObject) + setPosition: function (x, y) { - if (interactiveObject.cursor && this.canvas) - { - this.canvas.style.cursor = this.defaultCursor; - } + if (y === undefined) { y = x; } + + this.x = x; + this.y = y; + + return this; }, /** - * Adds new Pointer objects to the Input Manager. - * - * By default Phaser creates 2 pointer objects: `mousePointer` and `pointer1`. - * - * You can create more either by calling this method, or by setting the `input.activePointers` property - * in the Game Config, up to a maximum of 10 pointers. - * - * The first 10 pointers are available via the `InputPlugin.pointerX` properties, once they have been added - * via this method. + * Sets the size of this Ellipse. + * Does not change its position. * - * @method Phaser.Input.InputManager#addPointer - * @since 3.10.0 + * @method Phaser.Geom.Ellipse#setSize + * @since 3.0.0 * - * @param {number} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total. + * @param {number} width - The width of the ellipse. + * @param {number} [height=width] - The height of the ellipse. * - * @return {Phaser.Input.Pointer[]} An array containing all of the new Pointer objects that were created. + * @return {this} This Ellipse object. */ - addPointer: function (quantity) + setSize: function (width, height) { - if (quantity === undefined) { quantity = 1; } - - var output = []; - - if (this.pointersTotal + quantity > 10) - { - quantity = 10 - this.pointersTotal; - } - - for (var i = 0; i < quantity; i++) - { - var id = this.pointers.length; - - var pointer = new Pointer(this, id); - - pointer.smoothFactor = this.config.inputSmoothFactor; - - this.pointers.push(pointer); - - this.pointersTotal++; + if (height === undefined) { height = width; } - output.push(pointer); - } + this.width = width; + this.height = height; - return output; + return this; }, /** - * Internal method that gets a list of all the active Input Plugins in the game - * and updates each of them in turn, in reverse order (top to bottom), to allow - * for DOM top-level event handling simulation. + * Checks to see if the Ellipse is empty: has a width or height equal to zero. * - * @method Phaser.Input.InputManager#updateInputPlugins - * @since 3.16.0 + * @method Phaser.Geom.Ellipse#isEmpty + * @since 3.0.0 * - * @param {number} type - The type of event to process. - * @param {Phaser.Input.Pointer[]} pointers - An array of Pointers on which the event occurred. + * @return {boolean} True if the Ellipse is empty, otherwise false. */ - updateInputPlugins: function (type, pointers) + isEmpty: function () { - var scenes = this.game.scene.getScenes(true, true); - - this._tempSkip = false; - - for (var i = 0; i < scenes.length; i++) - { - var scene = scenes[i]; - - if (scene.sys.input) - { - var capture = scene.sys.input.update(type, pointers); - - if ((capture && this.globalTopOnly) || this._tempSkip) - { - // If the Scene returns true, or called stopPropagation, it means it captured some input that no other Scene should get, so we bail out - return; - } - } - } + return (this.width <= 0 || this.height <= 0); }, - // event.targetTouches = list of all touches on the TARGET ELEMENT (i.e. game dom element) - // event.touches = list of all touches on the ENTIRE DOCUMENT, not just the target element - // event.changedTouches = the touches that CHANGED in this event, not the total number of them - /** - * Processes a touch start event, as passed in by the TouchManager. + * Returns the minor radius of the ellipse. Also known as the Semi Minor Axis. * - * @method Phaser.Input.InputManager#onTouchStart - * @private - * @since 3.18.0 + * @method Phaser.Geom.Ellipse#getMinorRadius + * @since 3.0.0 * - * @param {TouchEvent} event - The native DOM Touch event. + * @return {number} The minor radius. */ - onTouchStart: function (event) + getMinorRadius: function () { - var pointers = this.pointers; - var changed = []; - - for (var c = 0; c < event.changedTouches.length; c++) - { - var changedTouch = event.changedTouches[c]; - - for (var i = 1; i < this.pointersTotal; i++) - { - var pointer = pointers[i]; - - if (!pointer.active) - { - pointer.touchstart(changedTouch, event); - - this.activePointer = pointer; - - changed.push(pointer); - - break; - } - } - } - - this.updateInputPlugins(CONST.TOUCH_START, changed); + return Math.min(this.width, this.height) / 2; }, /** - * Processes a touch move event, as passed in by the TouchManager. + * Returns the major radius of the ellipse. Also known as the Semi Major Axis. * - * @method Phaser.Input.InputManager#onTouchMove - * @private - * @since 3.18.0 + * @method Phaser.Geom.Ellipse#getMajorRadius + * @since 3.0.0 * - * @param {TouchEvent} event - The native DOM Touch event. + * @return {number} The major radius. */ - onTouchMove: function (event) + getMajorRadius: function () { - var pointers = this.pointers; - var changed = []; - - for (var c = 0; c < event.changedTouches.length; c++) - { - var changedTouch = event.changedTouches[c]; - - for (var i = 1; i < this.pointersTotal; i++) - { - var pointer = pointers[i]; - - if (pointer.active && pointer.identifier === changedTouch.identifier) - { - pointer.touchmove(changedTouch, event); - - this.activePointer = pointer; - - changed.push(pointer); - - break; - } - } - } - - this.updateInputPlugins(CONST.TOUCH_MOVE, changed); + return Math.max(this.width, this.height) / 2; }, - // For touch end its a list of the touch points that have been removed from the surface - // https://developer.mozilla.org/en-US/docs/DOM/TouchList - // event.changedTouches = the touches that CHANGED in this event, not the total number of them - /** - * Processes a touch end event, as passed in by the TouchManager. - * - * @method Phaser.Input.InputManager#onTouchEnd - * @private - * @since 3.18.0 + * The left position of the Ellipse. * - * @param {TouchEvent} event - The native DOM Touch event. + * @name Phaser.Geom.Ellipse#left + * @type {number} + * @since 3.0.0 */ - onTouchEnd: function (event) - { - var pointers = this.pointers; - var changed = []; + left: { - for (var c = 0; c < event.changedTouches.length; c++) + get: function () { - var changedTouch = event.changedTouches[c]; - - for (var i = 1; i < this.pointersTotal; i++) - { - var pointer = pointers[i]; - - if (pointer.active && pointer.identifier === changedTouch.identifier) - { - pointer.touchend(changedTouch, event); - - changed.push(pointer); + return this.x - (this.width / 2); + }, - break; - } - } + set: function (value) + { + this.x = value + (this.width / 2); } - this.updateInputPlugins(CONST.TOUCH_END, changed); }, /** - * Processes a touch cancel event, as passed in by the TouchManager. - * - * @method Phaser.Input.InputManager#onTouchCancel - * @private - * @since 3.18.0 + * The right position of the Ellipse. * - * @param {TouchEvent} event - The native DOM Touch event. + * @name Phaser.Geom.Ellipse#right + * @type {number} + * @since 3.0.0 */ - onTouchCancel: function (event) - { - var pointers = this.pointers; - var changed = []; + right: { - for (var c = 0; c < event.changedTouches.length; c++) + get: function () { - var changedTouch = event.changedTouches[c]; - - for (var i = 1; i < this.pointersTotal; i++) - { - var pointer = pointers[i]; - - if (pointer.active && pointer.identifier === changedTouch.identifier) - { - pointer.touchcancel(changedTouch, event); - - changed.push(pointer); + return this.x + (this.width / 2); + }, - break; - } - } + set: function (value) + { + this.x = value - (this.width / 2); } - this.updateInputPlugins(CONST.TOUCH_CANCEL, changed); }, /** - * Processes a mouse down event, as passed in by the MouseManager. - * - * @method Phaser.Input.InputManager#onMouseDown - * @private - * @since 3.18.0 + * The top position of the Ellipse. * - * @param {MouseEvent} event - The native DOM Mouse event. + * @name Phaser.Geom.Ellipse#top + * @type {number} + * @since 3.0.0 */ - onMouseDown: function (event) - { - var mousePointer = this.mousePointer; - - mousePointer.down(event); + top: { - mousePointer.updateMotion(); + get: function () + { + return this.y - (this.height / 2); + }, - this.activePointer = mousePointer; + set: function (value) + { + this.y = value + (this.height / 2); + } - this.updateInputPlugins(CONST.MOUSE_DOWN, this.mousePointerContainer); }, /** - * Processes a mouse move event, as passed in by the MouseManager. - * - * @method Phaser.Input.InputManager#onMouseMove - * @private - * @since 3.18.0 + * The bottom position of the Ellipse. * - * @param {MouseEvent} event - The native DOM Mouse event. + * @name Phaser.Geom.Ellipse#bottom + * @type {number} + * @since 3.0.0 */ - onMouseMove: function (event) - { - var mousePointer = this.mousePointer; + bottom: { - mousePointer.move(event); + get: function () + { + return this.y + (this.height / 2); + }, - mousePointer.updateMotion(); + set: function (value) + { + this.y = value - (this.height / 2); + } - this.activePointer = mousePointer; + } - this.updateInputPlugins(CONST.MOUSE_MOVE, this.mousePointerContainer); - }, +}); - /** - * Processes a mouse up event, as passed in by the MouseManager. - * - * @method Phaser.Input.InputManager#onMouseUp - * @private - * @since 3.18.0 - * - * @param {MouseEvent} event - The native DOM Mouse event. - */ - onMouseUp: function (event) - { - var mousePointer = this.mousePointer; +module.exports = Ellipse; - mousePointer.up(event); - mousePointer.updateMotion(); +/***/ }), - this.activePointer = mousePointer; +/***/ 98068: +/***/ ((module) => { - this.updateInputPlugins(CONST.MOUSE_UP, this.mousePointerContainer); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Processes a mouse wheel event, as passed in by the MouseManager. - * - * @method Phaser.Input.InputManager#onMouseWheel - * @private - * @since 3.18.0 - * - * @param {WheelEvent} event - The native DOM Wheel event. - */ - onMouseWheel: function (event) - { - var mousePointer = this.mousePointer; - - mousePointer.wheel(event); - - this.activePointer = mousePointer; - - this.updateInputPlugins(CONST.MOUSE_WHEEL, this.mousePointerContainer); - }, - - /** - * Processes a pointer lock change event, as passed in by the MouseManager. - * - * @method Phaser.Input.InputManager#onPointerLockChange - * @fires Phaser.Input.Events#POINTERLOCK_CHANGE - * @private - * @since 3.19.0 - * - * @param {MouseEvent} event - The native DOM Mouse event. - */ - onPointerLockChange: function (event) - { - var isLocked = this.mouse.locked; +/** + * Compares the `x`, `y`, `width` and `height` properties of the two given Ellipses. + * Returns `true` if they all match, otherwise returns `false`. + * + * @function Phaser.Geom.Ellipse.Equals + * @since 3.0.0 + * + * @param {Phaser.Geom.Ellipse} ellipse - The first Ellipse to compare. + * @param {Phaser.Geom.Ellipse} toCompare - The second Ellipse to compare. + * + * @return {boolean} `true` if the two Ellipse equal each other, otherwise `false`. + */ +var Equals = function (ellipse, toCompare) +{ + return ( + ellipse.x === toCompare.x && + ellipse.y === toCompare.y && + ellipse.width === toCompare.width && + ellipse.height === toCompare.height + ); +}; - this.mousePointer.locked = isLocked; +module.exports = Equals; - this.events.emit(Events.POINTERLOCK_CHANGE, event, isLocked); - }, - /** - * Checks if the given Game Object should be considered as a candidate for input or not. - * - * Checks if the Game Object has an input component that is enabled, that it will render, - * and finally, if it has a parent, that the parent parent, or any ancestor, is visible or not. - * - * @method Phaser.Input.InputManager#inputCandidate - * @private - * @since 3.10.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to test. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera which is being tested against. - * - * @return {boolean} `true` if the Game Object should be considered for input, otherwise `false`. - */ - inputCandidate: function (gameObject, camera) - { - var input = gameObject.input; +/***/ }), - if (!input || !input.enabled || (!input.alwaysEnabled && !gameObject.willRender(camera))) - { - return false; - } +/***/ 72897: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var visible = true; - var parent = gameObject.parentContainer; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (parent) - { - do - { - if (!parent.willRender(camera)) - { - visible = false; - break; - } +var Rectangle = __webpack_require__(74118); - parent = parent.parentContainer; +/** + * Returns the bounds of the Ellipse object. + * + * @function Phaser.Geom.Ellipse.GetBounds + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the bounds from. + * @param {(Phaser.Geom.Rectangle|object)} [out] - A Rectangle, or rectangle-like object, to store the ellipse bounds in. If not given a new Rectangle will be created. + * + * @return {(Phaser.Geom.Rectangle|object)} The Rectangle object containing the Ellipse bounds. + */ +var GetBounds = function (ellipse, out) +{ + if (out === undefined) { out = new Rectangle(); } - } while (parent); - } + out.x = ellipse.left; + out.y = ellipse.top; + out.width = ellipse.width; + out.height = ellipse.height; - return visible; - }, + return out; +}; - /** - * Performs a hit test using the given Pointer and camera, against an array of interactive Game Objects. - * - * The Game Objects are culled against the camera, and then the coordinates are translated into the local camera space - * and used to determine if they fall within the remaining Game Objects hit areas or not. - * - * If nothing is matched an empty array is returned. - * - * This method is called automatically by InputPlugin.hitTestPointer and doesn't usually need to be invoked directly. - * - * @method Phaser.Input.InputManager#hitTest - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer to test against. - * @param {array} gameObjects - An array of interactive Game Objects to check. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera which is being tested against. - * @param {array} [output] - An array to store the results in. If not given, a new empty array is created. - * - * @return {array} An array of the Game Objects that were hit during this hit test. - */ - hitTest: function (pointer, gameObjects, camera, output) - { - if (output === undefined) { output = this._tempHitTest; } +module.exports = GetBounds; - var tempPoint = this._tempPoint; - var csx = camera.scrollX; - var csy = camera.scrollY; +/***/ }), - output.length = 0; +/***/ 95340: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var x = pointer.x; - var y = pointer.y; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Stores the world point inside of tempPoint - camera.getWorldPoint(x, y, tempPoint); +var CircumferencePoint = __webpack_require__(86998); +var FromPercent = __webpack_require__(91806); +var MATH_CONST = __webpack_require__(83392); +var Point = __webpack_require__(79967); - pointer.worldX = tempPoint.x; - pointer.worldY = tempPoint.y; +/** + * Returns a Point object containing the coordinates of a point on the circumference of the Ellipse + * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point + * at 180 degrees around the circle. + * + * @function Phaser.Geom.Ellipse.GetPoint + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the circumference point on. + * @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse. + * @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created. + * + * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the ellipse. + */ +var GetPoint = function (ellipse, position, out) +{ + if (out === undefined) { out = new Point(); } - var point = { x: 0, y: 0 }; + var angle = FromPercent(position, 0, MATH_CONST.PI2); - var matrix = this._tempMatrix; - var parentMatrix = this._tempMatrix2; + return CircumferencePoint(ellipse, angle, out); +}; - for (var i = 0; i < gameObjects.length; i++) - { - var gameObject = gameObjects[i]; +module.exports = GetPoint; - // Checks if the Game Object can receive input (isn't being ignored by the camera, invisible, etc) - // and also checks all of its parents, if any - if (!this.inputCandidate(gameObject, camera)) - { - continue; - } - var px = tempPoint.x + (csx * gameObject.scrollFactorX) - csx; - var py = tempPoint.y + (csy * gameObject.scrollFactorY) - csy; +/***/ }), - if (gameObject.parentContainer) - { - gameObject.getWorldTransformMatrix(matrix, parentMatrix); +/***/ 54978: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - matrix.applyInverse(px, py, point); - } - else - { - TransformXY(px, py, gameObject.x, gameObject.y, gameObject.rotation, gameObject.scaleX, gameObject.scaleY, point); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (this.pointWithinHitArea(gameObject, point.x, point.y)) - { - output.push(gameObject); - } - } +var Circumference = __webpack_require__(39507); +var CircumferencePoint = __webpack_require__(86998); +var FromPercent = __webpack_require__(91806); +var MATH_CONST = __webpack_require__(83392); - return output; - }, +/** + * Returns an array of Point objects containing the coordinates of the points around the circumference of the Ellipse, + * based on the given quantity or stepRate values. + * + * @function Phaser.Geom.Ellipse.GetPoints + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point[]} O - [out,$return] + * + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the points from. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} [stepRate] - Sets the quantity by getting the circumference of the ellipse and dividing it by the stepRate. + * @param {(array|Phaser.Geom.Point[])} [out] - An array to insert the points in to. If not provided a new array will be created. + * + * @return {(array|Phaser.Geom.Point[])} An array of Point objects pertaining to the points around the circumference of the ellipse. + */ +var GetPoints = function (ellipse, quantity, stepRate, out) +{ + if (out === undefined) { out = []; } - /** - * Checks if the given x and y coordinate are within the hit area of the Game Object. - * - * This method assumes that the coordinate values have already been translated into the space of the Game Object. - * - * If the coordinates are within the hit area they are set into the Game Objects Input `localX` and `localY` properties. - * - * @method Phaser.Input.InputManager#pointWithinHitArea - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object to check against. - * @param {number} x - The translated x coordinate for the hit test. - * @param {number} y - The translated y coordinate for the hit test. - * - * @return {boolean} `true` if the coordinates were inside the Game Objects hit area, otherwise `false`. - */ - pointWithinHitArea: function (gameObject, x, y) + // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!quantity && stepRate > 0) { - // Normalize the origin - x += gameObject.displayOriginX; - y += gameObject.displayOriginY; - - var input = gameObject.input; - - if (input && input.hitAreaCallback(input.hitArea, x, y, gameObject)) - { - input.localX = x; - input.localY = y; - - return true; - } - else - { - return false; - } - }, + quantity = Circumference(ellipse) / stepRate; + } - /** - * Checks if the given x and y coordinate are within the hit area of the Interactive Object. - * - * This method assumes that the coordinate values have already been translated into the space of the Interactive Object. - * - * If the coordinates are within the hit area they are set into the Interactive Objects Input `localX` and `localY` properties. - * - * @method Phaser.Input.InputManager#pointWithinInteractiveObject - * @since 3.0.0 - * - * @param {Phaser.Types.Input.InteractiveObject} object - The Interactive Object to check against. - * @param {number} x - The translated x coordinate for the hit test. - * @param {number} y - The translated y coordinate for the hit test. - * - * @return {boolean} `true` if the coordinates were inside the Game Objects hit area, otherwise `false`. - */ - pointWithinInteractiveObject: function (object, x, y) + for (var i = 0; i < quantity; i++) { - if (!object.hitArea) - { - return false; - } + var angle = FromPercent(i / quantity, 0, MATH_CONST.PI2); - // Normalize the origin - x += object.gameObject.displayOriginX; - y += object.gameObject.displayOriginY; + out.push(CircumferencePoint(ellipse, angle)); + } - object.localX = x; - object.localY = y; + return out; +}; - return object.hitAreaCallback(object.hitArea, x, y, object); - }, +module.exports = GetPoints; - /** - * Transforms the pageX and pageY values of a Pointer into the scaled coordinate space of the Input Manager. - * - * @method Phaser.Input.InputManager#transformPointer - * @since 3.10.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer to transform the values for. - * @param {number} pageX - The Page X value. - * @param {number} pageY - The Page Y value. - * @param {boolean} wasMove - Are we transforming the Pointer from a move event, or an up / down event? - */ - transformPointer: function (pointer, pageX, pageY, wasMove) - { - var p0 = pointer.position; - var p1 = pointer.prevPosition; - // Store previous position - p1.x = p0.x; - p1.y = p0.y; +/***/ }), - // Translate coordinates - var x = this.scaleManager.transformX(pageX); - var y = this.scaleManager.transformY(pageY); +/***/ 77951: +/***/ ((module) => { - var a = pointer.smoothFactor; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (!wasMove || a === 0) - { - // Set immediately - p0.x = x; - p0.y = y; - } - else - { - // Apply smoothing - p0.x = x * a + p1.x * (1 - a); - p0.y = y * a + p1.y * (1 - a); - } - }, +/** + * Offsets the Ellipse by the values given. + * + * @function Phaser.Geom.Ellipse.Offset + * @since 3.0.0 + * + * @generic {Phaser.Geom.Ellipse} O - [ellipse,$return] + * + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to be offset (translated.) + * @param {number} x - The amount to horizontally offset the Ellipse by. + * @param {number} y - The amount to vertically offset the Ellipse by. + * + * @return {Phaser.Geom.Ellipse} The Ellipse that was offset. + */ +var Offset = function (ellipse, x, y) +{ + ellipse.x += x; + ellipse.y += y; - /** - * Destroys the Input Manager and all of its systems. - * - * There is no way to recover from doing this. - * - * @method Phaser.Input.InputManager#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.events.removeAllListeners(); + return ellipse; +}; - this.game.events.off(GameEvents.PRE_RENDER); +module.exports = Offset; - if (this.keyboard) - { - this.keyboard.destroy(); - } - if (this.mouse) - { - this.mouse.destroy(); - } +/***/ }), - if (this.touch) - { - this.touch.destroy(); - } +/***/ 36233: +/***/ ((module) => { - for (var i = 0; i < this.pointers.length; i++) - { - this.pointers[i].destroy(); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.pointers = []; - this._tempHitTest = []; - this._tempMatrix.destroy(); - this.canvas = null; - this.game = null; - } +/** + * Offsets the Ellipse by the values given in the `x` and `y` properties of the Point object. + * + * @function Phaser.Geom.Ellipse.OffsetPoint + * @since 3.0.0 + * + * @generic {Phaser.Geom.Ellipse} O - [ellipse,$return] + * + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to be offset (translated.) + * @param {(Phaser.Geom.Point|object)} point - The Point object containing the values to offset the Ellipse by. + * + * @return {Phaser.Geom.Ellipse} The Ellipse that was offset. + */ +var OffsetPoint = function (ellipse, point) +{ + ellipse.x += point.x; + ellipse.y += point.y; -}); + return ellipse; +}; -module.exports = InputManager; +module.exports = OffsetPoint; /***/ }), -/* 410 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 72006: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayRemove = __webpack_require__(93); -var Class = __webpack_require__(0); -var GameEvents = __webpack_require__(22); -var InputEvents = __webpack_require__(51); -var KeyCodes = __webpack_require__(143); -var NOOP = __webpack_require__(1); +var Point = __webpack_require__(79967); /** - * @classdesc - * The Keyboard Manager is a helper class that belongs to the global Input Manager. + * Returns a uniformly distributed random point from anywhere within the given Ellipse. * - * Its role is to listen for native DOM Keyboard Events and then store them for further processing by the Keyboard Plugin. + * @function Phaser.Geom.Ellipse.Random + * @since 3.0.0 * - * You do not need to create this class directly, the Input Manager will create an instance of it automatically if keyboard - * input has been enabled in the Game Config. + * @generic {Phaser.Geom.Point} O - [out,$return] * - * @class KeyboardManager - * @memberof Phaser.Input.Keyboard - * @constructor - * @since 3.16.0 + * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get a random point from. + * @param {(Phaser.Geom.Point|object)} [out] - A Point or point-like object to set the random `x` and `y` values in. * - * @param {Phaser.Input.InputManager} inputManager - A reference to the Input Manager. + * @return {(Phaser.Geom.Point|object)} A Point object with the random values set in the `x` and `y` properties. */ -var KeyboardManager = new Class({ +var Random = function (ellipse, out) +{ + if (out === undefined) { out = new Point(); } - initialize: + var p = Math.random() * Math.PI * 2; + var s = Math.sqrt(Math.random()); - function KeyboardManager (inputManager) - { - /** - * A reference to the Input Manager. - * - * @name Phaser.Input.Keyboard.KeyboardManager#manager - * @type {Phaser.Input.InputManager} - * @since 3.16.0 - */ - this.manager = inputManager; + out.x = ellipse.x + ((s * Math.cos(p)) * ellipse.width / 2); + out.y = ellipse.y + ((s * Math.sin(p)) * ellipse.height / 2); - /** - * An internal event queue. - * - * @name Phaser.Input.Keyboard.KeyboardManager#queue - * @type {KeyboardEvent[]} - * @private - * @since 3.16.0 - */ - this.queue = []; + return out; +}; - /** - * A flag that controls if the non-modified keys, matching those stored in the `captures` array, - * have `preventDefault` called on them or not. - * - * A non-modified key is one that doesn't have a modifier key held down with it. The modifier keys are - * shift, control, alt and the meta key (Command on a Mac, the Windows Key on Windows). - * Therefore, if the user presses shift + r, it won't prevent this combination, because of the modifier. - * However, if the user presses just the r key on its own, it will have its event prevented. - * - * If you wish to stop capturing the keys, for example switching out to a DOM based element, then - * you can toggle this property at run-time. - * - * @name Phaser.Input.Keyboard.KeyboardManager#preventDefault - * @type {boolean} - * @since 3.16.0 - */ - this.preventDefault = true; +module.exports = Random; - /** - * An array of Key Code values that will automatically have `preventDefault` called on them, - * as long as the `KeyboardManager.preventDefault` boolean is set to `true`. - * - * By default the array is empty. - * - * The key must be non-modified when pressed in order to be captured. - * - * A non-modified key is one that doesn't have a modifier key held down with it. The modifier keys are - * shift, control, alt and the meta key (Command on a Mac, the Windows Key on Windows). - * Therefore, if the user presses shift + r, it won't prevent this combination, because of the modifier. - * However, if the user presses just the r key on its own, it will have its event prevented. - * - * If you wish to stop capturing the keys, for example switching out to a DOM based element, then - * you can toggle the `KeyboardManager.preventDefault` boolean at run-time. - * - * If you need more specific control, you can create Key objects and set the flag on each of those instead. - * - * This array can be populated via the Game Config by setting the `input.keyboard.capture` array, or you - * can call the `addCapture` method. See also `removeCapture` and `clearCaptures`. - * - * @name Phaser.Input.Keyboard.KeyboardManager#captures - * @type {number[]} - * @since 3.16.0 - */ - this.captures = []; - /** - * A boolean that controls if the Keyboard Manager is enabled or not. - * Can be toggled on the fly. - * - * @name Phaser.Input.Keyboard.KeyboardManager#enabled - * @type {boolean} - * @default false - * @since 3.16.0 - */ - this.enabled = false; +/***/ }), - /** - * The Keyboard Event target, as defined in the Game Config. - * Typically the window in which the game is rendering, but can be any interactive DOM element. - * - * @name Phaser.Input.Keyboard.KeyboardManager#target - * @type {any} - * @since 3.16.0 - */ - this.target; +/***/ 40652: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The Key Down Event handler. - * This function is sent the native DOM KeyEvent. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Keyboard.KeyboardManager#onKeyDown - * @type {function} - * @since 3.16.00 - */ - this.onKeyDown = NOOP; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The Key Up Event handler. - * This function is sent the native DOM KeyEvent. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Keyboard.KeyboardManager#onKeyUp - * @type {function} - * @since 3.16.00 - */ - this.onKeyUp = NOOP; +var Ellipse = __webpack_require__(95669); - inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); - }, +Ellipse.Area = __webpack_require__(58605); +Ellipse.Circumference = __webpack_require__(39507); +Ellipse.CircumferencePoint = __webpack_require__(86998); +Ellipse.Clone = __webpack_require__(81773); +Ellipse.Contains = __webpack_require__(72313); +Ellipse.ContainsPoint = __webpack_require__(34368); +Ellipse.ContainsRect = __webpack_require__(71431); +Ellipse.CopyFrom = __webpack_require__(75459); +Ellipse.Equals = __webpack_require__(98068); +Ellipse.GetBounds = __webpack_require__(72897); +Ellipse.GetPoint = __webpack_require__(95340); +Ellipse.GetPoints = __webpack_require__(54978); +Ellipse.Offset = __webpack_require__(77951); +Ellipse.OffsetPoint = __webpack_require__(36233); +Ellipse.Random = __webpack_require__(72006); - /** - * The Keyboard Manager boot process. - * - * @method Phaser.Input.Keyboard.KeyboardManager#boot - * @private - * @since 3.16.0 - */ - boot: function () - { - var config = this.manager.config; +module.exports = Ellipse; - this.enabled = config.inputKeyboard; - this.target = config.inputKeyboardEventTarget; - this.addCapture(config.inputKeyboardCapture); +/***/ }), - if (!this.target && window) - { - this.target = window; - } +/***/ 84068: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (this.enabled && this.target) - { - this.startListeners(); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.manager.game.events.on(GameEvents.POST_STEP, this.postUpdate, this); - }, +var CONST = __webpack_require__(52394); +var Extend = __webpack_require__(98611); - /** - * Starts the Keyboard Event listeners running. - * This is called automatically and does not need to be manually invoked. - * - * @method Phaser.Input.Keyboard.KeyboardManager#startListeners - * @since 3.16.0 - */ - startListeners: function () - { - var _this = this; +/** + * @namespace Phaser.Geom + */ - this.onKeyDown = function (event) - { - if (event.defaultPrevented || !_this.enabled || !_this.manager) - { - // Do nothing if event already handled - return; - } +var Geom = { - _this.queue.push(event); + Circle: __webpack_require__(6112), + Ellipse: __webpack_require__(40652), + Intersects: __webpack_require__(7563), + Line: __webpack_require__(28482), + Mesh: __webpack_require__(14293), + Point: __webpack_require__(63472), + Polygon: __webpack_require__(44359), + Rectangle: __webpack_require__(66658), + Triangle: __webpack_require__(87619) - _this.manager.events.emit(InputEvents.MANAGER_PROCESS); +}; - var modified = (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey); +// Merge in the consts +Geom = Extend(false, Geom, CONST); - if (_this.preventDefault && !modified && _this.captures.indexOf(event.keyCode) > -1) - { - event.preventDefault(); - } - }; +module.exports = Geom; - this.onKeyUp = function (event) - { - if (event.defaultPrevented || !_this.enabled || !_this.manager) - { - // Do nothing if event already handled - return; - } - _this.queue.push(event); +/***/ }), - _this.manager.events.emit(InputEvents.MANAGER_PROCESS); +/***/ 22184: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var modified = (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (_this.preventDefault && !modified && _this.captures.indexOf(event.keyCode) > -1) - { - event.preventDefault(); - } - }; +var DistanceBetween = __webpack_require__(53996); - var target = this.target; +/** + * Checks if two Circles intersect. + * + * @function Phaser.Geom.Intersects.CircleToCircle + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circleA - The first Circle to check for intersection. + * @param {Phaser.Geom.Circle} circleB - The second Circle to check for intersection. + * + * @return {boolean} `true` if the two Circles intersect, otherwise `false`. + */ +var CircleToCircle = function (circleA, circleB) +{ + return (DistanceBetween(circleA.x, circleA.y, circleB.x, circleB.y) <= (circleA.radius + circleB.radius)); +}; - if (target) - { - target.addEventListener('keydown', this.onKeyDown, false); - target.addEventListener('keyup', this.onKeyUp, false); +module.exports = CircleToCircle; - this.enabled = true; - } - }, - /** - * Stops the Key Event listeners. - * This is called automatically and does not need to be manually invoked. - * - * @method Phaser.Input.Keyboard.KeyboardManager#stopListeners - * @since 3.16.0 - */ - stopListeners: function () - { - var target = this.target; +/***/ }), - target.removeEventListener('keydown', this.onKeyDown, false); - target.removeEventListener('keyup', this.onKeyUp, false); +/***/ 26535: +/***/ ((module) => { - this.enabled = false; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Clears the event queue. - * Called automatically by the Input Manager. - * - * @method Phaser.Input.Keyboard.KeyboardManager#postUpdate - * @private - * @since 3.16.0 - */ - postUpdate: function () +/** + * Checks for intersection between a circle and a rectangle. + * + * @function Phaser.Geom.Intersects.CircleToRectangle + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The circle to be checked. + * @param {Phaser.Geom.Rectangle} rect - The rectangle to be checked. + * + * @return {boolean} `true` if the two objects intersect, otherwise `false`. + */ +var CircleToRectangle = function (circle, rect) +{ + var halfWidth = rect.width / 2; + var halfHeight = rect.height / 2; + + var cx = Math.abs(circle.x - rect.x - halfWidth); + var cy = Math.abs(circle.y - rect.y - halfHeight); + var xDist = halfWidth + circle.radius; + var yDist = halfHeight + circle.radius; + + if (cx > xDist || cy > yDist) { - this.queue = []; - }, + return false; + } + else if (cx <= halfWidth || cy <= halfHeight) + { + return true; + } + else + { + var xCornerDist = cx - halfWidth; + var yCornerDist = cy - halfHeight; + var xCornerDistSq = xCornerDist * xCornerDist; + var yCornerDistSq = yCornerDist * yCornerDist; + var maxCornerDistSq = circle.radius * circle.radius; - /** - * By default when a key is pressed Phaser will not stop the event from propagating up to the browser. - * There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll. - * - * This `addCapture` method enables consuming keyboard event for specific keys so it doesn't bubble up to the the browser - * and cause the default browser behavior. - * - * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to say prevent - * the SPACE BAR from triggering a page scroll, then it will prevent it for any Scene in your game, not just the calling one. - * - * You can pass in a single key code value, or an array of key codes, or a string: - * - * ```javascript - * this.input.keyboard.addCapture(62); - * ``` - * - * An array of key codes: - * - * ```javascript - * this.input.keyboard.addCapture([ 62, 63, 64 ]); - * ``` - * - * Or a string: - * - * ```javascript - * this.input.keyboard.addCapture('W,S,A,D'); - * ``` - * - * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. - * - * You can also provide an array mixing both strings and key code integers. - * - * If there are active captures after calling this method, the `preventDefault` property is set to `true`. - * - * @method Phaser.Input.Keyboard.KeyboardManager#addCapture - * @since 3.16.0 - * - * @param {(string|number|number[]|any[])} keycode - The Key Codes to enable capture for, preventing them reaching the browser. - */ - addCapture: function (keycode) + return (xCornerDistSq + yCornerDistSq <= maxCornerDistSq); + } +}; + +module.exports = CircleToRectangle; + + +/***/ }), + +/***/ 71145: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Florian Vazelle + * @author Geoffrey Glaive + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Point = __webpack_require__(79967); +var CircleToCircle = __webpack_require__(22184); + +/** + * Checks if two Circles intersect and returns the intersection points as a Point object array. + * + * @function Phaser.Geom.Intersects.GetCircleToCircle + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circleA - The first Circle to check for intersection. + * @param {Phaser.Geom.Circle} circleB - The second Circle to check for intersection. + * @param {array} [out] - An optional array in which to store the points of intersection. + * + * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. + */ +var GetCircleToCircle = function (circleA, circleB, out) +{ + if (out === undefined) { out = []; } + + if (CircleToCircle(circleA, circleB)) { - if (typeof keycode === 'string') - { - keycode = keycode.split(','); - } + var x0 = circleA.x; + var y0 = circleA.y; + var r0 = circleA.radius; - if (!Array.isArray(keycode)) - { - keycode = [ keycode ]; - } + var x1 = circleB.x; + var y1 = circleB.y; + var r1 = circleB.radius; - var captures = this.captures; + var coefficientA, coefficientB, coefficientC, lambda, x; - for (var i = 0; i < keycode.length; i++) + if (y0 === y1) { - var code = keycode[i]; + x = ((r1 * r1) - (r0 * r0) - (x1 * x1) + (x0 * x0)) / (2 * (x0 - x1)); - if (typeof code === 'string') + coefficientA = 1; + coefficientB = -2 * y1; + coefficientC = (x1 * x1) + (x * x) - (2 * x1 * x) + (y1 * y1) - (r1 * r1); + + lambda = (coefficientB * coefficientB) - (4 * coefficientA * coefficientC); + + if (lambda === 0) { - code = KeyCodes[code.trim().toUpperCase()]; + out.push(new Point(x, (-coefficientB / (2 * coefficientA)))); } - - if (captures.indexOf(code) === -1) + else if (lambda > 0) { - captures.push(code); + out.push(new Point(x, (-coefficientB + Math.sqrt(lambda)) / (2 * coefficientA))); + out.push(new Point(x, (-coefficientB - Math.sqrt(lambda)) / (2 * coefficientA))); } } - - this.preventDefault = captures.length > 0; - }, - - /** - * Removes an existing key capture. - * - * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to remove - * the capture of a key, then it will remove it for any Scene in your game, not just the calling one. - * - * You can pass in a single key code value, or an array of key codes, or a string: - * - * ```javascript - * this.input.keyboard.removeCapture(62); - * ``` - * - * An array of key codes: - * - * ```javascript - * this.input.keyboard.removeCapture([ 62, 63, 64 ]); - * ``` - * - * Or a string: - * - * ```javascript - * this.input.keyboard.removeCapture('W,S,A,D'); - * ``` - * - * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. - * - * You can also provide an array mixing both strings and key code integers. - * - * If there are no captures left after calling this method, the `preventDefault` property is set to `false`. - * - * @method Phaser.Input.Keyboard.KeyboardManager#removeCapture - * @since 3.16.0 - * - * @param {(string|number|number[]|any[])} keycode - The Key Codes to disable capture for, allowing them reaching the browser again. - */ - removeCapture: function (keycode) - { - if (typeof keycode === 'string') - { - keycode = keycode.split(','); - } - - if (!Array.isArray(keycode)) + else { - keycode = [ keycode ]; - } + var v1 = (x0 - x1) / (y0 - y1); + var n = (r1 * r1 - r0 * r0 - x1 * x1 + x0 * x0 - y1 * y1 + y0 * y0) / (2 * (y0 - y1)); - var captures = this.captures; + coefficientA = (v1 * v1) + 1; + coefficientB = (2 * y0 * v1) - (2 * n * v1) - (2 * x0); + coefficientC = (x0 * x0) + (y0 * y0) + (n * n) - (r0 * r0) - (2 * y0 * n); - for (var i = 0; i < keycode.length; i++) - { - var code = keycode[i]; + lambda = (coefficientB * coefficientB) - (4 * coefficientA * coefficientC); - if (typeof code === 'string') + if (lambda === 0) { - code = KeyCodes[code.toUpperCase()]; + x = (-coefficientB / (2 * coefficientA)); + out.push(new Point(x, (n - (x * v1)))); + } + else if (lambda > 0) + { + x = (-coefficientB + Math.sqrt(lambda)) / (2 * coefficientA); + out.push(new Point(x, (n - (x * v1)))); + x = (-coefficientB - Math.sqrt(lambda)) / (2 * coefficientA); + out.push(new Point(x, (n - (x * v1)))); } - - ArrayRemove(captures, code); } + } - this.preventDefault = captures.length > 0; - }, + return out; +}; - /** - * Removes all keyboard captures and sets the `preventDefault` property to `false`. - * - * @method Phaser.Input.Keyboard.KeyboardManager#clearCaptures - * @since 3.16.0 - */ - clearCaptures: function () - { - this.captures = []; +module.exports = GetCircleToCircle; - this.preventDefault = false; - }, - /** - * Destroys this Keyboard Manager instance. - * - * @method Phaser.Input.Keyboard.KeyboardManager#destroy - * @since 3.16.0 - */ - destroy: function () - { - this.stopListeners(); +/***/ }), - this.clearCaptures(); +/***/ 62508: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.queue = []; +/** + * @author Florian Vazelle + * @author Geoffrey Glaive + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.manager.game.events.off(GameEvents.POST_RENDER, this.postUpdate, this); +var GetLineToCircle = __webpack_require__(26111); +var CircleToRectangle = __webpack_require__(26535); - this.target = null; - this.enabled = false; - this.manager = null; +/** + * Checks for intersection between a circle and a rectangle, + * and returns the intersection points as a Point object array. + * + * @function Phaser.Geom.Intersects.GetCircleToRectangle + * @since 3.0.0 + * + * @param {Phaser.Geom.Circle} circle - The circle to be checked. + * @param {Phaser.Geom.Rectangle} rect - The rectangle to be checked. + * @param {array} [out] - An optional array in which to store the points of intersection. + * + * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. + */ +var GetCircleToRectangle = function (circle, rect, out) +{ + if (out === undefined) { out = []; } + + if (CircleToRectangle(circle, rect)) + { + var lineA = rect.getLineA(); + var lineB = rect.getLineB(); + var lineC = rect.getLineC(); + var lineD = rect.getLineD(); + + GetLineToCircle(lineA, circle, out); + GetLineToCircle(lineB, circle, out); + GetLineToCircle(lineC, circle, out); + GetLineToCircle(lineD, circle, out); } -}); + return out; +}; -module.exports = KeyboardManager; +module.exports = GetCircleToRectangle; /***/ }), -/* 411 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 26111: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Florian Vazelle + * @author Geoffrey Glaive + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Features = __webpack_require__(191); -var InputEvents = __webpack_require__(51); -var NOOP = __webpack_require__(1); - -// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent -// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md +var Point = __webpack_require__(79967); +var LineToCircle = __webpack_require__(61472); /** - * @classdesc - * The Mouse Manager is a helper class that belongs to the Input Manager. - * - * Its role is to listen for native DOM Mouse Events and then pass them onto the Input Manager for further processing. - * - * You do not need to create this class directly, the Input Manager will create an instance of it automatically. + * Checks for intersection between the line segment and circle, + * and returns the intersection points as a Point object array. * - * @class MouseManager - * @memberof Phaser.Input.Mouse - * @constructor + * @function Phaser.Geom.Intersects.GetLineToCircle * @since 3.0.0 * - * @param {Phaser.Input.InputManager} inputManager - A reference to the Input Manager. + * @param {Phaser.Geom.Line} line - The line segment to check. + * @param {Phaser.Geom.Circle} circle - The circle to check against the line. + * @param {array} [out] - An optional array in which to store the points of intersection. + * + * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. */ -var MouseManager = new Class({ - - initialize: +var GetLineToCircle = function (line, circle, out) +{ + if (out === undefined) { out = []; } - function MouseManager (inputManager) + if (LineToCircle(line, circle)) { - /** - * A reference to the Input Manager. - * - * @name Phaser.Input.Mouse.MouseManager#manager - * @type {Phaser.Input.InputManager} - * @since 3.0.0 - */ - this.manager = inputManager; + var lx1 = line.x1; + var ly1 = line.y1; - /** - * If `true` the DOM `mousedown` event will have `preventDefault` set. - * - * @name Phaser.Input.Mouse.MouseManager#preventDefaultDown - * @type {boolean} - * @default true - * @since 3.50.0 - */ - this.preventDefaultDown = true; + var lx2 = line.x2; + var ly2 = line.y2; - /** - * If `true` the DOM `mouseup` event will have `preventDefault` set. - * - * @name Phaser.Input.Mouse.MouseManager#preventDefaultUp - * @type {boolean} - * @default true - * @since 3.50.0 - */ - this.preventDefaultUp = true; + var cx = circle.x; + var cy = circle.y; + var cr = circle.radius; - /** - * If `true` the DOM `mousemove` event will have `preventDefault` set. - * - * @name Phaser.Input.Mouse.MouseManager#preventDefaultMove - * @type {boolean} - * @default true - * @since 3.50.0 - */ - this.preventDefaultMove = true; + var lDirX = lx2 - lx1; + var lDirY = ly2 - ly1; + var oDirX = lx1 - cx; + var oDirY = ly1 - cy; - /** - * If `true` the DOM `wheel` event will have `preventDefault` set. - * - * @name Phaser.Input.Mouse.MouseManager#preventDefaultWheel - * @type {boolean} - * @default true - * @since 3.50.0 - */ - this.preventDefaultWheel = false; + var coefficientA = lDirX * lDirX + lDirY * lDirY; + var coefficientB = 2 * (lDirX * oDirX + lDirY * oDirY); + var coefficientC = oDirX * oDirX + oDirY * oDirY - cr * cr; - /** - * A boolean that controls if the Mouse Manager is enabled or not. - * Can be toggled on the fly. - * - * @name Phaser.Input.Mouse.MouseManager#enabled - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.enabled = false; + var lambda = (coefficientB * coefficientB) - (4 * coefficientA * coefficientC); - /** - * The Mouse target, as defined in the Game Config. - * Typically the canvas to which the game is rendering, but can be any interactive DOM element. - * - * @name Phaser.Input.Mouse.MouseManager#target - * @type {any} - * @since 3.0.0 - */ - this.target; + var x, y; - /** - * If the mouse has been pointer locked successfully this will be set to true. - * - * @name Phaser.Input.Mouse.MouseManager#locked - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.locked = false; + if (lambda === 0) + { + var root = -coefficientB / (2 * coefficientA); + x = lx1 + root * lDirX; + y = ly1 + root * lDirY; + if (root >= 0 && root <= 1) + { + out.push(new Point(x, y)); + } + } + else if (lambda > 0) + { + var root1 = (-coefficientB - Math.sqrt(lambda)) / (2 * coefficientA); + x = lx1 + root1 * lDirX; + y = ly1 + root1 * lDirY; + if (root1 >= 0 && root1 <= 1) + { + out.push(new Point(x, y)); + } - /** - * The Mouse Move Event handler. - * This function is sent the native DOM MouseEvent. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Mouse.MouseManager#onMouseMove - * @type {function} - * @since 3.10.0 - */ - this.onMouseMove = NOOP; + var root2 = (-coefficientB + Math.sqrt(lambda)) / (2 * coefficientA); + x = lx1 + root2 * lDirX; + y = ly1 + root2 * lDirY; + if (root2 >= 0 && root2 <= 1) + { + out.push(new Point(x, y)); + } + } + } - /** - * The Mouse Down Event handler. - * This function is sent the native DOM MouseEvent. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Mouse.MouseManager#onMouseDown - * @type {function} - * @since 3.10.0 - */ - this.onMouseDown = NOOP; + return out; +}; - /** - * The Mouse Up Event handler. - * This function is sent the native DOM MouseEvent. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Mouse.MouseManager#onMouseUp - * @type {function} - * @since 3.10.0 - */ - this.onMouseUp = NOOP; +module.exports = GetLineToCircle; - /** - * The Mouse Down Event handler specifically for events on the Window. - * This function is sent the native DOM MouseEvent. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Mouse.MouseManager#onMouseDownWindow - * @type {function} - * @since 3.17.0 - */ - this.onMouseDownWindow = NOOP; - /** - * The Mouse Up Event handler specifically for events on the Window. - * This function is sent the native DOM MouseEvent. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Mouse.MouseManager#onMouseUpWindow - * @type {function} - * @since 3.17.0 - */ - this.onMouseUpWindow = NOOP; +/***/ }), - /** - * The Mouse Over Event handler. - * This function is sent the native DOM MouseEvent. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Mouse.MouseManager#onMouseOver - * @type {function} - * @since 3.16.0 - */ - this.onMouseOver = NOOP; +/***/ 96537: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The Mouse Out Event handler. - * This function is sent the native DOM MouseEvent. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Mouse.MouseManager#onMouseOut - * @type {function} - * @since 3.16.0 - */ - this.onMouseOut = NOOP; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The Mouse Wheel Event handler. - * This function is sent the native DOM MouseEvent. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Mouse.MouseManager#onMouseWheel - * @type {function} - * @since 3.18.0 - */ - this.onMouseWheel = NOOP; +var Vector3 = __webpack_require__(70015); - /** - * Internal pointerLockChange handler. - * This function is sent the native DOM MouseEvent. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Mouse.MouseManager#pointerLockChange - * @type {function} - * @since 3.0.0 - */ - this.pointerLockChange = NOOP; +/** + * Checks for intersection between the two line segments, or a ray and a line segment, + * and returns the intersection point as a Vector3, or `null` if the lines are parallel, or do not intersect. + * + * The `z` property of the Vector3 contains the intersection distance, which can be used to find + * the closest intersecting point from a group of line segments. + * + * @function Phaser.Geom.Intersects.GetLineToLine + * @since 3.50.0 + * + * @param {Phaser.Geom.Line} line1 - The first line segment, or a ray, to check. + * @param {Phaser.Geom.Line} line2 - The second line segment to check. + * @param {boolean} [isRay=false] - Is `line1` a ray or a line segment? + * @param {Phaser.Math.Vector3} [out] - A Vector3 to store the intersection results in. + * + * @return {Phaser.Math.Vector3} A Vector3 containing the intersection results, or `null`. + */ +var GetLineToLine = function (line1, line2, isRay, out) +{ + if (isRay === undefined) { isRay = false; } - /** - * Are the event listeners hooked into `window.top` or `window`? - * - * This is set during the `boot` sequence. If the browser does not have access to `window.top`, - * such as in cross-origin iframe environments, this property gets set to `false` and the events - * are hooked into `window` instead. - * - * @name Phaser.Input.Mouse.MouseManager#isTop - * @type {boolean} - * @readonly - * @since 3.50.0 - */ - this.isTop = true; + var x1 = line1.x1; + var y1 = line1.y1; + var x2 = line1.x2; + var y2 = line1.y2; - inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); - }, + var x3 = line2.x1; + var y3 = line2.y1; + var x4 = line2.x2; + var y4 = line2.y2; - /** - * The Touch Manager boot process. - * - * @method Phaser.Input.Mouse.MouseManager#boot - * @private - * @since 3.0.0 - */ - boot: function () + var dx1 = x2 - x1; + var dy1 = y2 - y1; + + var dx2 = x4 - x3; + var dy2 = y4 - y3; + + var denom = (dx1 * dy2 - dy1 * dx2); + + // Add co-linear check + + // Make sure there is not a division by zero - this also indicates that the lines are parallel. + // If numA and numB were both equal to zero the lines would be on top of each other (coincidental). + // This check is not done because it is not necessary for this implementation (the parallel check accounts for this). + + if (denom === 0) { - var config = this.manager.config; + return null; + } - this.enabled = config.inputMouse; - this.target = config.inputMouseEventTarget; - this.passive = config.inputMousePassive; + var t; + var u; + var s; - this.preventDefaultDown = config.inputMousePreventDefaultDown; - this.preventDefaultUp = config.inputMousePreventDefaultUp; - this.preventDefaultMove = config.inputMousePreventDefaultMove; - this.preventDefaultWheel = config.inputMousePreventDefaultWheel; + if (isRay) + { + t = (dx1 * (y3 - y1) + dy1 * (x1 - x3)) / (dx2 * dy1 - dy2 * dx1); + u = (x3 + dx2 * t - x1) / dx1; - if (!this.target) - { - this.target = this.manager.game.canvas; - } - else if (typeof this.target === 'string') + // Intersects? + if (u < 0 || t < 0 || t > 1) { - this.target = document.getElementById(this.target); + return null; } - if (config.disableContextMenu) - { - this.disableContextMenu(); - } + s = u; + } + else + { + t = ((x3 - x1) * dy2 - (y3 - y1) * dx2) / denom; + u = ((y1 - y3) * dx1 - (x1 - x3) * dy1) / denom; - if (this.enabled && this.target) + // Intersects? + if (t < 0 || t > 1 || u < 0 || u > 1) { - this.startListeners(); + return null; } - }, - /** - * Attempts to disable the context menu from appearing if you right-click on the browser. - * - * Works by listening for the `contextmenu` event and prevent defaulting it. - * - * Use this if you need to enable right-button mouse support in your game, and the browser - * menu keeps getting in the way. - * - * @method Phaser.Input.Mouse.MouseManager#disableContextMenu - * @since 3.0.0 - * - * @return {this} This Mouse Manager instance. - */ - disableContextMenu: function () + s = t; + } + + if (out === undefined) { - document.body.addEventListener('contextmenu', function (event) - { - event.preventDefault(); - return false; - }); + out = new Vector3(); + } - return this; - }, + return out.set( + x1 + dx1 * s, + y1 + dy1 * s, + s + ); +}; - /** - * If the browser supports it, you can request that the pointer be locked to the browser window. - * - * This is classically known as 'FPS controls', where the pointer can't leave the browser until - * the user presses an exit key. - * - * If the browser successfully enters a locked state, a `POINTER_LOCK_CHANGE_EVENT` will be dispatched, - * from the games Input Manager, with an `isPointerLocked` property. - * - * It is important to note that pointer lock can only be enabled after an 'engagement gesture', - * see: https://w3c.github.io/pointerlock/#dfn-engagement-gesture. - * - * Note for Firefox: There is a bug in certain Firefox releases that cause native DOM events like - * `mousemove` to fire continuously when in pointer lock mode. You can get around this by setting - * `this.preventDefaultMove` to `false` in this class. You may also need to do the same for - * `preventDefaultDown` and/or `preventDefaultUp`. Please test combinations of these if you encounter - * the error. - * - * @method Phaser.Input.Mouse.MouseManager#requestPointerLock - * @since 3.0.0 - */ - requestPointerLock: function () - { - if (Features.pointerLock) - { - var element = this.target; +module.exports = GetLineToLine; - element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock; - element.requestPointerLock(); - } - }, +/***/ }), - /** - * If the browser supports pointer lock, this will request that the pointer lock is released. If - * the browser successfully enters a locked state, a 'POINTER_LOCK_CHANGE_EVENT' will be - * dispatched - from the game's input manager - with an `isPointerLocked` property. - * - * @method Phaser.Input.Mouse.MouseManager#releasePointerLock - * @since 3.0.0 - */ - releasePointerLock: function () - { - if (Features.pointerLock) - { - document.exitPointerLock = document.exitPointerLock || document.mozExitPointerLock || document.webkitExitPointerLock; - document.exitPointerLock(); - } - }, +/***/ 17647: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Starts the Mouse Event listeners running. - * This is called automatically and does not need to be manually invoked. - * - * @method Phaser.Input.Mouse.MouseManager#startListeners - * @since 3.0.0 - */ - startListeners: function () +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetLineToLine = __webpack_require__(96537); +var Line = __webpack_require__(88829); +var Vector3 = __webpack_require__(70015); + +// Temp calculation segment +var segment = new Line(); + +// Temp vec3 +var tempIntersect = new Vector3(); + +/** + * Checks for the closest point of intersection between a line segment and an array of points, where each pair + * of points are converted to line segments for the intersection tests. + * + * If no intersection is found, this function returns `null`. + * + * If intersection was found, a Vector3 is returned with the following properties: + * + * The `x` and `y` components contain the point of the intersection. + * The `z` component contains the closest distance. + * + * @function Phaser.Geom.Intersects.GetLineToPoints + * @since 3.50.0 + * + * @param {Phaser.Geom.Line} line - The line segment, or ray, to check. If a ray, set the `isRay` parameter to `true`. + * @param {Phaser.Math.Vector2[] | Phaser.Geom.Point[]} points - An array of points to check. + * @param {boolean} [isRay=false] - Is `line` a ray or a line segment? + * @param {Phaser.Math.Vector3} [out] - A Vector3 to store the intersection results in. + * + * @return {Phaser.Math.Vector3} A Vector3 containing the intersection results, or `null`. + */ +var GetLineToPoints = function (line, points, isRay, out) +{ + if (isRay === undefined) { isRay = false; } + if (out === undefined) { out = new Vector3(); } + + var closestIntersect = false; + + // Reset our vec3s + out.set(); + tempIntersect.set(); + + var prev = points[0]; + + for (var i = 1; i < points.length; i++) { - var target = this.target; + var current = points[i]; - if (!target) - { - return; - } + segment.setTo(prev.x, prev.y, current.x, current.y); - var _this = this; - var manager = this.manager; - var canvas = manager.canvas; - var autoFocus = (window && window.focus && manager.game.config.autoFocus); + prev = current; - this.onMouseMove = function (event) + if (GetLineToLine(line, segment, isRay, tempIntersect)) { - if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) + if (!closestIntersect || tempIntersect.z < out.z) { - manager.onMouseMove(event); + out.copy(tempIntersect); - if (_this.preventDefaultMove) - { - event.preventDefault(); - } + closestIntersect = true; } - }; + } + } - this.onMouseDown = function (event) - { - if (autoFocus) - { - window.focus(); - } + return (closestIntersect) ? out : null; +}; - if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) - { - manager.onMouseDown(event); +module.exports = GetLineToPoints; - if (_this.preventDefaultDown && event.target === canvas) - { - event.preventDefault(); - } - } - }; - this.onMouseDownWindow = function (event) - { - if (!event.defaultPrevented && _this.enabled && manager && manager.enabled && event.target !== canvas) - { - // Only process the event if the target isn't the canvas - manager.onMouseDown(event); - } - }; +/***/ }), - this.onMouseUp = function (event) - { - if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) - { - manager.onMouseUp(event); +/***/ 68439: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (_this.preventDefaultUp && event.target === canvas) - { - event.preventDefault(); - } - } - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.onMouseUpWindow = function (event) - { - if (!event.defaultPrevented && _this.enabled && manager && manager.enabled && event.target !== canvas) - { - // Only process the event if the target isn't the canvas - manager.onMouseUp(event); - } - }; +var Vector3 = __webpack_require__(70015); +var Vector4 = __webpack_require__(51729); +var GetLineToPoints = __webpack_require__(17647); - this.onMouseOver = function (event) - { - if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) - { - manager.setCanvasOver(event); - } - }; +// Temp vec3 +var tempIntersect = new Vector3(); - this.onMouseOut = function (event) - { - if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) - { - manager.setCanvasOut(event); - } - }; +/** + * Checks for the closest point of intersection between a line segment and an array of polygons. + * + * If no intersection is found, this function returns `null`. + * + * If intersection was found, a Vector4 is returned with the following properties: + * + * The `x` and `y` components contain the point of the intersection. + * The `z` component contains the closest distance. + * The `w` component contains the index of the polygon, in the given array, that triggered the intersection. + * + * @function Phaser.Geom.Intersects.GetLineToPolygon + * @since 3.50.0 + * + * @param {Phaser.Geom.Line} line - The line segment, or ray, to check. If a ray, set the `isRay` parameter to `true`. + * @param {Phaser.Geom.Polygon | Phaser.Geom.Polygon[]} polygons - A single polygon, or array of polygons, to check. + * @param {boolean} [isRay=false] - Is `line` a ray or a line segment? + * @param {Phaser.Math.Vector4} [out] - A Vector4 to store the intersection results in. + * + * @return {Phaser.Math.Vector4} A Vector4 containing the intersection results, or `null`. + */ +var GetLineToPolygon = function (line, polygons, isRay, out) +{ + if (out === undefined) { out = new Vector4(); } - this.onMouseWheel = function (event) + if (!Array.isArray(polygons)) + { + polygons = [ polygons ]; + } + + var closestIntersect = false; + + // Reset our vec4s + out.set(); + tempIntersect.set(); + + for (var i = 0; i < polygons.length; i++) + { + if (GetLineToPoints(line, polygons[i].points, isRay, tempIntersect)) { - if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) + if (!closestIntersect || tempIntersect.z < out.z) { - manager.onMouseWheel(event); - } + out.set(tempIntersect.x, tempIntersect.y, tempIntersect.z, i); - if (_this.preventDefaultWheel && event.target === canvas) - { - event.preventDefault(); + closestIntersect = true; } - }; + } + } - var passive = { passive: true }; + return (closestIntersect) ? out : null; +}; - target.addEventListener('mousemove', this.onMouseMove); - target.addEventListener('mousedown', this.onMouseDown); - target.addEventListener('mouseup', this.onMouseUp); - target.addEventListener('mouseover', this.onMouseOver, passive); - target.addEventListener('mouseout', this.onMouseOut, passive); +module.exports = GetLineToPolygon; - if (this.preventDefaultWheel) - { - target.addEventListener('wheel', this.onMouseWheel, { passive: false }); - } - else + +/***/ }), + +/***/ 9569: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Florian Vazelle + * @author Geoffrey Glaive + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Point = __webpack_require__(79967); +var LineToLine = __webpack_require__(25227); +var LineToRectangle = __webpack_require__(47910); + +/** + * Checks for intersection between the Line and a Rectangle shape, + * and returns the intersection points as a Point object array. + * + * @function Phaser.Geom.Intersects.GetLineToRectangle + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The Line to check for intersection. + * @param {(Phaser.Geom.Rectangle|object)} rect - The Rectangle to check for intersection. + * @param {array} [out] - An optional array in which to store the points of intersection. + * + * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. + */ +var GetLineToRectangle = function (line, rect, out) +{ + if (out === undefined) { out = []; } + + if (LineToRectangle(line, rect)) + { + var lineA = rect.getLineA(); + var lineB = rect.getLineB(); + var lineC = rect.getLineC(); + var lineD = rect.getLineD(); + + var output = [ new Point(), new Point(), new Point(), new Point() ]; + + var result = [ + LineToLine(lineA, line, output[0]), + LineToLine(lineB, line, output[1]), + LineToLine(lineC, line, output[2]), + LineToLine(lineD, line, output[3]) + ]; + + for (var i = 0; i < 4; i++) { - target.addEventListener('wheel', this.onMouseWheel, passive); + if (result[i]) { out.push(output[i]); } } + } - if (window && manager.game.config.inputWindowEvents) - { - try - { - window.top.addEventListener('mousedown', this.onMouseDownWindow, passive); - window.top.addEventListener('mouseup', this.onMouseUpWindow, passive); - } - catch (exception) - { - window.addEventListener('mousedown', this.onMouseDownWindow, passive); - window.addEventListener('mouseup', this.onMouseUpWindow, passive); + return out; +}; - this.isTop = false; - } - } +module.exports = GetLineToRectangle; - if (Features.pointerLock) - { - this.pointerLockChange = function (event) - { - var element = _this.target; - _this.locked = (document.pointerLockElement === element || document.mozPointerLockElement === element || document.webkitPointerLockElement === element) ? true : false; +/***/ }), - manager.onPointerLockChange(event); - }; +/***/ 7449: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - document.addEventListener('pointerlockchange', this.pointerLockChange, true); - document.addEventListener('mozpointerlockchange', this.pointerLockChange, true); - document.addEventListener('webkitpointerlockchange', this.pointerLockChange, true); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.enabled = true; - }, +var Vector4 = __webpack_require__(51729); +var GetLineToPolygon = __webpack_require__(68439); +var Line = __webpack_require__(88829); - /** - * Stops the Mouse Event listeners. - * This is called automatically and does not need to be manually invoked. - * - * @method Phaser.Input.Mouse.MouseManager#stopListeners - * @since 3.0.0 - */ - stopListeners: function () +// Temp calculation segment +var segment = new Line(); + +/** + * @ignore + */ +function CheckIntersects (angle, x, y, polygons, intersects) +{ + var dx = Math.cos(angle); + var dy = Math.sin(angle); + + segment.setTo(x, y, x + dx, y + dy); + + var closestIntersect = GetLineToPolygon(segment, polygons, true); + + if (closestIntersect) { - var target = this.target; + intersects.push(new Vector4(closestIntersect.x, closestIntersect.y, angle, closestIntersect.w)); + } +} - target.removeEventListener('mousemove', this.onMouseMove); - target.removeEventListener('mousedown', this.onMouseDown); - target.removeEventListener('mouseup', this.onMouseUp); - target.removeEventListener('mouseover', this.onMouseOver); - target.removeEventListener('mouseout', this.onMouseOut); +/** + * @ignore + */ +function SortIntersects (a, b) +{ + return a.z - b.z; +} - if (window) - { - target = (this.isTop) ? window.top : window; +/** + * Projects rays out from the given point to each line segment of the polygons. + * + * If the rays intersect with the polygons, the points of intersection are returned in an array. + * + * If no intersections are found, the returned array will be empty. + * + * Each Vector4 intersection result has the following properties: + * + * The `x` and `y` components contain the point of the intersection. + * The `z` component contains the angle of intersection. + * The `w` component contains the index of the polygon, in the given array, that triggered the intersection. + * + * @function Phaser.Geom.Intersects.GetRaysFromPointToPolygon + * @since 3.50.0 + * + * @param {number} x - The x coordinate to project the rays from. + * @param {number} y - The y coordinate to project the rays from. + * @param {Phaser.Geom.Polygon | Phaser.Geom.Polygon[]} polygons - A single polygon, or array of polygons, to check against the rays. + * + * @return {Phaser.Math.Vector4[]} An array containing all intersections in Vector4s. + */ +var GetRaysFromPointToPolygon = function (x, y, polygons) +{ + if (!Array.isArray(polygons)) + { + polygons = [ polygons ]; + } - target.removeEventListener('mousedown', this.onMouseDownWindow); - target.removeEventListener('mouseup', this.onMouseUpWindow); - } + var intersects = []; + var angles = []; - if (Features.pointerLock) + for (var i = 0; i < polygons.length; i++) + { + var points = polygons[i].points; + + for (var p = 0; p < points.length; p++) { - document.removeEventListener('pointerlockchange', this.pointerLockChange, true); - document.removeEventListener('mozpointerlockchange', this.pointerLockChange, true); - document.removeEventListener('webkitpointerlockchange', this.pointerLockChange, true); - } - }, + var angle = Math.atan2(points[p].y - y, points[p].x - x); - /** - * Destroys this Mouse Manager instance. - * - * @method Phaser.Input.Mouse.MouseManager#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.stopListeners(); + if (angles.indexOf(angle) === -1) + { + // +- 0.00001 rads to catch lines behind segment corners - this.target = null; - this.enabled = false; - this.manager = null; + CheckIntersects(angle, x, y, polygons, intersects); + CheckIntersects(angle - 0.00001, x, y, polygons, intersects); + CheckIntersects(angle + 0.00001, x, y, polygons, intersects); + + angles.push(angle); + } + } } -}); + return intersects.sort(SortIntersects); +}; -module.exports = MouseManager; +module.exports = GetRaysFromPointToPolygon; /***/ }), -/* 412 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 82931: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Angle = __webpack_require__(349); -var Class = __webpack_require__(0); -var Distance = __webpack_require__(50); -var FuzzyEqual = __webpack_require__(124); -var SmoothStepInterpolation = __webpack_require__(360); -var Vector2 = __webpack_require__(3); -var OS = __webpack_require__(105); +var Rectangle = __webpack_require__(74118); +var RectangleToRectangle = __webpack_require__(90205); /** - * @classdesc - * A Pointer object encapsulates both mouse and touch input within Phaser. - * - * By default, Phaser will create 2 pointers for your game to use. If you require more, i.e. for a multi-touch - * game, then use the `InputPlugin.addPointer` method to do so, rather than instantiating this class directly, - * otherwise it won't be managed by the input system. + * Checks if two Rectangle shapes intersect and returns the area of this intersection as Rectangle object. * - * You can reference the current active pointer via `InputPlugin.activePointer`. You can also use the properties - * `InputPlugin.pointer1` through to `pointer10`, for each pointer you have enabled in your game. + * If optional `output` parameter is omitted, new Rectangle object is created and returned. If there is intersection, it will contain intersection area. If there is no intersection, it wil be empty Rectangle (all values set to zero). * - * The properties of this object are set by the Input Plugin during processing. This object is then sent in all - * input related events that the Input Plugin emits, so you can reference properties from it directly in your - * callbacks. + * If Rectangle object is passed as `output` and there is intersection, then intersection area data will be loaded into it and it will be returned. If there is no intersection, it will be returned without any change. * - * @class Pointer - * @memberof Phaser.Input - * @constructor + * @function Phaser.Geom.Intersects.GetRectangleIntersection * @since 3.0.0 * - * @param {Phaser.Input.InputManager} manager - A reference to the Input Manager. - * @param {number} id - The internal ID of this Pointer. + * @generic {Phaser.Geom.Rectangle} O - [output,$return] + * + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle object. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle object. + * @param {Phaser.Geom.Rectangle} [output] - Optional Rectangle object. If given, the intersection data will be loaded into it (in case of no intersection, it will be left unchanged). Otherwise, new Rectangle object will be created and returned with either intersection data or empty (all values set to zero), if there is no intersection. + * + * @return {Phaser.Geom.Rectangle} A rectangle object with intersection data. */ -var Pointer = new Class({ - - initialize: +var GetRectangleIntersection = function (rectA, rectB, output) +{ + if (output === undefined) { output = new Rectangle(); } - function Pointer (manager, id) + if (RectangleToRectangle(rectA, rectB)) { - /** - * A reference to the Input Manager. - * - * @name Phaser.Input.Pointer#manager - * @type {Phaser.Input.InputManager} - * @since 3.0.0 - */ - this.manager = manager; + output.x = Math.max(rectA.x, rectB.x); + output.y = Math.max(rectA.y, rectB.y); + output.width = Math.min(rectA.right, rectB.right) - output.x; + output.height = Math.min(rectA.bottom, rectB.bottom) - output.y; + } - /** - * The internal ID of this Pointer. - * - * @name Phaser.Input.Pointer#id - * @type {number} - * @readonly - * @since 3.0.0 - */ - this.id = id; + return output; +}; - /** - * The most recent native DOM Event this Pointer has processed. - * - * @name Phaser.Input.Pointer#event - * @type {(TouchEvent|MouseEvent|WheelEvent)} - * @since 3.0.0 - */ - this.event; +module.exports = GetRectangleIntersection; - /** - * The DOM element the Pointer was pressed down on, taken from the DOM event. - * In a default set-up this will be the Canvas that Phaser is rendering to, or the Window element. - * - * @name Phaser.Input.Pointer#downElement - * @type {any} - * @readonly - * @since 3.16.0 - */ - this.downElement; - /** - * The DOM element the Pointer was released on, taken from the DOM event. - * In a default set-up this will be the Canvas that Phaser is rendering to, or the Window element. - * - * @name Phaser.Input.Pointer#upElement - * @type {any} - * @readonly - * @since 3.16.0 - */ - this.upElement; +/***/ }), - /** - * The camera the Pointer interacted with during its last update. - * - * A Pointer can only ever interact with one camera at once, which will be the top-most camera - * in the list should multiple cameras be positioned on-top of each other. - * - * @name Phaser.Input.Pointer#camera - * @type {Phaser.Cameras.Scene2D.Camera} - * @default null - * @since 3.0.0 - */ - this.camera = null; +/***/ 1946: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * A read-only property that indicates which button was pressed, or released, on the pointer - * during the most recent event. It is only set during `up` and `down` events. - * - * On Touch devices the value is always 0. - * - * Users may change the configuration of buttons on their pointing device so that if an event's button property - * is zero, it may not have been caused by the button that is physically left–most on the pointing device; - * however, it should behave as if the left button was clicked in the standard button layout. - * - * @name Phaser.Input.Pointer#button - * @type {number} - * @readonly - * @default 0 - * @since 3.18.0 - */ - this.button = 0; +/** + * @author Florian Vazelle + * @author Geoffrey Glaive + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * 0: No button or un-initialized - * 1: Left button - * 2: Right button - * 4: Wheel button or middle button - * 8: 4th button (typically the "Browser Back" button) - * 16: 5th button (typically the "Browser Forward" button) - * - * For a mouse configured for left-handed use, the button actions are reversed. - * In this case, the values are read from right to left. - * - * @name Phaser.Input.Pointer#buttons - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.buttons = 0; +var GetLineToRectangle = __webpack_require__(9569); +var RectangleToRectangle = __webpack_require__(90205); - /** - * The position of the Pointer in screen space. - * - * @name Phaser.Input.Pointer#position - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.0.0 - */ - this.position = new Vector2(); +/** + * Checks if two Rectangles intersect and returns the intersection points as a Point object array. + * + * A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. As such, the two Rectangles are considered "solid". A Rectangle with no width or no height will never intersect another Rectangle. + * + * @function Phaser.Geom.Intersects.GetRectangleToRectangle + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check for intersection. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check for intersection. + * @param {array} [out] - An optional array in which to store the points of intersection. + * + * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. + */ +var GetRectangleToRectangle = function (rectA, rectB, out) +{ + if (out === undefined) { out = []; } - /** - * The previous position of the Pointer in screen space. - * - * The old x and y values are stored in here during the InputManager.transformPointer call. - * - * Use the properties `velocity`, `angle` and `distance` to create your own gesture recognition. - * - * @name Phaser.Input.Pointer#prevPosition - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.11.0 - */ - this.prevPosition = new Vector2(); + if (RectangleToRectangle(rectA, rectB)) + { + var lineA = rectA.getLineA(); + var lineB = rectA.getLineB(); + var lineC = rectA.getLineC(); + var lineD = rectA.getLineD(); - /** - * An internal vector used for calculations of the pointer speed and angle. - * - * @name Phaser.Input.Pointer#midPoint - * @type {Phaser.Math.Vector2} - * @private - * @since 3.16.0 - */ - this.midPoint = new Vector2(-1, -1); + GetLineToRectangle(lineA, rectB, out); + GetLineToRectangle(lineB, rectB, out); + GetLineToRectangle(lineC, rectB, out); + GetLineToRectangle(lineD, rectB, out); + } - /** - * The current velocity of the Pointer, based on its current and previous positions. - * - * This value is smoothed out each frame, according to the `motionFactor` property. - * - * This property is updated whenever the Pointer moves, regardless of any button states. In other words, - * it changes based on movement alone - a button doesn't have to be pressed first. - * - * @name Phaser.Input.Pointer#velocity - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.16.0 - */ - this.velocity = new Vector2(); + return out; +}; - /** - * The current angle the Pointer is moving, in radians, based on its previous and current position. - * - * The angle is based on the old position facing to the current position. - * - * This property is updated whenever the Pointer moves, regardless of any button states. In other words, - * it changes based on movement alone - a button doesn't have to be pressed first. - * - * @name Phaser.Input.Pointer#angle - * @type {number} - * @readonly - * @since 3.16.0 - */ - this.angle = 0; +module.exports = GetRectangleToRectangle; - /** - * The distance the Pointer has moved, based on its previous and current position. - * - * This value is smoothed out each frame, according to the `motionFactor` property. - * - * This property is updated whenever the Pointer moves, regardless of any button states. In other words, - * it changes based on movement alone - a button doesn't have to be pressed first. - * - * If you need the total distance travelled since the primary buttons was pressed down, - * then use the `Pointer.getDistance` method. - * - * @name Phaser.Input.Pointer#distance - * @type {number} - * @readonly - * @since 3.16.0 - */ - this.distance = 0; - /** - * The smoothing factor to apply to the Pointer position. - * - * Due to their nature, pointer positions are inherently noisy. While this is fine for lots of games, if you need cleaner positions - * then you can set this value to apply an automatic smoothing to the positions as they are recorded. - * - * The default value of zero means 'no smoothing'. - * Set to a small value, such as 0.2, to apply an average level of smoothing between positions. You can do this by changing this - * value directly, or by setting the `input.smoothFactor` property in the Game Config. - * - * Positions are only smoothed when the pointer moves. If the primary button on this Pointer enters an Up or Down state, then the position - * is always precise, and not smoothed. - * - * @name Phaser.Input.Pointer#smoothFactor - * @type {number} - * @default 0 - * @since 3.16.0 - */ - this.smoothFactor = 0; - - /** - * The factor applied to the motion smoothing each frame. - * - * This value is passed to the Smooth Step Interpolation that is used to calculate the velocity, - * angle and distance of the Pointer. It's applied every frame, until the midPoint reaches the current - * position of the Pointer. 0.2 provides a good average but can be increased if you need a - * quicker update and are working in a high performance environment. Never set this value to - * zero. - * - * @name Phaser.Input.Pointer#motionFactor - * @type {number} - * @default 0.2 - * @since 3.16.0 - */ - this.motionFactor = 0.2; - - /** - * The x position of this Pointer, translated into the coordinate space of the most recent Camera it interacted with. - * - * If you wish to use this value _outside_ of an input event handler then you should update it first by calling - * the `Pointer.updateWorldPoint` method. - * - * @name Phaser.Input.Pointer#worldX - * @type {number} - * @default 0 - * @since 3.10.0 - */ - this.worldX = 0; +/***/ }), - /** - * The y position of this Pointer, translated into the coordinate space of the most recent Camera it interacted with. - * - * If you wish to use this value _outside_ of an input event handler then you should update it first by calling - * the `Pointer.updateWorldPoint` method. - * - * @name Phaser.Input.Pointer#worldY - * @type {number} - * @default 0 - * @since 3.10.0 - */ - this.worldY = 0; +/***/ 34211: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Time when this Pointer was most recently moved (regardless of the state of its buttons, if any) - * - * @name Phaser.Input.Pointer#moveTime - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.moveTime = 0; +/** + * @author Florian Vazelle + * @author Geoffrey Glaive + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * X coordinate of the Pointer when Button 1 (left button), or Touch, was pressed, used for dragging objects. - * - * @name Phaser.Input.Pointer#downX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.downX = 0; +var RectangleToTriangle = __webpack_require__(20370); +var GetLineToRectangle = __webpack_require__(9569); - /** - * Y coordinate of the Pointer when Button 1 (left button), or Touch, was pressed, used for dragging objects. - * - * @name Phaser.Input.Pointer#downY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.downY = 0; +/** + * Checks for intersection between Rectangle shape and Triangle shape, + * and returns the intersection points as a Point object array. + * + * @function Phaser.Geom.Intersects.GetRectangleToTriangle + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - Rectangle object to test. + * @param {Phaser.Geom.Triangle} triangle - Triangle object to test. + * @param {array} [out] - An optional array in which to store the points of intersection. + * + * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. + */ +var GetRectangleToTriangle = function (rect, triangle, out) +{ + if (out === undefined) { out = []; } - /** - * The Event timestamp when the first button, or Touch input, was pressed. Used for dragging objects. - * - * @name Phaser.Input.Pointer#downTime - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.downTime = 0; + if (RectangleToTriangle(rect, triangle)) + { + var lineA = triangle.getLineA(); + var lineB = triangle.getLineB(); + var lineC = triangle.getLineC(); - /** - * X coordinate of the Pointer when Button 1 (left button), or Touch, was released, used for dragging objects. - * - * @name Phaser.Input.Pointer#upX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.upX = 0; + GetLineToRectangle(lineA, rect, out); + GetLineToRectangle(lineB, rect, out); + GetLineToRectangle(lineC, rect, out); + } - /** - * Y coordinate of the Pointer when Button 1 (left button), or Touch, was released, used for dragging objects. - * - * @name Phaser.Input.Pointer#upY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.upY = 0; + return out; +}; - /** - * The Event timestamp when the final button, or Touch input, was released. Used for dragging objects. - * - * @name Phaser.Input.Pointer#upTime - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.upTime = 0; +module.exports = GetRectangleToTriangle; - /** - * Is the primary button down? (usually button 0, the left mouse button) - * - * @name Phaser.Input.Pointer#primaryDown - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.primaryDown = false; - /** - * Is _any_ button on this pointer considered as being down? - * - * @name Phaser.Input.Pointer#isDown - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.isDown = false; +/***/ }), - /** - * Did the previous input event come from a Touch input (true) or Mouse? (false) - * - * @name Phaser.Input.Pointer#wasTouch - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.wasTouch = false; +/***/ 80511: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Did this Pointer get canceled by a touchcancel event? - * - * Note: "canceled" is the American-English spelling of "cancelled". Please don't submit PRs correcting it! - * - * @name Phaser.Input.Pointer#wasCanceled - * @type {boolean} - * @default false - * @since 3.15.0 - */ - this.wasCanceled = false; +/** + * @author Florian Vazelle + * @author Geoffrey Glaive + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * If the mouse is locked, the horizontal relative movement of the Pointer in pixels since last frame. - * - * @name Phaser.Input.Pointer#movementX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.movementX = 0; +var GetLineToCircle = __webpack_require__(26111); +var TriangleToCircle = __webpack_require__(48411); - /** - * If the mouse is locked, the vertical relative movement of the Pointer in pixels since last frame. - * - * @name Phaser.Input.Pointer#movementY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.movementY = 0; +/** + * Checks if a Triangle and a Circle intersect, and returns the intersection points as a Point object array. + * + * A Circle intersects a Triangle if its center is located within it or if any of the Triangle's sides intersect the Circle. As such, the Triangle and the Circle are considered "solid" for the intersection. + * + * @function Phaser.Geom.Intersects.GetTriangleToCircle + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check for intersection. + * @param {Phaser.Geom.Circle} circle - The Circle to check for intersection. + * @param {array} [out] - An optional array in which to store the points of intersection. + * + * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. + */ +var GetTriangleToCircle = function (triangle, circle, out) +{ + if (out === undefined) { out = []; } - /** - * The identifier property of the Pointer as set by the DOM event when this Pointer is started. - * - * @name Phaser.Input.Pointer#identifier - * @type {number} - * @since 3.10.0 - */ - this.identifier = 0; + if (TriangleToCircle(triangle, circle)) + { + var lineA = triangle.getLineA(); + var lineB = triangle.getLineB(); + var lineC = triangle.getLineC(); - /** - * The pointerId property of the Pointer as set by the DOM event when this Pointer is started. - * The browser can and will recycle this value. - * - * @name Phaser.Input.Pointer#pointerId - * @type {number} - * @since 3.10.0 - */ - this.pointerId = null; + GetLineToCircle(lineA, circle, out); + GetLineToCircle(lineB, circle, out); + GetLineToCircle(lineC, circle, out); + } - /** - * An active Pointer is one that is currently pressed down on the display. - * A Mouse is always considered as active. - * - * @name Phaser.Input.Pointer#active - * @type {boolean} - * @since 3.10.0 - */ - this.active = (id === 0) ? true : false; + return out; +}; - /** - * Is this pointer Pointer Locked? - * - * Only a mouse pointer can be locked and it only becomes locked when requested via - * the browsers Pointer Lock API. - * - * You can request this by calling the `this.input.mouse.requestPointerLock()` method from - * a `pointerdown` or `pointerup` event handler. - * - * @name Phaser.Input.Pointer#locked - * @readonly - * @type {boolean} - * @since 3.19.0 - */ - this.locked = false; +module.exports = GetTriangleToCircle; - /** - * The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device. - * - * @name Phaser.Input.Pointer#deltaX - * @type {number} - * @default 0 - * @since 3.18.0 - */ - this.deltaX = 0; - /** - * The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device. - * This value will typically be less than 0 if the user scrolls up and greater than zero if scrolling down. - * - * @name Phaser.Input.Pointer#deltaY - * @type {number} - * @default 0 - * @since 3.18.0 - */ - this.deltaY = 0; +/***/ }), - /** - * The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device. - * - * @name Phaser.Input.Pointer#deltaZ - * @type {number} - * @default 0 - * @since 3.18.0 - */ - this.deltaZ = 0; - }, +/***/ 31343: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Takes a Camera and updates this Pointer's `worldX` and `worldY` values so they are - * the result of a translation through the given Camera. - * - * Note that the values will be automatically replaced the moment the Pointer is - * updated by an input event, such as a mouse move, so should be used immediately. - * - * @method Phaser.Input.Pointer#updateWorldPoint - * @since 3.19.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera which is being tested against. - * - * @return {this} This Pointer object. - */ - updateWorldPoint: function (camera) - { - // Stores the world point inside of tempPoint - var temp = camera.getWorldPoint(this.x, this.y); +/** + * @author Florian Vazelle + * @author Geoffrey Glaive + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.worldX = temp.x; - this.worldY = temp.y; +var Point = __webpack_require__(79967); +var TriangleToLine = __webpack_require__(86117); +var LineToLine = __webpack_require__(25227); - return this; - }, +/** + * Checks if a Triangle and a Line intersect, and returns the intersection points as a Point object array. + * + * The Line intersects the Triangle if it starts inside of it, ends inside of it, or crosses any of the Triangle's sides. Thus, the Triangle is considered "solid". + * + * @function Phaser.Geom.Intersects.GetTriangleToLine + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check with. + * @param {Phaser.Geom.Line} line - The Line to check with. + * @param {array} [out] - An optional array in which to store the points of intersection. + * + * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. + */ +var GetTriangleToLine = function (triangle, line, out) +{ + if (out === undefined) { out = []; } - /** - * Takes a Camera and returns a Vector2 containing the translated position of this Pointer - * within that Camera. This can be used to convert this Pointers position into camera space. - * - * @method Phaser.Input.Pointer#positionToCamera - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the translation. - * @param {(Phaser.Math.Vector2|object)} [output] - A Vector2-like object in which to store the translated position. - * - * @return {(Phaser.Math.Vector2|object)} A Vector2 containing the translated coordinates of this Pointer, based on the given camera. - */ - positionToCamera: function (camera, output) + if (TriangleToLine(triangle, line)) { - return camera.getWorldPoint(this.x, this.y, output); - }, + var lineA = triangle.getLineA(); + var lineB = triangle.getLineB(); + var lineC = triangle.getLineC(); - /** - * Calculates the motion of this Pointer, including its velocity and angle of movement. - * This method is called automatically each frame by the Input Manager. - * - * @method Phaser.Input.Pointer#updateMotion - * @private - * @since 3.16.0 - */ - updateMotion: function () - { - var cx = this.position.x; - var cy = this.position.y; + var output = [ new Point(), new Point(), new Point() ]; - var mx = this.midPoint.x; - var my = this.midPoint.y; + var result = [ + LineToLine(lineA, line, output[0]), + LineToLine(lineB, line, output[1]), + LineToLine(lineC, line, output[2]) + ]; - if (cx === mx && cy === my) + for (var i = 0; i < 3; i++) { - // Nothing to do here - return; + if (result[i]) { out.push(output[i]); } } + } - // Moving towards our goal ... - var vx = SmoothStepInterpolation(this.motionFactor, mx, cx); - var vy = SmoothStepInterpolation(this.motionFactor, my, cy); + return out; +}; - if (FuzzyEqual(vx, cx, 0.1)) - { - vx = cx; - } +module.exports = GetTriangleToLine; - if (FuzzyEqual(vy, cy, 0.1)) - { - vy = cy; - } - this.midPoint.set(vx, vy); +/***/ }), - var dx = cx - vx; - var dy = cy - vy; +/***/ 70534: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.velocity.set(dx, dy); +/** + * @author Florian Vazelle + * @author Geoffrey Glaive + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.angle = Angle(vx, vy, cx, cy); +var TriangleToTriangle = __webpack_require__(23589); +var GetTriangleToLine = __webpack_require__(31343); - this.distance = Math.sqrt(dx * dx + dy * dy); - }, +/** + * Checks if two Triangles intersect, and returns the intersection points as a Point object array. + * + * A Triangle intersects another Triangle if any pair of their lines intersects or if any point of one Triangle is within the other Triangle. Thus, the Triangles are considered "solid". + * + * @function Phaser.Geom.Intersects.GetTriangleToTriangle + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangleA - The first Triangle to check for intersection. + * @param {Phaser.Geom.Triangle} triangleB - The second Triangle to check for intersection. + * @param {array} [out] - An optional array in which to store the points of intersection. + * + * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. + */ +var GetTriangleToTriangle = function (triangleA, triangleB, out) +{ + if (out === undefined) { out = []; } - /** - * Internal method to handle a Mouse Up Event. - * - * @method Phaser.Input.Pointer#up - * @private - * @since 3.0.0 - * - * @param {MouseEvent} event - The Mouse Event to process. - */ - up: function (event) + if (TriangleToTriangle(triangleA, triangleB)) { - if ('buttons' in event) - { - this.buttons = event.buttons; - } + var lineA = triangleB.getLineA(); + var lineB = triangleB.getLineB(); + var lineC = triangleB.getLineC(); - this.event = event; + GetTriangleToLine(triangleA, lineA, out); + GetTriangleToLine(triangleA, lineB, out); + GetTriangleToLine(triangleA, lineC, out); + } - this.button = event.button; + return out; +}; - this.upElement = event.target; +module.exports = GetTriangleToTriangle; - // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY, false); - // 0: Main button pressed, usually the left button or the un-initialized state - if (event.button === 0) - { - this.primaryDown = false; - this.upX = this.x; - this.upY = this.y; - } +/***/ }), - if (this.buttons === 0) - { - // No more buttons are still down - this.isDown = false; +/***/ 61472: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.upTime = event.timeStamp; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.wasTouch = false; - } - }, +var Contains = __webpack_require__(65650); +var Point = __webpack_require__(79967); - /** - * Internal method to handle a Mouse Down Event. - * - * @method Phaser.Input.Pointer#down - * @private - * @since 3.0.0 - * - * @param {MouseEvent} event - The Mouse Event to process. - */ - down: function (event) +var tmp = new Point(); + +/** + * Checks for intersection between the line segment and circle. + * + * Based on code by [Matt DesLauriers](https://github.com/mattdesl/line-circle-collision/blob/master/LICENSE.md). + * + * @function Phaser.Geom.Intersects.LineToCircle + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line segment to check. + * @param {Phaser.Geom.Circle} circle - The circle to check against the line. + * @param {(Phaser.Geom.Point|any)} [nearest] - An optional Point-like object. If given the closest point on the Line where the circle intersects will be stored in this object. + * + * @return {boolean} `true` if the two objects intersect, otherwise `false`. + */ +var LineToCircle = function (line, circle, nearest) +{ + if (nearest === undefined) { nearest = tmp; } + + if (Contains(circle, line.x1, line.y1)) { - if ('buttons' in event) - { - this.buttons = event.buttons; - } + nearest.x = line.x1; + nearest.y = line.y1; - this.event = event; + return true; + } - this.button = event.button; + if (Contains(circle, line.x2, line.y2)) + { + nearest.x = line.x2; + nearest.y = line.y2; - this.downElement = event.target; + return true; + } - // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY, false); + var dx = line.x2 - line.x1; + var dy = line.y2 - line.y1; - // 0: Main button pressed, usually the left button or the un-initialized state - if (event.button === 0) - { - this.primaryDown = true; - this.downX = this.x; - this.downY = this.y; - } + var lcx = circle.x - line.x1; + var lcy = circle.y - line.y1; - if (OS.macOS && event.ctrlKey) - { - // Override button settings on macOS - this.buttons = 2; - this.primaryDown = false; - } + // project lc onto d, resulting in vector p + var dLen2 = (dx * dx) + (dy * dy); + var px = dx; + var py = dy; - if (!this.isDown) - { - this.isDown = true; + if (dLen2 > 0) + { + var dp = ((lcx * dx) + (lcy * dy)) / dLen2; - this.downTime = event.timeStamp; - } + px *= dp; + py *= dp; + } - this.wasTouch = false; - }, + nearest.x = line.x1 + px; + nearest.y = line.y1 + py; - /** - * Internal method to handle a Mouse Move Event. - * - * @method Phaser.Input.Pointer#move - * @private - * @since 3.0.0 - * - * @param {MouseEvent} event - The Mouse Event to process. - */ - move: function (event) - { - if ('buttons' in event) - { - this.buttons = event.buttons; - } + // len2 of p + var pLen2 = (px * px) + (py * py); - this.event = event; + return ( + pLen2 <= dLen2 && + ((px * dx) + (py * dy)) >= 0 && + Contains(circle, nearest.x, nearest.y) + ); +}; - // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY, true); +module.exports = LineToCircle; - if (this.locked) - { - // Multiple DOM events may occur within one frame, but only one Phaser event will fire - this.movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0; - this.movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0; - } - this.moveTime = event.timeStamp; +/***/ }), - this.wasTouch = false; - }, +/***/ 25227: +/***/ ((module) => { - /** - * Internal method to handle a Mouse Wheel Event. - * - * @method Phaser.Input.Pointer#wheel - * @private - * @since 3.18.0 - * - * @param {WheelEvent} event - The Wheel Event to process. - */ - wheel: function (event) +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// This is based off an explanation and expanded math presented by Paul Bourke: +// See http://paulbourke.net/geometry/pointlineplane/ + +/** + * Checks if two Lines intersect. If the Lines are identical, they will be treated as parallel and thus non-intersecting. + * + * @function Phaser.Geom.Intersects.LineToLine + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line1 - The first Line to check. + * @param {Phaser.Geom.Line} line2 - The second Line to check. + * @param {Phaser.Types.Math.Vector2Like} [out] - An optional point-like object in which to store the coordinates of intersection, if needed. + * + * @return {boolean} `true` if the two Lines intersect, and the `out` object will be populated, if given. Otherwise, `false`. + */ +var LineToLine = function (line1, line2, out) +{ + var x1 = line1.x1; + var y1 = line1.y1; + var x2 = line1.x2; + var y2 = line1.y2; + + var x3 = line2.x1; + var y3 = line2.y1; + var x4 = line2.x2; + var y4 = line2.y2; + + // Check that none of the lines are length zero + if ((x1 === x2 && y1 === y2) || (x3 === x4 && y3 === y4)) { - if ('buttons' in event) - { - this.buttons = event.buttons; - } + return false; + } - this.event = event; + var denom = ((y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1)); - // Sets the local x/y properties - this.manager.transformPointer(this, event.pageX, event.pageY, false); + // Make sure there is not a division by zero - this also indicates that the lines are parallel. + // If numA and numB were both equal to zero the lines would be on top of each other (coincidental). + // This check is not done because it is not necessary for this implementation (the parallel check accounts for this). - this.deltaX = event.deltaX; - this.deltaY = event.deltaY; - this.deltaZ = event.deltaZ; + if (denom === 0) + { + // Lines are parallel + return false; + } - this.wasTouch = false; - }, + // Calculate the intermediate fractional point that the lines potentially intersect. - /** - * Internal method to handle a Touch Start Event. - * - * @method Phaser.Input.Pointer#touchstart - * @private - * @since 3.0.0 - * - * @param {Touch} touch - The Changed Touch from the Touch Event. - * @param {TouchEvent} event - The full Touch Event. - */ - touchstart: function (touch, event) + var ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom; + var ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom; + + // The fractional point will be between 0 and 1 inclusive if the lines intersect. + // If the fractional calculation is larger than 1 or smaller than 0 the lines would need to be longer to intersect. + + if (ua < 0 || ua > 1 || ub < 0 || ub > 1) { - if (touch['pointerId']) + return false; + } + else + { + if (out) { - this.pointerId = touch.pointerId; + out.x = x1 + ua * (x2 - x1); + out.y = y1 + ua * (y2 - y1); } - this.identifier = touch.identifier; - this.target = touch.target; - this.active = true; - - this.buttons = 1; - - this.event = event; + return true; + } +}; - this.downElement = touch.target; +module.exports = LineToLine; - // Sets the local x/y properties - this.manager.transformPointer(this, touch.pageX, touch.pageY, false); - this.primaryDown = true; - this.downX = this.x; - this.downY = this.y; - this.downTime = event.timeStamp; +/***/ }), - this.isDown = true; +/***/ 47910: +/***/ ((module) => { - this.wasTouch = true; - this.wasCanceled = false; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.updateMotion(); - }, +/** + * Checks for intersection between the Line and a Rectangle shape, or a rectangle-like + * object, with public `x`, `y`, `right` and `bottom` properties, such as a Sprite or Body. + * + * An intersection is considered valid if: + * + * The line starts within, or ends within, the Rectangle. + * The line segment intersects one of the 4 rectangle edges. + * + * The for the purposes of this function rectangles are considered 'solid'. + * + * @function Phaser.Geom.Intersects.LineToRectangle + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The Line to check for intersection. + * @param {(Phaser.Geom.Rectangle|object)} rect - The Rectangle to check for intersection. + * + * @return {boolean} `true` if the Line and the Rectangle intersect, `false` otherwise. + */ +var LineToRectangle = function (line, rect) +{ + var x1 = line.x1; + var y1 = line.y1; - /** - * Internal method to handle a Touch Move Event. - * - * @method Phaser.Input.Pointer#touchmove - * @private - * @since 3.0.0 - * - * @param {Touch} touch - The Changed Touch from the Touch Event. - * @param {TouchEvent} event - The full Touch Event. - */ - touchmove: function (touch, event) - { - this.event = event; + var x2 = line.x2; + var y2 = line.y2; - // Sets the local x/y properties - this.manager.transformPointer(this, touch.pageX, touch.pageY, true); + var bx1 = rect.x; + var by1 = rect.y; + var bx2 = rect.right; + var by2 = rect.bottom; - this.moveTime = event.timeStamp; + var t = 0; - this.wasTouch = true; + // If the start or end of the line is inside the rect then we assume + // collision, as rects are solid for our use-case. - this.updateMotion(); - }, + if ((x1 >= bx1 && x1 <= bx2 && y1 >= by1 && y1 <= by2) || + (x2 >= bx1 && x2 <= bx2 && y2 >= by1 && y2 <= by2)) + { + return true; + } - /** - * Internal method to handle a Touch End Event. - * - * @method Phaser.Input.Pointer#touchend - * @private - * @since 3.0.0 - * - * @param {Touch} touch - The Changed Touch from the Touch Event. - * @param {TouchEvent} event - The full Touch Event. - */ - touchend: function (touch, event) + if (x1 < bx1 && x2 >= bx1) { - this.buttons = 0; + // Left edge + t = y1 + (y2 - y1) * (bx1 - x1) / (x2 - x1); - this.event = event; + if (t > by1 && t <= by2) + { + return true; + } + } + else if (x1 > bx2 && x2 <= bx2) + { + // Right edge + t = y1 + (y2 - y1) * (bx2 - x1) / (x2 - x1); - this.upElement = touch.target; + if (t >= by1 && t <= by2) + { + return true; + } + } - // Sets the local x/y properties - this.manager.transformPointer(this, touch.pageX, touch.pageY, false); + if (y1 < by1 && y2 >= by1) + { + // Top edge + t = x1 + (x2 - x1) * (by1 - y1) / (y2 - y1); - this.primaryDown = false; - this.upX = this.x; - this.upY = this.y; - this.upTime = event.timeStamp; + if (t >= bx1 && t <= bx2) + { + return true; + } + } + else if (y1 > by2 && y2 <= by2) + { + // Bottom edge + t = x1 + (x2 - x1) * (by2 - y1) / (y2 - y1); - this.isDown = false; + if (t >= bx1 && t <= bx2) + { + return true; + } + } - this.wasTouch = true; - this.wasCanceled = false; + return false; +}; - this.active = false; +module.exports = LineToRectangle; - this.updateMotion(); - }, - /** - * Internal method to handle a Touch Cancel Event. - * - * @method Phaser.Input.Pointer#touchcancel - * @private - * @since 3.15.0 - * - * @param {Touch} touch - The Changed Touch from the Touch Event. - * @param {TouchEvent} event - The full Touch Event. - */ - touchcancel: function (touch, event) - { - this.buttons = 0; +/***/ }), - this.event = event; +/***/ 34426: +/***/ ((module) => { - this.upElement = touch.target; +/** + * @author Richard Davey + * @author Florian Mertens + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Sets the local x/y properties - this.manager.transformPointer(this, touch.pageX, touch.pageY, false); +/** + * Checks if the a Point falls between the two end-points of a Line, based on the given line thickness. + * + * Assumes that the line end points are circular, not square. + * + * @function Phaser.Geom.Intersects.PointToLine + * @since 3.0.0 + * + * @param {(Phaser.Geom.Point|any)} point - The point, or point-like object to check. + * @param {Phaser.Geom.Line} line - The line segment to test for intersection on. + * @param {number} [lineThickness=1] - The line thickness. Assumes that the line end points are circular. + * + * @return {boolean} `true` if the Point falls on the Line, otherwise `false`. + */ +var PointToLine = function (point, line, lineThickness) +{ + if (lineThickness === undefined) { lineThickness = 1; } - this.primaryDown = false; - this.upX = this.x; - this.upY = this.y; - this.upTime = event.timeStamp; + var x1 = line.x1; + var y1 = line.y1; - this.isDown = false; + var x2 = line.x2; + var y2 = line.y2; - this.wasTouch = true; - this.wasCanceled = true; + var px = point.x; + var py = point.y; - this.active = false; - }, + var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); - /** - * Checks to see if any buttons are being held down on this Pointer. - * - * @method Phaser.Input.Pointer#noButtonDown - * @since 3.0.0 - * - * @return {boolean} `true` if no buttons are being held down. - */ - noButtonDown: function () + if (L2 === 0) { - return (this.buttons === 0); - }, + return false; + } - /** - * Checks to see if the left button is being held down on this Pointer. - * - * @method Phaser.Input.Pointer#leftButtonDown - * @since 3.0.0 - * - * @return {boolean} `true` if the left button is being held down. - */ - leftButtonDown: function () - { - return (this.buttons & 1) ? true : false; - }, + var r = (((px - x1) * (x2 - x1)) + ((py - y1) * (y2 - y1))) / L2; - /** - * Checks to see if the right button is being held down on this Pointer. - * - * @method Phaser.Input.Pointer#rightButtonDown - * @since 3.0.0 - * - * @return {boolean} `true` if the right button is being held down. - */ - rightButtonDown: function () + // Assume line thickness is circular + if (r < 0) { - return (this.buttons & 2) ? true : false; - }, - - /** - * Checks to see if the middle button is being held down on this Pointer. - * - * @method Phaser.Input.Pointer#middleButtonDown - * @since 3.0.0 - * - * @return {boolean} `true` if the middle button is being held down. - */ - middleButtonDown: function () + // Outside line1 + return (Math.sqrt(((x1 - px) * (x1 - px)) + ((y1 - py) * (y1 - py))) <= lineThickness); + } + else if ((r >= 0) && (r <= 1)) { - return (this.buttons & 4) ? true : false; - }, + // On the line segment + var s = (((y1 - py) * (x2 - x1)) - ((x1 - px) * (y2 - y1))) / L2; - /** - * Checks to see if the back button is being held down on this Pointer. - * - * @method Phaser.Input.Pointer#backButtonDown - * @since 3.0.0 - * - * @return {boolean} `true` if the back button is being held down. - */ - backButtonDown: function () + return (Math.abs(s) * Math.sqrt(L2) <= lineThickness); + } + else { - return (this.buttons & 8) ? true : false; - }, + // Outside line2 + return (Math.sqrt(((x2 - px) * (x2 - px)) + ((y2 - py) * (y2 - py))) <= lineThickness); + } +}; - /** - * Checks to see if the forward button is being held down on this Pointer. - * - * @method Phaser.Input.Pointer#forwardButtonDown - * @since 3.0.0 - * - * @return {boolean} `true` if the forward button is being held down. - */ - forwardButtonDown: function () - { - return (this.buttons & 16) ? true : false; - }, +module.exports = PointToLine; - /** - * Checks to see if the left button was just released on this Pointer. - * - * @method Phaser.Input.Pointer#leftButtonReleased - * @since 3.18.0 - * - * @return {boolean} `true` if the left button was just released. - */ - leftButtonReleased: function () - { - return (this.button === 0 && !this.isDown); - }, - /** - * Checks to see if the right button was just released on this Pointer. - * - * @method Phaser.Input.Pointer#rightButtonReleased - * @since 3.18.0 - * - * @return {boolean} `true` if the right button was just released. - */ - rightButtonReleased: function () - { - return (this.button === 2 && !this.isDown); - }, +/***/ }), - /** - * Checks to see if the middle button was just released on this Pointer. - * - * @method Phaser.Input.Pointer#middleButtonReleased - * @since 3.18.0 - * - * @return {boolean} `true` if the middle button was just released. - */ - middleButtonReleased: function () +/***/ 81414: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var PointToLine = __webpack_require__(34426); + +/** + * Checks if a Point is located on the given line segment. + * + * @function Phaser.Geom.Intersects.PointToLineSegment + * @since 3.0.0 + * + * @param {Phaser.Geom.Point} point - The Point to check for intersection. + * @param {Phaser.Geom.Line} line - The line segment to check for intersection. + * + * @return {boolean} `true` if the Point is on the given line segment, otherwise `false`. + */ +var PointToLineSegment = function (point, line) +{ + if (!PointToLine(point, line)) { - return (this.button === 1 && !this.isDown); - }, + return false; + } - /** - * Checks to see if the back button was just released on this Pointer. - * - * @method Phaser.Input.Pointer#backButtonReleased - * @since 3.18.0 - * - * @return {boolean} `true` if the back button was just released. - */ - backButtonReleased: function () + var xMin = Math.min(line.x1, line.x2); + var xMax = Math.max(line.x1, line.x2); + var yMin = Math.min(line.y1, line.y2); + var yMax = Math.max(line.y1, line.y2); + + return ((point.x >= xMin && point.x <= xMax) && (point.y >= yMin && point.y <= yMax)); +}; + +module.exports = PointToLineSegment; + + +/***/ }), + +/***/ 90205: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Checks if two Rectangles intersect. + * + * A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. + * As such, the two Rectangles are considered "solid". + * A Rectangle with no width or no height will never intersect another Rectangle. + * + * @function Phaser.Geom.Intersects.RectangleToRectangle + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check for intersection. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check for intersection. + * + * @return {boolean} `true` if the two Rectangles intersect, otherwise `false`. + */ +var RectangleToRectangle = function (rectA, rectB) +{ + if (rectA.width <= 0 || rectA.height <= 0 || rectB.width <= 0 || rectB.height <= 0) { - return (this.button === 3 && !this.isDown); - }, + return false; + } - /** - * Checks to see if the forward button was just released on this Pointer. - * - * @method Phaser.Input.Pointer#forwardButtonReleased - * @since 3.18.0 - * - * @return {boolean} `true` if the forward button was just released. - */ - forwardButtonReleased: function () + return !(rectA.right < rectB.x || rectA.bottom < rectB.y || rectA.x > rectB.right || rectA.y > rectB.bottom); +}; + +module.exports = RectangleToRectangle; + + +/***/ }), + +/***/ 20370: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var LineToLine = __webpack_require__(25227); +var Contains = __webpack_require__(94287); +var ContainsArray = __webpack_require__(86875); +var Decompose = __webpack_require__(87279); + +/** + * Checks for intersection between Rectangle shape and Triangle shape. + * + * @function Phaser.Geom.Intersects.RectangleToTriangle + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - Rectangle object to test. + * @param {Phaser.Geom.Triangle} triangle - Triangle object to test. + * + * @return {boolean} A value of `true` if objects intersect; otherwise `false`. + */ +var RectangleToTriangle = function (rect, triangle) +{ + // First the cheapest ones: + + if ( + triangle.left > rect.right || + triangle.right < rect.left || + triangle.top > rect.bottom || + triangle.bottom < rect.top) { - return (this.button === 4 && !this.isDown); - }, + return false; + } - /** - * If the Pointer has a button pressed down at the time this method is called, it will return the - * distance between the Pointer's `downX` and `downY` values and the current position. - * - * If no button is held down, it will return the last recorded distance, based on where - * the Pointer was when the button was released. - * - * If you wish to get the distance being travelled currently, based on the velocity of the Pointer, - * then see the `Pointer.distance` property. - * - * @method Phaser.Input.Pointer#getDistance - * @since 3.13.0 - * - * @return {number} The distance the Pointer moved. - */ - getDistance: function () + var triA = triangle.getLineA(); + var triB = triangle.getLineB(); + var triC = triangle.getLineC(); + + // Are any of the triangle points within the rectangle? + + if (Contains(rect, triA.x1, triA.y1) || Contains(rect, triA.x2, triA.y2)) { - if (this.isDown) - { - return Distance(this.downX, this.downY, this.x, this.y); - } - else - { - return Distance(this.downX, this.downY, this.upX, this.upY); - } - }, + return true; + } - /** - * If the Pointer has a button pressed down at the time this method is called, it will return the - * horizontal distance between the Pointer's `downX` and `downY` values and the current position. - * - * If no button is held down, it will return the last recorded horizontal distance, based on where - * the Pointer was when the button was released. - * - * @method Phaser.Input.Pointer#getDistanceX - * @since 3.16.0 - * - * @return {number} The horizontal distance the Pointer moved. - */ - getDistanceX: function () + if (Contains(rect, triB.x1, triB.y1) || Contains(rect, triB.x2, triB.y2)) { - if (this.isDown) - { - return Math.abs(this.downX - this.x); - } - else - { - return Math.abs(this.downX - this.upX); - } - }, + return true; + } - /** - * If the Pointer has a button pressed down at the time this method is called, it will return the - * vertical distance between the Pointer's `downX` and `downY` values and the current position. - * - * If no button is held down, it will return the last recorded vertical distance, based on where - * the Pointer was when the button was released. - * - * @method Phaser.Input.Pointer#getDistanceY - * @since 3.16.0 - * - * @return {number} The vertical distance the Pointer moved. - */ - getDistanceY: function () + if (Contains(rect, triC.x1, triC.y1) || Contains(rect, triC.x2, triC.y2)) { - if (this.isDown) - { - return Math.abs(this.downY - this.y); - } - else - { - return Math.abs(this.downY - this.upY); - } - }, + return true; + } - /** - * If the Pointer has a button pressed down at the time this method is called, it will return the - * duration since the button was pressed down. - * - * If no button is held down, it will return the last recorded duration, based on the time - * the last button on the Pointer was released. - * - * @method Phaser.Input.Pointer#getDuration - * @since 3.16.0 - * - * @return {number} The duration the Pointer was held down for in milliseconds. - */ - getDuration: function () + // Cheap tests over, now to see if any of the lines intersect ... + + var rectA = rect.getLineA(); + var rectB = rect.getLineB(); + var rectC = rect.getLineC(); + var rectD = rect.getLineD(); + + if (LineToLine(triA, rectA) || LineToLine(triA, rectB) || LineToLine(triA, rectC) || LineToLine(triA, rectD)) { - if (this.isDown) - { - return (this.manager.time - this.downTime); - } - else - { - return (this.upTime - this.downTime); - } - }, + return true; + } - /** - * If the Pointer has a button pressed down at the time this method is called, it will return the - * angle between the Pointer's `downX` and `downY` values and the current position. - * - * If no button is held down, it will return the last recorded angle, based on where - * the Pointer was when the button was released. - * - * The angle is based on the old position facing to the current position. - * - * If you wish to get the current angle, based on the velocity of the Pointer, then - * see the `Pointer.angle` property. - * - * @method Phaser.Input.Pointer#getAngle - * @since 3.16.0 - * - * @return {number} The angle between the Pointer's coordinates in radians. - */ - getAngle: function () + if (LineToLine(triB, rectA) || LineToLine(triB, rectB) || LineToLine(triB, rectC) || LineToLine(triB, rectD)) { - if (this.isDown) - { - return Angle(this.downX, this.downY, this.x, this.y); - } - else - { - return Angle(this.downX, this.downY, this.upX, this.upY); - } - }, + return true; + } - /** - * Takes the previous and current Pointer positions and then generates an array of interpolated values between - * the two. The array will be populated up to the size of the `steps` argument. - * - * ```javaScript - * var points = pointer.getInterpolatedPosition(4); - * - * // points[0] = { x: 0, y: 0 } - * // points[1] = { x: 2, y: 1 } - * // points[2] = { x: 3, y: 2 } - * // points[3] = { x: 6, y: 3 } - * ``` - * - * Use this if you need to get smoothed values between the previous and current pointer positions. DOM pointer - * events can often fire faster than the main browser loop, and this will help you avoid janky movement - * especially if you have an object following a Pointer. - * - * Note that if you provide an output array it will only be populated up to the number of steps provided. - * It will not clear any previous data that may have existed beyond the range of the steps count. - * - * Internally it uses the Smooth Step interpolation calculation. - * - * @method Phaser.Input.Pointer#getInterpolatedPosition - * @since 3.11.0 - * - * @param {number} [steps=10] - The number of interpolation steps to use. - * @param {array} [out] - An array to store the results in. If not provided a new one will be created. - * - * @return {array} An array of interpolated values. - */ - getInterpolatedPosition: function (steps, out) + if (LineToLine(triC, rectA) || LineToLine(triC, rectB) || LineToLine(triC, rectC) || LineToLine(triC, rectD)) { - if (steps === undefined) { steps = 10; } - if (out === undefined) { out = []; } + return true; + } - var prevX = this.prevPosition.x; - var prevY = this.prevPosition.y; + // None of the lines intersect, so are any rectangle points within the triangle? - var curX = this.position.x; - var curY = this.position.y; + var points = Decompose(rect); + var within = ContainsArray(triangle, points, true); - for (var i = 0; i < steps; i++) - { - var t = (1 / steps) * i; + return (within.length > 0); +}; - out[i] = { x: SmoothStepInterpolation(t, prevX, curX), y: SmoothStepInterpolation(t, prevY, curY) }; - } +module.exports = RectangleToTriangle; - return out; - }, - /** - * Destroys this Pointer instance and resets its external references. - * - * @method Phaser.Input.Pointer#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.camera = null; - this.manager = null; - this.position = null; - }, +/***/ }), - /** - * The x position of this Pointer. - * The value is in screen space. - * See `worldX` to get a camera converted position. - * - * @name Phaser.Input.Pointer#x - * @type {number} - * @since 3.0.0 - */ - x: { +/***/ 8786: +/***/ ((module) => { - get: function () - { - return this.position.x; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - set: function (value) - { - this.position.x = value; - } +/** + * Check if rectangle intersects with values. + * + * @function Phaser.Geom.Intersects.RectangleToValues + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - The rectangle object + * @param {number} left - The x coordinate of the left of the Rectangle. + * @param {number} right - The x coordinate of the right of the Rectangle. + * @param {number} top - The y coordinate of the top of the Rectangle. + * @param {number} bottom - The y coordinate of the bottom of the Rectangle. + * @param {number} [tolerance=0] - Tolerance allowed in the calculation, expressed in pixels. + * + * @return {boolean} Returns true if there is an intersection. + */ +var RectangleToValues = function (rect, left, right, top, bottom, tolerance) +{ + if (tolerance === undefined) { tolerance = 0; } - }, + return !( + left > rect.right + tolerance || + right < rect.left - tolerance || + top > rect.bottom + tolerance || + bottom < rect.top - tolerance + ); +}; - /** - * The y position of this Pointer. - * The value is in screen space. - * See `worldY` to get a camera converted position. - * - * @name Phaser.Input.Pointer#y - * @type {number} - * @since 3.0.0 - */ - y: { +module.exports = RectangleToValues; - get: function () - { - return this.position.y; - }, - set: function (value) - { - this.position.y = value; - } +/***/ }), - }, +/***/ 48411: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Time when this Pointer was most recently updated by a DOM Event. - * This comes directly from the `event.timeStamp` property. - * If no event has yet taken place, it will return zero. - * - * @name Phaser.Input.Pointer#time - * @type {number} - * @readonly - * @since 3.16.0 - */ - time: { +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - get: function () - { - return (this.event) ? this.event.timeStamp : 0; - } +var LineToCircle = __webpack_require__(61472); +var Contains = __webpack_require__(60689); + +/** + * Checks if a Triangle and a Circle intersect. + * + * A Circle intersects a Triangle if its center is located within it or if any of the Triangle's sides intersect the Circle. As such, the Triangle and the Circle are considered "solid" for the intersection. + * + * @function Phaser.Geom.Intersects.TriangleToCircle + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check for intersection. + * @param {Phaser.Geom.Circle} circle - The Circle to check for intersection. + * + * @return {boolean} `true` if the Triangle and the `Circle` intersect, otherwise `false`. + */ +var TriangleToCircle = function (triangle, circle) +{ + // First the cheapest ones: + if ( + triangle.left > circle.right || + triangle.right < circle.left || + triangle.top > circle.bottom || + triangle.bottom < circle.top) + { + return false; } -}); + if (Contains(triangle, circle.x, circle.y)) + { + return true; + } -module.exports = Pointer; + if (LineToCircle(triangle.getLineA(), circle)) + { + return true; + } + + if (LineToCircle(triangle.getLineB(), circle)) + { + return true; + } + + if (LineToCircle(triangle.getLineC(), circle)) + { + return true; + } + + return false; +}; + +module.exports = TriangleToCircle; /***/ }), -/* 413 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 86117: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var InputEvents = __webpack_require__(51); -var NOOP = __webpack_require__(1); - -// https://developer.mozilla.org/en-US/docs/Web/API/Touch_events -// https://patrickhlauke.github.io/touch/tests/results/ -// https://www.html5rocks.com/en/mobile/touch/ +var LineToLine = __webpack_require__(25227); /** - * @classdesc - * The Touch Manager is a helper class that belongs to the Input Manager. - * - * Its role is to listen for native DOM Touch Events and then pass them onto the Input Manager for further processing. - * - * You do not need to create this class directly, the Input Manager will create an instance of it automatically. + * Checks if a Triangle and a Line intersect. * - * @class TouchManager - * @memberof Phaser.Input.Touch - * @constructor + * The Line intersects the Triangle if it starts inside of it, ends inside of it, or crosses any of the Triangle's sides. Thus, the Triangle is considered "solid". + * + * @function Phaser.Geom.Intersects.TriangleToLine * @since 3.0.0 * - * @param {Phaser.Input.InputManager} inputManager - A reference to the Input Manager. + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check with. + * @param {Phaser.Geom.Line} line - The Line to check with. + * + * @return {boolean} `true` if the Triangle and the Line intersect, otherwise `false`. */ -var TouchManager = new Class({ - - initialize: +var TriangleToLine = function (triangle, line) +{ + // If the Triangle contains either the start or end point of the line, it intersects + if (triangle.contains(line.x1, line.y1) || triangle.contains(line.x2, line.y2)) + { + return true; + } - function TouchManager (inputManager) + // Now check the line against each line of the Triangle + if (LineToLine(triangle.getLineA(), line)) { - /** - * A reference to the Input Manager. - * - * @name Phaser.Input.Touch.TouchManager#manager - * @type {Phaser.Input.InputManager} - * @since 3.0.0 - */ - this.manager = inputManager; + return true; + } - /** - * If true the DOM events will have event.preventDefault applied to them, if false they will propagate fully. - * - * @name Phaser.Input.Touch.TouchManager#capture - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.capture = true; + if (LineToLine(triangle.getLineB(), line)) + { + return true; + } - /** - * A boolean that controls if the Touch Manager is enabled or not. - * Can be toggled on the fly. - * - * @name Phaser.Input.Touch.TouchManager#enabled - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.enabled = false; + if (LineToLine(triangle.getLineC(), line)) + { + return true; + } - /** - * The Touch Event target, as defined in the Game Config. - * Typically the canvas to which the game is rendering, but can be any interactive DOM element. - * - * @name Phaser.Input.Touch.TouchManager#target - * @type {any} - * @since 3.0.0 - */ - this.target; + return false; +}; - /** - * The Touch Start event handler function. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Touch.TouchManager#onTouchStart - * @type {function} - * @since 3.0.0 - */ - this.onTouchStart = NOOP; +module.exports = TriangleToLine; - /** - * The Touch Start event handler function specifically for events on the Window. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Touch.TouchManager#onTouchStartWindow - * @type {function} - * @since 3.17.0 - */ - this.onTouchStartWindow = NOOP; - /** - * The Touch Move event handler function. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Touch.TouchManager#onTouchMove - * @type {function} - * @since 3.0.0 - */ - this.onTouchMove = NOOP; +/***/ }), - /** - * The Touch End event handler function. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Touch.TouchManager#onTouchEnd - * @type {function} - * @since 3.0.0 - */ - this.onTouchEnd = NOOP; +/***/ 23589: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The Touch End event handler function specifically for events on the Window. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Touch.TouchManager#onTouchEndWindow - * @type {function} - * @since 3.17.0 - */ - this.onTouchEndWindow = NOOP; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The Touch Cancel event handler function. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Touch.TouchManager#onTouchCancel - * @type {function} - * @since 3.15.0 - */ - this.onTouchCancel = NOOP; +var ContainsArray = __webpack_require__(86875); +var Decompose = __webpack_require__(18680); +var LineToLine = __webpack_require__(25227); - /** - * The Touch Cancel event handler function specifically for events on the Window. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Touch.TouchManager#onTouchCancelWindow - * @type {function} - * @since 3.18.0 - */ - this.onTouchCancelWindow = NOOP; +/** + * Checks if two Triangles intersect. + * + * A Triangle intersects another Triangle if any pair of their lines intersects or if any point of one Triangle is within the other Triangle. Thus, the Triangles are considered "solid". + * + * @function Phaser.Geom.Intersects.TriangleToTriangle + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangleA - The first Triangle to check for intersection. + * @param {Phaser.Geom.Triangle} triangleB - The second Triangle to check for intersection. + * + * @return {boolean} `true` if the Triangles intersect, otherwise `false`. + */ +var TriangleToTriangle = function (triangleA, triangleB) +{ + // First the cheapest ones: - /** - * The Touch Over event handler function. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Touch.TouchManager#onTouchOver - * @type {function} - * @since 3.16.0 - */ - this.onTouchOver = NOOP; + if ( + triangleA.left > triangleB.right || + triangleA.right < triangleB.left || + triangleA.top > triangleB.bottom || + triangleA.bottom < triangleB.top) + { + return false; + } - /** - * The Touch Out event handler function. - * Initially empty and bound in the `startListeners` method. - * - * @name Phaser.Input.Touch.TouchManager#onTouchOut - * @type {function} - * @since 3.16.0 - */ - this.onTouchOut = NOOP; + var lineAA = triangleA.getLineA(); + var lineAB = triangleA.getLineB(); + var lineAC = triangleA.getLineC(); - inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); - }, + var lineBA = triangleB.getLineA(); + var lineBB = triangleB.getLineB(); + var lineBC = triangleB.getLineC(); - /** - * The Touch Manager boot process. - * - * @method Phaser.Input.Touch.TouchManager#boot - * @private - * @since 3.0.0 - */ - boot: function () + // Now check the lines against each line of TriangleB + if (LineToLine(lineAA, lineBA) || LineToLine(lineAA, lineBB) || LineToLine(lineAA, lineBC)) { - var config = this.manager.config; + return true; + } - this.enabled = config.inputTouch; - this.target = config.inputTouchEventTarget; - this.capture = config.inputTouchCapture; + if (LineToLine(lineAB, lineBA) || LineToLine(lineAB, lineBB) || LineToLine(lineAB, lineBC)) + { + return true; + } - if (!this.target) - { - this.target = this.manager.game.canvas; - } + if (LineToLine(lineAC, lineBA) || LineToLine(lineAC, lineBB) || LineToLine(lineAC, lineBC)) + { + return true; + } - if (config.disableContextMenu) - { - this.disableContextMenu(); - } + // Nope, so check to see if any of the points of triangleA are within triangleB - if (this.enabled && this.target) - { - this.startListeners(); - } - }, + var points = Decompose(triangleA); + var within = ContainsArray(triangleB, points, true); - /** - * Attempts to disable the context menu from appearing if you touch-hold on the browser. - * - * Works by listening for the `contextmenu` event and prevent defaulting it. - * - * Use this if you need to disable the OS context menu on mobile. - * - * @method Phaser.Input.Touch.TouchManager#disableContextMenu - * @since 3.20.0 - * - * @return {this} This Touch Manager instance. - */ - disableContextMenu: function () + if (within.length > 0) { - document.body.addEventListener('contextmenu', function (event) - { - event.preventDefault(); - return false; - }); + return true; + } - return this; - }, + // Finally check to see if any of the points of triangleB are within triangleA - /** - * Starts the Touch Event listeners running as long as an input target is set. - * - * This method is called automatically if Touch Input is enabled in the game config, - * which it is by default. However, you can call it manually should you need to - * delay input capturing until later in the game. - * - * @method Phaser.Input.Touch.TouchManager#startListeners - * @since 3.0.0 - */ - startListeners: function () + points = Decompose(triangleB); + within = ContainsArray(triangleA, points, true); + + if (within.length > 0) { - var _this = this; - var canvas = this.manager.canvas; - var autoFocus = (window && window.focus && this.manager.game.config.autoFocus); + return true; + } - this.onTouchStart = function (event) - { - if (autoFocus) - { - window.focus(); - } + return false; +}; - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) - { - _this.manager.onTouchStart(event); - - if (_this.capture && event.cancelable && event.target === canvas) - { - event.preventDefault(); - } - } - }; +module.exports = TriangleToTriangle; - this.onTouchStartWindow = function (event) - { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled && event.target !== canvas) - { - // Only process the event if the target isn't the canvas - _this.manager.onTouchStart(event); - } - }; - this.onTouchMove = function (event) - { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) - { - _this.manager.onTouchMove(event); - - if (_this.capture && event.cancelable) - { - event.preventDefault(); - } - } - }; +/***/ }), - this.onTouchEnd = function (event) - { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) - { - _this.manager.onTouchEnd(event); - - if (_this.capture && event.cancelable && event.target === canvas) - { - event.preventDefault(); - } - } - }; +/***/ 7563: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.onTouchEndWindow = function (event) - { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled && event.target !== canvas) - { - // Only process the event if the target isn't the canvas - _this.manager.onTouchEnd(event); - } - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.onTouchCancel = function (event) - { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) - { - _this.manager.onTouchCancel(event); - - if (_this.capture) - { - event.preventDefault(); - } - } - }; +/** + * @namespace Phaser.Geom.Intersects + */ - this.onTouchCancelWindow = function (event) - { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) - { - _this.manager.onTouchCancel(event); - } - }; +module.exports = { - this.onTouchOver = function (event) - { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) - { - _this.manager.setCanvasOver(event); - } - }; + CircleToCircle: __webpack_require__(22184), + CircleToRectangle: __webpack_require__(26535), + GetCircleToCircle: __webpack_require__(71145), + GetCircleToRectangle: __webpack_require__(62508), + GetLineToCircle: __webpack_require__(26111), + GetLineToLine: __webpack_require__(96537), + GetLineToPoints: __webpack_require__(17647), + GetLineToPolygon: __webpack_require__(68439), + GetLineToRectangle: __webpack_require__(9569), + GetRaysFromPointToPolygon: __webpack_require__(7449), + GetRectangleIntersection: __webpack_require__(82931), + GetRectangleToRectangle: __webpack_require__(1946), + GetRectangleToTriangle: __webpack_require__(34211), + GetTriangleToCircle: __webpack_require__(80511), + GetTriangleToLine: __webpack_require__(31343), + GetTriangleToTriangle: __webpack_require__(70534), + LineToCircle: __webpack_require__(61472), + LineToLine: __webpack_require__(25227), + LineToRectangle: __webpack_require__(47910), + PointToLine: __webpack_require__(34426), + PointToLineSegment: __webpack_require__(81414), + RectangleToRectangle: __webpack_require__(90205), + RectangleToTriangle: __webpack_require__(20370), + RectangleToValues: __webpack_require__(8786), + TriangleToCircle: __webpack_require__(48411), + TriangleToLine: __webpack_require__(86117), + TriangleToTriangle: __webpack_require__(23589) - this.onTouchOut = function (event) - { - if (!event.defaultPrevented && _this.enabled && _this.manager && _this.manager.enabled) - { - _this.manager.setCanvasOut(event); - } - }; +}; - var target = this.target; - if (!target) - { - return; - } +/***/ }), - var passive = { passive: true }; - var nonPassive = { passive: false }; +/***/ 50599: +/***/ ((module) => { - target.addEventListener('touchstart', this.onTouchStart, (this.capture) ? nonPassive : passive); - target.addEventListener('touchmove', this.onTouchMove, (this.capture) ? nonPassive : passive); - target.addEventListener('touchend', this.onTouchEnd, (this.capture) ? nonPassive : passive); - target.addEventListener('touchcancel', this.onTouchCancel, (this.capture) ? nonPassive : passive); - target.addEventListener('touchover', this.onTouchOver, (this.capture) ? nonPassive : passive); - target.addEventListener('touchout', this.onTouchOut, (this.capture) ? nonPassive : passive); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (window && this.manager.game.config.inputWindowEvents) - { - window.addEventListener('touchstart', this.onTouchStartWindow, nonPassive); - window.addEventListener('touchend', this.onTouchEndWindow, nonPassive); - window.addEventListener('touchcancel', this.onTouchCancelWindow, nonPassive); - } +/** + * Calculate the angle of the line in radians. + * + * @function Phaser.Geom.Line.Angle + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line to calculate the angle of. + * + * @return {number} The angle of the line, in radians. + */ +var Angle = function (line) +{ + return Math.atan2(line.y2 - line.y1, line.x2 - line.x1); +}; - this.enabled = true; - }, +module.exports = Angle; - /** - * Stops the Touch Event listeners. - * This is called automatically and does not need to be manually invoked. - * - * @method Phaser.Input.Touch.TouchManager#stopListeners - * @since 3.0.0 - */ - stopListeners: function () + +/***/ }), + +/***/ 58813: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Using Bresenham's line algorithm this will return an array of all coordinates on this line. + * + * The `start` and `end` points are rounded before this runs as the algorithm works on integers. + * + * @function Phaser.Geom.Line.BresenhamPoints + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line. + * @param {number} [stepRate=1] - The optional step rate for the points on the line. + * @param {Phaser.Types.Math.Vector2Like[]} [results] - An optional array to push the resulting coordinates into. + * + * @return {Phaser.Types.Math.Vector2Like[]} The array of coordinates on the line. + */ +var BresenhamPoints = function (line, stepRate, results) +{ + if (stepRate === undefined) { stepRate = 1; } + if (results === undefined) { results = []; } + + var x1 = Math.round(line.x1); + var y1 = Math.round(line.y1); + var x2 = Math.round(line.x2); + var y2 = Math.round(line.y2); + + var dx = Math.abs(x2 - x1); + var dy = Math.abs(y2 - y1); + var sx = (x1 < x2) ? 1 : -1; + var sy = (y1 < y2) ? 1 : -1; + var err = dx - dy; + + results.push({ x: x1, y: y1 }); + + var i = 1; + + while (!((x1 === x2) && (y1 === y2))) { - var target = this.target; + var e2 = err << 1; - target.removeEventListener('touchstart', this.onTouchStart); - target.removeEventListener('touchmove', this.onTouchMove); - target.removeEventListener('touchend', this.onTouchEnd); - target.removeEventListener('touchcancel', this.onTouchCancel); - target.removeEventListener('touchover', this.onTouchOver); - target.removeEventListener('touchout', this.onTouchOut); + if (e2 > -dy) + { + err -= dy; + x1 += sx; + } - if (window) + if (e2 < dx) { - window.removeEventListener('touchstart', this.onTouchStartWindow); - window.removeEventListener('touchend', this.onTouchEndWindow); + err += dx; + y1 += sy; } - }, - /** - * Destroys this Touch Manager instance. - * - * @method Phaser.Input.Touch.TouchManager#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.stopListeners(); + if (i % stepRate === 0) + { + results.push({ x: x1, y: y1 }); + } - this.target = null; - this.enabled = false; - this.manager = null; + i++; } -}); + return results; +}; -module.exports = TouchManager; +module.exports = BresenhamPoints; /***/ }), -/* 414 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 88513: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var GameEvents = __webpack_require__(22); -var EventEmitter = __webpack_require__(9); -var FileTypesManager = __webpack_require__(8); -var GameObjectCreator = __webpack_require__(16); -var GameObjectFactory = __webpack_require__(5); -var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(24); -var Remove = __webpack_require__(93); /** - * @classdesc - * The PluginManager is responsible for installing and adding plugins to Phaser. - * - * It is a global system and therefore belongs to the Game instance, not a specific Scene. - * - * It works in conjunction with the PluginCache. Core internal plugins automatically register themselves - * with the Cache, but it's the Plugin Manager that is responsible for injecting them into the Scenes. - * - * There are two types of plugin: - * - * 1. A Global Plugin - * 2. A Scene Plugin - * - * A Global Plugin is a plugin that lives within the Plugin Manager rather than a Scene. You can get - * access to it by calling `PluginManager.get` and providing a key. Any Scene that requests a plugin in - * this way will all get access to the same plugin instance, allowing you to use a single plugin across - * multiple Scenes. - * - * A Scene Plugin is a plugin dedicated to running within a Scene. These are different to Global Plugins - * in that their instances do not live within the Plugin Manager, but within the Scene Systems class instead. - * And that every Scene created is given its own unique instance of a Scene Plugin. Examples of core Scene - * Plugins include the Input Plugin, the Tween Plugin and the physics Plugins. - * - * You can add a plugin to Phaser in three different ways: - * - * 1. Preload it - * 2. Include it in your source code and install it via the Game Config - * 3. Include it in your source code and install it within a Scene - * - * For examples of all of these approaches please see the Phaser 3 Examples Repo `plugins` folder. - * - * For information on creating your own plugin please see the Phaser 3 Plugin Template. + * Center a line on the given coordinates. * - * @class PluginManager - * @memberof Phaser.Plugins - * @constructor + * @function Phaser.Geom.Line.CenterOn * @since 3.0.0 * - * @param {Phaser.Game} game - The game instance that owns this Plugin Manager. + * @param {Phaser.Geom.Line} line - The line to center. + * @param {number} x - The horizontal coordinate to center the line on. + * @param {number} y - The vertical coordinate to center the line on. + * + * @return {Phaser.Geom.Line} The centered line. */ -var PluginManager = new Class({ +var CenterOn = function (line, x, y) +{ + var tx = x - ((line.x1 + line.x2) / 2); + var ty = y - ((line.y1 + line.y2) / 2); - Extends: EventEmitter, + line.x1 += tx; + line.y1 += ty; - initialize: + line.x2 += tx; + line.y2 += ty; - function PluginManager (game) - { - EventEmitter.call(this); + return line; +}; - /** - * The game instance that owns this Plugin Manager. - * - * @name Phaser.Plugins.PluginManager#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; - - /** - * The global plugins currently running and managed by this Plugin Manager. - * A plugin must have been started at least once in order to appear in this list. - * - * @name Phaser.Plugins.PluginManager#plugins - * @type {Phaser.Types.Plugins.GlobalPlugin[]} - * @since 3.8.0 - */ - this.plugins = []; - - /** - * A list of plugin keys that should be installed into Scenes as well as the Core Plugins. - * - * @name Phaser.Plugins.PluginManager#scenePlugins - * @type {string[]} - * @since 3.8.0 - */ - this.scenePlugins = []; - - /** - * A temporary list of plugins to install when the game has booted. - * - * @name Phaser.Plugins.PluginManager#_pendingGlobal - * @private - * @type {array} - * @since 3.8.0 - */ - this._pendingGlobal = []; - - /** - * A temporary list of scene plugins to install when the game has booted. - * - * @name Phaser.Plugins.PluginManager#_pendingScene - * @private - * @type {array} - * @since 3.8.0 - */ - this._pendingScene = []; - - if (game.isBooted) - { - this.boot(); - } - else - { - game.events.once(GameEvents.BOOT, this.boot, this); - } - }, - - /** - * Run once the game has booted and installs all of the plugins configured in the Game Config. - * - * @method Phaser.Plugins.PluginManager#boot - * @protected - * @since 3.0.0 - */ - boot: function () - { - var i; - var entry; - var key; - var plugin; - var start; - var mapping; - var data; - var config = this.game.config; - - // Any plugins to install? - var list = config.installGlobalPlugins; - - // Any plugins added outside of the game config, but before the game booted? - list = list.concat(this._pendingGlobal); - - for (i = 0; i < list.length; i++) - { - entry = list[i]; +module.exports = CenterOn; - // { key: 'TestPlugin', plugin: TestPlugin, start: true, mapping: 'test', data: { msg: 'The plugin is alive' } } - key = GetFastValue(entry, 'key', null); - plugin = GetFastValue(entry, 'plugin', null); - start = GetFastValue(entry, 'start', false); - mapping = GetFastValue(entry, 'mapping', null); - data = GetFastValue(entry, 'data', null); +/***/ }), - if (key) - { - if (plugin) - { - this.install(key, plugin, start, mapping, data); - } - else - { - console.warn('Missing `plugin` for key: ' + key); - } +/***/ 26718: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Any scene plugins to install? - list = config.installScenePlugins; +var Line = __webpack_require__(88829); - // Any plugins added outside of the game config, but before the game booted? - list = list.concat(this._pendingScene); +/** + * Clone the given line. + * + * @function Phaser.Geom.Line.Clone + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} source - The source line to clone. + * + * @return {Phaser.Geom.Line} The cloned line. + */ +var Clone = function (source) +{ + return new Line(source.x1, source.y1, source.x2, source.y2); +}; - for (i = 0; i < list.length; i++) - { - entry = list[i]; +module.exports = Clone; - // { key: 'moveSpritePlugin', plugin: MoveSpritePlugin, , mapping: 'move' } - key = GetFastValue(entry, 'key', null); - plugin = GetFastValue(entry, 'plugin', null); - mapping = GetFastValue(entry, 'mapping', null); +/***/ }), - if (key) - { - if (plugin) - { - this.installScenePlugin(key, plugin, mapping); - } - else - { - console.warn('Missing `plugin` for key: ' + key); - } - } - } +/***/ 88930: +/***/ ((module) => { - this._pendingGlobal = []; - this._pendingScene = []; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.game.events.once(GameEvents.DESTROY, this.destroy, this); - }, +/** + * Copy the values of one line to a destination line. + * + * @function Phaser.Geom.Line.CopyFrom + * @since 3.0.0 + * + * @generic {Phaser.Geom.Line} O - [dest,$return] + * + * @param {Phaser.Geom.Line} source - The source line to copy the values from. + * @param {Phaser.Geom.Line} dest - The destination line to copy the values to. + * + * @return {Phaser.Geom.Line} The destination line. + */ +var CopyFrom = function (source, dest) +{ + return dest.setTo(source.x1, source.y1, source.x2, source.y2); +}; - /** - * Called by the Scene Systems class. Tells the plugin manager to install all Scene plugins into it. - * - * First it will install global references, i.e. references from the Game systems into the Scene Systems (and Scene if mapped.) - * Then it will install Core Scene Plugins followed by Scene Plugins registered with the PluginManager. - * Finally it will install any references to Global Plugins that have a Scene mapping property into the Scene itself. - * - * @method Phaser.Plugins.PluginManager#addToScene - * @protected - * @since 3.8.0 - * - * @param {Phaser.Scenes.Systems} sys - The Scene Systems class to install all the plugins in to. - * @param {array} globalPlugins - An array of global plugins to install. - * @param {array} scenePlugins - An array of scene plugins to install. - */ - addToScene: function (sys, globalPlugins, scenePlugins) - { - var i; - var pluginKey; - var pluginList; - var game = this.game; - var scene = sys.scene; - var map = sys.settings.map; - var isBooted = sys.settings.isBooted; +module.exports = CopyFrom; - // Reference the GlobalPlugins from Game into Scene.Systems - for (i = 0; i < globalPlugins.length; i++) - { - pluginKey = globalPlugins[i]; - if (game[pluginKey]) - { - sys[pluginKey] = game[pluginKey]; +/***/ }), - // Scene level injection - if (map.hasOwnProperty(pluginKey)) - { - scene[map[pluginKey]] = sys[pluginKey]; - } - } - else if (pluginKey === 'game' && map.hasOwnProperty(pluginKey)) - { - scene[map[pluginKey]] = game; - } - } +/***/ 90656: +/***/ ((module) => { - for (var s = 0; s < scenePlugins.length; s++) - { - pluginList = scenePlugins[s]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - for (i = 0; i < pluginList.length; i++) - { - pluginKey = pluginList[i]; +/** + * Compare two lines for strict equality. + * + * @function Phaser.Geom.Line.Equals + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The first line to compare. + * @param {Phaser.Geom.Line} toCompare - The second line to compare. + * + * @return {boolean} Whether the two lines are equal. + */ +var Equals = function (line, toCompare) +{ + return ( + line.x1 === toCompare.x1 && + line.y1 === toCompare.y1 && + line.x2 === toCompare.x2 && + line.y2 === toCompare.y2 + ); +}; - if (!PluginCache.hasCore(pluginKey)) - { - continue; - } +module.exports = Equals; - var source = PluginCache.getCore(pluginKey); - var mapKey = source.mapping; +/***/ }), - var plugin = new source.plugin(scene, this, mapKey); +/***/ 30897: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - sys[mapKey] = plugin; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Scene level injection - if (source.custom) - { - scene[mapKey] = plugin; - } - else if (map.hasOwnProperty(mapKey)) - { - scene[map[mapKey]] = plugin; - } +var Length = __webpack_require__(16028); - // Scene is already booted, usually because this method is being called at run-time, so boot the plugin - if (isBooted) - { - plugin.boot(); - } - } - } +/** + * Extends the start and end points of a Line by the given amounts. + * + * The amounts can be positive or negative. Positive points will increase the length of the line, + * while negative ones will decrease it. + * + * If no `right` value is provided it will extend the length of the line equally in both directions. + * + * Pass a value of zero to leave the start or end point unchanged. + * + * @function Phaser.Geom.Line.Extend + * @since 3.16.0 + * + * @param {Phaser.Geom.Line} line - The line instance to extend. + * @param {number} left - The amount to extend the start of the line by. + * @param {number} [right] - The amount to extend the end of the line by. If not given it will be set to the `left` value. + * + * @return {Phaser.Geom.Line} The modified Line instance. + */ +var Extend = function (line, left, right) +{ + if (right === undefined) { right = left; } - // And finally, inject any 'global scene plugins' - pluginList = this.plugins; + var length = Length(line); - for (i = 0; i < pluginList.length; i++) - { - var entry = pluginList[i]; + var slopX = line.x2 - line.x1; + var slopY = line.y2 - line.y1; - if (entry.mapping) - { - scene[entry.mapping] = entry.plugin; - } - } - }, + if (left) + { + line.x1 = line.x1 - slopX / length * left; + line.y1 = line.y1 - slopY / length * left; + } - /** - * Called by the Scene Systems class. Returns a list of plugins to be installed. - * - * @method Phaser.Plugins.PluginManager#getDefaultScenePlugins - * @protected - * @since 3.8.0 - * - * @return {string[]} A list keys of all the Scene Plugins to install. - */ - getDefaultScenePlugins: function () + if (right) { - var list = this.game.config.defaultPlugins; + line.x2 = line.x2 + slopX / length * right; + line.y2 = line.y2 + slopY / length * right; + } - // Merge in custom Scene plugins - list = list.concat(this.scenePlugins); + return line; +}; - return list; - }, +module.exports = Extend; - /** - * Installs a new Scene Plugin into the Plugin Manager and optionally adds it - * to the given Scene as well. A Scene Plugin added to the manager in this way - * will be automatically installed into all new Scenes using the key and mapping given. - * - * The `key` property is what the plugin is injected into Scene.Systems as. - * The `mapping` property is optional, and if specified is what the plugin is installed into - * the Scene as. For example: - * - * ```javascript - * this.plugins.installScenePlugin('powerupsPlugin', pluginCode, 'powerups'); - * - * // and from within the scene: - * this.sys.powerupsPlugin; // key value - * this.powerups; // mapping value - * ``` - * - * This method is called automatically by Phaser if you install your plugins using either the - * Game Configuration object, or by preloading them via the Loader. - * - * @method Phaser.Plugins.PluginManager#installScenePlugin - * @since 3.8.0 - * - * @param {string} key - The property key that will be used to add this plugin to Scene.Systems. - * @param {function} plugin - The plugin code. This should be the non-instantiated version. - * @param {string} [mapping] - If this plugin is injected into the Phaser.Scene class, this is the property key to use. - * @param {Phaser.Scene} [addToScene] - Optionally automatically add this plugin to the given Scene. - * @param {boolean} [fromLoader=false] - Is this being called by the Loader? - */ - installScenePlugin: function (key, plugin, mapping, addToScene, fromLoader) - { - if (fromLoader === undefined) { fromLoader = false; } - if (typeof plugin !== 'function') - { - console.warn('Invalid Scene Plugin: ' + key); - return; - } +/***/ }), - if (!PluginCache.hasCore(key)) - { - // Plugin is freshly loaded - PluginCache.register(key, plugin, mapping, true); +/***/ 30684: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.scenePlugins.push(key); - } - else if (!fromLoader && PluginCache.hasCore(key)) - { - // Plugin wasn't from the loader but already exists - console.warn('Scene Plugin key in use: ' + key); - return; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (addToScene) - { - var instance = new plugin(addToScene, this, key); +var DistanceBetweenPoints = __webpack_require__(92951); +var GetEaseFunction = __webpack_require__(21902); +var Point = __webpack_require__(79967); - addToScene.sys[key] = instance; +/** + * Returns an array of `quantity` Points where each point is taken from the given Line, + * spaced out according to the ease function specified. + * + * ```javascript + * const line = new Phaser.Geom.Line(100, 300, 700, 300); + * const points = Phaser.Geom.Line.GetEasedPoints(line, 'sine.out', 32) + * ``` + * + * In the above example, the `points` array will contain 32 points spread-out across + * the length of `line`, where the position of each point is determined by the `Sine.out` + * ease function. + * + * You can optionally provide a collinear threshold. In this case, the resulting points + * are checked against each other, and if they are `< collinearThreshold` distance apart, + * they are dropped from the results. This can help avoid lots of clustered points at + * far ends of the line with tightly-packed eases such as Quartic. Leave the value set + * to zero to skip this check. + * + * Note that if you provide a collinear threshold, the resulting array may not always + * contain `quantity` points. + * + * @function Phaser.Geom.Line.GetEasedPoints + * @since 3.23.0 + * + * @generic {Phaser.Geom.Point[]} O - [out,$return] + * + * @param {Phaser.Geom.Line} line - The Line object. + * @param {(string|function)} ease - The ease to use. This can be either a string from the EaseMap, or a custom function. + * @param {number} quantity - The number of points to return. Note that if you provide a `collinearThreshold`, the resulting array may not always contain this number of points. + * @param {number} [collinearThreshold=0] - An optional threshold. The final array is reduced so that each point is spaced out at least this distance apart. This helps reduce clustering in noisey eases. + * @param {number[]} [easeParams] - An optional array of ease parameters to go with the ease. + * + * @return {Phaser.Geom.Point[]} An array of Geom.Points containing the coordinates of the points on the line. + */ +var GetEasedPoints = function (line, ease, quantity, collinearThreshold, easeParams) +{ + if (collinearThreshold === undefined) { collinearThreshold = 0; } + if (easeParams === undefined) { easeParams = []; } - if (mapping && mapping !== '') - { - addToScene[mapping] = instance; - } + var results = []; - instance.boot(); - } - }, + var x1 = line.x1; + var y1 = line.y1; - /** - * Installs a new Global Plugin into the Plugin Manager and optionally starts it running. - * A global plugin belongs to the Plugin Manager, rather than a specific Scene, and can be accessed - * and used by all Scenes in your game. - * - * The `key` property is what you use to access this plugin from the Plugin Manager. - * - * ```javascript - * this.plugins.install('powerupsPlugin', pluginCode); - * - * // and from within the scene: - * this.plugins.get('powerupsPlugin'); - * ``` - * - * This method is called automatically by Phaser if you install your plugins using either the - * Game Configuration object, or by preloading them via the Loader. - * - * The same plugin can be installed multiple times into the Plugin Manager by simply giving each - * instance its own unique key. - * - * @method Phaser.Plugins.PluginManager#install - * @since 3.8.0 - * - * @param {string} key - The unique handle given to this plugin within the Plugin Manager. - * @param {function} plugin - The plugin code. This should be the non-instantiated version. - * @param {boolean} [start=false] - Automatically start the plugin running? This is always `true` if you provide a mapping value. - * @param {string} [mapping] - If this plugin is injected into the Phaser.Scene class, this is the property key to use. - * @param {any} [data] - A value passed to the plugin's `init` method. - * - * @return {?Phaser.Plugins.BasePlugin} The plugin that was started, or `null` if `start` was false, or game isn't yet booted. - */ - install: function (key, plugin, start, mapping, data) - { - if (start === undefined) { start = false; } - if (mapping === undefined) { mapping = null; } - if (data === undefined) { data = null; } + var spaceX = line.x2 - x1; + var spaceY = line.y2 - y1; - if (typeof plugin !== 'function') - { - console.warn('Invalid Plugin: ' + key); - return null; - } + var easeFunc = GetEaseFunction(ease, easeParams); - if (PluginCache.hasCustom(key)) - { - console.warn('Plugin key in use: ' + key); - return null; - } + var i; + var v; + var q = quantity - 1; - if (mapping !== null) - { - start = true; - } + for (i = 0; i < q; i++) + { + v = easeFunc(i / q); - if (!this.game.isBooted) - { - this._pendingGlobal.push({ key: key, plugin: plugin, start: start, mapping: mapping, data: data }); - } - else - { - // Add it to the plugin store - PluginCache.registerCustom(key, plugin, mapping, data); + results.push(new Point(x1 + (spaceX * v), y1 + (spaceY * v))); + } - if (start) - { - return this.start(key); - } - } + // Always include the end of the line + v = easeFunc(1); - return null; - }, + results.push(new Point(x1 + (spaceX * v), y1 + (spaceY * v))); - /** - * Gets an index of a global plugin based on the given key. - * - * @method Phaser.Plugins.PluginManager#getIndex - * @protected - * @since 3.8.0 - * - * @param {string} key - The unique plugin key. - * - * @return {number} The index of the plugin within the plugins array. - */ - getIndex: function (key) + // Remove collinear parts + if (collinearThreshold > 0) { - var list = this.plugins; + var prevPoint = results[0]; - for (var i = 0; i < list.length; i++) + // Store the new results here + var sortedResults = [ prevPoint ]; + + for (i = 1; i < results.length - 1; i++) { - var entry = list[i]; + var point = results[i]; - if (entry.key === key) + if (DistanceBetweenPoints(prevPoint, point) >= collinearThreshold) { - return i; + sortedResults.push(point); + prevPoint = point; } } - return -1; - }, - - /** - * Gets a global plugin based on the given key. - * - * @method Phaser.Plugins.PluginManager#getEntry - * @protected - * @since 3.8.0 - * - * @param {string} key - The unique plugin key. - * - * @return {Phaser.Types.Plugins.GlobalPlugin} The plugin entry. - */ - getEntry: function (key) - { - var idx = this.getIndex(key); - - if (idx !== -1) - { - return this.plugins[idx]; - } - }, - - /** - * Checks if the given global plugin, based on its key, is active or not. - * - * @method Phaser.Plugins.PluginManager#isActive - * @since 3.8.0 - * - * @param {string} key - The unique plugin key. - * - * @return {boolean} `true` if the plugin is active, otherwise `false`. - */ - isActive: function (key) - { - var entry = this.getEntry(key); - - return (entry && entry.active); - }, - - /** - * Starts a global plugin running. - * - * If the plugin was previously active then calling `start` will reset it to an active state and then - * call its `start` method. - * - * If the plugin has never been run before a new instance of it will be created within the Plugin Manager, - * its active state set and then both of its `init` and `start` methods called, in that order. - * - * If the plugin is already running under the given key then nothing happens. - * - * @method Phaser.Plugins.PluginManager#start - * @since 3.8.0 - * - * @param {string} key - The key of the plugin to start. - * @param {string} [runAs] - Run the plugin under a new key. This allows you to run one plugin multiple times. - * - * @return {?Phaser.Plugins.BasePlugin} The plugin that was started, or `null` if invalid key given or plugin is already stopped. - */ - start: function (key, runAs) - { - if (runAs === undefined) { runAs = key; } - - var entry = this.getEntry(runAs); + // Top and tail + var endPoint = results[results.length - 1]; - // Plugin already running under this key? - if (entry && !entry.active) - { - // It exists, we just need to start it up again - entry.active = true; - entry.plugin.start(); - } - else if (!entry) + if (DistanceBetweenPoints(prevPoint, endPoint) < collinearThreshold) { - entry = this.createEntry(key, runAs); + sortedResults.pop(); } - return (entry) ? entry.plugin : null; - }, + sortedResults.push(endPoint); - /** - * Creates a new instance of a global plugin, adds an entry into the plugins array and returns it. - * - * @method Phaser.Plugins.PluginManager#createEntry - * @private - * @since 3.9.0 - * - * @param {string} key - The key of the plugin to create an instance of. - * @param {string} [runAs] - Run the plugin under a new key. This allows you to run one plugin multiple times. - * - * @return {?Phaser.Plugins.BasePlugin} The plugin that was started, or `null` if invalid key given. - */ - createEntry: function (key, runAs) + return sortedResults; + } + else { - var entry = PluginCache.getCustom(key); - - if (entry) - { - var instance = new entry.plugin(this); + return results; + } +}; - entry = { - key: runAs, - plugin: instance, - active: true, - mapping: entry.mapping, - data: entry.data - }; +module.exports = GetEasedPoints; - this.plugins.push(entry); - instance.init(entry.data); - instance.start(); - } +/***/ }), - return entry; - }, +/***/ 20487: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Stops a global plugin from running. - * - * If the plugin is active then its active state will be set to false and the plugins `stop` method - * will be called. - * - * If the plugin is not already running, nothing will happen. - * - * @method Phaser.Plugins.PluginManager#stop - * @since 3.8.0 - * - * @param {string} key - The key of the plugin to stop. - * - * @return {this} The Plugin Manager. - */ - stop: function (key) - { - var entry = this.getEntry(key); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (entry && entry.active) - { - entry.active = false; - entry.plugin.stop(); - } +var Point = __webpack_require__(79967); - return this; - }, +/** + * Get the midpoint of the given line. + * + * @function Phaser.Geom.Line.GetMidPoint + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Line} line - The line to get the midpoint of. + * @param {(Phaser.Geom.Point|object)} [out] - An optional point object to store the midpoint in. + * + * @return {(Phaser.Geom.Point|object)} The midpoint of the Line. + */ +var GetMidPoint = function (line, out) +{ + if (out === undefined) { out = new Point(); } - /** - * Gets a global plugin from the Plugin Manager based on the given key and returns it. - * - * If it cannot find an active plugin based on the key, but there is one in the Plugin Cache with the same key, - * then it will create a new instance of the cached plugin and return that. - * - * @method Phaser.Plugins.PluginManager#get - * @since 3.8.0 - * - * @param {string} key - The key of the plugin to get. - * @param {boolean} [autoStart=true] - Automatically start a new instance of the plugin if found in the cache, but not actively running. - * - * @return {?(Phaser.Plugins.BasePlugin|function)} The plugin, or `null` if no plugin was found matching the key. - */ - get: function (key, autoStart) - { - if (autoStart === undefined) { autoStart = true; } + out.x = (line.x1 + line.x2) / 2; + out.y = (line.y1 + line.y2) / 2; - var entry = this.getEntry(key); + return out; +}; - if (entry) - { - return entry.plugin; - } - else - { - var plugin = this.getClass(key); +module.exports = GetMidPoint; - if (plugin && autoStart) - { - entry = this.createEntry(key, key); - return (entry) ? entry.plugin : null; - } - else if (plugin) - { - return plugin; - } - } +/***/ }), - return null; - }, +/***/ 11222: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Returns the plugin class from the cache. - * Used internally by the Plugin Manager. - * - * @method Phaser.Plugins.PluginManager#getClass - * @since 3.8.0 - * - * @param {string} key - The key of the plugin to get. - * - * @return {Phaser.Plugins.BasePlugin} A Plugin object - */ - getClass: function (key) - { - return PluginCache.getCustomClass(key); - }, +/** + * @author Richard Davey + * @author Florian Mertens + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Removes a global plugin from the Plugin Manager and Plugin Cache. - * - * It is up to you to remove all references to this plugin that you may hold within your game code. - * - * @method Phaser.Plugins.PluginManager#removeGlobalPlugin - * @since 3.8.0 - * - * @param {string} key - The key of the plugin to remove. - */ - removeGlobalPlugin: function (key) - { - var entry = this.getEntry(key); +var Point = __webpack_require__(79967); - if (entry) - { - Remove(this.plugins, entry); - } +/** + * Get the nearest point on a line perpendicular to the given point. + * + * @function Phaser.Geom.Line.GetNearestPoint + * @since 3.16.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Line} line - The line to get the nearest point on. + * @param {(Phaser.Geom.Point|object)} point - The point to get the nearest point to. + * @param {(Phaser.Geom.Point|object)} [out] - An optional point, or point-like object, to store the coordinates of the nearest point on the line. + * + * @return {(Phaser.Geom.Point|object)} The nearest point on the line. + */ +var GetNearestPoint = function (line, point, out) +{ + if (out === undefined) { out = new Point(); } - PluginCache.removeCustom(key); - }, + var x1 = line.x1; + var y1 = line.y1; - /** - * Removes a scene plugin from the Plugin Manager and Plugin Cache. - * - * This will not remove the plugin from any active Scenes that are already using it. - * - * It is up to you to remove all references to this plugin that you may hold within your game code. - * - * @method Phaser.Plugins.PluginManager#removeScenePlugin - * @since 3.8.0 - * - * @param {string} key - The key of the plugin to remove. - */ - removeScenePlugin: function (key) - { - Remove(this.scenePlugins, key); + var x2 = line.x2; + var y2 = line.y2; - PluginCache.remove(key); - }, + var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); - /** - * Registers a new type of Game Object with the global Game Object Factory and / or Creator. - * This is usually called from within your Plugin code and is a helpful short-cut for creating - * new Game Objects. - * - * The key is the property that will be injected into the factories and used to create the - * Game Object. For example: - * - * ```javascript - * this.plugins.registerGameObject('clown', clownFactoryCallback, clownCreatorCallback); - * // later in your game code: - * this.add.clown(); - * this.make.clown(); - * ``` - * - * The callbacks are what are called when the factories try to create a Game Object - * matching the given key. It's important to understand that the callbacks are invoked within - * the context of the GameObjectFactory. In this context there are several properties available - * to use: - * - * this.scene - A reference to the Scene that owns the GameObjectFactory. - * this.displayList - A reference to the Display List the Scene owns. - * this.updateList - A reference to the Update List the Scene owns. - * - * See the GameObjectFactory and GameObjectCreator classes for more details. - * Any public property or method listed is available from your callbacks under `this`. - * - * @method Phaser.Plugins.PluginManager#registerGameObject - * @since 3.8.0 - * - * @param {string} key - The key of the Game Object that the given callbacks will create, i.e. `image`, `sprite`. - * @param {function} [factoryCallback] - The callback to invoke when the Game Object Factory is called. - * @param {function} [creatorCallback] - The callback to invoke when the Game Object Creator is called. - */ - registerGameObject: function (key, factoryCallback, creatorCallback) + if (L2 === 0) { - if (factoryCallback) - { - GameObjectFactory.register(key, factoryCallback); - } - - if (creatorCallback) - { - GameObjectCreator.register(key, creatorCallback); - } + return out; + } - return this; - }, + var r = (((point.x - x1) * (x2 - x1)) + ((point.y - y1) * (y2 - y1))) / L2; - /** - * Removes a previously registered Game Object from the global Game Object Factory and / or Creator. - * This is usually called from within your Plugin destruction code to help clean-up after your plugin has been removed. - * - * @method Phaser.Plugins.PluginManager#removeGameObject - * @since 3.19.0 - * - * @param {string} key - The key of the Game Object to be removed from the factories. - * @param {boolean} [removeFromFactory=true] - Should the Game Object be removed from the Game Object Factory? - * @param {boolean} [removeFromCreator=true] - Should the Game Object be removed from the Game Object Creator? - */ - removeGameObject: function (key, removeFromFactory, removeFromCreator) - { - if (removeFromFactory === undefined) { removeFromFactory = true; } - if (removeFromCreator === undefined) { removeFromCreator = true; } + out.x = x1 + (r * (x2 - x1)); + out.y = y1 + (r * (y2 - y1)); - if (removeFromFactory) - { - GameObjectFactory.remove(key); - } + return out; +}; - if (removeFromCreator) - { - GameObjectCreator.remove(key); - } +module.exports = GetNearestPoint; - return this; - }, - /** - * Registers a new file type with the global File Types Manager, making it available to all Loader - * Plugins created after this. - * - * This is usually called from within your Plugin code and is a helpful short-cut for creating - * new loader file types. - * - * The key is the property that will be injected into the Loader Plugin and used to load the - * files. For example: - * - * ```javascript - * this.plugins.registerFileType('wad', doomWadLoaderCallback); - * // later in your preload code: - * this.load.wad(); - * ``` - * - * The callback is what is called when the loader tries to load a file matching the given key. - * It's important to understand that the callback is invoked within - * the context of the LoaderPlugin. In this context there are several properties / methods available - * to use: - * - * this.addFile - A method to add the new file to the load queue. - * this.scene - The Scene that owns the Loader Plugin instance. - * - * See the LoaderPlugin class for more details. Any public property or method listed is available from - * your callback under `this`. - * - * @method Phaser.Plugins.PluginManager#registerFileType - * @since 3.8.0 - * - * @param {string} key - The key of the Game Object that the given callbacks will create, i.e. `image`, `sprite`. - * @param {function} callback - The callback to invoke when the Game Object Factory is called. - * @param {Phaser.Scene} [addToScene] - Optionally add this file type into the Loader Plugin owned by the given Scene. - */ - registerFileType: function (key, callback, addToScene) - { - FileTypesManager.register(key, callback); +/***/ }), - if (addToScene && addToScene.sys.load) - { - addToScene.sys.load[key] = callback; - } - }, +/***/ 7377: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Destroys this Plugin Manager and all associated plugins. - * It will iterate all plugins found and call their `destroy` methods. - * - * The PluginCache will remove all custom plugins. - * - * @method Phaser.Plugins.PluginManager#destroy - * @since 3.8.0 - */ - destroy: function () - { - for (var i = 0; i < this.plugins.length; i++) - { - this.plugins[i].plugin.destroy(); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - PluginCache.destroyCustomPlugins(); +var MATH_CONST = __webpack_require__(83392); +var Angle = __webpack_require__(50599); +var Point = __webpack_require__(79967); - if (this.game.noReturn) - { - PluginCache.destroyCorePlugins(); - } +/** + * Calculate the normal of the given line. + * + * The normal of a line is a vector that points perpendicular from it. + * + * @function Phaser.Geom.Line.GetNormal + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Line} line - The line to calculate the normal of. + * @param {(Phaser.Geom.Point|object)} [out] - An optional point object to store the normal in. + * + * @return {(Phaser.Geom.Point|object)} The normal of the Line. + */ +var GetNormal = function (line, out) +{ + if (out === undefined) { out = new Point(); } - this.game = null; - this.plugins = []; - this.scenePlugins = []; - } + var a = Angle(line) - MATH_CONST.TAU; -}); + out.x = Math.cos(a); + out.y = Math.sin(a); -/* - * "Sometimes, the elegant implementation is just a function. - * Not a method. Not a class. Not a framework. Just a function." - * -- John Carmack - */ + return out; +}; -module.exports = PluginManager; +module.exports = GetNormal; /***/ }), -/* 415 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 66464: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(201); -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(104); -var GameEvents = __webpack_require__(22); -var GetInnerHeight = __webpack_require__(401); -var GetTarget = __webpack_require__(407); -var GetScreenOrientation = __webpack_require__(402); -var NOOP = __webpack_require__(1); -var Rectangle = __webpack_require__(10); -var Size = __webpack_require__(416); -var SnapFloor = __webpack_require__(76); -var Vector2 = __webpack_require__(3); +var Point = __webpack_require__(79967); /** - * @classdesc - * The Scale Manager handles the scaling, resizing and alignment of the game canvas. - * - * The way scaling is handled is by setting the game canvas to a fixed size, which is defined in the - * game configuration. You also define the parent container in the game config. If no parent is given, - * it will default to using the document body. The Scale Manager will then look at the available space - * within the _parent_ and scale the canvas accordingly. Scaling is handled by setting the canvas CSS - * width and height properties, leaving the width and height of the canvas element itself untouched. - * Scaling is therefore achieved by keeping the core canvas the same size and 'stretching' - * it via its CSS properties. This gives the same result and speed as using the `transform-scale` CSS - * property, without the need for browser prefix handling. - * - * The calculations for the scale are heavily influenced by the bounding parent size, which is the computed - * dimensions of the canvas's parent. The CSS rules of the parent element play an important role in the - * operation of the Scale Manager. For example, if the parent has no defined width or height, then actions - * like auto-centering will fail to achieve the required result. The Scale Manager works in tandem with the - * CSS you set-up on the page hosting your game, rather than taking control of it. - * - * #### Parent and Display canvas containment guidelines: - * - * - Style the Parent element (of the game canvas) to control the Parent size and thus the games size and layout. - * - * - The Parent element's CSS styles should _effectively_ apply maximum (and minimum) bounding behavior. - * - * - The Parent element should _not_ apply a padding as this is not accounted for. - * If a padding is required apply it to the Parent's parent or apply a margin to the Parent. - * If you need to add a border, margin or any other CSS around your game container, then use a parent element and - * apply the CSS to this instead, otherwise you'll be constantly resizing the shape of the game container. - * - * - The Display canvas layout CSS styles (i.e. margins, size) should not be altered / specified as - * they may be updated by the Scale Manager. - * - * #### Scale Modes - * - * The way the scaling is handled is determined by the `scaleMode` property. The default is `NONE`, - * which prevents Phaser from scaling or touching the canvas, or its parent, at all. In this mode, you are - * responsible for all scaling. The other scaling modes afford you automatic scaling. - * - * If you wish to scale your game so that it always fits into the available space within the parent, you - * should use the scale mode `FIT`. Look at the documentation for other scale modes to see what options are - * available. Here is a basic config showing how to set this scale mode: + * Get a point on a line that's a given percentage along its length. * - * ```javascript - * scale: { - * parent: 'yourgamediv', - * mode: Phaser.Scale.FIT, - * width: 800, - * height: 600 - * } - * ``` + * @function Phaser.Geom.Line.GetPoint + * @since 3.0.0 * - * Place the `scale` config object within your game config. + * @generic {Phaser.Geom.Point} O - [out,$return] * - * If you wish for the canvas to be resized directly, so that the canvas itself fills the available space - * (i.e. it isn't scaled, it's resized) then use the `RESIZE` scale mode. This will give you a 1:1 mapping - * of canvas pixels to game size. In this mode CSS isn't used to scale the canvas, it's literally adjusted - * to fill all available space within the parent. You should be extremely careful about the size of the - * canvas you're creating when doing this, as the larger the area, the more work the GPU has to do and it's - * very easy to hit fill-rate limits quickly. + * @param {Phaser.Geom.Line} line - The line. + * @param {number} position - A value between 0 and 1, where 0 is the start, 0.5 is the middle and 1 is the end of the line. + * @param {(Phaser.Geom.Point|object)} [out] - An optional point, or point-like object, to store the coordinates of the point on the line. * - * For complex, custom-scaling requirements, you should probably consider using the `RESIZE` scale mode, - * with your own limitations in place re: canvas dimensions and managing the scaling with the game scenes - * yourself. For the vast majority of games, however, the `FIT` mode is likely to be the most used. + * @return {(Phaser.Geom.Point|object)} The point on the line. + */ +var GetPoint = function (line, position, out) +{ + if (out === undefined) { out = new Point(); } + + out.x = line.x1 + (line.x2 - line.x1) * position; + out.y = line.y1 + (line.y2 - line.y1) * position; + + return out; +}; + +module.exports = GetPoint; + + +/***/ }), + +/***/ 8570: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Length = __webpack_require__(16028); +var Point = __webpack_require__(79967); + +/** + * Get a number of points along a line's length. * - * Please appreciate that the Scale Manager cannot perform miracles. All it does is scale your game canvas - * as best it can, based on what it can infer from its surrounding area. There are all kinds of environments - * where it's up to you to guide and help the canvas position itself, especially when built into rendering - * frameworks like React and Vue. If your page requires meta tags to prevent user scaling gestures, or such - * like, then it's up to you to ensure they are present in the html. + * Provide a `quantity` to get an exact number of points along the line. * - * #### Centering + * Provide a `stepRate` to ensure a specific distance between each point on the line. Set `quantity` to `0` when + * providing a `stepRate`. * - * You can also have the game canvas automatically centered. Again, this relies heavily on the parent being - * properly configured and styled, as the centering offsets are based entirely on the available space - * within the parent element. Centering is disabled by default, or can be applied horizontally, vertically, - * or both. Here's an example: + * @function Phaser.Geom.Line.GetPoints + * @since 3.0.0 * - * ```javascript - * scale: { - * parent: 'yourgamediv', - * autoCenter: Phaser.Scale.CENTER_BOTH, - * width: 800, - * height: 600 - * } - * ``` + * @generic {Phaser.Geom.Point[]} O - [out,$return] * - * #### Fullscreen API + * @param {Phaser.Geom.Line} line - The line. + * @param {number} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead. + * @param {number} [stepRate] - The distance between each point on the line. When set, `quantity` is implied and should be set to `0`. + * @param {(array|Phaser.Geom.Point[])} [out] - An optional array of Points, or point-like objects, to store the coordinates of the points on the line. * - * If the browser supports it, you can send your game into fullscreen mode. In this mode, the game will fill - * the entire display, removing all browser UI and anything else present on the screen. It will remain in this - * mode until your game either disables it, or until the user tabs out or presses ESCape if on desktop. It's a - * great way to achieve a desktop-game like experience from the browser, but it does require a modern browser - * to handle it. Some mobile browsers also support this. + * @return {(array|Phaser.Geom.Point[])} An array of Points, or point-like objects, containing the coordinates of the points on the line. + */ +var GetPoints = function (line, quantity, stepRate, out) +{ + if (out === undefined) { out = []; } + + // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!quantity && stepRate > 0) + { + quantity = Length(line) / stepRate; + } + + var x1 = line.x1; + var y1 = line.y1; + + var x2 = line.x2; + var y2 = line.y2; + + for (var i = 0; i < quantity; i++) + { + var position = i / quantity; + + var x = x1 + (x2 - x1) * position; + var y = y1 + (y2 - y1) * position; + + out.push(new Point(x, y)); + } + + return out; +}; + +module.exports = GetPoints; + + +/***/ }), + +/***/ 65269: +/***/ ((module) => { + +/** + * @author Richard Davey + * @author Florian Mertens + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Get the shortest distance from a Line to the given Point. * - * @class ScaleManager - * @memberof Phaser.Scale - * @extends Phaser.Events.EventEmitter - * @constructor + * @function Phaser.Geom.Line.GetShortestDistance * @since 3.16.0 * - * @param {Phaser.Game} game - A reference to the Phaser.Game instance. + * @param {Phaser.Geom.Line} line - The line to get the distance from. + * @param {Phaser.Types.Math.Vector2Like} point - The point to get the shortest distance to. + * + * @return {(boolean|number)} The shortest distance from the line to the point, or `false`. */ -var ScaleManager = new Class({ +var GetShortestDistance = function (line, point) +{ + var x1 = line.x1; + var y1 = line.y1; - Extends: EventEmitter, + var x2 = line.x2; + var y2 = line.y2; - initialize: + var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); - function ScaleManager (game) + if (L2 === 0) { - EventEmitter.call(this); + return false; + } - /** - * A reference to the Phaser.Game instance. - * - * @name Phaser.Scale.ScaleManager#game - * @type {Phaser.Game} - * @readonly - * @since 3.15.0 - */ - this.game = game; + var s = (((y1 - point.y) * (x2 - x1)) - ((x1 - point.x) * (y2 - y1))) / L2; - /** - * A reference to the HTML Canvas Element that Phaser uses to render the game. - * - * @name Phaser.Scale.ScaleManager#canvas - * @type {HTMLCanvasElement} - * @since 3.16.0 - */ - this.canvas; + return Math.abs(s) * Math.sqrt(L2); +}; - /** - * The DOM bounds of the canvas element. - * - * @name Phaser.Scale.ScaleManager#canvasBounds - * @type {Phaser.Geom.Rectangle} - * @since 3.16.0 - */ - this.canvasBounds = new Rectangle(); +module.exports = GetShortestDistance; - /** - * The parent object of the Canvas. Often a div, or the browser window, or nothing in non-browser environments. - * - * This is set in the Game Config as the `parent` property. If undefined (or just not present), it will default - * to use the document body. If specifically set to `null` Phaser will ignore all parent operations. - * - * @name Phaser.Scale.ScaleManager#parent - * @type {?any} - * @since 3.16.0 - */ - this.parent = null; - /** - * Is the parent element the browser window? - * - * @name Phaser.Scale.ScaleManager#parentIsWindow - * @type {boolean} - * @since 3.16.0 - */ - this.parentIsWindow = false; +/***/ }), - /** - * The Parent Size component. - * - * @name Phaser.Scale.ScaleManager#parentSize - * @type {Phaser.Structs.Size} - * @since 3.16.0 - */ - this.parentSize = new Size(); +/***/ 82996: +/***/ ((module) => { - /** - * The Game Size component. - * - * The un-modified game size, as requested in the game config (the raw width / height), - * as used for world bounds, cameras, etc - * - * @name Phaser.Scale.ScaleManager#gameSize - * @type {Phaser.Structs.Size} - * @since 3.16.0 - */ - this.gameSize = new Size(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The Base Size component. - * - * The modified game size, which is the auto-rounded gameSize, used to set the canvas width and height - * (but not the CSS style) - * - * @name Phaser.Scale.ScaleManager#baseSize - * @type {Phaser.Structs.Size} - * @since 3.16.0 - */ - this.baseSize = new Size(); +/** + * Calculate the height of the given line. + * + * @function Phaser.Geom.Line.Height + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line to calculate the height of. + * + * @return {number} The height of the line. + */ +var Height = function (line) +{ + return Math.abs(line.y1 - line.y2); +}; - /** - * The Display Size component. - * - * The size used for the canvas style, factoring in the scale mode, parent and other values. - * - * @name Phaser.Scale.ScaleManager#displaySize - * @type {Phaser.Structs.Size} - * @since 3.16.0 - */ - this.displaySize = new Size(); +module.exports = Height; - /** - * The game scale mode. - * - * @name Phaser.Scale.ScaleManager#scaleMode - * @type {Phaser.Scale.ScaleModeType} - * @since 3.16.0 - */ - this.scaleMode = CONST.SCALE_MODE.NONE; - /** - * The game zoom factor. - * - * This value allows you to multiply your games base size by the given zoom factor. - * This is then used when calculating the display size, even in `NONE` situations. - * If you don't want Phaser to touch the canvas style at all, this value should be 1. - * - * Can also be set to `MAX_ZOOM` in which case the zoom value will be derived based - * on the game size and available space within the parent. - * - * @name Phaser.Scale.ScaleManager#zoom - * @type {number} - * @since 3.16.0 - */ - this.zoom = 1; +/***/ }), - /** - * Internal flag set when the game zoom factor is modified. - * - * @name Phaser.Scale.ScaleManager#_resetZoom - * @type {boolean} - * @readonly - * @since 3.19.0 - */ - this._resetZoom = false; +/***/ 16028: +/***/ ((module) => { - /** - * The scale factor between the baseSize and the canvasBounds. - * - * @name Phaser.Scale.ScaleManager#displayScale - * @type {Phaser.Math.Vector2} - * @since 3.16.0 - */ - this.displayScale = new Vector2(1, 1); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * If set, the canvas sizes will be automatically passed through Math.floor. - * This results in rounded pixel display values, which is important for performance on legacy - * and low powered devices, but at the cost of not achieving a 'perfect' fit in some browser windows. - * - * @name Phaser.Scale.ScaleManager#autoRound - * @type {boolean} - * @since 3.16.0 - */ - this.autoRound = false; +/** + * Calculate the length of the given line. + * + * @function Phaser.Geom.Line.Length + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line to calculate the length of. + * + * @return {number} The length of the line. + */ +var Length = function (line) +{ + return Math.sqrt((line.x2 - line.x1) * (line.x2 - line.x1) + (line.y2 - line.y1) * (line.y2 - line.y1)); +}; - /** - * Automatically center the canvas within the parent? The different centering modes are: - * - * 1. No centering. - * 2. Center both horizontally and vertically. - * 3. Center horizontally. - * 4. Center vertically. - * - * Please be aware that in order to center the game canvas, you must have specified a parent - * that has a size set, or the canvas parent is the document.body. - * - * @name Phaser.Scale.ScaleManager#autoCenter - * @type {Phaser.Scale.CenterType} - * @since 3.16.0 - */ - this.autoCenter = CONST.CENTER.NO_CENTER; +module.exports = Length; - /** - * The current device orientation. - * - * Orientation events are dispatched via the Device Orientation API, typically only on mobile browsers. - * - * @name Phaser.Scale.ScaleManager#orientation - * @type {Phaser.Scale.OrientationType} - * @since 3.16.0 - */ - this.orientation = CONST.ORIENTATION.LANDSCAPE; - /** - * A reference to the Device.Fullscreen object. - * - * @name Phaser.Scale.ScaleManager#fullscreen - * @type {Phaser.Device.Fullscreen} - * @since 3.16.0 - */ - this.fullscreen; +/***/ }), - /** - * The DOM Element which is sent into fullscreen mode. - * - * @name Phaser.Scale.ScaleManager#fullscreenTarget - * @type {?any} - * @since 3.16.0 - */ - this.fullscreenTarget = null; +/***/ 88829: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Did Phaser create the fullscreen target div, or was it provided in the game config? - * - * @name Phaser.Scale.ScaleManager#_createdFullscreenTarget - * @type {boolean} - * @private - * @since 3.16.0 - */ - this._createdFullscreenTarget = false; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var GetPoint = __webpack_require__(66464); +var GetPoints = __webpack_require__(8570); +var GEOM_CONST = __webpack_require__(52394); +var Random = __webpack_require__(74077); +var Vector2 = __webpack_require__(93736); + +/** + * @classdesc + * Defines a Line segment, a part of a line between two endpoints. + * + * @class Line + * @memberof Phaser.Geom + * @constructor + * @since 3.0.0 + * + * @param {number} [x1=0] - The x coordinate of the lines starting point. + * @param {number} [y1=0] - The y coordinate of the lines starting point. + * @param {number} [x2=0] - The x coordinate of the lines ending point. + * @param {number} [y2=0] - The y coordinate of the lines ending point. + */ +var Line = new Class({ + + initialize: + + function Line (x1, y1, x2, y2) + { + if (x1 === undefined) { x1 = 0; } + if (y1 === undefined) { y1 = 0; } + if (x2 === undefined) { x2 = 0; } + if (y2 === undefined) { y2 = 0; } /** - * The dirty state of the Scale Manager. - * Set if there is a change between the parent size and the current size. + * The geometry constant type of this object: `GEOM_CONST.LINE`. + * Used for fast type comparisons. * - * @name Phaser.Scale.ScaleManager#dirty - * @type {boolean} - * @since 3.16.0 + * @name Phaser.Geom.Line#type + * @type {number} + * @readonly + * @since 3.19.0 */ - this.dirty = false; + this.type = GEOM_CONST.LINE; /** - * How many milliseconds should elapse before checking if the browser size has changed? - * - * Most modern browsers dispatch a 'resize' event, which the Scale Manager will listen for. - * However, older browsers fail to do this, or do it consistently, so we fall back to a - * more traditional 'size check' based on a time interval. You can control how often it is - * checked here. + * The x coordinate of the lines starting point. * - * @name Phaser.Scale.ScaleManager#resizeInterval + * @name Phaser.Geom.Line#x1 * @type {number} - * @since 3.16.0 + * @since 3.0.0 */ - this.resizeInterval = 500; + this.x1 = x1; /** - * Internal size interval tracker. + * The y coordinate of the lines starting point. * - * @name Phaser.Scale.ScaleManager#_lastCheck + * @name Phaser.Geom.Line#y1 * @type {number} - * @private - * @since 3.16.0 + * @since 3.0.0 */ - this._lastCheck = 0; + this.y1 = y1; /** - * Internal flag to check orientation state. + * The x coordinate of the lines ending point. * - * @name Phaser.Scale.ScaleManager#_checkOrientation - * @type {boolean} - * @private - * @since 3.16.0 + * @name Phaser.Geom.Line#x2 + * @type {number} + * @since 3.0.0 */ - this._checkOrientation = false; + this.x2 = x2; /** - * Internal object containing our defined event listeners. + * The y coordinate of the lines ending point. * - * @name Phaser.Scale.ScaleManager#listeners - * @type {object} - * @private - * @since 3.16.0 + * @name Phaser.Geom.Line#y2 + * @type {number} + * @since 3.0.0 */ - this.listeners = { - - orientationChange: NOOP, - windowResize: NOOP, - fullScreenChange: NOOP, - fullScreenError: NOOP - - }; + this.y2 = y2; }, /** - * Called _before_ the canvas object is created and added to the DOM. + * Get a point on a line that's a given percentage along its length. * - * @method Phaser.Scale.ScaleManager#preBoot - * @protected - * @listens Phaser.Core.Events#BOOT - * @since 3.16.0 + * @method Phaser.Geom.Line#getPoint + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [output,$return] + * + * @param {number} position - A value between 0 and 1, where 0 is the start, 0.5 is the middle and 1 is the end of the line. + * @param {(Phaser.Geom.Point|object)} [output] - An optional point, or point-like object, to store the coordinates of the point on the line. + * + * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point on the line. */ - preBoot: function () + getPoint: function (position, output) { - // Parse the config to get the scaling values we need - this.parseConfig(this.game.config); - - this.game.events.once(GameEvents.BOOT, this.boot, this); + return GetPoint(this, position, output); }, /** - * The Boot handler is called by Phaser.Game when it first starts up. - * The renderer is available by now and the canvas has been added to the DOM. + * Get a number of points along a line's length. * - * @method Phaser.Scale.ScaleManager#boot - * @protected - * @fires Phaser.Scale.Events#RESIZE - * @since 3.16.0 + * Provide a `quantity` to get an exact number of points along the line. + * + * Provide a `stepRate` to ensure a specific distance between each point on the line. Set `quantity` to `0` when + * providing a `stepRate`. + * + * @method Phaser.Geom.Line#getPoints + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point[]} O - [output,$return] + * + * @param {number} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead. + * @param {number} [stepRate] - The distance between each point on the line. When set, `quantity` is implied and should be set to `0`. + * @param {(array|Phaser.Geom.Point[])} [output] - An optional array of Points, or point-like objects, to store the coordinates of the points on the line. + * + * @return {(array|Phaser.Geom.Point[])} An array of Points, or point-like objects, containing the coordinates of the points on the line. */ - boot: function () + getPoints: function (quantity, stepRate, output) { - var game = this.game; + return GetPoints(this, quantity, stepRate, output); + }, - this.canvas = game.canvas; + /** + * Get a random Point on the Line. + * + * @method Phaser.Geom.Line#getRandomPoint + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [point,$return] + * + * @param {(Phaser.Geom.Point|object)} [point] - An instance of a Point to be modified. + * + * @return {Phaser.Geom.Point} A random Point on the Line. + */ + getRandomPoint: function (point) + { + return Random(this, point); + }, - this.fullscreen = game.device.fullscreen; + /** + * Set new coordinates for the line endpoints. + * + * @method Phaser.Geom.Line#setTo + * @since 3.0.0 + * + * @param {number} [x1=0] - The x coordinate of the lines starting point. + * @param {number} [y1=0] - The y coordinate of the lines starting point. + * @param {number} [x2=0] - The x coordinate of the lines ending point. + * @param {number} [y2=0] - The y coordinate of the lines ending point. + * + * @return {this} This Line object. + */ + setTo: function (x1, y1, x2, y2) + { + if (x1 === undefined) { x1 = 0; } + if (y1 === undefined) { y1 = 0; } + if (x2 === undefined) { x2 = 0; } + if (y2 === undefined) { y2 = 0; } - if (this.scaleMode !== CONST.SCALE_MODE.RESIZE) - { - this.displaySize.setAspectMode(this.scaleMode); - } + this.x1 = x1; + this.y1 = y1; - if (this.scaleMode === CONST.SCALE_MODE.NONE) - { - this.resize(this.width, this.height); - } - else - { - this.getParentBounds(); + this.x2 = x2; + this.y2 = y2; - // Only set the parent bounds if the parent has an actual size - if (this.parentSize.width > 0 && this.parentSize.height > 0) - { - this.displaySize.setParent(this.parentSize); - } + return this; + }, - this.refresh(); - } + /** + * Returns a Vector2 object that corresponds to the start of this Line. + * + * @method Phaser.Geom.Line#getPointA + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [vec2,$return] + * + * @param {Phaser.Math.Vector2} [vec2] - A Vector2 object to set the results in. If `undefined` a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2} A Vector2 object that corresponds to the start of this Line. + */ + getPointA: function (vec2) + { + if (vec2 === undefined) { vec2 = new Vector2(); } - game.events.on(GameEvents.PRE_STEP, this.step, this); - game.events.once(GameEvents.READY, this.refresh, this); - game.events.once(GameEvents.DESTROY, this.destroy, this); + vec2.set(this.x1, this.y1); - this.startListeners(); + return vec2; }, /** - * Parses the game configuration to set-up the scale defaults. + * Returns a Vector2 object that corresponds to the end of this Line. * - * @method Phaser.Scale.ScaleManager#parseConfig - * @protected - * @since 3.16.0 + * @method Phaser.Geom.Line#getPointB + * @since 3.0.0 * - * @param {Phaser.Types.Core.GameConfig} config - The Game configuration object. + * @generic {Phaser.Math.Vector2} O - [vec2,$return] + * + * @param {Phaser.Math.Vector2} [vec2] - A Vector2 object to set the results in. If `undefined` a new Vector2 will be created. + * + * @return {Phaser.Math.Vector2} A Vector2 object that corresponds to the end of this Line. */ - parseConfig: function (config) + getPointB: function (vec2) { - // Get the parent element, if any - this.getParent(config); + if (vec2 === undefined) { vec2 = new Vector2(); } - // Get the size of the parent element - // This can often set a height of zero (especially for un-styled divs) - this.getParentBounds(); + vec2.set(this.x2, this.y2); - var width = config.width; - var height = config.height; - var scaleMode = config.scaleMode; - var zoom = config.zoom; - var autoRound = config.autoRound; + return vec2; + }, - // If width = '100%', or similar value - if (typeof width === 'string') + /** + * The left position of the Line. + * + * @name Phaser.Geom.Line#left + * @type {number} + * @since 3.0.0 + */ + left: { + + get: function () { - // If we have a parent with a height, we'll work it out from that - var parentWidth = this.parentSize.width; + return Math.min(this.x1, this.x2); + }, - if (parentWidth === 0) + set: function (value) + { + if (this.x1 <= this.x2) { - parentWidth = window.innerWidth; + this.x1 = value; } - - var parentScaleX = parseInt(width, 10) / 100; - - width = Math.floor(parentWidth * parentScaleX); - } - - // If height = '100%', or similar value - if (typeof height === 'string') - { - // If we have a parent with a height, we'll work it out from that - var parentHeight = this.parentSize.height; - - if (parentHeight === 0) + else { - parentHeight = window.innerHeight; + this.x2 = value; } - - var parentScaleY = parseInt(height, 10) / 100; - - height = Math.floor(parentHeight * parentScaleY); } - this.scaleMode = scaleMode; - - this.autoRound = autoRound; - - this.autoCenter = config.autoCenter; - - this.resizeInterval = config.resizeInterval; - - if (autoRound) - { - width = Math.floor(width); - height = Math.floor(height); - } + }, - // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc - this.gameSize.setSize(width, height); + /** + * The right position of the Line. + * + * @name Phaser.Geom.Line#right + * @type {number} + * @since 3.0.0 + */ + right: { - if (zoom === CONST.ZOOM.MAX_ZOOM) + get: function () { - zoom = this.getMaxZoom(); - } - - this.zoom = zoom; + return Math.max(this.x1, this.x2); + }, - if (zoom !== 1) + set: function (value) { - this._resetZoom = true; + if (this.x1 > this.x2) + { + this.x1 = value; + } + else + { + this.x2 = value; + } } - // The modified game size - this.baseSize.setSize(width, height); + }, - if (autoRound) - { - this.baseSize.width = Math.floor(this.baseSize.width); - this.baseSize.height = Math.floor(this.baseSize.height); - } + /** + * The top position of the Line. + * + * @name Phaser.Geom.Line#top + * @type {number} + * @since 3.0.0 + */ + top: { - if (config.minWidth > 0) + get: function () { - this.displaySize.setMin(config.minWidth * zoom, config.minHeight * zoom); - } + return Math.min(this.y1, this.y2); + }, - if (config.maxWidth > 0) + set: function (value) { - this.displaySize.setMax(config.maxWidth * zoom, config.maxHeight * zoom); + if (this.y1 <= this.y2) + { + this.y1 = value; + } + else + { + this.y2 = value; + } } - // The size used for the canvas style, factoring in the scale mode and parent and zoom value - // We just use the w/h here as this is what sets the aspect ratio (which doesn't then change) - this.displaySize.setSize(width, height); - - this.orientation = GetScreenOrientation(width, height); }, /** - * Determines the parent element of the game canvas, if any, based on the game configuration. - * - * @method Phaser.Scale.ScaleManager#getParent - * @since 3.16.0 + * The bottom position of the Line. * - * @param {Phaser.Types.Core.GameConfig} config - The Game configuration object. + * @name Phaser.Geom.Line#bottom + * @type {number} + * @since 3.0.0 */ - getParent: function (config) - { - var parent = config.parent; + bottom: { - if (parent === null) + get: function () { - // User is responsible for managing the parent - return; - } - - this.parent = GetTarget(parent); - this.parentIsWindow = (this.parent === document.body); + return Math.max(this.y1, this.y2); + }, - if (config.expandParent && config.scaleMode !== CONST.SCALE_MODE.NONE) + set: function (value) { - var DOMRect = this.parent.getBoundingClientRect(); - - if (this.parentIsWindow || DOMRect.height === 0) + if (this.y1 > this.y2) { - document.documentElement.style.height = '100%'; - document.body.style.height = '100%'; - - DOMRect = this.parent.getBoundingClientRect(); - - // The parent STILL has no height, clearly no CSS - // has been set on it even though we fixed the body :( - if (!this.parentIsWindow && DOMRect.height === 0) - { - this.parent.style.overflow = 'hidden'; - this.parent.style.width = '100%'; - this.parent.style.height = '100%'; - } + this.y1 = value; + } + else + { + this.y2 = value; } } - // And now get the fullscreenTarget - if (config.fullscreenTarget && !this.fullscreenTarget) - { - this.fullscreenTarget = GetTarget(config.fullscreenTarget); - } - }, + } - /** - * Calculates the size of the parent bounds and updates the `parentSize` component, if the canvas has a dom parent. - * - * @method Phaser.Scale.ScaleManager#getParentBounds - * @since 3.16.0 - * - * @return {boolean} `true` if the parent bounds have changed size, otherwise `false`. - */ - getParentBounds: function () - { - if (!this.parent) - { - return false; - } +}); - var parentSize = this.parentSize; +module.exports = Line; - // Ref. http://msdn.microsoft.com/en-us/library/hh781509(v=vs.85).aspx for getBoundingClientRect - var DOMRect = this.parent.getBoundingClientRect(); +/***/ }), - if (this.parentIsWindow && this.game.device.os.iOS) - { - DOMRect.height = GetInnerHeight(true); - } +/***/ 73273: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var newWidth = DOMRect.width; - var newHeight = DOMRect.height; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (parentSize.width !== newWidth || parentSize.height !== newHeight) - { - parentSize.setSize(newWidth, newHeight); +var MATH_CONST = __webpack_require__(83392); +var Wrap = __webpack_require__(1071); +var Angle = __webpack_require__(50599); - return true; - } - else - { - return false; - } - }, +/** + * Get the angle of the normal of the given line in radians. + * + * @function Phaser.Geom.Line.NormalAngle + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line to calculate the angle of the normal of. + * + * @return {number} The angle of the normal of the line in radians. + */ +var NormalAngle = function (line) +{ + var angle = Angle(line) - MATH_CONST.TAU; - /** - * Attempts to lock the orientation of the web browser using the Screen Orientation API. - * - * This API is only available on modern mobile browsers. - * See https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation for details. - * - * @method Phaser.Scale.ScaleManager#lockOrientation - * @since 3.16.0 - * - * @param {string} orientation - The orientation you'd like to lock the browser in. Should be an API string such as 'landscape', 'landscape-primary', 'portrait', etc. - * - * @return {boolean} `true` if the orientation was successfully locked, otherwise `false`. - */ - lockOrientation: function (orientation) - { - var lock = screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation; + return Wrap(angle, -Math.PI, Math.PI); +}; - if (lock) - { - return lock.call(screen, orientation); - } +module.exports = NormalAngle; - return false; - }, - /** - * This method will set the size of the Parent Size component, which is used in scaling - * and centering calculations. You only need to call this method if you have explicitly - * disabled the use of a parent in your game config, but still wish to take advantage of - * other Scale Manager features. - * - * @method Phaser.Scale.ScaleManager#setParentSize - * @fires Phaser.Scale.Events#RESIZE - * @since 3.16.0 - * - * @param {number} width - The new width of the parent. - * @param {number} height - The new height of the parent. - * - * @return {this} The Scale Manager instance. - */ - setParentSize: function (width, height) - { - this.parentSize.setSize(width, height); +/***/ }), - return this.refresh(); - }, +/***/ 96936: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * This method will set a new size for your game. - * - * It should only be used if you're looking to change the base size of your game and are using - * one of the Scale Manager scaling modes, i.e. `FIT`. If you're using `NONE` and wish to - * change the game and canvas size directly, then please use the `resize` method instead. - * - * @method Phaser.Scale.ScaleManager#setGameSize - * @fires Phaser.Scale.Events#RESIZE - * @since 3.16.0 - * - * @param {number} width - The new width of the game. - * @param {number} height - The new height of the game. - * - * @return {this} The Scale Manager instance. - */ - setGameSize: function (width, height) - { - var autoRound = this.autoRound; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (autoRound) - { - width = Math.floor(width); - height = Math.floor(height); - } +var MATH_CONST = __webpack_require__(83392); +var Angle = __webpack_require__(50599); - var previousWidth = this.width; - var previousHeight = this.height; +/** + * Returns the x component of the normal vector of the given line. + * + * @function Phaser.Geom.Line.NormalX + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The Line object to get the normal value from. + * + * @return {number} The x component of the normal vector of the line. + */ +var NormalX = function (line) +{ + return Math.cos(Angle(line) - MATH_CONST.TAU); +}; - // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc - this.gameSize.resize(width, height); +module.exports = NormalX; - // The modified game size - this.baseSize.resize(width, height); - if (autoRound) - { - this.baseSize.width = Math.floor(this.baseSize.width); - this.baseSize.height = Math.floor(this.baseSize.height); - } +/***/ }), - // The size used for the canvas style, factoring in the scale mode and parent and zoom value - // Update the aspect ratio - this.displaySize.setAspectRatio(width / height); +/***/ 43581: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.canvas.width = this.baseSize.width; - this.canvas.height = this.baseSize.height; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this.refresh(previousWidth, previousHeight); - }, +var MATH_CONST = __webpack_require__(83392); +var Angle = __webpack_require__(50599); - /** - * Call this to modify the size of the Phaser canvas element directly. - * You should only use this if you are using the `NONE` scale mode, - * it will update all internal components completely. - * - * If all you want to do is change the size of the parent, see the `setParentSize` method. - * - * If all you want is to change the base size of the game, but still have the Scale Manager - * manage all the scaling (i.e. you're **not** using `NONE`), then see the `setGameSize` method. - * - * This method will set the `gameSize`, `baseSize` and `displaySize` components to the given - * dimensions. It will then resize the canvas width and height to the values given, by - * directly setting the properties. Finally, if you have set the Scale Manager zoom value - * to anything other than 1 (the default), it will set the canvas CSS width and height to - * be the given size multiplied by the zoom factor (the canvas pixel size remains untouched). - * - * If you have enabled `autoCenter`, it is then passed to the `updateCenter` method and - * the margins are set, allowing the canvas to be centered based on its parent element - * alone. Finally, the `displayScale` is adjusted and the RESIZE event dispatched. - * - * @method Phaser.Scale.ScaleManager#resize - * @fires Phaser.Scale.Events#RESIZE - * @since 3.16.0 - * - * @param {number} width - The new width of the game. - * @param {number} height - The new height of the game. - * - * @return {this} The Scale Manager instance. - */ - resize: function (width, height) - { - var zoom = this.zoom; - var autoRound = this.autoRound; +/** + * The Y value of the normal of the given line. + * The normal of a line is a vector that points perpendicular from it. + * + * @function Phaser.Geom.Line.NormalY + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line to calculate the normal of. + * + * @return {number} The Y value of the normal of the Line. + */ +var NormalY = function (line) +{ + return Math.sin(Angle(line) - MATH_CONST.TAU); +}; - if (autoRound) - { - width = Math.floor(width); - height = Math.floor(height); - } +module.exports = NormalY; - var previousWidth = this.width; - var previousHeight = this.height; - // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc - this.gameSize.resize(width, height); +/***/ }), - // The modified game size - this.baseSize.resize(width, height); +/***/ 13990: +/***/ ((module) => { - if (autoRound) - { - this.baseSize.width = Math.floor(this.baseSize.width); - this.baseSize.height = Math.floor(this.baseSize.height); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // The size used for the canvas style, factoring in the scale mode and parent and zoom value - // We just use the w/h here as this is what sets the aspect ratio (which doesn't then change) - this.displaySize.setSize((width * zoom), (height * zoom)); +/** + * Offset a line by the given amount. + * + * @function Phaser.Geom.Line.Offset + * @since 3.0.0 + * + * @generic {Phaser.Geom.Line} O - [line,$return] + * + * @param {Phaser.Geom.Line} line - The line to offset. + * @param {number} x - The horizontal offset to add to the line. + * @param {number} y - The vertical offset to add to the line. + * + * @return {Phaser.Geom.Line} The offset line. + */ +var Offset = function (line, x, y) +{ + line.x1 += x; + line.y1 += y; - this.canvas.width = this.baseSize.width; - this.canvas.height = this.baseSize.height; + line.x2 += x; + line.y2 += y; - var style = this.canvas.style; + return line; +}; - var styleWidth = width * zoom; - var styleHeight = height * zoom; +module.exports = Offset; - if (autoRound) - { - styleWidth = Math.floor(styleWidth); - styleHeight = Math.floor(styleHeight); - } - if (styleWidth !== width || styleHeight !== height) - { - style.width = styleWidth + 'px'; - style.height = styleHeight + 'px'; - } +/***/ }), - return this.refresh(previousWidth, previousHeight); - }, +/***/ 1298: +/***/ ((module) => { - /** - * Sets the zoom value of the Scale Manager. - * - * @method Phaser.Scale.ScaleManager#setZoom - * @fires Phaser.Scale.Events#RESIZE - * @since 3.16.0 - * - * @param {number} value - The new zoom value of the game. - * - * @return {this} The Scale Manager instance. - */ - setZoom: function (value) - { - this.zoom = value; - this._resetZoom = true; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this.refresh(); - }, +/** + * Calculate the perpendicular slope of the given line. + * + * @function Phaser.Geom.Line.PerpSlope + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line to calculate the perpendicular slope of. + * + * @return {number} The perpendicular slope of the line. + */ +var PerpSlope = function (line) +{ + return -((line.x2 - line.x1) / (line.y2 - line.y1)); +}; - /** - * Sets the zoom to be the maximum possible based on the _current_ parent size. - * - * @method Phaser.Scale.ScaleManager#setMaxZoom - * @fires Phaser.Scale.Events#RESIZE - * @since 3.16.0 - * - * @return {this} The Scale Manager instance. - */ - setMaxZoom: function () - { - this.zoom = this.getMaxZoom(); - this._resetZoom = true; +module.exports = PerpSlope; - return this.refresh(); - }, - /** - * Refreshes the internal scale values, bounds sizes and orientation checks. - * - * Once finished, dispatches the resize event. - * - * This is called automatically by the Scale Manager when the browser window size changes, - * as long as it is using a Scale Mode other than 'NONE'. - * - * @method Phaser.Scale.ScaleManager#refresh - * @fires Phaser.Scale.Events#RESIZE - * @since 3.16.0 - * - * @param {number} [previousWidth] - The previous width of the game. Only set if the gameSize has changed. - * @param {number} [previousHeight] - The previous height of the game. Only set if the gameSize has changed. - * - * @return {this} The Scale Manager instance. - */ - refresh: function (previousWidth, previousHeight) - { - if (previousWidth === undefined) { previousWidth = this.width; } - if (previousHeight === undefined) { previousHeight = this.height; } +/***/ }), - this.updateScale(); - this.updateBounds(); - this.updateOrientation(); +/***/ 74077: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.displayScale.set(this.baseSize.width / this.canvasBounds.width, this.baseSize.height / this.canvasBounds.height); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var domContainer = this.game.domContainer; +var Point = __webpack_require__(79967); - if (domContainer) - { - this.baseSize.setCSS(domContainer); +/** + * Returns a random point on a given Line. + * + * @function Phaser.Geom.Line.Random + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Line} line - The Line to calculate the random Point on. + * @param {(Phaser.Geom.Point|object)} [out] - An instance of a Point to be modified. + * + * @return {(Phaser.Geom.Point|object)} A random Point on the Line. + */ +var Random = function (line, out) +{ + if (out === undefined) { out = new Point(); } - var canvasStyle = this.canvas.style; - var domStyle = domContainer.style; + var t = Math.random(); - domStyle.transform = 'scale(' + this.displaySize.width / this.baseSize.width + ',' + this.displaySize.height / this.baseSize.height + ')'; + out.x = line.x1 + t * (line.x2 - line.x1); + out.y = line.y1 + t * (line.y2 - line.y1); - domStyle.marginLeft = canvasStyle.marginLeft; - domStyle.marginTop = canvasStyle.marginTop; - } + return out; +}; - this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, previousWidth, previousHeight); +module.exports = Random; - return this; - }, - /** - * Internal method that checks the current screen orientation, only if the internal check flag is set. - * - * If the orientation has changed it updates the orientation property and then dispatches the orientation change event. - * - * @method Phaser.Scale.ScaleManager#updateOrientation - * @fires Phaser.Scale.Events#ORIENTATION_CHANGE - * @since 3.16.0 - */ - updateOrientation: function () - { - if (this._checkOrientation) - { - this._checkOrientation = false; +/***/ }), - var newOrientation = GetScreenOrientation(this.width, this.height); +/***/ 30473: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (newOrientation !== this.orientation) - { - this.orientation = newOrientation; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.emit(Events.ORIENTATION_CHANGE, newOrientation); - } - } - }, +var Angle = __webpack_require__(50599); +var NormalAngle = __webpack_require__(73273); - /** - * Internal method that manages updating the size components based on the scale mode. - * - * @method Phaser.Scale.ScaleManager#updateScale - * @since 3.16.0 - */ - updateScale: function () - { - var style = this.canvas.style; +/** + * Calculate the reflected angle between two lines. + * + * This is the outgoing angle based on the angle of Line 1 and the normalAngle of Line 2. + * + * @function Phaser.Geom.Line.ReflectAngle + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} lineA - The first line. + * @param {Phaser.Geom.Line} lineB - The second line. + * + * @return {number} The reflected angle between each line. + */ +var ReflectAngle = function (lineA, lineB) +{ + return (2 * NormalAngle(lineB) - Math.PI - Angle(lineA)); +}; - var width = this.gameSize.width; - var height = this.gameSize.height; +module.exports = ReflectAngle; - var styleWidth; - var styleHeight; - var zoom = this.zoom; - var autoRound = this.autoRound; +/***/ }), - if (this.scaleMode === CONST.SCALE_MODE.NONE) - { - // No scale - this.displaySize.setSize((width * zoom), (height * zoom)); +/***/ 25968: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - styleWidth = this.displaySize.width; - styleHeight = this.displaySize.height; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (autoRound) - { - styleWidth = Math.floor(styleWidth); - styleHeight = Math.floor(styleHeight); - } +var RotateAroundXY = __webpack_require__(1809); - if (this._resetZoom) - { - style.width = styleWidth + 'px'; - style.height = styleHeight + 'px'; +/** + * Rotate a line around its midpoint by the given angle in radians. + * + * @function Phaser.Geom.Line.Rotate + * @since 3.0.0 + * + * @generic {Phaser.Geom.Line} O - [line,$return] + * + * @param {Phaser.Geom.Line} line - The line to rotate. + * @param {number} angle - The angle of rotation in radians. + * + * @return {Phaser.Geom.Line} The rotated line. + */ +var Rotate = function (line, angle) +{ + var x = (line.x1 + line.x2) / 2; + var y = (line.y1 + line.y2) / 2; - this._resetZoom = false; - } - } - else if (this.scaleMode === CONST.SCALE_MODE.RESIZE) - { - // Resize to match parent + return RotateAroundXY(line, x, y, angle); +}; - // This will constrain using min/max - this.displaySize.setSize(this.parentSize.width, this.parentSize.height); +module.exports = Rotate; - this.gameSize.setSize(this.displaySize.width, this.displaySize.height); - this.baseSize.setSize(this.displaySize.width, this.displaySize.height); +/***/ }), - styleWidth = this.displaySize.width; - styleHeight = this.displaySize.height; +/***/ 24296: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (autoRound) - { - styleWidth = Math.floor(styleWidth); - styleHeight = Math.floor(styleHeight); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.canvas.width = styleWidth; - this.canvas.height = styleHeight; - } - else - { - // All other scale modes - this.displaySize.setSize(this.parentSize.width, this.parentSize.height); +var RotateAroundXY = __webpack_require__(1809); - styleWidth = this.displaySize.width; - styleHeight = this.displaySize.height; +/** + * Rotate a line around a point by the given angle in radians. + * + * @function Phaser.Geom.Line.RotateAroundPoint + * @since 3.0.0 + * + * @generic {Phaser.Geom.Line} O - [line,$return] + * + * @param {Phaser.Geom.Line} line - The line to rotate. + * @param {(Phaser.Geom.Point|object)} point - The point to rotate the line around. + * @param {number} angle - The angle of rotation in radians. + * + * @return {Phaser.Geom.Line} The rotated line. + */ +var RotateAroundPoint = function (line, point, angle) +{ + return RotateAroundXY(line, point.x, point.y, angle); +}; - if (autoRound) - { - styleWidth = Math.floor(styleWidth); - styleHeight = Math.floor(styleHeight); - } +module.exports = RotateAroundPoint; - style.width = styleWidth + 'px'; - style.height = styleHeight + 'px'; - } - // Update the parentSize in case the canvas / style change modified it - this.getParentBounds(); +/***/ }), - // Finally, update the centering - this.updateCenter(); +/***/ 1809: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Rotate a line around the given coordinates by the given angle in radians. + * + * @function Phaser.Geom.Line.RotateAroundXY + * @since 3.0.0 + * + * @generic {Phaser.Geom.Line} O - [line,$return] + * + * @param {Phaser.Geom.Line} line - The line to rotate. + * @param {number} x - The horizontal coordinate to rotate the line around. + * @param {number} y - The vertical coordinate to rotate the line around. + * @param {number} angle - The angle of rotation in radians. + * + * @return {Phaser.Geom.Line} The rotated line. + */ +var RotateAroundXY = function (line, x, y, angle) +{ + var c = Math.cos(angle); + var s = Math.sin(angle); + + var tx = line.x1 - x; + var ty = line.y1 - y; + + line.x1 = tx * c - ty * s + x; + line.y1 = tx * s + ty * c + y; + + tx = line.x2 - x; + ty = line.y2 - y; + + line.x2 = tx * c - ty * s + x; + line.y2 = tx * s + ty * c + y; + + return line; +}; + +module.exports = RotateAroundXY; + + +/***/ }), + +/***/ 88171: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Set a line to a given position, angle and length. + * + * @function Phaser.Geom.Line.SetToAngle + * @since 3.0.0 + * + * @generic {Phaser.Geom.Line} O - [line,$return] + * + * @param {Phaser.Geom.Line} line - The line to set. + * @param {number} x - The horizontal start position of the line. + * @param {number} y - The vertical start position of the line. + * @param {number} angle - The angle of the line in radians. + * @param {number} length - The length of the line. + * + * @return {Phaser.Geom.Line} The updated line. + */ +var SetToAngle = function (line, x, y, angle, length) +{ + line.x1 = x; + line.y1 = y; + + line.x2 = x + (Math.cos(angle) * length); + line.y2 = y + (Math.sin(angle) * length); + + return line; +}; + +module.exports = SetToAngle; + + +/***/ }), + +/***/ 82797: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Calculate the slope of the given line. + * + * @function Phaser.Geom.Line.Slope + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line to calculate the slope of. + * + * @return {number} The slope of the line. + */ +var Slope = function (line) +{ + return (line.y2 - line.y1) / (line.x2 - line.x1); +}; + +module.exports = Slope; + + +/***/ }), + +/***/ 41067: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Calculate the width of the given line. + * + * @function Phaser.Geom.Line.Width + * @since 3.0.0 + * + * @param {Phaser.Geom.Line} line - The line to calculate the width of. + * + * @return {number} The width of the line. + */ +var Width = function (line) +{ + return Math.abs(line.x1 - line.x2); +}; + +module.exports = Width; + + +/***/ }), + +/***/ 28482: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Line = __webpack_require__(88829); + +Line.Angle = __webpack_require__(50599); +Line.BresenhamPoints = __webpack_require__(58813); +Line.CenterOn = __webpack_require__(88513); +Line.Clone = __webpack_require__(26718); +Line.CopyFrom = __webpack_require__(88930); +Line.Equals = __webpack_require__(90656); +Line.Extend = __webpack_require__(30897); +Line.GetEasedPoints = __webpack_require__(30684); +Line.GetMidPoint = __webpack_require__(20487); +Line.GetNearestPoint = __webpack_require__(11222); +Line.GetNormal = __webpack_require__(7377); +Line.GetPoint = __webpack_require__(66464); +Line.GetPoints = __webpack_require__(8570); +Line.GetShortestDistance = __webpack_require__(65269); +Line.Height = __webpack_require__(82996); +Line.Length = __webpack_require__(16028); +Line.NormalAngle = __webpack_require__(73273); +Line.NormalX = __webpack_require__(96936); +Line.NormalY = __webpack_require__(43581); +Line.Offset = __webpack_require__(13990); +Line.PerpSlope = __webpack_require__(1298); +Line.Random = __webpack_require__(74077); +Line.ReflectAngle = __webpack_require__(30473); +Line.Rotate = __webpack_require__(25968); +Line.RotateAroundPoint = __webpack_require__(24296); +Line.RotateAroundXY = __webpack_require__(1809); +Line.SetToAngle = __webpack_require__(88171); +Line.Slope = __webpack_require__(82797); +Line.Width = __webpack_require__(41067); + +module.exports = Line; + + +/***/ }), + +/***/ 18693: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var Rectangle = __webpack_require__(74118); +var Vector2 = __webpack_require__(93736); + +/** + * Returns the length of the line. + * + * @ignore + * @private + * + * @param {number} x1 - The x1 coordinate. + * @param {number} y1 - The y1 coordinate. + * @param {number} x2 - The x2 coordinate. + * @param {number} y2 - The y2 coordinate. + * + * @return {number} The length of the line. + */ +function GetLength (x1, y1, x2, y2) +{ + var x = x1 - x2; + var y = y1 - y2; + var magnitude = (x * x) + (y * y); + + return Math.sqrt(magnitude); +} + +/** + * @classdesc + * A Face Geometry Object. + * + * A Face is used by the Mesh Game Object. A Mesh consists of one, or more, faces that are + * used to render the Mesh Game Objects in WebGL. + * + * A Face consists of 3 Vertex instances, for the 3 corners of the face and methods to help + * you modify and test them. + * + * @class Face + * @memberof Phaser.Geom.Mesh + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Geom.Mesh.Vertex} vertex1 - The first vertex of the Face. + * @param {Phaser.Geom.Mesh.Vertex} vertex2 - The second vertex of the Face. + * @param {Phaser.Geom.Mesh.Vertex} vertex3 - The third vertex of the Face. + */ +var Face = new Class({ + + initialize: + + function Face (vertex1, vertex2, vertex3) + { + /** + * The first vertex in this Face. + * + * @name Phaser.Geom.Mesh.Face#vertex1 + * @type {Phaser.Geom.Mesh.Vertex} + * @since 3.50.0 + */ + this.vertex1 = vertex1; + + /** + * The second vertex in this Face. + * + * @name Phaser.Geom.Mesh.Face#vertex2 + * @type {Phaser.Geom.Mesh.Vertex} + * @since 3.50.0 + */ + this.vertex2 = vertex2; + + /** + * The third vertex in this Face. + * + * @name Phaser.Geom.Mesh.Face#vertex3 + * @type {Phaser.Geom.Mesh.Vertex} + * @since 3.50.0 + */ + this.vertex3 = vertex3; + + /** + * The bounds of this Face. + * + * Be sure to call the `Face.updateBounds` method _before_ using this property. + * + * @name Phaser.Geom.Mesh.Face#bounds + * @type {Phaser.Geom.Rectangle} + * @since 3.50.0 + */ + this.bounds = new Rectangle(); + + /** + * The face inCenter. Do not access directly, instead use the `getInCenter` method. + * + * @name Phaser.Geom.Mesh.Face#_inCenter + * @type {Phaser.Math.Vector2} + * @private + * @since 3.50.0 + */ + this._inCenter = new Vector2(); }, /** - * Calculates and returns the largest possible zoom factor, based on the current - * parent and game sizes. If the parent has no dimensions (i.e. an unstyled div), - * or is smaller than the un-zoomed game, then this will return a value of 1 (no zoom) + * Calculates and returns the in-center position of this Face. * - * @method Phaser.Scale.ScaleManager#getMaxZoom - * @since 3.16.0 + * @method Phaser.Geom.Mesh.Face#getInCenter + * @since 3.50.0 * - * @return {number} The maximum possible zoom factor. At a minimum this value is always at least 1. + * @param {boolean} [local=true] Return the in center from the un-transformed vertex positions (`true`), or transformed? (`false`) + * + * @return {Phaser.Math.Vector2} A Vector2 containing the in center position of this Face. */ - getMaxZoom: function () + getInCenter: function (local) { - var zoomH = SnapFloor(this.parentSize.width, this.gameSize.width, 0, true); - var zoomV = SnapFloor(this.parentSize.height, this.gameSize.height, 0, true); + if (local === undefined) { local = true; } - return Math.max(Math.min(zoomH, zoomV), 1); + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + var v1x; + var v1y; + + var v2x; + var v2y; + + var v3x; + var v3y; + + if (local) + { + v1x = v1.x; + v1y = v1.y; + + v2x = v2.x; + v2y = v2.y; + + v3x = v3.x; + v3y = v3.y; + } + else + { + v1x = v1.vx; + v1y = v1.vy; + + v2x = v2.vx; + v2y = v2.vy; + + v3x = v3.vx; + v3y = v3.vy; + } + + var d1 = GetLength(v3x, v3y, v2x, v2y); + var d2 = GetLength(v1x, v1y, v3x, v3y); + var d3 = GetLength(v2x, v2y, v1x, v1y); + + var p = d1 + d2 + d3; + + return this._inCenter.set( + (v1x * d1 + v2x * d2 + v3x * d3) / p, + (v1y * d1 + v2y * d2 + v3y * d3) / p + ); }, /** - * Calculates and updates the canvas CSS style in order to center it within the - * bounds of its parent. If you have explicitly set parent to be `null` in your - * game config then this method will likely give incorrect results unless you have called the - * `setParentSize` method first. + * Checks if the given coordinates are within this Face. * - * It works by modifying the canvas CSS `marginLeft` and `marginTop` properties. + * You can optionally provide a transform matrix. If given, the Face vertices + * will be transformed first, before being checked against the coordinates. * - * If they have already been set by your own style sheet, or code, this will overwrite them. + * @method Phaser.Geom.Mesh.Face#contains + * @since 3.50.0 * - * To prevent the Scale Manager from centering the canvas, either do not set the - * `autoCenter` property in your game config, or make sure it is set to `NO_CENTER`. + * @param {number} x - The horizontal position to check. + * @param {number} y - The vertical position to check. + * @param {Phaser.GameObjects.Components.TransformMatrix} [calcMatrix] - Optional transform matrix to apply to the vertices before comparison. * - * @method Phaser.Scale.ScaleManager#updateCenter - * @since 3.16.0 + * @return {boolean} `true` if the coordinates lay within this Face, otherwise `false`. */ - updateCenter: function () + contains: function (x, y, calcMatrix) { - var autoCenter = this.autoCenter; + var vertex1 = this.vertex1; + var vertex2 = this.vertex2; + var vertex3 = this.vertex3; - if (autoCenter === CONST.CENTER.NO_CENTER) + var v1x = vertex1.vx; + var v1y = vertex1.vy; + + var v2x = vertex2.vx; + var v2y = vertex2.vy; + + var v3x = vertex3.vx; + var v3y = vertex3.vy; + + if (calcMatrix) { - return; + var a = calcMatrix.a; + var b = calcMatrix.b; + var c = calcMatrix.c; + var d = calcMatrix.d; + var e = calcMatrix.e; + var f = calcMatrix.f; + + v1x = vertex1.vx * a + vertex1.vy * c + e; + v1y = vertex1.vx * b + vertex1.vy * d + f; + + v2x = vertex2.vx * a + vertex2.vy * c + e; + v2y = vertex2.vx * b + vertex2.vy * d + f; + + v3x = vertex3.vx * a + vertex3.vy * c + e; + v3y = vertex3.vx * b + vertex3.vy * d + f; } - var canvas = this.canvas; + var t0x = v3x - v1x; + var t0y = v3y - v1y; - var style = canvas.style; + var t1x = v2x - v1x; + var t1y = v2y - v1y; - var bounds = canvas.getBoundingClientRect(); + var t2x = x - v1x; + var t2y = y - v1y; - // var width = parseInt(canvas.style.width, 10) || canvas.width; - // var height = parseInt(canvas.style.height, 10) || canvas.height; + var dot00 = (t0x * t0x) + (t0y * t0y); + var dot01 = (t0x * t1x) + (t0y * t1y); + var dot02 = (t0x * t2x) + (t0y * t2y); + var dot11 = (t1x * t1x) + (t1y * t1y); + var dot12 = (t1x * t2x) + (t1y * t2y); - var width = bounds.width; - var height = bounds.height; + // Compute barycentric coordinates + var bc = ((dot00 * dot11) - (dot01 * dot01)); + var inv = (bc === 0) ? 0 : (1 / bc); + var u = ((dot11 * dot02) - (dot01 * dot12)) * inv; + var v = ((dot00 * dot12) - (dot01 * dot02)) * inv; - var offsetX = Math.floor((this.parentSize.width - width) / 2); - var offsetY = Math.floor((this.parentSize.height - height) / 2); + return (u >= 0 && v >= 0 && (u + v < 1)); + }, - if (autoCenter === CONST.CENTER.CENTER_HORIZONTALLY) - { - offsetY = 0; - } - else if (autoCenter === CONST.CENTER.CENTER_VERTICALLY) - { - offsetX = 0; - } + /** + * Checks if the vertices in this Face are orientated counter-clockwise, or not. + * + * It checks the transformed position of the vertices, not the local one. + * + * @method Phaser.Geom.Mesh.Face#isCounterClockwise + * @since 3.50.0 + * + * @param {number} z - The z-axis value to test against. Typically the `Mesh.modelPosition.z`. + * + * @return {boolean} `true` if the vertices in this Face run counter-clockwise, otherwise `false`. + */ + isCounterClockwise: function (z) + { + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; - style.marginLeft = offsetX + 'px'; - style.marginTop = offsetY + 'px'; + var d = (v2.vx - v1.vx) * (v3.vy - v1.vy) - (v2.vy - v1.vy) * (v3.vx - v1.vx); + + return (z <= 0) ? d >= 0 : d < 0; }, /** - * Updates the `canvasBounds` rectangle to match the bounding client rectangle of the - * canvas element being used to track input events. + * Loads the data from this Vertex into the given Typed Arrays. * - * @method Phaser.Scale.ScaleManager#updateBounds - * @since 3.16.0 + * @method Phaser.Geom.Mesh.Face#load + * @since 3.50.0 + * + * @param {Float32Array} F32 - A Float32 Array to insert the position, UV and unit data in to. + * @param {Uint32Array} U32 - A Uint32 Array to insert the color and alpha data in to. + * @param {number} offset - The index of the array to insert this Vertex to. + * @param {number} textureUnit - The texture unit currently in use. + * @param {number} tintEffect - The tint effect to use. + * + * @return {number} The new vertex index array offset. */ - updateBounds: function () + load: function (F32, U32, offset, textureUnit, tintEffect) { - var bounds = this.canvasBounds; - var clientRect = this.canvas.getBoundingClientRect(); + offset = this.vertex1.load(F32, U32, offset, textureUnit, tintEffect); + offset = this.vertex2.load(F32, U32, offset, textureUnit, tintEffect); + offset = this.vertex3.load(F32, U32, offset, textureUnit, tintEffect); - bounds.x = clientRect.left + (window.pageXOffset || 0) - (document.documentElement.clientLeft || 0); - bounds.y = clientRect.top + (window.pageYOffset || 0) - (document.documentElement.clientTop || 0); - bounds.width = clientRect.width; - bounds.height = clientRect.height; + return offset; }, /** - * Transforms the pageX value into the scaled coordinate space of the Scale Manager. + * Transforms all Face vertices by the given matrix, storing the results in their `vx`, `vy` and `vz` properties. * - * @method Phaser.Scale.ScaleManager#transformX - * @since 3.16.0 + * @method Phaser.Geom.Mesh.Face#transformCoordinatesLocal + * @since 3.50.0 * - * @param {number} pageX - The DOM pageX value. + * @param {Phaser.Math.Matrix4} transformMatrix - The transform matrix to apply to this vertex. + * @param {number} width - The width of the parent Mesh. + * @param {number} height - The height of the parent Mesh. + * @param {number} cameraZ - The z position of the MeshCamera. * - * @return {number} The translated value. + * @return {this} This Face instance. */ - transformX: function (pageX) + transformCoordinatesLocal: function (transformMatrix, width, height, cameraZ) { - return (pageX - this.canvasBounds.left) * this.displayScale.x; + this.vertex1.transformCoordinatesLocal(transformMatrix, width, height, cameraZ); + this.vertex2.transformCoordinatesLocal(transformMatrix, width, height, cameraZ); + this.vertex3.transformCoordinatesLocal(transformMatrix, width, height, cameraZ); + + return this; }, /** - * Transforms the pageY value into the scaled coordinate space of the Scale Manager. + * Updates the bounds of this Face, based on the translated values of the vertices. * - * @method Phaser.Scale.ScaleManager#transformY - * @since 3.16.0 + * Call this method prior to accessing the `Face.bounds` property. * - * @param {number} pageY - The DOM pageY value. + * @method Phaser.Geom.Mesh.Face#updateBounds + * @since 3.50.0 * - * @return {number} The translated value. + * @return {this} This Face instance. */ - transformY: function (pageY) + updateBounds: function () { - return (pageY - this.canvasBounds.top) * this.displayScale.y; + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + var bounds = this.bounds; + + bounds.x = Math.min(v1.vx, v2.vx, v3.vx); + bounds.y = Math.min(v1.vy, v2.vy, v3.vy); + bounds.width = Math.max(v1.vx, v2.vx, v3.vx) - bounds.x; + bounds.height = Math.max(v1.vy, v2.vy, v3.vy) - bounds.y; + + return this; }, /** - * Sends a request to the browser to ask it to go in to full screen mode, using the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API Fullscreen API}. + * Checks if this Face is within the view of the given Camera. * - * If the browser does not support this, a `FULLSCREEN_UNSUPPORTED` event will be emitted. + * This method is called in the `MeshWebGLRenderer` function. It performs the following tasks: * - * This method _must_ be called from a `pointerup` user-input gesture (**not** `pointerdown`). You cannot launch - * games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked - * from fullscreen unless the iframe has the `allowfullscreen` attribute. + * First, the `Vertex.update` method is called on each of the vertices. This populates them + * with the new translated values, updating their `tx`, `ty` and `ta` properties. * - * On touch devices, such as Android and iOS Safari, you should always use `pointerup` and NOT `pointerdown`, - * otherwise the request will fail unless the document in which your game is embedded has already received - * some form of touch input, which you cannot guarantee. Activating fullscreen via `pointerup` circumvents - * this issue. + * Then it tests to see if this face is visible due to the alpha values, if not, it returns. * - * Performing an action that navigates to another page, or opens another tab, will automatically cancel - * fullscreen mode, as will the user pressing the ESC key. To cancel fullscreen mode directly from your game, - * i.e. by clicking an icon, call the `stopFullscreen` method. + * After this, if `hideCCW` is set, it calls `isCounterClockwise` and returns if not. * - * A browser can only send one DOM element into fullscreen. You can control which element this is by - * setting the `fullscreenTarget` property in your game config, or changing the property in the Scale Manager. - * Note that the game canvas _must_ be a child of the target. If you do not give a target, Phaser will - * automatically create a blank `
` element and move the canvas into it, before going fullscreen. - * When it leaves fullscreen, the div will be removed. + * Finally, it will update the `Face.bounds` based on the newly translated vertex values + * and return the results of an intersection test between the bounds and the camera world view + * rectangle. * - * @method Phaser.Scale.ScaleManager#startFullscreen - * @fires Phaser.Scale.Events#ENTER_FULLSCREEN - * @fires Phaser.Scale.Events#FULLSCREEN_FAILED - * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED - * @fires Phaser.Scale.Events#RESIZE - * @since 3.16.0 + * @method Phaser.Geom.Mesh.Face#isInView + * @since 3.50.0 * - * @param {object} [fullscreenOptions] - The FullscreenOptions dictionary is used to provide configuration options when entering full screen. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against. + * @param {boolean} hideCCW - Test the counter-clockwise orientation of the verts? + * @param {number} z - The Cameras z position, used in the CCW test. + * @param {number} alpha - The alpha of the parent object. + * @param {number} a - The parent transform matrix data a component. + * @param {number} b - The parent transform matrix data b component. + * @param {number} c - The parent transform matrix data c component. + * @param {number} d - The parent transform matrix data d component. + * @param {number} e - The parent transform matrix data e component. + * @param {number} f - The parent transform matrix data f component. + * @param {boolean} roundPixels - Round the vertex position or not? + * + * @return {boolean} `true` if this Face can be seen by the Camera. */ - startFullscreen: function (fullscreenOptions) + isInView: function (camera, hideCCW, z, alpha, a, b, c, d, e, f, roundPixels) { - if (fullscreenOptions === undefined) { fullscreenOptions = { navigationUI: 'hide' }; } + this.update(alpha, a, b, c, d, e, f, roundPixels); - var fullscreen = this.fullscreen; + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; - if (!fullscreen.available) + // Alpha check first + if (v1.ta <= 0 && v2.ta <= 0 && v3.ta <= 0) { - this.emit(Events.FULLSCREEN_UNSUPPORTED); - - return; + return false; } - if (!fullscreen.active) + // CCW check + if (hideCCW && !this.isCounterClockwise(z)) { - var fsTarget = this.getFullscreenTarget(); + return false; + } - if (fullscreen.keyboard) - { - fsTarget[fullscreen.request](Element.ALLOW_KEYBOARD_INPUT); - } - else - { - fsTarget[fullscreen.request](fullscreenOptions); - } + // Bounds check + var bounds = this.bounds; + + bounds.x = Math.min(v1.tx, v2.tx, v3.tx); + bounds.y = Math.min(v1.ty, v2.ty, v3.ty); + bounds.width = Math.max(v1.tx, v2.tx, v3.tx) - bounds.x; + bounds.height = Math.max(v1.ty, v2.ty, v3.ty) - bounds.y; + + var cr = camera.x + camera.width; + var cb = camera.y + camera.height; + + if (bounds.width <= 0 || bounds.height <= 0 || camera.width <= 0 || camera.height <= 0) + { + return false; } + + return !(bounds.right < camera.x || bounds.bottom < camera.y || bounds.x > cr || bounds.y > cb); }, /** - * The browser has successfully entered fullscreen mode. + * Translates the original UV positions of each vertex by the given amounts. * - * @method Phaser.Scale.ScaleManager#fullscreenSuccessHandler - * @private - * @fires Phaser.Scale.Events#ENTER_FULLSCREEN - * @fires Phaser.Scale.Events#RESIZE - * @since 3.17.0 + * The original properties `Vertex.u` and `Vertex.v` + * remain unchanged, only the translated properties + * `Vertex.tu` and `Vertex.tv`, as used in rendering, + * are updated. + * + * @method Phaser.Geom.Mesh.Face#scrollUV + * @since 3.60.0 + * + * @param {number} x - The amount to scroll the UV u coordinate by. + * @param {number} y - The amount to scroll the UV v coordinate by. + * + * @return {this} This Face instance. */ - fullscreenSuccessHandler: function () + scrollUV: function (x, y) { - this.getParentBounds(); - - this.refresh(); + this.vertex1.scrollUV(x, y); + this.vertex2.scrollUV(x, y); + this.vertex3.scrollUV(x, y); - this.emit(Events.ENTER_FULLSCREEN); + return this; }, /** - * The browser failed to enter fullscreen mode. + * Scales the original UV values of each vertex by the given amounts. * - * @method Phaser.Scale.ScaleManager#fullscreenErrorHandler - * @private - * @fires Phaser.Scale.Events#FULLSCREEN_FAILED - * @fires Phaser.Scale.Events#RESIZE - * @since 3.17.0 + * The original properties `Vertex.u` and `Vertex.v` + * remain unchanged, only the translated properties + * `Vertex.tu` and `Vertex.tv`, as used in rendering, + * are updated. * - * @param {any} error - The DOM error event. + * @method Phaser.Geom.Mesh.Face#scaleUV + * @since 3.60.0 + * + * @param {number} x - The amount to scale the UV u coordinate by. + * @param {number} y - The amount to scale the UV v coordinate by. + * + * @return {this} This Face instance. */ - fullscreenErrorHandler: function (error) + scaleUV: function (x, y) { - this.removeFullscreenTarget(); + this.vertex1.scaleUV(x, y); + this.vertex2.scaleUV(x, y); + this.vertex3.scaleUV(x, y); - this.emit(Events.FULLSCREEN_FAILED, error); + return this; }, /** - * An internal method that gets the target element that is used when entering fullscreen mode. + * Sets the color value for each Vertex in this Face. * - * @method Phaser.Scale.ScaleManager#getFullscreenTarget - * @since 3.16.0 + * @method Phaser.Geom.Mesh.Face#setColor + * @since 3.60.0 * - * @return {object} The fullscreen target element. + * @param {number} color - The color value for each vertex. + * + * @return {this} This Face instance. */ - getFullscreenTarget: function () + setColor: function (color) { - if (!this.fullscreenTarget) - { - var fsTarget = document.createElement('div'); - - fsTarget.style.margin = '0'; - fsTarget.style.padding = '0'; - fsTarget.style.width = '100%'; - fsTarget.style.height = '100%'; - - this.fullscreenTarget = fsTarget; + this.vertex1.color = color; + this.vertex2.color = color; + this.vertex3.color = color; - this._createdFullscreenTarget = true; - } - - if (this._createdFullscreenTarget) - { - var canvasParent = this.canvas.parentNode; - - canvasParent.insertBefore(this.fullscreenTarget, this.canvas); - - this.fullscreenTarget.appendChild(this.canvas); - } - - return this.fullscreenTarget; - }, + return this; + }, /** - * Removes the fullscreen target that was added to the DOM. + * Calls the `Vertex.update` method on each of the vertices. This populates them + * with the new translated values, updating their `tx`, `ty` and `ta` properties. * - * @method Phaser.Scale.ScaleManager#removeFullscreenTarget - * @since 3.17.0 - */ - removeFullscreenTarget: function () - { - if (this._createdFullscreenTarget) - { - var fsTarget = this.fullscreenTarget; - - if (fsTarget && fsTarget.parentNode) - { - var parent = fsTarget.parentNode; - - parent.insertBefore(this.canvas, fsTarget); - - parent.removeChild(fsTarget); - } - } - }, - - /** - * Calling this method will cancel fullscreen mode, if the browser has entered it. + * @method Phaser.Geom.Mesh.Face#update + * @since 3.60.0 * - * @method Phaser.Scale.ScaleManager#stopFullscreen - * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN - * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED - * @since 3.16.0 + * @param {number} alpha - The alpha of the parent object. + * @param {number} a - The parent transform matrix data a component. + * @param {number} b - The parent transform matrix data b component. + * @param {number} c - The parent transform matrix data c component. + * @param {number} d - The parent transform matrix data d component. + * @param {number} e - The parent transform matrix data e component. + * @param {number} f - The parent transform matrix data f component. + * @param {boolean} roundPixels - Round the vertex position or not? + * + * @return {this} This Face instance. */ - stopFullscreen: function () + update: function (alpha, a, b, c, d, e, f, roundPixels) { - var fullscreen = this.fullscreen; - - if (!fullscreen.available) - { - this.emit(Events.FULLSCREEN_UNSUPPORTED); - - return false; - } - - if (fullscreen.active) - { - document[fullscreen.cancel](); - } - - this.removeFullscreenTarget(); - - // Get the parent size again as it will have changed - this.getParentBounds(); + this.vertex1.update(a, b, c, d, e, f, roundPixels, alpha); + this.vertex2.update(a, b, c, d, e, f, roundPixels, alpha); + this.vertex3.update(a, b, c, d, e, f, roundPixels, alpha); - this.emit(Events.LEAVE_FULLSCREEN); - - this.refresh(); + return this; }, /** - * Toggles the fullscreen mode. If already in fullscreen, calling this will cancel it. - * If not in fullscreen, this will request the browser to enter fullscreen mode. + * Translates the vertices of this Face by the given amounts. * - * If the browser does not support this, a `FULLSCREEN_UNSUPPORTED` event will be emitted. + * The actual vertex positions are adjusted, not their transformed position. * - * This method _must_ be called from a user-input gesture, such as `pointerdown`. You cannot launch - * games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked - * from fullscreen unless the iframe has the `allowfullscreen` attribute. + * Therefore, this updates the vertex data directly. * - * @method Phaser.Scale.ScaleManager#toggleFullscreen - * @fires Phaser.Scale.Events#ENTER_FULLSCREEN - * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN - * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED - * @fires Phaser.Scale.Events#RESIZE - * @since 3.16.0 + * @method Phaser.Geom.Mesh.Face#translate + * @since 3.50.0 * - * @param {object} [fullscreenOptions] - The FullscreenOptions dictionary is used to provide configuration options when entering full screen. - */ - toggleFullscreen: function (fullscreenOptions) - { - if (this.fullscreen.active) - { - this.stopFullscreen(); - } - else - { - this.startFullscreen(fullscreenOptions); - } - }, - - /** - * An internal method that starts the different DOM event listeners running. + * @param {number} x - The amount to horizontally translate by. + * @param {number} [y=0] - The amount to vertically translate by. * - * @method Phaser.Scale.ScaleManager#startListeners - * @since 3.16.0 + * @return {this} This Face instance. */ - startListeners: function () + translate: function (x, y) { - var _this = this; - var listeners = this.listeners; - - listeners.orientationChange = function () - { - _this.updateBounds(); - - _this._checkOrientation = true; - _this.dirty = true; - }; - - listeners.windowResize = function () - { - _this.updateBounds(); - - _this.dirty = true; - }; - - // Only dispatched on mobile devices - window.addEventListener('orientationchange', listeners.orientationChange, false); - - window.addEventListener('resize', listeners.windowResize, false); - - if (this.fullscreen.available) - { - listeners.fullScreenChange = function (event) - { - return _this.onFullScreenChange(event); - }; + if (y === undefined) { y = 0; } - listeners.fullScreenError = function (event) - { - return _this.onFullScreenError(event); - }; + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; - var vendors = [ 'webkit', 'moz', '' ]; + v1.x += x; + v1.y += y; - vendors.forEach(function (prefix) - { - document.addEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); - document.addEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); - }); + v2.x += x; + v2.y += y; - // MS Specific - document.addEventListener('MSFullscreenChange', listeners.fullScreenChange, false); - document.addEventListener('MSFullscreenError', listeners.fullScreenError, false); - } - }, + v3.x += x; + v3.y += y; - /** - * Triggered when a fullscreenchange event is dispatched by the DOM. - * - * @method Phaser.Scale.ScaleManager#onFullScreenChange - * @protected - * @since 3.16.0 - */ - onFullScreenChange: function () - { - if (document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement || document.mozFullScreenElement) - { - this.fullscreenSuccessHandler(); - } - else - { - // They pressed ESC while in fullscreen mode - this.stopFullscreen(); - } + return this; }, /** - * Triggered when a fullscreenerror event is dispatched by the DOM. + * The x coordinate of this Face, based on the in center position of the Face. * - * @method Phaser.Scale.ScaleManager#onFullScreenError - * @since 3.16.0 + * @name Phaser.Geom.Mesh.Face#x + * @type {number} + * @since 3.50.0 */ - onFullScreenError: function () - { - this.removeFullscreenTarget(); - }, + x: { - /** - * Internal method, called automatically by the game step. - * Monitors the elapsed time and resize interval to see if a parent bounds check needs to take place. - * - * @method Phaser.Scale.ScaleManager#step - * @since 3.16.0 - * - * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). - * @param {number} delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class. - */ - step: function (time, delta) - { - if (!this.parent) + get: function () { - return; - } - - this._lastCheck += delta; + return this.getInCenter().x; + }, - if (this.dirty || this._lastCheck > this.resizeInterval) + set: function (value) { - // Returns true if the parent bounds have changed size - if (this.getParentBounds()) - { - this.refresh(); - } + var current = this.getInCenter(); - this.dirty = false; - this._lastCheck = 0; + this.translate(value - current.x, 0); } - }, - - /** - * Stops all DOM event listeners. - * - * @method Phaser.Scale.ScaleManager#stopListeners - * @since 3.16.0 - */ - stopListeners: function () - { - var listeners = this.listeners; - - window.removeEventListener('orientationchange', listeners.orientationChange, false); - window.removeEventListener('resize', listeners.windowResize, false); - - var vendors = [ 'webkit', 'moz', '' ]; - - vendors.forEach(function (prefix) - { - document.removeEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); - document.removeEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); - }); - - // MS Specific - document.removeEventListener('MSFullscreenChange', listeners.fullScreenChange, false); - document.removeEventListener('MSFullscreenError', listeners.fullScreenError, false); - }, - - /** - * Destroys this Scale Manager, releasing all references to external resources. - * Once destroyed, the Scale Manager cannot be used again. - * - * @method Phaser.Scale.ScaleManager#destroy - * @since 3.16.0 - */ - destroy: function () - { - this.removeAllListeners(); - - this.stopListeners(); - - this.game = null; - this.canvas = null; - this.canvasBounds = null; - this.parent = null; - this.fullscreenTarget = null; - this.parentSize.destroy(); - this.gameSize.destroy(); - this.baseSize.destroy(); - this.displaySize.destroy(); }, /** - * Is the browser currently in fullscreen mode or not? + * The y coordinate of this Face, based on the in center position of the Face. * - * @name Phaser.Scale.ScaleManager#isFullscreen - * @type {boolean} - * @readonly - * @since 3.16.0 + * @name Phaser.Geom.Mesh.Face#y + * @type {number} + * @since 3.50.0 */ - isFullscreen: { + y: { get: function () { - return this.fullscreen.active; - } - - }, - - /** - * The game width. - * - * This is typically the size given in the game configuration. - * - * @name Phaser.Scale.ScaleManager#width - * @type {number} - * @readonly - * @since 3.16.0 - */ - width: { + return this.getInCenter().y; + }, - get: function () + set: function (value) { - return this.gameSize.width; + var current = this.getInCenter(); + + this.translate(0, value - current.y); } }, /** - * The game height. + * Set the alpha value of this Face. * - * This is typically the size given in the game configuration. + * Each vertex is given the same value. If you need to adjust the alpha on a per-vertex basis + * then use the `Vertex.alpha` property instead. * - * @name Phaser.Scale.ScaleManager#height - * @type {number} - * @readonly - * @since 3.16.0 - */ - height: { - - get: function () - { - return this.gameSize.height; - } - - }, - - /** - * Is the device in a portrait orientation as reported by the Orientation API? - * This value is usually only available on mobile devices. + * When getting the alpha of this Face, it will return an average of the alpha + * component of all three vertices. * - * @name Phaser.Scale.ScaleManager#isPortrait - * @type {boolean} - * @readonly - * @since 3.16.0 + * @name Phaser.Geom.Mesh.Face#alpha + * @type {number} + * @since 3.50.0 */ - isPortrait: { + alpha: { get: function () { - return (this.orientation === CONST.ORIENTATION.PORTRAIT); - } - - }, + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; - /** - * Is the device in a landscape orientation as reported by the Orientation API? - * This value is usually only available on mobile devices. - * - * @name Phaser.Scale.ScaleManager#isLandscape - * @type {boolean} - * @readonly - * @since 3.16.0 - */ - isLandscape: { + return (v1.alpha + v2.alpha + v3.alpha) / 3; + }, - get: function () + set: function (value) { - return (this.orientation === CONST.ORIENTATION.LANDSCAPE); + this.vertex1.alpha = value; + this.vertex2.alpha = value; + this.vertex3.alpha = value; } }, /** - * Are the game dimensions portrait? (i.e. taller than they are wide) + * The depth of this Face, which is an average of the z component of all three vertices. * - * This is different to the device itself being in a portrait orientation. + * The depth is calculated based on the transformed z value, not the local one. * - * @name Phaser.Scale.ScaleManager#isGamePortrait - * @type {boolean} + * @name Phaser.Geom.Mesh.Face#depth + * @type {number} * @readonly - * @since 3.16.0 + * @since 3.50.0 */ - isGamePortrait: { + depth: { get: function () { - return (this.height > this.width); + var v1 = this.vertex1; + var v2 = this.vertex2; + var v3 = this.vertex3; + + return (v1.vz + v2.vz + v3.vz) / 3; } }, /** - * Are the game dimensions landscape? (i.e. wider than they are tall) - * - * This is different to the device itself being in a landscape orientation. + * Destroys this Face and nulls the references to the vertices. * - * @name Phaser.Scale.ScaleManager#isGameLandscape - * @type {boolean} - * @readonly - * @since 3.16.0 + * @method Phaser.Geom.Mesh.Face#destroy + * @since 3.50.0 */ - isGameLandscape: { - - get: function () - { - return (this.width > this.height); - } - + destroy: function () + { + this.vertex1 = null; + this.vertex2 = null; + this.vertex3 = null; } }); -module.exports = ScaleManager; +module.exports = Face; /***/ }), -/* 416 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 99425: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(18); -var Class = __webpack_require__(0); -var SnapFloor = __webpack_require__(76); -var Vector2 = __webpack_require__(3); +var Face = __webpack_require__(18693); +var GetFastValue = __webpack_require__(72632); +var Matrix4 = __webpack_require__(16650); +var Vector3 = __webpack_require__(70015); +var Vertex = __webpack_require__(85769); + +var tempPosition = new Vector3(); +var tempRotation = new Vector3(); +var tempMatrix = new Matrix4(); /** - * @classdesc - * The Size component allows you to set `width` and `height` properties and define the relationship between them. - * - * The component can automatically maintain the aspect ratios between the two values, and clamp them - * to a defined min-max range. You can also control the dominant axis. When dimensions are given to the Size component - * that would cause it to exceed its min-max range, the dimensions are adjusted based on the dominant axis. + * Creates a grid of vertices based on the given configuration object and optionally adds it to a Mesh. * - * @class Size - * @memberof Phaser.Structs - * @constructor - * @since 3.16.0 + * The size of the grid is given in pixels. An example configuration may be: * - * @param {number} [width=0] - The width of the Size component. - * @param {number} [height=width] - The height of the Size component. If not given, it will use the `width`. - * @param {number} [aspectMode=0] - The aspect mode of the Size component. Defaults to 0, no mode. - * @param {any} [parent=null] - The parent of this Size component. Can be any object with public `width` and `height` properties. Dimensions are clamped to keep them within the parent bounds where possible. + * `{ width: 256, height: 256, widthSegments: 2, heightSegments: 2, tile: true }` + * + * This will create a grid 256 x 256 pixels in size, split into 2 x 2 segments, with + * the texture tiling across the cells. + * + * You can split the grid into segments both vertically and horizontally. This will + * generate two faces per grid segment as a result. + * + * The `tile` parameter allows you to control if the tile will repeat across the grid + * segments, or be displayed in full. + * + * If adding this grid to a Mesh you can offset the grid via the `x` and `y` properties. + * + * UV coordinates are generated based on the given texture and frame in the config. For + * example, no frame is given, the UVs will be in the range 0 to 1. If a frame is given, + * such as from a texture atlas, the UVs will be generated within the range of that frame. + * + * @function Phaser.Geom.Mesh.GenerateGridVerts + * @since 3.50.0 + * + * @param {Phaser.Types.Geom.Mesh.GenerateGridConfig} config - A Grid configuration object. + * + * @return {Phaser.Types.Geom.Mesh.GenerateGridVertsResult} A Grid Result object, containing the generated vertices and indicies. */ -var Size = new Class({ +var GenerateGridVerts = function (config) +{ + var mesh = GetFastValue(config, 'mesh'); + var texture = GetFastValue(config, 'texture', null); + var frame = GetFastValue(config, 'frame'); + var width = GetFastValue(config, 'width', 1); + var height = GetFastValue(config, 'height', width); + var widthSegments = GetFastValue(config, 'widthSegments', 1); + var heightSegments = GetFastValue(config, 'heightSegments', widthSegments); + var posX = GetFastValue(config, 'x', 0); + var posY = GetFastValue(config, 'y', 0); + var posZ = GetFastValue(config, 'z', 0); + var rotateX = GetFastValue(config, 'rotateX', 0); + var rotateY = GetFastValue(config, 'rotateY', 0); + var rotateZ = GetFastValue(config, 'rotateZ', 0); + var zIsUp = GetFastValue(config, 'zIsUp', true); + var isOrtho = GetFastValue(config, 'isOrtho', (mesh) ? mesh.dirtyCache[11] : false); + var colors = GetFastValue(config, 'colors', [ 0xffffff ]); + var alphas = GetFastValue(config, 'alphas', [ 1 ]); + var tile = GetFastValue(config, 'tile', false); + var flipY = GetFastValue(config, 'flipY', false); - initialize: + var widthSet = GetFastValue(config, 'width', null); - function Size (width, height, aspectMode, parent) - { - if (width === undefined) { width = 0; } - if (height === undefined) { height = width; } - if (aspectMode === undefined) { aspectMode = 0; } - if (parent === undefined) { parent = null; } + var result = { + faces: [], + verts: [] + }; - /** - * Internal width value. - * - * @name Phaser.Structs.Size#_width - * @type {number} - * @private - * @since 3.16.0 - */ - this._width = width; + tempPosition.set(posX, posY, posZ); + tempRotation.set(rotateX, rotateY, rotateZ); + tempMatrix.fromRotationXYTranslation(tempRotation, tempPosition, zIsUp); - /** - * Internal height value. - * - * @name Phaser.Structs.Size#_height - * @type {number} - * @private - * @since 3.16.0 - */ - this._height = height; + var textureFrame; - /** - * Internal parent reference. - * - * @name Phaser.Structs.Size#_parent - * @type {any} - * @private - * @since 3.16.0 - */ - this._parent = parent; + if (!texture && mesh) + { + texture = mesh.texture; - /** - * The aspect mode this Size component will use when calculating its dimensions. - * This property is read-only. To change it use the `setAspectMode` method. - * - * @name Phaser.Structs.Size#aspectMode - * @type {number} - * @readonly - * @since 3.16.0 - */ - this.aspectMode = aspectMode; + if (!frame) + { + textureFrame = mesh.frame; + } + } + else if (mesh && typeof(texture) === 'string') + { + texture = mesh.scene.sys.textures.get(texture); + } + else if (!texture) + { + // There's nothing more we can do without a texture + return result; + } - /** - * The proportional relationship between the width and height. - * - * This property is read-only and is updated automatically when either the `width` or `height` properties are changed, - * depending on the aspect mode. - * - * @name Phaser.Structs.Size#aspectRatio - * @type {number} - * @readonly - * @since 3.16.0 - */ - this.aspectRatio = (height === 0) ? 1 : width / height; + if (!textureFrame) + { + textureFrame = texture.get(frame); + } - /** - * The minimum allowed width. - * Cannot be less than zero. - * This value is read-only. To change it see the `setMin` method. - * - * @name Phaser.Structs.Size#minWidth - * @type {number} - * @readonly - * @since 3.16.0 - */ - this.minWidth = 0; + // If the Mesh is ortho and no width / height is given, we'll default to texture sizes (if set!) + if (!widthSet && isOrtho && texture && mesh) + { + width = textureFrame.width / mesh.height; + height = textureFrame.height / mesh.height; + } - /** - * The minimum allowed height. - * Cannot be less than zero. - * This value is read-only. To change it see the `setMin` method. - * - * @name Phaser.Structs.Size#minHeight - * @type {number} - * @readonly - * @since 3.16.0 - */ - this.minHeight = 0; + var halfWidth = width / 2; + var halfHeight = height / 2; - /** - * The maximum allowed width. - * This value is read-only. To change it see the `setMax` method. - * - * @name Phaser.Structs.Size#maxWidth - * @type {number} - * @readonly - * @since 3.16.0 - */ - this.maxWidth = Number.MAX_VALUE; + var gridX = Math.floor(widthSegments); + var gridY = Math.floor(heightSegments); - /** - * The maximum allowed height. - * This value is read-only. To change it see the `setMax` method. - * - * @name Phaser.Structs.Size#maxHeight - * @type {number} - * @readonly - * @since 3.16.0 - */ - this.maxHeight = Number.MAX_VALUE; + var gridX1 = gridX + 1; + var gridY1 = gridY + 1; - /** - * A Vector2 containing the horizontal and vertical snap values, which the width and height are snapped to during resizing. - * - * By default this is disabled. - * - * This property is read-only. To change it see the `setSnap` method. - * - * @name Phaser.Structs.Size#snapTo - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.16.0 - */ - this.snapTo = new Vector2(); - }, + var segmentWidth = width / gridX; + var segmentHeight = height / gridY; - /** - * Sets the aspect mode of this Size component. - * - * The aspect mode controls what happens when you modify the `width` or `height` properties, or call `setSize`. - * - * It can be a number from 0 to 4, or a Size constant: - * - * 0. NONE = Do not make the size fit the aspect ratio. Change the ratio when the size changes. - * 1. WIDTH_CONTROLS_HEIGHT = The height is automatically adjusted based on the width. - * 2. HEIGHT_CONTROLS_WIDTH = The width is automatically adjusted based on the height. - * 3. FIT = The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered. - * 4. ENVELOP = The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size. - * - * Calling this method automatically recalculates the `width` and the `height`, if required. - * - * @method Phaser.Structs.Size#setAspectMode - * @since 3.16.0 - * - * @param {number} [value=0] - The aspect mode value. - * - * @return {this} This Size component instance. - */ - setAspectMode: function (value) - { - if (value === undefined) { value = 0; } + var uvs = []; + var vertices = []; - this.aspectMode = value; + var ix; + var iy; - return this.setSize(this._width, this._height); - }, + var frameU0 = 0; + var frameU1 = 1; + var frameV0 = 0; + var frameV1 = 1; - /** - * By setting a Snap To value when this Size component is modified its dimensions will automatically - * by snapped to the nearest grid slice, using floor. For example, if you have snap value of 16, - * and the width changes to 68, then it will snap down to 64 (the closest multiple of 16 when floored) - * - * Note that snapping takes place before adjustments by the parent, or the min / max settings. If these - * values are not multiples of the given snap values, then this can result in un-snapped dimensions. - * - * Call this method with no arguments to reset the snap values. - * - * Calling this method automatically recalculates the `width` and the `height`, if required. - * - * @method Phaser.Structs.Size#setSnap - * @since 3.16.0 - * - * @param {number} [snapWidth=0] - The amount to snap the width to. If you don't want to snap the width, pass a value of zero. - * @param {number} [snapHeight=snapWidth] - The amount to snap the height to. If not provided it will use the `snapWidth` value. If you don't want to snap the height, pass a value of zero. - * - * @return {this} This Size component instance. - */ - setSnap: function (snapWidth, snapHeight) + if (textureFrame) { - if (snapWidth === undefined) { snapWidth = 0; } - if (snapHeight === undefined) { snapHeight = snapWidth; } + frameU0 = textureFrame.u0; + frameU1 = textureFrame.u1; - this.snapTo.set(snapWidth, snapHeight); + if (!flipY) + { + frameV0 = textureFrame.v0; + frameV1 = textureFrame.v1; + } + else + { + frameV0 = textureFrame.v1; + frameV1 = textureFrame.v0; + } + } - return this.setSize(this._width, this._height); - }, + var frameU = frameU1 - frameU0; + var frameV = frameV1 - frameV0; - /** - * Sets, or clears, the parent of this Size component. - * - * To clear the parent call this method with no arguments. - * - * The parent influences the maximum extents to which this Size component can expand, - * based on the aspect mode: - * - * NONE - The parent clamps both the width and height. - * WIDTH_CONTROLS_HEIGHT - The parent clamps just the width. - * HEIGHT_CONTROLS_WIDTH - The parent clamps just the height. - * FIT - The parent clamps whichever axis is required to ensure the size fits within it. - * ENVELOP - The parent is used to ensure the size fully envelops the parent. - * - * Calling this method automatically calls `setSize`. - * - * @method Phaser.Structs.Size#setParent - * @since 3.16.0 - * - * @param {any} [parent] - Sets the parent of this Size component. Don't provide a value to clear an existing parent. - * - * @return {this} This Size component instance. - */ - setParent: function (parent) + for (iy = 0; iy < gridY1; iy++) { - this._parent = parent; + var y = iy * segmentHeight - halfHeight; - return this.setSize(this._width, this._height); - }, + for (ix = 0; ix < gridX1; ix++) + { + var x = ix * segmentWidth - halfWidth; - /** - * Set the minimum width and height values this Size component will allow. - * - * The minimum values can never be below zero, or greater than the maximum values. - * - * Setting this will automatically adjust both the `width` and `height` properties to ensure they are within range. - * - * Note that based on the aspect mode, and if this Size component has a parent set or not, the minimums set here - * _can_ be exceed in some situations. - * - * @method Phaser.Structs.Size#setMin - * @since 3.16.0 - * - * @param {number} [width=0] - The minimum allowed width of the Size component. - * @param {number} [height=width] - The minimum allowed height of the Size component. If not given, it will use the `width`. - * - * @return {this} This Size component instance. - */ - setMin: function (width, height) - { - if (width === undefined) { width = 0; } - if (height === undefined) { height = width; } + vertices.push(x, -y); - this.minWidth = Clamp(width, 0, this.maxWidth); - this.minHeight = Clamp(height, 0, this.maxHeight); + var tu = frameU0 + frameU * (ix / gridX); + var tv = frameV0 + frameV * (iy / gridY); - return this.setSize(this._width, this._height); - }, + uvs.push(tu, tv); + } + } - /** - * Set the maximum width and height values this Size component will allow. - * - * Setting this will automatically adjust both the `width` and `height` properties to ensure they are within range. - * - * Note that based on the aspect mode, and if this Size component has a parent set or not, the maximums set here - * _can_ be exceed in some situations. - * - * @method Phaser.Structs.Size#setMax - * @since 3.16.0 - * - * @param {number} [width=Number.MAX_VALUE] - The maximum allowed width of the Size component. - * @param {number} [height=width] - The maximum allowed height of the Size component. If not given, it will use the `width`. - * - * @return {this} This Size component instance. - */ - setMax: function (width, height) + if (!Array.isArray(colors)) { - if (width === undefined) { width = Number.MAX_VALUE; } - if (height === undefined) { height = width; } + colors = [ colors ]; + } - this.maxWidth = Clamp(width, this.minWidth, Number.MAX_VALUE); - this.maxHeight = Clamp(height, this.minHeight, Number.MAX_VALUE); + if (!Array.isArray(alphas)) + { + alphas = [ alphas ]; + } - return this.setSize(this._width, this._height); - }, + var alphaIndex = 0; + var colorIndex = 0; - /** - * Sets the width and height of this Size component based on the aspect mode. - * - * If the aspect mode is 'none' then calling this method will change the aspect ratio, otherwise the current - * aspect ratio is honored across all other modes. - * - * If snapTo values have been set then the given width and height are snapped first, prior to any further - * adjustment via min/max values, or a parent. - * - * If minimum and/or maximum dimensions have been specified, the values given to this method will be clamped into - * that range prior to adjustment, but may still exceed them depending on the aspect mode. - * - * If this Size component has a parent set, and the aspect mode is `fit` or `envelop`, then the given sizes will - * be clamped to the range specified by the parent. - * - * @method Phaser.Structs.Size#setSize - * @since 3.16.0 - * - * @param {number} [width=0] - The new width of the Size component. - * @param {number} [height=width] - The new height of the Size component. If not given, it will use the `width`. - * - * @return {this} This Size component instance. - */ - setSize: function (width, height) + for (iy = 0; iy < gridY; iy++) { - if (width === undefined) { width = 0; } - if (height === undefined) { height = width; } - - switch (this.aspectMode) + for (ix = 0; ix < gridX; ix++) { - case Size.NONE: - this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); - this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); - this.aspectRatio = (this._height === 0) ? 1 : this._width / this._height; - break; - - case Size.WIDTH_CONTROLS_HEIGHT: - this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); - this._height = this.getNewHeight(this._width * (1 / this.aspectRatio), false); - break; - - case Size.HEIGHT_CONTROLS_WIDTH: - this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); - this._width = this.getNewWidth(this._height * this.aspectRatio, false); - break; + var a = (ix + gridX1 * iy) * 2; + var b = (ix + gridX1 * (iy + 1)) * 2; + var c = ((ix + 1) + gridX1 * (iy + 1)) * 2; + var d = ((ix + 1) + gridX1 * iy) * 2; - case Size.FIT: - this.constrain(width, height, true); - break; + var color = colors[colorIndex]; + var alpha = alphas[alphaIndex]; - case Size.ENVELOP: - this.constrain(width, height, false); - break; - } + var vert1 = new Vertex(vertices[a], vertices[a + 1], 0, uvs[a], uvs[a + 1], color, alpha).transformMat4(tempMatrix); + var vert2 = new Vertex(vertices[b], vertices[b + 1], 0, uvs[b], uvs[b + 1], color, alpha).transformMat4(tempMatrix); + var vert3 = new Vertex(vertices[d], vertices[d + 1], 0, uvs[d], uvs[d + 1], color, alpha).transformMat4(tempMatrix); + var vert4 = new Vertex(vertices[b], vertices[b + 1], 0, uvs[b], uvs[b + 1], color, alpha).transformMat4(tempMatrix); + var vert5 = new Vertex(vertices[c], vertices[c + 1], 0, uvs[c], uvs[c + 1], color, alpha).transformMat4(tempMatrix); + var vert6 = new Vertex(vertices[d], vertices[d + 1], 0, uvs[d], uvs[d + 1], color, alpha).transformMat4(tempMatrix); - return this; - }, + if (tile) + { + vert1.setUVs(frameU0, frameV1); + vert2.setUVs(frameU0, frameV0); + vert3.setUVs(frameU1, frameV1); + vert4.setUVs(frameU0, frameV0); + vert5.setUVs(frameU1, frameV0); + vert6.setUVs(frameU1, frameV1); + } - /** - * Sets a new aspect ratio, overriding what was there previously. - * - * It then calls `setSize` immediately using the current dimensions. - * - * @method Phaser.Structs.Size#setAspectRatio - * @since 3.16.0 - * - * @param {number} ratio - The new aspect ratio. - * - * @return {this} This Size component instance. - */ - setAspectRatio: function (ratio) - { - this.aspectRatio = ratio; + colorIndex++; - return this.setSize(this._width, this._height); - }, + if (colorIndex === colors.length) + { + colorIndex = 0; + } - /** - * Sets a new width and height for this Size component and updates the aspect ratio based on them. - * - * It _doesn't_ change the `aspectMode` and still factors in size limits such as the min max and parent bounds. - * - * @method Phaser.Structs.Size#resize - * @since 3.16.0 - * - * @param {number} width - The new width of the Size component. - * @param {number} [height=width] - The new height of the Size component. If not given, it will use the `width`. - * - * @return {this} This Size component instance. - */ - resize: function (width, height) - { - this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); - this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); - this.aspectRatio = (this._height === 0) ? 1 : this._width / this._height; + alphaIndex++; - return this; - }, + if (alphaIndex === alphas.length) + { + alphaIndex = 0; + } - /** - * Takes a new width and passes it through the min/max clamp and then checks it doesn't exceed the parent width. - * - * @method Phaser.Structs.Size#getNewWidth - * @since 3.16.0 - * - * @param {number} value - The value to clamp and check. - * @param {boolean} [checkParent=true] - Check the given value against the parent, if set. - * - * @return {number} The modified width value. - */ - getNewWidth: function (value, checkParent) - { - if (checkParent === undefined) { checkParent = true; } - - value = Clamp(value, this.minWidth, this.maxWidth); + result.verts.push(vert1, vert2, vert3, vert4, vert5, vert6); - if (checkParent && this._parent && value > this._parent.width) - { - value = Math.max(this.minWidth, this._parent.width); + result.faces.push( + new Face(vert1, vert2, vert3), + new Face(vert4, vert5, vert6) + ); } + } - return value; - }, - - /** - * Takes a new height and passes it through the min/max clamp and then checks it doesn't exceed the parent height. - * - * @method Phaser.Structs.Size#getNewHeight - * @since 3.16.0 - * - * @param {number} value - The value to clamp and check. - * @param {boolean} [checkParent=true] - Check the given value against the parent, if set. - * - * @return {number} The modified height value. - */ - getNewHeight: function (value, checkParent) + if (mesh) { - if (checkParent === undefined) { checkParent = true; } - - value = Clamp(value, this.minHeight, this.maxHeight); - - if (checkParent && this._parent && value > this._parent.height) - { - value = Math.max(this.minHeight, this._parent.height); - } + mesh.faces = mesh.faces.concat(result.faces); + mesh.vertices = mesh.vertices.concat(result.verts); + } - return value; - }, + return result; +}; - /** - * The current `width` and `height` are adjusted to fit inside the given dimensions, while keeping the aspect ratio. - * - * If `fit` is true there may be some space inside the target area which is not covered if its aspect ratio differs. - * If `fit` is false the size may extend further out than the target area if the aspect ratios differ. - * - * If this Size component has a parent set, then the width and height passed to this method will be clamped so - * it cannot exceed that of the parent. - * - * @method Phaser.Structs.Size#constrain - * @since 3.16.0 - * - * @param {number} [width=0] - The new width of the Size component. - * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. - * @param {boolean} [fit=true] - Perform a `fit` (true) constraint, or an `envelop` (false) constraint. - * - * @return {this} This Size component instance. - */ - constrain: function (width, height, fit) - { - if (width === undefined) { width = 0; } - if (height === undefined) { height = width; } - if (fit === undefined) { fit = true; } +module.exports = GenerateGridVerts; - width = this.getNewWidth(width); - height = this.getNewHeight(height); - var snap = this.snapTo; - var newRatio = (height === 0) ? 1 : width / height; +/***/ }), - if ((fit && this.aspectRatio > newRatio) || (!fit && this.aspectRatio < newRatio)) - { - // We need to change the height to fit the width +/***/ 53267: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - width = SnapFloor(width, snap.x); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - height = width / this.aspectRatio; +var Face = __webpack_require__(18693); +var Matrix4 = __webpack_require__(16650); +var Vector3 = __webpack_require__(70015); +var Vertex = __webpack_require__(85769); - if (snap.y > 0) - { - height = SnapFloor(height, snap.y); +var tempPosition = new Vector3(); +var tempRotation = new Vector3(); +var tempMatrix = new Matrix4(); - // Reduce the width accordingly - width = height * this.aspectRatio; - } - } - else if ((fit && this.aspectRatio < newRatio) || (!fit && this.aspectRatio > newRatio)) - { - // We need to change the width to fit the height - - height = SnapFloor(height, snap.y); - - width = height * this.aspectRatio; - - if (snap.x > 0) - { - width = SnapFloor(width, snap.x); - - // Reduce the height accordingly - height = width * (1 / this.aspectRatio); - } - } - - this._width = width; - this._height = height; - - return this; - }, +/** + * This method will return an object containing Face and Vertex instances, generated + * from the parsed triangulated OBJ Model data given to this function. + * + * The obj data should have been parsed in advance via the ParseObj function: + * + * ```javascript + * var data = Phaser.Geom.Mesh.ParseObj(rawData, flipUV); + * + * var results = GenerateObjVerts(data); + * ``` + * + * Alternatively, you can parse obj files loaded via the OBJFile loader: + * + * ```javascript + * preload () + * { + * this.load.obj('alien', 'assets/3d/alien.obj); + * } + * + * var results = GenerateObjVerts(this.cache.obj.get('alien)); + * ``` + * + * Make sure your 3D package has triangulated the model data prior to exporting it. + * + * You can use the data returned by this function to populate the vertices of a Mesh Game Object. + * + * You may add multiple models to a single Mesh, although they will act as one when + * moved or rotated. You can scale the model data, should it be too small (or large) to visualize. + * You can also offset the model via the `x`, `y` and `z` parameters. + * + * @function Phaser.Geom.Mesh.GenerateObjVerts + * @since 3.50.0 + * + * @param {Phaser.Types.Geom.Mesh.OBJData} data - The parsed OBJ model data. + * @param {Phaser.GameObjects.Mesh} [mesh] - An optional Mesh Game Object. If given, the generated Faces will be automatically added to this Mesh. Set to `null` to skip. + * @param {number} [scale=1] - An amount to scale the model data by. Use this if the model has exported too small, or large, to see. + * @param {number} [x=0] - Translate the model x position by this amount. + * @param {number} [y=0] - Translate the model y position by this amount. + * @param {number} [z=0] - Translate the model z position by this amount. + * @param {number} [rotateX=0] - Rotate the model on the x axis by this amount, in radians. + * @param {number} [rotateY=0] - Rotate the model on the y axis by this amount, in radians. + * @param {number} [rotateZ=0] - Rotate the model on the z axis by this amount, in radians. + * @param {boolean} [zIsUp=true] - Is the z axis up (true), or is y axis up (false)? + * + * @return {Phaser.Types.Geom.Mesh.GenerateVertsResult} The parsed Face and Vertex objects. + */ +var GenerateObjVerts = function (data, mesh, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp) +{ + if (scale === undefined) { scale = 1; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (z === undefined) { z = 0; } + if (rotateX === undefined) { rotateX = 0; } + if (rotateY === undefined) { rotateY = 0; } + if (rotateZ === undefined) { rotateZ = 0; } + if (zIsUp === undefined) { zIsUp = true; } - /** - * The current `width` and `height` are adjusted to fit inside the given dimensions, while keeping the aspect ratio. - * - * There may be some space inside the target area which is not covered if its aspect ratio differs. - * - * If this Size component has a parent set, then the width and height passed to this method will be clamped so - * it cannot exceed that of the parent. - * - * @method Phaser.Structs.Size#fitTo - * @since 3.16.0 - * - * @param {number} [width=0] - The new width of the Size component. - * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. - * - * @return {this} This Size component instance. - */ - fitTo: function (width, height) - { - return this.constrain(width, height, true); - }, + var result = { + faces: [], + verts: [] + }; - /** - * The current `width` and `height` are adjusted so that they fully envelope the given dimensions, while keeping the aspect ratio. - * - * The size may extend further out than the target area if the aspect ratios differ. - * - * If this Size component has a parent set, then the values are clamped so that it never exceeds the parent - * on the longest axis. - * - * @method Phaser.Structs.Size#envelop - * @since 3.16.0 - * - * @param {number} [width=0] - The new width of the Size component. - * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. - * - * @return {this} This Size component instance. - */ - envelop: function (width, height) - { - return this.constrain(width, height, false); - }, + var materials = data.materials; - /** - * Sets the width of this Size component. - * - * Depending on the aspect mode, changing the width may also update the height and aspect ratio. - * - * @method Phaser.Structs.Size#setWidth - * @since 3.16.0 - * - * @param {number} width - The new width of the Size component. - * - * @return {this} This Size component instance. - */ - setWidth: function (value) - { - return this.setSize(value, this._height); - }, + tempPosition.set(x, y, z); + tempRotation.set(rotateX, rotateY, rotateZ); + tempMatrix.fromRotationXYTranslation(tempRotation, tempPosition, zIsUp); - /** - * Sets the height of this Size component. - * - * Depending on the aspect mode, changing the height may also update the width and aspect ratio. - * - * @method Phaser.Structs.Size#setHeight - * @since 3.16.0 - * - * @param {number} height - The new height of the Size component. - * - * @return {this} This Size component instance. - */ - setHeight: function (value) + for (var m = 0; m < data.models.length; m++) { - return this.setSize(this._width, value); - }, + var model = data.models[m]; - /** - * Returns a string representation of this Size component. - * - * @method Phaser.Structs.Size#toString - * @since 3.16.0 - * - * @return {string} A string representation of this Size component. - */ - toString: function () - { - return '[{ Size (width=' + this._width + ' height=' + this._height + ' aspectRatio=' + this.aspectRatio + ' aspectMode=' + this.aspectMode + ') }]'; - }, + var vertices = model.vertices; + var textureCoords = model.textureCoords; + var faces = model.faces; - /** - * Sets the values of this Size component to the `element.style.width` and `height` - * properties of the given DOM Element. The properties are set as `px` values. - * - * @method Phaser.Structs.Size#setCSS - * @since 3.17.0 - * - * @param {HTMLElement} element - The DOM Element to set the CSS style on. - */ - setCSS: function (element) - { - if (element && element.style) + for (var i = 0; i < faces.length; i++) { - element.style.width = this._width + 'px'; - element.style.height = this._height + 'px'; - } - }, - - /** - * Copies the aspect mode, aspect ratio, width and height from this Size component - * to the given Size component. Note that the parent, if set, is not copied across. - * - * @method Phaser.Structs.Size#copy - * @since 3.16.0 - * - * @param {Phaser.Structs.Size} destination - The Size component to copy the values to. - * - * @return {Phaser.Structs.Size} The updated destination Size component. - */ - copy: function (destination) - { - destination.setAspectMode(this.aspectMode); - - destination.aspectRatio = this.aspectRatio; - - return destination.setSize(this.width, this.height); - }, + var face = faces[i]; - /** - * Destroys this Size component. - * - * This clears the local properties and any parent object, if set. - * - * A destroyed Size component cannot be re-used. - * - * @method Phaser.Structs.Size#destroy - * @since 3.16.0 - */ - destroy: function () - { - this._parent = null; - this.snapTo = null; - }, + var v1 = face.vertices[0]; + var v2 = face.vertices[1]; + var v3 = face.vertices[2]; - /** - * The width of this Size component. - * - * This value is clamped to the range specified by `minWidth` and `maxWidth`, if enabled. - * - * A width can never be less than zero. - * - * Changing this value will automatically update the `height` if the aspect ratio lock is enabled. - * You can also use the `setWidth` and `getWidth` methods. - * - * @name Phaser.Structs.Size#width - * @type {number} - * @since 3.16.0 - */ - width: { + var m1 = vertices[v1.vertexIndex]; + var m2 = vertices[v2.vertexIndex]; + var m3 = vertices[v3.vertexIndex]; - get: function () - { - return this._width; - }, + var t1 = v1.textureCoordsIndex; + var t2 = v2.textureCoordsIndex; + var t3 = v3.textureCoordsIndex; - set: function (value) - { - this.setSize(value, this._height); - } + var uv1 = (t1 === -1) ? { u: 0, v: 1 } : textureCoords[t1]; + var uv2 = (t2 === -1) ? { u: 0, v: 0 } : textureCoords[t2]; + var uv3 = (t3 === -1) ? { u: 1, v: 1 } : textureCoords[t3]; - }, + var color = 0xffffff; - /** - * The height of this Size component. - * - * This value is clamped to the range specified by `minHeight` and `maxHeight`, if enabled. - * - * A height can never be less than zero. - * - * Changing this value will automatically update the `width` if the aspect ratio lock is enabled. - * You can also use the `setHeight` and `getHeight` methods. - * - * @name Phaser.Structs.Size#height - * @type {number} - * @since 3.16.0 - */ - height: { + if (face.material !== '' && materials[face.material]) + { + color = materials[face.material]; + } - get: function () - { - return this._height; - }, + var vert1 = new Vertex(m1.x * scale, m1.y * scale, m1.z * scale, uv1.u, uv1.v, color).transformMat4(tempMatrix); + var vert2 = new Vertex(m2.x * scale, m2.y * scale, m2.z * scale, uv2.u, uv2.v, color).transformMat4(tempMatrix); + var vert3 = new Vertex(m3.x * scale, m3.y * scale, m3.z * scale, uv3.u, uv3.v, color).transformMat4(tempMatrix); - set: function (value) - { - this.setSize(this._width, value); + result.verts.push(vert1, vert2, vert3); + result.faces.push(new Face(vert1, vert2, vert3)); } - } -}); - -/** - * Do not make the size fit the aspect ratio. Change the ratio when the size changes. - * - * @name Phaser.Structs.Size.NONE - * @constant - * @type {number} - * @since 3.16.0 - */ -Size.NONE = 0; - -/** - * The height is automatically adjusted based on the width. - * - * @name Phaser.Structs.Size.WIDTH_CONTROLS_HEIGHT - * @constant - * @type {number} - * @since 3.16.0 - */ -Size.WIDTH_CONTROLS_HEIGHT = 1; - -/** - * The width is automatically adjusted based on the height. - * - * @name Phaser.Structs.Size.HEIGHT_CONTROLS_WIDTH - * @constant - * @type {number} - * @since 3.16.0 - */ -Size.HEIGHT_CONTROLS_WIDTH = 2; - -/** - * The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered. - * - * @name Phaser.Structs.Size.FIT - * @constant - * @type {number} - * @since 3.16.0 - */ -Size.FIT = 3; + if (mesh) + { + mesh.faces = mesh.faces.concat(result.faces); + mesh.vertices = mesh.vertices.concat(result.verts); + } -/** - * The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size. - * - * @name Phaser.Structs.Size.ENVELOP - * @constant - * @type {number} - * @since 3.16.0 - */ -Size.ENVELOP = 4; + return result; +}; -module.exports = Size; +module.exports = GenerateObjVerts; /***/ }), -/* 417 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 67623: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(144); -var Events = __webpack_require__(20); -var GameEvents = __webpack_require__(22); -var GetValue = __webpack_require__(6); -var LoaderEvents = __webpack_require__(95); -var NOOP = __webpack_require__(1); -var Scene = __webpack_require__(418); -var Systems = __webpack_require__(204); +var Face = __webpack_require__(18693); +var Vertex = __webpack_require__(85769); /** - * @classdesc - * The Scene Manager. + * Generates a set of Face and Vertex objects by parsing the given data. * - * The Scene Manager is a Game level system, responsible for creating, processing and updating all of the - * Scenes in a Game instance. + * This method will take vertex data in one of two formats, based on the `containsZ` parameter. * - * You should not usually interact directly with the Scene Manager at all. Instead, you should use - * the Scene Plugin, which is available from every Scene in your game via the `this.scene` property. + * If your vertex data are `x`, `y` pairs, then `containsZ` should be `false` (this is the default) * - * Using methods in this Scene Manager directly will break queued operations and can cause runtime - * errors. Instead, go via the Scene Plugin. Every feature this Scene Manager provides is also - * available via the Scene Plugin. + * If your vertex data is groups of `x`, `y` and `z` values, then the `containsZ` parameter must be true. * - * @class SceneManager - * @memberof Phaser.Scenes - * @constructor - * @since 3.0.0 + * The `uvs` parameter is a numeric array consisting of `u` and `v` pairs. * - * @param {Phaser.Game} game - The Phaser.Game instance this Scene Manager belongs to. - * @param {object} sceneConfig - Scene specific configuration settings. + * The `normals` parameter is a numeric array consisting of `x`, `y` vertex normal values and, if `containsZ` is true, `z` values as well. + * + * The `indicies` parameter is an optional array that, if given, is an indexed list of vertices to be added. + * + * The `colors` parameter is an optional array, or single value, that if given sets the color of each vertex created. + * + * The `alphas` parameter is an optional array, or single value, that if given sets the alpha of each vertex created. + * + * When providing indexed data it is assumed that _all_ of the arrays are indexed, not just the vertices. + * + * The following example will create a 256 x 256 sized quad using an index array: + * + * ```javascript + * const vertices = [ + * -128, 128, + * 128, 128, + * -128, -128, + * 128, -128 + * ]; + * + * const uvs = [ + * 0, 1, + * 1, 1, + * 0, 0, + * 1, 0 + * ]; + * + * const indices = [ 0, 2, 1, 2, 3, 1 ]; + * + * GenerateVerts(vertices, uvs, indicies); + * ``` + * + * If the data is not indexed, it's assumed that the arrays all contain sequential data. + * + * @function Phaser.Geom.Mesh.GenerateVerts + * @since 3.50.0 + * + * @param {number[]} vertices - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. + * @param {number[]} uvs - The UVs pairs array. + * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? + * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. + * @param {boolean} [flipUV=false] - Flip the UV coordinates? + * + * @return {Phaser.Types.Geom.Mesh.GenerateVertsResult} The parsed Face and Vertex objects. */ -var SceneManager = new Class({ - - initialize: +var GenerateVerts = function (vertices, uvs, indicies, containsZ, normals, colors, alphas, flipUV) +{ + if (containsZ === undefined) { containsZ = false; } + if (colors === undefined) { colors = 0xffffff; } + if (alphas === undefined) { alphas = 1; } + if (flipUV === undefined) { flipUV = false; } - function SceneManager (game, sceneConfig) + if (vertices.length !== uvs.length && !containsZ) { - /** - * The Game that this SceneManager belongs to. - * - * @name Phaser.Scenes.SceneManager#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; - - /** - * An object that maps the keys to the scene so we can quickly get a scene from a key without iteration. - * - * @name Phaser.Scenes.SceneManager#keys - * @type {Record} - * @since 3.0.0 - */ - this.keys = {}; - - /** - * The array in which all of the scenes are kept. - * - * @name Phaser.Scenes.SceneManager#scenes - * @type {Phaser.Scene[]} - * @since 3.0.0 - */ - this.scenes = []; - - /** - * Scenes pending to be added are stored in here until the manager has time to add it. - * - * @name Phaser.Scenes.SceneManager#_pending - * @type {array} - * @private - * @since 3.0.0 - */ - this._pending = []; - - /** - * An array of scenes waiting to be started once the game has booted. - * - * @name Phaser.Scenes.SceneManager#_start - * @type {array} - * @private - * @since 3.0.0 - */ - this._start = []; + console.warn('GenerateVerts: vertices and uvs count not equal'); + return; + } - /** - * An operations queue, because we don't manipulate the scenes array during processing. - * - * @name Phaser.Scenes.SceneManager#_queue - * @type {array} - * @private - * @since 3.0.0 - */ - this._queue = []; + var result = { + faces: [], + vertices: [] + }; - /** - * Boot time data to merge. - * - * @name Phaser.Scenes.SceneManager#_data - * @type {object} - * @private - * @since 3.4.0 - */ - this._data = {}; + var i; - /** - * Is the Scene Manager actively processing the Scenes list? - * - * @name Phaser.Scenes.SceneManager#isProcessing - * @type {boolean} - * @default false - * @readonly - * @since 3.0.0 - */ - this.isProcessing = false; + var x; + var y; + var z; - /** - * Has the Scene Manager properly started? - * - * @name Phaser.Scenes.SceneManager#isBooted - * @type {boolean} - * @default false - * @readonly - * @since 3.4.0 - */ - this.isBooted = false; + var u; + var v; - /** - * Do any of the Cameras in any of the Scenes require a custom viewport? - * If not we can skip scissor tests. - * - * @name Phaser.Scenes.SceneManager#customViewports - * @type {number} - * @default 0 - * @since 3.12.0 - */ - this.customViewports = 0; + var color; + var alpha; - if (sceneConfig) - { - if (!Array.isArray(sceneConfig)) - { - sceneConfig = [ sceneConfig ]; - } + var normalX; + var normalY; + var normalZ; - for (var i = 0; i < sceneConfig.length; i++) - { - // The i === 0 part just autostarts the first Scene given (unless it says otherwise in its config) - this._pending.push({ - key: 'default', - scene: sceneConfig[i], - autoStart: (i === 0), - data: {} - }); - } - } + var iInc = (containsZ) ? 3 : 2; - game.events.once(GameEvents.READY, this.bootQueue, this); - }, + var isColorArray = Array.isArray(colors); + var isAlphaArray = Array.isArray(alphas); - /** - * Internal first-time Scene boot handler. - * - * @method Phaser.Scenes.SceneManager#bootQueue - * @private - * @since 3.2.0 - */ - bootQueue: function () + if (Array.isArray(indicies) && indicies.length > 0) { - if (this.isBooted) - { - return; - } - - var i; - var entry; - var key; - var sceneConfig; - - for (i = 0; i < this._pending.length; i++) + for (i = 0; i < indicies.length; i++) { - entry = this._pending[i]; + var index1 = indicies[i]; + var index2 = indicies[i] * 2; + var index3 = indicies[i] * iInc; - key = entry.key; - sceneConfig = entry.scene; + x = vertices[index3]; + y = vertices[index3 + 1]; + z = (containsZ) ? vertices[index3 + 2] : 0; - var newScene; + u = uvs[index2]; + v = uvs[index2 + 1]; - if (sceneConfig instanceof Scene) - { - newScene = this.createSceneFromInstance(key, sceneConfig); - } - else if (typeof sceneConfig === 'object') - { - newScene = this.createSceneFromObject(key, sceneConfig); - } - else if (typeof sceneConfig === 'function') + if (flipUV) { - newScene = this.createSceneFromFunction(key, sceneConfig); + v = 1 - v; } - // Replace key in case the scene changed it - key = newScene.sys.settings.key; - - this.keys[key] = newScene; + color = (isColorArray) ? colors[index1] : colors; + alpha = (isAlphaArray) ? alphas[index1] : alphas; - this.scenes.push(newScene); + normalX = 0; + normalY = 0; + normalZ = 0; - // Any data to inject? - if (this._data[key]) + if (normals) { - newScene.sys.settings.data = this._data[key].data; - - if (this._data[key].autoStart) - { - entry.autoStart = true; - } + normalX = normals[index3]; + normalY = normals[index3 + 1]; + normalZ = (containsZ) ? normals[index3 + 2] : 0; } - if (entry.autoStart || newScene.sys.settings.active) - { - this._start.push(key); - } + result.vertices.push(new Vertex(x, y, z, u, v, color, alpha, normalX, normalY, normalZ)); } + } + else + { + var uvIndex = 0; + var colorIndex = 0; - // Clear the pending lists - this._pending.length = 0; + for (i = 0; i < vertices.length; i += iInc) + { + x = vertices[i]; + y = vertices[i + 1]; + z = (containsZ) ? vertices[i + 2] : 0; - this._data = {}; + u = uvs[uvIndex]; + v = uvs[uvIndex + 1]; - this.isBooted = true; + color = (isColorArray) ? colors[colorIndex] : colors; + alpha = (isAlphaArray) ? alphas[colorIndex] : alphas; - // _start might have been populated by the above - for (i = 0; i < this._start.length; i++) - { - entry = this._start[i]; + normalX = 0; + normalY = 0; + normalZ = 0; - this.start(entry); - } + if (normals) + { + normalX = normals[i]; + normalY = normals[i + 1]; + normalZ = (containsZ) ? normals[i + 2] : 0; + } - this._start.length = 0; - }, + result.vertices.push(new Vertex(x, y, z, u, v, color, alpha, normalX, normalY, normalZ)); - /** - * Process the Scene operations queue. - * - * @method Phaser.Scenes.SceneManager#processQueue - * @since 3.0.0 - */ - processQueue: function () + uvIndex += 2; + colorIndex++; + } + } + + for (i = 0; i < result.vertices.length; i += 3) { - var pendingLength = this._pending.length; - var queueLength = this._queue.length; + var vert1 = result.vertices[i]; + var vert2 = result.vertices[i + 1]; + var vert3 = result.vertices[i + 2]; - if (pendingLength === 0 && queueLength === 0) - { - return; - } + result.faces.push(new Face(vert1, vert2, vert3)); + } - var i; - var entry; + return result; +}; - if (pendingLength) - { - for (i = 0; i < pendingLength; i++) - { - entry = this._pending[i]; +module.exports = GenerateVerts; - this.add(entry.key, entry.scene, entry.autoStart, entry.data); - } - // _start might have been populated by this.add - for (i = 0; i < this._start.length; i++) - { - entry = this._start[i]; +/***/ }), - this.start(entry); - } +/***/ 27291: +/***/ ((module) => { - // Clear the pending lists - this._start.length = 0; - this._pending.length = 0; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return; - } +var flip = true; - for (i = 0; i < this._queue.length; i++) - { - entry = this._queue[i]; +var defaultModelName = 'untitled'; +var currentGroup = ''; +var currentMaterial = ''; - this[entry.op](entry.keyA, entry.keyB); - } +/** + * @ignore + */ +function stripComments (line) +{ + var idx = line.indexOf('#'); - this._queue.length = 0; - }, + return (idx > -1) ? line.substring(0, idx) : line; +} - /** - * Adds a new Scene into the SceneManager. - * You must give each Scene a unique key by which you'll identify it. - * - * The `sceneConfig` can be: - * - * * A `Phaser.Scene` object, or an object that extends it. - * * A plain JavaScript object - * * A JavaScript ES6 Class that extends `Phaser.Scene` - * * A JavaScript ES5 prototype based Class - * * A JavaScript function - * - * If a function is given then a new Scene will be created by calling it. - * - * @method Phaser.Scenes.SceneManager#add - * @since 3.0.0 - * - * @param {string} key - A unique key used to reference the Scene, i.e. `MainMenu` or `Level1`. - * @param {(Phaser.Scene|Phaser.Types.Scenes.SettingsConfig|Phaser.Types.Scenes.CreateSceneFromObjectConfig|function)} sceneConfig - The config for the Scene - * @param {boolean} [autoStart=false] - If `true` the Scene will be started immediately after being added. - * @param {object} [data] - Optional data object. This will be set as `Scene.settings.data` and passed to `Scene.init`, and `Scene.create`. - * - * @return {?Phaser.Scene} The added Scene, if it was added immediately, otherwise `null`. - */ - add: function (key, sceneConfig, autoStart, data) +/** + * @ignore + */ +function currentModel (result) +{ + if (result.models.length === 0) { - if (autoStart === undefined) { autoStart = false; } - if (data === undefined) { data = {}; } + result.models.push({ + faces: [], + name: defaultModelName, + textureCoords: [], + vertexNormals: [], + vertices: [] + }); + } - // If processing or not booted then put scene into a holding pattern - if (this.isProcessing || !this.isBooted) - { - this._pending.push({ - key: key, - scene: sceneConfig, - autoStart: autoStart, - data: data - }); + currentGroup = ''; - if (!this.isBooted) - { - this._data[key] = { data: data }; - } + return result.models[result.models.length - 1]; +} - return null; - } +/** + * @ignore + */ +function parseObject (lineItems, result) +{ + var modelName = lineItems.length >= 2 ? lineItems[1] : defaultModelName; - key = this.getKey(key, sceneConfig); + result.models.push({ + faces: [], + name: modelName, + textureCoords: [], + vertexNormals: [], + vertices: [] + }); - var newScene; + currentGroup = ''; +} - if (sceneConfig instanceof Scene) - { - newScene = this.createSceneFromInstance(key, sceneConfig); - } - else if (typeof sceneConfig === 'object') - { - sceneConfig.key = key; +/** + * @ignore + */ +function parseGroup (lineItems) +{ + if (lineItems.length === 2) + { + currentGroup = lineItems[1]; + } +} - newScene = this.createSceneFromObject(key, sceneConfig); - } - else if (typeof sceneConfig === 'function') - { - newScene = this.createSceneFromFunction(key, sceneConfig); - } +/** + * @ignore + */ +function parseVertexCoords (lineItems, result) +{ + var len = lineItems.length; - // Any data to inject? - newScene.sys.settings.data = data; + var x = (len >= 2) ? parseFloat(lineItems[1]) : 0; + var y = (len >= 3) ? parseFloat(lineItems[2]) : 0; + var z = (len >= 4) ? parseFloat(lineItems[3]) : 0; - // Replace key in case the scene changed it - key = newScene.sys.settings.key; + currentModel(result).vertices.push({ x: x, y: y, z: z }); +} - this.keys[key] = newScene; +/** + * @ignore + */ +function parseTextureCoords (lineItems, result) +{ + var len = lineItems.length; - this.scenes.push(newScene); + var u = (len >= 2) ? parseFloat(lineItems[1]) : 0; + var v = (len >= 3) ? parseFloat(lineItems[2]) : 0; + var w = (len >= 4) ? parseFloat(lineItems[3]) : 0; - if (autoStart || newScene.sys.settings.active) - { - if (this._pending.length) - { - this._start.push(key); - } - else - { - this.start(key); - } - } + if (isNaN(u)) + { + u = 0; + } - return newScene; - }, + if (isNaN(v)) + { + v = 0; + } - /** - * Removes a Scene from the SceneManager. - * - * The Scene is removed from the local scenes array, it's key is cleared from the keys - * cache and Scene.Systems.destroy is then called on it. - * - * If the SceneManager is processing the Scenes when this method is called it will - * queue the operation for the next update sequence. - * - * @method Phaser.Scenes.SceneManager#remove - * @since 3.2.0 - * - * @param {string} key - A unique key used to reference the Scene, i.e. `MainMenu` or `Level1`. - * - * @return {this} This Scene Manager instance. - */ - remove: function (key) + if (isNaN(w)) { - if (this.isProcessing) - { - this._queue.push({ op: 'remove', keyA: key, keyB: null }); - } - else - { - var sceneToRemove = this.getScene(key); + w = 0; + } - if (!sceneToRemove || sceneToRemove.sys.isTransitioning()) - { - return this; - } + if (flip) + { + v = 1 - v; + } - var index = this.scenes.indexOf(sceneToRemove); - var sceneKey = sceneToRemove.sys.settings.key; + currentModel(result).textureCoords.push({ u: u, v: v, w: w }); +} - if (index > -1) - { - delete this.keys[sceneKey]; - this.scenes.splice(index, 1); +/** + * @ignore + */ +function parseVertexNormal (lineItems, result) +{ + var len = lineItems.length; - if (this._start.indexOf(sceneKey) > -1) - { - index = this._start.indexOf(sceneKey); - this._start.splice(index, 1); - } + var x = (len >= 2) ? parseFloat(lineItems[1]) : 0; + var y = (len >= 3) ? parseFloat(lineItems[2]) : 0; + var z = (len >= 4) ? parseFloat(lineItems[3]) : 0; - sceneToRemove.sys.destroy(); - } - } + currentModel(result).vertexNormals.push({ x: x, y: y, z: z }); +} - return this; - }, +/** + * @ignore + */ +function parsePolygon (lineItems, result) +{ + var totalVertices = lineItems.length - 1; - /** - * Boot the given Scene. - * - * @method Phaser.Scenes.SceneManager#bootScene - * @private - * @fires Phaser.Scenes.Events#TRANSITION_INIT - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene to boot. - */ - bootScene: function (scene) + if (totalVertices < 3) { - var sys = scene.sys; - var settings = sys.settings; - - sys.sceneUpdate = NOOP; + return; + } - if (scene.init) - { - scene.init.call(scene, settings.data); + var face = { + group: currentGroup, + material: currentMaterial, + vertices: [] + }; - settings.status = CONST.INIT; + for (var i = 0; i < totalVertices; i++) + { + var vertexString = lineItems[i + 1]; + var vertexValues = vertexString.split('/'); + var vvLen = vertexValues.length; - if (settings.isTransition) - { - sys.events.emit(Events.TRANSITION_INIT, settings.transitionFrom, settings.transitionDuration); - } + if (vvLen < 1 || vvLen > 3) + { + continue; } - var loader; + var vertexIndex = 0; + var textureCoordsIndex = 0; + var vertexNormalIndex = 0; - if (sys.load) - { - loader = sys.load; + vertexIndex = parseInt(vertexValues[0], 10); - loader.reset(); + if (vvLen > 1 && vertexValues[1] !== '') + { + textureCoordsIndex = parseInt(vertexValues[1], 10); } - if (loader && scene.preload) + if (vvLen > 2) { - scene.preload.call(scene); + vertexNormalIndex = parseInt(vertexValues[2], 10); + } - // Is the loader empty? - if (loader.list.size === 0) + if (vertexIndex !== 0) + { + // Negative vertex indices refer to the nth last defined vertex + // convert these to postive indices for simplicity + if (vertexIndex < 0) { - this.create(scene); + vertexIndex = currentModel(result).vertices.length + 1 + vertexIndex; } - else - { - settings.status = CONST.LOADING; - // Start the loader going as we have something in the queue - loader.once(LoaderEvents.COMPLETE, this.loadComplete, this); + textureCoordsIndex -= 1; + vertexIndex -= 1; + vertexNormalIndex -= 1; - loader.start(); - } - } - else - { - // No preload? Then there was nothing to load either - this.create(scene); + face.vertices.push({ + textureCoordsIndex: textureCoordsIndex, + vertexIndex: vertexIndex, + vertexNormalIndex: vertexNormalIndex + }); } - }, + } - /** - * Handles load completion for a Scene's Loader. - * - * Starts the Scene that the Loader belongs to. - * - * @method Phaser.Scenes.SceneManager#loadComplete - * @private - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - The loader that has completed loading. - */ - loadComplete: function (loader) - { - this.create(loader.scene); - }, + currentModel(result).faces.push(face); +} - /** - * Handle payload completion for a Scene. - * - * @method Phaser.Scenes.SceneManager#payloadComplete - * @private - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - The loader that has completed loading its Scene's payload. - */ - payloadComplete: function (loader) +/** + * @ignore + */ +function parseMtlLib (lineItems, result) +{ + if (lineItems.length >= 2) { - this.bootScene(loader.scene); - }, + result.materialLibraries.push(lineItems[1]); + } +} - /** - * Updates the Scenes. - * - * @method Phaser.Scenes.SceneManager#update - * @since 3.0.0 - * - * @param {number} time - Time elapsed. - * @param {number} delta - Delta time from the last update. - */ - update: function (time, delta) +/** + * @ignore + */ +function parseUseMtl (lineItems) +{ + if (lineItems.length >= 2) { - this.processQueue(); + currentMaterial = lineItems[1]; + } +} - this.isProcessing = true; +/** + * Parses a Wavefront OBJ File, extracting the models from it and returning them in an array. + * + * The model data *must* be triangulated for a Mesh Game Object to be able to render it. + * + * @function Phaser.Geom.Mesh.ParseObj + * @since 3.50.0 + * + * @param {string} data - The OBJ File data as a raw string. + * @param {boolean} [flipUV=true] - Flip the UV coordinates? + * + * @return {Phaser.Types.Geom.Mesh.OBJData} The parsed model and material data. + */ +var ParseObj = function (data, flipUV) +{ + if (flipUV === undefined) { flipUV = true; } - // Loop through the active scenes in reverse order - for (var i = this.scenes.length - 1; i >= 0; i--) - { - var sys = this.scenes[i].sys; + flip = flipUV; - if (sys.settings.status > CONST.START && sys.settings.status <= CONST.RUNNING) - { - sys.step(time, delta); - } - } - }, + // Store results in here + var result = { + materials: {}, + materialLibraries: [], + models: [] + }; - /** - * Renders the Scenes. - * - * @method Phaser.Scenes.SceneManager#render - * @since 3.0.0 - * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer to use. - */ - render: function (renderer) + currentGroup = ''; + currentMaterial = ''; + + var lines = data.split('\n'); + + for (var i = 0; i < lines.length; i++) { - // Loop through the scenes in forward order - for (var i = 0; i < this.scenes.length; i++) + var line = stripComments(lines[i]); + + var lineItems = line.replace(/\s\s+/g, ' ').trim().split(' '); + + switch (lineItems[0].toLowerCase()) { - var sys = this.scenes[i].sys; + case 'o': + // Start A New Model + parseObject(lineItems, result); + break; - if (sys.settings.visible && sys.settings.status >= CONST.LOADING && sys.settings.status < CONST.SLEEPING) - { - sys.render(renderer); - } - } + case 'g': + // Start a new polygon group + parseGroup(lineItems); + break; - this.isProcessing = false; - }, + case 'v': + // Define a vertex for the current model + parseVertexCoords(lineItems, result); + break; - /** - * Calls the given Scene's {@link Phaser.Scene#create} method and updates its status. - * - * @method Phaser.Scenes.SceneManager#create - * @private - * @fires Phaser.Scenes.Events#CREATE - * @fires Phaser.Scenes.Events#TRANSITION_INIT - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene to create. - */ - create: function (scene) - { - var sys = scene.sys; - var settings = sys.settings; + case 'vt': + // Texture Coords + parseTextureCoords(lineItems, result); + break; - if (scene.create) - { - settings.status = CONST.CREATING; + case 'vn': + // Define a vertex normal for the current model + parseVertexNormal(lineItems, result); + break; - scene.create.call(scene, settings.data); + case 'f': + // Define a Face/Polygon + parsePolygon(lineItems, result); + break; - if (settings.status === CONST.DESTROYED) - { - return; - } - } + case 'mtllib': + // Reference to a material library file (.mtl) + parseMtlLib(lineItems, result); + break; - if (settings.isTransition) - { - sys.events.emit(Events.TRANSITION_START, settings.transitionFrom, settings.transitionDuration); + case 'usemtl': + // Sets the current material to be applied to polygons defined from this point forward + parseUseMtl(lineItems); + break; } + } - // If the Scene has an update function we'll set it now, otherwise it'll remain as NOOP - if (scene.update) - { - sys.sceneUpdate = scene.update; - } + return result; +}; - settings.status = CONST.RUNNING; +module.exports = ParseObj; - sys.events.emit(Events.CREATE, scene); - }, - /** - * Creates and initializes a Scene from a function. - * - * @method Phaser.Scenes.SceneManager#createSceneFromFunction - * @private - * @since 3.0.0 - * - * @param {string} key - The key of the Scene. - * @param {function} scene - The function to create the Scene from. - * - * @return {Phaser.Scene} The created Scene. - */ - createSceneFromFunction: function (key, scene) +/***/ }), + +/***/ 76799: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetColor = __webpack_require__(22946); + +/** + * Takes a Wavefront Material file and extracts the diffuse reflectivity of the named + * materials, converts them to integer color values and returns them. + * + * This is used internally by the `addOBJ` and `addModel` methods, but is exposed for + * public consumption as well. + * + * Note this only works with diffuse values, specified in the `Kd r g b` format, where + * `g` and `b` are optional, but `r` is required. It does not support spectral rfl files, + * or any other material statement (such as `Ka` or `Ks`) + * + * @method Phaser.Geom.Mesh.ParseObjMaterial + * @since 3.50.0 + * + * @param {string} mtl - The OBJ MTL file as a raw string, i.e. loaded via `this.load.text`. + * + * @return {object} The parsed material colors, where each property of the object matches the material name. + */ +var ParseObjMaterial = function (mtl) +{ + var output = {}; + + var lines = mtl.split('\n'); + + var currentMaterial = ''; + + for (var i = 0; i < lines.length; i++) { - var newScene = new scene(); + var line = lines[i].trim(); - if (newScene instanceof Scene) + if (line.indexOf('#') === 0 || line === '') { - var configKey = newScene.sys.settings.key; + continue; + } - if (configKey !== '') + var lineItems = line.replace(/\s\s+/g, ' ').trim().split(' '); + + switch (lineItems[0].toLowerCase()) + { + case 'newmtl': { - key = configKey; + currentMaterial = lineItems[1]; + break; } - if (this.keys.hasOwnProperty(key)) + // The diffuse reflectivity of the current material + // Support r, [g], [b] format, where g and b are optional + case 'kd': { - throw new Error('Cannot add a Scene with duplicate key: ' + key); - } + var r = Math.floor(lineItems[1] * 255); + var g = (lineItems.length >= 2) ? Math.floor(lineItems[2] * 255) : r; + var b = (lineItems.length >= 3) ? Math.floor(lineItems[3] * 255) : r; - return this.createSceneFromInstance(key, newScene); + output[currentMaterial] = GetColor(r, g, b); + + break; + } } - else - { - newScene.sys = new Systems(newScene); + } - newScene.sys.settings.key = key; + return output; +}; - newScene.sys.init(this.game); +module.exports = ParseObjMaterial; - return newScene; - } - }, - /** - * Creates and initializes a Scene instance. - * - * @method Phaser.Scenes.SceneManager#createSceneFromInstance - * @private - * @since 3.0.0 - * - * @param {string} key - The key of the Scene. - * @param {Phaser.Scene} newScene - The Scene instance. - * - * @return {Phaser.Scene} The created Scene. - */ - createSceneFromInstance: function (key, newScene) - { - var configKey = newScene.sys.settings.key; +/***/ }), - if (configKey === '') - { - newScene.sys.settings.key = key; - } +/***/ 15313: +/***/ ((module) => { - newScene.sys.init(this.game); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return newScene; - }, +/** + * Rotates the vertices of a Face to the given angle. + * + * The actual vertex positions are adjusted, not their transformed positions. + * + * Therefore, this updates the vertex data directly. + * + * @function Phaser.Geom.Mesh.RotateFace + * @since 3.50.0 + * + * @param {Phaser.Geom.Mesh.Face} face - The Face to rotate. + * @param {number} angle - The angle to rotate to, in radians. + * @param {number} [cx] - An optional center of rotation. If not given, the Face in-center is used. + * @param {number} [cy] - An optional center of rotation. If not given, the Face in-center is used. + */ +var RotateFace = function (face, angle, cx, cy) +{ + var x; + var y; - /** - * Creates and initializes a Scene from an Object definition. - * - * @method Phaser.Scenes.SceneManager#createSceneFromObject - * @private - * @since 3.0.0 - * - * @param {string} key - The key of the Scene. - * @param {(string|Phaser.Types.Scenes.SettingsConfig|Phaser.Types.Scenes.CreateSceneFromObjectConfig)} sceneConfig - The Scene config. - * - * @return {Phaser.Scene} The created Scene. - */ - createSceneFromObject: function (key, sceneConfig) + // No point of rotation? Use the inCenter instead, then. + if (cx === undefined && cy === undefined) { - var newScene = new Scene(sceneConfig); + var inCenter = face.getInCenter(); - var configKey = newScene.sys.settings.key; + x = inCenter.x; + y = inCenter.y; + } - if (configKey !== '') - { - key = configKey; - } - else - { - newScene.sys.settings.key = key; - } + var c = Math.cos(angle); + var s = Math.sin(angle); - newScene.sys.init(this.game); + var v1 = face.vertex1; + var v2 = face.vertex2; + var v3 = face.vertex3; - // Extract callbacks + var tx = v1.x - x; + var ty = v1.y - y; - var defaults = [ 'init', 'preload', 'create', 'update', 'render' ]; + v1.set(tx * c - ty * s + x, tx * s + ty * c + y); - for (var i = 0; i < defaults.length; i++) - { - var sceneCallback = GetValue(sceneConfig, defaults[i], null); + tx = v2.x - x; + ty = v2.y - y; - if (sceneCallback) - { - newScene[defaults[i]] = sceneCallback; - } - } + v2.set(tx * c - ty * s + x, tx * s + ty * c + y); - // Now let's move across any other functions or properties that may exist in the extend object: + tx = v3.x - x; + ty = v3.y - y; - /* - scene: { - preload: preload, - create: create, - extend: { - hello: 1, - test: 'atari', - addImage: addImage - } - } - */ + v3.set(tx * c - ty * s + x, tx * s + ty * c + y); +}; - if (sceneConfig.hasOwnProperty('extend')) - { - for (var propertyKey in sceneConfig.extend) - { - if (!sceneConfig.extend.hasOwnProperty(propertyKey)) - { - continue; - } +module.exports = RotateFace; - var value = sceneConfig.extend[propertyKey]; - if (propertyKey === 'data' && newScene.hasOwnProperty('data') && typeof value === 'object') - { - // Populate the DataManager - newScene.data.merge(value); - } - else if (propertyKey !== 'sys') - { - newScene[propertyKey] = value; - } - } - } +/***/ }), - return newScene; - }, +/***/ 85769: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Retrieves the key of a Scene from a Scene config. - * - * @method Phaser.Scenes.SceneManager#getKey - * @private - * @since 3.0.0 - * - * @param {string} key - The key to check in the Scene config. - * @param {(Phaser.Scene|Phaser.Types.Scenes.SettingsConfig|function)} sceneConfig - The Scene config. - * - * @return {string} The Scene key. - */ - getKey: function (key, sceneConfig) - { - if (!key) { key = 'default'; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (typeof sceneConfig === 'function') - { - return key; - } - else if (sceneConfig instanceof Scene) - { - key = sceneConfig.sys.settings.key; - } - else if (typeof sceneConfig === 'object' && sceneConfig.hasOwnProperty('key')) - { - key = sceneConfig.key; - } +var Class = __webpack_require__(56694); +var Utils = __webpack_require__(75512); +var Vector3 = __webpack_require__(70015); - // By this point it's either 'default' or extracted from the Scene +/** + * @classdesc + * A Vertex Geometry Object. + * + * This class consists of all the information required for a single vertex within a Face Geometry Object. + * + * Faces, and thus Vertex objects, are used by the Mesh Game Object in order to render objects in WebGL. + * + * @class Vertex + * @memberof Phaser.Geom.Mesh + * @constructor + * @extends Phaser.Math.Vector3 + * @since 3.50.0 + * + * @param {number} x - The x position of the vertex. + * @param {number} y - The y position of the vertex. + * @param {number} z - The z position of the vertex. + * @param {number} u - The UV u coordinate of the vertex. + * @param {number} v - The UV v coordinate of the vertex. + * @param {number} [color=0xffffff] - The color value of the vertex. + * @param {number} [alpha=1] - The alpha value of the vertex. + * @param {number} [nx=0] - The x normal value of the vertex. + * @param {number} [ny=0] - The y normal value of the vertex. + * @param {number} [nz=0] - The z normal value of the vertex. + */ +var Vertex = new Class({ - if (this.keys.hasOwnProperty(key)) - { - throw new Error('Cannot add a Scene with duplicate key: ' + key); - } - else - { - return key; - } - }, + Extends: Vector3, - /** - * Returns an array of all the current Scenes being managed by this Scene Manager. - * - * You can filter the output by the active state of the Scene and choose to have - * the array returned in normal or reversed order. - * - * @method Phaser.Scenes.SceneManager#getScenes - * @since 3.16.0 - * - * @param {boolean} [isActive=true] - Only include Scene's that are currently active? - * @param {boolean} [inReverse=false] - Return the array of Scenes in reverse? - * - * @return {Phaser.Scene[]} An array containing all of the Scenes in the Scene Manager. - */ - getScenes: function (isActive, inReverse) + initialize: + + function Vertex (x, y, z, u, v, color, alpha, nx, ny, nz) { - if (isActive === undefined) { isActive = true; } - if (inReverse === undefined) { inReverse = false; } + if (color === undefined) { color = 0xffffff; } + if (alpha === undefined) { alpha = 1; } + if (nx === undefined) { nx = 0; } + if (ny === undefined) { ny = 0; } + if (nz === undefined) { nz = 0; } - var out = []; - var scenes = this.scenes; + Vector3.call(this, x, y, z); - for (var i = 0; i < scenes.length; i++) - { - var scene = scenes[i]; + /** + * The projected x coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#vx + * @type {number} + * @since 3.50.0 + */ + this.vx = 0; - if (scene && (!isActive || (isActive && scene.sys.isActive()))) - { - out.push(scene); - } - } + /** + * The projected y coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#vy + * @type {number} + * @since 3.50.0 + */ + this.vy = 0; - return (inReverse) ? out.reverse() : out; - }, + /** + * The projected z coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#vz + * @type {number} + * @since 3.50.0 + */ + this.vz = 0; - /** - * Retrieves a Scene. - * - * @method Phaser.Scenes.SceneManager#getScene - * @since 3.0.0 - * - * @param {(string|Phaser.Scene)} key - The Scene to retrieve. - * - * @return {?Phaser.Scene} The Scene. - */ - getScene: function (key) - { - if (typeof key === 'string') - { - if (this.keys[key]) - { - return this.keys[key]; - } - } - else - { - for (var i = 0; i < this.scenes.length; i++) - { - if (key === this.scenes[i]) - { - return key; - } - } - } + /** + * The normalized projected x coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#nx + * @type {number} + * @since 3.50.0 + */ + this.nx = nx; - return null; - }, + /** + * The normalized projected y coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#ny + * @type {number} + * @since 3.50.0 + */ + this.ny = ny; - /** - * Determines whether a Scene is running. - * - * @method Phaser.Scenes.SceneManager#isActive - * @since 3.0.0 - * - * @param {(string|Phaser.Scene)} key - The Scene to check. - * - * @return {boolean} Whether the Scene is running, or `null` if no matching Scene was found. - */ - isActive: function (key) - { - var scene = this.getScene(key); + /** + * The normalized projected z coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#nz + * @type {number} + * @since 3.50.0 + */ + this.nz = nz; - if (scene) - { - return scene.sys.isActive(); - } + /** + * UV u coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#u + * @type {number} + * @since 3.50.0 + */ + this.u = u; - return null; - }, + /** + * UV v coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#v + * @type {number} + * @since 3.50.0 + */ + this.v = v; - /** - * Determines whether a Scene is paused. - * - * @method Phaser.Scenes.SceneManager#isPaused - * @since 3.17.0 - * - * @param {(string|Phaser.Scene)} key - The Scene to check. - * - * @return {boolean} Whether the Scene is paused, or `null` if no matching Scene was found. - */ - isPaused: function (key) - { - var scene = this.getScene(key); + /** + * The color value of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#color + * @type {number} + * @since 3.50.0 + */ + this.color = color; - if (scene) - { - return scene.sys.isPaused(); - } + /** + * The alpha value of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#alpha + * @type {number} + * @since 3.50.0 + */ + this.alpha = alpha; - return null; - }, + /** + * The translated x coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#tx + * @type {number} + * @since 3.50.0 + */ + this.tx = 0; - /** - * Determines whether a Scene is visible. - * - * @method Phaser.Scenes.SceneManager#isVisible - * @since 3.0.0 - * - * @param {(string|Phaser.Scene)} key - The Scene to check. - * - * @return {boolean} Whether the Scene is visible, or `null` if no matching Scene was found. - */ - isVisible: function (key) - { - var scene = this.getScene(key); + /** + * The translated y coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#ty + * @type {number} + * @since 3.50.0 + */ + this.ty = 0; - if (scene) - { - return scene.sys.isVisible(); - } + /** + * The translated alpha value of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#ta + * @type {number} + * @since 3.50.0 + */ + this.ta = 0; - return null; + /** + * The translated uv u coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#tu + * @type {number} + * @since 3.60.0 + */ + this.tu = u; + + /** + * The translated uv v coordinate of this vertex. + * + * @name Phaser.Geom.Mesh.Vertex#tv + * @type {number} + * @since 3.60.0 + */ + this.tv = v; }, /** - * Determines whether a Scene is sleeping. + * Sets the U and V properties. * - * @method Phaser.Scenes.SceneManager#isSleeping - * @since 3.0.0 + * Also resets the translated uv properties, undoing any scale + * or shift they may have had. * - * @param {(string|Phaser.Scene)} key - The Scene to check. + * @method Phaser.Geom.Mesh.Vertex#setUVs + * @since 3.50.0 * - * @return {boolean} Whether the Scene is sleeping, or `null` if no matching Scene was found. + * @param {number} u - The UV u coordinate of the vertex. + * @param {number} v - The UV v coordinate of the vertex. + * + * @return {this} This Vertex. */ - isSleeping: function (key) + setUVs: function (u, v) { - var scene = this.getScene(key); + this.u = u; + this.v = v; - if (scene) - { - return scene.sys.isSleeping(); - } + this.tu = u; + this.tv = v; - return null; + return this; }, /** - * Pauses the given Scene. + * Translates the original UV positions by the given amounts. * - * @method Phaser.Scenes.SceneManager#pause - * @since 3.0.0 + * The original properties `Vertex.u` and `Vertex.v` + * remain unchanged, only the translated properties + * `Vertex.tu` and `Vertex.tv`, as used in rendering, + * are updated. * - * @param {(string|Phaser.Scene)} key - The Scene to pause. - * @param {object} [data] - An optional data object that will be passed to the Scene and emitted by its pause event. + * @method Phaser.Geom.Mesh.Vertex#scrollUV + * @since 3.60.0 * - * @return {this} This Scene Manager instance. + * @param {number} x - The amount to scroll the UV u coordinate by. + * @param {number} y - The amount to scroll the UV v coordinate by. + * + * @return {this} This Vertex. */ - pause: function (key, data) + scrollUV: function (x, y) { - var scene = this.getScene(key); - - if (scene) - { - scene.sys.pause(data); - } + this.tu += x; + this.tv += y; return this; }, /** - * Resumes the given Scene. + * Scales the original UV values by the given amounts. * - * @method Phaser.Scenes.SceneManager#resume - * @since 3.0.0 + * The original properties `Vertex.u` and `Vertex.v` + * remain unchanged, only the translated properties + * `Vertex.tu` and `Vertex.tv`, as used in rendering, + * are updated. * - * @param {(string|Phaser.Scene)} key - The Scene to resume. - * @param {object} [data] - An optional data object that will be passed to the Scene and emitted by its resume event. + * @method Phaser.Geom.Mesh.Vertex#scaleUV + * @since 3.60.0 * - * @return {this} This Scene Manager instance. + * @param {number} x - The amount to scale the UV u coordinate by. + * @param {number} y - The amount to scale the UV v coordinate by. + * + * @return {this} This Vertex. */ - resume: function (key, data) + scaleUV: function (x, y) { - var scene = this.getScene(key); - - if (scene) - { - scene.sys.resume(data); - } + this.tu = this.u * x; + this.tv = this.v * y; return this; }, /** - * Puts the given Scene to sleep. - * - * @method Phaser.Scenes.SceneManager#sleep - * @since 3.0.0 + * Transforms this vertex by the given matrix, storing the results in `vx`, `vy` and `vz`. * - * @param {(string|Phaser.Scene)} key - The Scene to put to sleep. - * @param {object} [data] - An optional data object that will be passed to the Scene and emitted by its sleep event. + * @method Phaser.Geom.Mesh.Vertex#transformCoordinatesLocal + * @since 3.50.0 * - * @return {this} This Scene Manager instance. + * @param {Phaser.Math.Matrix4} transformMatrix - The transform matrix to apply to this vertex. + * @param {number} width - The width of the parent Mesh. + * @param {number} height - The height of the parent Mesh. + * @param {number} cameraZ - The z position of the MeshCamera. */ - sleep: function (key, data) + transformCoordinatesLocal: function (transformMatrix, width, height, cameraZ) { - var scene = this.getScene(key); + var x = this.x; + var y = this.y; + var z = this.z; - if (scene && !scene.sys.isTransitioning()) + var m = transformMatrix.val; + + var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; + var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; + var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; + var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; + + this.vx = (tx / tw) * width; + this.vy = -(ty / tw) * height; + + if (cameraZ <= 0) { - scene.sys.sleep(data); + this.vz = (tz / tw); + } + else + { + this.vz = -(tz / tw); } - - return this; }, /** - * Awakens the given Scene. + * Resizes this Vertex by setting the x and y coordinates, then transforms this vertex + * by an identity matrix and dimensions, storing the results in `vx`, `vy` and `vz`. * - * @method Phaser.Scenes.SceneManager#wake - * @since 3.0.0 + * @method Phaser.Geom.Mesh.Vertex#resize + * @since 3.60.0 * - * @param {(string|Phaser.Scene)} key - The Scene to wake up. - * @param {object} [data] - An optional data object that will be passed to the Scene and emitted by its wake event. + * @param {number} x - The x position of the vertex. + * @param {number} y - The y position of the vertex. + * @param {number} width - The width of the parent Mesh. + * @param {number} height - The height of the parent Mesh. + * @param {number} originX - The originX of the parent Mesh. + * @param {number} originY - The originY of the parent Mesh. * - * @return {this} This Scene Manager instance. + * @return {this} This Vertex. */ - wake: function (key, data) + resize: function (x, y, width, height, originX, originY) { - var scene = this.getScene(key); + this.x = x; + this.y = y; - if (scene) + this.vx = this.x * width; + this.vy = -this.y * height; + this.vz = 0; + + if (originX < 0.5) { - scene.sys.wake(data); + this.vx += width * (0.5 - originX); + } + else if (originX > 0.5) + { + this.vx -= width * (originX - 0.5); + } + + if (originY < 0.5) + { + this.vy += height * (0.5 - originY); + } + else if (originY > 0.5) + { + this.vy -= height * (originY - 0.5); } return this; }, /** - * Runs the given Scene. - * - * If the given Scene is paused, it will resume it. If sleeping, it will wake it. - * If not running at all, it will be started. - * - * Use this if you wish to open a modal Scene by calling `pause` on the current - * Scene, then `run` on the modal Scene. + * Updates this Vertex based on the given transform. * - * @method Phaser.Scenes.SceneManager#run - * @since 3.10.0 + * @method Phaser.Geom.Mesh.Vertex#update + * @since 3.50.0 * - * @param {(string|Phaser.Scene)} key - The Scene to run. - * @param {object} [data] - A data object that will be passed to the Scene on start, wake, or resume. + * @param {number} a - The parent transform matrix data a component. + * @param {number} b - The parent transform matrix data b component. + * @param {number} c - The parent transform matrix data c component. + * @param {number} d - The parent transform matrix data d component. + * @param {number} e - The parent transform matrix data e component. + * @param {number} f - The parent transform matrix data f component. + * @param {boolean} roundPixels - Round the vertex position or not? + * @param {number} alpha - The alpha of the parent object. * - * @return {this} This Scene Manager instance. + * @return {this} This Vertex. */ - run: function (key, data) + update: function (a, b, c, d, e, f, roundPixels, alpha) { - var scene = this.getScene(key); + var tx = this.vx * a + this.vy * c + e; + var ty = this.vx * b + this.vy * d + f; - if (!scene) + if (roundPixels) { - for (var i = 0; i < this._pending.length; i++) - { - if (this._pending[i].key === key) - { - this.queueOp('start', key, data); - break; - } - } - return this; + tx = Math.round(tx); + ty = Math.round(ty); } - if (scene.sys.isSleeping()) - { - // Sleeping? - scene.sys.wake(data); - } - else if (scene.sys.isPaused()) - { - // Paused? - scene.sys.resume(data); - } - else - { - // Not actually running? - this.start(key, data); - } + this.tx = tx; + this.ty = ty; + this.ta = this.alpha * alpha; + + return this; }, /** - * Starts the given Scene. + * Loads the data from this Vertex into the given Typed Arrays. * - * @method Phaser.Scenes.SceneManager#start - * @since 3.0.0 + * @method Phaser.Geom.Mesh.Vertex#load + * @since 3.50.0 * - * @param {(string|Phaser.Scene)} key - The Scene to start. - * @param {object} [data] - Optional data object to pass to `Scene.Settings` and `Scene.init`, and `Scene.create`. + * @param {Float32Array} F32 - A Float32 Array to insert the position, UV and unit data in to. + * @param {Uint32Array} U32 - A Uint32 Array to insert the color and alpha data in to. + * @param {number} offset - The index of the array to insert this Vertex to. + * @param {number} textureUnit - The texture unit currently in use. + * @param {number} tintEffect - The tint effect to use. * - * @return {this} This Scene Manager instance. + * @return {number} The new array offset. */ - start: function (key, data) + load: function (F32, U32, offset, textureUnit, tintEffect) { - // If the Scene Manager is not running, then put the Scene into a holding pattern - if (!this.isBooted) - { - this._data[key] = { - autoStart: true, - data: data - }; + F32[++offset] = this.tx; + F32[++offset] = this.ty; + F32[++offset] = this.tu; + F32[++offset] = this.tv; + F32[++offset] = textureUnit; + F32[++offset] = tintEffect; + U32[++offset] = Utils.getTintAppendFloatAlpha(this.color, this.ta); - return this; - } + return offset; + } - var scene = this.getScene(key); +}); - if (scene) - { - var sys = scene.sys; +module.exports = Vertex; - // If the Scene is already running (perhaps they called start from a launched sub-Scene?) - // then we close it down before starting it again. - if (sys.isActive() || sys.isPaused()) - { - sys.shutdown(); - sys.sceneUpdate = NOOP; +/***/ }), - sys.start(data); - } - else - { - sys.sceneUpdate = NOOP; +/***/ 14293: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - sys.start(data); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var loader; +/** + * @namespace Phaser.Geom.Mesh + */ - if (sys.load) - { - loader = sys.load; - } +var Mesh = { - // Files payload? - if (loader && sys.settings.hasOwnProperty('pack')) - { - loader.reset(); + Face: __webpack_require__(18693), + GenerateGridVerts: __webpack_require__(99425), + GenerateObjVerts: __webpack_require__(53267), + GenerateVerts: __webpack_require__(67623), + ParseObj: __webpack_require__(27291), + ParseObjMaterial: __webpack_require__(76799), + RotateFace: __webpack_require__(15313), + Vertex: __webpack_require__(85769) - if (loader.addPack({ payload: sys.settings.pack })) - { - sys.settings.status = CONST.LOADING; +}; - loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this); +module.exports = Mesh; - loader.start(); - return this; - } - } - } +/***/ }), - this.bootScene(scene); - } +/***/ 77601: +/***/ ((module) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Stops the given Scene. - * - * @method Phaser.Scenes.SceneManager#stop - * @since 3.0.0 - * - * @param {(string|Phaser.Scene)} key - The Scene to stop. - * @param {object} [data] - Optional data object to pass to Scene.shutdown. - * - * @return {this} This Scene Manager instance. - */ - stop: function (key, data) - { - var scene = this.getScene(key); +/** + * Apply `Math.ceil()` to each coordinate of the given Point. + * + * @function Phaser.Geom.Point.Ceil + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [point,$return] + * + * @param {Phaser.Geom.Point} point - The Point to ceil. + * + * @return {Phaser.Geom.Point} The Point with `Math.ceil()` applied to its coordinates. + */ +var Ceil = function (point) +{ + return point.setTo(Math.ceil(point.x), Math.ceil(point.y)); +}; - if (scene && !scene.sys.isTransitioning()) - { - scene.sys.shutdown(data); - } +module.exports = Ceil; - return this; - }, - /** - * Sleeps one one Scene and starts the other. - * - * @method Phaser.Scenes.SceneManager#switch - * @since 3.0.0 - * - * @param {(string|Phaser.Scene)} from - The Scene to sleep. - * @param {(string|Phaser.Scene)} to - The Scene to start. - * - * @return {this} This Scene Manager instance. - */ - switch: function (from, to) - { - var sceneA = this.getScene(from); - var sceneB = this.getScene(to); +/***/ }), - if (sceneA && sceneB && sceneA !== sceneB) - { - this.sleep(from); +/***/ 38933: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (this.isSleeping(to)) - { - this.wake(to); - } - else - { - this.start(to); - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var Point = __webpack_require__(79967); - /** - * Retrieves a Scene by numeric index. - * - * @method Phaser.Scenes.SceneManager#getAt - * @since 3.0.0 - * - * @param {number} index - The index of the Scene to retrieve. - * - * @return {(Phaser.Scene|undefined)} The Scene. - */ - getAt: function (index) - { - return this.scenes[index]; - }, +/** + * Clone the given Point. + * + * @function Phaser.Geom.Point.Clone + * @since 3.0.0 + * + * @param {Phaser.Geom.Point} source - The source Point to clone. + * + * @return {Phaser.Geom.Point} The cloned Point. + */ +var Clone = function (source) +{ + return new Point(source.x, source.y); +}; - /** - * Retrieves the numeric index of a Scene. - * - * @method Phaser.Scenes.SceneManager#getIndex - * @since 3.0.0 - * - * @param {(string|Phaser.Scene)} key - The key of the Scene. - * - * @return {number} The index of the Scene. - */ - getIndex: function (key) - { - var scene = this.getScene(key); +module.exports = Clone; - return this.scenes.indexOf(scene); - }, - /** - * Brings a Scene to the top of the Scenes list. - * - * This means it will render above all other Scenes. - * - * @method Phaser.Scenes.SceneManager#bringToTop - * @since 3.0.0 - * - * @param {(string|Phaser.Scene)} key - The Scene to move. - * - * @return {this} This Scene Manager instance. - */ - bringToTop: function (key) - { - if (this.isProcessing) - { - this._queue.push({ op: 'bringToTop', keyA: key, keyB: null }); - } - else - { - var index = this.getIndex(key); +/***/ }), - if (index !== -1 && index < this.scenes.length) - { - var scene = this.getScene(key); +/***/ 47103: +/***/ ((module) => { - this.scenes.splice(index, 1); - this.scenes.push(scene); - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +/** + * Copy the values of one Point to a destination Point. + * + * @function Phaser.Geom.Point.CopyFrom + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [dest,$return] + * + * @param {Phaser.Geom.Point} source - The source Point to copy the values from. + * @param {Phaser.Geom.Point} dest - The destination Point to copy the values to. + * + * @return {Phaser.Geom.Point} The destination Point. + */ +var CopyFrom = function (source, dest) +{ + return dest.setTo(source.x, source.y); +}; - /** - * Sends a Scene to the back of the Scenes list. - * - * This means it will render below all other Scenes. - * - * @method Phaser.Scenes.SceneManager#sendToBack - * @since 3.0.0 - * - * @param {(string|Phaser.Scene)} key - The Scene to move. - * - * @return {this} This Scene Manager instance. - */ - sendToBack: function (key) - { - if (this.isProcessing) - { - this._queue.push({ op: 'sendToBack', keyA: key, keyB: null }); - } - else - { - var index = this.getIndex(key); +module.exports = CopyFrom; - if (index !== -1 && index > 0) - { - var scene = this.getScene(key); - this.scenes.splice(index, 1); - this.scenes.unshift(scene); - } - } +/***/ }), - return this; - }, +/***/ 13625: +/***/ ((module) => { - /** - * Moves a Scene down one position in the Scenes list. - * - * @method Phaser.Scenes.SceneManager#moveDown - * @since 3.0.0 - * - * @param {(string|Phaser.Scene)} key - The Scene to move. - * - * @return {this} This Scene Manager instance. - */ - moveDown: function (key) - { - if (this.isProcessing) - { - this._queue.push({ op: 'moveDown', keyA: key, keyB: null }); - } - else - { - var indexA = this.getIndex(key); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (indexA > 0) - { - var indexB = indexA - 1; - var sceneA = this.getScene(key); - var sceneB = this.getAt(indexB); +/** + * A comparison of two `Point` objects to see if they are equal. + * + * @function Phaser.Geom.Point.Equals + * @since 3.0.0 + * + * @param {Phaser.Geom.Point} point - The original `Point` to compare against. + * @param {Phaser.Geom.Point} toCompare - The second `Point` to compare. + * + * @return {boolean} Returns true if the both `Point` objects are equal. + */ +var Equals = function (point, toCompare) +{ + return (point.x === toCompare.x && point.y === toCompare.y); +}; - this.scenes[indexA] = sceneB; - this.scenes[indexB] = sceneA; - } - } +module.exports = Equals; - return this; - }, - /** - * Moves a Scene up one position in the Scenes list. - * - * @method Phaser.Scenes.SceneManager#moveUp - * @since 3.0.0 - * - * @param {(string|Phaser.Scene)} key - The Scene to move. - * - * @return {this} This Scene Manager instance. - */ - moveUp: function (key) - { - if (this.isProcessing) - { - this._queue.push({ op: 'moveUp', keyA: key, keyB: null }); - } - else - { - var indexA = this.getIndex(key); +/***/ }), - if (indexA < this.scenes.length - 1) - { - var indexB = indexA + 1; - var sceneA = this.getScene(key); - var sceneB = this.getAt(indexB); +/***/ 12536: +/***/ ((module) => { - this.scenes[indexA] = sceneB; - this.scenes[indexB] = sceneA; - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +/** + * Apply `Math.ceil()` to each coordinate of the given Point. + * + * @function Phaser.Geom.Point.Floor + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [point,$return] + * + * @param {Phaser.Geom.Point} point - The Point to floor. + * + * @return {Phaser.Geom.Point} The Point with `Math.floor()` applied to its coordinates. + */ +var Floor = function (point) +{ + return point.setTo(Math.floor(point.x), Math.floor(point.y)); +}; - /** - * Moves a Scene so it is immediately above another Scene in the Scenes list. - * - * This means it will render over the top of the other Scene. - * - * @method Phaser.Scenes.SceneManager#moveAbove - * @since 3.2.0 - * - * @param {(string|Phaser.Scene)} keyA - The Scene that Scene B will be moved above. - * @param {(string|Phaser.Scene)} keyB - The Scene to be moved. - * - * @return {this} This Scene Manager instance. - */ - moveAbove: function (keyA, keyB) - { - if (keyA === keyB) - { - return this; - } +module.exports = Floor; - if (this.isProcessing) - { - this._queue.push({ op: 'moveAbove', keyA: keyA, keyB: keyB }); - } - else - { - var indexA = this.getIndex(keyA); - var indexB = this.getIndex(keyB); - if (indexA !== -1 && indexB !== -1) - { - var tempScene = this.getAt(indexB); +/***/ }), - // Remove - this.scenes.splice(indexB, 1); +/***/ 54205: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Add in new location - this.scenes.splice(indexA + 1, 0, tempScene); - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var Point = __webpack_require__(79967); - /** - * Moves a Scene so it is immediately below another Scene in the Scenes list. - * - * This means it will render behind the other Scene. - * - * @method Phaser.Scenes.SceneManager#moveBelow - * @since 3.2.0 - * - * @param {(string|Phaser.Scene)} keyA - The Scene that Scene B will be moved above. - * @param {(string|Phaser.Scene)} keyB - The Scene to be moved. - * - * @return {this} This Scene Manager instance. - */ - moveBelow: function (keyA, keyB) +/** + * Get the centroid or geometric center of a plane figure (the arithmetic mean position of all the points in the figure). + * Informally, it is the point at which a cutout of the shape could be perfectly balanced on the tip of a pin. + * + * @function Phaser.Geom.Point.GetCentroid + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Types.Math.Vector2Like[]} points - An array of Vector2Like objects to get the geometric center of. + * @param {Phaser.Geom.Point} [out] - A Point object to store the output coordinates in. If not given, a new Point instance is created. + * + * @return {Phaser.Geom.Point} A Point object representing the geometric center of the given points. + */ +var GetCentroid = function (points, out) +{ + if (out === undefined) { out = new Point(); } + + if (!Array.isArray(points)) { - if (keyA === keyB) - { - return this; - } + throw new Error('GetCentroid points argument must be an array'); + } - if (this.isProcessing) + var len = points.length; + + if (len < 1) + { + throw new Error('GetCentroid points array must not be empty'); + } + else if (len === 1) + { + out.x = points[0].x; + out.y = points[0].y; + } + else + { + for (var i = 0; i < len; i++) { - this._queue.push({ op: 'moveBelow', keyA: keyA, keyB: keyB }); + out.x += points[i].x; + out.y += points[i].y; } - else - { - var indexA = this.getIndex(keyA); - var indexB = this.getIndex(keyB); - if (indexA !== -1 && indexB !== -1) - { - var tempScene = this.getAt(indexB); + out.x /= len; + out.y /= len; + } - // Remove - this.scenes.splice(indexB, 1); + return out; +}; - if (indexA === 0) - { - this.scenes.unshift(tempScene); - } - else - { - // Add in new location - this.scenes.splice(indexA, 0, tempScene); - } - } - } +module.exports = GetCentroid; - return this; - }, - /** - * Queue a Scene operation for the next update. - * - * @method Phaser.Scenes.SceneManager#queueOp - * @private - * @since 3.0.0 - * - * @param {string} op - The operation to perform. - * @param {(string|Phaser.Scene)} keyA - Scene A. - * @param {(any|string|Phaser.Scene)} [keyB] - Scene B, or a data object. - * - * @return {this} This Scene Manager instance. - */ - queueOp: function (op, keyA, keyB) - { - this._queue.push({ op: op, keyA: keyA, keyB: keyB }); +/***/ }), - return this; - }, +/***/ 50083: +/***/ ((module) => { - /** - * Swaps the positions of two Scenes in the Scenes list. - * - * @method Phaser.Scenes.SceneManager#swapPosition - * @since 3.0.0 - * - * @param {(string|Phaser.Scene)} keyA - The first Scene to swap. - * @param {(string|Phaser.Scene)} keyB - The second Scene to swap. - * - * @return {this} This Scene Manager instance. - */ - swapPosition: function (keyA, keyB) - { - if (keyA === keyB) - { - return this; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (this.isProcessing) - { - this._queue.push({ op: 'swapPosition', keyA: keyA, keyB: keyB }); - } - else - { - var indexA = this.getIndex(keyA); - var indexB = this.getIndex(keyB); +/** + * Calculate the magnitude of the point, which equivalent to the length of the line from the origin to this point. + * + * @function Phaser.Geom.Point.GetMagnitude + * @since 3.0.0 + * + * @param {Phaser.Geom.Point} point - The point to calculate the magnitude for + * + * @return {number} The resulting magnitude + */ +var GetMagnitude = function (point) +{ + return Math.sqrt((point.x * point.x) + (point.y * point.y)); +}; - if (indexA !== indexB && indexA !== -1 && indexB !== -1) - { - var tempScene = this.getAt(indexA); +module.exports = GetMagnitude; - this.scenes[indexA] = this.scenes[indexB]; - this.scenes[indexB] = tempScene; - } - } - return this; - }, +/***/ }), - /** - * Dumps debug information about each Scene to the developer console. - * - * @method Phaser.Scenes.SceneManager#dump - * @since 3.2.0 - */ - dump: function () - { - var out = []; - var map = [ 'pending', 'init', 'start', 'loading', 'creating', 'running', 'paused', 'sleeping', 'shutdown', 'destroyed' ]; +/***/ 82712: +/***/ ((module) => { - for (var i = 0; i < this.scenes.length; i++) - { - var sys = this.scenes[i].sys; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var key = (sys.settings.visible && (sys.settings.status === CONST.RUNNING || sys.settings.status === CONST.PAUSED)) ? '[*] ' : '[-] '; - key += sys.settings.key + ' (' + map[sys.settings.status] + ')'; +/** + * Calculates the square of magnitude of given point.(Can be used for fast magnitude calculation of point) + * + * @function Phaser.Geom.Point.GetMagnitudeSq + * @since 3.0.0 + * + * @param {Phaser.Geom.Point} point - Returns square of the magnitude/length of given point. + * + * @return {number} Returns square of the magnitude of given point. + */ +var GetMagnitudeSq = function (point) +{ + return (point.x * point.x) + (point.y * point.y); +}; - out.push(key); - } +module.exports = GetMagnitudeSq; - console.log(out.join('\n')); - }, - /** - * Destroy this Scene Manager and all of its systems. - * - * This process cannot be reversed. - * - * This method is called automatically when a Phaser Game instance is destroyed. - * - * @method Phaser.Scenes.SceneManager#destroy - * @since 3.0.0 - */ - destroy: function () +/***/ }), + +/***/ 20052: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Rectangle = __webpack_require__(74118); + +/** + * Calculates the Axis Aligned Bounding Box (or aabb) from an array of points. + * + * @function Phaser.Geom.Point.GetRectangleFromPoints + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * + * @param {Phaser.Types.Math.Vector2Like[]} points - An array of Vector2Like objects to get the AABB from. + * @param {Phaser.Geom.Rectangle} [out] - A Rectangle object to store the results in. If not given, a new Rectangle instance is created. + * + * @return {Phaser.Geom.Rectangle} A Rectangle object holding the AABB values for the given points. + */ +var GetRectangleFromPoints = function (points, out) +{ + if (out === undefined) { out = new Rectangle(); } + + var xMax = Number.NEGATIVE_INFINITY; + var xMin = Number.POSITIVE_INFINITY; + var yMax = Number.NEGATIVE_INFINITY; + var yMin = Number.POSITIVE_INFINITY; + + for (var i = 0; i < points.length; i++) { - for (var i = 0; i < this.scenes.length; i++) - { - var sys = this.scenes[i].sys; + var point = points[i]; - sys.destroy(); + if (point.x > xMax) + { + xMax = point.x; } - this.update = NOOP; - - this.scenes = []; + if (point.x < xMin) + { + xMin = point.x; + } - this._pending = []; - this._start = []; - this._queue = []; + if (point.y > yMax) + { + yMax = point.y; + } - this.game = null; + if (point.y < yMin) + { + yMin = point.y; + } } -}); + out.x = xMin; + out.y = yMin; + out.width = xMax - xMin; + out.height = yMax - yMin; -module.exports = SceneManager; + return out; +}; + +module.exports = GetRectangleFromPoints; /***/ }), -/* 418 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 77154: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Systems = __webpack_require__(204); +var Point = __webpack_require__(79967); /** - * @classdesc - * A base Phaser.Scene class which can be extended for your own use. - * - * You can also define the optional methods {@link Phaser.Types.Scenes.SceneInitCallback init()}, {@link Phaser.Types.Scenes.ScenePreloadCallback preload()}, and {@link Phaser.Types.Scenes.SceneCreateCallback create()}. + * Returns the linear interpolation point between the two given points, based on `t`. * - * @class Scene - * @memberof Phaser - * @constructor + * @function Phaser.Geom.Point.Interpolate * @since 3.0.0 * - * @param {(string|Phaser.Types.Scenes.SettingsConfig)} config - Scene specific configuration settings. + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Point} pointA - The starting `Point` for the interpolation. + * @param {Phaser.Geom.Point} pointB - The target `Point` for the interpolation. + * @param {number} [t=0] - The amount to interpolate between the two points. Generally, a value between 0 (returns the starting `Point`) and 1 (returns the target `Point`). If omitted, 0 is used. + * @param {(Phaser.Geom.Point|object)} [out] - An optional `Point` object whose `x` and `y` values will be set to the result of the interpolation (can also be any object with `x` and `y` properties). If omitted, a new `Point` created and returned. + * + * @return {(Phaser.Geom.Point|object)} Either the object from the `out` argument with the properties `x` and `y` set to the result of the interpolation or a newly created `Point` object. */ -var Scene = new Class({ +var Interpolate = function (pointA, pointB, t, out) +{ + if (t === undefined) { t = 0; } + if (out === undefined) { out = new Point(); } - initialize: + out.x = pointA.x + ((pointB.x - pointA.x) * t); + out.y = pointA.y + ((pointB.y - pointA.y) * t); - function Scene (config) - { - /** - * The Scene Systems. You must never overwrite this property, or all hell will break lose. - * - * @name Phaser.Scene#sys - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.sys = new Systems(this, config); + return out; +}; - /** - * A reference to the Phaser.Game instance. - * - * This property will only be available if defined in the Scene Injection Map. - * - * @name Phaser.Scene#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game; +module.exports = Interpolate; - /** - * A reference to the global Animation Manager. - * - * This property will only be available if defined in the Scene Injection Map. - * - * @name Phaser.Scene#anims - * @type {Phaser.Animations.AnimationManager} - * @since 3.0.0 - */ - this.anims; - /** - * A reference to the global Cache. - * - * This property will only be available if defined in the Scene Injection Map. - * - * @name Phaser.Scene#cache - * @type {Phaser.Cache.CacheManager} - * @since 3.0.0 - */ - this.cache; +/***/ }), - /** - * A reference to the global Data Manager. - * - * This property will only be available if defined in the Scene Injection Map. - * - * @name Phaser.Scene#registry - * @type {Phaser.Data.DataManager} - * @since 3.0.0 - */ - this.registry; +/***/ 42397: +/***/ ((module) => { - /** - * A reference to the Sound Manager. - * - * This property will only be available if defined in the Scene Injection Map and the plugin is installed. - * - * @name Phaser.Scene#sound - * @type {(Phaser.Sound.NoAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager|Phaser.Sound.WebAudioSoundManager)} - * @since 3.0.0 - */ - this.sound; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * A reference to the Texture Manager. - * - * This property will only be available if defined in the Scene Injection Map. - * - * @name Phaser.Scene#textures - * @type {Phaser.Textures.TextureManager} - * @since 3.0.0 - */ - this.textures; +/** + * Swaps the X and the Y coordinate of a point. + * + * @function Phaser.Geom.Point.Invert + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [point,$return] + * + * @param {Phaser.Geom.Point} point - The Point to modify. + * + * @return {Phaser.Geom.Point} The modified `point`. + */ +var Invert = function (point) +{ + return point.setTo(point.y, point.x); +}; - /** - * A Scene specific Event Emitter. - * - * This property will only be available if defined in the Scene Injection Map. - * - * @name Phaser.Scene#events - * @type {Phaser.Events.EventEmitter} - * @since 3.0.0 - */ - this.events; +module.exports = Invert; - /** - * The Scene Camera Manager. - * - * This property will only be available if defined in the Scene Injection Map. - * - * @name Phaser.Scene#cameras - * @type {Phaser.Cameras.Scene2D.CameraManager} - * @since 3.0.0 - */ - this.cameras; - /** - * The Scene Game Object Factory. - * - * This property will only be available if defined in the Scene Injection Map. - * - * @name Phaser.Scene#add - * @type {Phaser.GameObjects.GameObjectFactory} - * @since 3.0.0 - */ - this.add; +/***/ }), - /** - * The Scene Game Object Creator. - * - * This property will only be available if defined in the Scene Injection Map. - * - * @name Phaser.Scene#make - * @type {Phaser.GameObjects.GameObjectCreator} - * @since 3.0.0 - */ - this.make; +/***/ 59464: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * A reference to the Scene Manager Plugin. - * - * This property will only be available if defined in the Scene Injection Map. - * - * @name Phaser.Scene#scene - * @type {Phaser.Scenes.ScenePlugin} - * @since 3.0.0 - */ - this.scene; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The Game Object Display List belonging to this Scene. - * - * This property will only be available if defined in the Scene Injection Map. - * - * @name Phaser.Scene#children - * @type {Phaser.GameObjects.DisplayList} - * @since 3.0.0 - */ - this.children; +var Point = __webpack_require__(79967); - /** - * The Scene Lights Manager Plugin. - * - * This property will only be available if defined in the Scene Injection Map and the plugin is installed. - * - * @name Phaser.Scene#lights - * @type {Phaser.GameObjects.LightsManager} - * @since 3.0.0 - */ - this.lights; +/** + * Inverts a Point's coordinates. + * + * @function Phaser.Geom.Point.Negative + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Point} point - The Point to invert. + * @param {Phaser.Geom.Point} [out] - The Point to return the inverted coordinates in. + * + * @return {Phaser.Geom.Point} The modified `out` Point, or a new Point if none was provided. + */ +var Negative = function (point, out) +{ + if (out === undefined) { out = new Point(); } - /** - * A Scene specific Data Manager Plugin. - * - * See the `registry` property for the global Data Manager. - * - * This property will only be available if defined in the Scene Injection Map and the plugin is installed. - * - * @name Phaser.Scene#data - * @type {Phaser.Data.DataManager} - * @since 3.0.0 - */ - this.data; + return out.setTo(-point.x, -point.y); +}; - /** - * The Scene Input Manager Plugin. - * - * This property will only be available if defined in the Scene Injection Map and the plugin is installed. - * - * @name Phaser.Scene#input - * @type {Phaser.Input.InputPlugin} - * @since 3.0.0 - */ - this.input; +module.exports = Negative; - /** - * The Scene Loader Plugin. - * - * This property will only be available if defined in the Scene Injection Map and the plugin is installed. - * - * @name Phaser.Scene#load - * @type {Phaser.Loader.LoaderPlugin} - * @since 3.0.0 - */ - this.load; - /** - * The Scene Time and Clock Plugin. - * - * This property will only be available if defined in the Scene Injection Map and the plugin is installed. - * - * @name Phaser.Scene#time - * @type {Phaser.Time.Clock} - * @since 3.0.0 - */ - this.time; +/***/ }), - /** - * The Scene Tween Manager Plugin. - * - * This property will only be available if defined in the Scene Injection Map and the plugin is installed. - * - * @name Phaser.Scene#tweens - * @type {Phaser.Tweens.TweenManager} - * @since 3.0.0 - */ - this.tweens; +/***/ 79967: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The Scene Arcade Physics Plugin. - * - * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured. - * - * @name Phaser.Scene#physics - * @type {Phaser.Physics.Arcade.ArcadePhysics} - * @since 3.0.0 - */ - this.physics; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The Scene Matter Physics Plugin. - * - * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured. - * - * @name Phaser.Scene#matter - * @type {Phaser.Physics.Matter.MatterPhysics} - * @since 3.0.0 - */ - this.matter; +var Class = __webpack_require__(56694); +var GEOM_CONST = __webpack_require__(52394); - if (false) - {} +/** + * @classdesc + * Defines a Point in 2D space, with an x and y component. + * + * @class Point + * @memberof Phaser.Geom + * @constructor + * @since 3.0.0 + * + * @param {number} [x=0] - The x coordinate of this Point. + * @param {number} [y=x] - The y coordinate of this Point. + */ +var Point = new Class({ + + initialize: + + function Point (x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = x; } /** - * A reference to the global Scale Manager. - * - * This property will only be available if defined in the Scene Injection Map. + * The geometry constant type of this object: `GEOM_CONST.POINT`. + * Used for fast type comparisons. * - * @name Phaser.Scene#scale - * @type {Phaser.Scale.ScaleManager} - * @since 3.16.2 + * @name Phaser.Geom.Point#type + * @type {number} + * @readonly + * @since 3.19.0 */ - this.scale; + this.type = GEOM_CONST.POINT; /** - * A reference to the global Plugin Manager. - * - * The Plugin Manager is a global system that allows plugins to register themselves with it, and can then install - * those plugins into Scenes as required. + * The x coordinate of this Point. * - * @name Phaser.Scene#plugins - * @type {Phaser.Plugins.PluginManager} + * @name Phaser.Geom.Point#x + * @type {number} + * @default 0 * @since 3.0.0 */ - this.plugins; + this.x = x; /** - * A reference to the renderer instance Phaser is using, either Canvas Renderer or WebGL Renderer. + * The y coordinate of this Point. * - * @name Phaser.Scene#renderer - * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} - * @since 3.50.0 + * @name Phaser.Geom.Point#y + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.renderer; + this.y = y; }, /** - * This method should be overridden by your own Scenes. - * - * This method is called once per game step while the scene is running. + * Set the x and y coordinates of the point to the given values. * - * @method Phaser.Scene#update + * @method Phaser.Geom.Point#setTo * @since 3.0.0 * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * @param {number} [x=0] - The x coordinate of this Point. + * @param {number} [y=x] - The y coordinate of this Point. + * + * @return {this} This Point object. */ - update: function () + setTo: function (x, y) { + if (x === undefined) { x = 0; } + if (y === undefined) { y = x; } + + this.x = x; + this.y = y; + + return this; } }); -module.exports = Scene; +module.exports = Point; /***/ }), -/* 419 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 53581: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetFastValue = __webpack_require__(2); -var UppercaseFirst = __webpack_require__(205); +var Point = __webpack_require__(79967); +var GetMagnitudeSq = __webpack_require__(82712); /** - * Builds an array of which physics plugins should be activated for the given Scene. + * Calculates the vector projection of `pointA` onto the nonzero `pointB`. This is the + * orthogonal projection of `pointA` onto a straight line parallel to `pointB`. * - * @function Phaser.Scenes.GetPhysicsPlugins + * @function Phaser.Geom.Point.Project * @since 3.0.0 * - * @param {Phaser.Scenes.Systems} sys - The scene system to get the physics systems of. + * @generic {Phaser.Geom.Point} O - [out,$return] * - * @return {array} An array of Physics systems to start for this Scene. + * @param {Phaser.Geom.Point} pointA - Point A, to be projected onto Point B. + * @param {Phaser.Geom.Point} pointB - Point B, to have Point A projected upon it. + * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. + * + * @return {Phaser.Geom.Point} A Point object holding the coordinates of the vector projection of `pointA` onto `pointB`. */ -var GetPhysicsPlugins = function (sys) +var Project = function (pointA, pointB, out) { - var defaultSystem = sys.game.config.defaultPhysicsSystem; - var sceneSystems = GetFastValue(sys.settings, 'physics', false); - - if (!defaultSystem && !sceneSystems) - { - // No default physics system or systems in this scene - return; - } - - // Let's build the systems array - var output = []; + if (out === undefined) { out = new Point(); } - if (defaultSystem) - { - output.push(UppercaseFirst(defaultSystem + 'Physics')); - } + var dot = ((pointA.x * pointB.x) + (pointA.y * pointB.y)); + var amt = dot / GetMagnitudeSq(pointB); - if (sceneSystems) + if (amt !== 0) { - for (var key in sceneSystems) - { - key = UppercaseFirst(key.concat('Physics')); - - if (output.indexOf(key) === -1) - { - output.push(key); - } - } + out.x = amt * pointB.x; + out.y = amt * pointB.y; } - // An array of Physics systems to start for this Scene - return output; + return out; }; -module.exports = GetPhysicsPlugins; +module.exports = Project; /***/ }), -/* 420 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 50817: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetFastValue = __webpack_require__(2); +var Point = __webpack_require__(79967); /** - * Builds an array of which plugins (not including physics plugins) should be activated for the given Scene. + * Calculates the vector projection of `pointA` onto the nonzero `pointB`. This is the + * orthogonal projection of `pointA` onto a straight line paralle to `pointB`. * - * @function Phaser.Scenes.GetScenePlugins + * @function Phaser.Geom.Point.ProjectUnit * @since 3.0.0 * - * @param {Phaser.Scenes.Systems} sys - The Scene Systems object to check for plugins. + * @generic {Phaser.Geom.Point} O - [out,$return] * - * @return {array} An array of all plugins which should be activated, either the default ones or the ones configured in the Scene Systems object. + * @param {Phaser.Geom.Point} pointA - Point A, to be projected onto Point B. Must be a normalized point with a magnitude of 1. + * @param {Phaser.Geom.Point} pointB - Point B, to have Point A projected upon it. + * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. + * + * @return {Phaser.Geom.Point} A unit Point object holding the coordinates of the vector projection of `pointA` onto `pointB`. */ -var GetScenePlugins = function (sys) +var ProjectUnit = function (pointA, pointB, out) { - var defaultPlugins = sys.plugins.getDefaultScenePlugins(); + if (out === undefined) { out = new Point(); } - var scenePlugins = GetFastValue(sys.settings, 'plugins', false); + var amt = ((pointA.x * pointB.x) + (pointA.y * pointB.y)); - // Scene Plugins always override Default Plugins - if (Array.isArray(scenePlugins)) - { - return scenePlugins; - } - else if (defaultPlugins) - { - return defaultPlugins; - } - else + if (amt !== 0) { - // No default plugins or plugins in this scene - return []; + out.x = amt * pointB.x; + out.y = amt * pointB.y; } + + return out; }; -module.exports = GetScenePlugins; +module.exports = ProjectUnit; /***/ }), -/* 421 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 40525: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(144); -var GetValue = __webpack_require__(6); -var Merge = __webpack_require__(127); -var InjectionMap = __webpack_require__(978); +var GetMagnitude = __webpack_require__(50083); /** - * @namespace Phaser.Scenes.Settings + * Changes the magnitude (length) of a two-dimensional vector without changing its direction. + * + * @function Phaser.Geom.Point.SetMagnitude + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [point,$return] + * + * @param {Phaser.Geom.Point} point - The Point to treat as the end point of the vector. + * @param {number} magnitude - The new magnitude of the vector. + * + * @return {Phaser.Geom.Point} The modified Point. */ +var SetMagnitude = function (point, magnitude) +{ + if (point.x !== 0 || point.y !== 0) + { + var m = GetMagnitude(point); -var Settings = { + point.x /= m; + point.y /= m; + } - /** - * Takes a Scene configuration object and returns a fully formed System Settings object. - * - * @function Phaser.Scenes.Settings.create - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Scenes.SettingsConfig)} config - The Scene configuration object used to create this Scene Settings. - * - * @return {Phaser.Types.Scenes.SettingsObject} The Scene Settings object created as a result of the config and default settings. - */ - create: function (config) - { - if (typeof config === 'string') - { - config = { key: config }; - } - else if (config === undefined) - { - // Pass the 'hasOwnProperty' checks - config = {}; - } + point.x *= magnitude; + point.y *= magnitude; - return { + return point; +}; - status: CONST.PENDING, +module.exports = SetMagnitude; - key: GetValue(config, 'key', ''), - active: GetValue(config, 'active', false), - visible: GetValue(config, 'visible', true), - isBooted: false, +/***/ }), - isTransition: false, - transitionFrom: null, - transitionDuration: 0, - transitionAllowInput: true, +/***/ 63472: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Loader payload array +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - data: {}, +var Point = __webpack_require__(79967); - pack: GetValue(config, 'pack', false), +Point.Ceil = __webpack_require__(77601); +Point.Clone = __webpack_require__(38933); +Point.CopyFrom = __webpack_require__(47103); +Point.Equals = __webpack_require__(13625); +Point.Floor = __webpack_require__(12536); +Point.GetCentroid = __webpack_require__(54205); +Point.GetMagnitude = __webpack_require__(50083); +Point.GetMagnitudeSq = __webpack_require__(82712); +Point.GetRectangleFromPoints = __webpack_require__(20052); +Point.Interpolate = __webpack_require__(77154); +Point.Invert = __webpack_require__(42397); +Point.Negative = __webpack_require__(59464); +Point.Project = __webpack_require__(53581); +Point.ProjectUnit = __webpack_require__(50817); +Point.SetMagnitude = __webpack_require__(40525); - // Cameras +module.exports = Point; - cameras: GetValue(config, 'cameras', null), - // Scene Property Injection Map +/***/ }), - map: GetValue(config, 'map', Merge(InjectionMap, GetValue(config, 'mapAdd', {}))), +/***/ 19631: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Physics +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - physics: GetValue(config, 'physics', {}), +var Polygon = __webpack_require__(8580); - // Loader +/** + * Create a new polygon which is a copy of the specified polygon + * + * @function Phaser.Geom.Polygon.Clone + * @since 3.0.0 + * + * @param {Phaser.Geom.Polygon} polygon - The polygon to create a clone of + * + * @return {Phaser.Geom.Polygon} A new separate Polygon cloned from the specified polygon, based on the same points. + */ +var Clone = function (polygon) +{ + return new Polygon(polygon.points); +}; - loader: GetValue(config, 'loader', {}), +module.exports = Clone; - // Plugins - plugins: GetValue(config, 'plugins', false), +/***/ }), - // Input +/***/ 45604: +/***/ ((module) => { - input: GetValue(config, 'input', {}) +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - }; +// Checks whether the x and y coordinates are contained within this polygon. +// Adapted from http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html by Jonas Raoni Soares Silva + +/** + * Checks if a point is within the bounds of a Polygon. + * + * @function Phaser.Geom.Polygon.Contains + * @since 3.0.0 + * + * @param {Phaser.Geom.Polygon} polygon - The Polygon to check against. + * @param {number} x - The X coordinate of the point to check. + * @param {number} y - The Y coordinate of the point to check. + * + * @return {boolean} `true` if the point is within the bounds of the Polygon, otherwise `false`. + */ +var Contains = function (polygon, x, y) +{ + var inside = false; + + for (var i = -1, j = polygon.points.length - 1; ++i < polygon.points.length; j = i) + { + var ix = polygon.points[i].x; + var iy = polygon.points[i].y; + + var jx = polygon.points[j].x; + var jy = polygon.points[j].y; + + if (((iy <= y && y < jy) || (jy <= y && y < iy)) && (x < (jx - ix) * (y - iy) / (jy - iy) + ix)) + { + inside = !inside; + } } + return inside; }; -module.exports = Settings; +module.exports = Contains; /***/ }), -/* 422 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 87289: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(31); -var CanvasTexture = __webpack_require__(423); -var Class = __webpack_require__(0); -var Color = __webpack_require__(38); -var CONST = __webpack_require__(33); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(106); -var GameEvents = __webpack_require__(22); -var GenerateTexture = __webpack_require__(388); -var GetValue = __webpack_require__(6); -var Parser = __webpack_require__(425); -var Texture = __webpack_require__(206); +var Contains = __webpack_require__(45604); /** - * @callback EachTextureCallback + * Checks the given Point again the Polygon to see if the Point lays within its vertices. * - * @param {Phaser.Textures.Texture} texture - Each texture in Texture Manager. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + * @function Phaser.Geom.Polygon.ContainsPoint + * @since 3.0.0 + * + * @param {Phaser.Geom.Polygon} polygon - The Polygon to check. + * @param {Phaser.Geom.Point} point - The Point to check if it's within the Polygon. + * + * @return {boolean} `true` if the Point is within the Polygon, otherwise `false`. + */ +var ContainsPoint = function (polygon, point) +{ + return Contains(polygon, point.x, point.y); +}; + +module.exports = ContainsPoint; + + +/***/ }), + +/***/ 11117: +/***/ ((module) => { + +"use strict"; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @classdesc - * Textures are managed by the global TextureManager. This is a singleton class that is - * responsible for creating and delivering Textures and their corresponding Frames to Game Objects. + * This module implements a modified ear slicing algorithm, optimized by z-order curve hashing and extended to + * handle holes, twisted polygons, degeneracies and self-intersections in a way that doesn't guarantee correctness + * of triangulation, but attempts to always produce acceptable results for practical data. * - * Sprites and other Game Objects get the texture data they need from the TextureManager. + * Example: * - * Access it via `scene.textures`. + * ```javascript + * const triangles = Phaser.Geom.Polygon.Earcut([10,0, 0,50, 60,60, 70,10]); // returns [1,0,3, 3,2,1] + * ``` * - * @class TextureManager - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Textures - * @constructor - * @since 3.0.0 + * Each group of three vertex indices in the resulting array forms a triangle. * - * @param {Phaser.Game} game - The Phaser.Game instance this Texture Manager belongs to. + * ```javascript + * // triangulating a polygon with a hole + * earcut([0,0, 100,0, 100,100, 0,100, 20,20, 80,20, 80,80, 20,80], [4]); + * // [3,0,4, 5,4,0, 3,4,7, 5,0,1, 2,3,7, 6,5,1, 2,7,6, 6,1,2] + * + * // triangulating a polygon with 3d coords + * earcut([10,0,1, 0,50,2, 60,60,3, 70,10,4], null, 3); + * // [1,0,3, 3,2,1] + * ``` + * + * If you pass a single vertex as a hole, Earcut treats it as a Steiner point. + * + * If your input is a multi-dimensional array (e.g. GeoJSON Polygon), you can convert it to the format + * expected by Earcut with `Phaser.Geom.Polygon.Earcut.flatten`: + * + * ```javascript + * var data = earcut.flatten(geojson.geometry.coordinates); + * var triangles = earcut(data.vertices, data.holes, data.dimensions); + * ``` + * + * After getting a triangulation, you can verify its correctness with `Phaser.Geom.Polygon.Earcut.deviation`: + * + * ```javascript + * var deviation = earcut.deviation(vertices, holes, dimensions, triangles); + * ``` + * Returns the relative difference between the total area of triangles and the area of the input polygon. + * 0 means the triangulation is fully correct. + * + * For more information see https://github.com/mapbox/earcut + * + * @function Phaser.Geom.Polygon.Earcut + * @since 3.50.0 + * + * @param {number[]} data - A flat array of vertex coordinate, like [x0,y0, x1,y1, x2,y2, ...] + * @param {number[]} [holeIndices] - An array of hole indices if any (e.g. [5, 8] for a 12-vertex input would mean one hole with vertices 5–7 and another with 8–11). + * @param {number} [dimensions=2] - The number of coordinates per vertex in the input array (2 by default). + * + * @return {number[]} An array of triangulated data. */ -var TextureManager = new Class({ - - Extends: EventEmitter, - - initialize: - - function TextureManager (game) - { - EventEmitter.call(this); - /** - * The Game that this TextureManager belongs to. - * - * @name Phaser.Textures.TextureManager#game - * @type {Phaser.Game} - * @since 3.0.0 - */ - this.game = game; + // Earcut 2.2.4 (July 5th 2022) - /** - * The name of this manager. - * - * @name Phaser.Textures.TextureManager#name - * @type {string} - * @since 3.0.0 - */ - this.name = 'TextureManager'; +/* + * ISC License + * + * Copyright (c) 2016, Mapbox + * + * Permission to use, copy, modify, and/or distribute this software for any purpose + * with or without fee is hereby granted, provided that the above copyright notice + * and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ - /** - * An object that has all of textures that Texture Manager creates. - * Textures are assigned to keys so we can access to any texture that this object has directly by key value without iteration. - * - * @name Phaser.Textures.TextureManager#list - * @type {object} - * @default {} - * @since 3.0.0 - */ - this.list = {}; - /** - * The temporary canvas element to save an pixel data of an arbitrary texture in getPixel() and getPixelAlpha() method. - * - * @name Phaser.Textures.TextureManager#_tempCanvas - * @type {HTMLCanvasElement} - * @private - * @since 3.0.0 - */ - this._tempCanvas = CanvasPool.create2D(this, 1, 1); - /** - * The context of the temporary canvas element made to save an pixel data in getPixel() and getPixelAlpha() method. - * - * @name Phaser.Textures.TextureManager#_tempContext - * @type {CanvasRenderingContext2D} - * @private - * @since 3.0.0 - */ - this._tempContext = this._tempCanvas.getContext('2d'); +function earcut(data, holeIndices, dim) { - /** - * An counting value used for emitting 'ready' event after all of managers in game is loaded. - * - * @name Phaser.Textures.TextureManager#_pending - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._pending = 0; + dim = dim || 2; - game.events.once(GameEvents.BOOT, this.boot, this); - }, + var hasHoles = holeIndices && holeIndices.length, + outerLen = hasHoles ? holeIndices[0] * dim : data.length, + outerNode = linkedList(data, 0, outerLen, dim, true), + triangles = []; - /** - * The Boot Handler called by Phaser.Game when it first starts up. - * - * @method Phaser.Textures.TextureManager#boot - * @private - * @since 3.0.0 - */ - boot: function () - { - this._pending = 3; + if (!outerNode || outerNode.next === outerNode.prev) return triangles; - this.on(Events.LOAD, this.updatePending, this); - this.on(Events.ERROR, this.updatePending, this); + var minX, minY, maxX, maxY, x, y, invSize; - var config = this.game.config; + if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); - this.addBase64('__DEFAULT', config.defaultImage); - this.addBase64('__MISSING', config.missingImage); - this.addBase64('__WHITE', config.whiteImage); + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + if (data.length > 80 * dim) { + minX = maxX = data[0]; + minY = maxY = data[1]; - this.game.events.once(GameEvents.DESTROY, this.destroy, this); - }, + for (var i = dim; i < outerLen; i += dim) { + x = data[i]; + y = data[i + 1]; + if (x < minX) minX = x; + if (y < minY) minY = y; + if (x > maxX) maxX = x; + if (y > maxY) maxY = y; + } - /** - * After 'onload' or 'onerror' invoked twice, emit 'ready' event. - * - * @method Phaser.Textures.TextureManager#updatePending - * @private - * @since 3.0.0 - */ - updatePending: function () - { - this._pending--; + // minX, minY and invSize are later used to transform coords into integers for z-order calculation + invSize = Math.max(maxX - minX, maxY - minY); + invSize = invSize !== 0 ? 32767 / invSize : 0; + } - if (this._pending === 0) - { - this.off(Events.LOAD); - this.off(Events.ERROR); + earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0); - this.emit(Events.READY); - } - }, + return triangles; +} - /** - * Checks the given texture key and throws a console.warn if the key is already in use, then returns false. - * If you wish to avoid the console.warn then use `TextureManager.exists` instead. - * - * @method Phaser.Textures.TextureManager#checkKey - * @since 3.7.0 - * - * @param {string} key - The texture key to check. - * - * @return {boolean} `true` if it's safe to use the texture key, otherwise `false`. - */ - checkKey: function (key) - { - if (this.exists(key)) - { - // eslint-disable-next-line no-console - console.error('Texture key already in use: ' + key); +// create a circular doubly linked list from polygon points in the specified winding order +function linkedList(data, start, end, dim, clockwise) { + var i, last; - return false; - } + if (clockwise === (signedArea(data, start, end, dim) > 0)) { + for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); + } else { + for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); + } - return true; - }, + if (last && equals(last, last.next)) { + removeNode(last); + last = last.next; + } - /** - * Removes a Texture from the Texture Manager and destroys it. This will immediately - * clear all references to it from the Texture Manager, and if it has one, destroy its - * WebGLTexture. This will emit a `removetexture` event. - * - * Note: If you have any Game Objects still using this texture they will start throwing - * errors the next time they try to render. Make sure that removing the texture is the final - * step when clearing down to avoid this. - * - * @method Phaser.Textures.TextureManager#remove - * @fires Phaser.Textures.Events#REMOVE - * @since 3.7.0 - * - * @param {(string|Phaser.Textures.Texture)} key - The key of the Texture to remove, or a reference to it. - * - * @return {Phaser.Textures.TextureManager} The Texture Manager. - */ - remove: function (key) - { - if (typeof key === 'string') - { - if (this.exists(key)) - { - key = this.get(key); - } - else - { - console.warn('No texture found matching key: ' + key); - return this; - } - } + return last; +} - // By this point key should be a Texture, if not, the following fails anyway - if (this.list.hasOwnProperty(key.key)) - { - key.destroy(); +// eliminate colinear or duplicate points +function filterPoints(start, end) { + if (!start) return start; + if (!end) end = start; - this.emit(Events.REMOVE, key.key); - } + var p = start, + again; + do { + again = false; - return this; - }, + if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { + removeNode(p); + p = end = p.prev; + if (p === p.next) break; + again = true; - /** - * Removes a key from the Texture Manager but does not destroy the Texture that was using the key. - * - * @method Phaser.Textures.TextureManager#removeKey - * @since 3.17.0 - * - * @param {string} key - The key to remove from the texture list. - * - * @return {Phaser.Textures.TextureManager} The Texture Manager. - */ - removeKey: function (key) - { - if (this.list.hasOwnProperty(key)) - { - delete this.list[key]; + } else { + p = p.next; } + } while (again || p !== end); - return this; - }, + return end; +} - /** - * Adds a new Texture to the Texture Manager created from the given Base64 encoded data. - * - * It works by creating an `Image` DOM object, then setting the `src` attribute to - * the given base64 encoded data. As a result, the process is asynchronous by its nature, - * so be sure to listen for the events this method dispatches before using the texture. - * - * @method Phaser.Textures.TextureManager#addBase64 - * @fires Phaser.Textures.Events#ADD - * @fires Phaser.Textures.Events#ERROR - * @fires Phaser.Textures.Events#LOAD - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {*} data - The Base64 encoded data. - * - * @return {this} This Texture Manager instance. - */ - addBase64: function (key, data) - { - if (this.checkKey(key)) - { - var _this = this; +// main ear slicing loop which triangulates a polygon (given as a linked list) +function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { + if (!ear) return; - var image = new Image(); + // interlink polygon nodes in z-order + if (!pass && invSize) indexCurve(ear, minX, minY, invSize); - image.onerror = function () - { - _this.emit(Events.ERROR, key); - }; + var stop = ear, + prev, next; - image.onload = function () - { - var texture = _this.create(key, image); + // iterate through ears, slicing them one by one + while (ear.prev !== ear.next) { + prev = ear.prev; + next = ear.next; - Parser.Image(texture, 0); + if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { + // cut off the triangle + triangles.push(prev.i / dim | 0); + triangles.push(ear.i / dim | 0); + triangles.push(next.i / dim | 0); - _this.emit(Events.ADD, key, texture); + removeNode(ear); - _this.emit(Events.LOAD, key, texture); - }; + // skipping the next vertex leads to less sliver triangles + ear = next.next; + stop = next.next; - image.src = data; + continue; } - return this; - }, + ear = next; - /** - * Gets an existing texture frame and converts it into a base64 encoded image and returns the base64 data. - * - * You can also provide the image type and encoder options. - * - * This will only work with bitmap based texture frames, such as those created from Texture Atlases. - * It will not work with GL Texture objects, such as Shaders, or Render Textures. For those please - * see the WebGL Snapshot function instead. - * - * @method Phaser.Textures.TextureManager#getBase64 - * @since 3.12.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {(string|number)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. - * @param {string} [type='image/png'] - A DOMString indicating the image format. The default format type is image/png. - * @param {number} [encoderOptions=0.92] - A Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp. If this argument is anything else, the default value for image quality is used. The default value is 0.92. Other arguments are ignored. - * - * @return {string} The base64 encoded data, or an empty string if the texture frame could not be found. - */ - getBase64: function (key, frame, type, encoderOptions) - { - if (type === undefined) { type = 'image/png'; } - if (encoderOptions === undefined) { encoderOptions = 0.92; } + // if we looped through the whole remaining polygon and can't find any more ears + if (ear === stop) { + // try filtering points and slicing again + if (!pass) { + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); - var data = ''; + // if this didn't work, try curing all small self-intersections locally + } else if (pass === 1) { + ear = cureLocalIntersections(filterPoints(ear), triangles, dim); + earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); - var textureFrame = this.getFrame(key, frame); + // as a last resort, try splitting the remaining polygon into two + } else if (pass === 2) { + splitEarcut(ear, triangles, dim, minX, minY, invSize); + } - if (textureFrame && (textureFrame.source.isRenderTexture || textureFrame.source.isGLTexture)) - { - console.warn('Cannot getBase64 from WebGL Texture'); + break; } - else if (textureFrame) - { - var cd = textureFrame.canvasData; + } +} - var canvas = CanvasPool.create2D(this, cd.width, cd.height); - var ctx = canvas.getContext('2d'); +// check whether a polygon node forms a valid ear with adjacent nodes +function isEar(ear) { + var a = ear.prev, + b = ear, + c = ear.next; - ctx.drawImage( - textureFrame.source.image, - cd.x, - cd.y, - cd.width, - cd.height, - 0, - 0, - cd.width, - cd.height - ); + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear - data = canvas.toDataURL(type, encoderOptions); + // now make sure we don't have other points inside the potential ear + var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y; - CanvasPool.remove(canvas); - } + // triangle bbox; min & max are calculated like this for speed + var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx), + y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy), + x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx), + y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy); + + var p = c.next; + while (p !== a) { + if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && + pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && + area(p.prev, p, p.next) >= 0) return false; + p = p.next; + } - return data; - }, + return true; +} - /** - * Adds a new Texture to the Texture Manager created from the given Image element. - * - * @method Phaser.Textures.TextureManager#addImage - * @fires Phaser.Textures.Events#ADD - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {HTMLImageElement} source - The source Image element. - * @param {HTMLImageElement|HTMLCanvasElement} [dataSource] - An optional data Image element. - * - * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. - */ - addImage: function (key, source, dataSource) - { - var texture = null; +function isEarHashed(ear, minX, minY, invSize) { + var a = ear.prev, + b = ear, + c = ear.next; - if (this.checkKey(key)) - { - texture = this.create(key, source); + if (area(a, b, c) >= 0) return false; // reflex, can't be an ear - Parser.Image(texture, 0); + var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y; - if (dataSource) - { - texture.setDataSource(dataSource); - } + // triangle bbox; min & max are calculated like this for speed + var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx), + y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy), + x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx), + y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy); - this.emit(Events.ADD, key, texture); - } + // z-order range for the current triangle bbox; + var minZ = zOrder(x0, y0, minX, minY, invSize), + maxZ = zOrder(x1, y1, minX, minY, invSize); - return texture; - }, + var p = ear.prevZ, + n = ear.nextZ; - /** - * Takes a WebGL Texture and creates a Phaser Texture from it, which is added to the Texture Manager using the given key. - * - * This allows you to then use the Texture as a normal texture for texture based Game Objects like Sprites. - * - * If the `width` and `height` arguments are omitted, but the WebGL Texture was created by Phaser's WebGL Renderer - * and has `glTexture.width` and `glTexture.height` properties, these values will be used instead. - * - * This is a WebGL only feature. - * - * @method Phaser.Textures.TextureManager#addGLTexture - * @fires Phaser.Textures.Events#ADD - * @since 3.19.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {WebGLTexture} glTexture - The source Render Texture. - * @param {number} [width] - The new width of the Texture. Read from `glTexture.width` if omitted. - * @param {number} [height] - The new height of the Texture. Read from `glTexture.height` if omitted. - * - * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. - */ - addGLTexture: function (key, glTexture, width, height) - { - var texture = null; + // look for points inside the triangle in both directions + while (p && p.z >= minZ && n && n.z <= maxZ) { + if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; - if (this.checkKey(key)) - { - if (width === undefined) { width = glTexture.width; } - if (height === undefined) { height = glTexture.height; } + if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; + } - texture = this.create(key, glTexture, width, height); + // look for remaining points in decreasing z-order + while (p && p.z >= minZ) { + if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; + p = p.prevZ; + } - texture.add('__BASE', 0, 0, 0, width, height); + // look for remaining points in increasing z-order + while (n && n.z <= maxZ) { + if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && + pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; + n = n.nextZ; + } - this.emit(Events.ADD, key, texture); - } + return true; +} - return texture; - }, +// go through all polygon nodes and cure small local self-intersections +function cureLocalIntersections(start, triangles, dim) { + var p = start; + do { + var a = p.prev, + b = p.next.next; - /** - * Adds a Render Texture to the Texture Manager using the given key. - * This allows you to then use the Render Texture as a normal texture for texture based Game Objects like Sprites. - * - * @method Phaser.Textures.TextureManager#addRenderTexture - * @fires Phaser.Textures.Events#ADD - * @since 3.12.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {Phaser.GameObjects.RenderTexture} renderTexture - The source Render Texture. - * - * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. - */ - addRenderTexture: function (key, renderTexture) - { - var texture = null; + if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { - if (this.checkKey(key)) - { - texture = this.create(key, renderTexture); + triangles.push(a.i / dim | 0); + triangles.push(p.i / dim | 0); + triangles.push(b.i / dim | 0); - texture.add('__BASE', 0, 0, 0, renderTexture.width, renderTexture.height); + // remove two nodes involved + removeNode(p); + removeNode(p.next); - this.emit(Events.ADD, key, texture); + p = start = b; } + p = p.next; + } while (p !== start); - return texture; - }, - - /** - * Creates a new Texture using the given config values. - * - * Generated textures consist of a Canvas element to which the texture data is drawn. - * - * Generates a texture based on the given Create configuration object. - * - * The texture is drawn using a fixed-size indexed palette of 16 colors, where the hex value in the - * data cells map to a single color. For example, if the texture config looked like this: - * - * ```javascript - * var star = [ - * '.....828.....', - * '....72227....', - * '....82228....', - * '...7222227...', - * '2222222222222', - * '8222222222228', - * '.72222222227.', - * '..787777787..', - * '..877777778..', - * '.78778887787.', - * '.27887.78872.', - * '.787.....787.' - * ]; - * - * this.textures.generate('star', { data: star, pixelWidth: 4 }); - * ``` - * - * Then it would generate a texture that is 52 x 48 pixels in size, because each cell of the data array - * represents 1 pixel multiplied by the `pixelWidth` value. The cell values, such as `8`, maps to color - * number 8 in the palette. If a cell contains a period character `.` then it is transparent. - * - * The default palette is Arne16, but you can specify your own using the `palette` property. - * - * @method Phaser.Textures.TextureManager#generate - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {Phaser.Types.Create.GenerateTextureConfig} config - The configuration object needed to generate the texture. - * - * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. - */ - generate: function (key, config) - { - if (this.checkKey(key)) - { - var canvas = CanvasPool.create(this, 1, 1); + return filterPoints(p); +} - config.canvas = canvas; +// try splitting polygon into two and triangulate them independently +function splitEarcut(start, triangles, dim, minX, minY, invSize) { + // look for a valid diagonal that divides the polygon into two + var a = start; + do { + var b = a.next.next; + while (b !== a.prev) { + if (a.i !== b.i && isValidDiagonal(a, b)) { + // split the polygon in two by the diagonal + var c = splitPolygon(a, b); - GenerateTexture(config); + // filter colinear points around the cuts + a = filterPoints(a, a.next); + c = filterPoints(c, c.next); - return this.addCanvas(key, canvas); - } - else - { - return null; + // run earcut on each half + earcutLinked(a, triangles, dim, minX, minY, invSize, 0); + earcutLinked(c, triangles, dim, minX, minY, invSize, 0); + return; + } + b = b.next; } - }, + a = a.next; + } while (a !== start); +} - /** - * Creates a new Texture using a blank Canvas element of the size given. - * - * Canvas elements are automatically pooled and calling this method will - * extract a free canvas from the CanvasPool, or create one if none are available. - * - * @method Phaser.Textures.TextureManager#createCanvas - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {number} [width=256] - The width of the Canvas element. - * @param {number} [height=256] - The height of the Canvas element. - * - * @return {?Phaser.Textures.CanvasTexture} The Canvas Texture that was created, or `null` if the key is already in use. - */ - createCanvas: function (key, width, height) - { - if (width === undefined) { width = 256; } - if (height === undefined) { height = 256; } +// link every hole into the outer loop, producing a single-ring polygon without holes +function eliminateHoles(data, holeIndices, outerNode, dim) { + var queue = [], + i, len, start, end, list; - if (this.checkKey(key)) - { - var canvas = CanvasPool.create(this, width, height, CONST.CANVAS, true); + for (i = 0, len = holeIndices.length; i < len; i++) { + start = holeIndices[i] * dim; + end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + list = linkedList(data, start, end, dim, false); + if (list === list.next) list.steiner = true; + queue.push(getLeftmost(list)); + } - return this.addCanvas(key, canvas); - } + queue.sort(compareX); - return null; - }, + // process holes from left to right + for (i = 0; i < queue.length; i++) { + outerNode = eliminateHole(queue[i], outerNode); + } - /** - * Creates a new Canvas Texture object from an existing Canvas element - * and adds it to this Texture Manager, unless `skipCache` is true. - * - * @method Phaser.Textures.TextureManager#addCanvas - * @fires Phaser.Textures.Events#ADD - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {HTMLCanvasElement} source - The Canvas element to form the base of the new Texture. - * @param {boolean} [skipCache=false] - Skip adding this Texture into the Cache? - * - * @return {?Phaser.Textures.CanvasTexture} The Canvas Texture that was created, or `null` if the key is already in use. - */ - addCanvas: function (key, source, skipCache) - { - if (skipCache === undefined) { skipCache = false; } + return outerNode; +} - var texture = null; +function compareX(a, b) { + return a.x - b.x; +} - if (skipCache) - { - texture = new CanvasTexture(this, key, source, source.width, source.height); - } - else if (this.checkKey(key)) - { - texture = new CanvasTexture(this, key, source, source.width, source.height); +// find a bridge between vertices that connects hole with an outer ring and and link it +function eliminateHole(hole, outerNode) { + var bridge = findHoleBridge(hole, outerNode); + if (!bridge) { + return outerNode; + } - this.list[key] = texture; + var bridgeReverse = splitPolygon(bridge, hole); - this.emit(Events.ADD, key, texture); - } + // filter collinear points around the cuts + filterPoints(bridgeReverse, bridgeReverse.next); + return filterPoints(bridge, bridge.next); +} - return texture; - }, +// David Eberly's algorithm for finding a bridge between hole and outer polygon +function findHoleBridge(hole, outerNode) { + var p = outerNode, + hx = hole.x, + hy = hole.y, + qx = -Infinity, + m; - /** - * Adds a new Texture Atlas to this Texture Manager. - * It can accept either JSON Array or JSON Hash formats, as exported by Texture Packer and similar software. - * - * @method Phaser.Textures.TextureManager#addAtlas - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {HTMLImageElement} source - The source Image element. - * @param {object} data - The Texture Atlas data. - * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. - * - * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. - */ - addAtlas: function (key, source, data, dataSource) - { - // New Texture Packer format? - if (Array.isArray(data.textures) || Array.isArray(data.frames)) - { - return this.addAtlasJSONArray(key, source, data, dataSource); - } - else - { - return this.addAtlasJSONHash(key, source, data, dataSource); + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point + do { + if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { + var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); + if (x <= hx && x > qx) { + qx = x; + m = p.x < p.next.x ? p : p.next; + if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint + } } - }, + p = p.next; + } while (p !== outerNode); - /** - * Adds a Texture Atlas to this Texture Manager. - * The frame data of the atlas must be stored in an Array within the JSON. - * This is known as a JSON Array in software such as Texture Packer. - * - * @method Phaser.Textures.TextureManager#addAtlasJSONArray - * @fires Phaser.Textures.Events#ADD - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {(HTMLImageElement|HTMLImageElement[])} source - The source Image element/s. - * @param {(object|object[])} data - The Texture Atlas data/s. - * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. - * - * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. - */ - addAtlasJSONArray: function (key, source, data, dataSource) - { - var texture = null; + if (!m) return null; - if (this.checkKey(key)) - { - texture = this.create(key, source); + // look for points inside the triangle of hole point, segment intersection and endpoint; + // if there are no points found, we have a valid connection; + // otherwise choose the point of the minimum angle with the ray as connection point - // Multi-Atlas? - if (Array.isArray(data)) - { - var singleAtlasFile = (data.length === 1); // multi-pack with one atlas file for all images + var stop = m, + mx = m.x, + my = m.y, + tanMin = Infinity, + tan; - // !! Assumes the textures are in the same order in the source array as in the json data !! - for (var i = 0; i < texture.source.length; i++) - { - var atlasData = singleAtlasFile ? data[0] : data[i]; + p = m; - Parser.JSONArray(texture, i, atlasData); - } - } - else - { - Parser.JSONArray(texture, 0, data); - } + do { + if (hx >= p.x && p.x >= mx && hx !== p.x && + pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { - if (dataSource) - { - texture.setDataSource(dataSource); - } + tan = Math.abs(hy - p.y) / (hx - p.x); // tangential - this.emit(Events.ADD, key, texture); + if (locallyInside(p, hole) && + (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) { + m = p; + tanMin = tan; + } } - return texture; - }, + p = p.next; + } while (p !== stop); - /** - * Adds a Texture Atlas to this Texture Manager. - * The frame data of the atlas must be stored in an Object within the JSON. - * This is known as a JSON Hash in software such as Texture Packer. - * - * @method Phaser.Textures.TextureManager#addAtlasJSONHash - * @fires Phaser.Textures.Events#ADD - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {HTMLImageElement} source - The source Image element. - * @param {object} data - The Texture Atlas data. - * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. - * - * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. - */ - addAtlasJSONHash: function (key, source, data, dataSource) - { - var texture = null; + return m; +} - if (this.checkKey(key)) - { - texture = this.create(key, source); +// whether sector in vertex m contains sector in vertex p in the same coordinates +function sectorContainsSector(m, p) { + return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0; +} - if (Array.isArray(data)) - { - for (var i = 0; i < data.length; i++) - { - Parser.JSONHash(texture, i, data[i]); - } - } - else - { - Parser.JSONHash(texture, 0, data); +// interlink polygon nodes in z-order +function indexCurve(start, minX, minY, invSize) { + var p = start; + do { + if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize); + p.prevZ = p.prev; + p.nextZ = p.next; + p = p.next; + } while (p !== start); + + p.prevZ.nextZ = null; + p.prevZ = null; + + sortLinked(p); +} + +// Simon Tatham's linked list merge sort algorithm +// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html +function sortLinked(list) { + var i, p, q, e, tail, numMerges, pSize, qSize, + inSize = 1; + + do { + p = list; + list = null; + tail = null; + numMerges = 0; + + while (p) { + numMerges++; + q = p; + pSize = 0; + for (i = 0; i < inSize; i++) { + pSize++; + q = q.nextZ; + if (!q) break; } + qSize = inSize; - if (dataSource) - { - texture.setDataSource(dataSource); + while (pSize > 0 || (qSize > 0 && q)) { + + if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { + e = p; + p = p.nextZ; + pSize--; + } else { + e = q; + q = q.nextZ; + qSize--; + } + + if (tail) tail.nextZ = e; + else list = e; + + e.prevZ = tail; + tail = e; } - this.emit(Events.ADD, key, texture); + p = q; } - return texture; - }, + tail.nextZ = null; + inSize *= 2; - /** - * Adds a Texture Atlas to this Texture Manager, where the atlas data is given - * in the XML format. - * - * @method Phaser.Textures.TextureManager#addAtlasXML - * @fires Phaser.Textures.Events#ADD - * @since 3.7.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {HTMLImageElement} source - The source Image element. - * @param {object} data - The Texture Atlas XML data. - * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. - * - * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. - */ - addAtlasXML: function (key, source, data, dataSource) - { - var texture = null; + } while (numMerges > 1); - if (this.checkKey(key)) - { - texture = this.create(key, source); + return list; +} - Parser.AtlasXML(texture, 0, data); +// z-order of a point given coords and inverse of the longer side of data bbox +function zOrder(x, y, minX, minY, invSize) { + // coords are transformed into non-negative 15-bit integer range + x = (x - minX) * invSize | 0; + y = (y - minY) * invSize | 0; - if (dataSource) - { - texture.setDataSource(dataSource); - } + x = (x | (x << 8)) & 0x00FF00FF; + x = (x | (x << 4)) & 0x0F0F0F0F; + x = (x | (x << 2)) & 0x33333333; + x = (x | (x << 1)) & 0x55555555; - this.emit(Events.ADD, key, texture); - } + y = (y | (y << 8)) & 0x00FF00FF; + y = (y | (y << 4)) & 0x0F0F0F0F; + y = (y | (y << 2)) & 0x33333333; + y = (y | (y << 1)) & 0x55555555; - return texture; - }, + return x | (y << 1); +} - /** - * Adds a Unity Texture Atlas to this Texture Manager. - * The data must be in the form of a Unity YAML file. - * - * @method Phaser.Textures.TextureManager#addUnityAtlas - * @fires Phaser.Textures.Events#ADD - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {HTMLImageElement} source - The source Image element. - * @param {object} data - The Texture Atlas data. - * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. - * - * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. - */ - addUnityAtlas: function (key, source, data, dataSource) - { - var texture = null; +// find the leftmost node of a polygon ring +function getLeftmost(start) { + var p = start, + leftmost = start; + do { + if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p; + p = p.next; + } while (p !== start); - if (this.checkKey(key)) - { - texture = this.create(key, source); + return leftmost; +} - Parser.UnityYAML(texture, 0, data); +// check if a point lies within a convex triangle +function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { + return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && + (ax - px) * (by - py) >= (bx - px) * (ay - py) && + (bx - px) * (cy - py) >= (cx - px) * (by - py); +} - if (dataSource) - { - texture.setDataSource(dataSource); - } +// check if a diagonal between two polygon nodes is valid (lies in polygon interior) +function isValidDiagonal(a, b) { + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges + (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible + (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors + equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case +} - this.emit(Events.ADD, key, texture); - } +// signed area of a triangle +function area(p, q, r) { + return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); +} - return texture; - }, +// check if two points are equal +function equals(p1, p2) { + return p1.x === p2.x && p1.y === p2.y; +} - /** - * Adds a Sprite Sheet to this Texture Manager. - * - * In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact - * same size and cannot be trimmed or rotated. - * - * @method Phaser.Textures.TextureManager#addSpriteSheet - * @fires Phaser.Textures.Events#ADD - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {HTMLImageElement} source - The source Image element. - * @param {Phaser.Types.Textures.SpriteSheetConfig} config - The configuration object for this Sprite Sheet. - * - * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. - */ - addSpriteSheet: function (key, source, config) - { - var texture = null; +// check if two segments intersect +function intersects(p1, q1, p2, q2) { + var o1 = sign(area(p1, q1, p2)); + var o2 = sign(area(p1, q1, q2)); + var o3 = sign(area(p2, q2, p1)); + var o4 = sign(area(p2, q2, q1)); - if (this.checkKey(key)) - { - texture = this.create(key, source); + if (o1 !== o2 && o3 !== o4) return true; // general case - var width = texture.source[0].width; - var height = texture.source[0].height; + if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1 + if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1 + if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2 + if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2 - Parser.SpriteSheet(texture, 0, 0, 0, width, height, config); + return false; +} - this.emit(Events.ADD, key, texture); - } +// for collinear points p, q, r, check if point q lies on segment pr +function onSegment(p, q, r) { + return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y); +} - return texture; - }, +function sign(num) { + return num > 0 ? 1 : num < 0 ? -1 : 0; +} - /** - * Adds a Sprite Sheet to this Texture Manager, where the Sprite Sheet exists as a Frame within a Texture Atlas. - * - * In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact - * same size and cannot be trimmed or rotated. - * - * @method Phaser.Textures.TextureManager#addSpriteSheetFromAtlas - * @fires Phaser.Textures.Events#ADD - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {Phaser.Types.Textures.SpriteSheetFromAtlasConfig} config - The configuration object for this Sprite Sheet. - * - * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. - */ - addSpriteSheetFromAtlas: function (key, config) - { - if (!this.checkKey(key)) - { - return null; - } +// check if a polygon diagonal intersects any polygon segments +function intersectsPolygon(a, b) { + var p = a; + do { + if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && + intersects(p, p.next, a, b)) return true; + p = p.next; + } while (p !== a); - var atlasKey = GetValue(config, 'atlas', null); - var atlasFrame = GetValue(config, 'frame', null); + return false; +} - if (!atlasKey || !atlasFrame) - { - return; - } +// check if a polygon diagonal is locally inside the polygon +function locallyInside(a, b) { + return area(a.prev, a, a.next) < 0 ? + area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : + area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; +} - var atlas = this.get(atlasKey); - var sheet = atlas.get(atlasFrame); +// check if the middle point of a polygon diagonal is inside the polygon +function middleInside(a, b) { + var p = a, + inside = false, + px = (a.x + b.x) / 2, + py = (a.y + b.y) / 2; + do { + if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && + (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) + inside = !inside; + p = p.next; + } while (p !== a); - if (sheet) - { - var texture = this.create(key, sheet.source.image); + return inside; +} - if (sheet.trimmed) - { - // If trimmed we need to help the parser adjust - Parser.SpriteSheetFromAtlas(texture, sheet, config); - } - else - { - Parser.SpriteSheet(texture, 0, sheet.cutX, sheet.cutY, sheet.cutWidth, sheet.cutHeight, config); - } +// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; +// if one belongs to the outer ring and another to a hole, it merges it into a single ring +function splitPolygon(a, b) { + var a2 = new Node(a.i, a.x, a.y), + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; - this.emit(Events.ADD, key, texture); + a.next = b; + b.prev = a; - return texture; - } - }, + a2.next = an; + an.prev = a2; - /** - * Creates a new Texture using the given source and dimensions. - * - * @method Phaser.Textures.TextureManager#create - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {HTMLImageElement} source - The source Image element. - * @param {number} width - The width of the Texture. - * @param {number} height - The height of the Texture. - * - * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. - */ - create: function (key, source, width, height) - { - var texture = null; + b2.next = a2; + a2.prev = b2; - if (this.checkKey(key)) - { - texture = new Texture(this, key, source, width, height); + bp.next = b2; + b2.prev = bp; - this.list[key] = texture; - } + return b2; +} - return texture; - }, +// create a node and optionally link it with previous one (in a circular doubly linked list) +function insertNode(i, x, y, last) { + var p = new Node(i, x, y); - /** - * Checks the given key to see if a Texture using it exists within this Texture Manager. - * - * @method Phaser.Textures.TextureManager#exists - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * - * @return {boolean} Returns `true` if a Texture matching the given key exists in this Texture Manager. - */ - exists: function (key) - { - return (this.list.hasOwnProperty(key)); - }, + if (!last) { + p.prev = p; + p.next = p; - /** - * Returns a Texture from the Texture Manager that matches the given key. - * - * If the key is `undefined` it will return the `__DEFAULT` Texture. - * - * If the key is an instance of a Texture, it will return the key directly. - * - * Finally. if the key is given, but not found and not a Texture instance, it will return the `__MISSING` Texture. - * - * @method Phaser.Textures.TextureManager#get - * @since 3.0.0 - * - * @param {(string|Phaser.Textures.Texture)} key - The unique string-based key of the Texture, or a Texture instance. - * - * @return {Phaser.Textures.Texture} The Texture that was created. - */ - get: function (key) - { - if (key === undefined) { key = '__DEFAULT'; } + } else { + p.next = last.next; + p.prev = last; + last.next.prev = p; + last.next = p; + } + return p; +} - if (this.list[key]) - { - return this.list[key]; +function removeNode(p) { + p.next.prev = p.prev; + p.prev.next = p.next; + + if (p.prevZ) p.prevZ.nextZ = p.nextZ; + if (p.nextZ) p.nextZ.prevZ = p.prevZ; +} + +function Node(i, x, y) { + // vertex index in coordinates array + this.i = i; + + // vertex coordinates + this.x = x; + this.y = y; + + // previous and next vertex nodes in a polygon ring + this.prev = null; + this.next = null; + + // z-order curve value + this.z = 0; + + // previous and next nodes in z-order + this.prevZ = null; + this.nextZ = null; + + // indicates whether this is a steiner point + this.steiner = false; +} + +// return a percentage difference between the polygon area and its triangulation area; +// used to verify correctness of triangulation +earcut.deviation = function (data, holeIndices, dim, triangles) { + var hasHoles = holeIndices && holeIndices.length; + var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + + var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); + if (hasHoles) { + for (var i = 0, len = holeIndices.length; i < len; i++) { + var start = holeIndices[i] * dim; + var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; + polygonArea -= Math.abs(signedArea(data, start, end, dim)); } - else if (key instanceof Texture) - { - return key; + } + + var trianglesArea = 0; + for (i = 0; i < triangles.length; i += 3) { + var a = triangles[i] * dim; + var b = triangles[i + 1] * dim; + var c = triangles[i + 2] * dim; + trianglesArea += Math.abs( + (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - + (data[a] - data[b]) * (data[c + 1] - data[a + 1])); + } + + return polygonArea === 0 && trianglesArea === 0 ? 0 : + Math.abs((trianglesArea - polygonArea) / polygonArea); +}; + +function signedArea(data, start, end, dim) { + var sum = 0; + for (var i = start, j = end - dim; i < end; i += dim) { + sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); + j = i; + } + return sum; +} + +// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts +earcut.flatten = function (data) { + var dim = data[0][0].length, + result = {vertices: [], holes: [], dimensions: dim}, + holeIndex = 0; + + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < data[i].length; j++) { + for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); } - else - { - return this.list['__MISSING']; + if (i > 0) { + holeIndex += data[i - 1].length; + result.holes.push(holeIndex); } - }, + } + return result; +}; - /** - * Takes a Texture key and Frame name and returns a clone of that Frame if found. - * - * @method Phaser.Textures.TextureManager#cloneFrame - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {(string|number)} frame - The string or index of the Frame to be cloned. - * - * @return {Phaser.Textures.Frame} A Clone of the given Frame. - */ - cloneFrame: function (key, frame) +module.exports = earcut; + + +/***/ }), + +/***/ 14045: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Rectangle = __webpack_require__(74118); + +/** + * Calculates the bounding AABB rectangle of a polygon. + * + * @function Phaser.Geom.Polygon.GetAABB + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * + * @param {Phaser.Geom.Polygon} polygon - The polygon that should be calculated. + * @param {(Phaser.Geom.Rectangle|object)} [out] - The rectangle or object that has x, y, width, and height properties to store the result. Optional. + * + * @return {(Phaser.Geom.Rectangle|object)} The resulting rectangle or object that is passed in with position and dimensions of the polygon's AABB. + */ +var GetAABB = function (polygon, out) +{ + if (out === undefined) { out = new Rectangle(); } + + var minX = Infinity; + var minY = Infinity; + var maxX = -minX; + var maxY = -minY; + var p; + + for (var i = 0; i < polygon.points.length; i++) { - if (this.list[key]) - { - return this.list[key].get(frame).clone(); - } - }, + p = polygon.points[i]; - /** - * Takes a Texture key and Frame name and returns a reference to that Frame, if found. - * - * @method Phaser.Textures.TextureManager#getFrame - * @since 3.0.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {(string|number)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. - * - * @return {Phaser.Textures.Frame} A Texture Frame object. - */ - getFrame: function (key, frame) + minX = Math.min(minX, p.x); + minY = Math.min(minY, p.y); + maxX = Math.max(maxX, p.x); + maxY = Math.max(maxY, p.y); + } + + out.x = minX; + out.y = minY; + out.width = maxX - minX; + out.height = maxY - minY; + + return out; +}; + +module.exports = GetAABB; + + +/***/ }), + +/***/ 98286: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Export the points as an array of flat numbers, following the sequence [ x,y, x,y, x,y ] + +/** + * Stores all of the points of a Polygon into a flat array of numbers following the sequence [ x,y, x,y, x,y ], + * i.e. each point of the Polygon, in the order it's defined, corresponds to two elements of the resultant + * array for the point's X and Y coordinate. + * + * @function Phaser.Geom.Polygon.GetNumberArray + * @since 3.0.0 + * + * @generic {number[]} O - [output,$return] + * + * @param {Phaser.Geom.Polygon} polygon - The Polygon whose points to export. + * @param {(array|number[])} [output] - An array to which the points' coordinates should be appended. + * + * @return {(array|number[])} The modified `output` array, or a new array if none was given. + */ +var GetNumberArray = function (polygon, output) +{ + if (output === undefined) { output = []; } + + for (var i = 0; i < polygon.points.length; i++) { - if (this.list[key]) - { - return this.list[key].get(frame); - } - }, + output.push(polygon.points[i].x); + output.push(polygon.points[i].y); + } - /** - * Returns an array with all of the keys of all Textures in this Texture Manager. - * The output array will exclude the `__DEFAULT` and `__MISSING` keys. - * - * @method Phaser.Textures.TextureManager#getTextureKeys - * @since 3.0.0 - * - * @return {string[]} An array containing all of the Texture keys stored in this Texture Manager. - */ - getTextureKeys: function () + return output; +}; + +module.exports = GetNumberArray; + + +/***/ }), + +/***/ 89294: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Length = __webpack_require__(16028); +var Line = __webpack_require__(88829); +var Perimeter = __webpack_require__(5159); + +/** + * Returns an array of Point objects containing the coordinates of the points around the perimeter of the Polygon, + * based on the given quantity or stepRate values. + * + * @function Phaser.Geom.Polygon.GetPoints + * @since 3.12.0 + * + * @param {Phaser.Geom.Polygon} polygon - The Polygon to get the points from. + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} [stepRate] - Sets the quantity by getting the perimeter of the Polygon and dividing it by the stepRate. + * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created. + * + * @return {Phaser.Geom.Point[]} An array of Point objects pertaining to the points around the perimeter of the Polygon. + */ +var GetPoints = function (polygon, quantity, stepRate, out) +{ + if (out === undefined) { out = []; } + + var points = polygon.points; + var perimeter = Perimeter(polygon); + + // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!quantity && stepRate > 0) { - var output = []; + quantity = perimeter / stepRate; + } - for (var key in this.list) + for (var i = 0; i < quantity; i++) + { + var position = perimeter * (i / quantity); + var accumulatedPerimeter = 0; + + for (var j = 0; j < points.length; j++) { - if (key !== '__DEFAULT' && key !== '__MISSING') + var pointA = points[j]; + var pointB = points[(j + 1) % points.length]; + var line = new Line( + pointA.x, + pointA.y, + pointB.x, + pointB.y + ); + var length = Length(line); + + if (position < accumulatedPerimeter || position > accumulatedPerimeter + length) { - output.push(key); + accumulatedPerimeter += length; + continue; } - } - return output; - }, + var point = line.getPoint((position - accumulatedPerimeter) / length); + out.push(point); - /** - * Given a Texture and an `x` and `y` coordinate this method will return a new - * Color object that has been populated with the color and alpha values of the pixel - * at that location in the Texture. - * - * @method Phaser.Textures.TextureManager#getPixel - * @since 3.0.0 - * - * @param {number} x - The x coordinate of the pixel within the Texture. - * @param {number} y - The y coordinate of the pixel within the Texture. - * @param {string} key - The unique string-based key of the Texture. - * @param {(string|number)} [frame] - The string or index of the Frame. - * - * @return {?Phaser.Display.Color} A Color object populated with the color values of the requested pixel, - * or `null` if the coordinates were out of bounds. - */ - getPixel: function (x, y, key, frame) - { - var textureFrame = this.getFrame(key, frame); + break; + } + } - if (textureFrame) - { - // Adjust for trim (if not trimmed x and y are just zero) - x -= textureFrame.x; - y -= textureFrame.y; + return out; +}; - var data = textureFrame.data.cut; +module.exports = GetPoints; - x += data.x; - y += data.y; - if (x >= data.x && x < data.r && y >= data.y && y < data.b) - { - var ctx = this._tempContext; +/***/ }), - ctx.clearRect(0, 0, 1, 1); - ctx.drawImage(textureFrame.source.image, x, y, 1, 1, 0, 0, 1, 1); +/***/ 5159: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var rgb = ctx.getImageData(0, 0, 1, 1); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return new Color(rgb.data[0], rgb.data[1], rgb.data[2], rgb.data[3]); - } - } +var Length = __webpack_require__(16028); +var Line = __webpack_require__(88829); - return null; - }, +/** + * Returns the perimeter of the given Polygon. + * + * @function Phaser.Geom.Polygon.Perimeter + * @since 3.12.0 + * + * @param {Phaser.Geom.Polygon} polygon - The Polygon to get the perimeter of. + * + * @return {number} The perimeter of the Polygon. + */ +var Perimeter = function (polygon) +{ + var points = polygon.points; + var perimeter = 0; - /** - * Given a Texture and an `x` and `y` coordinate this method will return a value between 0 and 255 - * corresponding to the alpha value of the pixel at that location in the Texture. If the coordinate - * is out of bounds it will return null. - * - * @method Phaser.Textures.TextureManager#getPixelAlpha - * @since 3.10.0 - * - * @param {number} x - The x coordinate of the pixel within the Texture. - * @param {number} y - The y coordinate of the pixel within the Texture. - * @param {string} key - The unique string-based key of the Texture. - * @param {(string|number)} [frame] - The string or index of the Frame. - * - * @return {number} A value between 0 and 255, or `null` if the coordinates were out of bounds. - */ - getPixelAlpha: function (x, y, key, frame) + for (var i = 0; i < points.length; i++) { - var textureFrame = this.getFrame(key, frame); + var pointA = points[i]; + var pointB = points[(i + 1) % points.length]; + var line = new Line( + pointA.x, + pointA.y, + pointB.x, + pointB.y + ); - if (textureFrame) - { - // Adjust for trim (if not trimmed x and y are just zero) - x -= textureFrame.x; - y -= textureFrame.y; + perimeter += Length(line); + } - var data = textureFrame.data.cut; + return perimeter; +}; - x += data.x; - y += data.y; +module.exports = Perimeter; - if (x >= data.x && x < data.r && y >= data.y && y < data.b) - { - var ctx = this._tempContext; - ctx.clearRect(0, 0, 1, 1); - ctx.drawImage(textureFrame.source.image, x, y, 1, 1, 0, 0, 1, 1); +/***/ }), - var rgb = ctx.getImageData(0, 0, 1, 1); +/***/ 8580: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return rgb.data[3]; - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return null; +var Class = __webpack_require__(56694); +var Contains = __webpack_require__(45604); +var GetPoints = __webpack_require__(89294); +var GEOM_CONST = __webpack_require__(52394); + +/** + * @classdesc + * A Polygon object + * + * The polygon is a closed shape consists of a series of connected straight lines defined by list of ordered points. + * Several formats are supported to define the list of points, check the setTo method for details. + * This is a geometry object allowing you to define and inspect the shape. + * It is not a Game Object, in that you cannot add it to the display list, and it has no texture. + * To render a Polygon you should look at the capabilities of the Graphics class. + * + * @class Polygon + * @memberof Phaser.Geom + * @constructor + * @since 3.0.0 + * + * @param {(string|number[]|Phaser.Types.Math.Vector2Like[])} [points] - List of points defining the perimeter of this Polygon. Several formats are supported: + * - A string containing paired x y values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'` + * - An array of Point objects: `[new Phaser.Point(x1, y1), ...]` + * - An array of objects with public x y properties: `[obj1, obj2, ...]` + * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]` + * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]` + */ +var Polygon = new Class({ + + initialize: + + function Polygon (points) + { + /** + * The geometry constant type of this object: `GEOM_CONST.POLYGON`. + * Used for fast type comparisons. + * + * @name Phaser.Geom.Polygon#type + * @type {number} + * @readonly + * @since 3.19.0 + */ + this.type = GEOM_CONST.POLYGON; + + /** + * The area of this Polygon. + * + * @name Phaser.Geom.Polygon#area + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.area = 0; + + /** + * An array of number pair objects that make up this polygon. I.e. [ {x,y}, {x,y}, {x,y} ] + * + * @name Phaser.Geom.Polygon#points + * @type {Phaser.Geom.Point[]} + * @since 3.0.0 + */ + this.points = []; + + if (points) + { + this.setTo(points); + } }, /** - * Sets the given Game Objects `texture` and `frame` properties so that it uses - * the Texture and Frame specified in the `key` and `frame` arguments to this method. + * Check to see if the Polygon contains the given x / y coordinates. * - * @method Phaser.Textures.TextureManager#setTexture + * @method Phaser.Geom.Polygon#contains * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the texture would be set on. - * @param {string} key - The unique string-based key of the Texture. - * @param {(string|number)} [frame] - The string or index of the Frame. + * @param {number} x - The x coordinate to check within the polygon. + * @param {number} y - The y coordinate to check within the polygon. * - * @return {Phaser.GameObjects.GameObject} The Game Object the texture was set on. + * @return {boolean} `true` if the coordinates are within the polygon, otherwise `false`. */ - setTexture: function (gameObject, key, frame) + contains: function (x, y) { - if (this.list[key]) - { - gameObject.texture = this.list[key]; - gameObject.frame = gameObject.texture.get(frame); - } - - return gameObject; + return Contains(this, x, y); }, /** - * Changes the key being used by a Texture to the new key provided. + * Sets this Polygon to the given points. * - * The old key is removed, allowing it to be re-used. + * The points can be set from a variety of formats: * - * Game Objects are linked to Textures by a reference to the Texture object, so - * all existing references will be retained. + * - A string containing paired values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'` + * - An array of Point objects: `[new Phaser.Point(x1, y1), ...]` + * - An array of objects with public x/y properties: `[obj1, obj2, ...]` + * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]` + * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]` * - * @method Phaser.Textures.TextureManager#renameTexture - * @since 3.12.0 + * `setTo` may also be called without any arguments to remove all points. * - * @param {string} currentKey - The current string-based key of the Texture you wish to rename. - * @param {string} newKey - The new unique string-based key to use for the Texture. + * @method Phaser.Geom.Polygon#setTo + * @since 3.0.0 * - * @return {boolean} `true` if the Texture key was successfully renamed, otherwise `false`. + * @param {(string|number[]|Phaser.Types.Math.Vector2Like[])} [points] - Points defining the perimeter of this polygon. Please check function description above for the different supported formats. + * + * @return {this} This Polygon object. */ - renameTexture: function (currentKey, newKey) + setTo: function (points) { - var texture = this.get(currentKey); + this.area = 0; + this.points = []; - if (texture && currentKey !== newKey) + if (typeof points === 'string') { - texture.key = newKey; + points = points.split(' '); + } - this.list[newKey] = texture; + if (!Array.isArray(points)) + { + return this; + } - delete this.list[currentKey]; + var p; + var y0 = Number.MAX_VALUE; - return true; + // The points argument is an array, so iterate through it + for (var i = 0; i < points.length; i++) + { + p = { x: 0, y: 0 }; + + if (typeof points[i] === 'number' || typeof points[i] === 'string') + { + p.x = parseFloat(points[i]); + p.y = parseFloat(points[i + 1]); + i++; + } + else if (Array.isArray(points[i])) + { + // An array of arrays? + p.x = points[i][0]; + p.y = points[i][1]; + } + else + { + p.x = points[i].x; + p.y = points[i].y; + } + + this.points.push(p); + + // Lowest boundary + if (p.y < y0) + { + y0 = p.y; + } } - return false; + this.calculateArea(y0); + + return this; }, /** - * Passes all Textures to the given callback. + * Calculates the area of the Polygon. This is available in the property Polygon.area * - * @method Phaser.Textures.TextureManager#each + * @method Phaser.Geom.Polygon#calculateArea * @since 3.0.0 * - * @param {EachTextureCallback} callback - The callback function to be sent the Textures. - * @param {object} scope - The value to use as `this` when executing the callback. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + * @return {number} The area of the polygon. */ - each: function (callback, scope) + calculateArea: function () { - var args = [ null ]; - - for (var i = 1; i < arguments.length; i++) + if (this.points.length < 3) { - args.push(arguments[i]); + this.area = 0; + + return this.area; } - for (var texture in this.list) + var sum = 0; + var p1; + var p2; + + for (var i = 0; i < this.points.length - 1; i++) { - args[0] = this.list[texture]; + p1 = this.points[i]; + p2 = this.points[i + 1]; - callback.apply(scope, args); + sum += (p2.x - p1.x) * (p1.y + p2.y); } + + p1 = this.points[0]; + p2 = this.points[this.points.length - 1]; + + sum += (p1.x - p2.x) * (p2.y + p1.y); + + this.area = -sum * 0.5; + + return this.area; }, /** - * Destroys the Texture Manager and all Textures stored within it. + * Returns an array of Point objects containing the coordinates of the points around the perimeter of the Polygon, + * based on the given quantity or stepRate values. * - * @method Phaser.Textures.TextureManager#destroy - * @since 3.0.0 + * @method Phaser.Geom.Polygon#getPoints + * @since 3.12.0 + * + * @generic {Phaser.Geom.Point[]} O - [output,$return] + * + * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. + * @param {number} [stepRate] - Sets the quantity by getting the perimeter of the Polygon and dividing it by the stepRate. + * @param {(array|Phaser.Geom.Point[])} [output] - An array to insert the points in to. If not provided a new array will be created. + * + * @return {(array|Phaser.Geom.Point[])} An array of Point objects pertaining to the points around the perimeter of the Polygon. */ - destroy: function () + getPoints: function (quantity, step, output) { - for (var texture in this.list) - { - this.list[texture].destroy(); - } - - this.list = {}; - - this.game = null; - - CanvasPool.remove(this._tempCanvas); + return GetPoints(this, quantity, step, output); } }); -module.exports = TextureManager; +module.exports = Polygon; /***/ }), -/* 423 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 32244: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Clamp = __webpack_require__(18); -var Color = __webpack_require__(38); -var CONST = __webpack_require__(33); -var IsSizePowerOfTwo = __webpack_require__(138); -var Texture = __webpack_require__(206); - /** - * @classdesc - * A Canvas Texture is a special kind of Texture that is backed by an HTML Canvas Element as its source. + * Reverses the order of the points of a Polygon. * - * You can use the properties of this texture to draw to the canvas element directly, using all of the standard - * canvas operations available in the browser. Any Game Object can be given this texture and will render with it. + * @function Phaser.Geom.Polygon.Reverse + * @since 3.0.0 * - * Note: When running under WebGL the Canvas Texture needs to re-generate its base WebGLTexture and reupload it to - * the GPU every time you modify it, otherwise the changes you make to this texture will not be visible. To do this - * you should call `CanvasTexture.refresh()` once you are finished with your changes to the canvas. Try and keep - * this to a minimum, especially on large canvas sizes, or you may inadvertently thrash the GPU by constantly uploading - * texture data to it. This restriction does not apply if using the Canvas Renderer. - * - * It starts with only one frame that covers the whole of the canvas. You can add further frames, that specify - * sections of the canvas using the `add` method. - * - * Should you need to resize the canvas use the `setSize` method so that it accurately updates all of the underlying - * texture data as well. Forgetting to do this (i.e. by changing the canvas size directly from your code) could cause - * graphical errors. + * @generic {Phaser.Geom.Polygon} O - [polygon,$return] * - * @class CanvasTexture - * @extends Phaser.Textures.Texture - * @memberof Phaser.Textures - * @constructor - * @since 3.7.0 + * @param {Phaser.Geom.Polygon} polygon - The Polygon to modify. * - * @param {Phaser.Textures.TextureManager} manager - A reference to the Texture Manager this Texture belongs to. - * @param {string} key - The unique string-based key of this Texture. - * @param {HTMLCanvasElement} source - The canvas element that is used as the base of this texture. - * @param {number} width - The width of the canvas. - * @param {number} height - The height of the canvas. + * @return {Phaser.Geom.Polygon} The modified Polygon. */ -var CanvasTexture = new Class({ +var Reverse = function (polygon) +{ + polygon.points.reverse(); - Extends: Texture, + return polygon; +}; - initialize: +module.exports = Reverse; - function CanvasTexture (manager, key, source, width, height) - { - Texture.call(this, manager, key, source, width, height); - this.add('__BASE', 0, 0, 0, width, height); +/***/ }), - /** - * A reference to the Texture Source of this Canvas. - * - * @name Phaser.Textures.CanvasTexture#_source - * @type {Phaser.Textures.TextureSource} - * @private - * @since 3.7.0 - */ - this._source = this.frames['__BASE'].source; +/***/ 95874: +/***/ ((module) => { - /** - * The source Canvas Element. - * - * @name Phaser.Textures.CanvasTexture#canvas - * @readonly - * @type {HTMLCanvasElement} - * @since 3.7.0 - */ - this.canvas = this._source.image; +/** + * @author Richard Davey + * @author Vladimir Agafonkin + * @see Based on Simplify.js mourner.github.io/simplify-js + */ - /** - * The 2D Canvas Rendering Context. - * - * @name Phaser.Textures.CanvasTexture#context - * @readonly - * @type {CanvasRenderingContext2D} - * @since 3.7.0 - */ - this.context = this.canvas.getContext('2d'); +/** + * Copyright (c) 2017, Vladimir Agafonkin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ - /** - * The width of the Canvas. - * This property is read-only, if you wish to change it use the `setSize` method. - * - * @name Phaser.Textures.CanvasTexture#width - * @readonly - * @type {number} - * @since 3.7.0 - */ - this.width = width; +/** + * @ignore + */ +function getSqDist (p1, p2) +{ + var dx = p1.x - p2.x, + dy = p1.y - p2.y; - /** - * The height of the Canvas. - * This property is read-only, if you wish to change it use the `setSize` method. - * - * @name Phaser.Textures.CanvasTexture#height - * @readonly - * @type {number} - * @since 3.7.0 - */ - this.height = height; + return dx * dx + dy * dy; +} - /** - * The context image data. - * Use the `update` method to populate this when the canvas changes. - * - * @name Phaser.Textures.CanvasTexture#imageData - * @type {ImageData} - * @since 3.13.0 - */ - this.imageData = this.context.getImageData(0, 0, width, height); +/** + * Square distance from a point to a segment + * + * @ignore + */ +function getSqSegDist (p, p1, p2) +{ + var x = p1.x, + y = p1.y, + dx = p2.x - x, + dy = p2.y - y; - /** - * A Uint8ClampedArray view into the `buffer`. - * Use the `update` method to populate this when the canvas changes. - * Note that this is unavailable in some browsers, such as Epic Browser, due to their security restrictions. - * - * @name Phaser.Textures.CanvasTexture#data - * @type {Uint8ClampedArray} - * @since 3.13.0 - */ - this.data = null; + if (dx !== 0 || dy !== 0) + { + var t = ((p.x - x) * dx + (p.y - y) * dy) / (dx * dx + dy * dy); - if (this.imageData) + if (t > 1) { - this.data = this.imageData.data; + x = p2.x; + y = p2.y; + } + else if (t > 0) + { + x += dx * t; + y += dy * t; } + } - /** - * An Uint32Array view into the `buffer`. - * - * @name Phaser.Textures.CanvasTexture#pixels - * @type {Uint32Array} - * @since 3.13.0 - */ - this.pixels = null; + dx = p.x - x; + dy = p.y - y; - /** - * An ArrayBuffer the same size as the context ImageData. - * - * @name Phaser.Textures.CanvasTexture#buffer - * @type {ArrayBuffer} - * @since 3.13.0 - */ - this.buffer; + return dx * dx + dy * dy; +} - if (this.data) +/** + * Basic distance-based simplification + * + * @ignore + */ +function simplifyRadialDist (points, sqTolerance) +{ + var prevPoint = points[0], + newPoints = [ prevPoint ], + point; + + for (var i = 1, len = points.length; i < len; i++) + { + point = points[i]; + + if (getSqDist(point, prevPoint) > sqTolerance) { - if (this.imageData.data.buffer) - { - this.buffer = this.imageData.data.buffer; - this.pixels = new Uint32Array(this.buffer); - } - else if (window.ArrayBuffer) - { - this.buffer = new ArrayBuffer(this.imageData.data.length); - this.pixels = new Uint32Array(this.buffer); - } - else - { - this.pixels = this.imageData.data; - } + newPoints.push(point); + prevPoint = point; } - }, + } - /** - * This re-creates the `imageData` from the current context. - * It then re-builds the ArrayBuffer, the `data` Uint8ClampedArray reference and the `pixels` Int32Array. - * - * Warning: This is a very expensive operation, so use it sparingly. - * - * @method Phaser.Textures.CanvasTexture#update - * @since 3.13.0 - * - * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. - */ - update: function () + if (prevPoint !== point) { - this.imageData = this.context.getImageData(0, 0, this.width, this.height); + newPoints.push(point); + } - this.data = this.imageData.data; + return newPoints; +} - if (this.imageData.data.buffer) - { - this.buffer = this.imageData.data.buffer; - this.pixels = new Uint32Array(this.buffer); - } - else if (window.ArrayBuffer) +/** + * @ignore + */ +function simplifyDPStep (points, first, last, sqTolerance, simplified) +{ + var maxSqDist = sqTolerance, + index; + + for (var i = first + 1; i < last; i++) + { + var sqDist = getSqSegDist(points[i], points[first], points[last]); + + if (sqDist > maxSqDist) { - this.buffer = new ArrayBuffer(this.imageData.data.length); - this.pixels = new Uint32Array(this.buffer); + index = i; + maxSqDist = sqDist; } - else + } + + if (maxSqDist > sqTolerance) + { + if (index - first > 1) { - this.pixels = this.imageData.data; + simplifyDPStep(points, first, index, sqTolerance, simplified); } - if (this.manager.game.config.renderType === CONST.WEBGL) + simplified.push(points[index]); + + if (last - index > 1) { - this.refresh(); + simplifyDPStep(points, index, last, sqTolerance, simplified); } + } +} - return this; - }, +/** + * Simplification using Ramer-Douglas-Peucker algorithm + * + * @ignore + */ +function simplifyDouglasPeucker (points, sqTolerance) +{ + var last = points.length - 1; - /** - * Draws the given Image or Canvas element to this CanvasTexture, then updates the internal - * ImageData buffer and arrays. - * - * @method Phaser.Textures.CanvasTexture#draw - * @since 3.13.0 - * - * @param {number} x - The x coordinate to draw the source at. - * @param {number} y - The y coordinate to draw the source at. - * @param {(HTMLImageElement|HTMLCanvasElement)} source - The element to draw to this canvas. - * - * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. - */ - draw: function (x, y, source) - { - this.context.drawImage(source, x, y); + var simplified = [ points[0] ]; - return this.update(); - }, + simplifyDPStep(points, 0, last, sqTolerance, simplified); - /** - * Draws the given texture frame to this CanvasTexture, then updates the internal - * ImageData buffer and arrays. - * - * @method Phaser.Textures.CanvasTexture#drawFrame - * @since 3.16.0 - * - * @param {string} key - The unique string-based key of the Texture. - * @param {(string|number)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. - * @param {number} [x=0] - The x coordinate to draw the source at. - * @param {number} [y=0] - The y coordinate to draw the source at. - * - * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. - */ - drawFrame: function (key, frame, x, y) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } + simplified.push(points[last]); - var textureFrame = this.manager.getFrame(key, frame); + return simplified; +} - if (textureFrame) - { - var cd = textureFrame.canvasData; +/** + * Takes a Polygon object and simplifies the points by running them through a combination of + * Douglas-Peucker and Radial Distance algorithms. Simplification dramatically reduces the number of + * points in a polygon while retaining its shape, giving a huge performance boost when processing + * it and also reducing visual noise. + * + * @function Phaser.Geom.Polygon.Simplify + * @since 3.50.0 + * + * @generic {Phaser.Geom.Polygon} O - [polygon,$return] + * + * @param {Phaser.Geom.Polygon} polygon - The polygon to be simplified. The polygon will be modified in-place and returned. + * @param {number} [tolerance=1] - Affects the amount of simplification (in the same metric as the point coordinates). + * @param {boolean} [highestQuality=false] - Excludes distance-based preprocessing step which leads to highest quality simplification but runs ~10-20 times slower. + * + * @return {Phaser.Geom.Polygon} The input polygon. + */ +var Simplify = function (polygon, tolerance, highestQuality) +{ + if (tolerance === undefined) { tolerance = 1; } + if (highestQuality === undefined) { highestQuality = false; } - var width = textureFrame.cutWidth; - var height = textureFrame.cutHeight; - var res = textureFrame.source.resolution; + var points = polygon.points; - this.context.drawImage( - textureFrame.source.image, - cd.x, cd.y, - width, - height, - x, y, - width / res, - height / res - ); + if (points.length > 2) + { + var sqTolerance = tolerance * tolerance; - return this.update(); - } - else + if (!highestQuality) { - return this; + points = simplifyRadialDist(points, sqTolerance); } - }, - /** - * Sets a pixel in the CanvasTexture to the given color and alpha values. - * - * This is an expensive operation to run in large quantities, so use sparingly. - * - * @method Phaser.Textures.CanvasTexture#setPixel - * @since 3.16.0 - * - * @param {number} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {number} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {number} red - The red color value. A number between 0 and 255. - * @param {number} green - The green color value. A number between 0 and 255. - * @param {number} blue - The blue color value. A number between 0 and 255. - * @param {number} [alpha=255] - The alpha value. A number between 0 and 255. - * - * @return {this} This CanvasTexture. - */ - setPixel: function (x, y, red, green, blue, alpha) - { - if (alpha === undefined) { alpha = 255; } + polygon.setTo(simplifyDouglasPeucker(points, sqTolerance)); + } - x = Math.abs(Math.floor(x)); - y = Math.abs(Math.floor(y)); + return polygon; +}; - var index = this.getIndex(x, y); +module.exports = Simplify; - if (index > -1) - { - var imageData = this.context.getImageData(x, y, 1, 1); - imageData.data[0] = red; - imageData.data[1] = green; - imageData.data[2] = blue; - imageData.data[3] = alpha; +/***/ }), - this.context.putImageData(imageData, x, y); - } +/***/ 18974: +/***/ ((module) => { - return this; - }, +/** + * @author Richard Davey + * @author Igor Ognichenko + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Puts the ImageData into the context of this CanvasTexture at the given coordinates. - * - * @method Phaser.Textures.CanvasTexture#putData - * @since 3.16.0 - * - * @param {ImageData} imageData - The ImageData to put at the given location. - * @param {number} x - The x coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {number} y - The y coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {number} [dirtyX=0] - Horizontal position (x coordinate) of the top-left corner from which the image data will be extracted. - * @param {number} [dirtyY=0] - Vertical position (x coordinate) of the top-left corner from which the image data will be extracted. - * @param {number} [dirtyWidth] - Width of the rectangle to be painted. Defaults to the width of the image data. - * @param {number} [dirtyHeight] - Height of the rectangle to be painted. Defaults to the height of the image data. - * - * @return {this} This CanvasTexture. - */ - putData: function (imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight) - { - if (dirtyX === undefined) { dirtyX = 0; } - if (dirtyY === undefined) { dirtyY = 0; } - if (dirtyWidth === undefined) { dirtyWidth = imageData.width; } - if (dirtyHeight === undefined) { dirtyHeight = imageData.height; } +/** + * @ignore + */ +var copy = function (out, a) +{ + out[0] = a[0]; + out[1] = a[1]; - this.context.putImageData(imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight); + return out; +}; - return this; - }, +/** + * Takes a Polygon object and applies Chaikin's smoothing algorithm on its points. + * + * @function Phaser.Geom.Polygon.Smooth + * @since 3.13.0 + * + * @generic {Phaser.Geom.Polygon} O - [polygon,$return] + * + * @param {Phaser.Geom.Polygon} polygon - The polygon to be smoothed. The polygon will be modified in-place and returned. + * + * @return {Phaser.Geom.Polygon} The input polygon. + */ +var Smooth = function (polygon) +{ + var i; + var points = []; + var data = polygon.points; - /** - * Gets an ImageData region from this CanvasTexture from the position and size specified. - * You can write this back using `CanvasTexture.putData`, or manipulate it. - * - * @method Phaser.Textures.CanvasTexture#getData - * @since 3.16.0 - * - * @param {number} x - The x coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {number} y - The y coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {number} width - The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left. - * @param {number} height - The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up. - * - * @return {ImageData} The ImageData extracted from this CanvasTexture. - */ - getData: function (x, y, width, height) + for (i = 0; i < data.length; i++) { - x = Clamp(Math.floor(x), 0, this.width - 1); - y = Clamp(Math.floor(y), 0, this.height - 1); - width = Clamp(width, 1, this.width - x); - height = Clamp(height, 1, this.height - y); + points.push([ data[i].x, data[i].y ]); + } - var imageData = this.context.getImageData(x, y, width, height); + var output = []; - return imageData; - }, + if (points.length > 0) + { + output.push(copy([ 0, 0 ], points[0])); + } - /** - * Get the color of a specific pixel from this texture and store it in a Color object. - * - * If you have drawn anything to this CanvasTexture since it was created you must call `CanvasTexture.update` to refresh the array buffer, - * otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist. - * - * @method Phaser.Textures.CanvasTexture#getPixel - * @since 3.13.0 - * - * @param {number} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {number} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {Phaser.Display.Color} [out] - A Color object to store the pixel values in. If not provided a new Color object will be created. - * - * @return {Phaser.Display.Color} An object with the red, green, blue and alpha values set in the r, g, b and a properties. - */ - getPixel: function (x, y, out) + for (i = 0; i < points.length - 1; i++) { - if (!out) - { - out = new Color(); - } + var p0 = points[i]; + var p1 = points[i + 1]; + var p0x = p0[0]; + var p0y = p0[1]; + var p1x = p1[0]; + var p1y = p1[1]; - var index = this.getIndex(x, y); + output.push([ 0.85 * p0x + 0.15 * p1x, 0.85 * p0y + 0.15 * p1y ]); + output.push([ 0.15 * p0x + 0.85 * p1x, 0.15 * p0y + 0.85 * p1y ]); + } - if (index > -1) - { - var data = this.data; + if (points.length > 1) + { + output.push(copy([ 0, 0 ], points[points.length - 1])); + } - var r = data[index + 0]; - var g = data[index + 1]; - var b = data[index + 2]; - var a = data[index + 3]; + return polygon.setTo(output); +}; - out.setTo(r, g, b, a); - } +module.exports = Smooth; - return out; - }, - /** - * Returns an array containing all of the pixels in the given region. - * - * If the requested region extends outside the bounds of this CanvasTexture, - * the region is truncated to fit. - * - * If you have drawn anything to this CanvasTexture since it was created you must call `CanvasTexture.update` to refresh the array buffer, - * otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist. - * - * @method Phaser.Textures.CanvasTexture#getPixels - * @since 3.16.0 - * - * @param {number} [x=0] - The x coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {number} [y=0] - The y coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {number} [width] - The width of the region to get. Must be an integer. Defaults to the canvas width if not given. - * @param {number} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`. - * - * @return {Phaser.Types.Textures.PixelConfig[][]} A 2d array of Pixel objects. - */ - getPixels: function (x, y, width, height) +/***/ }), + +/***/ 23490: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Tranlates the points of the given Polygon. + * + * @function Phaser.Geom.Polygon.Translate + * @since 3.50.0 + * + * @generic {Phaser.Geom.Polygon} O - [polygon,$return] + * + * @param {Phaser.Geom.Polygon} polygon - The Polygon to modify. + * @param {number} x - The amount to horizontally translate the points by. + * @param {number} y - The amount to vertically translate the points by. + * + * @return {Phaser.Geom.Polygon} The modified Polygon. + */ +var Translate = function (polygon, x, y) +{ + var points = polygon.points; + + for (var i = 0; i < points.length; i++) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = this.width; } - if (height === undefined) { height = width; } + points[i].x += x; + points[i].y += y; + } - x = Math.abs(Math.round(x)); - y = Math.abs(Math.round(y)); + return polygon; +}; - var left = Clamp(x, 0, this.width); - var right = Clamp(x + width, 0, this.width); - var top = Clamp(y, 0, this.height); - var bottom = Clamp(y + height, 0, this.height); +module.exports = Translate; - var pixel = new Color(); - var out = []; +/***/ }), - for (var py = top; py < bottom; py++) - { - var row = []; +/***/ 44359: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - for (var px = left; px < right; px++) - { - pixel = this.getPixel(px, py, pixel); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - row.push({ x: px, y: py, color: pixel.color, alpha: pixel.alphaGL }); - } +var Polygon = __webpack_require__(8580); - out.push(row); - } +Polygon.Clone = __webpack_require__(19631); +Polygon.Contains = __webpack_require__(45604); +Polygon.ContainsPoint = __webpack_require__(87289); +Polygon.Earcut = __webpack_require__(11117); +Polygon.GetAABB = __webpack_require__(14045); +Polygon.GetNumberArray = __webpack_require__(98286); +Polygon.GetPoints = __webpack_require__(89294); +Polygon.Perimeter = __webpack_require__(5159); +Polygon.Reverse = __webpack_require__(32244); +Polygon.Simplify = __webpack_require__(95874); +Polygon.Smooth = __webpack_require__(18974); +Polygon.Translate = __webpack_require__(23490); - return out; - }, +module.exports = Polygon; - /** - * Returns the Image Data index for the given pixel in this CanvasTexture. - * - * The index can be used to read directly from the `this.data` array. - * - * The index points to the red value in the array. The subsequent 3 indexes - * point to green, blue and alpha respectively. - * - * @method Phaser.Textures.CanvasTexture#getIndex - * @since 3.16.0 - * - * @param {number} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * @param {number} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. - * - * @return {number} - */ - getIndex: function (x, y) - { - x = Math.abs(Math.round(x)); - y = Math.abs(Math.round(y)); - if (x < this.width && y < this.height) - { - return (x + y * this.width) * 4; - } - else - { - return -1; - } - }, +/***/ }), - /** - * This should be called manually if you are running under WebGL. - * It will refresh the WebGLTexture from the Canvas source. Only call this if you know that the - * canvas has changed, as there is a significant GPU texture allocation cost involved in doing so. - * - * @method Phaser.Textures.CanvasTexture#refresh - * @since 3.7.0 - * - * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. - */ - refresh: function () - { - this._source.update(); +/***/ 1653: +/***/ ((module) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Gets the Canvas Element. - * - * @method Phaser.Textures.CanvasTexture#getCanvas - * @since 3.7.0 - * - * @return {HTMLCanvasElement} The Canvas DOM element this texture is using. - */ - getCanvas: function () - { - return this.canvas; - }, +/** + * Calculates the area of the given Rectangle object. + * + * @function Phaser.Geom.Rectangle.Area + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - The rectangle to calculate the area of. + * + * @return {number} The area of the Rectangle object. + */ +var Area = function (rect) +{ + return rect.width * rect.height; +}; - /** - * Gets the 2D Canvas Rendering Context. - * - * @method Phaser.Textures.CanvasTexture#getContext - * @since 3.7.0 - * - * @return {CanvasRenderingContext2D} The Canvas Rendering Context this texture is using. - */ - getContext: function () - { - return this.context; - }, +module.exports = Area; - /** - * Clears the given region of this Canvas Texture, resetting it back to transparent. - * If no region is given, the whole Canvas Texture is cleared. - * - * @method Phaser.Textures.CanvasTexture#clear - * @since 3.7.0 - * - * @param {number} [x=0] - The x coordinate of the top-left of the region to clear. - * @param {number} [y=0] - The y coordinate of the top-left of the region to clear. - * @param {number} [width] - The width of the region. - * @param {number} [height] - The height of the region. - * - * @return {Phaser.Textures.CanvasTexture} The Canvas Texture. - */ - clear: function (x, y, width, height) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = this.width; } - if (height === undefined) { height = this.height; } - this.context.clearRect(x, y, width, height); +/***/ }), - return this.update(); - }, +/***/ 33943: +/***/ ((module) => { - /** - * Changes the size of this Canvas Texture. - * - * @method Phaser.Textures.CanvasTexture#setSize - * @since 3.7.0 - * - * @param {number} width - The new width of the Canvas. - * @param {number} [height] - The new height of the Canvas. If not given it will use the width as the height. - * - * @return {Phaser.Textures.CanvasTexture} The Canvas Texture. - */ - setSize: function (width, height) - { - if (height === undefined) { height = width; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (width !== this.width || height !== this.height) - { - // Update the Canvas - this.canvas.width = width; - this.canvas.height = height; +/** + * Rounds a Rectangle's position up to the smallest integer greater than or equal to each current coordinate. + * + * @function Phaser.Geom.Rectangle.Ceil + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [rect,$return] + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to adjust. + * + * @return {Phaser.Geom.Rectangle} The adjusted Rectangle. + */ +var Ceil = function (rect) +{ + rect.x = Math.ceil(rect.x); + rect.y = Math.ceil(rect.y); - // Update the Texture Source - this._source.width = width; - this._source.height = height; - this._source.isPowerOf2 = IsSizePowerOfTwo(width, height); + return rect; +}; - // Update the Frame - this.frames['__BASE'].setSize(width, height, 0, 0); +module.exports = Ceil; - // Update this - this.width = width; - this.height = height; - this.refresh(); - } +/***/ }), - return this; - }, +/***/ 58662: +/***/ ((module) => { - /** - * Destroys this Texture and releases references to its sources and frames. - * - * @method Phaser.Textures.CanvasTexture#destroy - * @since 3.16.0 - */ - destroy: function () - { - Texture.prototype.destroy.call(this); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this._source = null; - this.canvas = null; - this.context = null; - this.imageData = null; - this.data = null; - this.pixels = null; - this.buffer = null; - } +/** + * Rounds a Rectangle's position and size up to the smallest integer greater than or equal to each respective value. + * + * @function Phaser.Geom.Rectangle.CeilAll + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [rect,$return] + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to modify. + * + * @return {Phaser.Geom.Rectangle} The modified Rectangle. + */ +var CeilAll = function (rect) +{ + rect.x = Math.ceil(rect.x); + rect.y = Math.ceil(rect.y); + rect.width = Math.ceil(rect.width); + rect.height = Math.ceil(rect.height); -}); + return rect; +}; -module.exports = CanvasTexture; +module.exports = CeilAll; /***/ }), -/* 424 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 79993: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(31); -var Class = __webpack_require__(0); -var IsSizePowerOfTwo = __webpack_require__(138); -var ScaleModes = __webpack_require__(168); - /** - * @classdesc - * A Texture Source is the encapsulation of the actual source data for a Texture. + * Moves the top-left corner of a Rectangle so that its center is at the given coordinates. * - * This is typically an Image Element, loaded from the file system or network, a Canvas Element or a Video Element. + * @function Phaser.Geom.Rectangle.CenterOn + * @since 3.0.0 * - * A Texture can contain multiple Texture Sources, which only happens when a multi-atlas is loaded. + * @generic {Phaser.Geom.Rectangle} O - [rect,$return] * - * @class TextureSource - * @memberof Phaser.Textures - * @constructor - * @since 3.0.0 + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to be centered. + * @param {number} x - The X coordinate of the Rectangle's center. + * @param {number} y - The Y coordinate of the Rectangle's center. * - * @param {Phaser.Textures.Texture} texture - The Texture this TextureSource belongs to. - * @param {(HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|Phaser.GameObjects.RenderTexture|WebGLTexture)} source - The source image data. - * @param {number} [width] - Optional width of the source image. If not given it's derived from the source itself. - * @param {number} [height] - Optional height of the source image. If not given it's derived from the source itself. - * @param {boolean} [flipY=false] - Sets the `UNPACK_FLIP_Y_WEBGL` flag the WebGL Texture uses during upload. + * @return {Phaser.Geom.Rectangle} The centered rectangle. */ -var TextureSource = new Class({ +var CenterOn = function (rect, x, y) +{ + rect.x = x - (rect.width / 2); + rect.y = y - (rect.height / 2); - initialize: + return rect; +}; - function TextureSource (texture, source, width, height, flipY) - { - if (flipY === undefined) { flipY = false; } +module.exports = CenterOn; - var game = texture.manager.game; - /** - * The Texture this TextureSource belongs to. - * - * @name Phaser.Textures.TextureSource#renderer - * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} - * @since 3.7.0 - */ - this.renderer = game.renderer; +/***/ }), - /** - * The Texture this TextureSource belongs to. - * - * @name Phaser.Textures.TextureSource#texture - * @type {Phaser.Textures.Texture} - * @since 3.0.0 - */ - this.texture = texture; +/***/ 81572: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The source of the image data. - * - * This is either an Image Element, a Canvas Element, a Video Element, a RenderTexture or a WebGLTexture. - * - * @name Phaser.Textures.TextureSource#source - * @type {(HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|Phaser.GameObjects.RenderTexture|WebGLTexture)} - * @since 3.12.0 - */ - this.source = source; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The image data. - * - * This is either an Image element, Canvas element or a Video Element. - * - * @name Phaser.Textures.TextureSource#image - * @type {(HTMLImageElement|HTMLCanvasElement|HTMLVideoElement)} - * @since 3.0.0 - */ - this.image = source; +var Rectangle = __webpack_require__(74118); - /** - * Currently un-used. - * - * @name Phaser.Textures.TextureSource#compressionAlgorithm - * @type {number} - * @default null - * @since 3.0.0 - */ - this.compressionAlgorithm = null; +/** + * Creates a new Rectangle which is identical to the given one. + * + * @function Phaser.Geom.Rectangle.Clone + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} source - The Rectangle to clone. + * + * @return {Phaser.Geom.Rectangle} The newly created Rectangle, which is separate from the given one. + */ +var Clone = function (source) +{ + return new Rectangle(source.x, source.y, source.width, source.height); +}; - /** - * The resolution of the source image. - * - * @name Phaser.Textures.TextureSource#resolution - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.resolution = 1; +module.exports = Clone; - /** - * The width of the source image. If not specified in the constructor it will check - * the `naturalWidth` and then `width` properties of the source image. - * - * @name Phaser.Textures.TextureSource#width - * @type {number} - * @since 3.0.0 - */ - this.width = width || source.naturalWidth || source.videoWidth || source.width || 0; - /** - * The height of the source image. If not specified in the constructor it will check - * the `naturalHeight` and then `height` properties of the source image. - * - * @name Phaser.Textures.TextureSource#height - * @type {number} - * @since 3.0.0 - */ - this.height = height || source.naturalHeight || source.videoHeight || source.height || 0; +/***/ }), - /** - * The Scale Mode the image will use when rendering. - * Either Linear or Nearest. - * - * @name Phaser.Textures.TextureSource#scaleMode - * @type {number} - * @since 3.0.0 - */ - this.scaleMode = ScaleModes.DEFAULT; +/***/ 94287: +/***/ ((module) => { - /** - * Is the source image a Canvas Element? - * - * @name Phaser.Textures.TextureSource#isCanvas - * @type {boolean} - * @since 3.0.0 - */ - this.isCanvas = (source instanceof HTMLCanvasElement); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Is the source image a Video Element? - * - * @name Phaser.Textures.TextureSource#isVideo - * @type {boolean} - * @since 3.20.0 - */ - this.isVideo = (window.hasOwnProperty('HTMLVideoElement') && source instanceof HTMLVideoElement); +/** + * Checks if a given point is inside a Rectangle's bounds. + * + * @function Phaser.Geom.Rectangle.Contains + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to check. + * @param {number} x - The X coordinate of the point to check. + * @param {number} y - The Y coordinate of the point to check. + * + * @return {boolean} `true` if the point is within the Rectangle's bounds, otherwise `false`. + */ +var Contains = function (rect, x, y) +{ + if (rect.width <= 0 || rect.height <= 0) + { + return false; + } - /** - * Is the source image a Render Texture? - * - * @name Phaser.Textures.TextureSource#isRenderTexture - * @type {boolean} - * @since 3.12.0 - */ - this.isRenderTexture = (source.type === 'RenderTexture'); + return (rect.x <= x && rect.x + rect.width >= x && rect.y <= y && rect.y + rect.height >= y); +}; - /** - * Is the source image a WebGLTexture? - * - * @name Phaser.Textures.TextureSource#isGLTexture - * @type {boolean} - * @since 3.19.0 - */ - this.isGLTexture = (window.hasOwnProperty('WebGLTexture') && source instanceof WebGLTexture); - - /** - * Are the source image dimensions a power of two? - * - * @name Phaser.Textures.TextureSource#isPowerOf2 - * @type {boolean} - * @since 3.0.0 - */ - this.isPowerOf2 = IsSizePowerOfTwo(this.width, this.height); +module.exports = Contains; - /** - * The WebGL Texture of the source image. If this TextureSource is driven from a WebGLTexture - * already, then this is a reference to that WebGLTexture. - * - * @name Phaser.Textures.TextureSource#glTexture - * @type {?WebGLTexture} - * @default null - * @since 3.0.0 - */ - this.glTexture = null; - /** - * The current texture unit index as assigned by the WebGL Renderer. - * Un-used in canvas. Should be treated as read-only. - * - * @name Phaser.Textures.TextureSource#glIndex - * @type {number} - * @default 0 - * @since 3.50.0 - */ - this.glIndex = 0; +/***/ }), - /** - * The counter value when this texture was last assigned an index by the WebGL Renderer. - * Un-used in canvas. Should be treated as read-only. - * - * @name Phaser.Textures.TextureSource#glIndexCounter - * @type {number} - * @default -1 - * @since 3.50.0 - */ - this.glIndexCounter = -1; +/***/ 28687: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Sets the `UNPACK_FLIP_Y_WEBGL` flag the WebGL Texture uses during upload. - * - * @name Phaser.Textures.TextureSource#flipY - * @type {boolean} - * @since 3.20.0 - */ - this.flipY = flipY; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.init(game); - }, +var Contains = __webpack_require__(94287); - /** - * Creates a WebGL Texture, if required, and sets the Texture filter mode. - * - * @method Phaser.Textures.TextureSource#init - * @since 3.0.0 - * - * @param {Phaser.Game} game - A reference to the Phaser Game instance. - */ - init: function (game) - { - var renderer = this.renderer; +/** + * Determines whether the specified point is contained within the rectangular region defined by this Rectangle object. + * + * @function Phaser.Geom.Rectangle.ContainsPoint + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle object. + * @param {Phaser.Geom.Point} point - The point object to be checked. Can be a Phaser Point object or any object with x and y values. + * + * @return {boolean} A value of true if the Rectangle object contains the specified point, otherwise false. + */ +var ContainsPoint = function (rect, point) +{ + return Contains(rect, point.x, point.y); +}; - if (renderer) - { - if (renderer.gl) - { - if (this.isCanvas) - { - this.glTexture = renderer.createCanvasTexture(this.image, false, this.flipY); - } - else if (this.isVideo) - { - this.glTexture = renderer.createVideoTexture(this.image, false, this.flipY); - } - else if (this.isRenderTexture) - { - this.image = this.source.canvas; +module.exports = ContainsPoint; - this.glTexture = renderer.createTextureFromSource(null, this.width, this.height, this.scaleMode); - } - else if (this.isGLTexture) - { - this.glTexture = this.source; - } - else - { - this.glTexture = renderer.createTextureFromSource(this.image, this.width, this.height, this.scaleMode); - } - } - else if (this.isRenderTexture) - { - this.image = this.source.canvas; - } - } - if (!game.config.antialias) - { - this.setFilter(1); - } - }, +/***/ }), - /** - * Sets the Filter Mode for this Texture. - * - * The mode can be either Linear, the default, or Nearest. - * - * For pixel-art you should use Nearest. - * - * @method Phaser.Textures.TextureSource#setFilter - * @since 3.0.0 - * - * @param {Phaser.Textures.FilterMode} filterMode - The Filter Mode. - */ - setFilter: function (filterMode) - { - if (this.renderer.gl) - { - this.renderer.setTextureFilter(this.glTexture, filterMode); - } +/***/ 73222: +/***/ ((module) => { - this.scaleMode = filterMode; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets the `UNPACK_FLIP_Y_WEBGL` flag for the WebGL Texture during texture upload. - * - * @method Phaser.Textures.TextureSource#setFlipY - * @since 3.20.0 - * - * @param {boolean} [value=true] - Should the WebGL Texture be flipped on the Y axis on texture upload or not? - */ - setFlipY: function (value) +/** + * Tests if one rectangle fully contains another. + * + * @function Phaser.Geom.Rectangle.ContainsRect + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rectA - The first rectangle. + * @param {Phaser.Geom.Rectangle} rectB - The second rectangle. + * + * @return {boolean} True only if rectA fully contains rectB. + */ +var ContainsRect = function (rectA, rectB) +{ + // Volume check (if rectB volume > rectA then rectA cannot contain it) + if ((rectB.width * rectB.height) > (rectA.width * rectA.height)) { - if (value === undefined) { value = true; } - - this.flipY = value; + return false; + } - return this; - }, + return ( + (rectB.x > rectA.x && rectB.x < rectA.right) && + (rectB.right > rectA.x && rectB.right < rectA.right) && + (rectB.y > rectA.y && rectB.y < rectA.bottom) && + (rectB.bottom > rectA.y && rectB.bottom < rectA.bottom) + ); +}; - /** - * If this TextureSource is backed by a Canvas and is running under WebGL, - * it updates the WebGLTexture using the canvas data. - * - * @method Phaser.Textures.TextureSource#update - * @since 3.7.0 - */ - update: function () - { - var gl = this.renderer.gl; +module.exports = ContainsRect; - if (gl && this.isCanvas) - { - this.glTexture = this.renderer.updateCanvasTexture(this.image, this.glTexture, this.flipY); - } - else if (gl && this.isVideo) - { - this.glTexture = this.renderer.updateVideoTexture(this.image, this.glTexture, this.flipY); - } - }, - /** - * Destroys this Texture Source and nulls the references. - * - * @method Phaser.Textures.TextureSource#destroy - * @since 3.0.0 - */ - destroy: function () - { - if (this.glTexture) - { - this.renderer.deleteTexture(this.glTexture, true); - } +/***/ }), - if (this.isCanvas) - { - CanvasPool.remove(this.image); - } +/***/ 29538: +/***/ ((module) => { - this.renderer = null; - this.texture = null; - this.source = null; - this.image = null; - this.glTexture = null; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -}); +/** + * Copy the values of one Rectangle to a destination Rectangle. + * + * @function Phaser.Geom.Rectangle.CopyFrom + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [dest,$return] + * + * @param {Phaser.Geom.Rectangle} source - The source Rectangle to copy the values from. + * @param {Phaser.Geom.Rectangle} dest - The destination Rectangle to copy the values to. + * + * @return {Phaser.Geom.Rectangle} The destination Rectangle. + */ +var CopyFrom = function (source, dest) +{ + return dest.setTo(source.x, source.y, source.width, source.height); +}; -module.exports = TextureSource; +module.exports = CopyFrom; /***/ }), -/* 425 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 87279: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @namespace Phaser.Textures.Parsers + * Create an array of points for each corner of a Rectangle + * If an array is specified, each point object will be added to the end of the array, otherwise a new array will be created. + * + * @function Phaser.Geom.Rectangle.Decompose + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle object to be decomposed. + * @param {array} [out] - If provided, each point will be added to this array. + * + * @return {array} Will return the array you specified or a new array containing the points of the Rectangle. */ +var Decompose = function (rect, out) +{ + if (out === undefined) { out = []; } -module.exports = { - - AtlasXML: __webpack_require__(979), - Canvas: __webpack_require__(980), - Image: __webpack_require__(981), - JSONArray: __webpack_require__(982), - JSONHash: __webpack_require__(983), - SpriteSheet: __webpack_require__(984), - SpriteSheetFromAtlas: __webpack_require__(985), - UnityYAML: __webpack_require__(986) + out.push({ x: rect.x, y: rect.y }); + out.push({ x: rect.right, y: rect.y }); + out.push({ x: rect.right, y: rect.bottom }); + out.push({ x: rect.x, y: rect.bottom }); + return out; }; +module.exports = Decompose; + /***/ }), -/* 426 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 19989: +/***/ ((module) => { /** * @author Richard Davey - * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var HTML5AudioSoundManager = __webpack_require__(427); -var NoAudioSoundManager = __webpack_require__(430); -var WebAudioSoundManager = __webpack_require__(432); - /** - * Creates a Web Audio, HTML5 Audio or No Audio Sound Manager based on config and device settings. - * - * Be aware of https://developers.google.com/web/updates/2017/09/autoplay-policy-changes + * Compares the `x`, `y`, `width` and `height` properties of two rectangles. * - * @function Phaser.Sound.SoundManagerCreator + * @function Phaser.Geom.Rectangle.Equals * @since 3.0.0 * - * @param {Phaser.Game} game - Reference to the current game instance. + * @param {Phaser.Geom.Rectangle} rect - Rectangle A + * @param {Phaser.Geom.Rectangle} toCompare - Rectangle B * - * @return {(Phaser.Sound.HTML5AudioSoundManager|Phaser.Sound.WebAudioSoundManager|Phaser.Sound.NoAudioSoundManager)} The Sound Manager instance that was created. + * @return {boolean} `true` if the rectangles' properties are an exact match, otherwise `false`. */ -var SoundManagerCreator = { - - create: function (game) - { - var audioConfig = game.config.audio; - var deviceAudio = game.device.audio; - - if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData)) - { - return new NoAudioSoundManager(game); - } - - if (deviceAudio.webAudio && !audioConfig.disableWebAudio) - { - return new WebAudioSoundManager(game); - } - - return new HTML5AudioSoundManager(game); - } - +var Equals = function (rect, toCompare) +{ + return ( + rect.x === toCompare.x && + rect.y === toCompare.y && + rect.width === toCompare.width && + rect.height === toCompare.height + ); }; -module.exports = SoundManagerCreator; +module.exports = Equals; /***/ }), -/* 427 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 92628: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSoundManager = __webpack_require__(145); -var Class = __webpack_require__(0); -var Events = __webpack_require__(70); -var HTML5AudioSound = __webpack_require__(429); +var GetAspectRatio = __webpack_require__(6700); /** - * HTML5 Audio implementation of the Sound Manager. - * - * To play multiple instances of the same HTML5 Audio sound, you need to provide an `instances` value when - * loading the sound with the Loader: + * Adjusts the target rectangle, changing its width, height and position, + * so that it fits inside the area of the source rectangle, while maintaining its original + * aspect ratio. * - * ```javascript - * this.load.audio('explosion', 'explosion.mp3', { - * instances: 2 - * }); - * ``` + * Unlike the `FitOutside` function, there may be some space inside the source area not covered. * - * Not all browsers can play all audio formats. + * @function Phaser.Geom.Rectangle.FitInside + * @since 3.0.0 * - * There is a good guide to what's supported: [Cross-browser audio basics: Audio codec support](https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics#Audio_Codec_Support). + * @generic {Phaser.Geom.Rectangle} O - [target,$return] * - * @class HTML5AudioSoundManager - * @extends Phaser.Sound.BaseSoundManager - * @memberof Phaser.Sound - * @constructor - * @since 3.0.0 + * @param {Phaser.Geom.Rectangle} target - The target rectangle to adjust. + * @param {Phaser.Geom.Rectangle} source - The source rectangle to envelop the target in. * - * @param {Phaser.Game} game - Reference to the current game instance. + * @return {Phaser.Geom.Rectangle} The modified target rectangle instance. */ -var HTML5AudioSoundManager = new Class({ - - Extends: BaseSoundManager, - - initialize: +var FitInside = function (target, source) +{ + var ratio = GetAspectRatio(target); - function HTML5AudioSoundManager (game) + if (ratio < GetAspectRatio(source)) { - /** - * Flag indicating whether if there are no idle instances of HTML5 Audio tag, - * for any particular sound, if one of the used tags should be hijacked and used - * for succeeding playback or if succeeding Phaser.Sound.HTML5AudioSound#play - * call should be ignored. - * - * @name Phaser.Sound.HTML5AudioSoundManager#override - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.override = true; + // Taller than Wide + target.setSize(source.height * ratio, source.height); + } + else + { + // Wider than Tall + target.setSize(source.width, source.width / ratio); + } - /** - * Value representing time difference, in seconds, between calling - * play method on an audio tag and when it actually starts playing. - * It is used to achieve more accurate delayed sound playback. - * - * You might need to tweak this value to get the desired results - * since audio play delay varies depending on the browser/platform. - * - * @name Phaser.Sound.HTML5AudioSoundManager#audioPlayDelay - * @type {number} - * @default 0.1 - * @since 3.0.0 - */ - this.audioPlayDelay = 0.1; + return target.setPosition( + source.centerX - (target.width / 2), + source.centerY - (target.height / 2) + ); +}; - /** - * A value by which we should offset the loop end marker of the - * looping sound to compensate for lag, caused by changing audio - * tag playback position, in order to achieve gapless looping. - * - * You might need to tweak this value to get the desired results - * since loop lag varies depending on the browser/platform. - * - * @name Phaser.Sound.HTML5AudioSoundManager#loopEndOffset - * @type {number} - * @default 0.05 - * @since 3.0.0 - */ - this.loopEndOffset = 0.05; +module.exports = FitInside; - /** - * An array for keeping track of all the sounds - * that were paused when game lost focus. - * - * @name Phaser.Sound.HTML5AudioSoundManager#onBlurPausedSounds - * @type {Phaser.Sound.HTML5AudioSound[]} - * @private - * @default [] - * @since 3.0.0 - */ - this.onBlurPausedSounds = []; - this.locked = 'ontouchstart' in window; +/***/ }), - /** - * A queue of all actions performed on sound objects while audio was locked. - * Once the audio gets unlocked, after an explicit user interaction, - * all actions will be performed in chronological order. - * Array of object types: { sound: Phaser.Sound.HTML5AudioSound, name: string, value?: * } - * - * @name Phaser.Sound.HTML5AudioSoundManager#lockedActionsQueue - * @type {array} - * @private - * @since 3.0.0 - */ - this.lockedActionsQueue = this.locked ? [] : null; +/***/ 85028: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Property that actually holds the value of global mute - * for HTML5 Audio sound manager implementation. - * - * @name Phaser.Sound.HTML5AudioSoundManager#_mute - * @type {boolean} - * @private - * @default false - * @since 3.0.0 - */ - this._mute = false; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Property that actually holds the value of global volume - * for HTML5 Audio sound manager implementation. - * - * @name Phaser.Sound.HTML5AudioSoundManager#_volume - * @type {boolean} - * @private - * @default 1 - * @since 3.0.0 - */ - this._volume = 1; +var GetAspectRatio = __webpack_require__(6700); - BaseSoundManager.call(this, game); - }, +/** + * Adjusts the target rectangle, changing its width, height and position, + * so that it fully covers the area of the source rectangle, while maintaining its original + * aspect ratio. + * + * Unlike the `FitInside` function, the target rectangle may extend further out than the source. + * + * @function Phaser.Geom.Rectangle.FitOutside + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [target,$return] + * + * @param {Phaser.Geom.Rectangle} target - The target rectangle to adjust. + * @param {Phaser.Geom.Rectangle} source - The source rectangle to envelope the target in. + * + * @return {Phaser.Geom.Rectangle} The modified target rectangle instance. + */ +var FitOutside = function (target, source) +{ + var ratio = GetAspectRatio(target); - /** - * Adds a new sound into the sound manager. - * - * @method Phaser.Sound.HTML5AudioSoundManager#add - * @since 3.0.0 - * - * @param {string} key - Asset key for the sound. - * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. - * - * @return {Phaser.Sound.HTML5AudioSound} The new sound instance. - */ - add: function (key, config) + if (ratio > GetAspectRatio(source)) { - var sound = new HTML5AudioSound(this, key, config); - - this.sounds.push(sound); - - return sound; - }, - - /** - * Unlocks HTML5 Audio loading and playback on mobile - * devices on the initial explicit user interaction. - * - * @method Phaser.Sound.HTML5AudioSoundManager#unlock - * @since 3.0.0 - */ - unlock: function () + // Wider than Tall + target.setSize(source.height * ratio, source.height); + } + else { - this.locked = false; - - var _this = this; - - this.game.cache.audio.entries.each(function (key, tags) - { - for (var i = 0; i < tags.length; i++) - { - if (tags[i].dataset.locked === 'true') - { - _this.locked = true; - - return false; - } - } - - return true; - }); + // Taller than Wide + target.setSize(source.width, source.width / ratio); + } - if (!this.locked) - { - return; - } + return target.setPosition( + source.centerX - target.width / 2, + source.centerY - target.height / 2 + ); +}; - var moved = false; +module.exports = FitOutside; - var detectMove = function () - { - moved = true; - }; - var unlock = function () - { - if (moved) - { - moved = false; - return; - } +/***/ }), - document.body.removeEventListener('touchmove', detectMove); - document.body.removeEventListener('touchend', unlock); +/***/ 71356: +/***/ ((module) => { - var lockedTags = []; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - _this.game.cache.audio.entries.each(function (key, tags) - { - for (var i = 0; i < tags.length; i++) - { - var tag = tags[i]; +/** + * Rounds down (floors) the top left X and Y coordinates of the given Rectangle to the largest integer less than or equal to them + * + * @function Phaser.Geom.Rectangle.Floor + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [rect,$return] + * + * @param {Phaser.Geom.Rectangle} rect - The rectangle to floor the top left X and Y coordinates of + * + * @return {Phaser.Geom.Rectangle} The rectangle that was passed to this function with its coordinates floored. + */ +var Floor = function (rect) +{ + rect.x = Math.floor(rect.x); + rect.y = Math.floor(rect.y); - if (tag.dataset.locked === 'true') - { - lockedTags.push(tag); - } - } + return rect; +}; - return true; - }); +module.exports = Floor; - if (lockedTags.length === 0) - { - return; - } - var lastTag = lockedTags[lockedTags.length - 1]; +/***/ }), - lastTag.oncanplaythrough = function () - { - lastTag.oncanplaythrough = null; +/***/ 21687: +/***/ ((module) => { - lockedTags.forEach(function (tag) - { - tag.dataset.locked = 'false'; - }); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - _this.unlocked = true; - }; +/** + * Rounds a Rectangle's position and size down to the largest integer less than or equal to each current coordinate or dimension. + * + * @function Phaser.Geom.Rectangle.FloorAll + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [rect,$return] + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to adjust. + * + * @return {Phaser.Geom.Rectangle} The adjusted Rectangle. + */ +var FloorAll = function (rect) +{ + rect.x = Math.floor(rect.x); + rect.y = Math.floor(rect.y); + rect.width = Math.floor(rect.width); + rect.height = Math.floor(rect.height); - lockedTags.forEach(function (tag) - { - tag.load(); - }); - }; + return rect; +}; - this.once(Events.UNLOCKED, function () - { - this.forEachActiveSound(function (sound) - { - if (sound.currentMarker === null && sound.duration === 0) - { - sound.duration = sound.tags[0].duration; - } +module.exports = FloorAll; - sound.totalDuration = sound.tags[0].duration; - }); - while (this.lockedActionsQueue.length) - { - var lockedAction = this.lockedActionsQueue.shift(); +/***/ }), - if (lockedAction.sound[lockedAction.prop].apply) - { - lockedAction.sound[lockedAction.prop].apply(lockedAction.sound, lockedAction.value || []); - } - else - { - lockedAction.sound[lockedAction.prop] = lockedAction.value; - } - } +/***/ 80222: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - }, this); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - document.body.addEventListener('touchmove', detectMove, false); - document.body.addEventListener('touchend', unlock, false); - }, +var Rectangle = __webpack_require__(74118); +var MATH_CONST = __webpack_require__(83392); - /** - * Method used internally for pausing sound manager if - * Phaser.Sound.HTML5AudioSoundManager#pauseOnBlur is set to true. - * - * @method Phaser.Sound.HTML5AudioSoundManager#onBlur - * @protected - * @since 3.0.0 - */ - onBlur: function () - { - this.forEachActiveSound(function (sound) - { - if (sound.isPlaying) - { - this.onBlurPausedSounds.push(sound); - sound.onBlur(); - } - }); - }, +/** + * Constructs new Rectangle or repositions and resizes an existing Rectangle so that all of the given points are on or within its bounds. + * + * The `points` parameter is an array of Point-like objects: + * + * ```js + * const points = [ + * [100, 200], + * [200, 400], + * { x: 30, y: 60 } + * ] + * ``` + * + * @function Phaser.Geom.Rectangle.FromPoints + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * + * @param {array} points - An array of points (either arrays with two elements corresponding to the X and Y coordinate or an object with public `x` and `y` properties) which should be surrounded by the Rectangle. + * @param {Phaser.Geom.Rectangle} [out] - Optional Rectangle to adjust. + * + * @return {Phaser.Geom.Rectangle} The adjusted `out` Rectangle, or a new Rectangle if none was provided. + */ +var FromPoints = function (points, out) +{ + if (out === undefined) { out = new Rectangle(); } - /** - * Method used internally for resuming sound manager if - * Phaser.Sound.HTML5AudioSoundManager#pauseOnBlur is set to true. - * - * @method Phaser.Sound.HTML5AudioSoundManager#onFocus - * @protected - * @since 3.0.0 - */ - onFocus: function () + if (points.length === 0) { - this.onBlurPausedSounds.forEach(function (sound) - { - sound.onFocus(); - }); + return out; + } - this.onBlurPausedSounds.length = 0; - }, + var minX = Number.MAX_VALUE; + var minY = Number.MAX_VALUE; - /** - * Calls Phaser.Sound.BaseSoundManager#destroy method - * and cleans up all HTML5 Audio related stuff. - * - * @method Phaser.Sound.HTML5AudioSoundManager#destroy - * @since 3.0.0 - */ - destroy: function () - { - BaseSoundManager.prototype.destroy.call(this); + var maxX = MATH_CONST.MIN_SAFE_INTEGER; + var maxY = MATH_CONST.MIN_SAFE_INTEGER; - this.onBlurPausedSounds.length = 0; - this.onBlurPausedSounds = null; - }, + var p; + var px; + var py; - /** - * Method used internally by Phaser.Sound.HTML5AudioSound class methods and property setters - * to check if sound manager is locked and then either perform action immediately or queue it - * to be performed once the sound manager gets unlocked. - * - * @method Phaser.Sound.HTML5AudioSoundManager#isLocked - * @protected - * @since 3.0.0 - * - * @param {Phaser.Sound.HTML5AudioSound} sound - Sound object on which to perform queued action. - * @param {string} prop - Name of the method to be called or property to be assigned a value to. - * @param {*} [value] - An optional parameter that either holds an array of arguments to be passed to the method call or value to be set to the property. - * - * @return {boolean} Whether the sound manager is locked. - */ - isLocked: function (sound, prop, value) + for (var i = 0; i < points.length; i++) { - if (sound.tags[0].dataset.locked === 'true') - { - this.lockedActionsQueue.push({ - sound: sound, - prop: prop, - value: value - }); + p = points[i]; - return true; + if (Array.isArray(p)) + { + px = p[0]; + py = p[1]; + } + else + { + px = p.x; + py = p.y; } - return false; - }, + minX = Math.min(minX, px); + minY = Math.min(minY, py); - /** - * Sets the muted state of all this Sound Manager. - * - * @method Phaser.Sound.HTML5AudioSoundManager#setMute - * @fires Phaser.Sound.Events#GLOBAL_MUTE - * @since 3.3.0 - * - * @param {boolean} value - `true` to mute all sounds, `false` to unmute them. - * - * @return {Phaser.Sound.HTML5AudioSoundManager} This Sound Manager. - */ - setMute: function (value) - { - this.mute = value; + maxX = Math.max(maxX, px); + maxY = Math.max(maxY, py); + } - return this; - }, + out.x = minX; + out.y = minY; + out.width = maxX - minX; + out.height = maxY - minY; - /** - * @name Phaser.Sound.HTML5AudioSoundManager#mute - * @type {boolean} - * @fires Phaser.Sound.Events#GLOBAL_MUTE - * @since 3.0.0 - */ - mute: { + return out; +}; - get: function () - { - return this._mute; - }, +module.exports = FromPoints; - set: function (value) - { - this._mute = value; - this.forEachActiveSound(function (sound) - { - sound.updateMute(); - }); +/***/ }), - this.emit(Events.GLOBAL_MUTE, this, value); - } +/***/ 75785: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - }, +/** + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets the volume of this Sound Manager. - * - * @method Phaser.Sound.HTML5AudioSoundManager#setVolume - * @fires Phaser.Sound.Events#GLOBAL_VOLUME - * @since 3.3.0 - * - * @param {number} value - The global volume of this Sound Manager. - * - * @return {Phaser.Sound.HTML5AudioSoundManager} This Sound Manager. - */ - setVolume: function (value) - { - this.volume = value; +var Rectangle = __webpack_require__(74118); - return this; - }, +/** + * Create the smallest Rectangle containing two coordinate pairs. + * + * @function Phaser.Geom.Rectangle.FromXY + * @since 3.23.0 + * + * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * + * @param {number} x1 - The X coordinate of the first point. + * @param {number} y1 - The Y coordinate of the first point. + * @param {number} x2 - The X coordinate of the second point. + * @param {number} y2 - The Y coordinate of the second point. + * @param {Phaser.Geom.Rectangle} [out] - Optional Rectangle to adjust. + * + * @return {Phaser.Geom.Rectangle} The adjusted `out` Rectangle, or a new Rectangle if none was provided. + */ +var FromXY = function (x1, y1, x2, y2, out) +{ + if (out === undefined) { out = new Rectangle(); } - /** - * @name Phaser.Sound.HTML5AudioSoundManager#volume - * @type {number} - * @fires Phaser.Sound.Events#GLOBAL_VOLUME - * @since 3.0.0 - */ - volume: { + return out.setTo( + Math.min(x1, x2), + Math.min(y1, y2), + Math.abs(x1 - x2), + Math.abs(y1 - y2) + ); +}; - get: function () - { - return this._volume; - }, +module.exports = FromXY; - set: function (value) - { - this._volume = value; - this.forEachActiveSound(function (sound) - { - sound.updateVolume(); - }); +/***/ }), - this.emit(Events.GLOBAL_VOLUME, this, value); - } +/***/ 6700: +/***/ ((module) => { - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -}); +/** + * Calculates the width/height ratio of a rectangle. + * + * @function Phaser.Geom.Rectangle.GetAspectRatio + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - The rectangle. + * + * @return {number} The width/height ratio of the rectangle. + */ +var GetAspectRatio = function (rect) +{ + return (rect.height === 0) ? NaN : rect.width / rect.height; +}; -module.exports = HTML5AudioSoundManager; +module.exports = GetAspectRatio; /***/ }), -/* 428 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 35242: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(78); +var Point = __webpack_require__(79967); /** - * Returns the first element in the array. - * - * You can optionally specify a matching criteria using the `property` and `value` arguments. - * - * For example: `getAll('visible', true)` would return the first element that had its `visible` property set. + * Returns the center of a Rectangle as a Point. * - * Optionally you can specify a start and end index. For example if the array had 100 elements, - * and you set `startIndex` to 0 and `endIndex` to 50, it would search only the first 50 elements. + * @function Phaser.Geom.Rectangle.GetCenter + * @since 3.0.0 * - * @function Phaser.Utils.Array.GetFirst - * @since 3.4.0 + * @generic {Phaser.Geom.Point} O - [out,$return] * - * @param {array} array - The array to search. - * @param {string} [property] - The property to test on each array element. - * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {number} [startIndex=0] - An optional start index to search from. - * @param {number} [endIndex=array.length] - An optional end index to search up to (but not included) + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the center of. + * @param {(Phaser.Geom.Point|object)} [out] - Optional point-like object to update with the center coordinates. * - * @return {object} The first matching element from the array, or `null` if no element could be found in the range given. + * @return {(Phaser.Geom.Point|object)} The modified `out` object, or a new Point if none was provided. */ -var GetFirst = function (array, property, value, startIndex, endIndex) +var GetCenter = function (rect, out) { - if (startIndex === undefined) { startIndex = 0; } - if (endIndex === undefined) { endIndex = array.length; } - - if (SafeRange(array, startIndex, endIndex)) - { - for (var i = startIndex; i < endIndex; i++) - { - var child = array[i]; + if (out === undefined) { out = new Point(); } - if (!property || - (property && value === undefined && child.hasOwnProperty(property)) || - (property && value !== undefined && child[property] === value)) - { - return child; - } - } - } + out.x = rect.centerX; + out.y = rect.centerY; - return null; + return out; }; -module.exports = GetFirst; +module.exports = GetCenter; /***/ }), -/* 429 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 47698: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSound = __webpack_require__(146); -var Class = __webpack_require__(0); -var Events = __webpack_require__(70); -var Clamp = __webpack_require__(18); +var Perimeter = __webpack_require__(85876); +var Point = __webpack_require__(79967); /** - * @classdesc - * HTML5 Audio implementation of the sound. + * Calculates the coordinates of a point at a certain `position` on the Rectangle's perimeter. * - * @class HTML5AudioSound - * @extends Phaser.Sound.BaseSound - * @memberof Phaser.Sound - * @constructor + * The `position` is a fraction between 0 and 1 which defines how far into the perimeter the point is. + * + * A value of 0 or 1 returns the point at the top left corner of the rectangle, while a value of 0.5 returns the point at the bottom right corner of the rectangle. Values between 0 and 0.5 are on the top or the right side and values between 0.5 and 1 are on the bottom or the left side. + * + * @function Phaser.Geom.Rectangle.GetPoint * @since 3.0.0 * - * @param {Phaser.Sound.HTML5AudioSoundManager} manager - Reference to the current sound manager instance. - * @param {string} key - Asset key for the sound. - * @param {Phaser.Types.Sound.SoundConfig} [config={}] - An optional config object containing default sound settings. + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle to get the perimeter point from. + * @param {number} position - The normalized distance into the Rectangle's perimeter to return. + * @param {(Phaser.Geom.Point|object)} [out] - An object to update with the `x` and `y` coordinates of the point. + * + * @return {Phaser.Geom.Point} The updated `output` object, or a new Point if no `output` object was given. */ -var HTML5AudioSound = new Class({ +var GetPoint = function (rectangle, position, out) +{ + if (out === undefined) { out = new Point(); } - Extends: BaseSound, + if (position <= 0 || position >= 1) + { + out.x = rectangle.x; + out.y = rectangle.y; - initialize: + return out; + } - function HTML5AudioSound (manager, key, config) - { - if (config === undefined) { config = {}; } + var p = Perimeter(rectangle) * position; - /** - * An array containing all HTML5 Audio tags that could be used for individual - * sound's playback. Number of instances depends on the config value passed - * to the Loader#audio method call, default is 1. - * - * @name Phaser.Sound.HTML5AudioSound#tags - * @type {HTMLAudioElement[]} - * @private - * @since 3.0.0 - */ - this.tags = manager.game.cache.audio.get(key); + if (position > 0.5) + { + p -= (rectangle.width + rectangle.height); - if (!this.tags) + if (p <= rectangle.width) { - throw new Error('There is no audio asset with key "' + key + '" in the audio cache'); + // Face 3 + out.x = rectangle.right - p; + out.y = rectangle.bottom; } + else + { + // Face 4 + out.x = rectangle.x; + out.y = rectangle.bottom - (p - rectangle.width); + } + } + else if (p <= rectangle.width) + { + // Face 1 + out.x = rectangle.x + p; + out.y = rectangle.y; + } + else + { + // Face 2 + out.x = rectangle.right; + out.y = rectangle.y + (p - rectangle.width); + } - /** - * Reference to an HTML5 Audio tag used for playing sound. - * - * @name Phaser.Sound.HTML5AudioSound#audio - * @type {HTMLAudioElement} - * @private - * @default null - * @since 3.0.0 - */ - this.audio = null; - - /** - * Timestamp as generated by the Request Animation Frame or SetTimeout - * representing the time at which the delayed sound playback should start. - * Set to 0 if sound playback is not delayed. - * - * @name Phaser.Sound.HTML5AudioSound#startTime - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this.startTime = 0; - - /** - * Audio tag's playback position recorded on previous - * update method call. Set to 0 if sound is not playing. - * - * @name Phaser.Sound.HTML5AudioSound#previousTime - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this.previousTime = 0; + return out; +}; - this.duration = this.tags[0].duration; +module.exports = GetPoint; - this.totalDuration = this.tags[0].duration; - BaseSound.call(this, manager, key, config); - }, +/***/ }), - /** - * Play this sound, or a marked section of it. - * It always plays the sound from the start. If you want to start playback from a specific time - * you can set 'seek' setting of the config object, provided to this call, to that value. - * - * @method Phaser.Sound.HTML5AudioSound#play - * @fires Phaser.Sound.Events#PLAY - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Sound.SoundConfig)} [markerName=''] - If you want to play a marker then provide the marker name here. Alternatively, this parameter can be a SoundConfig object. - * @param {Phaser.Types.Sound.SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound. - * - * @return {boolean} Whether the sound started playing successfully. - */ - play: function (markerName, config) - { - if (this.manager.isLocked(this, 'play', [ markerName, config ])) - { - return false; - } +/***/ 54932: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (!BaseSound.prototype.play.call(this, markerName, config)) - { - return false; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // \/\/\/ isPlaying = true, isPaused = false \/\/\/ - if (!this.pickAndPlayAudioTag()) - { - return false; - } +var GetPoint = __webpack_require__(47698); +var Perimeter = __webpack_require__(85876); - this.emit(Events.PLAY, this); +/** + * Return an array of points from the perimeter of the rectangle, each spaced out based on the quantity or step required. + * + * @function Phaser.Geom.Rectangle.GetPoints + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point[]} O - [out,$return] + * + * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle object to get the points from. + * @param {number} step - Step between points. Used to calculate the number of points to return when quantity is falsey. Ignored if quantity is positive. + * @param {number} quantity - The number of evenly spaced points from the rectangles perimeter to return. If falsey, step param will be used to calculate the number of points. + * @param {(array|Phaser.Geom.Point[])} [out] - An optional array to store the points in. + * + * @return {(array|Phaser.Geom.Point[])} An array of Points from the perimeter of the rectangle. + */ +var GetPoints = function (rectangle, quantity, stepRate, out) +{ + if (out === undefined) { out = []; } - return true; - }, + // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!quantity && stepRate > 0) + { + quantity = Perimeter(rectangle) / stepRate; + } - /** - * Pauses the sound. - * - * @method Phaser.Sound.HTML5AudioSound#pause - * @fires Phaser.Sound.Events#PAUSE - * @since 3.0.0 - * - * @return {boolean} Whether the sound was paused successfully. - */ - pause: function () + for (var i = 0; i < quantity; i++) { - if (this.manager.isLocked(this, 'pause')) - { - return false; - } + var position = i / quantity; - if (this.startTime > 0) - { - return false; - } + out.push(GetPoint(rectangle, position)); + } - if (!BaseSound.prototype.pause.call(this)) - { - return false; - } + return out; +}; - // \/\/\/ isPlaying = false, isPaused = true \/\/\/ - this.currentConfig.seek = this.audio.currentTime - (this.currentMarker ? this.currentMarker.start : 0); +module.exports = GetPoints; - this.stopAndReleaseAudioTag(); - this.emit(Events.PAUSE, this); +/***/ }), - return true; - }, +/***/ 31591: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Resumes the sound. - * - * @method Phaser.Sound.HTML5AudioSound#resume - * @fires Phaser.Sound.Events#RESUME - * @since 3.0.0 - * - * @return {boolean} Whether the sound was resumed successfully. - */ - resume: function () - { - if (this.manager.isLocked(this, 'resume')) - { - return false; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (this.startTime > 0) - { - return false; - } +var Point = __webpack_require__(79967); - if (!BaseSound.prototype.resume.call(this)) - { - return false; - } +/** + * Returns the size of the Rectangle, expressed as a Point object. + * With the value of the `width` as the `x` property and the `height` as the `y` property. + * + * @function Phaser.Geom.Rectangle.GetSize + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the size from. + * @param {(Phaser.Geom.Point|object)} [out] - The Point object to store the size in. If not given, a new Point instance is created. + * + * @return {(Phaser.Geom.Point|object)} A Point object where `x` holds the width and `y` holds the height of the Rectangle. + */ +var GetSize = function (rect, out) +{ + if (out === undefined) { out = new Point(); } - // \/\/\/ isPlaying = true, isPaused = false \/\/\/ - if (!this.pickAndPlayAudioTag()) - { - return false; - } + out.x = rect.width; + out.y = rect.height; - this.emit(Events.RESUME, this); + return out; +}; - return true; - }, +module.exports = GetSize; - /** - * Stop playing this sound. - * - * @method Phaser.Sound.HTML5AudioSound#stop - * @fires Phaser.Sound.Events#STOP - * @since 3.0.0 - * - * @return {boolean} Whether the sound was stopped successfully. - */ - stop: function () - { - if (this.manager.isLocked(this, 'stop')) - { - return false; - } - if (!BaseSound.prototype.stop.call(this)) - { - return false; - } +/***/ }), - // \/\/\/ isPlaying = false, isPaused = false \/\/\/ - this.stopAndReleaseAudioTag(); +/***/ 7782: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.emit(Events.STOP, this); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return true; - }, +var CenterOn = __webpack_require__(79993); - /** - * Used internally to do what the name says. - * - * @method Phaser.Sound.HTML5AudioSound#pickAndPlayAudioTag - * @private - * @since 3.0.0 - * - * @return {boolean} Whether the sound was assigned an audio tag successfully. - */ - pickAndPlayAudioTag: function () - { - if (!this.pickAudioTag()) - { - this.reset(); - return false; - } +/** + * Increases the size of a Rectangle by a specified amount. + * + * The center of the Rectangle stays the same. The amounts are added to each side, so the actual increase in width or height is two times bigger than the respective argument. + * + * @function Phaser.Geom.Rectangle.Inflate + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [rect,$return] + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to inflate. + * @param {number} x - How many pixels the left and the right side should be moved by horizontally. + * @param {number} y - How many pixels the top and the bottom side should be moved by vertically. + * + * @return {Phaser.Geom.Rectangle} The inflated Rectangle. + */ +var Inflate = function (rect, x, y) +{ + var cx = rect.centerX; + var cy = rect.centerY; - var seek = this.currentConfig.seek; - var delay = this.currentConfig.delay; - var offset = (this.currentMarker ? this.currentMarker.start : 0) + seek; + rect.setSize(rect.width + (x * 2), rect.height + (y * 2)); - this.previousTime = offset; - this.audio.currentTime = offset; - this.applyConfig(); + return CenterOn(rect, cx, cy); +}; - if (delay === 0) - { - this.startTime = 0; +module.exports = Inflate; - if (this.audio.paused) - { - this.playCatchPromise(); - } - } - else - { - this.startTime = window.performance.now() + delay * 1000; - if (!this.audio.paused) - { - this.audio.pause(); - } - } +/***/ }), - this.resetConfig(); +/***/ 66217: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return true; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * This method performs the audio tag pooling logic. It first looks for - * unused audio tag to assign to this sound object. If there are no unused - * audio tags, based on HTML5AudioSoundManager#override property value, it - * looks for sound with most advanced playback and hijacks its audio tag or - * does nothing. - * - * @method Phaser.Sound.HTML5AudioSound#pickAudioTag - * @private - * @since 3.0.0 - * - * @return {boolean} Whether the sound was assigned an audio tag successfully. - */ - pickAudioTag: function () - { - if (this.audio) - { - return true; - } +var Rectangle = __webpack_require__(74118); +var Intersects = __webpack_require__(90205); - for (var i = 0; i < this.tags.length; i++) - { - var audio = this.tags[i]; +/** + * Takes two Rectangles and first checks to see if they intersect. + * If they intersect it will return the area of intersection in the `out` Rectangle. + * If they do not intersect, the `out` Rectangle will have a width and height of zero. + * + * @function Phaser.Geom.Rectangle.Intersection + * @since 3.11.0 + * + * @generic {Phaser.Geom.Rectangle} O - [rect,$return] + * + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to get the intersection from. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to get the intersection from. + * @param {Phaser.Geom.Rectangle} [out] - A Rectangle to store the intersection results in. + * + * @return {Phaser.Geom.Rectangle} The intersection result. If the width and height are zero, no intersection occurred. + */ +var Intersection = function (rectA, rectB, out) +{ + if (out === undefined) { out = new Rectangle(); } - if (audio.dataset.used === 'false') - { - audio.dataset.used = 'true'; - this.audio = audio; - return true; - } - } + if (Intersects(rectA, rectB)) + { + out.x = Math.max(rectA.x, rectB.x); + out.y = Math.max(rectA.y, rectB.y); + out.width = Math.min(rectA.right, rectB.right) - out.x; + out.height = Math.min(rectA.bottom, rectB.bottom) - out.y; + } + else + { + out.setEmpty(); + } - if (!this.manager.override) - { - return false; - } + return out; +}; - var otherSounds = []; +module.exports = Intersection; - this.manager.forEachActiveSound(function (sound) - { - if (sound.key === this.key && sound.audio) - { - otherSounds.push(sound); - } - }, this); - otherSounds.sort(function (a1, a2) - { - if (a1.loop === a2.loop) - { - // sort by progress - return (a2.seek / a2.duration) - (a1.seek / a1.duration); - } - return a1.loop ? 1 : -1; - }); +/***/ }), - var selectedSound = otherSounds[0]; +/***/ 40053: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.audio = selectedSound.audio; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - selectedSound.reset(); - selectedSound.audio = null; - selectedSound.startTime = 0; - selectedSound.previousTime = 0; +var Perimeter = __webpack_require__(85876); +var Point = __webpack_require__(79967); - return true; - }, +/** + * Returns an array of points from the perimeter of the Rectangle, where each point is spaced out based + * on either the `step` value, or the `quantity`. + * + * @function Phaser.Geom.Rectangle.MarchingAnts + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point[]} O - [out,$return] + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the perimeter points from. + * @param {number} [step] - The distance between each point of the perimeter. Set to `null` if you wish to use the `quantity` parameter instead. + * @param {number} [quantity] - The total number of points to return. The step is then calculated based on the length of the Rectangle, divided by this value. + * @param {(array|Phaser.Geom.Point[])} [out] - An array in which the perimeter points will be stored. If not given, a new array instance is created. + * + * @return {(array|Phaser.Geom.Point[])} An array containing the perimeter points from the Rectangle. + */ +var MarchingAnts = function (rect, step, quantity, out) +{ + if (out === undefined) { out = []; } - /** - * Method used for playing audio tag and catching possible exceptions - * thrown from rejected Promise returned from play method call. - * - * @method Phaser.Sound.HTML5AudioSound#playCatchPromise - * @private - * @since 3.0.0 - */ - playCatchPromise: function () + if (!step && !quantity) { - var playPromise = this.audio.play(); - - if (playPromise) - { - // eslint-disable-next-line no-unused-vars - playPromise.catch(function (reason) - { - console.warn(reason); - }); - } - }, + // Bail out + return out; + } - /** - * Used internally to do what the name says. - * - * @method Phaser.Sound.HTML5AudioSound#stopAndReleaseAudioTag - * @private - * @since 3.0.0 - */ - stopAndReleaseAudioTag: function () + // If step is a falsey value (false, null, 0, undefined, etc) then we calculate + // it based on the quantity instead, otherwise we always use the step value + if (!step) { - this.startTime = 0; - this.previousTime = 0; + step = Perimeter(rect) / quantity; + } + else + { + quantity = Math.round(Perimeter(rect) / step); + } - if (this.audio) - { - this.audio.pause(); - this.audio.dataset.used = 'false'; - this.audio = null; - } - }, + var x = rect.x; + var y = rect.y; + var face = 0; - /** - * Method used internally to reset sound state, usually when stopping sound - * or when hijacking audio tag from another sound. - * - * @method Phaser.Sound.HTML5AudioSound#reset - * @private - * @since 3.0.0 - */ - reset: function () - { - BaseSound.prototype.stop.call(this); - }, + // Loop across each face of the rectangle - /** - * Method used internally by sound manager for pausing sound if - * Phaser.Sound.HTML5AudioSoundManager#pauseOnBlur is set to true. - * - * @method Phaser.Sound.HTML5AudioSoundManager#onBlur - * @private - * @since 3.0.0 - */ - onBlur: function () + for (var i = 0; i < quantity; i++) { - this.isPlaying = false; - this.isPaused = true; + out.push(new Point(x, y)); - this.currentConfig.seek = this.audio.currentTime - (this.currentMarker ? this.currentMarker.start : 0); + switch (face) + { - this.currentConfig.delay = Math.max(0, (this.startTime - window.performance.now()) / 1000); + // Top face + case 0: + x += step; - this.stopAndReleaseAudioTag(); - }, + if (x >= rect.right) + { + face = 1; + y += (x - rect.right); + x = rect.right; + } + break; - /** - * Method used internally by sound manager for resuming sound if - * Phaser.Sound.HTML5AudioSoundManager#pauseOnBlur is set to true. - * - * @method Phaser.Sound.HTML5AudioSound#onFocus - * @private - * @since 3.0.0 - */ - onFocus: function () - { - this.isPlaying = true; - this.isPaused = false; - this.pickAndPlayAudioTag(); - }, + // Right face + case 1: + y += step; - /** - * Update method called automatically by sound manager on every game step. - * - * @method Phaser.Sound.HTML5AudioSound#update - * @fires Phaser.Sound.Events#COMPLETE - * @fires Phaser.Sound.Events#LOOPED - * @protected - * @since 3.0.0 - * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - */ - update: function (time) - { - if (!this.isPlaying) - { - return; - } + if (y >= rect.bottom) + { + face = 2; + x -= (y - rect.bottom); + y = rect.bottom; + } + break; - // handling delayed playback - if (this.startTime > 0) - { - if (this.startTime < time - this.manager.audioPlayDelay) - { - this.audio.currentTime += Math.max(0, time - this.startTime) / 1000; - this.startTime = 0; - this.previousTime = this.audio.currentTime; - this.playCatchPromise(); - } + // Bottom face + case 2: + x -= step; - return; + if (x <= rect.left) + { + face = 3; + y -= (rect.left - x); + x = rect.left; + } + break; + + // Left face + case 3: + y -= step; + + if (y <= rect.top) + { + face = 0; + y = rect.top; + } + break; } + } - // handle looping and ending - var startTime = this.currentMarker ? this.currentMarker.start : 0; - var endTime = startTime + this.duration; - var currentTime = this.audio.currentTime; + return out; +}; - if (this.currentConfig.loop) - { - if (currentTime >= endTime - this.manager.loopEndOffset) - { - this.audio.currentTime = startTime + Math.max(0, currentTime - endTime); - currentTime = this.audio.currentTime; - } - else if (currentTime < startTime) - { - this.audio.currentTime += startTime; - currentTime = this.audio.currentTime; - } +module.exports = MarchingAnts; - if (currentTime < this.previousTime) - { - this.emit(Events.LOOPED, this); - } - } - else if (currentTime >= endTime) - { - this.reset(); - this.stopAndReleaseAudioTag(); +/***/ }), - this.emit(Events.COMPLETE, this); +/***/ 86673: +/***/ ((module) => { - return; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.previousTime = currentTime; - }, +/** + * Merges a Rectangle with a list of points by repositioning and/or resizing it such that all points are located on or within its bounds. + * + * @function Phaser.Geom.Rectangle.MergePoints + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [target,$return] + * + * @param {Phaser.Geom.Rectangle} target - The Rectangle which should be merged. + * @param {Phaser.Geom.Point[]} points - An array of Points (or any object with public `x` and `y` properties) which should be merged with the Rectangle. + * + * @return {Phaser.Geom.Rectangle} The modified Rectangle. + */ +var MergePoints = function (target, points) +{ + var minX = target.x; + var maxX = target.right; + var minY = target.y; + var maxY = target.bottom; - /** - * Calls Phaser.Sound.BaseSound#destroy method - * and cleans up all HTML5 Audio related stuff. - * - * @method Phaser.Sound.HTML5AudioSound#destroy - * @since 3.0.0 - */ - destroy: function () + for (var i = 0; i < points.length; i++) { - BaseSound.prototype.destroy.call(this); + minX = Math.min(minX, points[i].x); + maxX = Math.max(maxX, points[i].x); + minY = Math.min(minY, points[i].y); + maxY = Math.max(maxY, points[i].y); + } - this.tags = null; + target.x = minX; + target.y = minY; + target.width = maxX - minX; + target.height = maxY - minY; - if (this.audio) - { - this.stopAndReleaseAudioTag(); - } - }, + return target; +}; - /** - * Method used internally to determine mute setting of the sound. - * - * @method Phaser.Sound.HTML5AudioSound#updateMute - * @private - * @since 3.0.0 - */ - updateMute: function () - { - if (this.audio) - { - this.audio.muted = this.currentConfig.mute || this.manager.mute; - } - }, +module.exports = MergePoints; - /** - * Method used internally to calculate total volume of the sound. - * - * @method Phaser.Sound.HTML5AudioSound#updateVolume - * @private - * @since 3.0.0 - */ - updateVolume: function () - { - if (this.audio) - { - this.audio.volume = Clamp(this.currentConfig.volume * this.manager.volume, 0, 1); - } - }, - /** - * Method used internally to calculate total playback rate of the sound. - * - * @method Phaser.Sound.HTML5AudioSound#calculateRate - * @protected - * @since 3.0.0 - */ - calculateRate: function () - { - BaseSound.prototype.calculateRate.call(this); +/***/ }), - if (this.audio) - { - this.audio.playbackRate = this.totalRate; - } - }, +/***/ 14655: +/***/ ((module) => { - /** - * Boolean indicating whether the sound is muted or not. - * Gets or sets the muted state of this sound. - * - * @name Phaser.Sound.HTML5AudioSound#mute - * @type {boolean} - * @default false - * @fires Phaser.Sound.Events#MUTE - * @since 3.0.0 - */ - mute: { +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - get: function () - { - return this.currentConfig.mute; - }, +/** + * Merges the source rectangle into the target rectangle and returns the target. + * Neither rectangle should have a negative width or height. + * + * @function Phaser.Geom.Rectangle.MergeRect + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [target,$return] + * + * @param {Phaser.Geom.Rectangle} target - Target rectangle. Will be modified to include source rectangle. + * @param {Phaser.Geom.Rectangle} source - Rectangle that will be merged into target rectangle. + * + * @return {Phaser.Geom.Rectangle} Modified target rectangle that contains source rectangle. + */ +var MergeRect = function (target, source) +{ + var minX = Math.min(target.x, source.x); + var maxX = Math.max(target.right, source.right); - set: function (value) - { - this.currentConfig.mute = value; + target.x = minX; + target.width = maxX - minX; - if (this.manager.isLocked(this, 'mute', value)) - { - return; - } + var minY = Math.min(target.y, source.y); + var maxY = Math.max(target.bottom, source.bottom); - this.updateMute(); + target.y = minY; + target.height = maxY - minY; - this.emit(Events.MUTE, this, value); - } - }, + return target; +}; - /** - * Sets the muted state of this Sound. - * - * @method Phaser.Sound.HTML5AudioSound#setMute - * @fires Phaser.Sound.Events#MUTE - * @since 3.4.0 - * - * @param {boolean} value - `true` to mute this sound, `false` to unmute it. - * - * @return {this} This Sound instance. - */ - setMute: function (value) - { - this.mute = value; +module.exports = MergeRect; - return this; - }, - /** - * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). - * - * @name Phaser.Sound.HTML5AudioSound#volume - * @type {number} - * @default 1 - * @fires Phaser.Sound.Events#VOLUME - * @since 3.0.0 - */ - volume: { +/***/ }), - get: function () - { - return this.currentConfig.volume; - }, +/***/ 44755: +/***/ ((module) => { - set: function (value) - { - this.currentConfig.volume = value; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (this.manager.isLocked(this, 'volume', value)) - { - return; - } +/** + * Merges a Rectangle with a point by repositioning and/or resizing it so that the point is on or within its bounds. + * + * @function Phaser.Geom.Rectangle.MergeXY + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [target,$return] + * + * @param {Phaser.Geom.Rectangle} target - The Rectangle which should be merged and modified. + * @param {number} x - The X coordinate of the point which should be merged. + * @param {number} y - The Y coordinate of the point which should be merged. + * + * @return {Phaser.Geom.Rectangle} The modified `target` Rectangle. + */ +var MergeXY = function (target, x, y) +{ + var minX = Math.min(target.x, x); + var maxX = Math.max(target.right, x); - this.updateVolume(); + target.x = minX; + target.width = maxX - minX; - this.emit(Events.VOLUME, this, value); - } - }, + var minY = Math.min(target.y, y); + var maxY = Math.max(target.bottom, y); - /** - * Sets the volume of this Sound. - * - * @method Phaser.Sound.HTML5AudioSound#setVolume - * @fires Phaser.Sound.Events#VOLUME - * @since 3.4.0 - * - * @param {number} value - The volume of the sound. - * - * @return {this} This Sound instance. - */ - setVolume: function (value) - { - this.volume = value; + target.y = minY; + target.height = maxY - minY; - return this; - }, + return target; +}; - /** - * Rate at which this Sound will be played. - * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed - * and 2.0 doubles the audios playback speed. - * - * @name Phaser.Sound.HTML5AudioSound#rate - * @type {number} - * @default 1 - * @fires Phaser.Sound.Events#RATE - * @since 3.0.0 - */ - rate: { +module.exports = MergeXY; - get: function () - { - return this.currentConfig.rate; - }, - set: function (value) - { - this.currentConfig.rate = value; +/***/ }), - if (this.manager.isLocked(this, Events.RATE, value)) - { - return; - } - else - { - this.calculateRate(); +/***/ 74466: +/***/ ((module) => { - this.emit(Events.RATE, this, value); - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - }, +/** + * Nudges (translates) the top left corner of a Rectangle by a given offset. + * + * @function Phaser.Geom.Rectangle.Offset + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [rect,$return] + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to adjust. + * @param {number} x - The distance to move the Rectangle horizontally. + * @param {number} y - The distance to move the Rectangle vertically. + * + * @return {Phaser.Geom.Rectangle} The adjusted Rectangle. + */ +var Offset = function (rect, x, y) +{ + rect.x += x; + rect.y += y; - /** - * Sets the playback rate of this Sound. - * - * For example, a value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed - * and 2.0 doubles the audios playback speed. - * - * @method Phaser.Sound.HTML5AudioSound#setRate - * @fires Phaser.Sound.Events#RATE - * @since 3.3.0 - * - * @param {number} value - The playback rate at of this Sound. - * - * @return {this} This Sound instance. - */ - setRate: function (value) - { - this.rate = value; + return rect; +}; - return this; - }, +module.exports = Offset; - /** - * The detune value of this Sound, given in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). - * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). - * - * @name Phaser.Sound.HTML5AudioSound#detune - * @type {number} - * @default 0 - * @fires Phaser.Sound.Events#DETUNE - * @since 3.0.0 - */ - detune: { - get: function () - { - return this.currentConfig.detune; - }, +/***/ }), - set: function (value) - { - this.currentConfig.detune = value; +/***/ 55946: +/***/ ((module) => { - if (this.manager.isLocked(this, Events.DETUNE, value)) - { - return; - } - else - { - this.calculateRate(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.emit(Events.DETUNE, this, value); - } - } +/** + * Nudges (translates) the top-left corner of a Rectangle by the coordinates of a point (translation vector). + * + * @function Phaser.Geom.Rectangle.OffsetPoint + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [rect,$return] + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to adjust. + * @param {(Phaser.Geom.Point|Phaser.Math.Vector2)} point - The point whose coordinates should be used as an offset. + * + * @return {Phaser.Geom.Rectangle} The adjusted Rectangle. + */ +var OffsetPoint = function (rect, point) +{ + rect.x += point.x; + rect.y += point.y; - }, + return rect; +}; - /** - * Sets the detune value of this Sound, given in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). - * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). - * - * @method Phaser.Sound.HTML5AudioSound#setDetune - * @fires Phaser.Sound.Events#DETUNE - * @since 3.3.0 - * - * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). - * - * @return {this} This Sound instance. - */ - setDetune: function (value) - { - this.detune = value; +module.exports = OffsetPoint; - return this; - }, - /** - * Property representing the position of playback for this sound, in seconds. - * Setting it to a specific value moves current playback to that position. - * The value given is clamped to the range 0 to current marker duration. - * Setting seek of a stopped sound has no effect. - * - * @name Phaser.Sound.HTML5AudioSound#seek - * @type {number} - * @fires Phaser.Sound.Events#SEEK - * @since 3.0.0 - */ - seek: { +/***/ }), - get: function () - { - if (this.isPlaying) - { - return this.audio.currentTime - (this.currentMarker ? this.currentMarker.start : 0); - } - else if (this.isPaused) - { - return this.currentConfig.seek; - } - else - { - return 0; - } - }, - - set: function (value) - { - if (this.manager.isLocked(this, 'seek', value)) - { - return; - } - - if (this.startTime > 0) - { - return; - } +/***/ 97474: +/***/ ((module) => { - if (this.isPlaying || this.isPaused) - { - value = Math.min(Math.max(0, value), this.duration); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (this.isPlaying) - { - this.previousTime = value; - this.audio.currentTime = value; - } - else if (this.isPaused) - { - this.currentConfig.seek = value; - } +/** + * Checks if two Rectangles overlap. If a Rectangle is within another Rectangle, the two will be considered overlapping. Thus, the Rectangles are treated as "solid". + * + * @function Phaser.Geom.Rectangle.Overlaps + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check. + * + * @return {boolean} `true` if the two Rectangles overlap, `false` otherwise. + */ +var Overlaps = function (rectA, rectB) +{ + return ( + rectA.x < rectB.right && + rectA.right > rectB.x && + rectA.y < rectB.bottom && + rectA.bottom > rectB.y + ); +}; - this.emit(Events.SEEK, this, value); - } - } - }, +module.exports = Overlaps; - /** - * Seeks to a specific point in this sound. - * - * @method Phaser.Sound.HTML5AudioSound#setSeek - * @fires Phaser.Sound.Events#SEEK - * @since 3.4.0 - * - * @param {number} value - The point in the sound to seek to. - * - * @return {this} This Sound instance. - */ - setSeek: function (value) - { - this.seek = value; - return this; - }, +/***/ }), - /** - * Flag indicating whether or not the sound or current sound marker will loop. - * - * @name Phaser.Sound.HTML5AudioSound#loop - * @type {boolean} - * @default false - * @fires Phaser.Sound.Events#LOOP - * @since 3.0.0 - */ - loop: { +/***/ 85876: +/***/ ((module) => { - get: function () - { - return this.currentConfig.loop; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - set: function (value) - { - this.currentConfig.loop = value; +/** + * Calculates the perimeter of a Rectangle. + * + * @function Phaser.Geom.Rectangle.Perimeter + * @since 3.0.0 + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to use. + * + * @return {number} The perimeter of the Rectangle, equal to `(width * 2) + (height * 2)`. + */ +var Perimeter = function (rect) +{ + return 2 * (rect.width + rect.height); +}; - if (this.manager.isLocked(this, 'loop', value)) - { - return; - } +module.exports = Perimeter; - if (this.audio) - { - this.audio.loop = value; - } - this.emit(Events.LOOP, this, value); - } +/***/ }), - }, +/***/ 20243: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Sets the loop state of this Sound. - * - * @method Phaser.Sound.HTML5AudioSound#setLoop - * @fires Phaser.Sound.Events#LOOP - * @since 3.4.0 - * - * @param {boolean} value - `true` to loop this sound, `false` to not loop it. - * - * @return {Phaser.Sound.HTML5AudioSound} This Sound instance. - */ - setLoop: function (value) - { - this.loop = value; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var Point = __webpack_require__(79967); +var DegToRad = __webpack_require__(75606); - /** - * Gets or sets the pan of this sound, a value between -1 (full left pan) and 1 (full right pan). - * - * Has no audible effect on HTML5 Audio Sound, but still generates the PAN Event. - * - * @name Phaser.Sound.HTML5AudioSound#pan - * @type {number} - * @default 0 - * @fires Phaser.Sound.Events#PAN - * @since 3.50.0 - */ - pan: { +/** + * Returns a Point from the perimeter of a Rectangle based on the given angle. + * + * @function Phaser.Geom.Rectangle.PerimeterPoint + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle to get the perimeter point from. + * @param {number} angle - The angle of the point, in degrees. + * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. + * + * @return {Phaser.Geom.Point} A Point object holding the coordinates of the Rectangle perimeter. + */ +var PerimeterPoint = function (rectangle, angle, out) +{ + if (out === undefined) { out = new Point(); } - get: function () - { - return this.currentConfig.pan; - }, + angle = DegToRad(angle); - set: function (value) - { - this.currentConfig.pan = value; + var s = Math.sin(angle); + var c = Math.cos(angle); - this.emit(Events.PAN, this, value); - } - }, + var dx = (c > 0) ? rectangle.width / 2 : rectangle.width / -2; + var dy = (s > 0) ? rectangle.height / 2 : rectangle.height / -2; - /** - * Sets the pan of this sound, a value between -1 (full left pan) and 1 (full right pan). - * - * Has no audible effect on HTML5 Audio Sound, but still generates the PAN Event. - * - * @method Phaser.Sound.HTML5AudioSound#setPan - * @fires Phaser.Sound.Events#PAN - * @since 3.50.0 - * - * @param {number} value - The pan of the sound. A value between -1 (full left pan) and 1 (full right pan). - * - * @return {this} This Sound instance. - */ - setPan: function (value) + if (Math.abs(dx * s) < Math.abs(dy * c)) { - this.pan = value; - - return this; + dy = (dx * s) / c; + } + else + { + dx = (dy * c) / s; } -}); + out.x = dx + rectangle.centerX; + out.y = dy + rectangle.centerY; -module.exports = HTML5AudioSound; + return out; +}; + +module.exports = PerimeterPoint; /***/ }), -/* 430 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 30001: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSoundManager = __webpack_require__(145); -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(9); -var NoAudioSound = __webpack_require__(431); -var NOOP = __webpack_require__(1); +var Point = __webpack_require__(79967); /** - * @classdesc - * No-audio implementation of the Sound Manager. It is used if audio has been - * disabled in the game config or the device doesn't support any audio. - * - * It represents a graceful degradation of Sound Manager logic that provides - * minimal functionality and prevents Phaser projects that use audio from - * breaking on devices that don't support any audio playback technologies. + * Returns a random point within a Rectangle. * - * @class NoAudioSoundManager - * @extends Phaser.Sound.BaseSoundManager - * @memberof Phaser.Sound - * @constructor + * @function Phaser.Geom.Rectangle.Random * @since 3.0.0 * - * @param {Phaser.Game} game - Reference to the current game instance. + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Rectangle} rect - The Rectangle to return a point from. + * @param {Phaser.Geom.Point} out - The object to update with the point's coordinates. + * + * @return {Phaser.Geom.Point} The modified `out` object, or a new Point if none was provided. */ -var NoAudioSoundManager = new Class({ - - Extends: EventEmitter, - - initialize: - - function NoAudioSoundManager (game) - { - EventEmitter.call(this); +var Random = function (rect, out) +{ + if (out === undefined) { out = new Point(); } - this.game = game; - this.sounds = []; - this.mute = false; - this.volume = 1; - this.rate = 1; - this.detune = 0; - this.pauseOnBlur = true; - this.locked = false; - }, + out.x = rect.x + (Math.random() * rect.width); + out.y = rect.y + (Math.random() * rect.height); - add: function (key, config) - { - var sound = new NoAudioSound(this, key, config); + return out; +}; - this.sounds.push(sound); +module.exports = Random; - return sound; - }, - addAudioSprite: function (key, config) - { - var sound = this.add(key, config); +/***/ }), - sound.spritemap = {}; +/***/ 97691: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return sound; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // eslint-disable-next-line no-unused-vars - play: function (key, extra) - { - return false; - }, +var Between = __webpack_require__(17489); +var ContainsRect = __webpack_require__(73222); +var Point = __webpack_require__(79967); - // eslint-disable-next-line no-unused-vars - playAudioSprite: function (key, spriteName, config) - { - return false; - }, +/** + * Calculates a random point that lies within the `outer` Rectangle, but outside of the `inner` Rectangle. + * The inner Rectangle must be fully contained within the outer rectangle. + * + * @function Phaser.Geom.Rectangle.RandomOutside + * @since 3.10.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Rectangle} outer - The outer Rectangle to get the random point within. + * @param {Phaser.Geom.Rectangle} inner - The inner Rectangle to exclude from the returned point. + * @param {Phaser.Geom.Point} [out] - A Point, or Point-like object to store the result in. If not specified, a new Point will be created. + * + * @return {Phaser.Geom.Point} A Point object containing the random values in its `x` and `y` properties. + */ +var RandomOutside = function (outer, inner, out) +{ + if (out === undefined) { out = new Point(); } - remove: function (sound) + if (ContainsRect(outer, inner)) { - return BaseSoundManager.prototype.remove.call(this, sound); - }, + // Pick a random quadrant + // + // The quadrants don't extend the full widths / heights of the outer rect to give + // us a better uniformed distribution, otherwise you get clumping in the corners where + // the 4 quads would overlap - removeByKey: function (key) - { - return BaseSoundManager.prototype.removeByKey.call(this, key); - }, + switch (Between(0, 3)) + { + case 0: // Top + out.x = outer.x + (Math.random() * (inner.right - outer.x)); + out.y = outer.y + (Math.random() * (inner.top - outer.y)); + break; - pauseAll: NOOP, - resumeAll: NOOP, - stopAll: NOOP, - update: NOOP, - setRate: NOOP, - setDetune: NOOP, - setMute: NOOP, - setVolume: NOOP, + case 1: // Bottom + out.x = inner.x + (Math.random() * (outer.right - inner.x)); + out.y = inner.bottom + (Math.random() * (outer.bottom - inner.bottom)); + break; - forEachActiveSound: function (callbackfn, scope) - { - BaseSoundManager.prototype.forEachActiveSound.call(this, callbackfn, scope); - }, + case 2: // Left + out.x = outer.x + (Math.random() * (inner.x - outer.x)); + out.y = inner.y + (Math.random() * (outer.bottom - inner.y)); + break; - destroy: function () - { - BaseSoundManager.prototype.destroy.call(this); + case 3: // Right + out.x = inner.right + (Math.random() * (outer.right - inner.right)); + out.y = outer.y + (Math.random() * (inner.bottom - outer.y)); + break; + } } -}); + return out; +}; -module.exports = NoAudioSoundManager; +module.exports = RandomOutside; /***/ }), -/* 431 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 74118: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSound = __webpack_require__(146); -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(9); -var Extend = __webpack_require__(17); - -var returnFalse = function () -{ - return false; -}; - -var returnNull = function () -{ - return null; -}; - -var returnThis = function () -{ - return this; -}; +var Class = __webpack_require__(56694); +var Contains = __webpack_require__(94287); +var GetPoint = __webpack_require__(47698); +var GetPoints = __webpack_require__(54932); +var GEOM_CONST = __webpack_require__(52394); +var Line = __webpack_require__(88829); +var Random = __webpack_require__(30001); /** * @classdesc - * No audio implementation of the sound. It is used if audio has been - * disabled in the game config or the device doesn't support any audio. - * - * It represents a graceful degradation of sound logic that provides - * minimal functionality and prevents Phaser projects that use audio from - * breaking on devices that don't support any audio playback technologies. + * Encapsulates a 2D rectangle defined by its corner point in the top-left and its extends in x (width) and y (height) * - * @class NoAudioSound - * @memberof Phaser.Sound + * @class Rectangle + * @memberof Phaser.Geom * @constructor * @since 3.0.0 * - * @param {Phaser.Sound.NoAudioSoundManager} manager - Reference to the current sound manager instance. - * @param {string} key - Asset key for the sound. - * @param {Phaser.Types.Sound.SoundConfig} [config={}] - An optional config object containing default sound settings. + * @param {number} [x=0] - The X coordinate of the top left corner of the Rectangle. + * @param {number} [y=0] - The Y coordinate of the top left corner of the Rectangle. + * @param {number} [width=0] - The width of the Rectangle. + * @param {number} [height=0] - The height of the Rectangle. */ -var NoAudioSound = new Class({ - - Extends: EventEmitter, +var Rectangle = new Class({ initialize: - function NoAudioSound (manager, key, config) + function Rectangle (x, y, width, height) { - if (config === void 0) { config = {}; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 0; } + if (height === undefined) { height = 0; } - EventEmitter.call(this); + /** + * The geometry constant type of this object: `GEOM_CONST.RECTANGLE`. + * Used for fast type comparisons. + * + * @name Phaser.Geom.Rectangle#type + * @type {number} + * @readonly + * @since 3.19.0 + */ + this.type = GEOM_CONST.RECTANGLE; - this.manager = manager; - this.key = key; - this.isPlaying = false; - this.isPaused = false; - this.totalRate = 1; - this.duration = 0; - this.totalDuration = 0; + /** + * The X coordinate of the top left corner of the Rectangle. + * + * @name Phaser.Geom.Rectangle#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.x = x; - this.config = Extend({ - mute: false, - volume: 1, - rate: 1, - detune: 0, - seek: 0, - loop: false, - delay: 0, - pan: 0 - }, config); + /** + * The Y coordinate of the top left corner of the Rectangle. + * + * @name Phaser.Geom.Rectangle#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y = y; - this.currentConfig = this.config; - this.mute = false; - this.volume = 1; - this.rate = 1; - this.detune = 0; - this.seek = 0; - this.loop = false; - this.pan = 0; - this.markers = {}; - this.currentMarker = null; - this.pendingRemove = false; + /** + * The width of the Rectangle, i.e. the distance between its left side (defined by `x`) and its right side. + * + * @name Phaser.Geom.Rectangle#width + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.width = width; + + /** + * The height of the Rectangle, i.e. the distance between its top side (defined by `y`) and its bottom side. + * + * @name Phaser.Geom.Rectangle#height + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.height = height; }, /** - * @method Phaser.Sound.NoAudioSound#addMarker + * Checks if the given point is inside the Rectangle's bounds. + * + * @method Phaser.Geom.Rectangle#contains * @since 3.0.0 * - * @param {Phaser.Types.Sound.SoundMarker} marker - Marker object. + * @param {number} x - The X coordinate of the point to check. + * @param {number} y - The Y coordinate of the point to check. * - * @return {boolean} false + * @return {boolean} `true` if the point is within the Rectangle's bounds, otherwise `false`. */ - addMarker: returnFalse, + contains: function (x, y) + { + return Contains(this, x, y); + }, /** - * @method Phaser.Sound.NoAudioSound#updateMarker + * Calculates the coordinates of a point at a certain `position` on the Rectangle's perimeter. + * + * The `position` is a fraction between 0 and 1 which defines how far into the perimeter the point is. + * + * A value of 0 or 1 returns the point at the top left corner of the rectangle, while a value of 0.5 returns the point at the bottom right corner of the rectangle. Values between 0 and 0.5 are on the top or the right side and values between 0.5 and 1 are on the bottom or the left side. + * + * @method Phaser.Geom.Rectangle#getPoint * @since 3.0.0 * - * @param {Phaser.Types.Sound.SoundMarker} marker - Marker object with updated values. + * @generic {Phaser.Geom.Point} O - [output,$return] * - * @return {boolean} false + * @param {number} position - The normalized distance into the Rectangle's perimeter to return. + * @param {(Phaser.Geom.Point|object)} [output] - An object to update with the `x` and `y` coordinates of the point. + * + * @return {(Phaser.Geom.Point|object)} The updated `output` object, or a new Point if no `output` object was given. */ - updateMarker: returnFalse, + getPoint: function (position, output) + { + return GetPoint(this, position, output); + }, /** - * @method Phaser.Sound.NoAudioSound#removeMarker + * Returns an array of points from the perimeter of the Rectangle, each spaced out based on the quantity or step required. + * + * @method Phaser.Geom.Rectangle#getPoints * @since 3.0.0 * - * @param {string} markerName - The name of the marker to remove. + * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @return {null} null + * @param {number} quantity - The number of points to return. Set to `false` or 0 to return an arbitrary number of points (`perimeter / stepRate`) evenly spaced around the Rectangle based on the `stepRate`. + * @param {number} [stepRate] - If `quantity` is 0, determines the normalized distance between each returned point. + * @param {(array|Phaser.Geom.Point[])} [output] - An array to which to append the points. + * + * @return {(array|Phaser.Geom.Point[])} The modified `output` array, or a new array if none was provided. */ - removeMarker: returnNull, + getPoints: function (quantity, stepRate, output) + { + return GetPoints(this, quantity, stepRate, output); + }, /** - * @method Phaser.Sound.NoAudioSound#play + * Returns a random point within the Rectangle's bounds. + * + * @method Phaser.Geom.Rectangle#getRandomPoint * @since 3.0.0 * - * @param {(string|Phaser.Types.Sound.SoundConfig)} [markerName=''] - If you want to play a marker then provide the marker name here. Alternatively, this parameter can be a SoundConfig object. - * @param {Phaser.Types.Sound.SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound. + * @generic {Phaser.Geom.Point} O - [point,$return] * - * @return {boolean} false + * @param {Phaser.Geom.Point} [point] - The object in which to store the `x` and `y` coordinates of the point. + * + * @return {Phaser.Geom.Point} The updated `point`, or a new Point if none was provided. */ - play: returnFalse, + getRandomPoint: function (point) + { + return Random(this, point); + }, /** - * @method Phaser.Sound.NoAudioSound#pause + * Sets the position, width, and height of the Rectangle. + * + * @method Phaser.Geom.Rectangle#setTo * @since 3.0.0 * - * @return {boolean} false + * @param {number} x - The X coordinate of the top left corner of the Rectangle. + * @param {number} y - The Y coordinate of the top left corner of the Rectangle. + * @param {number} width - The width of the Rectangle. + * @param {number} height - The height of the Rectangle. + * + * @return {this} This Rectangle object. */ - pause: returnFalse, + setTo: function (x, y, width, height) + { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + + return this; + }, /** - * Resumes the sound. + * Resets the position, width, and height of the Rectangle to 0. * - * @method Phaser.Sound.NoAudioSound#resume + * @method Phaser.Geom.Rectangle#setEmpty * @since 3.0.0 * - * @return {boolean} false + * @return {this} This Rectangle object. */ - resume: returnFalse, + setEmpty: function () + { + return this.setTo(0, 0, 0, 0); + }, /** - * Stop playing this sound. + * Sets the position of the Rectangle. * - * @method Phaser.Sound.NoAudioSound#stop + * @method Phaser.Geom.Rectangle#setPosition * @since 3.0.0 * - * @return {boolean} false + * @param {number} x - The X coordinate of the top left corner of the Rectangle. + * @param {number} [y=x] - The Y coordinate of the top left corner of the Rectangle. + * + * @return {this} This Rectangle object. */ - stop: returnFalse, + setPosition: function (x, y) + { + if (y === undefined) { y = x; } + + this.x = x; + this.y = y; + + return this; + }, /** - * Destroys this sound and all associated events and marks it for removal from the sound manager. + * Sets the width and height of the Rectangle. * - * @method Phaser.Sound.NoAudioSound#destroy - * @fires Phaser.Sound.Events#DESTROY + * @method Phaser.Geom.Rectangle#setSize * @since 3.0.0 + * + * @param {number} width - The width to set the Rectangle to. + * @param {number} [height=width] - The height to set the Rectangle to. + * + * @return {this} This Rectangle object. */ - destroy: function () + setSize: function (width, height) { - BaseSound.prototype.destroy.call(this); - }, - - setMute: returnThis, - - setVolume: returnThis, - - setRate: returnThis, - - setDetune: returnThis, - - setSeek: returnThis, - - setLoop: returnThis, - - setPan: returnThis - -}); - -module.exports = NoAudioSound; - - -/***/ }), -/* 432 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Base64ToArrayBuffer = __webpack_require__(433); -var BaseSoundManager = __webpack_require__(145); -var Class = __webpack_require__(0); -var Events = __webpack_require__(70); -var GameEvents = __webpack_require__(22); -var WebAudioSound = __webpack_require__(434); - -/** - * @classdesc - * Web Audio API implementation of the Sound Manager. - * - * Not all browsers can play all audio formats. - * - * There is a good guide to what's supported: [Cross-browser audio basics: Audio codec support](https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics#Audio_Codec_Support). - * - * @class WebAudioSoundManager - * @extends Phaser.Sound.BaseSoundManager - * @memberof Phaser.Sound - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Game} game - Reference to the current game instance. - */ -var WebAudioSoundManager = new Class({ + if (height === undefined) { height = width; } - Extends: BaseSoundManager, + this.width = width; + this.height = height; - initialize: + return this; + }, - function WebAudioSoundManager (game) + /** + * Determines if the Rectangle is empty. A Rectangle is empty if its width or height is less than or equal to 0. + * + * @method Phaser.Geom.Rectangle#isEmpty + * @since 3.0.0 + * + * @return {boolean} `true` if the Rectangle is empty. A Rectangle object is empty if its width or height is less than or equal to 0. + */ + isEmpty: function () { - /** - * The AudioContext being used for playback. - * - * @name Phaser.Sound.WebAudioSoundManager#context - * @type {AudioContext} - * @since 3.0.0 - */ - this.context = this.createAudioContext(game); - - /** - * Gain node responsible for controlling global muting. - * - * @name Phaser.Sound.WebAudioSoundManager#masterMuteNode - * @type {GainNode} - * @since 3.0.0 - */ - this.masterMuteNode = this.context.createGain(); - - /** - * Gain node responsible for controlling global volume. - * - * @name Phaser.Sound.WebAudioSoundManager#masterVolumeNode - * @type {GainNode} - * @since 3.0.0 - */ - this.masterVolumeNode = this.context.createGain(); - - this.masterMuteNode.connect(this.masterVolumeNode); - - this.masterVolumeNode.connect(this.context.destination); - - /** - * Destination node for connecting individual sounds to. - * - * @name Phaser.Sound.WebAudioSoundManager#destination - * @type {AudioNode} - * @since 3.0.0 - */ - this.destination = this.masterMuteNode; - - this.locked = this.context.state === 'suspended' && ('ontouchstart' in window || 'onclick' in window); - - BaseSoundManager.call(this, game); - - if (this.locked && game.isBooted) - { - this.unlock(); - } - else - { - game.events.once(GameEvents.BOOT, this.unlock, this); - } + return (this.width <= 0 || this.height <= 0); }, /** - * Method responsible for instantiating and returning AudioContext instance. - * If an instance of an AudioContext class was provided through the game config, - * that instance will be returned instead. This can come in handy if you are reloading - * a Phaser game on a page that never properly refreshes (such as in an SPA project) - * and you want to reuse already instantiated AudioContext. + * Returns a Line object that corresponds to the top of this Rectangle. * - * @method Phaser.Sound.WebAudioSoundManager#createAudioContext + * @method Phaser.Geom.Rectangle#getLineA * @since 3.0.0 * - * @param {Phaser.Game} game - Reference to the current game instance. + * @generic {Phaser.Geom.Line} O - [line,$return] * - * @return {AudioContext} The AudioContext instance to be used for playback. + * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. + * + * @return {Phaser.Geom.Line} A Line object that corresponds to the top of this Rectangle. */ - createAudioContext: function (game) + getLineA: function (line) { - var audioConfig = game.config.audio; - - if (audioConfig.context) - { - audioConfig.context.resume(); + if (line === undefined) { line = new Line(); } - return audioConfig.context; - } + line.setTo(this.x, this.y, this.right, this.y); - if (window.hasOwnProperty('AudioContext')) - { - return new AudioContext(); - } - else if (window.hasOwnProperty('webkitAudioContext')) - { - return new window.webkitAudioContext(); - } + return line; }, /** - * This method takes a new AudioContext reference and then sets - * this Sound Manager to use that context for all playback. + * Returns a Line object that corresponds to the right of this Rectangle. * - * As part of this call it also disconnects the master mute and volume - * nodes and then re-creates them on the new given context. + * @method Phaser.Geom.Rectangle#getLineB + * @since 3.0.0 * - * @method Phaser.Sound.WebAudioSoundManager#setAudioContext - * @since 3.21.0 + * @generic {Phaser.Geom.Line} O - [line,$return] * - * @param {AudioContext} context - Reference to an already created AudioContext instance. + * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. * - * @return {this} The WebAudioSoundManager instance. + * @return {Phaser.Geom.Line} A Line object that corresponds to the right of this Rectangle. */ - setAudioContext: function (context) + getLineB: function (line) { - if (this.context) - { - this.context.close(); - } - - if (this.masterMuteNode) - { - this.masterMuteNode.disconnect(); - } - - if (this.masterVolumeNode) - { - this.masterVolumeNode.disconnect(); - } - - this.context = context; - - this.masterMuteNode = context.createGain(); - this.masterVolumeNode = context.createGain(); - - this.masterMuteNode.connect(this.masterVolumeNode); - this.masterVolumeNode.connect(context.destination); + if (line === undefined) { line = new Line(); } - this.destination = this.masterMuteNode; + line.setTo(this.right, this.y, this.right, this.bottom); - return this; + return line; }, /** - * Adds a new sound into the sound manager. + * Returns a Line object that corresponds to the bottom of this Rectangle. * - * @method Phaser.Sound.WebAudioSoundManager#add + * @method Phaser.Geom.Rectangle#getLineC * @since 3.0.0 * - * @param {string} key - Asset key for the sound. - * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. + * @generic {Phaser.Geom.Line} O - [line,$return] * - * @return {Phaser.Sound.WebAudioSound} The new sound instance. + * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. + * + * @return {Phaser.Geom.Line} A Line object that corresponds to the bottom of this Rectangle. */ - add: function (key, config) + getLineC: function (line) { - var sound = new WebAudioSound(this, key, config); + if (line === undefined) { line = new Line(); } - this.sounds.push(sound); + line.setTo(this.right, this.bottom, this.x, this.bottom); - return sound; + return line; }, /** - * Decode audio data into a format ready for playback via Web Audio. - * - * The audio data can be a base64 encoded string, an audio media-type data uri, or an ArrayBuffer instance. - * - * The `audioKey` is the key that will be used to save the decoded audio to the audio cache. - * - * Instead of passing a single entry you can instead pass an array of `Phaser.Types.Sound.DecodeAudioConfig` - * objects as the first and only argument. + * Returns a Line object that corresponds to the left of this Rectangle. * - * Decoding is an async process, so be sure to listen for the events to know when decoding has completed. + * @method Phaser.Geom.Rectangle#getLineD + * @since 3.0.0 * - * Once the audio has decoded it can be added to the Sound Manager or played via its key. + * @generic {Phaser.Geom.Line} O - [line,$return] * - * @method Phaser.Sound.WebAudioSoundManager#decodeAudio - * @fires Phaser.Sound.Events#DECODED - * @fires Phaser.Sound.Events#DECODED_ALL - * @since 3.18.0 + * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. * - * @param {(Phaser.Types.Sound.DecodeAudioConfig[]|string)} [audioKey] - The string-based key to be used to reference the decoded audio in the audio cache, or an array of audio config objects. - * @param {(ArrayBuffer|string)} [audioData] - The audio data, either a base64 encoded string, an audio media-type data uri, or an ArrayBuffer instance. + * @return {Phaser.Geom.Line} A Line object that corresponds to the left of this Rectangle. */ - decodeAudio: function (audioKey, audioData) + getLineD: function (line) { - var audioFiles; + if (line === undefined) { line = new Line(); } - if (!Array.isArray(audioKey)) - { - audioFiles = [ { key: audioKey, data: audioData } ]; - } - else - { - audioFiles = audioKey; - } + line.setTo(this.x, this.bottom, this.x, this.y); - var cache = this.game.cache.audio; - var remaining = audioFiles.length; + return line; + }, - for (var i = 0; i < audioFiles.length; i++) - { - var entry = audioFiles[i]; + /** + * The x coordinate of the left of the Rectangle. + * Changing the left property of a Rectangle object has no effect on the y and height properties. However it does affect the width property, whereas changing the x value does not affect the width property. + * + * @name Phaser.Geom.Rectangle#left + * @type {number} + * @since 3.0.0 + */ + left: { - var key = entry.key; - var data = entry.data; + get: function () + { + return this.x; + }, - if (typeof data === 'string') + set: function (value) + { + if (value >= this.right) { - data = Base64ToArrayBuffer(data); + this.width = 0; } - - var success = function (key, audioBuffer) - { - cache.add(key, audioBuffer); - - this.emit(Events.DECODED, key); - - remaining--; - - if (remaining === 0) - { - this.emit(Events.DECODED_ALL); - } - }.bind(this, key); - - var failure = function (key, error) + else { - // eslint-disable-next-line no-console - console.error('Error decoding audio: ' + key + ' - ', error ? error.message : ''); - - remaining--; - - if (remaining === 0) - { - this.emit(Events.DECODED_ALL); - } - }.bind(this, key); + this.width = this.right - value; + } - this.context.decodeAudioData(data, success, failure); + this.x = value; } + }, /** - * Unlocks Web Audio API on the initial input event. - * - * Read more about how this issue is handled here in [this article](https://medium.com/@pgoloskokovic/unlocking-web-audio-the-smarter-way-8858218c0e09). + * The sum of the x and width properties. + * Changing the right property of a Rectangle object has no effect on the x, y and height properties, however it does affect the width property. * - * @method Phaser.Sound.WebAudioSoundManager#unlock + * @name Phaser.Geom.Rectangle#right + * @type {number} * @since 3.0.0 */ - unlock: function () - { - var _this = this; + right: { - var body = document.body; + get: function () + { + return this.x + this.width; + }, - var unlockHandler = function unlockHandler () + set: function (value) { - if (_this.context && body) + if (value <= this.x) { - var bodyRemove = body.removeEventListener; - - _this.context.resume().then(function () - { - bodyRemove('touchstart', unlockHandler); - bodyRemove('touchend', unlockHandler); - bodyRemove('click', unlockHandler); - bodyRemove('keydown', unlockHandler); - - _this.unlocked = true; - }, function () - { - bodyRemove('touchstart', unlockHandler); - bodyRemove('touchend', unlockHandler); - bodyRemove('click', unlockHandler); - bodyRemove('keydown', unlockHandler); - }); + this.width = 0; + } + else + { + this.width = value - this.x; } - }; - - if (body) - { - body.addEventListener('touchstart', unlockHandler, false); - body.addEventListener('touchend', unlockHandler, false); - body.addEventListener('click', unlockHandler, false); - body.addEventListener('keydown', unlockHandler, false); } + }, /** - * Method used internally for pausing sound manager if - * Phaser.Sound.WebAudioSoundManager#pauseOnBlur is set to true. + * The y coordinate of the top of the Rectangle. Changing the top property of a Rectangle object has no effect on the x and width properties. + * However it does affect the height property, whereas changing the y value does not affect the height property. * - * @method Phaser.Sound.WebAudioSoundManager#onBlur - * @protected + * @name Phaser.Geom.Rectangle#top + * @type {number} * @since 3.0.0 */ - onBlur: function () - { - if (!this.locked) + top: { + + get: function () { - this.context.suspend(); + return this.y; + }, + + set: function (value) + { + if (value >= this.bottom) + { + this.height = 0; + } + else + { + this.height = (this.bottom - value); + } + + this.y = value; } + }, /** - * Method used internally for resuming sound manager if - * Phaser.Sound.WebAudioSoundManager#pauseOnBlur is set to true. + * The sum of the y and height properties. + * Changing the bottom property of a Rectangle object has no effect on the x, y and width properties, but does change the height property. * - * @method Phaser.Sound.WebAudioSoundManager#onFocus - * @protected + * @name Phaser.Geom.Rectangle#bottom + * @type {number} * @since 3.0.0 */ - onFocus: function () - { - var context = this.context; - - if ((context.state === 'suspended' || context.state === 'interrupted') && !this.locked) - { - context.resume(); - } - }, - - /** - * Update method called on every game step. - * Removes destroyed sounds and updates every active sound in the game. - * - * @method Phaser.Sound.WebAudioSoundManager#update - * @protected - * @fires Phaser.Sound.Events#UNLOCKED - * @since 3.0.0 - * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time elapsed since the last frame. - */ - update: function (time, delta) - { - BaseSoundManager.prototype.update.call(this, time, delta); - - var context = this.context; + bottom: { - // Resume interrupted audio on iOS - if (context && context.state === 'interrupted') + get: function () { - context.resume(); - } - }, - - /** - * Calls Phaser.Sound.BaseSoundManager#destroy method - * and cleans up all Web Audio API related stuff. - * - * @method Phaser.Sound.WebAudioSoundManager#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.destination = null; - this.masterVolumeNode.disconnect(); - this.masterVolumeNode = null; - this.masterMuteNode.disconnect(); - this.masterMuteNode = null; + return this.y + this.height; + }, - if (this.game.config.audio.context) - { - this.context.suspend(); - } - else + set: function (value) { - var _this = this; - - this.context.close().then(function () + if (value <= this.y) { - _this.context = null; - }); + this.height = 0; + } + else + { + this.height = value - this.y; + } } - BaseSoundManager.prototype.destroy.call(this); }, /** - * Sets the muted state of all this Sound Manager. - * - * @method Phaser.Sound.WebAudioSoundManager#setMute - * @fires Phaser.Sound.Events#GLOBAL_MUTE - * @since 3.3.0 - * - * @param {boolean} value - `true` to mute all sounds, `false` to unmute them. + * The x coordinate of the center of the Rectangle. * - * @return {Phaser.Sound.WebAudioSoundManager} This Sound Manager. - */ - setMute: function (value) - { - this.mute = value; - - return this; - }, - - /** - * @name Phaser.Sound.WebAudioSoundManager#mute - * @type {boolean} - * @fires Phaser.Sound.Events#GLOBAL_MUTE + * @name Phaser.Geom.Rectangle#centerX + * @type {number} * @since 3.0.0 */ - mute: { + centerX: { get: function () { - return (this.masterMuteNode.gain.value === 0); + return this.x + (this.width / 2); }, set: function (value) { - this.masterMuteNode.gain.setValueAtTime(value ? 0 : 1, 0); - - this.emit(Events.GLOBAL_MUTE, this, value); + this.x = value - (this.width / 2); } }, /** - * Sets the volume of this Sound Manager. - * - * @method Phaser.Sound.WebAudioSoundManager#setVolume - * @fires Phaser.Sound.Events#GLOBAL_VOLUME - * @since 3.3.0 - * - * @param {number} value - The global volume of this Sound Manager. + * The y coordinate of the center of the Rectangle. * - * @return {Phaser.Sound.WebAudioSoundManager} This Sound Manager. - */ - setVolume: function (value) - { - this.volume = value; - - return this; - }, - - /** - * @name Phaser.Sound.WebAudioSoundManager#volume + * @name Phaser.Geom.Rectangle#centerY * @type {number} - * @fires Phaser.Sound.Events#GLOBAL_VOLUME * @since 3.0.0 */ - volume: { + centerY: { get: function () { - return this.masterVolumeNode.gain.value; + return this.y + (this.height / 2); }, set: function (value) { - this.masterVolumeNode.gain.setValueAtTime(value, 0); - - this.emit(Events.GLOBAL_VOLUME, this, value); + this.y = value - (this.height / 2); } } }); -module.exports = WebAudioSoundManager; +module.exports = Rectangle; /***/ }), -/* 433 */ -/***/ (function(module, exports) { + +/***/ 51828: +/***/ ((module) => { /** - * @author Niklas von Hertzen (https://github.com/niklasvh/base64-arraybuffer) * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - -// Use a lookup table to find the index. -var lookup = new Uint8Array(256); - -for (var i = 0; i < chars.length; i++) -{ - lookup[chars.charCodeAt(i)] = i; -} - /** - * Converts a base64 string, either with or without a data uri, into an Array Buffer. + * Determines if the two objects (either Rectangles or Rectangle-like) have the same width and height values under strict equality. * - * @function Phaser.Utils.Base64.Base64ToArrayBuffer - * @since 3.18.0 - * - * @param {string} base64 - The base64 string to be decoded. Can optionally contain a data URI header, which will be stripped out prior to decoding. - * - * @return {ArrayBuffer} An ArrayBuffer decoded from the base64 data. + * @function Phaser.Geom.Rectangle.SameDimensions + * @since 3.15.0 + * + * @param {Phaser.Geom.Rectangle} rect - The first Rectangle object. + * @param {Phaser.Geom.Rectangle} toCompare - The second Rectangle object. + * + * @return {boolean} `true` if the objects have equivalent values for the `width` and `height` properties, otherwise `false`. */ -var Base64ToArrayBuffer = function (base64) +var SameDimensions = function (rect, toCompare) { - // Is it a data uri? if so, strip the header away - base64 = base64.substr(base64.indexOf(',') + 1); + return (rect.width === toCompare.width && rect.height === toCompare.height); +}; - var len = base64.length; - var bufferLength = len * 0.75; - var p = 0; - var encoded1; - var encoded2; - var encoded3; - var encoded4; +module.exports = SameDimensions; - if (base64[len - 1] === '=') - { - bufferLength--; - if (base64[len - 2] === '=') - { - bufferLength--; - } - } +/***/ }), - var arrayBuffer = new ArrayBuffer(bufferLength); - var bytes = new Uint8Array(arrayBuffer); +/***/ 5691: +/***/ ((module) => { - for (var i = 0; i < len; i += 4) - { - encoded1 = lookup[base64.charCodeAt(i)]; - encoded2 = lookup[base64.charCodeAt(i + 1)]; - encoded3 = lookup[base64.charCodeAt(i + 2)]; - encoded4 = lookup[base64.charCodeAt(i + 3)]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); - bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); - bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); - } +/** + * Scales the width and height of this Rectangle by the given amounts. + * + * @function Phaser.Geom.Rectangle.Scale + * @since 3.0.0 + * + * @generic {Phaser.Geom.Rectangle} O - [rect,$return] + * + * @param {Phaser.Geom.Rectangle} rect - The `Rectangle` object that will be scaled by the specified amount(s). + * @param {number} x - The factor by which to scale the rectangle horizontally. + * @param {number} y - The amount by which to scale the rectangle vertically. If this is not specified, the rectangle will be scaled by the factor `x` in both directions. + * + * @return {Phaser.Geom.Rectangle} The rectangle object with updated `width` and `height` properties as calculated from the scaling factor(s). + */ +var Scale = function (rect, x, y) +{ + if (y === undefined) { y = x; } - return arrayBuffer; + rect.width *= x; + rect.height *= y; + + return rect; }; -module.exports = Base64ToArrayBuffer; +module.exports = Scale; /***/ }), -/* 434 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 58795: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BaseSound = __webpack_require__(146); -var Class = __webpack_require__(0); -var Events = __webpack_require__(70); +var Rectangle = __webpack_require__(74118); /** - * @classdesc - * Web Audio API implementation of the sound. + * Creates a new Rectangle or repositions and/or resizes an existing Rectangle so that it encompasses the two given Rectangles, i.e. calculates their union. * - * @class WebAudioSound - * @extends Phaser.Sound.BaseSound - * @memberof Phaser.Sound - * @constructor + * @function Phaser.Geom.Rectangle.Union * @since 3.0.0 * - * @param {Phaser.Sound.WebAudioSoundManager} manager - Reference to the current sound manager instance. - * @param {string} key - Asset key for the sound. - * @param {Phaser.Types.Sound.SoundConfig} [config={}] - An optional config object containing default sound settings. + * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * + * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to use. + * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to use. + * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the union in. + * + * @return {Phaser.Geom.Rectangle} The modified `out` Rectangle, or a new Rectangle if none was provided. */ -var WebAudioSound = new Class({ - - Extends: BaseSound, - - initialize: +var Union = function (rectA, rectB, out) +{ + if (out === undefined) { out = new Rectangle(); } - function WebAudioSound (manager, key, config) - { - if (config === undefined) { config = {}; } + // Cache vars so we can use one of the input rects as the output rect + var x = Math.min(rectA.x, rectB.x); + var y = Math.min(rectA.y, rectB.y); + var w = Math.max(rectA.right, rectB.right) - x; + var h = Math.max(rectA.bottom, rectB.bottom) - y; - /** - * Audio buffer containing decoded data of the audio asset to be played. - * - * @name Phaser.Sound.WebAudioSound#audioBuffer - * @type {AudioBuffer} - * @since 3.0.0 - */ - this.audioBuffer = manager.game.cache.audio.get(key); + return out.setTo(x, y, w, h); +}; - if (!this.audioBuffer) - { - throw new Error('Audio key "' + key + '" missing from cache'); - } +module.exports = Union; - /** - * A reference to an audio source node used for playing back audio from - * audio data stored in Phaser.Sound.WebAudioSound#audioBuffer. - * - * @name Phaser.Sound.WebAudioSound#source - * @type {AudioBufferSourceNode} - * @default null - * @since 3.0.0 - */ - this.source = null; - /** - * A reference to a second audio source used for gapless looped playback. - * - * @name Phaser.Sound.WebAudioSound#loopSource - * @type {AudioBufferSourceNode} - * @default null - * @since 3.0.0 - */ - this.loopSource = null; +/***/ }), - /** - * Gain node responsible for controlling this sound's muting. - * - * @name Phaser.Sound.WebAudioSound#muteNode - * @type {GainNode} - * @since 3.0.0 - */ - this.muteNode = manager.context.createGain(); +/***/ 66658: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Rectangle = __webpack_require__(74118); + +Rectangle.Area = __webpack_require__(1653); +Rectangle.Ceil = __webpack_require__(33943); +Rectangle.CeilAll = __webpack_require__(58662); +Rectangle.CenterOn = __webpack_require__(79993); +Rectangle.Clone = __webpack_require__(81572); +Rectangle.Contains = __webpack_require__(94287); +Rectangle.ContainsPoint = __webpack_require__(28687); +Rectangle.ContainsRect = __webpack_require__(73222); +Rectangle.CopyFrom = __webpack_require__(29538); +Rectangle.Decompose = __webpack_require__(87279); +Rectangle.Equals = __webpack_require__(19989); +Rectangle.FitInside = __webpack_require__(92628); +Rectangle.FitOutside = __webpack_require__(85028); +Rectangle.Floor = __webpack_require__(71356); +Rectangle.FloorAll = __webpack_require__(21687); +Rectangle.FromPoints = __webpack_require__(80222); +Rectangle.FromXY = __webpack_require__(75785); +Rectangle.GetAspectRatio = __webpack_require__(6700); +Rectangle.GetCenter = __webpack_require__(35242); +Rectangle.GetPoint = __webpack_require__(47698); +Rectangle.GetPoints = __webpack_require__(54932); +Rectangle.GetSize = __webpack_require__(31591); +Rectangle.Inflate = __webpack_require__(7782); +Rectangle.Intersection = __webpack_require__(66217); +Rectangle.MarchingAnts = __webpack_require__(40053); +Rectangle.MergePoints = __webpack_require__(86673); +Rectangle.MergeRect = __webpack_require__(14655); +Rectangle.MergeXY = __webpack_require__(44755); +Rectangle.Offset = __webpack_require__(74466); +Rectangle.OffsetPoint = __webpack_require__(55946); +Rectangle.Overlaps = __webpack_require__(97474); +Rectangle.Perimeter = __webpack_require__(85876); +Rectangle.PerimeterPoint = __webpack_require__(20243); +Rectangle.Random = __webpack_require__(30001); +Rectangle.RandomOutside = __webpack_require__(97691); +Rectangle.SameDimensions = __webpack_require__(51828); +Rectangle.Scale = __webpack_require__(5691); +Rectangle.Union = __webpack_require__(58795); - /** - * Gain node responsible for controlling this sound's volume. - * - * @name Phaser.Sound.WebAudioSound#volumeNode - * @type {GainNode} - * @since 3.0.0 - */ - this.volumeNode = manager.context.createGain(); +module.exports = Rectangle; - /** - * Panner node responsible for controlling this sound's pan. - * - * Doesn't work on iOS / Safari. - * - * @name Phaser.Sound.WebAudioSound#pannerNode - * @type {StereoPannerNode} - * @since 3.50.0 - */ - this.pannerNode = null; - /** - * The time at which the sound should have started playback from the beginning. - * Based on BaseAudioContext.currentTime value. - * - * @name Phaser.Sound.WebAudioSound#playTime - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this.playTime = 0; +/***/ }), - /** - * The time at which the sound source should have actually started playback. - * Based on BaseAudioContext.currentTime value. - * - * @name Phaser.Sound.WebAudioSound#startTime - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this.startTime = 0; +/***/ 19108: +/***/ ((module) => { - /** - * The time at which the sound loop source should actually start playback. - * Based on BaseAudioContext.currentTime value. - * - * @name Phaser.Sound.WebAudioSound#loopTime - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this.loopTime = 0; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * An array where we keep track of all rate updates during playback. - * Array of object types: { time: number, rate: number } - * - * @name Phaser.Sound.WebAudioSound#rateUpdates - * @type {array} - * @private - * @default [] - * @since 3.0.0 - */ - this.rateUpdates = []; +// The 2D area of a triangle. The area value is always non-negative. - /** - * Used for keeping track when sound source playback has ended - * so its state can be updated accordingly. - * - * @name Phaser.Sound.WebAudioSound#hasEnded - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.hasEnded = false; +/** + * Returns the area of a Triangle. + * + * @function Phaser.Geom.Triangle.Area + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to use. + * + * @return {number} The area of the Triangle, always non-negative. + */ +var Area = function (triangle) +{ + var x1 = triangle.x1; + var y1 = triangle.y1; - /** - * Used for keeping track when sound source has looped - * so its state can be updated accordingly. - * - * @name Phaser.Sound.WebAudioSound#hasLooped - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.hasLooped = false; + var x2 = triangle.x2; + var y2 = triangle.y2; - this.muteNode.connect(this.volumeNode); + var x3 = triangle.x3; + var y3 = triangle.y3; - if (manager.context.createStereoPanner) - { - this.pannerNode = manager.context.createStereoPanner(); + return Math.abs(((x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1)) / 2); +}; - this.volumeNode.connect(this.pannerNode); +module.exports = Area; - this.pannerNode.connect(manager.destination); - } - else - { - this.volumeNode.connect(manager.destination); - } - this.duration = this.audioBuffer.duration; +/***/ }), - this.totalDuration = this.audioBuffer.duration; +/***/ 41199: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - BaseSound.call(this, manager, key, config); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Play this sound, or a marked section of it. - * - * It always plays the sound from the start. If you want to start playback from a specific time - * you can set 'seek' setting of the config object, provided to this call, to that value. - * - * @method Phaser.Sound.WebAudioSound#play - * @fires Phaser.Sound.Events#PLAY - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Sound.SoundConfig)} [markerName=''] - If you want to play a marker then provide the marker name here. Alternatively, this parameter can be a SoundConfig object. - * @param {Phaser.Types.Sound.SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound. - * - * @return {boolean} Whether the sound started playing successfully. - */ - play: function (markerName, config) - { - if (!BaseSound.prototype.play.call(this, markerName, config)) - { - return false; - } +var Triangle = __webpack_require__(66349); - // \/\/\/ isPlaying = true, isPaused = false \/\/\/ - this.stopAndRemoveBufferSource(); - this.createAndStartBufferSource(); +/** + * Builds an equilateral triangle. In the equilateral triangle, all the sides are the same length (congruent) and all the angles are the same size (congruent). + * The x/y specifies the top-middle of the triangle (x1/y1) and length is the length of each side. + * + * @function Phaser.Geom.Triangle.BuildEquilateral + * @since 3.0.0 + * + * @param {number} x - x coordinate of the top point of the triangle. + * @param {number} y - y coordinate of the top point of the triangle. + * @param {number} length - Length of each side of the triangle. + * + * @return {Phaser.Geom.Triangle} The Triangle object of the given size. + */ +var BuildEquilateral = function (x, y, length) +{ + var height = length * (Math.sqrt(3) / 2); - this.emit(Events.PLAY, this); + var x1 = x; + var y1 = y; - return true; - }, + var x2 = x + (length / 2); + var y2 = y + height; - /** - * Pauses the sound. - * - * @method Phaser.Sound.WebAudioSound#pause - * @fires Phaser.Sound.Events#PAUSE - * @since 3.0.0 - * - * @return {boolean} Whether the sound was paused successfully. - */ - pause: function () - { - if (this.manager.context.currentTime < this.startTime) - { - return false; - } + var x3 = x - (length / 2); + var y3 = y + height; - if (!BaseSound.prototype.pause.call(this)) - { - return false; - } + return new Triangle(x1, y1, x2, y2, x3, y3); +}; - // \/\/\/ isPlaying = false, isPaused = true \/\/\/ - this.currentConfig.seek = this.getCurrentTime(); // Equivalent to setting paused time - this.stopAndRemoveBufferSource(); +module.exports = BuildEquilateral; - this.emit(Events.PAUSE, this); - return true; - }, +/***/ }), - /** - * Resumes the sound. - * - * @method Phaser.Sound.WebAudioSound#resume - * @fires Phaser.Sound.Events#RESUME - * @since 3.0.0 - * - * @return {boolean} Whether the sound was resumed successfully. - */ - resume: function () - { - if (this.manager.context.currentTime < this.startTime) - { - return false; - } +/***/ 88730: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (!BaseSound.prototype.resume.call(this)) - { - return false; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // \/\/\/ isPlaying = true, isPaused = false \/\/\/ - this.createAndStartBufferSource(); +var EarCut = __webpack_require__(11117); +var Triangle = __webpack_require__(66349); - this.emit(Events.RESUME, this); +/** + * Takes an array of vertex coordinates, and optionally an array of hole indices, then returns an array + * of Triangle instances, where the given vertices have been decomposed into a series of triangles. + * + * @function Phaser.Geom.Triangle.BuildFromPolygon + * @since 3.0.0 + * + * @generic {Phaser.Geom.Triangle[]} O - [out,$return] + * + * @param {array} data - A flat array of vertex coordinates like [x0,y0, x1,y1, x2,y2, ...] + * @param {array} [holes=null] - An array of hole indices if any (e.g. [5, 8] for a 12-vertex input would mean one hole with vertices 5–7 and another with 8–11). + * @param {number} [scaleX=1] - Horizontal scale factor to multiply the resulting points by. + * @param {number} [scaleY=1] - Vertical scale factor to multiply the resulting points by. + * @param {(array|Phaser.Geom.Triangle[])} [out] - An array to store the resulting Triangle instances in. If not provided, a new array is created. + * + * @return {(array|Phaser.Geom.Triangle[])} An array of Triangle instances, where each triangle is based on the decomposed vertices data. + */ +var BuildFromPolygon = function (data, holes, scaleX, scaleY, out) +{ + if (holes === undefined) { holes = null; } + if (scaleX === undefined) { scaleX = 1; } + if (scaleY === undefined) { scaleY = 1; } + if (out === undefined) { out = []; } - return true; - }, + var tris = EarCut(data, holes); - /** - * Stop playing this sound. - * - * @method Phaser.Sound.WebAudioSound#stop - * @fires Phaser.Sound.Events#STOP - * @since 3.0.0 - * - * @return {boolean} Whether the sound was stopped successfully. - */ - stop: function () - { - if (!BaseSound.prototype.stop.call(this)) - { - return false; - } + var a; + var b; + var c; - // \/\/\/ isPlaying = false, isPaused = false \/\/\/ - this.stopAndRemoveBufferSource(); + var x1; + var y1; - this.emit(Events.STOP, this); + var x2; + var y2; - return true; - }, + var x3; + var y3; - /** - * Used internally. - * - * @method Phaser.Sound.WebAudioSound#createAndStartBufferSource - * @private - * @since 3.0.0 - */ - createAndStartBufferSource: function () + for (var i = 0; i < tris.length; i += 3) { - var seek = this.currentConfig.seek; - var delay = this.currentConfig.delay; - var when = this.manager.context.currentTime + delay; - var offset = (this.currentMarker ? this.currentMarker.start : 0) + seek; - var duration = this.duration - seek; + a = tris[i]; + b = tris[i + 1]; + c = tris[i + 2]; - this.playTime = when - seek; - this.startTime = when; - this.source = this.createBufferSource(); + x1 = data[a * 2] * scaleX; + y1 = data[(a * 2) + 1] * scaleY; - this.applyConfig(); + x2 = data[b * 2] * scaleX; + y2 = data[(b * 2) + 1] * scaleY; - this.source.start(Math.max(0, when), Math.max(0, offset), Math.max(0, duration)); + x3 = data[c * 2] * scaleX; + y3 = data[(c * 2) + 1] * scaleY; - this.resetConfig(); - }, + out.push(new Triangle(x1, y1, x2, y2, x3, y3)); + } - /** - * Used internally. - * - * @method Phaser.Sound.WebAudioSound#createAndStartLoopBufferSource - * @private - * @since 3.0.0 - */ - createAndStartLoopBufferSource: function () - { - var when = this.getLoopTime(); - var offset = this.currentMarker ? this.currentMarker.start : 0; - var duration = this.duration; + return out; +}; - this.loopTime = when; - this.loopSource = this.createBufferSource(); - this.loopSource.playbackRate.setValueAtTime(this.totalRate, 0); - this.loopSource.start(Math.max(0, when), Math.max(0, offset), Math.max(0, duration)); - }, +module.exports = BuildFromPolygon; - /** - * Used internally. - * - * @method Phaser.Sound.WebAudioSound#createBufferSource - * @private - * @since 3.0.0 - * - * @return {AudioBufferSourceNode} - */ - createBufferSource: function () - { - var _this = this; - var source = this.manager.context.createBufferSource(); - source.buffer = this.audioBuffer; +/***/ }), - source.connect(this.muteNode); +/***/ 3635: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - source.onended = function (ev) - { - if (ev.target === _this.source) - { - // sound ended - if (_this.currentConfig.loop) - { - _this.hasLooped = true; - } - else - { - _this.hasEnded = true; - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // else was stopped - }; +var Triangle = __webpack_require__(66349); - return source; - }, +// Builds a right triangle, with one 90 degree angle and two acute angles +// The x/y is the coordinate of the 90 degree angle (and will map to x1/y1 in the resulting Triangle) +// w/h can be positive or negative and represent the length of each side - /** - * Used internally. - * - * @method Phaser.Sound.WebAudioSound#stopAndRemoveBufferSource - * @private - * @since 3.0.0 - */ - stopAndRemoveBufferSource: function () - { - if (this.source) - { - this.source.stop(); - this.source.disconnect(); - this.source = null; - } +/** + * Builds a right triangle, i.e. one which has a 90-degree angle and two acute angles. + * + * @function Phaser.Geom.Triangle.BuildRight + * @since 3.0.0 + * + * @param {number} x - The X coordinate of the right angle, which will also be the first X coordinate of the constructed Triangle. + * @param {number} y - The Y coordinate of the right angle, which will also be the first Y coordinate of the constructed Triangle. + * @param {number} width - The length of the side which is to the left or to the right of the right angle. + * @param {number} height - The length of the side which is above or below the right angle. + * + * @return {Phaser.Geom.Triangle} The constructed right Triangle. + */ +var BuildRight = function (x, y, width, height) +{ + if (height === undefined) { height = width; } - this.playTime = 0; - this.startTime = 0; + // 90 degree angle + var x1 = x; + var y1 = y; - this.stopAndRemoveLoopBufferSource(); - }, + var x2 = x; + var y2 = y - height; - /** - * Used internally. - * - * @method Phaser.Sound.WebAudioSound#stopAndRemoveLoopBufferSource - * @private - * @since 3.0.0 - */ - stopAndRemoveLoopBufferSource: function () - { - if (this.loopSource) - { - this.loopSource.stop(); - this.loopSource.disconnect(); - this.loopSource = null; - } + var x3 = x + width; + var y3 = y; - this.loopTime = 0; - }, + return new Triangle(x1, y1, x2, y2, x3, y3); +}; - /** - * Method used internally for applying config values to some of the sound properties. - * - * @method Phaser.Sound.WebAudioSound#applyConfig - * @protected - * @since 3.0.0 - */ - applyConfig: function () - { - this.rateUpdates.length = 0; +module.exports = BuildRight; - this.rateUpdates.push({ - time: 0, - rate: 1 - }); - BaseSound.prototype.applyConfig.call(this); - }, +/***/ }), - /** - * Update method called automatically by sound manager on every game step. - * - * @method Phaser.Sound.WebAudioSound#update - * @fires Phaser.Sound.Events#COMPLETE - * @fires Phaser.Sound.Events#LOOPED - * @protected - * @since 3.0.0 - */ - update: function () - { - if (this.hasEnded) - { - this.hasEnded = false; +/***/ 1882: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - BaseSound.prototype.stop.call(this); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.stopAndRemoveBufferSource(); +var Centroid = __webpack_require__(56595); +var Offset = __webpack_require__(9640); - this.emit(Events.COMPLETE, this); - } - else if (this.hasLooped) - { - this.hasLooped = false; - this.source = this.loopSource; - this.loopSource = null; - this.playTime = this.startTime = this.loopTime; - this.rateUpdates.length = 0; +/** + * @callback CenterFunction + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to return the center coordinates of. + * + * @return {Phaser.Math.Vector2} The center point of the Triangle according to the function. + */ - this.rateUpdates.push({ - time: 0, - rate: this.totalRate - }); +/** + * Positions the Triangle so that it is centered on the given coordinates. + * + * @function Phaser.Geom.Triangle.CenterOn + * @since 3.0.0 + * + * @generic {Phaser.Geom.Triangle} O - [triangle,$return] + * + * @param {Phaser.Geom.Triangle} triangle - The triangle to be positioned. + * @param {number} x - The horizontal coordinate to center on. + * @param {number} y - The vertical coordinate to center on. + * @param {CenterFunction} [centerFunc] - The function used to center the triangle. Defaults to Centroid centering. + * + * @return {Phaser.Geom.Triangle} The Triangle that was centered. + */ +var CenterOn = function (triangle, x, y, centerFunc) +{ + if (centerFunc === undefined) { centerFunc = Centroid; } - this.createAndStartLoopBufferSource(); + // Get the center of the triangle + var center = centerFunc(triangle); - this.emit(Events.LOOPED, this); - } - }, + // Difference + var diffX = x - center.x; + var diffY = y - center.y; - /** - * Calls Phaser.Sound.BaseSound#destroy method - * and cleans up all Web Audio API related stuff. - * - * @method Phaser.Sound.WebAudioSound#destroy - * @since 3.0.0 - */ - destroy: function () - { - BaseSound.prototype.destroy.call(this); + return Offset(triangle, diffX, diffY); +}; - this.audioBuffer = null; - this.stopAndRemoveBufferSource(); - this.muteNode.disconnect(); - this.muteNode = null; - this.volumeNode.disconnect(); - this.volumeNode = null; +module.exports = CenterOn; - if (this.pannerNode) - { - this.pannerNode.disconnect(); - this.pannerNode = null; - } - this.rateUpdates.length = 0; - this.rateUpdates = null; - }, +/***/ }), - /** - * Method used internally to calculate total playback rate of the sound. - * - * @method Phaser.Sound.WebAudioSound#calculateRate - * @protected - * @since 3.0.0 - */ - calculateRate: function () - { - BaseSound.prototype.calculateRate.call(this); +/***/ 56595: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var now = this.manager.context.currentTime; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (this.source && typeof this.totalRate === 'number') - { - this.source.playbackRate.setValueAtTime(this.totalRate, now); - } +var Point = __webpack_require__(79967); - if (this.isPlaying) - { - this.rateUpdates.push({ - time: Math.max(this.startTime, now) - this.playTime, - rate: this.totalRate - }); +// The three medians (the lines drawn from the vertices to the bisectors of the opposite sides) +// meet in the centroid or center of mass (center of gravity). +// The centroid divides each median in a ratio of 2:1 - if (this.loopSource) - { - this.stopAndRemoveLoopBufferSource(); - this.createAndStartLoopBufferSource(); - } - } - }, +/** + * Calculates the position of a Triangle's centroid, which is also its center of mass (center of gravity). + * + * The centroid is the point in a Triangle at which its three medians (the lines drawn from the vertices to the bisectors of the opposite sides) meet. It divides each one in a 2:1 ratio. + * + * @function Phaser.Geom.Triangle.Centroid + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to use. + * @param {(Phaser.Geom.Point|object)} [out] - An object to store the coordinates in. + * + * @return {(Phaser.Geom.Point|object)} The `out` object with modified `x` and `y` properties, or a new Point if none was provided. + */ +var Centroid = function (triangle, out) +{ + if (out === undefined) { out = new Point(); } - /** - * Method used internally for calculating current playback time of a playing sound. - * - * @method Phaser.Sound.WebAudioSound#getCurrentTime - * @private - * @since 3.0.0 - */ - getCurrentTime: function () - { - var currentTime = 0; + out.x = (triangle.x1 + triangle.x2 + triangle.x3) / 3; + out.y = (triangle.y1 + triangle.y2 + triangle.y3) / 3; - for (var i = 0; i < this.rateUpdates.length; i++) - { - var nextTime = 0; + return out; +}; - if (i < this.rateUpdates.length - 1) - { - nextTime = this.rateUpdates[i + 1].time; - } - else - { - nextTime = this.manager.context.currentTime - this.playTime; - } +module.exports = Centroid; - currentTime += (nextTime - this.rateUpdates[i].time) * this.rateUpdates[i].rate; - } - return currentTime; - }, +/***/ }), - /** - * Method used internally for calculating the time - * at witch the loop source should start playing. - * - * @method Phaser.Sound.WebAudioSound#getLoopTime - * @private - * @since 3.0.0 - */ - getLoopTime: function () - { - var lastRateUpdateCurrentTime = 0; +/***/ 91835: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - for (var i = 0; i < this.rateUpdates.length - 1; i++) - { - lastRateUpdateCurrentTime += (this.rateUpdates[i + 1].time - this.rateUpdates[i].time) * this.rateUpdates[i].rate; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var lastRateUpdate = this.rateUpdates[this.rateUpdates.length - 1]; +var Vector2 = __webpack_require__(93736); - return this.playTime + lastRateUpdate.time + (this.duration - lastRateUpdateCurrentTime) / lastRateUpdate.rate; - }, +// Adapted from http://bjornharrtell.github.io/jsts/doc/api/jsts_geom_Triangle.js.html - /** - * Rate at which this Sound will be played. - * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed - * and 2.0 doubles the audios playback speed. - * - * @name Phaser.Sound.WebAudioSound#rate - * @type {number} - * @default 1 - * @fires Phaser.Sound.Events#RATE - * @since 3.0.0 - */ - rate: { +/** + * Computes the determinant of a 2x2 matrix. Uses standard double-precision arithmetic, so is susceptible to round-off error. + * + * @function det + * @private + * @since 3.0.0 + * + * @param {number} m00 - The [0,0] entry of the matrix. + * @param {number} m01 - The [0,1] entry of the matrix. + * @param {number} m10 - The [1,0] entry of the matrix. + * @param {number} m11 - The [1,1] entry of the matrix. + * + * @return {number} the determinant. + */ +function det (m00, m01, m10, m11) +{ + return (m00 * m11) - (m01 * m10); +} - get: function () - { - return this.currentConfig.rate; - }, +/** + * Computes the circumcentre of a triangle. The circumcentre is the centre of + * the circumcircle, the smallest circle which encloses the triangle. It is also + * the common intersection point of the perpendicular bisectors of the sides of + * the triangle, and is the only point which has equal distance to all three + * vertices of the triangle. + * + * @function Phaser.Geom.Triangle.CircumCenter + * @since 3.0.0 + * + * @generic {Phaser.Math.Vector2} O - [out,$return] + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the circumcenter of. + * @param {Phaser.Math.Vector2} [out] - The Vector2 object to store the position in. If not given, a new Vector2 instance is created. + * + * @return {Phaser.Math.Vector2} A Vector2 object holding the coordinates of the circumcenter of the Triangle. + */ +var CircumCenter = function (triangle, out) +{ + if (out === undefined) { out = new Vector2(); } - set: function (value) - { - this.currentConfig.rate = value; + var cx = triangle.x3; + var cy = triangle.y3; - this.calculateRate(); + var ax = triangle.x1 - cx; + var ay = triangle.y1 - cy; - this.emit(Events.RATE, this, value); - } + var bx = triangle.x2 - cx; + var by = triangle.y2 - cy; - }, + var denom = 2 * det(ax, ay, bx, by); + var numx = det(ay, ax * ax + ay * ay, by, bx * bx + by * by); + var numy = det(ax, ax * ax + ay * ay, bx, bx * bx + by * by); - /** - * Sets the playback rate of this Sound. - * - * For example, a value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed - * and 2.0 doubles the audios playback speed. - * - * @method Phaser.Sound.WebAudioSound#setRate - * @fires Phaser.Sound.Events#RATE - * @since 3.3.0 - * - * @param {number} value - The playback rate at of this Sound. - * - * @return {this} This Sound instance. - */ - setRate: function (value) - { - this.rate = value; + out.x = cx - numx / denom; + out.y = cy + numy / denom; - return this; - }, + return out; +}; - /** - * The detune value of this Sound, given in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). - * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). - * - * @name Phaser.Sound.WebAudioSound#detune - * @type {number} - * @default 0 - * @fires Phaser.Sound.Events#DETUNE - * @since 3.0.0 - */ - detune: { +module.exports = CircumCenter; - get: function () - { - return this.currentConfig.detune; - }, - set: function (value) - { - this.currentConfig.detune = value; +/***/ }), - this.calculateRate(); +/***/ 97073: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.emit(Events.DETUNE, this, value); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - }, +var Circle = __webpack_require__(26673); - /** - * Sets the detune value of this Sound, given in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). - * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). - * - * @method Phaser.Sound.WebAudioSound#setDetune - * @fires Phaser.Sound.Events#DETUNE - * @since 3.3.0 - * - * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). - * - * @return {this} This Sound instance. - */ - setDetune: function (value) - { - this.detune = value; +// Adapted from https://gist.github.com/mutoo/5617691 - return this; - }, +/** + * Finds the circumscribed circle (circumcircle) of a Triangle object. The circumcircle is the circle which touches all of the triangle's vertices. + * + * @function Phaser.Geom.Triangle.CircumCircle + * @since 3.0.0 + * + * @generic {Phaser.Geom.Circle} O - [out,$return] + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to use as input. + * @param {Phaser.Geom.Circle} [out] - An optional Circle to store the result in. + * + * @return {Phaser.Geom.Circle} The updated `out` Circle, or a new Circle if none was provided. + */ +var CircumCircle = function (triangle, out) +{ + if (out === undefined) { out = new Circle(); } - /** - * Boolean indicating whether the sound is muted or not. - * Gets or sets the muted state of this sound. - * - * @name Phaser.Sound.WebAudioSound#mute - * @type {boolean} - * @default false - * @fires Phaser.Sound.Events#MUTE - * @since 3.0.0 - */ - mute: { + // A + var x1 = triangle.x1; + var y1 = triangle.y1; - get: function () - { - return (this.muteNode.gain.value === 0); - }, + // B + var x2 = triangle.x2; + var y2 = triangle.y2; - set: function (value) - { - this.currentConfig.mute = value; - this.muteNode.gain.setValueAtTime(value ? 0 : 1, 0); + // C + var x3 = triangle.x3; + var y3 = triangle.y3; - this.emit(Events.MUTE, this, value); - } + var A = x2 - x1; + var B = y2 - y1; + var C = x3 - x1; + var D = y3 - y1; + var E = A * (x1 + x2) + B * (y1 + y2); + var F = C * (x1 + x3) + D * (y1 + y3); + var G = 2 * (A * (y3 - y2) - B * (x3 - x2)); - }, + var dx; + var dy; - /** - * Sets the muted state of this Sound. - * - * @method Phaser.Sound.WebAudioSound#setMute - * @fires Phaser.Sound.Events#MUTE - * @since 3.4.0 - * - * @param {boolean} value - `true` to mute this sound, `false` to unmute it. - * - * @return {this} This Sound instance. - */ - setMute: function (value) + // If the points of the triangle are collinear, then just find the + // extremes and use the midpoint as the center of the circumcircle. + + if (Math.abs(G) < 0.000001) { - this.mute = value; + var minX = Math.min(x1, x2, x3); + var minY = Math.min(y1, y2, y3); + dx = (Math.max(x1, x2, x3) - minX) * 0.5; + dy = (Math.max(y1, y2, y3) - minY) * 0.5; - return this; - }, + out.x = minX + dx; + out.y = minY + dy; + out.radius = Math.sqrt(dx * dx + dy * dy); + } + else + { + out.x = (D * E - B * F) / G; + out.y = (A * F - C * E) / G; + dx = out.x - x1; + dy = out.y - y1; + out.radius = Math.sqrt(dx * dx + dy * dy); + } - /** - * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). - * - * @name Phaser.Sound.WebAudioSound#volume - * @type {number} - * @default 1 - * @fires Phaser.Sound.Events#VOLUME - * @since 3.0.0 - */ - volume: { + return out; +}; - get: function () - { - return this.volumeNode.gain.value; - }, +module.exports = CircumCircle; - set: function (value) - { - this.currentConfig.volume = value; - this.volumeNode.gain.setValueAtTime(value, 0); - this.emit(Events.VOLUME, this, value); - } - }, +/***/ }), - /** - * Sets the volume of this Sound. - * - * @method Phaser.Sound.WebAudioSound#setVolume - * @fires Phaser.Sound.Events#VOLUME - * @since 3.4.0 - * - * @param {number} value - The volume of the sound. - * - * @return {this} This Sound instance. - */ - setVolume: function (value) - { - this.volume = value; +/***/ 75974: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Property representing the position of playback for this sound, in seconds. - * Setting it to a specific value moves current playback to that position. - * The value given is clamped to the range 0 to current marker duration. - * Setting seek of a stopped sound has no effect. - * - * @name Phaser.Sound.WebAudioSound#seek - * @type {number} - * @fires Phaser.Sound.Events#SEEK - * @since 3.0.0 - */ - seek: { +var Triangle = __webpack_require__(66349); - get: function () - { - if (this.isPlaying) - { - if (this.manager.context.currentTime < this.startTime) - { - return this.startTime - this.playTime; - } +/** + * Clones a Triangle object. + * + * @function Phaser.Geom.Triangle.Clone + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} source - The Triangle to clone. + * + * @return {Phaser.Geom.Triangle} A new Triangle identical to the given one but separate from it. + */ +var Clone = function (source) +{ + return new Triangle(source.x1, source.y1, source.x2, source.y2, source.x3, source.y3); +}; - return this.getCurrentTime(); - } - else if (this.isPaused) - { - return this.currentConfig.seek; - } - else - { - return 0; - } - }, +module.exports = Clone; - set: function (value) - { - if (this.manager.context.currentTime < this.startTime) - { - return; - } - if (this.isPlaying || this.isPaused) - { - value = Math.min(Math.max(0, value), this.duration); +/***/ }), - this.currentConfig.seek = value; +/***/ 60689: +/***/ ((module) => { - if (this.isPlaying) - { - this.stopAndRemoveBufferSource(); - this.createAndStartBufferSource(); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.emit(Events.SEEK, this, value); - } - } - }, +// http://www.blackpawn.com/texts/pointinpoly/ - /** - * Seeks to a specific point in this sound. - * - * @method Phaser.Sound.WebAudioSound#setSeek - * @fires Phaser.Sound.Events#SEEK - * @since 3.4.0 - * - * @param {number} value - The point in the sound to seek to. - * - * @return {this} This Sound instance. - */ - setSeek: function (value) - { - this.seek = value; +/** + * Checks if a point (as a pair of coordinates) is inside a Triangle's bounds. + * + * @function Phaser.Geom.Triangle.Contains + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to check. + * @param {number} x - The X coordinate of the point to check. + * @param {number} y - The Y coordinate of the point to check. + * + * @return {boolean} `true` if the point is inside the Triangle, otherwise `false`. + */ +var Contains = function (triangle, x, y) +{ + var v0x = triangle.x3 - triangle.x1; + var v0y = triangle.y3 - triangle.y1; - return this; - }, + var v1x = triangle.x2 - triangle.x1; + var v1y = triangle.y2 - triangle.y1; - /** - * Flag indicating whether or not the sound or current sound marker will loop. - * - * @name Phaser.Sound.WebAudioSound#loop - * @type {boolean} - * @default false - * @fires Phaser.Sound.Events#LOOP - * @since 3.0.0 - */ - loop: { + var v2x = x - triangle.x1; + var v2y = y - triangle.y1; - get: function () - { - return this.currentConfig.loop; - }, + var dot00 = (v0x * v0x) + (v0y * v0y); + var dot01 = (v0x * v1x) + (v0y * v1y); + var dot02 = (v0x * v2x) + (v0y * v2y); + var dot11 = (v1x * v1x) + (v1y * v1y); + var dot12 = (v1x * v2x) + (v1y * v2y); - set: function (value) - { - this.currentConfig.loop = value; + // Compute barycentric coordinates + var b = ((dot00 * dot11) - (dot01 * dot01)); + var inv = (b === 0) ? 0 : (1 / b); + var u = ((dot11 * dot02) - (dot01 * dot12)) * inv; + var v = ((dot00 * dot12) - (dot01 * dot02)) * inv; - if (this.isPlaying) - { - this.stopAndRemoveLoopBufferSource(); + return (u >= 0 && v >= 0 && (u + v < 1)); +}; - if (value) - { - this.createAndStartLoopBufferSource(); - } - } +module.exports = Contains; - this.emit(Events.LOOP, this, value); - } - }, - /** - * Sets the loop state of this Sound. - * - * @method Phaser.Sound.WebAudioSound#setLoop - * @fires Phaser.Sound.Events#LOOP - * @since 3.4.0 - * - * @param {boolean} value - `true` to loop this sound, `false` to not loop it. - * - * @return {this} This Sound instance. - */ - setLoop: function (value) - { - this.loop = value; +/***/ }), - return this; - }, +/***/ 86875: +/***/ ((module) => { - /** - * Gets or sets the pan of this sound, a value between -1 (full left pan) and 1 (full right pan). - * - * Always returns zero on iOS / Safari as it doesn't support the stereo panner node. - * - * @name Phaser.Sound.WebAudioSound#pan - * @type {number} - * @default 0 - * @fires Phaser.Sound.Events#PAN - * @since 3.50.0 - */ - pan: { +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - get: function () - { - if (this.pannerNode) - { - return this.pannerNode.pan.value; - } - else - { - return 0; - } - }, +// http://www.blackpawn.com/texts/pointinpoly/ - set: function (value) - { - this.currentConfig.pan = value; +// points is an array of Point-like objects with public x/y properties +// returns an array containing all points that are within the triangle, or an empty array if none +// if 'returnFirst' is true it will return after the first point within the triangle is found - if (this.pannerNode) - { - this.pannerNode.pan.setValueAtTime(value, this.manager.context.currentTime); - } +/** + * Filters an array of point-like objects to only those contained within a triangle. + * If `returnFirst` is true, will return an array containing only the first point in the provided array that is within the triangle (or an empty array if there are no such points). + * + * @function Phaser.Geom.Triangle.ContainsArray + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - The triangle that the points are being checked in. + * @param {Phaser.Geom.Point[]} points - An array of point-like objects (objects that have an `x` and `y` property) + * @param {boolean} [returnFirst=false] - If `true`, return an array containing only the first point found that is within the triangle. + * @param {array} [out] - If provided, the points that are within the triangle will be appended to this array instead of being added to a new array. If `returnFirst` is true, only the first point found within the triangle will be appended. This array will also be returned by this function. + * + * @return {Phaser.Geom.Point[]} An array containing all the points from `points` that are within the triangle, if an array was provided as `out`, points will be appended to that array and it will also be returned here. + */ +var ContainsArray = function (triangle, points, returnFirst, out) +{ + if (returnFirst === undefined) { returnFirst = false; } + if (out === undefined) { out = []; } - this.emit(Events.PAN, this, value); - } - }, + var v0x = triangle.x3 - triangle.x1; + var v0y = triangle.y3 - triangle.y1; - /** - * Sets the pan of this sound, a value between -1 (full left pan) and 1 (full right pan). - * - * Note: iOS / Safari doesn't support the stereo panner node. - * - * @method Phaser.Sound.WebAudioSound#setPan - * @fires Phaser.Sound.Events#PAN - * @since 3.50.0 - * - * @param {number} value - The pan of the sound. A value between -1 (full left pan) and 1 (full right pan). - * - * @return {this} This Sound instance. - */ - setPan: function (value) + var v1x = triangle.x2 - triangle.x1; + var v1y = triangle.y2 - triangle.y1; + + var dot00 = (v0x * v0x) + (v0y * v0y); + var dot01 = (v0x * v1x) + (v0y * v1y); + var dot11 = (v1x * v1x) + (v1y * v1y); + + // Compute barycentric coordinates + var b = ((dot00 * dot11) - (dot01 * dot01)); + var inv = (b === 0) ? 0 : (1 / b); + + var u; + var v; + var v2x; + var v2y; + var dot02; + var dot12; + + var x1 = triangle.x1; + var y1 = triangle.y1; + + for (var i = 0; i < points.length; i++) { - this.pan = value; + v2x = points[i].x - x1; + v2y = points[i].y - y1; - return this; + dot02 = (v0x * v2x) + (v0y * v2y); + dot12 = (v1x * v2x) + (v1y * v2y); + + u = ((dot11 * dot02) - (dot01 * dot12)) * inv; + v = ((dot00 * dot12) - (dot01 * dot02)) * inv; + + if (u >= 0 && v >= 0 && (u + v < 1)) + { + out.push({ x: points[i].x, y: points[i].y }); + + if (returnFirst) + { + break; + } + } } -}); + return out; +}; -module.exports = WebAudioSound; +module.exports = ContainsArray; /***/ }), -/* 435 */ -/***/ (function(module, exports) { + +/***/ 51532: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Contains = __webpack_require__(60689); + /** - * Transposes the elements of the given matrix (array of arrays). + * Tests if a triangle contains a point. * - * The transpose of a matrix is a new matrix whose rows are the columns of the original. + * @function Phaser.Geom.Triangle.ContainsPoint + * @since 3.0.0 * - * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) - * have the same length. There must be at least two rows. This is an example matrix: + * @param {Phaser.Geom.Triangle} triangle - The triangle. + * @param {(Phaser.Geom.Point|Phaser.Math.Vector2|any)} point - The point to test, or any point-like object with public `x` and `y` properties. * - * ``` - * [ - * [ 1, 1, 1, 1, 1, 1 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 2, 0, 1, 2, 0, 4 ], - * [ 2, 0, 3, 4, 0, 4 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 3, 3, 3, 3, 3, 3 ] - * ] - * ``` + * @return {boolean} `true` if the point is within the triangle, otherwise `false`. + */ +var ContainsPoint = function (triangle, point) +{ + return Contains(triangle, point.x, point.y); +}; + +module.exports = ContainsPoint; + + +/***/ }), + +/***/ 42538: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Copy the values of one Triangle to a destination Triangle. * - * @function Phaser.Utils.Array.Matrix.TransposeMatrix + * @function Phaser.Geom.Triangle.CopyFrom * @since 3.0.0 * - * @generic T - * @genericUse {T[][]} - [array,$return] + * @generic {Phaser.Geom.Triangle} O - [dest,$return] * - * @param {T[][]} [array] - The array matrix to transpose. + * @param {Phaser.Geom.Triangle} source - The source Triangle to copy the values from. + * @param {Phaser.Geom.Triangle} dest - The destination Triangle to copy the values to. * - * @return {T[][]} A new array matrix which is a transposed version of the given array. + * @return {Phaser.Geom.Triangle} The destination Triangle. */ -var TransposeMatrix = function (array) +var CopyFrom = function (source, dest) { - var sourceRowCount = array.length; - var sourceColCount = array[0].length; + return dest.setTo(source.x1, source.y1, source.x2, source.y2, source.x3, source.y3); +}; - var result = new Array(sourceColCount); +module.exports = CopyFrom; - for (var i = 0; i < sourceColCount; i++) - { - result[i] = new Array(sourceRowCount); - for (var j = sourceRowCount - 1; j > -1; j--) - { - result[i][j] = array[j][i]; - } - } +/***/ }), - return result; +/***/ 18680: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Decomposes a Triangle into an array of its points. + * + * @function Phaser.Geom.Triangle.Decompose + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to decompose. + * @param {array} [out] - An array to store the points into. + * + * @return {array} The provided `out` array, or a new array if none was provided, with three objects with `x` and `y` properties representing each point of the Triangle appended to it. + */ +var Decompose = function (triangle, out) +{ + if (out === undefined) { out = []; } + + out.push({ x: triangle.x1, y: triangle.y1 }); + out.push({ x: triangle.x2, y: triangle.y2 }); + out.push({ x: triangle.x3, y: triangle.y3 }); + + return out; }; -module.exports = TransposeMatrix; +module.exports = Decompose; /***/ }), -/* 436 */ -/***/ (function(module, exports) { + +/***/ 29977: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @ignore + * Returns true if two triangles have the same coordinates. + * + * @function Phaser.Geom.Triangle.Equals + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - The first triangle to check. + * @param {Phaser.Geom.Triangle} toCompare - The second triangle to check. + * + * @return {boolean} `true` if the two given triangles have the exact same coordinates, otherwise `false`. */ -function swap (arr, i, j) +var Equals = function (triangle, toCompare) { - var tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} + return ( + triangle.x1 === toCompare.x1 && + triangle.y1 === toCompare.y1 && + triangle.x2 === toCompare.x2 && + triangle.y2 === toCompare.y2 && + triangle.x3 === toCompare.x3 && + triangle.y3 === toCompare.y3 + ); +}; + +module.exports = Equals; + + +/***/ }), + +/***/ 56088: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @ignore + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -function defaultCompare (a, b) -{ - return a < b ? -1 : a > b ? 1 : 0; -} + +var Point = __webpack_require__(79967); +var Length = __webpack_require__(16028); /** - * A [Floyd-Rivest](https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm) quick selection algorithm. - * - * Rearranges the array items so that all items in the [left, k] range are smaller than all items in [k, right]; - * The k-th element will have the (k - left + 1)th smallest value in [left, right]. + * Returns a Point from around the perimeter of a Triangle. * - * The array is modified in-place. + * @function Phaser.Geom.Triangle.GetPoint + * @since 3.0.0 * - * Based on code by [Vladimir Agafonkin](https://www.npmjs.com/~mourner) + * @generic {Phaser.Geom.Point} O - [out,$return] * - * @function Phaser.Utils.Array.QuickSelect - * @since 3.0.0 + * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the point on its perimeter from. + * @param {number} position - The position along the perimeter of the triangle. A value between 0 and 1. + * @param {(Phaser.Geom.Point|object)} [out] - An option Point, or Point-like object to store the value in. If not given a new Point will be created. * - * @param {array} arr - The array to sort. - * @param {number} k - The k-th element index. - * @param {number} [left=0] - The index of the left part of the range. - * @param {number} [right] - The index of the right part of the range. - * @param {function} [compare] - An optional comparison function. Is passed two elements and should return 0, 1 or -1. + * @return {(Phaser.Geom.Point|object)} A Point object containing the given position from the perimeter of the triangle. */ -var QuickSelect = function (arr, k, left, right, compare) +var GetPoint = function (triangle, position, out) { - if (left === undefined) { left = 0; } - if (right === undefined) { right = arr.length - 1; } - if (compare === undefined) { compare = defaultCompare; } - - while (right > left) - { - if (right - left > 600) - { - var n = right - left + 1; - var m = k - left + 1; - var z = Math.log(n); - var s = 0.5 * Math.exp(2 * z / 3); - var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); + if (out === undefined) { out = new Point(); } - QuickSelect(arr, k, newLeft, newRight, compare); - } + var line1 = triangle.getLineA(); + var line2 = triangle.getLineB(); + var line3 = triangle.getLineC(); - var t = arr[k]; - var i = left; - var j = right; + if (position <= 0 || position >= 1) + { + out.x = line1.x1; + out.y = line1.y1; - swap(arr, left, k); + return out; + } - if (compare(arr[right], t) > 0) - { - swap(arr, left, right); - } + var length1 = Length(line1); + var length2 = Length(line2); + var length3 = Length(line3); - while (i < j) - { - swap(arr, i, j); + var perimeter = length1 + length2 + length3; - i++; - j--; + var p = perimeter * position; + var localPosition = 0; - while (compare(arr[i], t) < 0) - { - i++; - } + // Which line is it on? - while (compare(arr[j], t) > 0) - { - j--; - } - } + if (p < length1) + { + // Line 1 + localPosition = p / length1; - if (compare(arr[left], t) === 0) - { - swap(arr, left, j); - } - else - { - j++; - swap(arr, j, right); - } + out.x = line1.x1 + (line1.x2 - line1.x1) * localPosition; + out.y = line1.y1 + (line1.y2 - line1.y1) * localPosition; + } + else if (p > length1 + length2) + { + // Line 3 + p -= length1 + length2; + localPosition = p / length3; - if (j <= k) - { - left = j + 1; - } + out.x = line3.x1 + (line3.x2 - line3.x1) * localPosition; + out.y = line3.y1 + (line3.y2 - line3.y1) * localPosition; + } + else + { + // Line 2 + p -= length1; + localPosition = p / length2; - if (k <= j) - { - right = j - 1; - } + out.x = line2.x1 + (line2.x2 - line2.x1) * localPosition; + out.y = line2.y1 + (line2.y2 - line2.y1) * localPosition; } + + return out; }; -module.exports = QuickSelect; +module.exports = GetPoint; /***/ }), -/* 437 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 24402: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetValue = __webpack_require__(6); -var Shuffle = __webpack_require__(131); - -var BuildChunk = function (a, b, qty) -{ - var out = []; - - for (var aIndex = 0; aIndex < a.length; aIndex++) - { - for (var bIndex = 0; bIndex < b.length; bIndex++) - { - for (var i = 0; i < qty; i++) - { - out.push({ a: a[aIndex], b: b[bIndex] }); - } - } - } - - return out; -}; +var Length = __webpack_require__(16028); +var Point = __webpack_require__(79967); /** - * Creates an array populated with a range of values, based on the given arguments and configuration object. - * - * Range ([a,b,c], [1,2,3]) = - * a1, a2, a3, b1, b2, b3, c1, c2, c3 - * - * Range ([a,b], [1,2,3], qty = 3) = - * a1, a1, a1, a2, a2, a2, a3, a3, a3, b1, b1, b1, b2, b2, b2, b3, b3, b3 - * - * Range ([a,b,c], [1,2,3], repeat x1) = - * a1, a2, a3, b1, b2, b3, c1, c2, c3, a1, a2, a3, b1, b2, b3, c1, c2, c3 - * - * Range ([a,b], [1,2], repeat -1 = endless, max = 14) = - * Maybe if max is set then repeat goes to -1 automatically? - * a1, a2, b1, b2, a1, a2, b1, b2, a1, a2, b1, b2, a1, a2 (capped at 14 elements) - * - * Range ([a], [1,2,3,4,5], random = true) = - * a4, a1, a5, a2, a3 - * - * Range ([a, b], [1,2,3], random = true) = - * b3, a2, a1, b1, a3, b2 - * - * Range ([a, b, c], [1,2,3], randomB = true) = - * a3, a1, a2, b2, b3, b1, c1, c3, c2 - * - * Range ([a], [1,2,3,4,5], yoyo = true) = - * a1, a2, a3, a4, a5, a5, a4, a3, a2, a1 - * - * Range ([a, b], [1,2,3], yoyo = true) = - * a1, a2, a3, b1, b2, b3, b3, b2, b1, a3, a2, a1 + * Returns an array of evenly spaced points on the perimeter of a Triangle. * - * @function Phaser.Utils.Array.Range + * @function Phaser.Geom.Triangle.GetPoints * @since 3.0.0 * - * @param {array} a - The first array of range elements. - * @param {array} b - The second array of range elements. - * @param {object} [options] - A range configuration object. Can contain: repeat, random, randomB, yoyo, max, qty. + * @generic {Phaser.Geom.Point} O - [out,$return] * - * @return {array} An array of arranged elements. + * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the points from. + * @param {number} quantity - The number of evenly spaced points to return. Set to 0 to return an arbitrary number of points based on the `stepRate`. + * @param {number} stepRate - If `quantity` is 0, the distance between each returned point. + * @param {(array|Phaser.Geom.Point[])} [out] - An array to which the points should be appended. + * + * @return {(array|Phaser.Geom.Point[])} The modified `out` array, or a new array if none was provided. */ -var Range = function (a, b, options) +var GetPoints = function (triangle, quantity, stepRate, out) { - var max = GetValue(options, 'max', 0); - var qty = GetValue(options, 'qty', 1); - var random = GetValue(options, 'random', false); - var randomB = GetValue(options, 'randomB', false); - var repeat = GetValue(options, 'repeat', 0); - var yoyo = GetValue(options, 'yoyo', false); + if (out === undefined) { out = []; } - var out = []; + var line1 = triangle.getLineA(); + var line2 = triangle.getLineB(); + var line3 = triangle.getLineC(); - if (randomB) + var length1 = Length(line1); + var length2 = Length(line2); + var length3 = Length(line3); + + var perimeter = length1 + length2 + length3; + + // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. + if (!quantity && stepRate > 0) { - Shuffle(b); + quantity = perimeter / stepRate; } - // Endless repeat, so limit by max - if (repeat === -1) + for (var i = 0; i < quantity; i++) { - if (max === 0) - { - repeat = 0; - } - else - { - // Work out how many repeats we need - var total = (a.length * b.length) * qty; - - if (yoyo) - { - total *= 2; - } + var p = perimeter * (i / quantity); + var localPosition = 0; - repeat = Math.ceil(max / total); - } - } + var point = new Point(); - for (var i = 0; i <= repeat; i++) - { - var chunk = BuildChunk(a, b, qty); + // Which line is it on? - if (random) + if (p < length1) { - Shuffle(chunk); - } + // Line 1 + localPosition = p / length1; - out = out.concat(chunk); + point.x = line1.x1 + (line1.x2 - line1.x1) * localPosition; + point.y = line1.y1 + (line1.y2 - line1.y1) * localPosition; + } + else if (p > length1 + length2) + { + // Line 3 + p -= length1 + length2; + localPosition = p / length3; - if (yoyo) + point.x = line3.x1 + (line3.x2 - line3.x1) * localPosition; + point.y = line3.y1 + (line3.y2 - line3.y1) * localPosition; + } + else { - chunk.reverse(); + // Line 2 + p -= length1; + localPosition = p / length2; - out = out.concat(chunk); + point.x = line2.x1 + (line2.x2 - line2.x1) * localPosition; + point.y = line2.y1 + (line2.y2 - line2.y1) * localPosition; } - } - if (max) - { - out.splice(max); + out.push(point); } return out; }; -module.exports = Range; +module.exports = GetPoints; /***/ }), -/* 438 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 83648: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @namespace Phaser.Structs.Events - */ - -module.exports = { - - PROCESS_QUEUE_ADD: __webpack_require__(1041), - PROCESS_QUEUE_REMOVE: __webpack_require__(1042) - -}; - +var Point = __webpack_require__(79967); -/***/ }), -/* 439 */ -/***/ (function(module, exports, __webpack_require__) { +// The three angle bisectors of a triangle meet in one point called the incenter. +// It is the center of the incircle, the circle inscribed in the triangle. -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +function getLength (x1, y1, x2, y2) +{ + var x = x1 - x2; + var y = y1 - y2; + var magnitude = (x * x) + (y * y); -var GetAdvancedValue = __webpack_require__(13); + return Math.sqrt(magnitude); +} /** - * Adds an Animation component to a Sprite and populates it based on the given config. + * Calculates the position of the incenter of a Triangle object. This is the point where its three angle bisectors meet and it's also the center of the incircle, which is the circle inscribed in the triangle. * - * @function Phaser.GameObjects.BuildGameObjectAnimation + * @function Phaser.Geom.Triangle.InCenter * @since 3.0.0 * - * @param {Phaser.GameObjects.Sprite} sprite - The sprite to add an Animation component to. - * @param {object} config - The animation config. + * @generic {Phaser.Geom.Point} O - [out,$return] * - * @return {Phaser.GameObjects.Sprite} The updated Sprite. + * @param {Phaser.Geom.Triangle} triangle - The Triangle to find the incenter of. + * @param {Phaser.Geom.Point} [out] - An optional Point in which to store the coordinates. + * + * @return {Phaser.Geom.Point} Point (x, y) of the center pixel of the triangle. */ -var BuildGameObjectAnimation = function (sprite, config) +var InCenter = function (triangle, out) { - var animConfig = GetAdvancedValue(config, 'anims', null); - - if (animConfig === null) - { - return sprite; - } - - if (typeof animConfig === 'string') - { - // { anims: 'key' } - sprite.anims.play(animConfig); - } - else if (typeof animConfig === 'object') - { - // { anims: { - // key: string - // startFrame: [string|number] - // delay: [float] - // repeat: [integer] - // repeatDelay: [float] - // yoyo: [boolean] - // play: [boolean] - // delayedPlay: [boolean] - // } - // } - - var anims = sprite.anims; + if (out === undefined) { out = new Point(); } - var key = GetAdvancedValue(animConfig, 'key', undefined); + var x1 = triangle.x1; + var y1 = triangle.y1; - if (key) - { - var startFrame = GetAdvancedValue(animConfig, 'startFrame', undefined); + var x2 = triangle.x2; + var y2 = triangle.y2; - var delay = GetAdvancedValue(animConfig, 'delay', 0); - var repeat = GetAdvancedValue(animConfig, 'repeat', 0); - var repeatDelay = GetAdvancedValue(animConfig, 'repeatDelay', 0); - var yoyo = GetAdvancedValue(animConfig, 'yoyo', false); + var x3 = triangle.x3; + var y3 = triangle.y3; - var play = GetAdvancedValue(animConfig, 'play', false); - var delayedPlay = GetAdvancedValue(animConfig, 'delayedPlay', 0); + var d1 = getLength(x3, y3, x2, y2); + var d2 = getLength(x1, y1, x3, y3); + var d3 = getLength(x2, y2, x1, y1); - var playConfig = { - key: key, - delay: delay, - repeat: repeat, - repeatDelay: repeatDelay, - yoyo: yoyo, - startFrame: startFrame - }; + var p = d1 + d2 + d3; - if (play) - { - anims.play(playConfig); - } - else if (delayedPlay > 0) - { - anims.playAfterDelay(playConfig, delayedPlay); - } - else - { - anims.load(playConfig); - } - } - } + out.x = (x1 * d1 + x2 * d2 + x3 * d3) / p; + out.y = (y1 * d1 + y2 * d2 + y3 * d3) / p; - return sprite; + return out; }; -module.exports = BuildGameObjectAnimation; +module.exports = InCenter; /***/ }), -/* 440 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 9640: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Frame = __webpack_require__(109); - /** - * @classdesc - * A Bob Game Object. + * Moves each point (vertex) of a Triangle by a given offset, thus moving the entire Triangle by that offset. * - * A Bob belongs to a Blitter Game Object. The Blitter is responsible for managing and rendering this object. + * @function Phaser.Geom.Triangle.Offset + * @since 3.0.0 * - * A Bob has a position, alpha value and a frame from a texture that it uses to render with. You can also toggle - * the flipped and visible state of the Bob. The Frame the Bob uses to render can be changed dynamically, but it - * must be a Frame within the Texture used by the parent Blitter. + * @generic {Phaser.Geom.Triangle} O - [triangle,$return] * - * Bob positions are relative to the Blitter parent. So if you move the Blitter parent, all Bob children will - * have their positions impacted by this change as well. + * @param {Phaser.Geom.Triangle} triangle - The Triangle to move. + * @param {number} x - The horizontal offset (distance) by which to move each point. Can be positive or negative. + * @param {number} y - The vertical offset (distance) by which to move each point. Can be positive or negative. * - * You can manipulate Bob objects directly from your game code, but the creation and destruction of them should be - * handled via the Blitter parent. + * @return {Phaser.Geom.Triangle} The modified Triangle. + */ +var Offset = function (triangle, x, y) +{ + triangle.x1 += x; + triangle.y1 += y; + + triangle.x2 += x; + triangle.y2 += y; + + triangle.x3 += x; + triangle.y3 += y; + + return triangle; +}; + +module.exports = Offset; + + +/***/ }), + +/***/ 95290: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Length = __webpack_require__(16028); + +/** + * Gets the length of the perimeter of the given triangle. + * Calculated by adding together the length of each of the three sides. * - * @class Bob - * @memberof Phaser.GameObjects + * @function Phaser.Geom.Triangle.Perimeter + * @since 3.0.0 + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the length from. + * + * @return {number} The length of the Triangle. + */ +var Perimeter = function (triangle) +{ + var line1 = triangle.getLineA(); + var line2 = triangle.getLineB(); + var line3 = triangle.getLineC(); + + return (Length(line1) + Length(line2) + Length(line3)); +}; + +module.exports = Perimeter; + + +/***/ }), + +/***/ 99761: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Point = __webpack_require__(79967); + +/** + * Returns a random Point from within the area of the given Triangle. + * + * @function Phaser.Geom.Triangle.Random + * @since 3.0.0 + * + * @generic {Phaser.Geom.Point} O - [out,$return] + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to get a random point from. + * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. + * + * @return {Phaser.Geom.Point} A Point object holding the coordinates of a random position within the Triangle. + */ +var Random = function (triangle, out) +{ + if (out === undefined) { out = new Point(); } + + // Basis vectors + var ux = triangle.x2 - triangle.x1; + var uy = triangle.y2 - triangle.y1; + + var vx = triangle.x3 - triangle.x1; + var vy = triangle.y3 - triangle.y1; + + // Random point within the unit square + var r = Math.random(); + var s = Math.random(); + + // Point outside the triangle? Remap it. + if (r + s >= 1) + { + r = 1 - r; + s = 1 - s; + } + + out.x = triangle.x1 + ((ux * r) + (vx * s)); + out.y = triangle.y1 + ((uy * r) + (vy * s)); + + return out; +}; + +module.exports = Random; + + +/***/ }), + +/***/ 21934: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var RotateAroundXY = __webpack_require__(19211); +var InCenter = __webpack_require__(83648); + +/** + * Rotates a Triangle about its incenter, which is the point at which its three angle bisectors meet. + * + * @function Phaser.Geom.Triangle.Rotate + * @since 3.0.0 + * + * @generic {Phaser.Geom.Triangle} O - [triangle,$return] + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. + * @param {number} angle - The angle by which to rotate the Triangle, in radians. + * + * @return {Phaser.Geom.Triangle} The rotated Triangle. + */ +var Rotate = function (triangle, angle) +{ + var point = InCenter(triangle); + + return RotateAroundXY(triangle, point.x, point.y, angle); +}; + +module.exports = Rotate; + + +/***/ }), + +/***/ 68454: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var RotateAroundXY = __webpack_require__(19211); + +/** + * Rotates a Triangle at a certain angle about a given Point or object with public `x` and `y` properties. + * + * @function Phaser.Geom.Triangle.RotateAroundPoint + * @since 3.0.0 + * + * @generic {Phaser.Geom.Triangle} O - [triangle,$return] + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. + * @param {Phaser.Geom.Point} point - The Point to rotate the Triangle about. + * @param {number} angle - The angle by which to rotate the Triangle, in radians. + * + * @return {Phaser.Geom.Triangle} The rotated Triangle. + */ +var RotateAroundPoint = function (triangle, point, angle) +{ + return RotateAroundXY(triangle, point.x, point.y, angle); +}; + +module.exports = RotateAroundPoint; + + +/***/ }), + +/***/ 19211: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Rotates an entire Triangle at a given angle about a specific point. + * + * @function Phaser.Geom.Triangle.RotateAroundXY + * @since 3.0.0 + * + * @generic {Phaser.Geom.Triangle} O - [triangle,$return] + * + * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. + * @param {number} x - The X coordinate of the point to rotate the Triangle about. + * @param {number} y - The Y coordinate of the point to rotate the Triangle about. + * @param {number} angle - The angle by which to rotate the Triangle, in radians. + * + * @return {Phaser.Geom.Triangle} The rotated Triangle. + */ +var RotateAroundXY = function (triangle, x, y, angle) +{ + var c = Math.cos(angle); + var s = Math.sin(angle); + + var tx = triangle.x1 - x; + var ty = triangle.y1 - y; + + triangle.x1 = tx * c - ty * s + x; + triangle.y1 = tx * s + ty * c + y; + + tx = triangle.x2 - x; + ty = triangle.y2 - y; + + triangle.x2 = tx * c - ty * s + x; + triangle.y2 = tx * s + ty * c + y; + + tx = triangle.x3 - x; + ty = triangle.y3 - y; + + triangle.x3 = tx * c - ty * s + x; + triangle.y3 = tx * s + ty * c + y; + + return triangle; +}; + +module.exports = RotateAroundXY; + + +/***/ }), + +/***/ 66349: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var Contains = __webpack_require__(60689); +var GetPoint = __webpack_require__(56088); +var GetPoints = __webpack_require__(24402); +var GEOM_CONST = __webpack_require__(52394); +var Line = __webpack_require__(88829); +var Random = __webpack_require__(99761); + +/** + * @classdesc + * A triangle is a plane created by connecting three points. + * The first two arguments specify the first point, the middle two arguments + * specify the second point, and the last two arguments specify the third point. + * + * @class Triangle + * @memberof Phaser.Geom * @constructor * @since 3.0.0 * - * @param {Phaser.GameObjects.Blitter} blitter - The parent Blitter object is responsible for updating this Bob. - * @param {number} x - The horizontal position of this Game Object in the world, relative to the parent Blitter position. - * @param {number} y - The vertical position of this Game Object in the world, relative to the parent Blitter position. - * @param {(string|number)} frame - The Frame this Bob will render with, as defined in the Texture the parent Blitter is using. - * @param {boolean} visible - Should the Bob render visible or not to start with? + * @param {number} [x1=0] - `x` coordinate of the first point. + * @param {number} [y1=0] - `y` coordinate of the first point. + * @param {number} [x2=0] - `x` coordinate of the second point. + * @param {number} [y2=0] - `y` coordinate of the second point. + * @param {number} [x3=0] - `x` coordinate of the third point. + * @param {number} [y3=0] - `y` coordinate of the third point. */ -var Bob = new Class({ +var Triangle = new Class({ initialize: - function Bob (blitter, x, y, frame, visible) + function Triangle (x1, y1, x2, y2, x3, y3) { - /** - * The Blitter object that this Bob belongs to. - * - * @name Phaser.GameObjects.Bob#parent - * @type {Phaser.GameObjects.Blitter} - * @since 3.0.0 - */ - this.parent = blitter; + if (x1 === undefined) { x1 = 0; } + if (y1 === undefined) { y1 = 0; } + if (x2 === undefined) { x2 = 0; } + if (y2 === undefined) { y2 = 0; } + if (x3 === undefined) { x3 = 0; } + if (y3 === undefined) { y3 = 0; } /** - * The x position of this Bob, relative to the x position of the Blitter. + * The geometry constant type of this object: `GEOM_CONST.TRIANGLE`. + * Used for fast type comparisons. * - * @name Phaser.GameObjects.Bob#x + * @name Phaser.Geom.Triangle#type * @type {number} - * @since 3.0.0 + * @readonly + * @since 3.19.0 */ - this.x = x; + this.type = GEOM_CONST.TRIANGLE; /** - * The y position of this Bob, relative to the y position of the Blitter. + * `x` coordinate of the first point. * - * @name Phaser.GameObjects.Bob#y + * @name Phaser.Geom.Triangle#x1 * @type {number} + * @default 0 * @since 3.0.0 */ - this.y = y; - - /** - * The frame that the Bob uses to render with. - * To change the frame use the `Bob.setFrame` method. - * - * @name Phaser.GameObjects.Bob#frame - * @type {Phaser.Textures.Frame} - * @protected - * @since 3.0.0 - */ - this.frame = frame; + this.x1 = x1; /** - * A blank object which can be used to store data related to this Bob in. + * `y` coordinate of the first point. * - * @name Phaser.GameObjects.Bob#data - * @type {object} - * @default {} + * @name Phaser.Geom.Triangle#y1 + * @type {number} + * @default 0 * @since 3.0.0 */ - this.data = {}; + this.y1 = y1; /** - * The tint value of this Bob. + * `x` coordinate of the second point. * - * @name Phaser.GameObjects.Bob#tint + * @name Phaser.Geom.Triangle#x2 * @type {number} - * @default 0xffffff - * @since 3.20.0 - */ - this.tint = 0xffffff; - - /** - * The visible state of this Bob. - * - * @name Phaser.GameObjects.Bob#_visible - * @type {boolean} - * @private + * @default 0 * @since 3.0.0 */ - this._visible = visible; + this.x2 = x2; /** - * The alpha value of this Bob. + * `y` coordinate of the second point. * - * @name Phaser.GameObjects.Bob#_alpha + * @name Phaser.Geom.Triangle#y2 * @type {number} - * @private - * @default 1 + * @default 0 * @since 3.0.0 */ - this._alpha = 1; + this.y2 = y2; /** - * The horizontally flipped state of the Bob. - * A Bob that is flipped horizontally will render inversed on the horizontal axis. - * Flipping always takes place from the middle of the texture. + * `x` coordinate of the third point. * - * @name Phaser.GameObjects.Bob#flipX - * @type {boolean} + * @name Phaser.Geom.Triangle#x3 + * @type {number} + * @default 0 * @since 3.0.0 */ - this.flipX = false; + this.x3 = x3; /** - * The vertically flipped state of the Bob. - * A Bob that is flipped vertically will render inversed on the vertical axis (i.e. upside down) - * Flipping always takes place from the middle of the texture. + * `y` coordinate of the third point. * - * @name Phaser.GameObjects.Bob#flipY - * @type {boolean} + * @name Phaser.Geom.Triangle#y3 + * @type {number} + * @default 0 * @since 3.0.0 */ - this.flipY = false; + this.y3 = y3; }, /** - * Changes the Texture Frame being used by this Bob. - * The frame must be part of the Texture the parent Blitter is using. - * If no value is given it will use the default frame of the Blitter parent. + * Checks whether a given points lies within the triangle. * - * @method Phaser.GameObjects.Bob#setFrame + * @method Phaser.Geom.Triangle#contains * @since 3.0.0 * - * @param {(string|number|Phaser.Textures.Frame)} [frame] - The frame to be used during rendering. + * @param {number} x - The x coordinate of the point to check. + * @param {number} y - The y coordinate of the point to check. * - * @return {this} This Bob Game Object. + * @return {boolean} `true` if the coordinate pair is within the triangle, otherwise `false`. */ - setFrame: function (frame) + contains: function (x, y) { - if (frame === undefined) - { - this.frame = this.parent.frame; - } - else if (frame instanceof Frame && frame.texture === this.parent.texture) - { - this.frame = frame; - } - else - { - this.frame = this.parent.texture.get(frame); - } - - return this; + return Contains(this, x, y); }, /** - * Resets the horizontal and vertical flipped state of this Bob back to their default un-flipped state. + * Returns a specific point on the triangle. * - * @method Phaser.GameObjects.Bob#resetFlip + * @method Phaser.Geom.Triangle#getPoint * @since 3.0.0 * - * @return {this} This Bob Game Object. + * @generic {Phaser.Geom.Point} O - [output,$return] + * + * @param {number} position - Position as float within `0` and `1`. `0` equals the first point. + * @param {(Phaser.Geom.Point|object)} [output] - Optional Point, or point-like object, that the calculated point will be written to. + * + * @return {(Phaser.Geom.Point|object)} Calculated `Point` that represents the requested position. It is the same as `output` when this parameter has been given. */ - resetFlip: function () + getPoint: function (position, output) { - this.flipX = false; - this.flipY = false; - - return this; + return GetPoint(this, position, output); }, /** - * Resets this Bob. - * - * Changes the position to the values given, and optionally changes the frame. - * - * Also resets the flipX and flipY values, sets alpha back to 1 and visible to true. + * Calculates a list of evenly distributed points on the triangle. It is either possible to pass an amount of points to be generated (`quantity`) or the distance between two points (`stepRate`). * - * @method Phaser.GameObjects.Bob#reset + * @method Phaser.Geom.Triangle#getPoints * @since 3.0.0 * - * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. - * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. - * @param {(string|number|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using. + * @generic {Phaser.Geom.Point[]} O - [output,$return] * - * @return {this} This Bob Game Object. + * @param {number} quantity - Number of points to be generated. Can be falsey when `stepRate` should be used. All points have the same distance along the triangle. + * @param {number} [stepRate] - Distance between two points. Will only be used when `quantity` is falsey. + * @param {(array|Phaser.Geom.Point[])} [output] - Optional Array for writing the calculated points into. Otherwise a new array will be created. + * + * @return {(array|Phaser.Geom.Point[])} Returns a list of calculated `Point` instances or the filled array passed as parameter `output`. */ - reset: function (x, y, frame) + getPoints: function (quantity, stepRate, output) { - this.x = x; - this.y = y; - - this.flipX = false; - this.flipY = false; - - this._alpha = 1; - this._visible = true; - - this.parent.dirty = true; - - if (frame) - { - this.setFrame(frame); - } - - return this; + return GetPoints(this, quantity, stepRate, output); }, /** - * Changes the position of this Bob to the values given. + * Returns a random point along the triangle. * - * @method Phaser.GameObjects.Bob#setPosition - * @since 3.20.0 + * @method Phaser.Geom.Triangle#getRandomPoint + * @since 3.0.0 * - * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object. - * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object. + * @generic {Phaser.Geom.Point} O - [point,$return] * - * @return {this} This Bob Game Object. + * @param {Phaser.Geom.Point} [point] - Optional `Point` that should be modified. Otherwise a new one will be created. + * + * @return {Phaser.Geom.Point} Random `Point`. When parameter `point` has been provided it will be returned. */ - setPosition: function (x, y) + getRandomPoint: function (point) { - this.x = x; - this.y = y; - - return this; + return Random(this, point); }, /** - * Sets the horizontal flipped state of this Bob. + * Sets all three points of the triangle. Leaving out any coordinate sets it to be `0`. * - * @method Phaser.GameObjects.Bob#setFlipX + * @method Phaser.Geom.Triangle#setTo * @since 3.0.0 * - * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. + * @param {number} [x1=0] - `x` coordinate of the first point. + * @param {number} [y1=0] - `y` coordinate of the first point. + * @param {number} [x2=0] - `x` coordinate of the second point. + * @param {number} [y2=0] - `y` coordinate of the second point. + * @param {number} [x3=0] - `x` coordinate of the third point. + * @param {number} [y3=0] - `y` coordinate of the third point. * - * @return {this} This Bob Game Object. + * @return {this} This Triangle object. */ - setFlipX: function (value) + setTo: function (x1, y1, x2, y2, x3, y3) { - this.flipX = value; + if (x1 === undefined) { x1 = 0; } + if (y1 === undefined) { y1 = 0; } + if (x2 === undefined) { x2 = 0; } + if (y2 === undefined) { y2 = 0; } + if (x3 === undefined) { x3 = 0; } + if (y3 === undefined) { y3 = 0; } + + this.x1 = x1; + this.y1 = y1; + + this.x2 = x2; + this.y2 = y2; + + this.x3 = x3; + this.y3 = y3; return this; }, /** - * Sets the vertical flipped state of this Bob. + * Returns a Line object that corresponds to Line A of this Triangle. * - * @method Phaser.GameObjects.Bob#setFlipY + * @method Phaser.Geom.Triangle#getLineA * @since 3.0.0 * - * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. + * @generic {Phaser.Geom.Line} O - [line,$return] * - * @return {this} This Bob Game Object. + * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. + * + * @return {Phaser.Geom.Line} A Line object that corresponds to line A of this Triangle. */ - setFlipY: function (value) + getLineA: function (line) { - this.flipY = value; + if (line === undefined) { line = new Line(); } - return this; + line.setTo(this.x1, this.y1, this.x2, this.y2); + + return line; }, /** - * Sets the horizontal and vertical flipped state of this Bob. + * Returns a Line object that corresponds to Line B of this Triangle. * - * @method Phaser.GameObjects.Bob#setFlip + * @method Phaser.Geom.Triangle#getLineB * @since 3.0.0 * - * @param {boolean} x - The horizontal flipped state. `false` for no flip, or `true` to be flipped. - * @param {boolean} y - The horizontal flipped state. `false` for no flip, or `true` to be flipped. + * @generic {Phaser.Geom.Line} O - [line,$return] * - * @return {this} This Bob Game Object. + * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. + * + * @return {Phaser.Geom.Line} A Line object that corresponds to line B of this Triangle. */ - setFlip: function (x, y) + getLineB: function (line) { - this.flipX = x; - this.flipY = y; + if (line === undefined) { line = new Line(); } - return this; + line.setTo(this.x2, this.y2, this.x3, this.y3); + + return line; }, /** - * Sets the visibility of this Bob. - * - * An invisible Bob will skip rendering. + * Returns a Line object that corresponds to Line C of this Triangle. * - * @method Phaser.GameObjects.Bob#setVisible + * @method Phaser.Geom.Triangle#getLineC * @since 3.0.0 * - * @param {boolean} value - The visible state of the Game Object. + * @generic {Phaser.Geom.Line} O - [line,$return] * - * @return {this} This Bob Game Object. + * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created. + * + * @return {Phaser.Geom.Line} A Line object that corresponds to line C of this Triangle. */ - setVisible: function (value) + getLineC: function (line) { - this.visible = value; + if (line === undefined) { line = new Line(); } - return this; + line.setTo(this.x3, this.y3, this.x1, this.y1); + + return line; }, /** - * Set the Alpha level of this Bob. The alpha controls the opacity of the Game Object as it renders. - * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. - * - * A Bob with alpha 0 will skip rendering. + * Left most X coordinate of the triangle. Setting it moves the triangle on the X axis accordingly. * - * @method Phaser.GameObjects.Bob#setAlpha + * @name Phaser.Geom.Triangle#left + * @type {number} * @since 3.0.0 - * - * @param {number} value - The alpha value used for this Bob. Between 0 and 1. - * - * @return {this} This Bob Game Object. */ - setAlpha: function (value) - { - this.alpha = value; + left: { - return this; - }, + get: function () + { + return Math.min(this.x1, this.x2, this.x3); + }, - /** - * Sets the tint of this Bob. - * - * @method Phaser.GameObjects.Bob#setTint - * @since 3.20.0 - * - * @param {number} value - The tint value used for this Bob. Between 0 and 0xffffff. - * - * @return {this} This Bob Game Object. - */ - setTint: function (value) - { - this.tint = value; + set: function (value) + { + var diff = 0; + + if (this.x1 <= this.x2 && this.x1 <= this.x3) + { + diff = this.x1 - value; + } + else if (this.x2 <= this.x1 && this.x2 <= this.x3) + { + diff = this.x2 - value; + } + else + { + diff = this.x3 - value; + } + + this.x1 -= diff; + this.x2 -= diff; + this.x3 -= diff; + } - return this; }, /** - * Destroys this Bob instance. - * Removes itself from the Blitter and clears the parent, frame and data properties. + * Right most X coordinate of the triangle. Setting it moves the triangle on the X axis accordingly. * - * @method Phaser.GameObjects.Bob#destroy + * @name Phaser.Geom.Triangle#right + * @type {number} * @since 3.0.0 */ - destroy: function () - { - this.parent.dirty = true; + right: { - this.parent.children.remove(this); + get: function () + { + return Math.max(this.x1, this.x2, this.x3); + }, + + set: function (value) + { + var diff = 0; + + if (this.x1 >= this.x2 && this.x1 >= this.x3) + { + diff = this.x1 - value; + } + else if (this.x2 >= this.x1 && this.x2 >= this.x3) + { + diff = this.x2 - value; + } + else + { + diff = this.x3 - value; + } + + this.x1 -= diff; + this.x2 -= diff; + this.x3 -= diff; + } - this.parent = undefined; - this.frame = undefined; - this.data = undefined; }, /** - * The visible state of the Bob. - * - * An invisible Bob will skip rendering. + * Top most Y coordinate of the triangle. Setting it moves the triangle on the Y axis accordingly. * - * @name Phaser.GameObjects.Bob#visible - * @type {boolean} + * @name Phaser.Geom.Triangle#top + * @type {number} * @since 3.0.0 */ - visible: { + top: { get: function () { - return this._visible; + return Math.min(this.y1, this.y2, this.y3); }, set: function (value) { - this.parent.dirty |= (this._visible !== value); - this._visible = value; + var diff = 0; + + if (this.y1 <= this.y2 && this.y1 <= this.y3) + { + diff = this.y1 - value; + } + else if (this.y2 <= this.y1 && this.y2 <= this.y3) + { + diff = this.y2 - value; + } + else + { + diff = this.y3 - value; + } + + this.y1 -= diff; + this.y2 -= diff; + this.y3 -= diff; } }, /** - * The alpha value of the Bob, between 0 and 1. - * - * A Bob with alpha 0 will skip rendering. + * Bottom most Y coordinate of the triangle. Setting it moves the triangle on the Y axis accordingly. * - * @name Phaser.GameObjects.Bob#alpha + * @name Phaser.Geom.Triangle#bottom * @type {number} * @since 3.0.0 */ - alpha: { + bottom: { get: function () { - return this._alpha; + return Math.max(this.y1, this.y2, this.y3); }, set: function (value) { - this.parent.dirty |= ((this._alpha > 0) !== (value > 0)); - this._alpha = value; + var diff = 0; + + if (this.y1 >= this.y2 && this.y1 >= this.y3) + { + diff = this.y1 - value; + } + else if (this.y2 >= this.y1 && this.y2 >= this.y3) + { + diff = this.y2 - value; + } + else + { + diff = this.y3 - value; + } + + this.y1 -= diff; + this.y2 -= diff; + this.y3 -= diff; } } }); -module.exports = Bob; +module.exports = Triangle; /***/ }), -/* 441 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 87619: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Rectangle = __webpack_require__(10); +var Triangle = __webpack_require__(66349); + +Triangle.Area = __webpack_require__(19108); +Triangle.BuildEquilateral = __webpack_require__(41199); +Triangle.BuildFromPolygon = __webpack_require__(88730); +Triangle.BuildRight = __webpack_require__(3635); +Triangle.CenterOn = __webpack_require__(1882); +Triangle.Centroid = __webpack_require__(56595); +Triangle.CircumCenter = __webpack_require__(91835); +Triangle.CircumCircle = __webpack_require__(97073); +Triangle.Clone = __webpack_require__(75974); +Triangle.Contains = __webpack_require__(60689); +Triangle.ContainsArray = __webpack_require__(86875); +Triangle.ContainsPoint = __webpack_require__(51532); +Triangle.CopyFrom = __webpack_require__(42538); +Triangle.Decompose = __webpack_require__(18680); +Triangle.Equals = __webpack_require__(29977); +Triangle.GetPoint = __webpack_require__(56088); +Triangle.GetPoints = __webpack_require__(24402); +Triangle.InCenter = __webpack_require__(83648); +Triangle.Perimeter = __webpack_require__(95290); +Triangle.Offset = __webpack_require__(9640); +Triangle.Random = __webpack_require__(99761); +Triangle.Rotate = __webpack_require__(21934); +Triangle.RotateAroundPoint = __webpack_require__(68454); +Triangle.RotateAroundXY = __webpack_require__(19211); + +module.exports = Triangle; + + +/***/ }), + +/***/ 27395: +/***/ ((module) => { /** - * Creates a new Rectangle or repositions and/or resizes an existing Rectangle so that it encompasses the two given Rectangles, i.e. calculates their union. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Creates a new Interactive Object. * - * @function Phaser.Geom.Rectangle.Union - * @since 3.0.0 + * This is called automatically by the Input Manager when you enable a Game Object for input. * - * @generic {Phaser.Geom.Rectangle} O - [out,$return] + * The resulting Interactive Object is mapped to the Game Object's `input` property. * - * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to use. - * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to use. - * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the union in. + * @function Phaser.Input.CreateInteractiveObject + * @since 3.0.0 * - * @return {Phaser.Geom.Rectangle} The modified `out` Rectangle, or a new Rectangle if none was provided. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to which this Interactive Object is bound. + * @param {any} hitArea - The hit area for this Interactive Object. Typically a geometry shape, like a Rectangle or Circle. + * @param {Phaser.Types.Input.HitAreaCallback} hitAreaCallback - The 'contains' check callback that the hit area shape will use for all hit tests. + * + * @return {Phaser.Types.Input.InteractiveObject} The new Interactive Object. */ -var Union = function (rectA, rectB, out) +var CreateInteractiveObject = function (gameObject, hitArea, hitAreaCallback) { - if (out === undefined) { out = new Rectangle(); } + return { - // Cache vars so we can use one of the input rects as the output rect - var x = Math.min(rectA.x, rectB.x); - var y = Math.min(rectA.y, rectB.y); - var w = Math.max(rectA.right, rectB.right) - x; - var h = Math.max(rectA.bottom, rectB.bottom) - y; + gameObject: gameObject, - return out.setTo(x, y, w, h); + enabled: true, + draggable: false, + dropZone: false, + cursor: false, + + target: null, + + camera: null, + + hitArea: hitArea, + hitAreaCallback: hitAreaCallback, + hitAreaDebug: null, + + // Has the dev specified their own shape, or is this bound to the texture size? + customHitArea: false, + + localX: 0, + localY: 0, + + // 0 = Not being dragged + // 1 = Being checked for dragging + // 2 = Being dragged + dragState: 0, + + dragStartX: 0, + dragStartY: 0, + dragStartXGlobal: 0, + dragStartYGlobal: 0, + + dragX: 0, + dragY: 0 + + }; }; -module.exports = Union; +module.exports = CreateInteractiveObject; /***/ }), -/* 442 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 18104: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var DOMElementRender = __webpack_require__(1055); -var GameObject = __webpack_require__(15); -var IsPlainObject = __webpack_require__(7); -var RemoveFromDOM = __webpack_require__(202); -var SCENE_EVENTS = __webpack_require__(20); -var Vector4 = __webpack_require__(140); - /** - * @classdesc - * DOM Element Game Objects are a way to control and manipulate HTML Elements over the top of your game. - * - * In order for DOM Elements to display you have to enable them by adding the following to your game - * configuration object: - * - * ```javascript - * dom { - * createContainer: true - * } - * ``` - * - * When this is added, Phaser will automatically create a DOM Container div that is positioned over the top - * of the game canvas. This div is sized to match the canvas, and if the canvas size changes, as a result of - * settings within the Scale Manager, the dom container is resized accordingly. - * - * If you have not already done so, you have to provide a `parent` in the Game Configuration, or the DOM - * Container will fail to be created. - * - * You can create a DOM Element by either passing in DOMStrings, or by passing in a reference to an existing - * Element that you wish to be placed under the control of Phaser. For example: - * - * ```javascript - * this.add.dom(x, y, 'div', 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser'); - * ``` + * Creates a new Pixel Perfect Handler function. * - * The above code will insert a div element into the DOM Container at the given x/y coordinate. The DOMString in - * the 4th argument sets the initial CSS style of the div and the final argument is the inner text. In this case, - * it will create a lime colored div that is 220px by 100px in size with the text Phaser in it, in an Arial font. + * Access via `InputPlugin.makePixelPerfect` rather than calling it directly. * - * You should nearly always, without exception, use explicitly sized HTML Elements, in order to fully control - * alignment and positioning of the elements next to regular game content. + * @function Phaser.Input.CreatePixelPerfectHandler + * @since 3.10.0 * - * Rather than specify the CSS and HTML directly you can use the `load.html` File Loader to load it into the - * cache and then use the `createFromCache` method instead. You can also use `createFromHTML` and various other - * methods available in this class to help construct your elements. + * @param {Phaser.Textures.TextureManager} textureManager - A reference to the Texture Manager. + * @param {number} alphaTolerance - The alpha level that the pixel should be above to be included as a successful interaction. * - * Once the element has been created you can then control it like you would any other Game Object. You can set its - * position, scale, rotation, alpha and other properties. It will move as the main Scene Camera moves and be clipped - * at the edge of the canvas. It's important to remember some limitations of DOM Elements: The obvious one is that - * they appear above or below your game canvas. You cannot blend them into the display list, meaning you cannot have - * a DOM Element, then a Sprite, then another DOM Element behind it. + * @return {function} The new Pixel Perfect Handler function. + */ +var CreatePixelPerfectHandler = function (textureManager, alphaTolerance) +{ + return function (hitArea, x, y, gameObject) + { + var alpha = textureManager.getPixelAlpha(x, y, gameObject.texture.key, gameObject.frame.name); + + return (alpha && alpha >= alphaTolerance); + }; +}; + +module.exports = CreatePixelPerfectHandler; + + +/***/ }), + +/***/ 69898: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(72687); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(33963); +var GameEvents = __webpack_require__(97081); +var Keyboard = __webpack_require__(71064); +var Mouse = __webpack_require__(7905); +var Pointer = __webpack_require__(40398); +var Touch = __webpack_require__(37579); +var TransformMatrix = __webpack_require__(69360); +var TransformXY = __webpack_require__(64462); + +/** + * @classdesc + * The Input Manager is responsible for handling the pointer related systems in a single Phaser Game instance. * - * They also cannot be enabled for input. To do that, you have to use the `addListener` method to add native event - * listeners directly. The final limitation is to do with cameras. The DOM Container is sized to match the game canvas - * entirely and clipped accordingly. DOM Elements respect camera scrolling and scrollFactor settings, but if you - * change the size of the camera so it no longer matches the size of the canvas, they won't be clipped accordingly. + * Based on the Game Config it will create handlers for mouse and touch support. * - * Also, all DOM Elements are inserted into the same DOM Container, regardless of which Scene they are created in. + * Keyboard and Gamepad are plugins, handled directly by the InputPlugin class. * - * Note that you should only have DOM Elements in a Scene with a _single_ Camera. If you require multiple cameras, - * use parallel scenes to achieve this. + * It then manages the events, pointer creation and general hit test related operations. * - * DOM Elements are a powerful way to align native HTML with your Phaser Game Objects. For example, you can insert - * a login form for a multiplayer game directly into your title screen. Or a text input box for a highscore table. - * Or a banner ad from a 3rd party service. Or perhaps you'd like to use them for high resolution text display and - * UI. The choice is up to you, just remember that you're dealing with standard HTML and CSS floating over the top - * of your game, and should treat it accordingly. + * You rarely need to interact with the Input Manager directly, and as such, all of its properties and methods + * should be considered private. Instead, you should use the Input Plugin, which is a Scene level system, responsible + * for dealing with all input events for a Scene. * - * @class DOMElement - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects + * @class InputManager + * @memberof Phaser.Input * @constructor - * @since 3.17.0 - * - * @extends Phaser.GameObjects.Components.AlphaSingle - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible + * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this DOM Element in the world. - * @param {number} [y=0] - The vertical position of this DOM Element in the world. - * @param {(Element|string)} [element] - An existing DOM element, or a string. If a string starting with a # it will do a `getElementById` look-up on the string (minus the hash). Without a hash, it represents the type of element to create, i.e. 'div'. - * @param {(string|any)} [style] - If a string, will be set directly as the elements `style` property value. If a plain object, will be iterated and the values transferred. In both cases the values replacing whatever CSS styles may have been previously set. - * @param {string} [innerText] - If given, will be set directly as the elements `innerText` property value, replacing whatever was there before. + * @param {Phaser.Game} game - The Game instance that owns the Input Manager. + * @param {object} config - The Input Configuration object, as set in the Game Config. */ -var DOMElement = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.AlphaSingle, - Components.BlendMode, - Components.Depth, - Components.Origin, - Components.ScrollFactor, - Components.Transform, - Components.Visible, - DOMElementRender - ], +var InputManager = new Class({ initialize: - function DOMElement (scene, x, y, element, style, innerText) + function InputManager (game, config) { - GameObject.call(this, scene, 'DOMElement'); - /** - * A reference to the parent DOM Container that the Game instance created when it started. + * The Game instance that owns the Input Manager. + * A Game only maintains on instance of the Input Manager at any time. * - * @name Phaser.GameObjects.DOMElement#parent - * @type {Element} - * @since 3.17.0 + * @name Phaser.Input.InputManager#game + * @type {Phaser.Game} + * @readonly + * @since 3.0.0 */ - this.parent = scene.sys.game.domContainer; + this.game = game; /** - * A reference to the HTML Cache. + * A reference to the global Game Scale Manager. + * Used for all bounds checks and pointer scaling. * - * @name Phaser.GameObjects.DOMElement#cache - * @type {Phaser.Cache.BaseCache} - * @since 3.17.0 + * @name Phaser.Input.InputManager#scaleManager + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.0 */ - this.cache = scene.sys.cache.html; + this.scaleManager; /** - * The actual DOM Element that this Game Object is bound to. For example, if you've created a `
` - * then this property is a direct reference to that element within the dom. + * The Canvas that is used for all DOM event input listeners. * - * @name Phaser.GameObjects.DOMElement#node - * @type {Element} - * @since 3.17.0 + * @name Phaser.Input.InputManager#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 */ - this.node; + this.canvas; /** - * By default a DOM Element will have its transform, display, opacity, zIndex and blend mode properties - * updated when its rendered. If, for some reason, you don't want any of these changed other than the - * CSS transform, then set this flag to `true`. When `true` only the CSS Transform is applied and it's - * up to you to keep track of and set the other properties as required. - * - * This can be handy if, for example, you've a nested DOM Element and you don't want the opacity to be - * picked-up by any of its children. + * The Game Configuration object, as set during the game boot. * - * @name Phaser.GameObjects.DOMElement#transformOnly - * @type {boolean} - * @since 3.17.0 + * @name Phaser.Input.InputManager#config + * @type {Phaser.Core.Config} + * @since 3.0.0 */ - this.transformOnly = false; + this.config = config; /** - * The angle, in radians, by which to skew the DOM Element on the horizontal axis. - * - * https://developer.mozilla.org/en-US/docs/Web/CSS/transform + * If set, the Input Manager will run its update loop every frame. * - * @name Phaser.GameObjects.DOMElement#skewX - * @type {number} - * @since 3.17.0 + * @name Phaser.Input.InputManager#enabled + * @type {boolean} + * @default true + * @since 3.0.0 */ - this.skewX = 0; + this.enabled = true; /** - * The angle, in radians, by which to skew the DOM Element on the vertical axis. - * - * https://developer.mozilla.org/en-US/docs/Web/CSS/transform + * The Event Emitter instance that the Input Manager uses to emit events from. * - * @name Phaser.GameObjects.DOMElement#skewY - * @type {number} - * @since 3.17.0 + * @name Phaser.Input.InputManager#events + * @type {Phaser.Events.EventEmitter} + * @since 3.0.0 */ - this.skewY = 0; + this.events = new EventEmitter(); /** - * A Vector4 that contains the 3D rotation of this DOM Element around a fixed axis in 3D space. - * - * All values in the Vector4 are treated as degrees, unless the `rotate3dAngle` property is changed. - * - * For more details see the following MDN page: - * - * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate3d + * Are any mouse or touch pointers currently over the game canvas? + * This is updated automatically by the canvas over and out handlers. * - * @name Phaser.GameObjects.DOMElement#rotate3d - * @type {Phaser.Math.Vector4} - * @since 3.17.0 + * @name Phaser.Input.InputManager#isOver + * @type {boolean} + * @readonly + * @since 3.16.0 */ - this.rotate3d = new Vector4(); + this.isOver = true; /** - * The unit that represents the 3D rotation values. By default this is `deg` for degrees, but can - * be changed to any supported unit. See this page for further details: + * The default CSS cursor to be used when interacting with your game. * - * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate3d + * See the `setDefaultCursor` method for more details. * - * @name Phaser.GameObjects.DOMElement#rotate3dAngle + * @name Phaser.Input.InputManager#defaultCursor * @type {string} - * @since 3.17.0 + * @since 3.10.0 */ - this.rotate3dAngle = 'deg'; + this.defaultCursor = ''; /** - * Sets the CSS `pointerEvents` attribute on the DOM Element during rendering. + * A reference to the Keyboard Manager class, if enabled via the `input.keyboard` Game Config property. * - * This is 'auto' by default. Changing it may have unintended side-effects with - * internal Phaser input handling, such as dragging, so only change this if you - * understand the implications. + * @name Phaser.Input.InputManager#keyboard + * @type {?Phaser.Input.Keyboard.KeyboardManager} + * @since 3.16.0 + */ + this.keyboard = (config.inputKeyboard) ? new Keyboard(this) : null; + + /** + * A reference to the Mouse Manager class, if enabled via the `input.mouse` Game Config property. * - * @name Phaser.GameObjects.DOMElement#pointerEvents - * @type {string} - * @since 3.55.0 + * @name Phaser.Input.InputManager#mouse + * @type {?Phaser.Input.Mouse.MouseManager} + * @since 3.0.0 */ - this.pointerEvents = 'auto'; + this.mouse = (config.inputMouse) ? new Mouse(this) : null; /** - * The native (un-scaled) width of this Game Object. + * A reference to the Touch Manager class, if enabled via the `input.touch` Game Config property. * - * For a DOM Element this property is read-only. + * @name Phaser.Input.InputManager#touch + * @type {Phaser.Input.Touch.TouchManager} + * @since 3.0.0 + */ + this.touch = (config.inputTouch) ? new Touch(this) : null; + + /** + * An array of Pointers that have been added to the game. + * The first entry is reserved for the Mouse Pointer, the rest are Touch Pointers. * - * The property `displayWidth` holds the computed bounds of this DOM Element, factoring in scaling. + * By default there is 1 touch pointer enabled. If you need more use the `addPointer` method to start them, + * or set the `input.activePointers` property in the Game Config. * - * @name Phaser.GameObjects.DOMElement#width - * @type {number} - * @readonly - * @since 3.17.0 + * @name Phaser.Input.InputManager#pointers + * @type {Phaser.Input.Pointer[]} + * @since 3.10.0 */ - this.width = 0; + this.pointers = []; /** - * The native (un-scaled) height of this Game Object. - * - * For a DOM Element this property is read-only. + * The number of touch objects activated and being processed each update. * - * The property `displayHeight` holds the computed bounds of this DOM Element, factoring in scaling. + * You can change this by either calling `addPointer` at run-time, or by + * setting the `input.activePointers` property in the Game Config. * - * @name Phaser.GameObjects.DOMElement#height + * @name Phaser.Input.InputManager#pointersTotal * @type {number} * @readonly - * @since 3.17.0 + * @since 3.10.0 */ - this.height = 0; + this.pointersTotal = config.inputActivePointers; + + if (config.inputTouch && this.pointersTotal === 1) + { + this.pointersTotal = 2; + } + + for (var i = 0; i <= this.pointersTotal; i++) + { + var pointer = new Pointer(this, i); + + pointer.smoothFactor = config.inputSmoothFactor; + + this.pointers.push(pointer); + } /** - * The computed display width of this Game Object, based on the `getBoundingClientRect` DOM call. + * The mouse has its own unique Pointer object, which you can reference directly if making a _desktop specific game_. + * If you are supporting both desktop and touch devices then do not use this property, instead use `activePointer` + * which will always map to the most recently interacted pointer. * - * The property `width` holds the un-scaled width of this DOM Element. + * @name Phaser.Input.InputManager#mousePointer + * @type {?Phaser.Input.Pointer} + * @since 3.10.0 + */ + this.mousePointer = (config.inputMouse) ? this.pointers[0] : null; + + /** + * The most recently active Pointer object. * - * @name Phaser.GameObjects.DOMElement#displayWidth - * @type {number} - * @readonly - * @since 3.17.0 + * If you've only 1 Pointer in your game then this will accurately be either the first finger touched, or the mouse. + * + * If your game doesn't need to support multi-touch then you can safely use this property in all of your game + * code and it will adapt to be either the mouse or the touch, based on device. + * + * @name Phaser.Input.InputManager#activePointer + * @type {Phaser.Input.Pointer} + * @since 3.0.0 */ - this.displayWidth = 0; + this.activePointer = this.pointers[0]; /** - * The computed display height of this Game Object, based on the `getBoundingClientRect` DOM call. + * If the top-most Scene in the Scene List receives an input it will stop input from + * propagating any lower down the scene list, i.e. if you have a UI Scene at the top + * and click something on it, that click will not then be passed down to any other + * Scene below. Disable this to have input events passed through all Scenes, all the time. * - * The property `height` holds the un-scaled height of this DOM Element. + * @name Phaser.Input.InputManager#globalTopOnly + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.globalTopOnly = true; + + /** + * The time this Input Manager was last updated. + * This value is populated by the Game Step each frame. * - * @name Phaser.GameObjects.DOMElement#displayHeight + * @name Phaser.Input.InputManager#time * @type {number} * @readonly - * @since 3.17.0 + * @since 3.16.2 */ - this.displayHeight = 0; + this.time = 0; /** - * Internal native event handler. + * A re-cycled point-like object to store hit test values in. * - * @name Phaser.GameObjects.DOMElement#handler - * @type {number} + * @name Phaser.Input.InputManager#_tempPoint + * @type {{x:number, y:number}} * @private - * @since 3.17.0 + * @since 3.0.0 */ - this.handler = this.dispatchNativeEvent.bind(this); + this._tempPoint = { x: 0, y: 0 }; - this.setPosition(x, y); + /** + * A re-cycled array to store hit results in. + * + * @name Phaser.Input.InputManager#_tempHitTest + * @type {array} + * @private + * @default [] + * @since 3.0.0 + */ + this._tempHitTest = []; - if (typeof element === 'string') - { - // hash? - if (element[0] === '#') - { - this.setElement(element.substr(1), style, innerText); - } - else - { - this.createElement(element, style, innerText); - } - } - else if (element) - { - this.setElement(element, style, innerText); - } + /** + * A re-cycled matrix used in hit test calculations. + * + * @name Phaser.Input.InputManager#_tempMatrix + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @private + * @since 3.4.0 + */ + this._tempMatrix = new TransformMatrix(); - scene.sys.events.on(SCENE_EVENTS.SLEEP, this.handleSceneEvent, this); - scene.sys.events.on(SCENE_EVENTS.WAKE, this.handleSceneEvent, this); - }, + /** + * A re-cycled matrix used in hit test calculations. + * + * @name Phaser.Input.InputManager#_tempMatrix2 + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @private + * @since 3.12.0 + */ + this._tempMatrix2 = new TransformMatrix(); - // Overrides Game Object method - addedToScene: function () - { - this.scene.sys.updateList.add(this); - }, + /** + * An internal private var that records Scenes aborting event processing. + * + * @name Phaser.Input.InputManager#_tempSkip + * @type {boolean} + * @private + * @since 3.18.0 + */ + this._tempSkip = false; - // Overrides Game Object method - removedFromScene: function () - { - this.scene.sys.updateList.remove(this); + /** + * An internal private array that avoids needing to create a new array on every DOM mouse event. + * + * @name Phaser.Input.InputManager#mousePointerContainer + * @type {Phaser.Input.Pointer[]} + * @private + * @since 3.18.0 + */ + this.mousePointerContainer = [ this.mousePointer ]; + + game.events.once(GameEvents.BOOT, this.boot, this); }, /** - * Handles a Scene Sleep and Wake event. - * - * @method Phaser.GameObjects.DOMElement#handleSceneEvent - * @private - * @since 3.22.0 + * The Boot handler is called by Phaser.Game when it first starts up. + * The renderer is available by now. * - * @param {Phaser.Scenes.Systems} sys - The Scene Systems. + * @method Phaser.Input.InputManager#boot + * @protected + * @fires Phaser.Input.Events#MANAGER_BOOT + * @since 3.0.0 */ - handleSceneEvent: function (sys) + boot: function () { - var node = this.node; - var style = node.style; + var game = this.game; + var events = game.events; - if (node) - { - style.display = (sys.settings.visible) ? 'block' : 'none'; - } + this.canvas = game.canvas; + + this.scaleManager = game.scale; + + this.events.emit(Events.MANAGER_BOOT); + + events.on(GameEvents.PRE_RENDER, this.preRender, this); + + events.once(GameEvents.DESTROY, this.destroy, this); }, /** - * Sets the horizontal and vertical skew values of this DOM Element. - * - * For more information see: https://developer.mozilla.org/en-US/docs/Web/CSS/transform - * - * @method Phaser.GameObjects.DOMElement#setSkew - * @since 3.17.0 + * Internal canvas state change, called automatically by the Mouse Manager. * - * @param {number} [x=0] - The angle, in radians, by which to skew the DOM Element on the horizontal axis. - * @param {number} [y=x] - The angle, in radians, by which to skew the DOM Element on the vertical axis. + * @method Phaser.Input.InputManager#setCanvasOver + * @fires Phaser.Input.Events#GAME_OVER + * @private + * @since 3.16.0 * - * @return {this} This DOM Element instance. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event. */ - setSkew: function (x, y) + setCanvasOver: function (event) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = x; } - - this.skewX = x; - this.skewY = y; + this.isOver = true; - return this; + this.events.emit(Events.GAME_OVER, event); }, /** - * Sets the perspective CSS property of the _parent DOM Container_. This determines the distance between the z=0 - * plane and the user in order to give a 3D-positioned element some perspective. Each 3D element with - * z > 0 becomes larger; each 3D-element with z < 0 becomes smaller. The strength of the effect is determined - * by the value of this property. - * - * For more information see: https://developer.mozilla.org/en-US/docs/Web/CSS/perspective - * - * **Changing this value changes it globally for all DOM Elements, as they all share the same parent container.** - * - * @method Phaser.GameObjects.DOMElement#setPerspective - * @since 3.17.0 + * Internal canvas state change, called automatically by the Mouse Manager. * - * @param {number} value - The perspective value, in pixels, that determines the distance between the z plane and the user. + * @method Phaser.Input.InputManager#setCanvasOut + * @fires Phaser.Input.Events#GAME_OUT + * @private + * @since 3.16.0 * - * @return {this} This DOM Element instance. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event. */ - setPerspective: function (value) + setCanvasOut: function (event) { - this.parent.style.perspective = value + 'px'; + this.isOver = false; - return this; + this.events.emit(Events.GAME_OUT, event); }, /** - * The perspective CSS property value of the _parent DOM Container_. This determines the distance between the z=0 - * plane and the user in order to give a 3D-positioned element some perspective. Each 3D element with - * z > 0 becomes larger; each 3D-element with z < 0 becomes smaller. The strength of the effect is determined - * by the value of this property. - * - * For more information see: https://developer.mozilla.org/en-US/docs/Web/CSS/perspective - * - * **Changing this value changes it globally for all DOM Elements, as they all share the same parent container.** + * Internal update, called automatically by the Game Step right at the start. * - * @name Phaser.GameObjects.DOMElement#perspective - * @type {number} - * @since 3.17.0 + * @method Phaser.Input.InputManager#preRender + * @private + * @since 3.18.0 */ - perspective: { + preRender: function () + { + var time = this.game.loop.now; + var delta = this.game.loop.delta; + var scenes = this.game.scene.getScenes(true, true); - get: function () - { - return parseFloat(this.parent.style.perspective); - }, + this.time = time; - set: function (value) + this.events.emit(Events.MANAGER_UPDATE); + + for (var i = 0; i < scenes.length; i++) { - this.parent.style.perspective = value + 'px'; - } + var scene = scenes[i]; + if (scene.sys.input && scene.sys.input.updatePoll(time, delta) && this.globalTopOnly) + { + // If the Scene returns true, it means it captured some input that no other Scene should get, so we bail out + return; + } + } }, /** - * Adds one or more native DOM event listeners onto the underlying Element of this Game Object. - * The event is then dispatched via this Game Objects standard event emitter. + * Tells the Input system to set a custom cursor. * - * For example: + * This cursor will be the default cursor used when interacting with the game canvas. * - * ```javascript - * var div = this.add.dom(x, y, element); + * If an Interactive Object also sets a custom cursor, this is the cursor that is reset after its use. * - * div.addListener('click'); + * Any valid CSS cursor value is allowed, including paths to image files, i.e.: * - * div.on('click', handler); + * ```javascript + * this.input.setDefaultCursor('url(assets/cursors/sword.cur), pointer'); * ``` * - * @method Phaser.GameObjects.DOMElement#addListener - * @since 3.17.0 - * - * @param {string} events - The DOM event/s to listen for. You can specify multiple events by separating them with spaces. + * Please read about the differences between browsers when it comes to the file formats and sizes they support: * - * @return {this} This DOM Element instance. - */ - addListener: function (events) - { - if (this.node) - { - events = events.split(' '); - - for (var i = 0; i < events.length; i++) - { - this.node.addEventListener(events[i], this.handler, false); - } - } - - return this; - }, - - /** - * Removes one or more native DOM event listeners from the underlying Element of this Game Object. + * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor + * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_User_Interface/Using_URL_values_for_the_cursor_property * - * @method Phaser.GameObjects.DOMElement#removeListener - * @since 3.17.0 + * It's up to you to pick a suitable cursor format that works across the range of browsers you need to support. * - * @param {string} events - The DOM event/s to stop listening for. You can specify multiple events by separating them with spaces. + * @method Phaser.Input.InputManager#setDefaultCursor + * @since 3.10.0 * - * @return {this} This DOM Element instance. + * @param {string} cursor - The CSS to be used when setting the default cursor. */ - removeListener: function (events) + setDefaultCursor: function (cursor) { - if (this.node) - { - events = events.split(' '); + this.defaultCursor = cursor; - for (var i = 0; i < events.length; i++) - { - this.node.removeEventListener(events[i], this.handler); - } + if (this.canvas.style.cursor !== cursor) + { + this.canvas.style.cursor = cursor; } - - return this; }, /** - * Internal event proxy to dispatch native DOM Events via this Game Object. + * Called by the InputPlugin when processing over and out events. * - * @method Phaser.GameObjects.DOMElement#dispatchNativeEvent + * Tells the Input Manager to set a custom cursor during its postUpdate step. + * + * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor + * + * @method Phaser.Input.InputManager#setCursor * @private - * @since 3.17.0 + * @since 3.10.0 * - * @param {any} event - The native DOM event. + * @param {Phaser.Types.Input.InteractiveObject} interactiveObject - The Interactive Object that called this method. */ - dispatchNativeEvent: function (event) + setCursor: function (interactiveObject) { - this.emit(event.type, event); + if (interactiveObject.cursor) + { + this.canvas.style.cursor = interactiveObject.cursor; + } }, /** - * Creates a native DOM Element, adds it to the parent DOM Container and then binds it to this Game Object, - * so you can control it. The `tagName` should be a string and is passed to `document.createElement`: - * - * ```javascript - * this.add.dom().createElement('div'); - * ``` - * - * For more details on acceptable tag names see: https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement - * - * You can also pass in a DOMString or style object to set the CSS on the created element, and an optional `innerText` - * value as well. Here is an example of a DOMString: - * - * ```javascript - * this.add.dom().createElement('div', 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser'); - * ``` - * - * And using a style object: - * - * ```javascript - * var style = { - * 'background-color': 'lime'; - * 'width': '200px'; - * 'height': '100px'; - * 'font': '48px Arial'; - * }; - * - * this.add.dom().createElement('div', style, 'Phaser'); - * ``` - * - * If this Game Object already has an Element, it is removed from the DOM entirely first. - * Any event listeners you may have previously created will need to be re-created after this call. + * Called by the InputPlugin when processing over and out events. * - * @method Phaser.GameObjects.DOMElement#createElement - * @since 3.17.0 + * Tells the Input Manager to clear the hand cursor, if set, during its postUpdate step. * - * @param {string} tagName - A string that specifies the type of element to be created. The nodeName of the created element is initialized with the value of tagName. Don't use qualified names (like "html:a") with this method. - * @param {(string|any)} [style] - Either a DOMString that holds the CSS styles to be applied to the created element, or an object the styles will be ready from. - * @param {string} [innerText] - A DOMString that holds the text that will be set as the innerText of the created element. + * @method Phaser.Input.InputManager#resetCursor + * @private + * @since 3.10.0 * - * @return {this} This DOM Element instance. + * @param {Phaser.Types.Input.InteractiveObject} interactiveObject - The Interactive Object that called this method. */ - createElement: function (tagName, style, innerText) + resetCursor: function (interactiveObject) { - return this.setElement(document.createElement(tagName), style, innerText); + if (interactiveObject.cursor && this.canvas) + { + this.canvas.style.cursor = this.defaultCursor; + } }, /** - * Binds a new DOM Element to this Game Object. If this Game Object already has an Element it is removed from the DOM - * entirely first. Any event listeners you may have previously created will need to be re-created on the new element. - * - * The `element` argument you pass to this method can be either a string tagName: - * - * ```javascript - *

Phaser

- * - * this.add.dom().setElement('heading'); - * ``` - * - * Or a reference to an Element instance: - * - * ```javascript - *

Phaser

- * - * var h1 = document.getElementById('heading'); - * - * this.add.dom().setElement(h1); - * ``` - * - * You can also pass in a DOMString or style object to set the CSS on the created element, and an optional `innerText` - * value as well. Here is an example of a DOMString: - * - * ```javascript - * this.add.dom().setElement(h1, 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser'); - * ``` + * Adds new Pointer objects to the Input Manager. * - * And using a style object: + * By default Phaser creates 2 pointer objects: `mousePointer` and `pointer1`. * - * ```javascript - * var style = { - * 'background-color': 'lime'; - * 'width': '200px'; - * 'height': '100px'; - * 'font': '48px Arial'; - * }; + * You can create more either by calling this method, or by setting the `input.activePointers` property + * in the Game Config, up to a maximum of 10 pointers. * - * this.add.dom().setElement(h1, style, 'Phaser'); - * ``` + * The first 10 pointers are available via the `InputPlugin.pointerX` properties, once they have been added + * via this method. * - * @method Phaser.GameObjects.DOMElement#setElement - * @since 3.17.0 + * @method Phaser.Input.InputManager#addPointer + * @since 3.10.0 * - * @param {(string|Element)} element - If a string it is passed to `getElementById()`, or it should be a reference to an existing Element. - * @param {(string|any)} [style] - Either a DOMString that holds the CSS styles to be applied to the created element, or an object the styles will be ready from. - * @param {string} [innerText] - A DOMString that holds the text that will be set as the innerText of the created element. + * @param {number} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total. * - * @return {this} This DOM Element instance. + * @return {Phaser.Input.Pointer[]} An array containing all of the new Pointer objects that were created. */ - setElement: function (element, style, innerText) + addPointer: function (quantity) { - // Already got an element? Remove it first - this.removeElement(); - - var target; - - if (typeof element === 'string') - { - // hash? - if (element[0] === '#') - { - element = element.substr(1); - } + if (quantity === undefined) { quantity = 1; } - target = document.getElementById(element); - } - else if (typeof element === 'object' && element.nodeType === 1) - { - target = element; - } + var output = []; - if (!target) + if (this.pointersTotal + quantity > 10) { - return this; + quantity = 10 - this.pointersTotal; } - this.node = target; - - // style can be empty, a string or a plain object - if (style && IsPlainObject(style)) - { - for (var key in style) - { - target.style[key] = style[key]; - } - } - else if (typeof style === 'string') + for (var i = 0; i < quantity; i++) { - target.style = style; - } - - // Add / Override the values we need - - target.style.zIndex = '0'; - target.style.display = 'inline'; - target.style.position = 'absolute'; + var id = this.pointers.length; - // Node handler + var pointer = new Pointer(this, id); - target.phaser = this; + pointer.smoothFactor = this.config.inputSmoothFactor; - if (this.parent) - { - this.parent.appendChild(target); - } + this.pointers.push(pointer); - // InnerText + this.pointersTotal++; - if (innerText) - { - target.innerText = innerText; + output.push(pointer); } - return this.updateSize(); + return output; }, /** - * Takes a block of html from the HTML Cache, that has previously been preloaded into the game, and then - * creates a DOM Element from it. The loaded HTML is set as the `innerHTML` property of the created - * element. - * - * Assume the following html is stored in a file called `loginform.html`: - * - * ```html - * - * - * ``` - * - * Which is loaded into your game using the cache key 'login': - * - * ```javascript - * this.load.html('login', 'assets/loginform.html'); - * ``` - * - * You can create a DOM Element from it using the cache key: - * - * ```javascript - * this.add.dom().createFromCache('login'); - * ``` - * - * The optional `elementType` argument controls the container that is created, into which the loaded html is inserted. - * The default is a plain `div` object, but any valid tagName can be given. - * - * If this Game Object already has an Element, it is removed from the DOM entirely first. - * Any event listeners you may have previously created will need to be re-created after this call. - * - * @method Phaser.GameObjects.DOMElement#createFromCache - * @since 3.17.0 + * Internal method that gets a list of all the active Input Plugins in the game + * and updates each of them in turn, in reverse order (top to bottom), to allow + * for DOM top-level event handling simulation. * - * @param {string} The key of the html cache entry to use for this DOM Element. - * @param {string} [tagName='div'] - The tag name of the element into which all of the loaded html will be inserted. Defaults to a plain div tag. + * @method Phaser.Input.InputManager#updateInputPlugins + * @since 3.16.0 * - * @return {this} This DOM Element instance. + * @param {number} type - The type of event to process. + * @param {Phaser.Input.Pointer[]} pointers - An array of Pointers on which the event occurred. */ - createFromCache: function (key, tagName) + updateInputPlugins: function (type, pointers) { - var html = this.cache.get(key); + var scenes = this.game.scene.getScenes(false, true); - if (html) + this._tempSkip = false; + + for (var i = 0; i < scenes.length; i++) { - this.createFromHTML(html, tagName); - } + var scene = scenes[i]; - return this; + if (scene.sys.input) + { + var capture = scene.sys.input.update(type, pointers); + + if ((capture && this.globalTopOnly) || this._tempSkip) + { + // If the Scene returns true, or called stopPropagation, it means it captured some input that no other Scene should get, so we bail out + return; + } + } + } }, + // event.targetTouches = list of all touches on the TARGET ELEMENT (i.e. game dom element) + // event.touches = list of all touches on the ENTIRE DOCUMENT, not just the target element + // event.changedTouches = the touches that CHANGED in this event, not the total number of them + /** - * Takes a string of html and then creates a DOM Element from it. The HTML is set as the `innerHTML` - * property of the created element. - * - * ```javascript - * let form = ` - * - * - * `; - * ``` - * - * You can create a DOM Element from it using the string: - * - * ```javascript - * this.add.dom().createFromHTML(form); - * ``` - * - * The optional `elementType` argument controls the type of container that is created, into which the html is inserted. - * The default is a plain `div` object, but any valid tagName can be given. - * - * If this Game Object already has an Element, it is removed from the DOM entirely first. - * Any event listeners you may have previously created will need to be re-created after this call. - * - * @method Phaser.GameObjects.DOMElement#createFromHTML - * @since 3.17.0 + * Processes a touch start event, as passed in by the TouchManager. * - * @param {string} html - A string of html to be set as the `innerHTML` property of the created element. - * @param {string} [tagName='div'] - The tag name of the element into which all of the html will be inserted. Defaults to a plain div tag. + * @method Phaser.Input.InputManager#onTouchStart + * @private + * @since 3.18.0 * - * @return {this} This DOM Element instance. + * @param {TouchEvent} event - The native DOM Touch event. */ - createFromHTML: function (html, tagName) + onTouchStart: function (event) { - if (tagName === undefined) { tagName = 'div'; } - - // Already got an element? Remove it first - this.removeElement(); + var pointers = this.pointers; + var changed = []; - var element = document.createElement(tagName); + for (var c = 0; c < event.changedTouches.length; c++) + { + var changedTouch = event.changedTouches[c]; - this.node = element; + for (var i = 1; i < this.pointersTotal; i++) + { + var pointer = pointers[i]; - element.style.zIndex = '0'; - element.style.display = 'inline'; - element.style.position = 'absolute'; + if (!pointer.active) + { + pointer.touchstart(changedTouch, event); - // Node handler + this.activePointer = pointer; - element.phaser = this; + changed.push(pointer); - if (this.parent) - { - this.parent.appendChild(element); + break; + } + } } - element.innerHTML = html; - - return this.updateSize(); + this.updateInputPlugins(CONST.TOUCH_START, changed); }, /** - * Removes the current DOM Element bound to this Game Object from the DOM entirely and resets the - * `node` property of this Game Object to be `null`. + * Processes a touch move event, as passed in by the TouchManager. * - * @method Phaser.GameObjects.DOMElement#removeElement - * @since 3.17.0 + * @method Phaser.Input.InputManager#onTouchMove + * @private + * @since 3.18.0 * - * @return {this} This DOM Element instance. + * @param {TouchEvent} event - The native DOM Touch event. */ - removeElement: function () + onTouchMove: function (event) { - if (this.node) + var pointers = this.pointers; + var changed = []; + + for (var c = 0; c < event.changedTouches.length; c++) { - RemoveFromDOM(this.node); + var changedTouch = event.changedTouches[c]; - this.node = null; + for (var i = 1; i < this.pointersTotal; i++) + { + var pointer = pointers[i]; + + if (pointer.active && pointer.identifier === changedTouch.identifier) + { + var element = document.elementFromPoint(changedTouch.pageX, changedTouch.pageY); + var overCanvas = element === this.canvas; + + if (!this.isOver && overCanvas) + { + this.setCanvasOver(event); + } + else if (this.isOver && !overCanvas) + { + this.setCanvasOut(event); + } + + if (this.isOver) + { + pointer.touchmove(changedTouch, event); + + this.activePointer = pointer; + + changed.push(pointer); + } + + break; + } + } } - return this; + this.updateInputPlugins(CONST.TOUCH_MOVE, changed); }, + // For touch end its a list of the touch points that have been removed from the surface + // https://developer.mozilla.org/en-US/docs/DOM/TouchList + // event.changedTouches = the touches that CHANGED in this event, not the total number of them + /** - * Internal method that calls `getBoundingClientRect` on the `node` and then sets the bounds width - * and height into the `displayWidth` and `displayHeight` properties, and the `clientWidth` and `clientHeight` - * values into the `width` and `height` properties respectively. - * - * This is called automatically whenever a new element is created or set. + * Processes a touch end event, as passed in by the TouchManager. * - * @method Phaser.GameObjects.DOMElement#updateSize - * @since 3.17.0 + * @method Phaser.Input.InputManager#onTouchEnd + * @private + * @since 3.18.0 * - * @return {this} This DOM Element instance. + * @param {TouchEvent} event - The native DOM Touch event. */ - updateSize: function () + onTouchEnd: function (event) { - var node = this.node; + var pointers = this.pointers; + var changed = []; - var nodeBounds = node.getBoundingClientRect(); + for (var c = 0; c < event.changedTouches.length; c++) + { + var changedTouch = event.changedTouches[c]; - this.width = node.clientWidth; - this.height = node.clientHeight; + for (var i = 1; i < this.pointersTotal; i++) + { + var pointer = pointers[i]; - this.displayWidth = nodeBounds.width || 0; - this.displayHeight = nodeBounds.height || 0; + if (pointer.active && pointer.identifier === changedTouch.identifier) + { + pointer.touchend(changedTouch, event); - return this; + changed.push(pointer); + + break; + } + } + } + + this.updateInputPlugins(CONST.TOUCH_END, changed); }, /** - * Gets all children from this DOM Elements node, using `querySelectorAll('*')` and then iterates through - * them, looking for the first one that has a property matching the given key and value. It then returns this child - * if found, or `null` if not. - * - * @method Phaser.GameObjects.DOMElement#getChildByProperty - * @since 3.17.0 + * Processes a touch cancel event, as passed in by the TouchManager. * - * @param {string} property - The property to search the children for. - * @param {string} value - The value the property must strictly equal. + * @method Phaser.Input.InputManager#onTouchCancel + * @private + * @since 3.18.0 * - * @return {?Element} The first matching child DOM Element, or `null` if not found. + * @param {TouchEvent} event - The native DOM Touch event. */ - getChildByProperty: function (property, value) + onTouchCancel: function (event) { - if (this.node) + var pointers = this.pointers; + var changed = []; + + for (var c = 0; c < event.changedTouches.length; c++) { - var children = this.node.querySelectorAll('*'); + var changedTouch = event.changedTouches[c]; - for (var i = 0; i < children.length; i++) + for (var i = 1; i < this.pointersTotal; i++) { - if (children[i][property] === value) + var pointer = pointers[i]; + + if (pointer.active && pointer.identifier === changedTouch.identifier) { - return children[i]; + pointer.touchcancel(changedTouch, event); + + changed.push(pointer); + + break; } } } - return null; + this.updateInputPlugins(CONST.TOUCH_CANCEL, changed); }, /** - * Gets all children from this DOM Elements node, using `querySelectorAll('*')` and then iterates through - * them, looking for the first one that has a matching id. It then returns this child if found, or `null` if not. - * - * Be aware that class and id names are case-sensitive. - * - * @method Phaser.GameObjects.DOMElement#getChildByID - * @since 3.17.0 + * Processes a mouse down event, as passed in by the MouseManager. * - * @param {string} id - The id to search the children for. + * @method Phaser.Input.InputManager#onMouseDown + * @private + * @since 3.18.0 * - * @return {?Element} The first matching child DOM Element, or `null` if not found. + * @param {MouseEvent} event - The native DOM Mouse event. */ - getChildByID: function (id) + onMouseDown: function (event) { - return this.getChildByProperty('id', id); + var mousePointer = this.mousePointer; + + mousePointer.down(event); + + mousePointer.updateMotion(); + + this.activePointer = mousePointer; + + this.updateInputPlugins(CONST.MOUSE_DOWN, this.mousePointerContainer); }, /** - * Gets all children from this DOM Elements node, using `querySelectorAll('*')` and then iterates through - * them, looking for the first one that has a matching name. It then returns this child if found, or `null` if not. - * - * Be aware that class and id names are case-sensitive. - * - * @method Phaser.GameObjects.DOMElement#getChildByName - * @since 3.17.0 + * Processes a mouse move event, as passed in by the MouseManager. * - * @param {string} name - The name to search the children for. + * @method Phaser.Input.InputManager#onMouseMove + * @private + * @since 3.18.0 * - * @return {?Element} The first matching child DOM Element, or `null` if not found. + * @param {MouseEvent} event - The native DOM Mouse event. */ - getChildByName: function (name) + onMouseMove: function (event) { - return this.getChildByProperty('name', name); + var mousePointer = this.mousePointer; + + mousePointer.move(event); + + mousePointer.updateMotion(); + + this.activePointer = mousePointer; + + this.updateInputPlugins(CONST.MOUSE_MOVE, this.mousePointerContainer); }, /** - * Sets the `className` property of the DOM Element node and updates the internal sizes. - * - * @method Phaser.GameObjects.DOMElement#setClassName - * @since 3.17.0 + * Processes a mouse up event, as passed in by the MouseManager. * - * @param {string} className - A string representing the class or space-separated classes of the element. + * @method Phaser.Input.InputManager#onMouseUp + * @private + * @since 3.18.0 * - * @return {this} This DOM Element instance. + * @param {MouseEvent} event - The native DOM Mouse event. */ - setClassName: function (className) + onMouseUp: function (event) { - if (this.node) - { - this.node.className = className; + var mousePointer = this.mousePointer; - this.updateSize(); - } + mousePointer.up(event); - return this; + mousePointer.updateMotion(); + + this.activePointer = mousePointer; + + this.updateInputPlugins(CONST.MOUSE_UP, this.mousePointerContainer); }, /** - * Sets the `innerText` property of the DOM Element node and updates the internal sizes. - * - * Note that only certain types of Elements can have `innerText` set on them. - * - * @method Phaser.GameObjects.DOMElement#setText - * @since 3.17.0 + * Processes a mouse wheel event, as passed in by the MouseManager. * - * @param {string} text - A DOMString representing the rendered text content of the element. + * @method Phaser.Input.InputManager#onMouseWheel + * @private + * @since 3.18.0 * - * @return {this} This DOM Element instance. + * @param {WheelEvent} event - The native DOM Wheel event. */ - setText: function (text) + onMouseWheel: function (event) { - if (this.node) - { - this.node.innerText = text; + var mousePointer = this.mousePointer; - this.updateSize(); - } + mousePointer.wheel(event); - return this; + this.activePointer = mousePointer; + + this.updateInputPlugins(CONST.MOUSE_WHEEL, this.mousePointerContainer); }, /** - * Sets the `innerHTML` property of the DOM Element node and updates the internal sizes. - * - * @method Phaser.GameObjects.DOMElement#setHTML - * @since 3.17.0 + * Processes a pointer lock change event, as passed in by the MouseManager. * - * @param {string} html - A DOMString of html to be set as the `innerHTML` property of the element. + * @method Phaser.Input.InputManager#onPointerLockChange + * @fires Phaser.Input.Events#POINTERLOCK_CHANGE + * @private + * @since 3.19.0 * - * @return {this} This DOM Element instance. + * @param {MouseEvent} event - The native DOM Mouse event. */ - setHTML: function (html) + onPointerLockChange: function (event) { - if (this.node) - { - this.node.innerHTML = html; + var isLocked = this.mouse.locked; - this.updateSize(); - } + this.mousePointer.locked = isLocked; - return this; + this.events.emit(Events.POINTERLOCK_CHANGE, event, isLocked); }, /** - * Runs internal update tasks. + * Checks if the given Game Object should be considered as a candidate for input or not. + * + * Checks if the Game Object has an input component that is enabled, that it will render, + * and finally, if it has a parent, that the parent parent, or any ancestor, is visible or not. * - * @method Phaser.GameObjects.DOMElement#preUpdate + * @method Phaser.Input.InputManager#inputCandidate * @private - * @since 3.17.0 + * @since 3.10.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to test. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera which is being tested against. + * + * @return {boolean} `true` if the Game Object should be considered for input, otherwise `false`. */ - preUpdate: function () + inputCandidate: function (gameObject, camera) { - var parent = this.parentContainer; - var node = this.node; + var input = gameObject.input; - if (node && parent && !parent.willRender()) + if (!input || !input.enabled || !gameObject.willRender(camera)) { - node.style.display = 'none'; + return false; + } + + var visible = true; + var parent = gameObject.parentContainer; + + if (parent) + { + do + { + if (!parent.willRender(camera)) + { + visible = false; + break; + } + + parent = parent.parentContainer; + + } while (parent); } + + return visible; }, /** - * Compares the renderMask with the renderFlags to see if this Game Object will render or not. + * Performs a hit test using the given Pointer and camera, against an array of interactive Game Objects. * - * DOMElements always return `true` as they need to still set values during the render pass, even if not visible. + * The Game Objects are culled against the camera, and then the coordinates are translated into the local camera space + * and used to determine if they fall within the remaining Game Objects hit areas or not. * - * @method Phaser.GameObjects.DOMElement#willRender - * @since 3.17.0 + * If nothing is matched an empty array is returned. * - * @return {boolean} `true` if the Game Object should be rendered, otherwise `false`. + * This method is called automatically by InputPlugin.hitTestPointer and doesn't usually need to be invoked directly. + * + * @method Phaser.Input.InputManager#hitTest + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer to test against. + * @param {array} gameObjects - An array of interactive Game Objects to check. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera which is being tested against. + * @param {array} [output] - An array to store the results in. If not given, a new empty array is created. + * + * @return {array} An array of the Game Objects that were hit during this hit test. */ - willRender: function () + hitTest: function (pointer, gameObjects, camera, output) { - return true; - }, - - /** - * Handles the pre-destroy step for the DOM Element, which removes the underlying node from the DOM. - * - * @method Phaser.GameObjects.DOMElement#preDestroy - * @private - * @since 3.17.0 - */ - preDestroy: function () - { - this.removeElement(); - - this.scene.sys.events.off(SCENE_EVENTS.SLEEP, this.handleSceneEvent, this); - this.scene.sys.events.off(SCENE_EVENTS.WAKE, this.handleSceneEvent, this); - } - -}); + if (output === undefined) { output = this._tempHitTest; } -module.exports = DOMElement; + var tempPoint = this._tempPoint; + var csx = camera.scrollX; + var csy = camera.scrollY; -/***/ }), -/* 443 */ -/***/ (function(module, exports, __webpack_require__) { + output.length = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var x = pointer.x; + var y = pointer.y; -var CSSBlendModes = __webpack_require__(1056); -var GameObject = __webpack_require__(15); -var TransformMatrix = __webpack_require__(25); + // Stores the world point inside of tempPoint + camera.getWorldPoint(x, y, tempPoint); -var tempMatrix1 = new TransformMatrix(); -var tempMatrix2 = new TransformMatrix(); -var tempMatrix3 = new TransformMatrix(); + pointer.worldX = tempPoint.x; + pointer.worldY = tempPoint.y; -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.DOMElement#renderWebGL - * @since 3.17.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active renderer. - * @param {Phaser.GameObjects.DOMElement} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var DOMElementCSSRenderer = function (renderer, src, camera, parentMatrix) -{ - if (!src.node) - { - return; - } + var point = { x: 0, y: 0 }; - var style = src.node.style; - var settings = src.scene.sys.settings; + var matrix = this._tempMatrix; + var parentMatrix = this._tempMatrix2; - if (!style || !settings.visible || GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter !== 0 && (src.cameraFilter & camera.id)) || (src.parentContainer && !src.parentContainer.willRender())) - { - style.display = 'none'; + for (var i = 0; i < gameObjects.length; i++) + { + var gameObject = gameObjects[i]; - return; - } + // Checks if the Game Object can receive input (isn't being ignored by the camera, invisible, etc) + // and also checks all of its parents, if any + if (!this.inputCandidate(gameObject, camera)) + { + continue; + } - var parent = src.parentContainer; - var alpha = camera.alpha * src.alpha; + var px = tempPoint.x + (csx * gameObject.scrollFactorX) - csx; + var py = tempPoint.y + (csy * gameObject.scrollFactorY) - csy; - if (parent) - { - alpha *= parent.alpha; - } + if (gameObject.parentContainer) + { + gameObject.getWorldTransformMatrix(matrix, parentMatrix); - var camMatrix = tempMatrix1; - var srcMatrix = tempMatrix2; - var calcMatrix = tempMatrix3; + matrix.applyInverse(px, py, point); + } + else + { + TransformXY(px, py, gameObject.x, gameObject.y, gameObject.rotation, gameObject.scaleX, gameObject.scaleY, point); + } - var dx = 0; - var dy = 0; + if (this.pointWithinHitArea(gameObject, point.x, point.y)) + { + output.push(gameObject); + } + } - var tx = '0%'; - var ty = '0%'; + return output; + }, - if (parentMatrix) + /** + * Checks if the given x and y coordinate are within the hit area of the Game Object. + * + * This method assumes that the coordinate values have already been translated into the space of the Game Object. + * + * If the coordinates are within the hit area they are set into the Game Objects Input `localX` and `localY` properties. + * + * @method Phaser.Input.InputManager#pointWithinHitArea + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object to check against. + * @param {number} x - The translated x coordinate for the hit test. + * @param {number} y - The translated y coordinate for the hit test. + * + * @return {boolean} `true` if the coordinates were inside the Game Objects hit area, otherwise `false`. + */ + pointWithinHitArea: function (gameObject, x, y) { - dx = (src.width * src.scaleX) * src.originX; - dy = (src.height * src.scaleY) * src.originY; - - srcMatrix.applyITRS(src.x - dx, src.y - dy, src.rotation, src.scaleX, src.scaleY); + // Normalize the origin + x += gameObject.displayOriginX; + y += gameObject.displayOriginY; - camMatrix.copyFrom(camera.matrix); + var input = gameObject.input; - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); + if (input && input.hitAreaCallback(input.hitArea, x, y, gameObject)) + { + input.localX = x; + input.localY = y; - // Undo the camera scroll - srcMatrix.e = src.x - dx; - srcMatrix.f = src.y - dy; + return true; + } + else + { + return false; + } + }, - // Multiply by the src matrix, store result in calcMatrix - camMatrix.multiply(srcMatrix, calcMatrix); - } - else + /** + * Checks if the given x and y coordinate are within the hit area of the Interactive Object. + * + * This method assumes that the coordinate values have already been translated into the space of the Interactive Object. + * + * If the coordinates are within the hit area they are set into the Interactive Objects Input `localX` and `localY` properties. + * + * @method Phaser.Input.InputManager#pointWithinInteractiveObject + * @since 3.0.0 + * + * @param {Phaser.Types.Input.InteractiveObject} object - The Interactive Object to check against. + * @param {number} x - The translated x coordinate for the hit test. + * @param {number} y - The translated y coordinate for the hit test. + * + * @return {boolean} `true` if the coordinates were inside the Game Objects hit area, otherwise `false`. + */ + pointWithinInteractiveObject: function (object, x, y) { - dx = (src.width) * src.originX; - dy = (src.height) * src.originY; - - srcMatrix.applyITRS(src.x - dx, src.y - dy, src.rotation, src.scaleX, src.scaleY); - - camMatrix.copyFrom(camera.matrix); + if (!object.hitArea) + { + return false; + } - tx = (100 * src.originX) + '%'; - ty = (100 * src.originY) + '%'; + // Normalize the origin + x += object.gameObject.displayOriginX; + y += object.gameObject.displayOriginY; - srcMatrix.e -= camera.scrollX * src.scrollFactorX; - srcMatrix.f -= camera.scrollY * src.scrollFactorY; + object.localX = x; + object.localY = y; - // Multiply by the src matrix, store result in calcMatrix - camMatrix.multiply(srcMatrix, calcMatrix); - } + return object.hitAreaCallback(object.hitArea, x, y, object); + }, - if (!src.transformOnly) + /** + * Transforms the pageX and pageY values of a Pointer into the scaled coordinate space of the Input Manager. + * + * @method Phaser.Input.InputManager#transformPointer + * @since 3.10.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer to transform the values for. + * @param {number} pageX - The Page X value. + * @param {number} pageY - The Page Y value. + * @param {boolean} wasMove - Are we transforming the Pointer from a move event, or an up / down event? + */ + transformPointer: function (pointer, pageX, pageY, wasMove) { - style.display = 'block'; - style.opacity = alpha; - style.zIndex = src._depth; - style.pointerEvents = src.pointerEvents; - style.mixBlendMode = CSSBlendModes[src._blendMode]; - } - - // https://developer.mozilla.org/en-US/docs/Web/CSS/transform - - style.transform = - calcMatrix.getCSSMatrix() + - ' skew(' + src.skewX + 'rad, ' + src.skewY + 'rad)' + - ' rotate3d(' + src.rotate3d.x + ',' + src.rotate3d.y + ',' + src.rotate3d.z + ',' + src.rotate3d.w + src.rotate3dAngle + ')'; - - style.transformOrigin = tx + ' ' + ty; -}; - -module.exports = DOMElementCSSRenderer; - - -/***/ }), -/* 444 */ -/***/ (function(module, exports, __webpack_require__) { + var p0 = pointer.position; + var p1 = pointer.prevPosition; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Store previous position + p1.x = p0.x; + p1.y = p0.y; -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(15); -var ExternRender = __webpack_require__(1060); + // Translate coordinates + var x = this.scaleManager.transformX(pageX); + var y = this.scaleManager.transformY(pageY); -/** - * @classdesc - * An Extern Game Object is a special type of Game Object that allows you to pass - * rendering off to a 3rd party. - * - * When you create an Extern and place it in the display list of a Scene, the renderer will - * process the list as usual. When it finds an Extern it will flush the current batch, - * clear down the pipeline and prepare a transform matrix which your render function can - * take advantage of, if required. - * - * The WebGL context is then left in a 'clean' state, ready for you to bind your own shaders, - * or draw to it, whatever you wish to do. This should all take place in the `render` method. - * The correct way to deploy an Extern object is to create a class that extends it, then - * override the `render` (and optionally `preUpdate`) methods and pass off control to your - * 3rd party libraries or custom WebGL code there. - * - * Once you've finished, you should free-up any of your resources. - * The Extern will then rebind the Phaser pipeline and carry on rendering the display list. - * - * Although this object has lots of properties such as Alpha, Blend Mode and Tint, none of - * them are used during rendering unless you take advantage of them in your own render code. - * - * @class Extern - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.GameObjects - * @constructor - * @since 3.16.0 - * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - */ -var Extern = new Class({ + var a = pointer.smoothFactor; - Extends: GameObject, + if (!wasMove || a === 0) + { + // Set immediately + p0.x = x; + p0.y = y; + } + else + { + // Apply smoothing + p0.x = x * a + p1.x * (1 - a); + p0.y = y * a + p1.y * (1 - a); + } + }, - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.Depth, - Components.Flip, - Components.Origin, - Components.ScrollFactor, - Components.Size, - Components.Texture, - Components.Tint, - Components.Transform, - Components.Visible, - ExternRender - ], + /** + * Destroys the Input Manager and all of its systems. + * + * There is no way to recover from doing this. + * + * @method Phaser.Input.InputManager#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.events.removeAllListeners(); - initialize: + this.game.events.off(GameEvents.PRE_RENDER); - function Extern (scene) - { - GameObject.call(this, scene, 'Extern'); - }, + if (this.keyboard) + { + this.keyboard.destroy(); + } - // Overrides Game Object method - addedToScene: function () - { - this.scene.sys.updateList.add(this); - }, + if (this.mouse) + { + this.mouse.destroy(); + } - // Overrides Game Object method - removedFromScene: function () - { - this.scene.sys.updateList.remove(this); - }, + if (this.touch) + { + this.touch.destroy(); + } - preUpdate: function () - { - // override this! - // Arguments: time, delta - }, + for (var i = 0; i < this.pointers.length; i++) + { + this.pointers[i].destroy(); + } - render: function () - { - // override this! - // Arguments: renderer, camera, calcMatrix + this.pointers = []; + this._tempHitTest = []; + this._tempMatrix.destroy(); + this.canvas = null; + this.game = null; } }); -module.exports = Extern; +module.exports = InputManager; /***/ }), -/* 445 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 12499: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CircumferencePoint = __webpack_require__(218); -var FromPercent = __webpack_require__(98); -var MATH_CONST = __webpack_require__(14); -var Point = __webpack_require__(4); +var Circle = __webpack_require__(26673); +var CircleContains = __webpack_require__(65650); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(72687); +var CreateInteractiveObject = __webpack_require__(27395); +var CreatePixelPerfectHandler = __webpack_require__(18104); +var DistanceBetween = __webpack_require__(53996); +var Ellipse = __webpack_require__(95669); +var EllipseContains = __webpack_require__(72313); +var Events = __webpack_require__(33963); +var EventEmitter = __webpack_require__(6659); +var GetFastValue = __webpack_require__(72632); +var GEOM_CONST = __webpack_require__(52394); +var InputPluginCache = __webpack_require__(63399); +var IsPlainObject = __webpack_require__(42911); +var PluginCache = __webpack_require__(91963); +var Rectangle = __webpack_require__(74118); +var RectangleContains = __webpack_require__(94287); +var SceneEvents = __webpack_require__(7599); +var Triangle = __webpack_require__(66349); +var TriangleContains = __webpack_require__(60689); /** - * Returns a Point object containing the coordinates of a point on the circumference of the Ellipse - * based on the given angle normalized to the range 0 to 1. I.e. a value of 0.5 will give the point - * at 180 degrees around the circle. - * - * @function Phaser.Geom.Ellipse.GetPoint - * @since 3.0.0 + * @classdesc + * The Input Plugin belongs to a Scene and handles all input related events and operations for it. * - * @generic {Phaser.Geom.Point} O - [out,$return] + * You can access it from within a Scene using `this.input`. * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the circumference point on. - * @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse. - * @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created. + * It emits events directly. For example, you can do: * - * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the ellipse. - */ -var GetPoint = function (ellipse, position, out) -{ - if (out === undefined) { out = new Point(); } - - var angle = FromPercent(position, 0, MATH_CONST.PI2); - - return CircumferencePoint(ellipse, angle, out); -}; - -module.exports = GetPoint; - - -/***/ }), -/* 446 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Circumference = __webpack_require__(447); -var CircumferencePoint = __webpack_require__(218); -var FromPercent = __webpack_require__(98); -var MATH_CONST = __webpack_require__(14); - -/** - * Returns an array of Point objects containing the coordinates of the points around the circumference of the Ellipse, - * based on the given quantity or stepRate values. + * ```javascript + * this.input.on('pointerdown', callback, context); + * ``` * - * @function Phaser.Geom.Ellipse.GetPoints - * @since 3.0.0 + * To listen for a pointer down event anywhere on the game canvas. * - * @generic {Phaser.Geom.Point[]} O - [out,$return] + * Game Objects can be enabled for input by calling their `setInteractive` method. After which they + * will directly emit input events: * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the points from. - * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. - * @param {number} [stepRate] - Sets the quantity by getting the circumference of the ellipse and dividing it by the stepRate. - * @param {(array|Phaser.Geom.Point[])} [out] - An array to insert the points in to. If not provided a new array will be created. + * ```javascript + * var sprite = this.add.sprite(x, y, texture); + * sprite.setInteractive(); + * sprite.on('pointerdown', callback, context); + * ``` * - * @return {(array|Phaser.Geom.Point[])} An array of Point objects pertaining to the points around the circumference of the ellipse. - */ -var GetPoints = function (ellipse, quantity, stepRate, out) -{ - if (out === undefined) { out = []; } - - // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!quantity && stepRate > 0) - { - quantity = Circumference(ellipse) / stepRate; - } - - for (var i = 0; i < quantity; i++) - { - var angle = FromPercent(i / quantity, 0, MATH_CONST.PI2); - - out.push(CircumferencePoint(ellipse, angle)); - } - - return out; -}; - -module.exports = GetPoints; - - -/***/ }), -/* 447 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Returns the circumference of the given Ellipse. + * There are lots of game configuration options available relating to input. + * See the [Input Config object]{@linkcode Phaser.Types.Core.InputConfig} for more details, including how to deal with Phaser + * listening for input events outside of the canvas, how to set a default number of pointers, input + * capture settings and more. * - * @function Phaser.Geom.Ellipse.Circumference - * @since 3.0.0 + * Please also see the Input examples and tutorials for further information. * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the circumference of. + * **Incorrect input coordinates with Angular** * - * @return {number} The circumference of th Ellipse. - */ -var Circumference = function (ellipse) -{ - var rx = ellipse.width / 2; - var ry = ellipse.height / 2; - var h = Math.pow((rx - ry), 2) / Math.pow((rx + ry), 2); - - return (Math.PI * (rx + ry)) * (1 + ((3 * h) / (10 + Math.sqrt(4 - (3 * h))))); -}; - -module.exports = Circumference; - - -/***/ }), -/* 448 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Commands = __webpack_require__(217); -var SetTransform = __webpack_require__(30); - -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * If you are using Phaser within Angular, and use nglf or the router, to make the component in which the Phaser game resides + * change state (i.e. appear or disappear) then you'll need to notify the Scale Manager about this, as Angular will mess with + * the DOM in a way in which Phaser can't detect directly. Call `this.scale.updateBounds()` as part of your game init in order + * to refresh the canvas DOM bounds values, which Phaser uses for input point position calculations. * - * @method Phaser.GameObjects.Graphics#renderCanvas + * @class InputPlugin + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Input + * @constructor * @since 3.0.0 - * @private * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Graphics} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - * @param {CanvasRenderingContext2D} [renderTargetCtx] - The target rendering context. - * @param {boolean} allowClip - If `true` then path operations will be used instead of fill operations. + * @param {Phaser.Scene} scene - A reference to the Scene that this Input Plugin is responsible for. */ -var GraphicsCanvasRenderer = function (renderer, src, camera, parentMatrix, renderTargetCtx, allowClip) -{ - var commandBuffer = src.commandBuffer; - var commandBufferLength = commandBuffer.length; - - var ctx = renderTargetCtx || renderer.currentContext; - - if (commandBufferLength === 0 || !SetTransform(renderer, ctx, src, camera, parentMatrix)) - { - return; - } - - camera.addToRenderList(src); +var InputPlugin = new Class({ - var lineAlpha = 1; - var fillAlpha = 1; - var lineColor = 0; - var fillColor = 0; - var lineWidth = 1; - var red = 0; - var green = 0; - var blue = 0; + Extends: EventEmitter, - // Reset any currently active paths - ctx.beginPath(); + initialize: - for (var index = 0; index < commandBufferLength; ++index) + function InputPlugin (scene) { - var commandID = commandBuffer[index]; - - switch (commandID) - { - case Commands.ARC: - ctx.arc( - commandBuffer[index + 1], - commandBuffer[index + 2], - commandBuffer[index + 3], - commandBuffer[index + 4], - commandBuffer[index + 5], - commandBuffer[index + 6] - ); - - // +7 because overshoot is the 7th value, not used in Canvas - index += 7; - break; - - case Commands.LINE_STYLE: - lineWidth = commandBuffer[index + 1]; - lineColor = commandBuffer[index + 2]; - lineAlpha = commandBuffer[index + 3]; - red = ((lineColor & 0xFF0000) >>> 16); - green = ((lineColor & 0xFF00) >>> 8); - blue = (lineColor & 0xFF); - ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + lineAlpha + ')'; - ctx.lineWidth = lineWidth; - index += 3; - break; - - case Commands.FILL_STYLE: - fillColor = commandBuffer[index + 1]; - fillAlpha = commandBuffer[index + 2]; - red = ((fillColor & 0xFF0000) >>> 16); - green = ((fillColor & 0xFF00) >>> 8); - blue = (fillColor & 0xFF); - ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')'; - index += 2; - break; - - case Commands.BEGIN_PATH: - ctx.beginPath(); - break; - - case Commands.CLOSE_PATH: - ctx.closePath(); - break; - - case Commands.FILL_PATH: - if (!allowClip) - { - ctx.fill(); - } - break; - - case Commands.STROKE_PATH: - if (!allowClip) - { - ctx.stroke(); - } - break; - - case Commands.FILL_RECT: - if (!allowClip) - { - ctx.fillRect( - commandBuffer[index + 1], - commandBuffer[index + 2], - commandBuffer[index + 3], - commandBuffer[index + 4] - ); - } - else - { - ctx.rect( - commandBuffer[index + 1], - commandBuffer[index + 2], - commandBuffer[index + 3], - commandBuffer[index + 4] - ); - } - index += 4; - break; - - case Commands.FILL_TRIANGLE: - ctx.beginPath(); - ctx.moveTo(commandBuffer[index + 1], commandBuffer[index + 2]); - ctx.lineTo(commandBuffer[index + 3], commandBuffer[index + 4]); - ctx.lineTo(commandBuffer[index + 5], commandBuffer[index + 6]); - ctx.closePath(); - if (!allowClip) - { - ctx.fill(); - } - index += 6; - break; - - case Commands.STROKE_TRIANGLE: - ctx.beginPath(); - ctx.moveTo(commandBuffer[index + 1], commandBuffer[index + 2]); - ctx.lineTo(commandBuffer[index + 3], commandBuffer[index + 4]); - ctx.lineTo(commandBuffer[index + 5], commandBuffer[index + 6]); - ctx.closePath(); - if (!allowClip) - { - ctx.stroke(); - } - index += 6; - break; - - case Commands.LINE_TO: - ctx.lineTo( - commandBuffer[index + 1], - commandBuffer[index + 2] - ); - index += 2; - break; - - case Commands.MOVE_TO: - ctx.moveTo( - commandBuffer[index + 1], - commandBuffer[index + 2] - ); - index += 2; - break; - - case Commands.LINE_FX_TO: - ctx.lineTo( - commandBuffer[index + 1], - commandBuffer[index + 2] - ); - index += 5; - break; - - case Commands.MOVE_FX_TO: - ctx.moveTo( - commandBuffer[index + 1], - commandBuffer[index + 2] - ); - index += 5; - break; - - case Commands.SAVE: - ctx.save(); - break; - - case Commands.RESTORE: - ctx.restore(); - break; - - case Commands.TRANSLATE: - ctx.translate( - commandBuffer[index + 1], - commandBuffer[index + 2] - ); - index += 2; - break; - - case Commands.SCALE: - ctx.scale( - commandBuffer[index + 1], - commandBuffer[index + 2] - ); - index += 2; - break; - - case Commands.ROTATE: - ctx.rotate( - commandBuffer[index + 1] - ); - index += 1; - break; - - case Commands.GRADIENT_FILL_STYLE: - index += 5; - break; - - case Commands.GRADIENT_LINE_STYLE: - index += 6; - break; - } - } + EventEmitter.call(this); - // Restore the context saved in SetTransform - ctx.restore(); -}; + /** + * A reference to the Scene that this Input Plugin is responsible for. + * + * @name Phaser.Input.InputPlugin#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; -module.exports = GraphicsCanvasRenderer; + /** + * A reference to the Scene Systems class. + * + * @name Phaser.Input.InputPlugin#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; + /** + * A reference to the Scene Systems Settings. + * + * @name Phaser.Input.InputPlugin#settings + * @type {Phaser.Types.Scenes.SettingsObject} + * @since 3.5.0 + */ + this.settings = scene.sys.settings; -/***/ }), -/* 449 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * A reference to the Game Input Manager. + * + * @name Phaser.Input.InputPlugin#manager + * @type {Phaser.Input.InputManager} + * @since 3.0.0 + */ + this.manager = scene.sys.game.input; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Internal event queue used for plugins only. + * + * @name Phaser.Input.InputPlugin#pluginEvents + * @type {Phaser.Events.EventEmitter} + * @private + * @since 3.10.0 + */ + this.pluginEvents = new EventEmitter(); -var Class = __webpack_require__(0); -var FloatBetween = __webpack_require__(137); -var GetEaseFunction = __webpack_require__(80); -var GetFastValue = __webpack_require__(2); -var Wrap = __webpack_require__(68); + /** + * If `true` this Input Plugin will process DOM input events. + * + * @name Phaser.Input.InputPlugin#enabled + * @type {boolean} + * @default true + * @since 3.5.0 + */ + this.enabled = true; -/** - * @classdesc - * A Particle Emitter property. - * - * Facilitates changing Particle properties as they are emitted and throughout their lifetime. - * - * @class EmitterOp - * @memberof Phaser.GameObjects.Particles - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig} config - Settings for the Particle Emitter that owns this property. - * @param {string} key - The name of the property. - * @param {number} defaultValue - The default value of the property. - * @param {boolean} [emitOnly=false] - Whether the property can only be modified when a Particle is emitted. - */ -var EmitterOp = new Class({ + /** + * A reference to the Scene Display List. This property is set during the `boot` method. + * + * @name Phaser.Input.InputPlugin#displayList + * @type {Phaser.GameObjects.DisplayList} + * @since 3.0.0 + */ + this.displayList; - initialize: + /** + * A reference to the Scene Cameras Manager. This property is set during the `boot` method. + * + * @name Phaser.Input.InputPlugin#cameras + * @type {Phaser.Cameras.Scene2D.CameraManager} + * @since 3.0.0 + */ + this.cameras; - function EmitterOp (config, key, defaultValue, emitOnly) - { - if (emitOnly === undefined) - { - emitOnly = false; - } + // Inject the available input plugins into this class + InputPluginCache.install(this); /** - * The name of this property. + * A reference to the Mouse Manager. * - * @name Phaser.GameObjects.Particles.EmitterOp#propertyKey - * @type {string} + * This property is only set if Mouse support has been enabled in your Game Configuration file. + * + * If you just wish to get access to the mouse pointer, use the `mousePointer` property instead. + * + * @name Phaser.Input.InputPlugin#mouse + * @type {?Phaser.Input.Mouse.MouseManager} * @since 3.0.0 */ - this.propertyKey = key; + this.mouse = this.manager.mouse; /** - * The value of this property. + * When set to `true` (the default) the Input Plugin will emulate DOM behavior by only emitting events from + * the top-most Game Objects in the Display List. * - * @name Phaser.GameObjects.Particles.EmitterOp#propertyValue - * @type {number} + * If set to `false` it will emit events from all Game Objects below a Pointer, not just the top one. + * + * @name Phaser.Input.InputPlugin#topOnly + * @type {boolean} + * @default true * @since 3.0.0 */ - this.propertyValue = defaultValue; + this.topOnly = true; /** - * The default value of this property. + * How often should the Pointers be checked? * - * @name Phaser.GameObjects.Particles.EmitterOp#defaultValue + * The value is a time, given in ms, and is the time that must have elapsed between game steps before + * the Pointers will be polled again. When a pointer is polled it runs a hit test to see which Game + * Objects are currently below it, or being interacted with it. + * + * Pointers will *always* be checked if they have been moved by the user, or press or released. + * + * This property only controls how often they will be polled if they have not been updated. + * You should set this if you want to have Game Objects constantly check against the pointers, even + * if the pointer didn't itself move. + * + * Set to 0 to poll constantly. Set to -1 to only poll on user movement. + * + * @name Phaser.Input.InputPlugin#pollRate * @type {number} + * @default -1 * @since 3.0.0 */ - this.defaultValue = defaultValue; + this.pollRate = -1; /** - * The number of steps for stepped easing between {@link Phaser.GameObjects.Particles.EmitterOp#start} and - * {@link Phaser.GameObjects.Particles.EmitterOp#end} values, per emit. + * Internal poll timer value. * - * @name Phaser.GameObjects.Particles.EmitterOp#steps + * @name Phaser.Input.InputPlugin#_pollTimer * @type {number} + * @private * @default 0 * @since 3.0.0 */ - this.steps = 0; + this._pollTimer = 0; + + var _eventData = { cancelled: false }; /** - * The step counter for stepped easing, per emit. + * Internal event propagation callback container. * - * @name Phaser.GameObjects.Particles.EmitterOp#counter - * @type {number} - * @default 0 - * @since 3.0.0 + * @name Phaser.Input.InputPlugin#_eventContainer + * @type {Phaser.Types.Input.EventData} + * @private + * @since 3.13.0 */ - this.counter = 0; + this._eventContainer = { + stopPropagation: function () + { + _eventData.cancelled = true; + } + }; /** - * The start value for this property to ease between. + * Internal event propagation data object. * - * @name Phaser.GameObjects.Particles.EmitterOp#start + * @name Phaser.Input.InputPlugin#_eventData + * @type {object} + * @private + * @since 3.13.0 + */ + this._eventData = _eventData; + + /** + * The distance, in pixels, a pointer has to move while being held down, before it thinks it is being dragged. + * + * @name Phaser.Input.InputPlugin#dragDistanceThreshold * @type {number} * @default 0 * @since 3.0.0 */ - this.start = 0; + this.dragDistanceThreshold = 0; /** - * The end value for this property to ease between. + * The amount of time, in ms, a pointer has to be held down before it thinks it is dragging. * - * @name Phaser.GameObjects.Particles.EmitterOp#end + * The default polling rate is to poll only on move so once the time threshold is reached the + * drag event will not start until you move the mouse. If you want it to start immediately + * when the time threshold is reached, you must increase the polling rate by calling + * [setPollAlways]{@linkcode Phaser.Input.InputPlugin#setPollAlways} or + * [setPollRate]{@linkcode Phaser.Input.InputPlugin#setPollRate}. + * + * @name Phaser.Input.InputPlugin#dragTimeThreshold * @type {number} * @default 0 * @since 3.0.0 */ - this.end = 0; + this.dragTimeThreshold = 0; /** - * The easing function to use for updating this property. + * Used to temporarily store the results of the Hit Test * - * @name Phaser.GameObjects.Particles.EmitterOp#ease - * @type {?function} + * @name Phaser.Input.InputPlugin#_temp + * @type {array} + * @private + * @default [] * @since 3.0.0 */ - this.ease; + this._temp = []; /** - * Whether this property can only be modified when a Particle is emitted. - * - * Set to `true` to allow only {@link Phaser.GameObjects.Particles.EmitterOp#onEmit} callbacks to be set and - * affect this property. + * Used to temporarily store the results of the Hit Test dropZones * - * Set to `false` to allow both {@link Phaser.GameObjects.Particles.EmitterOp#onEmit} and - * {@link Phaser.GameObjects.Particles.EmitterOp#onUpdate} callbacks to be set and affect this property. + * @name Phaser.Input.InputPlugin#_tempZones + * @type {array} + * @private + * @default [] + * @since 3.0.0 + */ + this._tempZones = []; + + /** + * A list of all Game Objects that have been set to be interactive in the Scene this Input Plugin is managing. * - * @name Phaser.GameObjects.Particles.EmitterOp#emitOnly - * @type {boolean} + * @name Phaser.Input.InputPlugin#_list + * @type {Phaser.GameObjects.GameObject[]} + * @private + * @default [] * @since 3.0.0 */ - this.emitOnly = emitOnly; + this._list = []; /** - * The callback to run for Particles when they are emitted from the Particle Emitter. + * Objects waiting to be inserted to the list on the next call to 'begin'. * - * @name Phaser.GameObjects.Particles.EmitterOp#onEmit - * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitCallback} + * @name Phaser.Input.InputPlugin#_pendingInsertion + * @type {Phaser.GameObjects.GameObject[]} + * @private + * @default [] * @since 3.0.0 */ - this.onEmit = this.defaultEmit; + this._pendingInsertion = []; /** - * The callback to run for Particles when they are updated. + * Objects waiting to be removed from the list on the next call to 'begin'. * - * @name Phaser.GameObjects.Particles.EmitterOp#onUpdate - * @type {Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateCallback} + * @name Phaser.Input.InputPlugin#_pendingRemoval + * @type {Phaser.GameObjects.GameObject[]} + * @private + * @default [] * @since 3.0.0 */ - this.onUpdate = this.defaultUpdate; + this._pendingRemoval = []; - this.loadConfig(config); - }, + /** + * A list of all Game Objects that have been enabled for dragging. + * + * @name Phaser.Input.InputPlugin#_draggable + * @type {Phaser.GameObjects.GameObject[]} + * @private + * @default [] + * @since 3.0.0 + */ + this._draggable = []; - /** - * Load the property from a Particle Emitter configuration object. - * - * Optionally accepts a new property key to use, replacing the current one. - * - * @method Phaser.GameObjects.Particles.EmitterOp#loadConfig - * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig} [config] - Settings for the Particle Emitter that owns this property. - * @param {string} [newKey] - The new key to use for this property, if any. - */ - loadConfig: function (config, newKey) - { - if (config === undefined) - { - config = {}; - } + /** + * A list of all Interactive Objects currently considered as being 'draggable' by any pointer, indexed by pointer ID. + * + * @name Phaser.Input.InputPlugin#_drag + * @type {{0:Array,1:Array,2:Array,3:Array,4:Array,5:Array,6:Array,7:Array,8:Array,9:Array,10:Array}} + * @private + * @since 3.0.0 + */ + this._drag = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [] }; - if (newKey) - { - this.propertyKey = newKey; - } + /** + * A array containing the dragStates, for this Scene, index by the Pointer ID. + * + * @name Phaser.Input.InputPlugin#_dragState + * @type {number[]} + * @private + * @since 3.16.0 + */ + this._dragState = []; - this.propertyValue = GetFastValue( - config, - this.propertyKey, - this.defaultValue - ); + /** + * A list of all Interactive Objects currently considered as being 'over' by any pointer, indexed by pointer ID. + * + * @name Phaser.Input.InputPlugin#_over + * @type {{0:Array,1:Array,2:Array,3:Array,4:Array,5:Array,6:Array,7:Array,8:Array,9:Array,10:Array}} + * @private + * @since 3.0.0 + */ + this._over = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [] }; - this.setMethods(); + /** + * A list of valid DOM event types. + * + * @name Phaser.Input.InputPlugin#_validTypes + * @type {string[]} + * @private + * @since 3.0.0 + */ + this._validTypes = [ 'onDown', 'onUp', 'onOver', 'onOut', 'onMove', 'onDragStart', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragLeave', 'onDragOver', 'onDrop' ]; - if (this.emitOnly) - { - // Reset it back again - this.onUpdate = this.defaultUpdate; - } + /** + * Internal property that tracks frame event state. + * + * @name Phaser.Input.InputPlugin#_updatedThisFrame + * @type {boolean} + * @private + * @since 3.18.0 + */ + this._updatedThisFrame = false; + + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); }, /** - * Build a JSON representation of this Particle Emitter property. - * - * @method Phaser.GameObjects.Particles.EmitterOp#toJSON - * @since 3.0.0 + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. * - * @return {object} A JSON representation of this Particle Emitter property. + * @method Phaser.Input.InputPlugin#boot + * @fires Phaser.Input.Events#BOOT + * @private + * @since 3.5.1 */ - toJSON: function () + boot: function () { - return this.propertyValue; + this.cameras = this.systems.cameras; + + this.displayList = this.systems.displayList; + + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); + + // Registered input plugins listen for this + this.pluginEvents.emit(Events.BOOT); }, /** - * Change the current value of the property and update its callback methods. - * - * @method Phaser.GameObjects.Particles.EmitterOp#onChange - * @since 3.0.0 + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. * - * @param {number} value - The value of the property. + * @method Phaser.Input.InputPlugin#start + * @fires Phaser.Input.Events#START + * @private + * @since 3.5.0 + */ + start: function () + { + var eventEmitter = this.systems.events; + + eventEmitter.on(SceneEvents.TRANSITION_START, this.transitionIn, this); + eventEmitter.on(SceneEvents.TRANSITION_OUT, this.transitionOut, this); + eventEmitter.on(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); + + this.manager.events.on(Events.GAME_OUT, this.onGameOut, this); + this.manager.events.on(Events.GAME_OVER, this.onGameOver, this); + + this.enabled = true; + + // Populate the pointer drag states + this._dragState = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; + + // Registered input plugins listen for this + this.pluginEvents.emit(Events.START); + }, + + /** + * Game Over handler. * - * @return {this} This Emitter Op object. + * @method Phaser.Input.InputPlugin#onGameOver + * @fires Phaser.Input.Events#GAME_OVER + * @private + * @since 3.16.2 */ - onChange: function (value) + onGameOver: function (event) { - this.propertyValue = value; + if (this.isActive()) + { + this.emit(Events.GAME_OVER, event.timeStamp, event); + } + }, - return this.setMethods(); + /** + * Game Out handler. + * + * @method Phaser.Input.InputPlugin#onGameOut + * @fires Phaser.Input.Events#GAME_OUT + * @private + * @since 3.16.2 + */ + onGameOut: function (event) + { + if (this.isActive()) + { + this.emit(Events.GAME_OUT, event.timeStamp, event); + } }, /** - * Update the {@link Phaser.GameObjects.Particles.EmitterOp#onEmit} and - * {@link Phaser.GameObjects.Particles.EmitterOp#onUpdate} callbacks based on the type of the current - * {@link Phaser.GameObjects.Particles.EmitterOp#propertyValue}. + * The pre-update handler is responsible for checking the pending removal and insertion lists and + * deleting old Game Objects. * - * @method Phaser.GameObjects.Particles.EmitterOp#setMethods + * @method Phaser.Input.InputPlugin#preUpdate + * @private + * @fires Phaser.Input.Events#PRE_UPDATE * @since 3.0.0 - * - * @return {this} This Emitter Op object. */ - setMethods: function () + preUpdate: function () { - var value = this.propertyValue; + // Registered input plugins listen for this + this.pluginEvents.emit(Events.PRE_UPDATE); - var t = typeof value; + var removeList = this._pendingRemoval; + var insertList = this._pendingInsertion; - // Reset them in case they're not changed below - this.onEmit = this.defaultEmit; - this.onUpdate = this.defaultUpdate; + var toRemove = removeList.length; + var toInsert = insertList.length; - if (t === 'number') + if (toRemove === 0 && toInsert === 0) { - // Explicit static value: - // x: 400 - - this.onEmit = this.staticValueEmit; - this.onUpdate = this.staticValueUpdate; // How? + // Quick bail + return; } - else if (Array.isArray(value)) - { - // Picks a random element from the array: - // x: [ 100, 200, 300, 400 ] - this.onEmit = this.randomStaticValueEmit; - } - else if (t === 'function') + var current = this._list; + + // Delete old gameObjects + for (var i = 0; i < toRemove; i++) { - // The same as setting just the onUpdate function and no onEmit (unless this op is an emitOnly one) - // Custom callback, must return a value: + var gameObject = removeList[i]; - /* - x: function (particle, key, t, value) - { - return value + 50; - } - */ + var index = current.indexOf(gameObject); - if (this.emitOnly) - { - this.onEmit = value; - } - else + if (index > -1) { - this.onUpdate = value; + current.splice(index, 1); + + this.clear(gameObject, true); } } - else if (t === 'object' && this.hasBoth(value, 'start', 'end')) + + // Clear the removal list + this._pendingRemoval.length = 0; + + // Move pendingInsertion to list (also clears pendingInsertion at the same time) + this._list = current.concat(insertList.splice(0)); + }, + + /** + * Checks to see if both this plugin and the Scene to which it belongs is active. + * + * @method Phaser.Input.InputPlugin#isActive + * @since 3.10.0 + * + * @return {boolean} `true` if the plugin and the Scene it belongs to is active. + */ + isActive: function () + { + return (this.enabled && this.scene.sys.canInput()); + }, + + /** + * This is called automatically by the Input Manager. + * It emits events for plugins to listen to and also handles polling updates, if enabled. + * + * @method Phaser.Input.InputPlugin#updatePoll + * @since 3.18.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * + * @return {boolean} `true` if the plugin and the Scene it belongs to is active. + */ + updatePoll: function (time, delta) + { + if (!this.isActive()) + { + return false; + } + + // The plugins should update every frame, regardless if there has been + // any DOM input events or not (such as the Gamepad and Keyboard) + this.pluginEvents.emit(Events.UPDATE, time, delta); + + // We can leave now if we've already updated once this frame via the immediate DOM event handlers + if (this._updatedThisFrame) { - this.start = value.start; - this.end = value.end; + this._updatedThisFrame = false; - // x: { start: 100, end: 400, random: true } (random optional) = eases between start and end + return false; + } - var isRandom = this.has(value, 'random'); + var i; + var manager = this.manager; - if (isRandom) - { - this.onEmit = this.randomRangedValueEmit; - } + var pointers = manager.pointers; + var pointersTotal = manager.pointersTotal; - if (this.has(value, 'steps')) - { - // A stepped (per emit) range + for (i = 0; i < pointersTotal; i++) + { + pointers[i].updateMotion(); + } - // x: { start: 100, end: 400, steps: 64 } + // No point going any further if there aren't any interactive objects + if (this._list.length === 0) + { + return false; + } - // Increments a value stored in the emitter + var rate = this.pollRate; - this.steps = value.steps; - this.counter = this.start; + if (rate === -1) + { + return false; + } + else if (rate > 0) + { + this._pollTimer -= delta; - this.onEmit = this.steppedEmit; + if (this._pollTimer < 0) + { + // Discard timer diff, we're ready to poll again + this._pollTimer = this.pollRate; } else { - // An eased range (defaults to Linear if not specified) + // Not enough time has elapsed since the last poll, so abort now + return false; + } + } - // x: { start: 100, end: 400, [ ease: 'Linear' ] } + // We got this far? Then we should poll for movement + var captured = false; - var easeType = this.has(value, 'ease') ? value.ease : 'Linear'; + for (i = 0; i < pointersTotal; i++) + { + var total = 0; - this.ease = GetEaseFunction(easeType, value.easeParams); + var pointer = pointers[i]; + + // Always reset this array + this._tempZones = []; + + // _temp contains a hit tested and camera culled list of IO objects + this._temp = this.hitTestPointer(pointer); - if (!isRandom) + this.sortGameObjects(this._temp, pointer); + this.sortDropZones(this._tempZones); + + if (this.topOnly) + { + // Only the top-most one counts now, so safely ignore the rest + if (this._temp.length) { - this.onEmit = this.easedValueEmit; + this._temp.splice(1); } - this.onUpdate = this.easeValueUpdate; + if (this._tempZones.length) + { + this._tempZones.splice(1); + } } - } - else if (t === 'object' && this.hasBoth(value, 'min', 'max')) - { - // { min: 100, max: 400 } = pick a random number between min and max - this.start = value.min; - this.end = value.max; - this.onEmit = this.randomRangedValueEmit; - } - else if (t === 'object' && this.has(value, 'random')) - { - // { random: [ 100, 400 ] } = pick a random number between the two elements of the array + total += this.processOverOutEvents(pointer); - var rnd = value.random; + if (this.getDragState(pointer) === 2) + { + this.processDragThresholdEvent(pointer, time); + } - if (Array.isArray(rnd)) + if (total > 0) { - this.start = rnd[0]; - this.end = rnd[1]; + // We interacted with an event in this Scene, so block any Scenes below us from doing the same this frame + captured = true; } + } + + return captured; + }, - this.onEmit = this.randomRangedValueEmit; + /** + * This method is called when a DOM Event is received by the Input Manager. It handles dispatching the events + * to relevant input enabled Game Objects in this scene. + * + * @method Phaser.Input.InputPlugin#update + * @private + * @fires Phaser.Input.Events#UPDATE + * @since 3.0.0 + * + * @param {number} type - The type of event to process. + * @param {Phaser.Input.Pointer[]} pointers - An array of Pointers on which the event occurred. + * + * @return {boolean} `true` if this Scene has captured the input events from all other Scenes, otherwise `false`. + */ + update: function (type, pointers) + { + if (!this.isActive()) + { + return false; } - else if (t === 'object' && this.hasEither(value, 'onEmit', 'onUpdate')) + + var pointersTotal = pointers.length; + var captured = false; + + for (var i = 0; i < pointersTotal; i++) { - // Custom onEmit and onUpdate callbacks + var total = 0; + var pointer = pointers[i]; - /* - x: { - // Called at the start of the particles life, when it is being created - onEmit: function (particle, key, t, value) + // Always reset this array + this._tempZones = []; + + // _temp contains a hit tested and camera culled list of IO objects + this._temp = this.hitTestPointer(pointer); + + this.sortGameObjects(this._temp, pointer); + this.sortDropZones(this._tempZones); + + if (this.topOnly) + { + // Only the top-most one counts now, so safely ignore the rest + if (this._temp.length) { - return value; - }, + this._temp.splice(1); + } - // Called during the particles life on each update - onUpdate: function (particle, key, t, value) + if (this._tempZones.length) { - return value; + this._tempZones.splice(1); } } - */ - if (this.has(value, 'onEmit')) + switch (type) { - this.onEmit = value.onEmit; + case CONST.MOUSE_DOWN: + total += this.processDragDownEvent(pointer); + total += this.processDownEvents(pointer); + total += this.processOverOutEvents(pointer); + break; + + case CONST.MOUSE_UP: + total += this.processDragUpEvent(pointer); + total += this.processUpEvents(pointer); + total += this.processOverOutEvents(pointer); + break; + + case CONST.TOUCH_START: + total += this.processDragDownEvent(pointer); + total += this.processDownEvents(pointer); + total += this.processOverEvents(pointer); + break; + + case CONST.TOUCH_END: + case CONST.TOUCH_CANCEL: + total += this.processDragUpEvent(pointer); + total += this.processUpEvents(pointer); + total += this.processOutEvents(pointer); + break; + + case CONST.MOUSE_MOVE: + case CONST.TOUCH_MOVE: + total += this.processDragMoveEvent(pointer); + total += this.processMoveEvents(pointer); + total += this.processOverOutEvents(pointer); + break; + + case CONST.MOUSE_WHEEL: + total += this.processWheelEvent(pointer); + break; } - if (this.has(value, 'onUpdate')) + if (total > 0) { - this.onUpdate = value.onUpdate; + // We interacted with an event in this Scene, so block any Scenes below us from doing the same this frame + captured = true; } } - return this; + this._updatedThisFrame = true; + + return captured; }, /** - * Check whether an object has the given property. + * Clears a Game Object so it no longer has an Interactive Object associated with it. + * The Game Object is then queued for removal from the Input Plugin on the next update. * - * @method Phaser.GameObjects.Particles.EmitterOp#has + * @method Phaser.Input.InputPlugin#clear * @since 3.0.0 * - * @param {object} object - The object to check. - * @param {string} key - The key of the property to look for in the object. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will have its Interactive Object removed. + * @param {boolean} [skipQueue=false] - Skip adding this Game Object into the removal queue? * - * @return {boolean} `true` if the property exists in the object, `false` otherwise. + * @return {Phaser.GameObjects.GameObject} The Game Object that had its Interactive Object removed. */ - has: function (object, key) + clear: function (gameObject, skipQueue) { - return object.hasOwnProperty(key); + if (skipQueue === undefined) { skipQueue = false; } + + this.disable(gameObject); + + var input = gameObject.input; + + // If GameObject.input already cleared from higher class + if (input) + { + this.removeDebug(gameObject); + + input.gameObject = undefined; + input.target = undefined; + input.hitArea = undefined; + input.hitAreaCallback = undefined; + input.callbackContext = undefined; + + gameObject.input = null; + } + + if (!skipQueue) + { + this.queueForRemoval(gameObject); + } + + var index = this._draggable.indexOf(gameObject); + + if (index > -1) + { + this._draggable.splice(index, 1); + } + + return gameObject; }, /** - * Check whether an object has both of the given properties. + * Disables Input on a single Game Object. * - * @method Phaser.GameObjects.Particles.EmitterOp#hasBoth + * An input disabled Game Object still retains its Interactive Object component and can be re-enabled + * at any time, by passing it to `InputPlugin.enable`. + * + * @method Phaser.Input.InputPlugin#disable * @since 3.0.0 * - * @param {object} object - The object to check. - * @param {string} key1 - The key of the first property to check the object for. - * @param {string} key2 - The key of the second property to check the object for. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to have its input system disabled. * - * @return {boolean} `true` if both properties exist in the object, `false` otherwise. + * @return {this} This Input Plugin. */ - hasBoth: function (object, key1, key2) + disable: function (gameObject) { - return object.hasOwnProperty(key1) && object.hasOwnProperty(key2); + var input = gameObject.input; + + if (input) + { + input.enabled = false; + input.dragState = 0; + } + + // Clear from _temp, _drag and _over + var temp = this._temp; + var drag = this._drag; + var over = this._over; + var manager = this.manager; + + var index = temp.indexOf(gameObject); + + if (index > -1) + { + temp.splice(index, 1); + } + + for (var i = 0; i < manager.pointersTotal; i++) + { + index = drag[i].indexOf(gameObject); + + if (index > -1) + { + drag[i].splice(index, 1); + } + + index = over[i].indexOf(gameObject); + + if (index > -1) + { + over[i].splice(index, 1); + + manager.resetCursor(input); + } + } + + return this; }, /** - * Check whether an object has at least one of the given properties. + * Enable a Game Object for interaction. * - * @method Phaser.GameObjects.Particles.EmitterOp#hasEither - * @since 3.0.0 + * If the Game Object already has an Interactive Object component, it is enabled and returned. * - * @param {object} object - The object to check. - * @param {string} key1 - The key of the first property to check the object for. - * @param {string} key2 - The key of the second property to check the object for. + * Otherwise, a new Interactive Object component is created and assigned to the Game Object's `input` property. * - * @return {boolean} `true` if at least one of the properties exists in the object, `false` if neither exist. - */ - hasEither: function (object, key1, key2) - { - return object.hasOwnProperty(key1) || object.hasOwnProperty(key2); - }, - - /** - * The returned value sets what the property will be at the START of the particles life, on emit. + * Input works by using hit areas, these are nearly always geometric shapes, such as rectangles or circles, that act as the hit area + * for the Game Object. However, you can provide your own hit area shape and callback, should you wish to handle some more advanced + * input detection. * - * @method Phaser.GameObjects.Particles.EmitterOp#defaultEmit + * If no arguments are provided it will try and create a rectangle hit area based on the texture frame the Game Object is using. If + * this isn't a texture-bound object, such as a Graphics or BitmapText object, this will fail, and you'll need to provide a specific + * shape for it to use. + * + * You can also provide an Input Configuration Object as the only argument to this method. + * + * @method Phaser.Input.InputPlugin#enable * @since 3.0.0 * - * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. - * @param {string} key - The name of the property. - * @param {number} [value] - The current value of the property. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to be enabled for input. + * @param {(Phaser.Types.Input.InputConfiguration|any)} [hitArea] - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. + * @param {Phaser.Types.Input.HitAreaCallback} [hitAreaCallback] - The 'contains' function to invoke to check if the pointer is within the hit area. + * @param {boolean} [dropZone=false] - Is this Game Object a drop zone or not? * - * @return {number} The new value of the property. + * @return {this} This Input Plugin. */ - defaultEmit: function (particle, key, value) + enable: function (gameObject, hitArea, hitAreaCallback, dropZone) { - return value; + if (dropZone === undefined) { dropZone = false; } + + if (gameObject.input) + { + // If it is already has an InteractiveObject then just enable it and return + gameObject.input.enabled = true; + } + else + { + // Create an InteractiveObject and enable it + this.setHitArea(gameObject, hitArea, hitAreaCallback); + } + + if (gameObject.input && dropZone && !gameObject.input.dropZone) + { + gameObject.input.dropZone = dropZone; + } + + return this; }, /** - * The returned value updates the property for the duration of the particles life. + * Takes the given Pointer and performs a hit test against it, to see which interactive Game Objects + * it is currently above. * - * @method Phaser.GameObjects.Particles.EmitterOp#defaultUpdate + * The hit test is performed against which-ever Camera the Pointer is over. If it is over multiple + * cameras, it starts checking the camera at the top of the camera list, and if nothing is found, iterates down the list. + * + * @method Phaser.Input.InputPlugin#hitTestPointer * @since 3.0.0 * - * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. - * @param {string} key - The name of the property. - * @param {number} t - The T value (between 0 and 1) - * @param {number} value - The current value of the property. + * @param {Phaser.Input.Pointer} pointer - The Pointer to check against the Game Objects. * - * @return {number} The new value of the property. + * @return {Phaser.GameObjects.GameObject[]} An array of all the interactive Game Objects the Pointer was above. */ - defaultUpdate: function (particle, key, t, value) + hitTestPointer: function (pointer) { - return value; + var cameras = this.cameras.getCamerasBelowPointer(pointer); + + for (var c = 0; c < cameras.length; c++) + { + var camera = cameras[c]; + + // Get a list of all objects that can be seen by the camera below the pointer in the scene and store in 'over' array. + // All objects in this array are input enabled, as checked by the hitTest method, so we don't need to check later on as well. + var over = this.manager.hitTest(pointer, this._list, camera); + + // Filter out the drop zones + for (var i = 0; i < over.length; i++) + { + var obj = over[i]; + + if (obj.input.dropZone) + { + this._tempZones.push(obj); + } + } + + if (over.length > 0) + { + pointer.camera = camera; + + return over; + } + } + + // If we got this far then there were no Game Objects below the pointer, but it was still over + // a camera, so set that the top-most one into the pointer + + pointer.camera = cameras[0]; + + return []; }, /** - * An `onEmit` callback that returns the current value of the property. + * An internal method that handles the Pointer down event. * - * @method Phaser.GameObjects.Particles.EmitterOp#staticValueEmit + * @method Phaser.Input.InputPlugin#processDownEvents + * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_DOWN + * @fires Phaser.Input.Events#GAMEOBJECT_DOWN + * @fires Phaser.Input.Events#POINTER_DOWN + * @fires Phaser.Input.Events#POINTER_DOWN_OUTSIDE * @since 3.0.0 * - * @return {number} The current value of the property. + * @param {Phaser.Input.Pointer} pointer - The Pointer being tested. + * + * @return {number} The total number of objects interacted with. */ - staticValueEmit: function () + processDownEvents: function (pointer) { - return this.propertyValue; + var total = 0; + var currentlyOver = this._temp; + + var _eventData = this._eventData; + var _eventContainer = this._eventContainer; + + _eventData.cancelled = false; + + var aborted = false; + + // Go through all objects the pointer was over and fire their events / callbacks + for (var i = 0; i < currentlyOver.length; i++) + { + var gameObject = currentlyOver[i]; + + if (!gameObject.input || !gameObject.input.enabled) + { + continue; + } + + total++; + + gameObject.emit(Events.GAMEOBJECT_POINTER_DOWN, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } + + this.emit(Events.GAMEOBJECT_DOWN, pointer, gameObject, _eventContainer); + + if (_eventData.cancelled || !gameObject.input) + { + aborted = true; + break; + } + } + + // If they released outside the canvas, but pressed down inside it, we'll still dispatch the event. + if (!aborted && this.manager) + { + if (pointer.downElement === this.manager.game.canvas) + { + this.emit(Events.POINTER_DOWN, pointer, currentlyOver); + } + else + { + this.emit(Events.POINTER_DOWN_OUTSIDE, pointer); + } + } + + return total; }, /** - * An `onUpdate` callback that returns the current value of the property. + * Returns the drag state of the given Pointer for this Input Plugin. * - * @method Phaser.GameObjects.Particles.EmitterOp#staticValueUpdate - * @since 3.0.0 + * The state will be one of the following: * - * @return {number} The current value of the property. - */ - staticValueUpdate: function () - { - return this.propertyValue; - }, - - /** - * An `onEmit` callback that returns a random value from the current value array. + * 0 = Not dragging anything + * 1 = Primary button down and objects below, so collect a draglist + * 2 = Pointer being checked if meets drag criteria + * 3 = Pointer meets criteria, notify the draglist + * 4 = Pointer actively dragging the draglist and has moved + * 5 = Pointer actively dragging but has been released, notify draglist * - * @method Phaser.GameObjects.Particles.EmitterOp#randomStaticValueEmit - * @since 3.0.0 + * @method Phaser.Input.InputPlugin#getDragState + * @since 3.16.0 * - * @return {number} The new value of the property. + * @param {Phaser.Input.Pointer} pointer - The Pointer to get the drag state for. + * + * @return {number} The drag state of the given Pointer. */ - randomStaticValueEmit: function () + getDragState: function (pointer) { - var randomIndex = Math.floor(Math.random() * this.propertyValue.length); - - return this.propertyValue[randomIndex]; + return this._dragState[pointer.id]; }, /** - * An `onEmit` callback that returns a value between the {@link Phaser.GameObjects.Particles.EmitterOp#start} and - * {@link Phaser.GameObjects.Particles.EmitterOp#end} range. + * Sets the drag state of the given Pointer for this Input Plugin. * - * @method Phaser.GameObjects.Particles.EmitterOp#randomRangedValueEmit - * @since 3.0.0 + * The state must be one of the following values: * - * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. - * @param {string} key - The key of the property. + * 0 = Not dragging anything + * 1 = Primary button down and objects below, so collect a draglist + * 2 = Pointer being checked if meets drag criteria + * 3 = Pointer meets criteria, notify the draglist + * 4 = Pointer actively dragging the draglist and has moved + * 5 = Pointer actively dragging but has been released, notify draglist * - * @return {number} The new value of the property. + * @method Phaser.Input.InputPlugin#setDragState + * @since 3.16.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer to set the drag state for. + * @param {number} state - The drag state value. An integer between 0 and 5. */ - randomRangedValueEmit: function (particle, key) + setDragState: function (pointer, state) { - var value = FloatBetween(this.start, this.end); - - if (particle && particle.data[key]) - { - particle.data[key].min = value; - } - - return value; + this._dragState[pointer.id] = state; }, /** - * An `onEmit` callback that returns a stepped value between the - * {@link Phaser.GameObjects.Particles.EmitterOp#start} and {@link Phaser.GameObjects.Particles.EmitterOp#end} - * range. + * Checks to see if a Pointer is ready to drag the objects below it, based on either a distance + * or time threshold. * - * @method Phaser.GameObjects.Particles.EmitterOp#steppedEmit - * @since 3.0.0 + * @method Phaser.Input.InputPlugin#processDragThresholdEvent + * @private + * @since 3.18.0 * - * @return {number} The new value of the property. + * @param {Phaser.Input.Pointer} pointer - The Pointer to check the drag thresholds on. + * @param {number} time - The current time. */ - steppedEmit: function () + processDragThresholdEvent: function (pointer, time) { - var current = this.counter; + var passed = false; + var timeThreshold = this.dragTimeThreshold; + var distanceThreshold = this.dragDistanceThreshold; - var next = this.counter + (this.end - this.start) / this.steps; + if (distanceThreshold > 0 && DistanceBetween(pointer.x, pointer.y, pointer.downX, pointer.downY) >= distanceThreshold) + { + // It has moved far enough to be considered a drag + passed = true; + } + else if (timeThreshold > 0 && (time >= pointer.downTime + timeThreshold)) + { + // It has been held down long enough to be considered a drag + passed = true; + } - this.counter = Wrap(next, this.start, this.end); + if (passed) + { + this.setDragState(pointer, 3); - return current; + return this.processDragStartList(pointer); + } }, /** - * An `onEmit` callback for an eased property. - * - * It prepares the particle for easing by {@link Phaser.GameObjects.Particles.EmitterOp#easeValueUpdate}. + * Processes the drag list for the given pointer and dispatches the start events for each object on it. * - * @method Phaser.GameObjects.Particles.EmitterOp#easedValueEmit - * @since 3.0.0 + * @method Phaser.Input.InputPlugin#processDragStartList + * @private + * @fires Phaser.Input.Events#DRAG_START + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_START + * @since 3.18.0 * - * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. - * @param {string} key - The name of the property. + * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. * - * @return {number} {@link Phaser.GameObjects.Particles.EmitterOp#start}, as the new value of the property. + * @return {number} The number of items that DRAG_START was called on. */ - easedValueEmit: function (particle, key) + processDragStartList: function (pointer) { - if (particle && particle.data[key]) + // 3 = Pointer meets criteria and is freshly down, notify the draglist + if (this.getDragState(pointer) !== 3) { - var data = particle.data[key]; + return 0; + } - data.min = this.start; - data.max = this.end; + var list = this._drag[pointer.id]; + + for (var i = 0; i < list.length; i++) + { + var gameObject = list[i]; + + var input = gameObject.input; + + input.dragState = 2; + + input.dragStartX = gameObject.x; + input.dragStartY = gameObject.y; + + input.dragStartXGlobal = pointer.worldX; + input.dragStartYGlobal = pointer.worldY; + + input.dragX = input.dragStartXGlobal - input.dragStartX; + input.dragY = input.dragStartYGlobal - input.dragStartY; + + gameObject.emit(Events.GAMEOBJECT_DRAG_START, pointer, input.dragX, input.dragY); + + this.emit(Events.DRAG_START, pointer, gameObject); } - return this.start; + this.setDragState(pointer, 4); + + return list.length; }, /** - * An `onUpdate` callback that returns an eased value between the - * {@link Phaser.GameObjects.Particles.EmitterOp#start} and {@link Phaser.GameObjects.Particles.EmitterOp#end} - * range. + * Processes a 'drag down' event for the given pointer. Checks the pointer state, builds-up the drag list + * and prepares them all for interaction. * - * @method Phaser.GameObjects.Particles.EmitterOp#easeValueUpdate - * @since 3.0.0 + * @method Phaser.Input.InputPlugin#processDragDownEvent + * @private + * @since 3.18.0 * - * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. - * @param {string} key - The name of the property. - * @param {number} t - The T value (between 0 and 1) + * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. * - * @return {number} The new value of the property. + * @return {number} The number of items that were collected on the drag list. */ - easeValueUpdate: function (particle, key, t) + processDragDownEvent: function (pointer) { - var data = particle.data[key]; - - return (data.max - data.min) * this.ease(t) + data.min; - } -}); - -module.exports = EmitterOp; - + var currentlyOver = this._temp; -/***/ }), -/* 450 */ -/***/ (function(module, exports, __webpack_require__) { + if (this._draggable.length === 0 || currentlyOver.length === 0 || !pointer.primaryDown || this.getDragState(pointer) !== 0) + { + // There are no draggable items, no over items or the pointer isn't down, so let's not even bother going further + return 0; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // 1 = Primary button down and objects below, so collect a draglist + this.setDragState(pointer, 1); -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); + // Get draggable objects, sort them, pick the top (or all) and store them somewhere + var draglist = []; -/** - * @classdesc - * The GravityWell action applies a force on the particle to draw it towards, or repel it from, a single point. - * - * The force applied is inversely proportional to the square of the distance from the particle to the point, in accordance with Newton's law of gravity. - * - * This simulates the effect of gravity over large distances (as between planets, for example). - * - * @class GravityWell - * @memberof Phaser.GameObjects.Particles - * @constructor - * @since 3.0.0 - * - * @param {(number|Phaser.Types.GameObjects.Particles.GravityWellConfig)} [x=0] - The x coordinate of the Gravity Well, in world space. - * @param {number} [y=0] - The y coordinate of the Gravity Well, in world space. - * @param {number} [power=0] - The strength of the gravity force - larger numbers produce a stronger force. - * @param {number} [epsilon=100] - The minimum distance for which the gravity force is calculated. - * @param {number} [gravity=50] - The gravitational force of this Gravity Well. - */ -var GravityWell = new Class({ + for (var i = 0; i < currentlyOver.length; i++) + { + var gameObject = currentlyOver[i]; - initialize: + if (gameObject.input.draggable && (gameObject.input.dragState === 0)) + { + draglist.push(gameObject); + } + } - function GravityWell (x, y, power, epsilon, gravity) - { - if (typeof x === 'object') + if (draglist.length === 0) { - var config = x; + this.setDragState(pointer, 0); - x = GetFastValue(config, 'x', 0); - y = GetFastValue(config, 'y', 0); - power = GetFastValue(config, 'power', 0); - epsilon = GetFastValue(config, 'epsilon', 100); - gravity = GetFastValue(config, 'gravity', 50); + return 0; } - else + else if (draglist.length > 1) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (power === undefined) { power = 0; } - if (epsilon === undefined) { epsilon = 100; } - if (gravity === undefined) { gravity = 50; } - } - - /** - * The x coordinate of the Gravity Well, in world space. - * - * @name Phaser.GameObjects.Particles.GravityWell#x - * @type {number} - * @since 3.0.0 - */ - this.x = x; - - /** - * The y coordinate of the Gravity Well, in world space. - * - * @name Phaser.GameObjects.Particles.GravityWell#y - * @type {number} - * @since 3.0.0 - */ - this.y = y; - - /** - * The active state of the Gravity Well. An inactive Gravity Well will not influence any particles. - * - * @name Phaser.GameObjects.Particles.GravityWell#active - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.active = true; + this.sortGameObjects(draglist, pointer); - /** - * Internal gravity value. - * - * @name Phaser.GameObjects.Particles.GravityWell#_gravity - * @type {number} - * @private - * @since 3.0.0 - */ - this._gravity = gravity; + if (this.topOnly) + { + draglist.splice(1); + } + } - /** - * Internal power value. - * - * @name Phaser.GameObjects.Particles.GravityWell#_power - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._power = 0; + // draglist now contains all potential candidates for dragging + this._drag[pointer.id] = draglist; - /** - * Internal epsilon value. - * - * @name Phaser.GameObjects.Particles.GravityWell#_epsilon - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._epsilon = 0; + if (this.dragDistanceThreshold === 0 && this.dragTimeThreshold === 0) + { + // No drag criteria, so snap immediately to mode 3 + this.setDragState(pointer, 3); - /** - * The strength of the gravity force - larger numbers produce a stronger force. - * - * @name Phaser.GameObjects.Particles.GravityWell#power - * @type {number} - * @since 3.0.0 - */ - this.power = power; + return this.processDragStartList(pointer); + } + else + { + // Check the distance / time on the next event + this.setDragState(pointer, 2); - /** - * The minimum distance for which the gravity force is calculated. - * - * @name Phaser.GameObjects.Particles.GravityWell#epsilon - * @type {number} - * @since 3.0.0 - */ - this.epsilon = epsilon; + return 0; + } }, /** - * Takes a Particle and updates it based on the properties of this Gravity Well. + * Processes a 'drag move' event for the given pointer. * - * @method Phaser.GameObjects.Particles.GravityWell#update - * @since 3.0.0 + * @method Phaser.Input.InputPlugin#processDragMoveEvent + * @private + * @fires Phaser.Input.Events#DRAG_ENTER + * @fires Phaser.Input.Events#DRAG + * @fires Phaser.Input.Events#DRAG_LEAVE + * @fires Phaser.Input.Events#DRAG_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_ENTER + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_LEAVE + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_OVER + * @since 3.18.0 * - * @param {Phaser.GameObjects.Particles.Particle} particle - The Particle to update. - * @param {number} delta - The delta time in ms. - * @param {number} step - The delta value divided by 1000. + * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. + * + * @return {number} The number of items that were updated by this drag event. */ - update: function (particle, delta) + processDragMoveEvent: function (pointer) { - var x = this.x - particle.x; - var y = this.y - particle.y; - var dSq = x * x + y * y; - - if (dSq === 0) + // 2 = Pointer being checked if meets drag criteria + if (this.getDragState(pointer) === 2) { - return; + this.processDragThresholdEvent(pointer, this.manager.game.loop.now); } - var d = Math.sqrt(dSq); - - if (dSq < this._epsilon) + if (this.getDragState(pointer) !== 4) { - dSq = this._epsilon; + return 0; } - var factor = ((this._power * delta) / (dSq * d)) * 100; - - particle.velocityX += x * factor; - particle.velocityY += y * factor; - }, + // 4 = Pointer actively dragging the draglist and has moved + var dropZones = this._tempZones; - epsilon: { + var list = this._drag[pointer.id]; - get: function () + for (var i = 0; i < list.length; i++) { - return Math.sqrt(this._epsilon); - }, + var gameObject = list[i]; - set: function (value) - { - this._epsilon = value * value; - } + var input = gameObject.input; - }, + var target = input.target; - power: { + // If this GO has a target then let's check it + if (target) + { + var index = dropZones.indexOf(target); - get: function () - { - return this._power / this._gravity; - }, + // Got a target, are we still over it? + if (index === 0) + { + // We're still over it, and it's still the top of the display list, phew ... + gameObject.emit(Events.GAMEOBJECT_DRAG_OVER, pointer, target); - set: function (value) - { - this._power = value * this._gravity; - } + this.emit(Events.DRAG_OVER, pointer, gameObject, target); + } + else if (index > 0) + { + // Still over it but it's no longer top of the display list (targets must always be at the top) + gameObject.emit(Events.GAMEOBJECT_DRAG_LEAVE, pointer, target); - }, + this.emit(Events.DRAG_LEAVE, pointer, gameObject, target); - gravity: { + input.target = dropZones[0]; - get: function () - { - return this._gravity; - }, + target = input.target; - set: function (value) - { - var pwr = this.power; - this._gravity = value; - this.power = pwr; - } + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, target); - } + this.emit(Events.DRAG_ENTER, pointer, gameObject, target); + } + else + { + // Nope, we've moved on (or the target has!), leave the old target + gameObject.emit(Events.GAMEOBJECT_DRAG_LEAVE, pointer, target); -}); + this.emit(Events.DRAG_LEAVE, pointer, gameObject, target); -module.exports = GravityWell; + // Anything new to replace it? + // Yup! + if (dropZones[0]) + { + input.target = dropZones[0]; + target = input.target; -/***/ }), -/* 451 */ -/***/ (function(module, exports, __webpack_require__) { + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, target); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.emit(Events.DRAG_ENTER, pointer, gameObject, target); + } + else + { + // Nope + input.target = null; + } + } + } + else if (!target && dropZones[0]) + { + input.target = dropZones[0]; -var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(36); -var DistanceBetween = __webpack_require__(50); + target = input.target; -/** - * @classdesc - * A Particle is a simple Game Object controlled by a Particle Emitter and Manager, and rendered by the Manager. - * It uses its own lightweight physics system, and can interact only with its Emitter's bounds and zones. - * - * @class Particle - * @memberof Phaser.GameObjects.Particles - * @constructor - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The Emitter to which this Particle belongs. - */ -var Particle = new Class({ + gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, target); - initialize: + this.emit(Events.DRAG_ENTER, pointer, gameObject, target); + } - function Particle (emitter) - { - /** - * The Emitter to which this Particle belongs. - * - * A Particle can only belong to a single Emitter and is created, updated and destroyed via it. - * - * @name Phaser.GameObjects.Particles.Particle#emitter - * @type {Phaser.GameObjects.Particles.ParticleEmitter} - * @since 3.0.0 - */ - this.emitter = emitter; + var dragX; + var dragY; - /** - * The texture frame used to render this Particle. - * - * @name Phaser.GameObjects.Particles.Particle#frame - * @type {Phaser.Textures.Frame} - * @default null - * @since 3.0.0 - */ - this.frame = null; + if (!gameObject.parentContainer) + { + dragX = pointer.worldX - input.dragX; + dragY = pointer.worldY - input.dragY; + } + else + { + var dx = pointer.worldX - input.dragStartXGlobal; + var dy = pointer.worldY - input.dragStartYGlobal; - /** - * The x coordinate of this Particle. - * - * @name Phaser.GameObjects.Particles.Particle#x - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.x = 0; + var rotation = gameObject.getParentRotation(); - /** - * The y coordinate of this Particle. - * - * @name Phaser.GameObjects.Particles.Particle#y - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.y = 0; + var dxRotated = dx * Math.cos(rotation) + dy * Math.sin(rotation); + var dyRotated = dy * Math.cos(rotation) - dx * Math.sin(rotation); - /** - * The x velocity of this Particle. - * - * @name Phaser.GameObjects.Particles.Particle#velocityX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.velocityX = 0; + dxRotated *= (1 / gameObject.parentContainer.scaleX); + dyRotated *= (1 / gameObject.parentContainer.scaleY); - /** - * The y velocity of this Particle. - * - * @name Phaser.GameObjects.Particles.Particle#velocityY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.velocityY = 0; + dragX = dxRotated + input.dragStartX; + dragY = dyRotated + input.dragStartY; + } - /** - * The x acceleration of this Particle. - * - * @name Phaser.GameObjects.Particles.Particle#accelerationX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.accelerationX = 0; + gameObject.emit(Events.GAMEOBJECT_DRAG, pointer, dragX, dragY); - /** - * The y acceleration of this Particle. - * - * @name Phaser.GameObjects.Particles.Particle#accelerationY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.accelerationY = 0; + this.emit(Events.DRAG, pointer, gameObject, dragX, dragY); + } - /** - * The maximum horizontal velocity this Particle can travel at. - * - * @name Phaser.GameObjects.Particles.Particle#maxVelocityX - * @type {number} - * @default 10000 - * @since 3.0.0 - */ - this.maxVelocityX = 10000; + return list.length; + }, - /** - * The maximum vertical velocity this Particle can travel at. - * - * @name Phaser.GameObjects.Particles.Particle#maxVelocityY - * @type {number} - * @default 10000 - * @since 3.0.0 - */ - this.maxVelocityY = 10000; + /** + * Processes a 'drag down' event for the given pointer. Checks the pointer state, builds-up the drag list + * and prepares them all for interaction. + * + * @method Phaser.Input.InputPlugin#processDragUpEvent + * @fires Phaser.Input.Events#DRAG_END + * @fires Phaser.Input.Events#DROP + * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_END + * @fires Phaser.Input.Events#GAMEOBJECT_DROP + * @private + * @since 3.18.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. + * + * @return {number} The number of items that were updated by this drag event. + */ + processDragUpEvent: function (pointer) + { + // 5 = Pointer was actively dragging but has been released, notify draglist + var list = this._drag[pointer.id]; - /** - * The bounciness, or restitution, of this Particle. - * - * @name Phaser.GameObjects.Particles.Particle#bounce - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.bounce = 0; + for (var i = 0; i < list.length; i++) + { + var gameObject = list[i]; - /** - * The horizontal scale of this Particle. - * - * @name Phaser.GameObjects.Particles.Particle#scaleX - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.scaleX = 1; + var input = gameObject.input; - /** - * The vertical scale of this Particle. - * - * @name Phaser.GameObjects.Particles.Particle#scaleY - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.scaleY = 1; + if (input && input.dragState === 2) + { + input.dragState = 0; - /** - * The alpha value of this Particle. - * - * @name Phaser.GameObjects.Particles.Particle#alpha - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.alpha = 1; + input.dragX = input.localX - gameObject.displayOriginX; + input.dragY = input.localY - gameObject.displayOriginY; - /** - * The angle of this Particle in degrees. - * - * @name Phaser.GameObjects.Particles.Particle#angle - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.angle = 0; + var dropped = false; - /** - * The angle of this Particle in radians. - * - * @name Phaser.GameObjects.Particles.Particle#rotation - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.rotation = 0; + var target = input.target; - /** - * The tint applied to this Particle. - * - * @name Phaser.GameObjects.Particles.Particle#tint - * @type {number} - * @webglOnly - * @since 3.0.0 - */ - this.tint = 0xffffff; + if (target) + { + gameObject.emit(Events.GAMEOBJECT_DROP, pointer, target); - /** - * The lifespan of this Particle in ms. - * - * @name Phaser.GameObjects.Particles.Particle#life - * @type {number} - * @default 1000 - * @since 3.0.0 - */ - this.life = 1000; + this.emit(Events.DROP, pointer, gameObject, target); - /** - * The current life of this Particle in ms. - * - * @name Phaser.GameObjects.Particles.Particle#lifeCurrent - * @type {number} - * @default 1000 - * @since 3.0.0 - */ - this.lifeCurrent = 1000; + input.target = null; - /** - * The delay applied to this Particle upon emission, in ms. - * - * @name Phaser.GameObjects.Particles.Particle#delayCurrent - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.delayCurrent = 0; + dropped = true; + } - /** - * The normalized lifespan T value, where 0 is the start and 1 is the end. - * - * @name Phaser.GameObjects.Particles.Particle#lifeT - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.lifeT = 0; + // And finally the dragend event - /** - * The data used by the ease equation. - * - * @name Phaser.GameObjects.Particles.Particle#data - * @type {object} - * @since 3.0.0 - */ - this.data = { - tint: { min: 0xffffff, max: 0xffffff, current: 0xffffff }, - alpha: { min: 1, max: 1 }, - rotate: { min: 0, max: 0 }, - scaleX: { min: 1, max: 1 }, - scaleY: { min: 1, max: 1 } - }; - }, + if (gameObject.input && gameObject.input.enabled) + { + gameObject.emit(Events.GAMEOBJECT_DRAG_END, pointer, input.dragX, input.dragY, dropped); - /** - * Checks to see if this Particle is alive and updating. - * - * @method Phaser.GameObjects.Particles.Particle#isAlive - * @since 3.0.0 - * - * @return {boolean} `true` if this Particle is alive and updating, otherwise `false`. - */ - isAlive: function () - { - return (this.lifeCurrent > 0); - }, + this.emit(Events.DRAG_END, pointer, gameObject, dropped); + } + } + } - /** - * Resets the position of this particle back to zero. - * - * @method Phaser.GameObjects.Particles.Particle#resetPosition - * @since 3.16.0 - */ - resetPosition: function () - { - this.x = 0; - this.y = 0; + this.setDragState(pointer, 0); + + list.splice(0); + + return 0; }, /** - * Starts this Particle from the given coordinates. + * An internal method that handles the Pointer movement event. * - * @method Phaser.GameObjects.Particles.Particle#fire + * @method Phaser.Input.InputPlugin#processMoveEvents + * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_MOVE + * @fires Phaser.Input.Events#GAMEOBJECT_MOVE + * @fires Phaser.Input.Events#POINTER_MOVE * @since 3.0.0 * - * @param {number} x - The x coordinate to launch this Particle from. - * @param {number} y - The y coordinate to launch this Particle from. + * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. + * + * @return {number} The total number of objects interacted with. */ - fire: function (x, y) + processMoveEvents: function (pointer) { - var emitter = this.emitter; + var total = 0; + var currentlyOver = this._temp; - this.frame = emitter.getFrame(); + var _eventData = this._eventData; + var _eventContainer = this._eventContainer; - if (emitter.emitZone) - { - // Updates particle.x and particle.y during this call - emitter.emitZone.getPoint(this); - } + _eventData.cancelled = false; - if (x === undefined) - { - this.x += emitter.x.onEmit(this, 'x'); - } - else - { - this.x += x; - } + var aborted = false; - if (y === undefined) - { - this.y += emitter.y.onEmit(this, 'y'); - } - else + // Go through all objects the pointer was over and fire their events / callbacks + for (var i = 0; i < currentlyOver.length; i++) { - this.y += y; - } - - this.life = emitter.lifespan.onEmit(this, 'lifespan'); - this.lifeCurrent = this.life; - this.lifeT = 0; + var gameObject = currentlyOver[i]; - var sx = emitter.speedX.onEmit(this, 'speedX'); - var sy = (emitter.speedY) ? emitter.speedY.onEmit(this, 'speedY') : sx; + if (!gameObject.input || !gameObject.input.enabled) + { + continue; + } - if (emitter.radial) - { - var rad = DegToRad(emitter.angle.onEmit(this, 'angle')); + total++; - this.velocityX = Math.cos(rad) * Math.abs(sx); - this.velocityY = Math.sin(rad) * Math.abs(sy); - } - else if (emitter.moveTo) - { - var mx = emitter.moveToX.onEmit(this, 'moveToX'); - var my = (emitter.moveToY) ? emitter.moveToY.onEmit(this, 'moveToY') : mx; + gameObject.emit(Events.GAMEOBJECT_POINTER_MOVE, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); - var angle = Math.atan2(my - this.y, mx - this.x); + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } - var speed = DistanceBetween(this.x, this.y, mx, my) / (this.life / 1000); + this.emit(Events.GAMEOBJECT_MOVE, pointer, gameObject, _eventContainer); - // We know how many pixels we need to move, but how fast? - // var speed = this.distanceToXY(displayObject, x, y) / (maxTime / 1000); + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } - this.velocityX = Math.cos(angle) * speed; - this.velocityY = Math.sin(angle) * speed; - } - else - { - this.velocityX = sx; - this.velocityY = sy; + if (this.topOnly) + { + break; + } } - if (emitter.acceleration) + if (!aborted) { - this.accelerationX = emitter.accelerationX.onEmit(this, 'accelerationX'); - this.accelerationY = emitter.accelerationY.onEmit(this, 'accelerationY'); + this.emit(Events.POINTER_MOVE, pointer, currentlyOver); } - this.maxVelocityX = emitter.maxVelocityX.onEmit(this, 'maxVelocityX'); - this.maxVelocityY = emitter.maxVelocityY.onEmit(this, 'maxVelocityY'); - - this.delayCurrent = emitter.delay.onEmit(this, 'delay'); - - this.scaleX = emitter.scaleX.onEmit(this, 'scaleX'); - this.scaleY = (emitter.scaleY) ? emitter.scaleY.onEmit(this, 'scaleY') : this.scaleX; - - this.angle = emitter.rotate.onEmit(this, 'rotate'); - this.rotation = DegToRad(this.angle); - - this.bounce = emitter.bounce.onEmit(this, 'bounce'); - - this.alpha = emitter.alpha.onEmit(this, 'alpha'); - - this.tint = emitter.tint.onEmit(this, 'tint'); + return total; }, /** - * An internal method that calculates the velocity of the Particle. + * An internal method that handles a mouse wheel event. * - * @method Phaser.GameObjects.Particles.Particle#computeVelocity - * @since 3.0.0 + * @method Phaser.Input.InputPlugin#processWheelEvent + * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_WHEEL + * @fires Phaser.Input.Events#GAMEOBJECT_WHEEL + * @fires Phaser.Input.Events#POINTER_WHEEL + * @since 3.18.0 * - * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The Emitter that is updating this Particle. - * @param {number} delta - The delta time in ms. - * @param {number} step - The delta value divided by 1000. - * @param {array} processors - Particle processors (gravity wells). + * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. + * + * @return {number} The total number of objects interacted with. */ - computeVelocity: function (emitter, delta, step, processors) + processWheelEvent: function (pointer) { - var vx = this.velocityX; - var vy = this.velocityY; + var total = 0; + var currentlyOver = this._temp; - var ax = this.accelerationX; - var ay = this.accelerationY; + var _eventData = this._eventData; + var _eventContainer = this._eventContainer; - var mx = this.maxVelocityX; - var my = this.maxVelocityY; + _eventData.cancelled = false; - vx += (emitter.gravityX * step); - vy += (emitter.gravityY * step); + var aborted = false; - if (ax) - { - vx += (ax * step); - } + var dx = pointer.deltaX; + var dy = pointer.deltaY; + var dz = pointer.deltaZ; - if (ay) + // Go through all objects the pointer was over and fire their events / callbacks + for (var i = 0; i < currentlyOver.length; i++) { - vy += (ay * step); - } + var gameObject = currentlyOver[i]; - if (vx > mx) - { - vx = mx; - } - else if (vx < -mx) - { - vx = -mx; - } + if (!gameObject.input || !gameObject.input.enabled) + { + continue; + } - if (vy > my) - { - vy = my; - } - else if (vy < -my) - { - vy = -my; - } + total++; - this.velocityX = vx; - this.velocityY = vy; + gameObject.emit(Events.GAMEOBJECT_POINTER_WHEEL, pointer, dx, dy, dz, _eventContainer); - // Apply any additional processors - for (var i = 0; i < processors.length; i++) + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } + + this.emit(Events.GAMEOBJECT_WHEEL, pointer, gameObject, dx, dy, dz, _eventContainer); + + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } + } + + if (!aborted) { - processors[i].update(this, delta, step); + this.emit(Events.POINTER_WHEEL, pointer, currentlyOver, dx, dy, dz); } + + return total; }, /** - * Checks if this Particle is still within the bounds defined by the given Emitter. + * An internal method that handles the Pointer over events. + * This is called when a touch input hits the canvas, having previously been off of it. * - * If not, and depending on the Emitter collision flags, the Particle may either stop or rebound. + * @method Phaser.Input.InputPlugin#processOverEvents + * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_OVER + * @fires Phaser.Input.Events#POINTER_OVER + * @since 3.18.0 * - * @method Phaser.GameObjects.Particles.Particle#checkBounds - * @since 3.0.0 + * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The Emitter to check the bounds against. + * @return {number} The total number of objects interacted with. */ - checkBounds: function (emitter) + processOverEvents: function (pointer) { - var bounds = emitter.bounds; - var bounce = -this.bounce; + var currentlyOver = this._temp; - if (this.x < bounds.x && emitter.collideLeft) - { - this.x = bounds.x; - this.velocityX *= bounce; - } - else if (this.x > bounds.right && emitter.collideRight) - { - this.x = bounds.right; - this.velocityX *= bounce; - } + var totalInteracted = 0; - if (this.y < bounds.y && emitter.collideTop) - { - this.y = bounds.y; - this.velocityY *= bounce; - } - else if (this.y > bounds.bottom && emitter.collideBottom) + var total = currentlyOver.length; + + var justOver = []; + + if (total > 0) { - this.y = bounds.bottom; - this.velocityY *= bounce; + var manager = this.manager; + + var _eventData = this._eventData; + var _eventContainer = this._eventContainer; + + _eventData.cancelled = false; + + var aborted = false; + + for (var i = 0; i < total; i++) + { + var gameObject = currentlyOver[i]; + + if (!gameObject.input || !gameObject.input.enabled) + { + continue; + } + + justOver.push(gameObject); + + manager.setCursor(gameObject.input); + + gameObject.emit(Events.GAMEOBJECT_POINTER_OVER, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + + totalInteracted++; + + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } + + this.emit(Events.GAMEOBJECT_OVER, pointer, gameObject, _eventContainer); + + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } + } + + if (!aborted) + { + this.emit(Events.POINTER_OVER, pointer, justOver); + } } + + // Then sort it into display list order + this._over[pointer.id] = justOver; + + return totalInteracted; }, /** - * The main update method for this Particle. - * - * Updates its life values, computes the velocity and repositions the Particle. + * An internal method that handles the Pointer out events. + * This is called when a touch input leaves the canvas, as it can never be 'over' in this case. * - * @method Phaser.GameObjects.Particles.Particle#update - * @since 3.0.0 + * @method Phaser.Input.InputPlugin#processOutEvents + * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OUT + * @fires Phaser.Input.Events#GAMEOBJECT_OUT + * @fires Phaser.Input.Events#POINTER_OUT + * @since 3.18.0 * - * @param {number} delta - The delta time in ms. - * @param {number} step - The delta value divided by 1000. - * @param {array} processors - An optional array of update processors. + * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {boolean} Returns `true` if this Particle has now expired and should be removed, otherwise `false` if still active. + * @return {number} The total number of objects interacted with. */ - update: function (delta, step, processors) + processOutEvents: function (pointer) { - if (this.delayCurrent > 0) - { - this.delayCurrent -= delta; - - return false; - } + var previouslyOver = this._over[pointer.id]; - var emitter = this.emitter; + var totalInteracted = 0; - // How far along in life is this particle? (t = 0 to 1) - var t = 1 - (this.lifeCurrent / this.life); + var total = previouslyOver.length; - this.lifeT = t; + if (total > 0) + { + var manager = this.manager; - this.computeVelocity(emitter, delta, step, processors); + var _eventData = this._eventData; + var _eventContainer = this._eventContainer; - this.x += this.velocityX * step; - this.y += this.velocityY * step; + _eventData.cancelled = false; - if (emitter.bounds) - { - this.checkBounds(emitter); - } + var aborted = false; - if (emitter.deathZone && emitter.deathZone.willKill(this)) - { - this.lifeCurrent = 0; + this.sortGameObjects(previouslyOver, pointer); - // No need to go any further, particle has been killed - return true; - } + for (var i = 0; i < total; i++) + { + var gameObject = previouslyOver[i]; - this.scaleX = emitter.scaleX.onUpdate(this, 'scaleX', t, this.scaleX); + // Call onOut for everything in the previouslyOver array + gameObject = previouslyOver[i]; - if (emitter.scaleY) - { - this.scaleY = emitter.scaleY.onUpdate(this, 'scaleY', t, this.scaleY); - } - else - { - this.scaleY = this.scaleX; - } + if (!gameObject.input || !gameObject.input.enabled) + { + continue; + } - this.angle = emitter.rotate.onUpdate(this, 'rotate', t, this.angle); - this.rotation = DegToRad(this.angle); + manager.resetCursor(gameObject.input); - this.alpha = emitter.alpha.onUpdate(this, 'alpha', t, this.alpha); + gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, _eventContainer); - this.tint = emitter.tint.onUpdate(this, 'tint', t, this.tint); + totalInteracted++; - this.lifeCurrent -= delta; + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } - return (this.lifeCurrent <= 0); - } + this.emit(Events.GAMEOBJECT_OUT, pointer, gameObject, _eventContainer); -}); + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } -module.exports = Particle; + if (!aborted) + { + this.emit(Events.POINTER_OUT, pointer, previouslyOver); + } + } + this._over[pointer.id] = []; + } -/***/ }), -/* 452 */ -/***/ (function(module, exports, __webpack_require__) { + return totalInteracted; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * An internal method that handles the Pointer over and out events. + * + * @method Phaser.Input.InputPlugin#processOverOutEvents + * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_OVER + * @fires Phaser.Input.Events#POINTER_OVER + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OUT + * @fires Phaser.Input.Events#GAMEOBJECT_OUT + * @fires Phaser.Input.Events#POINTER_OUT + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. + * + * @return {number} The total number of objects interacted with. + */ + processOverOutEvents: function (pointer) + { + var currentlyOver = this._temp; -var BlendModes = __webpack_require__(35); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var DeathZone = __webpack_require__(453); -var EdgeZone = __webpack_require__(454); -var EmitterOp = __webpack_require__(449); -var GetFastValue = __webpack_require__(2); -var GetRandom = __webpack_require__(210); -var HasAny = __webpack_require__(455); -var HasValue = __webpack_require__(126); -var Particle = __webpack_require__(451); -var RandomZone = __webpack_require__(456); -var Rectangle = __webpack_require__(10); -var StableSort = __webpack_require__(79); -var Vector2 = __webpack_require__(3); -var Wrap = __webpack_require__(68); + var i; + var gameObject; + var justOut = []; + var justOver = []; + var stillOver = []; + var previouslyOver = this._over[pointer.id]; + var currentlyDragging = this._drag[pointer.id]; -/** - * @classdesc - * A particle emitter represents a single particle stream. - * It controls a pool of {@link Phaser.GameObjects.Particles.Particle Particles} and is controlled by a {@link Phaser.GameObjects.Particles.ParticleEmitterManager Particle Emitter Manager}. - * - * @class ParticleEmitter - * @memberof Phaser.GameObjects.Particles - * @constructor - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Mask - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} manager - The Emitter Manager this Emitter belongs to. - * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig} config - Settings for this emitter. - */ -var ParticleEmitter = new Class({ + var manager = this.manager; - Mixins: [ - Components.BlendMode, - Components.Mask, - Components.ScrollFactor, - Components.Visible - ], + // Go through all objects the pointer was previously over, and see if it still is. + // Splits the previouslyOver array into two parts: justOut and stillOver - initialize: + for (i = 0; i < previouslyOver.length; i++) + { + gameObject = previouslyOver[i]; - function ParticleEmitter (manager, config) - { - /** - * The Emitter Manager this Emitter belongs to. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#manager - * @type {Phaser.GameObjects.Particles.ParticleEmitterManager} - * @since 3.0.0 - */ - this.manager = manager; + if (currentlyOver.indexOf(gameObject) === -1 && currentlyDragging.indexOf(gameObject) === -1) + { + // Not in the currentlyOver array, so must be outside of this object now + justOut.push(gameObject); + } + else + { + // In the currentlyOver array + stillOver.push(gameObject); + } + } - /** - * The texture assigned to particles. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#texture - * @type {Phaser.Textures.Texture} - * @since 3.0.0 - */ - this.texture = manager.texture; + // Go through all objects the pointer is currently over (the hit test results) + // and if not in the previouslyOver array we know it's a new entry, so add to justOver + for (i = 0; i < currentlyOver.length; i++) + { + gameObject = currentlyOver[i]; - /** - * The texture frames assigned to particles. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#frames - * @type {Phaser.Textures.Frame[]} - * @since 3.0.0 - */ - this.frames = [ manager.defaultFrame ]; + // Is this newly over? - /** - * The default texture frame assigned to particles. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#defaultFrame - * @type {Phaser.Textures.Frame} - * @since 3.0.0 - */ - this.defaultFrame = manager.defaultFrame; + if (previouslyOver.indexOf(gameObject) === -1) + { + justOver.push(gameObject); + } + } - /** - * Names of simple configuration properties. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#configFastMap - * @type {object} - * @since 3.0.0 - */ - this.configFastMap = [ - 'active', - 'blendMode', - 'collideBottom', - 'collideLeft', - 'collideRight', - 'collideTop', - 'deathCallback', - 'deathCallbackScope', - 'emitCallback', - 'emitCallbackScope', - 'follow', - 'frequency', - 'gravityX', - 'gravityY', - 'maxParticles', - 'name', - 'on', - 'particleBringToTop', - 'particleClass', - 'radial', - 'timeScale', - 'trackVisible', - 'visible' - ]; + // By this point the arrays are filled, so now we can process what happened... - /** - * Names of complex configuration properties. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#configOpMap - * @type {object} - * @since 3.0.0 - */ - this.configOpMap = [ - 'accelerationX', - 'accelerationY', - 'angle', - 'alpha', - 'bounce', - 'delay', - 'lifespan', - 'maxVelocityX', - 'maxVelocityY', - 'moveToX', - 'moveToY', - 'quantity', - 'rotate', - 'scaleX', - 'scaleY', - 'speedX', - 'speedY', - 'tint', - 'x', - 'y' - ]; + // Process the Just Out objects + var total = justOut.length; - /** - * The name of this Particle Emitter. - * - * Empty by default and never populated by Phaser, this is left for developers to use. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#name - * @type {string} - * @default '' - * @since 3.0.0 - */ - this.name = ''; + var totalInteracted = 0; - /** - * The Particle Class which will be emitted by this Emitter. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#particleClass - * @type {Phaser.GameObjects.Particles.Particle} - * @default Phaser.GameObjects.Particles.Particle - * @since 3.0.0 - */ - this.particleClass = Particle; + var _eventData = this._eventData; + var _eventContainer = this._eventContainer; - /** - * The x-coordinate of the particle origin (where particles will be emitted). - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#x - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setPosition - */ - this.x = new EmitterOp(config, 'x', 0, true); + _eventData.cancelled = false; - /** - * The y-coordinate of the particle origin (where particles will be emitted). - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#y - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setPosition - */ - this.y = new EmitterOp(config, 'y', 0, true); + var aborted = false; - /** - * A radial emitter will emit particles in all directions between angle min and max, - * using {@link Phaser.GameObjects.Particles.ParticleEmitter#speed} as the value. If set to false then this acts as a point Emitter. - * A point emitter will emit particles only in the direction derived from the speedX and speedY values. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#radial - * @type {boolean} - * @default true - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setRadial - */ - this.radial = true; + if (total > 0) + { + this.sortGameObjects(justOut, pointer); - /** - * Horizontal acceleration applied to emitted particles, in pixels per second squared. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#gravityX - * @type {number} - * @default 0 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setGravity - */ - this.gravityX = 0; + // Call onOut for everything in the justOut array + for (i = 0; i < total; i++) + { + gameObject = justOut[i]; - /** - * Vertical acceleration applied to emitted particles, in pixels per second squared. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#gravityY - * @type {number} - * @default 0 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setGravity - */ - this.gravityY = 0; + if (!gameObject.input || !gameObject.input.enabled) + { + continue; + } - /** - * Whether accelerationX and accelerationY are non-zero. Set automatically during configuration. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#acceleration - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.acceleration = false; + // Reset cursor before we emit the event, in case they want to change it during the event + manager.resetCursor(gameObject.input); - /** - * Horizontal acceleration applied to emitted particles, in pixels per second squared. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#accelerationX - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0 - * @since 3.0.0 - */ - this.accelerationX = new EmitterOp(config, 'accelerationX', 0, true); + gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, _eventContainer); - /** - * Vertical acceleration applied to emitted particles, in pixels per second squared. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#accelerationY - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0 - * @since 3.0.0 - */ - this.accelerationY = new EmitterOp(config, 'accelerationY', 0, true); + totalInteracted++; - /** - * The maximum horizontal velocity of emitted particles, in pixels per second squared. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityX - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 10000 - * @since 3.0.0 - */ - this.maxVelocityX = new EmitterOp(config, 'maxVelocityX', 10000, true); + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } - /** - * The maximum vertical velocity of emitted particles, in pixels per second squared. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityY - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 10000 - * @since 3.0.0 - */ - this.maxVelocityY = new EmitterOp(config, 'maxVelocityY', 10000, true); + this.emit(Events.GAMEOBJECT_OUT, pointer, gameObject, _eventContainer); - /** - * The initial horizontal speed of emitted particles, in pixels per second. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#speedX - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setSpeedX - */ - this.speedX = new EmitterOp(config, 'speedX', 0, true); + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } + } - /** - * The initial vertical speed of emitted particles, in pixels per second. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#speedY - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setSpeedY - */ - this.speedY = new EmitterOp(config, 'speedY', 0, true); + if (!aborted) + { + this.emit(Events.POINTER_OUT, pointer, justOut); + } + } - /** - * Whether moveToX and moveToY are nonzero. Set automatically during configuration. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#moveTo - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.moveTo = false; + // Process the Just Over objects + total = justOver.length; - /** - * The x-coordinate emitted particles move toward, when {@link Phaser.GameObjects.Particles.ParticleEmitter#moveTo} is true. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#moveToX - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0 - * @since 3.0.0 - */ - this.moveToX = new EmitterOp(config, 'moveToX', 0, true); + _eventData.cancelled = false; - /** - * The y-coordinate emitted particles move toward, when {@link Phaser.GameObjects.Particles.ParticleEmitter#moveTo} is true. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#moveToY - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0 - * @since 3.0.0 - */ - this.moveToY = new EmitterOp(config, 'moveToY', 0, true); + aborted = false; - /** - * Whether particles will rebound when they meet the emitter bounds. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#bounce - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0 - * @since 3.0.0 - */ - this.bounce = new EmitterOp(config, 'bounce', 0, true); + if (total > 0) + { + this.sortGameObjects(justOver, pointer); - /** - * The horizontal scale of emitted particles. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#scaleX - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 1 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setScale - * @see Phaser.GameObjects.Particles.ParticleEmitter#setScaleX - */ - this.scaleX = new EmitterOp(config, 'scaleX', 1); + // Call onOver for everything in the justOver array + for (i = 0; i < total; i++) + { + gameObject = justOver[i]; - /** - * The vertical scale of emitted particles. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#scaleY - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 1 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setScale - * @see Phaser.GameObjects.Particles.ParticleEmitter#setScaleY - */ - this.scaleY = new EmitterOp(config, 'scaleY', 1); + if (!gameObject.input || !gameObject.input.enabled) + { + continue; + } - /** - * Color tint applied to emitted particles. Value must not include the alpha channel. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#tint - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0xffffff - * @since 3.0.0 - */ - this.tint = new EmitterOp(config, 'tint', 0xffffff); + // Set cursor before we emit the event, in case they want to change it during the event + manager.setCursor(gameObject.input); - /** - * The alpha (transparency) of emitted particles. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#alpha - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 1 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setAlpha - */ - this.alpha = new EmitterOp(config, 'alpha', 1); + gameObject.emit(Events.GAMEOBJECT_POINTER_OVER, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); - /** - * The lifespan of emitted particles, in ms. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#lifespan - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 1000 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setLifespan - */ - this.lifespan = new EmitterOp(config, 'lifespan', 1000, true); + totalInteracted++; - /** - * The angle of the initial velocity of emitted particles, in degrees. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#angle - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default { min: 0, max: 360 } - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setAngle - */ - this.angle = new EmitterOp(config, 'angle', { min: 0, max: 360 }, true); + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } - /** - * The rotation of emitted particles, in degrees. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#rotate - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0 - * @since 3.0.0 - */ - this.rotate = new EmitterOp(config, 'rotate', 0); + this.emit(Events.GAMEOBJECT_OVER, pointer, gameObject, _eventContainer); - /** - * A function to call when a particle is emitted. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallback - * @type {?Phaser.Types.GameObjects.Particles.ParticleEmitterCallback} - * @default null - * @since 3.0.0 - */ - this.emitCallback = null; - - /** - * The calling context for {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallback}. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope - * @type {?*} - * @default null - * @since 3.0.0 - */ - this.emitCallbackScope = null; - - /** - * A function to call when a particle dies. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallback - * @type {?Phaser.Types.GameObjects.Particles.ParticleDeathCallback} - * @default null - * @since 3.0.0 - */ - this.deathCallback = null; - - /** - * The calling context for {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallback}. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope - * @type {?*} - * @default null - * @since 3.0.0 - */ - this.deathCallbackScope = null; - - /** - * Set to hard limit the amount of particle objects this emitter is allowed to create. - * 0 means unlimited. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#maxParticles - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.maxParticles = 0; - - /** - * How many particles are emitted each time particles are emitted (one explosion or one flow cycle). - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#quantity - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 1 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrequency - * @see Phaser.GameObjects.Particles.ParticleEmitter#setQuantity - */ - this.quantity = new EmitterOp(config, 'quantity', 1, true); - - /** - * How many ms to wait after emission before the particles start updating. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#delay - * @type {Phaser.GameObjects.Particles.EmitterOp} - * @default 0 - * @since 3.0.0 - */ - this.delay = new EmitterOp(config, 'delay', 0, true); - - /** - * For a flow emitter, the time interval (>= 0) between particle flow cycles in ms. - * A value of 0 means there is one particle flow cycle for each logic update (the maximum flow frequency). This is the default setting. - * For an exploding emitter, this value will be -1. - * Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#flow} also puts the emitter in flow mode (frequency >= 0). - * Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} also puts the emitter in explode mode (frequency = -1). - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#frequency - * @type {number} - * @default 0 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrequency - */ - this.frequency = 0; - - /** - * Controls if the emitter is currently emitting a particle flow (when frequency >= 0). - * Already alive particles will continue to update until they expire. - * Controlled by {@link Phaser.GameObjects.Particles.ParticleEmitter#start} and {@link Phaser.GameObjects.Particles.ParticleEmitter#stop}. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#on - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.on = true; - - /** - * Newly emitted particles are added to the top of the particle list, i.e. rendered above those already alive. - * Set to false to send them to the back. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#particleBringToTop - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.particleBringToTop = true; - - /** - * The time rate applied to active particles, affecting lifespan, movement, and tweens. Values larger than 1 are faster than normal. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#timeScale - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.timeScale = 1; - - /** - * An object describing a shape to emit particles from. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#emitZone - * @type {?Phaser.GameObjects.Particles.Zones.EdgeZone|Phaser.GameObjects.Particles.Zones.RandomZone} - * @default null - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone - */ - this.emitZone = null; - - /** - * An object describing a shape that deactivates particles when they interact with it. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#deathZone - * @type {?Phaser.GameObjects.Particles.Zones.DeathZone} - * @default null - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setDeathZone - */ - this.deathZone = null; - - /** - * A rectangular boundary constraining particle movement. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#bounds - * @type {?Phaser.Geom.Rectangle} - * @default null - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setBounds - */ - this.bounds = null; - - /** - * Whether particles interact with the left edge of the emitter {@link Phaser.GameObjects.Particles.ParticleEmitter#bounds}. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#collideLeft - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.collideLeft = true; - - /** - * Whether particles interact with the right edge of the emitter {@link Phaser.GameObjects.Particles.ParticleEmitter#bounds}. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#collideRight - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.collideRight = true; - - /** - * Whether particles interact with the top edge of the emitter {@link Phaser.GameObjects.Particles.ParticleEmitter#bounds}. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#collideTop - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.collideTop = true; - - /** - * Whether particles interact with the bottom edge of the emitter {@link Phaser.GameObjects.Particles.ParticleEmitter#bounds}. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#collideBottom - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.collideBottom = true; - - /** - * Whether this emitter updates itself and its particles. - * - * Controlled by {@link Phaser.GameObjects.Particles.ParticleEmitter#pause} - * and {@link Phaser.GameObjects.Particles.ParticleEmitter#resume}. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#active - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.active = true; - - /** - * Set this to false to hide any active particles. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#visible - * @type {boolean} - * @default true - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setVisible - */ - this.visible = true; - - /** - * The blend mode of this emitter's particles. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#blendMode - * @type {number} - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setBlendMode - */ - this.blendMode = BlendModes.NORMAL; - - /** - * A Game Object whose position is used as the particle origin. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#follow - * @type {?Phaser.GameObjects.GameObject} - * @default null - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#startFollow - * @see Phaser.GameObjects.Particles.ParticleEmitter#stopFollow - */ - this.follow = null; - - /** - * The offset of the particle origin from the {@link Phaser.GameObjects.Particles.ParticleEmitter#follow} target. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#followOffset - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#startFollow - */ - this.followOffset = new Vector2(); - - /** - * Whether the emitter's {@link Phaser.GameObjects.Particles.ParticleEmitter#visible} state will track - * the {@link Phaser.GameObjects.Particles.ParticleEmitter#follow} target's visibility state. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#trackVisible - * @type {boolean} - * @default false - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#startFollow - */ - this.trackVisible = false; - - /** - * The current texture frame, as an index of {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#currentFrame - * @type {number} - * @default 0 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame - */ - this.currentFrame = 0; - - /** - * Whether texture {@link Phaser.GameObjects.Particles.ParticleEmitter#frames} are selected at random. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#randomFrame - * @type {boolean} - * @default true - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame - */ - this.randomFrame = true; - - /** - * The number of consecutive particles that receive a single texture frame (per frame cycle). - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#frameQuantity - * @type {number} - * @default 1 - * @since 3.0.0 - * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame - */ - this.frameQuantity = 1; - - /** - * Inactive particles. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#dead - * @type {Phaser.GameObjects.Particles.Particle[]} - * @private - * @since 3.0.0 - */ - this.dead = []; + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } + } - /** - * Active particles - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#alive - * @type {Phaser.GameObjects.Particles.Particle[]} - * @private - * @since 3.0.0 - */ - this.alive = []; + if (!aborted) + { + this.emit(Events.POINTER_OVER, pointer, justOver); + } + } - /** - * The time until the next flow cycle. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#_counter - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._counter = 0; + // Add the contents of justOver to the previously over array + previouslyOver = stillOver.concat(justOver); - /** - * Counts up to {@link Phaser.GameObjects.Particles.ParticleEmitter#frameQuantity}. - * - * @name Phaser.GameObjects.Particles.ParticleEmitter#_frameCounter - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._frameCounter = 0; + // Then sort it into display list order + this._over[pointer.id] = this.sortGameObjects(previouslyOver, pointer); - if (config) - { - this.fromJSON(config); - } + return totalInteracted; }, /** - * Merges configuration settings into the emitter's current settings. + * An internal method that handles the Pointer up events. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#fromJSON + * @method Phaser.Input.InputPlugin#processUpEvents + * @private + * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_UP + * @fires Phaser.Input.Events#GAMEOBJECT_UP + * @fires Phaser.Input.Events#POINTER_UP + * @fires Phaser.Input.Events#POINTER_UP_OUTSIDE * @since 3.0.0 * - * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig} config - Settings for this emitter. + * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. * - * @return {this} This Particle Emitter. + * @return {number} The total number of objects interacted with. */ - fromJSON: function (config) + processUpEvents: function (pointer) { - if (!config) - { - return this; - } + var currentlyOver = this._temp; - // Only update properties from their current state if they exist in the given config + var _eventData = this._eventData; + var _eventContainer = this._eventContainer; - var i = 0; - var key = ''; + _eventData.cancelled = false; + + var aborted = false; - for (i = 0; i < this.configFastMap.length; i++) + // Go through all objects the pointer was over and fire their events / callbacks + for (var i = 0; i < currentlyOver.length; i++) { - key = this.configFastMap[i]; + var gameObject = currentlyOver[i]; - if (HasValue(config, key)) + if (!gameObject.input || !gameObject.input.enabled) { - this[key] = GetFastValue(config, key); + continue; } - } - for (i = 0; i < this.configOpMap.length; i++) - { - key = this.configOpMap[i]; + gameObject.emit(Events.GAMEOBJECT_POINTER_UP, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); - if (HasValue(config, key)) + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) { - this[key].loadConfig(config); + aborted = true; + break; } - } - - this.acceleration = (this.accelerationX.propertyValue !== 0 || this.accelerationY.propertyValue !== 0); - - this.moveTo = (this.moveToX.propertyValue !== 0 || this.moveToY.propertyValue !== 0); - - // Special 'speed' override - - if (HasValue(config, 'speed')) - { - this.speedX.loadConfig(config, 'speed'); - this.speedY = null; - } - - // If you specify speedX, speedY or moveTo then it changes the emitter from radial to a point emitter - if (HasAny(config, [ 'speedX', 'speedY' ]) || this.moveTo) - { - this.radial = false; - } - - // Special 'scale' override - - if (HasValue(config, 'scale')) - { - this.scaleX.loadConfig(config, 'scale'); - this.scaleY = null; - } - - if (HasValue(config, 'callbackScope')) - { - var callbackScope = GetFastValue(config, 'callbackScope', null); - this.emitCallbackScope = callbackScope; - this.deathCallbackScope = callbackScope; - } + this.emit(Events.GAMEOBJECT_UP, pointer, gameObject, _eventContainer); - if (HasValue(config, 'emitZone')) - { - this.setEmitZone(config.emitZone); + if (_eventData.cancelled || !gameObject.input || !gameObject.input.enabled) + { + aborted = true; + break; + } } - if (HasValue(config, 'deathZone')) + // If they released outside the canvas, but pressed down inside it, we'll still dispatch the event. + if (!aborted && this.manager) { - this.setDeathZone(config.deathZone); + if (pointer.upElement === this.manager.game.canvas) + { + this.emit(Events.POINTER_UP, pointer, currentlyOver); + } + else + { + this.emit(Events.POINTER_UP_OUTSIDE, pointer); + } } - if (HasValue(config, 'bounds')) - { - this.setBounds(config.bounds); - } + return currentlyOver.length; + }, - if (HasValue(config, 'followOffset')) + /** + * Queues a Game Object for insertion into this Input Plugin on the next update. + * + * @method Phaser.Input.InputPlugin#queueForInsertion + * @private + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} child - The Game Object to add. + * + * @return {this} This InputPlugin object. + */ + queueForInsertion: function (child) + { + if (this._pendingInsertion.indexOf(child) === -1 && this._list.indexOf(child) === -1) { - this.followOffset.setFromObject(GetFastValue(config, 'followOffset', 0)); + this._pendingInsertion.push(child); } - if (HasValue(config, 'frame')) - { - this.setFrame(config.frame); - } + return this; + }, - if (HasValue(config, 'reserve')) - { - this.reserve(config.reserve); - } + /** + * Queues a Game Object for removal from this Input Plugin on the next update. + * + * @method Phaser.Input.InputPlugin#queueForRemoval + * @private + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} child - The Game Object to remove. + * + * @return {this} This InputPlugin object. + */ + queueForRemoval: function (child) + { + this._pendingRemoval.push(child); return this; }, /** - * Creates a description of this emitter suitable for JSON serialization. + * Sets the draggable state of the given array of Game Objects. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#toJSON + * They can either be set to be draggable, or can have their draggable state removed by passing `false`. + * + * A Game Object will not fire drag events unless it has been specifically enabled for drag. + * + * @method Phaser.Input.InputPlugin#setDraggable * @since 3.0.0 * - * @param {object} [output] - An object to copy output into. + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to change the draggable state on. + * @param {boolean} [value=true] - Set to `true` if the Game Objects should be made draggable, `false` if they should be unset. * - * @return {object} - The output object. + * @return {this} This InputPlugin object. */ - toJSON: function (output) + setDraggable: function (gameObjects, value) { - if (output === undefined) { output = {}; } - - var i = 0; - var key = ''; + if (value === undefined) { value = true; } - for (i = 0; i < this.configFastMap.length; i++) + if (!Array.isArray(gameObjects)) { - key = this.configFastMap[i]; - - output[key] = this[key]; + gameObjects = [ gameObjects ]; } - for (i = 0; i < this.configOpMap.length; i++) + for (var i = 0; i < gameObjects.length; i++) { - key = this.configOpMap[i]; + var gameObject = gameObjects[i]; - if (this[key]) - { - output[key] = this[key].toJSON(); - } - } + gameObject.input.draggable = value; - // special handlers - if (!this.speedY) - { - delete output.speedX; - output.speed = this.speedX.toJSON(); - } + var index = this._draggable.indexOf(gameObject); - if (!this.scaleY) - { - delete output.scaleX; - output.scale = this.scaleX.toJSON(); + if (value && index === -1) + { + this._draggable.push(gameObject); + } + else if (!value && index > -1) + { + this._draggable.splice(index, 1); + } } - return output; + return this; }, /** - * Continuously moves the particle origin to follow a Game Object's position. + * Creates a function that can be passed to `setInteractive`, `enable` or `setHitArea` that will handle + * pixel-perfect input detection on an Image or Sprite based Game Object, or any custom class that extends them. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#startFollow - * @since 3.0.0 + * The following will create a sprite that is clickable on any pixel that has an alpha value >= 1. * - * @param {Phaser.GameObjects.GameObject} target - The Game Object to follow. - * @param {number} [offsetX=0] - Horizontal offset of the particle origin from the Game Object. - * @param {number} [offsetY=0] - Vertical offset of the particle origin from the Game Object. - * @param {boolean} [trackVisible=false] - Whether the emitter's visible state will track the target's visible state. + * ```javascript + * this.add.sprite(x, y, key).setInteractive(this.input.makePixelPerfect()); + * ``` * - * @return {this} This Particle Emitter. + * The following will create a sprite that is clickable on any pixel that has an alpha value >= 150. + * + * ```javascript + * this.add.sprite(x, y, key).setInteractive(this.input.makePixelPerfect(150)); + * ``` + * + * Once you have made an Interactive Object pixel perfect it impacts all input related events for it: down, up, + * dragstart, drag, etc. + * + * As a pointer interacts with the Game Object it will constantly poll the texture, extracting a single pixel from + * the given coordinates and checking its color values. This is an expensive process, so should only be enabled on + * Game Objects that really need it. + * + * You cannot make non-texture based Game Objects pixel perfect. So this will not work on Graphics, BitmapText, + * Render Textures, Text, Tilemaps, Containers or Particles. + * + * @method Phaser.Input.InputPlugin#makePixelPerfect + * @since 3.10.0 + * + * @param {number} [alphaTolerance=1] - The alpha level that the pixel should be above to be included as a successful interaction. + * + * @return {function} A Pixel Perfect Handler for use as a hitArea shape callback. */ - startFollow: function (target, offsetX, offsetY, trackVisible) + makePixelPerfect: function (alphaTolerance) { - if (offsetX === undefined) { offsetX = 0; } - if (offsetY === undefined) { offsetY = 0; } - if (trackVisible === undefined) { trackVisible = false; } + if (alphaTolerance === undefined) { alphaTolerance = 1; } - this.follow = target; - this.followOffset.set(offsetX, offsetY); - this.trackVisible = trackVisible; + var textureManager = this.systems.textures; - return this; + return CreatePixelPerfectHandler(textureManager, alphaTolerance); }, /** - * Stops following a Game Object. + * Sets the hit area for the given array of Game Objects. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#stopFollow - * @since 3.0.0 + * A hit area is typically one of the geometric shapes Phaser provides, such as a `Phaser.Geom.Rectangle` + * or `Phaser.Geom.Circle`. However, it can be any object as long as it works with the provided callback. * - * @return {this} This Particle Emitter. - */ - stopFollow: function () - { - this.follow = null; - this.followOffset.set(0, 0); - this.trackVisible = false; - - return this; - }, - - /** - * Chooses a texture frame from {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. + * If no hit area is provided a Rectangle is created based on the size of the Game Object, if possible + * to calculate. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#getFrame + * The hit area callback is the function that takes an `x` and `y` coordinate and returns a boolean if + * those values fall within the area of the shape or not. All of the Phaser geometry objects provide this, + * such as `Phaser.Geom.Rectangle.Contains`. + * + * @method Phaser.Input.InputPlugin#setHitArea * @since 3.0.0 * - * @return {Phaser.Textures.Frame} The texture frame. + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set the hit area on. + * @param {(Phaser.Types.Input.InputConfiguration|any)} [hitArea] - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. + * @param {Phaser.Types.Input.HitAreaCallback} [hitAreaCallback] - The 'contains' function to invoke to check if the pointer is within the hit area. + * + * @return {this} This InputPlugin object. */ - getFrame: function () + setHitArea: function (gameObjects, hitArea, hitAreaCallback) { - if (this.frames.length === 1) + if (hitArea === undefined) { - return this.defaultFrame; + return this.setHitAreaFromTexture(gameObjects); } - else if (this.randomFrame) + + if (!Array.isArray(gameObjects)) { - return GetRandom(this.frames); + gameObjects = [ gameObjects ]; } - else + + var draggable = false; + var dropZone = false; + var cursor = false; + var useHandCursor = false; + var pixelPerfect = false; + var customHitArea = true; + + // Config object? + if (IsPlainObject(hitArea)) { - var frame = this.frames[this.currentFrame]; + var config = hitArea; + + hitArea = GetFastValue(config, 'hitArea', null); + hitAreaCallback = GetFastValue(config, 'hitAreaCallback', null); + draggable = GetFastValue(config, 'draggable', false); + dropZone = GetFastValue(config, 'dropZone', false); + cursor = GetFastValue(config, 'cursor', false); + useHandCursor = GetFastValue(config, 'useHandCursor', false); - this._frameCounter++; + pixelPerfect = GetFastValue(config, 'pixelPerfect', false); + var alphaTolerance = GetFastValue(config, 'alphaTolerance', 1); - if (this._frameCounter === this.frameQuantity) + if (pixelPerfect) { - this._frameCounter = 0; - this.currentFrame = Wrap(this.currentFrame + 1, 0, this._frameLength); + hitArea = {}; + hitAreaCallback = this.makePixelPerfect(alphaTolerance); } - return frame; + // Still no hitArea or callback? + if (!hitArea || !hitAreaCallback) + { + this.setHitAreaFromTexture(gameObjects); + customHitArea = false; + } } - }, - - // frame: 0 - // frame: 'red' - // frame: [ 0, 1, 2, 3 ] - // frame: [ 'red', 'green', 'blue', 'pink', 'white' ] - // frame: { frames: [ 'red', 'green', 'blue', 'pink', 'white' ], [cycle: bool], [quantity: int] } - - /** - * Sets a pattern for assigning texture frames to emitted particles. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setFrame - * @since 3.0.0 - * - * @param {(array|string|number|Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig)} frames - One or more texture frames, or a configuration object. - * @param {boolean} [pickRandom=true] - Whether frames should be assigned at random from `frames`. - * @param {number} [quantity=1] - The number of consecutive particles that will receive each frame. - * - * @return {this} This Particle Emitter. - */ - setFrame: function (frames, pickRandom, quantity) - { - if (pickRandom === undefined) { pickRandom = true; } - if (quantity === undefined) { quantity = 1; } - - this.randomFrame = pickRandom; - this.frameQuantity = quantity; - this.currentFrame = 0; - this._frameCounter = 0; - - var t = typeof (frames); - - if (Array.isArray(frames) || t === 'string' || t === 'number') + else if (typeof hitArea === 'function' && !hitAreaCallback) { - this.manager.setEmitterFrames(frames, this); + hitAreaCallback = hitArea; + hitArea = {}; } - else if (t === 'object') - { - var frameConfig = frames; - frames = GetFastValue(frameConfig, 'frames', null); + for (var i = 0; i < gameObjects.length; i++) + { + var gameObject = gameObjects[i]; - if (frames) + if (pixelPerfect && gameObject.type === 'Container') { - this.manager.setEmitterFrames(frames, this); + console.warn('Cannot pixelPerfect test a Container. Use a custom callback.'); + continue; } - var isCycle = GetFastValue(frameConfig, 'cycle', false); + var io = (!gameObject.input) ? CreateInteractiveObject(gameObject, hitArea, hitAreaCallback) : gameObject.input; - this.randomFrame = (isCycle) ? false : true; + io.customHitArea = customHitArea; + io.dropZone = dropZone; + io.cursor = (useHandCursor) ? 'pointer' : cursor; - this.frameQuantity = GetFastValue(frameConfig, 'quantity', quantity); - } + gameObject.input = io; - this._frameLength = this.frames.length; + if (draggable) + { + this.setDraggable(gameObject); + } - if (this._frameLength === 1) - { - this.frameQuantity = 1; - this.randomFrame = false; + this.queueForInsertion(gameObject); } return this; }, /** - * Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle movement on or off. + * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Circle` shape, using + * the given coordinates and radius to control its position and size. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setRadial + * @method Phaser.Input.InputPlugin#setHitAreaCircle * @since 3.0.0 * - * @param {boolean} [value=true] - Radial mode (true) or point mode (true). + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set as having a circle hit area. + * @param {number} x - The center of the circle. + * @param {number} y - The center of the circle. + * @param {number} radius - The radius of the circle. + * @param {Phaser.Types.Input.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Circle.Contains. * - * @return {this} This Particle Emitter. + * @return {this} This InputPlugin object. */ - setRadial: function (value) + setHitAreaCircle: function (gameObjects, x, y, radius, callback) { - if (value === undefined) { value = true; } + if (callback === undefined) { callback = CircleContains; } - this.radial = value; + var shape = new Circle(x, y, radius); - return this; + return this.setHitArea(gameObjects, shape, callback); }, /** - * Sets the position of the emitter's particle origin. - * New particles will be emitted here. + * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Ellipse` shape, using + * the given coordinates and dimensions to control its position and size. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setPosition + * @method Phaser.Input.InputPlugin#setHitAreaEllipse * @since 3.0.0 * - * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} x - The x-coordinate of the particle origin. - * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} y - The y-coordinate of the particle origin. + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set as having an ellipse hit area. + * @param {number} x - The center of the ellipse. + * @param {number} y - The center of the ellipse. + * @param {number} width - The width of the ellipse. + * @param {number} height - The height of the ellipse. + * @param {Phaser.Types.Input.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Ellipse.Contains. * - * @return {this} This Particle Emitter. + * @return {this} This InputPlugin object. */ - setPosition: function (x, y) + setHitAreaEllipse: function (gameObjects, x, y, width, height, callback) { - this.x.onChange(x); - this.y.onChange(y); + if (callback === undefined) { callback = EllipseContains; } - return this; + var shape = new Ellipse(x, y, width, height); + + return this.setHitArea(gameObjects, shape, callback); }, /** - * Sets or modifies a rectangular boundary constraining the particles. - * - * To remove the boundary, set {@link Phaser.GameObjects.Particles.ParticleEmitter#bounds} to null. + * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Rectangle` shape, using + * the Game Objects texture frame to define the position and size of the hit area. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setBounds + * @method Phaser.Input.InputPlugin#setHitAreaFromTexture * @since 3.0.0 * - * @param {(number|Phaser.Types.GameObjects.Particles.ParticleEmitterBounds|Phaser.Types.GameObjects.Particles.ParticleEmitterBoundsAlt)} x - The x-coordinate of the left edge of the boundary, or an object representing a rectangle. - * @param {number} y - The y-coordinate of the top edge of the boundary. - * @param {number} width - The width of the boundary. - * @param {number} height - The height of the boundary. + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set as having an ellipse hit area. + * @param {Phaser.Types.Input.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Rectangle.Contains. * - * @return {this} This Particle Emitter. + * @return {this} This InputPlugin object. */ - setBounds: function (x, y, width, height) + setHitAreaFromTexture: function (gameObjects, callback) { - if (typeof x === 'object') - { - var obj = x; - - x = obj.x; - y = obj.y; - width = (HasValue(obj, 'w')) ? obj.w : obj.width; - height = (HasValue(obj, 'h')) ? obj.h : obj.height; - } + if (callback === undefined) { callback = RectangleContains; } - if (this.bounds) + if (!Array.isArray(gameObjects)) { - this.bounds.setTo(x, y, width, height); + gameObjects = [ gameObjects ]; } - else + + for (var i = 0; i < gameObjects.length; i++) { - this.bounds = new Rectangle(x, y, width, height); + var gameObject = gameObjects[i]; + + var frame = gameObject.frame; + + var width = 0; + var height = 0; + + if (gameObject.width) + { + width = gameObject.width; + height = gameObject.height; + } + else if (frame) + { + width = frame.realWidth; + height = frame.realHeight; + } + + if (gameObject.type === 'Container' && (width === 0 || height === 0)) + { + console.warn('Container.setInteractive must specify a Shape or call setSize() first'); + continue; + } + + if (width !== 0 && height !== 0) + { + gameObject.input = CreateInteractiveObject(gameObject, new Rectangle(0, 0, width, height), callback); + + this.queueForInsertion(gameObject); + } } return this; }, /** - * Sets the initial horizontal speed of emitted particles. - * Changes the emitter to point mode. + * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Rectangle` shape, using + * the given coordinates and dimensions to control its position and size. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedX + * @method Phaser.Input.InputPlugin#setHitAreaRectangle * @since 3.0.0 * - * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} value - The speed, in pixels per second. + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set as having a rectangular hit area. + * @param {number} x - The top-left of the rectangle. + * @param {number} y - The top-left of the rectangle. + * @param {number} width - The width of the rectangle. + * @param {number} height - The height of the rectangle. + * @param {Phaser.Types.Input.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Rectangle.Contains. * - * @return {this} This Particle Emitter. + * @return {this} This InputPlugin object. */ - setSpeedX: function (value) + setHitAreaRectangle: function (gameObjects, x, y, width, height, callback) { - this.speedX.onChange(value); + if (callback === undefined) { callback = RectangleContains; } - // If you specify speedX and Y then it changes the emitter from radial to a point emitter - this.radial = false; + var shape = new Rectangle(x, y, width, height); - return this; + return this.setHitArea(gameObjects, shape, callback); }, /** - * Sets the initial vertical speed of emitted particles. - * Changes the emitter to point mode. + * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Triangle` shape, using + * the given coordinates to control the position of its points. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedY + * @method Phaser.Input.InputPlugin#setHitAreaTriangle * @since 3.0.0 * - * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} value - The speed, in pixels per second. + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set as having a triangular hit area. + * @param {number} x1 - The x coordinate of the first point of the triangle. + * @param {number} y1 - The y coordinate of the first point of the triangle. + * @param {number} x2 - The x coordinate of the second point of the triangle. + * @param {number} y2 - The y coordinate of the second point of the triangle. + * @param {number} x3 - The x coordinate of the third point of the triangle. + * @param {number} y3 - The y coordinate of the third point of the triangle. + * @param {Phaser.Types.Input.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Triangle.Contains. * - * @return {this} This Particle Emitter. + * @return {this} This InputPlugin object. */ - setSpeedY: function (value) + setHitAreaTriangle: function (gameObjects, x1, y1, x2, y2, x3, y3, callback) { - if (this.speedY) - { - this.speedY.onChange(value); + if (callback === undefined) { callback = TriangleContains; } - // If you specify speedX and Y then it changes the emitter from radial to a point emitter - this.radial = false; - } + var shape = new Triangle(x1, y1, x2, y2, x3, y3); - return this; + return this.setHitArea(gameObjects, shape, callback); }, /** - * Sets the initial radial speed of emitted particles. - * Changes the emitter to radial mode. + * Creates an Input Debug Shape for the given Game Object. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeed - * @since 3.0.0 + * The Game Object must have _already_ been enabled for input prior to calling this method. + * + * This is intended to assist you during development and debugging. * - * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} value - The speed, in pixels per second. + * Debug Shapes can only be created for Game Objects that are using standard Phaser Geometry for input, + * including: Circle, Ellipse, Line, Polygon, Rectangle and Triangle. * - * @return {this} This Particle Emitter. + * Game Objects that are using their automatic hit areas are using Rectangles by default, so will also work. + * + * The Debug Shape is created and added to the display list and is then kept in sync with the Game Object + * it is connected with. Should you need to modify it yourself, such as to hide it, you can access it via + * the Game Object property: `GameObject.input.hitAreaDebug`. + * + * Calling this method on a Game Object that already has a Debug Shape will first destroy the old shape, + * before creating a new one. If you wish to remove the Debug Shape entirely, you should call the + * method `InputPlugin.removeDebug`. + * + * Note that the debug shape will only show the outline of the input area. If the input test is using a + * pixel perfect check, for example, then this is not displayed. If you are using a custom shape, that + * doesn't extend one of the base Phaser Geometry objects, as your hit area, then this method will not + * work. + * + * @method Phaser.Input.InputPlugin#enableDebug + * @since 3.19.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to create the input debug shape for. + * @param {number} [color=0x00ff00] - The outline color of the debug shape. + * + * @return {this} This Input Plugin. */ - setSpeed: function (value) + enableDebug: function (gameObject, color) { - this.speedX.onChange(value); - this.speedY = null; + if (color === undefined) { color = 0x00ff00; } - // If you specify speedX and Y then it changes the emitter from radial to a point emitter - this.radial = true; + var input = gameObject.input; + + if (!input || !input.hitArea) + { + return this; + } + + var shape = input.hitArea; + var shapeType = shape.type; + var debug = input.hitAreaDebug; + var factory = this.systems.add; + var updateList = this.systems.updateList; + + if (debug) + { + updateList.remove(debug); + + debug.destroy(); + + debug = null; + } + + var offsetx = 0; + var offsety = 0; + + switch (shapeType) + { + case GEOM_CONST.CIRCLE: + debug = factory.arc(0, 0, shape.radius); + offsetx = shape.x - shape.radius; + offsety = shape.y - shape.radius; + break; + + case GEOM_CONST.ELLIPSE: + debug = factory.ellipse(0, 0, shape.width, shape.height); + offsetx = shape.x - shape.width / 2; + offsety = shape.y - shape.height / 2; + break; + + case GEOM_CONST.LINE: + debug = factory.line(0, 0, shape.x1, shape.y1, shape.x2, shape.y2); + break; + + case GEOM_CONST.POLYGON: + debug = factory.polygon(0, 0, shape.points); + break; + + case GEOM_CONST.RECTANGLE: + debug = factory.rectangle(0, 0, shape.width, shape.height); + offsetx = shape.x; + offsety = shape.y; + break; + + case GEOM_CONST.TRIANGLE: + debug = factory.triangle(0, 0, shape.x1, shape.y1, shape.x2, shape.y2, shape.x3, shape.y3); + break; + } + + if (debug) + { + debug.isFilled = false; + debug.strokeColor = color; + + debug.preUpdate = function () + { + debug.setStrokeStyle(1 / gameObject.scale, debug.strokeColor); + + debug.setDisplayOrigin(gameObject.displayOriginX, gameObject.displayOriginY); + + var x = gameObject.x; + var y = gameObject.y; + var rotation = gameObject.rotation; + var scaleX = gameObject.scaleX; + var scaleY = gameObject.scaleY; + + if (gameObject.parentContainer) + { + var matrix = gameObject.getWorldTransformMatrix(); + + x = matrix.tx; + y = matrix.ty; + rotation = matrix.rotation; + scaleX = matrix.scaleX; + scaleY = matrix.scaleY; + } + + debug.setRotation(rotation); + debug.setScale(scaleX, scaleY); + debug.setPosition(x + offsetx * scaleX, y + offsety * scaleY); + debug.setScrollFactor(gameObject.scrollFactorX, gameObject.scrollFactorY); + debug.setDepth(gameObject.depth); + }; + + updateList.add(debug); + + input.hitAreaDebug = debug; + } return this; }, /** - * Sets the horizontal scale of emitted particles. + * Removes an Input Debug Shape from the given Game Object. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleX - * @since 3.0.0 + * The shape is destroyed immediately and the `hitAreaDebug` property is set to `null`. + * + * @method Phaser.Input.InputPlugin#removeDebug + * @since 3.19.0 * - * @param {(Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType)} value - The scale, relative to 1. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to remove the input debug shape from. * - * @return {this} This Particle Emitter. + * @return {this} This Input Plugin. */ - setScaleX: function (value) + removeDebug: function (gameObject) { - this.scaleX.onChange(value); + var input = gameObject.input; + + if (input && input.hitAreaDebug) + { + var debug = input.hitAreaDebug; + + this.systems.updateList.remove(debug); + + debug.destroy(); + + input.hitAreaDebug = null; + } return this; }, /** - * Sets the vertical scale of emitted particles. + * Sets the Pointers to always poll. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleY - * @since 3.0.0 + * When a pointer is polled it runs a hit test to see which Game Objects are currently below it, + * or being interacted with it, regardless if the Pointer has actually moved or not. + * + * You should enable this if you want objects in your game to fire over / out events, and the objects + * are constantly moving, but the pointer may not have. Polling every frame has additional computation + * costs, especially if there are a large number of interactive objects in your game. * - * @param {(Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType)} value - The scale, relative to 1. + * @method Phaser.Input.InputPlugin#setPollAlways + * @since 3.0.0 * - * @return {this} This Particle Emitter. + * @return {this} This InputPlugin object. */ - setScaleY: function (value) + setPollAlways: function () { - this.scaleY.onChange(value); - - return this; + return this.setPollRate(0); }, /** - * Sets the scale of emitted particles. + * Sets the Pointers to only poll when they are moved or updated. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setScale - * @since 3.0.0 + * When a pointer is polled it runs a hit test to see which Game Objects are currently below it, + * or being interacted with it. * - * @param {(Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType)} value - The scale, relative to 1. + * @method Phaser.Input.InputPlugin#setPollOnMove + * @since 3.0.0 * - * @return {this} This Particle Emitter. + * @return {this} This InputPlugin object. */ - setScale: function (value) + setPollOnMove: function () { - this.scaleX.onChange(value); - this.scaleY = null; - - return this; + return this.setPollRate(-1); }, /** - * Sets the horizontal gravity applied to emitted particles. + * Sets the poll rate value. This is the amount of time that should have elapsed before a pointer + * will be polled again. See the `setPollAlways` and `setPollOnMove` methods. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setGravityX + * @method Phaser.Input.InputPlugin#setPollRate * @since 3.0.0 * - * @param {number} value - Acceleration due to gravity, in pixels per second squared. + * @param {number} value - The amount of time, in ms, that should elapsed before re-polling the pointers. * - * @return {this} This Particle Emitter. + * @return {this} This InputPlugin object. */ - setGravityX: function (value) + setPollRate: function (value) { - this.gravityX = value; + this.pollRate = value; + this._pollTimer = 0; return this; }, /** - * Sets the vertical gravity applied to emitted particles. + * When set to `true` the global Input Manager will emulate DOM behavior by only emitting events from + * the top-most Scene in the Scene List. By default, if a Scene receives an input event it will then stop the event + * from flowing down to any Scenes below it in the Scene list. To disable this behavior call this method with `false`. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setGravityY + * @method Phaser.Input.InputPlugin#setGlobalTopOnly * @since 3.0.0 * - * @param {number} value - Acceleration due to gravity, in pixels per second squared. + * @param {boolean} value - Set to `true` to stop processing input events on the Scene that receives it, or `false` to let the event continue down the Scene list. * - * @return {this} This Particle Emitter. + * @return {this} This InputPlugin object. */ - setGravityY: function (value) + setGlobalTopOnly: function (value) { - this.gravityY = value; + this.manager.globalTopOnly = value; return this; }, /** - * Sets the gravity applied to emitted particles. + * When set to `true` this Input Plugin will emulate DOM behavior by only emitting events from + * the top-most Game Objects in the Display List. + * + * If set to `false` it will emit events from all Game Objects below a Pointer, not just the top one. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setGravity + * @method Phaser.Input.InputPlugin#setTopOnly * @since 3.0.0 * - * @param {number} x - Horizontal acceleration due to gravity, in pixels per second squared. - * @param {number} y - Vertical acceleration due to gravity, in pixels per second squared. + * @param {boolean} value - `true` to only include the top-most Game Object, or `false` to include all Game Objects in a hit test. * - * @return {this} This Particle Emitter. + * @return {this} This InputPlugin object. */ - setGravity: function (x, y) + setTopOnly: function (value) { - this.gravityX = x; - this.gravityY = y; + this.topOnly = value; return this; }, /** - * Sets the opacity of emitted particles. + * Given an array of Game Objects and a Pointer, sort the array and return it, + * so that the objects are in render order with the lowest at the bottom. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setAlpha + * @method Phaser.Input.InputPlugin#sortGameObjects * @since 3.0.0 * - * @param {(Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType)} value - A value between 0 (transparent) and 1 (opaque). + * @param {Phaser.GameObjects.GameObject[]} gameObjects - An array of Game Objects to be sorted. + * @param {Phaser.Input.Pointer} pointer - The Pointer to check against the Game Objects. * - * @return {this} This Particle Emitter. + * @return {Phaser.GameObjects.GameObject[]} The sorted array of Game Objects. */ - setAlpha: function (value) + sortGameObjects: function (gameObjects, pointer) { - this.alpha.onChange(value); + if (gameObjects.length < 2 || !pointer.camera) + { + return gameObjects; + } - return this; + var list = pointer.camera.renderList; + + return gameObjects.sort(function (childA, childB) + { + var indexA = Math.max(list.indexOf(childA), 0); + var indexB = Math.max(list.indexOf(childB), 0); + + return indexB - indexA; + }); }, /** - * Sets the color tint of emitted particles. + * Given an array of Drop Zone Game Objects, sort the array and return it, + * so that the objects are in depth index order with the lowest at the bottom. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setTint - * @since 3.22.0 + * @method Phaser.Input.InputPlugin#sortDropZones + * @since 3.52.0 * - * @param {(Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType)} value - A value between 0 and 0xffffff. + * @param {Phaser.GameObjects.GameObject[]} gameObjects - An array of Game Objects to be sorted. * - * @return {this} This Particle Emitter. + * @return {Phaser.GameObjects.GameObject[]} The sorted array of Game Objects. */ - setTint: function (value) + sortDropZones: function (gameObjects) { - this.tint.onChange(value); + if (gameObjects.length < 2) + { + return gameObjects; + } - return this; + this.scene.sys.depthSort(); + + return gameObjects.sort(this.sortDropZoneHandler.bind(this)); }, /** - * Sets the angle of a {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle stream. + * Return the child lowest down the display list (with the smallest index) + * Will iterate through all parent containers, if present. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitterAngle - * @since 3.0.0 + * Prior to version 3.52.0 this method was called `sortHandlerGO`. + * + * @method Phaser.Input.InputPlugin#sortDropZoneHandler + * @private + * @since 3.52.0 * - * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} value - The angle of the initial velocity of emitted particles. + * @param {Phaser.GameObjects.GameObject} childA - The first Game Object to compare. + * @param {Phaser.GameObjects.GameObject} childB - The second Game Object to compare. * - * @return {this} This Particle Emitter. + * @return {number} Returns either a negative or positive integer, or zero if they match. */ - setEmitterAngle: function (value) + sortDropZoneHandler: function (childA, childB) { - this.angle.onChange(value); + if (!childA.parentContainer && !childB.parentContainer) + { + // Quick bail out when neither child has a container + return this.displayList.getIndex(childB) - this.displayList.getIndex(childA); + } + else if (childA.parentContainer === childB.parentContainer) + { + // Quick bail out when both children have the same container + return childB.parentContainer.getIndex(childB) - childA.parentContainer.getIndex(childA); + } + else if (childA.parentContainer === childB) + { + // Quick bail out when childA is a child of childB + return -1; + } + else if (childB.parentContainer === childA) + { + // Quick bail out when childA is a child of childB + return 1; + } + else + { + // Container index check + var listA = childA.getIndexList(); + var listB = childB.getIndexList(); + var len = Math.min(listA.length, listB.length); - return this; - }, + for (var i = 0; i < len; i++) + { + var indexA = listA[i]; + var indexB = listB[i]; - /** - * Sets the angle of a {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle stream. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setAngle - * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} value - The angle of the initial velocity of emitted particles. - * - * @return {this} This Particle Emitter. - */ - setAngle: function (value) - { - this.angle.onChange(value); + if (indexA === indexB) + { + // Go to the next level down + continue; + } + else + { + // Non-matching parents, so return + return indexB - indexA; + } + } - return this; + return listB.length - listA.length; + } + + // Technically this shouldn't happen, but ... + // eslint-disable-next-line no-unreachable + return 0; }, /** - * Sets the lifespan of newly emitted particles. + * This method should be called from within an input event handler, such as `pointerdown`. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setLifespan - * @since 3.0.0 + * When called, it stops the Input Manager from allowing _this specific event_ to be processed by any other Scene + * not yet handled in the scene list. * - * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} value - The particle lifespan, in ms. + * @method Phaser.Input.InputPlugin#stopPropagation + * @since 3.0.0 * - * @return {this} This Particle Emitter. + * @return {this} This InputPlugin object. */ - setLifespan: function (value) + stopPropagation: function () { - this.lifespan.onChange(value); + this.manager._tempSkip = true; return this; }, /** - * Sets the number of particles released at each flow cycle or explosion. + * Adds new Pointer objects to the Input Manager. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setQuantity - * @since 3.0.0 + * By default Phaser creates 2 pointer objects: `mousePointer` and `pointer1`. * - * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} quantity - The number of particles to release at each flow cycle or explosion. + * You can create more either by calling this method, or by setting the `input.activePointers` property + * in the Game Config, up to a maximum of 10 pointers. * - * @return {this} This Particle Emitter. - */ - setQuantity: function (quantity) - { - this.quantity.onChange(quantity); - - return this; - }, - - /** - * Sets the emitter's {@link Phaser.GameObjects.Particles.ParticleEmitter#frequency} - * and {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. + * The first 10 pointers are available via the `InputPlugin.pointerX` properties, once they have been added + * via this method. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setFrequency - * @since 3.0.0 + * @method Phaser.Input.InputPlugin#addPointer + * @since 3.10.0 * - * @param {number} frequency - The time interval (>= 0) of each flow cycle, in ms; or -1 to put the emitter in explosion mode. - * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} [quantity] - The number of particles to release at each flow cycle or explosion. + * @param {number} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total. * - * @return {this} This Particle Emitter. + * @return {Phaser.Input.Pointer[]} An array containing all of the new Pointer objects that were created. */ - setFrequency: function (frequency, quantity) + addPointer: function (quantity) { - this.frequency = frequency; - - this._counter = 0; - - if (quantity) - { - this.quantity.onChange(quantity); - } - - return this; + return this.manager.addPointer(quantity); }, /** - * Sets or removes the {@link Phaser.GameObjects.Particles.ParticleEmitter#emitZone}. - * - * An {@link Phaser.Types.GameObjects.Particles.ParticleEmitterEdgeZoneConfig EdgeZone} places particles on its edges. Its {@link Phaser.Types.GameObjects.Particles.EdgeZoneSource source} can be a Curve, Path, Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable {@link Phaser.Types.GameObjects.Particles.EdgeZoneSourceCallback getPoints} method. + * Tells the Input system to set a custom cursor. * - * A {@link Phaser.Types.GameObjects.Particles.ParticleEmitterRandomZoneConfig RandomZone} places randomly within its interior. Its {@link RandomZoneSource source} can be a Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable {@link Phaser.Types.GameObjects.Particles.RandomZoneSourceCallback getRandomPoint} method. + * This cursor will be the default cursor used when interacting with the game canvas. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone - * @since 3.0.0 + * If an Interactive Object also sets a custom cursor, this is the cursor that is reset after its use. * - * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterEdgeZoneConfig|Phaser.Types.GameObjects.Particles.ParticleEmitterRandomZoneConfig} [zoneConfig] - An object describing the zone, or `undefined` to remove any current emit zone. + * Any valid CSS cursor value is allowed, including paths to image files, i.e.: * - * @return {this} This Particle Emitter. - */ - setEmitZone: function (zoneConfig) - { - if (zoneConfig === undefined) - { - this.emitZone = null; - } - else - { - // Where source = Geom like Circle, or a Path or Curve - // emitZone: { type: 'random', source: X } - // emitZone: { type: 'edge', source: X, quantity: 32, [stepRate=0], [yoyo=false], [seamless=true] } - - var type = GetFastValue(zoneConfig, 'type', 'random'); - var source = GetFastValue(zoneConfig, 'source', null); - - switch (type) - { - case 'random': - - this.emitZone = new RandomZone(source); - - break; - - case 'edge': - - var quantity = GetFastValue(zoneConfig, 'quantity', 1); - var stepRate = GetFastValue(zoneConfig, 'stepRate', 0); - var yoyo = GetFastValue(zoneConfig, 'yoyo', false); - var seamless = GetFastValue(zoneConfig, 'seamless', true); - - this.emitZone = new EdgeZone(source, quantity, stepRate, yoyo, seamless); - - break; - } - } - - return this; - }, - - /** - * Sets or removes the {@link Phaser.GameObjects.Particles.ParticleEmitter#deathZone}. + * ```javascript + * this.input.setDefaultCursor('url(assets/cursors/sword.cur), pointer'); + * ``` * - * @method Phaser.GameObjects.Particles.ParticleEmitter#setDeathZone - * @since 3.0.0 + * Please read about the differences between browsers when it comes to the file formats and sizes they support: * - * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterDeathZoneConfig} [zoneConfig] - An object describing the zone, or `undefined` to remove any current death zone. + * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor + * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_User_Interface/Using_URL_values_for_the_cursor_property * - * @return {this} This Particle Emitter. - */ - setDeathZone: function (zoneConfig) - { - if (zoneConfig === undefined) - { - this.deathZone = null; - } - else - { - // Where source = Geom like Circle or Rect that supports a 'contains' function - // deathZone: { type: 'onEnter', source: X } - // deathZone: { type: 'onLeave', source: X } - - var type = GetFastValue(zoneConfig, 'type', 'onEnter'); - var source = GetFastValue(zoneConfig, 'source', null); - - if (source && typeof source.contains === 'function') - { - var killOnEnter = (type === 'onEnter') ? true : false; - - this.deathZone = new DeathZone(source, killOnEnter); - } - } - - return this; - }, - - /** - * Creates inactive particles and adds them to this emitter's pool. + * It's up to you to pick a suitable cursor format that works across the range of browsers you need to support. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#reserve - * @since 3.0.0 + * @method Phaser.Input.InputPlugin#setDefaultCursor + * @since 3.10.0 * - * @param {number} particleCount - The number of particles to create. + * @param {string} cursor - The CSS to be used when setting the default cursor. * - * @return {this} This Particle Emitter. + * @return {this} This Input instance. */ - reserve: function (particleCount) + setDefaultCursor: function (cursor) { - var dead = this.dead; - - for (var i = 0; i < particleCount; i++) - { - dead.push(new this.particleClass(this)); - } + this.manager.setDefaultCursor(cursor); return this; }, /** - * Gets the number of active (in-use) particles in this emitter. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#getAliveParticleCount - * @since 3.0.0 + * The Scene that owns this plugin is transitioning in. * - * @return {number} The number of particles with `active=true`. + * @method Phaser.Input.InputPlugin#transitionIn + * @private + * @since 3.5.0 */ - getAliveParticleCount: function () + transitionIn: function () { - return this.alive.length; + this.enabled = this.settings.transitionAllowInput; }, /** - * Gets the number of inactive (available) particles in this emitter. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#getDeadParticleCount - * @since 3.0.0 + * The Scene that owns this plugin has finished transitioning in. * - * @return {number} The number of particles with `active=false`. + * @method Phaser.Input.InputPlugin#transitionComplete + * @private + * @since 3.5.0 */ - getDeadParticleCount: function () + transitionComplete: function () { - return this.dead.length; + if (!this.settings.transitionAllowInput) + { + this.enabled = true; + } }, /** - * Gets the total number of particles in this emitter. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#getParticleCount - * @since 3.0.0 + * The Scene that owns this plugin is transitioning out. * - * @return {number} The number of particles, including both alive and dead. + * @method Phaser.Input.InputPlugin#transitionOut + * @private + * @since 3.5.0 */ - getParticleCount: function () + transitionOut: function () { - return this.getAliveParticleCount() + this.getDeadParticleCount(); + this.enabled = this.settings.transitionAllowInput; }, /** - * Whether this emitter is at its limit (if set). + * The Scene that owns this plugin is shutting down. + * We need to kill and reset all internal properties as well as stop listening to Scene events. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#atLimit + * @method Phaser.Input.InputPlugin#shutdown + * @fires Phaser.Input.Events#SHUTDOWN + * @private * @since 3.0.0 - * - * @return {boolean} Returns `true` if this Emitter is at its limit, or `false` if no limit, or below the `maxParticles` level. */ - atLimit: function () + shutdown: function () { - return (this.maxParticles > 0 && this.getParticleCount() === this.maxParticles); - }, + // Registered input plugins listen for this + this.pluginEvents.emit(Events.SHUTDOWN); - /** - * Sets a function to call for each newly emitted particle. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleEmit - * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterCallback} callback - The function. - * @param {*} [context] - The calling context. - * - * @return {this} This Particle Emitter. - */ - onParticleEmit: function (callback, context) - { - if (callback === undefined) + this._temp.length = 0; + this._list.length = 0; + this._draggable.length = 0; + this._pendingRemoval.length = 0; + this._pendingInsertion.length = 0; + this._dragState.length = 0; + + for (var i = 0; i < 10; i++) { - // Clear any previously set callback - this.emitCallback = null; - this.emitCallbackScope = null; + this._drag[i] = []; + this._over[i] = []; } - else if (typeof callback === 'function') - { - this.emitCallback = callback; - if (context) - { - this.emitCallbackScope = context; - } - } + this.removeAllListeners(); - return this; - }, + var manager = this.manager; - /** - * Sets a function to call for each particle death. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleDeath - * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.Particles.ParticleDeathCallback} callback - The function. - * @param {*} [context] - The function's calling context. - * - * @return {this} This Particle Emitter. - */ - onParticleDeath: function (callback, context) - { - if (callback === undefined) - { - // Clear any previously set callback - this.deathCallback = null; - this.deathCallbackScope = null; - } - else if (typeof callback === 'function') - { - this.deathCallback = callback; + manager.canvas.style.cursor = manager.defaultCursor; - if (context) - { - this.deathCallbackScope = context; - } - } + var eventEmitter = this.systems.events; - return this; + eventEmitter.off(SceneEvents.TRANSITION_START, this.transitionIn, this); + eventEmitter.off(SceneEvents.TRANSITION_OUT, this.transitionOut, this); + eventEmitter.off(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + + manager.events.off(Events.GAME_OUT, this.onGameOut, this); + manager.events.off(Events.GAME_OVER, this.onGameOver, this); + + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * Deactivates every particle in this emitter. + * Loops through all of the Input Manager Pointer instances and calls `reset` on them. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#killAll - * @since 3.0.0 + * Use this function if you find that input has been stolen from Phaser via a 3rd + * party component, such as Vue, and you need to tell Phaser to reset the Pointer states. * - * @return {this} This Particle Emitter. + * @method Phaser.Input.InputPlugin#resetPointers + * @since 3.60.0 */ - killAll: function () + resetPointers: function () { - var dead = this.dead; - var alive = this.alive; + var pointers = this.manager.pointers; - while (alive.length > 0) + for (var i = 0; i < pointers.length; i++) { - dead.push(alive.pop()); + pointers[i].reset(); } - - return this; }, /** - * Calls a function for each active particle in this emitter. + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#forEachAlive + * @method Phaser.Input.InputPlugin#destroy + * @fires Phaser.Input.Events#DESTROY + * @private * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterCallback} callback - The function. - * @param {*} context - The function's calling context. - * - * @return {this} This Particle Emitter. */ - forEachAlive: function (callback, context) + destroy: function () { - var alive = this.alive; - var length = alive.length; + this.shutdown(); - for (var index = 0; index < length; ++index) - { - // Sends the Particle and the Emitter - callback.call(context, alive[index], this); - } + // Registered input plugins listen for this + this.pluginEvents.emit(Events.DESTROY); - return this; + this.pluginEvents.removeAllListeners(); + + this.scene.sys.events.off(SceneEvents.START, this.start, this); + + this.scene = null; + this.cameras = null; + this.manager = null; + this.events = null; + this.mouse = null; }, /** - * Calls a function for each inactive particle in this emitter. + * The x coordinates of the ActivePointer based on the first camera in the camera list. + * This is only safe to use if your game has just 1 non-transformed camera and doesn't use multi-touch. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#forEachDead + * @name Phaser.Input.InputPlugin#x + * @type {number} + * @readonly * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterCallback} callback - The function. - * @param {*} context - The function's calling context. - * - * @return {this} This Particle Emitter. */ - forEachDead: function (callback, context) - { - var dead = this.dead; - var length = dead.length; + x: { - for (var index = 0; index < length; ++index) + get: function () { - // Sends the Particle and the Emitter - callback.call(context, dead[index], this); + return this.manager.activePointer.x; } - return this; }, /** - * Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#on} the emitter and resets the flow counter. - * - * If this emitter is in flow mode (frequency >= 0; the default), the particle flow will start (or restart). - * - * If this emitter is in explode mode (frequency = -1), nothing will happen. - * Use {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} or {@link Phaser.GameObjects.Particles.ParticleEmitter#flow} instead. + * The y coordinates of the ActivePointer based on the first camera in the camera list. + * This is only safe to use if your game has just 1 non-transformed camera and doesn't use multi-touch. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#start + * @name Phaser.Input.InputPlugin#y + * @type {number} + * @readonly * @since 3.0.0 - * - * @return {this} This Particle Emitter. */ - start: function () - { - this.on = true; + y: { - this._counter = 0; + get: function () + { + return this.manager.activePointer.y; + } - return this; }, /** - * Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#on off} the emitter. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#stop - * @since 3.11.0 + * Are any mouse or touch pointers currently over the game canvas? * - * @return {this} This Particle Emitter. + * @name Phaser.Input.InputPlugin#isOver + * @type {boolean} + * @readonly + * @since 3.16.0 */ - stop: function () - { - this.on = false; + isOver: { + + get: function () + { + return this.manager.isOver; + } - return this; }, /** - * {@link Phaser.GameObjects.Particles.ParticleEmitter#active Deactivates} the emitter. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#pause - * @since 3.0.0 + * The mouse has its own unique Pointer object, which you can reference directly if making a _desktop specific game_. + * If you are supporting both desktop and touch devices then do not use this property, instead use `activePointer` + * which will always map to the most recently interacted pointer. * - * @return {this} This Particle Emitter. + * @name Phaser.Input.InputPlugin#mousePointer + * @type {Phaser.Input.Pointer} + * @readonly + * @since 3.10.0 */ - pause: function () - { - this.active = false; + mousePointer: { + + get: function () + { + return this.manager.mousePointer; + } - return this; }, /** - * {@link Phaser.GameObjects.Particles.ParticleEmitter#active Activates} the emitter. + * The current active input Pointer. * - * @method Phaser.GameObjects.Particles.ParticleEmitter#resume + * @name Phaser.Input.InputPlugin#activePointer + * @type {Phaser.Input.Pointer} + * @readonly * @since 3.0.0 - * - * @return {this} This Particle Emitter. */ - resume: function () - { - this.active = true; + activePointer: { + + get: function () + { + return this.manager.activePointer; + } - return this; }, /** - * Removes the emitter from its manager and the scene. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#remove - * @since 3.22.0 + * A touch-based Pointer object. + * This will be `undefined` by default unless you add a new Pointer using `addPointer`. * - * @return {this} This Particle Emitter. + * @name Phaser.Input.InputPlugin#pointer1 + * @type {Phaser.Input.Pointer} + * @readonly + * @since 3.10.0 */ - remove: function () - { - this.manager.removeEmitter(this); + pointer1: { + + get: function () + { + return this.manager.pointers[1]; + } - return this; }, /** - * Sorts active particles with {@link Phaser.GameObjects.Particles.ParticleEmitter#depthSortCallback}. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#depthSort - * @since 3.0.0 + * A touch-based Pointer object. + * This will be `undefined` by default unless you add a new Pointer using `addPointer`. * - * @return {this} This Particle Emitter. + * @name Phaser.Input.InputPlugin#pointer2 + * @type {Phaser.Input.Pointer} + * @readonly + * @since 3.10.0 */ - depthSort: function () - { - StableSort(this.alive, this.depthSortCallback); + pointer2: { + + get: function () + { + return this.manager.pointers[2]; + } - return this; }, /** - * Puts the emitter in flow mode (frequency >= 0) and starts (or restarts) a particle flow. - * - * To resume a flow at the current frequency and quantity, use {@link Phaser.GameObjects.Particles.ParticleEmitter#start} instead. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#flow - * @since 3.0.0 - * - * @param {number} frequency - The time interval (>= 0) of each flow cycle, in ms. - * @param {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} [count=1] - The number of particles to emit at each flow cycle. + * A touch-based Pointer object. + * This will be `undefined` by default unless you add a new Pointer using `addPointer`. * - * @return {this} This Particle Emitter. + * @name Phaser.Input.InputPlugin#pointer3 + * @type {Phaser.Input.Pointer} + * @readonly + * @since 3.10.0 */ - flow: function (frequency, count) - { - if (count === undefined) { count = 1; } - - this.frequency = frequency; + pointer3: { - this.quantity.onChange(count); + get: function () + { + return this.manager.pointers[3]; + } - return this.start(); }, /** - * Puts the emitter in explode mode (frequency = -1), stopping any current particle flow, and emits several particles all at once. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#explode - * @since 3.0.0 - * - * @param {number} count - The amount of Particles to emit. - * @param {number} x - The x coordinate to emit the Particles from. - * @param {number} y - The y coordinate to emit the Particles from. + * A touch-based Pointer object. + * This will be `undefined` by default unless you add a new Pointer using `addPointer`. * - * @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle. + * @name Phaser.Input.InputPlugin#pointer4 + * @type {Phaser.Input.Pointer} + * @readonly + * @since 3.10.0 */ - explode: function (count, x, y) - { - this.frequency = -1; + pointer4: { - return this.emitParticle(count, x, y); - }, + get: function () + { + return this.manager.pointers[4]; + } - /** - * Emits particles at a given position (or the emitter's current position). - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#emitParticleAt - * @since 3.0.0 - * - * @param {number} [x=this.x] - The x coordinate to emit the Particles from. - * @param {number} [y=this.x] - The y coordinate to emit the Particles from. - * @param {number} [count=this.quantity] - The number of Particles to emit. - * - * @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle. - */ - emitParticleAt: function (x, y, count) - { - return this.emitParticle(count, x, y); }, /** - * Emits particles at a given position (or the emitter's current position). - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#emitParticle - * @since 3.0.0 - * - * @param {number} [count=this.quantity] - The number of Particles to emit. - * @param {number} [x=this.x] - The x coordinate to emit the Particles from. - * @param {number} [y=this.x] - The y coordinate to emit the Particles from. - * - * @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle. + * A touch-based Pointer object. + * This will be `undefined` by default unless you add a new Pointer using `addPointer`. * - * @see Phaser.GameObjects.Particles.Particle#fire + * @name Phaser.Input.InputPlugin#pointer5 + * @type {Phaser.Input.Pointer} + * @readonly + * @since 3.10.0 */ - emitParticle: function (count, x, y) - { - if (this.atLimit()) - { - return; - } + pointer5: { - if (count === undefined) + get: function () { - count = this.quantity.onEmit(); + return this.manager.pointers[5]; } - var dead = this.dead; + }, - var followX = (this.follow) ? this.follow.x + this.followOffset.x : x; - var followY = (this.follow) ? this.follow.y + this.followOffset.y : y; + /** + * A touch-based Pointer object. + * This will be `undefined` by default unless you add a new Pointer using `addPointer`. + * + * @name Phaser.Input.InputPlugin#pointer6 + * @type {Phaser.Input.Pointer} + * @readonly + * @since 3.10.0 + */ + pointer6: { - for (var i = 0; i < count; i++) + get: function () { - var particle = dead.pop(); - - if (!particle) - { - particle = new this.particleClass(this); - } - - particle.fire(followX, followY); - - if (this.particleBringToTop) - { - this.alive.push(particle); - } - else - { - this.alive.unshift(particle); - } - - if (this.emitCallback) - { - this.emitCallback.call(this.emitCallbackScope, particle, this); - } - - if (this.atLimit()) - { - break; - } + return this.manager.pointers[6]; } - return particle; }, /** - * Updates this emitter and its particles. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#preUpdate - * @since 3.0.0 + * A touch-based Pointer object. + * This will be `undefined` by default unless you add a new Pointer using `addPointer`. * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @name Phaser.Input.InputPlugin#pointer7 + * @type {Phaser.Input.Pointer} + * @readonly + * @since 3.10.0 */ - preUpdate: function (time, delta) - { - // Scale the delta - delta *= this.timeScale; - - var step = (delta / 1000); + pointer7: { - if (this.trackVisible) + get: function () { - this.visible = this.follow.visible; + return this.manager.pointers[7]; } - // Any particle processors? - var processors = this.manager.getProcessors(); - - var particles = this.alive; - var dead = this.dead; + }, - var i = 0; - var rip = []; - var length = particles.length; + /** + * A touch-based Pointer object. + * This will be `undefined` by default unless you add a new Pointer using `addPointer`. + * + * @name Phaser.Input.InputPlugin#pointer8 + * @type {Phaser.Input.Pointer} + * @readonly + * @since 3.10.0 + */ + pointer8: { - for (i = 0; i < length; i++) + get: function () { - var particle = particles[i]; - - // update returns `true` if the particle is now dead (lifeCurrent <= 0) - if (particle.update(delta, step, processors)) - { - rip.push({ index: i, particle: particle }); - } + return this.manager.pointers[8]; } - // Move dead particles to the dead array - length = rip.length; - - if (length > 0) - { - var deathCallback = this.deathCallback; - var deathCallbackScope = this.deathCallbackScope; - - for (i = length - 1; i >= 0; i--) - { - var entry = rip[i]; - - // Remove from particles array - particles.splice(entry.index, 1); - - // Add to dead array - dead.push(entry.particle); - - // Callback - if (deathCallback) - { - deathCallback.call(deathCallbackScope, entry.particle); - } - - entry.particle.resetPosition(); - } - } + }, - if (!this.on) - { - return; - } + /** + * A touch-based Pointer object. + * This will be `undefined` by default unless you add a new Pointer using `addPointer`. + * + * @name Phaser.Input.InputPlugin#pointer9 + * @type {Phaser.Input.Pointer} + * @readonly + * @since 3.10.0 + */ + pointer9: { - if (this.frequency === 0) + get: function () { - this.emitParticle(); + return this.manager.pointers[9]; } - else if (this.frequency > 0) - { - this._counter -= delta; - - if (this._counter <= 0) - { - this.emitParticle(); - // counter = frequency - remained from previous delta - this._counter = (this.frequency - Math.abs(this._counter)); - } - } }, /** - * Calculates the difference of two particles, for sorting them by depth. - * - * @method Phaser.GameObjects.Particles.ParticleEmitter#depthSortCallback - * @since 3.0.0 - * - * @param {object} a - The first particle. - * @param {object} b - The second particle. + * A touch-based Pointer object. + * This will be `undefined` by default unless you add a new Pointer using `addPointer`. * - * @return {number} The difference of a and b's y coordinates. + * @name Phaser.Input.InputPlugin#pointer10 + * @type {Phaser.Input.Pointer} + * @readonly + * @since 3.10.0 */ - depthSortCallback: function (a, b) - { - return a.y - b.y; + pointer10: { + + get: function () + { + return this.manager.pointers[10]; + } + } }); -module.exports = ParticleEmitter; +PluginCache.register('InputPlugin', InputPlugin, 'input'); + +module.exports = InputPlugin; /***/ }), -/* 453 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 63399: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); +var GetValue = __webpack_require__(10850); + +// Contains the plugins that Phaser uses globally and locally. +// These are the source objects, not instantiated. +var inputPlugins = {}; /** - * @classdesc - * A Death Zone. + * @namespace Phaser.Input.InputPluginCache + */ + +var InputPluginCache = {}; + +/** + * Static method called directly by the Core internal Plugins. + * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) + * Plugin is the object to instantiate to create the plugin + * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input) * - * A Death Zone is a special type of zone that will kill a Particle as soon as it either enters, or leaves, the zone. + * @function Phaser.Input.InputPluginCache.register + * @static + * @since 3.10.0 * - * The zone consists of a `source` which could be a Geometric shape, such as a Rectangle or Ellipse, or your own - * object as long as it includes a `contains` method for which the Particles can be tested against. + * @param {string} key - A reference used to get this plugin from the plugin cache. + * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. + * @param {string} mapping - If this plugin is to be injected into the Input Plugin, this is the property key used. + * @param {string} settingsKey - The key in the Scene Settings to check to see if this plugin should install or not. + * @param {string} configKey - The key in the Game Config to check to see if this plugin should install or not. + */ +InputPluginCache.register = function (key, plugin, mapping, settingsKey, configKey) +{ + inputPlugins[key] = { plugin: plugin, mapping: mapping, settingsKey: settingsKey, configKey: configKey }; +}; + +/** + * Returns the input plugin object from the cache based on the given key. * - * @class DeathZone - * @memberof Phaser.GameObjects.Particles.Zones - * @constructor - * @since 3.0.0 + * @function Phaser.Input.InputPluginCache.getPlugin + * @static + * @since 3.10.0 * - * @param {Phaser.Types.GameObjects.Particles.DeathZoneSource} source - An object instance that has a `contains` method that returns a boolean when given `x` and `y` arguments. - * @param {boolean} killOnEnter - Should the Particle be killed when it enters the zone? `true` or leaves it? `false` + * @param {string} key - The key of the input plugin to get. + * + * @return {Phaser.Types.Input.InputPluginContainer} The input plugin object. */ -var DeathZone = new Class({ +InputPluginCache.getPlugin = function (key) +{ + return inputPlugins[key]; +}; - initialize: +/** + * Installs all of the registered Input Plugins into the given target. + * + * @function Phaser.Input.InputPluginCache.install + * @static + * @since 3.10.0 + * + * @param {Phaser.Input.InputPlugin} target - The target InputPlugin to install the plugins into. + */ +InputPluginCache.install = function (target) +{ + var sys = target.scene.sys; + var settings = sys.settings.input; + var config = sys.game.config; - function DeathZone (source, killOnEnter) + for (var key in inputPlugins) { - /** - * An object instance that has a `contains` method that returns a boolean when given `x` and `y` arguments. - * This could be a Geometry shape, such as `Phaser.Geom.Circle`, or your own custom object. - * - * @name Phaser.GameObjects.Particles.Zones.DeathZone#source - * @type {Phaser.Types.GameObjects.Particles.DeathZoneSource} - * @since 3.0.0 - */ - this.source = source; + var source = inputPlugins[key].plugin; + var mapping = inputPlugins[key].mapping; + var settingsKey = inputPlugins[key].settingsKey; + var configKey = inputPlugins[key].configKey; - /** - * Set to `true` if the Particle should be killed if it enters this zone. - * Set to `false` to kill the Particle if it leaves this zone. - * - * @name Phaser.GameObjects.Particles.Zones.DeathZone#killOnEnter - * @type {boolean} - * @since 3.0.0 - */ - this.killOnEnter = killOnEnter; - }, + if (GetValue(settings, settingsKey, config[configKey])) + { + target[mapping] = new source(target); + } + } +}; - /** - * Checks if the given Particle will be killed or not by this zone. - * - * @method Phaser.GameObjects.Particles.Zones.DeathZone#willKill - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Particles.Particle} particle - The Particle to be checked against this zone. - * - * @return {boolean} Return `true` if the Particle is to be killed, otherwise return `false`. - */ - willKill: function (particle) +/** + * Removes an input plugin based on the given key. + * + * @function Phaser.Input.InputPluginCache.remove + * @static + * @since 3.10.0 + * + * @param {string} key - The key of the input plugin to remove. + */ +InputPluginCache.remove = function (key) +{ + if (inputPlugins.hasOwnProperty(key)) { - var withinZone = this.source.contains(particle.x, particle.y); - - return (withinZone && this.killOnEnter || !withinZone && !this.killOnEnter); + delete inputPlugins[key]; } +}; -}); - -module.exports = DeathZone; +module.exports = InputPluginCache; /***/ }), -/* 454 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 40398: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); +var Angle = __webpack_require__(90447); +var Class = __webpack_require__(56694); +var Distance = __webpack_require__(53996); +var FuzzyEqual = __webpack_require__(88456); +var SmoothStepInterpolation = __webpack_require__(44521); +var Vector2 = __webpack_require__(93736); +var OS = __webpack_require__(36580); /** * @classdesc - * A zone that places particles on a shape's edges. + * A Pointer object encapsulates both mouse and touch input within Phaser. * - * @class EdgeZone - * @memberof Phaser.GameObjects.Particles.Zones + * By default, Phaser will create 2 pointers for your game to use. If you require more, i.e. for a multi-touch + * game, then use the `InputPlugin.addPointer` method to do so, rather than instantiating this class directly, + * otherwise it won't be managed by the input system. + * + * You can reference the current active pointer via `InputPlugin.activePointer`. You can also use the properties + * `InputPlugin.pointer1` through to `pointer10`, for each pointer you have enabled in your game. + * + * The properties of this object are set by the Input Plugin during processing. This object is then sent in all + * input related events that the Input Plugin emits, so you can reference properties from it directly in your + * callbacks. + * + * @class Pointer + * @memberof Phaser.Input * @constructor * @since 3.0.0 * - * @param {Phaser.Types.GameObjects.Particles.EdgeZoneSource} source - An object instance with a `getPoints(quantity, stepRate)` method returning an array of points. - * @param {number} quantity - The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. - * @param {number} stepRate - The distance between each particle. When set, `quantity` is implied and should be set to 0. - * @param {boolean} [yoyo=false] - Whether particles are placed from start to end and then end to start. - * @param {boolean} [seamless=true] - Whether one endpoint will be removed if it's identical to the other. + * @param {Phaser.Input.InputManager} manager - A reference to the Input Manager. + * @param {number} id - The internal ID of this Pointer. */ -var EdgeZone = new Class({ +var Pointer = new Class({ initialize: - function EdgeZone (source, quantity, stepRate, yoyo, seamless) + function Pointer (manager, id) { - if (yoyo === undefined) { yoyo = false; } - if (seamless === undefined) { seamless = true; } - - /** - * An object instance with a `getPoints(quantity, stepRate)` method returning an array of points. - * - * @name Phaser.GameObjects.Particles.Zones.EdgeZone#source - * @type {Phaser.Types.GameObjects.Particles.EdgeZoneSource|Phaser.Types.GameObjects.Particles.RandomZoneSource} - * @since 3.0.0 - */ - this.source = source; - /** - * The points placed on the source edge. + * A reference to the Input Manager. * - * @name Phaser.GameObjects.Particles.Zones.EdgeZone#points - * @type {Phaser.Geom.Point[]} - * @default [] + * @name Phaser.Input.Pointer#manager + * @type {Phaser.Input.InputManager} * @since 3.0.0 */ - this.points = []; + this.manager = manager; /** - * The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. + * The internal ID of this Pointer. * - * @name Phaser.GameObjects.Particles.Zones.EdgeZone#quantity + * @name Phaser.Input.Pointer#id * @type {number} + * @readonly * @since 3.0.0 */ - this.quantity = quantity; + this.id = id; /** - * The distance between each particle. When set, `quantity` is implied and should be set to 0. + * The most recent native DOM Event this Pointer has processed. * - * @name Phaser.GameObjects.Particles.Zones.EdgeZone#stepRate - * @type {number} + * @name Phaser.Input.Pointer#event + * @type {(TouchEvent|MouseEvent|WheelEvent)} * @since 3.0.0 */ - this.stepRate = stepRate; + this.event; /** - * Whether particles are placed from start to end and then end to start. + * The DOM element the Pointer was pressed down on, taken from the DOM event. + * In a default set-up this will be the Canvas that Phaser is rendering to, or the Window element. * - * @name Phaser.GameObjects.Particles.Zones.EdgeZone#yoyo - * @type {boolean} - * @since 3.0.0 + * @name Phaser.Input.Pointer#downElement + * @type {any} + * @readonly + * @since 3.16.0 */ - this.yoyo = yoyo; + this.downElement; /** - * The counter used for iterating the EdgeZone's points. + * The DOM element the Pointer was released on, taken from the DOM event. + * In a default set-up this will be the Canvas that Phaser is rendering to, or the Window element. * - * @name Phaser.GameObjects.Particles.Zones.EdgeZone#counter - * @type {number} - * @default -1 - * @since 3.0.0 + * @name Phaser.Input.Pointer#upElement + * @type {any} + * @readonly + * @since 3.16.0 */ - this.counter = -1; + this.upElement; /** - * Whether one endpoint will be removed if it's identical to the other. + * The camera the Pointer interacted with during its last update. * - * @name Phaser.GameObjects.Particles.Zones.EdgeZone#seamless - * @type {boolean} + * A Pointer can only ever interact with one camera at once, which will be the top-most camera + * in the list should multiple cameras be positioned on-top of each other. + * + * @name Phaser.Input.Pointer#camera + * @type {Phaser.Cameras.Scene2D.Camera} + * @default null * @since 3.0.0 */ - this.seamless = seamless; + this.camera = null; /** - * An internal count of the points belonging to this EdgeZone. + * A read-only property that indicates which button was pressed, or released, on the pointer + * during the most recent event. It is only set during `up` and `down` events. * - * @name Phaser.GameObjects.Particles.Zones.EdgeZone#_length + * On Touch devices the value is always 0. + * + * Users may change the configuration of buttons on their pointing device so that if an event's button property + * is zero, it may not have been caused by the button that is physically left–most on the pointing device; + * however, it should behave as if the left button was clicked in the standard button layout. + * + * @name Phaser.Input.Pointer#button * @type {number} - * @private + * @readonly * @default 0 - * @since 3.0.0 + * @since 3.18.0 */ - this._length = 0; + this.button = 0; /** - * An internal value used to keep track of the current iteration direction for the EdgeZone's points. + * 0: No button or un-initialized + * 1: Left button + * 2: Right button + * 4: Wheel button or middle button + * 8: 4th button (typically the "Browser Back" button) + * 16: 5th button (typically the "Browser Forward" button) * - * 0 = forwards, 1 = backwards + * For a mouse configured for left-handed use, the button actions are reversed. + * In this case, the values are read from right to left. * - * @name Phaser.GameObjects.Particles.Zones.EdgeZone#_direction + * @name Phaser.Input.Pointer#buttons * @type {number} - * @private * @default 0 * @since 3.0.0 */ - this._direction = 0; - - this.updateSource(); - }, - - /** - * Update the {@link Phaser.GameObjects.Particles.Zones.EdgeZone#points} from the EdgeZone's - * {@link Phaser.GameObjects.Particles.Zones.EdgeZone#source}. - * - * Also updates internal properties. - * - * @method Phaser.GameObjects.Particles.Zones.EdgeZone#updateSource - * @since 3.0.0 - * - * @return {this} This Edge Zone. - */ - updateSource: function () - { - this.points = this.source.getPoints(this.quantity, this.stepRate); - - // Remove ends? - if (this.seamless) - { - var a = this.points[0]; - var b = this.points[this.points.length - 1]; - - if (a.x === b.x && a.y === b.y) - { - this.points.pop(); - } - } - - var oldLength = this._length; - - this._length = this.points.length; - - // Adjust counter if we now have less points than before - if (this._length < oldLength && this.counter > this._length) - { - this.counter = this._length - 1; - } - - return this; - }, - - /** - * Change the source of the EdgeZone. - * - * @method Phaser.GameObjects.Particles.Zones.EdgeZone#changeSource - * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.Particles.EdgeZoneSource} source - An object instance with a `getPoints(quantity, stepRate)` method returning an array of points. - * - * @return {this} This Edge Zone. - */ - changeSource: function (source) - { - this.source = source; - - return this.updateSource(); - }, - - /** - * Get the next point in the Zone and set its coordinates on the given Particle. - * - * @method Phaser.GameObjects.Particles.Zones.EdgeZone#getPoint - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Particles.Particle} particle - The Particle. - */ - getPoint: function (particle) - { - if (this._direction === 0) - { - this.counter++; - - if (this.counter >= this._length) - { - if (this.yoyo) - { - this._direction = 1; - this.counter = this._length - 1; - } - else - { - this.counter = 0; - } - } - } - else - { - this.counter--; - - if (this.counter === -1) - { - if (this.yoyo) - { - this._direction = 0; - this.counter = 0; - } - else - { - this.counter = this._length - 1; - } - } - } - - var point = this.points[this.counter]; - - if (point) - { - particle.x = point.x; - particle.y = point.y; - } - } - -}); - -module.exports = EdgeZone; - - -/***/ }), -/* 455 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Verifies that an object contains at least one of the requested keys - * - * @function Phaser.Utils.Objects.HasAny - * @since 3.0.0 - * - * @param {object} source - an object on which to check for key existence - * @param {string[]} keys - an array of keys to search the object for - * - * @return {boolean} true if the source object contains at least one of the keys, false otherwise - */ -var HasAny = function (source, keys) -{ - for (var i = 0; i < keys.length; i++) - { - if (source.hasOwnProperty(keys[i])) - { - return true; - } - } - - return false; -}; - -module.exports = HasAny; - - -/***/ }), -/* 456 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Vector2 = __webpack_require__(3); - -/** - * @classdesc - * A zone that places particles randomly within a shapes area. - * - * @class RandomZone - * @memberof Phaser.GameObjects.Particles.Zones - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.Particles.RandomZoneSource} source - An object instance with a `getRandomPoint(point)` method. - */ -var RandomZone = new Class({ - - initialize: + this.buttons = 0; - function RandomZone (source) - { /** - * An object instance with a `getRandomPoint(point)` method. + * The position of the Pointer in screen space. * - * @name Phaser.GameObjects.Particles.Zones.RandomZone#source - * @type {Phaser.Types.GameObjects.Particles.RandomZoneSource} + * @name Phaser.Input.Pointer#position + * @type {Phaser.Math.Vector2} + * @readonly * @since 3.0.0 */ - this.source = source; + this.position = new Vector2(); /** - * Internal calculation vector. + * The previous position of the Pointer in screen space. * - * @name Phaser.GameObjects.Particles.Zones.RandomZone#_tempVec + * The old x and y values are stored in here during the InputManager.transformPointer call. + * + * Use the properties `velocity`, `angle` and `distance` to create your own gesture recognition. + * + * @name Phaser.Input.Pointer#prevPosition * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 + * @readonly + * @since 3.11.0 */ - this._tempVec = new Vector2(); - }, - - /** - * Get the next point in the Zone and set its coordinates on the given Particle. - * - * @method Phaser.GameObjects.Particles.Zones.RandomZone#getPoint - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Particles.Particle} particle - The Particle. - */ - getPoint: function (particle) - { - var vec = this._tempVec; - - this.source.getRandomPoint(vec); - - particle.x = vec.x; - particle.y = vec.y; - } - -}); - -module.exports = RandomZone; - - -/***/ }), -/* 457 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var Sprite = __webpack_require__(73); - -/** - * @classdesc - * A PathFollower Game Object. - * - * A PathFollower is a Sprite Game Object with some extra helpers to allow it to follow a Path automatically. - * - * Anything you can do with a standard Sprite can be done with this PathFollower, such as animate it, tint it, - * scale it and so on. - * - * PathFollowers are bound to a single Path at any one time and can traverse the length of the Path, from start - * to finish, forwards or backwards, or from any given point on the Path to its end. They can optionally rotate - * to face the direction of the path, be offset from the path coordinates or rotate independently of the Path. - * - * @class PathFollower - * @extends Phaser.GameObjects.Sprite - * @memberof Phaser.GameObjects - * @constructor - * @since 3.0.0 - * - * @extends Phaser.GameObjects.Components.PathFollower - * - * @param {Phaser.Scene} scene - The Scene to which this PathFollower belongs. - * @param {Phaser.Curves.Path} path - The Path this PathFollower is following. It can only follow one Path at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. - */ -var PathFollower = new Class({ - - Extends: Sprite, - - Mixins: [ - Components.PathFollower - ], - - initialize: - - function PathFollower (scene, path, x, y, texture, frame) - { - Sprite.call(this, scene, x, y, texture, frame); - - this.path = path; - }, - - /** - * Internal update handler that advances this PathFollower along the path. - * - * Called automatically by the Scene step, should not typically be called directly. - * - * @method Phaser.GameObjects.PathFollower#preUpdate - * @protected - * @since 3.0.0 - * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. - */ - preUpdate: function (time, delta) - { - this.anims.update(time, delta); - this.pathUpdate(time); - } - -}); - -module.exports = PathFollower; - - -/***/ }), -/* 458 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Returns an object containing dimensions of the Text object. - * - * @function Phaser.GameObjects.GetTextSize - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Text} text - The Text object to calculate the size from. - * @param {Phaser.Types.GameObjects.Text.TextMetrics} size - The Text metrics to use when calculating the size. - * @param {string[]} lines - The lines of text to calculate the size from. - * - * @return {Phaser.Types.GameObjects.Text.GetTextSizeObject} An object containing dimensions of the Text object. - */ -var GetTextSize = function (text, size, lines) -{ - var canvas = text.canvas; - var context = text.context; - var style = text.style; - - var lineWidths = []; - var maxLineWidth = 0; - var drawnLines = lines.length; - - if (style.maxLines > 0 && style.maxLines < lines.length) - { - drawnLines = style.maxLines; - } - - style.syncFont(canvas, context); - - // Text Width - - for (var i = 0; i < drawnLines; i++) - { - var lineWidth = style.strokeThickness; - - lineWidth += context.measureText(lines[i]).width; - - // Adjust for wrapped text - if (style.wordWrap) - { - lineWidth -= context.measureText(' ').width; - } - - lineWidths[i] = Math.ceil(lineWidth); - maxLineWidth = Math.max(maxLineWidth, lineWidths[i]); - } - - // Text Height - - var lineHeight = size.fontSize + style.strokeThickness; - var height = lineHeight * drawnLines; - var lineSpacing = text.lineSpacing; - - // Adjust for line spacing - if (drawnLines > 1) - { - height += lineSpacing * (drawnLines - 1); - } - - return { - width: maxLineWidth, - height: height, - lines: drawnLines, - lineWidths: lineWidths, - lineSpacing: lineSpacing, - lineHeight: lineHeight - }; -}; - -module.exports = GetTextSize; - - -/***/ }), -/* 459 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var GetAdvancedValue = __webpack_require__(13); -var GetValue = __webpack_require__(6); -var MeasureText = __webpack_require__(460); - -// Key: [ Object Key, Default Value ] - -var propertyMap = { - fontFamily: [ 'fontFamily', 'Courier' ], - fontSize: [ 'fontSize', '16px' ], - fontStyle: [ 'fontStyle', '' ], - backgroundColor: [ 'backgroundColor', null ], - color: [ 'color', '#fff' ], - stroke: [ 'stroke', '#fff' ], - strokeThickness: [ 'strokeThickness', 0 ], - shadowOffsetX: [ 'shadow.offsetX', 0 ], - shadowOffsetY: [ 'shadow.offsetY', 0 ], - shadowColor: [ 'shadow.color', '#000' ], - shadowBlur: [ 'shadow.blur', 0 ], - shadowStroke: [ 'shadow.stroke', false ], - shadowFill: [ 'shadow.fill', false ], - align: [ 'align', 'left' ], - maxLines: [ 'maxLines', 0 ], - fixedWidth: [ 'fixedWidth', 0 ], - fixedHeight: [ 'fixedHeight', 0 ], - resolution: [ 'resolution', 0 ], - rtl: [ 'rtl', false ], - testString: [ 'testString', '|MÉqgy' ], - baselineX: [ 'baselineX', 1.2 ], - baselineY: [ 'baselineY', 1.4 ], - wordWrapWidth: [ 'wordWrap.width', null ], - wordWrapCallback: [ 'wordWrap.callback', null ], - wordWrapCallbackScope: [ 'wordWrap.callbackScope', null ], - wordWrapUseAdvanced: [ 'wordWrap.useAdvancedWrap', false ] -}; + this.prevPosition = new Vector2(); -/** - * @classdesc - * A TextStyle class manages all of the style settings for a Text object. - * - * Text Game Objects create a TextStyle instance automatically, which is - * accessed via the `Text.style` property. You do not normally need to - * instantiate one yourself. - * - * @class TextStyle - * @memberof Phaser.GameObjects - * @constructor - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Text} text - The Text object that this TextStyle is styling. - * @param {Phaser.Types.GameObjects.Text.TextStyle} style - The style settings to set. - */ -var TextStyle = new Class({ + /** + * An internal vector used for calculations of the pointer speed and angle. + * + * @name Phaser.Input.Pointer#midPoint + * @type {Phaser.Math.Vector2} + * @private + * @since 3.16.0 + */ + this.midPoint = new Vector2(-1, -1); - initialize: + /** + * The current velocity of the Pointer, based on its current and previous positions. + * + * This value is smoothed out each frame, according to the `motionFactor` property. + * + * This property is updated whenever the Pointer moves, regardless of any button states. In other words, + * it changes based on movement alone - a button doesn't have to be pressed first. + * + * @name Phaser.Input.Pointer#velocity + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.16.0 + */ + this.velocity = new Vector2(); - function TextStyle (text, style) - { /** - * The Text object that this TextStyle is styling. + * The current angle the Pointer is moving, in radians, based on its previous and current position. * - * @name Phaser.GameObjects.TextStyle#parent - * @type {Phaser.GameObjects.Text} - * @since 3.0.0 + * The angle is based on the old position facing to the current position. + * + * This property is updated whenever the Pointer moves, regardless of any button states. In other words, + * it changes based on movement alone - a button doesn't have to be pressed first. + * + * @name Phaser.Input.Pointer#angle + * @type {number} + * @readonly + * @since 3.16.0 */ - this.parent = text; + this.angle = 0; /** - * The font family. + * The distance the Pointer has moved, based on its previous and current position. * - * @name Phaser.GameObjects.TextStyle#fontFamily - * @type {string} - * @default 'Courier' - * @since 3.0.0 + * This value is smoothed out each frame, according to the `motionFactor` property. + * + * This property is updated whenever the Pointer moves, regardless of any button states. In other words, + * it changes based on movement alone - a button doesn't have to be pressed first. + * + * If you need the total distance travelled since the primary buttons was pressed down, + * then use the `Pointer.getDistance` method. + * + * @name Phaser.Input.Pointer#distance + * @type {number} + * @readonly + * @since 3.16.0 */ - this.fontFamily; + this.distance = 0; /** - * The font size. + * The smoothing factor to apply to the Pointer position. * - * @name Phaser.GameObjects.TextStyle#fontSize - * @type {string} - * @default '16px' - * @since 3.0.0 + * Due to their nature, pointer positions are inherently noisy. While this is fine for lots of games, if you need cleaner positions + * then you can set this value to apply an automatic smoothing to the positions as they are recorded. + * + * The default value of zero means 'no smoothing'. + * Set to a small value, such as 0.2, to apply an average level of smoothing between positions. You can do this by changing this + * value directly, or by setting the `input.smoothFactor` property in the Game Config. + * + * Positions are only smoothed when the pointer moves. If the primary button on this Pointer enters an Up or Down state, then the position + * is always precise, and not smoothed. + * + * @name Phaser.Input.Pointer#smoothFactor + * @type {number} + * @default 0 + * @since 3.16.0 */ - this.fontSize; + this.smoothFactor = 0; /** - * The font style. + * The factor applied to the motion smoothing each frame. * - * @name Phaser.GameObjects.TextStyle#fontStyle - * @type {string} - * @since 3.0.0 + * This value is passed to the Smooth Step Interpolation that is used to calculate the velocity, + * angle and distance of the Pointer. It's applied every frame, until the midPoint reaches the current + * position of the Pointer. 0.2 provides a good average but can be increased if you need a + * quicker update and are working in a high performance environment. Never set this value to + * zero. + * + * @name Phaser.Input.Pointer#motionFactor + * @type {number} + * @default 0.2 + * @since 3.16.0 */ - this.fontStyle; + this.motionFactor = 0.2; /** - * The background color. + * The x position of this Pointer, translated into the coordinate space of the most recent Camera it interacted with. * - * @name Phaser.GameObjects.TextStyle#backgroundColor - * @type {string} - * @since 3.0.0 + * If you wish to use this value _outside_ of an input event handler then you should update it first by calling + * the `Pointer.updateWorldPoint` method. + * + * @name Phaser.Input.Pointer#worldX + * @type {number} + * @default 0 + * @since 3.10.0 */ - this.backgroundColor; + this.worldX = 0; /** - * The text fill color. + * The y position of this Pointer, translated into the coordinate space of the most recent Camera it interacted with. * - * @name Phaser.GameObjects.TextStyle#color - * @type {string} - * @default '#fff' - * @since 3.0.0 + * If you wish to use this value _outside_ of an input event handler then you should update it first by calling + * the `Pointer.updateWorldPoint` method. + * + * @name Phaser.Input.Pointer#worldY + * @type {number} + * @default 0 + * @since 3.10.0 */ - this.color; + this.worldY = 0; /** - * The text stroke color. + * Time when this Pointer was most recently moved (regardless of the state of its buttons, if any) * - * @name Phaser.GameObjects.TextStyle#stroke - * @type {string} - * @default '#fff' + * @name Phaser.Input.Pointer#moveTime + * @type {number} + * @default 0 * @since 3.0.0 */ - this.stroke; + this.moveTime = 0; /** - * The text stroke thickness. + * X coordinate of the Pointer when Button 1 (left button), or Touch, was pressed, used for dragging objects. * - * @name Phaser.GameObjects.TextStyle#strokeThickness + * @name Phaser.Input.Pointer#downX * @type {number} * @default 0 * @since 3.0.0 */ - this.strokeThickness; + this.downX = 0; /** - * The horizontal shadow offset. + * Y coordinate of the Pointer when Button 1 (left button), or Touch, was pressed, used for dragging objects. * - * @name Phaser.GameObjects.TextStyle#shadowOffsetX + * @name Phaser.Input.Pointer#downY * @type {number} * @default 0 * @since 3.0.0 */ - this.shadowOffsetX; + this.downY = 0; /** - * The vertical shadow offset. + * The Event timestamp when the first button, or Touch input, was pressed. Used for dragging objects. * - * @name Phaser.GameObjects.TextStyle#shadowOffsetY + * @name Phaser.Input.Pointer#downTime * @type {number} * @default 0 * @since 3.0.0 */ - this.shadowOffsetY; + this.downTime = 0; /** - * The shadow color. + * X coordinate of the Pointer when Button 1 (left button), or Touch, was released, used for dragging objects. * - * @name Phaser.GameObjects.TextStyle#shadowColor - * @type {string} - * @default '#000' + * @name Phaser.Input.Pointer#upX + * @type {number} + * @default 0 * @since 3.0.0 */ - this.shadowColor; + this.upX = 0; /** - * The shadow blur radius. + * Y coordinate of the Pointer when Button 1 (left button), or Touch, was released, used for dragging objects. * - * @name Phaser.GameObjects.TextStyle#shadowBlur + * @name Phaser.Input.Pointer#upY * @type {number} * @default 0 * @since 3.0.0 */ - this.shadowBlur; + this.upY = 0; /** - * Whether shadow stroke is enabled or not. + * The Event timestamp when the final button, or Touch input, was released. Used for dragging objects. * - * @name Phaser.GameObjects.TextStyle#shadowStroke - * @type {boolean} - * @default false + * @name Phaser.Input.Pointer#upTime + * @type {number} + * @default 0 * @since 3.0.0 */ - this.shadowStroke; + this.upTime = 0; /** - * Whether shadow fill is enabled or not. + * Is the primary button down? (usually button 0, the left mouse button) * - * @name Phaser.GameObjects.TextStyle#shadowFill + * @name Phaser.Input.Pointer#primaryDown * @type {boolean} * @default false * @since 3.0.0 */ - this.shadowFill; + this.primaryDown = false; /** - * The text alignment. + * Is _any_ button on this pointer considered as being down? * - * @name Phaser.GameObjects.TextStyle#align - * @type {string} - * @default 'left' + * @name Phaser.Input.Pointer#isDown + * @type {boolean} + * @default false * @since 3.0.0 */ - this.align; + this.isDown = false; /** - * The maximum number of lines to draw. + * Did the previous input event come from a Touch input (true) or Mouse? (false) * - * @name Phaser.GameObjects.TextStyle#maxLines - * @type {number} - * @default 0 + * @name Phaser.Input.Pointer#wasTouch + * @type {boolean} + * @default false * @since 3.0.0 */ - this.maxLines; + this.wasTouch = false; /** - * The fixed width of the text. + * Did this Pointer get canceled by a touchcancel event? * - * `0` means no fixed with. + * Note: "canceled" is the American-English spelling of "cancelled". Please don't submit PRs correcting it! * - * @name Phaser.GameObjects.TextStyle#fixedWidth - * @type {number} - * @default 0 - * @since 3.0.0 + * @name Phaser.Input.Pointer#wasCanceled + * @type {boolean} + * @default false + * @since 3.15.0 */ - this.fixedWidth; + this.wasCanceled = false; /** - * The fixed height of the text. - * - * `0` means no fixed height. + * If the mouse is locked, the horizontal relative movement of the Pointer in pixels since last frame. * - * @name Phaser.GameObjects.TextStyle#fixedHeight + * @name Phaser.Input.Pointer#movementX * @type {number} * @default 0 * @since 3.0.0 */ - this.fixedHeight; + this.movementX = 0; /** - * The resolution the text is rendered to its internal canvas at. - * The default is 0, which means it will use the resolution set in the Game Config. + * If the mouse is locked, the vertical relative movement of the Pointer in pixels since last frame. * - * @name Phaser.GameObjects.TextStyle#resolution + * @name Phaser.Input.Pointer#movementY * @type {number} * @default 0 - * @since 3.12.0 - */ - this.resolution; - - /** - * Whether the text should render right to left. - * - * @name Phaser.GameObjects.TextStyle#rtl - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.rtl; - - /** - * The test string to use when measuring the font. - * - * @name Phaser.GameObjects.TextStyle#testString - * @type {string} - * @default '|MÉqgy' * @since 3.0.0 */ - this.testString; + this.movementY = 0; /** - * The amount of horizontal padding added to the width of the text when calculating the font metrics. + * The identifier property of the Pointer as set by the DOM event when this Pointer is started. * - * @name Phaser.GameObjects.TextStyle#baselineX + * @name Phaser.Input.Pointer#identifier * @type {number} - * @default 1.2 - * @since 3.3.0 + * @since 3.10.0 */ - this.baselineX; + this.identifier = 0; /** - * The amount of vertical padding added to the height of the text when calculating the font metrics. + * The pointerId property of the Pointer as set by the DOM event when this Pointer is started. + * The browser can and will recycle this value. * - * @name Phaser.GameObjects.TextStyle#baselineY + * @name Phaser.Input.Pointer#pointerId * @type {number} - * @default 1.4 - * @since 3.3.0 + * @since 3.10.0 */ - this.baselineY; + this.pointerId = null; /** - * The maximum width of a line of text in pixels. Null means no line wrapping. Setting this - * property directly will not re-run the word wrapping algorithm. To change the width and - * re-wrap, use {@link Phaser.GameObjects.TextStyle#setWordWrapWidth}. + * An active Pointer is one that is currently pressed down on the display. + * A Mouse is always considered as active. * - * @name Phaser.GameObjects.TextStyle#wordWrapWidth - * @type {number | null} - * @default null - * @since 3.24.0 + * @name Phaser.Input.Pointer#active + * @type {boolean} + * @since 3.10.0 */ - this.wordWrapWidth; + this.active = (id === 0) ? true : false; /** - * A custom function that will be responsible for wrapping the text. It will receive two - * arguments: text (the string to wrap), textObject (this Text instance). It should return - * the wrapped lines either as an array of lines or as a string with newline characters in - * place to indicate where breaks should happen. Setting this directly will not re-run the - * word wrapping algorithm. To change the callback and re-wrap, use - * {@link Phaser.GameObjects.TextStyle#setWordWrapCallback}. + * Is this pointer Pointer Locked? * - * @name Phaser.GameObjects.TextStyle#wordWrapCallback - * @type {TextStyleWordWrapCallback | null} - * @default null - * @since 3.24.0 + * Only a mouse pointer can be locked and it only becomes locked when requested via + * the browsers Pointer Lock API. + * + * You can request this by calling the `this.input.mouse.requestPointerLock()` method from + * a `pointerdown` or `pointerup` event handler. + * + * @name Phaser.Input.Pointer#locked + * @readonly + * @type {boolean} + * @since 3.19.0 */ - this.wordWrapCallback; + this.locked = false; /** - * The scope that will be applied when the wordWrapCallback is invoked. Setting this directly will not re-run the - * word wrapping algorithm. To change the callback and re-wrap, use - * {@link Phaser.GameObjects.TextStyle#setWordWrapCallback}. + * The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device. * - * @name Phaser.GameObjects.TextStyle#wordWrapCallbackScope - * @type {object | null} - * @default null - * @since 3.24.0 + * @name Phaser.Input.Pointer#deltaX + * @type {number} + * @default 0 + * @since 3.18.0 */ - this.wordWrapCallbackScope; + this.deltaX = 0; /** - * Whether or not to use the advanced wrapping algorithm. If true, spaces are collapsed and - * whitespace is trimmed from lines. If false, spaces and whitespace are left as is. Setting - * this property directly will not re-run the word wrapping algorithm. To change the - * advanced setting and re-wrap, use {@link Phaser.GameObjects.TextStyle#setWordWrapWidth}. + * The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device. + * This value will typically be less than 0 if the user scrolls up and greater than zero if scrolling down. * - * @name Phaser.GameObjects.TextStyle#wordWrapUseAdvanced - * @type {boolean} - * @default false - * @since 3.24.0 + * @name Phaser.Input.Pointer#deltaY + * @type {number} + * @default 0 + * @since 3.18.0 */ - this.wordWrapUseAdvanced; + this.deltaY = 0; /** - * The font style, size and family. + * The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device. * - * @name Phaser.GameObjects.TextStyle#_font - * @type {string} - * @private - * @since 3.0.0 + * @name Phaser.Input.Pointer#deltaZ + * @type {number} + * @default 0 + * @since 3.18.0 */ - this._font; + this.deltaZ = 0; + }, - // Set to defaults + user style - this.setStyle(style, false, true); + /** + * Takes a Camera and updates this Pointer's `worldX` and `worldY` values so they are + * the result of a translation through the given Camera. + * + * Note that the values will be automatically replaced the moment the Pointer is + * updated by an input event, such as a mouse move, so should be used immediately. + * + * @method Phaser.Input.Pointer#updateWorldPoint + * @since 3.19.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera which is being tested against. + * + * @return {this} This Pointer object. + */ + updateWorldPoint: function (camera) + { + // Stores the world point inside of tempPoint + var temp = camera.getWorldPoint(this.x, this.y); - var metrics = GetValue(style, 'metrics', false); + this.worldX = temp.x; + this.worldY = temp.y; - // Provide optional TextMetrics in the style object to avoid the canvas look-up / scanning - // Doing this is reset if you then change the font of this TextStyle after creation - if (metrics) - { - this.metrics = { - ascent: GetValue(metrics, 'ascent', 0), - descent: GetValue(metrics, 'descent', 0), - fontSize: GetValue(metrics, 'fontSize', 0) - }; - } - else - { - this.metrics = MeasureText(this); - } + return this; }, /** - * Set the text style. - * - * @example - * text.setStyle({ - * fontSize: '64px', - * fontFamily: 'Arial', - * color: '#ffffff', - * align: 'center', - * backgroundColor: '#ff00ff' - * }); + * Takes a Camera and returns a Vector2 containing the translated position of this Pointer + * within that Camera. This can be used to convert this Pointers position into camera space. * - * @method Phaser.GameObjects.TextStyle#setStyle + * @method Phaser.Input.Pointer#positionToCamera * @since 3.0.0 * - * @param {Phaser.Types.GameObjects.Text.TextStyle} style - The style settings to set. - * @param {boolean} [updateText=true] - Whether to update the text immediately. - * @param {boolean} [setDefaults=false] - Use the default values is not set, or the local values. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the translation. + * @param {(Phaser.Math.Vector2|object)} [output] - A Vector2-like object in which to store the translated position. * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @return {(Phaser.Math.Vector2|object)} A Vector2 containing the translated coordinates of this Pointer, based on the given camera. */ - setStyle: function (style, updateText, setDefaults) + positionToCamera: function (camera, output) { - if (updateText === undefined) { updateText = true; } - if (setDefaults === undefined) { setDefaults = false; } + return camera.getWorldPoint(this.x, this.y, output); + }, - // Avoid type mutation - // eslint-disable-next-line no-prototype-builtins - if (style && style.hasOwnProperty('fontSize') && typeof style.fontSize === 'number') + /** + * Calculates the motion of this Pointer, including its velocity and angle of movement. + * This method is called automatically each frame by the Input Manager. + * + * @method Phaser.Input.Pointer#updateMotion + * @private + * @since 3.16.0 + */ + updateMotion: function () + { + var cx = this.position.x; + var cy = this.position.y; + + var mx = this.midPoint.x; + var my = this.midPoint.y; + + if (cx === mx && cy === my) { - style.fontSize = style.fontSize.toString() + 'px'; + // Nothing to do here + return; } - for (var key in propertyMap) - { - var value = (setDefaults) ? propertyMap[key][1] : this[key]; + // Moving towards our goal ... + var vx = SmoothStepInterpolation(this.motionFactor, mx, cx); + var vy = SmoothStepInterpolation(this.motionFactor, my, cy); - if (key === 'wordWrapCallback' || key === 'wordWrapCallbackScope') - { - // Callback & scope should be set without processing the values - this[key] = GetValue(style, propertyMap[key][0], value); - } - else - { - this[key] = GetAdvancedValue(style, propertyMap[key][0], value); - } + if (FuzzyEqual(vx, cx, 0.1)) + { + vx = cx; } - // Allow for 'font' override - var font = GetValue(style, 'font', null); - - if (font !== null) + if (FuzzyEqual(vy, cy, 0.1)) { - this.setFont(font, false); + vy = cy; } - this._font = [ this.fontStyle, this.fontSize, this.fontFamily ].join(' ').trim(); + this.midPoint.set(vx, vy); - // Allow for 'fill' to be used in place of 'color' - var fill = GetValue(style, 'fill', null); + var dx = cx - vx; + var dy = cy - vy; - if (fill !== null) - { - this.color = fill; - } + this.velocity.set(dx, dy); - if (updateText) - { - return this.update(true); - } - else - { - return this.parent; - } - }, + this.angle = Angle(vx, vy, cx, cy); - /** - * Synchronize the font settings to the given Canvas Rendering Context. - * - * @method Phaser.GameObjects.TextStyle#syncFont - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The Canvas Element. - * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. - */ - syncFont: function (canvas, context) - { - context.font = this._font; + this.distance = Math.sqrt(dx * dx + dy * dy); }, /** - * Synchronize the text style settings to the given Canvas Rendering Context. + * Internal method to handle a Mouse Up Event. * - * @method Phaser.GameObjects.TextStyle#syncStyle + * @method Phaser.Input.Pointer#up + * @private * @since 3.0.0 * - * @param {HTMLCanvasElement} canvas - The Canvas Element. - * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. + * @param {MouseEvent} event - The Mouse Event to process. */ - syncStyle: function (canvas, context) + up: function (event) { - context.textBaseline = 'alphabetic'; + if ('buttons' in event) + { + this.buttons = event.buttons; + } - context.fillStyle = this.color; - context.strokeStyle = this.stroke; + this.event = event; - context.lineWidth = this.strokeThickness; - context.lineCap = 'round'; - context.lineJoin = 'round'; - }, + this.button = event.button; - /** - * Synchronize the shadow settings to the given Canvas Rendering Context. - * - * @method Phaser.GameObjects.TextStyle#syncShadow - * @since 3.0.0 - * - * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context. - * @param {boolean} enabled - Whether shadows are enabled or not. - */ - syncShadow: function (context, enabled) - { - if (enabled) + this.upElement = event.target; + + // Sets the local x/y properties + this.manager.transformPointer(this, event.pageX, event.pageY, false); + + // 0: Main button pressed, usually the left button or the un-initialized state + if (event.button === 0) { - context.shadowOffsetX = this.shadowOffsetX; - context.shadowOffsetY = this.shadowOffsetY; - context.shadowColor = this.shadowColor; - context.shadowBlur = this.shadowBlur; + this.primaryDown = false; + this.upX = this.x; + this.upY = this.y; } - else + + if (this.buttons === 0) { - context.shadowOffsetX = 0; - context.shadowOffsetY = 0; - context.shadowColor = 0; - context.shadowBlur = 0; + // No more buttons are still down + this.isDown = false; + + this.upTime = event.timeStamp; + + this.wasTouch = false; } }, /** - * Update the style settings for the parent Text object. + * Internal method to handle a Mouse Down Event. * - * @method Phaser.GameObjects.TextStyle#update + * @method Phaser.Input.Pointer#down + * @private * @since 3.0.0 * - * @param {boolean} recalculateMetrics - Whether to recalculate font and text metrics. - * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @param {MouseEvent} event - The Mouse Event to process. */ - update: function (recalculateMetrics) + down: function (event) { - if (recalculateMetrics) + if ('buttons' in event) { - this._font = [ this.fontStyle, this.fontSize, this.fontFamily ].join(' ').trim(); - - this.metrics = MeasureText(this); + this.buttons = event.buttons; } - return this.parent.updateText(); - }, + this.event = event; - /** - * Set the font. - * - * If a string is given, the font family is set. - * - * If an object is given, the `fontFamily`, `fontSize` and `fontStyle` - * properties of that object are set. - * - * @method Phaser.GameObjects.TextStyle#setFont - * @since 3.0.0 - * - * @param {(string|object)} font - The font family or font settings to set. - * @param {boolean} [updateText=true] - Whether to update the text immediately. - * - * @return {Phaser.GameObjects.Text} The parent Text object. - */ - setFont: function (font, updateText) - { - if (updateText === undefined) { updateText = true; } + this.button = event.button; - var fontFamily = font; - var fontSize = ''; - var fontStyle = ''; + this.downElement = event.target; - if (typeof font !== 'string') + // Sets the local x/y properties + this.manager.transformPointer(this, event.pageX, event.pageY, false); + + // 0: Main button pressed, usually the left button or the un-initialized state + if (event.button === 0) { - fontFamily = GetValue(font, 'fontFamily', 'Courier'); - fontSize = GetValue(font, 'fontSize', '16px'); - fontStyle = GetValue(font, 'fontStyle', ''); + this.primaryDown = true; + this.downX = this.x; + this.downY = this.y; } - else - { - var fontSplit = font.split(' '); - - var i = 0; - fontStyle = (fontSplit.length > 2) ? fontSplit[i++] : ''; - fontSize = fontSplit[i++] || '16px'; - fontFamily = fontSplit[i++] || 'Courier'; + if (OS.macOS && event.ctrlKey) + { + // Override button settings on macOS + this.buttons = 2; + this.primaryDown = false; } - if (fontFamily !== this.fontFamily || fontSize !== this.fontSize || fontStyle !== this.fontStyle) + if (!this.isDown) { - this.fontFamily = fontFamily; - this.fontSize = fontSize; - this.fontStyle = fontStyle; + this.isDown = true; - if (updateText) - { - this.update(true); - } + this.downTime = event.timeStamp; } - return this.parent; + this.wasTouch = false; }, /** - * Set the font family. + * Internal method to handle a Mouse Move Event. * - * @method Phaser.GameObjects.TextStyle#setFontFamily + * @method Phaser.Input.Pointer#move + * @private * @since 3.0.0 * - * @param {string} family - The font family. - * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @param {MouseEvent} event - The Mouse Event to process. */ - setFontFamily: function (family) + move: function (event) { - if (this.fontFamily !== family) + if ('buttons' in event) { - this.fontFamily = family; + this.buttons = event.buttons; + } - this.update(true); + this.event = event; + + // Sets the local x/y properties + this.manager.transformPointer(this, event.pageX, event.pageY, true); + + if (this.locked) + { + // Multiple DOM events may occur within one frame, but only one Phaser event will fire + this.movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0; + this.movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0; } - return this.parent; + this.moveTime = event.timeStamp; + + this.wasTouch = false; }, /** - * Set the font style. - * - * @method Phaser.GameObjects.TextStyle#setFontStyle - * @since 3.0.0 + * Internal method to handle a Mouse Wheel Event. * - * @param {string} style - The font style. + * @method Phaser.Input.Pointer#wheel + * @private + * @since 3.18.0 * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @param {WheelEvent} event - The Wheel Event to process. */ - setFontStyle: function (style) + wheel: function (event) { - if (this.fontStyle !== style) + if ('buttons' in event) { - this.fontStyle = style; - - this.update(true); + this.buttons = event.buttons; } - return this.parent; + this.event = event; + + // Sets the local x/y properties + this.manager.transformPointer(this, event.pageX, event.pageY, false); + + this.deltaX = event.deltaX; + this.deltaY = event.deltaY; + this.deltaZ = event.deltaZ; + + this.wasTouch = false; }, /** - * Set the font size. + * Internal method to handle a Touch Start Event. * - * @method Phaser.GameObjects.TextStyle#setFontSize + * @method Phaser.Input.Pointer#touchstart + * @private * @since 3.0.0 * - * @param {(number|string)} size - The font size. - * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @param {Touch} touch - The Changed Touch from the Touch Event. + * @param {TouchEvent} event - The full Touch Event. */ - setFontSize: function (size) + touchstart: function (touch, event) { - if (typeof size === 'number') + if (touch['pointerId']) { - size = size.toString() + 'px'; + this.pointerId = touch.pointerId; } - if (this.fontSize !== size) - { - this.fontSize = size; + this.identifier = touch.identifier; + this.target = touch.target; + this.active = true; - this.update(true); - } + this.buttons = 1; - return this.parent; + this.event = event; + + this.downElement = touch.target; + + // Sets the local x/y properties + this.manager.transformPointer(this, touch.pageX, touch.pageY, false); + + this.primaryDown = true; + this.downX = this.x; + this.downY = this.y; + this.downTime = event.timeStamp; + + this.isDown = true; + + this.wasTouch = true; + this.wasCanceled = false; + + this.updateMotion(); }, /** - * Set the test string to use when measuring the font. + * Internal method to handle a Touch Move Event. * - * @method Phaser.GameObjects.TextStyle#setTestString + * @method Phaser.Input.Pointer#touchmove + * @private * @since 3.0.0 * - * @param {string} string - The test string to use when measuring the font. - * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @param {Touch} touch - The Changed Touch from the Touch Event. + * @param {TouchEvent} event - The full Touch Event. */ - setTestString: function (string) + touchmove: function (touch, event) { - this.testString = string; + this.event = event; - return this.update(true); + // Sets the local x/y properties + this.manager.transformPointer(this, touch.pageX, touch.pageY, true); + + this.moveTime = event.timeStamp; + + this.wasTouch = true; + + this.updateMotion(); }, /** - * Set a fixed width and height for the text. - * - * Pass in `0` for either of these parameters to disable fixed width or height respectively. + * Internal method to handle a Touch End Event. * - * @method Phaser.GameObjects.TextStyle#setFixedSize + * @method Phaser.Input.Pointer#touchend + * @private * @since 3.0.0 * - * @param {number} width - The fixed width to set. - * @param {number} height - The fixed height to set. - * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @param {Touch} touch - The Changed Touch from the Touch Event. + * @param {TouchEvent} event - The full Touch Event. */ - setFixedSize: function (width, height) + touchend: function (touch, event) { - this.fixedWidth = width; - this.fixedHeight = height; + this.buttons = 0; - if (width) - { - this.parent.width = width; - } + this.event = event; - if (height) - { - this.parent.height = height; - } + this.upElement = touch.target; - return this.update(false); + // Sets the local x/y properties + this.manager.transformPointer(this, touch.pageX, touch.pageY, false); + + this.primaryDown = false; + this.upX = this.x; + this.upY = this.y; + this.upTime = event.timeStamp; + + this.isDown = false; + + this.wasTouch = true; + this.wasCanceled = false; + + this.active = false; + + this.updateMotion(); }, /** - * Set the background color. - * - * @method Phaser.GameObjects.TextStyle#setBackgroundColor - * @since 3.0.0 + * Internal method to handle a Touch Cancel Event. * - * @param {string} color - The background color. + * @method Phaser.Input.Pointer#touchcancel + * @private + * @since 3.15.0 * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @param {Touch} touch - The Changed Touch from the Touch Event. + * @param {TouchEvent} event - The full Touch Event. */ - setBackgroundColor: function (color) + touchcancel: function (touch, event) { - this.backgroundColor = color; + this.buttons = 0; - return this.update(false); + this.event = event; + + this.upElement = touch.target; + + // Sets the local x/y properties + this.manager.transformPointer(this, touch.pageX, touch.pageY, false); + + this.primaryDown = false; + this.upX = this.x; + this.upY = this.y; + this.upTime = event.timeStamp; + + this.isDown = false; + + this.wasTouch = true; + this.wasCanceled = true; + + this.active = false; }, /** - * Set the text fill color. + * Checks to see if any buttons are being held down on this Pointer. * - * @method Phaser.GameObjects.TextStyle#setFill + * @method Phaser.Input.Pointer#noButtonDown * @since 3.0.0 * - * @param {string} color - The text fill color. - * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @return {boolean} `true` if no buttons are being held down. */ - setFill: function (color) + noButtonDown: function () { - this.color = color; - - return this.update(false); + return (this.buttons === 0); }, /** - * Set the text fill color. + * Checks to see if the left button is being held down on this Pointer. * - * @method Phaser.GameObjects.TextStyle#setColor + * @method Phaser.Input.Pointer#leftButtonDown * @since 3.0.0 * - * @param {string} color - The text fill color. - * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @return {boolean} `true` if the left button is being held down. */ - setColor: function (color) + leftButtonDown: function () { - this.color = color; - - return this.update(false); + return (this.buttons & 1) ? true : false; }, /** - * Set the resolution used by the Text object. - * - * By default it will be set to match the resolution set in the Game Config, - * but you can override it via this method. It allows for much clearer text on High DPI devices, - * at the cost of memory because it uses larger internal Canvas textures for the Text. - * - * Please use with caution, as the more high res Text you have, the more memory it uses up. - * - * @method Phaser.GameObjects.TextStyle#setResolution - * @since 3.12.0 + * Checks to see if the right button is being held down on this Pointer. * - * @param {number} value - The resolution for this Text object to use. + * @method Phaser.Input.Pointer#rightButtonDown + * @since 3.0.0 * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @return {boolean} `true` if the right button is being held down. */ - setResolution: function (value) + rightButtonDown: function () { - this.resolution = value; - - return this.update(false); + return (this.buttons & 2) ? true : false; }, /** - * Set the stroke settings. + * Checks to see if the middle button is being held down on this Pointer. * - * @method Phaser.GameObjects.TextStyle#setStroke + * @method Phaser.Input.Pointer#middleButtonDown * @since 3.0.0 * - * @param {string} color - The stroke color. - * @param {number} thickness - The stroke thickness. - * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @return {boolean} `true` if the middle button is being held down. */ - setStroke: function (color, thickness) + middleButtonDown: function () { - if (thickness === undefined) { thickness = this.strokeThickness; } - - if (color === undefined && this.strokeThickness !== 0) - { - // Reset the stroke to zero (disabling it) - this.strokeThickness = 0; - - this.update(true); - } - else if (this.stroke !== color || this.strokeThickness !== thickness) - { - this.stroke = color; - this.strokeThickness = thickness; - - this.update(true); - } - - return this.parent; + return (this.buttons & 4) ? true : false; }, /** - * Set the shadow settings. - * - * Calling this method always re-measures the parent Text object, - * so only call it when you actually change the shadow settings. + * Checks to see if the back button is being held down on this Pointer. * - * @method Phaser.GameObjects.TextStyle#setShadow + * @method Phaser.Input.Pointer#backButtonDown * @since 3.0.0 * - * @param {number} [x=0] - The horizontal shadow offset. - * @param {number} [y=0] - The vertical shadow offset. - * @param {string} [color='#000'] - The shadow color. - * @param {number} [blur=0] - The shadow blur radius. - * @param {boolean} [shadowStroke=false] - Whether to stroke the shadow. - * @param {boolean} [shadowFill=true] - Whether to fill the shadow. - * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @return {boolean} `true` if the back button is being held down. */ - setShadow: function (x, y, color, blur, shadowStroke, shadowFill) + backButtonDown: function () { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (color === undefined) { color = '#000'; } - if (blur === undefined) { blur = 0; } - if (shadowStroke === undefined) { shadowStroke = false; } - if (shadowFill === undefined) { shadowFill = true; } - - this.shadowOffsetX = x; - this.shadowOffsetY = y; - this.shadowColor = color; - this.shadowBlur = blur; - this.shadowStroke = shadowStroke; - this.shadowFill = shadowFill; - - return this.update(false); + return (this.buttons & 8) ? true : false; }, /** - * Set the shadow offset. + * Checks to see if the forward button is being held down on this Pointer. * - * @method Phaser.GameObjects.TextStyle#setShadowOffset + * @method Phaser.Input.Pointer#forwardButtonDown * @since 3.0.0 * - * @param {number} [x=0] - The horizontal shadow offset. - * @param {number} [y=0] - The vertical shadow offset. - * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @return {boolean} `true` if the forward button is being held down. */ - setShadowOffset: function (x, y) + forwardButtonDown: function () { - if (x === undefined) { x = 0; } - if (y === undefined) { y = x; } - - this.shadowOffsetX = x; - this.shadowOffsetY = y; + return (this.buttons & 16) ? true : false; + }, - return this.update(false); + /** + * Checks to see if the left button was just released on this Pointer. + * + * @method Phaser.Input.Pointer#leftButtonReleased + * @since 3.18.0 + * + * @return {boolean} `true` if the left button was just released. + */ + leftButtonReleased: function () + { + return (this.button === 0 && !this.isDown); }, /** - * Set the shadow color. + * Checks to see if the right button was just released on this Pointer. * - * @method Phaser.GameObjects.TextStyle#setShadowColor - * @since 3.0.0 + * @method Phaser.Input.Pointer#rightButtonReleased + * @since 3.18.0 * - * @param {string} [color='#000'] - The shadow color. + * @return {boolean} `true` if the right button was just released. + */ + rightButtonReleased: function () + { + return (this.button === 2 && !this.isDown); + }, + + /** + * Checks to see if the middle button was just released on this Pointer. * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @method Phaser.Input.Pointer#middleButtonReleased + * @since 3.18.0 + * + * @return {boolean} `true` if the middle button was just released. */ - setShadowColor: function (color) + middleButtonReleased: function () { - if (color === undefined) { color = '#000'; } + return (this.button === 1 && !this.isDown); + }, - this.shadowColor = color; + /** + * Checks to see if the back button was just released on this Pointer. + * + * @method Phaser.Input.Pointer#backButtonReleased + * @since 3.18.0 + * + * @return {boolean} `true` if the back button was just released. + */ + backButtonReleased: function () + { + return (this.button === 3 && !this.isDown); + }, - return this.update(false); + /** + * Checks to see if the forward button was just released on this Pointer. + * + * @method Phaser.Input.Pointer#forwardButtonReleased + * @since 3.18.0 + * + * @return {boolean} `true` if the forward button was just released. + */ + forwardButtonReleased: function () + { + return (this.button === 4 && !this.isDown); }, /** - * Set the shadow blur radius. + * If the Pointer has a button pressed down at the time this method is called, it will return the + * distance between the Pointer's `downX` and `downY` values and the current position. * - * @method Phaser.GameObjects.TextStyle#setShadowBlur - * @since 3.0.0 + * If no button is held down, it will return the last recorded distance, based on where + * the Pointer was when the button was released. * - * @param {number} [blur=0] - The shadow blur radius. + * If you wish to get the distance being travelled currently, based on the velocity of the Pointer, + * then see the `Pointer.distance` property. * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @method Phaser.Input.Pointer#getDistance + * @since 3.13.0 + * + * @return {number} The distance the Pointer moved. */ - setShadowBlur: function (blur) + getDistance: function () { - if (blur === undefined) { blur = 0; } - - this.shadowBlur = blur; - - return this.update(false); + if (this.isDown) + { + return Distance(this.downX, this.downY, this.x, this.y); + } + else + { + return Distance(this.downX, this.downY, this.upX, this.upY); + } }, /** - * Enable or disable shadow stroke. + * If the Pointer has a button pressed down at the time this method is called, it will return the + * horizontal distance between the Pointer's `downX` and `downY` values and the current position. * - * @method Phaser.GameObjects.TextStyle#setShadowStroke - * @since 3.0.0 + * If no button is held down, it will return the last recorded horizontal distance, based on where + * the Pointer was when the button was released. * - * @param {boolean} enabled - Whether shadow stroke is enabled or not. + * @method Phaser.Input.Pointer#getDistanceX + * @since 3.16.0 * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @return {number} The horizontal distance the Pointer moved. */ - setShadowStroke: function (enabled) + getDistanceX: function () { - this.shadowStroke = enabled; - - return this.update(false); + if (this.isDown) + { + return Math.abs(this.downX - this.x); + } + else + { + return Math.abs(this.downX - this.upX); + } }, /** - * Enable or disable shadow fill. + * If the Pointer has a button pressed down at the time this method is called, it will return the + * vertical distance between the Pointer's `downX` and `downY` values and the current position. * - * @method Phaser.GameObjects.TextStyle#setShadowFill - * @since 3.0.0 + * If no button is held down, it will return the last recorded vertical distance, based on where + * the Pointer was when the button was released. * - * @param {boolean} enabled - Whether shadow fill is enabled or not. + * @method Phaser.Input.Pointer#getDistanceY + * @since 3.16.0 * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @return {number} The vertical distance the Pointer moved. */ - setShadowFill: function (enabled) + getDistanceY: function () { - this.shadowFill = enabled; - - return this.update(false); + if (this.isDown) + { + return Math.abs(this.downY - this.y); + } + else + { + return Math.abs(this.downY - this.upY); + } }, /** - * Set the width (in pixels) to use for wrapping lines. - * - * Pass in null to remove wrapping by width. + * If the Pointer has a button pressed down at the time this method is called, it will return the + * duration since the button was pressed down. * - * @method Phaser.GameObjects.TextStyle#setWordWrapWidth - * @since 3.0.0 + * If no button is held down, it will return the last recorded duration, based on the time + * the last button on the Pointer was released. * - * @param {number} width - The maximum width of a line in pixels. Set to null to remove wrapping. - * @param {boolean} [useAdvancedWrap=false] - Whether or not to use the advanced wrapping - * algorithm. If true, spaces are collapsed and whitespace is trimmed from lines. If false, - * spaces and whitespace are left as is. + * @method Phaser.Input.Pointer#getDuration + * @since 3.16.0 * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @return {number} The duration the Pointer was held down for in milliseconds. */ - setWordWrapWidth: function (width, useAdvancedWrap) + getDuration: function () { - if (useAdvancedWrap === undefined) { useAdvancedWrap = false; } - - this.wordWrapWidth = width; - this.wordWrapUseAdvanced = useAdvancedWrap; - - return this.update(false); + if (this.isDown) + { + return (this.manager.time - this.downTime); + } + else + { + return (this.upTime - this.downTime); + } }, /** - * Set a custom callback for wrapping lines. + * If the Pointer has a button pressed down at the time this method is called, it will return the + * angle between the Pointer's `downX` and `downY` values and the current position. * - * Pass in null to remove wrapping by callback. + * If no button is held down, it will return the last recorded angle, based on where + * the Pointer was when the button was released. * - * @method Phaser.GameObjects.TextStyle#setWordWrapCallback - * @since 3.0.0 + * The angle is based on the old position facing to the current position. * - * @param {TextStyleWordWrapCallback} callback - A custom function that will be responsible for wrapping the - * text. It will receive two arguments: text (the string to wrap), textObject (this Text - * instance). It should return the wrapped lines either as an array of lines or as a string with - * newline characters in place to indicate where breaks should happen. - * @param {object} [scope=null] - The scope that will be applied when the callback is invoked. + * If you wish to get the current angle, based on the velocity of the Pointer, then + * see the `Pointer.angle` property. * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @method Phaser.Input.Pointer#getAngle + * @since 3.16.0 + * + * @return {number} The angle between the Pointer's coordinates in radians. */ - setWordWrapCallback: function (callback, scope) + getAngle: function () { - if (scope === undefined) { scope = null; } - - this.wordWrapCallback = callback; - this.wordWrapCallbackScope = scope; - - return this.update(false); + if (this.isDown) + { + return Angle(this.downX, this.downY, this.x, this.y); + } + else + { + return Angle(this.downX, this.downY, this.upX, this.upY); + } }, /** - * Set the alignment of the text in this Text object. + * Takes the previous and current Pointer positions and then generates an array of interpolated values between + * the two. The array will be populated up to the size of the `steps` argument. * - * The argument can be one of: `left`, `right`, `center` or `justify`. + * ```javaScript + * var points = pointer.getInterpolatedPosition(4); * - * Alignment only works if the Text object has more than one line of text. + * // points[0] = { x: 0, y: 0 } + * // points[1] = { x: 2, y: 1 } + * // points[2] = { x: 3, y: 2 } + * // points[3] = { x: 6, y: 3 } + * ``` * - * @method Phaser.GameObjects.TextStyle#setAlign - * @since 3.0.0 + * Use this if you need to get smoothed values between the previous and current pointer positions. DOM pointer + * events can often fire faster than the main browser loop, and this will help you avoid janky movement + * especially if you have an object following a Pointer. * - * @param {string} [align='left'] - The text alignment for multi-line text. + * Note that if you provide an output array it will only be populated up to the number of steps provided. + * It will not clear any previous data that may have existed beyond the range of the steps count. * - * @return {Phaser.GameObjects.Text} The parent Text object. + * Internally it uses the Smooth Step interpolation calculation. + * + * @method Phaser.Input.Pointer#getInterpolatedPosition + * @since 3.11.0 + * + * @param {number} [steps=10] - The number of interpolation steps to use. + * @param {array} [out] - An array to store the results in. If not provided a new one will be created. + * + * @return {array} An array of interpolated values. */ - setAlign: function (align) + getInterpolatedPosition: function (steps, out) { - if (align === undefined) { align = 'left'; } + if (steps === undefined) { steps = 10; } + if (out === undefined) { out = []; } - this.align = align; + var prevX = this.prevPosition.x; + var prevY = this.prevPosition.y; - return this.update(false); + var curX = this.position.x; + var curY = this.position.y; + + for (var i = 0; i < steps; i++) + { + var t = (1 / steps) * i; + + out[i] = { x: SmoothStepInterpolation(t, prevX, curX), y: SmoothStepInterpolation(t, prevY, curY) }; + } + + return out; }, /** - * Set the maximum number of lines to draw. - * - * @method Phaser.GameObjects.TextStyle#setMaxLines - * @since 3.0.0 - * - * @param {number} [max=0] - The maximum number of lines to draw. + * Fully reset this Pointer back to its unitialized state. * - * @return {Phaser.GameObjects.Text} The parent Text object. + * @method Phaser.Input.Pointer#reset + * @since 3.60.0 */ - setMaxLines: function (max) + reset: function () { - if (max === undefined) { max = 0; } + this.event = null; + this.downElement = null; + this.upElement = null; - this.maxLines = max; + this.button = 0; + this.buttons = 0; - return this.update(false); + this.position.set(0, 0); + this.prevPosition.set(0, 0); + this.midPoint.set(-1, -1); + this.velocity.set(0, 0); + this.angle = 0; + this.distance = 0; + this.worldX = 0; + this.worldY = 0; + this.downX = 0; + this.downY = 0; + this.upX = 0; + this.upY = 0; + this.moveTime = 0; + this.upTime = 0; + this.downTime = 0; + this.primaryDown = false; + this.isDown = false; + this.wasTouch = false; + this.wasCanceled = false; + this.movementX = 0; + this.movementY = 0; + this.identifier = 0; + this.pointerId = null; + this.deltaX = 0; + this.deltaY = 0; + this.deltaZ = 0; + + this.active = (this.id === 0) ? true : false; }, /** - * Get the current text metrics. + * Destroys this Pointer instance and resets its external references. * - * @method Phaser.GameObjects.TextStyle#getTextMetrics + * @method Phaser.Input.Pointer#destroy * @since 3.0.0 - * - * @return {Phaser.Types.GameObjects.Text.TextMetrics} The text metrics. */ - getTextMetrics: function () + destroy: function () { - var metrics = this.metrics; - - return { - ascent: metrics.ascent, - descent: metrics.descent, - fontSize: metrics.fontSize - }; + this.camera = null; + this.manager = null; + this.position = null; }, /** - * Build a JSON representation of this Text Style. + * The x position of this Pointer. + * The value is in screen space. + * See `worldX` to get a camera converted position. * - * @method Phaser.GameObjects.TextStyle#toJSON + * @name Phaser.Input.Pointer#x + * @type {number} * @since 3.0.0 - * - * @return {object} A JSON representation of this Text Style. */ - toJSON: function () - { - var output = {}; + x: { - for (var key in propertyMap) + get: function () { - output[key] = this[key]; - } + return this.position.x; + }, - output.metrics = this.getTextMetrics(); + set: function (value) + { + this.position.x = value; + } - return output; }, /** - * Destroy this Text Style. + * The y position of this Pointer. + * The value is in screen space. + * See `worldY` to get a camera converted position. * - * @method Phaser.GameObjects.TextStyle#destroy + * @name Phaser.Input.Pointer#y + * @type {number} * @since 3.0.0 */ - destroy: function () - { - this.parent = undefined; + y: { + + get: function () + { + return this.position.y; + }, + + set: function (value) + { + this.position.y = value; + } + + }, + + /** + * Time when this Pointer was most recently updated by a DOM Event. + * This comes directly from the `event.timeStamp` property. + * If no event has yet taken place, it will return zero. + * + * @name Phaser.Input.Pointer#time + * @type {number} + * @readonly + * @since 3.16.0 + */ + time: { + + get: function () + { + return (this.event) ? this.event.timeStamp : 0; + } + } }); -module.exports = TextStyle; +module.exports = Pointer; /***/ }), -/* 460 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 72687: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CanvasPool = __webpack_require__(31); - -/** - * Calculates the ascent, descent and fontSize of a given font style. - * - * @function Phaser.GameObjects.MeasureText - * @since 3.0.0 - * - * @param {Phaser.GameObjects.TextStyle} textStyle - The TextStyle object to measure. - * - * @return {Phaser.Types.GameObjects.Text.TextMetrics} An object containing the ascent, descent and fontSize of the TextStyle. - */ -var MeasureText = function (textStyle) -{ - var canvas = CanvasPool.create(this); - var context = canvas.getContext('2d'); - - textStyle.syncFont(canvas, context); - - var metrics = context.measureText(textStyle.testString); - - if ('actualBoundingBoxAscent' in metrics) - { - var ascent = metrics.actualBoundingBoxAscent; - var descent = metrics.actualBoundingBoxDescent; - - CanvasPool.remove(canvas); - - return { - ascent: ascent, - descent: descent, - fontSize: ascent + descent - }; - } +var INPUT_CONST = { - var width = Math.ceil(metrics.width * textStyle.baselineX); - var baseline = width; - var height = 2 * baseline; + /** + * The mouse pointer is being held down. + * + * @name Phaser.Input.MOUSE_DOWN + * @type {number} + * @since 3.10.0 + */ + MOUSE_DOWN: 0, - baseline = baseline * textStyle.baselineY | 0; + /** + * The mouse pointer is being moved. + * + * @name Phaser.Input.MOUSE_MOVE + * @type {number} + * @since 3.10.0 + */ + MOUSE_MOVE: 1, - canvas.width = width; - canvas.height = height; + /** + * The mouse pointer is released. + * + * @name Phaser.Input.MOUSE_UP + * @type {number} + * @since 3.10.0 + */ + MOUSE_UP: 2, - context.fillStyle = '#f00'; - context.fillRect(0, 0, width, height); + /** + * A touch pointer has been started. + * + * @name Phaser.Input.TOUCH_START + * @type {number} + * @since 3.10.0 + */ + TOUCH_START: 3, - context.font = textStyle._font; + /** + * A touch pointer has been started. + * + * @name Phaser.Input.TOUCH_MOVE + * @type {number} + * @since 3.10.0 + */ + TOUCH_MOVE: 4, - context.textBaseline = 'alphabetic'; - context.fillStyle = '#000'; - context.fillText(textStyle.testString, 0, baseline); + /** + * A touch pointer has been started. + * + * @name Phaser.Input.TOUCH_END + * @type {number} + * @since 3.10.0 + */ + TOUCH_END: 5, - var output = { - ascent: 0, - descent: 0, - fontSize: 0 - }; + /** + * The pointer lock has changed. + * + * @name Phaser.Input.POINTER_LOCK_CHANGE + * @type {number} + * @since 3.10.0 + */ + POINTER_LOCK_CHANGE: 6, - var imagedata = context.getImageData(0, 0, width, height); - if (!imagedata) - { - output.ascent = baseline; - output.descent = baseline + 6; - output.fontSize = output.ascent + output.descent; + /** + * A touch pointer has been been cancelled by the browser. + * + * @name Phaser.Input.TOUCH_CANCEL + * @type {number} + * @since 3.15.0 + */ + TOUCH_CANCEL: 7, - CanvasPool.remove(canvas); + /** + * The mouse wheel changes. + * + * @name Phaser.Input.MOUSE_WHEEL + * @type {number} + * @since 3.18.0 + */ + MOUSE_WHEEL: 8 - return output; - } +}; - var pixels = imagedata.data; - var numPixels = pixels.length; - var line = width * 4; - var i; - var j; - var idx = 0; - var stop = false; +module.exports = INPUT_CONST; - // ascent. scan from top to bottom until we find a non red pixel - for (i = 0; i < baseline; i++) - { - for (j = 0; j < line; j += 4) - { - if (pixels[idx + j] !== 255) - { - stop = true; - break; - } - } - if (!stop) - { - idx += line; - } - else - { - break; - } - } +/***/ }), - output.ascent = baseline - i; +/***/ 14874: +/***/ ((module) => { - idx = numPixels - line; - stop = false; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // descent. scan from bottom to top until we find a non red pixel - for (i = height; i > baseline; i--) - { - for (j = 0; j < line; j += 4) - { - if (pixels[idx + j] !== 255) - { - stop = true; - break; - } - } +/** + * The Input Plugin Boot Event. + * + * This internal event is dispatched by the Input Plugin when it boots, signalling to all of its systems to create themselves. + * + * @event Phaser.Input.Events#BOOT + * @type {string} + * @since 3.0.0 + */ +module.exports = 'boot'; - if (!stop) - { - idx -= line; - } - else - { - break; - } - } - output.descent = (i - baseline); - output.fontSize = output.ascent + output.descent; +/***/ }), - CanvasPool.remove(canvas); +/***/ 54168: +/***/ ((module) => { - return output; -}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = MeasureText; +/** + * The Input Plugin Destroy Event. + * + * This internal event is dispatched by the Input Plugin when it is destroyed, signalling to all of its systems to destroy themselves. + * + * @event Phaser.Input.Events#DESTROY + * @type {string} + * @since 3.0.0 + */ +module.exports = 'destroy'; /***/ }), -/* 461 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 526: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArcRender = __webpack_require__(1097); -var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(36); -var Earcut = __webpack_require__(59); -var GeomCircle = __webpack_require__(65); -var MATH_CONST = __webpack_require__(14); -var Shape = __webpack_require__(34); - /** - * @classdesc - * The Arc Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * When it renders it displays an arc shape. You can control the start and end angles of the arc, - * as well as if the angles are winding clockwise or anti-clockwise. With the default settings - * it renders as a complete circle. By changing the angles you can create other arc shapes, - * such as half-circles. - * - * Arcs also have an `iterations` property and corresponding `setIterations` method. This allows - * you to control how smooth the shape renders in WebGL, by controlling the number of iterations - * that take place during construction. + * The Pointer Drag End Input Event. * - * @class Arc - * @extends Phaser.GameObjects.Shape - * @memberof Phaser.GameObjects - * @constructor - * @since 3.13.0 + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer stops dragging a Game Object. * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [radius=128] - The radius of the arc. - * @param {number} [startAngle=0] - The start angle of the arc, in degrees. - * @param {number} [endAngle=360] - The end angle of the arc, in degrees. - * @param {boolean} [anticlockwise=false] - The winding order of the start and end angles. - * @param {number} [fillColor] - The color the arc will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the arc will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * Listen to this event from within a Scene using: `this.input.on('dragend', listener)`. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_END]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_END} event instead. + * + * @event Phaser.Input.Events#DRAG_END + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer stopped dragging. */ -var Arc = new Class({ - - Extends: Shape, +module.exports = 'dragend'; - Mixins: [ - ArcRender - ], - initialize: +/***/ }), - function Arc (scene, x, y, radius, startAngle, endAngle, anticlockwise, fillColor, fillAlpha) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (radius === undefined) { radius = 128; } - if (startAngle === undefined) { startAngle = 0; } - if (endAngle === undefined) { endAngle = 360; } - if (anticlockwise === undefined) { anticlockwise = false; } +/***/ 81623: +/***/ ((module) => { - Shape.call(this, scene, 'Arc', new GeomCircle(0, 0, radius)); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Private internal value. Holds the start angle in degrees. - * - * @name Phaser.GameObjects.Arc#_startAngle - * @type {number} - * @private - * @since 3.13.0 - */ - this._startAngle = startAngle; +/** + * The Pointer Drag Enter Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object into a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('dragenter', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_ENTER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_ENTER} event instead. + * + * @event Phaser.Input.Events#DRAG_ENTER + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved into. + */ +module.exports = 'dragenter'; - /** - * Private internal value. Holds the end angle in degrees. - * - * @name Phaser.GameObjects.Arc#_endAngle - * @type {number} - * @private - * @since 3.13.0 - */ - this._endAngle = endAngle; - /** - * Private internal value. Holds the winding order of the start and end angles. - * - * @name Phaser.GameObjects.Arc#_anticlockwise - * @type {boolean} - * @private - * @since 3.13.0 - */ - this._anticlockwise = anticlockwise; +/***/ }), - /** - * Private internal value. Holds the number of iterations used when drawing the arc. - * - * @name Phaser.GameObjects.Arc#_iterations - * @type {number} - * @default 0.01 - * @private - * @since 3.13.0 - */ - this._iterations = 0.01; +/***/ 94472: +/***/ ((module) => { - this.setPosition(x, y); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var diameter = this.geom.radius * 2; - this.setSize(diameter, diameter); +/** + * The Pointer Drag Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves while dragging a Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('drag', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG} event instead. + * + * @event Phaser.Input.Events#DRAG + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'drag'; - if (fillColor !== undefined) - { - this.setFillStyle(fillColor, fillAlpha); - } - this.updateDisplayOrigin(); - this.updateData(); - }, +/***/ }), - /** - * The number of iterations used when drawing the arc. - * Increase this value for smoother arcs, at the cost of more polygons being rendered. - * Modify this value by small amounts, such as 0.01. - * - * @name Phaser.GameObjects.Arc#iterations - * @type {number} - * @default 0.01 - * @since 3.13.0 - */ - iterations: { +/***/ 9304: +/***/ ((module) => { - get: function () - { - return this._iterations; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - set: function (value) - { - this._iterations = value; +/** + * The Pointer Drag Leave Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object out of a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('dragleave', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_LEAVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_LEAVE} event instead. + * + * @event Phaser.Input.Events#DRAG_LEAVE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has left. + */ +module.exports = 'dragleave'; - this.updateData(); - } - }, +/***/ }), - /** - * The radius of the arc. - * - * @name Phaser.GameObjects.Arc#radius - * @type {number} - * @since 3.13.0 - */ - radius: { +/***/ 34265: +/***/ ((module) => { - get: function () - { - return this.geom.radius; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - set: function (value) - { - this.geom.radius = value; +/** + * The Pointer Drag Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object over a Drag Target. + * + * When the Game Object first enters the drag target it will emit a `dragenter` event. If it then moves while within + * the drag target, it will emit this event instead. + * + * Listen to this event from within a Scene using: `this.input.on('dragover', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_OVER} event instead. + * + * @event Phaser.Input.Events#DRAG_OVER + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved over. + */ +module.exports = 'dragover'; - var diameter = value * 2; - this.setSize(diameter, diameter); - this.updateDisplayOrigin(); - this.updateData(); - } - }, +/***/ }), - /** - * The start angle of the arc, in degrees. - * - * @name Phaser.GameObjects.Arc#startAngle - * @type {number} - * @since 3.13.0 - */ - startAngle: { +/***/ 50151: +/***/ ((module) => { - get: function () - { - return this._startAngle; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - set: function (value) - { - this._startAngle = value; +/** + * The Pointer Drag Start Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer starts to drag any Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('dragstart', listener)`. + * + * A Pointer can only drag a single Game Object at once. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_START]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_START} event instead. + * + * @event Phaser.Input.Events#DRAG_START + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. + */ +module.exports = 'dragstart'; - this.updateData(); - } - }, +/***/ }), - /** - * The end angle of the arc, in degrees. - * - * @name Phaser.GameObjects.Arc#endAngle - * @type {number} - * @since 3.13.0 - */ - endAngle: { +/***/ 98134: +/***/ ((module) => { - get: function () - { - return this._endAngle; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - set: function (value) - { - this._endAngle = value; +/** + * The Pointer Drop Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drops a Game Object on a Drag Target. + * + * Listen to this event from within a Scene using: `this.input.on('drop', listener)`. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DROP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DROP} event instead. + * + * @event Phaser.Input.Events#DROP + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer was dragging. + * @param {Phaser.GameObjects.GameObject} target - The Drag Target the `gameObject` has been dropped on. + */ +module.exports = 'drop'; - this.updateData(); - } - }, +/***/ }), - /** - * The winding order of the start and end angles. - * - * @name Phaser.GameObjects.Arc#anticlockwise - * @type {boolean} - * @since 3.13.0 - */ - anticlockwise: { +/***/ 56773: +/***/ ((module) => { - get: function () - { - return this._anticlockwise; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - set: function (value) - { - this._anticlockwise = value; +/** + * The Game Object Down Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down on _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectdown', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_DOWN + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was pressed down on. + * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectdown'; - this.updateData(); - } - }, +/***/ }), - /** - * Sets the radius of the arc. - * This call can be chained. - * - * @method Phaser.GameObjects.Arc#setRadius - * @since 3.13.0 - * - * @param {number} value - The value to set the radius to. - * - * @return {this} This Game Object instance. - */ - setRadius: function (value) - { - this.radius = value; +/***/ 45824: +/***/ ((module) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets the number of iterations used when drawing the arc. - * Increase this value for smoother arcs, at the cost of more polygons being rendered. - * Modify this value by small amounts, such as 0.01. - * This call can be chained. - * - * @method Phaser.GameObjects.Arc#setIterations - * @since 3.13.0 - * - * @param {number} value - The value to set the iterations to. - * - * @return {this} This Game Object instance. - */ - setIterations: function (value) - { - if (value === undefined) { value = 0.01; } +/** + * The Game Object Drag End Event. + * + * This event is dispatched by an interactive Game Object if a pointer stops dragging it. + * + * Listen to this event from a Game Object using: `gameObject.on('dragend', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive](Phaser.GameObjects.GameObject#setInteractive) for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_END + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer stopped dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer stopped dragging the Game Object, in world space. + */ +module.exports = 'dragend'; - this.iterations = value; - return this; - }, +/***/ }), - /** - * Sets the starting angle of the arc, in degrees. - * This call can be chained. - * - * @method Phaser.GameObjects.Arc#setStartAngle - * @since 3.13.0 - * - * @param {number} value - The value to set the starting angle to. - * - * @return {this} This Game Object instance. - */ - setStartAngle: function (angle, anticlockwise) - { - this._startAngle = angle; +/***/ 39578: +/***/ ((module) => { - if (anticlockwise !== undefined) - { - this._anticlockwise = anticlockwise; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this.updateData(); - }, +/** + * The Game Object Drag Enter Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it into a drag target. + * + * Listen to this event from a Game Object using: `gameObject.on('dragenter', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_ENTER + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved into. + */ +module.exports = 'dragenter'; - /** - * Sets the ending angle of the arc, in degrees. - * This call can be chained. - * - * @method Phaser.GameObjects.Arc#setEndAngle - * @since 3.13.0 - * - * @param {number} value - The value to set the ending angle to. - * - * @return {this} This Game Object instance. - */ - setEndAngle: function (angle, anticlockwise) - { - this._endAngle = angle; - if (anticlockwise !== undefined) - { - this._anticlockwise = anticlockwise; - } +/***/ }), - return this.updateData(); - }, +/***/ 72072: +/***/ ((module) => { - /** - * Internal method that updates the data and path values. - * - * @method Phaser.GameObjects.Arc#updateData - * @private - * @since 3.13.0 - * - * @return {this} This Game Object instance. - */ - updateData: function () - { - var step = this._iterations; - var iteration = step; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var radius = this.geom.radius; - var startAngle = DegToRad(this._startAngle); - var endAngle = DegToRad(this._endAngle); - var anticlockwise = this._anticlockwise; +/** + * The Game Object Drag Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves while dragging it. + * + * Listen to this event from a Game Object using: `gameObject.on('drag', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'drag'; - var x = radius; - var y = radius; - endAngle -= startAngle; +/***/ }), - if (anticlockwise) - { - if (endAngle < -MATH_CONST.PI2) - { - endAngle = -MATH_CONST.PI2; - } - else if (endAngle > 0) - { - endAngle = -MATH_CONST.PI2 + endAngle % MATH_CONST.PI2; - } - } - else if (endAngle > MATH_CONST.PI2) - { - endAngle = MATH_CONST.PI2; - } - else if (endAngle < 0) - { - endAngle = MATH_CONST.PI2 + endAngle % MATH_CONST.PI2; - } +/***/ 82569: +/***/ ((module) => { - var path = [ x + Math.cos(startAngle) * radius, y + Math.sin(startAngle) * radius ]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var ta; +/** + * The Game Object Drag Leave Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it out of a drag target. + * + * Listen to this event from a Game Object using: `gameObject.on('dragleave', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_LEAVE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has left. + */ +module.exports = 'dragleave'; - while (iteration < 1) - { - ta = endAngle * iteration + startAngle; - path.push(x + Math.cos(ta) * radius, y + Math.sin(ta) * radius); +/***/ }), - iteration += step; - } +/***/ 70833: +/***/ ((module) => { - ta = endAngle + startAngle; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - path.push(x + Math.cos(ta) * radius, y + Math.sin(ta) * radius); +/** + * The Game Object Drag Over Event. + * + * This event is dispatched by an interactive Game Object if a pointer drags it over a drag target. + * + * When the Game Object first enters the drag target it will emit a `dragenter` event. If it then moves while within + * the drag target, it will emit this event instead. + * + * Listen to this event from a Game Object using: `gameObject.on('dragover', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_OVER + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved over. + */ +module.exports = 'dragover'; - path.push(x + Math.cos(startAngle) * radius, y + Math.sin(startAngle) * radius); - this.pathIndexes = Earcut(path); - this.pathData = path; +/***/ }), - return this; - } +/***/ 81442: +/***/ ((module) => { -}); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = Arc; +/** + * The Game Object Drag Start Event. + * + * This event is dispatched by an interactive Game Object if a pointer starts to drag it. + * + * Listen to this event from a Game Object using: `gameObject.on('dragstart', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * There are lots of useful drag related properties that are set within the Game Object when dragging occurs. + * For example, `gameObject.input.dragStartX`, `dragStartY` and so on. + * + * @event Phaser.Input.Events#GAMEOBJECT_DRAG_START + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. + * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. + */ +module.exports = 'dragstart'; /***/ }), -/* 462 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 32936: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var CurveRender = __webpack_require__(1100); -var Earcut = __webpack_require__(59); -var Rectangle = __webpack_require__(10); -var Shape = __webpack_require__(34); - /** - * @classdesc - * The Curve Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * To render a Curve Shape you must first create a `Phaser.Curves.Curve` object, then pass it to - * the Curve Shape in the constructor. - * - * The Curve shape also has a `smoothness` property and corresponding `setSmoothness` method. - * This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations - * that take place during construction. Increase and decrease the default value for smoother, or more - * jagged, shapes. + * The Game Object Drop Event. * - * @class Curve - * @extends Phaser.GameObjects.Shape - * @memberof Phaser.GameObjects - * @constructor - * @since 3.13.0 + * This event is dispatched by an interactive Game Object if a pointer drops it on a Drag Target. * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {Phaser.Curves.Curve} [curve] - The Curve object to use to create the Shape. - * @param {number} [fillColor] - The color the curve will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the curve will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * Listen to this event from a Game Object using: `gameObject.on('drop', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive and enabled for drag. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * @event Phaser.Input.Events#GAMEOBJECT_DROP + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} target - The Drag Target the `gameObject` has been dropped on. */ -var Curve = new Class({ - - Extends: Shape, - - Mixins: [ - CurveRender - ], - - initialize: +module.exports = 'drop'; - function Curve (scene, x, y, curve, fillColor, fillAlpha) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - Shape.call(this, scene, 'Curve', curve); +/***/ }), - /** - * Private internal value. - * The number of points used to draw the curve. Higher values create smoother renders at the cost of more triangles being drawn. - * - * @name Phaser.GameObjects.Curve#_smoothness - * @type {number} - * @private - * @since 3.13.0 - */ - this._smoothness = 32; +/***/ 99658: +/***/ ((module) => { - /** - * Private internal value. - * The Curve bounds rectangle. - * - * @name Phaser.GameObjects.Curve#_curveBounds - * @type {Phaser.Geom.Rectangle} - * @private - * @since 3.13.0 - */ - this._curveBounds = new Rectangle(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.closePath = false; +/** + * The Game Object Move Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is moved across _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectmove', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_MOVE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was moved on. + * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectmove'; - this.setPosition(x, y); - if (fillColor !== undefined) - { - this.setFillStyle(fillColor, fillAlpha); - } +/***/ }), - this.updateData(); - }, +/***/ 60515: +/***/ ((module) => { - /** - * The smoothness of the curve. The number of points used when rendering it. - * Increase this value for smoother curves, at the cost of more polygons being rendered. - * - * @name Phaser.GameObjects.Curve#smoothness - * @type {number} - * @default 32 - * @since 3.13.0 - */ - smoothness: { +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - get: function () - { - return this._smoothness; - }, +/** + * The Game Object Out Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves out of _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectout', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * If the pointer leaves the game canvas itself, it will not trigger an this event. To handle those cases, + * please listen for the [GAME_OUT]{@linkcode Phaser.Input.Events#event:GAME_OUT} event. + * + * @event Phaser.Input.Events#GAMEOBJECT_OUT + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer moved out of. + * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectout'; - set: function (value) - { - this._smoothness = value; - this.updateData(); - } +/***/ }), - }, +/***/ 55254: +/***/ ((module) => { - /** - * Sets the smoothness of the curve. The number of points used when rendering it. - * Increase this value for smoother curves, at the cost of more polygons being rendered. - * This call can be chained. - * - * @method Phaser.GameObjects.Curve#setSmoothness - * @since 3.13.0 - * - * @param {number} value - The value to set the smoothness to. - * - * @return {this} This Game Object instance. - */ - setSmoothness: function (value) - { - this._smoothness = value; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this.updateData(); - }, +/** + * The Game Object Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves over _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectover', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_OVER + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer moved over. + * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectover'; - /** - * Internal method that updates the data and path values. - * - * @method Phaser.GameObjects.Curve#updateData - * @private - * @since 3.13.0 - * - * @return {this} This Game Object instance. - */ - updateData: function () - { - var bounds = this._curveBounds; - var smoothness = this._smoothness; - // Update the bounds in case the underlying data has changed - this.geom.getBounds(bounds, smoothness); +/***/ }), - this.setSize(bounds.width, bounds.height); - this.updateDisplayOrigin(); +/***/ 34782: +/***/ ((module) => { - var path = []; - var points = this.geom.getPoints(smoothness); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - for (var i = 0; i < points.length; i++) - { - path.push(points[i].x, points[i].y); - } +/** + * The Game Object Pointer Down Event. + * + * This event is dispatched by an interactive Game Object if a pointer is pressed down on it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerdown', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_DOWN + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerdown'; - path.push(points[0].x, points[0].y); - this.pathIndexes = Earcut(path); - this.pathData = path; +/***/ }), - return this; - } +/***/ 41769: +/***/ ((module) => { -}); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = Curve; +/** + * The Game Object Pointer Move Event. + * + * This event is dispatched by an interactive Game Object if a pointer is moved while over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointermove', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_MOVE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointermove'; /***/ }), -/* 463 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 65588: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Earcut = __webpack_require__(59); -var EllipseRender = __webpack_require__(1103); -var GeomEllipse = __webpack_require__(111); -var Shape = __webpack_require__(34); - /** - * @classdesc - * The Ellipse Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * When it renders it displays an ellipse shape. You can control the width and height of the ellipse. - * If the width and height match it will render as a circle. If the width is less than the height, - * it will look more like an egg shape. - * - * The Ellipse shape also has a `smoothness` property and corresponding `setSmoothness` method. - * This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations - * that take place during construction. Increase and decrease the default value for smoother, or more - * jagged, shapes. + * The Game Object Pointer Out Event. * - * @class Ellipse - * @extends Phaser.GameObjects.Shape - * @memberof Phaser.GameObjects - * @constructor - * @since 3.13.0 + * This event is dispatched by an interactive Game Object if a pointer moves out of it. * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [width=128] - The width of the ellipse. An ellipse with equal width and height renders as a circle. - * @param {number} [height=128] - The height of the ellipse. An ellipse with equal width and height renders as a circle. - * @param {number} [fillColor] - The color the ellipse will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the ellipse will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * Listen to this event from a Game Object using: `gameObject.on('pointerout', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * If the pointer leaves the game canvas itself, it will not trigger an this event. To handle those cases, + * please listen for the [GAME_OUT]{@linkcode Phaser.Input.Events#event:GAME_OUT} event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_OUT + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. */ -var Ellipse = new Class({ +module.exports = 'pointerout'; - Extends: Shape, - - Mixins: [ - EllipseRender - ], - initialize: +/***/ }), - function Ellipse (scene, x, y, width, height, fillColor, fillAlpha) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = 128; } - if (height === undefined) { height = 128; } +/***/ 61640: +/***/ ((module) => { - Shape.call(this, scene, 'Ellipse', new GeomEllipse(width / 2, height / 2, width, height)); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Private internal value. - * The number of points used to draw the curve. Higher values create smoother renders at the cost of more triangles being drawn. - * - * @name Phaser.GameObjects.Ellipse#_smoothness - * @type {number} - * @private - * @since 3.13.0 - */ - this._smoothness = 64; +/** + * The Game Object Pointer Over Event. + * + * This event is dispatched by an interactive Game Object if a pointer moves over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerover', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_OVER + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerover'; - this.setPosition(x, y); - this.width = width; - this.height = height; +/***/ }), - if (fillColor !== undefined) - { - this.setFillStyle(fillColor, fillAlpha); - } +/***/ 49342: +/***/ ((module) => { - this.updateDisplayOrigin(); - this.updateData(); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The smoothness of the ellipse. The number of points used when rendering it. - * Increase this value for a smoother ellipse, at the cost of more polygons being rendered. - * - * @name Phaser.GameObjects.Ellipse#smoothness - * @type {number} - * @default 64 - * @since 3.13.0 - */ - smoothness: { +/** + * The Game Object Pointer Up Event. + * + * This event is dispatched by an interactive Game Object if a pointer is released while over it. + * + * Listen to this event from a Game Object using: `gameObject.on('pointerup', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_UP + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. + * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'pointerup'; - get: function () - { - return this._smoothness; - }, - set: function (value) - { - this._smoothness = value; +/***/ }), - this.updateData(); - } +/***/ 82662: +/***/ ((module) => { - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets the size of the ellipse by changing the underlying geometry data, rather than scaling the object. - * This call can be chained. - * - * @method Phaser.GameObjects.Ellipse#setSize - * @since 3.13.0 - * - * @param {number} width - The width of the ellipse. - * @param {number} height - The height of the ellipse. - * - * @return {this} This Game Object instance. - */ - setSize: function (width, height) - { - this.width = width; - this.height = height; - this.geom.setPosition(width / 2, height / 2); - this.geom.setSize(width, height); +/** + * The Game Object Pointer Wheel Event. + * + * This event is dispatched by an interactive Game Object if a pointer has its wheel moved while over it. + * + * Listen to this event from a Game Object using: `gameObject.on('wheel', listener)`. + * Note that the scope of the listener is automatically set to be the Game Object instance itself. + * + * To receive this event, the Game Object must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_WHEEL} + * 2. [GAMEOBJECT_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_WHEEL} + * 3. [POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:POINTER_WHEEL} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_POINTER_WHEEL + * @type {string} + * @since 3.18.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {number} deltaX - The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device. + * @param {number} deltaY - The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device. This value will typically be less than 0 if the user scrolls up and greater than zero if scrolling down. + * @param {number} deltaZ - The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device. + * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'wheel'; - return this.updateData(); - }, - /** - * Sets the smoothness of the ellipse. The number of points used when rendering it. - * Increase this value for a smoother ellipse, at the cost of more polygons being rendered. - * This call can be chained. - * - * @method Phaser.GameObjects.Ellipse#setSmoothness - * @since 3.13.0 - * - * @param {number} value - The value to set the smoothness to. - * - * @return {this} This Game Object instance. - */ - setSmoothness: function (value) - { - this._smoothness = value; +/***/ }), - return this.updateData(); - }, +/***/ 13058: +/***/ ((module) => { - /** - * Internal method that updates the data and path values. - * - * @method Phaser.GameObjects.Ellipse#updateData - * @private - * @since 3.13.0 - * - * @return {this} This Game Object instance. - */ - updateData: function () - { - var path = []; - var points = this.geom.getPoints(this._smoothness); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - for (var i = 0; i < points.length; i++) - { - path.push(points[i].x, points[i].y); - } +/** + * The Game Object Up Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released while over _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectup', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_UP + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was over when released. + * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectup'; - path.push(points[0].x, points[0].y); - this.pathIndexes = Earcut(path); - this.pathData = path; +/***/ }), - return this; - } +/***/ 52426: +/***/ ((module) => { -}); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = Ellipse; +/** + * The Game Object Wheel Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer has its wheel moved while over _any_ interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('gameobjectwheel', listener)`. + * + * To receive this event, the Game Objects must have been set as interactive. + * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * + * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_WHEEL} event instead. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_WHEEL} + * 2. [GAMEOBJECT_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_WHEEL} + * 3. [POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:POINTER_WHEEL} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#GAMEOBJECT_WHEEL + * @type {string} + * @since 3.18.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was over when the wheel changed. + * @param {number} deltaX - The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device. + * @param {number} deltaY - The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device. This value will typically be less than 0 if the user scrolls up and greater than zero if scrolling down. + * @param {number} deltaZ - The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device. + * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. + */ +module.exports = 'gameobjectwheel'; /***/ }), -/* 464 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 78072: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Shape = __webpack_require__(34); -var GridRender = __webpack_require__(1106); - /** - * @classdesc - * The Grid Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. + * The Input Plugin Game Out Event. * - * This shape supports only fill colors and cannot be stroked. + * This event is dispatched by the Input Plugin if the active pointer leaves the game canvas and is now + * outside of it, elsewhere on the web page. * - * A Grid Shape allows you to display a grid in your game, where you can control the size of the - * grid as well as the width and height of the grid cells. You can set a fill color for each grid - * cell as well as an alternate fill color. When the alternate fill color is set then the grid - * cells will alternate the fill colors as they render, creating a chess-board effect. You can - * also optionally have an outline fill color. If set, this draws lines between the grid cells - * in the given color. If you specify an outline color with an alpha of zero, then it will draw - * the cells spaced out, but without the lines between them. + * Listen to this event from within a Scene using: `this.input.on('gameout', listener)`. * - * @class Grid - * @extends Phaser.GameObjects.Shape - * @memberof Phaser.GameObjects - * @constructor - * @since 3.13.0 + * @event Phaser.Input.Events#GAME_OUT + * @type {string} + * @since 3.16.1 * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [width=128] - The width of the grid. - * @param {number} [height=128] - The height of the grid. - * @param {number} [cellWidth=32] - The width of one cell in the grid. - * @param {number} [cellHeight=32] - The height of one cell in the grid. - * @param {number} [fillColor] - The color the grid cells will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. - * @param {number} [outlineFillColor] - The color of the lines between the grid cells. See the `setOutline` method. - * @param {number} [outlineFillAlpha] - The alpha of the lines between the grid cells. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event that triggered the canvas out. */ -var Grid = new Class({ +module.exports = 'gameout'; - Extends: Shape, - Mixins: [ - GridRender - ], +/***/ }), - initialize: +/***/ 1545: +/***/ ((module) => { - function Grid (scene, x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = 128; } - if (height === undefined) { height = 128; } - if (cellWidth === undefined) { cellWidth = 32; } - if (cellHeight === undefined) { cellHeight = 32; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - Shape.call(this, scene, 'Grid', null); +/** + * The Input Plugin Game Over Event. + * + * This event is dispatched by the Input Plugin if the active pointer enters the game canvas and is now + * over of it, having previously been elsewhere on the web page. + * + * Listen to this event from within a Scene using: `this.input.on('gameover', listener)`. + * + * @event Phaser.Input.Events#GAME_OVER + * @type {string} + * @since 3.16.1 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {(MouseEvent|TouchEvent)} event - The DOM Event that triggered the canvas over. + */ +module.exports = 'gameover'; - /** - * The width of each grid cell. - * Must be a positive value. - * - * @name Phaser.GameObjects.Grid#cellWidth - * @type {number} - * @since 3.13.0 - */ - this.cellWidth = cellWidth; - /** - * The height of each grid cell. - * Must be a positive value. - * - * @name Phaser.GameObjects.Grid#cellHeight - * @type {number} - * @since 3.13.0 - */ - this.cellHeight = cellHeight; +/***/ }), - /** - * Will the grid render its cells in the `fillColor`? - * - * @name Phaser.GameObjects.Grid#showCells - * @type {boolean} - * @since 3.13.0 - */ - this.showCells = true; +/***/ 67137: +/***/ ((module) => { - /** - * The color of the lines between each grid cell. - * - * @name Phaser.GameObjects.Grid#outlineFillColor - * @type {number} - * @since 3.13.0 - */ - this.outlineFillColor = 0; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The alpha value for the color of the lines between each grid cell. - * - * @name Phaser.GameObjects.Grid#outlineFillAlpha - * @type {number} - * @since 3.13.0 - */ - this.outlineFillAlpha = 0; +/** + * The Input Manager Boot Event. + * + * This internal event is dispatched by the Input Manager when it boots. + * + * @event Phaser.Input.Events#MANAGER_BOOT + * @type {string} + * @since 3.0.0 + */ +module.exports = 'boot'; - /** - * Will the grid display the lines between each cell when it renders? - * - * @name Phaser.GameObjects.Grid#showOutline - * @type {boolean} - * @since 3.13.0 - */ - this.showOutline = true; - /** - * Will the grid render the alternating cells in the `altFillColor`? - * - * @name Phaser.GameObjects.Grid#showAltCells - * @type {boolean} - * @since 3.13.0 - */ - this.showAltCells = false; +/***/ }), - /** - * The color the alternating grid cells will be filled with, i.e. 0xff0000 for red. - * - * @name Phaser.GameObjects.Grid#altFillColor - * @type {number} - * @since 3.13.0 - */ - this.altFillColor; +/***/ 27678: +/***/ ((module) => { - /** - * The alpha the alternating grid cells will be filled with. - * You can also set the alpha of the overall Shape using its `alpha` property. - * - * @name Phaser.GameObjects.Grid#altFillAlpha - * @type {number} - * @since 3.13.0 - */ - this.altFillAlpha; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.setPosition(x, y); - this.setSize(width, height); +/** + * The Input Manager Process Event. + * + * This internal event is dispatched by the Input Manager when not using the legacy queue system, + * and it wants the Input Plugins to update themselves. + * + * @event Phaser.Input.Events#MANAGER_PROCESS + * @type {string} + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'process'; - this.setFillStyle(fillColor, fillAlpha); - if (outlineFillColor !== undefined) - { - this.setOutlineStyle(outlineFillColor, outlineFillAlpha); - } +/***/ }), - this.updateDisplayOrigin(); - }, +/***/ 22257: +/***/ ((module) => { - /** - * Sets the fill color and alpha level the grid cells will use when rendering. - * - * If this method is called with no values then the grid cells will not be rendered, - * however the grid lines and alternating cells may still be. - * - * Also see the `setOutlineStyle` and `setAltFillStyle` methods. - * - * This call can be chained. - * - * @method Phaser.GameObjects.Grid#setFillStyle - * @since 3.13.0 - * - * @param {number} [fillColor] - The color the grid cells will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha=1] - The alpha the grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. - * - * @return {this} This Game Object instance. - */ - setFillStyle: function (fillColor, fillAlpha) - { - if (fillAlpha === undefined) { fillAlpha = 1; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (fillColor === undefined) - { - this.showCells = false; - } - else - { - this.fillColor = fillColor; - this.fillAlpha = fillAlpha; - this.showCells = true; - } +/** + * The Input Manager Update Event. + * + * This internal event is dispatched by the Input Manager as part of its update step. + * + * @event Phaser.Input.Events#MANAGER_UPDATE + * @type {string} + * @since 3.0.0 + */ +module.exports = 'update'; - return this; - }, - /** - * Sets the fill color and alpha level that the alternating grid cells will use. - * - * If this method is called with no values then alternating grid cells will not be rendered in a different color. - * - * Also see the `setOutlineStyle` and `setFillStyle` methods. - * - * This call can be chained. - * - * @method Phaser.GameObjects.Grid#setAltFillStyle - * @since 3.13.0 - * - * @param {number} [fillColor] - The color the alternating grid cells will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha=1] - The alpha the alternating grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. - * - * @return {this} This Game Object instance. - */ - setAltFillStyle: function (fillColor, fillAlpha) - { - if (fillAlpha === undefined) { fillAlpha = 1; } +/***/ }), - if (fillColor === undefined) - { - this.showAltCells = false; - } - else - { - this.altFillColor = fillColor; - this.altFillAlpha = fillAlpha; - this.showAltCells = true; - } +/***/ 90379: +/***/ ((module) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets the fill color and alpha level that the lines between each grid cell will use. - * - * If this method is called with no values then the grid lines will not be rendered at all, however - * the cells themselves may still be if they have colors set. - * - * Also see the `setFillStyle` and `setAltFillStyle` methods. - * - * This call can be chained. - * - * @method Phaser.GameObjects.Grid#setOutlineStyle - * @since 3.13.0 - * - * @param {number} [fillColor] - The color the lines between the grid cells will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha=1] - The alpha the lines between the grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. - * - * @return {this} This Game Object instance. - */ - setOutlineStyle: function (fillColor, fillAlpha) - { - if (fillAlpha === undefined) { fillAlpha = 1; } +/** + * The Input Manager Pointer Lock Change Event. + * + * This event is dispatched by the Input Manager when it is processing a native Pointer Lock Change DOM Event. + * + * @event Phaser.Input.Events#POINTERLOCK_CHANGE + * @type {string} + * @since 3.0.0 + * + * @param {Event} event - The native DOM Event. + * @param {boolean} locked - The locked state of the Mouse Pointer. + */ +module.exports = 'pointerlockchange'; - if (fillColor === undefined) - { - this.showOutline = false; - } - else - { - this.outlineFillColor = fillColor; - this.outlineFillAlpha = fillAlpha; - this.showOutline = true; - } - return this; - } +/***/ }), -}); +/***/ 88909: +/***/ ((module) => { -module.exports = Grid; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Pointer Down Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointerdown', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_DOWN + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointerdown'; /***/ }), -/* 465 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 36548: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var IsoBoxRender = __webpack_require__(1109); -var Class = __webpack_require__(0); -var Shape = __webpack_require__(34); - /** - * @classdesc - * The IsoBox Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports only fill colors and cannot be stroked. - * - * An IsoBox is an 'isometric' rectangle. Each face of it has a different fill color. You can set - * the color of the top, left and right faces of the rectangle respectively. You can also choose - * which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties. - * - * You cannot view an IsoBox from under-neath, however you can change the 'angle' by setting - * the `projection` property. + * The Pointer Down Outside Input Event. * - * @class IsoBox - * @extends Phaser.GameObjects.Shape - * @memberof Phaser.GameObjects - * @constructor - * @since 3.13.0 + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down anywhere outside of the game canvas. * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [size=48] - The width of the iso box in pixels. The left and right faces will be exactly half this value. - * @param {number} [height=32] - The height of the iso box. The left and right faces will be this tall. The overall height of the isobox will be this value plus half the `size` value. - * @param {number} [fillTop=0xeeeeee] - The fill color of the top face of the iso box. - * @param {number} [fillLeft=0x999999] - The fill color of the left face of the iso box. - * @param {number} [fillRight=0xcccccc] - The fill color of the right face of the iso box. + * Listen to this event from within a Scene using: `this.input.on('pointerdownoutside', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} + * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} + * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_DOWN_OUTSIDE + * @type {string} + * @since 3.16.1 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. */ -var IsoBox = new Class({ +module.exports = 'pointerdownoutside'; - Extends: Shape, - Mixins: [ - IsoBoxRender - ], +/***/ }), - initialize: +/***/ 18483: +/***/ ((module) => { - function IsoBox (scene, x, y, size, height, fillTop, fillLeft, fillRight) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (size === undefined) { size = 48; } - if (height === undefined) { height = 32; } - if (fillTop === undefined) { fillTop = 0xeeeeee; } - if (fillLeft === undefined) { fillLeft = 0x999999; } - if (fillRight === undefined) { fillRight = 0xcccccc; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - Shape.call(this, scene, 'IsoBox', null); +/** + * The Pointer Move Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is moved anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointermove', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} + * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} + * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_MOVE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointermove'; - /** - * The projection level of the iso box. Change this to change the 'angle' at which you are looking at the box. - * - * @name Phaser.GameObjects.IsoBox#projection - * @type {number} - * @default 4 - * @since 3.13.0 - */ - this.projection = 4; - /** - * The color used to fill in the top of the iso box. - * - * @name Phaser.GameObjects.IsoBox#fillTop - * @type {number} - * @since 3.13.0 - */ - this.fillTop = fillTop; +/***/ }), - /** - * The color used to fill in the left-facing side of the iso box. - * - * @name Phaser.GameObjects.IsoBox#fillLeft - * @type {number} - * @since 3.13.0 - */ - this.fillLeft = fillLeft; +/***/ 22355: +/***/ ((module) => { - /** - * The color used to fill in the right-facing side of the iso box. - * - * @name Phaser.GameObjects.IsoBox#fillRight - * @type {number} - * @since 3.13.0 - */ - this.fillRight = fillRight; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Controls if the top-face of the iso box be rendered. - * - * @name Phaser.GameObjects.IsoBox#showTop - * @type {boolean} - * @default true - * @since 3.13.0 - */ - this.showTop = true; +/** + * The Pointer Out Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves out of any interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('pointerout', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} + * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} + * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * If the pointer leaves the game canvas itself, it will not trigger an this event. To handle those cases, + * please listen for the [GAME_OUT]{@linkcode Phaser.Input.Events#event:GAME_OUT} event. + * + * @event Phaser.Input.Events#POINTER_OUT + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} justOut - An array containing all interactive Game Objects that the pointer moved out of when the event was created. + */ +module.exports = 'pointerout'; - /** - * Controls if the left-face of the iso box be rendered. - * - * @name Phaser.GameObjects.IsoBox#showLeft - * @type {boolean} - * @default true - * @since 3.13.0 - */ - this.showLeft = true; - /** - * Controls if the right-face of the iso box be rendered. - * - * @name Phaser.GameObjects.IsoBox#showRight - * @type {boolean} - * @default true - * @since 3.13.0 - */ - this.showRight = true; +/***/ }), - this.isFilled = true; +/***/ 7997: +/***/ ((module) => { - this.setPosition(x, y); - this.setSize(size, height); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.updateDisplayOrigin(); - }, +/** + * The Pointer Over Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves over any interactive Game Object. + * + * Listen to this event from within a Scene using: `this.input.on('pointerover', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} + * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} + * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_OVER + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} justOver - An array containing all interactive Game Objects that the pointer moved over when the event was created. + */ +module.exports = 'pointerover'; - /** - * Sets the projection level of the iso box. Change this to change the 'angle' at which you are looking at the box. - * This call can be chained. - * - * @method Phaser.GameObjects.IsoBox#setProjection - * @since 3.13.0 - * - * @param {number} value - The value to set the projection to. - * - * @return {this} This Game Object instance. - */ - setProjection: function (value) - { - this.projection = value; - return this; - }, +/***/ }), - /** - * Sets which faces of the iso box will be rendered. - * This call can be chained. - * - * @method Phaser.GameObjects.IsoBox#setFaces - * @since 3.13.0 - * - * @param {boolean} [showTop=true] - Show the top-face of the iso box. - * @param {boolean} [showLeft=true] - Show the left-face of the iso box. - * @param {boolean} [showRight=true] - Show the right-face of the iso box. - * - * @return {this} This Game Object instance. - */ - setFaces: function (showTop, showLeft, showRight) - { - if (showTop === undefined) { showTop = true; } - if (showLeft === undefined) { showLeft = true; } - if (showRight === undefined) { showRight = true; } +/***/ 66318: +/***/ ((module) => { - this.showTop = showTop; - this.showLeft = showLeft; - this.showRight = showRight; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +/** + * The Pointer Up Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released anywhere. + * + * Listen to this event from within a Scene using: `this.input.on('pointerup', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_UP + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + */ +module.exports = 'pointerup'; - /** - * Sets the fill colors for each face of the iso box. - * This call can be chained. - * - * @method Phaser.GameObjects.IsoBox#setFillStyle - * @since 3.13.0 - * - * @param {number} [fillTop] - The color used to fill the top of the iso box. - * @param {number} [fillLeft] - The color used to fill in the left-facing side of the iso box. - * @param {number} [fillRight] - The color used to fill in the right-facing side of the iso box. - * - * @return {this} This Game Object instance. - */ - setFillStyle: function (fillTop, fillLeft, fillRight) - { - this.fillTop = fillTop; - this.fillLeft = fillLeft; - this.fillRight = fillRight; - this.isFilled = true; +/***/ }), - return this; - } +/***/ 94812: +/***/ ((module) => { -}); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = IsoBox; +/** + * The Pointer Up Outside Input Event. + * + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released anywhere outside of the game canvas. + * + * Listen to this event from within a Scene using: `this.input.on('pointerupoutside', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} + * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} + * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_UP_OUTSIDE + * @type {string} + * @since 3.16.1 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + */ +module.exports = 'pointerupoutside'; /***/ }), -/* 466 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 37310: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var IsoTriangleRender = __webpack_require__(1112); -var Shape = __webpack_require__(34); - /** - * @classdesc - * The IsoTriangle Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports only fill colors and cannot be stroked. - * - * An IsoTriangle is an 'isometric' triangle. Think of it like a pyramid. Each face has a different - * fill color. You can set the color of the top, left and right faces of the triangle respectively - * You can also choose which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties. - * - * You cannot view an IsoTriangle from under-neath, however you can change the 'angle' by setting - * the `projection` property. The `reversed` property controls if the IsoTriangle is rendered upside - * down or not. + * The Pointer Wheel Input Event. * - * @class IsoTriangle - * @extends Phaser.GameObjects.Shape - * @memberof Phaser.GameObjects - * @constructor - * @since 3.13.0 + * This event is dispatched by the Input Plugin belonging to a Scene if a pointer has its wheel updated. * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [size=48] - The width of the iso triangle in pixels. The left and right faces will be exactly half this value. - * @param {number} [height=32] - The height of the iso triangle. The left and right faces will be this tall. The overall height of the iso triangle will be this value plus half the `size` value. - * @param {boolean} [reversed=false] - Is the iso triangle upside down? - * @param {number} [fillTop=0xeeeeee] - The fill color of the top face of the iso triangle. - * @param {number} [fillLeft=0x999999] - The fill color of the left face of the iso triangle. - * @param {number} [fillRight=0xcccccc] - The fill color of the right face of the iso triangle. + * Listen to this event from within a Scene using: `this.input.on('wheel', listener)`. + * + * The event hierarchy is as follows: + * + * 1. [GAMEOBJECT_POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_WHEEL} + * 2. [GAMEOBJECT_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_WHEEL} + * 3. [POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:POINTER_WHEEL} + * + * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop + * the propagation of this event. + * + * @event Phaser.Input.Events#POINTER_WHEEL + * @type {string} + * @since 3.18.0 + * + * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. + * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. + * @param {number} deltaX - The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device. + * @param {number} deltaY - The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device. This value will typically be less than 0 if the user scrolls up and greater than zero if scrolling down. + * @param {number} deltaZ - The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device. */ -var IsoTriangle = new Class({ +module.exports = 'wheel'; - Extends: Shape, - Mixins: [ - IsoTriangleRender - ], +/***/ }), - initialize: +/***/ 24196: +/***/ ((module) => { - function IsoTriangle (scene, x, y, size, height, reversed, fillTop, fillLeft, fillRight) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (size === undefined) { size = 48; } - if (height === undefined) { height = 32; } - if (reversed === undefined) { reversed = false; } - if (fillTop === undefined) { fillTop = 0xeeeeee; } - if (fillLeft === undefined) { fillLeft = 0x999999; } - if (fillRight === undefined) { fillRight = 0xcccccc; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - Shape.call(this, scene, 'IsoTriangle', null); +/** + * The Input Plugin Pre-Update Event. + * + * This internal event is dispatched by the Input Plugin at the start of its `preUpdate` method. + * This hook is designed specifically for input plugins, but can also be listened to from user-land code. + * + * @event Phaser.Input.Events#PRE_UPDATE + * @type {string} + * @since 3.0.0 + */ +module.exports = 'preupdate'; - /** - * The projection level of the iso box. Change this to change the 'angle' at which you are looking at the box. - * - * @name Phaser.GameObjects.IsoTriangle#projection - * @type {number} - * @default 4 - * @since 3.13.0 - */ - this.projection = 4; - /** - * The color used to fill in the top of the iso triangle. This is only used if the triangle is reversed. - * - * @name Phaser.GameObjects.IsoTriangle#fillTop - * @type {number} - * @since 3.13.0 - */ - this.fillTop = fillTop; +/***/ }), - /** - * The color used to fill in the left-facing side of the iso triangle. - * - * @name Phaser.GameObjects.IsoTriangle#fillLeft - * @type {number} - * @since 3.13.0 - */ - this.fillLeft = fillLeft; +/***/ 27053: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Input Plugin Shutdown Event. + * + * This internal event is dispatched by the Input Plugin when it shuts down, signalling to all of its systems to shut themselves down. + * + * @event Phaser.Input.Events#SHUTDOWN + * @type {string} + * @since 3.0.0 + */ +module.exports = 'shutdown'; + + +/***/ }), + +/***/ 29413: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Input Plugin Start Event. + * + * This internal event is dispatched by the Input Plugin when it has finished setting-up, + * signalling to all of its internal systems to start. + * + * @event Phaser.Input.Events#START + * @type {string} + * @since 3.0.0 + */ +module.exports = 'start'; + + +/***/ }), + +/***/ 25165: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Input Plugin Update Event. + * + * This internal event is dispatched by the Input Plugin at the start of its `update` method. + * This hook is designed specifically for input plugins, but can also be listened to from user-land code. + * + * @event Phaser.Input.Events#UPDATE + * @type {string} + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'update'; + + +/***/ }), + +/***/ 33963: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Input.Events + */ + +module.exports = { + + BOOT: __webpack_require__(14874), + DESTROY: __webpack_require__(54168), + DRAG_END: __webpack_require__(526), + DRAG_ENTER: __webpack_require__(81623), + DRAG: __webpack_require__(94472), + DRAG_LEAVE: __webpack_require__(9304), + DRAG_OVER: __webpack_require__(34265), + DRAG_START: __webpack_require__(50151), + DROP: __webpack_require__(98134), + GAME_OUT: __webpack_require__(78072), + GAME_OVER: __webpack_require__(1545), + GAMEOBJECT_DOWN: __webpack_require__(56773), + GAMEOBJECT_DRAG_END: __webpack_require__(45824), + GAMEOBJECT_DRAG_ENTER: __webpack_require__(39578), + GAMEOBJECT_DRAG: __webpack_require__(72072), + GAMEOBJECT_DRAG_LEAVE: __webpack_require__(82569), + GAMEOBJECT_DRAG_OVER: __webpack_require__(70833), + GAMEOBJECT_DRAG_START: __webpack_require__(81442), + GAMEOBJECT_DROP: __webpack_require__(32936), + GAMEOBJECT_MOVE: __webpack_require__(99658), + GAMEOBJECT_OUT: __webpack_require__(60515), + GAMEOBJECT_OVER: __webpack_require__(55254), + GAMEOBJECT_POINTER_DOWN: __webpack_require__(34782), + GAMEOBJECT_POINTER_MOVE: __webpack_require__(41769), + GAMEOBJECT_POINTER_OUT: __webpack_require__(65588), + GAMEOBJECT_POINTER_OVER: __webpack_require__(61640), + GAMEOBJECT_POINTER_UP: __webpack_require__(49342), + GAMEOBJECT_POINTER_WHEEL: __webpack_require__(82662), + GAMEOBJECT_UP: __webpack_require__(13058), + GAMEOBJECT_WHEEL: __webpack_require__(52426), + MANAGER_BOOT: __webpack_require__(67137), + MANAGER_PROCESS: __webpack_require__(27678), + MANAGER_UPDATE: __webpack_require__(22257), + POINTER_DOWN: __webpack_require__(88909), + POINTER_DOWN_OUTSIDE: __webpack_require__(36548), + POINTER_MOVE: __webpack_require__(18483), + POINTER_OUT: __webpack_require__(22355), + POINTER_OVER: __webpack_require__(7997), + POINTER_UP: __webpack_require__(66318), + POINTER_UP_OUTSIDE: __webpack_require__(94812), + POINTER_WHEEL: __webpack_require__(37310), + POINTERLOCK_CHANGE: __webpack_require__(90379), + PRE_UPDATE: __webpack_require__(24196), + SHUTDOWN: __webpack_require__(27053), + START: __webpack_require__(29413), + UPDATE: __webpack_require__(25165) + +}; + + +/***/ }), + +/***/ 70848: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); + +/** + * @classdesc + * Contains information about a specific Gamepad Axis. + * Axis objects are created automatically by the Gamepad as they are needed. + * + * @class Axis + * @memberof Phaser.Input.Gamepad + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Input.Gamepad.Gamepad} pad - A reference to the Gamepad that this Axis belongs to. + * @param {number} index - The index of this Axis. + */ +var Axis = new Class({ + + initialize: + function Axis (pad, index) + { /** - * The color used to fill in the right-facing side of the iso triangle. + * A reference to the Gamepad that this Axis belongs to. * - * @name Phaser.GameObjects.IsoTriangle#fillRight - * @type {number} - * @since 3.13.0 + * @name Phaser.Input.Gamepad.Axis#pad + * @type {Phaser.Input.Gamepad.Gamepad} + * @since 3.0.0 */ - this.fillRight = fillRight; + this.pad = pad; /** - * Controls if the top-face of the iso triangle be rendered. + * An event emitter to use to emit the axis events. * - * @name Phaser.GameObjects.IsoTriangle#showTop - * @type {boolean} - * @default true - * @since 3.13.0 + * @name Phaser.Input.Gamepad.Axis#events + * @type {Phaser.Events.EventEmitter} + * @since 3.0.0 */ - this.showTop = true; + this.events = pad.events; /** - * Controls if the left-face of the iso triangle be rendered. + * The index of this Axis. * - * @name Phaser.GameObjects.IsoTriangle#showLeft - * @type {boolean} - * @default true - * @since 3.13.0 + * @name Phaser.Input.Gamepad.Axis#index + * @type {number} + * @since 3.0.0 */ - this.showLeft = true; + this.index = index; /** - * Controls if the right-face of the iso triangle be rendered. + * The raw axis value, between -1 and 1 with 0 being dead center. + * Use the method `getValue` to get a normalized value with the threshold applied. * - * @name Phaser.GameObjects.IsoTriangle#showRight - * @type {boolean} - * @default true - * @since 3.13.0 + * @name Phaser.Input.Gamepad.Axis#value + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.showRight = true; + this.value = 0; /** - * Sets if the iso triangle will be rendered upside down or not. + * Movement tolerance threshold below which axis values are ignored in `getValue`. * - * @name Phaser.GameObjects.IsoTriangle#isReversed - * @type {boolean} - * @default false - * @since 3.13.0 + * @name Phaser.Input.Gamepad.Axis#threshold + * @type {number} + * @default 0.1 + * @since 3.0.0 */ - this.isReversed = reversed; - - this.isFilled = true; - - this.setPosition(x, y); - this.setSize(size, height); - - this.updateDisplayOrigin(); - }, - - /** - * Sets the projection level of the iso triangle. Change this to change the 'angle' at which you are looking at the pyramid. - * This call can be chained. - * - * @method Phaser.GameObjects.IsoTriangle#setProjection - * @since 3.13.0 - * - * @param {number} value - The value to set the projection to. - * - * @return {this} This Game Object instance. - */ - setProjection: function (value) - { - this.projection = value; - - return this; + this.threshold = 0.1; }, /** - * Sets if the iso triangle will be rendered upside down or not. - * This call can be chained. + * Internal update handler for this Axis. + * Called automatically by the Gamepad as part of its update. * - * @method Phaser.GameObjects.IsoTriangle#setReversed - * @since 3.13.0 - * - * @param {boolean} reversed - Sets if the iso triangle will be rendered upside down or not. + * @method Phaser.Input.Gamepad.Axis#update + * @private + * @since 3.0.0 * - * @return {this} This Game Object instance. + * @param {number} value - The value of the axis movement. */ - setReversed: function (reversed) + update: function (value) { - this.isReversed = reversed; - - return this; + this.value = value; }, /** - * Sets which faces of the iso triangle will be rendered. - * This call can be chained. + * Applies the `threshold` value to the axis and returns it. * - * @method Phaser.GameObjects.IsoTriangle#setFaces - * @since 3.13.0 - * - * @param {boolean} [showTop=true] - Show the top-face of the iso triangle (only if `reversed` is true) - * @param {boolean} [showLeft=true] - Show the left-face of the iso triangle. - * @param {boolean} [showRight=true] - Show the right-face of the iso triangle. + * @method Phaser.Input.Gamepad.Axis#getValue + * @since 3.0.0 * - * @return {this} This Game Object instance. + * @return {number} The axis value, adjusted for the movement threshold. */ - setFaces: function (showTop, showLeft, showRight) + getValue: function () { - if (showTop === undefined) { showTop = true; } - if (showLeft === undefined) { showLeft = true; } - if (showRight === undefined) { showRight = true; } - - this.showTop = showTop; - this.showLeft = showLeft; - this.showRight = showRight; - - return this; + return (Math.abs(this.value) < this.threshold) ? 0 : this.value; }, /** - * Sets the fill colors for each face of the iso triangle. - * This call can be chained. - * - * @method Phaser.GameObjects.IsoTriangle#setFillStyle - * @since 3.13.0 - * - * @param {number} [fillTop] - The color used to fill the top of the iso triangle. - * @param {number} [fillLeft] - The color used to fill in the left-facing side of the iso triangle. - * @param {number} [fillRight] - The color used to fill in the right-facing side of the iso triangle. + * Destroys this Axis instance and releases external references it holds. * - * @return {this} This Game Object instance. + * @method Phaser.Input.Gamepad.Axis#destroy + * @since 3.10.0 */ - setFillStyle: function (fillTop, fillLeft, fillRight) + destroy: function () { - this.fillTop = fillTop; - this.fillLeft = fillLeft; - this.fillRight = fillRight; - - this.isFilled = true; - - return this; + this.pad = null; + this.events = null; } }); -module.exports = IsoTriangle; +module.exports = Axis; /***/ }), -/* 467 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 21274: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Shape = __webpack_require__(34); -var GeomLine = __webpack_require__(47); -var LineRender = __webpack_require__(1115); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(43200); /** * @classdesc - * The Line Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports only stroke colors and cannot be filled. - * - * A Line Shape allows you to draw a line between two points in your game. You can control the - * stroke color and thickness of the line. In WebGL only you can also specify a different - * thickness for the start and end of the line, allowing you to render lines that taper-off. - * - * If you need to draw multiple lines in a sequence you may wish to use the Polygon Shape instead. - * - * Be aware that as with all Game Objects the default origin is 0.5. If you need to draw a Line - * between two points and want the x1/y1 values to match the x/y values, then set the origin to 0. + * Contains information about a specific button on a Gamepad. + * Button objects are created automatically by the Gamepad as they are needed. * - * @class Line - * @extends Phaser.GameObjects.Shape - * @memberof Phaser.GameObjects + * @class Button + * @memberof Phaser.Input.Gamepad * @constructor - * @since 3.13.0 + * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [x1=0] - The horizontal position of the start of the line. - * @param {number} [y1=0] - The vertical position of the start of the line. - * @param {number} [x2=128] - The horizontal position of the end of the line. - * @param {number} [y2=0] - The vertical position of the end of the line. - * @param {number} [strokeColor] - The color the line will be drawn in, i.e. 0xff0000 for red. - * @param {number} [strokeAlpha] - The alpha the line will be drawn in. You can also set the alpha of the overall Shape using its `alpha` property. + * @param {Phaser.Input.Gamepad.Gamepad} pad - A reference to the Gamepad that this Button belongs to. + * @param {number} index - The index of this Button. */ -var Line = new Class({ - - Extends: Shape, - - Mixins: [ - LineRender - ], +var Button = new Class({ initialize: - function Line (scene, x, y, x1, y1, x2, y2, strokeColor, strokeAlpha) + function Button (pad, index) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (x1 === undefined) { x1 = 0; } - if (y1 === undefined) { y1 = 0; } - if (x2 === undefined) { x2 = 128; } - if (y2 === undefined) { y2 = 0; } - - Shape.call(this, scene, 'Line', new GeomLine(x1, y1, x2, y2)); + /** + * A reference to the Gamepad that this Button belongs to. + * + * @name Phaser.Input.Gamepad.Button#pad + * @type {Phaser.Input.Gamepad.Gamepad} + * @since 3.0.0 + */ + this.pad = pad; - var width = Math.max(1, this.geom.right - this.geom.left); - var height = Math.max(1, this.geom.bottom - this.geom.top); + /** + * An event emitter to use to emit the button events. + * + * @name Phaser.Input.Gamepad.Button#events + * @type {Phaser.Events.EventEmitter} + * @since 3.0.0 + */ + this.events = pad.manager; /** - * The width (or thickness) of the line. - * See the setLineWidth method for extra details on changing this on WebGL. + * The index of this Button. * - * @name Phaser.GameObjects.Line#lineWidth + * @name Phaser.Input.Gamepad.Button#index * @type {number} - * @since 3.13.0 + * @since 3.0.0 */ - this.lineWidth = 1; + this.index = index; /** - * Private internal value. Holds the start width of the line. + * Between 0 and 1. * - * @name Phaser.GameObjects.Line#_startWidth + * @name Phaser.Input.Gamepad.Button#value * @type {number} - * @private - * @since 3.13.0 + * @default 0 + * @since 3.0.0 */ - this._startWidth = 1; + this.value = 0; /** - * Private internal value. Holds the end width of the line. + * Can be set for analogue buttons to enable a 'pressure' threshold, + * before a button is considered as being 'pressed'. * - * @name Phaser.GameObjects.Line#_endWidth + * @name Phaser.Input.Gamepad.Button#threshold * @type {number} - * @private - * @since 3.13.0 + * @default 1 + * @since 3.0.0 */ - this._endWidth = 1; - - this.setPosition(x, y); - this.setSize(width, height); - - if (strokeColor !== undefined) - { - this.setStrokeStyle(1, strokeColor, strokeAlpha); - } + this.threshold = 1; - this.updateDisplayOrigin(); + /** + * Is the Button being pressed down or not? + * + * @name Phaser.Input.Gamepad.Button#pressed + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.pressed = false; }, /** - * Sets the width of the line. - * - * When using the WebGL renderer you can have different start and end widths. - * When using the Canvas renderer only the `startWidth` value is used. The `endWidth` is ignored. - * - * This call can be chained. - * - * @method Phaser.GameObjects.Line#setLineWidth - * @since 3.13.0 + * Internal update handler for this Button. + * Called automatically by the Gamepad as part of its update. * - * @param {number} startWidth - The start width of the line. - * @param {number} [endWidth] - The end width of the line. Only used in WebGL. + * @method Phaser.Input.Gamepad.Button#update + * @fires Phaser.Input.Gamepad.Events#BUTTON_DOWN + * @fires Phaser.Input.Gamepad.Events#BUTTON_UP + * @fires Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN + * @fires Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP + * @private + * @since 3.0.0 * - * @return {this} This Game Object instance. + * @param {number} value - The value of the button. Between 0 and 1. */ - setLineWidth: function (startWidth, endWidth) + update: function (value) { - if (endWidth === undefined) { endWidth = startWidth; } - - this._startWidth = startWidth; - this._endWidth = endWidth; + this.value = value; - this.lineWidth = startWidth; + var pad = this.pad; + var index = this.index; - return this; + if (value >= this.threshold) + { + if (!this.pressed) + { + this.pressed = true; + this.events.emit(Events.BUTTON_DOWN, pad, this, value); + this.pad.emit(Events.GAMEPAD_BUTTON_DOWN, index, value, this); + } + } + else if (this.pressed) + { + this.pressed = false; + this.events.emit(Events.BUTTON_UP, pad, this, value); + this.pad.emit(Events.GAMEPAD_BUTTON_UP, index, value, this); + } }, /** - * Sets the start and end coordinates of this Line. - * - * @method Phaser.GameObjects.Line#setTo - * @since 3.13.0 - * - * @param {number} [x1=0] - The horizontal position of the start of the line. - * @param {number} [y1=0] - The vertical position of the start of the line. - * @param {number} [x2=0] - The horizontal position of the end of the line. - * @param {number} [y2=0] - The vertical position of the end of the line. + * Destroys this Button instance and releases external references it holds. * - * @return {this} This Line object. + * @method Phaser.Input.Gamepad.Button#destroy + * @since 3.10.0 */ - setTo: function (x1, y1, x2, y2) + destroy: function () { - this.geom.setTo(x1, y1, x2, y2); - - return this; + this.pad = null; + this.events = null; } }); -module.exports = Line; +module.exports = Button; /***/ }), -/* 468 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 75956: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PolygonRender = __webpack_require__(1118); -var Class = __webpack_require__(0); -var Earcut = __webpack_require__(59); -var GetAABB = __webpack_require__(469); -var GeomPolygon = __webpack_require__(227); -var Shape = __webpack_require__(34); -var Smooth = __webpack_require__(472); +var Axis = __webpack_require__(70848); +var Button = __webpack_require__(21274); +var Class = __webpack_require__(56694); +var EventEmitter = __webpack_require__(6659); +var Vector2 = __webpack_require__(93736); /** * @classdesc - * The Polygon Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * The Polygon Shape is created by providing a list of points, which are then used to create an - * internal Polygon geometry object. The points can be set from a variety of formats: + * A single Gamepad. * - * - A string containing paired values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'` - * - An array of Point or Vector2 objects: `[new Phaser.Math.Vector2(x1, y1), ...]` - * - An array of objects with public x/y properties: `[obj1, obj2, ...]` - * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]` - * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]` - * - * By default the `x` and `y` coordinates of this Shape refer to the center of it. However, depending - * on the coordinates of the points provided, the final shape may be rendered offset from its origin. + * These are created, updated and managed by the Gamepad Plugin. * - * @class Polygon - * @extends Phaser.GameObjects.Shape - * @memberof Phaser.GameObjects + * @class Gamepad + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Input.Gamepad * @constructor - * @since 3.13.0 + * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {any} [points] - The points that make up the polygon. - * @param {number} [fillColor] - The color the polygon will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the polygon will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * @param {Phaser.Input.Gamepad.GamepadPlugin} manager - A reference to the Gamepad Plugin. + * @param {Phaser.Types.Input.Gamepad.Pad} pad - The Gamepad object, as extracted from GamepadEvent. */ -var Polygon = new Class({ - - Extends: Shape, +var Gamepad = new Class({ - Mixins: [ - PolygonRender - ], + Extends: EventEmitter, initialize: - function Polygon (scene, x, y, points, fillColor, fillAlpha) + function Gamepad (manager, pad) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - - Shape.call(this, scene, 'Polygon', new GeomPolygon(points)); + EventEmitter.call(this); - var bounds = GetAABB(this.geom); + /** + * A reference to the Gamepad Plugin. + * + * @name Phaser.Input.Gamepad.Gamepad#manager + * @type {Phaser.Input.Gamepad.GamepadPlugin} + * @since 3.0.0 + */ + this.manager = manager; - this.setPosition(x, y); - this.setSize(bounds.width, bounds.height); + /** + * A reference to the native Gamepad object that is connected to the browser. + * + * @name Phaser.Input.Gamepad.Gamepad#pad + * @type {any} + * @since 3.10.0 + */ + this.pad = pad; - if (fillColor !== undefined) - { - this.setFillStyle(fillColor, fillAlpha); - } + /** + * A string containing some information about the controller. + * + * This is not strictly specified, but in Firefox it will contain three pieces of information + * separated by dashes (-): two 4-digit hexadecimal strings containing the USB vendor and + * product id of the controller, and the name of the controller as provided by the driver. + * In Chrome it will contain the name of the controller as provided by the driver, + * followed by vendor and product 4-digit hexadecimal strings. + * + * @name Phaser.Input.Gamepad.Gamepad#id + * @type {string} + * @since 3.0.0 + */ + this.id = pad.id; - this.updateDisplayOrigin(); - this.updateData(); - }, + /** + * An integer that is unique for each Gamepad currently connected to the system. + * This can be used to distinguish multiple controllers. + * Note that disconnecting a device and then connecting a new device may reuse the previous index. + * + * @name Phaser.Input.Gamepad.Gamepad#index + * @type {number} + * @since 3.0.0 + */ + this.index = pad.index; - /** - * Smooths the polygon over the number of iterations specified. - * The base polygon data will be updated and replaced with the smoothed values. - * This call can be chained. - * - * @method Phaser.GameObjects.Polygon#smooth - * @since 3.13.0 - * - * @param {number} [iterations=1] - The number of times to apply the polygon smoothing. - * - * @return {this} This Game Object instance. - */ - smooth: function (iterations) - { - if (iterations === undefined) { iterations = 1; } + var buttons = []; - for (var i = 0; i < iterations; i++) + for (var i = 0; i < pad.buttons.length; i++) { - Smooth(this.geom); + buttons.push(new Button(this, i)); } - return this.updateData(); - }, + /** + * An array of Gamepad Button objects, corresponding to the different buttons available on the Gamepad. + * + * @name Phaser.Input.Gamepad.Gamepad#buttons + * @type {Phaser.Input.Gamepad.Button[]} + * @since 3.0.0 + */ + this.buttons = buttons; - /** - * Internal method that updates the data and path values. - * - * @method Phaser.GameObjects.Polygon#updateData - * @private - * @since 3.13.0 - * - * @return {this} This Game Object instance. - */ - updateData: function () - { - var path = []; - var points = this.geom.points; + var axes = []; - for (var i = 0; i < points.length; i++) + for (i = 0; i < pad.axes.length; i++) { - path.push(points[i].x, points[i].y); + axes.push(new Axis(this, i)); } - path.push(points[0].x, points[0].y); + /** + * An array of Gamepad Axis objects, corresponding to the different axes available on the Gamepad, if any. + * + * @name Phaser.Input.Gamepad.Gamepad#axes + * @type {Phaser.Input.Gamepad.Axis[]} + * @since 3.0.0 + */ + this.axes = axes; - this.pathIndexes = Earcut(path); - this.pathData = path; + /** + * The Gamepad's Haptic Actuator (Vibration / Rumble support). + * This is highly experimental and only set if both present on the device, + * and exposed by both the hardware and browser. + * + * @name Phaser.Input.Gamepad.Gamepad#vibration + * @type {GamepadHapticActuator} + * @since 3.10.0 + */ + this.vibration = pad.vibrationActuator; - return this; - } + // https://w3c.github.io/gamepad/#remapping -}); + var _noButton = { value: 0, pressed: false }; -module.exports = Polygon; + /** + * A reference to the Left Button in the Left Cluster. + * + * @name Phaser.Input.Gamepad.Gamepad#_LCLeft + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._LCLeft = (buttons[14]) ? buttons[14] : _noButton; + /** + * A reference to the Right Button in the Left Cluster. + * + * @name Phaser.Input.Gamepad.Gamepad#_LCRight + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._LCRight = (buttons[15]) ? buttons[15] : _noButton; -/***/ }), -/* 469 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * A reference to the Top Button in the Left Cluster. + * + * @name Phaser.Input.Gamepad.Gamepad#_LCTop + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._LCTop = (buttons[12]) ? buttons[12] : _noButton; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A reference to the Bottom Button in the Left Cluster. + * + * @name Phaser.Input.Gamepad.Gamepad#_LCBottom + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._LCBottom = (buttons[13]) ? buttons[13] : _noButton; -var Rectangle = __webpack_require__(10); + /** + * A reference to the Left Button in the Right Cluster. + * + * @name Phaser.Input.Gamepad.Gamepad#_RCLeft + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._RCLeft = (buttons[2]) ? buttons[2] : _noButton; -/** - * Calculates the bounding AABB rectangle of a polygon. - * - * @function Phaser.Geom.Polygon.GetAABB - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [out,$return] - * - * @param {Phaser.Geom.Polygon} polygon - The polygon that should be calculated. - * @param {(Phaser.Geom.Rectangle|object)} [out] - The rectangle or object that has x, y, width, and height properties to store the result. Optional. - * - * @return {(Phaser.Geom.Rectangle|object)} The resulting rectangle or object that is passed in with position and dimensions of the polygon's AABB. - */ -var GetAABB = function (polygon, out) -{ - if (out === undefined) { out = new Rectangle(); } + /** + * A reference to the Right Button in the Right Cluster. + * + * @name Phaser.Input.Gamepad.Gamepad#_RCRight + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._RCRight = (buttons[1]) ? buttons[1] : _noButton; - var minX = Infinity; - var minY = Infinity; - var maxX = -minX; - var maxY = -minY; - var p; + /** + * A reference to the Top Button in the Right Cluster. + * + * @name Phaser.Input.Gamepad.Gamepad#_RCTop + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._RCTop = (buttons[3]) ? buttons[3] : _noButton; - for (var i = 0; i < polygon.points.length; i++) - { - p = polygon.points[i]; + /** + * A reference to the Bottom Button in the Right Cluster. + * + * @name Phaser.Input.Gamepad.Gamepad#_RCBottom + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._RCBottom = (buttons[0]) ? buttons[0] : _noButton; - minX = Math.min(minX, p.x); - minY = Math.min(minY, p.y); - maxX = Math.max(maxX, p.x); - maxY = Math.max(maxY, p.y); - } + /** + * A reference to the Top Left Front Button (L1 Shoulder Button) + * + * @name Phaser.Input.Gamepad.Gamepad#_FBLeftTop + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._FBLeftTop = (buttons[4]) ? buttons[4] : _noButton; - out.x = minX; - out.y = minY; - out.width = maxX - minX; - out.height = maxY - minY; + /** + * A reference to the Bottom Left Front Button (L2 Shoulder Button) + * + * @name Phaser.Input.Gamepad.Gamepad#_FBLeftBottom + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._FBLeftBottom = (buttons[6]) ? buttons[6] : _noButton; - return out; -}; + /** + * A reference to the Top Right Front Button (R1 Shoulder Button) + * + * @name Phaser.Input.Gamepad.Gamepad#_FBRightTop + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._FBRightTop = (buttons[5]) ? buttons[5] : _noButton; -module.exports = GetAABB; + /** + * A reference to the Bottom Right Front Button (R2 Shoulder Button) + * + * @name Phaser.Input.Gamepad.Gamepad#_FBRightBottom + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._FBRightBottom = (buttons[7]) ? buttons[7] : _noButton; + var _noAxis = { value: 0 }; -/***/ }), -/* 470 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * A reference to the Horizontal Axis for the Left Stick. + * + * @name Phaser.Input.Gamepad.Gamepad#_HAxisLeft + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._HAxisLeft = (axes[0]) ? axes[0] : _noAxis; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A reference to the Vertical Axis for the Left Stick. + * + * @name Phaser.Input.Gamepad.Gamepad#_VAxisLeft + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._VAxisLeft = (axes[1]) ? axes[1] : _noAxis; -var Length = __webpack_require__(67); -var Line = __webpack_require__(47); -var Perimeter = __webpack_require__(471); + /** + * A reference to the Horizontal Axis for the Right Stick. + * + * @name Phaser.Input.Gamepad.Gamepad#_HAxisRight + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._HAxisRight = (axes[2]) ? axes[2] : _noAxis; -/** - * Returns an array of Point objects containing the coordinates of the points around the perimeter of the Polygon, - * based on the given quantity or stepRate values. - * - * @function Phaser.Geom.Polygon.GetPoints - * @since 3.12.0 - * - * @param {Phaser.Geom.Polygon} polygon - The Polygon to get the points from. - * @param {number} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead. - * @param {number} [stepRate] - Sets the quantity by getting the perimeter of the Polygon and dividing it by the stepRate. - * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created. - * - * @return {Phaser.Geom.Point[]} An array of Point objects pertaining to the points around the perimeter of the Polygon. - */ -var GetPoints = function (polygon, quantity, stepRate, out) -{ - if (out === undefined) { out = []; } + /** + * A reference to the Vertical Axis for the Right Stick. + * + * @name Phaser.Input.Gamepad.Gamepad#_VAxisRight + * @type {Phaser.Input.Gamepad.Button} + * @private + * @since 3.10.0 + */ + this._VAxisRight = (axes[3]) ? axes[3] : _noAxis; - var points = polygon.points; - var perimeter = Perimeter(polygon); + /** + * A Vector2 containing the most recent values from the Gamepad's left axis stick. + * This is updated automatically as part of the Gamepad.update cycle. + * The H Axis is mapped to the `Vector2.x` property, and the V Axis to the `Vector2.y` property. + * The values are based on the Axis thresholds. + * If the Gamepad does not have a left axis stick, the values will always be zero. + * + * @name Phaser.Input.Gamepad.Gamepad#leftStick + * @type {Phaser.Math.Vector2} + * @since 3.10.0 + */ + this.leftStick = new Vector2(); - // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!quantity && stepRate > 0) + /** + * A Vector2 containing the most recent values from the Gamepad's right axis stick. + * This is updated automatically as part of the Gamepad.update cycle. + * The H Axis is mapped to the `Vector2.x` property, and the V Axis to the `Vector2.y` property. + * The values are based on the Axis thresholds. + * If the Gamepad does not have a right axis stick, the values will always be zero. + * + * @name Phaser.Input.Gamepad.Gamepad#rightStick + * @type {Phaser.Math.Vector2} + * @since 3.10.0 + */ + this.rightStick = new Vector2(); + + /** + * When was this Gamepad created? Used to avoid duplicate event spamming in the update loop. + * + * @name Phaser.Input.Gamepad.Gamepad#_created + * @type {number} + * @private + * @since 3.50.0 + */ + this._created = performance.now(); + }, + + /** + * Gets the total number of axis this Gamepad claims to support. + * + * @method Phaser.Input.Gamepad.Gamepad#getAxisTotal + * @since 3.10.0 + * + * @return {number} The total number of axes this Gamepad claims to support. + */ + getAxisTotal: function () { - quantity = perimeter / stepRate; - } + return this.axes.length; + }, - for (var i = 0; i < quantity; i++) + /** + * Gets the value of an axis based on the given index. + * The index must be valid within the range of axes supported by this Gamepad. + * The return value will be a float between 0 and 1. + * + * @method Phaser.Input.Gamepad.Gamepad#getAxisValue + * @since 3.10.0 + * + * @param {number} index - The index of the axes to get the value for. + * + * @return {number} The value of the axis, between 0 and 1. + */ + getAxisValue: function (index) { - var position = perimeter * (i / quantity); - var accumulatedPerimeter = 0; + return this.axes[index].getValue(); + }, - for (var j = 0; j < points.length; j++) + /** + * Sets the threshold value of all axis on this Gamepad. + * The value is a float between 0 and 1 and is the amount below which the axis is considered as not having been moved. + * + * @method Phaser.Input.Gamepad.Gamepad#setAxisThreshold + * @since 3.10.0 + * + * @param {number} value - A value between 0 and 1. + */ + setAxisThreshold: function (value) + { + for (var i = 0; i < this.axes.length; i++) { - var pointA = points[j]; - var pointB = points[(j + 1) % points.length]; - var line = new Line( - pointA.x, - pointA.y, - pointB.x, - pointB.y - ); - var length = Length(line); - - if (position < accumulatedPerimeter || position > accumulatedPerimeter + length) - { - accumulatedPerimeter += length; - continue; - } - - var point = line.getPoint((position - accumulatedPerimeter) / length); - out.push(point); - - break; + this.axes[i].threshold = value; } - } - - return out; -}; - -module.exports = GetPoints; - - -/***/ }), -/* 471 */ -/***/ (function(module, exports, __webpack_require__) { + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Gets the total number of buttons this Gamepad claims to have. + * + * @method Phaser.Input.Gamepad.Gamepad#getButtonTotal + * @since 3.10.0 + * + * @return {number} The total number of buttons this Gamepad claims to have. + */ + getButtonTotal: function () + { + return this.buttons.length; + }, -var Length = __webpack_require__(67); -var Line = __webpack_require__(47); + /** + * Gets the value of a button based on the given index. + * The index must be valid within the range of buttons supported by this Gamepad. + * + * The return value will be either 0 or 1 for an analogue button, or a float between 0 and 1 + * for a pressure-sensitive digital button, such as the shoulder buttons on a Dual Shock. + * + * @method Phaser.Input.Gamepad.Gamepad#getButtonValue + * @since 3.10.0 + * + * @param {number} index - The index of the button to get the value for. + * + * @return {number} The value of the button, between 0 and 1. + */ + getButtonValue: function (index) + { + return this.buttons[index].value; + }, -/** - * Returns the perimeter of the given Polygon. - * - * @function Phaser.Geom.Polygon.Perimeter - * @since 3.12.0 - * - * @param {Phaser.Geom.Polygon} polygon - The Polygon to get the perimeter of. - * - * @return {number} The perimeter of the Polygon. - */ -var Perimeter = function (polygon) -{ - var points = polygon.points; - var perimeter = 0; + /** + * Returns if the button is pressed down or not. + * The index must be valid within the range of buttons supported by this Gamepad. + * + * @method Phaser.Input.Gamepad.Gamepad#isButtonDown + * @since 3.10.0 + * + * @param {number} index - The index of the button to get the value for. + * + * @return {boolean} `true` if the button is considered as being pressed down, otherwise `false`. + */ + isButtonDown: function (index) + { + return this.buttons[index].pressed; + }, - for (var i = 0; i < points.length; i++) + /** + * Internal update handler for this Gamepad. + * Called automatically by the Gamepad Manager as part of its update. + * + * @method Phaser.Input.Gamepad.Gamepad#update + * @private + * @since 3.0.0 + */ + update: function (pad) { - var pointA = points[i]; - var pointB = points[(i + 1) % points.length]; - var line = new Line( - pointA.x, - pointA.y, - pointB.x, - pointB.y - ); + if (pad.timestamp < this._created) + { + return; + } - perimeter += Length(line); - } + var i; - return perimeter; -}; + // Sync the button values -module.exports = Perimeter; + var localButtons = this.buttons; + var gamepadButtons = pad.buttons; + var len = localButtons.length; -/***/ }), -/* 472 */ -/***/ (function(module, exports) { + for (i = 0; i < len; i++) + { + localButtons[i].update(gamepadButtons[i].value); + } -/** - * @author Richard Davey - * @author Igor Ognichenko - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Sync the axis values -/** - * @ignore - */ -var copy = function (out, a) -{ - out[0] = a[0]; - out[1] = a[1]; - - return out; -}; + var localAxes = this.axes; + var gamepadAxes = pad.axes; -/** - * Takes a Polygon object and applies Chaikin's smoothing algorithm on its points. - * - * @function Phaser.Geom.Polygon.Smooth - * @since 3.13.0 - * - * @generic {Phaser.Geom.Polygon} O - [polygon,$return] - * - * @param {Phaser.Geom.Polygon} polygon - The polygon to be smoothed. The polygon will be modified in-place and returned. - * - * @return {Phaser.Geom.Polygon} The input polygon. - */ -var Smooth = function (polygon) -{ - var i; - var points = []; - var data = polygon.points; + len = localAxes.length; - for (i = 0; i < data.length; i++) - { - points.push([ data[i].x, data[i].y ]); - } + for (i = 0; i < len; i++) + { + localAxes[i].update(gamepadAxes[i]); + } - var output = []; - - if (points.length > 0) - { - output.push(copy([ 0, 0 ], points[0])); - } - - for (i = 0; i < points.length - 1; i++) - { - var p0 = points[i]; - var p1 = points[i + 1]; - var p0x = p0[0]; - var p0y = p0[1]; - var p1x = p1[0]; - var p1y = p1[1]; + if (len >= 2) + { + this.leftStick.set(localAxes[0].getValue(), localAxes[1].getValue()); - output.push([ 0.85 * p0x + 0.15 * p1x, 0.85 * p0y + 0.15 * p1y ]); - output.push([ 0.15 * p0x + 0.85 * p1x, 0.15 * p0y + 0.85 * p1y ]); - } - - if (points.length > 1) + if (len >= 4) + { + this.rightStick.set(localAxes[2].getValue(), localAxes[3].getValue()); + } + } + }, + + /** + * Destroys this Gamepad instance, its buttons and axes, and releases external references it holds. + * + * @method Phaser.Input.Gamepad.Gamepad#destroy + * @since 3.10.0 + */ + destroy: function () { - output.push(copy([ 0, 0 ], points[points.length - 1])); - } - - return polygon.setTo(output); -}; + this.removeAllListeners(); -module.exports = Smooth; + this.manager = null; + this.pad = null; + var i; -/***/ }), -/* 473 */ -/***/ (function(module, exports, __webpack_require__) { + for (i = 0; i < this.buttons.length; i++) + { + this.buttons[i].destroy(); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (i = 0; i < this.axes.length; i++) + { + this.axes[i].destroy(); + } -var Class = __webpack_require__(0); -var GeomRectangle = __webpack_require__(10); -var Shape = __webpack_require__(34); -var RectangleRender = __webpack_require__(1121); + this.buttons = []; + this.axes = []; + }, -/** - * @classdesc - * The Rectangle Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * You can change the size of the rectangle by changing the `width` and `height` properties. - * - * @class Rectangle - * @extends Phaser.GameObjects.Shape - * @memberof Phaser.GameObjects - * @constructor - * @since 3.13.0 - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {number} [width=128] - The width of the rectangle. - * @param {number} [height=128] - The height of the rectangle. - * @param {number} [fillColor] - The color the rectangle will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the rectangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. - */ -var Rectangle = new Class({ + /** + * Is this Gamepad currently connected or not? + * + * @name Phaser.Input.Gamepad.Gamepad#connected + * @type {boolean} + * @default true + * @since 3.0.0 + */ + connected: { - Extends: Shape, + get: function () + { + return this.pad.connected; + } - Mixins: [ - RectangleRender - ], + }, - initialize: + /** + * A timestamp containing the most recent time this Gamepad was updated. + * + * @name Phaser.Input.Gamepad.Gamepad#timestamp + * @type {number} + * @since 3.0.0 + */ + timestamp: { - function Rectangle (scene, x, y, width, height, fillColor, fillAlpha) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = 128; } - if (height === undefined) { height = 128; } + get: function () + { + return this.pad.timestamp; + } - Shape.call(this, scene, 'Rectangle', new GeomRectangle(0, 0, width, height)); + }, - this.setPosition(x, y); - this.setSize(width, height); + /** + * Is the Gamepad's Left button being pressed? + * If the Gamepad doesn't have this button it will always return false. + * This is the d-pad left button under standard Gamepad mapping. + * + * @name Phaser.Input.Gamepad.Gamepad#left + * @type {boolean} + * @since 3.10.0 + */ + left: { - if (fillColor !== undefined) + get: function () { - this.setFillStyle(fillColor, fillAlpha); + return this._LCLeft.pressed; } - this.updateDisplayOrigin(); - this.updateData(); }, /** - * Sets the internal size of this Game Object, as used for frame or physics body creation. + * Is the Gamepad's Right button being pressed? + * If the Gamepad doesn't have this button it will always return false. + * This is the d-pad right button under standard Gamepad mapping. * - * This will not change the size that the Game Object is rendered in-game. - * For that you need to either set the scale of the Game Object (`setScale`) or call the - * `setDisplaySize` method, which is the same thing as changing the scale but allows you - * to do so by giving pixel values. + * @name Phaser.Input.Gamepad.Gamepad#right + * @type {boolean} + * @since 3.10.0 + */ + right: { + + get: function () + { + return this._LCRight.pressed; + } + + }, + + /** + * Is the Gamepad's Up button being pressed? + * If the Gamepad doesn't have this button it will always return false. + * This is the d-pad up button under standard Gamepad mapping. * - * If you have enabled this Game Object for input, changing the size will _not_ change the - * size of the hit area. To do this you should adjust the `input.hitArea` object directly. + * @name Phaser.Input.Gamepad.Gamepad#up + * @type {boolean} + * @since 3.10.0 + */ + up: { + + get: function () + { + return this._LCTop.pressed; + } + + }, + + /** + * Is the Gamepad's Down button being pressed? + * If the Gamepad doesn't have this button it will always return false. + * This is the d-pad down button under standard Gamepad mapping. * - * @method Phaser.GameObjects.Rectangle#setSize - * @since 3.13.0 + * @name Phaser.Input.Gamepad.Gamepad#down + * @type {boolean} + * @since 3.10.0 + */ + down: { + + get: function () + { + return this._LCBottom.pressed; + } + + }, + + /** + * Is the Gamepad's bottom button in the right button cluster being pressed? + * If the Gamepad doesn't have this button it will always return false. + * On a Dual Shock controller it's the X button. + * On an XBox controller it's the A button. * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. + * @name Phaser.Input.Gamepad.Gamepad#A + * @type {boolean} + * @since 3.10.0 + */ + A: { + + get: function () + { + return this._RCBottom.pressed; + } + + }, + + /** + * Is the Gamepad's top button in the right button cluster being pressed? + * If the Gamepad doesn't have this button it will always return false. + * On a Dual Shock controller it's the Triangle button. + * On an XBox controller it's the Y button. * - * @return {this} This Game Object instance. + * @name Phaser.Input.Gamepad.Gamepad#Y + * @type {boolean} + * @since 3.10.0 */ - setSize: function (width, height) - { - this.width = width; - this.height = height; + Y: { - this.geom.setSize(width, height); + get: function () + { + return this._RCTop.pressed; + } - this.updateData(); + }, + + /** + * Is the Gamepad's left button in the right button cluster being pressed? + * If the Gamepad doesn't have this button it will always return false. + * On a Dual Shock controller it's the Square button. + * On an XBox controller it's the X button. + * + * @name Phaser.Input.Gamepad.Gamepad#X + * @type {boolean} + * @since 3.10.0 + */ + X: { + + get: function () + { + return this._RCLeft.pressed; + } - return this; }, /** - * Internal method that updates the data and path values. + * Is the Gamepad's right button in the right button cluster being pressed? + * If the Gamepad doesn't have this button it will always return false. + * On a Dual Shock controller it's the Circle button. + * On an XBox controller it's the B button. * - * @method Phaser.GameObjects.Rectangle#updateData - * @private - * @since 3.13.0 + * @name Phaser.Input.Gamepad.Gamepad#B + * @type {boolean} + * @since 3.10.0 + */ + B: { + + get: function () + { + return this._RCRight.pressed; + } + + }, + + /** + * Returns the value of the Gamepad's top left shoulder button. + * If the Gamepad doesn't have this button it will always return zero. + * The value is a float between 0 and 1, corresponding to how depressed the button is. + * On a Dual Shock controller it's the L1 button. + * On an XBox controller it's the LB button. * - * @return {this} This Game Object instance. + * @name Phaser.Input.Gamepad.Gamepad#L1 + * @type {number} + * @since 3.10.0 */ - updateData: function () - { - var path = []; - var rect = this.geom; - var line = this._tempLine; + L1: { - rect.getLineA(line); + get: function () + { + return this._FBLeftTop.value; + } - path.push(line.x1, line.y1, line.x2, line.y2); + }, - rect.getLineB(line); + /** + * Returns the value of the Gamepad's bottom left shoulder button. + * If the Gamepad doesn't have this button it will always return zero. + * The value is a float between 0 and 1, corresponding to how depressed the button is. + * On a Dual Shock controller it's the L2 button. + * On an XBox controller it's the LT button. + * + * @name Phaser.Input.Gamepad.Gamepad#L2 + * @type {number} + * @since 3.10.0 + */ + L2: { - path.push(line.x2, line.y2); + get: function () + { + return this._FBLeftBottom.value; + } - rect.getLineC(line); + }, - path.push(line.x2, line.y2); + /** + * Returns the value of the Gamepad's top right shoulder button. + * If the Gamepad doesn't have this button it will always return zero. + * The value is a float between 0 and 1, corresponding to how depressed the button is. + * On a Dual Shock controller it's the R1 button. + * On an XBox controller it's the RB button. + * + * @name Phaser.Input.Gamepad.Gamepad#R1 + * @type {number} + * @since 3.10.0 + */ + R1: { - rect.getLineD(line); + get: function () + { + return this._FBRightTop.value; + } - path.push(line.x2, line.y2); + }, - this.pathData = path; + /** + * Returns the value of the Gamepad's bottom right shoulder button. + * If the Gamepad doesn't have this button it will always return zero. + * The value is a float between 0 and 1, corresponding to how depressed the button is. + * On a Dual Shock controller it's the R2 button. + * On an XBox controller it's the RT button. + * + * @name Phaser.Input.Gamepad.Gamepad#R2 + * @type {number} + * @since 3.10.0 + */ + R2: { + + get: function () + { + return this._FBRightBottom.value; + } - return this; } }); -module.exports = Rectangle; +module.exports = Gamepad; /***/ }), -/* 474 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 1379: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var StarRender = __webpack_require__(1124); -var Class = __webpack_require__(0); -var Earcut = __webpack_require__(59); -var Shape = __webpack_require__(34); +var Class = __webpack_require__(56694); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(43200); +var Gamepad = __webpack_require__(75956); +var GetValue = __webpack_require__(10850); +var InputPluginCache = __webpack_require__(63399); +var InputEvents = __webpack_require__(33963); /** * @classdesc - * The Star Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * As the name implies, the Star shape will display a star in your game. You can control several - * aspects of it including the number of points that constitute the star. The default is 5. If - * you change it to 4 it will render as a diamond. If you increase them, you'll get a more spiky - * star shape. - * - * You can also control the inner and outer radius, which is how 'long' each point of the star is. - * Modify these values to create more interesting shapes. + * The Gamepad Plugin is an input plugin that belongs to the Scene-owned Input system. * - * @class Star - * @extends Phaser.GameObjects.Shape - * @memberof Phaser.GameObjects + * Its role is to listen for native DOM Gamepad Events and then process them. + * + * You do not need to create this class directly, the Input system will create an instance of it automatically. + * + * You can access it from within a Scene using `this.input.gamepad`. + * + * To listen for a gamepad being connected: + * + * ```javascript + * this.input.gamepad.once('connected', function (pad) { + * // 'pad' is a reference to the gamepad that was just connected + * }); + * ``` + * + * Note that the browser may require you to press a button on a gamepad before it will allow you to access it, + * this is for security reasons. However, it may also trust the page already, in which case you won't get the + * 'connected' event and instead should check `GamepadPlugin.total` to see if it thinks there are any gamepads + * already connected. + * + * Once you have received the connected event, or polled the gamepads and found them enabled, you can access + * them via the built-in properties `GamepadPlugin.pad1` to `pad4`, for up to 4 game pads. With a reference + * to the gamepads you can poll its buttons and axis sticks. See the properties and methods available on + * the `Gamepad` class for more details. + * + * As of September 2020 Chrome, and likely other browsers, will soon start to require that games requesting + * access to the Gamepad API are running under SSL. They will actively block API access if they are not. + * + * For more information about Gamepad support in browsers see the following resources: + * + * https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API + * https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API + * https://www.smashingmagazine.com/2015/11/gamepad-api-in-web-games/ + * http://html5gamepad.com/ + * + * @class GamepadPlugin + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Input.Gamepad * @constructor - * @since 3.13.0 + * @since 3.10.0 * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [points=5] - The number of points on the star. - * @param {number} [innerRadius=32] - The inner radius of the star. - * @param {number} [outerRadius=64] - The outer radius of the star. - * @param {number} [fillColor] - The color the star will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the star will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * @param {Phaser.Input.InputPlugin} sceneInputPlugin - A reference to the Scene Input Plugin that the KeyboardPlugin belongs to. */ -var Star = new Class({ - - Extends: Shape, +var GamepadPlugin = new Class({ - Mixins: [ - StarRender - ], + Extends: EventEmitter, initialize: - function Star (scene, x, y, points, innerRadius, outerRadius, fillColor, fillAlpha) + function GamepadPlugin (sceneInputPlugin) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (points === undefined) { points = 5; } - if (innerRadius === undefined) { innerRadius = 32; } - if (outerRadius === undefined) { outerRadius = 64; } + EventEmitter.call(this); - Shape.call(this, scene, 'Star', null); + /** + * A reference to the Scene that this Input Plugin is responsible for. + * + * @name Phaser.Input.Gamepad.GamepadPlugin#scene + * @type {Phaser.Scene} + * @since 3.10.0 + */ + this.scene = sceneInputPlugin.scene; /** - * Private internal value. - * The number of points in the star. + * A reference to the Scene Systems Settings. * - * @name Phaser.GameObjects.Star#_points - * @type {number} + * @name Phaser.Input.Gamepad.GamepadPlugin#settings + * @type {Phaser.Types.Scenes.SettingsObject} + * @since 3.10.0 + */ + this.settings = this.scene.sys.settings; + + /** + * A reference to the Scene Input Plugin that created this Keyboard Plugin. + * + * @name Phaser.Input.Gamepad.GamepadPlugin#sceneInputPlugin + * @type {Phaser.Input.InputPlugin} + * @since 3.10.0 + */ + this.sceneInputPlugin = sceneInputPlugin; + + /** + * A boolean that controls if the Gamepad Manager is enabled or not. + * Can be toggled on the fly. + * + * @name Phaser.Input.Gamepad.GamepadPlugin#enabled + * @type {boolean} + * @default true + * @since 3.10.0 + */ + this.enabled = true; + + /** + * The Gamepad Event target, as defined in the Game Config. + * Typically the browser window, but can be any interactive DOM element. + * + * @name Phaser.Input.Gamepad.GamepadPlugin#target + * @type {any} + * @since 3.10.0 + */ + this.target; + + /** + * An array of the connected Gamepads. + * + * @name Phaser.Input.Gamepad.GamepadPlugin#gamepads + * @type {Phaser.Input.Gamepad.Gamepad[]} + * @default [] + * @since 3.10.0 + */ + this.gamepads = []; + + /** + * An internal event queue. + * + * @name Phaser.Input.Gamepad.GamepadPlugin#queue + * @type {GamepadEvent[]} * @private - * @since 3.13.0 + * @since 3.10.0 */ - this._points = points; + this.queue = []; /** - * Private internal value. - * The inner radius of the star. + * Internal event handler. * - * @name Phaser.GameObjects.Star#_innerRadius - * @type {number} + * @name Phaser.Input.Gamepad.GamepadPlugin#onGamepadHandler + * @type {function} * @private - * @since 3.13.0 + * @since 3.10.0 */ - this._innerRadius = innerRadius; + this.onGamepadHandler; /** - * Private internal value. - * The outer radius of the star. + * Internal Gamepad reference. * - * @name Phaser.GameObjects.Star#_outerRadius - * @type {number} + * @name Phaser.Input.Gamepad.GamepadPlugin#_pad1 + * @type {Phaser.Input.Gamepad.Gamepad} * @private - * @since 3.13.0 + * @since 3.10.0 */ - this._outerRadius = outerRadius; + this._pad1; - this.setPosition(x, y); - this.setSize(outerRadius * 2, outerRadius * 2); + /** + * Internal Gamepad reference. + * + * @name Phaser.Input.Gamepad.GamepadPlugin#_pad2 + * @type {Phaser.Input.Gamepad.Gamepad} + * @private + * @since 3.10.0 + */ + this._pad2; - if (fillColor !== undefined) - { - this.setFillStyle(fillColor, fillAlpha); - } + /** + * Internal Gamepad reference. + * + * @name Phaser.Input.Gamepad.GamepadPlugin#_pad3 + * @type {Phaser.Input.Gamepad.Gamepad} + * @private + * @since 3.10.0 + */ + this._pad3; - this.updateDisplayOrigin(); - this.updateData(); + /** + * Internal Gamepad reference. + * + * @name Phaser.Input.Gamepad.GamepadPlugin#_pad4 + * @type {Phaser.Input.Gamepad.Gamepad} + * @private + * @since 3.10.0 + */ + this._pad4; + + sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this); + sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this); }, /** - * Sets the number of points that make up the Star shape. - * This call can be chained. - * - * @method Phaser.GameObjects.Star#setPoints - * @since 3.13.0 - * - * @param {number} value - The amount of points the Star will have. + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. * - * @return {this} This Game Object instance. + * @method Phaser.Input.Gamepad.GamepadPlugin#boot + * @private + * @since 3.10.0 */ - setPoints: function (value) + boot: function () { - this._points = value; + var game = this.scene.sys.game; + var settings = this.settings.input; + var config = game.config; - return this.updateData(); + this.enabled = GetValue(settings, 'gamepad', config.inputGamepad) && game.device.input.gamepads; + this.target = GetValue(settings, 'gamepad.target', config.inputGamepadEventTarget); + + this.sceneInputPlugin.pluginEvents.once(InputEvents.DESTROY, this.destroy, this); }, /** - * Sets the inner radius of the Star shape. - * This call can be chained. - * - * @method Phaser.GameObjects.Star#setInnerRadius - * @since 3.13.0 - * - * @param {number} value - The amount to set the inner radius to. + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. * - * @return {this} This Game Object instance. + * @method Phaser.Input.Gamepad.GamepadPlugin#start + * @private + * @since 3.10.0 */ - setInnerRadius: function (value) + start: function () { - this._innerRadius = value; + if (this.enabled) + { + this.startListeners(); - return this.updateData(); + this.refreshPads(); + } + + this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); }, /** - * Sets the outer radius of the Star shape. - * This call can be chained. + * Checks to see if both this plugin and the Scene to which it belongs is active. * - * @method Phaser.GameObjects.Star#setOuterRadius - * @since 3.13.0 - * - * @param {number} value - The amount to set the outer radius to. + * @method Phaser.Input.Gamepad.GamepadPlugin#isActive + * @since 3.10.0 * - * @return {this} This Game Object instance. + * @return {boolean} `true` if the plugin and the Scene it belongs to is active. */ - setOuterRadius: function (value) + isActive: function () { - this._outerRadius = value; - - return this.updateData(); + return (this.enabled && this.scene.sys.isActive()); }, /** - * The number of points that make up the Star shape. + * Starts the Gamepad Event listeners running. + * This is called automatically and does not need to be manually invoked. * - * @name Phaser.GameObjects.Star#points - * @type {number} - * @default 5 - * @since 3.13.0 + * @method Phaser.Input.Gamepad.GamepadPlugin#startListeners + * @private + * @since 3.10.0 */ - points: { + startListeners: function () + { + var _this = this; + var target = this.target; - get: function () + var handler = function (event) { - return this._points; - }, + if (event.defaultPrevented || !_this.isActive()) + { + // Do nothing if event already handled + return; + } - set: function (value) - { - this._points = value; + _this.refreshPads(); - this.updateData(); - } + _this.queue.push(event); + }; + + this.onGamepadHandler = handler; + + target.addEventListener('gamepadconnected', handler, false); + target.addEventListener('gamepaddisconnected', handler, false); + + // FF also supports gamepadbuttondown, gamepadbuttonup and gamepadaxismove but + // nothing else does, and we can get those values via the gamepads anyway, so we will + // until more browsers support this + // Finally, listen for an update event from the Input Plugin + this.sceneInputPlugin.pluginEvents.on(InputEvents.UPDATE, this.update, this); }, /** - * The inner radius of the Star shape. + * Stops the Gamepad Event listeners. + * This is called automatically and does not need to be manually invoked. * - * @name Phaser.GameObjects.Star#innerRadius - * @type {number} - * @default 32 - * @since 3.13.0 + * @method Phaser.Input.Gamepad.GamepadPlugin#stopListeners + * @private + * @since 3.10.0 */ - innerRadius: { + stopListeners: function () + { + this.target.removeEventListener('gamepadconnected', this.onGamepadHandler); + this.target.removeEventListener('gamepaddisconnected', this.onGamepadHandler); - get: function () - { - return this._innerRadius; - }, + this.sceneInputPlugin.pluginEvents.off(InputEvents.UPDATE, this.update); - set: function (value) + for (var i = 0; i < this.gamepads.length; i++) { - this._innerRadius = value; - - this.updateData(); + this.gamepads[i].removeAllListeners(); } + }, + /** + * Disconnects all current Gamepads. + * + * @method Phaser.Input.Gamepad.GamepadPlugin#disconnectAll + * @since 3.10.0 + */ + disconnectAll: function () + { + for (var i = 0; i < this.gamepads.length; i++) + { + this.gamepads[i].pad.connected = false; + } }, /** - * The outer radius of the Star shape. + * Refreshes the list of connected Gamepads. * - * @name Phaser.GameObjects.Star#outerRadius - * @type {number} - * @default 64 - * @since 3.13.0 + * This is called automatically when a gamepad is connected or disconnected, + * and during the update loop. + * + * @method Phaser.Input.Gamepad.GamepadPlugin#refreshPads + * @private + * @since 3.10.0 */ - outerRadius: { + refreshPads: function () + { + var connectedPads = navigator.getGamepads(); - get: function () + if (!connectedPads) { - return this._outerRadius; - }, - - set: function (value) + this.disconnectAll(); + } + else { - this._outerRadius = value; + var currentPads = this.gamepads; - this.updateData(); - } + for (var i = 0; i < connectedPads.length; i++) + { + var livePad = connectedPads[i]; + + // Because sometimes they're null (yes, really) + if (!livePad) + { + continue; + } + + var id = livePad.id; + var index = livePad.index; + var currentPad = currentPads[index]; + + if (!currentPad) + { + // A new Gamepad, not currently stored locally + var newPad = new Gamepad(this, livePad); + + currentPads[index] = newPad; + + if (!this._pad1) + { + this._pad1 = newPad; + } + else if (!this._pad2) + { + this._pad2 = newPad; + } + else if (!this._pad3) + { + this._pad3 = newPad; + } + else if (!this._pad4) + { + this._pad4 = newPad; + } + } + else if (currentPad.id !== id) + { + // A new Gamepad with a different vendor string, but it has got the same index as an old one + currentPad.destroy(); + currentPads[index] = new Gamepad(this, livePad); + } + else + { + // If neither of these, it's a pad we've already got, so update it + currentPad.update(livePad); + } + } + } }, /** - * Internal method that updates the data and path values. + * Returns an array of all currently connected Gamepads. * - * @method Phaser.GameObjects.Star#updateData - * @private - * @since 3.13.0 + * @method Phaser.Input.Gamepad.GamepadPlugin#getAll + * @since 3.10.0 * - * @return {this} This Game Object instance. + * @return {Phaser.Input.Gamepad.Gamepad[]} An array of all currently connected Gamepads. */ - updateData: function () + getAll: function () { - var path = []; + var out = []; + var pads = this.gamepads; - var points = this._points; - var innerRadius = this._innerRadius; - var outerRadius = this._outerRadius; + for (var i = 0; i < pads.length; i++) + { + if (pads[i]) + { + out.push(pads[i]); + } + } - var rot = Math.PI / 2 * 3; - var step = Math.PI / points; + return out; + }, - // So origin 0.5 = the center of the star - var x = outerRadius; - var y = outerRadius; - - path.push(x, y + -outerRadius); + /** + * Looks-up a single Gamepad based on the given index value. + * + * @method Phaser.Input.Gamepad.GamepadPlugin#getPad + * @since 3.10.0 + * + * @param {number} index - The index of the Gamepad to get. + * + * @return {Phaser.Input.Gamepad.Gamepad} The Gamepad matching the given index, or undefined if none were found. + */ + getPad: function (index) + { + var pads = this.gamepads; - for (var i = 0; i < points; i++) + for (var i = 0; i < pads.length; i++) { - path.push(x + Math.cos(rot) * outerRadius, y + Math.sin(rot) * outerRadius); - - rot += step; + if (pads[i] && pads[i].index === index) + { + return pads[i]; + } + } + }, - path.push(x + Math.cos(rot) * innerRadius, y + Math.sin(rot) * innerRadius); - - rot += step; + /** + * The internal update loop. Refreshes all connected gamepads and processes their events. + * + * Called automatically by the Input Manager, invoked from the Game step. + * + * @method Phaser.Input.Gamepad.GamepadPlugin#update + * @private + * @fires Phaser.Input.Gamepad.Events#CONNECTED + * @fires Phaser.Input.Gamepad.Events#DISCONNECTED + * @since 3.10.0 + */ + update: function () + { + if (!this.enabled) + { + return; } - path.push(x, y + -outerRadius); + this.refreshPads(); - this.pathIndexes = Earcut(path); - this.pathData = path; + var len = this.queue.length; - return this; - } + if (len === 0) + { + return; + } -}); + var queue = this.queue.splice(0, len); -module.exports = Star; + // Process the event queue, dispatching all of the events that have stored up + for (var i = 0; i < len; i++) + { + var event = queue[i]; + var pad = this.getPad(event.gamepad.index); + if (event.type === 'gamepadconnected') + { + this.emit(Events.CONNECTED, pad, event); + } + else if (event.type === 'gamepaddisconnected') + { + this.emit(Events.DISCONNECTED, pad, event); + } + } + }, -/***/ }), -/* 475 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Shape = __webpack_require__(34); -var GeomTriangle = __webpack_require__(82); -var TriangleRender = __webpack_require__(1127); - -/** - * @classdesc - * The Triangle Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * The Triangle consists of 3 lines, joining up to form a triangular shape. You can control the - * position of each point of these lines. The triangle is always closed and cannot have an open - * face. If you require that, consider using a Polygon instead. - * - * @class Triangle - * @extends Phaser.GameObjects.Shape - * @memberof Phaser.GameObjects - * @constructor - * @since 3.13.0 - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [x1=0] - The horizontal position of the first point in the triangle. - * @param {number} [y1=128] - The vertical position of the first point in the triangle. - * @param {number} [x2=64] - The horizontal position of the second point in the triangle. - * @param {number} [y2=0] - The vertical position of the second point in the triangle. - * @param {number} [x3=128] - The horizontal position of the third point in the triangle. - * @param {number} [y3=128] - The vertical position of the third point in the triangle. - * @param {number} [fillColor] - The color the triangle will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the triangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. - */ -var Triangle = new Class({ - - Extends: Shape, - - Mixins: [ - TriangleRender - ], + /** + * Shuts the Gamepad Plugin down. + * All this does is remove any listeners bound to it. + * + * @method Phaser.Input.Gamepad.GamepadPlugin#shutdown + * @private + * @since 3.10.0 + */ + shutdown: function () + { + this.stopListeners(); - initialize: + this.removeAllListeners(); + }, - function Triangle (scene, x, y, x1, y1, x2, y2, x3, y3, fillColor, fillAlpha) + /** + * Destroys this Gamepad Plugin, disconnecting all Gamepads and releasing internal references. + * + * @method Phaser.Input.Gamepad.GamepadPlugin#destroy + * @private + * @since 3.10.0 + */ + destroy: function () { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (x1 === undefined) { x1 = 0; } - if (y1 === undefined) { y1 = 128; } - if (x2 === undefined) { x2 = 64; } - if (y2 === undefined) { y2 = 0; } - if (x3 === undefined) { x3 = 128; } - if (y3 === undefined) { y3 = 128; } + this.shutdown(); - Shape.call(this, scene, 'Triangle', new GeomTriangle(x1, y1, x2, y2, x3, y3)); + for (var i = 0; i < this.gamepads.length; i++) + { + if (this.gamepads[i]) + { + this.gamepads[i].destroy(); + } + } - var width = this.geom.right - this.geom.left; - var height = this.geom.bottom - this.geom.top; + this.gamepads = []; - this.setPosition(x, y); - this.setSize(width, height); + this.scene = null; + this.settings = null; + this.sceneInputPlugin = null; + this.target = null; + }, - if (fillColor !== undefined) + /** + * The total number of connected game pads. + * + * @name Phaser.Input.Gamepad.GamepadPlugin#total + * @type {number} + * @since 3.10.0 + */ + total: { + + get: function () { - this.setFillStyle(fillColor, fillAlpha); + return this.gamepads.length; } - this.updateDisplayOrigin(); - this.updateData(); }, /** - * Sets the data for the lines that make up this Triangle shape. - * - * @method Phaser.GameObjects.Triangle#setTo - * @since 3.13.0 + * A reference to the first connected Gamepad. * - * @param {number} [x1=0] - The horizontal position of the first point in the triangle. - * @param {number} [y1=0] - The vertical position of the first point in the triangle. - * @param {number} [x2=0] - The horizontal position of the second point in the triangle. - * @param {number} [y2=0] - The vertical position of the second point in the triangle. - * @param {number} [x3=0] - The horizontal position of the third point in the triangle. - * @param {number} [y3=0] - The vertical position of the third point in the triangle. + * This will be undefined if either no pads are connected, or the browser + * has not yet issued a gamepadconnect, which can happen even if a Gamepad + * is plugged in, but hasn't yet had any buttons pressed on it. * - * @return {this} This Game Object instance. + * @name Phaser.Input.Gamepad.GamepadPlugin#pad1 + * @type {Phaser.Input.Gamepad.Gamepad} + * @since 3.10.0 */ - setTo: function (x1, y1, x2, y2, x3, y3) - { - this.geom.setTo(x1, y1, x2, y2, x3, y3); + pad1: { + + get: function () + { + return this._pad1; + } - return this.updateData(); }, /** - * Internal method that updates the data and path values. + * A reference to the second connected Gamepad. * - * @method Phaser.GameObjects.Triangle#updateData - * @private - * @since 3.13.0 + * This will be undefined if either no pads are connected, or the browser + * has not yet issued a gamepadconnect, which can happen even if a Gamepad + * is plugged in, but hasn't yet had any buttons pressed on it. * - * @return {this} This Game Object instance. + * @name Phaser.Input.Gamepad.GamepadPlugin#pad2 + * @type {Phaser.Input.Gamepad.Gamepad} + * @since 3.10.0 */ - updateData: function () - { - var path = []; - var tri = this.geom; - var line = this._tempLine; + pad2: { - tri.getLineA(line); + get: function () + { + return this._pad2; + } - path.push(line.x1, line.y1, line.x2, line.y2); + }, - tri.getLineB(line); + /** + * A reference to the third connected Gamepad. + * + * This will be undefined if either no pads are connected, or the browser + * has not yet issued a gamepadconnect, which can happen even if a Gamepad + * is plugged in, but hasn't yet had any buttons pressed on it. + * + * @name Phaser.Input.Gamepad.GamepadPlugin#pad3 + * @type {Phaser.Input.Gamepad.Gamepad} + * @since 3.10.0 + */ + pad3: { - path.push(line.x2, line.y2); + get: function () + { + return this._pad3; + } - tri.getLineC(line); + }, - path.push(line.x2, line.y2); + /** + * A reference to the fourth connected Gamepad. + * + * This will be undefined if either no pads are connected, or the browser + * has not yet issued a gamepadconnect, which can happen even if a Gamepad + * is plugged in, but hasn't yet had any buttons pressed on it. + * + * @name Phaser.Input.Gamepad.GamepadPlugin#pad4 + * @type {Phaser.Input.Gamepad.Gamepad} + * @since 3.10.0 + */ + pad4: { - this.pathData = path; + get: function () + { + return this._pad4; + } - return this; } }); -module.exports = Triangle; +/** + * An instance of the Gamepad Plugin class, if enabled via the `input.gamepad` Scene or Game Config property. + * Use this to create access Gamepads connected to the browser and respond to gamepad buttons. + * + * @name Phaser.Input.InputPlugin#gamepad + * @type {?Phaser.Input.Gamepad.GamepadPlugin} + * @since 3.10.0 + */ +InputPluginCache.register('GamepadPlugin', GamepadPlugin, 'gamepad', 'gamepad', 'inputGamepad'); + +module.exports = GamepadPlugin; /***/ }), -/* 476 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 33171: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Point = __webpack_require__(4); -var Length = __webpack_require__(67); - /** - * Returns a Point from around the perimeter of a Triangle. + * Tatar SNES USB Controller Gamepad Configuration. + * USB Gamepad (STANDARD GAMEPAD Vendor: 0079 Product: 0011) * - * @function Phaser.Geom.Triangle.GetPoint + * @name Phaser.Input.Gamepad.Configs.SNES_USB + * @namespace * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the point on its perimeter from. - * @param {number} position - The position along the perimeter of the triangle. A value between 0 and 1. - * @param {(Phaser.Geom.Point|object)} [out] - An option Point, or Point-like object to store the value in. If not given a new Point will be created. - * - * @return {(Phaser.Geom.Point|object)} A Point object containing the given position from the perimeter of the triangle. */ -var GetPoint = function (triangle, position, out) -{ - if (out === undefined) { out = new Point(); } +module.exports = { - var line1 = triangle.getLineA(); - var line2 = triangle.getLineB(); - var line3 = triangle.getLineC(); + /** + * D-Pad up + * + * @name Phaser.Input.Gamepad.Configs.SNES_USB.UP + * @const + * @type {number} + * @since 3.0.0 + */ + UP: 12, - if (position <= 0 || position >= 1) - { - out.x = line1.x1; - out.y = line1.y1; + /** + * D-Pad down + * + * @name Phaser.Input.Gamepad.Configs.SNES_USB.DOWN + * @const + * @type {number} + * @since 3.0.0 + */ + DOWN: 13, - return out; - } + /** + * D-Pad left + * + * @name Phaser.Input.Gamepad.Configs.SNES_USB.LEFT + * @const + * @type {number} + * @since 3.0.0 + */ + LEFT: 14, - var length1 = Length(line1); - var length2 = Length(line2); - var length3 = Length(line3); + /** + * D-Pad right + * + * @name Phaser.Input.Gamepad.Configs.SNES_USB.RIGHT + * @const + * @type {number} + * @since 3.0.0 + */ + RIGHT: 15, - var perimeter = length1 + length2 + length3; + /** + * Select button + * + * @name Phaser.Input.Gamepad.Configs.SNES_USB.SELECT + * @const + * @type {number} + * @since 3.0.0 + */ + SELECT: 8, - var p = perimeter * position; - var localPosition = 0; + /** + * Start button + * + * @name Phaser.Input.Gamepad.Configs.SNES_USB.START + * @const + * @type {number} + * @since 3.0.0 + */ + START: 9, - // Which line is it on? + /** + * B Button (Bottom) + * + * @name Phaser.Input.Gamepad.Configs.SNES_USB.B + * @const + * @type {number} + * @since 3.0.0 + */ + B: 0, - if (p < length1) - { - // Line 1 - localPosition = p / length1; + /** + * A Button (Right) + * + * @name Phaser.Input.Gamepad.Configs.SNES_USB.A + * @const + * @type {number} + * @since 3.0.0 + */ + A: 1, - out.x = line1.x1 + (line1.x2 - line1.x1) * localPosition; - out.y = line1.y1 + (line1.y2 - line1.y1) * localPosition; - } - else if (p > length1 + length2) - { - // Line 3 - p -= length1 + length2; - localPosition = p / length3; + /** + * Y Button (Left) + * + * @name Phaser.Input.Gamepad.Configs.SNES_USB.Y + * @const + * @type {number} + * @since 3.0.0 + */ + Y: 2, - out.x = line3.x1 + (line3.x2 - line3.x1) * localPosition; - out.y = line3.y1 + (line3.y2 - line3.y1) * localPosition; - } - else - { - // Line 2 - p -= length1; - localPosition = p / length2; + /** + * X Button (Top) + * + * @name Phaser.Input.Gamepad.Configs.SNES_USB.X + * @const + * @type {number} + * @since 3.0.0 + */ + X: 3, - out.x = line2.x1 + (line2.x2 - line2.x1) * localPosition; - out.y = line2.y1 + (line2.y2 - line2.y1) * localPosition; - } + /** + * Left bumper + * + * @name Phaser.Input.Gamepad.Configs.SNES_USB.LEFT_SHOULDER + * @const + * @type {number} + * @since 3.0.0 + */ + LEFT_SHOULDER: 4, - return out; -}; + /** + * Right bumper + * + * @name Phaser.Input.Gamepad.Configs.SNES_USB.RIGHT_SHOULDER + * @const + * @type {number} + * @since 3.0.0 + */ + RIGHT_SHOULDER: 5 -module.exports = GetPoint; +}; /***/ }), -/* 477 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 74982: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Length = __webpack_require__(67); -var Point = __webpack_require__(4); - /** - * Returns an array of evenly spaced points on the perimeter of a Triangle. + * PlayStation DualShock 4 Gamepad Configuration. + * Sony PlayStation DualShock 4 (v2) wireless controller * - * @function Phaser.Geom.Triangle.GetPoints + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4 + * @namespace * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the points from. - * @param {number} quantity - The number of evenly spaced points to return. Set to 0 to return an arbitrary number of points based on the `stepRate`. - * @param {number} stepRate - If `quantity` is 0, the distance between each returned point. - * @param {(array|Phaser.Geom.Point[])} [out] - An array to which the points should be appended. - * - * @return {(array|Phaser.Geom.Point[])} The modified `out` array, or a new array if none was provided. */ -var GetPoints = function (triangle, quantity, stepRate, out) -{ - if (out === undefined) { out = []; } +module.exports = { - var line1 = triangle.getLineA(); - var line2 = triangle.getLineB(); - var line3 = triangle.getLineC(); + /** + * D-Pad up + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.UP + * @const + * @type {number} + * @since 3.0.0 + */ + UP: 12, - var length1 = Length(line1); - var length2 = Length(line2); - var length3 = Length(line3); + /** + * D-Pad down + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.DOWN + * @const + * @type {number} + * @since 3.0.0 + */ + DOWN: 13, - var perimeter = length1 + length2 + length3; + /** + * D-Pad left + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.LEFT + * @const + * @type {number} + * @since 3.0.0 + */ + LEFT: 14, - // If quantity is a falsey value (false, null, 0, undefined, etc) then we calculate it based on the stepRate instead. - if (!quantity && stepRate > 0) - { - quantity = perimeter / stepRate; - } + /** + * D-Pad up + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.RIGHT + * @const + * @type {number} + * @since 3.0.0 + */ + RIGHT: 15, - for (var i = 0; i < quantity; i++) - { - var p = perimeter * (i / quantity); - var localPosition = 0; + /** + * Share button + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.SHARE + * @const + * @type {number} + * @since 3.0.0 + */ + SHARE: 8, - var point = new Point(); + /** + * Options button + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.OPTIONS + * @const + * @type {number} + * @since 3.0.0 + */ + OPTIONS: 9, - // Which line is it on? + /** + * PlayStation logo button + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.PS + * @const + * @type {number} + * @since 3.0.0 + */ + PS: 16, - if (p < length1) - { - // Line 1 - localPosition = p / length1; + /** + * Touchpad click + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.TOUCHBAR + * @const + * @type {number} + * @since 3.0.0 + */ + TOUCHBAR: 17, - point.x = line1.x1 + (line1.x2 - line1.x1) * localPosition; - point.y = line1.y1 + (line1.y2 - line1.y1) * localPosition; - } - else if (p > length1 + length2) - { - // Line 3 - p -= length1 + length2; - localPosition = p / length3; + /** + * Cross button (Bottom) + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.X + * @const + * @type {number} + * @since 3.0.0 + */ + X: 0, - point.x = line3.x1 + (line3.x2 - line3.x1) * localPosition; - point.y = line3.y1 + (line3.y2 - line3.y1) * localPosition; - } - else - { - // Line 2 - p -= length1; - localPosition = p / length2; + /** + * Circle button (Right) + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.CIRCLE + * @const + * @type {number} + * @since 3.0.0 + */ + CIRCLE: 1, - point.x = line2.x1 + (line2.x2 - line2.x1) * localPosition; - point.y = line2.y1 + (line2.y2 - line2.y1) * localPosition; - } + /** + * Square button (Left) + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.SQUARE + * @const + * @type {number} + * @since 3.0.0 + */ + SQUARE: 2, - out.push(point); - } + /** + * Triangle button (Top) + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.TRIANGLE + * @const + * @type {number} + * @since 3.0.0 + */ + TRIANGLE: 3, - return out; -}; + /** + * Left bumper (L1) + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.L1 + * @const + * @type {number} + * @since 3.0.0 + */ + L1: 4, -module.exports = GetPoints; + /** + * Right bumper (R1) + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.R1 + * @const + * @type {number} + * @since 3.0.0 + */ + R1: 5, + /** + * Left trigger (L2) + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.L2 + * @const + * @type {number} + * @since 3.0.0 + */ + L2: 6, -/***/ }), -/* 478 */ -/***/ (function(module, exports) { + /** + * Right trigger (R2) + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.R2 + * @const + * @type {number} + * @since 3.0.0 + */ + R2: 7, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Left stick click (L3) + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.L3 + * @const + * @type {number} + * @since 3.0.0 + */ + L3: 10, -/** - * Sets a value in an object, allowing for dot notation to control the depth of the property. - * - * For example: - * - * ```javascript - * var data = { - * world: { - * position: { - * x: 200, - * y: 100 - * } - * } - * }; - * - * SetValue(data, 'world.position.y', 300); - * - * console.log(data.world.position.y); // 300 - * ``` - * - * @function Phaser.Utils.Objects.SetValue - * @since 3.17.0 - * - * @param {object} source - The object to set the value in. - * @param {string} key - The name of the property in the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`) - * @param {any} value - The value to set into the property, if found in the source object. - * - * @return {boolean} `true` if the property key was valid and the value was set, otherwise `false`. - */ -var SetValue = function (source, key, value) -{ - if (!source || typeof source === 'number') - { - return false; - } - else if (source.hasOwnProperty(key)) - { - source[key] = value; + /** + * Right stick click (R3) + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.R3 + * @const + * @type {number} + * @since 3.0.0 + */ + R3: 11, - return true; - } - else if (key.indexOf('.') !== -1) - { - var keys = key.split('.'); - var parent = source; - var prev = source; + /** + * Left stick horizontal + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.LEFT_STICK_H + * @const + * @type {number} + * @since 3.0.0 + */ + LEFT_STICK_H: 0, - // Use for loop here so we can break early - for (var i = 0; i < keys.length; i++) - { - if (parent.hasOwnProperty(keys[i])) - { - // Yes it has a key property, let's carry on down - prev = parent; - parent = parent[keys[i]]; - } - else - { - return false; - } - } + /** + * Left stick vertical + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.LEFT_STICK_V + * @const + * @type {number} + * @since 3.0.0 + */ + LEFT_STICK_V: 1, - prev[keys[keys.length - 1]] = value; + /** + * Right stick horizontal + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.RIGHT_STICK_H + * @const + * @type {number} + * @since 3.0.0 + */ + RIGHT_STICK_H: 2, - return true; - } - - return false; -}; + /** + * Right stick vertical + * + * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4.RIGHT_STICK_V + * @const + * @type {number} + * @since 3.0.0 + */ + RIGHT_STICK_V: 3 -module.exports = SetValue; +}; /***/ }), -/* 479 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 43247: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Face = __webpack_require__(116); -var Vertex = __webpack_require__(117); - /** - * Generates a set of Face and Vertex objects by parsing the given data. - * - * This method will take vertex data in one of two formats, based on the `containsZ` parameter. - * - * If your vertex data are `x`, `y` pairs, then `containsZ` should be `false` (this is the default) - * - * If your vertex data is groups of `x`, `y` and `z` values, then the `containsZ` parameter must be true. - * - * The `uvs` parameter is a numeric array consisting of `u` and `v` pairs. - * - * The `normals` parameter is a numeric array consisting of `x`, `y` vertex normal values and, if `containsZ` is true, `z` values as well. - * - * The `indicies` parameter is an optional array that, if given, is an indexed list of vertices to be added. - * - * The `colors` parameter is an optional array, or single value, that if given sets the color of each vertex created. - * - * The `alphas` parameter is an optional array, or single value, that if given sets the alpha of each vertex created. - * - * When providing indexed data it is assumed that _all_ of the arrays are indexed, not just the vertices. - * - * The following example will create a 256 x 256 sized quad using an index array: - * - * ```javascript - * const vertices = [ - * -128, 128, - * 128, 128, - * -128, -128, - * 128, -128 - * ]; - * - * const uvs = [ - * 0, 1, - * 1, 1, - * 0, 0, - * 1, 0 - * ]; - * - * const indices = [ 0, 2, 1, 2, 3, 1 ]; - * - * GenerateVerts(vertices, uvs, indicies); - * ``` - * - * If the data is not indexed, it's assumed that the arrays all contain sequential data. - * - * @function Phaser.Geom.Mesh.GenerateVerts - * @since 3.50.0 - * - * @param {number[]} vertices - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. - * @param {number[]} uvs - The UVs pairs array. - * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. - * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? - * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. - * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. - * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. + * XBox 360 Gamepad Configuration. * - * @return {Phaser.Types.Geom.Mesh.GenerateVertsResult} The parsed Face and Vertex objects. + * @name Phaser.Input.Gamepad.Configs.XBOX_360 + * @namespace + * @since 3.0.0 */ -var GenerateVerts = function (vertices, uvs, indicies, containsZ, normals, colors, alphas) -{ - if (containsZ === undefined) { containsZ = false; } - if (colors === undefined) { colors = 0xffffff; } - if (alphas === undefined) { alphas = 1; } +module.exports = { - if (vertices.length !== uvs.length) - { - console.warn('GenerateVerts: vertices and uvs count not equal'); - return; - } + /** + * D-Pad up + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.UP + * @const + * @type {number} + * @since 3.0.0 + */ + UP: 12, - var result = { - faces: [], - vertices: [] - }; + /** + * D-Pad down + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.DOWN + * @const + * @type {number} + * @since 3.0.0 + */ + DOWN: 13, - var i; + /** + * D-Pad left + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.LEFT + * @const + * @type {number} + * @since 3.0.0 + */ + LEFT: 14, - var x; - var y; - var z; + /** + * D-Pad right + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.RIGHT + * @const + * @type {number} + * @since 3.0.0 + */ + RIGHT: 15, - var u; - var v; + /** + * XBox menu button + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.MENU + * @const + * @type {number} + * @since 3.0.0 + */ + MENU: 16, - var color; - var alpha; + /** + * A button (Bottom) + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.A + * @const + * @type {number} + * @since 3.0.0 + */ + A: 0, - var normalX; - var normalY; - var normalZ; + /** + * B button (Right) + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.B + * @const + * @type {number} + * @since 3.0.0 + */ + B: 1, - var iInc = (containsZ) ? 3 : 2; + /** + * X button (Left) + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.X + * @const + * @type {number} + * @since 3.0.0 + */ + X: 2, - var isColorArray = Array.isArray(colors); - var isAlphaArray = Array.isArray(alphas); + /** + * Y button (Top) + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.Y + * @const + * @type {number} + * @since 3.0.0 + */ + Y: 3, - if (Array.isArray(indicies) && indicies.length > 0) - { - for (i = 0; i < indicies.length; i++) - { - var index1 = indicies[i]; - var index2 = indicies[i] * 2; - var index3 = indicies[i] * iInc; + /** + * Left Bumper + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.LB + * @const + * @type {number} + * @since 3.0.0 + */ + LB: 4, - x = vertices[index3]; - y = vertices[index3 + 1]; - z = (containsZ) ? vertices[index3 + 2] : 0; + /** + * Right Bumper + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.RB + * @const + * @type {number} + * @since 3.0.0 + */ + RB: 5, - u = uvs[index2]; - v = uvs[index2 + 1]; + /** + * Left Trigger + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.LT + * @const + * @type {number} + * @since 3.0.0 + */ + LT: 6, - color = (isColorArray) ? colors[index1] : colors; - alpha = (isAlphaArray) ? alphas[index1] : alphas; + /** + * Right Trigger + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.RT + * @const + * @type {number} + * @since 3.0.0 + */ + RT: 7, - normalX = 0; - normalY = 0; - normalZ = 0; + /** + * Back / Change View button + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.BACK + * @const + * @type {number} + * @since 3.0.0 + */ + BACK: 8, - if (normals) - { - normalX = normals[index3]; - normalY = normals[index3 + 1]; - normalZ = (containsZ) ? normals[index3 + 2] : 0; - } + /** + * Start button + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.START + * @const + * @type {number} + * @since 3.0.0 + */ + START: 9, - result.vertices.push(new Vertex(x, y, z, u, v, color, alpha, normalX, normalY, normalZ)); - } - } - else - { - var uvIndex = 0; - var colorIndex = 0; + /** + * Left Stick press + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.LS + * @const + * @type {number} + * @since 3.0.0 + */ + LS: 10, - for (i = 0; i < vertices.length; i += iInc) - { - x = vertices[i]; - y = vertices[i + 1]; - z = (containsZ) ? vertices[i + 2] : 0; + /** + * Right stick press + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.RS + * @const + * @type {number} + * @since 3.0.0 + */ + RS: 11, - u = uvs[uvIndex]; - v = uvs[uvIndex + 1]; + /** + * Left Stick horizontal + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.LEFT_STICK_H + * @const + * @type {number} + * @since 3.0.0 + */ + LEFT_STICK_H: 0, - color = (isColorArray) ? colors[colorIndex] : colors; - alpha = (isAlphaArray) ? alphas[colorIndex] : alphas; + /** + * Left Stick vertical + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.LEFT_STICK_V + * @const + * @type {number} + * @since 3.0.0 + */ + LEFT_STICK_V: 1, - normalX = 0; - normalY = 0; - normalZ = 0; + /** + * Right Stick horizontal + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.RIGHT_STICK_H + * @const + * @type {number} + * @since 3.0.0 + */ + RIGHT_STICK_H: 2, - if (normals) - { - normalX = normals[i]; - normalY = normals[i + 1]; - normalZ = (containsZ) ? normals[i + 2] : 0; - } + /** + * Right Stick vertical + * + * @name Phaser.Input.Gamepad.Configs.XBOX_360.RIGHT_STICK_V + * @const + * @type {number} + * @since 3.0.0 + */ + RIGHT_STICK_V: 3 - result.vertices.push(new Vertex(x, y, z, u, v, color, alpha, normalX, normalY, normalZ)); +}; - uvIndex += 2; - colorIndex++; - } - } - for (i = 0; i < result.vertices.length; i += 3) - { - var vert1 = result.vertices[i]; - var vert2 = result.vertices[i + 1]; - var vert3 = result.vertices[i + 2]; +/***/ }), - result.faces.push(new Face(vert1, vert2, vert3)); - } +/***/ 4898: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return result; -}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = GenerateVerts; +/** + * @namespace Phaser.Input.Gamepad.Configs + */ + +module.exports = { + + DUALSHOCK_4: __webpack_require__(74982), + SNES_USB: __webpack_require__(33171), + XBOX_360: __webpack_require__(43247) + +}; /***/ }), -/* 480 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 17344: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Face = __webpack_require__(116); -var Matrix4 = __webpack_require__(69); -var Vector3 = __webpack_require__(39); -var Vertex = __webpack_require__(117); - -var tempPosition = new Vector3(); -var tempRotation = new Vector3(); -var tempMatrix = new Matrix4(); - /** - * This method will return an object containing Face and Vertex instances, generated - * from the parsed triangulated OBJ Model data given to this function. - * - * The obj data should have been parsed in advance via the ParseObj function: + * The Gamepad Button Down Event. * - * ```javascript - * var data = Phaser.Geom.Mesh.ParseObj(rawData, flipUV); + * This event is dispatched by the Gamepad Plugin when a button has been pressed on any active Gamepad. * - * var results = GenerateObjVerts(data); - * ``` + * Listen to this event from within a Scene using: `this.input.gamepad.on('down', listener)`. * - * Alternatively, you can parse obj files loaded via the OBJFile loader: + * You can also listen for a DOWN event from a Gamepad instance. See the [GAMEPAD_BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_DOWN} event for details. * - * ```javascript - * preload () - * { - * this.load.obj('alien', 'assets/3d/alien.obj); - * } + * @event Phaser.Input.Gamepad.Events#BUTTON_DOWN + * @type {string} + * @since 3.10.0 * - * var results = GenerateObjVerts(this.cache.obj.get('alien)); - * ``` + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad on which the button was pressed. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. + * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + */ +module.exports = 'down'; + + +/***/ }), + +/***/ 36635: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Gamepad Button Up Event. * - * Make sure your 3D package has triangulated the model data prior to exporting it. + * This event is dispatched by the Gamepad Plugin when a button has been released on any active Gamepad. * - * You can use the data returned by this function to populate the vertices of a Mesh Game Object. + * Listen to this event from within a Scene using: `this.input.gamepad.on('up', listener)`. * - * You may add multiple models to a single Mesh, although they will act as one when - * moved or rotated. You can scale the model data, should it be too small (or large) to visualize. - * You can also offset the model via the `x`, `y` and `z` parameters. + * You can also listen for an UP event from a Gamepad instance. See the [GAMEPAD_BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_UP} event for details. * - * @function Phaser.Geom.Mesh.GenerateObjVerts - * @since 3.50.0 + * @event Phaser.Input.Gamepad.Events#BUTTON_UP + * @type {string} + * @since 3.10.0 * - * @param {Phaser.Types.Geom.Mesh.OBJData} data - The parsed OBJ model data. - * @param {Phaser.GameObjects.Mesh} [mesh] - An optional Mesh Game Object. If given, the generated Faces will be automatically added to this Mesh. Set to `null` to skip. - * @param {number} [scale=1] - An amount to scale the model data by. Use this if the model has exported too small, or large, to see. - * @param {number} [x=0] - Translate the model x position by this amount. - * @param {number} [y=0] - Translate the model y position by this amount. - * @param {number} [z=0] - Translate the model z position by this amount. - * @param {number} [rotateX=0] - Rotate the model on the x axis by this amount, in radians. - * @param {number} [rotateY=0] - Rotate the model on the y axis by this amount, in radians. - * @param {number} [rotateZ=0] - Rotate the model on the z axis by this amount, in radians. - * @param {boolean} [zIsUp=true] - Is the z axis up (true), or is y axis up (false)? - * - * @return {Phaser.Types.Geom.Mesh.GenerateVertsResult} The parsed Face and Vertex objects. + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad on which the button was released. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. + * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. */ -var GenerateObjVerts = function (data, mesh, scale, x, y, z, rotateX, rotateY, rotateZ, zIsUp) -{ - if (scale === undefined) { scale = 1; } - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (z === undefined) { z = 0; } - if (rotateX === undefined) { rotateX = 0; } - if (rotateY === undefined) { rotateY = 0; } - if (rotateZ === undefined) { rotateZ = 0; } - if (zIsUp === undefined) { zIsUp = true; } - - var result = { - faces: [], - verts: [] - }; - - var materials = data.materials; +module.exports = 'up'; - tempPosition.set(x, y, z); - tempRotation.set(rotateX, rotateY, rotateZ); - tempMatrix.fromRotationXYTranslation(tempRotation, tempPosition, zIsUp); - for (var m = 0; m < data.models.length; m++) - { - var model = data.models[m]; +/***/ }), - var vertices = model.vertices; - var textureCoords = model.textureCoords; - var faces = model.faces; +/***/ 85724: +/***/ ((module) => { - for (var i = 0; i < faces.length; i++) - { - var face = faces[i]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var v1 = face.vertices[0]; - var v2 = face.vertices[1]; - var v3 = face.vertices[2]; +/** + * The Gamepad Connected Event. + * + * This event is dispatched by the Gamepad Plugin when a Gamepad has been connected. + * + * Listen to this event from within a Scene using: `this.input.gamepad.once('connected', listener)`. + * + * Note that the browser may require you to press a button on a gamepad before it will allow you to access it, + * this is for security reasons. However, it may also trust the page already, in which case you won't get the + * 'connected' event and instead should check `GamepadPlugin.total` to see if it thinks there are any gamepads + * already connected. + * + * @event Phaser.Input.Gamepad.Events#CONNECTED + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad which was connected. + * @param {Event} event - The native DOM Event that triggered the connection. + */ +module.exports = 'connected'; - var m1 = vertices[v1.vertexIndex]; - var m2 = vertices[v2.vertexIndex]; - var m3 = vertices[v3.vertexIndex]; - var t1 = v1.textureCoordsIndex; - var t2 = v2.textureCoordsIndex; - var t3 = v3.textureCoordsIndex; +/***/ }), - var uv1 = (t1 === -1) ? { u: 0, v: 1 } : textureCoords[t1]; - var uv2 = (t2 === -1) ? { u: 0, v: 0 } : textureCoords[t2]; - var uv3 = (t3 === -1) ? { u: 1, v: 1 } : textureCoords[t3]; +/***/ 55832: +/***/ ((module) => { - var color = 0xffffff; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (face.material !== '' && materials[face.material]) - { - color = materials[face.material]; - } +/** + * The Gamepad Disconnected Event. + * + * This event is dispatched by the Gamepad Plugin when a Gamepad has been disconnected. + * + * Listen to this event from within a Scene using: `this.input.gamepad.once('disconnected', listener)`. + * + * @event Phaser.Input.Gamepad.Events#DISCONNECTED + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad which was disconnected. + * @param {Event} event - The native DOM Event that triggered the disconnection. + */ +module.exports = 'disconnected'; - var vert1 = new Vertex(m1.x * scale, m1.y * scale, m1.z * scale, uv1.u, uv1.v, color).transformMat4(tempMatrix); - var vert2 = new Vertex(m2.x * scale, m2.y * scale, m2.z * scale, uv2.u, uv2.v, color).transformMat4(tempMatrix); - var vert3 = new Vertex(m3.x * scale, m3.y * scale, m3.z * scale, uv3.u, uv3.v, color).transformMat4(tempMatrix); - result.verts.push(vert1, vert2, vert3); - result.faces.push(new Face(vert1, vert2, vert3)); - } - } +/***/ }), - if (mesh) - { - mesh.faces = mesh.faces.concat(result.faces); - mesh.vertices = mesh.vertices.concat(result.verts); - } +/***/ 772: +/***/ ((module) => { - return result; -}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = GenerateObjVerts; +/** + * The Gamepad Button Down Event. + * + * This event is dispatched by a Gamepad instance when a button has been pressed on it. + * + * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin: + * `this.input.gamepad.pad1.on('down', listener)`. + * + * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'. + * + * You can also listen for a DOWN event from the Gamepad Plugin. See the [BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_DOWN} event for details. + * + * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN + * @type {string} + * @since 3.10.0 + * + * @param {number} index - The index of the button that was pressed. + * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. + */ +module.exports = 'down'; /***/ }), -/* 481 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 33608: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circle = __webpack_require__(65); -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var RGB = __webpack_require__(200); -var Utils = __webpack_require__(12); - /** - * @classdesc - * A 2D point light. + * The Gamepad Button Up Event. * - * These are typically created by a {@link Phaser.GameObjects.LightsManager}, available from within a scene via `this.lights`. + * This event is dispatched by a Gamepad instance when a button has been released on it. * - * Any Game Objects using the Light2D pipeline will then be affected by these Lights as long as they have a normal map. + * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin: + * `this.input.gamepad.pad1.on('up', listener)`. * - * They can also simply be used to represent a point light for your own purposes. + * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'. * - * @class Light - * @extends Phaser.Geom.Circle - * @memberof Phaser.GameObjects - * @constructor - * @since 3.0.0 + * You can also listen for an UP event from the Gamepad Plugin. See the [BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_UP} event for details. * - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Visible + * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP + * @type {string} + * @since 3.10.0 * - * @param {number} x - The horizontal position of the light. - * @param {number} y - The vertical position of the light. - * @param {number} radius - The radius of the light. - * @param {number} r - The red color of the light. A value between 0 and 1. - * @param {number} g - The green color of the light. A value between 0 and 1. - * @param {number} b - The blue color of the light. A value between 0 and 1. - * @param {number} intensity - The intensity of the light. + * @param {number} index - The index of the button that was released. + * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. + * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. */ -var Light = new Class({ +module.exports = 'up'; - Extends: Circle, - Mixins: [ - Components.ScrollFactor, - Components.Visible - ], +/***/ }), - initialize: +/***/ 43200: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - function Light (x, y, radius, r, g, b, intensity) - { - Circle.call(this, x, y, radius); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The color of the light. - * - * @name Phaser.GameObjects.Light#color - * @type {Phaser.Display.RGB} - * @since 3.50.0 - */ - this.color = new RGB(r, g, b); +/** + * @namespace Phaser.Input.Gamepad.Events + */ - /** - * The intensity of the light. - * - * @name Phaser.GameObjects.Light#intensity - * @type {number} - * @since 3.50.0 - */ - this.intensity = intensity; +module.exports = { - /** - * The flags that are compared against `RENDER_MASK` to determine if this Game Object will render or not. - * The bits are 0001 | 0010 | 0100 | 1000 set by the components Visible, Alpha, Transform and Texture respectively. - * If those components are not used by your custom class then you can use this bitmask as you wish. - * - * @name Phaser.GameObjects.GameObject#renderFlags - * @type {number} - * @default 15 - * @since 3.0.0 - */ - this.renderFlags = 15; + BUTTON_DOWN: __webpack_require__(17344), + BUTTON_UP: __webpack_require__(36635), + CONNECTED: __webpack_require__(85724), + DISCONNECTED: __webpack_require__(55832), + GAMEPAD_BUTTON_DOWN: __webpack_require__(772), + GAMEPAD_BUTTON_UP: __webpack_require__(33608) - /** - * A bitmask that controls if this Game Object is drawn by a Camera or not. - * Not usually set directly, instead call `Camera.ignore`, however you can - * set this property directly using the Camera.id property: - * - * @example - * this.cameraFilter |= camera.id - * - * @name Phaser.GameObjects.GameObject#cameraFilter - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.cameraFilter = 0; +}; - this.setScrollFactor(1, 1); - }, - /** - * Compares the renderMask with the renderFlags to see if this Game Object will render or not. - * Also checks the Game Object against the given Cameras exclusion list. - * - * @method Phaser.GameObjects.Light#willRender - * @since 3.50.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against this Game Object. - * - * @return {boolean} True if the Game Object should be rendered, otherwise false. - */ - willRender: function (camera) - { - return !(Light.RENDER_MASK !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id))); - }, +/***/ }), - /** - * Set the color of the light from a single integer RGB value. - * - * @method Phaser.GameObjects.Light#setColor - * @since 3.0.0 - * - * @param {number} rgb - The integer RGB color of the light. - * - * @return {this} This Light object. - */ - setColor: function (rgb) - { - var color = Utils.getFloatsFromUintRGB(rgb); +/***/ 92636: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.color.set(color[0], color[1], color[2]); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +/** + * @namespace Phaser.Input.Gamepad + */ - /** - * Set the intensity of the light. - * - * @method Phaser.GameObjects.Light#setIntensity - * @since 3.0.0 - * - * @param {number} intensity - The intensity of the light. - * - * @return {this} This Light object. - */ - setIntensity: function (intensity) - { - this.intensity = intensity; +module.exports = { - return this; - }, + Axis: __webpack_require__(70848), + Button: __webpack_require__(21274), + Events: __webpack_require__(43200), + Gamepad: __webpack_require__(75956), + GamepadPlugin: __webpack_require__(1379), - /** - * Set the radius of the light. - * - * @method Phaser.GameObjects.Light#setRadius - * @since 3.0.0 - * - * @param {number} radius - The radius of the light. - * - * @return {this} This Light object. - */ - setRadius: function (radius) - { - this.radius = radius; + Configs: __webpack_require__(4898) +}; - return this; - } -}); +/***/ }), + +/***/ 20873: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * The bitmask that `GameObject.renderFlags` is compared against to determine if the Game Object will render or not. - * - * @constant {number} RENDER_MASK - * @memberof Phaser.GameObjects.Light - * @default + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -Light.RENDER_MASK = 15; -module.exports = Light; +var CONST = __webpack_require__(72687); +var Extend = __webpack_require__(98611); + +/** + * @namespace Phaser.Input + */ + +var Input = { + + CreatePixelPerfectHandler: __webpack_require__(18104), + CreateInteractiveObject: __webpack_require__(27395), + Events: __webpack_require__(33963), + Gamepad: __webpack_require__(92636), + InputManager: __webpack_require__(69898), + InputPlugin: __webpack_require__(12499), + InputPluginCache: __webpack_require__(63399), + Keyboard: __webpack_require__(28388), + Mouse: __webpack_require__(11343), + Pointer: __webpack_require__(40398), + Touch: __webpack_require__(77423) + +}; + +// Merge in the consts +Input = Extend(false, Input, CONST); + +module.exports = Input; /***/ }), -/* 482 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 71064: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CircleToRectangle = __webpack_require__(151); -var Class = __webpack_require__(0); -var DistanceBetween = __webpack_require__(50); -var Light = __webpack_require__(481); -var PointLight = __webpack_require__(150); -var RGB = __webpack_require__(200); -var SpliceOne = __webpack_require__(74); -var StableSort = __webpack_require__(79); -var Utils = __webpack_require__(12); - -/** - * @callback LightForEach - * - * @param {Phaser.GameObjects.Light} light - The Light. - */ +var ArrayRemove = __webpack_require__(66458); +var Class = __webpack_require__(56694); +var GameEvents = __webpack_require__(97081); +var InputEvents = __webpack_require__(33963); +var KeyCodes = __webpack_require__(11873); +var NOOP = __webpack_require__(72283); /** * @classdesc - * Manages Lights for a Scene. + * The Keyboard Manager is a helper class that belongs to the global Input Manager. * - * Affects the rendering of Game Objects using the `Light2D` pipeline. + * Its role is to listen for native DOM Keyboard Events and then store them for further processing by the Keyboard Plugin. * - * @class LightsManager - * @memberof Phaser.GameObjects + * You do not need to create this class directly, the Input Manager will create an instance of it automatically if keyboard + * input has been enabled in the Game Config. + * + * @class KeyboardManager + * @memberof Phaser.Input.Keyboard * @constructor - * @since 3.0.0 + * @since 3.16.0 + * + * @param {Phaser.Input.InputManager} inputManager - A reference to the Input Manager. */ -var LightsManager = new Class({ +var KeyboardManager = new Class({ initialize: - function LightsManager () + function KeyboardManager (inputManager) { /** - * The Lights in the Scene. + * A reference to the Input Manager. * - * @name Phaser.GameObjects.LightsManager#lights - * @type {Phaser.GameObjects.Light[]} - * @default [] - * @since 3.0.0 + * @name Phaser.Input.Keyboard.KeyboardManager#manager + * @type {Phaser.Input.InputManager} + * @since 3.16.0 */ - this.lights = []; + this.manager = inputManager; /** - * The ambient color. + * An internal event queue. * - * @name Phaser.GameObjects.LightsManager#ambientColor - * @type {Phaser.Display.RGB} - * @since 3.50.0 + * @name Phaser.Input.Keyboard.KeyboardManager#queue + * @type {KeyboardEvent[]} + * @private + * @since 3.16.0 */ - this.ambientColor = new RGB(0.1, 0.1, 0.1); + this.queue = []; /** - * Whether the Lights Manager is enabled. + * A flag that controls if the non-modified keys, matching those stored in the `captures` array, + * have `preventDefault` called on them or not. * - * @name Phaser.GameObjects.LightsManager#active + * A non-modified key is one that doesn't have a modifier key held down with it. The modifier keys are + * shift, control, alt and the meta key (Command on a Mac, the Windows Key on Windows). + * Therefore, if the user presses shift + r, it won't prevent this combination, because of the modifier. + * However, if the user presses just the r key on its own, it will have its event prevented. + * + * If you wish to stop capturing the keys, for example switching out to a DOM based element, then + * you can toggle this property at run-time. + * + * @name Phaser.Input.Keyboard.KeyboardManager#preventDefault + * @type {boolean} + * @since 3.16.0 + */ + this.preventDefault = true; + + /** + * An array of Key Code values that will automatically have `preventDefault` called on them, + * as long as the `KeyboardManager.preventDefault` boolean is set to `true`. + * + * By default the array is empty. + * + * The key must be non-modified when pressed in order to be captured. + * + * A non-modified key is one that doesn't have a modifier key held down with it. The modifier keys are + * shift, control, alt and the meta key (Command on a Mac, the Windows Key on Windows). + * Therefore, if the user presses shift + r, it won't prevent this combination, because of the modifier. + * However, if the user presses just the r key on its own, it will have its event prevented. + * + * If you wish to stop capturing the keys, for example switching out to a DOM based element, then + * you can toggle the `KeyboardManager.preventDefault` boolean at run-time. + * + * If you need more specific control, you can create Key objects and set the flag on each of those instead. + * + * This array can be populated via the Game Config by setting the `input.keyboard.capture` array, or you + * can call the `addCapture` method. See also `removeCapture` and `clearCaptures`. + * + * @name Phaser.Input.Keyboard.KeyboardManager#captures + * @type {number[]} + * @since 3.16.0 + */ + this.captures = []; + + /** + * A boolean that controls if the Keyboard Manager is enabled or not. + * Can be toggled on the fly. + * + * @name Phaser.Input.Keyboard.KeyboardManager#enabled * @type {boolean} * @default false - * @since 3.0.0 + * @since 3.16.0 */ - this.active = false; + this.enabled = false; /** - * The maximum number of lights that a single Camera and the lights shader can process. - * Change this via the `maxLights` property in your game config, as it cannot be changed at runtime. + * The Keyboard Event target, as defined in the Game Config. + * Typically the window in which the game is rendering, but can be any interactive DOM element. * - * @name Phaser.GameObjects.LightsManager#maxLights - * @type {number} - * @readonly - * @since 3.15.0 + * @name Phaser.Input.Keyboard.KeyboardManager#target + * @type {any} + * @since 3.16.0 */ - this.maxLights = -1; + this.target; /** - * The number of lights that the LightPipeline processed in the _previous_ frame. + * The Key Down Event handler. + * This function is sent the native DOM KeyEvent. + * Initially empty and bound in the `startListeners` method. * - * @name Phaser.GameObjects.LightsManager#visibleLights - * @type {number} - * @readonly - * @since 3.50.0 + * @name Phaser.Input.Keyboard.KeyboardManager#onKeyDown + * @type {function} + * @since 3.16.00 */ - this.visibleLights = 0; - }, + this.onKeyDown = NOOP; - /** - * Creates a new Point Light Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Point Light Game Object has been built into Phaser. - * - * The Point Light Game Object provides a way to add a point light effect into your game, - * without the expensive shader processing requirements of the traditional Light Game Object. - * - * The difference is that the Point Light renders using a custom shader, designed to give the - * impression of a point light source, of variable radius, intensity and color, in your game. - * However, unlike the Light Game Object, it does not impact any other Game Objects, or use their - * normal maps for calcuations. This makes them extremely fast to render compared to Lights - * and perfect for special effects, such as flickering torches or muzzle flashes. - * - * For maximum performance you should batch Point Light Game Objects together. This means - * ensuring they follow each other consecutively on the display list. Ideally, use a Layer - * Game Object and then add just Point Lights to it, so that it can batch together the rendering - * of the lights. You don't _have_ to do this, and if you've only a handful of Point Lights in - * your game then it's perfectly safe to mix them into the dislay list as normal. However, if - * you're using a large number of them, please consider how they are mixed into the display list. - * - * The renderer will automatically cull Point Lights. Those with a radius that does not intersect - * with the Camera will be skipped in the rendering list. This happens automatically and the - * culled state is refreshed every frame, for every camera. - * - * The origin of a Point Light is always 0.5 and it cannot be changed. - * - * Point Lights are a WebGL only feature and do not have a Canvas counterpart. - * - * @method Phaser.GameObjects.LightsManager#addPointLight - * @since 3.50.0 - * - * @param {number} x - The horizontal position of this Point Light in the world. - * @param {number} y - The vertical position of this Point Light in the world. - * @param {number} [color=0xffffff] - The color of the Point Light, given as a hex value. - * @param {number} [radius=128] - The radius of the Point Light. - * @param {number} [intensity=1] - The intensity, or colr blend, of the Point Light. - * @param {number} [attenuation=0.1] - The attenuation of the Point Light. This is the reduction of light from the center point. - * - * @return {Phaser.GameObjects.PointLight} The Game Object that was created. - */ - addPointLight: function (x, y, color, radius, intensity, attenuation) - { - return this.systems.displayList.add(new PointLight(this.scene, x, y, color, radius, intensity, attenuation)); + /** + * The Key Up Event handler. + * This function is sent the native DOM KeyEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Keyboard.KeyboardManager#onKeyUp + * @type {function} + * @since 3.16.00 + */ + this.onKeyUp = NOOP; + + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, /** - * Enable the Lights Manager. - * - * @method Phaser.GameObjects.LightsManager#enable - * @since 3.0.0 + * The Keyboard Manager boot process. * - * @return {this} This Lights Manager instance. + * @method Phaser.Input.Keyboard.KeyboardManager#boot + * @private + * @since 3.16.0 */ - enable: function () + boot: function () { - if (this.maxLights === -1) + var config = this.manager.config; + + this.enabled = config.inputKeyboard; + this.target = config.inputKeyboardEventTarget; + + this.addCapture(config.inputKeyboardCapture); + + if (!this.target && window) { - this.maxLights = this.systems.renderer.config.maxLights; + this.target = window; } - this.active = true; + if (this.enabled && this.target) + { + this.startListeners(); + } - return this; + this.manager.game.events.on(GameEvents.POST_STEP, this.postUpdate, this); }, /** - * Disable the Lights Manager. - * - * @method Phaser.GameObjects.LightsManager#disable - * @since 3.0.0 + * Starts the Keyboard Event listeners running. + * This is called automatically and does not need to be manually invoked. * - * @return {this} This Lights Manager instance. + * @method Phaser.Input.Keyboard.KeyboardManager#startListeners + * @since 3.16.0 */ - disable: function () + startListeners: function () { - this.active = false; + var _this = this; - return this; - }, + this.onKeyDown = function (event) + { + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } - /** - * Get all lights that can be seen by the given Camera. - * - * It will automatically cull lights that are outside the world view of the Camera. - * - * If more lights are returned than supported by the pipeline, the lights are then culled - * based on the distance from the center of the camera. Only those closest are rendered. - * - * @method Phaser.GameObjects.LightsManager#getLights - * @since 3.50.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to cull Lights for. - * - * @return {Phaser.GameObjects.Light[]} The culled Lights. - */ - getLights: function (camera) - { - var lights = this.lights; - var worldView = camera.worldView; + _this.queue.push(event); - var visibleLights = []; + _this.manager.events.emit(InputEvents.MANAGER_PROCESS); - for (var i = 0; i < lights.length; i++) - { - var light = lights[i]; + var modified = (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey); - if (light.willRender(camera) && CircleToRectangle(light, worldView)) + if (_this.preventDefault && !modified && _this.captures.indexOf(event.keyCode) > -1) { - visibleLights.push({ - light: light, - distance: DistanceBetween(light.x, light.y, worldView.centerX, worldView.centerY) - }); + event.preventDefault(); } - } + }; - if (visibleLights.length > this.maxLights) + this.onKeyUp = function (event) { - // We've got too many lights, so sort by distance from camera and cull those far away - // This isn't ideal because it doesn't factor in the radius of the lights, but it'll do for now - // and is significantly better than we had before! + if (event.defaultPrevented || !_this.enabled || !_this.manager) + { + // Do nothing if event already handled + return; + } - StableSort(visibleLights, this.sortByDistance); + _this.queue.push(event); - visibleLights = visibleLights.slice(0, this.maxLights); - } + _this.manager.events.emit(InputEvents.MANAGER_PROCESS); - this.visibleLights = visibleLights.length; + var modified = (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey); - return visibleLights; - }, + if (_this.preventDefault && !modified && _this.captures.indexOf(event.keyCode) > -1) + { + event.preventDefault(); + } + }; - sortByDistance: function (a, b) - { - return (a.distance >= b.distance); + var target = this.target; + + if (target) + { + target.addEventListener('keydown', this.onKeyDown, false); + target.addEventListener('keyup', this.onKeyUp, false); + + this.enabled = true; + } }, /** - * Set the ambient light color. - * - * @method Phaser.GameObjects.LightsManager#setAmbientColor - * @since 3.0.0 - * - * @param {number} rgb - The integer RGB color of the ambient light. + * Stops the Key Event listeners. + * This is called automatically and does not need to be manually invoked. * - * @return {this} This Lights Manager instance. + * @method Phaser.Input.Keyboard.KeyboardManager#stopListeners + * @since 3.16.0 */ - setAmbientColor: function (rgb) + stopListeners: function () { - var color = Utils.getFloatsFromUintRGB(rgb); + var target = this.target; - this.ambientColor.set(color[0], color[1], color[2]); + target.removeEventListener('keydown', this.onKeyDown, false); + target.removeEventListener('keyup', this.onKeyUp, false); - return this; + this.enabled = false; }, /** - * Returns the maximum number of Lights allowed to appear at once. - * - * @method Phaser.GameObjects.LightsManager#getMaxVisibleLights - * @since 3.0.0 + * Clears the event queue. + * Called automatically by the Input Manager. * - * @return {number} The maximum number of Lights allowed to appear at once. + * @method Phaser.Input.Keyboard.KeyboardManager#postUpdate + * @private + * @since 3.16.0 */ - getMaxVisibleLights: function () + postUpdate: function () { - return this.maxLights; + this.queue = []; }, /** - * Get the number of Lights managed by this Lights Manager. + * By default when a key is pressed Phaser will not stop the event from propagating up to the browser. + * There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll. * - * @method Phaser.GameObjects.LightsManager#getLightCount - * @since 3.0.0 + * This `addCapture` method enables consuming keyboard event for specific keys so it doesn't bubble up to the the browser + * and cause the default browser behavior. * - * @return {number} The number of Lights managed by this Lights Manager. - */ - getLightCount: function () - { - return this.lights.length; - }, - - /** - * Add a Light. + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to say prevent + * the SPACE BAR from triggering a page scroll, then it will prevent it for any Scene in your game, not just the calling one. * - * @method Phaser.GameObjects.LightsManager#addLight - * @since 3.0.0 + * You can pass in a single key code value, or an array of key codes, or a string: * - * @param {number} [x=0] - The horizontal position of the Light. - * @param {number} [y=0] - The vertical position of the Light. - * @param {number} [radius=128] - The radius of the Light. - * @param {number} [rgb=0xffffff] - The integer RGB color of the light. - * @param {number} [intensity=1] - The intensity of the Light. + * ```javascript + * this.input.keyboard.addCapture(62); + * ``` * - * @return {Phaser.GameObjects.Light} The Light that was added. + * An array of key codes: + * + * ```javascript + * this.input.keyboard.addCapture([ 62, 63, 64 ]); + * ``` + * + * Or a string: + * + * ```javascript + * this.input.keyboard.addCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * If there are active captures after calling this method, the `preventDefault` property is set to `true`. + * + * @method Phaser.Input.Keyboard.KeyboardManager#addCapture + * @since 3.16.0 + * + * @param {(string|number|number[]|any[])} keycode - The Key Codes to enable capture for, preventing them reaching the browser. */ - addLight: function (x, y, radius, rgb, intensity) + addCapture: function (keycode) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (radius === undefined) { radius = 128; } - if (rgb === undefined) { rgb = 0xffffff; } - if (intensity === undefined) { intensity = 1; } + if (typeof keycode === 'string') + { + keycode = keycode.split(','); + } - var color = Utils.getFloatsFromUintRGB(rgb); + if (!Array.isArray(keycode)) + { + keycode = [ keycode ]; + } - var light = new Light(x, y, radius, color[0], color[1], color[2], intensity); + var captures = this.captures; - this.lights.push(light); + for (var i = 0; i < keycode.length; i++) + { + var code = keycode[i]; - return light; + if (typeof code === 'string') + { + code = KeyCodes[code.trim().toUpperCase()]; + } + + if (captures.indexOf(code) === -1) + { + captures.push(code); + } + } + + this.preventDefault = captures.length > 0; }, /** - * Remove a Light. + * Removes an existing key capture. * - * @method Phaser.GameObjects.LightsManager#removeLight - * @since 3.0.0 + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to remove + * the capture of a key, then it will remove it for any Scene in your game, not just the calling one. * - * @param {Phaser.GameObjects.Light} light - The Light to remove. + * You can pass in a single key code value, or an array of key codes, or a string: * - * @return {this} This Lights Manager instance. + * ```javascript + * this.input.keyboard.removeCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.removeCapture([ 62, 63, 64 ]); + * ``` + * + * Or a string: + * + * ```javascript + * this.input.keyboard.removeCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * If there are no captures left after calling this method, the `preventDefault` property is set to `false`. + * + * @method Phaser.Input.Keyboard.KeyboardManager#removeCapture + * @since 3.16.0 + * + * @param {(string|number|number[]|any[])} keycode - The Key Codes to disable capture for, allowing them reaching the browser again. */ - removeLight: function (light) + removeCapture: function (keycode) { - var index = this.lights.indexOf(light); + if (typeof keycode === 'string') + { + keycode = keycode.split(','); + } - if (index >= 0) + if (!Array.isArray(keycode)) { - SpliceOne(this.lights, index); + keycode = [ keycode ]; } - return this; + var captures = this.captures; + + for (var i = 0; i < keycode.length; i++) + { + var code = keycode[i]; + + if (typeof code === 'string') + { + code = KeyCodes[code.toUpperCase()]; + } + + ArrayRemove(captures, code); + } + + this.preventDefault = captures.length > 0; }, /** - * Shut down the Lights Manager. - * - * Recycles all active Lights into the Light pool, resets ambient light color and clears the lists of Lights and - * culled Lights. + * Removes all keyboard captures and sets the `preventDefault` property to `false`. * - * @method Phaser.GameObjects.LightsManager#shutdown - * @since 3.0.0 + * @method Phaser.Input.Keyboard.KeyboardManager#clearCaptures + * @since 3.16.0 */ - shutdown: function () + clearCaptures: function () { - this.lights.length = 0; + this.captures = []; + + this.preventDefault = false; }, /** - * Destroy the Lights Manager. - * - * Cleans up all references by calling {@link Phaser.GameObjects.LightsManager#shutdown}. + * Destroys this Keyboard Manager instance. * - * @method Phaser.GameObjects.LightsManager#destroy - * @since 3.0.0 + * @method Phaser.Input.Keyboard.KeyboardManager#destroy + * @since 3.16.0 */ destroy: function () { - this.shutdown(); - } - -}); - -module.exports = LightsManager; - - -/***/ }), -/* 483 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CONST = __webpack_require__(56); -var Extend = __webpack_require__(17); + this.stopListeners(); -/** - * @namespace Phaser.Geom - */ + this.clearCaptures(); -var Geom = { + this.queue = []; - Circle: __webpack_require__(1191), - Ellipse: __webpack_require__(1201), - Intersects: __webpack_require__(484), - Line: __webpack_require__(1221), - Mesh: __webpack_require__(1243), - Point: __webpack_require__(1246), - Polygon: __webpack_require__(1260), - Rectangle: __webpack_require__(502), - Triangle: __webpack_require__(1293) + this.manager.game.events.off(GameEvents.POST_RENDER, this.postUpdate, this); -}; + this.target = null; + this.enabled = false; + this.manager = null; + } -// Merge in the consts -Geom = Extend(false, Geom, CONST); +}); -module.exports = Geom; +module.exports = KeyboardManager; /***/ }), -/* 484 */ -/***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Geom.Intersects - */ - -module.exports = { - - CircleToCircle: __webpack_require__(231), - CircleToRectangle: __webpack_require__(151), - GetCircleToCircle: __webpack_require__(1211), - GetCircleToRectangle: __webpack_require__(1212), - GetLineToCircle: __webpack_require__(232), - GetLineToLine: __webpack_require__(485), - GetLineToPoints: __webpack_require__(486), - GetLineToPolygon: __webpack_require__(487), - GetLineToRectangle: __webpack_require__(234), - GetRaysFromPointToPolygon: __webpack_require__(1213), - GetRectangleIntersection: __webpack_require__(1214), - GetRectangleToRectangle: __webpack_require__(1215), - GetRectangleToTriangle: __webpack_require__(1216), - GetTriangleToCircle: __webpack_require__(1217), - GetTriangleToLine: __webpack_require__(492), - GetTriangleToTriangle: __webpack_require__(1218), - LineToCircle: __webpack_require__(233), - LineToLine: __webpack_require__(96), - LineToRectangle: __webpack_require__(488), - PointToLine: __webpack_require__(496), - PointToLineSegment: __webpack_require__(1219), - RectangleToRectangle: __webpack_require__(152), - RectangleToTriangle: __webpack_require__(489), - RectangleToValues: __webpack_require__(1220), - TriangleToCircle: __webpack_require__(491), - TriangleToLine: __webpack_require__(493), - TriangleToTriangle: __webpack_require__(494) - -}; - - -/***/ }), -/* 485 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ 89666: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector3 = __webpack_require__(39); +var Class = __webpack_require__(56694); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(94030); +var GameEvents = __webpack_require__(97081); +var GetValue = __webpack_require__(10850); +var InputEvents = __webpack_require__(33963); +var InputPluginCache = __webpack_require__(63399); +var Key = __webpack_require__(50165); +var KeyCodes = __webpack_require__(11873); +var KeyCombo = __webpack_require__(95625); +var KeyMap = __webpack_require__(48044); +var SceneEvents = __webpack_require__(7599); +var SnapFloor = __webpack_require__(84314); /** - * Checks for intersection between the two line segments and returns the intersection point as a Vector3, - * or `null` if the lines are parallel, or do not intersect. + * @classdesc + * The Keyboard Plugin is an input plugin that belongs to the Scene-owned Input system. * - * The `z` property of the Vector3 contains the intersection distance, which can be used to find - * the closest intersecting point from a group of line segments. + * Its role is to listen for native DOM Keyboard Events and then process them. * - * @function Phaser.Geom.Intersects.GetLineToLine - * @since 3.50.0 + * You do not need to create this class directly, the Input system will create an instance of it automatically. * - * @param {Phaser.Geom.Line} line1 - The first line segment to check. - * @param {Phaser.Geom.Line} line2 - The second line segment to check. - * @param {Phaser.Math.Vector3} [out] - A Vector3 to store the intersection results in. + * You can access it from within a Scene using `this.input.keyboard`. For example, you can do: * - * @return {Phaser.Math.Vector3} A Vector3 containing the intersection results, or `null`. - */ -var GetLineToLine = function (line1, line2, out) -{ - var x1 = line1.x1; - var y1 = line1.y1; - var x2 = line1.x2; - var y2 = line1.y2; - - var x3 = line2.x1; - var y3 = line2.y1; - var x4 = line2.x2; - var y4 = line2.y2; - - var dx1 = x2 - x1; - var dy1 = y2 - y1; - - var dx2 = x4 - x3; - var dy2 = y4 - y3; - - var denom = dy2 * dx1 - dx2 * dy1; - - // Make sure there is not a division by zero - this also indicates that the lines are parallel. - // If numA and numB were both equal to zero the lines would be on top of each other (coincidental). - // This check is not done because it is not necessary for this implementation (the parallel check accounts for this). - - if (dx1 === 0 || denom === 0) - { - return false; - } - - var T2 = (dx1 * (y3 - y1) + dy1 * (x1 - x3)) / (dx2 * dy1 - dy2 * dx1); - var T1 = (x3 + dx2 * T2 - x1) / dx1; - - // Intersects? - if (T1 < 0 || T2 < 0 || T2 > 1) - { - return null; - } - - if (out === undefined) - { - out = new Vector3(); - } - - return out.set( - x1 + dx1 * T1, - y1 + dy1 * T1, - T1 - ); -}; - -module.exports = GetLineToLine; - - -/***/ }), -/* 486 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Vector3 = __webpack_require__(39); -var GetLineToLine = __webpack_require__(485); -var Line = __webpack_require__(47); - -// Temp calculation segment -var segment = new Line(); - -// Temp vec3 -var tempIntersect = new Vector3(); - -/** - * Checks for the closest point of intersection between a line segment and an array of points, where each pair - * of points are converted to line segments for the intersection tests. + * ```javascript + * this.input.keyboard.on('keydown', callback, context); + * ``` * - * If no intersection is found, this function returns `null`. + * Or, to listen for a specific key: * - * If intersection was found, a Vector3 is returned with the following properties: + * ```javascript + * this.input.keyboard.on('keydown-A', callback, context); + * ``` * - * The `x` and `y` components contain the point of the intersection. - * The `z` component contains the closest distance. + * You can also create Key objects, which you can then poll in your game loop: * - * @function Phaser.Geom.Intersects.GetLineToPoints - * @since 3.50.0 + * ```javascript + * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); + * ``` * - * @param {Phaser.Geom.Line} line - The line segment to check. - * @param {Phaser.Math.Vector2[] | Phaser.Geom.Point[]} points - An array of points to check. - * @param {Phaser.Math.Vector3} [out] - A Vector3 to store the intersection results in. + * If you have multiple parallel Scenes, each trying to get keyboard input, be sure to disable capture on them to stop them from + * stealing input from another Scene in the list. You can do this with `this.input.keyboard.enabled = false` within the + * Scene to stop all input, or `this.input.keyboard.preventDefault = false` to stop a Scene halting input on another Scene. * - * @return {Phaser.Math.Vector3} A Vector3 containing the intersection results, or `null`. + * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. + * See http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/ for more details + * and use the site https://w3c.github.io/uievents/tools/key-event-viewer.html to test your n-key support in browser. + * + * Also please be aware that certain browser extensions can disable or override Phaser keyboard handling. + * For example the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. + * And there are others. So, please check your extensions before opening Phaser issues about keys that don't work. + * + * @class KeyboardPlugin + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Input.Keyboard + * @constructor + * @since 3.10.0 + * + * @param {Phaser.Input.InputPlugin} sceneInputPlugin - A reference to the Scene Input Plugin that the KeyboardPlugin belongs to. */ -var GetLineToPoints = function (line, points, out) -{ - if (out === undefined) { out = new Vector3(); } - - var closestIntersect = false; +var KeyboardPlugin = new Class({ - // Reset our vec3s - out.set(); - tempIntersect.set(); + Extends: EventEmitter, - var prev = points[0]; + initialize: - for (var i = 1; i < points.length; i++) + function KeyboardPlugin (sceneInputPlugin) { - var current = points[i]; - - segment.setTo(prev.x, prev.y, current.x, current.y); - - prev = current; + EventEmitter.call(this); - if (GetLineToLine(line, segment, tempIntersect)) - { - if (!closestIntersect || tempIntersect.z < out.z) - { - out.copy(tempIntersect); + /** + * A reference to the core game, so we can listen for visibility events. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#game + * @type {Phaser.Game} + * @since 3.16.0 + */ + this.game = sceneInputPlugin.systems.game; - closestIntersect = true; - } + /** + * A reference to the Scene that this Input Plugin is responsible for. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#scene + * @type {Phaser.Scene} + * @since 3.10.0 + */ + this.scene = sceneInputPlugin.scene; + + /** + * A reference to the Scene Systems Settings. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#settings + * @type {Phaser.Types.Scenes.SettingsObject} + * @since 3.10.0 + */ + this.settings = this.scene.sys.settings; + + /** + * A reference to the Scene Input Plugin that created this Keyboard Plugin. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#sceneInputPlugin + * @type {Phaser.Input.InputPlugin} + * @since 3.10.0 + */ + this.sceneInputPlugin = sceneInputPlugin; + + /** + * A reference to the global Keyboard Manager. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#manager + * @type {Phaser.Input.Keyboard.KeyboardManager} + * @since 3.16.0 + */ + this.manager = sceneInputPlugin.manager.keyboard; + + /** + * A boolean that controls if this Keyboard Plugin is enabled or not. + * Can be toggled on the fly. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#enabled + * @type {boolean} + * @default true + * @since 3.10.0 + */ + this.enabled = true; + + /** + * An array of Key objects to process. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#keys + * @type {Phaser.Input.Keyboard.Key[]} + * @since 3.10.0 + */ + this.keys = []; + + /** + * An array of KeyCombo objects to process. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#combos + * @type {Phaser.Input.Keyboard.KeyCombo[]} + * @since 3.10.0 + */ + this.combos = []; + + /** + * Internal repeat key flag. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#prevCode + * @type {string} + * @private + * @since 3.50.0 + */ + this.prevCode = null; + + /** + * Internal repeat key flag. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#prevTime + * @type {number} + * @private + * @since 3.50.0 + */ + this.prevTime = 0; + + /** + * Internal repeat key flag. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#prevType + * @type {string} + * @private + * @since 3.50.1 + */ + this.prevType = null; + + sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this); + sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this); + }, + + /** + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#boot + * @private + * @since 3.10.0 + */ + boot: function () + { + var settings = this.settings.input; + + this.enabled = GetValue(settings, 'keyboard', true); + + var captures = GetValue(settings, 'keyboard.capture', null); + + if (captures) + { + this.addCaptures(captures); } - } - return (closestIntersect) ? out : null; -}; + this.sceneInputPlugin.pluginEvents.once(InputEvents.DESTROY, this.destroy, this); + }, -module.exports = GetLineToPoints; + /** + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#start + * @private + * @since 3.10.0 + */ + start: function () + { + this.sceneInputPlugin.manager.events.on(InputEvents.MANAGER_PROCESS, this.update, this); + this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); -/***/ }), -/* 487 */ -/***/ (function(module, exports, __webpack_require__) { + this.game.events.on(GameEvents.BLUR, this.resetKeys, this); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.scene.sys.events.on(SceneEvents.PAUSE, this.resetKeys, this); + this.scene.sys.events.on(SceneEvents.SLEEP, this.resetKeys, this); + }, -var Vector3 = __webpack_require__(39); -var Vector4 = __webpack_require__(140); -var GetLineToPoints = __webpack_require__(486); + /** + * Checks to see if both this plugin and the Scene to which it belongs is active. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#isActive + * @since 3.10.0 + * + * @return {boolean} `true` if the plugin and the Scene it belongs to is active. + */ + isActive: function () + { + return (this.enabled && this.scene.sys.canInput()); + }, -// Temp vec3 -var tempIntersect = new Vector3(); + /** + * By default when a key is pressed Phaser will not stop the event from propagating up to the browser. + * There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll. + * + * This `addCapture` method enables consuming keyboard events for specific keys, so they don't bubble up the browser + * and cause the default behaviors. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to say prevent + * the SPACE BAR from triggering a page scroll, then it will prevent it for any Scene in your game, not just the calling one. + * + * You can pass a single key code value: + * + * ```javascript + * this.input.keyboard.addCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.addCapture([ 62, 63, 64 ]); + * ``` + * + * Or, a comma-delimited string: + * + * ```javascript + * this.input.keyboard.addCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#addCapture + * @since 3.16.0 + * + * @param {(string|number|number[]|any[])} keycode - The Key Codes to enable event capture for. + * + * @return {this} This KeyboardPlugin object. + */ + addCapture: function (keycode) + { + this.manager.addCapture(keycode); -/** - * Checks for the closest point of intersection between a line segment and an array of polygons. - * - * If no intersection is found, this function returns `null`. - * - * If intersection was found, a Vector4 is returned with the following properties: - * - * The `x` and `y` components contain the point of the intersection. - * The `z` component contains the closest distance. - * The `w` component contains the index of the polygon, in the given array, that triggered the intersection. - * - * @function Phaser.Geom.Intersects.GetLineToPolygon - * @since 3.50.0 - * - * @param {Phaser.Geom.Line} line - The line segment to check. - * @param {Phaser.Geom.Polygon | Phaser.Geom.Polygon[]} polygons - A single polygon, or array of polygons, to check. - * @param {Phaser.Math.Vector4} [out] - A Vector4 to store the intersection results in. - * - * @return {Phaser.Math.Vector4} A Vector4 containing the intersection results, or `null`. - */ -var GetLineToPolygon = function (line, polygons, out) -{ - if (out === undefined) { out = new Vector4(); } + return this; + }, - if (!Array.isArray(polygons)) + /** + * Removes an existing key capture. + * + * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to remove + * the capture of a key, then it will remove it for any Scene in your game, not just the calling one. + * + * You can pass a single key code value: + * + * ```javascript + * this.input.keyboard.removeCapture(62); + * ``` + * + * An array of key codes: + * + * ```javascript + * this.input.keyboard.removeCapture([ 62, 63, 64 ]); + * ``` + * + * Or, a comma-delimited string: + * + * ```javascript + * this.input.keyboard.removeCapture('W,S,A,D'); + * ``` + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * You can also provide an array mixing both strings and key code integers. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#removeCapture + * @since 3.16.0 + * + * @param {(string|number|number[]|any[])} keycode - The Key Codes to disable event capture for. + * + * @return {this} This KeyboardPlugin object. + */ + removeCapture: function (keycode) { - polygons = [ polygons ]; - } + this.manager.removeCapture(keycode); - var closestIntersect = false; + return this; + }, - // Reset our vec4s - out.set(); - tempIntersect.set(); + /** + * Returns an array that contains all of the keyboard captures currently enabled. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#getCaptures + * @since 3.16.0 + * + * @return {number[]} An array of all the currently capturing key codes. + */ + getCaptures: function () + { + return this.manager.captures; + }, - for (var i = 0; i < polygons.length; i++) + /** + * Allows Phaser to prevent any key captures you may have defined from bubbling up the browser. + * You can use this to re-enable event capturing if you had paused it via `disableGlobalCapture`. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#enableGlobalCapture + * @since 3.16.0 + * + * @return {this} This KeyboardPlugin object. + */ + enableGlobalCapture: function () + { + this.manager.preventDefault = true; + + return this; + }, + + /** + * Disables Phaser from preventing any key captures you may have defined, without actually removing them. + * You can use this to temporarily disable event capturing if, for example, you swap to a DOM element. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#disableGlobalCapture + * @since 3.16.0 + * + * @return {this} This KeyboardPlugin object. + */ + disableGlobalCapture: function () + { + this.manager.preventDefault = false; + + return this; + }, + + /** + * Removes all keyboard captures. + * + * Note that this is a global change. It will clear all event captures across your game, not just for this specific Scene. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#clearCaptures + * @since 3.16.0 + * + * @return {this} This KeyboardPlugin object. + */ + clearCaptures: function () + { + this.manager.clearCaptures(); + + return this; + }, + + /** + * Creates and returns an object containing 4 hotkeys for Up, Down, Left and Right, and also Space Bar and shift. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#createCursorKeys + * @since 3.10.0 + * + * @return {Phaser.Types.Input.Keyboard.CursorKeys} An object containing the properties: `up`, `down`, `left`, `right`, `space` and `shift`. + */ + createCursorKeys: function () + { + return this.addKeys({ + up: KeyCodes.UP, + down: KeyCodes.DOWN, + left: KeyCodes.LEFT, + right: KeyCodes.RIGHT, + space: KeyCodes.SPACE, + shift: KeyCodes.SHIFT + }); + }, + + /** + * A practical way to create an object containing user selected hotkeys. + * + * For example: + * + * ```javascript + * this.input.keyboard.addKeys({ 'up': Phaser.Input.Keyboard.KeyCodes.W, 'down': Phaser.Input.Keyboard.KeyCodes.S }); + * ``` + * + * would return an object containing the properties (`up` and `down`) mapped to W and S {@link Phaser.Input.Keyboard.Key} objects. + * + * You can also pass in a comma-separated string: + * + * ```javascript + * this.input.keyboard.addKeys('W,S,A,D'); + * ``` + * + * Which will return an object with the properties W, S, A and D mapped to the relevant Key objects. + * + * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#addKeys + * @since 3.10.0 + * + * @param {(object|string)} keys - An object containing Key Codes, or a comma-separated string. + * @param {boolean} [enableCapture=true] - Automatically call `preventDefault` on the native DOM browser event for the key codes being added. + * @param {boolean} [emitOnRepeat=false] - Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). + * + * @return {object} An object containing Key objects mapped to the input properties. + */ + addKeys: function (keys, enableCapture, emitOnRepeat) { - if (GetLineToPoints(line, polygons[i].points, tempIntersect)) + if (enableCapture === undefined) { enableCapture = true; } + if (emitOnRepeat === undefined) { emitOnRepeat = false; } + + var output = {}; + + if (typeof keys === 'string') { - if (!closestIntersect || tempIntersect.z < out.z) + keys = keys.split(','); + + for (var i = 0; i < keys.length; i++) { - out.set(tempIntersect.x, tempIntersect.y, tempIntersect.z, i); + var currentKey = keys[i].trim(); - closestIntersect = true; + if (currentKey) + { + output[currentKey] = this.addKey(currentKey, enableCapture, emitOnRepeat); + } + } + } + else + { + for (var key in keys) + { + output[key] = this.addKey(keys[key], enableCapture, emitOnRepeat); } } - } - return (closestIntersect) ? out : null; -}; + return output; + }, -module.exports = GetLineToPolygon; + /** + * Adds a Key object to this Keyboard Plugin. + * + * The given argument can be either an existing Key object, a string, such as `A` or `SPACE`, or a key code value. + * + * If a Key object is given, and one already exists matching the same key code, the existing one is replaced with the new one. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#addKey + * @since 3.10.0 + * + * @param {(Phaser.Input.Keyboard.Key|string|number)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * @param {boolean} [enableCapture=true] - Automatically call `preventDefault` on the native DOM browser event for the key codes being added. + * @param {boolean} [emitOnRepeat=false] - Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). + * + * @return {Phaser.Input.Keyboard.Key} The newly created Key object, or a reference to it if it already existed in the keys array. + */ + addKey: function (key, enableCapture, emitOnRepeat) + { + if (enableCapture === undefined) { enableCapture = true; } + if (emitOnRepeat === undefined) { emitOnRepeat = false; } + var keys = this.keys; -/***/ }), -/* 488 */ -/***/ (function(module, exports) { + if (key instanceof Key) + { + var idx = keys.indexOf(key); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (idx > -1) + { + keys[idx] = key; + } + else + { + keys[key.keyCode] = key; + } -/** - * Checks for intersection between the Line and a Rectangle shape, or a rectangle-like - * object, with public `x`, `y`, `right` and `bottom` properties, such as a Sprite or Body. - * - * An intersection is considered valid if: - * - * The line starts within, or ends within, the Rectangle. - * The line segment intersects one of the 4 rectangle edges. - * - * The for the purposes of this function rectangles are considered 'solid'. - * - * @function Phaser.Geom.Intersects.LineToRectangle - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The Line to check for intersection. - * @param {(Phaser.Geom.Rectangle|object)} rect - The Rectangle to check for intersection. - * - * @return {boolean} `true` if the Line and the Rectangle intersect, `false` otherwise. - */ -var LineToRectangle = function (line, rect) -{ - var x1 = line.x1; - var y1 = line.y1; + if (enableCapture) + { + this.addCapture(key.keyCode); + } - var x2 = line.x2; - var y2 = line.y2; + key.setEmitOnRepeat(emitOnRepeat); - var bx1 = rect.x; - var by1 = rect.y; - var bx2 = rect.right; - var by2 = rect.bottom; + return key; + } - var t = 0; + if (typeof key === 'string') + { + key = KeyCodes[key.toUpperCase()]; + } - // If the start or end of the line is inside the rect then we assume - // collision, as rects are solid for our use-case. + if (!keys[key]) + { + keys[key] = new Key(this, key); - if ((x1 >= bx1 && x1 <= bx2 && y1 >= by1 && y1 <= by2) || - (x2 >= bx1 && x2 <= bx2 && y2 >= by1 && y2 <= by2)) - { - return true; - } + if (enableCapture) + { + this.addCapture(key); + } - if (x1 < bx1 && x2 >= bx1) + keys[key].setEmitOnRepeat(emitOnRepeat); + } + + return keys[key]; + }, + + /** + * Removes a Key object from this Keyboard Plugin. + * + * The given argument can be either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#removeKey + * @since 3.10.0 + * + * @param {(Phaser.Input.Keyboard.Key|string|number)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. + * @param {boolean} [destroy=false] - Call `Key.destroy` on the removed Key object? + * @param {boolean} [removeCapture=false] - Remove this Key from being captured? Only applies if set to capture when created. + * + * @return {this} This KeyboardPlugin object. + */ + removeKey: function (key, destroy, removeCapture) { - // Left edge - t = y1 + (y2 - y1) * (bx1 - x1) / (x2 - x1); + if (destroy === undefined) { destroy = false; } + if (removeCapture === undefined) { removeCapture = false; } - if (t > by1 && t <= by2) + var keys = this.keys; + var ref; + + if (key instanceof Key) { - return true; + var idx = keys.indexOf(key); + + if (idx > -1) + { + ref = this.keys[idx]; + + this.keys[idx] = undefined; + } } - } - else if (x1 > bx2 && x2 <= bx2) + else if (typeof key === 'string') + { + key = KeyCodes[key.toUpperCase()]; + } + + if (keys[key]) + { + ref = keys[key]; + + keys[key] = undefined; + } + + if (ref) + { + ref.plugin = null; + + if (removeCapture) + { + this.removeCapture(ref.keyCode); + } + + if (destroy) + { + ref.destroy(); + } + } + + return this; + }, + + /** + * Removes all Key objects created by _this_ Keyboard Plugin. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#removeAllKeys + * @since 3.24.0 + * + * @param {boolean} [destroy=false] - Call `Key.destroy` on each removed Key object? + * @param {boolean} [removeCapture=false] - Remove all key captures for Key objects owened by this plugin? + * + * @return {this} This KeyboardPlugin object. + */ + removeAllKeys: function (destroy, removeCapture) { - // Right edge - t = y1 + (y2 - y1) * (bx2 - x1) / (x2 - x1); + if (destroy === undefined) { destroy = false; } + if (removeCapture === undefined) { removeCapture = false; } - if (t >= by1 && t <= by2) + var keys = this.keys; + + for (var i = 0; i < keys.length; i++) { - return true; + var key = keys[i]; + + if (key) + { + keys[i] = undefined; + + if (removeCapture) + { + this.removeCapture(key.keyCode); + } + + if (destroy) + { + key.destroy(); + } + } } - } - if (y1 < by1 && y2 >= by1) + return this; + }, + + /** + * Creates a new KeyCombo. + * + * A KeyCombo will listen for a specific string of keys from the Keyboard, and when it receives them + * it will emit a `keycombomatch` event from this Keyboard Plugin. + * + * The keys to be listened for can be defined as: + * + * A string (i.e. 'ATARI') + * An array of either integers (key codes) or strings, or a mixture of both + * An array of objects (such as Key objects) with a public 'keyCode' property + * + * For example, to listen for the Konami code (up, up, down, down, left, right, left, right, b, a, enter) + * you could pass the following array of key codes: + * + * ```javascript + * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true }); + * + * this.input.keyboard.on('keycombomatch', function (event) { + * console.log('Konami Code entered!'); + * }); + * ``` + * + * Or, to listen for the user entering the word PHASER: + * + * ```javascript + * this.input.keyboard.createCombo('PHASER'); + * ``` + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#createCombo + * @since 3.10.0 + * + * @param {(string|number[]|object[])} keys - The keys that comprise this combo. + * @param {Phaser.Types.Input.Keyboard.KeyComboConfig} [config] - A Key Combo configuration object. + * + * @return {Phaser.Input.Keyboard.KeyCombo} The new KeyCombo object. + */ + createCombo: function (keys, config) { - // Top edge - t = x1 + (x2 - x1) * (by1 - y1) / (y2 - y1); + return new KeyCombo(this, keys, config); + }, - if (t >= bx1 && t <= bx2) + /** + * Checks if the given Key object is currently being held down. + * + * The difference between this method and checking the `Key.isDown` property directly is that you can provide + * a duration to this method. For example, if you wanted a key press to fire a bullet, but you only wanted + * it to be able to fire every 100ms, then you can call this method with a `duration` of 100 and it + * will only return `true` every 100ms. + * + * If the Keyboard Plugin has been disabled, this method will always return `false`. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#checkDown + * @since 3.11.0 + * + * @param {Phaser.Input.Keyboard.Key} key - A Key object. + * @param {number} [duration=0] - The duration which must have elapsed before this Key is considered as being down. + * + * @return {boolean} `true` if the Key is down within the duration specified, otherwise `false`. + */ + checkDown: function (key, duration) + { + if (duration === undefined) { duration = 0; } + + if (this.enabled && key.isDown) { - return true; + var t = SnapFloor(this.time - key.timeDown, duration); + + if (t > key._tick) + { + key._tick = t; + + return true; + } } - } - else if (y1 > by2 && y2 <= by2) + + return false; + }, + + /** + * Internal update handler called by the Input Plugin, which is in turn invoked by the Game step. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#update + * @private + * @since 3.10.0 + */ + update: function () { - // Bottom edge - t = x1 + (x2 - x1) * (by2 - y1) / (y2 - y1); + var queue = this.manager.queue; + var len = queue.length; - if (t >= bx1 && t <= bx2) + if (!this.isActive() || len === 0) { - return true; + return; } - } - return false; -}; + var keys = this.keys; -module.exports = LineToRectangle; + // Process the event queue, dispatching all of the events that have stored up + for (var i = 0; i < len; i++) + { + var event = queue[i]; + var code = event.keyCode; + var key = keys[code]; + var repeat = false; + // Override the default functions (it's too late for the browser to use them anyway, so we may as well) + if (event.cancelled === undefined) + { + // Event allowed to flow across all handlers in this Scene, and any other Scene in the Scene list + event.cancelled = 0; -/***/ }), -/* 489 */ -/***/ (function(module, exports, __webpack_require__) { + // Won't reach any more local (Scene level) handlers + event.stopImmediatePropagation = function () + { + event.cancelled = 1; + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Won't reach any more handlers in any Scene further down the Scene list + event.stopPropagation = function () + { + event.cancelled = -1; + }; + } -var LineToLine = __webpack_require__(96); -var Contains = __webpack_require__(57); -var ContainsArray = __webpack_require__(235); -var Decompose = __webpack_require__(490); + if (event.cancelled === -1) + { + // This event has been stopped from broadcasting to any other Scene, so abort. + continue; + } -/** - * Checks for intersection between Rectangle shape and Triangle shape. - * - * @function Phaser.Geom.Intersects.RectangleToTriangle - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rect - Rectangle object to test. - * @param {Phaser.Geom.Triangle} triangle - Triangle object to test. - * - * @return {boolean} A value of `true` if objects intersect; otherwise `false`. - */ -var RectangleToTriangle = function (rect, triangle) -{ - // First the cheapest ones: + // Duplicate event bailout + if (code === this.prevCode && event.timeStamp === this.prevTime && event.type === this.prevType) + { + // On some systems, the exact same event will fire multiple times. This prevents it. + continue; + } - if ( - triangle.left > rect.right || - triangle.right < rect.left || - triangle.top > rect.bottom || - triangle.bottom < rect.top) - { - return false; - } + this.prevCode = code; + this.prevTime = event.timeStamp; + this.prevType = event.type; - var triA = triangle.getLineA(); - var triB = triangle.getLineB(); - var triC = triangle.getLineC(); + if (event.type === 'keydown') + { + // Key specific callback first + if (key) + { + repeat = key.isDown; - // Are any of the triangle points within the rectangle? + key.onDown(event); + } - if (Contains(rect, triA.x1, triA.y1) || Contains(rect, triA.x2, triA.y2)) - { - return true; - } + if (!event.cancelled && (!key || !repeat)) + { + if (KeyMap[code]) + { + this.emit(Events.KEY_DOWN + KeyMap[code], event); + } - if (Contains(rect, triB.x1, triB.y1) || Contains(rect, triB.x2, triB.y2)) - { - return true; - } + if (!event.cancelled) + { + this.emit(Events.ANY_KEY_DOWN, event); + } + } + } + else + { + // Key specific callback first + if (key) + { + key.onUp(event); + } - if (Contains(rect, triC.x1, triC.y1) || Contains(rect, triC.x2, triC.y2)) - { - return true; - } + if (!event.cancelled) + { + if (KeyMap[code]) + { + this.emit(Events.KEY_UP + KeyMap[code], event); + } - // Cheap tests over, now to see if any of the lines intersect ... + if (!event.cancelled) + { + this.emit(Events.ANY_KEY_UP, event); + } + } + } - var rectA = rect.getLineA(); - var rectB = rect.getLineB(); - var rectC = rect.getLineC(); - var rectD = rect.getLineD(); + // Reset the cancel state for other Scenes to use + if (event.cancelled === 1) + { + event.cancelled = 0; + } + } + }, - if (LineToLine(triA, rectA) || LineToLine(triA, rectB) || LineToLine(triA, rectC) || LineToLine(triA, rectD)) + /** + * Resets all Key objects created by _this_ Keyboard Plugin back to their default un-pressed states. + * This can only reset keys created via the `addKey`, `addKeys` or `createCursorKeys` methods. + * If you have created a Key object directly you'll need to reset it yourself. + * + * This method is called automatically when the Keyboard Plugin shuts down, but can be + * invoked directly at any time you require. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#resetKeys + * @since 3.15.0 + * + * @return {this} This KeyboardPlugin object. + */ + resetKeys: function () { - return true; - } + var keys = this.keys; - if (LineToLine(triB, rectA) || LineToLine(triB, rectB) || LineToLine(triB, rectC) || LineToLine(triB, rectD)) + for (var i = 0; i < keys.length; i++) + { + // Because it's a sparsely populated array + if (keys[i]) + { + keys[i].reset(); + } + } + + return this; + }, + + /** + * Shuts this Keyboard Plugin down. This performs the following tasks: + * + * 1 - Removes all keys created by this Keyboard plugin. + * 2 - Stops and removes the keyboard event listeners. + * 3 - Clears out any pending requests in the queue, without processing them. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#shutdown + * @private + * @since 3.10.0 + */ + shutdown: function () { - return true; - } + this.removeAllKeys(true); + this.removeAllListeners(); - if (LineToLine(triC, rectA) || LineToLine(triC, rectB) || LineToLine(triC, rectC) || LineToLine(triC, rectD)) + this.sceneInputPlugin.manager.events.off(InputEvents.MANAGER_PROCESS, this.update, this); + + this.game.events.off(GameEvents.BLUR, this.resetKeys); + + this.scene.sys.events.off(SceneEvents.PAUSE, this.resetKeys, this); + this.scene.sys.events.off(SceneEvents.SLEEP, this.resetKeys, this); + + this.queue = []; + }, + + /** + * Destroys this Keyboard Plugin instance and all references it holds, plus clears out local arrays. + * + * @method Phaser.Input.Keyboard.KeyboardPlugin#destroy + * @private + * @since 3.10.0 + */ + destroy: function () { - return true; - } + this.shutdown(); - // None of the lines intersect, so are any rectangle points within the triangle? + var keys = this.keys; - var points = Decompose(rect); - var within = ContainsArray(triangle, points, true); + for (var i = 0; i < keys.length; i++) + { + // Because it's a sparsely populated array + if (keys[i]) + { + keys[i].destroy(); + } + } - return (within.length > 0); -}; + this.keys = []; + this.combos = []; + this.queue = []; -module.exports = RectangleToTriangle; + this.scene = null; + this.settings = null; + this.sceneInputPlugin = null; + this.manager = null; + }, + + /** + * Internal time value. + * + * @name Phaser.Input.Keyboard.KeyboardPlugin#time + * @type {number} + * @private + * @since 3.11.0 + */ + time: { + + get: function () + { + return this.sceneInputPlugin.manager.time; + } + + } + +}); + +/** + * An instance of the Keyboard Plugin class, if enabled via the `input.keyboard` Scene or Game Config property. + * Use this to create Key objects and listen for keyboard specific events. + * + * @name Phaser.Input.InputPlugin#keyboard + * @type {?Phaser.Input.Keyboard.KeyboardPlugin} + * @since 3.10.0 + */ +InputPluginCache.register('KeyboardPlugin', KeyboardPlugin, 'keyboard', 'keyboard', 'inputKeyboard'); + +module.exports = KeyboardPlugin; /***/ }), -/* 490 */ -/***/ (function(module, exports) { + +/***/ 60258: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Create an array of points for each corner of a Rectangle - * If an array is specified, each point object will be added to the end of the array, otherwise a new array will be created. + * Used internally by the KeyCombo class. + * Return `true` if it reached the end of the combo, `false` if not. * - * @function Phaser.Geom.Rectangle.Decompose + * @function Phaser.Input.Keyboard.AdvanceKeyCombo + * @private * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle object to be decomposed. - * @param {array} [out] - If provided, each point will be added to this array. + * @param {KeyboardEvent} event - The native Keyboard Event. + * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to advance. * - * @return {array} Will return the array you specified or a new array containing the points of the Rectangle. + * @return {boolean} `true` if it reached the end of the combo, `false` if not. */ -var Decompose = function (rect, out) +var AdvanceKeyCombo = function (event, combo) { - if (out === undefined) { out = []; } - - out.push({ x: rect.x, y: rect.y }); - out.push({ x: rect.right, y: rect.y }); - out.push({ x: rect.right, y: rect.bottom }); - out.push({ x: rect.x, y: rect.bottom }); + combo.timeLastMatched = event.timeStamp; + combo.index++; - return out; + if (combo.index === combo.size) + { + return true; + } + else + { + combo.current = combo.keyCodes[combo.index]; + return false; + } }; -module.exports = Decompose; +module.exports = AdvanceKeyCombo; /***/ }), -/* 491 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 95625: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var LineToCircle = __webpack_require__(233); -var Contains = __webpack_require__(115); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(94030); +var GetFastValue = __webpack_require__(72632); +var ProcessKeyCombo = __webpack_require__(2544); +var ResetKeyCombo = __webpack_require__(88754); /** - * Checks if a Triangle and a Circle intersect. - * - * A Circle intersects a Triangle if its center is located within it or if any of the Triangle's sides intersect the Circle. As such, the Triangle and the Circle are considered "solid" for the intersection. + * @classdesc + * A KeyCombo will listen for a specific string of keys from the Keyboard, and when it receives them + * it will emit a `keycombomatch` event from the Keyboard Manager. * - * @function Phaser.Geom.Intersects.TriangleToCircle - * @since 3.0.0 + * The keys to be listened for can be defined as: * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to check for intersection. - * @param {Phaser.Geom.Circle} circle - The Circle to check for intersection. + * A string (i.e. 'ATARI') + * An array of either integers (key codes) or strings, or a mixture of both + * An array of objects (such as Key objects) with a public 'keyCode' property * - * @return {boolean} `true` if the Triangle and the `Circle` intersect, otherwise `false`. + * For example, to listen for the Konami code (up, up, down, down, left, right, left, right, b, a, enter) + * you could pass the following array of key codes: + * + * ```javascript + * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true }); + * + * this.input.keyboard.on('keycombomatch', function (event) { + * console.log('Konami Code entered!'); + * }); + * ``` + * + * Or, to listen for the user entering the word PHASER: + * + * ```javascript + * this.input.keyboard.createCombo('PHASER'); + * ``` + * + * @class KeyCombo + * @memberof Phaser.Input.Keyboard + * @constructor + * @listens Phaser.Input.Keyboard.Events#ANY_KEY_DOWN + * @since 3.0.0 + * + * @param {Phaser.Input.Keyboard.KeyboardPlugin} keyboardPlugin - A reference to the Keyboard Plugin. + * @param {(string|number[]|object[])} keys - The keys that comprise this combo. + * @param {Phaser.Types.Input.Keyboard.KeyComboConfig} [config] - A Key Combo configuration object. */ -var TriangleToCircle = function (triangle, circle) -{ - // First the cheapest ones: +var KeyCombo = new Class({ - if ( - triangle.left > circle.right || - triangle.right < circle.left || - triangle.top > circle.bottom || - triangle.bottom < circle.top) - { - return false; - } + initialize: - if (Contains(triangle, circle.x, circle.y)) + function KeyCombo (keyboardPlugin, keys, config) { - return true; - } + if (config === undefined) { config = {}; } - if (LineToCircle(triangle.getLineA(), circle)) - { - return true; - } + // Can't have a zero or single length combo (string or array based) + if (keys.length < 2) + { + return false; + } - if (LineToCircle(triangle.getLineB(), circle)) - { - return true; - } + /** + * A reference to the Keyboard Manager + * + * @name Phaser.Input.Keyboard.KeyCombo#manager + * @type {Phaser.Input.Keyboard.KeyboardPlugin} + * @since 3.0.0 + */ + this.manager = keyboardPlugin; - if (LineToCircle(triangle.getLineC(), circle)) - { - return true; - } + /** + * A flag that controls if this Key Combo is actively processing keys or not. + * + * @name Phaser.Input.Keyboard.KeyCombo#enabled + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.enabled = true; - return false; -}; + /** + * An array of the keycodes that comprise this combo. + * + * @name Phaser.Input.Keyboard.KeyCombo#keyCodes + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.keyCodes = []; -module.exports = TriangleToCircle; + // if 'keys' is a string we need to get the keycode of each character in it + for (var i = 0; i < keys.length; i++) + { + var char = keys[i]; -/***/ }), -/* 492 */ -/***/ (function(module, exports, __webpack_require__) { + if (typeof char === 'string') + { + this.keyCodes.push(char.toUpperCase().charCodeAt(0)); + } + else if (typeof char === 'number') + { + this.keyCodes.push(char); + } + else if (char.hasOwnProperty('keyCode')) + { + this.keyCodes.push(char.keyCode); + } + } -/** - * @author Florian Vazelle - * @author Geoffrey Glaive - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The current keyCode the combo is waiting for. + * + * @name Phaser.Input.Keyboard.KeyCombo#current + * @type {number} + * @since 3.0.0 + */ + this.current = this.keyCodes[0]; + + /** + * The current index of the key being waited for in the 'keys' string. + * + * @name Phaser.Input.Keyboard.KeyCombo#index + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.index = 0; -var Point = __webpack_require__(4); -var TriangleToLine = __webpack_require__(493); -var LineToLine = __webpack_require__(96); + /** + * The length of this combo (in keycodes) + * + * @name Phaser.Input.Keyboard.KeyCombo#size + * @type {number} + * @since 3.0.0 + */ + this.size = this.keyCodes.length; -/** - * Checks if a Triangle and a Line intersect, and returns the intersection points as a Point object array. - * - * The Line intersects the Triangle if it starts inside of it, ends inside of it, or crosses any of the Triangle's sides. Thus, the Triangle is considered "solid". - * - * @function Phaser.Geom.Intersects.GetTriangleToLine - * @since 3.0.0 - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to check with. - * @param {Phaser.Geom.Line} line - The Line to check with. - * @param {array} [out] - An optional array in which to store the points of intersection. - * - * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. - */ -var GetTriangleToLine = function (triangle, line, out) -{ - if (out === undefined) { out = []; } + /** + * The time the previous key in the combo was matched. + * + * @name Phaser.Input.Keyboard.KeyCombo#timeLastMatched + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.timeLastMatched = 0; - if (TriangleToLine(triangle, line)) - { - var lineA = triangle.getLineA(); - var lineB = triangle.getLineB(); - var lineC = triangle.getLineC(); + /** + * Has this Key Combo been matched yet? + * + * @name Phaser.Input.Keyboard.KeyCombo#matched + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.matched = false; - var output = [ new Point(), new Point(), new Point() ]; + /** + * The time the entire combo was matched. + * + * @name Phaser.Input.Keyboard.KeyCombo#timeMatched + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.timeMatched = 0; - var result = [ - LineToLine(lineA, line, output[0]), - LineToLine(lineB, line, output[1]), - LineToLine(lineC, line, output[2]) - ]; + /** + * If they press the wrong key do we reset the combo? + * + * @name Phaser.Input.Keyboard.KeyCombo#resetOnWrongKey + * @type {boolean} + * @default 0 + * @since 3.0.0 + */ + this.resetOnWrongKey = GetFastValue(config, 'resetOnWrongKey', true); - for (var i = 0; i < 3; i++) + /** + * The max delay in ms between each key press. Above this the combo is reset. 0 means disabled. + * + * @name Phaser.Input.Keyboard.KeyCombo#maxKeyDelay + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.maxKeyDelay = GetFastValue(config, 'maxKeyDelay', 0); + + /** + * If previously matched and they press the first key of the combo again, will it reset? + * + * @name Phaser.Input.Keyboard.KeyCombo#resetOnMatch + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.resetOnMatch = GetFastValue(config, 'resetOnMatch', false); + + /** + * If the combo matches, will it delete itself? + * + * @name Phaser.Input.Keyboard.KeyCombo#deleteOnMatch + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.deleteOnMatch = GetFastValue(config, 'deleteOnMatch', false); + + var _this = this; + + var onKeyDownHandler = function (event) { - if (result[i]) { out.push(output[i]); } - } - } + if (_this.matched || !_this.enabled) + { + return; + } - return out; -}; + var matched = ProcessKeyCombo(event, _this); -module.exports = GetTriangleToLine; + if (matched) + { + _this.manager.emit(Events.COMBO_MATCH, _this, event); + if (_this.resetOnMatch) + { + ResetKeyCombo(_this); + } + else if (_this.deleteOnMatch) + { + _this.destroy(); + } + } + }; -/***/ }), -/* 493 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The internal Key Down handler. + * + * @name Phaser.Input.Keyboard.KeyCombo#onKeyDown + * @private + * @type {KeyboardKeydownCallback} + * @fires Phaser.Input.Keyboard.Events#COMBO_MATCH + * @since 3.0.0 + */ + this.onKeyDown = onKeyDownHandler; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.manager.on(Events.ANY_KEY_DOWN, this.onKeyDown); + }, -var LineToLine = __webpack_require__(96); + /** + * How far complete is this combo? A value between 0 and 1. + * + * @name Phaser.Input.Keyboard.KeyCombo#progress + * @type {number} + * @readonly + * @since 3.0.0 + */ + progress: { -/** - * Checks if a Triangle and a Line intersect. - * - * The Line intersects the Triangle if it starts inside of it, ends inside of it, or crosses any of the Triangle's sides. Thus, the Triangle is considered "solid". - * - * @function Phaser.Geom.Intersects.TriangleToLine - * @since 3.0.0 - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to check with. - * @param {Phaser.Geom.Line} line - The Line to check with. - * - * @return {boolean} `true` if the Triangle and the Line intersect, otherwise `false`. - */ -var TriangleToLine = function (triangle, line) -{ - // If the Triangle contains either the start or end point of the line, it intersects - if (triangle.contains(line.x1, line.y1) || triangle.contains(line.x2, line.y2)) - { - return true; - } + get: function () + { + return this.index / this.size; + } - // Now check the line against each line of the Triangle - if (LineToLine(triangle.getLineA(), line)) - { - return true; - } + }, - if (LineToLine(triangle.getLineB(), line)) + /** + * Destroys this Key Combo and all of its references. + * + * @method Phaser.Input.Keyboard.KeyCombo#destroy + * @since 3.0.0 + */ + destroy: function () { - return true; - } + this.enabled = false; + this.keyCodes = []; - if (LineToLine(triangle.getLineC(), line)) - { - return true; + this.manager.off(Events.ANY_KEY_DOWN, this.onKeyDown); + + this.manager = null; } - return false; -}; +}); -module.exports = TriangleToLine; +module.exports = KeyCombo; /***/ }), -/* 494 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 2544: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ContainsArray = __webpack_require__(235); -var Decompose = __webpack_require__(495); -var LineToLine = __webpack_require__(96); +var AdvanceKeyCombo = __webpack_require__(60258); /** - * Checks if two Triangles intersect. - * - * A Triangle intersects another Triangle if any pair of their lines intersects or if any point of one Triangle is within the other Triangle. Thus, the Triangles are considered "solid". + * Used internally by the KeyCombo class. * - * @function Phaser.Geom.Intersects.TriangleToTriangle + * @function Phaser.Input.Keyboard.ProcessKeyCombo + * @private * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangleA - The first Triangle to check for intersection. - * @param {Phaser.Geom.Triangle} triangleB - The second Triangle to check for intersection. + * @param {KeyboardEvent} event - The native Keyboard Event. + * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to be processed. * - * @return {boolean} `true` if the Triangles intersect, otherwise `false`. + * @return {boolean} `true` if the combo was matched, otherwise `false`. */ -var TriangleToTriangle = function (triangleA, triangleB) +var ProcessKeyCombo = function (event, combo) { - // First the cheapest ones: - - if ( - triangleA.left > triangleB.right || - triangleA.right < triangleB.left || - triangleA.top > triangleB.bottom || - triangleA.bottom < triangleB.top) + if (combo.matched) { - return false; + return true; } - var lineAA = triangleA.getLineA(); - var lineAB = triangleA.getLineB(); - var lineAC = triangleA.getLineC(); - - var lineBA = triangleB.getLineA(); - var lineBB = triangleB.getLineB(); - var lineBC = triangleB.getLineC(); + var comboMatched = false; + var keyMatched = false; - // Now check the lines against each line of TriangleB - if (LineToLine(lineAA, lineBA) || LineToLine(lineAA, lineBB) || LineToLine(lineAA, lineBC)) + if (event.keyCode === combo.current) { - return true; - } + // Key was correct - if (LineToLine(lineAB, lineBA) || LineToLine(lineAB, lineBB) || LineToLine(lineAB, lineBC)) - { - return true; - } + if (combo.index > 0 && combo.maxKeyDelay > 0) + { + // We have to check to see if the delay between + // the new key and the old one was too long (if enabled) - if (LineToLine(lineAC, lineBA) || LineToLine(lineAC, lineBB) || LineToLine(lineAC, lineBC)) - { - return true; - } + var timeLimit = combo.timeLastMatched + combo.maxKeyDelay; - // Nope, so check to see if any of the points of triangleA are within triangleB + // Check if they pressed it in time or not + if (event.timeStamp <= timeLimit) + { + keyMatched = true; + comboMatched = AdvanceKeyCombo(event, combo); + } + } + else + { + keyMatched = true; - var points = Decompose(triangleA); - var within = ContainsArray(triangleB, points, true); + // We don't check the time for the first key pressed, so just advance it + comboMatched = AdvanceKeyCombo(event, combo); + } + } - if (within.length > 0) + if (!keyMatched && combo.resetOnWrongKey) { - return true; + // Wrong key was pressed + combo.index = 0; + combo.current = combo.keyCodes[0]; } - // Finally check to see if any of the points of triangleB are within triangleA - - points = Decompose(triangleB); - within = ContainsArray(triangleA, points, true); - - if (within.length > 0) + if (comboMatched) { - return true; + combo.timeLastMatched = event.timeStamp; + combo.matched = true; + combo.timeMatched = event.timeStamp; } - return false; + return comboMatched; }; -module.exports = TriangleToTriangle; +module.exports = ProcessKeyCombo; /***/ }), -/* 495 */ -/***/ (function(module, exports) { + +/***/ 88754: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Decomposes a Triangle into an array of its points. + * Used internally by the KeyCombo class. * - * @function Phaser.Geom.Triangle.Decompose + * @function Phaser.Input.Keyboard.ResetKeyCombo + * @private * @since 3.0.0 * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to decompose. - * @param {array} [out] - An array to store the points into. + * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo to reset. * - * @return {array} The provided `out` array, or a new array if none was provided, with three objects with `x` and `y` properties representing each point of the Triangle appended to it. + * @return {Phaser.Input.Keyboard.KeyCombo} The KeyCombo. */ -var Decompose = function (triangle, out) +var ResetKeyCombo = function (combo) { - if (out === undefined) { out = []; } - - out.push({ x: triangle.x1, y: triangle.y1 }); - out.push({ x: triangle.x2, y: triangle.y2 }); - out.push({ x: triangle.x3, y: triangle.y3 }); + combo.current = combo.keyCodes[0]; + combo.index = 0; + combo.timeLastMatched = 0; + combo.matched = false; + combo.timeMatched = 0; - return out; + return combo; }; -module.exports = Decompose; +module.exports = ResetKeyCombo; /***/ }), -/* 496 */ -/***/ (function(module, exports) { + +/***/ 5044: +/***/ ((module) => { /** * @author Richard Davey - * @author Florian Mertens - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Checks if the a Point falls between the two end-points of a Line, based on the given line thickness. - * - * Assumes that the line end points are circular, not square. + * The Global Key Down Event. * - * @function Phaser.Geom.Intersects.PointToLine - * @since 3.0.0 + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down. * - * @param {(Phaser.Geom.Point|any)} point - The point, or point-like object to check. - * @param {Phaser.Geom.Line} line - The line segment to test for intersection on. - * @param {number} [lineThickness=1] - The line thickness. Assumes that the line end points are circular. + * Listen to this event from within a Scene using: `this.input.keyboard.on('keydown', listener)`. * - * @return {boolean} `true` if the Point falls on the Line, otherwise `false`. + * You can also listen for a specific key being pressed. See [Keyboard.Events.KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_DOWN} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details. + * + * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. + * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details. + * + * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. + * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. + * There are others. So, please check your extensions if you find you have specific keys that don't work. + * + * @event Phaser.Input.Keyboard.Events#ANY_KEY_DOWN + * @type {string} + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc. */ -var PointToLine = function (point, line, lineThickness) -{ - if (lineThickness === undefined) { lineThickness = 1; } - - var x1 = line.x1; - var y1 = line.y1; - - var x2 = line.x2; - var y2 = line.y2; - - var px = point.x; - var py = point.y; - - var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); - - if (L2 === 0) - { - return false; - } - - var r = (((px - x1) * (x2 - x1)) + ((py - y1) * (y2 - y1))) / L2; - - // Assume line thickness is circular - if (r < 0) - { - // Outside line1 - return (Math.sqrt(((x1 - px) * (x1 - px)) + ((y1 - py) * (y1 - py))) <= lineThickness); - } - else if ((r >= 0) && (r <= 1)) - { - // On the line segment - var s = (((y1 - py) * (x2 - x1)) - ((x1 - px) * (y2 - y1))) / L2; - - return (Math.abs(s) * Math.sqrt(L2) <= lineThickness); - } - else - { - // Outside line2 - return (Math.sqrt(((x2 - px) * (x2 - px)) + ((y2 - py) * (y2 - py))) <= lineThickness); - } -}; - -module.exports = PointToLine; +module.exports = 'keydown'; /***/ }), -/* 497 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 40813: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MATH_CONST = __webpack_require__(14); -var Wrap = __webpack_require__(68); -var Angle = __webpack_require__(97); - /** - * Get the angle of the normal of the given line in radians. + * The Global Key Up Event. * - * @function Phaser.Geom.Line.NormalAngle - * @since 3.0.0 + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released. * - * @param {Phaser.Geom.Line} line - The line to calculate the angle of the normal of. + * Listen to this event from within a Scene using: `this.input.keyboard.on('keyup', listener)`. * - * @return {number} The angle of the normal of the line in radians. + * You can also listen for a specific key being released. See [Keyboard.Events.KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_UP} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details. + * + * @event Phaser.Input.Keyboard.Events#ANY_KEY_UP + * @type {string} + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc. */ -var NormalAngle = function (line) -{ - var angle = Angle(line) - MATH_CONST.TAU; - - return Wrap(angle, -Math.PI, Math.PI); -}; - -module.exports = NormalAngle; +module.exports = 'keyup'; /***/ }), -/* 498 */ -/***/ (function(module, exports) { + +/***/ 89319: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var flip = true; - -var defaultModelName = 'untitled'; -var currentGroup = ''; -var currentMaterial = ''; - /** - * @ignore + * The Key Combo Match Event. + * + * This event is dispatched by the Keyboard Plugin when a [Key Combo]{@link Phaser.Input.Keyboard.KeyCombo} is matched. + * + * Listen for this event from the Key Plugin after a combo has been created: + * + * ```javascript + * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true }); + * + * this.input.keyboard.on('keycombomatch', function (event) { + * console.log('Konami Code entered!'); + * }); + * ``` + * + * @event Phaser.Input.Keyboard.Events#COMBO_MATCH + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Keyboard.KeyCombo} keycombo - The Key Combo object that was matched. + * @param {KeyboardEvent} event - The native DOM Keyboard Event of the final key in the combo. You can inspect this to learn more about any modifiers, etc. */ -function stripComments (line) -{ - var idx = line.indexOf('#'); - - return (idx > -1) ? line.substring(0, idx) : line; -} +module.exports = 'keycombomatch'; -/** - * @ignore - */ -function currentModel (result) -{ - if (result.models.length === 0) - { - result.models.push({ - faces: [], - name: defaultModelName, - textureCoords: [], - vertexNormals: [], - vertices: [] - }); - } - currentGroup = ''; +/***/ }), - return result.models[result.models.length - 1]; -} +/***/ 43267: +/***/ ((module) => { /** - * @ignore + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -function parseObject (lineItems, result) -{ - var modelName = lineItems.length >= 2 ? lineItems[1] : defaultModelName; - - result.models.push({ - faces: [], - name: modelName, - textureCoords: [], - vertexNormals: [], - vertices: [] - }); - - currentGroup = ''; -} /** - * @ignore + * The Key Down Event. + * + * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is pressed. + * + * Listen for this event from the Key object instance directly: + * + * ```javascript + * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); + * + * spaceBar.on('down', listener) + * ``` + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details. + * + * @event Phaser.Input.Keyboard.Events#DOWN + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Keyboard.Key} key - The Key object that was pressed. + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc. */ -function parseGroup (lineItems) -{ - if (lineItems.length === 2) - { - currentGroup = lineItems[1]; - } -} +module.exports = 'down'; -/** - * @ignore - */ -function parseVertexCoords (lineItems, result) -{ - var len = lineItems.length; - var x = (len >= 2) ? parseFloat(lineItems[1]) : 0; - var y = (len >= 3) ? parseFloat(lineItems[2]) : 0; - var z = (len >= 4) ? parseFloat(lineItems[3]) : 0; +/***/ }), - currentModel(result).vertices.push({ x: x, y: y, z: z }); -} +/***/ 78595: +/***/ ((module) => { /** - * @ignore + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -function parseTextureCoords (lineItems, result) -{ - var len = lineItems.length; - - var u = (len >= 2) ? parseFloat(lineItems[1]) : 0; - var v = (len >= 3) ? parseFloat(lineItems[2]) : 0; - var w = (len >= 4) ? parseFloat(lineItems[3]) : 0; - - if (isNaN(u)) - { - u = 0; - } - if (isNaN(v)) - { - v = 0; - } +/** + * The Key Down Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down. + * + * Unlike the `ANY_KEY_DOWN` event, this one has a special dynamic event name. For example, to listen for the `A` key being pressed + * use the following from within a Scene: `this.input.keyboard.on('keydown-A', listener)`. You can replace the `-A` part of the event + * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar: + * `this.input.keyboard.on('keydown-SPACE', listener)`. + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details. + * + * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. + * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details. + * + * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. + * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. + * There are others. So, please check your extensions if you find you have specific keys that don't work. + * + * @event Phaser.Input.Keyboard.Events#KEY_DOWN + * @type {string} + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc. + */ +module.exports = 'keydown-'; - if (isNaN(w)) - { - w = 0; - } - if (flip) - { - v = 1 - v; - } +/***/ }), - currentModel(result).textureCoords.push({ u: u, v: v, w: w }); -} +/***/ 30056: +/***/ ((module) => { /** - * @ignore + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -function parseVertexNormal (lineItems, result) -{ - var len = lineItems.length; - - var x = (len >= 2) ? parseFloat(lineItems[1]) : 0; - var y = (len >= 3) ? parseFloat(lineItems[2]) : 0; - var z = (len >= 4) ? parseFloat(lineItems[3]) : 0; - - currentModel(result).vertexNormals.push({ x: x, y: y, z: z }); -} /** - * @ignore + * The Key Up Event. + * + * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released. + * + * Unlike the `ANY_KEY_UP` event, this one has a special dynamic event name. For example, to listen for the `A` key being released + * use the following from within a Scene: `this.input.keyboard.on('keyup-A', listener)`. You can replace the `-A` part of the event + * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar: + * `this.input.keyboard.on('keyup-SPACE', listener)`. + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details. + * + * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details. + * + * @event Phaser.Input.Keyboard.Events#KEY_UP + * @type {string} + * @since 3.0.0 + * + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc. */ -function parsePolygon (lineItems, result) -{ - var totalVertices = lineItems.length - 1; - - if (totalVertices < 3) - { - return; - } - - var face = { - group: currentGroup, - material: currentMaterial, - vertices: [] - }; - - for (var i = 0; i < totalVertices; i++) - { - var vertexString = lineItems[i + 1]; - var vertexValues = vertexString.split('/'); - var vvLen = vertexValues.length; - - if (vvLen < 1 || vvLen > 3) - { - continue; - } - - var vertexIndex = 0; - var textureCoordsIndex = 0; - var vertexNormalIndex = 0; - - vertexIndex = parseInt(vertexValues[0], 10); - - if (vvLen > 1 && vertexValues[1] !== '') - { - textureCoordsIndex = parseInt(vertexValues[1], 10); - } - - if (vvLen > 2) - { - vertexNormalIndex = parseInt(vertexValues[2], 10); - } - - if (vertexIndex !== 0) - { - // Negative vertex indices refer to the nth last defined vertex - // convert these to postive indices for simplicity - if (vertexIndex < 0) - { - vertexIndex = currentModel(result).vertices.length + 1 + vertexIndex; - } - - textureCoordsIndex -= 1; - vertexIndex -= 1; - vertexNormalIndex -= 1; +module.exports = 'keyup-'; - face.vertices.push({ - textureCoordsIndex: textureCoordsIndex, - vertexIndex: vertexIndex, - vertexNormalIndex: vertexNormalIndex - }); - } - } - currentModel(result).faces.push(face); -} +/***/ }), -/** - * @ignore - */ -function parseMtlLib (lineItems, result) -{ - if (lineItems.length >= 2) - { - result.materialLibraries.push(lineItems[1]); - } -} +/***/ 81939: +/***/ ((module) => { /** - * @ignore + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -function parseUseMtl (lineItems) -{ - if (lineItems.length >= 2) - { - currentMaterial = lineItems[1]; - } -} /** - * Parses a Wavefront OBJ File, extracting the models from it and returning them in an array. + * The Key Up Event. * - * The model data *must* be triangulated for a Mesh Game Object to be able to render it. + * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is released. * - * @function Phaser.Geom.Mesh.ParseObj - * @since 3.50.0 + * Listen for this event from the Key object instance directly: * - * @param {string} data - The OBJ File data as a raw string. - * @param {boolean} [flipUV=true] - Flip the UV coordinates? + * ```javascript + * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); * - * @return {Phaser.Types.Geom.Mesh.OBJData} The parsed model and material data. + * spaceBar.on('up', listener) + * ``` + * + * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details. + * + * @event Phaser.Input.Keyboard.Events#UP + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Input.Keyboard.Key} key - The Key object that was released. + * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc. */ -var ParseObj = function (data, flipUV) -{ - if (flipUV === undefined) { flipUV = true; } - - flip = flipUV; - - // Store results in here - var result = { - materials: {}, - materialLibraries: [], - models: [] - }; - - currentGroup = ''; - currentMaterial = ''; - - var lines = data.split('\n'); - - for (var i = 0; i < lines.length; i++) - { - var line = stripComments(lines[i]); - - var lineItems = line.replace(/\s\s+/g, ' ').trim().split(' '); - - switch (lineItems[0].toLowerCase()) - { - case 'o': - // Start A New Model - parseObject(lineItems, result); - break; +module.exports = 'up'; - case 'g': - // Start a new polygon group - parseGroup(lineItems); - break; - case 'v': - // Define a vertex for the current model - parseVertexCoords(lineItems, result); - break; +/***/ }), - case 'vt': - // Texture Coords - parseTextureCoords(lineItems, result); - break; +/***/ 94030: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - case 'vn': - // Define a vertex normal for the current model - parseVertexNormal(lineItems, result); - break; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - case 'f': - // Define a Face/Polygon - parsePolygon(lineItems, result); - break; +/** + * @namespace Phaser.Input.Keyboard.Events + */ - case 'mtllib': - // Reference to a material library file (.mtl) - parseMtlLib(lineItems, result); - break; +module.exports = { - case 'usemtl': - // Sets the current material to be applied to polygons defined from this point forward - parseUseMtl(lineItems); - break; - } - } + ANY_KEY_DOWN: __webpack_require__(5044), + ANY_KEY_UP: __webpack_require__(40813), + COMBO_MATCH: __webpack_require__(89319), + DOWN: __webpack_require__(43267), + KEY_DOWN: __webpack_require__(78595), + KEY_UP: __webpack_require__(30056), + UP: __webpack_require__(81939) - return result; }; -module.exports = ParseObj; - /***/ }), -/* 499 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 28388: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetColor = __webpack_require__(103); - /** - * Takes a Wavefront Material file and extracts the diffuse reflectivity of the named - * materials, converts them to integer color values and returns them. - * - * This is used internally by the `addOBJ` and `addModel` methods, but is exposed for - * public consumption as well. - * - * Note this only works with diffuse values, specified in the `Kd r g b` format, where - * `g` and `b` are optional, but `r` is required. It does not support spectral rfl files, - * or any other material statement (such as `Ka` or `Ks`) - * - * @method Phaser.Geom.Mesh.ParseObjMaterial - * @since 3.50.0 - * - * @param {string} mtl - The OBJ MTL file as a raw string, i.e. loaded via `this.load.text`. - * - * @return {object} The parsed material colors, where each property of the object matches the material name. + * @namespace Phaser.Input.Keyboard */ -var ParseObjMaterial = function (mtl) -{ - var output = {}; - - var lines = mtl.split('\n'); - - var currentMaterial = ''; - for (var i = 0; i < lines.length; i++) - { - var line = lines[i].trim(); +module.exports = { - if (line.indexOf('#') === 0 || line === '') - { - continue; - } + Events: __webpack_require__(94030), - var lineItems = line.replace(/\s\s+/g, ' ').trim().split(' '); + KeyboardManager: __webpack_require__(71064), + KeyboardPlugin: __webpack_require__(89666), - switch (lineItems[0].toLowerCase()) - { - case 'newmtl': - { - currentMaterial = lineItems[1]; - break; - } + Key: __webpack_require__(50165), + KeyCodes: __webpack_require__(11873), - // The diffuse reflectivity of the current material - // Support r, [g], [b] format, where g and b are optional - case 'kd': - { - var r = Math.floor(lineItems[1] * 255); - var g = (lineItems.length >= 2) ? Math.floor(lineItems[2] * 255) : r; - var b = (lineItems.length >= 3) ? Math.floor(lineItems[3] * 255) : r; + KeyCombo: __webpack_require__(95625), - output[currentMaterial] = GetColor(r, g, b); + AdvanceKeyCombo: __webpack_require__(60258), + ProcessKeyCombo: __webpack_require__(2544), + ResetKeyCombo: __webpack_require__(88754), - break; - } - } - } + JustDown: __webpack_require__(42460), + JustUp: __webpack_require__(53162), + DownDuration: __webpack_require__(64964), + UpDuration: __webpack_require__(70331) - return output; }; -module.exports = ParseObjMaterial; - /***/ }), -/* 500 */ -/***/ (function(module, exports) { + +/***/ 64964: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Calculate the magnitude of the point, which equivalent to the length of the line from the origin to this point. + * Returns `true` if the Key was pressed down within the `duration` value given, based on the current + * game clock time. Or `false` if it either isn't down, or was pressed down longer ago than the given duration. * - * @function Phaser.Geom.Point.GetMagnitude + * @function Phaser.Input.Keyboard.DownDuration * @since 3.0.0 * - * @param {Phaser.Geom.Point} point - The point to calculate the magnitude for + * @param {Phaser.Input.Keyboard.Key} key - The Key object to test. + * @param {number} [duration=50] - The duration, in ms, within which the key must have been pressed down. * - * @return {number} The resulting magnitude + * @return {boolean} `true` if the Key was pressed down within `duration` ms ago, otherwise `false`. */ -var GetMagnitude = function (point) +var DownDuration = function (key, duration) { - return Math.sqrt((point.x * point.x) + (point.y * point.y)); + if (duration === undefined) { duration = 50; } + + var current = key.plugin.game.loop.time - key.timeDown; + + return (key.isDown && current < duration); }; -module.exports = GetMagnitude; +module.exports = DownDuration; /***/ }), -/* 501 */ -/***/ (function(module, exports) { + +/***/ 42460: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Calculates the square of magnitude of given point.(Can be used for fast magnitude calculation of point) + * The justDown value allows you to test if this Key has just been pressed down or not. * - * @function Phaser.Geom.Point.GetMagnitudeSq - * @since 3.0.0 - * - * @param {Phaser.Geom.Point} point - Returns square of the magnitude/length of given point. + * When you check this value it will return `true` if the Key is down, otherwise `false`. * - * @return {number} Returns square of the magnitude of given point. - */ -var GetMagnitudeSq = function (point) -{ - return (point.x * point.x) + (point.y * point.y); -}; - -module.exports = GetMagnitudeSq; - - -/***/ }), -/* 502 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Rectangle = __webpack_require__(10); - -Rectangle.Area = __webpack_require__(1267); -Rectangle.Ceil = __webpack_require__(1268); -Rectangle.CeilAll = __webpack_require__(1269); -Rectangle.CenterOn = __webpack_require__(190); -Rectangle.Clone = __webpack_require__(1270); -Rectangle.Contains = __webpack_require__(57); -Rectangle.ContainsPoint = __webpack_require__(1271); -Rectangle.ContainsRect = __webpack_require__(503); -Rectangle.CopyFrom = __webpack_require__(1272); -Rectangle.Decompose = __webpack_require__(490); -Rectangle.Equals = __webpack_require__(1273); -Rectangle.FitInside = __webpack_require__(1274); -Rectangle.FitOutside = __webpack_require__(1275); -Rectangle.Floor = __webpack_require__(1276); -Rectangle.FloorAll = __webpack_require__(1277); -Rectangle.FromPoints = __webpack_require__(199); -Rectangle.FromXY = __webpack_require__(1278); -Rectangle.GetAspectRatio = __webpack_require__(237); -Rectangle.GetCenter = __webpack_require__(1279); -Rectangle.GetPoint = __webpack_require__(171); -Rectangle.GetPoints = __webpack_require__(306); -Rectangle.GetSize = __webpack_require__(1280); -Rectangle.Inflate = __webpack_require__(1281); -Rectangle.Intersection = __webpack_require__(1282); -Rectangle.MarchingAnts = __webpack_require__(316); -Rectangle.MergePoints = __webpack_require__(1283); -Rectangle.MergeRect = __webpack_require__(1284); -Rectangle.MergeXY = __webpack_require__(1285); -Rectangle.Offset = __webpack_require__(1286); -Rectangle.OffsetPoint = __webpack_require__(1287); -Rectangle.Overlaps = __webpack_require__(1288); -Rectangle.Perimeter = __webpack_require__(130); -Rectangle.PerimeterPoint = __webpack_require__(1289); -Rectangle.Random = __webpack_require__(174); -Rectangle.RandomOutside = __webpack_require__(1290); -Rectangle.SameDimensions = __webpack_require__(1291); -Rectangle.Scale = __webpack_require__(1292); -Rectangle.Union = __webpack_require__(441); - -module.exports = Rectangle; - - -/***/ }), -/* 503 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Tests if one rectangle fully contains another. + * You can only call justDown once per key press. It will only return `true` once, until the Key is released and pressed down again. + * This allows you to use it in situations where you want to check if this key is down without using an event, such as in a core game loop. * - * @function Phaser.Geom.Rectangle.ContainsRect + * @function Phaser.Input.Keyboard.JustDown * @since 3.0.0 * - * @param {Phaser.Geom.Rectangle} rectA - The first rectangle. - * @param {Phaser.Geom.Rectangle} rectB - The second rectangle. + * @param {Phaser.Input.Keyboard.Key} key - The Key to check to see if it's just down or not. * - * @return {boolean} True only if rectA fully contains rectB. + * @return {boolean} `true` if the Key was just pressed, otherwise `false`. */ -var ContainsRect = function (rectA, rectB) +var JustDown = function (key) { - // Volume check (if rectB volume > rectA then rectA cannot contain it) - if ((rectB.width * rectB.height) > (rectA.width * rectA.height)) + if (key._justDown) + { + key._justDown = false; + + return true; + } + else { return false; } - - return ( - (rectB.x > rectA.x && rectB.x < rectA.right) && - (rectB.right > rectA.x && rectB.right < rectA.right) && - (rectB.y > rectA.y && rectB.y < rectA.bottom) && - (rectB.bottom > rectA.y && rectB.bottom < rectA.bottom) - ); }; -module.exports = ContainsRect; +module.exports = JustDown; /***/ }), -/* 504 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Point = __webpack_require__(4); - -// The three medians (the lines drawn from the vertices to the bisectors of the opposite sides) -// meet in the centroid or center of mass (center of gravity). -// The centroid divides each median in a ratio of 2:1 - -/** - * Calculates the position of a Triangle's centroid, which is also its center of mass (center of gravity). - * - * The centroid is the point in a Triangle at which its three medians (the lines drawn from the vertices to the bisectors of the opposite sides) meet. It divides each one in a 2:1 ratio. - * - * @function Phaser.Geom.Triangle.Centroid - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to use. - * @param {(Phaser.Geom.Point|object)} [out] - An object to store the coordinates in. - * - * @return {(Phaser.Geom.Point|object)} The `out` object with modified `x` and `y` properties, or a new Point if none was provided. - */ -var Centroid = function (triangle, out) -{ - if (out === undefined) { out = new Point(); } - - out.x = (triangle.x1 + triangle.x2 + triangle.x3) / 3; - out.y = (triangle.y1 + triangle.y2 + triangle.y3) / 3; - return out; -}; - -module.exports = Centroid; - - -/***/ }), -/* 505 */ -/***/ (function(module, exports) { +/***/ 53162: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Moves each point (vertex) of a Triangle by a given offset, thus moving the entire Triangle by that offset. - * - * @function Phaser.Geom.Triangle.Offset - * @since 3.0.0 - * - * @generic {Phaser.Geom.Triangle} O - [triangle,$return] + * The justUp value allows you to test if this Key has just been released or not. * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to move. - * @param {number} x - The horizontal offset (distance) by which to move each point. Can be positive or negative. - * @param {number} y - The vertical offset (distance) by which to move each point. Can be positive or negative. + * When you check this value it will return `true` if the Key is up, otherwise `false`. * - * @return {Phaser.Geom.Triangle} The modified Triangle. - */ -var Offset = function (triangle, x, y) -{ - triangle.x1 += x; - triangle.y1 += y; - - triangle.x2 += x; - triangle.y2 += y; - - triangle.x3 += x; - triangle.y3 += y; - - return triangle; -}; - -module.exports = Offset; - - -/***/ }), -/* 506 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Point = __webpack_require__(4); - -// The three angle bisectors of a triangle meet in one point called the incenter. -// It is the center of the incircle, the circle inscribed in the triangle. - -function getLength (x1, y1, x2, y2) -{ - var x = x1 - x2; - var y = y1 - y2; - var magnitude = (x * x) + (y * y); - - return Math.sqrt(magnitude); -} - -/** - * Calculates the position of the incenter of a Triangle object. This is the point where its three angle bisectors meet and it's also the center of the incircle, which is the circle inscribed in the triangle. + * You can only call JustUp once per key release. It will only return `true` once, until the Key is pressed down and released again. + * This allows you to use it in situations where you want to check if this key is up without using an event, such as in a core game loop. * - * @function Phaser.Geom.Triangle.InCenter + * @function Phaser.Input.Keyboard.JustUp * @since 3.0.0 * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to find the incenter of. - * @param {Phaser.Geom.Point} [out] - An optional Point in which to store the coordinates. - * - * @return {Phaser.Geom.Point} Point (x, y) of the center pixel of the triangle. - */ -var InCenter = function (triangle, out) -{ - if (out === undefined) { out = new Point(); } - - var x1 = triangle.x1; - var y1 = triangle.y1; - - var x2 = triangle.x2; - var y2 = triangle.y2; - - var x3 = triangle.x3; - var y3 = triangle.y3; - - var d1 = getLength(x3, y3, x2, y2); - var d2 = getLength(x1, y1, x3, y3); - var d3 = getLength(x2, y2, x1, y1); - - var p = d1 + d2 + d3; - - out.x = (x1 * d1 + x2 * d2 + x3 * d3) / p; - out.y = (y1 * d1 + y2 * d2 + y3 * d3) / p; - - return out; -}; - -module.exports = InCenter; - - -/***/ }), -/* 507 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Creates a new Pixel Perfect Handler function. - * - * Access via `InputPlugin.makePixelPerfect` rather than calling it directly. - * - * @function Phaser.Input.CreatePixelPerfectHandler - * @since 3.10.0 - * - * @param {Phaser.Textures.TextureManager} textureManager - A reference to the Texture Manager. - * @param {number} alphaTolerance - The alpha level that the pixel should be above to be included as a successful interaction. + * @param {Phaser.Input.Keyboard.Key} key - The Key to check to see if it's just up or not. * - * @return {function} The new Pixel Perfect Handler function. + * @return {boolean} `true` if the Key was just released, otherwise `false`. */ -var CreatePixelPerfectHandler = function (textureManager, alphaTolerance) +var JustUp = function (key) { - return function (hitArea, x, y, gameObject) + if (key._justUp) { - var alpha = textureManager.getPixelAlpha(x, y, gameObject.texture.key, gameObject.frame.name); + key._justUp = false; - return (alpha && alpha >= alphaTolerance); - }; + return true; + } + else + { + return false; + } }; -module.exports = CreatePixelPerfectHandler; +module.exports = JustUp; /***/ }), -/* 508 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Creates a new Interactive Object. - * - * This is called automatically by the Input Manager when you enable a Game Object for input. - * - * The resulting Interactive Object is mapped to the Game Object's `input` property. - * - * @function Phaser.Input.CreateInteractiveObject - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to which this Interactive Object is bound. - * @param {any} hitArea - The hit area for this Interactive Object. Typically a geometry shape, like a Rectangle or Circle. - * @param {Phaser.Types.Input.HitAreaCallback} hitAreaCallback - The 'contains' check callback that the hit area shape will use for all hit tests. - * - * @return {Phaser.Types.Input.InteractiveObject} The new Interactive Object. - */ -var CreateInteractiveObject = function (gameObject, hitArea, hitAreaCallback) -{ - return { - - gameObject: gameObject, - - enabled: true, - alwaysEnabled: false, - draggable: false, - dropZone: false, - cursor: false, - - target: null, - camera: null, - - hitArea: hitArea, - hitAreaCallback: hitAreaCallback, - hitAreaDebug: null, - - // Has the dev specified their own shape, or is this bound to the texture size? - customHitArea: false, - - localX: 0, - localY: 0, - - // 0 = Not being dragged - // 1 = Being checked for dragging - // 2 = Being dragged - dragState: 0, - - dragStartX: 0, - dragStartY: 0, - dragStartXGlobal: 0, - dragStartYGlobal: 0, - - dragX: 0, - dragY: 0 - - }; -}; - -module.exports = CreateInteractiveObject; - - -/***/ }), -/* 509 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ 50165: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); +var Class = __webpack_require__(56694); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(94030); /** * @classdesc - * Contains information about a specific Gamepad Axis. - * Axis objects are created automatically by the Gamepad as they are needed. + * A generic Key object which can be passed to the Process functions (and so on) + * keycode must be an integer * - * @class Axis - * @memberof Phaser.Input.Gamepad + * @class Key + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Input.Keyboard * @constructor * @since 3.0.0 * - * @param {Phaser.Input.Gamepad.Gamepad} pad - A reference to the Gamepad that this Axis belongs to. - * @param {number} index - The index of this Axis. + * @param {Phaser.Input.Keyboard.KeyboardPlugin} plugin - The Keyboard Plugin instance that owns this Key object. + * @param {number} keyCode - The keycode of this key. */ -var Axis = new Class({ +var Key = new Class({ + + Extends: EventEmitter, initialize: - function Axis (pad, index) + function Key (plugin, keyCode) { - /** - * A reference to the Gamepad that this Axis belongs to. - * - * @name Phaser.Input.Gamepad.Axis#pad - * @type {Phaser.Input.Gamepad.Gamepad} - * @since 3.0.0 - */ - this.pad = pad; - - /** - * An event emitter to use to emit the axis events. - * - * @name Phaser.Input.Gamepad.Axis#events - * @type {Phaser.Events.EventEmitter} - * @since 3.0.0 - */ - this.events = pad.events; - - /** - * The index of this Axis. - * - * @name Phaser.Input.Gamepad.Axis#index - * @type {number} - * @since 3.0.0 - */ - this.index = index; + EventEmitter.call(this); /** - * The raw axis value, between -1 and 1 with 0 being dead center. - * Use the method `getValue` to get a normalized value with the threshold applied. + * The Keyboard Plugin instance that owns this Key object. * - * @name Phaser.Input.Gamepad.Axis#value - * @type {number} - * @default 0 - * @since 3.0.0 + * @name Phaser.Input.Keyboard.Key#plugin + * @type {Phaser.Input.Keyboard.KeyboardPlugin} + * @since 3.17.0 */ - this.value = 0; + this.plugin = plugin; /** - * Movement tolerance threshold below which axis values are ignored in `getValue`. + * The keycode of this key. * - * @name Phaser.Input.Gamepad.Axis#threshold + * @name Phaser.Input.Keyboard.Key#keyCode * @type {number} - * @default 0.1 * @since 3.0.0 */ - this.threshold = 0.1; - }, - - /** - * Internal update handler for this Axis. - * Called automatically by the Gamepad as part of its update. - * - * @method Phaser.Input.Gamepad.Axis#update - * @private - * @since 3.0.0 - * - * @param {number} value - The value of the axis movement. - */ - update: function (value) - { - this.value = value; - }, - - /** - * Applies the `threshold` value to the axis and returns it. - * - * @method Phaser.Input.Gamepad.Axis#getValue - * @since 3.0.0 - * - * @return {number} The axis value, adjusted for the movement threshold. - */ - getValue: function () - { - return (Math.abs(this.value) < this.threshold) ? 0 : this.value; - }, - - /** - * Destroys this Axis instance and releases external references it holds. - * - * @method Phaser.Input.Gamepad.Axis#destroy - * @since 3.10.0 - */ - destroy: function () - { - this.pad = null; - this.events = null; - } - -}); - -module.exports = Axis; - - -/***/ }), -/* 510 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Events = __webpack_require__(239); - -/** - * @classdesc - * Contains information about a specific button on a Gamepad. - * Button objects are created automatically by the Gamepad as they are needed. - * - * @class Button - * @memberof Phaser.Input.Gamepad - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Input.Gamepad.Gamepad} pad - A reference to the Gamepad that this Button belongs to. - * @param {number} index - The index of this Button. - */ -var Button = new Class({ - - initialize: + this.keyCode = keyCode; - function Button (pad, index) - { /** - * A reference to the Gamepad that this Button belongs to. + * The original DOM event. * - * @name Phaser.Input.Gamepad.Button#pad - * @type {Phaser.Input.Gamepad.Gamepad} + * @name Phaser.Input.Keyboard.Key#originalEvent + * @type {KeyboardEvent} * @since 3.0.0 */ - this.pad = pad; + this.originalEvent = undefined; /** - * An event emitter to use to emit the button events. + * Can this Key be processed? * - * @name Phaser.Input.Gamepad.Button#events - * @type {Phaser.Events.EventEmitter} + * @name Phaser.Input.Keyboard.Key#enabled + * @type {boolean} + * @default true * @since 3.0.0 */ - this.events = pad.manager; + this.enabled = true; /** - * The index of this Button. + * The "down" state of the key. This will remain `true` for as long as the keyboard thinks this key is held down. * - * @name Phaser.Input.Gamepad.Button#index - * @type {number} + * @name Phaser.Input.Keyboard.Key#isDown + * @type {boolean} + * @default false * @since 3.0.0 */ - this.index = index; + this.isDown = false; /** - * Between 0 and 1. + * The "up" state of the key. This will remain `true` for as long as the keyboard thinks this key is up. * - * @name Phaser.Input.Gamepad.Button#value - * @type {number} - * @default 0 + * @name Phaser.Input.Keyboard.Key#isUp + * @type {boolean} + * @default true * @since 3.0.0 */ - this.value = 0; + this.isUp = true; /** - * Can be set for analogue buttons to enable a 'pressure' threshold, - * before a button is considered as being 'pressed'. + * The down state of the ALT key, if pressed at the same time as this key. * - * @name Phaser.Input.Gamepad.Button#threshold - * @type {number} - * @default 1 + * @name Phaser.Input.Keyboard.Key#altKey + * @type {boolean} + * @default false * @since 3.0.0 */ - this.threshold = 1; + this.altKey = false; /** - * Is the Button being pressed down or not? + * The down state of the CTRL key, if pressed at the same time as this key. * - * @name Phaser.Input.Gamepad.Button#pressed + * @name Phaser.Input.Keyboard.Key#ctrlKey * @type {boolean} * @default false * @since 3.0.0 */ - this.pressed = false; - }, - - /** - * Internal update handler for this Button. - * Called automatically by the Gamepad as part of its update. - * - * @method Phaser.Input.Gamepad.Button#update - * @fires Phaser.Input.Gamepad.Events#BUTTON_DOWN - * @fires Phaser.Input.Gamepad.Events#BUTTON_UP - * @fires Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN - * @fires Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP - * @private - * @since 3.0.0 - * - * @param {number} value - The value of the button. Between 0 and 1. - */ - update: function (value) - { - this.value = value; - - var pad = this.pad; - var index = this.index; - - if (value >= this.threshold) - { - if (!this.pressed) - { - this.pressed = true; - this.events.emit(Events.BUTTON_DOWN, pad, this, value); - this.pad.emit(Events.GAMEPAD_BUTTON_DOWN, index, value, this); - } - } - else if (this.pressed) - { - this.pressed = false; - this.events.emit(Events.BUTTON_UP, pad, this, value); - this.pad.emit(Events.GAMEPAD_BUTTON_UP, index, value, this); - } - }, - - /** - * Destroys this Button instance and releases external references it holds. - * - * @method Phaser.Input.Gamepad.Button#destroy - * @since 3.10.0 - */ - destroy: function () - { - this.pad = null; - this.events = null; - } - -}); - -module.exports = Button; - - -/***/ }), -/* 511 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Axis = __webpack_require__(509); -var Button = __webpack_require__(510); -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(9); -var Vector2 = __webpack_require__(3); - -/** - * @classdesc - * A single Gamepad. - * - * These are created, updated and managed by the Gamepad Plugin. - * - * @class Gamepad - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Input.Gamepad - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Input.Gamepad.GamepadPlugin} manager - A reference to the Gamepad Plugin. - * @param {Phaser.Types.Input.Gamepad.Pad} pad - The Gamepad object, as extracted from GamepadEvent. - */ -var Gamepad = new Class({ - - Extends: EventEmitter, - - initialize: - - function Gamepad (manager, pad) - { - EventEmitter.call(this); + this.ctrlKey = false; /** - * A reference to the Gamepad Plugin. + * The down state of the SHIFT key, if pressed at the same time as this key. * - * @name Phaser.Input.Gamepad.Gamepad#manager - * @type {Phaser.Input.Gamepad.GamepadPlugin} + * @name Phaser.Input.Keyboard.Key#shiftKey + * @type {boolean} + * @default false * @since 3.0.0 */ - this.manager = manager; + this.shiftKey = false; /** - * A reference to the native Gamepad object that is connected to the browser. + * The down state of the Meta key, if pressed at the same time as this key. + * On a Mac the Meta Key is the Command key. On Windows keyboards, it's the Windows key. * - * @name Phaser.Input.Gamepad.Gamepad#pad - * @type {any} - * @since 3.10.0 + * @name Phaser.Input.Keyboard.Key#metaKey + * @type {boolean} + * @default false + * @since 3.16.0 */ - this.pad = pad; + this.metaKey = false; /** - * A string containing some information about the controller. - * - * This is not strictly specified, but in Firefox it will contain three pieces of information - * separated by dashes (-): two 4-digit hexadecimal strings containing the USB vendor and - * product id of the controller, and the name of the controller as provided by the driver. - * In Chrome it will contain the name of the controller as provided by the driver, - * followed by vendor and product 4-digit hexadecimal strings. + * The location of the modifier key. 0 for standard (or unknown), 1 for left, 2 for right, 3 for numpad. * - * @name Phaser.Input.Gamepad.Gamepad#id - * @type {string} + * @name Phaser.Input.Keyboard.Key#location + * @type {number} + * @default 0 * @since 3.0.0 */ - this.id = pad.id; + this.location = 0; /** - * An integer that is unique for each Gamepad currently connected to the system. - * This can be used to distinguish multiple controllers. - * Note that disconnecting a device and then connecting a new device may reuse the previous index. + * The timestamp when the key was last pressed down. * - * @name Phaser.Input.Gamepad.Gamepad#index + * @name Phaser.Input.Keyboard.Key#timeDown * @type {number} + * @default 0 * @since 3.0.0 */ - this.index = pad.index; - - var buttons = []; - - for (var i = 0; i < pad.buttons.length; i++) - { - buttons.push(new Button(this, i)); - } + this.timeDown = 0; /** - * An array of Gamepad Button objects, corresponding to the different buttons available on the Gamepad. + * The number of milliseconds this key was held down for in the previous down - up sequence. + * This value isn't updated every game step, only when the Key changes state. + * To get the current duration use the `getDuration` method. * - * @name Phaser.Input.Gamepad.Gamepad#buttons - * @type {Phaser.Input.Gamepad.Button[]} + * @name Phaser.Input.Keyboard.Key#duration + * @type {number} + * @default 0 * @since 3.0.0 */ - this.buttons = buttons; - - var axes = []; - - for (i = 0; i < pad.axes.length; i++) - { - axes.push(new Axis(this, i)); - } + this.duration = 0; /** - * An array of Gamepad Axis objects, corresponding to the different axes available on the Gamepad, if any. + * The timestamp when the key was last released. * - * @name Phaser.Input.Gamepad.Gamepad#axes - * @type {Phaser.Input.Gamepad.Axis[]} + * @name Phaser.Input.Keyboard.Key#timeUp + * @type {number} + * @default 0 * @since 3.0.0 */ - this.axes = axes; - - /** - * The Gamepad's Haptic Actuator (Vibration / Rumble support). - * This is highly experimental and only set if both present on the device, - * and exposed by both the hardware and browser. - * - * @name Phaser.Input.Gamepad.Gamepad#vibration - * @type {GamepadHapticActuator} - * @since 3.10.0 - */ - this.vibration = pad.vibrationActuator; - - // https://w3c.github.io/gamepad/#remapping - - var _noButton = { value: 0, pressed: false }; - - /** - * A reference to the Left Button in the Left Cluster. - * - * @name Phaser.Input.Gamepad.Gamepad#_LCLeft - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 - */ - this._LCLeft = (buttons[14]) ? buttons[14] : _noButton; - - /** - * A reference to the Right Button in the Left Cluster. - * - * @name Phaser.Input.Gamepad.Gamepad#_LCRight - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 - */ - this._LCRight = (buttons[15]) ? buttons[15] : _noButton; - - /** - * A reference to the Top Button in the Left Cluster. - * - * @name Phaser.Input.Gamepad.Gamepad#_LCTop - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 - */ - this._LCTop = (buttons[12]) ? buttons[12] : _noButton; - - /** - * A reference to the Bottom Button in the Left Cluster. - * - * @name Phaser.Input.Gamepad.Gamepad#_LCBottom - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 - */ - this._LCBottom = (buttons[13]) ? buttons[13] : _noButton; - - /** - * A reference to the Left Button in the Right Cluster. - * - * @name Phaser.Input.Gamepad.Gamepad#_RCLeft - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 - */ - this._RCLeft = (buttons[2]) ? buttons[2] : _noButton; - - /** - * A reference to the Right Button in the Right Cluster. - * - * @name Phaser.Input.Gamepad.Gamepad#_RCRight - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 - */ - this._RCRight = (buttons[1]) ? buttons[1] : _noButton; - - /** - * A reference to the Top Button in the Right Cluster. - * - * @name Phaser.Input.Gamepad.Gamepad#_RCTop - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 - */ - this._RCTop = (buttons[3]) ? buttons[3] : _noButton; - - /** - * A reference to the Bottom Button in the Right Cluster. - * - * @name Phaser.Input.Gamepad.Gamepad#_RCBottom - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 - */ - this._RCBottom = (buttons[0]) ? buttons[0] : _noButton; - - /** - * A reference to the Top Left Front Button (L1 Shoulder Button) - * - * @name Phaser.Input.Gamepad.Gamepad#_FBLeftTop - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 - */ - this._FBLeftTop = (buttons[4]) ? buttons[4] : _noButton; - - /** - * A reference to the Bottom Left Front Button (L2 Shoulder Button) - * - * @name Phaser.Input.Gamepad.Gamepad#_FBLeftBottom - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 - */ - this._FBLeftBottom = (buttons[6]) ? buttons[6] : _noButton; - - /** - * A reference to the Top Right Front Button (R1 Shoulder Button) - * - * @name Phaser.Input.Gamepad.Gamepad#_FBRightTop - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 - */ - this._FBRightTop = (buttons[5]) ? buttons[5] : _noButton; + this.timeUp = 0; /** - * A reference to the Bottom Right Front Button (R2 Shoulder Button) + * When a key is held down should it continuously fire the `down` event each time it repeats? * - * @name Phaser.Input.Gamepad.Gamepad#_FBRightBottom - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 - */ - this._FBRightBottom = (buttons[7]) ? buttons[7] : _noButton; - - var _noAxis = { value: 0 }; - - /** - * A reference to the Horizontal Axis for the Left Stick. + * By default it will emit the `down` event just once, but if you wish to receive the event + * for each repeat as well, enable this property. * - * @name Phaser.Input.Gamepad.Gamepad#_HAxisLeft - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 + * @name Phaser.Input.Keyboard.Key#emitOnRepeat + * @type {boolean} + * @default false + * @since 3.16.0 */ - this._HAxisLeft = (axes[0]) ? axes[0] : _noAxis; + this.emitOnRepeat = false; /** - * A reference to the Vertical Axis for the Left Stick. + * If a key is held down this holds down the number of times the key has 'repeated'. * - * @name Phaser.Input.Gamepad.Gamepad#_VAxisLeft - * @type {Phaser.Input.Gamepad.Button} - * @private - * @since 3.10.0 + * @name Phaser.Input.Keyboard.Key#repeats + * @type {number} + * @default 0 + * @since 3.0.0 */ - this._VAxisLeft = (axes[1]) ? axes[1] : _noAxis; + this.repeats = 0; /** - * A reference to the Horizontal Axis for the Right Stick. + * True if the key has just been pressed (NOTE: requires to be reset, see justDown getter) * - * @name Phaser.Input.Gamepad.Gamepad#_HAxisRight - * @type {Phaser.Input.Gamepad.Button} + * @name Phaser.Input.Keyboard.Key#_justDown + * @type {boolean} * @private - * @since 3.10.0 + * @default false + * @since 3.0.0 */ - this._HAxisRight = (axes[2]) ? axes[2] : _noAxis; + this._justDown = false; /** - * A reference to the Vertical Axis for the Right Stick. + * True if the key has just been pressed (NOTE: requires to be reset, see justDown getter) * - * @name Phaser.Input.Gamepad.Gamepad#_VAxisRight - * @type {Phaser.Input.Gamepad.Button} + * @name Phaser.Input.Keyboard.Key#_justUp + * @type {boolean} * @private - * @since 3.10.0 - */ - this._VAxisRight = (axes[3]) ? axes[3] : _noAxis; - - /** - * A Vector2 containing the most recent values from the Gamepad's left axis stick. - * This is updated automatically as part of the Gamepad.update cycle. - * The H Axis is mapped to the `Vector2.x` property, and the V Axis to the `Vector2.y` property. - * The values are based on the Axis thresholds. - * If the Gamepad does not have a left axis stick, the values will always be zero. - * - * @name Phaser.Input.Gamepad.Gamepad#leftStick - * @type {Phaser.Math.Vector2} - * @since 3.10.0 - */ - this.leftStick = new Vector2(); - - /** - * A Vector2 containing the most recent values from the Gamepad's right axis stick. - * This is updated automatically as part of the Gamepad.update cycle. - * The H Axis is mapped to the `Vector2.x` property, and the V Axis to the `Vector2.y` property. - * The values are based on the Axis thresholds. - * If the Gamepad does not have a right axis stick, the values will always be zero. - * - * @name Phaser.Input.Gamepad.Gamepad#rightStick - * @type {Phaser.Math.Vector2} - * @since 3.10.0 + * @default false + * @since 3.0.0 */ - this.rightStick = new Vector2(); + this._justUp = false; /** - * When was this Gamepad created? Used to avoid duplicate event spamming in the update loop. + * Internal tick counter. * - * @name Phaser.Input.Gamepad.Gamepad#_created + * @name Phaser.Input.Keyboard.Key#_tick * @type {number} * @private - * @since 3.50.0 + * @since 3.11.0 */ - this._created = performance.now(); + this._tick = -1; }, /** - * Gets the total number of axis this Gamepad claims to support. + * Controls if this Key will continuously emit a `down` event while being held down (true), + * or emit the event just once, on first press, and then skip future events (false). * - * @method Phaser.Input.Gamepad.Gamepad#getAxisTotal - * @since 3.10.0 + * @method Phaser.Input.Keyboard.Key#setEmitOnRepeat + * @since 3.16.0 * - * @return {number} The total number of axes this Gamepad claims to support. + * @param {boolean} value - Emit `down` events on repeated key down actions, or just once? + * + * @return {this} This Key instance. */ - getAxisTotal: function () + setEmitOnRepeat: function (value) { - return this.axes.length; + this.emitOnRepeat = value; + + return this; }, /** - * Gets the value of an axis based on the given index. - * The index must be valid within the range of axes supported by this Gamepad. - * The return value will be a float between 0 and 1. - * - * @method Phaser.Input.Gamepad.Gamepad#getAxisValue - * @since 3.10.0 + * Processes the Key Down action for this Key. + * Called automatically by the Keyboard Plugin. * - * @param {number} index - The index of the axes to get the value for. + * @method Phaser.Input.Keyboard.Key#onDown + * @fires Phaser.Input.Keyboard.Events#DOWN + * @since 3.16.0 * - * @return {number} The value of the axis, between 0 and 1. + * @param {KeyboardEvent} event - The native DOM Keyboard event. */ - getAxisValue: function (index) + onDown: function (event) { - return this.axes[index].getValue(); + this.originalEvent = event; + + if (!this.enabled) + { + return; + } + + this.altKey = event.altKey; + this.ctrlKey = event.ctrlKey; + this.shiftKey = event.shiftKey; + this.metaKey = event.metaKey; + this.location = event.location; + + this.repeats++; + + if (!this.isDown) + { + this.isDown = true; + this.isUp = false; + this.timeDown = event.timeStamp; + this.duration = 0; + this._justDown = true; + this._justUp = false; + + this.emit(Events.DOWN, this, event); + } + else if (this.emitOnRepeat) + { + this.emit(Events.DOWN, this, event); + } }, /** - * Sets the threshold value of all axis on this Gamepad. - * The value is a float between 0 and 1 and is the amount below which the axis is considered as not having been moved. + * Processes the Key Up action for this Key. + * Called automatically by the Keyboard Plugin. * - * @method Phaser.Input.Gamepad.Gamepad#setAxisThreshold - * @since 3.10.0 + * @method Phaser.Input.Keyboard.Key#onUp + * @fires Phaser.Input.Keyboard.Events#UP + * @since 3.16.0 * - * @param {number} value - A value between 0 and 1. + * @param {KeyboardEvent} event - The native DOM Keyboard event. */ - setAxisThreshold: function (value) + onUp: function (event) { - for (var i = 0; i < this.axes.length; i++) + this.originalEvent = event; + + if (!this.enabled) { - this.axes[i].threshold = value; + return; } + + this.isDown = false; + this.isUp = true; + this.timeUp = event.timeStamp; + this.duration = this.timeUp - this.timeDown; + this.repeats = 0; + + this._justDown = false; + this._justUp = true; + this._tick = -1; + + this.emit(Events.UP, this, event); }, /** - * Gets the total number of buttons this Gamepad claims to have. + * Resets this Key object back to its default un-pressed state. * - * @method Phaser.Input.Gamepad.Gamepad#getButtonTotal - * @since 3.10.0 + * As of version 3.60.0 it no longer resets the `enabled` or `preventDefault` flags. * - * @return {number} The total number of buttons this Gamepad claims to have. + * @method Phaser.Input.Keyboard.Key#reset + * @since 3.6.0 + * + * @return {this} This Key instance. */ - getButtonTotal: function () + reset: function () { - return this.buttons.length; + this.isDown = false; + this.isUp = true; + this.altKey = false; + this.ctrlKey = false; + this.shiftKey = false; + this.metaKey = false; + this.timeDown = 0; + this.duration = 0; + this.timeUp = 0; + this.repeats = 0; + this._justDown = false; + this._justUp = false; + this._tick = -1; + + return this; }, /** - * Gets the value of a button based on the given index. - * The index must be valid within the range of buttons supported by this Gamepad. + * Returns the duration, in ms, that the Key has been held down for. * - * The return value will be either 0 or 1 for an analogue button, or a float between 0 and 1 - * for a pressure-sensitive digital button, such as the shoulder buttons on a Dual Shock. + * If the key is not currently down it will return zero. * - * @method Phaser.Input.Gamepad.Gamepad#getButtonValue - * @since 3.10.0 + * To get the duration the Key was held down for in the previous up-down cycle, + * use the `Key.duration` property value instead. * - * @param {number} index - The index of the button to get the value for. + * @method Phaser.Input.Keyboard.Key#getDuration + * @since 3.17.0 * - * @return {number} The value of the button, between 0 and 1. + * @return {number} The duration, in ms, that the Key has been held down for if currently down. */ - getButtonValue: function (index) + getDuration: function () { - return this.buttons[index].value; + if (this.isDown) + { + return (this.plugin.game.loop.time - this.timeDown); + } + else + { + return 0; + } }, /** - * Returns if the button is pressed down or not. - * The index must be valid within the range of buttons supported by this Gamepad. - * - * @method Phaser.Input.Gamepad.Gamepad#isButtonDown - * @since 3.10.0 - * - * @param {number} index - The index of the button to get the value for. + * Removes any bound event handlers and removes local references. * - * @return {boolean} `true` if the button is considered as being pressed down, otherwise `false`. + * @method Phaser.Input.Keyboard.Key#destroy + * @since 3.16.0 */ - isButtonDown: function (index) - { - return this.buttons[index].pressed; - }, - - /** - * Internal update handler for this Gamepad. - * Called automatically by the Gamepad Manager as part of its update. - * - * @method Phaser.Input.Gamepad.Gamepad#update - * @private - * @since 3.0.0 - */ - update: function (pad) + destroy: function () { - if (pad.timestamp < this._created) - { - return; - } - - var i; + this.removeAllListeners(); - // Sync the button values + this.originalEvent = null; - var localButtons = this.buttons; - var gamepadButtons = pad.buttons; + this.plugin = null; + } - var len = localButtons.length; +}); - for (i = 0; i < len; i++) - { - localButtons[i].update(gamepadButtons[i].value); - } +module.exports = Key; - // Sync the axis values - var localAxes = this.axes; - var gamepadAxes = pad.axes; +/***/ }), - len = localAxes.length; +/***/ 11873: +/***/ ((module) => { - for (i = 0; i < len; i++) - { - localAxes[i].update(gamepadAxes[i]); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (len >= 2) - { - this.leftStick.set(localAxes[0].getValue(), localAxes[1].getValue()); +/** + * Keyboard Codes. + * + * @namespace Phaser.Input.Keyboard.KeyCodes + * @memberof Phaser.Input.Keyboard + * @since 3.0.0 + */ - if (len >= 4) - { - this.rightStick.set(localAxes[2].getValue(), localAxes[3].getValue()); - } - } - }, +var KeyCodes = { /** - * Destroys this Gamepad instance, its buttons and axes, and releases external references it holds. + * The BACKSPACE key. * - * @method Phaser.Input.Gamepad.Gamepad#destroy - * @since 3.10.0 + * @name Phaser.Input.Keyboard.KeyCodes.BACKSPACE + * @type {number} + * @since 3.0.0 */ - destroy: function () - { - this.removeAllListeners(); - - this.manager = null; - this.pad = null; - - var i; - - for (i = 0; i < this.buttons.length; i++) - { - this.buttons[i].destroy(); - } - - for (i = 0; i < this.axes.length; i++) - { - this.axes[i].destroy(); - } - - this.buttons = []; - this.axes = []; - }, + BACKSPACE: 8, /** - * Is this Gamepad currently connected or not? + * The TAB key. * - * @name Phaser.Input.Gamepad.Gamepad#connected - * @type {boolean} - * @default true + * @name Phaser.Input.Keyboard.KeyCodes.TAB + * @type {number} * @since 3.0.0 */ - connected: { - - get: function () - { - return this.pad.connected; - } + TAB: 9, - }, + /** + * The ENTER key. + * + * @name Phaser.Input.Keyboard.KeyCodes.ENTER + * @type {number} + * @since 3.0.0 + */ + ENTER: 13, /** - * A timestamp containing the most recent time this Gamepad was updated. + * The SHIFT key. * - * @name Phaser.Input.Gamepad.Gamepad#timestamp + * @name Phaser.Input.Keyboard.KeyCodes.SHIFT * @type {number} * @since 3.0.0 */ - timestamp: { + SHIFT: 16, - get: function () - { - return this.pad.timestamp; - } + /** + * The CTRL key. + * + * @name Phaser.Input.Keyboard.KeyCodes.CTRL + * @type {number} + * @since 3.0.0 + */ + CTRL: 17, - }, + /** + * The ALT key. + * + * @name Phaser.Input.Keyboard.KeyCodes.ALT + * @type {number} + * @since 3.0.0 + */ + ALT: 18, /** - * Is the Gamepad's Left button being pressed? - * If the Gamepad doesn't have this button it will always return false. - * This is the d-pad left button under standard Gamepad mapping. + * The PAUSE key. * - * @name Phaser.Input.Gamepad.Gamepad#left - * @type {boolean} - * @since 3.10.0 + * @name Phaser.Input.Keyboard.KeyCodes.PAUSE + * @type {number} + * @since 3.0.0 */ - left: { + PAUSE: 19, - get: function () - { - return this._LCLeft.pressed; - } + /** + * The CAPS_LOCK key. + * + * @name Phaser.Input.Keyboard.KeyCodes.CAPS_LOCK + * @type {number} + * @since 3.0.0 + */ + CAPS_LOCK: 20, - }, + /** + * The ESC key. + * + * @name Phaser.Input.Keyboard.KeyCodes.ESC + * @type {number} + * @since 3.0.0 + */ + ESC: 27, /** - * Is the Gamepad's Right button being pressed? - * If the Gamepad doesn't have this button it will always return false. - * This is the d-pad right button under standard Gamepad mapping. + * The SPACE key. * - * @name Phaser.Input.Gamepad.Gamepad#right - * @type {boolean} - * @since 3.10.0 + * @name Phaser.Input.Keyboard.KeyCodes.SPACE + * @type {number} + * @since 3.0.0 */ - right: { + SPACE: 32, - get: function () - { - return this._LCRight.pressed; - } + /** + * The PAGE_UP key. + * + * @name Phaser.Input.Keyboard.KeyCodes.PAGE_UP + * @type {number} + * @since 3.0.0 + */ + PAGE_UP: 33, - }, + /** + * The PAGE_DOWN key. + * + * @name Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN + * @type {number} + * @since 3.0.0 + */ + PAGE_DOWN: 34, /** - * Is the Gamepad's Up button being pressed? - * If the Gamepad doesn't have this button it will always return false. - * This is the d-pad up button under standard Gamepad mapping. + * The END key. * - * @name Phaser.Input.Gamepad.Gamepad#up - * @type {boolean} - * @since 3.10.0 + * @name Phaser.Input.Keyboard.KeyCodes.END + * @type {number} + * @since 3.0.0 */ - up: { + END: 35, - get: function () - { - return this._LCTop.pressed; - } + /** + * The HOME key. + * + * @name Phaser.Input.Keyboard.KeyCodes.HOME + * @type {number} + * @since 3.0.0 + */ + HOME: 36, - }, + /** + * The LEFT key. + * + * @name Phaser.Input.Keyboard.KeyCodes.LEFT + * @type {number} + * @since 3.0.0 + */ + LEFT: 37, /** - * Is the Gamepad's Down button being pressed? - * If the Gamepad doesn't have this button it will always return false. - * This is the d-pad down button under standard Gamepad mapping. + * The UP key. * - * @name Phaser.Input.Gamepad.Gamepad#down - * @type {boolean} - * @since 3.10.0 + * @name Phaser.Input.Keyboard.KeyCodes.UP + * @type {number} + * @since 3.0.0 */ - down: { + UP: 38, - get: function () - { - return this._LCBottom.pressed; - } + /** + * The RIGHT key. + * + * @name Phaser.Input.Keyboard.KeyCodes.RIGHT + * @type {number} + * @since 3.0.0 + */ + RIGHT: 39, - }, + /** + * The DOWN key. + * + * @name Phaser.Input.Keyboard.KeyCodes.DOWN + * @type {number} + * @since 3.0.0 + */ + DOWN: 40, /** - * Is the Gamepad's bottom button in the right button cluster being pressed? - * If the Gamepad doesn't have this button it will always return false. - * On a Dual Shock controller it's the X button. - * On an XBox controller it's the A button. + * The PRINT_SCREEN key. * - * @name Phaser.Input.Gamepad.Gamepad#A - * @type {boolean} - * @since 3.10.0 + * @name Phaser.Input.Keyboard.KeyCodes.PRINT_SCREEN + * @type {number} + * @since 3.0.0 */ - A: { + PRINT_SCREEN: 42, - get: function () - { - return this._RCBottom.pressed; - } + /** + * The INSERT key. + * + * @name Phaser.Input.Keyboard.KeyCodes.INSERT + * @type {number} + * @since 3.0.0 + */ + INSERT: 45, - }, + /** + * The DELETE key. + * + * @name Phaser.Input.Keyboard.KeyCodes.DELETE + * @type {number} + * @since 3.0.0 + */ + DELETE: 46, /** - * Is the Gamepad's top button in the right button cluster being pressed? - * If the Gamepad doesn't have this button it will always return false. - * On a Dual Shock controller it's the Triangle button. - * On an XBox controller it's the Y button. + * The ZERO key. * - * @name Phaser.Input.Gamepad.Gamepad#Y - * @type {boolean} - * @since 3.10.0 + * @name Phaser.Input.Keyboard.KeyCodes.ZERO + * @type {number} + * @since 3.0.0 */ - Y: { + ZERO: 48, - get: function () - { - return this._RCTop.pressed; - } + /** + * The ONE key. + * + * @name Phaser.Input.Keyboard.KeyCodes.ONE + * @type {number} + * @since 3.0.0 + */ + ONE: 49, - }, + /** + * The TWO key. + * + * @name Phaser.Input.Keyboard.KeyCodes.TWO + * @type {number} + * @since 3.0.0 + */ + TWO: 50, /** - * Is the Gamepad's left button in the right button cluster being pressed? - * If the Gamepad doesn't have this button it will always return false. - * On a Dual Shock controller it's the Square button. - * On an XBox controller it's the X button. + * The THREE key. * - * @name Phaser.Input.Gamepad.Gamepad#X - * @type {boolean} - * @since 3.10.0 + * @name Phaser.Input.Keyboard.KeyCodes.THREE + * @type {number} + * @since 3.0.0 */ - X: { + THREE: 51, - get: function () - { - return this._RCLeft.pressed; - } + /** + * The FOUR key. + * + * @name Phaser.Input.Keyboard.KeyCodes.FOUR + * @type {number} + * @since 3.0.0 + */ + FOUR: 52, - }, + /** + * The FIVE key. + * + * @name Phaser.Input.Keyboard.KeyCodes.FIVE + * @type {number} + * @since 3.0.0 + */ + FIVE: 53, /** - * Is the Gamepad's right button in the right button cluster being pressed? - * If the Gamepad doesn't have this button it will always return false. - * On a Dual Shock controller it's the Circle button. - * On an XBox controller it's the B button. + * The SIX key. * - * @name Phaser.Input.Gamepad.Gamepad#B - * @type {boolean} - * @since 3.10.0 + * @name Phaser.Input.Keyboard.KeyCodes.SIX + * @type {number} + * @since 3.0.0 */ - B: { + SIX: 54, - get: function () - { - return this._RCRight.pressed; - } + /** + * The SEVEN key. + * + * @name Phaser.Input.Keyboard.KeyCodes.SEVEN + * @type {number} + * @since 3.0.0 + */ + SEVEN: 55, - }, + /** + * The EIGHT key. + * + * @name Phaser.Input.Keyboard.KeyCodes.EIGHT + * @type {number} + * @since 3.0.0 + */ + EIGHT: 56, /** - * Returns the value of the Gamepad's top left shoulder button. - * If the Gamepad doesn't have this button it will always return zero. - * The value is a float between 0 and 1, corresponding to how depressed the button is. - * On a Dual Shock controller it's the L1 button. - * On an XBox controller it's the LB button. + * The NINE key. * - * @name Phaser.Input.Gamepad.Gamepad#L1 + * @name Phaser.Input.Keyboard.KeyCodes.NINE * @type {number} - * @since 3.10.0 + * @since 3.0.0 */ - L1: { + NINE: 57, - get: function () - { - return this._FBLeftTop.value; - } + /** + * The NUMPAD_ZERO key. + * + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ZERO + * @type {number} + * @since 3.0.0 + */ + NUMPAD_ZERO: 96, - }, + /** + * The NUMPAD_ONE key. + * + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ONE + * @type {number} + * @since 3.0.0 + */ + NUMPAD_ONE: 97, /** - * Returns the value of the Gamepad's bottom left shoulder button. - * If the Gamepad doesn't have this button it will always return zero. - * The value is a float between 0 and 1, corresponding to how depressed the button is. - * On a Dual Shock controller it's the L2 button. - * On an XBox controller it's the LT button. + * The NUMPAD_TWO key. * - * @name Phaser.Input.Gamepad.Gamepad#L2 + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_TWO * @type {number} - * @since 3.10.0 + * @since 3.0.0 */ - L2: { + NUMPAD_TWO: 98, - get: function () - { - return this._FBLeftBottom.value; - } + /** + * The NUMPAD_THREE key. + * + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_THREE + * @type {number} + * @since 3.0.0 + */ + NUMPAD_THREE: 99, - }, + /** + * The NUMPAD_FOUR key. + * + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FOUR + * @type {number} + * @since 3.0.0 + */ + NUMPAD_FOUR: 100, /** - * Returns the value of the Gamepad's top right shoulder button. - * If the Gamepad doesn't have this button it will always return zero. - * The value is a float between 0 and 1, corresponding to how depressed the button is. - * On a Dual Shock controller it's the R1 button. - * On an XBox controller it's the RB button. + * The NUMPAD_FIVE key. * - * @name Phaser.Input.Gamepad.Gamepad#R1 + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FIVE * @type {number} - * @since 3.10.0 + * @since 3.0.0 */ - R1: { + NUMPAD_FIVE: 101, - get: function () - { - return this._FBRightTop.value; - } + /** + * The NUMPAD_SIX key. + * + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SIX + * @type {number} + * @since 3.0.0 + */ + NUMPAD_SIX: 102, - }, + /** + * The NUMPAD_SEVEN key. + * + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SEVEN + * @type {number} + * @since 3.0.0 + */ + NUMPAD_SEVEN: 103, /** - * Returns the value of the Gamepad's bottom right shoulder button. - * If the Gamepad doesn't have this button it will always return zero. - * The value is a float between 0 and 1, corresponding to how depressed the button is. - * On a Dual Shock controller it's the R2 button. - * On an XBox controller it's the RT button. + * The NUMPAD_EIGHT key. * - * @name Phaser.Input.Gamepad.Gamepad#R2 + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_EIGHT * @type {number} - * @since 3.10.0 + * @since 3.0.0 */ - R2: { + NUMPAD_EIGHT: 104, - get: function () - { - return this._FBRightBottom.value; - } + /** + * The NUMPAD_NINE key. + * + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_NINE + * @type {number} + * @since 3.0.0 + */ + NUMPAD_NINE: 105, - } + /** + * The Numpad Addition (+) key. + * + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ADD + * @type {number} + * @since 3.21.0 + */ + NUMPAD_ADD: 107, -}); + /** + * The Numpad Subtraction (-) key. + * + * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SUBTRACT + * @type {number} + * @since 3.21.0 + */ + NUMPAD_SUBTRACT: 109, -module.exports = Gamepad; + /** + * The A key. + * + * @name Phaser.Input.Keyboard.KeyCodes.A + * @type {number} + * @since 3.0.0 + */ + A: 65, + /** + * The B key. + * + * @name Phaser.Input.Keyboard.KeyCodes.B + * @type {number} + * @since 3.0.0 + */ + B: 66, -/***/ }), -/* 512 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The C key. + * + * @name Phaser.Input.Keyboard.KeyCodes.C + * @type {number} + * @since 3.0.0 + */ + C: 67, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The D key. + * + * @name Phaser.Input.Keyboard.KeyCodes.D + * @type {number} + * @since 3.0.0 + */ + D: 68, -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(154); + /** + * The E key. + * + * @name Phaser.Input.Keyboard.KeyCodes.E + * @type {number} + * @since 3.0.0 + */ + E: 69, -/** - * @classdesc - * A generic Key object which can be passed to the Process functions (and so on) - * keycode must be an integer - * - * @class Key - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Input.Keyboard - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.KeyboardPlugin} plugin - The Keyboard Plugin instance that owns this Key object. - * @param {number} keyCode - The keycode of this key. - */ -var Key = new Class({ + /** + * The F key. + * + * @name Phaser.Input.Keyboard.KeyCodes.F + * @type {number} + * @since 3.0.0 + */ + F: 70, - Extends: EventEmitter, + /** + * The G key. + * + * @name Phaser.Input.Keyboard.KeyCodes.G + * @type {number} + * @since 3.0.0 + */ + G: 71, - initialize: + /** + * The H key. + * + * @name Phaser.Input.Keyboard.KeyCodes.H + * @type {number} + * @since 3.0.0 + */ + H: 72, - function Key (plugin, keyCode) - { - EventEmitter.call(this); + /** + * The I key. + * + * @name Phaser.Input.Keyboard.KeyCodes.I + * @type {number} + * @since 3.0.0 + */ + I: 73, - /** - * The Keyboard Plugin instance that owns this Key object. - * - * @name Phaser.Input.Keyboard.Key#plugin - * @type {Phaser.Input.Keyboard.KeyboardPlugin} - * @since 3.17.0 - */ - this.plugin = plugin; + /** + * The J key. + * + * @name Phaser.Input.Keyboard.KeyCodes.J + * @type {number} + * @since 3.0.0 + */ + J: 74, - /** - * The keycode of this key. - * - * @name Phaser.Input.Keyboard.Key#keyCode - * @type {number} - * @since 3.0.0 - */ - this.keyCode = keyCode; + /** + * The K key. + * + * @name Phaser.Input.Keyboard.KeyCodes.K + * @type {number} + * @since 3.0.0 + */ + K: 75, - /** - * The original DOM event. - * - * @name Phaser.Input.Keyboard.Key#originalEvent - * @type {KeyboardEvent} - * @since 3.0.0 - */ - this.originalEvent = undefined; + /** + * The L key. + * + * @name Phaser.Input.Keyboard.KeyCodes.L + * @type {number} + * @since 3.0.0 + */ + L: 76, - /** - * Can this Key be processed? - * - * @name Phaser.Input.Keyboard.Key#enabled - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.enabled = true; + /** + * The M key. + * + * @name Phaser.Input.Keyboard.KeyCodes.M + * @type {number} + * @since 3.0.0 + */ + M: 77, - /** - * The "down" state of the key. This will remain `true` for as long as the keyboard thinks this key is held down. - * - * @name Phaser.Input.Keyboard.Key#isDown - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.isDown = false; + /** + * The N key. + * + * @name Phaser.Input.Keyboard.KeyCodes.N + * @type {number} + * @since 3.0.0 + */ + N: 78, - /** - * The "up" state of the key. This will remain `true` for as long as the keyboard thinks this key is up. - * - * @name Phaser.Input.Keyboard.Key#isUp - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.isUp = true; + /** + * The O key. + * + * @name Phaser.Input.Keyboard.KeyCodes.O + * @type {number} + * @since 3.0.0 + */ + O: 79, - /** - * The down state of the ALT key, if pressed at the same time as this key. - * - * @name Phaser.Input.Keyboard.Key#altKey - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.altKey = false; + /** + * The P key. + * + * @name Phaser.Input.Keyboard.KeyCodes.P + * @type {number} + * @since 3.0.0 + */ + P: 80, - /** - * The down state of the CTRL key, if pressed at the same time as this key. - * - * @name Phaser.Input.Keyboard.Key#ctrlKey - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.ctrlKey = false; + /** + * The Q key. + * + * @name Phaser.Input.Keyboard.KeyCodes.Q + * @type {number} + * @since 3.0.0 + */ + Q: 81, - /** - * The down state of the SHIFT key, if pressed at the same time as this key. - * - * @name Phaser.Input.Keyboard.Key#shiftKey - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.shiftKey = false; + /** + * The R key. + * + * @name Phaser.Input.Keyboard.KeyCodes.R + * @type {number} + * @since 3.0.0 + */ + R: 82, - /** - * The down state of the Meta key, if pressed at the same time as this key. - * On a Mac the Meta Key is the Command key. On Windows keyboards, it's the Windows key. - * - * @name Phaser.Input.Keyboard.Key#metaKey - * @type {boolean} - * @default false - * @since 3.16.0 - */ - this.metaKey = false; + /** + * The S key. + * + * @name Phaser.Input.Keyboard.KeyCodes.S + * @type {number} + * @since 3.0.0 + */ + S: 83, - /** - * The location of the modifier key. 0 for standard (or unknown), 1 for left, 2 for right, 3 for numpad. - * - * @name Phaser.Input.Keyboard.Key#location - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.location = 0; + /** + * The T key. + * + * @name Phaser.Input.Keyboard.KeyCodes.T + * @type {number} + * @since 3.0.0 + */ + T: 84, - /** - * The timestamp when the key was last pressed down. - * - * @name Phaser.Input.Keyboard.Key#timeDown - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.timeDown = 0; + /** + * The U key. + * + * @name Phaser.Input.Keyboard.KeyCodes.U + * @type {number} + * @since 3.0.0 + */ + U: 85, - /** - * The number of milliseconds this key was held down for in the previous down - up sequence. - * This value isn't updated every game step, only when the Key changes state. - * To get the current duration use the `getDuration` method. - * - * @name Phaser.Input.Keyboard.Key#duration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.duration = 0; + /** + * The V key. + * + * @name Phaser.Input.Keyboard.KeyCodes.V + * @type {number} + * @since 3.0.0 + */ + V: 86, - /** - * The timestamp when the key was last released. - * - * @name Phaser.Input.Keyboard.Key#timeUp - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.timeUp = 0; + /** + * The W key. + * + * @name Phaser.Input.Keyboard.KeyCodes.W + * @type {number} + * @since 3.0.0 + */ + W: 87, - /** - * When a key is held down should it continuously fire the `down` event each time it repeats? - * - * By default it will emit the `down` event just once, but if you wish to receive the event - * for each repeat as well, enable this property. - * - * @name Phaser.Input.Keyboard.Key#emitOnRepeat - * @type {boolean} - * @default false - * @since 3.16.0 - */ - this.emitOnRepeat = false; + /** + * The X key. + * + * @name Phaser.Input.Keyboard.KeyCodes.X + * @type {number} + * @since 3.0.0 + */ + X: 88, - /** - * If a key is held down this holds down the number of times the key has 'repeated'. - * - * @name Phaser.Input.Keyboard.Key#repeats - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.repeats = 0; + /** + * The Y key. + * + * @name Phaser.Input.Keyboard.KeyCodes.Y + * @type {number} + * @since 3.0.0 + */ + Y: 89, - /** - * True if the key has just been pressed (NOTE: requires to be reset, see justDown getter) - * - * @name Phaser.Input.Keyboard.Key#_justDown - * @type {boolean} - * @private - * @default false - * @since 3.0.0 - */ - this._justDown = false; + /** + * The Z key. + * + * @name Phaser.Input.Keyboard.KeyCodes.Z + * @type {number} + * @since 3.0.0 + */ + Z: 90, - /** - * True if the key has just been pressed (NOTE: requires to be reset, see justDown getter) - * - * @name Phaser.Input.Keyboard.Key#_justUp - * @type {boolean} - * @private - * @default false - * @since 3.0.0 - */ - this._justUp = false; + /** + * The F1 key. + * + * @name Phaser.Input.Keyboard.KeyCodes.F1 + * @type {number} + * @since 3.0.0 + */ + F1: 112, - /** - * Internal tick counter. - * - * @name Phaser.Input.Keyboard.Key#_tick - * @type {number} - * @private - * @since 3.11.0 - */ - this._tick = -1; - }, + /** + * The F2 key. + * + * @name Phaser.Input.Keyboard.KeyCodes.F2 + * @type {number} + * @since 3.0.0 + */ + F2: 113, /** - * Controls if this Key will continuously emit a `down` event while being held down (true), - * or emit the event just once, on first press, and then skip future events (false). + * The F3 key. * - * @method Phaser.Input.Keyboard.Key#setEmitOnRepeat - * @since 3.16.0 - * - * @param {boolean} value - Emit `down` events on repeated key down actions, or just once? - * - * @return {this} This Key instance. + * @name Phaser.Input.Keyboard.KeyCodes.F3 + * @type {number} + * @since 3.0.0 */ - setEmitOnRepeat: function (value) - { - this.emitOnRepeat = value; + F3: 114, - return this; - }, + /** + * The F4 key. + * + * @name Phaser.Input.Keyboard.KeyCodes.F4 + * @type {number} + * @since 3.0.0 + */ + F4: 115, /** - * Processes the Key Down action for this Key. - * Called automatically by the Keyboard Plugin. + * The F5 key. * - * @method Phaser.Input.Keyboard.Key#onDown - * @fires Phaser.Input.Keyboard.Events#DOWN - * @since 3.16.0 - * - * @param {KeyboardEvent} event - The native DOM Keyboard event. + * @name Phaser.Input.Keyboard.KeyCodes.F5 + * @type {number} + * @since 3.0.0 */ - onDown: function (event) - { - this.originalEvent = event; + F5: 116, - if (!this.enabled) - { - return; - } + /** + * The F6 key. + * + * @name Phaser.Input.Keyboard.KeyCodes.F6 + * @type {number} + * @since 3.0.0 + */ + F6: 117, - this.altKey = event.altKey; - this.ctrlKey = event.ctrlKey; - this.shiftKey = event.shiftKey; - this.metaKey = event.metaKey; - this.location = event.location; - - this.repeats++; + /** + * The F7 key. + * + * @name Phaser.Input.Keyboard.KeyCodes.F7 + * @type {number} + * @since 3.0.0 + */ + F7: 118, - if (!this.isDown) - { - this.isDown = true; - this.isUp = false; - this.timeDown = event.timeStamp; - this.duration = 0; - this._justDown = true; - this._justUp = false; + /** + * The F8 key. + * + * @name Phaser.Input.Keyboard.KeyCodes.F8 + * @type {number} + * @since 3.0.0 + */ + F8: 119, - this.emit(Events.DOWN, this, event); - } - else if (this.emitOnRepeat) - { - this.emit(Events.DOWN, this, event); - } - }, + /** + * The F9 key. + * + * @name Phaser.Input.Keyboard.KeyCodes.F9 + * @type {number} + * @since 3.0.0 + */ + F9: 120, /** - * Processes the Key Up action for this Key. - * Called automatically by the Keyboard Plugin. + * The F10 key. * - * @method Phaser.Input.Keyboard.Key#onUp - * @fires Phaser.Input.Keyboard.Events#UP - * @since 3.16.0 - * - * @param {KeyboardEvent} event - The native DOM Keyboard event. + * @name Phaser.Input.Keyboard.KeyCodes.F10 + * @type {number} + * @since 3.0.0 */ - onUp: function (event) - { - this.originalEvent = event; + F10: 121, - if (!this.enabled) - { - return; - } - - this.isDown = false; - this.isUp = true; - this.timeUp = event.timeStamp; - this.duration = this.timeUp - this.timeDown; - this.repeats = 0; - - this._justDown = false; - this._justUp = true; - this._tick = -1; - - this.emit(Events.UP, this, event); - }, + /** + * The F11 key. + * + * @name Phaser.Input.Keyboard.KeyCodes.F11 + * @type {number} + * @since 3.0.0 + */ + F11: 122, /** - * Resets this Key object back to its default un-pressed state. + * The F12 key. * - * @method Phaser.Input.Keyboard.Key#reset - * @since 3.6.0 - * - * @return {this} This Key instance. + * @name Phaser.Input.Keyboard.KeyCodes.F12 + * @type {number} + * @since 3.0.0 */ - reset: function () - { - this.preventDefault = true; - this.enabled = true; - this.isDown = false; - this.isUp = true; - this.altKey = false; - this.ctrlKey = false; - this.shiftKey = false; - this.metaKey = false; - this.timeDown = 0; - this.duration = 0; - this.timeUp = 0; - this.repeats = 0; - this._justDown = false; - this._justUp = false; - this._tick = -1; + F12: 123, - return this; - }, + /** + * The SEMICOLON key. + * + * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON + * @type {number} + * @since 3.0.0 + */ + SEMICOLON: 186, /** - * Returns the duration, in ms, that the Key has been held down for. - * - * If the key is not currently down it will return zero. - * - * The get the duration the Key was held down for in the previous up-down cycle, - * use the `Key.duration` property value instead. + * The PLUS key. * - * @method Phaser.Input.Keyboard.Key#getDuration - * @since 3.17.0 - * - * @return {number} The duration, in ms, that the Key has been held down for if currently down. + * @name Phaser.Input.Keyboard.KeyCodes.PLUS + * @type {number} + * @since 3.0.0 */ - getDuration: function () - { - if (this.isDown) - { - return (this.plugin.game.loop.time - this.timeDown); - } - else - { - return 0; - } - }, + PLUS: 187, /** - * Removes any bound event handlers and removes local references. + * The COMMA key. * - * @method Phaser.Input.Keyboard.Key#destroy - * @since 3.16.0 + * @name Phaser.Input.Keyboard.KeyCodes.COMMA + * @type {number} + * @since 3.0.0 */ - destroy: function () - { - this.removeAllListeners(); + COMMA: 188, - this.originalEvent = null; + /** + * The MINUS key. + * + * @name Phaser.Input.Keyboard.KeyCodes.MINUS + * @type {number} + * @since 3.0.0 + */ + MINUS: 189, - this.plugin = null; - } + /** + * The PERIOD key. + * + * @name Phaser.Input.Keyboard.KeyCodes.PERIOD + * @type {number} + * @since 3.0.0 + */ + PERIOD: 190, -}); + /** + * The FORWARD_SLASH key. + * + * @name Phaser.Input.Keyboard.KeyCodes.FORWARD_SLASH + * @type {number} + * @since 3.0.0 + */ + FORWARD_SLASH: 191, -module.exports = Key; + /** + * The BACK_SLASH key. + * + * @name Phaser.Input.Keyboard.KeyCodes.BACK_SLASH + * @type {number} + * @since 3.0.0 + */ + BACK_SLASH: 220, + + /** + * The QUOTES key. + * + * @name Phaser.Input.Keyboard.KeyCodes.QUOTES + * @type {number} + * @since 3.0.0 + */ + QUOTES: 222, + + /** + * The BACKTICK key. + * + * @name Phaser.Input.Keyboard.KeyCodes.BACKTICK + * @type {number} + * @since 3.0.0 + */ + BACKTICK: 192, + + /** + * The OPEN_BRACKET key. + * + * @name Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET + * @type {number} + * @since 3.0.0 + */ + OPEN_BRACKET: 219, + + /** + * The CLOSED_BRACKET key. + * + * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET + * @type {number} + * @since 3.0.0 + */ + CLOSED_BRACKET: 221, + + /** + * The SEMICOLON_FIREFOX key. + * + * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON_FIREFOX + * @type {number} + * @since 3.0.0 + */ + SEMICOLON_FIREFOX: 59, + + /** + * The COLON key. + * + * @name Phaser.Input.Keyboard.KeyCodes.COLON + * @type {number} + * @since 3.0.0 + */ + COLON: 58, + + /** + * The COMMA_FIREFOX_WINDOWS key. + * + * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX_WINDOWS + * @type {number} + * @since 3.0.0 + */ + COMMA_FIREFOX_WINDOWS: 60, + + /** + * The COMMA_FIREFOX key. + * + * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX + * @type {number} + * @since 3.0.0 + */ + COMMA_FIREFOX: 62, + + /** + * The BRACKET_RIGHT_FIREFOX key. + * + * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_RIGHT_FIREFOX + * @type {number} + * @since 3.0.0 + */ + BRACKET_RIGHT_FIREFOX: 174, + + /** + * The BRACKET_LEFT_FIREFOX key. + * + * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_LEFT_FIREFOX + * @type {number} + * @since 3.0.0 + */ + BRACKET_LEFT_FIREFOX: 175 +}; + +module.exports = KeyCodes; /***/ }), -/* 513 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 48044: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Events = __webpack_require__(154); -var GetFastValue = __webpack_require__(2); -var ProcessKeyCombo = __webpack_require__(514); -var ResetKeyCombo = __webpack_require__(516); +var KeyCodes = __webpack_require__(11873); + +var KeyMap = {}; + +for (var key in KeyCodes) +{ + KeyMap[KeyCodes[key]] = key; +} + +module.exports = KeyMap; + + +/***/ }), + +/***/ 70331: +/***/ ((module) => { /** - * @classdesc - * A KeyCombo will listen for a specific string of keys from the Keyboard, and when it receives them - * it will emit a `keycombomatch` event from the Keyboard Manager. - * - * The keys to be listened for can be defined as: - * - * A string (i.e. 'ATARI') - * An array of either integers (key codes) or strings, or a mixture of both - * An array of objects (such as Key objects) with a public 'keyCode' property + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Returns `true` if the Key was released within the `duration` value given, based on the current + * game clock time. Or returns `false` if it either isn't up, or was released longer ago than the given duration. * - * For example, to listen for the Konami code (up, up, down, down, left, right, left, right, b, a, enter) - * you could pass the following array of key codes: + * @function Phaser.Input.Keyboard.UpDuration + * @since 3.0.0 * - * ```javascript - * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true }); + * @param {Phaser.Input.Keyboard.Key} key - The Key object to test. + * @param {number} [duration=50] - The duration, in ms, within which the key must have been released. * - * this.input.keyboard.on('keycombomatch', function (event) { - * console.log('Konami Code entered!'); - * }); - * ``` + * @return {boolean} `true` if the Key was released within `duration` ms ago, otherwise `false`. + */ +var UpDuration = function (key, duration) +{ + if (duration === undefined) { duration = 50; } + + var current = key.plugin.game.loop.time - key.timeUp; + + return (key.isUp && current < duration); +}; + +module.exports = UpDuration; + + +/***/ }), + +/***/ 7905: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var Features = __webpack_require__(90185); +var InputEvents = __webpack_require__(33963); +var NOOP = __webpack_require__(72283); + +// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent +// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md + +/** + * @classdesc + * The Mouse Manager is a helper class that belongs to the Input Manager. * - * Or, to listen for the user entering the word PHASER: + * Its role is to listen for native DOM Mouse Events and then pass them onto the Input Manager for further processing. * - * ```javascript - * this.input.keyboard.createCombo('PHASER'); - * ``` + * You do not need to create this class directly, the Input Manager will create an instance of it automatically. * - * @class KeyCombo - * @memberof Phaser.Input.Keyboard + * @class MouseManager + * @memberof Phaser.Input.Mouse * @constructor - * @listens Phaser.Input.Keyboard.Events#ANY_KEY_DOWN * @since 3.0.0 * - * @param {Phaser.Input.Keyboard.KeyboardPlugin} keyboardPlugin - A reference to the Keyboard Plugin. - * @param {(string|number[]|object[])} keys - The keys that comprise this combo. - * @param {Phaser.Types.Input.Keyboard.KeyComboConfig} [config] - A Key Combo configuration object. + * @param {Phaser.Input.InputManager} inputManager - A reference to the Input Manager. */ -var KeyCombo = new Class({ +var MouseManager = new Class({ initialize: - function KeyCombo (keyboardPlugin, keys, config) + function MouseManager (inputManager) { - if (config === undefined) { config = {}; } - - // Can't have a zero or single length combo (string or array based) - if (keys.length < 2) - { - return false; - } - /** - * A reference to the Keyboard Manager + * A reference to the Input Manager. * - * @name Phaser.Input.Keyboard.KeyCombo#manager - * @type {Phaser.Input.Keyboard.KeyboardPlugin} + * @name Phaser.Input.Mouse.MouseManager#manager + * @type {Phaser.Input.InputManager} * @since 3.0.0 */ - this.manager = keyboardPlugin; + this.manager = inputManager; /** - * A flag that controls if this Key Combo is actively processing keys or not. + * If `true` the DOM `mousedown` event will have `preventDefault` set. * - * @name Phaser.Input.Keyboard.KeyCombo#enabled + * @name Phaser.Input.Mouse.MouseManager#preventDefaultDown * @type {boolean} * @default true - * @since 3.0.0 + * @since 3.50.0 */ - this.enabled = true; + this.preventDefaultDown = true; /** - * An array of the keycodes that comprise this combo. + * If `true` the DOM `mouseup` event will have `preventDefault` set. * - * @name Phaser.Input.Keyboard.KeyCombo#keyCodes - * @type {array} - * @default [] - * @since 3.0.0 + * @name Phaser.Input.Mouse.MouseManager#preventDefaultUp + * @type {boolean} + * @default true + * @since 3.50.0 */ - this.keyCodes = []; - - // if 'keys' is a string we need to get the keycode of each character in it - - for (var i = 0; i < keys.length; i++) - { - var char = keys[i]; - - if (typeof char === 'string') - { - this.keyCodes.push(char.toUpperCase().charCodeAt(0)); - } - else if (typeof char === 'number') - { - this.keyCodes.push(char); - } - else if (char.hasOwnProperty('keyCode')) - { - this.keyCodes.push(char.keyCode); - } - } + this.preventDefaultUp = true; /** - * The current keyCode the combo is waiting for. + * If `true` the DOM `mousemove` event will have `preventDefault` set. * - * @name Phaser.Input.Keyboard.KeyCombo#current - * @type {number} - * @since 3.0.0 + * @name Phaser.Input.Mouse.MouseManager#preventDefaultMove + * @type {boolean} + * @default true + * @since 3.50.0 */ - this.current = this.keyCodes[0]; + this.preventDefaultMove = true; /** - * The current index of the key being waited for in the 'keys' string. + * If `true` the DOM `wheel` event will have `preventDefault` set. * - * @name Phaser.Input.Keyboard.KeyCombo#index - * @type {number} - * @default 0 - * @since 3.0.0 + * @name Phaser.Input.Mouse.MouseManager#preventDefaultWheel + * @type {boolean} + * @default true + * @since 3.50.0 */ - this.index = 0; + this.preventDefaultWheel = false; /** - * The length of this combo (in keycodes) + * A boolean that controls if the Mouse Manager is enabled or not. + * Can be toggled on the fly. * - * @name Phaser.Input.Keyboard.KeyCombo#size - * @type {number} + * @name Phaser.Input.Mouse.MouseManager#enabled + * @type {boolean} + * @default false * @since 3.0.0 */ - this.size = this.keyCodes.length; + this.enabled = false; /** - * The time the previous key in the combo was matched. + * The Mouse target, as defined in the Game Config. + * Typically the canvas to which the game is rendering, but can be any interactive DOM element. * - * @name Phaser.Input.Keyboard.KeyCombo#timeLastMatched - * @type {number} - * @default 0 + * @name Phaser.Input.Mouse.MouseManager#target + * @type {any} * @since 3.0.0 */ - this.timeLastMatched = 0; + this.target; /** - * Has this Key Combo been matched yet? + * If the mouse has been pointer locked successfully this will be set to true. * - * @name Phaser.Input.Keyboard.KeyCombo#matched + * @name Phaser.Input.Mouse.MouseManager#locked * @type {boolean} * @default false * @since 3.0.0 */ - this.matched = false; + this.locked = false; /** - * The time the entire combo was matched. + * The Mouse Move Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. * - * @name Phaser.Input.Keyboard.KeyCombo#timeMatched - * @type {number} - * @default 0 - * @since 3.0.0 + * @name Phaser.Input.Mouse.MouseManager#onMouseMove + * @type {function} + * @since 3.10.0 */ - this.timeMatched = 0; + this.onMouseMove = NOOP; /** - * If they press the wrong key do we reset the combo? + * The Mouse Down Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. * - * @name Phaser.Input.Keyboard.KeyCombo#resetOnWrongKey - * @type {boolean} - * @default 0 - * @since 3.0.0 + * @name Phaser.Input.Mouse.MouseManager#onMouseDown + * @type {function} + * @since 3.10.0 */ - this.resetOnWrongKey = GetFastValue(config, 'resetOnWrongKey', true); + this.onMouseDown = NOOP; /** - * The max delay in ms between each key press. Above this the combo is reset. 0 means disabled. + * The Mouse Up Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. * - * @name Phaser.Input.Keyboard.KeyCombo#maxKeyDelay - * @type {number} - * @default 0 - * @since 3.0.0 + * @name Phaser.Input.Mouse.MouseManager#onMouseUp + * @type {function} + * @since 3.10.0 */ - this.maxKeyDelay = GetFastValue(config, 'maxKeyDelay', 0); + this.onMouseUp = NOOP; /** - * If previously matched and they press the first key of the combo again, will it reset? + * The Mouse Down Event handler specifically for events on the Window. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. * - * @name Phaser.Input.Keyboard.KeyCombo#resetOnMatch - * @type {boolean} - * @default false - * @since 3.0.0 + * @name Phaser.Input.Mouse.MouseManager#onMouseDownWindow + * @type {function} + * @since 3.17.0 */ - this.resetOnMatch = GetFastValue(config, 'resetOnMatch', false); + this.onMouseDownWindow = NOOP; /** - * If the combo matches, will it delete itself? + * The Mouse Up Event handler specifically for events on the Window. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. * - * @name Phaser.Input.Keyboard.KeyCombo#deleteOnMatch - * @type {boolean} - * @default false - * @since 3.0.0 + * @name Phaser.Input.Mouse.MouseManager#onMouseUpWindow + * @type {function} + * @since 3.17.0 */ - this.deleteOnMatch = GetFastValue(config, 'deleteOnMatch', false); - - var _this = this; - - var onKeyDownHandler = function (event) - { - if (_this.matched || !_this.enabled) - { - return; - } + this.onMouseUpWindow = NOOP; - var matched = ProcessKeyCombo(event, _this); + /** + * The Mouse Over Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseOver + * @type {function} + * @since 3.16.0 + */ + this.onMouseOver = NOOP; - if (matched) - { - _this.manager.emit(Events.COMBO_MATCH, _this, event); + /** + * The Mouse Out Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseOut + * @type {function} + * @since 3.16.0 + */ + this.onMouseOut = NOOP; - if (_this.resetOnMatch) - { - ResetKeyCombo(_this); - } - else if (_this.deleteOnMatch) - { - _this.destroy(); - } - } - }; + /** + * The Mouse Wheel Event handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Mouse.MouseManager#onMouseWheel + * @type {function} + * @since 3.18.0 + */ + this.onMouseWheel = NOOP; /** - * The internal Key Down handler. + * Internal pointerLockChange handler. + * This function is sent the native DOM MouseEvent. + * Initially empty and bound in the `startListeners` method. * - * @name Phaser.Input.Keyboard.KeyCombo#onKeyDown - * @private - * @type {KeyboardKeydownCallback} - * @fires Phaser.Input.Keyboard.Events#COMBO_MATCH + * @name Phaser.Input.Mouse.MouseManager#pointerLockChange + * @type {function} * @since 3.0.0 */ - this.onKeyDown = onKeyDownHandler; + this.pointerLockChange = NOOP; - this.manager.on(Events.ANY_KEY_DOWN, this.onKeyDown); + /** + * Are the event listeners hooked into `window.top` or `window`? + * + * This is set during the `boot` sequence. If the browser does not have access to `window.top`, + * such as in cross-origin iframe environments, this property gets set to `false` and the events + * are hooked into `window` instead. + * + * @name Phaser.Input.Mouse.MouseManager#isTop + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.isTop = true; + + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); }, /** - * How far complete is this combo? A value between 0 and 1. + * The Touch Manager boot process. * - * @name Phaser.Input.Keyboard.KeyCombo#progress - * @type {number} - * @readonly + * @method Phaser.Input.Mouse.MouseManager#boot + * @private * @since 3.0.0 */ - progress: { + boot: function () + { + var config = this.manager.config; - get: function () + this.enabled = config.inputMouse; + this.target = config.inputMouseEventTarget; + this.passive = config.inputMousePassive; + + this.preventDefaultDown = config.inputMousePreventDefaultDown; + this.preventDefaultUp = config.inputMousePreventDefaultUp; + this.preventDefaultMove = config.inputMousePreventDefaultMove; + this.preventDefaultWheel = config.inputMousePreventDefaultWheel; + + if (!this.target) { - return this.index / this.size; + this.target = this.manager.game.canvas; + } + else if (typeof this.target === 'string') + { + this.target = document.getElementById(this.target); + } + + if (config.disableContextMenu) + { + this.disableContextMenu(); } + if (this.enabled && this.target) + { + this.startListeners(); + } }, /** - * Destroys this Key Combo and all of its references. + * Attempts to disable the context menu from appearing if you right-click on the game canvas, or specified input target. * - * @method Phaser.Input.Keyboard.KeyCombo#destroy + * Works by listening for the `contextmenu` event and prevent defaulting it. + * + * Use this if you need to enable right-button mouse support in your game, and the context + * menu keeps getting in the way. + * + * @method Phaser.Input.Mouse.MouseManager#disableContextMenu * @since 3.0.0 + * + * @return {this} This Mouse Manager instance. */ - destroy: function () + disableContextMenu: function () { - this.enabled = false; - this.keyCodes = []; + this.target.addEventListener('contextmenu', function (event) + { + event.preventDefault(); + return false; + }); - this.manager.off(Events.ANY_KEY_DOWN, this.onKeyDown); + return this; + }, - this.manager = null; - } + /** + * If the browser supports it, you can request that the pointer be locked to the browser window. + * + * This is classically known as 'FPS controls', where the pointer can't leave the browser until + * the user presses an exit key. + * + * If the browser successfully enters a locked state, a `POINTER_LOCK_CHANGE_EVENT` will be dispatched, + * from the games Input Manager, with an `isPointerLocked` property. + * + * It is important to note that pointer lock can only be enabled after an 'engagement gesture', + * see: https://w3c.github.io/pointerlock/#dfn-engagement-gesture. + * + * Note for Firefox: There is a bug in certain Firefox releases that cause native DOM events like + * `mousemove` to fire continuously when in pointer lock mode. You can get around this by setting + * `this.preventDefaultMove` to `false` in this class. You may also need to do the same for + * `preventDefaultDown` and/or `preventDefaultUp`. Please test combinations of these if you encounter + * the error. + * + * @method Phaser.Input.Mouse.MouseManager#requestPointerLock + * @since 3.0.0 + */ + requestPointerLock: function () + { + if (Features.pointerLock) + { + var element = this.target; -}); + element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock; -module.exports = KeyCombo; + element.requestPointerLock(); + } + }, + + /** + * If the browser supports pointer lock, this will request that the pointer lock is released. If + * the browser successfully enters a locked state, a 'POINTER_LOCK_CHANGE_EVENT' will be + * dispatched - from the game's input manager - with an `isPointerLocked` property. + * + * @method Phaser.Input.Mouse.MouseManager#releasePointerLock + * @since 3.0.0 + */ + releasePointerLock: function () + { + if (Features.pointerLock) + { + document.exitPointerLock = document.exitPointerLock || document.mozExitPointerLock || document.webkitExitPointerLock; + document.exitPointerLock(); + } + }, + /** + * Starts the Mouse Event listeners running. + * This is called automatically and does not need to be manually invoked. + * + * @method Phaser.Input.Mouse.MouseManager#startListeners + * @since 3.0.0 + */ + startListeners: function () + { + var target = this.target; -/***/ }), -/* 514 */ -/***/ (function(module, exports, __webpack_require__) { + if (!target) + { + return; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var _this = this; + var manager = this.manager; + var canvas = manager.canvas; + var autoFocus = (window && window.focus && manager.game.config.autoFocus); -var AdvanceKeyCombo = __webpack_require__(515); + this.onMouseMove = function (event) + { + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) + { + manager.onMouseMove(event); -/** - * Used internally by the KeyCombo class. - * - * @function Phaser.Input.Keyboard.ProcessKeyCombo - * @private - * @since 3.0.0 - * - * @param {KeyboardEvent} event - The native Keyboard Event. - * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to be processed. - * - * @return {boolean} `true` if the combo was matched, otherwise `false`. - */ -var ProcessKeyCombo = function (event, combo) -{ - if (combo.matched) - { - return true; - } + if (_this.preventDefaultMove) + { + event.preventDefault(); + } + } + }; - var comboMatched = false; - var keyMatched = false; + this.onMouseDown = function (event) + { + if (autoFocus) + { + window.focus(); + } - if (event.keyCode === combo.current) - { - // Key was correct + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) + { + manager.onMouseDown(event); - if (combo.index > 0 && combo.maxKeyDelay > 0) + if (_this.preventDefaultDown && event.target === canvas) + { + event.preventDefault(); + } + } + }; + + this.onMouseDownWindow = function (event) { - // We have to check to see if the delay between - // the new key and the old one was too long (if enabled) + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled && event.target !== canvas) + { + // Only process the event if the target isn't the canvas + manager.onMouseDown(event); + } + }; - var timeLimit = combo.timeLastMatched + combo.maxKeyDelay; + this.onMouseUp = function (event) + { + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) + { + manager.onMouseUp(event); - // Check if they pressed it in time or not - if (event.timeStamp <= timeLimit) + if (_this.preventDefaultUp && event.target === canvas) + { + event.preventDefault(); + } + } + }; + + this.onMouseUpWindow = function (event) + { + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled && event.target !== canvas) { - keyMatched = true; - comboMatched = AdvanceKeyCombo(event, combo); + // Only process the event if the target isn't the canvas + manager.onMouseUp(event); + } + }; + + this.onMouseOver = function (event) + { + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) + { + manager.setCanvasOver(event); + } + }; + + this.onMouseOut = function (event) + { + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) + { + manager.setCanvasOut(event); + } + }; + + this.onMouseWheel = function (event) + { + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) + { + manager.onMouseWheel(event); + } + + if (_this.preventDefaultWheel && event.target === canvas) + { + event.preventDefault(); } + }; + + var passive = { passive: true }; + + target.addEventListener('mousemove', this.onMouseMove); + target.addEventListener('mousedown', this.onMouseDown); + target.addEventListener('mouseup', this.onMouseUp); + target.addEventListener('mouseover', this.onMouseOver, passive); + target.addEventListener('mouseout', this.onMouseOut, passive); + + if (this.preventDefaultWheel) + { + target.addEventListener('wheel', this.onMouseWheel, { passive: false }); } else { - keyMatched = true; + target.addEventListener('wheel', this.onMouseWheel, passive); + } - // We don't check the time for the first key pressed, so just advance it - comboMatched = AdvanceKeyCombo(event, combo); + if (window && manager.game.config.inputWindowEvents) + { + try + { + window.top.addEventListener('mousedown', this.onMouseDownWindow, passive); + window.top.addEventListener('mouseup', this.onMouseUpWindow, passive); + } + catch (exception) + { + window.addEventListener('mousedown', this.onMouseDownWindow, passive); + window.addEventListener('mouseup', this.onMouseUpWindow, passive); + + this.isTop = false; + } } - } - if (!keyMatched && combo.resetOnWrongKey) + if (Features.pointerLock) + { + this.pointerLockChange = function (event) + { + var element = _this.target; + + _this.locked = (document.pointerLockElement === element || document.mozPointerLockElement === element || document.webkitPointerLockElement === element) ? true : false; + + manager.onPointerLockChange(event); + }; + + document.addEventListener('pointerlockchange', this.pointerLockChange, true); + document.addEventListener('mozpointerlockchange', this.pointerLockChange, true); + document.addEventListener('webkitpointerlockchange', this.pointerLockChange, true); + } + + this.enabled = true; + }, + + /** + * Stops the Mouse Event listeners. + * This is called automatically and does not need to be manually invoked. + * + * @method Phaser.Input.Mouse.MouseManager#stopListeners + * @since 3.0.0 + */ + stopListeners: function () { - // Wrong key was pressed - combo.index = 0; - combo.current = combo.keyCodes[0]; - } + var target = this.target; - if (comboMatched) + target.removeEventListener('mousemove', this.onMouseMove); + target.removeEventListener('mousedown', this.onMouseDown); + target.removeEventListener('mouseup', this.onMouseUp); + target.removeEventListener('mouseover', this.onMouseOver); + target.removeEventListener('mouseout', this.onMouseOut); + + if (window) + { + target = (this.isTop) ? window.top : window; + + target.removeEventListener('mousedown', this.onMouseDownWindow); + target.removeEventListener('mouseup', this.onMouseUpWindow); + } + + if (Features.pointerLock) + { + document.removeEventListener('pointerlockchange', this.pointerLockChange, true); + document.removeEventListener('mozpointerlockchange', this.pointerLockChange, true); + document.removeEventListener('webkitpointerlockchange', this.pointerLockChange, true); + } + }, + + /** + * Destroys this Mouse Manager instance. + * + * @method Phaser.Input.Mouse.MouseManager#destroy + * @since 3.0.0 + */ + destroy: function () { - combo.timeLastMatched = event.timeStamp; - combo.matched = true; - combo.timeMatched = event.timeStamp; + this.stopListeners(); + + this.target = null; + this.enabled = false; + this.manager = null; } - return comboMatched; -}; +}); -module.exports = ProcessKeyCombo; +module.exports = MouseManager; /***/ }), -/* 515 */ -/***/ (function(module, exports) { + +/***/ 11343: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Used internally by the KeyCombo class. - * Return `true` if it reached the end of the combo, `false` if not. - * - * @function Phaser.Input.Keyboard.AdvanceKeyCombo - * @private - * @since 3.0.0 - * - * @param {KeyboardEvent} event - The native Keyboard Event. - * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo object to advance. - * - * @return {boolean} `true` if it reached the end of the combo, `false` if not. + * @namespace Phaser.Input.Mouse */ -var AdvanceKeyCombo = function (event, combo) -{ - combo.timeLastMatched = event.timeStamp; - combo.index++; - if (combo.index === combo.size) - { - return true; - } - else - { - combo.current = combo.keyCodes[combo.index]; - return false; - } -}; +/* eslint-disable */ +module.exports = { -module.exports = AdvanceKeyCombo; + MouseManager: __webpack_require__(7905) + +}; +/* eslint-enable */ /***/ }), -/* 516 */ -/***/ (function(module, exports) { + +/***/ 37579: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * Used internally by the KeyCombo class. - * - * @function Phaser.Input.Keyboard.ResetKeyCombo - * @private - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.KeyCombo} combo - The KeyCombo to reset. - * - * @return {Phaser.Input.Keyboard.KeyCombo} The KeyCombo. - */ -var ResetKeyCombo = function (combo) -{ - combo.current = combo.keyCodes[0]; - combo.index = 0; - combo.timeLastMatched = 0; - combo.matched = false; - combo.timeMatched = 0; - - return combo; -}; - -module.exports = ResetKeyCombo; - +var Class = __webpack_require__(56694); +var InputEvents = __webpack_require__(33963); +var NOOP = __webpack_require__(72283); -/***/ }), -/* 517 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var MergeXHRSettings = __webpack_require__(240); +// https://developer.mozilla.org/en-US/docs/Web/API/Touch_events +// https://patrickhlauke.github.io/touch/tests/results/ +// https://www.html5rocks.com/en/mobile/touch/ /** - * Creates a new XMLHttpRequest (xhr) object based on the given File and XHRSettings - * and starts the download of it. It uses the Files own XHRSettings and merges them - * with the global XHRSettings object to set the xhr values before download. + * @classdesc + * The Touch Manager is a helper class that belongs to the Input Manager. * - * @function Phaser.Loader.XHRLoader - * @since 3.0.0 + * Its role is to listen for native DOM Touch Events and then pass them onto the Input Manager for further processing. * - * @param {Phaser.Loader.File} file - The File to download. - * @param {Phaser.Types.Loader.XHRSettingsObject} globalXHRSettings - The global XHRSettings object. + * You do not need to create this class directly, the Input Manager will create an instance of it automatically. * - * @return {XMLHttpRequest} The XHR object. + * @class TouchManager + * @memberof Phaser.Input.Touch + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Input.InputManager} inputManager - A reference to the Input Manager. */ -var XHRLoader = function (file, globalXHRSettings) -{ - var config = MergeXHRSettings(globalXHRSettings, file.xhrSettings); - - var xhr = new XMLHttpRequest(); - - xhr.open('GET', file.src, config.async, config.user, config.password); - - xhr.responseType = file.xhrSettings.responseType; - xhr.timeout = config.timeout; - - if (config.headers) - { - for (var key in config.headers) - { - xhr.setRequestHeader(key, config.headers[key]); - } - } +var TouchManager = new Class({ - if (config.header && config.headerValue) - { - xhr.setRequestHeader(config.header, config.headerValue); - } + initialize: - if (config.requestedWith) + function TouchManager (inputManager) { - xhr.setRequestHeader('X-Requested-With', config.requestedWith); - } + /** + * A reference to the Input Manager. + * + * @name Phaser.Input.Touch.TouchManager#manager + * @type {Phaser.Input.InputManager} + * @since 3.0.0 + */ + this.manager = inputManager; - if (config.overrideMimeType) - { - xhr.overrideMimeType(config.overrideMimeType); - } + /** + * If true the DOM events will have event.preventDefault applied to them, if false they will propagate fully. + * + * @name Phaser.Input.Touch.TouchManager#capture + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.capture = true; - if (config.withCredentials) - { - xhr.withCredentials = true; - } + /** + * A boolean that controls if the Touch Manager is enabled or not. + * Can be toggled on the fly. + * + * @name Phaser.Input.Touch.TouchManager#enabled + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.enabled = false; - // After a successful request, the xhr.response property will contain the requested data as a DOMString, ArrayBuffer, Blob, or Document (depending on what was set for responseType.) + /** + * The Touch Event target, as defined in the Game Config. + * Typically the canvas to which the game is rendering, but can be any interactive DOM element. + * + * @name Phaser.Input.Touch.TouchManager#target + * @type {any} + * @since 3.0.0 + */ + this.target; - xhr.onload = file.onLoad.bind(file, xhr); - xhr.onerror = file.onError.bind(file, xhr); - xhr.onprogress = file.onProgress.bind(file); + /** + * The Touch Start event handler function. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchStart + * @type {function} + * @since 3.0.0 + */ + this.onTouchStart = NOOP; - // This is the only standard method, the ones above are browser additions (maybe not universal?) - // xhr.onreadystatechange + /** + * The Touch Start event handler function specifically for events on the Window. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchStartWindow + * @type {function} + * @since 3.17.0 + */ + this.onTouchStartWindow = NOOP; - xhr.send(); + /** + * The Touch Move event handler function. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchMove + * @type {function} + * @since 3.0.0 + */ + this.onTouchMove = NOOP; - return xhr; -}; + /** + * The Touch End event handler function. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchEnd + * @type {function} + * @since 3.0.0 + */ + this.onTouchEnd = NOOP; -module.exports = XHRLoader; + /** + * The Touch End event handler function specifically for events on the Window. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchEndWindow + * @type {function} + * @since 3.17.0 + */ + this.onTouchEndWindow = NOOP; + /** + * The Touch Cancel event handler function. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchCancel + * @type {function} + * @since 3.15.0 + */ + this.onTouchCancel = NOOP; -/***/ }), -/* 518 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The Touch Cancel event handler function specifically for events on the Window. + * Initially empty and bound in the `startListeners` method. + * + * @name Phaser.Input.Touch.TouchManager#onTouchCancelWindow + * @type {function} + * @since 3.18.0 + */ + this.onTouchCancelWindow = NOOP; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Are the event listeners hooked into `window.top` or `window`? + * + * This is set during the `boot` sequence. If the browser does not have access to `window.top`, + * such as in cross-origin iframe environments, this property gets set to `false` and the events + * are hooked into `window` instead. + * + * @name Phaser.Input.Touch.TouchManager#isTop + * @type {boolean} + * @readonly + * @since 3.60.0 + */ + this.isTop = true; -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var HTML5AudioFile = __webpack_require__(519); -var IsPlainObject = __webpack_require__(7); + inputManager.events.once(InputEvents.MANAGER_BOOT, this.boot, this); + }, -/** - * @classdesc - * A single Audio File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#audio method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audio. - * - * @class AudioFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.AudioFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {any} [urlConfig] - The absolute or relative URL to load this file from in a config object. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - * @param {AudioContext} [audioContext] - The AudioContext this file will use to process itself. - */ -var AudioFile = new Class({ + /** + * The Touch Manager boot process. + * + * @method Phaser.Input.Touch.TouchManager#boot + * @private + * @since 3.0.0 + */ + boot: function () + { + var config = this.manager.config; - Extends: File, + this.enabled = config.inputTouch; + this.target = config.inputTouchEventTarget; + this.capture = config.inputTouchCapture; - initialize: + if (!this.target) + { + this.target = this.manager.game.canvas; + } + else if (typeof this.target === 'string') + { + this.target = document.getElementById(this.target); + } - // URL is an object created by AudioFile.findAudioURL - function AudioFile (loader, key, urlConfig, xhrSettings, audioContext) - { - if (IsPlainObject(key)) + if (config.disableContextMenu) { - var config = key; + this.disableContextMenu(); + } - key = GetFastValue(config, 'key'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - audioContext = GetFastValue(config, 'context', audioContext); + if (this.enabled && this.target) + { + this.startListeners(); } + }, - var fileConfig = { - type: 'audio', - cache: loader.cacheManager.audio, - extension: urlConfig.type, - responseType: 'arraybuffer', - key: key, - url: urlConfig.url, - xhrSettings: xhrSettings, - config: { context: audioContext } - }; + /** + * Attempts to disable the context menu from appearing if you touch-hold on the browser. + * + * Works by listening for the `contextmenu` event and prevent defaulting it. + * + * Use this if you need to disable the OS context menu on mobile. + * + * @method Phaser.Input.Touch.TouchManager#disableContextMenu + * @since 3.20.0 + * + * @return {this} This Touch Manager instance. + */ + disableContextMenu: function () + { + this.target.addEventListener('contextmenu', function (event) + { + event.preventDefault(); + return false; + }); - File.call(this, loader, fileConfig); + return this; }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * Starts the Touch Event listeners running as long as an input target is set. * - * @method Phaser.Loader.FileTypes.AudioFile#onProcess + * This method is called automatically if Touch Input is enabled in the game config, + * which it is by default. However, you can call it manually should you need to + * delay input capturing until later in the game. + * + * @method Phaser.Input.Touch.TouchManager#startListeners * @since 3.0.0 */ - onProcess: function () + startListeners: function () { - this.state = CONST.FILE_PROCESSING; + var target = this.target; - var _this = this; + if (!target) + { + return; + } - // interesting read https://github.com/WebAudio/web-audio-api/issues/1305 - this.config.context.decodeAudioData(this.xhrLoader.response, - function (audioBuffer) - { - _this.data = audioBuffer; + var _this = this; + var manager = this.manager; + var canvas = manager.canvas; + var autoFocus = (window && window.focus && manager.game.config.autoFocus); - _this.onProcessComplete(); - }, - function (e) + this.onTouchMove = function (event) + { + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) { - // eslint-disable-next-line no-console - console.error('Error decoding audio: ' + _this.key + ' - ', e ? e.message : null); + manager.onTouchMove(event); - _this.onProcessError(); + if (_this.capture && event.cancelable) + { + event.preventDefault(); + } } - ); - - this.config.context = null; - } + }; -}); + this.onTouchStart = function (event) + { + if (autoFocus) + { + window.focus(); + } -AudioFile.create = function (loader, key, urls, config, xhrSettings) -{ - var game = loader.systems.game; - var audioConfig = game.config.audio; - var deviceAudio = game.device.audio; + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) + { + manager.onTouchStart(event); - // url may be inside key, which may be an object - if (IsPlainObject(key)) - { - urls = GetFastValue(key, 'url', []); - config = GetFastValue(key, 'config', {}); - } + if (_this.capture && event.cancelable && event.target === canvas) + { + event.preventDefault(); + } + } + }; - var urlConfig = AudioFile.getAudioURL(game, urls); + this.onTouchStartWindow = function (event) + { + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled && event.target !== canvas) + { + // Only process the event if the target isn't the canvas + manager.onTouchStart(event); + } + }; - if (!urlConfig) - { - return null; - } + this.onTouchEnd = function (event) + { + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) + { + manager.onTouchEnd(event); - // https://developers.google.com/web/updates/2012/02/HTML5-audio-and-the-Web-Audio-API-are-BFFs - // var stream = GetFastValue(config, 'stream', false); + if (_this.capture && event.cancelable && event.target === canvas) + { + event.preventDefault(); + } + } + }; - if (deviceAudio.webAudio && !audioConfig.disableWebAudio) - { - return new AudioFile(loader, key, urlConfig, xhrSettings, game.sound.context); - } - else - { - return new HTML5AudioFile(loader, key, urlConfig, config); - } -}; + this.onTouchEndWindow = function (event) + { + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled && event.target !== canvas) + { + // Only process the event if the target isn't the canvas + manager.onTouchEnd(event); + } + }; -AudioFile.getAudioURL = function (game, urls) -{ - if (!Array.isArray(urls)) - { - urls = [ urls ]; - } + this.onTouchCancel = function (event) + { + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) + { + manager.onTouchCancel(event); - for (var i = 0; i < urls.length; i++) - { - var url = GetFastValue(urls[i], 'url', urls[i]); + if (_this.capture) + { + event.preventDefault(); + } + } + }; - if (url.indexOf('blob:') === 0 || url.indexOf('data:') === 0) + this.onTouchCancelWindow = function (event) { - return { - url: url, - type: '' - }; - } + if (!event.defaultPrevented && _this.enabled && manager && manager.enabled) + { + manager.onTouchCancel(event); + } + }; - var audioType = url.match(/\.([a-zA-Z0-9]+)($|\?)/); + var capture = this.capture; + var passive = { passive: true }; + var nonPassive = { passive: false }; - audioType = GetFastValue(urls[i], 'type', (audioType) ? audioType[1] : '').toLowerCase(); + target.addEventListener('touchstart', this.onTouchStart, (capture) ? nonPassive : passive); + target.addEventListener('touchmove', this.onTouchMove, (capture) ? nonPassive : passive); + target.addEventListener('touchend', this.onTouchEnd, (capture) ? nonPassive : passive); + target.addEventListener('touchcancel', this.onTouchCancel, (capture) ? nonPassive : passive); - if (game.device.audio[audioType]) + if (window && manager.game.config.inputWindowEvents) { - return { - url: url, - type: audioType - }; - } - } + try + { + window.top.addEventListener('touchstart', this.onTouchStartWindow, nonPassive); + window.top.addEventListener('touchend', this.onTouchEndWindow, nonPassive); + window.top.addEventListener('touchcancel', this.onTouchCancelWindow, nonPassive); + } + catch (exception) + { + window.addEventListener('touchstart', this.onTouchStartWindow, nonPassive); + window.addEventListener('touchend', this.onTouchEndWindow, nonPassive); + window.addEventListener('touchcancel', this.onTouchCancelWindow, nonPassive); - return null; -}; + this.isTop = false; + } + } -/** - * Adds an Audio or HTML5Audio file, or array of audio files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.audio('title', [ 'music/Title.ogg', 'music/Title.mp3', 'music/Title.m4a' ]); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Audio Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Audio Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Audio Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.audio({ - * key: 'title', - * url: [ 'music/Title.ogg', 'music/Title.mp3', 'music/Title.m4a' ] - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.AudioFileConfig` for more details. - * - * The URLs can be relative or absolute. If the URLs are relative the `Loader.baseURL` and `Loader.path` values will be prepended to them. - * - * Due to different browsers supporting different audio file types you should usually provide your audio files in a variety of formats. - * ogg, mp3 and m4a are the most common. If you provide an array of URLs then the Loader will determine which _one_ file to load based on - * browser support. - * - * If audio has been disabled in your game, either via the game config, or lack of support from the device, then no audio will be loaded. - * - * Note: The ability to load this type of file will only be available if the Audio File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#audio - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.AudioFileConfig|Phaser.Types.Loader.FileTypes.AudioFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {(string|string[])} [urls] - The absolute or relative URL to load the audio files from. - * @param {any} [config] - An object containing an `instances` property for HTML5Audio. Defaults to 1. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('audio', function (key, urls, config, xhrSettings) -{ - var game = this.systems.game; - var audioConfig = game.config.audio; - var deviceAudio = game.device.audio; + this.enabled = true; + }, - if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData)) + /** + * Stops the Touch Event listeners. + * This is called automatically and does not need to be manually invoked. + * + * @method Phaser.Input.Touch.TouchManager#stopListeners + * @since 3.0.0 + */ + stopListeners: function () { - // Sounds are disabled, so skip loading audio - return this; - } + var target = this.target; - var audioFile; + target.removeEventListener('touchstart', this.onTouchStart); + target.removeEventListener('touchmove', this.onTouchMove); + target.removeEventListener('touchend', this.onTouchEnd); + target.removeEventListener('touchcancel', this.onTouchCancel); - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) + if (window) { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - audioFile = AudioFile.create(this, key[i]); + target = (this.isTop) ? window.top : window; - if (audioFile) - { - this.addFile(audioFile); - } + target.removeEventListener('touchstart', this.onTouchStartWindow); + target.removeEventListener('touchend', this.onTouchEndWindow); + target.removeEventListener('touchcancel', this.onTouchCancelWindow); } - } - else + }, + + /** + * Destroys this Touch Manager instance. + * + * @method Phaser.Input.Touch.TouchManager#destroy + * @since 3.0.0 + */ + destroy: function () { - audioFile = AudioFile.create(this, key, urls, config, xhrSettings); + this.stopListeners(); - if (audioFile) - { - this.addFile(audioFile); - } + this.target = null; + this.enabled = false; + this.manager = null; } - return this; }); -module.exports = AudioFile; +module.exports = TouchManager; + + +/***/ }), + +/***/ 77423: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Input.Touch + */ + +/* eslint-disable */ +module.exports = { + + TouchManager: __webpack_require__(37579) + +}; +/* eslint-enable */ /***/ }), -/* 519 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 98035: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Events = __webpack_require__(95); -var File = __webpack_require__(23); -var GetFastValue = __webpack_require__(2); -var GetURL = __webpack_require__(155); -var IsPlainObject = __webpack_require__(7); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var Events = __webpack_require__(683); +var GetFastValue = __webpack_require__(72632); +var GetURL = __webpack_require__(30750); +var MergeXHRSettings = __webpack_require__(43531); +var XHRLoader = __webpack_require__(88490); +var XHRSettings = __webpack_require__(33868); /** * @classdesc - * A single Audio File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#audio method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audio. + * The base File class used by all File Types that the Loader can support. + * You shouldn't create an instance of a File directly, but should extend it with your own class, setting a custom type and processing methods. * - * @class HTML5AudioFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes + * @class File + * @memberof Phaser.Loader * @constructor * @since 3.0.0 * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.AudioFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [urlConfig] - The absolute or relative URL to load this file from. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that is going to load this File. + * @param {Phaser.Types.Loader.FileConfig} fileConfig - The file configuration object, as created by the file type. */ -var HTML5AudioFile = new Class({ - - Extends: File, +var File = new Class({ initialize: - function HTML5AudioFile (loader, key, urlConfig, audioConfig) + function File (loader, fileConfig) { - if (IsPlainObject(key)) + /** + * A reference to the Loader that is going to load this file. + * + * @name Phaser.Loader.File#loader + * @type {Phaser.Loader.LoaderPlugin} + * @since 3.0.0 + */ + this.loader = loader; + + /** + * A reference to the Cache, or Texture Manager, that is going to store this file if it loads. + * + * @name Phaser.Loader.File#cache + * @type {(Phaser.Cache.BaseCache|Phaser.Textures.TextureManager)} + * @since 3.7.0 + */ + this.cache = GetFastValue(fileConfig, 'cache', false); + + /** + * The file type string (image, json, etc) for sorting within the Loader. + * + * @name Phaser.Loader.File#type + * @type {string} + * @since 3.0.0 + */ + this.type = GetFastValue(fileConfig, 'type', false); + + if (!this.type) { - var config = key; + throw new Error('Invalid File type: ' + this.type); + } - key = GetFastValue(config, 'key'); - audioConfig = GetFastValue(config, 'config', audioConfig); + /** + * Unique cache key (unique within its file type) + * + * @name Phaser.Loader.File#key + * @type {string} + * @since 3.0.0 + */ + this.key = GetFastValue(fileConfig, 'key', false); + + var loadKey = this.key; + + if (loader.prefix && loader.prefix !== '') + { + this.key = loader.prefix + loadKey; } - var fileConfig = { - type: 'audio', - cache: loader.cacheManager.audio, - extension: urlConfig.type, - key: key, - url: urlConfig.url, - config: audioConfig - }; + if (!this.key) + { + throw new Error('Invalid File key: ' + this.key); + } - File.call(this, loader, fileConfig); + var url = GetFastValue(fileConfig, 'url'); - // New properties specific to this class - this.locked = 'ontouchstart' in window; - this.loaded = false; - this.filesLoaded = 0; - this.filesTotal = 0; - }, + if (url === undefined) + { + url = loader.path + loadKey + '.' + GetFastValue(fileConfig, 'extension', ''); + } + else if (typeof url === 'string' && !url.match(/^(?:blob:|data:|capacitor:\/\/|http:\/\/|https:\/\/|\/\/)/)) + { + url = loader.path + url; + } - /** - * Called when the file finishes loading. - * - * @method Phaser.Loader.FileTypes.HTML5AudioFile#onLoad - * @since 3.0.0 - */ - onLoad: function () - { - if (this.loaded) + /** + * The URL of the file, not including baseURL. + * + * Automatically has Loader.path prepended to it if a string. + * + * Can also be a JavaScript Object, such as the results of parsing JSON data. + * + * @name Phaser.Loader.File#url + * @type {object|string} + * @since 3.0.0 + */ + this.url = url; + + /** + * The final URL this file will load from, including baseURL and path. + * Set automatically when the Loader calls 'load' on this file. + * + * @name Phaser.Loader.File#src + * @type {string} + * @since 3.0.0 + */ + this.src = ''; + + /** + * The merged XHRSettings for this file. + * + * @name Phaser.Loader.File#xhrSettings + * @type {Phaser.Types.Loader.XHRSettingsObject} + * @since 3.0.0 + */ + this.xhrSettings = XHRSettings(GetFastValue(fileConfig, 'responseType', undefined)); + + if (GetFastValue(fileConfig, 'xhrSettings', false)) { - return; + this.xhrSettings = MergeXHRSettings(this.xhrSettings, GetFastValue(fileConfig, 'xhrSettings', {})); } - this.loaded = true; + /** + * The XMLHttpRequest instance (as created by XHR Loader) that is loading this File. + * + * @name Phaser.Loader.File#xhrLoader + * @type {?XMLHttpRequest} + * @since 3.0.0 + */ + this.xhrLoader = null; - this.loader.nextFile(this, true); + /** + * The current state of the file. One of the FILE_CONST values. + * + * @name Phaser.Loader.File#state + * @type {number} + * @since 3.0.0 + */ + this.state = (typeof(this.url) === 'function') ? CONST.FILE_POPULATED : CONST.FILE_PENDING; + + /** + * The total size of this file. + * Set by onProgress and only if loading via XHR. + * + * @name Phaser.Loader.File#bytesTotal + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.bytesTotal = 0; + + /** + * Updated as the file loads. + * Only set if loading via XHR. + * + * @name Phaser.Loader.File#bytesLoaded + * @type {number} + * @default -1 + * @since 3.0.0 + */ + this.bytesLoaded = -1; + + /** + * A percentage value between 0 and 1 indicating how much of this file has loaded. + * Only set if loading via XHR. + * + * @name Phaser.Loader.File#percentComplete + * @type {number} + * @default -1 + * @since 3.0.0 + */ + this.percentComplete = -1; + + /** + * For CORs based loading. + * If this is undefined then the File will check BaseLoader.crossOrigin and use that (if set) + * + * @name Phaser.Loader.File#crossOrigin + * @type {(string|undefined)} + * @since 3.0.0 + */ + this.crossOrigin = undefined; + + /** + * The processed file data, stored here after the file has loaded. + * + * @name Phaser.Loader.File#data + * @type {*} + * @since 3.0.0 + */ + this.data = undefined; + + /** + * A config object that can be used by file types to store transitional data. + * + * @name Phaser.Loader.File#config + * @type {*} + * @since 3.0.0 + */ + this.config = GetFastValue(fileConfig, 'config', {}); + + /** + * If this is a multipart file, i.e. an atlas and its json together, then this is a reference + * to the parent MultiFile. Set and used internally by the Loader or specific file types. + * + * @name Phaser.Loader.File#multiFile + * @type {?Phaser.Loader.MultiFile} + * @since 3.7.0 + */ + this.multiFile; + + /** + * Does this file have an associated linked file? Such as an image and a normal map. + * Atlases and Bitmap Fonts use the multiFile, because those files need loading together but aren't + * actually bound by data, where-as a linkFile is. + * + * @name Phaser.Loader.File#linkFile + * @type {?Phaser.Loader.File} + * @since 3.7.0 + */ + this.linkFile; }, /** - * Called if the file errors while loading. + * Links this File with another, so they depend upon each other for loading and processing. * - * @method Phaser.Loader.FileTypes.HTML5AudioFile#onError - * @since 3.0.0 + * @method Phaser.Loader.File#setLink + * @since 3.7.0 + * + * @param {Phaser.Loader.File} fileB - The file to link to this one. */ - onError: function () + setLink: function (fileB) { - for (var i = 0; i < this.data.length; i++) - { - var audio = this.data[i]; - - audio.oncanplaythrough = null; - audio.onerror = null; - } + this.linkFile = fileB; - this.loader.nextFile(this, false); + fileB.linkFile = this; }, /** - * Called during the file load progress. Is sent a DOM ProgressEvent. + * Resets the XHRLoader instance this file is using. * - * @method Phaser.Loader.FileTypes.HTML5AudioFile#onProgress - * @fires Phaser.Loader.Events#FILE_PROGRESS + * @method Phaser.Loader.File#resetXHR * @since 3.0.0 */ - onProgress: function (event) + resetXHR: function () { - var audio = event.target; - - audio.oncanplaythrough = null; - audio.onerror = null; - - this.filesLoaded++; - - this.percentComplete = Math.min((this.filesLoaded / this.filesTotal), 1); - - this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete); - - if (this.filesLoaded === this.filesTotal) + if (this.xhrLoader) { - this.onLoad(); + this.xhrLoader.onload = undefined; + this.xhrLoader.onerror = undefined; + this.xhrLoader.onprogress = undefined; } }, @@ -148615,83477 +140916,113229 @@ var HTML5AudioFile = new Class({ * During the load the methods onLoad, onError and onProgress are called, based on the XHR events. * You shouldn't normally call this method directly, it's meant to be invoked by the Loader. * - * @method Phaser.Loader.FileTypes.HTML5AudioFile#load + * @method Phaser.Loader.File#load * @since 3.0.0 */ load: function () { - this.data = []; - - var instances = (this.config && this.config.instances) || 1; - - this.filesTotal = instances; - this.filesLoaded = 0; - this.percentComplete = 0; - - for (var i = 0; i < instances; i++) + if (this.state === CONST.FILE_POPULATED) { - var audio = new Audio(); - - if (!audio.dataset) - { - audio.dataset = {}; - } + // Can happen for example in a JSONFile if they've provided a JSON object instead of a URL + this.loader.nextFile(this, true); + } + else + { + this.state = CONST.FILE_LOADING; - audio.dataset.name = this.key + ('0' + i).slice(-2); - audio.dataset.used = 'false'; + this.src = GetURL(this, this.loader.baseURL); - if (this.locked) + if (this.src.indexOf('data:') === 0) { - audio.dataset.locked = 'true'; + console.warn('Local data URIs are not supported: ' + this.key); } else { - audio.dataset.locked = 'false'; + // The creation of this XHRLoader starts the load process going. + // It will automatically call the following, based on the load outcome: + // + // xhr.onload = this.onLoad + // xhr.onerror = this.onError + // xhr.onprogress = this.onProgress - audio.preload = 'auto'; - audio.oncanplaythrough = this.onProgress.bind(this); - audio.onerror = this.onError.bind(this); + this.xhrLoader = XHRLoader(this, this.loader.xhr); } - - this.data.push(audio); } + }, - for (i = 0; i < this.data.length; i++) + /** + * Called when the file finishes loading, is sent a DOM ProgressEvent. + * + * @method Phaser.Loader.File#onLoad + * @since 3.0.0 + * + * @param {XMLHttpRequest} xhr - The XMLHttpRequest that caused this onload event. + * @param {ProgressEvent} event - The DOM ProgressEvent that resulted from this load. + */ + onLoad: function (xhr, event) + { + var isLocalFile = xhr.responseURL && this.loader.localSchemes.some(function (scheme) { - audio = this.data[i]; - audio.src = GetURL(this, this.loader.baseURL); + return xhr.responseURL.indexOf(scheme) === 0; + }); - if (!this.locked) - { - audio.load(); - } - } + var localFileOk = (isLocalFile && event.target.status === 0); - if (this.locked) + var success = !(event.target && event.target.status !== 200) || localFileOk; + + // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called. + if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) { - // This is super-dangerous but works. Race condition potential high. - // Is there another way? - setTimeout(this.onLoad.bind(this)); + success = false; } - } -}); + this.state = CONST.FILE_LOADED; -module.exports = HTML5AudioFile; + this.resetXHR(); + this.loader.nextFile(this, success); + }, -/***/ }), -/* 520 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Called if the file errors while loading, is sent a DOM ProgressEvent. + * + * @method Phaser.Loader.File#onError + * @since 3.0.0 + * + * @param {XMLHttpRequest} xhr - The XMLHttpRequest that caused this onload event. + * @param {ProgressEvent} event - The DOM ProgressEvent that resulted from this error. + */ + onError: function () + { + this.resetXHR(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.loader.nextFile(this, false); + }, -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); + /** + * Called during the file load progress. Is sent a DOM ProgressEvent. + * + * @method Phaser.Loader.File#onProgress + * @fires Phaser.Loader.Events#FILE_PROGRESS + * @since 3.0.0 + * + * @param {ProgressEvent} event - The DOM ProgressEvent. + */ + onProgress: function (event) + { + if (event.lengthComputable) + { + this.bytesLoaded = event.loaded; + this.bytesTotal = event.total; -/** - * @classdesc - * A single Script File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#script method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#script. - * - * @class ScriptFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.ScriptFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var ScriptFile = new Class({ + this.percentComplete = Math.min((this.bytesLoaded / this.bytesTotal), 1); - Extends: File, - - initialize: - - function ScriptFile (loader, key, url, xhrSettings) - { - var extension = 'js'; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); + this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete); } - - var fileConfig = { - type: 'script', - cache: false, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings - }; - - File.call(this, loader, fileConfig); }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * Usually overridden by the FileTypes and is called by Loader.nextFile. + * This method controls what extra work this File does with its loaded data, for example a JSON file will parse itself during this stage. * - * @method Phaser.Loader.FileTypes.ScriptFile#onProcess - * @since 3.7.0 + * @method Phaser.Loader.File#onProcess + * @since 3.0.0 */ onProcess: function () { this.state = CONST.FILE_PROCESSING; - this.data = document.createElement('script'); - this.data.language = 'javascript'; - this.data.type = 'text/javascript'; - this.data.defer = false; - this.data.text = this.xhrLoader.responseText; - - document.head.appendChild(this.data); - this.onProcessComplete(); - } - -}); + }, -/** - * Adds a Script file, or array of Script files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.script('aliens', 'lib/aliens.js'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String and not already in-use by another file in the Loader. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.script({ - * key: 'aliens', - * url: 'lib/aliens.js' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.ScriptFileConfig` for more details. - * - * Once the file has finished loading it will automatically be converted into a script element - * via `document.createElement('script')`. It will have its language set to JavaScript, `defer` set to - * false and then the resulting element will be appended to `document.head`. Any code then in the - * script will be executed. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.js". It will always add `.js` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Script File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#script - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.ScriptFileConfig|Phaser.Types.Loader.FileTypes.ScriptFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('script', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) + /** + * Called when the File has completed processing. + * Checks on the state of its multifile, if set. + * + * @method Phaser.Loader.File#onProcessComplete + * @since 3.7.0 + */ + onProcessComplete: function () { - for (var i = 0; i < key.length; i++) + this.state = CONST.FILE_COMPLETE; + + if (this.multiFile) { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new ScriptFile(this, key[i])); + this.multiFile.onFileComplete(this); } - } - else - { - this.addFile(new ScriptFile(this, key, url, xhrSettings)); - } - - return this; -}); - -module.exports = ScriptFile; - - -/***/ }), -/* 521 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var ArcadeImage = __webpack_require__(522); -var ArcadeSprite = __webpack_require__(157); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(62); -var PhysicsGroup = __webpack_require__(524); -var StaticPhysicsGroup = __webpack_require__(525); - -/** - * @classdesc - * The Arcade Physics Factory allows you to easily create Arcade Physics enabled Game Objects. - * Objects that are created by this Factory are automatically added to the physics world. - * - * @class Factory - * @memberof Phaser.Physics.Arcade - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Physics.Arcade.World} world - The Arcade Physics World instance. - */ -var Factory = new Class({ - - initialize: - - function Factory (world) - { - /** - * A reference to the Arcade Physics World. - * - * @name Phaser.Physics.Arcade.Factory#world - * @type {Phaser.Physics.Arcade.World} - * @since 3.0.0 - */ - this.world = world; - - /** - * A reference to the Scene this Arcade Physics instance belongs to. - * - * @name Phaser.Physics.Arcade.Factory#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = world.scene; - /** - * A reference to the Scene.Systems this Arcade Physics instance belongs to. - * - * @name Phaser.Physics.Arcade.Factory#sys - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.sys = world.scene.sys; + this.loader.fileProcessComplete(this); }, /** - * Creates a new Arcade Physics Collider object. - * - * @method Phaser.Physics.Arcade.Factory#collider - * @since 3.0.0 - * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group|Phaser.GameObjects.Group[])} object1 - The first object to check for collision. - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group|Phaser.GameObjects.Group[])} object2 - The second object to check for collision. - * @param {ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects collide. Must return a boolean. - * @param {*} [callbackContext] - The scope in which to call the callbacks. + * Called when the File has completed processing but it generated an error. + * Checks on the state of its multifile, if set. * - * @return {Phaser.Physics.Arcade.Collider} The Collider that was created. + * @method Phaser.Loader.File#onProcessError + * @since 3.7.0 */ - collider: function (object1, object2, collideCallback, processCallback, callbackContext) + onProcessError: function () { - return this.world.addCollider(object1, object2, collideCallback, processCallback, callbackContext); + // eslint-disable-next-line no-console + console.error('Failed to process file: %s "%s"', this.type, this.key); + + this.state = CONST.FILE_ERRORED; + + if (this.multiFile) + { + this.multiFile.onFileFailed(this); + } + + this.loader.fileProcessComplete(this); }, /** - * Creates a new Arcade Physics Collider Overlap object. - * - * @method Phaser.Physics.Arcade.Factory#overlap - * @since 3.0.0 + * Checks if a key matching the one used by this file exists in the target Cache or not. + * This is called automatically by the LoaderPlugin to decide if the file can be safely + * loaded or will conflict. * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group|Phaser.GameObjects.Group[])} object1 - The first object to check for overlap. - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group|Phaser.GameObjects.Group[])} object2 - The second object to check for overlap. - * @param {ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects collide. Must return a boolean. - * @param {*} [callbackContext] - The scope in which to call the callbacks. + * @method Phaser.Loader.File#hasCacheConflict + * @since 3.7.0 * - * @return {Phaser.Physics.Arcade.Collider} The Collider that was created. + * @return {boolean} `true` if adding this file will cause a conflict, otherwise `false`. */ - overlap: function (object1, object2, collideCallback, processCallback, callbackContext) + hasCacheConflict: function () { - return this.world.addOverlap(object1, object2, collideCallback, processCallback, callbackContext); + return (this.cache && this.cache.exists(this.key)); }, /** - * Adds an Arcade Physics Body to the given Game Object. - * - * @method Phaser.Physics.Arcade.Factory#existing - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] - * - * @param {Phaser.GameObjects.GameObject} gameObject - A Game Object. - * @param {boolean} [isStatic=false] - Create a Static body (true) or Dynamic body (false). + * Adds this file to its target cache upon successful loading and processing. + * This method is often overridden by specific file types. * - * @return {Phaser.Types.Physics.Arcade.GameObjectWithBody} The Game Object. + * @method Phaser.Loader.File#addToCache + * @since 3.7.0 */ - existing: function (gameObject, isStatic) + addToCache: function () { - var type = (isStatic) ? CONST.STATIC_BODY : CONST.DYNAMIC_BODY; - - this.world.enableBody(gameObject, type); - - return gameObject; + if (this.cache && this.data) + { + this.cache.add(this.key, this.data); + } }, /** - * Creates a new Arcade Image object with a Static body. - * - * @method Phaser.Physics.Arcade.Factory#staticImage - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * Called once the file has been added to its cache and is now ready for deletion from the Loader. + * It will emit a `filecomplete` event from the LoaderPlugin. * - * @return {Phaser.Types.Physics.Arcade.ImageWithStaticBody} The Image object that was created. + * @method Phaser.Loader.File#pendingDestroy + * @fires Phaser.Loader.Events#FILE_COMPLETE + * @fires Phaser.Loader.Events#FILE_KEY_COMPLETE + * @since 3.7.0 */ - staticImage: function (x, y, key, frame) + pendingDestroy: function (data) { - var image = new ArcadeImage(this.scene, x, y, key, frame); + if (this.state === CONST.FILE_PENDING_DESTROY) + { + return; + } - this.sys.displayList.add(image); + if (data === undefined) { data = this.data; } - this.world.enableBody(image, CONST.STATIC_BODY); + var key = this.key; + var type = this.type; - return image; + this.loader.emit(Events.FILE_COMPLETE, key, type, data); + this.loader.emit(Events.FILE_KEY_COMPLETE + type + '-' + key, key, type, data); + + this.loader.flagForRemoval(this); + + this.state = CONST.FILE_PENDING_DESTROY; }, /** - * Creates a new Arcade Image object with a Dynamic body. - * - * @method Phaser.Physics.Arcade.Factory#image - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * Destroy this File and any references it holds. * - * @return {Phaser.Types.Physics.Arcade.ImageWithDynamicBody} The Image object that was created. + * @method Phaser.Loader.File#destroy + * @since 3.7.0 */ - image: function (x, y, key, frame) + destroy: function () { - var image = new ArcadeImage(this.scene, x, y, key, frame); + this.loader = null; + this.cache = null; + this.xhrSettings = null; + this.multiFile = null; + this.linkFile = null; + this.data = null; + } - this.sys.displayList.add(image); +}); - this.world.enableBody(image, CONST.DYNAMIC_BODY); +/** + * Static method for creating object URL using URL API and setting it as image 'src' attribute. + * If URL API is not supported (usually on old browsers) it falls back to creating Base64 encoded url using FileReader. + * + * @method Phaser.Loader.File.createObjectURL + * @static + * @since 3.7.0 + * + * @param {HTMLImageElement} image - Image object which 'src' attribute should be set to object URL. + * @param {Blob} blob - A Blob object to create an object URL for. + * @param {string} defaultType - Default mime type used if blob type is not available. + */ +File.createObjectURL = function (image, blob, defaultType) +{ + if (typeof URL === 'function') + { + image.src = URL.createObjectURL(blob); + } + else + { + var reader = new FileReader(); - return image; - }, + reader.onload = function () + { + image.removeAttribute('crossOrigin'); + image.src = 'data:' + (blob.type || defaultType) + ';base64,' + reader.result.split(',')[1]; + }; - /** - * Creates a new Arcade Sprite object with a Static body. - * - * @method Phaser.Physics.Arcade.Factory#staticSprite - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * - * @return {Phaser.Types.Physics.Arcade.SpriteWithStaticBody} The Sprite object that was created. - */ - staticSprite: function (x, y, key, frame) + reader.onerror = image.onerror; + + reader.readAsDataURL(blob); + } +}; + +/** + * Static method for releasing an existing object URL which was previously created + * by calling {@link File#createObjectURL} method. + * + * @method Phaser.Loader.File.revokeObjectURL + * @static + * @since 3.7.0 + * + * @param {HTMLImageElement} image - Image object which 'src' attribute should be revoked. + */ +File.revokeObjectURL = function (image) +{ + if (typeof URL === 'function') { - var sprite = new ArcadeSprite(this.scene, x, y, key, frame); + URL.revokeObjectURL(image.src); + } +}; - this.sys.displayList.add(sprite); - this.sys.updateList.add(sprite); +module.exports = File; - this.world.enableBody(sprite, CONST.STATIC_BODY); - return sprite; - }, +/***/ }), - /** - * Creates a new Arcade Sprite object with a Dynamic body. - * - * @method Phaser.Physics.Arcade.Factory#sprite - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * - * @return {Phaser.Types.Physics.Arcade.SpriteWithDynamicBody} The Sprite object that was created. - */ - sprite: function (x, y, key, frame) - { - var sprite = new ArcadeSprite(this.scene, x, y, key, frame); +/***/ 76846: +/***/ ((module) => { - this.sys.displayList.add(sprite); - this.sys.updateList.add(sprite); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.world.enableBody(sprite, CONST.DYNAMIC_BODY); +var types = {}; - return sprite; - }, +/** + * @namespace Phaser.Loader.FileTypesManager + */ + +var FileTypesManager = { /** - * Creates a Static Physics Group object. - * All Game Objects created by this Group will automatically be static Arcade Physics objects. + * Static method called when a LoaderPlugin is created. * - * @method Phaser.Physics.Arcade.Factory#staticGroup - * @since 3.0.0 + * Loops through the local types object and injects all of them as + * properties into the LoaderPlugin instance. * - * @param {(Phaser.GameObjects.GameObject[]|Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. - * @param {Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} [config] - Settings for this group. + * @method Phaser.Loader.FileTypesManager.install + * @since 3.0.0 * - * @return {Phaser.Physics.Arcade.StaticGroup} The Static Group object that was created. + * @param {Phaser.Loader.LoaderPlugin} loader - The LoaderPlugin to install the types into. */ - staticGroup: function (children, config) + install: function (loader) { - return this.sys.updateList.add(new StaticPhysicsGroup(this.world, this.world.scene, children, config)); + for (var key in types) + { + loader[key] = types[key]; + } }, /** - * Creates a Physics Group object. - * All Game Objects created by this Group will automatically be dynamic Arcade Physics objects. + * Static method called directly by the File Types. * - * @method Phaser.Physics.Arcade.Factory#group - * @since 3.0.0 + * The key is a reference to the function used to load the files via the Loader, i.e. `image`. * - * @param {(Phaser.GameObjects.GameObject[]|Phaser.Types.Physics.Arcade.PhysicsGroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. - * @param {Phaser.Types.Physics.Arcade.PhysicsGroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} [config] - Settings for this group. + * @method Phaser.Loader.FileTypesManager.register + * @since 3.0.0 * - * @return {Phaser.Physics.Arcade.Group} The Group object that was created. + * @param {string} key - The key that will be used as the method name in the LoaderPlugin. + * @param {function} factoryFunction - The function that will be called when LoaderPlugin.key is invoked. */ - group: function (children, config) + register: function (key, factoryFunction) { - return this.sys.updateList.add(new PhysicsGroup(this.world, this.world.scene, children, config)); + types[key] = factoryFunction; }, /** - * Destroys this Factory. + * Removed all associated file types. * - * @method Phaser.Physics.Arcade.Factory#destroy - * @since 3.5.0 + * @method Phaser.Loader.FileTypesManager.destroy + * @since 3.0.0 */ destroy: function () { - this.world = null; - this.scene = null; - this.sys = null; + types = {}; } -}); +}; -module.exports = Factory; +module.exports = FileTypesManager; /***/ }), -/* 522 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 30750: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Components = __webpack_require__(243); -var Image = __webpack_require__(125); - /** - * @classdesc - * An Arcade Physics Image is an Image with an Arcade Physics body and related components. - * The body can be dynamic or static. - * - * The main difference between an Arcade Image and an Arcade Sprite is that you cannot animate an Arcade Image. + * Given a File and a baseURL value this returns the URL the File will use to download from. * - * @class Image - * @extends Phaser.GameObjects.Image - * @memberof Phaser.Physics.Arcade - * @constructor + * @function Phaser.Loader.GetURL * @since 3.0.0 * - * @extends Phaser.Physics.Arcade.Components.Acceleration - * @extends Phaser.Physics.Arcade.Components.Angular - * @extends Phaser.Physics.Arcade.Components.Bounce - * @extends Phaser.Physics.Arcade.Components.Debug - * @extends Phaser.Physics.Arcade.Components.Drag - * @extends Phaser.Physics.Arcade.Components.Enable - * @extends Phaser.Physics.Arcade.Components.Friction - * @extends Phaser.Physics.Arcade.Components.Gravity - * @extends Phaser.Physics.Arcade.Components.Immovable - * @extends Phaser.Physics.Arcade.Components.Mass - * @extends Phaser.Physics.Arcade.Components.Pushable - * @extends Phaser.Physics.Arcade.Components.Size - * @extends Phaser.Physics.Arcade.Components.Velocity - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible + * @param {Phaser.Loader.File} file - The File object. + * @param {string} baseURL - A default base URL. * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @return {string} The URL the File will use. */ -var ArcadeImage = new Class({ - - Extends: Image, - - Mixins: [ - Components.Acceleration, - Components.Angular, - Components.Bounce, - Components.Debug, - Components.Drag, - Components.Enable, - Components.Friction, - Components.Gravity, - Components.Immovable, - Components.Mass, - Components.Pushable, - Components.Size, - Components.Velocity - ], - - initialize: - - function ArcadeImage (scene, x, y, texture, frame) +var GetURL = function (file, baseURL) +{ + if (!file.url) { - Image.call(this, scene, x, y, texture, frame); - - /** - * This Game Object's Physics Body. - * - * @name Phaser.Physics.Arcade.Image#body - * @type {?(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} - * @default null - * @since 3.0.0 - */ - this.body = null; + return false; } -}); - -module.exports = ArcadeImage; - - -/***/ }), -/* 523 */ -/***/ (function(module, exports, __webpack_require__) { - -var OverlapRect = __webpack_require__(244); -var Circle = __webpack_require__(65); -var CircleToCircle = __webpack_require__(231); -var CircleToRectangle = __webpack_require__(151); - -/** - * This method will search the given circular area and return an array of all physics bodies that - * overlap with it. It can return either Dynamic, Static bodies or a mixture of both. - * - * A body only has to intersect with the search area to be considered, it doesn't have to be fully - * contained within it. - * - * If Arcade Physics is set to use the RTree (which it is by default) then the search is rather fast, - * otherwise the search is O(N) for Dynamic Bodies. - * - * @function Phaser.Physics.Arcade.Components.OverlapCirc - * @since 3.21.0 - * - * @param {number} x - The x coordinate of the center of the area to search within. - * @param {number} y - The y coordinate of the center of the area to search within. - * @param {number} radius - The radius of the area to search within. - * @param {boolean} [includeDynamic=true] - Should the search include Dynamic Bodies? - * @param {boolean} [includeStatic=false] - Should the search include Static Bodies? - * - * @return {(Phaser.Physics.Arcade.Body[]|Phaser.Physics.Arcade.StaticBody[])} An array of bodies that overlap with the given area. - */ -var OverlapCirc = function (world, x, y, radius, includeDynamic, includeStatic) -{ - var bodiesInRect = OverlapRect(world, x - radius, y - radius, 2 * radius, 2 * radius, includeDynamic, includeStatic); - - if (bodiesInRect.length === 0) + if (file.url.match(/^(?:blob:|data:|capacitor:\/\/|http:\/\/|https:\/\/|\/\/)/)) { - return bodiesInRect; + return file.url; } - - var area = new Circle(x, y, radius); - var circFromBody = new Circle(); - var bodiesInArea = []; - - for (var i = 0; i < bodiesInRect.length; i++) + else { - var body = bodiesInRect[i]; - - if (body.isCircle) - { - circFromBody.setTo(body.center.x, body.center.y, body.halfWidth); - - if (CircleToCircle(area, circFromBody)) - { - bodiesInArea.push(body); - } - } - else if (CircleToRectangle(area, body)) - { - bodiesInArea.push(body); - } + return baseURL + file.url; } - - return bodiesInArea; }; -module.exports = OverlapCirc; +module.exports = GetURL; /***/ }), -/* 524 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 67285: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArcadeSprite = __webpack_require__(157); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(62); -var GetFastValue = __webpack_require__(2); -var Group = __webpack_require__(113); -var IsPlainObject = __webpack_require__(7); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var CustomSet = __webpack_require__(58403); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(683); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var GetValue = __webpack_require__(10850); +var PluginCache = __webpack_require__(91963); +var SceneEvents = __webpack_require__(7599); +var XHRSettings = __webpack_require__(33868); /** * @classdesc - * An Arcade Physics Group object. + * The Loader handles loading all external content such as Images, Sounds, Texture Atlases and data files. + * You typically interact with it via `this.load` in your Scene. Scenes can have a `preload` method, which is always + * called before the Scenes `create` method, allowing you to preload assets that the Scene may need. * - * The primary use of a Physics Group is a way to collect together physics enable objects - * that share the same intrinsic structure into a single pool. They can they be easily - * compared against other Groups, or Game Objects. + * If you call any `this.load` methods from outside of `Scene.preload` then you need to start the Loader going + * yourself by calling `Loader.start()`. It's only automatically started during the Scene preload. * - * All Game Objects created by, or added to this Group will automatically be given **dynamic** - * Arcade Physics bodies (if they have no body already) and the bodies will receive the - * Groups {@link Phaser.Physics.Arcade.Group#defaults default values}. + * The Loader uses a combination of tag loading (eg. Audio elements) and XHR and provides progress and completion events. + * Files are loaded in parallel by default. The amount of concurrent connections can be controlled in your Game Configuration. * - * You should not pass objects into this Group that should not receive a body. For example, - * do not add basic Geometry or Tilemap Layers into a Group, as they will not behave in the - * way you may expect. Groups should all ideally have objects of the same type in them. + * Once the Loader has started loading you are still able to add files to it. These can be injected as a result of a loader + * event, the type of file being loaded (such as a pack file) or other external events. As long as the Loader hasn't finished + * simply adding a new file to it, while running, will ensure it's added into the current queue. * - * If you wish to create a Group filled with Static Bodies, please see {@link Phaser.Physics.Arcade.StaticGroup}. + * Every Scene has its own instance of the Loader and they are bound to the Scene in which they are created. However, + * assets loaded by the Loader are placed into global game-level caches. For example, loading an XML file will place that + * file inside `Game.cache.xml`, which is accessible from every Scene in your game, no matter who was responsible + * for loading it. The same is true of Textures. A texture loaded in one Scene is instantly available to all other Scenes + * in your game. * - * @class Group - * @extends Phaser.GameObjects.Group - * @memberof Phaser.Physics.Arcade + * The Loader works by using custom File Types. These are stored in the FileTypesManager, which injects them into the Loader + * when it's instantiated. You can create your own custom file types by extending either the File or MultiFile classes. + * See those files for more details. + * + * @class LoaderPlugin + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Loader * @constructor * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.World} world - The physics simulation. - * @param {Phaser.Scene} scene - The scene this group belongs to. - * @param {(Phaser.GameObjects.GameObject[]|Phaser.Types.Physics.Arcade.PhysicsGroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. - * @param {Phaser.Types.Physics.Arcade.PhysicsGroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} [config] - Settings for this group. + * @param {Phaser.Scene} scene - The Scene which owns this Loader instance. */ -var PhysicsGroup = new Class({ +var LoaderPlugin = new Class({ - Extends: Group, + Extends: EventEmitter, initialize: - function PhysicsGroup (world, scene, children, config) + function LoaderPlugin (scene) { - if (!children && !config) - { - config = { - internalCreateCallback: this.createCallbackHandler, - internalRemoveCallback: this.removeCallbackHandler - }; - } - else if (IsPlainObject(children)) - { - // children is a plain object, so swizzle them: - config = children; - children = null; + EventEmitter.call(this); - config.internalCreateCallback = this.createCallbackHandler; - config.internalRemoveCallback = this.removeCallbackHandler; - } - else if (Array.isArray(children) && IsPlainObject(children[0])) - { - // children is an array of plain objects (i.e., configs) - config = children[0]; + var gameConfig = scene.sys.game.config; + var sceneConfig = scene.sys.settings.loader; - var _this = this; + /** + * The Scene which owns this Loader instance. + * + * @name Phaser.Loader.LoaderPlugin#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; - children.forEach(function (singleConfig) - { - singleConfig.internalCreateCallback = _this.createCallbackHandler; - singleConfig.internalRemoveCallback = _this.removeCallbackHandler; - }); + /** + * A reference to the Scene Systems. + * + * @name Phaser.Loader.LoaderPlugin#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; - children = null; - } - else - { - // config is not defined and children is not a plain object nor an array of plain objects - config = { - internalCreateCallback: this.createCallbackHandler, - internalRemoveCallback: this.removeCallbackHandler - }; - } + /** + * A reference to the global Cache Manager. + * + * @name Phaser.Loader.LoaderPlugin#cacheManager + * @type {Phaser.Cache.CacheManager} + * @since 3.7.0 + */ + this.cacheManager = scene.sys.cache; /** - * The physics simulation. + * A reference to the global Texture Manager. * - * @name Phaser.Physics.Arcade.Group#world - * @type {Phaser.Physics.Arcade.World} + * @name Phaser.Loader.LoaderPlugin#textureManager + * @type {Phaser.Textures.TextureManager} + * @since 3.7.0 + */ + this.textureManager = scene.sys.textures; + + /** + * A reference to the global Scene Manager. + * + * @name Phaser.Loader.LoaderPlugin#sceneManager + * @type {Phaser.Scenes.SceneManager} + * @protected + * @since 3.16.0 + */ + this.sceneManager = scene.sys.game.scene; + + // Inject the available filetypes into the Loader + FileTypesManager.install(this); + + /** + * An optional prefix that is automatically prepended to the start of every file key. + * If prefix was `MENU.` and you load an image with the key 'Background' the resulting key would be `MENU.Background`. + * You can set this directly, or call `Loader.setPrefix()`. It will then affect every file added to the Loader + * from that point on. It does _not_ change any file already in the load queue. + * + * @name Phaser.Loader.LoaderPlugin#prefix + * @type {string} + * @default '' + * @since 3.7.0 + */ + this.prefix = ''; + + /** + * The value of `path`, if set, is placed before any _relative_ file path given. For example: + * + * ```javascript + * this.load.path = "images/sprites/"; + * this.load.image("ball", "ball.png"); + * this.load.image("tree", "level1/oaktree.png"); + * this.load.image("boom", "http://server.com/explode.png"); + * ``` + * + * Would load the `ball` file from `images/sprites/ball.png` and the tree from + * `images/sprites/level1/oaktree.png` but the file `boom` would load from the URL + * given as it's an absolute URL. + * + * Please note that the path is added before the filename but *after* the baseURL (if set.) + * + * If you set this property directly then it _must_ end with a "/". Alternatively, call `setPath()` and it'll do it for you. + * + * @name Phaser.Loader.LoaderPlugin#path + * @type {string} + * @default '' * @since 3.0.0 */ - this.world = world; + this.path = ''; /** - * The class to create new Group members from. + * If you want to append a URL before the path of any asset you can set this here. * - * This should be either `Phaser.Physics.Arcade.Image`, `Phaser.Physics.Arcade.Sprite`, or a class extending one of those. + * Useful if allowing the asset base url to be configured outside of the game code. * - * @name Phaser.Physics.Arcade.Group#classType - * @type {Function} - * @default ArcadeSprite + * If you set this property directly then it _must_ end with a "/". Alternatively, call `setBaseURL()` and it'll do it for you. + * + * @name Phaser.Loader.LoaderPlugin#baseURL + * @type {string} + * @default '' * @since 3.0.0 */ - config.classType = GetFastValue(config, 'classType', ArcadeSprite); + this.baseURL = ''; + + this.setBaseURL(GetFastValue(sceneConfig, 'baseURL', gameConfig.loaderBaseURL)); + + this.setPath(GetFastValue(sceneConfig, 'path', gameConfig.loaderPath)); + + this.setPrefix(GetFastValue(sceneConfig, 'prefix', gameConfig.loaderPrefix)); /** - * The physics type of the Group's members. + * The number of concurrent / parallel resources to try and fetch at once. * - * @name Phaser.Physics.Arcade.Group#physicsType + * Old browsers limit 6 requests per domain; modern ones, especially those with HTTP/2 don't limit it at all. + * + * The default is 32 but you can change this in your Game Config, or by changing this property before the Loader starts. + * + * @name Phaser.Loader.LoaderPlugin#maxParallelDownloads * @type {number} - * @default Phaser.Physics.Arcade.DYNAMIC_BODY * @since 3.0.0 */ - this.physicsType = CONST.DYNAMIC_BODY; + this.maxParallelDownloads = GetFastValue(sceneConfig, 'maxParallelDownloads', gameConfig.loaderMaxParallelDownloads); /** - * Default physics properties applied to Game Objects added to the Group or created by the Group. Derived from the `config` argument. - * - * You can remove the default values by setting this property to `{}`. + * xhr specific global settings (can be overridden on a per-file basis) * - * @name Phaser.Physics.Arcade.Group#defaults - * @type {Phaser.Types.Physics.Arcade.PhysicsGroupDefaults} + * @name Phaser.Loader.LoaderPlugin#xhr + * @type {Phaser.Types.Loader.XHRSettingsObject} * @since 3.0.0 */ - this.defaults = { - setCollideWorldBounds: GetFastValue(config, 'collideWorldBounds', false), - setBoundsRectangle: GetFastValue(config, 'customBoundsRectangle', null), - setAccelerationX: GetFastValue(config, 'accelerationX', 0), - setAccelerationY: GetFastValue(config, 'accelerationY', 0), - setAllowDrag: GetFastValue(config, 'allowDrag', true), - setAllowGravity: GetFastValue(config, 'allowGravity', true), - setAllowRotation: GetFastValue(config, 'allowRotation', true), - setBounceX: GetFastValue(config, 'bounceX', 0), - setBounceY: GetFastValue(config, 'bounceY', 0), - setDragX: GetFastValue(config, 'dragX', 0), - setDragY: GetFastValue(config, 'dragY', 0), - setEnable: GetFastValue(config, 'enable', true), - setGravityX: GetFastValue(config, 'gravityX', 0), - setGravityY: GetFastValue(config, 'gravityY', 0), - setFrictionX: GetFastValue(config, 'frictionX', 0), - setFrictionY: GetFastValue(config, 'frictionY', 0), - setMaxVelocityX: GetFastValue(config, 'maxVelocityX', 10000), - setMaxVelocityY: GetFastValue(config, 'maxVelocityY', 10000), - setVelocityX: GetFastValue(config, 'velocityX', 0), - setVelocityY: GetFastValue(config, 'velocityY', 0), - setAngularVelocity: GetFastValue(config, 'angularVelocity', 0), - setAngularAcceleration: GetFastValue(config, 'angularAcceleration', 0), - setAngularDrag: GetFastValue(config, 'angularDrag', 0), - setMass: GetFastValue(config, 'mass', 1), - setImmovable: GetFastValue(config, 'immovable', false) - }; + this.xhr = XHRSettings( + GetFastValue(sceneConfig, 'responseType', gameConfig.loaderResponseType), + GetFastValue(sceneConfig, 'async', gameConfig.loaderAsync), + GetFastValue(sceneConfig, 'user', gameConfig.loaderUser), + GetFastValue(sceneConfig, 'password', gameConfig.loaderPassword), + GetFastValue(sceneConfig, 'timeout', gameConfig.loaderTimeout), + GetFastValue(sceneConfig, 'withCredentials', gameConfig.loaderWithCredentials) + ); - Group.call(this, scene, children, config); + /** + * The crossOrigin value applied to loaded images. Very often this needs to be set to 'anonymous'. + * + * @name Phaser.Loader.LoaderPlugin#crossOrigin + * @type {string} + * @since 3.0.0 + */ + this.crossOrigin = GetFastValue(sceneConfig, 'crossOrigin', gameConfig.loaderCrossOrigin); /** - * A textual representation of this Game Object. - * Used internally by Phaser but is available for your own custom classes to populate. + * Optional load type for image files. `XHR` is the default. Set to `HTMLImageElement` to load images using the Image tag instead. * - * @name Phaser.Physics.Arcade.Group#type + * @name Phaser.Loader.LoaderPlugin#imageLoadType * @type {string} - * @default 'PhysicsGroup' - * @since 3.21.0 + * @since 3.60.0 */ - this.type = 'PhysicsGroup'; + this.imageLoadType = GetFastValue(sceneConfig, 'imageLoadType', gameConfig.loaderImageLoadType); + + /** + * An array of all schemes that the Loader considers as being 'local'. + * + * This is populated by the `Phaser.Core.Config#loaderLocalScheme` game configuration setting and defaults to + * `[ 'file://', 'capacitor://' ]`. Additional local schemes can be added to this array as needed. + * + * @name Phaser.Loader.LoaderPlugin#localSchemes + * @type {string[]} + * @since 3.60.0 + */ + this.localSchemes = GetFastValue(sceneConfig, 'localScheme', gameConfig.loaderLocalScheme); + + /** + * The total number of files to load. It may not always be accurate because you may add to the Loader during the process + * of loading, especially if you load a Pack File. Therefore this value can change, but in most cases remains static. + * + * @name Phaser.Loader.LoaderPlugin#totalToLoad + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.totalToLoad = 0; + + /** + * The progress of the current load queue, as a float value between 0 and 1. + * This is updated automatically as files complete loading. + * Note that it is possible for this value to go down again if you add content to the current load queue during a load. + * + * @name Phaser.Loader.LoaderPlugin#progress + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.progress = 0; + + /** + * Files are placed in this Set when they're added to the Loader via `addFile`. + * + * They are moved to the `inflight` Set when they start loading, and assuming a successful + * load, to the `queue` Set for further processing. + * + * By the end of the load process this Set will be empty. + * + * @name Phaser.Loader.LoaderPlugin#list + * @type {Phaser.Structs.Set.} + * @since 3.0.0 + */ + this.list = new CustomSet(); + + /** + * Files are stored in this Set while they're in the process of being loaded. + * + * Upon a successful load they are moved to the `queue` Set. + * + * By the end of the load process this Set will be empty. + * + * @name Phaser.Loader.LoaderPlugin#inflight + * @type {Phaser.Structs.Set.} + * @since 3.0.0 + */ + this.inflight = new CustomSet(); + + /** + * Files are stored in this Set while they're being processed. + * + * If the process is successful they are moved to their final destination, which could be + * a Cache or the Texture Manager. + * + * At the end of the load process this Set will be empty. + * + * @name Phaser.Loader.LoaderPlugin#queue + * @type {Phaser.Structs.Set.} + * @since 3.0.0 + */ + this.queue = new CustomSet(); + + /** + * A temporary Set in which files are stored after processing, + * awaiting destruction at the end of the load process. + * + * @name Phaser.Loader.LoaderPlugin#_deleteQueue + * @type {Phaser.Structs.Set.} + * @private + * @since 3.7.0 + */ + this._deleteQueue = new CustomSet(); + + /** + * The total number of files that failed to load during the most recent load. + * This value is reset when you call `Loader.start`. + * + * @name Phaser.Loader.LoaderPlugin#totalFailed + * @type {number} + * @default 0 + * @since 3.7.0 + */ + this.totalFailed = 0; + + /** + * The total number of files that successfully loaded during the most recent load. + * This value is reset when you call `Loader.start`. + * + * @name Phaser.Loader.LoaderPlugin#totalComplete + * @type {number} + * @default 0 + * @since 3.7.0 + */ + this.totalComplete = 0; + + /** + * The current state of the Loader. + * + * @name Phaser.Loader.LoaderPlugin#state + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.state = CONST.LOADER_IDLE; + + /** + * The current index being used by multi-file loaders to avoid key clashes. + * + * @name Phaser.Loader.LoaderPlugin#multiKeyIndex + * @type {number} + * @private + * @since 3.20.0 + */ + this.multiKeyIndex = 0; + + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.pluginStart, this); }, /** - * Enables a Game Object's Body and assigns `defaults`. Called when a Group member is added or created. - * - * @method Phaser.Physics.Arcade.Group#createCallbackHandler - * @since 3.0.0 + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. * - * @param {Phaser.GameObjects.GameObject} child - The Game Object being added. + * @method Phaser.Loader.LoaderPlugin#boot + * @private + * @since 3.5.1 */ - createCallbackHandler: function (child) + boot: function () { - if (!child.body) - { - this.world.enableBody(child, CONST.DYNAMIC_BODY); - } - - var body = child.body; - - for (var key in this.defaults) - { - body[key](this.defaults[key]); - } + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** - * Disables a Game Object's Body. Called when a Group member is removed. - * - * @method Phaser.Physics.Arcade.Group#removeCallbackHandler - * @since 3.0.0 + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. * - * @param {Phaser.GameObjects.GameObject} child - The Game Object being removed. - */ - removeCallbackHandler: function (child) + * @method Phaser.Loader.LoaderPlugin#pluginStart + * @private + * @since 3.5.1 + */ + pluginStart: function () { - if (child.body) - { - this.world.disableBody(child); - } + this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * Sets the velocity of each Group member. + * If you want to append a URL before the path of any asset you can set this here. * - * @method Phaser.Physics.Arcade.Group#setVelocity + * Useful if allowing the asset base url to be configured outside of the game code. + * + * Once a base URL is set it will affect every file loaded by the Loader from that point on. It does _not_ change any + * file _already_ being loaded. To reset it, call this method with no arguments. + * + * @method Phaser.Loader.LoaderPlugin#setBaseURL * @since 3.0.0 * - * @param {number} x - The horizontal velocity. - * @param {number} y - The vertical velocity. - * @param {number} [step=0] - The velocity increment. When set, the first member receives velocity (x, y), the second (x + step, y + step), and so on. + * @param {string} [url] - The URL to use. Leave empty to reset. * - * @return {Phaser.Physics.Arcade.Group} This Physics Group object. + * @return {this} This Loader object. */ - setVelocity: function (x, y, step) + setBaseURL: function (url) { - if (step === undefined) { step = 0; } - - var items = this.getChildren(); + if (url === undefined) { url = ''; } - for (var i = 0; i < items.length; i++) + if (url !== '' && url.substr(-1) !== '/') { - items[i].body.velocity.set(x + (i * step), y + (i * step)); + url = url.concat('/'); } + this.baseURL = url; + return this; }, /** - * Sets the horizontal velocity of each Group member. + * The value of `path`, if set, is placed before any _relative_ file path given. For example: * - * @method Phaser.Physics.Arcade.Group#setVelocityX + * ```javascript + * this.load.setPath("images/sprites/"); + * this.load.image("ball", "ball.png"); + * this.load.image("tree", "level1/oaktree.png"); + * this.load.image("boom", "http://server.com/explode.png"); + * ``` + * + * Would load the `ball` file from `images/sprites/ball.png` and the tree from + * `images/sprites/level1/oaktree.png` but the file `boom` would load from the URL + * given as it's an absolute URL. + * + * Please note that the path is added before the filename but *after* the baseURL (if set.) + * + * Once a path is set it will then affect every file added to the Loader from that point on. It does _not_ change any + * file _already_ in the load queue. To reset it, call this method with no arguments. + * + * @method Phaser.Loader.LoaderPlugin#setPath * @since 3.0.0 * - * @param {number} value - The velocity value. - * @param {number} [step=0] - The velocity increment. When set, the first member receives velocity (x), the second (x + step), and so on. + * @param {string} [path] - The path to use. Leave empty to reset. * - * @return {Phaser.Physics.Arcade.Group} This Physics Group object. + * @return {this} This Loader object. */ - setVelocityX: function (value, step) + setPath: function (path) { - if (step === undefined) { step = 0; } - - var items = this.getChildren(); + if (path === undefined) { path = ''; } - for (var i = 0; i < items.length; i++) + if (path !== '' && path.substr(-1) !== '/') { - items[i].body.velocity.x = value + (i * step); + path = path.concat('/'); } + this.path = path; + return this; }, /** - * Sets the vertical velocity of each Group member. + * An optional prefix that is automatically prepended to the start of every file key. * - * @method Phaser.Physics.Arcade.Group#setVelocityY + * If prefix was `MENU.` and you load an image with the key 'Background' the resulting key would be `MENU.Background`. + * + * Once a prefix is set it will then affect every file added to the Loader from that point on. It does _not_ change any + * file _already_ in the load queue. To reset it, call this method with no arguments. + * + * @method Phaser.Loader.LoaderPlugin#setPrefix + * @since 3.7.0 + * + * @param {string} [prefix] - The prefix to use. Leave empty to reset. + * + * @return {this} This Loader object. + */ + setPrefix: function (prefix) + { + if (prefix === undefined) { prefix = ''; } + + this.prefix = prefix; + + return this; + }, + + /** + * Sets the Cross Origin Resource Sharing value used when loading files. + * + * Files can override this value on a per-file basis by specifying an alternative `crossOrigin` value in their file config. + * + * Once CORs is set it will then affect every file loaded by the Loader from that point on, as long as they don't have + * their own CORs setting. To reset it, call this method with no arguments. + * + * For more details about CORs see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS + * + * @method Phaser.Loader.LoaderPlugin#setCORS * @since 3.0.0 * - * @param {number} value - The velocity value. - * @param {number} [step=0] - The velocity increment. When set, the first member receives velocity (y), the second (y + step), and so on. + * @param {string} [crossOrigin] - The value to use for the `crossOrigin` property in the load request. * - * @return {Phaser.Physics.Arcade.Group} This Physics Group object. + * @return {this} This Loader object. */ - setVelocityY: function (value, step) + setCORS: function (crossOrigin) { - if (step === undefined) { step = 0; } + this.crossOrigin = crossOrigin; - var items = this.getChildren(); + return this; + }, - for (var i = 0; i < items.length; i++) + /** + * Adds a file, or array of files, into the load queue. + * + * The file must be an instance of `Phaser.Loader.File`, or a class that extends it. The Loader will check that the key + * used by the file won't conflict with any other key either in the loader, the inflight queue or the target cache. + * If allowed it will then add the file into the pending list, read for the load to start. Or, if the load has already + * started, ready for the next batch of files to be pulled from the list to the inflight queue. + * + * You should not normally call this method directly, but rather use one of the Loader methods like `image` or `atlas`, + * however you can call this as long as the file given to it is well formed. + * + * @method Phaser.Loader.LoaderPlugin#addFile + * @fires Phaser.Loader.Events#ADD + * @since 3.0.0 + * + * @param {(Phaser.Loader.File|Phaser.Loader.File[])} file - The file, or array of files, to be added to the load queue. + */ + addFile: function (file) + { + if (!Array.isArray(file)) { - items[i].body.velocity.y = value + (i * step); + file = [ file ]; } - return this; - } + for (var i = 0; i < file.length; i++) + { + var item = file[i]; -}); + // Does the file already exist in the cache or texture manager? + // Or will it conflict with a file already in the queue or inflight? + if (!this.keyExists(item)) + { + this.list.set(item); -module.exports = PhysicsGroup; + this.emit(Events.ADD, item.key, item.type, this, item); + if (this.isLoading()) + { + this.totalToLoad++; + this.updateProgress(); + } + } + } + }, -/***/ }), -/* 525 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Checks the key and type of the given file to see if it will conflict with anything already + * in a Cache, the Texture Manager, or the list or inflight queues. + * + * @method Phaser.Loader.LoaderPlugin#keyExists + * @since 3.7.0 + * + * @param {Phaser.Loader.File} file - The file to check the key of. + * + * @return {boolean} `true` if adding this file will cause a cache or queue conflict, otherwise `false`. + */ + keyExists: function (file) + { + var keyConflict = file.hasCacheConflict(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (!keyConflict) + { + this.list.iterate(function (item) + { + if (item.type === file.type && item.key === file.key) + { + keyConflict = true; -var ArcadeSprite = __webpack_require__(157); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(62); -var GetFastValue = __webpack_require__(2); -var Group = __webpack_require__(113); -var IsPlainObject = __webpack_require__(7); + return false; + } -/** - * @classdesc - * An Arcade Physics Static Group object. - * - * All Game Objects created by or added to this Group will automatically be given static Arcade Physics bodies, if they have no body. - * - * Its dynamic counterpart is {@link Phaser.Physics.Arcade.Group}. - * - * @class StaticGroup - * @extends Phaser.GameObjects.Group - * @memberof Phaser.Physics.Arcade - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Physics.Arcade.World} world - The physics simulation. - * @param {Phaser.Scene} scene - The scene this group belongs to. - * @param {(Phaser.GameObjects.GameObject[]|Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. - * @param {Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} [config] - Settings for this group. - */ -var StaticPhysicsGroup = new Class({ + }); + } - Extends: Group, + if (!keyConflict && this.isLoading()) + { + this.inflight.iterate(function (item) + { + if (item.type === file.type && item.key === file.key) + { + keyConflict = true; - initialize: + return false; + } - function StaticPhysicsGroup (world, scene, children, config) + }); + + this.queue.iterate(function (item) + { + if (item.type === file.type && item.key === file.key) + { + keyConflict = true; + + return false; + } + + }); + } + + return keyConflict; + }, + + /** + * Takes a well formed, fully parsed pack file object and adds its entries into the load queue. Usually you do not call + * this method directly, but instead use `Loader.pack` and supply a path to a JSON file that holds the + * pack data. However, if you've got the data prepared you can pass it to this method. + * + * You can also provide an optional key. If you do then it will only add the entries from that part of the pack into + * to the load queue. If not specified it will add all entries it finds. For more details about the pack file format + * see the `LoaderPlugin.pack` method. + * + * @method Phaser.Loader.LoaderPlugin#addPack + * @since 3.7.0 + * + * @param {any} pack - The Pack File data to be parsed and each entry of it to added to the load queue. + * @param {string} [packKey] - An optional key to use from the pack file data. + * + * @return {boolean} `true` if any files were added to the queue, otherwise `false`. + */ + addPack: function (pack, packKey) { - if (!children && !config) + // if no packKey provided we'll add everything to the queue + if (typeof(packKey) === 'string') { - config = { - internalCreateCallback: this.createCallbackHandler, - internalRemoveCallback: this.removeCallbackHandler, - createMultipleCallback: this.createMultipleCallbackHandler, - classType: ArcadeSprite - }; + var subPack = GetValue(pack, packKey); + + if (subPack) + { + pack = { packKey: subPack }; + } } - else if (IsPlainObject(children)) + + var total = 0; + + // Store the loader settings in case this pack replaces them + var currentBaseURL = this.baseURL; + var currentPath = this.path; + var currentPrefix = this.prefix; + + // Here we go ... + for (var key in pack) { - // children is a plain object, so swizzle them: - config = children; - children = null; + if (!Object.prototype.hasOwnProperty.call(pack, key)) + { + continue; + } - config.internalCreateCallback = this.createCallbackHandler; - config.internalRemoveCallback = this.removeCallbackHandler; - config.createMultipleCallback = this.createMultipleCallbackHandler; - config.classType = GetFastValue(config, 'classType', ArcadeSprite); + var config = pack[key]; + + // Any meta data to process? + var baseURL = GetFastValue(config, 'baseURL', currentBaseURL); + var path = GetFastValue(config, 'path', currentPath); + var prefix = GetFastValue(config, 'prefix', currentPrefix); + var files = GetFastValue(config, 'files', null); + var defaultType = GetFastValue(config, 'defaultType', 'void'); + + if (Array.isArray(files)) + { + this.setBaseURL(baseURL); + this.setPath(path); + this.setPrefix(prefix); + + for (var i = 0; i < files.length; i++) + { + var file = files[i]; + var type = (file.hasOwnProperty('type')) ? file.type : defaultType; + + if (this[type]) + { + this[type](file); + total++; + } + } + } } - else if (Array.isArray(children) && IsPlainObject(children[0])) + + // Reset the loader settings + this.setBaseURL(currentBaseURL); + this.setPath(currentPath); + this.setPrefix(currentPrefix); + + return (total > 0); + }, + + /** + * Is the Loader actively loading, or processing loaded files? + * + * @method Phaser.Loader.LoaderPlugin#isLoading + * @since 3.0.0 + * + * @return {boolean} `true` if the Loader is busy loading or processing, otherwise `false`. + */ + isLoading: function () + { + return (this.state === CONST.LOADER_LOADING || this.state === CONST.LOADER_PROCESSING); + }, + + /** + * Is the Loader ready to start a new load? + * + * @method Phaser.Loader.LoaderPlugin#isReady + * @since 3.0.0 + * + * @return {boolean} `true` if the Loader is ready to start a new load, otherwise `false`. + */ + isReady: function () + { + return (this.state === CONST.LOADER_IDLE || this.state === CONST.LOADER_COMPLETE); + }, + + /** + * Starts the Loader running. This will reset the progress and totals and then emit a `start` event. + * If there is nothing in the queue the Loader will immediately complete, otherwise it will start + * loading the first batch of files. + * + * The Loader is started automatically if the queue is populated within your Scenes `preload` method. + * + * However, outside of this, you need to call this method to start it. + * + * If the Loader is already running this method will simply return. + * + * @method Phaser.Loader.LoaderPlugin#start + * @fires Phaser.Loader.Events#START + * @since 3.0.0 + */ + start: function () + { + if (!this.isReady()) { - // children is an array of plain objects - config = children; - children = null; + return; + } - config.forEach(function (singleConfig) - { - singleConfig.internalCreateCallback = this.createCallbackHandler; - singleConfig.internalRemoveCallback = this.removeCallbackHandler; - singleConfig.createMultipleCallback = this.createMultipleCallbackHandler; - singleConfig.classType = GetFastValue(singleConfig, 'classType', ArcadeSprite); - }); + this.progress = 0; + + this.totalFailed = 0; + this.totalComplete = 0; + this.totalToLoad = this.list.size; + + this.emit(Events.START, this); + + if (this.list.size === 0) + { + this.loadComplete(); } else { - // config is not defined and children is not a plain object nor an array of plain objects - config = { - internalCreateCallback: this.createCallbackHandler, - internalRemoveCallback: this.removeCallbackHandler - }; - } + this.state = CONST.LOADER_LOADING; - /** - * The physics simulation. - * - * @name Phaser.Physics.Arcade.StaticGroup#world - * @type {Phaser.Physics.Arcade.World} - * @since 3.0.0 - */ - this.world = world; + this.inflight.clear(); + this.queue.clear(); - /** - * The scene this group belongs to. - * - * @name Phaser.Physics.Arcade.StaticGroup#physicsType - * @type {number} - * @default Phaser.Physics.Arcade.STATIC_BODY - * @since 3.0.0 - */ - this.physicsType = CONST.STATIC_BODY; + this.updateProgress(); - Group.call(this, scene, children, config); + this.checkLoadQueue(); - /** - * A textual representation of this Game Object. - * Used internally by Phaser but is available for your own custom classes to populate. - * - * @name Phaser.Physics.Arcade.StaticGroup#type - * @type {string} - * @default 'StaticPhysicsGroup' - * @since 3.21.0 - */ - this.type = 'StaticPhysicsGroup'; + this.systems.events.on(SceneEvents.UPDATE, this.update, this); + } }, /** - * Adds a static physics body to the new group member (if it lacks one) and adds it to the simulation. + * Called automatically during the load process. + * It updates the `progress` value and then emits a progress event, which you can use to + * display a loading bar in your game. * - * @method Phaser.Physics.Arcade.StaticGroup#createCallbackHandler + * @method Phaser.Loader.LoaderPlugin#updateProgress + * @fires Phaser.Loader.Events#PROGRESS * @since 3.0.0 + */ + updateProgress: function () + { + this.progress = 1 - ((this.list.size + this.inflight.size) / this.totalToLoad); + + this.emit(Events.PROGRESS, this.progress); + }, + + /** + * Called automatically during the load process. * - * @param {Phaser.GameObjects.GameObject} child - The new group member. - * - * @see Phaser.Physics.Arcade.World#enableBody + * @method Phaser.Loader.LoaderPlugin#update + * @since 3.10.0 */ - createCallbackHandler: function (child) + update: function () { - if (!child.body) + if (this.state === CONST.LOADER_LOADING && this.list.size > 0 && this.inflight.size < this.maxParallelDownloads) { - this.world.enableBody(child, CONST.STATIC_BODY); + this.checkLoadQueue(); } }, /** - * Disables the group member's physics body, removing it from the simulation. + * An internal method called by the Loader. * - * @method Phaser.Physics.Arcade.StaticGroup#removeCallbackHandler + * It will check to see if there are any more files in the pending list that need loading, and if so it will move + * them from the list Set into the inflight Set, set their CORs flag and start them loading. + * + * It will carrying on doing this for each file in the pending list until it runs out, or hits the max allowed parallel downloads. + * + * @method Phaser.Loader.LoaderPlugin#checkLoadQueue + * @private + * @since 3.7.0 + */ + checkLoadQueue: function () + { + this.list.each(function (file) + { + if (file.state === CONST.FILE_POPULATED || (file.state === CONST.FILE_PENDING && this.inflight.size < this.maxParallelDownloads)) + { + this.inflight.set(file); + + this.list.delete(file); + + // If the file doesn't have its own crossOrigin set, we'll use the Loaders (which is undefined by default) + if (!file.crossOrigin) + { + file.crossOrigin = this.crossOrigin; + } + + file.load(); + } + + if (this.inflight.size === this.maxParallelDownloads) + { + // Tells the Set iterator to abort + return false; + } + + }, this); + }, + + /** + * An internal method called automatically by the XHRLoader belong to a File. + * + * This method will remove the given file from the inflight Set and update the load progress. + * If the file was successful its `onProcess` method is called, otherwise it is added to the delete queue. + * + * @method Phaser.Loader.LoaderPlugin#nextFile + * @fires Phaser.Loader.Events#FILE_LOAD + * @fires Phaser.Loader.Events#FILE_LOAD_ERROR * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} child - The group member being removed. + * @param {Phaser.Loader.File} file - The File that just finished loading, or errored during load. + * @param {boolean} success - `true` if the file loaded successfully, otherwise `false`. + */ + nextFile: function (file, success) + { + // Has the game been destroyed during load? If so, bail out now. + if (!this.inflight) + { + return; + } + + this.inflight.delete(file); + + this.updateProgress(); + + if (success) + { + this.totalComplete++; + + this.queue.set(file); + + this.emit(Events.FILE_LOAD, file); + + file.onProcess(); + } + else + { + this.totalFailed++; + + this._deleteQueue.set(file); + + this.emit(Events.FILE_LOAD_ERROR, file); + + this.fileProcessComplete(file); + } + }, + + /** + * An internal method that is called automatically by the File when it has finished processing. * - * @see Phaser.Physics.Arcade.World#disableBody + * If the process was successful, and the File isn't part of a MultiFile, its `addToCache` method is called. + * + * It this then removed from the queue. If there are no more files to load `loadComplete` is called. + * + * @method Phaser.Loader.LoaderPlugin#fileProcessComplete + * @since 3.7.0 + * + * @param {Phaser.Loader.File} file - The file that has finished processing. */ - removeCallbackHandler: function (child) + fileProcessComplete: function (file) { - if (child.body) + // Has the game been destroyed during load? If so, bail out now. + if (!this.scene || !this.systems || !this.systems.game || this.systems.game.pendingDestroy) { - this.world.disableBody(child); + return; + } + + // This file has failed, so move it to the failed Set + if (file.state === CONST.FILE_ERRORED) + { + if (file.multiFile) + { + file.multiFile.onFileFailed(file); + } + } + else if (file.state === CONST.FILE_COMPLETE) + { + if (file.multiFile) + { + if (file.multiFile.isReadyToProcess()) + { + // If we got here then all files the link file needs are ready to add to the cache + file.multiFile.addToCache(); + file.multiFile.pendingDestroy(); + } + } + else + { + // If we got here, then the file processed, so let it add itself to its cache + file.addToCache(); + file.pendingDestroy(); + } + } + + // Remove it from the queue + this.queue.delete(file); + + // Nothing left to do? + + if (this.list.size === 0 && this.inflight.size === 0 && this.queue.size === 0) + { + this.loadComplete(); } }, /** - * Refreshes the group. + * Called at the end when the load queue is exhausted and all files have either loaded or errored. + * By this point every loaded file will now be in its associated cache and ready for use. * - * @method Phaser.Physics.Arcade.StaticGroup#createMultipleCallbackHandler + * Also clears down the Sets, puts progress to 1 and clears the deletion queue. + * + * @method Phaser.Loader.LoaderPlugin#loadComplete + * @fires Phaser.Loader.Events#COMPLETE + * @fires Phaser.Loader.Events#POST_PROCESS + * @since 3.7.0 + */ + loadComplete: function () + { + this.emit(Events.POST_PROCESS, this); + + this.list.clear(); + this.inflight.clear(); + this.queue.clear(); + + this.progress = 1; + + this.state = CONST.LOADER_COMPLETE; + + this.systems.events.off(SceneEvents.UPDATE, this.update, this); + + // Call 'destroy' on each file ready for deletion + this._deleteQueue.iterateLocal('destroy'); + + this._deleteQueue.clear(); + + this.emit(Events.COMPLETE, this, this.totalComplete, this.totalFailed); + }, + + /** + * Adds a File into the pending-deletion queue. + * + * @method Phaser.Loader.LoaderPlugin#flagForRemoval + * @since 3.7.0 + * + * @param {Phaser.Loader.File} file - The File to be queued for deletion when the Loader completes. + */ + flagForRemoval: function (file) + { + this._deleteQueue.set(file); + }, + + /** + * Converts the given JSON data into a file that the browser then prompts you to download so you can save it locally. + * + * The data must be well formed JSON and ready-parsed, not a JavaScript object. + * + * @method Phaser.Loader.LoaderPlugin#saveJSON * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject[]} entries - The newly created group members. + * @param {*} data - The JSON data, ready parsed. + * @param {string} [filename=file.json] - The name to save the JSON file as. * - * @see Phaser.Physics.Arcade.StaticGroup#refresh + * @return {this} This Loader plugin. */ - createMultipleCallbackHandler: function () + saveJSON: function (data, filename) { - this.refresh(); + return this.save(JSON.stringify(data), filename); }, /** - * Resets each Body to the position of its parent Game Object. - * Body sizes aren't changed (use {@link Phaser.Physics.Arcade.Components.Enable#refreshBody} for that). + * Causes the browser to save the given data as a file to its default Downloads folder. * - * @method Phaser.Physics.Arcade.StaticGroup#refresh + * Creates a DOM level anchor link, assigns it as being a `download` anchor, sets the href + * to be an ObjectURL based on the given data, and then invokes a click event. + * + * @method Phaser.Loader.LoaderPlugin#save * @since 3.0.0 * - * @return {Phaser.Physics.Arcade.StaticGroup} This group. + * @param {*} data - The data to be saved. Will be passed through URL.createObjectURL. + * @param {string} [filename=file.json] - The filename to save the file as. + * @param {string} [filetype=application/json] - The file type to use when saving the file. Defaults to JSON. * - * @see Phaser.Physics.Arcade.StaticBody#reset + * @return {this} This Loader plugin. */ - refresh: function () + save: function (data, filename, filetype) { - var children = this.children.entries; + if (filename === undefined) { filename = 'file.json'; } + if (filetype === undefined) { filetype = 'application/json'; } - for (var i = 0; i < children.length; i++) - { - children[i].body.reset(); - } + var blob = new Blob([ data ], { type: filetype }); + + var url = URL.createObjectURL(blob); + + var a = document.createElement('a'); + + a.download = filename; + a.textContent = 'Download ' + filename; + a.href = url; + a.click(); return this; + }, + + /** + * Resets the Loader. + * + * This will clear all lists and reset the base URL, path and prefix. + * + * Warning: If the Loader is currently downloading files, or has files in its queue, they will be aborted. + * + * @method Phaser.Loader.LoaderPlugin#reset + * @since 3.0.0 + */ + reset: function () + { + this.list.clear(); + this.inflight.clear(); + this.queue.clear(); + + var gameConfig = this.systems.game.config; + var sceneConfig = this.systems.settings.loader; + + this.setBaseURL(GetFastValue(sceneConfig, 'baseURL', gameConfig.loaderBaseURL)); + this.setPath(GetFastValue(sceneConfig, 'path', gameConfig.loaderPath)); + this.setPrefix(GetFastValue(sceneConfig, 'prefix', gameConfig.loaderPrefix)); + + this.state = CONST.LOADER_IDLE; + }, + + /** + * The Scene that owns this plugin is shutting down. + * We need to kill and reset all internal properties as well as stop listening to Scene events. + * + * @method Phaser.Loader.LoaderPlugin#shutdown + * @private + * @since 3.0.0 + */ + shutdown: function () + { + this.reset(); + + this.state = CONST.LOADER_SHUTDOWN; + + this.systems.events.off(SceneEvents.UPDATE, this.update, this); + this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); + }, + + /** + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. + * + * @method Phaser.Loader.LoaderPlugin#destroy + * @private + * @since 3.0.0 + */ + destroy: function () + { + this.shutdown(); + + this.state = CONST.LOADER_DESTROYED; + + this.systems.events.off(SceneEvents.UPDATE, this.update, this); + this.systems.events.off(SceneEvents.START, this.pluginStart, this); + + this.list = null; + this.inflight = null; + this.queue = null; + + this.scene = null; + this.systems = null; + this.textureManager = null; + this.cacheManager = null; + this.sceneManager = null; } }); -module.exports = StaticPhysicsGroup; +PluginCache.register('Loader', LoaderPlugin, 'load'); + +module.exports = LoaderPlugin; /***/ }), -/* 526 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 43531: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AngleBetweenPoints = __webpack_require__(350); -var Body = __webpack_require__(527); -var Clamp = __webpack_require__(18); -var Class = __webpack_require__(0); -var Collider = __webpack_require__(528); -var CONST = __webpack_require__(62); -var DistanceBetween = __webpack_require__(50); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(245); -var FuzzyEqual = __webpack_require__(124); -var FuzzyGreaterThan = __webpack_require__(354); -var FuzzyLessThan = __webpack_require__(355); -var GetOverlapX = __webpack_require__(246); -var GetOverlapY = __webpack_require__(247); -var GetTilesWithinWorldXY = __webpack_require__(529); -var GetValue = __webpack_require__(6); -var MATH_CONST = __webpack_require__(14); -var ProcessQueue = __webpack_require__(211); -var ProcessTileCallbacks = __webpack_require__(530); -var Rectangle = __webpack_require__(10); -var RTree = __webpack_require__(531); -var SeparateTile = __webpack_require__(532); -var SeparateX = __webpack_require__(537); -var SeparateY = __webpack_require__(538); -var Set = __webpack_require__(149); -var StaticBody = __webpack_require__(539); -var TileIntersectsBody = __webpack_require__(248); -var TransformMatrix = __webpack_require__(25); -var Vector2 = __webpack_require__(3); -var Wrap = __webpack_require__(68); +var Extend = __webpack_require__(98611); +var XHRSettings = __webpack_require__(33868); /** - * @classdesc - * The Arcade Physics World. - * - * The World is responsible for creating, managing, colliding and updating all of the bodies within it. + * Takes two XHRSettings Objects and creates a new XHRSettings object from them. * - * An instance of the World belongs to a Phaser.Scene and is accessed via the property `physics.world`. + * The new object is seeded by the values given in the global settings, but any setting in + * the local object overrides the global ones. * - * @class World - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Physics.Arcade - * @constructor + * @function Phaser.Loader.MergeXHRSettings * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene to which this World instance belongs. - * @param {Phaser.Types.Physics.Arcade.ArcadeWorldConfig} config - An Arcade Physics Configuration object. + * @param {Phaser.Types.Loader.XHRSettingsObject} global - The global XHRSettings object. + * @param {Phaser.Types.Loader.XHRSettingsObject} local - The local XHRSettings object. + * + * @return {Phaser.Types.Loader.XHRSettingsObject} A newly formed XHRSettings object. */ -var World = new Class({ +var MergeXHRSettings = function (global, local) +{ + var output = (global === undefined) ? XHRSettings() : Extend({}, global); - Extends: EventEmitter, + if (local) + { + for (var setting in local) + { + if (local[setting] !== undefined) + { + output[setting] = local[setting]; + } + } + } + + return output; +}; + +module.exports = MergeXHRSettings; + + +/***/ }), + +/***/ 45176: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var Events = __webpack_require__(683); + +/** + * @classdesc + * A MultiFile is a special kind of parent that contains two, or more, Files as children and looks after + * the loading and processing of them all. It is commonly extended and used as a base class for file types such as AtlasJSON or BitmapFont. + * + * You shouldn't create an instance of a MultiFile directly, but should extend it with your own class, setting a custom type and processing methods. + * + * @class MultiFile + * @memberof Phaser.Loader + * @constructor + * @since 3.7.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that is going to load this File. + * @param {string} type - The file type string for sorting within the Loader. + * @param {string} key - The key of the file within the loader. + * @param {Phaser.Loader.File[]} files - An array of Files that make-up this MultiFile. + */ +var MultiFile = new Class({ initialize: - function World (scene, config) + function MultiFile (loader, type, key, files) { - EventEmitter.call(this); + var finalFiles = []; - /** - * The Scene this simulation belongs to. - * - * @name Phaser.Physics.Arcade.World#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; + // Clean out any potential 'null' or 'undefined' file entries + files.forEach(function (file) + { + if (file) + { + finalFiles.push(file); + } + }); /** - * Dynamic Bodies in this simulation. + * A reference to the Loader that is going to load this file. * - * @name Phaser.Physics.Arcade.World#bodies - * @type {Phaser.Structs.Set.} - * @since 3.0.0 + * @name Phaser.Loader.MultiFile#loader + * @type {Phaser.Loader.LoaderPlugin} + * @since 3.7.0 */ - this.bodies = new Set(); + this.loader = loader; /** - * Static Bodies in this simulation. + * The file type string for sorting within the Loader. * - * @name Phaser.Physics.Arcade.World#staticBodies - * @type {Phaser.Structs.Set.} - * @since 3.0.0 + * @name Phaser.Loader.MultiFile#type + * @type {string} + * @since 3.7.0 */ - this.staticBodies = new Set(); + this.type = type; /** - * Static Bodies marked for deletion. + * Unique cache key (unique within its file type) * - * @name Phaser.Physics.Arcade.World#pendingDestroy - * @type {Phaser.Structs.Set.<(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)>} - * @since 3.1.0 + * @name Phaser.Loader.MultiFile#key + * @type {string} + * @since 3.7.0 */ - this.pendingDestroy = new Set(); + this.key = key; /** - * This simulation's collision processors. + * The current index being used by multi-file loaders to avoid key clashes. * - * @name Phaser.Physics.Arcade.World#colliders - * @type {Phaser.Structs.ProcessQueue.} - * @since 3.0.0 + * @name Phaser.Loader.MultiFile#multiKeyIndex + * @type {number} + * @private + * @since 3.20.0 */ - this.colliders = new ProcessQueue(); + this.multiKeyIndex = loader.multiKeyIndex++; /** - * Acceleration of Bodies due to gravity, in pixels per second. + * Array of files that make up this MultiFile. * - * @name Phaser.Physics.Arcade.World#gravity - * @type {Phaser.Math.Vector2} - * @since 3.0.0 + * @name Phaser.Loader.MultiFile#files + * @type {Phaser.Loader.File[]} + * @since 3.7.0 */ - this.gravity = new Vector2(GetValue(config, 'gravity.x', 0), GetValue(config, 'gravity.y', 0)); + this.files = finalFiles; /** - * A boundary constraining Bodies. + * The current state of the file. One of the FILE_CONST values. * - * @name Phaser.Physics.Arcade.World#bounds - * @type {Phaser.Geom.Rectangle} - * @since 3.0.0 + * @name Phaser.Loader.MultiFile#state + * @type {number} + * @since 3.60.0 */ - this.bounds = new Rectangle( - GetValue(config, 'x', 0), - GetValue(config, 'y', 0), - GetValue(config, 'width', scene.sys.scale.width), - GetValue(config, 'height', scene.sys.scale.height) - ); + this.state = CONST.FILE_PENDING; /** - * The boundary edges that Bodies can collide with. + * The completion status of this MultiFile. * - * @name Phaser.Physics.Arcade.World#checkCollision - * @type {Phaser.Types.Physics.Arcade.CheckCollisionObject} - * @since 3.0.0 + * @name Phaser.Loader.MultiFile#complete + * @type {boolean} + * @default false + * @since 3.7.0 */ - this.checkCollision = { - up: GetValue(config, 'checkCollision.up', true), - down: GetValue(config, 'checkCollision.down', true), - left: GetValue(config, 'checkCollision.left', true), - right: GetValue(config, 'checkCollision.right', true) - }; + this.complete = false; /** - * The number of physics steps to be taken per second. - * - * This property is read-only. Use the `setFPS` method to modify it at run-time. + * The number of files to load. * - * @name Phaser.Physics.Arcade.World#fps - * @readonly + * @name Phaser.Loader.MultiFile#pending * @type {number} - * @default 60 - * @since 3.10.0 + * @since 3.7.0 */ - this.fps = GetValue(config, 'fps', 60); - /** - * Should Physics use a fixed update time-step (true) or sync to the render fps (false)?. - * False value of this property disables fps and timeScale properties. - * - * @name Phaser.Physics.Arcade.World#fixedStep - * @type {boolean} - * @default true - * @since 3.23.0 - */ - this.fixedStep = GetValue(config, 'fixedStep', true); + this.pending = finalFiles.length; /** - * The amount of elapsed ms since the last frame. + * The number of files that failed to load. * - * @name Phaser.Physics.Arcade.World#_elapsed - * @private + * @name Phaser.Loader.MultiFile#failed * @type {number} - * @since 3.10.0 + * @default 0 + * @since 3.7.0 */ - this._elapsed = 0; + this.failed = 0; /** - * Internal frame time value. + * A storage container for transient data that the loading files need. * - * @name Phaser.Physics.Arcade.World#_frameTime - * @private - * @type {number} - * @since 3.10.0 + * @name Phaser.Loader.MultiFile#config + * @type {any} + * @since 3.7.0 */ - this._frameTime = 1 / this.fps; + this.config = {}; /** - * Internal frame time ms value. + * A reference to the Loaders baseURL at the time this MultiFile was created. + * Used to populate child-files. * - * @name Phaser.Physics.Arcade.World#_frameTimeMS - * @private - * @type {number} - * @since 3.10.0 + * @name Phaser.Loader.MultiFile#baseURL + * @type {string} + * @since 3.20.0 */ - this._frameTimeMS = 1000 * this._frameTime; + this.baseURL = loader.baseURL; /** - * The number of steps that took place in the last frame. + * A reference to the Loaders path at the time this MultiFile was created. + * Used to populate child-files. * - * @name Phaser.Physics.Arcade.World#stepsLastFrame - * @readonly - * @type {number} - * @since 3.10.0 + * @name Phaser.Loader.MultiFile#path + * @type {string} + * @since 3.20.0 */ - this.stepsLastFrame = 0; + this.path = loader.path; /** - * Scaling factor applied to the frame rate. - * - * - 1.0 = normal speed - * - 2.0 = half speed - * - 0.5 = double speed + * A reference to the Loaders prefix at the time this MultiFile was created. + * Used to populate child-files. * - * @name Phaser.Physics.Arcade.World#timeScale - * @type {number} - * @default 1 - * @since 3.10.0 - */ - this.timeScale = GetValue(config, 'timeScale', 1); - - /** - * The maximum absolute difference of a Body's per-step velocity and its overlap with another Body that will result in separation on *each axis*. - * Larger values favor separation. - * Smaller values favor no separation. - * - * @name Phaser.Physics.Arcade.World#OVERLAP_BIAS - * @type {number} - * @default 4 - * @since 3.0.0 - */ - this.OVERLAP_BIAS = GetValue(config, 'overlapBias', 4); - - /** - * The maximum absolute value of a Body's overlap with a tile that will result in separation on *each axis*. - * Larger values favor separation. - * Smaller values favor no separation. - * The optimum value may be similar to the tile size. - * - * @name Phaser.Physics.Arcade.World#TILE_BIAS - * @type {number} - * @default 16 - * @since 3.0.0 - */ - this.TILE_BIAS = GetValue(config, 'tileBias', 16); - - /** - * Always separate overlapping Bodies horizontally before vertically. - * False (the default) means Bodies are first separated on the axis of greater gravity, or the vertical axis if neither is greater. - * - * @name Phaser.Physics.Arcade.World#forceX - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.forceX = GetValue(config, 'forceX', false); - - /** - * Whether the simulation advances with the game loop. - * - * @name Phaser.Physics.Arcade.World#isPaused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.isPaused = GetValue(config, 'isPaused', false); - - /** - * Temporary total of colliding Bodies. - * - * @name Phaser.Physics.Arcade.World#_total - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._total = 0; - - /** - * Enables the debug display. - * - * @name Phaser.Physics.Arcade.World#drawDebug - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.drawDebug = GetValue(config, 'debug', false); - - /** - * The graphics object drawing the debug display. - * - * @name Phaser.Physics.Arcade.World#debugGraphic - * @type {Phaser.GameObjects.Graphics} - * @since 3.0.0 - */ - this.debugGraphic; - - /** - * Default debug display settings for new Bodies. - * - * @name Phaser.Physics.Arcade.World#defaults - * @type {Phaser.Types.Physics.Arcade.ArcadeWorldDefaults} - * @since 3.0.0 - */ - this.defaults = { - debugShowBody: GetValue(config, 'debugShowBody', true), - debugShowStaticBody: GetValue(config, 'debugShowStaticBody', true), - debugShowVelocity: GetValue(config, 'debugShowVelocity', true), - bodyDebugColor: GetValue(config, 'debugBodyColor', 0xff00ff), - staticBodyDebugColor: GetValue(config, 'debugStaticBodyColor', 0x0000ff), - velocityDebugColor: GetValue(config, 'debugVelocityColor', 0x00ff00) - }; - - /** - * The maximum number of items per node on the RTree. - * - * This is ignored if `useTree` is `false`. If you have a large number of bodies in - * your world then you may find search performance improves by increasing this value, - * to allow more items per node and less node division. - * - * @name Phaser.Physics.Arcade.World#maxEntries - * @type {number} - * @default 16 - * @since 3.0.0 - */ - this.maxEntries = GetValue(config, 'maxEntries', 16); - - /** - * Should this Arcade Physics World use an RTree for Dynamic bodies? - * - * An RTree is a fast way of spatially sorting of all the bodies in the world. - * However, at certain limits, the cost of clearing and inserting the bodies into the - * tree every frame becomes more expensive than the search speed gains it provides. - * - * If you have a large number of dynamic bodies in your world then it may be best to - * disable the use of the RTree by setting this property to `false` in the physics config. - * - * The number it can cope with depends on browser and device, but a conservative estimate - * of around 5,000 bodies should be considered the max before disabling it. - * - * This only applies to dynamic bodies. Static bodies are always kept in an RTree, - * because they don't have to be cleared every frame, so you benefit from the - * massive search speeds all the time. - * - * @name Phaser.Physics.Arcade.World#useTree - * @type {boolean} - * @default true - * @since 3.10.0 - */ - this.useTree = GetValue(config, 'useTree', true); - - /** - * The spatial index of Dynamic Bodies. - * - * @name Phaser.Physics.Arcade.World#tree - * @type {Phaser.Structs.RTree} - * @since 3.0.0 - */ - this.tree = new RTree(this.maxEntries); - - /** - * The spatial index of Static Bodies. - * - * @name Phaser.Physics.Arcade.World#staticTree - * @type {Phaser.Structs.RTree} - * @since 3.0.0 - */ - this.staticTree = new RTree(this.maxEntries); - - /** - * Recycled input for tree searches. - * - * @name Phaser.Physics.Arcade.World#treeMinMax - * @type {Phaser.Types.Physics.Arcade.ArcadeWorldTreeMinMax} - * @since 3.0.0 - */ - this.treeMinMax = { minX: 0, minY: 0, maxX: 0, maxY: 0 }; - - /** - * A temporary Transform Matrix used by bodies for calculations without them needing their own local copy. - * - * @name Phaser.Physics.Arcade.World#_tempMatrix - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @private - * @since 3.12.0 - */ - this._tempMatrix = new TransformMatrix(); - - /** - * A temporary Transform Matrix used by bodies for calculations without them needing their own local copy. - * - * @name Phaser.Physics.Arcade.World#_tempMatrix2 - * @type {Phaser.GameObjects.Components.TransformMatrix} - * @private - * @since 3.12.0 + * @name Phaser.Loader.MultiFile#prefix + * @type {string} + * @since 3.20.0 */ - this._tempMatrix2 = new TransformMatrix(); + this.prefix = loader.prefix; - if (this.drawDebug) + // Link the files + for (var i = 0; i < finalFiles.length; i++) { - this.createDebugGraphic(); + finalFiles[i].multiFile = this; } }, /** - * Adds an Arcade Physics Body to a Game Object, an array of Game Objects, or the children of a Group. - * - * The difference between this and the `enableBody` method is that you can pass arrays or Groups - * to this method. - * - * You can specify if the bodies are to be Dynamic or Static. A dynamic body can move via velocity and - * acceleration. A static body remains fixed in place and as such is able to use an optimized search - * tree, making it ideal for static elements such as level objects. You can still collide and overlap - * with static bodies. + * Checks if this MultiFile is ready to process its children or not. * - * Normally, rather than calling this method directly, you'd use the helper methods available in the - * Arcade Physics Factory, such as: + * @method Phaser.Loader.MultiFile#isReadyToProcess + * @since 3.7.0 * - * ```javascript - * this.physics.add.image(x, y, textureKey); - * this.physics.add.sprite(x, y, textureKey); - * ``` + * @return {boolean} `true` if all children of this MultiFile have loaded, otherwise `false`. + */ + isReadyToProcess: function () + { + return (this.pending === 0 && this.failed === 0 && !this.complete); + }, + + /** + * Adds another child to this MultiFile, increases the pending count and resets the completion status. * - * Calling factory methods encapsulates the creation of a Game Object and the creation of its - * body at the same time. If you are creating custom classes then you can pass them to this - * method to have their bodies created. + * @method Phaser.Loader.MultiFile#addToMultiFile + * @since 3.7.0 * - * @method Phaser.Physics.Arcade.World#enable - * @since 3.0.0 + * @param {Phaser.Loader.File} files - The File to add to this MultiFile. * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group|Phaser.GameObjects.Group[])} object - The object, or objects, on which to create the bodies. - * @param {number} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`. + * @return {Phaser.Loader.MultiFile} This MultiFile instance. */ - enable: function (object, bodyType) + addToMultiFile: function (file) { - if (bodyType === undefined) { bodyType = CONST.DYNAMIC_BODY; } - - if (!Array.isArray(object)) - { - object = [ object ]; - } + this.files.push(file); - for (var i = 0; i < object.length; i++) - { - var entry = object[i]; + file.multiFile = this; - if (entry.isParent) - { - var children = entry.getChildren(); + this.pending++; - for (var c = 0; c < children.length; c++) - { - var child = children[c]; + this.complete = false; - if (child.isParent) - { - // Handle Groups nested inside of Groups - this.enable(child, bodyType); - } - else - { - this.enableBody(child, bodyType); - } - } - } - else - { - this.enableBody(entry, bodyType); - } - } + return this; }, /** - * Creates an Arcade Physics Body on a single Game Object. - * - * If the Game Object already has a body, this method will simply add it back into the simulation. - * - * You can specify if the body is Dynamic or Static. A dynamic body can move via velocity and - * acceleration. A static body remains fixed in place and as such is able to use an optimized search - * tree, making it ideal for static elements such as level objects. You can still collide and overlap - * with static bodies. - * - * Normally, rather than calling this method directly, you'd use the helper methods available in the - * Arcade Physics Factory, such as: - * - * ```javascript - * this.physics.add.image(x, y, textureKey); - * this.physics.add.sprite(x, y, textureKey); - * ``` - * - * Calling factory methods encapsulates the creation of a Game Object and the creation of its - * body at the same time. If you are creating custom classes then you can pass them to this - * method to have their bodies created. - * - * @method Phaser.Physics.Arcade.World#enableBody - * @since 3.0.0 + * Called by each File when it finishes loading. * - * @param {Phaser.GameObjects.GameObject} object - The Game Object on which to create the body. - * @param {number} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`. + * @method Phaser.Loader.MultiFile#onFileComplete + * @since 3.7.0 * - * @return {Phaser.GameObjects.GameObject} The Game Object on which the body was created. + * @param {Phaser.Loader.File} file - The File that has completed processing. */ - enableBody: function (object, bodyType) + onFileComplete: function (file) { - if (bodyType === undefined) { bodyType = CONST.DYNAMIC_BODY; } + var index = this.files.indexOf(file); - if (!object.body) + if (index !== -1) { - if (bodyType === CONST.DYNAMIC_BODY) - { - object.body = new Body(this, object); - } - else if (bodyType === CONST.STATIC_BODY) - { - object.body = new StaticBody(this, object); - } + this.pending--; } - - this.add(object.body); - - return object; }, /** - * Adds an existing Arcade Physics Body or StaticBody to the simulation. - * - * The body is enabled and added to the local search trees. - * - * @method Phaser.Physics.Arcade.World#add - * @since 3.10.0 + * Called by each File that fails to load. * - * @param {(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} body - The Body to be added to the simulation. + * @method Phaser.Loader.MultiFile#onFileFailed + * @since 3.7.0 * - * @return {(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} The Body that was added to the simulation. + * @param {Phaser.Loader.File} file - The File that has failed to load. */ - add: function (body) + onFileFailed: function (file) { - if (body.physicsType === CONST.DYNAMIC_BODY) - { - this.bodies.set(body); - } - else if (body.physicsType === CONST.STATIC_BODY) + var index = this.files.indexOf(file); + + if (index !== -1) { - this.staticBodies.set(body); + this.failed++; - this.staticTree.insert(body); + // eslint-disable-next-line no-console + console.error('File failed: %s "%s" (via %s "%s")', this.type, this.key, file.type, file.key); } - - body.enable = true; - - return body; }, /** - * Disables the Arcade Physics Body of a Game Object, an array of Game Objects, or the children of a Group. - * - * The difference between this and the `disableBody` method is that you can pass arrays or Groups - * to this method. - * - * The body itself is not deleted, it just has its `enable` property set to false, which - * means you can re-enable it again at any point by passing it to enable `World.enable` or `World.add`. + * Called once all children of this multi file have been added to their caches and is now + * ready for deletion from the Loader. * - * @method Phaser.Physics.Arcade.World#disable - * @since 3.0.0 + * It will emit a `filecomplete` event from the LoaderPlugin. * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group|Phaser.GameObjects.Group[])} object - The object, or objects, on which to disable the bodies. + * @method Phaser.Loader.MultiFile#pendingDestroy + * @fires Phaser.Loader.Events#FILE_COMPLETE + * @fires Phaser.Loader.Events#FILE_KEY_COMPLETE + * @since 3.60.0 */ - disable: function (object) + pendingDestroy: function () { - if (!Array.isArray(object)) + if (this.state === CONST.FILE_PENDING_DESTROY) { - object = [ object ]; + return; } - for (var i = 0; i < object.length; i++) - { - var entry = object[i]; + var key = this.key; + var type = this.type; - if (entry.isParent) - { - var children = entry.getChildren(); + this.loader.emit(Events.FILE_COMPLETE, key, type); + this.loader.emit(Events.FILE_KEY_COMPLETE + type + '-' + key, key, type); - for (var c = 0; c < children.length; c++) - { - var child = children[c]; + this.loader.flagForRemoval(this); - if (child.isParent) - { - // Handle Groups nested inside of Groups - this.disable(child); - } - else - { - this.disableBody(child.body); - } - } - } - else - { - this.disableBody(entry.body); - } + for (var i = 0; i < this.files.length; i++) + { + this.files[i].pendingDestroy(); } + + this.state = CONST.FILE_PENDING_DESTROY; }, /** - * Disables an existing Arcade Physics Body or StaticBody and removes it from the simulation. + * Destroy this Multi File and any references it holds. * - * The body is disabled and removed from the local search trees. - * - * The body itself is not deleted, it just has its `enable` property set to false, which - * means you can re-enable it again at any point by passing it to enable `World.enable` or `World.add`. - * - * @method Phaser.Physics.Arcade.World#disableBody - * @since 3.0.0 - * - * @param {(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} body - The Body to be disabled. + * @method Phaser.Loader.MultiFile#destroy + * @since 3.60.0 */ - disableBody: function (body) + destroy: function () { - this.remove(body); + this.loader = null; + this.files = null; + this.config = null; + } - body.enable = false; - }, +}); - /** - * Removes an existing Arcade Physics Body or StaticBody from the simulation. - * - * The body is disabled and removed from the local search trees. - * - * The body itself is not deleted, it just has its `enabled` property set to false, which - * means you can re-enable it again at any point by passing it to enable `enable` or `add`. - * - * @method Phaser.Physics.Arcade.World#remove - * @since 3.0.0 - * - * @param {(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} body - The body to be removed from the simulation. - */ - remove: function (body) +module.exports = MultiFile; + + +/***/ }), + +/***/ 88490: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var MergeXHRSettings = __webpack_require__(43531); + +/** + * Creates a new XMLHttpRequest (xhr) object based on the given File and XHRSettings + * and starts the download of it. It uses the Files own XHRSettings and merges them + * with the global XHRSettings object to set the xhr values before download. + * + * @function Phaser.Loader.XHRLoader + * @since 3.0.0 + * + * @param {Phaser.Loader.File} file - The File to download. + * @param {Phaser.Types.Loader.XHRSettingsObject} globalXHRSettings - The global XHRSettings object. + * + * @return {XMLHttpRequest} The XHR object. + */ +var XHRLoader = function (file, globalXHRSettings) +{ + var config = MergeXHRSettings(globalXHRSettings, file.xhrSettings); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', file.src, config.async, config.user, config.password); + + xhr.responseType = file.xhrSettings.responseType; + xhr.timeout = config.timeout; + + if (config.headers) { - if (body.physicsType === CONST.DYNAMIC_BODY) - { - this.tree.remove(body); - this.bodies.delete(body); - } - else if (body.physicsType === CONST.STATIC_BODY) + for (var key in config.headers) { - this.staticBodies.delete(body); - this.staticTree.remove(body); + xhr.setRequestHeader(key, config.headers[key]); } - }, + } - /** - * Creates a Graphics Game Object that the world will use to render the debug display to. - * - * This is called automatically when the World is instantiated if the `debug` config property - * was set to `true`. However, you can call it at any point should you need to display the - * debug Graphic from a fixed point. - * - * You can control which objects are drawn to the Graphics object, and the colors they use, - * by setting the debug properties in the physics config. - * - * You should not typically use this in a production game. Use it to aid during debugging. - * - * @method Phaser.Physics.Arcade.World#createDebugGraphic - * @since 3.0.0 - * - * @return {Phaser.GameObjects.Graphics} The Graphics object that was created for use by the World. - */ - createDebugGraphic: function () + if (config.header && config.headerValue) { - var graphic = this.scene.sys.add.graphics({ x: 0, y: 0 }); + xhr.setRequestHeader(config.header, config.headerValue); + } - graphic.setDepth(Number.MAX_VALUE); + if (config.requestedWith) + { + xhr.setRequestHeader('X-Requested-With', config.requestedWith); + } - this.debugGraphic = graphic; + if (config.overrideMimeType) + { + xhr.overrideMimeType(config.overrideMimeType); + } - this.drawDebug = true; + if (config.withCredentials) + { + xhr.withCredentials = true; + } - return graphic; - }, + // After a successful request, the xhr.response property will contain the requested data as a DOMString, ArrayBuffer, Blob, or Document (depending on what was set for responseType.) + + xhr.onload = file.onLoad.bind(file, xhr); + xhr.onerror = file.onError.bind(file, xhr); + xhr.onprogress = file.onProgress.bind(file); + + // This is the only standard method, the ones above are browser additions (maybe not universal?) + // xhr.onreadystatechange + + xhr.send(); + + return xhr; +}; + +module.exports = XHRLoader; + + +/***/ }), + +/***/ 33868: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Creates an XHRSettings Object with default values. + * + * @function Phaser.Loader.XHRSettings + * @since 3.0.0 + * + * @param {XMLHttpRequestResponseType} [responseType=''] - The responseType, such as 'text'. + * @param {boolean} [async=true] - Should the XHR request use async or not? + * @param {string} [user=''] - Optional username for the XHR request. + * @param {string} [password=''] - Optional password for the XHR request. + * @param {number} [timeout=0] - Optional XHR timeout value. + * @param {boolean} [withCredentials=false] - Optional XHR withCredentials value. + * + * @return {Phaser.Types.Loader.XHRSettingsObject} The XHRSettings object as used by the Loader. + */ +var XHRSettings = function (responseType, async, user, password, timeout, withCredentials) +{ + if (responseType === undefined) { responseType = ''; } + if (async === undefined) { async = true; } + if (user === undefined) { user = ''; } + if (password === undefined) { password = ''; } + if (timeout === undefined) { timeout = 0; } + if (withCredentials === undefined) { withCredentials = false; } + + // Before sending a request, set the xhr.responseType to "text", + // "arraybuffer", "blob", or "document", depending on your data needs. + // Note, setting xhr.responseType = '' (or omitting) will default the response to "text". + + return { + + // Ignored by the Loader, only used by File. + responseType: responseType, + + async: async, + + // credentials + user: user, + password: password, + + // timeout in ms (0 = no timeout) + timeout: timeout, + + // setRequestHeader + headers: undefined, + header: undefined, + headerValue: undefined, + requestedWith: false, + + // overrideMimeType + overrideMimeType: undefined, + + // withCredentials + withCredentials: withCredentials + + }; +}; + +module.exports = XHRSettings; + + +/***/ }), + +/***/ 12117: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var FILE_CONST = { /** - * Sets the position, size and properties of the World boundary. - * - * The World boundary is an invisible rectangle that defines the edges of the World. - * If a Body is set to collide with the world bounds then it will automatically stop - * when it reaches any of the edges. You can optionally set which edges of the boundary - * should be checked against. + * The Loader is idle. * - * @method Phaser.Physics.Arcade.World#setBounds + * @name Phaser.Loader.LOADER_IDLE + * @type {number} * @since 3.0.0 - * - * @param {number} x - The top-left x coordinate of the boundary. - * @param {number} y - The top-left y coordinate of the boundary. - * @param {number} width - The width of the boundary. - * @param {number} height - The height of the boundary. - * @param {boolean} [checkLeft] - Should bodies check against the left edge of the boundary? - * @param {boolean} [checkRight] - Should bodies check against the right edge of the boundary? - * @param {boolean} [checkUp] - Should bodies check against the top edge of the boundary? - * @param {boolean} [checkDown] - Should bodies check against the bottom edge of the boundary? - * - * @return {Phaser.Physics.Arcade.World} This World object. */ - setBounds: function (x, y, width, height, checkLeft, checkRight, checkUp, checkDown) - { - this.bounds.setTo(x, y, width, height); - - if (checkLeft !== undefined) - { - this.setBoundsCollision(checkLeft, checkRight, checkUp, checkDown); - } - - return this; - }, + LOADER_IDLE: 0, /** - * Enables or disables collisions on each edge of the World boundary. + * The Loader is actively loading. * - * @method Phaser.Physics.Arcade.World#setBoundsCollision + * @name Phaser.Loader.LOADER_LOADING + * @type {number} * @since 3.0.0 - * - * @param {boolean} [left=true] - Should bodies check against the left edge of the boundary? - * @param {boolean} [right=true] - Should bodies check against the right edge of the boundary? - * @param {boolean} [up=true] - Should bodies check against the top edge of the boundary? - * @param {boolean} [down=true] - Should bodies check against the bottom edge of the boundary? - * - * @return {Phaser.Physics.Arcade.World} This World object. */ - setBoundsCollision: function (left, right, up, down) - { - if (left === undefined) { left = true; } - if (right === undefined) { right = true; } - if (up === undefined) { up = true; } - if (down === undefined) { down = true; } - - this.checkCollision.left = left; - this.checkCollision.right = right; - this.checkCollision.up = up; - this.checkCollision.down = down; - - return this; - }, + LOADER_LOADING: 1, /** - * Pauses the simulation. - * - * A paused simulation does not update any existing bodies, or run any Colliders. - * - * However, you can still enable and disable bodies within it, or manually run collide or overlap - * checks. + * The Loader is processing files is has loaded. * - * @method Phaser.Physics.Arcade.World#pause - * @fires Phaser.Physics.Arcade.Events#PAUSE + * @name Phaser.Loader.LOADER_PROCESSING + * @type {number} * @since 3.0.0 - * - * @return {Phaser.Physics.Arcade.World} This World object. */ - pause: function () - { - this.isPaused = true; - - this.emit(Events.PAUSE); - - return this; - }, + LOADER_PROCESSING: 2, /** - * Resumes the simulation, if paused. + * The Loader has completed loading and processing. * - * @method Phaser.Physics.Arcade.World#resume - * @fires Phaser.Physics.Arcade.Events#RESUME + * @name Phaser.Loader.LOADER_COMPLETE + * @type {number} * @since 3.0.0 - * - * @return {Phaser.Physics.Arcade.World} This World object. */ - resume: function () - { - this.isPaused = false; - - this.emit(Events.RESUME); - - return this; - }, + LOADER_COMPLETE: 3, /** - * Creates a new Collider object and adds it to the simulation. - * - * A Collider is a way to automatically perform collision checks between two objects, - * calling the collide and process callbacks if they occur. - * - * Colliders are run as part of the World update, after all of the Bodies have updated. - * - * By creating a Collider you don't need then call `World.collide` in your `update` loop, - * as it will be handled for you automatically. + * The Loader is shutting down. * - * @method Phaser.Physics.Arcade.World#addCollider + * @name Phaser.Loader.LOADER_SHUTDOWN + * @type {number} * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#collide - * - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object to check for collision. - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object2 - The second object to check for collision. - * @param {ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects collide. Must return a boolean. - * @param {*} [callbackContext] - The scope in which to call the callbacks. - * - * @return {Phaser.Physics.Arcade.Collider} The Collider that was created. */ - addCollider: function (object1, object2, collideCallback, processCallback, callbackContext) - { - if (collideCallback === undefined) { collideCallback = null; } - if (processCallback === undefined) { processCallback = null; } - if (callbackContext === undefined) { callbackContext = collideCallback; } - - var collider = new Collider(this, false, object1, object2, collideCallback, processCallback, callbackContext); - - this.colliders.add(collider); - - return collider; - }, + LOADER_SHUTDOWN: 4, /** - * Creates a new Overlap Collider object and adds it to the simulation. - * - * A Collider is a way to automatically perform overlap checks between two objects, - * calling the collide and process callbacks if they occur. - * - * Colliders are run as part of the World update, after all of the Bodies have updated. - * - * By creating a Collider you don't need then call `World.overlap` in your `update` loop, - * as it will be handled for you automatically. + * The Loader has been destroyed. * - * @method Phaser.Physics.Arcade.World#addOverlap + * @name Phaser.Loader.LOADER_DESTROYED + * @type {number} * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object to check for overlap. - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object2 - The second object to check for overlap. - * @param {ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects overlap. - * @param {ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects overlap. Must return a boolean. - * @param {*} [callbackContext] - The scope in which to call the callbacks. - * - * @return {Phaser.Physics.Arcade.Collider} The Collider that was created. */ - addOverlap: function (object1, object2, collideCallback, processCallback, callbackContext) - { - if (collideCallback === undefined) { collideCallback = null; } - if (processCallback === undefined) { processCallback = null; } - if (callbackContext === undefined) { callbackContext = collideCallback; } - - var collider = new Collider(this, true, object1, object2, collideCallback, processCallback, callbackContext); - - this.colliders.add(collider); - - return collider; - }, + LOADER_DESTROYED: 5, /** - * Removes a Collider from the simulation so it is no longer processed. - * - * This method does not destroy the Collider. If you wish to add it back at a later stage you can call - * `World.colliders.add(Collider)`. - * - * If you no longer need the Collider you can call the `Collider.destroy` method instead, which will - * automatically clear all of its references and then remove it from the World. If you call destroy on - * a Collider you _don't_ need to pass it to this method too. + * File is in the load queue but not yet started. * - * @method Phaser.Physics.Arcade.World#removeCollider + * @name Phaser.Loader.FILE_PENDING + * @type {number} * @since 3.0.0 - * - * @param {Phaser.Physics.Arcade.Collider} collider - The Collider to remove from the simulation. - * - * @return {Phaser.Physics.Arcade.World} This World object. */ - removeCollider: function (collider) - { - this.colliders.remove(collider); - - return this; - }, + FILE_PENDING: 10, /** - * Sets the frame rate to run the simulation at. - * - * The frame rate value is used to simulate a fixed update time step. This fixed - * time step allows for a straightforward implementation of a deterministic game state. + * File has been started to load by the loader (onLoad called) * - * This frame rate is independent of the frequency at which the game is rendering. The - * higher you set the fps, the more physics simulation steps will occur per game step. - * Conversely, the lower you set it, the less will take place. + * @name Phaser.Loader.FILE_LOADING + * @type {number} + * @since 3.0.0 + */ + FILE_LOADING: 11, + + /** + * File has loaded successfully, awaiting processing. * - * You can optionally advance the simulation directly yourself by calling the `step` method. + * @name Phaser.Loader.FILE_LOADED + * @type {number} + * @since 3.0.0 + */ + FILE_LOADED: 12, + + /** + * File failed to load. * - * @method Phaser.Physics.Arcade.World#setFPS - * @since 3.10.0 + * @name Phaser.Loader.FILE_FAILED + * @type {number} + * @since 3.0.0 + */ + FILE_FAILED: 13, + + /** + * File is being processed (onProcess callback) * - * @param {number} framerate - The frame rate to advance the simulation at. + * @name Phaser.Loader.FILE_PROCESSING + * @type {number} + * @since 3.0.0 + */ + FILE_PROCESSING: 14, + + /** + * The File has errored somehow during processing. * - * @return {this} This World object. + * @name Phaser.Loader.FILE_ERRORED + * @type {number} + * @since 3.0.0 */ - setFPS: function (framerate) - { - this.fps = framerate; - this._frameTime = 1 / this.fps; - this._frameTimeMS = 1000 * this._frameTime; + FILE_ERRORED: 16, - return this; - }, + /** + * File has finished processing. + * + * @name Phaser.Loader.FILE_COMPLETE + * @type {number} + * @since 3.0.0 + */ + FILE_COMPLETE: 17, /** - * Advances the simulation based on the elapsed time and fps rate. + * File has been destroyed. * - * This is called automatically by your Scene and does not need to be invoked directly. + * @name Phaser.Loader.FILE_DESTROYED + * @type {number} + * @since 3.0.0 + */ + FILE_DESTROYED: 18, + + /** + * File was populated from local data and doesn't need an HTTP request. * - * @method Phaser.Physics.Arcade.World#update - * @fires Phaser.Physics.Arcade.Events#WORLD_STEP + * @name Phaser.Loader.FILE_POPULATED + * @type {number} * @since 3.0.0 + */ + FILE_POPULATED: 19, + + /** + * File is pending being destroyed. * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @name Phaser.Loader.FILE_PENDING_DESTROY + * @type {number} + * @since 3.60.0 */ - update: function (time, delta) - { - if (this.isPaused || this.bodies.size === 0) - { - return; - } + FILE_PENDING_DESTROY: 20 - var i; - var fixedDelta = this._frameTime; - var msPerFrame = this._frameTimeMS * this.timeScale; +}; - this._elapsed += delta; +module.exports = FILE_CONST; - // Update all active bodies - var body; - var bodies = this.bodies.entries; - // Will a step happen this frame? - var willStep = (this._elapsed >= msPerFrame); +/***/ }), - if (!this.fixedStep) - { - fixedDelta = delta * 0.001; - willStep = true; - this._elapsed = 0; - } +/***/ 7398: +/***/ ((module) => { - for (i = 0; i < bodies.length; i++) - { - body = bodies[i]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (body.enable) - { - body.preUpdate(willStep, fixedDelta); - } - } +/** + * The Loader Plugin Add File Event. + * + * This event is dispatched when a new file is successfully added to the Loader and placed into the load queue. + * + * Listen to it from a Scene using: `this.load.on('addfile', listener)`. + * + * If you add lots of files to a Loader from a `preload` method, it will dispatch this event for each one of them. + * + * @event Phaser.Loader.Events#ADD + * @type {string} + * @since 3.0.0 + * + * @param {string} key - The unique key of the file that was added to the Loader. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} string of the file that was added to the Loader, i.e. `image`. + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + * @param {Phaser.Loader.File} file - A reference to the File which was added to the Loader. + */ +module.exports = 'addfile'; - // We know that a step will happen this frame, so let's bundle it all together to save branching and iteration costs - if (willStep) - { - this._elapsed -= msPerFrame; - this.stepsLastFrame = 1; - // Optionally populate our dynamic collision tree - if (this.useTree) - { - this.tree.clear(); - this.tree.load(bodies); - } +/***/ }), - // Process any colliders - var colliders = this.colliders.update(); +/***/ 52187: +/***/ ((module) => { - for (i = 0; i < colliders.length; i++) - { - var collider = colliders[i]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (collider.active) - { - collider.update(); - } - } +/** + * The Loader Plugin Complete Event. + * + * This event is dispatched when the Loader has fully processed everything in the load queue. + * By this point every loaded file will now be in its associated cache and ready for use. + * + * Listen to it from a Scene using: `this.load.on('complete', listener)`. + * + * @event Phaser.Loader.Events#COMPLETE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + * @param {number} totalComplete - The total number of files that successfully loaded. + * @param {number} totalFailed - The total number of files that failed to load. + */ +module.exports = 'complete'; - this.emit(Events.WORLD_STEP, fixedDelta); - } - // Process any additional steps this frame - while (this._elapsed >= msPerFrame) - { - this._elapsed -= msPerFrame; +/***/ }), - this.step(fixedDelta); - } - }, +/***/ 36627: +/***/ ((module) => { - /** - * Advances the simulation by a time increment. - * - * @method Phaser.Physics.Arcade.World#step - * @fires Phaser.Physics.Arcade.Events#WORLD_STEP - * @since 3.10.0 - * - * @param {number} delta - The delta time amount, in seconds, by which to advance the simulation. - */ - step: function (delta) - { - // Update all active bodies - var i; - var body; - var bodies = this.bodies.entries; - var len = bodies.length; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - for (i = 0; i < len; i++) - { - body = bodies[i]; +/** + * The File Load Complete Event. + * + * This event is dispatched by the Loader Plugin when _any_ file in the queue finishes loading. + * + * Listen to it from a Scene using: `this.load.on('filecomplete', listener)`. + * + * Make sure you remove this listener when you have finished, or it will continue to fire if the Scene reloads. + * + * You can also listen for the completion of a specific file. See the [FILE_KEY_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_KEY_COMPLETE} event. + * + * @event Phaser.Loader.Events#FILE_COMPLETE + * @type {string} + * @since 3.0.0 + * + * @param {string} key - The key of the file that just loaded and finished processing. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`. + * @param {any} [data] - The raw data the file contained. If the file was a multi-file, like an atlas or bitmap font, this parameter will be undefined. + */ +module.exports = 'filecomplete'; - if (body.enable) - { - body.update(delta); - } - } - // Optionally populate our dynamic collision tree - if (this.useTree) - { - this.tree.clear(); - this.tree.load(bodies); - } +/***/ }), - // Process any colliders - var colliders = this.colliders.update(); +/***/ 81925: +/***/ ((module) => { - for (i = 0; i < colliders.length; i++) - { - var collider = colliders[i]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (collider.active) - { - collider.update(); - } - } +/** + * The File Load Complete Event. + * + * This event is dispatched by the Loader Plugin when any file in the queue finishes loading. + * + * It uses a special dynamic event name constructed from the key and type of the file. + * + * For example, if you have loaded an `image` with a key of `monster`, you can listen for it + * using the following: + * + * ```javascript + * this.load.on('filecomplete-image-monster', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * Or, if you have loaded a texture `atlas` with a key of `Level1`: + * + * ```javascript + * this.load.on('filecomplete-atlasjson-Level1', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`: + * + * ```javascript + * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) { + * // Your handler code + * }); + * ``` + * + * Make sure you remove your listeners when you have finished, or they will continue to fire if the Scene reloads. + * + * You can also listen for the generic completion of files. See the [FILE_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_COMPLETE} event. + * + * @event Phaser.Loader.Events#FILE_KEY_COMPLETE + * @type {string} + * @since 3.0.0 + * + * @param {string} key - The key of the file that just loaded and finished processing. + * @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`. + * @param {any} [data] - The raw data the file contained. If the file was a multi-file, like an atlas or bitmap font, this parameter will be undefined. + */ +module.exports = 'filecomplete-'; - this.emit(Events.WORLD_STEP, delta); - this.stepsLastFrame++; - }, +/***/ }), - /** - * Updates bodies, draws the debug display, and handles pending queue operations. - * - * @method Phaser.Physics.Arcade.World#postUpdate - * @since 3.0.0 - */ - postUpdate: function () - { - var i; - var body; - var bodies = this.bodies.entries; - var len = bodies.length; +/***/ 29774: +/***/ ((module) => { - var dynamic = this.bodies; - var staticBodies = this.staticBodies; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // We don't need to postUpdate if there wasn't a step this frame - if (this.stepsLastFrame) - { - this.stepsLastFrame = 0; +/** + * The File Load Error Event. + * + * This event is dispatched by the Loader Plugin when a file fails to load. + * + * Listen to it from a Scene using: `this.load.on('loaderror', listener)`. + * + * @event Phaser.Loader.Events#FILE_LOAD_ERROR + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Loader.File} file - A reference to the File which errored during load. + */ +module.exports = 'loaderror'; - for (i = 0; i < len; i++) - { - body = bodies[i]; - if (body.enable) - { - body.postUpdate(); - } - } - } +/***/ }), - if (this.drawDebug) - { - var graphics = this.debugGraphic; +/***/ 20943: +/***/ ((module) => { - graphics.clear(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - for (i = 0; i < len; i++) - { - body = bodies[i]; +/** + * The File Load Event. + * + * This event is dispatched by the Loader Plugin when a file finishes loading, + * but _before_ it is processed and added to the internal Phaser caches. + * + * Listen to it from a Scene using: `this.load.on('load', listener)`. + * + * @event Phaser.Loader.Events#FILE_LOAD + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Loader.File} file - A reference to the File which just finished loading. + */ +module.exports = 'load'; - if (body.willDrawDebug()) - { - body.drawDebug(graphics); - } - } - bodies = staticBodies.entries; - len = bodies.length; +/***/ }), - for (i = 0; i < len; i++) - { - body = bodies[i]; +/***/ 74693: +/***/ ((module) => { - if (body.willDrawDebug()) - { - body.drawDebug(graphics); - } - } - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var pending = this.pendingDestroy; +/** + * The File Load Progress Event. + * + * This event is dispatched by the Loader Plugin during the load of a file, if the browser receives a DOM ProgressEvent and + * the `lengthComputable` event property is true. Depending on the size of the file and browser in use, this may, or may not happen. + * + * Listen to it from a Scene using: `this.load.on('fileprogress', listener)`. + * + * @event Phaser.Loader.Events#FILE_PROGRESS + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Loader.File} file - A reference to the File which errored during load. + * @param {number} percentComplete - A value between 0 and 1 indicating how 'complete' this file is. + */ +module.exports = 'fileprogress'; - if (pending.size > 0) - { - var dynamicTree = this.tree; - var staticTree = this.staticTree; - bodies = pending.entries; - len = bodies.length; +/***/ }), - for (i = 0; i < len; i++) - { - body = bodies[i]; +/***/ 71176: +/***/ ((module) => { - if (body.physicsType === CONST.DYNAMIC_BODY) - { - dynamicTree.remove(body); - dynamic.delete(body); - } - else if (body.physicsType === CONST.STATIC_BODY) - { - staticTree.remove(body); - staticBodies.delete(body); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - body.world = undefined; - body.gameObject = undefined; - } +/** + * The Loader Plugin Post Process Event. + * + * This event is dispatched by the Loader Plugin when the Loader has finished loading everything in the load queue. + * It is dispatched before the internal lists are cleared and each File is destroyed. + * + * Use this hook to perform any last minute processing of files that can only happen once the + * Loader has completed, but prior to it emitting the `complete` event. + * + * Listen to it from a Scene using: `this.load.on('postprocess', listener)`. + * + * @event Phaser.Loader.Events#POST_PROCESS + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + */ +module.exports = 'postprocess'; - pending.clear(); - } - }, - /** - * Calculates a Body's velocity and updates its position. - * - * @method Phaser.Physics.Arcade.World#updateMotion - * @since 3.0.0 - * - * @param {Phaser.Physics.Arcade.Body} body - The Body to be updated. - * @param {number} delta - The delta value to be used in the motion calculations, in seconds. - */ - updateMotion: function (body, delta) - { - if (body.allowRotation) - { - this.computeAngularVelocity(body, delta); - } +/***/ }), - this.computeVelocity(body, delta); - }, +/***/ 88984: +/***/ ((module) => { - /** - * Calculates a Body's angular velocity. - * - * @method Phaser.Physics.Arcade.World#computeAngularVelocity - * @since 3.10.0 - * - * @param {Phaser.Physics.Arcade.Body} body - The Body to compute the velocity for. - * @param {number} delta - The delta value to be used in the calculation, in seconds. - */ - computeAngularVelocity: function (body, delta) - { - var velocity = body.angularVelocity; - var acceleration = body.angularAcceleration; - var drag = body.angularDrag; - var max = body.maxAngular; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (acceleration) - { - velocity += acceleration * delta; - } - else if (body.allowDrag && drag) - { - drag *= delta; +/** + * The Loader Plugin Progress Event. + * + * This event is dispatched when the Loader updates its load progress, typically as a result of a file having completed loading. + * + * Listen to it from a Scene using: `this.load.on('progress', listener)`. + * + * @event Phaser.Loader.Events#PROGRESS + * @type {string} + * @since 3.0.0 + * + * @param {number} progress - The current progress of the load. A value between 0 and 1. + */ +module.exports = 'progress'; - if (FuzzyGreaterThan(velocity - drag, 0, 0.1)) - { - velocity -= drag; - } - else if (FuzzyLessThan(velocity + drag, 0, 0.1)) - { - velocity += drag; - } - else - { - velocity = 0; - } - } - velocity = Clamp(velocity, -max, max); +/***/ }), - var velocityDelta = velocity - body.angularVelocity; +/***/ 72753: +/***/ ((module) => { - body.angularVelocity += velocityDelta; - body.rotation += (body.angularVelocity * delta); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Calculates a Body's per-axis velocity. - * - * @method Phaser.Physics.Arcade.World#computeVelocity - * @since 3.0.0 - * - * @param {Phaser.Physics.Arcade.Body} body - The Body to compute the velocity for. - * @param {number} delta - The delta value to be used in the calculation, in seconds. - */ - computeVelocity: function (body, delta) - { - var velocityX = body.velocity.x; - var accelerationX = body.acceleration.x; - var dragX = body.drag.x; - var maxX = body.maxVelocity.x; +/** + * The Loader Plugin Start Event. + * + * This event is dispatched when the Loader starts running. At this point load progress is zero. + * + * This event is dispatched even if there aren't any files in the load queue. + * + * Listen to it from a Scene using: `this.load.on('start', listener)`. + * + * @event Phaser.Loader.Events#START + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. + */ +module.exports = 'start'; - var velocityY = body.velocity.y; - var accelerationY = body.acceleration.y; - var dragY = body.drag.y; - var maxY = body.maxVelocity.y; - var speed = body.speed; - var maxSpeed = body.maxSpeed; - var allowDrag = body.allowDrag; - var useDamping = body.useDamping; +/***/ }), - if (body.allowGravity) - { - velocityX += (this.gravity.x + body.gravity.x) * delta; - velocityY += (this.gravity.y + body.gravity.y) * delta; - } +/***/ 683: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (accelerationX) - { - velocityX += accelerationX * delta; - } - else if (allowDrag && dragX) - { - if (useDamping) - { - // Damping based deceleration - dragX = Math.pow(dragX, delta); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - velocityX *= dragX; +/** + * @namespace Phaser.Loader.Events + */ - speed = Math.sqrt(velocityX * velocityX + velocityY * velocityY); +module.exports = { - if (FuzzyEqual(speed, 0, 0.001)) - { - velocityX = 0; - } - } - else - { - // Linear deceleration - dragX *= delta; + ADD: __webpack_require__(7398), + COMPLETE: __webpack_require__(52187), + FILE_COMPLETE: __webpack_require__(36627), + FILE_KEY_COMPLETE: __webpack_require__(81925), + FILE_LOAD_ERROR: __webpack_require__(29774), + FILE_LOAD: __webpack_require__(20943), + FILE_PROGRESS: __webpack_require__(74693), + POST_PROCESS: __webpack_require__(71176), + PROGRESS: __webpack_require__(88984), + START: __webpack_require__(72753) - if (FuzzyGreaterThan(velocityX - dragX, 0, 0.01)) - { - velocityX -= dragX; - } - else if (FuzzyLessThan(velocityX + dragX, 0, 0.01)) - { - velocityX += dragX; - } - else - { - velocityX = 0; - } - } - } +}; - if (accelerationY) - { - velocityY += accelerationY * delta; - } - else if (allowDrag && dragY) - { - if (useDamping) - { - // Damping based deceleration - dragY = Math.pow(dragY, delta); - velocityY *= dragY; +/***/ }), - speed = Math.sqrt(velocityX * velocityX + velocityY * velocityY); +/***/ 46468: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (FuzzyEqual(speed, 0, 0.001)) - { - velocityY = 0; - } - } - else - { - // Linear deceleration - dragY *= delta; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (FuzzyGreaterThan(velocityY - dragY, 0, 0.01)) - { - velocityY -= dragY; - } - else if (FuzzyLessThan(velocityY + dragY, 0, 0.01)) - { - velocityY += dragY; - } - else - { - velocityY = 0; - } - } - } +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var JSONFile = __webpack_require__(70806); +var LoaderEvents = __webpack_require__(683); - velocityX = Clamp(velocityX, -maxX, maxX); - velocityY = Clamp(velocityY, -maxY, maxY); +/** + * @classdesc + * A single Animation JSON File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#animation method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#animation. + * + * @class AnimationJSONFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + */ +var AnimationJSONFile = new Class({ - body.velocity.set(velocityX, velocityY); + Extends: JSONFile, - if (maxSpeed > -1 && speed > maxSpeed) - { - body.velocity.normalize().scale(maxSpeed); - speed = maxSpeed; - } + initialize: - body.speed = speed; + // url can either be a string, in which case it is treated like a proper url, or an object, in which case it is treated as a ready-made JS Object + // dataKey allows you to pluck a specific object out of the JSON and put just that into the cache, rather than the whole thing + + function AnimationJSONFile (loader, key, url, xhrSettings, dataKey) + { + JSONFile.call(this, loader, key, url, xhrSettings, dataKey); + + this.type = 'animationJSON'; }, /** - * Separates two Bodies. - * - * @method Phaser.Physics.Arcade.World#separate - * @fires Phaser.Physics.Arcade.Events#COLLIDE - * @fires Phaser.Physics.Arcade.Events#OVERLAP - * @since 3.0.0 + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. * - * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated. - * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to be separated. - * @param {ArcadePhysicsCallback} [processCallback] - The process callback. - * @param {*} [callbackContext] - The context in which to invoke the callback. - * @param {boolean} [overlapOnly] - If this a collide or overlap check? - * @param {boolean} [intersects] - Assert that the bodies intersect and should not be tested before separation. + * @method Phaser.Loader.FileTypes.AnimationJSONFile#onProcess + * @since 3.7.0 + */ + onProcess: function () + { + // We need to hook into this event: + this.loader.once(LoaderEvents.POST_PROCESS, this.onLoadComplete, this); + + // But the rest is the same as a normal JSON file + JSONFile.prototype.onProcess.call(this); + }, + + /** + * Called at the end of the load process, after the Loader has finished all files in its queue. * - * @return {boolean} True if separation occurred, otherwise false. + * @method Phaser.Loader.FileTypes.AnimationJSONFile#onLoadComplete + * @since 3.7.0 */ - separate: function (body1, body2, processCallback, callbackContext, overlapOnly, intersects) + onLoadComplete: function () { - if ( - !intersects && - !body1.enable || - !body2.enable || - body1.checkCollision.none || - body2.checkCollision.none || - !this.intersects(body1, body2)) - { - return false; - } + this.loader.systems.anims.fromJSON(this.data); + } - // They overlap. Is there a custom process callback? If it returns true then we can carry on, otherwise we should abort. - if (processCallback && processCallback.call(callbackContext, body1.gameObject, body2.gameObject) === false) - { - return false; - } +}); + +/** + * Adds an Animation JSON Data file, or array of Animation JSON files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.animation('baddieAnims', 'files/BaddieAnims.json'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring + * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. + * + * The key must be a unique String. It is used to add the file to the global JSON Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the JSON Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the JSON Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.animation({ + * key: 'baddieAnims', + * url: 'files/BaddieAnims.json' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.JSONFileConfig` for more details. + * + * Once the file has finished loading it will automatically be passed to the global Animation Managers `fromJSON` method. + * This will parse all of the JSON data and create animation data from it. This process happens at the very end + * of the Loader, once every other file in the load queue has finished. The reason for this is to allow you to load + * both animation data and the images it relies upon in the same load call. + * + * Once the animation data has been parsed you will be able to play animations using that data. + * Please see the Animation Manager `fromJSON` method for more details about the format and playback. + * + * You can also access the raw animation data from its Cache using its key: + * + * ```javascript + * this.load.animation('baddieAnims', 'files/BaddieAnims.json'); + * // and later in your game ... + * var data = this.cache.json.get('baddieAnims'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and + * this is what you would use to retrieve the text from the JSON Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" + * and no URL is given then the Loader will set the URL to be "data.json". It will always add `.json` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * You can also optionally provide a `dataKey` to use. This allows you to extract only a part of the JSON and store it in the Cache, + * rather than the whole file. For example, if your JSON data had a structure like this: + * + * ```json + * { + * "level1": { + * "baddies": { + * "aliens": {}, + * "boss": {} + * } + * }, + * "level2": {}, + * "level3": {} + * } + * ``` + * + * And if you only wanted to create animations from the `boss` data, then you could pass `level1.baddies.boss`as the `dataKey`. + * + * Note: The ability to load this type of file will only be available if the JSON File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#animation + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". + * @param {string} [dataKey] - When the Animation JSON file loads only this property will be stored in the Cache and used to create animation data. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('animation', function (key, url, dataKey, xhrSettings) +{ + // Supports an Object file definition in the key argument + // Or an array of objects in the key argument + // Or a single entry where all arguments have been defined - // Circle vs. Circle quick bail out - if (body1.isCircle && body2.isCircle) + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) { - return this.separateCircle(body1, body2, overlapOnly); + this.addFile(new AnimationJSONFile(this, key[i])); } + } + else + { + this.addFile(new AnimationJSONFile(this, key, url, xhrSettings, dataKey)); + } - // We define the behavior of bodies in a collision circle and rectangle - // If a collision occurs in the corner points of the rectangle, the body behave like circles + return this; +}); - // Either body1 or body2 is a circle - if (body1.isCircle !== body2.isCircle) - { - var bodyRect = (body1.isCircle) ? body2 : body1; - var bodyCircle = (body1.isCircle) ? body1 : body2; +module.exports = AnimationJSONFile; - var rect = { - x: bodyRect.x, - y: bodyRect.y, - right: bodyRect.right, - bottom: bodyRect.bottom - }; - var circle = bodyCircle.center; +/***/ }), - if (circle.y < rect.y || circle.y > rect.bottom) - { - if (circle.x < rect.x || circle.x > rect.right) - { - return this.separateCircle(body1, body2, overlapOnly); - } - } - } +/***/ 31648: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var resultX = false; - var resultY = false; +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var ImageFile = __webpack_require__(42927); +var IsPlainObject = __webpack_require__(42911); +var JSONFile = __webpack_require__(70806); +var MultiFile = __webpack_require__(45176); - // Do we separate on x first or y first or both? - if (overlapOnly) - { - // No separation but we need to calculate overlapX, overlapY, etc. - resultX = SeparateX(body1, body2, overlapOnly, this.OVERLAP_BIAS); - resultY = SeparateY(body1, body2, overlapOnly, this.OVERLAP_BIAS); - } - else if (this.forceX || Math.abs(this.gravity.y + body1.gravity.y) < Math.abs(this.gravity.x + body1.gravity.x)) +/** + * @classdesc + * A single JSON based Texture Atlas File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#atlas method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlas. + * + * https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-for-phaser3?source=photonstorm + * + * @class AsepriteFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.AsepriteFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {object|string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + */ +var AsepriteFile = new Class({ + + Extends: MultiFile, + + initialize: + + function AsepriteFile (loader, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) + { + var image; + var data; + + if (IsPlainObject(key)) { - resultX = SeparateX(body1, body2, overlapOnly, this.OVERLAP_BIAS); + var config = key; - // Are they still intersecting? Let's do the other axis then - if (this.intersects(body1, body2)) - { - resultY = SeparateY(body1, body2, overlapOnly, this.OVERLAP_BIAS); - } + key = GetFastValue(config, 'key'); + + image = new ImageFile(loader, { + key: key, + url: GetFastValue(config, 'textureURL'), + extension: GetFastValue(config, 'textureExtension', 'png'), + normalMap: GetFastValue(config, 'normalMap'), + xhrSettings: GetFastValue(config, 'textureXhrSettings') + }); + + data = new JSONFile(loader, { + key: key, + url: GetFastValue(config, 'atlasURL'), + extension: GetFastValue(config, 'atlasExtension', 'json'), + xhrSettings: GetFastValue(config, 'atlasXhrSettings') + }); } else { - resultY = SeparateY(body1, body2, overlapOnly, this.OVERLAP_BIAS); - - // Are they still intersecting? Let's do the other axis then - if (this.intersects(body1, body2)) - { - resultX = SeparateX(body1, body2, overlapOnly, this.OVERLAP_BIAS); - } + image = new ImageFile(loader, key, textureURL, textureXhrSettings); + data = new JSONFile(loader, key, atlasURL, atlasXhrSettings); } - var result = (resultX || resultY); - - if (result) + if (image.linkFile) { - if (overlapOnly) - { - if (body1.onOverlap || body2.onOverlap) - { - this.emit(Events.OVERLAP, body1.gameObject, body2.gameObject, body1, body2); - } - } - else if (body1.onCollide || body2.onCollide) - { - this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2); - } + // Image has a normal map + MultiFile.call(this, loader, 'atlasjson', key, [ image, data, image.linkFile ]); + } + else + { + MultiFile.call(this, loader, 'atlasjson', key, [ image, data ]); } - - return result; }, /** - * Separates two Bodies, when both are circular. - * - * @method Phaser.Physics.Arcade.World#separateCircle - * @fires Phaser.Physics.Arcade.Events#COLLIDE - * @fires Phaser.Physics.Arcade.Events#OVERLAP - * @since 3.0.0 - * - * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated. - * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to be separated. - * @param {boolean} [overlapOnly] - If this a collide or overlap check? - * @param {number} [bias] - A small value added to the calculations. + * Adds this file to its target cache upon successful loading and processing. * - * @return {boolean} True if separation occurred, otherwise false. + * @method Phaser.Loader.FileTypes.AsepriteFile#addToCache + * @since 3.7.0 */ - separateCircle: function (body1, body2, overlapOnly, bias) + addToCache: function () { - // Set the bounding box overlap values into the bodies themselves (hence we don't use the return values here) - GetOverlapX(body1, body2, false, bias); - GetOverlapY(body1, body2, false, bias); - - var overlap = 0; - - if (body1.isCircle !== body2.isCircle) + if (this.isReadyToProcess()) { - var rect = { - x: (body2.isCircle) ? body1.position.x : body2.position.x, - y: (body2.isCircle) ? body1.position.y : body2.position.y, - right: (body2.isCircle) ? body1.right : body2.right, - bottom: (body2.isCircle) ? body1.bottom : body2.bottom - }; + var image = this.files[0]; + var json = this.files[1]; + var normalMap = (this.files[2]) ? this.files[2].data : null; - var circle = { - x: (body1.isCircle) ? body1.center.x : body2.center.x, - y: (body1.isCircle) ? body1.center.y : body2.center.y, - radius: (body1.isCircle) ? body1.halfWidth : body2.halfWidth - }; + this.loader.textureManager.addAtlas(image.key, image.data, json.data, normalMap); - if (circle.y < rect.y) - { - if (circle.x < rect.x) - { - overlap = DistanceBetween(circle.x, circle.y, rect.x, rect.y) - circle.radius; - } - else if (circle.x > rect.right) - { - overlap = DistanceBetween(circle.x, circle.y, rect.right, rect.y) - circle.radius; - } - } - else if (circle.y > rect.bottom) - { - if (circle.x < rect.x) - { - overlap = DistanceBetween(circle.x, circle.y, rect.x, rect.bottom) - circle.radius; - } - else if (circle.x > rect.right) - { - overlap = DistanceBetween(circle.x, circle.y, rect.right, rect.bottom) - circle.radius; - } - } + json.addToCache(); - overlap *= -1; - } - else - { - overlap = (body1.halfWidth + body2.halfWidth) - DistanceBetween(body1.center.x, body1.center.y, body2.center.x, body2.center.y); + this.complete = true; } + } - body1.overlapR = overlap; - body2.overlapR = overlap; - - // Can't separate two immovable bodies, or a body with its own custom separation logic - if (overlapOnly || overlap === 0 || (body1.immovable && body2.immovable) || body1.customSeparateX || body2.customSeparateX) - { - if (overlap !== 0 && (body1.onOverlap || body2.onOverlap)) - { - this.emit(Events.OVERLAP, body1.gameObject, body2.gameObject, body1, body2); - } +}); - // return true if there was some overlap, otherwise false - return (overlap !== 0); - } +/** + * Aseprite is a powerful animated sprite editor and pixel art tool. + * + * You can find more details at https://www.aseprite.org/ + * + * Adds a JSON based Aseprite Animation, or array of animations, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.aseprite('gladiator', 'images/Gladiator.png', 'images/Gladiator.json'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring + * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. + * + * To export a compatible JSON file in Aseprite, please do the following: + * + * 1. Go to "File - Export Sprite Sheet" + * + * 2. On the **Layout** tab: + * 2a. Set the "Sheet type" to "Packed" + * 2b. Set the "Constraints" to "None" + * 2c. Check the "Merge Duplicates" checkbox + * + * 3. On the **Sprite** tab: + * 3a. Set "Layers" to "Visible layers" + * 3b. Set "Frames" to "All frames", unless you only wish to export a sub-set of tags + * + * 4. On the **Borders** tab: + * 4a. Check the "Trim Sprite" and "Trim Cells" options + * 4b. Ensure "Border Padding", "Spacing" and "Inner Padding" are all > 0 (1 is usually enough) + * + * 5. On the **Output** tab: + * 5a. Check "Output File", give your image a name and make sure you choose "png files" as the file type + * 5b. Check "JSON Data" and give your json file a name + * 5c. The JSON Data type can be either a Hash or Array, Phaser doesn't mind. + * 5d. Make sure "Tags" is checked in the Meta options + * 5e. In the "Item Filename" input box, make sure it says just "{frame}" and nothing more. + * + * 6. Click export + * + * This was tested with Aseprite 1.2.25. + * + * This will export a png and json file which you can load using the Aseprite Loader, i.e.: + * + * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.aseprite({ + * key: 'gladiator', + * textureURL: 'images/Gladiator.png', + * atlasURL: 'images/Gladiator.json' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.AsepriteFileConfig` for more details. + * + * Instead of passing a URL for the JSON data you can also pass in a well formed JSON object instead. + * + * Once loaded, you can call this method from within a Scene with the 'atlas' key: + * + * ```javascript + * this.anims.createFromAseprite('paladin'); + * ``` + * + * Any animations defined in the JSON will now be available to use in Phaser and you play them + * via their Tag name. For example, if you have an animation called 'War Cry' on your Aseprite timeline, + * you can play it in Phaser using that Tag name: + * + * ```javascript + * this.add.sprite(400, 300).play('War Cry'); + * ``` + * + * When calling this method you can optionally provide an array of tag names, and only those animations + * will be created. For example: + * + * ```javascript + * this.anims.createFromAseprite('paladin', [ 'step', 'War Cry', 'Magnum Break' ]); + * ``` + * + * This will only create the 3 animations defined. Note that the tag names are case-sensitive. + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Aseprite File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#aseprite + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.50.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.AsepriteFileConfig|Phaser.Types.Loader.FileTypes.AsepriteFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {object|string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('aseprite', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) +{ + var multifile; - var dx = body1.center.x - body2.center.x; - var dy = body1.center.y - body2.center.y; - var d = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)); - var nx = ((body2.center.x - body1.center.x) / d) || 0; - var ny = ((body2.center.y - body1.center.y) / d) || 0; - var p = 2 * (body1.velocity.x * nx + body1.velocity.y * ny - body2.velocity.x * nx - body2.velocity.y * ny) / (body1.mass + body2.mass); + // Supports an Object file definition in the key argument + // Or an array of objects in the key argument + // Or a single entry where all arguments have been defined - if (body1.immovable || body2.immovable) + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) { - p *= 2; - } + multifile = new AsepriteFile(this, key[i]); - if (!body1.immovable) - { - body1.velocity.x = (body1.velocity.x - p / body1.mass * nx); - body1.velocity.y = (body1.velocity.y - p / body1.mass * ny); + this.addFile(multifile.files); } + } + else + { + multifile = new AsepriteFile(this, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings); - if (!body2.immovable) - { - body2.velocity.x = (body2.velocity.x + p / body2.mass * nx); - body2.velocity.y = (body2.velocity.y + p / body2.mass * ny); - } + this.addFile(multifile.files); + } - if (!body1.immovable && !body2.immovable) - { - overlap /= 2; - } + return this; +}); - // Note: This is inadequate for circle-rectangle separation +module.exports = AsepriteFile; - var angle = AngleBetweenPoints(body1.center, body2.center); - var overlapX = (overlap + MATH_CONST.EPSILON) * Math.cos(angle); - var overlapY = (overlap + MATH_CONST.EPSILON) * Math.sin(angle); - if (!body1.immovable) - { - body1.x -= overlapX; - body1.y -= overlapY; +/***/ }), - body1.updateCenter(); - } +/***/ 73152: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (!body2.immovable) - { - body2.x += overlapX; - body2.y += overlapY; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - body2.updateCenter(); - } +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var ImageFile = __webpack_require__(42927); +var IsPlainObject = __webpack_require__(42911); +var JSONFile = __webpack_require__(70806); +var MultiFile = __webpack_require__(45176); - body1.velocity.x *= body1.bounce.x; - body1.velocity.y *= body1.bounce.y; - body2.velocity.x *= body2.bounce.x; - body2.velocity.y *= body2.bounce.y; +/** + * @classdesc + * A single JSON based Texture Atlas File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#atlas method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlas. + * + * https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-for-phaser3?source=photonstorm + * + * @class AtlasJSONFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.AtlasJSONFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {object|string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + */ +var AtlasJSONFile = new Class({ - if (body1.onCollide || body2.onCollide) - { - this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2); - } + Extends: MultiFile, - return true; - }, + initialize: - /** - * Checks to see if two Bodies intersect at all. - * - * @method Phaser.Physics.Arcade.World#intersects - * @since 3.0.0 - * - * @param {Phaser.Physics.Arcade.Body} body1 - The first body to check. - * @param {Phaser.Physics.Arcade.Body} body2 - The second body to check. - * - * @return {boolean} True if the two bodies intersect, otherwise false. - */ - intersects: function (body1, body2) + function AtlasJSONFile (loader, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) { - if (body1 === body2) + var image; + var data; + + if (IsPlainObject(key)) { - return false; - } + var config = key; - if (!body1.isCircle && !body2.isCircle) + key = GetFastValue(config, 'key'); + + image = new ImageFile(loader, { + key: key, + url: GetFastValue(config, 'textureURL'), + extension: GetFastValue(config, 'textureExtension', 'png'), + normalMap: GetFastValue(config, 'normalMap'), + xhrSettings: GetFastValue(config, 'textureXhrSettings') + }); + + data = new JSONFile(loader, { + key: key, + url: GetFastValue(config, 'atlasURL'), + extension: GetFastValue(config, 'atlasExtension', 'json'), + xhrSettings: GetFastValue(config, 'atlasXhrSettings') + }); + } + else { - // Rect vs. Rect - return !( - body1.right <= body2.position.x || - body1.bottom <= body2.position.y || - body1.position.x >= body2.right || - body1.position.y >= body2.bottom - ); + image = new ImageFile(loader, key, textureURL, textureXhrSettings); + data = new JSONFile(loader, key, atlasURL, atlasXhrSettings); } - else if (body1.isCircle) + + if (image.linkFile) { - if (body2.isCircle) - { - // Circle vs. Circle - return DistanceBetween(body1.center.x, body1.center.y, body2.center.x, body2.center.y) <= (body1.halfWidth + body2.halfWidth); - } - else - { - // Circle vs. Rect - return this.circleBodyIntersects(body1, body2); - } + // Image has a normal map + MultiFile.call(this, loader, 'atlasjson', key, [ image, data, image.linkFile ]); } else { - // Rect vs. Circle - return this.circleBodyIntersects(body2, body1); + MultiFile.call(this, loader, 'atlasjson', key, [ image, data ]); } }, /** - * Tests if a circular Body intersects with another Body. - * - * @method Phaser.Physics.Arcade.World#circleBodyIntersects - * @since 3.0.0 - * - * @param {Phaser.Physics.Arcade.Body} circle - The circular body to test. - * @param {Phaser.Physics.Arcade.Body} body - The rectangular body to test. + * Adds this file to its target cache upon successful loading and processing. * - * @return {boolean} True if the two bodies intersect, otherwise false. + * @method Phaser.Loader.FileTypes.AtlasJSONFile#addToCache + * @since 3.7.0 */ - circleBodyIntersects: function (circle, body) + addToCache: function () { - var x = Clamp(circle.center.x, body.left, body.right); - var y = Clamp(circle.center.y, body.top, body.bottom); - - var dx = (circle.center.x - x) * (circle.center.x - x); - var dy = (circle.center.y - y) * (circle.center.y - y); + if (this.isReadyToProcess()) + { + var image = this.files[0]; + var json = this.files[1]; + var normalMap = (this.files[2]) ? this.files[2].data : null; - return (dx + dy) <= (circle.halfWidth * circle.halfWidth); - }, + this.loader.textureManager.addAtlas(image.key, image.data, json.data, normalMap); - /** - * Tests if Game Objects overlap. - * - * See details in {@link Phaser.Physics.Arcade.World#collide}. - * - * @method Phaser.Physics.Arcade.World#overlap - * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object or array of objects to check. - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. - * @param {ArcadePhysicsCallback} [overlapCallback] - An optional callback function that is called if the objects overlap. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they overlap. If this is set then `overlapCallback` will only be called if this callback returns `true`. - * @param {*} [callbackContext] - The context in which to run the callbacks. - * - * @return {boolean} True if at least one Game Object overlaps another. - * - * @see Phaser.Physics.Arcade.World#collide - */ - overlap: function (object1, object2, overlapCallback, processCallback, callbackContext) - { - if (overlapCallback === undefined) { overlapCallback = null; } - if (processCallback === undefined) { processCallback = null; } - if (callbackContext === undefined) { callbackContext = overlapCallback; } + this.complete = true; + } + } - return this.collideObjects(object1, object2, overlapCallback, processCallback, callbackContext, true); - }, +}); - /** - * Performs a collision check and separation between the two physics enabled objects given, which can be single - * Game Objects, arrays of Game Objects, Physics Groups, arrays of Physics Groups or normal Groups. - * - * If you don't require separation then use {@link Phaser.Physics.Arcade.World#overlap} instead. - * - * If two Groups or arrays are passed, each member of one will be tested against each member of the other. - * - * If **only** one Group is passed (as `object1`), each member of the Group will be collided against the other members. - * - * If **only** one Array is passed, the array is iterated and every element in it is tested against the others. - * - * Two callbacks can be provided; they receive the colliding game objects as arguments. - * If an overlap is detected, the `processCallback` is called first. It can cancel the collision by returning false. - * Next the objects are separated and `collideCallback` is invoked. - * - * Arcade Physics uses the Projection Method of collision resolution and separation. While it's fast and suitable - * for 'arcade' style games it lacks stability when multiple objects are in close proximity or resting upon each other. - * The separation that stops two objects penetrating may create a new penetration against a different object. If you - * require a high level of stability please consider using an alternative physics system, such as Matter.js. - * - * @method Phaser.Physics.Arcade.World#collide - * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object or array of objects to check. - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} [callbackContext] - The context in which to run the callbacks. - * - * @return {boolean} `true` if any overlapping Game Objects were separated, otherwise `false`. - */ - collide: function (object1, object2, collideCallback, processCallback, callbackContext) - { - if (collideCallback === undefined) { collideCallback = null; } - if (processCallback === undefined) { processCallback = null; } - if (callbackContext === undefined) { callbackContext = collideCallback; } +/** + * Adds a JSON based Texture Atlas, or array of atlases, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.atlas('mainmenu', 'images/MainMenu.png', 'images/MainMenu.json'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring + * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. + * + * Phaser expects the atlas data to be provided in a JSON file, using either the JSON Hash or JSON Array format. + * + * These files are created by software such as: + * + * * [Texture Packer](https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-for-phaser3?source=photonstorm) + * * [Shoebox](https://renderhjs.net/shoebox/) + * * [Gamma Texture Packer](https://gammafp.com/tool/atlas-packer/) + * * [Adobe Flash / Animate](https://www.adobe.com/uk/products/animate.html) + * * [Free Texture Packer](http://free-tex-packer.com/) + * * [Leshy SpriteSheet Tool](https://www.leshylabs.com/apps/sstool/) + * + * If you are using Texture Packer and have enabled multi-atlas support, then please use the Phaser Multi Atlas loader + * instead of this one. + * + * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.atlas({ + * key: 'mainmenu', + * textureURL: 'images/MainMenu.png', + * atlasURL: 'images/MainMenu.json' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.AtlasJSONFileConfig` for more details. + * + * Instead of passing a URL for the atlas JSON data you can also pass in a well formed JSON object instead. + * + * Once the atlas has finished loading you can use frames from it as textures for a Game Object by referencing its key: + * + * ```javascript + * this.load.atlas('mainmenu', 'images/MainMenu.png', 'images/MainMenu.json'); + * // and later in your game ... + * this.add.image(x, y, 'mainmenu', 'background'); + * ``` + * + * To get a list of all available frames within an atlas please consult your Texture Atlas software. + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, + * then you can specify it by providing an array as the `url` where the second element is the normal map: + * + * ```javascript + * this.load.atlas('mainmenu', [ 'images/MainMenu.png', 'images/MainMenu-n.png' ], 'images/MainMenu.json'); + * ``` + * + * Or, if you are using a config object use the `normalMap` property: + * + * ```javascript + * this.load.atlas({ + * key: 'mainmenu', + * textureURL: 'images/MainMenu.png', + * normalMap: 'images/MainMenu-n.png', + * atlasURL: 'images/MainMenu.json' + * }); + * ``` + * + * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. + * Normal maps are a WebGL only feature. + * + * Note: The ability to load this type of file will only be available if the Atlas JSON File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#atlas + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.AtlasJSONFileConfig|Phaser.Types.Loader.FileTypes.AtlasJSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {object|string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('atlas', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) +{ + var multifile; - return this.collideObjects(object1, object2, collideCallback, processCallback, callbackContext, false); - }, + // Supports an Object file definition in the key argument + // Or an array of objects in the key argument + // Or a single entry where all arguments have been defined - /** - * Internal helper function. Please use Phaser.Physics.Arcade.World#collide instead. - * - * @method Phaser.Physics.Arcade.World#collideObjects - * @private - * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object to check for collision. - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} [object2] - The second object to check for collision. - * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. - * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. - * @param {any} callbackContext - The scope in which to call the callbacks. - * @param {boolean} overlapOnly - Whether this is a collision or overlap check. - * - * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. - */ - collideObjects: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly) + if (Array.isArray(key)) { - var i; - var j; - - if (object1.isParent && object1.physicsType === undefined) + for (var i = 0; i < key.length; i++) { - object1 = object1.children.entries; - } + multifile = new AtlasJSONFile(this, key[i]); - if (object2 && object2.isParent && object2.physicsType === undefined) - { - object2 = object2.children.entries; + this.addFile(multifile.files); } + } + else + { + multifile = new AtlasJSONFile(this, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings); - var object1isArray = Array.isArray(object1); - var object2isArray = Array.isArray(object2); + this.addFile(multifile.files); + } - this._total = 0; + return this; +}); - if (!object1isArray && !object2isArray) +module.exports = AtlasJSONFile; + + +/***/ }), + +/***/ 24616: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var ImageFile = __webpack_require__(42927); +var IsPlainObject = __webpack_require__(42911); +var MultiFile = __webpack_require__(45176); +var XMLFile = __webpack_require__(15297); + +/** + * @classdesc + * A single XML based Texture Atlas File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#atlasXML method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlasXML. + * + * @class AtlasXMLFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.7.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.AtlasXMLFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas xml file. Used in replacement of the Loaders default XHR Settings. + */ +var AtlasXMLFile = new Class({ + + Extends: MultiFile, + + initialize: + + function AtlasXMLFile (loader, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) + { + var image; + var data; + + if (IsPlainObject(key)) { - // Neither of them are arrays - do this first as it's the most common use-case - this.collideHandler(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly); + var config = key; + + key = GetFastValue(config, 'key'); + + image = new ImageFile(loader, { + key: key, + url: GetFastValue(config, 'textureURL'), + extension: GetFastValue(config, 'textureExtension', 'png'), + normalMap: GetFastValue(config, 'normalMap'), + xhrSettings: GetFastValue(config, 'textureXhrSettings') + }); + + data = new XMLFile(loader, { + key: key, + url: GetFastValue(config, 'atlasURL'), + extension: GetFastValue(config, 'atlasExtension', 'xml'), + xhrSettings: GetFastValue(config, 'atlasXhrSettings') + }); } - else if (!object1isArray && object2isArray) + else { - // Object 2 is an Array - for (i = 0; i < object2.length; i++) - { - this.collideHandler(object1, object2[i], collideCallback, processCallback, callbackContext, overlapOnly); - } + image = new ImageFile(loader, key, textureURL, textureXhrSettings); + data = new XMLFile(loader, key, atlasURL, atlasXhrSettings); } - else if (object1isArray && !object2isArray) - { - // Object 1 is an Array - if (!object2) - { - // Special case for array vs. self - for (i = 0; i < object1.length; i++) - { - var child = object1[i]; - - for (j = i + 1; j < object1.length; j++) - { - if (i === j) - { - continue; - } - this.collideHandler(child, object1[j], collideCallback, processCallback, callbackContext, overlapOnly); - } - } - } - else - { - for (i = 0; i < object1.length; i++) - { - this.collideHandler(object1[i], object2, collideCallback, processCallback, callbackContext, overlapOnly); - } - } + if (image.linkFile) + { + // Image has a normal map + MultiFile.call(this, loader, 'atlasxml', key, [ image, data, image.linkFile ]); } else { - // They're both arrays - for (i = 0; i < object1.length; i++) - { - for (j = 0; j < object2.length; j++) - { - this.collideHandler(object1[i], object2[j], collideCallback, processCallback, callbackContext, overlapOnly); - } - } + MultiFile.call(this, loader, 'atlasxml', key, [ image, data ]); } - - return (this._total > 0); }, /** - * Internal helper function. Please use Phaser.Physics.Arcade.World#collide and Phaser.Physics.Arcade.World#overlap instead. - * - * @method Phaser.Physics.Arcade.World#collideHandler - * @private - * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object or array of objects to check. - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object2 - The second object or array of objects to check, or `undefined`. - * @param {ArcadePhysicsCallback} collideCallback - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} processCallback - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} callbackContext - The context in which to run the callbacks. - * @param {boolean} overlapOnly - Whether this is a collision or overlap check. + * Adds this file to its target cache upon successful loading and processing. * - * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + * @method Phaser.Loader.FileTypes.AtlasXMLFile#addToCache + * @since 3.7.0 */ - collideHandler: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly) + addToCache: function () { - // Collide Group with Self - // Only collide valid objects - if (object2 === undefined && object1.isParent) + if (this.isReadyToProcess()) { - return this.collideGroupVsGroup(object1, object1, collideCallback, processCallback, callbackContext, overlapOnly); - } + var image = this.files[0]; + var xml = this.files[1]; + var normalMap = (this.files[2]) ? this.files[2].data : null; - // If neither of the objects are set then bail out - if (!object1 || !object2) - { - return false; - } + this.loader.textureManager.addAtlasXML(image.key, image.data, xml.data, normalMap); - // A Body - if (object1.body) - { - if (object2.body) - { - return this.collideSpriteVsSprite(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly); - } - else if (object2.isParent) - { - return this.collideSpriteVsGroup(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly); - } - else if (object2.isTilemap) - { - return this.collideSpriteVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly); - } + this.complete = true; } + } - // GROUPS - else if (object1.isParent) +}); + +/** + * Adds an XML based Texture Atlas, or array of atlases, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.atlasXML('mainmenu', 'images/MainMenu.png', 'images/MainMenu.xml'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring + * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. + * + * Phaser expects the atlas data to be provided in an XML file format. + * These files are created by software such as Shoebox and Adobe Flash / Animate. + * + * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.atlasXML({ + * key: 'mainmenu', + * textureURL: 'images/MainMenu.png', + * atlasURL: 'images/MainMenu.xml' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.AtlasXMLFileConfig` for more details. + * + * Once the atlas has finished loading you can use frames from it as textures for a Game Object by referencing its key: + * + * ```javascript + * this.load.atlasXML('mainmenu', 'images/MainMenu.png', 'images/MainMenu.xml'); + * // and later in your game ... + * this.add.image(x, y, 'mainmenu', 'background'); + * ``` + * + * To get a list of all available frames within an atlas please consult your Texture Atlas software. + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, + * then you can specify it by providing an array as the `url` where the second element is the normal map: + * + * ```javascript + * this.load.atlasXML('mainmenu', [ 'images/MainMenu.png', 'images/MainMenu-n.png' ], 'images/MainMenu.xml'); + * ``` + * + * Or, if you are using a config object use the `normalMap` property: + * + * ```javascript + * this.load.atlasXML({ + * key: 'mainmenu', + * textureURL: 'images/MainMenu.png', + * normalMap: 'images/MainMenu-n.png', + * atlasURL: 'images/MainMenu.xml' + * }); + * ``` + * + * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. + * Normal maps are a WebGL only feature. + * + * Note: The ability to load this type of file will only be available if the Atlas XML File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#atlasXML + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.7.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.AtlasXMLFileConfig|Phaser.Types.Loader.FileTypes.AtlasXMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas xml file. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('atlasXML', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) +{ + var multifile; + + // Supports an Object file definition in the key argument + // Or an array of objects in the key argument + // Or a single entry where all arguments have been defined + + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) { - if (object2.body) - { - return this.collideSpriteVsGroup(object2, object1, collideCallback, processCallback, callbackContext, overlapOnly); - } - else if (object2.isParent) - { - return this.collideGroupVsGroup(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly); - } - else if (object2.isTilemap) - { - return this.collideGroupVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly); - } + multifile = new AtlasXMLFile(this, key[i]); + + this.addFile(multifile.files); } + } + else + { + multifile = new AtlasXMLFile(this, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings); - // TILEMAP LAYERS - else if (object1.isTilemap) + this.addFile(multifile.files); + } + + return this; +}); + +module.exports = AtlasXMLFile; + + +/***/ }), + +/***/ 67448: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var HTML5AudioFile = __webpack_require__(30929); +var IsPlainObject = __webpack_require__(42911); + +/** + * @classdesc + * A single Audio File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#audio method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audio. + * + * @class AudioFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.AudioFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {Phaser.Types.Loader.FileTypes.AudioFileURLConfig} [urlConfig] - The absolute or relative URL to load this file from in a config object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {AudioContext} [audioContext] - The AudioContext this file will use to process itself. + */ +var AudioFile = new Class({ + + Extends: File, + + initialize: + + // URL is an object created by AudioFile.findAudioURL + function AudioFile (loader, key, urlConfig, xhrSettings, audioContext) + { + if (IsPlainObject(key)) { - if (object2.body) - { - return this.collideSpriteVsTilemapLayer(object2, object1, collideCallback, processCallback, callbackContext, overlapOnly); - } - else if (object2.isParent) - { - return this.collideGroupVsTilemapLayer(object2, object1, collideCallback, processCallback, callbackContext, overlapOnly); - } + var config = key; + + key = GetFastValue(config, 'key'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + audioContext = GetFastValue(config, 'context', audioContext); } + + var fileConfig = { + type: 'audio', + cache: loader.cacheManager.audio, + extension: urlConfig.type, + responseType: 'arraybuffer', + key: key, + url: urlConfig.url, + xhrSettings: xhrSettings, + config: { context: audioContext } + }; + + File.call(this, loader, fileConfig); }, /** - * Internal handler for Sprite vs. Sprite collisions. - * Please use Phaser.Physics.Arcade.World#collide instead. + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. * - * @method Phaser.Physics.Arcade.World#collideSpriteVsSprite - * @private + * @method Phaser.Loader.FileTypes.AudioFile#onProcess * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} sprite1 - The first object to check for collision. - * @param {Phaser.GameObjects.GameObject} sprite2 - The second object to check for collision. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} [callbackContext] - The context in which to run the callbacks. - * @param {boolean} overlapOnly - Whether this is a collision or overlap check. - * - * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ - collideSpriteVsSprite: function (sprite1, sprite2, collideCallback, processCallback, callbackContext, overlapOnly) + onProcess: function () { - if (!sprite1.body || !sprite2.body) - { - return false; - } + this.state = CONST.FILE_PROCESSING; - if (this.separate(sprite1.body, sprite2.body, processCallback, callbackContext, overlapOnly)) - { - if (collideCallback) + var _this = this; + + // interesting read https://github.com/WebAudio/web-audio-api/issues/1305 + this.config.context.decodeAudioData(this.xhrLoader.response, + function (audioBuffer) { - collideCallback.call(callbackContext, sprite1, sprite2); + _this.data = audioBuffer; + + _this.onProcessComplete(); + }, + function (e) + { + // eslint-disable-next-line no-console + console.error('Error decoding audio: ' + _this.key + ' - ', e ? e.message : null); + + _this.onProcessError(); } + ); - this._total++; - } + this.config.context = null; + } - return true; - }, +}); - /** - * Internal handler for Sprite vs. Group collisions. - * Please use Phaser.Physics.Arcade.World#collide instead. - * - * @method Phaser.Physics.Arcade.World#collideSpriteVsGroup - * @private - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. - * @param {Phaser.GameObjects.Group} group - The second object to check for collision. - * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. - * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. - * @param {any} callbackContext - The scope in which to call the callbacks. - * @param {boolean} overlapOnly - Whether this is a collision or overlap check. - * - * @return {boolean} `true` if the Sprite collided with the given Group, otherwise `false`. - */ - collideSpriteVsGroup: function (sprite, group, collideCallback, processCallback, callbackContext, overlapOnly) +AudioFile.create = function (loader, key, urls, config, xhrSettings) +{ + var game = loader.systems.game; + var audioConfig = game.config.audio; + var deviceAudio = game.device.audio; + + // url may be inside key, which may be an object + if (IsPlainObject(key)) { - var bodyA = sprite.body; + urls = GetFastValue(key, 'url', []); + config = GetFastValue(key, 'config', {}); + } - if (group.length === 0 || !bodyA || !bodyA.enable || bodyA.checkCollision.none) + var urlConfig = AudioFile.getAudioURL(game, urls); + + if (!urlConfig) + { + console.warn('No audio URLs for "%s" matched this device', key); + + return null; + } + + // https://developers.google.com/web/updates/2012/02/HTML5-audio-and-the-Web-Audio-API-are-BFFs + // var stream = GetFastValue(config, 'stream', false); + + if (deviceAudio.webAudio && !audioConfig.disableWebAudio) + { + return new AudioFile(loader, key, urlConfig, xhrSettings, game.sound.context); + } + else + { + return new HTML5AudioFile(loader, key, urlConfig, config); + } +}; + +AudioFile.getAudioURL = function (game, urls) +{ + if (!Array.isArray(urls)) + { + urls = [ urls ]; + } + + for (var i = 0; i < urls.length; i++) + { + var url = GetFastValue(urls[i], 'url', urls[i]); + + if (url.indexOf('blob:') === 0 || url.indexOf('data:') === 0) { - return; + return { + url: url, + type: '' + }; } - // Does sprite collide with anything? + var audioType = url.match(/\.([a-zA-Z0-9]+)($|\?)/); - var i; - var len; - var bodyB; + audioType = GetFastValue(urls[i], 'type', (audioType) ? audioType[1] : '').toLowerCase(); - if (this.useTree || group.physicsType === CONST.STATIC_BODY) + if (game.device.audio[audioType]) { - var minMax = this.treeMinMax; + return { + url: url, + type: audioType + }; + } + } - minMax.minX = bodyA.left; - minMax.minY = bodyA.top; - minMax.maxX = bodyA.right; - minMax.maxY = bodyA.bottom; + return null; +}; - var results = (group.physicsType === CONST.DYNAMIC_BODY) ? this.tree.search(minMax) : this.staticTree.search(minMax); +/** + * Adds an Audio or HTML5Audio file, or array of audio files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.audio('title', [ 'music/Title.ogg', 'music/Title.mp3', 'music/Title.m4a' ]); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Audio Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Audio Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Audio Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.audio({ + * key: 'title', + * url: [ 'music/Title.ogg', 'music/Title.mp3', 'music/Title.m4a' ] + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.AudioFileConfig` for more details. + * + * The URLs can be relative or absolute. If the URLs are relative the `Loader.baseURL` and `Loader.path` values will be prepended to them. + * + * Due to different browsers supporting different audio file types you should usually provide your audio files in a variety of formats. + * ogg, mp3 and m4a are the most common. If you provide an array of URLs then the Loader will determine which _one_ file to load based on + * browser support. + * + * If audio has been disabled in your game, either via the game config, or lack of support from the device, then no audio will be loaded. + * + * Note: The ability to load this type of file will only be available if the Audio File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#audio + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.AudioFileConfig|Phaser.Types.Loader.FileTypes.AudioFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {(string|string[]|Phaser.Types.Loader.FileTypes.AudioFileURLConfig|Phaser.Types.Loader.FileTypes.AudioFileURLConfig[])} [urls] - The absolute or relative URL to load the audio files from. + * @param {any} [config] - An object containing an `instances` property for HTML5Audio. Defaults to 1. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('audio', function (key, urls, config, xhrSettings) +{ + var game = this.systems.game; + var audioConfig = game.config.audio; + var deviceAudio = game.device.audio; - len = results.length; + if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData)) + { + // Sounds are disabled, so skip loading audio + return this; + } - for (i = 0; i < len; i++) + var audioFile; + + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + audioFile = AudioFile.create(this, key[i]); + + if (audioFile) { - bodyB = results[i]; + this.addFile(audioFile); + } + } + } + else + { + audioFile = AudioFile.create(this, key, urls, config, xhrSettings); - if (bodyA === bodyB || !bodyB.enable || bodyB.checkCollision.none || !group.contains(bodyB.gameObject)) - { - // Skip if comparing against itself, or if bodyB isn't collidable, or if bodyB isn't actually part of the Group - continue; - } + if (audioFile) + { + this.addFile(audioFile); + } + } - if (this.separate(bodyA, bodyB, processCallback, callbackContext, overlapOnly, true)) - { - if (collideCallback) - { - collideCallback.call(callbackContext, bodyA.gameObject, bodyB.gameObject); - } + return this; +}); - this._total++; - } - } +module.exports = AudioFile; + + +/***/ }), + +/***/ 66109: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var AudioFile = __webpack_require__(67448); +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); +var JSONFile = __webpack_require__(70806); +var MultiFile = __webpack_require__(45176); + +/** + * @classdesc + * An Audio Sprite File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#audioSprite method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audioSprite. + * + * @class AudioSpriteFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.7.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.AudioSpriteFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} jsonURL - The absolute or relative URL to load the json file from. Or a well formed JSON object to use instead. + * @param {{(string|string[])}} [audioURL] - The absolute or relative URL to load the audio file from. If empty it will be obtained by parsing the JSON file. + * @param {any} [audioConfig] - The audio configuration options. + * @param {Phaser.Types.Loader.XHRSettingsObject} [audioXhrSettings] - An XHR Settings configuration object for the audio file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [jsonXhrSettings] - An XHR Settings configuration object for the json file. Used in replacement of the Loaders default XHR Settings. + */ +var AudioSpriteFile = new Class({ + + Extends: MultiFile, + + initialize: + + function AudioSpriteFile (loader, key, jsonURL, audioURL, audioConfig, audioXhrSettings, jsonXhrSettings) + { + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + jsonURL = GetFastValue(config, 'jsonURL'); + audioURL = GetFastValue(config, 'audioURL'); + audioConfig = GetFastValue(config, 'audioConfig'); + audioXhrSettings = GetFastValue(config, 'audioXhrSettings'); + jsonXhrSettings = GetFastValue(config, 'jsonXhrSettings'); } - else + + var data; + + // No url? then we're going to do a json load and parse it from that + if (!audioURL) { - var children = group.getChildren(); - var skipIndex = group.children.entries.indexOf(sprite); + data = new JSONFile(loader, key, jsonURL, jsonXhrSettings); - len = children.length; + MultiFile.call(this, loader, 'audiosprite', key, [ data ]); - for (i = 0; i < len; i++) - { - bodyB = children[i].body; + this.config.resourceLoad = true; + this.config.audioConfig = audioConfig; + this.config.audioXhrSettings = audioXhrSettings; + } + else + { + var audio = AudioFile.create(loader, key, audioURL, audioConfig, audioXhrSettings); - if (!bodyB || i === skipIndex || !bodyB.enable) - { - continue; - } + if (audio) + { + data = new JSONFile(loader, key, jsonURL, jsonXhrSettings); - if (this.separate(bodyA, bodyB, processCallback, callbackContext, overlapOnly)) - { - if (collideCallback) - { - collideCallback.call(callbackContext, bodyA.gameObject, bodyB.gameObject); - } + MultiFile.call(this, loader, 'audiosprite', key, [ audio, data ]); - this._total++; - } + this.config.resourceLoad = false; } } }, /** - * Internal handler for Group vs. Tilemap collisions. - * Please use Phaser.Physics.Arcade.World#collide instead. - * - * @method Phaser.Physics.Arcade.World#collideGroupVsTilemapLayer - * @private - * @since 3.0.0 + * Called by each File when it finishes loading. * - * @param {Phaser.GameObjects.Group} group - The first object to check for collision. - * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The second object to check for collision. - * @param {ArcadePhysicsCallback} collideCallback - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} processCallback - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} callbackContext - The context in which to run the callbacks. - * @param {boolean} overlapOnly - Whether this is a collision or overlap check. + * @method Phaser.Loader.FileTypes.AudioSpriteFile#onFileComplete + * @since 3.7.0 * - * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + * @param {Phaser.Loader.File} file - The File that has completed processing. */ - collideGroupVsTilemapLayer: function (group, tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly) + onFileComplete: function (file) { - var children = group.getChildren(); + var index = this.files.indexOf(file); - if (children.length === 0) + if (index !== -1) { - return false; - } - - var didCollide = false; + this.pending--; - for (var i = 0; i < children.length; i++) - { - if (children[i].body) + if (this.config.resourceLoad && file.type === 'json' && file.data.hasOwnProperty('resources')) { - if (this.collideSpriteVsTilemapLayer(children[i], tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly)) + // Inspect the data for the files to now load + var urls = file.data.resources; + + var audioConfig = GetFastValue(this.config, 'audioConfig'); + var audioXhrSettings = GetFastValue(this.config, 'audioXhrSettings'); + + var audio = AudioFile.create(this.loader, file.key, urls, audioConfig, audioXhrSettings); + + if (audio) { - didCollide = true; + this.addToMultiFile(audio); + + this.loader.addFile(audio); } } } - - return didCollide; }, /** - * This advanced method is specifically for testing for collision between a single Sprite and an array of Tile objects. - * - * You should generally use the `collide` method instead, with a Sprite vs. a Tilemap Layer, as that will perform - * tile filtering and culling for you, as well as handle the interesting face collision automatically. - * - * This method is offered for those who would like to check for collision with specific Tiles in a layer, without - * having to set any collision attributes on the tiles in question. This allows you to perform quick dynamic collisions - * on small sets of Tiles. As such, no culling or checks are made to the array of Tiles given to this method, - * you should filter them before passing them to this method. - * - * Important: Use of this method skips the `interesting faces` system that Tilemap Layers use. This means if you have - * say a row or column of tiles, and you jump into, or walk over them, it's possible to get stuck on the edges of the - * tiles as the interesting face calculations are skipped. However, for quick-fire small collision set tests on - * dynamic maps, this method can prove very useful. - * - * @method Phaser.Physics.Arcade.World#collideTiles - * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE - * @since 3.17.0 - * - * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. - * @param {Phaser.Tilemaps.Tile[]} tiles - An array of Tiles to check for collision against. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} [callbackContext] - The context in which to run the callbacks. + * Adds this file to its target cache upon successful loading and processing. * - * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + * @method Phaser.Loader.FileTypes.AudioSpriteFile#addToCache + * @since 3.7.0 */ - collideTiles: function (sprite, tiles, collideCallback, processCallback, callbackContext) + addToCache: function () { - if (!sprite.body.enable || tiles.length === 0) - { - return false; - } - else + if (this.isReadyToProcess()) { - return this.collideSpriteVsTilesHandler(sprite, tiles, collideCallback, processCallback, callbackContext, false, false); - } - }, + var fileA = this.files[0]; + var fileB = this.files[1]; - /** - * This advanced method is specifically for testing for overlaps between a single Sprite and an array of Tile objects. - * - * You should generally use the `overlap` method instead, with a Sprite vs. a Tilemap Layer, as that will perform - * tile filtering and culling for you, as well as handle the interesting face collision automatically. - * - * This method is offered for those who would like to check for overlaps with specific Tiles in a layer, without - * having to set any collision attributes on the tiles in question. This allows you to perform quick dynamic overlap - * tests on small sets of Tiles. As such, no culling or checks are made to the array of Tiles given to this method, - * you should filter them before passing them to this method. - * - * @method Phaser.Physics.Arcade.World#overlapTiles - * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP - * @since 3.17.0 - * - * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. - * @param {Phaser.Tilemaps.Tile[]} tiles - An array of Tiles to check for collision against. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects overlap. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} [callbackContext] - The context in which to run the callbacks. - * - * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. - */ - overlapTiles: function (sprite, tiles, collideCallback, processCallback, callbackContext) - { - if (!sprite.body.enable || tiles.length === 0) - { - return false; - } - else - { - return this.collideSpriteVsTilesHandler(sprite, tiles, collideCallback, processCallback, callbackContext, true, false); + fileA.addToCache(); + fileB.addToCache(); + + this.complete = true; } - }, + } - /** - * Internal handler for Sprite vs. Tilemap collisions. - * Please use Phaser.Physics.Arcade.World#collide instead. - * - * @method Phaser.Physics.Arcade.World#collideSpriteVsTilemapLayer - * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE - * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. - * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The second object to check for collision. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} [callbackContext] - The context in which to run the callbacks. - * @param {boolean} [overlapOnly] - Whether this is a collision or overlap check. - * - * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. - */ - collideSpriteVsTilemapLayer: function (sprite, tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly) - { - var body = sprite.body; +}); - if (!body.enable || body.checkCollision.none) - { - return false; - } +/** + * Adds a JSON based Audio Sprite, or array of audio sprites, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.audioSprite('kyobi', 'kyobi.json', [ + * 'kyobi.ogg', + * 'kyobi.mp3', + * 'kyobi.m4a' + * ]); + * } + * ``` + * + * Audio Sprites are a combination of audio files and a JSON configuration. + * The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite + * + * If the JSON file includes a 'resource' object then you can let Phaser parse it and load the audio + * files automatically based on its content. To do this exclude the audio URLs from the load: + * + * ```javascript + * function preload () + * { + * this.load.audioSprite('kyobi', 'kyobi.json'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring + * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. + * + * The key must be a unique String. It is used to add the file to the global Audio Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Audio Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Audio Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.audioSprite({ + * key: 'kyobi', + * jsonURL: 'audio/Kyobi.json', + * audioURL: [ + * 'audio/Kyobi.ogg', + * 'audio/Kyobi.mp3', + * 'audio/Kyobi.m4a' + * ] + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.AudioSpriteFileConfig` for more details. + * + * Instead of passing a URL for the audio JSON data you can also pass in a well formed JSON object instead. + * + * Once the audio has finished loading you can use it create an Audio Sprite by referencing its key: + * + * ```javascript + * this.load.audioSprite('kyobi', 'kyobi.json'); + * // and later in your game ... + * var music = this.sound.addAudioSprite('kyobi'); + * music.play('title'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * Due to different browsers supporting different audio file types you should usually provide your audio files in a variety of formats. + * ogg, mp3 and m4a are the most common. If you provide an array of URLs then the Loader will determine which _one_ file to load based on + * browser support. + * + * If audio has been disabled in your game, either via the game config, or lack of support from the device, then no audio will be loaded. + * + * Note: The ability to load this type of file will only be available if the Audio Sprite File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#audioSprite + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.AudioSpriteFileConfig|Phaser.Types.Loader.FileTypes.AudioSpriteFileConfig[])} key - The key to use for this file, or a file configuration object, or an array of objects. + * @param {string} jsonURL - The absolute or relative URL to load the json file from. Or a well formed JSON object to use instead. + * @param {(string|string[])} [audioURL] - The absolute or relative URL to load the audio file from. If empty it will be obtained by parsing the JSON file. + * @param {any} [audioConfig] - The audio configuration options. + * @param {Phaser.Types.Loader.XHRSettingsObject} [audioXhrSettings] - An XHR Settings configuration object for the audio file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [jsonXhrSettings] - An XHR Settings configuration object for the json file. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader. + */ +FileTypesManager.register('audioSprite', function (key, jsonURL, audioURL, audioConfig, audioXhrSettings, jsonXhrSettings) +{ + var game = this.systems.game; + var gameAudioConfig = game.config.audio; + var deviceAudio = game.device.audio; - var x = body.position.x; - var y = body.position.y; - var w = body.width; - var h = body.height; + if ((gameAudioConfig && gameAudioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) + { + // Sounds are disabled, so skip loading audio + return this; + } - var layerData = tilemapLayer.layer; + var multifile; - if (layerData.tileWidth > layerData.baseTileWidth) + // Supports an Object file definition in the key argument + // Or an array of objects in the key argument + // Or a single entry where all arguments have been defined + + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) { - // The x origin of a tile is the left side, so x and width need to be adjusted. - var xDiff = (layerData.tileWidth - layerData.baseTileWidth) * tilemapLayer.scaleX; - x -= xDiff; - w += xDiff; + multifile = new AudioSpriteFile(this, key[i]); + + if (multifile.files) + { + this.addFile(multifile.files); + } } + } + else + { + multifile = new AudioSpriteFile(this, key, jsonURL, audioURL, audioConfig, audioXhrSettings, jsonXhrSettings); - if (layerData.tileHeight > layerData.baseTileHeight) + if (multifile.files) { - // The y origin of a tile is the bottom side, so just the height needs to be adjusted. - var yDiff = (layerData.tileHeight - layerData.baseTileHeight) * tilemapLayer.scaleY; - h += yDiff; + this.addFile(multifile.files); } + } - var mapData = GetTilesWithinWorldXY(x, y, w, h, null, tilemapLayer.scene.cameras.main, tilemapLayer.layer); + return this; +}); - if (mapData.length === 0) - { - return false; - } - else + +/***/ }), + +/***/ 40612: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); + +/** + * @classdesc + * A single Binary File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#binary method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#binary. + * + * @class BinaryFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.BinaryFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.bin`, i.e. if `key` was "alien" then the URL will be "alien.bin". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {any} [dataType] - Optional type to cast the binary file to once loaded. For example, `Uint8Array`. + */ +var BinaryFile = new Class({ + + Extends: File, + + initialize: + + function BinaryFile (loader, key, url, xhrSettings, dataType) + { + var extension = 'bin'; + + if (IsPlainObject(key)) { - return this.collideSpriteVsTilesHandler(sprite, mapData, collideCallback, processCallback, callbackContext, overlapOnly, true); + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + dataType = GetFastValue(config, 'dataType', dataType); } + + var fileConfig = { + type: 'binary', + cache: loader.cacheManager.binary, + extension: extension, + responseType: 'arraybuffer', + key: key, + url: url, + xhrSettings: xhrSettings, + config: { dataType: dataType } + }; + + File.call(this, loader, fileConfig); }, /** - * Internal handler for Sprite vs. Tilemap collisions. - * Please use Phaser.Physics.Arcade.World#collide instead. - * - * @method Phaser.Physics.Arcade.World#collideSpriteVsTilesHandler - * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE - * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP - * @private - * @since 3.17.0 - * - * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. - * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The second object to check for collision. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} [callbackContext] - The context in which to run the callbacks. - * @param {boolean} [overlapOnly] - Whether this is a collision or overlap check. - * @param {boolean} [isLayer] - Is this check coming from a TilemapLayer or an array of tiles? + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. * - * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + * @method Phaser.Loader.FileTypes.BinaryFile#onProcess + * @since 3.7.0 */ - collideSpriteVsTilesHandler: function (sprite, tiles, collideCallback, processCallback, callbackContext, overlapOnly, isLayer) + onProcess: function () { - var body = sprite.body; + this.state = CONST.FILE_PROCESSING; - var tile; - var tileWorldRect = { left: 0, right: 0, top: 0, bottom: 0 }; - var tilemapLayer; - var collision = false; + var ctor = this.config.dataType; - for (var i = 0; i < tiles.length; i++) + this.data = (ctor) ? new ctor(this.xhrLoader.response) : this.xhrLoader.response; + + this.onProcessComplete(); + } + +}); + +/** + * Adds a Binary file, or array of Binary files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.binary('doom', 'files/Doom.wad'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Binary Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Binary Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Binary Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.binary({ + * key: 'doom', + * url: 'files/Doom.wad', + * dataType: Uint8Array + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.BinaryFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.binary('doom', 'files/Doom.wad'); + * // and later in your game ... + * var data = this.cache.binary.get('doom'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Data` the final key will be `LEVEL1.Data` and + * this is what you would use to retrieve the text from the Binary Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "doom" + * and no URL is given then the Loader will set the URL to be "doom.bin". It will always add `.bin` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Binary File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#binary + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.BinaryFileConfig|Phaser.Types.Loader.FileTypes.BinaryFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.bin`, i.e. if `key` was "alien" then the URL will be "alien.bin". + * @param {any} [dataType] - Optional type to cast the binary file to once loaded. For example, `Uint8Array`. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('binary', function (key, url, dataType, xhrSettings) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) { - tile = tiles[i]; + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new BinaryFile(this, key[i])); + } + } + else + { + this.addFile(new BinaryFile(this, key, url, xhrSettings, dataType)); + } - tilemapLayer = tile.tilemapLayer; + return this; +}); - var point = tilemapLayer.tileToWorldXY(tile.x, tile.y); +module.exports = BinaryFile; - tileWorldRect.left = point.x; - tileWorldRect.top = point.y; - // If the maps base tile size differs from the layer tile size, only the top of the rect - // needs to be adjusted since its origin is (0, 1). - if (tile.baseHeight !== tile.height) - { - tileWorldRect.top -= (tile.height - tile.baseHeight) * tilemapLayer.scaleY; - } +/***/ }), - tileWorldRect.right = tileWorldRect.left + tile.width * tilemapLayer.scaleX; - tileWorldRect.bottom = tileWorldRect.top + tile.height * tilemapLayer.scaleY; +/***/ 54565: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (TileIntersectsBody(tileWorldRect, body) - && (!processCallback || processCallback.call(callbackContext, sprite, tile)) - && ProcessTileCallbacks(tile, sprite) - && (overlapOnly || SeparateTile(i, body, tile, tileWorldRect, tilemapLayer, this.TILE_BIAS, isLayer))) - { - this._total++; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - collision = true; +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var ImageFile = __webpack_require__(42927); +var IsPlainObject = __webpack_require__(42911); +var MultiFile = __webpack_require__(45176); +var ParseXMLBitmapFont = __webpack_require__(31476); +var XMLFile = __webpack_require__(15297); - if (collideCallback) - { - collideCallback.call(callbackContext, sprite, tile); - } +/** + * @classdesc + * A single Bitmap Font based File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#bitmapFont method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#bitmapFont. + * + * @class BitmapFontFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.BitmapFontFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the font image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {string} [fontDataURL] - The absolute or relative URL to load the font xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the font image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [fontDataXhrSettings] - An XHR Settings configuration object for the font data xml file. Used in replacement of the Loaders default XHR Settings. + */ +var BitmapFontFile = new Class({ - if (overlapOnly && body.onOverlap) - { - this.emit(Events.TILE_OVERLAP, sprite, tile, body); - } - else if (body.onCollide) - { - this.emit(Events.TILE_COLLIDE, sprite, tile, body); - } - } - } + Extends: MultiFile, - return collision; - }, + initialize: - /** - * Internal helper for Group vs. Group collisions. - * Please use Phaser.Physics.Arcade.World#collide instead. - * - * @method Phaser.Physics.Arcade.World#collideGroupVsGroup - * @private - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Group} group1 - The first object to check for collision. - * @param {Phaser.GameObjects.Group} group2 - The second object to check for collision. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} [callbackContext] - The context in which to run the callbacks. - * @param {boolean} overlapOnly - Whether this is a collision or overlap check. - * - * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. - */ - collideGroupVsGroup: function (group1, group2, collideCallback, processCallback, callbackContext, overlapOnly) + function BitmapFontFile (loader, key, textureURL, fontDataURL, textureXhrSettings, fontDataXhrSettings) { - if (group1.length === 0 || group2.length === 0) + var image; + var data; + + if (IsPlainObject(key)) { - return; - } + var config = key; - var children = group1.getChildren(); + key = GetFastValue(config, 'key'); - for (var i = 0; i < children.length; i++) - { - this.collideSpriteVsGroup(children[i], group2, collideCallback, processCallback, callbackContext, overlapOnly); - } - }, + image = new ImageFile(loader, { + key: key, + url: GetFastValue(config, 'textureURL'), + extension: GetFastValue(config, 'textureExtension', 'png'), + normalMap: GetFastValue(config, 'normalMap'), + xhrSettings: GetFastValue(config, 'textureXhrSettings') + }); - /** - * Wrap an object's coordinates (or several objects' coordinates) within {@link Phaser.Physics.Arcade.World#bounds}. - * - * If the object is outside any boundary edge (left, top, right, bottom), it will be moved to the same offset from the opposite edge (the interior). - * - * @method Phaser.Physics.Arcade.World#wrap - * @since 3.3.0 - * - * @param {any} object - A Game Object, a Group, an object with `x` and `y` coordinates, or an array of such objects. - * @param {number} [padding=0] - An amount added to each boundary edge during the operation. - */ - wrap: function (object, padding) - { - if (object.body) - { - this.wrapObject(object, padding); + data = new XMLFile(loader, { + key: key, + url: GetFastValue(config, 'fontDataURL'), + extension: GetFastValue(config, 'fontDataExtension', 'xml'), + xhrSettings: GetFastValue(config, 'fontDataXhrSettings') + }); } - else if (object.getChildren) + else { - this.wrapArray(object.getChildren(), padding); + image = new ImageFile(loader, key, textureURL, textureXhrSettings); + data = new XMLFile(loader, key, fontDataURL, fontDataXhrSettings); } - else if (Array.isArray(object)) + + if (image.linkFile) { - this.wrapArray(object, padding); + // Image has a normal map + MultiFile.call(this, loader, 'bitmapfont', key, [ image, data, image.linkFile ]); } else { - this.wrapObject(object, padding); + MultiFile.call(this, loader, 'bitmapfont', key, [ image, data ]); } }, /** - * Wrap each object's coordinates within {@link Phaser.Physics.Arcade.World#bounds}. - * - * @method Phaser.Physics.Arcade.World#wrapArray - * @since 3.3.0 + * Adds this file to its target cache upon successful loading and processing. * - * @param {Array.<*>} objects - An array of objects to be wrapped. - * @param {number} [padding=0] - An amount added to the boundary. + * @method Phaser.Loader.FileTypes.BitmapFontFile#addToCache + * @since 3.7.0 */ - wrapArray: function (objects, padding) + addToCache: function () { - for (var i = 0; i < objects.length; i++) + if (this.isReadyToProcess()) { - this.wrapObject(objects[i], padding); + var image = this.files[0]; + var xml = this.files[1]; + + image.addToCache(); + + var texture = image.cache.get(image.key); + + var data = ParseXMLBitmapFont(xml.data, image.cache.getFrame(image.key), 0, 0, texture); + + this.loader.cacheManager.bitmapFont.add(image.key, { data: data, texture: image.key, frame: null }); + + this.complete = true; } - }, + } - /** - * Wrap an object's coordinates within {@link Phaser.Physics.Arcade.World#bounds}. - * - * @method Phaser.Physics.Arcade.World#wrapObject - * @since 3.3.0 - * - * @param {*} object - A Game Object, a Physics Body, or any object with `x` and `y` coordinates - * @param {number} [padding=0] - An amount added to the boundary. - */ - wrapObject: function (object, padding) - { - if (padding === undefined) { padding = 0; } +}); - object.x = Wrap(object.x, this.bounds.left - padding, this.bounds.right + padding); - object.y = Wrap(object.y, this.bounds.top - padding, this.bounds.bottom + padding); - }, +/** + * Adds an XML based Bitmap Font, or array of fonts, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - /** - * Shuts down the simulation, clearing physics data and removing listeners. - * - * @method Phaser.Physics.Arcade.World#shutdown - * @since 3.0.0 - */ - shutdown: function () - { - this.tree.clear(); - this.staticTree.clear(); - this.bodies.clear(); - this.staticBodies.clear(); - this.colliders.destroy(); + * ```javascript + * function preload () + * { + * this.load.bitmapFont('goldenFont', 'images/GoldFont.png', 'images/GoldFont.xml'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring + * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. + * + * Phaser expects the font data to be provided in an XML file format. + * These files are created by software such as the [Angelcode Bitmap Font Generator](http://www.angelcode.com/products/bmfont/), + * [Littera](http://kvazars.com/littera/) or [Glyph Designer](https://71squared.com/glyphdesigner) + * + * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.bitmapFont({ + * key: 'goldenFont', + * textureURL: 'images/GoldFont.png', + * fontDataURL: 'images/GoldFont.xml' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.BitmapFontFileConfig` for more details. + * + * Once the atlas has finished loading you can use key of it when creating a Bitmap Text Game Object: + * + * ```javascript + * this.load.bitmapFont('goldenFont', 'images/GoldFont.png', 'images/GoldFont.xml'); + * // and later in your game ... + * this.add.bitmapText(x, y, 'goldenFont', 'Hello World'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use when creating a Bitmap Text object. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, + * then you can specify it by providing an array as the `url` where the second element is the normal map: + * + * ```javascript + * this.load.bitmapFont('goldenFont', [ 'images/GoldFont.png', 'images/GoldFont-n.png' ], 'images/GoldFont.xml'); + * ``` + * + * Or, if you are using a config object use the `normalMap` property: + * + * ```javascript + * this.load.bitmapFont({ + * key: 'goldenFont', + * textureURL: 'images/GoldFont.png', + * normalMap: 'images/GoldFont-n.png', + * fontDataURL: 'images/GoldFont.xml' + * }); + * ``` + * + * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. + * Normal maps are a WebGL only feature. + * + * Note: The ability to load this type of file will only be available if the Bitmap Font File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#bitmapFont + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.BitmapFontFileConfig|Phaser.Types.Loader.FileTypes.BitmapFontFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the font image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {string} [fontDataURL] - The absolute or relative URL to load the font xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the font image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [fontDataXhrSettings] - An XHR Settings configuration object for the font data xml file. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('bitmapFont', function (key, textureURL, fontDataURL, textureXhrSettings, fontDataXhrSettings) +{ + var multifile; - this.removeAllListeners(); - }, + // Supports an Object file definition in the key argument + // Or an array of objects in the key argument + // Or a single entry where all arguments have been defined - /** - * Shuts down the simulation and disconnects it from the current scene. - * - * @method Phaser.Physics.Arcade.World#destroy - * @since 3.0.0 - */ - destroy: function () + if (Array.isArray(key)) { - this.shutdown(); + for (var i = 0; i < key.length; i++) + { + multifile = new BitmapFontFile(this, key[i]); - this.scene = null; + this.addFile(multifile.files); + } + } + else + { + multifile = new BitmapFontFile(this, key, textureURL, fontDataURL, textureXhrSettings, fontDataXhrSettings); + + this.addFile(multifile.files); } + return this; }); -module.exports = World; +module.exports = BitmapFontFile; /***/ }), -/* 527 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 99898: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Benjamin D. Richards - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(62); -var Events = __webpack_require__(245); -var RadToDeg = __webpack_require__(196); -var Rectangle = __webpack_require__(10); -var RectangleContains = __webpack_require__(57); -var Vector2 = __webpack_require__(3); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); /** * @classdesc - * A Dynamic Arcade Body. + * A single CSS File suitable for loading by the Loader. * - * Its static counterpart is {@link Phaser.Physics.Arcade.StaticBody}. + * These are created when you use the Phaser.Loader.LoaderPlugin#css method and are not typically created directly. * - * @class Body - * @memberof Phaser.Physics.Arcade + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#css. + * + * @class CSSFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes * @constructor - * @since 3.0.0 + * @since 3.17.0 * - * @param {Phaser.Physics.Arcade.World} world - The Arcade Physics simulation this Body belongs to. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object this Body belongs to. + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.CSSFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ -var Body = new Class({ +var CSSFile = new Class({ + + Extends: File, initialize: - function Body (world, gameObject) + function CSSFile (loader, key, url, xhrSettings) { - var width = (gameObject.displayWidth) ? gameObject.displayWidth : 64; - var height = (gameObject.displayHeight) ? gameObject.displayHeight : 64; + var extension = 'css'; - /** - * The Arcade Physics simulation this Body belongs to. - * - * @name Phaser.Physics.Arcade.Body#world - * @type {Phaser.Physics.Arcade.World} - * @since 3.0.0 - */ - this.world = world; + if (IsPlainObject(key)) + { + var config = key; - /** - * The Game Object this Body belongs to. - * - * @name Phaser.Physics.Arcade.Body#gameObject - * @type {Phaser.GameObjects.GameObject} - * @since 3.0.0 - */ - this.gameObject = gameObject; + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } - /** - * Transformations applied to this Body. - * - * @name Phaser.Physics.Arcade.Body#transform - * @type {object} - * @since 3.4.0 - */ - this.transform = { - x: gameObject.x, - y: gameObject.y, - rotation: gameObject.angle, - scaleX: gameObject.scaleX, - scaleY: gameObject.scaleY, - displayOriginX: gameObject.displayOriginX, - displayOriginY: gameObject.displayOriginY + var fileConfig = { + type: 'script', + cache: false, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings }; - /** - * Whether the Body is drawn to the debug display. - * - * @name Phaser.Physics.Arcade.Body#debugShowBody - * @type {boolean} - * @since 3.0.0 - */ - this.debugShowBody = world.defaults.debugShowBody; + File.call(this, loader, fileConfig); + }, - /** - * Whether the Body's velocity is drawn to the debug display. - * - * @name Phaser.Physics.Arcade.Body#debugShowVelocity - * @type {boolean} - * @since 3.0.0 - */ - this.debugShowVelocity = world.defaults.debugShowVelocity; + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.CSSFile#onProcess + * @since 3.17.0 + */ + onProcess: function () + { + this.state = CONST.FILE_PROCESSING; - /** - * The color of this Body on the debug display. - * - * @name Phaser.Physics.Arcade.Body#debugBodyColor - * @type {number} - * @since 3.0.0 - */ - this.debugBodyColor = world.defaults.bodyDebugColor; + this.data = document.createElement('style'); + this.data.defer = false; + this.data.innerHTML = this.xhrLoader.responseText; - /** - * Whether this Body is updated by the physics simulation. - * - * @name Phaser.Physics.Arcade.Body#enable - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.enable = true; + document.head.appendChild(this.data); - /** - * Whether this Body is circular (true) or rectangular (false). - * - * @name Phaser.Physics.Arcade.Body#isCircle - * @type {boolean} - * @default false - * @since 3.0.0 - * @see Phaser.Physics.Arcade.Body#setCircle - */ - this.isCircle = false; + this.onProcessComplete(); + } - /** - * If this Body is circular, this is the unscaled radius of the Body, as set by setCircle(), in source pixels. - * The true radius is equal to `halfWidth`. - * - * @name Phaser.Physics.Arcade.Body#radius - * @type {number} - * @default 0 - * @since 3.0.0 - * @see Phaser.Physics.Arcade.Body#setCircle - */ - this.radius = 0; +}); - /** - * The offset of this Body's position from its Game Object's position, in source pixels. - * - * @name Phaser.Physics.Arcade.Body#offset - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - * @see Phaser.Physics.Arcade.Body#setOffset - */ - this.offset = new Vector2(); +/** + * Adds a CSS file, or array of CSS files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.css('headers', 'styles/headers.css'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String and not already in-use by another file in the Loader. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.css({ + * key: 'headers', + * url: 'styles/headers.css' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.CSSFileConfig` for more details. + * + * Once the file has finished loading it will automatically be converted into a style DOM element + * via `document.createElement('style')`. It will have its `defer` property set to false and then the + * resulting element will be appended to `document.head`. The CSS styles are then applied to the current document. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.css". It will always add `.css` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the CSS File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#css + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.17.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.CSSFileConfig|Phaser.Types.Loader.FileTypes.CSSFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.css`, i.e. if `key` was "alien" then the URL will be "alien.css". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('css', function (key, url, xhrSettings) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new CSSFile(this, key[i])); + } + } + else + { + this.addFile(new CSSFile(this, key, url, xhrSettings)); + } - /** - * The position of this Body within the simulation. - * - * @name Phaser.Physics.Arcade.Body#position - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.position = new Vector2( - gameObject.x - gameObject.scaleX * gameObject.displayOriginX, - gameObject.y - gameObject.scaleY * gameObject.displayOriginY - ); + return this; +}); - /** - * The position of this Body during the previous step. - * - * @name Phaser.Physics.Arcade.Body#prev - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.prev = this.position.clone(); +module.exports = CSSFile; - /** - * The position of this Body during the previous frame. - * - * @name Phaser.Physics.Arcade.Body#prevFrame - * @type {Phaser.Math.Vector2} - * @since 3.20.0 - */ - this.prevFrame = this.position.clone(); - /** - * Whether this Body's `rotation` is affected by its angular acceleration and angular velocity. - * - * @name Phaser.Physics.Arcade.Body#allowRotation - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.allowRotation = true; +/***/ }), - /** - * This body's rotation, in degrees, based on its angular acceleration and angular velocity. - * The Body's rotation controls the `angle` of its Game Object. - * It doesn't rotate the Body's own geometry, which is always an axis-aligned rectangle or a circle. - * - * @name Phaser.Physics.Arcade.Body#rotation - * @type {number} - * @since 3.0.0 - */ - this.rotation = gameObject.angle; +/***/ 47375: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The Body rotation, in degrees, during the previous step. - * - * @name Phaser.Physics.Arcade.Body#preRotation - * @type {number} - * @since 3.0.0 - */ - this.preRotation = gameObject.angle; +/** + * @author Richard Davey + * @copyright 2021 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The width of the Body, in pixels. - * If the Body is circular, this is also the diameter. - * If you wish to change the width use the `Body.setSize` method. - * - * @name Phaser.Physics.Arcade.Body#width - * @type {number} - * @readonly - * @default 64 - * @since 3.0.0 - */ - this.width = width; +var AtlasJSONFile = __webpack_require__(73152); +var BinaryFile = __webpack_require__(40612); +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var ImageFile = __webpack_require__(42927); +var IsPlainObject = __webpack_require__(42911); +var JSONFile = __webpack_require__(70806); +var KTXParser = __webpack_require__(67409); +var Merge = __webpack_require__(30657); +var MultiAtlasFile = __webpack_require__(80802); +var MultiFile = __webpack_require__(45176); +var PVRParser = __webpack_require__(24904); - /** - * The height of the Body, in pixels. - * If the Body is circular, this is also the diameter. - * If you wish to change the height use the `Body.setSize` method. - * - * @name Phaser.Physics.Arcade.Body#height - * @type {number} - * @readonly - * @default 64 - * @since 3.0.0 - */ - this.height = height; +/** + * @classdesc + * A Compressed Texture File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#texture method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#texture. + * + * @class CompressedTextureFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {string} key - The key to use for this file. + * @param {Phaser.Types.Loader.FileTypes.CompressedTextureFileEntry} entry - The compressed texture file entry to load. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var CompressedTextureFile = new Class({ - /** - * The unscaled width of the Body, in source pixels, as set by setSize(). - * The default is the width of the Body's Game Object's texture frame. - * - * @name Phaser.Physics.Arcade.Body#sourceWidth - * @type {number} - * @since 3.0.0 - * @see Phaser.Physics.Arcade.Body#setSize - */ - this.sourceWidth = width; + Extends: MultiFile, - /** - * The unscaled height of the Body, in source pixels, as set by setSize(). - * The default is the height of the Body's Game Object's texture frame. - * - * @name Phaser.Physics.Arcade.Body#sourceHeight - * @type {number} - * @since 3.0.0 - * @see Phaser.Physics.Arcade.Body#setSize - */ - this.sourceHeight = height; + initialize: - if (gameObject.frame) + function CompressedTextureFile (loader, key, entry, xhrSettings) + { + if (entry.multiAtlasURL) { - this.sourceWidth = gameObject.frame.realWidth; - this.sourceHeight = gameObject.frame.realHeight; + var multi = new JSONFile(loader, { + key: key, + url: entry.multiAtlasURL, + xhrSettings: xhrSettings, + config: entry + }); + + MultiFile.call(this, loader, 'texture', key, [ multi ]); } + else + { + var extension = entry.textureURL.substr(entry.textureURL.length - 3); - /** - * Half the Body's width, in pixels. - * - * @name Phaser.Physics.Arcade.Body#halfWidth - * @type {number} - * @since 3.0.0 - */ - this.halfWidth = Math.abs(width / 2); + if (!entry.type) + { + entry.type = (extension.toLowerCase() === 'ktx') ? 'KTX' : 'PVR'; + } - /** - * Half the Body's height, in pixels. - * - * @name Phaser.Physics.Arcade.Body#halfHeight - * @type {number} - * @since 3.0.0 - */ - this.halfHeight = Math.abs(height / 2); + var image = new BinaryFile(loader, { + key: key, + url: entry.textureURL, + extension: extension, + xhrSettings: xhrSettings, + config: entry + }); - /** - * The center of the Body. - * The midpoint of its `position` (top-left corner) and its bottom-right corner. - * - * @name Phaser.Physics.Arcade.Body#center - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.center = new Vector2(this.position.x + this.halfWidth, this.position.y + this.halfHeight); + if (entry.atlasURL) + { + var data = new JSONFile(loader, { + key: key, + url: entry.atlasURL, + xhrSettings: xhrSettings, + config: entry + }); - /** - * The Body's velocity, in pixels per second. - * - * @name Phaser.Physics.Arcade.Body#velocity - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.velocity = new Vector2(); + MultiFile.call(this, loader, 'texture', key, [ image, data ]); + } + else + { + MultiFile.call(this, loader, 'texture', key, [ image ]); + } + } - /** - * The Body's change in position (due to velocity) at the last step, in pixels. - * - * The size of this value depends on the simulation's step rate. - * - * @name Phaser.Physics.Arcade.Body#newVelocity - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.0.0 - */ - this.newVelocity = new Vector2(); + this.config = entry; + }, - /** - * The Body's absolute maximum change in position, in pixels per step. - * - * @name Phaser.Physics.Arcade.Body#deltaMax - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.deltaMax = new Vector2(); + /** + * Called by each File when it finishes loading. + * + * @method Phaser.Loader.FileTypes.CompressedTextureFile#onFileComplete + * @since 3.60.0 + * + * @param {Phaser.Loader.File} file - The File that has completed processing. + */ + onFileComplete: function (file) + { + var index = this.files.indexOf(file); - /** - * The Body's change in velocity, in pixels per second squared. - * - * @name Phaser.Physics.Arcade.Body#acceleration - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.acceleration = new Vector2(); + if (index !== -1) + { + this.pending--; - /** - * Whether this Body's velocity is affected by its `drag`. - * - * @name Phaser.Physics.Arcade.Body#allowDrag - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.allowDrag = true; + if (!this.config.multiAtlasURL) + { + return; + } - /** - * When `useDamping` is false (the default), this is absolute loss of velocity due to movement, in pixels per second squared. - * - * When `useDamping` is true, this is a damping multiplier between 0 and 1. - * A value of 0 means the Body stops instantly. - * A value of 0.01 mean the Body keeps 1% of its velocity per second, losing 99%. - * A value of 0.1 means the Body keeps 10% of its velocity per second, losing 90%. - * A value of 1 means the Body loses no velocity. - * You can use very small values (e.g., 0.001) to stop the Body quickly. - * - * The x and y components are applied separately. - * - * Drag is applied only when `acceleration` is zero. - * - * @name Phaser.Physics.Arcade.Body#drag - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.drag = new Vector2(); + if (file.type === 'json' && file.data.hasOwnProperty('textures')) + { + // Inspect the data for the files to now load + var textures = file.data.textures; - /** - * Whether this Body's position is affected by gravity (local or world). - * - * @name Phaser.Physics.Arcade.Body#allowGravity - * @type {boolean} - * @default true - * @since 3.0.0 - * @see Phaser.Physics.Arcade.Body#gravity - * @see Phaser.Physics.Arcade.World#gravity - */ - this.allowGravity = true; + var config = this.config; + var loader = this.loader; - /** - * Acceleration due to gravity (specific to this Body), in pixels per second squared. - * Total gravity is the sum of this vector and the simulation's `gravity`. - * - * @name Phaser.Physics.Arcade.Body#gravity - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#gravity - */ - this.gravity = new Vector2(); + var currentBaseURL = loader.baseURL; + var currentPath = loader.path; + var currentPrefix = loader.prefix; - /** - * Rebound following a collision, relative to 1. - * - * @name Phaser.Physics.Arcade.Body#bounce - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.bounce = new Vector2(); + var baseURL = GetFastValue(config, 'multiBaseURL', this.baseURL); + var path = GetFastValue(config, 'multiPath', this.path); + var prefix = GetFastValue(config, 'prefix', this.prefix); + var textureXhrSettings = GetFastValue(config, 'textureXhrSettings'); - /** - * Rebound following a collision with the world boundary, relative to 1. - * If null, `bounce` is used instead. - * - * @name Phaser.Physics.Arcade.Body#worldBounce - * @type {?Phaser.Math.Vector2} - * @default null - * @since 3.0.0 - */ - this.worldBounce = null; + if (baseURL) + { + loader.setBaseURL(baseURL); + } - /** - * The rectangle used for world boundary collisions. - * - * By default it is set to the world boundary rectangle. Or, if this Body was - * created by a Physics Group, then whatever rectangle that Group defined. - * - * You can also change it by using the `Body.setBoundsRectangle` method. - * - * @name Phaser.Physics.Arcade.Body#customBoundsRectangle - * @type {Phaser.Geom.Rectangle} - * @since 3.20 - */ - this.customBoundsRectangle = world.bounds; + if (path) + { + loader.setPath(path); + } - // If true this Body will dispatch events + if (prefix) + { + loader.setPrefix(prefix); + } - /** - * Whether the simulation emits a `worldbounds` event when this Body collides with the world boundary (and `collideWorldBounds` is also true). - * - * @name Phaser.Physics.Arcade.Body#onWorldBounds - * @type {boolean} - * @default false - * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#WORLD_BOUNDS - */ - this.onWorldBounds = false; + for (var i = 0; i < textures.length; i++) + { + // "image": "texture-packer-multi-atlas-0.png", + var textureURL = textures[i].image; - /** - * Whether the simulation emits a `collide` event when this Body collides with another. - * - * @name Phaser.Physics.Arcade.Body#onCollide - * @type {boolean} - * @default false - * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#COLLIDE - */ - this.onCollide = false; + var key = 'CMA' + this.multiKeyIndex + '_' + textureURL; - /** - * Whether the simulation emits an `overlap` event when this Body overlaps with another. - * - * @name Phaser.Physics.Arcade.Body#onOverlap - * @type {boolean} - * @default false - * @since 3.0.0 - * @see Phaser.Physics.Arcade.World#OVERLAP - */ - this.onOverlap = false; + var image = new BinaryFile(loader, key, textureURL, textureXhrSettings); - /** - * The Body's absolute maximum velocity, in pixels per second. - * The horizontal and vertical components are applied separately. - * - * @name Phaser.Physics.Arcade.Body#maxVelocity - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.maxVelocity = new Vector2(10000, 10000); + this.addToMultiFile(image); - /** - * The maximum speed this Body is allowed to reach, in pixels per second. - * - * If not negative it limits the scalar value of speed. - * - * Any negative value means no maximum is being applied (the default). - * - * @name Phaser.Physics.Arcade.Body#maxSpeed - * @type {number} - * @default -1 - * @since 3.16.0 - */ - this.maxSpeed = -1; + loader.addFile(image); - /** - * If this Body is `immovable` and in motion, `friction` is the proportion of this Body's motion received by the riding Body on each axis, relative to 1. - * The horizontal component (x) is applied only when two colliding Bodies are separated vertically. - * The vertical component (y) is applied only when two colliding Bodies are separated horizontally. - * The default value (1, 0) moves the riding Body horizontally in equal proportion to this Body and vertically not at all. - * - * @name Phaser.Physics.Arcade.Body#friction - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.friction = new Vector2(1, 0); + // "normalMap": "texture-packer-multi-atlas-0_n.png", + if (textures[i].normalMap) + { + var normalMap = new BinaryFile(loader, key, textures[i].normalMap, textureXhrSettings); - /** - * If this Body is using `drag` for deceleration this property controls how the drag is applied. - * If set to `true` drag will use a damping effect rather than a linear approach. If you are - * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in - * the game Asteroids) then you will get a far smoother and more visually correct deceleration - * by using damping, avoiding the axis-drift that is prone with linear deceleration. - * - * If you enable this property then you should use far smaller `drag` values than with linear, as - * they are used as a multiplier on the velocity. Values such as 0.05 will give a nice slow - * deceleration. - * - * @name Phaser.Physics.Arcade.Body#useDamping - * @type {boolean} - * @default false - * @since 3.10.0 - */ - this.useDamping = false; + normalMap.type = 'normalMap'; - /** - * The rate of change of this Body's `rotation`, in degrees per second. - * - * @name Phaser.Physics.Arcade.Body#angularVelocity - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.angularVelocity = 0; + image.setLink(normalMap); - /** - * The Body's angular acceleration (change in angular velocity), in degrees per second squared. - * - * @name Phaser.Physics.Arcade.Body#angularAcceleration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.angularAcceleration = 0; + this.addToMultiFile(normalMap); - /** - * Loss of angular velocity due to angular movement, in degrees per second. - * - * Angular drag is applied only when angular acceleration is zero. - * - * @name Phaser.Physics.Arcade.Body#angularDrag - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.angularDrag = 0; + loader.addFile(normalMap); + } + } - /** - * The Body's maximum angular velocity, in degrees per second. - * - * @name Phaser.Physics.Arcade.Body#maxAngular - * @type {number} - * @default 1000 - * @since 3.0.0 - */ - this.maxAngular = 1000; + // Reset the loader settings + loader.setBaseURL(currentBaseURL); + loader.setPath(currentPath); + loader.setPrefix(currentPrefix); + } + } + }, - /** - * The Body's inertia, relative to a default unit (1). - * With `bounce`, this affects the exchange of momentum (velocities) during collisions. - * - * @name Phaser.Physics.Arcade.Body#mass - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.mass = 1; + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.CompressedTextureFile#addToCache + * @since 3.60.0 + */ + addToCache: function () + { + if (this.isReadyToProcess()) + { + var entry = this.config; - /** - * The calculated angle of this Body's velocity vector, in radians, during the last step. - * - * @name Phaser.Physics.Arcade.Body#angle - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.angle = 0; + if (entry.multiAtlasURL) + { + this.addMultiToCache(); + } + else + { + var renderer = this.loader.systems.renderer; + var textureManager = this.loader.textureManager; + var textureData; - /** - * The calculated magnitude of the Body's velocity, in pixels per second, during the last step. - * - * @name Phaser.Physics.Arcade.Body#speed - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.speed = 0; + var image = this.files[0]; + var json = this.files[1]; - /** - * The direction of the Body's velocity, as calculated during the last step. - * This is a numeric constant value (FACING_UP, FACING_DOWN, FACING_LEFT, FACING_RIGHT). - * If the Body is moving on both axes, this describes motion on the vertical axis only. - * - * @name Phaser.Physics.Arcade.Body#facing - * @type {number} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.FACING_UP - * @see Phaser.Physics.Arcade.FACING_DOWN - * @see Phaser.Physics.Arcade.FACING_LEFT - * @see Phaser.Physics.Arcade.FACING_RIGHT - */ - this.facing = CONST.FACING_NONE; + if (entry.type === 'PVR') + { + textureData = PVRParser(image.data); + } + else if (entry.type === 'KTX') + { + textureData = KTXParser(image.data); + } - /** - * Whether this Body can be moved by collisions with another Body. - * - * @name Phaser.Physics.Arcade.Body#immovable - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.immovable = false; + if (textureData && renderer.supportsCompressedTexture(entry.format, textureData.internalFormat)) + { + textureData.format = renderer.getCompressedTextureName(entry.format, textureData.internalFormat); - /** - * Sets if this Body can be pushed by another Body. - * - * A body that cannot be pushed will reflect back all of the velocity it is given to the - * colliding body. If that body is also not pushable, then the separation will be split - * between them evenly. - * - * If you want your body to never move or seperate at all, see the `setImmovable` method. - * - * By default, Dynamic Bodies are always pushable. - * - * @name Phaser.Physics.Arcade.Body#pushable - * @type {boolean} - * @default true - * @since 3.50.0 - * @see Phaser.GameObjects.Components.Pushable#setPushable - */ - this.pushable = true; + var atlasData = (json && json.data) ? json.data : null; - /** - * Whether the Body's position and rotation are affected by its velocity, acceleration, drag, and gravity. - * - * @name Phaser.Physics.Arcade.Body#moves - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.moves = true; + textureManager.addCompressedTexture(image.key, textureData, atlasData); + } + } - /** - * A flag disabling the default horizontal separation of colliding bodies. - * Pass your own `collideCallback` to the collider. - * - * @name Phaser.Physics.Arcade.Body#customSeparateX - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.customSeparateX = false; + this.complete = true; + } + }, - /** - * A flag disabling the default vertical separation of colliding bodies. - * Pass your own `collideCallback` to the collider. - * - * @name Phaser.Physics.Arcade.Body#customSeparateY - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.customSeparateY = false; + /** + * Adds all of the multi-file entties to their target caches upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.CompressedTextureFile#addMultiToCache + * @since 3.60.0 + */ + addMultiToCache: function () + { + var entry = this.config; + var json = this.files[0]; - /** - * The amount of horizontal overlap (before separation), if this Body is colliding with another. - * - * @name Phaser.Physics.Arcade.Body#overlapX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.overlapX = 0; + var data = []; + var images = []; + var normalMaps = []; - /** - * The amount of vertical overlap (before separation), if this Body is colliding with another. - * - * @name Phaser.Physics.Arcade.Body#overlapY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.overlapY = 0; + var renderer = this.loader.systems.renderer; + var textureManager = this.loader.textureManager; + var textureData; - /** - * The amount of overlap (before separation), if this Body is circular and colliding with another circular body. - * - * @name Phaser.Physics.Arcade.Body#overlapR - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.overlapR = 0; + for (var i = 1; i < this.files.length; i++) + { + var file = this.files[i]; - /** - * Whether this Body is overlapped with another and both are not moving, on at least one axis. - * - * @name Phaser.Physics.Arcade.Body#embedded - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.embedded = false; + if (file.type === 'normalMap') + { + continue; + } - /** - * Whether this Body interacts with the world boundary. - * - * @name Phaser.Physics.Arcade.Body#collideWorldBounds - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.collideWorldBounds = false; + var pos = file.key.indexOf('_'); + var key = file.key.substr(pos + 1); - /** - * Whether this Body is checked for collisions and for which directions. - * You can set `checkCollision.none = true` to disable collision checks. - * - * @name Phaser.Physics.Arcade.Body#checkCollision - * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} - * @since 3.0.0 - */ - this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; + var image = file.data; - /** - * Whether this Body is colliding with a Body or Static Body and in which direction. - * In a collision where both bodies have zero velocity, `embedded` will be set instead. - * - * @name Phaser.Physics.Arcade.Body#touching - * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#blocked - * @see Phaser.Physics.Arcade.Body#embedded - */ - this.touching = { none: true, up: false, down: false, left: false, right: false }; + // Now we need to find out which json entry this mapped to + for (var t = 0; t < json.data.textures.length; t++) + { + var item = json.data.textures[t]; - /** - * This Body's `touching` value during the previous step. - * - * @name Phaser.Physics.Arcade.Body#wasTouching - * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#touching - */ - this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; + if (item.image === key) + { + if (entry.type === 'PVR') + { + textureData = PVRParser(image); + } + else if (entry.type === 'KTX') + { + textureData = KTXParser(image); + } - /** - * Whether this Body is colliding with a Static Body, a tile, or the world boundary. - * In a collision with a Static Body, if this Body has zero velocity then `embedded` will be set instead. - * - * @name Phaser.Physics.Arcade.Body#blocked - * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} - * @since 3.0.0 - * - * @see Phaser.Physics.Arcade.Body#embedded - * @see Phaser.Physics.Arcade.Body#touching - */ - this.blocked = { none: true, up: false, down: false, left: false, right: false }; + if (textureData && renderer.supportsCompressedTexture(entry.format, textureData.internalFormat)) + { + textureData.format = renderer.getCompressedTextureName(entry.format, textureData.internalFormat); - /** - * Whether to automatically synchronize this Body's dimensions to the dimensions of its Game Object's visual bounds. - * - * @name Phaser.Physics.Arcade.Body#syncBounds - * @type {boolean} - * @default false - * @since 3.0.0 - * @see Phaser.GameObjects.Components.GetBounds#getBounds - */ - this.syncBounds = false; + images.push(textureData); - /** - * The Body's physics type (dynamic or static). - * - * @name Phaser.Physics.Arcade.Body#physicsType - * @type {number} - * @readonly - * @default Phaser.Physics.Arcade.DYNAMIC_BODY - * @since 3.0.0 - */ - this.physicsType = CONST.DYNAMIC_BODY; + data.push(item); - /** - * Cached horizontal scale of the Body's Game Object. - * - * @name Phaser.Physics.Arcade.Body#_sx - * @type {number} - * @private - * @since 3.0.0 - */ - this._sx = gameObject.scaleX; + if (file.linkFile) + { + normalMaps.push(file.linkFile.data); + } + } - /** - * Cached vertical scale of the Body's Game Object. - * - * @name Phaser.Physics.Arcade.Body#_sy - * @type {number} - * @private - * @since 3.0.0 - */ - this._sy = gameObject.scaleY; + break; + } + } + } - /** - * The calculated change in the Body's horizontal position during the last step. - * - * @name Phaser.Physics.Arcade.Body#_dx - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._dx = 0; + if (normalMaps.length === 0) + { + normalMaps = undefined; + } - /** - * The calculated change in the Body's vertical position during the last step. - * - * @name Phaser.Physics.Arcade.Body#_dy - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._dy = 0; + textureManager.addAtlasJSONArray(this.key, images, data, normalMaps); - /** - * The final calculated change in the Body's horizontal position as of `postUpdate`. - * - * @name Phaser.Physics.Arcade.Body#_tx - * @type {number} - * @private - * @default 0 - * @since 3.22.0 - */ - this._tx = 0; + this.complete = true; + } - /** - * The final calculated change in the Body's vertical position as of `postUpdate`. - * - * @name Phaser.Physics.Arcade.Body#_ty - * @type {number} - * @private - * @default 0 - * @since 3.22.0 - */ - this._ty = 0; +}); - /** - * Stores the Game Object's bounds. - * - * @name Phaser.Physics.Arcade.Body#_bounds - * @type {Phaser.Geom.Rectangle} - * @private - * @since 3.0.0 - */ - this._bounds = new Rectangle(); - }, +/** + * Adds a Compressed Texture file to the current load queue. This feature is WebGL only. + * + * This method takes a key and a configuration object, which lists the different formats + * and files associated with them. + * + * The texture format object should be ordered in GPU priority order, with IMG as the last entry. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * preload () + * { + * this.load.texture('yourPic', { + * ASTC: { type: 'PVR', textureURL: 'pic-astc-4x4.pvr' }, + * PVRTC: { type: 'PVR', textureURL: 'pic-pvrtc-4bpp-rgba.pvr' }, + * S3TC: { type: 'PVR', textureURL: 'pic-dxt5.pvr' }, + * IMG: { textureURL: 'pic.png' } + * }); + * ``` + * + * If you wish to load a texture atlas, provide the `atlasURL` property: + * + * ```javascript + * preload () + * { + * const path = 'assets/compressed'; + * + * this.load.texture('yourAtlas', { + * 'ASTC': { type: 'PVR', textureURL: `${path}/textures-astc-4x4.pvr`, atlasURL: `${path}/textures.json` }, + * 'PVRTC': { type: 'PVR', textureURL: `${path}/textures-pvrtc-4bpp-rgba.pvr`, atlasURL: `${path}/textures-pvrtc-4bpp-rgba.json` }, + * 'S3TC': { type: 'PVR', textureURL: `${path}/textures-dxt5.pvr`, atlasURL: `${path}/textures-dxt5.json` }, + * 'IMG': { textureURL: `${path}/textures.png`, atlasURL: `${path}/textures.json` } + * }); + * } + * ``` + * + * If you wish to load a Multi Atlas, as exported from Texture Packer Pro, use the `multiAtlasURL` property instead: + * + * ```javascript + * preload () + * { + * const path = 'assets/compressed'; + * + * this.load.texture('yourAtlas', { + * 'ASTC': { type: 'PVR', atlasURL: `${path}/textures.json` }, + * 'PVRTC': { type: 'PVR', atlasURL: `${path}/textures-pvrtc-4bpp-rgba.json` }, + * 'S3TC': { type: 'PVR', atlasURL: `${path}/textures-dxt5.json` }, + * 'IMG': { atlasURL: `${path}/textures.json` } + * }); + * } + * ``` + * + * When loading a Multi Atlas you do not need to specify the `textureURL` property as it will be read from the JSON file. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.texture({ + * key: 'yourPic', + * url: { + * ASTC: { type: 'PVR', textureURL: 'pic-astc-4x4.pvr' }, + * PVRTC: { type: 'PVR', textureURL: 'pic-pvrtc-4bpp-rgba.pvr' }, + * S3TC: { type: 'PVR', textureURL: 'pic-dxt5.pvr' }, + * IMG: { textureURL: 'pic.png' } + * } + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.CompressedTextureFileConfig` for more details. + * + * The number of formats you provide to this function is up to you, but you should ensure you + * cover the primary platforms where appropriate. + * + * The 'IMG' entry is a fallback to a JPG or PNG, should the browser be unable to load any of the other + * formats presented to this function. You should really always include this, although it is optional. + * + * Phaser supports loading both the PVR and KTX container formats. Within those, it can parse + * the following texture compression formats: + * + * ETC + * ETC1 + * ATC + * ASTC + * BPTC + * RGTC + * PVRTC + * S3TC + * S3TCSRGB + * + * For more information about the benefits of compressed textures please see the + * following articles: + * + * Texture Compression in 2020 (https://aras-p.info/blog/2020/12/08/Texture-Compression-in-2020/) + * Compressed GPU Texture Formats (https://themaister.net/blog/2020/08/12/compressed-gpu-texture-formats-a-review-and-compute-shader-decoders-part-1/) + * + * To create compressed texture files use a 3rd party application such as: + * + * Texture Packer (https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-for-phaser3?utm_source=ad&utm_medium=banner&utm_campaign=phaser-2018-10-16) + * PVRTexTool (https://developer.imaginationtech.com/pvrtextool/) - available for Windows, macOS and Linux. + * Mali Texture Compression Tool (https://developer.arm.com/tools-and-software/graphics-and-gaming/mali-texture-compression-tool) + * ASTC Encoder (https://github.com/ARM-software/astc-encoder) + * + * ASTCs must have a Channel Type of Unsigned Normalized Bytes (UNorm) and a Linear RGB Color Space. + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Data` the final key will be `LEVEL1.Data` and + * this is what you would use to retrieve the text from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * Unlike other file loaders in Phaser, the URLs must include the file extension. + * + * Note: The ability to load this type of file will only be available if the Compressed Texture File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#texture + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.60.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.CompressedTextureFileConfig|Phaser.Types.Loader.FileTypes.CompressedTextureFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {Phaser.Types.Loader.FileTypes.CompressedTextureFileConfig} [url] - The compressed texture configuration object. Not required if passing a config object as the `key` parameter. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('texture', function (key, url, xhrSettings) +{ + var renderer = this.systems.renderer; + + var AddEntry = function (loader, key, urls, xhrSettings) + { + var entry = { + format: null, + type: null, + textureURL: undefined, + atlasURL: undefined, + multiAtlasURL: undefined, + multiPath: undefined, + multiBaseURL: undefined + }; - /** - * Updates the Body's `transform`, `width`, `height`, and `center` from its Game Object. - * The Body's `position` isn't changed. - * - * @method Phaser.Physics.Arcade.Body#updateBounds - * @since 3.0.0 - */ - updateBounds: function () - { - var sprite = this.gameObject; + if (IsPlainObject(key)) + { + var config = key; - // Container? + key = GetFastValue(config, 'key'); + urls = GetFastValue(config, 'url'), + xhrSettings = GetFastValue(config, 'xhrSettings'); + } - var transform = this.transform; + var matched = false; - if (sprite.parentContainer) + for (var textureBaseFormat in urls) { - var matrix = sprite.getWorldTransformMatrix(this.world._tempMatrix, this.world._tempMatrix2); + if (renderer.supportsCompressedTexture(textureBaseFormat)) + { + var urlEntry = urls[textureBaseFormat]; - transform.x = matrix.tx; - transform.y = matrix.ty; - transform.rotation = RadToDeg(matrix.rotation); - transform.scaleX = matrix.scaleX; - transform.scaleY = matrix.scaleY; - transform.displayOriginX = sprite.displayOriginX; - transform.displayOriginY = sprite.displayOriginY; + if (typeof urlEntry === 'string') + { + entry.textureURL = urlEntry; + } + else + { + entry = Merge(urlEntry, entry); + } + + entry.format = textureBaseFormat.toUpperCase(); + + matched = true; + + break; + } } - else + + if (!matched) { - transform.x = sprite.x; - transform.y = sprite.y; - transform.rotation = sprite.angle; - transform.scaleX = sprite.scaleX; - transform.scaleY = sprite.scaleY; - transform.displayOriginX = sprite.displayOriginX; - transform.displayOriginY = sprite.displayOriginY; + console.warn('No supported compressed texture format or IMG fallback', key); } + else if (entry.format === 'IMG') + { + var file; + var multifile; - var recalc = false; + if (entry.multiAtlasURL) + { + multifile = new MultiAtlasFile(loader, key, entry.multiAtlasURL, entry.multiPath, entry.multiBaseURL, xhrSettings); - if (this.syncBounds) - { - var b = sprite.getBounds(this._bounds); + file = multifile.files; + } + else if (entry.atlasURL) + { + multifile = new AtlasJSONFile(loader, key, entry.textureURL, entry.atlasURL, xhrSettings); - this.width = b.width; - this.height = b.height; - recalc = true; + file = multifile.files; + } + else + { + file = new ImageFile(loader, key, entry.textureURL, xhrSettings); + } + + loader.addFile(file); } else { - var asx = Math.abs(transform.scaleX); - var asy = Math.abs(transform.scaleY); + var texture = new CompressedTextureFile(loader, key, entry, xhrSettings); - if (this._sx !== asx || this._sy !== asy) - { - this.width = this.sourceWidth * asx; - this.height = this.sourceHeight * asy; - this._sx = asx; - this._sy = asy; - recalc = true; - } + loader.addFile(texture.files); } + }; - if (recalc) + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) { - this.halfWidth = Math.floor(this.width / 2); - this.halfHeight = Math.floor(this.height / 2); - this.updateCenter(); + AddEntry(this, key[i]); } - }, - - /** - * Updates the Body's `center` from its `position`, `width`, and `height`. - * - * @method Phaser.Physics.Arcade.Body#updateCenter - * @since 3.0.0 - */ - updateCenter: function () + } + else { - this.center.set(this.position.x + this.halfWidth, this.position.y + this.halfHeight); - }, + AddEntry(this, key, url, xhrSettings); + } - /** - * Updates the Body's `position`, `width`, `height`, and `center` from its Game Object and `offset`. - * - * You don't need to call this for Dynamic Bodies, as it happens automatically during the physics step. - * But you could use it if you have modified the Body offset or Game Object transform and need to immediately - * read the Body's new `position` or `center`. - * - * To resynchronize the Body with its Game Object, use `reset()` instead. - * - * @method Phaser.Physics.Arcade.Body#updateFromGameObject - * @since 3.24.0 - */ - updateFromGameObject: function () - { - this.updateBounds(); + return this; +}); - var transform = this.transform; +module.exports = CompressedTextureFile; - this.position.x = transform.x + transform.scaleX * (this.offset.x - transform.displayOriginX); - this.position.y = transform.y + transform.scaleY * (this.offset.y - transform.displayOriginY); - this.updateCenter(); - }, +/***/ }), - /** - * Prepares the Body for a physics step by resetting the `wasTouching`, `touching` and `blocked` states. - * - * This method is only called if the physics world is going to run a step this frame. - * - * @method Phaser.Physics.Arcade.Body#resetFlags - * @since 3.18.0 - * - * @param {boolean} [clear=false] - Set the `wasTouching` values to their defaults. - */ - resetFlags: function (clear) - { - if (clear === undefined) - { - clear = false; - } +/***/ 46568: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Store and reset collision flags - var wasTouching = this.wasTouching; - var touching = this.touching; - var blocked = this.blocked; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (clear) +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); +var Shader = __webpack_require__(31053); + +/** + * @classdesc + * A single GLSL File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#glsl method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#glsl. + * + * @class GLSLFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.GLSLFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". + * @param {string} [shaderType='fragment'] - The type of shader. Either `fragment` for a fragment shader, or `vertex` for a vertex shader. This is ignored if you load a shader bundle. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var GLSLFile = new Class({ + + Extends: File, + + initialize: + + function GLSLFile (loader, key, url, shaderType, xhrSettings) + { + var extension = 'glsl'; + + if (IsPlainObject(key)) { - wasTouching.none = true; - wasTouching.up = false; - wasTouching.down = false; - wasTouching.left = false; - wasTouching.right = false; + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + shaderType = GetFastValue(config, 'shaderType', 'fragment'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); } - else + else if (shaderType === undefined) { - wasTouching.none = touching.none; - wasTouching.up = touching.up; - wasTouching.down = touching.down; - wasTouching.left = touching.left; - wasTouching.right = touching.right; + shaderType = 'fragment'; } - touching.none = true; - touching.up = false; - touching.down = false; - touching.left = false; - touching.right = false; - - blocked.none = true; - blocked.up = false; - blocked.down = false; - blocked.left = false; - blocked.right = false; - - this.overlapR = 0; - this.overlapX = 0; - this.overlapY = 0; + var fileConfig = { + type: 'glsl', + cache: loader.cacheManager.shader, + extension: extension, + responseType: 'text', + key: key, + url: url, + config: { + shaderType: shaderType + }, + xhrSettings: xhrSettings + }; - this.embedded = false; + File.call(this, loader, fileConfig); }, /** - * Syncs the position body position with the parent Game Object. - * - * This method is called every game frame, regardless if the world steps or not. - * - * @method Phaser.Physics.Arcade.Body#preUpdate - * @since 3.17.0 + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. * - * @param {boolean} willStep - Will this Body run an update as well? - * @param {number} delta - The delta time, in seconds, elapsed since the last frame. + * @method Phaser.Loader.FileTypes.GLSLFile#onProcess + * @since 3.7.0 */ - preUpdate: function (willStep, delta) + onProcess: function () { - if (willStep) - { - this.resetFlags(); - } + this.state = CONST.FILE_PROCESSING; - this.updateFromGameObject(); + this.data = this.xhrLoader.responseText; - this.rotation = this.transform.rotation; - this.preRotation = this.rotation; - - if (this.moves) - { - this.prev.x = this.position.x; - this.prev.y = this.position.y; - this.prevFrame.x = this.position.x; - this.prevFrame.y = this.position.y; - } - - if (willStep) - { - this.update(delta); - } - }, + this.onProcessComplete(); + }, /** - * Performs a single physics step and updates the body velocity, angle, speed and other properties. - * - * This method can be called multiple times per game frame, depending on the physics step rate. - * - * The results are synced back to the Game Object in `postUpdate`. - * - * @method Phaser.Physics.Arcade.Body#update - * @fires Phaser.Physics.Arcade.Events#WORLD_BOUNDS - * @since 3.0.0 + * Adds this file to its target cache upon successful loading and processing. * - * @param {number} delta - The delta time, in seconds, elapsed since the last frame. + * @method Phaser.Loader.FileTypes.GLSLFile#addToCache + * @since 3.17.0 */ - update: function (delta) + addToCache: function () { - this.prev.x = this.position.x; - this.prev.y = this.position.y; - - if (this.moves) - { - this.world.updateMotion(this, delta); - - var vx = this.velocity.x; - var vy = this.velocity.y; - - this.newVelocity.set(vx * delta, vy * delta); - - this.position.add(this.newVelocity); - - this.updateCenter(); - - this.angle = Math.atan2(vy, vx); - this.speed = Math.sqrt(vx * vx + vy * vy); + var data = this.data.split('\n'); - // Now the update will throw collision checks at the Body - // And finally we'll integrate the new position back to the Sprite in postUpdate + // Check to see if this is a shader bundle, or raw glsl file. + var block = this.extractBlock(data, 0); - if (this.collideWorldBounds && this.checkWorldBounds() && this.onWorldBounds) + if (block) + { + while (block) { - this.world.emit(Events.WORLD_BOUNDS, this, this.blocked.up, this.blocked.down, this.blocked.left, this.blocked.right); - } - } - - this._dx = this.position.x - this.prev.x; - this._dy = this.position.y - this.prev.y; - }, + var key = this.getShaderName(block.header); + var shaderType = this.getShaderType(block.header); + var uniforms = this.getShaderUniforms(block.header); + var shaderSrc = block.shader; - /** - * Feeds the Body results back into the parent Game Object. - * - * This method is called every game frame, regardless if the world steps or not. - * - * @method Phaser.Physics.Arcade.Body#postUpdate - * @since 3.0.0 - */ - postUpdate: function () - { - var dx = this.position.x - this.prevFrame.x; - var dy = this.position.y - this.prevFrame.y; + if (this.cache.has(key)) + { + var shader = this.cache.get(key); - if (this.moves) - { - var mx = this.deltaMax.x; - var my = this.deltaMax.y; + if (shaderType === 'fragment') + { + shader.fragmentSrc = shaderSrc; + } + else + { + shader.vertexSrc = shaderSrc; + } - if (mx !== 0 && dx !== 0) - { - if (dx < 0 && dx < -mx) - { - dx = -mx; - } - else if (dx > 0 && dx > mx) - { - dx = mx; + if (!shader.uniforms) + { + shader.uniforms = uniforms; + } } - } - - if (my !== 0 && dy !== 0) - { - if (dy < 0 && dy < -my) + else if (shaderType === 'fragment') { - dy = -my; + this.cache.add(key, new Shader(key, shaderSrc, '', uniforms)); } - else if (dy > 0 && dy > my) + else { - dy = my; + this.cache.add(key, new Shader(key, '', shaderSrc, uniforms)); } - } - - this.gameObject.x += dx; - this.gameObject.y += dy; - } - - if (dx < 0) - { - this.facing = CONST.FACING_LEFT; - } - else if (dx > 0) - { - this.facing = CONST.FACING_RIGHT; - } - if (dy < 0) - { - this.facing = CONST.FACING_UP; + block = this.extractBlock(data, block.offset); + } } - else if (dy > 0) + else if (this.config.shaderType === 'fragment') { - this.facing = CONST.FACING_DOWN; + // Single shader + this.cache.add(this.key, new Shader(this.key, this.data)); } - - if (this.allowRotation) + else { - this.gameObject.angle += this.deltaZ(); + this.cache.add(this.key, new Shader(this.key, '', this.data)); } - - this._tx = dx; - this._ty = dy; }, /** - * Sets a custom collision boundary rectangle. Use if you want to have a custom - * boundary instead of the world boundaries. - * - * @method Phaser.Physics.Arcade.Body#setBoundsRectangle - * @since 3.20 - * - * @param {?Phaser.Geom.Rectangle} [bounds] - The new boundary rectangle. Pass `null` to use the World bounds. + * Returns the name of the shader from the header block. * - * @return {this} This Body object. - */ - setBoundsRectangle: function (bounds) - { - this.customBoundsRectangle = (!bounds) ? this.world.bounds : bounds; - - return this; - }, - - /** - * Checks for collisions between this Body and the world boundary and separates them. + * @method Phaser.Loader.FileTypes.GLSLFile#getShaderName + * @since 3.17.0 * - * @method Phaser.Physics.Arcade.Body#checkWorldBounds - * @since 3.0.0 + * @param {string[]} headerSource - The header data. * - * @return {boolean} True if this Body is colliding with the world boundary. + * @return {string} The shader name. */ - checkWorldBounds: function () + getShaderName: function (headerSource) { - var pos = this.position; - var bounds = this.customBoundsRectangle; - var check = this.world.checkCollision; - - var bx = (this.worldBounce) ? -this.worldBounce.x : -this.bounce.x; - var by = (this.worldBounce) ? -this.worldBounce.y : -this.bounce.y; - - var wasSet = false; - - if (pos.x < bounds.x && check.left) - { - pos.x = bounds.x; - this.velocity.x *= bx; - this.blocked.left = true; - wasSet = true; - } - else if (this.right > bounds.right && check.right) - { - pos.x = bounds.right - this.width; - this.velocity.x *= bx; - this.blocked.right = true; - wasSet = true; - } - - if (pos.y < bounds.y && check.up) - { - pos.y = bounds.y; - this.velocity.y *= by; - this.blocked.up = true; - wasSet = true; - } - else if (this.bottom > bounds.bottom && check.down) + for (var i = 0; i < headerSource.length; i++) { - pos.y = bounds.bottom - this.height; - this.velocity.y *= by; - this.blocked.down = true; - wasSet = true; - } + var line = headerSource[i].trim(); - if (wasSet) - { - this.blocked.none = false; - this.updateCenter(); + if (line.substring(0, 5) === 'name:') + { + return line.substring(5).trim(); + } } - return wasSet; + return this.key; }, /** - * Sets the offset of the Body's position from its Game Object's position. - * The Body's `position` isn't changed until the next `preUpdate`. + * Returns the type of the shader from the header block. * - * @method Phaser.Physics.Arcade.Body#setOffset - * @since 3.0.0 + * @method Phaser.Loader.FileTypes.GLSLFile#getShaderType + * @since 3.17.0 * - * @param {number} x - The horizontal offset, in source pixels. - * @param {number} [y=x] - The vertical offset, in source pixels. + * @param {string[]} headerSource - The header data. * - * @return {Phaser.Physics.Arcade.Body} This Body object. + * @return {string} The shader type. Either 'fragment' or 'vertex'. */ - setOffset: function (x, y) + getShaderType: function (headerSource) { - if (y === undefined) { y = x; } + for (var i = 0; i < headerSource.length; i++) + { + var line = headerSource[i].trim(); - this.offset.set(x, y); + if (line.substring(0, 5) === 'type:') + { + return line.substring(5).trim(); + } + } - return this; + return this.config.shaderType; }, /** - * Sizes and positions this Body, as a rectangle. - * Modifies the Body `offset` if `center` is true (the default). - * Resets the width and height to match current frame, if no width and height provided and a frame is found. + * Returns the shader uniforms from the header block. * - * @method Phaser.Physics.Arcade.Body#setSize - * @since 3.0.0 + * @method Phaser.Loader.FileTypes.GLSLFile#getShaderUniforms + * @since 3.17.0 * - * @param {number} [width] - The width of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width. - * @param {number} [height] - The height of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height. - * @param {boolean} [center=true] - Modify the Body's `offset`, placing the Body's center on its Game Object's center. Only works if the Game Object has the `getCenter` method. + * @param {string[]} headerSource - The header data. * - * @return {Phaser.Physics.Arcade.Body} This Body object. + * @return {any} The shader uniforms object. */ - setSize: function (width, height, center) + getShaderUniforms: function (headerSource) { - if (center === undefined) { center = true; } - - var gameObject = this.gameObject; - - if (!width && gameObject.frame) - { - width = gameObject.frame.realWidth; - } + var uniforms = {}; - if (!height && gameObject.frame) + for (var i = 0; i < headerSource.length; i++) { - height = gameObject.frame.realHeight; - } - - this.sourceWidth = width; - this.sourceHeight = height; - - this.width = this.sourceWidth * this._sx; - this.height = this.sourceHeight * this._sy; - - this.halfWidth = Math.floor(this.width / 2); - this.halfHeight = Math.floor(this.height / 2); + var line = headerSource[i].trim(); - this.updateCenter(); + if (line.substring(0, 8) === 'uniform.') + { + var pos = line.indexOf(':'); - if (center && gameObject.getCenter) - { - var ox = (gameObject.width - width) / 2; - var oy = (gameObject.height - height) / 2; + if (pos) + { + var key = line.substring(8, pos); - this.offset.set(ox, oy); + try + { + uniforms[key] = JSON.parse(line.substring(pos + 1)); + } + catch (e) + { + console.warn('Invalid uniform JSON: ' + key); + } + } + } } - this.isCircle = false; - this.radius = 0; - - return this; + return uniforms; }, /** - * Sizes and positions this Body, as a circle. + * Processes the shader file and extracts the relevant data. * - * @method Phaser.Physics.Arcade.Body#setCircle - * @since 3.0.0 + * @method Phaser.Loader.FileTypes.GLSLFile#extractBlock + * @private + * @since 3.17.0 * - * @param {number} radius - The radius of the Body, in source pixels. - * @param {number} [offsetX] - The horizontal offset of the Body from its Game Object, in source pixels. - * @param {number} [offsetY] - The vertical offset of the Body from its Game Object, in source pixels. + * @param {string[]} data - The array of shader data to process. + * @param {number} offset - The offset to start processing from. * - * @return {Phaser.Physics.Arcade.Body} This Body object. + * @return {any} The processed shader block, or null. */ - setCircle: function (radius, offsetX, offsetY) + extractBlock: function (data, offset) { - if (offsetX === undefined) { offsetX = this.offset.x; } - if (offsetY === undefined) { offsetY = this.offset.y; } + var headerStart = -1; + var headerEnd = -1; + var blockEnd = -1; + var headerOpen = false; + var captureSource = false; + var headerSource = []; + var shaderSource = []; - if (radius > 0) + for (var i = offset; i < data.length; i++) { - this.isCircle = true; - this.radius = radius; - - this.sourceWidth = radius * 2; - this.sourceHeight = radius * 2; - - this.width = this.sourceWidth * this._sx; - this.height = this.sourceHeight * this._sy; - - this.halfWidth = Math.floor(this.width / 2); - this.halfHeight = Math.floor(this.height / 2); + var line = data[i].trim(); - this.offset.set(offsetX, offsetY); + if (line === '---') + { + if (headerStart === -1) + { + headerStart = i; + headerOpen = true; + } + else if (headerOpen) + { + headerEnd = i; + headerOpen = false; + captureSource = true; + } + else + { + // We've hit another --- delimiter, break out + captureSource = false; + break; + } + } + else if (headerOpen) + { + headerSource.push(line); + } + else if (captureSource) + { + shaderSource.push(line); + blockEnd = i; + } + } - this.updateCenter(); + if (!headerOpen && headerEnd !== -1) + { + return { header: headerSource, shader: shaderSource.join('\n'), offset: blockEnd }; } else { - this.isCircle = false; + return null; } + } - return this; - }, +}); - /** - * Sets this Body's parent Game Object to the given coordinates and resets this Body at the new coordinates. - * If the Body had any velocity or acceleration it is lost as a result of calling this. - * - * @method Phaser.Physics.Arcade.Body#reset - * @since 3.0.0 - * - * @param {number} x - The horizontal position to place the Game Object. - * @param {number} y - The vertical position to place the Game Object. - */ - reset: function (x, y) +/** + * Adds a GLSL file, or array of GLSL files, to the current load queue. + * In Phaser 3 GLSL files are just plain Text files at the current moment in time. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.glsl('plasma', 'shaders/Plasma.glsl'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Shader Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Shader Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Shader Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.glsl({ + * key: 'plasma', + * shaderType: 'fragment', + * url: 'shaders/Plasma.glsl' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.GLSLFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.glsl('plasma', 'shaders/Plasma.glsl'); + * // and later in your game ... + * var data = this.cache.shader.get('plasma'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `FX.` and the key was `Plasma` the final key will be `FX.Plasma` and + * this is what you would use to retrieve the text from the Shader Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "plasma" + * and no URL is given then the Loader will set the URL to be "plasma.glsl". It will always add `.glsl` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the GLSL File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#glsl + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.GLSLFileConfig|Phaser.Types.Loader.FileTypes.GLSLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.glsl`, i.e. if `key` was "alien" then the URL will be "alien.glsl". + * @param {string} [shaderType='fragment'] - The type of shader. Either `fragment` for a fragment shader, or `vertex` for a vertex shader. This is ignored if you load a shader bundle. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('glsl', function (key, url, shaderType, xhrSettings) +{ + if (Array.isArray(key)) { - this.stop(); + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new GLSLFile(this, key[i])); + } + } + else + { + this.addFile(new GLSLFile(this, key, url, shaderType, xhrSettings)); + } - var gameObject = this.gameObject; + return this; +}); - gameObject.setPosition(x, y); +module.exports = GLSLFile; - if (gameObject.getTopLeft) - { - gameObject.getTopLeft(this.position); - } - else - { - this.position.set(x, y); - } - this.prev.copy(this.position); - this.prevFrame.copy(this.position); +/***/ }), - this.rotation = gameObject.angle; - this.preRotation = gameObject.angle; +/***/ 30929: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.updateBounds(); - this.updateCenter(); - this.resetFlags(true); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets acceleration, velocity, and speed to zero. - * - * @method Phaser.Physics.Arcade.Body#stop - * @since 3.0.0 - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - stop: function () - { - this.velocity.set(0); - this.acceleration.set(0); - this.speed = 0; - this.angularVelocity = 0; - this.angularAcceleration = 0; +var Class = __webpack_require__(56694); +var Events = __webpack_require__(683); +var File = __webpack_require__(98035); +var GetFastValue = __webpack_require__(72632); +var GetURL = __webpack_require__(30750); +var IsPlainObject = __webpack_require__(42911); - return this; - }, +/** + * @classdesc + * A single Audio File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#audio method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audio. + * + * @class HTML5AudioFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.AudioFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [urlConfig] - The absolute or relative URL to load this file from. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var HTML5AudioFile = new Class({ - /** - * Copies the coordinates of this Body's edges into an object. - * - * @method Phaser.Physics.Arcade.Body#getBounds - * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Arcade.ArcadeBodyBounds} obj - An object to copy the values into. - * - * @return {Phaser.Types.Physics.Arcade.ArcadeBodyBounds} - An object with {x, y, right, bottom}. - */ - getBounds: function (obj) - { - obj.x = this.x; - obj.y = this.y; - obj.right = this.right; - obj.bottom = this.bottom; + Extends: File, - return obj; - }, + initialize: - /** - * Tests if the coordinates are within this Body. - * - * @method Phaser.Physics.Arcade.Body#hitTest - * @since 3.0.0 - * - * @param {number} x - The horizontal coordinate. - * @param {number} y - The vertical coordinate. - * - * @return {boolean} True if (x, y) is within this Body. - */ - hitTest: function (x, y) + function HTML5AudioFile (loader, key, urlConfig, audioConfig) { - if (!this.isCircle) + if (IsPlainObject(key)) { - return RectangleContains(this, x, y); + var config = key; + + key = GetFastValue(config, 'key'); + audioConfig = GetFastValue(config, 'config', audioConfig); } - // Check if x/y are within the bounds first - if (this.radius > 0 && x >= this.left && x <= this.right && y >= this.top && y <= this.bottom) - { - var dx = (this.center.x - x) * (this.center.x - x); - var dy = (this.center.y - y) * (this.center.y - y); + var fileConfig = { + type: 'audio', + cache: loader.cacheManager.audio, + extension: urlConfig.type, + key: key, + url: urlConfig.url, + config: audioConfig + }; - return (dx + dy) <= (this.radius * this.radius); - } + File.call(this, loader, fileConfig); - return false; + // New properties specific to this class + this.locked = 'ontouchstart' in window; + this.loaded = false; + this.filesLoaded = 0; + this.filesTotal = 0; }, /** - * Whether this Body is touching a tile or the world boundary while moving down. + * Called when the file finishes loading. * - * @method Phaser.Physics.Arcade.Body#onFloor + * @method Phaser.Loader.FileTypes.HTML5AudioFile#onLoad * @since 3.0.0 - * @see Phaser.Physics.Arcade.Body#blocked - * - * @return {boolean} True if touching. */ - onFloor: function () + onLoad: function () { - return this.blocked.down; - }, + if (this.loaded) + { + return; + } - /** - * Whether this Body is touching a tile or the world boundary while moving up. - * - * @method Phaser.Physics.Arcade.Body#onCeiling - * @since 3.0.0 - * @see Phaser.Physics.Arcade.Body#blocked - * - * @return {boolean} True if touching. - */ - onCeiling: function () - { - return this.blocked.up; - }, + this.loaded = true; - /** - * Whether this Body is touching a tile or the world boundary while moving left or right. - * - * @method Phaser.Physics.Arcade.Body#onWall - * @since 3.0.0 - * @see Phaser.Physics.Arcade.Body#blocked - * - * @return {boolean} True if touching. - */ - onWall: function () - { - return (this.blocked.left || this.blocked.right); + this.loader.nextFile(this, true); }, /** - * The absolute (non-negative) change in this Body's horizontal position from the previous step. + * Called if the file errors while loading. * - * @method Phaser.Physics.Arcade.Body#deltaAbsX + * @method Phaser.Loader.FileTypes.HTML5AudioFile#onError * @since 3.0.0 - * - * @return {number} The delta value. */ - deltaAbsX: function () + onError: function () { - return (this._dx > 0) ? this._dx : -this._dx; - }, + for (var i = 0; i < this.data.length; i++) + { + var audio = this.data[i]; - /** - * The absolute (non-negative) change in this Body's vertical position from the previous step. - * - * @method Phaser.Physics.Arcade.Body#deltaAbsY - * @since 3.0.0 - * - * @return {number} The delta value. - */ - deltaAbsY: function () - { - return (this._dy > 0) ? this._dy : -this._dy; - }, + audio.oncanplaythrough = null; + audio.onerror = null; + } - /** - * The change in this Body's horizontal position from the previous step. - * This value is set during the Body's update phase. - * - * As a Body can update multiple times per step this may not hold the final - * delta value for the Body. In this case, please see the `deltaXFinal` method. - * - * @method Phaser.Physics.Arcade.Body#deltaX - * @since 3.0.0 - * - * @return {number} The delta value. - */ - deltaX: function () - { - return this._dx; + this.loader.nextFile(this, false); }, /** - * The change in this Body's vertical position from the previous step. - * This value is set during the Body's update phase. - * - * As a Body can update multiple times per step this may not hold the final - * delta value for the Body. In this case, please see the `deltaYFinal` method. + * Called during the file load progress. Is sent a DOM ProgressEvent. * - * @method Phaser.Physics.Arcade.Body#deltaY + * @method Phaser.Loader.FileTypes.HTML5AudioFile#onProgress + * @fires Phaser.Loader.Events#FILE_PROGRESS * @since 3.0.0 - * - * @return {number} The delta value. */ - deltaY: function () + onProgress: function (event) { - return this._dy; - }, + var audio = event.target; - /** - * The change in this Body's horizontal position from the previous game update. - * - * This value is set during the `postUpdate` phase and takes into account the - * `deltaMax` and final position of the Body. - * - * Because this value is not calculated until `postUpdate`, you must listen for it - * during a Scene `POST_UPDATE` or `RENDER` event, and not in `update`, as it will - * not be calculated by that point. If you _do_ use these values in `update` they - * will represent the delta from the _previous_ game frame. - * - * @method Phaser.Physics.Arcade.Body#deltaXFinal - * @since 3.22.0 - * - * @return {number} The final delta x value. - */ - deltaXFinal: function () - { - return this._tx; - }, + audio.oncanplaythrough = null; + audio.onerror = null; - /** - * The change in this Body's vertical position from the previous game update. - * - * This value is set during the `postUpdate` phase and takes into account the - * `deltaMax` and final position of the Body. - * - * Because this value is not calculated until `postUpdate`, you must listen for it - * during a Scene `POST_UPDATE` or `RENDER` event, and not in `update`, as it will - * not be calculated by that point. If you _do_ use these values in `update` they - * will represent the delta from the _previous_ game frame. - * - * @method Phaser.Physics.Arcade.Body#deltaYFinal - * @since 3.22.0 - * - * @return {number} The final delta y value. - */ - deltaYFinal: function () - { - return this._ty; - }, + this.filesLoaded++; - /** - * The change in this Body's rotation from the previous step, in degrees. - * - * @method Phaser.Physics.Arcade.Body#deltaZ - * @since 3.0.0 - * - * @return {number} The delta value. - */ - deltaZ: function () - { - return this.rotation - this.preRotation; - }, + this.percentComplete = Math.min((this.filesLoaded / this.filesTotal), 1); - /** - * Disables this Body and marks it for deletion by the simulation. - * - * @method Phaser.Physics.Arcade.Body#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.enable = false; + this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete); - if (this.world) + if (this.filesLoaded === this.filesTotal) { - this.world.pendingDestroy.set(this); + this.onLoad(); } }, /** - * Draws this Body and its velocity, if enabled. + * Called by the Loader, starts the actual file downloading. + * During the load the methods onLoad, onError and onProgress are called, based on the XHR events. + * You shouldn't normally call this method directly, it's meant to be invoked by the Loader. * - * @method Phaser.Physics.Arcade.Body#drawDebug + * @method Phaser.Loader.FileTypes.HTML5AudioFile#load * @since 3.0.0 - * - * @param {Phaser.GameObjects.Graphics} graphic - The Graphics object to draw on. */ - drawDebug: function (graphic) + load: function () { - var pos = this.position; + this.data = []; - var x = pos.x + this.halfWidth; - var y = pos.y + this.halfHeight; + var instances = (this.config && this.config.instances) || 1; - if (this.debugShowBody) + this.filesTotal = instances; + this.filesLoaded = 0; + this.percentComplete = 0; + + for (var i = 0; i < instances; i++) { - graphic.lineStyle(graphic.defaultStrokeWidth, this.debugBodyColor); + var audio = new Audio(); - if (this.isCircle) + if (!audio.dataset) { - graphic.strokeCircle(x, y, this.width / 2); + audio.dataset = {}; } - else - { - // Only draw the sides where checkCollision is true, similar to debugger in layer - if (this.checkCollision.up) - { - graphic.lineBetween(pos.x, pos.y, pos.x + this.width, pos.y); - } - if (this.checkCollision.right) - { - graphic.lineBetween(pos.x + this.width, pos.y, pos.x + this.width, pos.y + this.height); - } + audio.dataset.name = this.key + ('0' + i).slice(-2); + audio.dataset.used = 'false'; - if (this.checkCollision.down) - { - graphic.lineBetween(pos.x, pos.y + this.height, pos.x + this.width, pos.y + this.height); - } + if (this.locked) + { + audio.dataset.locked = 'true'; + } + else + { + audio.dataset.locked = 'false'; - if (this.checkCollision.left) - { - graphic.lineBetween(pos.x, pos.y, pos.x, pos.y + this.height); - } + audio.preload = 'auto'; + audio.oncanplaythrough = this.onProgress.bind(this); + audio.onerror = this.onError.bind(this); } - } - if (this.debugShowVelocity) - { - graphic.lineStyle(graphic.defaultStrokeWidth, this.world.defaults.velocityDebugColor, 1); - graphic.lineBetween(x, y, x + this.velocity.x / 2, y + this.velocity.y / 2); + this.data.push(audio); } - }, - - /** - * Whether this Body will be drawn to the debug display. - * - * @method Phaser.Physics.Arcade.Body#willDrawDebug - * @since 3.0.0 - * - * @return {boolean} True if either `debugShowBody` or `debugShowVelocity` are enabled. - */ - willDrawDebug: function () - { - return (this.debugShowBody || this.debugShowVelocity); - }, - - /** - * Sets whether this Body collides with the world boundary. - * - * Optionally also sets the World Bounce and `onWorldBounds` values. - * - * @method Phaser.Physics.Arcade.Body#setCollideWorldBounds - * @since 3.0.0 - * - * @param {boolean} [value=true] - `true` if the Body should collide with the world bounds, otherwise `false`. - * @param {number} [bounceX] - If given this replaces the Body's `worldBounce.x` value. - * @param {number} [bounceY] - If given this replaces the Body's `worldBounce.y` value. - * @param {boolean} [onWorldBounds] - If given this replaces the Body's `onWorldBounds` value. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setCollideWorldBounds: function (value, bounceX, bounceY, onWorldBounds) - { - if (value === undefined) { value = true; } - this.collideWorldBounds = value; - - var setBounceX = (bounceX !== undefined); - var setBounceY = (bounceY !== undefined); - - if (setBounceX || setBounceY) + for (i = 0; i < this.data.length; i++) { - if (!this.worldBounce) - { - this.worldBounce = new Vector2(); - } - - if (setBounceX) - { - this.worldBounce.x = bounceX; - } + audio = this.data[i]; + audio.src = GetURL(this, this.loader.baseURL); - if (setBounceY) + if (!this.locked) { - this.worldBounce.y = bounceY; + audio.load(); } } - if (onWorldBounds !== undefined) + if (this.locked) { - this.onWorldBounds = onWorldBounds; + // This is super-dangerous but works. Race condition potential high. + // Is there another way? + setTimeout(this.onLoad.bind(this)); } + } - return this; - }, +}); - /** - * Sets the Body's velocity. - * - * @method Phaser.Physics.Arcade.Body#setVelocity - * @since 3.0.0 - * - * @param {number} x - The horizontal velocity, in pixels per second. - * @param {number} [y=x] - The vertical velocity, in pixels per second. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setVelocity: function (x, y) - { - this.velocity.set(x, y); +module.exports = HTML5AudioFile; - x = this.velocity.x; - y = this.velocity.y; - this.speed = Math.sqrt(x * x + y * y); +/***/ }), - return this; - }, +/***/ 77459: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Sets the Body's horizontal velocity. - * - * @method Phaser.Physics.Arcade.Body#setVelocityX - * @since 3.0.0 - * - * @param {number} value - The velocity, in pixels per second. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setVelocityX: function (value) - { - this.velocity.x = value; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var x = value; - var y = this.velocity.y; +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); - this.speed = Math.sqrt(x * x + y * y); +/** + * @classdesc + * A single HTML File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#html method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#html. + * + * @class HTMLFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.12.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.HTMLFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.html`, i.e. if `key` was "alien" then the URL will be "alien.html". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var HTMLFile = new Class({ - return this; - }, + Extends: File, - /** - * Sets the Body's vertical velocity. - * - * @method Phaser.Physics.Arcade.Body#setVelocityY - * @since 3.0.0 - * - * @param {number} value - The velocity, in pixels per second. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setVelocityY: function (value) + initialize: + + function HTMLFile (loader, key, url, xhrSettings) { - this.velocity.y = value; + var extension = 'html'; - var x = this.velocity.x; - var y = value; + if (IsPlainObject(key)) + { + var config = key; - this.speed = Math.sqrt(x * x + y * y); + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } - return this; + var fileConfig = { + type: 'text', + cache: loader.cacheManager.html, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; + + File.call(this, loader, fileConfig); }, /** - * Sets the Body's maximum velocity. - * - * @method Phaser.Physics.Arcade.Body#setMaxVelocity - * @since 3.10.0 - * - * @param {number} x - The horizontal velocity, in pixels per second. - * @param {number} [y=x] - The vertical velocity, in pixels per second. + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. * - * @return {Phaser.Physics.Arcade.Body} This Body object. + * @method Phaser.Loader.FileTypes.HTMLFile#onProcess + * @since 3.7.0 */ - setMaxVelocity: function (x, y) + onProcess: function () { - this.maxVelocity.set(x, y); - - return this; - }, - - /** - * Sets the Body's maximum horizontal velocity. - * - * @method Phaser.Physics.Arcade.Body#setMaxVelocityX - * @since 3.50.0 - * - * @param {number} value - The maximum horizontal velocity, in pixels per second. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setMaxVelocityX: function (value) - { - this.maxVelocity.x = value; + this.state = CONST.FILE_PROCESSING; - return this; - }, + this.data = this.xhrLoader.responseText; - /** - * Sets the Body's maximum vertical velocity. - * - * @method Phaser.Physics.Arcade.Body#setMaxVelocityY - * @since 3.50.0 - * - * @param {number} value - The maximum vertical velocity, in pixels per second. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setMaxVelocityY: function (value) - { - this.maxVelocity.y = value; + this.onProcessComplete(); + } - return this; - }, +}); - /** - * Sets the maximum speed the Body can move. - * - * @method Phaser.Physics.Arcade.Body#setMaxSpeed - * @since 3.16.0 - * - * @param {number} value - The maximum speed value, in pixels per second. Set to a negative value to disable. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setMaxSpeed: function (value) +/** + * Adds an HTML file, or array of HTML files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.html('story', 'files/LoginForm.html'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global HTML Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the HTML Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the HTML Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.html({ + * key: 'login', + * url: 'files/LoginForm.html' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.HTMLFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.html('login', 'files/LoginForm.html'); + * // and later in your game ... + * var data = this.cache.html.get('login'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and + * this is what you would use to retrieve the html from the HTML Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" + * and no URL is given then the Loader will set the URL to be "story.html". It will always add `.html` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the HTML File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#html + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.12.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.HTMLFileConfig|Phaser.Types.Loader.FileTypes.HTMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.html`, i.e. if `key` was "alien" then the URL will be "alien.html". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('html', function (key, url, xhrSettings) +{ + if (Array.isArray(key)) { - this.maxSpeed = value; - - return this; - }, - - /** - * Sets the Body's bounce. - * - * @method Phaser.Physics.Arcade.Body#setBounce - * @since 3.0.0 - * - * @param {number} x - The horizontal bounce, relative to 1. - * @param {number} y - The vertical bounce, relative to 1. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setBounce: function (x, y) + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new HTMLFile(this, key[i])); + } + } + else { - this.bounce.set(x, y); - - return this; - }, + this.addFile(new HTMLFile(this, key, url, xhrSettings)); + } - /** - * Sets the Body's horizontal bounce. - * - * @method Phaser.Physics.Arcade.Body#setBounceX - * @since 3.0.0 - * - * @param {number} value - The bounce, relative to 1. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setBounceX: function (value) - { - this.bounce.x = value; + return this; +}); - return this; - }, +module.exports = HTMLFile; - /** - * Sets the Body's vertical bounce. - * - * @method Phaser.Physics.Arcade.Body#setBounceY - * @since 3.0.0 - * - * @param {number} value - The bounce, relative to 1. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setBounceY: function (value) - { - this.bounce.y = value; - return this; - }, +/***/ }), - /** - * Sets the Body's acceleration. - * - * @method Phaser.Physics.Arcade.Body#setAcceleration - * @since 3.0.0 - * - * @param {number} x - The horizontal component, in pixels per second squared. - * @param {number} y - The vertical component, in pixels per second squared. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setAcceleration: function (x, y) - { - this.acceleration.set(x, y); +/***/ 9755: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets the Body's horizontal acceleration. - * - * @method Phaser.Physics.Arcade.Body#setAccelerationX - * @since 3.0.0 - * - * @param {number} value - The acceleration, in pixels per second squared. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setAccelerationX: function (value) - { - this.acceleration.x = value; +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); - return this; - }, +/** + * @classdesc + * A single HTML File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#htmlTexture method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#htmlTexture. + * + * @class HTMLTextureFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.12.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {number} [width] - The width of the texture the HTML will be rendered to. + * @param {number} [height] - The height of the texture the HTML will be rendered to. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var HTMLTextureFile = new Class({ - /** - * Sets the Body's vertical acceleration. - * - * @method Phaser.Physics.Arcade.Body#setAccelerationY - * @since 3.0.0 - * - * @param {number} value - The acceleration, in pixels per second squared. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setAccelerationY: function (value) - { - this.acceleration.y = value; + Extends: File, - return this; - }, + initialize: - /** - * Enables or disables drag. - * - * @method Phaser.Physics.Arcade.Body#setAllowDrag - * @since 3.9.0 - * @see Phaser.Physics.Arcade.Body#allowDrag - * - * @param {boolean} [value=true] - `true` to allow drag on this body, or `false` to disable it. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setAllowDrag: function (value) + function HTMLTextureFile (loader, key, url, width, height, xhrSettings) { - if (value === undefined) { value = true; } + if (width === undefined) { width = 512; } + if (height === undefined) { height = 512; } - this.allowDrag = value; + var extension = 'html'; - return this; - }, + if (IsPlainObject(key)) + { + var config = key; - /** - * Enables or disables gravity's effect on this Body. - * - * @method Phaser.Physics.Arcade.Body#setAllowGravity - * @since 3.9.0 - * @see Phaser.Physics.Arcade.Body#allowGravity - * - * @param {boolean} [value=true] - `true` to allow gravity on this body, or `false` to disable it. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setAllowGravity: function (value) - { - if (value === undefined) { value = true; } + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + width = GetFastValue(config, 'width', width); + height = GetFastValue(config, 'height', height); + } - this.allowGravity = value; + var fileConfig = { + type: 'html', + cache: loader.textureManager, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings, + config: { + width: width, + height: height + } + }; - return this; + File.call(this, loader, fileConfig); }, /** - * Enables or disables rotation. - * - * @method Phaser.Physics.Arcade.Body#setAllowRotation - * @since 3.9.0 - * @see Phaser.Physics.Arcade.Body#allowRotation - * - * @param {boolean} [value=true] - `true` to allow rotation on this body, or `false` to disable it. + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. * - * @return {Phaser.Physics.Arcade.Body} This Body object. + * @method Phaser.Loader.FileTypes.HTMLTextureFile#onProcess + * @since 3.7.0 */ - setAllowRotation: function (value) + onProcess: function () { - if (value === undefined) { value = true; } + this.state = CONST.FILE_PROCESSING; - this.allowRotation = value; + var w = this.config.width; + var h = this.config.height; - return this; - }, + var data = []; - /** - * Sets the Body's drag. - * - * @method Phaser.Physics.Arcade.Body#setDrag - * @since 3.0.0 - * - * @param {number} x - The horizontal component, in pixels per second squared. - * @param {number} y - The vertical component, in pixels per second squared. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setDrag: function (x, y) - { - this.drag.set(x, y); + data.push(''); + data.push(''); + data.push(''); + data.push(this.xhrLoader.responseText); + data.push(''); + data.push(''); + data.push(''); - return this; - }, + var svg = [ data.join('\n') ]; + var _this = this; - /** - * If this Body is using `drag` for deceleration this property controls how the drag is applied. - * If set to `true` drag will use a damping effect rather than a linear approach. If you are - * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in - * the game Asteroids) then you will get a far smoother and more visually correct deceleration - * by using damping, avoiding the axis-drift that is prone with linear deceleration. - * - * If you enable this property then you should use far smaller `drag` values than with linear, as - * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow - * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately. - * - * @method Phaser.Physics.Arcade.Body#setDamping - * @since 3.50.0 - * - * @param {boolean} value - `true` to use damping, or `false` to use drag. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setDamping: function (value) - { - this.useDamping = value; + try + { + var blob = new window.Blob(svg, { type: 'image/svg+xml;charset=utf-8' }); + } + catch (e) + { + _this.state = CONST.FILE_ERRORED; - return this; - }, + _this.onProcessComplete(); - /** - * Sets the Body's horizontal drag. - * - * @method Phaser.Physics.Arcade.Body#setDragX - * @since 3.0.0 - * - * @param {number} value - The drag, in pixels per second squared. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setDragX: function (value) - { - this.drag.x = value; + return; + } - return this; - }, + this.data = new Image(); - /** - * Sets the Body's vertical drag. - * - * @method Phaser.Physics.Arcade.Body#setDragY - * @since 3.0.0 - * - * @param {number} value - The drag, in pixels per second squared. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setDragY: function (value) - { - this.drag.y = value; + this.data.crossOrigin = this.crossOrigin; - return this; - }, + this.data.onload = function () + { + File.revokeObjectURL(_this.data); - /** - * Sets the Body's gravity. - * - * @method Phaser.Physics.Arcade.Body#setGravity - * @since 3.0.0 - * - * @param {number} x - The horizontal component, in pixels per second squared. - * @param {number} y - The vertical component, in pixels per second squared. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setGravity: function (x, y) - { - this.gravity.set(x, y); + _this.onProcessComplete(); + }; - return this; - }, + this.data.onerror = function () + { + File.revokeObjectURL(_this.data); - /** - * Sets the Body's horizontal gravity. - * - * @method Phaser.Physics.Arcade.Body#setGravityX - * @since 3.0.0 - * - * @param {number} value - The gravity, in pixels per second squared. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setGravityX: function (value) - { - this.gravity.x = value; + _this.onProcessError(); + }; - return this; + File.createObjectURL(this.data, blob, 'image/svg+xml'); }, /** - * Sets the Body's vertical gravity. - * - * @method Phaser.Physics.Arcade.Body#setGravityY - * @since 3.0.0 - * - * @param {number} value - The gravity, in pixels per second squared. + * Adds this file to its target cache upon successful loading and processing. * - * @return {Phaser.Physics.Arcade.Body} This Body object. + * @method Phaser.Loader.FileTypes.HTMLTextureFile#addToCache + * @since 3.7.0 */ - setGravityY: function (value) + addToCache: function () { - this.gravity.y = value; + this.cache.addImage(this.key, this.data); + } - return this; - }, +}); - /** - * Sets the Body's friction. - * - * @method Phaser.Physics.Arcade.Body#setFriction - * @since 3.0.0 - * - * @param {number} x - The horizontal component, relative to 1. - * @param {number} y - The vertical component, relative to 1. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setFriction: function (x, y) +/** + * Adds an HTML File, or array of HTML Files, to the current load queue. When the files are loaded they + * will be rendered to textures and stored in the Texture Manager. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.htmlTexture('instructions', 'content/intro.html', 256, 512); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.htmlTexture({ + * key: 'instructions', + * url: 'content/intro.html', + * width: 256, + * height: 512 + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig` for more details. + * + * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key: + * + * ```javascript + * this.load.htmlTexture('instructions', 'content/intro.html', 256, 512); + * // and later in your game ... + * this.add.image(x, y, 'instructions'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.html". It will always add `.html` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * The width and height are the size of the texture to which the HTML will be rendered. It's not possible to determine these + * automatically, so you will need to provide them, either as arguments or in the file config object. + * When the HTML file has loaded a new SVG element is created with a size and viewbox set to the width and height given. + * The SVG file has a body tag added to it, with the HTML file contents included. It then calls `window.Blob` on the SVG, + * and if successful is added to the Texture Manager, otherwise it fails processing. The overall quality of the rendered + * HTML depends on your browser, and some of them may not even support the svg / blob process used. Be aware that there are + * limitations on what HTML can be inside an SVG. You can find out more details in this + * [Mozilla MDN entry](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Drawing_DOM_objects_into_a_canvas). + * + * Note: The ability to load this type of file will only be available if the HTMLTextureFile File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#htmlTexture + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.12.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig|Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.html`, i.e. if `key` was "alien" then the URL will be "alien.html". + * @param {number} [width=512] - The width of the texture the HTML will be rendered to. + * @param {number} [height=512] - The height of the texture the HTML will be rendered to. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('htmlTexture', function (key, url, width, height, xhrSettings) +{ + if (Array.isArray(key)) { - this.friction.set(x, y); - - return this; - }, - - /** - * Sets the Body's horizontal friction. - * - * @method Phaser.Physics.Arcade.Body#setFrictionX - * @since 3.0.0 - * - * @param {number} value - The friction value, relative to 1. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setFrictionX: function (value) + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new HTMLTextureFile(this, key[i])); + } + } + else { - this.friction.x = value; - - return this; - }, + this.addFile(new HTMLTextureFile(this, key, url, width, height, xhrSettings)); + } - /** - * Sets the Body's vertical friction. - * - * @method Phaser.Physics.Arcade.Body#setFrictionY - * @since 3.0.0 - * - * @param {number} value - The friction value, relative to 1. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setFrictionY: function (value) - { - this.friction.y = value; + return this; +}); - return this; - }, +module.exports = HTMLTextureFile; - /** - * Sets the Body's angular velocity. - * - * @method Phaser.Physics.Arcade.Body#setAngularVelocity - * @since 3.0.0 - * - * @param {number} value - The velocity, in degrees per second. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setAngularVelocity: function (value) - { - this.angularVelocity = value; - return this; - }, +/***/ }), - /** - * Sets the Body's angular acceleration. - * - * @method Phaser.Physics.Arcade.Body#setAngularAcceleration - * @since 3.0.0 - * - * @param {number} value - The acceleration, in degrees per second squared. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setAngularAcceleration: function (value) - { - this.angularAcceleration = value; +/***/ 42927: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets the Body's angular drag. - * - * @method Phaser.Physics.Arcade.Body#setAngularDrag - * @since 3.0.0 - * - * @param {number} value - The drag, in degrees per second squared. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setAngularDrag: function (value) - { - this.angularDrag = value; +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); +var GetURL = __webpack_require__(30750); - return this; - }, +/** + * @classdesc + * A single Image File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#image method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#image. + * + * @class ImageFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Types.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. Only provided for, and used by, Sprite Sheets. + */ +var ImageFile = new Class({ - /** - * Sets the Body's mass. - * - * @method Phaser.Physics.Arcade.Body#setMass - * @since 3.0.0 - * - * @param {number} value - The mass value, relative to 1. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setMass: function (value) - { - this.mass = value; + Extends: File, - return this; - }, + initialize: - /** - * Sets the Body's `immovable` property. - * - * @method Phaser.Physics.Arcade.Body#setImmovable - * @since 3.0.0 - * - * @param {boolean} [value=true] - The value to assign to `immovable`. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setImmovable: function (value) + function ImageFile (loader, key, url, xhrSettings, frameConfig) { - if (value === undefined) { value = true; } - - this.immovable = value; - - return this; - }, + var extension = 'png'; + var normalMapURL; - /** - * Sets the Body's `enable` property. - * - * @method Phaser.Physics.Arcade.Body#setEnable - * @since 3.15.0 - * - * @param {boolean} [value=true] - The value to assign to `enable`. - * - * @return {Phaser.Physics.Arcade.Body} This Body object. - */ - setEnable: function (value) - { - if (value === undefined) { value = true; } + if (IsPlainObject(key)) + { + var config = key; - this.enable = value; + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + normalMapURL = GetFastValue(config, 'normalMap'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + frameConfig = GetFastValue(config, 'frameConfig'); + } - return this; - }, + if (Array.isArray(url)) + { + normalMapURL = url[1]; + url = url[0]; + } - /** - * This is an internal handler, called by the `ProcessX` function as part - * of the collision step. You should almost never call this directly. - * - * @method Phaser.Physics.Arcade.Body#processX - * @since 3.50.0 - * - * @param {number} x - The amount to add to the Body position. - * @param {number} [vx] - The amount to add to the Body velocity. - * @param {boolean} [left] - Set the blocked.left value? - * @param {boolean} [right] - Set the blocked.right value? - */ - processX: function (x, vx, left, right) - { - this.x += x; + var fileConfig = { + type: 'image', + cache: loader.textureManager, + extension: extension, + responseType: 'blob', + key: key, + url: url, + xhrSettings: xhrSettings, + config: frameConfig + }; - this.updateCenter(); + File.call(this, loader, fileConfig); - if (vx !== null) + // Do we have a normal map to load as well? + if (normalMapURL) { - this.velocity.x = vx; - } + var normalMap = new ImageFile(loader, this.key, normalMapURL, xhrSettings, frameConfig); - var blocked = this.blocked; + normalMap.type = 'normalMap'; - if (left) - { - blocked.left = true; + this.setLink(normalMap); + + loader.addFile(normalMap); } - if (right) + this.useImageElementLoad = loader.imageLoadType === 'HTMLImageElement'; + + if (this.useImageElementLoad) { - blocked.right = true; + this.load = this.loadImage; + this.onProcess = this.onProcessImage; } }, /** - * This is an internal handler, called by the `ProcessY` function as part - * of the collision step. You should almost never call this directly. - * - * @method Phaser.Physics.Arcade.Body#processY - * @since 3.50.0 + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. * - * @param {number} y - The amount to add to the Body position. - * @param {number} [vy] - The amount to add to the Body velocity. - * @param {boolean} [up] - Set the blocked.up value? - * @param {boolean} [down] - Set the blocked.down value? + * @method Phaser.Loader.FileTypes.ImageFile#onProcess + * @since 3.7.0 */ - processY: function (y, vy, up, down) + onProcess: function () { - this.y += y; - - this.updateCenter(); + this.state = CONST.FILE_PROCESSING; - if (vy !== null) - { - this.velocity.y = vy; - } + this.data = new Image(); - var blocked = this.blocked; + this.data.crossOrigin = this.crossOrigin; - if (up) - { - blocked.up = true; - } + var _this = this; - if (down) + this.data.onload = function () { - blocked.down = true; - } - }, + File.revokeObjectURL(_this.data); - /** - * The Bodys horizontal position (left edge). - * - * @name Phaser.Physics.Arcade.Body#x - * @type {number} - * @since 3.0.0 - */ - x: { + _this.onProcessComplete(); + }; - get: function () + this.data.onerror = function () { - return this.position.x; - }, + File.revokeObjectURL(_this.data); - set: function (value) - { - this.position.x = value; - } + _this.onProcessError(); + }; + File.createObjectURL(this.data, this.xhrLoader.response, 'image/png'); }, /** - * The Bodys vertical position (top edge). + * Handles image load processing. * - * @name Phaser.Physics.Arcade.Body#y - * @type {number} - * @since 3.0.0 + * @method Phaser.Loader.FileTypes.ImageFile#onProcessImage + * @private + * @since 3.60.0 */ - y: { + onProcessImage: function () + { + var result = this.state; - get: function () - { - return this.position.y; - }, + this.state = CONST.FILE_PROCESSING; - set: function (value) + if (result === CONST.FILE_LOADED) { - this.position.y = value; + this.onProcessComplete(); + } + else + { + this.onProcessError(); } - }, /** - * The left edge of the Body. Identical to x. + * Loads the image using either XHR or an Image tag. * - * @name Phaser.Physics.Arcade.Body#left - * @type {number} - * @readonly - * @since 3.0.0 + * @method Phaser.Loader.FileTypes.ImageFile#loadImage + * @private + * @since 3.60.0 */ - left: { + loadImage: function () + { + this.state = CONST.FILE_LOADING; - get: function () + this.src = GetURL(this, this.loader.baseURL); + + if (this.src.indexOf('data:') === 0) { - return this.position.x; + console.warn('Local data URIs are not supported: ' + this.key); } + else + { + this.data = new Image(); - }, + this.data.crossOrigin = this.crossOrigin; - /** - * The right edge of the Body. - * - * @name Phaser.Physics.Arcade.Body#right - * @type {number} - * @readonly - * @since 3.0.0 - */ - right: { + var _this = this; - get: function () - { - return this.position.x + this.width; - } + this.data.onload = function () + { + _this.state = CONST.FILE_LOADED; - }, + _this.loader.nextFile(_this, true); + }; - /** - * The top edge of the Body. Identical to y. - * - * @name Phaser.Physics.Arcade.Body#top - * @type {number} - * @readonly - * @since 3.0.0 - */ - top: { + this.data.onerror = function () + { + _this.loader.nextFile(_this, false); + }; - get: function () - { - return this.position.y; + this.data.src = this.src; } - }, /** - * The bottom edge of this Body. + * Adds this file to its target cache upon successful loading and processing. * - * @name Phaser.Physics.Arcade.Body#bottom - * @type {number} - * @readonly - * @since 3.0.0 + * @method Phaser.Loader.FileTypes.ImageFile#addToCache + * @since 3.7.0 */ - bottom: { + addToCache: function () + { + // Check if we have a linked normal map + var linkFile = this.linkFile; - get: function () + if (linkFile) { - return this.position.y + this.height; - } + // We do, but has it loaded? + if (linkFile.state >= CONST.FILE_COMPLETE) + { + // Both files have loaded + if (this.type === 'normalMap') + { + // linkFile.data = Image + // this.data = Normal Map + this.cache.addImage(this.key, linkFile.data, this.data); + } + else + { + // linkFile.data = Normal Map + // this.data = Image + this.cache.addImage(this.key, this.data, linkFile.data); + } + } + // Nothing to do here, we'll use the linkFile `addToCache` call + // to process this pair + } + else + { + this.cache.addImage(this.key, this.data); + } } }); -module.exports = Body; - - -/***/ }), -/* 528 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); - /** - * @classdesc - * An Arcade Physics Collider will automatically check for collision, or overlaps, between two objects - * every step. If a collision, or overlap, occurs it will invoke the given callbacks. + * Adds an Image, or array of Images, to the current load queue. * - * @class Collider - * @memberof Phaser.Physics.Arcade - * @constructor - * @since 3.0.0 + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: * - * @param {Phaser.Physics.Arcade.World} world - The Arcade physics World that will manage the collisions. - * @param {boolean} overlapOnly - Whether to check for collisions or overlap. - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object to check for collision. - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object2 - The second object to check for collision. - * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. - * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. - * @param {any} callbackContext - The scope in which to call the callbacks. - */ -var Collider = new Class({ - - initialize: - - function Collider (world, overlapOnly, object1, object2, collideCallback, processCallback, callbackContext) - { - /** - * The world in which the bodies will collide. - * - * @name Phaser.Physics.Arcade.Collider#world - * @type {Phaser.Physics.Arcade.World} - * @since 3.0.0 - */ - this.world = world; - - /** - * The name of the collider (unused by Phaser). - * - * @name Phaser.Physics.Arcade.Collider#name - * @type {string} - * @since 3.1.0 - */ - this.name = ''; - - /** - * Whether the collider is active. - * - * @name Phaser.Physics.Arcade.Collider#active - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.active = true; - - /** - * Whether to check for collisions or overlaps. - * - * @name Phaser.Physics.Arcade.Collider#overlapOnly - * @type {boolean} - * @since 3.0.0 - */ - this.overlapOnly = overlapOnly; - - /** - * The first object to check for collision. - * - * @name Phaser.Physics.Arcade.Collider#object1 - * @type {Phaser.Types.Physics.Arcade.ArcadeColliderType} - * @since 3.0.0 - */ - this.object1 = object1; - - /** - * The second object to check for collision. - * - * @name Phaser.Physics.Arcade.Collider#object2 - * @type {Phaser.Types.Physics.Arcade.ArcadeColliderType} - * @since 3.0.0 - */ - this.object2 = object2; - - /** - * The callback to invoke when the two objects collide. - * - * @name Phaser.Physics.Arcade.Collider#collideCallback - * @type {ArcadePhysicsCallback} - * @since 3.0.0 - */ - this.collideCallback = collideCallback; - - /** - * If a processCallback exists it must return true or collision checking will be skipped. - * - * @name Phaser.Physics.Arcade.Collider#processCallback - * @type {ArcadePhysicsCallback} - * @since 3.0.0 - */ - this.processCallback = processCallback; - - /** - * The context the collideCallback and processCallback will run in. - * - * @name Phaser.Physics.Arcade.Collider#callbackContext - * @type {object} - * @since 3.0.0 - */ - this.callbackContext = callbackContext; - }, - - /** - * A name for the Collider. - * - * Phaser does not use this value, it's for your own reference. - * - * @method Phaser.Physics.Arcade.Collider#setName - * @since 3.1.0 - * - * @param {string} name - The name to assign to the Collider. - * - * @return {Phaser.Physics.Arcade.Collider} This Collider instance. - */ - setName: function (name) - { - this.name = name; - - return this; - }, - - /** - * Called by World as part of its step processing, initial operation of collision checking. - * - * @method Phaser.Physics.Arcade.Collider#update - * @since 3.0.0 - */ - update: function () + * ```javascript + * function preload () + * { + * this.load.image('logo', 'images/phaserLogo.png'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. + * If you try to load an animated gif only the first frame will be rendered. Browsers do not natively support playback + * of animated gifs to Canvas elements. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.image({ + * key: 'logo', + * url: 'images/AtariLogo.png' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.ImageFileConfig` for more details. + * + * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key: + * + * ```javascript + * this.load.image('logo', 'images/AtariLogo.png'); + * // and later in your game ... + * this.add.image(x, y, 'logo'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, + * then you can specify it by providing an array as the `url` where the second element is the normal map: + * + * ```javascript + * this.load.image('logo', [ 'images/AtariLogo.png', 'images/AtariLogo-n.png' ]); + * ``` + * + * Or, if you are using a config object use the `normalMap` property: + * + * ```javascript + * this.load.image({ + * key: 'logo', + * url: 'images/AtariLogo.png', + * normalMap: 'images/AtariLogo-n.png' + * }); + * ``` + * + * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. + * Normal maps are a WebGL only feature. + * + * In Phaser 3.60 a new property was added that allows you to control how images are loaded. By default, images are loaded via XHR as Blobs. + * However, you can set `loader.imageLoadType: "HTMLImageElement"` in the Game Configuration and instead, the Loader will load all images + * via the Image tag instead. + * + * Note: The ability to load this type of file will only be available if the Image File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#image + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig|Phaser.Types.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('image', function (key, url, xhrSettings) +{ + if (Array.isArray(key)) { - this.world.collideObjects( - this.object1, - this.object2, - this.collideCallback, - this.processCallback, - this.callbackContext, - this.overlapOnly - ); - }, - - /** - * Removes Collider from World and disposes of its resources. - * - * @method Phaser.Physics.Arcade.Collider#destroy - * @since 3.0.0 - */ - destroy: function () + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new ImageFile(this, key[i])); + } + } + else { - this.world.removeCollider(this); - - this.active = false; - - this.world = null; - - this.object1 = null; - this.object2 = null; - - this.collideCallback = null; - this.processCallback = null; - this.callbackContext = null; + this.addFile(new ImageFile(this, key, url, xhrSettings)); } + return this; }); -module.exports = Collider; +module.exports = ImageFile; /***/ }), -/* 529 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 70806: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(26); -var Vector2 = __webpack_require__(3); - -var pointStart = new Vector2(); -var pointEnd = new Vector2(); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var GetValue = __webpack_require__(10850); +var IsPlainObject = __webpack_require__(42911); /** - * Gets the tiles in the given rectangular area (in world coordinates) of the layer. + * @classdesc + * A single JSON File suitable for loading by the Loader. * - * @function Phaser.Tilemaps.Components.GetTilesWithinWorldXY - * @since 3.0.0 + * These are created when you use the Phaser.Loader.LoaderPlugin#json method and are not typically created directly. * - * @param {number} worldX - The world x coordinate for the top-left of the area. - * @param {number} worldY - The world y coordinate for the top-left of the area. - * @param {number} width - The width of the area. - * @param {number} height - The height of the area. - * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#json. * - * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. + * @class JSONFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {(object|string)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, can be a fully formed JSON Object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. */ -var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer) -{ - var worldToTileXY = layer.tilemapLayer.tilemap._convert.WorldToTileXY; +var JSONFile = new Class({ - // Top left corner of the rect, rounded down to include partial tiles - worldToTileXY(worldX, worldY, true, pointStart, camera, layer); + Extends: File, - var xStart = pointStart.x; - var yStart = pointStart.y; + initialize: - // Bottom right corner of the rect, rounded up to include partial tiles - worldToTileXY(worldX + width, worldY + height, false, pointEnd, camera, layer); + // url can either be a string, in which case it is treated like a proper url, or an object, in which case it is treated as a ready-made JS Object + // dataKey allows you to pluck a specific object out of the JSON and put just that into the cache, rather than the whole thing - var xEnd = Math.ceil(pointEnd.x); - var yEnd = Math.ceil(pointEnd.y); + function JSONFile (loader, key, url, xhrSettings, dataKey) + { + var extension = 'json'; - return GetTilesWithin(xStart, yStart, xEnd - xStart, yEnd - yStart, filteringOptions, layer); -}; + if (IsPlainObject(key)) + { + var config = key; -module.exports = GetTilesWithinWorldXY; + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + dataKey = GetFastValue(config, 'dataKey', dataKey); + } + var fileConfig = { + type: 'json', + cache: loader.cacheManager.json, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings, + config: dataKey + }; -/***/ }), -/* 530 */ -/***/ (function(module, exports) { + File.call(this, loader, fileConfig); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // A JSON object has been provided (instead of a URL), so we'll use it directly as the File.data. No need to load it. + if (IsPlainObject(url)) + { + if (dataKey) + { + this.data = GetValue(url, dataKey); + } + else + { + this.data = url; + } + + this.state = CONST.FILE_POPULATED; + } + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.JSONFile#onProcess + * @since 3.7.0 + */ + onProcess: function () + { + if (this.state !== CONST.FILE_POPULATED) + { + this.state = CONST.FILE_PROCESSING; + + try + { + var json = JSON.parse(this.xhrLoader.responseText); + } + catch (e) + { + this.onProcessError(); + + throw e; + } + + var key = this.config; + + if (typeof key === 'string') + { + this.data = GetValue(json, key, json); + } + else + { + this.data = json; + } + } + + this.onProcessComplete(); + } + +}); /** - * A function to process the collision callbacks between a single tile and an Arcade Physics enabled Game Object. + * Adds a JSON file, or array of JSON files, to the current load queue. * - * @function Phaser.Physics.Arcade.Tilemap.ProcessTileCallbacks + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.json('wavedata', 'files/AlienWaveData.json'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global JSON Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the JSON Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the JSON Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.json({ + * key: 'wavedata', + * url: 'files/AlienWaveData.json' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.JSONFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.json('wavedata', 'files/AlienWaveData.json'); + * // and later in your game ... + * var data = this.cache.json.get('wavedata'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and + * this is what you would use to retrieve the text from the JSON Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" + * and no URL is given then the Loader will set the URL to be "data.json". It will always add `.json` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * You can also optionally provide a `dataKey` to use. This allows you to extract only a part of the JSON and store it in the Cache, + * rather than the whole file. For example, if your JSON data had a structure like this: + * + * ```json + * { + * "level1": { + * "baddies": { + * "aliens": {}, + * "boss": {} + * } + * }, + * "level2": {}, + * "level3": {} + * } + * ``` + * + * And you only wanted to store the `boss` data in the Cache, then you could pass `level1.baddies.boss`as the `dataKey`. + * + * Note: The ability to load this type of file will only be available if the JSON File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#json + * @fires Phaser.Loader.LoaderPlugin#ADD * @since 3.0.0 * - * @param {Phaser.Tilemaps.Tile} tile - The Tile to process. - * @param {Phaser.GameObjects.Sprite} sprite - The Game Object to process with the Tile. + * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {(object|string)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, can be a fully formed JSON Object. + * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. * - * @return {boolean} The result of the callback, `true` for further processing, or `false` to skip this pair. + * @return {this} The Loader instance. */ -var ProcessTileCallbacks = function (tile, sprite) +FileTypesManager.register('json', function (key, url, dataKey, xhrSettings) { - // Tile callbacks take priority over layer level callbacks - if (tile.collisionCallback) + if (Array.isArray(key)) { - return !tile.collisionCallback.call(tile.collisionCallbackContext, sprite, tile); + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new JSONFile(this, key[i])); + } } - else if (tile.layer.callbacks[tile.index]) + else { - return !tile.layer.callbacks[tile.index].callback.call( - tile.layer.callbacks[tile.index].callbackContext, sprite, tile - ); + this.addFile(new JSONFile(this, key, url, xhrSettings, dataKey)); } - return true; -}; + return this; +}); -module.exports = ProcessTileCallbacks; +module.exports = JSONFile; /***/ }), -/* 531 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 80802: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @author Vladimir Agafonkin * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var quickselect = __webpack_require__(436); +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var ImageFile = __webpack_require__(42927); +var IsPlainObject = __webpack_require__(42911); +var JSONFile = __webpack_require__(70806); +var MultiFile = __webpack_require__(45176); /** * @classdesc - * RBush is a high-performance JavaScript library for 2D spatial indexing of points and rectangles. - * It's based on an optimized R-tree data structure with bulk insertion support. + * A single Multi Texture Atlas File suitable for loading by the Loader. * - * Spatial index is a special data structure for points and rectangles that allows you to perform queries like - * "all items within this bounding box" very efficiently (e.g. hundreds of times faster than looping over all items). + * These are created when you use the Phaser.Loader.LoaderPlugin#multiatlas method and are not typically created directly. * - * This version of RBush uses a fixed min/max accessor structure of `[ '.left', '.top', '.right', '.bottom' ]`. - * This is to avoid the eval like function creation that the original library used, which caused CSP policy violations. - * - * rbush is forked from https://github.com/mourner/rbush by Vladimir Agafonkin + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#multiatlas. * - * @class RTree - * @memberof Phaser.Structs + * @class MultiAtlasFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes * @constructor - * @since 3.0.0 + * @since 3.7.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.MultiAtlasFileConfig)} key - The key of the file. Must be unique within both the Loader and the Texture Manager. Or a config object. + * @param {string} [atlasURL] - The absolute or relative URL to load the multi atlas json file from. + * @param {string} [path] - Optional path to use when loading the textures defined in the atlas data. + * @param {string} [baseURL] - Optional Base URL to use when loading the textures defined in the atlas data. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - Extra XHR Settings specifically for the atlas json file. + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture files. */ +var MultiAtlasFile = new Class({ -function rbush (maxEntries) -{ - var format = [ '.left', '.top', '.right', '.bottom' ]; - - if (!(this instanceof rbush)) return new rbush(maxEntries, format); - - // max entries in a node is 9 by default; min node fill is 40% for best performance - this._maxEntries = Math.max(4, maxEntries || 9); - this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)); - - this.clear(); -} - -rbush.prototype = { + Extends: MultiFile, - all: function () - { - return this._all(this.data, []); - }, + initialize: - search: function (bbox) + function MultiAtlasFile (loader, key, atlasURL, path, baseURL, atlasXhrSettings, textureXhrSettings) { - var node = this.data, - result = [], - toBBox = this.toBBox; + if (IsPlainObject(key)) + { + var config = key; - if (!intersects(bbox, node)) return result; + key = GetFastValue(config, 'key'); - var nodesToSearch = [], - i, len, child, childBBox; + if (GetFastValue(config, 'url', false)) + { + atlasURL = GetFastValue(config, 'url'); + } + else + { + atlasURL = GetFastValue(config, 'atlasURL'); + } - while (node) { - for (i = 0, len = node.children.length; i < len; i++) { + atlasXhrSettings = GetFastValue(config, 'xhrSettings'); + path = GetFastValue(config, 'path'); + baseURL = GetFastValue(config, 'baseURL'); + textureXhrSettings = GetFastValue(config, 'textureXhrSettings'); + } - child = node.children[i]; - childBBox = node.leaf ? toBBox(child) : child; + var data = new JSONFile(loader, key, atlasURL, atlasXhrSettings); - if (intersects(bbox, childBBox)) { - if (node.leaf) result.push(child); - else if (contains(bbox, childBBox)) this._all(child, result); - else nodesToSearch.push(child); - } - } - node = nodesToSearch.pop(); - } + MultiFile.call(this, loader, 'multiatlas', key, [ data ]); - return result; + this.config.path = path; + this.config.baseURL = baseURL; + this.config.textureXhrSettings = textureXhrSettings; }, - collides: function (bbox) + /** + * Called by each File when it finishes loading. + * + * @method Phaser.Loader.FileTypes.MultiAtlasFile#onFileComplete + * @since 3.7.0 + * + * @param {Phaser.Loader.File} file - The File that has completed processing. + */ + onFileComplete: function (file) { - var node = this.data, - toBBox = this.toBBox; + var index = this.files.indexOf(file); - if (!intersects(bbox, node)) return false; + if (index !== -1) + { + this.pending--; - var nodesToSearch = [], - i, len, child, childBBox; + if (file.type === 'json' && file.data.hasOwnProperty('textures')) + { + // Inspect the data for the files to now load + var textures = file.data.textures; - while (node) { - for (i = 0, len = node.children.length; i < len; i++) { + var config = this.config; + var loader = this.loader; - child = node.children[i]; - childBBox = node.leaf ? toBBox(child) : child; + var currentBaseURL = loader.baseURL; + var currentPath = loader.path; + var currentPrefix = loader.prefix; - if (intersects(bbox, childBBox)) { - if (node.leaf || contains(bbox, childBBox)) return true; - nodesToSearch.push(child); - } - } - node = nodesToSearch.pop(); - } + var baseURL = GetFastValue(config, 'baseURL', this.baseURL); + var path = GetFastValue(config, 'path', this.path); + var prefix = GetFastValue(config, 'prefix', this.prefix); + var textureXhrSettings = GetFastValue(config, 'textureXhrSettings'); - return false; - }, + loader.setBaseURL(baseURL); + loader.setPath(path); + loader.setPrefix(prefix); - load: function (data) - { - if (!(data && data.length)) return this; + for (var i = 0; i < textures.length; i++) + { + // "image": "texture-packer-multi-atlas-0.png", + var textureURL = textures[i].image; - if (data.length < this._minEntries) { - for (var i = 0, len = data.length; i < len; i++) { - this.insert(data[i]); - } - return this; - } + var key = 'MA' + this.multiKeyIndex + '_' + textureURL; - // recursively build the tree with the given data from scratch using OMT algorithm - var node = this._build(data.slice(), 0, data.length - 1, 0); + var image = new ImageFile(loader, key, textureURL, textureXhrSettings); - if (!this.data.children.length) { - // save as is if tree is empty - this.data = node; + this.addToMultiFile(image); - } else if (this.data.height === node.height) { - // split root if trees have the same height - this._splitRoot(this.data, node); + loader.addFile(image); - } else { - if (this.data.height < node.height) { - // swap trees if inserted one is bigger - var tmpNode = this.data; - this.data = node; - node = tmpNode; - } + // "normalMap": "texture-packer-multi-atlas-0_n.png", + if (textures[i].normalMap) + { + var normalMap = new ImageFile(loader, key, textures[i].normalMap, textureXhrSettings); - // insert the small tree into the large tree at appropriate level - this._insert(node, this.data.height - node.height - 1, true); - } + normalMap.type = 'normalMap'; - return this; - }, + image.setLink(normalMap); - insert: function (item) - { - if (item) this._insert(item, this.data.height - 1); - return this; - }, + this.addToMultiFile(normalMap); - clear: function () - { - this.data = createNode([]); - return this; + loader.addFile(normalMap); + } + } + + // Reset the loader settings + loader.setBaseURL(currentBaseURL); + loader.setPath(currentPath); + loader.setPrefix(currentPrefix); + } + } }, - remove: function (item, equalsFn) + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.MultiAtlasFile#addToCache + * @since 3.7.0 + */ + addToCache: function () { - if (!item) return this; - - var node = this.data, - bbox = this.toBBox(item), - path = [], - indexes = [], - i, parent, index, goingUp; - - // depth-first iterative tree traversal - while (node || path.length) { + if (this.isReadyToProcess()) + { + var fileJSON = this.files[0]; - if (!node) { // go up - node = path.pop(); - parent = path[path.length - 1]; - i = indexes.pop(); - goingUp = true; - } + var data = []; + var images = []; + var normalMaps = []; - if (node.leaf) { // check current node - index = findItem(item, node.children, equalsFn); + for (var i = 1; i < this.files.length; i++) + { + var file = this.files[i]; - if (index !== -1) { - // item found, remove the item and condense tree upwards - node.children.splice(index, 1); - path.push(node); - this._condense(path); - return this; + if (file.type === 'normalMap') + { + continue; } - } - if (!goingUp && !node.leaf && contains(node, bbox)) { // go down - path.push(node); - indexes.push(i); - i = 0; - parent = node; - node = node.children[0]; + var pos = file.key.indexOf('_'); + var key = file.key.substr(pos + 1); - } else if (parent) { // go right - i++; - node = parent.children[i]; - goingUp = false; + var image = file.data; - } else node = null; // nothing found - } + // Now we need to find out which json entry this mapped to + for (var t = 0; t < fileJSON.data.textures.length; t++) + { + var item = fileJSON.data.textures[t]; - return this; - }, + if (item.image === key) + { + images.push(image); - toBBox: function (item) { return item; }, + data.push(item); - compareMinX: compareNodeMinX, - compareMinY: compareNodeMinY, + if (file.linkFile) + { + normalMaps.push(file.linkFile.data); + } - toJSON: function () { return this.data; }, + break; + } + } + } - fromJSON: function (data) - { - this.data = data; - return this; - }, + if (normalMaps.length === 0) + { + normalMaps = undefined; + } - _all: function (node, result) - { - var nodesToSearch = []; - while (node) { - if (node.leaf) result.push.apply(result, node.children); - else nodesToSearch.push.apply(nodesToSearch, node.children); + this.loader.textureManager.addAtlasJSONArray(this.key, images, data, normalMaps); - node = nodesToSearch.pop(); + this.complete = true; } - return result; - }, + } - _build: function (items, left, right, height) - { - var N = right - left + 1, - M = this._maxEntries, - node; +}); - if (N <= M) { - // reached leaf level; return leaf - node = createNode(items.slice(left, right + 1)); - calcBBox(node, this.toBBox); - return node; - } +/** + * Adds a Multi Texture Atlas, or array of multi atlases, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.multiatlas('level1', 'images/Level1.json'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring + * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. + * + * Phaser expects the atlas data to be provided in a JSON file as exported from the application Texture Packer, + * version 4.6.3 or above, where you have made sure to use the Phaser 3 Export option. + * + * The way it works internally is that you provide a URL to the JSON file. Phaser then loads this JSON, parses it and + * extracts which texture files it also needs to load to complete the process. If the JSON also defines normal maps, + * Phaser will load those as well. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.multiatlas({ + * key: 'level1', + * atlasURL: 'images/Level1.json' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.MultiAtlasFileConfig` for more details. + * + * Instead of passing a URL for the atlas JSON data you can also pass in a well formed JSON object instead. + * + * Once the atlas has finished loading you can use frames from it as textures for a Game Object by referencing its key: + * + * ```javascript + * this.load.multiatlas('level1', 'images/Level1.json'); + * // and later in your game ... + * this.add.image(x, y, 'level1', 'background'); + * ``` + * + * To get a list of all available frames within an atlas please consult your Texture Atlas software. + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Multi Atlas File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#multiatlas + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.7.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.MultiAtlasFileConfig|Phaser.Types.Loader.FileTypes.MultiAtlasFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". + * @param {string} [path] - Optional path to use when loading the textures defined in the atlas data. + * @param {string} [baseURL] - Optional Base URL to use when loading the textures defined in the atlas data. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('multiatlas', function (key, atlasURL, path, baseURL, atlasXhrSettings) +{ + var multifile; - if (!height) { - // target height of the bulk-loaded tree - height = Math.ceil(Math.log(N) / Math.log(M)); + // Supports an Object file definition in the key argument + // Or an array of objects in the key argument + // Or a single entry where all arguments have been defined - // target number of root entries to maximize storage utilization - M = Math.ceil(N / Math.pow(M, height - 1)); - } + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + multifile = new MultiAtlasFile(this, key[i]); - node = createNode([]); - node.leaf = false; - node.height = height; + this.addFile(multifile.files); + } + } + else + { + multifile = new MultiAtlasFile(this, key, atlasURL, path, baseURL, atlasXhrSettings); - // split the items into M mostly square tiles + this.addFile(multifile.files); + } - var N2 = Math.ceil(N / M), - N1 = N2 * Math.ceil(Math.sqrt(M)), - i, j, right2, right3; + return this; +}); - multiSelect(items, left, right, N1, this.compareMinX); +module.exports = MultiAtlasFile; - for (i = left; i <= right; i += N1) { - right2 = Math.min(i + N1 - 1, right); +/***/ }), - multiSelect(items, i, right2, N2, this.compareMinY); +/***/ 39034: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - for (j = i; j <= right2; j += N2) { +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - right3 = Math.min(j + N2 - 1, right2); +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); +var MultiFile = __webpack_require__(45176); +var ScriptFile = __webpack_require__(55188); - // pack each entry recursively - node.children.push(this._build(items, j, right3, height - 1)); - } - } +/** + * @classdesc + * A Multi Script File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#scripts method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#scripts. + * + * @class MultiScriptFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.17.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.MultiScriptFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string[]} [url] - An array of absolute or relative URLs to load the script files from. They are processed in the order given in the array. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object for the script files. Used in replacement of the Loaders default XHR Settings. + */ +var MultiScriptFile = new Class({ - calcBBox(node, this.toBBox); + Extends: MultiFile, - return node; - }, + initialize: - _chooseSubtree: function (bbox, node, level, path) + function MultiScriptFile (loader, key, url, xhrSettings) { - var i, len, child, targetNode, area, enlargement, minArea, minEnlargement; - - while (true) { - path.push(node); + var extension = 'js'; + var files = []; - if (node.leaf || path.length - 1 === level) break; + if (IsPlainObject(key)) + { + var config = key; - minArea = minEnlargement = Infinity; + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } - for (i = 0, len = node.children.length; i < len; i++) { - child = node.children[i]; - area = bboxArea(child); - enlargement = enlargedArea(bbox, child) - area; + if (!Array.isArray(url)) + { + url = [ url ]; + } - // choose entry with the least area enlargement - if (enlargement < minEnlargement) { - minEnlargement = enlargement; - minArea = area < minArea ? area : minArea; - targetNode = child; + for (var i = 0; i < url.length; i++) + { + var scriptFile = new ScriptFile(loader, { + key: key + '_' + i.toString(), + url: url[i], + extension: extension, + xhrSettings: xhrSettings + }); - } else if (enlargement === minEnlargement) { - // otherwise choose one with the smallest area - if (area < minArea) { - minArea = area; - targetNode = child; - } - } - } + // Override the default onProcess function + scriptFile.onProcess = function () + { + this.onProcessComplete(); + }; - node = targetNode || node.children[0]; + files.push(scriptFile); } - return node; + MultiFile.call(this, loader, 'scripts', key, files); }, - _insert: function (item, level, isNode) + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.MultiScriptFile#addToCache + * @since 3.17.0 + */ + addToCache: function () { - var toBBox = this.toBBox, - bbox = isNode ? item : toBBox(item), - insertPath = []; + if (this.isReadyToProcess()) + { + for (var i = 0; i < this.files.length; i++) + { + var file = this.files[i]; - // find the best node for accommodating the item, saving all nodes along the path too - var node = this._chooseSubtree(bbox, this.data, level, insertPath); + file.data = document.createElement('script'); + file.data.language = 'javascript'; + file.data.type = 'text/javascript'; + file.data.defer = false; + file.data.text = file.xhrLoader.responseText; - // put the item into the node - node.children.push(item); - extend(node, bbox); + document.head.appendChild(file.data); + } - // split on node overflow; propagate upwards if necessary - while (level >= 0) { - if (insertPath[level].children.length > this._maxEntries) { - this._split(insertPath, level); - level--; - } else break; + this.complete = true; } + } - // adjust bboxes along the insertion path - this._adjustParentBBoxes(bbox, insertPath, level); - }, - - // split overflowed node into two - _split: function (insertPath, level) - { - var node = insertPath[level], - M = node.children.length, - m = this._minEntries; +}); - this._chooseSplitAxis(node, m, M); - - var splitIndex = this._chooseSplitIndex(node, m, M); - - var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex)); - newNode.height = node.height; - newNode.leaf = node.leaf; - - calcBBox(node, this.toBBox); - calcBBox(newNode, this.toBBox); +/** + * Adds an array of Script files to the current load queue. + * + * The difference between this and the `ScriptFile` file type is that you give an array of scripts to this method, + * and the scripts are then processed _exactly_ in that order. This allows you to load a bunch of scripts that + * may have dependencies on each other without worrying about the async nature of traditional script loading. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.scripts('PostProcess', [ + * 'libs/shaders/CopyShader.js', + * 'libs/postprocessing/EffectComposer.js', + * 'libs/postprocessing/RenderPass.js', + * 'libs/postprocessing/MaskPass.js', + * 'libs/postprocessing/ShaderPass.js', + * 'libs/postprocessing/AfterimagePass.js' + * ]); + * } + * ``` + * + * In the code above the script files will all be loaded in parallel but only processed (i.e. invoked) in the exact + * order given in the array. + * + * The files are **not** loaded right away. They are added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the files are queued + * it means you cannot use the files immediately after calling this method, but must wait for the files to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String and not already in-use by another file in the Loader. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.scripts({ + * key: 'PostProcess', + * url: [ + * 'libs/shaders/CopyShader.js', + * 'libs/postprocessing/EffectComposer.js', + * 'libs/postprocessing/RenderPass.js', + * 'libs/postprocessing/MaskPass.js', + * 'libs/postprocessing/ShaderPass.js', + * 'libs/postprocessing/AfterimagePass.js' + * ] + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.MultiScriptFileConfig` for more details. + * + * Once all the files have finished loading they will automatically be converted into a script element + * via `document.createElement('script')`. They will have their language set to JavaScript, `defer` set to + * false and then the resulting element will be appended to `document.head`. Any code then in the + * script will be executed. This is done in the exact order the files are specified in the url array. + * + * The URLs can be relative or absolute. If the URLs are relative the `Loader.baseURL` and `Loader.path` values will be prepended to them. + * + * Note: The ability to load this type of file will only be available if the MultiScript File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#scripts + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.17.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.MultiScriptFileConfig|Phaser.Types.Loader.FileTypes.MultiScriptFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string[]} [url] - An array of absolute or relative URLs to load the script files from. They are processed in the order given in the array. + * @param {string} [extension='js'] - The default file extension to use if no url is provided. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for these files. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('scripts', function (key, url, xhrSettings) +{ + var multifile; - if (level) insertPath[level - 1].children.push(newNode); - else this._splitRoot(node, newNode); - }, + // Supports an Object file definition in the key argument + // Or an array of objects in the key argument + // Or a single entry where all arguments have been defined - _splitRoot: function (node, newNode) + if (Array.isArray(key)) { - // split root node - this.data = createNode([node, newNode]); - this.data.height = node.height + 1; - this.data.leaf = false; - calcBBox(this.data, this.toBBox); - }, + for (var i = 0; i < key.length; i++) + { + multifile = new MultiScriptFile(this, key[i]); - _chooseSplitIndex: function (node, m, M) + this.addFile(multifile.files); + } + } + else { - var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index; + multifile = new MultiScriptFile(this, key, url, xhrSettings); - minOverlap = minArea = Infinity; + this.addFile(multifile.files); + } - for (i = m; i <= M - m; i++) { - bbox1 = distBBox(node, 0, i, this.toBBox); - bbox2 = distBBox(node, i, M, this.toBBox); + return this; +}); - overlap = intersectionArea(bbox1, bbox2); - area = bboxArea(bbox1) + bboxArea(bbox2); +module.exports = MultiScriptFile; - // choose distribution with minimum overlap - if (overlap < minOverlap) { - minOverlap = overlap; - index = i; - minArea = area < minArea ? area : minArea; +/***/ }), - } else if (overlap === minOverlap) { - // otherwise choose distribution with minimum area - if (area < minArea) { - minArea = area; - index = i; - } - } - } +/***/ 85527: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return index; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // sorts node children by the best axis for split - _chooseSplitAxis: function (node, m, M) - { - var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, - compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, - xMargin = this._allDistMargin(node, m, M, compareMinX), - yMargin = this._allDistMargin(node, m, M, compareMinY); +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); +var MultiFile = __webpack_require__(45176); +var ParseObj = __webpack_require__(27291); +var ParseObjMaterial = __webpack_require__(76799); +var TextFile = __webpack_require__(86897); - // if total distributions margin value is minimal for x, sort by minX, - // otherwise it's already sorted by minY - if (xMargin < yMargin) node.children.sort(compareMinX); - }, +/** + * @classdesc + * A single Wavefront OBJ File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#obj method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#obj. + * + * @class OBJFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.OBJFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [objURL] - The absolute or relative URL to load the obj file from. If undefined or `null` it will be set to `.obj`, i.e. if `key` was "alien" then the URL will be "alien.obj". + * @param {string} [matURL] - The absolute or relative URL to load the material file from. If undefined or `null` it will be set to `.mat`, i.e. if `key` was "alien" then the URL will be "alien.mat". + * @param {boolean} [flipUV] - Flip the UV coordinates stored in the model data? + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for these files. + */ +var OBJFile = new Class({ - // total margin of all possible split distributions where each node is at least m full - _allDistMargin: function (node, m, M, compare) - { - node.children.sort(compare); + Extends: MultiFile, - var toBBox = this.toBBox, - leftBBox = distBBox(node, 0, m, toBBox), - rightBBox = distBBox(node, M - m, M, toBBox), - margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), - i, child; + initialize: - for (i = m; i < M - m; i++) { - child = node.children[i]; - extend(leftBBox, node.leaf ? toBBox(child) : child); - margin += bboxMargin(leftBBox); - } + function OBJFile (loader, key, objURL, matURL, flipUV, xhrSettings) + { + var obj; + var mat; - for (i = M - m - 1; i >= m; i--) { - child = node.children[i]; - extend(rightBBox, node.leaf ? toBBox(child) : child); - margin += bboxMargin(rightBBox); - } + var cache = loader.cacheManager.obj; - return margin; - }, + if (IsPlainObject(key)) + { + var config = key; - _adjustParentBBoxes: function (bbox, path, level) - { - // adjust bboxes along the given tree path - for (var i = level; i >= 0; i--) { - extend(path[i], bbox); - } - }, + key = GetFastValue(config, 'key'); - _condense: function (path) - { - // go through the path, removing empty nodes and updating bboxes - for (var i = path.length - 1, siblings; i >= 0; i--) { - if (path[i].children.length === 0) { - if (i > 0) { - siblings = path[i - 1].children; - siblings.splice(siblings.indexOf(path[i]), 1); + obj = new TextFile(loader, { + key: key, + type: 'obj', + cache: cache, + url: GetFastValue(config, 'url'), + extension: GetFastValue(config, 'extension', 'obj'), + xhrSettings: GetFastValue(config, 'xhrSettings'), + config: { + flipUV: GetFastValue(config, 'flipUV', flipUV) + } + }); - } else this.clear(); + matURL = GetFastValue(config, 'matURL'); - } else calcBBox(path[i], this.toBBox); + if (matURL) + { + mat = new TextFile(loader, { + key: key, + type: 'mat', + cache: cache, + url: matURL, + extension: GetFastValue(config, 'matExtension', 'mat'), + xhrSettings: GetFastValue(config, 'xhrSettings') + }); + } } - }, + else + { + obj = new TextFile(loader, { + key: key, + url: objURL, + type: 'obj', + cache: cache, + extension: 'obj', + xhrSettings: xhrSettings, + config: { + flipUV: flipUV + } + }); - compareMinX: function (a, b) - { - return a.left - b.left; - }, + if (matURL) + { + mat = new TextFile(loader, { + key: key, + url: matURL, + type: 'mat', + cache: cache, + extension: 'mat', + xhrSettings: xhrSettings + }); + } + } - compareMinY: function (a, b) - { - return a.top - b.top; + MultiFile.call(this, loader, 'obj', key, [ obj, mat ]); }, - toBBox: function (a) + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.OBJFile#addToCache + * @since 3.50.0 + */ + addToCache: function () { - return { - minX: a.left, - minY: a.top, - maxX: a.right, - maxY: a.bottom - }; - } -}; - -function findItem (item, items, equalsFn) -{ - if (!equalsFn) return items.indexOf(item); + if (this.isReadyToProcess()) + { + var obj = this.files[0]; + var mat = this.files[1]; - for (var i = 0; i < items.length; i++) { - if (equalsFn(item, items[i])) return i; - } - return -1; -} + var objData = ParseObj(obj.data, obj.config.flipUV); -// calculate node's bbox from bboxes of its children -function calcBBox (node, toBBox) -{ - distBBox(node, 0, node.children.length, toBBox, node); -} + if (mat) + { + objData.materials = ParseObjMaterial(mat.data); + } -// min bounding rectangle of node children from k to p-1 -function distBBox (node, k, p, toBBox, destNode) -{ - if (!destNode) destNode = createNode(null); - destNode.minX = Infinity; - destNode.minY = Infinity; - destNode.maxX = -Infinity; - destNode.maxY = -Infinity; + obj.cache.add(obj.key, objData); - for (var i = k, child; i < p; i++) { - child = node.children[i]; - extend(destNode, node.leaf ? toBBox(child) : child); + this.complete = true; + } } - return destNode; -} - -function extend (a, b) -{ - a.minX = Math.min(a.minX, b.minX); - a.minY = Math.min(a.minY, b.minY); - a.maxX = Math.max(a.maxX, b.maxX); - a.maxY = Math.max(a.maxY, b.maxY); - return a; -} - -function compareNodeMinX (a, b) { return a.minX - b.minX; } -function compareNodeMinY (a, b) { return a.minY - b.minY; } - -function bboxArea (a) { return (a.maxX - a.minX) * (a.maxY - a.minY); } -function bboxMargin (a) { return (a.maxX - a.minX) + (a.maxY - a.minY); } - -function enlargedArea (a, b) -{ - return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) * - (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY)); -} - -function intersectionArea (a, b) -{ - var minX = Math.max(a.minX, b.minX), - minY = Math.max(a.minY, b.minY), - maxX = Math.min(a.maxX, b.maxX), - maxY = Math.min(a.maxY, b.maxY); - - return Math.max(0, maxX - minX) * - Math.max(0, maxY - minY); -} - -function contains (a, b) -{ - return a.minX <= b.minX && - a.minY <= b.minY && - b.maxX <= a.maxX && - b.maxY <= a.maxY; -} - -function intersects (a, b) -{ - return b.minX <= a.maxX && - b.minY <= a.maxY && - b.maxX >= a.minX && - b.maxY >= a.minY; -} +}); -function createNode (children) +/** + * Adds a Wavefront OBJ file, or array of OBJ files, to the current load queue. + * + * Note: You should ensure your 3D package has triangulated the OBJ file prior to export. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.obj('ufo', 'files/spaceship.obj'); + * } + * ``` + * + * You can optionally also load a Wavefront Material file as well, by providing the 3rd parameter: + * + * ```javascript + * function preload () + * { + * this.load.obj('ufo', 'files/spaceship.obj', 'files/spaceship.mtl'); + * } + * ``` + * + * If given, the material will be parsed and stored along with the obj data in the cache. + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global OBJ Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the OBJ Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the OBJ Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.obj({ + * key: 'ufo', + * url: 'files/spaceship.obj', + * matURL: 'files/spaceship.mtl', + * flipUV: true + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.OBJFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.obj('ufo', 'files/spaceship.obj'); + * // and later in your game ... + * var data = this.cache.obj.get('ufo'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and + * this is what you would use to retrieve the obj from the OBJ Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" + * and no URL is given then the Loader will set the URL to be "story.obj". It will always add `.obj` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the OBJ File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#obj + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.50.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.OBJFileConfig|Phaser.Types.Loader.FileTypes.OBJFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [objURL] - The absolute or relative URL to load the obj file from. If undefined or `null` it will be set to `.obj`, i.e. if `key` was "alien" then the URL will be "alien.obj". + * @param {string} [matURL] - Optional absolute or relative URL to load the obj material file from. + * @param {boolean} [flipUV] - Flip the UV coordinates stored in the model data? + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('obj', function (key, objURL, matURL, flipUVs, xhrSettings) { - return { - children: children, - height: 1, - leaf: true, - minX: Infinity, - minY: Infinity, - maxX: -Infinity, - maxY: -Infinity - }; -} - -// sort an array so that items come in groups of n unsorted items, with groups sorted between each other; -// combines selection algorithm with binary divide & conquer approach + var multifile; -function multiSelect (arr, left, right, n, compare) -{ - var stack = [left, right], - mid; + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + multifile = new OBJFile(this, key[i]); - while (stack.length) + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(multifile.files); + } + } + else { - right = stack.pop(); - left = stack.pop(); + multifile = new OBJFile(this, key, objURL, matURL, flipUVs, xhrSettings); - if (right - left <= n) continue; + this.addFile(multifile.files); + } - mid = left + Math.ceil((right - left) / n / 2) * n; - quickselect(arr, mid, left, right, compare); + return this; +}); - stack.push(left, mid, mid, right); - } -} +module.exports = OBJFile; -module.exports = rbush; /***/ }), -/* 532 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 3616: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TileCheckX = __webpack_require__(533); -var TileCheckY = __webpack_require__(535); -var TileIntersectsBody = __webpack_require__(248); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var FileTypesManager = __webpack_require__(76846); +var JSONFile = __webpack_require__(70806); /** - * The core separation function to separate a physics body and a tile. + * @classdesc + * A single JSON Pack File suitable for loading by the Loader. * - * @function Phaser.Physics.Arcade.Tilemap.SeparateTile - * @since 3.0.0 + * These are created when you use the Phaser.Loader.LoaderPlugin#pack method and are not typically created directly. * - * @param {number} i - The index of the tile within the map data. - * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. - * @param {Phaser.Tilemaps.Tile} tile - The tile to collide against. - * @param {Phaser.Geom.Rectangle} tileWorldRect - A rectangle-like object defining the dimensions of the tile. - * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The tilemapLayer to collide against. - * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. - * @param {boolean} isLayer - Is this check coming from a TilemapLayer or an array of tiles? + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#pack. * - * @return {boolean} `true` if the body was separated, otherwise `false`. + * @class PackFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.7.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.PackFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {(string|any)} [url] - The absolute or relative URL to load this file from or a ready formed JSON object. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. */ -var SeparateTile = function (i, body, tile, tileWorldRect, tilemapLayer, tileBias, isLayer) -{ - var tileLeft = tileWorldRect.left; - var tileTop = tileWorldRect.top; - var tileRight = tileWorldRect.right; - var tileBottom = tileWorldRect.bottom; - var faceHorizontal = tile.faceLeft || tile.faceRight; - var faceVertical = tile.faceTop || tile.faceBottom; +var PackFile = new Class({ - if (!isLayer) - { - faceHorizontal = true; - faceVertical = true; - } + Extends: JSONFile, - // We don't need to go any further if this tile doesn't actually have any colliding faces. This - // could happen if the tile was meant to be collided with re: a callback, but otherwise isn't - // needed for separation. - if (!faceHorizontal && !faceVertical) - { - return false; - } + initialize: - var ox = 0; - var oy = 0; - var minX = 0; - var minY = 1; + // url can either be a string, in which case it is treated like a proper url, or an object, in which case it is treated as a ready-made JS Object + // dataKey allows you to pluck a specific object out of the JSON and put just that into the cache, rather than the whole thing - if (body.deltaAbsX() > body.deltaAbsY()) - { - // Moving faster horizontally, check X axis first - minX = -1; - } - else if (body.deltaAbsX() < body.deltaAbsY()) + function PackFile (loader, key, url, xhrSettings, dataKey) { - // Moving faster vertically, check Y axis first - minY = -1; - } + JSONFile.call(this, loader, key, url, xhrSettings, dataKey); - if (body.deltaX() !== 0 && body.deltaY() !== 0 && faceHorizontal && faceVertical) - { - // We only need do this if both axes have colliding faces AND we're moving in both - // directions - minX = Math.min(Math.abs(body.position.x - tileRight), Math.abs(body.right - tileLeft)); - minY = Math.min(Math.abs(body.position.y - tileBottom), Math.abs(body.bottom - tileTop)); - } + this.type = 'packfile'; + }, - if (minX < minY) + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.PackFile#onProcess + * @since 3.7.0 + */ + onProcess: function () { - if (faceHorizontal) + if (this.state !== CONST.FILE_POPULATED) { - ox = TileCheckX(body, tile, tileLeft, tileRight, tileBias, isLayer); + this.state = CONST.FILE_PROCESSING; - // That's horizontal done, check if we still intersects? If not then we can return now - if (ox !== 0 && !TileIntersectsBody(tileWorldRect, body)) - { - return true; - } + this.data = JSON.parse(this.xhrLoader.responseText); } - if (faceVertical) + if (this.data.hasOwnProperty('files') && this.config) { - oy = TileCheckY(body, tile, tileTop, tileBottom, tileBias, isLayer); + var newData = {}; + + newData[this.config] = this.data; + + this.data = newData; } + + // Let's pass the pack file data over to the Loader ... + this.loader.addPack(this.data, this.config); + + this.onProcessComplete(); } - else - { - if (faceVertical) - { - oy = TileCheckY(body, tile, tileTop, tileBottom, tileBias, isLayer); - // That's vertical done, check if we still intersects? If not then we can return now - if (oy !== 0 && !TileIntersectsBody(tileWorldRect, body)) - { - return true; - } - } +}); - if (faceHorizontal) +/** + * Adds a JSON File Pack, or array of packs, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.pack('level1', 'data/Level1Files.json'); + * } + * ``` + * + * A File Pack is a JSON file (or object) that contains details about other files that should be added into the Loader. + * Here is a small example: + * + * ```json + * { + * "test1": { + * "files": [ + * { + * "type": "image", + * "key": "taikodrummaster", + * "url": "assets/pics/taikodrummaster.jpg" + * }, + * { + * "type": "image", + * "key": "sukasuka-chtholly", + * "url": "assets/pics/sukasuka-chtholly.png" + * } + * ] + * }, + * "meta": { + * "generated": "1401380327373", + * "app": "Phaser 3 Asset Packer", + * "url": "https://phaser.io", + * "version": "1.0", + * "copyright": "Photon Storm Ltd. 2018" + * } + * } + * ``` + * + * The pack can be split into sections. In the example above you'll see a section called `test1. You can tell + * the `load.pack` method to parse only a particular section of a pack. The pack is stored in the JSON Cache, + * so you can pass it to the Loader to process additional sections as needed in your game, or you can just load + * them all at once without specifying anything. + * + * The pack file can contain an entry for any type of file that Phaser can load. The object structures exactly + * match that of the file type configs, and all properties available within the file type configs can be used + * in the pack file too. + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring + * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. + * + * The key must be a unique String. It is used to add the file to the global JSON Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the JSON Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the JSON Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.pack({ + * key: 'level1', + * url: 'data/Level1Files.json' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.PackFileConfig` for more details. + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and + * this is what you would use to retrieve the text from the JSON Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" + * and no URL is given then the Loader will set the URL to be "data.json". It will always add `.json` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * You can also optionally provide a `dataKey` to use. This allows you to extract only a part of the JSON and store it in the Cache, + * rather than the whole file. For example, if your JSON data had a structure like this: + * + * ```json + * { + * "level1": { + * "baddies": { + * "aliens": {}, + * "boss": {} + * } + * }, + * "level2": {}, + * "level3": {} + * } + * ``` + * + * And you only wanted to store the `boss` data in the Cache, then you could pass `level1.baddies.boss`as the `dataKey`. + * + * Note: The ability to load this type of file will only be available if the Pack File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#pack + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.7.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.PackFileConfig|Phaser.Types.Loader.FileTypes.PackFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". + * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('pack', function (key, url, dataKey, xhrSettings) +{ + // Supports an Object file definition in the key argument + // Or an array of objects in the key argument + // Or a single entry where all arguments have been defined + + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) { - ox = TileCheckX(body, tile, tileLeft, tileRight, tileBias, isLayer); + this.addFile(new PackFile(this, key[i])); } } + else + { + this.addFile(new PackFile(this, key, url, xhrSettings, dataKey)); + } - return (ox !== 0 || oy !== 0); -}; + return this; +}); -module.exports = SeparateTile; +module.exports = PackFile; /***/ }), -/* 533 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 12217: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ProcessTileSeparationX = __webpack_require__(534); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); /** - * Check the body against the given tile on the X axis. - * Used internally by the SeparateTile function. + * @classdesc + * A single Plugin Script File suitable for loading by the Loader. * - * @function Phaser.Physics.Arcade.Tilemap.TileCheckX - * @since 3.0.0 + * These are created when you use the Phaser.Loader.LoaderPlugin#plugin method and are not typically created directly. * - * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. - * @param {Phaser.Tilemaps.Tile} tile - The tile to check. - * @param {number} tileLeft - The left position of the tile within the tile world. - * @param {number} tileRight - The right position of the tile within the tile world. - * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. - * @param {boolean} isLayer - Is this check coming from a TilemapLayer or an array of tiles? + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#plugin. * - * @return {number} The amount of separation that occurred. + * @class PluginFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.PluginFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {boolean} [start=false] - Automatically start the plugin after loading? + * @param {string} [mapping] - If this plugin is to be injected into the Scene, this is the property key used. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ -var TileCheckX = function (body, tile, tileLeft, tileRight, tileBias, isLayer) -{ - var ox = 0; +var PluginFile = new Class({ - var faceLeft = tile.faceLeft; - var faceRight = tile.faceRight; - var collideLeft = tile.collideLeft; - var collideRight = tile.collideRight; + Extends: File, - if (!isLayer) - { - faceLeft = true; - faceRight = true; - collideLeft = true; - collideRight = true; - } + initialize: - if (body.deltaX() < 0 && collideRight && body.checkCollision.left) + function PluginFile (loader, key, url, start, mapping, xhrSettings) { - // Body is moving LEFT - if (faceRight && body.x < tileRight) + var extension = 'js'; + + if (IsPlainObject(key)) { - ox = body.x - tileRight; + var config = key; - if (ox < -tileBias) - { - ox = 0; - } + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + start = GetFastValue(config, 'start'); + mapping = GetFastValue(config, 'mapping'); } - } - else if (body.deltaX() > 0 && collideLeft && body.checkCollision.right) - { - // Body is moving RIGHT - if (faceLeft && body.right > tileLeft) - { - ox = body.right - tileLeft; - if (ox > tileBias) - { - ox = 0; + var fileConfig = { + type: 'plugin', + cache: false, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings, + config: { + start: start, + mapping: mapping } + }; + + File.call(this, loader, fileConfig); + + // If the url variable refers to a class, add the plugin directly + if (typeof url === 'function') + { + this.data = url; + + this.state = CONST.FILE_POPULATED; } - } + }, - if (ox !== 0) + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.PluginFile#onProcess + * @since 3.7.0 + */ + onProcess: function () { - if (body.customSeparateX) + var pluginManager = this.loader.systems.plugins; + var config = this.config; + + var start = GetFastValue(config, 'start', false); + var mapping = GetFastValue(config, 'mapping', null); + + if (this.state === CONST.FILE_POPULATED) { - body.overlapX = ox; + pluginManager.install(this.key, this.data, start, mapping); } else { - ProcessTileSeparationX(body, ox); - } - } + // Plugin added via a js file + this.state = CONST.FILE_PROCESSING; - return ox; -}; + this.data = document.createElement('script'); + this.data.language = 'javascript'; + this.data.type = 'text/javascript'; + this.data.defer = false; + this.data.text = this.xhrLoader.responseText; -module.exports = TileCheckX; + document.head.appendChild(this.data); + var plugin = pluginManager.install(this.key, window[this.key], start, mapping); -/***/ }), -/* 534 */ -/***/ (function(module, exports) { + if (start || mapping) + { + // Install into the current Scene Systems and Scene + this.loader.systems[mapping] = plugin; + this.loader.scene[mapping] = plugin; + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.onProcessComplete(); + } + +}); /** - * Internal function to process the separation of a physics body from a tile. + * Adds a Plugin Script file, or array of plugin files, to the current load queue. * - * @function Phaser.Physics.Arcade.Tilemap.ProcessTileSeparationX + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.plugin('modplayer', 'plugins/ModPlayer.js'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String and not already in-use by another file in the Loader. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.plugin({ + * key: 'modplayer', + * url: 'plugins/ModPlayer.js' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.PluginFileConfig` for more details. + * + * Once the file has finished loading it will automatically be converted into a script element + * via `document.createElement('script')`. It will have its language set to JavaScript, `defer` set to + * false and then the resulting element will be appended to `document.head`. Any code then in the + * script will be executed. It will then be passed to the Phaser PluginCache.register method. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.js". It will always add `.js` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Plugin File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#plugin + * @fires Phaser.Loader.LoaderPlugin#ADD * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. - * @param {number} x - The x separation amount. + * @param {(string|Phaser.Types.Loader.FileTypes.PluginFileConfig|Phaser.Types.Loader.FileTypes.PluginFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {(string|function)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". Or, a plugin function. + * @param {boolean} [start] - Automatically start the plugin after loading? + * @param {string} [mapping] - If this plugin is to be injected into the Scene, this is the property key used. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. */ -var ProcessTileSeparationX = function (body, x) +FileTypesManager.register('plugin', function (key, url, start, mapping, xhrSettings) { - if (x < 0) - { - body.blocked.none = false; - body.blocked.left = true; - } - else if (x > 0) - { - body.blocked.none = false; - body.blocked.right = true; - } - - body.position.x -= x; - - if (body.bounce.x === 0) + if (Array.isArray(key)) { - body.velocity.x = 0; + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new PluginFile(this, key[i])); + } } else { - body.velocity.x = -body.velocity.x * body.bounce.x; + this.addFile(new PluginFile(this, key, url, start, mapping, xhrSettings)); } -}; -module.exports = ProcessTileSeparationX; + return this; +}); + +module.exports = PluginFile; /***/ }), -/* 535 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 4474: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ProcessTileSeparationY = __webpack_require__(536); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); /** - * Check the body against the given tile on the Y axis. - * Used internally by the SeparateTile function. + * @classdesc + * A single SVG File suitable for loading by the Loader. * - * @function Phaser.Physics.Arcade.Tilemap.TileCheckY - * @since 3.0.0 + * These are created when you use the Phaser.Loader.LoaderPlugin#svg method and are not typically created directly. * - * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. - * @param {Phaser.Tilemaps.Tile} tile - The tile to check. - * @param {number} tileTop - The top position of the tile within the tile world. - * @param {number} tileBottom - The bottom position of the tile within the tile world. - * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. - * @param {boolean} isLayer - Is this check coming from a TilemapLayer or an array of tiles? + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#svg. * - * @return {number} The amount of separation that occurred. - */ -var TileCheckY = function (body, tile, tileTop, tileBottom, tileBias, isLayer) -{ - var oy = 0; + * @class SVGFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.SVGFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.svg`, i.e. if `key` was "alien" then the URL will be "alien.svg". + * @param {Phaser.Types.Loader.FileTypes.SVGSizeConfig} [svgConfig] - The svg size configuration object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var SVGFile = new Class({ - var faceTop = tile.faceTop; - var faceBottom = tile.faceBottom; - var collideUp = tile.collideUp; - var collideDown = tile.collideDown; + Extends: File, - if (!isLayer) + initialize: + + function SVGFile (loader, key, url, svgConfig, xhrSettings) { - faceTop = true; - faceBottom = true; - collideUp = true; - collideDown = true; - } + var extension = 'svg'; - if (body.deltaY() < 0 && collideDown && body.checkCollision.up) + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + svgConfig = GetFastValue(config, 'svgConfig', {}); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } + + var fileConfig = { + type: 'svg', + cache: loader.textureManager, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings, + config: { + width: GetFastValue(svgConfig, 'width'), + height: GetFastValue(svgConfig, 'height'), + scale: GetFastValue(svgConfig, 'scale') + } + }; + + File.call(this, loader, fileConfig); + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.SVGFile#onProcess + * @since 3.7.0 + */ + onProcess: function () { - // Body is moving UP - if (faceBottom && body.y < tileBottom) + this.state = CONST.FILE_PROCESSING; + + var text = this.xhrLoader.responseText; + var svg = [ text ]; + var width = this.config.width; + var height = this.config.height; + var scale = this.config.scale; + + resize: if (width && height || scale) { - oy = body.y - tileBottom; + var xml = null; + var parser = new DOMParser(); + xml = parser.parseFromString(text, 'text/xml'); + var svgXML = xml.getElementsByTagName('svg')[0]; - if (oy < -tileBias) + var hasViewBox = svgXML.hasAttribute('viewBox'); + var svgWidth = parseFloat(svgXML.getAttribute('width')); + var svgHeight = parseFloat(svgXML.getAttribute('height')); + + if (!hasViewBox && svgWidth && svgHeight) { - oy = 0; + // If there's no viewBox attribute, set one + svgXML.setAttribute('viewBox', '0 0 ' + svgWidth + ' ' + svgHeight); + } + else if (hasViewBox && !svgWidth && !svgHeight) + { + // Get the w/h from the viewbox + var viewBox = svgXML.getAttribute('viewBox').split(/\s+|,/); + + svgWidth = viewBox[2]; + svgHeight = viewBox[3]; + } + + if (scale) + { + if (svgWidth && svgHeight) + { + width = svgWidth * scale; + height = svgHeight * scale; + } + else + { + break resize; + } } + + svgXML.setAttribute('width', width.toString() + 'px'); + svgXML.setAttribute('height', height.toString() + 'px'); + + svg = [ (new XMLSerializer()).serializeToString(svgXML) ]; } - } - else if (body.deltaY() > 0 && collideUp && body.checkCollision.down) - { - // Body is moving DOWN - if (faceTop && body.bottom > tileTop) + + try { - oy = body.bottom - tileTop; + var blob = new window.Blob(svg, { type: 'image/svg+xml;charset=utf-8' }); + } + catch (e) + { + this.onProcessError(); - if (oy > tileBias) + return; + } + + this.data = new Image(); + + this.data.crossOrigin = this.crossOrigin; + + var _this = this; + var retry = false; + + this.data.onload = function () + { + if (!retry) { - oy = 0; + File.revokeObjectURL(_this.data); } - } + + _this.onProcessComplete(); + }; + + this.data.onerror = function () + { + // Safari 8 re-try + if (!retry) + { + retry = true; + + File.revokeObjectURL(_this.data); + + _this.data.src = 'data:image/svg+xml,' + encodeURIComponent(svg.join('')); + } + else + { + _this.onProcessError(); + } + }; + + File.createObjectURL(this.data, blob, 'image/svg+xml'); + }, + + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.SVGFile#addToCache + * @since 3.7.0 + */ + addToCache: function () + { + this.cache.addImage(this.key, this.data); } - if (oy !== 0) +}); + +/** + * Adds an SVG File, or array of SVG Files, to the current load queue. When the files are loaded they + * will be rendered to bitmap textures and stored in the Texture Manager. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.svg('morty', 'images/Morty.svg'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.svg({ + * key: 'morty', + * url: 'images/Morty.svg' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.SVGFileConfig` for more details. + * + * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key: + * + * ```javascript + * this.load.svg('morty', 'images/Morty.svg'); + * // and later in your game ... + * this.add.image(x, y, 'morty'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.html". It will always add `.html` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * You can optionally pass an SVG Resize Configuration object when you load an SVG file. By default the SVG will be rendered to a texture + * at the same size defined in the SVG file attributes. However, this isn't always desirable. You may wish to resize the SVG (either down + * or up) to improve texture clarity, or reduce texture memory consumption. You can either specify an exact width and height to resize + * the SVG to: + * + * ```javascript + * function preload () + * { + * this.load.svg('morty', 'images/Morty.svg', { width: 300, height: 600 }); + * } + * ``` + * + * Or when using a configuration object: + * + * ```javascript + * this.load.svg({ + * key: 'morty', + * url: 'images/Morty.svg', + * svgConfig: { + * width: 300, + * height: 600 + * } + * }); + * ``` + * + * Alternatively, you can just provide a scale factor instead: + * + * ```javascript + * function preload () + * { + * this.load.svg('morty', 'images/Morty.svg', { scale: 2.5 }); + * } + * ``` + * + * Or when using a configuration object: + * + * ```javascript + * this.load.svg({ + * key: 'morty', + * url: 'images/Morty.svg', + * svgConfig: { + * scale: 2.5 + * } + * }); + * ``` + * + * If scale, width and height values are all given, the scale has priority and the width and height values are ignored. + * + * Note: The ability to load this type of file will only be available if the SVG File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#svg + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.SVGFileConfig|Phaser.Types.Loader.FileTypes.SVGFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.svg`, i.e. if `key` was "alien" then the URL will be "alien.svg". + * @param {Phaser.Types.Loader.FileTypes.SVGSizeConfig} [svgConfig] - The svg size configuration object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('svg', function (key, url, svgConfig, xhrSettings) +{ + if (Array.isArray(key)) { - if (body.customSeparateY) - { - body.overlapY = oy; - } - else + for (var i = 0; i < key.length; i++) { - ProcessTileSeparationY(body, oy); + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new SVGFile(this, key[i])); } } + else + { + this.addFile(new SVGFile(this, key, url, svgConfig, xhrSettings)); + } - return oy; -}; + return this; +}); + +module.exports = SVGFile; -module.exports = TileCheckY; /***/ }), -/* 536 */ -/***/ (function(module, exports) { + +/***/ 95171: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); + /** - * Internal function to process the separation of a physics body from a tile. + * @classdesc + * An external Scene JavaScript File suitable for loading by the Loader. * - * @function Phaser.Physics.Arcade.Tilemap.ProcessTileSeparationY - * @since 3.0.0 + * These are created when you use the Phaser.Loader.LoaderPlugin#sceneFile method and are not typically created directly. * - * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. - * @param {number} y - The y separation amount. + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#sceneFile. + * + * @class SceneFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.16.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.SceneFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ -var ProcessTileSeparationY = function (body, y) -{ - if (y < 0) +var SceneFile = new Class({ + + Extends: File, + + initialize: + + function SceneFile (loader, key, url, xhrSettings) { - body.blocked.none = false; - body.blocked.up = true; - } - else if (y > 0) + var extension = 'js'; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } + + var fileConfig = { + type: 'text', + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; + + File.call(this, loader, fileConfig); + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.SceneFile#onProcess + * @since 3.16.0 + */ + onProcess: function () { - body.blocked.none = false; - body.blocked.down = true; + this.state = CONST.FILE_PROCESSING; + + this.data = this.xhrLoader.responseText; + + this.onProcessComplete(); + }, + + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.SceneFile#addToCache + * @since 3.16.0 + */ + addToCache: function () + { + var code = this.data.concat('(function(){\n' + 'return new ' + this.key + '();\n' + '}).call(this);'); + + // Stops rollup from freaking out during build + var eval2 = eval; + + this.loader.sceneManager.add(this.key, eval2(code)); + + this.complete = true; } - body.position.y -= y; +}); - if (body.bounce.y === 0) +/** + * Adds an external Scene file, or array of Scene files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.sceneFile('Level1', 'src/Level1.js'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Scene Manager upon a successful load. + * + * For a Scene File it's vitally important that the key matches the class name in the JavaScript file. + * + * For example here is the source file: + * + * ```javascript + * class ExternalScene extends Phaser.Scene { + * + * constructor () + * { + * super('myScene'); + * } + * + * } + * ``` + * + * Because the class is called `ExternalScene` that is the exact same key you must use when loading it: + * + * ```javascript + * function preload () + * { + * this.load.sceneFile('ExternalScene', 'src/yourScene.js'); + * } + * ``` + * + * The key that is used within the Scene Manager can either be set to the same, or you can override it in the Scene + * constructor, as we've done in the example above, where the Scene key was changed to `myScene`. + * + * The key should be unique both in terms of files being loaded and Scenes already present in the Scene Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Scene Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.sceneFile({ + * key: 'Level1', + * url: 'src/Level1.js' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.SceneFileConfig` for more details. + * + * Once the file has finished loading it will be added to the Scene Manager. + * + * ```javascript + * this.load.sceneFile('Level1', 'src/Level1.js'); + * // and later in your game ... + * this.scene.start('Level1'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `WORLD1.` and the key was `Story` the final key will be `WORLD1.Story` and + * this is what you would use to retrieve the text from the Scene Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" + * and no URL is given then the Loader will set the URL to be "story.js". It will always add `.js` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Scene File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#sceneFile + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.16.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.SceneFileConfig|Phaser.Types.Loader.FileTypes.SceneFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('sceneFile', function (key, url, xhrSettings) +{ + if (Array.isArray(key)) { - body.velocity.y = 0; + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new SceneFile(this, key[i])); + } } else { - body.velocity.y = -body.velocity.y * body.bounce.y; + this.addFile(new SceneFile(this, key, url, xhrSettings)); } -}; -module.exports = ProcessTileSeparationY; + return this; +}); + +module.exports = SceneFile; /***/ }), -/* 537 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 82458: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetOverlapX = __webpack_require__(246); -var ProcessX = __webpack_require__(1389); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); /** - * Separates two overlapping bodies on the X-axis (horizontally). - * - * Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection. + * @classdesc + * A single Scene Plugin Script File suitable for loading by the Loader. * - * The bodies won't be separated if there is no horizontal overlap between them, if they are static, or if either one uses custom logic for its separation. + * These are created when you use the Phaser.Loader.LoaderPlugin#scenePlugin method and are not typically created directly. * - * @function Phaser.Physics.Arcade.SeparateX - * @since 3.0.0 + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#scenePlugin. * - * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. - * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. - * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. - * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. + * @class ScenePluginFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.8.0 * - * @return {boolean} `true` if the two bodies overlap vertically, otherwise `false`. + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.ScenePluginFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {string} [systemKey] - If this plugin is to be added to Scene.Systems, this is the property key for it. + * @param {string} [sceneKey] - If this plugin is to be added to the Scene, this is the property key for it. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ -var SeparateX = function (body1, body2, overlapOnly, bias) -{ - var overlap = GetOverlapX(body1, body2, overlapOnly, bias); +var ScenePluginFile = new Class({ - var body1Immovable = body1.immovable; - var body2Immovable = body2.immovable; + Extends: File, - // Can't separate two immovable bodies, or a body with its own custom separation logic - if (overlapOnly || overlap === 0 || (body1Immovable && body2Immovable) || body1.customSeparateX || body2.customSeparateX) + initialize: + + function ScenePluginFile (loader, key, url, systemKey, sceneKey, xhrSettings) { - // return true if there was some overlap, otherwise false - return (overlap !== 0) || (body1.embedded && body2.embedded); - } + var extension = 'js'; - var blockedState = ProcessX.Set(body1, body2, overlap); + if (IsPlainObject(key)) + { + var config = key; - if (!body1Immovable && !body2Immovable) + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + systemKey = GetFastValue(config, 'systemKey'); + sceneKey = GetFastValue(config, 'sceneKey'); + } + + var fileConfig = { + type: 'scenePlugin', + cache: false, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings, + config: { + systemKey: systemKey, + sceneKey: sceneKey + } + }; + + File.call(this, loader, fileConfig); + + // If the url variable refers to a class, add the plugin directly + if (typeof url === 'function') + { + this.data = url; + + this.state = CONST.FILE_POPULATED; + } + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.ScenePluginFile#onProcess + * @since 3.8.0 + */ + onProcess: function () { - if (blockedState > 0) + var pluginManager = this.loader.systems.plugins; + var config = this.config; + + var key = this.key; + var systemKey = GetFastValue(config, 'systemKey', key); + var sceneKey = GetFastValue(config, 'sceneKey', key); + + if (this.state === CONST.FILE_POPULATED) { - return true; + pluginManager.installScenePlugin(systemKey, this.data, sceneKey, this.loader.scene, true); } + else + { + // Plugin added via a js file + this.state = CONST.FILE_PROCESSING; - return ProcessX.Check(); + this.data = document.createElement('script'); + this.data.language = 'javascript'; + this.data.type = 'text/javascript'; + this.data.defer = false; + this.data.text = this.xhrLoader.responseText; + + document.head.appendChild(this.data); + + pluginManager.installScenePlugin(systemKey, window[this.key], sceneKey, this.loader.scene, true); + } + + this.onProcessComplete(); } - else if (body1Immovable) + +}); + +/** + * Adds a Scene Plugin Script file, or array of plugin files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.scenePlugin('ModPlayer', 'plugins/ModPlayer.js', 'modPlayer', 'mods'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String and not already in-use by another file in the Loader. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.scenePlugin({ + * key: 'modplayer', + * url: 'plugins/ModPlayer.js' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.ScenePluginFileConfig` for more details. + * + * Once the file has finished loading it will automatically be converted into a script element + * via `document.createElement('script')`. It will have its language set to JavaScript, `defer` set to + * false and then the resulting element will be appended to `document.head`. Any code then in the + * script will be executed. It will then be passed to the Phaser PluginCache.register method. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.js". It will always add `.js` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Script File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#scenePlugin + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.8.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.ScenePluginFileConfig|Phaser.Types.Loader.FileTypes.ScenePluginFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {(string|function)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". Or, set to a plugin function. + * @param {string} [systemKey] - If this plugin is to be added to Scene.Systems, this is the property key for it. + * @param {string} [sceneKey] - If this plugin is to be added to the Scene, this is the property key for it. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('scenePlugin', function (key, url, systemKey, sceneKey, xhrSettings) +{ + if (Array.isArray(key)) { - ProcessX.RunImmovableBody1(blockedState); + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new ScenePluginFile(this, key[i])); + } } - else if (body2Immovable) + else { - ProcessX.RunImmovableBody2(blockedState); + this.addFile(new ScenePluginFile(this, key, url, systemKey, sceneKey, xhrSettings)); } - // If we got this far then there WAS overlap, and separation is complete, so return true - return true; -}; + return this; +}); -module.exports = SeparateX; +module.exports = ScenePluginFile; /***/ }), -/* 538 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 55188: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetOverlapY = __webpack_require__(247); -var ProcessY = __webpack_require__(1390); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); /** - * Separates two overlapping bodies on the Y-axis (vertically). + * @classdesc + * A single Script File suitable for loading by the Loader. * - * Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection. + * These are created when you use the Phaser.Loader.LoaderPlugin#script method and are not typically created directly. * - * The bodies won't be separated if there is no vertical overlap between them, if they are static, or if either one uses custom logic for its separation. + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#script. * - * @function Phaser.Physics.Arcade.SeparateY + * @class ScriptFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. - * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. - * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. - * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. - * - * @return {boolean} `true` if the two bodies overlap vertically, otherwise `false`. + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.ScriptFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {string} [type='script'] - The script type. Should be either 'script' for classic JavaScript, or 'module' if the file contains an exported module. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ -var SeparateY = function (body1, body2, overlapOnly, bias) -{ - var overlap = GetOverlapY(body1, body2, overlapOnly, bias); +var ScriptFile = new Class({ - var body1Immovable = body1.immovable; - var body2Immovable = body2.immovable; + Extends: File, - // Can't separate two immovable bodies, or a body with its own custom separation logic - if (overlapOnly || overlap === 0 || (body1Immovable && body2Immovable) || body1.customSeparateY || body2.customSeparateY) + initialize: + + function ScriptFile (loader, key, url, type, xhrSettings) { - // return true if there was some overlap, otherwise false - return (overlap !== 0) || (body1.embedded && body2.embedded); - } + var extension = 'js'; - var blockedState = ProcessY.Set(body1, body2, overlap); + if (IsPlainObject(key)) + { + var config = key; - if (!body1Immovable && !body2Immovable) - { - if (blockedState > 0) + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + type = GetFastValue(config, 'type', 'script'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } + else if (type === undefined) { - return true; + type = 'script'; } - return ProcessY.Check(); + var fileConfig = { + type: type, + cache: false, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; + + File.call(this, loader, fileConfig); + }, + + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.ScriptFile#onProcess + * @since 3.7.0 + */ + onProcess: function () + { + this.state = CONST.FILE_PROCESSING; + + this.data = document.createElement('script'); + this.data.language = 'javascript'; + this.data.type = 'text/javascript'; + this.data.defer = false; + this.data.text = this.xhrLoader.responseText; + + document.head.appendChild(this.data); + + this.onProcessComplete(); } - else if (body1Immovable) + +}); + +/** + * Adds a Script file, or array of Script files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.script('aliens', 'lib/aliens.js'); + * } + * ``` + * + * If the script file contains a module, then you should specify that using the 'type' parameter: + * + * ```javascript + * function preload () + * { + * this.load.script('aliens', 'lib/aliens.js', 'module'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String and not already in-use by another file in the Loader. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.script({ + * key: 'aliens', + * url: 'lib/aliens.js', + * type: 'script' // or 'module' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.ScriptFileConfig` for more details. + * + * Once the file has finished loading it will automatically be converted into a script element + * via `document.createElement('script')`. It will have its language set to JavaScript, `defer` set to + * false and then the resulting element will be appended to `document.head`. Any code then in the + * script will be executed. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.js". It will always add `.js` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Script File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#script + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.ScriptFileConfig|Phaser.Types.Loader.FileTypes.ScriptFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". + * @param {string} [type='script'] - The script type. Should be either 'script' for classic JavaScript, or 'module' if the file contains an exported module. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('script', function (key, url, type, xhrSettings) +{ + if (Array.isArray(key)) { - ProcessY.RunImmovableBody1(blockedState); + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new ScriptFile(this, key[i])); + } } - else if (body2Immovable) + else { - ProcessY.RunImmovableBody2(blockedState); + this.addFile(new ScriptFile(this, key, url, type, xhrSettings)); } - // If we got this far then there WAS overlap, and separation is complete, so return true - return true; -}; + return this; +}); -module.exports = SeparateY; +module.exports = ScriptFile; /***/ }), -/* 539 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 33536: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CircleContains = __webpack_require__(66); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(62); -var RectangleContains = __webpack_require__(57); -var Vector2 = __webpack_require__(3); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var FileTypesManager = __webpack_require__(76846); +var ImageFile = __webpack_require__(42927); /** * @classdesc - * A Static Arcade Physics Body. - * - * A Static Body never moves, and isn't automatically synchronized with its parent Game Object. - * That means if you make any change to the parent's origin, position, or scale after creating or adding the body, you'll need to update the Static Body manually. + * A single Sprite Sheet Image File suitable for loading by the Loader. * - * A Static Body can collide with other Bodies, but is never moved by collisions. + * These are created when you use the Phaser.Loader.LoaderPlugin#spritesheet method and are not typically created directly. * - * Its dynamic counterpart is {@link Phaser.Physics.Arcade.Body}. + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#spritesheet. * - * @class StaticBody - * @memberof Phaser.Physics.Arcade + * @class SpriteSheetFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes * @constructor * @since 3.0.0 * - * @param {Phaser.Physics.Arcade.World} world - The Arcade Physics simulation this Static Body belongs to. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object this Static Body belongs to. + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.SpriteSheetFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {Phaser.Types.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ -var StaticBody = new Class({ +var SpriteSheetFile = new Class({ + + Extends: ImageFile, initialize: - function StaticBody (world, gameObject) + function SpriteSheetFile (loader, key, url, frameConfig, xhrSettings) { - var width = (gameObject.displayWidth) ? gameObject.displayWidth : 64; - var height = (gameObject.displayHeight) ? gameObject.displayHeight : 64; - - /** - * The Arcade Physics simulation this Static Body belongs to. - * - * @name Phaser.Physics.Arcade.StaticBody#world - * @type {Phaser.Physics.Arcade.World} - * @since 3.0.0 - */ - this.world = world; - - /** - * The Game Object this Static Body belongs to. - * - * @name Phaser.Physics.Arcade.StaticBody#gameObject - * @type {Phaser.GameObjects.GameObject} - * @since 3.0.0 - */ - this.gameObject = gameObject; + ImageFile.call(this, loader, key, url, xhrSettings, frameConfig); - /** - * Whether the Static Body's boundary is drawn to the debug display. - * - * @name Phaser.Physics.Arcade.StaticBody#debugShowBody - * @type {boolean} - * @since 3.0.0 - */ - this.debugShowBody = world.defaults.debugShowStaticBody; + this.type = 'spritesheet'; + }, - /** - * The color of this Static Body on the debug display. - * - * @name Phaser.Physics.Arcade.StaticBody#debugBodyColor - * @type {number} - * @since 3.0.0 - */ - this.debugBodyColor = world.defaults.staticBodyDebugColor; + /** + * Adds this file to its target cache upon successful loading and processing. + * + * @method Phaser.Loader.FileTypes.SpriteSheetFile#addToCache + * @since 3.7.0 + */ + addToCache: function () + { + // Check if we have a linked normal map + var linkFile = this.linkFile; - /** - * Whether this Static Body is updated by the physics simulation. - * - * @name Phaser.Physics.Arcade.StaticBody#enable - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.enable = true; + if (linkFile) + { + // We do, but has it loaded? + if (linkFile.state >= CONST.FILE_COMPLETE) + { + // Both files have loaded + if (this.type === 'normalMap') + { + // linkFile.data = Image + // this.data = Normal Map + this.cache.addSpriteSheet(this.key, linkFile.data, this.config, this.data); + } + else + { + // linkFile.data = Normal Map + // this.data = Image + this.cache.addSpriteSheet(this.key, this.data, this.config, linkFile.data); + } + } - /** - * Whether this Static Body's boundary is circular (`true`) or rectangular (`false`). - * - * @name Phaser.Physics.Arcade.StaticBody#isCircle - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.isCircle = false; + // Nothing to do here, we'll use the linkFile `addToCache` call + // to process this pair + } + else + { + this.cache.addSpriteSheet(this.key, this.data, this.config); + } + } - /** - * If this Static Body is circular, this is the radius of the boundary, as set by {@link Phaser.Physics.Arcade.StaticBody#setCircle}, in pixels. - * Equal to `halfWidth`. - * - * @name Phaser.Physics.Arcade.StaticBody#radius - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.radius = 0; +}); - /** - * The offset set by {@link Phaser.Physics.Arcade.StaticBody#setCircle} or {@link Phaser.Physics.Arcade.StaticBody#setSize}. - * - * This doesn't affect the Static Body's position, because a Static Body does not follow its Game Object. - * - * @name Phaser.Physics.Arcade.StaticBody#offset - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.0.0 - */ - this.offset = new Vector2(); +/** + * Adds a Sprite Sheet Image, or array of Sprite Sheet Images, to the current load queue. + * + * The term 'Sprite Sheet' in Phaser means a fixed-size sheet. Where every frame in the sheet is the exact same size, + * and you reference those frames using numbers, not frame names. This is not the same thing as a Texture Atlas, where + * the frames are packed in a way where they take up the least amount of space, and are referenced by their names, + * not numbers. Some articles and software use the term 'Sprite Sheet' to mean Texture Atlas, so please be aware of + * what sort of file you're actually trying to load. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.spritesheet('bot', 'images/robot.png', { frameWidth: 32, frameHeight: 38 }); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. + * If you try to load an animated gif only the first frame will be rendered. Browsers do not natively support playback + * of animated gifs to Canvas elements. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.spritesheet({ + * key: 'bot', + * url: 'images/robot.png', + * frameConfig: { + * frameWidth: 32, + * frameHeight: 38, + * startFrame: 0, + * endFrame: 8 + * } + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.SpriteSheetFileConfig` for more details. + * + * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key: + * + * ```javascript + * this.load.spritesheet('bot', 'images/robot.png', { frameWidth: 32, frameHeight: 38 }); + * // and later in your game ... + * this.add.image(x, y, 'bot', 0); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `PLAYER.` and the key was `Running` the final key will be `PLAYER.Running` and + * this is what you would use to retrieve the image from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, + * then you can specify it by providing an array as the `url` where the second element is the normal map: + * + * ```javascript + * this.load.spritesheet('logo', [ 'images/AtariLogo.png', 'images/AtariLogo-n.png' ], { frameWidth: 256, frameHeight: 80 }); + * ``` + * + * Or, if you are using a config object use the `normalMap` property: + * + * ```javascript + * this.load.spritesheet({ + * key: 'logo', + * url: 'images/AtariLogo.png', + * normalMap: 'images/AtariLogo-n.png', + * frameConfig: { + * frameWidth: 256, + * frameHeight: 80 + * } + * }); + * ``` + * + * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. + * Normal maps are a WebGL only feature. + * + * Note: The ability to load this type of file will only be available if the Sprite Sheet File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#spritesheet + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.SpriteSheetFileConfig|Phaser.Types.Loader.FileTypes.SpriteSheetFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {Phaser.Types.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. At a minimum it should have a `frameWidth` property. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('spritesheet', function (key, url, frameConfig, xhrSettings) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new SpriteSheetFile(this, key[i])); + } + } + else + { + this.addFile(new SpriteSheetFile(this, key, url, frameConfig, xhrSettings)); + } - /** - * The position of this Static Body within the simulation. - * - * @name Phaser.Physics.Arcade.StaticBody#position - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.position = new Vector2(gameObject.x - (width * gameObject.originX), gameObject.y - (height * gameObject.originY)); + return this; +}); - /** - * The width of the Static Body's boundary, in pixels. - * If the Static Body is circular, this is also the Static Body's diameter. - * - * @name Phaser.Physics.Arcade.StaticBody#width - * @type {number} - * @since 3.0.0 - */ - this.width = width; +module.exports = SpriteSheetFile; - /** - * The height of the Static Body's boundary, in pixels. - * If the Static Body is circular, this is also the Static Body's diameter. - * - * @name Phaser.Physics.Arcade.StaticBody#height - * @type {number} - * @since 3.0.0 - */ - this.height = height; - /** - * Half the Static Body's width, in pixels. - * If the Static Body is circular, this is also the Static Body's radius. - * - * @name Phaser.Physics.Arcade.StaticBody#halfWidth - * @type {number} - * @since 3.0.0 - */ - this.halfWidth = Math.abs(this.width / 2); +/***/ }), - /** - * Half the Static Body's height, in pixels. - * If the Static Body is circular, this is also the Static Body's radius. - * - * @name Phaser.Physics.Arcade.StaticBody#halfHeight - * @type {number} - * @since 3.0.0 - */ - this.halfHeight = Math.abs(this.height / 2); +/***/ 86897: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The center of the Static Body's boundary. - * This is the midpoint of its `position` (top-left corner) and its bottom-right corner. - * - * @name Phaser.Physics.Arcade.StaticBody#center - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.center = new Vector2(this.position.x + this.halfWidth, this.position.y + this.halfHeight); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * A constant zero velocity used by the Arcade Physics simulation for calculations. - * - * @name Phaser.Physics.Arcade.StaticBody#velocity - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.0.0 - */ - this.velocity = Vector2.ZERO; +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); - /** - * A constant `false` value expected by the Arcade Physics simulation. - * - * @name Phaser.Physics.Arcade.StaticBody#allowGravity - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.allowGravity = false; +/** + * @classdesc + * A single Text File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#text method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#text. + * + * @class TextFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var TextFile = new Class({ - /** - * Gravitational force applied specifically to this Body. Values are in pixels per second squared. Always zero for a Static Body. - * - * @name Phaser.Physics.Arcade.StaticBody#gravity - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.0.0 - */ - this.gravity = Vector2.ZERO; + Extends: File, - /** - * Rebound, or restitution, following a collision, relative to 1. Always zero for a Static Body. - * - * @name Phaser.Physics.Arcade.StaticBody#bounce - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.0.0 - */ - this.bounce = Vector2.ZERO; + initialize: - // If true this Body will dispatch events + function TextFile (loader, key, url, xhrSettings) + { + var type = 'text'; + var extension = 'txt'; + var cache = loader.cacheManager.text; - /** - * Whether the simulation emits a `worldbounds` event when this StaticBody collides with the world boundary. - * Always false for a Static Body. (Static Bodies never collide with the world boundary and never trigger a `worldbounds` event.) - * - * @name Phaser.Physics.Arcade.StaticBody#onWorldBounds - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.onWorldBounds = false; + if (IsPlainObject(key)) + { + var config = key; - /** - * Whether the simulation emits a `collide` event when this StaticBody collides with another. - * - * @name Phaser.Physics.Arcade.StaticBody#onCollide - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.onCollide = false; + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + type = GetFastValue(config, 'type', type); + cache = GetFastValue(config, 'cache', cache); + } - /** - * Whether the simulation emits an `overlap` event when this StaticBody overlaps with another. - * - * @name Phaser.Physics.Arcade.StaticBody#onOverlap - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.onOverlap = false; + var fileConfig = { + type: type, + cache: cache, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; - /** - * The StaticBody's inertia, relative to a default unit (1). With `bounce`, this affects the exchange of momentum (velocities) during collisions. - * - * @name Phaser.Physics.Arcade.StaticBody#mass - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.mass = 1; + File.call(this, loader, fileConfig); + }, - /** - * Whether this object can be moved by collisions with another body. - * - * @name Phaser.Physics.Arcade.StaticBody#immovable - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.immovable = true; + /** + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. + * + * @method Phaser.Loader.FileTypes.TextFile#onProcess + * @since 3.7.0 + */ + onProcess: function () + { + this.state = CONST.FILE_PROCESSING; - /** - * Sets if this Body can be pushed by another Body. - * - * A body that cannot be pushed will reflect back all of the velocity it is given to the - * colliding body. If that body is also not pushable, then the separation will be split - * between them evenly. - * - * If you want your body to never move or seperate at all, see the `setImmovable` method. - * - * By default, Static Bodies are not pushable. - * - * @name Phaser.Physics.Arcade.StaticBody#pushable - * @type {boolean} - * @default false - * @since 3.50.0 - * @see Phaser.GameObjects.Components.Pushable#setPushable - */ - this.pushable = false; + this.data = this.xhrLoader.responseText; - /** - * A flag disabling the default horizontal separation of colliding bodies. Pass your own `collideHandler` to the collider. - * - * @name Phaser.Physics.Arcade.StaticBody#customSeparateX - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.customSeparateX = false; + this.onProcessComplete(); + } - /** - * A flag disabling the default vertical separation of colliding bodies. Pass your own `collideHandler` to the collider. - * - * @name Phaser.Physics.Arcade.StaticBody#customSeparateY - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.customSeparateY = false; +}); - /** - * The amount of horizontal overlap (before separation), if this Body is colliding with another. - * - * @name Phaser.Physics.Arcade.StaticBody#overlapX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.overlapX = 0; +/** + * Adds a Text file, or array of Text files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.text('story', 'files/IntroStory.txt'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Text Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Text Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Text Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.text({ + * key: 'story', + * url: 'files/IntroStory.txt' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.TextFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.text('story', 'files/IntroStory.txt'); + * // and later in your game ... + * var data = this.cache.text.get('story'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and + * this is what you would use to retrieve the text from the Text Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" + * and no URL is given then the Loader will set the URL to be "story.txt". It will always add `.txt` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Text File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#text + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig|Phaser.Types.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('text', function (key, url, xhrSettings) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new TextFile(this, key[i])); + } + } + else + { + this.addFile(new TextFile(this, key, url, xhrSettings)); + } - /** - * The amount of vertical overlap (before separation), if this Body is colliding with another. - * - * @name Phaser.Physics.Arcade.StaticBody#overlapY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.overlapY = 0; + return this; +}); - /** - * The amount of overlap (before separation), if this StaticBody is circular and colliding with another circular body. - * - * @name Phaser.Physics.Arcade.StaticBody#overlapR - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.overlapR = 0; +module.exports = TextFile; - /** - * Whether this StaticBody has ever overlapped with another while both were not moving. - * - * @name Phaser.Physics.Arcade.StaticBody#embedded - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.embedded = false; - /** - * Whether this StaticBody interacts with the world boundary. - * Always false for a Static Body. (Static Bodies never collide with the world boundary.) - * - * @name Phaser.Physics.Arcade.StaticBody#collideWorldBounds - * @type {boolean} - * @readonly - * @default false - * @since 3.0.0 - */ - this.collideWorldBounds = false; +/***/ }), - /** - * Whether this StaticBody is checked for collisions and for which directions. You can set `checkCollision.none = false` to disable collision checks. - * - * @name Phaser.Physics.Arcade.StaticBody#checkCollision - * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} - * @since 3.0.0 - */ - this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; +/***/ 58673: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * This property is kept for compatibility with Dynamic Bodies. - * Avoid using it. - * - * @name Phaser.Physics.Arcade.StaticBody#touching - * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} - * @since 3.0.0 - */ - this.touching = { none: true, up: false, down: false, left: false, right: false }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * This property is kept for compatibility with Dynamic Bodies. - * Avoid using it. - * The values are always false for a Static Body. - * - * @name Phaser.Physics.Arcade.StaticBody#wasTouching - * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} - * @since 3.0.0 - */ - this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); +var TILEMAP_FORMATS = __webpack_require__(93560); - /** - * This property is kept for compatibility with Dynamic Bodies. - * Avoid using it. - * - * @name Phaser.Physics.Arcade.StaticBody#blocked - * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} - * @since 3.0.0 - */ - this.blocked = { none: true, up: false, down: false, left: false, right: false }; +/** + * @classdesc + * A single Tilemap CSV File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#tilemapCSV method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#tilemapCSV. + * + * @class TilemapCSVFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.TilemapCSVFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.csv`, i.e. if `key` was "alien" then the URL will be "alien.csv". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var TilemapCSVFile = new Class({ - /** - * The StaticBody's physics type (static by default). - * - * @name Phaser.Physics.Arcade.StaticBody#physicsType - * @type {number} - * @default Phaser.Physics.Arcade.STATIC_BODY - * @since 3.0.0 - */ - this.physicsType = CONST.STATIC_BODY; + Extends: File, - /** - * The calculated change in the Static Body's horizontal position during the current step. - * For a static body this is always zero. - * - * @name Phaser.Physics.Arcade.StaticBody#_dx - * @type {number} - * @private - * @default 0 - * @since 3.10.0 - */ - this._dx = 0; + initialize: - /** - * The calculated change in the Static Body's vertical position during the current step. - * For a static body this is always zero. - * - * @name Phaser.Physics.Arcade.StaticBody#_dy - * @type {number} - * @private - * @default 0 - * @since 3.10.0 - */ - this._dy = 0; + function TilemapCSVFile (loader, key, url, xhrSettings) + { + var extension = 'csv'; + + if (IsPlainObject(key)) + { + var config = key; + + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } + + var fileConfig = { + type: 'tilemapCSV', + cache: loader.cacheManager.tilemap, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; + + File.call(this, loader, fileConfig); + + this.tilemapFormat = TILEMAP_FORMATS.CSV; }, /** - * Changes the Game Object this Body is bound to. - * First it removes its reference from the old Game Object, then sets the new one. - * You can optionally update the position and dimensions of this Body to reflect that of the new Game Object. - * - * @method Phaser.Physics.Arcade.StaticBody#setGameObject - * @since 3.1.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The new Game Object that will own this Body. - * @param {boolean} [update=true] - Reposition and resize this Body to match the new Game Object? - * - * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. * - * @see Phaser.Physics.Arcade.StaticBody#updateFromGameObject + * @method Phaser.Loader.FileTypes.TilemapCSVFile#onProcess + * @since 3.7.0 */ - setGameObject: function (gameObject, update) + onProcess: function () { - if (gameObject && gameObject !== this.gameObject) - { - // Remove this body from the old game object - this.gameObject.body = null; - - gameObject.body = this; - - // Update our reference - this.gameObject = gameObject; - } + this.state = CONST.FILE_PROCESSING; - if (update) - { - this.updateFromGameObject(); - } + this.data = this.xhrLoader.responseText; - return this; + this.onProcessComplete(); }, /** - * Syncs the Static Body's position and size with its parent Game Object. - * - * @method Phaser.Physics.Arcade.StaticBody#updateFromGameObject - * @since 3.1.0 + * Adds this file to its target cache upon successful loading and processing. * - * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. + * @method Phaser.Loader.FileTypes.TilemapCSVFile#addToCache + * @since 3.7.0 */ - updateFromGameObject: function () + addToCache: function () { - this.world.staticTree.remove(this); + var tiledata = { format: this.tilemapFormat, data: this.data }; - var gameObject = this.gameObject; + this.cache.add(this.key, tiledata); + } - gameObject.getTopLeft(this.position); +}); - this.width = gameObject.displayWidth; - this.height = gameObject.displayHeight; +/** + * Adds a CSV Tilemap file, or array of CSV files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.tilemapCSV('level1', 'maps/Level1.csv'); + * } + * ``` + * + * Tilemap CSV data can be created in a text editor, or a 3rd party app that exports as CSV. + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Tilemap Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Tilemap Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Text Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.tilemapCSV({ + * key: 'level1', + * url: 'maps/Level1.csv' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.TilemapCSVFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.tilemapCSV('level1', 'maps/Level1.csv'); + * // and later in your game ... + * var map = this.make.tilemap({ key: 'level1' }); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and + * this is what you would use to retrieve the text from the Tilemap Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "level" + * and no URL is given then the Loader will set the URL to be "level.csv". It will always add `.csv` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Tilemap CSV File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#tilemapCSV + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.TilemapCSVFileConfig|Phaser.Types.Loader.FileTypes.TilemapCSVFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.csv`, i.e. if `key` was "alien" then the URL will be "alien.csv". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('tilemapCSV', function (key, url, xhrSettings) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new TilemapCSVFile(this, key[i])); + } + } + else + { + this.addFile(new TilemapCSVFile(this, key, url, xhrSettings)); + } - this.halfWidth = Math.abs(this.width / 2); - this.halfHeight = Math.abs(this.height / 2); + return this; +}); - this.center.set(this.position.x + this.halfWidth, this.position.y + this.halfHeight); +module.exports = TilemapCSVFile; - this.world.staticTree.insert(this); - return this; - }, +/***/ }), - /** - * Positions the Static Body at an offset from its Game Object. - * - * @method Phaser.Physics.Arcade.StaticBody#setOffset - * @since 3.4.0 - * - * @param {number} x - The horizontal offset of the Static Body from the Game Object's `x`. - * @param {number} y - The vertical offset of the Static Body from the Game Object's `y`. - * - * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. - */ - setOffset: function (x, y) - { - if (y === undefined) { y = x; } +/***/ 98896: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.world.staticTree.remove(this); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.position.x -= this.offset.x; - this.position.y -= this.offset.y; +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var JSONFile = __webpack_require__(70806); +var TILEMAP_FORMATS = __webpack_require__(93560); - this.offset.set(x, y); +/** + * @classdesc + * A single Impact.js Tilemap JSON File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#tilemapImpact method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#tilemapImpact. + * + * @class TilemapImpactFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.7.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.TilemapImpactFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var TilemapImpactFile = new Class({ - this.position.x += this.offset.x; - this.position.y += this.offset.y; + Extends: JSONFile, - this.updateCenter(); + initialize: - this.world.staticTree.insert(this); + function TilemapImpactFile (loader, key, url, xhrSettings) + { + JSONFile.call(this, loader, key, url, xhrSettings); - return this; + this.type = 'tilemapJSON'; + + this.cache = loader.cacheManager.tilemap; }, /** - * Sets the size of the Static Body. - * When `center` is true, also repositions it. - * Resets the width and height to match current frame, if no width and height provided and a frame is found. - * - * @method Phaser.Physics.Arcade.StaticBody#setSize - * @since 3.0.0 - * - * @param {number} [width] - The width of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width. - * @param {number} [height] - The height of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height. - * @param {boolean} [center=true] - Place the Static Body's center on its Game Object's center. Only works if the Game Object has the `getCenter` method. + * Adds this file to its target cache upon successful loading and processing. * - * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. + * @method Phaser.Loader.FileTypes.TilemapImpactFile#addToCache + * @since 3.7.0 */ - setSize: function (width, height, center) + addToCache: function () { - if (center === undefined) { center = true; } + var tiledata = { format: TILEMAP_FORMATS.WELTMEISTER, data: this.data }; - var gameObject = this.gameObject; + this.cache.add(this.key, tiledata); + } - if (!width && gameObject.frame) - { - width = gameObject.frame.realWidth; - } +}); - if (!height && gameObject.frame) +/** + * Adds an Impact.js Tilemap file, or array of map files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.tilemapImpact('level1', 'maps/Level1.json'); + * } + * ``` + * + * Impact Tilemap data is created the Impact.js Map Editor called Weltmeister. + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Tilemap Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Tilemap Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Text Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.tilemapImpact({ + * key: 'level1', + * url: 'maps/Level1.json' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.TilemapImpactFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.tilemapImpact('level1', 'maps/Level1.json'); + * // and later in your game ... + * var map = this.make.tilemap({ key: 'level1' }); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and + * this is what you would use to retrieve the text from the Tilemap Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "level" + * and no URL is given then the Loader will set the URL to be "level.json". It will always add `.json` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Tilemap Impact File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#tilemapImpact + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.7.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.TilemapImpactFileConfig|Phaser.Types.Loader.FileTypes.TilemapImpactFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('tilemapImpact', function (key, url, xhrSettings) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) { - height = gameObject.frame.realHeight; + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new TilemapImpactFile(this, key[i])); } + } + else + { + this.addFile(new TilemapImpactFile(this, key, url, xhrSettings)); + } - this.world.staticTree.remove(this); + return this; +}); - this.width = width; - this.height = height; +module.exports = TilemapImpactFile; - this.halfWidth = Math.floor(width / 2); - this.halfHeight = Math.floor(height / 2); - if (center && gameObject.getCenter) - { - var ox = gameObject.displayWidth / 2; - var oy = gameObject.displayHeight / 2; +/***/ }), - this.position.x -= this.offset.x; - this.position.y -= this.offset.y; +/***/ 50563: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.offset.set(ox - this.halfWidth, oy - this.halfHeight); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.position.x += this.offset.x; - this.position.y += this.offset.y; - } +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var JSONFile = __webpack_require__(70806); +var TILEMAP_FORMATS = __webpack_require__(93560); - this.updateCenter(); +/** + * @classdesc + * A single Tiled Tilemap JSON File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#tilemapTiledJSON method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#tilemapTiledJSON. + * + * @class TilemapJSONFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.TilemapJSONFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {object|string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + */ +var TilemapJSONFile = new Class({ - this.isCircle = false; - this.radius = 0; + Extends: JSONFile, - this.world.staticTree.insert(this); + initialize: - return this; + function TilemapJSONFile (loader, key, url, xhrSettings) + { + JSONFile.call(this, loader, key, url, xhrSettings); + + this.type = 'tilemapJSON'; + + this.cache = loader.cacheManager.tilemap; }, /** - * Sets this Static Body to have a circular body and sets its size and position. - * - * @method Phaser.Physics.Arcade.StaticBody#setCircle - * @since 3.0.0 - * - * @param {number} radius - The radius of the StaticBody, in pixels. - * @param {number} [offsetX] - The horizontal offset of the StaticBody from its Game Object, in pixels. - * @param {number} [offsetY] - The vertical offset of the StaticBody from its Game Object, in pixels. + * Adds this file to its target cache upon successful loading and processing. * - * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. + * @method Phaser.Loader.FileTypes.TilemapJSONFile#addToCache + * @since 3.7.0 */ - setCircle: function (radius, offsetX, offsetY) + addToCache: function () { - if (offsetX === undefined) { offsetX = this.offset.x; } - if (offsetY === undefined) { offsetY = this.offset.y; } - - if (radius > 0) - { - this.world.staticTree.remove(this); - - this.isCircle = true; - - this.radius = radius; - - this.width = radius * 2; - this.height = radius * 2; - - this.halfWidth = Math.floor(this.width / 2); - this.halfHeight = Math.floor(this.height / 2); + var tiledata = { format: TILEMAP_FORMATS.TILED_JSON, data: this.data }; - this.offset.set(offsetX, offsetY); + this.cache.add(this.key, tiledata); + } - this.updateCenter(); +}); - this.world.staticTree.insert(this); - } - else +/** + * Adds a Tiled JSON Tilemap file, or array of map files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.tilemapTiledJSON('level1', 'maps/Level1.json'); + * } + * ``` + * + * The Tilemap data is created using the Tiled Map Editor and selecting JSON as the export format. + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Tilemap Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Tilemap Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Text Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.tilemapTiledJSON({ + * key: 'level1', + * url: 'maps/Level1.json' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.TilemapJSONFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.tilemapTiledJSON('level1', 'maps/Level1.json'); + * // and later in your game ... + * var map = this.make.tilemap({ key: 'level1' }); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and + * this is what you would use to retrieve the text from the Tilemap Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "level" + * and no URL is given then the Loader will set the URL to be "level.json". It will always add `.json` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the Tilemap JSON File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#tilemapTiledJSON + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.TilemapJSONFileConfig|Phaser.Types.Loader.FileTypes.TilemapJSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {object|string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('tilemapTiledJSON', function (key, url, xhrSettings) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) { - this.isCircle = false; + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new TilemapJSONFile(this, key[i])); } - - return this; - }, - - /** - * Updates the StaticBody's `center` from its `position` and dimensions. - * - * @method Phaser.Physics.Arcade.StaticBody#updateCenter - * @since 3.0.0 - */ - updateCenter: function () + } + else { - this.center.set(this.position.x + this.halfWidth, this.position.y + this.halfHeight); - }, + this.addFile(new TilemapJSONFile(this, key, url, xhrSettings)); + } - /** - * Resets this Body to the given coordinates. Also positions its parent Game Object to the same coordinates. - * - * @method Phaser.Physics.Arcade.StaticBody#reset - * @since 3.0.0 - * - * @param {number} [x] - The x coordinate to reset the body to. If not given will use the parent Game Object's coordinate. - * @param {number} [y] - The y coordinate to reset the body to. If not given will use the parent Game Object's coordinate. - */ - reset: function (x, y) - { - var gameObject = this.gameObject; + return this; +}); - if (x === undefined) { x = gameObject.x; } - if (y === undefined) { y = gameObject.y; } +module.exports = TilemapJSONFile; - this.world.staticTree.remove(this); - gameObject.setPosition(x, y); +/***/ }), - gameObject.getTopLeft(this.position); +/***/ 82857: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.updateCenter(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.world.staticTree.insert(this); - }, +var Class = __webpack_require__(56694); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var ImageFile = __webpack_require__(42927); +var IsPlainObject = __webpack_require__(42911); +var MultiFile = __webpack_require__(45176); +var TextFile = __webpack_require__(86897); - /** - * NOOP function. A Static Body cannot be stopped. - * - * @method Phaser.Physics.Arcade.StaticBody#stop - * @since 3.0.0 - * - * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. - */ - stop: function () - { - return this; - }, +/** + * @classdesc + * A single text file based Unity Texture Atlas File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#unityAtlas method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#unityAtlas. + * + * @class UnityAtlasFile + * @extends Phaser.Loader.MultiFile + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.UnityAtlasFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas data file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas data file. Used in replacement of the Loaders default XHR Settings. + */ +var UnityAtlasFile = new Class({ - /** - * Returns the x and y coordinates of the top left and bottom right points of the StaticBody. - * - * @method Phaser.Physics.Arcade.StaticBody#getBounds - * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Arcade.ArcadeBodyBounds} obj - The object which will hold the coordinates of the bounds. - * - * @return {Phaser.Types.Physics.Arcade.ArcadeBodyBounds} The same object that was passed with `x`, `y`, `right` and `bottom` values matching the respective values of the StaticBody. - */ - getBounds: function (obj) - { - obj.x = this.x; - obj.y = this.y; - obj.right = this.right; - obj.bottom = this.bottom; + Extends: MultiFile, - return obj; - }, + initialize: - /** - * Checks to see if a given x,y coordinate is colliding with this Static Body. - * - * @method Phaser.Physics.Arcade.StaticBody#hitTest - * @since 3.0.0 - * - * @param {number} x - The x coordinate to check against this body. - * @param {number} y - The y coordinate to check against this body. - * - * @return {boolean} `true` if the given coordinate lies within this body, otherwise `false`. - */ - hitTest: function (x, y) + function UnityAtlasFile (loader, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) { - return (this.isCircle) ? CircleContains(this, x, y) : RectangleContains(this, x, y); - }, + var image; + var data; - /** - * NOOP - * - * @method Phaser.Physics.Arcade.StaticBody#postUpdate - * @since 3.12.0 - */ - postUpdate: function () - { - }, + if (IsPlainObject(key)) + { + var config = key; - /** - * The absolute (non-negative) change in this StaticBody's horizontal position from the previous step. Always zero. - * - * @method Phaser.Physics.Arcade.StaticBody#deltaAbsX - * @since 3.0.0 - * - * @return {number} Always zero for a Static Body. - */ - deltaAbsX: function () - { - return 0; - }, + key = GetFastValue(config, 'key'); - /** - * The absolute (non-negative) change in this StaticBody's vertical position from the previous step. Always zero. - * - * @method Phaser.Physics.Arcade.StaticBody#deltaAbsY - * @since 3.0.0 - * - * @return {number} Always zero for a Static Body. - */ - deltaAbsY: function () - { - return 0; - }, + image = new ImageFile(loader, { + key: key, + url: GetFastValue(config, 'textureURL'), + extension: GetFastValue(config, 'textureExtension', 'png'), + normalMap: GetFastValue(config, 'normalMap'), + xhrSettings: GetFastValue(config, 'textureXhrSettings') + }); - /** - * The change in this StaticBody's horizontal position from the previous step. Always zero. - * - * @method Phaser.Physics.Arcade.StaticBody#deltaX - * @since 3.0.0 - * - * @return {number} The change in this StaticBody's velocity from the previous step. Always zero. - */ - deltaX: function () - { - return 0; - }, + data = new TextFile(loader, { + key: key, + url: GetFastValue(config, 'atlasURL'), + extension: GetFastValue(config, 'atlasExtension', 'txt'), + xhrSettings: GetFastValue(config, 'atlasXhrSettings') + }); + } + else + { + image = new ImageFile(loader, key, textureURL, textureXhrSettings); + data = new TextFile(loader, key, atlasURL, atlasXhrSettings); + } - /** - * The change in this StaticBody's vertical position from the previous step. Always zero. - * - * @method Phaser.Physics.Arcade.StaticBody#deltaY - * @since 3.0.0 - * - * @return {number} The change in this StaticBody's velocity from the previous step. Always zero. - */ - deltaY: function () - { - return 0; + if (image.linkFile) + { + // Image has a normal map + MultiFile.call(this, loader, 'unityatlas', key, [ image, data, image.linkFile ]); + } + else + { + MultiFile.call(this, loader, 'unityatlas', key, [ image, data ]); + } }, /** - * The change in this StaticBody's rotation from the previous step. Always zero. - * - * @method Phaser.Physics.Arcade.StaticBody#deltaZ - * @since 3.0.0 + * Adds this file to its target cache upon successful loading and processing. * - * @return {number} The change in this StaticBody's rotation from the previous step. Always zero. + * @method Phaser.Loader.FileTypes.UnityAtlasFile#addToCache + * @since 3.7.0 */ - deltaZ: function () + addToCache: function () { - return 0; - }, + if (this.isReadyToProcess()) + { + var image = this.files[0]; + var text = this.files[1]; + var normalMap = (this.files[2]) ? this.files[2].data : null; - /** - * Disables this Body and marks it for destruction during the next step. - * - * @method Phaser.Physics.Arcade.StaticBody#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.enable = false; + this.loader.textureManager.addUnityAtlas(image.key, image.data, text.data, normalMap); - this.world.pendingDestroy.set(this); - }, + this.complete = true; + } + } - /** - * Draws a graphical representation of the StaticBody for visual debugging purposes. - * - * @method Phaser.Physics.Arcade.StaticBody#drawDebug - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Graphics} graphic - The Graphics object to use for the debug drawing of the StaticBody. - */ - drawDebug: function (graphic) - { - var pos = this.position; +}); - var x = pos.x + this.halfWidth; - var y = pos.y + this.halfHeight; +/** + * Adds a Unity YAML based Texture Atlas, or array of atlases, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.unityAtlas('mainmenu', 'images/MainMenu.png', 'images/MainMenu.txt'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring + * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. + * + * Phaser expects the atlas data to be provided in a YAML formatted text file as exported from Unity. + * + * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. + * + * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Texture Manager first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.unityAtlas({ + * key: 'mainmenu', + * textureURL: 'images/MainMenu.png', + * atlasURL: 'images/MainMenu.txt' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.UnityAtlasFileConfig` for more details. + * + * Once the atlas has finished loading you can use frames from it as textures for a Game Object by referencing its key: + * + * ```javascript + * this.load.unityAtlas('mainmenu', 'images/MainMenu.png', 'images/MainMenu.json'); + * // and later in your game ... + * this.add.image(x, y, 'mainmenu', 'background'); + * ``` + * + * To get a list of all available frames within an atlas please consult your Texture Atlas software. + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and + * this is what you would use to retrieve the image from the Texture Manager. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" + * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, + * then you can specify it by providing an array as the `url` where the second element is the normal map: + * + * ```javascript + * this.load.unityAtlas('mainmenu', [ 'images/MainMenu.png', 'images/MainMenu-n.png' ], 'images/MainMenu.txt'); + * ``` + * + * Or, if you are using a config object use the `normalMap` property: + * + * ```javascript + * this.load.unityAtlas({ + * key: 'mainmenu', + * textureURL: 'images/MainMenu.png', + * normalMap: 'images/MainMenu-n.png', + * atlasURL: 'images/MainMenu.txt' + * }); + * ``` + * + * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. + * Normal maps are a WebGL only feature. + * + * Note: The ability to load this type of file will only be available if the Unity Atlas File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#unityAtlas + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.UnityAtlasFileConfig|Phaser.Types.Loader.FileTypes.UnityAtlasFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". + * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas data file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". + * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas data file. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('unityAtlas', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) +{ + var multifile; - if (this.debugShowBody) - { - graphic.lineStyle(graphic.defaultStrokeWidth, this.debugBodyColor, 1); + // Supports an Object file definition in the key argument + // Or an array of objects in the key argument + // Or a single entry where all arguments have been defined - if (this.isCircle) - { - graphic.strokeCircle(x, y, this.width / 2); - } - else - { - graphic.strokeRect(pos.x, pos.y, this.width, this.height); - } + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) + { + multifile = new UnityAtlasFile(this, key[i]); + this.addFile(multifile.files); } - }, - - /** - * Indicates whether the StaticBody is going to be showing a debug visualization during postUpdate. - * - * @method Phaser.Physics.Arcade.StaticBody#willDrawDebug - * @since 3.0.0 - * - * @return {boolean} Whether or not the StaticBody is going to show the debug visualization during postUpdate. - */ - willDrawDebug: function () + } + else { - return this.debugShowBody; - }, + multifile = new UnityAtlasFile(this, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings); - /** - * Sets the Mass of the StaticBody. Will set the Mass to 0.1 if the value passed is less than or equal to zero. - * - * @method Phaser.Physics.Arcade.StaticBody#setMass - * @since 3.0.0 - * - * @param {number} value - The value to set the Mass to. Values of zero or less are changed to 0.1. - * - * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. - */ - setMass: function (value) - { - if (value <= 0) - { - // Causes havoc otherwise - value = 0.1; - } + this.addFile(multifile.files); + } - this.mass = value; + return this; +}); - return this; - }, +module.exports = UnityAtlasFile; - /** - * The x coordinate of the StaticBody. - * - * @name Phaser.Physics.Arcade.StaticBody#x - * @type {number} - * @since 3.0.0 - */ - x: { - get: function () - { - return this.position.x; - }, +/***/ }), - set: function (value) - { - this.world.staticTree.remove(this); +/***/ 22833: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.position.x = value; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.world.staticTree.insert(this); - } +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetURL = __webpack_require__(30750); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); - }, +/** + * @classdesc + * A single Video File suitable for loading by the Loader. + * + * These are created when you use the Phaser.Loader.LoaderPlugin#video method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#video. + * + * @class VideoFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes + * @constructor + * @since 3.20.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.VideoFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {(string|string[]|Phaser.Types.Loader.FileTypes.VideoFileURLConfig|Phaser.Types.Loader.FileTypes.VideoFileURLConfig[])} [urls] - The absolute or relative URL to load the video files from. + * @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it. + */ +var VideoFile = new Class({ - /** - * The y coordinate of the StaticBody. - * - * @name Phaser.Physics.Arcade.StaticBody#y - * @type {number} - * @since 3.0.0 - */ - y: { + Extends: File, - get: function () - { - return this.position.y; - }, + initialize: - set: function (value) - { - this.world.staticTree.remove(this); + function VideoFile (loader, key, url, noAudio) + { + if (noAudio === undefined) { noAudio = false; } - this.position.y = value; + if (IsPlainObject(key)) + { + var config = key; - this.world.staticTree.insert(this); + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url', []); + noAudio = GetFastValue(config, 'noAudio', false); } - }, - - /** - * Returns the left-most x coordinate of the area of the StaticBody. - * - * @name Phaser.Physics.Arcade.StaticBody#left - * @type {number} - * @readonly - * @since 3.0.0 - */ - left: { + var urlConfig = loader.systems.game.device.video.getVideoURL(url); - get: function () + if (!urlConfig) { - return this.position.x; + console.warn('VideoFile: No supported format for ' + key); } + var fileConfig = { + type: 'video', + cache: loader.cacheManager.video, + extension: urlConfig.type, + key: key, + url: urlConfig.url, + config: { + noAudio: noAudio + } + }; + + File.call(this, loader, fileConfig); }, /** - * The right-most x coordinate of the area of the StaticBody. + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. * - * @name Phaser.Physics.Arcade.StaticBody#right - * @type {number} - * @readonly - * @since 3.0.0 - */ - right: { - - get: function () - { - return this.position.x + this.width; - } + * @method Phaser.Loader.FileTypes.VideoFile#onProcess + * @since 3.20.0 + */ + onProcess: function () + { + this.data = { + url: this.src, + noAudio: this.config.noAudio, + crossOrigin: this.crossOrigin + }; + this.onProcessComplete(); }, /** - * The highest y coordinate of the area of the StaticBody. + * Called by the Loader, starts the actual file downloading. + * During the load the methods onLoad, onError and onProgress are called, based on the XHR events. + * You shouldn't normally call this method directly, it's meant to be invoked by the Loader. * - * @name Phaser.Physics.Arcade.StaticBody#top - * @type {number} - * @readonly - * @since 3.0.0 + * @method Phaser.Loader.FileTypes.VideoFile#load + * @since 3.20.0 */ - top: { + load: function () + { + // We set these, but we don't actually load anything (the Video Game Object does that) - get: function () - { - return this.position.y; - } + this.src = GetURL(this, this.loader.baseURL); - }, + this.state = CONST.FILE_LOADED; - /** - * The lowest y coordinate of the area of the StaticBody. (y + height) - * - * @name Phaser.Physics.Arcade.StaticBody#bottom - * @type {number} - * @readonly - * @since 3.0.0 - */ - bottom: { + this.loader.nextFile(this, true); + } - get: function () +}); + +/** + * Adds a Video file, or array of video files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.video('intro', [ 'video/level1.mp4', 'video/level1.webm', 'video/level1.mov' ]); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global Video Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the Video Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the Video Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.video({ + * key: 'intro', + * url: [ 'video/level1.mp4', 'video/level1.webm', 'video/level1.mov' ], + * noAudio: true + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.VideoFileConfig` for more details. + * + * The URLs can be relative or absolute. If the URLs are relative the `Loader.baseURL` and `Loader.path` values will be prepended to them. + * + * Due to different browsers supporting different video file types you should usually provide your video files in a variety of formats. + * mp4, mov and webm are the most common. If you provide an array of URLs then the Loader will determine which _one_ file to load based on + * browser support, starting with the first in the array and progressing to the end. + * + * Unlike most asset-types, videos do not _need_ to be preloaded. You can create a Video Game Object and then call its `loadURL` method, + * to load a video at run-time, rather than in advance. + * + * Note: The ability to load this type of file will only be available if the Video File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#video + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.20.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.VideoFileConfig|Phaser.Types.Loader.FileTypes.VideoFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {(string|string[]|Phaser.Types.Loader.FileTypes.VideoFileURLConfig|Phaser.Types.Loader.FileTypes.VideoFileURLConfig[])} [urls] - The absolute or relative URL to load the video files from. + * @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('video', function (key, urls, noAudio) +{ + if (Array.isArray(key)) + { + for (var i = 0; i < key.length; i++) { - return this.position.y + this.height; + this.addFile(new VideoFile(this, key[i])); } - + } + else + { + this.addFile(new VideoFile(this, key, urls, noAudio)); } + return this; }); -module.exports = StaticBody; +module.exports = VideoFile; /***/ }), -/* 540 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 15297: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** -* @author Richard Davey -* @copyright 2020 Photon Storm Ltd. -* @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} -*/ + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -var Class = __webpack_require__(0); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12117); +var File = __webpack_require__(98035); +var FileTypesManager = __webpack_require__(76846); +var GetFastValue = __webpack_require__(72632); +var IsPlainObject = __webpack_require__(42911); +var ParseXML = __webpack_require__(89200); /** * @classdesc - * A Global Plugin is installed just once into the Game owned Plugin Manager. - * It can listen for Game events and respond to them. + * A single XML File suitable for loading by the Loader. * - * @class BasePlugin - * @memberof Phaser.Plugins + * These are created when you use the Phaser.Loader.LoaderPlugin#xml method and are not typically created directly. + * + * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#xml. + * + * @class XMLFile + * @extends Phaser.Loader.File + * @memberof Phaser.Loader.FileTypes * @constructor - * @since 3.8.0 + * @since 3.0.0 * - * @param {Phaser.Plugins.PluginManager} pluginManager - A reference to the Plugin Manager. + * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. + * @param {(string|Phaser.Types.Loader.FileTypes.XMLFileConfig)} key - The key to use for this file, or a file configuration object. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. */ -var BasePlugin = new Class({ +var XMLFile = new Class({ + + Extends: File, initialize: - function BasePlugin (pluginManager) + function XMLFile (loader, key, url, xhrSettings) { - /** - * A handy reference to the Plugin Manager that is responsible for this plugin. - * Can be used as a route to gain access to game systems and events. - * - * @name Phaser.Plugins.BasePlugin#pluginManager - * @type {Phaser.Plugins.PluginManager} - * @protected - * @since 3.8.0 - */ - this.pluginManager = pluginManager; + var extension = 'xml'; - /** - * A reference to the Game instance this plugin is running under. - * - * @name Phaser.Plugins.BasePlugin#game - * @type {Phaser.Game} - * @protected - * @since 3.8.0 - */ - this.game = pluginManager.game; - }, + if (IsPlainObject(key)) + { + var config = key; - /** - * The PluginManager calls this method on a Global Plugin when the plugin is first instantiated. - * It will never be called again on this instance. - * In here you can set-up whatever you need for this plugin to run. - * If a plugin is set to automatically start then `BasePlugin.start` will be called immediately after this. - * On a Scene Plugin, this method is never called. Use {@link Phaser.Plugins.ScenePlugin#boot} instead. - * - * @method Phaser.Plugins.BasePlugin#init - * @since 3.8.0 - * - * @param {?any} [data] - A value specified by the user, if any, from the `data` property of the plugin's configuration object (if started at game boot) or passed in the PluginManager's `install` method (if started manually). - */ - init: function () - { + key = GetFastValue(config, 'key'); + url = GetFastValue(config, 'url'); + xhrSettings = GetFastValue(config, 'xhrSettings'); + extension = GetFastValue(config, 'extension', extension); + } + + var fileConfig = { + type: 'xml', + cache: loader.cacheManager.xml, + extension: extension, + responseType: 'text', + key: key, + url: url, + xhrSettings: xhrSettings + }; + + File.call(this, loader, fileConfig); }, /** - * The PluginManager calls this method on a Global Plugin when the plugin is started. - * If a plugin is stopped, and then started again, this will get called again. - * Typically called immediately after `BasePlugin.init`. - * On a Scene Plugin, this method is never called. + * Called automatically by Loader.nextFile. + * This method controls what extra work this File does with its loaded data. * - * @method Phaser.Plugins.BasePlugin#start - * @since 3.8.0 + * @method Phaser.Loader.FileTypes.XMLFile#onProcess + * @since 3.7.0 */ - start: function () + onProcess: function () { - // Here are the game-level events you can listen to. - // At the very least you should offer a destroy handler for when the game closes down. + this.state = CONST.FILE_PROCESSING; - // var eventEmitter = this.game.events; + this.data = ParseXML(this.xhrLoader.responseText); - // eventEmitter.once('destroy', this.gameDestroy, this); - // eventEmitter.on('pause', this.gamePause, this); - // eventEmitter.on('resume', this.gameResume, this); - // eventEmitter.on('resize', this.gameResize, this); - // eventEmitter.on('prestep', this.gamePreStep, this); - // eventEmitter.on('step', this.gameStep, this); - // eventEmitter.on('poststep', this.gamePostStep, this); - // eventEmitter.on('prerender', this.gamePreRender, this); - // eventEmitter.on('postrender', this.gamePostRender, this); - }, + if (this.data) + { + this.onProcessComplete(); + } + else + { + this.onProcessError(); + } + } - /** - * The PluginManager calls this method on a Global Plugin when the plugin is stopped. - * The game code has requested that your plugin stop doing whatever it does. - * It is now considered as 'inactive' by the PluginManager. - * Handle that process here (i.e. stop listening for events, etc) - * If the plugin is started again then `BasePlugin.start` will be called again. - * On a Scene Plugin, this method is never called. - * - * @method Phaser.Plugins.BasePlugin#stop - * @since 3.8.0 - */ - stop: function () - { - }, +}); - /** - * Game instance has been destroyed. - * You must release everything in here, all references, all objects, free it all up. - * - * @method Phaser.Plugins.BasePlugin#destroy - * @since 3.8.0 - */ - destroy: function () +/** + * Adds an XML file, or array of XML files, to the current load queue. + * + * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + * + * ```javascript + * function preload () + * { + * this.load.xml('wavedata', 'files/AlienWaveData.xml'); + * } + * ``` + * + * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, + * or if it's already running, when the next free load slot becomes available. This happens automatically if you + * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued + * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. + * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the + * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been + * loaded. + * + * The key must be a unique String. It is used to add the file to the global XML Cache upon a successful load. + * The key should be unique both in terms of files being loaded and files already present in the XML Cache. + * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file + * then remove it from the XML Cache first, before loading a new one. + * + * Instead of passing arguments you can pass a configuration object, such as: + * + * ```javascript + * this.load.xml({ + * key: 'wavedata', + * url: 'files/AlienWaveData.xml' + * }); + * ``` + * + * See the documentation for `Phaser.Types.Loader.FileTypes.XMLFileConfig` for more details. + * + * Once the file has finished loading you can access it from its Cache using its key: + * + * ```javascript + * this.load.xml('wavedata', 'files/AlienWaveData.xml'); + * // and later in your game ... + * var data = this.cache.xml.get('wavedata'); + * ``` + * + * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files + * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and + * this is what you would use to retrieve the text from the XML Cache. + * + * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * + * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" + * and no URL is given then the Loader will set the URL to be "data.xml". It will always add `.xml` as the extension, although + * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * + * Note: The ability to load this type of file will only be available if the XML File type has been built into Phaser. + * It is available in the default build but can be excluded from custom builds. + * + * @method Phaser.Loader.LoaderPlugin#xml + * @fires Phaser.Loader.LoaderPlugin#ADD + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Loader.FileTypes.XMLFileConfig|Phaser.Types.Loader.FileTypes.XMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. + * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". + * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * + * @return {this} The Loader instance. + */ +FileTypesManager.register('xml', function (key, url, xhrSettings) +{ + if (Array.isArray(key)) { - this.pluginManager = null; - this.game = null; - this.scene = null; - this.systems = null; + for (var i = 0; i < key.length; i++) + { + // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object + this.addFile(new XMLFile(this, key[i])); + } + } + else + { + this.addFile(new XMLFile(this, key, url, xhrSettings)); } + return this; }); -module.exports = BasePlugin; +module.exports = XMLFile; /***/ }), -/* 541 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 34034: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector2 = __webpack_require__(3); - -var point = new Vector2(); - /** - * Checks if the given tile coordinate is within the isometric layer bounds, or not. - * - * @function Phaser.Tilemaps.Components.CheckIsoBounds - * @since 3.50.0 - * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to check against. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against. - * - * @return {boolean} Returns `true` if the coordinates are within the iso bounds. + * @namespace Phaser.Loader.FileTypes */ -var CheckIsoBounds = function (tileX, tileY, layer, camera) -{ - var tilemapLayer = layer.tilemapLayer; - var cullPaddingX = tilemapLayer.cullPaddingX; - var cullPaddingY = tilemapLayer.cullPaddingY; +module.exports = { - var pos = tilemapLayer.tilemap.tileToWorldXY(tileX, tileY, point, camera, tilemapLayer); + AnimationJSONFile: __webpack_require__(46468), + AsepriteFile: __webpack_require__(31648), + AtlasJSONFile: __webpack_require__(73152), + AtlasXMLFile: __webpack_require__(24616), + AudioFile: __webpack_require__(67448), + AudioSpriteFile: __webpack_require__(66109), + BinaryFile: __webpack_require__(40612), + BitmapFontFile: __webpack_require__(54565), + CompressedTextureFile: __webpack_require__(47375), + CSSFile: __webpack_require__(99898), + GLSLFile: __webpack_require__(46568), + HTML5AudioFile: __webpack_require__(30929), + HTMLFile: __webpack_require__(77459), + HTMLTextureFile: __webpack_require__(9755), + ImageFile: __webpack_require__(42927), + JSONFile: __webpack_require__(70806), + MultiAtlasFile: __webpack_require__(80802), + MultiScriptFile: __webpack_require__(39034), + OBJFile: __webpack_require__(85527), + PackFile: __webpack_require__(3616), + PluginFile: __webpack_require__(12217), + SceneFile: __webpack_require__(95171), + ScenePluginFile: __webpack_require__(82458), + ScriptFile: __webpack_require__(55188), + SpriteSheetFile: __webpack_require__(33536), + SVGFile: __webpack_require__(4474), + TextFile: __webpack_require__(86897), + TilemapCSVFile: __webpack_require__(58673), + TilemapImpactFile: __webpack_require__(98896), + TilemapJSONFile: __webpack_require__(50563), + UnityAtlasFile: __webpack_require__(82857), + VideoFile: __webpack_require__(22833), + XMLFile: __webpack_require__(15297) - // we always subtract 1/2 of the tile's height/width to make the culling distance start from the center of the tiles. - return pos.x > camera.worldView.x + tilemapLayer.scaleX * layer.tileWidth * (-cullPaddingX - 0.5) - && pos.x < camera.worldView.right + tilemapLayer.scaleX * layer.tileWidth * (cullPaddingX - 0.5) - && pos.y > camera.worldView.y + tilemapLayer.scaleY * layer.tileHeight * (-cullPaddingY - 1.0) - && pos.y < camera.worldView.bottom + tilemapLayer.scaleY * layer.tileHeight * (cullPaddingY - 0.5); }; -module.exports = CheckIsoBounds; - /***/ }), -/* 542 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 95695: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(26); +var CONST = __webpack_require__(12117); +var Extend = __webpack_require__(98611); /** - * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching - * `findIndex` and updates their index to match `newIndex`. This only modifies the index and does - * not change collision information. - * - * @function Phaser.Tilemaps.Components.ReplaceByIndex - * @since 3.0.0 - * - * @param {number} findIndex - The index of the tile to search for. - * @param {number} newIndex - The index of the tile to replace it with. - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @namespace Phaser.Loader */ -var ReplaceByIndex = function (findIndex, newIndex, tileX, tileY, width, height, layer) -{ - var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); - for (var i = 0; i < tiles.length; i++) - { - if (tiles[i] && tiles[i].index === findIndex) - { - tiles[i].index = newIndex; - } - } +var Loader = { + + Events: __webpack_require__(683), + + FileTypes: __webpack_require__(34034), + + File: __webpack_require__(98035), + FileTypesManager: __webpack_require__(76846), + GetURL: __webpack_require__(30750), + LoaderPlugin: __webpack_require__(67285), + MergeXHRSettings: __webpack_require__(43531), + MultiFile: __webpack_require__(45176), + XHRLoader: __webpack_require__(88490), + XHRSettings: __webpack_require__(33868) + }; -module.exports = ReplaceByIndex; +// Merge in the consts +Loader = Extend(false, Loader, CONST); + +module.exports = Loader; /***/ }), -/* 543 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 26042: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Rectangle = __webpack_require__(10); -var SnapCeil = __webpack_require__(139); -var SnapFloor = __webpack_require__(76); - -var bounds = new Rectangle(); - /** - * Returns the bounds in the given orthogonal layer that are within the cameras viewport. - * This is used internally by the cull tiles function. + * Calculate the mean average of the given values. * - * @function Phaser.Tilemaps.Components.CullBounds - * @since 3.50.0 + * @function Phaser.Math.Average + * @since 3.0.0 * - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {number[]} values - The values to average. * - * @return {Phaser.Geom.Rectangle} A rectangle containing the culled bounds. If you wish to retain this object, clone it, as it's recycled internally. + * @return {number} The average value. */ -var CullBounds = function (layer, camera) +var Average = function (values) { - var tilemap = layer.tilemapLayer.tilemap; - var tilemapLayer = layer.tilemapLayer; - - // We need to use the tile sizes defined for the map as a whole, not the layer, - // in order to calculate the bounds correctly. As different sized tiles may be - // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. - var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); - var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); - - var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; - var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; + var sum = 0; - var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, tileH, 0, true) - tilemapLayer.cullPaddingY; - var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, tileH, 0, true) + tilemapLayer.cullPaddingY; + for (var i = 0; i < values.length; i++) + { + sum += (+values[i]); + } - return bounds.setTo( - boundsLeft, - boundsTop, - (boundsRight - boundsLeft), - (boundsBottom - boundsTop) - ); + return sum / values.length; }; -module.exports = CullBounds; +module.exports = Average; /***/ }), -/* 544 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 22824: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CullBounds = __webpack_require__(543); -var RunCull = __webpack_require__(159); +var Factorial = __webpack_require__(8034); /** - * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * Calculates the Bernstein basis from the three factorial coefficients. * - * @function Phaser.Tilemaps.Components.CullTiles - * @since 3.50.0 + * @function Phaser.Math.Bernstein + * @since 3.0.0 * - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. - * @param {array} [outputArray] - An optional array to store the Tile objects within. - * @param {number} [renderOrder=0] - The rendering order constant. + * @param {number} n - The first value. + * @param {number} i - The second value. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @return {number} The Bernstein basis of Factorial(n) / Factorial(i) / Factorial(n - i) */ -var CullTiles = function (layer, camera, outputArray, renderOrder) +var Bernstein = function (n, i) { - if (outputArray === undefined) { outputArray = []; } - if (renderOrder === undefined) { renderOrder = 0; } - - outputArray.length = 0; - - var tilemapLayer = layer.tilemapLayer; - - // Camera world view bounds, snapped for scaled tile size - // Cull Padding values are given in tiles, not pixels - var bounds = CullBounds(layer, camera); - - if (tilemapLayer.skipCull || tilemapLayer.scrollFactorX !== 1 || tilemapLayer.scrollFactorY !== 1) - { - bounds.left = 0; - bounds.right = layer.width; - bounds.top = 0; - bounds.bottom = layer.height; - } - - RunCull(layer, bounds, renderOrder, outputArray); - - return outputArray; + return Factorial(n) / Factorial(i) / Factorial(n - i); }; -module.exports = CullTiles; +module.exports = Bernstein; /***/ }), -/* 545 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 17489: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CullBounds = __webpack_require__(546); -var RunCull = __webpack_require__(159); - /** - * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * Compute a random integer between the `min` and `max` values, inclusive. * - * @function Phaser.Tilemaps.Components.HexagonalCullTiles - * @since 3.50.0 + * @function Phaser.Math.Between + * @since 3.0.0 * - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. - * @param {array} [outputArray] - An optional array to store the Tile objects within. - * @param {number} [renderOrder=0] - The rendering order constant. + * @param {number} min - The minimum value. + * @param {number} max - The maximum value. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @return {number} The random integer. */ -var HexagonalCullTiles = function (layer, camera, outputArray, renderOrder) +var Between = function (min, max) { - if (outputArray === undefined) { outputArray = []; } - if (renderOrder === undefined) { renderOrder = 0; } - - outputArray.length = 0; - - var tilemapLayer = layer.tilemapLayer; - - if (!tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1) - { - // Camera world view bounds, snapped for scaled tile size - // Cull Padding values are given in tiles, not pixels - - var bounds = CullBounds(layer, camera); - - RunCull(layer, bounds, renderOrder, outputArray); - } - - return outputArray; + return Math.floor(Math.random() * (max - min + 1) + min); }; -module.exports = HexagonalCullTiles; +module.exports = Between; /***/ }), -/* 546 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 14976: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SnapCeil = __webpack_require__(139); -var SnapFloor = __webpack_require__(76); - /** - * Returns the bounds in the given layer that are within the camera's viewport. - * This is used internally by the cull tiles function. + * Calculates a Catmull-Rom value from the given points, based on an alpha of 0.5. * - * @function Phaser.Tilemaps.Components.HexagonalCullBounds - * @since 3.50.0 + * @function Phaser.Math.CatmullRom + * @since 3.0.0 * - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {number} t - The amount to interpolate by. + * @param {number} p0 - The first control point. + * @param {number} p1 - The second control point. + * @param {number} p2 - The third control point. + * @param {number} p3 - The fourth control point. * - * @return {object} An object containing the `left`, `right`, `top` and `bottom` bounds. + * @return {number} The Catmull-Rom value. */ -var HexagonalCullBounds = function (layer, camera) +var CatmullRom = function (t, p0, p1, p2, p3) { - var tilemap = layer.tilemapLayer.tilemap; - var tilemapLayer = layer.tilemapLayer; - - // We need to use the tile sizes defined for the map as a whole, not the layer, - // in order to calculate the bounds correctly. As different sized tiles may be - // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. - var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); - var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); - - var len = layer.hexSideLength; - var rowH = ((tileH - len) / 2 + len); - - var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; - var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; - - var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, rowH, 0, true) - tilemapLayer.cullPaddingY; - var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, rowH, 0, true) + tilemapLayer.cullPaddingY; + var v0 = (p2 - p0) * 0.5; + var v1 = (p3 - p1) * 0.5; + var t2 = t * t; + var t3 = t * t2; - return { - left: boundsLeft, - right: boundsRight, - top: boundsTop, - bottom: boundsBottom - }; + return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; }; -module.exports = HexagonalCullBounds; +module.exports = CatmullRom; /***/ }), -/* 547 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 89129: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CheckIsoBounds = __webpack_require__(541); - /** - * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * Ceils to some place comparative to a `base`, default is 10 for decimal place. * - * @function Phaser.Tilemaps.Components.IsometricCullTiles - * @since 3.50.0 + * The `place` is represented by the power applied to `base` to get that place. * - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. - * @param {array} [outputArray] - An optional array to store the Tile objects within. - * @param {number} [renderOrder=0] - The rendering order constant. + * @function Phaser.Math.CeilTo + * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @param {number} value - The value to round. + * @param {number} [place=0] - The place to round to. + * @param {number} [base=10] - The base to round in. Default is 10 for decimal. + * + * @return {number} The rounded value. */ -var IsometricCullTiles = function (layer, camera, outputArray, renderOrder) +var CeilTo = function (value, place, base) { - if (outputArray === undefined) { outputArray = []; } - if (renderOrder === undefined) { renderOrder = 0; } - - outputArray.length = 0; - - var tilemapLayer = layer.tilemapLayer; - - var mapData = layer.data; - var mapWidth = layer.width; - var mapHeight = layer.height; - - var drawLeft = 0; - var drawRight = mapWidth; - var drawTop = 0; - var drawBottom = mapHeight; - - if (!tilemapLayer.skipCull) - { - var x; - var y; - var tile; - - if (renderOrder === 0) - { - // right-down - - for (y = drawTop; y < drawBottom; y++) - { - for (x = drawLeft; mapData[y] && x < drawRight; x++) - { - if (CheckIsoBounds(x, y, layer, camera)) - { - tile = mapData[y][x]; - - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } - - outputArray.push(tile); - } - } - } - } - else if (renderOrder === 1) - { - // left-down - - for (y = drawTop; y < drawBottom; y++) - { - for (x = drawRight; mapData[y] && x >= drawLeft; x--) - { - if (CheckIsoBounds(x, y, layer, camera)) - { - tile = mapData[y][x]; - - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } - - outputArray.push(tile); - } - } - } - } - else if (renderOrder === 2) - { - // right-up + if (place === undefined) { place = 0; } + if (base === undefined) { base = 10; } - for (y = drawBottom; y >= drawTop; y--) - { - for (x = drawLeft; mapData[y] && x < drawRight; x++) - { - if (CheckIsoBounds(x, y, layer, camera)) - { - tile = mapData[y][x]; + var p = Math.pow(base, -place); - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } + return Math.ceil(value * p) / p; +}; - outputArray.push(tile); - } - } - } - } - else if (renderOrder === 3) - { - // left-up +module.exports = CeilTo; - for (y = drawBottom; y >= drawTop; y--) - { - for (x = drawRight; mapData[y] && x >= drawLeft; x--) - { - if (CheckIsoBounds(x, y, layer, camera)) - { - tile = mapData[y][x]; - if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) - { - continue; - } +/***/ }), - outputArray.push(tile); - } - } - } - } - } +/***/ 82897: +/***/ ((module) => { - tilemapLayer.tilesDrawn = outputArray.length; - tilemapLayer.tilesTotal = mapWidth * mapHeight; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return outputArray; +/** + * Force a value within the boundaries by clamping it to the range `min`, `max`. + * + * @function Phaser.Math.Clamp + * @since 3.0.0 + * + * @param {number} value - The value to be clamped. + * @param {number} min - The minimum bounds. + * @param {number} max - The maximum bounds. + * + * @return {number} The clamped value. + */ +var Clamp = function (value, min, max) +{ + return Math.max(min, Math.min(max, value)); }; -module.exports = IsometricCullTiles; +module.exports = Clamp; /***/ }), -/* 548 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 75606: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CullBounds = __webpack_require__(549); -var RunCull = __webpack_require__(159); +var CONST = __webpack_require__(83392); /** - * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * Convert the given angle from degrees, to the equivalent angle in radians. * - * @function Phaser.Tilemaps.Components.StaggeredCullTiles - * @since 3.50.0 + * @function Phaser.Math.DegToRad + * @since 3.0.0 * - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. - * @param {array} [outputArray] - An optional array to store the Tile objects within. - * @param {number} [renderOrder=0] - The rendering order constant. + * @param {number} degrees - The angle (in degrees) to convert to radians. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @return {number} The given angle converted to radians. */ -var StaggeredCullTiles = function (layer, camera, outputArray, renderOrder) +var DegToRad = function (degrees) { - if (outputArray === undefined) { outputArray = []; } - if (renderOrder === undefined) { renderOrder = 0; } - - outputArray.length = 0; - - var tilemapLayer = layer.tilemapLayer; - - if (!tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1) - { - // Camera world view bounds, snapped for scaled tile size - // Cull Padding values are given in tiles, not pixels - - var bounds = CullBounds(layer, camera); - - RunCull(layer, bounds, renderOrder, outputArray); - } - - return outputArray; + return degrees * CONST.DEG_TO_RAD; }; -module.exports = StaggeredCullTiles; +module.exports = DegToRad; /***/ }), -/* 549 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 767: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SnapCeil = __webpack_require__(139); -var SnapFloor = __webpack_require__(76); - /** - * Returns the bounds in the given layer that are within the camera's viewport. - * This is used internally by the cull tiles function. + * Calculates the positive difference of two given numbers. * - * @function Phaser.Tilemaps.Components.StaggeredCullBounds - * @since 3.50.0 + * @function Phaser.Math.Difference + * @since 3.0.0 * - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {number} a - The first number in the calculation. + * @param {number} b - The second number in the calculation. * - * @return {object} An object containing the `left`, `right`, `top` and `bottom` bounds. + * @return {number} The positive difference of the two given numbers. */ -var StaggeredCullBounds = function (layer, camera) +var Difference = function (a, b) { - var tilemap = layer.tilemapLayer.tilemap; - var tilemapLayer = layer.tilemapLayer; - - // We need to use the tile sizes defined for the map as a whole, not the layer, - // in order to calculate the bounds correctly. As different sized tiles may be - // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. - var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); - var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); - - var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; - var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; - - var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, tileH / 2, 0, true) - tilemapLayer.cullPaddingY; - var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, tileH / 2, 0, true) + tilemapLayer.cullPaddingY; - - return { - left: boundsLeft, - right: boundsRight, - top: boundsTop, - bottom: boundsBottom - }; + return Math.abs(a - b); }; -module.exports = StaggeredCullBounds; +module.exports = Difference; /***/ }), -/* 550 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 9849: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector2 = __webpack_require__(3); +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var Matrix4 = __webpack_require__(16650); +var NOOP = __webpack_require__(72283); + +var tempMatrix = new Matrix4(); /** - * Converts from hexagonal tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the - * layer's position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. + * @classdesc * - * @function Phaser.Tilemaps.Components.HexagonalTileToWorldXY + * @class Euler + * @memberof Phaser.Math + * @constructor * @since 3.50.0 * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Math.Vector2} The XY location in world coordinates. + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. */ -var HexagonalTileToWorldXY = function (tileX, tileY, point, camera, layer) -{ - if (!point) { point = new Vector2(); } - - var tileWidth = layer.baseTileWidth; - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; +var Euler = new Class({ - var layerWorldX = 0; - var layerWorldY = 0; + initialize: - if (tilemapLayer) + function Euler (x, y, z, order) { - if (!camera) { camera = tilemapLayer.scene.cameras.main; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (z === undefined) { z = 0; } + if (order === undefined) { order = Euler.DefaultOrder; } - layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + this._x = x; + this._y = y; + this._z = z; + this._order = order; - tileWidth *= tilemapLayer.scaleX; + this.onChangeCallback = NOOP; + }, - layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + x: { + get: function () + { + return this._x; + }, - tileHeight *= tilemapLayer.scaleY; - } + set: function (value) + { + this._x = value; - var len = layer.hexSideLength; - var rowHeight = ((tileHeight - len) / 2 + len); + this.onChangeCallback(this); + } + }, - // similar to staggered, because Tiled uses the oddr representation. - var x = layerWorldX + tileX * tileWidth + tileY % 2 * (tileWidth / 2); - var y = layerWorldY + tileY * rowHeight; + y: { + get: function () + { + return this._y; + }, - return point.set(x, y); -}; + set: function (value) + { + this._y = value; -module.exports = HexagonalTileToWorldXY; + this.onChangeCallback(this); + } + }, + + z: { + get: function () + { + return this._z; + }, + set: function (value) + { + this._z = value; -/***/ }), -/* 551 */ -/***/ (function(module, exports, __webpack_require__) { + this.onChangeCallback(this); + } + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + order: { + get: function () + { + return this._order; + }, -var Vector2 = __webpack_require__(3); + set: function (value) + { + this._order = value; -/** - * Converts from isometric tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the - * layer's position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @function Phaser.Tilemaps.Components.IsometricTileToWorldXY - * @since 3.50.0 - * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Math.Vector2} The XY location in world coordinates. - */ -var IsometricTileToWorldXY = function (tileX, tileY, point, camera, layer) -{ - if (!point) { point = new Vector2(); } + this.onChangeCallback(this); + } + }, - var tileWidth = layer.baseTileWidth; - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; + set: function (x, y, z, order) + { + if (order === undefined) { order = this._order; } - var layerWorldX = 0; - var layerWorldY = 0; + this._x = x; + this._y = y; + this._z = z; + this._order = order; - if (tilemapLayer) + this.onChangeCallback(this); + + return this; + }, + + copy: function (euler) { - if (!camera) { camera = tilemapLayer.scene.cameras.main; } + return this.set(euler.x, euler.y, euler.z, euler.order); + }, - layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + setFromQuaternion: function (quaternion, order, update) + { + if (order === undefined) { order = this._order; } + if (update === undefined) { update = false; } - tileWidth *= tilemapLayer.scaleX; + tempMatrix.fromQuat(quaternion); - layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + return this.setFromRotationMatrix(tempMatrix, order, update); + }, - tileHeight *= tilemapLayer.scaleY; - } + setFromRotationMatrix: function (matrix, order, update) + { + if (order === undefined) { order = this._order; } + if (update === undefined) { update = false; } - var x = layerWorldX + (tileX - tileY) * (tileWidth / 2); - var y = layerWorldY + (tileX + tileY) * (tileHeight / 2); + var elements = matrix.val; - return point.set(x, y); -}; + // Upper 3x3 of matrix is un-scaled rotation matrix + var m11 = elements[0]; + var m12 = elements[4]; + var m13 = elements[8]; + var m21 = elements[1]; + var m22 = elements[5]; + var m23 = elements[9]; + var m31 = elements[2]; + var m32 = elements[6]; + var m33 = elements[10]; -module.exports = IsometricTileToWorldXY; + var x = 0; + var y = 0; + var z = 0; + var epsilon = 0.99999; + switch (order) + { + case 'XYZ': + { + y = Math.asin(Clamp(m13, -1, 1)); -/***/ }), -/* 552 */ -/***/ (function(module, exports, __webpack_require__) { + if (Math.abs(m13) < epsilon) + { + x = Math.atan2(-m23, m33); + z = Math.atan2(-m12, m11); + } + else + { + x = Math.atan2(m32, m22); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + break; + } -var Vector2 = __webpack_require__(3); + case 'YXZ': + { + x = Math.asin(-Clamp(m23, -1, 1)); -/** - * Converts from staggered tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the - * layer's position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @function Phaser.Tilemaps.Components.StaggeredTileToWorldXY - * @since 3.50.0 - * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Math.Vector2} The XY location in world coordinates. - */ -var StaggeredTileToWorldXY = function (tileX, tileY, point, camera, layer) -{ - if (!point) { point = new Vector2(); } + if (Math.abs(m23) < epsilon) + { + y = Math.atan2(m13, m33); + z = Math.atan2(m21, m22); + } + else + { + y = Math.atan2(-m31, m11); + } - var tileWidth = layer.baseTileWidth; - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; + break; + } - var layerWorldX = 0; - var layerWorldY = 0; + case 'ZXY': + { + x = Math.asin(Clamp(m32, -1, 1)); - if (tilemapLayer) - { - if (!camera) { camera = tilemapLayer.scene.cameras.main; } + if (Math.abs(m32) < epsilon) + { + y = Math.atan2(-m31, m33); + z = Math.atan2(-m12, m22); + } + else + { + z = Math.atan2(m21, m11); + } - layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + break; + } - tileWidth *= tilemapLayer.scaleX; + case 'ZYX': + { + y = Math.asin(-Clamp(m31, -1, 1)); - layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + if (Math.abs(m31) < epsilon) + { + x = Math.atan2(m32, m33); + z = Math.atan2(m21, m11); + } + else + { + z = Math.atan2(-m12, m22); + } - tileHeight *= tilemapLayer.scaleY; + break; + } + + case 'YZX': + { + z = Math.asin(Clamp(m21, -1, 1)); + + if (Math.abs(m21) < epsilon) + { + x = Math.atan2(-m23, m22); + y = Math.atan2(-m31, m11); + } + else + { + y = Math.atan2(m13, m33); + } + + break; + } + + case 'XZY': + { + z = Math.asin(-Clamp(m12, -1, 1)); + + if (Math.abs(m12) < epsilon) + { + x = Math.atan2(m32, m22); + y = Math.atan2(m13, m11); + } + else + { + x = Math.atan2(-m23, m33); + } + + break; + } + } + + this._x = x; + this._y = y; + this._z = z; + this._order = order; + + if (update) + { + this.onChangeCallback(this); + } + + return this; } - var x = layerWorldX + tileX * tileWidth + tileY % 2 * (tileWidth / 2); - var y = layerWorldY + tileY * (tileHeight / 2); +}); - return point.set(x, y); -}; +Euler.RotationOrders = [ 'XYZ', 'YXZ', 'ZXY', 'ZYX', 'YZX', 'XZY' ]; -module.exports = StaggeredTileToWorldXY; +Euler.DefaultOrder = 'XYZ'; + +module.exports = Euler; /***/ }), -/* 553 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 8034: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TileToWorldX = __webpack_require__(253); -var TileToWorldY = __webpack_require__(254); -var Vector2 = __webpack_require__(3); - /** - * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the - * layer's position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. + * Calculates the factorial of a given number for integer values greater than 0. * - * @function Phaser.Tilemaps.Components.TileToWorldXY + * @function Phaser.Math.Factorial * @since 3.0.0 * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {number} value - A positive integer to calculate the factorial of. * - * @return {Phaser.Math.Vector2} The XY location in world coordinates. + * @return {number} The factorial of the given number. */ -var TileToWorldXY = function (tileX, tileY, point, camera, layer) +var Factorial = function (value) { - if (!point) { point = new Vector2(0, 0); } + if (value === 0) + { + return 1; + } - point.x = TileToWorldX(tileX, camera, layer); - point.y = TileToWorldY(tileY, camera, layer); + var res = value; - return point; + while (--value) + { + res *= value; + } + + return res; }; -module.exports = TileToWorldXY; +module.exports = Factorial; /***/ }), -/* 554 */ -/***/ (function(module, exports) { + +/***/ 61616: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Converts from hexagonal tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the - * layer's position, scale and scroll. + * Generate a random floating point number between the two given bounds, minimum inclusive, maximum exclusive. * - * @function Phaser.Tilemaps.Components.HexagonalTileToWorldY - * @since 3.50.0 + * @function Phaser.Math.FloatBetween + * @since 3.0.0 * - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {number} min - The lower bound for the float, inclusive. + * @param {number} max - The upper bound for the float exclusive. * - * @return {number} The Y location in world coordinates. + * @return {number} A random float within the given range. */ -var HexagonalTileToWorldY = function (tileY, camera, layer) +var FloatBetween = function (min, max) { - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; - var layerWorldY = 0; - - if (tilemapLayer) - { - if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } - - layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - - tileHeight *= tilemapLayer.scaleY; - } - - var len = tilemapLayer.tilemap.hexSideLength; - - var rowHeight = ((tileHeight - len) / 2 + len); - - return layerWorldY + tileY * rowHeight; + return Math.random() * (max - min) + min; }; -module.exports = HexagonalTileToWorldY; +module.exports = FloatBetween; /***/ }), -/* 555 */ -/***/ (function(module, exports) { + +/***/ 60679: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Converts from staggered tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the - * layers position, scale and scroll. + * Floors to some place comparative to a `base`, default is 10 for decimal place. * - * @function Phaser.Tilemaps.Components.StaggeredTileToWorldY - * @since 3.50.0 + * The `place` is represented by the power applied to `base` to get that place. * - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @function Phaser.Math.FloorTo + * @since 3.0.0 * - * @return {number} The Y location in world coordinates. + * @param {number} value - The value to round. + * @param {number} [place=0] - The place to round to. + * @param {number} [base=10] - The base to round in. Default is 10 for decimal. + * + * @return {number} The rounded value. */ -var StaggeredTileToWorldY = function (tileY, camera, layer) +var FloorTo = function (value, place, base) { - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; - var layerWorldY = 0; - - if (tilemapLayer) - { - if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } - - layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + if (place === undefined) { place = 0; } + if (base === undefined) { base = 10; } - tileHeight *= tilemapLayer.scaleY; - } + var p = Math.pow(base, -place); - return layerWorldY + tileY * (tileHeight / 2); + return Math.floor(value * p) / p; }; -module.exports = StaggeredTileToWorldY; +module.exports = FloorTo; /***/ }), -/* 556 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 91806: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector2 = __webpack_require__(3); +var Clamp = __webpack_require__(82897); /** - * Converts from world XY coordinates (pixels) to hexagonal tile XY coordinates (tile units), factoring in the - * layer's position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. + * Return a value based on the range between `min` and `max` and the percentage given. * - * @function Phaser.Tilemaps.Components.HexagonalWorldToTileXY - * @since 3.50.0 + * @function Phaser.Math.FromPercent + * @since 3.0.0 * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} snapToFloor - Whether or not to round the tile coordinates down to the nearest integer. - * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {number} percent - A value between 0 and 1 representing the percentage. + * @param {number} min - The minimum value. + * @param {number} [max] - The maximum value. * - * @return {Phaser.Math.Vector2} The XY location in tile units. + * @return {number} The value that is `percent` percent between `min` and `max`. */ -var HexagonalWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +var FromPercent = function (percent, min, max) { - if (!point) { point = new Vector2(); } - - var tileWidth = layer.baseTileWidth; - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; - - if (tilemapLayer) - { - if (!camera) { camera = tilemapLayer.scene.cameras.main; } - - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's vertical scroll - - worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - - tileHeight *= tilemapLayer.scaleY; - - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's horizontal scroll - - worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); - - tileWidth *= tilemapLayer.scaleX; - } - - var len = layer.hexSideLength; - var rowHeight = ((tileHeight - len) / 2 + len); - - // similar to staggered, because Tiled uses the oddr representation. - var y = (snapToFloor) ? Math.floor((worldY / rowHeight)) : (worldY / rowHeight); - var x = (snapToFloor) ? Math.floor((worldX - (y % 2) * 0.5 * tileWidth) / tileWidth) : (worldX - (y % 2) * 0.5 * tileWidth) / tileWidth; + percent = Clamp(percent, 0, 1); - return point.set(x, y); + return (max - min) * percent + min; }; -module.exports = HexagonalWorldToTileXY; +module.exports = FromPercent; /***/ }), -/* 557 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 79366: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector2 = __webpack_require__(3); - /** - * Converts from world XY coordinates (pixels) to isometric tile XY coordinates (tile units), factoring in the - * layer's position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. + * Calculate a per-ms speed from a distance and time (given in seconds). * - * @function Phaser.Tilemaps.Components.IsometricWorldToTileXY - * @since 3.50.0 + * @function Phaser.Math.GetSpeed + * @since 3.0.0 * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {number} distance - The distance. + * @param {number} time - The time, in seconds. * - * @return {Phaser.Math.Vector2} The XY location in tile units. + * @return {number} The speed, in distance per ms. + * + * @example + * // 400px over 1 second is 0.4 px/ms + * Phaser.Math.GetSpeed(400, 1) // -> 0.4 */ -var IsometricWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +var GetSpeed = function (distance, time) { - if (!point) { point = new Vector2(); } - - var tileWidth = layer.baseTileWidth; - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; - - if (tilemapLayer) - { - if (!camera) { camera = tilemapLayer.scene.cameras.main; } - - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's vertical scroll - - worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - - tileHeight *= tilemapLayer.scaleY; - - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's horizontal scroll - - worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); - - tileWidth *= tilemapLayer.scaleX; - } - - var x = (snapToFloor) ? Math.floor((worldX / (tileWidth / 2) + worldY / (tileHeight / 2)) / 2) : ((worldX / (tileWidth / 2) + worldY / (tileHeight / 2)) / 2); - var y = (snapToFloor) ? Math.floor((worldY / (tileHeight / 2) - worldX / (tileWidth / 2)) / 2) : ((worldY / (tileHeight / 2) - worldX / (tileWidth / 2)) / 2); - - return point.set(x, y); + return (distance / time) / 1000; }; -module.exports = IsometricWorldToTileXY; +module.exports = GetSpeed; /***/ }), -/* 558 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 43776: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector2 = __webpack_require__(3); - /** - * Converts from world XY coordinates (pixels) to staggered tile XY coordinates (tile units), factoring in the - * layer's position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. + * Check if a given value is an even number. * - * @function Phaser.Tilemaps.Components.StaggeredWorldToTileXY - * @since 3.50.0 + * @function Phaser.Math.IsEven + * @since 3.0.0 * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {number} value - The number to perform the check with. * - * @return {Phaser.Math.Vector2} The XY location in tile units. + * @return {boolean} Whether the number is even or not. */ -var StaggeredWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +var IsEven = function (value) { - if (!point) { point = new Vector2(); } - - var tileWidth = layer.baseTileWidth; - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; - - if (tilemapLayer) - { - if (!camera) { camera = tilemapLayer.scene.cameras.main; } - - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's vertical scroll - - worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - - tileHeight *= tilemapLayer.scaleY; - - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's horizontal scroll - - worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); - - tileWidth *= tilemapLayer.scaleX; - } - - var y = (snapToFloor) ? Math.floor((worldY / (tileHeight / 2))) : (worldY / (tileHeight / 2)); - var x = (snapToFloor) ? Math.floor((worldX + (y % 2) * 0.5 * tileWidth) / tileWidth) : (worldX + (y % 2) * 0.5 * tileWidth) / tileWidth; + // Use abstract equality == for "is number" test - return point.set(x, y); + // eslint-disable-next-line eqeqeq + return (value == parseFloat(value)) ? !(value % 2) : void 0; }; -module.exports = StaggeredWorldToTileXY; +module.exports = IsEven; /***/ }), -/* 559 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 58442: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var WorldToTileX = __webpack_require__(255); -var WorldToTileY = __webpack_require__(256); -var Vector2 = __webpack_require__(3); - /** - * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the - * layer's position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. + * Check if a given value is an even number using a strict type check. * - * @function Phaser.Tilemaps.Components.WorldToTileXY + * @function Phaser.Math.IsEvenStrict * @since 3.0.0 * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {number} value - The number to perform the check with. * - * @return {Phaser.Math.Vector2} The XY location in tile units. + * @return {boolean} Whether the number is even or not. */ -var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +var IsEvenStrict = function (value) { - if (snapToFloor === undefined) { snapToFloor = true; } - if (!point) { point = new Vector2(0, 0); } - - point.x = WorldToTileX(worldX, snapToFloor, camera, layer); - point.y = WorldToTileY(worldY, snapToFloor, camera, layer); - - return point; + // Use strict equality === for "is number" test + return (value === parseFloat(value)) ? !(value % 2) : void 0; }; -module.exports = WorldToTileXY; +module.exports = IsEvenStrict; /***/ }), -/* 560 */ -/***/ (function(module, exports) { + +/***/ 42798: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Converts from world Y coordinates (pixels) to hexagonal tile Y coordinates (tile units), factoring in the - * layers position, scale and scroll. + * Calculates a linear (interpolation) value over t. * - * @function Phaser.Tilemaps.Components.HexagonalWorldToTileY - * @since 3.50.0 + * @function Phaser.Math.Linear + * @since 3.0.0 * - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {number} p0 - The first point. + * @param {number} p1 - The second point. + * @param {number} t - The percentage between p0 and p1 to return, represented as a number between 0 and 1. * - * @return {number} The Y location in tile units. + * @return {number} The step t% of the way between p0 and p1. */ -var HexagonalWorldToTileY = function (worldY, snapToFloor, camera, layer) +var Linear = function (p0, p1, t) { - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; + return (p1 - p0) * t + p0; +}; - if (tilemapLayer) - { - if (!camera) { camera = tilemapLayer.scene.cameras.main; } +module.exports = Linear; - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's vertical scroll - worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); +/***/ }), - tileHeight *= tilemapLayer.scaleY; - } +/***/ 61072: +/***/ ((module) => { - var len = layer.hexSideLength; +/** + * @author Greg McLean + * @copyright 2021 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var rowHeight = ((tileHeight - len) / 2 + len); +/** + * Interpolates two given Vectors and returns a new Vector between them. + * + * Does not modify either of the passed Vectors. + * + * @function Phaser.Math.LinearXY + * @since 3.60.0 + * + * @param {Phaser.Math.Vector2} vector1 - Starting vector + * @param {Phaser.Math.Vector2} vector2 - Ending vector + * @param {number} [t=0] - The percentage between vector1 and vector2 to return, represented as a number between 0 and 1. + * + * @return {Phaser.Math.Vector2} The step t% of the way between vector1 and vector2. + */ +var LinearXY = function (vector1, vector2, t) +{ + if (t === undefined) { t = 0; } - return (snapToFloor) ? Math.floor(worldY / rowHeight) : worldY / rowHeight; + return vector1.clone().lerp(vector2, t); }; -module.exports = HexagonalWorldToTileY; +module.exports = LinearXY; /***/ }), -/* 561 */ -/***/ (function(module, exports) { + +/***/ 5341: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * Converts from world Y coordinates (pixels) to staggered tile Y coordinates (tile units), factoring in the - * layers position, scale and scroll. - * - * @function Phaser.Tilemaps.Components.StaggeredWorldToTileY - * @since 3.50.0 - * - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {number} The Y location in tile units. - */ -var StaggeredWorldToTileY = function (worldY, snapToFloor, camera, layer) -{ - var tileHeight = layer.baseTileHeight; - var tilemapLayer = layer.tilemapLayer; - - if (tilemapLayer) - { - if (!camera) { camera = tilemapLayer.scene.cameras.main; } - - // Find the world position relative to the static or dynamic layer's top left origin, - // factoring in the camera's vertical scroll - - worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - - tileHeight *= tilemapLayer.scaleY; - } - - return (snapToFloor) ? Math.floor(worldY / (tileHeight / 2)) : worldY / (tileHeight / 2); -}; - -module.exports = StaggeredWorldToTileY; - - -/***/ }), -/* 562 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl -var IsInLayerBounds = __webpack_require__(119); +var Class = __webpack_require__(56694); /** - * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns - * false if there is no tile or if the tile at that location has an index of -1. + * @classdesc + * A three-dimensional matrix. * - * @function Phaser.Tilemaps.Components.HasTileAt - * @since 3.0.0 + * Defaults to the identity matrix when instantiated. * - * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @class Matrix3 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 * - * @return {?boolean} Returns a boolean, or null if the layer given was invalid. + * @param {Phaser.Math.Matrix3} [m] - Optional Matrix3 to copy values from. */ -var HasTileAt = function (tileX, tileY, layer) -{ - if (IsInLayerBounds(tileX, tileY, layer)) - { - var tile = layer.data[tileY][tileX]; +var Matrix3 = new Class({ - return (tile !== null && tile.index > -1); - } - else + initialize: + + function Matrix3 (m) { - return false; - } -}; + /** + * The matrix values. + * + * @name Phaser.Math.Matrix3#val + * @type {Float32Array} + * @since 3.0.0 + */ + this.val = new Float32Array(9); -module.exports = HasTileAt; + if (m) + { + // Assume Matrix3 with val: + this.copy(m); + } + else + { + // Default to identity + this.identity(); + } + }, + /** + * Make a clone of this Matrix3. + * + * @method Phaser.Math.Matrix3#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} A clone of this Matrix3. + */ + clone: function () + { + return new Matrix3(this); + }, -/***/ }), -/* 563 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * This method is an alias for `Matrix3.copy`. + * + * @method Phaser.Math.Matrix3#set + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} src - The Matrix to set the values of this Matrix's from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + set: function (src) + { + return this.copy(src); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Copy the values of a given Matrix into this Matrix. + * + * @method Phaser.Math.Matrix3#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} src - The Matrix to copy the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + copy: function (src) + { + var out = this.val; + var a = src.val; -var Tile = __webpack_require__(85); -var IsInLayerBounds = __webpack_require__(119); -var CalculateFacesAt = __webpack_require__(252); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; -/** - * Removes the tile at the given tile coordinates in the specified layer and updates the layer's - * collision information. - * - * @function Phaser.Tilemaps.Components.RemoveTileAt - * @since 3.0.0 - * - * @param {number} tileX - The x coordinate. - * @param {number} tileY - The y coordinate. - * @param {boolean} replaceWithNull - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile} The Tile object that was removed. - */ -var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, layer) -{ - if (replaceWithNull === undefined) { replaceWithNull = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } + return this; + }, - if (!IsInLayerBounds(tileX, tileY, layer)) + /** + * Copy the values of a given Matrix4 into this Matrix3. + * + * @method Phaser.Math.Matrix3#fromMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} m - The Matrix4 to copy the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + fromMat4: function (m) { - return null; - } + var a = m.val; + var out = this.val; - var tile = layer.data[tileY][tileX]; + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; - if (!tile) - { - return null; - } - else - { - layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, layer.tileWidth, layer.tileHeight); - } + return this; + }, - // Recalculate faces only if the removed tile was a colliding tile - if (recalculateFaces && tile && tile.collides) + /** + * Set the values of this Matrix from the given array. + * + * @method Phaser.Math.Matrix3#fromArray + * @since 3.0.0 + * + * @param {array} a - The array to copy the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + fromArray: function (a) { - CalculateFacesAt(tileX, tileY, layer); - } - - return tile; -}; - -module.exports = RemoveTileAt; + var out = this.val; + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; -/***/ }), -/* 564 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Reset this Matrix to an identity (default) matrix. + * + * @method Phaser.Math.Matrix3#identity + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + identity: function () + { + var out = this.val; -var Formats = __webpack_require__(40); -var Parse2DArray = __webpack_require__(259); -var ParseCSV = __webpack_require__(565); -var ParseJSONTiled = __webpack_require__(566); -var ParseWeltmeister = __webpack_require__(577); + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; -/** - * Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format - * is found, returns `null`. When loading from CSV or a 2D array, you should specify the tileWidth & - * tileHeight. When parsing from a map from Tiled, the tileWidth & tileHeight will be pulled from - * the map data. - * - * @function Phaser.Tilemaps.Parsers.Parse - * @since 3.0.0 - * - * @param {string} name - The name of the tilemap, used to set the name on the MapData. - * @param {number} mapFormat - See ../Formats.js. - * @param {(number[][]|string|object)} data - 2D array, CSV string or Tiled JSON object. - * @param {number} tileWidth - The width of a tile in pixels. Required for 2D array and CSV, but - * ignored for Tiled JSON. - * @param {number} tileHeight - The height of a tile in pixels. Required for 2D array and CSV, but - * ignored for Tiled JSON. - * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map - * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty - * location will get a Tile object with an index of -1. If you've a large sparsely populated map and - * the tile data doesn't need to change then setting this value to `true` will help with memory - * consumption. However if your map is small or you need to update the tiles dynamically, then leave - * the default value set. - * - * @return {Phaser.Tilemaps.MapData} The created `MapData` object. - */ -var Parse = function (name, mapFormat, data, tileWidth, tileHeight, insertNull) -{ - var newMap; + return this; + }, - switch (mapFormat) + /** + * Transpose this Matrix. + * + * @method Phaser.Math.Matrix3#transpose + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + transpose: function () { - case (Formats.ARRAY_2D): - newMap = Parse2DArray(name, data, tileWidth, tileHeight, insertNull); - break; - case (Formats.CSV): - newMap = ParseCSV(name, data, tileWidth, tileHeight, insertNull); - break; - case (Formats.TILED_JSON): - newMap = ParseJSONTiled(name, data, insertNull); - break; - case (Formats.WELTMEISTER): - newMap = ParseWeltmeister(name, data, insertNull); - break; - default: - console.warn('Unrecognized tilemap data format: ' + mapFormat); - newMap = null; - } - - return newMap; -}; + var a = this.val; + var a01 = a[1]; + var a02 = a[2]; + var a12 = a[5]; -module.exports = Parse; + a[1] = a[3]; + a[2] = a[6]; + a[3] = a01; + a[5] = a[7]; + a[6] = a02; + a[7] = a12; + return this; + }, -/***/ }), -/* 565 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Invert this Matrix. + * + * @method Phaser.Math.Matrix3#invert + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + invert: function () + { + var a = this.val; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; -var Formats = __webpack_require__(40); -var Parse2DArray = __webpack_require__(259); + var b01 = a22 * a11 - a12 * a21; + var b11 = -a22 * a10 + a12 * a20; + var b21 = a21 * a10 - a11 * a20; -/** - * Parses a CSV string of tile indexes into a new MapData object with a single layer. - * - * @function Phaser.Tilemaps.Parsers.ParseCSV - * @since 3.0.0 - * - * @param {string} name - The name of the tilemap, used to set the name on the MapData. - * @param {string} data - CSV string of tile indexes. - * @param {number} tileWidth - The width of a tile in pixels. - * @param {number} tileHeight - The height of a tile in pixels. - * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map - * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty - * location will get a Tile object with an index of -1. If you've a large sparsely populated map and - * the tile data doesn't need to change then setting this value to `true` will help with memory - * consumption. However if your map is small or you need to update the tiles dynamically, then leave - * the default value set. - * - * @return {Phaser.Tilemaps.MapData} The resulting MapData object. - */ -var ParseCSV = function (name, data, tileWidth, tileHeight, insertNull) -{ - var array2D = data - .trim() - .split('\n') - .map(function (row) { return row.split(','); }); + // Calculate the determinant + var det = a00 * b01 + a01 * b11 + a02 * b21; - var map = Parse2DArray(name, array2D, tileWidth, tileHeight, insertNull); - map.format = Formats.CSV; + if (!det) + { + return null; + } - return map; -}; + det = 1 / det; -module.exports = ParseCSV; + a[0] = b01 * det; + a[1] = (-a22 * a01 + a02 * a21) * det; + a[2] = (a12 * a01 - a02 * a11) * det; + a[3] = b11 * det; + a[4] = (a22 * a00 - a02 * a20) * det; + a[5] = (-a12 * a00 + a02 * a10) * det; + a[6] = b21 * det; + a[7] = (-a21 * a00 + a01 * a20) * det; + a[8] = (a11 * a00 - a01 * a10) * det; + return this; + }, -/***/ }), -/* 566 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Calculate the adjoint, or adjugate, of this Matrix. + * + * @method Phaser.Math.Matrix3#adjoint + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + adjoint: function () + { + var a = this.val; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; -var AssignTileProperties = __webpack_require__(567); -var BuildTilesetIndex = __webpack_require__(568); -var CONST = __webpack_require__(29); -var Formats = __webpack_require__(40); -var FromOrientationString = __webpack_require__(258); -var MapData = __webpack_require__(121); -var ParseImageLayers = __webpack_require__(569); -var ParseObjectLayers = __webpack_require__(570); -var ParseTileLayers = __webpack_require__(573); -var ParseTilesets = __webpack_require__(575); + a[0] = (a11 * a22 - a12 * a21); + a[1] = (a02 * a21 - a01 * a22); + a[2] = (a01 * a12 - a02 * a11); + a[3] = (a12 * a20 - a10 * a22); + a[4] = (a00 * a22 - a02 * a20); + a[5] = (a02 * a10 - a00 * a12); + a[6] = (a10 * a21 - a11 * a20); + a[7] = (a01 * a20 - a00 * a21); + a[8] = (a00 * a11 - a01 * a10); -/** - * Parses a Tiled JSON object into a new MapData object. - * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled - * @since 3.0.0 - * - * @param {string} name - The name of the tilemap, used to set the name on the MapData. - * @param {object} json - The Tiled JSON object. - * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map - * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty - * location will get a Tile object with an index of -1. If you've a large sparsely populated map and - * the tile data doesn't need to change then setting this value to `true` will help with memory - * consumption. However if your map is small or you need to update the tiles dynamically, then leave - * the default value set. - * - * @return {?Phaser.Tilemaps.MapData} The created MapData object, or `null` if the data can't be parsed. - */ -var ParseJSONTiled = function (name, json, insertNull) -{ - // Map data will consist of: layers, objects, images, tilesets, sizes - var mapData = new MapData({ - width: json.width, - height: json.height, - name: name, - tileWidth: json.tilewidth, - tileHeight: json.tileheight, - orientation: FromOrientationString(json.orientation), - format: Formats.TILED_JSON, - version: json.version, - properties: json.properties, - renderOrder: json.renderorder, - infinite: json.infinite - }); + return this; + }, - if (mapData.orientation === CONST.HEXAGONAL) + /** + * Calculate the determinant of this Matrix. + * + * @method Phaser.Math.Matrix3#determinant + * @since 3.0.0 + * + * @return {number} The determinant of this Matrix. + */ + determinant: function () { - mapData.hexSideLength = json.hexsidelength; - } - - mapData.layers = ParseTileLayers(json, insertNull); - mapData.images = ParseImageLayers(json); - - var sets = ParseTilesets(json); - - mapData.tilesets = sets.tilesets; - mapData.imageCollections = sets.imageCollections; + var a = this.val; - mapData.objects = ParseObjectLayers(json); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; - mapData.tiles = BuildTilesetIndex(mapData); + return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); + }, - AssignTileProperties(mapData); + /** + * Multiply this Matrix by the given Matrix. + * + * @method Phaser.Math.Matrix3#multiply + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix3} src - The Matrix to multiply this Matrix by. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + multiply: function (src) + { + var a = this.val; - return mapData; -}; + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; + var a20 = a[6]; + var a21 = a[7]; + var a22 = a[8]; -module.exports = ParseJSONTiled; + var b = src.val; + var b00 = b[0]; + var b01 = b[1]; + var b02 = b[2]; + var b10 = b[3]; + var b11 = b[4]; + var b12 = b[5]; + var b20 = b[6]; + var b21 = b[7]; + var b22 = b[8]; -/***/ }), -/* 567 */ -/***/ (function(module, exports, __webpack_require__) { + a[0] = b00 * a00 + b01 * a10 + b02 * a20; + a[1] = b00 * a01 + b01 * a11 + b02 * a21; + a[2] = b00 * a02 + b01 * a12 + b02 * a22; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + a[3] = b10 * a00 + b11 * a10 + b12 * a20; + a[4] = b10 * a01 + b11 * a11 + b12 * a21; + a[5] = b10 * a02 + b11 * a12 + b12 * a22; -var Extend = __webpack_require__(17); + a[6] = b20 * a00 + b21 * a10 + b22 * a20; + a[7] = b20 * a01 + b21 * a11 + b22 * a21; + a[8] = b20 * a02 + b21 * a12 + b22 * a22; -/** - * Copy properties from tileset to tiles. - * - * @function Phaser.Tilemaps.Parsers.Tiled.AssignTileProperties - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.MapData} mapData - The Map Data object. - */ -var AssignTileProperties = function (mapData) -{ - var layerData; - var tile; - var sid; - var set; - var row; + return this; + }, - // go through each of the map data layers - for (var i = 0; i < mapData.layers.length; i++) + /** + * Translate this Matrix using the given Vector. + * + * @method Phaser.Math.Matrix3#translate + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + translate: function (v) { - layerData = mapData.layers[i]; - - set = null; - - // rows of tiles - for (var j = 0; j < layerData.data.length; j++) - { - row = layerData.data[j]; - - // individual tiles - for (var k = 0; k < row.length; k++) - { - tile = row[k]; - - if (tile === null || tile.index < 0) - { - continue; - } - - // find the relevant tileset - sid = mapData.tiles[tile.index][2]; - set = mapData.tilesets[sid]; + var a = this.val; + var x = v.x; + var y = v.y; - // Ensure that a tile's size matches its tileset - tile.width = set.tileWidth; - tile.height = set.tileHeight; + a[6] = x * a[0] + y * a[3] + a[6]; + a[7] = x * a[1] + y * a[4] + a[7]; + a[8] = x * a[2] + y * a[5] + a[8]; - // if that tile type has any properties, add them to the tile object - if (set.tileProperties && set.tileProperties[tile.index - set.firstgid]) - { - tile.properties = Extend( - tile.properties, set.tileProperties[tile.index - set.firstgid] - ); - } - } - } - } -}; + return this; + }, -module.exports = AssignTileProperties; + /** + * Apply a rotation transformation to this Matrix. + * + * @method Phaser.Math.Matrix3#rotate + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + rotate: function (rad) + { + var a = this.val; + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a10 = a[3]; + var a11 = a[4]; + var a12 = a[5]; -/***/ }), -/* 568 */ -/***/ (function(module, exports, __webpack_require__) { + var s = Math.sin(rad); + var c = Math.cos(rad); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + a[0] = c * a00 + s * a10; + a[1] = c * a01 + s * a11; + a[2] = c * a02 + s * a12; -var Tileset = __webpack_require__(122); + a[3] = c * a10 - s * a00; + a[4] = c * a11 - s * a01; + a[5] = c * a12 - s * a02; -/** - * Master list of tiles -> x, y, index in tileset. - * - * @function Phaser.Tilemaps.Parsers.Tiled.BuildTilesetIndex - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.MapData} mapData - The Map Data object. - * - * @return {array} An array of Tileset objects. - */ -var BuildTilesetIndex = function (mapData) -{ - var i; - var set; - var tiles = []; + return this; + }, - for (i = 0; i < mapData.imageCollections.length; i++) + /** + * Apply a scale transformation to this Matrix. + * + * Uses the `x` and `y` components of the given Vector to scale the Matrix. + * + * @method Phaser.Math.Matrix3#scale + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + scale: function (v) { - var collection = mapData.imageCollections[i]; - var images = collection.images; - - for (var j = 0; j < images.length; j++) - { - var image = images[j]; + var a = this.val; + var x = v.x; + var y = v.y; - set = new Tileset(image.image, image.gid, collection.imageWidth, collection.imageHeight, 0, 0); + a[0] = x * a[0]; + a[1] = x * a[1]; + a[2] = x * a[2]; - set.updateTileData(collection.imageWidth, collection.imageHeight); + a[3] = y * a[3]; + a[4] = y * a[4]; + a[5] = y * a[5]; - mapData.tilesets.push(set); - } - } + return this; + }, - for (i = 0; i < mapData.tilesets.length; i++) + /** + * Set the values of this Matrix from the given Quaternion. + * + * @method Phaser.Math.Matrix3#fromQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + fromQuat: function (q) { - set = mapData.tilesets[i]; + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; - var x = set.tileMargin; - var y = set.tileMargin; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; - var count = 0; - var countX = 0; - var countY = 0; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; - for (var t = set.firstgid; t < set.firstgid + set.total; t++) - { - // Can add extra properties here as needed - tiles[t] = [ x, y, i ]; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; - x += set.tileWidth + set.tileSpacing; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; - count++; + var out = this.val; - if (count === set.total) - { - break; - } + out[0] = 1 - (yy + zz); + out[3] = xy + wz; + out[6] = xz - wy; - countX++; + out[1] = xy - wz; + out[4] = 1 - (xx + zz); + out[7] = yz + wx; - if (countX === set.columns) - { - x = set.tileMargin; - y += set.tileHeight + set.tileSpacing; + out[2] = xz + wy; + out[5] = yz - wx; + out[8] = 1 - (xx + yy); - countX = 0; - countY++; + return this; + }, - if (countY === set.rows) - { - break; - } - } - } - } + /** + * Set the values of this Matrix3 to be normalized from the given Matrix4. + * + * @method Phaser.Math.Matrix3#normalFromMat4 + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} m - The Matrix4 to normalize the values from. + * + * @return {Phaser.Math.Matrix3} This Matrix3. + */ + normalFromMat4: function (m) + { + var a = m.val; + var out = this.val; - return tiles; -}; + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; -module.exports = BuildTilesetIndex; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; -/***/ }), -/* 569 */ -/***/ (function(module, exports, __webpack_require__) { + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; -var GetFastValue = __webpack_require__(2); -var CreateGroupLayer = __webpack_require__(161); + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; -/** - * Parses a Tiled JSON object into an array of objects with details about the image layers. - * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseImageLayers - * @since 3.0.0 - * - * @param {object} json - The Tiled JSON object. - * - * @return {array} Array of objects that include critical info about the map's image layers - */ -var ParseImageLayers = function (json) -{ - var images = []; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; - // State inherited from a parent group - var groupStack = []; - var curGroupState = CreateGroupLayer(json); + // Calculate the determinant + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - while (curGroupState.i < curGroupState.layers.length || groupStack.length > 0) - { - if (curGroupState.i >= curGroupState.layers.length) + if (!det) { - // Ensure recursion stack is not empty first - if (groupStack.length < 1) - { - console.warn( - 'TilemapParser.parseTiledJSON - Invalid layer group hierarchy' - ); - break; - } - - // Return to previous recursive state - curGroupState = groupStack.pop(); - continue; + return null; } - // Get current layer and advance iterator - var curi = curGroupState.layers[curGroupState.i]; - curGroupState.i++; + det = 1 / det; - if (curi.type !== 'imagelayer') - { - if (curi.type === 'group') - { - // Compute next state inherited from group - var nextGroupState = CreateGroupLayer(json, curi, curGroupState); + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - // Preserve current state before recursing - groupStack.push(curGroupState); - curGroupState = nextGroupState; - } + out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - // Skip this layer OR 'recurse' (iterative style) into the group - continue; - } + out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - var layerOffsetX = GetFastValue(curi, 'offsetx', 0) + GetFastValue(curi, 'startx', 0); - var layerOffsetY = GetFastValue(curi, 'offsety', 0) + GetFastValue(curi, 'starty', 0); - images.push({ - name: (curGroupState.name + curi.name), - image: curi.image, - x: (curGroupState.x + layerOffsetX + curi.x), - y: (curGroupState.y + layerOffsetY + curi.y), - alpha: (curGroupState.opacity * curi.opacity), - visible: (curGroupState.visible && curi.visible), - properties: GetFastValue(curi, 'properties', {}) - }); + return this; } - return images; -}; +}); -module.exports = ParseImageLayers; +module.exports = Matrix3; /***/ }), -/* 570 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 16650: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetFastValue = __webpack_require__(2); -var ParseObject = __webpack_require__(260); -var ObjectLayer = __webpack_require__(572); -var CreateGroupLayer = __webpack_require__(161); +var Class = __webpack_require__(56694); +var Vector3 = __webpack_require__(70015); /** - * Parses a Tiled JSON object into an array of ObjectLayer objects. + * @ignore + */ +var EPSILON = 0.000001; + +/** + * @classdesc + * A four-dimensional matrix. * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseObjectLayers - * @since 3.0.0 + * Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji + * and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl * - * @param {object} json - The Tiled JSON object. + * @class Matrix4 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 * - * @return {array} An array of all object layers in the tilemap as `ObjectLayer`s. + * @param {Phaser.Math.Matrix4} [m] - Optional Matrix4 to copy values from. */ -var ParseObjectLayers = function (json) -{ - var objectLayers = []; +var Matrix4 = new Class({ - // State inherited from a parent group - var groupStack = []; - var curGroupState = CreateGroupLayer(json); + initialize: - while (curGroupState.i < curGroupState.layers.length || groupStack.length > 0) + function Matrix4 (m) { - if (curGroupState.i >= curGroupState.layers.length) - { - // Ensure recursion stack is not empty first - if (groupStack.length < 1) - { - console.warn( - 'TilemapParser.parseTiledJSON - Invalid layer group hierarchy' - ); - break; - } - - // Return to previous recursive state - curGroupState = groupStack.pop(); - continue; - } - - // Get current layer and advance iterator - var curo = curGroupState.layers[curGroupState.i]; - curGroupState.i++; - - // Modify inherited properties - curo.opacity *= curGroupState.opacity; - curo.visible = curGroupState.visible && curo.visible; + /** + * The matrix values. + * + * @name Phaser.Math.Matrix4#val + * @type {Float32Array} + * @since 3.0.0 + */ + this.val = new Float32Array(16); - if (curo.type !== 'objectgroup') + if (m) { - if (curo.type === 'group') - { - // Compute next state inherited from group - var nextGroupState = CreateGroupLayer(json, curo, curGroupState); - - // Preserve current state before recursing - groupStack.push(curGroupState); - curGroupState = nextGroupState; - } - - // Skip this layer OR 'recurse' (iterative style) into the group - continue; + // Assume Matrix4 with val: + this.copy(m); } - - curo.name = curGroupState.name + curo.name; - var offsetX = curGroupState.x + GetFastValue(curo, 'startx', 0) + GetFastValue(curo, 'offsetx', 0); - var offsetY = curGroupState.y + GetFastValue(curo, 'starty', 0) + GetFastValue(curo, 'offsety', 0); - - var objects = []; - for (var j = 0; j < curo.objects.length; j++) + else { - var parsedObject = ParseObject(curo.objects[j], offsetX, offsetY); - - objects.push(parsedObject); + // Default to identity + this.identity(); } + }, - var objectLayer = new ObjectLayer(curo); - objectLayer.objects = objects; + /** + * Make a clone of this Matrix4. + * + * @method Phaser.Math.Matrix4#clone + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} A clone of this Matrix4. + */ + clone: function () + { + return new Matrix4(this); + }, - objectLayers.push(objectLayer); - } - - return objectLayers; -}; + /** + * This method is an alias for `Matrix4.copy`. + * + * @method Phaser.Math.Matrix4#set + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to set the values of this Matrix's from. + * + * @return {this} This Matrix4. + */ + set: function (src) + { + return this.copy(src); + }, -module.exports = ParseObjectLayers; + /** + * Sets all values of this Matrix4. + * + * @method Phaser.Math.Matrix4#setValues + * @since 3.50.0 + * + * @param {number} m00 - The m00 value. + * @param {number} m01 - The m01 value. + * @param {number} m02 - The m02 value. + * @param {number} m03 - The m03 value. + * @param {number} m10 - The m10 value. + * @param {number} m11 - The m11 value. + * @param {number} m12 - The m12 value. + * @param {number} m13 - The m13 value. + * @param {number} m20 - The m20 value. + * @param {number} m21 - The m21 value. + * @param {number} m22 - The m22 value. + * @param {number} m23 - The m23 value. + * @param {number} m30 - The m30 value. + * @param {number} m31 - The m31 value. + * @param {number} m32 - The m32 value. + * @param {number} m33 - The m33 value. + * + * @return {this} This Matrix4 instance. + */ + setValues: function (m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) + { + var out = this.val; + out[0] = m00; + out[1] = m01; + out[2] = m02; + out[3] = m03; + out[4] = m10; + out[5] = m11; + out[6] = m12; + out[7] = m13; + out[8] = m20; + out[9] = m21; + out[10] = m22; + out[11] = m23; + out[12] = m30; + out[13] = m31; + out[14] = m32; + out[15] = m33; -/***/ }), -/* 571 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Copy the values of a given Matrix into this Matrix. + * + * @method Phaser.Math.Matrix4#copy + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to copy the values from. + * + * @return {this} This Matrix4. + */ + copy: function (src) + { + var a = src.val; -var HasValue = __webpack_require__(126); + return this.setValues(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); + }, -/** - * Returns a new object that only contains the `keys` that were found on the object provided. - * If no `keys` are found, an empty object is returned. - * - * @function Phaser.Utils.Objects.Pick - * @since 3.18.0 - * - * @param {object} object - The object to pick the provided keys from. - * @param {array} keys - An array of properties to retrieve from the provided object. - * - * @return {object} A new object that only contains the `keys` that were found on the provided object. If no `keys` were found, an empty object will be returned. - */ -var Pick = function (object, keys) -{ - var obj = {}; + /** + * Set the values of this Matrix from the given array. + * + * @method Phaser.Math.Matrix4#fromArray + * @since 3.0.0 + * + * @param {number[]} a - The array to copy the values from. Must have at least 16 elements. + * + * @return {this} This Matrix4. + */ + fromArray: function (a) + { + return this.setValues(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); + }, - for (var i = 0; i < keys.length; i++) + /** + * Reset this Matrix. + * + * Sets all values to `0`. + * + * @method Phaser.Math.Matrix4#zero + * @since 3.0.0 + * + * @return {Phaser.Math.Matrix4} This Matrix4. + */ + zero: function () { - var key = keys[i]; + return this.setValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + }, - if (HasValue(object, key)) - { - obj[key] = object[key]; - } - } + /** + * Generates a transform matrix based on the given position, scale and rotation. + * + * @method Phaser.Math.Matrix4#transform + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} position - The position vector. + * @param {Phaser.Math.Vector3} scale - The scale vector. + * @param {Phaser.Math.Quaternion} rotation - The rotation quaternion. + * + * @return {this} This Matrix4. + */ + transform: function (position, scale, rotation) + { + var rotMatrix = _tempMat1.fromQuat(rotation); - return obj; -}; + var rm = rotMatrix.val; -module.exports = Pick; + var sx = scale.x; + var sy = scale.y; + var sz = scale.z; + return this.setValues( + rm[0] * sx, + rm[1] * sx, + rm[2] * sx, + 0, -/***/ }), -/* 572 */ -/***/ (function(module, exports, __webpack_require__) { + rm[4] * sy, + rm[5] * sy, + rm[6] * sy, + 0, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + rm[8] * sz, + rm[9] * sz, + rm[10] * sz, + 0, -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); + position.x, + position.y, + position.z, + 1 + ); + }, -/** - * @classdesc - * A class for representing a Tiled object layer in a map. This mirrors the structure of a Tiled - * object layer, except: - * - "x" & "y" properties are ignored since these cannot be changed in Tiled. - * - "offsetx" & "offsety" are applied to the individual object coordinates directly, so they - * are ignored as well. - * - "draworder" is ignored. - * - * @class ObjectLayer - * @memberof Phaser.Tilemaps - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Types.Tilemaps.ObjectLayerConfig} [config] - The data for the layer from the Tiled JSON object. - */ -var ObjectLayer = new Class({ + /** + * Set the `x`, `y` and `z` values of this Matrix. + * + * @method Phaser.Math.Matrix4#xyz + * @since 3.0.0 + * + * @param {number} x - The x value. + * @param {number} y - The y value. + * @param {number} z - The z value. + * + * @return {this} This Matrix4. + */ + xyz: function (x, y, z) + { + this.identity(); - initialize: + var out = this.val; - function ObjectLayer (config) - { - if (config === undefined) { config = {}; } + out[12] = x; + out[13] = y; + out[14] = z; - /** - * The name of the Object Layer. - * - * @name Phaser.Tilemaps.ObjectLayer#name - * @type {string} - * @since 3.0.0 - */ - this.name = GetFastValue(config, 'name', 'object layer'); + return this; + }, - /** - * The opacity of the layer, between 0 and 1. - * - * @name Phaser.Tilemaps.ObjectLayer#opacity - * @type {number} - * @since 3.0.0 - */ - this.opacity = GetFastValue(config, 'opacity', 1); + /** + * Set the scaling values of this Matrix. + * + * @method Phaser.Math.Matrix4#scaling + * @since 3.0.0 + * + * @param {number} x - The x scaling value. + * @param {number} y - The y scaling value. + * @param {number} z - The z scaling value. + * + * @return {this} This Matrix4. + */ + scaling: function (x, y, z) + { + this.zero(); - /** - * The custom properties defined on the Object Layer, keyed by their name. - * - * @name Phaser.Tilemaps.ObjectLayer#properties - * @type {object} - * @since 3.0.0 - */ - this.properties = GetFastValue(config, 'properties', {}); + var out = this.val; - /** - * The type of each custom property defined on the Object Layer, keyed by its name. - * - * @name Phaser.Tilemaps.ObjectLayer#propertyTypes - * @type {object} - * @since 3.0.0 - */ - this.propertyTypes = GetFastValue(config, 'propertytypes', {}); + out[0] = x; + out[5] = y; + out[10] = z; + out[15] = 1; - /** - * The type of the layer, which should be `objectgroup`. - * - * @name Phaser.Tilemaps.ObjectLayer#type - * @type {string} - * @since 3.0.0 - */ - this.type = GetFastValue(config, 'type', 'objectgroup'); + return this; + }, - /** - * Whether the layer is shown (`true`) or hidden (`false`). - * - * @name Phaser.Tilemaps.ObjectLayer#visible - * @type {boolean} - * @since 3.0.0 - */ - this.visible = GetFastValue(config, 'visible', true); + /** + * Reset this Matrix to an identity (default) matrix. + * + * @method Phaser.Math.Matrix4#identity + * @since 3.0.0 + * + * @return {this} This Matrix4. + */ + identity: function () + { + return this.setValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + }, - /** - * An array of all objects on this Object Layer. - * - * Each Tiled object corresponds to a JavaScript object in this array. It has an `id` (unique), - * `name` (as assigned in Tiled), `type` (as assigned in Tiled), `rotation` (in clockwise degrees), - * `properties` (if any), `visible` state (`true` if visible, `false` otherwise), - * `x` and `y` coordinates (in pixels, relative to the tilemap), and a `width` and `height` (in pixels). - * - * An object tile has a `gid` property (GID of the represented tile), a `flippedHorizontal` property, - * a `flippedVertical` property, and `flippedAntiDiagonal` property. - * The {@link http://docs.mapeditor.org/en/latest/reference/tmx-map-format/|Tiled documentation} contains - * information on flipping and rotation. - * - * Polylines have a `polyline` property, which is an array of objects corresponding to points, - * where each point has an `x` property and a `y` property. Polygons have an identically structured - * array in their `polygon` property. Text objects have a `text` property with the text's properties. - * - * Rectangles and ellipses have a `rectangle` or `ellipse` property set to `true`. - * - * @name Phaser.Tilemaps.ObjectLayer#objects - * @type {Phaser.Types.Tilemaps.TiledObject[]} - * @since 3.0.0 - */ - this.objects = GetFastValue(config, 'objects', []); - } + /** + * Transpose this Matrix. + * + * @method Phaser.Math.Matrix4#transpose + * @since 3.0.0 + * + * @return {this} This Matrix4. + */ + transpose: function () + { + var a = this.val; -}); + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a12 = a[6]; + var a13 = a[7]; + var a23 = a[11]; -module.exports = ObjectLayer; + a[1] = a[4]; + a[2] = a[8]; + a[3] = a[12]; + a[4] = a01; + a[6] = a[9]; + a[7] = a[13]; + a[8] = a02; + a[9] = a12; + a[11] = a[14]; + a[12] = a03; + a[13] = a13; + a[14] = a23; + return this; + }, -/***/ }), -/* 573 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Copies the given Matrix4 into this Matrix and then inverses it. + * + * @method Phaser.Math.Matrix4#getInverse + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} m - The Matrix4 to invert into this Matrix4. + * + * @return {this} This Matrix4. + */ + getInverse: function (m) + { + this.copy(m); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this.invert(); + }, -var Base64Decode = __webpack_require__(574); -var CONST = __webpack_require__(29); -var CreateGroupLayer = __webpack_require__(161); -var FromOrientationString = __webpack_require__(258); -var GetFastValue = __webpack_require__(2); -var LayerData = __webpack_require__(120); -var ParseGID = __webpack_require__(261); -var Tile = __webpack_require__(85); + /** + * Invert this Matrix. + * + * @method Phaser.Math.Matrix4#invert + * @since 3.0.0 + * + * @return {this} This Matrix4. + */ + invert: function () + { + var a = this.val; -/** - * Parses all tilemap layers in a Tiled JSON object into new LayerData objects. - * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseTileLayers - * @since 3.0.0 - * - * @param {object} json - The Tiled JSON object. - * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map - * data are handled (see {@link Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled}). - * - * @return {Phaser.Tilemaps.LayerData[]} - An array of LayerData objects, one for each entry in - * json.layers with the type 'tilelayer'. - */ -var ParseTileLayers = function (json, insertNull) -{ - var infiniteMap = GetFastValue(json, 'infinite', false); - var tileLayers = []; + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; - // State inherited from a parent group - var groupStack = []; - var curGroupState = CreateGroupLayer(json); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; - while (curGroupState.i < curGroupState.layers.length || groupStack.length > 0) - { - if (curGroupState.i >= curGroupState.layers.length) - { - // Ensure recursion stack is not empty first - if (groupStack.length < 1) - { - console.warn( - 'TilemapParser.parseTiledJSON - Invalid layer group hierarchy' - ); - break; - } + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; - // Return to previous recursive state - curGroupState = groupStack.pop(); - continue; - } + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; - var curl = curGroupState.layers[curGroupState.i]; - curGroupState.i++; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; - if (curl.type !== 'tilelayer') - { - if (curl.type === 'group') - { - // Compute next state inherited from group - var nextGroupState = CreateGroupLayer(json, curl, curGroupState); + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; - // Preserve current state before recursing - groupStack.push(curGroupState); - curGroupState = nextGroupState; - } + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; - // Skip this layer OR 'recurse' (iterative style) into the group - continue; - } + // Calculate the determinant + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - // Base64 decode data if necessary. NOTE: uncompressed base64 only. - if (curl.compression) + if (!det) { - console.warn( - 'TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer \'' - + curl.name + '\'' - ); - continue; + return this; } - else if (curl.encoding && curl.encoding === 'base64') - { - // Chunks for an infinite map - if (curl.chunks) - { - for (var i = 0; i < curl.chunks.length; i++) - { - curl.chunks[i].data = Base64Decode(curl.chunks[i].data); - } - } - // Non-infinite map data - if (curl.data) - { - curl.data = Base64Decode(curl.data); - } + det = 1 / det; - delete curl.encoding; // Allow the same map to be parsed multiple times - } + return this.setValues( + (a11 * b11 - a12 * b10 + a13 * b09) * det, + (a02 * b10 - a01 * b11 - a03 * b09) * det, + (a31 * b05 - a32 * b04 + a33 * b03) * det, + (a22 * b04 - a21 * b05 - a23 * b03) * det, + (a12 * b08 - a10 * b11 - a13 * b07) * det, + (a00 * b11 - a02 * b08 + a03 * b07) * det, + (a32 * b02 - a30 * b05 - a33 * b01) * det, + (a20 * b05 - a22 * b02 + a23 * b01) * det, + (a10 * b10 - a11 * b08 + a13 * b06) * det, + (a01 * b08 - a00 * b10 - a03 * b06) * det, + (a30 * b04 - a31 * b02 + a33 * b00) * det, + (a21 * b02 - a20 * b04 - a23 * b00) * det, + (a11 * b07 - a10 * b09 - a12 * b06) * det, + (a00 * b09 - a01 * b07 + a02 * b06) * det, + (a31 * b01 - a30 * b03 - a32 * b00) * det, + (a20 * b03 - a21 * b01 + a22 * b00) * det + ); + }, - // This is an array containing the tile indexes, one after the other. -1 = no tile, - // everything else = the tile index (starting at 1 for Tiled, 0 for CSV) If the map - // contains multiple tilesets then the indexes are relative to that which the set starts - // from. Need to set which tileset in the cache = which tileset in the JSON, if you do this - // manually it means you can use the same map data but a new tileset. + /** + * Calculate the adjoint, or adjugate, of this Matrix. + * + * @method Phaser.Math.Matrix4#adjoint + * @since 3.0.0 + * + * @return {this} This Matrix4. + */ + adjoint: function () + { + var a = this.val; - var layerData; - var gidInfo; - var tile; - var blankTile; + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; - var output = []; - var x = 0; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; - if (infiniteMap) - { - var layerOffsetX = (GetFastValue(curl, 'startx', 0) + curl.x); - var layerOffsetY = (GetFastValue(curl, 'starty', 0) + curl.y); + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; - layerData = new LayerData({ - name: (curGroupState.name + curl.name), - x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + layerOffsetX * json.tilewidth), - y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + layerOffsetY * json.tileheight), - width: curl.width, - height: curl.height, - tileWidth: json.tilewidth, - tileHeight: json.tileheight, - alpha: (curGroupState.opacity * curl.opacity), - visible: (curGroupState.visible && curl.visible), - properties: GetFastValue(curl, 'properties', []), - orientation: FromOrientationString(json.orientation) - }); + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; - if (layerData.orientation === CONST.HEXAGONAL) - { - layerData.hexSideLength = json.hexsidelength; - } + return this.setValues( + (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)), + -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)), + (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)), + -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)), + -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)), + (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)), + -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)), + (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)), + (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)), + -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)), + (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)), + -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)), + -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)), + (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)), + -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)), + (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)) + ); + }, - for (var c = 0; c < curl.height; c++) - { - output.push([ null ]); + /** + * Calculate the determinant of this Matrix. + * + * @method Phaser.Math.Matrix4#determinant + * @since 3.0.0 + * + * @return {number} The determinant of this Matrix. + */ + determinant: function () + { + var a = this.val; - for (var j = 0; j < curl.width; j++) - { - output[c][j] = null; - } - } + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; - for (c = 0, len = curl.chunks.length; c < len; c++) - { - var chunk = curl.chunks[c]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; - var offsetX = (chunk.x - layerOffsetX); - var offsetY = (chunk.y - layerOffsetY); + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; - var y = 0; + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; - for (var t = 0, len2 = chunk.data.length; t < len2; t++) - { - var newOffsetX = x + offsetX; - var newOffsetY = y + offsetY; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; - gidInfo = ParseGID(chunk.data[t]); + // Calculate the determinant + return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + }, - // index, x, y, width, height - if (gidInfo.gid > 0) - { - tile = new Tile(layerData, gidInfo.gid, newOffsetX, newOffsetY, json.tilewidth, json.tileheight); + /** + * Multiply this Matrix by the given Matrix. + * + * @method Phaser.Math.Matrix4#multiply + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix to multiply this Matrix by. + * + * @return {this} This Matrix4. + */ + multiply: function (src) + { + var a = this.val; - // Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal - // propeties into flipX, flipY and rotation - tile.rotation = gidInfo.rotation; - tile.flipX = gidInfo.flipped; + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; - output[newOffsetY][newOffsetX] = tile; - } - else - { - blankTile = insertNull - ? null - : new Tile(layerData, -1, newOffsetX, newOffsetY, json.tilewidth, json.tileheight); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; - output[newOffsetY][newOffsetX] = blankTile; - } + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; - x++; + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; - if (x === chunk.width) - { - y++; - x = 0; - } - } - } - } - else - { - layerData = new LayerData({ - name: (curGroupState.name + curl.name), - x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + curl.x), - y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + curl.y), - width: curl.width, - height: curl.height, - tileWidth: json.tilewidth, - tileHeight: json.tileheight, - alpha: (curGroupState.opacity * curl.opacity), - visible: (curGroupState.visible && curl.visible), - properties: GetFastValue(curl, 'properties', []), - orientation: FromOrientationString(json.orientation) - }); + var b = src.val; - if (layerData.orientation === CONST.HEXAGONAL) - { - layerData.hexSideLength = json.hexsidelength; - } - var row = []; + // Cache only the current line of the second matrix + var b0 = b[0]; + var b1 = b[1]; + var b2 = b[2]; + var b3 = b[3]; - // Loop through the data field in the JSON. - for (var k = 0, len = curl.data.length; k < len; k++) - { - gidInfo = ParseGID(curl.data[k]); + a[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - // index, x, y, width, height - if (gidInfo.gid > 0) - { - tile = new Tile(layerData, gidInfo.gid, x, output.length, json.tilewidth, json.tileheight); + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; - // Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal - // propeties into flipX, flipY and rotation - tile.rotation = gidInfo.rotation; - tile.flipX = gidInfo.flipped; + a[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - row.push(tile); - } - else - { - blankTile = insertNull - ? null - : new Tile(layerData, -1, x, output.length, json.tilewidth, json.tileheight); - row.push(blankTile); - } + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; - x++; + a[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - if (x === curl.width) - { - output.push(row); - x = 0; - row = []; - } - } - } + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; - layerData.data = output; - tileLayers.push(layerData); - } + a[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + a[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + a[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + a[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - return tileLayers; -}; + return this; + }, -module.exports = ParseTileLayers; + /** + * Multiply the values of this Matrix4 by those given in the `src` argument. + * + * @method Phaser.Math.Matrix4#multiplyLocal + * @since 3.0.0 + * + * @param {Phaser.Math.Matrix4} src - The source Matrix4 that this Matrix4 is multiplied by. + * + * @return {this} This Matrix4. + */ + multiplyLocal: function (src) + { + var a = this.val; + var b = src.val; + return this.setValues( + a[0] * b[0] + a[1] * b[4] + a[2] * b[8] + a[3] * b[12], + a[0] * b[1] + a[1] * b[5] + a[2] * b[9] + a[3] * b[13], + a[0] * b[2] + a[1] * b[6] + a[2] * b[10] + a[3] * b[14], + a[0] * b[3] + a[1] * b[7] + a[2] * b[11] + a[3] * b[15], -/***/ }), -/* 574 */ -/***/ (function(module, exports) { + a[4] * b[0] + a[5] * b[4] + a[6] * b[8] + a[7] * b[12], + a[4] * b[1] + a[5] * b[5] + a[6] * b[9] + a[7] * b[13], + a[4] * b[2] + a[5] * b[6] + a[6] * b[10] + a[7] * b[14], + a[4] * b[3] + a[5] * b[7] + a[6] * b[11] + a[7] * b[15], -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + a[8] * b[0] + a[9] * b[4] + a[10] * b[8] + a[11] * b[12], + a[8] * b[1] + a[9] * b[5] + a[10] * b[9] + a[11] * b[13], + a[8] * b[2] + a[9] * b[6] + a[10] * b[10] + a[11] * b[14], + a[8] * b[3] + a[9] * b[7] + a[10] * b[11] + a[11] * b[15], -/** - * Decode base-64 encoded data, for example as exported by Tiled. - * - * @function Phaser.Tilemaps.Parsers.Tiled.Base64Decode - * @since 3.0.0 - * - * @param {object} data - Base-64 encoded data to decode. - * - * @return {array} Array containing the decoded bytes. - */ -var Base64Decode = function (data) -{ - var binaryString = window.atob(data); - var len = binaryString.length; - var bytes = new Array(len / 4); + a[12] * b[0] + a[13] * b[4] + a[14] * b[8] + a[15] * b[12], + a[12] * b[1] + a[13] * b[5] + a[14] * b[9] + a[15] * b[13], + a[12] * b[2] + a[13] * b[6] + a[14] * b[10] + a[15] * b[14], + a[12] * b[3] + a[13] * b[7] + a[14] * b[11] + a[15] * b[15] + ); + }, - // Interpret binaryString as an array of bytes representing little-endian encoded uint32 values. - for (var i = 0; i < len; i += 4) + /** + * Multiplies the given Matrix4 object with this Matrix. + * + * This is the same as calling `multiplyMatrices(m, this)`. + * + * @method Phaser.Math.Matrix4#premultiply + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} m - The Matrix4 to multiply with this one. + * + * @return {this} This Matrix4. + */ + premultiply: function (m) { - bytes[i / 4] = ( - binaryString.charCodeAt(i) | - binaryString.charCodeAt(i + 1) << 8 | - binaryString.charCodeAt(i + 2) << 16 | - binaryString.charCodeAt(i + 3) << 24 - ) >>> 0; - } - - return bytes; -}; - -module.exports = Base64Decode; + return this.multiplyMatrices(m, this); + }, + /** + * Multiplies the two given Matrix4 objects and stores the results in this Matrix. + * + * @method Phaser.Math.Matrix4#multiplyMatrices + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} a - The first Matrix4 to multiply. + * @param {Phaser.Math.Matrix4} b - The second Matrix4 to multiply. + * + * @return {this} This Matrix4. + */ + multiplyMatrices: function (a, b) + { + var am = a.val; + var bm = b.val; -/***/ }), -/* 575 */ -/***/ (function(module, exports, __webpack_require__) { + var a11 = am[0]; + var a12 = am[4]; + var a13 = am[8]; + var a14 = am[12]; + var a21 = am[1]; + var a22 = am[5]; + var a23 = am[9]; + var a24 = am[13]; + var a31 = am[2]; + var a32 = am[6]; + var a33 = am[10]; + var a34 = am[14]; + var a41 = am[3]; + var a42 = am[7]; + var a43 = am[11]; + var a44 = am[15]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var b11 = bm[0]; + var b12 = bm[4]; + var b13 = bm[8]; + var b14 = bm[12]; + var b21 = bm[1]; + var b22 = bm[5]; + var b23 = bm[9]; + var b24 = bm[13]; + var b31 = bm[2]; + var b32 = bm[6]; + var b33 = bm[10]; + var b34 = bm[14]; + var b41 = bm[3]; + var b42 = bm[7]; + var b43 = bm[11]; + var b44 = bm[15]; -var Tileset = __webpack_require__(122); -var ImageCollection = __webpack_require__(576); -var ParseObject = __webpack_require__(260); -var ParseWangsets = __webpack_require__(1453); + return this.setValues( + a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41, + a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41, + a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41, + a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41, + a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42, + a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42, + a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42, + a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42, + a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43, + a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43, + a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43, + a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43, + a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44, + a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44, + a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44, + a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44 + ); + }, -/** - * Tilesets and Image Collections. - * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseTilesets - * @since 3.0.0 - * - * @param {object} json - The Tiled JSON data. - * - * @return {object} An object containing the tileset and image collection data. - */ -var ParseTilesets = function (json) -{ - var tilesets = []; - var imageCollections = []; - var lastSet = null; - var stringID; + /** + * Translate this Matrix using the given Vector. + * + * @method Phaser.Math.Matrix4#translate + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to translate this Matrix with. + * + * @return {this} This Matrix4. + */ + translate: function (v) + { + return this.translateXYZ(v.x, v.y, v.z); + }, - for (var i = 0; i < json.tilesets.length; i++) + /** + * Translate this Matrix using the given values. + * + * @method Phaser.Math.Matrix4#translateXYZ + * @since 3.16.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {this} This Matrix4. + */ + translateXYZ: function (x, y, z) { - // name, firstgid, width, height, margin, spacing, properties - var set = json.tilesets[i]; + var a = this.val; - if (set.source) - { - console.warn('External tilesets unsupported. Use Embed Tileset and re-export'); - } - else if (set.image) - { - var newSet = new Tileset(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing); + a[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + a[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + a[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + a[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; - if (json.version > 1) - { - var datas = undefined; - var props = undefined; + return this; + }, - if (Array.isArray(set.tiles)) - { - datas = datas || {}; - props = props || {}; + /** + * Apply a scale transformation to this Matrix. + * + * Uses the `x`, `y` and `z` components of the given Vector to scale the Matrix. + * + * @method Phaser.Math.Matrix4#scale + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to scale this Matrix with. + * + * @return {this} This Matrix4. + */ + scale: function (v) + { + return this.scaleXYZ(v.x, v.y, v.z); + }, - // Tiled 1.2+ - for (var t = 0; t < set.tiles.length; t++) - { - var tile = set.tiles[t]; + /** + * Apply a scale transformation to this Matrix. + * + * @method Phaser.Math.Matrix4#scaleXYZ + * @since 3.16.0 + * + * @param {number} x - The x component. + * @param {number} y - The y component. + * @param {number} z - The z component. + * + * @return {this} This Matrix4. + */ + scaleXYZ: function (x, y, z) + { + var a = this.val; - // Convert tileproperties. - if (tile.properties) - { - var newPropData = {}; + a[0] = a[0] * x; + a[1] = a[1] * x; + a[2] = a[2] * x; + a[3] = a[3] * x; - tile.properties.forEach(function (propData) - { - newPropData[propData['name']] = propData['value']; - }); + a[4] = a[4] * y; + a[5] = a[5] * y; + a[6] = a[6] * y; + a[7] = a[7] * y; - props[tile.id] = newPropData; - } + a[8] = a[8] * z; + a[9] = a[9] * z; + a[10] = a[10] * z; + a[11] = a[11] * z; - // Convert objectgroup - if (tile.objectgroup) - { - (datas[tile.id] || (datas[tile.id] = {})).objectgroup = tile.objectgroup; + return this; + }, - if (tile.objectgroup.objects) - { - var parsedObjects2 = tile.objectgroup.objects.map(function (obj) - { - return ParseObject(obj); - }); + /** + * Derive a rotation matrix around the given axis. + * + * @method Phaser.Math.Matrix4#makeRotationAxis + * @since 3.0.0 + * + * @param {(Phaser.Math.Vector3|Phaser.Math.Vector4)} axis - The rotation axis. + * @param {number} angle - The rotation angle in radians. + * + * @return {this} This Matrix4. + */ + makeRotationAxis: function (axis, angle) + { + // Based on http://www.gamedev.net/reference/articles/article1199.asp - datas[tile.id].objectgroup.objects = parsedObjects2; - } - } + var c = Math.cos(angle); + var s = Math.sin(angle); + var t = 1 - c; + var x = axis.x; + var y = axis.y; + var z = axis.z; + var tx = t * x; + var ty = t * y; - // Copy animation data - if (tile.animation) - { - (datas[tile.id] || (datas[tile.id] = {})).animation = tile.animation; - } + return this.setValues( + tx * x + c, tx * y - s * z, tx * z + s * y, 0, + tx * y + s * z, ty * y + c, ty * z - s * x, 0, + tx * z - s * y, ty * z + s * x, t * z * z + c, 0, + 0, 0, 0, 1 + ); + }, - // Copy tile `type` field - // (see https://doc.mapeditor.org/en/latest/manual/custom-properties/#typed-tiles). - if (tile.type) - { - (datas[tile.id] || (datas[tile.id] = {})).type = tile.type; - } - } - } + /** + * Apply a rotation transformation to this Matrix. + * + * @method Phaser.Math.Matrix4#rotate + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * @param {Phaser.Math.Vector3} axis - The axis to rotate upon. + * + * @return {this} This Matrix4. + */ + rotate: function (rad, axis) + { + var a = this.val; + var x = axis.x; + var y = axis.y; + var z = axis.z; + var len = Math.sqrt(x * x + y * y + z * z); - if (Array.isArray(set.wangsets)) - { - datas = datas || {}; - props = props || {}; + if (Math.abs(len) < EPSILON) + { + return this; + } - ParseWangsets(set.wangsets, datas); - } + len = 1 / len; + x *= len; + y *= len; + z *= len; - if (datas) // Implies also props is set. - { - newSet.tileData = datas; - newSet.tileProperties = props; - } - } - else - { - // Tiled 1 + var s = Math.sin(rad); + var c = Math.cos(rad); + var t = 1 - c; - // Properties stored per-tile in object with string indexes starting at "0" - if (set.tileproperties) - { - newSet.tileProperties = set.tileproperties; - } + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; - // Object & terrain shapes stored per-tile in object with string indexes starting at "0" - if (set.tiles) - { - newSet.tileData = set.tiles; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; - // Parse the objects into Phaser format to match handling of other Tiled objects - for (stringID in newSet.tileData) - { - var objectGroup = newSet.tileData[stringID].objectgroup; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; - if (objectGroup && objectGroup.objects) - { - var parsedObjects1 = objectGroup.objects.map(function (obj) - { - return ParseObject(obj); - }); + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; - newSet.tileData[stringID].objectgroup.objects = parsedObjects1; - } - } - } - } + // Construct the elements of the rotation matrix + var b00 = x * x * t + c; + var b01 = y * x * t + z * s; + var b02 = z * x * t - y * s; - // For a normal sliced tileset the row/count/size information is computed when updated. - // This is done (again) after the image is set. - newSet.updateTileData(set.imagewidth, set.imageheight); + var b10 = x * y * t - z * s; + var b11 = y * y * t + c; + var b12 = z * y * t + x * s; - tilesets.push(newSet); - } - else - { - var newCollection = new ImageCollection(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing, set.properties); + var b20 = x * z * t + y * s; + var b21 = y * z * t - x * s; + var b22 = z * z * t + c; - var maxId = 0; + // Perform rotation-specific matrix multiplication + return this.setValues( + a00 * b00 + a10 * b01 + a20 * b02, + a01 * b00 + a11 * b01 + a21 * b02, + a02 * b00 + a12 * b01 + a22 * b02, + a03 * b00 + a13 * b01 + a23 * b02, + a00 * b10 + a10 * b11 + a20 * b12, + a01 * b10 + a11 * b11 + a21 * b12, + a02 * b10 + a12 * b11 + a22 * b12, + a03 * b10 + a13 * b11 + a23 * b12, + a00 * b20 + a10 * b21 + a20 * b22, + a01 * b20 + a11 * b21 + a21 * b22, + a02 * b20 + a12 * b21 + a22 * b22, + a03 * b20 + a13 * b21 + a23 * b22, + a30, a31, a32, a33 + ); + }, - for (t = 0; t < set.tiles.length; t++) - { - tile = set.tiles[t]; + /** + * Rotate this matrix on its X axis. + * + * @method Phaser.Math.Matrix4#rotateX + * @since 3.0.0 + * + * @param {number} rad - The angle in radians to rotate by. + * + * @return {this} This Matrix4. + */ + rotateX: function (rad) + { + var a = this.val; + var s = Math.sin(rad); + var c = Math.cos(rad); - var image = tile.image; - var tileId = parseInt(tile.id, 10); - var gid = set.firstgid + tileId; - newCollection.addImage(gid, image); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; - maxId = Math.max(tileId, maxId); - } + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; - newCollection.maxId = maxId; + // Perform axis-specific matrix multiplication + a[4] = a10 * c + a20 * s; + a[5] = a11 * c + a21 * s; + a[6] = a12 * c + a22 * s; + a[7] = a13 * c + a23 * s; + a[8] = a20 * c - a10 * s; + a[9] = a21 * c - a11 * s; + a[10] = a22 * c - a12 * s; + a[11] = a23 * c - a13 * s; - imageCollections.push(newCollection); - } + return this; + }, - // We've got a new Tileset, so set the lastgid into the previous one - if (lastSet) - { - lastSet.lastgid = set.firstgid - 1; - } + /** + * Rotate this matrix on its Y axis. + * + * @method Phaser.Math.Matrix4#rotateY + * @since 3.0.0 + * + * @param {number} rad - The angle to rotate by, in radians. + * + * @return {this} This Matrix4. + */ + rotateY: function (rad) + { + var a = this.val; + var s = Math.sin(rad); + var c = Math.cos(rad); - lastSet = set; - } + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; - return { tilesets: tilesets, imageCollections: imageCollections }; -}; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; -module.exports = ParseTilesets; + // Perform axis-specific matrix multiplication + a[0] = a00 * c - a20 * s; + a[1] = a01 * c - a21 * s; + a[2] = a02 * c - a22 * s; + a[3] = a03 * c - a23 * s; + a[8] = a00 * s + a20 * c; + a[9] = a01 * s + a21 * c; + a[10] = a02 * s + a22 * c; + a[11] = a03 * s + a23 * c; + return this; + }, -/***/ }), -/* 576 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Rotate this matrix on its Z axis. + * + * @method Phaser.Math.Matrix4#rotateZ + * @since 3.0.0 + * + * @param {number} rad - The angle to rotate by, in radians. + * + * @return {this} This Matrix4. + */ + rotateZ: function (rad) + { + var a = this.val; + var s = Math.sin(rad); + var c = Math.cos(rad); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; -var Class = __webpack_require__(0); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; -/** - * @classdesc - * An Image Collection is a special Tile Set containing multiple images, with no slicing into each image. - * - * Image Collections are normally created automatically when Tiled data is loaded. - * - * @class ImageCollection - * @memberof Phaser.Tilemaps - * @constructor - * @since 3.0.0 - * - * @param {string} name - The name of the image collection in the map data. - * @param {number} firstgid - The first image index this image collection contains. - * @param {number} [width=32] - Width of widest image (in pixels). - * @param {number} [height=32] - Height of tallest image (in pixels). - * @param {number} [margin=0] - The margin around all images in the collection (in pixels). - * @param {number} [spacing=0] - The spacing between each image in the collection (in pixels). - * @param {object} [properties={}] - Custom Image Collection properties. - */ -var ImageCollection = new Class({ + // Perform axis-specific matrix multiplication + a[0] = a00 * c + a10 * s; + a[1] = a01 * c + a11 * s; + a[2] = a02 * c + a12 * s; + a[3] = a03 * c + a13 * s; + a[4] = a10 * c - a00 * s; + a[5] = a11 * c - a01 * s; + a[6] = a12 * c - a02 * s; + a[7] = a13 * c - a03 * s; - initialize: + return this; + }, - function ImageCollection (name, firstgid, width, height, margin, spacing, properties) + /** + * Set the values of this Matrix from the given rotation Quaternion and translation Vector. + * + * @method Phaser.Math.Matrix4#fromRotationTranslation + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set rotation from. + * @param {Phaser.Math.Vector3} v - The Vector to set translation from. + * + * @return {this} This Matrix4. + */ + fromRotationTranslation: function (q, v) { - if (width === undefined || width <= 0) { width = 32; } - if (height === undefined || height <= 0) { height = 32; } - if (margin === undefined) { margin = 0; } - if (spacing === undefined) { spacing = 0; } - - /** - * The name of the Image Collection. - * - * @name Phaser.Tilemaps.ImageCollection#name - * @type {string} - * @since 3.0.0 - */ - this.name = name; + // Quaternion math + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; - /** - * The Tiled firstgid value. - * This is the starting index of the first image index this Image Collection contains. - * - * @name Phaser.Tilemaps.ImageCollection#firstgid - * @type {number} - * @since 3.0.0 - */ - this.firstgid = firstgid | 0; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; - /** - * The width of the widest image (in pixels). - * - * @name Phaser.Tilemaps.ImageCollection#imageWidth - * @type {number} - * @readonly - * @since 3.0.0 - */ - this.imageWidth = width | 0; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; - /** - * The height of the tallest image (in pixels). - * - * @name Phaser.Tilemaps.ImageCollection#imageHeight - * @type {number} - * @readonly - * @since 3.0.0 - */ - this.imageHeight = height | 0; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; - /** - * The margin around the images in the collection (in pixels). - * Use `setSpacing` to change. - * - * @name Phaser.Tilemaps.ImageCollection#imageMarge - * @type {number} - * @readonly - * @since 3.0.0 - */ - this.imageMargin = margin | 0; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; - /** - * The spacing between each image in the collection (in pixels). - * Use `setSpacing` to change. - * - * @name Phaser.Tilemaps.ImageCollection#imageSpacing - * @type {number} - * @readonly - * @since 3.0.0 - */ - this.imageSpacing = spacing | 0; + return this.setValues( + 1 - (yy + zz), + xy + wz, + xz - wy, + 0, - /** - * Image Collection-specific properties that are typically defined in the Tiled editor. - * - * @name Phaser.Tilemaps.ImageCollection#properties - * @type {object} - * @since 3.0.0 - */ - this.properties = properties || {}; + xy - wz, + 1 - (xx + zz), + yz + wx, + 0, - /** - * The cached images that are a part of this collection. - * - * @name Phaser.Tilemaps.ImageCollection#images - * @type {array} - * @readonly - * @since 3.0.0 - */ - this.images = []; + xz + wy, + yz - wx, + 1 - (xx + yy), + 0, - /** - * The total number of images in the image collection. - * - * @name Phaser.Tilemaps.ImageCollection#total - * @type {number} - * @readonly - * @since 3.0.0 - */ - this.total = 0; + v.x, + v.y, + v.z, + 1 + ); }, /** - * Returns true if and only if this image collection contains the given image index. + * Set the values of this Matrix from the given Quaternion. * - * @method Phaser.Tilemaps.ImageCollection#containsImageIndex + * @method Phaser.Math.Matrix4#fromQuat * @since 3.0.0 - * - * @param {number} imageIndex - The image index to search for. - * - * @return {boolean} True if this Image Collection contains the given index. + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to set the values of this Matrix from. + * + * @return {this} This Matrix4. */ - containsImageIndex: function (imageIndex) + fromQuat: function (q) { - return (imageIndex >= this.firstgid && imageIndex < (this.firstgid + this.total)); + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; + + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + + return this.setValues( + 1 - (yy + zz), + xy + wz, + xz - wy, + 0, + + xy - wz, + 1 - (xx + zz), + yz + wx, + 0, + + xz + wy, + yz - wx, + 1 - (xx + yy), + 0, + + 0, + 0, + 0, + 1 + ); }, /** - * Add an image to this Image Collection. + * Generate a frustum matrix with the given bounds. * - * @method Phaser.Tilemaps.ImageCollection#addImage + * @method Phaser.Math.Matrix4#frustum * @since 3.0.0 - * - * @param {number} gid - The gid of the image in the Image Collection. - * @param {string} image - The the key of the image in the Image Collection and in the cache. * - * @return {Phaser.Tilemaps.ImageCollection} This ImageCollection object. + * @param {number} left - The left bound of the frustum. + * @param {number} right - The right bound of the frustum. + * @param {number} bottom - The bottom bound of the frustum. + * @param {number} top - The top bound of the frustum. + * @param {number} near - The near bound of the frustum. + * @param {number} far - The far bound of the frustum. + * + * @return {this} This Matrix4. */ - addImage: function (gid, image) + frustum: function (left, right, bottom, top, near, far) { - this.images.push({ gid: gid, image: image }); - this.total++; + var rl = 1 / (right - left); + var tb = 1 / (top - bottom); + var nf = 1 / (near - far); - return this; - } + return this.setValues( + (near * 2) * rl, + 0, + 0, + 0, -}); + 0, + (near * 2) * tb, + 0, + 0, -module.exports = ImageCollection; + (right + left) * rl, + (top + bottom) * tb, + (far + near) * nf, + -1, + 0, + 0, + (far * near * 2) * nf, + 0 + ); + }, -/***/ }), -/* 577 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Generate a perspective projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#perspective + * @since 3.0.0 + * + * @param {number} fovy - Vertical field of view in radians + * @param {number} aspect - Aspect ratio. Typically viewport width /height. + * @param {number} near - Near bound of the frustum. + * @param {number} far - Far bound of the frustum. + * + * @return {this} This Matrix4. + */ + perspective: function (fovy, aspect, near, far) + { + var f = 1.0 / Math.tan(fovy / 2); + var nf = 1 / (near - far); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this.setValues( + f / aspect, + 0, + 0, + 0, -var Formats = __webpack_require__(40); -var MapData = __webpack_require__(121); -var ParseTileLayers = __webpack_require__(578); -var ParseTilesets = __webpack_require__(579); + 0, + f, + 0, + 0, -/** - * Parses a Weltmeister JSON object into a new MapData object. - * - * @function Phaser.Tilemaps.Parsers.Impact.ParseWeltmeister - * @since 3.0.0 - * - * @param {string} name - The name of the tilemap, used to set the name on the MapData. - * @param {object} json - The Weltmeister JSON object. - * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map - * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty - * location will get a Tile object with an index of -1. If you've a large sparsely populated map and - * the tile data doesn't need to change then setting this value to `true` will help with memory - * consumption. However if your map is small or you need to update the tiles dynamically, then leave - * the default value set. - * - * @return {?Phaser.Tilemaps.MapData} The created MapData object, or `null` if the data can't be parsed. - */ -var ParseWeltmeister = function (name, json, insertNull) -{ - if (json.layer.length === 0) - { - console.warn('No layers found in the Weltmeister map: ' + name); - return null; - } + 0, + 0, + (far + near) * nf, + -1, - var width = 0; - var height = 0; + 0, + 0, + (2 * far * near) * nf, + 0 + ); + }, - for (var i = 0; i < json.layer.length; i++) + /** + * Generate a perspective projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#perspectiveLH + * @since 3.0.0 + * + * @param {number} width - The width of the frustum. + * @param {number} height - The height of the frustum. + * @param {number} near - Near bound of the frustum. + * @param {number} far - Far bound of the frustum. + * + * @return {this} This Matrix4. + */ + perspectiveLH: function (width, height, near, far) { - if (json.layer[i].width > width) { width = json.layer[i].width; } - if (json.layer[i].height > height) { height = json.layer[i].height; } - } + return this.setValues( + (2 * near) / width, + 0, + 0, + 0, - var mapData = new MapData({ - width: width, - height: height, - name: name, - tileWidth: json.layer[0].tilesize, - tileHeight: json.layer[0].tilesize, - format: Formats.WELTMEISTER - }); + 0, + (2 * near) / height, + 0, + 0, - mapData.layers = ParseTileLayers(json, insertNull); - mapData.tilesets = ParseTilesets(json); + 0, + 0, + -far / (near - far), + 1, - return mapData; -}; + 0, + 0, + (near * far) / (near - far), + 0 + ); + }, -module.exports = ParseWeltmeister; + /** + * Generate an orthogonal projection matrix with the given bounds. + * + * @method Phaser.Math.Matrix4#ortho + * @since 3.0.0 + * + * @param {number} left - The left bound of the frustum. + * @param {number} right - The right bound of the frustum. + * @param {number} bottom - The bottom bound of the frustum. + * @param {number} top - The top bound of the frustum. + * @param {number} near - The near bound of the frustum. + * @param {number} far - The far bound of the frustum. + * + * @return {this} This Matrix4. + */ + ortho: function (left, right, bottom, top, near, far) + { + var lr = left - right; + var bt = bottom - top; + var nf = near - far; + // Avoid division by zero + lr = (lr === 0) ? lr : 1 / lr; + bt = (bt === 0) ? bt : 1 / bt; + nf = (nf === 0) ? nf : 1 / nf; -/***/ }), -/* 578 */ -/***/ (function(module, exports, __webpack_require__) { + return this.setValues( + -2 * lr, + 0, + 0, + 0, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + 0, + -2 * bt, + 0, + 0, -var LayerData = __webpack_require__(120); -var Tile = __webpack_require__(85); + 0, + 0, + 2 * nf, + 0, -/** - * Parses all tilemap layers in an Impact JSON object into new LayerData objects. - * - * @function Phaser.Tilemaps.Parsers.Impact.ParseTileLayers - * @since 3.0.0 - * - * @param {object} json - The Impact JSON object. - * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map - * data are handled (see {@link Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled}). - * - * @return {Phaser.Tilemaps.LayerData[]} - An array of LayerData objects, one for each entry in - * json.layers with the type 'tilelayer'. - */ -var ParseTileLayers = function (json, insertNull) -{ - var tileLayers = []; + (left + right) * lr, + (top + bottom) * bt, + (far + near) * nf, + 1 + ); + }, - for (var i = 0; i < json.layer.length; i++) + /** + * Generate a right-handed look-at matrix with the given eye position, target and up axis. + * + * @method Phaser.Math.Matrix4#lookAtRH + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} eye - Position of the viewer. + * @param {Phaser.Math.Vector3} target - Point the viewer is looking at. + * @param {Phaser.Math.Vector3} up - vec3 pointing up. + * + * @return {this} This Matrix4. + */ + lookAtRH: function (eye, target, up) { - var layer = json.layer[i]; - - var layerData = new LayerData({ - name: layer.name, - width: layer.width, - height: layer.height, - tileWidth: layer.tilesize, - tileHeight: layer.tilesize, - visible: layer.visible === 1 - }); + var m = this.val; - var row = []; - var tileGrid = []; + _z.subVectors(eye, target); - // Loop through the data field in the JSON. This is a 2D array containing the tile indexes, - // one after the other. The indexes are relative to the tileset that contains the tile. - for (var y = 0; y < layer.data.length; y++) + if (_z.getLengthSquared() === 0) { - for (var x = 0; x < layer.data[y].length; x++) - { - // In Weltmeister, 0 = no tile, but the Tilemap API expects -1 = no tile. - var index = layer.data[y][x] - 1; + // eye and target are in the same position + _z.z = 1; + } - var tile; + _z.normalize(); + _x.crossVectors(up, _z); - if (index > -1) - { - tile = new Tile(layerData, index, x, y, layer.tilesize, layer.tilesize); - } - else - { - tile = insertNull - ? null - : new Tile(layerData, -1, x, y, layer.tilesize, layer.tilesize); - } + if (_x.getLengthSquared() === 0) + { + // up and z are parallel - row.push(tile); + if (Math.abs(up.z) === 1) + { + _z.x += 0.0001; + } + else + { + _z.z += 0.0001; } - tileGrid.push(row); - row = []; + _z.normalize(); + _x.crossVectors(up, _z); } - layerData.data = tileGrid; + _x.normalize(); + _y.crossVectors(_z, _x); - tileLayers.push(layerData); - } + m[0] = _x.x; + m[1] = _x.y; + m[2] = _x.z; + m[4] = _y.x; + m[5] = _y.y; + m[6] = _y.z; + m[8] = _z.x; + m[9] = _z.y; + m[10] = _z.z; - return tileLayers; -}; + return this; + }, -module.exports = ParseTileLayers; + /** + * Generate a look-at matrix with the given eye position, focal point, and up axis. + * + * @method Phaser.Math.Matrix4#lookAt + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} eye - Position of the viewer + * @param {Phaser.Math.Vector3} center - Point the viewer is looking at + * @param {Phaser.Math.Vector3} up - vec3 pointing up. + * + * @return {this} This Matrix4. + */ + lookAt: function (eye, center, up) + { + var eyex = eye.x; + var eyey = eye.y; + var eyez = eye.z; + var upx = up.x; + var upy = up.y; + var upz = up.z; -/***/ }), -/* 579 */ -/***/ (function(module, exports, __webpack_require__) { + var centerx = center.x; + var centery = center.y; + var centerz = center.z; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (Math.abs(eyex - centerx) < EPSILON && + Math.abs(eyey - centery) < EPSILON && + Math.abs(eyez - centerz) < EPSILON) + { + return this.identity(); + } -var Tileset = __webpack_require__(122); + var z0 = eyex - centerx; + var z1 = eyey - centery; + var z2 = eyez - centerz; -/** - * Tilesets and Image Collections - * - * @function Phaser.Tilemaps.Parsers.Impact.ParseTilesets - * @since 3.0.0 - * - * @param {object} json - The Impact JSON data. - * - * @return {array} An array of Tilesets. - */ -var ParseTilesets = function (json) -{ - var tilesets = []; - var tilesetsNames = []; + var len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); - for (var i = 0; i < json.layer.length; i++) - { - var layer = json.layer[i]; + z0 *= len; + z1 *= len; + z2 *= len; - // A relative filepath to the source image (within Weltmeister) is used for the name - var tilesetName = layer.tilesetName; + var x0 = upy * z2 - upz * z1; + var x1 = upz * z0 - upx * z2; + var x2 = upx * z1 - upy * z0; - // Only add unique tilesets that have a valid name. Collision layers will have a blank name. - if (tilesetName !== '' && tilesetsNames.indexOf(tilesetName) === -1) - { - tilesetsNames.push(tilesetName); + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); - // Tiles are stored with an ID relative to the tileset, rather than a globally unique ID - // across all tilesets. Also, tilesets in Weltmeister have no margin or padding. - tilesets.push(new Tileset(tilesetName, 0, layer.tilesize, layer.tilesize, 0, 0)); + if (!len) + { + x0 = 0; + x1 = 0; + x2 = 0; + } + else + { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; } - } - - return tilesets; -}; -module.exports = ParseTilesets; + var y0 = z1 * x2 - z2 * x1; + var y1 = z2 * x0 - z0 * x2; + var y2 = z0 * x1 - z1 * x0; + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); -/***/ }), -/* 580 */ -/***/ (function(module, exports, __webpack_require__) { + if (!len) + { + y0 = 0; + y1 = 0; + y2 = 0; + } + else + { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this.setValues( + x0, + y0, + z0, + 0, -var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(36); -var Formats = __webpack_require__(40); -var GetFastValue = __webpack_require__(2); -var LayerData = __webpack_require__(120); -var ORIENTATION = __webpack_require__(29); -var Rotate = __webpack_require__(362); -var SpliceOne = __webpack_require__(74); -var Sprite = __webpack_require__(73); -var Tile = __webpack_require__(85); -var TilemapComponents = __webpack_require__(251); -var TilemapLayer = __webpack_require__(581); -var Tileset = __webpack_require__(122); + x1, + y1, + z1, + 0, -/** - * @callback TilemapFilterCallback - * - * @param {Phaser.GameObjects.GameObject} value - An object found in the filtered area. - * @param {number} index - The index of the object within the array. - * @param {Phaser.GameObjects.GameObject[]} array - An array of all the objects found. - * - * @return {Phaser.GameObjects.GameObject} The object. - */ + x2, + y2, + z2, + 0, -/** - * @callback TilemapFindCallback - * - * @param {Phaser.GameObjects.GameObject} value - An object found. - * @param {number} index - The index of the object within the array. - * @param {Phaser.GameObjects.GameObject[]} array - An array of all the objects found. - * - * @return {boolean} `true` if the callback should be invoked, otherwise `false`. + -(x0 * eyex + x1 * eyey + x2 * eyez), + -(y0 * eyex + y1 * eyey + y2 * eyez), + -(z0 * eyex + z1 * eyey + z2 * eyez), + 1 + ); + }, + + /** + * Set the values of this matrix from the given `yaw`, `pitch` and `roll` values. + * + * @method Phaser.Math.Matrix4#yawPitchRoll + * @since 3.0.0 + * + * @param {number} yaw - The yaw value. + * @param {number} pitch - The pitch value. + * @param {number} roll - The roll value. + * + * @return {this} This Matrix4. + */ + yawPitchRoll: function (yaw, pitch, roll) + { + this.zero(); + _tempMat1.zero(); + _tempMat2.zero(); + + var m0 = this.val; + var m1 = _tempMat1.val; + var m2 = _tempMat2.val; + + // Rotate Z + var s = Math.sin(roll); + var c = Math.cos(roll); + + m0[10] = 1; + m0[15] = 1; + m0[0] = c; + m0[1] = s; + m0[4] = -s; + m0[5] = c; + + // Rotate X + s = Math.sin(pitch); + c = Math.cos(pitch); + + m1[0] = 1; + m1[15] = 1; + m1[5] = c; + m1[10] = c; + m1[9] = -s; + m1[6] = s; + + // Rotate Y + s = Math.sin(yaw); + c = Math.cos(yaw); + + m2[5] = 1; + m2[15] = 1; + m2[0] = c; + m2[2] = -s; + m2[8] = s; + m2[10] = c; + + this.multiplyLocal(_tempMat1); + this.multiplyLocal(_tempMat2); + + return this; + }, + + /** + * Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix. + * + * @method Phaser.Math.Matrix4#setWorldMatrix + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} rotation - The rotation of the world matrix. + * @param {Phaser.Math.Vector3} position - The position of the world matrix. + * @param {Phaser.Math.Vector3} scale - The scale of the world matrix. + * @param {Phaser.Math.Matrix4} [viewMatrix] - The view matrix. + * @param {Phaser.Math.Matrix4} [projectionMatrix] - The projection matrix. + * + * @return {this} This Matrix4. + */ + setWorldMatrix: function (rotation, position, scale, viewMatrix, projectionMatrix) + { + this.yawPitchRoll(rotation.y, rotation.x, rotation.z); + + _tempMat1.scaling(scale.x, scale.y, scale.z); + _tempMat2.xyz(position.x, position.y, position.z); + + this.multiplyLocal(_tempMat1); + this.multiplyLocal(_tempMat2); + + if (viewMatrix) + { + this.multiplyLocal(viewMatrix); + } + + if (projectionMatrix) + { + this.multiplyLocal(projectionMatrix); + } + + return this; + }, + + /** + * Multiplies this Matrix4 by the given `src` Matrix4 and stores the results in the `out` Matrix4. + * + * @method Phaser.Math.Matrix4#multiplyToMat4 + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} src - The Matrix4 to multiply with this one. + * @param {Phaser.Math.Matrix4} out - The receiving Matrix. + * + * @return {Phaser.Math.Matrix4} This `out` Matrix4. + */ + multiplyToMat4: function (src, out) + { + var a = this.val; + var b = src.val; + + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + var a30 = a[12]; + var a31 = a[13]; + var a32 = a[14]; + var a33 = a[15]; + + var b00 = b[0]; + var b01 = b[1]; + var b02 = b[2]; + var b03 = b[3]; + var b10 = b[4]; + var b11 = b[5]; + var b12 = b[6]; + var b13 = b[7]; + var b20 = b[8]; + var b21 = b[9]; + var b22 = b[10]; + var b23 = b[11]; + var b30 = b[12]; + var b31 = b[13]; + var b32 = b[14]; + var b33 = b[15]; + + return out.setValues( + b00 * a00 + b01 * a10 + b02 * a20 + b03 * a30, + b01 * a01 + b01 * a11 + b02 * a21 + b03 * a31, + b02 * a02 + b01 * a12 + b02 * a22 + b03 * a32, + b03 * a03 + b01 * a13 + b02 * a23 + b03 * a33, + + b10 * a00 + b11 * a10 + b12 * a20 + b13 * a30, + b10 * a01 + b11 * a11 + b12 * a21 + b13 * a31, + b10 * a02 + b11 * a12 + b12 * a22 + b13 * a32, + b10 * a03 + b11 * a13 + b12 * a23 + b13 * a33, + + b20 * a00 + b21 * a10 + b22 * a20 + b23 * a30, + b20 * a01 + b21 * a11 + b22 * a21 + b23 * a31, + b20 * a02 + b21 * a12 + b22 * a22 + b23 * a32, + b20 * a03 + b21 * a13 + b22 * a23 + b23 * a33, + + b30 * a00 + b31 * a10 + b32 * a20 + b33 * a30, + b30 * a01 + b31 * a11 + b32 * a21 + b33 * a31, + b30 * a02 + b31 * a12 + b32 * a22 + b33 * a32, + b30 * a03 + b31 * a13 + b32 * a23 + b33 * a33 + ); + }, + + /** + * Takes the rotation and position vectors and builds this Matrix4 from them. + * + * @method Phaser.Math.Matrix4#fromRotationXYTranslation + * @since 3.50.0 + * + * @param {Phaser.Math.Vector3} rotation - The rotation vector. + * @param {Phaser.Math.Vector3} position - The position vector. + * @param {boolean} translateFirst - Should the operation translate then rotate (`true`), or rotate then translate? (`false`) + * + * @return {this} This Matrix4. + */ + fromRotationXYTranslation: function (rotation, position, translateFirst) + { + var x = position.x; + var y = position.y; + var z = position.z; + + var sx = Math.sin(rotation.x); + var cx = Math.cos(rotation.x); + + var sy = Math.sin(rotation.y); + var cy = Math.cos(rotation.y); + + var a30 = x; + var a31 = y; + var a32 = z; + + // Rotate X + + var b21 = -sx; + + // Rotate Y + + var c01 = 0 - b21 * sy; + + var c02 = 0 - cx * sy; + + var c21 = b21 * cy; + + var c22 = cx * cy; + + // Translate + if (!translateFirst) + { + // a30 = cy * x + 0 * y + sy * z; + a30 = cy * x + sy * z; + a31 = c01 * x + cx * y + c21 * z; + a32 = c02 * x + sx * y + c22 * z; + } + + return this.setValues( + cy, + c01, + c02, + 0, + 0, + cx, + sx, + 0, + sy, + c21, + c22, + 0, + a30, + a31, + a32, + 1 + ); + }, + + /** + * Returns the maximum axis scale from this Matrix4. + * + * @method Phaser.Math.Matrix4#getMaxScaleOnAxis + * @since 3.50.0 + * + * @return {number} The maximum axis scale. + */ + getMaxScaleOnAxis: function () + { + var m = this.val; + + var scaleXSq = m[0] * m[0] + m[1] * m[1] + m[2] * m[2]; + var scaleYSq = m[4] * m[4] + m[5] * m[5] + m[6] * m[6]; + var scaleZSq = m[8] * m[8] + m[9] * m[9] + m[10] * m[10]; + + return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq)); + } + +}); + +/** + * @ignore */ +var _tempMat1 = new Matrix4(); /** - * @classdesc - * A Tilemap is a container for Tilemap data. This isn't a display object, rather, it holds data - * about the map and allows you to add tilesets and tilemap layers to it. A map can have one or - * more tilemap layers, which are the display objects that actually render the tiles. - * - * The Tilemap data can be parsed from a Tiled JSON file, a CSV file or a 2D array. Tiled is a free - * software package specifically for creating tile maps, and is available from: - * http://www.mapeditor.org - * - * As of Phaser 3.50.0 the Tilemap API now supports the following types of map: + * @ignore + */ +var _tempMat2 = new Matrix4(); + +/** + * @ignore + */ +var _x = new Vector3(); + +/** + * @ignore + */ +var _y = new Vector3(); + +/** + * @ignore + */ +var _z = new Vector3(); + +module.exports = Matrix4; + + +/***/ }), + +/***/ 69635: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Add an `amount` to a `value`, limiting the maximum result to `max`. * - * 1) Orthogonal - * 2) Isometric - * 3) Hexagonal - * 4) Staggered + * @function Phaser.Math.MaxAdd + * @since 3.0.0 * - * Prior to this release, only orthogonal maps were supported. + * @param {number} value - The value to add to. + * @param {number} amount - The amount to add. + * @param {number} max - The maximum value to return. * - * Another large change in 3.50 was the consolidation of Tilemap Layers. Previously, you created - * either a Static or Dynamic Tilemap Layer. However, as of 3.50 the features of both have been - * merged and the API simplified, so now there is just the single `TilemapLayer` class. + * @return {number} The resulting value. + */ +var MaxAdd = function (value, amount, max) +{ + return Math.min(value + amount, max); +}; + +module.exports = MaxAdd; + + +/***/ }), + +/***/ 37394: +/***/ ((module) => { + +/** + * @author Vladislav Forsh + * @copyright 2021 RoboWhale + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Calculate the median of the given values. The values are sorted and the middle value is returned. + * In case of an even number of values, the average of the two middle values is returned. * - * A Tilemap has handy methods for getting and manipulating the tiles within a layer, allowing - * you to build or modify the tilemap data at runtime. + * @function Phaser.Math.Median + * @since 3.54.0 * - * Note that all Tilemaps use a base tile size to calculate dimensions from, but that a - * TilemapLayer may have its own unique tile size that overrides this. + * @param {number[]} values - The values to average. * - * As of Phaser 3.21.0, if your tilemap includes layer groups (a feature of Tiled 1.2.0+) these - * will be traversed and the following properties will impact children: + * @return {number} The median value. + */ +var Median = function (values) +{ + var valuesNum = values.length; + if (valuesNum === 0) + { + return 0; + } + + values.sort(function (a, b) { return a - b; }); + + var halfIndex = Math.floor(valuesNum / 2); + + return valuesNum % 2 === 0 + ? (values[halfIndex] + values[halfIndex - 1]) / 2 + : values[halfIndex]; +}; + +module.exports = Median; + + +/***/ }), + +/***/ 17259: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Subtract an `amount` from `value`, limiting the minimum result to `min`. * - * - Opacity (blended with parent) and visibility (parent overrides child) - * - Vertical and horizontal offset + * @function Phaser.Math.MinSub + * @since 3.0.0 * - * The grouping hierarchy is not preserved and all layers will be flattened into a single array. + * @param {number} value - The value to subtract from. + * @param {number} amount - The amount to subtract. + * @param {number} min - The minimum value to return. * - * Group layers are parsed during Tilemap construction but are discarded after parsing so dynamic - * layers will NOT continue to be affected by a parent. + * @return {number} The resulting value. + */ +var MinSub = function (value, amount, min) +{ + return Math.max(value - amount, min); +}; + +module.exports = MinSub; + + +/***/ }), + +/***/ 61820: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Work out what percentage `value` is of the range between `min` and `max`. + * If `max` isn't given then it will return the percentage of `value` to `min`. * - * To avoid duplicate layer names, a layer that is a child of a group layer will have its parent - * group name prepended with a '/'. For example, consider a group called 'ParentGroup' with a - * child called 'Layer 1'. In the Tilemap object, 'Layer 1' will have the name - * 'ParentGroup/Layer 1'. + * You can optionally specify an `upperMax` value, which is a mid-way point in the range that represents 100%, after which the % starts to go down to zero again. * - * @class Tilemap - * @memberof Phaser.Tilemaps - * @constructor + * @function Phaser.Math.Percent * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene to which this Tilemap belongs. - * @param {Phaser.Tilemaps.MapData} mapData - A MapData instance containing Tilemap data. + * @param {number} value - The value to determine the percentage of. + * @param {number} min - The minimum value. + * @param {number} [max] - The maximum value. + * @param {number} [upperMax] - The mid-way point in the range that represents 100%. + * + * @return {number} A value between 0 and 1 representing the percentage. */ -var Tilemap = new Class({ +var Percent = function (value, min, max, upperMax) +{ + if (max === undefined) { max = min + 1; } - initialize: + var percentage = (value - min) / (max - min); - function Tilemap (scene, mapData) + if (percentage > 1) { - /** - * @name Phaser.Tilemaps.Tilemap#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; + if (upperMax !== undefined) + { + percentage = ((upperMax - value)) / (upperMax - max); - /** - * The base width of a tile in pixels. Note that individual layers may have a different tile - * width. - * - * @name Phaser.Tilemaps.Tilemap#tileWidth - * @type {number} - * @since 3.0.0 - */ - this.tileWidth = mapData.tileWidth; + if (percentage < 0) + { + percentage = 0; + } + } + else + { + percentage = 1; + } + } + else if (percentage < 0) + { + percentage = 0; + } - /** - * The base height of a tile in pixels. Note that individual layers may have a different - * tile height. - * - * @name Phaser.Tilemaps.Tilemap#tileHeight - * @type {number} - * @since 3.0.0 - */ - this.tileHeight = mapData.tileHeight; + return percentage; +}; - /** - * The width of the map (in tiles). - * - * @name Phaser.Tilemaps.Tilemap#width - * @type {number} - * @since 3.0.0 - */ - this.width = mapData.width; +module.exports = Percent; - /** - * The height of the map (in tiles). - * - * @name Phaser.Tilemaps.Tilemap#height - * @type {number} - * @since 3.0.0 - */ - this.height = mapData.height; - /** - * The orientation of the map data (as specified in Tiled), usually 'orthogonal'. - * - * @name Phaser.Tilemaps.Tilemap#orientation - * @type {string} - * @since 3.0.0 - */ - this.orientation = mapData.orientation; +/***/ }), - /** - * The render (draw) order of the map data (as specified in Tiled), usually 'right-down'. - * - * The draw orders are: - * - * right-down - * left-down - * right-up - * left-up - * - * This can be changed via the `setRenderOrder` method. - * - * @name Phaser.Tilemaps.Tilemap#renderOrder - * @type {string} - * @since 3.12.0 - */ - this.renderOrder = mapData.renderOrder; +/***/ 75003: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The format of the map data. - * - * @name Phaser.Tilemaps.Tilemap#format - * @type {number} - * @since 3.0.0 - */ - this.format = mapData.format; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The version of the map data (as specified in Tiled, usually 1). - * - * @name Phaser.Tilemaps.Tilemap#version - * @type {number} - * @since 3.0.0 - */ - this.version = mapData.version; +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl - /** - * Map specific properties as specified in Tiled. - * - * @name Phaser.Tilemaps.Tilemap#properties - * @type {object} - * @since 3.0.0 - */ - this.properties = mapData.properties; +var Class = __webpack_require__(56694); +var Matrix3 = __webpack_require__(5341); +var NOOP = __webpack_require__(72283); +var Vector3 = __webpack_require__(70015); - /** - * The width of the map in pixels based on width * tileWidth. - * - * @name Phaser.Tilemaps.Tilemap#widthInPixels - * @type {number} - * @since 3.0.0 - */ - this.widthInPixels = mapData.widthInPixels; +var EPSILON = 0.000001; - /** - * The height of the map in pixels based on height * tileHeight. - * - * @name Phaser.Tilemaps.Tilemap#heightInPixels - * @type {number} - * @since 3.0.0 - */ - this.heightInPixels = mapData.heightInPixels; +// Some shared 'private' arrays +var siNext = new Int8Array([ 1, 2, 0 ]); +var tmp = new Float32Array([ 0, 0, 0 ]); - /** - * A collection of Images, as parsed from Tiled map data. - * - * @name Phaser.Tilemaps.Tilemap#imageCollections - * @type {Phaser.Tilemaps.ImageCollection[]} - * @since 3.0.0 - */ - this.imageCollections = mapData.imageCollections; +var xUnitVec3 = new Vector3(1, 0, 0); +var yUnitVec3 = new Vector3(0, 1, 0); - /** - * An array of Tiled Image Layers. - * - * @name Phaser.Tilemaps.Tilemap#images - * @type {array} - * @since 3.0.0 - */ - this.images = mapData.images; +var tmpvec = new Vector3(); +var tmpMat3 = new Matrix3(); - /** - * An array of Tilemap layer data. - * - * @name Phaser.Tilemaps.Tilemap#layers - * @type {Phaser.Tilemaps.LayerData[]} - * @since 3.0.0 - */ - this.layers = mapData.layers; +/** + * @classdesc + * A quaternion. + * + * @class Quaternion + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x=0] - The x component. + * @param {number} [y=0] - The y component. + * @param {number} [z=0] - The z component. + * @param {number} [w=1] - The w component. + */ +var Quaternion = new Class({ + + initialize: + function Quaternion (x, y, z, w) + { /** - * An array of Tilesets used in the map. + * The x component of this Quaternion. * - * @name Phaser.Tilemaps.Tilemap#tilesets - * @type {Phaser.Tilemaps.Tileset[]} - * @since 3.0.0 + * @name Phaser.Math.Quaternion#_x + * @type {number} + * @default 0 + * @private + * @since 3.50.0 */ - this.tilesets = mapData.tilesets; /** - * An array of ObjectLayer instances parsed from Tiled object layers. + * The y component of this Quaternion. * - * @name Phaser.Tilemaps.Tilemap#objects - * @type {Phaser.Tilemaps.ObjectLayer[]} - * @since 3.0.0 + * @name Phaser.Math.Quaternion#_y + * @type {number} + * @default 0 + * @private + * @since 3.50.0 */ - this.objects = mapData.objects; /** - * The index of the currently selected LayerData object. + * The z component of this Quaternion. * - * @name Phaser.Tilemaps.Tilemap#currentLayerIndex + * @name Phaser.Math.Quaternion#_z * @type {number} - * @since 3.0.0 + * @default 0 + * @private + * @since 3.50.0 */ - this.currentLayerIndex = 0; /** - * The length of the horizontal sides of the hexagon. - * Only used for hexagonal orientation Tilemaps. + * The w component of this Quaternion. * - * @name Phaser.Tilemaps.Tilemap#hexSideLength + * @name Phaser.Math.Quaternion#_w * @type {number} + * @default 0 + * @private * @since 3.50.0 */ - this.hexSideLength = mapData.hexSideLength; - - var orientation = this.orientation; /** - * Functions used to handle world to tile, and tile to world, conversion. - * Cached here for internal use by public methods such as `worldToTileXY`, etc. + * This callback is invoked, if set, each time a value in this quaternion is changed. + * The callback is passed one argument, a reference to this quaternion. * - * @name Phaser.Tilemaps.Tilemap#_convert - * @private - * @type {object} + * @name Phaser.Math.Quaternion#onChangeCallback + * @type {function} * @since 3.50.0 */ - this._convert = { - WorldToTileXY: TilemapComponents.GetWorldToTileXYFunction(orientation), - WorldToTileX: TilemapComponents.GetWorldToTileXFunction(orientation), - WorldToTileY: TilemapComponents.GetWorldToTileYFunction(orientation), - TileToWorldXY: TilemapComponents.GetTileToWorldXYFunction(orientation), - TileToWorldX: TilemapComponents.GetTileToWorldXFunction(orientation), - TileToWorldY: TilemapComponents.GetTileToWorldYFunction(orientation) - }; + this.onChangeCallback = NOOP; + + this.set(x, y, z, w); }, /** - * @ignore + * The x component of this Quaternion. + * + * @name Phaser.Math.Quaternion#x + * @type {number} + * @default 0 + * @since 3.0.0 */ - createBlankDynamicLayer: function (name, tileset, x, y, width, height, tileWidth, tileHeight) - { - console.warn('createBlankDynamicLayer is deprecated. Use createBlankLayer'); + x: { + get: function () + { + return this._x; + }, + + set: function (value) + { + this._x = value; - return this.createBlankLayer(name, tileset, x, y, width, height, tileWidth, tileHeight); + this.onChangeCallback(this); + } }, /** - * @ignore + * The y component of this Quaternion. + * + * @name Phaser.Math.Quaternion#y + * @type {number} + * @default 0 + * @since 3.0.0 */ - createDynamicLayer: function (layerID, tileset, x, y) - { - console.warn('createDynamicLayer is deprecated. Use createLayer'); + y: { + get: function () + { + return this._y; + }, + + set: function (value) + { + this._y = value; - return this.createLayer(layerID, tileset, x, y); + this.onChangeCallback(this); + } }, /** - * @ignore + * The z component of this Quaternion. + * + * @name Phaser.Math.Quaternion#z + * @type {number} + * @default 0 + * @since 3.0.0 */ - createStaticLayer: function (layerID, tileset, x, y) - { - console.warn('createStaticLayer is deprecated. Use createLayer'); + z: { + get: function () + { + return this._z; + }, + + set: function (value) + { + this._z = value; - return this.createLayer(layerID, tileset, x, y); + this.onChangeCallback(this); + } }, /** - * Sets the rendering (draw) order of the tiles in this map. - * - * The default is 'right-down', meaning it will order the tiles starting from the top-left, - * drawing to the right and then moving down to the next row. - * - * The draw orders are: + * The w component of this Quaternion. * - * 0 = right-down - * 1 = left-down - * 2 = right-up - * 3 = left-up + * @name Phaser.Math.Quaternion#w + * @type {number} + * @default 0 + * @since 3.0.0 + */ + w: { + get: function () + { + return this._w; + }, + + set: function (value) + { + this._w = value; + + this.onChangeCallback(this); + } + }, + + /** + * Copy the components of a given Quaternion or Vector into this Quaternion. * - * Setting the render order does not change the tiles or how they are stored in the layer, - * it purely impacts the order in which they are rendered. + * @method Phaser.Math.Quaternion#copy + * @since 3.0.0 * - * You can provide either an integer (0 to 3), or the string version of the order. + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} src - The Quaternion or Vector to copy the components from. * - * Calling this method _after_ creating Tilemap Layers will **not** automatically - * update them to use the new render order. If you call this method after creating layers, use their - * own `setRenderOrder` methods to change them as needed. + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + copy: function (src) + { + return this.set(src); + }, + + /** + * Set the components of this Quaternion and optionally call the `onChangeCallback`. * - * @method Phaser.Tilemaps.Tilemap#setRenderOrder - * @since 3.12.0 + * @method Phaser.Math.Quaternion#set + * @since 3.0.0 * - * @param {(number|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. + * @param {(number|object)} [x=0] - The x component, or an object containing x, y, z, and w components. + * @param {number} [y=0] - The y component. + * @param {number} [z=0] - The z component. + * @param {number} [w=0] - The w component. + * @param {boolean} [update=true] - Call the `onChangeCallback`? * - * @return {this} This Tilemap object. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - setRenderOrder: function (renderOrder) + set: function (x, y, z, w, update) { - var orders = [ 'right-down', 'left-down', 'right-up', 'left-up' ]; + if (update === undefined) { update = true; } - if (typeof renderOrder === 'number') + if (typeof x === 'object') { - renderOrder = orders[renderOrder]; + this._x = x.x || 0; + this._y = x.y || 0; + this._z = x.z || 0; + this._w = x.w || 0; + } + else + { + this._x = x || 0; + this._y = y || 0; + this._z = z || 0; + this._w = w || 0; } - if (orders.indexOf(renderOrder) > -1) + if (update) { - this.renderOrder = renderOrder; + this.onChangeCallback(this); } return this; }, /** - * Adds an image to the map to be used as a tileset. A single map may use multiple tilesets. - * Note that the tileset name can be found in the JSON file exported from Tiled, or in the Tiled - * editor. + * Add a given Quaternion or Vector to this Quaternion. Addition is component-wise. * - * @method Phaser.Tilemaps.Tilemap#addTilesetImage + * @method Phaser.Math.Quaternion#add * @since 3.0.0 * - * @param {string} tilesetName - The name of the tileset as specified in the map data. - * @param {string} [key] - The key of the Phaser.Cache image used for this tileset. If - * `undefined` or `null` it will look for an image with a key matching the tilesetName parameter. - * @param {number} [tileWidth] - The width of the tile (in pixels) in the Tileset Image. If not - * given it will default to the map's tileWidth value, or the tileWidth specified in the Tiled - * JSON file. - * @param {number} [tileHeight] - The height of the tiles (in pixels) in the Tileset Image. If - * not given it will default to the map's tileHeight value, or the tileHeight specified in the - * Tiled JSON file. - * @param {number} [tileMargin] - The margin around the tiles in the sheet (in pixels). If not - * specified, it will default to 0 or the value specified in the Tiled JSON file. - * @param {number} [tileSpacing] - The spacing between each the tile in the sheet (in pixels). - * If not specified, it will default to 0 or the value specified in the Tiled JSON file. - * @param {number} [gid=0] - If adding multiple tilesets to a blank map, specify the starting - * GID this set will use here. + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to add to this Quaternion. * - * @return {?Phaser.Tilemaps.Tileset} Returns the Tileset object that was created or updated, or null if it - * failed. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - addTilesetImage: function (tilesetName, key, tileWidth, tileHeight, tileMargin, tileSpacing, gid) + add: function (v) { - if (tilesetName === undefined) { return null; } - if (key === undefined || key === null) { key = tilesetName; } + this._x += v.x; + this._y += v.y; + this._z += v.z; + this._w += v.w; - if (!this.scene.sys.textures.exists(key)) - { - console.warn('Invalid Tileset Image: ' + key); - return null; - } + this.onChangeCallback(this); - var texture = this.scene.sys.textures.get(key); + return this; + }, - var index = this.getTilesetIndex(tilesetName); + /** + * Subtract a given Quaternion or Vector from this Quaternion. Subtraction is component-wise. + * + * @method Phaser.Math.Quaternion#subtract + * @since 3.0.0 + * + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to subtract from this Quaternion. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + subtract: function (v) + { + this._x -= v.x; + this._y -= v.y; + this._z -= v.z; + this._w -= v.w; - if (index === null && this.format === Formats.TILED_JSON) - { - console.warn('No data found for Tileset: ' + tilesetName); - return null; - } + this.onChangeCallback(this); - var tileset = this.tilesets[index]; + return this; + }, - if (tileset) - { - tileset.setTileSize(tileWidth, tileHeight); - tileset.setSpacing(tileMargin, tileSpacing); - tileset.setImage(texture); + /** + * Scale this Quaternion by the given value. + * + * @method Phaser.Math.Quaternion#scale + * @since 3.0.0 + * + * @param {number} scale - The value to scale this Quaternion by. + * + * @return {Phaser.Math.Quaternion} This Quaternion. + */ + scale: function (scale) + { + this._x *= scale; + this._y *= scale; + this._z *= scale; + this._w *= scale; - return tileset; - } + this.onChangeCallback(this); - if (tileWidth === undefined) { tileWidth = this.tileWidth; } - if (tileHeight === undefined) { tileHeight = this.tileHeight; } - if (tileMargin === undefined) { tileMargin = 0; } - if (tileSpacing === undefined) { tileSpacing = 0; } - if (gid === undefined) { gid = 0; } + return this; + }, - tileset = new Tileset(tilesetName, gid, tileWidth, tileHeight, tileMargin, tileSpacing); + /** + * Calculate the length of this Quaternion. + * + * @method Phaser.Math.Quaternion#length + * @since 3.0.0 + * + * @return {number} The length of this Quaternion. + */ + length: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; - tileset.setImage(texture); + return Math.sqrt(x * x + y * y + z * z + w * w); + }, - this.tilesets.push(tileset); + /** + * Calculate the length of this Quaternion squared. + * + * @method Phaser.Math.Quaternion#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Quaternion, squared. + */ + lengthSq: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; - return tileset; + return x * x + y * y + z * z + w * w; }, /** - * Copies the tiles in the source rectangular area to a new destination (all specified in tile - * coordinates) within the layer. This copies all tile properties & recalculates collision - * information in the destination region. - * - * If no layer specified, the map's current layer is used. This cannot be applied to StaticTilemapLayers. + * Normalize this Quaternion. * - * @method Phaser.Tilemaps.Tilemap#copy + * @method Phaser.Math.Quaternion#normalize * @since 3.0.0 * - * @param {number} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. - * @param {number} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. - * @param {number} width - The width of the area to copy, in tiles, not pixels. - * @param {number} height - The height of the area to copy, in tiles, not pixels. - * @param {number} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. - * @param {number} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. - * - * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - copy: function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, layer) + normalize: function () { - layer = this.getLayer(layer); + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + var len = x * x + y * y + z * z + w * w; - if (layer !== null) + if (len > 0) { - TilemapComponents.Copy( - srcTileX, srcTileY, - width, height, - destTileX, destTileY, - recalculateFaces, layer - ); + len = 1 / Math.sqrt(len); - return this; - } - else - { - return null; + this._x = x * len; + this._y = y * len; + this._z = z * len; + this._w = w * len; } + + this.onChangeCallback(this); + + return this; }, /** - * Creates a new and empty Tilemap Layer. The currently selected layer in the map is set to this new layer. - * - * Prior to v3.50.0 this method was called `createBlankDynamicLayer`. + * Calculate the dot product of this Quaternion and the given Quaternion or Vector. * - * @method Phaser.Tilemaps.Tilemap#createBlankLayer + * @method Phaser.Math.Quaternion#dot * @since 3.0.0 * - * @param {string} name - The name of this layer. Must be unique within the map. - * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - * @param {number} [x=0] - The world x position where the top left of this layer will be placed. - * @param {number} [y=0] - The world y position where the top left of this layer will be placed. - * @param {number} [width] - The width of the layer in tiles. If not specified, it will default to the map's width. - * @param {number} [height] - The height of the layer in tiles. If not specified, it will default to the map's height. - * @param {number} [tileWidth] - The width of the tiles the layer uses for calculations. If not specified, it will default to the map's tileWidth. - * @param {number} [tileHeight] - The height of the tiles the layer uses for calculations. If not specified, it will default to the map's tileHeight. + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to dot product with this Quaternion. * - * @return {?Phaser.Tilemaps.TilemapLayer} Returns the new layer that was created, or `null` if it failed. + * @return {number} The dot product of this Quaternion and the given Quaternion or Vector. */ - createBlankLayer: function (name, tileset, x, y, width, height, tileWidth, tileHeight) + dot: function (v) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = this.width; } - if (height === undefined) { height = this.height; } - if (tileWidth === undefined) { tileWidth = this.tileWidth; } - if (tileHeight === undefined) { tileHeight = this.tileHeight; } - - var index = this.getLayerIndex(name); - - if (index !== null) - { - console.warn('Invalid Tilemap Layer ID: ' + name); - return null; - } - - var layerData = new LayerData({ - name: name, - tileWidth: tileWidth, - tileHeight: tileHeight, - width: width, - height: height, - orientation: this.orientation - }); - - var row; - - for (var tileY = 0; tileY < height; tileY++) - { - row = []; - - for (var tileX = 0; tileX < width; tileX++) - { - row.push(new Tile(layerData, -1, tileX, tileY, tileWidth, tileHeight, this.tileWidth, this.tileHeight)); - } - - layerData.data.push(row); - } - - this.layers.push(layerData); - - this.currentLayerIndex = this.layers.length - 1; - - var layer = new TilemapLayer(this.scene, this, this.currentLayerIndex, tileset, x, y); - - layer.setRenderOrder(this.renderOrder); - - this.scene.sys.displayList.add(layer); - - return layer; + return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; }, /** - * Creates a new Tilemap Layer that renders the LayerData associated with the given - * `layerID`. The currently selected layer in the map is set to this new layer. - * - * The `layerID` is important. If you've created your map in Tiled then you can get this by - * looking in Tiled and looking at the layer name. Or you can open the JSON file it exports and - * look at the layers[].name value. Either way it must match. - * - * Prior to v3.50.0 this method was called `createDynamicLayer`. + * Linearly interpolate this Quaternion towards the given Quaternion or Vector. * - * @method Phaser.Tilemaps.Tilemap#createLayer + * @method Phaser.Math.Quaternion#lerp * @since 3.0.0 * - * @param {(number|string)} layerID - The layer array index value, or if a string is given, the layer name from Tiled. - * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - * @param {number} [x=0] - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. - * @param {number} [y=0] - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} v - The Quaternion or Vector to interpolate towards. + * @param {number} [t=0] - The percentage of interpolation. * - * @return {?Phaser.Tilemaps.TilemapLayer} Returns the new layer was created, or null if it failed. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - createLayer: function (layerID, tileset, x, y) + lerp: function (v, t) { - var index = this.getLayerIndex(layerID); - - if (index === null) - { - console.warn('Invalid Tilemap Layer ID: ' + layerID); - - if (typeof layerID === 'string') - { - console.warn('Valid tilelayer names:\n\t' + this.getTileLayerNames().join(',\n\t')); - } - - return null; - } - - var layerData = this.layers[index]; - - // Check for an associated static or dynamic tilemap layer - if (layerData.tilemapLayer) - { - console.warn('Tilemap Layer ID already exists:' + layerID); - return null; - } - - this.currentLayerIndex = index; - - // Default the x/y position to match Tiled layer offset, if it exists. - - if (x === undefined) - { - x = layerData.x; - } - - if (y === undefined) - { - y = layerData.y; - } - - var layer = new TilemapLayer(this.scene, this, index, tileset, x, y); - - layer.setRenderOrder(this.renderOrder); + if (t === undefined) { t = 0; } - this.scene.sys.displayList.add(layer); + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; - return layer; + return this.set( + ax + t * (v.x - ax), + ay + t * (v.y - ay), + az + t * (v.z - az), + aw + t * (v.w - aw) + ); }, /** - * This method will iterate through all of the objects defined in a Tiled Object Layer and then - * convert the matching results into Phaser Game Objects (by default, Sprites) - * - * Objects are matched on one of 3 criteria: The Object ID, the Object GID or the Object Name. - * - * Within Tiled, Object IDs are unique per Object. Object GIDs, however, are shared by all objects - * using the same image. Finally, Object Names are strings and the same name can be used on multiple - * Objects in Tiled, they do not have to be unique. - * - * You set the configuration parameter accordingly, based on which type of criteria you wish - * to match against. For example, to convert all items on an Object Layer with a `gid` of 26: - * - * ```javascript - * createFromObjects(layerName, { - * gid: 26 - * }); - * ``` - * - * Or, to convert objects with the name 'bonus': - * - * ```javascript - * createFromObjects(layerName, { - * name: 'bonus' - * }); - * ``` - * - * Or, to convert an object with a specific id: - * - * ```javascript - * createFromObjects(layerName, { - * id: 9 - * }); - * ``` - * - * You should only specify either `id`, `gid`, `name`, or none of them. Do not add more than - * one criteria to your config. If you do not specify any criteria, then _all_ objects in the - * Object Layer will be converted. - * - * By default this method will convert objects into `Sprite` instances, but you can override - * this by providing your own class type: - * - * ```javascript - * createFromObjects(layerName, { - * gid: 26, - * classType: Coin - * }); - * ``` - * - * This will convert all Objects with a gid of 26 into your custom `Coin` class. You can pass - * any class type here, but it _must_ extend `Phaser.GameObjects.GameObject` as its base class. - * Your class will always be passed 1 parameter: `scene`, which is a reference to either the Scene - * specified in the config object or, if not given, the Scene to which this Tilemap belongs. - * - * All properties from object are copied into the Game Object, so you can use this as an easy - * way to configure properties from within the map editor. For example giving an object a - * property of `alpha: 0.5` in Tiled will be reflected in the Game Object that is created. - * - * Custom object properties that do not exist as a Game Object property are set in the - * Game Objects {@link Phaser.GameObjects.GameObject#data data store}. - * - * You can use set a `container` property in the config. If given, the class will be added to - * the Container instance instead of the Scene. - * - * Finally, you can provide an array of config objects, to convert multiple types of object in - * a single call: - * - * ```javascript - * createFromObjects(layerName, [ - * { - * gid: 26, - * classType: Coin - * }, - * { - * id: 9, - * classType: BossMonster - * }, - * { - * name: 'lava', - * classType: LavaTile - * } - * ]); - * ``` - * - * The signature of this method changed significantly in v3.50.0. Prior to this, it did not take config objects. + * Rotates this Quaternion based on the two given vectors. * - * @method Phaser.Tilemaps.Tilemap#createFromObjects + * @method Phaser.Math.Quaternion#rotationTo * @since 3.0.0 * - * @param {string} objectLayerName - The name of the Tiled object layer to create the Game Objects from. - * @param {Phaser.Types.Tilemaps.CreateFromObjectLayerConfig|Phaser.Types.Tilemaps.CreateFromObjectLayerConfig[]} config - A CreateFromObjects configuration object, or an array of them. + * @param {Phaser.Math.Vector3} a - The transform rotation vector. + * @param {Phaser.Math.Vector3} b - The target rotation vector. * - * @return {Phaser.GameObjects.GameObject[]} An array containing the Game Objects that were created. Empty if invalid object layer, or no matching id/gid/name was found. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - createFromObjects: function (objectLayerName, config) + rotationTo: function (a, b) { - var results = []; - - var objectLayer = this.getObjectLayer(objectLayerName); - - if (!objectLayer) - { - console.warn('createFromObjects: Invalid objectLayerName given: ' + objectLayerName); - - return results; - } - - if (!Array.isArray(config)) - { - config = [ config ]; - } - - var objects = objectLayer.objects; + var dot = a.x * b.x + a.y * b.y + a.z * b.z; - for (var c = 0; c < config.length; c++) + if (dot < -0.999999) { - var singleConfig = config[c]; - - var id = GetFastValue(singleConfig, 'id', null); - var gid = GetFastValue(singleConfig, 'gid', null); - var name = GetFastValue(singleConfig, 'name', null); - - var obj; - var toConvert = []; - - // Sweep to get all the objects we want to convert in this pass - for (var s = 0; s < objects.length; s++) + if (tmpvec.copy(xUnitVec3).cross(a).length() < EPSILON) { - obj = objects[s]; - - if ( - (id === null && gid === null && name === null) || - (id !== null && obj.id === id) || - (gid !== null && obj.gid === gid) || - (name !== null && obj.name === name) - ) - { - toConvert.push(obj); - } + tmpvec.copy(yUnitVec3).cross(a); } - // Now let's convert them ... - - var classType = GetFastValue(singleConfig, 'classType', Sprite); - var scene = GetFastValue(singleConfig, 'scene', this.scene); - var container = GetFastValue(singleConfig, 'container', null); - var texture = GetFastValue(singleConfig, 'key', null); - var frame = GetFastValue(singleConfig, 'frame', null); - - for (var i = 0; i < toConvert.length; i++) - { - obj = toConvert[i]; - - var sprite = new classType(scene); - - sprite.setName(obj.name); - sprite.setPosition(obj.x, obj.y); - sprite.setTexture(texture, frame); - - if (obj.width) - { - sprite.displayWidth = obj.width; - } - - if (obj.height) - { - sprite.displayHeight = obj.height; - } - - // Origin is (0, 1) in Tiled, so find the offset that matches the Sprites origin. - // Do not offset objects with zero dimensions (e.g. points). - var offset = { - x: sprite.originX * obj.width, - y: (sprite.originY - 1) * obj.height - }; - - // If the object is rotated, then the origin offset also needs to be rotated. - if (obj.rotation) - { - var angle = DegToRad(obj.rotation); - - Rotate(offset, angle); - - sprite.rotation = angle; - } - - sprite.x += offset.x; - sprite.y += offset.y; - - if (obj.flippedHorizontal !== undefined || obj.flippedVertical !== undefined) - { - sprite.setFlip(obj.flippedHorizontal, obj.flippedVertical); - } + tmpvec.normalize(); - if (!obj.visible) - { - sprite.visible = false; - } + return this.setAxisAngle(tmpvec, Math.PI); - // Set properties the class may have, or setData those it doesn't - if (Array.isArray(obj.properties)) - { - // Tiled objects custom properties format - obj.properties.forEach(function (propData) - { - var key = propData['name']; - if (sprite[key] !== undefined) - { - sprite[key] = propData['value']; - } - else - { - sprite.setData(key, propData['value']); - } - }); - } - else - { - for (var key in obj.properties) - { - if (sprite[key] !== undefined) - { - sprite[key] = obj.properties[key]; - } - else - { - sprite.setData(key, obj.properties[key]); - } - } - } + } + else if (dot > 0.999999) + { + return this.set(0, 0, 0, 1); + } + else + { + tmpvec.copy(a).cross(b); - if (container) - { - container.add(sprite); - } - else - { - scene.add.existing(sprite); - } + this._x = tmpvec.x; + this._y = tmpvec.y; + this._z = tmpvec.z; + this._w = 1 + dot; - results.push(sprite); - } + return this.normalize(); } - - return results; }, /** - * Creates a Sprite for every object matching the given tile indexes in the layer. You can - * optionally specify if each tile will be replaced with a new tile after the Sprite has been - * created. This is useful if you want to lay down special tiles in a level that are converted to - * Sprites, but want to replace the tile itself with a floor tile or similar once converted. + * Set the axes of this Quaternion. * - * @method Phaser.Tilemaps.Tilemap#createFromTiles + * @method Phaser.Math.Quaternion#setAxes * @since 3.0.0 * - * @param {(number|array)} indexes - The tile index, or array of indexes, to create Sprites from. - * @param {(number|array)} replacements - The tile index, or array of indexes, to change a converted - * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a - * one-to-one mapping with the indexes array. - * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. scene.make.sprite). - * @param {Phaser.Scene} [scene] - The Scene to create the Sprites within. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Math.Vector3} view - The view axis. + * @param {Phaser.Math.Vector3} right - The right axis. + * @param {Phaser.Math.Vector3} up - The upwards axis. * - * @return {?Phaser.GameObjects.Sprite[]} Returns an array of Tiles, or null if the layer given was invalid. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - createFromTiles: function (indexes, replacements, spriteConfig, scene, camera, layer) + setAxes: function (view, right, up) { - layer = this.getLayer(layer); + var m = tmpMat3.val; - if (layer === null) { return null; } + m[0] = right.x; + m[3] = right.y; + m[6] = right.z; - return TilemapComponents.CreateFromTiles(indexes, replacements, spriteConfig, scene, camera, layer); + m[1] = up.x; + m[4] = up.y; + m[7] = up.z; + + m[2] = -view.x; + m[5] = -view.y; + m[8] = -view.z; + + return this.fromMat3(tmpMat3).normalize(); }, /** - * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the - * specified index. Tiles will be set to collide if the given index is a colliding index. - * Collision information in the region will be recalculated. - * - * If no layer specified, the map's current layer is used. - * This cannot be applied to StaticTilemapLayers. + * Reset this Matrix to an identity (default) Quaternion. * - * @method Phaser.Tilemaps.Tilemap#fill + * @method Phaser.Math.Quaternion#identity * @since 3.0.0 * - * @param {number} index - The tile index to fill the area with. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. - * - * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - fill: function (index, tileX, tileY, width, height, recalculateFaces, layer) + identity: function () { - if (recalculateFaces === undefined) { recalculateFaces = true; } - - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - TilemapComponents.Fill(index, tileX, tileY, width, height, recalculateFaces, layer); - - return this; + return this.set(0, 0, 0, 1); }, /** - * For each object in the given object layer, run the given filter callback function. Any - * objects that pass the filter test (i.e. where the callback returns true) will returned as a - * new array. Similar to Array.prototype.Filter in vanilla JS. + * Set the axis angle of this Quaternion. * - * @method Phaser.Tilemaps.Tilemap#filterObjects + * @method Phaser.Math.Quaternion#setAxisAngle * @since 3.0.0 * - * @param {(Phaser.Tilemaps.ObjectLayer|string)} objectLayer - The name of an object layer (from Tiled) or an ObjectLayer instance. - * @param {TilemapFilterCallback} callback - The callback. Each object in the given area will be passed to this callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. + * @param {Phaser.Math.Vector3} axis - The axis. + * @param {number} rad - The angle in radians. * - * @return {?Phaser.Types.Tilemaps.TiledObject[]} An array of object that match the search, or null if the objectLayer given was invalid. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - filterObjects: function (objectLayer, callback, context) + setAxisAngle: function (axis, rad) { - if (typeof objectLayer === 'string') - { - var name = objectLayer; - - objectLayer = this.getObjectLayer(objectLayer); + rad = rad * 0.5; - if (!objectLayer) - { - console.warn('No object layer found with the name: ' + name); - return null; - } - } + var s = Math.sin(rad); - return objectLayer.objects.filter(callback, context); + return this.set( + s * axis.x, + s * axis.y, + s * axis.z, + Math.cos(rad) + ); }, /** - * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given - * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns - * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS. - * If no layer specified, the map's current layer is used. + * Multiply this Quaternion by the given Quaternion or Vector. * - * @method Phaser.Tilemaps.Tilemap#filterTiles + * @method Phaser.Math.Quaternion#multiply * @since 3.0.0 * - * @param {function} callback - The callback. Each tile in the given area will be passed to this - * callback as the first and only parameter. The callback should return true for tiles that pass the - * filter. - * @param {object} [context] - The context under which the callback should be run. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to multiply this Quaternion by. * - * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - filterTiles: function (callback, context, tileX, tileY, width, height, filteringOptions, layer) + multiply: function (b) { - layer = this.getLayer(layer); + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; - if (layer === null) { return null; } + var bx = b.x; + var by = b.y; + var bz = b.z; + var bw = b.w; - return TilemapComponents.FilterTiles(callback, context, tileX, tileY, width, height, filteringOptions, layer); + return this.set( + ax * bw + aw * bx + ay * bz - az * by, + ay * bw + aw * by + az * bx - ax * bz, + az * bw + aw * bz + ax * by - ay * bx, + aw * bw - ax * bx - ay * by - az * bz + ); }, /** - * Searches the entire map layer for the first tile matching the given index, then returns that Tile - * object. If no match is found, it returns null. The search starts from the top-left tile and - * continues horizontally until it hits the end of the row, then it drops down to the next column. - * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to - * the top-left. - * If no layer specified, the map's current layer is used. + * Smoothly linearly interpolate this Quaternion towards the given Quaternion or Vector. * - * @method Phaser.Tilemaps.Tilemap#findByIndex + * @method Phaser.Math.Quaternion#slerp * @since 3.0.0 * - * @param {number} index - The tile index value to search for. - * @param {number} [skip=0] - The number of times to skip a matching tile before returning. - * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(Phaser.Math.Quaternion|Phaser.Math.Vector4)} b - The Quaternion or Vector to interpolate towards. + * @param {number} t - The percentage of interpolation. * - * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - findByIndex: function (findIndex, skip, reverse, layer) + slerp: function (b, t) { - layer = this.getLayer(layer); + // benchmarks: http://jsperf.com/quaternion-slerp-implementations - if (layer === null) { return null; } + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; - return TilemapComponents.FindByIndex(findIndex, skip, reverse, layer); - }, + var bx = b.x; + var by = b.y; + var bz = b.z; + var bw = b.w; - /** - * Find the first object in the given object layer that satisfies the provided testing function. - * I.e. finds the first object for which `callback` returns true. Similar to - * Array.prototype.find in vanilla JS. - * - * @method Phaser.Tilemaps.Tilemap#findObject - * @since 3.0.0 - * - * @param {(Phaser.Tilemaps.ObjectLayer|string)} objectLayer - The name of an object layer (from Tiled) or an ObjectLayer instance. - * @param {TilemapFindCallback} callback - The callback. Each object in the given area will be passed to this callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * - * @return {?Phaser.Types.Tilemaps.TiledObject} An object that matches the search, or null if no object found. - */ - findObject: function (objectLayer, callback, context) - { - if (typeof objectLayer === 'string') + // calc cosine + var cosom = ax * bx + ay * by + az * bz + aw * bw; + + // adjust signs (if necessary) + if (cosom < 0) { - var name = objectLayer; + cosom = -cosom; + bx = - bx; + by = - by; + bz = - bz; + bw = - bw; + } - objectLayer = this.getObjectLayer(objectLayer); + // "from" and "to" quaternions are very close + // ... so we can do a linear interpolation + var scale0 = 1 - t; + var scale1 = t; - if (!objectLayer) - { - console.warn('No object layer found with the name: ' + name); - return null; - } + // calculate coefficients + if ((1 - cosom) > EPSILON) + { + // standard case (slerp) + var omega = Math.acos(cosom); + var sinom = Math.sin(omega); + + scale0 = Math.sin((1.0 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; } - return objectLayer.objects.find(callback, context) || null; + // calculate final values + return this.set( + scale0 * ax + scale1 * bx, + scale0 * ay + scale1 * by, + scale0 * az + scale1 * bz, + scale0 * aw + scale1 * bw + ); }, /** - * Find the first tile in the given rectangular area (in tile coordinates) of the layer that - * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns - * true. Similar to Array.prototype.find in vanilla JS. - * If no layer specified, the maps current layer is used. + * Invert this Quaternion. * - * @method Phaser.Tilemaps.Tilemap#findTile + * @method Phaser.Math.Quaternion#invert * @since 3.0.0 * - * @param {FindTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. - * - * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - findTile: function (callback, context, tileX, tileY, width, height, filteringOptions, layer) + invert: function () { - layer = this.getLayer(layer); + var a0 = this.x; + var a1 = this.y; + var a2 = this.z; + var a3 = this.w; - if (layer === null) { return null; } + var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + var invDot = (dot) ? 1 / dot : 0; - return TilemapComponents.FindTile(callback, context, tileX, tileY, width, height, filteringOptions, layer); + return this.set( + -a0 * invDot, + -a1 * invDot, + -a2 * invDot, + a3 * invDot + ); }, /** - * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given - * callback. Similar to Array.prototype.forEach in vanilla JS. + * Convert this Quaternion into its conjugate. * - * If no layer specified, the map's current layer is used. + * Sets the x, y and z components. * - * @method Phaser.Tilemaps.Tilemap#forEachTile + * @method Phaser.Math.Quaternion#conjugate * @since 3.0.0 * - * @param {EachTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. - * - * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - forEachTile: function (callback, context, tileX, tileY, width, height, filteringOptions, layer) + conjugate: function () { - layer = this.getLayer(layer); - - if (layer === null) { return null; } + this._x = -this.x; + this._y = -this.y; + this._z = -this.z; - TilemapComponents.ForEachTile(callback, context, tileX, tileY, width, height, filteringOptions, layer); + this.onChangeCallback(this); return this; }, /** - * Gets the image layer index based on its name. + * Rotate this Quaternion on the X axis. * - * @method Phaser.Tilemaps.Tilemap#getImageIndex + * @method Phaser.Math.Quaternion#rotateX * @since 3.0.0 * - * @param {string} name - The name of the image to get. + * @param {number} rad - The rotation angle in radians. * - * @return {number} The index of the image in this tilemap, or null if not found. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - getImageIndex: function (name) + rotateX: function (rad) { - return this.getIndex(this.images, name); - }, + rad *= 0.5; - /** - * Return a list of all valid imagelayer names loaded in this Tilemap. - * - * @method Phaser.Tilemaps.Tilemap#getImageLayerNames - * @since 3.21.0 - * - * @return {string[]} Array of valid imagelayer names / IDs loaded into this Tilemap. - */ - getImageLayerNames: function () - { - if (!this.images || !Array.isArray(this.images)) - { - return []; - } + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; - return this.images.map(function (image) - { - return image.name; - }); + var bx = Math.sin(rad); + var bw = Math.cos(rad); + + return this.set( + ax * bw + aw * bx, + ay * bw + az * bx, + az * bw - ay * bx, + aw * bw - ax * bx + ); }, /** - * Internally used. Returns the index of the object in one of the Tilemaps arrays whose name - * property matches the given `name`. + * Rotate this Quaternion on the Y axis. * - * @method Phaser.Tilemaps.Tilemap#getIndex + * @method Phaser.Math.Quaternion#rotateY * @since 3.0.0 * - * @param {array} location - The Tilemap array to search. - * @param {string} name - The name of the array element to get. + * @param {number} rad - The rotation angle in radians. * - * @return {number} The index of the element in the array, or null if not found. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - getIndex: function (location, name) + rotateY: function (rad) { - for (var i = 0; i < location.length; i++) - { - if (location[i].name === name) - { - return i; - } - } + rad *= 0.5; - return null; + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; + + var by = Math.sin(rad); + var bw = Math.cos(rad); + + return this.set( + ax * bw - az * by, + ay * bw + aw * by, + az * bw + ax * by, + aw * bw - ay * by + ); }, /** - * Gets the LayerData from `this.layers` that is associated with the given `layer`, or null if the layer is invalid. + * Rotate this Quaternion on the Z axis. * - * @method Phaser.Tilemaps.Tilemap#getLayer + * @method Phaser.Math.Quaternion#rotateZ * @since 3.0.0 * - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or Tilemap Layer. If not given will default to the maps current layer index. + * @param {number} rad - The rotation angle in radians. * - * @return {Phaser.Tilemaps.LayerData} The corresponding LayerData within this.layers. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - getLayer: function (layer) + rotateZ: function (rad) { - var index = this.getLayerIndex(layer); + rad *= 0.5; - return (index !== null) ? this.layers[index] : null; + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; + + var bz = Math.sin(rad); + var bw = Math.cos(rad); + + return this.set( + ax * bw + ay * bz, + ay * bw - ax * bz, + az * bw + aw * bz, + aw * bw - az * bz + ); }, /** - * Gets the ObjectLayer from `this.objects` that has the given `name`, or null if no ObjectLayer is found with that name. + * Create a unit (or rotation) Quaternion from its x, y, and z components. * - * @method Phaser.Tilemaps.Tilemap#getObjectLayer - * @since 3.0.0 + * Sets the w component. * - * @param {string} [name] - The name of the object layer from Tiled. + * @method Phaser.Math.Quaternion#calculateW + * @since 3.0.0 * - * @return {?Phaser.Tilemaps.ObjectLayer} The corresponding `ObjectLayer` within `this.objects`, or null. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - getObjectLayer: function (name) + calculateW: function () { - var index = this.getIndex(this.objects, name); + var x = this.x; + var y = this.y; + var z = this.z; - return (index !== null) ? this.objects[index] : null; + this.w = -Math.sqrt(1.0 - x * x - y * y - z * z); + + return this; }, /** - * Return a list of all valid objectgroup names loaded in this Tilemap. + * Set this Quaternion from the given Euler, based on Euler order. * - * @method Phaser.Tilemaps.Tilemap#getObjectLayerNames - * @since 3.21.0 + * @method Phaser.Math.Quaternion#setFromEuler + * @since 3.50.0 * - * @return {string[]} Array of valid objectgroup names / IDs loaded into this Tilemap. + * @param {Phaser.Math.Euler} euler - The Euler to convert from. + * @param {boolean} [update=true] - Run the `onChangeCallback`? + * + * @return {Phaser.Math.Quaternion} This Quaternion. */ - getObjectLayerNames: function () + setFromEuler: function (euler, update) { - if (!this.objects || !Array.isArray(this.objects)) + var x = euler.x / 2; + var y = euler.y / 2; + var z = euler.z / 2; + + var c1 = Math.cos(x); + var c2 = Math.cos(y); + var c3 = Math.cos(z); + + var s1 = Math.sin(x); + var s2 = Math.sin(y); + var s3 = Math.sin(z); + + switch (euler.order) { - return []; + case 'XYZ': + { + this.set( + s1 * c2 * c3 + c1 * s2 * s3, + c1 * s2 * c3 - s1 * c2 * s3, + c1 * c2 * s3 + s1 * s2 * c3, + c1 * c2 * c3 - s1 * s2 * s3, + update + ); + + break; + } + + case 'YXZ': + { + this.set( + s1 * c2 * c3 + c1 * s2 * s3, + c1 * s2 * c3 - s1 * c2 * s3, + c1 * c2 * s3 - s1 * s2 * c3, + c1 * c2 * c3 + s1 * s2 * s3, + update + ); + + break; + } + + case 'ZXY': + { + this.set( + s1 * c2 * c3 - c1 * s2 * s3, + c1 * s2 * c3 + s1 * c2 * s3, + c1 * c2 * s3 + s1 * s2 * c3, + c1 * c2 * c3 - s1 * s2 * s3, + update + ); + + break; + } + + case 'ZYX': + { + this.set( + s1 * c2 * c3 - c1 * s2 * s3, + c1 * s2 * c3 + s1 * c2 * s3, + c1 * c2 * s3 - s1 * s2 * c3, + c1 * c2 * c3 + s1 * s2 * s3, + update + ); + + break; + } + + case 'YZX': + { + this.set( + s1 * c2 * c3 + c1 * s2 * s3, + c1 * s2 * c3 + s1 * c2 * s3, + c1 * c2 * s3 - s1 * s2 * c3, + c1 * c2 * c3 - s1 * s2 * s3, + update + ); + + break; + } + + case 'XZY': + { + this.set( + s1 * c2 * c3 - c1 * s2 * s3, + c1 * s2 * c3 - s1 * c2 * s3, + c1 * c2 * s3 + s1 * s2 * c3, + c1 * c2 * c3 + s1 * s2 * s3, + update + ); + + break; + } } - return this.objects.map(function (object) - { - return object.name; - }); + return this; }, /** - * Gets the LayerData index of the given `layer` within this.layers, or null if an invalid - * `layer` is given. + * Sets the rotation of this Quaternion from the given Matrix4. * - * @method Phaser.Tilemaps.Tilemap#getLayerIndex - * @since 3.0.0 + * @method Phaser.Math.Quaternion#setFromRotationMatrix + * @since 3.50.0 * - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or a Tilemap Layer. If not given will default to the map's current layer index. + * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to set the rotation from. * - * @return {number} The LayerData index within this.layers. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - getLayerIndex: function (layer) + setFromRotationMatrix: function (mat4) { - if (layer === undefined) - { - return this.currentLayerIndex; - } - else if (typeof layer === 'string') + var m = mat4.val; + + var m11 = m[0]; + var m12 = m[4]; + var m13 = m[8]; + var m21 = m[1]; + var m22 = m[5]; + var m23 = m[9]; + var m31 = m[2]; + var m32 = m[6]; + var m33 = m[10]; + + var trace = m11 + m22 + m33; + var s; + + if (trace > 0) { - return this.getLayerIndexByName(layer); + s = 0.5 / Math.sqrt(trace + 1.0); + + this.set( + (m32 - m23) * s, + (m13 - m31) * s, + (m21 - m12) * s, + 0.25 / s + ); } - else if (typeof layer === 'number' && layer < this.layers.length) + else if (m11 > m22 && m11 > m33) { - return layer; + s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33); + + this.set( + 0.25 * s, + (m12 + m21) / s, + (m13 + m31) / s, + (m32 - m23) / s + ); } - else if (layer instanceof TilemapLayer) + else if (m22 > m33) { - return layer.layerIndex; + s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33); + + this.set( + (m12 + m21) / s, + 0.25 * s, + (m23 + m32) / s, + (m13 - m31) / s + ); } else { - return null; + s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22); + + this.set( + (m13 + m31) / s, + (m23 + m32) / s, + 0.25 * s, + (m21 - m12) / s + ); } - }, - /** - * Gets the index of the LayerData within this.layers that has the given `name`, or null if an - * invalid `name` is given. - * - * @method Phaser.Tilemaps.Tilemap#getLayerIndexByName - * @since 3.0.0 - * - * @param {string} name - The name of the layer to get. - * - * @return {number} The LayerData index within this.layers. - */ - getLayerIndexByName: function (name) - { - return this.getIndex(this.layers, name); + return this; }, /** - * Gets a tile at the given tile coordinates from the given layer. - * - * If no layer is specified, the maps current layer is used. + * Convert the given Matrix into this Quaternion. * - * @method Phaser.Tilemaps.Tilemap#getTileAt + * @method Phaser.Math.Quaternion#fromMat3 * @since 3.0.0 * - * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). - * @param {boolean} [nonNull] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Math.Matrix3} mat - The Matrix to convert from. * - * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. + * @return {Phaser.Math.Quaternion} This Quaternion. */ - getTileAt: function (tileX, tileY, nonNull, layer) + fromMat3: function (mat) { - layer = this.getLayer(layer); + // benchmarks: + // http://jsperf.com/typed-array-access-speed + // http://jsperf.com/conversion-of-3x3-matrix-to-quaternion - if (layer === null) { return null; } + // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes + // article "Quaternion Calculus and Fast Animation". + var m = mat.val; + var fTrace = m[0] + m[4] + m[8]; + var fRoot; - return TilemapComponents.GetTileAt(tileX, tileY, nonNull, layer); - }, + if (fTrace > 0) + { + // |w| > 1/2, may as well choose w > 1/2 + fRoot = Math.sqrt(fTrace + 1.0); // 2w - /** - * Gets a tile at the given world coordinates from the given layer. - * - * If no layer is specified, the maps current layer is used. - * - * @method Phaser.Tilemaps.Tilemap#getTileAtWorldXY - * @since 3.0.0 - * - * @param {number} worldX - X position to get the tile from (given in pixels) - * @param {number} worldY - Y position to get the tile from (given in pixels) - * @param {boolean} [nonNull] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. - * - * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. - */ - getTileAtWorldXY: function (worldX, worldY, nonNull, camera, layer) - { - layer = this.getLayer(layer); + this.w = 0.5 * fRoot; - if (layer === null) { return null; } + fRoot = 0.5 / fRoot; // 1/(4w) - return TilemapComponents.GetTileAtWorldXY(worldX, worldY, nonNull, camera, layer); - }, + this._x = (m[7] - m[5]) * fRoot; + this._y = (m[2] - m[6]) * fRoot; + this._z = (m[3] - m[1]) * fRoot; + } + else + { + // |w| <= 1/2 + var i = 0; - /** - * Return a list of all valid tilelayer names loaded in this Tilemap. - * - * @method Phaser.Tilemaps.Tilemap#getTileLayerNames - * @since 3.21.0 - * - * @return {string[]} Array of valid tilelayer names / IDs loaded into this Tilemap. - */ - getTileLayerNames: function () + if (m[4] > m[0]) + { + i = 1; + } + + if (m[8] > m[i * 3 + i]) + { + i = 2; + } + + var j = siNext[i]; + var k = siNext[j]; + + // This isn't quite as clean without array access + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1); + tmp[i] = 0.5 * fRoot; + + fRoot = 0.5 / fRoot; + + tmp[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + tmp[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + + this._x = tmp[0]; + this._y = tmp[1]; + this._z = tmp[2]; + this._w = (m[k * 3 + j] - m[j * 3 + k]) * fRoot; + } + + this.onChangeCallback(this); + + return this; + } + +}); + +module.exports = Quaternion; + + +/***/ }), + +/***/ 23701: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(83392); + +/** + * Convert the given angle in radians, to the equivalent angle in degrees. + * + * @function Phaser.Math.RadToDeg + * @since 3.0.0 + * + * @param {number} radians - The angle in radians to convert ot degrees. + * + * @return {number} The given angle converted to degrees. + */ +var RadToDeg = function (radians) +{ + return radians * CONST.RAD_TO_DEG; +}; + +module.exports = RadToDeg; + + +/***/ }), + +/***/ 16906: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Compute a random unit vector. + * + * Computes random values for the given vector between -1 and 1 that can be used to represent a direction. + * + * Optionally accepts a scale value to scale the resulting vector by. + * + * @function Phaser.Math.RandomXY + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} vector - The Vector to compute random values for. + * @param {number} [scale=1] - The scale of the random values. + * + * @return {Phaser.Math.Vector2} The given Vector. + */ +var RandomXY = function (vector, scale) +{ + if (scale === undefined) { scale = 1; } + + var r = Math.random() * 2 * Math.PI; + + vector.x = Math.cos(r) * scale; + vector.y = Math.sin(r) * scale; + + return vector; +}; + +module.exports = RandomXY; + + +/***/ }), + +/***/ 52417: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Compute a random position vector in a spherical area, optionally defined by the given radius. + * + * @function Phaser.Math.RandomXYZ + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} vec3 - The Vector to compute random values for. + * @param {number} [radius=1] - The radius. + * + * @return {Phaser.Math.Vector3} The given Vector. + */ +var RandomXYZ = function (vec3, radius) +{ + if (radius === undefined) { radius = 1; } + + var r = Math.random() * 2 * Math.PI; + var z = (Math.random() * 2) - 1; + var zScale = Math.sqrt(1 - z * z) * radius; + + vec3.x = Math.cos(r) * zScale; + vec3.y = Math.sin(r) * zScale; + vec3.z = z * radius; + + return vec3; +}; + +module.exports = RandomXYZ; + + +/***/ }), + +/***/ 17915: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Compute a random four-dimensional vector. + * + * @function Phaser.Math.RandomXYZW + * @since 3.0.0 + * + * @param {Phaser.Math.Vector4} vec4 - The Vector to compute random values for. + * @param {number} [scale=1] - The scale of the random values. + * + * @return {Phaser.Math.Vector4} The given Vector. + */ +var RandomXYZW = function (vec4, scale) +{ + if (scale === undefined) { scale = 1; } + + vec4.x = (Math.random() * 2 - 1) * scale; + vec4.y = (Math.random() * 2 - 1) * scale; + vec4.z = (Math.random() * 2 - 1) * scale; + vec4.w = (Math.random() * 2 - 1) * scale; + + return vec4; +}; + +module.exports = RandomXYZW; + + +/***/ }), + +/***/ 52257: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Rotate a given point by a given angle around the origin (0, 0), in an anti-clockwise direction. + * + * @function Phaser.Math.Rotate + * @since 3.0.0 + * + * @param {(Phaser.Geom.Point|object)} point - The point to be rotated. + * @param {number} angle - The angle to be rotated by in an anticlockwise direction. + * + * @return {Phaser.Geom.Point} The given point, rotated by the given angle in an anticlockwise direction. + */ +var Rotate = function (point, angle) +{ + var x = point.x; + var y = point.y; + + point.x = (x * Math.cos(angle)) - (y * Math.sin(angle)); + point.y = (x * Math.sin(angle)) + (y * Math.cos(angle)); + + return point; +}; + +module.exports = Rotate; + + +/***/ }), + +/***/ 2386: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Rotate a `point` around `x` and `y` to the given `angle`, at the same distance. + * + * In polar notation, this maps a point from (r, t) to (r, angle), vs. the origin (x, y). + * + * @function Phaser.Math.RotateAround + * @since 3.0.0 + * + * @generic {Phaser.Types.Math.Vector2Like} T - [point,$return] + * + * @param {(Phaser.Geom.Point|object)} point - The point to be rotated. + * @param {number} x - The horizontal coordinate to rotate around. + * @param {number} y - The vertical coordinate to rotate around. + * @param {number} angle - The angle of rotation in radians. + * + * @return {Phaser.Types.Math.Vector2Like} The given point. + */ +var RotateAround = function (point, x, y, angle) +{ + var c = Math.cos(angle); + var s = Math.sin(angle); + + var tx = point.x - x; + var ty = point.y - y; + + point.x = tx * c - ty * s + x; + point.y = tx * s + ty * c + y; + + return point; +}; + +module.exports = RotateAround; + + +/***/ }), + +/***/ 72395: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Rotate a `point` around `x` and `y` by the given `angle` and `distance`. + * + * In polar notation, this maps a point from (r, t) to (distance, t + angle), vs. the origin (x, y). + * + * @function Phaser.Math.RotateAroundDistance + * @since 3.0.0 + * + * @generic {Phaser.Types.Math.Vector2Like} T - [point,$return] + * + * @param {(Phaser.Geom.Point|object)} point - The point to be rotated. + * @param {number} x - The horizontal coordinate to rotate around. + * @param {number} y - The vertical coordinate to rotate around. + * @param {number} angle - The angle of rotation in radians. + * @param {number} distance - The distance from (x, y) to place the point at. + * + * @return {Phaser.Types.Math.Vector2Like} The given point. + */ +var RotateAroundDistance = function (point, x, y, angle, distance) +{ + var t = angle + Math.atan2(point.y - y, point.x - x); + + point.x = x + (distance * Math.cos(t)); + point.y = y + (distance * Math.sin(t)); + + return point; +}; + +module.exports = RotateAroundDistance; + + +/***/ }), + +/***/ 41061: +/***/ ((module) => { + +/** + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Position a `point` at the given `angle` and `distance` to (`x`, `y`). + * + * @function Phaser.Math.RotateTo + * @since 3.24.0 + * + * @generic {Phaser.Types.Math.Vector2Like} T - [point,$return] + * + * @param {Phaser.Types.Math.Vector2Like} point - The point to be positioned. + * @param {number} x - The horizontal coordinate to position from. + * @param {number} y - The vertical coordinate to position from. + * @param {number} angle - The angle of rotation in radians. + * @param {number} distance - The distance from (x, y) to place the point at. + * + * @return {Phaser.Types.Math.Vector2Like} The given point. + */ +var RotateTo = function (point, x, y, angle, distance) +{ + point.x = x + (distance * Math.cos(angle)); + point.y = y + (distance * Math.sin(angle)); + + return point; +}; + +module.exports = RotateTo; + + +/***/ }), + +/***/ 93709: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector3 = __webpack_require__(70015); +var Matrix4 = __webpack_require__(16650); +var Quaternion = __webpack_require__(75003); + +var tmpMat4 = new Matrix4(); +var tmpQuat = new Quaternion(); +var tmpVec3 = new Vector3(); + +/** + * Rotates a vector in place by axis angle. + * + * This is the same as transforming a point by an + * axis-angle quaternion, but it has higher precision. + * + * @function Phaser.Math.RotateVec3 + * @since 3.0.0 + * + * @param {Phaser.Math.Vector3} vec - The vector to be rotated. + * @param {Phaser.Math.Vector3} axis - The axis to rotate around. + * @param {number} radians - The angle of rotation in radians. + * + * @return {Phaser.Math.Vector3} The given vector. + */ +var RotateVec3 = function (vec, axis, radians) +{ + // Set the quaternion to our axis angle + tmpQuat.setAxisAngle(axis, radians); + + // Create a rotation matrix from the axis angle + tmpMat4.fromRotationTranslation(tmpQuat, tmpVec3.set(0, 0, 0)); + + // Multiply our vector by the rotation matrix + return vec.transformMat4(tmpMat4); +}; + +module.exports = RotateVec3; + + +/***/ }), + +/***/ 67233: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Round a given number so it is further away from zero. That is, positive numbers are rounded up, and negative numbers are rounded down. + * + * @function Phaser.Math.RoundAwayFromZero + * @since 3.0.0 + * + * @param {number} value - The number to round. + * + * @return {number} The rounded number, rounded away from zero. + */ +var RoundAwayFromZero = function (value) +{ + // "Opposite" of truncate. + return (value > 0) ? Math.ceil(value) : Math.floor(value); +}; + +module.exports = RoundAwayFromZero; + + +/***/ }), + +/***/ 64333: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Round a value to the given precision. + * + * For example: + * + * ```javascript + * RoundTo(123.456, 0) = 123 + * RoundTo(123.456, 1) = 120 + * RoundTo(123.456, 2) = 100 + * ``` + * + * To round the decimal, i.e. to round to precision, pass in a negative `place`: + * + * ```javascript + * RoundTo(123.456789, 0) = 123 + * RoundTo(123.456789, -1) = 123.5 + * RoundTo(123.456789, -2) = 123.46 + * RoundTo(123.456789, -3) = 123.457 + * ``` + * + * @function Phaser.Math.RoundTo + * @since 3.0.0 + * + * @param {number} value - The value to round. + * @param {number} [place=0] - The place to round to. Positive to round the units, negative to round the decimal. + * @param {number} [base=10] - The base to round in. Default is 10 for decimal. + * + * @return {number} The rounded value. + */ +var RoundTo = function (value, place, base) +{ + if (place === undefined) { place = 0; } + if (base === undefined) { base = 10; } + + var p = Math.pow(base, -place); + + return Math.round(value * p) / p; +}; + +module.exports = RoundTo; + + +/***/ }), + +/***/ 59533: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Generate a series of sine and cosine values. + * + * @function Phaser.Math.SinCosTableGenerator + * @since 3.0.0 + * + * @param {number} length - The number of values to generate. + * @param {number} [sinAmp=1] - The sine value amplitude. + * @param {number} [cosAmp=1] - The cosine value amplitude. + * @param {number} [frequency=1] - The frequency of the values. + * + * @return {Phaser.Types.Math.SinCosTable} The generated values. + */ +var SinCosTableGenerator = function (length, sinAmp, cosAmp, frequency) +{ + if (sinAmp === undefined) { sinAmp = 1; } + if (cosAmp === undefined) { cosAmp = 1; } + if (frequency === undefined) { frequency = 1; } + + frequency *= Math.PI / length; + + var cos = []; + var sin = []; + + for (var c = 0; c < length; c++) { - if (!this.layers || !Array.isArray(this.layers)) + cosAmp -= sinAmp * frequency; + sinAmp += cosAmp * frequency; + + cos[c] = cosAmp; + sin[c] = sinAmp; + } + + return { + sin: sin, + cos: cos, + length: length + }; +}; + +module.exports = SinCosTableGenerator; + + +/***/ }), + +/***/ 5514: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Calculate a smooth interpolation percentage of `x` between `min` and `max`. + * + * The function receives the number `x` as an argument and returns 0 if `x` is less than or equal to the left edge, + * 1 if `x` is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, + * between 0 and 1 otherwise. + * + * @function Phaser.Math.SmoothStep + * @since 3.0.0 + * @see {@link https://en.wikipedia.org/wiki/Smoothstep} + * + * @param {number} x - The input value. + * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. + * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. + * + * @return {number} The percentage of interpolation, between 0 and 1. + */ +var SmoothStep = function (x, min, max) +{ + if (x <= min) + { + return 0; + } + + if (x >= max) + { + return 1; + } + + x = (x - min) / (max - min); + + return x * x * (3 - 2 * x); +}; + +module.exports = SmoothStep; + + +/***/ }), + +/***/ 87736: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Calculate a smoother interpolation percentage of `x` between `min` and `max`. + * + * The function receives the number `x` as an argument and returns 0 if `x` is less than or equal to the left edge, + * 1 if `x` is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, + * between 0 and 1 otherwise. + * + * Produces an even smoother interpolation than {@link Phaser.Math.SmoothStep}. + * + * @function Phaser.Math.SmootherStep + * @since 3.0.0 + * @see {@link https://en.wikipedia.org/wiki/Smoothstep#Variations} + * + * @param {number} x - The input value. + * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. + * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. + * + * @return {number} The percentage of interpolation, between 0 and 1. + */ +var SmootherStep = function (x, min, max) +{ + x = Math.max(0, Math.min(1, (x - min) / (max - min))); + + return x * x * x * (x * (x * 6 - 15) + 10); +}; + +module.exports = SmootherStep; + + +/***/ }), + +/***/ 55805: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(93736); + +/** + * Returns a Vector2 containing the x and y position of the given index in a `width` x `height` sized grid. + * + * For example, in a 6 x 4 grid, index 16 would equal x: 4 y: 2. + * + * If the given index is out of range an empty Vector2 is returned. + * + * @function Phaser.Math.ToXY + * @since 3.19.0 + * + * @param {number} index - The position within the grid to get the x/y value for. + * @param {number} width - The width of the grid. + * @param {number} height - The height of the grid. + * @param {Phaser.Math.Vector2} [out] - An optional Vector2 to store the result in. If not given, a new Vector2 instance will be created. + * + * @return {Phaser.Math.Vector2} A Vector2 where the x and y properties contain the given grid index. + */ +var ToXY = function (index, width, height, out) +{ + if (out === undefined) { out = new Vector2(); } + + var x = 0; + var y = 0; + var total = width * height; + + if (index > 0 && index <= total) + { + if (index > width - 1) { - return []; + y = Math.floor(index / width); + x = index - (y * width); + } + else + { + x = index; } + } - return this.layers.map(function (layer) + return out.set(x, y); +}; + +module.exports = ToXY; + + +/***/ }), + +/***/ 64462: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(93736); + +/** + * Takes the `x` and `y` coordinates and transforms them into the same space as + * defined by the position, rotation and scale values. + * + * @function Phaser.Math.TransformXY + * @since 3.0.0 + * + * @param {number} x - The x coordinate to be transformed. + * @param {number} y - The y coordinate to be transformed. + * @param {number} positionX - Horizontal position of the transform point. + * @param {number} positionY - Vertical position of the transform point. + * @param {number} rotation - Rotation of the transform point, in radians. + * @param {number} scaleX - Horizontal scale of the transform point. + * @param {number} scaleY - Vertical scale of the transform point. + * @param {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} [output] - The output vector, point or object for the translated coordinates. + * + * @return {(Phaser.Math.Vector2|Phaser.Geom.Point|object)} The translated point. + */ +var TransformXY = function (x, y, positionX, positionY, rotation, scaleX, scaleY, output) +{ + if (output === undefined) { output = new Vector2(); } + + var radianSin = Math.sin(rotation); + var radianCos = Math.cos(rotation); + + // Rotate and Scale + var a = radianCos * scaleX; + var b = radianSin * scaleX; + var c = -radianSin * scaleY; + var d = radianCos * scaleY; + + // Invert + var id = 1 / ((a * d) + (c * -b)); + + output.x = (d * id * x) + (-c * id * y) + (((positionY * c) - (positionX * d)) * id); + output.y = (a * id * y) + (-b * id * x) + (((-positionY * a) + (positionX * b)) * id); + + return output; +}; + +module.exports = TransformXY; + + +/***/ }), + +/***/ 93736: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + +var Class = __webpack_require__(56694); +var FuzzyEqual = __webpack_require__(88456); + +/** + * @classdesc + * A representation of a vector in 2D space. + * + * A two-component vector. + * + * @class Vector2 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number|Phaser.Types.Math.Vector2Like} [x=0] - The x component, or an object with `x` and `y` properties. + * @param {number} [y=x] - The y component. + */ +var Vector2 = new Class({ + + initialize: + + function Vector2 (x, y) + { + /** + * The x component of this Vector. + * + * @name Phaser.Math.Vector2#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.x = 0; + + /** + * The y component of this Vector. + * + * @name Phaser.Math.Vector2#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y = 0; + + if (typeof x === 'object') { - return layer.name; - }); + this.x = x.x || 0; + this.y = x.y || 0; + } + else + { + if (y === undefined) { y = x; } + + this.x = x || 0; + this.y = y || 0; + } }, /** - * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. - * - * If no layer is specified, the maps current layer is used. + * Make a clone of this Vector2. * - * @method Phaser.Tilemaps.Tilemap#getTilesWithin + * @method Phaser.Math.Vector2#clone * @since 3.0.0 * - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. - * - * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} A clone of this Vector2. */ - getTilesWithin: function (tileX, tileY, width, height, filteringOptions, layer) + clone: function () { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - return TilemapComponents.GetTilesWithin(tileX, tileY, width, height, filteringOptions, layer); + return new Vector2(this.x, this.y); }, /** - * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, - * Line, Rectangle or Triangle. The shape should be in world coordinates. - * - * If no layer is specified, the maps current layer is used. + * Copy the components of a given Vector into this Vector. * - * @method Phaser.Tilemaps.Tilemap#getTilesWithinShape + * @method Phaser.Math.Vector2#copy * @since 3.0.0 * - * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Types.Math.Vector2Like} src - The Vector to copy the components from. * - * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - getTilesWithinShape: function (shape, filteringOptions, camera, layer) + copy: function (src) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } + this.x = src.x || 0; + this.y = src.y || 0; - return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, layer); + return this; }, /** - * Gets the tiles in the given rectangular area (in world coordinates) of the layer. - * - * If no layer is specified, the maps current layer is used. + * Set the component values of this Vector from a given Vector2Like object. * - * @method Phaser.Tilemaps.Tilemap#getTilesWithinWorldXY + * @method Phaser.Math.Vector2#setFromObject * @since 3.0.0 * - * @param {number} worldX - The world x coordinate for the top-left of the area. - * @param {number} worldY - The world y coordinate for the top-left of the area. - * @param {number} width - The width of the area. - * @param {number} height - The height of the area. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Types.Math.Vector2Like} obj - The object containing the component values to set for this Vector. * - * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera, layer) + setFromObject: function (obj) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } + this.x = obj.x || 0; + this.y = obj.y || 0; - return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, layer); + return this; }, /** - * Gets the Tileset that has the given `name`, or null if an invalid `name` is given. + * Set the `x` and `y` components of the this Vector to the given `x` and `y` values. * - * @method Phaser.Tilemaps.Tilemap#getTileset - * @since 3.14.0 + * @method Phaser.Math.Vector2#set + * @since 3.0.0 * - * @param {string} name - The name of the Tileset to get. + * @param {number} x - The x value to set for this Vector. + * @param {number} [y=x] - The y value to set for this Vector. * - * @return {?Phaser.Tilemaps.Tileset} The Tileset, or `null` if no matching named tileset was found. + * @return {Phaser.Math.Vector2} This Vector2. */ - getTileset: function (name) + set: function (x, y) { - var index = this.getIndex(this.tilesets, name); + if (y === undefined) { y = x; } - return (index !== null) ? this.tilesets[index] : null; + this.x = x; + this.y = y; + + return this; }, /** - * Gets the index of the Tileset within this.tilesets that has the given `name`, or null if an - * invalid `name` is given. + * This method is an alias for `Vector2.set`. * - * @method Phaser.Tilemaps.Tilemap#getTilesetIndex - * @since 3.0.0 + * @method Phaser.Math.Vector2#setTo + * @since 3.4.0 * - * @param {string} name - The name of the Tileset to get. + * @param {number} x - The x value to set for this Vector. + * @param {number} [y=x] - The y value to set for this Vector. * - * @return {number} The Tileset index within this.tilesets. + * @return {Phaser.Math.Vector2} This Vector2. */ - getTilesetIndex: function (name) + setTo: function (x, y) { - return this.getIndex(this.tilesets, name); + return this.set(x, y); }, /** - * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns - * false if there is no tile or if the tile at that location has an index of -1. - * - * If no layer is specified, the maps current layer is used. + * Sets the `x` and `y` values of this object from a given polar coordinate. * - * @method Phaser.Tilemaps.Tilemap#hasTileAt + * @method Phaser.Math.Vector2#setToPolar * @since 3.0.0 * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} azimuth - The angular coordinate, in radians. + * @param {number} [radius=1] - The radial coordinate (length). * - * @return {?boolean} Returns a boolean, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - hasTileAt: function (tileX, tileY, layer) + setToPolar: function (azimuth, radius) { - layer = this.getLayer(layer); + if (radius == null) { radius = 1; } - if (layer === null) { return null; } + this.x = Math.cos(azimuth) * radius; + this.y = Math.sin(azimuth) * radius; - return TilemapComponents.HasTileAt(tileX, tileY, layer); + return this; }, /** - * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns - * false if there is no tile or if the tile at that location has an index of -1. + * Check whether this Vector is equal to a given Vector. * - * If no layer is specified, the maps current layer is used. + * Performs a strict equality check against each Vector's components. * - * @method Phaser.Tilemaps.Tilemap#hasTileAtWorldXY + * @method Phaser.Math.Vector2#equals * @since 3.0.0 * - * @param {number} worldX - The x coordinate, in pixels. - * @param {number} worldY - The y coordinate, in pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Types.Math.Vector2Like} v - The vector to compare with this Vector. * - * @return {?boolean} Returns a boolean, or null if the layer given was invalid. + * @return {boolean} Whether the given Vector is equal to this Vector. */ - hasTileAtWorldXY: function (worldX, worldY, camera, layer) + equals: function (v) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera, layer); + return ((this.x === v.x) && (this.y === v.y)); }, /** - * The LayerData object that is currently selected in the map. You can set this property using - * any type supported by setLayer. + * Check whether this Vector is approximately equal to a given Vector. * - * @name Phaser.Tilemaps.Tilemap#layer - * @type {Phaser.Tilemaps.LayerData} - * @since 3.0.0 + * @method Phaser.Math.Vector2#fuzzyEquals + * @since 3.23.0 + * + * @param {Phaser.Types.Math.Vector2Like} v - The vector to compare with this Vector. + * @param {number} [epsilon=0.0001] - The tolerance value. + * + * @return {boolean} Whether both absolute differences of the x and y components are smaller than `epsilon`. */ - layer: { - get: function () - { - return this.layers[this.currentLayerIndex]; - }, - - set: function (layer) - { - this.setLayer(layer); - } + fuzzyEquals: function (v, epsilon) + { + return (FuzzyEqual(this.x, v.x, epsilon) && FuzzyEqual(this.y, v.y, epsilon)); }, /** - * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index - * or a Tile object. If you pass in a Tile, all attributes will be copied over to the specified - * location. If you pass in an index, only the index at the specified location will be changed. - * Collision information will be recalculated at the specified location. - * - * If no layer is specified, the maps current layer is used. + * Calculate the angle between this Vector and the positive x-axis, in radians. * - * @method Phaser.Tilemaps.Tilemap#putTileAt + * @method Phaser.Math.Vector2#angle * @since 3.0.0 * - * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. - * - * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid or the coordinates were out of bounds. + * @return {number} The angle between this Vector, and the positive x-axis, given in radians. */ - putTileAt: function (tile, tileX, tileY, recalculateFaces, layer) + angle: function () { - if (recalculateFaces === undefined) { recalculateFaces = true; } + // computes the angle in radians with respect to the positive x-axis - layer = this.getLayer(layer); + var angle = Math.atan2(this.y, this.x); - if (layer === null) { return null; } + if (angle < 0) + { + angle += 2 * Math.PI; + } - return TilemapComponents.PutTileAt(tile, tileX, tileY, recalculateFaces, layer); + return angle; }, /** - * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either - * an index or a Tile object. If you pass in a Tile, all attributes will be copied over to the - * specified location. If you pass in an index, only the index at the specified location will be - * changed. Collision information will be recalculated at the specified location. - * - * If no layer is specified, the maps current layer is used. + * Set the angle of this Vector. * - * @method Phaser.Tilemaps.Tilemap#putTileAtWorldXY - * @since 3.0.0 + * @method Phaser.Math.Vector2#setAngle + * @since 3.23.0 * - * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {number} worldX - The x coordinate, in pixels. - * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {number} angle - The angle, in radians. * - * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera, layer) + setAngle: function (angle) { - if (recalculateFaces === undefined) { recalculateFaces = true; } - - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - return TilemapComponents.PutTileAtWorldXY(tile, worldX, worldY, recalculateFaces, camera, layer); + return this.setToPolar(angle, this.length()); }, /** - * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified - * layer. The array can be composed of either tile indexes or Tile objects. If you pass in a Tile, - * all attributes will be copied over to the specified location. If you pass in an index, only the - * index at the specified location will be changed. Collision information will be recalculated - * within the region tiles were changed. - * - * If no layer is specified, the maps current layer is used. + * Add a given Vector to this Vector. Addition is component-wise. * - * @method Phaser.Tilemaps.Tilemap#putTilesAt + * @method Phaser.Math.Vector2#add * @since 3.0.0 * - * @param {(number[]|number[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Types.Math.Vector2Like} src - The Vector to add to this Vector. * - * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces, layer) + add: function (src) { - if (recalculateFaces === undefined) { recalculateFaces = true; } + this.x += src.x; + this.y += src.y; - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, layer); - - return this; - }, + return this; + }, /** - * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the - * specified layer. Each tile will receive a new index. If an array of indexes is passed in, then - * those will be used for randomly assigning new tile indexes. If an array is not provided, the - * indexes found within the region (excluding -1) will be used for randomly assigning new tile - * indexes. This method only modifies tile indexes and does not change collision information. - * - * If no layer is specified, the maps current layer is used. + * Subtract the given Vector from this Vector. Subtraction is component-wise. * - * @method Phaser.Tilemaps.Tilemap#randomize + * @method Phaser.Math.Vector2#subtract * @since 3.0.0 * - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {number[]} [indexes] - An array of indexes to randomly draw from during randomization. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Types.Math.Vector2Like} src - The Vector to subtract from this Vector. * - * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - randomize: function (tileX, tileY, width, height, indexes, layer) + subtract: function (src) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - TilemapComponents.Randomize(tileX, tileY, width, height, indexes, layer); + this.x -= src.x; + this.y -= src.y; return this; }, /** - * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting - * faces are used internally for optimizing collisions against tiles. This method is mostly used - * internally to optimize recalculating faces when only one tile has been changed. + * Perform a component-wise multiplication between this Vector and the given Vector. * - * If no layer is specified, the maps current layer is used. + * Multiplies this Vector by the given Vector. * - * @method Phaser.Tilemaps.Tilemap#calculateFacesAt + * @method Phaser.Math.Vector2#multiply * @since 3.0.0 * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Types.Math.Vector2Like} src - The Vector to multiply this Vector by. * - * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - calculateFacesAt: function (tileX, tileY, layer) + multiply: function (src) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - TilemapComponents.CalculateFacesAt(tileX, tileY, layer); + this.x *= src.x; + this.y *= src.y; return this; }, /** - * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the - * layer. Interesting faces are used internally for optimizing collisions against tiles. This method - * is mostly used internally. - * - * If no layer is specified, the maps current layer is used. + * Scale this Vector by the given value. * - * @method Phaser.Tilemaps.Tilemap#calculateFacesWithin + * @method Phaser.Math.Vector2#scale * @since 3.0.0 * - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. - * - * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. - */ - calculateFacesWithin: function (tileX, tileY, width, height, layer) - { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - TilemapComponents.CalculateFacesWithin(tileX, tileY, width, height, layer); - - return this; - }, - - /** - * Removes the given TilemapLayer from this Tilemap without destroying it. - * - * If no layer is specified, the maps current layer is used. - * - * @method Phaser.Tilemaps.Tilemap#removeLayer - * @since 3.17.0 - * - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to be removed. + * @param {number} value - The value to scale this Vector by. * - * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - removeLayer: function (layer) + scale: function (value) { - var index = this.getLayerIndex(layer); - - if (index !== null) + if (isFinite(value)) { - SpliceOne(this.layers, index); - - for (var i = index; i < this.layers.length; i++) - { - if (this.layers[i].tilemapLayer) - { - this.layers[i].tilemapLayer.layerIndex--; - } - } - - if (this.currentLayerIndex === index) - { - this.currentLayerIndex = 0; - } - - return this; + this.x *= value; + this.y *= value; } else { - return null; + this.x = 0; + this.y = 0; } + + return this; }, /** - * Destroys the given TilemapLayer and removes it from this Tilemap. + * Perform a component-wise division between this Vector and the given Vector. * - * If no layer is specified, the maps current layer is used. + * Divides this Vector by the given Vector. * - * @method Phaser.Tilemaps.Tilemap#destroyLayer - * @since 3.17.0 + * @method Phaser.Math.Vector2#divide + * @since 3.0.0 * - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to be destroyed. + * @param {Phaser.Types.Math.Vector2Like} src - The Vector to divide this Vector by. * - * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - destroyLayer: function (layer) + divide: function (src) { - var index = this.getLayerIndex(layer); - - if (index !== null) - { - layer = this.layers[index]; - - layer.destroy(); - - SpliceOne(this.layers, index); - - if (this.currentLayerIndex === index) - { - this.currentLayerIndex = 0; - } + this.x /= src.x; + this.y /= src.y; - return this; - } - else - { - return null; - } + return this; }, /** - * Removes all Tilemap Layers from this Tilemap and calls `destroy` on each of them. + * Negate the `x` and `y` components of this Vector. * - * @method Phaser.Tilemaps.Tilemap#removeAllLayers + * @method Phaser.Math.Vector2#negate * @since 3.0.0 * - * @return {this} This Tilemap object. + * @return {Phaser.Math.Vector2} This Vector2. */ - removeAllLayers: function () + negate: function () { - var layers = this.layers; - - for (var i = 0; i < layers.length; i++) - { - if (layers[i].tilemapLayer) - { - layers[i].tilemapLayer.destroy(false); - } - } - - layers.length = 0; - - this.currentLayerIndex = 0; + this.x = -this.x; + this.y = -this.y; return this; }, /** - * Removes the given Tile, or an array of Tiles, from the layer to which they belong, - * and optionally recalculates the collision information. + * Calculate the distance between this Vector and the given Vector. * - * @method Phaser.Tilemaps.Tilemap#removeTile - * @since 3.17.0 + * @method Phaser.Math.Vector2#distance + * @since 3.0.0 * - * @param {(Phaser.Tilemaps.Tile|Phaser.Tilemaps.Tile[])} tiles - The Tile to remove, or an array of Tiles. - * @param {number} [replaceIndex=-1] - After removing the Tile, insert a brand new Tile into its location with the given index. Leave as -1 to just remove the tile. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {Phaser.Types.Math.Vector2Like} src - The Vector to calculate the distance to. * - * @return {Phaser.Tilemaps.Tile[]} Returns an array of Tiles that were removed. + * @return {number} The distance from this Vector to the given Vector. */ - removeTile: function (tiles, replaceIndex, recalculateFaces) + distance: function (src) { - if (replaceIndex === undefined) { replaceIndex = -1; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - - var removed = []; - - if (!Array.isArray(tiles)) - { - tiles = [ tiles ]; - } - - for (var i = 0; i < tiles.length; i++) - { - var tile = tiles[i]; - - removed.push(this.removeTileAt(tile.x, tile.y, true, recalculateFaces, tile.tilemapLayer)); - - if (replaceIndex > -1) - { - this.putTileAt(replaceIndex, tile.x, tile.y, recalculateFaces, tile.tilemapLayer); - } - } + var dx = src.x - this.x; + var dy = src.y - this.y; - return removed; + return Math.sqrt(dx * dx + dy * dy); }, /** - * Removes the tile at the given tile coordinates in the specified layer and updates the layers collision information. - * - * If no layer is specified, the maps current layer is used. + * Calculate the distance between this Vector and the given Vector, squared. * - * @method Phaser.Tilemaps.Tilemap#removeTileAt + * @method Phaser.Math.Vector2#distanceSq * @since 3.0.0 * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [replaceWithNull] - If `true` (the default), this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} [recalculateFaces] - If `true` (the default), the faces data will be recalculated. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Types.Math.Vector2Like} src - The Vector to calculate the distance to. * - * @return {?Phaser.Tilemaps.Tile} Returns the Tile that was removed, or null if the layer given was invalid. + * @return {number} The distance from this Vector to the given Vector, squared. */ - removeTileAt: function (tileX, tileY, replaceWithNull, recalculateFaces, layer) + distanceSq: function (src) { - if (replaceWithNull === undefined) { replaceWithNull = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - - layer = this.getLayer(layer); - - if (layer === null) { return null; } + var dx = src.x - this.x; + var dy = src.y - this.y; - return TilemapComponents.RemoveTileAt(tileX, tileY, replaceWithNull, recalculateFaces, layer); + return dx * dx + dy * dy; }, /** - * Removes the tile at the given world coordinates in the specified layer and updates the layers collision information. - * - * If no layer is specified, the maps current layer is used. + * Calculate the length (or magnitude) of this Vector. * - * @method Phaser.Tilemaps.Tilemap#removeTileAtWorldXY + * @method Phaser.Math.Vector2#length * @since 3.0.0 * - * @param {number} worldX - The x coordinate, in pixels. - * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [replaceWithNull] - If `true` (the default), this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} [recalculateFaces] - If `true` (the default), the faces data will be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. - * - * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. + * @return {number} The length of this Vector. */ - removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer) + length: function () { - if (replaceWithNull === undefined) { replaceWithNull = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - - layer = this.getLayer(layer); - - if (layer === null) { return null; } + var x = this.x; + var y = this.y; - return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, layer); + return Math.sqrt(x * x + y * y); }, /** - * Draws a debug representation of the layer to the given Graphics object. This is helpful when you want to - * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles - * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation - * wherever you want on the screen. + * Set the length (or magnitude) of this Vector. * - * If no layer is specified, the maps current layer is used. + * @method Phaser.Math.Vector2#setLength + * @since 3.23.0 * - * **Note:** This method currently only works with orthogonal tilemap layers. + * @param {number} length * - * @method Phaser.Tilemaps.Tilemap#renderDebug - * @since 3.0.0 + * @return {Phaser.Math.Vector2} This Vector2. + */ + setLength: function (length) + { + return this.normalize().scale(length); + }, + + /** + * Calculate the length of this Vector squared. * - * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {Phaser.Types.Tilemaps.StyleConfig} [styleConfig] - An object specifying the colors to use for the debug drawing. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @method Phaser.Math.Vector2#lengthSq + * @since 3.0.0 * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {number} The length of this Vector, squared. */ - renderDebug: function (graphics, styleConfig, layer) + lengthSq: function () { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - if (this.orientation === ORIENTATION.ORTHOGONAL) - { - TilemapComponents.RenderDebug(graphics, styleConfig, layer); - } + var x = this.x; + var y = this.y; - return this; + return x * x + y * y; }, /** - * Draws a debug representation of all layers within this Tilemap to the given Graphics object. - * - * This is helpful when you want to get a quick idea of which of your tiles are colliding and which - * have interesting faces. The tiles are drawn starting at (0, 0) in the Graphics, allowing you to - * place the debug representation wherever you want on the screen. + * Normalize this Vector. * - * @method Phaser.Tilemaps.Tilemap#renderDebugFull - * @since 3.17.0 + * Makes the vector a unit length vector (magnitude of 1) in the same direction. * - * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {Phaser.Types.Tilemaps.StyleConfig} [styleConfig] - An object specifying the colors to use for the debug drawing. + * @method Phaser.Math.Vector2#normalize + * @since 3.0.0 * - * @return {this} This Tilemap instance. + * @return {Phaser.Math.Vector2} This Vector2. */ - renderDebugFull: function (graphics, styleConfig) + normalize: function () { - var layers = this.layers; + var x = this.x; + var y = this.y; + var len = x * x + y * y; - for (var i = 0; i < layers.length; i++) + if (len > 0) { - TilemapComponents.RenderDebug(graphics, styleConfig, layers[i]); + len = 1 / Math.sqrt(len); + + this.x = x * len; + this.y = y * len; } return this; }, /** - * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching - * `findIndex` and updates their index to match `newIndex`. This only modifies the index and does - * not change collision information. - * - * If no layer is specified, the maps current layer is used. + * Rotate this Vector to its perpendicular, in the positive direction. * - * @method Phaser.Tilemaps.Tilemap#replaceByIndex + * @method Phaser.Math.Vector2#normalizeRightHand * @since 3.0.0 * - * @param {number} findIndex - The index of the tile to search for. - * @param {number} newIndex - The index of the tile to replace it with. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. - * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - replaceByIndex: function (findIndex, newIndex, tileX, tileY, width, height, layer) + normalizeRightHand: function () { - layer = this.getLayer(layer); - - if (layer === null) { return null; } + var x = this.x; - TilemapComponents.ReplaceByIndex(findIndex, newIndex, tileX, tileY, width, height, layer); + this.x = this.y * -1; + this.y = x; return this; }, /** - * Sets collision on the given tile or tiles within a layer by index. You can pass in either a - * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if - * collision will be enabled (true) or disabled (false). - * - * If no layer is specified, the maps current layer is used. - * - * @method Phaser.Tilemaps.Tilemap#setCollision - * @since 3.0.0 + * Rotate this Vector to its perpendicular, in the negative direction. * - * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes. - * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. - * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. + * @method Phaser.Math.Vector2#normalizeLeftHand + * @since 3.23.0 * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - setCollision: function (indexes, collides, recalculateFaces, layer, updateLayer) + normalizeLeftHand: function () { - if (collides === undefined) { collides = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - if (updateLayer === undefined) { updateLayer = true; } - - layer = this.getLayer(layer); - - if (layer === null) { return null; } + var x = this.x; - TilemapComponents.SetCollision(indexes, collides, recalculateFaces, layer, updateLayer); + this.x = this.y; + this.y = x * -1; return this; }, /** - * Sets collision on a range of tiles in a layer whose index is between the specified `start` and - * `stop` (inclusive). Calling this with a start value of 10 and a stop value of 14 would set - * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be - * enabled (true) or disabled (false). - * - * If no layer is specified, the maps current layer is used. + * Calculate the dot product of this Vector and the given Vector. * - * @method Phaser.Tilemaps.Tilemap#setCollisionBetween + * @method Phaser.Math.Vector2#dot * @since 3.0.0 * - * @param {number} start - The first index of the tile to be set for collision. - * @param {number} stop - The last index of the tile to be set for collision. - * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Types.Math.Vector2Like} src - The Vector2 to dot product with this Vector2. * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {number} The dot product of this Vector and the given Vector. */ - setCollisionBetween: function (start, stop, collides, recalculateFaces, layer) + dot: function (src) { - if (collides === undefined) { collides = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - TilemapComponents.SetCollisionBetween(start, stop, collides, recalculateFaces, layer); - - return this; + return this.x * src.x + this.y * src.y; }, /** - * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property - * that matches the given properties object, its collision flag will be set. The `collides` - * parameter controls if collision will be enabled (true) or disabled (false). Passing in - * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that - * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can - * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a - * "types" property that matches any of those values, its collision flag will be updated. - * - * If no layer is specified, the maps current layer is used. + * Calculate the cross product of this Vector and the given Vector. * - * @method Phaser.Tilemaps.Tilemap#setCollisionByProperty + * @method Phaser.Math.Vector2#cross * @since 3.0.0 * - * @param {object} properties - An object with tile properties and corresponding values that should be checked. - * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Types.Math.Vector2Like} src - The Vector2 to cross with this Vector2. * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {number} The cross product of this Vector and the given Vector. */ - setCollisionByProperty: function (properties, collides, recalculateFaces, layer) + cross: function (src) { - if (collides === undefined) { collides = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - TilemapComponents.SetCollisionByProperty(properties, collides, recalculateFaces, layer); - - return this; + return this.x * src.y - this.y * src.x; }, /** - * Sets collision on all tiles in the given layer, except for tiles that have an index specified in - * the given array. The `collides` parameter controls if collision will be enabled (true) or - * disabled (false). Tile indexes not currently in the layer are not affected. + * Linearly interpolate between this Vector and the given Vector. * - * If no layer is specified, the maps current layer is used. + * Interpolates this Vector towards the given Vector. * - * @method Phaser.Tilemaps.Tilemap#setCollisionByExclusion + * @method Phaser.Math.Vector2#lerp * @since 3.0.0 * - * @param {number[]} indexes - An array of the tile indexes to not be counted for collision. - * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Types.Math.Vector2Like} src - The Vector2 to interpolate towards. + * @param {number} [t=0] - The interpolation percentage, between 0 and 1. * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - setCollisionByExclusion: function (indexes, collides, recalculateFaces, layer) + lerp: function (src, t) { - if (collides === undefined) { collides = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - - layer = this.getLayer(layer); + if (t === undefined) { t = 0; } - if (layer === null) { return null; } + var ax = this.x; + var ay = this.y; - TilemapComponents.SetCollisionByExclusion(indexes, collides, recalculateFaces, layer); + this.x = ax + t * (src.x - ax); + this.y = ay + t * (src.y - ay); return this; }, /** - * Sets collision on the tiles within a layer by checking each tiles collision group data - * (typically defined in Tiled within the tileset collision editor). If any objects are found within - * a tiles collision group, the tiles colliding information will be set. The `collides` parameter - * controls if collision will be enabled (true) or disabled (false). - * - * If no layer is specified, the maps current layer is used. + * Transform this Vector with the given Matrix. * - * @method Phaser.Tilemaps.Tilemap#setCollisionFromCollisionGroup + * @method Phaser.Math.Vector2#transformMat3 * @since 3.0.0 * - * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector2 with. * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - setCollisionFromCollisionGroup: function (collides, recalculateFaces, layer) + transformMat3: function (mat) { - if (collides === undefined) { collides = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - - layer = this.getLayer(layer); - - if (layer === null) { return null; } + var x = this.x; + var y = this.y; + var m = mat.val; - TilemapComponents.SetCollisionFromCollisionGroup(collides, recalculateFaces, layer); + this.x = m[0] * x + m[3] * y + m[6]; + this.y = m[1] * x + m[4] * y + m[7]; return this; }, /** - * Sets a global collision callback for the given tile index within the layer. This will affect all - * tiles on this layer that have the same index. If a callback is already set for the tile index it - * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile - * at a specific location on the map then see `setTileLocationCallback`. - * - * If no layer is specified, the maps current layer is used. + * Transform this Vector with the given Matrix. * - * @method Phaser.Tilemaps.Tilemap#setTileIndexCallback + * @method Phaser.Math.Vector2#transformMat4 * @since 3.0.0 * - * @param {(number|number[])} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. All values should be integers. - * @param {function} callback - The callback that will be invoked when the tile is collided with. - * @param {object} callbackContext - The context under which the callback is called. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector2 with. * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - setTileIndexCallback: function (indexes, callback, callbackContext, layer) + transformMat4: function (mat) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } + var x = this.x; + var y = this.y; + var m = mat.val; - TilemapComponents.SetTileIndexCallback(indexes, callback, callbackContext, layer); + this.x = m[0] * x + m[4] * y + m[12]; + this.y = m[1] * x + m[5] * y + m[13]; return this; }, /** - * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. - * If a callback is already set for the tile index it will be replaced. Set the callback to null to - * remove it. - * - * If no layer is specified, the maps current layer is used. + * Make this Vector the zero vector (0, 0). * - * @method Phaser.Tilemaps.Tilemap#setTileLocationCallback + * @method Phaser.Math.Vector2#reset * @since 3.0.0 * - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {function} callback - The callback that will be invoked when the tile is collided with. - * @param {object} [callbackContext] - The context under which the callback is called. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. - * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {Phaser.Math.Vector2} This Vector2. */ - setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext, layer) + reset: function () { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - TilemapComponents.SetTileLocationCallback(tileX, tileY, width, height, callback, callbackContext, layer); + this.x = 0; + this.y = 0; return this; }, /** - * Sets the current layer to the LayerData associated with `layer`. + * Limit the length (or magnitude) of this Vector. * - * @method Phaser.Tilemaps.Tilemap#setLayer - * @since 3.0.0 + * @method Phaser.Math.Vector2#limit + * @since 3.23.0 * - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or a TilemapLayer. If not given will default to the maps current layer index. + * @param {number} max - The maximum length. * - * @return {this} This Tilemap object. + * @return {Phaser.Math.Vector2} This Vector2. */ - setLayer: function (layer) + limit: function (max) { - var index = this.getLayerIndex(layer); + var len = this.length(); - if (index !== null) + if (len && len > max) { - this.currentLayerIndex = index; + this.scale(max / len); } return this; }, /** - * Sets the base tile size for the map. Note: this does not necessarily match the tileWidth and - * tileHeight for all layers. This also updates the base size on all tiles across all layers. + * Reflect this Vector off a line defined by a normal. * - * @method Phaser.Tilemaps.Tilemap#setBaseTileSize - * @since 3.0.0 + * @method Phaser.Math.Vector2#reflect + * @since 3.23.0 * - * @param {number} tileWidth - The width of the tiles the map uses for calculations. - * @param {number} tileHeight - The height of the tiles the map uses for calculations. + * @param {Phaser.Math.Vector2} normal - A vector perpendicular to the line. * - * @return {this} This Tilemap object. + * @return {Phaser.Math.Vector2} This Vector2. */ - setBaseTileSize: function (tileWidth, tileHeight) + reflect: function (normal) { - this.tileWidth = tileWidth; - this.tileHeight = tileHeight; - this.widthInPixels = this.width * tileWidth; - this.heightInPixels = this.height * tileHeight; - - // Update the base tile size on all layers & tiles - for (var i = 0; i < this.layers.length; i++) - { - this.layers[i].baseTileWidth = tileWidth; - this.layers[i].baseTileHeight = tileHeight; + normal = normal.clone().normalize(); - var mapData = this.layers[i].data; - var mapWidth = this.layers[i].width; - var mapHeight = this.layers[i].height; + return this.subtract(normal.scale(2 * this.dot(normal))); + }, - for (var row = 0; row < mapHeight; row++) - { - for (var col = 0; col < mapWidth; col++) - { - var tile = mapData[row][col]; + /** + * Reflect this Vector across another. + * + * @method Phaser.Math.Vector2#mirror + * @since 3.23.0 + * + * @param {Phaser.Math.Vector2} axis - A vector to reflect across. + * + * @return {Phaser.Math.Vector2} This Vector2. + */ + mirror: function (axis) + { + return this.reflect(axis).negate(); + }, - if (tile !== null) - { - tile.setSize(undefined, undefined, tileWidth, tileHeight); - } - } - } - } + /** + * Rotate this Vector by an angle amount. + * + * @method Phaser.Math.Vector2#rotate + * @since 3.23.0 + * + * @param {number} delta - The angle to rotate by, in radians. + * + * @return {Phaser.Math.Vector2} This Vector2. + */ + rotate: function (delta) + { + var cos = Math.cos(delta); + var sin = Math.sin(delta); - return this; + return this.set(cos * this.x - sin * this.y, sin * this.x + cos * this.y); }, /** - * Sets the tile size for a specific `layer`. Note: this does not necessarily match the maps - * tileWidth and tileHeight for all layers. This will set the tile size for the layer and any - * tiles the layer has. + * Project this Vector onto another. * - * @method Phaser.Tilemaps.Tilemap#setLayerTileSize - * @since 3.0.0 + * @method Phaser.Math.Vector2#project + * @since 3.60.0 * - * @param {number} tileWidth - The width of the tiles (in pixels) in the layer. - * @param {number} tileHeight - The height of the tiles (in pixels) in the layer. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or a TilemapLayer. If not given will default to the maps current layer index. + * @param {Phaser.Math.Vector2} src - The vector to project onto. * - * @return {this} This Tilemap object. + * @return {Phaser.Math.Vector2} This Vector2. */ - setLayerTileSize: function (tileWidth, tileHeight, layer) + project: function (src) { - layer = this.getLayer(layer); + var scalar = this.dot(src) / src.dot(src); - if (layer === null) { return this; } + return this.copy(src).scale(scalar); + } - layer.tileWidth = tileWidth; - layer.tileHeight = tileHeight; +}); - var mapData = layer.data; - var mapWidth = layer.width; - var mapHeight = layer.height; +/** + * A static zero Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.ZERO + * @type {Phaser.Math.Vector2} + * @since 3.1.0 + */ +Vector2.ZERO = new Vector2(); - for (var row = 0; row < mapHeight; row++) - { - for (var col = 0; col < mapWidth; col++) - { - var tile = mapData[row][col]; +/** + * A static right Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.RIGHT + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.RIGHT = new Vector2(1, 0); - if (tile !== null) - { - tile.setSize(tileWidth, tileHeight); - } - } - } +/** + * A static left Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.LEFT + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.LEFT = new Vector2(-1, 0); - return this; +/** + * A static up Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.UP + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.UP = new Vector2(0, -1); + +/** + * A static down Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.DOWN + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.DOWN = new Vector2(0, 1); + +/** + * A static one Vector2 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector2.ONE + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ +Vector2.ONE = new Vector2(1, 1); + +module.exports = Vector2; + + +/***/ }), + +/***/ 70015: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + +var Class = __webpack_require__(56694); + +/** + * @classdesc + * A representation of a vector in 3D space. + * + * A three-component vector. + * + * @class Vector3 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + */ +var Vector3 = new Class({ + + initialize: + + function Vector3 (x, y, z) + { + /** + * The x component of this Vector. + * + * @name Phaser.Math.Vector3#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.x = 0; + + /** + * The y component of this Vector. + * + * @name Phaser.Math.Vector3#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y = 0; + + /** + * The z component of this Vector. + * + * @name Phaser.Math.Vector3#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.z = 0; + + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } }, /** - * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given - * layer. It will only randomize the tiles in that area, so if they're all the same nothing will - * appear to have changed! This method only modifies tile indexes and does not change collision - * information. + * Set this Vector to point up. * - * If no layer is specified, the maps current layer is used. + * Sets the y component of the vector to 1, and the others to 0. * - * @method Phaser.Tilemaps.Tilemap#shuffle + * @method Phaser.Math.Vector3#up * @since 3.0.0 * - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. - * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {Phaser.Math.Vector3} This Vector3. */ - shuffle: function (tileX, tileY, width, height, layer) + up: function () { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - TilemapComponents.Shuffle(tileX, tileY, width, height, layer); + this.x = 0; + this.y = 1; + this.z = 0; return this; }, /** - * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching - * `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision - * information. - * - * If no layer is specified, the maps current layer is used. + * Sets the components of this Vector to be the `Math.min` result from the given vector. * - * @method Phaser.Tilemaps.Tilemap#swapByIndex - * @since 3.0.0 + * @method Phaser.Math.Vector3#min + * @since 3.50.0 * - * @param {number} tileA - First tile index. - * @param {number} tileB - Second tile index. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Math.Vector3} v - The Vector3 to check the minimum values against. * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {Phaser.Math.Vector3} This Vector3. */ - swapByIndex: function (indexA, indexB, tileX, tileY, width, height, layer) + min: function (v) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - TilemapComponents.SwapByIndex(indexA, indexB, tileX, tileY, width, height, layer); + this.x = Math.min(this.x, v.x); + this.y = Math.min(this.y, v.y); + this.z = Math.min(this.z, v.z); return this; }, /** - * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the - * layers position, scale and scroll. - * - * If no layer is specified, the maps current layer is used. + * Sets the components of this Vector to be the `Math.max` result from the given vector. * - * @method Phaser.Tilemaps.Tilemap#tileToWorldX - * @since 3.0.0 + * @method Phaser.Math.Vector3#max + * @since 3.50.0 * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Math.Vector3} v - The Vector3 to check the maximum values against. * - * @return {?number} Returns a number, or null if the layer given was invalid. + * @return {Phaser.Math.Vector3} This Vector3. */ - tileToWorldX: function (tileX, camera, layer) + max: function (v) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } + this.x = Math.max(this.x, v.x); + this.y = Math.max(this.y, v.y); + this.z = Math.max(this.z, v.z); - return this._convert.TileToWorldX(tileX, camera, layer); + return this; }, /** - * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the - * layers position, scale and scroll. - * - * If no layer is specified, the maps current layer is used. + * Make a clone of this Vector3. * - * @method Phaser.Tilemaps.Tilemap#tileToWorldY + * @method Phaser.Math.Vector3#clone * @since 3.0.0 * - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. - * - * @return {?number} Returns a number, or null if the layer given was invalid. + * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values. */ - tileToWorldY: function (tileX, camera, layer) + clone: function () { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - return this._convert.TileToWorldY(tileX, camera, layer); + return new Vector3(this.x, this.y, this.z); }, /** - * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the - * layers position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * If no layer is specified, the maps current layer is used. + * Adds the two given Vector3s and sets the results into this Vector3. * - * @method Phaser.Tilemaps.Tilemap#tileToWorldXY - * @since 3.0.0 + * @method Phaser.Math.Vector3#addVectors + * @since 3.50.0 * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Math.Vector2} [vec2] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Math.Vector3} a - The first Vector to add. + * @param {Phaser.Math.Vector3} b - The second Vector to add. * - * @return {?Phaser.Math.Vector2} Returns a Vector2, or null if the layer given was invalid. + * @return {Phaser.Math.Vector3} This Vector3. */ - tileToWorldXY: function (tileX, tileY, vec2, camera, layer) + addVectors: function (a, b) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } + this.x = a.x + b.x; + this.y = a.y + b.y; + this.z = a.z + b.z; - return this._convert.TileToWorldXY(tileX, tileY, vec2, camera, layer); + return this; }, /** - * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the - * specified layer. Each tile will receive a new index. New indexes are drawn from the given - * weightedIndexes array. An example weighted array: - * - * [ - * { index: 6, weight: 4 }, // Probability of index 6 is 4 / 8 - * { index: 7, weight: 2 }, // Probability of index 7 would be 2 / 8 - * { index: 8, weight: 1.5 }, // Probability of index 8 would be 1.5 / 8 - * { index: 26, weight: 0.5 } // Probability of index 27 would be 0.5 / 8 - * ] - * - * The probability of any index being picked is (the indexs weight) / (sum of all weights). This - * method only modifies tile indexes and does not change collision information. - * - * If no layer is specified, the maps current layer is used. + * Calculate the cross (vector) product of two given Vectors. * - * @method Phaser.Tilemaps.Tilemap#weightedRandomize + * @method Phaser.Math.Vector3#crossVectors * @since 3.0.0 * - * @param {object[]} weightedIndexes - An array of objects to randomly draw from during randomization. They should be in the form: { index: 0, weight: 4 } or { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Math.Vector3} a - The first Vector to multiply. + * @param {Phaser.Math.Vector3} b - The second Vector to multiply. * - * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + * @return {Phaser.Math.Vector3} This Vector3. */ - weightedRandomize: function (weightedIndexes, tileX, tileY, width, height, layer) + crossVectors: function (a, b) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } + var ax = a.x; + var ay = a.y; + var az = a.z; + var bx = b.x; + var by = b.y; + var bz = b.z; - TilemapComponents.WeightedRandomize(tileX, tileY, width, height, weightedIndexes, layer); + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; return this; }, /** - * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the - * layers position, scale and scroll. + * Check whether this Vector is equal to a given Vector. * - * If no layer is specified, the maps current layer is used. + * Performs a strict equality check against each Vector's components. * - * @method Phaser.Tilemaps.Tilemap#worldToTileX + * @method Phaser.Math.Vector3#equals * @since 3.0.0 * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {Phaser.Math.Vector3} v - The Vector3 to compare against. * - * @return {?number} Returns a number, or null if the layer given was invalid. + * @return {boolean} True if the two vectors strictly match, otherwise false. */ - worldToTileX: function (worldX, snapToFloor, camera, layer) + equals: function (v) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } - - return this._convert.WorldToTileX(worldX, snapToFloor, camera, layer); + return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z)); }, /** - * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the - * layers position, scale and scroll. - * - * If no layer is specified, the maps current layer is used. + * Copy the components of a given Vector into this Vector. * - * @method Phaser.Tilemaps.Tilemap#worldToTileY + * @method Phaser.Math.Vector3#copy * @since 3.0.0 * - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from. * - * @return {?number} Returns a number, or null if the layer given was invalid. + * @return {Phaser.Math.Vector3} This Vector3. */ - worldToTileY: function (worldY, snapToFloor, camera, layer) + copy: function (src) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } + this.x = src.x; + this.y = src.y; + this.z = src.z || 0; - return this._convert.WorldToTileY(worldY, snapToFloor, camera, layer); + return this; }, /** - * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the - * layers position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * If no layer is specified, the maps current layer is used. + * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values. * - * @method Phaser.Tilemaps.Tilemap#worldToTileXY + * @method Phaser.Math.Vector3#set * @since 3.0.0 * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Math.Vector2} [vec2] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. - * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components. + * @param {number} [y] - The y value to set for this Vector. + * @param {number} [z] - The z value to set for this Vector. * - * @return {?Phaser.Math.Vector2} Returns a vec2, or null if the layer given was invalid. + * @return {Phaser.Math.Vector3} This Vector3. */ - worldToTileXY: function (worldX, worldY, snapToFloor, vec2, camera, layer) + set: function (x, y, z) { - layer = this.getLayer(layer); - - if (layer === null) { return null; } + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + } - return this._convert.WorldToTileXY(worldX, worldY, snapToFloor, vec2, camera, layer); + return this; }, /** - * Removes all layer data from this Tilemap and nulls the scene reference. This will destroy any - * TilemapLayers that have been created. + * Sets the components of this Vector3 from the position of the given Matrix4. * - * @method Phaser.Tilemaps.Tilemap#destroy - * @since 3.0.0 + * @method Phaser.Math.Vector3#setFromMatrixPosition + * @since 3.50.0 + * + * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to get the position from. + * + * @return {Phaser.Math.Vector3} This Vector3. */ - destroy: function () - { - this.removeAllLayers(); - - this.tilesets.length = 0; - this.objects.length = 0; - - this.scene = null; - } - -}); - -module.exports = Tilemap; - - -/***/ }), -/* 581 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var Components = __webpack_require__(11); -var GameObject = __webpack_require__(15); -var TilemapComponents = __webpack_require__(251); -var TilemapLayerRender = __webpack_require__(1456); - -/** - * @classdesc - * A Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination - * with one, or more, Tilesets. - * - * @class TilemapLayer - * @extends Phaser.GameObjects.GameObject - * @memberof Phaser.Tilemaps - * @constructor - * @since 3.50.0 - * - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.ComputedSize - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible - * - * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. - * @param {Phaser.Tilemaps.Tilemap} tilemap - The Tilemap this layer is a part of. - * @param {number} layerIndex - The index of the LayerData associated with this layer. - * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. - * @param {number} [x=0] - The world x position where the top left of this layer will be placed. - * @param {number} [y=0] - The world y position where the top left of this layer will be placed. - */ -var TilemapLayer = new Class({ - - Extends: GameObject, - - Mixins: [ - Components.Alpha, - Components.BlendMode, - Components.ComputedSize, - Components.Depth, - Components.Flip, - Components.GetBounds, - Components.Origin, - Components.Pipeline, - Components.Transform, - Components.Visible, - Components.ScrollFactor, - TilemapLayerRender - ], - - initialize: - - function TilemapLayer (scene, tilemap, layerIndex, tileset, x, y) + setFromMatrixPosition: function (m) { - GameObject.call(this, scene, 'TilemapLayer'); - - /** - * Used internally by physics system to perform fast type checks. - * - * @name Phaser.Tilemaps.TilemapLayer#isTilemap - * @type {boolean} - * @readonly - * @since 3.50.0 - */ - this.isTilemap = true; - - /** - * The Tilemap that this layer is a part of. - * - * @name Phaser.Tilemaps.TilemapLayer#tilemap - * @type {Phaser.Tilemaps.Tilemap} - * @since 3.50.0 - */ - this.tilemap = tilemap; - - /** - * The index of the LayerData associated with this layer. - * - * @name Phaser.Tilemaps.TilemapLayer#layerIndex - * @type {number} - * @since 3.50.0 - */ - this.layerIndex = layerIndex; - - /** - * The LayerData associated with this layer. LayerData can only be associated with one - * tilemap layer. - * - * @name Phaser.Tilemaps.TilemapLayer#layer - * @type {Phaser.Tilemaps.LayerData} - * @since 3.50.0 - */ - this.layer = tilemap.layers[layerIndex]; - - // Link the LayerData with this static tilemap layer - this.layer.tilemapLayer = this; - - /** - * An array of `Tileset` objects associated with this layer. - * - * @name Phaser.Tilemaps.TilemapLayer#tileset - * @type {Phaser.Tilemaps.Tileset[]} - * @since 3.50.0 - */ - this.tileset = []; - - /** - * The total number of tiles drawn by the renderer in the last frame. - * - * @name Phaser.Tilemaps.TilemapLayer#tilesDrawn - * @type {number} - * @readonly - * @since 3.50.0 - */ - this.tilesDrawn = 0; - - /** - * The total number of tiles in this layer. Updated every frame. - * - * @name Phaser.Tilemaps.TilemapLayer#tilesTotal - * @type {number} - * @readonly - * @since 3.50.0 - */ - this.tilesTotal = this.layer.width * this.layer.height; - - /** - * Used internally during rendering. This holds the tiles that are visible within the Camera. - * - * @name Phaser.Tilemaps.TilemapLayer#culledTiles - * @type {Phaser.Tilemaps.Tile[]} - * @since 3.50.0 - */ - this.culledTiles = []; - - /** - * You can control if the camera should cull tiles on this layer before rendering them or not. - * - * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. - * - * However, there are some instances when you may wish to disable this, and toggling this flag allows - * you to do so. Also see `setSkipCull` for a chainable method that does the same thing. - * - * @name Phaser.Tilemaps.TilemapLayer#skipCull - * @type {boolean} - * @since 3.50.0 - */ - this.skipCull = false; - - /** - * The amount of extra tiles to add into the cull rectangle when calculating its horizontal size. - * - * See the method `setCullPadding` for more details. - * - * @name Phaser.Tilemaps.TilemapLayer#cullPaddingX - * @type {number} - * @default 1 - * @since 3.50.0 - */ - this.cullPaddingX = 1; - - /** - * The amount of extra tiles to add into the cull rectangle when calculating its vertical size. - * - * See the method `setCullPadding` for more details. - * - * @name Phaser.Tilemaps.TilemapLayer#cullPaddingY - * @type {number} - * @default 1 - * @since 3.50.0 - */ - this.cullPaddingY = 1; - - /** - * The callback that is invoked when the tiles are culled. - * - * It will call a different function based on the map orientation: - * - * Orthogonal (the default) is `TilemapComponents.CullTiles` - * Isometric is `TilemapComponents.IsometricCullTiles` - * Hexagonal is `TilemapComponents.HexagonalCullTiles` - * Staggered is `TilemapComponents.StaggeredCullTiles` - * - * However, you can override this to call any function you like. - * - * It will be sent 4 arguments: - * - * 1. The Phaser.Tilemaps.LayerData object for this Layer - * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. - * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. - * 4. The Render Order constant. - * - * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. - * - * @name Phaser.Tilemaps.TilemapLayer#cullCallback - * @type {function} - * @since 3.50.0 - */ - this.cullCallback = TilemapComponents.GetCullTilesFunction(this.layer.orientation); - - /** - * The rendering (draw) order of the tiles in this layer. - * - * The default is 0 which is 'right-down', meaning it will draw the tiles starting from the top-left, - * drawing to the right and then moving down to the next row. - * - * The draw orders are: - * - * 0 = right-down - * 1 = left-down - * 2 = right-up - * 3 = left-up - * - * This can be changed via the `setRenderOrder` method. - * - * @name Phaser.Tilemaps.TilemapLayer#_renderOrder - * @type {number} - * @default 0 - * @private - * @since 3.50.0 - */ - this._renderOrder = 0; - - /** - * An array holding the mapping between the tile indexes and the tileset they belong to. - * - * @name Phaser.Tilemaps.TilemapLayer#gidMap - * @type {Phaser.Tilemaps.Tileset[]} - * @since 3.50.0 - */ - this.gidMap = []; - - this.setTilesets(tileset); - this.setAlpha(this.layer.alpha); - this.setPosition(x, y); - this.setOrigin(); - this.setSize(tilemap.tileWidth * this.layer.width, tilemap.tileHeight * this.layer.height); - - this.initPipeline(); + return this.fromArray(m.val, 12); }, /** - * Populates the internal `tileset` array with the Tileset references this Layer requires for rendering. + * Sets the components of this Vector3 from the Matrix4 column specified. * - * @method Phaser.Tilemaps.TilemapLayer#setTilesets - * @private + * @method Phaser.Math.Vector3#setFromMatrixColumn * @since 3.50.0 * - * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. + * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to get the column from. + * @param {number} index - The column index. + * + * @return {Phaser.Math.Vector3} This Vector3. */ - setTilesets: function (tilesets) + setFromMatrixColumn: function (mat4, index) { - var gidMap = []; - var setList = []; - var map = this.tilemap; - - if (!Array.isArray(tilesets)) - { - tilesets = [ tilesets ]; - } - - for (var i = 0; i < tilesets.length; i++) - { - var tileset = tilesets[i]; - - if (typeof tileset === 'string') - { - tileset = map.getTileset(tileset); - } - - if (tileset) - { - setList.push(tileset); - - var s = tileset.firstgid; - - for (var t = 0; t < tileset.total; t++) - { - gidMap[s + t] = tileset; - } - } - } - - this.gidMap = gidMap; - this.tileset = setList; + return this.fromArray(mat4.val, index * 4); }, /** - * Sets the rendering (draw) order of the tiles in this layer. - * - * The default is 'right-down', meaning it will order the tiles starting from the top-left, - * drawing to the right and then moving down to the next row. - * - * The draw orders are: - * - * 0 = right-down - * 1 = left-down - * 2 = right-up - * 3 = left-up - * - * Setting the render order does not change the tiles or how they are stored in the layer, - * it purely impacts the order in which they are rendered. + * Sets the components of this Vector3 from the given array, based on the offset. * - * You can provide either an integer (0 to 3), or the string version of the order. + * Vector3.x = array[offset] + * Vector3.y = array[offset + 1] + * Vector3.z = array[offset + 2] * - * @method Phaser.Tilemaps.TilemapLayer#setRenderOrder + * @method Phaser.Math.Vector3#fromArray * @since 3.50.0 * - * @param {(number|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. + * @param {number[]} array - The array of values to get this Vector from. + * @param {number} [offset=0] - The offset index into the array. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector3} This Vector3. */ - setRenderOrder: function (renderOrder) + fromArray: function (array, offset) { - var orders = [ 'right-down', 'left-down', 'right-up', 'left-up' ]; - - if (typeof renderOrder === 'string') - { - renderOrder = orders.indexOf(renderOrder); - } + if (offset === undefined) { offset = 0; } - if (renderOrder >= 0 && renderOrder < 4) - { - this._renderOrder = renderOrder; - } + this.x = array[offset]; + this.y = array[offset + 1]; + this.z = array[offset + 2]; return this; }, /** - * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting - * faces are used internally for optimizing collisions against tiles. This method is mostly used - * internally to optimize recalculating faces when only one tile has been changed. + * Add a given Vector to this Vector. Addition is component-wise. * - * @method Phaser.Tilemaps.TilemapLayer#calculateFacesAt - * @since 3.50.0 + * @method Phaser.Math.Vector3#add + * @since 3.0.0 * - * @param {number} tileX - The x coordinate. - * @param {number} tileY - The y coordinate. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector3} This Vector3. */ - calculateFacesAt: function (tileX, tileY) + add: function (v) { - TilemapComponents.CalculateFacesAt(tileX, tileY, this.layer); + this.x += v.x; + this.y += v.y; + this.z += v.z || 0; return this; }, /** - * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the - * layer. Interesting faces are used internally for optimizing collisions against tiles. This method - * is mostly used internally. + * Add the given value to each component of this Vector. * - * @method Phaser.Tilemaps.TilemapLayer#calculateFacesWithin + * @method Phaser.Math.Vector3#addScalar * @since 3.50.0 * - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {number} s - The amount to add to this Vector. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector3} This Vector3. */ - calculateFacesWithin: function (tileX, tileY, width, height) + addScalar: function (s) { - TilemapComponents.CalculateFacesWithin(tileX, tileY, width, height, this.layer); + this.x += s; + this.y += s; + this.z += s; return this; }, /** - * Creates a Sprite for every object matching the given tile indexes in the layer. You can - * optionally specify if each tile will be replaced with a new tile after the Sprite has been - * created. This is useful if you want to lay down special tiles in a level that are converted to - * Sprites, but want to replace the tile itself with a floor tile or similar once converted. + * Add and scale a given Vector to this Vector. Addition is component-wise. * - * @method Phaser.Tilemaps.TilemapLayer#createFromTiles + * @method Phaser.Math.Vector3#addScale * @since 3.50.0 * - * @param {(number|array)} indexes - The tile index, or array of indexes, to create Sprites from. - * @param {(number|array)} replacements - The tile index, or array of indexes, to change a converted - * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a - * one-to-one mapping with the indexes array. - * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} [spriteConfig] - The config object to pass into the Sprite creator (i.e. - * scene.make.sprite). - * @param {Phaser.Scene} [scene] - The Scene to create the Sprites within. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when determining the world XY + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector. + * @param {number} scale - The amount to scale `v` by. * - * @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created. + * @return {Phaser.Math.Vector3} This Vector3. */ - createFromTiles: function (indexes, replacements, spriteConfig, scene, camera) + addScale: function (v, scale) { - return TilemapComponents.CreateFromTiles(indexes, replacements, spriteConfig, scene, camera, this.layer); + this.x += v.x * scale; + this.y += v.y * scale; + this.z += v.z * scale || 0; + + return this; }, /** - * Returns the tiles in the given layer that are within the cameras viewport. - * This is used internally during rendering. + * Subtract the given Vector from this Vector. Subtraction is component-wise. * - * @method Phaser.Tilemaps.TilemapLayer#cull - * @since 3.50.0 + * @method Phaser.Math.Vector3#subtract + * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects to render. + * @return {Phaser.Math.Vector3} This Vector3. */ - cull: function (camera) + subtract: function (v) { - return this.cullCallback(this.layer, camera, this.culledTiles, this._renderOrder); + this.x -= v.x; + this.y -= v.y; + this.z -= v.z || 0; + + return this; }, /** - * Copies the tiles in the source rectangular area to a new destination (all specified in tile - * coordinates) within the layer. This copies all tile properties & recalculates collision - * information in the destination region. + * Perform a component-wise multiplication between this Vector and the given Vector. * - * @method Phaser.Tilemaps.TilemapLayer#copy - * @since 3.50.0 + * Multiplies this Vector by the given Vector. * - * @param {number} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. - * @param {number} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. - * @param {number} width - The width of the area to copy, in tiles, not pixels. - * @param {number} height - The height of the area to copy, in tiles, not pixels. - * @param {number} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. - * @param {number} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @method Phaser.Math.Vector3#multiply + * @since 3.0.0 * - * @return {this} This Tilemap Layer object. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. */ - copy: function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces) + multiply: function (v) { - TilemapComponents.Copy(srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, this.layer); + this.x *= v.x; + this.y *= v.y; + this.z *= v.z || 1; return this; }, /** - * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the - * specified index. Tiles will be set to collide if the given index is a colliding index. - * Collision information in the region will be recalculated. + * Scale this Vector by the given value. * - * @method Phaser.Tilemaps.TilemapLayer#fill - * @since 3.50.0 + * @method Phaser.Math.Vector3#scale + * @since 3.0.0 * - * @param {number} index - The tile index to fill the area with. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {number} scale - The value to scale this Vector by. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector3} This Vector3. */ - fill: function (index, tileX, tileY, width, height, recalculateFaces) + scale: function (scale) { - TilemapComponents.Fill(index, tileX, tileY, width, height, recalculateFaces, this.layer); + if (isFinite(scale)) + { + this.x *= scale; + this.y *= scale; + this.z *= scale; + } + else + { + this.x = 0; + this.y = 0; + this.z = 0; + } return this; }, /** - * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given - * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns - * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS. + * Perform a component-wise division between this Vector and the given Vector. * - * @method Phaser.Tilemaps.TilemapLayer#filterTiles - * @since 3.50.0 + * Divides this Vector by the given Vector. * - * @param {function} callback - The callback. Each tile in the given area will be passed to this - * callback as the first and only parameter. The callback should return true for tiles that pass the - * filter. - * @param {object} [context] - The context under which the callback should be run. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @method Phaser.Math.Vector3#divide + * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by. + * + * @return {Phaser.Math.Vector3} This Vector3. */ - filterTiles: function (callback, context, tileX, tileY, width, height, filteringOptions) + divide: function (v) { - return TilemapComponents.FilterTiles(callback, context, tileX, tileY, width, height, filteringOptions, this.layer); + this.x /= v.x; + this.y /= v.y; + this.z /= v.z || 1; + + return this; }, /** - * Searches the entire map layer for the first tile matching the given index, then returns that Tile - * object. If no match is found, it returns null. The search starts from the top-left tile and - * continues horizontally until it hits the end of the row, then it drops down to the next column. - * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to - * the top-left. - * - * @method Phaser.Tilemaps.TilemapLayer#findByIndex - * @since 3.50.0 + * Negate the `x`, `y` and `z` components of this Vector. * - * @param {number} index - The tile index value to search for. - * @param {number} [skip=0] - The number of times to skip a matching tile before returning. - * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. + * @method Phaser.Math.Vector3#negate + * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tile} The first matching Tile object. + * @return {Phaser.Math.Vector3} This Vector3. */ - findByIndex: function (findIndex, skip, reverse) + negate: function () { - return TilemapComponents.FindByIndex(findIndex, skip, reverse, this.layer); + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + + return this; }, /** - * Find the first tile in the given rectangular area (in tile coordinates) of the layer that - * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns - * true. Similar to Array.prototype.find in vanilla JS. + * Calculate the distance between this Vector and the given Vector. * - * @method Phaser.Tilemaps.TilemapLayer#findTile - * @since 3.50.0 + * @method Phaser.Math.Vector3#distance + * @since 3.0.0 * - * @param {FindTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. - * @param {object} [context] - The context under which the callback should be run. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. * - * @return {?Phaser.Tilemaps.Tile} The first Tile found at the given location. + * @return {number} The distance from this Vector to the given Vector. */ - findTile: function (callback, context, tileX, tileY, width, height, filteringOptions) + distance: function (v) { - return TilemapComponents.FindTile(callback, context, tileX, tileY, width, height, filteringOptions, this.layer); + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + + return Math.sqrt(dx * dx + dy * dy + dz * dz); }, /** - * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given - * callback. Similar to Array.prototype.forEach in vanilla JS. + * Calculate the distance between this Vector and the given Vector, squared. * - * @method Phaser.Tilemaps.TilemapLayer#forEachTile - * @since 3.50.0 + * @method Phaser.Math.Vector3#distanceSq + * @since 3.0.0 * - * @param {EachTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. - * @param {object} [context] - The context, or scope, under which the callback should be run. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to. * - * @return {this} This Tilemap Layer object. + * @return {number} The distance from this Vector to the given Vector, squared. */ - forEachTile: function (callback, context, tileX, tileY, width, height, filteringOptions) + distanceSq: function (v) { - TilemapComponents.ForEachTile(callback, context, tileX, tileY, width, height, filteringOptions, this.layer); + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; - return this; + return dx * dx + dy * dy + dz * dz; }, /** - * Gets a tile at the given tile coordinates from the given layer. - * - * @method Phaser.Tilemaps.TilemapLayer#getTileAt - * @since 3.50.0 + * Calculate the length (or magnitude) of this Vector. * - * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). - * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). - * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. + * @method Phaser.Math.Vector3#length + * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tile} The Tile at the given coordinates or null if no tile was found or the coordinates were invalid. + * @return {number} The length of this Vector. */ - getTileAt: function (tileX, tileY, nonNull) + length: function () { - return TilemapComponents.GetTileAt(tileX, tileY, nonNull, this.layer); + var x = this.x; + var y = this.y; + var z = this.z; + + return Math.sqrt(x * x + y * y + z * z); }, /** - * Gets a tile at the given world coordinates from the given layer. - * - * @method Phaser.Tilemaps.TilemapLayer#getTileAtWorldXY - * @since 3.50.0 + * Calculate the length of this Vector squared. * - * @param {number} worldX - X position to get the tile from (given in pixels) - * @param {number} worldY - Y position to get the tile from (given in pixels) - * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @method Phaser.Math.Vector3#lengthSq + * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. + * @return {number} The length of this Vector, squared. */ - getTileAtWorldXY: function (worldX, worldY, nonNull, camera) + lengthSq: function () { - return TilemapComponents.GetTileAtWorldXY(worldX, worldY, nonNull, camera, this.layer); + var x = this.x; + var y = this.y; + var z = this.z; + + return x * x + y * y + z * z; }, /** - * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. + * Normalize this Vector. * - * @method Phaser.Tilemaps.TilemapLayer#getTilesWithin - * @since 3.50.0 + * Makes the vector a unit length vector (magnitude of 1) in the same direction. * - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @method Phaser.Math.Vector3#normalize + * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects found within the area. + * @return {Phaser.Math.Vector3} This Vector3. */ - getTilesWithin: function (tileX, tileY, width, height, filteringOptions) + normalize: function () { - return TilemapComponents.GetTilesWithin(tileX, tileY, width, height, filteringOptions, this.layer); + var x = this.x; + var y = this.y; + var z = this.z; + var len = x * x + y * y + z * z; + + if (len > 0) + { + len = 1 / Math.sqrt(len); + + this.x = x * len; + this.y = y * len; + this.z = z * len; + } + + return this; }, /** - * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, - * Line, Rectangle or Triangle. The shape should be in world coordinates. + * Calculate the dot product of this Vector and the given Vector. * - * @method Phaser.Tilemaps.TilemapLayer#getTilesWithinShape - * @since 3.50.0 + * @method Phaser.Math.Vector3#dot + * @since 3.0.0 * - * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects found within the shape. + * @return {number} The dot product of this Vector and `v`. */ - getTilesWithinShape: function (shape, filteringOptions, camera) + dot: function (v) { - return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer); + return this.x * v.x + this.y * v.y + this.z * v.z; }, /** - * Gets the tiles in the given rectangular area (in world coordinates) of the layer. + * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector. * - * @method Phaser.Tilemaps.TilemapLayer#getTilesWithinWorldXY - * @since 3.50.0 + * @method Phaser.Math.Vector3#cross + * @since 3.0.0 * - * @param {number} worldX - The world x coordinate for the top-left of the area. - * @param {number} worldY - The world y coordinate for the top-left of the area. - * @param {number} width - The width of the area. - * @param {number} height - The height of the area. - * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Math.Vector3} v - The Vector to cross product with. * - * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects found within the area. + * @return {Phaser.Math.Vector3} This Vector3. */ - getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera) + cross: function (v) { - return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer); + var ax = this.x; + var ay = this.y; + var az = this.z; + var bx = v.x; + var by = v.y; + var bz = v.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; }, /** - * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns - * false if there is no tile or if the tile at that location has an index of -1. + * Linearly interpolate between this Vector and the given Vector. * - * @method Phaser.Tilemaps.TilemapLayer#hasTileAt - * @since 3.50.0 + * Interpolates this Vector towards the given Vector. * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @method Phaser.Math.Vector3#lerp + * @since 3.0.0 * - * @return {boolean} `true` if a tile was found at the given location, otherwise `false`. + * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards. + * @param {number} [t=0] - The interpolation percentage, between 0 and 1. + * + * @return {Phaser.Math.Vector3} This Vector3. */ - hasTileAt: function (tileX, tileY) + lerp: function (v, t) { - return TilemapComponents.HasTileAt(tileX, tileY, this.layer); + if (t === undefined) { t = 0; } + + var ax = this.x; + var ay = this.y; + var az = this.z; + + this.x = ax + t * (v.x - ax); + this.y = ay + t * (v.y - ay); + this.z = az + t * (v.z - az); + + return this; }, /** - * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns - * false if there is no tile or if the tile at that location has an index of -1. + * Takes a Matrix3 and applies it to this Vector3. * - * @method Phaser.Tilemaps.TilemapLayer#hasTileAtWorldXY + * @method Phaser.Math.Vector3#applyMatrix3 * @since 3.50.0 * - * @param {number} worldX - The x coordinate, in pixels. - * @param {number} worldY - The y coordinate, in pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Math.Matrix3} mat3 - The Matrix3 to apply to this Vector3. * - * @return {boolean} `true` if a tile was found at the given location, otherwise `false`. + * @return {Phaser.Math.Vector3} This Vector3. */ - hasTileAtWorldXY: function (worldX, worldY, camera) + applyMatrix3: function (mat3) { - return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera, this.layer); + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat3.val; + + this.x = m[0] * x + m[3] * y + m[6] * z; + this.y = m[1] * x + m[4] * y + m[7] * z; + this.z = m[2] * x + m[5] * y + m[8] * z; + + return this; }, /** - * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index - * or a Tile object. If you pass in a Tile, all attributes will be copied over to the specified - * location. If you pass in an index, only the index at the specified location will be changed. - * Collision information will be recalculated at the specified location. + * Takes a Matrix4 and applies it to this Vector3. * - * @method Phaser.Tilemaps.TilemapLayer#putTileAt + * @method Phaser.Math.Vector3#applyMatrix4 * @since 3.50.0 * - * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {Phaser.Math.Matrix4} mat4 - The Matrix4 to apply to this Vector3. * - * @return {Phaser.Tilemaps.Tile} The Tile object that was inserted at the given coordinates. + * @return {Phaser.Math.Vector3} This Vector3. */ - putTileAt: function (tile, tileX, tileY, recalculateFaces) + applyMatrix4: function (mat4) { - return TilemapComponents.PutTileAt(tile, tileX, tileY, recalculateFaces, this.layer); + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat4.val; + + var w = 1 / (m[3] * x + m[7] * y + m[11] * z + m[15]); + + this.x = (m[0] * x + m[4] * y + m[8] * z + m[12]) * w; + this.y = (m[1] * x + m[5] * y + m[9] * z + m[13]) * w; + this.z = (m[2] * x + m[6] * y + m[10] * z + m[14]) * w; + + return this; }, /** - * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either - * an index or a Tile object. If you pass in a Tile, all attributes will be copied over to the - * specified location. If you pass in an index, only the index at the specified location will be - * changed. Collision information will be recalculated at the specified location. + * Transform this Vector with the given Matrix. * - * @method Phaser.Tilemaps.TilemapLayer#putTileAtWorldXY - * @since 3.50.0 + * @method Phaser.Math.Vector3#transformMat3 + * @since 3.0.0 * - * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {number} worldX - The x coordinate, in pixels. - * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with. * - * @return {Phaser.Tilemaps.Tile} The Tile object that was inserted at the given coordinates. + * @return {Phaser.Math.Vector3} This Vector3. */ - putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera) + transformMat3: function (mat) { - return TilemapComponents.PutTileAtWorldXY(tile, worldX, worldY, recalculateFaces, camera, this.layer); + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + this.x = x * m[0] + y * m[3] + z * m[6]; + this.y = x * m[1] + y * m[4] + z * m[7]; + this.z = x * m[2] + y * m[5] + z * m[8]; + + return this; }, /** - * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified - * layer. The array can be composed of either tile indexes or Tile objects. If you pass in a Tile, - * all attributes will be copied over to the specified location. If you pass in an index, only the - * index at the specified location will be changed. Collision information will be recalculated - * within the region tiles were changed. + * Transform this Vector with the given Matrix4. * - * @method Phaser.Tilemaps.TilemapLayer#putTilesAt - * @since 3.50.0 + * @method Phaser.Math.Vector3#transformMat4 + * @since 3.0.0 * - * @param {(number[]|number[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector3} This Vector3. */ - putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces) + transformMat4: function (mat) { - TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer); + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + this.x = m[0] * x + m[4] * y + m[8] * z + m[12]; + this.y = m[1] * x + m[5] * y + m[9] * z + m[13]; + this.z = m[2] * x + m[6] * y + m[10] * z + m[14]; return this; }, /** - * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the - * specified layer. Each tile will receive a new index. If an array of indexes is passed in, then - * those will be used for randomly assigning new tile indexes. If an array is not provided, the - * indexes found within the region (excluding -1) will be used for randomly assigning new tile - * indexes. This method only modifies tile indexes and does not change collision information. + * Transforms the coordinates of this Vector3 with the given Matrix4. * - * @method Phaser.Tilemaps.TilemapLayer#randomize - * @since 3.50.0 + * @method Phaser.Math.Vector3#transformCoordinates + * @since 3.0.0 * - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {number[]} [indexes] - An array of indexes to randomly draw from during randomization. + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector3} This Vector3. */ - randomize: function (tileX, tileY, width, height, indexes) + transformCoordinates: function (mat) { - TilemapComponents.Randomize(tileX, tileY, width, height, indexes, this.layer); + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12]; + var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13]; + var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14]; + var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15]; + + this.x = tx / tw; + this.y = ty / tw; + this.z = tz / tw; return this; }, /** - * Removes the tile at the given tile coordinates in the specified layer and updates the layers - * collision information. + * Transform this Vector with the given Quaternion. * - * @method Phaser.Tilemaps.TilemapLayer#removeTileAt - * @since 3.50.0 + * @method Phaser.Math.Vector3#transformQuat + * @since 3.0.0 * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. * - * @return {Phaser.Tilemaps.Tile} A Tile object. + * @return {Phaser.Math.Vector3} This Vector3. */ - removeTileAt: function (tileX, tileY, replaceWithNull, recalculateFaces) + transformQuat: function (q) { - return TilemapComponents.RemoveTileAt(tileX, tileY, replaceWithNull, recalculateFaces, this.layer); + // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations + var x = this.x; + var y = this.y; + var z = this.z; + var qx = q.x; + var qy = q.y; + var qz = q.z; + var qw = q.w; + + // calculate quat * vec + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = -qx * x - qy * y - qz * z; + + // calculate result * inverse quat + this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; + this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; + this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; + + return this; }, /** - * Removes the tile at the given world coordinates in the specified layer and updates the layers - * collision information. - * - * @method Phaser.Tilemaps.TilemapLayer#removeTileAtWorldXY - * @since 3.50.0 + * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, + * e.g. unprojecting a 2D point into 3D space. * - * @param {number} worldX - The x coordinate, in pixels. - * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @method Phaser.Math.Vector3#project + * @since 3.0.0 * - * @return {Phaser.Tilemaps.Tile} The Tile object that was removed from the given location. + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with. + * + * @return {Phaser.Math.Vector3} This Vector3. */ - removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera) + project: function (mat) { - return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, this.layer); + var x = this.x; + var y = this.y; + var z = this.z; + var m = mat.val; + + var a00 = m[0]; + var a01 = m[1]; + var a02 = m[2]; + var a03 = m[3]; + var a10 = m[4]; + var a11 = m[5]; + var a12 = m[6]; + var a13 = m[7]; + var a20 = m[8]; + var a21 = m[9]; + var a22 = m[10]; + var a23 = m[11]; + var a30 = m[12]; + var a31 = m[13]; + var a32 = m[14]; + var a33 = m[15]; + + var lw = 1 / (x * a03 + y * a13 + z * a23 + a33); + + this.x = (x * a00 + y * a10 + z * a20 + a30) * lw; + this.y = (x * a01 + y * a11 + z * a21 + a31) * lw; + this.z = (x * a02 + y * a12 + z * a22 + a32) * lw; + + return this; }, /** - * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to - * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles - * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation - * wherever you want on the screen. + * Multiplies this Vector3 by the given view and projection matrices. * - * @method Phaser.Tilemaps.TilemapLayer#renderDebug + * @method Phaser.Math.Vector3#projectViewMatrix * @since 3.50.0 * - * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {Phaser.Types.Tilemaps.StyleConfig} [styleConfig] - An object specifying the colors to use for the debug drawing. + * @param {Phaser.Math.Matrix4} viewMatrix - A View Matrix. + * @param {Phaser.Math.Matrix4} projectionMatrix - A Projection Matrix. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector3} This Vector3. */ - renderDebug: function (graphics, styleConfig) + projectViewMatrix: function (viewMatrix, projectionMatrix) { - TilemapComponents.RenderDebug(graphics, styleConfig, this.layer); - - return this; + return this.applyMatrix4(viewMatrix).applyMatrix4(projectionMatrix); }, /** - * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching - * `findIndex` and updates their index to match `newIndex`. This only modifies the index and does - * not change collision information. + * Multiplies this Vector3 by the given inversed projection matrix and world matrix. * - * @method Phaser.Tilemaps.TilemapLayer#replaceByIndex + * @method Phaser.Math.Vector3#unprojectViewMatrix * @since 3.50.0 * - * @param {number} findIndex - The index of the tile to search for. - * @param {number} newIndex - The index of the tile to replace it with. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Math.Matrix4} projectionMatrix - An inversed Projection Matrix. + * @param {Phaser.Math.Matrix4} worldMatrix - A World View Matrix. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector3} This Vector3. */ - replaceByIndex: function (findIndex, newIndex, tileX, tileY, width, height) + unprojectViewMatrix: function (projectionMatrix, worldMatrix) { - TilemapComponents.ReplaceByIndex(findIndex, newIndex, tileX, tileY, width, height, this.layer); - - return this; + return this.applyMatrix4(projectionMatrix).applyMatrix4(worldMatrix); }, /** - * You can control if the Cameras should cull tiles before rendering them or not. - * - * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. + * Unproject this point from 2D space to 3D space. + * The point should have its x and y properties set to + * 2D screen space, and the z either at 0 (near plane) + * or 1 (far plane). The provided matrix is assumed to already + * be combined, i.e. projection * view * model. * - * However, there are some instances when you may wish to disable this. + * After this operation, this vector's (x, y, z) components will + * represent the unprojected 3D coordinate. * - * @method Phaser.Tilemaps.TilemapLayer#setSkipCull - * @since 3.50.0 + * @method Phaser.Math.Vector3#unproject + * @since 3.0.0 * - * @param {boolean} [value=true] - Set to `true` to stop culling tiles. Set to `false` to enable culling again. + * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels. + * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector3} This Vector3. */ - setSkipCull: function (value) + unproject: function (viewport, invProjectionView) { - if (value === undefined) { value = true; } + var viewX = viewport.x; + var viewY = viewport.y; + var viewWidth = viewport.z; + var viewHeight = viewport.w; - this.skipCull = value; + var x = this.x - viewX; + var y = (viewHeight - this.y - 1) - viewY; + var z = this.z; - return this; + this.x = (2 * x) / viewWidth - 1; + this.y = (2 * y) / viewHeight - 1; + this.z = 2 * z - 1; + + return this.project(invProjectionView); }, /** - * When a Camera culls the tiles in this layer it does so using its view into the world, building up a - * rectangle inside which the tiles must exist or they will be culled. Sometimes you may need to expand the size - * of this 'cull rectangle', especially if you plan on rotating the Camera viewing the layer. Do so - * by providing the padding values. The values given are in tiles, not pixels. So if the tile width was 32px - * and you set `paddingX` to be 4, it would add 32px x 4 to the cull rectangle (adjusted for scale) - * - * @method Phaser.Tilemaps.TilemapLayer#setCullPadding - * @since 3.50.0 + * Make this Vector the zero vector (0, 0, 0). * - * @param {number} [paddingX=1] - The amount of extra horizontal tiles to add to the cull check padding. - * @param {number} [paddingY=1] - The amount of extra vertical tiles to add to the cull check padding. + * @method Phaser.Math.Vector3#reset + * @since 3.0.0 * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector3} This Vector3. */ - setCullPadding: function (paddingX, paddingY) + reset: function () { - if (paddingX === undefined) { paddingX = 1; } - if (paddingY === undefined) { paddingY = 1; } - - this.cullPaddingX = paddingX; - this.cullPaddingY = paddingY; + this.x = 0; + this.y = 0; + this.z = 0; return this; + } + +}); + +/** + * A static zero Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ZERO + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ZERO = new Vector3(); + +/** + * A static right Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.RIGHT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.RIGHT = new Vector3(1, 0, 0); + +/** + * A static left Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.LEFT + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.LEFT = new Vector3(-1, 0, 0); + +/** + * A static up Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.UP + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.UP = new Vector3(0, -1, 0); + +/** + * A static down Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.DOWN + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.DOWN = new Vector3(0, 1, 0); + +/** + * A static forward Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.FORWARD + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.FORWARD = new Vector3(0, 0, 1); + +/** + * A static back Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.BACK + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.BACK = new Vector3(0, 0, -1); + +/** + * A static one Vector3 for use by reference. + * + * This constant is meant for comparison operations and should not be modified directly. + * + * @constant + * @name Phaser.Math.Vector3.ONE + * @type {Phaser.Math.Vector3} + * @since 3.16.0 + */ +Vector3.ONE = new Vector3(1, 1, 1); + +module.exports = Vector3; + + +/***/ }), + +/***/ 51729: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji +// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl + +var Class = __webpack_require__(56694); + +/** + * @classdesc + * A representation of a vector in 4D space. + * + * A four-component vector. + * + * @class Vector4 + * @memberof Phaser.Math + * @constructor + * @since 3.0.0 + * + * @param {number} [x] - The x component. + * @param {number} [y] - The y component. + * @param {number} [z] - The z component. + * @param {number} [w] - The w component. + */ +var Vector4 = new Class({ + + initialize: + + function Vector4 (x, y, z, w) + { + /** + * The x component of this Vector. + * + * @name Phaser.Math.Vector4#x + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.x = 0; + + /** + * The y component of this Vector. + * + * @name Phaser.Math.Vector4#y + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.y = 0; + + /** + * The z component of this Vector. + * + * @name Phaser.Math.Vector4#z + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.z = 0; + + /** + * The w component of this Vector. + * + * @name Phaser.Math.Vector4#w + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.w = 0; + + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + this.w = x.w || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = w || 0; + } }, /** - * Sets collision on the given tile or tiles within a layer by index. You can pass in either a - * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if - * collision will be enabled (true) or disabled (false). - * - * @method Phaser.Tilemaps.TilemapLayer#setCollision - * @since 3.50.0 + * Make a clone of this Vector4. * - * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. - * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. + * @method Phaser.Math.Vector4#clone + * @since 3.0.0 * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector4} A clone of this Vector4. */ - setCollision: function (indexes, collides, recalculateFaces, updateLayer) + clone: function () { - TilemapComponents.SetCollision(indexes, collides, recalculateFaces, this.layer, updateLayer); - - return this; + return new Vector4(this.x, this.y, this.z, this.w); }, /** - * Sets collision on a range of tiles in a layer whose index is between the specified `start` and - * `stop` (inclusive). Calling this with a start value of 10 and a stop value of 14 would set - * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be - * enabled (true) or disabled (false). + * Copy the components of a given Vector into this Vector. * - * @method Phaser.Tilemaps.TilemapLayer#setCollisionBetween - * @since 3.50.0 + * @method Phaser.Math.Vector4#copy + * @since 3.0.0 * - * @param {number} start - The first index of the tile to be set for collision. - * @param {number} stop - The last index of the tile to be set for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {Phaser.Math.Vector4} src - The Vector to copy the components from. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector4} This Vector4. */ - setCollisionBetween: function (start, stop, collides, recalculateFaces) + copy: function (src) { - TilemapComponents.SetCollisionBetween(start, stop, collides, recalculateFaces, this.layer); + this.x = src.x; + this.y = src.y; + this.z = src.z || 0; + this.w = src.w || 0; return this; }, /** - * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property - * that matches the given properties object, its collision flag will be set. The `collides` - * parameter controls if collision will be enabled (true) or disabled (false). Passing in - * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that - * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can - * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a - * "types" property that matches any of those values, its collision flag will be updated. + * Check whether this Vector is equal to a given Vector. * - * @method Phaser.Tilemaps.TilemapLayer#setCollisionByProperty - * @since 3.50.0 + * Performs a strict quality check against each Vector's components. * - * @param {object} properties - An object with tile properties and corresponding values that should be checked. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @method Phaser.Math.Vector4#equals + * @since 3.0.0 * - * @return {this} This Tilemap Layer object. + * @param {Phaser.Math.Vector4} v - The vector to check equality with. + * + * @return {boolean} A boolean indicating whether the two Vectors are equal or not. */ - setCollisionByProperty: function (properties, collides, recalculateFaces) + equals: function (v) { - TilemapComponents.SetCollisionByProperty(properties, collides, recalculateFaces, this.layer); - - return this; + return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z) && (this.w === v.w)); }, /** - * Sets collision on all tiles in the given layer, except for tiles that have an index specified in - * the given array. The `collides` parameter controls if collision will be enabled (true) or - * disabled (false). Tile indexes not currently in the layer are not affected. + * Set the `x`, `y`, `z` and `w` components of the this Vector to the given `x`, `y`, `z` and `w` values. * - * @method Phaser.Tilemaps.TilemapLayer#setCollisionByExclusion - * @since 3.50.0 + * @method Phaser.Math.Vector4#set + * @since 3.0.0 * - * @param {number[]} indexes - An array of the tile indexes to not be counted for collision. - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y, z and w components. + * @param {number} y - The y value to set for this Vector. + * @param {number} z - The z value to set for this Vector. + * @param {number} w - The z value to set for this Vector. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector4} This Vector4. */ - setCollisionByExclusion: function (indexes, collides, recalculateFaces) + set: function (x, y, z, w) { - TilemapComponents.SetCollisionByExclusion(indexes, collides, recalculateFaces, this.layer); + if (typeof x === 'object') + { + this.x = x.x || 0; + this.y = x.y || 0; + this.z = x.z || 0; + this.w = x.w || 0; + } + else + { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = w || 0; + } return this; }, /** - * Sets collision on the tiles within a layer by checking each tiles collision group data - * (typically defined in Tiled within the tileset collision editor). If any objects are found within - * a tiles collision group, the tile's colliding information will be set. The `collides` parameter - * controls if collision will be enabled (true) or disabled (false). + * Add a given Vector to this Vector. Addition is component-wise. * - * @method Phaser.Tilemaps.TilemapLayer#setCollisionFromCollisionGroup - * @since 3.50.0 + * @method Phaser.Math.Vector4#add + * @since 3.0.0 * - * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. - * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to add to this Vector. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector4} This Vector4. */ - setCollisionFromCollisionGroup: function (collides, recalculateFaces) + add: function (v) { - TilemapComponents.SetCollisionFromCollisionGroup(collides, recalculateFaces, this.layer); + this.x += v.x; + this.y += v.y; + this.z += v.z || 0; + this.w += v.w || 0; return this; }, /** - * Sets a global collision callback for the given tile index within the layer. This will affect all - * tiles on this layer that have the same index. If a callback is already set for the tile index it - * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile - * at a specific location on the map then see setTileLocationCallback. + * Subtract the given Vector from this Vector. Subtraction is component-wise. * - * @method Phaser.Tilemaps.TilemapLayer#setTileIndexCallback - * @since 3.50.0 + * @method Phaser.Math.Vector4#subtract + * @since 3.0.0 * - * @param {(number|number[])} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. - * @param {function} callback - The callback that will be invoked when the tile is collided with. - * @param {object} callbackContext - The context under which the callback is called. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to subtract from this Vector. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector4} This Vector4. */ - setTileIndexCallback: function (indexes, callback, callbackContext) + subtract: function (v) { - TilemapComponents.SetTileIndexCallback(indexes, callback, callbackContext, this.layer); + this.x -= v.x; + this.y -= v.y; + this.z -= v.z || 0; + this.w -= v.w || 0; return this; }, /** - * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. - * If a callback is already set for the tile index it will be replaced. Set the callback to null to - * remove it. + * Scale this Vector by the given value. * - * @method Phaser.Tilemaps.TilemapLayer#setTileLocationCallback - * @since 3.50.0 + * @method Phaser.Math.Vector4#scale + * @since 3.0.0 * - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. - * @param {function} [callback] - The callback that will be invoked when the tile is collided with. - * @param {object} [callbackContext] - The context, or scope, under which the callback is invoked. + * @param {number} scale - The value to scale this Vector by. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector4} This Vector4. */ - setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext) + scale: function (scale) { - TilemapComponents.SetTileLocationCallback(tileX, tileY, width, height, callback, callbackContext, this.layer); + this.x *= scale; + this.y *= scale; + this.z *= scale; + this.w *= scale; return this; }, /** - * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given - * layer. It will only randomize the tiles in that area, so if they're all the same nothing will - * appear to have changed! This method only modifies tile indexes and does not change collision - * information. + * Calculate the length (or magnitude) of this Vector. * - * @method Phaser.Tilemaps.TilemapLayer#shuffle - * @since 3.50.0 + * @method Phaser.Math.Vector4#length + * @since 3.0.0 * - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @return {number} The length of this Vector. + */ + length: function () + { + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + + return Math.sqrt(x * x + y * y + z * z + w * w); + }, + + /** + * Calculate the length of this Vector squared. * - * @return {this} This Tilemap Layer object. + * @method Phaser.Math.Vector4#lengthSq + * @since 3.0.0 + * + * @return {number} The length of this Vector, squared. */ - shuffle: function (tileX, tileY, width, height) + lengthSq: function () { - TilemapComponents.Shuffle(tileX, tileY, width, height, this.layer); + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; - return this; + return x * x + y * y + z * z + w * w; }, /** - * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching - * `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision - * information. + * Normalize this Vector. * - * @method Phaser.Tilemaps.TilemapLayer#swapByIndex - * @since 3.50.0 + * Makes the vector a unit length vector (magnitude of 1) in the same direction. * - * @param {number} tileA - First tile index. - * @param {number} tileB - Second tile index. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @method Phaser.Math.Vector4#normalize + * @since 3.0.0 * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector4} This Vector4. */ - swapByIndex: function (indexA, indexB, tileX, tileY, width, height) + normalize: function () { - TilemapComponents.SwapByIndex(indexA, indexB, tileX, tileY, width, height, this.layer); + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + var len = x * x + y * y + z * z + w * w; + + if (len > 0) + { + len = 1 / Math.sqrt(len); + + this.x = x * len; + this.y = y * len; + this.z = z * len; + this.w = w * len; + } return this; }, /** - * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the - * layers position, scale and scroll. + * Calculate the dot product of this Vector and the given Vector. * - * @method Phaser.Tilemaps.TilemapLayer#tileToWorldX - * @since 3.50.0 + * @method Phaser.Math.Vector4#dot + * @since 3.0.0 * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Math.Vector4} v - The Vector4 to dot product with this Vector4. * - * @return {number} The Tile X coordinate converted to pixels. + * @return {number} The dot product of this Vector and the given Vector. */ - tileToWorldX: function (tileX, camera) + dot: function (v) { - return this.tilemap.tileToWorldX(tileX, camera, this); + return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; }, /** - * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the - * layers position, scale and scroll. + * Linearly interpolate between this Vector and the given Vector. * - * @method Phaser.Tilemaps.TilemapLayer#tileToWorldY - * @since 3.50.0 + * Interpolates this Vector towards the given Vector. * - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @method Phaser.Math.Vector4#lerp + * @since 3.0.0 * - * @return {number} The Tile Y coordinate converted to pixels. + * @param {Phaser.Math.Vector4} v - The Vector4 to interpolate towards. + * @param {number} [t=0] - The interpolation percentage, between 0 and 1. + * + * @return {Phaser.Math.Vector4} This Vector4. */ - tileToWorldY: function (tileY, camera) + lerp: function (v, t) { - return this.tilemap.tileToWorldY(tileY, camera, this); + if (t === undefined) { t = 0; } + + var ax = this.x; + var ay = this.y; + var az = this.z; + var aw = this.w; + + this.x = ax + t * (v.x - ax); + this.y = ay + t * (v.y - ay); + this.z = az + t * (v.z - az); + this.w = aw + t * (v.w - aw); + + return this; }, /** - * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the - * layers position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. + * Perform a component-wise multiplication between this Vector and the given Vector. * - * @method Phaser.Tilemaps.TilemapLayer#tileToWorldXY - * @since 3.50.0 + * Multiplies this Vector by the given Vector. * - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @method Phaser.Math.Vector4#multiply + * @since 3.0.0 * - * @return {Phaser.Math.Vector2} A Vector2 containing the world coordinates of the Tile. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to multiply this Vector by. + * + * @return {Phaser.Math.Vector4} This Vector4. */ - tileToWorldXY: function (tileX, tileY, point, camera) + multiply: function (v) { - return this.tilemap.tileToWorldXY(tileX, tileY, point, camera, this); + this.x *= v.x; + this.y *= v.y; + this.z *= v.z || 1; + this.w *= v.w || 1; + + return this; }, /** - * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the - * specified layer. Each tile will receive a new index. New indexes are drawn from the given - * weightedIndexes array. An example weighted array: - * - * [ - * { index: 6, weight: 4 }, // Probability of index 6 is 4 / 8 - * { index: 7, weight: 2 }, // Probability of index 7 would be 2 / 8 - * { index: 8, weight: 1.5 }, // Probability of index 8 would be 1.5 / 8 - * { index: 26, weight: 0.5 } // Probability of index 27 would be 0.5 / 8 - * ] + * Perform a component-wise division between this Vector and the given Vector. * - * The probability of any index being choose is (the index's weight) / (sum of all weights). This - * method only modifies tile indexes and does not change collision information. + * Divides this Vector by the given Vector. * - * @method Phaser.Tilemaps.TilemapLayer#weightedRandomize - * @since 3.50.0 + * @method Phaser.Math.Vector4#divide + * @since 3.0.0 * - * @param {object[]} weightedIndexes - An array of objects to randomly draw from during randomization. They should be in the form: { index: 0, weight: 4 } or { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. - * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. - * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to divide this Vector by. * - * @return {this} This Tilemap Layer object. + * @return {Phaser.Math.Vector4} This Vector4. */ - weightedRandomize: function (weightedIndexes, tileX, tileY, width, height) + divide: function (v) { - TilemapComponents.WeightedRandomize(tileX, tileY, width, height, weightedIndexes, this.layer); + this.x /= v.x; + this.y /= v.y; + this.z /= v.z || 1; + this.w /= v.w || 1; return this; }, /** - * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the - * layers position, scale and scroll. + * Calculate the distance between this Vector and the given Vector. * - * @method Phaser.Tilemaps.TilemapLayer#worldToTileX - * @since 3.50.0 + * @method Phaser.Math.Vector4#distance + * @since 3.0.0 * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. * - * @return {number} The tile X coordinate based on the world value. + * @return {number} The distance from this Vector to the given Vector. */ - worldToTileX: function (worldX, snapToFloor, camera) + distance: function (v) { - return this.tilemap.worldToTileX(worldX, snapToFloor, camera, this); + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + var dw = v.w - this.w || 0; + + return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw); }, /** - * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the - * layers position, scale and scroll. + * Calculate the distance between this Vector and the given Vector, squared. * - * @method Phaser.Tilemaps.TilemapLayer#worldToTileY - * @since 3.50.0 + * @method Phaser.Math.Vector4#distanceSq + * @since 3.0.0 * - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3|Phaser.Math.Vector4)} v - The Vector to calculate the distance to. * - * @return {number} The tile Y coordinate based on the world value. + * @return {number} The distance from this Vector to the given Vector, squared. */ - worldToTileY: function (worldY, snapToFloor, camera) + distanceSq: function (v) { - return this.tilemap.worldToTileY(worldY, snapToFloor, camera, this); + var dx = v.x - this.x; + var dy = v.y - this.y; + var dz = v.z - this.z || 0; + var dw = v.w - this.w || 0; + + return dx * dx + dy * dy + dz * dz + dw * dw; }, /** - * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the - * layers position, scale and scroll. This will return a new Vector2 object or update the given - * `point` object. - * - * @method Phaser.Tilemaps.TilemapLayer#worldToTileXY - * @since 3.50.0 + * Negate the `x`, `y`, `z` and `w` components of this Vector. * - * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. - * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. - * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. - * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. - * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @method Phaser.Math.Vector4#negate + * @since 3.0.0 * - * @return {Phaser.Math.Vector2} A Vector2 containing the tile coordinates of the world values. + * @return {Phaser.Math.Vector4} This Vector4. */ - worldToTileXY: function (worldX, worldY, snapToFloor, point, camera) + negate: function () { - return this.tilemap.worldToTileXY(worldX, worldY, snapToFloor, point, camera, this); + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + this.w = -this.w; + + return this; }, /** - * Destroys this TilemapLayer and removes its link to the associated LayerData. + * Transform this Vector with the given Matrix. * - * @method Phaser.Tilemaps.TilemapLayer#destroy - * @since 3.50.0 + * @method Phaser.Math.Vector4#transformMat4 + * @since 3.0.0 * - * @param {boolean} [removeFromTilemap=true] - Remove this layer from the parent Tilemap? + * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector4 with. + * + * @return {Phaser.Math.Vector4} This Vector4. */ - destroy: function (removeFromTilemap) + transformMat4: function (mat) { - if (removeFromTilemap === undefined) { removeFromTilemap = true; } + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + var m = mat.val; - if (!this.tilemap) - { - // Abort, we've already been destroyed - return; - } + this.x = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + this.y = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + this.z = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + this.w = m[3] * x + m[7] * y + m[11] * z + m[15] * w; - // Uninstall this layer only if it is still installed on the LayerData object - if (this.layer.tilemapLayer === this) - { - this.layer.tilemapLayer = undefined; - } + return this; + }, - if (removeFromTilemap) - { - this.tilemap.removeLayer(this); - } + /** + * Transform this Vector with the given Quaternion. + * + * @method Phaser.Math.Vector4#transformQuat + * @since 3.0.0 + * + * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with. + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + transformQuat: function (q) + { + var x = this.x; + var y = this.y; + var z = this.z; + var qx = q.x; + var qy = q.y; + var qz = q.z; + var qw = q.w; - this.tilemap = undefined; - this.layer = undefined; - this.culledTiles.length = 0; - this.cullCallback = null; + // calculate quat * vec + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = -qx * x - qy * y - qz * z; - this.gidMap = []; - this.tileset = []; + // calculate result * inverse quat + this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; + this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; + this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; - GameObject.prototype.destroy.call(this); + return this; + }, + + /** + * Make this Vector the zero vector (0, 0, 0, 0). + * + * @method Phaser.Math.Vector4#reset + * @since 3.0.0 + * + * @return {Phaser.Math.Vector4} This Vector4. + */ + reset: function () + { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 0; + + return this; } }); -module.exports = TilemapLayer; +Vector4.prototype.sub = Vector4.prototype.subtract; +Vector4.prototype.mul = Vector4.prototype.multiply; +Vector4.prototype.div = Vector4.prototype.divide; +Vector4.prototype.dist = Vector4.prototype.distance; +Vector4.prototype.distSq = Vector4.prototype.distanceSq; +Vector4.prototype.len = Vector4.prototype.length; +Vector4.prototype.lenSq = Vector4.prototype.lengthSq; + +module.exports = Vector4; /***/ }), -/* 582 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 9557: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); - /** - * @classdesc - * A Timer Event represents a delayed function call. It's managed by a Scene's {@link Clock} and will call its function after a set amount of time has passed. The Timer Event can optionally repeat - i.e. call its function multiple times before finishing, or loop indefinitely. - * - * Because it's managed by a Clock, a Timer Event is based on game time, will be affected by its Clock's time scale, and will pause if its Clock pauses. + * Checks if the two values are within the given `tolerance` of each other. * - * @class TimerEvent - * @memberof Phaser.Time - * @constructor + * @function Phaser.Math.Within * @since 3.0.0 * - * @param {Phaser.Types.Time.TimerEventConfig} config - The configuration for the Timer Event, including its delay and callback. + * @param {number} a - The first value to use in the calculation. + * @param {number} b - The second value to use in the calculation. + * @param {number} tolerance - The tolerance. Anything equal to or less than this value is considered as being within range. + * + * @return {boolean} Returns `true` if `a` is less than or equal to the tolerance of `b`. */ -var TimerEvent = new Class({ +var Within = function (a, b, tolerance) +{ + return (Math.abs(a - b) <= tolerance); +}; - initialize: +module.exports = Within; - function TimerEvent (config) - { - /** - * The delay in ms at which this TimerEvent fires. - * - * @name Phaser.Time.TimerEvent#delay - * @type {number} - * @default 0 - * @readonly - * @since 3.0.0 - */ - this.delay = 0; - /** - * The total number of times this TimerEvent will repeat before finishing. - * - * @name Phaser.Time.TimerEvent#repeat - * @type {number} - * @default 0 - * @readonly - * @since 3.0.0 - */ - this.repeat = 0; +/***/ }), - /** - * If repeating this contains the current repeat count. - * - * @name Phaser.Time.TimerEvent#repeatCount - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.repeatCount = 0; +/***/ 1071: +/***/ ((module) => { - /** - * True if this TimerEvent loops, otherwise false. - * - * @name Phaser.Time.TimerEvent#loop - * @type {boolean} - * @default false - * @readonly - * @since 3.0.0 - */ - this.loop = false; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The callback that will be called when the TimerEvent occurs. - * - * @name Phaser.Time.TimerEvent#callback - * @type {function} - * @since 3.0.0 - */ - this.callback; +/** + * Wrap the given `value` between `min` and `max`. + * + * @function Phaser.Math.Wrap + * @since 3.0.0 + * + * @param {number} value - The value to wrap. + * @param {number} min - The minimum value. + * @param {number} max - The maximum value. + * + * @return {number} The wrapped value. + */ +var Wrap = function (value, min, max) +{ + if (value >= min && value <= max) + { + // Skip modulo if already in range + return value; + } - /** - * The scope in which the callback will be called. - * - * @name Phaser.Time.TimerEvent#callbackScope - * @type {object} - * @since 3.0.0 - */ - this.callbackScope; + var range = max - min; - /** - * Additional arguments to be passed to the callback. - * - * @name Phaser.Time.TimerEvent#args - * @type {array} - * @since 3.0.0 - */ - this.args; + return (min + ((((value - min) % range) + range) % range)); +}; - /** - * Scale the time causing this TimerEvent to update. - * - * @name Phaser.Time.TimerEvent#timeScale - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.timeScale = 1; +module.exports = Wrap; - /** - * Start this many MS into the elapsed (useful if you want a long duration with repeat, but for the first loop to fire quickly) - * - * @name Phaser.Time.TimerEvent#startAt - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.startAt = 0; - /** - * The time in milliseconds which has elapsed since the Timer Event's creation. - * - * This value is local for the Timer Event and is relative to its Clock. As such, it's influenced by the Clock's time scale and paused state, the Timer Event's initial {@link #startAt} property, and the Timer Event's {@link #timeScale} and {@link #paused} state. - * - * @name Phaser.Time.TimerEvent#elapsed - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.elapsed = 0; +/***/ }), - /** - * Whether or not this timer is paused. - * - * @name Phaser.Time.TimerEvent#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; +/***/ 90447: +/***/ ((module) => { - /** - * Whether the Timer Event's function has been called. - * - * When the Timer Event fires, this property will be set to `true` before the callback function is invoked and will be reset immediately afterward if the Timer Event should repeat. The value of this property does not directly influence whether the Timer Event will be removed from its Clock, but can prevent it from firing. - * - * @name Phaser.Time.TimerEvent#hasDispatched - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.hasDispatched = false; - - this.reset(config); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Completely reinitializes the Timer Event, regardless of its current state, according to a configuration object. - * - * @method Phaser.Time.TimerEvent#reset - * @since 3.0.0 - * - * @param {Phaser.Types.Time.TimerEventConfig} config - The new state for the Timer Event. - * - * @return {Phaser.Time.TimerEvent} This TimerEvent object. - */ - reset: function (config) - { - this.delay = GetFastValue(config, 'delay', 0); +/** + * Find the angle of a segment from (x1, y1) -> (x2, y2). + * + * @function Phaser.Math.Angle.Between + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The angle in radians. + */ +var Between = function (x1, y1, x2, y2) +{ + return Math.atan2(y2 - y1, x2 - x1); +}; - // Can also be set to -1 for an infinite loop (same as setting loop: true) - this.repeat = GetFastValue(config, 'repeat', 0); +module.exports = Between; - this.loop = GetFastValue(config, 'loop', false); - this.callback = GetFastValue(config, 'callback', undefined); +/***/ }), - this.callbackScope = GetFastValue(config, 'callbackScope', this.callback); +/***/ 94240: +/***/ ((module) => { - this.args = GetFastValue(config, 'args', []); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.timeScale = GetFastValue(config, 'timeScale', 1); +/** + * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). + * + * Calculates the angle of the vector from the first point to the second point. + * + * @function Phaser.Math.Angle.BetweenPoints + * @since 3.0.0 + * + * @param {Phaser.Types.Math.Vector2Like} point1 - The first point. + * @param {Phaser.Types.Math.Vector2Like} point2 - The second point. + * + * @return {number} The angle in radians. + */ +var BetweenPoints = function (point1, point2) +{ + return Math.atan2(point2.y - point1.y, point2.x - point1.x); +}; - this.startAt = GetFastValue(config, 'startAt', 0); +module.exports = BetweenPoints; - this.paused = GetFastValue(config, 'paused', false); - this.elapsed = this.startAt; - this.hasDispatched = false; - this.repeatCount = (this.repeat === -1 || this.loop) ? 999999999999 : this.repeat; +/***/ }), - return this; - }, +/***/ 84066: +/***/ ((module) => { - /** - * Gets the progress of the current iteration, not factoring in repeats. - * - * @method Phaser.Time.TimerEvent#getProgress - * @since 3.0.0 - * - * @return {number} A number between 0 and 1 representing the current progress. - */ - getProgress: function () - { - return (this.elapsed / this.delay); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Gets the progress of the timer overall, factoring in repeats. - * - * @method Phaser.Time.TimerEvent#getOverallProgress - * @since 3.0.0 - * - * @return {number} The overall progress of the Timer Event, between 0 and 1. - */ - getOverallProgress: function () - { - if (this.repeat > 0) - { - var totalDuration = this.delay + (this.delay * this.repeat); - var totalElapsed = this.elapsed + (this.delay * (this.repeat - this.repeatCount)); +/** + * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). + * + * The difference between this method and {@link Phaser.Math.Angle.BetweenPoints} is that this assumes the y coordinate + * travels down the screen. + * + * @function Phaser.Math.Angle.BetweenPointsY + * @since 3.0.0 + * + * @param {Phaser.Types.Math.Vector2Like} point1 - The first point. + * @param {Phaser.Types.Math.Vector2Like} point2 - The second point. + * + * @return {number} The angle in radians. + */ +var BetweenPointsY = function (point1, point2) +{ + return Math.atan2(point2.x - point1.x, point2.y - point1.y); +}; - return (totalElapsed / totalDuration); - } - else - { - return this.getProgress(); - } - }, +module.exports = BetweenPointsY; - /** - * Returns the number of times this Timer Event will repeat before finishing. - * - * This should not be confused with the number of times the Timer Event will fire before finishing. A return value of 0 doesn't indicate that the Timer Event has finished running - it indicates that it will not repeat after the next time it fires. - * - * @method Phaser.Time.TimerEvent#getRepeatCount - * @since 3.0.0 - * - * @return {number} How many times the Timer Event will repeat. - */ - getRepeatCount: function () - { - return this.repeatCount; - }, - /** - * Returns the local elapsed time for the current iteration of the Timer Event. - * - * @method Phaser.Time.TimerEvent#getElapsed - * @since 3.0.0 - * - * @return {number} The local elapsed time in milliseconds. - */ - getElapsed: function () - { - return this.elapsed; - }, +/***/ }), - /** - * Returns the local elapsed time for the current iteration of the Timer Event in seconds. - * - * @method Phaser.Time.TimerEvent#getElapsedSeconds - * @since 3.0.0 - * - * @return {number} The local elapsed time in seconds. - */ - getElapsedSeconds: function () - { - return this.elapsed * 0.001; - }, +/***/ 9678: +/***/ ((module) => { - /** - * Returns the time interval until the next iteration of the Timer Event. - * - * @method Phaser.Time.TimerEvent#getRemaining - * @since 3.50.0 - * - * @return {number} The time interval in milliseconds. - */ - getRemaining: function () - { - return this.delay - this.elapsed; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Returns the time interval until the next iteration of the Timer Event in seconds. - * - * @method Phaser.Time.TimerEvent#getRemainingSeconds - * @since 3.50.0 - * - * @return {number} The time interval in seconds. - */ - getRemainingSeconds: function () - { - return this.getRemaining() * 0.001; - }, +/** + * Find the angle of a segment from (x1, y1) -> (x2, y2). + * + * The difference between this method and {@link Phaser.Math.Angle.Between} is that this assumes the y coordinate + * travels down the screen. + * + * @function Phaser.Math.Angle.BetweenY + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The angle in radians. + */ +var BetweenY = function (x1, y1, x2, y2) +{ + return Math.atan2(x2 - x1, y2 - y1); +}; - /** - * Returns the time interval until the last iteration of the Timer Event. - * - * @method Phaser.Time.TimerEvent#getOverallRemaining - * @since 3.50.0 - * - * @return {number} The time interval in milliseconds. - */ - getOverallRemaining: function () - { - return this.delay * (1 + this.repeatCount) - this.elapsed; - }, +module.exports = BetweenY; - /** - * Returns the time interval until the last iteration of the Timer Event in seconds. - * - * @method Phaser.Time.TimerEvent#getOverallRemainingSeconds - * @since 3.50.0 - * - * @return {number} The time interval in seconds. - */ - getOverallRemainingSeconds: function () - { - return this.getOverallRemaining() * 0.001; - }, - /** - * Forces the Timer Event to immediately expire, thus scheduling its removal in the next frame. - * - * @method Phaser.Time.TimerEvent#remove - * @since 3.0.0 - * - * @param {boolean} [dispatchCallback=false] - If `true`, the function of the Timer Event will be called before its removal. - */ - remove: function (dispatchCallback) - { - if (dispatchCallback === undefined) { dispatchCallback = false; } +/***/ }), - this.elapsed = this.delay; +/***/ 76861: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.hasDispatched = !dispatchCallback; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.repeatCount = 0; - }, +var CONST = __webpack_require__(83392); - /** - * Destroys all object references in the Timer Event, i.e. its callback, scope, and arguments. - * - * Normally, this method is only called by the Clock when it shuts down. As such, it doesn't stop the Timer Event. If called manually, the Timer Event will still be updated by the Clock, but it won't do anything when it fires. - * - * @method Phaser.Time.TimerEvent#destroy - * @since 3.0.0 - */ - destroy: function () +/** + * Takes an angle in Phasers default clockwise format and converts it so that + * 0 is North, 90 is West, 180 is South and 270 is East, + * therefore running counter-clockwise instead of clockwise. + * + * You can pass in the angle from a Game Object using: + * + * ```javascript + * var converted = CounterClockwise(gameobject.rotation); + * ``` + * + * All values for this function are in radians. + * + * @function Phaser.Math.Angle.CounterClockwise + * @since 3.16.0 + * + * @param {number} angle - The angle to convert, in radians. + * + * @return {number} The converted angle, in radians. + */ +var CounterClockwise = function (angle) +{ + if (angle > Math.PI) { - this.callback = undefined; - this.callbackScope = undefined; - this.args = []; + angle -= CONST.PI2; } -}); + return Math.abs((((angle + CONST.TAU) % CONST.PI2) - CONST.PI2) % CONST.PI2); +}; -module.exports = TimerEvent; +module.exports = CounterClockwise; /***/ }), -/* 583 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 37570: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RESERVED = __webpack_require__(1465); - /** - * Internal function used by the Tween Builder to return an array of properties - * that the Tween will be operating on. It takes a tween configuration object - * and then checks that none of the `props` entries start with an underscore, or that - * none of the direct properties are on the Reserved list. + * Normalize an angle to the [0, 2pi] range. * - * @function Phaser.Tweens.Builders.GetProps + * @function Phaser.Math.Angle.Normalize * @since 3.0.0 * - * @param {Phaser.Types.Tweens.TweenBuilderConfig} config - The configuration object of the Tween to get the properties from. + * @param {number} angle - The angle to normalize, in radians. * - * @return {string[]} An array of all the properties the tween will operate on. + * @return {number} The normalized angle, in radians. */ -var GetProps = function (config) +var Normalize = function (angle) { - var key; - var keys = []; - - // First see if we have a props object + angle = angle % (2 * Math.PI); - if (config.hasOwnProperty('props')) + if (angle >= 0) { - for (key in config.props) - { - // Skip any property that starts with an underscore - if (key.substr(0, 1) !== '_') - { - keys.push({ key: key, value: config.props[key] }); - } - } + return angle; } else { - for (key in config) - { - // Skip any property that is in the ReservedProps list or that starts with an underscore - if (RESERVED.indexOf(key) === -1 && key.substr(0, 1) !== '_') - { - keys.push({ key: key, value: config[key] }); - } - } + return angle + 2 * Math.PI; } - - return keys; }; -module.exports = GetProps; +module.exports = Normalize; /***/ }), -/* 584 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 87597: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author @samme + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetValue = __webpack_require__(6); +var FloatBetween = __webpack_require__(61616); /** - * Internal function used by the Timeline Builder. - * - * It returns an array of all tweens in the given timeline config. + * Returns a random angle in the range [-pi, pi]. * - * @function Phaser.Tweens.Builders.GetTweens - * @since 3.0.0 + * @function Phaser.Math.Angle.Random + * @since 3.23.0 + * + * @return {number} The angle, in radians. + */ +var Random = function () +{ + return FloatBetween(-Math.PI, Math.PI); +}; + +module.exports = Random; + + +/***/ }), + +/***/ 74493: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @author @samme + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var FloatBetween = __webpack_require__(61616); + +/** + * Returns a random angle in the range [-180, 180]. * - * @param {Phaser.Types.Tweens.TimelineBuilderConfig} config - The configuration object for the Timeline. + * @function Phaser.Math.Angle.RandomDegrees + * @since 3.23.0 * - * @return {Phaser.Tweens.Tween[]} An array of Tween instances that the Timeline will manage. + * @return {number} The angle, in degrees. */ -var GetTweens = function (config) +var RandomDegrees = function () { - var tweens = GetValue(config, 'tweens', null); + return FloatBetween(-180, 180); +}; - if (tweens === null) - { - return []; - } - else if (typeof tweens === 'function') - { - tweens = tweens.call(); - } +module.exports = RandomDegrees; - if (!Array.isArray(tweens)) - { - tweens = [ tweens ]; - } - return tweens; +/***/ }), + +/***/ 19049: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Normalize = __webpack_require__(37570); + +/** + * Reverse the given angle. + * + * @function Phaser.Math.Angle.Reverse + * @since 3.0.0 + * + * @param {number} angle - The angle to reverse, in radians. + * + * @return {number} The reversed angle, in radians. + */ +var Reverse = function (angle) +{ + return Normalize(angle + Math.PI); }; -module.exports = GetTweens; +module.exports = Reverse; /***/ }), -/* 585 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 90612: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Defaults = __webpack_require__(265); -var GetAdvancedValue = __webpack_require__(13); -var GetBoolean = __webpack_require__(99); -var GetEaseFunction = __webpack_require__(80); -var GetNewValue = __webpack_require__(162); -var GetValue = __webpack_require__(6); -var GetValueOp = __webpack_require__(264); -var Tween = __webpack_require__(266); -var TweenData = __webpack_require__(268); +var MATH_CONST = __webpack_require__(83392); /** - * Creates a new Number Tween. + * Rotates `currentAngle` towards `targetAngle`, taking the shortest rotation distance. The `lerp` argument is the amount to rotate by in this call. * - * @function Phaser.Tweens.Builders.NumberTweenBuilder + * @function Phaser.Math.Angle.RotateTo * @since 3.0.0 * - * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - The owner of the new Tween. - * @param {Phaser.Types.Tweens.NumberTweenBuilderConfig} config - Configuration for the new Tween. - * @param {Phaser.Types.Tweens.TweenConfigDefaults} defaults - Tween configuration defaults. + * @param {number} currentAngle - The current angle, in radians. + * @param {number} targetAngle - The target angle to rotate to, in radians. + * @param {number} [lerp=0.05] - The lerp value to add to the current angle. * - * @return {Phaser.Tweens.Tween} The new tween. + * @return {number} The adjusted angle. */ -var NumberTweenBuilder = function (parent, config, defaults) +var RotateTo = function (currentAngle, targetAngle, lerp) { - if (defaults === undefined) + if (lerp === undefined) { lerp = 0.05; } + + if (currentAngle === targetAngle) { - defaults = Defaults; + return currentAngle; } - // var tween = this.tweens.addCounter({ - // from: 100, - // to: 200, - // ... (normal tween properties) - // }) - // - // Then use it in your game via: - // - // tween.getValue() + if (Math.abs(targetAngle - currentAngle) <= lerp || Math.abs(targetAngle - currentAngle) >= (MATH_CONST.PI2 - lerp)) + { + currentAngle = targetAngle; + } + else + { + if (Math.abs(targetAngle - currentAngle) > Math.PI) + { + if (targetAngle < currentAngle) + { + targetAngle += MATH_CONST.PI2; + } + else + { + targetAngle -= MATH_CONST.PI2; + } + } - var from = GetValue(config, 'from', 0); - var to = GetValue(config, 'to', 1); + if (targetAngle > currentAngle) + { + currentAngle += lerp; + } + else if (targetAngle < currentAngle) + { + currentAngle -= lerp; + } + } - var targets = [ { value: from } ]; + return currentAngle; +}; - var delay = GetNewValue(config, 'delay', defaults.delay); - var duration = GetNewValue(config, 'duration', defaults.duration); - var easeParams = GetValue(config, 'easeParams', defaults.easeParams); - var ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), easeParams); - var hold = GetNewValue(config, 'hold', defaults.hold); - var repeat = GetNewValue(config, 'repeat', defaults.repeat); - var repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay); - var yoyo = GetBoolean(config, 'yoyo', defaults.yoyo); +module.exports = RotateTo; - var data = []; - var ops = GetValueOp('value', to); +/***/ }), - var tweenData = TweenData( - targets[0], - 0, - 'value', - ops.getEnd, - ops.getStart, - ops.getActive, - ease, - delay, - duration, - yoyo, - hold, - repeat, - repeatDelay, - false, - false - ); +/***/ 93954: +/***/ ((module) => { - tweenData.start = from; - tweenData.current = from; - tweenData.to = to; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Gets the shortest angle between `angle1` and `angle2`. + * + * Both angles must be in the range -180 to 180, which is the same clamped + * range that `sprite.angle` uses, so you can pass in two sprite angles to + * this method and get the shortest angle back between the two of them. + * + * The angle returned will be in the same range. If the returned angle is + * greater than 0 then it's a counter-clockwise rotation, if < 0 then it's + * a clockwise rotation. + * + * @function Phaser.Math.Angle.ShortestBetween + * @since 3.0.0 + * + * @param {number} angle1 - The first angle in the range -180 to 180. + * @param {number} angle2 - The second angle in the range -180 to 180. + * + * @return {number} The shortest angle, in degrees. If greater than zero it's a counter-clockwise rotation. + */ +var ShortestBetween = function (angle1, angle2) +{ + var difference = angle2 - angle1; - data.push(tweenData); + if (difference === 0) + { + return 0; + } - var tween = new Tween(parent, data, targets); + var times = Math.floor((difference - (-180)) / 360); - tween.offset = GetAdvancedValue(config, 'offset', null); - tween.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); - tween.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); - tween.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); - tween.paused = GetBoolean(config, 'paused', false); - tween.useFrames = GetBoolean(config, 'useFrames', false); + return difference - (times * 360); - // Set the Callbacks - var scope = GetValue(config, 'callbackScope', tween); +}; - // Callback parameters: 0 = a reference to the Tween itself, 1 = the target/s of the Tween, ... your own params - var tweenArray = [ tween, null ]; +module.exports = ShortestBetween; - var callbacks = Tween.TYPES; - for (var i = 0; i < callbacks.length; i++) - { - var type = callbacks[i]; +/***/ }), - var callback = GetValue(config, type, false); +/***/ 35786: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (callback) - { - var callbackScope = GetValue(config, type + 'Scope', scope); - var callbackParams = GetValue(config, type + 'Params', []); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // The null is reset to be the Tween target - tween.setCallback(type, callback, tweenArray.concat(callbackParams), callbackScope); - } - } +var MathWrap = __webpack_require__(1071); - return tween; +/** + * Wrap an angle. + * + * Wraps the angle to a value in the range of -PI to PI. + * + * @function Phaser.Math.Angle.Wrap + * @since 3.0.0 + * + * @param {number} angle - The angle to wrap, in radians. + * + * @return {number} The wrapped angle, in radians. + */ +var Wrap = function (angle) +{ + return MathWrap(angle, -Math.PI, Math.PI); }; -module.exports = NumberTweenBuilder; +module.exports = Wrap; /***/ }), -/* 586 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 62138: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetEaseFunction = __webpack_require__(80); -var GetValue = __webpack_require__(6); -var MATH_CONST = __webpack_require__(14); +var Wrap = __webpack_require__(1071); /** - * Creates a Stagger function to be used by a Tween property. - * - * The stagger function will allow you to stagger changes to the value of the property across all targets of the tween. - * - * This is only worth using if the tween has multiple targets. - * - * The following will stagger the delay by 100ms across all targets of the tween, causing them to scale down to 0.2 - * over the duration specified: - * - * ```javascript - * this.tweens.add({ - * targets: [ ... ], - * scale: 0.2, - * ease: 'linear', - * duration: 1000, - * delay: this.tweens.stagger(100) - * }); - * ``` - * - * The following will stagger the delay by 500ms across all targets of the tween using a 10 x 6 grid, staggering - * from the center out, using a cubic ease. - * - * ```javascript - * this.tweens.add({ - * targets: [ ... ], - * scale: 0.2, - * ease: 'linear', - * duration: 1000, - * delay: this.tweens.stagger(500, { grid: [ 10, 6 ], from: 'center', ease: 'cubic.out' }) - * }); - * ``` + * Wrap an angle in degrees. * - * @function Phaser.Tweens.Builders.StaggerBuilder - * @since 3.19.0 + * Wraps the angle to a value in the range of -180 to 180. * - * @param {(number|number[])} value - The amount to stagger by, or an array containing two elements representing the min and max values to stagger between. - * @param {Phaser.Types.Tweens.StaggerConfig} [config] - A Stagger Configuration object. + * @function Phaser.Math.Angle.WrapDegrees + * @since 3.0.0 * - * @return {function} The stagger function. + * @param {number} angle - The angle to wrap, in degrees. + * + * @return {number} The wrapped angle, in degrees. */ -var StaggerBuilder = function (value, options) +var WrapDegrees = function (angle) { - if (options === undefined) { options = {}; } + return Wrap(angle, -180, 180); +}; - var result; +module.exports = WrapDegrees; - var start = GetValue(options, 'start', 0); - var ease = GetValue(options, 'ease', null); - var grid = GetValue(options, 'grid', null); - var from = GetValue(options, 'from', 0); +/***/ }), - var fromFirst = (from === 'first'); - var fromCenter = (from === 'center'); - var fromLast = (from === 'last'); - var fromValue = (typeof(from) === 'number'); +/***/ 22153: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var isRange = (Array.isArray(value)); - var value1 = (isRange) ? parseFloat(value[0]) : parseFloat(value); - var value2 = (isRange) ? parseFloat(value[1]) : 0; - var maxValue = Math.max(value1, value2); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (isRange) - { - start += value1; - } +/** + * @namespace Phaser.Math.Angle + */ - if (grid) - { - // Pre-calc the grid to save doing it for ever tweendata update - var gridWidth = grid[0]; - var gridHeight = grid[1]; +module.exports = { - var fromX = 0; - var fromY = 0; + Between: __webpack_require__(90447), + BetweenPoints: __webpack_require__(94240), + BetweenPointsY: __webpack_require__(84066), + BetweenY: __webpack_require__(9678), + CounterClockwise: __webpack_require__(76861), + Normalize: __webpack_require__(37570), + Random: __webpack_require__(87597), + RandomDegrees: __webpack_require__(74493), + Reverse: __webpack_require__(19049), + RotateTo: __webpack_require__(90612), + ShortestBetween: __webpack_require__(93954), + Wrap: __webpack_require__(35786), + WrapDegrees: __webpack_require__(62138) - var distanceX = 0; - var distanceY = 0; +}; - var gridValues = []; - if (fromLast) - { - fromX = gridWidth - 1; - fromY = gridHeight - 1; - } - else if (fromValue) - { - fromX = from % gridWidth; - fromY = Math.floor(from / gridWidth); - } - else if (fromCenter) - { - fromX = (gridWidth - 1) / 2; - fromY = (gridHeight - 1) / 2; - } +/***/ }), - var gridMax = MATH_CONST.MIN_SAFE_INTEGER; +/***/ 83392: +/***/ ((module) => { - for (var toY = 0; toY < gridHeight; toY++) - { - gridValues[toY] = []; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - for (var toX = 0; toX < gridWidth; toX++) - { - distanceX = fromX - toX; - distanceY = fromY - toY; +var MATH_CONST = { - var dist = Math.sqrt(distanceX * distanceX + distanceY * distanceY); + /** + * The value of PI * 2. + * + * @name Phaser.Math.PI2 + * @type {number} + * @since 3.0.0 + */ + PI2: Math.PI * 2, - if (dist > gridMax) - { - gridMax = dist; - } + /** + * The value of PI * 0.5. + * + * Yes, we understand that this should actually be PI * 2, but + * it has been like this for so long we can't change it now. + * If you need PI * 2, use the PI2 constant instead. + * + * @name Phaser.Math.TAU + * @type {number} + * @since 3.0.0 + */ + TAU: Math.PI * 0.5, - gridValues[toY][toX] = dist; - } - } - } + /** + * An epsilon value (1.0e-6) + * + * @name Phaser.Math.EPSILON + * @type {number} + * @since 3.0.0 + */ + EPSILON: 1.0e-6, - var easeFunction = (ease) ? GetEaseFunction(ease) : null; + /** + * For converting degrees to radians (PI / 180) + * + * @name Phaser.Math.DEG_TO_RAD + * @type {number} + * @since 3.0.0 + */ + DEG_TO_RAD: Math.PI / 180, - if (grid) - { - result = function (target, key, value, index) - { - var gridSpace = 0; - var toX = index % gridWidth; - var toY = Math.floor(index / gridWidth); - - if (toX >= 0 && toX < gridWidth && toY >= 0 && toY < gridHeight) - { - gridSpace = gridValues[toY][toX]; - } + /** + * For converting radians to degrees (180 / PI) + * + * @name Phaser.Math.RAD_TO_DEG + * @type {number} + * @since 3.0.0 + */ + RAD_TO_DEG: 180 / Math.PI, - var output; - - if (isRange) - { - var diff = (value2 - value1); - - if (easeFunction) - { - output = ((gridSpace / gridMax) * diff) * easeFunction(gridSpace / gridMax); - } - else - { - output = (gridSpace / gridMax) * diff; - } - } - else if (easeFunction) - { - output = (gridSpace * value1) * easeFunction(gridSpace / gridMax); - } - else - { - output = gridSpace * value1; - } + /** + * An instance of the Random Number Generator. + * This is not set until the Game boots. + * + * @name Phaser.Math.RND + * @type {Phaser.Math.RandomDataGenerator} + * @since 3.0.0 + */ + RND: null, - return output + start; - }; - } - else - { - result = function (target, key, value, index, total) - { - // zero offset - total--; - - var fromIndex; - - if (fromFirst) - { - fromIndex = index; - } - else if (fromCenter) - { - fromIndex = Math.abs((total / 2) - index); - } - else if (fromLast) - { - fromIndex = total - index; - } - else if (fromValue) - { - fromIndex = Math.abs(from - index); - } - - var output; - - if (isRange) - { - var spacing; + /** + * The minimum safe integer this browser supports. + * We use a const for backward compatibility with Internet Explorer. + * + * @name Phaser.Math.MIN_SAFE_INTEGER + * @type {number} + * @since 3.21.0 + */ + MIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER || -9007199254740991, - if (fromCenter) - { - spacing = ((value2 - value1) / total) * (fromIndex * 2); - } - else - { - spacing = ((value2 - value1) / total) * fromIndex; - } - - if (easeFunction) - { - output = spacing * easeFunction(fromIndex / total); - } - else - { - output = spacing; - } - } - else if (easeFunction) - { - output = (total * maxValue) * easeFunction(fromIndex / total); - } - else - { - output = fromIndex * value1; - } - - return output + start; - }; - } + /** + * The maximum safe integer this browser supports. + * We use a const for backward compatibility with Internet Explorer. + * + * @name Phaser.Math.MAX_SAFE_INTEGER + * @type {number} + * @since 3.21.0 + */ + MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER || 9007199254740991 - return result; }; -module.exports = StaggerBuilder; +module.exports = MATH_CONST; /***/ }), -/* 587 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 53996: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clone = __webpack_require__(77); -var Defaults = __webpack_require__(265); -var GetAdvancedValue = __webpack_require__(13); -var GetBoolean = __webpack_require__(99); -var GetEaseFunction = __webpack_require__(80); -var GetNewValue = __webpack_require__(162); -var GetTargets = __webpack_require__(263); -var GetTweens = __webpack_require__(584); -var GetValue = __webpack_require__(6); -var Timeline = __webpack_require__(588); -var TweenBuilder = __webpack_require__(163); - /** - * Builds a Timeline of Tweens based on a configuration object. + * Calculate the distance between two sets of coordinates (points). * - * @function Phaser.Tweens.Builders.TimelineBuilder + * @function Phaser.Math.Distance.Between * @since 3.0.0 * - * @param {Phaser.Tweens.TweenManager} manager - The Tween Manager to which the Timeline will belong. - * @param {Phaser.Types.Tweens.TimelineBuilderConfig} config - The configuration object for the Timeline. + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. * - * @return {Phaser.Tweens.Timeline} The created Timeline. + * @return {number} The distance between each point. */ -var TimelineBuilder = function (manager, config) +var DistanceBetween = function (x1, y1, x2, y2) { - var timeline = new Timeline(manager); - - timeline.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); - timeline.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); - timeline.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); - timeline.paused = GetBoolean(config, 'paused', false); - timeline.useFrames = GetBoolean(config, 'useFrames', false); - - // Callbacks - - var scope = GetValue(config, 'callbackScope', timeline); + var dx = x1 - x2; + var dy = y1 - y2; - var timelineArray = [ timeline ]; + return Math.sqrt(dx * dx + dy * dy); +}; - var onStart = GetValue(config, 'onStart', false); +module.exports = DistanceBetween; - // The Start of the Timeline - if (onStart) - { - var onStartScope = GetValue(config, 'onStartScope', scope); - var onStartParams = GetValue(config, 'onStartParams', []); - timeline.setCallback('onStart', onStart, timelineArray.concat(onStartParams), onStartScope); - } +/***/ }), - var onUpdate = GetValue(config, 'onUpdate', false); +/***/ 92951: +/***/ ((module) => { - // Every time the Timeline updates (regardless which Tweens are running) - if (onUpdate) - { - var onUpdateScope = GetValue(config, 'onUpdateScope', scope); - var onUpdateParams = GetValue(config, 'onUpdateParams', []); +/** + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - timeline.setCallback('onUpdate', onUpdate, timelineArray.concat(onUpdateParams), onUpdateScope); - } +/** + * Calculate the distance between two points. + * + * @function Phaser.Math.Distance.BetweenPoints + * @since 3.22.0 + * + * @param {Phaser.Types.Math.Vector2Like} a - The first point. + * @param {Phaser.Types.Math.Vector2Like} b - The second point. + * + * @return {number} The distance between the points. + */ +var DistanceBetweenPoints = function (a, b) +{ + var dx = a.x - b.x; + var dy = a.y - b.y; - var onLoop = GetValue(config, 'onLoop', false); + return Math.sqrt(dx * dx + dy * dy); +}; - // Called when the whole Timeline loops - if (onLoop) - { - var onLoopScope = GetValue(config, 'onLoopScope', scope); - var onLoopParams = GetValue(config, 'onLoopParams', []); +module.exports = DistanceBetweenPoints; - timeline.setCallback('onLoop', onLoop, timelineArray.concat(onLoopParams), onLoopScope); - } - var onYoyo = GetValue(config, 'onYoyo', false); +/***/ }), - // Called when a Timeline yoyos - if (onYoyo) - { - var onYoyoScope = GetValue(config, 'onYoyoScope', scope); - var onYoyoParams = GetValue(config, 'onYoyoParams', []); +/***/ 12161: +/***/ ((module) => { - timeline.setCallback('onYoyo', onYoyo, timelineArray.concat(null, onYoyoParams), onYoyoScope); - } +/** + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var onComplete = GetValue(config, 'onComplete', false); +/** + * Calculate the squared distance between two points. + * + * @function Phaser.Math.Distance.BetweenPointsSquared + * @since 3.22.0 + * + * @param {Phaser.Types.Math.Vector2Like} a - The first point. + * @param {Phaser.Types.Math.Vector2Like} b - The second point. + * + * @return {number} The squared distance between the points. + */ +var DistanceBetweenPointsSquared = function (a, b) +{ + var dx = a.x - b.x; + var dy = a.y - b.y; - // Called when the Timeline completes, after the completeDelay, etc. - if (onComplete) - { - var onCompleteScope = GetValue(config, 'onCompleteScope', scope); - var onCompleteParams = GetValue(config, 'onCompleteParams', []); + return dx * dx + dy * dy; +}; - timeline.setCallback('onComplete', onComplete, timelineArray.concat(onCompleteParams), onCompleteScope); - } +module.exports = DistanceBetweenPointsSquared; - // Tweens - var tweens = GetTweens(config); +/***/ }), - if (tweens.length === 0) - { - timeline.paused = true; +/***/ 38057: +/***/ ((module) => { - return timeline; - } +/** + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var defaults = Clone(Defaults); +/** + * Calculate the Chebyshev distance between two sets of coordinates (points). + * + * Chebyshev distance (or chessboard distance) is the maximum of the horizontal and vertical distances. + * It's the effective distance when movement can be horizontal, vertical, or diagonal. + * + * @function Phaser.Math.Distance.Chebyshev + * @since 3.22.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The distance between each point. + */ +var ChebyshevDistance = function (x1, y1, x2, y2) +{ + return Math.max(Math.abs(x1 - x2), Math.abs(y1 - y2)); +}; - defaults.targets = GetTargets(config); +module.exports = ChebyshevDistance; - // totalDuration: If specified each tween in the Timeline is given an equal portion of the totalDuration - var totalDuration = GetAdvancedValue(config, 'totalDuration', 0); +/***/ }), - if (totalDuration > 0) - { - defaults.duration = Math.floor(totalDuration / tweens.length); - } - else - { - defaults.duration = GetNewValue(config, 'duration', defaults.duration); - } +/***/ 33297: +/***/ ((module) => { - defaults.delay = GetNewValue(config, 'delay', defaults.delay); - defaults.easeParams = GetValue(config, 'easeParams', defaults.easeParams); - defaults.ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), defaults.easeParams); - defaults.hold = GetNewValue(config, 'hold', defaults.hold); - defaults.repeat = GetNewValue(config, 'repeat', defaults.repeat); - defaults.repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay); - defaults.yoyo = GetBoolean(config, 'yoyo', defaults.yoyo); - defaults.flipX = GetBoolean(config, 'flipX', defaults.flipX); - defaults.flipY = GetBoolean(config, 'flipY', defaults.flipY); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Create the Tweens - for (var i = 0; i < tweens.length; i++) - { - timeline.queue(TweenBuilder(timeline, tweens[i], defaults)); - } +/** + * Calculate the distance between two sets of coordinates (points) to the power of `pow`. + * + * @function Phaser.Math.Distance.Power + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * @param {number} pow - The exponent. + * + * @return {number} The distance between each point. + */ +var DistancePower = function (x1, y1, x2, y2, pow) +{ + if (pow === undefined) { pow = 2; } - return timeline; + return Math.sqrt(Math.pow(x2 - x1, pow) + Math.pow(y2 - y1, pow)); }; -module.exports = TimelineBuilder; +module.exports = DistancePower; /***/ }), -/* 588 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 90366: +/***/ ((module) => { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(267); -var TweenBuilder = __webpack_require__(163); -var TWEEN_CONST = __webpack_require__(100); - /** - * @classdesc - * A Timeline combines multiple Tweens into one. Its overall behavior is otherwise similar to a single Tween. + * Calculate the snake distance between two sets of coordinates (points). * - * The Timeline updates all of its Tweens simultaneously. Its methods allow you to easily build a sequence - * of Tweens (each one starting after the previous one) or run multiple Tweens at once during given parts of the Timeline. + * Snake distance (rectilinear distance, Manhattan distance) is the sum of the horizontal and vertical distances. + * It's the effective distance when movement is allowed only horizontally or vertically (but not both). * - * @class Timeline - * @memberof Phaser.Tweens - * @extends Phaser.Events.EventEmitter - * @constructor - * @since 3.0.0 + * @function Phaser.Math.Distance.Snake + * @since 3.22.0 * - * @param {Phaser.Tweens.TweenManager} manager - The Tween Manager which owns this Timeline. + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The distance between each point. */ -var Timeline = new Class({ +var SnakeDistance = function (x1, y1, x2, y2) +{ + return Math.abs(x1 - x2) + Math.abs(y1 - y2); +}; - Extends: EventEmitter, +module.exports = SnakeDistance; - initialize: - function Timeline (manager) - { - EventEmitter.call(this); - - /** - * The Tween Manager which owns this Timeline. - * - * @name Phaser.Tweens.Timeline#manager - * @type {Phaser.Tweens.TweenManager} - * @since 3.0.0 - */ - this.manager = manager; +/***/ }), - /** - * A constant value which allows this Timeline to be easily identified as one. - * - * @name Phaser.Tweens.Timeline#isTimeline - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.isTimeline = true; +/***/ 35032: +/***/ ((module) => { - /** - * An array of Tween objects, each containing a unique property and target being tweened. - * - * @name Phaser.Tweens.Timeline#data - * @type {array} - * @default [] - * @since 3.0.0 - */ - this.data = []; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The cached size of the data array. - * - * @name Phaser.Tweens.Timeline#totalData - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalData = 0; +/** + * Calculate the distance between two sets of coordinates (points), squared. + * + * @function Phaser.Math.Distance.Squared + * @since 3.0.0 + * + * @param {number} x1 - The x coordinate of the first point. + * @param {number} y1 - The y coordinate of the first point. + * @param {number} x2 - The x coordinate of the second point. + * @param {number} y2 - The y coordinate of the second point. + * + * @return {number} The distance between each point, squared. + */ +var DistanceSquared = function (x1, y1, x2, y2) +{ + var dx = x1 - x2; + var dy = y1 - y2; - /** - * If true then duration, delay, etc values are all frame totals, rather than ms. - * - * @name Phaser.Tweens.Timeline#useFrames - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.useFrames = false; + return dx * dx + dy * dy; +}; - /** - * Scales the time applied to this Timeline. A value of 1 runs in real-time. A value of 0.5 runs 50% slower, and so on. - * Value isn't used when calculating total duration of the Timeline, it's a run-time delta adjustment only. - * - * @name Phaser.Tweens.Timeline#timeScale - * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.timeScale = 1; +module.exports = DistanceSquared; - /** - * Loop this Timeline? Can be -1 for an infinite loop, or an integer. - * When enabled it will play through ALL Tweens again (use Tween.repeat to loop a single tween) - * - * @name Phaser.Tweens.Timeline#loop - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loop = 0; - /** - * Time in ms/frames before this Timeline loops. - * - * @name Phaser.Tweens.Timeline#loopDelay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loopDelay = 0; +/***/ }), - /** - * How many loops are left to run? - * - * @name Phaser.Tweens.Timeline#loopCounter - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.loopCounter = 0; +/***/ 10130: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Time in ms/frames before the 'onComplete' event fires. This never fires if loop = true (as it never completes) - * - * @name Phaser.Tweens.Timeline#completeDelay - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.completeDelay = 0; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Countdown timer value, as used by `loopDelay` and `completeDelay`. - * - * @name Phaser.Tweens.Timeline#countdown - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.countdown = 0; +/** + * @namespace Phaser.Math.Distance + */ - /** - * The current state of the Timeline. - * - * @name Phaser.Tweens.Timeline#state - * @type {number} - * @since 3.0.0 - */ - this.state = TWEEN_CONST.PENDING_ADD; +module.exports = { - /** - * The state of the Timeline when it was paused (used by Resume) - * - * @name Phaser.Tweens.Timeline#_pausedState - * @type {number} - * @private - * @since 3.0.0 - */ - this._pausedState = TWEEN_CONST.PENDING_ADD; + Between: __webpack_require__(53996), + BetweenPoints: __webpack_require__(92951), + BetweenPointsSquared: __webpack_require__(12161), + Chebyshev: __webpack_require__(38057), + Power: __webpack_require__(33297), + Snake: __webpack_require__(90366), + Squared: __webpack_require__(35032) - /** - * Does the Timeline start off paused? (if so it needs to be started with Timeline.play) - * - * @name Phaser.Tweens.Timeline#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; +}; - /** - * Elapsed time in ms/frames of this run through of the Timeline. - * - * @name Phaser.Tweens.Timeline#elapsed - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.elapsed = 0; - /** - * Total elapsed time in ms/frames of the entire Timeline, including looping. - * - * @name Phaser.Tweens.Timeline#totalElapsed - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalElapsed = 0; +/***/ }), - /** - * Time in ms/frames for the whole Timeline to play through once, excluding loop amounts and loop delays. - * - * @name Phaser.Tweens.Timeline#duration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.duration = 0; +/***/ 35060: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Value between 0 and 1. The amount of progress through the Timeline, _excluding loops_. - * - * @name Phaser.Tweens.Timeline#progress - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.progress = 0; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Time in ms/frames for all Tweens in this Timeline to complete (including looping) - * - * @name Phaser.Tweens.Timeline#totalDuration - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalDuration = 0; +var Back = __webpack_require__(25265); +var Bounce = __webpack_require__(57428); +var Circular = __webpack_require__(73214); +var Cubic = __webpack_require__(71778); +var Elastic = __webpack_require__(36468); +var Expo = __webpack_require__(88258); +var Linear = __webpack_require__(52910); +var Quadratic = __webpack_require__(67799); +var Quartic = __webpack_require__(74083); +var Quintic = __webpack_require__(92284); +var Sine = __webpack_require__(28035); +var Stepped = __webpack_require__(8754); - /** - * Value between 0 and 1. The amount through the entire Timeline, including looping. - * - * @name Phaser.Tweens.Timeline#totalProgress - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.totalProgress = 0; +// EaseMap +module.exports = { - /** - * An object containing the different Tween callback functions. - * - * You can either set these in the Tween config, or by calling the `Tween.setCallback` method. - * - * `onComplete` When the Timeline finishes playback fully or `Timeline.stop` is called. Never invoked if timeline is set to repeat infinitely. - * `onLoop` When a Timeline loops. - * `onStart` When the Timeline starts playing. - * `onUpdate` When a Timeline updates a child Tween. - * `onYoyo` When a Timeline starts a yoyo. - * - * @name Phaser.Tweens.Timeline#callbacks - * @type {object} - * @since 3.0.0 - */ - this.callbacks = { - onComplete: null, - onLoop: null, - onStart: null, - onUpdate: null, - onYoyo: null - }; + Power0: Linear, + Power1: Quadratic.Out, + Power2: Cubic.Out, + Power3: Quartic.Out, + Power4: Quintic.Out, - /** - * The context in which all callbacks are invoked. - * - * @name Phaser.Tweens.Timeline#callbackScope - * @type {any} - * @since 3.0.0 - */ - this.callbackScope; - }, + Linear: Linear, + Quad: Quadratic.Out, + Cubic: Cubic.Out, + Quart: Quartic.Out, + Quint: Quintic.Out, + Sine: Sine.Out, + Expo: Expo.Out, + Circ: Circular.Out, + Elastic: Elastic.Out, + Back: Back.Out, + Bounce: Bounce.Out, + Stepped: Stepped, - /** - * Internal method that will emit a Timeline based Event and invoke the given callback. - * - * @method Phaser.Tweens.Timeline#dispatchTimelineEvent - * @since 3.19.0 - * - * @param {Phaser.Types.Tweens.Event} event - The Event to be dispatched. - * @param {function} callback - The callback to be invoked. Can be `null` or `undefined` to skip invocation. - */ - dispatchTimelineEvent: function (event, callback) - { - this.emit(event, this); + 'Quad.easeIn': Quadratic.In, + 'Cubic.easeIn': Cubic.In, + 'Quart.easeIn': Quartic.In, + 'Quint.easeIn': Quintic.In, + 'Sine.easeIn': Sine.In, + 'Expo.easeIn': Expo.In, + 'Circ.easeIn': Circular.In, + 'Elastic.easeIn': Elastic.In, + 'Back.easeIn': Back.In, + 'Bounce.easeIn': Bounce.In, - if (callback) - { - callback.func.apply(callback.scope, callback.params); - } - }, + 'Quad.easeOut': Quadratic.Out, + 'Cubic.easeOut': Cubic.Out, + 'Quart.easeOut': Quartic.Out, + 'Quint.easeOut': Quintic.Out, + 'Sine.easeOut': Sine.Out, + 'Expo.easeOut': Expo.Out, + 'Circ.easeOut': Circular.Out, + 'Elastic.easeOut': Elastic.Out, + 'Back.easeOut': Back.Out, + 'Bounce.easeOut': Bounce.Out, - /** - * Sets the value of the time scale applied to this Timeline. A value of 1 runs in real-time. - * A value of 0.5 runs 50% slower, and so on. - * - * The value isn't used when calculating total duration of the tween, it's a run-time delta adjustment only. - * - * @method Phaser.Tweens.Timeline#setTimeScale - * @since 3.0.0 - * - * @param {number} value - The time scale value to set. - * - * @return {this} This Timeline object. - */ - setTimeScale: function (value) - { - this.timeScale = value; + 'Quad.easeInOut': Quadratic.InOut, + 'Cubic.easeInOut': Cubic.InOut, + 'Quart.easeInOut': Quartic.InOut, + 'Quint.easeInOut': Quintic.InOut, + 'Sine.easeInOut': Sine.InOut, + 'Expo.easeInOut': Expo.InOut, + 'Circ.easeInOut': Circular.InOut, + 'Elastic.easeInOut': Elastic.InOut, + 'Back.easeInOut': Back.InOut, + 'Bounce.easeInOut': Bounce.InOut - return this; - }, +}; - /** - * Gets the value of the time scale applied to this Timeline. A value of 1 runs in real-time. - * A value of 0.5 runs 50% slower, and so on. - * - * @method Phaser.Tweens.Timeline#getTimeScale - * @since 3.0.0 - * - * @return {number} The value of the time scale applied to this Timeline. - */ - getTimeScale: function () - { - return this.timeScale; - }, - /** - * Check whether or not the Timeline is playing. - * - * @method Phaser.Tweens.Timeline#isPlaying - * @since 3.0.0 - * - * @return {boolean} `true` if this Timeline is active, otherwise `false`. - */ - isPlaying: function () - { - return (this.state === TWEEN_CONST.ACTIVE); - }, +/***/ }), - /** - * Creates a new Tween, based on the given Tween Config, and adds it to this Timeline. - * - * @method Phaser.Tweens.Timeline#add - * @since 3.0.0 - * - * @param {(Phaser.Types.Tweens.TweenBuilderConfig|object)} config - The configuration object for the Tween. - * - * @return {this} This Timeline object. - */ - add: function (config) - { - return this.queue(TweenBuilder(this, config)); - }, +/***/ 25860: +/***/ ((module) => { - /** - * Adds an existing Tween to this Timeline. - * - * @method Phaser.Tweens.Timeline#queue - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - The Tween to be added to this Timeline. - * - * @return {this} This Timeline object. - */ - queue: function (tween) - { - if (!this.isPlaying()) - { - tween.parent = this; - tween.parentIsTimeline = true; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.data.push(tween); +/** + * Back ease-in. + * + * @function Phaser.Math.Easing.Back.In + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * @param {number} [overshoot=1.70158] - The overshoot amount. + * + * @return {number} The tweened value. + */ +var In = function (v, overshoot) +{ + if (overshoot === undefined) { overshoot = 1.70158; } - this.totalData = this.data.length; - } + return v * v * ((overshoot + 1) * v - overshoot); +}; - return this; - }, +module.exports = In; - /** - * Checks whether a Tween has an offset value. - * - * @method Phaser.Tweens.Timeline#hasOffset - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - The Tween to check. - * - * @return {boolean} `true` if the tween has a non-null offset. - */ - hasOffset: function (tween) - { - return (tween.offset !== null); - }, - /** - * Checks whether the offset value is a number or a directive that is relative to previous tweens. - * - * @method Phaser.Tweens.Timeline#isOffsetAbsolute - * @since 3.0.0 - * - * @param {number} value - The offset value to be evaluated. - * - * @return {boolean} `true` if the result is a number, `false` if it is a directive like " -= 1000". - */ - isOffsetAbsolute: function (value) - { - return (typeof(value) === 'number'); - }, +/***/ }), - /** - * Checks if the offset is a relative value rather than an absolute one. - * If the value is just a number, this returns false. - * - * @method Phaser.Tweens.Timeline#isOffsetRelative - * @since 3.0.0 - * - * @param {string} value - The offset value to be evaluated. - * - * @return {boolean} `true` if the value is relative, i.e " -= 1000". If `false`, the offset is absolute. - */ - isOffsetRelative: function (value) - { - var t = typeof(value); +/***/ 45264: +/***/ ((module) => { - if (t === 'string') - { - var op = value[0]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (op === '-' || op === '+') - { - return true; - } - } +/** + * Back ease-in/out. + * + * @function Phaser.Math.Easing.Back.InOut + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * @param {number} [overshoot=1.70158] - The overshoot amount. + * + * @return {number} The tweened value. + */ +var InOut = function (v, overshoot) +{ + if (overshoot === undefined) { overshoot = 1.70158; } - return false; - }, + var s = overshoot * 1.525; - /** - * Parses the relative offset value, returning a positive or negative number. - * - * @method Phaser.Tweens.Timeline#getRelativeOffset - * @since 3.0.0 - * - * @param {string} value - The relative offset, in the format of '-=500', for example. The first character determines whether it will be a positive or negative number. Spacing matters here. - * @param {number} base - The value to use as the offset. - * - * @return {number} The parsed offset value. - */ - getRelativeOffset: function (value, base) + if ((v *= 2) < 1) + { + return 0.5 * (v * v * ((s + 1) * v - s)); + } + else { - var op = value[0]; - var num = parseFloat(value.substr(2)); - var result = base; + return 0.5 * ((v -= 2) * v * ((s + 1) * v + s) + 2); + } +}; - switch (op) - { - case '+': - result += num; - break; +module.exports = InOut; - case '-': - result -= num; - break; - } - // Cannot ever be < 0 - return Math.max(0, result); - }, +/***/ }), - /** - * Calculates the total duration of the timeline. - * - * Computes all tween durations and returns the full duration of the timeline. - * - * The resulting number is stored in the timeline, not as a return value. - * - * @method Phaser.Tweens.Timeline#calcDuration - * @since 3.0.0 - */ - calcDuration: function () - { - var prevEnd = 0; - var totalDuration = 0; - var offsetDuration = 0; +/***/ 36699: +/***/ ((module) => { - for (var i = 0; i < this.totalData; i++) - { - var tween = this.data[i]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - tween.init(); +/** + * Back ease-out. + * + * @function Phaser.Math.Easing.Back.Out + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * @param {number} [overshoot=1.70158] - The overshoot amount. + * + * @return {number} The tweened value. + */ +var Out = function (v, overshoot) +{ + if (overshoot === undefined) { overshoot = 1.70158; } - if (this.hasOffset(tween)) - { - if (this.isOffsetAbsolute(tween.offset)) - { - // An actual number, so it defines the start point from the beginning of the timeline - tween.calculatedOffset = tween.offset; + return --v * v * ((overshoot + 1) * v + overshoot) + 1; +}; - if (tween.offset === 0) - { - offsetDuration = 0; - } - } - else if (this.isOffsetRelative(tween.offset)) - { - // A relative offset (i.e. '-=1000', so starts at 'offset' ms relative to the PREVIOUS Tweens ending time) - tween.calculatedOffset = this.getRelativeOffset(tween.offset, prevEnd); - } - } - else - { - // Sequential - tween.calculatedOffset = offsetDuration; - } +module.exports = Out; - prevEnd = tween.totalDuration + tween.calculatedOffset; - totalDuration += tween.totalDuration; - offsetDuration += tween.totalDuration; - } +/***/ }), - // Excludes loop values - this.duration = totalDuration; +/***/ 25265: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.loopCounter = (this.loop === -1) ? 999999999999 : this.loop; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (this.loopCounter > 0) - { - this.totalDuration = this.duration + this.completeDelay + ((this.duration + this.loopDelay) * this.loopCounter); - } - else - { - this.totalDuration = this.duration + this.completeDelay; - } - }, +/** + * @namespace Phaser.Math.Easing.Back + */ - /** - * Initializes the timeline, which means all Tweens get their init() called, and the total duration will be computed. - * Returns a boolean indicating whether the timeline is auto-started or not. - * - * @method Phaser.Tweens.Timeline#init - * @since 3.0.0 - * - * @return {boolean} `true` if the Timeline is started. `false` if it is paused. - */ - init: function () - { - this.calcDuration(); +module.exports = { - this.progress = 0; - this.totalProgress = 0; + In: __webpack_require__(25860), + Out: __webpack_require__(36699), + InOut: __webpack_require__(45264) - if (this.paused) - { - this.state = TWEEN_CONST.PAUSED; +}; - return false; - } - else - { - return true; - } - }, - /** - * Resets all of the timeline's tweens back to their initial states. - * The boolean parameter indicates whether tweens that are looping should reset as well, or not. - * - * @method Phaser.Tweens.Timeline#resetTweens - * @since 3.0.0 - * - * @param {boolean} resetFromLoop - If `true`, resets all looping tweens to their initial values. - */ - resetTweens: function (resetFromLoop) - { - for (var i = 0; i < this.totalData; i++) - { - var tween = this.data[i]; +/***/ }), - tween.play(resetFromLoop); - } - }, +/***/ 62191: +/***/ ((module) => { - /** - * Sets a callback for the Timeline. - * - * @method Phaser.Tweens.Timeline#setCallback - * @since 3.0.0 - * - * @param {string} type - The internal type of callback to set. - * @param {function} callback - Timeline allows multiple tweens to be linked together to create a streaming sequence. - * @param {array} [params] - The parameters to pass to the callback. - * @param {object} [scope] - The context scope of the callback. - * - * @return {this} This Timeline object. - */ - setCallback: function (type, callback, params, scope) - { - if (Timeline.TYPES.indexOf(type) !== -1) - { - this.callbacks[type] = { func: callback, scope: scope, params: params }; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +/** + * Bounce ease-in. + * + * @function Phaser.Math.Easing.Bounce.In + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var In = function (v) +{ + v = 1 - v; - /** - * Passed a Tween to the Tween Manager and requests it be made active. - * - * @method Phaser.Tweens.Timeline#makeActive - * @since 3.3.0 - * - * @param {Phaser.Tweens.Tween} tween - The tween object to make active. - * - * @return {Phaser.Tweens.TweenManager} The Timeline's Tween Manager reference. - */ - makeActive: function (tween) + if (v < 1 / 2.75) { - return this.manager.makeActive(tween); - }, - - /** - * Starts playing the Timeline. - * - * @method Phaser.Tweens.Timeline#play - * @fires Phaser.Tweens.Events#TIMELINE_START - * @since 3.0.0 - */ - play: function () + return 1 - (7.5625 * v * v); + } + else if (v < 2 / 2.75) { - if (this.state === TWEEN_CONST.ACTIVE) - { - return; - } - - if (this.paused) - { - this.paused = false; - - this.manager.makeActive(this); - - return; - } - else - { - this.resetTweens(false); - - this.state = TWEEN_CONST.ACTIVE; - } - - this.dispatchTimelineEvent(Events.TIMELINE_START, this.callbacks.onStart); - }, - - /** - * Updates the Timeline's `state` and fires callbacks and events. - * - * @method Phaser.Tweens.Timeline#nextState - * @fires Phaser.Tweens.Events#TIMELINE_COMPLETE - * @fires Phaser.Tweens.Events#TIMELINE_LOOP - * @since 3.0.0 - * - * @see Phaser.Tweens.Timeline#update - */ - nextState: function () + return 1 - (7.5625 * (v -= 1.5 / 2.75) * v + 0.75); + } + else if (v < 2.5 / 2.75) { - if (this.loopCounter > 0) - { - // Reset the elapsed time - this.elapsed = 0; - this.progress = 0; - - this.loopCounter--; + return 1 - (7.5625 * (v -= 2.25 / 2.75) * v + 0.9375); + } + else + { + return 1 - (7.5625 * (v -= 2.625 / 2.75) * v + 0.984375); + } +}; - this.resetTweens(true); +module.exports = In; - if (this.loopDelay > 0) - { - this.countdown = this.loopDelay; - this.state = TWEEN_CONST.LOOP_DELAY; - } - else - { - this.state = TWEEN_CONST.ACTIVE; +/***/ }), - this.dispatchTimelineEvent(Events.TIMELINE_LOOP, this.callbacks.onLoop); - } - } - else if (this.completeDelay > 0) - { - this.state = TWEEN_CONST.COMPLETE_DELAY; +/***/ 24799: +/***/ ((module) => { - this.countdown = this.completeDelay; - } - else - { - this.state = TWEEN_CONST.PENDING_REMOVE; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.dispatchTimelineEvent(Events.TIMELINE_COMPLETE, this.callbacks.onComplete); - } - }, +/** + * Bounce ease-in/out. + * + * @function Phaser.Math.Easing.Bounce.InOut + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var InOut = function (v) +{ + var reverse = false; - /** - * Returns 'true' if this Timeline has finished and should be removed from the Tween Manager. - * Otherwise, returns false. - * - * @method Phaser.Tweens.Timeline#update - * @fires Phaser.Tweens.Events#TIMELINE_COMPLETE - * @fires Phaser.Tweens.Events#TIMELINE_UPDATE - * @since 3.0.0 - * - * @param {number} timestamp - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - * - * @return {boolean} Returns `true` if this Timeline has finished and should be removed from the Tween Manager. - */ - update: function (timestamp, delta) + if (v < 0.5) { - if (this.state === TWEEN_CONST.PAUSED) - { - return; - } - - if (this.useFrames) - { - delta = 1 * this.manager.timeScale; - } - - delta *= this.timeScale; - - this.elapsed += delta; - this.progress = Math.min(this.elapsed / this.duration, 1); - - this.totalElapsed += delta; - this.totalProgress = Math.min(this.totalElapsed / this.totalDuration, 1); - - switch (this.state) - { - case TWEEN_CONST.ACTIVE: - - var stillRunning = this.totalData; + v = 1 - (v * 2); + reverse = true; + } + else + { + v = (v * 2) - 1; + } - for (var i = 0; i < this.totalData; i++) - { - var tween = this.data[i]; + if (v < 1 / 2.75) + { + v = 7.5625 * v * v; + } + else if (v < 2 / 2.75) + { + v = 7.5625 * (v -= 1.5 / 2.75) * v + 0.75; + } + else if (v < 2.5 / 2.75) + { + v = 7.5625 * (v -= 2.25 / 2.75) * v + 0.9375; + } + else + { + v = 7.5625 * (v -= 2.625 / 2.75) * v + 0.984375; + } - if (tween.update(timestamp, delta)) - { - stillRunning--; - } - } + if (reverse) + { + return (1 - v) * 0.5; + } + else + { + return v * 0.5 + 0.5; + } +}; - this.dispatchTimelineEvent(Events.TIMELINE_UPDATE, this.callbacks.onUpdate); +module.exports = InOut; - // Anything still running? If not, we're done - if (stillRunning === 0) - { - this.nextState(); - } - break; +/***/ }), - case TWEEN_CONST.LOOP_DELAY: +/***/ 60819: +/***/ ((module) => { - this.countdown -= delta; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (this.countdown <= 0) - { - this.state = TWEEN_CONST.ACTIVE; +/** + * Bounce ease-out. + * + * @function Phaser.Math.Easing.Bounce.Out + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var Out = function (v) +{ + if (v < 1 / 2.75) + { + return 7.5625 * v * v; + } + else if (v < 2 / 2.75) + { + return 7.5625 * (v -= 1.5 / 2.75) * v + 0.75; + } + else if (v < 2.5 / 2.75) + { + return 7.5625 * (v -= 2.25 / 2.75) * v + 0.9375; + } + else + { + return 7.5625 * (v -= 2.625 / 2.75) * v + 0.984375; + } +}; - this.dispatchTimelineEvent(Events.TIMELINE_LOOP, this.callbacks.onLoop); - } +module.exports = Out; - break; - case TWEEN_CONST.COMPLETE_DELAY: +/***/ }), - this.countdown -= delta; +/***/ 57428: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (this.countdown <= 0) - { - this.state = TWEEN_CONST.PENDING_REMOVE; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.dispatchTimelineEvent(Events.TIMELINE_COMPLETE, this.callbacks.onComplete); - } +/** + * @namespace Phaser.Math.Easing.Bounce + */ - break; - } +module.exports = { - return (this.state === TWEEN_CONST.PENDING_REMOVE); - }, + In: __webpack_require__(62191), + Out: __webpack_require__(60819), + InOut: __webpack_require__(24799) - /** - * Stops the Timeline immediately, whatever stage of progress it is at and flags it for removal by the TweenManager. - * - * @method Phaser.Tweens.Timeline#stop - * @since 3.0.0 - */ - stop: function () - { - this.state = TWEEN_CONST.PENDING_REMOVE; - }, +}; - /** - * Pauses the Timeline, retaining its internal state. - * - * Calling this on a Timeline that is already paused has no effect and fires no event. - * - * @method Phaser.Tweens.Timeline#pause - * @fires Phaser.Tweens.Events#TIMELINE_PAUSE - * @since 3.0.0 - * - * @return {this} This Timeline object. - */ - pause: function () - { - if (this.state === TWEEN_CONST.PAUSED) - { - return; - } - this.paused = true; +/***/ }), - this._pausedState = this.state; +/***/ 86855: +/***/ ((module) => { - this.state = TWEEN_CONST.PAUSED; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.emit(Events.TIMELINE_PAUSE, this); +/** + * Circular ease-in. + * + * @function Phaser.Math.Easing.Circular.In + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var In = function (v) +{ + return 1 - Math.sqrt(1 - v * v); +}; - return this; - }, +module.exports = In; - /** - * Resumes a paused Timeline from where it was when it was paused. - * - * Calling this on a Timeline that isn't paused has no effect and fires no event. - * - * @method Phaser.Tweens.Timeline#resume - * @fires Phaser.Tweens.Events#TIMELINE_RESUME - * @since 3.0.0 - * - * @return {this} This Timeline object. - */ - resume: function () - { - if (this.state === TWEEN_CONST.PAUSED) - { - this.paused = false; - this.state = this._pausedState; +/***/ }), - this.emit(Events.TIMELINE_RESUME, this); - } +/***/ 7280: +/***/ ((module) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Checks if any of the Tweens in this Timeline as operating on the target object. - * - * Returns `false` if no Tweens operate on the target object. - * - * @method Phaser.Tweens.Timeline#hasTarget - * @since 3.0.0 - * - * @param {object} target - The target to check all Tweens against. - * - * @return {boolean} `true` if there is at least a single Tween that operates on the target object, otherwise `false`. - */ - hasTarget: function (target) +/** + * Circular ease-in/out. + * + * @function Phaser.Math.Easing.Circular.InOut + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var InOut = function (v) +{ + if ((v *= 2) < 1) { - for (var i = 0; i < this.data.length; i++) - { - if (this.data[i].hasTarget(target)) - { - return true; - } - } - - return false; - }, - - /** - * Stops all the Tweens in the Timeline immediately, whatever stage of progress they are at and flags - * them for removal by the TweenManager. - * - * @method Phaser.Tweens.Timeline#destroy - * @since 3.0.0 - */ - destroy: function () + return -0.5 * (Math.sqrt(1 - v * v) - 1); + } + else { - for (var i = 0; i < this.data.length; i++) - { - this.data[i].stop(); - } + return 0.5 * (Math.sqrt(1 - (v -= 2) * v) + 1); } +}; -}); - -Timeline.TYPES = [ 'onStart', 'onUpdate', 'onLoop', 'onComplete', 'onYoyo' ]; - -module.exports = Timeline; +module.exports = InOut; /***/ }), -/* 589 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 18058: +/***/ ((module) => { /** - * @author Joachim Grill * @author Richard Davey - * @copyright 2018 CodeAndWeb GmbH - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bodies = __webpack_require__(86); -var Body = __webpack_require__(41); -var Common = __webpack_require__(32); -var GetFastValue = __webpack_require__(2); -var Vertices = __webpack_require__(64); - /** - * Use PhysicsEditorParser.parseBody() to build a Matter body object, based on a physics data file - * created and exported with PhysicsEditor (https://www.codeandweb.com/physicseditor). + * Circular ease-out. * - * @namespace Phaser.Physics.Matter.PhysicsEditorParser - * @since 3.10.0 + * @function Phaser.Math.Easing.Circular.Out + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. */ -var PhysicsEditorParser = { +var Out = function (v) +{ + return Math.sqrt(1 - (--v * v)); +}; - /** - * Parses a body element exported by PhysicsEditor. - * - * @function Phaser.Physics.Matter.PhysicsEditorParser.parseBody - * @since 3.10.0 - * - * @param {number} x - The horizontal world location of the body. - * @param {number} y - The vertical world location of the body. - * @param {object} config - The body configuration and fixture (child body) definitions, as exported by PhysicsEditor. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {MatterJS.BodyType} A compound Matter JS Body. - */ - parseBody: function (x, y, config, options) - { - if (options === undefined) { options = {}; } +module.exports = Out; - var fixtureConfigs = GetFastValue(config, 'fixtures', []); - var fixtures = []; - for (var fc = 0; fc < fixtureConfigs.length; fc++) - { - var fixtureParts = this.parseFixture(fixtureConfigs[fc]); +/***/ }), - for (var i = 0; i < fixtureParts.length; i++) - { - fixtures.push(fixtureParts[i]); - } - } +/***/ 73214: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var matterConfig = Common.clone(config, true); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - Common.extend(matterConfig, options, true); +/** + * @namespace Phaser.Math.Easing.Circular + */ - delete matterConfig.fixtures; - delete matterConfig.type; +module.exports = { - var body = Body.create(matterConfig); + In: __webpack_require__(86855), + Out: __webpack_require__(18058), + InOut: __webpack_require__(7280) - Body.setParts(body, fixtures); - - Body.setPosition(body, { x: x, y: y }); +}; - return body; - }, - /** - * Parses an element of the "fixtures" list exported by PhysicsEditor - * - * @function Phaser.Physics.Matter.PhysicsEditorParser.parseFixture - * @since 3.10.0 - * - * @param {object} fixtureConfig - The fixture object to parse. - * - * @return {MatterJS.BodyType[]} - An array of Matter JS Bodies. - */ - parseFixture: function (fixtureConfig) - { - var matterConfig = Common.extend({}, false, fixtureConfig); +/***/ }), - delete matterConfig.circle; - delete matterConfig.vertices; +/***/ 91532: +/***/ ((module) => { - var fixtures; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (fixtureConfig.circle) - { - var x = GetFastValue(fixtureConfig.circle, 'x'); - var y = GetFastValue(fixtureConfig.circle, 'y'); - var r = GetFastValue(fixtureConfig.circle, 'radius'); - fixtures = [ Bodies.circle(x, y, r, matterConfig) ]; - } - else if (fixtureConfig.vertices) - { - fixtures = this.parseVertices(fixtureConfig.vertices, matterConfig); - } +/** + * Cubic ease-in. + * + * @function Phaser.Math.Easing.Cubic.In + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var In = function (v) +{ + return v * v * v; +}; - return fixtures; - }, +module.exports = In; - /** - * Parses the "vertices" lists exported by PhysicsEditor. - * - * @function Phaser.Physics.Matter.PhysicsEditorParser.parseVertices - * @since 3.10.0 - * - * @param {array} vertexSets - The vertex lists to parse. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {MatterJS.BodyType[]} - An array of Matter JS Bodies. - */ - parseVertices: function (vertexSets, options) - { - if (options === undefined) { options = {}; } - var parts = []; +/***/ }), - for (var v = 0; v < vertexSets.length; v++) - { - Vertices.clockwiseSort(vertexSets[v]); +/***/ 63180: +/***/ ((module) => { - parts.push(Body.create(Common.extend({ - position: Vertices.centre(vertexSets[v]), - vertices: vertexSets[v] - }, options))); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // flag coincident part edges - return Bodies.flagCoincidentParts(parts); +/** + * Cubic ease-in/out. + * + * @function Phaser.Math.Easing.Cubic.InOut + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var InOut = function (v) +{ + if ((v *= 2) < 1) + { + return 0.5 * v * v * v; + } + else + { + return 0.5 * ((v -= 2) * v * v + 2); } }; -module.exports = PhysicsEditorParser; +module.exports = InOut; /***/ }), -/* 590 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 16518: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bodies = __webpack_require__(86); -var Body = __webpack_require__(41); - /** - * Creates a body using the supplied physics data, as provided by a JSON file. - * - * The data file should be loaded as JSON: - * - * ```javascript - * preload () - * { - * this.load.json('ninjas', 'assets/ninjas.json); - * } - * - * create () - * { - * const ninjaShapes = this.cache.json.get('ninjas'); - * - * this.matter.add.fromJSON(400, 300, ninjaShapes.shinobi); - * } - * ``` - * - * Do not pass the entire JSON file to this method, but instead pass one of the shapes contained within it. - * - * If you pas in an `options` object, any settings in there will override those in the config object. - * - * The structure of the JSON file is as follows: - * - * ```text - * { - * 'generator_info': // The name of the application that created the JSON data - * 'shapeName': { - * 'type': // The type of body - * 'label': // Optional body label - * 'vertices': // An array, or an array of arrays, containing the vertex data in x/y object pairs - * } - * } - * ``` - * - * At the time of writing, only the Phaser Physics Tracer App exports in this format. + * Cubic ease-out. * - * @namespace Phaser.Physics.Matter.PhysicsJSONParser - * @since 3.22.0 + * @function Phaser.Math.Easing.Cubic.Out + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. */ -var PhysicsJSONParser = { +var Out = function (v) +{ + return --v * v * v + 1; +}; - /** - * Parses a body element from the given JSON data. - * - * @function Phaser.Physics.Matter.PhysicsJSONParser.parseBody - * @since 3.22.0 - * - * @param {number} x - The horizontal world location of the body. - * @param {number} y - The vertical world location of the body. - * @param {object} config - The body configuration data. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {MatterJS.BodyType} A Matter JS Body. - */ - parseBody: function (x, y, config, options) - { - if (options === undefined) { options = {}; } +module.exports = Out; - var body; - var vertexSets = config.vertices; - if (vertexSets.length === 1) - { - // Just a single Body - options.vertices = vertexSets[0]; +/***/ }), - body = Body.create(options); +/***/ 71778: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - Bodies.flagCoincidentParts(body.parts); - } - else - { - var parts = []; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - for (var i = 0; i < vertexSets.length; i++) - { - var part = Body.create({ - vertices: vertexSets[i] - }); +/** + * @namespace Phaser.Math.Easing.Cubic + */ - parts.push(part); - } +module.exports = { - Bodies.flagCoincidentParts(parts); + In: __webpack_require__(91532), + Out: __webpack_require__(16518), + InOut: __webpack_require__(63180) - options.parts = parts; +}; - body = Body.create(options); - } - body.label = config.label; +/***/ }), - Body.setPosition(body, { x: x, y: y }); +/***/ 24729: +/***/ ((module) => { - return body; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Elastic ease-in. + * + * @function Phaser.Math.Easing.Elastic.In + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. + * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. + * + * @return {number} The tweened value. + */ +var In = function (v, amplitude, period) +{ + if (amplitude === undefined) { amplitude = 0.1; } + if (period === undefined) { period = 0.1; } + + if (v === 0) + { + return 0; + } + else if (v === 1) + { + return 1; } + else + { + var s = period / 4; + + if (amplitude < 1) + { + amplitude = 1; + } + else + { + s = period * Math.asin(1 / amplitude) / (2 * Math.PI); + } + return -(amplitude * Math.pow(2, 10 * (v -= 1)) * Math.sin((v - s) * (2 * Math.PI) / period)); + } }; -module.exports = PhysicsJSONParser; +module.exports = In; /***/ }), -/* 591 */ -/***/ (function(module, exports, __webpack_require__) { -/** -* The `Matter.Composites` module contains factory methods for creating composite bodies -* with commonly used configurations (such as stacks and chains). -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class Composites -*/ +/***/ 50325: +/***/ ((module) => { -var Composites = {}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = Composites; +/** + * Elastic ease-in/out. + * + * @function Phaser.Math.Easing.Elastic.InOut + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. + * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. + * + * @return {number} The tweened value. + */ +var InOut = function (v, amplitude, period) +{ + if (amplitude === undefined) { amplitude = 0.1; } + if (period === undefined) { period = 0.1; } -var Composite = __webpack_require__(118); -var Constraint = __webpack_require__(128); -var Common = __webpack_require__(32); -var Body = __webpack_require__(41); -var Bodies = __webpack_require__(86); + if (v === 0) + { + return 0; + } + else if (v === 1) + { + return 1; + } + else + { + var s = period / 4; -(function() { + if (amplitude < 1) + { + amplitude = 1; + } + else + { + s = period * Math.asin(1 / amplitude) / (2 * Math.PI); + } - /** - * Create a new composite containing bodies created in the callback in a grid arrangement. - * This function uses the body's bounds to prevent overlaps. - * @method stack - * @param {number} xx - * @param {number} yy - * @param {number} columns - * @param {number} rows - * @param {number} columnGap - * @param {number} rowGap - * @param {function} callback - * @return {composite} A new composite containing objects created in the callback - */ - Composites.stack = function(xx, yy, columns, rows, columnGap, rowGap, callback) { - var stack = Composite.create({ label: 'Stack' }), - x = xx, - y = yy, - lastBody, - i = 0; + if ((v *= 2) < 1) + { + return -0.5 * (amplitude * Math.pow(2, 10 * (v -= 1)) * Math.sin((v - s) * (2 * Math.PI) / period)); + } + else + { + return amplitude * Math.pow(2, -10 * (v -= 1)) * Math.sin((v - s) * (2 * Math.PI) / period) * 0.5 + 1; + } + } +}; - for (var row = 0; row < rows; row++) { - var maxHeight = 0; - - for (var column = 0; column < columns; column++) { - var body = callback(x, y, column, row, lastBody, i); - - if (body) { - var bodyHeight = body.bounds.max.y - body.bounds.min.y, - bodyWidth = body.bounds.max.x - body.bounds.min.x; +module.exports = InOut; - if (bodyHeight > maxHeight) - maxHeight = bodyHeight; - - Body.translate(body, { x: bodyWidth * 0.5, y: bodyHeight * 0.5 }); - x = body.bounds.max.x + columnGap; +/***/ }), - Composite.addBody(stack, body); - - lastBody = body; - i += 1; - } else { - x += columnGap; - } - } - - y += maxHeight + rowGap; - x = xx; - } +/***/ 84074: +/***/ ((module) => { - return stack; - }; - - /** - * Chains all bodies in the given composite together using constraints. - * @method chain - * @param {composite} composite - * @param {number} xOffsetA - * @param {number} yOffsetA - * @param {number} xOffsetB - * @param {number} yOffsetB - * @param {object} options - * @return {composite} A new composite containing objects chained together with constraints - */ - Composites.chain = function(composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options) { - var bodies = composite.bodies; - - for (var i = 1; i < bodies.length; i++) { - var bodyA = bodies[i - 1], - bodyB = bodies[i], - bodyAHeight = bodyA.bounds.max.y - bodyA.bounds.min.y, - bodyAWidth = bodyA.bounds.max.x - bodyA.bounds.min.x, - bodyBHeight = bodyB.bounds.max.y - bodyB.bounds.min.y, - bodyBWidth = bodyB.bounds.max.x - bodyB.bounds.min.x; - - var defaults = { - bodyA: bodyA, - pointA: { x: bodyAWidth * xOffsetA, y: bodyAHeight * yOffsetA }, - bodyB: bodyB, - pointB: { x: bodyBWidth * xOffsetB, y: bodyBHeight * yOffsetB } - }; - - var constraint = Common.extend(defaults, options); - - Composite.addConstraint(composite, Constraint.create(constraint)); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - composite.label += ' Chain'; - - return composite; - }; +/** + * Elastic ease-out. + * + * @function Phaser.Math.Easing.Elastic.Out + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. + * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. + * + * @return {number} The tweened value. + */ +var Out = function (v, amplitude, period) +{ + if (amplitude === undefined) { amplitude = 0.1; } + if (period === undefined) { period = 0.1; } - /** - * Connects bodies in the composite with constraints in a grid pattern, with optional cross braces. - * @method mesh - * @param {composite} composite - * @param {number} columns - * @param {number} rows - * @param {boolean} crossBrace - * @param {object} options - * @return {composite} The composite containing objects meshed together with constraints - */ - Composites.mesh = function(composite, columns, rows, crossBrace, options) { - var bodies = composite.bodies, - row, - col, - bodyA, - bodyB, - bodyC; - - for (row = 0; row < rows; row++) { - for (col = 1; col < columns; col++) { - bodyA = bodies[(col - 1) + (row * columns)]; - bodyB = bodies[col + (row * columns)]; - Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options))); - } + if (v === 0) + { + return 0; + } + else if (v === 1) + { + return 1; + } + else + { + var s = period / 4; - if (row > 0) { - for (col = 0; col < columns; col++) { - bodyA = bodies[col + ((row - 1) * columns)]; - bodyB = bodies[col + (row * columns)]; - Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options))); + if (amplitude < 1) + { + amplitude = 1; + } + else + { + s = period * Math.asin(1 / amplitude) / (2 * Math.PI); + } - if (crossBrace && col > 0) { - bodyC = bodies[(col - 1) + ((row - 1) * columns)]; - Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyC, bodyB: bodyB }, options))); - } + return (amplitude * Math.pow(2, -10 * v) * Math.sin((v - s) * (2 * Math.PI) / period) + 1); + } +}; - if (crossBrace && col < columns - 1) { - bodyC = bodies[(col + 1) + ((row - 1) * columns)]; - Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyC, bodyB: bodyB }, options))); - } - } - } - } +module.exports = Out; - composite.label += ' Mesh'; - - return composite; - }; - - /** - * Create a new composite containing bodies created in the callback in a pyramid arrangement. - * This function uses the body's bounds to prevent overlaps. - * @method pyramid - * @param {number} xx - * @param {number} yy - * @param {number} columns - * @param {number} rows - * @param {number} columnGap - * @param {number} rowGap - * @param {function} callback - * @return {composite} A new composite containing objects created in the callback - */ - Composites.pyramid = function(xx, yy, columns, rows, columnGap, rowGap, callback) { - return Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function(x, y, column, row, lastBody, i) { - var actualRows = Math.min(rows, Math.ceil(columns / 2)), - lastBodyWidth = lastBody ? lastBody.bounds.max.x - lastBody.bounds.min.x : 0; - - if (row > actualRows) - return; - - // reverse row order - row = actualRows - row; - - var start = row, - end = columns - 1 - row; - if (column < start || column > end) - return; - - // retroactively fix the first body's position, since width was unknown - if (i === 1) { - Body.translate(lastBody, { x: (column + (columns % 2 === 1 ? 1 : -1)) * lastBodyWidth, y: 0 }); - } +/***/ }), - var xOffset = lastBody ? column * lastBodyWidth : 0; - - return callback(xx + xOffset + column * columnGap, y, column, row, lastBody, i); - }); - }; +/***/ 36468: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Creates a composite with a Newton's Cradle setup of bodies and constraints. - * @method newtonsCradle - * @param {number} xx - * @param {number} yy - * @param {number} number - * @param {number} size - * @param {number} length - * @return {composite} A new composite newtonsCradle body - */ - Composites.newtonsCradle = function(xx, yy, number, size, length) { - var newtonsCradle = Composite.create({ label: 'Newtons Cradle' }); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - for (var i = 0; i < number; i++) { - var separation = 1.9, - circle = Bodies.circle(xx + i * (size * separation), yy + length, size, - { inertia: Infinity, restitution: 1, friction: 0, frictionAir: 0.0001, slop: 1 }), - constraint = Constraint.create({ pointA: { x: xx + i * (size * separation), y: yy }, bodyB: circle }); +/** + * @namespace Phaser.Math.Easing.Elastic + */ - Composite.addBody(newtonsCradle, circle); - Composite.addConstraint(newtonsCradle, constraint); - } +module.exports = { - return newtonsCradle; - }; - - /** - * Creates a composite with simple car setup of bodies and constraints. - * @method car - * @param {number} xx - * @param {number} yy - * @param {number} width - * @param {number} height - * @param {number} wheelSize - * @return {composite} A new composite car body - */ - Composites.car = function(xx, yy, width, height, wheelSize) { - var group = Body.nextGroup(true), - wheelBase = 20, - wheelAOffset = -width * 0.5 + wheelBase, - wheelBOffset = width * 0.5 - wheelBase, - wheelYOffset = 0; - - var car = Composite.create({ label: 'Car' }), - body = Bodies.rectangle(xx, yy, width, height, { - collisionFilter: { - group: group - }, - chamfer: { - radius: height * 0.5 - }, - density: 0.0002 - }); - - var wheelA = Bodies.circle(xx + wheelAOffset, yy + wheelYOffset, wheelSize, { - collisionFilter: { - group: group - }, - friction: 0.8 - }); - - var wheelB = Bodies.circle(xx + wheelBOffset, yy + wheelYOffset, wheelSize, { - collisionFilter: { - group: group - }, - friction: 0.8 - }); - - var axelA = Constraint.create({ - bodyB: body, - pointB: { x: wheelAOffset, y: wheelYOffset }, - bodyA: wheelA, - stiffness: 1, - length: 0 - }); - - var axelB = Constraint.create({ - bodyB: body, - pointB: { x: wheelBOffset, y: wheelYOffset }, - bodyA: wheelB, - stiffness: 1, - length: 0 - }); - - Composite.addBody(car, body); - Composite.addBody(car, wheelA); - Composite.addBody(car, wheelB); - Composite.addConstraint(car, axelA); - Composite.addConstraint(car, axelB); + In: __webpack_require__(24729), + Out: __webpack_require__(84074), + InOut: __webpack_require__(50325) - return car; - }; +}; - /** - * Creates a simple soft body like object. - * @method softBody - * @param {number} xx - * @param {number} yy - * @param {number} columns - * @param {number} rows - * @param {number} columnGap - * @param {number} rowGap - * @param {boolean} crossBrace - * @param {number} particleRadius - * @param {} particleOptions - * @param {} constraintOptions - * @return {composite} A new composite softBody - */ - Composites.softBody = function(xx, yy, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions) { - particleOptions = Common.extend({ inertia: Infinity }, particleOptions); - constraintOptions = Common.extend({ stiffness: 0.2, render: { type: 'line', anchors: false } }, constraintOptions); - var softBody = Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function(x, y) { - return Bodies.circle(x, y, particleRadius, particleOptions); - }); +/***/ }), - Composites.mesh(softBody, columns, rows, crossBrace, constraintOptions); +/***/ 95638: +/***/ ((module) => { - softBody.label = 'Soft Body'; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return softBody; - }; +/** + * Exponential ease-in. + * + * @function Phaser.Math.Easing.Expo.In + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var In = function (v) +{ + return Math.pow(2, 10 * (v - 1)) - 0.001; +}; -})(); +module.exports = In; /***/ }), -/* 592 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 10357: +/***/ ((module) => { /** -* The `Matter.Svg` module contains methods for converting SVG images into an array of vector points. -* -* To use this module you also need the SVGPathSeg polyfill: https://github.com/progers/pathseg -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class Svg -*/ + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -var Svg = {}; +/** + * Exponential ease-in/out. + * + * @function Phaser.Math.Easing.Expo.InOut + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var InOut = function (v) +{ + if ((v *= 2) < 1) + { + return 0.5 * Math.pow(2, 10 * (v - 1)); + } + else + { + return 0.5 * (2 - Math.pow(2, -10 * (v - 1))); + } +}; -module.exports = Svg; +module.exports = InOut; -var Bounds = __webpack_require__(84); -var Common = __webpack_require__(32); -(function() { +/***/ }), - /** - * Converts an SVG path into an array of vector points. - * If the input path forms a concave shape, you must decompose the result into convex parts before use. - * See `Bodies.fromVertices` which provides support for this. - * Note that this function is not guaranteed to support complex paths (such as those with holes). - * You must load the `pathseg.js` polyfill on newer browsers. - * @method pathToVertices - * @param {SVGPathElement} path - * @param {Number} [sampleLength=15] - * @return {Vector[]} points - */ - Svg.pathToVertices = function(path, sampleLength) { - if (typeof window !== 'undefined' && !('SVGPathSeg' in window)) { - Common.warn('Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.'); - } +/***/ 14894: +/***/ ((module) => { - // https://github.com/wout/svg.topoly.js/blob/master/svg.topoly.js - var i, il, total, point, segment, segments, - segmentsQueue, lastSegment, - lastPoint, segmentIndex, points = [], - lx, ly, length = 0, x = 0, y = 0; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - sampleLength = sampleLength || 15; +/** + * Exponential ease-out. + * + * @function Phaser.Math.Easing.Expo.Out + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var Out = function (v) +{ + return 1 - Math.pow(2, -10 * v); +}; - var addPoint = function(px, py, pathSegType) { - // all odd-numbered path types are relative except PATHSEG_CLOSEPATH (1) - var isRelative = pathSegType % 2 === 1 && pathSegType > 1; +module.exports = Out; - // when the last point doesn't equal the current point add the current point - if (!lastPoint || px != lastPoint.x || py != lastPoint.y) { - if (lastPoint && isRelative) { - lx = lastPoint.x; - ly = lastPoint.y; - } else { - lx = 0; - ly = 0; - } - var point = { - x: lx + px, - y: ly + py - }; +/***/ }), - // set last point - if (isRelative || !lastPoint) { - lastPoint = point; - } +/***/ 88258: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - points.push(point); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - x = lx + px; - y = ly + py; - } - }; +/** + * @namespace Phaser.Math.Easing.Expo + */ - var addSegmentPoint = function(segment) { - var segType = segment.pathSegTypeAsLetter.toUpperCase(); +module.exports = { - // skip path ends - if (segType === 'Z') - return; + In: __webpack_require__(95638), + Out: __webpack_require__(14894), + InOut: __webpack_require__(10357) - // map segment to x and y - switch (segType) { +}; - case 'M': - case 'L': - case 'T': - case 'C': - case 'S': - case 'Q': - x = segment.x; - y = segment.y; - break; - case 'H': - x = segment.x; - break; - case 'V': - y = segment.y; - break; - } - addPoint(x, y, segment.pathSegType); - }; +/***/ }), - // ensure path is absolute - Svg._svgPathToAbsolute(path); +/***/ 33063: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // get total length - total = path.getTotalLength(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // queue segments - segments = []; - for (i = 0; i < path.pathSegList.numberOfItems; i += 1) - segments.push(path.pathSegList.getItem(i)); +/** + * @namespace Phaser.Math.Easing + */ - segmentsQueue = segments.concat(); +module.exports = { - // sample through path - while (length < total) { - // get segment at position - segmentIndex = path.getPathSegAtLength(length); - segment = segments[segmentIndex]; + Back: __webpack_require__(25265), + Bounce: __webpack_require__(57428), + Circular: __webpack_require__(73214), + Cubic: __webpack_require__(71778), + Elastic: __webpack_require__(36468), + Expo: __webpack_require__(88258), + Linear: __webpack_require__(52910), + Quadratic: __webpack_require__(67799), + Quartic: __webpack_require__(74083), + Quintic: __webpack_require__(92284), + Sine: __webpack_require__(28035), + Stepped: __webpack_require__(8754) - // new segment - if (segment != lastSegment) { - while (segmentsQueue.length && segmentsQueue[0] != segment) - addSegmentPoint(segmentsQueue.shift()); +}; - lastSegment = segment; - } - // add points in between when curving - // TODO: adaptive sampling - switch (segment.pathSegTypeAsLetter.toUpperCase()) { +/***/ }), - case 'C': - case 'T': - case 'S': - case 'Q': - case 'A': - point = path.getPointAtLength(length); - addPoint(point.x, point.y, 0); - break; +/***/ 43927: +/***/ ((module) => { - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // increment by sample value - length += sampleLength; - } +/** + * Linear easing (no variation). + * + * @function Phaser.Math.Easing.Linear + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var Linear = function (v) +{ + return v; +}; - // add remaining segments not passed by sampling - for (i = 0, il = segmentsQueue.length; i < il; ++i) - addSegmentPoint(segmentsQueue[i]); +module.exports = Linear; - return points; - }; - Svg._svgPathToAbsolute = function(path) { - // http://phrogz.net/convert-svg-path-to-all-absolute-commands - // Copyright (c) Gavin Kistner - // http://phrogz.net/js/_ReuseLicense.txt - // Modifications: tidy formatting and naming - var x0, y0, x1, y1, x2, y2, segs = path.pathSegList, - x = 0, y = 0, len = segs.numberOfItems; +/***/ }), - for (var i = 0; i < len; ++i) { - var seg = segs.getItem(i), - segType = seg.pathSegTypeAsLetter; +/***/ 52910: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (/[MLHVCSQTA]/.test(segType)) { - if ('x' in seg) x = seg.x; - if ('y' in seg) y = seg.y; - } else { - if ('x1' in seg) x1 = x + seg.x1; - if ('x2' in seg) x2 = x + seg.x2; - if ('y1' in seg) y1 = y + seg.y1; - if ('y2' in seg) y2 = y + seg.y2; - if ('x' in seg) x += seg.x; - if ('y' in seg) y += seg.y; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - switch (segType) { +module.exports = __webpack_require__(43927); - case 'm': - segs.replaceItem(path.createSVGPathSegMovetoAbs(x, y), i); - break; - case 'l': - segs.replaceItem(path.createSVGPathSegLinetoAbs(x, y), i); - break; - case 'h': - segs.replaceItem(path.createSVGPathSegLinetoHorizontalAbs(x), i); - break; - case 'v': - segs.replaceItem(path.createSVGPathSegLinetoVerticalAbs(y), i); - break; - case 'c': - segs.replaceItem(path.createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2), i); - break; - case 's': - segs.replaceItem(path.createSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2), i); - break; - case 'q': - segs.replaceItem(path.createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1), i); - break; - case 't': - segs.replaceItem(path.createSVGPathSegCurvetoQuadraticSmoothAbs(x, y), i); - break; - case 'a': - segs.replaceItem(path.createSVGPathSegArcAbs(x, y, seg.r1, seg.r2, seg.angle, seg.largeArcFlag, seg.sweepFlag), i); - break; - case 'z': - case 'Z': - x = x0; - y = y0; - break; - } - } +/***/ }), - if (segType == 'M' || segType == 'm') { - x0 = x; - y0 = y; - } - } - }; +/***/ 77471: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Quadratic ease-in. + * + * @function Phaser.Math.Easing.Quadratic.In + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var In = function (v) +{ + return v * v; +}; + +module.exports = In; -})(); /***/ }), -/* 593 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 83863: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bodies = __webpack_require__(86); -var Body = __webpack_require__(41); -var Class = __webpack_require__(0); -var Components = __webpack_require__(249); -var EventEmitter = __webpack_require__(9); -var GetFastValue = __webpack_require__(2); -var HasValue = __webpack_require__(126); -var Vertices = __webpack_require__(64); - /** - * @classdesc - * A wrapper around a Tile that provides access to a corresponding Matter body. A tile can only - * have one Matter body associated with it. You can either pass in an existing Matter body for - * the tile or allow the constructor to create the corresponding body for you. If the Tile has a - * collision group (defined in Tiled), those shapes will be used to create the body. If not, the - * tile's rectangle bounding box will be used. - * - * The corresponding body will be accessible on the Tile itself via Tile.physics.matterBody. - * - * Note: not all Tiled collision shapes are supported. See - * Phaser.Physics.Matter.TileBody#setFromTileCollision for more information. + * Quadratic ease-in/out. * - * @class TileBody - * @memberof Phaser.Physics.Matter - * @extends Phaser.Events.EventEmitter - * @constructor + * @function Phaser.Math.Easing.Quadratic.InOut * @since 3.0.0 * - * @extends Phaser.Physics.Matter.Components.Bounce - * @extends Phaser.Physics.Matter.Components.Collision - * @extends Phaser.Physics.Matter.Components.Friction - * @extends Phaser.Physics.Matter.Components.Gravity - * @extends Phaser.Physics.Matter.Components.Mass - * @extends Phaser.Physics.Matter.Components.Sensor - * @extends Phaser.Physics.Matter.Components.Sleep - * @extends Phaser.Physics.Matter.Components.Static + * @param {number} v - The value to be tweened. * - * @param {Phaser.Physics.Matter.World} world - The Matter world instance this body belongs to. - * @param {Phaser.Tilemaps.Tile} tile - The target tile that should have a Matter body. - * @param {Phaser.Types.Physics.Matter.MatterTileOptions} [options] - Options to be used when creating the Matter body. + * @return {number} The tweened value. */ -var MatterTileBody = new Class({ +var InOut = function (v) +{ + if ((v *= 2) < 1) + { + return 0.5 * v * v; + } + else + { + return -0.5 * (--v * (v - 2) - 1); + } +}; - Extends: EventEmitter, +module.exports = InOut; - Mixins: [ - Components.Bounce, - Components.Collision, - Components.Friction, - Components.Gravity, - Components.Mass, - Components.Sensor, - Components.Sleep, - Components.Static - ], - initialize: +/***/ }), - function MatterTileBody (world, tile, options) - { - EventEmitter.call(this); +/***/ 44383: +/***/ ((module) => { - /** - * The tile object the body is associated with. - * - * @name Phaser.Physics.Matter.TileBody#tile - * @type {Phaser.Tilemaps.Tile} - * @since 3.0.0 - */ - this.tile = tile; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The Matter world the body exists within. - * - * @name Phaser.Physics.Matter.TileBody#world - * @type {Phaser.Physics.Matter.World} - * @since 3.0.0 - */ - this.world = world; +/** + * Quadratic ease-out. + * + * @function Phaser.Math.Easing.Quadratic.Out + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var Out = function (v) +{ + return v * (2 - v); +}; - // Install a reference to 'this' on the tile and ensure there can only be one matter body - // associated with the tile - if (tile.physics.matterBody) - { - tile.physics.matterBody.destroy(); - } +module.exports = Out; - tile.physics.matterBody = this; - // Set the body either from an existing body (if provided), the shapes in the tileset - // collision layer (if it exists) or a rectangle matching the tile. - var body = GetFastValue(options, 'body', null); +/***/ }), - var addToWorld = GetFastValue(options, 'addToWorld', true); +/***/ 67799: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (!body) - { - var collisionGroup = tile.getCollisionGroup(); - var collisionObjects = GetFastValue(collisionGroup, 'objects', []); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (collisionObjects.length > 0) - { - this.setFromTileCollision(options); - } - else - { - this.setFromTileRectangle(options); - } - } - else - { - this.setBody(body, addToWorld); - } - }, +/** + * @namespace Phaser.Math.Easing.Quadratic + */ - /** - * Sets the current body to a rectangle that matches the bounds of the tile. - * - * @method Phaser.Physics.Matter.TileBody#setFromTileRectangle - * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBodyTileOptions} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. - * - * @return {Phaser.Physics.Matter.TileBody} This TileBody object. - */ - setFromTileRectangle: function (options) - { - if (options === undefined) { options = {}; } - if (!HasValue(options, 'isStatic')) { options.isStatic = true; } - if (!HasValue(options, 'addToWorld')) { options.addToWorld = true; } +module.exports = { - var bounds = this.tile.getBounds(); - var cx = bounds.x + (bounds.width / 2); - var cy = bounds.y + (bounds.height / 2); - var body = Bodies.rectangle(cx, cy, bounds.width, bounds.height, options); + In: __webpack_require__(77471), + Out: __webpack_require__(44383), + InOut: __webpack_require__(83863) - this.setBody(body, options.addToWorld); +}; - return this; - }, - /** - * Sets the current body from the collision group associated with the Tile. This is typically - * set up in Tiled's collision editor. - * - * Note: Matter doesn't support all shapes from Tiled. Rectangles and polygons are directly - * supported. Ellipses are converted into circle bodies. Polylines are treated as if they are - * closed polygons. If a tile has multiple shapes, a multi-part body will be created. Concave - * shapes are supported if poly-decomp library is included. Decomposition is not guaranteed to - * work for complex shapes (e.g. holes), so it's often best to manually decompose a concave - * polygon into multiple convex polygons yourself. - * - * @method Phaser.Physics.Matter.TileBody#setFromTileCollision - * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBodyTileOptions} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. - * - * @return {Phaser.Physics.Matter.TileBody} This TileBody object. - */ - setFromTileCollision: function (options) - { - if (options === undefined) { options = {}; } - if (!HasValue(options, 'isStatic')) { options.isStatic = true; } - if (!HasValue(options, 'addToWorld')) { options.addToWorld = true; } +/***/ }), - var sx = this.tile.tilemapLayer.scaleX; - var sy = this.tile.tilemapLayer.scaleY; - var tileX = this.tile.getLeft(); - var tileY = this.tile.getTop(); - var collisionGroup = this.tile.getCollisionGroup(); - var collisionObjects = GetFastValue(collisionGroup, 'objects', []); +/***/ 48311: +/***/ ((module) => { - var parts = []; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - for (var i = 0; i < collisionObjects.length; i++) - { - var object = collisionObjects[i]; - var ox = tileX + (object.x * sx); - var oy = tileY + (object.y * sy); - var ow = object.width * sx; - var oh = object.height * sy; - var body = null; +/** + * Quartic ease-in. + * + * @function Phaser.Math.Easing.Quartic.In + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var In = function (v) +{ + return v * v * v * v; +}; - if (object.rectangle) - { - body = Bodies.rectangle(ox + ow / 2, oy + oh / 2, ow, oh, options); - } - else if (object.ellipse) - { - body = Bodies.circle(ox + ow / 2, oy + oh / 2, ow / 2, options); - } - else if (object.polygon || object.polyline) - { - // Polygons and polylines are both treated as closed polygons - var originalPoints = object.polygon ? object.polygon : object.polyline; +module.exports = In; - var points = originalPoints.map(function (p) - { - return { x: p.x * sx, y: p.y * sy }; - }); - var vertices = Vertices.create(points); +/***/ }), - // Points are relative to the object's origin (first point placed in Tiled), but - // matter expects points to be relative to the center of mass. This only applies to - // convex shapes. When a concave shape is decomposed, multiple parts are created and - // the individual parts are positioned relative to (ox, oy). - // - // Update: 8th January 2019 - the latest version of Matter needs the Vertices adjusted, - // regardless if convex or concave. +/***/ 55248: +/***/ ((module) => { - var center = Vertices.centre(vertices); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - ox += center.x; - oy += center.y; +/** + * Quartic ease-in/out. + * + * @function Phaser.Math.Easing.Quartic.InOut + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var InOut = function (v) +{ + if ((v *= 2) < 1) + { + return 0.5 * v * v * v * v; + } + else + { + return -0.5 * ((v -= 2) * v * v * v - 2); + } +}; - body = Bodies.fromVertices(ox, oy, vertices, options); - } +module.exports = InOut; - if (body) - { - parts.push(body); - } - } - if (parts.length === 1) - { - this.setBody(parts[0], options.addToWorld); - } - else if (parts.length > 1) - { - options.parts = parts; - this.setBody(Body.create(options), options.addToWorld); - } +/***/ }), - return this; - }, +/***/ 23135: +/***/ ((module) => { - /** - * Sets the current body to the given body. This will remove the previous body, if one already - * exists. - * - * @method Phaser.Physics.Matter.TileBody#setBody - * @since 3.0.0 - * - * @param {MatterJS.BodyType} body - The new Matter body to use. - * @param {boolean} [addToWorld=true] - Whether or not to add the body to the Matter world. - * - * @return {Phaser.Physics.Matter.TileBody} This TileBody object. - */ - setBody: function (body, addToWorld) - { - if (addToWorld === undefined) { addToWorld = true; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (this.body) - { - this.removeBody(); - } +/** + * Quartic ease-out. + * + * @function Phaser.Math.Easing.Quartic.Out + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var Out = function (v) +{ + return 1 - (--v * v * v * v); +}; - this.body = body; - this.body.gameObject = this; +module.exports = Out; - if (addToWorld) - { - this.world.add(this.body); - } - return this; - }, +/***/ }), - /** - * Removes the current body from the TileBody and from the Matter world - * - * @method Phaser.Physics.Matter.TileBody#removeBody - * @since 3.0.0 - * - * @return {Phaser.Physics.Matter.TileBody} This TileBody object. - */ - removeBody: function () - { - if (this.body) - { - this.world.remove(this.body); - this.body.gameObject = undefined; - this.body = undefined; - } +/***/ 74083: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Removes the current body from the tile and the world. - * - * @method Phaser.Physics.Matter.TileBody#destroy - * @since 3.0.0 - * - * @return {Phaser.Physics.Matter.TileBody} This TileBody object. - */ - destroy: function () - { - this.removeBody(); - this.tile.physics.matterBody = undefined; - this.removeAllListeners(); - } +/** + * @namespace Phaser.Math.Easing.Quartic + */ -}); +module.exports = { -module.exports = MatterTileBody; + In: __webpack_require__(48311), + Out: __webpack_require__(23135), + InOut: __webpack_require__(55248) + +}; /***/ }), -/* 594 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 7313: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @namespace Phaser.Physics.Matter.Matter + * Quintic ease-in. + * + * @function Phaser.Math.Easing.Quintic.In + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. */ +var In = function (v) +{ + return v * v * v * v * v; +}; -var Matter = __webpack_require__(1399); - -Matter.Body = __webpack_require__(41); -Matter.Composite = __webpack_require__(118); -Matter.World = __webpack_require__(596); - -Matter.Detector = __webpack_require__(273); -Matter.Grid = __webpack_require__(597); -Matter.Pairs = __webpack_require__(598); -Matter.Pair = __webpack_require__(250); -Matter.Query = __webpack_require__(1400); -Matter.Resolver = __webpack_require__(599); -Matter.SAT = __webpack_require__(274); - -Matter.Constraint = __webpack_require__(128); +module.exports = In; -Matter.Common = __webpack_require__(32); -Matter.Engine = __webpack_require__(1401); -Matter.Events = __webpack_require__(166); -Matter.Sleeping = __webpack_require__(165); -Matter.Plugin = __webpack_require__(595); -Matter.Bodies = __webpack_require__(86); -Matter.Composites = __webpack_require__(591); +/***/ }), -Matter.Axes = __webpack_require__(271); -Matter.Bounds = __webpack_require__(84); -Matter.Svg = __webpack_require__(592); -Matter.Vector = __webpack_require__(83); -Matter.Vertices = __webpack_require__(64); +/***/ 98759: +/***/ ((module) => { -// aliases +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -Matter.World.add = Matter.Composite.add; -Matter.World.remove = Matter.Composite.remove; -Matter.World.addComposite = Matter.Composite.addComposite; -Matter.World.addBody = Matter.Composite.addBody; -Matter.World.addConstraint = Matter.Composite.addConstraint; -Matter.World.clear = Matter.Composite.clear; +/** + * Quintic ease-in/out. + * + * @function Phaser.Math.Easing.Quintic.InOut + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var InOut = function (v) +{ + if ((v *= 2) < 1) + { + return 0.5 * v * v * v * v * v; + } + else + { + return 0.5 * ((v -= 2) * v * v * v * v + 2); + } +}; -module.exports = Matter; +module.exports = InOut; /***/ }), -/* 595 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 26670: +/***/ ((module) => { /** -* The `Matter.Plugin` module contains functions for registering and installing plugins on modules. -* -* @class Plugin -*/ + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -var Plugin = {}; +/** + * Quintic ease-out. + * + * @function Phaser.Math.Easing.Quintic.Out + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var Out = function (v) +{ + return --v * v * v * v * v + 1; +}; -module.exports = Plugin; +module.exports = Out; -var Common = __webpack_require__(32); -(function() { +/***/ }), - Plugin._registry = {}; +/***/ 92284: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Registers a plugin object so it can be resolved later by name. - * @method register - * @param plugin {} The plugin to register. - * @return {object} The plugin. - */ - Plugin.register = function(plugin) { - if (!Plugin.isPlugin(plugin)) { - Common.warn('Plugin.register:', Plugin.toString(plugin), 'does not implement all required fields.'); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (plugin.name in Plugin._registry) { - var registered = Plugin._registry[plugin.name], - pluginVersion = Plugin.versionParse(plugin.version).number, - registeredVersion = Plugin.versionParse(registered.version).number; +/** + * @namespace Phaser.Math.Easing.Quintic + */ - if (pluginVersion > registeredVersion) { - Common.warn('Plugin.register:', Plugin.toString(registered), 'was upgraded to', Plugin.toString(plugin)); - Plugin._registry[plugin.name] = plugin; - } else if (pluginVersion < registeredVersion) { - Common.warn('Plugin.register:', Plugin.toString(registered), 'can not be downgraded to', Plugin.toString(plugin)); - } else if (plugin !== registered) { - Common.warn('Plugin.register:', Plugin.toString(plugin), 'is already registered to different plugin object'); - } - } else { - Plugin._registry[plugin.name] = plugin; - } +module.exports = { - return plugin; - }; + In: __webpack_require__(7313), + Out: __webpack_require__(26670), + InOut: __webpack_require__(98759) - /** - * Resolves a dependency to a plugin object from the registry if it exists. - * The `dependency` may contain a version, but only the name matters when resolving. - * @method resolve - * @param dependency {string} The dependency. - * @return {object} The plugin if resolved, otherwise `undefined`. - */ - Plugin.resolve = function(dependency) { - return Plugin._registry[Plugin.dependencyParse(dependency).name]; - }; +}; - /** - * Returns a pretty printed plugin name and version. - * @method toString - * @param plugin {} The plugin. - * @return {string} Pretty printed plugin name and version. - */ - Plugin.toString = function(plugin) { - return typeof plugin === 'string' ? plugin : (plugin.name || 'anonymous') + '@' + (plugin.version || plugin.range || '0.0.0'); - }; - /** - * Returns `true` if the object meets the minimum standard to be considered a plugin. - * This means it must define the following properties: - * - `name` - * - `version` - * - `install` - * @method isPlugin - * @param obj {} The obj to test. - * @return {boolean} `true` if the object can be considered a plugin otherwise `false`. - */ - Plugin.isPlugin = function(obj) { - return obj && obj.name && obj.version && obj.install; - }; +/***/ }), - /** - * Returns `true` if a plugin with the given `name` been installed on `module`. - * @method isUsed - * @param module {} The module. - * @param name {string} The plugin name. - * @return {boolean} `true` if a plugin with the given `name` been installed on `module`, otherwise `false`. - */ - Plugin.isUsed = function(module, name) { - return module.used.indexOf(name) > -1; - }; +/***/ 52929: +/***/ ((module) => { - /** - * Returns `true` if `plugin.for` is applicable to `module` by comparing against `module.name` and `module.version`. - * If `plugin.for` is not specified then it is assumed to be applicable. - * The value of `plugin.for` is a string of the format `'module-name'` or `'module-name@version'`. - * @method isFor - * @param plugin {} The plugin. - * @param module {} The module. - * @return {boolean} `true` if `plugin.for` is applicable to `module`, otherwise `false`. - */ - Plugin.isFor = function(plugin, module) { - var parsed = plugin.for && Plugin.dependencyParse(plugin.for); - return !plugin.for || (module.name === parsed.name && Plugin.versionSatisfies(module.version, parsed.range)); - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Installs the plugins by calling `plugin.install` on each plugin specified in `plugins` if passed, otherwise `module.uses`. - * For installing plugins on `Matter` see the convenience function `Matter.use`. - * Plugins may be specified either by their name or a reference to the plugin object. - * Plugins themselves may specify further dependencies, but each plugin is installed only once. - * Order is important, a topological sort is performed to find the best resulting order of installation. - * This sorting attempts to satisfy every dependency's requested ordering, but may not be exact in all cases. - * This function logs the resulting status of each dependency in the console, along with any warnings. - * - A green tick ✅ indicates a dependency was resolved and installed. - * - An orange diamond 🔶 indicates a dependency was resolved but a warning was thrown for it or one if its dependencies. - * - A red cross ❌ indicates a dependency could not be resolved. - * Avoid calling this function multiple times on the same module unless you intend to manually control installation order. - * @method use - * @param module {} The module install plugins on. - * @param [plugins=module.uses] {} The plugins to install on module (optional, defaults to `module.uses`). - */ - Plugin.use = function(module, plugins) { - module.uses = (module.uses || []).concat(plugins || []); +/** + * Sinusoidal ease-in. + * + * @function Phaser.Math.Easing.Sine.In + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var In = function (v) +{ + if (v === 0) + { + return 0; + } + else if (v === 1) + { + return 1; + } + else + { + return 1 - Math.cos(v * Math.PI / 2); + } +}; - if (module.uses.length === 0) { - Common.warn('Plugin.use:', Plugin.toString(module), 'does not specify any dependencies to install.'); - return; - } +module.exports = In; - var dependencies = Plugin.dependencies(module), - sortedDependencies = Common.topologicalSort(dependencies), - status = []; - for (var i = 0; i < sortedDependencies.length; i += 1) { - if (sortedDependencies[i] === module.name) { - continue; - } +/***/ }), - var plugin = Plugin.resolve(sortedDependencies[i]); +/***/ 66333: +/***/ ((module) => { - if (!plugin) { - status.push('❌ ' + sortedDependencies[i]); - continue; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (Plugin.isUsed(module, plugin.name)) { - continue; - } +/** + * Sinusoidal ease-in/out. + * + * @function Phaser.Math.Easing.Sine.InOut + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var InOut = function (v) +{ + if (v === 0) + { + return 0; + } + else if (v === 1) + { + return 1; + } + else + { + return 0.5 * (1 - Math.cos(Math.PI * v)); + } +}; - if (!Plugin.isFor(plugin, module)) { - Common.warn('Plugin.use:', Plugin.toString(plugin), 'is for', plugin.for, 'but installed on', Plugin.toString(module) + '.'); - plugin._warned = true; - } +module.exports = InOut; - if (plugin.install) { - plugin.install(module); - } else { - Common.warn('Plugin.use:', Plugin.toString(plugin), 'does not specify an install function.'); - plugin._warned = true; - } - if (plugin._warned) { - status.push('🔶 ' + Plugin.toString(plugin)); - delete plugin._warned; - } else { - status.push('✅ ' + Plugin.toString(plugin)); - } +/***/ }), - module.used.push(plugin.name); - } +/***/ 37255: +/***/ ((module) => { - if (status.length > 0 && !plugin.silent) { - Common.info(status.join(' ')); - } - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Recursively finds all of a module's dependencies and returns a flat dependency graph. - * @method dependencies - * @param module {} The module. - * @return {object} A dependency graph. - */ - Plugin.dependencies = function(module, tracked) { - var parsedBase = Plugin.dependencyParse(module), - name = parsedBase.name; +/** + * Sinusoidal ease-out. + * + * @function Phaser.Math.Easing.Sine.Out + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * + * @return {number} The tweened value. + */ +var Out = function (v) +{ + if (v === 0) + { + return 0; + } + else if (v === 1) + { + return 1; + } + else + { + return Math.sin(v * Math.PI / 2); + } +}; - tracked = tracked || {}; +module.exports = Out; - if (name in tracked) { - return; - } - module = Plugin.resolve(module) || module; +/***/ }), - tracked[name] = Common.map(module.uses || [], function(dependency) { - if (Plugin.isPlugin(dependency)) { - Plugin.register(dependency); - } +/***/ 28035: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var parsed = Plugin.dependencyParse(dependency), - resolved = Plugin.resolve(dependency); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (resolved && !Plugin.versionSatisfies(resolved.version, parsed.range)) { - Common.warn( - 'Plugin.dependencies:', Plugin.toString(resolved), 'does not satisfy', - Plugin.toString(parsed), 'used by', Plugin.toString(parsedBase) + '.' - ); +/** + * @namespace Phaser.Math.Easing.Sine + */ - resolved._warned = true; - module._warned = true; - } else if (!resolved) { - Common.warn( - 'Plugin.dependencies:', Plugin.toString(dependency), 'used by', - Plugin.toString(parsedBase), 'could not be resolved.' - ); +module.exports = { - module._warned = true; - } + In: __webpack_require__(52929), + Out: __webpack_require__(37255), + InOut: __webpack_require__(66333) - return parsed.name; - }); +}; - for (var i = 0; i < tracked[name].length; i += 1) { - Plugin.dependencies(tracked[name][i], tracked); - } - return tracked; - }; +/***/ }), - /** - * Parses a dependency string into its components. - * The `dependency` is a string of the format `'module-name'` or `'module-name@version'`. - * See documentation for `Plugin.versionParse` for a description of the format. - * This function can also handle dependencies that are already resolved (e.g. a module object). - * @method dependencyParse - * @param dependency {string} The dependency of the format `'module-name'` or `'module-name@version'`. - * @return {object} The dependency parsed into its components. - */ - Plugin.dependencyParse = function(dependency) { - if (Common.isString(dependency)) { - var pattern = /^[\w-]+(@(\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-]+)?))?$/; +/***/ 52770: +/***/ ((module) => { - if (!pattern.test(dependency)) { - Common.warn('Plugin.dependencyParse:', dependency, 'is not a valid dependency string.'); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return { - name: dependency.split('@')[0], - range: dependency.split('@')[1] || '*' - }; - } +/** + * Stepped easing. + * + * @function Phaser.Math.Easing.Stepped + * @since 3.0.0 + * + * @param {number} v - The value to be tweened. + * @param {number} [steps=1] - The number of steps in the ease. + * + * @return {number} The tweened value. + */ +var Stepped = function (v, steps) +{ + if (steps === undefined) { steps = 1; } - return { - name: dependency.name, - range: dependency.range || dependency.version - }; - }; + if (v <= 0) + { + return 0; + } + else if (v >= 1) + { + return 1; + } + else + { + return (((steps * v) | 0) + 1) * (1 / steps); + } +}; - /** - * Parses a version string into its components. - * Versions are strictly of the format `x.y.z` (as in [semver](http://semver.org/)). - * Versions may optionally have a prerelease tag in the format `x.y.z-alpha`. - * Ranges are a strict subset of [npm ranges](https://docs.npmjs.com/misc/semver#advanced-range-syntax). - * Only the following range types are supported: - * - Tilde ranges e.g. `~1.2.3` - * - Caret ranges e.g. `^1.2.3` - * - Exact version e.g. `1.2.3` - * - Any version `*` - * @method versionParse - * @param range {string} The version string. - * @return {object} The version range parsed into its components. - */ - Plugin.versionParse = function(range) { - var pattern = /^\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-]+)?$/; +module.exports = Stepped; - if (!pattern.test(range)) { - Common.warn('Plugin.versionParse:', range, 'is not a valid version or range.'); - } - var identifiers = range.split('-'); - range = identifiers[0]; +/***/ }), - var isRange = isNaN(Number(range[0])), - version = isRange ? range.substr(1) : range, - parts = Common.map(version.split('.'), function(part) { - return Number(part); - }); +/***/ 8754: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return { - isRange: isRange, - version: version, - range: range, - operator: isRange ? range[0] : '', - parts: parts, - prerelease: identifiers[1], - number: parts[0] * 1e8 + parts[1] * 1e4 + parts[2] - }; - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Returns `true` if `version` satisfies the given `range`. - * See documentation for `Plugin.versionParse` for a description of the format. - * If a version or range is not specified, then any version (`*`) is assumed to satisfy. - * @method versionSatisfies - * @param version {string} The version string. - * @param range {string} The range string. - * @return {boolean} `true` if `version` satisfies `range`, otherwise `false`. - */ - Plugin.versionSatisfies = function(version, range) { - range = range || '*'; +/** + * @namespace Phaser.Math.Easing.Stepped + */ - var rangeParsed = Plugin.versionParse(range), - rangeParts = rangeParsed.parts, - versionParsed = Plugin.versionParse(version), - versionParts = versionParsed.parts; +module.exports = __webpack_require__(52770); - if (rangeParsed.isRange) { - if (rangeParsed.operator === '*' || version === '*') { - return true; - } - if (rangeParsed.operator === '~') { - return versionParts[0] === rangeParts[0] && versionParts[1] === rangeParts[1] && versionParts[2] >= rangeParts[2]; - } +/***/ }), - if (rangeParsed.operator === '^') { - if (rangeParts[0] > 0) { - return versionParts[0] === rangeParts[0] && versionParsed.number >= rangeParsed.number; - } +/***/ 17247: +/***/ ((module) => { - if (rangeParts[1] > 0) { - return versionParts[1] === rangeParts[1] && versionParts[2] >= rangeParts[2]; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return versionParts[2] === rangeParts[2]; - } - } +/** + * Calculate the fuzzy ceiling of the given value. + * + * @function Phaser.Math.Fuzzy.Ceil + * @since 3.0.0 + * + * @param {number} value - The value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {number} The fuzzy ceiling of the value. + */ +var Ceil = function (value, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } - return version === range || version === '*'; - }; + return Math.ceil(value - epsilon); +}; -})(); +module.exports = Ceil; /***/ }), -/* 596 */ -/***/ (function(module, exports, __webpack_require__) { -/** -* The `Matter.World` module contains methods for creating and manipulating the world composite. -* A `Matter.World` is a `Matter.Composite` body, which is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`. -* A `Matter.World` has a few additional properties including `gravity` and `bounds`. -* It is important to use the functions in the `Matter.Composite` module to modify the world composite, rather than directly modifying its properties. -* There are also a few methods here that alias those in `Matter.Composite` for easier readability. -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class World -* @extends Composite -*/ +/***/ 88456: +/***/ ((module) => { -var World = {}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = World; +/** + * Check whether the given values are fuzzily equal. + * + * Two numbers are fuzzily equal if their difference is less than `epsilon`. + * + * @function Phaser.Math.Fuzzy.Equal + * @since 3.0.0 + * + * @param {number} a - The first value. + * @param {number} b - The second value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {boolean} `true` if the values are fuzzily equal, otherwise `false`. + */ +var Equal = function (a, b, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } -var Composite = __webpack_require__(118); -var Constraint = __webpack_require__(128); -var Common = __webpack_require__(32); + return Math.abs(a - b) < epsilon; +}; -(function() { +module.exports = Equal; - /** - * Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @constructor - * @param {} options - * @return {world} A new world - */ - World.create = function(options) { - var composite = Composite.create(); - var defaults = { - label: 'World', - gravity: { - x: 0, - y: 1, - scale: 0.001 - }, - bounds: { - min: { x: -Infinity, y: -Infinity }, - max: { x: Infinity, y: Infinity } - } - }; - - return Common.extend(composite, defaults, options); - }; +/***/ }), - /* - * - * Properties Documentation - * - */ +/***/ 61824: +/***/ ((module) => { - /** - * The gravity to apply on the world. - * - * @property gravity - * @type object - */ +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The gravity x component. - * - * @property gravity.x - * @type object - * @default 0 - */ +/** + * Calculate the fuzzy floor of the given value. + * + * @function Phaser.Math.Fuzzy.Floor + * @since 3.0.0 + * + * @param {number} value - The value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {number} The floor of the value. + */ +var Floor = function (value, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } - /** - * The gravity y component. - * - * @property gravity.y - * @type object - * @default 1 - */ + return Math.floor(value + epsilon); +}; - /** - * The gravity scale factor. - * - * @property gravity.scale - * @type object - * @default 0.001 - */ +module.exports = Floor; - /** - * A `Bounds` object that defines the world bounds for collision detection. - * - * @property bounds - * @type bounds - * @default { min: { x: -Infinity, y: -Infinity }, max: { x: Infinity, y: Infinity } } - */ - // World is a Composite body - // see src/module/Outro.js for these aliases: - - /** - * An alias for Composite.add - * @method add - * @param {world} world - * @param {} object - * @return {composite} The original world with the objects added - */ +/***/ }), - /** - * An alias for Composite.remove - * @method remove - * @param {world} world - * @param {} object - * @param {boolean} [deep=false] - * @return {composite} The original world with the objects removed - */ +/***/ 41935: +/***/ ((module) => { - /** - * An alias for Composite.clear - * @method clear - * @param {world} world - * @param {boolean} keepStatic - */ +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * An alias for Composite.addComposite - * @method addComposite - * @param {world} world - * @param {composite} composite - * @return {world} The original world with the objects from composite added - */ - - /** - * An alias for Composite.addBody - * @method addBody - * @param {world} world - * @param {body} body - * @return {world} The original world with the body added - */ +/** + * Check whether `a` is fuzzily greater than `b`. + * + * `a` is fuzzily greater than `b` if it is more than `b - epsilon`. + * + * @function Phaser.Math.Fuzzy.GreaterThan + * @since 3.0.0 + * + * @param {number} a - The first value. + * @param {number} b - The second value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {boolean} `true` if `a` is fuzzily greater than than `b`, otherwise `false`. + */ +var GreaterThan = function (a, b, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } - /** - * An alias for Composite.addConstraint - * @method addConstraint - * @param {world} world - * @param {constraint} constraint - * @return {world} The original world with the constraint added - */ + return a > b - epsilon; +}; -})(); +module.exports = GreaterThan; /***/ }), -/* 597 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 54726: +/***/ ((module) => { /** -* The `Matter.Grid` module contains methods for creating and manipulating collision broadphase grid structures. -* -* @class Grid -*/ + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -var Grid = {}; +/** + * Check whether `a` is fuzzily less than `b`. + * + * `a` is fuzzily less than `b` if it is less than `b + epsilon`. + * + * @function Phaser.Math.Fuzzy.LessThan + * @since 3.0.0 + * + * @param {number} a - The first value. + * @param {number} b - The second value. + * @param {number} [epsilon=0.0001] - The epsilon. + * + * @return {boolean} `true` if `a` is fuzzily less than `b`, otherwise `false`. + */ +var LessThan = function (a, b, epsilon) +{ + if (epsilon === undefined) { epsilon = 0.0001; } -module.exports = Grid; + return a < b + epsilon; +}; -var Pair = __webpack_require__(250); -var Detector = __webpack_require__(273); -var Common = __webpack_require__(32); +module.exports = LessThan; -(function() { - /** - * Creates a new grid. - * @method create - * @param {} options - * @return {grid} A new grid - */ - Grid.create = function(options) { - var defaults = { - controller: Grid, - detector: Detector.collisions, - buckets: {}, - pairs: {}, - pairsList: [], - bucketWidth: 48, - bucketHeight: 48 - }; +/***/ }), - return Common.extend(defaults, options); - }; +/***/ 52778: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The width of a single grid bucket. - * - * @property bucketWidth - * @type number - * @default 48 - */ +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The height of a single grid bucket. - * - * @property bucketHeight - * @type number - * @default 48 - */ +/** + * @namespace Phaser.Math.Fuzzy + */ - /** - * Updates the grid. - * @method update - * @param {grid} grid - * @param {body[]} bodies - * @param {engine} engine - * @param {boolean} forceUpdate - */ - Grid.update = function(grid, bodies, engine, forceUpdate) { - var i, col, row, - world = engine.world, - buckets = grid.buckets, - bucket, - bucketId, - gridChanged = false; - - // @if DEBUG - var metrics = engine.metrics; - metrics.broadphaseTests = 0; - // @endif - - for (i = 0; i < bodies.length; i++) { - var body = bodies[i]; +module.exports = { - if (body.isSleeping && !forceUpdate) - continue; + Ceil: __webpack_require__(17247), + Equal: __webpack_require__(88456), + Floor: __webpack_require__(61824), + GreaterThan: __webpack_require__(41935), + LessThan: __webpack_require__(54726) - // don't update out of world bodies - if (body.bounds.max.x < world.bounds.min.x || body.bounds.min.x > world.bounds.max.x - || body.bounds.max.y < world.bounds.min.y || body.bounds.min.y > world.bounds.max.y) - continue; +}; - var newRegion = Grid._getRegion(grid, body); - // if the body has changed grid region - if (!body.region || newRegion.id !== body.region.id || forceUpdate) { +/***/ }), - // @if DEBUG - metrics.broadphaseTests += 1; - // @endif +/***/ 5923: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (!body.region || forceUpdate) - body.region = newRegion; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var union = Grid._regionUnion(newRegion, body.region); +var CONST = __webpack_require__(83392); +var Extend = __webpack_require__(98611); - // update grid buckets affected by region change - // iterate over the union of both regions - for (col = union.startCol; col <= union.endCol; col++) { - for (row = union.startRow; row <= union.endRow; row++) { - bucketId = Grid._getBucketId(col, row); - bucket = buckets[bucketId]; +/** + * @namespace Phaser.Math + */ - var isInsideNewRegion = (col >= newRegion.startCol && col <= newRegion.endCol - && row >= newRegion.startRow && row <= newRegion.endRow); +var PhaserMath = { - var isInsideOldRegion = (col >= body.region.startCol && col <= body.region.endCol - && row >= body.region.startRow && row <= body.region.endRow); + // Collections of functions + Angle: __webpack_require__(22153), + Distance: __webpack_require__(10130), + Easing: __webpack_require__(33063), + Fuzzy: __webpack_require__(52778), + Interpolation: __webpack_require__(48528), + Pow2: __webpack_require__(73773), + Snap: __webpack_require__(23679), - // remove from old region buckets - if (!isInsideNewRegion && isInsideOldRegion) { - if (isInsideOldRegion) { - if (bucket) - Grid._bucketRemoveBody(grid, bucket, body); - } - } + // Expose the RNG Class + RandomDataGenerator: __webpack_require__(81429), - // add to new region buckets - if (body.region === newRegion || (isInsideNewRegion && !isInsideOldRegion) || forceUpdate) { - if (!bucket) - bucket = Grid._createBucket(buckets, bucketId); - Grid._bucketAddBody(grid, bucket, body); - } - } - } + // Single functions + Average: __webpack_require__(26042), + Bernstein: __webpack_require__(22824), + Between: __webpack_require__(17489), + CatmullRom: __webpack_require__(14976), + CeilTo: __webpack_require__(89129), + Clamp: __webpack_require__(82897), + DegToRad: __webpack_require__(75606), + Difference: __webpack_require__(767), + Euler: __webpack_require__(9849), + Factorial: __webpack_require__(8034), + FloatBetween: __webpack_require__(61616), + FloorTo: __webpack_require__(60679), + FromPercent: __webpack_require__(91806), + GetSpeed: __webpack_require__(79366), + IsEven: __webpack_require__(43776), + IsEvenStrict: __webpack_require__(58442), + Linear: __webpack_require__(42798), + LinearXY: __webpack_require__(61072), + MaxAdd: __webpack_require__(69635), + Median: __webpack_require__(37394), + MinSub: __webpack_require__(17259), + Percent: __webpack_require__(61820), + RadToDeg: __webpack_require__(23701), + RandomXY: __webpack_require__(16906), + RandomXYZ: __webpack_require__(52417), + RandomXYZW: __webpack_require__(17915), + Rotate: __webpack_require__(52257), + RotateAround: __webpack_require__(2386), + RotateAroundDistance: __webpack_require__(72395), + RotateTo: __webpack_require__(41061), + RoundAwayFromZero: __webpack_require__(67233), + RoundTo: __webpack_require__(64333), + SinCosTableGenerator: __webpack_require__(59533), + SmootherStep: __webpack_require__(87736), + SmoothStep: __webpack_require__(5514), + ToXY: __webpack_require__(55805), + TransformXY: __webpack_require__(64462), + Within: __webpack_require__(9557), + Wrap: __webpack_require__(1071), - // set the new region - body.region = newRegion; + // Vector classes + Vector2: __webpack_require__(93736), + Vector3: __webpack_require__(70015), + Vector4: __webpack_require__(51729), + Matrix3: __webpack_require__(5341), + Matrix4: __webpack_require__(16650), + Quaternion: __webpack_require__(75003), + RotateVec3: __webpack_require__(93709) - // flag changes so we can update pairs - gridChanged = true; - } - } +}; - // update pairs list only if pairs changed (i.e. a body changed region) - if (gridChanged) - grid.pairsList = Grid._createActivePairsList(grid); - }; +// Merge in the consts - /** - * Clears the grid. - * @method clear - * @param {grid} grid - */ - Grid.clear = function(grid) { - grid.buckets = {}; - grid.pairs = {}; - grid.pairsList = []; - }; +PhaserMath = Extend(false, PhaserMath, CONST); - /** - * Finds the union of two regions. - * @method _regionUnion - * @private - * @param {} regionA - * @param {} regionB - * @return {} region - */ - Grid._regionUnion = function(regionA, regionB) { - var startCol = Math.min(regionA.startCol, regionB.startCol), - endCol = Math.max(regionA.endCol, regionB.endCol), - startRow = Math.min(regionA.startRow, regionB.startRow), - endRow = Math.max(regionA.endRow, regionB.endRow); +// Export it - return Grid._createRegion(startCol, endCol, startRow, endRow); - }; +module.exports = PhaserMath; - /** - * Gets the region a given body falls in for a given grid. - * @method _getRegion - * @private - * @param {} grid - * @param {} body - * @return {} region - */ - Grid._getRegion = function(grid, body) { - var bounds = body.bounds, - startCol = Math.floor(bounds.min.x / grid.bucketWidth), - endCol = Math.floor(bounds.max.x / grid.bucketWidth), - startRow = Math.floor(bounds.min.y / grid.bucketHeight), - endRow = Math.floor(bounds.max.y / grid.bucketHeight); - return Grid._createRegion(startCol, endCol, startRow, endRow); - }; +/***/ }), - /** - * Creates a region. - * @method _createRegion - * @private - * @param {} startCol - * @param {} endCol - * @param {} startRow - * @param {} endRow - * @return {} region - */ - Grid._createRegion = function(startCol, endCol, startRow, endRow) { - return { - id: startCol + ',' + endCol + ',' + startRow + ',' + endRow, - startCol: startCol, - endCol: endCol, - startRow: startRow, - endRow: endRow - }; - }; +/***/ 63210: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Gets the bucket id at the given position. - * @method _getBucketId - * @private - * @param {} column - * @param {} row - * @return {string} bucket id - */ - Grid._getBucketId = function(column, row) { - return 'C' + column + 'R' + row; - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Creates a bucket. - * @method _createBucket - * @private - * @param {} buckets - * @param {} bucketId - * @return {} bucket - */ - Grid._createBucket = function(buckets, bucketId) { - var bucket = buckets[bucketId] = []; - return bucket; - }; +var Bernstein = __webpack_require__(22824); - /** - * Adds a body to a bucket. - * @method _bucketAddBody - * @private - * @param {} grid - * @param {} bucket - * @param {} body - */ - Grid._bucketAddBody = function(grid, bucket, body) { - // add new pairs - for (var i = 0; i < bucket.length; i++) { - var bodyB = bucket[i]; +/** + * A bezier interpolation method. + * + * @function Phaser.Math.Interpolation.Bezier + * @since 3.0.0 + * + * @param {number[]} v - The input array of values to interpolate between. + * @param {number} k - The percentage of interpolation, between 0 and 1. + * + * @return {number} The interpolated value. + */ +var BezierInterpolation = function (v, k) +{ + var b = 0; + var n = v.length - 1; - if (body.id === bodyB.id || (body.isStatic && bodyB.isStatic)) - continue; + for (var i = 0; i <= n; i++) + { + b += Math.pow(1 - k, n - i) * Math.pow(k, i) * v[i] * Bernstein(n, i); + } - // keep track of the number of buckets the pair exists in - // important for Grid.update to work - var pairId = Pair.id(body, bodyB), - pair = grid.pairs[pairId]; + return b; +}; - if (pair) { - pair[2] += 1; - } else { - grid.pairs[pairId] = [body, bodyB, 1]; - } - } +module.exports = BezierInterpolation; - // add to bodies (after pairs, otherwise pairs with self) - bucket.push(body); - }; - /** - * Removes a body from a bucket. - * @method _bucketRemoveBody - * @private - * @param {} grid - * @param {} bucket - * @param {} body - */ - Grid._bucketRemoveBody = function(grid, bucket, body) { - // remove from bucket - bucket.splice(bucket.indexOf(body), 1); +/***/ }), - // update pair counts - for (var i = 0; i < bucket.length; i++) { - // keep track of the number of buckets the pair exists in - // important for _createActivePairsList to work - var bodyB = bucket[i], - pairId = Pair.id(body, bodyB), - pair = grid.pairs[pairId]; +/***/ 88332: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (pair) - pair[2] -= 1; - } - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Generates a list of the active pairs in the grid. - * @method _createActivePairsList - * @private - * @param {} grid - * @return [] pairs - */ - Grid._createActivePairsList = function(grid) { - var pairKeys, - pair, - pairs = []; - - // grid.pairs is used as a hashmap - pairKeys = Common.keys(grid.pairs); - - // iterate over grid.pairs - for (var k = 0; k < pairKeys.length; k++) { - pair = grid.pairs[pairKeys[k]]; - - // if pair exists in at least one bucket - // it is a pair that needs further collision testing so push it - if (pair[2] > 0) { - pairs.push(pair); - } else { - delete grid.pairs[pairKeys[k]]; - } - } - - return pairs; - }; - -})(); - - -/***/ }), -/* 598 */ -/***/ (function(module, exports, __webpack_require__) { +var CatmullRom = __webpack_require__(14976); /** -* The `Matter.Pairs` module contains methods for creating and manipulating collision pair sets. -* -* @class Pairs -*/ - -var Pairs = {}; - -module.exports = Pairs; - -var Pair = __webpack_require__(250); -var Common = __webpack_require__(32); - -(function() { - - Pairs._pairMaxIdleLife = 1000; - - /** - * Creates a new pairs structure. - * @method create - * @param {object} options - * @return {pairs} A new pairs structure - */ - Pairs.create = function(options) { - return Common.extend({ - table: {}, - list: [], - collisionStart: [], - collisionActive: [], - collisionEnd: [] - }, options); - }; - - /** - * Updates pairs given a list of collisions. - * @method update - * @param {object} pairs - * @param {collision[]} collisions - * @param {number} timestamp - */ - Pairs.update = function(pairs, collisions, timestamp) { - var pairsList = pairs.list, - pairsTable = pairs.table, - collisionStart = pairs.collisionStart, - collisionEnd = pairs.collisionEnd, - collisionActive = pairs.collisionActive, - collision, - pairId, - pair, - i; - - // clear collision state arrays, but maintain old reference - collisionStart.length = 0; - collisionEnd.length = 0; - collisionActive.length = 0; - - for (i = 0; i < pairsList.length; i++) { - pairsList[i].confirmedActive = false; - } - - for (i = 0; i < collisions.length; i++) { - collision = collisions[i]; - - if (collision.collided) { - pairId = Pair.id(collision.bodyA, collision.bodyB); - - pair = pairsTable[pairId]; - - if (pair) { - // pair already exists (but may or may not be active) - if (pair.isActive) { - // pair exists and is active - collisionActive.push(pair); - } else { - // pair exists but was inactive, so a collision has just started again - collisionStart.push(pair); - } - - // update the pair - Pair.update(pair, collision, timestamp); - pair.confirmedActive = true; - } else { - // pair did not exist, create a new pair - pair = Pair.create(collision, timestamp); - pairsTable[pairId] = pair; - - // push the new pair - collisionStart.push(pair); - pairsList.push(pair); - } - } - } + * A Catmull-Rom interpolation method. + * + * @function Phaser.Math.Interpolation.CatmullRom + * @since 3.0.0 + * + * @param {number[]} v - The input array of values to interpolate between. + * @param {number} k - The percentage of interpolation, between 0 and 1. + * + * @return {number} The interpolated value. + */ +var CatmullRomInterpolation = function (v, k) +{ + var m = v.length - 1; + var f = m * k; + var i = Math.floor(f); - // deactivate previously active pairs that are now inactive - for (i = 0; i < pairsList.length; i++) { - pair = pairsList[i]; - if (pair.isActive && !pair.confirmedActive) { - Pair.setActive(pair, false, timestamp); - collisionEnd.push(pair); - } + if (v[0] === v[m]) + { + if (k < 0) + { + i = Math.floor(f = m * (1 + k)); } - }; - - /** - * Finds and removes pairs that have been inactive for a set amount of time. - * @method removeOld - * @param {object} pairs - * @param {number} timestamp - */ - Pairs.removeOld = function(pairs, timestamp) { - var pairsList = pairs.list, - pairsTable = pairs.table, - indexesToRemove = [], - pair, - collision, - pairIndex, - i; - for (i = 0; i < pairsList.length; i++) { - pair = pairsList[i]; - collision = pair.collision; - - // never remove sleeping pairs - if (collision.bodyA.isSleeping || collision.bodyB.isSleeping) { - pair.timeUpdated = timestamp; - continue; - } - - // if pair is inactive for too long, mark it to be removed - if (timestamp - pair.timeUpdated > Pairs._pairMaxIdleLife) { - indexesToRemove.push(i); - } + return CatmullRom(f - i, v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m]); + } + else + { + if (k < 0) + { + return v[0] - (CatmullRom(-f, v[0], v[0], v[1], v[1]) - v[0]); } - // remove marked pairs - for (i = 0; i < indexesToRemove.length; i++) { - pairIndex = indexesToRemove[i] - i; - pair = pairsList[pairIndex]; - delete pairsTable[pair.id]; - pairsList.splice(pairIndex, 1); + if (k > 1) + { + return v[m] - (CatmullRom(f - m, v[m], v[m], v[m - 1], v[m - 1]) - v[m]); } - }; - /** - * Clears the given pairs structure. - * @method clear - * @param {pairs} pairs - * @return {pairs} pairs - */ - Pairs.clear = function(pairs) { - pairs.table = {}; - pairs.list.length = 0; - pairs.collisionStart.length = 0; - pairs.collisionActive.length = 0; - pairs.collisionEnd.length = 0; - return pairs; - }; + return CatmullRom(f - i, v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2]); + } +}; -})(); +module.exports = CatmullRomInterpolation; /***/ }), -/* 599 */ -/***/ (function(module, exports, __webpack_require__) { - -/** -* The `Matter.Resolver` module contains methods for resolving collision pairs. -* -* @class Resolver -*/ - -var Resolver = {}; - -module.exports = Resolver; - -var Vertices = __webpack_require__(64); -var Vector = __webpack_require__(83); -var Common = __webpack_require__(32); -var Bounds = __webpack_require__(84); - -(function() { - - Resolver._restingThresh = 4; - Resolver._restingThreshTangent = 6; - Resolver._positionDampen = 0.9; - Resolver._positionWarming = 0.8; - Resolver._frictionNormalMultiplier = 5; - - /** - * Prepare pairs for position solving. - * @method preSolvePosition - * @param {pair[]} pairs - */ - Resolver.preSolvePosition = function(pairs) { - var i, - pair, - activeCount; - - // find total contacts on each body - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive) - continue; - - activeCount = pair.activeContacts.length; - pair.collision.parentA.totalContacts += activeCount; - pair.collision.parentB.totalContacts += activeCount; - } - }; - - /** - * Find a solution for pair positions. - * @method solvePosition - * @param {pair[]} pairs - * @param {body[]} bodies - * @param {number} timeScale - */ - Resolver.solvePosition = function(pairs, bodies, timeScale) { - var i, - normalX, - normalY, - pair, - collision, - bodyA, - bodyB, - normal, - separation, - penetration, - positionImpulseA, - positionImpulseB, - contactShare, - bodyBtoAX, - bodyBtoAY, - positionImpulse, - impulseCoefficient = timeScale * Resolver._positionDampen; - - for (i = 0; i < bodies.length; i++) { - var body = bodies[i]; - body.previousPositionImpulse.x = body.positionImpulse.x; - body.previousPositionImpulse.y = body.positionImpulse.y; - } - - // find impulses required to resolve penetration - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive || pair.isSensor) - continue; - - collision = pair.collision; - bodyA = collision.parentA; - bodyB = collision.parentB; - normal = collision.normal; - positionImpulseA = bodyA.previousPositionImpulse; - positionImpulseB = bodyB.previousPositionImpulse; +/***/ 34631: +/***/ ((module) => { - penetration = collision.penetration; - - bodyBtoAX = positionImpulseB.x - positionImpulseA.x + penetration.x; - bodyBtoAY = positionImpulseB.y - positionImpulseA.y + penetration.y; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - normalX = normal.x; - normalY = normal.y; +/** + * @ignore + */ +function P0 (t, p) +{ + var k = 1 - t; - separation = normalX * bodyBtoAX + normalY * bodyBtoAY; - pair.separation = separation; + return k * k * k * p; +} - positionImpulse = (separation - pair.slop) * impulseCoefficient; +/** + * @ignore + */ +function P1 (t, p) +{ + var k = 1 - t; - if (bodyA.isStatic || bodyB.isStatic) - positionImpulse *= 2; - - if (!(bodyA.isStatic || bodyA.isSleeping)) { - contactShare = positionImpulse / bodyA.totalContacts; - bodyA.positionImpulse.x += normalX * contactShare; - bodyA.positionImpulse.y += normalY * contactShare; - } + return 3 * k * k * t * p; +} - if (!(bodyB.isStatic || bodyB.isSleeping)) { - contactShare = positionImpulse / bodyB.totalContacts; - bodyB.positionImpulse.x -= normalX * contactShare; - bodyB.positionImpulse.y -= normalY * contactShare; - } - } - }; +/** + * @ignore + */ +function P2 (t, p) +{ + return 3 * (1 - t) * t * t * p; +} - /** - * Apply position resolution. - * @method postSolvePosition - * @param {body[]} bodies - */ - Resolver.postSolvePosition = function(bodies) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; +/** + * @ignore + */ +function P3 (t, p) +{ + return t * t * t * p; +} - // reset contact count - body.totalContacts = 0; +/** + * A cubic bezier interpolation method. + * + * https://medium.com/@adrian_cooney/bezier-interpolation-13b68563313a + * + * @function Phaser.Math.Interpolation.CubicBezier + * @since 3.0.0 + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} p0 - The start point. + * @param {number} p1 - The first control point. + * @param {number} p2 - The second control point. + * @param {number} p3 - The end point. + * + * @return {number} The interpolated value. + */ +var CubicBezierInterpolation = function (t, p0, p1, p2, p3) +{ + return P0(t, p0) + P1(t, p1) + P2(t, p2) + P3(t, p3); +}; - if (body.positionImpulse.x !== 0 || body.positionImpulse.y !== 0) { - // update body geometry - for (var j = 0; j < body.parts.length; j++) { - var part = body.parts[j]; - Vertices.translate(part.vertices, body.positionImpulse); - Bounds.update(part.bounds, part.vertices, body.velocity); - part.position.x += body.positionImpulse.x; - part.position.y += body.positionImpulse.y; - } +module.exports = CubicBezierInterpolation; - // move the body without changing velocity - body.positionPrev.x += body.positionImpulse.x; - body.positionPrev.y += body.positionImpulse.y; - if (Vector.dot(body.positionImpulse, body.velocity) < 0) { - // reset cached impulse if the body has velocity along it - body.positionImpulse.x = 0; - body.positionImpulse.y = 0; - } else { - // warm the next iteration - body.positionImpulse.x *= Resolver._positionWarming; - body.positionImpulse.y *= Resolver._positionWarming; - } - } - } - }; +/***/ }), - /** - * Prepare pairs for velocity solving. - * @method preSolveVelocity - * @param {pair[]} pairs - */ - Resolver.preSolveVelocity = function(pairs) { - var i, - j, - pair, - contacts, - collision, - bodyA, - bodyB, - normal, - tangent, - contact, - contactVertex, - normalImpulse, - tangentImpulse, - offset, - impulse = Vector._temp[0], - tempA = Vector._temp[1]; - - for (i = 0; i < pairs.length; i++) { - pair = pairs[i]; - - if (!pair.isActive || pair.isSensor) - continue; - - contacts = pair.activeContacts; - collision = pair.collision; - bodyA = collision.parentA; - bodyB = collision.parentB; - normal = collision.normal; - tangent = collision.tangent; +/***/ 47614: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // resolve each contact - for (j = 0; j < contacts.length; j++) { - contact = contacts[j]; - contactVertex = contact.vertex; - normalImpulse = contact.normalImpulse; - tangentImpulse = contact.tangentImpulse; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (normalImpulse !== 0 || tangentImpulse !== 0) { - // total impulse from contact - impulse.x = (normal.x * normalImpulse) + (tangent.x * tangentImpulse); - impulse.y = (normal.y * normalImpulse) + (tangent.y * tangentImpulse); - - // apply impulse from contact - if (!(bodyA.isStatic || bodyA.isSleeping)) { - offset = Vector.sub(contactVertex, bodyA.position, tempA); - bodyA.positionPrev.x += impulse.x * bodyA.inverseMass; - bodyA.positionPrev.y += impulse.y * bodyA.inverseMass; - bodyA.anglePrev += Vector.cross(offset, impulse) * bodyA.inverseInertia; - } +var Linear = __webpack_require__(42798); - if (!(bodyB.isStatic || bodyB.isSleeping)) { - offset = Vector.sub(contactVertex, bodyB.position, tempA); - bodyB.positionPrev.x -= impulse.x * bodyB.inverseMass; - bodyB.positionPrev.y -= impulse.y * bodyB.inverseMass; - bodyB.anglePrev -= Vector.cross(offset, impulse) * bodyB.inverseInertia; - } - } - } - } - }; +/** + * A linear interpolation method. + * + * @function Phaser.Math.Interpolation.Linear + * @since 3.0.0 + * @see {@link https://en.wikipedia.org/wiki/Linear_interpolation} + * + * @param {number[]} v - The input array of values to interpolate between. + * @param {!number} k - The percentage of interpolation, between 0 and 1. + * + * @return {!number} The interpolated value. + */ +var LinearInterpolation = function (v, k) +{ + var m = v.length - 1; + var f = m * k; + var i = Math.floor(f); - /** - * Find a solution for pair velocities. - * @method solveVelocity - * @param {pair[]} pairs - * @param {number} timeScale - */ - Resolver.solveVelocity = function(pairs, timeScale) { - var timeScaleSquared = timeScale * timeScale, - impulse = Vector._temp[0], - tempA = Vector._temp[1], - tempB = Vector._temp[2], - tempC = Vector._temp[3], - tempD = Vector._temp[4], - tempE = Vector._temp[5]; - - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i]; - - if (!pair.isActive || pair.isSensor) - continue; - - var collision = pair.collision, - bodyA = collision.parentA, - bodyB = collision.parentB, - normal = collision.normal, - tangent = collision.tangent, - contacts = pair.activeContacts, - contactShare = 1 / contacts.length; + if (k < 0) + { + return Linear(v[0], v[1], f); + } + else if (k > 1) + { + return Linear(v[m], v[m - 1], m - f); + } + else + { + return Linear(v[i], v[(i + 1 > m) ? m : i + 1], f - i); + } +}; - // update body velocities - bodyA.velocity.x = bodyA.position.x - bodyA.positionPrev.x; - bodyA.velocity.y = bodyA.position.y - bodyA.positionPrev.y; - bodyB.velocity.x = bodyB.position.x - bodyB.positionPrev.x; - bodyB.velocity.y = bodyB.position.y - bodyB.positionPrev.y; - bodyA.angularVelocity = bodyA.angle - bodyA.anglePrev; - bodyB.angularVelocity = bodyB.angle - bodyB.anglePrev; +module.exports = LinearInterpolation; - // resolve each contact - for (var j = 0; j < contacts.length; j++) { - var contact = contacts[j], - contactVertex = contact.vertex, - offsetA = Vector.sub(contactVertex, bodyA.position, tempA), - offsetB = Vector.sub(contactVertex, bodyB.position, tempB), - velocityPointA = Vector.add(bodyA.velocity, Vector.mult(Vector.perp(offsetA), bodyA.angularVelocity), tempC), - velocityPointB = Vector.add(bodyB.velocity, Vector.mult(Vector.perp(offsetB), bodyB.angularVelocity), tempD), - relativeVelocity = Vector.sub(velocityPointA, velocityPointB, tempE), - normalVelocity = Vector.dot(normal, relativeVelocity); - var tangentVelocity = Vector.dot(tangent, relativeVelocity), - tangentSpeed = Math.abs(tangentVelocity), - tangentVelocityDirection = Common.sign(tangentVelocity); +/***/ }), - // raw impulses - var normalImpulse = (1 + pair.restitution) * normalVelocity, - normalForce = Common.clamp(pair.separation + normalVelocity, 0, 1) * Resolver._frictionNormalMultiplier; +/***/ 16252: +/***/ ((module) => { - // coulomb friction - var tangentImpulse = tangentVelocity, - maxFriction = Infinity; - - if (tangentSpeed > pair.friction * pair.frictionStatic * normalForce * timeScaleSquared) { - maxFriction = tangentSpeed; - tangentImpulse = Common.clamp( - pair.friction * tangentVelocityDirection * timeScaleSquared, - -maxFriction, maxFriction - ); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // modify impulses accounting for mass, inertia and offset - var oAcN = Vector.cross(offsetA, normal), - oBcN = Vector.cross(offsetB, normal), - share = contactShare / (bodyA.inverseMass + bodyB.inverseMass + bodyA.inverseInertia * oAcN * oAcN + bodyB.inverseInertia * oBcN * oBcN); +/** + * @ignore + */ +function P0 (t, p) +{ + var k = 1 - t; - normalImpulse *= share; - tangentImpulse *= share; + return k * k * p; +} - // handle high velocity and resting collisions separately - if (normalVelocity < 0 && normalVelocity * normalVelocity > Resolver._restingThresh * timeScaleSquared) { - // high normal velocity so clear cached contact normal impulse - contact.normalImpulse = 0; - } else { - // solve resting collision constraints using Erin Catto's method (GDC08) - // impulse constraint tends to 0 - var contactNormalImpulse = contact.normalImpulse; - contact.normalImpulse = Math.min(contact.normalImpulse + normalImpulse, 0); - normalImpulse = contact.normalImpulse - contactNormalImpulse; - } +/** + * @ignore + */ +function P1 (t, p) +{ + return 2 * (1 - t) * t * p; +} - // handle high velocity and resting collisions separately - if (tangentVelocity * tangentVelocity > Resolver._restingThreshTangent * timeScaleSquared) { - // high tangent velocity so clear cached contact tangent impulse - contact.tangentImpulse = 0; - } else { - // solve resting collision constraints using Erin Catto's method (GDC08) - // tangent impulse tends to -tangentSpeed or +tangentSpeed - var contactTangentImpulse = contact.tangentImpulse; - contact.tangentImpulse = Common.clamp(contact.tangentImpulse + tangentImpulse, -maxFriction, maxFriction); - tangentImpulse = contact.tangentImpulse - contactTangentImpulse; - } +/** + * @ignore + */ +function P2 (t, p) +{ + return t * t * p; +} - // total impulse from contact - impulse.x = (normal.x * normalImpulse) + (tangent.x * tangentImpulse); - impulse.y = (normal.y * normalImpulse) + (tangent.y * tangentImpulse); - - // apply impulse from contact - if (!(bodyA.isStatic || bodyA.isSleeping)) { - bodyA.positionPrev.x += impulse.x * bodyA.inverseMass; - bodyA.positionPrev.y += impulse.y * bodyA.inverseMass; - bodyA.anglePrev += Vector.cross(offsetA, impulse) * bodyA.inverseInertia; - } +// https://github.com/mrdoob/three.js/blob/master/src/extras/core/Interpolations.js - if (!(bodyB.isStatic || bodyB.isSleeping)) { - bodyB.positionPrev.x -= impulse.x * bodyB.inverseMass; - bodyB.positionPrev.y -= impulse.y * bodyB.inverseMass; - bodyB.anglePrev -= Vector.cross(offsetB, impulse) * bodyB.inverseInertia; - } - } - } - }; +/** + * A quadratic bezier interpolation method. + * + * @function Phaser.Math.Interpolation.QuadraticBezier + * @since 3.2.0 + * + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} p0 - The start point. + * @param {number} p1 - The control point. + * @param {number} p2 - The end point. + * + * @return {number} The interpolated value. + */ +var QuadraticBezierInterpolation = function (t, p0, p1, p2) +{ + return P0(t, p0) + P1(t, p1) + P2(t, p2); +}; -})(); +module.exports = QuadraticBezierInterpolation; /***/ }), -/* 600 */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || new Function("return this")(); -} catch (e) { - // This works if the window reference is available - if (typeof window === "object") g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - -/***/ }), -/* 601 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ 44521: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @author samme - * @copyright 2020 Photon Storm Ltd. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var QuickSet = __webpack_require__(276); +var SmoothStep = __webpack_require__(5514); /** - * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, and aligns them next to each other. - * - * The first item isn't moved. The second item is aligned next to the first, then the third next to the second, and so on. - * - * @function Phaser.Actions.AlignTo - * @since 3.22.0 + * A Smooth Step interpolation method. * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * @function Phaser.Math.Interpolation.SmoothStep + * @since 3.9.0 + * @see {@link https://en.wikipedia.org/wiki/Smoothstep} * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} position - The position to align the items with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`. - * @param {number} [offsetX=0] - Optional horizontal offset from the position. - * @param {number} [offsetY=0] - Optional vertical offset from the position. + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. + * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + * @return {number} The interpolated value. */ -var AlignTo = function (items, position, offsetX, offsetY) +var SmoothStepInterpolation = function (t, min, max) { - var target = items[0]; - - for (var i = 1; i < items.length; i++) - { - var item = items[i]; - - QuickSet(item, target, position, offsetX, offsetY); - - target = item; - } - - return items; + return min + (max - min) * SmoothStep(t, 0, 1); }; -module.exports = AlignTo; +module.exports = SmoothStepInterpolation; /***/ }), -/* 602 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 45507: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueInc = __webpack_require__(46); +var SmootherStep = __webpack_require__(87736); /** - * Takes an array of Game Objects, or any objects that have a public `angle` property, - * and then adds the given value to each of their `angle` properties. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `Angle(group.getChildren(), value, step)` - * - * @function Phaser.Actions.Angle - * @since 3.0.0 + * A Smoother Step interpolation method. * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] + * @function Phaser.Math.Interpolation.SmootherStep + * @since 3.9.0 + * @see {@link https://en.wikipedia.org/wiki/Smoothstep#Variations} * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to be added to the `angle` property. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. + * @param {number} t - The percentage of interpolation, between 0 and 1. + * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. + * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + * @return {number} The interpolated value. */ -var Angle = function (items, value, step, index, direction) +var SmootherStepInterpolation = function (t, min, max) { - return PropertyValueInc(items, 'angle', value, step, index, direction); + return min + (max - min) * SmootherStep(t, 0, 1); }; -module.exports = Angle; +module.exports = SmootherStepInterpolation; /***/ }), -/* 603 */ -/***/ (function(module, exports) { + +/***/ 48528: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Takes an array of objects and passes each of them to the given callback. - * - * @function Phaser.Actions.Call - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {Phaser.Types.Actions.CallCallback} callback - The callback to be invoked. It will be passed just one argument: the item from the array. - * @param {*} context - The scope in which the callback will be invoked. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that was passed to this Action. + * @namespace Phaser.Math.Interpolation */ -var Call = function (items, callback, context) -{ - for (var i = 0; i < items.length; i++) - { - var item = items[i]; - callback.call(context, item); - } +module.exports = { - return items; -}; + Bezier: __webpack_require__(63210), + CatmullRom: __webpack_require__(88332), + CubicBezier: __webpack_require__(34631), + Linear: __webpack_require__(47614), + QuadraticBezier: __webpack_require__(16252), + SmoothStep: __webpack_require__(44521), + SmootherStep: __webpack_require__(45507) -module.exports = Call; +}; /***/ }), -/* 604 */ -/***/ (function(module, exports) { + +/***/ 3504: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Takes an array of objects and returns the first element in the array that has properties which match - * all of those specified in the `compare` object. For example, if the compare object was: `{ scaleX: 0.5, alpha: 1 }` - * then it would return the first item which had the property `scaleX` set to 0.5 and `alpha` set to 1. - * - * To use this with a Group: `GetFirst(group.getChildren(), compare, index)` + * Returns the nearest power of 2 to the given `value`. * - * @function Phaser.Actions.GetFirst + * @function Phaser.Math.Pow2.GetNext * @since 3.0.0 * - * @generic {Phaser.GameObjects.GameObject[]} G - [items] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be searched by this action. - * @param {object} compare - The comparison object. Each property in this object will be checked against the items of the array. - * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} value - The value. * - * @return {?(object|Phaser.GameObjects.GameObject)} The first object in the array that matches the comparison object, or `null` if no match was found. + * @return {number} The nearest power of 2 to `value`. */ -var GetFirst = function (items, compare, index) +var GetPowerOfTwo = function (value) { - if (index === undefined) { index = 0; } - - for (var i = index; i < items.length; i++) - { - var item = items[i]; - - var match = true; - - for (var property in compare) - { - if (item[property] !== compare[property]) - { - match = false; - } - } - - if (match) - { - return item; - } - } + var index = Math.log(value) / 0.6931471805599453; - return null; + return (1 << Math.ceil(index)); }; -module.exports = GetFirst; +module.exports = GetPowerOfTwo; /***/ }), -/* 605 */ -/***/ (function(module, exports) { + +/***/ 28621: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Takes an array of objects and returns the last element in the array that has properties which match - * all of those specified in the `compare` object. For example, if the compare object was: `{ scaleX: 0.5, alpha: 1 }` - * then it would return the last item which had the property `scaleX` set to 0.5 and `alpha` set to 1. - * - * To use this with a Group: `GetLast(group.getChildren(), compare, index)` - * - * @function Phaser.Actions.GetLast - * @since 3.3.0 + * Checks if the given `width` and `height` are a power of two. + * Useful for checking texture dimensions. * - * @generic {Phaser.GameObjects.GameObject[]} G - [items] + * @function Phaser.Math.Pow2.IsSize + * @since 3.0.0 * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be searched by this action. - * @param {object} compare - The comparison object. Each property in this object will be checked against the items of the array. - * @param {number} [index=0] - An optional offset to start searching from within the items array. + * @param {number} width - The width. + * @param {number} height - The height. * - * @return {?(object|Phaser.GameObjects.GameObject)} The last object in the array that matches the comparison object, or `null` if no match was found. + * @return {boolean} `true` if `width` and `height` are a power of two, otherwise `false`. */ -var GetLast = function (items, compare, index) +var IsSizePowerOfTwo = function (width, height) { - if (index === undefined) { index = 0; } - - for (var i = index; i < items.length; i++) - { - var item = items[i]; - - var match = true; - - for (var property in compare) - { - if (item[property] !== compare[property]) - { - match = false; - } - } - - if (match) - { - return item; - } - } - - return null; + return (width > 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0); }; -module.exports = GetLast; +module.exports = IsSizePowerOfTwo; /***/ }), -/* 606 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 2018: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AlignIn = __webpack_require__(289); -var CONST = __webpack_require__(123); -var GetFastValue = __webpack_require__(2); -var NOOP = __webpack_require__(1); -var Zone = __webpack_require__(129); - -var tempZone = new Zone({ sys: { queueDepthSort: NOOP, events: { once: NOOP } } }, 0, 0, 1, 1); - /** - * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, - * and then aligns them based on the grid configuration given to this action. + * Tests the value and returns `true` if it is a power of two. * - * @function Phaser.Actions.GridAlign + * @function Phaser.Math.Pow2.IsValue * @since 3.0.0 * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {Phaser.Types.Actions.GridAlignConfig} options - The GridAlign Configuration object. + * @param {number} value - The value to check if it's a power of two. * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + * @return {boolean} Returns `true` if `value` is a power of two, otherwise `false`. */ -var GridAlign = function (items, options) +var IsValuePowerOfTwo = function (value) { - if (options === undefined) { options = {}; } - - var widthSet = options.hasOwnProperty('width'); - var heightSet = options.hasOwnProperty('height'); - - var width = GetFastValue(options, 'width', -1); - var height = GetFastValue(options, 'height', -1); - - var cellWidth = GetFastValue(options, 'cellWidth', 1); - var cellHeight = GetFastValue(options, 'cellHeight', cellWidth); - - var position = GetFastValue(options, 'position', CONST.TOP_LEFT); - var x = GetFastValue(options, 'x', 0); - var y = GetFastValue(options, 'y', 0); + return (value > 0 && (value & (value - 1)) === 0); +}; - var cx = 0; - var cy = 0; - var w = (width * cellWidth); - var h = (height * cellHeight); +module.exports = IsValuePowerOfTwo; - tempZone.setPosition(x, y); - tempZone.setSize(cellWidth, cellHeight); - for (var i = 0; i < items.length; i++) - { - AlignIn(items[i], tempZone, position); +/***/ }), - if (widthSet && width === -1) - { - // We keep laying them out horizontally until we've done them all - tempZone.x += cellWidth; - } - else if (heightSet && height === -1) - { - // We keep laying them out vertically until we've done them all - tempZone.y += cellHeight; - } - else if (heightSet && !widthSet) - { - // We keep laying them out until we hit the column limit - cy += cellHeight; - tempZone.y += cellHeight; +/***/ 73773: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (cy === h) - { - cy = 0; - cx += cellWidth; - tempZone.y = y; - tempZone.x += cellWidth; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (cx === w) - { - // We've hit the column limit, so return, even if there are items left - break; - } - } - } - else - { - // We keep laying them out until we hit the column limit - cx += cellWidth; - tempZone.x += cellWidth; +/** + * @namespace Phaser.Math.Pow2 + */ - if (cx === w) - { - cx = 0; - cy += cellHeight; - tempZone.x = x; - tempZone.y += cellHeight; +module.exports = { - if (cy === h) - { - // We've hit the column limit, so return, even if there are items left - break; - } - } - } - } + GetNext: __webpack_require__(3504), + IsSize: __webpack_require__(28621), + IsValue: __webpack_require__(2018) - return items; }; -module.exports = GridAlign; - /***/ }), -/* 607 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 81429: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(18); - -// bitmask flag for GameObject.renderMask -var _FLAG = 2; // 0010 +var Class = __webpack_require__(56694); /** - * Provides methods used for setting the alpha properties of a Game Object. - * Should be applied as a mixin and not used directly. + * @classdesc + * A seeded Random Data Generator. * - * @namespace Phaser.GameObjects.Components.Alpha + * Access via `Phaser.Math.RND` which is an instance of this class pre-defined + * by Phaser. Or, create your own instance to use as you require. + * + * The `Math.RND` generator is seeded by the Game Config property value `seed`. + * If no such config property exists, a random number is used. + * + * If you create your own instance of this class you should provide a seed for it. + * If no seed is given it will use a 'random' one based on Date.now. + * + * @class RandomDataGenerator + * @memberof Phaser.Math + * @constructor * @since 3.0.0 + * + * @param {(string|string[])} [seeds] - The seeds to use for the random number generator. */ +var RandomDataGenerator = new Class({ -var Alpha = { + initialize: - /** - * Private internal value. Holds the global alpha value. - * - * @name Phaser.GameObjects.Components.Alpha#_alpha - * @type {number} - * @private - * @default 1 - * @since 3.0.0 - */ - _alpha: 1, + function RandomDataGenerator (seeds) + { + if (seeds === undefined) { seeds = [ (Date.now() * Math.random()).toString() ]; } - /** - * Private internal value. Holds the top-left alpha value. - * - * @name Phaser.GameObjects.Components.Alpha#_alphaTL - * @type {number} - * @private - * @default 1 - * @since 3.0.0 - */ - _alphaTL: 1, + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#c + * @type {number} + * @default 1 + * @private + * @since 3.0.0 + */ + this.c = 1; - /** - * Private internal value. Holds the top-right alpha value. - * - * @name Phaser.GameObjects.Components.Alpha#_alphaTR - * @type {number} - * @private - * @default 1 - * @since 3.0.0 - */ - _alphaTR: 1, + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#s0 + * @type {number} + * @default 0 + * @private + * @since 3.0.0 + */ + this.s0 = 0; - /** - * Private internal value. Holds the bottom-left alpha value. - * - * @name Phaser.GameObjects.Components.Alpha#_alphaBL - * @type {number} - * @private - * @default 1 - * @since 3.0.0 - */ - _alphaBL: 1, + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#s1 + * @type {number} + * @default 0 + * @private + * @since 3.0.0 + */ + this.s1 = 0; + + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#s2 + * @type {number} + * @default 0 + * @private + * @since 3.0.0 + */ + this.s2 = 0; + + /** + * Internal var. + * + * @name Phaser.Math.RandomDataGenerator#n + * @type {number} + * @default 0 + * @private + * @since 3.2.0 + */ + this.n = 0; + + /** + * Signs to choose from. + * + * @name Phaser.Math.RandomDataGenerator#signs + * @type {number[]} + * @since 3.0.0 + */ + this.signs = [ -1, 1 ]; + + if (seeds) + { + this.init(seeds); + } + }, /** - * Private internal value. Holds the bottom-right alpha value. + * Private random helper. * - * @name Phaser.GameObjects.Components.Alpha#_alphaBR - * @type {number} - * @private - * @default 1 + * @method Phaser.Math.RandomDataGenerator#rnd * @since 3.0.0 + * @private + * + * @return {number} A random number. */ - _alphaBR: 1, + rnd: function () + { + var t = 2091639 * this.s0 + this.c * 2.3283064365386963e-10; // 2^-32 + + this.c = t | 0; + this.s0 = this.s1; + this.s1 = this.s2; + this.s2 = t - this.c; + + return this.s2; + }, /** - * Clears all alpha values associated with this Game Object. - * - * Immediately sets the alpha levels back to 1 (fully opaque). + * Internal method that creates a seed hash. * - * @method Phaser.GameObjects.Components.Alpha#clearAlpha + * @method Phaser.Math.RandomDataGenerator#hash * @since 3.0.0 + * @private * - * @return {this} This Game Object instance. + * @param {string} data - The value to hash. + * + * @return {number} The hashed value. */ - clearAlpha: function () + hash: function (data) { - return this.setAlpha(1); + var h; + var n = this.n; + + data = data.toString(); + + for (var i = 0; i < data.length; i++) + { + n += data.charCodeAt(i); + h = 0.02519603282416938 * n; + n = h >>> 0; + h -= n; + h *= n; + n = h >>> 0; + h -= n; + n += h * 0x100000000;// 2^32 + } + + this.n = n; + + return (n >>> 0) * 2.3283064365386963e-10;// 2^-32 }, /** - * Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders. - * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque. - * - * If your game is running under WebGL you can optionally specify four different alpha values, each of which - * correspond to the four corners of the Game Object. Under Canvas only the `topLeft` value given is used. + * Initialize the state of the random data generator. * - * @method Phaser.GameObjects.Components.Alpha#setAlpha + * @method Phaser.Math.RandomDataGenerator#init * @since 3.0.0 * - * @param {number} [topLeft=1] - The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object. - * @param {number} [topRight] - The alpha value used for the top-right of the Game Object. WebGL only. - * @param {number} [bottomLeft] - The alpha value used for the bottom-left of the Game Object. WebGL only. - * @param {number} [bottomRight] - The alpha value used for the bottom-right of the Game Object. WebGL only. - * - * @return {this} This Game Object instance. + * @param {(string|string[])} seeds - The seeds to initialize the random data generator with. */ - setAlpha: function (topLeft, topRight, bottomLeft, bottomRight) + init: function (seeds) { - if (topLeft === undefined) { topLeft = 1; } - - // Treat as if there is only one alpha value for the whole Game Object - if (topRight === undefined) + if (typeof seeds === 'string') { - this.alpha = topLeft; + this.state(seeds); } else { - this._alphaTL = Clamp(topLeft, 0, 1); - this._alphaTR = Clamp(topRight, 0, 1); - this._alphaBL = Clamp(bottomLeft, 0, 1); - this._alphaBR = Clamp(bottomRight, 0, 1); + this.sow(seeds); } - - return this; }, /** - * The alpha value of the Game Object. + * Reset the seed of the random data generator. * - * This is a global value, impacting the entire Game Object, not just a region of it. + * _Note_: the seed array is only processed up to the first `undefined` (or `null`) value, should such be present. * - * @name Phaser.GameObjects.Components.Alpha#alpha - * @type {number} + * @method Phaser.Math.RandomDataGenerator#sow * @since 3.0.0 - */ - alpha: { - - get: function () - { - return this._alpha; - }, - - set: function (value) - { - var v = Clamp(value, 0, 1); - - this._alpha = v; - this._alphaTL = v; - this._alphaTR = v; - this._alphaBL = v; - this._alphaBR = v; - - if (v === 0) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } - } - - }, - - /** - * The alpha value starting from the top-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. * - * @name Phaser.GameObjects.Components.Alpha#alphaTopLeft - * @type {number} - * @webglOnly - * @since 3.0.0 - */ - alphaTopLeft: { - - get: function () - { - return this._alphaTL; - }, - - set: function (value) - { - var v = Clamp(value, 0, 1); - - this._alphaTL = v; - - if (v !== 0) - { - this.renderFlags |= _FLAG; - } - } - - }, - - /** - * The alpha value starting from the top-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Alpha#alphaTopRight - * @type {number} - * @webglOnly - * @since 3.0.0 + * @param {string[]} seeds - The array of seeds: the `toString()` of each value is used. */ - alphaTopRight: { - - get: function () - { - return this._alphaTR; - }, + sow: function (seeds) + { + // Always reset to default seed + this.n = 0xefc8249d; + this.s0 = this.hash(' '); + this.s1 = this.hash(' '); + this.s2 = this.hash(' '); + this.c = 1; - set: function (value) + if (!seeds) { - var v = Clamp(value, 0, 1); - - this._alphaTR = v; - - if (v !== 0) - { - this.renderFlags |= _FLAG; - } + return; } - }, - - /** - * The alpha value starting from the bottom-left of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * - * @name Phaser.GameObjects.Components.Alpha#alphaBottomLeft - * @type {number} - * @webglOnly - * @since 3.0.0 - */ - alphaBottomLeft: { - - get: function () - { - return this._alphaBL; - }, - - set: function (value) + // Apply any seeds + for (var i = 0; i < seeds.length && (seeds[i] != null); i++) { - var v = Clamp(value, 0, 1); - - this._alphaBL = v; + var seed = seeds[i]; - if (v !== 0) - { - this.renderFlags |= _FLAG; - } + this.s0 -= this.hash(seed); + this.s0 += ~~(this.s0 < 0); + this.s1 -= this.hash(seed); + this.s1 += ~~(this.s1 < 0); + this.s2 -= this.hash(seed); + this.s2 += ~~(this.s2 < 0); } - }, /** - * The alpha value starting from the bottom-right of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. + * Returns a random integer between 0 and 2^32. * - * @name Phaser.GameObjects.Components.Alpha#alphaBottomRight - * @type {number} - * @webglOnly - * @since 3.0.0 - */ - alphaBottomRight: { - - get: function () - { - return this._alphaBR; - }, - - set: function (value) - { - var v = Clamp(value, 0, 1); - - this._alphaBR = v; - - if (v !== 0) - { - this.renderFlags |= _FLAG; - } - } - - } - -}; - -module.exports = Alpha; - - -/***/ }), -/* 608 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Provides methods used for calculating and setting the size of a non-Frame based Game Object. - * Should be applied as a mixin and not used directly. - * - * @namespace Phaser.GameObjects.Components.ComputedSize - * @since 3.0.0 - */ - -var ComputedSize = { - - /** - * The native (un-scaled) width of this Game Object. - * - * Changing this value will not change the size that the Game Object is rendered in-game. - * For that you need to either set the scale of the Game Object (`setScale`) or use - * the `displayWidth` property. - * - * @name Phaser.GameObjects.Components.ComputedSize#width - * @type {number} - * @since 3.0.0 - */ - width: 0, - - /** - * The native (un-scaled) height of this Game Object. - * - * Changing this value will not change the size that the Game Object is rendered in-game. - * For that you need to either set the scale of the Game Object (`setScale`) or use - * the `displayHeight` property. - * - * @name Phaser.GameObjects.Components.ComputedSize#height - * @type {number} - * @since 3.0.0 - */ - height: 0, - - /** - * The displayed width of this Game Object. - * - * This value takes into account the scale factor. - * - * Setting this value will adjust the Game Object's scale property. - * - * @name Phaser.GameObjects.Components.ComputedSize#displayWidth - * @type {number} - * @since 3.0.0 - */ - displayWidth: { - - get: function () - { - return this.scaleX * this.width; - }, - - set: function (value) - { - this.scaleX = value / this.width; - } - - }, - - /** - * The displayed height of this Game Object. - * - * This value takes into account the scale factor. - * - * Setting this value will adjust the Game Object's scale property. - * - * @name Phaser.GameObjects.Components.ComputedSize#displayHeight - * @type {number} + * @method Phaser.Math.RandomDataGenerator#integer * @since 3.0.0 - */ - displayHeight: { - - get: function () - { - return this.scaleY * this.height; - }, - - set: function (value) - { - this.scaleY = value / this.height; - } - - }, - - /** - * Sets the internal size of this Game Object, as used for frame or physics body creation. - * - * This will not change the size that the Game Object is rendered in-game. - * For that you need to either set the scale of the Game Object (`setScale`) or call the - * `setDisplaySize` method, which is the same thing as changing the scale but allows you - * to do so by giving pixel values. - * - * If you have enabled this Game Object for input, changing the size will _not_ change the - * size of the hit area. To do this you should adjust the `input.hitArea` object directly. - * - * @method Phaser.GameObjects.Components.ComputedSize#setSize - * @since 3.4.0 * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. - * - * @return {this} This Game Object instance. + * @return {number} A random integer between 0 and 2^32. */ - setSize: function (width, height) + integer: function () { - this.width = width; - this.height = height; - - return this; + // 2^32 + return this.rnd() * 0x100000000; }, /** - * Sets the display size of this Game Object. - * - * Calling this will adjust the scale. - * - * @method Phaser.GameObjects.Components.ComputedSize#setDisplaySize - * @since 3.4.0 - * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. - * - * @return {this} This Game Object instance. - */ - setDisplaySize: function (width, height) - { - this.displayWidth = width; - this.displayHeight = height; - - return this; - } - -}; - -module.exports = ComputedSize; - - -/***/ }), -/* 609 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Provides methods used for getting and setting the texture of a Game Object. - * - * @namespace Phaser.GameObjects.Components.Crop - * @since 3.12.0 - */ - -var Crop = { - - /** - * The Texture this Game Object is using to render with. - * - * @name Phaser.GameObjects.Components.Crop#texture - * @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture} - * @since 3.0.0 - */ - texture: null, - - /** - * The Texture Frame this Game Object is using to render with. + * Returns a random real number between 0 and 1. * - * @name Phaser.GameObjects.Components.Crop#frame - * @type {Phaser.Textures.Frame} + * @method Phaser.Math.RandomDataGenerator#frac * @since 3.0.0 - */ - frame: null, - - /** - * A boolean flag indicating if this Game Object is being cropped or not. - * You can toggle this at any time after `setCrop` has been called, to turn cropping on or off. - * Equally, calling `setCrop` with no arguments will reset the crop and disable it. - * - * @name Phaser.GameObjects.Components.Crop#isCropped - * @type {boolean} - * @since 3.11.0 - */ - isCropped: false, - - /** - * Applies a crop to a texture based Game Object, such as a Sprite or Image. - * - * The crop is a rectangle that limits the area of the texture frame that is visible during rendering. - * - * Cropping a Game Object does not change its size, dimensions, physics body or hit area, it just - * changes what is shown when rendered. - * - * The crop coordinates are relative to the texture frame, not the Game Object, meaning 0 x 0 is the top-left. - * - * Therefore, if you had a Game Object that had an 800x600 sized texture, and you wanted to show only the left - * half of it, you could call `setCrop(0, 0, 400, 600)`. - * - * It is also scaled to match the Game Object scale automatically. Therefore a crop rect of 100x50 would crop - * an area of 200x100 when applied to a Game Object that had a scale factor of 2. - * - * You can either pass in numeric values directly, or you can provide a single Rectangle object as the first argument. - * - * Call this method with no arguments at all to reset the crop, or toggle the property `isCropped` to `false`. - * - * You should do this if the crop rectangle becomes the same size as the frame itself, as it will allow - * the renderer to skip several internal calculations. - * - * @method Phaser.GameObjects.Components.Crop#setCrop - * @since 3.11.0 * - * @param {(number|Phaser.Geom.Rectangle)} [x] - The x coordinate to start the crop from. Or a Phaser.Geom.Rectangle object, in which case the rest of the arguments are ignored. - * @param {number} [y] - The y coordinate to start the crop from. - * @param {number} [width] - The width of the crop rectangle in pixels. - * @param {number} [height] - The height of the crop rectangle in pixels. - * - * @return {this} This Game Object instance. + * @return {number} A random real number between 0 and 1. */ - setCrop: function (x, y, width, height) + frac: function () { - if (x === undefined) - { - this.isCropped = false; - } - else if (this.frame) - { - if (typeof x === 'number') - { - this.frame.setCropUVs(this._crop, x, y, width, height, this.flipX, this.flipY); - } - else - { - var rect = x; - - this.frame.setCropUVs(this._crop, rect.x, rect.y, rect.width, rect.height, this.flipX, this.flipY); - } - - this.isCropped = true; - } - - return this; + // 2^-53 + return this.rnd() + (this.rnd() * 0x200000 | 0) * 1.1102230246251565e-16; }, /** - * Internal method that returns a blank, well-formed crop object for use by a Game Object. + * Returns a random real number between 0 and 2^32. * - * @method Phaser.GameObjects.Components.Crop#resetCropObject - * @private - * @since 3.12.0 - * - * @return {object} The crop object. - */ - resetCropObject: function () - { - return { u0: 0, v0: 0, u1: 0, v1: 0, width: 0, height: 0, x: 0, y: 0, flipX: false, flipY: false, cx: 0, cy: 0, cw: 0, ch: 0 }; - } - -}; - -module.exports = Crop; - - -/***/ }), -/* 610 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Provides methods used for visually flipping a Game Object. - * Should be applied as a mixin and not used directly. - * - * @namespace Phaser.GameObjects.Components.Flip - * @since 3.0.0 - */ - -var Flip = { - - /** - * The horizontally flipped state of the Game Object. - * - * A Game Object that is flipped horizontally will render inversed on the horizontal axis. - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. - * - * @name Phaser.GameObjects.Components.Flip#flipX - * @type {boolean} - * @default false - * @since 3.0.0 - */ - flipX: false, - - /** - * The vertically flipped state of the Game Object. - * - * A Game Object that is flipped vertically will render inversed on the vertical axis (i.e. upside down) - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. - * - * @name Phaser.GameObjects.Components.Flip#flipY - * @type {boolean} - * @default false - * @since 3.0.0 - */ - flipY: false, - - /** - * Toggles the horizontal flipped state of this Game Object. - * - * A Game Object that is flipped horizontally will render inversed on the horizontal axis. - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. - * - * @method Phaser.GameObjects.Components.Flip#toggleFlipX - * @since 3.0.0 - * - * @return {this} This Game Object instance. - */ - toggleFlipX: function () - { - this.flipX = !this.flipX; - - return this; - }, - - /** - * Toggles the vertical flipped state of this Game Object. - * - * @method Phaser.GameObjects.Components.Flip#toggleFlipY + * @method Phaser.Math.RandomDataGenerator#real * @since 3.0.0 - * - * @return {this} This Game Object instance. + * + * @return {number} A random real number between 0 and 2^32. */ - toggleFlipY: function () + real: function () { - this.flipY = !this.flipY; - - return this; + return this.integer() + this.frac(); }, /** - * Sets the horizontal flipped state of this Game Object. - * - * A Game Object that is flipped horizontally will render inversed on the horizontal axis. - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. - * - * @method Phaser.GameObjects.Components.Flip#setFlipX + * Returns a random integer between and including min and max. + * + * @method Phaser.Math.RandomDataGenerator#integerInRange * @since 3.0.0 * - * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. - * - * @return {this} This Game Object instance. + * @param {number} min - The minimum value in the range. + * @param {number} max - The maximum value in the range. + * + * @return {number} A random number between min and max. */ - setFlipX: function (value) + integerInRange: function (min, max) { - this.flipX = value; - - return this; + return Math.floor(this.realInRange(0, max - min + 1) + min); }, /** - * Sets the vertical flipped state of this Game Object. - * - * @method Phaser.GameObjects.Components.Flip#setFlipY + * Returns a random integer between and including min and max. + * This method is an alias for RandomDataGenerator.integerInRange. + * + * @method Phaser.Math.RandomDataGenerator#between * @since 3.0.0 * - * @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped. - * - * @return {this} This Game Object instance. + * @param {number} min - The minimum value in the range. + * @param {number} max - The maximum value in the range. + * + * @return {number} A random number between min and max. */ - setFlipY: function (value) + between: function (min, max) { - this.flipY = value; - - return this; + return Math.floor(this.realInRange(0, max - min + 1) + min); }, /** - * Sets the horizontal and vertical flipped state of this Game Object. - * - * A Game Object that is flipped will render inversed on the flipped axis. - * Flipping always takes place from the middle of the texture and does not impact the scale value. - * If this Game Object has a physics body, it will not change the body. This is a rendering toggle only. - * - * @method Phaser.GameObjects.Components.Flip#setFlip + * Returns a random real number between min and max. + * + * @method Phaser.Math.RandomDataGenerator#realInRange * @since 3.0.0 * - * @param {boolean} x - The horizontal flipped state. `false` for no flip, or `true` to be flipped. - * @param {boolean} y - The horizontal flipped state. `false` for no flip, or `true` to be flipped. - * - * @return {this} This Game Object instance. + * @param {number} min - The minimum value in the range. + * @param {number} max - The maximum value in the range. + * + * @return {number} A random number between min and max. */ - setFlip: function (x, y) + realInRange: function (min, max) { - this.flipX = x; - this.flipY = y; - - return this; + return this.frac() * (max - min) + min; }, /** - * Resets the horizontal and vertical flipped state of this Game Object back to their default un-flipped state. - * - * @method Phaser.GameObjects.Components.Flip#resetFlip + * Returns a random real number between -1 and 1. + * + * @method Phaser.Math.RandomDataGenerator#normal * @since 3.0.0 * - * @return {this} This Game Object instance. + * @return {number} A random real number between -1 and 1. */ - resetFlip: function () + normal: function () { - this.flipX = false; - this.flipY = false; - - return this; - } - -}; - -module.exports = Flip; - - -/***/ }), -/* 611 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Rectangle = __webpack_require__(10); -var RotateAround = __webpack_require__(308); -var Vector2 = __webpack_require__(3); - -/** - * Provides methods used for obtaining the bounds of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @namespace Phaser.GameObjects.Components.GetBounds - * @since 3.0.0 - */ - -var GetBounds = { + return 1 - (2 * this.frac()); + }, /** - * Processes the bounds output vector before returning it. - * - * @method Phaser.GameObjects.Components.GetBounds#prepareBoundsOutput - * @private - * @since 3.18.0 - * - * @generic {Phaser.Math.Vector2} O - [output,$return] + * Returns a valid RFC4122 version4 ID hex string from https://gist.github.com/1308368 * - * @param {(Phaser.Math.Vector2|object)} output - An object to store the values in. If not provided a new Vector2 will be created. - * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? + * @method Phaser.Math.RandomDataGenerator#uuid + * @since 3.0.0 * - * @return {(Phaser.Math.Vector2|object)} The values stored in the output object. + * @return {string} A valid RFC4122 version4 ID hex string */ - prepareBoundsOutput: function (output, includeParent) + uuid: function () { - if (includeParent === undefined) { includeParent = false; } - - if (this.rotation !== 0) - { - RotateAround(output, this.x, this.y, this.rotation); - } + var a = ''; + var b = ''; - if (includeParent && this.parentContainer) + for (b = a = ''; a++ < 36; b += ~a % 5 | a * 3 & 4 ? (a ^ 15 ? 8 ^ this.frac() * (a ^ 20 ? 16 : 4) : 4).toString(16) : '-') { - var parentMatrix = this.parentContainer.getBoundsTransformMatrix(); - - parentMatrix.transformPoint(output.x, output.y, output); + // eslint-disable-next-line no-empty } - return output; + return b; }, /** - * Gets the center coordinate of this Game Object, regardless of origin. - * The returned point is calculated in local space and does not factor in any parent containers + * Returns a random element from within the given array. * - * @method Phaser.GameObjects.Components.GetBounds#getCenter + * @method Phaser.Math.RandomDataGenerator#pick * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [output,$return] + * @generic T + * @genericUse {T[]} - [array] + * @genericUse {T} - [$return] * - * @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created. + * @param {T[]} array - The array to pick a random element from. * - * @return {(Phaser.Math.Vector2|object)} The values stored in the output object. + * @return {T} A random member of the array. */ - getCenter: function (output) + pick: function (array) { - if (output === undefined) { output = new Vector2(); } - - output.x = this.x - (this.displayWidth * this.originX) + (this.displayWidth / 2); - output.y = this.y - (this.displayHeight * this.originY) + (this.displayHeight / 2); - - return output; + return array[this.integerInRange(0, array.length - 1)]; }, /** - * Gets the top-left corner coordinate of this Game Object, regardless of origin. - * The returned point is calculated in local space and does not factor in any parent containers + * Returns a sign to be used with multiplication operator. * - * @method Phaser.GameObjects.Components.GetBounds#getTopLeft + * @method Phaser.Math.RandomDataGenerator#sign * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [output,$return] - * - * @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? - * - * @return {(Phaser.Math.Vector2|object)} The values stored in the output object. - */ - getTopLeft: function (output, includeParent) - { - if (!output) { output = new Vector2(); } - - output.x = this.x - (this.displayWidth * this.originX); - output.y = this.y - (this.displayHeight * this.originY); - - return this.prepareBoundsOutput(output, includeParent); - }, - - /** - * Gets the top-center coordinate of this Game Object, regardless of origin. - * The returned point is calculated in local space and does not factor in any parent containers - * - * @method Phaser.GameObjects.Components.GetBounds#getTopCenter - * @since 3.18.0 - * - * @generic {Phaser.Math.Vector2} O - [output,$return] - * - * @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? - * - * @return {(Phaser.Math.Vector2|object)} The values stored in the output object. + * @return {number} -1 or +1. */ - getTopCenter: function (output, includeParent) + sign: function () { - if (!output) { output = new Vector2(); } - - output.x = (this.x - (this.displayWidth * this.originX)) + (this.displayWidth / 2); - output.y = this.y - (this.displayHeight * this.originY); - - return this.prepareBoundsOutput(output, includeParent); + return this.pick(this.signs); }, /** - * Gets the top-right corner coordinate of this Game Object, regardless of origin. - * The returned point is calculated in local space and does not factor in any parent containers + * Returns a random element from within the given array, favoring the earlier entries. * - * @method Phaser.GameObjects.Components.GetBounds#getTopRight + * @method Phaser.Math.RandomDataGenerator#weightedPick * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [output,$return] + * @generic T + * @genericUse {T[]} - [array] + * @genericUse {T} - [$return] * - * @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? + * @param {T[]} array - The array to pick a random element from. * - * @return {(Phaser.Math.Vector2|object)} The values stored in the output object. + * @return {T} A random member of the array. */ - getTopRight: function (output, includeParent) + weightedPick: function (array) { - if (!output) { output = new Vector2(); } - - output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; - output.y = this.y - (this.displayHeight * this.originY); - - return this.prepareBoundsOutput(output, includeParent); + return array[~~(Math.pow(this.frac(), 2) * (array.length - 1) + 0.5)]; }, /** - * Gets the left-center coordinate of this Game Object, regardless of origin. - * The returned point is calculated in local space and does not factor in any parent containers - * - * @method Phaser.GameObjects.Components.GetBounds#getLeftCenter - * @since 3.18.0 + * Returns a random timestamp between min and max, or between the beginning of 2000 and the end of 2020 if min and max aren't specified. * - * @generic {Phaser.Math.Vector2} O - [output,$return] + * @method Phaser.Math.RandomDataGenerator#timestamp + * @since 3.0.0 * - * @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? + * @param {number} min - The minimum value in the range. + * @param {number} max - The maximum value in the range. * - * @return {(Phaser.Math.Vector2|object)} The values stored in the output object. + * @return {number} A random timestamp between min and max. */ - getLeftCenter: function (output, includeParent) + timestamp: function (min, max) { - if (!output) { output = new Vector2(); } - - output.x = this.x - (this.displayWidth * this.originX); - output.y = (this.y - (this.displayHeight * this.originY)) + (this.displayHeight / 2); - - return this.prepareBoundsOutput(output, includeParent); + return this.realInRange(min || 946684800000, max || 1577862000000); }, /** - * Gets the right-center coordinate of this Game Object, regardless of origin. - * The returned point is calculated in local space and does not factor in any parent containers - * - * @method Phaser.GameObjects.Components.GetBounds#getRightCenter - * @since 3.18.0 - * - * @generic {Phaser.Math.Vector2} O - [output,$return] + * Returns a random angle between -180 and 180. * - * @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? + * @method Phaser.Math.RandomDataGenerator#angle + * @since 3.0.0 * - * @return {(Phaser.Math.Vector2|object)} The values stored in the output object. + * @return {number} A random number between -180 and 180. */ - getRightCenter: function (output, includeParent) + angle: function () { - if (!output) { output = new Vector2(); } - - output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; - output.y = (this.y - (this.displayHeight * this.originY)) + (this.displayHeight / 2); - - return this.prepareBoundsOutput(output, includeParent); + return this.integerInRange(-180, 180); }, /** - * Gets the bottom-left corner coordinate of this Game Object, regardless of origin. - * The returned point is calculated in local space and does not factor in any parent containers + * Returns a random rotation in radians, between -3.141 and 3.141 * - * @method Phaser.GameObjects.Components.GetBounds#getBottomLeft + * @method Phaser.Math.RandomDataGenerator#rotation * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [output,$return] - * - * @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? - * - * @return {(Phaser.Math.Vector2|object)} The values stored in the output object. + * @return {number} A random number between -3.141 and 3.141 */ - getBottomLeft: function (output, includeParent) + rotation: function () { - if (!output) { output = new Vector2(); } - - output.x = this.x - (this.displayWidth * this.originX); - output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; - - return this.prepareBoundsOutput(output, includeParent); + return this.realInRange(-3.1415926, 3.1415926); }, /** - * Gets the bottom-center coordinate of this Game Object, regardless of origin. - * The returned point is calculated in local space and does not factor in any parent containers - * - * @method Phaser.GameObjects.Components.GetBounds#getBottomCenter - * @since 3.18.0 + * Gets or Sets the state of the generator. This allows you to retain the values + * that the generator is using between games, i.e. in a game save file. * - * @generic {Phaser.Math.Vector2} O - [output,$return] + * To seed this generator with a previously saved state you can pass it as the + * `seed` value in your game config, or call this method directly after Phaser has booted. * - * @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? + * Call this method with no parameters to return the current state. * - * @return {(Phaser.Math.Vector2|object)} The values stored in the output object. - */ - getBottomCenter: function (output, includeParent) - { - if (!output) { output = new Vector2(); } - - output.x = (this.x - (this.displayWidth * this.originX)) + (this.displayWidth / 2); - output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; - - return this.prepareBoundsOutput(output, includeParent); - }, - - /** - * Gets the bottom-right corner coordinate of this Game Object, regardless of origin. - * The returned point is calculated in local space and does not factor in any parent containers + * If providing a state it should match the same format that this method + * returns, which is a string with a header `!rnd` followed by the `c`, + * `s0`, `s1` and `s2` values respectively, each comma-delimited. * - * @method Phaser.GameObjects.Components.GetBounds#getBottomRight + * @method Phaser.Math.RandomDataGenerator#state * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [output,$return] - * - * @param {(Phaser.Math.Vector2|object)} [output] - An object to store the values in. If not provided a new Vector2 will be created. - * @param {boolean} [includeParent=false] - If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? + * @param {string} [state] - Generator state to be set. * - * @return {(Phaser.Math.Vector2|object)} The values stored in the output object. + * @return {string} The current state of the generator. */ - getBottomRight: function (output, includeParent) + state: function (state) { - if (!output) { output = new Vector2(); } + if (typeof state === 'string' && state.match(/^!rnd/)) + { + state = state.split(','); - output.x = (this.x - (this.displayWidth * this.originX)) + this.displayWidth; - output.y = (this.y - (this.displayHeight * this.originY)) + this.displayHeight; + this.c = parseFloat(state[1]); + this.s0 = parseFloat(state[2]); + this.s1 = parseFloat(state[3]); + this.s2 = parseFloat(state[4]); + } - return this.prepareBoundsOutput(output, includeParent); + return [ '!rnd', this.c, this.s0, this.s1, this.s2 ].join(','); }, /** - * Gets the bounds of this Game Object, regardless of origin. - * The values are stored and returned in a Rectangle, or Rectangle-like, object. + * Shuffles the given array, using the current seed. * - * @method Phaser.GameObjects.Components.GetBounds#getBounds - * @since 3.0.0 + * @method Phaser.Math.RandomDataGenerator#shuffle + * @since 3.7.0 * - * @generic {Phaser.Geom.Rectangle} O - [output,$return] + * @generic T + * @genericUse {T[]} - [array,$return] * - * @param {(Phaser.Geom.Rectangle|object)} [output] - An object to store the values in. If not provided a new Rectangle will be created. + * @param {T[]} [array] - The array to be shuffled. * - * @return {(Phaser.Geom.Rectangle|object)} The values stored in the output object. + * @return {T[]} The shuffled array. */ - getBounds: function (output) + shuffle: function (array) { - if (output === undefined) { output = new Rectangle(); } - - // We can use the output object to temporarily store the x/y coords in: - - var TLx, TLy, TRx, TRy, BLx, BLy, BRx, BRy; + var len = array.length - 1; - // Instead of doing a check if parent container is - // defined per corner we only do it once. - if (this.parentContainer) + for (var i = len; i > 0; i--) { - var parentMatrix = this.parentContainer.getBoundsTransformMatrix(); - - this.getTopLeft(output); - parentMatrix.transformPoint(output.x, output.y, output); - - TLx = output.x; - TLy = output.y; - - this.getTopRight(output); - parentMatrix.transformPoint(output.x, output.y, output); - - TRx = output.x; - TRy = output.y; - - this.getBottomLeft(output); - parentMatrix.transformPoint(output.x, output.y, output); - - BLx = output.x; - BLy = output.y; - - this.getBottomRight(output); - parentMatrix.transformPoint(output.x, output.y, output); + var randomIndex = Math.floor(this.frac() * (i + 1)); + var itemAtIndex = array[randomIndex]; - BRx = output.x; - BRy = output.y; + array[randomIndex] = array[i]; + array[i] = itemAtIndex; } - else - { - this.getTopLeft(output); - TLx = output.x; - TLy = output.y; + return array; + } - this.getTopRight(output); +}); - TRx = output.x; - TRy = output.y; +module.exports = RandomDataGenerator; - this.getBottomLeft(output); - BLx = output.x; - BLy = output.y; +/***/ }), - this.getBottomRight(output); +/***/ 82127: +/***/ ((module) => { - BRx = output.x; - BRy = output.y; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - output.x = Math.min(TLx, TRx, BLx, BRx); - output.y = Math.min(TLy, TRy, BLy, BRy); - output.width = Math.max(TLx, TRx, BLx, BRx) - output.x; - output.height = Math.max(TLy, TRy, BLy, BRy) - output.y; +/** + * Snap a value to nearest grid slice, using ceil. + * + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`. + * As will `14` snap to `15`... but `16` will snap to `20`. + * + * @function Phaser.Math.Snap.Ceil + * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. + */ +var SnapCeil = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } - return output; + if (gap === 0) + { + return value; } + value -= start; + value = gap * Math.ceil(value / gap); + + return (divide) ? (start + value) / gap : start + value; }; -module.exports = GetBounds; +module.exports = SnapCeil; /***/ }), -/* 612 */ -/***/ (function(module, exports) { + +/***/ 84314: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Game Blur Event. - * - * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded - * enters a blurred state. The blur event is raised when the window loses focus. This can happen if a user swaps - * tab, or if they simply remove focus from the browser to another app. + * Snap a value to nearest grid slice, using floor. * - * @event Phaser.Core.Events#BLUR + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. + * As will `14` snap to `10`... but `16` will snap to `15`. + * + * @function Phaser.Math.Snap.Floor * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. */ -module.exports = 'blur'; +var SnapFloor = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.floor(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapFloor; /***/ }), -/* 613 */ -/***/ (function(module, exports) { + +/***/ 88462: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Game Boot Event. - * - * This event is dispatched when the Phaser Game instance has finished booting, but before it is ready to start running. - * The global systems use this event to know when to set themselves up, dispatching their own `ready` events as required. + * Snap a value to nearest grid slice, using rounding. * - * @event Phaser.Core.Events#BOOT + * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10` whereas `14` will snap to `15`. + * + * @function Phaser.Math.Snap.To * @since 3.0.0 + * + * @param {number} value - The value to snap. + * @param {number} gap - The interval gap of the grid. + * @param {number} [start=0] - Optional starting offset for gap. + * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. + * + * @return {number} The snapped value. */ -module.exports = 'boot'; +var SnapTo = function (value, gap, start, divide) +{ + if (start === undefined) { start = 0; } + + if (gap === 0) + { + return value; + } + + value -= start; + value = gap * Math.round(value / gap); + + return (divide) ? (start + value) / gap : start + value; +}; + +module.exports = SnapTo; /***/ }), -/* 614 */ -/***/ (function(module, exports) { + +/***/ 23679: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Game Context Lost Event. - * - * This event is dispatched by the Game if the WebGL Renderer it is using encounters a WebGL Context Lost event from the browser. - * - * The partner event is `CONTEXT_RESTORED`. - * - * @event Phaser.Core.Events#CONTEXT_LOST - * @since 3.19.0 + * @namespace Phaser.Math.Snap */ -module.exports = 'contextlost'; + +module.exports = { + + Ceil: __webpack_require__(82127), + Floor: __webpack_require__(84314), + To: __webpack_require__(88462) + +}; /***/ }), -/* 615 */ -/***/ (function(module, exports) { + +/***/ 92491: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * The Game Context Restored Event. - * - * This event is dispatched by the Game if the WebGL Renderer it is using encounters a WebGL Context Restored event from the browser. - * - * The partner event is `CONTEXT_LOST`. - * - * @event Phaser.Core.Events#CONTEXT_RESTORED - * @since 3.19.0 - */ -module.exports = 'contextrestored'; - - -/***/ }), -/* 616 */ -/***/ (function(module, exports) { +__webpack_require__(75205); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var CONST = __webpack_require__(86459); +var Extend = __webpack_require__(98611); /** - * The Game Destroy Event. - * - * This event is dispatched when the game instance has been told to destroy itself. - * Lots of internal systems listen to this event in order to clear themselves out. - * Custom plugins and game code should also do the same. - * - * @event Phaser.Core.Events#DESTROY - * @since 3.0.0 + * @namespace Phaser */ -module.exports = 'destroy'; - -/***/ }), -/* 617 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var Phaser = { -/** - * The Game Focus Event. - * - * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded - * enters a focused state. The focus event is raised when the window re-gains focus, having previously lost it. - * - * @event Phaser.Core.Events#FOCUS - * @since 3.0.0 - */ -module.exports = 'focus'; + Actions: __webpack_require__(83979), + Animations: __webpack_require__(13517), + BlendModes: __webpack_require__(95723), + Cache: __webpack_require__(45820), + Cameras: __webpack_require__(44143), + Core: __webpack_require__(80293), + Class: __webpack_require__(56694), + Create: __webpack_require__(84106), + Curves: __webpack_require__(73962), + Data: __webpack_require__(1999), + Display: __webpack_require__(24816), + DOM: __webpack_require__(3590), + Events: __webpack_require__(95146), + FX: __webpack_require__(96910), + Game: __webpack_require__(15213), + GameObjects: __webpack_require__(48013), + Geom: __webpack_require__(84068), + Input: __webpack_require__(20873), + Loader: __webpack_require__(95695), + Math: __webpack_require__(5923), + Physics: __webpack_require__(53954), + Plugins: __webpack_require__(45615), + Renderer: __webpack_require__(42069), + Scale: __webpack_require__(86754), + ScaleModes: __webpack_require__(27394), + Scene: __webpack_require__(87157), + Scenes: __webpack_require__(20436), + Structs: __webpack_require__(20010), + Textures: __webpack_require__(87499), + Tilemaps: __webpack_require__(52678), + Time: __webpack_require__(97121), + Tweens: __webpack_require__(75193), + Utils: __webpack_require__(22178) +}; -/***/ }), -/* 618 */ -/***/ (function(module, exports) { +// Merge in the optional plugins and WebGL only features -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +if (true) +{ + Phaser.Sound = __webpack_require__(56751); +} -/** - * The Game Hidden Event. - * - * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded - * enters a hidden state. Only browsers that support the Visibility API will cause this event to be emitted. - * - * In most modern browsers, when the document enters a hidden state, the Request Animation Frame and setTimeout, which - * control the main game loop, will automatically pause. There is no way to stop this from happening. It is something - * your game should account for in its own code, should the pause be an issue (i.e. for multiplayer games) - * - * @event Phaser.Core.Events#HIDDEN - * @since 3.0.0 - */ -module.exports = 'hidden'; +if (false) +{} +if (false) +{} -/***/ }), -/* 619 */ -/***/ (function(module, exports) { +// Merge in the consts -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +Phaser = Extend(false, Phaser, CONST); /** - * The Game Pause Event. - * - * This event is dispatched when the Game loop enters a paused state, usually as a result of the Visibility Handler. + * The root types namespace. * - * @event Phaser.Core.Events#PAUSE - * @since 3.0.0 + * @namespace Phaser.Types + * @since 3.17.0 */ -module.exports = 'pause'; +// Export it -/***/ }), -/* 620 */ -/***/ (function(module, exports) { +module.exports = Phaser; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +__webpack_require__.g.Phaser = Phaser; -/** - * The Game Post-Render Event. - * - * This event is dispatched right at the end of the render process. - * - * Every Scene will have rendered and been drawn to the canvas by the time this event is fired. - * Use it for any last minute post-processing before the next game step begins. - * - * @event Phaser.Core.Events#POST_RENDER - * @since 3.0.0 - * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer being used by the Game instance. +/* + * "Documentation is like pizza: when it is good, it is very, very good; + * and when it is bad, it is better than nothing." + * -- Dick Brandon */ -module.exports = 'postrender'; /***/ }), -/* 621 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Game Post-Step Event. - * - * This event is dispatched after the Scene Manager has updated. - * Hook into it from plugins or systems that need to do things before the render starts. - * - * @event Phaser.Core.Events#POST_STEP - * @since 3.0.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ -module.exports = 'poststep'; - -/***/ }), -/* 622 */ -/***/ (function(module, exports) { +/***/ 62832: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * The Game Pre-Render Event. - * - * This event is dispatched immediately before any of the Scenes have started to render. - * - * The renderer will already have been initialized this frame, clearing itself and preparing to receive the Scenes for rendering, but it won't have actually drawn anything yet. - * - * @event Phaser.Core.Events#PRE_RENDER - * @since 3.0.0 - * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - A reference to the current renderer being used by the Game instance. - */ -module.exports = 'prerender'; - - -/***/ }), -/* 623 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var Class = __webpack_require__(56694); +var Components = __webpack_require__(7864); +var Image = __webpack_require__(1539); /** - * The Game Pre-Step Event. - * - * This event is dispatched before the main Game Step starts. By this point in the game cycle none of the Scene updates have yet happened. - * Hook into it from plugins or systems that need to update before the Scene Manager does. + * @classdesc + * An Arcade Physics Image is an Image with an Arcade Physics body and related components. + * The body can be dynamic or static. * - * @event Phaser.Core.Events#PRE_STEP - * @since 3.0.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ -module.exports = 'prestep'; - - -/***/ }), -/* 624 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Game Ready Event. - * - * This event is dispatched when the Phaser Game instance has finished booting, the Texture Manager is fully ready, - * and all local systems are now able to start. + * The main difference between an Arcade Image and an Arcade Sprite is that you cannot animate an Arcade Image. * - * @event Phaser.Core.Events#READY + * @class Image + * @extends Phaser.GameObjects.Image + * @memberof Phaser.Physics.Arcade + * @constructor * @since 3.0.0 - */ -module.exports = 'ready'; - - -/***/ }), -/* 625 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Game Resume Event. - * - * This event is dispatched when the game loop leaves a paused state and resumes running. * - * @event Phaser.Core.Events#RESUME - * @since 3.0.0 - */ -module.exports = 'resume'; - - -/***/ }), -/* 626 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Game Step Event. - * - * This event is dispatched after the Game Pre-Step and before the Scene Manager steps. - * Hook into it from plugins or systems that need to update before the Scene Manager does, but after the core Systems have. + * @extends Phaser.Physics.Arcade.Components.Acceleration + * @extends Phaser.Physics.Arcade.Components.Angular + * @extends Phaser.Physics.Arcade.Components.Bounce + * @extends Phaser.Physics.Arcade.Components.Debug + * @extends Phaser.Physics.Arcade.Components.Drag + * @extends Phaser.Physics.Arcade.Components.Enable + * @extends Phaser.Physics.Arcade.Components.Friction + * @extends Phaser.Physics.Arcade.Components.Gravity + * @extends Phaser.Physics.Arcade.Components.Immovable + * @extends Phaser.Physics.Arcade.Components.Mass + * @extends Phaser.Physics.Arcade.Components.Pushable + * @extends Phaser.Physics.Arcade.Components.Size + * @extends Phaser.Physics.Arcade.Components.Velocity + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible * - * @event Phaser.Core.Events#STEP - * @since 3.0.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ -module.exports = 'step'; - +var ArcadeImage = new Class({ -/***/ }), -/* 627 */ -/***/ (function(module, exports) { + Extends: Image, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + Mixins: [ + Components.Acceleration, + Components.Angular, + Components.Bounce, + Components.Debug, + Components.Drag, + Components.Enable, + Components.Friction, + Components.Gravity, + Components.Immovable, + Components.Mass, + Components.Pushable, + Components.Size, + Components.Velocity + ], -/** - * The Game Visible Event. - * - * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded - * enters a visible state, previously having been hidden. - * - * Only browsers that support the Visibility API will cause this event to be emitted. - * - * @event Phaser.Core.Events#VISIBLE - * @since 3.0.0 - */ -module.exports = 'visible'; + initialize: + function ArcadeImage (scene, x, y, texture, frame) + { + Image.call(this, scene, x, y, texture, frame); -/***/ }), -/* 628 */ -/***/ (function(module, exports) { + /** + * This Game Object's Physics Body. + * + * @name Phaser.Physics.Arcade.Image#body + * @type {?(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} + * @default null + * @since 3.0.0 + */ + this.body = null; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +}); -/** - * The Post-Render Event. - * - * This event is dispatched by the Renderer when all rendering, for all cameras in all Scenes, - * has completed, but before any pending snap shots have been taken. - * - * @event Phaser.Renderer.Events#POST_RENDER - * @since 3.50.0 - */ -module.exports = 'postrender'; +module.exports = ArcadeImage; /***/ }), -/* 629 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Pre-Render Event. - * - * This event is dispatched by the Phaser Renderer. This happens right at the start of the render - * process, after the context has been cleared, the scissors enabled (WebGL only) and everything has been - * reset ready for the render. - * - * @event Phaser.Renderer.Events#PRE_RENDER - * @since 3.50.0 - */ -module.exports = 'prerender'; - -/***/ }), -/* 630 */ -/***/ (function(module, exports) { +/***/ 66150: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var DegToRad = __webpack_require__(75606); +var DistanceBetween = __webpack_require__(53996); +var DistanceSquared = __webpack_require__(35032); +var Factory = __webpack_require__(99523); +var GetFastValue = __webpack_require__(72632); +var Merge = __webpack_require__(30657); +var OverlapCirc = __webpack_require__(2732); +var OverlapRect = __webpack_require__(15147); +var PluginCache = __webpack_require__(91963); +var SceneEvents = __webpack_require__(7599); +var Vector2 = __webpack_require__(93736); +var World = __webpack_require__(85233); + /** - * The Render Event. + * @classdesc + * The Arcade Physics Plugin belongs to a Scene and sets up and manages the Scene's physics simulation. + * It also holds some useful methods for moving and rotating Arcade Physics Bodies. * - * This event is dispatched by the Phaser Renderer for every camera in every Scene. + * You can access it from within a Scene using `this.physics`. * - * It is dispatched before any of the children in the Scene have been rendered. + * Arcade Physics uses the Projection Method of collision resolution and separation. While it's fast and suitable + * for 'arcade' style games it lacks stability when multiple objects are in close proximity or resting upon each other. + * The separation that stops two objects penetrating may create a new penetration against a different object. If you + * require a high level of stability please consider using an alternative physics system, such as Matter.js. * - * @event Phaser.Renderer.Events#RENDER - * @since 3.50.0 + * @class ArcadePhysics + * @memberof Phaser.Physics.Arcade + * @constructor + * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene being rendered. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered. + * @param {Phaser.Scene} scene - The Scene that this Plugin belongs to. */ -module.exports = 'render'; - - -/***/ }), -/* 631 */ -/***/ (function(module, exports) { +var ArcadePhysics = new Class({ -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + initialize: -/** - * The Renderer Resize Event. - * - * This event is dispatched by the Phaser Renderer when it is resized, usually as a result - * of the Scale Manager resizing. - * - * @event Phaser.Renderer.Events#RESIZE - * @since 3.50.0 - * - * @param {number} width - The new width of the renderer. - * @param {number} height - The new height of the renderer. - */ -module.exports = 'resize'; + function ArcadePhysics (scene) + { + /** + * The Scene that this Plugin belongs to. + * + * @name Phaser.Physics.Arcade.ArcadePhysics#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; + /** + * The Scene's Systems. + * + * @name Phaser.Physics.Arcade.ArcadePhysics#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; -/***/ }), -/* 632 */ -/***/ (function(module, exports) { + /** + * A configuration object. Union of the `physics.arcade.*` properties of the GameConfig and SceneConfig objects. + * + * @name Phaser.Physics.Arcade.ArcadePhysics#config + * @type {Phaser.Types.Physics.Arcade.ArcadeWorldConfig} + * @since 3.0.0 + */ + this.config = this.getConfig(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The physics simulation. + * + * @name Phaser.Physics.Arcade.ArcadePhysics#world + * @type {Phaser.Physics.Arcade.World} + * @since 3.0.0 + */ + this.world; -/** - * Provides methods used for getting and setting the origin of a Game Object. - * Values are normalized, given in the range 0 to 1. - * Display values contain the calculated pixel values. - * Should be applied as a mixin and not used directly. - * - * @namespace Phaser.GameObjects.Components.Origin - * @since 3.0.0 - */ + /** + * An object holding the Arcade Physics factory methods. + * + * @name Phaser.Physics.Arcade.ArcadePhysics#add + * @type {Phaser.Physics.Arcade.Factory} + * @since 3.0.0 + */ + this.add; -var Origin = { + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); + }, /** - * A property indicating that a Game Object has this component. + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. * - * @name Phaser.GameObjects.Components.Origin#_originComponent - * @type {boolean} + * @method Phaser.Physics.Arcade.ArcadePhysics#boot * @private - * @default true - * @since 3.2.0 - */ - _originComponent: true, - - /** - * The horizontal origin of this Game Object. - * The origin maps the relationship between the size and position of the Game Object. - * The default value is 0.5, meaning all Game Objects are positioned based on their center. - * Setting the value to 0 means the position now relates to the left of the Game Object. - * - * @name Phaser.GameObjects.Components.Origin#originX - * @type {number} - * @default 0.5 - * @since 3.0.0 - */ - originX: 0.5, - - /** - * The vertical origin of this Game Object. - * The origin maps the relationship between the size and position of the Game Object. - * The default value is 0.5, meaning all Game Objects are positioned based on their center. - * Setting the value to 0 means the position now relates to the top of the Game Object. - * - * @name Phaser.GameObjects.Components.Origin#originY - * @type {number} - * @default 0.5 - * @since 3.0.0 + * @since 3.5.1 */ - originY: 0.5, + boot: function () + { + this.world = new World(this.scene, this.config); + this.add = new Factory(this.world); - // private + read only - _displayOriginX: 0, - _displayOriginY: 0, + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); + }, /** - * The horizontal display origin of this Game Object. - * The origin is a normalized value between 0 and 1. - * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. * - * @name Phaser.GameObjects.Components.Origin#displayOriginX - * @type {number} - * @since 3.0.0 + * @method Phaser.Physics.Arcade.ArcadePhysics#start + * @private + * @since 3.5.0 */ - displayOriginX: { - - get: function () + start: function () + { + if (!this.world) { - return this._displayOriginX; - }, + this.world = new World(this.scene, this.config); + this.add = new Factory(this.world); + } - set: function (value) + var eventEmitter = this.systems.events; + + if (!GetFastValue(this.config, 'customUpdate', false)) { - this._displayOriginX = value; - this.originX = value / this.width; + eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); } + eventEmitter.on(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * The vertical display origin of this Game Object. - * The origin is a normalized value between 0 and 1. - * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. + * Causes `World.update` to be automatically called each time the Scene + * emits and `UPDATE` event. This is the default setting, so only needs + * calling if you have specifically disabled it. * - * @name Phaser.GameObjects.Components.Origin#displayOriginY - * @type {number} - * @since 3.0.0 + * @method Phaser.Physics.Arcade.ArcadePhysics#enableUpdate + * @since 3.50.0 */ - displayOriginY: { - - get: function () - { - return this._displayOriginY; - }, - - set: function (value) - { - this._displayOriginY = value; - this.originY = value / this.height; - } - + enableUpdate: function () + { + this.systems.events.on(SceneEvents.UPDATE, this.world.update, this.world); }, /** - * Sets the origin of this Game Object. - * - * The values are given in the range 0 to 1. + * Causes `World.update` to **not** be automatically called each time the Scene + * emits and `UPDATE` event. * - * @method Phaser.GameObjects.Components.Origin#setOrigin - * @since 3.0.0 + * If you wish to run the World update at your own rate, or from your own + * component, then you should call this method to disable the built-in link, + * and then call `World.update(delta, time)` accordingly. * - * @param {number} [x=0.5] - The horizontal origin value. - * @param {number} [y=x] - The vertical origin value. If not defined it will be set to the value of `x`. + * Note that `World.postUpdate` is always automatically called when the Scene + * emits a `POST_UPDATE` event, regardless of this setting. * - * @return {this} This Game Object instance. + * @method Phaser.Physics.Arcade.ArcadePhysics#disableUpdate + * @since 3.50.0 */ - setOrigin: function (x, y) + disableUpdate: function () { - if (x === undefined) { x = 0.5; } - if (y === undefined) { y = x; } - - this.originX = x; - this.originY = y; - - return this.updateDisplayOrigin(); + this.systems.events.off(SceneEvents.UPDATE, this.world.update, this.world); }, /** - * Sets the origin of this Game Object based on the Pivot values in its Frame. + * Creates the physics configuration for the current Scene. * - * @method Phaser.GameObjects.Components.Origin#setOriginFromFrame + * @method Phaser.Physics.Arcade.ArcadePhysics#getConfig * @since 3.0.0 * - * @return {this} This Game Object instance. + * @return {Phaser.Types.Physics.Arcade.ArcadeWorldConfig} The physics configuration. */ - setOriginFromFrame: function () + getConfig: function () { - if (!this.frame || !this.frame.customPivot) - { - return this.setOrigin(); - } - else - { - this.originX = this.frame.pivotX; - this.originY = this.frame.pivotY; - } + var gameConfig = this.systems.game.config.physics; + var sceneConfig = this.systems.settings.physics; - return this.updateDisplayOrigin(); + var config = Merge( + GetFastValue(sceneConfig, 'arcade', {}), + GetFastValue(gameConfig, 'arcade', {}) + ); + + return config; }, /** - * Sets the display origin of this Game Object. - * The difference between this and setting the origin is that you can use pixel values for setting the display origin. + * Tests if Game Objects overlap. See {@link Phaser.Physics.Arcade.World#overlap} * - * @method Phaser.GameObjects.Components.Origin#setDisplayOrigin + * @method Phaser.Physics.Arcade.ArcadePhysics#overlap * @since 3.0.0 * - * @param {number} [x=0] - The horizontal display origin value. - * @param {number} [y=x] - The vertical display origin value. If not defined it will be set to the value of `x`. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [overlapCallback] - An optional callback function that is called if the objects overlap. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they overlap. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {*} [callbackContext] - The context in which to run the callbacks. * - * @return {this} This Game Object instance. + * @return {boolean} True if at least one Game Object overlaps another. + * + * @see Phaser.Physics.Arcade.World#overlap */ - setDisplayOrigin: function (x, y) + overlap: function (object1, object2, overlapCallback, processCallback, callbackContext) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = x; } - - this.displayOriginX = x; - this.displayOriginY = y; + if (overlapCallback === undefined) { overlapCallback = null; } + if (processCallback === undefined) { processCallback = null; } + if (callbackContext === undefined) { callbackContext = overlapCallback; } - return this; + return this.world.collideObjects(object1, object2, overlapCallback, processCallback, callbackContext, true); }, /** - * Updates the Display Origin cached values internally stored on this Game Object. - * You don't usually call this directly, but it is exposed for edge-cases where you may. + * Performs a collision check and separation between the two physics enabled objects given, which can be single + * Game Objects, arrays of Game Objects, Physics Groups, arrays of Physics Groups or normal Groups. * - * @method Phaser.GameObjects.Components.Origin#updateDisplayOrigin + * If you don't require separation then use {@link #overlap} instead. + * + * If two Groups or arrays are passed, each member of one will be tested against each member of the other. + * + * If **only** one Group is passed (as `object1`), each member of the Group will be collided against the other members. + * + * If **only** one Array is passed, the array is iterated and every element in it is tested against the others. + * + * Two callbacks can be provided. The `collideCallback` is invoked if a collision occurs and the two colliding + * objects are passed to it. + * + * Arcade Physics uses the Projection Method of collision resolution and separation. While it's fast and suitable + * for 'arcade' style games it lacks stability when multiple objects are in close proximity or resting upon each other. + * The separation that stops two objects penetrating may create a new penetration against a different object. If you + * require a high level of stability please consider using an alternative physics system, such as Matter.js. + * + * @method Phaser.Physics.Arcade.ArcadePhysics#collide * @since 3.0.0 * - * @return {this} This Game Object instance. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {*} [callbackContext] - The context in which to run the callbacks. + * + * @return {boolean} True if any overlapping Game Objects were separated, otherwise false. + * + * @see Phaser.Physics.Arcade.World#collide */ - updateDisplayOrigin: function () + collide: function (object1, object2, collideCallback, processCallback, callbackContext) { - this._displayOriginX = this.originX * this.width; - this._displayOriginY = this.originY * this.height; - - return this; - } - -}; - -module.exports = Origin; - - -/***/ }), -/* 633 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var DegToRad = __webpack_require__(36); -var GetBoolean = __webpack_require__(99); -var GetValue = __webpack_require__(6); -var TWEEN_CONST = __webpack_require__(100); -var Vector2 = __webpack_require__(3); - -/** - * Provides methods used for managing a Game Object following a Path. - * Should be applied as a mixin and not used directly. - * - * @namespace Phaser.GameObjects.Components.PathFollower - * @since 3.17.0 - */ + if (collideCallback === undefined) { collideCallback = null; } + if (processCallback === undefined) { processCallback = null; } + if (callbackContext === undefined) { callbackContext = collideCallback; } -var PathFollower = { + return this.world.collideObjects(object1, object2, collideCallback, processCallback, callbackContext, false); + }, /** - * The Path this PathFollower is following. It can only follow one Path at a time. + * This advanced method is specifically for testing for collision between a single Sprite and an array of Tile objects. * - * @name Phaser.GameObjects.Components.PathFollower#path - * @type {Phaser.Curves.Path} - * @since 3.0.0 - */ - path: null, - - /** - * Should the PathFollower automatically rotate to point in the direction of the Path? + * You should generally use the `collide` method instead, with a Sprite vs. a Tilemap Layer, as that will perform + * tile filtering and culling for you, as well as handle the interesting face collision automatically. * - * @name Phaser.GameObjects.Components.PathFollower#rotateToPath - * @type {boolean} - * @default false - * @since 3.0.0 - */ - rotateToPath: false, - - /** - * If the PathFollower is rotating to match the Path (@see Phaser.GameObjects.PathFollower#rotateToPath) - * this value is added to the rotation value. This allows you to rotate objects to a path but control - * the angle of the rotation as well. + * This method is offered for those who would like to check for collision with specific Tiles in a layer, without + * having to set any collision attributes on the tiles in question. This allows you to perform quick dynamic collisions + * on small sets of Tiles. As such, no culling or checks are made to the array of Tiles given to this method, + * you should filter them before passing them to this method. * - * @name Phaser.GameObjects.PathFollower#pathRotationOffset - * @type {number} - * @default 0 - * @since 3.0.0 - */ - pathRotationOffset: 0, - - /** - * An additional vector to add to the PathFollowers position, allowing you to offset it from the - * Path coordinates. + * Important: Use of this method skips the `interesting faces` system that Tilemap Layers use. This means if you have + * say a row or column of tiles, and you jump into, or walk over them, it's possible to get stuck on the edges of the + * tiles as the interesting face calculations are skipped. However, for quick-fire small collision set tests on + * dynamic maps, this method can prove very useful. * - * @name Phaser.GameObjects.PathFollower#pathOffset - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - pathOffset: null, - - /** - * A Vector2 that stores the current point of the path the follower is on. + * @method Phaser.Physics.Arcade.ArcadePhysics#collideTiles + * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @since 3.17.0 * - * @name Phaser.GameObjects.PathFollower#pathVector - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - pathVector: null, - - /** - * The distance the follower has traveled from the previous point to the current one, at the last update. + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.Tilemaps.Tile[]} tiles - An array of Tiles to check for collision against. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. * - * @name Phaser.GameObjects.PathFollower#pathDelta - * @type {Phaser.Math.Vector2} - * @since 3.23.0 + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ - pathDelta: null, + collideTiles: function (sprite, tiles, collideCallback, processCallback, callbackContext) + { + return this.world.collideTiles(sprite, tiles, collideCallback, processCallback, callbackContext); + }, /** - * The Tween used for following the Path. + * This advanced method is specifically for testing for overlaps between a single Sprite and an array of Tile objects. * - * @name Phaser.GameObjects.PathFollower#pathTween - * @type {Phaser.Tweens.Tween} - * @since 3.0.0 + * You should generally use the `overlap` method instead, with a Sprite vs. a Tilemap Layer, as that will perform + * tile filtering and culling for you, as well as handle the interesting face collision automatically. + * + * This method is offered for those who would like to check for overlaps with specific Tiles in a layer, without + * having to set any collision attributes on the tiles in question. This allows you to perform quick dynamic overlap + * tests on small sets of Tiles. As such, no culling or checks are made to the array of Tiles given to this method, + * you should filter them before passing them to this method. + * + * @method Phaser.Physics.Arcade.ArcadePhysics#overlapTiles + * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP + * @since 3.17.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.Tilemaps.Tile[]} tiles - An array of Tiles to check for collision against. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects overlap. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. */ - pathTween: null, + overlapTiles: function (sprite, tiles, collideCallback, processCallback, callbackContext) + { + return this.world.overlapTiles(sprite, tiles, collideCallback, processCallback, callbackContext); + }, /** - * Settings for the PathFollower. + * Pauses the simulation. * - * @name Phaser.GameObjects.PathFollower#pathConfig - * @type {?Phaser.Types.GameObjects.PathFollower.PathConfig} - * @default null + * @method Phaser.Physics.Arcade.ArcadePhysics#pause * @since 3.0.0 + * + * @return {Phaser.Physics.Arcade.World} The simulation. */ - pathConfig: null, + pause: function () + { + return this.world.pause(); + }, /** - * Records the direction of the follower so it can change direction. + * Resumes the simulation (if paused). * - * @name Phaser.GameObjects.PathFollower#_prevDirection - * @type {number} - * @private + * @method Phaser.Physics.Arcade.ArcadePhysics#resume * @since 3.0.0 + * + * @return {Phaser.Physics.Arcade.World} The simulation. */ - _prevDirection: TWEEN_CONST.PLAYING_FORWARD, + resume: function () + { + return this.world.resume(); + }, /** - * Set the Path that this PathFollower should follow. + * Sets the acceleration.x/y property on the game object so it will move towards the x/y coordinates at the given rate (in pixels per second squared) * - * Optionally accepts {@link Phaser.Types.GameObjects.PathFollower.PathConfig} settings. + * You must give a maximum speed value, beyond which the game object won't go any faster. * - * @method Phaser.GameObjects.Components.PathFollower#setPath + * Note: The game object does not continuously track the target. If the target changes location during transit the game object will not modify its course. + * Note: The game object doesn't stop moving once it reaches the destination coordinates. + * + * @method Phaser.Physics.Arcade.ArcadePhysics#accelerateTo * @since 3.0.0 * - * @param {Phaser.Curves.Path} path - The Path this PathFollower is following. It can only follow one Path at a time. - * @param {(number|Phaser.Types.GameObjects.PathFollower.PathConfig|Phaser.Types.Tweens.NumberTweenBuilderConfig)} [config] - Settings for the PathFollower. + * @param {Phaser.GameObjects.GameObject} gameObject - Any Game Object with an Arcade Physics body. + * @param {number} x - The x coordinate to accelerate towards. + * @param {number} y - The y coordinate to accelerate towards. + * @param {number} [speed=60] - The acceleration (change in speed) in pixels per second squared. + * @param {number} [xSpeedMax=500] - The maximum x velocity the game object can reach. + * @param {number} [ySpeedMax=500] - The maximum y velocity the game object can reach. * - * @return {this} This Game Object. + * @return {number} The angle (in radians) that the object should be visually set to in order to match its new velocity. */ - setPath: function (path, config) + accelerateTo: function (gameObject, x, y, speed, xSpeedMax, ySpeedMax) { - if (config === undefined) { config = this.pathConfig; } - - var tween = this.pathTween; + if (speed === undefined) { speed = 60; } - if (tween && tween.isPlaying()) - { - tween.stop(); - } + var angle = Math.atan2(y - gameObject.y, x - gameObject.x); - this.path = path; + gameObject.body.acceleration.setToPolar(angle, speed); - if (config) + if (xSpeedMax !== undefined && ySpeedMax !== undefined) { - this.startFollow(config); + gameObject.body.maxVelocity.set(xSpeedMax, ySpeedMax); } - return this; + return angle; }, /** - * Set whether the PathFollower should automatically rotate to point in the direction of the Path. + * Sets the acceleration.x/y property on the game object so it will move towards the x/y coordinates at the given rate (in pixels per second squared) * - * @method Phaser.GameObjects.Components.PathFollower#setRotateToPath + * You must give a maximum speed value, beyond which the game object won't go any faster. + * + * Note: The game object does not continuously track the target. If the target changes location during transit the game object will not modify its course. + * Note: The game object doesn't stop moving once it reaches the destination coordinates. + * + * @method Phaser.Physics.Arcade.ArcadePhysics#accelerateToObject * @since 3.0.0 * - * @param {boolean} value - Whether the PathFollower should automatically rotate to point in the direction of the Path. - * @param {number} [offset=0] - Rotation offset in degrees. + * @param {Phaser.GameObjects.GameObject} gameObject - Any Game Object with an Arcade Physics body. + * @param {Phaser.GameObjects.GameObject} destination - The Game Object to move towards. Can be any object but must have visible x/y properties. + * @param {number} [speed=60] - The acceleration (change in speed) in pixels per second squared. + * @param {number} [xSpeedMax=500] - The maximum x velocity the game object can reach. + * @param {number} [ySpeedMax=500] - The maximum y velocity the game object can reach. * - * @return {this} This Game Object. + * @return {number} The angle (in radians) that the object should be visually set to in order to match its new velocity. */ - setRotateToPath: function (value, offset) + accelerateToObject: function (gameObject, destination, speed, xSpeedMax, ySpeedMax) { - if (offset === undefined) { offset = 0; } - - this.rotateToPath = value; - - this.pathRotationOffset = offset; - - return this; + return this.accelerateTo(gameObject, destination.x, destination.y, speed, xSpeedMax, ySpeedMax); }, /** - * Is this PathFollower actively following a Path or not? + * Finds the Body or Game Object closest to a source point or object. * - * To be considered as `isFollowing` it must be currently moving on a Path, and not paused. + * If a `targets` argument is passed, this method finds the closest of those. + * The targets can be Arcade Physics Game Objects, Dynamic Bodies, or Static Bodies. * - * @method Phaser.GameObjects.Components.PathFollower#isFollowing - * @since 3.0.0 + * If no `targets` argument is passed, this method finds the closest Dynamic Body. * - * @return {boolean} `true` is this PathFollower is actively following a Path, otherwise `false`. - */ - isFollowing: function () - { - var tween = this.pathTween; - - return (tween && tween.isPlaying()); - }, - - /** - * Starts this PathFollower following its given Path. + * If two or more targets are the exact same distance from the source point, only the first target + * is returned. * - * @method Phaser.GameObjects.Components.PathFollower#startFollow - * @since 3.3.0 + * @method Phaser.Physics.Arcade.ArcadePhysics#closest + * @since 3.0.0 * - * @param {(number|Phaser.Types.GameObjects.PathFollower.PathConfig|Phaser.Types.Tweens.NumberTweenBuilderConfig)} [config={}] - The duration of the follow, or a PathFollower config object. - * @param {number} [startAt=0] - Optional start position of the follow, between 0 and 1. + * @generic {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody|Phaser.GameObjects.GameObject} Target + * @param {Phaser.Types.Math.Vector2Like} source - Any object with public `x` and `y` properties, such as a Game Object or Geometry object. + * @param {Target[]} [targets] - The targets. * - * @return {this} This Game Object. + * @return {Target|null} The target closest to the given source point. */ - startFollow: function (config, startAt) + closest: function (source, targets) { - if (config === undefined) { config = {}; } - if (startAt === undefined) { startAt = 0; } - - var tween = this.pathTween; - - if (tween && tween.isPlaying()) - { - tween.stop(); - } - - if (typeof config === 'number') + if (!targets) { - config = { duration: config }; + targets = this.world.bodies.entries; } - // Override in case they've been specified in the config - config.from = GetValue(config, 'from', 0); - config.to = GetValue(config, 'to', 1); + var min = Number.MAX_VALUE; + var closest = null; + var x = source.x; + var y = source.y; + var len = targets.length; - var positionOnPath = GetBoolean(config, 'positionOnPath', false); + for (var i = 0; i < len; i++) + { + var target = targets[i]; + var body = target.body || target; - this.rotateToPath = GetBoolean(config, 'rotateToPath', false); - this.pathRotationOffset = GetValue(config, 'rotationOffset', 0); + if (source === target || source === body || source === body.gameObject || source === body.center) + { + continue; + } - // This works, but it's not an ideal way of doing it as the follower jumps position - var seek = GetValue(config, 'startAt', startAt); + var distance = DistanceSquared(x, y, body.center.x, body.center.y); - if (seek) - { - config.onStart = function (tween) + if (distance < min) { - var tweenData = tween.data[0]; - tweenData.progress = seek; - tweenData.elapsed = tweenData.duration * seek; - var v = tweenData.ease(tweenData.progress); - tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v); - tweenData.target[tweenData.key] = tweenData.current; - }; + closest = target; + min = distance; + } } - if (!this.pathOffset) - { - this.pathOffset = new Vector2(this.x, this.y); - } + return closest; + }, - if (!this.pathVector) + /** + * Finds the Body or Game Object farthest from a source point or object. + * + * If a `targets` argument is passed, this method finds the farthest of those. + * The targets can be Arcade Physics Game Objects, Dynamic Bodies, or Static Bodies. + * + * If no `targets` argument is passed, this method finds the farthest Dynamic Body. + * + * If two or more targets are the exact same distance from the source point, only the first target + * is returned. + * + * @method Phaser.Physics.Arcade.ArcadePhysics#furthest + * @since 3.0.0 + * + * @param {any} source - Any object with public `x` and `y` properties, such as a Game Object or Geometry object. + * @param {(Phaser.Physics.Arcade.Body[]|Phaser.Physics.Arcade.StaticBody[]|Phaser.GameObjects.GameObject[])} [targets] - The targets. + * + * @return {?(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody|Phaser.GameObjects.GameObject)} The target farthest from the given source point. + */ + furthest: function (source, targets) + { + if (!targets) { - this.pathVector = new Vector2(); + targets = this.world.bodies.entries; } - if (!this.pathDelta) + var max = -1; + var farthest = null; + var x = source.x; + var y = source.y; + var len = targets.length; + + for (var i = 0; i < len; i++) { - this.pathDelta = new Vector2(); - } + var target = targets[i]; + var body = target.body || target; - this.pathDelta.reset(); + if (source === target || source === body || source === body.gameObject || source === body.center) + { + continue; + } - this.pathTween = this.scene.sys.tweens.addCounter(config); + var distance = DistanceSquared(x, y, body.center.x, body.center.y); - // The starting point of the path, relative to this follower - this.path.getStartPoint(this.pathOffset); + if (distance > max) + { + farthest = target; + max = distance; + } - if (positionOnPath) - { - this.x = this.pathOffset.x; - this.y = this.pathOffset.y; } - this.pathOffset.x = this.x - this.pathOffset.x; - this.pathOffset.y = this.y - this.pathOffset.y; - - this._prevDirection = TWEEN_CONST.PLAYING_FORWARD; - - if (this.rotateToPath) - { - // Set the rotation now (in case the tween has a delay on it, etc) - var nextPoint = this.path.getPoint(0.1); - - this.rotation = Math.atan2(nextPoint.y - this.y, nextPoint.x - this.x) + DegToRad(this.pathRotationOffset); - } - - this.pathConfig = config; - - return this; + return farthest; }, /** - * Pauses this PathFollower. It will still continue to render, but it will remain motionless at the - * point on the Path at which you paused it. + * Move the given display object towards the x/y coordinates at a steady velocity. + * If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds. + * Timings are approximate due to the way browser timers work. Allow for a variance of +- 50ms. + * Note: The display object does not continuously track the target. If the target changes location during transit the display object will not modify its course. + * Note: The display object doesn't stop moving once it reaches the destination coordinates. + * Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set drag or acceleration too high this object may not move at all) * - * @method Phaser.GameObjects.Components.PathFollower#pauseFollow - * @since 3.3.0 + * @method Phaser.Physics.Arcade.ArcadePhysics#moveTo + * @since 3.0.0 * - * @return {this} This Game Object. + * @param {Phaser.GameObjects.GameObject} gameObject - Any Game Object with an Arcade Physics body. + * @param {number} x - The x coordinate to move towards. + * @param {number} y - The y coordinate to move towards. + * @param {number} [speed=60] - The speed it will move, in pixels per second (default is 60 pixels/sec) + * @param {number} [maxTime=0] - Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the object will arrive at destination in the given number of ms. + * + * @return {number} The angle (in radians) that the object should be visually set to in order to match its new velocity. */ - pauseFollow: function () + moveTo: function (gameObject, x, y, speed, maxTime) { - var tween = this.pathTween; + if (speed === undefined) { speed = 60; } + if (maxTime === undefined) { maxTime = 0; } - if (tween && tween.isPlaying()) + var angle = Math.atan2(y - gameObject.y, x - gameObject.x); + + if (maxTime > 0) { - tween.pause(); + // We know how many pixels we need to move, but how fast? + speed = DistanceBetween(gameObject.x, gameObject.y, x, y) / (maxTime / 1000); } - return this; + gameObject.body.velocity.setToPolar(angle, speed); + + return angle; }, /** - * Resumes a previously paused PathFollower. + * Move the given display object towards the destination object at a steady velocity. + * If you specify a maxTime then it will adjust the speed (overwriting what you set) so it arrives at the destination in that number of seconds. + * Timings are approximate due to the way browser timers work. Allow for a variance of +- 50ms. + * Note: The display object does not continuously track the target. If the target changes location during transit the display object will not modify its course. + * Note: The display object doesn't stop moving once it reaches the destination coordinates. + * Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set drag or acceleration too high this object may not move at all) * - * If the PathFollower was not paused this has no effect. + * @method Phaser.Physics.Arcade.ArcadePhysics#moveToObject + * @since 3.0.0 * - * @method Phaser.GameObjects.Components.PathFollower#resumeFollow - * @since 3.3.0 + * @param {Phaser.GameObjects.GameObject} gameObject - Any Game Object with an Arcade Physics body. + * @param {object} destination - Any object with public `x` and `y` properties, such as a Game Object or Geometry object. + * @param {number} [speed=60] - The speed it will move, in pixels per second (default is 60 pixels/sec) + * @param {number} [maxTime=0] - Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the object will arrive at destination in the given number of ms. * - * @return {this} This Game Object. + * @return {number} The angle (in radians) that the object should be visually set to in order to match its new velocity. */ - resumeFollow: function () + moveToObject: function (gameObject, destination, speed, maxTime) { - var tween = this.pathTween; - - if (tween && tween.isPaused()) - { - tween.resume(); - } - - return this; + return this.moveTo(gameObject, destination.x, destination.y, speed, maxTime); }, /** - * Stops this PathFollower from following the path any longer. + * Given the angle (in degrees) and speed calculate the velocity and return it as a vector, or set it to the given vector object. + * One way to use this is: velocityFromAngle(angle, 200, sprite.body.velocity) which will set the values directly to the sprite's velocity and not create a new vector object. * - * This will invoke any 'stop' conditions that may exist on the Path, or for the follower. + * @method Phaser.Physics.Arcade.ArcadePhysics#velocityFromAngle + * @since 3.0.0 * - * @method Phaser.GameObjects.Components.PathFollower#stopFollow - * @since 3.3.0 + * @param {number} angle - The angle in degrees calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative) + * @param {number} [speed=60] - The speed it will move, in pixels per second squared. + * @param {Phaser.Math.Vector2} [vec2] - The Vector2 in which the x and y properties will be set to the calculated velocity. * - * @return {this} This Game Object. + * @return {Phaser.Math.Vector2} The Vector2 that stores the velocity. */ - stopFollow: function () + velocityFromAngle: function (angle, speed, vec2) { - var tween = this.pathTween; - - if (tween && tween.isPlaying()) - { - tween.stop(); - } + if (speed === undefined) { speed = 60; } + if (vec2 === undefined) { vec2 = new Vector2(); } - return this; + return vec2.setToPolar(DegToRad(angle), speed); }, /** - * Internal update handler that advances this PathFollower along the path. + * Given the rotation (in radians) and speed calculate the velocity and return it as a vector, or set it to the given vector object. + * One way to use this is: velocityFromRotation(rotation, 200, sprite.body.velocity) which will set the values directly to the sprite's velocity and not create a new vector object. * - * Called automatically by the Scene step, should not typically be called directly. + * @method Phaser.Physics.Arcade.ArcadePhysics#velocityFromRotation + * @since 3.0.0 * - * @method Phaser.GameObjects.Components.PathFollower#pathUpdate - * @since 3.17.0 + * @param {number} rotation - The angle in radians. + * @param {number} [speed=60] - The speed it will move, in pixels per second squared + * @param {Phaser.Math.Vector2} [vec2] - The Vector2 in which the x and y properties will be set to the calculated velocity. + * + * @return {Phaser.Math.Vector2} The Vector2 that stores the velocity. */ - pathUpdate: function () + velocityFromRotation: function (rotation, speed, vec2) { - var tween = this.pathTween; - - if (tween) - { - var tweenData = tween.data[0]; - var pathDelta = this.pathDelta; - var pathVector = this.pathVector; - - pathDelta.copy(pathVector).negate(); - - if (tweenData.state === TWEEN_CONST.COMPLETE) - { - this.path.getPoint(1, pathVector); - - pathDelta.add(pathVector); - pathVector.add(this.pathOffset); - - this.setPosition(pathVector.x, pathVector.y); - - return; - } - else if (tweenData.state !== TWEEN_CONST.PLAYING_FORWARD && tweenData.state !== TWEEN_CONST.PLAYING_BACKWARD) - { - // If delayed, etc then bail out - return; - } - - this.path.getPoint(tween.getValue(), pathVector); - - pathDelta.add(pathVector); - pathVector.add(this.pathOffset); - - var oldX = this.x; - var oldY = this.y; - - this.setPosition(pathVector.x, pathVector.y); - - var speedX = this.x - oldX; - var speedY = this.y - oldY; - - if (speedX === 0 && speedY === 0) - { - // Bail out early - return; - } - - if (tweenData.state !== this._prevDirection) - { - // We've changed direction, so don't do a rotate this frame - this._prevDirection = tweenData.state; - - return; - } - - if (this.rotateToPath) - { - this.rotation = Math.atan2(speedY, speedX) + DegToRad(this.pathRotationOffset); - } - } - } - -}; - -module.exports = PathFollower; - - -/***/ }), -/* 634 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Provides methods used for getting and setting the size of a Game Object. - * - * @namespace Phaser.GameObjects.Components.Size - * @since 3.0.0 - */ - -var Size = { - - /** - * A property indicating that a Game Object has this component. - * - * @name Phaser.GameObjects.Components.Size#_sizeComponent - * @type {boolean} - * @private - * @default true - * @since 3.2.0 - */ - _sizeComponent: true, + if (speed === undefined) { speed = 60; } + if (vec2 === undefined) { vec2 = new Vector2(); } - /** - * The native (un-scaled) width of this Game Object. - * - * Changing this value will not change the size that the Game Object is rendered in-game. - * For that you need to either set the scale of the Game Object (`setScale`) or use - * the `displayWidth` property. - * - * @name Phaser.GameObjects.Components.Size#width - * @type {number} - * @since 3.0.0 - */ - width: 0, + return vec2.setToPolar(rotation, speed); + }, /** - * The native (un-scaled) height of this Game Object. - * - * Changing this value will not change the size that the Game Object is rendered in-game. - * For that you need to either set the scale of the Game Object (`setScale`) or use - * the `displayHeight` property. - * - * @name Phaser.GameObjects.Components.Size#height - * @type {number} - * @since 3.0.0 + * This method will search the given rectangular area and return an array of all physics bodies that + * overlap with it. It can return either Dynamic, Static bodies or a mixture of both. + * + * A body only has to intersect with the search area to be considered, it doesn't have to be fully + * contained within it. + * + * If Arcade Physics is set to use the RTree (which it is by default) then the search for is extremely fast, + * otherwise the search is O(N) for Dynamic Bodies. + * + * @method Phaser.Physics.Arcade.ArcadePhysics#overlapRect + * @since 3.17.0 + * + * @param {number} x - The top-left x coordinate of the area to search within. + * @param {number} y - The top-left y coordinate of the area to search within. + * @param {number} width - The width of the area to search within. + * @param {number} height - The height of the area to search within. + * @param {boolean} [includeDynamic=true] - Should the search include Dynamic Bodies? + * @param {boolean} [includeStatic=false] - Should the search include Static Bodies? + * + * @return {(Phaser.Physics.Arcade.Body[]|Phaser.Physics.Arcade.StaticBody[])} An array of bodies that overlap with the given area. */ - height: 0, + overlapRect: function (x, y, width, height, includeDynamic, includeStatic) + { + return OverlapRect(this.world, x, y, width, height, includeDynamic, includeStatic); + }, /** - * The displayed width of this Game Object. - * - * This value takes into account the scale factor. - * - * Setting this value will adjust the Game Object's scale property. - * - * @name Phaser.GameObjects.Components.Size#displayWidth - * @type {number} - * @since 3.0.0 + * This method will search the given circular area and return an array of all physics bodies that + * overlap with it. It can return either Dynamic, Static bodies or a mixture of both. + * + * A body only has to intersect with the search area to be considered, it doesn't have to be fully + * contained within it. + * + * If Arcade Physics is set to use the RTree (which it is by default) then the search is rather fast, + * otherwise the search is O(N) for Dynamic Bodies. + * + * @method Phaser.Physics.Arcade.ArcadePhysics#overlapCirc + * @since 3.21.0 + * + * @param {number} x - The x coordinate of the center of the area to search within. + * @param {number} y - The y coordinate of the center of the area to search within. + * @param {number} radius - The radius of the area to search within. + * @param {boolean} [includeDynamic=true] - Should the search include Dynamic Bodies? + * @param {boolean} [includeStatic=false] - Should the search include Static Bodies? + * + * @return {(Phaser.Physics.Arcade.Body[]|Phaser.Physics.Arcade.StaticBody[])} An array of bodies that overlap with the given area. */ - displayWidth: { - - get: function () - { - return Math.abs(this.scaleX * this.frame.realWidth); - }, - - set: function (value) - { - this.scaleX = value / this.frame.realWidth; - } - + overlapCirc: function (x, y, radius, includeDynamic, includeStatic) + { + return OverlapCirc(this.world, x, y, radius, includeDynamic, includeStatic); }, /** - * The displayed height of this Game Object. - * - * This value takes into account the scale factor. - * - * Setting this value will adjust the Game Object's scale property. - * - * @name Phaser.GameObjects.Components.Size#displayHeight - * @type {number} + * The Scene that owns this plugin is shutting down. + * We need to kill and reset all internal properties as well as stop listening to Scene events. + * + * @method Phaser.Physics.Arcade.ArcadePhysics#shutdown * @since 3.0.0 */ - displayHeight: { - - get: function () - { - return Math.abs(this.scaleY * this.frame.realHeight); - }, - - set: function (value) + shutdown: function () + { + if (!this.world) { - this.scaleY = value / this.frame.realHeight; + // Already destroyed + return; } - }, + var eventEmitter = this.systems.events; - /** - * Sets the size of this Game Object to be that of the given Frame. - * - * This will not change the size that the Game Object is rendered in-game. - * For that you need to either set the scale of the Game Object (`setScale`) or call the - * `setDisplaySize` method, which is the same thing as changing the scale but allows you - * to do so by giving pixel values. - * - * If you have enabled this Game Object for input, changing the size will _not_ change the - * size of the hit area. To do this you should adjust the `input.hitArea` object directly. - * - * @method Phaser.GameObjects.Components.Size#setSizeToFrame - * @since 3.0.0 - * - * @param {Phaser.Textures.Frame} frame - The frame to base the size of this Game Object on. - * - * @return {this} This Game Object instance. - */ - setSizeToFrame: function (frame) - { - if (frame === undefined) { frame = this.frame; } + eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.off(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); - this.width = frame.realWidth; - this.height = frame.realHeight; + this.add.destroy(); + this.world.destroy(); - return this; + this.add = null; + this.world = null; }, /** - * Sets the internal size of this Game Object, as used for frame or physics body creation. - * - * This will not change the size that the Game Object is rendered in-game. - * For that you need to either set the scale of the Game Object (`setScale`) or call the - * `setDisplaySize` method, which is the same thing as changing the scale but allows you - * to do so by giving pixel values. - * - * If you have enabled this Game Object for input, changing the size will _not_ change the - * size of the hit area. To do this you should adjust the `input.hitArea` object directly. - * - * @method Phaser.GameObjects.Components.Size#setSize - * @since 3.0.0 + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. - * - * @return {this} This Game Object instance. - */ - setSize: function (width, height) - { - this.width = width; - this.height = height; - - return this; - }, - - /** - * Sets the display size of this Game Object. - * - * Calling this will adjust the scale. - * - * @method Phaser.GameObjects.Components.Size#setDisplaySize + * @method Phaser.Physics.Arcade.ArcadePhysics#destroy * @since 3.0.0 - * - * @param {number} width - The width of this Game Object. - * @param {number} height - The height of this Game Object. - * - * @return {this} This Game Object instance. */ - setDisplaySize: function (width, height) + destroy: function () { - this.displayWidth = width; - this.displayHeight = height; + this.shutdown(); - return this; + this.scene.sys.events.off(SceneEvents.START, this.start, this); + + this.scene = null; + this.systems = null; } -}; +}); -module.exports = Size; +PluginCache.register('ArcadePhysics', ArcadePhysics, 'arcadePhysics'); + +module.exports = ArcadePhysics; /***/ }), -/* 635 */ -/***/ (function(module, exports) { + +/***/ 25084: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// bitmask flag for GameObject.renderMask -var _FLAG = 8; // 1000 +var Class = __webpack_require__(56694); +var Components = __webpack_require__(7864); +var Sprite = __webpack_require__(13747); /** - * Provides methods used for getting and setting the texture of a Game Object. + * @classdesc + * An Arcade Physics Sprite is a Sprite with an Arcade Physics body and related components. + * The body can be dynamic or static. * - * @namespace Phaser.GameObjects.Components.Texture + * The main difference between an Arcade Sprite and an Arcade Image is that you cannot animate an Arcade Image. + * If you do not require animation then you can safely use Arcade Images instead of Arcade Sprites. + * + * @class Sprite + * @extends Phaser.GameObjects.Sprite + * @memberof Phaser.Physics.Arcade + * @constructor * @since 3.0.0 + * + * @extends Phaser.Physics.Arcade.Components.Acceleration + * @extends Phaser.Physics.Arcade.Components.Angular + * @extends Phaser.Physics.Arcade.Components.Bounce + * @extends Phaser.Physics.Arcade.Components.Debug + * @extends Phaser.Physics.Arcade.Components.Drag + * @extends Phaser.Physics.Arcade.Components.Enable + * @extends Phaser.Physics.Arcade.Components.Friction + * @extends Phaser.Physics.Arcade.Components.Gravity + * @extends Phaser.Physics.Arcade.Components.Immovable + * @extends Phaser.Physics.Arcade.Components.Mass + * @extends Phaser.Physics.Arcade.Components.Pushable + * @extends Phaser.Physics.Arcade.Components.Size + * @extends Phaser.Physics.Arcade.Components.Velocity + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. */ +var ArcadeSprite = new Class({ -var Texture = { - - /** - * The Texture this Game Object is using to render with. - * - * @name Phaser.GameObjects.Components.Texture#texture - * @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture} - * @since 3.0.0 - */ - texture: null, - - /** - * The Texture Frame this Game Object is using to render with. - * - * @name Phaser.GameObjects.Components.Texture#frame - * @type {Phaser.Textures.Frame} - * @since 3.0.0 - */ - frame: null, - - /** - * Internal flag. Not to be set by this Game Object. - * - * @name Phaser.GameObjects.Components.Texture#isCropped - * @type {boolean} - * @private - * @since 3.11.0 - */ - isCropped: false, + Extends: Sprite, - /** - * Sets the texture and frame this Game Object will use to render with. - * - * Textures are referenced by their string-based keys, as stored in the Texture Manager. - * - * @method Phaser.GameObjects.Components.Texture#setTexture - * @since 3.0.0 - * - * @param {(string|Phaser.Textures.Texture)} key - The key of the texture to be used, as stored in the Texture Manager, or a Texture instance. - * @param {(string|number)} [frame] - The name or index of the frame within the Texture. - * - * @return {this} This Game Object instance. - */ - setTexture: function (key, frame) - { - this.texture = this.scene.sys.textures.get(key); + Mixins: [ + Components.Acceleration, + Components.Angular, + Components.Bounce, + Components.Debug, + Components.Drag, + Components.Enable, + Components.Friction, + Components.Gravity, + Components.Immovable, + Components.Mass, + Components.Pushable, + Components.Size, + Components.Velocity + ], - return this.setFrame(frame); - }, + initialize: - /** - * Sets the frame this Game Object will use to render with. - * - * The Frame has to belong to the current Texture being used. - * - * It can be either a string or an index. - * - * Calling `setFrame` will modify the `width` and `height` properties of your Game Object. - * It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer. - * - * @method Phaser.GameObjects.Components.Texture#setFrame - * @since 3.0.0 - * - * @param {(string|number)} frame - The name or index of the frame within the Texture. - * @param {boolean} [updateSize=true] - Should this call adjust the size of the Game Object? - * @param {boolean} [updateOrigin=true] - Should this call adjust the origin of the Game Object? - * - * @return {this} This Game Object instance. - */ - setFrame: function (frame, updateSize, updateOrigin) + function ArcadeSprite (scene, x, y, texture, frame) { - if (updateSize === undefined) { updateSize = true; } - if (updateOrigin === undefined) { updateOrigin = true; } - - this.frame = this.texture.get(frame); - - if (!this.frame.cutWidth || !this.frame.cutHeight) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } - - if (this._sizeComponent && updateSize) - { - this.setSizeToFrame(); - } - - if (this._originComponent && updateOrigin) - { - if (this.frame.customPivot) - { - this.setOrigin(this.frame.pivotX, this.frame.pivotY); - } - else - { - this.updateDisplayOrigin(); - } - } + Sprite.call(this, scene, x, y, texture, frame); - return this; + /** + * This Game Object's Physics Body. + * + * @name Phaser.Physics.Arcade.Sprite#body + * @type {?(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} + * @default null + * @since 3.0.0 + */ + this.body = null; } -}; +}); -module.exports = Texture; +module.exports = ArcadeSprite; /***/ }), -/* 636 */ -/***/ (function(module, exports) { + +/***/ 97602: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Benjamin D. Richards + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// bitmask flag for GameObject.renderMask -var _FLAG = 8; // 1000 +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(47401); +var Events = __webpack_require__(27037); +var RadToDeg = __webpack_require__(23701); +var Rectangle = __webpack_require__(74118); +var RectangleContains = __webpack_require__(94287); +var Vector2 = __webpack_require__(93736); /** - * Provides methods used for getting and setting the texture of a Game Object. + * @classdesc + * A Dynamic Arcade Body. * - * @namespace Phaser.GameObjects.Components.TextureCrop + * Its static counterpart is {@link Phaser.Physics.Arcade.StaticBody}. + * + * @class Body + * @memberof Phaser.Physics.Arcade + * @constructor * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.World} world - The Arcade Physics simulation this Body belongs to. + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object this Body belongs to. As of Phaser 3.60 this is now optional. */ +var Body = new Class({ -var TextureCrop = { + initialize: - /** - * The Texture this Game Object is using to render with. - * - * @name Phaser.GameObjects.Components.TextureCrop#texture - * @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture} - * @since 3.0.0 - */ - texture: null, + function Body (world, gameObject) + { + var width = 64; + var height = 64; - /** - * The Texture Frame this Game Object is using to render with. - * - * @name Phaser.GameObjects.Components.TextureCrop#frame - * @type {Phaser.Textures.Frame} - * @since 3.0.0 - */ - frame: null, + var dummyGameObject = { + x: 0, + y: 0, + angle: 0, + rotation: 0, + scaleX: 1, + scaleY: 1, + displayOriginX: 0, + displayOriginY: 0 + }; - /** - * A boolean flag indicating if this Game Object is being cropped or not. - * You can toggle this at any time after `setCrop` has been called, to turn cropping on or off. - * Equally, calling `setCrop` with no arguments will reset the crop and disable it. - * - * @name Phaser.GameObjects.Components.TextureCrop#isCropped - * @type {boolean} - * @since 3.11.0 - */ - isCropped: false, + var hasGameObject = (gameObject !== undefined); - /** - * Applies a crop to a texture based Game Object, such as a Sprite or Image. - * - * The crop is a rectangle that limits the area of the texture frame that is visible during rendering. - * - * Cropping a Game Object does not change its size, dimensions, physics body or hit area, it just - * changes what is shown when rendered. - * - * The crop coordinates are relative to the texture frame, not the Game Object, meaning 0 x 0 is the top-left. - * - * Therefore, if you had a Game Object that had an 800x600 sized texture, and you wanted to show only the left - * half of it, you could call `setCrop(0, 0, 400, 600)`. - * - * It is also scaled to match the Game Object scale automatically. Therefore a crop rect of 100x50 would crop - * an area of 200x100 when applied to a Game Object that had a scale factor of 2. - * - * You can either pass in numeric values directly, or you can provide a single Rectangle object as the first argument. - * - * Call this method with no arguments at all to reset the crop, or toggle the property `isCropped` to `false`. - * - * You should do this if the crop rectangle becomes the same size as the frame itself, as it will allow - * the renderer to skip several internal calculations. - * - * @method Phaser.GameObjects.Components.TextureCrop#setCrop - * @since 3.11.0 - * - * @param {(number|Phaser.Geom.Rectangle)} [x] - The x coordinate to start the crop from. Or a Phaser.Geom.Rectangle object, in which case the rest of the arguments are ignored. - * @param {number} [y] - The y coordinate to start the crop from. - * @param {number} [width] - The width of the crop rectangle in pixels. - * @param {number} [height] - The height of the crop rectangle in pixels. - * - * @return {this} This Game Object instance. - */ - setCrop: function (x, y, width, height) - { - if (x === undefined) + if (hasGameObject && gameObject.displayWidth) { - this.isCropped = false; + width = gameObject.displayWidth; + height = gameObject.displayHeight; } - else if (this.frame) - { - if (typeof x === 'number') - { - this.frame.setCropUVs(this._crop, x, y, width, height, this.flipX, this.flipY); - } - else - { - var rect = x; - - this.frame.setCropUVs(this._crop, rect.x, rect.y, rect.width, rect.height, this.flipX, this.flipY); - } - this.isCropped = true; + if (!hasGameObject) + { + gameObject = dummyGameObject; } - return this; - }, - - /** - * Sets the texture and frame this Game Object will use to render with. - * - * Textures are referenced by their string-based keys, as stored in the Texture Manager. - * - * @method Phaser.GameObjects.Components.TextureCrop#setTexture - * @since 3.0.0 - * - * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. - * @param {(string|number)} [frame] - The name or index of the frame within the Texture. - * - * @return {this} This Game Object instance. - */ - setTexture: function (key, frame) - { - this.texture = this.scene.sys.textures.get(key); + /** + * The Arcade Physics simulation this Body belongs to. + * + * @name Phaser.Physics.Arcade.Body#world + * @type {Phaser.Physics.Arcade.World} + * @since 3.0.0 + */ + this.world = world; - return this.setFrame(frame); - }, + /** + * The Game Object this Body belongs to. + * + * As of Phaser 3.60 this is now optional and can be undefined. + * + * @name Phaser.Physics.Arcade.Body#gameObject + * @type {Phaser.GameObjects.GameObject} + * @since 3.0.0 + */ + this.gameObject = (hasGameObject) ? gameObject : undefined; - /** - * Sets the frame this Game Object will use to render with. - * - * The Frame has to belong to the current Texture being used. - * - * It can be either a string or an index. - * - * Calling `setFrame` will modify the `width` and `height` properties of your Game Object. - * It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer. - * - * @method Phaser.GameObjects.Components.TextureCrop#setFrame - * @since 3.0.0 - * - * @param {(string|number)} frame - The name or index of the frame within the Texture. - * @param {boolean} [updateSize=true] - Should this call adjust the size of the Game Object? - * @param {boolean} [updateOrigin=true] - Should this call adjust the origin of the Game Object? - * - * @return {this} This Game Object instance. - */ - setFrame: function (frame, updateSize, updateOrigin) - { - if (updateSize === undefined) { updateSize = true; } - if (updateOrigin === undefined) { updateOrigin = true; } + /** + * A quick-test flag that signifies this is a Body, used in the World collision handler. + * + * @name Phaser.Physics.Arcade.Body#isBody + * @type {boolean} + * @readonly + * @since 3.60.0 + */ + this.isBody = true; - this.frame = this.texture.get(frame); + /** + * Transformations applied to this Body. + * + * @name Phaser.Physics.Arcade.Body#transform + * @type {object} + * @since 3.4.0 + */ + this.transform = { + x: gameObject.x, + y: gameObject.y, + rotation: gameObject.angle, + scaleX: gameObject.scaleX, + scaleY: gameObject.scaleY, + displayOriginX: gameObject.displayOriginX, + displayOriginY: gameObject.displayOriginY + }; - if (!this.frame.cutWidth || !this.frame.cutHeight) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } + /** + * Whether the Body is drawn to the debug display. + * + * @name Phaser.Physics.Arcade.Body#debugShowBody + * @type {boolean} + * @since 3.0.0 + */ + this.debugShowBody = world.defaults.debugShowBody; - if (this._sizeComponent && updateSize) - { - this.setSizeToFrame(); - } + /** + * Whether the Body's velocity is drawn to the debug display. + * + * @name Phaser.Physics.Arcade.Body#debugShowVelocity + * @type {boolean} + * @since 3.0.0 + */ + this.debugShowVelocity = world.defaults.debugShowVelocity; - if (this._originComponent && updateOrigin) - { - if (this.frame.customPivot) - { - this.setOrigin(this.frame.pivotX, this.frame.pivotY); - } - else - { - this.updateDisplayOrigin(); - } - } + /** + * The color of this Body on the debug display. + * + * @name Phaser.Physics.Arcade.Body#debugBodyColor + * @type {number} + * @since 3.0.0 + */ + this.debugBodyColor = world.defaults.bodyDebugColor; - if (this.isCropped) - { - this.frame.updateCropUVs(this._crop, this.flipX, this.flipY); - } + /** + * Whether this Body is updated by the physics simulation. + * + * @name Phaser.Physics.Arcade.Body#enable + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.enable = true; - return this; - }, + /** + * Whether this Body is circular (true) or rectangular (false). + * + * @name Phaser.Physics.Arcade.Body#isCircle + * @type {boolean} + * @default false + * @since 3.0.0 + * @see Phaser.Physics.Arcade.Body#setCircle + */ + this.isCircle = false; - /** - * Internal method that returns a blank, well-formed crop object for use by a Game Object. - * - * @method Phaser.GameObjects.Components.TextureCrop#resetCropObject - * @private - * @since 3.12.0 - * - * @return {object} The crop object. - */ - resetCropObject: function () - { - return { u0: 0, v0: 0, u1: 0, v1: 0, width: 0, height: 0, x: 0, y: 0, flipX: false, flipY: false, cx: 0, cy: 0, cw: 0, ch: 0 }; - } + /** + * If this Body is circular, this is the unscaled radius of the Body, as set by setCircle(), in source pixels. + * The true radius is equal to `halfWidth`. + * + * @name Phaser.Physics.Arcade.Body#radius + * @type {number} + * @default 0 + * @since 3.0.0 + * @see Phaser.Physics.Arcade.Body#setCircle + */ + this.radius = 0; -}; + /** + * The offset of this Body's position from its Game Object's position, in source pixels. + * + * @name Phaser.Physics.Arcade.Body#offset + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + * @see Phaser.Physics.Arcade.Body#setOffset + */ + this.offset = new Vector2(); -module.exports = TextureCrop; + /** + * The position of this Body within the simulation. + * + * @name Phaser.Physics.Arcade.Body#position + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.position = new Vector2( + gameObject.x - gameObject.scaleX * gameObject.displayOriginX, + gameObject.y - gameObject.scaleY * gameObject.displayOriginY + ); + /** + * The position of this Body during the previous step. + * + * @name Phaser.Physics.Arcade.Body#prev + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.prev = this.position.clone(); -/***/ }), -/* 637 */ -/***/ (function(module, exports) { + /** + * The position of this Body during the previous frame. + * + * @name Phaser.Physics.Arcade.Body#prevFrame + * @type {Phaser.Math.Vector2} + * @since 3.20.0 + */ + this.prevFrame = this.position.clone(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Whether this Body's `rotation` is affected by its angular acceleration and angular velocity. + * + * @name Phaser.Physics.Arcade.Body#allowRotation + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.allowRotation = true; -/** - * Provides methods used for setting the tint of a Game Object. - * Should be applied as a mixin and not used directly. - * - * @namespace Phaser.GameObjects.Components.Tint - * @webglOnly - * @since 3.0.0 - */ + /** + * This body's rotation, in degrees, based on its angular acceleration and angular velocity. + * The Body's rotation controls the `angle` of its Game Object. + * It doesn't rotate the Body's own geometry, which is always an axis-aligned rectangle or a circle. + * + * @name Phaser.Physics.Arcade.Body#rotation + * @type {number} + * @since 3.0.0 + */ + this.rotation = gameObject.angle; -var Tint = { + /** + * The Body rotation, in degrees, during the previous step. + * + * @name Phaser.Physics.Arcade.Body#preRotation + * @type {number} + * @since 3.0.0 + */ + this.preRotation = gameObject.angle; - /** - * The tint value being applied to the top-left vertice of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. - * - * @name Phaser.GameObjects.Components.Tint#tintTopLeft - * @type {number} - * @default 0xffffff - * @since 3.0.0 - */ - tintTopLeft: 0xffffff, + /** + * The width of the Body, in pixels. + * If the Body is circular, this is also the diameter. + * If you wish to change the width use the `Body.setSize` method. + * + * @name Phaser.Physics.Arcade.Body#width + * @type {number} + * @readonly + * @default 64 + * @since 3.0.0 + */ + this.width = width; - /** - * The tint value being applied to the top-right vertice of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. - * - * @name Phaser.GameObjects.Components.Tint#tintTopRight - * @type {number} - * @default 0xffffff - * @since 3.0.0 - */ - tintTopRight: 0xffffff, + /** + * The height of the Body, in pixels. + * If the Body is circular, this is also the diameter. + * If you wish to change the height use the `Body.setSize` method. + * + * @name Phaser.Physics.Arcade.Body#height + * @type {number} + * @readonly + * @default 64 + * @since 3.0.0 + */ + this.height = height; - /** - * The tint value being applied to the bottom-left vertice of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. - * - * @name Phaser.GameObjects.Components.Tint#tintBottomLeft - * @type {number} - * @default 0xffffff - * @since 3.0.0 - */ - tintBottomLeft: 0xffffff, + /** + * The unscaled width of the Body, in source pixels, as set by setSize(). + * The default is the width of the Body's Game Object's texture frame. + * + * @name Phaser.Physics.Arcade.Body#sourceWidth + * @type {number} + * @since 3.0.0 + * @see Phaser.Physics.Arcade.Body#setSize + */ + this.sourceWidth = width; - /** - * The tint value being applied to the bottom-right vertice of the Game Object. - * This value is interpolated from the corner to the center of the Game Object. - * The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple. + /** + * The unscaled height of the Body, in source pixels, as set by setSize(). + * The default is the height of the Body's Game Object's texture frame. + * + * @name Phaser.Physics.Arcade.Body#sourceHeight + * @type {number} + * @since 3.0.0 + * @see Phaser.Physics.Arcade.Body#setSize + */ + this.sourceHeight = height; + + if (gameObject.frame) + { + this.sourceWidth = gameObject.frame.realWidth; + this.sourceHeight = gameObject.frame.realHeight; + } + + /** + * Half the Body's width, in pixels. + * + * @name Phaser.Physics.Arcade.Body#halfWidth + * @type {number} + * @since 3.0.0 + */ + this.halfWidth = Math.abs(width / 2); + + /** + * Half the Body's height, in pixels. + * + * @name Phaser.Physics.Arcade.Body#halfHeight + * @type {number} + * @since 3.0.0 + */ + this.halfHeight = Math.abs(height / 2); + + /** + * The center of the Body. + * The midpoint of its `position` (top-left corner) and its bottom-right corner. + * + * @name Phaser.Physics.Arcade.Body#center + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.center = new Vector2(this.position.x + this.halfWidth, this.position.y + this.halfHeight); + + /** + * The Body's velocity, in pixels per second. + * + * @name Phaser.Physics.Arcade.Body#velocity + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.velocity = new Vector2(); + + /** + * The Body's change in position (due to velocity) at the last step, in pixels. + * + * The size of this value depends on the simulation's step rate. + * + * @name Phaser.Physics.Arcade.Body#newVelocity + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.0.0 + */ + this.newVelocity = new Vector2(); + + /** + * The Body's absolute maximum change in position, in pixels per step. + * + * @name Phaser.Physics.Arcade.Body#deltaMax + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.deltaMax = new Vector2(); + + /** + * The Body's change in velocity, in pixels per second squared. + * + * @name Phaser.Physics.Arcade.Body#acceleration + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.acceleration = new Vector2(); + + /** + * Whether this Body's velocity is affected by its `drag`. + * + * @name Phaser.Physics.Arcade.Body#allowDrag + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.allowDrag = true; + + /** + * When `useDamping` is false (the default), this is absolute loss of velocity due to movement, in pixels per second squared. + * + * When `useDamping` is true, this is a damping multiplier between 0 and 1. + * A value of 0 means the Body stops instantly. + * A value of 0.01 mean the Body keeps 1% of its velocity per second, losing 99%. + * A value of 0.1 means the Body keeps 10% of its velocity per second, losing 90%. + * A value of 1 means the Body loses no velocity. + * You can use very small values (e.g., 0.001) to stop the Body quickly. + * + * The x and y components are applied separately. + * + * Drag is applied only when `acceleration` is zero. + * + * @name Phaser.Physics.Arcade.Body#drag + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.drag = new Vector2(); + + /** + * Whether this Body's position is affected by gravity (local or world). + * + * @name Phaser.Physics.Arcade.Body#allowGravity + * @type {boolean} + * @default true + * @since 3.0.0 + * @see Phaser.Physics.Arcade.Body#gravity + * @see Phaser.Physics.Arcade.World#gravity + */ + this.allowGravity = true; + + /** + * Acceleration due to gravity (specific to this Body), in pixels per second squared. + * Total gravity is the sum of this vector and the simulation's `gravity`. + * + * @name Phaser.Physics.Arcade.Body#gravity + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + * @see Phaser.Physics.Arcade.World#gravity + */ + this.gravity = new Vector2(); + + /** + * Rebound following a collision, relative to 1. + * + * @name Phaser.Physics.Arcade.Body#bounce + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.bounce = new Vector2(); + + /** + * Rebound following a collision with the world boundary, relative to 1. + * If null, `bounce` is used instead. + * + * @name Phaser.Physics.Arcade.Body#worldBounce + * @type {?Phaser.Math.Vector2} + * @default null + * @since 3.0.0 + */ + this.worldBounce = null; + + /** + * The rectangle used for world boundary collisions. + * + * By default it is set to the world boundary rectangle. Or, if this Body was + * created by a Physics Group, then whatever rectangle that Group defined. + * + * You can also change it by using the `Body.setBoundsRectangle` method. + * + * @name Phaser.Physics.Arcade.Body#customBoundsRectangle + * @type {Phaser.Geom.Rectangle} + * @since 3.20 + */ + this.customBoundsRectangle = world.bounds; + + /** + * Whether the simulation emits a `worldbounds` event when this Body collides with the world boundary + * (and `collideWorldBounds` is also true). + * + * @name Phaser.Physics.Arcade.Body#onWorldBounds + * @type {boolean} + * @default false + * @since 3.0.0 + * @see Phaser.Physics.Arcade.World#WORLD_BOUNDS + */ + this.onWorldBounds = false; + + /** + * Whether the simulation emits a `collide` event when this Body collides with another. + * + * @name Phaser.Physics.Arcade.Body#onCollide + * @type {boolean} + * @default false + * @since 3.0.0 + * @see Phaser.Physics.Arcade.World#COLLIDE + */ + this.onCollide = false; + + /** + * Whether the simulation emits an `overlap` event when this Body overlaps with another. + * + * @name Phaser.Physics.Arcade.Body#onOverlap + * @type {boolean} + * @default false + * @since 3.0.0 + * @see Phaser.Physics.Arcade.World#OVERLAP + */ + this.onOverlap = false; + + /** + * The absolute maximum velocity of this body, in pixels per second. + * The horizontal and vertical components are applied separately. + * + * @name Phaser.Physics.Arcade.Body#maxVelocity + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.maxVelocity = new Vector2(10000, 10000); + + /** + * The maximum speed this Body is allowed to reach, in pixels per second. + * + * If not negative it limits the scalar value of speed. + * + * Any negative value means no maximum is being applied (the default). + * + * @name Phaser.Physics.Arcade.Body#maxSpeed + * @type {number} + * @default -1 + * @since 3.16.0 + */ + this.maxSpeed = -1; + + /** + * If this Body is `immovable` and in motion, `friction` is the proportion of this Body's motion received by the riding Body on each axis, relative to 1. + * The horizontal component (x) is applied only when two colliding Bodies are separated vertically. + * The vertical component (y) is applied only when two colliding Bodies are separated horizontally. + * The default value (1, 0) moves the riding Body horizontally in equal proportion to this Body and vertically not at all. + * + * @name Phaser.Physics.Arcade.Body#friction + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.friction = new Vector2(1, 0); + + /** + * If this Body is using `drag` for deceleration this property controls how the drag is applied. + * If set to `true` drag will use a damping effect rather than a linear approach. If you are + * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in + * the game Asteroids) then you will get a far smoother and more visually correct deceleration + * by using damping, avoiding the axis-drift that is prone with linear deceleration. + * + * If you enable this property then you should use far smaller `drag` values than with linear, as + * they are used as a multiplier on the velocity. Values such as 0.05 will give a nice slow + * deceleration. + * + * @name Phaser.Physics.Arcade.Body#useDamping + * @type {boolean} + * @default false + * @since 3.10.0 + */ + this.useDamping = false; + + /** + * The rate of change of this Body's `rotation`, in degrees per second. + * + * @name Phaser.Physics.Arcade.Body#angularVelocity + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.angularVelocity = 0; + + /** + * The Body's angular acceleration (change in angular velocity), in degrees per second squared. + * + * @name Phaser.Physics.Arcade.Body#angularAcceleration + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.angularAcceleration = 0; + + /** + * Loss of angular velocity due to angular movement, in degrees per second. + * + * Angular drag is applied only when angular acceleration is zero. + * + * @name Phaser.Physics.Arcade.Body#angularDrag + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.angularDrag = 0; + + /** + * The Body's maximum angular velocity, in degrees per second. + * + * @name Phaser.Physics.Arcade.Body#maxAngular + * @type {number} + * @default 1000 + * @since 3.0.0 + */ + this.maxAngular = 1000; + + /** + * The Body's inertia, relative to a default unit (1). + * With `bounce`, this affects the exchange of momentum (velocities) during collisions. + * + * @name Phaser.Physics.Arcade.Body#mass + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.mass = 1; + + /** + * The calculated angle of this Body's velocity vector, in radians, during the last step. + * + * @name Phaser.Physics.Arcade.Body#angle + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.angle = 0; + + /** + * The calculated magnitude of the Body's velocity, in pixels per second, during the last step. + * + * @name Phaser.Physics.Arcade.Body#speed + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.speed = 0; + + /** + * The direction of the Body's velocity, as calculated during the last step. + * This is a numeric constant value (FACING_UP, FACING_DOWN, FACING_LEFT, FACING_RIGHT). + * If the Body is moving on both axes, this describes motion on the vertical axis only. + * + * @name Phaser.Physics.Arcade.Body#facing + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.FACING_UP + * @see Phaser.Physics.Arcade.FACING_DOWN + * @see Phaser.Physics.Arcade.FACING_LEFT + * @see Phaser.Physics.Arcade.FACING_RIGHT + */ + this.facing = CONST.FACING_NONE; + + /** + * Whether this Body can be moved by collisions with another Body. + * + * @name Phaser.Physics.Arcade.Body#immovable + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.immovable = false; + + /** + * Sets if this Body can be pushed by another Body. + * + * A body that cannot be pushed will reflect back all of the velocity it is given to the + * colliding body. If that body is also not pushable, then the separation will be split + * between them evenly. + * + * If you want your body to never move or seperate at all, see the `setImmovable` method. + * + * By default, Dynamic Bodies are always pushable. + * + * @name Phaser.Physics.Arcade.Body#pushable + * @type {boolean} + * @default true + * @since 3.50.0 + * @see Phaser.GameObjects.Components.Pushable#setPushable + */ + this.pushable = true; + + /** + * Whether the Body's position and rotation are affected by its velocity, acceleration, drag, and gravity. + * + * @name Phaser.Physics.Arcade.Body#moves + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.moves = true; + + /** + * A flag disabling the default horizontal separation of colliding bodies. + * Pass your own `collideCallback` to the collider. + * + * @name Phaser.Physics.Arcade.Body#customSeparateX + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.customSeparateX = false; + + /** + * A flag disabling the default vertical separation of colliding bodies. + * Pass your own `collideCallback` to the collider. + * + * @name Phaser.Physics.Arcade.Body#customSeparateY + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.customSeparateY = false; + + /** + * The amount of horizontal overlap (before separation), if this Body is colliding with another. + * + * @name Phaser.Physics.Arcade.Body#overlapX + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.overlapX = 0; + + /** + * The amount of vertical overlap (before separation), if this Body is colliding with another. + * + * @name Phaser.Physics.Arcade.Body#overlapY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.overlapY = 0; + + /** + * The amount of overlap (before separation), if this Body is circular and colliding with another circular body. + * + * @name Phaser.Physics.Arcade.Body#overlapR + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.overlapR = 0; + + /** + * Whether this Body is overlapped with another and both are not moving, on at least one axis. + * + * @name Phaser.Physics.Arcade.Body#embedded + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.embedded = false; + + /** + * Whether this Body interacts with the world boundary. + * + * @name Phaser.Physics.Arcade.Body#collideWorldBounds + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.collideWorldBounds = false; + + /** + * Whether this Body is checked for collisions and for which directions. + * You can set `checkCollision.none = true` to disable collision checks. + * + * @name Phaser.Physics.Arcade.Body#checkCollision + * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} + * @since 3.0.0 + */ + this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; + + /** + * Whether this Body is colliding with a Body or Static Body and in which direction. + * In a collision where both bodies have zero velocity, `embedded` will be set instead. + * + * @name Phaser.Physics.Arcade.Body#touching + * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#blocked + * @see Phaser.Physics.Arcade.Body#embedded + */ + this.touching = { none: true, up: false, down: false, left: false, right: false }; + + /** + * This Body's `touching` value during the previous step. + * + * @name Phaser.Physics.Arcade.Body#wasTouching + * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#touching + */ + this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; + + /** + * Whether this Body is colliding with a Static Body, a tile, or the world boundary. + * In a collision with a Static Body, if this Body has zero velocity then `embedded` will be set instead. + * + * @name Phaser.Physics.Arcade.Body#blocked + * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#embedded + * @see Phaser.Physics.Arcade.Body#touching + */ + this.blocked = { none: true, up: false, down: false, left: false, right: false }; + + /** + * Whether to automatically synchronize this Body's dimensions to the dimensions of its Game Object's visual bounds. + * + * @name Phaser.Physics.Arcade.Body#syncBounds + * @type {boolean} + * @default false + * @since 3.0.0 + * @see Phaser.GameObjects.Components.GetBounds#getBounds + */ + this.syncBounds = false; + + /** + * The Body's physics type (dynamic or static). + * + * @name Phaser.Physics.Arcade.Body#physicsType + * @type {number} + * @readonly + * @default Phaser.Physics.Arcade.DYNAMIC_BODY + * @since 3.0.0 + */ + this.physicsType = CONST.DYNAMIC_BODY; + + /** + * Cached horizontal scale of the Body's Game Object. + * + * @name Phaser.Physics.Arcade.Body#_sx + * @type {number} + * @private + * @since 3.0.0 + */ + this._sx = gameObject.scaleX; + + /** + * Cached vertical scale of the Body's Game Object. + * + * @name Phaser.Physics.Arcade.Body#_sy + * @type {number} + * @private + * @since 3.0.0 + */ + this._sy = gameObject.scaleY; + + /** + * The calculated change in the Body's horizontal position during the last step. + * + * @name Phaser.Physics.Arcade.Body#_dx + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._dx = 0; + + /** + * The calculated change in the Body's vertical position during the last step. + * + * @name Phaser.Physics.Arcade.Body#_dy + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._dy = 0; + + /** + * The final calculated change in the Body's horizontal position as of `postUpdate`. + * + * @name Phaser.Physics.Arcade.Body#_tx + * @type {number} + * @private + * @default 0 + * @since 3.22.0 + */ + this._tx = 0; + + /** + * The final calculated change in the Body's vertical position as of `postUpdate`. + * + * @name Phaser.Physics.Arcade.Body#_ty + * @type {number} + * @private + * @default 0 + * @since 3.22.0 + */ + this._ty = 0; + + /** + * Stores the Game Object's bounds. + * + * @name Phaser.Physics.Arcade.Body#_bounds + * @type {Phaser.Geom.Rectangle} + * @private + * @since 3.0.0 + */ + this._bounds = new Rectangle(); + }, + + /** + * Updates the Body's `transform`, `width`, `height`, and `center` from its Game Object. + * The Body's `position` isn't changed. + * + * @method Phaser.Physics.Arcade.Body#updateBounds + * @since 3.0.0 + */ + updateBounds: function () + { + var sprite = this.gameObject; + + // Container? + + var transform = this.transform; + + if (sprite.parentContainer) + { + var matrix = sprite.getWorldTransformMatrix(this.world._tempMatrix, this.world._tempMatrix2); + + transform.x = matrix.tx; + transform.y = matrix.ty; + transform.rotation = RadToDeg(matrix.rotation); + transform.scaleX = matrix.scaleX; + transform.scaleY = matrix.scaleY; + transform.displayOriginX = sprite.displayOriginX; + transform.displayOriginY = sprite.displayOriginY; + } + else + { + transform.x = sprite.x; + transform.y = sprite.y; + transform.rotation = sprite.angle; + transform.scaleX = sprite.scaleX; + transform.scaleY = sprite.scaleY; + transform.displayOriginX = sprite.displayOriginX; + transform.displayOriginY = sprite.displayOriginY; + } + + var recalc = false; + + if (this.syncBounds) + { + var b = sprite.getBounds(this._bounds); + + this.width = b.width; + this.height = b.height; + recalc = true; + } + else + { + var asx = Math.abs(transform.scaleX); + var asy = Math.abs(transform.scaleY); + + if (this._sx !== asx || this._sy !== asy) + { + this.width = this.sourceWidth * asx; + this.height = this.sourceHeight * asy; + this._sx = asx; + this._sy = asy; + recalc = true; + } + } + + if (recalc) + { + this.halfWidth = Math.floor(this.width / 2); + this.halfHeight = Math.floor(this.height / 2); + this.updateCenter(); + } + }, + + /** + * Updates the Body's `center` from its `position`, `width`, and `height`. + * + * @method Phaser.Physics.Arcade.Body#updateCenter + * @since 3.0.0 + */ + updateCenter: function () + { + this.center.set(this.position.x + this.halfWidth, this.position.y + this.halfHeight); + }, + + /** + * Updates the Body's `position`, `width`, `height`, and `center` from its Game Object and `offset`. + * + * You don't need to call this for Dynamic Bodies, as it happens automatically during the physics step. + * But you could use it if you have modified the Body offset or Game Object transform and need to immediately + * read the Body's new `position` or `center`. + * + * To resynchronize the Body with its Game Object, use `reset()` instead. + * + * @method Phaser.Physics.Arcade.Body#updateFromGameObject + * @since 3.24.0 + */ + updateFromGameObject: function () + { + this.updateBounds(); + + var transform = this.transform; + + this.position.x = transform.x + transform.scaleX * (this.offset.x - transform.displayOriginX); + this.position.y = transform.y + transform.scaleY * (this.offset.y - transform.displayOriginY); + + this.updateCenter(); + }, + + /** + * Prepares the Body for a physics step by resetting the `wasTouching`, `touching` and `blocked` states. + * + * This method is only called if the physics world is going to run a step this frame. + * + * @method Phaser.Physics.Arcade.Body#resetFlags + * @since 3.18.0 + * + * @param {boolean} [clear=false] - Set the `wasTouching` values to their defaults. + */ + resetFlags: function (clear) + { + if (clear === undefined) + { + clear = false; + } + + // Store and reset collision flags + var wasTouching = this.wasTouching; + var touching = this.touching; + var blocked = this.blocked; + + if (clear) + { + wasTouching.none = true; + wasTouching.up = false; + wasTouching.down = false; + wasTouching.left = false; + wasTouching.right = false; + } + else + { + wasTouching.none = touching.none; + wasTouching.up = touching.up; + wasTouching.down = touching.down; + wasTouching.left = touching.left; + wasTouching.right = touching.right; + } + + touching.none = true; + touching.up = false; + touching.down = false; + touching.left = false; + touching.right = false; + + blocked.none = true; + blocked.up = false; + blocked.down = false; + blocked.left = false; + blocked.right = false; + + this.overlapR = 0; + this.overlapX = 0; + this.overlapY = 0; + + this.embedded = false; + }, + + /** + * Syncs the position body position with the parent Game Object. + * + * This method is called every game frame, regardless if the world steps or not. + * + * @method Phaser.Physics.Arcade.Body#preUpdate + * @since 3.17.0 + * + * @param {boolean} willStep - Will this Body run an update as well? + * @param {number} delta - The delta time, in seconds, elapsed since the last frame. + */ + preUpdate: function (willStep, delta) + { + if (willStep) + { + this.resetFlags(); + } + + if (this.gameObject) + { + this.updateFromGameObject(); + } + + this.rotation = this.transform.rotation; + this.preRotation = this.rotation; + + if (this.moves) + { + this.prev.x = this.position.x; + this.prev.y = this.position.y; + this.prevFrame.x = this.position.x; + this.prevFrame.y = this.position.y; + } + + if (willStep) + { + this.update(delta); + } + }, + + /** + * Performs a single physics step and updates the body velocity, angle, speed and other properties. + * + * This method can be called multiple times per game frame, depending on the physics step rate. + * + * The results are synced back to the Game Object in `postUpdate`. + * + * @method Phaser.Physics.Arcade.Body#update + * @fires Phaser.Physics.Arcade.Events#WORLD_BOUNDS + * @since 3.0.0 + * + * @param {number} delta - The delta time, in seconds, elapsed since the last frame. + */ + update: function (delta) + { + this.prev.x = this.position.x; + this.prev.y = this.position.y; + + if (this.moves) + { + this.world.updateMotion(this, delta); + + var vx = this.velocity.x; + var vy = this.velocity.y; + + this.newVelocity.set(vx * delta, vy * delta); + + this.position.add(this.newVelocity); + + this.updateCenter(); + + this.angle = Math.atan2(vy, vx); + this.speed = Math.sqrt(vx * vx + vy * vy); + + // Now the update will throw collision checks at the Body + // And finally we'll integrate the new position back to the Sprite in postUpdate + + if (this.collideWorldBounds && this.checkWorldBounds() && this.onWorldBounds) + { + this.world.emit(Events.WORLD_BOUNDS, this, this.blocked.up, this.blocked.down, this.blocked.left, this.blocked.right); + } + } + + this._dx = this.position.x - this.prev.x; + this._dy = this.position.y - this.prev.y; + }, + + /** + * Feeds the Body results back into the parent Game Object. + * + * This method is called every game frame, regardless if the world steps or not. + * + * @method Phaser.Physics.Arcade.Body#postUpdate + * @since 3.0.0 + */ + postUpdate: function () + { + var dx = this.position.x - this.prevFrame.x; + var dy = this.position.y - this.prevFrame.y; + var gameObject = this.gameObject; + + if (this.moves) + { + var mx = this.deltaMax.x; + var my = this.deltaMax.y; + + if (mx !== 0 && dx !== 0) + { + if (dx < 0 && dx < -mx) + { + dx = -mx; + } + else if (dx > 0 && dx > mx) + { + dx = mx; + } + } + + if (my !== 0 && dy !== 0) + { + if (dy < 0 && dy < -my) + { + dy = -my; + } + else if (dy > 0 && dy > my) + { + dy = my; + } + } + + if (gameObject) + { + gameObject.x += dx; + gameObject.y += dy; + } + } + + if (dx < 0) + { + this.facing = CONST.FACING_LEFT; + } + else if (dx > 0) + { + this.facing = CONST.FACING_RIGHT; + } + + if (dy < 0) + { + this.facing = CONST.FACING_UP; + } + else if (dy > 0) + { + this.facing = CONST.FACING_DOWN; + } + + if (this.allowRotation && gameObject) + { + gameObject.angle += this.deltaZ(); + } + + this._tx = dx; + this._ty = dy; + }, + + /** + * Sets a custom collision boundary rectangle. Use if you want to have a custom + * boundary instead of the world boundaries. + * + * @method Phaser.Physics.Arcade.Body#setBoundsRectangle + * @since 3.20 + * + * @param {?Phaser.Geom.Rectangle} [bounds] - The new boundary rectangle. Pass `null` to use the World bounds. + * + * @return {this} This Body object. + */ + setBoundsRectangle: function (bounds) + { + this.customBoundsRectangle = (!bounds) ? this.world.bounds : bounds; + + return this; + }, + + /** + * Checks for collisions between this Body and the world boundary and separates them. + * + * @method Phaser.Physics.Arcade.Body#checkWorldBounds + * @since 3.0.0 + * + * @return {boolean} True if this Body is colliding with the world boundary. + */ + checkWorldBounds: function () + { + var pos = this.position; + var bounds = this.customBoundsRectangle; + var check = this.world.checkCollision; + + var bx = (this.worldBounce) ? -this.worldBounce.x : -this.bounce.x; + var by = (this.worldBounce) ? -this.worldBounce.y : -this.bounce.y; + + var wasSet = false; + + if (pos.x < bounds.x && check.left) + { + pos.x = bounds.x; + this.velocity.x *= bx; + this.blocked.left = true; + wasSet = true; + } + else if (this.right > bounds.right && check.right) + { + pos.x = bounds.right - this.width; + this.velocity.x *= bx; + this.blocked.right = true; + wasSet = true; + } + + if (pos.y < bounds.y && check.up) + { + pos.y = bounds.y; + this.velocity.y *= by; + this.blocked.up = true; + wasSet = true; + } + else if (this.bottom > bounds.bottom && check.down) + { + pos.y = bounds.bottom - this.height; + this.velocity.y *= by; + this.blocked.down = true; + wasSet = true; + } + + if (wasSet) + { + this.blocked.none = false; + this.updateCenter(); + } + + return wasSet; + }, + + /** + * Sets the offset of the Body's position from its Game Object's position. + * The Body's `position` isn't changed until the next `preUpdate`. + * + * @method Phaser.Physics.Arcade.Body#setOffset + * @since 3.0.0 + * + * @param {number} x - The horizontal offset, in source pixels. + * @param {number} [y=x] - The vertical offset, in source pixels. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setOffset: function (x, y) + { + if (y === undefined) { y = x; } + + this.offset.set(x, y); + + return this; + }, + + /** + * Assign this Body to a new Game Object. + * + * Removes this body from the Physics World, assigns to the new Game Object, calls `setSize` and then + * adds this body back into the World again, setting it enabled, unless the `enable` argument is set to `false`. + * + * If this body already has a Game Object, then it will remove itself from that Game Object first. + * + * Only if the given `gameObject` has a `body` property will this Body be assigned to it. + * + * @method Phaser.Physics.Arcade.Body#setGameObject + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object this Body belongs to. + * @param {boolean} [enable=true] - Automatically enable this Body for physics. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setGameObject: function (gameObject, enable) + { + if (enable === undefined) { enable = true; } + + // Remove from the World + this.world.remove(this); + + if (this.gameObject && this.gameObject.body) + { + // Disconnect the current Game Object + this.gameObject.body = null; + } + + this.gameObject = gameObject; + + if (gameObject.body) + { + gameObject.body = this; + } + + this.setSize(); + + this.world.add(this); + + this.enable = enable; + + return this; + }, + + /** + * Sizes and positions this Body, as a rectangle. + * Modifies the Body `offset` if `center` is true (the default). + * Resets the width and height to match current frame, if no width and height provided and a frame is found. + * + * @method Phaser.Physics.Arcade.Body#setSize + * @since 3.0.0 + * + * @param {number} [width] - The width of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width. + * @param {number} [height] - The height of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height. + * @param {boolean} [center=true] - Modify the Body's `offset`, placing the Body's center on its Game Object's center. Only works if the Game Object has the `getCenter` method. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setSize: function (width, height, center) + { + if (center === undefined) { center = true; } + + var gameObject = this.gameObject; + + if (gameObject) + { + if (!width && gameObject.frame) + { + width = gameObject.frame.realWidth; + } + + if (!height && gameObject.frame) + { + height = gameObject.frame.realHeight; + } + } + + this.sourceWidth = width; + this.sourceHeight = height; + + this.width = this.sourceWidth * this._sx; + this.height = this.sourceHeight * this._sy; + + this.halfWidth = Math.floor(this.width / 2); + this.halfHeight = Math.floor(this.height / 2); + + this.updateCenter(); + + if (center && gameObject && gameObject.getCenter) + { + var ox = (gameObject.width - width) / 2; + var oy = (gameObject.height - height) / 2; + + this.offset.set(ox, oy); + } + + this.isCircle = false; + this.radius = 0; + + return this; + }, + + /** + * Sizes and positions this Body, as a circle. + * + * @method Phaser.Physics.Arcade.Body#setCircle + * @since 3.0.0 + * + * @param {number} radius - The radius of the Body, in source pixels. + * @param {number} [offsetX] - The horizontal offset of the Body from its Game Object, in source pixels. + * @param {number} [offsetY] - The vertical offset of the Body from its Game Object, in source pixels. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setCircle: function (radius, offsetX, offsetY) + { + if (offsetX === undefined) { offsetX = this.offset.x; } + if (offsetY === undefined) { offsetY = this.offset.y; } + + if (radius > 0) + { + this.isCircle = true; + this.radius = radius; + + this.sourceWidth = radius * 2; + this.sourceHeight = radius * 2; + + this.width = this.sourceWidth * this._sx; + this.height = this.sourceHeight * this._sy; + + this.halfWidth = Math.floor(this.width / 2); + this.halfHeight = Math.floor(this.height / 2); + + this.offset.set(offsetX, offsetY); + + this.updateCenter(); + } + else + { + this.isCircle = false; + } + + return this; + }, + + /** + * Sets this Body's parent Game Object to the given coordinates and resets this Body at the new coordinates. + * If the Body had any velocity or acceleration it is lost as a result of calling this. + * + * @method Phaser.Physics.Arcade.Body#reset + * @since 3.0.0 + * + * @param {number} x - The horizontal position to place the Game Object. + * @param {number} y - The vertical position to place the Game Object. + */ + reset: function (x, y) + { + this.stop(); + + var gameObject = this.gameObject; + + if (gameObject) + { + gameObject.setPosition(x, y); + + this.rotation = gameObject.angle; + this.preRotation = gameObject.angle; + } + + var pos = this.position; + + if (gameObject && gameObject.getTopLeft) + { + gameObject.getTopLeft(pos); + } + else + { + pos.set(x, y); + } + + this.prev.copy(pos); + this.prevFrame.copy(pos); + + if (gameObject) + { + this.updateBounds(); + } + + this.updateCenter(); + + if (this.collideWorldBounds) + { + this.checkWorldBounds(); + } + + this.resetFlags(true); + }, + + /** + * Sets acceleration, velocity, and speed to zero. + * + * @method Phaser.Physics.Arcade.Body#stop + * @since 3.0.0 + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + stop: function () + { + this.velocity.set(0); + this.acceleration.set(0); + this.speed = 0; + this.angularVelocity = 0; + this.angularAcceleration = 0; + + return this; + }, + + /** + * Copies the coordinates of this Body's edges into an object. + * + * @method Phaser.Physics.Arcade.Body#getBounds + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Arcade.ArcadeBodyBounds} obj - An object to copy the values into. + * + * @return {Phaser.Types.Physics.Arcade.ArcadeBodyBounds} - An object with {x, y, right, bottom}. + */ + getBounds: function (obj) + { + obj.x = this.x; + obj.y = this.y; + obj.right = this.right; + obj.bottom = this.bottom; + + return obj; + }, + + /** + * Tests if the coordinates are within this Body. + * + * @method Phaser.Physics.Arcade.Body#hitTest + * @since 3.0.0 + * + * @param {number} x - The horizontal coordinate. + * @param {number} y - The vertical coordinate. + * + * @return {boolean} True if (x, y) is within this Body. + */ + hitTest: function (x, y) + { + if (!this.isCircle) + { + return RectangleContains(this, x, y); + } + + // Check if x/y are within the bounds first + if (this.radius > 0 && x >= this.left && x <= this.right && y >= this.top && y <= this.bottom) + { + var dx = (this.center.x - x) * (this.center.x - x); + var dy = (this.center.y - y) * (this.center.y - y); + + return (dx + dy) <= (this.radius * this.radius); + } + + return false; + }, + + /** + * Whether this Body is touching a tile or the world boundary while moving down. + * + * @method Phaser.Physics.Arcade.Body#onFloor + * @since 3.0.0 + * @see Phaser.Physics.Arcade.Body#blocked + * + * @return {boolean} True if touching. + */ + onFloor: function () + { + return this.blocked.down; + }, + + /** + * Whether this Body is touching a tile or the world boundary while moving up. + * + * @method Phaser.Physics.Arcade.Body#onCeiling + * @since 3.0.0 + * @see Phaser.Physics.Arcade.Body#blocked + * + * @return {boolean} True if touching. + */ + onCeiling: function () + { + return this.blocked.up; + }, + + /** + * Whether this Body is touching a tile or the world boundary while moving left or right. + * + * @method Phaser.Physics.Arcade.Body#onWall + * @since 3.0.0 + * @see Phaser.Physics.Arcade.Body#blocked + * + * @return {boolean} True if touching. + */ + onWall: function () + { + return (this.blocked.left || this.blocked.right); + }, + + /** + * The absolute (non-negative) change in this Body's horizontal position from the previous step. + * + * @method Phaser.Physics.Arcade.Body#deltaAbsX + * @since 3.0.0 + * + * @return {number} The delta value. + */ + deltaAbsX: function () + { + return (this._dx > 0) ? this._dx : -this._dx; + }, + + /** + * The absolute (non-negative) change in this Body's vertical position from the previous step. + * + * @method Phaser.Physics.Arcade.Body#deltaAbsY + * @since 3.0.0 + * + * @return {number} The delta value. + */ + deltaAbsY: function () + { + return (this._dy > 0) ? this._dy : -this._dy; + }, + + /** + * The change in this Body's horizontal position from the previous step. + * This value is set during the Body's update phase. + * + * As a Body can update multiple times per step this may not hold the final + * delta value for the Body. In this case, please see the `deltaXFinal` method. + * + * @method Phaser.Physics.Arcade.Body#deltaX + * @since 3.0.0 + * + * @return {number} The delta value. + */ + deltaX: function () + { + return this._dx; + }, + + /** + * The change in this Body's vertical position from the previous step. + * This value is set during the Body's update phase. + * + * As a Body can update multiple times per step this may not hold the final + * delta value for the Body. In this case, please see the `deltaYFinal` method. + * + * @method Phaser.Physics.Arcade.Body#deltaY + * @since 3.0.0 + * + * @return {number} The delta value. + */ + deltaY: function () + { + return this._dy; + }, + + /** + * The change in this Body's horizontal position from the previous game update. + * + * This value is set during the `postUpdate` phase and takes into account the + * `deltaMax` and final position of the Body. + * + * Because this value is not calculated until `postUpdate`, you must listen for it + * during a Scene `POST_UPDATE` or `RENDER` event, and not in `update`, as it will + * not be calculated by that point. If you _do_ use these values in `update` they + * will represent the delta from the _previous_ game frame. + * + * @method Phaser.Physics.Arcade.Body#deltaXFinal + * @since 3.22.0 + * + * @return {number} The final delta x value. + */ + deltaXFinal: function () + { + return this._tx; + }, + + /** + * The change in this Body's vertical position from the previous game update. + * + * This value is set during the `postUpdate` phase and takes into account the + * `deltaMax` and final position of the Body. + * + * Because this value is not calculated until `postUpdate`, you must listen for it + * during a Scene `POST_UPDATE` or `RENDER` event, and not in `update`, as it will + * not be calculated by that point. If you _do_ use these values in `update` they + * will represent the delta from the _previous_ game frame. + * + * @method Phaser.Physics.Arcade.Body#deltaYFinal + * @since 3.22.0 + * + * @return {number} The final delta y value. + */ + deltaYFinal: function () + { + return this._ty; + }, + + /** + * The change in this Body's rotation from the previous step, in degrees. + * + * @method Phaser.Physics.Arcade.Body#deltaZ + * @since 3.0.0 + * + * @return {number} The delta value. + */ + deltaZ: function () + { + return this.rotation - this.preRotation; + }, + + /** + * Disables this Body and marks it for deletion by the simulation. + * + * @method Phaser.Physics.Arcade.Body#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.enable = false; + + if (this.world) + { + this.world.pendingDestroy.set(this); + } + }, + + /** + * Draws this Body and its velocity, if enabled. + * + * @method Phaser.Physics.Arcade.Body#drawDebug + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Graphics} graphic - The Graphics object to draw on. + */ + drawDebug: function (graphic) + { + var pos = this.position; + + var x = pos.x + this.halfWidth; + var y = pos.y + this.halfHeight; + + if (this.debugShowBody) + { + graphic.lineStyle(graphic.defaultStrokeWidth, this.debugBodyColor); + + if (this.isCircle) + { + graphic.strokeCircle(x, y, this.width / 2); + } + else + { + // Only draw the sides where checkCollision is true, similar to debugger in layer + if (this.checkCollision.up) + { + graphic.lineBetween(pos.x, pos.y, pos.x + this.width, pos.y); + } + + if (this.checkCollision.right) + { + graphic.lineBetween(pos.x + this.width, pos.y, pos.x + this.width, pos.y + this.height); + } + + if (this.checkCollision.down) + { + graphic.lineBetween(pos.x, pos.y + this.height, pos.x + this.width, pos.y + this.height); + } + + if (this.checkCollision.left) + { + graphic.lineBetween(pos.x, pos.y, pos.x, pos.y + this.height); + } + } + } + + if (this.debugShowVelocity) + { + graphic.lineStyle(graphic.defaultStrokeWidth, this.world.defaults.velocityDebugColor, 1); + graphic.lineBetween(x, y, x + this.velocity.x / 2, y + this.velocity.y / 2); + } + }, + + /** + * Whether this Body will be drawn to the debug display. + * + * @method Phaser.Physics.Arcade.Body#willDrawDebug + * @since 3.0.0 + * + * @return {boolean} True if either `debugShowBody` or `debugShowVelocity` are enabled. + */ + willDrawDebug: function () + { + return (this.debugShowBody || this.debugShowVelocity); + }, + + /** + * Sets whether this Body collides with the world boundary. + * + * Optionally also sets the World Bounce and `onWorldBounds` values. + * + * @method Phaser.Physics.Arcade.Body#setCollideWorldBounds + * @since 3.0.0 + * + * @param {boolean} [value=true] - `true` if the Body should collide with the world bounds, otherwise `false`. + * @param {number} [bounceX] - If given this replaces the Body's `worldBounce.x` value. + * @param {number} [bounceY] - If given this replaces the Body's `worldBounce.y` value. + * @param {boolean} [onWorldBounds] - If given this replaces the Body's `onWorldBounds` value. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setCollideWorldBounds: function (value, bounceX, bounceY, onWorldBounds) + { + if (value === undefined) { value = true; } + + this.collideWorldBounds = value; + + var setBounceX = (bounceX !== undefined); + var setBounceY = (bounceY !== undefined); + + if (setBounceX || setBounceY) + { + if (!this.worldBounce) + { + this.worldBounce = new Vector2(); + } + + if (setBounceX) + { + this.worldBounce.x = bounceX; + } + + if (setBounceY) + { + this.worldBounce.y = bounceY; + } + } + + if (onWorldBounds !== undefined) + { + this.onWorldBounds = onWorldBounds; + } + + return this; + }, + + /** + * Sets the Body's velocity. + * + * @method Phaser.Physics.Arcade.Body#setVelocity + * @since 3.0.0 + * + * @param {number} x - The horizontal velocity, in pixels per second. + * @param {number} [y=x] - The vertical velocity, in pixels per second. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setVelocity: function (x, y) + { + this.velocity.set(x, y); + + x = this.velocity.x; + y = this.velocity.y; + + this.speed = Math.sqrt(x * x + y * y); + + return this; + }, + + /** + * Sets the Body's horizontal velocity. + * + * @method Phaser.Physics.Arcade.Body#setVelocityX + * @since 3.0.0 + * + * @param {number} value - The velocity, in pixels per second. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setVelocityX: function (value) + { + return this.setVelocity(value, this.velocity.y); + }, + + /** + * Sets the Body's vertical velocity. + * + * @method Phaser.Physics.Arcade.Body#setVelocityY + * @since 3.0.0 + * + * @param {number} value - The velocity, in pixels per second. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setVelocityY: function (value) + { + return this.setVelocity(this.velocity.x, value); + }, + + /** + * Sets the Body's maximum velocity. + * + * @method Phaser.Physics.Arcade.Body#setMaxVelocity + * @since 3.10.0 + * + * @param {number} x - The horizontal velocity, in pixels per second. + * @param {number} [y=x] - The vertical velocity, in pixels per second. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMaxVelocity: function (x, y) + { + this.maxVelocity.set(x, y); + + return this; + }, + + /** + * Sets the Body's maximum horizontal velocity. + * + * @method Phaser.Physics.Arcade.Body#setMaxVelocityX + * @since 3.50.0 + * + * @param {number} value - The maximum horizontal velocity, in pixels per second. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMaxVelocityX: function (value) + { + this.maxVelocity.x = value; + + return this; + }, + + /** + * Sets the Body's maximum vertical velocity. + * + * @method Phaser.Physics.Arcade.Body#setMaxVelocityY + * @since 3.50.0 + * + * @param {number} value - The maximum vertical velocity, in pixels per second. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMaxVelocityY: function (value) + { + this.maxVelocity.y = value; + + return this; + }, + + /** + * Sets the maximum speed the Body can move. + * + * @method Phaser.Physics.Arcade.Body#setMaxSpeed + * @since 3.16.0 + * + * @param {number} value - The maximum speed value, in pixels per second. Set to a negative value to disable. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMaxSpeed: function (value) + { + this.maxSpeed = value; + + return this; + }, + + /** + * Sets the Body's bounce. + * + * @method Phaser.Physics.Arcade.Body#setBounce + * @since 3.0.0 + * + * @param {number} x - The horizontal bounce, relative to 1. + * @param {number} [y=x] - The vertical bounce, relative to 1. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setBounce: function (x, y) + { + this.bounce.set(x, y); + + return this; + }, + + /** + * Sets the Body's horizontal bounce. + * + * @method Phaser.Physics.Arcade.Body#setBounceX + * @since 3.0.0 + * + * @param {number} value - The bounce, relative to 1. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setBounceX: function (value) + { + this.bounce.x = value; + + return this; + }, + + /** + * Sets the Body's vertical bounce. + * + * @method Phaser.Physics.Arcade.Body#setBounceY + * @since 3.0.0 + * + * @param {number} value - The bounce, relative to 1. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setBounceY: function (value) + { + this.bounce.y = value; + + return this; + }, + + /** + * Sets the Body's acceleration. + * + * @method Phaser.Physics.Arcade.Body#setAcceleration + * @since 3.0.0 + * + * @param {number} x - The horizontal component, in pixels per second squared. + * @param {number} [y=x] - The vertical component, in pixels per second squared. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setAcceleration: function (x, y) + { + this.acceleration.set(x, y); + + return this; + }, + + /** + * Sets the Body's horizontal acceleration. + * + * @method Phaser.Physics.Arcade.Body#setAccelerationX + * @since 3.0.0 + * + * @param {number} value - The acceleration, in pixels per second squared. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setAccelerationX: function (value) + { + this.acceleration.x = value; + + return this; + }, + + /** + * Sets the Body's vertical acceleration. + * + * @method Phaser.Physics.Arcade.Body#setAccelerationY + * @since 3.0.0 + * + * @param {number} value - The acceleration, in pixels per second squared. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setAccelerationY: function (value) + { + this.acceleration.y = value; + + return this; + }, + + /** + * Enables or disables drag. + * + * @method Phaser.Physics.Arcade.Body#setAllowDrag + * @since 3.9.0 + * @see Phaser.Physics.Arcade.Body#allowDrag + * + * @param {boolean} [value=true] - `true` to allow drag on this body, or `false` to disable it. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setAllowDrag: function (value) + { + if (value === undefined) { value = true; } + + this.allowDrag = value; + + return this; + }, + + /** + * Enables or disables gravity's effect on this Body. + * + * @method Phaser.Physics.Arcade.Body#setAllowGravity + * @since 3.9.0 + * @see Phaser.Physics.Arcade.Body#allowGravity + * + * @param {boolean} [value=true] - `true` to allow gravity on this body, or `false` to disable it. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setAllowGravity: function (value) + { + if (value === undefined) { value = true; } + + this.allowGravity = value; + + return this; + }, + + /** + * Enables or disables rotation. + * + * @method Phaser.Physics.Arcade.Body#setAllowRotation + * @since 3.9.0 + * @see Phaser.Physics.Arcade.Body#allowRotation + * + * @param {boolean} [value=true] - `true` to allow rotation on this body, or `false` to disable it. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setAllowRotation: function (value) + { + if (value === undefined) { value = true; } + + this.allowRotation = value; + + return this; + }, + + /** + * Sets the Body's drag. + * + * @method Phaser.Physics.Arcade.Body#setDrag + * @since 3.0.0 + * + * @param {number} x - The horizontal component, in pixels per second squared. + * @param {number} [y=x] - The vertical component, in pixels per second squared. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setDrag: function (x, y) + { + this.drag.set(x, y); + + return this; + }, + + /** + * If this Body is using `drag` for deceleration this property controls how the drag is applied. + * If set to `true` drag will use a damping effect rather than a linear approach. If you are + * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in + * the game Asteroids) then you will get a far smoother and more visually correct deceleration + * by using damping, avoiding the axis-drift that is prone with linear deceleration. + * + * If you enable this property then you should use far smaller `drag` values than with linear, as + * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow + * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately. + * + * @method Phaser.Physics.Arcade.Body#setDamping + * @since 3.50.0 + * + * @param {boolean} value - `true` to use damping, or `false` to use drag. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setDamping: function (value) + { + this.useDamping = value; + + return this; + }, + + /** + * Sets the Body's horizontal drag. + * + * @method Phaser.Physics.Arcade.Body#setDragX + * @since 3.0.0 + * + * @param {number} value - The drag, in pixels per second squared. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setDragX: function (value) + { + this.drag.x = value; + + return this; + }, + + /** + * Sets the Body's vertical drag. + * + * @method Phaser.Physics.Arcade.Body#setDragY + * @since 3.0.0 + * + * @param {number} value - The drag, in pixels per second squared. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setDragY: function (value) + { + this.drag.y = value; + + return this; + }, + + /** + * Sets the Body's gravity. + * + * @method Phaser.Physics.Arcade.Body#setGravity + * @since 3.0.0 + * + * @param {number} x - The horizontal component, in pixels per second squared. + * @param {number} [y=x] - The vertical component, in pixels per second squared. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setGravity: function (x, y) + { + this.gravity.set(x, y); + + return this; + }, + + /** + * Sets the Body's horizontal gravity. + * + * @method Phaser.Physics.Arcade.Body#setGravityX + * @since 3.0.0 + * + * @param {number} value - The gravity, in pixels per second squared. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setGravityX: function (value) + { + this.gravity.x = value; + + return this; + }, + + /** + * Sets the Body's vertical gravity. + * + * @method Phaser.Physics.Arcade.Body#setGravityY + * @since 3.0.0 + * + * @param {number} value - The gravity, in pixels per second squared. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setGravityY: function (value) + { + this.gravity.y = value; + + return this; + }, + + /** + * Sets the Body's friction. + * + * @method Phaser.Physics.Arcade.Body#setFriction + * @since 3.0.0 + * + * @param {number} x - The horizontal component, relative to 1. + * @param {number} [y=x] - The vertical component, relative to 1. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setFriction: function (x, y) + { + this.friction.set(x, y); + + return this; + }, + + /** + * Sets the Body's horizontal friction. + * + * @method Phaser.Physics.Arcade.Body#setFrictionX + * @since 3.0.0 + * + * @param {number} value - The friction value, relative to 1. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setFrictionX: function (value) + { + this.friction.x = value; + + return this; + }, + + /** + * Sets the Body's vertical friction. + * + * @method Phaser.Physics.Arcade.Body#setFrictionY + * @since 3.0.0 + * + * @param {number} value - The friction value, relative to 1. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setFrictionY: function (value) + { + this.friction.y = value; + + return this; + }, + + /** + * Sets the Body's angular velocity. + * + * @method Phaser.Physics.Arcade.Body#setAngularVelocity + * @since 3.0.0 + * + * @param {number} value - The velocity, in degrees per second. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setAngularVelocity: function (value) + { + this.angularVelocity = value; + + return this; + }, + + /** + * Sets the Body's angular acceleration. + * + * @method Phaser.Physics.Arcade.Body#setAngularAcceleration + * @since 3.0.0 + * + * @param {number} value - The acceleration, in degrees per second squared. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setAngularAcceleration: function (value) + { + this.angularAcceleration = value; + + return this; + }, + + /** + * Sets the Body's angular drag. + * + * @method Phaser.Physics.Arcade.Body#setAngularDrag + * @since 3.0.0 + * + * @param {number} value - The drag, in degrees per second squared. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setAngularDrag: function (value) + { + this.angularDrag = value; + + return this; + }, + + /** + * Sets the Body's mass. + * + * @method Phaser.Physics.Arcade.Body#setMass + * @since 3.0.0 + * + * @param {number} value - The mass value, relative to 1. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setMass: function (value) + { + this.mass = value; + + return this; + }, + + /** + * Sets the Body's `immovable` property. + * + * @method Phaser.Physics.Arcade.Body#setImmovable + * @since 3.0.0 + * + * @param {boolean} [value=true] - The value to assign to `immovable`. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setImmovable: function (value) + { + if (value === undefined) { value = true; } + + this.immovable = value; + + return this; + }, + + /** + * Sets the Body's `enable` property. + * + * @method Phaser.Physics.Arcade.Body#setEnable + * @since 3.15.0 + * + * @param {boolean} [value=true] - The value to assign to `enable`. + * + * @return {Phaser.Physics.Arcade.Body} This Body object. + */ + setEnable: function (value) + { + if (value === undefined) { value = true; } + + this.enable = value; + + return this; + }, + + /** + * This is an internal handler, called by the `ProcessX` function as part + * of the collision step. You should almost never call this directly. + * + * @method Phaser.Physics.Arcade.Body#processX + * @since 3.50.0 + * + * @param {number} x - The amount to add to the Body position. + * @param {number} [vx] - The amount to add to the Body velocity. + * @param {boolean} [left] - Set the blocked.left value? + * @param {boolean} [right] - Set the blocked.right value? + */ + processX: function (x, vx, left, right) + { + this.x += x; + + this.updateCenter(); + + if (vx !== null) + { + this.velocity.x = vx; + } + + var blocked = this.blocked; + + if (left) + { + blocked.left = true; + blocked.none = false; + } + + if (right) + { + blocked.right = true; + blocked.none = false; + } + }, + + /** + * This is an internal handler, called by the `ProcessY` function as part + * of the collision step. You should almost never call this directly. + * + * @method Phaser.Physics.Arcade.Body#processY + * @since 3.50.0 + * + * @param {number} y - The amount to add to the Body position. + * @param {number} [vy] - The amount to add to the Body velocity. + * @param {boolean} [up] - Set the blocked.up value? + * @param {boolean} [down] - Set the blocked.down value? + */ + processY: function (y, vy, up, down) + { + this.y += y; + + this.updateCenter(); + + if (vy !== null) + { + this.velocity.y = vy; + } + + var blocked = this.blocked; + + if (up) + { + blocked.up = true; + blocked.none = false; + } + + if (down) + { + blocked.down = true; + blocked.none = false; + } + }, + + /** + * The Bodys horizontal position (left edge). + * + * @name Phaser.Physics.Arcade.Body#x + * @type {number} + * @since 3.0.0 + */ + x: { + + get: function () + { + return this.position.x; + }, + + set: function (value) + { + this.position.x = value; + } + + }, + + /** + * The Bodys vertical position (top edge). + * + * @name Phaser.Physics.Arcade.Body#y + * @type {number} + * @since 3.0.0 + */ + y: { + + get: function () + { + return this.position.y; + }, + + set: function (value) + { + this.position.y = value; + } + + }, + + /** + * The left edge of the Body. Identical to x. + * + * @name Phaser.Physics.Arcade.Body#left + * @type {number} + * @readonly + * @since 3.0.0 + */ + left: { + + get: function () + { + return this.position.x; + } + + }, + + /** + * The right edge of the Body. + * + * @name Phaser.Physics.Arcade.Body#right + * @type {number} + * @readonly + * @since 3.0.0 + */ + right: { + + get: function () + { + return this.position.x + this.width; + } + + }, + + /** + * The top edge of the Body. Identical to y. + * + * @name Phaser.Physics.Arcade.Body#top + * @type {number} + * @readonly + * @since 3.0.0 + */ + top: { + + get: function () + { + return this.position.y; + } + + }, + + /** + * The bottom edge of this Body. + * + * @name Phaser.Physics.Arcade.Body#bottom + * @type {number} + * @readonly + * @since 3.0.0 + */ + bottom: { + + get: function () + { + return this.position.y + this.height; + } + + } + +}); + +module.exports = Body; + + +/***/ }), + +/***/ 3909: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); + +/** + * @classdesc + * An Arcade Physics Collider will automatically check for collision, or overlaps, between two objects + * every step. If a collision, or overlap, occurs it will invoke the given callbacks. + * + * @class Collider + * @memberof Phaser.Physics.Arcade + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.World} world - The Arcade physics World that will manage the collisions. + * @param {boolean} overlapOnly - Whether to check for collisions or overlap. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object2 - The second object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. + * @param {any} callbackContext - The scope in which to call the callbacks. + */ +var Collider = new Class({ + + initialize: + + function Collider (world, overlapOnly, object1, object2, collideCallback, processCallback, callbackContext) + { + /** + * The world in which the bodies will collide. + * + * @name Phaser.Physics.Arcade.Collider#world + * @type {Phaser.Physics.Arcade.World} + * @since 3.0.0 + */ + this.world = world; + + /** + * The name of the collider (unused by Phaser). + * + * @name Phaser.Physics.Arcade.Collider#name + * @type {string} + * @since 3.1.0 + */ + this.name = ''; + + /** + * Whether the collider is active. + * + * @name Phaser.Physics.Arcade.Collider#active + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.active = true; + + /** + * Whether to check for collisions or overlaps. + * + * @name Phaser.Physics.Arcade.Collider#overlapOnly + * @type {boolean} + * @since 3.0.0 + */ + this.overlapOnly = overlapOnly; + + /** + * The first object to check for collision. + * + * @name Phaser.Physics.Arcade.Collider#object1 + * @type {Phaser.Types.Physics.Arcade.ArcadeColliderType} + * @since 3.0.0 + */ + this.object1 = object1; + + /** + * The second object to check for collision. + * + * @name Phaser.Physics.Arcade.Collider#object2 + * @type {Phaser.Types.Physics.Arcade.ArcadeColliderType} + * @since 3.0.0 + */ + this.object2 = object2; + + /** + * The callback to invoke when the two objects collide. + * + * @name Phaser.Physics.Arcade.Collider#collideCallback + * @type {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} + * @since 3.0.0 + */ + this.collideCallback = collideCallback; + + /** + * If a processCallback exists it must return true or collision checking will be skipped. + * + * @name Phaser.Physics.Arcade.Collider#processCallback + * @type {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} + * @since 3.0.0 + */ + this.processCallback = processCallback; + + /** + * The context the collideCallback and processCallback will run in. + * + * @name Phaser.Physics.Arcade.Collider#callbackContext + * @type {object} + * @since 3.0.0 + */ + this.callbackContext = callbackContext; + }, + + /** + * A name for the Collider. + * + * Phaser does not use this value, it's for your own reference. + * + * @method Phaser.Physics.Arcade.Collider#setName + * @since 3.1.0 + * + * @param {string} name - The name to assign to the Collider. + * + * @return {Phaser.Physics.Arcade.Collider} This Collider instance. + */ + setName: function (name) + { + this.name = name; + + return this; + }, + + /** + * Called by World as part of its step processing, initial operation of collision checking. + * + * @method Phaser.Physics.Arcade.Collider#update + * @since 3.0.0 + */ + update: function () + { + this.world.collideObjects( + this.object1, + this.object2, + this.collideCallback, + this.processCallback, + this.callbackContext, + this.overlapOnly + ); + }, + + /** + * Removes Collider from World and disposes of its resources. + * + * @method Phaser.Physics.Arcade.Collider#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.world.removeCollider(this); + + this.active = false; + + this.world = null; + + this.object1 = null; + this.object2 = null; + + this.collideCallback = null; + this.processCallback = null; + this.callbackContext = null; + } + +}); + +module.exports = Collider; + + +/***/ }), + +/***/ 99523: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var ArcadeImage = __webpack_require__(62832); +var ArcadeSprite = __webpack_require__(25084); +var Body = __webpack_require__(97602); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(47401); +var PhysicsGroup = __webpack_require__(10481); +var StaticBody = __webpack_require__(66634); +var StaticPhysicsGroup = __webpack_require__(46346); + +/** + * @classdesc + * The Arcade Physics Factory allows you to easily create Arcade Physics enabled Game Objects. + * Objects that are created by this Factory are automatically added to the physics world. + * + * @class Factory + * @memberof Phaser.Physics.Arcade + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.World} world - The Arcade Physics World instance. + */ +var Factory = new Class({ + + initialize: + + function Factory (world) + { + /** + * A reference to the Arcade Physics World. + * + * @name Phaser.Physics.Arcade.Factory#world + * @type {Phaser.Physics.Arcade.World} + * @since 3.0.0 + */ + this.world = world; + + /** + * A reference to the Scene this Arcade Physics instance belongs to. + * + * @name Phaser.Physics.Arcade.Factory#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = world.scene; + + /** + * A reference to the Scene.Systems this Arcade Physics instance belongs to. + * + * @name Phaser.Physics.Arcade.Factory#sys + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.sys = world.scene.sys; + }, + + /** + * Creates a new Arcade Physics Collider object. + * + * @method Phaser.Physics.Arcade.Factory#collider + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object2 - The second object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects collide. Must return a boolean. + * @param {*} [callbackContext] - The scope in which to call the callbacks. + * + * @return {Phaser.Physics.Arcade.Collider} The Collider that was created. + */ + collider: function (object1, object2, collideCallback, processCallback, callbackContext) + { + return this.world.addCollider(object1, object2, collideCallback, processCallback, callbackContext); + }, + + /** + * Creates a new Arcade Physics Collider Overlap object. + * + * @method Phaser.Physics.Arcade.Factory#overlap + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object to check for overlap. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object2 - The second object to check for overlap. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects collide. Must return a boolean. + * @param {*} [callbackContext] - The scope in which to call the callbacks. + * + * @return {Phaser.Physics.Arcade.Collider} The Collider that was created. + */ + overlap: function (object1, object2, collideCallback, processCallback, callbackContext) + { + return this.world.addOverlap(object1, object2, collideCallback, processCallback, callbackContext); + }, + + /** + * Adds an Arcade Physics Body to the given Game Object. + * + * @method Phaser.Physics.Arcade.Factory#existing + * @since 3.0.0 + * + * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return] + * + * @param {Phaser.GameObjects.GameObject} gameObject - A Game Object. + * @param {boolean} [isStatic=false] - Create a Static body (true) or Dynamic body (false). + * + * @return {Phaser.Types.Physics.Arcade.GameObjectWithBody} The Game Object. + */ + existing: function (gameObject, isStatic) + { + var type = (isStatic) ? CONST.STATIC_BODY : CONST.DYNAMIC_BODY; + + this.world.enableBody(gameObject, type); + + return gameObject; + }, + + /** + * Creates a new Arcade Image object with a Static body. + * + * @method Phaser.Physics.Arcade.Factory#staticImage + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * + * @return {Phaser.Types.Physics.Arcade.ImageWithStaticBody} The Image object that was created. + */ + staticImage: function (x, y, key, frame) + { + var image = new ArcadeImage(this.scene, x, y, key, frame); + + this.sys.displayList.add(image); + + this.world.enableBody(image, CONST.STATIC_BODY); + + return image; + }, + + /** + * Creates a new Arcade Image object with a Dynamic body. + * + * @method Phaser.Physics.Arcade.Factory#image + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * + * @return {Phaser.Types.Physics.Arcade.ImageWithDynamicBody} The Image object that was created. + */ + image: function (x, y, key, frame) + { + var image = new ArcadeImage(this.scene, x, y, key, frame); + + this.sys.displayList.add(image); + + this.world.enableBody(image, CONST.DYNAMIC_BODY); + + return image; + }, + + /** + * Creates a new Arcade Sprite object with a Static body. + * + * @method Phaser.Physics.Arcade.Factory#staticSprite + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * + * @return {Phaser.Types.Physics.Arcade.SpriteWithStaticBody} The Sprite object that was created. + */ + staticSprite: function (x, y, key, frame) + { + var sprite = new ArcadeSprite(this.scene, x, y, key, frame); + + this.sys.displayList.add(sprite); + this.sys.updateList.add(sprite); + + this.world.enableBody(sprite, CONST.STATIC_BODY); + + return sprite; + }, + + /** + * Creates a new Arcade Sprite object with a Dynamic body. + * + * @method Phaser.Physics.Arcade.Factory#sprite + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * + * @return {Phaser.Types.Physics.Arcade.SpriteWithDynamicBody} The Sprite object that was created. + */ + sprite: function (x, y, key, frame) + { + var sprite = new ArcadeSprite(this.scene, x, y, key, frame); + + this.sys.displayList.add(sprite); + this.sys.updateList.add(sprite); + + this.world.enableBody(sprite, CONST.DYNAMIC_BODY); + + return sprite; + }, + + /** + * Creates a Static Physics Group object. + * All Game Objects created by this Group will automatically be static Arcade Physics objects. + * + * @method Phaser.Physics.Arcade.Factory#staticGroup + * @since 3.0.0 + * + * @param {(Phaser.GameObjects.GameObject[]|Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. + * @param {Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} [config] - Settings for this group. + * + * @return {Phaser.Physics.Arcade.StaticGroup} The Static Group object that was created. + */ + staticGroup: function (children, config) + { + return this.sys.updateList.add(new StaticPhysicsGroup(this.world, this.world.scene, children, config)); + }, + + /** + * Creates a Physics Group object. + * All Game Objects created by this Group will automatically be dynamic Arcade Physics objects. + * + * @method Phaser.Physics.Arcade.Factory#group + * @since 3.0.0 + * + * @param {(Phaser.GameObjects.GameObject[]|Phaser.Types.Physics.Arcade.PhysicsGroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. + * @param {Phaser.Types.Physics.Arcade.PhysicsGroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} [config] - Settings for this group. + * + * @return {Phaser.Physics.Arcade.Group} The Group object that was created. + */ + group: function (children, config) + { + return this.sys.updateList.add(new PhysicsGroup(this.world, this.world.scene, children, config)); + }, + + /** + * Creates a new physics Body with the given position and size. + * + * This Body is not associated with any Game Object, but still exists within the world + * and can be tested for collision, have velocity, etc. + * + * @method Phaser.Physics.Arcade.Factory#body + * @since 3.60.0 + * + * @param {number} x - The horizontal position of this Body in the physics world. + * @param {number} y - The vertical position of this Body in the physics world. + * @param {number} [width=64] - The width of the Body in pixels. Cannot be negative or zero. + * @param {number} [height=64] - The height of the Body in pixels. Cannot be negative or zero. + * + * @return {Phaser.Physics.Arcade.Body} The Body that was created. + */ + body: function (x, y, width, height) + { + var body = new Body(this.world); + + body.position.set(x, y); + + if (width && height) + { + body.setSize(width, height); + } + + this.world.add(body, CONST.DYNAMIC_BODY); + + return body; + }, + + /** + * Creates a new static physics Body with the given position and size. + * + * This Body is not associated with any Game Object, but still exists within the world + * and can be tested for collision, etc. + * + * @method Phaser.Physics.Arcade.Factory#staticBody + * @since 3.60.0 + * + * @param {number} x - The horizontal position of this Body in the physics world. + * @param {number} y - The vertical position of this Body in the physics world. + * @param {number} [width=64] - The width of the Body in pixels. Cannot be negative or zero. + * @param {number} [height=64] - The height of the Body in pixels. Cannot be negative or zero. + * + * @return {Phaser.Physics.Arcade.Body} The Body that was created. + */ + staticBody: function (x, y, width, height) + { + var body = new StaticBody(this.world); + + body.position.set(x, y); + + if (width && height) + { + body.setSize(width, height); + } + + this.world.add(body, CONST.STATIC_BODY); + + return body; + }, + + /** + * Destroys this Factory. + * + * @method Phaser.Physics.Arcade.Factory#destroy + * @since 3.5.0 + */ + destroy: function () + { + this.world = null; + this.scene = null; + this.sys = null; + } + +}); + +module.exports = Factory; + + +/***/ }), + +/***/ 75671: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(47401); + +/** + * Calculates and returns the horizontal overlap between two arcade physics bodies and sets their properties + * accordingly, including: `touching.left`, `touching.right`, `touching.none` and `overlapX'. + * + * @function Phaser.Physics.Arcade.GetOverlapX + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - Is this an overlap only check, or part of separation? + * @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding). + * + * @return {number} The amount of overlap. + */ +var GetOverlapX = function (body1, body2, overlapOnly, bias) +{ + var overlap = 0; + var maxOverlap = body1.deltaAbsX() + body2.deltaAbsX() + bias; + + if (body1._dx === 0 && body2._dx === 0) + { + // They overlap but neither of them are moving + body1.embedded = true; + body2.embedded = true; + } + else if (body1._dx > body2._dx) + { + // Body1 is moving right and / or Body2 is moving left + overlap = body1.right - body2.x; + + if ((overlap > maxOverlap && !overlapOnly) || body1.checkCollision.right === false || body2.checkCollision.left === false) + { + overlap = 0; + } + else + { + body1.touching.none = false; + body1.touching.right = true; + + body2.touching.none = false; + body2.touching.left = true; + + if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) + { + body1.blocked.none = false; + body1.blocked.right = true; + } + + if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) + { + body2.blocked.none = false; + body2.blocked.left = true; + } + } + } + else if (body1._dx < body2._dx) + { + // Body1 is moving left and/or Body2 is moving right + overlap = body1.x - body2.width - body2.x; + + if ((-overlap > maxOverlap && !overlapOnly) || body1.checkCollision.left === false || body2.checkCollision.right === false) + { + overlap = 0; + } + else + { + body1.touching.none = false; + body1.touching.left = true; + + body2.touching.none = false; + body2.touching.right = true; + + if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) + { + body1.blocked.none = false; + body1.blocked.left = true; + } + + if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) + { + body2.blocked.none = false; + body2.blocked.right = true; + } + } + } + + // Resets the overlapX to zero if there is no overlap, or to the actual pixel value if there is + body1.overlapX = overlap; + body2.overlapX = overlap; + + return overlap; +}; + +module.exports = GetOverlapX; + + +/***/ }), + +/***/ 66185: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(47401); + +/** + * Calculates and returns the vertical overlap between two arcade physics bodies and sets their properties + * accordingly, including: `touching.up`, `touching.down`, `touching.none` and `overlapY'. + * + * @function Phaser.Physics.Arcade.GetOverlapY + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - Is this an overlap only check, or part of separation? + * @param {number} bias - A value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding). + * + * @return {number} The amount of overlap. + */ +var GetOverlapY = function (body1, body2, overlapOnly, bias) +{ + var overlap = 0; + var maxOverlap = body1.deltaAbsY() + body2.deltaAbsY() + bias; + + if (body1._dy === 0 && body2._dy === 0) + { + // They overlap but neither of them are moving + body1.embedded = true; + body2.embedded = true; + } + else if (body1._dy > body2._dy) + { + // Body1 is moving down and/or Body2 is moving up + overlap = body1.bottom - body2.y; + + if ((overlap > maxOverlap && !overlapOnly) || body1.checkCollision.down === false || body2.checkCollision.up === false) + { + overlap = 0; + } + else + { + body1.touching.none = false; + body1.touching.down = true; + + body2.touching.none = false; + body2.touching.up = true; + + if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) + { + body1.blocked.none = false; + body1.blocked.down = true; + } + + if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) + { + body2.blocked.none = false; + body2.blocked.up = true; + } + } + } + else if (body1._dy < body2._dy) + { + // Body1 is moving up and/or Body2 is moving down + overlap = body1.y - body2.bottom; + + if ((-overlap > maxOverlap && !overlapOnly) || body1.checkCollision.up === false || body2.checkCollision.down === false) + { + overlap = 0; + } + else + { + body1.touching.none = false; + body1.touching.up = true; + + body2.touching.none = false; + body2.touching.down = true; + + if (body2.physicsType === CONST.STATIC_BODY && !overlapOnly) + { + body1.blocked.none = false; + body1.blocked.up = true; + } + + if (body1.physicsType === CONST.STATIC_BODY && !overlapOnly) + { + body2.blocked.none = false; + body2.blocked.down = true; + } + } + } + + // Resets the overlapY to zero if there is no overlap, or to the actual pixel value if there is + body1.overlapY = overlap; + body2.overlapY = overlap; + + return overlap; +}; + +module.exports = GetOverlapY; + + +/***/ }), + +/***/ 10481: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var ArcadeSprite = __webpack_require__(25084); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(47401); +var GetFastValue = __webpack_require__(72632); +var Group = __webpack_require__(59192); +var IsPlainObject = __webpack_require__(42911); + +/** + * @classdesc + * An Arcade Physics Group object. + * + * The primary use of a Physics Group is a way to collect together physics enable objects + * that share the same intrinsic structure into a single pool. They can they be easily + * compared against other Groups, or Game Objects. + * + * All Game Objects created by, or added to this Group will automatically be given **dynamic** + * Arcade Physics bodies (if they have no body already) and the bodies will receive the + * Groups {@link Phaser.Physics.Arcade.Group#defaults default values}. + * + * You should not pass objects into this Group that should not receive a body. For example, + * do not add basic Geometry or Tilemap Layers into a Group, as they will not behave in the + * way you may expect. Groups should all ideally have objects of the same type in them. + * + * If you wish to create a Group filled with Static Bodies, please see {@link Phaser.Physics.Arcade.StaticGroup}. + * + * @class Group + * @extends Phaser.GameObjects.Group + * @memberof Phaser.Physics.Arcade + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.World} world - The physics simulation. + * @param {Phaser.Scene} scene - The scene this group belongs to. + * @param {(Phaser.GameObjects.GameObject[]|Phaser.Types.Physics.Arcade.PhysicsGroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. + * @param {Phaser.Types.Physics.Arcade.PhysicsGroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} [config] - Settings for this group. + */ +var PhysicsGroup = new Class({ + + Extends: Group, + + initialize: + + function PhysicsGroup (world, scene, children, config) + { + if (!children && !config) + { + config = { + internalCreateCallback: this.createCallbackHandler, + internalRemoveCallback: this.removeCallbackHandler + }; + } + else if (IsPlainObject(children)) + { + // children is a plain object, so swizzle them: + config = children; + children = null; + + config.internalCreateCallback = this.createCallbackHandler; + config.internalRemoveCallback = this.removeCallbackHandler; + } + else if (Array.isArray(children) && IsPlainObject(children[0])) + { + // children is an array of plain objects (i.e., configs) + config = children[0]; + + var _this = this; + + children.forEach(function (singleConfig) + { + singleConfig.internalCreateCallback = _this.createCallbackHandler; + singleConfig.internalRemoveCallback = _this.removeCallbackHandler; + }); + + children = null; + } + else + { + // config is not defined and children is not a plain object nor an array of plain objects + config = { + internalCreateCallback: this.createCallbackHandler, + internalRemoveCallback: this.removeCallbackHandler + }; + } + + /** + * The physics simulation. + * + * @name Phaser.Physics.Arcade.Group#world + * @type {Phaser.Physics.Arcade.World} + * @since 3.0.0 + */ + this.world = world; + + /** + * The class to create new Group members from. + * + * This should be either `Phaser.Physics.Arcade.Image`, `Phaser.Physics.Arcade.Sprite`, or a class extending one of those. + * + * @name Phaser.Physics.Arcade.Group#classType + * @type {function} + * @default ArcadeSprite + * @since 3.0.0 + * @see Phaser.Types.GameObjects.Group.GroupClassTypeConstructor + */ + config.classType = GetFastValue(config, 'classType', ArcadeSprite); + + /** + * The physics type of the Group's members. + * + * @name Phaser.Physics.Arcade.Group#physicsType + * @type {number} + * @default Phaser.Physics.Arcade.DYNAMIC_BODY + * @since 3.0.0 + */ + this.physicsType = CONST.DYNAMIC_BODY; + + /** + * Default physics properties applied to Game Objects added to the Group or created by the Group. Derived from the `config` argument. + * + * You can remove the default values by setting this property to `{}`. + * + * @name Phaser.Physics.Arcade.Group#defaults + * @type {Phaser.Types.Physics.Arcade.PhysicsGroupDefaults} + * @since 3.0.0 + */ + this.defaults = { + setCollideWorldBounds: GetFastValue(config, 'collideWorldBounds', false), + setBoundsRectangle: GetFastValue(config, 'customBoundsRectangle', null), + setAccelerationX: GetFastValue(config, 'accelerationX', 0), + setAccelerationY: GetFastValue(config, 'accelerationY', 0), + setAllowDrag: GetFastValue(config, 'allowDrag', true), + setAllowGravity: GetFastValue(config, 'allowGravity', true), + setAllowRotation: GetFastValue(config, 'allowRotation', true), + setDamping: GetFastValue(config, 'useDamping', false), + setBounceX: GetFastValue(config, 'bounceX', 0), + setBounceY: GetFastValue(config, 'bounceY', 0), + setDragX: GetFastValue(config, 'dragX', 0), + setDragY: GetFastValue(config, 'dragY', 0), + setEnable: GetFastValue(config, 'enable', true), + setGravityX: GetFastValue(config, 'gravityX', 0), + setGravityY: GetFastValue(config, 'gravityY', 0), + setFrictionX: GetFastValue(config, 'frictionX', 0), + setFrictionY: GetFastValue(config, 'frictionY', 0), + setMaxSpeed: GetFastValue(config, 'maxSpeed', -1), + setMaxVelocityX: GetFastValue(config, 'maxVelocityX', 10000), + setMaxVelocityY: GetFastValue(config, 'maxVelocityY', 10000), + setVelocityX: GetFastValue(config, 'velocityX', 0), + setVelocityY: GetFastValue(config, 'velocityY', 0), + setAngularVelocity: GetFastValue(config, 'angularVelocity', 0), + setAngularAcceleration: GetFastValue(config, 'angularAcceleration', 0), + setAngularDrag: GetFastValue(config, 'angularDrag', 0), + setMass: GetFastValue(config, 'mass', 1), + setImmovable: GetFastValue(config, 'immovable', false) + }; + + Group.call(this, scene, children, config); + + /** + * A textual representation of this Game Object. + * Used internally by Phaser but is available for your own custom classes to populate. + * + * @name Phaser.Physics.Arcade.Group#type + * @type {string} + * @default 'PhysicsGroup' + * @since 3.21.0 + */ + this.type = 'PhysicsGroup'; + }, + + /** + * Enables a Game Object's Body and assigns `defaults`. Called when a Group member is added or created. + * + * @method Phaser.Physics.Arcade.Group#createCallbackHandler + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} child - The Game Object being added. + */ + createCallbackHandler: function (child) + { + if (!child.body) + { + this.world.enableBody(child, CONST.DYNAMIC_BODY); + } + + var body = child.body; + + for (var key in this.defaults) + { + body[key](this.defaults[key]); + } + }, + + /** + * Disables a Game Object's Body. Called when a Group member is removed. + * + * @method Phaser.Physics.Arcade.Group#removeCallbackHandler + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} child - The Game Object being removed. + */ + removeCallbackHandler: function (child) + { + if (child.body) + { + this.world.disableBody(child); + } + }, + + /** + * Sets the velocity of each Group member. + * + * @method Phaser.Physics.Arcade.Group#setVelocity + * @since 3.0.0 + * + * @param {number} x - The horizontal velocity. + * @param {number} y - The vertical velocity. + * @param {number} [step=0] - The velocity increment. When set, the first member receives velocity (x, y), the second (x + step, y + step), and so on. + * + * @return {Phaser.Physics.Arcade.Group} This Physics Group object. + */ + setVelocity: function (x, y, step) + { + if (step === undefined) { step = 0; } + + var items = this.getChildren(); + + for (var i = 0; i < items.length; i++) + { + items[i].body.velocity.set(x + (i * step), y + (i * step)); + } + + return this; + }, + + /** + * Sets the horizontal velocity of each Group member. + * + * @method Phaser.Physics.Arcade.Group#setVelocityX + * @since 3.0.0 + * + * @param {number} value - The velocity value. + * @param {number} [step=0] - The velocity increment. When set, the first member receives velocity (x), the second (x + step), and so on. + * + * @return {Phaser.Physics.Arcade.Group} This Physics Group object. + */ + setVelocityX: function (value, step) + { + if (step === undefined) { step = 0; } + + var items = this.getChildren(); + + for (var i = 0; i < items.length; i++) + { + items[i].body.velocity.x = value + (i * step); + } + + return this; + }, + + /** + * Sets the vertical velocity of each Group member. + * + * @method Phaser.Physics.Arcade.Group#setVelocityY + * @since 3.0.0 + * + * @param {number} value - The velocity value. + * @param {number} [step=0] - The velocity increment. When set, the first member receives velocity (y), the second (y + step), and so on. + * + * @return {Phaser.Physics.Arcade.Group} This Physics Group object. + */ + setVelocityY: function (value, step) + { + if (step === undefined) { step = 0; } + + var items = this.getChildren(); + + for (var i = 0; i < items.length; i++) + { + items[i].body.velocity.y = value + (i * step); + } + + return this; + } + +}); + +module.exports = PhysicsGroup; + + +/***/ }), + +/***/ 22916: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var body1; +var body2; +var body1Pushable; +var body2Pushable; +var body1MassImpact; +var body2MassImpact; +var body1FullImpact; +var body2FullImpact; +var body1MovingLeft; +var body1MovingRight; +var body1Stationary; +var body2MovingLeft; +var body2MovingRight; +var body2Stationary; +var body1OnLeft; +var body2OnLeft; +var overlap; + +/** + * Sets all of the local processing values and calculates the velocity exchanges. + * + * Then runs `BlockCheck` and returns the value from it. + * + * This method is called by `Phaser.Physics.Arcade.SeparateX` and should not be + * called directly. + * + * @function Phaser.Physics.Arcade.ProcessX.Set + * @ignore + * @since 3.50.0 + * + * @param {Phaser.Physics.Arcade.Body} b1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} b2 - The second Body to separate. + * @param {number} ov - The overlap value. + * + * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + */ +var Set = function (b1, b2, ov) +{ + body1 = b1; + body2 = b2; + + var v1 = body1.velocity.x; + var v2 = body2.velocity.x; + + body1Pushable = body1.pushable; + body1MovingLeft = body1._dx < 0; + body1MovingRight = body1._dx > 0; + body1Stationary = body1._dx === 0; + body1OnLeft = Math.abs(body1.right - body2.x) <= Math.abs(body2.right - body1.x); + body1FullImpact = v2 - v1 * body1.bounce.x; + + body2Pushable = body2.pushable; + body2MovingLeft = body2._dx < 0; + body2MovingRight = body2._dx > 0; + body2Stationary = body2._dx === 0; + body2OnLeft = !body1OnLeft; + body2FullImpact = v1 - v2 * body2.bounce.x; + + // negative delta = up, positive delta = down (inc. gravity) + overlap = Math.abs(ov); + + return BlockCheck(); +}; + +/** + * Blocked Direction checks, because it doesn't matter if an object can be pushed + * or not, blocked is blocked. + * + * @function Phaser.Physics.Arcade.ProcessX.BlockCheck + * @ignore + * @since 3.50.0 + * + * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + */ +var BlockCheck = function () +{ + // Body1 is moving right and Body2 is blocked from going right any further + if (body1MovingRight && body1OnLeft && body2.blocked.right) + { + body1.processX(-overlap, body1FullImpact, false, true); + + return 1; + } + + // Body1 is moving up and Body2 is blocked from going up any further + if (body1MovingLeft && body2OnLeft && body2.blocked.left) + { + body1.processX(overlap, body1FullImpact, true); + + return 1; + } + + // Body2 is moving right and Body1 is blocked from going right any further + if (body2MovingRight && body2OnLeft && body1.blocked.right) + { + body2.processX(-overlap, body2FullImpact, false, true); + + return 2; + } + + // Body2 is moving up and Body1 is blocked from going up any further + if (body2MovingLeft && body1OnLeft && body1.blocked.left) + { + body2.processX(overlap, body2FullImpact, true); + + return 2; + } + + return 0; +}; + +/** + * The main check function. Runs through one of the four possible tests and returns the results. + * + * @function Phaser.Physics.Arcade.ProcessX.Check + * @ignore + * @since 3.50.0 + * + * @return {boolean} `true` if a check passed, otherwise `false`. + */ +var Check = function () +{ + var v1 = body1.velocity.x; + var v2 = body2.velocity.x; + + var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); + var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); + var avg = (nv1 + nv2) * 0.5; + + nv1 -= avg; + nv2 -= avg; + + body1MassImpact = avg + nv1 * body1.bounce.x; + body2MassImpact = avg + nv2 * body2.bounce.x; + + // Body1 hits Body2 on the right hand side + if (body1MovingLeft && body2OnLeft) + { + return Run(0); + } + + // Body2 hits Body1 on the right hand side + if (body2MovingLeft && body1OnLeft) + { + return Run(1); + } + + // Body1 hits Body2 on the left hand side + if (body1MovingRight && body1OnLeft) + { + return Run(2); + } + + // Body2 hits Body1 on the left hand side + if (body2MovingRight && body2OnLeft) + { + return Run(3); + } + + return false; +}; + +/** + * The main check function. Runs through one of the four possible tests and returns the results. + * + * @function Phaser.Physics.Arcade.ProcessX.Run + * @ignore + * @since 3.50.0 + * + * @param {number} side - The side to test. As passed in by the `Check` function. + * + * @return {boolean} Always returns `true`. + */ +var Run = function (side) +{ + if (body1Pushable && body2Pushable) + { + // Both pushable, or both moving at the same time, so equal rebound + overlap *= 0.5; + + if (side === 0 || side === 3) + { + // body1MovingLeft && body2OnLeft + // body2MovingRight && body2OnLeft + body1.processX(overlap, body1MassImpact); + body2.processX(-overlap, body2MassImpact); + } + else + { + // body2MovingLeft && body1OnLeft + // body1MovingRight && body1OnLeft + body1.processX(-overlap, body1MassImpact); + body2.processX(overlap, body2MassImpact); + } + } + else if (body1Pushable && !body2Pushable) + { + // Body1 pushable, Body2 not + + if (side === 0 || side === 3) + { + // body1MovingLeft && body2OnLeft + // body2MovingRight && body2OnLeft + body1.processX(overlap, body1FullImpact, true); + } + else + { + // body2MovingLeft && body1OnLeft + // body1MovingRight && body1OnLeft + body1.processX(-overlap, body1FullImpact, false, true); + } + } + else if (!body1Pushable && body2Pushable) + { + // Body2 pushable, Body1 not + + if (side === 0 || side === 3) + { + // body1MovingLeft && body2OnLeft + // body2MovingRight && body2OnLeft + body2.processX(-overlap, body2FullImpact, false, true); + } + else + { + // body2MovingLeft && body1OnLeft + // body1MovingRight && body1OnLeft + body2.processX(overlap, body2FullImpact, true); + } + } + else + { + // Neither body is pushable, so base it on movement + + var halfOverlap = overlap * 0.5; + + if (side === 0) + { + // body1MovingLeft && body2OnLeft + + if (body2Stationary) + { + body1.processX(overlap, 0, true); + body2.processX(0, null, false, true); + } + else if (body2MovingRight) + { + body1.processX(halfOverlap, 0, true); + body2.processX(-halfOverlap, 0, false, true); + } + else + { + // Body2 moving same direction as Body1 + body1.processX(halfOverlap, body2.velocity.x, true); + body2.processX(-halfOverlap, null, false, true); + } + } + else if (side === 1) + { + // body2MovingLeft && body1OnLeft + + if (body1Stationary) + { + body1.processX(0, null, false, true); + body2.processX(overlap, 0, true); + } + else if (body1MovingRight) + { + body1.processX(-halfOverlap, 0, false, true); + body2.processX(halfOverlap, 0, true); + } + else + { + // Body1 moving same direction as Body2 + body1.processX(-halfOverlap, null, false, true); + body2.processX(halfOverlap, body1.velocity.x, true); + } + } + else if (side === 2) + { + // body1MovingRight && body1OnLeft + + if (body2Stationary) + { + body1.processX(-overlap, 0, false, true); + body2.processX(0, null, true); + } + else if (body2MovingLeft) + { + body1.processX(-halfOverlap, 0, false, true); + body2.processX(halfOverlap, 0, true); + } + else + { + // Body2 moving same direction as Body1 + body1.processX(-halfOverlap, body2.velocity.x, false, true); + body2.processX(halfOverlap, null, true); + } + } + else if (side === 3) + { + // body2MovingRight && body2OnLeft + + if (body1Stationary) + { + body1.processX(0, null, true); + body2.processX(-overlap, 0, false, true); + } + else if (body1MovingLeft) + { + body1.processX(halfOverlap, 0, true); + body2.processX(-halfOverlap, 0, false, true); + } + else + { + // Body1 moving same direction as Body2 + body1.processX(halfOverlap, body2.velocity.y, true); + body2.processX(-halfOverlap, null, false, true); + } + } + } + + return true; +}; + +/** + * This function is run when Body1 is Immovable and Body2 is not. + * + * @function Phaser.Physics.Arcade.ProcessX.RunImmovableBody1 + * @ignore + * @since 3.50.0 + * + * @param {number} blockedState - The block state value. + */ +var RunImmovableBody1 = function (blockedState) +{ + if (blockedState === 1) + { + // But Body2 cannot go anywhere either, so we cancel out velocity + // Separation happened in the block check + body2.velocity.x = 0; + } + else if (body1OnLeft) + { + body2.processX(overlap, body2FullImpact, true); + } + else + { + body2.processX(-overlap, body2FullImpact, false, true); + } + + // This is special case code that handles things like vertically moving platforms you can ride + if (body1.moves) + { + body2.y += (body1.y - body1.prev.y) * body1.friction.y; + body2._dy = body2.y - body2.prev.y; + } +}; + +/** + * This function is run when Body2 is Immovable and Body1 is not. + * + * @function Phaser.Physics.Arcade.ProcessX.RunImmovableBody2 + * @ignore + * @since 3.50.0 + * + * @param {number} blockedState - The block state value. + */ +var RunImmovableBody2 = function (blockedState) +{ + if (blockedState === 2) + { + // But Body1 cannot go anywhere either, so we cancel out velocity + // Separation happened in the block check + body1.velocity.x = 0; + } + else if (body2OnLeft) + { + body1.processX(overlap, body1FullImpact, true); + } + else + { + body1.processX(-overlap, body1FullImpact, false, true); + } + + // This is special case code that handles things like vertically moving platforms you can ride + if (body2.moves) + { + body1.y += (body2.y - body2.prev.y) * body2.friction.y; + body1._dy = body1.y - body1.prev.y; + } +}; + +/** + * @namespace Phaser.Physics.Arcade.ProcessX + * @ignore + */ + +module.exports = { + BlockCheck: BlockCheck, + Check: Check, + Set: Set, + Run: Run, + RunImmovableBody1: RunImmovableBody1, + RunImmovableBody2: RunImmovableBody2 +}; + + +/***/ }), + +/***/ 67050: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var body1; +var body2; +var body1Pushable; +var body2Pushable; +var body1MassImpact; +var body2MassImpact; +var body1FullImpact; +var body2FullImpact; +var body1MovingUp; +var body1MovingDown; +var body1Stationary; +var body2MovingUp; +var body2MovingDown; +var body2Stationary; +var body1OnTop; +var body2OnTop; +var overlap; + +/** + * Sets all of the local processing values and calculates the velocity exchanges. + * + * Then runs `BlockCheck` and returns the value from it. + * + * This method is called by `Phaser.Physics.Arcade.SeparateY` and should not be + * called directly. + * + * @function Phaser.Physics.Arcade.ProcessY.Set + * @ignore + * @since 3.50.0 + * + * @param {Phaser.Physics.Arcade.Body} b1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} b2 - The second Body to separate. + * @param {number} ov - The overlap value. + * + * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + */ +var Set = function (b1, b2, ov) +{ + body1 = b1; + body2 = b2; + + var v1 = body1.velocity.y; + var v2 = body2.velocity.y; + + body1Pushable = body1.pushable; + body1MovingUp = body1._dy < 0; + body1MovingDown = body1._dy > 0; + body1Stationary = body1._dy === 0; + body1OnTop = Math.abs(body1.bottom - body2.y) <= Math.abs(body2.bottom - body1.y); + body1FullImpact = v2 - v1 * body1.bounce.y; + + body2Pushable = body2.pushable; + body2MovingUp = body2._dy < 0; + body2MovingDown = body2._dy > 0; + body2Stationary = body2._dy === 0; + body2OnTop = !body1OnTop; + body2FullImpact = v1 - v2 * body2.bounce.y; + + // negative delta = up, positive delta = down (inc. gravity) + overlap = Math.abs(ov); + + return BlockCheck(); +}; + +/** + * Blocked Direction checks, because it doesn't matter if an object can be pushed + * or not, blocked is blocked. + * + * @function Phaser.Physics.Arcade.ProcessY.BlockCheck + * @ignore + * @since 3.50.0 + * + * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + */ +var BlockCheck = function () +{ + // Body1 is moving down and Body2 is blocked from going down any further + if (body1MovingDown && body1OnTop && body2.blocked.down) + { + body1.processY(-overlap, body1FullImpact, false, true); + + return 1; + } + + // Body1 is moving up and Body2 is blocked from going up any further + if (body1MovingUp && body2OnTop && body2.blocked.up) + { + body1.processY(overlap, body1FullImpact, true); + + return 1; + } + + // Body2 is moving down and Body1 is blocked from going down any further + if (body2MovingDown && body2OnTop && body1.blocked.down) + { + body2.processY(-overlap, body2FullImpact, false, true); + + return 2; + } + + // Body2 is moving up and Body1 is blocked from going up any further + if (body2MovingUp && body1OnTop && body1.blocked.up) + { + body2.processY(overlap, body2FullImpact, true); + + return 2; + } + + return 0; +}; + +/** + * The main check function. Runs through one of the four possible tests and returns the results. + * + * @function Phaser.Physics.Arcade.ProcessY.Check + * @ignore + * @since 3.50.0 + * + * @return {boolean} `true` if a check passed, otherwise `false`. + */ +var Check = function () +{ + var v1 = body1.velocity.y; + var v2 = body2.velocity.y; + + var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); + var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); + var avg = (nv1 + nv2) * 0.5; + + nv1 -= avg; + nv2 -= avg; + + body1MassImpact = avg + nv1 * body1.bounce.y; + body2MassImpact = avg + nv2 * body2.bounce.y; + + // Body1 hits Body2 on the bottom side + if (body1MovingUp && body2OnTop) + { + return Run(0); + } + + // Body2 hits Body1 on the bottom side + if (body2MovingUp && body1OnTop) + { + return Run(1); + } + + // Body1 hits Body2 on the top side + if (body1MovingDown && body1OnTop) + { + return Run(2); + } + + // Body2 hits Body1 on the top side + if (body2MovingDown && body2OnTop) + { + return Run(3); + } + + return false; +}; + +/** + * The main check function. Runs through one of the four possible tests and returns the results. + * + * @function Phaser.Physics.Arcade.ProcessY.Run + * @ignore + * @since 3.50.0 + * + * @param {number} side - The side to test. As passed in by the `Check` function. + * + * @return {boolean} Always returns `true`. + */ +var Run = function (side) +{ + if (body1Pushable && body2Pushable) + { + // Both pushable, or both moving at the same time, so equal rebound + overlap *= 0.5; + + if (side === 0 || side === 3) + { + // body1MovingUp && body2OnTop + // body2MovingDown && body2OnTop + body1.processY(overlap, body1MassImpact); + body2.processY(-overlap, body2MassImpact); + } + else + { + // body2MovingUp && body1OnTop + // body1MovingDown && body1OnTop + body1.processY(-overlap, body1MassImpact); + body2.processY(overlap, body2MassImpact); + } + } + else if (body1Pushable && !body2Pushable) + { + // Body1 pushable, Body2 not + + if (side === 0 || side === 3) + { + // body1MovingUp && body2OnTop + // body2MovingDown && body2OnTop + body1.processY(overlap, body1FullImpact, true); + } + else + { + // body2MovingUp && body1OnTop + // body1MovingDown && body1OnTop + body1.processY(-overlap, body1FullImpact, false, true); + } + } + else if (!body1Pushable && body2Pushable) + { + // Body2 pushable, Body1 not + + if (side === 0 || side === 3) + { + // body1MovingUp && body2OnTop + // body2MovingDown && body2OnTop + body2.processY(-overlap, body2FullImpact, false, true); + } + else + { + // body2MovingUp && body1OnTop + // body1MovingDown && body1OnTop + body2.processY(overlap, body2FullImpact, true); + } + } + else + { + // Neither body is pushable, so base it on movement + + var halfOverlap = overlap * 0.5; + + if (side === 0) + { + // body1MovingUp && body2OnTop + + if (body2Stationary) + { + body1.processY(overlap, 0, true); + body2.processY(0, null, false, true); + } + else if (body2MovingDown) + { + body1.processY(halfOverlap, 0, true); + body2.processY(-halfOverlap, 0, false, true); + } + else + { + // Body2 moving same direction as Body1 + body1.processY(halfOverlap, body2.velocity.y, true); + body2.processY(-halfOverlap, null, false, true); + } + } + else if (side === 1) + { + // body2MovingUp && body1OnTop + + if (body1Stationary) + { + body1.processY(0, null, false, true); + body2.processY(overlap, 0, true); + } + else if (body1MovingDown) + { + body1.processY(-halfOverlap, 0, false, true); + body2.processY(halfOverlap, 0, true); + } + else + { + // Body1 moving same direction as Body2 + body1.processY(-halfOverlap, null, false, true); + body2.processY(halfOverlap, body1.velocity.y, true); + } + } + else if (side === 2) + { + // body1MovingDown && body1OnTop + + if (body2Stationary) + { + body1.processY(-overlap, 0, false, true); + body2.processY(0, null, true); + } + else if (body2MovingUp) + { + body1.processY(-halfOverlap, 0, false, true); + body2.processY(halfOverlap, 0, true); + } + else + { + // Body2 moving same direction as Body1 + body1.processY(-halfOverlap, body2.velocity.y, false, true); + body2.processY(halfOverlap, null, true); + } + } + else if (side === 3) + { + // body2MovingDown && body2OnTop + + if (body1Stationary) + { + body1.processY(0, null, true); + body2.processY(-overlap, 0, false, true); + } + else if (body1MovingUp) + { + body1.processY(halfOverlap, 0, true); + body2.processY(-halfOverlap, 0, false, true); + } + else + { + // Body1 moving same direction as Body2 + body1.processY(halfOverlap, body2.velocity.y, true); + body2.processY(-halfOverlap, null, false, true); + } + } + } + + return true; +}; + +/** + * This function is run when Body1 is Immovable and Body2 is not. + * + * @function Phaser.Physics.Arcade.ProcessY.RunImmovableBody1 + * @ignore + * @since 3.50.0 + * + * @param {number} blockedState - The block state value. + */ +var RunImmovableBody1 = function (blockedState) +{ + if (blockedState === 1) + { + // But Body2 cannot go anywhere either, so we cancel out velocity + // Separation happened in the block check + body2.velocity.y = 0; + } + else if (body1OnTop) + { + body2.processY(overlap, body2FullImpact, true); + } + else + { + body2.processY(-overlap, body2FullImpact, false, true); + } + + // This is special case code that handles things like horizontally moving platforms you can ride + if (body1.moves) + { + body2.x += (body1.x - body1.prev.x) * body1.friction.x; + body2._dx = body2.x - body2.prev.x; + } +}; + +/** + * This function is run when Body2 is Immovable and Body1 is not. + * + * @function Phaser.Physics.Arcade.ProcessY.RunImmovableBody2 + * @ignore + * @since 3.50.0 + * + * @param {number} blockedState - The block state value. + */ +var RunImmovableBody2 = function (blockedState) +{ + if (blockedState === 2) + { + // But Body1 cannot go anywhere either, so we cancel out velocity + // Separation happened in the block check + body1.velocity.y = 0; + } + else if (body2OnTop) + { + body1.processY(overlap, body1FullImpact, true); + } + else + { + body1.processY(-overlap, body1FullImpact, false, true); + } + + // This is special case code that handles things like horizontally moving platforms you can ride + if (body2.moves) + { + body1.x += (body2.x - body2.prev.x) * body2.friction.x; + body1._dx = body1.x - body1.prev.x; + } +}; + +/** + * @namespace Phaser.Physics.Arcade.ProcessY + * @ignore + */ + +module.exports = { + BlockCheck: BlockCheck, + Check: Check, + Set: Set, + Run: Run, + RunImmovableBody1: RunImmovableBody1, + RunImmovableBody2: RunImmovableBody2 +}; + + +/***/ }), + +/***/ 61777: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetOverlapX = __webpack_require__(75671); +var ProcessX = __webpack_require__(22916); + +/** + * Separates two overlapping bodies on the X-axis (horizontally). + * + * Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection. + * + * The bodies won't be separated if there is no horizontal overlap between them, if they are static, or if either one uses custom logic for its separation. + * + * @function Phaser.Physics.Arcade.SeparateX + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. + * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. + * @param {number} [overlap] - If given then this value will be used as the overlap and no check will be run. + * + * @return {boolean} `true` if the two bodies overlap vertically, otherwise `false`. + */ +var SeparateX = function (body1, body2, overlapOnly, bias, overlap) +{ + if (overlap === undefined) { overlap = GetOverlapX(body1, body2, overlapOnly, bias); } + + var body1Immovable = body1.immovable; + var body2Immovable = body2.immovable; + + // Can't separate two immovable bodies, or a body with its own custom separation logic + if (overlapOnly || overlap === 0 || (body1Immovable && body2Immovable) || body1.customSeparateX || body2.customSeparateX) + { + // return true if there was some overlap, otherwise false + return (overlap !== 0) || (body1.embedded && body2.embedded); + } + + var blockedState = ProcessX.Set(body1, body2, overlap); + + if (!body1Immovable && !body2Immovable) + { + if (blockedState > 0) + { + return true; + } + + return ProcessX.Check(); + } + else if (body1Immovable) + { + ProcessX.RunImmovableBody1(blockedState); + } + else if (body2Immovable) + { + ProcessX.RunImmovableBody2(blockedState); + } + + // If we got this far then there WAS overlap, and separation is complete, so return true + return true; +}; + +module.exports = SeparateX; + + +/***/ }), + +/***/ 25299: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetOverlapY = __webpack_require__(66185); +var ProcessY = __webpack_require__(67050); + +/** + * Separates two overlapping bodies on the Y-axis (vertically). + * + * Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection. + * + * The bodies won't be separated if there is no vertical overlap between them, if they are static, or if either one uses custom logic for its separation. + * + * @function Phaser.Physics.Arcade.SeparateY + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to separate. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to separate. + * @param {boolean} overlapOnly - If `true`, the bodies will only have their overlap data set and no separation will take place. + * @param {number} bias - A value to add to the delta value during overlap checking. Used to prevent sprite tunneling. + * @param {number} [overlap] - If given then this value will be used as the overlap and no check will be run. + * + * @return {boolean} `true` if the two bodies overlap vertically, otherwise `false`. + */ +var SeparateY = function (body1, body2, overlapOnly, bias, overlap) +{ + if (overlap === undefined) { overlap = GetOverlapY(body1, body2, overlapOnly, bias); } + + var body1Immovable = body1.immovable; + var body2Immovable = body2.immovable; + + // Can't separate two immovable bodies, or a body with its own custom separation logic + if (overlapOnly || overlap === 0 || (body1Immovable && body2Immovable) || body1.customSeparateY || body2.customSeparateY) + { + // return true if there was some overlap, otherwise false + return (overlap !== 0) || (body1.embedded && body2.embedded); + } + + var blockedState = ProcessY.Set(body1, body2, overlap); + + if (!body1Immovable && !body2Immovable) + { + if (blockedState > 0) + { + return true; + } + + return ProcessY.Check(); + } + else if (body1Immovable) + { + ProcessY.RunImmovableBody1(blockedState); + } + else if (body2Immovable) + { + ProcessY.RunImmovableBody2(blockedState); + } + + // If we got this far then there WAS overlap, and separation is complete, so return true + return true; +}; + +module.exports = SeparateY; + + +/***/ }), + +/***/ 66634: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CircleContains = __webpack_require__(65650); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(47401); +var RectangleContains = __webpack_require__(94287); +var Vector2 = __webpack_require__(93736); + +/** + * @classdesc + * A Static Arcade Physics Body. + * + * A Static Body never moves, and isn't automatically synchronized with its parent Game Object. + * That means if you make any change to the parent's origin, position, or scale after creating or adding the body, you'll need to update the Static Body manually. + * + * A Static Body can collide with other Bodies, but is never moved by collisions. + * + * Its dynamic counterpart is {@link Phaser.Physics.Arcade.Body}. + * + * @class StaticBody + * @memberof Phaser.Physics.Arcade + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.World} world - The Arcade Physics simulation this Static Body belongs to. + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object this Body belongs to. As of Phaser 3.60 this is now optional. + */ +var StaticBody = new Class({ + + initialize: + + function StaticBody (world, gameObject) + { + var width = 64; + var height = 64; + + var dummyGameObject = { + x: 0, + y: 0, + angle: 0, + rotation: 0, + scaleX: 1, + scaleY: 1, + displayOriginX: 0, + displayOriginY: 0 + }; + + var hasGameObject = (gameObject !== undefined); + + if (hasGameObject && gameObject.displayWidth) + { + width = gameObject.displayWidth; + height = gameObject.displayHeight; + } + + if (!hasGameObject) + { + gameObject = dummyGameObject; + } + + /** + * The Arcade Physics simulation this Static Body belongs to. + * + * @name Phaser.Physics.Arcade.StaticBody#world + * @type {Phaser.Physics.Arcade.World} + * @since 3.0.0 + */ + this.world = world; + + /** + * The Game Object this Static Body belongs to. + * + * As of Phaser 3.60 this is now optional and can be undefined. + * + * @name Phaser.Physics.Arcade.StaticBody#gameObject + * @type {Phaser.GameObjects.GameObject} + * @since 3.0.0 + */ + this.gameObject = (hasGameObject) ? gameObject : undefined; + + + /** + * A quick-test flag that signifies this is a Body, used in the World collision handler. + * + * @name Phaser.Physics.Arcade.StaticBody#isBody + * @type {boolean} + * @readonly + * @since 3.60.0 + */ + this.isBody = true; + + /** + * Whether the Static Body's boundary is drawn to the debug display. + * + * @name Phaser.Physics.Arcade.StaticBody#debugShowBody + * @type {boolean} + * @since 3.0.0 + */ + this.debugShowBody = world.defaults.debugShowStaticBody; + + /** + * The color of this Static Body on the debug display. + * + * @name Phaser.Physics.Arcade.StaticBody#debugBodyColor + * @type {number} + * @since 3.0.0 + */ + this.debugBodyColor = world.defaults.staticBodyDebugColor; + + /** + * Whether this Static Body is updated by the physics simulation. + * + * @name Phaser.Physics.Arcade.StaticBody#enable + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.enable = true; + + /** + * Whether this Static Body's boundary is circular (`true`) or rectangular (`false`). + * + * @name Phaser.Physics.Arcade.StaticBody#isCircle + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.isCircle = false; + + /** + * If this Static Body is circular, this is the radius of the boundary, as set by {@link Phaser.Physics.Arcade.StaticBody#setCircle}, in pixels. + * Equal to `halfWidth`. + * + * @name Phaser.Physics.Arcade.StaticBody#radius + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.radius = 0; + + /** + * The offset set by {@link Phaser.Physics.Arcade.StaticBody#setCircle} or {@link Phaser.Physics.Arcade.StaticBody#setSize}. + * + * This doesn't affect the Static Body's position, because a Static Body does not follow its Game Object. + * + * @name Phaser.Physics.Arcade.StaticBody#offset + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.0.0 + */ + this.offset = new Vector2(); + + /** + * The position of this Static Body within the simulation. + * + * @name Phaser.Physics.Arcade.StaticBody#position + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.position = new Vector2(gameObject.x - (width * gameObject.originX), gameObject.y - (height * gameObject.originY)); + + /** + * The width of the Static Body's boundary, in pixels. + * If the Static Body is circular, this is also the Static Body's diameter. + * + * @name Phaser.Physics.Arcade.StaticBody#width + * @type {number} + * @since 3.0.0 + */ + this.width = width; + + /** + * The height of the Static Body's boundary, in pixels. + * If the Static Body is circular, this is also the Static Body's diameter. + * + * @name Phaser.Physics.Arcade.StaticBody#height + * @type {number} + * @since 3.0.0 + */ + this.height = height; + + /** + * Half the Static Body's width, in pixels. + * If the Static Body is circular, this is also the Static Body's radius. + * + * @name Phaser.Physics.Arcade.StaticBody#halfWidth + * @type {number} + * @since 3.0.0 + */ + this.halfWidth = Math.abs(this.width / 2); + + /** + * Half the Static Body's height, in pixels. + * If the Static Body is circular, this is also the Static Body's radius. + * + * @name Phaser.Physics.Arcade.StaticBody#halfHeight + * @type {number} + * @since 3.0.0 + */ + this.halfHeight = Math.abs(this.height / 2); + + /** + * The center of the Static Body's boundary. + * This is the midpoint of its `position` (top-left corner) and its bottom-right corner. + * + * @name Phaser.Physics.Arcade.StaticBody#center + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.center = new Vector2(this.position.x + this.halfWidth, this.position.y + this.halfHeight); + + /** + * A constant zero velocity used by the Arcade Physics simulation for calculations. + * + * @name Phaser.Physics.Arcade.StaticBody#velocity + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.0.0 + */ + this.velocity = Vector2.ZERO; + + /** + * A constant `false` value expected by the Arcade Physics simulation. + * + * @name Phaser.Physics.Arcade.StaticBody#allowGravity + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.allowGravity = false; + + /** + * Gravitational force applied specifically to this Body. Values are in pixels per second squared. Always zero for a Static Body. + * + * @name Phaser.Physics.Arcade.StaticBody#gravity + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.0.0 + */ + this.gravity = Vector2.ZERO; + + /** + * Rebound, or restitution, following a collision, relative to 1. Always zero for a Static Body. + * + * @name Phaser.Physics.Arcade.StaticBody#bounce + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.0.0 + */ + this.bounce = Vector2.ZERO; + + // If true this Body will dispatch events + + /** + * Whether the simulation emits a `worldbounds` event when this StaticBody collides with the world boundary. + * Always false for a Static Body. (Static Bodies never collide with the world boundary and never trigger a `worldbounds` event.) + * + * @name Phaser.Physics.Arcade.StaticBody#onWorldBounds + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.onWorldBounds = false; + + /** + * Whether the simulation emits a `collide` event when this StaticBody collides with another. + * + * @name Phaser.Physics.Arcade.StaticBody#onCollide + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.onCollide = false; + + /** + * Whether the simulation emits an `overlap` event when this StaticBody overlaps with another. + * + * @name Phaser.Physics.Arcade.StaticBody#onOverlap + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.onOverlap = false; + + /** + * The StaticBody's inertia, relative to a default unit (1). With `bounce`, this affects the exchange of momentum (velocities) during collisions. + * + * @name Phaser.Physics.Arcade.StaticBody#mass + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.mass = 1; + + /** + * Whether this object can be moved by collisions with another body. + * + * @name Phaser.Physics.Arcade.StaticBody#immovable + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.immovable = true; + + /** + * Sets if this Body can be pushed by another Body. + * + * A body that cannot be pushed will reflect back all of the velocity it is given to the + * colliding body. If that body is also not pushable, then the separation will be split + * between them evenly. + * + * If you want your body to never move or seperate at all, see the `setImmovable` method. + * + * By default, Static Bodies are not pushable. + * + * @name Phaser.Physics.Arcade.StaticBody#pushable + * @type {boolean} + * @default false + * @since 3.50.0 + * @see Phaser.GameObjects.Components.Pushable#setPushable + */ + this.pushable = false; + + /** + * A flag disabling the default horizontal separation of colliding bodies. Pass your own `collideHandler` to the collider. + * + * @name Phaser.Physics.Arcade.StaticBody#customSeparateX + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.customSeparateX = false; + + /** + * A flag disabling the default vertical separation of colliding bodies. Pass your own `collideHandler` to the collider. + * + * @name Phaser.Physics.Arcade.StaticBody#customSeparateY + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.customSeparateY = false; + + /** + * The amount of horizontal overlap (before separation), if this Body is colliding with another. + * + * @name Phaser.Physics.Arcade.StaticBody#overlapX + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.overlapX = 0; + + /** + * The amount of vertical overlap (before separation), if this Body is colliding with another. + * + * @name Phaser.Physics.Arcade.StaticBody#overlapY + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.overlapY = 0; + + /** + * The amount of overlap (before separation), if this StaticBody is circular and colliding with another circular body. + * + * @name Phaser.Physics.Arcade.StaticBody#overlapR + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.overlapR = 0; + + /** + * Whether this StaticBody has ever overlapped with another while both were not moving. + * + * @name Phaser.Physics.Arcade.StaticBody#embedded + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.embedded = false; + + /** + * Whether this StaticBody interacts with the world boundary. + * Always false for a Static Body. (Static Bodies never collide with the world boundary.) + * + * @name Phaser.Physics.Arcade.StaticBody#collideWorldBounds + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.collideWorldBounds = false; + + /** + * Whether this StaticBody is checked for collisions and for which directions. You can set `checkCollision.none = false` to disable collision checks. + * + * @name Phaser.Physics.Arcade.StaticBody#checkCollision + * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} + * @since 3.0.0 + */ + this.checkCollision = { none: false, up: true, down: true, left: true, right: true }; + + /** + * This property is kept for compatibility with Dynamic Bodies. + * Avoid using it. + * + * @name Phaser.Physics.Arcade.StaticBody#touching + * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} + * @since 3.0.0 + */ + this.touching = { none: true, up: false, down: false, left: false, right: false }; + + /** + * This property is kept for compatibility with Dynamic Bodies. + * Avoid using it. + * The values are always false for a Static Body. + * + * @name Phaser.Physics.Arcade.StaticBody#wasTouching + * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} + * @since 3.0.0 + */ + this.wasTouching = { none: true, up: false, down: false, left: false, right: false }; + + /** + * This property is kept for compatibility with Dynamic Bodies. + * Avoid using it. + * + * @name Phaser.Physics.Arcade.StaticBody#blocked + * @type {Phaser.Types.Physics.Arcade.ArcadeBodyCollision} + * @since 3.0.0 + */ + this.blocked = { none: true, up: false, down: false, left: false, right: false }; + + /** + * The StaticBody's physics type (static by default). + * + * @name Phaser.Physics.Arcade.StaticBody#physicsType + * @type {number} + * @default Phaser.Physics.Arcade.STATIC_BODY + * @since 3.0.0 + */ + this.physicsType = CONST.STATIC_BODY; + + /** + * The calculated change in the Static Body's horizontal position during the current step. + * For a static body this is always zero. + * + * @name Phaser.Physics.Arcade.StaticBody#_dx + * @type {number} + * @private + * @default 0 + * @since 3.10.0 + */ + this._dx = 0; + + /** + * The calculated change in the Static Body's vertical position during the current step. + * For a static body this is always zero. + * + * @name Phaser.Physics.Arcade.StaticBody#_dy + * @type {number} + * @private + * @default 0 + * @since 3.10.0 + */ + this._dy = 0; + }, + + /** + * Changes the Game Object this Body is bound to. + * First it removes its reference from the old Game Object, then sets the new one. + * You can optionally update the position and dimensions of this Body to reflect that of the new Game Object. + * + * @method Phaser.Physics.Arcade.StaticBody#setGameObject + * @since 3.1.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The new Game Object that will own this Body. + * @param {boolean} [update=true] - Reposition and resize this Body to match the new Game Object? + * + * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. + * + * @see Phaser.Physics.Arcade.StaticBody#updateFromGameObject + */ + setGameObject: function (gameObject, update) + { + if (gameObject && gameObject !== this.gameObject) + { + // Remove this body from the old game object + this.gameObject.body = null; + + gameObject.body = this; + + // Update our reference + this.gameObject = gameObject; + } + + if (update) + { + this.updateFromGameObject(); + } + + return this; + }, + + /** + * Syncs the Static Body's position and size with its parent Game Object. + * + * @method Phaser.Physics.Arcade.StaticBody#updateFromGameObject + * @since 3.1.0 + * + * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. + */ + updateFromGameObject: function () + { + this.world.staticTree.remove(this); + + var gameObject = this.gameObject; + + gameObject.getTopLeft(this.position); + + this.width = gameObject.displayWidth; + this.height = gameObject.displayHeight; + + this.halfWidth = Math.abs(this.width / 2); + this.halfHeight = Math.abs(this.height / 2); + + this.center.set(this.position.x + this.halfWidth, this.position.y + this.halfHeight); + + this.world.staticTree.insert(this); + + return this; + }, + + /** + * Positions the Static Body at an offset from its Game Object. + * + * @method Phaser.Physics.Arcade.StaticBody#setOffset + * @since 3.4.0 + * + * @param {number} x - The horizontal offset of the Static Body from the Game Object's `x`. + * @param {number} y - The vertical offset of the Static Body from the Game Object's `y`. + * + * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. + */ + setOffset: function (x, y) + { + if (y === undefined) { y = x; } + + this.world.staticTree.remove(this); + + this.position.x -= this.offset.x; + this.position.y -= this.offset.y; + + this.offset.set(x, y); + + this.position.x += this.offset.x; + this.position.y += this.offset.y; + + this.updateCenter(); + + this.world.staticTree.insert(this); + + return this; + }, + + /** + * Sets the size of the Static Body. + * When `center` is true, also repositions it. + * Resets the width and height to match current frame, if no width and height provided and a frame is found. + * + * @method Phaser.Physics.Arcade.StaticBody#setSize + * @since 3.0.0 + * + * @param {number} [width] - The width of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width. + * @param {number} [height] - The height of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height. + * @param {boolean} [center=true] - Place the Static Body's center on its Game Object's center. Only works if the Game Object has the `getCenter` method. + * + * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. + */ + setSize: function (width, height, center) + { + if (center === undefined) { center = true; } + + var gameObject = this.gameObject; + + if (!width && gameObject.frame) + { + width = gameObject.frame.realWidth; + } + + if (!height && gameObject.frame) + { + height = gameObject.frame.realHeight; + } + + this.world.staticTree.remove(this); + + this.width = width; + this.height = height; + + this.halfWidth = Math.floor(width / 2); + this.halfHeight = Math.floor(height / 2); + + if (center && gameObject.getCenter) + { + var ox = gameObject.displayWidth / 2; + var oy = gameObject.displayHeight / 2; + + this.position.x -= this.offset.x; + this.position.y -= this.offset.y; + + this.offset.set(ox - this.halfWidth, oy - this.halfHeight); + + this.position.x += this.offset.x; + this.position.y += this.offset.y; + } + + this.updateCenter(); + + this.isCircle = false; + this.radius = 0; + + this.world.staticTree.insert(this); + + return this; + }, + + /** + * Sets this Static Body to have a circular body and sets its size and position. + * + * @method Phaser.Physics.Arcade.StaticBody#setCircle + * @since 3.0.0 + * + * @param {number} radius - The radius of the StaticBody, in pixels. + * @param {number} [offsetX] - The horizontal offset of the StaticBody from its Game Object, in pixels. + * @param {number} [offsetY] - The vertical offset of the StaticBody from its Game Object, in pixels. + * + * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. + */ + setCircle: function (radius, offsetX, offsetY) + { + if (offsetX === undefined) { offsetX = this.offset.x; } + if (offsetY === undefined) { offsetY = this.offset.y; } + + if (radius > 0) + { + this.world.staticTree.remove(this); + + this.isCircle = true; + + this.radius = radius; + + this.width = radius * 2; + this.height = radius * 2; + + this.halfWidth = Math.floor(this.width / 2); + this.halfHeight = Math.floor(this.height / 2); + + this.offset.set(offsetX, offsetY); + + this.updateCenter(); + + this.world.staticTree.insert(this); + } + else + { + this.isCircle = false; + } + + return this; + }, + + /** + * Updates the StaticBody's `center` from its `position` and dimensions. + * + * @method Phaser.Physics.Arcade.StaticBody#updateCenter + * @since 3.0.0 + */ + updateCenter: function () + { + this.center.set(this.position.x + this.halfWidth, this.position.y + this.halfHeight); + }, + + /** + * Resets this Body to the given coordinates. Also positions its parent Game Object to the same coordinates. + * + * @method Phaser.Physics.Arcade.StaticBody#reset + * @since 3.0.0 + * + * @param {number} [x] - The x coordinate to reset the body to. If not given will use the parent Game Object's coordinate. + * @param {number} [y] - The y coordinate to reset the body to. If not given will use the parent Game Object's coordinate. + */ + reset: function (x, y) + { + var gameObject = this.gameObject; + + if (x === undefined) { x = gameObject.x; } + if (y === undefined) { y = gameObject.y; } + + this.world.staticTree.remove(this); + + gameObject.setPosition(x, y); + + gameObject.getTopLeft(this.position); + + this.updateCenter(); + + this.world.staticTree.insert(this); + }, + + /** + * NOOP function. A Static Body cannot be stopped. + * + * @method Phaser.Physics.Arcade.StaticBody#stop + * @since 3.0.0 + * + * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. + */ + stop: function () + { + return this; + }, + + /** + * Returns the x and y coordinates of the top left and bottom right points of the StaticBody. + * + * @method Phaser.Physics.Arcade.StaticBody#getBounds + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Arcade.ArcadeBodyBounds} obj - The object which will hold the coordinates of the bounds. + * + * @return {Phaser.Types.Physics.Arcade.ArcadeBodyBounds} The same object that was passed with `x`, `y`, `right` and `bottom` values matching the respective values of the StaticBody. + */ + getBounds: function (obj) + { + obj.x = this.x; + obj.y = this.y; + obj.right = this.right; + obj.bottom = this.bottom; + + return obj; + }, + + /** + * Checks to see if a given x,y coordinate is colliding with this Static Body. + * + * @method Phaser.Physics.Arcade.StaticBody#hitTest + * @since 3.0.0 + * + * @param {number} x - The x coordinate to check against this body. + * @param {number} y - The y coordinate to check against this body. + * + * @return {boolean} `true` if the given coordinate lies within this body, otherwise `false`. + */ + hitTest: function (x, y) + { + return (this.isCircle) ? CircleContains(this, x, y) : RectangleContains(this, x, y); + }, + + /** + * NOOP + * + * @method Phaser.Physics.Arcade.StaticBody#postUpdate + * @since 3.12.0 + */ + postUpdate: function () + { + }, + + /** + * The absolute (non-negative) change in this StaticBody's horizontal position from the previous step. Always zero. + * + * @method Phaser.Physics.Arcade.StaticBody#deltaAbsX + * @since 3.0.0 + * + * @return {number} Always zero for a Static Body. + */ + deltaAbsX: function () + { + return 0; + }, + + /** + * The absolute (non-negative) change in this StaticBody's vertical position from the previous step. Always zero. + * + * @method Phaser.Physics.Arcade.StaticBody#deltaAbsY + * @since 3.0.0 + * + * @return {number} Always zero for a Static Body. + */ + deltaAbsY: function () + { + return 0; + }, + + /** + * The change in this StaticBody's horizontal position from the previous step. Always zero. + * + * @method Phaser.Physics.Arcade.StaticBody#deltaX + * @since 3.0.0 + * + * @return {number} The change in this StaticBody's velocity from the previous step. Always zero. + */ + deltaX: function () + { + return 0; + }, + + /** + * The change in this StaticBody's vertical position from the previous step. Always zero. + * + * @method Phaser.Physics.Arcade.StaticBody#deltaY + * @since 3.0.0 + * + * @return {number} The change in this StaticBody's velocity from the previous step. Always zero. + */ + deltaY: function () + { + return 0; + }, + + /** + * The change in this StaticBody's rotation from the previous step. Always zero. + * + * @method Phaser.Physics.Arcade.StaticBody#deltaZ + * @since 3.0.0 + * + * @return {number} The change in this StaticBody's rotation from the previous step. Always zero. + */ + deltaZ: function () + { + return 0; + }, + + /** + * Disables this Body and marks it for destruction during the next step. + * + * @method Phaser.Physics.Arcade.StaticBody#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.enable = false; + + this.world.pendingDestroy.set(this); + }, + + /** + * Draws a graphical representation of the StaticBody for visual debugging purposes. + * + * @method Phaser.Physics.Arcade.StaticBody#drawDebug + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Graphics} graphic - The Graphics object to use for the debug drawing of the StaticBody. + */ + drawDebug: function (graphic) + { + var pos = this.position; + + var x = pos.x + this.halfWidth; + var y = pos.y + this.halfHeight; + + if (this.debugShowBody) + { + graphic.lineStyle(graphic.defaultStrokeWidth, this.debugBodyColor, 1); + + if (this.isCircle) + { + graphic.strokeCircle(x, y, this.width / 2); + } + else + { + graphic.strokeRect(pos.x, pos.y, this.width, this.height); + } + + } + }, + + /** + * Indicates whether the StaticBody is going to be showing a debug visualization during postUpdate. + * + * @method Phaser.Physics.Arcade.StaticBody#willDrawDebug + * @since 3.0.0 + * + * @return {boolean} Whether or not the StaticBody is going to show the debug visualization during postUpdate. + */ + willDrawDebug: function () + { + return this.debugShowBody; + }, + + /** + * Sets the Mass of the StaticBody. Will set the Mass to 0.1 if the value passed is less than or equal to zero. + * + * @method Phaser.Physics.Arcade.StaticBody#setMass + * @since 3.0.0 + * + * @param {number} value - The value to set the Mass to. Values of zero or less are changed to 0.1. + * + * @return {Phaser.Physics.Arcade.StaticBody} This Static Body object. + */ + setMass: function (value) + { + if (value <= 0) + { + // Causes havoc otherwise + value = 0.1; + } + + this.mass = value; + + return this; + }, + + /** + * The x coordinate of the StaticBody. + * + * @name Phaser.Physics.Arcade.StaticBody#x + * @type {number} + * @since 3.0.0 + */ + x: { + + get: function () + { + return this.position.x; + }, + + set: function (value) + { + this.world.staticTree.remove(this); + + this.position.x = value; + + this.world.staticTree.insert(this); + } + + }, + + /** + * The y coordinate of the StaticBody. + * + * @name Phaser.Physics.Arcade.StaticBody#y + * @type {number} + * @since 3.0.0 + */ + y: { + + get: function () + { + return this.position.y; + }, + + set: function (value) + { + this.world.staticTree.remove(this); + + this.position.y = value; + + this.world.staticTree.insert(this); + } + + }, + + /** + * Returns the left-most x coordinate of the area of the StaticBody. + * + * @name Phaser.Physics.Arcade.StaticBody#left + * @type {number} + * @readonly + * @since 3.0.0 + */ + left: { + + get: function () + { + return this.position.x; + } + + }, + + /** + * The right-most x coordinate of the area of the StaticBody. + * + * @name Phaser.Physics.Arcade.StaticBody#right + * @type {number} + * @readonly + * @since 3.0.0 + */ + right: { + + get: function () + { + return this.position.x + this.width; + } + + }, + + /** + * The highest y coordinate of the area of the StaticBody. + * + * @name Phaser.Physics.Arcade.StaticBody#top + * @type {number} + * @readonly + * @since 3.0.0 + */ + top: { + + get: function () + { + return this.position.y; + } + + }, + + /** + * The lowest y coordinate of the area of the StaticBody. (y + height) + * + * @name Phaser.Physics.Arcade.StaticBody#bottom + * @type {number} + * @readonly + * @since 3.0.0 + */ + bottom: { + + get: function () + { + return this.position.y + this.height; + } + + } + +}); + +module.exports = StaticBody; + + +/***/ }), + +/***/ 46346: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var ArcadeSprite = __webpack_require__(25084); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(47401); +var GetFastValue = __webpack_require__(72632); +var Group = __webpack_require__(59192); +var IsPlainObject = __webpack_require__(42911); + +/** + * @classdesc + * An Arcade Physics Static Group object. + * + * All Game Objects created by or added to this Group will automatically be given static Arcade Physics bodies, if they have no body. + * + * Its dynamic counterpart is {@link Phaser.Physics.Arcade.Group}. + * + * @class StaticGroup + * @extends Phaser.GameObjects.Group + * @memberof Phaser.Physics.Arcade + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.World} world - The physics simulation. + * @param {Phaser.Scene} scene - The scene this group belongs to. + * @param {(Phaser.GameObjects.GameObject[]|Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument. + * @param {Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} [config] - Settings for this group. + */ +var StaticPhysicsGroup = new Class({ + + Extends: Group, + + initialize: + + function StaticPhysicsGroup (world, scene, children, config) + { + if (!children && !config) + { + config = { + internalCreateCallback: this.createCallbackHandler, + internalRemoveCallback: this.removeCallbackHandler, + createMultipleCallback: this.createMultipleCallbackHandler, + classType: ArcadeSprite + }; + } + else if (IsPlainObject(children)) + { + // children is a plain object, so swizzle them: + config = children; + children = null; + + config.internalCreateCallback = this.createCallbackHandler; + config.internalRemoveCallback = this.removeCallbackHandler; + config.createMultipleCallback = this.createMultipleCallbackHandler; + config.classType = GetFastValue(config, 'classType', ArcadeSprite); + } + else if (Array.isArray(children) && IsPlainObject(children[0])) + { + // children is an array of plain objects + config = children; + children = null; + + config.forEach(function (singleConfig) + { + singleConfig.internalCreateCallback = this.createCallbackHandler; + singleConfig.internalRemoveCallback = this.removeCallbackHandler; + singleConfig.createMultipleCallback = this.createMultipleCallbackHandler; + singleConfig.classType = GetFastValue(singleConfig, 'classType', ArcadeSprite); + }); + } + else + { + // config is not defined and children is not a plain object nor an array of plain objects + config = { + internalCreateCallback: this.createCallbackHandler, + internalRemoveCallback: this.removeCallbackHandler + }; + } + + /** + * The physics simulation. + * + * @name Phaser.Physics.Arcade.StaticGroup#world + * @type {Phaser.Physics.Arcade.World} + * @since 3.0.0 + */ + this.world = world; + + /** + * The scene this group belongs to. + * + * @name Phaser.Physics.Arcade.StaticGroup#physicsType + * @type {number} + * @default Phaser.Physics.Arcade.STATIC_BODY + * @since 3.0.0 + */ + this.physicsType = CONST.STATIC_BODY; + + Group.call(this, scene, children, config); + + /** + * A textual representation of this Game Object. + * Used internally by Phaser but is available for your own custom classes to populate. + * + * @name Phaser.Physics.Arcade.StaticGroup#type + * @type {string} + * @default 'StaticPhysicsGroup' + * @since 3.21.0 + */ + this.type = 'StaticPhysicsGroup'; + }, + + /** + * Adds a static physics body to the new group member (if it lacks one) and adds it to the simulation. + * + * @method Phaser.Physics.Arcade.StaticGroup#createCallbackHandler + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} child - The new group member. + * + * @see Phaser.Physics.Arcade.World#enableBody + */ + createCallbackHandler: function (child) + { + if (!child.body) + { + this.world.enableBody(child, CONST.STATIC_BODY); + } + }, + + /** + * Disables the group member's physics body, removing it from the simulation. + * + * @method Phaser.Physics.Arcade.StaticGroup#removeCallbackHandler + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} child - The group member being removed. + * + * @see Phaser.Physics.Arcade.World#disableBody + */ + removeCallbackHandler: function (child) + { + if (child.body) + { + this.world.disableBody(child); + } + }, + + /** + * Refreshes the group. + * + * @method Phaser.Physics.Arcade.StaticGroup#createMultipleCallbackHandler + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject[]} entries - The newly created group members. + * + * @see Phaser.Physics.Arcade.StaticGroup#refresh + */ + createMultipleCallbackHandler: function () + { + this.refresh(); + }, + + /** + * Resets each Body to the position of its parent Game Object. + * Body sizes aren't changed (use {@link Phaser.Physics.Arcade.Components.Enable#refreshBody} for that). + * + * @method Phaser.Physics.Arcade.StaticGroup#refresh + * @since 3.0.0 + * + * @return {Phaser.Physics.Arcade.StaticGroup} This group. + * + * @see Phaser.Physics.Arcade.StaticBody#reset + */ + refresh: function () + { + var children = this.children.entries; + + for (var i = 0; i < children.length; i++) + { + children[i].body.reset(); + } + + return this; + } + +}); + +module.exports = StaticPhysicsGroup; + + +/***/ }), + +/***/ 85233: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var AngleBetweenPoints = __webpack_require__(94240); +var Body = __webpack_require__(97602); +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var Collider = __webpack_require__(3909); +var CONST = __webpack_require__(47401); +var DistanceBetween = __webpack_require__(53996); +var DistanceBetweenPoints = __webpack_require__(92951); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(27037); +var FuzzyEqual = __webpack_require__(88456); +var FuzzyGreaterThan = __webpack_require__(41935); +var FuzzyLessThan = __webpack_require__(54726); +var GetOverlapX = __webpack_require__(75671); +var GetOverlapY = __webpack_require__(66185); +var GetTilesWithinWorldXY = __webpack_require__(44662); +var GetValue = __webpack_require__(10850); +var MATH_CONST = __webpack_require__(83392); +var ProcessQueue = __webpack_require__(74623); +var ProcessTileCallbacks = __webpack_require__(25163); +var Rectangle = __webpack_require__(74118); +var RTree = __webpack_require__(68687); +var SeparateTile = __webpack_require__(27354); +var SeparateX = __webpack_require__(61777); +var SeparateY = __webpack_require__(25299); +var Set = __webpack_require__(58403); +var StaticBody = __webpack_require__(66634); +var TileIntersectsBody = __webpack_require__(28808); +var TransformMatrix = __webpack_require__(69360); +var Vector2 = __webpack_require__(93736); +var Wrap = __webpack_require__(1071); + +/** + * @classdesc + * The Arcade Physics World. + * + * The World is responsible for creating, managing, colliding and updating all of the bodies within it. + * + * An instance of the World belongs to a Phaser.Scene and is accessed via the property `physics.world`. + * + * @class World + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Physics.Arcade + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to which this World instance belongs. + * @param {Phaser.Types.Physics.Arcade.ArcadeWorldConfig} config - An Arcade Physics Configuration object. + */ +var World = new Class({ + + Extends: EventEmitter, + + initialize: + + function World (scene, config) + { + EventEmitter.call(this); + + /** + * The Scene this simulation belongs to. + * + * @name Phaser.Physics.Arcade.World#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; + + /** + * Dynamic Bodies in this simulation. + * + * @name Phaser.Physics.Arcade.World#bodies + * @type {Phaser.Structs.Set.} + * @since 3.0.0 + */ + this.bodies = new Set(); + + /** + * Static Bodies in this simulation. + * + * @name Phaser.Physics.Arcade.World#staticBodies + * @type {Phaser.Structs.Set.} + * @since 3.0.0 + */ + this.staticBodies = new Set(); + + /** + * Static Bodies marked for deletion. + * + * @name Phaser.Physics.Arcade.World#pendingDestroy + * @type {Phaser.Structs.Set.<(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)>} + * @since 3.1.0 + */ + this.pendingDestroy = new Set(); + + /** + * This simulation's collision processors. + * + * @name Phaser.Physics.Arcade.World#colliders + * @type {Phaser.Structs.ProcessQueue.} + * @since 3.0.0 + */ + this.colliders = new ProcessQueue(); + + /** + * Acceleration of Bodies due to gravity, in pixels per second. + * + * @name Phaser.Physics.Arcade.World#gravity + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.gravity = new Vector2(GetValue(config, 'gravity.x', 0), GetValue(config, 'gravity.y', 0)); + + /** + * A boundary constraining Bodies. + * + * @name Phaser.Physics.Arcade.World#bounds + * @type {Phaser.Geom.Rectangle} + * @since 3.0.0 + */ + this.bounds = new Rectangle( + GetValue(config, 'x', 0), + GetValue(config, 'y', 0), + GetValue(config, 'width', scene.sys.scale.width), + GetValue(config, 'height', scene.sys.scale.height) + ); + + /** + * The boundary edges that Bodies can collide with. + * + * @name Phaser.Physics.Arcade.World#checkCollision + * @type {Phaser.Types.Physics.Arcade.CheckCollisionObject} + * @since 3.0.0 + */ + this.checkCollision = { + up: GetValue(config, 'checkCollision.up', true), + down: GetValue(config, 'checkCollision.down', true), + left: GetValue(config, 'checkCollision.left', true), + right: GetValue(config, 'checkCollision.right', true) + }; + + /** + * The number of physics steps to be taken per second. + * + * This property is read-only. Use the `setFPS` method to modify it at run-time. + * + * @name Phaser.Physics.Arcade.World#fps + * @readonly + * @type {number} + * @default 60 + * @since 3.10.0 + */ + this.fps = GetValue(config, 'fps', 60); + + /** + * Should Physics use a fixed update time-step (true) or sync to the render fps (false)?. + * False value of this property disables fps and timeScale properties. + * + * @name Phaser.Physics.Arcade.World#fixedStep + * @type {boolean} + * @default true + * @since 3.23.0 + */ + this.fixedStep = GetValue(config, 'fixedStep', true); + + /** + * The amount of elapsed ms since the last frame. + * + * @name Phaser.Physics.Arcade.World#_elapsed + * @private + * @type {number} + * @since 3.10.0 + */ + this._elapsed = 0; + + /** + * Internal frame time value. + * + * @name Phaser.Physics.Arcade.World#_frameTime + * @private + * @type {number} + * @since 3.10.0 + */ + this._frameTime = 1 / this.fps; + + /** + * Internal frame time ms value. + * + * @name Phaser.Physics.Arcade.World#_frameTimeMS + * @private + * @type {number} + * @since 3.10.0 + */ + this._frameTimeMS = 1000 * this._frameTime; + + /** + * The number of steps that took place in the last frame. + * + * @name Phaser.Physics.Arcade.World#stepsLastFrame + * @readonly + * @type {number} + * @since 3.10.0 + */ + this.stepsLastFrame = 0; + + /** + * Scaling factor applied to the frame rate. + * + * - 1.0 = normal speed + * - 2.0 = half speed + * - 0.5 = double speed + * + * @name Phaser.Physics.Arcade.World#timeScale + * @type {number} + * @default 1 + * @since 3.10.0 + */ + this.timeScale = GetValue(config, 'timeScale', 1); + + /** + * The maximum absolute difference of a Body's per-step velocity and its overlap with another Body that will result in separation on *each axis*. + * Larger values favor separation. + * Smaller values favor no separation. + * + * @name Phaser.Physics.Arcade.World#OVERLAP_BIAS + * @type {number} + * @default 4 + * @since 3.0.0 + */ + this.OVERLAP_BIAS = GetValue(config, 'overlapBias', 4); + + /** + * The maximum absolute value of a Body's overlap with a tile that will result in separation on *each axis*. + * Larger values favor separation. + * Smaller values favor no separation. + * The optimum value may be similar to the tile size. + * + * @name Phaser.Physics.Arcade.World#TILE_BIAS + * @type {number} + * @default 16 + * @since 3.0.0 + */ + this.TILE_BIAS = GetValue(config, 'tileBias', 16); + + /** + * Always separate overlapping Bodies horizontally before vertically. + * False (the default) means Bodies are first separated on the axis of greater gravity, or the vertical axis if neither is greater. + * + * @name Phaser.Physics.Arcade.World#forceX + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.forceX = GetValue(config, 'forceX', false); + + /** + * Whether the simulation advances with the game loop. + * + * @name Phaser.Physics.Arcade.World#isPaused + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.isPaused = GetValue(config, 'isPaused', false); + + /** + * Temporary total of colliding Bodies. + * + * @name Phaser.Physics.Arcade.World#_total + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._total = 0; + + /** + * Enables the debug display. + * + * @name Phaser.Physics.Arcade.World#drawDebug + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.drawDebug = GetValue(config, 'debug', false); + + /** + * The graphics object drawing the debug display. + * + * @name Phaser.Physics.Arcade.World#debugGraphic + * @type {Phaser.GameObjects.Graphics} + * @since 3.0.0 + */ + this.debugGraphic; + + /** + * Default debug display settings for new Bodies. + * + * @name Phaser.Physics.Arcade.World#defaults + * @type {Phaser.Types.Physics.Arcade.ArcadeWorldDefaults} + * @since 3.0.0 + */ + this.defaults = { + debugShowBody: GetValue(config, 'debugShowBody', true), + debugShowStaticBody: GetValue(config, 'debugShowStaticBody', true), + debugShowVelocity: GetValue(config, 'debugShowVelocity', true), + bodyDebugColor: GetValue(config, 'debugBodyColor', 0xff00ff), + staticBodyDebugColor: GetValue(config, 'debugStaticBodyColor', 0x0000ff), + velocityDebugColor: GetValue(config, 'debugVelocityColor', 0x00ff00) + }; + + /** + * The maximum number of items per node on the RTree. + * + * This is ignored if `useTree` is `false`. If you have a large number of bodies in + * your world then you may find search performance improves by increasing this value, + * to allow more items per node and less node division. + * + * @name Phaser.Physics.Arcade.World#maxEntries + * @type {number} + * @default 16 + * @since 3.0.0 + */ + this.maxEntries = GetValue(config, 'maxEntries', 16); + + /** + * Should this Arcade Physics World use an RTree for Dynamic bodies? + * + * An RTree is a fast way of spatially sorting of all the bodies in the world. + * However, at certain limits, the cost of clearing and inserting the bodies into the + * tree every frame becomes more expensive than the search speed gains it provides. + * + * If you have a large number of dynamic bodies in your world then it may be best to + * disable the use of the RTree by setting this property to `false` in the physics config. + * + * The number it can cope with depends on browser and device, but a conservative estimate + * of around 5,000 bodies should be considered the max before disabling it. + * + * This only applies to dynamic bodies. Static bodies are always kept in an RTree, + * because they don't have to be cleared every frame, so you benefit from the + * massive search speeds all the time. + * + * @name Phaser.Physics.Arcade.World#useTree + * @type {boolean} + * @default true + * @since 3.10.0 + */ + this.useTree = GetValue(config, 'useTree', true); + + /** + * The spatial index of Dynamic Bodies. + * + * @name Phaser.Physics.Arcade.World#tree + * @type {Phaser.Structs.RTree} + * @since 3.0.0 + */ + this.tree = new RTree(this.maxEntries); + + /** + * The spatial index of Static Bodies. + * + * @name Phaser.Physics.Arcade.World#staticTree + * @type {Phaser.Structs.RTree} + * @since 3.0.0 + */ + this.staticTree = new RTree(this.maxEntries); + + /** + * Recycled input for tree searches. + * + * @name Phaser.Physics.Arcade.World#treeMinMax + * @type {Phaser.Types.Physics.Arcade.ArcadeWorldTreeMinMax} + * @since 3.0.0 + */ + this.treeMinMax = { minX: 0, minY: 0, maxX: 0, maxY: 0 }; + + /** + * A temporary Transform Matrix used by bodies for calculations without them needing their own local copy. + * + * @name Phaser.Physics.Arcade.World#_tempMatrix + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @private + * @since 3.12.0 + */ + this._tempMatrix = new TransformMatrix(); + + /** + * A temporary Transform Matrix used by bodies for calculations without them needing their own local copy. + * + * @name Phaser.Physics.Arcade.World#_tempMatrix2 + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @private + * @since 3.12.0 + */ + this._tempMatrix2 = new TransformMatrix(); + + /** + * The Filtering Options passed to `GetTilesWithinWorldXY` as part of the `collideSpriteVsTilemapLayer` check. + * + * @name Phaser.Physics.Arcade.World#tileFilterOptions + * @type {Phaser.Types.Tilemaps.FilteringOptions} + * @since 3.60.0 + */ + this.tileFilterOptions = { isColliding: true, isNotEmpty: true, hasInterestingFace: true }; + + if (this.drawDebug) + { + this.createDebugGraphic(); + } + }, + + /** + * Adds an Arcade Physics Body to a Game Object, an array of Game Objects, or the children of a Group. + * + * The difference between this and the `enableBody` method is that you can pass arrays or Groups + * to this method. + * + * You can specify if the bodies are to be Dynamic or Static. A dynamic body can move via velocity and + * acceleration. A static body remains fixed in place and as such is able to use an optimized search + * tree, making it ideal for static elements such as level objects. You can still collide and overlap + * with static bodies. + * + * Normally, rather than calling this method directly, you'd use the helper methods available in the + * Arcade Physics Factory, such as: + * + * ```javascript + * this.physics.add.image(x, y, textureKey); + * this.physics.add.sprite(x, y, textureKey); + * ``` + * + * Calling factory methods encapsulates the creation of a Game Object and the creation of its + * body at the same time. If you are creating custom classes then you can pass them to this + * method to have their bodies created. + * + * @method Phaser.Physics.Arcade.World#enable + * @since 3.0.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group|Phaser.GameObjects.Group[])} object - The object, or objects, on which to create the bodies. + * @param {number} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`. + */ + enable: function (object, bodyType) + { + if (bodyType === undefined) { bodyType = CONST.DYNAMIC_BODY; } + + if (!Array.isArray(object)) + { + object = [ object ]; + } + + for (var i = 0; i < object.length; i++) + { + var entry = object[i]; + + if (entry.isParent) + { + var children = entry.getChildren(); + + for (var c = 0; c < children.length; c++) + { + var child = children[c]; + + if (child.isParent) + { + // Handle Groups nested inside of Groups + this.enable(child, bodyType); + } + else + { + this.enableBody(child, bodyType); + } + } + } + else + { + this.enableBody(entry, bodyType); + } + } + }, + + /** + * Creates an Arcade Physics Body on a single Game Object. + * + * If the Game Object already has a body, this method will simply add it back into the simulation. + * + * You can specify if the body is Dynamic or Static. A dynamic body can move via velocity and + * acceleration. A static body remains fixed in place and as such is able to use an optimized search + * tree, making it ideal for static elements such as level objects. You can still collide and overlap + * with static bodies. + * + * Normally, rather than calling this method directly, you'd use the helper methods available in the + * Arcade Physics Factory, such as: + * + * ```javascript + * this.physics.add.image(x, y, textureKey); + * this.physics.add.sprite(x, y, textureKey); + * ``` + * + * Calling factory methods encapsulates the creation of a Game Object and the creation of its + * body at the same time. If you are creating custom classes then you can pass them to this + * method to have their bodies created. + * + * @method Phaser.Physics.Arcade.World#enableBody + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} object - The Game Object on which to create the body. + * @param {number} [bodyType] - The type of Body to create. Either `DYNAMIC_BODY` or `STATIC_BODY`. + * + * @return {Phaser.GameObjects.GameObject} The Game Object on which the body was created. + */ + enableBody: function (object, bodyType) + { + if (bodyType === undefined) { bodyType = CONST.DYNAMIC_BODY; } + + if (object.hasTransformComponent) + { + if (!object.body) + { + if (bodyType === CONST.DYNAMIC_BODY) + { + object.body = new Body(this, object); + } + else if (bodyType === CONST.STATIC_BODY) + { + object.body = new StaticBody(this, object); + } + } + + this.add(object.body); + } + + return object; + }, + + /** + * Adds an existing Arcade Physics Body or StaticBody to the simulation. + * + * The body is enabled and added to the local search trees. + * + * @method Phaser.Physics.Arcade.World#add + * @since 3.10.0 + * + * @param {(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} body - The Body to be added to the simulation. + * + * @return {(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} The Body that was added to the simulation. + */ + add: function (body) + { + if (body.physicsType === CONST.DYNAMIC_BODY) + { + this.bodies.set(body); + } + else if (body.physicsType === CONST.STATIC_BODY) + { + this.staticBodies.set(body); + + this.staticTree.insert(body); + } + + body.enable = true; + + return body; + }, + + /** + * Disables the Arcade Physics Body of a Game Object, an array of Game Objects, or the children of a Group. + * + * The difference between this and the `disableBody` method is that you can pass arrays or Groups + * to this method. + * + * The body itself is not deleted, it just has its `enable` property set to false, which + * means you can re-enable it again at any point by passing it to enable `World.enable` or `World.add`. + * + * @method Phaser.Physics.Arcade.World#disable + * @since 3.0.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group|Phaser.GameObjects.Group[])} object - The object, or objects, on which to disable the bodies. + */ + disable: function (object) + { + if (!Array.isArray(object)) + { + object = [ object ]; + } + + for (var i = 0; i < object.length; i++) + { + var entry = object[i]; + + if (entry.isParent) + { + var children = entry.getChildren(); + + for (var c = 0; c < children.length; c++) + { + var child = children[c]; + + if (child.isParent) + { + // Handle Groups nested inside of Groups + this.disable(child); + } + else + { + this.disableBody(child.body); + } + } + } + else + { + this.disableBody(entry.body); + } + } + }, + + /** + * Disables an existing Arcade Physics Body or StaticBody and removes it from the simulation. + * + * The body is disabled and removed from the local search trees. + * + * The body itself is not deleted, it just has its `enable` property set to false, which + * means you can re-enable it again at any point by passing it to enable `World.enable` or `World.add`. + * + * @method Phaser.Physics.Arcade.World#disableBody + * @since 3.0.0 + * + * @param {(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} body - The Body to be disabled. + */ + disableBody: function (body) + { + this.remove(body); + + body.enable = false; + }, + + /** + * Removes an existing Arcade Physics Body or StaticBody from the simulation. + * + * The body is disabled and removed from the local search trees. + * + * The body itself is not deleted, it just has its `enabled` property set to false, which + * means you can re-enable it again at any point by passing it to enable `enable` or `add`. + * + * @method Phaser.Physics.Arcade.World#remove + * @since 3.0.0 + * + * @param {(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)} body - The body to be removed from the simulation. + */ + remove: function (body) + { + if (body.physicsType === CONST.DYNAMIC_BODY) + { + this.tree.remove(body); + this.bodies.delete(body); + } + else if (body.physicsType === CONST.STATIC_BODY) + { + this.staticBodies.delete(body); + this.staticTree.remove(body); + } + }, + + /** + * Creates a Graphics Game Object that the world will use to render the debug display to. + * + * This is called automatically when the World is instantiated if the `debug` config property + * was set to `true`. However, you can call it at any point should you need to display the + * debug Graphic from a fixed point. + * + * You can control which objects are drawn to the Graphics object, and the colors they use, + * by setting the debug properties in the physics config. + * + * You should not typically use this in a production game. Use it to aid during debugging. + * + * @method Phaser.Physics.Arcade.World#createDebugGraphic + * @since 3.0.0 + * + * @return {Phaser.GameObjects.Graphics} The Graphics object that was created for use by the World. + */ + createDebugGraphic: function () + { + var graphic = this.scene.sys.add.graphics({ x: 0, y: 0 }); + + graphic.setDepth(Number.MAX_VALUE); + + this.debugGraphic = graphic; + + this.drawDebug = true; + + return graphic; + }, + + /** + * Sets the position, size and properties of the World boundary. + * + * The World boundary is an invisible rectangle that defines the edges of the World. + * If a Body is set to collide with the world bounds then it will automatically stop + * when it reaches any of the edges. You can optionally set which edges of the boundary + * should be checked against. + * + * @method Phaser.Physics.Arcade.World#setBounds + * @since 3.0.0 + * + * @param {number} x - The top-left x coordinate of the boundary. + * @param {number} y - The top-left y coordinate of the boundary. + * @param {number} width - The width of the boundary. + * @param {number} height - The height of the boundary. + * @param {boolean} [checkLeft] - Should bodies check against the left edge of the boundary? + * @param {boolean} [checkRight] - Should bodies check against the right edge of the boundary? + * @param {boolean} [checkUp] - Should bodies check against the top edge of the boundary? + * @param {boolean} [checkDown] - Should bodies check against the bottom edge of the boundary? + * + * @return {Phaser.Physics.Arcade.World} This World object. + */ + setBounds: function (x, y, width, height, checkLeft, checkRight, checkUp, checkDown) + { + this.bounds.setTo(x, y, width, height); + + if (checkLeft !== undefined) + { + this.setBoundsCollision(checkLeft, checkRight, checkUp, checkDown); + } + + return this; + }, + + /** + * Enables or disables collisions on each edge of the World boundary. + * + * @method Phaser.Physics.Arcade.World#setBoundsCollision + * @since 3.0.0 + * + * @param {boolean} [left=true] - Should bodies check against the left edge of the boundary? + * @param {boolean} [right=true] - Should bodies check against the right edge of the boundary? + * @param {boolean} [up=true] - Should bodies check against the top edge of the boundary? + * @param {boolean} [down=true] - Should bodies check against the bottom edge of the boundary? + * + * @return {Phaser.Physics.Arcade.World} This World object. + */ + setBoundsCollision: function (left, right, up, down) + { + if (left === undefined) { left = true; } + if (right === undefined) { right = true; } + if (up === undefined) { up = true; } + if (down === undefined) { down = true; } + + this.checkCollision.left = left; + this.checkCollision.right = right; + this.checkCollision.up = up; + this.checkCollision.down = down; + + return this; + }, + + /** + * Pauses the simulation. + * + * A paused simulation does not update any existing bodies, or run any Colliders. + * + * However, you can still enable and disable bodies within it, or manually run collide or overlap + * checks. + * + * @method Phaser.Physics.Arcade.World#pause + * @fires Phaser.Physics.Arcade.Events#PAUSE + * @since 3.0.0 + * + * @return {Phaser.Physics.Arcade.World} This World object. + */ + pause: function () + { + this.isPaused = true; + + this.emit(Events.PAUSE); + + return this; + }, + + /** + * Resumes the simulation, if paused. + * + * @method Phaser.Physics.Arcade.World#resume + * @fires Phaser.Physics.Arcade.Events#RESUME + * @since 3.0.0 + * + * @return {Phaser.Physics.Arcade.World} This World object. + */ + resume: function () + { + this.isPaused = false; + + this.emit(Events.RESUME); + + return this; + }, + + /** + * Creates a new Collider object and adds it to the simulation. + * + * A Collider is a way to automatically perform collision checks between two objects, + * calling the collide and process callbacks if they occur. + * + * Colliders are run as part of the World update, after all of the Bodies have updated. + * + * By creating a Collider you don't need then call `World.collide` in your `update` loop, + * as it will be handled for you automatically. + * + * @method Phaser.Physics.Arcade.World#addCollider + * @since 3.0.0 + * @see Phaser.Physics.Arcade.World#collide + * + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object2 - The second object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects collide. Must return a boolean. + * @param {*} [callbackContext] - The scope in which to call the callbacks. + * + * @return {Phaser.Physics.Arcade.Collider} The Collider that was created. + */ + addCollider: function (object1, object2, collideCallback, processCallback, callbackContext) + { + if (collideCallback === undefined) { collideCallback = null; } + if (processCallback === undefined) { processCallback = null; } + if (callbackContext === undefined) { callbackContext = collideCallback; } + + var collider = new Collider(this, false, object1, object2, collideCallback, processCallback, callbackContext); + + this.colliders.add(collider); + + return collider; + }, + + /** + * Creates a new Overlap Collider object and adds it to the simulation. + * + * A Collider is a way to automatically perform overlap checks between two objects, + * calling the collide and process callbacks if they occur. + * + * Colliders are run as part of the World update, after all of the Bodies have updated. + * + * By creating a Collider you don't need then call `World.overlap` in your `update` loop, + * as it will be handled for you automatically. + * + * @method Phaser.Physics.Arcade.World#addOverlap + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object to check for overlap. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object2 - The second object to check for overlap. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects overlap. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects overlap. Must return a boolean. + * @param {*} [callbackContext] - The scope in which to call the callbacks. + * + * @return {Phaser.Physics.Arcade.Collider} The Collider that was created. + */ + addOverlap: function (object1, object2, collideCallback, processCallback, callbackContext) + { + if (collideCallback === undefined) { collideCallback = null; } + if (processCallback === undefined) { processCallback = null; } + if (callbackContext === undefined) { callbackContext = collideCallback; } + + var collider = new Collider(this, true, object1, object2, collideCallback, processCallback, callbackContext); + + this.colliders.add(collider); + + return collider; + }, + + /** + * Removes a Collider from the simulation so it is no longer processed. + * + * This method does not destroy the Collider. If you wish to add it back at a later stage you can call + * `World.colliders.add(Collider)`. + * + * If you no longer need the Collider you can call the `Collider.destroy` method instead, which will + * automatically clear all of its references and then remove it from the World. If you call destroy on + * a Collider you _don't_ need to pass it to this method too. + * + * @method Phaser.Physics.Arcade.World#removeCollider + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Collider} collider - The Collider to remove from the simulation. + * + * @return {Phaser.Physics.Arcade.World} This World object. + */ + removeCollider: function (collider) + { + this.colliders.remove(collider); + + return this; + }, + + /** + * Sets the frame rate to run the simulation at. + * + * The frame rate value is used to simulate a fixed update time step. This fixed + * time step allows for a straightforward implementation of a deterministic game state. + * + * This frame rate is independent of the frequency at which the game is rendering. The + * higher you set the fps, the more physics simulation steps will occur per game step. + * Conversely, the lower you set it, the less will take place. + * + * You can optionally advance the simulation directly yourself by calling the `step` method. + * + * @method Phaser.Physics.Arcade.World#setFPS + * @since 3.10.0 + * + * @param {number} framerate - The frame rate to advance the simulation at. + * + * @return {this} This World object. + */ + setFPS: function (framerate) + { + this.fps = framerate; + this._frameTime = 1 / this.fps; + this._frameTimeMS = 1000 * this._frameTime; + + return this; + }, + + /** + * Advances the simulation based on the elapsed time and fps rate. + * + * This is called automatically by your Scene and does not need to be invoked directly. + * + * @method Phaser.Physics.Arcade.World#update + * @fires Phaser.Physics.Arcade.Events#WORLD_STEP + * @since 3.0.0 + * + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time, in ms, elapsed since the last frame. + */ + update: function (time, delta) + { + if (this.isPaused || this.bodies.size === 0) + { + return; + } + + var i; + var fixedDelta = this._frameTime; + var msPerFrame = this._frameTimeMS * this.timeScale; + + this._elapsed += delta; + + // Update all active bodies + var body; + var bodies = this.bodies.entries; + + // Will a step happen this frame? + var willStep = (this._elapsed >= msPerFrame); + + if (!this.fixedStep) + { + fixedDelta = delta * 0.001; + willStep = true; + this._elapsed = 0; + } + + for (i = 0; i < bodies.length; i++) + { + body = bodies[i]; + + if (body.enable) + { + body.preUpdate(willStep, fixedDelta); + } + } + + // We know that a step will happen this frame, so let's bundle it all together to save branching and iteration costs + if (willStep) + { + this._elapsed -= msPerFrame; + this.stepsLastFrame = 1; + + // Optionally populate our dynamic collision tree + if (this.useTree) + { + this.tree.clear(); + this.tree.load(bodies); + } + + // Process any colliders + var colliders = this.colliders.update(); + + for (i = 0; i < colliders.length; i++) + { + var collider = colliders[i]; + + if (collider.active) + { + collider.update(); + } + } + + this.emit(Events.WORLD_STEP, fixedDelta); + } + + // Process any additional steps this frame + while (this._elapsed >= msPerFrame) + { + this._elapsed -= msPerFrame; + + this.step(fixedDelta); + } + }, + + /** + * Advances the simulation by a time increment. + * + * @method Phaser.Physics.Arcade.World#step + * @fires Phaser.Physics.Arcade.Events#WORLD_STEP + * @since 3.10.0 + * + * @param {number} delta - The delta time amount, in seconds, by which to advance the simulation. + */ + step: function (delta) + { + // Update all active bodies + var i; + var body; + var bodies = this.bodies.entries; + var len = bodies.length; + + for (i = 0; i < len; i++) + { + body = bodies[i]; + + if (body.enable) + { + body.update(delta); + } + } + + // Optionally populate our dynamic collision tree + if (this.useTree) + { + this.tree.clear(); + this.tree.load(bodies); + } + + // Process any colliders + var colliders = this.colliders.update(); + + for (i = 0; i < colliders.length; i++) + { + var collider = colliders[i]; + + if (collider.active) + { + collider.update(); + } + } + + this.emit(Events.WORLD_STEP, delta); + + this.stepsLastFrame++; + }, + + /** + * Updates bodies, draws the debug display, and handles pending queue operations. + * + * @method Phaser.Physics.Arcade.World#postUpdate + * @since 3.0.0 + */ + postUpdate: function () + { + var i; + var body; + var bodies = this.bodies.entries; + var len = bodies.length; + + var dynamic = this.bodies; + var staticBodies = this.staticBodies; + + // We don't need to postUpdate if there wasn't a step this frame + if (this.stepsLastFrame) + { + this.stepsLastFrame = 0; + + for (i = 0; i < len; i++) + { + body = bodies[i]; + + if (body.enable) + { + body.postUpdate(); + } + } + } + + if (this.drawDebug) + { + var graphics = this.debugGraphic; + + graphics.clear(); + + for (i = 0; i < len; i++) + { + body = bodies[i]; + + if (body.willDrawDebug()) + { + body.drawDebug(graphics); + } + } + + bodies = staticBodies.entries; + len = bodies.length; + + for (i = 0; i < len; i++) + { + body = bodies[i]; + + if (body.willDrawDebug()) + { + body.drawDebug(graphics); + } + } + } + + var pending = this.pendingDestroy; + + if (pending.size > 0) + { + var dynamicTree = this.tree; + var staticTree = this.staticTree; + + bodies = pending.entries; + len = bodies.length; + + for (i = 0; i < len; i++) + { + body = bodies[i]; + + if (body.physicsType === CONST.DYNAMIC_BODY) + { + dynamicTree.remove(body); + dynamic.delete(body); + } + else if (body.physicsType === CONST.STATIC_BODY) + { + staticTree.remove(body); + staticBodies.delete(body); + } + + body.world = undefined; + body.gameObject = undefined; + } + + pending.clear(); + } + }, + + /** + * Calculates a Body's velocity and updates its position. + * + * @method Phaser.Physics.Arcade.World#updateMotion + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body - The Body to be updated. + * @param {number} delta - The delta value to be used in the motion calculations, in seconds. + */ + updateMotion: function (body, delta) + { + if (body.allowRotation) + { + this.computeAngularVelocity(body, delta); + } + + this.computeVelocity(body, delta); + }, + + /** + * Calculates a Body's angular velocity. + * + * @method Phaser.Physics.Arcade.World#computeAngularVelocity + * @since 3.10.0 + * + * @param {Phaser.Physics.Arcade.Body} body - The Body to compute the velocity for. + * @param {number} delta - The delta value to be used in the calculation, in seconds. + */ + computeAngularVelocity: function (body, delta) + { + var velocity = body.angularVelocity; + var acceleration = body.angularAcceleration; + var drag = body.angularDrag; + var max = body.maxAngular; + + if (acceleration) + { + velocity += acceleration * delta; + } + else if (body.allowDrag && drag) + { + drag *= delta; + + if (FuzzyGreaterThan(velocity - drag, 0, 0.1)) + { + velocity -= drag; + } + else if (FuzzyLessThan(velocity + drag, 0, 0.1)) + { + velocity += drag; + } + else + { + velocity = 0; + } + } + + velocity = Clamp(velocity, -max, max); + + var velocityDelta = velocity - body.angularVelocity; + + body.angularVelocity += velocityDelta; + body.rotation += (body.angularVelocity * delta); + }, + + /** + * Calculates a Body's per-axis velocity. + * + * @method Phaser.Physics.Arcade.World#computeVelocity + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body - The Body to compute the velocity for. + * @param {number} delta - The delta value to be used in the calculation, in seconds. + */ + computeVelocity: function (body, delta) + { + var velocityX = body.velocity.x; + var accelerationX = body.acceleration.x; + var dragX = body.drag.x; + var maxX = body.maxVelocity.x; + + var velocityY = body.velocity.y; + var accelerationY = body.acceleration.y; + var dragY = body.drag.y; + var maxY = body.maxVelocity.y; + + var speed = body.speed; + var maxSpeed = body.maxSpeed; + var allowDrag = body.allowDrag; + var useDamping = body.useDamping; + + if (body.allowGravity) + { + velocityX += (this.gravity.x + body.gravity.x) * delta; + velocityY += (this.gravity.y + body.gravity.y) * delta; + } + + if (accelerationX) + { + velocityX += accelerationX * delta; + } + else if (allowDrag && dragX) + { + if (useDamping) + { + // Damping based deceleration + dragX = Math.pow(dragX, delta); + + velocityX *= dragX; + + speed = Math.sqrt(velocityX * velocityX + velocityY * velocityY); + + if (FuzzyEqual(speed, 0, 0.001)) + { + velocityX = 0; + } + } + else + { + // Linear deceleration + dragX *= delta; + + if (FuzzyGreaterThan(velocityX - dragX, 0, 0.01)) + { + velocityX -= dragX; + } + else if (FuzzyLessThan(velocityX + dragX, 0, 0.01)) + { + velocityX += dragX; + } + else + { + velocityX = 0; + } + } + } + + if (accelerationY) + { + velocityY += accelerationY * delta; + } + else if (allowDrag && dragY) + { + if (useDamping) + { + // Damping based deceleration + dragY = Math.pow(dragY, delta); + + velocityY *= dragY; + + speed = Math.sqrt(velocityX * velocityX + velocityY * velocityY); + + if (FuzzyEqual(speed, 0, 0.001)) + { + velocityY = 0; + } + } + else + { + // Linear deceleration + dragY *= delta; + + if (FuzzyGreaterThan(velocityY - dragY, 0, 0.01)) + { + velocityY -= dragY; + } + else if (FuzzyLessThan(velocityY + dragY, 0, 0.01)) + { + velocityY += dragY; + } + else + { + velocityY = 0; + } + } + } + + velocityX = Clamp(velocityX, -maxX, maxX); + velocityY = Clamp(velocityY, -maxY, maxY); + + body.velocity.set(velocityX, velocityY); + + if (maxSpeed > -1 && body.velocity.length() > maxSpeed) + { + body.velocity.normalize().scale(maxSpeed); + speed = maxSpeed; + } + + body.speed = speed; + }, + + /** + * Separates two Bodies. + * + * @method Phaser.Physics.Arcade.World#separate + * @fires Phaser.Physics.Arcade.Events#COLLIDE + * @fires Phaser.Physics.Arcade.Events#OVERLAP + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to be separated. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - The process callback. + * @param {*} [callbackContext] - The context in which to invoke the callback. + * @param {boolean} [overlapOnly] - If this a collide or overlap check? + * + * @return {boolean} True if separation occurred, otherwise false. + */ + separate: function (body1, body2, processCallback, callbackContext, overlapOnly) + { + var overlapX; + var overlapY; + + var result = false; + var runSeparation = true; + + if ( + !body1.enable || + !body2.enable || + body1.checkCollision.none || + body2.checkCollision.none || + !this.intersects(body1, body2)) + { + return result; + } + + // They overlap. Is there a custom process callback? If it returns true then we can carry on, otherwise we should abort. + if (processCallback && processCallback.call(callbackContext, body1.gameObject, body2.gameObject) === false) + { + return result; + } + + // Circle vs. Circle, or Circle vs. Rect + if (body1.isCircle || body2.isCircle) + { + var circleResults = this.separateCircle(body1, body2, overlapOnly); + + if (circleResults.result) + { + // We got a satisfactory result from the separateCircle method + result = true; + runSeparation = false; + } + else + { + // Further processing required + overlapX = circleResults.x; + overlapY = circleResults.y; + runSeparation = true; + } + } + + if (runSeparation) + { + var resultX = false; + var resultY = false; + var bias = this.OVERLAP_BIAS; + + // Do we separate on x first or y first or both? + if (overlapOnly) + { + // No separation but we need to calculate overlapX, overlapY, etc. + resultX = SeparateX(body1, body2, overlapOnly, bias, overlapX); + resultY = SeparateY(body1, body2, overlapOnly, bias, overlapY); + } + else if (this.forceX || Math.abs(this.gravity.y + body1.gravity.y) < Math.abs(this.gravity.x + body1.gravity.x)) + { + resultX = SeparateX(body1, body2, overlapOnly, bias, overlapX); + + // Are they still intersecting? Let's do the other axis then + if (this.intersects(body1, body2)) + { + resultY = SeparateY(body1, body2, overlapOnly, bias, overlapY); + } + } + else + { + resultY = SeparateY(body1, body2, overlapOnly, bias, overlapY); + + // Are they still intersecting? Let's do the other axis then + if (this.intersects(body1, body2)) + { + resultX = SeparateX(body1, body2, overlapOnly, bias, overlapX); + } + } + + result = (resultX || resultY); + } + + if (result) + { + if (overlapOnly) + { + if (body1.onOverlap || body2.onOverlap) + { + this.emit(Events.OVERLAP, body1.gameObject, body2.gameObject, body1, body2); + } + } + else if (body1.onCollide || body2.onCollide) + { + this.emit(Events.COLLIDE, body1.gameObject, body2.gameObject, body1, body2); + } + } + + return result; + }, + + /** + * Separates two Bodies, when both are circular. + * + * @method Phaser.Physics.Arcade.World#separateCircle + * @fires Phaser.Physics.Arcade.Events#COLLIDE + * @fires Phaser.Physics.Arcade.Events#OVERLAP + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body1 - The first Body to be separated. + * @param {Phaser.Physics.Arcade.Body} body2 - The second Body to be separated. + * @param {boolean} [overlapOnly] - If this a collide or overlap check? + * + * @return {boolean} True if separation occurred, otherwise false. + */ + separateCircle: function (body1, body2, overlapOnly) + { + // Set the AABB overlap, blocked and touching values into the bodies (we don't use the return values here) + GetOverlapX(body1, body2, false, 0); + GetOverlapY(body1, body2, false, 0); + + var body1IsCircle = body1.isCircle; + var body2IsCircle = body2.isCircle; + var body1Center = body1.center; + var body2Center = body2.center; + var body1Immovable = body1.immovable; + var body2Immovable = body2.immovable; + var body1Velocity = body1.velocity; + var body2Velocity = body2.velocity; + + var overlap = 0; + var twoCircles = true; + + if (body1IsCircle !== body2IsCircle) + { + twoCircles = false; + + var circleX = body1Center.x; + var circleY = body1Center.y; + var circleRadius = body1.halfWidth; + + var rectX = body2.position.x; + var rectY = body2.position.y; + var rectRight = body2.right; + var rectBottom = body2.bottom; + + if (body2IsCircle) + { + circleX = body2Center.x; + circleY = body2Center.y; + circleRadius = body2.halfWidth; + + rectX = body1.position.x; + rectY = body1.position.y; + rectRight = body1.right; + rectBottom = body1.bottom; + } + + if (circleY < rectY) + { + if (circleX < rectX) + { + overlap = DistanceBetween(circleX, circleY, rectX, rectY) - circleRadius; + } + else if (circleX > rectRight) + { + overlap = DistanceBetween(circleX, circleY, rectRight, rectY) - circleRadius; + } + } + else if (circleY > rectBottom) + { + if (circleX < rectX) + { + overlap = DistanceBetween(circleX, circleY, rectX, rectBottom) - circleRadius; + } + else if (circleX > rectRight) + { + overlap = DistanceBetween(circleX, circleY, rectRight, rectBottom) - circleRadius; + } + } + + // If a collision occurs in the corner points of the rectangle + // then the bodies behave like circles + overlap *= -1; + } + else + { + overlap = (body1.halfWidth + body2.halfWidth) - DistanceBetweenPoints(body1Center, body2Center); + } + + body1.overlapR = overlap; + body2.overlapR = overlap; + + var angle = AngleBetweenPoints(body1Center, body2Center); + var overlapX = (overlap + MATH_CONST.EPSILON) * Math.cos(angle); + var overlapY = (overlap + MATH_CONST.EPSILON) * Math.sin(angle); + + var results = { overlap: overlap, result: false, x: overlapX, y: overlapY }; + + // We know the AABBs already intersect before we enter this method + if (overlapOnly && (!twoCircles || (twoCircles && overlap !== 0))) + { + // Now we know the rect vs circle overlaps, or two circles do + results.result = true; + + return results; + } + + // Can't separate (in this method): + // Two immovable bodies + // A body with its own custom separation logic + // A circle vs. a rect with a face-on collision + if ((!twoCircles && overlap === 0) || (body1Immovable && body2Immovable) || body1.customSeparateX || body2.customSeparateX) + { + // Let SeparateX / SeparateY handle this + results.x = undefined; + results.y = undefined; + + return results; + } + + // If we get this far we either have circle vs. circle + // or circle vs. rect with corner collision + + var deadlock = (!body1.pushable && !body2.pushable); + + if (twoCircles) + { + var dx = body1Center.x - body2Center.x; + var dy = body1Center.y - body2Center.y; + var d = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)); + var nx = ((body2Center.x - body1Center.x) / d) || 0; + var ny = ((body2Center.y - body1Center.y) / d) || 0; + var p = 2 * (body1Velocity.x * nx + body1Velocity.y * ny - body2Velocity.x * nx - body2Velocity.y * ny) / (body1.mass + body2.mass); + + if (body1Immovable || body2Immovable) + { + p *= 2; + } + + if (!body1Immovable) + { + body1Velocity.x = (body1Velocity.x - p / body1.mass * nx); + body1Velocity.y = (body1Velocity.y - p / body1.mass * ny); + body1Velocity.multiply(body1.bounce); + } + + if (!body2Immovable) + { + body2Velocity.x = (body2Velocity.x + p / body2.mass * nx); + body2Velocity.y = (body2Velocity.y + p / body2.mass * ny); + body2Velocity.multiply(body2.bounce); + } + + if (!body1Immovable && !body2Immovable) + { + overlapX *= 0.5; + overlapY *= 0.5; + } + + if (!body1Immovable) + { + body1.x -= overlapX; + body1.y -= overlapY; + + body1.updateCenter(); + } + + if (!body2Immovable) + { + body2.x += overlapX; + body2.y += overlapY; + + body2.updateCenter(); + } + + results.result = true; + } + else + { + // Circle vs. Rect + // We'll only move the circle (if we can) and let + // the runSeparation handle the rectangle + + if (!body1Immovable || body1.pushable || deadlock) + { + body1.x -= overlapX; + body1.y -= overlapY; + + body1.updateCenter(); + } + else if (!body2Immovable || body2.pushable || deadlock) + { + body2.x += overlapX; + body2.y += overlapY; + + body2.updateCenter(); + } + + // Let SeparateX / SeparateY handle this further + results.x = undefined; + results.y = undefined; + } + + return results; + }, + + /** + * Checks to see if two Bodies intersect at all. + * + * @method Phaser.Physics.Arcade.World#intersects + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body1 - The first body to check. + * @param {Phaser.Physics.Arcade.Body} body2 - The second body to check. + * + * @return {boolean} True if the two bodies intersect, otherwise false. + */ + intersects: function (body1, body2) + { + if (body1 === body2) + { + return false; + } + + if (!body1.isCircle && !body2.isCircle) + { + // Rect vs. Rect + return !( + body1.right <= body2.left || + body1.bottom <= body2.top || + body1.left >= body2.right || + body1.top >= body2.bottom + ); + } + else if (body1.isCircle) + { + if (body2.isCircle) + { + // Circle vs. Circle + return DistanceBetweenPoints(body1.center, body2.center) <= (body1.halfWidth + body2.halfWidth); + } + else + { + // Circle vs. Rect + return this.circleBodyIntersects(body1, body2); + } + } + else + { + // Rect vs. Circle + return this.circleBodyIntersects(body2, body1); + } + }, + + /** + * Tests if a circular Body intersects with another Body. + * + * @method Phaser.Physics.Arcade.World#circleBodyIntersects + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} circle - The circular body to test. + * @param {Phaser.Physics.Arcade.Body} body - The rectangular body to test. + * + * @return {boolean} True if the two bodies intersect, otherwise false. + */ + circleBodyIntersects: function (circle, body) + { + var x = Clamp(circle.center.x, body.left, body.right); + var y = Clamp(circle.center.y, body.top, body.bottom); + + var dx = (circle.center.x - x) * (circle.center.x - x); + var dy = (circle.center.y - y) * (circle.center.y - y); + + return (dx + dy) <= (circle.halfWidth * circle.halfWidth); + }, + + /** + * Tests if Game Objects overlap. + * + * See details in {@link Phaser.Physics.Arcade.World#collide}. + * + * @method Phaser.Physics.Arcade.World#overlap + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [overlapCallback] - An optional callback function that is called if the objects overlap. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they overlap. If this is set then `overlapCallback` will only be called if this callback returns `true`. + * @param {*} [callbackContext] - The context in which to run the callbacks. + * + * @return {boolean} True if at least one Game Object overlaps another. + * + * @see Phaser.Physics.Arcade.World#collide + */ + overlap: function (object1, object2, overlapCallback, processCallback, callbackContext) + { + if (overlapCallback === undefined) { overlapCallback = null; } + if (processCallback === undefined) { processCallback = null; } + if (callbackContext === undefined) { callbackContext = overlapCallback; } + + return this.collideObjects(object1, object2, overlapCallback, processCallback, callbackContext, true); + }, + + /** + * Performs a collision check and separation between the two physics enabled objects given, which can be single + * Game Objects, arrays of Game Objects, Physics Groups, arrays of Physics Groups or normal Groups. + * + * If you don't require separation then use {@link Phaser.Physics.Arcade.World#overlap} instead. + * + * If two Groups or arrays are passed, each member of one will be tested against each member of the other. + * + * If **only** one Group is passed (as `object1`), each member of the Group will be collided against the other members. + * + * If **only** one Array is passed, the array is iterated and every element in it is tested against the others. + * + * Two callbacks can be provided; they receive the colliding game objects as arguments. + * If an overlap is detected, the `processCallback` is called first. It can cancel the collision by returning false. + * Next the objects are separated and `collideCallback` is invoked. + * + * Arcade Physics uses the Projection Method of collision resolution and separation. While it's fast and suitable + * for 'arcade' style games it lacks stability when multiple objects are in close proximity or resting upon each other. + * The separation that stops two objects penetrating may create a new penetration against a different object. If you + * require a high level of stability please consider using an alternative physics system, such as Matter.js. + * + * @method Phaser.Physics.Arcade.World#collide + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * + * @return {boolean} `true` if any overlapping Game Objects were separated, otherwise `false`. + */ + collide: function (object1, object2, collideCallback, processCallback, callbackContext) + { + if (collideCallback === undefined) { collideCallback = null; } + if (processCallback === undefined) { processCallback = null; } + if (callbackContext === undefined) { callbackContext = collideCallback; } + + return this.collideObjects(object1, object2, collideCallback, processCallback, callbackContext, false); + }, + + /** + * Internal helper function. Please use Phaser.Physics.Arcade.World#collide instead. + * + * @method Phaser.Physics.Arcade.World#collideObjects + * @private + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} [object2] - The second object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. + * @param {any} callbackContext - The scope in which to call the callbacks. + * @param {boolean} overlapOnly - Whether this is a collision or overlap check. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + collideObjects: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly) + { + var i; + var j; + + if (object1.isParent && (object1.physicsType === undefined || object2 === undefined || object1 === object2)) + { + object1 = object1.children.entries; + } + + if (object2 && object2.isParent && object2.physicsType === undefined) + { + object2 = object2.children.entries; + } + + var object1isArray = Array.isArray(object1); + var object2isArray = Array.isArray(object2); + + this._total = 0; + + if (!object1isArray && !object2isArray) + { + // Neither of them are arrays - do this first as it's the most common use-case + this.collideHandler(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly); + } + else if (!object1isArray && object2isArray) + { + // Object 2 is an Array + for (i = 0; i < object2.length; i++) + { + this.collideHandler(object1, object2[i], collideCallback, processCallback, callbackContext, overlapOnly); + } + } + else if (object1isArray && !object2isArray) + { + // Object 1 is an Array + if (!object2) + { + // Special case for array vs. self + for (i = 0; i < object1.length; i++) + { + var child = object1[i]; + + for (j = i + 1; j < object1.length; j++) + { + if (i === j) + { + continue; + } + + this.collideHandler(child, object1[j], collideCallback, processCallback, callbackContext, overlapOnly); + } + } + } + else + { + for (i = 0; i < object1.length; i++) + { + this.collideHandler(object1[i], object2, collideCallback, processCallback, callbackContext, overlapOnly); + } + } + } + else + { + // They're both arrays + for (i = 0; i < object1.length; i++) + { + for (j = 0; j < object2.length; j++) + { + this.collideHandler(object1[i], object2[j], collideCallback, processCallback, callbackContext, overlapOnly); + } + } + } + + return (this._total > 0); + }, + + /** + * Internal helper function. Please use Phaser.Physics.Arcade.World#collide and Phaser.Physics.Arcade.World#overlap instead. + * + * @method Phaser.Physics.Arcade.World#collideHandler + * @private + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object or array of objects to check. + * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object2 - The second object or array of objects to check, or `undefined`. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} collideCallback - An optional callback function that is called if the objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} processCallback - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} callbackContext - The context in which to run the callbacks. + * @param {boolean} overlapOnly - Whether this is a collision or overlap check. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + collideHandler: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly) + { + // Collide Group with Self + // Only collide valid objects + if (object2 === undefined && object1.isParent) + { + return this.collideGroupVsGroup(object1, object1, collideCallback, processCallback, callbackContext, overlapOnly); + } + + // If neither of the objects are set then bail out + if (!object1 || !object2) + { + return false; + } + + // SPRITE + if (object1.body || object1.isBody) + { + if (object2.body || object2.isBody) + { + return this.collideSpriteVsSprite(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly); + } + else if (object2.isParent) + { + return this.collideSpriteVsGroup(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly); + } + else if (object2.isTilemap) + { + return this.collideSpriteVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly); + } + } + + // GROUPS + else if (object1.isParent) + { + if (object2.body || object2.isBody) + { + return this.collideSpriteVsGroup(object2, object1, collideCallback, processCallback, callbackContext, overlapOnly); + } + else if (object2.isParent) + { + return this.collideGroupVsGroup(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly); + } + else if (object2.isTilemap) + { + return this.collideGroupVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly); + } + } + + // TILEMAP LAYERS + else if (object1.isTilemap) + { + if (object2.body || object2.isBody) + { + return this.collideSpriteVsTilemapLayer(object2, object1, collideCallback, processCallback, callbackContext, overlapOnly); + } + else if (object2.isParent) + { + return this.collideGroupVsTilemapLayer(object2, object1, collideCallback, processCallback, callbackContext, overlapOnly); + } + } + }, + + /** + * Internal handler for Sprite vs. Sprite collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. + * + * @method Phaser.Physics.Arcade.World#collideSpriteVsSprite + * @private + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} sprite1 - The first object to check for collision. + * @param {Phaser.GameObjects.GameObject} sprite2 - The second object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * @param {boolean} overlapOnly - Whether this is a collision or overlap check. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + collideSpriteVsSprite: function (sprite1, sprite2, collideCallback, processCallback, callbackContext, overlapOnly) + { + var body1 = (sprite1.isBody) ? sprite1 : sprite1.body; + var body2 = (sprite2.isBody) ? sprite2 : sprite2.body; + + if (!body1 || !body2) + { + return false; + } + + if (this.separate(body1, body2, processCallback, callbackContext, overlapOnly)) + { + if (collideCallback) + { + collideCallback.call(callbackContext, sprite1, sprite2); + } + + this._total++; + } + + return true; + }, + + /** + * Internal handler for Sprite vs. Group collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. + * + * @method Phaser.Physics.Arcade.World#collideSpriteVsGroup + * @private + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.GameObjects.Group} group - The second object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean. + * @param {any} callbackContext - The scope in which to call the callbacks. + * @param {boolean} overlapOnly - Whether this is a collision or overlap check. + * + * @return {boolean} `true` if the Sprite collided with the given Group, otherwise `false`. + */ + collideSpriteVsGroup: function (sprite, group, collideCallback, processCallback, callbackContext, overlapOnly) + { + var bodyA = (sprite.isBody) ? sprite : sprite.body; + + if (group.length === 0 || !bodyA || !bodyA.enable || bodyA.checkCollision.none) + { + return; + } + + // Does sprite collide with anything? + + var i; + var len; + var bodyB; + + if (this.useTree || group.physicsType === CONST.STATIC_BODY) + { + var minMax = this.treeMinMax; + + minMax.minX = bodyA.left; + minMax.minY = bodyA.top; + minMax.maxX = bodyA.right; + minMax.maxY = bodyA.bottom; + + var results = (group.physicsType === CONST.DYNAMIC_BODY) ? this.tree.search(minMax) : this.staticTree.search(minMax); + + len = results.length; + + for (i = 0; i < len; i++) + { + bodyB = results[i]; + + if (bodyA === bodyB || !bodyB.enable || bodyB.checkCollision.none || !group.contains(bodyB.gameObject)) + { + // Skip if comparing against itself, or if bodyB isn't collidable, or if bodyB isn't actually part of the Group + continue; + } + + if (this.separate(bodyA, bodyB, processCallback, callbackContext, overlapOnly)) + { + if (collideCallback) + { + collideCallback.call(callbackContext, bodyA.gameObject, bodyB.gameObject); + } + + this._total++; + } + } + } + else + { + var children = group.getChildren(); + var skipIndex = group.children.entries.indexOf(sprite); + + len = children.length; + + for (i = 0; i < len; i++) + { + bodyB = children[i].body; + + if (!bodyB || i === skipIndex || !bodyB.enable) + { + continue; + } + + if (this.separate(bodyA, bodyB, processCallback, callbackContext, overlapOnly)) + { + if (collideCallback) + { + collideCallback.call(callbackContext, bodyA.gameObject, bodyB.gameObject); + } + + this._total++; + } + } + } + }, + + /** + * Internal handler for Group vs. Tilemap collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. + * + * @method Phaser.Physics.Arcade.World#collideGroupVsTilemapLayer + * @private + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Group} group - The first object to check for collision. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The second object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} collideCallback - An optional callback function that is called if the objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} processCallback - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} callbackContext - The context in which to run the callbacks. + * @param {boolean} overlapOnly - Whether this is a collision or overlap check. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + collideGroupVsTilemapLayer: function (group, tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly) + { + var children = group.getChildren(); + + if (children.length === 0) + { + return false; + } + + var didCollide = false; + + for (var i = 0; i < children.length; i++) + { + if (children[i].body || children[i].isBody) + { + if (this.collideSpriteVsTilemapLayer(children[i], tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly)) + { + didCollide = true; + } + } + } + + return didCollide; + }, + + /** + * This advanced method is specifically for testing for collision between a single Sprite and an array of Tile objects. + * + * You should generally use the `collide` method instead, with a Sprite vs. a Tilemap Layer, as that will perform + * tile filtering and culling for you, as well as handle the interesting face collision automatically. + * + * This method is offered for those who would like to check for collision with specific Tiles in a layer, without + * having to set any collision attributes on the tiles in question. This allows you to perform quick dynamic collisions + * on small sets of Tiles. As such, no culling or checks are made to the array of Tiles given to this method, + * you should filter them before passing them to this method. + * + * Important: Use of this method skips the `interesting faces` system that Tilemap Layers use. This means if you have + * say a row or column of tiles, and you jump into, or walk over them, it's possible to get stuck on the edges of the + * tiles as the interesting face calculations are skipped. However, for quick-fire small collision set tests on + * dynamic maps, this method can prove very useful. + * + * @method Phaser.Physics.Arcade.World#collideTiles + * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @since 3.17.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.Tilemaps.Tile[]} tiles - An array of Tiles to check for collision against. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + collideTiles: function (sprite, tiles, collideCallback, processCallback, callbackContext) + { + if (tiles.length === 0 || (sprite.body && !sprite.body.enable) || (sprite.isBody && !sprite.enable)) + { + return false; + } + else + { + return this.collideSpriteVsTilesHandler(sprite, tiles, collideCallback, processCallback, callbackContext, false, false); + } + }, + + /** + * This advanced method is specifically for testing for overlaps between a single Sprite and an array of Tile objects. + * + * You should generally use the `overlap` method instead, with a Sprite vs. a Tilemap Layer, as that will perform + * tile filtering and culling for you, as well as handle the interesting face collision automatically. + * + * This method is offered for those who would like to check for overlaps with specific Tiles in a layer, without + * having to set any collision attributes on the tiles in question. This allows you to perform quick dynamic overlap + * tests on small sets of Tiles. As such, no culling or checks are made to the array of Tiles given to this method, + * you should filter them before passing them to this method. + * + * @method Phaser.Physics.Arcade.World#overlapTiles + * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP + * @since 3.17.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.Tilemaps.Tile[]} tiles - An array of Tiles to check for collision against. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects overlap. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + overlapTiles: function (sprite, tiles, collideCallback, processCallback, callbackContext) + { + if (tiles.length === 0 || (sprite.body && !sprite.body.enable) || (sprite.isBody && !sprite.enable)) + { + return false; + } + else + { + return this.collideSpriteVsTilesHandler(sprite, tiles, collideCallback, processCallback, callbackContext, true, false); + } + }, + + /** + * Internal handler for Sprite vs. Tilemap collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. + * + * @method Phaser.Physics.Arcade.World#collideSpriteVsTilemapLayer + * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The second object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * @param {boolean} [overlapOnly] - Whether this is a collision or overlap check. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + collideSpriteVsTilemapLayer: function (sprite, tilemapLayer, collideCallback, processCallback, callbackContext, overlapOnly) + { + var body = (sprite.isBody) ? sprite : sprite.body; + + if (!body.enable || body.checkCollision.none) + { + return false; + } + + var x = body.x; + var y = body.y; + var w = body.width; + var h = body.height; + + var layerData = tilemapLayer.layer; + + if (layerData.tileWidth > layerData.baseTileWidth) + { + // The x origin of a tile is the left side, so x and width need to be adjusted. + var xDiff = (layerData.tileWidth - layerData.baseTileWidth) * tilemapLayer.scaleX; + x -= xDiff; + w += xDiff; + } + + if (layerData.tileHeight > layerData.baseTileHeight) + { + // The y origin of a tile is the bottom side, so just the height needs to be adjusted. + var yDiff = (layerData.tileHeight - layerData.baseTileHeight) * tilemapLayer.scaleY; + h += yDiff; + } + + var options = (overlapOnly) ? null : this.tileFilterOptions; + + var mapData = GetTilesWithinWorldXY(x, y, w, h, options, tilemapLayer.scene.cameras.main, tilemapLayer.layer); + + if (mapData.length === 0) + { + return false; + } + else + { + return this.collideSpriteVsTilesHandler(sprite, mapData, collideCallback, processCallback, callbackContext, overlapOnly, true); + } + }, + + /** + * Internal handler for Sprite vs. Tilemap collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. + * + * @method Phaser.Physics.Arcade.World#collideSpriteVsTilesHandler + * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP + * @private + * @since 3.17.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The second object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * @param {boolean} [overlapOnly] - Whether this is a collision or overlap check. + * @param {boolean} [isLayer] - Is this check coming from a TilemapLayer or an array of tiles? + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + collideSpriteVsTilesHandler: function (sprite, tiles, collideCallback, processCallback, callbackContext, overlapOnly, isLayer) + { + var body = (sprite.isBody) ? sprite : sprite.body; + + var tile; + var tileWorldRect = { left: 0, right: 0, top: 0, bottom: 0 }; + var tilemapLayer; + var collision = false; + + for (var i = 0; i < tiles.length; i++) + { + tile = tiles[i]; + + tilemapLayer = tile.tilemapLayer; + + var point = tilemapLayer.tileToWorldXY(tile.x, tile.y); + + tileWorldRect.left = point.x; + tileWorldRect.top = point.y; + + // If the maps base tile size differs from the layer tile size, only the top of the rect + // needs to be adjusted since its origin is (0, 1). + if (tile.baseHeight !== tile.height) + { + tileWorldRect.top -= (tile.height - tile.baseHeight) * tilemapLayer.scaleY; + } + + tileWorldRect.right = tileWorldRect.left + tile.width * tilemapLayer.scaleX; + tileWorldRect.bottom = tileWorldRect.top + tile.height * tilemapLayer.scaleY; + + if (TileIntersectsBody(tileWorldRect, body) + && (!processCallback || processCallback.call(callbackContext, sprite, tile)) + && ProcessTileCallbacks(tile, sprite) + && (overlapOnly || SeparateTile(i, body, tile, tileWorldRect, tilemapLayer, this.TILE_BIAS, isLayer))) + { + this._total++; + + collision = true; + + if (collideCallback) + { + collideCallback.call(callbackContext, sprite, tile); + } + + if (overlapOnly && body.onOverlap) + { + this.emit(Events.TILE_OVERLAP, sprite, tile, body); + } + else if (body.onCollide) + { + this.emit(Events.TILE_COLLIDE, sprite, tile, body); + } + } + } + + return collision; + }, + + /** + * Internal helper for Group vs. Group collisions. + * Please use Phaser.Physics.Arcade.World#collide instead. + * + * @method Phaser.Physics.Arcade.World#collideGroupVsGroup + * @private + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Group} group1 - The first object to check for collision. + * @param {Phaser.GameObjects.Group} group2 - The second object to check for collision. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. + * @param {any} [callbackContext] - The context in which to run the callbacks. + * @param {boolean} overlapOnly - Whether this is a collision or overlap check. + * + * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. + */ + collideGroupVsGroup: function (group1, group2, collideCallback, processCallback, callbackContext, overlapOnly) + { + if (group1.length === 0 || group2.length === 0) + { + return; + } + + var children = group1.getChildren(); + + for (var i = 0; i < children.length; i++) + { + this.collideSpriteVsGroup(children[i], group2, collideCallback, processCallback, callbackContext, overlapOnly); + } + }, + + /** + * Wrap an object's coordinates (or several objects' coordinates) within {@link Phaser.Physics.Arcade.World#bounds}. + * + * If the object is outside any boundary edge (left, top, right, bottom), it will be moved to the same offset from the opposite edge (the interior). + * + * @method Phaser.Physics.Arcade.World#wrap + * @since 3.3.0 + * + * @param {any} object - A Game Object, a Group, an object with `x` and `y` coordinates, or an array of such objects. + * @param {number} [padding=0] - An amount added to each boundary edge during the operation. + */ + wrap: function (object, padding) + { + if (object.body) + { + this.wrapObject(object, padding); + } + else if (object.getChildren) + { + this.wrapArray(object.getChildren(), padding); + } + else if (Array.isArray(object)) + { + this.wrapArray(object, padding); + } + else + { + this.wrapObject(object, padding); + } + }, + + /** + * Wrap each object's coordinates within {@link Phaser.Physics.Arcade.World#bounds}. + * + * @method Phaser.Physics.Arcade.World#wrapArray + * @since 3.3.0 + * + * @param {Array.<*>} objects - An array of objects to be wrapped. + * @param {number} [padding=0] - An amount added to the boundary. + */ + wrapArray: function (objects, padding) + { + for (var i = 0; i < objects.length; i++) + { + this.wrapObject(objects[i], padding); + } + }, + + /** + * Wrap an object's coordinates within {@link Phaser.Physics.Arcade.World#bounds}. + * + * @method Phaser.Physics.Arcade.World#wrapObject + * @since 3.3.0 + * + * @param {*} object - A Game Object, a Physics Body, or any object with `x` and `y` coordinates + * @param {number} [padding=0] - An amount added to the boundary. + */ + wrapObject: function (object, padding) + { + if (padding === undefined) { padding = 0; } + + object.x = Wrap(object.x, this.bounds.left - padding, this.bounds.right + padding); + object.y = Wrap(object.y, this.bounds.top - padding, this.bounds.bottom + padding); + }, + + /** + * Shuts down the simulation, clearing physics data and removing listeners. + * + * @method Phaser.Physics.Arcade.World#shutdown + * @since 3.0.0 + */ + shutdown: function () + { + this.tree.clear(); + this.staticTree.clear(); + this.bodies.clear(); + this.staticBodies.clear(); + this.colliders.destroy(); + + this.removeAllListeners(); + }, + + /** + * Shuts down the simulation and disconnects it from the current scene. + * + * @method Phaser.Physics.Arcade.World#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.shutdown(); + + this.scene = null; + + if (this.debugGraphic) + { + this.debugGraphic.destroy(); + this.debugGraphic = null; + } + } + +}); + +module.exports = World; + + +/***/ }), + +/***/ 5321: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods used for setting the acceleration properties of an Arcade Physics Body. + * + * @namespace Phaser.Physics.Arcade.Components.Acceleration + * @since 3.0.0 + */ +var Acceleration = { + + /** + * Sets the body's horizontal and vertical acceleration. If the vertical acceleration value is not provided, the vertical acceleration is set to the same value as the horizontal acceleration. + * + * @method Phaser.Physics.Arcade.Components.Acceleration#setAcceleration + * @since 3.0.0 + * + * @param {number} x - The horizontal acceleration + * @param {number} [y=x] - The vertical acceleration + * + * @return {this} This Game Object. + */ + setAcceleration: function (x, y) + { + this.body.acceleration.set(x, y); + + return this; + }, + + /** + * Sets the body's horizontal acceleration. + * + * @method Phaser.Physics.Arcade.Components.Acceleration#setAccelerationX + * @since 3.0.0 + * + * @param {number} value - The horizontal acceleration + * + * @return {this} This Game Object. + */ + setAccelerationX: function (value) + { + this.body.acceleration.x = value; + + return this; + }, + + /** + * Sets the body's vertical acceleration. + * + * @method Phaser.Physics.Arcade.Components.Acceleration#setAccelerationY + * @since 3.0.0 + * + * @param {number} value - The vertical acceleration + * + * @return {this} This Game Object. + */ + setAccelerationY: function (value) + { + this.body.acceleration.y = value; + + return this; + } + +}; + +module.exports = Acceleration; + + +/***/ }), + +/***/ 29257: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods used for setting the angular acceleration properties of an Arcade Physics Body. + * + * @namespace Phaser.Physics.Arcade.Components.Angular + * @since 3.0.0 + */ +var Angular = { + + /** + * Sets the angular velocity of the body. + * + * In Arcade Physics, bodies cannot rotate. They are always axis-aligned. + * However, they can have angular motion, which is passed on to the Game Object bound to the body, + * causing them to visually rotate, even though the body remains axis-aligned. + * + * @method Phaser.Physics.Arcade.Components.Angular#setAngularVelocity + * @since 3.0.0 + * + * @param {number} value - The amount of angular velocity. + * + * @return {this} This Game Object. + */ + setAngularVelocity: function (value) + { + this.body.angularVelocity = value; + + return this; + }, + + /** + * Sets the angular acceleration of the body. + * + * In Arcade Physics, bodies cannot rotate. They are always axis-aligned. + * However, they can have angular motion, which is passed on to the Game Object bound to the body, + * causing them to visually rotate, even though the body remains axis-aligned. + * + * @method Phaser.Physics.Arcade.Components.Angular#setAngularAcceleration + * @since 3.0.0 + * + * @param {number} value - The amount of angular acceleration. + * + * @return {this} This Game Object. + */ + setAngularAcceleration: function (value) + { + this.body.angularAcceleration = value; + + return this; + }, + + /** + * Sets the angular drag of the body. Drag is applied to the current velocity, providing a form of deceleration. + * + * @method Phaser.Physics.Arcade.Components.Angular#setAngularDrag + * @since 3.0.0 + * + * @param {number} value - The amount of drag. + * + * @return {this} This Game Object. + */ + setAngularDrag: function (value) + { + this.body.angularDrag = value; + + return this; + } + +}; + +module.exports = Angular; + + +/***/ }), + +/***/ 62122: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods used for setting the bounce properties of an Arcade Physics Body. + * + * @namespace Phaser.Physics.Arcade.Components.Bounce + * @since 3.0.0 + */ +var Bounce = { + + /** + * Sets the bounce values of this body. + * + * Bounce is the amount of restitution, or elasticity, the body has when it collides with another object. + * A value of 1 means that it will retain its full velocity after the rebound. A value of 0 means it will not rebound at all. + * + * @method Phaser.Physics.Arcade.Components.Bounce#setBounce + * @since 3.0.0 + * + * @param {number} x - The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1. + * @param {number} [y=x] - The amount of vertical bounce to apply on collision. A float, typically between 0 and 1. + * + * @return {this} This Game Object. + */ + setBounce: function (x, y) + { + this.body.bounce.set(x, y); + + return this; + }, + + /** + * Sets the horizontal bounce value for this body. + * + * @method Phaser.Physics.Arcade.Components.Bounce#setBounceX + * @since 3.0.0 + * + * @param {number} value - The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1. + * + * @return {this} This Game Object. + */ + setBounceX: function (value) + { + this.body.bounce.x = value; + + return this; + }, + + /** + * Sets the vertical bounce value for this body. + * + * @method Phaser.Physics.Arcade.Components.Bounce#setBounceY + * @since 3.0.0 + * + * @param {number} value - The amount of vertical bounce to apply on collision. A float, typically between 0 and 1. + * + * @return {this} This Game Object. + */ + setBounceY: function (value) + { + this.body.bounce.y = value; + + return this; + }, + + /** + * Sets whether this Body collides with the world boundary. + * + * Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Phaser.Math.Vector2 first. + * + * @method Phaser.Physics.Arcade.Components.Bounce#setCollideWorldBounds + * @since 3.0.0 + * + * @param {boolean} [value=true] - `true` if this body should collide with the world bounds, otherwise `false`. + * @param {number} [bounceX] - If given this will be replace the `worldBounce.x` value. + * @param {number} [bounceY] - If given this will be replace the `worldBounce.y` value. + * @param {boolean} [onWorldBounds] - If given this replaces the Body's `onWorldBounds` value. + * + * @return {this} This Game Object. + */ + setCollideWorldBounds: function (value, bounceX, bounceY, onWorldBounds) + { + this.body.setCollideWorldBounds(value, bounceX, bounceY, onWorldBounds); + + return this; + } + +}; + +module.exports = Bounce; + + +/***/ }), + +/***/ 99803: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods used for setting the debug properties of an Arcade Physics Body. + * + * @namespace Phaser.Physics.Arcade.Components.Debug + * @since 3.0.0 + */ +var Debug = { + + /** + * Sets the debug values of this body. + * + * Bodies will only draw their debug if debug has been enabled for Arcade Physics as a whole. + * Note that there is a performance cost in drawing debug displays. It should never be used in production. + * + * @method Phaser.Physics.Arcade.Components.Debug#setDebug + * @since 3.0.0 + * + * @param {boolean} showBody - Set to `true` to have this body render its outline to the debug display. + * @param {boolean} showVelocity - Set to `true` to have this body render a velocity marker to the debug display. + * @param {number} bodyColor - The color of the body outline when rendered to the debug display. + * + * @return {this} This Game Object. + */ + setDebug: function (showBody, showVelocity, bodyColor) + { + this.debugShowBody = showBody; + this.debugShowVelocity = showVelocity; + this.debugBodyColor = bodyColor; + + return this; + }, + + /** + * Sets the color of the body outline when it renders to the debug display. + * + * @method Phaser.Physics.Arcade.Components.Debug#setDebugBodyColor + * @since 3.0.0 + * + * @param {number} value - The color of the body outline when rendered to the debug display. + * + * @return {this} This Game Object. + */ + setDebugBodyColor: function (value) + { + this.body.debugBodyColor = value; + + return this; + }, + + /** + * Set to `true` to have this body render its outline to the debug display. + * + * @name Phaser.Physics.Arcade.Components.Debug#debugShowBody + * @type {boolean} + * @since 3.0.0 + */ + debugShowBody: { + + get: function () + { + return this.body.debugShowBody; + }, + + set: function (value) + { + this.body.debugShowBody = value; + } + + }, + + /** + * Set to `true` to have this body render a velocity marker to the debug display. + * + * @name Phaser.Physics.Arcade.Components.Debug#debugShowVelocity + * @type {boolean} + * @since 3.0.0 + */ + debugShowVelocity: { + + get: function () + { + return this.body.debugShowVelocity; + }, + + set: function (value) + { + this.body.debugShowVelocity = value; + } + + }, + + /** + * The color of the body outline when it renders to the debug display. + * + * @name Phaser.Physics.Arcade.Components.Debug#debugBodyColor + * @type {number} + * @since 3.0.0 + */ + debugBodyColor: { + + get: function () + { + return this.body.debugBodyColor; + }, + + set: function (value) + { + this.body.debugBodyColor = value; + } + + } + +}; + +module.exports = Debug; + + +/***/ }), + +/***/ 87145: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods used for setting the drag properties of an Arcade Physics Body. + * + * @namespace Phaser.Physics.Arcade.Components.Drag + * @since 3.0.0 + */ +var Drag = { + + /** + * Sets the body's horizontal and vertical drag. If the vertical drag value is not provided, the vertical drag is set to the same value as the horizontal drag. + * + * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. + * It is the absolute loss of velocity due to movement, in pixels per second squared. + * The x and y components are applied separately. + * + * When `useDamping` is true, this is 1 minus the damping factor. + * A value of 1 means the Body loses no velocity. + * A value of 0.95 means the Body loses 5% of its velocity per step. + * A value of 0.5 means the Body loses 50% of its velocity per step. + * + * Drag is applied only when `acceleration` is zero. + * + * @method Phaser.Physics.Arcade.Components.Drag#setDrag + * @since 3.0.0 + * + * @param {number} x - The amount of horizontal drag to apply. + * @param {number} [y=x] - The amount of vertical drag to apply. + * + * @return {this} This Game Object. + */ + setDrag: function (x, y) + { + this.body.drag.set(x, y); + + return this; + }, + + /** + * Sets the body's horizontal drag. + * + * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. + * It is the absolute loss of velocity due to movement, in pixels per second squared. + * The x and y components are applied separately. + * + * When `useDamping` is true, this is 1 minus the damping factor. + * A value of 1 means the Body loses no velocity. + * A value of 0.95 means the Body loses 5% of its velocity per step. + * A value of 0.5 means the Body loses 50% of its velocity per step. + * + * Drag is applied only when `acceleration` is zero. + * + * @method Phaser.Physics.Arcade.Components.Drag#setDragX + * @since 3.0.0 + * + * @param {number} value - The amount of horizontal drag to apply. + * + * @return {this} This Game Object. + */ + setDragX: function (value) + { + this.body.drag.x = value; + + return this; + }, + + /** + * Sets the body's vertical drag. + * + * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. + * It is the absolute loss of velocity due to movement, in pixels per second squared. + * The x and y components are applied separately. + * + * When `useDamping` is true, this is 1 minus the damping factor. + * A value of 1 means the Body loses no velocity. + * A value of 0.95 means the Body loses 5% of its velocity per step. + * A value of 0.5 means the Body loses 50% of its velocity per step. + * + * Drag is applied only when `acceleration` is zero. + * + * @method Phaser.Physics.Arcade.Components.Drag#setDragY + * @since 3.0.0 + * + * @param {number} value - The amount of vertical drag to apply. + * + * @return {this} This Game Object. + */ + setDragY: function (value) + { + this.body.drag.y = value; + + return this; + }, + + /** + * If this Body is using `drag` for deceleration this function controls how the drag is applied. + * If set to `true` drag will use a damping effect rather than a linear approach. If you are + * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in + * the game Asteroids) then you will get a far smoother and more visually correct deceleration + * by using damping, avoiding the axis-drift that is prone with linear deceleration. + * + * If you enable this property then you should use far smaller `drag` values than with linear, as + * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow + * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately. + * + * @method Phaser.Physics.Arcade.Components.Drag#setDamping + * @since 3.10.0 + * + * @param {boolean} value - `true` to use damping for deceleration, or `false` to use linear deceleration. + * + * @return {this} This Game Object. + */ + setDamping: function (value) + { + this.body.useDamping = value; + + return this; + } + +}; + +module.exports = Drag; + + +/***/ }), + +/***/ 96174: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods used for setting the enable properties of an Arcade Physics Body. + * + * @namespace Phaser.Physics.Arcade.Components.Enable + * @since 3.0.0 + */ +var Enable = { + + /** + * Enables this Game Object's Body. + * If you reset the Body you must also pass `x` and `y`. + * + * @method Phaser.Physics.Arcade.Components.Enable#enableBody + * @since 3.0.0 + * + * @param {boolean} [reset] - Also reset the Body and place the Game Object at (x, y). + * @param {number} [x] - The horizontal position to place the Game Object, if `reset` is true. + * @param {number} [y] - The horizontal position to place the Game Object, if `reset` is true. + * @param {boolean} [enableGameObject] - Also set this Game Object's `active` to true. + * @param {boolean} [showGameObject] - Also set this Game Object's `visible` to true. + * + * @return {this} This Game Object. + * + * @see Phaser.Physics.Arcade.Body#enable + * @see Phaser.Physics.Arcade.StaticBody#enable + * @see Phaser.Physics.Arcade.Body#reset + * @see Phaser.Physics.Arcade.StaticBody#reset + * @see Phaser.GameObjects.GameObject#active + * @see Phaser.GameObjects.GameObject#visible + */ + enableBody: function (reset, x, y, enableGameObject, showGameObject) + { + if (reset) + { + this.body.reset(x, y); + } + + if (enableGameObject) + { + this.body.gameObject.active = true; + } + + if (showGameObject) + { + this.body.gameObject.visible = true; + } + + this.body.enable = true; + + return this; + }, + + /** + * Stops and disables this Game Object's Body. + * + * @method Phaser.Physics.Arcade.Components.Enable#disableBody + * @since 3.0.0 + * + * @param {boolean} [disableGameObject=false] - Also set this Game Object's `active` to false. + * @param {boolean} [hideGameObject=false] - Also set this Game Object's `visible` to false. + * + * @return {this} This Game Object. + * + * @see Phaser.Physics.Arcade.Body#enable + * @see Phaser.Physics.Arcade.StaticBody#enable + * @see Phaser.GameObjects.GameObject#active + * @see Phaser.GameObjects.GameObject#visible + */ + disableBody: function (disableGameObject, hideGameObject) + { + if (disableGameObject === undefined) { disableGameObject = false; } + if (hideGameObject === undefined) { hideGameObject = false; } + + this.body.stop(); + + this.body.enable = false; + + if (disableGameObject) + { + this.body.gameObject.active = false; + } + + if (hideGameObject) + { + this.body.gameObject.visible = false; + } + + return this; + }, + + /** + * Syncs the Body's position and size with its parent Game Object. + * You don't need to call this for Dynamic Bodies, as it happens automatically. + * But for Static bodies it's a useful way of modifying the position of a Static Body + * in the Physics World, based on its Game Object. + * + * @method Phaser.Physics.Arcade.Components.Enable#refreshBody + * @since 3.1.0 + * + * @return {this} This Game Object. + * + * @see Phaser.Physics.Arcade.StaticBody#updateFromGameObject + */ + refreshBody: function () + { + this.body.updateFromGameObject(); + + return this; + } + +}; + +module.exports = Enable; + + +/***/ }), + +/***/ 51702: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Methods for setting the friction of an Arcade Physics Body. + * + * In Arcade Physics, friction is a special case of motion transfer from an "immovable" body to a riding body. + * + * @namespace Phaser.Physics.Arcade.Components.Friction + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#friction + */ +var Friction = { + + /** + * Sets the friction of this game object's physics body. + * In Arcade Physics, friction is a special case of motion transfer from an "immovable" body to a riding body. + * + * @method Phaser.Physics.Arcade.Components.Friction#setFriction + * @since 3.0.0 + * + * @param {number} x - The amount of horizontal friction to apply, [0, 1]. + * @param {number} [y=x] - The amount of vertical friction to apply, [0, 1]. + * + * @return {this} This Game Object. + * + * @see Phaser.Physics.Arcade.Body#friction + */ + setFriction: function (x, y) + { + this.body.friction.set(x, y); + + return this; + }, + + /** + * Sets the horizontal friction of this game object's physics body. + * This can move a riding body horizontally when it collides with this one on the vertical axis. + * + * @method Phaser.Physics.Arcade.Components.Friction#setFrictionX + * @since 3.0.0 + * + * @param {number} x - The amount of friction to apply, [0, 1]. + * + * @return {this} This Game Object. + * + * @see Phaser.Physics.Arcade.Body#friction + */ + setFrictionX: function (x) + { + this.body.friction.x = x; + + return this; + }, + + /** + * Sets the vertical friction of this game object's physics body. + * This can move a riding body vertically when it collides with this one on the horizontal axis. + * + * @method Phaser.Physics.Arcade.Components.Friction#setFrictionY + * @since 3.0.0 + * + * @param {number} y - The amount of friction to apply, [0, 1]. + * + * @return {this} This Game Object. + * + * @see Phaser.Physics.Arcade.Body#friction + */ + setFrictionY: function (y) + { + this.body.friction.y = y; + + return this; + } + +}; + +module.exports = Friction; + + +/***/ }), + +/***/ 25578: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods for setting the gravity properties of an Arcade Physics Game Object. + * Should be applied as a mixin and not used directly. + * + * @namespace Phaser.Physics.Arcade.Components.Gravity + * @since 3.0.0 + */ +var Gravity = { + + /** + * Set the X and Y values of the gravitational pull to act upon this Arcade Physics Game Object. Values can be positive or negative. Larger values result in a stronger effect. + * + * If only one value is provided, this value will be used for both the X and Y axis. + * + * @method Phaser.Physics.Arcade.Components.Gravity#setGravity + * @since 3.0.0 + * + * @param {number} x - The gravitational force to be applied to the X-axis. + * @param {number} [y=x] - The gravitational force to be applied to the Y-axis. If this is not specified, the X value will be used. + * + * @return {this} This Game Object. + */ + setGravity: function (x, y) + { + this.body.gravity.set(x, y); + + return this; + }, + + /** + * Set the gravitational force to be applied to the X axis. Value can be positive or negative. Larger values result in a stronger effect. + * + * @method Phaser.Physics.Arcade.Components.Gravity#setGravityX + * @since 3.0.0 + * + * @param {number} x - The gravitational force to be applied to the X-axis. + * + * @return {this} This Game Object. + */ + setGravityX: function (x) + { + this.body.gravity.x = x; + + return this; + }, + + /** + * Set the gravitational force to be applied to the Y axis. Value can be positive or negative. Larger values result in a stronger effect. + * + * @method Phaser.Physics.Arcade.Components.Gravity#setGravityY + * @since 3.0.0 + * + * @param {number} y - The gravitational force to be applied to the Y-axis. + * + * @return {this} This Game Object. + */ + setGravityY: function (y) + { + this.body.gravity.y = y; + + return this; + } + +}; + +module.exports = Gravity; + + +/***/ }), + +/***/ 72029: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods used for setting the immovable properties of an Arcade Physics Body. + * + * @namespace Phaser.Physics.Arcade.Components.Immovable + * @since 3.0.0 + */ +var Immovable = { + + /** + * Sets if this Body can be separated during collisions with other bodies. + * + * When a body is immovable it means it won't move at all, not even to separate it from collision + * overlap. If you just wish to prevent a body from being knocked around by other bodies, see + * the `setPushable` method instead. + * + * @method Phaser.Physics.Arcade.Components.Immovable#setImmovable + * @since 3.0.0 + * + * @param {boolean} [value=true] - Sets if this body will be separated during collisions with other bodies. + * + * @return {this} This Game Object. + */ + setImmovable: function (value) + { + if (value === undefined) { value = true; } + + this.body.immovable = value; + + return this; + } + +}; + +module.exports = Immovable; + + +/***/ }), + +/***/ 34566: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods used for setting the mass properties of an Arcade Physics Body. + * + * @namespace Phaser.Physics.Arcade.Components.Mass + * @since 3.0.0 + */ +var Mass = { + + /** + * Sets the mass of the physics body + * + * @method Phaser.Physics.Arcade.Components.Mass#setMass + * @since 3.0.0 + * + * @param {number} value - New value for the mass of the body. + * + * @return {this} This Game Object. + */ + setMass: function (value) + { + this.body.mass = value; + + return this; + } + +}; + +module.exports = Mass; + + +/***/ }), + +/***/ 2732: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var OverlapRect = __webpack_require__(15147); +var Circle = __webpack_require__(26673); +var CircleToCircle = __webpack_require__(22184); +var CircleToRectangle = __webpack_require__(26535); + +/** + * This method will search the given circular area and return an array of all physics bodies that + * overlap with it. It can return either Dynamic, Static bodies or a mixture of both. + * + * A body only has to intersect with the search area to be considered, it doesn't have to be fully + * contained within it. + * + * If Arcade Physics is set to use the RTree (which it is by default) then the search is rather fast, + * otherwise the search is O(N) for Dynamic Bodies. + * + * @function Phaser.Physics.Arcade.Components.OverlapCirc + * @since 3.21.0 + * + * @param {number} x - The x coordinate of the center of the area to search within. + * @param {number} y - The y coordinate of the center of the area to search within. + * @param {number} radius - The radius of the area to search within. + * @param {boolean} [includeDynamic=true] - Should the search include Dynamic Bodies? + * @param {boolean} [includeStatic=false] - Should the search include Static Bodies? + * + * @return {(Phaser.Physics.Arcade.Body[]|Phaser.Physics.Arcade.StaticBody[])} An array of bodies that overlap with the given area. + */ +var OverlapCirc = function (world, x, y, radius, includeDynamic, includeStatic) +{ + var bodiesInRect = OverlapRect(world, x - radius, y - radius, 2 * radius, 2 * radius, includeDynamic, includeStatic); + + if (bodiesInRect.length === 0) + { + return bodiesInRect; + } + + var area = new Circle(x, y, radius); + var circFromBody = new Circle(); + var bodiesInArea = []; + + for (var i = 0; i < bodiesInRect.length; i++) + { + var body = bodiesInRect[i]; + + if (body.isCircle) + { + circFromBody.setTo(body.center.x, body.center.y, body.halfWidth); + + if (CircleToCircle(area, circFromBody)) + { + bodiesInArea.push(body); + } + } + else if (CircleToRectangle(area, body)) + { + bodiesInArea.push(body); + } + } + + return bodiesInArea; +}; + +module.exports = OverlapCirc; + + +/***/ }), + +/***/ 15147: +/***/ ((module) => { + +/** + * This method will search the given rectangular area and return an array of all physics bodies that + * overlap with it. It can return either Dynamic, Static bodies or a mixture of both. + * + * A body only has to intersect with the search area to be considered, it doesn't have to be fully + * contained within it. + * + * If Arcade Physics is set to use the RTree (which it is by default) then the search for is extremely fast, + * otherwise the search is O(N) for Dynamic Bodies. + * + * @function Phaser.Physics.Arcade.Components.OverlapRect + * @since 3.17.0 + * + * @param {number} x - The top-left x coordinate of the area to search within. + * @param {number} y - The top-left y coordinate of the area to search within. + * @param {number} width - The width of the area to search within. + * @param {number} height - The height of the area to search within. + * @param {boolean} [includeDynamic=true] - Should the search include Dynamic Bodies? + * @param {boolean} [includeStatic=false] - Should the search include Static Bodies? + * + * @return {(Phaser.Physics.Arcade.Body[]|Phaser.Physics.Arcade.StaticBody[])} An array of bodies that overlap with the given area. + */ +var OverlapRect = function (world, x, y, width, height, includeDynamic, includeStatic) +{ + if (includeDynamic === undefined) { includeDynamic = true; } + if (includeStatic === undefined) { includeStatic = false; } + + var dynamicBodies = []; + var staticBodies = []; + + var minMax = world.treeMinMax; + + minMax.minX = x; + minMax.minY = y; + minMax.maxX = x + width; + minMax.maxY = y + height; + + if (includeStatic) + { + staticBodies = world.staticTree.search(minMax); + } + + if (includeDynamic && world.useTree) + { + dynamicBodies = world.tree.search(minMax); + } + else if (includeDynamic) + { + var bodies = world.bodies; + + var fakeBody = + { + position: { + x: x, + y: y + }, + left: x, + top: y, + right: x + width, + bottom: y + height, + isCircle: false + }; + + var intersects = world.intersects; + + bodies.iterate(function (target) + { + if (intersects(target, fakeBody)) + { + dynamicBodies.push(target); + } + + }); + } + + return staticBodies.concat(dynamicBodies); +}; + +module.exports = OverlapRect; + + +/***/ }), + +/***/ 57527: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods used for setting the pushable property of an Arcade Physics Body. + * + * @namespace Phaser.Physics.Arcade.Components.Pushable + * @since 3.50.0 + */ +var Pushable = { + + /** + * Sets if this Body can be pushed by another Body. + * + * A body that cannot be pushed will reflect back all of the velocity it is given to the + * colliding body. If that body is also not pushable, then the separation will be split + * between them evenly. + * + * If you want your body to never move or seperate at all, see the `setImmovable` method. + * + * @method Phaser.Physics.Arcade.Components.Pushable#setPushable + * @since 3.50.0 + * + * @param {boolean} [value=true] - Sets if this body can be pushed by collisions with another Body. + * + * @return {this} This Game Object. + */ + setPushable: function (value) + { + if (value === undefined) { value = true; } + + this.body.pushable = value; + + return this; + } + +}; + +module.exports = Pushable; + + +/***/ }), + +/***/ 77687: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods for setting the size of an Arcade Physics Game Object. + * Should be applied as a mixin and not used directly. + * + * @namespace Phaser.Physics.Arcade.Components.Size + * @since 3.0.0 + */ +var Size = { + + /** + * Sets the body offset. This allows you to adjust the difference between the center of the body + * and the x and y coordinates of the parent Game Object. + * + * @method Phaser.Physics.Arcade.Components.Size#setOffset + * @since 3.0.0 + * + * @param {number} x - The amount to offset the body from the parent Game Object along the x-axis. + * @param {number} [y=x] - The amount to offset the body from the parent Game Object along the y-axis. Defaults to the value given for the x-axis. + * + * @return {this} This Game Object. + */ + setOffset: function (x, y) + { + this.body.setOffset(x, y); + + return this; + }, + + /** + * **DEPRECATED**: Please use `setBodySize` instead. + * + * Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object. + * + * @method Phaser.Physics.Arcade.Components.Size#setSize + * @since 3.0.0 + * @deprecated + * + * @param {number} width - The new width of the physics body, in pixels. + * @param {number} height - The new height of the physics body, in pixels. + * @param {boolean} [center=true] - Should the body be re-positioned so its center aligns with the parent Game Object? + * + * @return {this} This Game Object. + */ + setSize: function (width, height, center) + { + this.body.setSize(width, height, center); + + return this; + }, + + /** + * Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object. + * + * @method Phaser.Physics.Arcade.Components.Size#setBodySize + * @since 3.24.0 + * + * @param {number} width - The new width of the physics body, in pixels. + * @param {number} height - The new height of the physics body, in pixels. + * @param {boolean} [center=true] - Should the body be re-positioned so its center aligns with the parent Game Object? + * + * @return {this} This Game Object. + */ + setBodySize: function (width, height, center) + { + this.body.setSize(width, height, center); + + return this; + }, + + /** + * Sets this physics body to use a circle for collision instead of a rectangle. + * + * @method Phaser.Physics.Arcade.Components.Size#setCircle + * @since 3.0.0 + * + * @param {number} radius - The radius of the physics body, in pixels. + * @param {number} [offsetX] - The amount to offset the body from the parent Game Object along the x-axis. + * @param {number} [offsetY] - The amount to offset the body from the parent Game Object along the y-axis. + * + * @return {this} This Game Object. + */ + setCircle: function (radius, offsetX, offsetY) + { + this.body.setCircle(radius, offsetX, offsetY); + + return this; + } + +}; + +module.exports = Size; + + +/***/ }), + +/***/ 66536: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Provides methods for modifying the velocity of an Arcade Physics body. + * + * Should be applied as a mixin and not used directly. + * + * @namespace Phaser.Physics.Arcade.Components.Velocity + * @since 3.0.0 + */ +var Velocity = { + + /** + * Sets the velocity of the Body. + * + * @method Phaser.Physics.Arcade.Components.Velocity#setVelocity + * @since 3.0.0 + * + * @param {number} x - The horizontal velocity of the body. Positive values move the body to the right, while negative values move it to the left. + * @param {number} [y=x] - The vertical velocity of the body. Positive values move the body down, while negative values move it up. + * + * @return {this} This Game Object. + */ + setVelocity: function (x, y) + { + this.body.setVelocity(x, y); + + return this; + }, + + /** + * Sets the horizontal component of the body's velocity. + * + * Positive values move the body to the right, while negative values move it to the left. + * + * @method Phaser.Physics.Arcade.Components.Velocity#setVelocityX + * @since 3.0.0 + * + * @param {number} x - The new horizontal velocity. + * + * @return {this} This Game Object. + */ + setVelocityX: function (x) + { + this.body.setVelocityX(x); + + return this; + }, + + /** + * Sets the vertical component of the body's velocity. + * + * Positive values move the body down, while negative values move it up. + * + * @method Phaser.Physics.Arcade.Components.Velocity#setVelocityY + * @since 3.0.0 + * + * @param {number} y - The new vertical velocity of the body. + * + * @return {this} This Game Object. + */ + setVelocityY: function (y) + { + this.body.setVelocityY(y); + + return this; + }, + + /** + * Sets the maximum velocity of the body. + * + * @method Phaser.Physics.Arcade.Components.Velocity#setMaxVelocity + * @since 3.0.0 + * + * @param {number} x - The new maximum horizontal velocity. + * @param {number} [y=x] - The new maximum vertical velocity. + * + * @return {this} This Game Object. + */ + setMaxVelocity: function (x, y) + { + this.body.maxVelocity.set(x, y); + + return this; + } + +}; + +module.exports = Velocity; + + +/***/ }), + +/***/ 7864: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Physics.Arcade.Components + */ + +module.exports = { + + Acceleration: __webpack_require__(5321), + Angular: __webpack_require__(29257), + Bounce: __webpack_require__(62122), + Debug: __webpack_require__(99803), + Drag: __webpack_require__(87145), + Enable: __webpack_require__(96174), + Friction: __webpack_require__(51702), + Gravity: __webpack_require__(25578), + Immovable: __webpack_require__(72029), + Mass: __webpack_require__(34566), + OverlapCirc: __webpack_require__(2732), + OverlapRect: __webpack_require__(15147), + Pushable: __webpack_require__(57527), + Size: __webpack_require__(77687), + Velocity: __webpack_require__(66536) + +}; + + +/***/ }), + +/***/ 47401: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Arcade Physics consts. + * + * @ignore + */ + +var CONST = { + + /** + * Dynamic Body. + * + * @name Phaser.Physics.Arcade.DYNAMIC_BODY + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#physicsType + * @see Phaser.Physics.Arcade.Group#physicsType + */ + DYNAMIC_BODY: 0, + + /** + * Static Body. + * + * @name Phaser.Physics.Arcade.STATIC_BODY + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#physicsType + * @see Phaser.Physics.Arcade.StaticBody#physicsType + */ + STATIC_BODY: 1, + + /** + * Arcade Physics Group containing Dynamic Bodies. + * + * @name Phaser.Physics.Arcade.GROUP + * @readonly + * @type {number} + * @since 3.0.0 + */ + GROUP: 2, + + /** + * A Tilemap Layer. + * + * @name Phaser.Physics.Arcade.TILEMAPLAYER + * @readonly + * @type {number} + * @since 3.0.0 + */ + TILEMAPLAYER: 3, + + /** + * Facing no direction (initial value). + * + * @name Phaser.Physics.Arcade.FACING_NONE + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_NONE: 10, + + /** + * Facing up. + * + * @name Phaser.Physics.Arcade.FACING_UP + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_UP: 11, + + /** + * Facing down. + * + * @name Phaser.Physics.Arcade.FACING_DOWN + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_DOWN: 12, + + /** + * Facing left. + * + * @name Phaser.Physics.Arcade.FACING_LEFT + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_LEFT: 13, + + /** + * Facing right. + * + * @name Phaser.Physics.Arcade.FACING_RIGHT + * @readonly + * @type {number} + * @since 3.0.0 + * + * @see Phaser.Physics.Arcade.Body#facing + */ + FACING_RIGHT: 14 + +}; + +module.exports = CONST; + + +/***/ }), + +/***/ 22346: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Arcade Physics World Collide Event. + * + * This event is dispatched by an Arcade Physics World instance if two bodies collide _and_ at least + * one of them has their [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('collide', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#COLLIDE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject1 - The first Game Object involved in the collision. This is the parent of `body1`. + * @param {Phaser.GameObjects.GameObject} gameObject2 - The second Game Object involved in the collision. This is the parent of `body2`. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - The first Physics Body involved in the collision. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - The second Physics Body involved in the collision. + */ +module.exports = 'collide'; + + +/***/ }), + +/***/ 95092: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Arcade Physics World Overlap Event. + * + * This event is dispatched by an Arcade Physics World instance if two bodies overlap _and_ at least + * one of them has their [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`. + * + * It provides an alternative means to handling overlap events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('overlap', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#OVERLAP + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject1 - The first Game Object involved in the overlap. This is the parent of `body1`. + * @param {Phaser.GameObjects.GameObject} gameObject2 - The second Game Object involved in the overlap. This is the parent of `body2`. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - The first Physics Body involved in the overlap. + * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - The second Physics Body involved in the overlap. + */ +module.exports = 'overlap'; + + +/***/ }), + +/***/ 15775: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Arcade Physics World Pause Event. + * + * This event is dispatched by an Arcade Physics World instance when it is paused. + * + * Listen to it from a Scene using: `this.physics.world.on('pause', listener)`. + * + * @event Phaser.Physics.Arcade.Events#PAUSE + * @type {string} + * @since 3.0.0 + */ +module.exports = 'pause'; + + +/***/ }), + +/***/ 74142: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Arcade Physics World Resume Event. + * + * This event is dispatched by an Arcade Physics World instance when it resumes from a paused state. + * + * Listen to it from a Scene using: `this.physics.world.on('resume', listener)`. + * + * @event Phaser.Physics.Arcade.Events#RESUME + * @type {string} + * @since 3.0.0 + */ +module.exports = 'resume'; + + +/***/ }), + +/***/ 22825: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Arcade Physics Tile Collide Event. + * + * This event is dispatched by an Arcade Physics World instance if a body collides with a Tile _and_ + * has its [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('tilecollide', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#TILE_COLLIDE + * @type {string} + * @since 3.16.1 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object involved in the collision. This is the parent of `body`. + * @param {Phaser.Tilemaps.Tile} tile - The tile the body collided with. + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body of the Game Object involved in the collision. + */ +module.exports = 'tilecollide'; + + +/***/ }), + +/***/ 10851: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Arcade Physics Tile Overlap Event. + * + * This event is dispatched by an Arcade Physics World instance if a body overlaps with a Tile _and_ + * has its [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`. + * + * It provides an alternative means to handling overlap events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('tileoverlap', listener)`. + * + * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * + * @event Phaser.Physics.Arcade.Events#TILE_OVERLAP + * @type {string} + * @since 3.16.1 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object involved in the overlap. This is the parent of `body`. + * @param {Phaser.Tilemaps.Tile} tile - The tile the body overlapped. + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body of the Game Object involved in the overlap. + */ +module.exports = 'tileoverlap'; + + +/***/ }), + +/***/ 7543: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Arcade Physics World Bounds Event. + * + * This event is dispatched by an Arcade Physics World instance if a body makes contact with the world bounds _and_ + * it has its [onWorldBounds]{@link Phaser.Physics.Arcade.Body#onWorldBounds} property set to `true`. + * + * It provides an alternative means to handling collide events rather than using the callback approach. + * + * Listen to it from a Scene using: `this.physics.world.on('worldbounds', listener)`. + * + * @event Phaser.Physics.Arcade.Events#WORLD_BOUNDS + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body that hit the world bounds. + * @param {boolean} up - Is the Body blocked up? I.e. collided with the top of the world bounds. + * @param {boolean} down - Is the Body blocked down? I.e. collided with the bottom of the world bounds. + * @param {boolean} left - Is the Body blocked left? I.e. collided with the left of the world bounds. + * @param {boolean} right - Is the Body blocked right? I.e. collided with the right of the world bounds. + */ +module.exports = 'worldbounds'; + + +/***/ }), + +/***/ 1487: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Arcade Physics World Step Event. + * + * This event is dispatched by an Arcade Physics World instance whenever a physics step is run. + * It is emitted _after_ the bodies and colliders have been updated. + * + * In high framerate settings this can be multiple times per game frame. + * + * Listen to it from a Scene using: `this.physics.world.on('worldstep', listener)`. + * + * @event Phaser.Physics.Arcade.Events#WORLD_STEP + * @type {string} + * @since 3.18.0 + * + * @param {number} delta - The delta time amount of this step, in seconds. + */ +module.exports = 'worldstep'; + + +/***/ }), + +/***/ 27037: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Physics.Arcade.Events + */ + +module.exports = { + + COLLIDE: __webpack_require__(22346), + OVERLAP: __webpack_require__(95092), + PAUSE: __webpack_require__(15775), + RESUME: __webpack_require__(74142), + TILE_COLLIDE: __webpack_require__(22825), + TILE_OVERLAP: __webpack_require__(10851), + WORLD_BOUNDS: __webpack_require__(7543), + WORLD_STEP: __webpack_require__(1487) + +}; + + +/***/ }), + +/***/ 39977: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(47401); +var Extend = __webpack_require__(98611); + +/** + * @namespace Phaser.Physics.Arcade + */ + +var Arcade = { + + ArcadePhysics: __webpack_require__(66150), + Body: __webpack_require__(97602), + Collider: __webpack_require__(3909), + Components: __webpack_require__(7864), + Events: __webpack_require__(27037), + Factory: __webpack_require__(99523), + GetOverlapX: __webpack_require__(75671), + GetOverlapY: __webpack_require__(66185), + SeparateX: __webpack_require__(61777), + SeparateY: __webpack_require__(25299), + Group: __webpack_require__(10481), + Image: __webpack_require__(62832), + Sprite: __webpack_require__(25084), + StaticBody: __webpack_require__(66634), + StaticGroup: __webpack_require__(46346), + Tilemap: __webpack_require__(8413), + World: __webpack_require__(85233) + +}; + +// Merge in the consts +Arcade = Extend(false, Arcade, CONST); + +module.exports = Arcade; + + +/***/ }), + +/***/ 25163: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * A function to process the collision callbacks between a single tile and an Arcade Physics enabled Game Object. + * + * @function Phaser.Physics.Arcade.Tilemap.ProcessTileCallbacks + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.Tile} tile - The Tile to process. + * @param {Phaser.GameObjects.Sprite} sprite - The Game Object to process with the Tile. + * + * @return {boolean} The result of the callback, `true` for further processing, or `false` to skip this pair. + */ +var ProcessTileCallbacks = function (tile, sprite) +{ + // Tile callbacks take priority over layer level callbacks + if (tile.collisionCallback) + { + return !tile.collisionCallback.call(tile.collisionCallbackContext, sprite, tile); + } + else if (tile.layer.callbacks[tile.index]) + { + return !tile.layer.callbacks[tile.index].callback.call( + tile.layer.callbacks[tile.index].callbackContext, sprite, tile + ); + } + + return true; +}; + +module.exports = ProcessTileCallbacks; + + +/***/ }), + +/***/ 98209: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Internal function to process the separation of a physics body from a tile. + * + * @function Phaser.Physics.Arcade.Tilemap.ProcessTileSeparationX + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. + * @param {number} x - The x separation amount. + */ +var ProcessTileSeparationX = function (body, x) +{ + if (x < 0) + { + body.blocked.none = false; + body.blocked.left = true; + } + else if (x > 0) + { + body.blocked.none = false; + body.blocked.right = true; + } + + body.position.x -= x; + body.updateCenter(); + + if (body.bounce.x === 0) + { + body.velocity.x = 0; + } + else + { + body.velocity.x = -body.velocity.x * body.bounce.x; + } +}; + +module.exports = ProcessTileSeparationX; + + +/***/ }), + +/***/ 72792: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Internal function to process the separation of a physics body from a tile. + * + * @function Phaser.Physics.Arcade.Tilemap.ProcessTileSeparationY + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. + * @param {number} y - The y separation amount. + */ +var ProcessTileSeparationY = function (body, y) +{ + if (y < 0) + { + body.blocked.none = false; + body.blocked.up = true; + } + else if (y > 0) + { + body.blocked.none = false; + body.blocked.down = true; + } + + body.position.y -= y; + body.updateCenter(); + + if (body.bounce.y === 0) + { + body.velocity.y = 0; + } + else + { + body.velocity.y = -body.velocity.y * body.bounce.y; + } +}; + +module.exports = ProcessTileSeparationY; + + +/***/ }), + +/***/ 27354: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var TileCheckX = __webpack_require__(14405); +var TileCheckY = __webpack_require__(52926); +var TileIntersectsBody = __webpack_require__(28808); + +/** + * The core separation function to separate a physics body and a tile. + * + * @function Phaser.Physics.Arcade.Tilemap.SeparateTile + * @since 3.0.0 + * + * @param {number} i - The index of the tile within the map data. + * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. + * @param {Phaser.Tilemaps.Tile} tile - The tile to collide against. + * @param {Phaser.Geom.Rectangle} tileWorldRect - A rectangle-like object defining the dimensions of the tile. + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - The tilemapLayer to collide against. + * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. + * @param {boolean} isLayer - Is this check coming from a TilemapLayer or an array of tiles? + * + * @return {boolean} `true` if the body was separated, otherwise `false`. + */ +var SeparateTile = function (i, body, tile, tileWorldRect, tilemapLayer, tileBias, isLayer) +{ + var tileLeft = tileWorldRect.left; + var tileTop = tileWorldRect.top; + var tileRight = tileWorldRect.right; + var tileBottom = tileWorldRect.bottom; + var faceHorizontal = tile.faceLeft || tile.faceRight; + var faceVertical = tile.faceTop || tile.faceBottom; + + if (!isLayer) + { + faceHorizontal = true; + faceVertical = true; + } + + // We don't need to go any further if this tile doesn't actually have any colliding faces. This + // could happen if the tile was meant to be collided with re: a callback, but otherwise isn't + // needed for separation. + if (!faceHorizontal && !faceVertical) + { + return false; + } + + var ox = 0; + var oy = 0; + var minX = 0; + var minY = 1; + + if (body.deltaAbsX() > body.deltaAbsY()) + { + // Moving faster horizontally, check X axis first + minX = -1; + } + else if (body.deltaAbsX() < body.deltaAbsY()) + { + // Moving faster vertically, check Y axis first + minY = -1; + } + + if (body.deltaX() !== 0 && body.deltaY() !== 0 && faceHorizontal && faceVertical) + { + // We only need do this if both axes have colliding faces AND we're moving in both + // directions + minX = Math.min(Math.abs(body.position.x - tileRight), Math.abs(body.right - tileLeft)); + minY = Math.min(Math.abs(body.position.y - tileBottom), Math.abs(body.bottom - tileTop)); + } + + if (minX < minY) + { + if (faceHorizontal) + { + ox = TileCheckX(body, tile, tileLeft, tileRight, tileBias, isLayer); + + // That's horizontal done, check if we still intersects? If not then we can return now + if (ox !== 0 && !TileIntersectsBody(tileWorldRect, body)) + { + return true; + } + } + + if (faceVertical) + { + oy = TileCheckY(body, tile, tileTop, tileBottom, tileBias, isLayer); + } + } + else + { + if (faceVertical) + { + oy = TileCheckY(body, tile, tileTop, tileBottom, tileBias, isLayer); + + // That's vertical done, check if we still intersects? If not then we can return now + if (oy !== 0 && !TileIntersectsBody(tileWorldRect, body)) + { + return true; + } + } + + if (faceHorizontal) + { + ox = TileCheckX(body, tile, tileLeft, tileRight, tileBias, isLayer); + } + } + + return (ox !== 0 || oy !== 0); +}; + +module.exports = SeparateTile; + + +/***/ }), + +/***/ 14405: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var ProcessTileSeparationX = __webpack_require__(98209); + +/** + * Check the body against the given tile on the X axis. + * Used internally by the SeparateTile function. + * + * @function Phaser.Physics.Arcade.Tilemap.TileCheckX + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. + * @param {Phaser.Tilemaps.Tile} tile - The tile to check. + * @param {number} tileLeft - The left position of the tile within the tile world. + * @param {number} tileRight - The right position of the tile within the tile world. + * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. + * @param {boolean} isLayer - Is this check coming from a TilemapLayer or an array of tiles? + * + * @return {number} The amount of separation that occurred. + */ +var TileCheckX = function (body, tile, tileLeft, tileRight, tileBias, isLayer) +{ + var ox = 0; + + var faceLeft = tile.faceLeft; + var faceRight = tile.faceRight; + var collideLeft = tile.collideLeft; + var collideRight = tile.collideRight; + + if (!isLayer) + { + faceLeft = true; + faceRight = true; + collideLeft = true; + collideRight = true; + } + + if (body.deltaX() < 0 && collideRight && body.checkCollision.left) + { + // Body is moving LEFT + if (faceRight && body.x < tileRight) + { + ox = body.x - tileRight; + + if (ox < -tileBias) + { + ox = 0; + } + } + } + else if (body.deltaX() > 0 && collideLeft && body.checkCollision.right) + { + // Body is moving RIGHT + if (faceLeft && body.right > tileLeft) + { + ox = body.right - tileLeft; + + if (ox > tileBias) + { + ox = 0; + } + } + } + + if (ox !== 0) + { + if (body.customSeparateX) + { + body.overlapX = ox; + } + else + { + ProcessTileSeparationX(body, ox); + } + } + + return ox; +}; + +module.exports = TileCheckX; + + +/***/ }), + +/***/ 52926: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var ProcessTileSeparationY = __webpack_require__(72792); + +/** + * Check the body against the given tile on the Y axis. + * Used internally by the SeparateTile function. + * + * @function Phaser.Physics.Arcade.Tilemap.TileCheckY + * @since 3.0.0 + * + * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. + * @param {Phaser.Tilemaps.Tile} tile - The tile to check. + * @param {number} tileTop - The top position of the tile within the tile world. + * @param {number} tileBottom - The bottom position of the tile within the tile world. + * @param {number} tileBias - The tile bias value. Populated by the `World.TILE_BIAS` constant. + * @param {boolean} isLayer - Is this check coming from a TilemapLayer or an array of tiles? + * + * @return {number} The amount of separation that occurred. + */ +var TileCheckY = function (body, tile, tileTop, tileBottom, tileBias, isLayer) +{ + var oy = 0; + + var faceTop = tile.faceTop; + var faceBottom = tile.faceBottom; + var collideUp = tile.collideUp; + var collideDown = tile.collideDown; + + if (!isLayer) + { + faceTop = true; + faceBottom = true; + collideUp = true; + collideDown = true; + } + + if (body.deltaY() < 0 && collideDown && body.checkCollision.up) + { + // Body is moving UP + if (faceBottom && body.y < tileBottom) + { + oy = body.y - tileBottom; + + if (oy < -tileBias) + { + oy = 0; + } + } + } + else if (body.deltaY() > 0 && collideUp && body.checkCollision.down) + { + // Body is moving DOWN + if (faceTop && body.bottom > tileTop) + { + oy = body.bottom - tileTop; + + if (oy > tileBias) + { + oy = 0; + } + } + } + + if (oy !== 0) + { + if (body.customSeparateY) + { + body.overlapY = oy; + } + else + { + ProcessTileSeparationY(body, oy); + } + } + + return oy; +}; + +module.exports = TileCheckY; + + +/***/ }), + +/***/ 28808: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Checks for intersection between the given tile rectangle-like object and an Arcade Physics body. + * + * @function Phaser.Physics.Arcade.Tilemap.TileIntersectsBody + * @since 3.0.0 + * + * @param {{ left: number, right: number, top: number, bottom: number }} tileWorldRect - A rectangle object that defines the tile placement in the world. + * @param {Phaser.Physics.Arcade.Body} body - The body to check for intersection against. + * + * @return {boolean} Returns `true` of the tile intersects with the body, otherwise `false`. + */ +var TileIntersectsBody = function (tileWorldRect, body) +{ + // Currently, all bodies are treated as rectangles when colliding with a Tile. + + return !( + body.right <= tileWorldRect.left || + body.bottom <= tileWorldRect.top || + body.position.x >= tileWorldRect.right || + body.position.y >= tileWorldRect.bottom + ); +}; + +module.exports = TileIntersectsBody; + + +/***/ }), + +/***/ 8413: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Physics.Arcade.Tilemap + */ + +var Tilemap = { + + ProcessTileCallbacks: __webpack_require__(25163), + ProcessTileSeparationX: __webpack_require__(98209), + ProcessTileSeparationY: __webpack_require__(72792), + SeparateTile: __webpack_require__(27354), + TileCheckX: __webpack_require__(14405), + TileCheckY: __webpack_require__(52926), + TileIntersectsBody: __webpack_require__(28808) + +}; + +module.exports = Tilemap; + + +/***/ }), + +/***/ 53954: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Physics + */ + +/** + * @namespace Phaser.Types.Physics + */ + +module.exports = { + + Arcade: __webpack_require__(39977), + Matter: __webpack_require__(45949) + +}; + + +/***/ }), + +/***/ 63568: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var Vector2 = __webpack_require__(93736); + +/** + * @classdesc + * + * The Body Bounds class contains methods to help you extract the world coordinates from various points around + * the bounds of a Matter Body. Because Matter bodies are positioned based on their center of mass, and not a + * dimension based center, you often need to get the bounds coordinates in order to properly align them in the world. + * + * You can access this class via the MatterPhysics class from a Scene, i.e.: + * + * ```javascript + * this.matter.bodyBounds.getTopLeft(body); + * ``` + * + * See also the `MatterPhysics.alignBody` method. + * + * @class BodyBounds + * @memberof Phaser.Physics.Matter + * @constructor + * @since 3.22.0 + */ +var BodyBounds = new Class({ + + initialize: + + function BodyBounds () + { + /** + * A Vector2 that stores the temporary bounds center value during calculations by methods in this class. + * + * @name Phaser.Physics.Matter.BodyBounds#boundsCenter + * @type {Phaser.Math.Vector2} + * @since 3.22.0 + */ + this.boundsCenter = new Vector2(); + + /** + * A Vector2 that stores the temporary center diff values during calculations by methods in this class. + * + * @name Phaser.Physics.Matter.BodyBounds#centerDiff + * @type {Phaser.Math.Vector2} + * @since 3.22.0 + */ + this.centerDiff = new Vector2(); + }, + + /** + * Parses the given body to get the bounds diff values from it. + * + * They're stored in this class in the temporary properties `boundsCenter` and `centerDiff`. + * + * This method is called automatically by all other methods in this class. + * + * @method Phaser.Physics.Matter.BodyBounds#parseBody + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the bounds position from. + * + * @return {boolean} `true` if it was able to get the bounds, otherwise `false`. + */ + parseBody: function (body) + { + body = (body.hasOwnProperty('body')) ? body.body : body; + + if (!body.hasOwnProperty('bounds') || !body.hasOwnProperty('centerOfMass')) + { + return false; + } + + var boundsCenter = this.boundsCenter; + var centerDiff = this.centerDiff; + + var boundsWidth = body.bounds.max.x - body.bounds.min.x; + var boundsHeight = body.bounds.max.y - body.bounds.min.y; + + var bodyCenterX = boundsWidth * body.centerOfMass.x; + var bodyCenterY = boundsHeight * body.centerOfMass.y; + + boundsCenter.set(boundsWidth / 2, boundsHeight / 2); + centerDiff.set(bodyCenterX - boundsCenter.x, bodyCenterY - boundsCenter.y); + + return true; + }, + + /** + * Takes a Body and returns the world coordinates of the top-left of its _bounds_. + * + * Body bounds are updated by Matter each step and factor in scale and rotation. + * This will return the world coordinate based on the bodies _current_ position and bounds. + * + * @method Phaser.Physics.Matter.BodyBounds#getTopLeft + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. + * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. + * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. + * + * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. + */ + getTopLeft: function (body, x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + if (this.parseBody(body)) + { + var center = this.boundsCenter; + var diff = this.centerDiff; + + return new Vector2( + x + center.x + diff.x, + y + center.y + diff.y + ); + } + + return false; + }, + + /** + * Takes a Body and returns the world coordinates of the top-center of its _bounds_. + * + * Body bounds are updated by Matter each step and factor in scale and rotation. + * This will return the world coordinate based on the bodies _current_ position and bounds. + * + * @method Phaser.Physics.Matter.BodyBounds#getTopCenter + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. + * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. + * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. + * + * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. + */ + getTopCenter: function (body, x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + if (this.parseBody(body)) + { + var center = this.boundsCenter; + var diff = this.centerDiff; + + return new Vector2( + x + diff.x, + y + center.y + diff.y + ); + } + + return false; + }, + + /** + * Takes a Body and returns the world coordinates of the top-right of its _bounds_. + * + * Body bounds are updated by Matter each step and factor in scale and rotation. + * This will return the world coordinate based on the bodies _current_ position and bounds. + * + * @method Phaser.Physics.Matter.BodyBounds#getTopRight + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. + * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. + * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. + * + * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. + */ + getTopRight: function (body, x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + if (this.parseBody(body)) + { + var center = this.boundsCenter; + var diff = this.centerDiff; + + return new Vector2( + x - (center.x - diff.x), + y + center.y + diff.y + ); + } + + return false; + }, + + /** + * Takes a Body and returns the world coordinates of the left-center of its _bounds_. + * + * Body bounds are updated by Matter each step and factor in scale and rotation. + * This will return the world coordinate based on the bodies _current_ position and bounds. + * + * @method Phaser.Physics.Matter.BodyBounds#getLeftCenter + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. + * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. + * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. + * + * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. + */ + getLeftCenter: function (body, x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + if (this.parseBody(body)) + { + var center = this.boundsCenter; + var diff = this.centerDiff; + + return new Vector2( + x + center.x + diff.x, + y + diff.y + ); + } + + return false; + }, + + /** + * Takes a Body and returns the world coordinates of the center of its _bounds_. + * + * Body bounds are updated by Matter each step and factor in scale and rotation. + * This will return the world coordinate based on the bodies _current_ position and bounds. + * + * @method Phaser.Physics.Matter.BodyBounds#getCenter + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. + * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. + * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. + * + * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. + */ + getCenter: function (body, x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + if (this.parseBody(body)) + { + var diff = this.centerDiff; + + return new Vector2( + x + diff.x, + y + diff.y + ); + } + + return false; + }, + + /** + * Takes a Body and returns the world coordinates of the right-center of its _bounds_. + * + * Body bounds are updated by Matter each step and factor in scale and rotation. + * This will return the world coordinate based on the bodies _current_ position and bounds. + * + * @method Phaser.Physics.Matter.BodyBounds#getRightCenter + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. + * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. + * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. + * + * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. + */ + getRightCenter: function (body, x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + if (this.parseBody(body)) + { + var center = this.boundsCenter; + var diff = this.centerDiff; + + return new Vector2( + x - (center.x - diff.x), + y + diff.y + ); + } + + return false; + }, + + /** + * Takes a Body and returns the world coordinates of the bottom-left of its _bounds_. + * + * Body bounds are updated by Matter each step and factor in scale and rotation. + * This will return the world coordinate based on the bodies _current_ position and bounds. + * + * @method Phaser.Physics.Matter.BodyBounds#getBottomLeft + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. + * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. + * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. + * + * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. + */ + getBottomLeft: function (body, x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + if (this.parseBody(body)) + { + var center = this.boundsCenter; + var diff = this.centerDiff; + + return new Vector2( + x + center.x + diff.x, + y - (center.y - diff.y) + ); + } + + return false; + }, + + /** + * Takes a Body and returns the world coordinates of the bottom-center of its _bounds_. + * + * Body bounds are updated by Matter each step and factor in scale and rotation. + * This will return the world coordinate based on the bodies _current_ position and bounds. + * + * @method Phaser.Physics.Matter.BodyBounds#getBottomCenter + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. + * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. + * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. + * + * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. + */ + getBottomCenter: function (body, x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + if (this.parseBody(body)) + { + var center = this.boundsCenter; + var diff = this.centerDiff; + + return new Vector2( + x + diff.x, + y - (center.y - diff.y) + ); + } + + return false; + }, + + /** + * Takes a Body and returns the world coordinates of the bottom-right of its _bounds_. + * + * Body bounds are updated by Matter each step and factor in scale and rotation. + * This will return the world coordinate based on the bodies _current_ position and bounds. + * + * @method Phaser.Physics.Matter.BodyBounds#getBottomRight + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. + * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. + * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. + * + * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. + */ + getBottomRight: function (body, x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + + if (this.parseBody(body)) + { + var center = this.boundsCenter; + var diff = this.centerDiff; + + return new Vector2( + x - (center.x - diff.x), + y - (center.y - diff.y) + ); + } + + return false; + } + +}); + +module.exports = BodyBounds; + + +/***/ }), + +/***/ 18171: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Physics.Matter.Matter + */ + +var Matter = __webpack_require__(16929); + +Matter.Body = __webpack_require__(84125); +Matter.Composite = __webpack_require__(11299); +Matter.World = __webpack_require__(72005); + +Matter.Collision = __webpack_require__(63454); +Matter.Detector = __webpack_require__(13657); +Matter.Pairs = __webpack_require__(91327); +Matter.Pair = __webpack_require__(70584); +Matter.Query = __webpack_require__(13390); +Matter.Resolver = __webpack_require__(44272); + +Matter.Constraint = __webpack_require__(52838); + +Matter.Common = __webpack_require__(68758); +Matter.Engine = __webpack_require__(45775); +Matter.Events = __webpack_require__(39073); +Matter.Sleeping = __webpack_require__(22806); +Matter.Plugin = __webpack_require__(84474); + +Matter.Bodies = __webpack_require__(68516); +Matter.Composites = __webpack_require__(56643); + +Matter.Axes = __webpack_require__(50658); +Matter.Bounds = __webpack_require__(84091); +Matter.Svg = __webpack_require__(92765); +Matter.Vector = __webpack_require__(10438); +Matter.Vertices = __webpack_require__(39745); + +// aliases + +Matter.World.add = Matter.Composite.add; +Matter.World.remove = Matter.Composite.remove; +Matter.World.addComposite = Matter.Composite.addComposite; +Matter.World.addBody = Matter.Composite.addBody; +Matter.World.addConstraint = Matter.Composite.addConstraint; +Matter.World.clear = Matter.Composite.clear; + +module.exports = Matter; + + +/***/ }), + +/***/ 72653: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Bodies = __webpack_require__(68516); +var Class = __webpack_require__(56694); +var Composites = __webpack_require__(56643); +var Constraint = __webpack_require__(52838); +var Svg = __webpack_require__(92765); +var MatterGameObject = __webpack_require__(3860); +var MatterImage = __webpack_require__(7030); +var MatterSprite = __webpack_require__(73658); +var MatterTileBody = __webpack_require__(84720); +var PhysicsEditorParser = __webpack_require__(10998); +var PhysicsJSONParser = __webpack_require__(72829); +var PointerConstraint = __webpack_require__(88596); +var Vertices = __webpack_require__(39745); + +/** + * @classdesc + * The Matter Factory is responsible for quickly creating a variety of different types of + * bodies, constraints and Game Objects and adding them into the physics world. + * + * You access the factory from within a Scene using `add`: + * + * ```javascript + * this.matter.add.rectangle(x, y, width, height); + * ``` + * + * Use of the Factory is optional. All of the objects it creates can also be created + * directly via your own code or constructors. It is provided as a means to keep your + * code concise. + * + * @class Factory + * @memberof Phaser.Physics.Matter + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.World} world - The Matter World which this Factory adds to. + */ +var Factory = new Class({ + + initialize: + + function Factory (world) + { + /** + * The Matter World which this Factory adds to. + * + * @name Phaser.Physics.Matter.Factory#world + * @type {Phaser.Physics.Matter.World} + * @since 3.0.0 + */ + this.world = world; + + /** + * The Scene which this Factory's Matter World belongs to. + * + * @name Phaser.Physics.Matter.Factory#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = world.scene; + + /** + * A reference to the Scene.Systems this Matter Physics instance belongs to. + * + * @name Phaser.Physics.Matter.Factory#sys + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.sys = world.scene.sys; + }, + + /** + * Creates a new rigid rectangular Body and adds it to the World. + * + * @method Phaser.Physics.Matter.Factory#rectangle + * @since 3.0.0 + * + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {number} width - The width of the Body. + * @param {number} height - The height of the Body. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {MatterJS.BodyType} A Matter JS Body. + */ + rectangle: function (x, y, width, height, options) + { + var body = Bodies.rectangle(x, y, width, height, options); + + this.world.add(body); + + return body; + }, + + /** + * Creates a new rigid trapezoidal Body and adds it to the World. + * + * @method Phaser.Physics.Matter.Factory#trapezoid + * @since 3.0.0 + * + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {number} width - The width of the trapezoid Body. + * @param {number} height - The height of the trapezoid Body. + * @param {number} slope - The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {MatterJS.BodyType} A Matter JS Body. + */ + trapezoid: function (x, y, width, height, slope, options) + { + var body = Bodies.trapezoid(x, y, width, height, slope, options); + + this.world.add(body); + + return body; + }, + + /** + * Creates a new rigid circular Body and adds it to the World. + * + * @method Phaser.Physics.Matter.Factory#circle + * @since 3.0.0 + * + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {number} radius - The radius of the circle. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * @param {number} [maxSides] - The maximum amount of sides to use for the polygon which will approximate this circle. + * + * @return {MatterJS.BodyType} A Matter JS Body. + */ + circle: function (x, y, radius, options, maxSides) + { + var body = Bodies.circle(x, y, radius, options, maxSides); + + this.world.add(body); + + return body; + }, + + /** + * Creates a new rigid polygonal Body and adds it to the World. + * + * @method Phaser.Physics.Matter.Factory#polygon + * @since 3.0.0 + * + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {number} sides - The number of sides the polygon will have. + * @param {number} radius - The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {MatterJS.BodyType} A Matter JS Body. + */ + polygon: function (x, y, sides, radius, options) + { + var body = Bodies.polygon(x, y, sides, radius, options); + + this.world.add(body); + + return body; + }, + + /** + * Creates a body using the supplied vertices (or an array containing multiple sets of vertices) and adds it to the World. + * If the vertices are convex, they will pass through as supplied. Otherwise, if the vertices are concave, they will be decomposed. Note that this process is not guaranteed to support complex sets of vertices, e.g. ones with holes. + * + * @method Phaser.Physics.Matter.Factory#fromVertices + * @since 3.0.0 + * + * @param {number} x - The X coordinate of the center of the Body. + * @param {number} y - The Y coordinate of the center of the Body. + * @param {(string|array)} vertexSets - The vertices data. Either a path string or an array of vertices. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * @param {boolean} [flagInternal=false] - Flag internal edges (coincident part edges) + * @param {number} [removeCollinear=0.01] - Whether Matter.js will discard collinear edges (to improve performance). + * @param {number} [minimumArea=10] - During decomposition discard parts that have an area less than this. + * + * @return {MatterJS.BodyType} A Matter JS Body. + */ + fromVertices: function (x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea) + { + if (typeof vertexSets === 'string') + { + vertexSets = Vertices.fromPath(vertexSets); + } + + var body = Bodies.fromVertices(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea); + + this.world.add(body); + + return body; + }, + + /** + * Creates a body using data exported from the application PhysicsEditor (https://www.codeandweb.com/physicseditor) + * + * The PhysicsEditor file should be loaded as JSON: + * + * ```javascript + * preload () + * { + * this.load.json('vehicles', 'assets/vehicles.json); + * } + * + * create () + * { + * const vehicleShapes = this.cache.json.get('vehicles'); + * this.matter.add.fromPhysicsEditor(400, 300, vehicleShapes.truck); + * } + * ``` + * + * Do not pass the entire JSON file to this method, but instead pass one of the shapes contained within it. + * + * If you pas in an `options` object, any settings in there will override those in the PhysicsEditor config object. + * + * @method Phaser.Physics.Matter.Factory#fromPhysicsEditor + * @since 3.22.0 + * + * @param {number} x - The horizontal world location of the body. + * @param {number} y - The vertical world location of the body. + * @param {any} config - The JSON data exported from PhysicsEditor. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * @param {boolean} [addToWorld=true] - Should the newly created body be immediately added to the World? + * + * @return {MatterJS.BodyType} A Matter JS Body. + */ + fromPhysicsEditor: function (x, y, config, options, addToWorld) + { + if (addToWorld === undefined) { addToWorld = true; } + + var body = PhysicsEditorParser.parseBody(x, y, config, options); + + if (addToWorld && !this.world.has(body)) + { + this.world.add(body); + } + + return body; + }, + + /** + * Creates a body using the path data from an SVG file. + * + * SVG Parsing requires the pathseg polyfill from https://github.com/progers/pathseg + * + * The SVG file should be loaded as XML, as this method requires the ability to extract + * the path data from it. I.e.: + * + * ```javascript + * preload () + * { + * this.load.xml('face', 'assets/face.svg); + * } + * + * create () + * { + * this.matter.add.fromSVG(400, 300, this.cache.xml.get('face')); + * } + * ``` + * + * @method Phaser.Physics.Matter.Factory#fromSVG + * @since 3.22.0 + * + * @param {number} x - The X coordinate of the body. + * @param {number} y - The Y coordinate of the body. + * @param {object} xml - The SVG Path data. + * @param {number} [scale=1] - Scale the vertices by this amount after creation. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * @param {boolean} [addToWorld=true] - Should the newly created body be immediately added to the World? + * + * @return {MatterJS.BodyType} A Matter JS Body. + */ + fromSVG: function (x, y, xml, scale, options, addToWorld) + { + if (scale === undefined) { scale = 1; } + if (options === undefined) { options = {}; } + if (addToWorld === undefined) { addToWorld = true; } + + var path = xml.getElementsByTagName('path'); + var vertexSets = []; + + for (var i = 0; i < path.length; i++) + { + var points = Svg.pathToVertices(path[i], 30); + + if (scale !== 1) + { + Vertices.scale(points, scale, scale); + } + + vertexSets.push(points); + } + + var body = Bodies.fromVertices(x, y, vertexSets, options); + + if (addToWorld) + { + this.world.add(body); + } + + return body; + }, + + /** + * Creates a body using the supplied physics data, as provided by a JSON file. + * + * The data file should be loaded as JSON: + * + * ```javascript + * preload () + * { + * this.load.json('ninjas', 'assets/ninjas.json); + * } + * + * create () + * { + * const ninjaShapes = this.cache.json.get('ninjas'); + * + * this.matter.add.fromJSON(400, 300, ninjaShapes.shinobi); + * } + * ``` + * + * Do not pass the entire JSON file to this method, but instead pass one of the shapes contained within it. + * + * If you pas in an `options` object, any settings in there will override those in the config object. + * + * The structure of the JSON file is as follows: + * + * ```text + * { + * 'generator_info': // The name of the application that created the JSON data + * 'shapeName': { + * 'type': // The type of body + * 'label': // Optional body label + * 'vertices': // An array, or an array of arrays, containing the vertex data in x/y object pairs + * } + * } + * ``` + * + * At the time of writing, only the Phaser Physics Tracer App exports in this format. + * + * @method Phaser.Physics.Matter.Factory#fromJSON + * @since 3.22.0 + * + * @param {number} x - The X coordinate of the body. + * @param {number} y - The Y coordinate of the body. + * @param {any} config - The JSON physics data. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * @param {boolean} [addToWorld=true] - Should the newly created body be immediately added to the World? + * + * @return {MatterJS.BodyType} A Matter JS Body. + */ + fromJSON: function (x, y, config, options, addToWorld) + { + if (options === undefined) { options = {}; } + if (addToWorld === undefined) { addToWorld = true; } + + var body = PhysicsJSONParser.parseBody(x, y, config, options); + + if (body && addToWorld) + { + this.world.add(body); + } + + return body; + }, + + /** + * Create a new composite containing Matter Image objects created in a grid arrangement. + * This function uses the body bounds to prevent overlaps. + * + * @method Phaser.Physics.Matter.Factory#imageStack + * @since 3.0.0 + * + * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} frame - An optional frame from the Texture this Game Object is rendering with. Set to `null` to skip this value. + * @param {number} x - The horizontal position of this composite in the world. + * @param {number} y - The vertical position of this composite in the world. + * @param {number} columns - The number of columns in the grid. + * @param {number} rows - The number of rows in the grid. + * @param {number} [columnGap=0] - The distance between each column. + * @param {number} [rowGap=0] - The distance between each row. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {MatterJS.CompositeType} A Matter JS Composite Stack. + */ + imageStack: function (key, frame, x, y, columns, rows, columnGap, rowGap, options) + { + if (columnGap === undefined) { columnGap = 0; } + if (rowGap === undefined) { rowGap = 0; } + if (options === undefined) { options = {}; } + + var world = this.world; + var displayList = this.sys.displayList; + + options.addToWorld = false; + + var stack = Composites.stack(x, y, columns, rows, columnGap, rowGap, function (x, y) + { + var image = new MatterImage(world, x, y, key, frame, options); + + displayList.add(image); + + return image.body; + }); + + world.add(stack); + + return stack; + }, + + /** + * Create a new composite containing bodies created in the callback in a grid arrangement. + * + * This function uses the body bounds to prevent overlaps. + * + * @method Phaser.Physics.Matter.Factory#stack + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this composite in the world. + * @param {number} y - The vertical position of this composite in the world. + * @param {number} columns - The number of columns in the grid. + * @param {number} rows - The number of rows in the grid. + * @param {number} columnGap - The distance between each column. + * @param {number} rowGap - The distance between each row. + * @param {function} callback - The callback that creates the stack. + * + * @return {MatterJS.CompositeType} A new composite containing objects created in the callback. + */ + stack: function (x, y, columns, rows, columnGap, rowGap, callback) + { + var stack = Composites.stack(x, y, columns, rows, columnGap, rowGap, callback); + + this.world.add(stack); + + return stack; + }, + + /** + * Create a new composite containing bodies created in the callback in a pyramid arrangement. + * This function uses the body bounds to prevent overlaps. + * + * @method Phaser.Physics.Matter.Factory#pyramid + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this composite in the world. + * @param {number} y - The vertical position of this composite in the world. + * @param {number} columns - The number of columns in the pyramid. + * @param {number} rows - The number of rows in the pyramid. + * @param {number} columnGap - The distance between each column. + * @param {number} rowGap - The distance between each row. + * @param {function} callback - The callback function to be invoked. + * + * @return {MatterJS.CompositeType} A Matter JS Composite pyramid. + */ + pyramid: function (x, y, columns, rows, columnGap, rowGap, callback) + { + var stack = Composites.pyramid(x, y, columns, rows, columnGap, rowGap, callback); + + this.world.add(stack); + + return stack; + }, + + /** + * Chains all bodies in the given composite together using constraints. + * + * @method Phaser.Physics.Matter.Factory#chain + * @since 3.0.0 + * + * @param {MatterJS.CompositeType} composite - The composite in which all bodies will be chained together sequentially. + * @param {number} xOffsetA - The horizontal offset of the BodyA constraint. This is a percentage based on the body size, not a world position. + * @param {number} yOffsetA - The vertical offset of the BodyA constraint. This is a percentage based on the body size, not a world position. + * @param {number} xOffsetB - The horizontal offset of the BodyB constraint. This is a percentage based on the body size, not a world position. + * @param {number} yOffsetB - The vertical offset of the BodyB constraint. This is a percentage based on the body size, not a world position. + * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. + * + * @return {MatterJS.CompositeType} The original composite that was passed to this method. + */ + chain: function (composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options) + { + return Composites.chain(composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options); + }, + + /** + * Connects bodies in the composite with constraints in a grid pattern, with optional cross braces. + * + * @method Phaser.Physics.Matter.Factory#mesh + * @since 3.0.0 + * + * @param {MatterJS.CompositeType} composite - The composite in which all bodies will be chained together. + * @param {number} columns - The number of columns in the mesh. + * @param {number} rows - The number of rows in the mesh. + * @param {boolean} crossBrace - Create cross braces for the mesh as well? + * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. + * + * @return {MatterJS.CompositeType} The original composite that was passed to this method. + */ + mesh: function (composite, columns, rows, crossBrace, options) + { + return Composites.mesh(composite, columns, rows, crossBrace, options); + }, + + /** + * Creates a composite with a Newton's Cradle setup of bodies and constraints. + * + * @method Phaser.Physics.Matter.Factory#newtonsCradle + * @since 3.0.0 + * + * @param {number} x - The horizontal position of the start of the cradle. + * @param {number} y - The vertical position of the start of the cradle. + * @param {number} number - The number of balls in the cradle. + * @param {number} size - The radius of each ball in the cradle. + * @param {number} length - The length of the 'string' the balls hang from. + * + * @return {MatterJS.CompositeType} A Newton's cradle composite. + */ + newtonsCradle: function (x, y, number, size, length) + { + var composite = Composites.newtonsCradle(x, y, number, size, length); + + this.world.add(composite); + + return composite; + }, + + /** + * Creates a composite with simple car setup of bodies and constraints. + * + * @method Phaser.Physics.Matter.Factory#car + * @since 3.0.0 + * + * @param {number} x - The horizontal position of the car in the world. + * @param {number} y - The vertical position of the car in the world. + * @param {number} width - The width of the car chasis. + * @param {number} height - The height of the car chasis. + * @param {number} wheelSize - The radius of the car wheels. + * + * @return {MatterJS.CompositeType} A new composite car body. + */ + car: function (x, y, width, height, wheelSize) + { + var composite = Composites.car(x, y, width, height, wheelSize); + + this.world.add(composite); + + return composite; + }, + + /** + * Creates a simple soft body like object. + * + * @method Phaser.Physics.Matter.Factory#softBody + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this composite in the world. + * @param {number} y - The vertical position of this composite in the world. + * @param {number} columns - The number of columns in the Composite. + * @param {number} rows - The number of rows in the Composite. + * @param {number} columnGap - The distance between each column. + * @param {number} rowGap - The distance between each row. + * @param {boolean} crossBrace - `true` to create cross braces between the bodies, or `false` to create just straight braces. + * @param {number} particleRadius - The radius of this circlular composite. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [particleOptions] - An optional Body configuration object that is used to set initial Body properties on creation. + * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [constraintOptions] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. + * + * @return {MatterJS.CompositeType} A new composite simple soft body. + */ + softBody: function (x, y, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions) + { + var composite = Composites.softBody(x, y, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions); + + this.world.add(composite); + + return composite; + }, + + /** + * This method is an alias for `Factory.constraint`. + * + * Constraints (or joints) are used for specifying that a fixed distance must be maintained + * between two bodies, or a body and a fixed world-space position. + * + * The stiffness of constraints can be modified to create springs or elastic. + * + * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` + * value (e.g. `0.7` or above). + * + * If the constraint is unstable, try lowering the `stiffness` value and / or increasing + * `constraintIterations` within the Matter Config. + * + * For compound bodies, constraints must be applied to the parent body and not one of its parts. + * + * @method Phaser.Physics.Matter.Factory#joint + * @since 3.0.0 + * + * @param {MatterJS.BodyType} bodyA - The first possible `Body` that this constraint is attached to. + * @param {MatterJS.BodyType} bodyB - The second possible `Body` that this constraint is attached to. + * @param {number} [length] - A Number that specifies the target resting length of the constraint. If not given it is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. + * @param {number} [stiffness=1] - A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts as a soft spring. + * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. + * + * @return {MatterJS.ConstraintType} A Matter JS Constraint. + */ + joint: function (bodyA, bodyB, length, stiffness, options) + { + return this.constraint(bodyA, bodyB, length, stiffness, options); + }, + + /** + * This method is an alias for `Factory.constraint`. + * + * Constraints (or joints) are used for specifying that a fixed distance must be maintained + * between two bodies, or a body and a fixed world-space position. + * + * The stiffness of constraints can be modified to create springs or elastic. + * + * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` + * value (e.g. `0.7` or above). + * + * If the constraint is unstable, try lowering the `stiffness` value and / or increasing + * `constraintIterations` within the Matter Config. + * + * For compound bodies, constraints must be applied to the parent body and not one of its parts. + * + * @method Phaser.Physics.Matter.Factory#spring + * @since 3.0.0 + * + * @param {MatterJS.BodyType} bodyA - The first possible `Body` that this constraint is attached to. + * @param {MatterJS.BodyType} bodyB - The second possible `Body` that this constraint is attached to. + * @param {number} [length] - A Number that specifies the target resting length of the constraint. If not given it is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. + * @param {number} [stiffness=1] - A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts as a soft spring. + * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. + * + * @return {MatterJS.ConstraintType} A Matter JS Constraint. + */ + spring: function (bodyA, bodyB, length, stiffness, options) + { + return this.constraint(bodyA, bodyB, length, stiffness, options); + }, + + /** + * Constraints (or joints) are used for specifying that a fixed distance must be maintained + * between two bodies, or a body and a fixed world-space position. + * + * The stiffness of constraints can be modified to create springs or elastic. + * + * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` + * value (e.g. `0.7` or above). + * + * If the constraint is unstable, try lowering the `stiffness` value and / or increasing + * `constraintIterations` within the Matter Config. + * + * For compound bodies, constraints must be applied to the parent body and not one of its parts. + * + * @method Phaser.Physics.Matter.Factory#constraint + * @since 3.0.0 + * + * @param {MatterJS.BodyType} bodyA - The first possible `Body` that this constraint is attached to. + * @param {MatterJS.BodyType} bodyB - The second possible `Body` that this constraint is attached to. + * @param {number} [length] - A Number that specifies the target resting length of the constraint. If not given it is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. + * @param {number} [stiffness=1] - A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts as a soft spring. + * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. + * + * @return {MatterJS.ConstraintType} A Matter JS Constraint. + */ + constraint: function (bodyA, bodyB, length, stiffness, options) + { + if (stiffness === undefined) { stiffness = 1; } + if (options === undefined) { options = {}; } + + options.bodyA = (bodyA.type === 'body') ? bodyA : bodyA.body; + options.bodyB = (bodyB.type === 'body') ? bodyB : bodyB.body; + + if (!isNaN(length)) + { + options.length = length; + } + + options.stiffness = stiffness; + + var constraint = Constraint.create(options); + + this.world.add(constraint); + + return constraint; + }, + + /** + * Constraints (or joints) are used for specifying that a fixed distance must be maintained + * between two bodies, or a body and a fixed world-space position. + * + * A world constraint has only one body, you should specify a `pointA` position in + * the constraint options parameter to attach the constraint to the world. + * + * The stiffness of constraints can be modified to create springs or elastic. + * + * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` + * value (e.g. `0.7` or above). + * + * If the constraint is unstable, try lowering the `stiffness` value and / or increasing + * `constraintIterations` within the Matter Config. + * + * For compound bodies, constraints must be applied to the parent body and not one of its parts. + * + * @method Phaser.Physics.Matter.Factory#worldConstraint + * @since 3.0.0 + * + * @param {MatterJS.BodyType} body - The Matter `Body` that this constraint is attached to. + * @param {number} [length] - A number that specifies the target resting length of the constraint. If not given it is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. + * @param {number} [stiffness=1] - A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts as a soft spring. + * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. + * + * @return {MatterJS.ConstraintType} A Matter JS Constraint. + */ + worldConstraint: function (body, length, stiffness, options) + { + if (stiffness === undefined) { stiffness = 1; } + if (options === undefined) { options = {}; } + + options.bodyB = (body.type === 'body') ? body : body.body; + + if (!isNaN(length)) + { + options.length = length; + } + + options.stiffness = stiffness; + + var constraint = Constraint.create(options); + + this.world.add(constraint); + + return constraint; + }, + + /** + * This method is an alias for `Factory.pointerConstraint`. + * + * A Pointer Constraint is a special type of constraint that allows you to click + * and drag bodies in a Matter World. It monitors the active Pointers in a Scene, + * and when one is pressed down it checks to see if that hit any part of any active + * body in the world. If it did, and the body has input enabled, it will begin to + * drag it until either released, or you stop it via the `stopDrag` method. + * + * You can adjust the stiffness, length and other properties of the constraint via + * the `options` object on creation. + * + * @method Phaser.Physics.Matter.Factory#mouseSpring + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. + * + * @return {MatterJS.ConstraintType} A Matter JS Constraint. + */ + mouseSpring: function (options) + { + return this.pointerConstraint(options); + }, + + /** + * A Pointer Constraint is a special type of constraint that allows you to click + * and drag bodies in a Matter World. It monitors the active Pointers in a Scene, + * and when one is pressed down it checks to see if that hit any part of any active + * body in the world. If it did, and the body has input enabled, it will begin to + * drag it until either released, or you stop it via the `stopDrag` method. + * + * You can adjust the stiffness, length and other properties of the constraint via + * the `options` object on creation. + * + * @method Phaser.Physics.Matter.Factory#pointerConstraint + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. + * + * @return {MatterJS.ConstraintType} A Matter JS Constraint. + */ + pointerConstraint: function (options) + { + if (options === undefined) { options = {}; } + + if (!options.hasOwnProperty('render')) + { + options.render = { visible: false }; + } + + var pointerConstraint = new PointerConstraint(this.scene, this.world, options); + + this.world.add(pointerConstraint.constraint); + + return pointerConstraint; + }, + + /** + * Creates a Matter Physics Image Game Object. + * + * An Image is a light-weight Game Object useful for the display of static images in your game, + * such as logos, backgrounds, scenery or other non-animated elements. Images can have input + * events and physics bodies, or be tweened, tinted or scrolled. The main difference between an + * Image and a Sprite is that you cannot animate an Image as they do not have the Animation component. + * + * @method Phaser.Physics.Matter.Factory#image + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. Set to `null` to skip this value. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {Phaser.Physics.Matter.Image} The Matter Image Game Object. + */ + image: function (x, y, key, frame, options) + { + var image = new MatterImage(this.world, x, y, key, frame, options); + + this.sys.displayList.add(image); + + return image; + }, + + /** + * Creates a wrapper around a Tile that provides access to a corresponding Matter body. A tile can only + * have one Matter body associated with it. You can either pass in an existing Matter body for + * the tile or allow the constructor to create the corresponding body for you. If the Tile has a + * collision group (defined in Tiled), those shapes will be used to create the body. If not, the + * tile's rectangle bounding box will be used. + * + * The corresponding body will be accessible on the Tile itself via Tile.physics.matterBody. + * + * Note: not all Tiled collision shapes are supported. See + * Phaser.Physics.Matter.TileBody#setFromTileCollision for more information. + * + * @method Phaser.Physics.Matter.Factory#tileBody + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.Tile} tile - The target tile that should have a Matter body. + * @param {Phaser.Types.Physics.Matter.MatterTileOptions} [options] - Options to be used when creating the Matter body. + * + * @return {Phaser.Physics.Matter.TileBody} The Matter Tile Body Game Object. + */ + tileBody: function (tile, options) + { + return new MatterTileBody(this.world, tile, options); + }, + + /** + * Creates a Matter Physics Sprite Game Object. + * + * A Sprite Game Object is used for the display of both static and animated images in your game. + * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled + * and animated. + * + * The main difference between a Sprite and an Image Game Object is that you cannot animate Images. + * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation + * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases. + * + * @method Phaser.Physics.Matter.Factory#sprite + * @since 3.0.0 + * + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. Set to `null` to skip this value. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {Phaser.Physics.Matter.Sprite} The Matter Sprite Game Object. + */ + sprite: function (x, y, key, frame, options) + { + var sprite = new MatterSprite(this.world, x, y, key, frame, options); + + this.sys.displayList.add(sprite); + this.sys.updateList.add(sprite); + + return sprite; + }, + + /** + * Takes an existing Game Object and injects all of the Matter Components into it. + * + * This enables you to use component methods such as `setVelocity` or `isSensor` directly from + * this Game Object. + * + * You can also pass in either a Matter Body Configuration object, or a Matter Body instance + * to link with this Game Object. + * + * @method Phaser.Physics.Matter.Factory#gameObject + * @since 3.3.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to inject the Matter Components in to. + * @param {(Phaser.Types.Physics.Matter.MatterBodyConfig|MatterJS.Body)} [options] - A Matter Body configuration object, or an instance of a Matter Body. + * @param {boolean} [addToWorld=true] - Add this Matter Body to the World? + * + * @return {(Phaser.Physics.Matter.Image|Phaser.Physics.Matter.Sprite|Phaser.GameObjects.GameObject)} The Game Object that had the Matter Components injected into it. + */ + gameObject: function (gameObject, options, addToWorld) + { + return MatterGameObject(this.world, gameObject, options, addToWorld); + }, + + /** + * Destroys this Factory. + * + * @method Phaser.Physics.Matter.Factory#destroy + * @since 3.5.0 + */ + destroy: function () + { + this.world = null; + this.scene = null; + this.sys = null; + } + +}); + +module.exports = Factory; + + +/***/ }), + +/***/ 3860: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Components = __webpack_require__(74527); +var GetFastValue = __webpack_require__(72632); +var Vector2 = __webpack_require__(93736); + +/** + * Internal function to check if the object has a getter or setter. + * + * @function hasGetterOrSetter + * @private + * + * @param {object} def - The object to check. + * + * @return {boolean} True if it has a getter or setter, otherwise false. + */ +function hasGetterOrSetter (def) +{ + return (!!def.get && typeof def.get === 'function') || (!!def.set && typeof def.set === 'function'); +} + +/** + * A Matter Game Object is a generic object that allows you to combine any Phaser Game Object, + * including those you have extended or created yourself, with all of the Matter Components. + * + * This enables you to use component methods such as `setVelocity` or `isSensor` directly from + * this Game Object. + * + * @function Phaser.Physics.Matter.MatterGameObject + * @since 3.3.0 + * + * @param {Phaser.Physics.Matter.World} world - The Matter world to add the body to. + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will have the Matter body applied to it. + * @param {(Phaser.Types.Physics.Matter.MatterBodyConfig|MatterJS.Body)} [options] - A Matter Body configuration object, or an instance of a Matter Body. + * @param {boolean} [addToWorld=true] - Should the newly created body be immediately added to the World? + * + * @return {Phaser.GameObjects.GameObject} The Game Object that was created with the Matter body. + */ +var MatterGameObject = function (world, gameObject, options, addToWorld) +{ + if (options === undefined) { options = {}; } + if (addToWorld === undefined) { addToWorld = true; } + + var x = gameObject.x; + var y = gameObject.y; + + // Temp body pos to avoid body null checks + gameObject.body = { + temp: true, + position: { + x: x, + y: y + } + }; + + var mixins = [ + Components.Bounce, + Components.Collision, + Components.Force, + Components.Friction, + Components.Gravity, + Components.Mass, + Components.Sensor, + Components.SetBody, + Components.Sleep, + Components.Static, + Components.Transform, + Components.Velocity + ]; + + // First let's inject all of the components into the Game Object + mixins.forEach(function (mixin) + { + for (var key in mixin) + { + if (hasGetterOrSetter(mixin[key])) + { + Object.defineProperty(gameObject, key, { + get: mixin[key].get, + set: mixin[key].set + }); + } + else + { + Object.defineProperty(gameObject, key, {value: mixin[key]}); + } + } + + }); + + gameObject.world = world; + + gameObject._tempVec2 = new Vector2(x, y); + + if (options.hasOwnProperty('type') && options.type === 'body') + { + gameObject.setExistingBody(options, addToWorld); + } + else + { + var shape = GetFastValue(options, 'shape', null); + + if (!shape) + { + shape = 'rectangle'; + } + + options.addToWorld = addToWorld; + + gameObject.setBody(shape, options); + } + + return gameObject; +}; + +module.exports = MatterGameObject; + + +/***/ }), + +/***/ 7030: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var Components = __webpack_require__(74527); +var GameObject = __webpack_require__(89980); +var GetFastValue = __webpack_require__(72632); +var Image = __webpack_require__(1539); +var Pipeline = __webpack_require__(58210); +var Vector2 = __webpack_require__(93736); + +/** + * @classdesc + * A Matter Physics Image Game Object. + * + * An Image is a light-weight Game Object useful for the display of static images in your game, + * such as logos, backgrounds, scenery or other non-animated elements. Images can have input + * events and physics bodies, or be tweened, tinted or scrolled. The main difference between an + * Image and a Sprite is that you cannot animate an Image as they do not have the Animation component. + * + * @class Image + * @extends Phaser.GameObjects.Image + * @memberof Phaser.Physics.Matter + * @constructor + * @since 3.0.0 + * + * @extends Phaser.Physics.Matter.Components.Bounce + * @extends Phaser.Physics.Matter.Components.Collision + * @extends Phaser.Physics.Matter.Components.Force + * @extends Phaser.Physics.Matter.Components.Friction + * @extends Phaser.Physics.Matter.Components.Gravity + * @extends Phaser.Physics.Matter.Components.Mass + * @extends Phaser.Physics.Matter.Components.Sensor + * @extends Phaser.Physics.Matter.Components.SetBody + * @extends Phaser.Physics.Matter.Components.Sleep + * @extends Phaser.Physics.Matter.Components.Static + * @extends Phaser.Physics.Matter.Components.Transform + * @extends Phaser.Physics.Matter.Components.Velocity + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Physics.Matter.World} world - A reference to the Matter.World instance that this body belongs to. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + */ +var MatterImage = new Class({ + + Extends: Image, + + Mixins: [ + Components.Bounce, + Components.Collision, + Components.Force, + Components.Friction, + Components.Gravity, + Components.Mass, + Components.Sensor, + Components.SetBody, + Components.Sleep, + Components.Static, + Components.Transform, + Components.Velocity, + Pipeline + ], + + initialize: + + function MatterImage (world, x, y, texture, frame, options) + { + GameObject.call(this, world.scene, 'Image'); + + /** + * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. + * + * @name Phaser.Physics.Matter.Image#_crop + * @type {object} + * @private + * @since 3.24.0 + */ + this._crop = this.resetCropObject(); + + this.setTexture(texture, frame); + this.setSizeToFrame(); + this.setOrigin(); + + /** + * A reference to the Matter.World instance that this body belongs to. + * + * @name Phaser.Physics.Matter.Image#world + * @type {Phaser.Physics.Matter.World} + * @since 3.0.0 + */ + this.world = world; + + /** + * An internal temp vector used for velocity and force calculations. + * + * @name Phaser.Physics.Matter.Image#_tempVec2 + * @type {Phaser.Math.Vector2} + * @private + * @since 3.0.0 + */ + this._tempVec2 = new Vector2(x, y); + + var shape = GetFastValue(options, 'shape', null); + + if (shape) + { + this.setBody(shape, options); + } + else + { + this.setRectangle(this.width, this.height, options); + } + + this.setPosition(x, y); + + this.initPipeline(); + this.initPostPipeline(true); + } + +}); + +module.exports = MatterImage; + + +/***/ }), + +/***/ 50583: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var ALIGN_CONST = __webpack_require__(84093); +var Axes = __webpack_require__(50658); +var Bodies = __webpack_require__(68516); +var Body = __webpack_require__(84125); +var BodyBounds = __webpack_require__(63568); +var Bounds = __webpack_require__(84091); +var Class = __webpack_require__(56694); +var Collision = __webpack_require__(63454); +var Common = __webpack_require__(68758); +var Composite = __webpack_require__(11299); +var Composites = __webpack_require__(56643); +var Constraint = __webpack_require__(52838); +var Detector = __webpack_require__(13657); +var DistanceBetween = __webpack_require__(53996); +var Factory = __webpack_require__(72653); +var GetFastValue = __webpack_require__(72632); +var GetValue = __webpack_require__(10850); +var MatterAttractors = __webpack_require__(1675); +var MatterCollisionEvents = __webpack_require__(80391); +var MatterLib = __webpack_require__(16929); +var MatterWrap = __webpack_require__(44097); +var Merge = __webpack_require__(30657); +var Pair = __webpack_require__(70584); +var Pairs = __webpack_require__(91327); +var Plugin = __webpack_require__(84474); +var PluginCache = __webpack_require__(91963); +var Query = __webpack_require__(13390); +var Resolver = __webpack_require__(44272); +var SceneEvents = __webpack_require__(7599); +var Svg = __webpack_require__(92765); +var Vector = __webpack_require__(10438); +var Vertices = __webpack_require__(39745); +var World = __webpack_require__(31468); + +Common.setDecomp(__webpack_require__(81084)); + +/** + * @classdesc + * The Phaser Matter plugin provides the ability to use the Matter JS Physics Engine within your Phaser games. + * + * Unlike Arcade Physics, the other physics system provided with Phaser, Matter JS is a full-body physics system. + * It features: + * + * * Rigid bodies + * * Compound bodies + * * Composite bodies + * * Concave and convex hulls + * * Physical properties (mass, area, density etc.) + * * Restitution (elastic and inelastic collisions) + * * Collisions (broad-phase, mid-phase and narrow-phase) + * * Stable stacking and resting + * * Conservation of momentum + * * Friction and resistance + * * Constraints + * * Gravity + * * Sleeping and static bodies + * * Rounded corners (chamfering) + * * Views (translate, zoom) + * * Collision queries (raycasting, region tests) + * * Time scaling (slow-mo, speed-up) + * + * Configuration of Matter is handled via the Matter World Config object, which can be passed in either the + * Phaser Game Config, or Phaser Scene Config. Here is a basic example: + * + * ```js + * physics: { + * default: 'matter', + * matter: { + * enableSleeping: true, + * gravity: { + * y: 0 + * }, + * debug: { + * showBody: true, + * showStaticBody: true + * } + * } + * } + * ``` + * + * This class acts as an interface between a Phaser Scene and a single instance of the Matter Engine. + * + * Use it to access the most common Matter features and helper functions. + * + * You can find details, documentation and examples on the Matter JS website: https://brm.io/matter-js/ + * + * @class MatterPhysics + * @memberof Phaser.Physics.Matter + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Phaser Scene that owns this Matter Physics instance. + */ +var MatterPhysics = new Class({ + + initialize: + + function MatterPhysics (scene) + { + /** + * The Phaser Scene that owns this Matter Physics instance + * + * @name Phaser.Physics.Matter.MatterPhysics#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; + + /** + * A reference to the Scene Systems that belong to the Scene owning this Matter Physics instance. + * + * @name Phaser.Physics.Matter.MatterPhysics#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; + + /** + * The parsed Matter Configuration object. + * + * @name Phaser.Physics.Matter.MatterPhysics#config + * @type {Phaser.Types.Physics.Matter.MatterWorldConfig} + * @since 3.0.0 + */ + this.config = this.getConfig(); + + /** + * An instance of the Matter World class. This class is responsible for the updating of the + * Matter Physics world, as well as handling debug drawing functions. + * + * @name Phaser.Physics.Matter.MatterPhysics#world + * @type {Phaser.Physics.Matter.World} + * @since 3.0.0 + */ + this.world; + + /** + * An instance of the Matter Factory. This class provides lots of functions for creating a + * wide variety of physics objects and adds them automatically to the Matter World. + * + * You can use this class to cut-down on the amount of code required in your game, however, + * use of the Factory is entirely optional and should be seen as a development aid. It's + * perfectly possible to create and add components to the Matter world without using it. + * + * @name Phaser.Physics.Matter.MatterPhysics#add + * @type {Phaser.Physics.Matter.Factory} + * @since 3.0.0 + */ + this.add; + + /** + * An instance of the Body Bounds class. This class contains functions used for getting the + * world position from various points around the bounds of a physics body. + * + * @name Phaser.Physics.Matter.MatterPhysics#bodyBounds + * @type {Phaser.Physics.Matter.BodyBounds} + * @since 3.22.0 + */ + this.bodyBounds; + + // Body + + /** + * A reference to the `Matter.Body` module. + * + * The `Matter.Body` module contains methods for creating and manipulating body models. + * A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`. + * Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the `Bodies` module. + * + * @name Phaser.Physics.Matter.MatterPhysics#body + * @type {MatterJS.BodyFactory} + * @since 3.18.0 + */ + this.body = Body; + + /** + * A reference to the `Matter.Composite` module. + * + * The `Matter.Composite` module contains methods for creating and manipulating composite bodies. + * A composite body is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`, therefore composites form a tree structure. + * It is important to use the functions in this module to modify composites, rather than directly modifying their properties. + * Note that the `Matter.World` object is also a type of `Matter.Composite` and as such all composite methods here can also operate on a `Matter.World`. + * + * @name Phaser.Physics.Matter.MatterPhysics#composite + * @type {MatterJS.CompositeFactory} + * @since 3.22.0 + */ + this.composite = Composite; + + // Collision: + + /** + * A reference to the `Matter.Collision` module. + * + * The `Matter.Collision` module contains methods for detecting collisions between a given pair of bodies. + * + * For efficient detection between a list of bodies, see `Matter.Detector` and `Matter.Query`. + * + * @name Phaser.Physics.Matter.MatterPhysics#collision + * @type {MatterJS.Collision} + * @since 3.60.0 + */ + this.collision = Collision; + + /** + * A reference to the `Matter.Detector` module. + * + * The `Matter.Detector` module contains methods for detecting collisions given a set of pairs. + * + * @name Phaser.Physics.Matter.MatterPhysics#detector + * @type {MatterJS.DetectorFactory} + * @since 3.22.0 + */ + this.detector = Detector; + + /** + * A reference to the `Matter.Pair` module. + * + * The `Matter.Pair` module contains methods for creating and manipulating collision pairs. + * + * @name Phaser.Physics.Matter.MatterPhysics#pair + * @type {MatterJS.PairFactory} + * @since 3.22.0 + */ + this.pair = Pair; + + /** + * A reference to the `Matter.Pairs` module. + * + * The `Matter.Pairs` module contains methods for creating and manipulating collision pair sets. + * + * @name Phaser.Physics.Matter.MatterPhysics#pairs + * @type {MatterJS.PairsFactory} + * @since 3.22.0 + */ + this.pairs = Pairs; + + /** + * A reference to the `Matter.Query` module. + * + * The `Matter.Query` module contains methods for performing collision queries. + * + * @name Phaser.Physics.Matter.MatterPhysics#query + * @type {MatterJS.QueryFactory} + * @since 3.22.0 + */ + this.query = Query; + + /** + * A reference to the `Matter.Resolver` module. + * + * The `Matter.Resolver` module contains methods for resolving collision pairs. + * + * @name Phaser.Physics.Matter.MatterPhysics#resolver + * @type {MatterJS.ResolverFactory} + * @since 3.22.0 + */ + this.resolver = Resolver; + + // Constraint + + /** + * A reference to the `Matter.Constraint` module. + * + * The `Matter.Constraint` module contains methods for creating and manipulating constraints. + * Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position). + * The stiffness of constraints can be modified to create springs or elastic. + * + * @name Phaser.Physics.Matter.MatterPhysics#constraint + * @type {MatterJS.ConstraintFactory} + * @since 3.22.0 + */ + this.constraint = Constraint; + + // Factory + + /** + * A reference to the `Matter.Bodies` module. + * + * The `Matter.Bodies` module contains factory methods for creating rigid bodies + * with commonly used body configurations (such as rectangles, circles and other polygons). + * + * @name Phaser.Physics.Matter.MatterPhysics#bodies + * @type {MatterJS.BodiesFactory} + * @since 3.18.0 + */ + this.bodies = Bodies; + + /** + * A reference to the `Matter.Composites` module. + * + * The `Matter.Composites` module contains factory methods for creating composite bodies + * with commonly used configurations (such as stacks and chains). + * + * @name Phaser.Physics.Matter.MatterPhysics#composites + * @type {MatterJS.CompositesFactory} + * @since 3.22.0 + */ + this.composites = Composites; + + // Geometry + + /** + * A reference to the `Matter.Axes` module. + * + * The `Matter.Axes` module contains methods for creating and manipulating sets of axes. + * + * @name Phaser.Physics.Matter.MatterPhysics#axes + * @type {MatterJS.AxesFactory} + * @since 3.22.0 + */ + this.axes = Axes; + + /** + * A reference to the `Matter.Bounds` module. + * + * The `Matter.Bounds` module contains methods for creating and manipulating axis-aligned bounding boxes (AABB). + * + * @name Phaser.Physics.Matter.MatterPhysics#bounds + * @type {MatterJS.BoundsFactory} + * @since 3.22.0 + */ + this.bounds = Bounds; + + /** + * A reference to the `Matter.Svg` module. + * + * The `Matter.Svg` module contains methods for converting SVG images into an array of vector points. + * + * To use this module you also need the SVGPathSeg polyfill: https://github.com/progers/pathseg + * + * @name Phaser.Physics.Matter.MatterPhysics#svg + * @type {MatterJS.SvgFactory} + * @since 3.22.0 + */ + this.svg = Svg; + + /** + * A reference to the `Matter.Vector` module. + * + * The `Matter.Vector` module contains methods for creating and manipulating vectors. + * Vectors are the basis of all the geometry related operations in the engine. + * A `Matter.Vector` object is of the form `{ x: 0, y: 0 }`. + * + * @name Phaser.Physics.Matter.MatterPhysics#vector + * @type {MatterJS.VectorFactory} + * @since 3.22.0 + */ + this.vector = Vector; + + /** + * A reference to the `Matter.Vertices` module. + * + * The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. + * A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. + * A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull). + * + * @name Phaser.Physics.Matter.MatterPhysics#vertices + * @type {MatterJS.VerticesFactory} + * @since 3.22.0 + */ + this.vertices = Vertices; + + /** + * A reference to the `Matter.Vertices` module. + * + * The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. + * A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. + * A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull). + * + * @name Phaser.Physics.Matter.MatterPhysics#verts + * @type {MatterJS.VerticesFactory} + * @since 3.14.0 + */ + this.verts = Vertices; + + /** + * An internal temp vector used for velocity and force calculations. + * + * @name Phaser.Physics.Matter.MatterPhysics#_tempVec2 + * @type {MatterJS.Vector} + * @private + * @since 3.22.0 + */ + this._tempVec2 = Vector.create(); + + // Matter plugins + + if (GetValue(this.config, 'plugins.collisionevents', true)) + { + this.enableCollisionEventsPlugin(); + } + + if (GetValue(this.config, 'plugins.attractors', false)) + { + this.enableAttractorPlugin(); + } + + if (GetValue(this.config, 'plugins.wrap', false)) + { + this.enableWrapPlugin(); + } + + Resolver._restingThresh = GetValue(this.config, 'restingThresh', 4); + Resolver._restingThreshTangent = GetValue(this.config, 'restingThreshTangent', 6); + Resolver._positionDampen = GetValue(this.config, 'positionDampen', 0.9); + Resolver._positionWarming = GetValue(this.config, 'positionWarming', 0.8); + Resolver._frictionNormalMultiplier = GetValue(this.config, 'frictionNormalMultiplier', 5); + + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); + }, + + /** + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. + * + * @method Phaser.Physics.Matter.MatterPhysics#boot + * @private + * @since 3.5.1 + */ + boot: function () + { + this.world = new World(this.scene, this.config); + this.add = new Factory(this.world); + this.bodyBounds = new BodyBounds(); + + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); + }, + + /** + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. + * + * @method Phaser.Physics.Matter.MatterPhysics#start + * @private + * @since 3.5.0 + */ + start: function () + { + if (!this.world) + { + this.world = new World(this.scene, this.config); + this.add = new Factory(this.world); + } + + var eventEmitter = this.systems.events; + + eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.on(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); + }, + + /** + * This internal method is called when this class starts and retrieves the final Matter World Config. + * + * @method Phaser.Physics.Matter.MatterPhysics#getConfig + * @since 3.0.0 + * + * @return {Phaser.Types.Physics.Matter.MatterWorldConfig} The Matter World Config. + */ + getConfig: function () + { + var gameConfig = this.systems.game.config.physics; + var sceneConfig = this.systems.settings.physics; + + var config = Merge( + GetFastValue(sceneConfig, 'matter', {}), + GetFastValue(gameConfig, 'matter', {}) + ); + + return config; + }, + + /** + * Enables the Matter Attractors Plugin. + * + * The attractors plugin that makes it easy to apply continual forces on bodies. + * It's possible to simulate effects such as wind, gravity and magnetism. + * + * https://github.com/liabru/matter-attractors + * + * This method is called automatically if `plugins.attractors` is set in the Matter World Config. + * However, you can also call it directly from within your game. + * + * @method Phaser.Physics.Matter.MatterPhysics#enableAttractorPlugin + * @since 3.0.0 + * + * @return {this} This Matter Physics instance. + */ + enableAttractorPlugin: function () + { + Plugin.register(MatterAttractors); + Plugin.use(MatterLib, MatterAttractors); + + return this; + }, + + /** + * Enables the Matter Wrap Plugin. + * + * The coordinate wrapping plugin that automatically wraps the position of bodies such that they always stay + * within the given bounds. Upon crossing a boundary the body will appear on the opposite side of the bounds, + * while maintaining its velocity. + * + * https://github.com/liabru/matter-wrap + * + * This method is called automatically if `plugins.wrap` is set in the Matter World Config. + * However, you can also call it directly from within your game. + * + * @method Phaser.Physics.Matter.MatterPhysics#enableWrapPlugin + * @since 3.0.0 + * + * @return {this} This Matter Physics instance. + */ + enableWrapPlugin: function () + { + Plugin.register(MatterWrap); + Plugin.use(MatterLib, MatterWrap); + + return this; + }, + + /** + * Enables the Matter Collision Events Plugin. + * + * Note that this plugin is enabled by default. So you should only ever need to call this + * method if you have specifically disabled the plugin in your Matter World Config. + * You can disable it by setting `plugins.collisionevents: false` in your Matter World Config. + * + * This plugin triggers three new events on Matter.Body: + * + * 1. `onCollide` + * 2. `onCollideEnd` + * 3. `onCollideActive` + * + * These events correspond to the Matter.js events `collisionStart`, `collisionActive` and `collisionEnd`, respectively. + * You can listen to these events via Matter.Events or they will also be emitted from the Matter World. + * + * This plugin also extends Matter.Body with three convenience functions: + * + * `Matter.Body.setOnCollide(callback)` + * `Matter.Body.setOnCollideEnd(callback)` + * `Matter.Body.setOnCollideActive(callback)` + * + * You can register event callbacks by providing a function of type (pair: Matter.Pair) => void + * + * https://github.com/dxu/matter-collision-events + * + * @method Phaser.Physics.Matter.MatterPhysics#enableCollisionEventsPlugin + * @since 3.22.0 + * + * @return {this} This Matter Physics instance. + */ + enableCollisionEventsPlugin: function () + { + Plugin.register(MatterCollisionEvents); + Plugin.use(MatterLib, MatterCollisionEvents); + + return this; + }, + + /** + * Pauses the Matter World instance and sets `enabled` to `false`. + * + * A paused world will not run any simulations for the duration it is paused. + * + * @method Phaser.Physics.Matter.MatterPhysics#pause + * @fires Phaser.Physics.Matter.Events#PAUSE + * @since 3.0.0 + * + * @return {Phaser.Physics.Matter.World} The Matter World object. + */ + pause: function () + { + return this.world.pause(); + }, + + /** + * Resumes this Matter World instance from a paused state and sets `enabled` to `true`. + * + * @method Phaser.Physics.Matter.MatterPhysics#resume + * @since 3.0.0 + * + * @return {Phaser.Physics.Matter.World} The Matter World object. + */ + resume: function () + { + return this.world.resume(); + }, + + /** + * Sets the Matter Engine to run at fixed timestep of 60Hz and enables `autoUpdate`. + * If you have set a custom `getDelta` function then this will override it. + * + * @method Phaser.Physics.Matter.MatterPhysics#set60Hz + * @since 3.4.0 + * + * @return {this} This Matter Physics instance. + */ + set60Hz: function () + { + this.world.getDelta = this.world.update60Hz; + this.world.autoUpdate = true; + + return this; + }, + + /** + * Sets the Matter Engine to run at fixed timestep of 30Hz and enables `autoUpdate`. + * If you have set a custom `getDelta` function then this will override it. + * + * @method Phaser.Physics.Matter.MatterPhysics#set30Hz + * @since 3.4.0 + * + * @return {this} This Matter Physics instance. + */ + set30Hz: function () + { + this.world.getDelta = this.world.update30Hz; + this.world.autoUpdate = true; + + return this; + }, + + /** + * Manually advances the physics simulation by one iteration. + * + * You can optionally pass in the `delta` and `correction` values to be used by Engine.update. + * If undefined they use the Matter defaults of 60Hz and no correction. + * + * Calling `step` directly bypasses any checks of `enabled` or `autoUpdate`. + * + * It also ignores any custom `getDelta` functions, as you should be passing the delta + * value in to this call. + * + * You can adjust the number of iterations that Engine.update performs internally. + * Use the Scene Matter Physics config object to set the following properties: + * + * positionIterations (defaults to 6) + * velocityIterations (defaults to 4) + * constraintIterations (defaults to 2) + * + * Adjusting these values can help performance in certain situations, depending on the physics requirements + * of your game. + * + * @method Phaser.Physics.Matter.MatterPhysics#step + * @since 3.4.0 + * + * @param {number} [delta=16.666] - The delta value. + * @param {number} [correction=1] - Optional delta correction value. + */ + step: function (delta, correction) + { + this.world.step(delta, correction); + }, + + /** + * Checks if the vertices of the given body, or an array of bodies, contains the given point, or not. + * + * You can pass in either a single body, or an array of bodies to be checked. This method will + * return `true` if _any_ of the bodies in the array contain the point. See the `intersectPoint` method if you need + * to get a list of intersecting bodies. + * + * The point should be transformed into the Matter World coordinate system in advance. This happens by + * default with Input Pointers, but if you wish to use points from another system you may need to + * transform them before passing them. + * + * @method Phaser.Physics.Matter.MatterPhysics#containsPoint + * @since 3.22.0 + * + * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} body - The body, or an array of bodies, to check against the point. + * @param {number} x - The horizontal coordinate of the point. + * @param {number} y - The vertical coordinate of the point. + * + * @return {boolean} `true` if the point is within one of the bodies given, otherwise `false`. + */ + containsPoint: function (body, x, y) + { + body = this.getMatterBodies(body); + + var position = Vector.create(x, y); + + var result = Query.point(body, position); + + return (result.length > 0) ? true : false; + }, + + /** + * Checks the given coordinates to see if any vertices of the given bodies contain it. + * + * If no bodies are provided it will search all bodies in the Matter World, including within Composites. + * + * The coordinates should be transformed into the Matter World coordinate system in advance. This happens by + * default with Input Pointers, but if you wish to use coordinates from another system you may need to + * transform them before passing them. + * + * @method Phaser.Physics.Matter.MatterPhysics#intersectPoint + * @since 3.22.0 + * + * @param {number} x - The horizontal coordinate of the point. + * @param {number} y - The vertical coordinate of the point. + * @param {Phaser.Types.Physics.Matter.MatterBody[]} [bodies] - An array of bodies to check. If not provided it will search all bodies in the world. + * + * @return {Phaser.Types.Physics.Matter.MatterBody[]} An array of bodies which contain the given point. + */ + intersectPoint: function (x, y, bodies) + { + bodies = this.getMatterBodies(bodies); + + var position = Vector.create(x, y); + + var output = []; + + var result = Query.point(bodies, position); + + result.forEach(function (body) + { + if (output.indexOf(body) === -1) + { + output.push(body); + } + }); + + return output; + }, + + /** + * Checks the given rectangular area to see if any vertices of the given bodies intersect with it. + * Or, if the `outside` parameter is set to `true`, it checks to see which bodies do not + * intersect with it. + * + * If no bodies are provided it will search all bodies in the Matter World, including within Composites. + * + * @method Phaser.Physics.Matter.MatterPhysics#intersectRect + * @since 3.22.0 + * + * @param {number} x - The horizontal coordinate of the top-left of the area. + * @param {number} y - The vertical coordinate of the top-left of the area. + * @param {number} width - The width of the area. + * @param {number} height - The height of the area. + * @param {boolean} [outside=false] - If `false` it checks for vertices inside the area, if `true` it checks for vertices outside the area. + * @param {Phaser.Types.Physics.Matter.MatterBody[]} [bodies] - An array of bodies to check. If not provided it will search all bodies in the world. + * + * @return {Phaser.Types.Physics.Matter.MatterBody[]} An array of bodies that intersect with the given area. + */ + intersectRect: function (x, y, width, height, outside, bodies) + { + if (outside === undefined) { outside = false; } + + bodies = this.getMatterBodies(bodies); + + var bounds = { + min: { x: x, y: y }, + max: { x: x + width, y: y + height } + }; + + var output = []; + + var result = Query.region(bodies, bounds, outside); + + result.forEach(function (body) + { + if (output.indexOf(body) === -1) + { + output.push(body); + } + }); + + return output; + }, + + /** + * Checks the given ray segment to see if any vertices of the given bodies intersect with it. + * + * If no bodies are provided it will search all bodies in the Matter World. + * + * The width of the ray can be specified via the `rayWidth` parameter. + * + * @method Phaser.Physics.Matter.MatterPhysics#intersectRay + * @since 3.22.0 + * + * @param {number} x1 - The horizontal coordinate of the start of the ray segment. + * @param {number} y1 - The vertical coordinate of the start of the ray segment. + * @param {number} x2 - The horizontal coordinate of the end of the ray segment. + * @param {number} y2 - The vertical coordinate of the end of the ray segment. + * @param {number} [rayWidth=1] - The width of the ray segment. + * @param {Phaser.Types.Physics.Matter.MatterBody[]} [bodies] - An array of bodies to check. If not provided it will search all bodies in the world. + * + * @return {Phaser.Types.Physics.Matter.MatterBody[]} An array of bodies whos vertices intersect with the ray segment. + */ + intersectRay: function (x1, y1, x2, y2, rayWidth, bodies) + { + if (rayWidth === undefined) { rayWidth = 1; } + + bodies = this.getMatterBodies(bodies); + + var result = []; + var collisions = Query.ray(bodies, Vector.create(x1, y1), Vector.create(x2, y2), rayWidth); + + for (var i = 0; i < collisions.length; i++) + { + result.push(collisions[i].body); + } + + return result; + }, + + /** + * Checks the given Matter Body to see if it intersects with any of the given bodies. + * + * If no bodies are provided it will check against all bodies in the Matter World. + * + * @method Phaser.Physics.Matter.MatterPhysics#intersectBody + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody} body - The target body. + * @param {Phaser.Types.Physics.Matter.MatterBody[]} [bodies] - An array of bodies to check the target body against. If not provided it will search all bodies in the world. + * + * @return {Phaser.Types.Physics.Matter.MatterBody[]} An array of bodies whos vertices intersect with target body. + */ + intersectBody: function (body, bodies) + { + bodies = this.getMatterBodies(bodies); + + var result = []; + var collisions = Query.collides(body, bodies); + + for (var i = 0; i < collisions.length; i++) + { + var pair = collisions[i]; + + if (pair.bodyA === body) + { + result.push(pair.bodyB); + } + else + { + result.push(pair.bodyA); + } + } + + return result; + }, + + /** + * Checks to see if the target body, or an array of target bodies, intersects with any of the given bodies. + * + * If intersection occurs this method will return `true` and, if provided, invoke the callbacks. + * + * If no bodies are provided for the second parameter the target will check again all bodies in the Matter World. + * + * Note that bodies can only overlap if they are in non-colliding collision groups or categories. + * + * If you provide a `processCallback` then the two bodies that overlap are sent to it. This callback + * must return a boolean and is used to allow you to perform additional processing tests before a final + * outcome is decided. If it returns `true` then the bodies are finally passed to the `overlapCallback`, if set. + * + * If you provide an `overlapCallback` then the matching pairs of overlapping bodies will be sent to it. + * + * Both callbacks have the following signature: `function (bodyA, bodyB, collisionInfo)` where `bodyA` is always + * the target body. The `collisionInfo` object contains additional data, such as the angle and depth of penetration. + * + * @method Phaser.Physics.Matter.MatterPhysics#overlap + * @since 3.22.0 + * + * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} target - The target body, or array of target bodies, to check. + * @param {Phaser.Types.Physics.Matter.MatterBody[]} [bodies] - The second body, or array of bodies, to check. If falsey it will check against all bodies in the world. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [overlapCallback] - An optional callback function that is called if the bodies overlap. + * @param {Phaser.Types.Physics.Arcade.ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two bodies if they overlap. If this is set then `overlapCallback` will only be invoked if this callback returns `true`. + * @param {*} [callbackContext] - The context, or scope, in which to run the callbacks. + * + * @return {boolean} `true` if the target body intersects with _any_ of the bodies given, otherwise `false`. + */ + overlap: function (target, bodies, overlapCallback, processCallback, callbackContext) + { + if (overlapCallback === undefined) { overlapCallback = null; } + if (processCallback === undefined) { processCallback = null; } + if (callbackContext === undefined) { callbackContext = overlapCallback; } + + if (!Array.isArray(target)) + { + target = [ target ]; + } + + target = this.getMatterBodies(target); + bodies = this.getMatterBodies(bodies); + + var match = false; + + for (var i = 0; i < target.length; i++) + { + var entry = target[i]; + + var collisions = Query.collides(entry, bodies); + + for (var c = 0; c < collisions.length; c++) + { + var info = collisions[c]; + var bodyB = (info.bodyA.id === entry.id) ? info.bodyB : info.bodyA; + + if (!processCallback || processCallback.call(callbackContext, entry, bodyB, info)) + { + match = true; + + if (overlapCallback) + { + overlapCallback.call(callbackContext, entry, bodyB, info); + } + else if (!processCallback) + { + // If there are no callbacks we don't need to test every body, just exit when the first is found + return true; + } + } + } + } + + return match; + }, + + /** + * Sets the collision filter category of all given Matter Bodies to the given value. + * + * This number must be a power of two between 2^0 (= 1) and 2^31. + * + * Bodies with different collision groups (see {@link #setCollisionGroup}) will only collide if their collision + * categories are included in their collision masks (see {@link #setCollidesWith}). + * + * @method Phaser.Physics.Matter.MatterPhysics#setCollisionCategory + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody[]} bodies - An array of bodies to update. If falsey it will use all bodies in the world. + * @param {number} value - Unique category bitfield. + * + * @return {this} This Matter Physics instance. + */ + setCollisionCategory: function (bodies, value) + { + bodies = this.getMatterBodies(bodies); + + bodies.forEach(function (body) + { + body.collisionFilter.category = value; + }); + + return this; + }, + + /** + * Sets the collision filter group of all given Matter Bodies to the given value. + * + * If the group value is zero, or if two Matter Bodies have different group values, + * they will collide according to the usual collision filter rules (see {@link #setCollisionCategory} and {@link #setCollisionGroup}). + * + * If two Matter Bodies have the same positive group value, they will always collide; + * if they have the same negative group value they will never collide. + * + * @method Phaser.Physics.Matter.MatterPhysics#setCollisionGroup + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody[]} bodies - An array of bodies to update. If falsey it will use all bodies in the world. + * @param {number} value - Unique group index. + * + * @return {this} This Matter Physics instance. + */ + setCollisionGroup: function (bodies, value) + { + bodies = this.getMatterBodies(bodies); + + bodies.forEach(function (body) + { + body.collisionFilter.group = value; + }); + + return this; + }, + + /** + * Sets the collision filter mask of all given Matter Bodies to the given value. + * + * Two Matter Bodies with different collision groups will only collide if each one includes the others + * category in its mask based on a bitwise AND operation: `(categoryA & maskB) !== 0` and + * `(categoryB & maskA) !== 0` are both true. + * + * @method Phaser.Physics.Matter.MatterPhysics#setCollidesWith + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody[]} bodies - An array of bodies to update. If falsey it will use all bodies in the world. + * @param {(number|number[])} categories - A unique category bitfield, or an array of them. + * + * @return {this} This Matter Physics instance. + */ + setCollidesWith: function (bodies, categories) + { + bodies = this.getMatterBodies(bodies); + + var flags = 0; + + if (!Array.isArray(categories)) + { + flags = categories; + } + else + { + for (var i = 0; i < categories.length; i++) + { + flags |= categories[i]; + } + } + + bodies.forEach(function (body) + { + body.collisionFilter.mask = flags; + }); + + return this; + }, + + /** + * Takes an array and returns a new array made from all of the Matter Bodies found in the original array. + * + * For example, passing in Matter Game Objects, such as a bunch of Matter Sprites, to this method, would + * return an array containing all of their native Matter Body objects. + * + * If the `bodies` argument is falsey, it will return all bodies in the world. + * + * @method Phaser.Physics.Matter.MatterPhysics#getMatterBodies + * @since 3.22.0 + * + * @param {array} [bodies] - An array of objects to extract the bodies from. If falsey, it will return all bodies in the world. + * + * @return {MatterJS.BodyType[]} An array of native Matter Body objects. + */ + getMatterBodies: function (bodies) + { + if (!bodies) + { + return this.world.getAllBodies(); + } + + if (!Array.isArray(bodies)) + { + bodies = [ bodies ]; + } + + var output = []; + + for (var i = 0; i < bodies.length; i++) + { + var body = (bodies[i].hasOwnProperty('body')) ? bodies[i].body : bodies[i]; + + output.push(body); + } + + return output; + }, + + /** + * Sets both the horizontal and vertical linear velocity of the physics bodies. + * + * @method Phaser.Physics.Matter.MatterPhysics#setVelocity + * @since 3.22.0 + * + * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. + * @param {number} x - The horizontal linear velocity value. + * @param {number} y - The vertical linear velocity value. + * + * @return {this} This Matter Physics instance. + */ + setVelocity: function (bodies, x, y) + { + bodies = this.getMatterBodies(bodies); + + var vec2 = this._tempVec2; + + vec2.x = x; + vec2.y = y; + + bodies.forEach(function (body) + { + Body.setVelocity(body, vec2); + }); + + return this; + }, + + /** + * Sets just the horizontal linear velocity of the physics bodies. + * The vertical velocity of the body is unchanged. + * + * @method Phaser.Physics.Matter.MatterPhysics#setVelocityX + * @since 3.22.0 + * + * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. + * @param {number} x - The horizontal linear velocity value. + * + * @return {this} This Matter Physics instance. + */ + setVelocityX: function (bodies, x) + { + bodies = this.getMatterBodies(bodies); + + var vec2 = this._tempVec2; + + vec2.x = x; + + bodies.forEach(function (body) + { + vec2.y = body.velocity.y; + Body.setVelocity(body, vec2); + }); + + return this; + }, + + /** + * Sets just the vertical linear velocity of the physics bodies. + * The horizontal velocity of the body is unchanged. + * + * @method Phaser.Physics.Matter.MatterPhysics#setVelocityY + * @since 3.22.0 + * + * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. + * @param {number} y - The vertical linear velocity value. + * + * @return {this} This Matter Physics instance. + */ + setVelocityY: function (bodies, y) + { + bodies = this.getMatterBodies(bodies); + + var vec2 = this._tempVec2; + + vec2.y = y; + + bodies.forEach(function (body) + { + vec2.x = body.velocity.x; + Body.setVelocity(body, vec2); + }); + + return this; + }, + + /** + * Sets the angular velocity of the bodies instantly. + * Position, angle, force etc. are unchanged. + * + * @method Phaser.Physics.Matter.MatterPhysics#setAngularVelocity + * @since 3.22.0 + * + * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. + * @param {number} value - The angular velocity. + * + * @return {this} This Matter Physics instance. + */ + setAngularVelocity: function (bodies, value) + { + bodies = this.getMatterBodies(bodies); + + bodies.forEach(function (body) + { + Body.setAngularVelocity(body, value); + }); + + return this; + }, + + /** + * Applies a force to a body, at the bodies current position, including resulting torque. + * + * @method Phaser.Physics.Matter.MatterPhysics#applyForce + * @since 3.22.0 + * + * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. + * @param {Phaser.Types.Math.Vector2Like} force - A Vector that specifies the force to apply. + * + * @return {this} This Matter Physics instance. + */ + applyForce: function (bodies, force) + { + bodies = this.getMatterBodies(bodies); + + var vec2 = this._tempVec2; + + bodies.forEach(function (body) + { + vec2.x = body.position.x; + vec2.y = body.position.y; + + Body.applyForce(body, vec2, force); + }); + + return this; + }, + + /** + * Applies a force to a body, from the given world position, including resulting torque. + * If no angle is given, the current body angle is used. + * + * Use very small speed values, such as 0.1, depending on the mass and required velocity. + * + * @method Phaser.Physics.Matter.MatterPhysics#applyForceFromPosition + * @since 3.22.0 + * + * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. + * @param {Phaser.Types.Math.Vector2Like} position - A Vector that specifies the world-space position to apply the force at. + * @param {number} speed - A speed value to be applied to a directional force. + * @param {number} [angle] - The angle, in radians, to apply the force from. Leave undefined to use the current body angle. + * + * @return {this} This Matter Physics instance. + */ + applyForceFromPosition: function (bodies, position, speed, angle) + { + bodies = this.getMatterBodies(bodies); + + var vec2 = this._tempVec2; + + bodies.forEach(function (body) + { + if (angle === undefined) + { + angle = body.angle; + } + + vec2.x = speed * Math.cos(angle); + vec2.y = speed * Math.sin(angle); + + Body.applyForce(body, position, vec2); + }); + + return this; + }, + + /** + * Apply a force to a body based on the given angle and speed. + * If no angle is given, the current body angle is used. + * + * Use very small speed values, such as 0.1, depending on the mass and required velocity. + * + * @method Phaser.Physics.Matter.MatterPhysics#applyForceFromAngle + * @since 3.22.0 + * + * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. + * @param {number} speed - A speed value to be applied to a directional force. + * @param {number} [angle] - The angle, in radians, to apply the force from. Leave undefined to use the current body angle. + * + * @return {this} This Matter Physics instance. + */ + applyForceFromAngle: function (bodies, speed, angle) + { + bodies = this.getMatterBodies(bodies); + + var vec2 = this._tempVec2; + + bodies.forEach(function (body) + { + if (angle === undefined) + { + angle = body.angle; + } + + vec2.x = speed * Math.cos(angle); + vec2.y = speed * Math.sin(angle); + + Body.applyForce(body, { x: body.position.x, y: body.position.y }, vec2); + }); + + return this; + }, + + /** + * Returns the length of the given constraint, which is the distance between the two points. + * + * @method Phaser.Physics.Matter.MatterPhysics#getConstraintLength + * @since 3.22.0 + * + * @param {MatterJS.ConstraintType} constraint - The constraint to get the length from. + * + * @return {number} The length of the constraint. + */ + getConstraintLength: function (constraint) + { + var aX = constraint.pointA.x; + var aY = constraint.pointA.y; + var bX = constraint.pointB.x; + var bY = constraint.pointB.y; + + if (constraint.bodyA) + { + aX += constraint.bodyA.position.x; + aY += constraint.bodyA.position.y; + } + + if (constraint.bodyB) + { + bX += constraint.bodyB.position.x; + bY += constraint.bodyB.position.y; + } + + return DistanceBetween(aX, aY, bX, bY); + }, + + /** + * Aligns a Body, or Matter Game Object, against the given coordinates. + * + * The alignment takes place using the body bounds, which take into consideration things + * like body scale and rotation. + * + * Although a Body has a `position` property, it is based on the center of mass for the body, + * not a dimension based center. This makes aligning bodies difficult, especially if they have + * rotated or scaled. This method will derive the correct position based on the body bounds and + * its center of mass offset, in order to align the body with the given coordinate. + * + * For example, if you wanted to align a body so it sat in the bottom-center of the + * Scene, and the world was 800 x 600 in size: + * + * ```javascript + * this.matter.alignBody(body, 400, 600, Phaser.Display.Align.BOTTOM_CENTER); + * ``` + * + * You pass in 400 for the x coordinate, because that is the center of the world, and 600 for + * the y coordinate, as that is the base of the world. + * + * @method Phaser.Physics.Matter.MatterPhysics#alignBody + * @since 3.22.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to align. + * @param {number} x - The horizontal position to align the body to. + * @param {number} y - The vertical position to align the body to. + * @param {number} align - One of the `Phaser.Display.Align` constants, such as `Phaser.Display.Align.TOP_LEFT`. + * + * @return {this} This Matter Physics instance. + */ + alignBody: function (body, x, y, align) + { + body = (body.hasOwnProperty('body')) ? body.body : body; + + var pos; + + switch (align) + { + case ALIGN_CONST.TOP_LEFT: + case ALIGN_CONST.LEFT_TOP: + pos = this.bodyBounds.getTopLeft(body, x, y); + break; + + case ALIGN_CONST.TOP_CENTER: + pos = this.bodyBounds.getTopCenter(body, x, y); + break; + + case ALIGN_CONST.TOP_RIGHT: + case ALIGN_CONST.RIGHT_TOP: + pos = this.bodyBounds.getTopRight(body, x, y); + break; + + case ALIGN_CONST.LEFT_CENTER: + pos = this.bodyBounds.getLeftCenter(body, x, y); + break; + + case ALIGN_CONST.CENTER: + pos = this.bodyBounds.getCenter(body, x, y); + break; + + case ALIGN_CONST.RIGHT_CENTER: + pos = this.bodyBounds.getRightCenter(body, x, y); + break; + + case ALIGN_CONST.LEFT_BOTTOM: + case ALIGN_CONST.BOTTOM_LEFT: + pos = this.bodyBounds.getBottomLeft(body, x, y); + break; + + case ALIGN_CONST.BOTTOM_CENTER: + pos = this.bodyBounds.getBottomCenter(body, x, y); + break; + + case ALIGN_CONST.BOTTOM_RIGHT: + case ALIGN_CONST.RIGHT_BOTTOM: + pos = this.bodyBounds.getBottomRight(body, x, y); + break; + } + + if (pos) + { + Body.setPosition(body, pos); + } + + return this; + }, + + /** + * The Scene that owns this plugin is shutting down. + * We need to kill and reset all internal properties as well as stop listening to Scene events. + * + * @method Phaser.Physics.Matter.MatterPhysics#shutdown + * @private + * @since 3.0.0 + */ + shutdown: function () + { + var eventEmitter = this.systems.events; + + if (this.world) + { + eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); + eventEmitter.off(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); + } + + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); + + if (this.add) + { + this.add.destroy(); + } + + if (this.world) + { + this.world.destroy(); + } + + this.add = null; + this.world = null; + }, + + /** + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. + * + * @method Phaser.Physics.Matter.MatterPhysics#destroy + * @private + * @since 3.0.0 + */ + destroy: function () + { + this.shutdown(); + + this.scene.sys.events.off(SceneEvents.START, this.start, this); + + this.scene = null; + this.systems = null; + } + +}); + +PluginCache.register('MatterPhysics', MatterPhysics, 'matterPhysics'); + +module.exports = MatterPhysics; + + +/***/ }), + +/***/ 73658: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var AnimationState = __webpack_require__(16569); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(74527); +var GameObject = __webpack_require__(89980); +var GetFastValue = __webpack_require__(72632); +var Pipeline = __webpack_require__(58210); +var Sprite = __webpack_require__(13747); +var Vector2 = __webpack_require__(93736); + +/** + * @classdesc + * A Matter Physics Sprite Game Object. + * + * A Sprite Game Object is used for the display of both static and animated images in your game. + * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled + * and animated. + * + * The main difference between a Sprite and an Image Game Object is that you cannot animate Images. + * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation + * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases. + * + * @class Sprite + * @extends Phaser.GameObjects.Sprite + * @memberof Phaser.Physics.Matter + * @constructor + * @since 3.0.0 + * + * @extends Phaser.Physics.Matter.Components.Bounce + * @extends Phaser.Physics.Matter.Components.Collision + * @extends Phaser.Physics.Matter.Components.Force + * @extends Phaser.Physics.Matter.Components.Friction + * @extends Phaser.Physics.Matter.Components.Gravity + * @extends Phaser.Physics.Matter.Components.Mass + * @extends Phaser.Physics.Matter.Components.Sensor + * @extends Phaser.Physics.Matter.Components.SetBody + * @extends Phaser.Physics.Matter.Components.Sleep + * @extends Phaser.Physics.Matter.Components.Static + * @extends Phaser.Physics.Matter.Components.Transform + * @extends Phaser.Physics.Matter.Components.Velocity + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Size + * @extends Phaser.GameObjects.Components.Texture + * @extends Phaser.GameObjects.Components.Tint + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Physics.Matter.World} world - A reference to the Matter.World instance that this body belongs to. + * @param {number} x - The horizontal position of this Game Object in the world. + * @param {number} y - The vertical position of this Game Object in the world. + * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + */ +var MatterSprite = new Class({ + + Extends: Sprite, + + Mixins: [ + Components.Bounce, + Components.Collision, + Components.Force, + Components.Friction, + Components.Gravity, + Components.Mass, + Components.Sensor, + Components.SetBody, + Components.Sleep, + Components.Static, + Components.Transform, + Components.Velocity, + Pipeline + ], + + initialize: + + function MatterSprite (world, x, y, texture, frame, options) + { + GameObject.call(this, world.scene, 'Sprite'); + + /** + * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. + * + * @name Phaser.Physics.Matter.Sprite#_crop + * @type {object} + * @private + * @since 3.24.0 + */ + this._crop = this.resetCropObject(); + + this.anims = new AnimationState(this); + + this.setTexture(texture, frame); + this.setSizeToFrame(); + this.setOrigin(); + + /** + * A reference to the Matter.World instance that this body belongs to. + * + * @name Phaser.Physics.Matter.Sprite#world + * @type {Phaser.Physics.Matter.World} + * @since 3.0.0 + */ + this.world = world; + + /** + * An internal temp vector used for velocity and force calculations. + * + * @name Phaser.Physics.Matter.Sprite#_tempVec2 + * @type {Phaser.Math.Vector2} + * @private + * @since 3.0.0 + */ + this._tempVec2 = new Vector2(x, y); + + var shape = GetFastValue(options, 'shape', null); + + if (shape) + { + this.setBody(shape, options); + } + else + { + this.setRectangle(this.width, this.height, options); + } + + this.setPosition(x, y); + + this.initPipeline(); + this.initPostPipeline(true); + } + +}); + +module.exports = MatterSprite; + + +/***/ }), + +/***/ 84720: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Bodies = __webpack_require__(68516); +var Body = __webpack_require__(84125); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(74527); +var DeepCopy = __webpack_require__(28699); +var EventEmitter = __webpack_require__(6659); +var GetFastValue = __webpack_require__(72632); +var HasValue = __webpack_require__(19256); +var Vertices = __webpack_require__(39745); + +/** + * @classdesc + * A wrapper around a Tile that provides access to a corresponding Matter body. A tile can only + * have one Matter body associated with it. You can either pass in an existing Matter body for + * the tile or allow the constructor to create the corresponding body for you. If the Tile has a + * collision group (defined in Tiled), those shapes will be used to create the body. If not, the + * tile's rectangle bounding box will be used. + * + * The corresponding body will be accessible on the Tile itself via Tile.physics.matterBody. + * + * Note: not all Tiled collision shapes are supported. See + * Phaser.Physics.Matter.TileBody#setFromTileCollision for more information. + * + * @class TileBody + * @memberof Phaser.Physics.Matter + * @extends Phaser.Events.EventEmitter + * @constructor + * @since 3.0.0 + * + * @extends Phaser.Physics.Matter.Components.Bounce + * @extends Phaser.Physics.Matter.Components.Collision + * @extends Phaser.Physics.Matter.Components.Friction + * @extends Phaser.Physics.Matter.Components.Gravity + * @extends Phaser.Physics.Matter.Components.Mass + * @extends Phaser.Physics.Matter.Components.Sensor + * @extends Phaser.Physics.Matter.Components.Sleep + * @extends Phaser.Physics.Matter.Components.Static + * + * @param {Phaser.Physics.Matter.World} world - The Matter world instance this body belongs to. + * @param {Phaser.Tilemaps.Tile} tile - The target tile that should have a Matter body. + * @param {Phaser.Types.Physics.Matter.MatterTileOptions} [options] - Options to be used when creating the Matter body. + */ +var MatterTileBody = new Class({ + + Extends: EventEmitter, + + Mixins: [ + Components.Bounce, + Components.Collision, + Components.Friction, + Components.Gravity, + Components.Mass, + Components.Sensor, + Components.Sleep, + Components.Static + ], + + initialize: + + function MatterTileBody (world, tile, options) + { + EventEmitter.call(this); + + /** + * The tile object the body is associated with. + * + * @name Phaser.Physics.Matter.TileBody#tile + * @type {Phaser.Tilemaps.Tile} + * @since 3.0.0 + */ + this.tile = tile; + + /** + * The Matter world the body exists within. + * + * @name Phaser.Physics.Matter.TileBody#world + * @type {Phaser.Physics.Matter.World} + * @since 3.0.0 + */ + this.world = world; + + // Install a reference to 'this' on the tile and ensure there can only be one matter body + // associated with the tile + if (tile.physics.matterBody) + { + tile.physics.matterBody.destroy(); + } + + tile.physics.matterBody = this; + + // Set the body either from an existing body (if provided), the shapes in the tileset + // collision layer (if it exists) or a rectangle matching the tile. + var body = GetFastValue(options, 'body', null); + + var addToWorld = GetFastValue(options, 'addToWorld', true); + + if (!body) + { + var collisionGroup = tile.getCollisionGroup(); + var collisionObjects = GetFastValue(collisionGroup, 'objects', []); + + if (collisionObjects.length > 0) + { + this.setFromTileCollision(options); + } + else + { + this.setFromTileRectangle(options); + } + } + else + { + this.setBody(body, addToWorld); + } + + if (tile.flipX || tile.flipY) + { + var rotationPoint = { x: tile.getCenterX(), y: tile.getCenterY() }; + var scaleX = (tile.flipX) ? -1 : 1; + var scaleY = (tile.flipY) ? -1 : 1; + + Body.scale(body, scaleX, scaleY, rotationPoint); + } + }, + + /** + * Sets the current body to a rectangle that matches the bounds of the tile. + * + * @method Phaser.Physics.Matter.TileBody#setFromTileRectangle + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBodyTileOptions} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. + * + * @return {Phaser.Physics.Matter.TileBody} This TileBody object. + */ + setFromTileRectangle: function (options) + { + if (options === undefined) { options = {}; } + if (!HasValue(options, 'isStatic')) { options.isStatic = true; } + if (!HasValue(options, 'addToWorld')) { options.addToWorld = true; } + + var bounds = this.tile.getBounds(); + var cx = bounds.x + (bounds.width / 2); + var cy = bounds.y + (bounds.height / 2); + var body = Bodies.rectangle(cx, cy, bounds.width, bounds.height, options); + + this.setBody(body, options.addToWorld); + + return this; + }, + + /** + * Sets the current body from the collision group associated with the Tile. This is typically + * set up in Tiled's collision editor. + * + * Note: Matter doesn't support all shapes from Tiled. Rectangles and polygons are directly + * supported. Ellipses are converted into circle bodies. Polylines are treated as if they are + * closed polygons. If a tile has multiple shapes, a multi-part body will be created. Concave + * shapes are supported if poly-decomp library is included. Decomposition is not guaranteed to + * work for complex shapes (e.g. holes), so it's often best to manually decompose a concave + * polygon into multiple convex polygons yourself. + * + * @method Phaser.Physics.Matter.TileBody#setFromTileCollision + * @since 3.0.0 + * + * @param {Phaser.Types.Physics.Matter.MatterBodyTileOptions} [options] - Options to be used when creating the Matter body. See MatterJS.Body for a list of what Matter accepts. + * + * @return {Phaser.Physics.Matter.TileBody} This TileBody object. + */ + setFromTileCollision: function (options) + { + if (options === undefined) { options = {}; } + if (!HasValue(options, 'isStatic')) { options.isStatic = true; } + if (!HasValue(options, 'addToWorld')) { options.addToWorld = true; } + + var sx = this.tile.tilemapLayer.scaleX; + var sy = this.tile.tilemapLayer.scaleY; + var tileX = this.tile.getLeft(); + var tileY = this.tile.getTop(); + var collisionGroup = this.tile.getCollisionGroup(); + var collisionObjects = GetFastValue(collisionGroup, 'objects', []); + + var parts = []; + + for (var i = 0; i < collisionObjects.length; i++) + { + var object = collisionObjects[i]; + var ox = tileX + (object.x * sx); + var oy = tileY + (object.y * sy); + var ow = object.width * sx; + var oh = object.height * sy; + var body = null; + + if (object.rectangle) + { + body = Bodies.rectangle(ox + ow / 2, oy + oh / 2, ow, oh, options); + } + else if (object.ellipse) + { + body = Bodies.circle(ox + ow / 2, oy + oh / 2, ow / 2, options); + } + else if (object.polygon || object.polyline) + { + // Polygons and polylines are both treated as closed polygons + var originalPoints = object.polygon ? object.polygon : object.polyline; + + var points = originalPoints.map(function (p) + { + return { x: p.x * sx, y: p.y * sy }; + }); + + var vertices = Vertices.create(points); + + // Points are relative to the object's origin (first point placed in Tiled), but + // matter expects points to be relative to the center of mass. This only applies to + // convex shapes. When a concave shape is decomposed, multiple parts are created and + // the individual parts are positioned relative to (ox, oy). + // + // Update: 8th January 2019 - the latest version of Matter needs the Vertices adjusted, + // regardless if convex or concave. + + var center = Vertices.centre(vertices); + + ox += center.x; + oy += center.y; + + body = Bodies.fromVertices(ox, oy, vertices, options); + } + + if (body) + { + parts.push(body); + } + } + + if (parts.length === 1) + { + this.setBody(parts[0], options.addToWorld); + } + else if (parts.length > 1) + { + var tempOptions = DeepCopy(options); + + tempOptions.parts = parts; + + this.setBody(Body.create(tempOptions), tempOptions.addToWorld); + } + + return this; + }, + + /** + * Sets the current body to the given body. This will remove the previous body, if one already + * exists. + * + * @method Phaser.Physics.Matter.TileBody#setBody + * @since 3.0.0 + * + * @param {MatterJS.BodyType} body - The new Matter body to use. + * @param {boolean} [addToWorld=true] - Whether or not to add the body to the Matter world. + * + * @return {Phaser.Physics.Matter.TileBody} This TileBody object. + */ + setBody: function (body, addToWorld) + { + if (addToWorld === undefined) { addToWorld = true; } + + if (this.body) + { + this.removeBody(); + } + + this.body = body; + this.body.gameObject = this; + + if (addToWorld) + { + this.world.add(this.body); + } + + return this; + }, + + /** + * Removes the current body from the TileBody and from the Matter world + * + * @method Phaser.Physics.Matter.TileBody#removeBody + * @since 3.0.0 + * + * @return {Phaser.Physics.Matter.TileBody} This TileBody object. + */ + removeBody: function () + { + if (this.body) + { + this.world.remove(this.body); + this.body.gameObject = undefined; + this.body = undefined; + } + + return this; + }, + + /** + * Removes the current body from the tile and the world. + * + * @method Phaser.Physics.Matter.TileBody#destroy + * @since 3.0.0 + * + * @return {Phaser.Physics.Matter.TileBody} This TileBody object. + */ + destroy: function () + { + this.removeBody(); + this.tile.physics.matterBody = undefined; + this.removeAllListeners(); + } + +}); + +module.exports = MatterTileBody; + + +/***/ }), + +/***/ 10998: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Joachim Grill + * @author Richard Davey + * @copyright 2018 CodeAndWeb GmbH + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Bodies = __webpack_require__(68516); +var Body = __webpack_require__(84125); +var Common = __webpack_require__(68758); +var GetFastValue = __webpack_require__(72632); +var Vertices = __webpack_require__(39745); + +/** + * Use PhysicsEditorParser.parseBody() to build a Matter body object, based on a physics data file + * created and exported with PhysicsEditor (https://www.codeandweb.com/physicseditor). + * + * @namespace Phaser.Physics.Matter.PhysicsEditorParser + * @since 3.10.0 + */ +var PhysicsEditorParser = { + + /** + * Parses a body element exported by PhysicsEditor. + * + * @function Phaser.Physics.Matter.PhysicsEditorParser.parseBody + * @since 3.10.0 + * + * @param {number} x - The horizontal world location of the body. + * @param {number} y - The vertical world location of the body. + * @param {object} config - The body configuration and fixture (child body) definitions, as exported by PhysicsEditor. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {MatterJS.BodyType} A compound Matter JS Body. + */ + parseBody: function (x, y, config, options) + { + if (options === undefined) { options = {}; } + + var fixtureConfigs = GetFastValue(config, 'fixtures', []); + var fixtures = []; + + for (var fc = 0; fc < fixtureConfigs.length; fc++) + { + var fixtureParts = this.parseFixture(fixtureConfigs[fc]); + + for (var i = 0; i < fixtureParts.length; i++) + { + fixtures.push(fixtureParts[i]); + } + } + + var matterConfig = Common.clone(config, true); + + Common.extend(matterConfig, options, true); + + delete matterConfig.fixtures; + delete matterConfig.type; + + var body = Body.create(matterConfig); + + Body.setParts(body, fixtures); + + Body.setPosition(body, { x: x, y: y }); + + return body; + }, + + /** + * Parses an element of the "fixtures" list exported by PhysicsEditor + * + * @function Phaser.Physics.Matter.PhysicsEditorParser.parseFixture + * @since 3.10.0 + * + * @param {object} fixtureConfig - The fixture object to parse. + * + * @return {MatterJS.BodyType[]} - An array of Matter JS Bodies. + */ + parseFixture: function (fixtureConfig) + { + var matterConfig = Common.extend({}, false, fixtureConfig); + + delete matterConfig.circle; + delete matterConfig.vertices; + + var fixtures; + + if (fixtureConfig.circle) + { + var x = GetFastValue(fixtureConfig.circle, 'x'); + var y = GetFastValue(fixtureConfig.circle, 'y'); + var r = GetFastValue(fixtureConfig.circle, 'radius'); + fixtures = [ Bodies.circle(x, y, r, matterConfig) ]; + } + else if (fixtureConfig.vertices) + { + fixtures = this.parseVertices(fixtureConfig.vertices, matterConfig); + } + + return fixtures; + }, + + /** + * Parses the "vertices" lists exported by PhysicsEditor. + * + * @function Phaser.Physics.Matter.PhysicsEditorParser.parseVertices + * @since 3.10.0 + * + * @param {array} vertexSets - The vertex lists to parse. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {MatterJS.BodyType[]} - An array of Matter JS Bodies. + */ + parseVertices: function (vertexSets, options) + { + if (options === undefined) { options = {}; } + + var parts = []; + + for (var v = 0; v < vertexSets.length; v++) + { + Vertices.clockwiseSort(vertexSets[v]); + + parts.push(Body.create(Common.extend({ + position: Vertices.centre(vertexSets[v]), + vertices: vertexSets[v] + }, options))); + } + + // flag coincident part edges + return Bodies.flagCoincidentParts(parts); + } +}; + +module.exports = PhysicsEditorParser; + + +/***/ }), + +/***/ 72829: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Bodies = __webpack_require__(68516); +var Body = __webpack_require__(84125); + +/** + * Creates a body using the supplied physics data, as provided by a JSON file. + * + * The data file should be loaded as JSON: + * + * ```javascript + * preload () + * { + * this.load.json('ninjas', 'assets/ninjas.json); + * } + * + * create () + * { + * const ninjaShapes = this.cache.json.get('ninjas'); + * + * this.matter.add.fromJSON(400, 300, ninjaShapes.shinobi); + * } + * ``` + * + * Do not pass the entire JSON file to this method, but instead pass one of the shapes contained within it. + * + * If you pas in an `options` object, any settings in there will override those in the config object. + * + * The structure of the JSON file is as follows: + * + * ```text + * { + * 'generator_info': // The name of the application that created the JSON data + * 'shapeName': { + * 'type': // The type of body + * 'label': // Optional body label + * 'vertices': // An array, or an array of arrays, containing the vertex data in x/y object pairs + * } + * } + * ``` + * + * At the time of writing, only the Phaser Physics Tracer App exports in this format. + * + * @namespace Phaser.Physics.Matter.PhysicsJSONParser + * @since 3.22.0 + */ +var PhysicsJSONParser = { + + /** + * Parses a body element from the given JSON data. + * + * @function Phaser.Physics.Matter.PhysicsJSONParser.parseBody + * @since 3.22.0 + * + * @param {number} x - The horizontal world location of the body. + * @param {number} y - The vertical world location of the body. + * @param {object} config - The body configuration data. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {MatterJS.BodyType} A Matter JS Body. + */ + parseBody: function (x, y, config, options) + { + if (options === undefined) { options = {}; } + + var body; + var vertexSets = config.vertices; + + if (vertexSets.length === 1) + { + // Just a single Body + options.vertices = vertexSets[0]; + + body = Body.create(options); + + Bodies.flagCoincidentParts(body.parts); + } + else + { + var parts = []; + + for (var i = 0; i < vertexSets.length; i++) + { + var part = Body.create({ + vertices: vertexSets[i] + }); + + parts.push(part); + } + + Bodies.flagCoincidentParts(parts); + + options.parts = parts; + + body = Body.create(options); + } + + body.label = config.label; + + Body.setPosition(body, { x: x, y: y }); + + return body; + } + +}; + +module.exports = PhysicsJSONParser; + + +/***/ }), + +/***/ 88596: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Bounds = __webpack_require__(84091); +var Class = __webpack_require__(56694); +var Composite = __webpack_require__(11299); +var Constraint = __webpack_require__(52838); +var Detector = __webpack_require__(13657); +var Events = __webpack_require__(35416); +var InputEvents = __webpack_require__(33963); +var Merge = __webpack_require__(30657); +var Sleeping = __webpack_require__(22806); +var Vector2 = __webpack_require__(93736); +var Vertices = __webpack_require__(39745); + +/** + * @classdesc + * A Pointer Constraint is a special type of constraint that allows you to click + * and drag bodies in a Matter World. It monitors the active Pointers in a Scene, + * and when one is pressed down it checks to see if that hit any part of any active + * body in the world. If it did, and the body has input enabled, it will begin to + * drag it until either released, or you stop it via the `stopDrag` method. + * + * You can adjust the stiffness, length and other properties of the constraint via + * the `options` object on creation. + * + * @class PointerConstraint + * @memberof Phaser.Physics.Matter + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - A reference to the Scene to which this Pointer Constraint belongs. + * @param {Phaser.Physics.Matter.World} world - A reference to the Matter World instance to which this Constraint belongs. + * @param {object} [options] - A Constraint configuration object. + */ +var PointerConstraint = new Class({ + + initialize: + + function PointerConstraint (scene, world, options) + { + if (options === undefined) { options = {}; } + + // Defaults + var defaults = { + label: 'Pointer Constraint', + pointA: { x: 0, y: 0 }, + pointB: { x: 0, y: 0 }, + length: 0.01, + stiffness: 0.1, + angularStiffness: 1, + collisionFilter: { + category: 0x0001, + mask: 0xFFFFFFFF, + group: 0 + } + }; + + /** + * A reference to the Scene to which this Pointer Constraint belongs. + * This is the same Scene as the Matter World instance. + * + * @name Phaser.Physics.Matter.PointerConstraint#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; + + /** + * A reference to the Matter World instance to which this Constraint belongs. + * + * @name Phaser.Physics.Matter.PointerConstraint#world + * @type {Phaser.Physics.Matter.World} + * @since 3.0.0 + */ + this.world = world; + + /** + * The Camera the Pointer was interacting with when the input + * down event was processed. + * + * @name Phaser.Physics.Matter.PointerConstraint#camera + * @type {Phaser.Cameras.Scene2D.Camera} + * @since 3.0.0 + */ + this.camera = null; + + /** + * A reference to the Input Pointer that activated this Constraint. + * This is set in the `onDown` handler. + * + * @name Phaser.Physics.Matter.PointerConstraint#pointer + * @type {Phaser.Input.Pointer} + * @default null + * @since 3.0.0 + */ + this.pointer = null; + + /** + * Is this Constraint active or not? + * + * An active constraint will be processed each update. An inactive one will be skipped. + * Use this to toggle a Pointer Constraint on and off. + * + * @name Phaser.Physics.Matter.PointerConstraint#active + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.active = true; + + /** + * The internal transformed position. + * + * @name Phaser.Physics.Matter.PointerConstraint#position + * @type {Phaser.Math.Vector2} + * @since 3.0.0 + */ + this.position = new Vector2(); + + /** + * The body that is currently being dragged, if any. + * + * @name Phaser.Physics.Matter.PointerConstraint#body + * @type {?MatterJS.BodyType} + * @since 3.16.2 + */ + this.body = null; + + /** + * The part of the body that was clicked on to start the drag. + * + * @name Phaser.Physics.Matter.PointerConstraint#part + * @type {?MatterJS.BodyType} + * @since 3.16.2 + */ + this.part = null; + + /** + * The native Matter Constraint that is used to attach to bodies. + * + * @name Phaser.Physics.Matter.PointerConstraint#constraint + * @type {MatterJS.ConstraintType} + * @since 3.0.0 + */ + this.constraint = Constraint.create(Merge(options, defaults)); + + this.world.on(Events.BEFORE_UPDATE, this.update, this); + + scene.sys.input.on(InputEvents.POINTER_DOWN, this.onDown, this); + scene.sys.input.on(InputEvents.POINTER_UP, this.onUp, this); + }, + + /** + * A Pointer has been pressed down onto the Scene. + * + * If this Constraint doesn't have an active Pointer then a hit test is set to + * run against all active bodies in the world during the _next_ call to `update`. + * If a body is found, it is bound to this constraint and the drag begins. + * + * @method Phaser.Physics.Matter.PointerConstraint#onDown + * @since 3.0.0 + * + * @param {Phaser.Input.Pointer} pointer - A reference to the Pointer that was pressed. + */ + onDown: function (pointer) + { + if (!this.pointer) + { + this.pointer = pointer; + this.camera = pointer.camera; + } + }, + + /** + * A Pointer has been released from the Scene. If it was the one this constraint was using, it's cleared. + * + * @method Phaser.Physics.Matter.PointerConstraint#onUp + * @since 3.22.0 + * + * @param {Phaser.Input.Pointer} pointer - A reference to the Pointer that was pressed. + */ + onUp: function (pointer) + { + if (pointer === this.pointer) + { + this.pointer = null; + } + }, + + /** + * Scans all active bodies in the current Matter World to see if any of them + * are hit by the Pointer. The _first one_ found to hit is set as the active contraint + * body. + * + * @method Phaser.Physics.Matter.PointerConstraint#getBody + * @fires Phaser.Physics.Matter.Events#DRAG_START + * @since 3.16.2 + * + * @return {boolean} `true` if a body was found and set, otherwise `false`. + */ + getBody: function (pointer) + { + var pos = this.position; + var constraint = this.constraint; + + this.camera.getWorldPoint(pointer.x, pointer.y, pos); + + var bodies = Composite.allBodies(this.world.localWorld); + + for (var i = 0; i < bodies.length; i++) + { + var body = bodies[i]; + + if (!body.ignorePointer && + Bounds.contains(body.bounds, pos) && + Detector.canCollide(body.collisionFilter, constraint.collisionFilter)) + { + if (this.hitTestBody(body, pos)) + { + this.world.emit(Events.DRAG_START, body, this.part, this); + + return true; + } + } + } + + return false; + }, + + /** + * Scans the current body to determine if a part of it was clicked on. + * If a part is found the body is set as the `constraint.bodyB` property, + * as well as the `body` property of this class. The part is also set. + * + * @method Phaser.Physics.Matter.PointerConstraint#hitTestBody + * @since 3.16.2 + * + * @param {MatterJS.BodyType} body - The Matter Body to check. + * @param {Phaser.Math.Vector2} position - A translated hit test position. + * + * @return {boolean} `true` if a part of the body was hit, otherwise `false`. + */ + hitTestBody: function (body, position) + { + var constraint = this.constraint; + var partsLength = body.parts.length; + + var start = (partsLength > 1) ? 1 : 0; + + for (var i = start; i < partsLength; i++) + { + var part = body.parts[i]; + + if (Vertices.contains(part.vertices, position)) + { + constraint.pointA = position; + constraint.pointB = { x: position.x - body.position.x, y: position.y - body.position.y }; + + constraint.bodyB = body; + constraint.angleB = body.angle; + + Sleeping.set(body, false); + + this.part = part; + this.body = body; + + return true; + } + } + + return false; + }, + + /** + * Internal update handler. Called in the Matter BEFORE_UPDATE step. + * + * @method Phaser.Physics.Matter.PointerConstraint#update + * @fires Phaser.Physics.Matter.Events#DRAG + * @since 3.0.0 + */ + update: function () + { + var pointer = this.pointer; + var body = this.body; + + if (!this.active || !pointer) + { + if (body) + { + this.stopDrag(); + } + + return; + } + + if (!pointer.isDown && body) + { + this.stopDrag(); + + return; + } + else if (pointer.isDown) + { + if (!body && !this.getBody(pointer)) + { + return; + } + + body = this.body; + + var pos = this.position; + var constraint = this.constraint; + + this.camera.getWorldPoint(pointer.x, pointer.y, pos); + + // Drag update + constraint.pointA.x = pos.x; + constraint.pointA.y = pos.y; + + Sleeping.set(body, false); + + this.world.emit(Events.DRAG, body, this); + } + }, + + /** + * Stops the Pointer Constraint from dragging the body any further. + * + * This is called automatically if the Pointer is released while actively + * dragging a body. Or, you can call it manually to release a body from a + * constraint without having to first release the pointer. + * + * @method Phaser.Physics.Matter.PointerConstraint#stopDrag + * @fires Phaser.Physics.Matter.Events#DRAG_END + * @since 3.16.2 + */ + stopDrag: function () + { + var body = this.body; + var constraint = this.constraint; + + constraint.bodyB = null; + constraint.pointB = null; + + this.pointer = null; + this.body = null; + this.part = null; + + if (body) + { + this.world.emit(Events.DRAG_END, body, this); + } + }, + + /** + * Destroys this Pointer Constraint instance and all of its references. + * + * @method Phaser.Physics.Matter.PointerConstraint#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.world.removeConstraint(this.constraint); + + this.pointer = null; + this.constraint = null; + this.body = null; + this.part = null; + + this.world.off(Events.BEFORE_UPDATE, this.update); + + this.scene.sys.input.off(InputEvents.POINTER_DOWN, this.onDown, this); + this.scene.sys.input.off(InputEvents.POINTER_UP, this.onUp, this); + } + +}); + +module.exports = PointerConstraint; + + +/***/ }), + +/***/ 31468: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Bodies = __webpack_require__(68516); +var Body = __webpack_require__(84125); +var Class = __webpack_require__(56694); +var Common = __webpack_require__(68758); +var Composite = __webpack_require__(11299); +var Engine = __webpack_require__(45775); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(35416); +var GetFastValue = __webpack_require__(72632); +var GetValue = __webpack_require__(10850); +var MatterBody = __webpack_require__(84125); +var MatterEvents = __webpack_require__(39073); +var MatterTileBody = __webpack_require__(84720); +var MatterWorld = __webpack_require__(72005); +var Vector = __webpack_require__(10438); + +/** + * @classdesc + * The Matter World class is responsible for managing one single instance of a Matter Physics World for Phaser. + * + * Access this via `this.matter.world` from within a Scene. + * + * This class creates a Matter JS World Composite along with the Matter JS Engine during instantiation. It also + * handles delta timing, bounds, body and constraint creation and debug drawing. + * + * If you wish to access the Matter JS World object directly, see the `localWorld` property. + * If you wish to access the Matter Engine directly, see the `engine` property. + * + * This class is an Event Emitter and will proxy _all_ Matter JS events, as they are received. + * + * @class World + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Physics.Matter + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to which this Matter World instance belongs. + * @param {Phaser.Types.Physics.Matter.MatterWorldConfig} config - The Matter World configuration object. + */ +var World = new Class({ + + Extends: EventEmitter, + + initialize: + + function World (scene, config) + { + EventEmitter.call(this); + + /** + * The Scene to which this Matter World instance belongs. + * + * @name Phaser.Physics.Matter.World#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; + + /** + * An instance of the MatterJS Engine. + * + * @name Phaser.Physics.Matter.World#engine + * @type {MatterJS.Engine} + * @since 3.0.0 + */ + this.engine = Engine.create(config); + + /** + * A `World` composite object that will contain all simulated bodies and constraints. + * + * @name Phaser.Physics.Matter.World#localWorld + * @type {MatterJS.World} + * @since 3.0.0 + */ + this.localWorld = this.engine.world; + + var gravity = GetValue(config, 'gravity', null); + + if (gravity) + { + this.setGravity(gravity.x, gravity.y, gravity.scale); + } + else if (gravity === false) + { + this.setGravity(0, 0, 0); + } + + /** + * An object containing the 4 wall bodies that bound the physics world. + * + * @name Phaser.Physics.Matter.World#walls + * @type {Phaser.Types.Physics.Matter.MatterWalls} + * @since 3.0.0 + */ + this.walls = { left: null, right: null, top: null, bottom: null }; + + /** + * A flag that toggles if the world is enabled or not. + * + * @name Phaser.Physics.Matter.World#enabled + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.enabled = GetValue(config, 'enabled', true); + + /** + * This function is called every time the core game loop steps, which is bound to the + * Request Animation Frame frequency unless otherwise modified. + * + * The function is passed two values: `time` and `delta`, both of which come from the game step values. + * + * It must return a number. This number is used as the delta value passed to Matter.Engine.update. + * + * You can override this function with your own to define your own timestep. + * + * If you need to update the Engine multiple times in a single game step then call + * `World.update` as many times as required. Each call will trigger the `getDelta` function. + * If you wish to have full control over when the Engine updates then see the property `autoUpdate`. + * + * You can also adjust the number of iterations that Engine.update performs. + * Use the Scene Matter Physics config object to set the following properties: + * + * positionIterations (defaults to 6) + * velocityIterations (defaults to 4) + * constraintIterations (defaults to 2) + * + * Adjusting these values can help performance in certain situations, depending on the physics requirements + * of your game. + * + * @name Phaser.Physics.Matter.World#getDelta + * @type {function} + * @since 3.4.0 + */ + this.getDelta = GetValue(config, 'getDelta', this.update60Hz); + + var runnerConfig = GetFastValue(config, 'runner', {}); + + var hasFPS = GetFastValue(runnerConfig, 'fps', false); + + var fps = GetFastValue(runnerConfig, 'fps', 60); + + var delta = GetFastValue(runnerConfig, 'delta', 1000 / fps); + var deltaMin = GetFastValue(runnerConfig, 'deltaMin', 1000 / fps); + var deltaMax = GetFastValue(runnerConfig, 'deltaMax', 1000 / (fps * 0.5)); + + if (!hasFPS) + { + fps = 1000 / delta; + } + + /** + * The Matter JS Runner Configuration object. + * + * This object is populated via the Matter Configuration object's `runner` property and is + * updated constantly during the game step. + * + * @name Phaser.Physics.Matter.World#runner + * @type {Phaser.Types.Physics.Matter.MatterRunnerConfig} + * @since 3.22.0 + */ + this.runner = { + fps: fps, + deltaSampleSize: GetFastValue(runnerConfig, 'deltaSampleSize', 60), + counterTimestamp: 0, + frameCounter: 0, + deltaHistory: [], + timePrev: null, + timeScalePrev: 1, + frameRequestId: null, + isFixed: GetFastValue(runnerConfig, 'isFixed', false), + delta: delta, + deltaMin: deltaMin, + deltaMax: deltaMax + }; + + /** + * Automatically call Engine.update every time the game steps. + * If you disable this then you are responsible for calling `World.step` directly from your game. + * If you call `set60Hz` or `set30Hz` then `autoUpdate` is reset to `true`. + * + * @name Phaser.Physics.Matter.World#autoUpdate + * @type {boolean} + * @default true + * @since 3.4.0 + */ + this.autoUpdate = GetValue(config, 'autoUpdate', true); + + var debugConfig = GetValue(config, 'debug', false); + + /** + * A flag that controls if the debug graphics will be drawn to or not. + * + * @name Phaser.Physics.Matter.World#drawDebug + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.drawDebug = (typeof(debugConfig) === 'object') ? true : debugConfig; + + /** + * An instance of the Graphics object the debug bodies are drawn to, if enabled. + * + * @name Phaser.Physics.Matter.World#debugGraphic + * @type {Phaser.GameObjects.Graphics} + * @since 3.0.0 + */ + this.debugGraphic; + + /** + * The debug configuration object. + * + * The values stored in this object are read from the Matter World Config `debug` property. + * + * When a new Body or Constraint is _added to the World_, they are given the values stored in this object, + * unless they have their own `render` object set that will override them. + * + * Note that while you can modify the values of properties in this object at run-time, it will not change + * any of the Matter objects _already added_. It will only impact objects newly added to the world, or one + * that is removed and then re-added at a later time. + * + * @name Phaser.Physics.Matter.World#debugConfig + * @type {Phaser.Types.Physics.Matter.MatterDebugConfig} + * @since 3.22.0 + */ + this.debugConfig = { + showAxes: GetFastValue(debugConfig, 'showAxes', false), + showAngleIndicator: GetFastValue(debugConfig, 'showAngleIndicator', false), + angleColor: GetFastValue(debugConfig, 'angleColor', 0xe81153), + + showBroadphase: GetFastValue(debugConfig, 'showBroadphase', false), + broadphaseColor: GetFastValue(debugConfig, 'broadphaseColor', 0xffb400), + + showBounds: GetFastValue(debugConfig, 'showBounds', false), + boundsColor: GetFastValue(debugConfig, 'boundsColor', 0xffffff), + + showVelocity: GetFastValue(debugConfig, 'showVelocity', false), + velocityColor: GetFastValue(debugConfig, 'velocityColor', 0x00aeef), + + showCollisions: GetFastValue(debugConfig, 'showCollisions', false), + collisionColor: GetFastValue(debugConfig, 'collisionColor', 0xf5950c), + + showSeparations: GetFastValue(debugConfig, 'showSeparations', false), + separationColor: GetFastValue(debugConfig, 'separationColor', 0xffa500), + + showBody: GetFastValue(debugConfig, 'showBody', true), + showStaticBody: GetFastValue(debugConfig, 'showStaticBody', true), + showInternalEdges: GetFastValue(debugConfig, 'showInternalEdges', false), + + renderFill: GetFastValue(debugConfig, 'renderFill', false), + renderLine: GetFastValue(debugConfig, 'renderLine', true), + + fillColor: GetFastValue(debugConfig, 'fillColor', 0x106909), + fillOpacity: GetFastValue(debugConfig, 'fillOpacity', 1), + lineColor: GetFastValue(debugConfig, 'lineColor', 0x28de19), + lineOpacity: GetFastValue(debugConfig, 'lineOpacity', 1), + lineThickness: GetFastValue(debugConfig, 'lineThickness', 1), + + staticFillColor: GetFastValue(debugConfig, 'staticFillColor', 0x0d177b), + staticLineColor: GetFastValue(debugConfig, 'staticLineColor', 0x1327e4), + + showSleeping: GetFastValue(debugConfig, 'showSleeping', false), + staticBodySleepOpacity: GetFastValue(debugConfig, 'staticBodySleepOpacity', 0.7), + sleepFillColor: GetFastValue(debugConfig, 'sleepFillColor', 0x464646), + sleepLineColor: GetFastValue(debugConfig, 'sleepLineColor', 0x999a99), + + showSensors: GetFastValue(debugConfig, 'showSensors', true), + sensorFillColor: GetFastValue(debugConfig, 'sensorFillColor', 0x0d177b), + sensorLineColor: GetFastValue(debugConfig, 'sensorLineColor', 0x1327e4), + + showPositions: GetFastValue(debugConfig, 'showPositions', true), + positionSize: GetFastValue(debugConfig, 'positionSize', 4), + positionColor: GetFastValue(debugConfig, 'positionColor', 0xe042da), + + showJoint: GetFastValue(debugConfig, 'showJoint', true), + jointColor: GetFastValue(debugConfig, 'jointColor', 0xe0e042), + jointLineOpacity: GetFastValue(debugConfig, 'jointLineOpacity', 1), + jointLineThickness: GetFastValue(debugConfig, 'jointLineThickness', 2), + + pinSize: GetFastValue(debugConfig, 'pinSize', 4), + pinColor: GetFastValue(debugConfig, 'pinColor', 0x42e0e0), + + springColor: GetFastValue(debugConfig, 'springColor', 0xe042e0), + + anchorColor: GetFastValue(debugConfig, 'anchorColor', 0xefefef), + anchorSize: GetFastValue(debugConfig, 'anchorSize', 4), + + showConvexHulls: GetFastValue(debugConfig, 'showConvexHulls', false), + hullColor: GetFastValue(debugConfig, 'hullColor', 0xd703d0) + }; + + if (this.drawDebug) + { + this.createDebugGraphic(); + } + + this.setEventsProxy(); + + // Create the walls + + if (GetFastValue(config, 'setBounds', false)) + { + var boundsConfig = config['setBounds']; + + if (typeof boundsConfig === 'boolean') + { + this.setBounds(); + } + else + { + var x = GetFastValue(boundsConfig, 'x', 0); + var y = GetFastValue(boundsConfig, 'y', 0); + var width = GetFastValue(boundsConfig, 'width', scene.sys.scale.width); + var height = GetFastValue(boundsConfig, 'height', scene.sys.scale.height); + var thickness = GetFastValue(boundsConfig, 'thickness', 64); + var left = GetFastValue(boundsConfig, 'left', true); + var right = GetFastValue(boundsConfig, 'right', true); + var top = GetFastValue(boundsConfig, 'top', true); + var bottom = GetFastValue(boundsConfig, 'bottom', true); + + this.setBounds(x, y, width, height, thickness, left, right, top, bottom); + } + } + }, + + /** + * Sets the debug render style for the children of the given Matter Composite. + * + * Composites themselves do not render, but they can contain bodies, constraints and other composites that may do. + * So the children of this composite are passed to the `setBodyRenderStyle`, `setCompositeRenderStyle` and + * `setConstraintRenderStyle` methods accordingly. + * + * @method Phaser.Physics.Matter.World#setCompositeRenderStyle + * @since 3.22.0 + * + * @param {MatterJS.CompositeType} composite - The Matter Composite to set the render style on. + * + * @return {this} This Matter World instance for method chaining. + */ + setCompositeRenderStyle: function (composite) + { + var bodies = composite.bodies; + var constraints = composite.constraints; + var composites = composite.composites; + + var i; + var obj; + var render; + + for (i = 0; i < bodies.length; i++) + { + obj = bodies[i]; + render = obj.render; + + this.setBodyRenderStyle(obj, render.lineColor, render.lineOpacity, render.lineThickness, render.fillColor, render.fillOpacity); + } + + for (i = 0; i < constraints.length; i++) + { + obj = constraints[i]; + render = obj.render; + + this.setConstraintRenderStyle(obj, render.lineColor, render.lineOpacity, render.lineThickness, render.pinSize, render.anchorColor, render.anchorSize); + } + + for (i = 0; i < composites.length; i++) + { + obj = composites[i]; + + this.setCompositeRenderStyle(obj); + } + + return this; + }, + + /** + * Sets the debug render style for the given Matter Body. + * + * If you are using this on a Phaser Game Object, such as a Matter Sprite, then pass in the body property + * to this method, not the Game Object itself. + * + * If you wish to skip a parameter, so it retains its current value, pass `false` for it. + * + * If you wish to reset the Body render colors to the defaults found in the World Debug Config, then call + * this method with just the `body` parameter provided and no others. + * + * @method Phaser.Physics.Matter.World#setBodyRenderStyle + * @since 3.22.0 + * + * @param {MatterJS.BodyType} body - The Matter Body to set the render style on. + * @param {number} [lineColor] - The line color. If `null` it will use the World Debug Config value. + * @param {number} [lineOpacity] - The line opacity, between 0 and 1. If `null` it will use the World Debug Config value. + * @param {number} [lineThickness] - The line thickness. If `null` it will use the World Debug Config value. + * @param {number} [fillColor] - The fill color. If `null` it will use the World Debug Config value. + * @param {number} [fillOpacity] - The fill opacity, between 0 and 1. If `null` it will use the World Debug Config value. + * + * @return {this} This Matter World instance for method chaining. + */ + setBodyRenderStyle: function (body, lineColor, lineOpacity, lineThickness, fillColor, fillOpacity) + { + var render = body.render; + var config = this.debugConfig; + + if (!render) + { + return this; + } + + if (lineColor === undefined || lineColor === null) + { + lineColor = (body.isStatic) ? config.staticLineColor : config.lineColor; + } + + if (lineOpacity === undefined || lineOpacity === null) + { + lineOpacity = config.lineOpacity; + } + + if (lineThickness === undefined || lineThickness === null) + { + lineThickness = config.lineThickness; + } + + if (fillColor === undefined || fillColor === null) + { + fillColor = (body.isStatic) ? config.staticFillColor : config.fillColor; + } + + if (fillOpacity === undefined || fillOpacity === null) + { + fillOpacity = config.fillOpacity; + } + + if (lineColor !== false) + { + render.lineColor = lineColor; + } + + if (lineOpacity !== false) + { + render.lineOpacity = lineOpacity; + } + + if (lineThickness !== false) + { + render.lineThickness = lineThickness; + } + + if (fillColor !== false) + { + render.fillColor = fillColor; + } + + if (fillOpacity !== false) + { + render.fillOpacity = fillOpacity; + } + + return this; + }, + + /** + * Sets the debug render style for the given Matter Constraint. + * + * If you are using this on a Phaser Game Object, then pass in the body property + * to this method, not the Game Object itself. + * + * If you wish to skip a parameter, so it retains its current value, pass `false` for it. + * + * If you wish to reset the Constraint render colors to the defaults found in the World Debug Config, then call + * this method with just the `constraint` parameter provided and no others. + * + * @method Phaser.Physics.Matter.World#setConstraintRenderStyle + * @since 3.22.0 + * + * @param {MatterJS.ConstraintType} constraint - The Matter Constraint to set the render style on. + * @param {number} [lineColor] - The line color. If `null` it will use the World Debug Config value. + * @param {number} [lineOpacity] - The line opacity, between 0 and 1. If `null` it will use the World Debug Config value. + * @param {number} [lineThickness] - The line thickness. If `null` it will use the World Debug Config value. + * @param {number} [pinSize] - If this constraint is a pin, this sets the size of the pin circle. If `null` it will use the World Debug Config value. + * @param {number} [anchorColor] - The color used when rendering this constraints anchors. If `null` it will use the World Debug Config value. + * @param {number} [anchorSize] - The size of the anchor circle, if this constraint has anchors. If `null` it will use the World Debug Config value. + * + * @return {this} This Matter World instance for method chaining. + */ + setConstraintRenderStyle: function (constraint, lineColor, lineOpacity, lineThickness, pinSize, anchorColor, anchorSize) + { + var render = constraint.render; + var config = this.debugConfig; + + if (!render) + { + return this; + } + + // Reset them + if (lineColor === undefined || lineColor === null) + { + var type = render.type; + + if (type === 'line') + { + lineColor = config.jointColor; + } + else if (type === 'pin') + { + lineColor = config.pinColor; + } + else if (type === 'spring') + { + lineColor = config.springColor; + } + } + + if (lineOpacity === undefined || lineOpacity === null) + { + lineOpacity = config.jointLineOpacity; + } + + if (lineThickness === undefined || lineThickness === null) + { + lineThickness = config.jointLineThickness; + } + + if (pinSize === undefined || pinSize === null) + { + pinSize = config.pinSize; + } + + if (anchorColor === undefined || anchorColor === null) + { + anchorColor = config.anchorColor; + } + + if (anchorSize === undefined || anchorSize === null) + { + anchorSize = config.anchorSize; + } + + if (lineColor !== false) + { + render.lineColor = lineColor; + } + + if (lineOpacity !== false) + { + render.lineOpacity = lineOpacity; + } + + if (lineThickness !== false) + { + render.lineThickness = lineThickness; + } + + if (pinSize !== false) + { + render.pinSize = pinSize; + } + + if (anchorColor !== false) + { + render.anchorColor = anchorColor; + } + + if (anchorSize !== false) + { + render.anchorSize = anchorSize; + } + + return this; + }, + + /** + * This internal method acts as a proxy between all of the Matter JS events and then re-emits them + * via this class. + * + * @method Phaser.Physics.Matter.World#setEventsProxy + * @since 3.0.0 + */ + setEventsProxy: function () + { + var _this = this; + var engine = this.engine; + var world = this.localWorld; + + // Inject debug styles + + if (this.drawDebug) + { + MatterEvents.on(world, 'compositeModified', function (composite) + { + _this.setCompositeRenderStyle(composite); + }); + + MatterEvents.on(world, 'beforeAdd', function (event) + { + var objects = [].concat(event.object); + + for (var i = 0; i < objects.length; i++) + { + var obj = objects[i]; + var render = obj.render; + + if (obj.type === 'body') + { + _this.setBodyRenderStyle(obj, render.lineColor, render.lineOpacity, render.lineThickness, render.fillColor, render.fillOpacity); + } + else if (obj.type === 'composite') + { + _this.setCompositeRenderStyle(obj); + } + else if (obj.type === 'constraint') + { + _this.setConstraintRenderStyle(obj, render.lineColor, render.lineOpacity, render.lineThickness, render.pinSize, render.anchorColor, render.anchorSize); + } + } + }); + } + + MatterEvents.on(world, 'beforeAdd', function (event) + { + _this.emit(Events.BEFORE_ADD, event); + }); + + MatterEvents.on(world, 'afterAdd', function (event) + { + _this.emit(Events.AFTER_ADD, event); + }); + + MatterEvents.on(world, 'beforeRemove', function (event) + { + _this.emit(Events.BEFORE_REMOVE, event); + }); + + MatterEvents.on(world, 'afterRemove', function (event) + { + _this.emit(Events.AFTER_REMOVE, event); + }); + + MatterEvents.on(engine, 'beforeUpdate', function (event) + { + _this.emit(Events.BEFORE_UPDATE, event); + }); + + MatterEvents.on(engine, 'afterUpdate', function (event) + { + _this.emit(Events.AFTER_UPDATE, event); + }); + + MatterEvents.on(engine, 'collisionStart', function (event) + { + var pairs = event.pairs; + var bodyA; + var bodyB; + + if (pairs.length > 0) + { + bodyA = pairs[0].bodyA; + bodyB = pairs[0].bodyB; + } + + _this.emit(Events.COLLISION_START, event, bodyA, bodyB); + }); + + MatterEvents.on(engine, 'collisionActive', function (event) + { + var pairs = event.pairs; + var bodyA; + var bodyB; + + if (pairs.length > 0) + { + bodyA = pairs[0].bodyA; + bodyB = pairs[0].bodyB; + } + + _this.emit(Events.COLLISION_ACTIVE, event, bodyA, bodyB); + }); + + MatterEvents.on(engine, 'collisionEnd', function (event) + { + var pairs = event.pairs; + var bodyA; + var bodyB; + + if (pairs.length > 0) + { + bodyA = pairs[0].bodyA; + bodyB = pairs[0].bodyB; + } + + _this.emit(Events.COLLISION_END, event, bodyA, bodyB); + }); + }, + + /** + * Sets the bounds of the Physics world to match the given world pixel dimensions. + * + * You can optionally set which 'walls' to create: left, right, top or bottom. + * If none of the walls are given it will default to use the walls settings it had previously. + * I.e. if you previously told it to not have the left or right walls, and you then adjust the world size + * the newly created bounds will also not have the left and right walls. + * Explicitly state them in the parameters to override this. + * + * @method Phaser.Physics.Matter.World#setBounds + * @since 3.0.0 + * + * @param {number} [x=0] - The x coordinate of the top-left corner of the bounds. + * @param {number} [y=0] - The y coordinate of the top-left corner of the bounds. + * @param {number} [width] - The width of the bounds. + * @param {number} [height] - The height of the bounds. + * @param {number} [thickness=64] - The thickness of each wall, in pixels. + * @param {boolean} [left=true] - If true will create the left bounds wall. + * @param {boolean} [right=true] - If true will create the right bounds wall. + * @param {boolean} [top=true] - If true will create the top bounds wall. + * @param {boolean} [bottom=true] - If true will create the bottom bounds wall. + * + * @return {Phaser.Physics.Matter.World} This Matter World object. + */ + setBounds: function (x, y, width, height, thickness, left, right, top, bottom) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.scene.sys.scale.width; } + if (height === undefined) { height = this.scene.sys.scale.height; } + if (thickness === undefined) { thickness = 64; } + if (left === undefined) { left = true; } + if (right === undefined) { right = true; } + if (top === undefined) { top = true; } + if (bottom === undefined) { bottom = true; } + + this.updateWall(left, 'left', x - thickness, y - thickness, thickness, height + (thickness * 2)); + this.updateWall(right, 'right', x + width, y - thickness, thickness, height + (thickness * 2)); + this.updateWall(top, 'top', x, y - thickness, width, thickness); + this.updateWall(bottom, 'bottom', x, y + height, width, thickness); + + return this; + }, + + /** + * Updates the 4 rectangle bodies that were created, if `setBounds` was set in the Matter config, to use + * the new positions and sizes. This method is usually only called internally via the `setBounds` method. + * + * @method Phaser.Physics.Matter.World#updateWall + * @since 3.0.0 + * + * @param {boolean} add - `true` if the walls are being added or updated, `false` to remove them from the world. + * @param {string} [position] - Either `left`, `right`, `top` or `bottom`. Only optional if `add` is `false`. + * @param {number} [x] - The horizontal position to place the walls at. Only optional if `add` is `false`. + * @param {number} [y] - The vertical position to place the walls at. Only optional if `add` is `false`. + * @param {number} [width] - The width of the walls, in pixels. Only optional if `add` is `false`. + * @param {number} [height] - The height of the walls, in pixels. Only optional if `add` is `false`. + */ + updateWall: function (add, position, x, y, width, height) + { + var wall = this.walls[position]; + + if (add) + { + if (wall) + { + MatterWorld.remove(this.localWorld, wall); + } + + // adjust center + x += (width / 2); + y += (height / 2); + + this.walls[position] = this.create(x, y, width, height, { isStatic: true, friction: 0, frictionStatic: 0 }); + } + else + { + if (wall) + { + MatterWorld.remove(this.localWorld, wall); + } + + this.walls[position] = null; + } + }, + + /** + * Creates a Phaser.GameObjects.Graphics object that is used to render all of the debug bodies and joints to. + * + * This method is called automatically by the constructor, if debugging has been enabled. + * + * The created Graphics object is automatically added to the Scene at 0x0 and given a depth of `Number.MAX_VALUE`, + * so it renders above all else in the Scene. + * + * The Graphics object is assigned to the `debugGraphic` property of this class and `drawDebug` is enabled. + * + * @method Phaser.Physics.Matter.World#createDebugGraphic + * @since 3.0.0 + * + * @return {Phaser.GameObjects.Graphics} The newly created Graphics object. + */ + createDebugGraphic: function () + { + var graphic = this.scene.sys.add.graphics({ x: 0, y: 0 }); + + graphic.setDepth(Number.MAX_VALUE); + + this.debugGraphic = graphic; + + this.drawDebug = true; + + return graphic; + }, + + /** + * Sets the world gravity and gravity scale to 0. + * + * @method Phaser.Physics.Matter.World#disableGravity + * @since 3.0.0 + * + * @return {this} This Matter World object. + */ + disableGravity: function () + { + this.localWorld.gravity.x = 0; + this.localWorld.gravity.y = 0; + this.localWorld.gravity.scale = 0; + + return this; + }, + + /** + * Sets the worlds gravity to the values given. + * + * Gravity effects all bodies in the world, unless they have the `ignoreGravity` flag set. + * + * @method Phaser.Physics.Matter.World#setGravity + * @since 3.0.0 + * + * @param {number} [x=0] - The world gravity x component. + * @param {number} [y=1] - The world gravity y component. + * @param {number} [scale=0.001] - The gravity scale factor. + * + * @return {this} This Matter World object. + */ + setGravity: function (x, y, scale) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 1; } + if (scale === undefined) { scale = 0.001; } + + this.localWorld.gravity.x = x; + this.localWorld.gravity.y = y; + this.localWorld.gravity.scale = scale; + + return this; + }, + + /** + * Creates a rectangle Matter body and adds it to the world. + * + * @method Phaser.Physics.Matter.World#create + * @since 3.0.0 + * + * @param {number} x - The horizontal position of the body in the world. + * @param {number} y - The vertical position of the body in the world. + * @param {number} width - The width of the body. + * @param {number} height - The height of the body. + * @param {object} options - Optional Matter configuration object. + * + * @return {MatterJS.BodyType} The Matter.js body that was created. + */ + create: function (x, y, width, height, options) + { + var body = Bodies.rectangle(x, y, width, height, options); + + MatterWorld.add(this.localWorld, body); + + return body; + }, + + /** + * Adds a Matter JS object, or array of objects, to the world. + * + * The objects should be valid Matter JS entities, such as a Body, Composite or Constraint. + * + * Triggers `beforeAdd` and `afterAdd` events. + * + * @method Phaser.Physics.Matter.World#add + * @since 3.0.0 + * + * @param {(object|object[])} object - Can be single object, or an array, and can be a body, composite or constraint. + * + * @return {this} This Matter World object. + */ + add: function (object) + { + MatterWorld.add(this.localWorld, object); + + return this; + }, + + /** + * Removes a Matter JS object, or array of objects, from the world. + * + * The objects should be valid Matter JS entities, such as a Body, Composite or Constraint. + * + * Triggers `beforeRemove` and `afterRemove` events. + * + * @method Phaser.Physics.Matter.World#remove + * @since 3.0.0 + * + * @param {(object|object[])} object - Can be single object, or an array, and can be a body, composite or constraint. + * @param {boolean} [deep=false] - Optionally search the objects children and recursively remove those as well. + * + * @return {this} This Matter World object. + */ + remove: function (object, deep) + { + if (!Array.isArray(object)) + { + object = [ object ]; + } + + for (var i = 0; i < object.length; i++) + { + var entity = object[i]; + + var body = (entity.body) ? entity.body : entity; + + Composite.remove(this.localWorld, body, deep); + } + + return this; + }, + + /** + * Removes a Matter JS constraint, or array of constraints, from the world. + * + * Triggers `beforeRemove` and `afterRemove` events. + * + * @method Phaser.Physics.Matter.World#removeConstraint + * @since 3.0.0 + * + * @param {(MatterJS.ConstraintType|MatterJS.ConstraintType[])} constraint - A Matter JS Constraint, or an array of constraints, to be removed. + * @param {boolean} [deep=false] - Optionally search the objects children and recursively remove those as well. + * + * @return {this} This Matter World object. + */ + removeConstraint: function (constraint, deep) + { + Composite.remove(this.localWorld, constraint, deep); + + return this; + }, + + /** + * Adds `MatterTileBody` instances for all the colliding tiles within the given tilemap layer. + * + * Set the appropriate tiles in your layer to collide before calling this method! + * + * @method Phaser.Physics.Matter.World#convertTilemapLayer + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - An array of tiles. + * @param {object} [options] - Options to be passed to the MatterTileBody constructor. {@see Phaser.Physics.Matter.TileBody} + * + * @return {this} This Matter World object. + */ + convertTilemapLayer: function (tilemapLayer, options) + { + var layerData = tilemapLayer.layer; + var tiles = tilemapLayer.getTilesWithin(0, 0, layerData.width, layerData.height, { isColliding: true }); + + this.convertTiles(tiles, options); + + return this; + }, + + /** + * Adds `MatterTileBody` instances for the given tiles. This adds bodies regardless of whether the + * tiles are set to collide or not. + * + * @method Phaser.Physics.Matter.World#convertTiles + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.Tile[]} tiles - An array of tiles. + * @param {object} [options] - Options to be passed to the MatterTileBody constructor. {@see Phaser.Physics.Matter.TileBody} + * + * @return {this} This Matter World object. + */ + convertTiles: function (tiles, options) + { + if (tiles.length === 0) + { + return this; + } + + for (var i = 0; i < tiles.length; i++) + { + new MatterTileBody(this, tiles[i], options); + } + + return this; + }, + + /** + * Returns the next unique group index for which bodies will collide. + * If `isNonColliding` is `true`, returns the next unique group index for which bodies will not collide. + * + * @method Phaser.Physics.Matter.World#nextGroup + * @since 3.0.0 + * + * @param {boolean} [isNonColliding=false] - If `true`, returns the next unique group index for which bodies will _not_ collide. + * + * @return {number} Unique category bitfield + */ + nextGroup: function (isNonColliding) + { + return MatterBody.nextGroup(isNonColliding); + }, + + /** + * Returns the next unique category bitfield (starting after the initial default category 0x0001). + * There are 32 available. + * + * @method Phaser.Physics.Matter.World#nextCategory + * @since 3.0.0 + * + * @return {number} Unique category bitfield + */ + nextCategory: function () + { + return MatterBody.nextCategory(); + }, + + /** + * Pauses this Matter World instance and sets `enabled` to `false`. + * + * A paused world will not run any simulations for the duration it is paused. + * + * @method Phaser.Physics.Matter.World#pause + * @fires Phaser.Physics.Matter.Events#PAUSE + * @since 3.0.0 + * + * @return {this} This Matter World object. + */ + pause: function () + { + this.enabled = false; + + this.emit(Events.PAUSE); + + return this; + }, + + /** + * Resumes this Matter World instance from a paused state and sets `enabled` to `true`. + * + * @method Phaser.Physics.Matter.World#resume + * @fires Phaser.Physics.Matter.Events#RESUME + * @since 3.0.0 + * + * @return {this} This Matter World object. + */ + resume: function () + { + this.enabled = true; + + this.emit(Events.RESUME); + + return this; + }, + + /** + * The internal update method. This is called automatically by the parent Scene. + * + * Moves the simulation forward in time by delta ms. Uses `World.correction` value as an optional number that + * specifies the time correction factor to apply to the update. This can help improve the accuracy of the + * simulation in cases where delta is changing between updates. The value of correction is defined as `delta / lastDelta`, + * i.e. the percentage change of delta over the last step. Therefore the value is always 1 (no correction) when + * delta is constant (or when no correction is desired, which is the default). + * See the paper on Time Corrected Verlet for more information. + * + * Triggers `beforeUpdate` and `afterUpdate` events. Triggers `collisionStart`, `collisionActive` and `collisionEnd` events. + * + * If the World is paused, `update` is still run, but exits early and does not update the Matter Engine. + * + * @method Phaser.Physics.Matter.World#update + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + update: function (time, delta) + { + if (!this.enabled || !this.autoUpdate) + { + return; + } + + var engine = this.engine; + var runner = this.runner; + + var timing = engine.timing; + + if (runner.isFixed) + { + // fixed timestep + delta = this.getDelta(time, delta); + } + else + { + // dynamic timestep based on wall clock between calls + delta = (time - runner.timePrev) || runner.delta; + runner.timePrev = time; + + // optimistically filter delta over a few frames, to improve stability + runner.deltaHistory.push(delta); + runner.deltaHistory = runner.deltaHistory.slice(-runner.deltaSampleSize); + delta = Math.min.apply(null, runner.deltaHistory); + + // limit delta + delta = delta < runner.deltaMin ? runner.deltaMin : delta; + delta = delta > runner.deltaMax ? runner.deltaMax : delta; + + // update engine timing object + runner.delta = delta; + } + + runner.timeScalePrev = timing.timeScale; + + // fps counter + runner.frameCounter += 1; + + if (time - runner.counterTimestamp >= 1000) + { + runner.fps = runner.frameCounter * ((time - runner.counterTimestamp) / 1000); + runner.counterTimestamp = time; + runner.frameCounter = 0; + } + + Engine.update(engine, delta); + }, + + /** + * Manually advances the physics simulation by one iteration. + * + * You can optionally pass in the `delta` and `correction` values to be used by Engine.update. + * If undefined they use the Matter defaults of 60Hz and no correction. + * + * Calling `step` directly bypasses any checks of `enabled` or `autoUpdate`. + * + * It also ignores any custom `getDelta` functions, as you should be passing the delta + * value in to this call. + * + * You can adjust the number of iterations that Engine.update performs internally. + * Use the Scene Matter Physics config object to set the following properties: + * + * positionIterations (defaults to 6) + * velocityIterations (defaults to 4) + * constraintIterations (defaults to 2) + * + * Adjusting these values can help performance in certain situations, depending on the physics requirements + * of your game. + * + * @method Phaser.Physics.Matter.World#step + * @since 3.4.0 + * + * @param {number} [delta=16.666] - The delta value. + */ + step: function (delta) + { + Engine.update(this.engine, delta); + }, + + /** + * Runs the Matter Engine.update at a fixed timestep of 60Hz. + * + * @method Phaser.Physics.Matter.World#update60Hz + * @since 3.4.0 + * + * @return {number} The delta value to be passed to Engine.update. + */ + update60Hz: function () + { + return 1000 / 60; + }, + + /** + * Runs the Matter Engine.update at a fixed timestep of 30Hz. + * + * @method Phaser.Physics.Matter.World#update30Hz + * @since 3.4.0 + * + * @return {number} The delta value to be passed to Engine.update. + */ + update30Hz: function () + { + return 1000 / 30; + }, + + /** + * Returns `true` if the given body can be found within the World. + * + * @method Phaser.Physics.Matter.World#has + * @since 3.22.0 + * + * @param {(MatterJS.Body|Phaser.GameObjects.GameObject)} body - The Matter Body, or Game Object, to search for within the world. + * + * @return {MatterJS.BodyType[]} An array of all the Matter JS Bodies in this World. + */ + has: function (body) + { + var src = (body.hasOwnProperty('body')) ? body.body : body; + + return (Composite.get(this.localWorld, src.id, src.type) !== null); + }, + + /** + * Returns all the bodies in the Matter World, including all bodies in children, recursively. + * + * @method Phaser.Physics.Matter.World#getAllBodies + * @since 3.22.0 + * + * @return {MatterJS.BodyType[]} An array of all the Matter JS Bodies in this World. + */ + getAllBodies: function () + { + return Composite.allBodies(this.localWorld); + }, + + /** + * Returns all the constraints in the Matter World, including all constraints in children, recursively. + * + * @method Phaser.Physics.Matter.World#getAllConstraints + * @since 3.22.0 + * + * @return {MatterJS.ConstraintType[]} An array of all the Matter JS Constraints in this World. + */ + getAllConstraints: function () + { + return Composite.allConstraints(this.localWorld); + }, + + /** + * Returns all the composites in the Matter World, including all composites in children, recursively. + * + * @method Phaser.Physics.Matter.World#getAllComposites + * @since 3.22.0 + * + * @return {MatterJS.CompositeType[]} An array of all the Matter JS Composites in this World. + */ + getAllComposites: function () + { + return Composite.allComposites(this.localWorld); + }, + + /** + * Handles the rendering of bodies and debug information to the debug Graphics object, if enabled. + * + * This method is called automatically by the Scene after all processing has taken place. + * + * @method Phaser.Physics.Matter.World#postUpdate + * @private + * @since 3.0.0 + */ + postUpdate: function () + { + if (!this.drawDebug) + { + return; + } + + var config = this.debugConfig; + var engine = this.engine; + var graphics = this.debugGraphic; + + var bodies = Composite.allBodies(this.localWorld); + + this.debugGraphic.clear(); + + if (config.showBroadphase && engine.broadphase.controller) + { + this.renderGrid(engine.broadphase, graphics, config.broadphaseColor, 0.5); + } + + if (config.showBounds) + { + this.renderBodyBounds(bodies, graphics, config.boundsColor, 0.5); + } + + if (config.showBody || config.showStaticBody) + { + this.renderBodies(bodies); + } + + if (config.showJoint) + { + this.renderJoints(); + } + + if (config.showAxes || config.showAngleIndicator) + { + this.renderBodyAxes(bodies, graphics, config.showAxes, config.angleColor, 0.5); + } + + if (config.showVelocity) + { + this.renderBodyVelocity(bodies, graphics, config.velocityColor, 1, 2); + } + + if (config.showSeparations) + { + this.renderSeparations(engine.pairs.list, graphics, config.separationColor); + } + + if (config.showCollisions) + { + this.renderCollisions(engine.pairs.list, graphics, config.collisionColor); + } + }, + + /** + * Renders the Engine Broadphase Controller Grid to the given Graphics instance. + * + * The debug renderer calls this method if the `showBroadphase` config value is set. + * + * This method is used internally by the Matter Debug Renderer, but is also exposed publically should + * you wish to render the Grid to your own Graphics instance. + * + * @method Phaser.Physics.Matter.World#renderGrid + * @since 3.22.0 + * + * @param {MatterJS.Grid} grid - The Matter Grid to be rendered. + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. + * @param {number} lineColor - The line color. + * @param {number} lineOpacity - The line opacity, between 0 and 1. + * + * @return {this} This Matter World instance for method chaining. + */ + renderGrid: function (grid, graphics, lineColor, lineOpacity) + { + graphics.lineStyle(1, lineColor, lineOpacity); + + var bucketKeys = Common.keys(grid.buckets); + + for (var i = 0; i < bucketKeys.length; i++) + { + var bucketId = bucketKeys[i]; + + if (grid.buckets[bucketId].length < 2) + { + continue; + } + + var region = bucketId.split(/C|R/); + + graphics.strokeRect( + parseInt(region[1], 10) * grid.bucketWidth, + parseInt(region[2], 10) * grid.bucketHeight, + grid.bucketWidth, + grid.bucketHeight + ); + } + + return this; + }, + + /** + * Renders the list of Pair separations to the given Graphics instance. + * + * The debug renderer calls this method if the `showSeparations` config value is set. + * + * This method is used internally by the Matter Debug Renderer, but is also exposed publically should + * you wish to render the Grid to your own Graphics instance. + * + * @method Phaser.Physics.Matter.World#renderSeparations + * @since 3.22.0 + * + * @param {MatterJS.Pair[]} pairs - An array of Matter Pairs to be rendered. + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. + * @param {number} lineColor - The line color. + * + * @return {this} This Matter World instance for method chaining. + */ + renderSeparations: function (pairs, graphics, lineColor) + { + graphics.lineStyle(1, lineColor, 1); + + for (var i = 0; i < pairs.length; i++) + { + var pair = pairs[i]; + + if (!pair.isActive) + { + continue; + } + + var collision = pair.collision; + var bodyA = collision.bodyA; + var bodyB = collision.bodyB; + var posA = bodyA.position; + var posB = bodyB.position; + var penetration = collision.penetration; + + var k = (!bodyA.isStatic && !bodyB.isStatic) ? 4 : 1; + + if (bodyB.isStatic) + { + k = 0; + } + + graphics.lineBetween( + posB.x, + posB.y, + posB.x - (penetration.x * k), + posB.y - (penetration.y * k) + ); + + k = (!bodyA.isStatic && !bodyB.isStatic) ? 4 : 1; + + if (bodyA.isStatic) + { + k = 0; + } + + graphics.lineBetween( + posA.x, + posA.y, + posA.x - (penetration.x * k), + posA.y - (penetration.y * k) + ); + } + + return this; + }, + + /** + * Renders the list of collision points and normals to the given Graphics instance. + * + * The debug renderer calls this method if the `showCollisions` config value is set. + * + * This method is used internally by the Matter Debug Renderer, but is also exposed publically should + * you wish to render the Grid to your own Graphics instance. + * + * @method Phaser.Physics.Matter.World#renderCollisions + * @since 3.22.0 + * + * @param {MatterJS.Pair[]} pairs - An array of Matter Pairs to be rendered. + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. + * @param {number} lineColor - The line color. + * + * @return {this} This Matter World instance for method chaining. + */ + renderCollisions: function (pairs, graphics, lineColor) + { + graphics.lineStyle(1, lineColor, 0.5); + graphics.fillStyle(lineColor, 1); + + var i; + var pair; + + // Collision Positions + + for (i = 0; i < pairs.length; i++) + { + pair = pairs[i]; + + if (!pair.isActive) + { + continue; + } + + for (var j = 0; j < pair.activeContacts.length; j++) + { + var contact = pair.activeContacts[j]; + var vertex = contact.vertex; + + graphics.fillRect(vertex.x - 2, vertex.y - 2, 5, 5); + } + } + + // Collision Normals + + for (i = 0; i < pairs.length; i++) + { + pair = pairs[i]; + + if (!pair.isActive) + { + continue; + } + + var collision = pair.collision; + var contacts = pair.activeContacts; + + if (contacts.length > 0) + { + var normalPosX = contacts[0].vertex.x; + var normalPosY = contacts[0].vertex.y; + + if (contacts.length === 2) + { + normalPosX = (contacts[0].vertex.x + contacts[1].vertex.x) / 2; + normalPosY = (contacts[0].vertex.y + contacts[1].vertex.y) / 2; + } + + if (collision.bodyB === collision.supports[0].body || collision.bodyA.isStatic) + { + graphics.lineBetween( + normalPosX - collision.normal.x * 8, + normalPosY - collision.normal.y * 8, + normalPosX, + normalPosY + ); + } + else + { + graphics.lineBetween( + normalPosX + collision.normal.x * 8, + normalPosY + collision.normal.y * 8, + normalPosX, + normalPosY + ); + } + } + } + + return this; + }, + + /** + * Renders the bounds of an array of Bodies to the given Graphics instance. + * + * If the body is a compound body, it will render the bounds for the parent compound. + * + * The debug renderer calls this method if the `showBounds` config value is set. + * + * This method is used internally by the Matter Debug Renderer, but is also exposed publically should + * you wish to render bounds to your own Graphics instance. + * + * @method Phaser.Physics.Matter.World#renderBodyBounds + * @since 3.22.0 + * + * @param {array} bodies - An array of bodies from the localWorld. + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. + * @param {number} lineColor - The line color. + * @param {number} lineOpacity - The line opacity, between 0 and 1. + */ + renderBodyBounds: function (bodies, graphics, lineColor, lineOpacity) + { + graphics.lineStyle(1, lineColor, lineOpacity); + + for (var i = 0; i < bodies.length; i++) + { + var body = bodies[i]; + + // 1) Don't show invisible bodies + if (!body.render.visible) + { + continue; + } + + var bounds = body.bounds; + + if (bounds) + { + graphics.strokeRect( + bounds.min.x, + bounds.min.y, + bounds.max.x - bounds.min.x, + bounds.max.y - bounds.min.y + ); + } + else + { + var parts = body.parts; + + for (var j = parts.length > 1 ? 1 : 0; j < parts.length; j++) + { + var part = parts[j]; + + graphics.strokeRect( + part.bounds.min.x, + part.bounds.min.y, + part.bounds.max.x - part.bounds.min.x, + part.bounds.max.y - part.bounds.min.y + ); + } + } + } + + return this; + }, + + /** + * Renders either all axes, or a single axis indicator, for an array of Bodies, to the given Graphics instance. + * + * The debug renderer calls this method if the `showAxes` or `showAngleIndicator` config values are set. + * + * This method is used internally by the Matter Debug Renderer, but is also exposed publically should + * you wish to render bounds to your own Graphics instance. + * + * @method Phaser.Physics.Matter.World#renderBodyAxes + * @since 3.22.0 + * + * @param {array} bodies - An array of bodies from the localWorld. + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. + * @param {boolean} showAxes - If `true` it will render all body axes. If `false` it will render a single axis indicator. + * @param {number} lineColor - The line color. + * @param {number} lineOpacity - The line opacity, between 0 and 1. + */ + renderBodyAxes: function (bodies, graphics, showAxes, lineColor, lineOpacity) + { + graphics.lineStyle(1, lineColor, lineOpacity); + + for (var i = 0; i < bodies.length; i++) + { + var body = bodies[i]; + var parts = body.parts; + + // 1) Don't show invisible bodies + if (!body.render.visible) + { + continue; + } + + var part; + var j; + var k; + + if (showAxes) + { + for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) + { + part = parts[j]; + + for (k = 0; k < part.axes.length; k++) + { + var axis = part.axes[k]; + + graphics.lineBetween( + part.position.x, + part.position.y, + part.position.x + axis.x * 20, + part.position.y + axis.y * 20 + ); + } + } + } + else + { + for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) + { + part = parts[j]; + + for (k = 0; k < part.axes.length; k++) + { + graphics.lineBetween( + part.position.x, + part.position.y, + (part.vertices[0].x + part.vertices[part.vertices.length - 1].x) / 2, + (part.vertices[0].y + part.vertices[part.vertices.length - 1].y) / 2 + ); + } + } + } + } + + return this; + }, + + /** + * Renders a velocity indicator for an array of Bodies, to the given Graphics instance. + * + * The debug renderer calls this method if the `showVelocity` config value is set. + * + * This method is used internally by the Matter Debug Renderer, but is also exposed publically should + * you wish to render bounds to your own Graphics instance. + * + * @method Phaser.Physics.Matter.World#renderBodyVelocity + * @since 3.22.0 + * + * @param {array} bodies - An array of bodies from the localWorld. + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. + * @param {number} lineColor - The line color. + * @param {number} lineOpacity - The line opacity, between 0 and 1. + * @param {number} lineThickness - The line thickness. + */ + renderBodyVelocity: function (bodies, graphics, lineColor, lineOpacity, lineThickness) + { + graphics.lineStyle(lineThickness, lineColor, lineOpacity); + + for (var i = 0; i < bodies.length; i++) + { + var body = bodies[i]; + + // 1) Don't show invisible bodies + if (!body.render.visible) + { + continue; + } + + graphics.lineBetween( + body.position.x, + body.position.y, + body.position.x + (body.position.x - body.positionPrev.x) * 2, + body.position.y + (body.position.y - body.positionPrev.y) * 2 + ); + } + + return this; + }, + + /** + * Renders the given array of Bodies to the debug graphics instance. + * + * Called automatically by the `postUpdate` method. + * + * @method Phaser.Physics.Matter.World#renderBodies + * @private + * @since 3.14.0 + * + * @param {array} bodies - An array of bodies from the localWorld. + */ + renderBodies: function (bodies) + { + var graphics = this.debugGraphic; + + var config = this.debugConfig; + + var showBody = config.showBody; + var showStaticBody = config.showStaticBody; + var showSleeping = config.showSleeping; + var showInternalEdges = config.showInternalEdges; + var showConvexHulls = config.showConvexHulls; + + var renderFill = config.renderFill; + var renderLine = config.renderLine; + + var staticBodySleepOpacity = config.staticBodySleepOpacity; + var sleepFillColor = config.sleepFillColor; + var sleepLineColor = config.sleepLineColor; + + var hullColor = config.hullColor; + + for (var i = 0; i < bodies.length; i++) + { + var body = bodies[i]; + + // 1) Don't show invisible bodies + if (!body.render.visible) + { + continue; + } + + // 2) Don't show static bodies, OR + // 3) Don't show dynamic bodies + if ((!showStaticBody && body.isStatic) || (!showBody && !body.isStatic)) + { + continue; + } + + var lineColor = body.render.lineColor; + var lineOpacity = body.render.lineOpacity; + var lineThickness = body.render.lineThickness; + var fillColor = body.render.fillColor; + var fillOpacity = body.render.fillOpacity; + + if (showSleeping && body.isSleeping) + { + if (body.isStatic) + { + lineOpacity *= staticBodySleepOpacity; + fillOpacity *= staticBodySleepOpacity; + } + else + { + lineColor = sleepLineColor; + fillColor = sleepFillColor; + } + } + + if (!renderFill) + { + fillColor = null; + } + + if (!renderLine) + { + lineColor = null; + } + + this.renderBody(body, graphics, showInternalEdges, lineColor, lineOpacity, lineThickness, fillColor, fillOpacity); + + var partsLength = body.parts.length; + + if (showConvexHulls && partsLength > 1) + { + this.renderConvexHull(body, graphics, hullColor, lineThickness); + } + } + }, + + /** + * Renders a single Matter Body to the given Phaser Graphics Game Object. + * + * This method is used internally by the Matter Debug Renderer, but is also exposed publically should + * you wish to render a Body to your own Graphics instance. + * + * If you don't wish to render a line around the body, set the `lineColor` parameter to `null`. + * Equally, if you don't wish to render a fill, set the `fillColor` parameter to `null`. + * + * @method Phaser.Physics.Matter.World#renderBody + * @since 3.22.0 + * + * @param {MatterJS.BodyType} body - The Matter Body to be rendered. + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. + * @param {boolean} showInternalEdges - Render internal edges of the polygon? + * @param {number} [lineColor] - The line color. + * @param {number} [lineOpacity] - The line opacity, between 0 and 1. + * @param {number} [lineThickness=1] - The line thickness. + * @param {number} [fillColor] - The fill color. + * @param {number} [fillOpacity] - The fill opacity, between 0 and 1. + * + * @return {this} This Matter World instance for method chaining. + */ + renderBody: function (body, graphics, showInternalEdges, lineColor, lineOpacity, lineThickness, fillColor, fillOpacity) + { + if (lineColor === undefined) { lineColor = null; } + if (lineOpacity === undefined) { lineOpacity = null; } + if (lineThickness === undefined) { lineThickness = 1; } + if (fillColor === undefined) { fillColor = null; } + if (fillOpacity === undefined) { fillOpacity = null; } + + var config = this.debugConfig; + + var sensorFillColor = config.sensorFillColor; + var sensorLineColor = config.sensorLineColor; + + // Handle compound parts + var parts = body.parts; + var partsLength = parts.length; + + for (var k = (partsLength > 1) ? 1 : 0; k < partsLength; k++) + { + var part = parts[k]; + var render = part.render; + var opacity = render.opacity; + + if (!render.visible || opacity === 0 || (part.isSensor && !config.showSensors)) + { + continue; + } + + // Part polygon + var circleRadius = part.circleRadius; + + graphics.beginPath(); + + if (part.isSensor) + { + if (fillColor !== null) + { + graphics.fillStyle(sensorFillColor, fillOpacity * opacity); + } + + if (lineColor !== null) + { + graphics.lineStyle(lineThickness, sensorLineColor, lineOpacity * opacity); + } + } + else + { + if (fillColor !== null) + { + graphics.fillStyle(fillColor, fillOpacity * opacity); + } + + if (lineColor !== null) + { + graphics.lineStyle(lineThickness, lineColor, lineOpacity * opacity); + } + } + + if (circleRadius) + { + graphics.arc(part.position.x, part.position.y, circleRadius, 0, 2 * Math.PI); + } + else + { + var vertices = part.vertices; + var vertLength = vertices.length; + + graphics.moveTo(vertices[0].x, vertices[0].y); + + for (var j = 1; j < vertLength; j++) + { + var vert = vertices[j]; + + if (!vertices[j - 1].isInternal || showInternalEdges) + { + graphics.lineTo(vert.x, vert.y); + } + else + { + graphics.moveTo(vert.x, vert.y); + } + + if (j < vertLength && vert.isInternal && !showInternalEdges) + { + var nextIndex = (j + 1) % vertLength; + + graphics.moveTo(vertices[nextIndex].x, vertices[nextIndex].y); + } + } + + graphics.closePath(); + } + + if (fillColor !== null) + { + graphics.fillPath(); + } + + if (lineColor !== null) + { + graphics.strokePath(); + } + } + + if (config.showPositions && !body.isStatic) + { + var px = body.position.x; + var py = body.position.y; + var hs = Math.ceil(config.positionSize / 2); + + graphics.fillStyle(config.positionColor, 1); + graphics.fillRect(px - hs, py - hs, config.positionSize, config.positionSize); + } + + return this; + }, + + /** + * Renders the Convex Hull for a single Matter Body to the given Phaser Graphics Game Object. + * + * This method is used internally by the Matter Debug Renderer, but is also exposed publically should + * you wish to render a Body hull to your own Graphics instance. + * + * @method Phaser.Physics.Matter.World#renderConvexHull + * @since 3.22.0 + * + * @param {MatterJS.BodyType} body - The Matter Body to be rendered. + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. + * @param {number} hullColor - The color used to render the hull. + * @param {number} [lineThickness=1] - The hull line thickness. + * + * @return {this} This Matter World instance for method chaining. + */ + renderConvexHull: function (body, graphics, hullColor, lineThickness) + { + if (lineThickness === undefined) { lineThickness = 1; } + + var parts = body.parts; + var partsLength = parts.length; + + // Render Convex Hulls + if (partsLength > 1) + { + var verts = body.vertices; + + graphics.lineStyle(lineThickness, hullColor); + + graphics.beginPath(); + + graphics.moveTo(verts[0].x, verts[0].y); + + for (var v = 1; v < verts.length; v++) + { + graphics.lineTo(verts[v].x, verts[v].y); + } + + graphics.lineTo(verts[0].x, verts[0].y); + + graphics.strokePath(); + } + + return this; + }, + + /** + * Renders all of the constraints in the world (unless they are specifically set to invisible). + * + * Called automatically by the `postUpdate` method. + * + * @method Phaser.Physics.Matter.World#renderJoints + * @private + * @since 3.14.0 + */ + renderJoints: function () + { + var graphics = this.debugGraphic; + + // Render constraints + var constraints = Composite.allConstraints(this.localWorld); + + for (var i = 0; i < constraints.length; i++) + { + var config = constraints[i].render; + + var lineColor = config.lineColor; + var lineOpacity = config.lineOpacity; + var lineThickness = config.lineThickness; + var pinSize = config.pinSize; + var anchorColor = config.anchorColor; + var anchorSize = config.anchorSize; + + this.renderConstraint(constraints[i], graphics, lineColor, lineOpacity, lineThickness, pinSize, anchorColor, anchorSize); + } + }, + + /** + * Renders a single Matter Constraint, such as a Pin or a Spring, to the given Phaser Graphics Game Object. + * + * This method is used internally by the Matter Debug Renderer, but is also exposed publically should + * you wish to render a Constraint to your own Graphics instance. + * + * @method Phaser.Physics.Matter.World#renderConstraint + * @since 3.22.0 + * + * @param {MatterJS.ConstraintType} constraint - The Matter Constraint to render. + * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. + * @param {number} lineColor - The line color. + * @param {number} lineOpacity - The line opacity, between 0 and 1. + * @param {number} lineThickness - The line thickness. + * @param {number} pinSize - If this constraint is a pin, this sets the size of the pin circle. + * @param {number} anchorColor - The color used when rendering this constraints anchors. Set to `null` to not render anchors. + * @param {number} anchorSize - The size of the anchor circle, if this constraint has anchors and is rendering them. + * + * @return {this} This Matter World instance for method chaining. + */ + renderConstraint: function (constraint, graphics, lineColor, lineOpacity, lineThickness, pinSize, anchorColor, anchorSize) + { + var render = constraint.render; + + if (!render.visible || !constraint.pointA || !constraint.pointB) + { + return this; + } + + graphics.lineStyle(lineThickness, lineColor, lineOpacity); + + var bodyA = constraint.bodyA; + var bodyB = constraint.bodyB; + var start; + var end; + + if (bodyA) + { + start = Vector.add(bodyA.position, constraint.pointA); + } + else + { + start = constraint.pointA; + } + + if (render.type === 'pin') + { + graphics.strokeCircle(start.x, start.y, pinSize); + } + else + { + if (bodyB) + { + end = Vector.add(bodyB.position, constraint.pointB); + } + else + { + end = constraint.pointB; + } + + graphics.beginPath(); + graphics.moveTo(start.x, start.y); + + if (render.type === 'spring') + { + var delta = Vector.sub(end, start); + var normal = Vector.perp(Vector.normalise(delta)); + var coils = Math.ceil(Common.clamp(constraint.length / 5, 12, 20)); + var offset; + + for (var j = 1; j < coils; j += 1) + { + offset = (j % 2 === 0) ? 1 : -1; + + graphics.lineTo( + start.x + delta.x * (j / coils) + normal.x * offset * 4, + start.y + delta.y * (j / coils) + normal.y * offset * 4 + ); + } + } + + graphics.lineTo(end.x, end.y); + } + + graphics.strokePath(); + + if (render.anchors && anchorSize > 0) + { + graphics.fillStyle(anchorColor); + graphics.fillCircle(start.x, start.y, anchorSize); + graphics.fillCircle(end.x, end.y, anchorSize); + } + + return this; + }, + + /** + * Resets the internal collision IDs that Matter.JS uses for Body collision groups. + * + * You should call this before destroying your game if you need to restart the game + * again on the same page, without first reloading the page. Or, if you wish to + * consistently destroy a Scene that contains Matter.js and then run it again + * later in the same game. + * + * @method Phaser.Physics.Matter.World#resetCollisionIDs + * @since 3.17.0 + */ + resetCollisionIDs: function () + { + Body._nextCollidingGroupId = 1; + Body._nextNonCollidingGroupId = -1; + Body._nextCategory = 0x0001; + + return this; + }, + + /** + * Will remove all Matter physics event listeners and clear the matter physics world, + * engine and any debug graphics, if any. + * + * @method Phaser.Physics.Matter.World#shutdown + * @since 3.0.0 + */ + shutdown: function () + { + MatterEvents.off(this.engine); + + this.removeAllListeners(); + + MatterWorld.clear(this.localWorld, false); + + Engine.clear(this.engine); + + if (this.drawDebug) + { + this.debugGraphic.destroy(); + } + }, + + /** + * Will remove all Matter physics event listeners and clear the matter physics world, + * engine and any debug graphics, if any. + * + * After destroying the world it cannot be re-used again. + * + * @method Phaser.Physics.Matter.World#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.shutdown(); + } + +}); + +module.exports = World; + + +/***/ }), + +/***/ 95349: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * A component to set restitution on objects. + * + * @namespace Phaser.Physics.Matter.Components.Bounce + * @since 3.0.0 + */ +var Bounce = { + + /** + * Sets the restitution on the physics object. + * + * @method Phaser.Physics.Matter.Components.Bounce#setBounce + * @since 3.0.0 + * + * @param {number} value - A Number that defines the restitution (elasticity) of the body. The value is always positive and is in the range (0, 1). A value of 0 means collisions may be perfectly inelastic and no bouncing may occur. A value of 0.8 means the body may bounce back with approximately 80% of its kinetic energy. Note that collision response is based on pairs of bodies, and that restitution values are combined with the following formula: `Math.max(bodyA.restitution, bodyB.restitution)` + * + * @return {this} This Game Object instance. + */ + setBounce: function (value) + { + this.body.restitution = value; + + return this; + } + +}; + +module.exports = Bounce; + + +/***/ }), + +/***/ 70679: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Contains methods for changing the collision filter of a Matter Body. Should be used as a mixin and not called directly. + * + * @namespace Phaser.Physics.Matter.Components.Collision + * @since 3.0.0 + */ +var Collision = { + + /** + * Sets the collision category of this Game Object's Matter Body. This number must be a power of two between 2^0 (= 1) and 2^31. + * Two bodies with different collision groups (see {@link #setCollisionGroup}) will only collide if their collision + * categories are included in their collision masks (see {@link #setCollidesWith}). + * + * @method Phaser.Physics.Matter.Components.Collision#setCollisionCategory + * @since 3.0.0 + * + * @param {number} value - Unique category bitfield. + * + * @return {this} This Game Object instance. + */ + setCollisionCategory: function (value) + { + this.body.collisionFilter.category = value; + + return this; + }, + + /** + * Sets the collision group of this Game Object's Matter Body. If this is zero or two Matter Bodies have different values, + * they will collide according to the usual rules (see {@link #setCollisionCategory} and {@link #setCollisionGroup}). + * If two Matter Bodies have the same positive value, they will always collide; if they have the same negative value, + * they will never collide. + * + * @method Phaser.Physics.Matter.Components.Collision#setCollisionGroup + * @since 3.0.0 + * + * @param {number} value - Unique group index. + * + * @return {this} This Game Object instance. + */ + setCollisionGroup: function (value) + { + this.body.collisionFilter.group = value; + + return this; + }, + + /** + * Sets the collision mask for this Game Object's Matter Body. Two Matter Bodies with different collision groups will only + * collide if each one includes the other's category in its mask based on a bitwise AND, i.e. `(categoryA & maskB) !== 0` + * and `(categoryB & maskA) !== 0` are both true. + * + * @method Phaser.Physics.Matter.Components.Collision#setCollidesWith + * @since 3.0.0 + * + * @param {(number|number[])} categories - A unique category bitfield, or an array of them. + * + * @return {this} This Game Object instance. + */ + setCollidesWith: function (categories) + { + var flags = 0; + + if (!Array.isArray(categories)) + { + flags = categories; + } + else + { + for (var i = 0; i < categories.length; i++) + { + flags |= categories[i]; + } + } + + this.body.collisionFilter.mask = flags; + + return this; + }, + + /** + * The callback is sent a `Phaser.Types.Physics.Matter.MatterCollisionData` object. + * + * This does not change the bodies collision category, group or filter. Those must be set in addition + * to the callback. + * + * @method Phaser.Physics.Matter.Components.Collision#setOnCollide + * @since 3.22.0 + * + * @param {function} callback - The callback to invoke when this body starts colliding with another. + * + * @return {this} This Game Object instance. + */ + setOnCollide: function (callback) + { + this.body.onCollideCallback = callback; + + return this; + }, + + /** + * The callback is sent a `Phaser.Types.Physics.Matter.MatterCollisionData` object. + * + * This does not change the bodies collision category, group or filter. Those must be set in addition + * to the callback. + * + * @method Phaser.Physics.Matter.Components.Collision#setOnCollideEnd + * @since 3.22.0 + * + * @param {function} callback - The callback to invoke when this body stops colliding with another. + * + * @return {this} This Game Object instance. + */ + setOnCollideEnd: function (callback) + { + this.body.onCollideEndCallback = callback; + + return this; + }, + + /** + * The callback is sent a `Phaser.Types.Physics.Matter.MatterCollisionData` object. + * + * This does not change the bodies collision category, group or filter. Those must be set in addition + * to the callback. + * + * @method Phaser.Physics.Matter.Components.Collision#setOnCollideActive + * @since 3.22.0 + * + * @param {function} callback - The callback to invoke for the duration of this body colliding with another. + * + * @return {this} This Game Object instance. + */ + setOnCollideActive: function (callback) + { + this.body.onCollideActiveCallback = callback; + + return this; + }, + + /** + * The callback is sent a reference to the other body, along with a `Phaser.Types.Physics.Matter.MatterCollisionData` object. + * + * This does not change the bodies collision category, group or filter. Those must be set in addition + * to the callback. + * + * @method Phaser.Physics.Matter.Components.Collision#setOnCollideWith + * @since 3.22.0 + * + * @param {(MatterJS.Body|MatterJS.Body[])} body - The body, or an array of bodies, to test for collisions with. + * @param {function} callback - The callback to invoke when this body collides with the given body or bodies. + * + * @return {this} This Game Object instance. + */ + setOnCollideWith: function (body, callback) + { + if (!Array.isArray(body)) + { + body = [ body ]; + } + + for (var i = 0; i < body.length; i++) + { + var src = (body[i].hasOwnProperty('body')) ? body[i].body : body[i]; + + this.body.setOnCollideWith(src, callback); + } + + return this; + } + +}; + +module.exports = Collision; + + +/***/ }), + +/***/ 77178: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Body = __webpack_require__(84125); + +/** + * A component to apply force to Matter.js bodies. + * + * @namespace Phaser.Physics.Matter.Components.Force + * @since 3.0.0 + */ +var Force = { + + // force = vec2 / point + + /** + * Applies a force to a body. + * + * @method Phaser.Physics.Matter.Components.Force#applyForce + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} force - A Vector that specifies the force to apply. + * + * @return {this} This Game Object instance. + */ + applyForce: function (force) + { + this._tempVec2.set(this.body.position.x, this.body.position.y); + + Body.applyForce(this.body, this._tempVec2, force); + + return this; + }, + + /** + * Applies a force to a body from a given position. + * + * @method Phaser.Physics.Matter.Components.Force#applyForceFrom + * @since 3.0.0 + * + * @param {Phaser.Math.Vector2} position - The position in which the force comes from. + * @param {Phaser.Math.Vector2} force - A Vector that specifies the force to apply. + * + * @return {this} This Game Object instance. + */ + applyForceFrom: function (position, force) + { + Body.applyForce(this.body, position, force); + + return this; + }, + + /** + * Apply thrust to the forward position of the body. + * + * Use very small values, such as 0.1, depending on the mass and required speed. + * + * @method Phaser.Physics.Matter.Components.Force#thrust + * @since 3.0.0 + * + * @param {number} speed - A speed value to be applied to a directional force. + * + * @return {this} This Game Object instance. + */ + thrust: function (speed) + { + var angle = this.body.angle; + + this._tempVec2.set(speed * Math.cos(angle), speed * Math.sin(angle)); + + Body.applyForce(this.body, { x: this.body.position.x, y: this.body.position.y }, this._tempVec2); + + return this; + }, + + /** + * Apply thrust to the left position of the body. + * + * Use very small values, such as 0.1, depending on the mass and required speed. + * + * @method Phaser.Physics.Matter.Components.Force#thrustLeft + * @since 3.0.0 + * + * @param {number} speed - A speed value to be applied to a directional force. + * + * @return {this} This Game Object instance. + */ + thrustLeft: function (speed) + { + var angle = this.body.angle - Math.PI / 2; + + this._tempVec2.set(speed * Math.cos(angle), speed * Math.sin(angle)); + + Body.applyForce(this.body, { x: this.body.position.x, y: this.body.position.y }, this._tempVec2); + + return this; + }, + + /** + * Apply thrust to the right position of the body. + * + * Use very small values, such as 0.1, depending on the mass and required speed. + * + * @method Phaser.Physics.Matter.Components.Force#thrustRight + * @since 3.0.0 + * + * @param {number} speed - A speed value to be applied to a directional force. + * + * @return {this} This Game Object instance. + */ + thrustRight: function (speed) + { + var angle = this.body.angle + Math.PI / 2; + + this._tempVec2.set(speed * Math.cos(angle), speed * Math.sin(angle)); + + Body.applyForce(this.body, { x: this.body.position.x, y: this.body.position.y }, this._tempVec2); + + return this; + }, + + /** + * Apply thrust to the back position of the body. + * + * Use very small values, such as 0.1, depending on the mass and required speed. + * + * @method Phaser.Physics.Matter.Components.Force#thrustBack + * @since 3.0.0 + * + * @param {number} speed - A speed value to be applied to a directional force. + * + * @return {this} This Game Object instance. + */ + thrustBack: function (speed) + { + var angle = this.body.angle - Math.PI; + + this._tempVec2.set(speed * Math.cos(angle), speed * Math.sin(angle)); + + Body.applyForce(this.body, { x: this.body.position.x, y: this.body.position.y }, this._tempVec2); + + return this; + } + +}; + +module.exports = Force; + + +/***/ }), + +/***/ 74015: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Contains methods for changing the friction of a Game Object's Matter Body. Should be used a mixin, not called directly. + * + * @namespace Phaser.Physics.Matter.Components.Friction + * @since 3.0.0 + */ +var Friction = { + + /** + * Sets new friction values for this Game Object's Matter Body. + * + * @method Phaser.Physics.Matter.Components.Friction#setFriction + * @since 3.0.0 + * + * @param {number} value - The new friction of the body, between 0 and 1, where 0 allows the Body to slide indefinitely, while 1 allows it to stop almost immediately after a force is applied. + * @param {number} [air] - If provided, the new air resistance of the Body. The higher the value, the faster the Body will slow as it moves through space. 0 means the body has no air resistance. + * @param {number} [fstatic] - If provided, the new static friction of the Body. The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary. 0 means the body will never "stick" when it is nearly stationary. + * + * @return {this} This Game Object instance. + */ + setFriction: function (value, air, fstatic) + { + this.body.friction = value; + + if (air !== undefined) + { + this.body.frictionAir = air; + } + + if (fstatic !== undefined) + { + this.body.frictionStatic = fstatic; + } + + return this; + }, + + /** + * Sets a new air resistance for this Game Object's Matter Body. + * A value of 0 means the Body will never slow as it moves through space. + * The higher the value, the faster a Body slows when moving through space. + * + * @method Phaser.Physics.Matter.Components.Friction#setFrictionAir + * @since 3.0.0 + * + * @param {number} value - The new air resistance for the Body. + * + * @return {this} This Game Object instance. + */ + setFrictionAir: function (value) + { + this.body.frictionAir = value; + + return this; + }, + + /** + * Sets a new static friction for this Game Object's Matter Body. + * A value of 0 means the Body will never "stick" when it is nearly stationary. + * The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary. + * + * @method Phaser.Physics.Matter.Components.Friction#setFrictionStatic + * @since 3.0.0 + * + * @param {number} value - The new static friction for the Body. + * + * @return {this} This Game Object instance. + */ + setFrictionStatic: function (value) + { + this.body.frictionStatic = value; + + return this; + } + +}; + +module.exports = Friction; + + +/***/ }), + +/***/ 11535: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * A component to manipulate world gravity for Matter.js bodies. + * + * @namespace Phaser.Physics.Matter.Components.Gravity + * @since 3.0.0 + */ +var Gravity = { + + /** + * A togglable function for ignoring world gravity in real-time on the current body. + * + * @method Phaser.Physics.Matter.Components.Gravity#setIgnoreGravity + * @since 3.0.0 + * + * @param {boolean} value - Set to true to ignore the effect of world gravity, or false to not ignore it. + * + * @return {this} This Game Object instance. + */ + setIgnoreGravity: function (value) + { + this.body.ignoreGravity = value; + + return this; + } + +}; + +module.exports = Gravity; + + +/***/ }), + +/***/ 74497: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Body = __webpack_require__(84125); +var Vector2 = __webpack_require__(93736); + +/** + * Allows accessing the mass, density, and center of mass of a Matter-enabled Game Object. Should be used as a mixin and not directly. + * + * @namespace Phaser.Physics.Matter.Components.Mass + * @since 3.0.0 + */ +var Mass = { + + /** + * Sets the mass of the Game Object's Matter Body. + * + * @method Phaser.Physics.Matter.Components.Mass#setMass + * @since 3.0.0 + * + * @param {number} value - The new mass of the body. + * + * @return {this} This Game Object instance. + */ + setMass: function (value) + { + Body.setMass(this.body, value); + + return this; + }, + + /** + * Sets density of the body. + * + * @method Phaser.Physics.Matter.Components.Mass#setDensity + * @since 3.0.0 + * + * @param {number} value - The new density of the body. + * + * @return {this} This Game Object instance. + */ + setDensity: function (value) + { + Body.setDensity(this.body, value); + + return this; + }, + + /** + * The body's center of mass. + * + * Calling this creates a new `Vector2 each time to avoid mutation. + * + * If you only need to read the value and won't change it, you can get it from `GameObject.body.centerOfMass`. + * + * @name Phaser.Physics.Matter.Components.Mass#centerOfMass + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.10.0 + * + * @return {Phaser.Math.Vector2} The center of mass. + */ + centerOfMass: { + + get: function () + { + return new Vector2(this.body.centerOfMass.x, this.body.centerOfMass.y); + } + } + +}; + +module.exports = Mass; + + +/***/ }), + +/***/ 75529: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Enables a Matter-enabled Game Object to be a sensor. Should be used as a mixin and not directly. + * + * @namespace Phaser.Physics.Matter.Components.Sensor + * @since 3.0.0 + */ +var Sensor = { + + /** + * Set the body belonging to this Game Object to be a sensor. + * Sensors trigger collision events, but don't react with colliding body physically. + * + * @method Phaser.Physics.Matter.Components.Sensor#setSensor + * @since 3.0.0 + * + * @param {boolean} value - `true` to set the body as a sensor, or `false` to disable it. + * + * @return {this} This Game Object instance. + */ + setSensor: function (value) + { + this.body.isSensor = value; + + return this; + }, + + /** + * Is the body belonging to this Game Object a sensor or not? + * + * @method Phaser.Physics.Matter.Components.Sensor#isSensor + * @since 3.0.0 + * + * @return {boolean} `true` if the body is a sensor, otherwise `false`. + */ + isSensor: function () + { + return this.body.isSensor; + } + +}; + +module.exports = Sensor; + + +/***/ }), + +/***/ 64024: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Bodies = __webpack_require__(68516); +var Body = __webpack_require__(84125); +var FuzzyEquals = __webpack_require__(88456); +var GetFastValue = __webpack_require__(72632); +var PhysicsEditorParser = __webpack_require__(10998); +var PhysicsJSONParser = __webpack_require__(72829); +var Vertices = __webpack_require__(39745); + +/** + * Enables a Matter-enabled Game Object to set its Body. Should be used as a mixin and not directly. + * + * @namespace Phaser.Physics.Matter.Components.SetBody + * @since 3.0.0 + */ +var SetBody = { + + /** + * Set the body on a Game Object to a rectangle. + * + * Calling this methods resets previous properties you may have set on the body, including + * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed. + * + * @method Phaser.Physics.Matter.Components.SetBody#setRectangle + * @since 3.0.0 + * + * @param {number} width - Width of the rectangle. + * @param {number} height - Height of the rectangle. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {this} This Game Object instance. + */ + setRectangle: function (width, height, options) + { + return this.setBody({ type: 'rectangle', width: width, height: height }, options); + }, + + /** + * Set the body on a Game Object to a circle. + * + * Calling this methods resets previous properties you may have set on the body, including + * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed. + * + * @method Phaser.Physics.Matter.Components.SetBody#setCircle + * @since 3.0.0 + * + * @param {number} radius - The radius of the circle. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {this} This Game Object instance. + */ + setCircle: function (radius, options) + { + return this.setBody({ type: 'circle', radius: radius }, options); + }, + + /** + * Set the body on the Game Object to a polygon shape. + * + * Calling this methods resets previous properties you may have set on the body, including + * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed. + * + * @method Phaser.Physics.Matter.Components.SetBody#setPolygon + * @since 3.0.0 + * + * @param {number} radius - The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle. + * @param {number} sides - The number of sides the polygon will have. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {this} This Game Object instance. + */ + setPolygon: function (radius, sides, options) + { + return this.setBody({ type: 'polygon', sides: sides, radius: radius }, options); + }, + + /** + * Set the body on the Game Object to a trapezoid shape. + * + * Calling this methods resets previous properties you may have set on the body, including + * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed. + * + * @method Phaser.Physics.Matter.Components.SetBody#setTrapezoid + * @since 3.0.0 + * + * @param {number} width - The width of the trapezoid Body. + * @param {number} height - The height of the trapezoid Body. + * @param {number} slope - The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {this} This Game Object instance. + */ + setTrapezoid: function (width, height, slope, options) + { + return this.setBody({ type: 'trapezoid', width: width, height: height, slope: slope }, options); + }, + + /** + * Set this Game Object to use the given existing Matter Body. + * + * The body is first removed from the world before being added to this Game Object. + * + * @method Phaser.Physics.Matter.Components.SetBody#setExistingBody + * @since 3.0.0 + * + * @param {MatterJS.BodyType} body - The Body this Game Object should use. + * @param {boolean} [addToWorld=true] - Should the body be immediately added to the World? + * + * @return {this} This Game Object instance. + */ + setExistingBody: function (body, addToWorld) + { + if (addToWorld === undefined) { addToWorld = true; } + + if (this.body) + { + this.world.remove(this.body, true); + } + + this.body = body; + + for (var i = 0; i < body.parts.length; i++) + { + body.parts[i].gameObject = this; + } + + var _this = this; + + body.destroy = function destroy () + { + _this.world.remove(_this.body, true); + _this.body.gameObject = null; + }; + + if (addToWorld) + { + if (this.world.has(body)) + { + // Because it could be part of another Composite + this.world.remove(body, true); + } + + this.world.add(body); + } + + if (this._originComponent) + { + var rx = body.render.sprite.xOffset; + var ry = body.render.sprite.yOffset; + + var comx = body.centerOfMass.x; + var comy = body.centerOfMass.y; + + if (FuzzyEquals(comx, 0.5) && FuzzyEquals(comy, 0.5)) + { + this.setOrigin(rx + 0.5, ry + 0.5); + } + else + { + var cx = body.centerOffset.x; + var cy = body.centerOffset.y; + + this.setOrigin(rx + (cx / this.displayWidth), ry + (cy / this.displayHeight)); + } + } + + return this; + }, + + /** + * Set this Game Object to create and use a new Body based on the configuration object given. + * + * Calling this method resets previous properties you may have set on the body, including + * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed. + * + * @method Phaser.Physics.Matter.Components.SetBody#setBody + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Physics.Matter.MatterSetBodyConfig)} config - Either a string, such as `circle`, or a Matter Set Body Configuration object. + * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * + * @return {this} This Game Object instance. + */ + setBody: function (config, options) + { + if (!config) + { + return this; + } + + var body; + + // Allow them to do: shape: 'circle' instead of shape: { type: 'circle' } + if (typeof config === 'string') + { + // Using defaults + config = { type: config }; + } + + var shapeType = GetFastValue(config, 'type', 'rectangle'); + var bodyX = GetFastValue(config, 'x', this._tempVec2.x); + var bodyY = GetFastValue(config, 'y', this._tempVec2.y); + var bodyWidth = GetFastValue(config, 'width', this.width); + var bodyHeight = GetFastValue(config, 'height', this.height); + + switch (shapeType) + { + case 'rectangle': + body = Bodies.rectangle(bodyX, bodyY, bodyWidth, bodyHeight, options); + break; + + case 'circle': + var radius = GetFastValue(config, 'radius', Math.max(bodyWidth, bodyHeight) / 2); + var maxSides = GetFastValue(config, 'maxSides', 25); + body = Bodies.circle(bodyX, bodyY, radius, options, maxSides); + break; + + case 'trapezoid': + var slope = GetFastValue(config, 'slope', 0.5); + body = Bodies.trapezoid(bodyX, bodyY, bodyWidth, bodyHeight, slope, options); + break; + + case 'polygon': + var sides = GetFastValue(config, 'sides', 5); + var pRadius = GetFastValue(config, 'radius', Math.max(bodyWidth, bodyHeight) / 2); + body = Bodies.polygon(bodyX, bodyY, sides, pRadius, options); + break; + + case 'fromVertices': + case 'fromVerts': + + var verts = GetFastValue(config, 'verts', null); + + if (verts) + { + // Has the verts array come from Vertices.fromPath, or is it raw? + if (typeof verts === 'string') + { + verts = Vertices.fromPath(verts); + } + + if (this.body && !this.body.hasOwnProperty('temp')) + { + Body.setVertices(this.body, verts); + + body = this.body; + } + else + { + var flagInternal = GetFastValue(config, 'flagInternal', false); + var removeCollinear = GetFastValue(config, 'removeCollinear', 0.01); + var minimumArea = GetFastValue(config, 'minimumArea', 10); + + body = Bodies.fromVertices(bodyX, bodyY, verts, options, flagInternal, removeCollinear, minimumArea); + } + } + + break; + + case 'fromPhysicsEditor': + body = PhysicsEditorParser.parseBody(bodyX, bodyY, config, options); + break; + + case 'fromPhysicsTracer': + body = PhysicsJSONParser.parseBody(bodyX, bodyY, config, options); + break; + } + + if (body) + { + this.setExistingBody(body, config.addToWorld); + } + + return this; + } + +}; + +module.exports = SetBody; + + +/***/ }), + +/***/ 25106: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Events = __webpack_require__(35416); +var Sleeping = __webpack_require__(22806); +var MatterEvents = __webpack_require__(39073); + +/** + * Enables a Matter-enabled Game Object to be able to go to sleep. Should be used as a mixin and not directly. + * + * @namespace Phaser.Physics.Matter.Components.Sleep + * @since 3.0.0 + */ +var Sleep = { + + /** + * Sets this Body to sleep. + * + * @method Phaser.Physics.Matter.Components.Sleep#setToSleep + * @since 3.22.0 + * + * @return {this} This Game Object instance. + */ + setToSleep: function () + { + Sleeping.set(this.body, true); + + return this; + }, + + /** + * Wakes this Body if asleep. + * + * @method Phaser.Physics.Matter.Components.Sleep#setAwake + * @since 3.22.0 + * + * @return {this} This Game Object instance. + */ + setAwake: function () + { + Sleeping.set(this.body, false); + + return this; + }, + + /** + * Sets the number of updates in which this body must have near-zero velocity before it is set as sleeping (if sleeping is enabled by the engine). + * + * @method Phaser.Physics.Matter.Components.Sleep#setSleepThreshold + * @since 3.0.0 + * + * @param {number} [value=60] - A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping. + * + * @return {this} This Game Object instance. + */ + setSleepThreshold: function (value) + { + if (value === undefined) { value = 60; } + + this.body.sleepThreshold = value; + + return this; + }, + + /** + * Enable sleep and wake events for this body. + * + * By default when a body goes to sleep, or wakes up, it will not emit any events. + * + * The events are emitted by the Matter World instance and can be listened to via + * the `SLEEP_START` and `SLEEP_END` events. + * + * @method Phaser.Physics.Matter.Components.Sleep#setSleepEvents + * @since 3.0.0 + * + * @param {boolean} start - `true` if you want the sleep start event to be emitted for this body. + * @param {boolean} end - `true` if you want the sleep end event to be emitted for this body. + * + * @return {this} This Game Object instance. + */ + setSleepEvents: function (start, end) + { + this.setSleepStartEvent(start); + this.setSleepEndEvent(end); + + return this; + }, + + /** + * Enables or disables the Sleep Start event for this body. + * + * @method Phaser.Physics.Matter.Components.Sleep#setSleepStartEvent + * @since 3.0.0 + * + * @param {boolean} value - `true` to enable the sleep event, or `false` to disable it. + * + * @return {this} This Game Object instance. + */ + setSleepStartEvent: function (value) + { + if (value) + { + var world = this.world; + + MatterEvents.on(this.body, 'sleepStart', function (event) + { + world.emit(Events.SLEEP_START, event, this); + }); + } + else + { + MatterEvents.off(this.body, 'sleepStart'); + } + + return this; + }, + + /** + * Enables or disables the Sleep End event for this body. + * + * @method Phaser.Physics.Matter.Components.Sleep#setSleepEndEvent + * @since 3.0.0 + * + * @param {boolean} value - `true` to enable the sleep event, or `false` to disable it. + * + * @return {this} This Game Object instance. + */ + setSleepEndEvent: function (value) + { + if (value) + { + var world = this.world; + + MatterEvents.on(this.body, 'sleepEnd', function (event) + { + world.emit(Events.SLEEP_END, event, this); + }); + } + else + { + MatterEvents.off(this.body, 'sleepEnd'); + } + + return this; + } + +}; + +module.exports = Sleep; + + +/***/ }), + +/***/ 82884: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Body = __webpack_require__(84125); + +/** + * Provides methods used for getting and setting the static state of a physics body. + * + * @namespace Phaser.Physics.Matter.Components.Static + * @since 3.0.0 + */ +var Static = { + + /** + * Changes the physics body to be either static `true` or dynamic `false`. + * + * @method Phaser.Physics.Matter.Components.Static#setStatic + * @since 3.0.0 + * + * @param {boolean} value - `true` to set the body as being static, or `false` to make it dynamic. + * + * @return {this} This Game Object instance. + */ + setStatic: function (value) + { + Body.setStatic(this.body, value); + + return this; + }, + + /** + * Returns `true` if the body is static, otherwise `false` for a dynamic body. + * + * @method Phaser.Physics.Matter.Components.Static#isStatic + * @since 3.0.0 + * + * @return {boolean} `true` if the body is static, otherwise `false`. + */ + isStatic: function () + { + return this.body.isStatic; + } + +}; + +module.exports = Static; + + +/***/ }), + +/***/ 4753: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Body = __webpack_require__(84125); +var MATH_CONST = __webpack_require__(83392); +var WrapAngle = __webpack_require__(35786); +var WrapAngleDegrees = __webpack_require__(62138); + +// global bitmask flag for GameObject.renderMask (used by Scale) +var _FLAG = 4; // 0100 + +// Transform Component + +/** + * Provides methods used for getting and setting the position, scale and rotation of a Game Object. + * + * @namespace Phaser.Physics.Matter.Components.Transform + * @since 3.0.0 + */ +var Transform = { + + /** + * The x position of this Game Object. + * + * @name Phaser.Physics.Matter.Components.Transform#x + * @type {number} + * @since 3.0.0 + */ + x: { + + get: function () + { + return this.body.position.x; + }, + + set: function (value) + { + this._tempVec2.set(value, this.y); + + Body.setPosition(this.body, this._tempVec2); + } + + }, + + /** + * The y position of this Game Object. + * + * @name Phaser.Physics.Matter.Components.Transform#y + * @type {number} + * @since 3.0.0 + */ + y: { + + get: function () + { + return this.body.position.y; + }, + + set: function (value) + { + this._tempVec2.set(this.x, value); + + Body.setPosition(this.body, this._tempVec2); + } + + }, + + /** + * The horizontal scale of this Game Object. + * + * @name Phaser.Physics.Matter.Components.Transform#scaleX + * @type {number} + * @since 3.0.0 + */ + scaleX: { + + get: function () + { + return this._scaleX; + }, + + set: function (value) + { + var factorX = 1 / this._scaleX; + var factorY = 1 / this._scaleY; + + this._scaleX = value; + + if (this._scaleX === 0) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } + + // Reset Matter scale back to 1 (sigh) + Body.scale(this.body, factorX, factorY); + + Body.scale(this.body, value, this._scaleY); + } + + }, + + /** + * The vertical scale of this Game Object. + * + * @name Phaser.Physics.Matter.Components.Transform#scaleY + * @type {number} + * @since 3.0.0 + */ + scaleY: { + + get: function () + { + return this._scaleY; + }, + + set: function (value) + { + var factorX = 1 / this._scaleX; + var factorY = 1 / this._scaleY; + + this._scaleY = value; + + if (this._scaleY === 0) + { + this.renderFlags &= ~_FLAG; + } + else + { + this.renderFlags |= _FLAG; + } + + Body.scale(this.body, factorX, factorY); + + Body.scale(this.body, this._scaleX, value); + } + + }, + + /** + * Use `angle` to set or get rotation of the physics body associated to this GameObject. + * Unlike rotation, when using set the value can be in degrees, which will be converted to radians internally. + * + * @name Phaser.Physics.Matter.Components.Transform#angle + * @type {number} + * @since 3.0.0 + */ + angle: { + + get: function () + { + return WrapAngleDegrees(this.body.angle * MATH_CONST.RAD_TO_DEG); + }, + + set: function (value) + { + // value is in degrees + this.rotation = WrapAngleDegrees(value) * MATH_CONST.DEG_TO_RAD; + } + }, + + /** + * Use `rotation` to set or get the rotation of the physics body associated with this GameObject. + * The value when set must be in radians. + * + * @name Phaser.Physics.Matter.Components.Transform#rotation + * @type {number} + * @since 3.0.0 + */ + rotation: { + + get: function () + { + return this.body.angle; + }, + + set: function (value) + { + // value is in radians + this._rotation = WrapAngle(value); + + Body.setAngle(this.body, this._rotation); + } + }, + + /** + * Sets the position of the physics body along x and y axes. + * Both the parameters to this function are optional and if not passed any they default to 0. + * Velocity, angle, force etc. are unchanged. + * + * @method Phaser.Physics.Matter.Components.Transform#setPosition + * @since 3.0.0 + * + * @param {number} [x=0] - The horizontal position of the body. + * @param {number} [y=x] - The vertical position of the body. + * + * @return {this} This Game Object instance. + */ + setPosition: function (x, y) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = x; } + + this._tempVec2.set(x, y); + + Body.setPosition(this.body, this._tempVec2); + + return this; + }, + + /** + * Immediately sets the angle of the Body. + * Angular velocity, position, force etc. are unchanged. + * + * @method Phaser.Physics.Matter.Components.Transform#setRotation + * @since 3.0.0 + * + * @param {number} [radians=0] - The angle of the body, in radians. + * + * @return {this} This Game Object instance. + */ + setRotation: function (radians) + { + if (radians === undefined) { radians = 0; } + + this._rotation = WrapAngle(radians); + + Body.setAngle(this.body, radians); + + return this; + }, + + /** + * Setting fixed rotation sets the Body inertia to Infinity, which stops it + * from being able to rotate when forces are applied to it. + * + * @method Phaser.Physics.Matter.Components.Transform#setFixedRotation + * @since 3.0.0 + * + * @return {this} This Game Object instance. + */ + setFixedRotation: function () + { + Body.setInertia(this.body, Infinity); + + return this; + }, + + /** + * Immediately sets the angle of the Body. + * Angular velocity, position, force etc. are unchanged. + * + * @method Phaser.Physics.Matter.Components.Transform#setAngle + * @since 3.0.0 + * + * @param {number} [degrees=0] - The angle to set, in degrees. + * + * @return {this} This Game Object instance. + */ + setAngle: function (degrees) + { + if (degrees === undefined) { degrees = 0; } + + this.angle = degrees; + + Body.setAngle(this.body, this.rotation); + + return this; + }, + + /** + * Sets the scale of this Game Object. + * + * @method Phaser.Physics.Matter.Components.Transform#setScale + * @since 3.0.0 + * + * @param {number} [x=1] - The horizontal scale of this Game Object. + * @param {number} [y=x] - The vertical scale of this Game Object. If not set it will use the x value. + * @param {Phaser.Math.Vector2} [point] - The point (Vector2) from which scaling will occur. + * + * @return {this} This Game Object instance. + */ + setScale: function (x, y, point) + { + if (x === undefined) { x = 1; } + if (y === undefined) { y = x; } + + var factorX = 1 / this._scaleX; + var factorY = 1 / this._scaleY; + + this._scaleX = x; + this._scaleY = y; + + Body.scale(this.body, factorX, factorY, point); + + Body.scale(this.body, x, y, point); + + return this; + } + +}; + +module.exports = Transform; + + +/***/ }), + +/***/ 37268: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Body = __webpack_require__(84125); + +/** + * Contains methods for changing the velocity of a Matter Body. Should be used as a mixin and not called directly. + * + * @namespace Phaser.Physics.Matter.Components.Velocity + * @since 3.0.0 + */ +var Velocity = { + + /** + * Sets the horizontal velocity of the physics body. + * + * @method Phaser.Physics.Matter.Components.Velocity#setVelocityX + * @since 3.0.0 + * + * @param {number} x - The horizontal velocity value. + * + * @return {this} This Game Object instance. + */ + setVelocityX: function (x) + { + this._tempVec2.set(x, this.body.velocity.y); + + Body.setVelocity(this.body, this._tempVec2); + + return this; + }, + + /** + * Sets vertical velocity of the physics body. + * + * @method Phaser.Physics.Matter.Components.Velocity#setVelocityY + * @since 3.0.0 + * + * @param {number} y - The vertical velocity value. + * + * @return {this} This Game Object instance. + */ + setVelocityY: function (y) + { + this._tempVec2.set(this.body.velocity.x, y); + + Body.setVelocity(this.body, this._tempVec2); + + return this; + }, + + /** + * Sets both the horizontal and vertical velocity of the physics body. + * + * @method Phaser.Physics.Matter.Components.Velocity#setVelocity + * @since 3.0.0 + * + * @param {number} x - The horizontal velocity value. + * @param {number} [y=x] - The vertical velocity value, it can be either positive or negative. If not given, it will be the same as the `x` value. + * + * @return {this} This Game Object instance. + */ + setVelocity: function (x, y) + { + this._tempVec2.set(x, y); + + Body.setVelocity(this.body, this._tempVec2); + + return this; + }, + + /** + * Gets the current linear velocity of the physics body. + * + * @method Phaser.Physics.Matter.Components.Velocity#getVelocity + * @since 3.60.0 + * + * @return {Phaser.Types.Math.Vector2Like} The current linear velocity of the body. + */ + getVelocity: function () + { + return Body.getVelocity(this.body); + }, + + /** + * Sets the angular velocity of the body instantly. + * Position, angle, force etc. are unchanged. + * + * @method Phaser.Physics.Matter.Components.Velocity#setAngularVelocity + * @since 3.0.0 + * + * @param {number} velocity - The angular velocity. + * + * @return {this} This Game Object instance. + */ + setAngularVelocity: function (velocity) + { + Body.setAngularVelocity(this.body, velocity); + + return this; + }, + + /** + * Gets the current rotational velocity of the body. + * + * @method Phaser.Physics.Matter.Components.Velocity#getAngularVelocity + * @since 3.60.0 + * + * @return {number} The current angular velocity of the body. + */ + getAngularVelocity: function () + { + return Body.getAngularVelocity(this.body); + }, + + /** + * Sets the current rotational speed of the body. + * Direction is maintained. Affects body angular velocity. + * + * @method Phaser.Physics.Matter.Components.Velocity#setAngularSpeed + * @since 3.60.0 + * + * @param {number} speed - The angular speed. + * + * @return {this} This Game Object instance. + */ + setAngularSpeed: function (speed) + { + Body.setAngularSpeed(this.body, speed); + + return this; + }, + + /** + * Gets the current rotational speed of the body. + * Equivalent to the magnitude of its angular velocity. + * + * @method Phaser.Physics.Matter.Components.Velocity#getAngularSpeed + * @since 3.60.0 + * + * @return {number} The current angular velocity of the body. + */ + getAngularSpeed: function () + { + return Body.getAngularSpeed(this.body); + } + +}; + +module.exports = Velocity; + + +/***/ }), + +/***/ 74527: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Physics.Matter.Components + */ + +module.exports = { + + Bounce: __webpack_require__(95349), + Collision: __webpack_require__(70679), + Force: __webpack_require__(77178), + Friction: __webpack_require__(74015), + Gravity: __webpack_require__(11535), + Mass: __webpack_require__(74497), + Sensor: __webpack_require__(75529), + SetBody: __webpack_require__(64024), + Sleep: __webpack_require__(25106), + Static: __webpack_require__(82884), + Transform: __webpack_require__(4753), + Velocity: __webpack_require__(37268) + +}; + + +/***/ }), + +/***/ 63201: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.AfterAddEvent + * + * @property {any[]} object - An array of the object(s) that have been added. May be a single body, constraint, composite or a mixture of these. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics After Add Event. + * + * This event is dispatched by a Matter Physics World instance at the end of the process when a new Body + * or Constraint has just been added to the world. + * + * Listen to it from a Scene using: `this.matter.world.on('afteradd', listener)`. + * + * @event Phaser.Physics.Matter.Events#AFTER_ADD + * @type {string} + * @since 3.22.0 + * + * @param {Phaser.Physics.Matter.Events.AfterAddEvent} event - The Add Event object. + */ +module.exports = 'afteradd'; + + +/***/ }), + +/***/ 30474: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.AfterRemoveEvent + * + * @property {any[]} object - An array of the object(s) that were removed. May be a single body, constraint, composite or a mixture of these. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics After Remove Event. + * + * This event is dispatched by a Matter Physics World instance at the end of the process when a + * Body or Constraint was removed from the world. + * + * Listen to it from a Scene using: `this.matter.world.on('afterremove', listener)`. + * + * @event Phaser.Physics.Matter.Events#AFTER_REMOVE + * @type {string} + * @since 3.22.0 + * + * @param {Phaser.Physics.Matter.Events.AfterRemoveEvent} event - The Remove Event object. + */ +module.exports = 'afterremove'; + + +/***/ }), + +/***/ 44822: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.AfterUpdateEvent + * + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics After Update Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated and all collision events have resolved. + * + * Listen to it from a Scene using: `this.matter.world.on('afterupdate', listener)`. + * + * @event Phaser.Physics.Matter.Events#AFTER_UPDATE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.AfterUpdateEvent} event - The Update Event object. + */ +module.exports = 'afterupdate'; + + +/***/ }), + +/***/ 88820: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.BeforeAddEvent + * + * @property {any[]} object - An array of the object(s) to be added. May be a single body, constraint, composite or a mixture of these. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Before Add Event. + * + * This event is dispatched by a Matter Physics World instance at the start of the process when a new Body + * or Constraint is being added to the world. + * + * Listen to it from a Scene using: `this.matter.world.on('beforeadd', listener)`. + * + * @event Phaser.Physics.Matter.Events#BEFORE_ADD + * @type {string} + * @since 3.22.0 + * + * @param {Phaser.Physics.Matter.Events.BeforeAddEvent} event - The Add Event object. + */ +module.exports = 'beforeadd'; + + +/***/ }), + +/***/ 94849: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.BeforeRemoveEvent + * + * @property {any[]} object - An array of the object(s) to be removed. May be a single body, constraint, composite or a mixture of these. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Before Remove Event. + * + * This event is dispatched by a Matter Physics World instance at the start of the process when a + * Body or Constraint is being removed from the world. + * + * Listen to it from a Scene using: `this.matter.world.on('beforeremove', listener)`. + * + * @event Phaser.Physics.Matter.Events#BEFORE_REMOVE + * @type {string} + * @since 3.22.0 + * + * @param {Phaser.Physics.Matter.Events.BeforeRemoveEvent} event - The Remove Event object. + */ +module.exports = 'beforeremove'; + + +/***/ }), + +/***/ 6391: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.BeforeUpdateEvent + * + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Before Update Event. + * + * This event is dispatched by a Matter Physics World instance right before all the collision processing takes place. + * + * Listen to it from a Scene using: `this.matter.world.on('beforeupdate', listener)`. + * + * @event Phaser.Physics.Matter.Events#BEFORE_UPDATE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.BeforeUpdateEvent} event - The Update Event object. + */ +module.exports = 'beforeupdate'; + + +/***/ }), + +/***/ 96738: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.CollisionActiveEvent + * + * @property {Phaser.Types.Physics.Matter.MatterCollisionData[]} pairs - A list of all affected pairs in the collision. + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Collision Active Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated. + * It provides a list of all pairs that are colliding in the current tick (if any). + * + * Listen to it from a Scene using: `this.matter.world.on('collisionactive', listener)`. + * + * @event Phaser.Physics.Matter.Events#COLLISION_ACTIVE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.CollisionActiveEvent} event - The Collision Event object. + * @param {MatterJS.BodyType} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {MatterJS.BodyType} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + */ +module.exports = 'collisionactive'; + + +/***/ }), + +/***/ 7916: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.CollisionEndEvent + * + * @property {Phaser.Types.Physics.Matter.MatterCollisionData[]} pairs - A list of all affected pairs in the collision. + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Collision End Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated. + * It provides a list of all pairs that have finished colliding in the current tick (if any). + * + * Listen to it from a Scene using: `this.matter.world.on('collisionend', listener)`. + * + * @event Phaser.Physics.Matter.Events#COLLISION_END + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.CollisionEndEvent} event - The Collision Event object. + * @param {MatterJS.BodyType} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {MatterJS.BodyType} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + */ +module.exports = 'collisionend'; + + +/***/ }), + +/***/ 59529: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.CollisionStartEvent + * + * @property {Phaser.Types.Physics.Matter.MatterCollisionData[]} pairs - A list of all affected pairs in the collision. + * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Collision Start Event. + * + * This event is dispatched by a Matter Physics World instance after the engine has updated. + * It provides a list of all pairs that have started to collide in the current tick (if any). + * + * Listen to it from a Scene using: `this.matter.world.on('collisionstart', listener)`. + * + * @event Phaser.Physics.Matter.Events#COLLISION_START + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.CollisionStartEvent} event - The Collision Event object. + * @param {MatterJS.BodyType} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {MatterJS.BodyType} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + */ +module.exports = 'collisionstart'; + + +/***/ }), + +/***/ 10219: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Matter Physics Drag End Event. + * + * This event is dispatched by a Matter Physics World instance when a Pointer Constraint + * stops dragging a body. + * + * Listen to it from a Scene using: `this.matter.world.on('dragend', listener)`. + * + * @event Phaser.Physics.Matter.Events#DRAG_END + * @type {string} + * @since 3.16.2 + * + * @param {MatterJS.BodyType} body - The Body that has stopped being dragged. This is a Matter Body, not a Phaser Game Object. + * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that was dragging the body. + */ +module.exports = 'dragend'; + + +/***/ }), + +/***/ 183: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Matter Physics Drag Event. + * + * This event is dispatched by a Matter Physics World instance when a Pointer Constraint + * is actively dragging a body. It is emitted each time the pointer moves. + * + * Listen to it from a Scene using: `this.matter.world.on('drag', listener)`. + * + * @event Phaser.Physics.Matter.Events#DRAG + * @type {string} + * @since 3.16.2 + * + * @param {MatterJS.BodyType} body - The Body that is being dragged. This is a Matter Body, not a Phaser Game Object. + * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that is dragging the body. + */ +module.exports = 'drag'; + + +/***/ }), + +/***/ 39143: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Matter Physics Drag Start Event. + * + * This event is dispatched by a Matter Physics World instance when a Pointer Constraint + * starts dragging a body. + * + * Listen to it from a Scene using: `this.matter.world.on('dragstart', listener)`. + * + * @event Phaser.Physics.Matter.Events#DRAG_START + * @type {string} + * @since 3.16.2 + * + * @param {MatterJS.BodyType} body - The Body that has started being dragged. This is a Matter Body, not a Phaser Game Object. + * @param {MatterJS.BodyType} part - The part of the body that was clicked on. + * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that is dragging the body. + */ +module.exports = 'dragstart'; + + +/***/ }), + +/***/ 16483: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Matter Physics World Pause Event. + * + * This event is dispatched by an Matter Physics World instance when it is paused. + * + * Listen to it from a Scene using: `this.matter.world.on('pause', listener)`. + * + * @event Phaser.Physics.Matter.Events#PAUSE + * @type {string} + * @since 3.0.0 + */ +module.exports = 'pause'; + + +/***/ }), + +/***/ 35806: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Matter Physics World Resume Event. + * + * This event is dispatched by an Matter Physics World instance when it resumes from a paused state. + * + * Listen to it from a Scene using: `this.matter.world.on('resume', listener)`. + * + * @event Phaser.Physics.Matter.Events#RESUME + * @type {string} + * @since 3.0.0 + */ +module.exports = 'resume'; + + +/***/ }), + +/***/ 22106: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.SleepEndEvent + * + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Sleep End Event. + * + * This event is dispatched by a Matter Physics World instance when a Body stop sleeping. + * + * Listen to it from a Scene using: `this.matter.world.on('sleepend', listener)`. + * + * @event Phaser.Physics.Matter.Events#SLEEP_END + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.SleepEndEvent} event - The Sleep Event object. + * @param {MatterJS.BodyType} body - The body that has stopped sleeping. + */ +module.exports = 'sleepend'; + + +/***/ }), + +/***/ 5803: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @typedef {object} Phaser.Physics.Matter.Events.SleepStartEvent + * + * @property {any} source - The source object of the event. + * @property {string} name - The name of the event. + */ + +/** + * The Matter Physics Sleep Start Event. + * + * This event is dispatched by a Matter Physics World instance when a Body goes to sleep. + * + * Listen to it from a Scene using: `this.matter.world.on('sleepstart', listener)`. + * + * @event Phaser.Physics.Matter.Events#SLEEP_START + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Physics.Matter.Events.SleepStartEvent} event - The Sleep Event object. + * @param {MatterJS.BodyType} body - The body that has gone to sleep. + */ +module.exports = 'sleepstart'; + + +/***/ }), + +/***/ 35416: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Physics.Matter.Events + */ + +module.exports = { + + AFTER_ADD: __webpack_require__(63201), + AFTER_REMOVE: __webpack_require__(30474), + AFTER_UPDATE: __webpack_require__(44822), + BEFORE_ADD: __webpack_require__(88820), + BEFORE_REMOVE: __webpack_require__(94849), + BEFORE_UPDATE: __webpack_require__(6391), + COLLISION_ACTIVE: __webpack_require__(96738), + COLLISION_END: __webpack_require__(7916), + COLLISION_START: __webpack_require__(59529), + DRAG_END: __webpack_require__(10219), + DRAG: __webpack_require__(183), + DRAG_START: __webpack_require__(39143), + PAUSE: __webpack_require__(16483), + RESUME: __webpack_require__(35806), + SLEEP_END: __webpack_require__(22106), + SLEEP_START: __webpack_require__(5803) + +}; + + +/***/ }), + +/***/ 45949: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Physics.Matter + */ + +module.exports = { + + BodyBounds: __webpack_require__(63568), + Components: __webpack_require__(74527), + Events: __webpack_require__(35416), + Factory: __webpack_require__(72653), + MatterGameObject: __webpack_require__(3860), + Image: __webpack_require__(7030), + Matter: __webpack_require__(18171), + MatterPhysics: __webpack_require__(50583), + PolyDecomp: __webpack_require__(81084), + Sprite: __webpack_require__(73658), + TileBody: __webpack_require__(84720), + PhysicsEditorParser: __webpack_require__(10998), + PhysicsJSONParser: __webpack_require__(72829), + PointerConstraint: __webpack_require__(88596), + World: __webpack_require__(31468) + +}; + + +/***/ }), + +/***/ 84125: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * The `Matter.Body` module contains methods for creating and manipulating body models. + * A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`. + * Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module `Matter.Bodies`. + * + * See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). + * @class Body + */ + +var Body = {}; + +module.exports = Body; + +var Vertices = __webpack_require__(39745); +var Vector = __webpack_require__(10438); +var Sleeping = __webpack_require__(22806); +var Common = __webpack_require__(68758); +var Bounds = __webpack_require__(84091); +var Axes = __webpack_require__(50658); + +(function() { + + Body._timeCorrection = true; + Body._inertiaScale = 4; + Body._nextCollidingGroupId = 1; + Body._nextNonCollidingGroupId = -1; + Body._nextCategory = 0x0001; + Body._baseDelta = 1000 / 60; + + /** + * Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * Vertices must be specified in clockwise order. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {} options + * @return {body} body + */ + Body.create = function(options) { + var defaults = { + id: Common.nextId(), + type: 'body', + label: 'Body', + parts: [], + plugin: {}, + angle: 0, + vertices: null, // Phaser change: no point calling fromPath if they pass in vertices anyway + position: { x: 0, y: 0 }, + force: { x: 0, y: 0 }, + torque: 0, + positionImpulse: { x: 0, y: 0 }, + constraintImpulse: { x: 0, y: 0, angle: 0 }, + totalContacts: 0, + speed: 0, + angularSpeed: 0, + velocity: { x: 0, y: 0 }, + angularVelocity: 0, + isSensor: false, + isStatic: false, + isSleeping: false, + motion: 0, + sleepThreshold: 60, + density: 0.001, + restitution: 0, + friction: 0.1, + frictionStatic: 0.5, + frictionAir: 0.01, + collisionFilter: { + category: 0x0001, + mask: 0xFFFFFFFF, + group: 0 + }, + slop: 0.05, + timeScale: 1, + events: null, + bounds: null, + chamfer: null, + circleRadius: 0, + positionPrev: null, + anglePrev: 0, + parent: null, + axes: null, + area: 0, + mass: 0, + inverseMass: 0, + inertia: 0, + deltaTime: 1000 / 60, + inverseInertia: 0, + _original: null, + render: { + visible: true, + opacity: 1, + sprite: { + xOffset: 0, + yOffset: 0 + }, + fillColor: null, // custom Phaser property + fillOpacity: null, // custom Phaser property + lineColor: null, // custom Phaser property + lineOpacity: null, // custom Phaser property + lineThickness: null // custom Phaser property + }, + gameObject: null, // custom Phaser property + scale: { x: 1, y: 1 }, // custom Phaser property + centerOfMass: { x: 0, y: 0 }, // custom Phaser property (float, 0 - 1) + centerOffset: { x: 0, y: 0 }, // custom Phaser property (pixel values) + gravityScale: { x: 1, y: 1 }, // custom Phaser property + ignoreGravity: false, // custom Phaser property + ignorePointer: false, // custom Phaser property + onCollideCallback: null, // custom Phaser property + onCollideEndCallback: null, // custom Phaser property + onCollideActiveCallback: null, // custom Phaser property + onCollideWith: {} // custom Phaser property + }; + + if (!options.hasOwnProperty('position') && options.hasOwnProperty('vertices')) + { + options.position = Vertices.centre(options.vertices); + } + else if (!options.hasOwnProperty('vertices')) + { + defaults.vertices = Vertices.fromPath('L 0 0 L 40 0 L 40 40 L 0 40'); + } + + var body = Common.extend(defaults, options); + + _initProperties(body, options); + + // Helper function + body.setOnCollideWith = function (body, callback) + { + if (callback) + { + this.onCollideWith[body.id] = callback; + } + else + { + delete this.onCollideWith[body.id]; + } + + return this; + } + + return body; + }; + + /** + * Returns the next unique group index for which bodies will collide. + * If `isNonColliding` is `true`, returns the next unique group index for which bodies will _not_ collide. + * See `body.collisionFilter` for more information. + * @method nextGroup + * @param {bool} [isNonColliding=false] + * @return {Number} Unique group index + */ + Body.nextGroup = function(isNonColliding) { + if (isNonColliding) + return Body._nextNonCollidingGroupId--; + + return Body._nextCollidingGroupId++; + }; + + /** + * Returns the next unique category bitfield (starting after the initial default category `0x0001`). + * There are 32 available. See `body.collisionFilter` for more information. + * @method nextCategory + * @return {Number} Unique category bitfield + */ + Body.nextCategory = function() { + Body._nextCategory = Body._nextCategory << 1; + return Body._nextCategory; + }; + + /** + * Initialises body properties. + * @method _initProperties + * @private + * @param {body} body + * @param {} [options] + */ + var _initProperties = function(body, options) { + options = options || {}; + + // init required properties (order is important) + Body.set(body, { + bounds: body.bounds || Bounds.create(body.vertices), + positionPrev: body.positionPrev || Vector.clone(body.position), + anglePrev: body.anglePrev || body.angle, + vertices: body.vertices, + parts: body.parts || [body], + isStatic: body.isStatic, + isSleeping: body.isSleeping, + parent: body.parent || body + }); + + Vertices.rotate(body.vertices, body.angle, body.position); + Axes.rotate(body.axes, body.angle); + Bounds.update(body.bounds, body.vertices, body.velocity); + + // allow options to override the automatically calculated properties + Body.set(body, { + axes: options.axes || body.axes, + area: options.area || body.area, + mass: options.mass || body.mass, + inertia: options.inertia || body.inertia + }); + + if (body.parts.length === 1) + { + var bounds = body.bounds; + + var centerOfMass = body.centerOfMass; + var centerOffset = body.centerOffset; + + var bodyWidth = bounds.max.x - bounds.min.x; + var bodyHeight = bounds.max.y - bounds.min.y; + + centerOfMass.x = -(bounds.min.x - body.position.x) / bodyWidth; + centerOfMass.y = -(bounds.min.y - body.position.y) / bodyHeight; + + centerOffset.x = bodyWidth * centerOfMass.x; + centerOffset.y = bodyHeight * centerOfMass.y; + } + + // From Matter render code: + // body.render.sprite.xOffset += -(body.bounds.min.x - body.position.x) / (body.bounds.max.x - body.bounds.min.x); + // body.render.sprite.yOffset += -(body.bounds.min.y - body.position.y) / (body.bounds.max.y - body.bounds.min.y); + }; + + /** + * Given a property and a value (or map of), sets the property(s) on the body, using the appropriate setter functions if they exist. + * Prefer to use the actual setter functions in performance critical situations. + * @method set + * @param {body} body + * @param {} settings A property name (or map of properties and values) to set on the body. + * @param {} value The value to set if `settings` is a single property name. + */ + Body.set = function(body, settings, value) { + var property; + + if (typeof settings === 'string') { + property = settings; + settings = {}; + settings[property] = value; + } + + for (property in settings) { + if (!Object.prototype.hasOwnProperty.call(settings, property)) + continue; + + value = settings[property]; + switch (property) { + + case 'isStatic': + Body.setStatic(body, value); + break; + case 'isSleeping': + Sleeping.set(body, value); + break; + case 'mass': + Body.setMass(body, value); + break; + case 'density': + Body.setDensity(body, value); + break; + case 'inertia': + Body.setInertia(body, value); + break; + case 'vertices': + Body.setVertices(body, value); + break; + case 'position': + Body.setPosition(body, value); + break; + case 'angle': + Body.setAngle(body, value); + break; + case 'velocity': + Body.setVelocity(body, value); + break; + case 'angularVelocity': + Body.setAngularVelocity(body, value); + break; + case 'speed': + Body.setSpeed(body, value); + break; + case 'angularSpeed': + Body.setAngularSpeed(body, value); + break; + case 'parts': + Body.setParts(body, value); + break; + case 'centre': + Body.setCentre(body, value); + break; + default: + body[property] = value; + } + } + }; + + /** + * Sets the body as static, including isStatic flag and setting mass and inertia to Infinity. + * @method setStatic + * @param {body} body + * @param {bool} isStatic + */ + Body.setStatic = function(body, isStatic) { + for (var i = 0; i < body.parts.length; i++) { + var part = body.parts[i]; + + if (isStatic) { + if (!part.isStatic) { + part._original = { + restitution: part.restitution, + friction: part.friction, + mass: part.mass, + inertia: part.inertia, + density: part.density, + inverseMass: part.inverseMass, + inverseInertia: part.inverseInertia + }; + } + + part.restitution = 0; + part.friction = 1; + part.mass = part.inertia = part.density = Infinity; + part.inverseMass = part.inverseInertia = 0; + + part.positionPrev.x = part.position.x; + part.positionPrev.y = part.position.y; + part.anglePrev = part.angle; + part.angularVelocity = 0; + part.speed = 0; + part.angularSpeed = 0; + part.motion = 0; + } else if (part._original) { + part.restitution = part._original.restitution; + part.friction = part._original.friction; + part.mass = part._original.mass; + part.inertia = part._original.inertia; + part.density = part._original.density; + part.inverseMass = part._original.inverseMass; + part.inverseInertia = part._original.inverseInertia; + + part._original = null; + } + part.isStatic = isStatic; + } + }; + + /** + * Sets the mass of the body. Inverse mass, density and inertia are automatically updated to reflect the change. + * @method setMass + * @param {body} body + * @param {number} mass + */ + Body.setMass = function(body, mass) { + var moment = body.inertia / (body.mass / 6); + body.inertia = moment * (mass / 6); + body.inverseInertia = 1 / body.inertia; + + body.mass = mass; + body.inverseMass = 1 / body.mass; + body.density = body.mass / body.area; + }; + + /** + * Sets the density of the body. Mass and inertia are automatically updated to reflect the change. + * @method setDensity + * @param {body} body + * @param {number} density + */ + Body.setDensity = function(body, density) { + Body.setMass(body, density * body.area); + body.density = density; + }; + + /** + * Sets the moment of inertia (i.e. second moment of area) of the body. + * Inverse inertia is automatically updated to reflect the change. Mass is not changed. + * @method setInertia + * @param {body} body + * @param {number} inertia + */ + Body.setInertia = function(body, inertia) { + body.inertia = inertia; + body.inverseInertia = 1 / body.inertia; + }; + + /** + * Sets the body's vertices and updates body properties accordingly, including inertia, area and mass (with respect to `body.density`). + * Vertices will be automatically transformed to be orientated around their centre of mass as the origin. + * They are then automatically translated to world space based on `body.position`. + * + * The `vertices` argument should be passed as an array of `Matter.Vector` points (or a `Matter.Vertices` array). + * Vertices must form a convex hull, concave hulls are not supported. + * + * @method setVertices + * @param {body} body + * @param {vector[]} vertices + */ + Body.setVertices = function(body, vertices) { + // change vertices + if (vertices[0].body === body) { + body.vertices = vertices; + } else { + body.vertices = Vertices.create(vertices, body); + } + + // update properties + body.axes = Axes.fromVertices(body.vertices); + body.area = Vertices.area(body.vertices); + Body.setMass(body, body.density * body.area); + + // orient vertices around the centre of mass at origin (0, 0) + var centre = Vertices.centre(body.vertices); + Vertices.translate(body.vertices, centre, -1); + + // update inertia while vertices are at origin (0, 0) + Body.setInertia(body, Body._inertiaScale * Vertices.inertia(body.vertices, body.mass)); + + // update geometry + Vertices.translate(body.vertices, body.position); + + Bounds.update(body.bounds, body.vertices, body.velocity); + }; + + /** + * Sets the parts of the `body` and updates mass, inertia and centroid. + * Each part will have its parent set to `body`. + * By default the convex hull will be automatically computed and set on `body`, unless `autoHull` is set to `false.` + * Note that this method will ensure that the first part in `body.parts` will always be the `body`. + * @method setParts + * @param {body} body + * @param [body] parts + * @param {bool} [autoHull=true] + */ + Body.setParts = function(body, parts, autoHull) { + var i; + + // add all the parts, ensuring that the first part is always the parent body + parts = parts.slice(0); + body.parts.length = 0; + body.parts.push(body); + body.parent = body; + + for (i = 0; i < parts.length; i++) { + var part = parts[i]; + if (part !== body) { + part.parent = body; + body.parts.push(part); + } + } + + if (body.parts.length === 1) + return; + + autoHull = typeof autoHull !== 'undefined' ? autoHull : true; + + // find the convex hull of all parts to set on the parent body + if (autoHull) { + var vertices = []; + for (i = 0; i < parts.length; i++) { + vertices = vertices.concat(parts[i].vertices); + } + + Vertices.clockwiseSort(vertices); + + var hull = Vertices.hull(vertices), + hullCentre = Vertices.centre(hull); + + Body.setVertices(body, hull); + Vertices.translate(body.vertices, hullCentre); + } + + // sum the properties of all compound parts of the parent body + var total = Body._totalProperties(body); + + // Phaser addition + var cx = total.centre.x; + var cy = total.centre.y; + + var bounds = body.bounds; + var centerOfMass = body.centerOfMass; + var centerOffset = body.centerOffset; + + Bounds.update(bounds, body.vertices, body.velocity); + + centerOfMass.x = -(bounds.min.x - cx) / (bounds.max.x - bounds.min.x); + centerOfMass.y = -(bounds.min.y - cy) / (bounds.max.y - bounds.min.y); + + centerOffset.x = cx; + centerOffset.y = cy; + + body.area = total.area; + body.parent = body; + body.position.x = cx; + body.position.y = cy; + body.positionPrev.x = cx; + body.positionPrev.y = cy; + + // Matter.js original + // body.position.x = total.centre.x; + // body.position.y = total.centre.y; + // body.positionPrev.x = total.centre.x; + // body.positionPrev.y = total.centre.y; + + Body.setMass(body, total.mass); + Body.setInertia(body, total.inertia); + Body.setPosition(body, total.centre); + }; + + /** + * Set the centre of mass of the body. + * The `centre` is a vector in world-space unless `relative` is set, in which case it is a translation. + * The centre of mass is the point the body rotates about and can be used to simulate non-uniform density. + * This is equal to moving `body.position` but not the `body.vertices`. + * Invalid if the `centre` falls outside the body's convex hull. + * @method setCentre + * @param {body} body + * @param {vector} centre + * @param {bool} relative + */ + Body.setCentre = function(body, centre, relative) { + if (!relative) { + body.positionPrev.x = centre.x - (body.position.x - body.positionPrev.x); + body.positionPrev.y = centre.y - (body.position.y - body.positionPrev.y); + body.position.x = centre.x; + body.position.y = centre.y; + } else { + body.positionPrev.x += centre.x; + body.positionPrev.y += centre.y; + body.position.x += centre.x; + body.position.y += centre.y; + } + }; + + /** + * Sets the position of the body instantly. Velocity, angle, force etc. are unchanged. + * @method setPosition + * @param {body} body + * @param {vector} position + * @param {boolean} updateVelocity + */ + Body.setPosition = function(body, position, updateVelocity) { + var delta = Vector.sub(position, body.position); + if (updateVelocity) { + body.positionPrev.x = body.position.x; + body.positionPrev.y = body.position.y; + body.velocity.x = delta.x; + body.velocity.y = delta.y; + body.speed = Vector.magnitude(delta); + } else { + body.positionPrev.x += delta.x; + body.positionPrev.y += delta.y; + } + + for (var i = 0; i < body.parts.length; i++) { + var part = body.parts[i]; + part.position.x += delta.x; + part.position.y += delta.y; + Vertices.translate(part.vertices, delta); + Bounds.update(part.bounds, part.vertices, body.velocity); + } + }; + + /** + * Sets the angle of the body instantly. Angular velocity, position, force etc. are unchanged. + * @method setAngle + * @param {body} body + * @param {number} angle + * @param {boolean} updateVelocity + */ + Body.setAngle = function(body, angle, updateVelocity) { + var delta = angle - body.angle; + if (updateVelocity) { + body.anglePrev = body.angle; + body.angularVelocity = delta; + body.angularSpeed = Math.abs(delta); + } else { + body.anglePrev += delta; + } + + for (var i = 0; i < body.parts.length; i++) { + var part = body.parts[i]; + part.angle += delta; + Vertices.rotate(part.vertices, delta, body.position); + Axes.rotate(part.axes, delta); + Bounds.update(part.bounds, part.vertices, body.velocity); + if (i > 0) { + Vector.rotateAbout(part.position, delta, body.position, part.position); + } + } + }; + + /** + * Sets the linear velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`. + * @method setVelocity + * @param {body} body + * @param {vector} velocity + */ + Body.setVelocity = function(body, velocity) { + var timeScale = body.deltaTime / Body._baseDelta; + body.positionPrev.x = body.position.x - velocity.x * timeScale; + body.positionPrev.y = body.position.y - velocity.y * timeScale; + body.velocity.x = (body.position.x - body.positionPrev.x) / timeScale; + body.velocity.y = (body.position.y - body.positionPrev.y) / timeScale; + body.speed = Vector.magnitude(body.velocity); + }; + + /** + * Gets the current linear velocity of the body. + * @method getVelocity + * @param {body} body + * @return {vector} velocity + */ + Body.getVelocity = function(body) { + var timeScale = Body._baseDelta / body.deltaTime; + + return { + x: (body.position.x - body.positionPrev.x) * timeScale, + y: (body.position.y - body.positionPrev.y) * timeScale + }; + }; + + /** + * Gets the current linear speed of the body. + * Equivalent to the magnitude of its velocity. + * @method getSpeed + * @param {body} body + * @return {number} speed + */ + Body.getSpeed = function(body) { + return Vector.magnitude(Body.getVelocity(body)); + }; + + /** + * Sets the current linear speed of the body. + * Direction is maintained. Affects body velocity. + * @method setSpeed + * @param {body} body + * @param {number} speed + */ + Body.setSpeed = function(body, speed) { + Body.setVelocity(body, Vector.mult(Vector.normalise(Body.getVelocity(body)), speed)); + }; + + /** + * Sets the angular velocity of the body instantly. Position, angle, force etc. are unchanged. See also `Body.applyForce`. + * @method setAngularVelocity + * @param {body} body + * @param {number} velocity + */ + Body.setAngularVelocity = function(body, velocity) { + var timeScale = body.deltaTime / Body._baseDelta; + body.anglePrev = body.angle - velocity * timeScale; + body.angularVelocity = (body.angle - body.anglePrev) / timeScale; + body.angularSpeed = Math.abs(body.angularVelocity); + }; + + /** + * Gets the current rotational velocity of the body. + * @method getAngularVelocity + * @param {body} body + * @return {number} angular velocity + */ + Body.getAngularVelocity = function(body) { + return (body.angle - body.anglePrev) * Body._baseDelta / body.deltaTime; + }; + + /** + * Gets the current rotational speed of the body. + * Equivalent to the magnitude of its angular velocity. + * @method getAngularSpeed + * @param {body} body + * @return {number} angular speed + */ + Body.getAngularSpeed = function(body) { + return Math.abs(Body.getAngularVelocity(body)); + }; + + /** + * Sets the current rotational speed of the body. + * Direction is maintained. Affects body angular velocity. + * @method setAngularSpeed + * @param {body} body + * @param {number} speed + */ + Body.setAngularSpeed = function(body, speed) { + Body.setAngularVelocity(body, Common.sign(Body.getAngularVelocity(body)) * speed); + }; + + /** + * Moves a body by a given vector relative to its current position, without imparting any velocity. + * @method translate + * @param {body} body + * @param {vector} translation + * @param {boolean} [updateVelocity] + */ + Body.translate = function(body, translation, updateVelocity) { + Body.setPosition(body, Vector.add(body.position, translation), updateVelocity); + }; + + /** + * Rotates a body by a given angle relative to its current angle, without imparting any angular velocity. + * @method rotate + * @param {body} body + * @param {number} rotation + * @param {vector} [point] + * @param {boolean} [updateVelocity] + */ + Body.rotate = function(body, rotation, point, updateVelocity) { + if (!point) { + Body.setAngle(body, body.angle + rotation, updateVelocity); + } else { + var cos = Math.cos(rotation), + sin = Math.sin(rotation), + dx = body.position.x - point.x, + dy = body.position.y - point.y; + + Body.setPosition(body, { + x: point.x + (dx * cos - dy * sin), + y: point.y + (dx * sin + dy * cos) + }, updateVelocity); + + Body.setAngle(body, body.angle + rotation, updateVelocity); + } + }; + + /** + * Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre). + * @method scale + * @param {body} body + * @param {number} scaleX + * @param {number} scaleY + * @param {vector} [point] + */ + Body.scale = function(body, scaleX, scaleY, point) { + var totalArea = 0, + totalInertia = 0; + + point = point || body.position; + + for (var i = 0; i < body.parts.length; i++) { + var part = body.parts[i]; + + part.scale.x = scaleX; + part.scale.y = scaleY; + + // scale vertices + Vertices.scale(part.vertices, scaleX, scaleY, point); + + // update properties + part.axes = Axes.fromVertices(part.vertices); + part.area = Vertices.area(part.vertices); + Body.setMass(part, body.density * part.area); + + // update inertia (requires vertices to be at origin) + Vertices.translate(part.vertices, { x: -part.position.x, y: -part.position.y }); + Body.setInertia(part, Body._inertiaScale * Vertices.inertia(part.vertices, part.mass)); + Vertices.translate(part.vertices, { x: part.position.x, y: part.position.y }); + + if (i > 0) { + totalArea += part.area; + totalInertia += part.inertia; + } + + // scale position + part.position.x = point.x + (part.position.x - point.x) * scaleX; + part.position.y = point.y + (part.position.y - point.y) * scaleY; + + // update bounds + Bounds.update(part.bounds, part.vertices, body.velocity); + } + + // handle parent body + if (body.parts.length > 1) { + body.area = totalArea; + + if (!body.isStatic) { + Body.setMass(body, body.density * totalArea); + Body.setInertia(body, totalInertia); + } + } + + // handle circles + if (body.circleRadius) { + if (scaleX === scaleY) { + body.circleRadius *= scaleX; + } else { + // body is no longer a circle + body.circleRadius = null; + } + } + }; + + /** + * Performs a simulation step for the given `body`, including updating position and angle using Verlet integration. + * @method update + * @param {body} body + * @param {number} deltaTime + */ + Body.update = function(body, deltaTime) { + deltaTime = (typeof deltaTime !== 'undefined' ? deltaTime : (1000 / 60)) * body.timeScale; + var deltaTimeSquared = deltaTime * deltaTime, + correction = Body._timeCorrection ? deltaTime / (body.deltaTime || deltaTime) : 1; + + // from the previous step + var frictionAir = 1 - body.frictionAir * (deltaTime / Common._baseDelta), + velocityPrevX = (body.position.x - body.positionPrev.x) * correction, + velocityPrevY = (body.position.y - body.positionPrev.y) * correction; + + // update velocity with Verlet integration + body.velocity.x = (velocityPrevX * frictionAir) + (body.force.x / body.mass) * deltaTimeSquared; + body.velocity.y = (velocityPrevY * frictionAir) + (body.force.y / body.mass) * deltaTimeSquared; + + body.positionPrev.x = body.position.x; + body.positionPrev.y = body.position.y; + body.position.x += body.velocity.x; + body.position.y += body.velocity.y; + body.deltaTime = deltaTime; + + // update angular velocity with Verlet integration + body.angularVelocity = ((body.angle - body.anglePrev) * frictionAir * correction) + (body.torque / body.inertia) * deltaTimeSquared; + body.anglePrev = body.angle; + body.angle += body.angularVelocity; + + // track speed and acceleration + body.speed = Vector.magnitude(body.velocity); + body.angularSpeed = Math.abs(body.angularVelocity); + + // transform the body geometry + for (var i = 0; i < body.parts.length; i++) { + var part = body.parts[i]; + + Vertices.translate(part.vertices, body.velocity); + + if (i > 0) { + part.position.x += body.velocity.x; + part.position.y += body.velocity.y; + } + + if (body.angularVelocity !== 0) { + Vertices.rotate(part.vertices, body.angularVelocity, body.position); + Axes.rotate(part.axes, body.angularVelocity); + if (i > 0) { + Vector.rotateAbout(part.position, body.angularVelocity, body.position, part.position); + } + } + + Bounds.update(part.bounds, part.vertices, body.velocity); + } + }; + + /** + * Updates properties `body.velocity`, `body.speed`, `body.angularVelocity` and `body.angularSpeed` which are normalised in relation to `Body._baseDelta`. + * @method updateVelocities + * @param {body} body + */ + Body.updateVelocities = function(body) { + var timeScale = Body._baseDelta / body.deltaTime, + bodyVelocity = body.velocity; + + bodyVelocity.x = (body.position.x - body.positionPrev.x) * timeScale; + bodyVelocity.y = (body.position.y - body.positionPrev.y) * timeScale; + body.speed = Math.sqrt((bodyVelocity.x * bodyVelocity.x) + (bodyVelocity.y * bodyVelocity.y)); + + body.angularVelocity = (body.angle - body.anglePrev) * timeScale; + body.angularSpeed = Math.abs(body.angularVelocity); + }; + + /** + * Applies a force to a body from a given world-space position, including resulting torque. + * @method applyForce + * @param {body} body + * @param {vector} position + * @param {vector} force + */ + Body.applyForce = function(body, position, force) { + var offset = { x: position.x - body.position.x, y: position.y - body.position.y }; + body.force.x += force.x; + body.force.y += force.y; + body.torque += offset.x * force.y - offset.y * force.x; + }; + + /** + * Returns the sums of the properties of all compound parts of the parent body. + * @method _totalProperties + * @private + * @param {body} body + * @return {} + */ + Body._totalProperties = function(body) { + // from equations at: + // https://ecourses.ou.edu/cgi-bin/ebook.cgi?doc=&topic=st&chap_sec=07.2&page=theory + // http://output.to/sideway/default.asp?qno=121100087 + + var properties = { + mass: 0, + area: 0, + inertia: 0, + centre: { x: 0, y: 0 } + }; + + // sum the properties of all compound parts of the parent body + for (var i = body.parts.length === 1 ? 0 : 1; i < body.parts.length; i++) { + var part = body.parts[i], + mass = part.mass !== Infinity ? part.mass : 1; + + properties.mass += mass; + properties.area += part.area; + properties.inertia += part.inertia; + properties.centre = Vector.add(properties.centre, Vector.mult(part.position, mass)); + } + + properties.centre = Vector.div(properties.centre, properties.mass); + + return properties; + }; + + /* + * + * Events Documentation + * + */ + + /** + * Fired when a body starts sleeping (where `this` is the body). + * + * @event sleepStart + * @this {body} The body that has started sleeping + * @param {} event An event object + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + + /** + * Fired when a body ends sleeping (where `this` is the body). + * + * @event sleepEnd + * @this {body} The body that has ended sleeping + * @param {} event An event object + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + + /* + * + * Properties Documentation + * + */ + + /** + * An integer `Number` uniquely identifying number generated in `Body.create` by `Common.nextId`. + * + * @property id + * @type number + */ + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "body" + * @readOnly + */ + + /** + * An arbitrary `String` name to help the user identify and manage bodies. + * + * @property label + * @type string + * @default "Body" + */ + + /** + * An array of bodies that make up this body. + * The first body in the array must always be a self reference to the current body instance. + * All bodies in the `parts` array together form a single rigid compound body. + * Parts are allowed to overlap, have gaps or holes or even form concave bodies. + * Parts themselves should never be added to a `World`, only the parent body should be. + * Use `Body.setParts` when setting parts to ensure correct updates of all properties. + * + * @property parts + * @type body[] + */ + + /** + * An object reserved for storing plugin-specific properties. + * + * @property plugin + * @type {} + */ + + /** + * A self reference if the body is _not_ a part of another body. + * Otherwise this is a reference to the body that this is a part of. + * See `body.parts`. + * + * @property parent + * @type body + */ + + /** + * A `Number` specifying the angle of the body, in radians. + * + * @property angle + * @type number + * @default 0 + */ + + /** + * An array of `Vector` objects that specify the convex hull of the rigid body. + * These should be provided about the origin `(0, 0)`. E.g. + * + * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] + * + * When passed via `Body.create`, the vertices are translated relative to `body.position` (i.e. world-space, and constantly updated by `Body.update` during simulation). + * The `Vector` objects are also augmented with additional properties required for efficient collision detection. + * + * Other properties such as `inertia` and `bounds` are automatically calculated from the passed vertices (unless provided via `options`). + * Concave hulls are not currently supported. The module `Matter.Vertices` contains useful methods for working with vertices. + * + * @property vertices + * @type vector[] + */ + + /** + * A `Vector` that specifies the current world-space position of the body. + * + * @property position + * @type vector + * @default { x: 0, y: 0 } + */ + + /** + * A `Vector` that holds the current scale values as set by `Body.setScale`. + * + * @property scale + * @type vector + * @default { x: 1, y: 1 } + */ + + /** + * A `Vector` that specifies the force to apply in the current step. It is zeroed after every `Body.update`. See also `Body.applyForce`. + * + * @property force + * @type vector + * @default { x: 0, y: 0 } + */ + + /** + * A `Number` that specifies the torque (turning force) to apply in the current step. It is zeroed after every `Body.update`. + * + * @property torque + * @type number + * @default 0 + */ + + /** + * A `Number` that _measures_ the current speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.velocity`). + * + * @readOnly + * @property speed + * @type number + * @default 0 + */ + + /** + * A `Number` that _measures_ the current angular speed of the body after the last `Body.update`. It is read-only and always positive (it's the magnitude of `body.angularVelocity`). + * + * @readOnly + * @property angularSpeed + * @type number + * @default 0 + */ + + /** + * A `Vector` that _measures_ the current velocity of the body after the last `Body.update`. It is read-only. + * If you need to modify a body's velocity directly, you should either apply a force or simply change the body's `position` (as the engine uses position-Verlet integration). + * + * @readOnly + * @property velocity + * @type vector + * @default { x: 0, y: 0 } + */ + + /** + * A `Number` that _measures_ the current angular velocity of the body after the last `Body.update`. It is read-only. + * If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's `angle` (as the engine uses position-Verlet integration). + * + * @readOnly + * @property angularVelocity + * @type number + * @default 0 + */ + + /** + * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. + * If you need to set a body as static after its creation, you should use `Body.setStatic` as this requires more than just setting this flag. + * + * @property isStatic + * @type boolean + * @default false + */ + + /** + * A flag that indicates whether a body is a sensor. Sensor triggers collision events, but doesn't react with colliding body physically. + * + * @property isSensor + * @type boolean + * @default false + */ + + /** + * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. + * If you need to set a body as sleeping, you should use `Sleeping.set` as this requires more than just setting this flag. + * + * @property isSleeping + * @type boolean + * @default false + */ + + /** + * A `Number` that _measures_ the amount of movement a body currently has (a combination of `speed` and `angularSpeed`). It is read-only and always positive. + * It is used and updated by the `Matter.Sleeping` module during simulation to decide if a body has come to rest. + * + * @readOnly + * @property motion + * @type number + * @default 0 + */ + + /** + * A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the `Matter.Sleeping` module (if sleeping is enabled by the engine). + * + * @property sleepThreshold + * @type number + * @default 60 + */ + + /** + * A `Number` that defines the density of the body, that is its mass per unit area. + * If you pass the density via `Body.create` the `mass` property is automatically calculated for you based on the size (area) of the object. + * This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood). + * + * @property density + * @type number + * @default 0.001 + */ + + /** + * A `Number` that defines the mass of the body, although it may be more appropriate to specify the `density` property instead. + * If you modify this value, you must also modify the `body.inverseMass` property (`1 / mass`). + * + * @property mass + * @type number + */ + + /** + * A `Number` that defines the inverse mass of the body (`1 / mass`). + * If you modify this value, you must also modify the `body.mass` property. + * + * @property inverseMass + * @type number + */ + + /** + * A `Number` that defines the moment of inertia (i.e. second moment of area) of the body. + * It is automatically calculated from the given convex hull (`vertices` array) and density in `Body.create`. + * If you modify this value, you must also modify the `body.inverseInertia` property (`1 / inertia`). + * + * @property inertia + * @type number + */ + + /** + * A `Number` that defines the inverse moment of inertia of the body (`1 / inertia`). + * If you modify this value, you must also modify the `body.inertia` property. + * + * @property inverseInertia + * @type number + */ + + /** + * A `Number` that defines the restitution (elasticity) of the body. The value is always positive and is in the range `(0, 1)`. + * A value of `0` means collisions may be perfectly inelastic and no bouncing may occur. + * A value of `0.8` means the body may bounce back with approximately 80% of its kinetic energy. + * Note that collision response is based on _pairs_ of bodies, and that `restitution` values are _combined_ with the following formula: + * + * Math.max(bodyA.restitution, bodyB.restitution) + * + * @property restitution + * @type number + * @default 0 + */ + + /** + * A `Number` that defines the friction of the body. The value is always positive and is in the range `(0, 1)`. + * A value of `0` means that the body may slide indefinitely. + * A value of `1` means the body may come to a stop almost instantly after a force is applied. + * + * The effects of the value may be non-linear. + * High values may be unstable depending on the body. + * The engine uses a Coulomb friction model including static and kinetic friction. + * Note that collision response is based on _pairs_ of bodies, and that `friction` values are _combined_ with the following formula: + * + * Math.min(bodyA.friction, bodyB.friction) + * + * @property friction + * @type number + * @default 0.1 + */ + + /** + * A `Number` that defines the static friction of the body (in the Coulomb friction model). + * A value of `0` means the body will never 'stick' when it is nearly stationary and only dynamic `friction` is used. + * The higher the value (e.g. `10`), the more force it will take to initially get the body moving when nearly stationary. + * This value is multiplied with the `friction` property to make it easier to change `friction` and maintain an appropriate amount of static friction. + * + * @property frictionStatic + * @type number + * @default 0.5 + */ + + /** + * A `Number` that defines the air friction of the body (air resistance). + * A value of `0` means the body will never slow as it moves through space. + * The higher the value, the faster a body slows when moving through space. + * The effects of the value are non-linear. + * + * @property frictionAir + * @type number + * @default 0.01 + */ + + /** + * An `Object` that specifies the collision filtering properties of this body. + * + * Collisions between two bodies will obey the following rules: + * - If the two bodies have the same non-zero value of `collisionFilter.group`, + * they will always collide if the value is positive, and they will never collide + * if the value is negative. + * - If the two bodies have different values of `collisionFilter.group` or if one + * (or both) of the bodies has a value of 0, then the category/mask rules apply as follows: + * + * Each body belongs to a collision category, given by `collisionFilter.category`. This + * value is used as a bit field and the category should have only one bit set, meaning that + * the value of this property is a power of two in the range [1, 2^31]. Thus, there are 32 + * different collision categories available. + * + * Each body also defines a collision bitmask, given by `collisionFilter.mask` which specifies + * the categories it collides with (the value is the bitwise AND value of all these categories). + * + * Using the category/mask rules, two bodies `A` and `B` collide if each includes the other's + * category in its mask, i.e. `(categoryA & maskB) !== 0` and `(categoryB & maskA) !== 0` + * are both true. + * + * @property collisionFilter + * @type object + */ + + /** + * An Integer `Number`, that specifies the collision group this body belongs to. + * See `body.collisionFilter` for more information. + * + * @property collisionFilter.group + * @type object + * @default 0 + */ + + /** + * A bit field that specifies the collision category this body belongs to. + * The category value should have only one bit set, for example `0x0001`. + * This means there are up to 32 unique collision categories available. + * See `body.collisionFilter` for more information. + * + * @property collisionFilter.category + * @type object + * @default 1 + */ + + /** + * A bit mask that specifies the collision categories this body may collide with. + * See `body.collisionFilter` for more information. + * + * @property collisionFilter.mask + * @type object + * @default -1 + */ + + /** + * A `Number` that specifies a tolerance on how far a body is allowed to 'sink' or rotate into other bodies. + * Avoid changing this value unless you understand the purpose of `slop` in physics engines. + * The default should generally suffice, although very large bodies may require larger values for stable stacking. + * + * @property slop + * @type number + * @default 0.05 + */ + + /** + * A `Number` that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. + * + * @property timeScale + * @type number + * @default 1 + */ + + /** + * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. + * + * @property render + * @type object + */ + + /** + * A flag that indicates if the body should be rendered. + * + * @property render.visible + * @type boolean + * @default true + */ + + /** + * Sets the opacity to use when rendering. + * + * @property render.opacity + * @type number + * @default 1 + */ + + /** + * An `Object` that defines the sprite properties to use when rendering, if any. + * + * @property render.sprite + * @type object + */ + + /** + * A `Number` that defines the offset in the x-axis for the sprite (normalised by texture width). + * + * @property render.sprite.xOffset + * @type number + * @default 0 + */ + + /** + * A `Number` that defines the offset in the y-axis for the sprite (normalised by texture height). + * + * @property render.sprite.yOffset + * @type number + * @default 0 + */ + + /** + * A hex color value that defines the fill color to use when rendering the body. + * + * @property render.fillColor + * @type number + */ + + /** + * A value that defines the fill opacity to use when rendering the body. + * + * @property render.fillOpacity + * @type number + */ + + /** + * A hex color value that defines the line color to use when rendering the body. + * + * @property render.lineColor + * @type number + */ + + /** + * A value that defines the line opacity to use when rendering the body. + * + * @property render.lineOpacity + * @type number + */ + + /** + * A `Number` that defines the line width to use when rendering the body outline. + * + * @property render.lineThickness + * @type number + */ + + /** + * An array of unique axis vectors (edge normals) used for collision detection. + * These are automatically calculated from the given convex hull (`vertices` array) in `Body.create`. + * They are constantly updated by `Body.update` during the simulation. + * + * @property axes + * @type vector[] + */ + + /** + * A `Number` that _measures_ the area of the body's convex hull, calculated at creation by `Body.create`. + * + * @property area + * @type string + * @default + */ + + /** + * A `Bounds` object that defines the AABB region for the body. + * It is automatically calculated from the given convex hull (`vertices` array) in `Body.create` and constantly updated by `Body.update` during simulation. + * + * @property bounds + * @type bounds + */ + + /** + * A reference to the Phaser Game Object this body belongs to, if any. + * + * @property gameObject + * @type Phaser.GameObjects.GameObject + */ + + /** + * The center of mass of the Body. + * + * @property centerOfMass + * @type vector + * @default { x: 0, y: 0 } + */ + + /** + * The center of the body in pixel values. + * Used by Phaser for texture aligment. + * + * @property centerOffset + * @type vector + * @default { x: 0, y: 0 } + */ + + /** + * Will this Body ignore World gravity during the Engine update? + * + * @property ignoreGravity + * @type boolean + * @default false + */ + + /** + * Scale the influence of World gravity when applied to this body. + * + * @property gravityScale + * @type vector + * @default { x: 1, y: 1 } + */ + + /** + * Will this Body ignore Phaser Pointer input events? + * + * @property ignorePointer + * @type boolean + * @default false + */ + + /** + * A callback that is invoked when this Body starts colliding with any other Body. + * + * You can register callbacks by providing a function of type `( pair: Matter.Pair) => void`. + * + * @property onCollideCallback + * @type function + * @default null + */ + + /** + * A callback that is invoked when this Body stops colliding with any other Body. + * + * You can register callbacks by providing a function of type `( pair: Matter.Pair) => void`. + * + * @property onCollideEndCallback + * @type function + * @default null + */ + + /** + * A callback that is invoked for the duration that this Body is colliding with any other Body. + * + * You can register callbacks by providing a function of type `( pair: Matter.Pair) => void`. + * + * @property onCollideActiveCallback + * @type function + * @default null + */ + + /** + * A collision callback dictionary used by the `Body.setOnCollideWith` function. + * + * @property onCollideWith + * @type object + * @default null + */ + +})(); + + +/***/ }), + +/***/ 11299: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter.Composite` module contains methods for creating and manipulating composite bodies. +* A composite body is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`, therefore composites form a tree structure. +* It is important to use the functions in this module to modify composites, rather than directly modifying their properties. +* Note that the `Matter.World` object is also a type of `Matter.Composite` and as such all composite methods here can also operate on a `Matter.World`. +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class Composite +*/ + +var Composite = {}; + +module.exports = Composite; + +var Events = __webpack_require__(39073); +var Common = __webpack_require__(68758); +var Bounds = __webpack_require__(84091); +var Body = __webpack_require__(84125); + +(function() { + + /** + * Creates a new composite. The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properites section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {} [options] + * @return {composite} A new composite + */ + Composite.create = function(options) { + return Common.extend({ + id: Common.nextId(), + type: 'composite', + parent: null, + isModified: false, + bodies: [], + constraints: [], + composites: [], + label: 'Composite', + plugin: {}, + cache: { + allBodies: null, + allConstraints: null, + allComposites: null + } + }, options); + }; + + /** + * Sets the composite's `isModified` flag. + * If `updateParents` is true, all parents will be set (default: false). + * If `updateChildren` is true, all children will be set (default: false). + * @method setModified + * @param {composite} composite + * @param {boolean} isModified + * @param {boolean} [updateParents=false] + * @param {boolean} [updateChildren=false] + */ + Composite.setModified = function(composite, isModified, updateParents, updateChildren) { + + Events.trigger(composite, 'compositeModified', composite); + + composite.isModified = isModified; + + if (isModified && composite.cache) { + composite.cache.allBodies = null; + composite.cache.allConstraints = null; + composite.cache.allComposites = null; + } + + if (updateParents && composite.parent) { + Composite.setModified(composite.parent, isModified, updateParents, updateChildren); + } + + if (updateChildren) { + for (var i = 0; i < composite.composites.length; i++) { + var childComposite = composite.composites[i]; + Composite.setModified(childComposite, isModified, updateParents, updateChildren); + } + } + }; + + /** + * Generic single or multi-add function. Adds a single or an array of body(s), constraint(s) or composite(s) to the given composite. + * Triggers `beforeAdd` and `afterAdd` events on the `composite`. + * @method add + * @param {composite} composite + * @param {object|array} object A single or an array of body(s), constraint(s) or composite(s) + * @return {composite} The original composite with the objects added + */ + Composite.add = function(composite, object) { + var objects = [].concat(object); + + Events.trigger(composite, 'beforeAdd', { object: object }); + + for (var i = 0; i < objects.length; i++) { + var obj = objects[i]; + + switch (obj.type) { + + case 'body': + // skip adding compound parts + if (obj.parent !== obj) { + Common.warn('Composite.add: skipped adding a compound body part (you must add its parent instead)'); + break; + } + + Composite.addBody(composite, obj); + break; + case 'constraint': + Composite.addConstraint(composite, obj); + break; + case 'composite': + Composite.addComposite(composite, obj); + break; + case 'mouseConstraint': + Composite.addConstraint(composite, obj.constraint); + break; + + } + } + + Events.trigger(composite, 'afterAdd', { object: object }); + + return composite; + }; + + /** + * Generic remove function. Removes one or many body(s), constraint(s) or a composite(s) to the given composite. + * Optionally searching its children recursively. + * Triggers `beforeRemove` and `afterRemove` events on the `composite`. + * @method remove + * @param {composite} composite + * @param {object|array} object + * @param {boolean} [deep=false] + * @return {composite} The original composite with the objects removed + */ + Composite.remove = function(composite, object, deep) { + var objects = [].concat(object); + + Events.trigger(composite, 'beforeRemove', { object: object }); + + for (var i = 0; i < objects.length; i++) { + var obj = objects[i]; + + switch (obj.type) { + + case 'body': + Composite.removeBody(composite, obj, deep); + break; + case 'constraint': + Composite.removeConstraint(composite, obj, deep); + break; + case 'composite': + Composite.removeComposite(composite, obj, deep); + break; + case 'mouseConstraint': + Composite.removeConstraint(composite, obj.constraint); + break; + + } + } + + Events.trigger(composite, 'afterRemove', { object: object }); + + return composite; + }; + + /** + * Adds a composite to the given composite. + * @private + * @method addComposite + * @param {composite} compositeA + * @param {composite} compositeB + * @return {composite} The original compositeA with the objects from compositeB added + */ + Composite.addComposite = function(compositeA, compositeB) { + compositeA.composites.push(compositeB); + compositeB.parent = compositeA; + Composite.setModified(compositeA, true, true, false); + return compositeA; + }; + + /** + * Removes a composite from the given composite, and optionally searching its children recursively. + * @private + * @method removeComposite + * @param {composite} compositeA + * @param {composite} compositeB + * @param {boolean} [deep=false] + * @return {composite} The original compositeA with the composite removed + */ + Composite.removeComposite = function(compositeA, compositeB, deep) { + var position = Common.indexOf(compositeA.composites, compositeB); + if (position !== -1) { + Composite.removeCompositeAt(compositeA, position); + } + + if (deep) { + for (var i = 0; i < compositeA.composites.length; i++){ + Composite.removeComposite(compositeA.composites[i], compositeB, true); + } + } + + return compositeA; + }; + + /** + * Removes a composite from the given composite. + * @private + * @method removeCompositeAt + * @param {composite} composite + * @param {number} position + * @return {composite} The original composite with the composite removed + */ + Composite.removeCompositeAt = function(composite, position) { + composite.composites.splice(position, 1); + Composite.setModified(composite, true, true, false); + return composite; + }; + + /** + * Adds a body to the given composite. + * @private + * @method addBody + * @param {composite} composite + * @param {body} body + * @return {composite} The original composite with the body added + */ + Composite.addBody = function(composite, body) { + composite.bodies.push(body); + Composite.setModified(composite, true, true, false); + return composite; + }; + + /** + * Removes a body from the given composite, and optionally searching its children recursively. + * @private + * @method removeBody + * @param {composite} composite + * @param {body} body + * @param {boolean} [deep=false] + * @return {composite} The original composite with the body removed + */ + Composite.removeBody = function(composite, body, deep) { + var position = Common.indexOf(composite.bodies, body); + if (position !== -1) { + Composite.removeBodyAt(composite, position); + } + + if (deep) { + for (var i = 0; i < composite.composites.length; i++){ + Composite.removeBody(composite.composites[i], body, true); + } + } + + return composite; + }; + + /** + * Removes a body from the given composite. + * @private + * @method removeBodyAt + * @param {composite} composite + * @param {number} position + * @return {composite} The original composite with the body removed + */ + Composite.removeBodyAt = function(composite, position) { + composite.bodies.splice(position, 1); + Composite.setModified(composite, true, true, false); + return composite; + }; + + /** + * Adds a constraint to the given composite. + * @private + * @method addConstraint + * @param {composite} composite + * @param {constraint} constraint + * @return {composite} The original composite with the constraint added + */ + Composite.addConstraint = function(composite, constraint) { + composite.constraints.push(constraint); + Composite.setModified(composite, true, true, false); + return composite; + }; + + /** + * Removes a constraint from the given composite, and optionally searching its children recursively. + * @private + * @method removeConstraint + * @param {composite} composite + * @param {constraint} constraint + * @param {boolean} [deep=false] + * @return {composite} The original composite with the constraint removed + */ + Composite.removeConstraint = function(composite, constraint, deep) { + var position = Common.indexOf(composite.constraints, constraint); + if (position !== -1) { + Composite.removeConstraintAt(composite, position); + } + + if (deep) { + for (var i = 0; i < composite.composites.length; i++){ + Composite.removeConstraint(composite.composites[i], constraint, true); + } + } + + return composite; + }; + + /** + * Removes a body from the given composite. + * @private + * @method removeConstraintAt + * @param {composite} composite + * @param {number} position + * @return {composite} The original composite with the constraint removed + */ + Composite.removeConstraintAt = function(composite, position) { + composite.constraints.splice(position, 1); + Composite.setModified(composite, true, true, false); + return composite; + }; + + /** + * Removes all bodies, constraints and composites from the given composite. + * Optionally clearing its children recursively. + * @method clear + * @param {composite} composite + * @param {boolean} keepStatic + * @param {boolean} [deep=false] + */ + Composite.clear = function(composite, keepStatic, deep) { + if (deep) { + for (var i = 0; i < composite.composites.length; i++){ + Composite.clear(composite.composites[i], keepStatic, true); + } + } + + if (keepStatic) { + composite.bodies = composite.bodies.filter(function(body) { return body.isStatic; }); + } else { + composite.bodies.length = 0; + } + + composite.constraints.length = 0; + composite.composites.length = 0; + + Composite.setModified(composite, true, true, false); + + return composite; + }; + + /** + * Returns all bodies in the given composite, including all bodies in its children, recursively. + * @method allBodies + * @param {composite} composite + * @return {body[]} All the bodies + */ + Composite.allBodies = function(composite) { + if (composite.cache && composite.cache.allBodies) { + return composite.cache.allBodies; + } + + var bodies = [].concat(composite.bodies); + + for (var i = 0; i < composite.composites.length; i++) + bodies = bodies.concat(Composite.allBodies(composite.composites[i])); + + if (composite.cache) { + composite.cache.allBodies = bodies; + } + + return bodies; + }; + + /** + * Returns all constraints in the given composite, including all constraints in its children, recursively. + * @method allConstraints + * @param {composite} composite + * @return {constraint[]} All the constraints + */ + Composite.allConstraints = function(composite) { + if (composite.cache && composite.cache.allConstraints) { + return composite.cache.allConstraints; + } + + var constraints = [].concat(composite.constraints); + + for (var i = 0; i < composite.composites.length; i++) + constraints = constraints.concat(Composite.allConstraints(composite.composites[i])); + + if (composite.cache) { + composite.cache.allConstraints = constraints; + } + + return constraints; + }; + + /** + * Returns all composites in the given composite, including all composites in its children, recursively. + * @method allComposites + * @param {composite} composite + * @return {composite[]} All the composites + */ + Composite.allComposites = function(composite) { + if (composite.cache && composite.cache.allComposites) { + return composite.cache.allComposites; + } + + var composites = [].concat(composite.composites); + + for (var i = 0; i < composite.composites.length; i++) + composites = composites.concat(Composite.allComposites(composite.composites[i])); + + if (composite.cache) { + composite.cache.allComposites = composites; + } + + return composites; + }; + + /** + * Searches the composite recursively for an object matching the type and id supplied, null if not found. + * @method get + * @param {composite} composite + * @param {number} id + * @param {string} type + * @return {object} The requested object, if found + */ + Composite.get = function(composite, id, type) { + var objects, + object; + + switch (type) { + case 'body': + objects = Composite.allBodies(composite); + break; + case 'constraint': + objects = Composite.allConstraints(composite); + break; + case 'composite': + objects = Composite.allComposites(composite).concat(composite); + break; + } + + if (!objects) + return null; + + object = objects.filter(function(object) { + return object.id.toString() === id.toString(); + }); + + return object.length === 0 ? null : object[0]; + }; + + /** + * Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add). + * @method move + * @param {compositeA} compositeA + * @param {object[]} objects + * @param {compositeB} compositeB + * @return {composite} Returns compositeA + */ + Composite.move = function(compositeA, objects, compositeB) { + Composite.remove(compositeA, objects); + Composite.add(compositeB, objects); + return compositeA; + }; + + /** + * Assigns new ids for all objects in the composite, recursively. + * @method rebase + * @param {composite} composite + * @return {composite} Returns composite + */ + Composite.rebase = function(composite) { + var objects = Composite.allBodies(composite) + .concat(Composite.allConstraints(composite)) + .concat(Composite.allComposites(composite)); + + for (var i = 0; i < objects.length; i++) { + objects[i].id = Common.nextId(); + } + + return composite; + }; + + /** + * Translates all children in the composite by a given vector relative to their current positions, + * without imparting any velocity. + * @method translate + * @param {composite} composite + * @param {vector} translation + * @param {bool} [recursive=true] + */ + Composite.translate = function(composite, translation, recursive) { + var bodies = recursive ? Composite.allBodies(composite) : composite.bodies; + + for (var i = 0; i < bodies.length; i++) { + Body.translate(bodies[i], translation); + } + + return composite; + }; + + /** + * Rotates all children in the composite by a given angle about the given point, without imparting any angular velocity. + * @method rotate + * @param {composite} composite + * @param {number} rotation + * @param {vector} point + * @param {bool} [recursive=true] + */ + Composite.rotate = function(composite, rotation, point, recursive) { + var cos = Math.cos(rotation), + sin = Math.sin(rotation), + bodies = recursive ? Composite.allBodies(composite) : composite.bodies; + + for (var i = 0; i < bodies.length; i++) { + var body = bodies[i], + dx = body.position.x - point.x, + dy = body.position.y - point.y; + + Body.setPosition(body, { + x: point.x + (dx * cos - dy * sin), + y: point.y + (dx * sin + dy * cos) + }); + + Body.rotate(body, rotation); + } + + return composite; + }; + + /** + * Scales all children in the composite, including updating physical properties (mass, area, axes, inertia), from a world-space point. + * @method scale + * @param {composite} composite + * @param {number} scaleX + * @param {number} scaleY + * @param {vector} point + * @param {bool} [recursive=true] + */ + Composite.scale = function(composite, scaleX, scaleY, point, recursive) { + var bodies = recursive ? Composite.allBodies(composite) : composite.bodies; + + for (var i = 0; i < bodies.length; i++) { + var body = bodies[i], + dx = body.position.x - point.x, + dy = body.position.y - point.y; + + Body.setPosition(body, { + x: point.x + dx * scaleX, + y: point.y + dy * scaleY + }); + + Body.scale(body, scaleX, scaleY); + } + + return composite; + }; + + /** + * Returns the union of the bounds of all of the composite's bodies. + * @method bounds + * @param {composite} composite The composite. + * @returns {bounds} The composite bounds. + */ + Composite.bounds = function(composite) { + var bodies = Composite.allBodies(composite), + vertices = []; + + for (var i = 0; i < bodies.length; i += 1) { + var body = bodies[i]; + vertices.push(body.bounds.min, body.bounds.max); + } + + return Bounds.create(vertices); + }; + + /* + * + * Events Documentation + * + */ + + /** + * Fired when a call to `Composite.add` is made, before objects have been added. + * + * @event beforeAdd + * @param {} event An event object + * @param {} event.object The object(s) to be added (may be a single body, constraint, composite or a mixed array of these) + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + + /** + * Fired when a call to `Composite.add` is made, after objects have been added. + * + * @event afterAdd + * @param {} event An event object + * @param {} event.object The object(s) that have been added (may be a single body, constraint, composite or a mixed array of these) + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + + /** + * Fired when a call to `Composite.remove` is made, before objects have been removed. + * + * @event beforeRemove + * @param {} event An event object + * @param {} event.object The object(s) to be removed (may be a single body, constraint, composite or a mixed array of these) + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + + /** + * Fired when a call to `Composite.remove` is made, after objects have been removed. + * + * @event afterRemove + * @param {} event An event object + * @param {} event.object The object(s) that have been removed (may be a single body, constraint, composite or a mixed array of these) + * @param {} event.source The source object of the event + * @param {} event.name The name of the event + */ + + /* + * + * Properties Documentation + * + */ + + /** + * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * + * @property id + * @type number + */ + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "composite" + * @readOnly + */ + + /** + * An arbitrary `String` name to help the user identify and manage composites. + * + * @property label + * @type string + * @default "Composite" + */ + + /** + * A flag that specifies whether the composite has been modified during the current step. + * Most `Matter.Composite` methods will automatically set this flag to `true` to inform the engine of changes to be handled. + * If you need to change it manually, you should use the `Composite.setModified` method. + * + * @property isModified + * @type boolean + * @default false + */ + + /** + * The `Composite` that is the parent of this composite. It is automatically managed by the `Matter.Composite` methods. + * + * @property parent + * @type composite + * @default null + */ + + /** + * An array of `Body` that are _direct_ children of this composite. + * To add or remove bodies you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allBodies` method. + * + * @property bodies + * @type body[] + * @default [] + */ + + /** + * An array of `Constraint` that are _direct_ children of this composite. + * To add or remove constraints you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allConstraints` method. + * + * @property constraints + * @type constraint[] + * @default [] + */ + + /** + * An array of `Composite` that are _direct_ children of this composite. + * To add or remove composites you should use `Composite.add` and `Composite.remove` methods rather than directly modifying this property. + * If you wish to recursively find all descendants, you should use the `Composite.allComposites` method. + * + * @property composites + * @type composite[] + * @default [] + */ + + /** + * An object reserved for storing plugin-specific properties. + * + * @property plugin + * @type {} + */ + + /** + * An object used for storing cached results for performance reasons. + * This is used internally only and is automatically managed. + * + * @private + * @property cache + * @type {} + */ + +})(); + + +/***/ }), + +/***/ 72005: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* This module has now been replaced by `Matter.Composite`. +* +* All usage should be migrated to the equivalent functions found on `Matter.Composite`. +* For example `World.add(world, body)` now becomes `Composite.add(world, body)`. +* +* The property `world.gravity` has been moved to `engine.gravity`. +* +* For back-compatibility purposes this module will remain as a direct alias to `Matter.Composite` in the short term during migration. +* Eventually this alias module will be marked as deprecated and then later removed in a future release. +* +* @class World +* @extends Composite +*/ + +var World = {}; + +module.exports = World; + +var Composite = __webpack_require__(11299); + +(function() { + + /** + * See above, aliases for back compatibility only + */ + World.create = Composite.create; + World.add = Composite.add; + World.remove = Composite.remove; + World.clear = Composite.clear; + World.addComposite = Composite.addComposite; + World.addBody = Composite.addBody; + World.addConstraint = Composite.addConstraint; + + /* + * + * Properties Documentation + * + */ + + /** + * The gravity to apply on the world. + * + * @property gravity + * @type object + */ + + /** + * The gravity x component. + * + * @property gravity.x + * @type object + * @default 0 + */ + + /** + * The gravity y component. + * + * @property gravity.y + * @type object + * @default 1 + */ + + /** + * The gravity scale factor. + * + * @property gravity.scale + * @type object + * @default 0.001 + */ + + /** + * A `Bounds` object that defines the world bounds for collision detection. + * + * @property bounds + * @type bounds + * @default { min: { x: -Infinity, y: -Infinity }, max: { x: Infinity, y: Infinity } } + */ + + // World is a Composite body + // see src/module/Outro.js for these aliases: + + /** + * An alias for Composite.add + * @method add + * @param {world} world + * @param {} object + * @return {composite} The original world with the objects added + */ + + /** + * An alias for Composite.remove + * @method remove + * @param {world} world + * @param {} object + * @param {boolean} [deep=false] + * @return {composite} The original world with the objects removed + */ + + /** + * An alias for Composite.clear + * @method clear + * @param {world} world + * @param {boolean} keepStatic + */ + + /** + * An alias for Composite.addComposite + * @method addComposite + * @param {world} world + * @param {composite} composite + * @return {world} The original world with the objects from composite added + */ + + /** + * An alias for Composite.addBody + * @method addBody + * @param {world} world + * @param {body} body + * @return {world} The original world with the body added + */ + + /** + * An alias for Composite.addConstraint + * @method addConstraint + * @param {world} world + * @param {constraint} constraint + * @return {world} The original world with the constraint added + */ + +})(); + + +/***/ }), + +/***/ 63454: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter.Collision` module contains methods for detecting collisions between a given pair of bodies. +* +* For efficient detection between a list of bodies, see `Matter.Detector` and `Matter.Query`. +* +* See `Matter.Engine` for collision events. +* +* @class Collision +*/ + +var Collision = {}; + +module.exports = Collision; + +var Vertices = __webpack_require__(39745); +var Pair = __webpack_require__(70584); + +(function() { + var _supports = []; + + var _overlapAB = { + overlap: 0, + axis: null + }; + + var _overlapBA = { + overlap: 0, + axis: null + }; + + /** + * Creates a new collision record. + * @method create + * @param {body} bodyA The first body part represented by the collision record + * @param {body} bodyB The second body part represented by the collision record + * @return {collision} A new collision record + */ + Collision.create = function(bodyA, bodyB) { + return { + pair: null, + collided: false, + bodyA: bodyA, + bodyB: bodyB, + parentA: bodyA.parent, + parentB: bodyB.parent, + depth: 0, + normal: { x: 0, y: 0 }, + tangent: { x: 0, y: 0 }, + penetration: { x: 0, y: 0 }, + supports: [] + }; + }; + + /** + * Detect collision between two bodies. + * @method collides + * @param {body} bodyA + * @param {body} bodyB + * @param {pairs} [pairs] Optionally reuse collision records from existing pairs. + * @return {collision|null} A collision record if detected, otherwise null + */ + Collision.collides = function(bodyA, bodyB, pairs) { + Collision._overlapAxes(_overlapAB, bodyA.vertices, bodyB.vertices, bodyA.axes); + + if (_overlapAB.overlap <= 0) { + return null; + } + + Collision._overlapAxes(_overlapBA, bodyB.vertices, bodyA.vertices, bodyB.axes); + + if (_overlapBA.overlap <= 0) { + return null; + } + + // reuse collision records for gc efficiency + var pair = pairs && pairs.table[Pair.id(bodyA, bodyB)], + collision; + + if (!pair) { + collision = Collision.create(bodyA, bodyB); + collision.collided = true; + collision.bodyA = bodyA.id < bodyB.id ? bodyA : bodyB; + collision.bodyB = bodyA.id < bodyB.id ? bodyB : bodyA; + collision.parentA = collision.bodyA.parent; + collision.parentB = collision.bodyB.parent; + } else { + collision = pair.collision; + } + + bodyA = collision.bodyA; + bodyB = collision.bodyB; + + var minOverlap; + + if (_overlapAB.overlap < _overlapBA.overlap) { + minOverlap = _overlapAB; + } else { + minOverlap = _overlapBA; + } + + var normal = collision.normal, + supports = collision.supports, + minAxis = minOverlap.axis, + minAxisX = minAxis.x, + minAxisY = minAxis.y; + + // ensure normal is facing away from bodyA + if (minAxisX * (bodyB.position.x - bodyA.position.x) + minAxisY * (bodyB.position.y - bodyA.position.y) < 0) { + normal.x = minAxisX; + normal.y = minAxisY; + } else { + normal.x = -minAxisX; + normal.y = -minAxisY; + } + + collision.tangent.x = -normal.y; + collision.tangent.y = normal.x; + + collision.depth = minOverlap.overlap; + + collision.penetration.x = normal.x * collision.depth; + collision.penetration.y = normal.y * collision.depth; + + // find support points, there is always either exactly one or two + var supportsB = Collision._findSupports(bodyA, bodyB, normal, 1), + supportCount = 0; + + // find the supports from bodyB that are inside bodyA + if (Vertices.contains(bodyA.vertices, supportsB[0])) { + supports[supportCount++] = supportsB[0]; + } + + if (Vertices.contains(bodyA.vertices, supportsB[1])) { + supports[supportCount++] = supportsB[1]; + } + + // find the supports from bodyA that are inside bodyB + if (supportCount < 2) { + var supportsA = Collision._findSupports(bodyB, bodyA, normal, -1); + + if (Vertices.contains(bodyB.vertices, supportsA[0])) { + supports[supportCount++] = supportsA[0]; + } + + if (supportCount < 2 && Vertices.contains(bodyB.vertices, supportsA[1])) { + supports[supportCount++] = supportsA[1]; + } + } + + // account for the edge case of overlapping but no vertex containment + if (supportCount === 0) { + supports[supportCount++] = supportsB[0]; + } + + // update supports array size + supports.length = supportCount; + + return collision; + }; + + /** + * Find the overlap between two sets of vertices. + * @method _overlapAxes + * @private + * @param {object} result + * @param {vertices} verticesA + * @param {vertices} verticesB + * @param {axes} axes + */ + Collision._overlapAxes = function(result, verticesA, verticesB, axes) { + var verticesALength = verticesA.length, + verticesBLength = verticesB.length, + verticesAX = verticesA[0].x, + verticesAY = verticesA[0].y, + verticesBX = verticesB[0].x, + verticesBY = verticesB[0].y, + axesLength = axes.length, + overlapMin = Number.MAX_VALUE, + overlapAxisNumber = 0, + overlap, + overlapAB, + overlapBA, + dot, + i, + j; + + for (i = 0; i < axesLength; i++) { + var axis = axes[i], + axisX = axis.x, + axisY = axis.y, + minA = verticesAX * axisX + verticesAY * axisY, + minB = verticesBX * axisX + verticesBY * axisY, + maxA = minA, + maxB = minB; + + for (j = 1; j < verticesALength; j += 1) { + dot = verticesA[j].x * axisX + verticesA[j].y * axisY; + + if (dot > maxA) { + maxA = dot; + } else if (dot < minA) { + minA = dot; + } + } + + for (j = 1; j < verticesBLength; j += 1) { + dot = verticesB[j].x * axisX + verticesB[j].y * axisY; + + if (dot > maxB) { + maxB = dot; + } else if (dot < minB) { + minB = dot; + } + } + + overlapAB = maxA - minB; + overlapBA = maxB - minA; + overlap = overlapAB < overlapBA ? overlapAB : overlapBA; + + if (overlap < overlapMin) { + overlapMin = overlap; + overlapAxisNumber = i; + + if (overlap <= 0) { + // can not be intersecting + break; + } + } + } + + result.axis = axes[overlapAxisNumber]; + result.overlap = overlapMin; + }; + + /** + * Projects vertices on an axis and returns an interval. + * @method _projectToAxis + * @private + * @param {} projection + * @param {} vertices + * @param {} axis + */ + Collision._projectToAxis = function(projection, vertices, axis) { + var min = vertices[0].x * axis.x + vertices[0].y * axis.y, + max = min; + + for (var i = 1; i < vertices.length; i += 1) { + var dot = vertices[i].x * axis.x + vertices[i].y * axis.y; + + if (dot > max) { + max = dot; + } else if (dot < min) { + min = dot; + } + } + + projection.min = min; + projection.max = max; + }; + + /** + * Finds supporting vertices given two bodies along a given direction using hill-climbing. + * @method _findSupports + * @private + * @param {body} bodyA + * @param {body} bodyB + * @param {vector} normal + * @param {number} direction + * @return [vector] + */ + Collision._findSupports = function(bodyA, bodyB, normal, direction) { + var vertices = bodyB.vertices, + verticesLength = vertices.length, + bodyAPositionX = bodyA.position.x, + bodyAPositionY = bodyA.position.y, + normalX = normal.x * direction, + normalY = normal.y * direction, + nearestDistance = Number.MAX_VALUE, + vertexA, + vertexB, + vertexC, + distance, + j; + + // find deepest vertex relative to the axis + for (j = 0; j < verticesLength; j += 1) { + vertexB = vertices[j]; + distance = normalX * (bodyAPositionX - vertexB.x) + normalY * (bodyAPositionY - vertexB.y); + + // convex hill-climbing + if (distance < nearestDistance) { + nearestDistance = distance; + vertexA = vertexB; + } + } + + // measure next vertex + vertexC = vertices[(verticesLength + vertexA.index - 1) % verticesLength]; + nearestDistance = normalX * (bodyAPositionX - vertexC.x) + normalY * (bodyAPositionY - vertexC.y); + + // compare with previous vertex + vertexB = vertices[(vertexA.index + 1) % verticesLength]; + if (normalX * (bodyAPositionX - vertexB.x) + normalY * (bodyAPositionY - vertexB.y) < nearestDistance) { + _supports[0] = vertexA; + _supports[1] = vertexB; + + return _supports; + } + + _supports[0] = vertexA; + _supports[1] = vertexC; + + return _supports; + }; + + /* + * + * Properties Documentation + * + */ + + /** + * A reference to the pair using this collision record, if there is one. + * + * @property pair + * @type {pair|null} + * @default null + */ + + /** + * A flag that indicates if the bodies were colliding when the collision was last updated. + * + * @property collided + * @type boolean + * @default false + */ + + /** + * The first body part represented by the collision (see also `collision.parentA`). + * + * @property bodyA + * @type body + */ + + /** + * The second body part represented by the collision (see also `collision.parentB`). + * + * @property bodyB + * @type body + */ + + /** + * The first body represented by the collision (i.e. `collision.bodyA.parent`). + * + * @property parentA + * @type body + */ + + /** + * The second body represented by the collision (i.e. `collision.bodyB.parent`). + * + * @property parentB + * @type body + */ + + /** + * A `Number` that represents the minimum separating distance between the bodies along the collision normal. + * + * @readOnly + * @property depth + * @type number + * @default 0 + */ + + /** + * A normalised `Vector` that represents the direction between the bodies that provides the minimum separating distance. + * + * @property normal + * @type vector + * @default { x: 0, y: 0 } + */ + + /** + * A normalised `Vector` that is the tangent direction to the collision normal. + * + * @property tangent + * @type vector + * @default { x: 0, y: 0 } + */ + + /** + * A `Vector` that represents the direction and depth of the collision. + * + * @property penetration + * @type vector + * @default { x: 0, y: 0 } + */ + + /** + * An array of body vertices that represent the support points in the collision. + * These are the deepest vertices (along the collision normal) of each body that are contained by the other body's vertices. + * + * @property supports + * @type vector[] + * @default [] + */ + +})(); + + +/***/ }), + +/***/ 17319: +/***/ ((module) => { + +/** +* The `Matter.Contact` module contains methods for creating and manipulating collision contacts. +* +* @class Contact +*/ + +var Contact = {}; + +module.exports = Contact; + +(function() { + + /** + * Creates a new contact. + * @method create + * @param {vertex} vertex + * @return {contact} A new contact + */ + Contact.create = function(vertex) { + return { + vertex: vertex, + normalImpulse: 0, + tangentImpulse: 0 + }; + }; + +})(); + + +/***/ }), + +/***/ 13657: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter.Detector` module contains methods for efficiently detecting collisions between a list of bodies using a broadphase algorithm. +* +* @class Detector +*/ + +var Detector = {}; + +module.exports = Detector; + +var Common = __webpack_require__(68758); +var Collision = __webpack_require__(63454); + +(function() { + + /** + * Creates a new collision detector. + * @method create + * @param {} options + * @return {detector} A new collision detector + */ + Detector.create = function(options) { + var defaults = { + bodies: [], + pairs: null + }; + + return Common.extend(defaults, options); + }; + + /** + * Sets the list of bodies in the detector. + * @method setBodies + * @param {detector} detector + * @param {body[]} bodies + */ + Detector.setBodies = function(detector, bodies) { + detector.bodies = bodies.slice(0); + }; + + /** + * Clears the detector including its list of bodies. + * @method clear + * @param {detector} detector + */ + Detector.clear = function(detector) { + detector.bodies = []; + }; + + /** + * Efficiently finds all collisions among all the bodies in `detector.bodies` using a broadphase algorithm. + * + * _Note:_ The specific ordering of collisions returned is not guaranteed between releases and may change for performance reasons. + * If a specific ordering is required then apply a sort to the resulting array. + * @method collisions + * @param {detector} detector + * @return {collision[]} collisions + */ + Detector.collisions = function(detector) { + var collisions = [], + pairs = detector.pairs, + bodies = detector.bodies, + bodiesLength = bodies.length, + canCollide = Detector.canCollide, + collides = Collision.collides, + i, + j; + + bodies.sort(Detector._compareBoundsX); + + for (i = 0; i < bodiesLength; i++) { + var bodyA = bodies[i], + boundsA = bodyA.bounds, + boundXMax = bodyA.bounds.max.x, + boundYMax = bodyA.bounds.max.y, + boundYMin = bodyA.bounds.min.y, + bodyAStatic = bodyA.isStatic || bodyA.isSleeping, + partsALength = bodyA.parts.length, + partsASingle = partsALength === 1; + + for (j = i + 1; j < bodiesLength; j++) { + var bodyB = bodies[j], + boundsB = bodyB.bounds; + + if (boundsB.min.x > boundXMax) { + break; + } + + if (boundYMax < boundsB.min.y || boundYMin > boundsB.max.y) { + continue; + } + + if (bodyAStatic && (bodyB.isStatic || bodyB.isSleeping)) { + continue; + } + + if (!canCollide(bodyA.collisionFilter, bodyB.collisionFilter)) { + continue; + } + + var partsBLength = bodyB.parts.length; + + if (partsASingle && partsBLength === 1) { + var collision = collides(bodyA, bodyB, pairs); + + if (collision) { + collisions.push(collision); + } + } else { + var partsAStart = partsALength > 1 ? 1 : 0, + partsBStart = partsBLength > 1 ? 1 : 0; + + for (var k = partsAStart; k < partsALength; k++) { + var partA = bodyA.parts[k], + boundsA = partA.bounds; + + for (var z = partsBStart; z < partsBLength; z++) { + var partB = bodyB.parts[z], + boundsB = partB.bounds; + + if (boundsA.min.x > boundsB.max.x || boundsA.max.x < boundsB.min.x + || boundsA.max.y < boundsB.min.y || boundsA.min.y > boundsB.max.y) { + continue; + } + + var collision = collides(partA, partB, pairs); + + if (collision) { + collisions.push(collision); + } + } + } + } + } + } + + return collisions; + }; + + /** + * Returns `true` if both supplied collision filters will allow a collision to occur. + * See `body.collisionFilter` for more information. + * @method canCollide + * @param {} filterA + * @param {} filterB + * @return {bool} `true` if collision can occur + */ + Detector.canCollide = function(filterA, filterB) { + if (filterA.group === filterB.group && filterA.group !== 0) + return filterA.group > 0; + + return (filterA.mask & filterB.category) !== 0 && (filterB.mask & filterA.category) !== 0; + }; + + /** + * The comparison function used in the broadphase algorithm. + * Returns the signed delta of the bodies bounds on the x-axis. + * @private + * @method _sortCompare + * @param {body} bodyA + * @param {body} bodyB + * @return {number} The signed delta used for sorting + */ + Detector._compareBoundsX = function(bodyA, bodyB) { + return bodyA.bounds.min.x - bodyB.bounds.min.x; + }; + + /* + * + * Properties Documentation + * + */ + + /** + * The array of `Matter.Body` between which the detector finds collisions. + * + * _Note:_ The order of bodies in this array _is not fixed_ and will be continually managed by the detector. + * @property bodies + * @type body[] + * @default [] + */ + + /** + * Optional. A `Matter.Pairs` object from which previous collision objects may be reused. Intended for internal `Matter.Engine` usage. + * @property pairs + * @type {pairs|null} + * @default null + */ + +})(); + + +/***/ }), + +/***/ 70584: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter.Pair` module contains methods for creating and manipulating collision pairs. +* +* @class Pair +*/ + +var Pair = {}; + +module.exports = Pair; + +var Contact = __webpack_require__(17319); + +(function() { + + /** + * Creates a pair. + * @method create + * @param {collision} collision + * @param {number} timestamp + * @return {pair} A new pair + */ + Pair.create = function(collision, timestamp) { + var bodyA = collision.bodyA, + bodyB = collision.bodyB; + + var pair = { + id: Pair.id(bodyA, bodyB), + bodyA: bodyA, + bodyB: bodyB, + collision: collision, + contacts: [], + activeContacts: [], + separation: 0, + isActive: true, + confirmedActive: true, + isSensor: bodyA.isSensor || bodyB.isSensor, + timeCreated: timestamp, + timeUpdated: timestamp, + inverseMass: 0, + friction: 0, + frictionStatic: 0, + restitution: 0, + slop: 0 + }; + + Pair.update(pair, collision, timestamp); + + return pair; + }; + + /** + * Updates a pair given a collision. + * @method update + * @param {pair} pair + * @param {collision} collision + * @param {number} timestamp + */ + Pair.update = function(pair, collision, timestamp) { + var contacts = pair.contacts, + supports = collision.supports, + activeContacts = pair.activeContacts, + parentA = collision.parentA, + parentB = collision.parentB, + parentAVerticesLength = parentA.vertices.length; + + pair.isActive = true; + pair.timeUpdated = timestamp; + pair.collision = collision; + pair.separation = collision.depth; + pair.inverseMass = parentA.inverseMass + parentB.inverseMass; + pair.friction = parentA.friction < parentB.friction ? parentA.friction : parentB.friction; + pair.frictionStatic = parentA.frictionStatic > parentB.frictionStatic ? parentA.frictionStatic : parentB.frictionStatic; + pair.restitution = parentA.restitution > parentB.restitution ? parentA.restitution : parentB.restitution; + pair.slop = parentA.slop > parentB.slop ? parentA.slop : parentB.slop; + + collision.pair = pair; + activeContacts.length = 0; + + for (var i = 0; i < supports.length; i++) { + var support = supports[i], + contactId = support.body === parentA ? support.index : parentAVerticesLength + support.index, + contact = contacts[contactId]; + + if (contact) { + activeContacts.push(contact); + } else { + activeContacts.push(contacts[contactId] = Contact.create(support)); + } + } + }; + + /** + * Set a pair as active or inactive. + * @method setActive + * @param {pair} pair + * @param {bool} isActive + * @param {number} timestamp + */ + Pair.setActive = function(pair, isActive, timestamp) { + if (isActive) { + pair.isActive = true; + pair.timeUpdated = timestamp; + } else { + pair.isActive = false; + pair.activeContacts.length = 0; + } + }; + + /** + * Get the id for the given pair. + * @method id + * @param {body} bodyA + * @param {body} bodyB + * @return {string} Unique pairId + */ + Pair.id = function(bodyA, bodyB) { + if (bodyA.id < bodyB.id) { + return 'A' + bodyA.id + 'B' + bodyB.id; + } else { + return 'A' + bodyB.id + 'B' + bodyA.id; + } + }; + +})(); + + +/***/ }), + +/***/ 91327: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter.Pairs` module contains methods for creating and manipulating collision pair sets. +* +* @class Pairs +*/ + +var Pairs = {}; + +module.exports = Pairs; + +var Pair = __webpack_require__(70584); +var Common = __webpack_require__(68758); + +(function() { + + /** + * Creates a new pairs structure. + * @method create + * @param {object} options + * @return {pairs} A new pairs structure + */ + Pairs.create = function(options) { + return Common.extend({ + table: {}, + list: [], + collisionStart: [], + collisionActive: [], + collisionEnd: [] + }, options); + }; + + /** + * Updates pairs given a list of collisions. + * @method update + * @param {object} pairs + * @param {collision[]} collisions + * @param {number} timestamp + */ + Pairs.update = function(pairs, collisions, timestamp) { + var pairsList = pairs.list, + pairsListLength = pairsList.length, + pairsTable = pairs.table, + collisionsLength = collisions.length, + collisionStart = pairs.collisionStart, + collisionEnd = pairs.collisionEnd, + collisionActive = pairs.collisionActive, + collision, + pairIndex, + pair, + i; + + // clear collision state arrays, but maintain old reference + collisionStart.length = 0; + collisionEnd.length = 0; + collisionActive.length = 0; + + for (i = 0; i < pairsListLength; i++) { + pairsList[i].confirmedActive = false; + } + + for (i = 0; i < collisionsLength; i++) { + collision = collisions[i]; + pair = collision.pair; + + if (pair) { + // pair already exists (but may or may not be active) + if (pair.isActive) { + // pair exists and is active + collisionActive.push(pair); + } else { + // pair exists but was inactive, so a collision has just started again + collisionStart.push(pair); + } + + // update the pair + Pair.update(pair, collision, timestamp); + pair.confirmedActive = true; + } else { + // pair did not exist, create a new pair + pair = Pair.create(collision, timestamp); + pairsTable[pair.id] = pair; + + // push the new pair + collisionStart.push(pair); + pairsList.push(pair); + } + } + + // find pairs that are no longer active + var removePairIndex = []; + pairsListLength = pairsList.length; + + for (i = 0; i < pairsListLength; i++) { + pair = pairsList[i]; + + if (!pair.confirmedActive) { + Pair.setActive(pair, false, timestamp); + collisionEnd.push(pair); + + if (!pair.collision.bodyA.isSleeping && !pair.collision.bodyB.isSleeping) { + removePairIndex.push(i); + } + } + } + + // remove inactive pairs + for (i = 0; i < removePairIndex.length; i++) { + pairIndex = removePairIndex[i] - i; + pair = pairsList[pairIndex]; + pairsList.splice(pairIndex, 1); + delete pairsTable[pair.id]; + } + }; + + /** + * Clears the given pairs structure. + * @method clear + * @param {pairs} pairs + * @return {pairs} pairs + */ + Pairs.clear = function(pairs) { + pairs.table = {}; + pairs.list.length = 0; + pairs.collisionStart.length = 0; + pairs.collisionActive.length = 0; + pairs.collisionEnd.length = 0; + return pairs; + }; + +})(); + + +/***/ }), + +/***/ 13390: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter.Query` module contains methods for performing collision queries. +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class Query +*/ + +var Query = {}; + +module.exports = Query; + +var Vector = __webpack_require__(10438); +var Collision = __webpack_require__(63454); +var Bounds = __webpack_require__(84091); +var Bodies = __webpack_require__(68516); +var Vertices = __webpack_require__(39745); + +(function() { + + /** + * Returns a list of collisions between `body` and `bodies`. + * @method collides + * @param {body} body + * @param {body[]} bodies + * @return {collision[]} Collisions + */ + Query.collides = function(body, bodies) { + var collisions = [], + bodiesLength = bodies.length, + bounds = body.bounds, + collides = Collision.collides, + overlaps = Bounds.overlaps; + + for (var i = 0; i < bodiesLength; i++) { + var bodyA = bodies[i], + partsALength = bodyA.parts.length, + partsAStart = partsALength === 1 ? 0 : 1; + + // Phaser addition - skip same body checks + if (body === bodyA) + { + continue; + } + + if (overlaps(bodyA.bounds, bounds)) { + for (var j = partsAStart; j < partsALength; j++) { + var part = bodyA.parts[j]; + + if (overlaps(part.bounds, bounds)) { + var collision = collides(part, body); + + if (collision) { + collisions.push(collision); + break; + } + } + } + } + } + + return collisions; + }; + + /** + * Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided. + * @method ray + * @param {body[]} bodies + * @param {vector} startPoint + * @param {vector} endPoint + * @param {number} [rayWidth] + * @return {collision[]} Collisions + */ + Query.ray = function(bodies, startPoint, endPoint, rayWidth) { + rayWidth = rayWidth || 1e-100; + + var rayAngle = Vector.angle(startPoint, endPoint), + rayLength = Vector.magnitude(Vector.sub(startPoint, endPoint)), + rayX = (endPoint.x + startPoint.x) * 0.5, + rayY = (endPoint.y + startPoint.y) * 0.5, + ray = Bodies.rectangle(rayX, rayY, rayLength, rayWidth, { angle: rayAngle }), + collisions = Query.collides(ray, bodies); + + for (var i = 0; i < collisions.length; i += 1) { + var collision = collisions[i]; + collision.body = collision.bodyB = collision.bodyA; + } + + return collisions; + }; + + /** + * Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies. + * @method region + * @param {body[]} bodies + * @param {bounds} bounds + * @param {bool} [outside=false] + * @return {body[]} The bodies matching the query + */ + Query.region = function(bodies, bounds, outside) { + var result = []; + + for (var i = 0; i < bodies.length; i++) { + var body = bodies[i], + overlaps = Bounds.overlaps(body.bounds, bounds); + if ((overlaps && !outside) || (!overlaps && outside)) + result.push(body); + } + + return result; + }; + + /** + * Returns all bodies whose vertices contain the given point, from the given set of bodies. + * @method point + * @param {body[]} bodies + * @param {vector} point + * @return {body[]} The bodies matching the query + */ + Query.point = function(bodies, point) { + var result = []; + + for (var i = 0; i < bodies.length; i++) { + var body = bodies[i]; + + if (Bounds.contains(body.bounds, point)) { + for (var j = body.parts.length === 1 ? 0 : 1; j < body.parts.length; j++) { + var part = body.parts[j]; + + if (Bounds.contains(part.bounds, point) + && Vertices.contains(part.vertices, point)) { + result.push(body); + break; + } + } + } + } + + return result; + }; + +})(); + + +/***/ }), + +/***/ 44272: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter.Resolver` module contains methods for resolving collision pairs. +* +* @class Resolver +*/ + +var Resolver = {}; + +module.exports = Resolver; + +var Vertices = __webpack_require__(39745); +var Common = __webpack_require__(68758); +var Bounds = __webpack_require__(84091); + +(function() { + + Resolver._restingThresh = 2; + Resolver._restingThreshTangent = Math.sqrt(6); + Resolver._positionDampen = 0.9; + Resolver._positionWarming = 0.8; + Resolver._frictionNormalMultiplier = 5; + Resolver._frictionMaxStatic = Number.MAX_VALUE; + + /** + * Prepare pairs for position solving. + * @method preSolvePosition + * @param {pair[]} pairs + */ + Resolver.preSolvePosition = function(pairs) { + var i, + pair, + activeCount, + pairsLength = pairs.length; + + // find total contacts on each body + for (i = 0; i < pairsLength; i++) { + pair = pairs[i]; + + if (!pair.isActive) + continue; + + activeCount = pair.activeContacts.length; + pair.collision.parentA.totalContacts += activeCount; + pair.collision.parentB.totalContacts += activeCount; + } + }; + + /** + * Find a solution for pair positions. + * @method solvePosition + * @param {pair[]} pairs + * @param {number} delta + * @param {number} [damping=1] + */ + Resolver.solvePosition = function(pairs, delta, damping) { + var i, + pair, + collision, + bodyA, + bodyB, + normal, + contactShare, + positionImpulse, + positionDampen = Resolver._positionDampen * (damping || 1), + slopDampen = Common.clamp(delta / Common._baseDelta, 0, 1), + pairsLength = pairs.length; + + // find impulses required to resolve penetration + for (i = 0; i < pairsLength; i++) { + pair = pairs[i]; + + if (!pair.isActive || pair.isSensor) + continue; + + collision = pair.collision; + bodyA = collision.parentA; + bodyB = collision.parentB; + normal = collision.normal; + + // get current separation between body edges involved in collision + pair.separation = + normal.x * (bodyB.positionImpulse.x + collision.penetration.x - bodyA.positionImpulse.x) + + normal.y * (bodyB.positionImpulse.y + collision.penetration.y - bodyA.positionImpulse.y); + } + + for (i = 0; i < pairsLength; i++) { + pair = pairs[i]; + + if (!pair.isActive || pair.isSensor) + continue; + + collision = pair.collision; + bodyA = collision.parentA; + bodyB = collision.parentB; + normal = collision.normal; + positionImpulse = pair.separation - pair.slop * slopDampen; + + if (bodyA.isStatic || bodyB.isStatic) + positionImpulse *= 2; + + if (!(bodyA.isStatic || bodyA.isSleeping)) { + contactShare = positionDampen / bodyA.totalContacts; + bodyA.positionImpulse.x += normal.x * positionImpulse * contactShare; + bodyA.positionImpulse.y += normal.y * positionImpulse * contactShare; + } + + if (!(bodyB.isStatic || bodyB.isSleeping)) { + contactShare = positionDampen / bodyB.totalContacts; + bodyB.positionImpulse.x -= normal.x * positionImpulse * contactShare; + bodyB.positionImpulse.y -= normal.y * positionImpulse * contactShare; + } + } + }; + + /** + * Apply position resolution. + * @method postSolvePosition + * @param {body[]} bodies + */ + Resolver.postSolvePosition = function(bodies) { + var positionWarming = Resolver._positionWarming, + bodiesLength = bodies.length, + verticesTranslate = Vertices.translate, + boundsUpdate = Bounds.update; + + for (var i = 0; i < bodiesLength; i++) { + var body = bodies[i], + positionImpulse = body.positionImpulse, + positionImpulseX = positionImpulse.x, + positionImpulseY = positionImpulse.y, + velocity = body.velocity; + + // reset contact count + body.totalContacts = 0; + + if (positionImpulseX !== 0 || positionImpulseY !== 0) { + // update body geometry + for (var j = 0; j < body.parts.length; j++) { + var part = body.parts[j]; + verticesTranslate(part.vertices, positionImpulse); + boundsUpdate(part.bounds, part.vertices, velocity); + part.position.x += positionImpulseX; + part.position.y += positionImpulseY; + } + + // move the body without changing velocity + body.positionPrev.x += positionImpulseX; + body.positionPrev.y += positionImpulseY; + + if (positionImpulseX * velocity.x + positionImpulseY * velocity.y < 0) { + // reset cached impulse if the body has velocity along it + positionImpulse.x = 0; + positionImpulse.y = 0; + } else { + // warm the next iteration + positionImpulse.x *= positionWarming; + positionImpulse.y *= positionWarming; + } + } + } + }; + + /** + * Prepare pairs for velocity solving. + * @method preSolveVelocity + * @param {pair[]} pairs + */ + Resolver.preSolveVelocity = function(pairs) { + var pairsLength = pairs.length, + i, + j; + + for (i = 0; i < pairsLength; i++) { + var pair = pairs[i]; + + if (!pair.isActive || pair.isSensor) + continue; + + var contacts = pair.activeContacts, + contactsLength = contacts.length, + collision = pair.collision, + bodyA = collision.parentA, + bodyB = collision.parentB, + normal = collision.normal, + tangent = collision.tangent; + + // resolve each contact + for (j = 0; j < contactsLength; j++) { + var contact = contacts[j], + contactVertex = contact.vertex, + normalImpulse = contact.normalImpulse, + tangentImpulse = contact.tangentImpulse; + + if (normalImpulse !== 0 || tangentImpulse !== 0) { + // total impulse from contact + var impulseX = normal.x * normalImpulse + tangent.x * tangentImpulse, + impulseY = normal.y * normalImpulse + tangent.y * tangentImpulse; + + // apply impulse from contact + if (!(bodyA.isStatic || bodyA.isSleeping)) { + bodyA.positionPrev.x += impulseX * bodyA.inverseMass; + bodyA.positionPrev.y += impulseY * bodyA.inverseMass; + bodyA.anglePrev += bodyA.inverseInertia * ( + (contactVertex.x - bodyA.position.x) * impulseY + - (contactVertex.y - bodyA.position.y) * impulseX + ); + } + + if (!(bodyB.isStatic || bodyB.isSleeping)) { + bodyB.positionPrev.x -= impulseX * bodyB.inverseMass; + bodyB.positionPrev.y -= impulseY * bodyB.inverseMass; + bodyB.anglePrev -= bodyB.inverseInertia * ( + (contactVertex.x - bodyB.position.x) * impulseY + - (contactVertex.y - bodyB.position.y) * impulseX + ); + } + } + } + } + }; + + /** + * Find a solution for pair velocities. + * @method solveVelocity + * @param {pair[]} pairs + * @param {number} delta + */ + Resolver.solveVelocity = function(pairs, delta) { + var timeScale = delta / Common._baseDelta, + timeScaleSquared = timeScale * timeScale, + timeScaleCubed = timeScaleSquared * timeScale, + restingThresh = -Resolver._restingThresh * timeScale, + restingThreshTangent = Resolver._restingThreshTangent, + frictionNormalMultiplier = Resolver._frictionNormalMultiplier * timeScale, + frictionMaxStatic = Resolver._frictionMaxStatic, + pairsLength = pairs.length, + tangentImpulse, + maxFriction, + i, + j; + + for (i = 0; i < pairsLength; i++) { + var pair = pairs[i]; + + if (!pair.isActive || pair.isSensor) + continue; + + var collision = pair.collision, + bodyA = collision.parentA, + bodyB = collision.parentB, + bodyAVelocity = bodyA.velocity, + bodyBVelocity = bodyB.velocity, + normalX = collision.normal.x, + normalY = collision.normal.y, + tangentX = collision.tangent.x, + tangentY = collision.tangent.y, + contacts = pair.activeContacts, + contactsLength = contacts.length, + contactShare = 1 / contactsLength, + inverseMassTotal = bodyA.inverseMass + bodyB.inverseMass, + friction = pair.friction * pair.frictionStatic * frictionNormalMultiplier; + + // update body velocities + bodyAVelocity.x = bodyA.position.x - bodyA.positionPrev.x; + bodyAVelocity.y = bodyA.position.y - bodyA.positionPrev.y; + bodyBVelocity.x = bodyB.position.x - bodyB.positionPrev.x; + bodyBVelocity.y = bodyB.position.y - bodyB.positionPrev.y; + bodyA.angularVelocity = bodyA.angle - bodyA.anglePrev; + bodyB.angularVelocity = bodyB.angle - bodyB.anglePrev; + + // resolve each contact + for (j = 0; j < contactsLength; j++) { + var contact = contacts[j], + contactVertex = contact.vertex; + + var offsetAX = contactVertex.x - bodyA.position.x, + offsetAY = contactVertex.y - bodyA.position.y, + offsetBX = contactVertex.x - bodyB.position.x, + offsetBY = contactVertex.y - bodyB.position.y; + + var velocityPointAX = bodyAVelocity.x - offsetAY * bodyA.angularVelocity, + velocityPointAY = bodyAVelocity.y + offsetAX * bodyA.angularVelocity, + velocityPointBX = bodyBVelocity.x - offsetBY * bodyB.angularVelocity, + velocityPointBY = bodyBVelocity.y + offsetBX * bodyB.angularVelocity; + + var relativeVelocityX = velocityPointAX - velocityPointBX, + relativeVelocityY = velocityPointAY - velocityPointBY; + + var normalVelocity = normalX * relativeVelocityX + normalY * relativeVelocityY, + tangentVelocity = tangentX * relativeVelocityX + tangentY * relativeVelocityY; + + // coulomb friction + var normalOverlap = pair.separation + normalVelocity; + var normalForce = Math.min(normalOverlap, 1); + normalForce = normalOverlap < 0 ? 0 : normalForce; + + var frictionLimit = normalForce * friction; + + if (tangentVelocity < -frictionLimit || tangentVelocity > frictionLimit) { + maxFriction = (tangentVelocity > 0 ? tangentVelocity : -tangentVelocity); + tangentImpulse = pair.friction * (tangentVelocity > 0 ? 1 : -1) * timeScaleCubed; + + if (tangentImpulse < -maxFriction) { + tangentImpulse = -maxFriction; + } else if (tangentImpulse > maxFriction) { + tangentImpulse = maxFriction; + } + } else { + tangentImpulse = tangentVelocity; + maxFriction = frictionMaxStatic; + } + + // account for mass, inertia and contact offset + var oAcN = offsetAX * normalY - offsetAY * normalX, + oBcN = offsetBX * normalY - offsetBY * normalX, + share = contactShare / (inverseMassTotal + bodyA.inverseInertia * oAcN * oAcN + bodyB.inverseInertia * oBcN * oBcN); + + // raw impulses + var normalImpulse = (1 + pair.restitution) * normalVelocity * share; + tangentImpulse *= share; + + // handle high velocity and resting collisions separately + if (normalVelocity < restingThresh) { + // high normal velocity so clear cached contact normal impulse + contact.normalImpulse = 0; + } else { + // solve resting collision constraints using Erin Catto's method (GDC08) + // impulse constraint tends to 0 + var contactNormalImpulse = contact.normalImpulse; + contact.normalImpulse += normalImpulse; + if (contact.normalImpulse > 0) contact.normalImpulse = 0; + normalImpulse = contact.normalImpulse - contactNormalImpulse; + } + + // handle high velocity and resting collisions separately + if (tangentVelocity < -restingThreshTangent || tangentVelocity > restingThreshTangent) { + // high tangent velocity so clear cached contact tangent impulse + contact.tangentImpulse = 0; + } else { + // solve resting collision constraints using Erin Catto's method (GDC08) + // tangent impulse tends to -tangentSpeed or +tangentSpeed + var contactTangentImpulse = contact.tangentImpulse; + contact.tangentImpulse += tangentImpulse; + if (contact.tangentImpulse < -maxFriction) contact.tangentImpulse = -maxFriction; + if (contact.tangentImpulse > maxFriction) contact.tangentImpulse = maxFriction; + tangentImpulse = contact.tangentImpulse - contactTangentImpulse; + } + + // total impulse from contact + var impulseX = normalX * normalImpulse + tangentX * tangentImpulse, + impulseY = normalY * normalImpulse + tangentY * tangentImpulse; + + // apply impulse from contact + if (!(bodyA.isStatic || bodyA.isSleeping)) { + bodyA.positionPrev.x += impulseX * bodyA.inverseMass; + bodyA.positionPrev.y += impulseY * bodyA.inverseMass; + bodyA.anglePrev += (offsetAX * impulseY - offsetAY * impulseX) * bodyA.inverseInertia; + } + + if (!(bodyB.isStatic || bodyB.isSleeping)) { + bodyB.positionPrev.x -= impulseX * bodyB.inverseMass; + bodyB.positionPrev.y -= impulseY * bodyB.inverseMass; + bodyB.anglePrev -= (offsetBX * impulseY - offsetBY * impulseX) * bodyB.inverseInertia; + } + } + } + }; + +})(); + + +/***/ }), + +/***/ 52838: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter.Constraint` module contains methods for creating and manipulating constraints. +* Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position). +* The stiffness of constraints can be modified to create springs or elastic. +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class Constraint +*/ + +var Constraint = {}; + +module.exports = Constraint; + +var Vertices = __webpack_require__(39745); +var Vector = __webpack_require__(10438); +var Sleeping = __webpack_require__(22806); +var Bounds = __webpack_require__(84091); +var Axes = __webpack_require__(50658); +var Common = __webpack_require__(68758); + +(function() { + + Constraint._warming = 0.4; + Constraint._torqueDampen = 1; + Constraint._minLength = 0.000001; + + /** + * Creates a new constraint. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` value (e.g. `0.7` or above). + * If the constraint is unstable, try lowering the `stiffness` value and / or increasing `engine.constraintIterations`. + * For compound bodies, constraints must be applied to the parent body (not one of its parts). + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {} options + * @return {constraint} constraint + */ + Constraint.create = function(options) { + var constraint = options; + + // if bodies defined but no points, use body centre + if (constraint.bodyA && !constraint.pointA) + constraint.pointA = { x: 0, y: 0 }; + if (constraint.bodyB && !constraint.pointB) + constraint.pointB = { x: 0, y: 0 }; + + // calculate static length using initial world space points + var initialPointA = constraint.bodyA ? Vector.add(constraint.bodyA.position, constraint.pointA) : constraint.pointA, + initialPointB = constraint.bodyB ? Vector.add(constraint.bodyB.position, constraint.pointB) : constraint.pointB, + length = Vector.magnitude(Vector.sub(initialPointA, initialPointB)); + + constraint.length = typeof constraint.length !== 'undefined' ? constraint.length : length; + + // option defaults + constraint.id = constraint.id || Common.nextId(); + constraint.label = constraint.label || 'Constraint'; + constraint.type = 'constraint'; + constraint.stiffness = constraint.stiffness || (constraint.length > 0 ? 1 : 0.7); + constraint.damping = constraint.damping || 0; + constraint.angularStiffness = constraint.angularStiffness || 0; + constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA; + constraint.angleB = constraint.bodyB ? constraint.bodyB.angle : constraint.angleB; + constraint.plugin = {}; + + // render + var render = { + visible: true, + type: 'line', + anchors: true, + lineColor: null, // custom Phaser property + lineOpacity: null, // custom Phaser property + lineThickness: null, // custom Phaser property + pinSize: null, // custom Phaser property + anchorColor: null, // custom Phaser property + anchorSize: null // custom Phaser property + }; + + if (constraint.length === 0 && constraint.stiffness > 0.1) { + render.type = 'pin'; + render.anchors = false; + } else if (constraint.stiffness < 0.9) { + render.type = 'spring'; + } + + constraint.render = Common.extend(render, constraint.render); + + return constraint; + }; + + /** + * Prepares for solving by constraint warming. + * @private + * @method preSolveAll + * @param {body[]} bodies + */ + Constraint.preSolveAll = function(bodies) { + for (var i = 0; i < bodies.length; i += 1) { + var body = bodies[i], + impulse = body.constraintImpulse; + + if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) { + continue; + } + + body.position.x += impulse.x; + body.position.y += impulse.y; + body.angle += impulse.angle; + } + }; + + /** + * Solves all constraints in a list of collisions. + * @private + * @method solveAll + * @param {constraint[]} constraints + * @param {number} delta + */ + Constraint.solveAll = function(constraints, delta) { + var timeScale = Common.clamp(delta / Common._baseDelta, 0, 1); + // Solve fixed constraints first. + for (var i = 0; i < constraints.length; i += 1) { + var constraint = constraints[i], + fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic), + fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic); + + if (fixedA || fixedB) { + Constraint.solve(constraints[i], timeScale); + } + } + + // Solve free constraints last. + for (i = 0; i < constraints.length; i += 1) { + constraint = constraints[i]; + fixedA = !constraint.bodyA || (constraint.bodyA && constraint.bodyA.isStatic); + fixedB = !constraint.bodyB || (constraint.bodyB && constraint.bodyB.isStatic); + + if (!fixedA && !fixedB) { + Constraint.solve(constraints[i], timeScale); + } + } + }; + + /** + * Solves a distance constraint with Gauss-Siedel method. + * @private + * @method solve + * @param {constraint} constraint + * @param {number} timeScale + */ + Constraint.solve = function(constraint, timeScale) { + var bodyA = constraint.bodyA, + bodyB = constraint.bodyB, + pointA = constraint.pointA, + pointB = constraint.pointB; + + if (!bodyA && !bodyB) + return; + + // update reference angle + if (bodyA && !bodyA.isStatic) { + Vector.rotate(pointA, bodyA.angle - constraint.angleA, pointA); + constraint.angleA = bodyA.angle; + } + + // update reference angle + if (bodyB && !bodyB.isStatic) { + Vector.rotate(pointB, bodyB.angle - constraint.angleB, pointB); + constraint.angleB = bodyB.angle; + } + + var pointAWorld = pointA, + pointBWorld = pointB; + + if (bodyA) pointAWorld = Vector.add(bodyA.position, pointA); + if (bodyB) pointBWorld = Vector.add(bodyB.position, pointB); + + if (!pointAWorld || !pointBWorld) + return; + + var delta = Vector.sub(pointAWorld, pointBWorld), + currentLength = Vector.magnitude(delta); + + // prevent singularity + if (currentLength < Constraint._minLength) { + currentLength = Constraint._minLength; + } + + // solve distance constraint with Gauss-Siedel method + var difference = (currentLength - constraint.length) / currentLength, + isRigid = constraint.stiffness >= 1 || constraint.length === 0, + stiffness = isRigid ? constraint.stiffness * timeScale + : constraint.stiffness * timeScale * timeScale, + damping = constraint.damping * timeScale, + force = Vector.mult(delta, difference * stiffness), + massTotal = (bodyA ? bodyA.inverseMass : 0) + (bodyB ? bodyB.inverseMass : 0), + inertiaTotal = (bodyA ? bodyA.inverseInertia : 0) + (bodyB ? bodyB.inverseInertia : 0), + resistanceTotal = massTotal + inertiaTotal, + torque, + share, + normal, + normalVelocity, + relativeVelocity; + + if (damping > 0) { + var zero = Vector.create(); + normal = Vector.div(delta, currentLength); + + relativeVelocity = Vector.sub( + bodyB && Vector.sub(bodyB.position, bodyB.positionPrev) || zero, + bodyA && Vector.sub(bodyA.position, bodyA.positionPrev) || zero + ); + + normalVelocity = Vector.dot(normal, relativeVelocity); + } + + if (bodyA && !bodyA.isStatic) { + share = bodyA.inverseMass / massTotal; + + // keep track of applied impulses for post solving + bodyA.constraintImpulse.x -= force.x * share; + bodyA.constraintImpulse.y -= force.y * share; + + // apply forces + bodyA.position.x -= force.x * share; + bodyA.position.y -= force.y * share; + + // apply damping + if (damping > 0) { + bodyA.positionPrev.x -= damping * normal.x * normalVelocity * share; + bodyA.positionPrev.y -= damping * normal.y * normalVelocity * share; + } + + // apply torque + torque = (Vector.cross(pointA, force) / resistanceTotal) * Constraint._torqueDampen * bodyA.inverseInertia * (1 - constraint.angularStiffness); + bodyA.constraintImpulse.angle -= torque; + bodyA.angle -= torque; + } + + if (bodyB && !bodyB.isStatic) { + share = bodyB.inverseMass / massTotal; + + // keep track of applied impulses for post solving + bodyB.constraintImpulse.x += force.x * share; + bodyB.constraintImpulse.y += force.y * share; + + // apply forces + bodyB.position.x += force.x * share; + bodyB.position.y += force.y * share; + + // apply damping + if (damping > 0) { + bodyB.positionPrev.x += damping * normal.x * normalVelocity * share; + bodyB.positionPrev.y += damping * normal.y * normalVelocity * share; + } + + // apply torque + torque = (Vector.cross(pointB, force) / resistanceTotal) * Constraint._torqueDampen * bodyB.inverseInertia * (1 - constraint.angularStiffness); + bodyB.constraintImpulse.angle += torque; + bodyB.angle += torque; + } + + }; + + /** + * Performs body updates required after solving constraints. + * @private + * @method postSolveAll + * @param {body[]} bodies + */ + Constraint.postSolveAll = function(bodies) { + for (var i = 0; i < bodies.length; i++) { + var body = bodies[i], + impulse = body.constraintImpulse; + + if (body.isStatic || (impulse.x === 0 && impulse.y === 0 && impulse.angle === 0)) { + continue; + } + + Sleeping.set(body, false); + + // update geometry and reset + for (var j = 0; j < body.parts.length; j++) { + var part = body.parts[j]; + + Vertices.translate(part.vertices, impulse); + + if (j > 0) { + part.position.x += impulse.x; + part.position.y += impulse.y; + } + + if (impulse.angle !== 0) { + Vertices.rotate(part.vertices, impulse.angle, body.position); + Axes.rotate(part.axes, impulse.angle); + if (j > 0) { + Vector.rotateAbout(part.position, impulse.angle, body.position, part.position); + } + } + + Bounds.update(part.bounds, part.vertices, body.velocity); + } + + // dampen the cached impulse for warming next step + impulse.angle *= Constraint._warming; + impulse.x *= Constraint._warming; + impulse.y *= Constraint._warming; + } + }; + + /** + * Returns the world-space position of `constraint.pointA`, accounting for `constraint.bodyA`. + * @method pointAWorld + * @param {constraint} constraint + * @returns {vector} the world-space position + */ + Constraint.pointAWorld = function(constraint) { + return { + x: (constraint.bodyA ? constraint.bodyA.position.x : 0) + + (constraint.pointA ? constraint.pointA.x : 0), + y: (constraint.bodyA ? constraint.bodyA.position.y : 0) + + (constraint.pointA ? constraint.pointA.y : 0) + }; + }; + + /** + * Returns the world-space position of `constraint.pointB`, accounting for `constraint.bodyB`. + * @method pointBWorld + * @param {constraint} constraint + * @returns {vector} the world-space position + */ + Constraint.pointBWorld = function(constraint) { + return { + x: (constraint.bodyB ? constraint.bodyB.position.x : 0) + + (constraint.pointB ? constraint.pointB.x : 0), + y: (constraint.bodyB ? constraint.bodyB.position.y : 0) + + (constraint.pointB ? constraint.pointB.y : 0) + }; + }; + + /** + * Returns the current length of the constraint. + * This is the distance between both of the constraint's end points. + * See `constraint.length` for the target rest length. + * @method currentLength + * @param {constraint} constraint + * @returns {number} the current length + */ + Constraint.currentLength = function(constraint) { + var pointAX = (constraint.bodyA ? constraint.bodyA.position.x : 0) + + (constraint.pointA ? constraint.pointA.x : 0); + + var pointAY = (constraint.bodyA ? constraint.bodyA.position.y : 0) + + (constraint.pointA ? constraint.pointA.y : 0); + + var pointBX = (constraint.bodyB ? constraint.bodyB.position.x : 0) + + (constraint.pointB ? constraint.pointB.x : 0); + + var pointBY = (constraint.bodyB ? constraint.bodyB.position.y : 0) + + (constraint.pointB ? constraint.pointB.y : 0); + + var deltaX = pointAX - pointBX; + var deltaY = pointAY - pointBY; + + return Math.sqrt(deltaX * deltaX + deltaY * deltaY); + }; + /* + * + * Properties Documentation + * + */ + + /** + * An integer `Number` uniquely identifying number generated in `Composite.create` by `Common.nextId`. + * + * @property id + * @type number + */ + + /** + * A `String` denoting the type of object. + * + * @property type + * @type string + * @default "constraint" + * @readOnly + */ + + /** + * An arbitrary `String` name to help the user identify and manage bodies. + * + * @property label + * @type string + * @default "Constraint" + */ + + /** + * An `Object` that defines the rendering properties to be consumed by the module `Matter.Render`. + * + * @property render + * @type object + */ + + /** + * A flag that indicates if the constraint should be rendered. + * + * @property render.visible + * @type boolean + * @default true + */ + + /** + * A `Number` that defines the line width to use when rendering the constraint outline. + * A value of `0` means no outline will be rendered. + * + * @property render.lineWidth + * @type number + * @default 2 + */ + + /** + * A `String` that defines the stroke style to use when rendering the constraint outline. + * It is the same as when using a canvas, so it accepts CSS style property values. + * + * @property render.strokeStyle + * @type string + * @default a random colour + */ + + /** + * A `String` that defines the constraint rendering type. + * The possible values are 'line', 'pin', 'spring'. + * An appropriate render type will be automatically chosen unless one is given in options. + * + * @property render.type + * @type string + * @default 'line' + */ + + /** + * A `Boolean` that defines if the constraint's anchor points should be rendered. + * + * @property render.anchors + * @type boolean + * @default true + */ + + /** + * The first possible `Body` that this constraint is attached to. + * + * @property bodyA + * @type body + * @default null + */ + + /** + * The second possible `Body` that this constraint is attached to. + * + * @property bodyB + * @type body + * @default null + */ + + /** + * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position. + * + * @property pointA + * @type vector + * @default { x: 0, y: 0 } + */ + + /** + * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyB` if defined, otherwise a world-space position. + * + * @property pointB + * @type vector + * @default { x: 0, y: 0 } + */ + + /** + * A `Number` that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. + * A value of `1` means the constraint should be very stiff. + * A value of `0.2` means the constraint acts like a soft spring. + * + * @property stiffness + * @type number + * @default 1 + */ + + /** + * A `Number` that specifies the damping of the constraint, + * i.e. the amount of resistance applied to each body based on their velocities to limit the amount of oscillation. + * Damping will only be apparent when the constraint also has a very low `stiffness`. + * A value of `0.1` means the constraint will apply heavy damping, resulting in little to no oscillation. + * A value of `0` means the constraint will apply no damping. + * + * @property damping + * @type number + * @default 0 + */ + + /** + * A `Number` that specifies the target resting length of the constraint. + * It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. + * + * @property length + * @type number + */ + + /** + * An object reserved for storing plugin-specific properties. + * + * @property plugin + * @type {} + */ + +})(); + + +/***/ }), + +/***/ 68758: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter.Common` module contains utility functions that are common to all modules. +* +* @class Common +*/ + +var Common = {}; + +module.exports = Common; + +(function() { + + Common._baseDelta = 1000 / 60; + Common._nextId = 0; + Common._seed = 0; + Common._nowStartTime = +(new Date()); + Common._warnedOnce = {}; + Common._decomp = null; + + /** + * Extends the object in the first argument using the object in the second argument. + * @method extend + * @param {} obj + * @param {boolean} deep + * @return {} obj extended + */ + Common.extend = function(obj, deep) { + var argsStart, + args, + deepClone; + + if (typeof deep === 'boolean') { + argsStart = 2; + deepClone = deep; + } else { + argsStart = 1; + deepClone = true; + } + + for (var i = argsStart; i < arguments.length; i++) { + var source = arguments[i]; + + if (source) { + for (var prop in source) { + if (deepClone && source[prop] && source[prop].constructor === Object) { + if (!obj[prop] || obj[prop].constructor === Object) { + obj[prop] = obj[prop] || {}; + Common.extend(obj[prop], deepClone, source[prop]); + } else { + obj[prop] = source[prop]; + } + } else { + obj[prop] = source[prop]; + } + } + } + } + + return obj; + }; + + /** + * Creates a new clone of the object, if deep is true references will also be cloned. + * @method clone + * @param {} obj + * @param {bool} deep + * @return {} obj cloned + */ + Common.clone = function(obj, deep) { + return Common.extend({}, deep, obj); + }; + + /** + * Returns the list of keys for the given object. + * @method keys + * @param {} obj + * @return {string[]} keys + */ + Common.keys = function(obj) { + if (Object.keys) + return Object.keys(obj); + + // avoid hasOwnProperty for performance + var keys = []; + for (var key in obj) + keys.push(key); + return keys; + }; + + /** + * Returns the list of values for the given object. + * @method values + * @param {} obj + * @return {array} Array of the objects property values + */ + Common.values = function(obj) { + var values = []; + + if (Object.keys) { + var keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + values.push(obj[keys[i]]); + } + return values; + } + + // avoid hasOwnProperty for performance + for (var key in obj) + values.push(obj[key]); + return values; + }; + + /** + * Gets a value from `base` relative to the `path` string. + * @method get + * @param {} obj The base object + * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz' + * @param {number} [begin] Path slice begin + * @param {number} [end] Path slice end + * @return {} The object at the given path + */ + Common.get = function(obj, path, begin, end) { + path = path.split('.').slice(begin, end); + + for (var i = 0; i < path.length; i += 1) { + obj = obj[path[i]]; + } + + return obj; + }; + + /** + * Sets a value on `base` relative to the given `path` string. + * @method set + * @param {} obj The base object + * @param {string} path The path relative to `base`, e.g. 'Foo.Bar.baz' + * @param {} val The value to set + * @param {number} [begin] Path slice begin + * @param {number} [end] Path slice end + * @return {} Pass through `val` for chaining + */ + Common.set = function(obj, path, val, begin, end) { + var parts = path.split('.').slice(begin, end); + Common.get(obj, path, 0, -1)[parts[parts.length - 1]] = val; + return val; + }; + + /** + * Shuffles the given array in-place. + * The function uses a seeded random generator. + * @method shuffle + * @param {array} array + * @return {array} array shuffled randomly + */ + Common.shuffle = function(array) { + for (var i = array.length - 1; i > 0; i--) { + var j = Math.floor(Common.random() * (i + 1)); + var temp = array[i]; + array[i] = array[j]; + array[j] = temp; + } + return array; + }; + + /** + * Randomly chooses a value from a list with equal probability. + * The function uses a seeded random generator. + * @method choose + * @param {array} choices + * @return {object} A random choice object from the array + */ + Common.choose = function(choices) { + return choices[Math.floor(Common.random() * choices.length)]; + }; + + /** + * Returns true if the object is a HTMLElement, otherwise false. + * @method isElement + * @param {object} obj + * @return {boolean} True if the object is a HTMLElement, otherwise false + */ + Common.isElement = function(obj) { + if (typeof HTMLElement !== 'undefined') { + return obj instanceof HTMLElement; + } + + return !!(obj && obj.nodeType && obj.nodeName); + }; + + /** + * Returns true if the object is an array. + * @method isArray + * @param {object} obj + * @return {boolean} True if the object is an array, otherwise false + */ + Common.isArray = function(obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + }; + + /** + * Returns true if the object is a function. + * @method isFunction + * @param {object} obj + * @return {boolean} True if the object is a function, otherwise false + */ + Common.isFunction = function(obj) { + return typeof obj === "function"; + }; + + /** + * Returns true if the object is a plain object. + * @method isPlainObject + * @param {object} obj + * @return {boolean} True if the object is a plain object, otherwise false + */ + Common.isPlainObject = function(obj) { + return typeof obj === 'object' && obj.constructor === Object; + }; + + /** + * Returns true if the object is a string. + * @method isString + * @param {object} obj + * @return {boolean} True if the object is a string, otherwise false + */ + Common.isString = function(obj) { + return toString.call(obj) === '[object String]'; + }; + + /** + * Returns the given value clamped between a minimum and maximum value. + * @method clamp + * @param {number} value + * @param {number} min + * @param {number} max + * @return {number} The value clamped between min and max inclusive + */ + Common.clamp = function(value, min, max) { + if (value < min) + return min; + if (value > max) + return max; + return value; + }; + + /** + * Returns the sign of the given value. + * @method sign + * @param {number} value + * @return {number} -1 if negative, +1 if 0 or positive + */ + Common.sign = function(value) { + return value < 0 ? -1 : 1; + }; + + /** + * Returns the current timestamp since the time origin (e.g. from page load). + * The result is in milliseconds and will use high-resolution timing if available. + * @method now + * @return {number} the current timestamp in milliseconds + */ + Common.now = function() { + if (typeof window !== 'undefined' && window.performance) { + if (window.performance.now) { + return window.performance.now(); + } else if (window.performance.webkitNow) { + return window.performance.webkitNow(); + } + } + + if (Date.now) { + return Date.now(); + } + + return (new Date()) - Common._nowStartTime; + }; + + /** + * Returns a random value between a minimum and a maximum value inclusive. + * The function uses a seeded random generator. + * @method random + * @param {number} min + * @param {number} max + * @return {number} A random number between min and max inclusive + */ + Common.random = function(min, max) { + min = (typeof min !== "undefined") ? min : 0; + max = (typeof max !== "undefined") ? max : 1; + return min + _seededRandom() * (max - min); + }; + + var _seededRandom = function() { + // https://en.wikipedia.org/wiki/Linear_congruential_generator + Common._seed = (Common._seed * 9301 + 49297) % 233280; + return Common._seed / 233280; + }; + + /** + * Converts a CSS hex colour string into an integer. + * @method colorToNumber + * @param {string} colorString + * @return {number} An integer representing the CSS hex string + */ + Common.colorToNumber = function(colorString) { + colorString = colorString.replace('#',''); + + if (colorString.length == 3) { + colorString = colorString.charAt(0) + colorString.charAt(0) + + colorString.charAt(1) + colorString.charAt(1) + + colorString.charAt(2) + colorString.charAt(2); + } + + return parseInt(colorString, 16); + }; + + /** + * The console logging level to use, where each level includes all levels above and excludes the levels below. + * The default level is 'debug' which shows all console messages. * - * @name Phaser.GameObjects.Components.Tint#tintBottomRight - * @type {number} - * @default 0xffffff - * @since 3.0.0 + * Possible level values are: + * - 0 = None + * - 1 = Debug + * - 2 = Info + * - 3 = Warn + * - 4 = Error + * @property Common.logLevel + * @type {Number} + * @default 1 */ - tintBottomRight: 0xffffff, + Common.logLevel = 1; /** - * The tint fill mode. + * Shows a `console.log` message only if the current `Common.logLevel` allows it. + * The message will be prefixed with 'matter-js' to make it easily identifiable. + * @method log + * @param ...objs {} The objects to log. + */ + Common.log = function() { + if (console && Common.logLevel > 0 && Common.logLevel <= 3) { + console.log.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); + } + }; + + /** + * Shows a `console.info` message only if the current `Common.logLevel` allows it. + * The message will be prefixed with 'matter-js' to make it easily identifiable. + * @method info + * @param ...objs {} The objects to log. + */ + Common.info = function() { + if (console && Common.logLevel > 0 && Common.logLevel <= 2) { + console.info.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); + } + }; + + /** + * Shows a `console.warn` message only if the current `Common.logLevel` allows it. + * The message will be prefixed with 'matter-js' to make it easily identifiable. + * @method warn + * @param ...objs {} The objects to log. + */ + Common.warn = function() { + if (console && Common.logLevel > 0 && Common.logLevel <= 3) { + console.warn.apply(console, ['matter-js:'].concat(Array.prototype.slice.call(arguments))); + } + }; + + /** + * Uses `Common.warn` to log the given message one time only. + * @method warnOnce + * @param ...objs {} The objects to log. + */ + Common.warnOnce = function() { + var message = Array.prototype.slice.call(arguments).join(' '); + + if (!Common._warnedOnce[message]) { + Common.warn(message); + Common._warnedOnce[message] = true; + } + }; + + /** + * Shows a deprecated console warning when the function on the given object is called. + * The target function will be replaced with a new function that first shows the warning + * and then calls the original function. + * @method deprecated + * @param {object} obj The object or module + * @param {string} name The property name of the function on obj + * @param {string} warning The one-time message to show if the function is called + */ + Common.deprecated = function(obj, prop, warning) { + obj[prop] = Common.chain(function() { + Common.warnOnce('🔅 deprecated 🔅', warning); + }, obj[prop]); + }; + + /** + * Returns the next unique sequential ID. + * @method nextId + * @return {Number} Unique sequential ID + */ + Common.nextId = function() { + return Common._nextId++; + }; + + /** + * A cross browser compatible indexOf implementation. + * @method indexOf + * @param {array} haystack + * @param {object} needle + * @return {number} The position of needle in haystack, otherwise -1. + */ + Common.indexOf = function(haystack, needle) { + if (haystack.indexOf) + return haystack.indexOf(needle); + + for (var i = 0; i < haystack.length; i++) { + if (haystack[i] === needle) + return i; + } + + return -1; + }; + + /** + * A cross browser compatible array map implementation. + * @method map + * @param {array} list + * @param {function} func + * @return {array} Values from list transformed by func. + */ + Common.map = function(list, func) { + if (list.map) { + return list.map(func); + } + + var mapped = []; + + for (var i = 0; i < list.length; i += 1) { + mapped.push(func(list[i])); + } + + return mapped; + }; + + /** + * Takes a directed graph and returns the partially ordered set of vertices in topological order. + * Circular dependencies are allowed. + * @method topologicalSort + * @param {object} graph + * @return {array} Partially ordered set of vertices in topological order. + */ + Common.topologicalSort = function(graph) { + // https://github.com/mgechev/javascript-algorithms + // Copyright (c) Minko Gechev (MIT license) + // Modifications: tidy formatting and naming + var result = [], + visited = [], + temp = []; + + for (var node in graph) { + if (!visited[node] && !temp[node]) { + Common._topologicalSort(node, visited, temp, graph, result); + } + } + + return result; + }; + + Common._topologicalSort = function(node, visited, temp, graph, result) { + var neighbors = graph[node] || []; + temp[node] = true; + + for (var i = 0; i < neighbors.length; i += 1) { + var neighbor = neighbors[i]; + + if (temp[neighbor]) { + // skip circular dependencies + continue; + } + + if (!visited[neighbor]) { + Common._topologicalSort(neighbor, visited, temp, graph, result); + } + } + + temp[node] = false; + visited[node] = true; + + result.push(node); + }; + + /** + * Takes _n_ functions as arguments and returns a new function that calls them in order. + * The arguments applied when calling the new function will also be applied to every function passed. + * The value of `this` refers to the last value returned in the chain that was not `undefined`. + * Therefore if a passed function does not return a value, the previously returned value is maintained. + * After all passed functions have been called the new function returns the last returned value (if any). + * If any of the passed functions are a chain, then the chain will be flattened. + * @method chain + * @param ...funcs {function} The functions to chain. + * @return {function} A new function that calls the passed functions in order. + */ + Common.chain = function() { + var funcs = []; + + for (var i = 0; i < arguments.length; i += 1) { + var func = arguments[i]; + + if (func._chained) { + // flatten already chained functions + funcs.push.apply(funcs, func._chained); + } else { + funcs.push(func); + } + } + + var chain = function() { + // https://github.com/GoogleChrome/devtools-docs/issues/53#issuecomment-51941358 + var lastResult, + args = new Array(arguments.length); + + for (var i = 0, l = arguments.length; i < l; i++) { + args[i] = arguments[i]; + } + + for (i = 0; i < funcs.length; i += 1) { + var result = funcs[i].apply(lastResult, args); + + if (typeof result !== 'undefined') { + lastResult = result; + } + } + + return lastResult; + }; + + chain._chained = funcs; + + return chain; + }; + + /** + * Chains a function to excute before the original function on the given `path` relative to `base`. + * See also docs for `Common.chain`. + * @method chainPathBefore + * @param {} base The base object + * @param {string} path The path relative to `base` + * @param {function} func The function to chain before the original + * @return {function} The chained function that replaced the original + */ + Common.chainPathBefore = function(base, path, func) { + return Common.set(base, path, Common.chain( + func, + Common.get(base, path) + )); + }; + + /** + * Chains a function to excute after the original function on the given `path` relative to `base`. + * See also docs for `Common.chain`. + * @method chainPathAfter + * @param {} base The base object + * @param {string} path The path relative to `base` + * @param {function} func The function to chain after the original + * @return {function} The chained function that replaced the original + */ + Common.chainPathAfter = function(base, path, func) { + return Common.set(base, path, Common.chain( + Common.get(base, path), + func + )); + }; + + /** + * Provide the [poly-decomp](https://github.com/schteppe/poly-decomp.js) library module to enable + * concave vertex decomposition support when using `Bodies.fromVertices` e.g. `Common.setDecomp(require('poly-decomp'))`. + * @method setDecomp + * @param {} decomp The [poly-decomp](https://github.com/schteppe/poly-decomp.js) library module. + */ + Common.setDecomp = function(decomp) { + Common._decomp = decomp; + }; + + /** + * Returns the [poly-decomp](https://github.com/schteppe/poly-decomp.js) library module provided through `Common.setDecomp`, + * otherwise returns the global `decomp` if set. + * @method getDecomp + * @return {} The [poly-decomp](https://github.com/schteppe/poly-decomp.js) library module if provided. + */ + Common.getDecomp = function() { + // get user provided decomp if set + var decomp = Common._decomp; + + try { + // otherwise from window global + if (!decomp && typeof window !== 'undefined') { + decomp = window.decomp; + } + + // otherwise from node global + if (!decomp && typeof __webpack_require__.g !== 'undefined') { + decomp = __webpack_require__.g.decomp; + } + } catch (e) { + // decomp not available + decomp = null; + } + + return decomp; + }; +})(); + + +/***/ }), + +/***/ 45775: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter.Engine` module contains methods for creating and manipulating engines. +* An engine is a controller that manages updating the simulation of the world. +* See `Matter.Runner` for an optional game loop utility. +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class Engine +*/ + +var Engine = {}; + +module.exports = Engine; + +var Sleeping = __webpack_require__(22806); +var Resolver = __webpack_require__(44272); +var Detector = __webpack_require__(13657); +var Pairs = __webpack_require__(91327); +var Events = __webpack_require__(39073); +var Composite = __webpack_require__(11299); +var Constraint = __webpack_require__(52838); +var Common = __webpack_require__(68758); +var Body = __webpack_require__(84125); + +(function() { + + /** + * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. + * All properties have default values, and many are pre-calculated automatically based on other properties. + * See the properties section below for detailed information on what you can pass via the `options` object. + * @method create + * @param {object} [options] + * @return {engine} engine + */ + Engine.create = function(options) { + options = options || {}; + + var defaults = { + positionIterations: 6, + velocityIterations: 4, + constraintIterations: 2, + enableSleeping: false, + events: [], + plugin: {}, + gravity: { + x: 0, + y: 1, + scale: 0.001 + }, + timing: { + timestamp: 0, + timeScale: 1, + lastDelta: 0, + lastElapsed: 0 + } + }; + + var engine = Common.extend(defaults, options); + + engine.world = options.world || Composite.create({ label: 'World' }); + engine.pairs = options.pairs || Pairs.create(); + engine.detector = options.detector || Detector.create(); + + // for temporary back compatibility only + engine.grid = { buckets: [] }; + engine.world.gravity = engine.gravity; + engine.broadphase = engine.grid; + engine.metrics = {}; + + return engine; + }; + + /** + * Moves the simulation forward in time by `delta` ms. + * Triggers `beforeUpdate` and `afterUpdate` events. + * Triggers `collisionStart`, `collisionActive` and `collisionEnd` events. + * @method update + * @param {engine} engine + * @param {number} [delta=16.666] + */ + Engine.update = function(engine, delta) { + var startTime = Common.now(); + + var world = engine.world, + detector = engine.detector, + pairs = engine.pairs, + timing = engine.timing, + timestamp = timing.timestamp, + i; + + delta = typeof delta !== 'undefined' ? delta : Common._baseDelta; + delta *= timing.timeScale; + + // increment timestamp + timing.timestamp += delta; + timing.lastDelta = delta; + + // create an event object + var event = { + timestamp: timing.timestamp, + delta: delta + }; + + Events.trigger(engine, 'beforeUpdate', event); + + // get all bodies and all constraints in the world + var allBodies = Composite.allBodies(world), + allConstraints = Composite.allConstraints(world); + + // if the world has changed + if (world.isModified) { + // update the detector bodies + Detector.setBodies(detector, allBodies); + + // reset all composite modified flags + Composite.setModified(world, false, false, true); + } + + // update sleeping if enabled + if (engine.enableSleeping) + Sleeping.update(allBodies, delta); + + // apply gravity to all bodies + Engine._bodiesApplyGravity(allBodies, engine.gravity); + + // update all body position and rotation by integration + if (delta > 0) { + Engine._bodiesUpdate(allBodies, delta); + } + + Events.trigger(engine, 'beforeSolve', event); + + // update all constraints (first pass) + Constraint.preSolveAll(allBodies); + for (i = 0; i < engine.constraintIterations; i++) { + Constraint.solveAll(allConstraints, delta); + } + Constraint.postSolveAll(allBodies); + + // find all collisions + detector.pairs = engine.pairs; + var collisions = Detector.collisions(detector); + + // update collision pairs + Pairs.update(pairs, collisions, timestamp); + + // wake up bodies involved in collisions + if (engine.enableSleeping) + Sleeping.afterCollisions(pairs.list); + + // trigger collision events + if (pairs.collisionStart.length > 0) { + Events.trigger(engine, 'collisionStart', { + pairs: pairs.collisionStart, + timestamp: timing.timestamp, + delta: delta + }); + } + + // iteratively resolve position between collisions + var positionDamping = Common.clamp(20 / engine.positionIterations, 0, 1); + + Resolver.preSolvePosition(pairs.list); + for (i = 0; i < engine.positionIterations; i++) { + Resolver.solvePosition(pairs.list, delta, positionDamping); + } + Resolver.postSolvePosition(allBodies); + + // update all constraints (second pass) + Constraint.preSolveAll(allBodies); + for (i = 0; i < engine.constraintIterations; i++) { + Constraint.solveAll(allConstraints, delta); + } + Constraint.postSolveAll(allBodies); + + // iteratively resolve velocity between collisions + Resolver.preSolveVelocity(pairs.list); + for (i = 0; i < engine.velocityIterations; i++) { + Resolver.solveVelocity(pairs.list, delta); + } + + // update body speed and velocity properties + Engine._bodiesUpdateVelocities(allBodies); + + // trigger collision events + if (pairs.collisionActive.length > 0) { + Events.trigger(engine, 'collisionActive', { + pairs: pairs.collisionActive, + timestamp: timing.timestamp, + delta: delta + }); + } + + if (pairs.collisionEnd.length > 0) { + Events.trigger(engine, 'collisionEnd', { + pairs: pairs.collisionEnd, + timestamp: timing.timestamp, + delta: delta + }); + } + + // clear force buffers + Engine._bodiesClearForces(allBodies); + + Events.trigger(engine, 'afterUpdate', event); + + // log the time elapsed computing this update + engine.timing.lastElapsed = Common.now() - startTime; + + return engine; + }; + + /** + * Merges two engines by keeping the configuration of `engineA` but replacing the world with the one from `engineB`. + * @method merge + * @param {engine} engineA + * @param {engine} engineB + */ + Engine.merge = function(engineA, engineB) { + Common.extend(engineA, engineB); + + if (engineB.world) { + engineA.world = engineB.world; + + Engine.clear(engineA); + + var bodies = Composite.allBodies(engineA.world); + + for (var i = 0; i < bodies.length; i++) { + var body = bodies[i]; + Sleeping.set(body, false); + body.id = Common.nextId(); + } + } + }; + + /** + * Clears the engine pairs and detector. + * @method clear + * @param {engine} engine + */ + Engine.clear = function(engine) { + Pairs.clear(engine.pairs); + Detector.clear(engine.detector); + }; + + /** + * Zeroes the `body.force` and `body.torque` force buffers. + * @method _bodiesClearForces + * @private + * @param {body[]} bodies + */ + Engine._bodiesClearForces = function(bodies) { + var bodiesLength = bodies.length; + for (var i = 0; i < bodiesLength; i++) { + var body = bodies[i]; + + // reset force buffers + body.force.x = 0; + body.force.y = 0; + body.torque = 0; + } + }; + + /** + * Applys a mass dependant force to all given bodies. + * @method _bodiesApplyGravity + * @private + * @param {body[]} bodies + * @param {vector} gravity + */ + Engine._bodiesApplyGravity = function(bodies, gravity) { + var gravityScale = typeof gravity.scale !== 'undefined' ? gravity.scale : 0.001, + bodiesLength = bodies.length; + + if ((gravity.x === 0 && gravity.y === 0) || gravityScale === 0) { + return; + } + + for (var i = 0; i < bodiesLength; i++) { + var body = bodies[i]; + + if (body.isStatic || body.isSleeping) + continue; + + // add the resultant force of gravity + body.force.y += body.mass * gravity.y * gravityScale; + body.force.x += body.mass * gravity.x * gravityScale; + } + }; + + /** + * Applies `Body.update` to all given `bodies`. + * @method _bodiesUpdate + * @private + * @param {body[]} bodies + * @param {number} delta The amount of time elapsed between updates + */ + Engine._bodiesUpdate = function(bodies, delta) { + var bodiesLength = bodies.length; + + for (var i = 0; i < bodiesLength; i++) { + var body = bodies[i]; + + if (body.isStatic || body.isSleeping) + continue; + + Body.update(body, delta); + } + }; + + /** + * Applies `Body.updateVelocities` to all given `bodies`. + * @method _bodiesUpdateVelocities + * @private + * @param {body[]} bodies + */ + Engine._bodiesUpdateVelocities = function(bodies) { + var bodiesLength = bodies.length; + + for (var i = 0; i < bodiesLength; i++) { + Body.updateVelocities(bodies[i]); + } + }; + + /** + * A deprecated alias for `Runner.run`, use `Matter.Runner.run(engine)` instead and see `Matter.Runner` for more information. + * @deprecated use Matter.Runner.run(engine) instead + * @method run + * @param {engine} engine + */ + + /** + * Fired just before an update + * + * @event beforeUpdate + * @param {object} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {engine} event.source The source object of the event + * @param {string} event.name The name of the event + */ + + /** + * Fired after engine update and all collision events + * + * @event afterUpdate + * @param {object} event An event object + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {engine} event.source The source object of the event + * @param {string} event.name The name of the event + */ + + /** + * Fired after engine update, provides a list of all pairs that have started to collide in the current tick (if any) + * + * @event collisionStart + * @param {object} event An event object + * @param {pair[]} event.pairs List of affected pairs + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {engine} event.source The source object of the event + * @param {string} event.name The name of the event + */ + + /** + * Fired after engine update, provides a list of all pairs that are colliding in the current tick (if any) + * + * @event collisionActive + * @param {object} event An event object + * @param {pair[]} event.pairs List of affected pairs + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {engine} event.source The source object of the event + * @param {string} event.name The name of the event + */ + + /** + * Fired after engine update, provides a list of all pairs that have ended collision in the current tick (if any) + * + * @event collisionEnd + * @param {object} event An event object + * @param {pair[]} event.pairs List of affected pairs + * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {engine} event.source The source object of the event + * @param {string} event.name The name of the event + */ + + /* + * + * Properties Documentation + * + */ + + /** + * An integer `Number` that specifies the number of position iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. * - * `false` = An additive tint (the default), where vertices colors are blended with the texture. - * `true` = A fill tint, where the vertices colors replace the texture, but respects texture alpha. + * @property positionIterations + * @type number + * @default 6 + */ + + /** + * An integer `Number` that specifies the number of velocity iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. * - * @name Phaser.GameObjects.Components.Tint#tintFill - * @type {boolean} + * @property velocityIterations + * @type number + * @default 4 + */ + + /** + * An integer `Number` that specifies the number of constraint iterations to perform each update. + * The higher the value, the higher quality the simulation will be at the expense of performance. + * The default value of `2` is usually very adequate. + * + * @property constraintIterations + * @type number + * @default 2 + */ + + /** + * A flag that specifies whether the engine should allow sleeping via the `Matter.Sleeping` module. + * Sleeping can improve stability and performance, but often at the expense of accuracy. + * + * @property enableSleeping + * @type boolean * @default false - * @since 3.11.0 */ - tintFill: false, /** - * Clears all tint values associated with this Game Object. - * - * Immediately sets the color values back to 0xffffff and the tint type to 'additive', - * which results in no visible change to the texture. - * - * @method Phaser.GameObjects.Components.Tint#clearTint - * @webglOnly - * @since 3.0.0 - * - * @return {this} This Game Object instance. + * An `Object` containing properties regarding the timing systems of the engine. + * + * @property timing + * @type object + */ + + /** + * A `Number` that specifies the global scaling factor of time for all bodies. + * A value of `0` freezes the simulation. + * A value of `0.1` gives a slow-motion effect. + * A value of `1.2` gives a speed-up effect. + * + * @property timing.timeScale + * @type number + * @default 1 + */ + + /** + * A `Number` that specifies the current simulation-time in milliseconds starting from `0`. + * It is incremented on every `Engine.update` by the given `delta` argument. + * + * @property timing.timestamp + * @type number + * @default 0 + */ + + /** + * A `Number` that represents the total execution time elapsed during the last `Engine.update` in milliseconds. + * It is updated by timing from the start of the last `Engine.update` call until it ends. + * + * This value will also include the total execution time of all event handlers directly or indirectly triggered by the engine update. + * + * @property timing.lastElapsed + * @type number + * @default 0 + */ + + /** + * A `Number` that represents the `delta` value used in the last engine update. + * + * @property timing.lastDelta + * @type number + * @default 0 + */ + + /** + * A `Matter.Detector` instance. + * + * @property detector + * @type detector + * @default a Matter.Detector instance + */ + + /** + * A `Matter.Grid` instance. + * + * @deprecated replaced by `engine.detector` + * @property grid + * @type grid + * @default a Matter.Grid instance + */ + + /** + * Replaced by and now alias for `engine.grid`. + * + * @deprecated replaced by `engine.detector` + * @property broadphase + * @type grid + * @default a Matter.Grid instance + */ + + /** + * The root `Matter.Composite` instance that will contain all bodies, constraints and other composites to be simulated by this engine. + * + * @property world + * @type composite + * @default a Matter.Composite instance + */ + + /** + * An object reserved for storing plugin-specific properties. + * + * @property plugin + * @type {} + */ + + /** + * The gravity to apply on all bodies in `engine.world`. + * + * @property gravity + * @type object + */ + + /** + * The gravity x component. + * + * @property gravity.x + * @type object + * @default 0 + */ + + /** + * The gravity y component. + * + * @property gravity.y + * @type object + * @default 1 + */ + + /** + * The gravity scale factor. + * + * @property gravity.scale + * @type object + * @default 0.001 + */ + +})(); + + +/***/ }), + +/***/ 39073: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter.Events` module contains methods to fire and listen to events on other objects. +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class Events +*/ + +var Events = {}; + +module.exports = Events; + +var Common = __webpack_require__(68758); + +(function() { + + /** + * Subscribes a callback function to the given object's `eventName`. + * @method on + * @param {} object + * @param {string} eventNames + * @param {function} callback + */ + Events.on = function(object, eventNames, callback) { + var names = eventNames.split(' '), + name; + + for (var i = 0; i < names.length; i++) { + name = names[i]; + object.events = object.events || {}; + object.events[name] = object.events[name] || []; + object.events[name].push(callback); + } + + return callback; + }; + + /** + * Removes the given event callback. If no callback, clears all callbacks in `eventNames`. If no `eventNames`, clears all events. + * @method off + * @param {} object + * @param {string} eventNames + * @param {function} callback + */ + Events.off = function(object, eventNames, callback) { + if (!eventNames) { + object.events = {}; + return; + } + + // handle Events.off(object, callback) + if (typeof eventNames === 'function') { + callback = eventNames; + eventNames = Common.keys(object.events).join(' '); + } + + var names = eventNames.split(' '); + + for (var i = 0; i < names.length; i++) { + var callbacks = object.events[names[i]], + newCallbacks = []; + + if (callback && callbacks) { + for (var j = 0; j < callbacks.length; j++) { + if (callbacks[j] !== callback) + newCallbacks.push(callbacks[j]); + } + } + + object.events[names[i]] = newCallbacks; + } + }; + + /** + * Fires all the callbacks subscribed to the given object's `eventName`, in the order they subscribed, if any. + * @method trigger + * @param {} object + * @param {string} eventNames + * @param {} event + */ + Events.trigger = function(object, eventNames, event) { + var names, + name, + callbacks, + eventClone; + + var events = object.events; + + if (events && Common.keys(events).length > 0) { + if (!event) + event = {}; + + names = eventNames.split(' '); + + for (var i = 0; i < names.length; i++) { + name = names[i]; + callbacks = events[name]; + + if (callbacks) { + eventClone = Common.clone(event, false); + eventClone.name = name; + eventClone.source = object; + + for (var j = 0; j < callbacks.length; j++) { + callbacks[j].apply(object, [eventClone]); + } + } + } + } + }; + +})(); + + +/***/ }), + +/***/ 16929: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter` module is the top level namespace. It also includes a function for installing plugins on top of the library. +* +* @class Matter +*/ + +var Matter = {}; + +module.exports = Matter; + +var Plugin = __webpack_require__(84474); +var Common = __webpack_require__(68758); + +(function() { + + /** + * The library name. + * @property name + * @readOnly + * @type {String} + */ + Matter.name = 'matter-js'; + + /** + * The library version. + * @property version + * @readOnly + * @type {String} + */ + Matter.version = '0.19.0'; + + /** + * A list of plugin dependencies to be installed. These are normally set and installed through `Matter.use`. + * Alternatively you may set `Matter.uses` manually and install them by calling `Plugin.use(Matter)`. + * @property uses + * @type {Array} + */ + Matter.uses = []; + + /** + * The plugins that have been installed through `Matter.Plugin.install`. Read only. + * @property used + * @readOnly + * @type {Array} + */ + Matter.used = []; + + /** + * Installs the given plugins on the `Matter` namespace. + * This is a short-hand for `Plugin.use`, see it for more information. + * Call this function once at the start of your code, with all of the plugins you wish to install as arguments. + * Avoid calling this function multiple times unless you intend to manually control installation order. + * @method use + * @param ...plugin {Function} The plugin(s) to install on `base` (multi-argument). + */ + Matter.use = function() { + Plugin.use(Matter, Array.prototype.slice.call(arguments)); + }; + + /** + * Chains a function to excute before the original function on the given `path` relative to `Matter`. + * See also docs for `Common.chain`. + * @method before + * @param {string} path The path relative to `Matter` + * @param {function} func The function to chain before the original + * @return {function} The chained function that replaced the original + */ + Matter.before = function(path, func) { + path = path.replace(/^Matter./, ''); + return Common.chainPathBefore(Matter, path, func); + }; + + /** + * Chains a function to excute after the original function on the given `path` relative to `Matter`. + * See also docs for `Common.chain`. + * @method after + * @param {string} path The path relative to `Matter` + * @param {function} func The function to chain after the original + * @return {function} The chained function that replaced the original + */ + Matter.after = function(path, func) { + path = path.replace(/^Matter./, ''); + return Common.chainPathAfter(Matter, path, func); + }; + +})(); + + +/***/ }), + +/***/ 84474: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** +* The `Matter.Plugin` module contains functions for registering and installing plugins on modules. +* +* @class Plugin +*/ + +var Plugin = {}; + +module.exports = Plugin; + +var Common = __webpack_require__(68758); + +(function() { + + Plugin._registry = {}; + + /** + * Registers a plugin object so it can be resolved later by name. + * @method register + * @param plugin {} The plugin to register. + * @return {object} The plugin. + */ + Plugin.register = function(plugin) { + if (!Plugin.isPlugin(plugin)) { + Common.warn('Plugin.register:', Plugin.toString(plugin), 'does not implement all required fields.'); + } + + if (plugin.name in Plugin._registry) { + var registered = Plugin._registry[plugin.name], + pluginVersion = Plugin.versionParse(plugin.version).number, + registeredVersion = Plugin.versionParse(registered.version).number; + + if (pluginVersion > registeredVersion) { + Common.warn('Plugin.register:', Plugin.toString(registered), 'was upgraded to', Plugin.toString(plugin)); + Plugin._registry[plugin.name] = plugin; + } else if (pluginVersion < registeredVersion) { + Common.warn('Plugin.register:', Plugin.toString(registered), 'can not be downgraded to', Plugin.toString(plugin)); + } else if (plugin !== registered) { + Common.warn('Plugin.register:', Plugin.toString(plugin), 'is already registered to different plugin object'); + } + } else { + Plugin._registry[plugin.name] = plugin; + } + + return plugin; + }; + + /** + * Resolves a dependency to a plugin object from the registry if it exists. + * The `dependency` may contain a version, but only the name matters when resolving. + * @method resolve + * @param dependency {string} The dependency. + * @return {object} The plugin if resolved, otherwise `undefined`. + */ + Plugin.resolve = function(dependency) { + return Plugin._registry[Plugin.dependencyParse(dependency).name]; + }; + + /** + * Returns a pretty printed plugin name and version. + * @method toString + * @param plugin {} The plugin. + * @return {string} Pretty printed plugin name and version. + */ + Plugin.toString = function(plugin) { + return typeof plugin === 'string' ? plugin : (plugin.name || 'anonymous') + '@' + (plugin.version || plugin.range || '0.0.0'); + }; + + /** + * Returns `true` if the object meets the minimum standard to be considered a plugin. + * This means it must define the following properties: + * - `name` + * - `version` + * - `install` + * @method isPlugin + * @param obj {} The obj to test. + * @return {boolean} `true` if the object can be considered a plugin otherwise `false`. + */ + Plugin.isPlugin = function(obj) { + return obj && obj.name && obj.version && obj.install; + }; + + /** + * Returns `true` if a plugin with the given `name` been installed on `module`. + * @method isUsed + * @param module {} The module. + * @param name {string} The plugin name. + * @return {boolean} `true` if a plugin with the given `name` been installed on `module`, otherwise `false`. + */ + Plugin.isUsed = function(module, name) { + return module.used.indexOf(name) > -1; + }; + + /** + * Returns `true` if `plugin.for` is applicable to `module` by comparing against `module.name` and `module.version`. + * If `plugin.for` is not specified then it is assumed to be applicable. + * The value of `plugin.for` is a string of the format `'module-name'` or `'module-name@version'`. + * @method isFor + * @param plugin {} The plugin. + * @param module {} The module. + * @return {boolean} `true` if `plugin.for` is applicable to `module`, otherwise `false`. + */ + Plugin.isFor = function(plugin, module) { + var parsed = plugin.for && Plugin.dependencyParse(plugin.for); + return !plugin.for || (module.name === parsed.name && Plugin.versionSatisfies(module.version, parsed.range)); + }; + + /** + * Installs the plugins by calling `plugin.install` on each plugin specified in `plugins` if passed, otherwise `module.uses`. + * For installing plugins on `Matter` see the convenience function `Matter.use`. + * Plugins may be specified either by their name or a reference to the plugin object. + * Plugins themselves may specify further dependencies, but each plugin is installed only once. + * Order is important, a topological sort is performed to find the best resulting order of installation. + * This sorting attempts to satisfy every dependency's requested ordering, but may not be exact in all cases. + * This function logs the resulting status of each dependency in the console, along with any warnings. + * - A green tick ✅ indicates a dependency was resolved and installed. + * - An orange diamond 🔶 indicates a dependency was resolved but a warning was thrown for it or one if its dependencies. + * - A red cross ❌ indicates a dependency could not be resolved. + * Avoid calling this function multiple times on the same module unless you intend to manually control installation order. + * @method use + * @param module {} The module install plugins on. + * @param [plugins=module.uses] {} The plugins to install on module (optional, defaults to `module.uses`). */ - clearTint: function () - { - this.setTint(0xffffff); + Plugin.use = function(module, plugins) { + module.uses = (module.uses || []).concat(plugins || []); - return this; - }, + if (module.uses.length === 0) { + Common.warn('Plugin.use:', Plugin.toString(module), 'does not specify any dependencies to install.'); + return; + } + + var dependencies = Plugin.dependencies(module), + sortedDependencies = Common.topologicalSort(dependencies), + status = []; + + for (var i = 0; i < sortedDependencies.length; i += 1) { + if (sortedDependencies[i] === module.name) { + continue; + } + + var plugin = Plugin.resolve(sortedDependencies[i]); + + if (!plugin) { + status.push('❌ ' + sortedDependencies[i]); + continue; + } + + if (Plugin.isUsed(module, plugin.name)) { + continue; + } + + if (!Plugin.isFor(plugin, module)) { + Common.warn('Plugin.use:', Plugin.toString(plugin), 'is for', plugin.for, 'but installed on', Plugin.toString(module) + '.'); + plugin._warned = true; + } + + if (plugin.install) { + plugin.install(module); + } else { + Common.warn('Plugin.use:', Plugin.toString(plugin), 'does not specify an install function.'); + plugin._warned = true; + } + + if (plugin._warned) { + status.push('🔶 ' + Plugin.toString(plugin)); + delete plugin._warned; + } else { + status.push('✅ ' + Plugin.toString(plugin)); + } + + module.used.push(plugin.name); + } + + if (status.length > 0 && !plugin.silent) { + Common.info(status.join(' ')); + } + }; /** - * Sets an additive tint on this Game Object. - * - * The tint works by taking the pixel color values from the Game Objects texture, and then - * multiplying it by the color value of the tint. You can provide either one color value, - * in which case the whole Game Object will be tinted in that color. Or you can provide a color - * per corner. The colors are blended together across the extent of the Game Object. - * - * To modify the tint color once set, either call this method again with new values or use the - * `tint` property to set all colors at once. Or, use the properties `tintTopLeft`, `tintTopRight, - * `tintBottomLeft` and `tintBottomRight` to set the corner color values independently. - * - * To remove a tint call `clearTint`. - * - * To swap this from being an additive tint to a fill based tint set the property `tintFill` to `true`. - * - * @method Phaser.GameObjects.Components.Tint#setTint - * @webglOnly - * @since 3.0.0 - * - * @param {number} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If no other values are given this value is applied evenly, tinting the whole Game Object. - * @param {number} [topRight] - The tint being applied to the top-right of the Game Object. - * @param {number} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. - * @param {number} [bottomRight] - The tint being applied to the bottom-right of the Game Object. - * - * @return {this} This Game Object instance. + * Recursively finds all of a module's dependencies and returns a flat dependency graph. + * @method dependencies + * @param module {} The module. + * @return {object} A dependency graph. */ - setTint: function (topLeft, topRight, bottomLeft, bottomRight) - { - if (topLeft === undefined) { topLeft = 0xffffff; } + Plugin.dependencies = function(module, tracked) { + var parsedBase = Plugin.dependencyParse(module), + name = parsedBase.name; - if (topRight === undefined) - { - topRight = topLeft; - bottomLeft = topLeft; - bottomRight = topLeft; + tracked = tracked || {}; + + if (name in tracked) { + return; } - this.tintTopLeft = topLeft; - this.tintTopRight = topRight; - this.tintBottomLeft = bottomLeft; - this.tintBottomRight = bottomRight; + module = Plugin.resolve(module) || module; - this.tintFill = false; + tracked[name] = Common.map(module.uses || [], function(dependency) { + if (Plugin.isPlugin(dependency)) { + Plugin.register(dependency); + } - return this; - }, + var parsed = Plugin.dependencyParse(dependency), + resolved = Plugin.resolve(dependency); - /** - * Sets a fill-based tint on this Game Object. - * - * Unlike an additive tint, a fill-tint literally replaces the pixel colors from the texture - * with those in the tint. You can use this for effects such as making a player flash 'white' - * if hit by something. You can provide either one color value, in which case the whole - * Game Object will be rendered in that color. Or you can provide a color per corner. The colors - * are blended together across the extent of the Game Object. - * - * To modify the tint color once set, either call this method again with new values or use the - * `tint` property to set all colors at once. Or, use the properties `tintTopLeft`, `tintTopRight, - * `tintBottomLeft` and `tintBottomRight` to set the corner color values independently. - * - * To remove a tint call `clearTint`. - * - * To swap this from being a fill-tint to an additive tint set the property `tintFill` to `false`. - * - * @method Phaser.GameObjects.Components.Tint#setTintFill - * @webglOnly - * @since 3.11.0 - * - * @param {number} [topLeft=0xffffff] - The tint being applied to the top-left of the Game Object. If not other values are given this value is applied evenly, tinting the whole Game Object. - * @param {number} [topRight] - The tint being applied to the top-right of the Game Object. - * @param {number} [bottomLeft] - The tint being applied to the bottom-left of the Game Object. - * @param {number} [bottomRight] - The tint being applied to the bottom-right of the Game Object. - * - * @return {this} This Game Object instance. - */ - setTintFill: function (topLeft, topRight, bottomLeft, bottomRight) - { - this.setTint(topLeft, topRight, bottomLeft, bottomRight); + if (resolved && !Plugin.versionSatisfies(resolved.version, parsed.range)) { + Common.warn( + 'Plugin.dependencies:', Plugin.toString(resolved), 'does not satisfy', + Plugin.toString(parsed), 'used by', Plugin.toString(parsedBase) + '.' + ); - this.tintFill = true; + resolved._warned = true; + module._warned = true; + } else if (!resolved) { + Common.warn( + 'Plugin.dependencies:', Plugin.toString(dependency), 'used by', + Plugin.toString(parsedBase), 'could not be resolved.' + ); - return this; - }, + module._warned = true; + } - /** - * The tint value being applied to the whole of the Game Object. - * This property is a setter-only. Use the properties `tintTopLeft` etc to read the current tint value. - * - * @name Phaser.GameObjects.Components.Tint#tint - * @type {number} - * @webglOnly - * @since 3.0.0 - */ - tint: { + return parsed.name; + }); - set: function (value) - { - this.setTint(value, value, value, value); + for (var i = 0; i < tracked[name].length; i += 1) { + Plugin.dependencies(tracked[name][i], tracked); } - }, + + return tracked; + }; /** - * Does this Game Object have a tint applied? - * - * It checks to see if the 4 tint properties are set to the value 0xffffff - * and that the `tintFill` property is `false`. This indicates that a Game Object isn't tinted. - * - * @name Phaser.GameObjects.Components.Tint#isTinted - * @type {boolean} - * @webglOnly - * @readonly - * @since 3.11.0 + * Parses a dependency string into its components. + * The `dependency` is a string of the format `'module-name'` or `'module-name@version'`. + * See documentation for `Plugin.versionParse` for a description of the format. + * This function can also handle dependencies that are already resolved (e.g. a module object). + * @method dependencyParse + * @param dependency {string} The dependency of the format `'module-name'` or `'module-name@version'`. + * @return {object} The dependency parsed into its components. */ - isTinted: { + Plugin.dependencyParse = function(dependency) { + if (Common.isString(dependency)) { + var pattern = /^[\w-]+(@(\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-+]+)?))?$/; - get: function () - { - var white = 0xffffff; + if (!pattern.test(dependency)) { + Common.warn('Plugin.dependencyParse:', dependency, 'is not a valid dependency string.'); + } - return ( - this.tintFill || - this.tintTopLeft !== white || - this.tintTopRight !== white || - this.tintBottomLeft !== white || - this.tintBottomRight !== white - ); + return { + name: dependency.split('@')[0], + range: dependency.split('@')[1] || '*' + }; } - } + return { + name: dependency.name, + range: dependency.range || dependency.version + }; + }; -}; + /** + * Parses a version string into its components. + * Versions are strictly of the format `x.y.z` (as in [semver](http://semver.org/)). + * Versions may optionally have a prerelease tag in the format `x.y.z-alpha`. + * Ranges are a strict subset of [npm ranges](https://docs.npmjs.com/misc/semver#advanced-range-syntax). + * Only the following range types are supported: + * - Tilde ranges e.g. `~1.2.3` + * - Caret ranges e.g. `^1.2.3` + * - Greater than ranges e.g. `>1.2.3` + * - Greater than or equal ranges e.g. `>=1.2.3` + * - Exact version e.g. `1.2.3` + * - Any version `*` + * @method versionParse + * @param range {string} The version string. + * @return {object} The version range parsed into its components. + */ + Plugin.versionParse = function(range) { + var pattern = /^(\*)|(\^|~|>=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/; -module.exports = Tint; + if (!pattern.test(range)) { + Common.warn('Plugin.versionParse:', range, 'is not a valid version or range.'); + } + var parts = pattern.exec(range); + var major = Number(parts[4]); + var minor = Number(parts[5]); + var patch = Number(parts[6]); -/***/ }), -/* 638 */ -/***/ (function(module, exports) { + return { + isRange: Boolean(parts[1] || parts[2]), + version: parts[3], + range: range, + operator: parts[1] || parts[2] || '', + major: major, + minor: minor, + patch: patch, + parts: [major, minor, patch], + prerelease: parts[7], + number: major * 1e8 + minor * 1e4 + patch + }; + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Returns `true` if `version` satisfies the given `range`. + * See documentation for `Plugin.versionParse` for a description of the format. + * If a version or range is not specified, then any version (`*`) is assumed to satisfy. + * @method versionSatisfies + * @param version {string} The version string. + * @param range {string} The range string. + * @return {boolean} `true` if `version` satisfies `range`, otherwise `false`. + */ + Plugin.versionSatisfies = function(version, range) { + range = range || '*'; -/** - * The Change Data Event. - * - * This event is dispatched by a Data Manager when an item in the data store is changed. - * - * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for - * a change data event from a Game Object you would use: `sprite.data.on('changedata', listener)`. - * - * This event is dispatched for all items that change in the Data Manager. - * To listen for the change of a specific item, use the `CHANGE_DATA_KEY_EVENT` event. - * - * @event Phaser.Data.Events#CHANGE_DATA - * @since 3.0.0 - * - * @param {any} parent - A reference to the object that the Data Manager responsible for this event belongs to. - * @param {string} key - The unique key of the data item within the Data Manager. - * @param {any} value - The new value of the item in the Data Manager. - * @param {any} previousValue - The previous value of the item in the Data Manager. - */ -module.exports = 'changedata'; + var r = Plugin.versionParse(range), + v = Plugin.versionParse(version); + if (r.isRange) { + if (r.operator === '*' || version === '*') { + return true; + } -/***/ }), -/* 639 */ -/***/ (function(module, exports) { + if (r.operator === '>') { + return v.number > r.number; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (r.operator === '>=') { + return v.number >= r.number; + } -/** - * The Change Data Key Event. - * - * This event is dispatched by a Data Manager when an item in the data store is changed. - * - * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for - * the change of a specific data item from a Game Object you would use: `sprite.data.on('changedata-key', listener)`, - * where `key` is the unique string key of the data item. For example, if you have a data item stored called `gold` - * then you can listen for `sprite.data.on('changedata-gold')`. - * - * @event Phaser.Data.Events#CHANGE_DATA_KEY - * @since 3.16.1 - * - * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. - * @param {any} value - The item that was updated in the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. - * @param {any} previousValue - The previous item that was updated in the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. - */ -module.exports = 'changedata-'; + if (r.operator === '~') { + return v.major === r.major && v.minor === r.minor && v.patch >= r.patch; + } + if (r.operator === '^') { + if (r.major > 0) { + return v.major === r.major && v.number >= r.number; + } -/***/ }), -/* 640 */ -/***/ (function(module, exports) { + if (r.minor > 0) { + return v.minor === r.minor && v.patch >= r.patch; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return v.patch === r.patch; + } + } -/** - * The Data Manager Destroy Event. - * - * The Data Manager will listen for the destroy event from its parent, and then close itself down. - * - * @event Phaser.Data.Events#DESTROY - * @since 3.50.0 - */ -module.exports = 'destroy'; + return version === range || version === '*'; + }; + +})(); /***/ }), -/* 641 */ -/***/ (function(module, exports) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +/***/ 22806: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * The Remove Data Event. - * - * This event is dispatched by a Data Manager when an item is removed from it. - * - * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for - * the removal of a data item on a Game Object you would use: `sprite.data.on('removedata', listener)`. - * - * @event Phaser.Data.Events#REMOVE_DATA - * @since 3.0.0 - * - * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. - * @param {string} key - The unique key of the data item within the Data Manager. - * @param {any} data - The item that was removed from the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. - */ -module.exports = 'removedata'; +* The `Matter.Sleeping` module contains methods to manage the sleeping state of bodies. +* +* @class Sleeping +*/ +var Sleeping = {}; -/***/ }), -/* 642 */ -/***/ (function(module, exports) { +module.exports = Sleeping; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var Body = __webpack_require__(84125); +var Events = __webpack_require__(39073); +var Common = __webpack_require__(68758); -/** - * The Set Data Event. - * - * This event is dispatched by a Data Manager when a new item is added to the data store. - * - * Game Objects with data enabled have an instance of a Data Manager under the `data` property. So, to listen for - * the addition of a new data item on a Game Object you would use: `sprite.data.on('setdata', listener)`. - * - * @event Phaser.Data.Events#SET_DATA - * @since 3.0.0 - * - * @param {any} parent - A reference to the object that owns the instance of the Data Manager responsible for this event. - * @param {string} key - The unique key of the data item within the Data Manager. - * @param {any} data - The item that was added to the Data Manager. This can be of any data type, i.e. a string, boolean, number, object or instance. - */ -module.exports = 'setdata'; +(function() { + Sleeping._motionWakeThreshold = 0.18; + Sleeping._motionSleepThreshold = 0.08; + Sleeping._minBias = 0.9; -/***/ }), -/* 643 */ -/***/ (function(module, exports) { + /** + * Puts bodies to sleep or wakes them up depending on their motion. + * @method update + * @param {body[]} bodies + * @param {number} delta + */ + Sleeping.update = function(bodies, delta) { + var timeScale = delta / Common._baseDelta, + motionSleepThreshold = Sleeping._motionSleepThreshold; + + // update bodies sleeping status + for (var i = 0; i < bodies.length; i++) { + var body = bodies[i], + speed = Body.getSpeed(body), + angularSpeed = Body.getAngularSpeed(body), + motion = speed * speed + angularSpeed * angularSpeed; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // wake up bodies if they have a force applied + if (body.force.x !== 0 || body.force.y !== 0) { + Sleeping.set(body, false); + continue; + } -/** - * The Game Object Added to Scene Event. - * - * This event is dispatched when a Game Object is added to a Scene. - * - * Listen for it on a Game Object instance using `GameObject.on('addedtoscene', listener)`. - * - * @event Phaser.GameObjects.Events#ADDED_TO_SCENE - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was added to the Scene. - * @param {Phaser.Scene} scene - The Scene to which the Game Object was added. - */ -module.exports = 'addedtoscene'; + var minMotion = Math.min(body.motion, motion), + maxMotion = Math.max(body.motion, motion); + + // biased average motion estimation between frames + body.motion = Sleeping._minBias * minMotion + (1 - Sleeping._minBias) * maxMotion; + if (body.sleepThreshold > 0 && body.motion < motionSleepThreshold) { + body.sleepCounter += 1; + + if (body.sleepCounter >= body.sleepThreshold / timeScale) { + Sleeping.set(body, true); + } + } else if (body.sleepCounter > 0) { + body.sleepCounter -= 1; + } + } + }; -/***/ }), -/* 644 */ -/***/ (function(module, exports) { + /** + * Given a set of colliding pairs, wakes the sleeping bodies involved. + * @method afterCollisions + * @param {pair[]} pairs + */ + Sleeping.afterCollisions = function(pairs) { + var motionSleepThreshold = Sleeping._motionSleepThreshold; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // wake up bodies involved in collisions + for (var i = 0; i < pairs.length; i++) { + var pair = pairs[i]; + + // don't wake inactive pairs + if (!pair.isActive) + continue; -/** - * The Game Object Destroy Event. - * - * This event is dispatched when a Game Object instance is being destroyed. - * - * Listen for it on a Game Object instance using `GameObject.on('destroy', listener)`. - * - * @event Phaser.GameObjects.Events#DESTROY - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object which is being destroyed. - * @param {boolean} fromScene - `True` if this Game Object is being destroyed by the Scene, `false` if not. - */ -module.exports = 'destroy'; + var collision = pair.collision, + bodyA = collision.bodyA.parent, + bodyB = collision.bodyB.parent; + + // don't wake if at least one body is static + if ((bodyA.isSleeping && bodyB.isSleeping) || bodyA.isStatic || bodyB.isStatic) + continue; + + if (bodyA.isSleeping || bodyB.isSleeping) { + var sleepingBody = (bodyA.isSleeping && !bodyA.isStatic) ? bodyA : bodyB, + movingBody = sleepingBody === bodyA ? bodyB : bodyA; + if (!sleepingBody.isStatic && movingBody.motion > motionSleepThreshold) { + Sleeping.set(sleepingBody, false); + } + } + } + }; + + /** + * Set a body as sleeping or awake. + * @method set + * @param {body} body + * @param {boolean} isSleeping + */ + Sleeping.set = function(body, isSleeping) { + var wasSleeping = body.isSleeping; -/***/ }), -/* 645 */ -/***/ (function(module, exports) { + if (isSleeping) { + body.isSleeping = true; + body.sleepCounter = body.sleepThreshold; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + body.positionImpulse.x = 0; + body.positionImpulse.y = 0; -/** - * The Game Object Removed from Scene Event. - * - * This event is dispatched when a Game Object is removed from a Scene. - * - * Listen for it on a Game Object instance using `GameObject.on('removedfromscene', listener)`. - * - * @event Phaser.GameObjects.Events#REMOVED_FROM_SCENE - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was removed from the Scene. - * @param {Phaser.Scene} scene - The Scene from which the Game Object was removed. - */ -module.exports = 'removedfromscene'; + body.positionPrev.x = body.position.x; + body.positionPrev.y = body.position.y; + body.anglePrev = body.angle; + body.speed = 0; + body.angularSpeed = 0; + body.motion = 0; -/***/ }), -/* 646 */ -/***/ (function(module, exports) { + if (!wasSleeping) { + Events.trigger(body, 'sleepStart'); + } + } else { + body.isSleeping = false; + body.sleepCounter = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (wasSleeping) { + Events.trigger(body, 'sleepEnd'); + } + } + }; -/** - * The Video Game Object Complete Event. - * - * This event is dispatched when a Video finishes playback by reaching the end of its duration. It - * is also dispatched if a video marker sequence is being played and reaches the end. - * - * Note that not all videos can fire this event. Live streams, for example, have no fixed duration, - * so never technically 'complete'. - * - * If a video is stopped from playback, via the `Video.stop` method, it will emit the - * `VIDEO_STOP` event instead of this one. - * - * Listen for it from a Video Game Object instance using `Video.on('complete', listener)`. - * - * @event Phaser.GameObjects.Events#VIDEO_COMPLETE - * @since 3.20.0 - * - * @param {Phaser.GameObjects.Video} video - The Video Game Object which completed playback. - */ -module.exports = 'complete'; +})(); /***/ }), -/* 647 */ -/***/ (function(module, exports) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +/***/ 68516: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * The Video Game Object Created Event. - * - * This event is dispatched when the texture for a Video has been created. This happens - * when enough of the video source has been loaded that the browser is able to render a - * frame from it. - * - * Listen for it from a Video Game Object instance using `Video.on('created', listener)`. - * - * @event Phaser.GameObjects.Events#VIDEO_CREATED - * @since 3.20.0 - * - * @param {Phaser.GameObjects.Video} video - The Video Game Object which raised the event. - * @param {number} width - The width of the video. - * @param {number} height - The height of the video. - */ -module.exports = 'created'; +* The `Matter.Bodies` module contains factory methods for creating rigid body models +* with commonly used body configurations (such as rectangles, circles and other polygons). +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class Bodies +*/ +// TODO: true circle bodies -/***/ }), -/* 648 */ -/***/ (function(module, exports) { +var Bodies = {}; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +module.exports = Bodies; -/** - * The Video Game Object Error Event. - * - * This event is dispatched when a Video tries to play a source that does not exist, or is the wrong file type. - * - * Listen for it from a Video Game Object instance using `Video.on('error', listener)`. - * - * @event Phaser.GameObjects.Events#VIDEO_ERROR - * @since 3.20.0 - * - * @param {Phaser.GameObjects.Video} video - The Video Game Object which threw the error. - * @param {Event} event - The native DOM event the browser raised during playback. - */ -module.exports = 'error'; +var Vertices = __webpack_require__(39745); +var Common = __webpack_require__(68758); +var Body = __webpack_require__(84125); +var Bounds = __webpack_require__(84091); +var Vector = __webpack_require__(10438); +(function() { -/***/ }), -/* 649 */ -/***/ (function(module, exports) { + /** + * Creates a new rigid body model with a rectangle hull. + * The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method rectangle + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height + * @param {object} [options] + * @return {body} A new rectangle body + */ + Bodies.rectangle = function(x, y, width, height, options) { + options = options || {}; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var rectangle = { + label: 'Rectangle Body', + position: { x: x, y: y }, + vertices: Vertices.fromPath('L 0 0 L ' + width + ' 0 L ' + width + ' ' + height + ' L 0 ' + height) + }; -/** - * The Video Game Object Loop Event. - * - * This event is dispatched when a Video that is currently playing has looped. This only - * happens if the `loop` parameter was specified, or the `setLoop` method was called, - * and if the video has a fixed duration. Video streams, for example, cannot loop, as - * they have no duration. - * - * Looping is based on the result of the Video `timeupdate` event. This event is not - * frame-accurate, due to the way browsers work, so please do not rely on this loop - * event to be time or frame precise. - * - * Listen for it from a Video Game Object instance using `Video.on('loop', listener)`. - * - * @event Phaser.GameObjects.Events#VIDEO_LOOP - * @since 3.20.0 - * - * @param {Phaser.GameObjects.Video} video - The Video Game Object which has looped. - */ -module.exports = 'loop'; + if (options.chamfer) { + var chamfer = options.chamfer; + rectangle.vertices = Vertices.chamfer(rectangle.vertices, chamfer.radius, + chamfer.quality, chamfer.qualityMin, chamfer.qualityMax); + delete options.chamfer; + } + return Body.create(Common.extend({}, rectangle, options)); + }; -/***/ }), -/* 650 */ -/***/ (function(module, exports) { + /** + * Creates a new rigid body model with a trapezoid hull. + * The `slope` is parameterised as a fraction of `width` and must be < 1 to form a valid trapezoid. + * The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method trapezoid + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height + * @param {number} slope Must be a number < 1. + * @param {object} [options] + * @return {body} A new trapezoid body + */ + Bodies.trapezoid = function(x, y, width, height, slope, options) { + options = options || {}; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + slope *= 0.5; + var roof = (1 - (slope * 2)) * width; -/** - * The Video Game Object Play Event. - * - * This event is dispatched when a Video begins playback. For videos that do not require - * interaction unlocking, this is usually as soon as the `Video.play` method is called. - * However, for videos that require unlocking, it is fired once playback begins after - * they've been unlocked. - * - * Listen for it from a Video Game Object instance using `Video.on('play', listener)`. - * - * @event Phaser.GameObjects.Events#VIDEO_PLAY - * @since 3.20.0 - * - * @param {Phaser.GameObjects.Video} video - The Video Game Object which started playback. - */ -module.exports = 'play'; + var x1 = width * slope, + x2 = x1 + roof, + x3 = x2 + x1, + verticesPath; + if (slope < 0.5) { + verticesPath = 'L 0 0 L ' + x1 + ' ' + (-height) + ' L ' + x2 + ' ' + (-height) + ' L ' + x3 + ' 0'; + } else { + verticesPath = 'L 0 0 L ' + x2 + ' ' + (-height) + ' L ' + x3 + ' 0'; + } -/***/ }), -/* 651 */ -/***/ (function(module, exports) { + var trapezoid = { + label: 'Trapezoid Body', + position: { x: x, y: y }, + vertices: Vertices.fromPath(verticesPath) + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (options.chamfer) { + var chamfer = options.chamfer; + trapezoid.vertices = Vertices.chamfer(trapezoid.vertices, chamfer.radius, + chamfer.quality, chamfer.qualityMin, chamfer.qualityMax); + delete options.chamfer; + } -/** - * The Video Game Object Seeked Event. - * - * This event is dispatched when a Video completes seeking to a new point in its timeline. - * - * Listen for it from a Video Game Object instance using `Video.on('seeked', listener)`. - * - * @event Phaser.GameObjects.Events#VIDEO_SEEKED - * @since 3.20.0 - * - * @param {Phaser.GameObjects.Video} video - The Video Game Object which completed seeking. - */ -module.exports = 'seeked'; + return Body.create(Common.extend({}, trapezoid, options)); + }; + /** + * Creates a new rigid body model with a circle hull. + * The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method circle + * @param {number} x + * @param {number} y + * @param {number} radius + * @param {object} [options] + * @param {number} [maxSides] + * @return {body} A new circle body + */ + Bodies.circle = function(x, y, radius, options, maxSides) { + options = options || {}; -/***/ }), -/* 652 */ -/***/ (function(module, exports) { + var circle = { + label: 'Circle Body', + circleRadius: radius + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // approximate circles with polygons until true circles implemented in SAT + maxSides = maxSides || 25; + var sides = Math.ceil(Math.max(10, Math.min(maxSides, radius))); -/** - * The Video Game Object Seeking Event. - * - * This event is dispatched when a Video _begins_ seeking to a new point in its timeline. - * When the seek is complete, it will dispatch the `VIDEO_SEEKED` event to conclude. - * - * Listen for it from a Video Game Object instance using `Video.on('seeking', listener)`. - * - * @event Phaser.GameObjects.Events#VIDEO_SEEKING - * @since 3.20.0 - * - * @param {Phaser.GameObjects.Video} video - The Video Game Object which started seeking. - */ -module.exports = 'seeking'; + // optimisation: always use even number of sides (half the number of unique axes) + if (sides % 2 === 1) + sides += 1; + return Bodies.polygon(x, y, sides, radius, Common.extend({}, circle, options)); + }; -/***/ }), -/* 653 */ -/***/ (function(module, exports) { + /** + * Creates a new rigid body model with a regular polygon hull with the given number of sides. + * The options parameter is an object that specifies any properties you wish to override the defaults. + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method polygon + * @param {number} x + * @param {number} y + * @param {number} sides + * @param {number} radius + * @param {object} [options] + * @return {body} A new regular polygon body + */ + Bodies.polygon = function(x, y, sides, radius, options) { + options = options || {}; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (sides < 3) + return Bodies.circle(x, y, radius, options); -/** - * The Video Game Object Stopped Event. - * - * This event is dispatched when a Video is stopped from playback via a call to the `Video.stop` method, - * either directly via game code, or indirectly as the result of changing a video source or destroying it. - * - * Listen for it from a Video Game Object instance using `Video.on('stop', listener)`. - * - * @event Phaser.GameObjects.Events#VIDEO_STOP - * @since 3.20.0 - * - * @param {Phaser.GameObjects.Video} video - The Video Game Object which stopped playback. - */ -module.exports = 'stop'; + var theta = 2 * Math.PI / sides, + path = '', + offset = theta * 0.5; + for (var i = 0; i < sides; i += 1) { + var angle = offset + (i * theta), + xx = Math.cos(angle) * radius, + yy = Math.sin(angle) * radius; -/***/ }), -/* 654 */ -/***/ (function(module, exports) { + path += 'L ' + xx.toFixed(3) + ' ' + yy.toFixed(3) + ' '; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var polygon = { + label: 'Polygon Body', + position: { x: x, y: y }, + vertices: Vertices.fromPath(path) + }; -/** - * The Video Game Object Timeout Event. - * - * This event is dispatched when a Video has exhausted its allocated time while trying to connect to a video - * source to start playback. - * - * Listen for it from a Video Game Object instance using `Video.on('timeout', listener)`. - * - * @event Phaser.GameObjects.Events#VIDEO_TIMEOUT - * @since 3.20.0 - * - * @param {Phaser.GameObjects.Video} video - The Video Game Object which timed out. - */ -module.exports = 'timeout'; + if (options.chamfer) { + var chamfer = options.chamfer; + polygon.vertices = Vertices.chamfer(polygon.vertices, chamfer.radius, + chamfer.quality, chamfer.qualityMin, chamfer.qualityMax); + delete options.chamfer; + } + return Body.create(Common.extend({}, polygon, options)); + }; -/***/ }), -/* 655 */ -/***/ (function(module, exports) { + /** + * Utility to create a compound body based on set(s) of vertices. + * + * _Note:_ To optionally enable automatic concave vertices decomposition the [poly-decomp](https://github.com/schteppe/poly-decomp.js) + * package must be first installed and provided see `Common.setDecomp`, otherwise the convex hull of each vertex set will be used. + * + * The resulting vertices are reorientated about their centre of mass, + * and offset such that `body.position` corresponds to this point. + * + * The resulting offset may be found if needed by subtracting `body.bounds` from the original input bounds. + * To later move the centre of mass see `Body.setCentre`. + * + * Note that automatic conconcave decomposition results are not always optimal. + * For best results, simplify the input vertices as much as possible first. + * By default this function applies some addtional simplification to help. + * + * Some outputs may also require further manual processing afterwards to be robust. + * In particular some parts may need to be overlapped to avoid collision gaps. + * Thin parts and sharp points should be avoided or removed where possible. + * + * The options parameter object specifies any `Matter.Body` properties you wish to override the defaults. + * + * See the properties section of the `Matter.Body` module for detailed information on what you can pass via the `options` object. + * @method fromVertices + * @param {number} x + * @param {number} y + * @param {array} vertexSets One or more arrays of vertex points e.g. `[[{ x: 0, y: 0 }...], ...]`. + * @param {object} [options] The body options. + * @param {bool} [flagInternal=false] Optionally marks internal edges with `isInternal`. + * @param {number} [removeCollinear=0.01] Threshold when simplifying vertices along the same edge. + * @param {number} [minimumArea=10] Threshold when removing small parts. + * @param {number} [removeDuplicatePoints=0.01] Threshold when simplifying nearby vertices. + * @return {body} + */ + Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea, removeDuplicatePoints) { + var decomp = Common.getDecomp(), + canDecomp, + body, + parts, + isConvex, + isConcave, + vertices, + i, + j, + k, + v, + z; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // check decomp is as expected + canDecomp = Boolean(decomp && decomp.quickDecomp); -/** - * The Video Game Object Unlocked Event. - * - * This event is dispatched when a Video that was prevented from playback due to the browsers - * Media Engagement Interaction policy, is unlocked by a user gesture. - * - * Listen for it from a Video Game Object instance using `Video.on('unlocked', listener)`. - * - * @event Phaser.GameObjects.Events#VIDEO_UNLOCKED - * @since 3.20.0 - * - * @param {Phaser.GameObjects.Video} video - The Video Game Object which raised the event. - */ -module.exports = 'unlocked'; + options = options || {}; + parts = []; + flagInternal = typeof flagInternal !== 'undefined' ? flagInternal : false; + removeCollinear = typeof removeCollinear !== 'undefined' ? removeCollinear : 0.01; + minimumArea = typeof minimumArea !== 'undefined' ? minimumArea : 10; + removeDuplicatePoints = typeof removeDuplicatePoints !== 'undefined' ? removeDuplicatePoints : 0.01; -/***/ }), -/* 656 */ -/***/ (function(module, exports) { + // ensure vertexSets is an array of arrays + if (!Common.isArray(vertexSets[0])) { + vertexSets = [vertexSets]; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (v = 0; v < vertexSets.length; v += 1) { + vertices = vertexSets[v]; + isConvex = Vertices.isConvex(vertices); + isConcave = !isConvex; -/** - * The Game Object Added to Scene Event. - * - * This event is dispatched when a Game Object is added to a Scene. - * - * Listen for it from a Scene using `this.events.on('addedtoscene', listener)`. - * - * @event Phaser.Scenes.Events#ADDED_TO_SCENE - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was added to the Scene. - * @param {Phaser.Scene} scene - The Scene to which the Game Object was added. - */ -module.exports = 'addedtoscene'; + if (isConcave && !canDecomp) { + Common.warnOnce( + 'Bodies.fromVertices: Install the \'poly-decomp\' library and use Common.setDecomp or provide \'decomp\' as a global to decompose concave vertices.' + ); + } + if (isConvex || !canDecomp) { + if (isConvex) { + vertices = Vertices.clockwiseSort(vertices); + } else { + // fallback to convex hull when decomposition is not possible + vertices = Vertices.hull(vertices); + } -/***/ }), -/* 657 */ -/***/ (function(module, exports) { + parts.push({ + position: { x: x, y: y }, + vertices: vertices + }); + } else { + // initialise a decomposition + var concave = vertices.map(function(vertex) { + return [vertex.x, vertex.y]; + }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // vertices are concave and simple, we can decompose into parts + decomp.makeCCW(concave); + if (removeCollinear !== false) + decomp.removeCollinearPoints(concave, removeCollinear); + if (removeDuplicatePoints !== false && decomp.removeDuplicatePoints) + decomp.removeDuplicatePoints(concave, removeDuplicatePoints); -/** - * The Scene Systems Boot Event. - * - * This event is dispatched by a Scene during the Scene Systems boot process. Primarily used by Scene Plugins. - * - * Listen to it from a Scene using `this.events.on('boot', listener)`. - * - * @event Phaser.Scenes.Events#BOOT - * @since 3.0.0 - * - * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. - */ -module.exports = 'boot'; + // use the quick decomposition algorithm (Bayazit) + var decomposed = decomp.quickDecomp(concave); + // for each decomposed chunk + for (i = 0; i < decomposed.length; i++) { + var chunk = decomposed[i]; -/***/ }), -/* 658 */ -/***/ (function(module, exports) { + // convert vertices into the correct structure + var chunkVertices = chunk.map(function(vertices) { + return { + x: vertices[0], + y: vertices[1] + }; + }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // skip small chunks + if (minimumArea > 0 && Vertices.area(chunkVertices) < minimumArea) + continue; -/** - * The Scene Create Event. - * - * This event is dispatched by a Scene after it has been created by the Scene Manager. - * - * If a Scene has a `create` method then this event is emitted _after_ that has run. - * - * If there is a transition, this event will be fired after the `TRANSITION_START` event. - * - * Listen to it from a Scene using `this.events.on('create', listener)`. - * - * @event Phaser.Scenes.Events#CREATE - * @since 3.17.0 - * - * @param {Phaser.Scene} scene - A reference to the Scene that emitted this event. - */ -module.exports = 'create'; + // create a compound part + parts.push({ + position: Vertices.centre(chunkVertices), + vertices: chunkVertices + }); + } + } + } + + // create body parts + for (i = 0; i < parts.length; i++) { + parts[i] = Body.create(Common.extend(parts[i], options)); + } + + // flag internal edges (coincident part edges) + if (flagInternal) { + var coincident_max_dist = 5; + + for (i = 0; i < parts.length; i++) { + var partA = parts[i]; + + for (j = i + 1; j < parts.length; j++) { + var partB = parts[j]; + + if (Bounds.overlaps(partA.bounds, partB.bounds)) { + var pav = partA.vertices, + pbv = partB.vertices; + + // iterate vertices of both parts + for (k = 0; k < partA.vertices.length; k++) { + for (z = 0; z < partB.vertices.length; z++) { + // find distances between the vertices + var da = Vector.magnitudeSquared(Vector.sub(pav[(k + 1) % pav.length], pbv[z])), + db = Vector.magnitudeSquared(Vector.sub(pav[k], pbv[(z + 1) % pbv.length])); + + // if both vertices are very close, consider the edge concident (internal) + if (da < coincident_max_dist && db < coincident_max_dist) { + pav[k].isInternal = true; + pbv[z].isInternal = true; + } + } + } + } + } + } + } -/***/ }), -/* 659 */ -/***/ (function(module, exports) { + if (parts.length > 1) { + // create the parent body to be returned, that contains generated compound parts + body = Body.create(Common.extend({ parts: parts.slice(0) }, options)); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // offset such that body.position is at the centre off mass + Body.setPosition(body, { x: x, y: y }); -/** - * The Scene Systems Destroy Event. - * - * This event is dispatched by a Scene during the Scene Systems destroy process. - * - * Listen to it from a Scene using `this.events.on('destroy', listener)`. - * - * You should destroy any resources that may be in use by your Scene in this event handler. - * - * @event Phaser.Scenes.Events#DESTROY - * @since 3.0.0 - * - * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. - */ -module.exports = 'destroy'; + return body; + } else { + return parts[0]; + } + }; + /** + * Takes an array of Body objects and flags all internal edges (coincident parts) based on the maxDistance + * value. The array is changed in-place and returned, so you can pass this function a `Body.parts` property. + * + * @method flagCoincidentParts + * @param {body[]} parts - The Body parts, or array of bodies, to flag. + * @param {number} [maxDistance=5] + * @return {body[]} The modified `parts` parameter. + */ + Bodies.flagCoincidentParts = function (parts, maxDistance) + { + if (maxDistance === undefined) { maxDistance = 5; } -/***/ }), -/* 660 */ -/***/ (function(module, exports) { + for (var i = 0; i < parts.length; i++) + { + var partA = parts[i]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (var j = i + 1; j < parts.length; j++) + { + var partB = parts[j]; -/** - * The Scene Systems Pause Event. - * - * This event is dispatched by a Scene when it is paused, either directly via the `pause` method, or as an - * action from another Scene. - * - * Listen to it from a Scene using `this.events.on('pause', listener)`. - * - * @event Phaser.Scenes.Events#PAUSE - * @since 3.0.0 - * - * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. - * @param {any} [data] - An optional data object that was passed to this Scene when it was paused. - */ -module.exports = 'pause'; + if (Bounds.overlaps(partA.bounds, partB.bounds)) + { + var pav = partA.vertices; + var pbv = partB.vertices; + // iterate vertices of both parts + for (var k = 0; k < partA.vertices.length; k++) + { + for (var z = 0; z < partB.vertices.length; z++) + { + // find distances between the vertices + var da = Vector.magnitudeSquared(Vector.sub(pav[(k + 1) % pav.length], pbv[z])); + var db = Vector.magnitudeSquared(Vector.sub(pav[k], pbv[(z + 1) % pbv.length])); -/***/ }), -/* 661 */ -/***/ (function(module, exports) { + // if both vertices are very close, consider the edge concident (internal) + if (da < maxDistance && db < maxDistance) + { + pav[k].isInternal = true; + pbv[z].isInternal = true; + } + } + } + } + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return parts; + }; -/** - * The Scene Systems Post Update Event. - * - * This event is dispatched by a Scene during the main game loop step. - * - * The event flow for a single step of a Scene is as follows: - * - * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} - * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} - * 3. The `Scene.update` method is called, if it exists - * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} - * 5. [PRE_RENDER]{@linkcode Phaser.Scenes.Events#event:PRE_RENDER} - * 6. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} - * - * Listen to it from a Scene using `this.events.on('postupdate', listener)`. - * - * A Scene will only run its step if it is active. - * - * @event Phaser.Scenes.Events#POST_UPDATE - * @since 3.0.0 - * - * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ -module.exports = 'postupdate'; +})(); /***/ }), -/* 662 */ -/***/ (function(module, exports) { -/** - * @author samme - * @copyright 2021 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +/***/ 56643: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * The Scene Systems Pre-Render Event. - * - * This event is dispatched by a Scene during the main game loop step. - * - * The event flow for a single step of a Scene is as follows: - * - * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} - * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} - * 3. The `Scene.update` method is called, if it exists - * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} - * 5. [PRE_RENDER]{@linkcode Phaser.Scenes.Events#event:PRE_RENDER} - * 6. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} - * - * Listen to this event from a Scene using `this.events.on('prerender', listener)`. - * - * A Scene will only render if it is visible. - * - * This event is dispatched after the Scene Display List is sorted and before the Scene is rendered. - * - * @event Phaser.Scenes.Events#PRE_RENDER - * @since 3.53.0 - * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that rendered the Scene. - */ -module.exports = 'prerender'; +* The `Matter.Composites` module contains factory methods for creating composite bodies +* with commonly used configurations (such as stacks and chains). +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class Composites +*/ +var Composites = {}; -/***/ }), -/* 663 */ -/***/ (function(module, exports) { +module.exports = Composites; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var Composite = __webpack_require__(11299); +var Constraint = __webpack_require__(52838); +var Common = __webpack_require__(68758); +var Body = __webpack_require__(84125); +var Bodies = __webpack_require__(68516); -/** - * The Scene Systems Pre Update Event. - * - * This event is dispatched by a Scene during the main game loop step. - * - * The event flow for a single step of a Scene is as follows: - * - * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} - * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} - * 3. The `Scene.update` method is called, if it exists - * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} - * 5. [PRE_RENDER]{@linkcode Phaser.Scenes.Events#event:PRE_RENDER} - * 6. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} - * - * Listen to it from a Scene using `this.events.on('preupdate', listener)`. - * - * A Scene will only run its step if it is active. - * - * @event Phaser.Scenes.Events#PRE_UPDATE - * @since 3.0.0 - * - * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ -module.exports = 'preupdate'; +(function() { + /** + * Create a new composite containing bodies created in the callback in a grid arrangement. + * This function uses the body's bounds to prevent overlaps. + * @method stack + * @param {number} x Starting position in X. + * @param {number} y Starting position in Y. + * @param {number} columns + * @param {number} rows + * @param {number} columnGap + * @param {number} rowGap + * @param {function} callback + * @return {composite} A new composite containing objects created in the callback + */ + Composites.stack = function(x, y, columns, rows, columnGap, rowGap, callback) { + var stack = Composite.create({ label: 'Stack' }), + currentX = x, + currentY = y, + lastBody, + i = 0; -/***/ }), -/* 664 */ -/***/ (function(module, exports) { + for (var row = 0; row < rows; row++) { + var maxHeight = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (var column = 0; column < columns; column++) { + var body = callback(currentX, currentY, column, row, lastBody, i); -/** - * The Scene Systems Ready Event. - * - * This event is dispatched by a Scene during the Scene Systems start process. - * By this point in the process the Scene is now fully active and rendering. - * This event is meant for your game code to use, as all plugins have responded to the earlier 'start' event. - * - * Listen to it from a Scene using `this.events.on('ready', listener)`. - * - * @event Phaser.Scenes.Events#READY - * @since 3.0.0 - * - * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. - * @param {any} [data] - An optional data object that was passed to this Scene when it was started. - */ -module.exports = 'ready'; + if (body) { + var bodyHeight = body.bounds.max.y - body.bounds.min.y, + bodyWidth = body.bounds.max.x - body.bounds.min.x; + if (bodyHeight > maxHeight) + maxHeight = bodyHeight; -/***/ }), -/* 665 */ -/***/ (function(module, exports) { + Body.translate(body, { x: bodyWidth * 0.5, y: bodyHeight * 0.5 }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + currentX = body.bounds.max.x + columnGap; -/** - * The Game Object Removed from Scene Event. - * - * This event is dispatched when a Game Object is removed from a Scene. - * - * Listen for it from a Scene using `this.events.on('removedfromscene', listener)`. - * - * @event Phaser.Scenes.Events#REMOVED_FROM_SCENE - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was removed from the Scene. - * @param {Phaser.Scene} scene - The Scene from which the Game Object was removed. - */ -module.exports = 'removedfromscene'; + Composite.addBody(stack, body); + lastBody = body; + i += 1; + } else { + currentX += columnGap; + } + } -/***/ }), -/* 666 */ -/***/ (function(module, exports) { + currentY += maxHeight + rowGap; + currentX = x; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return stack; + }; -/** - * The Scene Systems Render Event. - * - * This event is dispatched by a Scene during the main game loop step. - * - * The event flow for a single step of a Scene is as follows: - * - * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} - * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} - * 3. The `Scene.update` method is called, if it exists - * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} - * 5. [PRE_RENDER]{@linkcode Phaser.Scenes.Events#event:PRE_RENDER} - * 6. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} - * - * Listen to it from a Scene using `this.events.on('render', listener)`. - * - * A Scene will only render if it is visible. - * - * By the time this event is dispatched, the Scene will have already been rendered. - * - * @event Phaser.Scenes.Events#RENDER - * @since 3.0.0 - * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that rendered the Scene. - */ -module.exports = 'render'; + /** + * Chains all bodies in the given composite together using constraints. + * @method chain + * @param {composite} composite + * @param {number} xOffsetA + * @param {number} yOffsetA + * @param {number} xOffsetB + * @param {number} yOffsetB + * @param {object} options + * @return {composite} A new composite containing objects chained together with constraints + */ + Composites.chain = function(composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options) { + var bodies = composite.bodies; + for (var i = 1; i < bodies.length; i++) { + var bodyA = bodies[i - 1], + bodyB = bodies[i], + bodyAHeight = bodyA.bounds.max.y - bodyA.bounds.min.y, + bodyAWidth = bodyA.bounds.max.x - bodyA.bounds.min.x, + bodyBHeight = bodyB.bounds.max.y - bodyB.bounds.min.y, + bodyBWidth = bodyB.bounds.max.x - bodyB.bounds.min.x; -/***/ }), -/* 667 */ -/***/ (function(module, exports) { + var defaults = { + bodyA: bodyA, + pointA: { x: bodyAWidth * xOffsetA, y: bodyAHeight * yOffsetA }, + bodyB: bodyB, + pointB: { x: bodyBWidth * xOffsetB, y: bodyBHeight * yOffsetB } + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var constraint = Common.extend(defaults, options); -/** - * The Scene Systems Resume Event. - * - * This event is dispatched by a Scene when it is resumed from a paused state, either directly via the `resume` method, - * or as an action from another Scene. - * - * Listen to it from a Scene using `this.events.on('resume', listener)`. - * - * @event Phaser.Scenes.Events#RESUME - * @since 3.0.0 - * - * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. - * @param {any} [data] - An optional data object that was passed to this Scene when it was resumed. - */ -module.exports = 'resume'; + Composite.addConstraint(composite, Constraint.create(constraint)); + } + composite.label += ' Chain'; -/***/ }), -/* 668 */ -/***/ (function(module, exports) { + return composite; + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Connects bodies in the composite with constraints in a grid pattern, with optional cross braces. + * @method mesh + * @param {composite} composite + * @param {number} columns + * @param {number} rows + * @param {boolean} crossBrace + * @param {object} options + * @return {composite} The composite containing objects meshed together with constraints + */ + Composites.mesh = function(composite, columns, rows, crossBrace, options) { + var bodies = composite.bodies, + row, + col, + bodyA, + bodyB, + bodyC; -/** - * The Scene Systems Shutdown Event. - * - * This event is dispatched by a Scene during the Scene Systems shutdown process. - * - * Listen to it from a Scene using `this.events.on('shutdown', listener)`. - * - * You should free-up any resources that may be in use by your Scene in this event handler, on the understanding - * that the Scene may, at any time, become active again. A shutdown Scene is not 'destroyed', it's simply not - * currently active. Use the [DESTROY]{@linkcode Phaser.Scenes.Events#event:DESTROY} event to completely clear resources. - * - * @event Phaser.Scenes.Events#SHUTDOWN - * @since 3.0.0 - * - * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. - * @param {any} [data] - An optional data object that was passed to this Scene when it was shutdown. - */ -module.exports = 'shutdown'; + for (row = 0; row < rows; row++) { + for (col = 1; col < columns; col++) { + bodyA = bodies[(col - 1) + (row * columns)]; + bodyB = bodies[col + (row * columns)]; + Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options))); + } + if (row > 0) { + for (col = 0; col < columns; col++) { + bodyA = bodies[col + ((row - 1) * columns)]; + bodyB = bodies[col + (row * columns)]; + Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyA, bodyB: bodyB }, options))); -/***/ }), -/* 669 */ -/***/ (function(module, exports) { + if (crossBrace && col > 0) { + bodyC = bodies[(col - 1) + ((row - 1) * columns)]; + Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyC, bodyB: bodyB }, options))); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (crossBrace && col < columns - 1) { + bodyC = bodies[(col + 1) + ((row - 1) * columns)]; + Composite.addConstraint(composite, Constraint.create(Common.extend({ bodyA: bodyC, bodyB: bodyB }, options))); + } + } + } + } -/** - * The Scene Systems Sleep Event. - * - * This event is dispatched by a Scene when it is sent to sleep, either directly via the `sleep` method, - * or as an action from another Scene. - * - * Listen to it from a Scene using `this.events.on('sleep', listener)`. - * - * @event Phaser.Scenes.Events#SLEEP - * @since 3.0.0 - * - * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. - * @param {any} [data] - An optional data object that was passed to this Scene when it was sent to sleep. - */ -module.exports = 'sleep'; + composite.label += ' Mesh'; + return composite; + }; -/***/ }), -/* 670 */ -/***/ (function(module, exports) { + /** + * Create a new composite containing bodies created in the callback in a pyramid arrangement. + * This function uses the body's bounds to prevent overlaps. + * @method pyramid + * @param {number} x Starting position in X. + * @param {number} y Starting position in Y. + * @param {number} columns + * @param {number} rows + * @param {number} columnGap + * @param {number} rowGap + * @param {function} callback + * @return {composite} A new composite containing objects created in the callback + */ + Composites.pyramid = function(x, y, columns, rows, columnGap, rowGap, callback) { + return Composites.stack(x, y, columns, rows, columnGap, rowGap, function(stackX, stackY, column, row, lastBody, i) { + var actualRows = Math.min(rows, Math.ceil(columns / 2)), + lastBodyWidth = lastBody ? lastBody.bounds.max.x - lastBody.bounds.min.x : 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (row > actualRows) + return; -/** - * The Scene Systems Start Event. - * - * This event is dispatched by a Scene during the Scene Systems start process. Primarily used by Scene Plugins. - * - * Listen to it from a Scene using `this.events.on('start', listener)`. - * - * @event Phaser.Scenes.Events#START - * @since 3.0.0 - * - * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. - */ -module.exports = 'start'; + // reverse row order + row = actualRows - row; + var start = row, + end = columns - 1 - row; -/***/ }), -/* 671 */ -/***/ (function(module, exports) { + if (column < start || column > end) + return; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // retroactively fix the first body's position, since width was unknown + if (i === 1) { + Body.translate(lastBody, { x: (column + (columns % 2 === 1 ? 1 : -1)) * lastBodyWidth, y: 0 }); + } -/** - * The Scene Transition Complete Event. - * - * This event is dispatched by the Target Scene of a transition. - * - * It happens when the transition process has completed. This occurs when the duration timer equals or exceeds the duration - * of the transition. - * - * Listen to it from a Scene using `this.events.on('transitioncomplete', listener)`. - * - * The Scene Transition event flow is as follows: - * - * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. - * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. - * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... - * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. - * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. - * - * @event Phaser.Scenes.Events#TRANSITION_COMPLETE - * @since 3.5.0 - * - * @param {Phaser.Scene} scene -The Scene on which the transitioned completed. - */ -module.exports = 'transitioncomplete'; + var xOffset = lastBody ? column * lastBodyWidth : 0; + return callback(x + xOffset + column * columnGap, stackY, column, row, lastBody, i); + }); + }; -/***/ }), -/* 672 */ -/***/ (function(module, exports) { + /** + * This has now moved to the [newtonsCradle example](https://github.com/liabru/matter-js/blob/master/examples/newtonsCradle.js), follow that instead as this function is deprecated here. + * @deprecated moved to newtonsCradle example + * @method newtonsCradle + * @param {number} x Starting position in X. + * @param {number} y Starting position in Y. + * @param {number} number + * @param {number} size + * @param {number} length + * @return {composite} A new composite newtonsCradle body + */ + Composites.newtonsCradle = function(x, y, number, size, length) { + var newtonsCradle = Composite.create({ label: 'Newtons Cradle' }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (var i = 0; i < number; i++) { + var separation = 1.9, + circle = Bodies.circle(x + i * (size * separation), y + length, size, + { inertia: Infinity, restitution: 1, friction: 0, frictionAir: 0.0001, slop: 1 }), + constraint = Constraint.create({ pointA: { x: x + i * (size * separation), y: y }, bodyB: circle }); -/** - * The Scene Transition Init Event. - * - * This event is dispatched by the Target Scene of a transition. - * - * It happens immediately after the `Scene.init` method is called. If the Scene does not have an `init` method, - * this event is not dispatched. - * - * Listen to it from a Scene using `this.events.on('transitioninit', listener)`. - * - * The Scene Transition event flow is as follows: - * - * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. - * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. - * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... - * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. - * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. - * - * @event Phaser.Scenes.Events#TRANSITION_INIT - * @since 3.5.0 - * - * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. - * @param {number} duration - The duration of the transition in ms. - */ -module.exports = 'transitioninit'; + Composite.addBody(newtonsCradle, circle); + Composite.addConstraint(newtonsCradle, constraint); + } + return newtonsCradle; + }; -/***/ }), -/* 673 */ -/***/ (function(module, exports) { + /** + * This has now moved to the [car example](https://github.com/liabru/matter-js/blob/master/examples/car.js), follow that instead as this function is deprecated here. + * @deprecated moved to car example + * @method car + * @param {number} x Starting position in X. + * @param {number} y Starting position in Y. + * @param {number} width + * @param {number} height + * @param {number} wheelSize + * @return {composite} A new composite car body + */ + Composites.car = function(x, y, width, height, wheelSize) { + var group = Body.nextGroup(true), + wheelBase = 20, + wheelAOffset = -width * 0.5 + wheelBase, + wheelBOffset = width * 0.5 - wheelBase, + wheelYOffset = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var car = Composite.create({ label: 'Car' }), + body = Bodies.rectangle(x, y, width, height, { + collisionFilter: { + group: group + }, + chamfer: { + radius: height * 0.5 + }, + density: 0.0002 + }); -/** - * The Scene Transition Out Event. - * - * This event is dispatched by a Scene when it initiates a transition to another Scene. - * - * Listen to it from a Scene using `this.events.on('transitionout', listener)`. - * - * The Scene Transition event flow is as follows: - * - * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. - * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. - * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... - * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. - * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. - * - * @event Phaser.Scenes.Events#TRANSITION_OUT - * @since 3.5.0 - * - * @param {Phaser.Scene} target - A reference to the Scene that is being transitioned to. - * @param {number} duration - The duration of the transition in ms. - */ -module.exports = 'transitionout'; + var wheelA = Bodies.circle(x + wheelAOffset, y + wheelYOffset, wheelSize, { + collisionFilter: { + group: group + }, + friction: 0.8 + }); + var wheelB = Bodies.circle(x + wheelBOffset, y + wheelYOffset, wheelSize, { + collisionFilter: { + group: group + }, + friction: 0.8 + }); -/***/ }), -/* 674 */ -/***/ (function(module, exports) { + var axelA = Constraint.create({ + bodyB: body, + pointB: { x: wheelAOffset, y: wheelYOffset }, + bodyA: wheelA, + stiffness: 1, + length: 0 + }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var axelB = Constraint.create({ + bodyB: body, + pointB: { x: wheelBOffset, y: wheelYOffset }, + bodyA: wheelB, + stiffness: 1, + length: 0 + }); -/** - * The Scene Transition Start Event. - * - * This event is dispatched by the Target Scene of a transition, only if that Scene was not asleep. - * - * It happens immediately after the `Scene.create` method is called. If the Scene does not have a `create` method, - * this event is dispatched anyway. - * - * If the Target Scene was sleeping then the [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} event is - * dispatched instead of this event. - * - * Listen to it from a Scene using `this.events.on('transitionstart', listener)`. - * - * The Scene Transition event flow is as follows: - * - * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. - * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. - * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... - * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. - * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. - * - * @event Phaser.Scenes.Events#TRANSITION_START - * @since 3.5.0 - * - * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. - * @param {number} duration - The duration of the transition in ms. - */ -module.exports = 'transitionstart'; + Composite.addBody(car, body); + Composite.addBody(car, wheelA); + Composite.addBody(car, wheelB); + Composite.addConstraint(car, axelA); + Composite.addConstraint(car, axelB); + return car; + }; -/***/ }), -/* 675 */ -/***/ (function(module, exports) { + /** + * This has now moved to the [softBody example](https://github.com/liabru/matter-js/blob/master/examples/softBody.js) + * and the [cloth example](https://github.com/liabru/matter-js/blob/master/examples/cloth.js), follow those instead as this function is deprecated here. + * @deprecated moved to softBody and cloth examples + * @method softBody + * @param {number} x Starting position in X. + * @param {number} y Starting position in Y. + * @param {number} columns + * @param {number} rows + * @param {number} columnGap + * @param {number} rowGap + * @param {boolean} crossBrace + * @param {number} particleRadius + * @param {} particleOptions + * @param {} constraintOptions + * @return {composite} A new composite softBody + */ + Composites.softBody = function(x, y, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions) { + particleOptions = Common.extend({ inertia: Infinity }, particleOptions); + constraintOptions = Common.extend({ stiffness: 0.2, render: { type: 'line', anchors: false } }, constraintOptions); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var softBody = Composites.stack(x, y, columns, rows, columnGap, rowGap, function(stackX, stackY) { + return Bodies.circle(stackX, stackY, particleRadius, particleOptions); + }); -/** - * The Scene Transition Wake Event. - * - * This event is dispatched by the Target Scene of a transition, only if that Scene was asleep before - * the transition began. If the Scene was not asleep the [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} event is dispatched instead. - * - * Listen to it from a Scene using `this.events.on('transitionwake', listener)`. - * - * The Scene Transition event flow is as follows: - * - * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. - * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. - * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... - * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. - * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. - * - * @event Phaser.Scenes.Events#TRANSITION_WAKE - * @since 3.5.0 - * - * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. - * @param {number} duration - The duration of the transition in ms. - */ -module.exports = 'transitionwake'; + Composites.mesh(softBody, columns, rows, crossBrace, constraintOptions); + + softBody.label = 'Soft Body'; + + return softBody; + }; + +})(); /***/ }), -/* 676 */ -/***/ (function(module, exports) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +/***/ 50658: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * The Scene Systems Update Event. - * - * This event is dispatched by a Scene during the main game loop step. - * - * The event flow for a single step of a Scene is as follows: - * - * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} - * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} - * 3. The `Scene.update` method is called, if it exists - * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} - * 5. [PRE_RENDER]{@linkcode Phaser.Scenes.Events#event:PRE_RENDER} - * 6. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} - * - * Listen to it from a Scene using `this.events.on('update', listener)`. - * - * A Scene will only run its step if it is active. - * - * @event Phaser.Scenes.Events#UPDATE - * @since 3.0.0 - * - * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ -module.exports = 'update'; +* The `Matter.Axes` module contains methods for creating and manipulating sets of axes. +* +* @class Axes +*/ +var Axes = {}; -/***/ }), -/* 677 */ -/***/ (function(module, exports) { +module.exports = Axes; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var Vector = __webpack_require__(10438); +var Common = __webpack_require__(68758); -/** - * The Scene Systems Wake Event. - * - * This event is dispatched by a Scene when it is woken from sleep, either directly via the `wake` method, - * or as an action from another Scene. - * - * Listen to it from a Scene using `this.events.on('wake', listener)`. - * - * @event Phaser.Scenes.Events#WAKE - * @since 3.0.0 - * - * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. - * @param {any} [data] - An optional data object that was passed to this Scene when it was woken up. - */ -module.exports = 'wake'; +(function() { + /** + * Creates a new set of axes from the given vertices. + * @method fromVertices + * @param {vertices} vertices + * @return {axes} A new axes from the given vertices + */ + Axes.fromVertices = function(vertices) { + var axes = {}; -/***/ }), -/* 678 */ -/***/ (function(module, exports, __webpack_require__) { + // find the unique axes, using edge normal gradients + for (var i = 0; i < vertices.length; i++) { + var j = (i + 1) % vertices.length, + normal = Vector.normalise({ + x: vertices[j].y - vertices[i].y, + y: vertices[i].x - vertices[j].x + }), + gradient = (normal.y === 0) ? Infinity : (normal.x / normal.y); + + // limit precision + gradient = gradient.toFixed(3).toString(); + axes[gradient] = normal; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return Common.values(axes); + }; -var PropertyValueInc = __webpack_require__(46); + /** + * Rotates a set of axes by the given angle. + * @method rotate + * @param {axes} axes + * @param {number} angle + */ + Axes.rotate = function(axes, angle) { + if (angle === 0) + return; + + var cos = Math.cos(angle), + sin = Math.sin(angle); -/** - * Takes an array of Game Objects, or any objects that have a public `alpha` property, - * and then adds the given value to each of their `alpha` properties. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `IncAlpha(group.getChildren(), value, step)` - * - * @function Phaser.Actions.IncAlpha - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to be added to the `alpha` property. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var IncAlpha = function (items, value, step, index, direction) -{ - return PropertyValueInc(items, 'alpha', value, step, index, direction); -}; + for (var i = 0; i < axes.length; i++) { + var axis = axes[i], + xx; + xx = axis.x * cos - axis.y * sin; + axis.y = axis.x * sin + axis.y * cos; + axis.x = xx; + } + }; -module.exports = IncAlpha; +})(); /***/ }), -/* 679 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 84091: +/***/ ((module) => { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +* The `Matter.Bounds` module contains methods for creating and manipulating axis-aligned bounding boxes (AABB). +* +* @class Bounds +*/ + +var Bounds = {}; -var PropertyValueInc = __webpack_require__(46); +module.exports = Bounds; -/** - * Takes an array of Game Objects, or any objects that have a public `x` property, - * and then adds the given value to each of their `x` properties. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `IncX(group.getChildren(), value, step)` - * - * @function Phaser.Actions.IncX - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to be added to the `x` property. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var IncX = function (items, value, step, index, direction) -{ - return PropertyValueInc(items, 'x', value, step, index, direction); -}; +(function() { -module.exports = IncX; + /** + * Creates a new axis-aligned bounding box (AABB) for the given vertices. + * @method create + * @param {vertices} vertices + * @return {bounds} A new bounds object + */ + Bounds.create = function(vertices) { + var bounds = { + min: { x: 0, y: 0 }, + max: { x: 0, y: 0 } + }; + if (vertices) + Bounds.update(bounds, vertices); + + return bounds; + }; -/***/ }), -/* 680 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Updates bounds using the given vertices and extends the bounds given a velocity. + * @method update + * @param {bounds} bounds + * @param {vertices} vertices + * @param {vector} velocity + */ + Bounds.update = function(bounds, vertices, velocity) { + bounds.min.x = Infinity; + bounds.max.x = -Infinity; + bounds.min.y = Infinity; + bounds.max.y = -Infinity; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (var i = 0; i < vertices.length; i++) { + var vertex = vertices[i]; + if (vertex.x > bounds.max.x) bounds.max.x = vertex.x; + if (vertex.x < bounds.min.x) bounds.min.x = vertex.x; + if (vertex.y > bounds.max.y) bounds.max.y = vertex.y; + if (vertex.y < bounds.min.y) bounds.min.y = vertex.y; + } + + if (velocity) { + if (velocity.x > 0) { + bounds.max.x += velocity.x; + } else { + bounds.min.x += velocity.x; + } + + if (velocity.y > 0) { + bounds.max.y += velocity.y; + } else { + bounds.min.y += velocity.y; + } + } + }; -var PropertyValueInc = __webpack_require__(46); + /** + * Returns true if the bounds contains the given point. + * @method contains + * @param {bounds} bounds + * @param {vector} point + * @return {boolean} True if the bounds contain the point, otherwise false + */ + Bounds.contains = function(bounds, point) { + return point.x >= bounds.min.x && point.x <= bounds.max.x + && point.y >= bounds.min.y && point.y <= bounds.max.y; + }; -/** - * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, - * and then adds the given value to each of them. - * - * The optional `stepX` and `stepY` properties are applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `IncXY(group.getChildren(), x, y, stepX, stepY)` - * - * @function Phaser.Actions.IncXY - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} x - The amount to be added to the `x` property. - * @param {number} [y=x] - The amount to be added to the `y` property. If `undefined` or `null` it uses the `x` value. - * @param {number} [stepX=0] - This is added to the `x` amount, multiplied by the iteration counter. - * @param {number} [stepY=0] - This is added to the `y` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var IncXY = function (items, x, y, stepX, stepY, index, direction) -{ - if (y === undefined || y === null) { y = x; } + /** + * Returns true if the two bounds intersect. + * @method overlaps + * @param {bounds} boundsA + * @param {bounds} boundsB + * @return {boolean} True if the bounds overlap, otherwise false + */ + Bounds.overlaps = function(boundsA, boundsB) { + return (boundsA.min.x <= boundsB.max.x && boundsA.max.x >= boundsB.min.x + && boundsA.max.y >= boundsB.min.y && boundsA.min.y <= boundsB.max.y); + }; + + /** + * Translates the bounds by the given vector. + * @method translate + * @param {bounds} bounds + * @param {vector} vector + */ + Bounds.translate = function(bounds, vector) { + bounds.min.x += vector.x; + bounds.max.x += vector.x; + bounds.min.y += vector.y; + bounds.max.y += vector.y; + }; + + /** + * Shifts the bounds to the given position. + * @method shift + * @param {bounds} bounds + * @param {vector} position + */ + Bounds.shift = function(bounds, position) { + var deltaX = bounds.max.x - bounds.min.x, + deltaY = bounds.max.y - bounds.min.y; + + bounds.min.x = position.x; + bounds.max.x = position.x + deltaX; + bounds.min.y = position.y; + bounds.max.y = position.y + deltaY; + }; + +})(); - PropertyValueInc(items, 'x', x, stepX, index, direction); - return PropertyValueInc(items, 'y', y, stepY, index, direction); -}; +/***/ }), -module.exports = IncXY; +/***/ 92765: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/** +* The `Matter.Svg` module contains methods for converting SVG images into an array of vector points. +* +* To use this module you also need the SVGPathSeg polyfill: https://github.com/progers/pathseg +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class Svg +*/ -/***/ }), -/* 681 */ -/***/ (function(module, exports, __webpack_require__) { +var Svg = {}; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +module.exports = Svg; -var PropertyValueInc = __webpack_require__(46); +var Bounds = __webpack_require__(84091); +var Common = __webpack_require__(68758); -/** - * Takes an array of Game Objects, or any objects that have a public `y` property, - * and then adds the given value to each of their `y` properties. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `IncY(group.getChildren(), value, step)` - * - * @function Phaser.Actions.IncY - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to be added to the `y` property. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var IncY = function (items, value, step, index, direction) -{ - return PropertyValueInc(items, 'y', value, step, index, direction); -}; +(function() { -module.exports = IncY; + /** + * Converts an SVG path into an array of vector points. + * If the input path forms a concave shape, you must decompose the result into convex parts before use. + * See `Bodies.fromVertices` which provides support for this. + * Note that this function is not guaranteed to support complex paths (such as those with holes). + * You must load the `pathseg.js` polyfill on newer browsers. + * @method pathToVertices + * @param {SVGPathElement} path + * @param {Number} [sampleLength=15] + * @return {Vector[]} points + */ + Svg.pathToVertices = function(path, sampleLength) { + if (typeof window !== 'undefined' && !('SVGPathSeg' in window)) { + Common.warn('Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.'); + } + // https://github.com/wout/svg.topoly.js/blob/master/svg.topoly.js + var i, il, total, point, segment, segments, + segmentsQueue, lastSegment, + lastPoint, segmentIndex, points = [], + lx, ly, length = 0, x = 0, y = 0; -/***/ }), -/* 682 */ -/***/ (function(module, exports) { + sampleLength = sampleLength || 15; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var addPoint = function(px, py, pathSegType) { + // all odd-numbered path types are relative except PATHSEG_CLOSEPATH (1) + var isRelative = pathSegType % 2 === 1 && pathSegType > 1; -/** - * Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of a Circle. - * - * If you wish to pass a `Phaser.GameObjects.Circle` Shape to this function, you should pass its `geom` property. - * - * @function Phaser.Actions.PlaceOnCircle - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Circle} circle - The Circle to position the Game Objects on. - * @param {number} [startAngle=0] - Optional angle to start position from, in radians. - * @param {number} [endAngle=6.28] - Optional angle to stop position at, in radians. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var PlaceOnCircle = function (items, circle, startAngle, endAngle) -{ - if (startAngle === undefined) { startAngle = 0; } - if (endAngle === undefined) { endAngle = 6.28; } + // when the last point doesn't equal the current point add the current point + if (!lastPoint || px != lastPoint.x || py != lastPoint.y) { + if (lastPoint && isRelative) { + lx = lastPoint.x; + ly = lastPoint.y; + } else { + lx = 0; + ly = 0; + } - var angle = startAngle; - var angleStep = (endAngle - startAngle) / items.length; + var point = { + x: lx + px, + y: ly + py + }; - for (var i = 0; i < items.length; i++) - { - items[i].x = circle.x + (circle.radius * Math.cos(angle)); - items[i].y = circle.y + (circle.radius * Math.sin(angle)); + // set last point + if (isRelative || !lastPoint) { + lastPoint = point; + } - angle += angleStep; - } + points.push(point); - return items; -}; + x = lx + px; + y = ly + py; + } + }; -module.exports = PlaceOnCircle; + var addSegmentPoint = function(segment) { + var segType = segment.pathSegTypeAsLetter.toUpperCase(); + // skip path ends + if (segType === 'Z') + return; -/***/ }), -/* 683 */ -/***/ (function(module, exports) { + // map segment to x and y + switch (segType) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + case 'M': + case 'L': + case 'T': + case 'C': + case 'S': + case 'Q': + x = segment.x; + y = segment.y; + break; + case 'H': + x = segment.x; + break; + case 'V': + y = segment.y; + break; + } -/** - * Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of an Ellipse. - * - * If you wish to pass a `Phaser.GameObjects.Ellipse` Shape to this function, you should pass its `geom` property. - * - * @function Phaser.Actions.PlaceOnEllipse - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to position the Game Objects on. - * @param {number} [startAngle=0] - Optional angle to start position from, in radians. - * @param {number} [endAngle=6.28] - Optional angle to stop position at, in radians. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var PlaceOnEllipse = function (items, ellipse, startAngle, endAngle) -{ - if (startAngle === undefined) { startAngle = 0; } - if (endAngle === undefined) { endAngle = 6.28; } + addPoint(x, y, segment.pathSegType); + }; - var angle = startAngle; - var angleStep = (endAngle - startAngle) / items.length; + // ensure path is absolute + Svg._svgPathToAbsolute(path); - var a = ellipse.width / 2; - var b = ellipse.height / 2; + // get total length + total = path.getTotalLength(); - for (var i = 0; i < items.length; i++) - { - items[i].x = ellipse.x + a * Math.cos(angle); - items[i].y = ellipse.y + b * Math.sin(angle); + // queue segments + segments = []; + for (i = 0; i < path.pathSegList.numberOfItems; i += 1) + segments.push(path.pathSegList.getItem(i)); - angle += angleStep; - } + segmentsQueue = segments.concat(); - return items; -}; + // sample through path + while (length < total) { + // get segment at position + segmentIndex = path.getPathSegAtLength(length); + segment = segments[segmentIndex]; -module.exports = PlaceOnEllipse; + // new segment + if (segment != lastSegment) { + while (segmentsQueue.length && segmentsQueue[0] != segment) + addSegmentPoint(segmentsQueue.shift()); + lastSegment = segment; + } -/***/ }), -/* 684 */ -/***/ (function(module, exports, __webpack_require__) { + // add points in between when curving + // TODO: adaptive sampling + switch (segment.pathSegTypeAsLetter.toUpperCase()) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + case 'C': + case 'T': + case 'S': + case 'Q': + case 'A': + point = path.getPointAtLength(length); + addPoint(point.x, point.y, 0); + break; -var GetPoints = __webpack_require__(172); + } -/** - * Positions an array of Game Objects on evenly spaced points of a Line. - * - * @function Phaser.Actions.PlaceOnLine - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Line} line - The Line to position the Game Objects on. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var PlaceOnLine = function (items, line) -{ - var points = GetPoints(line, items.length); + // increment by sample value + length += sampleLength; + } - for (var i = 0; i < items.length; i++) - { - var item = items[i]; - var point = points[i]; + // add remaining segments not passed by sampling + for (i = 0, il = segmentsQueue.length; i < il; ++i) + addSegmentPoint(segmentsQueue[i]); - item.x = point.x; - item.y = point.y; - } + return points; + }; - return items; -}; + Svg._svgPathToAbsolute = function(path) { + // http://phrogz.net/convert-svg-path-to-all-absolute-commands + // Copyright (c) Gavin Kistner + // http://phrogz.net/js/_ReuseLicense.txt + // Modifications: tidy formatting and naming + var x0, y0, x1, y1, x2, y2, segs = path.pathSegList, + x = 0, y = 0, len = segs.numberOfItems; -module.exports = PlaceOnLine; + for (var i = 0; i < len; ++i) { + var seg = segs.getItem(i), + segType = seg.pathSegTypeAsLetter; + if (/[MLHVCSQTA]/.test(segType)) { + if ('x' in seg) x = seg.x; + if ('y' in seg) y = seg.y; + } else { + if ('x1' in seg) x1 = x + seg.x1; + if ('x2' in seg) x2 = x + seg.x2; + if ('y1' in seg) y1 = y + seg.y1; + if ('y2' in seg) y2 = y + seg.y2; + if ('x' in seg) x += seg.x; + if ('y' in seg) y += seg.y; -/***/ }), -/* 685 */ -/***/ (function(module, exports, __webpack_require__) { + switch (segType) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + case 'm': + segs.replaceItem(path.createSVGPathSegMovetoAbs(x, y), i); + break; + case 'l': + segs.replaceItem(path.createSVGPathSegLinetoAbs(x, y), i); + break; + case 'h': + segs.replaceItem(path.createSVGPathSegLinetoHorizontalAbs(x), i); + break; + case 'v': + segs.replaceItem(path.createSVGPathSegLinetoVerticalAbs(y), i); + break; + case 'c': + segs.replaceItem(path.createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2), i); + break; + case 's': + segs.replaceItem(path.createSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2), i); + break; + case 'q': + segs.replaceItem(path.createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1), i); + break; + case 't': + segs.replaceItem(path.createSVGPathSegCurvetoQuadraticSmoothAbs(x, y), i); + break; + case 'a': + segs.replaceItem(path.createSVGPathSegArcAbs(x, y, seg.r1, seg.r2, seg.angle, seg.largeArcFlag, seg.sweepFlag), i); + break; + case 'z': + case 'Z': + x = x0; + y = y0; + break; -var MarchingAnts = __webpack_require__(316); -var RotateLeft = __webpack_require__(178); -var RotateRight = __webpack_require__(179); + } + } -/** - * Takes an array of Game Objects and positions them on evenly spaced points around the perimeter of a Rectangle. - * - * Placement starts from the top-left of the rectangle, and proceeds in a clockwise direction. - * If the `shift` parameter is given you can offset where placement begins. - * - * @function Phaser.Actions.PlaceOnRectangle - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to position the Game Objects on. - * @param {number} [shift=0] - An optional positional offset. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var PlaceOnRectangle = function (items, rect, shift) -{ - if (shift === undefined) { shift = 0; } + if (segType == 'M' || segType == 'm') { + x0 = x; + y0 = y; + } + } + }; - var points = MarchingAnts(rect, false, items.length); +})(); - if (shift > 0) - { - RotateLeft(points, shift); - } - else if (shift < 0) - { - RotateRight(points, Math.abs(shift)); - } +/***/ }), - for (var i = 0; i < items.length; i++) - { - items[i].x = points[i].x; - items[i].y = points[i].y; - } +/***/ 10438: +/***/ ((module) => { - return items; -}; +/** +* The `Matter.Vector` module contains methods for creating and manipulating vectors. +* Vectors are the basis of all the geometry related operations in the engine. +* A `Matter.Vector` object is of the form `{ x: 0, y: 0 }`. +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class Vector +*/ -module.exports = PlaceOnRectangle; +// TODO: consider params for reusing vector objects +var Vector = {}; -/***/ }), -/* 686 */ -/***/ (function(module, exports, __webpack_require__) { +module.exports = Vector; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +(function() { -var BresenhamPoints = __webpack_require__(317); + /** + * Creates a new vector. + * @method create + * @param {number} x + * @param {number} y + * @return {vector} A new vector + */ + Vector.create = function(x, y) { + return { x: x || 0, y: y || 0 }; + }; -/** - * Takes an array of Game Objects and positions them on evenly spaced points around the edges of a Triangle. - * - * If you wish to pass a `Phaser.GameObjects.Triangle` Shape to this function, you should pass its `geom` property. - * - * @function Phaser.Actions.PlaceOnTriangle - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Triangle} triangle - The Triangle to position the Game Objects on. - * @param {number} [stepRate=1] - An optional step rate, to increase or decrease the packing of the Game Objects on the lines. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var PlaceOnTriangle = function (items, triangle, stepRate) -{ - var p1 = BresenhamPoints({ x1: triangle.x1, y1: triangle.y1, x2: triangle.x2, y2: triangle.y2 }, stepRate); - var p2 = BresenhamPoints({ x1: triangle.x2, y1: triangle.y2, x2: triangle.x3, y2: triangle.y3 }, stepRate); - var p3 = BresenhamPoints({ x1: triangle.x3, y1: triangle.y3, x2: triangle.x1, y2: triangle.y1 }, stepRate); + /** + * Returns a new vector with `x` and `y` copied from the given `vector`. + * @method clone + * @param {vector} vector + * @return {vector} A new cloned vector + */ + Vector.clone = function(vector) { + return { x: vector.x, y: vector.y }; + }; - // Remove overlaps - p1.pop(); - p2.pop(); - p3.pop(); + /** + * Returns the magnitude (length) of a vector. + * @method magnitude + * @param {vector} vector + * @return {number} The magnitude of the vector + */ + Vector.magnitude = function(vector) { + return Math.sqrt((vector.x * vector.x) + (vector.y * vector.y)); + }; - p1 = p1.concat(p2, p3); + /** + * Returns the magnitude (length) of a vector (therefore saving a `sqrt` operation). + * @method magnitudeSquared + * @param {vector} vector + * @return {number} The squared magnitude of the vector + */ + Vector.magnitudeSquared = function(vector) { + return (vector.x * vector.x) + (vector.y * vector.y); + }; - var step = p1.length / items.length; - var p = 0; + /** + * Rotates the vector about (0, 0) by specified angle. + * @method rotate + * @param {vector} vector + * @param {number} angle + * @param {vector} [output] + * @return {vector} The vector rotated about (0, 0) + */ + Vector.rotate = function(vector, angle, output) { + var cos = Math.cos(angle), sin = Math.sin(angle); + if (!output) output = {}; + var x = vector.x * cos - vector.y * sin; + output.y = vector.x * sin + vector.y * cos; + output.x = x; + return output; + }; - for (var i = 0; i < items.length; i++) - { - var item = items[i]; - var point = p1[Math.floor(p)]; + /** + * Rotates the vector about a specified point by specified angle. + * @method rotateAbout + * @param {vector} vector + * @param {number} angle + * @param {vector} point + * @param {vector} [output] + * @return {vector} A new vector rotated about the point + */ + Vector.rotateAbout = function(vector, angle, point, output) { + var cos = Math.cos(angle), sin = Math.sin(angle); + if (!output) output = {}; + var x = point.x + ((vector.x - point.x) * cos - (vector.y - point.y) * sin); + output.y = point.y + ((vector.x - point.x) * sin + (vector.y - point.y) * cos); + output.x = x; + return output; + }; - item.x = point.x; - item.y = point.y; + /** + * Normalises a vector (such that its magnitude is `1`). + * @method normalise + * @param {vector} vector + * @return {vector} A new vector normalised + */ + Vector.normalise = function(vector) { + var magnitude = Vector.magnitude(vector); + if (magnitude === 0) + return { x: 0, y: 0 }; + return { x: vector.x / magnitude, y: vector.y / magnitude }; + }; - p += step; - } + /** + * Returns the dot-product of two vectors. + * @method dot + * @param {vector} vectorA + * @param {vector} vectorB + * @return {number} The dot product of the two vectors + */ + Vector.dot = function(vectorA, vectorB) { + return (vectorA.x * vectorB.x) + (vectorA.y * vectorB.y); + }; - return items; -}; + /** + * Returns the cross-product of two vectors. + * @method cross + * @param {vector} vectorA + * @param {vector} vectorB + * @return {number} The cross product of the two vectors + */ + Vector.cross = function(vectorA, vectorB) { + return (vectorA.x * vectorB.y) - (vectorA.y * vectorB.x); + }; -module.exports = PlaceOnTriangle; + /** + * Returns the cross-product of three vectors. + * @method cross3 + * @param {vector} vectorA + * @param {vector} vectorB + * @param {vector} vectorC + * @return {number} The cross product of the three vectors + */ + Vector.cross3 = function(vectorA, vectorB, vectorC) { + return (vectorB.x - vectorA.x) * (vectorC.y - vectorA.y) - (vectorB.y - vectorA.y) * (vectorC.x - vectorA.x); + }; + /** + * Adds the two vectors. + * @method add + * @param {vector} vectorA + * @param {vector} vectorB + * @param {vector} [output] + * @return {vector} A new vector of vectorA and vectorB added + */ + Vector.add = function(vectorA, vectorB, output) { + if (!output) output = {}; + output.x = vectorA.x + vectorB.x; + output.y = vectorA.y + vectorB.y; + return output; + }; -/***/ }), -/* 687 */ -/***/ (function(module, exports) { + /** + * Subtracts the two vectors. + * @method sub + * @param {vector} vectorA + * @param {vector} vectorB + * @param {vector} [output] + * @return {vector} A new vector of vectorA and vectorB subtracted + */ + Vector.sub = function(vectorA, vectorB, output) { + if (!output) output = {}; + output.x = vectorA.x - vectorB.x; + output.y = vectorA.y - vectorB.y; + return output; + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Multiplies a vector and a scalar. + * @method mult + * @param {vector} vector + * @param {number} scalar + * @return {vector} A new vector multiplied by scalar + */ + Vector.mult = function(vector, scalar) { + return { x: vector.x * scalar, y: vector.y * scalar }; + }; -/** - * Play an animation on all Game Objects in the array that have an Animation component. - * - * You can pass either an animation key, or an animation configuration object for more control over the playback. - * - * @function Phaser.Actions.PlayAnimation - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {(string|Phaser.Animations.Animation|Phaser.Types.Animations.PlayAnimationConfig)} key - The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object. - * @param {boolean} [ignoreIfPlaying=false] - If this animation is already playing then ignore this call. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var PlayAnimation = function (items, key, ignoreIfPlaying) -{ - for (var i = 0; i < items.length; i++) - { - var gameObject = items[i]; + /** + * Divides a vector and a scalar. + * @method div + * @param {vector} vector + * @param {number} scalar + * @return {vector} A new vector divided by scalar + */ + Vector.div = function(vector, scalar) { + return { x: vector.x / scalar, y: vector.y / scalar }; + }; - if (gameObject.anims) - { - gameObject.anims.play(key, ignoreIfPlaying); - } - } + /** + * Returns the perpendicular vector. Set `negate` to true for the perpendicular in the opposite direction. + * @method perp + * @param {vector} vector + * @param {bool} [negate=false] + * @return {vector} The perpendicular vector + */ + Vector.perp = function(vector, negate) { + negate = negate === true ? -1 : 1; + return { x: negate * -vector.y, y: negate * vector.x }; + }; - return items; -}; + /** + * Negates both components of a vector such that it points in the opposite direction. + * @method neg + * @param {vector} vector + * @return {vector} The negated vector + */ + Vector.neg = function(vector) { + return { x: -vector.x, y: -vector.y }; + }; -module.exports = PlayAnimation; + /** + * Returns the angle between the vector `vectorB - vectorA` and the x-axis in radians. + * @method angle + * @param {vector} vectorA + * @param {vector} vectorB + * @return {number} The angle in radians + */ + Vector.angle = function(vectorA, vectorB) { + return Math.atan2(vectorB.y - vectorA.y, vectorB.x - vectorA.x); + }; + + /** + * Temporary vector pool (not thread-safe). + * @property _temp + * @type {vector[]} + * @private + */ + Vector._temp = [ + Vector.create(), Vector.create(), + Vector.create(), Vector.create(), + Vector.create(), Vector.create() + ]; +})(); /***/ }), -/* 688 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 39745: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +* The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. +* A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. +* A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull). +* +* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). +* +* @class Vertices +*/ -var Random = __webpack_require__(170); +var Vertices = {}; -/** - * Takes an array of Game Objects and positions them at random locations within the Circle. - * - * If you wish to pass a `Phaser.GameObjects.Circle` Shape to this function, you should pass its `geom` property. - * - * @function Phaser.Actions.RandomCircle - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Circle} circle - The Circle to position the Game Objects within. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var RandomCircle = function (items, circle) -{ - for (var i = 0; i < items.length; i++) - { - Random(circle, items[i]); - } +module.exports = Vertices; - return items; -}; +var Vector = __webpack_require__(10438); +var Common = __webpack_require__(68758); -module.exports = RandomCircle; +(function() { + /** + * Creates a new set of `Matter.Body` compatible vertices. + * The `points` argument accepts an array of `Matter.Vector` points orientated around the origin `(0, 0)`, for example: + * + * [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] + * + * The `Vertices.create` method returns a new array of vertices, which are similar to Matter.Vector objects, + * but with some additional references required for efficient collision detection routines. + * + * Vertices must be specified in clockwise order. + * + * Note that the `body` argument is not optional, a `Matter.Body` reference must be provided. + * + * @method create + * @param {vector[]} points + * @param {body} body + */ + Vertices.create = function(points, body) { + var vertices = []; -/***/ }), -/* 689 */ -/***/ (function(module, exports, __webpack_require__) { + for (var i = 0; i < points.length; i++) { + var point = points[i], + vertex = { + x: point.x, + y: point.y, + index: i, + body: body, + isInternal: false + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + vertices.push(vertex); + } -var Random = __webpack_require__(180); + return vertices; + }; -/** - * Takes an array of Game Objects and positions them at random locations within the Ellipse. - * - * If you wish to pass a `Phaser.GameObjects.Ellipse` Shape to this function, you should pass its `geom` property. - * - * @function Phaser.Actions.RandomEllipse - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to position the Game Objects within. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var RandomEllipse = function (items, ellipse) -{ - for (var i = 0; i < items.length; i++) - { - Random(ellipse, items[i]); - } + /** + * Parses a string containing ordered x y pairs separated by spaces (and optionally commas), + * into a `Matter.Vertices` object for the given `Matter.Body`. + * For parsing SVG paths, see `Svg.pathToVertices`. + * @method fromPath + * @param {string} path + * @param {body} body + * @return {vertices} vertices + */ + Vertices.fromPath = function(path, body) { + var pathPattern = /L?\s*([-\d.e]+)[\s,]*([-\d.e]+)*/ig, + points = []; - return items; -}; + path.replace(pathPattern, function(match, x, y) { + points.push({ x: parseFloat(x), y: parseFloat(y) }); + }); -module.exports = RandomEllipse; + return Vertices.create(points, body); + }; + /** + * Returns the centre (centroid) of the set of vertices. + * @method centre + * @param {vertices} vertices + * @return {vector} The centre point + */ + Vertices.centre = function(vertices) { + var area = Vertices.area(vertices, true), + centre = { x: 0, y: 0 }, + cross, + temp, + j; -/***/ }), -/* 690 */ -/***/ (function(module, exports, __webpack_require__) { + for (var i = 0; i < vertices.length; i++) { + j = (i + 1) % vertices.length; + cross = Vector.cross(vertices[i], vertices[j]); + temp = Vector.mult(Vector.add(vertices[i], vertices[j]), cross); + centre = Vector.add(centre, temp); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return Vector.div(centre, 6 * area); + }; -var Random = __webpack_require__(173); + /** + * Returns the average (mean) of the set of vertices. + * @method mean + * @param {vertices} vertices + * @return {vector} The average point + */ + Vertices.mean = function(vertices) { + var average = { x: 0, y: 0 }; -/** - * Takes an array of Game Objects and positions them at random locations on the Line. - * - * If you wish to pass a `Phaser.GameObjects.Line` Shape to this function, you should pass its `geom` property. - * - * @function Phaser.Actions.RandomLine - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Line} line - The Line to position the Game Objects randomly on. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var RandomLine = function (items, line) -{ - for (var i = 0; i < items.length; i++) - { - Random(line, items[i]); - } + for (var i = 0; i < vertices.length; i++) { + average.x += vertices[i].x; + average.y += vertices[i].y; + } - return items; -}; + return Vector.div(average, vertices.length); + }; -module.exports = RandomLine; + /** + * Returns the area of the set of vertices. + * @method area + * @param {vertices} vertices + * @param {bool} signed + * @return {number} The area + */ + Vertices.area = function(vertices, signed) { + var area = 0, + j = vertices.length - 1; + for (var i = 0; i < vertices.length; i++) { + area += (vertices[j].x - vertices[i].x) * (vertices[j].y + vertices[i].y); + j = i; + } -/***/ }), -/* 691 */ -/***/ (function(module, exports, __webpack_require__) { + if (signed) + return area / 2; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return Math.abs(area) / 2; + }; -var Random = __webpack_require__(174); + /** + * Returns the moment of inertia (second moment of area) of the set of vertices given the total mass. + * @method inertia + * @param {vertices} vertices + * @param {number} mass + * @return {number} The polygon's moment of inertia + */ + Vertices.inertia = function(vertices, mass) { + var numerator = 0, + denominator = 0, + v = vertices, + cross, + j; -/** - * Takes an array of Game Objects and positions them at random locations within the Rectangle. - * - * @function Phaser.Actions.RandomRectangle - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to position the Game Objects within. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var RandomRectangle = function (items, rect) -{ - for (var i = 0; i < items.length; i++) - { - Random(rect, items[i]); - } + // find the polygon's moment of inertia, using second moment of area + // from equations at http://www.physicsforums.com/showthread.php?t=25293 + for (var n = 0; n < v.length; n++) { + j = (n + 1) % v.length; + cross = Math.abs(Vector.cross(v[j], v[n])); + numerator += cross * (Vector.dot(v[j], v[j]) + Vector.dot(v[j], v[n]) + Vector.dot(v[n], v[n])); + denominator += cross; + } - return items; -}; + return (mass / 6) * (numerator / denominator); + }; -module.exports = RandomRectangle; + /** + * Translates the set of vertices in-place. + * @method translate + * @param {vertices} vertices + * @param {vector} vector + * @param {number} scalar + */ + Vertices.translate = function(vertices, vector, scalar) { + scalar = typeof scalar !== 'undefined' ? scalar : 1; + var verticesLength = vertices.length, + translateX = vector.x * scalar, + translateY = vector.y * scalar, + i; + + for (i = 0; i < verticesLength; i++) { + vertices[i].x += translateX; + vertices[i].y += translateY; + } -/***/ }), -/* 692 */ -/***/ (function(module, exports, __webpack_require__) { + return vertices; + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Rotates the set of vertices in-place. + * @method rotate + * @param {vertices} vertices + * @param {number} angle + * @param {vector} point + */ + Vertices.rotate = function(vertices, angle, point) { + if (angle === 0) + return; -var Random = __webpack_require__(181); + var cos = Math.cos(angle), + sin = Math.sin(angle), + pointX = point.x, + pointY = point.y, + verticesLength = vertices.length, + vertex, + dx, + dy, + i; -/** - * Takes an array of Game Objects and positions them at random locations within the Triangle. - * - * If you wish to pass a `Phaser.GameObjects.Triangle` Shape to this function, you should pass its `geom` property. - * - * @function Phaser.Actions.RandomTriangle - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Triangle} triangle - The Triangle to position the Game Objects within. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var RandomTriangle = function (items, triangle) -{ - for (var i = 0; i < items.length; i++) - { - Random(triangle, items[i]); - } + for (i = 0; i < verticesLength; i++) { + vertex = vertices[i]; + dx = vertex.x - pointX; + dy = vertex.y - pointY; + vertex.x = pointX + (dx * cos - dy * sin); + vertex.y = pointY + (dx * sin + dy * cos); + } - return items; -}; + return vertices; + }; -module.exports = RandomTriangle; + /** + * Returns `true` if the `point` is inside the set of `vertices`. + * @method contains + * @param {vertices} vertices + * @param {vector} point + * @return {boolean} True if the vertices contains point, otherwise false + */ + Vertices.contains = function(vertices, point) { + var pointX = point.x, + pointY = point.y, + verticesLength = vertices.length, + vertex = vertices[verticesLength - 1], + nextVertex; + for (var i = 0; i < verticesLength; i++) { + nextVertex = vertices[i]; -/***/ }), -/* 693 */ -/***/ (function(module, exports, __webpack_require__) { + if ((pointX - vertex.x) * (nextVertex.y - vertex.y) + + (pointY - vertex.y) * (vertex.x - nextVertex.x) > 0) { + return false; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + vertex = nextVertex; + } -var PropertyValueInc = __webpack_require__(46); + return true; + }; -/** - * Takes an array of Game Objects, or any objects that have a public `rotation` property, - * and then adds the given value to each of their `rotation` properties. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `Rotate(group.getChildren(), value, step)` - * - * @function Phaser.Actions.Rotate - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to be added to the `rotation` property (in radians). - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var Rotate = function (items, value, step, index, direction) -{ - return PropertyValueInc(items, 'rotation', value, step, index, direction); -}; + /** + * Scales the vertices from a point (default is centre) in-place. + * @method scale + * @param {vertices} vertices + * @param {number} scaleX + * @param {number} scaleY + * @param {vector} point + */ + Vertices.scale = function(vertices, scaleX, scaleY, point) { + if (scaleX === 1 && scaleY === 1) + return vertices; -module.exports = Rotate; + point = point || Vertices.centre(vertices); + var vertex, + delta; -/***/ }), -/* 694 */ -/***/ (function(module, exports, __webpack_require__) { + for (var i = 0; i < vertices.length; i++) { + vertex = vertices[i]; + delta = Vector.sub(vertex, point); + vertices[i].x = point.x + delta.x * scaleX; + vertices[i].y = point.y + delta.y * scaleY; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return vertices; + }; -var RotateAroundDistance = __webpack_require__(182); -var DistanceBetween = __webpack_require__(50); + /** + * Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices. + * The radius parameter is a single number or an array to specify the radius for each vertex. + * @method chamfer + * @param {vertices} vertices + * @param {number[]} radius + * @param {number} quality + * @param {number} qualityMin + * @param {number} qualityMax + */ + Vertices.chamfer = function(vertices, radius, quality, qualityMin, qualityMax) { + if (typeof radius === 'number') { + radius = [radius]; + } else { + radius = radius || [8]; + } -/** - * Rotates each item around the given point by the given angle. - * - * @function Phaser.Actions.RotateAround - * @since 3.0.0 - * @see Phaser.Math.RotateAroundDistance - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {object} point - Any object with public `x` and `y` properties. - * @param {number} angle - The angle to rotate by, in radians. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var RotateAround = function (items, point, angle) -{ - var x = point.x; - var y = point.y; + // quality defaults to -1, which is auto + quality = (typeof quality !== 'undefined') ? quality : -1; + qualityMin = qualityMin || 2; + qualityMax = qualityMax || 14; - for (var i = 0; i < items.length; i++) - { - var item = items[i]; + var newVertices = []; - RotateAroundDistance(item, x, y, angle, Math.max(1, DistanceBetween(item.x, item.y, x, y))); - } + for (var i = 0; i < vertices.length; i++) { + var prevVertex = vertices[i - 1 >= 0 ? i - 1 : vertices.length - 1], + vertex = vertices[i], + nextVertex = vertices[(i + 1) % vertices.length], + currentRadius = radius[i < radius.length ? i : radius.length - 1]; - return items; -}; + if (currentRadius === 0) { + newVertices.push(vertex); + continue; + } -module.exports = RotateAround; + var prevNormal = Vector.normalise({ + x: vertex.y - prevVertex.y, + y: prevVertex.x - vertex.x + }); + var nextNormal = Vector.normalise({ + x: nextVertex.y - vertex.y, + y: vertex.x - nextVertex.x + }); -/***/ }), -/* 695 */ -/***/ (function(module, exports, __webpack_require__) { + var diagonalRadius = Math.sqrt(2 * Math.pow(currentRadius, 2)), + radiusVector = Vector.mult(Common.clone(prevNormal), currentRadius), + midNormal = Vector.normalise(Vector.mult(Vector.add(prevNormal, nextNormal), 0.5)), + scaledVertex = Vector.sub(vertex, Vector.mult(midNormal, diagonalRadius)); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var precision = quality; -var MathRotateAroundDistance = __webpack_require__(182); + if (quality === -1) { + // automatically decide precision + precision = Math.pow(currentRadius, 0.32) * 1.75; + } -/** - * Rotates an array of Game Objects around a point by the given angle and distance. - * - * @function Phaser.Actions.RotateAroundDistance - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {object} point - Any object with public `x` and `y` properties. - * @param {number} angle - The angle to rotate by, in radians. - * @param {number} distance - The distance from the point of rotation in pixels. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var RotateAroundDistance = function (items, point, angle, distance) -{ - var x = point.x; - var y = point.y; + precision = Common.clamp(precision, qualityMin, qualityMax); - // There's nothing to do - if (distance === 0) - { - return items; - } + // use an even value for precision, more likely to reduce axes by using symmetry + if (precision % 2 === 1) + precision += 1; - for (var i = 0; i < items.length; i++) - { - MathRotateAroundDistance(items[i], x, y, angle, distance); - } + var alpha = Math.acos(Vector.dot(prevNormal, nextNormal)), + theta = alpha / precision; - return items; -}; + for (var j = 0; j < precision; j++) { + newVertices.push(Vector.add(Vector.rotate(radiusVector, theta * j), scaledVertex)); + } + } -module.exports = RotateAroundDistance; + return newVertices; + }; + /** + * Sorts the input vertices into clockwise order in place. + * @method clockwiseSort + * @param {vertices} vertices + * @return {vertices} vertices + */ + Vertices.clockwiseSort = function(vertices) { + var centre = Vertices.mean(vertices); -/***/ }), -/* 696 */ -/***/ (function(module, exports, __webpack_require__) { + vertices.sort(function(vertexA, vertexB) { + return Vector.angle(centre, vertexA) - Vector.angle(centre, vertexB); + }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return vertices; + }; -var PropertyValueInc = __webpack_require__(46); + /** + * Returns true if the vertices form a convex shape (vertices must be in clockwise order). + * @method isConvex + * @param {vertices} vertices + * @return {bool} `true` if the `vertices` are convex, `false` if not (or `null` if not computable). + */ + Vertices.isConvex = function(vertices) { + // http://paulbourke.net/geometry/polygonmesh/ + // Copyright (c) Paul Bourke (use permitted) -/** - * Takes an array of Game Objects, or any objects that have a public `scaleX` property, - * and then adds the given value to each of their `scaleX` properties. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `ScaleX(group.getChildren(), value, step)` - * - * @function Phaser.Actions.ScaleX - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to be added to the `scaleX` property. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var ScaleX = function (items, value, step, index, direction) -{ - return PropertyValueInc(items, 'scaleX', value, step, index, direction); -}; + var flag = 0, + n = vertices.length, + i, + j, + k, + z; -module.exports = ScaleX; + if (n < 3) + return null; + for (i = 0; i < n; i++) { + j = (i + 1) % n; + k = (i + 2) % n; + z = (vertices[j].x - vertices[i].x) * (vertices[k].y - vertices[j].y); + z -= (vertices[j].y - vertices[i].y) * (vertices[k].x - vertices[j].x); -/***/ }), -/* 697 */ -/***/ (function(module, exports, __webpack_require__) { + if (z < 0) { + flag |= 1; + } else if (z > 0) { + flag |= 2; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (flag === 3) { + return false; + } + } -var PropertyValueInc = __webpack_require__(46); + if (flag !== 0){ + return true; + } else { + return null; + } + }; -/** - * Takes an array of Game Objects, or any objects that have public `scaleX` and `scaleY` properties, - * and then adds the given value to each of them. - * - * The optional `stepX` and `stepY` properties are applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `ScaleXY(group.getChildren(), scaleX, scaleY, stepX, stepY)` - * - * @function Phaser.Actions.ScaleXY - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} scaleX - The amount to be added to the `scaleX` property. - * @param {number} [scaleY] - The amount to be added to the `scaleY` property. If `undefined` or `null` it uses the `scaleX` value. - * @param {number} [stepX=0] - This is added to the `scaleX` amount, multiplied by the iteration counter. - * @param {number} [stepY=0] - This is added to the `scaleY` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var ScaleXY = function (items, scaleX, scaleY, stepX, stepY, index, direction) -{ - if (scaleY === undefined || scaleY === null) { scaleY = scaleX; } + /** + * Returns the convex hull of the input vertices as a new array of points. + * @method hull + * @param {vertices} vertices + * @return [vertex] vertices + */ + Vertices.hull = function(vertices) { + // http://geomalgorithms.com/a10-_hull-1.html - PropertyValueInc(items, 'scaleX', scaleX, stepX, index, direction); + var upper = [], + lower = [], + vertex, + i; - return PropertyValueInc(items, 'scaleY', scaleY, stepY, index, direction); -}; + // sort vertices on x-axis (y-axis for ties) + vertices = vertices.slice(0); + vertices.sort(function(vertexA, vertexB) { + var dx = vertexA.x - vertexB.x; + return dx !== 0 ? dx : vertexA.y - vertexB.y; + }); -module.exports = ScaleXY; + // build lower hull + for (i = 0; i < vertices.length; i += 1) { + vertex = vertices[i]; + while (lower.length >= 2 + && Vector.cross3(lower[lower.length - 2], lower[lower.length - 1], vertex) <= 0) { + lower.pop(); + } -/***/ }), -/* 698 */ -/***/ (function(module, exports, __webpack_require__) { + lower.push(vertex); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // build upper hull + for (i = vertices.length - 1; i >= 0; i -= 1) { + vertex = vertices[i]; -var PropertyValueInc = __webpack_require__(46); + while (upper.length >= 2 + && Vector.cross3(upper[upper.length - 2], upper[upper.length - 1], vertex) <= 0) { + upper.pop(); + } -/** - * Takes an array of Game Objects, or any objects that have a public `scaleY` property, - * and then adds the given value to each of their `scaleY` properties. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `ScaleY(group.getChildren(), value, step)` - * - * @function Phaser.Actions.ScaleY - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to be added to the `scaleY` property. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var ScaleY = function (items, value, step, index, direction) -{ - return PropertyValueInc(items, 'scaleY', value, step, index, direction); -}; + upper.push(vertex); + } -module.exports = ScaleY; + // concatenation of the lower and upper hulls gives the convex hull + // omit last points because they are repeated at the beginning of the other list + upper.pop(); + lower.pop(); + + return upper.concat(lower); + }; + +})(); /***/ }), -/* 699 */ -/***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +/***/ 1675: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var PropertyValueSet = __webpack_require__(27); +var Matter = __webpack_require__(18171); /** - * Takes an array of Game Objects, or any objects that have the public property `alpha` - * and then sets it to the given value. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetAlpha(group.getChildren(), value, step)` - * - * @function Phaser.Actions.SetAlpha - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + * An attractors plugin for matter.js. + * See the readme for usage and examples. + * @module MatterAttractors */ -var SetAlpha = function (items, value, step, index, direction) +var MatterAttractors = { - return PropertyValueSet(items, 'alpha', value, step, index, direction); -}; + name: 'matter-attractors', + version: '0.1.7', + for: 'matter-js@^0.19.0', + silent: true, -module.exports = SetAlpha; + // installs the plugin where `base` is `Matter` + // you should not need to call this directly. + install: function (base) + { + base.after('Body.create', function () + { + MatterAttractors.Body.init(this); + }); + base.before('Engine.update', function (engine) + { + MatterAttractors.Engine.update(engine); + }); + }, -/***/ }), -/* 700 */ -/***/ (function(module, exports, __webpack_require__) { + Body: + { + /** + * Initialises the `body` to support attractors. + * This is called automatically by the plugin. + * @function MatterAttractors.Body.init + * @param {Matter.Body} body The body to init. + * @returns {void} No return value. + */ + init: function (body) + { + body.plugin.attractors = body.plugin.attractors || []; + } + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + Engine: + { + /** + * Applies all attractors for all bodies in the `engine`. + * This is called automatically by the plugin. + * @function MatterAttractors.Engine.update + * @param {Matter.Engine} engine The engine to update. + * @returns {void} No return value. + */ + update: function (engine) + { + var bodies = Matter.Composite.allBodies(engine.world); -var PropertyValueSet = __webpack_require__(27); + for (var i = 0; i < bodies.length; i++) + { + var bodyA = bodies[i]; + var attractors = bodyA.plugin.attractors; -/** - * Takes an array of Game Objects, or any objects that have the public property `blendMode` - * and then sets it to the given value. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetBlendMode(group.getChildren(), value)` - * - * @function Phaser.Actions.SetBlendMode - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to set the property to. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var SetBlendMode = function (items, value, index, direction) -{ - return PropertyValueSet(items, 'blendMode', value, 0, index, direction); -}; + if (attractors && attractors.length > 0) + { + for (var j = 0; j < bodies.length; j++) + { + var bodyB = bodies[j]; -module.exports = SetBlendMode; + if (i !== j) + { + for (var k = 0; k < attractors.length; k++) + { + var attractor = attractors[k]; + var forceVector = attractor; + if (Matter.Common.isFunction(attractor)) + { + forceVector = attractor(bodyA, bodyB); + } -/***/ }), -/* 701 */ -/***/ (function(module, exports, __webpack_require__) { + if (forceVector) + { + Matter.Body.applyForce(bodyB, bodyB.position, forceVector); + } + } + } + } + } + } + } + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Defines some useful common attractor functions that can be used + * by pushing them to your body's `body.plugin.attractors` array. + * @namespace MatterAttractors.Attractors + * @property {number} gravityConstant The gravitational constant used by the gravity attractor. + */ + Attractors: + { + gravityConstant: 0.001, -var PropertyValueSet = __webpack_require__(27); + /** + * An attractor function that applies Newton's law of gravitation. + * Use this by pushing `MatterAttractors.Attractors.gravity` to your body's `body.plugin.attractors` array. + * The gravitational constant defaults to `0.001` which you can change + * at `MatterAttractors.Attractors.gravityConstant`. + * @function MatterAttractors.Attractors.gravity + * @param {Matter.Body} bodyA The first body. + * @param {Matter.Body} bodyB The second body. + * @returns {void} No return value. + */ + gravity: function (bodyA, bodyB) + { + // use Newton's law of gravitation + var bToA = Matter.Vector.sub(bodyB.position, bodyA.position); + var distanceSq = Matter.Vector.magnitudeSquared(bToA) || 0.0001; + var normal = Matter.Vector.normalise(bToA); + var magnitude = -MatterAttractors.Attractors.gravityConstant * (bodyA.mass * bodyB.mass / distanceSq); + var force = Matter.Vector.mult(normal, magnitude); -/** - * Takes an array of Game Objects, or any objects that have the public property `depth` - * and then sets it to the given value. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetDepth(group.getChildren(), value, step)` - * - * @function Phaser.Actions.SetDepth - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var SetDepth = function (items, value, step, index, direction) -{ - return PropertyValueSet(items, 'depth', value, step, index, direction); + // to apply forces to both bodies + Matter.Body.applyForce(bodyA, bodyA.position, Matter.Vector.neg(force)); + Matter.Body.applyForce(bodyB, bodyB.position, force); + } + } }; -module.exports = SetDepth; - - -/***/ }), -/* 702 */ -/***/ (function(module, exports) { +module.exports = MatterAttractors; /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * @namespace Matter.Body + * @see http://brm.io/matter-js/docs/classes/Body.html */ /** - * Passes all provided Game Objects to the Input Manager to enable them for input with identical areas and callbacks. - * - * @see {@link Phaser.GameObjects.GameObject#setInteractive} - * - * @function Phaser.Actions.SetHitArea - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {*} hitArea - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. - * @param {Phaser.Types.Input.HitAreaCallback} hitAreaCallback - A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + * This plugin adds a new property `body.plugin.attractors` to instances of `Matter.Body`. + * This is an array of callback functions that will be called automatically + * for every pair of bodies, on every engine update. + * @property {Function[]} body.plugin.attractors + * @memberof Matter.Body */ -var SetHitArea = function (items, hitArea, hitAreaCallback) -{ - for (var i = 0; i < items.length; i++) - { - items[i].setInteractive(hitArea, hitAreaCallback); - } - - return items; -}; -module.exports = SetHitArea; +/** + * An attractor function calculates the force to be applied + * to `bodyB`, it should either: + * - return the force vector to be applied to `bodyB` + * - or apply the force to the body(s) itself + * @callback AttractorFunction + * @param {Matter.Body} bodyA + * @param {Matter.Body} bodyB + * @returns {(Vector|undefined)} a force vector (optional) + */ /***/ }), -/* 703 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 80391: +/***/ ((module) => { /** + * @author @dxu https://github.com/dxu/matter-collision-events * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PropertyValueSet = __webpack_require__(27); - -/** - * Takes an array of Game Objects, or any objects that have the public properties `originX` and `originY` - * and then sets them to the given values. - * - * The optional `stepX` and `stepY` properties are applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetOrigin(group.getChildren(), originX, originY, stepX, stepY)` - * - * @function Phaser.Actions.SetOrigin - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} originX - The amount to set the `originX` property to. - * @param {number} [originY] - The amount to set the `originY` property to. If `undefined` or `null` it uses the `originX` value. - * @param {number} [stepX=0] - This is added to the `originX` amount, multiplied by the iteration counter. - * @param {number} [stepY=0] - This is added to the `originY` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var SetOrigin = function (items, originX, originY, stepX, stepY, index, direction) -{ - if (originY === undefined || originY === null) { originY = originX; } +var MatterCollisionEvents = { - PropertyValueSet(items, 'originX', originX, stepX, index, direction); - PropertyValueSet(items, 'originY', originY, stepY, index, direction); + name: 'matter-collision-events', + version: '0.1.6', + for: 'matter-js@^0.19.0', + silent: true, - items.forEach(function (item) + install: function (matter) { - item.updateDisplayOrigin(); - }); - - return items; -}; - -module.exports = SetOrigin; + matter.after('Engine.create', function () + { + matter.Events.on(this, 'collisionStart', function (event) + { + event.pairs.map(function (pair) + { + var bodyA = pair.bodyA; + var bodyB = pair.bodyB; + if (bodyA.gameObject) + { + bodyA.gameObject.emit('collide', bodyA, bodyB, pair); + } -/***/ }), -/* 704 */ -/***/ (function(module, exports, __webpack_require__) { + if (bodyB.gameObject) + { + bodyB.gameObject.emit('collide', bodyB, bodyA, pair); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + matter.Events.trigger(bodyA, 'onCollide', { pair: pair }); + matter.Events.trigger(bodyB, 'onCollide', { pair: pair }); -var PropertyValueSet = __webpack_require__(27); + if (bodyA.onCollideCallback) + { + bodyA.onCollideCallback(pair); + } -/** - * Takes an array of Game Objects, or any objects that have the public property `rotation` - * and then sets it to the given value. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetRotation(group.getChildren(), value, step)` - * - * @function Phaser.Actions.SetRotation - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var SetRotation = function (items, value, step, index, direction) -{ - return PropertyValueSet(items, 'rotation', value, step, index, direction); -}; + if (bodyB.onCollideCallback) + { + bodyB.onCollideCallback(pair); + } -module.exports = SetRotation; + if (bodyA.onCollideWith[bodyB.id]) + { + bodyA.onCollideWith[bodyB.id](bodyB, pair); + } + if (bodyB.onCollideWith[bodyA.id]) + { + bodyB.onCollideWith[bodyA.id](bodyA, pair); + } + }); + }); -/***/ }), -/* 705 */ -/***/ (function(module, exports, __webpack_require__) { + matter.Events.on(this, 'collisionActive', function (event) + { + event.pairs.map(function (pair) + { + var bodyA = pair.bodyA; + var bodyB = pair.bodyB; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (bodyA.gameObject) + { + bodyA.gameObject.emit('collideActive', bodyA, bodyB, pair); + } -var PropertyValueSet = __webpack_require__(27); + if (bodyB.gameObject) + { + bodyB.gameObject.emit('collideActive', bodyB, bodyA, pair); + } -/** - * Takes an array of Game Objects, or any objects that have the public properties `scaleX` and `scaleY` - * and then sets them to the given values. - * - * The optional `stepX` and `stepY` properties are applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetScale(group.getChildren(), scaleX, scaleY, stepX, stepY)` - * - * @function Phaser.Actions.SetScale - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} scaleX - The amount to set the `scaleX` property to. - * @param {number} [scaleY] - The amount to set the `scaleY` property to. If `undefined` or `null` it uses the `scaleX` value. - * @param {number} [stepX=0] - This is added to the `scaleX` amount, multiplied by the iteration counter. - * @param {number} [stepY=0] - This is added to the `scaleY` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var SetScale = function (items, scaleX, scaleY, stepX, stepY, index, direction) -{ - if (scaleY === undefined || scaleY === null) { scaleY = scaleX; } + matter.Events.trigger(bodyA, 'onCollideActive', { pair: pair }); + matter.Events.trigger(bodyB, 'onCollideActive', { pair: pair }); - PropertyValueSet(items, 'scaleX', scaleX, stepX, index, direction); + if (bodyA.onCollideActiveCallback) + { + bodyA.onCollideActiveCallback(pair); + } - return PropertyValueSet(items, 'scaleY', scaleY, stepY, index, direction); -}; + if (bodyB.onCollideActiveCallback) + { + bodyB.onCollideActiveCallback(pair); + } + }); + }); -module.exports = SetScale; + matter.Events.on(this, 'collisionEnd', function (event) + { + event.pairs.map(function (pair) + { + var bodyA = pair.bodyA; + var bodyB = pair.bodyB; + if (bodyA.gameObject) + { + bodyA.gameObject.emit('collideEnd', bodyA, bodyB, pair); + } -/***/ }), -/* 706 */ -/***/ (function(module, exports, __webpack_require__) { + if (bodyB.gameObject) + { + bodyB.gameObject.emit('collideEnd', bodyB, bodyA, pair); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + matter.Events.trigger(bodyA, 'onCollideEnd', { pair: pair }); + matter.Events.trigger(bodyB, 'onCollideEnd', { pair: pair }); -var PropertyValueSet = __webpack_require__(27); + if (bodyA.onCollideEndCallback) + { + bodyA.onCollideEndCallback(pair); + } -/** - * Takes an array of Game Objects, or any objects that have the public property `scaleX` - * and then sets it to the given value. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetScaleX(group.getChildren(), value, step)` - * - * @function Phaser.Actions.SetScaleX - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var SetScaleX = function (items, value, step, index, direction) -{ - return PropertyValueSet(items, 'scaleX', value, step, index, direction); + if (bodyB.onCollideEndCallback) + { + bodyB.onCollideEndCallback(pair); + } + }); + }); + }); + } }; -module.exports = SetScaleX; +module.exports = MatterCollisionEvents; /***/ }), -/* 707 */ -/***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +/***/ 44097: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var PropertyValueSet = __webpack_require__(27); +var Matter = __webpack_require__(18171); /** - * Takes an array of Game Objects, or any objects that have the public property `scaleY` - * and then sets it to the given value. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetScaleY(group.getChildren(), value, step)` - * - * @function Phaser.Actions.SetScaleY - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + * A coordinate wrapping plugin for matter.js. + * See the readme for usage and examples. + * @module MatterWrap */ -var SetScaleY = function (items, value, step, index, direction) -{ - return PropertyValueSet(items, 'scaleY', value, step, index, direction); -}; +var MatterWrap = { + // plugin meta + name: 'matter-wrap', // PLUGIN_NAME + version: '0.1.4', // PLUGIN_VERSION + for: 'matter-js@^0.19.0', + silent: true, // no console log please -module.exports = SetScaleY; + // installs the plugin where `base` is `Matter` + // you should not need to call this directly. + install: function(base) { + base.after('Engine.update', function() { + MatterWrap.Engine.update(this); + }); + }, + Engine: { + /** + * Updates the engine by wrapping bodies and composites inside `engine.world`. + * This is called automatically by the plugin. + * @function MatterWrap.Engine.update + * @param {Matter.Engine} engine The engine to update. + * @returns {void} No return value. + */ + update: function(engine) { + var world = engine.world, + bodies = Matter.Composite.allBodies(world), + composites = Matter.Composite.allComposites(world); -/***/ }), -/* 708 */ -/***/ (function(module, exports, __webpack_require__) { + for (var i = 0; i < bodies.length; i += 1) { + var body = bodies[i]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (body.plugin.wrap) { + MatterWrap.Body.wrap(body, body.plugin.wrap); + } + } -var PropertyValueSet = __webpack_require__(27); + for (i = 0; i < composites.length; i += 1) { + var composite = composites[i]; -/** - * Takes an array of Game Objects, or any objects that have the public properties `scrollFactorX` and `scrollFactorY` - * and then sets them to the given values. - * - * The optional `stepX` and `stepY` properties are applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetScrollFactor(group.getChildren(), scrollFactorX, scrollFactorY, stepX, stepY)` - * - * @function Phaser.Actions.SetScrollFactor - * @since 3.21.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} scrollFactorX - The amount to set the `scrollFactorX` property to. - * @param {number} [scrollFactorY] - The amount to set the `scrollFactorY` property to. If `undefined` or `null` it uses the `scrollFactorX` value. - * @param {number} [stepX=0] - This is added to the `scrollFactorX` amount, multiplied by the iteration counter. - * @param {number} [stepY=0] - This is added to the `scrollFactorY` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var SetScrollFactor = function (items, scrollFactorX, scrollFactorY, stepX, stepY, index, direction) -{ - if (scrollFactorY === undefined || scrollFactorY === null) { scrollFactorY = scrollFactorX; } + if (composite.plugin.wrap) { + MatterWrap.Composite.wrap(composite, composite.plugin.wrap); + } + } + } + }, - PropertyValueSet(items, 'scrollFactorX', scrollFactorX, stepX, index, direction); + Bounds: { + /** + * Returns a translation vector that wraps the `objectBounds` inside the `bounds`. + * @function MatterWrap.Bounds.wrap + * @param {Matter.Bounds} objectBounds The bounds of the object to wrap inside the bounds. + * @param {Matter.Bounds} bounds The bounds to wrap the body inside. + * @returns {?Matter.Vector} A translation vector (only if wrapping is required). + */ + wrap: function(objectBounds, bounds) { + var x = null, + y = null; - return PropertyValueSet(items, 'scrollFactorY', scrollFactorY, stepY, index, direction); -}; + if (typeof bounds.min.x !== 'undefined' && typeof bounds.max.x !== 'undefined') { + if (objectBounds.min.x > bounds.max.x) { + x = bounds.min.x - objectBounds.max.x; + } else if (objectBounds.max.x < bounds.min.x) { + x = bounds.max.x - objectBounds.min.x; + } + } -module.exports = SetScrollFactor; + if (typeof bounds.min.y !== 'undefined' && typeof bounds.max.y !== 'undefined') { + if (objectBounds.min.y > bounds.max.y) { + y = bounds.min.y - objectBounds.max.y; + } else if (objectBounds.max.y < bounds.min.y) { + y = bounds.max.y - objectBounds.min.y; + } + } + if (x !== null || y !== null) { + return { + x: x || 0, + y: y || 0 + }; + } + } + }, -/***/ }), -/* 709 */ -/***/ (function(module, exports, __webpack_require__) { + Body: { + /** + * Wraps the `body` position such that it always stays within the given bounds. + * Upon crossing a boundary the body will appear on the opposite side of the bounds, + * while maintaining its velocity. + * This is called automatically by the plugin. + * @function MatterWrap.Body.wrap + * @param {Matter.Body} body The body to wrap. + * @param {Matter.Bounds} bounds The bounds to wrap the body inside. + * @returns {?Matter.Vector} The translation vector that was applied (only if wrapping was required). + */ + wrap: function(body, bounds) { + var translation = MatterWrap.Bounds.wrap(body.bounds, bounds); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (translation) { + Matter.Body.translate(body, translation); + } -var PropertyValueSet = __webpack_require__(27); + return translation; + } + }, -/** - * Takes an array of Game Objects, or any objects that have the public property `scrollFactorX` - * and then sets it to the given value. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetScrollFactorX(group.getChildren(), value, step)` - * - * @function Phaser.Actions.SetScrollFactorX - * @since 3.21.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. - */ -var SetScrollFactorX = function (items, value, step, index, direction) -{ - return PropertyValueSet(items, 'scrollFactorX', value, step, index, direction); -}; + Composite: { + /** + * Returns the union of the bounds of all of the composite's bodies + * (not accounting for constraints). + * @function MatterWrap.Composite.bounds + * @param {Matter.Composite} composite The composite. + * @returns {Matter.Bounds} The composite bounds. + */ + bounds: function(composite) { + var bodies = Matter.Composite.allBodies(composite), + vertices = []; -module.exports = SetScrollFactorX; + for (var i = 0; i < bodies.length; i += 1) { + var body = bodies[i]; + vertices.push(body.bounds.min, body.bounds.max); + } + + return Matter.Bounds.create(vertices); + }, + + /** + * Wraps the `composite` position such that it always stays within the given bounds. + * Upon crossing a boundary the composite will appear on the opposite side of the bounds, + * while maintaining its velocity. + * This is called automatically by the plugin. + * @function MatterWrap.Composite.wrap + * @param {Matter.Composite} composite The composite to wrap. + * @param {Matter.Bounds} bounds The bounds to wrap the composite inside. + * @returns {?Matter.Vector} The translation vector that was applied (only if wrapping was required). + */ + wrap: function(composite, bounds) { + var translation = MatterWrap.Bounds.wrap( + MatterWrap.Composite.bounds(composite), + bounds + ); + + if (translation) { + Matter.Composite.translate(composite, translation); + } + return translation; + } + } +}; -/***/ }), -/* 710 */ -/***/ (function(module, exports, __webpack_require__) { +module.exports = MatterWrap; /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * @namespace Matter.Body + * @see http://brm.io/matter-js/docs/classes/Body.html */ -var PropertyValueSet = __webpack_require__(27); - /** - * Takes an array of Game Objects, or any objects that have the public property `scrollFactorY` - * and then sets it to the given value. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetScrollFactorY(group.getChildren(), value, step)` - * - * @function Phaser.Actions.SetScrollFactorY - * @since 3.21.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + * This plugin adds a new property `body.plugin.wrap` to instances of `Matter.Body`. + * This is a `Matter.Bounds` instance that specifies the wrapping region. + * @property {Matter.Bounds} body.plugin.wrap + * @memberof Matter.Body */ -var SetScrollFactorY = function (items, value, step, index, direction) -{ - return PropertyValueSet(items, 'scrollFactorY', value, step, index, direction); -}; -module.exports = SetScrollFactorY; +/** + * This plugin adds a new property `composite.plugin.wrap` to instances of `Matter.Composite`. + * This is a `Matter.Bounds` instance that specifies the wrapping region. + * @property {Matter.Bounds} composite.plugin.wrap + * @memberof Matter.Composite + */ /***/ }), -/* 711 */ -/***/ (function(module, exports) { + +/***/ 81084: +/***/ ((module) => { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Stefan Hedman (http://steffe.se) * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * Takes an array of Game Objects, or any objects that have the public method setTint() and then updates it to the given value(s). You can specify tint color per corner or provide only one color value for `topLeft` parameter, in which case whole item will be tinted with that color. - * - * @function Phaser.Actions.SetTint - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {number} topLeft - The tint being applied to top-left corner of item. If other parameters are given no value, this tint will be applied to whole item. - * @param {number} [topRight] - The tint to be applied to top-right corner of item. - * @param {number} [bottomLeft] - The tint to be applied to the bottom-left corner of item. - * @param {number} [bottomRight] - The tint to be applied to the bottom-right corner of item. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. - */ -var SetTint = function (items, topLeft, topRight, bottomLeft, bottomRight) -{ - for (var i = 0; i < items.length; i++) - { - items[i].setTint(topLeft, topRight, bottomLeft, bottomRight); - } +// v0.3.0 - return items; +module.exports = { + decomp: polygonDecomp, + quickDecomp: polygonQuickDecomp, + isSimple: polygonIsSimple, + removeCollinearPoints: polygonRemoveCollinearPoints, + removeDuplicatePoints: polygonRemoveDuplicatePoints, + makeCCW: polygonMakeCCW }; -module.exports = SetTint; - - -/***/ }), -/* 712 */ -/***/ (function(module, exports, __webpack_require__) { - /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Compute the intersection between two lines. + * @static + * @method lineInt + * @param {Array} l1 Line vector 1 + * @param {Array} l2 Line vector 2 + * @param {Number} precision Precision to use when checking if the lines are parallel + * @return {Array} The intersection point. */ - -var PropertyValueSet = __webpack_require__(27); +function lineInt(l1,l2,precision){ + precision = precision || 0; + var i = [0,0]; // point + var a1, b1, c1, a2, b2, c2, det; // scalars + a1 = l1[1][1] - l1[0][1]; + b1 = l1[0][0] - l1[1][0]; + c1 = a1 * l1[0][0] + b1 * l1[0][1]; + a2 = l2[1][1] - l2[0][1]; + b2 = l2[0][0] - l2[1][0]; + c2 = a2 * l2[0][0] + b2 * l2[0][1]; + det = a1 * b2 - a2*b1; + if (!scalar_eq(det, 0, precision)) { // lines are not parallel + i[0] = (b2 * c1 - b1 * c2) / det; + i[1] = (a1 * c2 - a2 * c1) / det; + } + return i; +} /** - * Takes an array of Game Objects, or any objects that have the public property `visible` - * and then sets it to the given value. - * - * To use this with a Group: `SetVisible(group.getChildren(), value)` - * - * @function Phaser.Actions.SetVisible - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {boolean} value - The value to set the property to. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + * Checks if two line segments intersects. + * @method segmentsIntersect + * @param {Array} p1 The start vertex of the first line segment. + * @param {Array} p2 The end vertex of the first line segment. + * @param {Array} q1 The start vertex of the second line segment. + * @param {Array} q2 The end vertex of the second line segment. + * @return {Boolean} True if the two line segments intersect */ -var SetVisible = function (items, value, index, direction) -{ - return PropertyValueSet(items, 'visible', value, 0, index, direction); -}; - -module.exports = SetVisible; - +function lineSegmentsIntersect(p1, p2, q1, q2){ + var dx = p2[0] - p1[0]; + var dy = p2[1] - p1[1]; + var da = q2[0] - q1[0]; + var db = q2[1] - q1[1]; -/***/ }), -/* 713 */ -/***/ (function(module, exports, __webpack_require__) { + // segments are parallel + if((da*dy - db*dx) === 0){ + return false; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var s = (dx * (q1[1] - p1[1]) + dy * (p1[0] - q1[0])) / (da * dy - db * dx); + var t = (da * (p1[1] - q1[1]) + db * (q1[0] - p1[0])) / (db * dx - da * dy); -var PropertyValueSet = __webpack_require__(27); + return (s>=0 && s<=1 && t>=0 && t<=1); +} /** - * Takes an array of Game Objects, or any objects that have the public property `x` - * and then sets it to the given value. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetX(group.getChildren(), value, step)` - * - * @function Phaser.Actions.SetX - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + * Get the area of a triangle spanned by the three given points. Note that the area will be negative if the points are not given in counter-clockwise order. + * @static + * @method area + * @param {Array} a + * @param {Array} b + * @param {Array} c + * @return {Number} */ -var SetX = function (items, value, step, index, direction) -{ - return PropertyValueSet(items, 'x', value, step, index, direction); -}; +function triangleArea(a,b,c){ + return (((b[0] - a[0])*(c[1] - a[1]))-((c[0] - a[0])*(b[1] - a[1]))); +} -module.exports = SetX; +function isLeft(a,b,c){ + return triangleArea(a,b,c) > 0; +} +function isLeftOn(a,b,c) { + return triangleArea(a, b, c) >= 0; +} -/***/ }), -/* 714 */ -/***/ (function(module, exports, __webpack_require__) { +function isRight(a,b,c) { + return triangleArea(a, b, c) < 0; +} -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +function isRightOn(a,b,c) { + return triangleArea(a, b, c) <= 0; +} -var PropertyValueSet = __webpack_require__(27); +var tmpPoint1 = [], + tmpPoint2 = []; /** - * Takes an array of Game Objects, or any objects that have the public properties `x` and `y` - * and then sets them to the given values. - * - * The optional `stepX` and `stepY` properties are applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetXY(group.getChildren(), x, y, stepX, stepY)` - * - * @function Phaser.Actions.SetXY - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} x - The amount to set the `x` property to. - * @param {number} [y=x] - The amount to set the `y` property to. If `undefined` or `null` it uses the `x` value. - * @param {number} [stepX=0] - This is added to the `x` amount, multiplied by the iteration counter. - * @param {number} [stepY=0] - This is added to the `y` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + * Check if three points are collinear + * @method collinear + * @param {Array} a + * @param {Array} b + * @param {Array} c + * @param {Number} [thresholdAngle=0] Threshold angle to use when comparing the vectors. The function will return true if the angle between the resulting vectors is less than this value. Use zero for max precision. + * @return {Boolean} */ -var SetXY = function (items, x, y, stepX, stepY, index, direction) -{ - if (y === undefined || y === null) { y = x; } - - PropertyValueSet(items, 'x', x, stepX, index, direction); - - return PropertyValueSet(items, 'y', y, stepY, index, direction); -}; +function collinear(a,b,c,thresholdAngle) { + if(!thresholdAngle){ + return triangleArea(a, b, c) === 0; + } else { + var ab = tmpPoint1, + bc = tmpPoint2; -module.exports = SetXY; + ab[0] = b[0]-a[0]; + ab[1] = b[1]-a[1]; + bc[0] = c[0]-b[0]; + bc[1] = c[1]-b[1]; + var dot = ab[0]*bc[0] + ab[1]*bc[1], + magA = Math.sqrt(ab[0]*ab[0] + ab[1]*ab[1]), + magB = Math.sqrt(bc[0]*bc[0] + bc[1]*bc[1]), + angle = Math.acos(dot/(magA*magB)); + return angle < thresholdAngle; + } +} -/***/ }), -/* 715 */ -/***/ (function(module, exports, __webpack_require__) { +function sqdist(a,b){ + var dx = b[0] - a[0]; + var dy = b[1] - a[1]; + return dx * dx + dy * dy; +} /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Get a vertex at position i. It does not matter if i is out of bounds, this function will just cycle. + * @method at + * @param {Number} i + * @return {Array} */ - -var PropertyValueSet = __webpack_require__(27); +function polygonAt(polygon, i){ + var s = polygon.length; + return polygon[i < 0 ? i % s + s : i % s]; +} /** - * Takes an array of Game Objects, or any objects that have the public property `y` - * and then sets it to the given value. - * - * The optional `step` property is applied incrementally, multiplied by each item in the array. - * - * To use this with a Group: `SetY(group.getChildren(), value, step)` - * - * @function Phaser.Actions.SetY - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action. - * @param {number} value - The amount to set the property to. - * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter. - * @param {number} [index=0] - An optional offset to start searching from within the items array. - * @param {number} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action. + * Clear the polygon data + * @method clear + * @return {Array} */ -var SetY = function (items, value, step, index, direction) -{ - return PropertyValueSet(items, 'y', value, step, index, direction); -}; - -module.exports = SetY; - - -/***/ }), -/* 716 */ -/***/ (function(module, exports, __webpack_require__) { +function polygonClear(polygon){ + polygon.length = 0; +} /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Append points "from" to "to"-1 from an other polygon "poly" onto this one. + * @method append + * @param {Polygon} poly The polygon to get points from. + * @param {Number} from The vertex index in "poly". + * @param {Number} to The end vertex index in "poly". Note that this vertex is NOT included when appending. + * @return {Array} */ - -var Vector2 = __webpack_require__(3); +function polygonAppend(polygon, poly, from, to){ + for(var i=from; i 1) - { - var i; - var cx; - var cy; - var cur; - - if (direction === 0) - { - // Bottom to Top - - var len = items.length - 1; - - px = items[len].x; - py = items[len].y; - - for (i = len - 1; i >= 0; i--) - { - // Current item - cur = items[i]; - - // Get current item x/y, to be passed to the next item in the list - cx = cur.x; - cy = cur.y; - - // Set current item to the previous items x/y - cur.x = px; - cur.y = py; - - // Set current as previous - px = cx; - py = cy; - } - - // Update the head item to the new x/y coordinates - items[len].x = x; - items[len].y = y; - } - else - { - // Top to Bottom - - px = items[0].x; - py = items[0].y; - - for (i = 1; i < items.length; i++) - { - // Current item - cur = items[i]; - - // Get current item x/y, to be passed to the next item in the list - cx = cur.x; - cy = cur.y; - - // Set current item to the previous items x/y - cur.x = px; - cur.y = py; - - // Set current as previous - px = cx; - py = cy; - } +function polygonMakeCCW(polygon){ + var br = 0, + v = polygon; - // Update the head item to the new x/y coordinates - items[0].x = x; - items[0].y = y; + // find bottom right point + for (var i = 1; i < polygon.length; ++i) { + if (v[i][1] < v[br][1] || (v[i][1] === v[br][1] && v[i][0] > v[br][0])) { + br = i; } } - else - { - px = items[0].x; - py = items[0].y; - items[0].x = x; - items[0].y = y; + // reverse poly if clockwise + if (!isLeft(polygonAt(polygon, br - 1), polygonAt(polygon, br), polygonAt(polygon, br + 1))) { + polygonReverse(polygon); + return true; + } else { + return false; } - - // Return the final set of coordinates as they're effectively lost from the shift and may be needed - - output.x = px; - output.y = py; - - return output; -}; - -module.exports = ShiftPosition; - - -/***/ }), -/* 717 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var ArrayShuffle = __webpack_require__(131); +} /** - * Shuffles the array in place. The shuffled array is both modified and returned. - * - * @function Phaser.Actions.Shuffle - * @since 3.0.0 - * @see Phaser.Utils.Array.Shuffle - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + * Reverse the vertices in the polygon + * @method reverse */ -var Shuffle = function (items) -{ - return ArrayShuffle(items); -}; - -module.exports = Shuffle; - - -/***/ }), -/* 718 */ -/***/ (function(module, exports, __webpack_require__) { +function polygonReverse(polygon){ + var tmp = []; + var N = polygon.length; + for(var i=0; i!==N; i++){ + tmp.push(polygon.pop()); + } + for(var i=0; i!==N; i++){ + polygon[i] = tmp[i]; + } +} /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Check if a point in the polygon is a reflex point + * @method isReflex + * @param {Number} i + * @return {Boolean} */ +function polygonIsReflex(polygon, i){ + return isRight(polygonAt(polygon, i - 1), polygonAt(polygon, i), polygonAt(polygon, i + 1)); +} -var MathSmootherStep = __webpack_require__(183); +var tmpLine1=[], + tmpLine2=[]; /** - * Smootherstep is a sigmoid-like interpolation and clamping function. - * - * The function depends on three parameters, the input x, the "left edge" and the "right edge", with the left edge being assumed smaller than the right edge. The function receives a real number x as an argument and returns 0 if x is less than or equal to the left edge, 1 if x is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, between 0 and 1 otherwise. The slope of the smoothstep function is zero at both edges. This is convenient for creating a sequence of transitions using smoothstep to interpolate each segment as an alternative to using more sophisticated or expensive interpolation techniques. - * - * @function Phaser.Actions.SmootherStep - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {string} property - The property of the Game Object to interpolate. - * @param {number} min - The minimum interpolation value. - * @param {number} max - The maximum interpolation value. - * @param {boolean} [inc=false] - Should the values be incremented? `true` or set (`false`) - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + * Check if two vertices in the polygon can see each other + * @method canSee + * @param {Number} a Vertex index 1 + * @param {Number} b Vertex index 2 + * @return {Boolean} */ -var SmootherStep = function (items, property, min, max, inc) -{ - if (inc === undefined) { inc = false; } - - var step = Math.abs(max - min) / items.length; - var i; +function polygonCanSee(polygon, a,b) { + var p, dist, l1=tmpLine1, l2=tmpLine2; - if (inc) - { - for (i = 0; i < items.length; i++) - { - items[i][property] += MathSmootherStep(i * step, min, max); - } + if (isLeftOn(polygonAt(polygon, a + 1), polygonAt(polygon, a), polygonAt(polygon, b)) && isRightOn(polygonAt(polygon, a - 1), polygonAt(polygon, a), polygonAt(polygon, b))) { + return false; } - else - { - for (i = 0; i < items.length; i++) - { - items[i][property] = MathSmootherStep(i * step, min, max); + dist = sqdist(polygonAt(polygon, a), polygonAt(polygon, b)); + for (var i = 0; i !== polygon.length; ++i) { // for each edge + if ((i + 1) % polygon.length === a || i === a){ // ignore incident edges + continue; + } + if (isLeftOn(polygonAt(polygon, a), polygonAt(polygon, b), polygonAt(polygon, i + 1)) && isRightOn(polygonAt(polygon, a), polygonAt(polygon, b), polygonAt(polygon, i))) { // if diag intersects an edge + l1[0] = polygonAt(polygon, a); + l1[1] = polygonAt(polygon, b); + l2[0] = polygonAt(polygon, i); + l2[1] = polygonAt(polygon, i + 1); + p = lineInt(l1,l2); + if (sqdist(polygonAt(polygon, a), p) < dist) { // if edge is blocking visibility to b + return false; + } } } - return items; -}; - -module.exports = SmootherStep; - - -/***/ }), -/* 719 */ -/***/ (function(module, exports, __webpack_require__) { + return true; +} /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Check if two vertices in the polygon can see each other + * @method canSee2 + * @param {Number} a Vertex index 1 + * @param {Number} b Vertex index 2 + * @return {Boolean} */ - -var MathSmoothStep = __webpack_require__(184); +function polygonCanSee2(polygon, a,b) { + // for each edge + for (var i = 0; i !== polygon.length; ++i) { + // ignore incident edges + if (i === a || i === b || (i + 1) % polygon.length === a || (i + 1) % polygon.length === b){ + continue; + } + if( lineSegmentsIntersect(polygonAt(polygon, a), polygonAt(polygon, b), polygonAt(polygon, i), polygonAt(polygon, i+1)) ){ + return false; + } + } + return true; +} /** - * Smoothstep is a sigmoid-like interpolation and clamping function. - * - * The function depends on three parameters, the input x, the "left edge" and the "right edge", with the left edge being assumed smaller than the right edge. The function receives a real number x as an argument and returns 0 if x is less than or equal to the left edge, 1 if x is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, between 0 and 1 otherwise. The slope of the smoothstep function is zero at both edges. This is convenient for creating a sequence of transitions using smoothstep to interpolate each segment as an alternative to using more sophisticated or expensive interpolation techniques. - * - * @function Phaser.Actions.SmoothStep - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {string} property - The property of the Game Object to interpolate. - * @param {number} min - The minimum interpolation value. - * @param {number} max - The maximum interpolation value. - * @param {boolean} [inc=false] - Should the values be incremented? `true` or set (`false`) - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + * Copy the polygon from vertex i to vertex j. + * @method copy + * @param {Number} i + * @param {Number} j + * @param {Polygon} [targetPoly] Optional target polygon to save in. + * @return {Polygon} The resulting copy. */ -var SmoothStep = function (items, property, min, max, inc) -{ - if (inc === undefined) { inc = false; } +function polygonCopy(polygon, i,j,targetPoly){ + var p = targetPoly || []; + polygonClear(p); + if (i < j) { + // Insert all vertices from i to j + for(var k=i; k<=j; k++){ + p.push(polygon[k]); + } - var step = Math.abs(max - min) / items.length; - var i; + } else { - if (inc) - { - for (i = 0; i < items.length; i++) - { - items[i][property] += MathSmoothStep(i * step, min, max); + // Insert vertices 0 to j + for(var k=0; k<=j; k++){ + p.push(polygon[k]); } - } - else - { - for (i = 0; i < items.length; i++) - { - items[i][property] = MathSmoothStep(i * step, min, max); + + // Insert vertices i to end + for(var k=i; k - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Decomposes the polygon into convex pieces. Returns a list of edges [[p1,p2],[p2,p3],...] that cuts the polygon. + * Note that this algorithm has complexity O(N^4) and will be very slow for polygons with many vertices. + * @method getCutEdges + * @return {Array} */ +function polygonGetCutEdges(polygon) { + var min=[], tmp1=[], tmp2=[], tmpPoly = []; + var nDiags = Number.MAX_VALUE; -/** - * Takes an array of Game Objects and then modifies their `property` so the value equals, or is incremented, by the - * calculated spread value. - * - * The spread value is derived from the given `min` and `max` values and the total number of items in the array. - * - * For example, to cause an array of Sprites to change in alpha from 0 to 1 you could call: - * - * ```javascript - * Phaser.Actions.Spread(itemsArray, 'alpha', 0, 1); - * ``` - * - * @function Phaser.Actions.Spread - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {string} property - The property of the Game Object to spread. - * @param {number} min - The minimum value. - * @param {number} max - The maximum value. - * @param {boolean} [inc=false] - Should the values be incremented? `true` or set (`false`) - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that were passed to this Action. - */ -var Spread = function (items, property, min, max, inc) -{ - if (inc === undefined) { inc = false; } + for (var i = 0; i < polygon.length; ++i) { + if (polygonIsReflex(polygon, i)) { + for (var j = 0; j < polygon.length; ++j) { + if (polygonCanSee(polygon, i, j)) { + tmp1 = polygonGetCutEdges(polygonCopy(polygon, i, j, tmpPoly)); + tmp2 = polygonGetCutEdges(polygonCopy(polygon, j, i, tmpPoly)); - var step = Math.abs(max - min) / items.length; - var i; + for(var k=0; k - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Decomposes the polygon into one or more convex sub-Polygons. + * @method decomp + * @return {Array} An array or Polygon objects. */ +function polygonDecomp(polygon){ + var edges = polygonGetCutEdges(polygon); + if(edges.length > 0){ + return polygonSlice(polygon, edges); + } else { + return [polygon]; + } +} /** - * Takes an array of Game Objects and toggles the visibility of each one. - * Those previously `visible = false` will become `visible = true`, and vice versa. - * - * @function Phaser.Actions.ToggleVisible - * @since 3.0.0 - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + * Slices the polygon given one or more cut edges. If given one, this function will return two polygons (false on failure). If many, an array of polygons. + * @method slice + * @param {Array} cutEdges A list of edges, as returned by .getCutEdges() + * @return {Array} */ -var ToggleVisible = function (items) -{ - for (var i = 0; i < items.length; i++) - { - items[i].visible = !items[i].visible; +function polygonSlice(polygon, cutEdges){ + if(cutEdges.length === 0){ + return [polygon]; } + if(cutEdges instanceof Array && cutEdges.length && cutEdges[0] instanceof Array && cutEdges[0].length===2 && cutEdges[0][0] instanceof Array){ - return items; -}; - -module.exports = ToggleVisible; + var polys = [polygon]; + for(var i=0; i - * @author samme - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Was given one edge + var cutEdge = cutEdges; + var i = polygon.indexOf(cutEdge[0]); + var j = polygon.indexOf(cutEdge[1]); -var Wrap = __webpack_require__(68); + if(i !== -1 && j !== -1){ + return [polygonCopy(polygon, i,j), + polygonCopy(polygon, j,i)]; + } else { + return false; + } + } +} /** - * Wrap each item's coordinates within a rectangle's area. - * - * @function Phaser.Actions.WrapInRectangle - * @since 3.0.0 - * @see Phaser.Math.Wrap - * - * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return] - * - * @param {(array|Phaser.GameObjects.GameObject[])} items - An array of Game Objects. The contents of this array are updated by this Action. - * @param {Phaser.Geom.Rectangle} rect - The rectangle. - * @param {number} [padding=0] - An amount added to each side of the rectangle during the operation. - * - * @return {(array|Phaser.GameObjects.GameObject[])} The array of Game Objects that was passed to this Action. + * Checks that the line segments of this polygon do not intersect each other. + * @method isSimple + * @param {Array} path An array of vertices e.g. [[0,0],[0,1],...] + * @return {Boolean} + * @todo Should it check all segments with all others? */ -var WrapInRectangle = function (items, rect, padding) -{ - if (padding === undefined) - { - padding = 0; +function polygonIsSimple(polygon){ + var path = polygon, i; + // Check + for(i=0; i - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Quickly decompose the Polygon into convex sub-polygons. + * @method quickDecomp + * @param {Array} result + * @param {Array} [reflexVertices] + * @param {Array} [steinerPoints] + * @param {Number} [delta] + * @param {Number} [maxlevel] + * @param {Number} [level] + * @return {Array} */ +function polygonQuickDecomp(polygon, result,reflexVertices,steinerPoints,delta,maxlevel,level){ + maxlevel = maxlevel || 100; + level = level || 0; + delta = delta || 25; + result = typeof(result)!=="undefined" ? result : []; + reflexVertices = reflexVertices || []; + steinerPoints = steinerPoints || []; -/** - * @namespace Phaser.Animations - */ + var upperInt=[0,0], lowerInt=[0,0], p=[0,0]; // Points + var upperDist=0, lowerDist=0, d=0, closestDist=0; // scalars + var upperIndex=0, lowerIndex=0, closestIndex=0; // Integers + var lowerPoly=[], upperPoly=[]; // polygons + var poly = polygon, + v = polygon; -module.exports = { + if(v.length < 3){ + return result; + } - Animation: __webpack_require__(185), - AnimationFrame: __webpack_require__(319), - AnimationManager: __webpack_require__(321), - AnimationState: __webpack_require__(164), - Events: __webpack_require__(132) + level++; + if(level > maxlevel){ + console.warn("quickDecomp: max level ("+maxlevel+") reached."); + return result; + } -}; + for (var i = 0; i < polygon.length; ++i) { + if (polygonIsReflex(poly, i)) { + reflexVertices.push(poly[i]); + upperDist = lowerDist = Number.MAX_VALUE; -/***/ }), -/* 724 */ -/***/ (function(module, exports) { + for (var j = 0; j < polygon.length; ++j) { + if (isLeft(polygonAt(poly, i - 1), polygonAt(poly, i), polygonAt(poly, j)) && isRightOn(polygonAt(poly, i - 1), polygonAt(poly, i), polygonAt(poly, j - 1))) { // if line intersects with an edge + p = getIntersectionPoint(polygonAt(poly, i - 1), polygonAt(poly, i), polygonAt(poly, j), polygonAt(poly, j - 1)); // find the point of intersection + if (isRight(polygonAt(poly, i + 1), polygonAt(poly, i), p)) { // make sure it's inside the poly + d = sqdist(poly[i], p); + if (d < lowerDist) { // keep only the closest intersection + lowerDist = d; + lowerInt = p; + lowerIndex = j; + } + } + } + if (isLeft(polygonAt(poly, i + 1), polygonAt(poly, i), polygonAt(poly, j + 1)) && isRightOn(polygonAt(poly, i + 1), polygonAt(poly, i), polygonAt(poly, j))) { + p = getIntersectionPoint(polygonAt(poly, i + 1), polygonAt(poly, i), polygonAt(poly, j), polygonAt(poly, j + 1)); + if (isLeft(polygonAt(poly, i - 1), polygonAt(poly, i), p)) { + d = sqdist(poly[i], p); + if (d < upperDist) { + upperDist = d; + upperInt = p; + upperIndex = j; + } + } + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // if there are no vertices to connect to, choose a point in the middle + if (lowerIndex === (upperIndex + 1) % polygon.length) { + //console.log("Case 1: Vertex("+i+"), lowerIndex("+lowerIndex+"), upperIndex("+upperIndex+"), poly.size("+polygon.length+")"); + p[0] = (lowerInt[0] + upperInt[0]) / 2; + p[1] = (lowerInt[1] + upperInt[1]) / 2; + steinerPoints.push(p); -/** - * The Add Animation Event. - * - * This event is dispatched when a new animation is added to the global Animation Manager. - * - * This can happen either as a result of an animation instance being added to the Animation Manager, - * or the Animation Manager creating a new animation directly. - * - * @event Phaser.Animations.Events#ADD_ANIMATION - * @since 3.0.0 - * - * @param {string} key - The key of the Animation that was added to the global Animation Manager. - * @param {Phaser.Animations.Animation} animation - An instance of the newly created Animation. - */ -module.exports = 'add'; + if (i < upperIndex) { + //lowerPoly.insert(lowerPoly.end(), poly.begin() + i, poly.begin() + upperIndex + 1); + polygonAppend(lowerPoly, poly, i, upperIndex+1); + lowerPoly.push(p); + upperPoly.push(p); + if (lowerIndex !== 0){ + //upperPoly.insert(upperPoly.end(), poly.begin() + lowerIndex, poly.end()); + polygonAppend(upperPoly, poly,lowerIndex,poly.length); + } + //upperPoly.insert(upperPoly.end(), poly.begin(), poly.begin() + i + 1); + polygonAppend(upperPoly, poly,0,i+1); + } else { + if (i !== 0){ + //lowerPoly.insert(lowerPoly.end(), poly.begin() + i, poly.end()); + polygonAppend(lowerPoly, poly,i,poly.length); + } + //lowerPoly.insert(lowerPoly.end(), poly.begin(), poly.begin() + upperIndex + 1); + polygonAppend(lowerPoly, poly,0,upperIndex+1); + lowerPoly.push(p); + upperPoly.push(p); + //upperPoly.insert(upperPoly.end(), poly.begin() + lowerIndex, poly.begin() + i + 1); + polygonAppend(upperPoly, poly,lowerIndex,i+1); + } + } else { + // connect to the closest point within the triangle + //console.log("Case 2: Vertex("+i+"), closestIndex("+closestIndex+"), poly.size("+polygon.length+")\n"); + if (lowerIndex > upperIndex) { + upperIndex += polygon.length; + } + closestDist = Number.MAX_VALUE; -/***/ }), -/* 725 */ -/***/ (function(module, exports) { + if(upperIndex < lowerIndex){ + return result; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (var j = lowerIndex; j <= upperIndex; ++j) { + if ( + isLeftOn(polygonAt(poly, i - 1), polygonAt(poly, i), polygonAt(poly, j)) && + isRightOn(polygonAt(poly, i + 1), polygonAt(poly, i), polygonAt(poly, j)) + ) { + d = sqdist(polygonAt(poly, i), polygonAt(poly, j)); + if (d < closestDist && polygonCanSee2(poly, i, j)) { + closestDist = d; + closestIndex = j % polygon.length; + } + } + } -/** - * The Animation Complete Event. - * - * This event is dispatched by a Sprite when an animation playing on it completes playback. - * This happens when the animation gets to the end of its sequence, factoring in any delays - * or repeats it may have to process. - * - * An animation that is set to loop, or repeat forever, will never fire this event, because - * it never actually completes. If you need to handle this, listen for the `ANIMATION_STOP` - * event instead, as this is emitted when the animation is stopped directly. - * - * Listen for it on the Sprite using `sprite.on('animationcomplete', listener)` - * - * The animation event flow is as follows: - * - * 1. `ANIMATION_START` - * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) - * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) - * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) - * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) - * - * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. - * - * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. - * - * @event Phaser.Animations.Events#ANIMATION_COMPLETE - * @since 3.50.0 - * - * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. - * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. - * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. - * @param {string} frameKey - The unique key of the Animation Frame within the Animation. - */ -module.exports = 'animationcomplete'; + if (i < closestIndex) { + polygonAppend(lowerPoly, poly,i,closestIndex+1); + if (closestIndex !== 0){ + polygonAppend(upperPoly, poly,closestIndex,v.length); + } + polygonAppend(upperPoly, poly,0,i+1); + } else { + if (i !== 0){ + polygonAppend(lowerPoly, poly,i,v.length); + } + polygonAppend(lowerPoly, poly,0,closestIndex+1); + polygonAppend(upperPoly, poly,closestIndex,i+1); + } + } + + // solve smallest poly first + if (lowerPoly.length < upperPoly.length) { + polygonQuickDecomp(lowerPoly,result,reflexVertices,steinerPoints,delta,maxlevel,level); + polygonQuickDecomp(upperPoly,result,reflexVertices,steinerPoints,delta,maxlevel,level); + } else { + polygonQuickDecomp(upperPoly,result,reflexVertices,steinerPoints,delta,maxlevel,level); + polygonQuickDecomp(lowerPoly,result,reflexVertices,steinerPoints,delta,maxlevel,level); + } + return result; + } + } + result.push(polygon); -/***/ }), -/* 726 */ -/***/ (function(module, exports) { + return result; +} /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Remove collinear points in the polygon. + * @method removeCollinearPoints + * @param {Number} [precision] The threshold angle to use when determining whether two edges are collinear. Use zero for finest precision. + * @return {Number} The number of points removed */ +function polygonRemoveCollinearPoints(polygon, precision){ + var num = 0; + for(var i=polygon.length-1; polygon.length>3 && i>=0; --i){ + if(collinear(polygonAt(polygon, i-1),polygonAt(polygon, i),polygonAt(polygon, i+1),precision)){ + // Remove the middle point + polygon.splice(i%polygon.length,1); + num++; + } + } + return num; +} /** - * The Animation Complete Dynamic Key Event. - * - * This event is dispatched by a Sprite when an animation playing on it completes playback. - * This happens when the animation gets to the end of its sequence, factoring in any delays - * or repeats it may have to process. - * - * An animation that is set to loop, or repeat forever, will never fire this event, because - * it never actually completes. If you need to handle this, listen for the `ANIMATION_STOP` - * event instead, as this is emitted when the animation is stopped directly. - * - * The difference between this and the `ANIMATION_COMPLETE` event is that this one has a - * dynamic event name that contains the name of the animation within it. For example, - * if you had an animation called `explode` you could listen for the completion of that - * specific animation by using: `sprite.on('animationcomplete-explode', listener)`. Or, if you - * wish to use types: `sprite.on(Phaser.Animations.Events.ANIMATION_COMPLETE_KEY + 'explode', listener)`. - * - * The animation event flow is as follows: - * - * 1. `ANIMATION_START` - * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) - * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) - * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) - * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) - * - * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. - * - * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. - * - * @event Phaser.Animations.Events#ANIMATION_COMPLETE_KEY - * @since 3.50.0 - * - * @param {Phaser.Animations.Animation} animation - A reference to the Animation that completed. - * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. - * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. - * @param {string} frameKey - The unique key of the Animation Frame within the Animation. + * Remove duplicate points in the polygon. + * @method removeDuplicatePoints + * @param {Number} [precision] The threshold to use when determining whether two points are the same. Use zero for best precision. */ -module.exports = 'animationcomplete-'; - - -/***/ }), -/* 727 */ -/***/ (function(module, exports) { +function polygonRemoveDuplicatePoints(polygon, precision){ + for(var i=polygon.length-1; i>=1; --i){ + var pi = polygon[i]; + for(var j=i-1; j>=0; --j){ + if(points_eq(pi, polygon[j], precision)){ + polygon.splice(i,1); + continue; + } + } + } +} /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Check if two scalars are equal + * @static + * @method eq + * @param {Number} a + * @param {Number} b + * @param {Number} [precision] + * @return {Boolean} */ +function scalar_eq(a,b,precision){ + precision = precision || 0; + return Math.abs(a-b) <= precision; +} /** - * The Animation Repeat Event. - * - * This event is dispatched by a Sprite when an animation repeats playing on it. - * This happens if the animation was created, or played, with a `repeat` value specified. - * - * An animation will repeat when it reaches the end of its sequence. - * - * Listen for it on the Sprite using `sprite.on('animationrepeat', listener)` - * - * The animation event flow is as follows: - * - * 1. `ANIMATION_START` - * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) - * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) - * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) - * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) - * - * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. - * - * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. - * - * @event Phaser.Animations.Events#ANIMATION_REPEAT - * @since 3.50.0 - * - * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has repeated. - * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. - * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation repeated. - * @param {string} frameKey - The unique key of the Animation Frame within the Animation. + * Check if two points are equal + * @static + * @method points_eq + * @param {Array} a + * @param {Array} b + * @param {Number} [precision] + * @return {Boolean} */ -module.exports = 'animationrepeat'; +function points_eq(a,b,precision){ + return scalar_eq(a[0],b[0],precision) && scalar_eq(a[1],b[1],precision); +} /***/ }), -/* 728 */ -/***/ (function(module, exports) { + +/***/ 88257: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +* @author Richard Davey +* @copyright 2013-2023 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} +*/ + +var Class = __webpack_require__(56694); /** - * The Animation Restart Event. - * - * This event is dispatched by a Sprite when an animation restarts playing on it. - * This only happens when the `Sprite.anims.restart` method is called. - * - * Listen for it on the Sprite using `sprite.on('animationrestart', listener)` - * - * The animation event flow is as follows: - * - * 1. `ANIMATION_START` - * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) - * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) - * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) - * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) - * - * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. - * - * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. + * @classdesc + * A Global Plugin is installed just once into the Game owned Plugin Manager. + * It can listen for Game events and respond to them. * - * @event Phaser.Animations.Events#ANIMATION_RESTART - * @since 3.50.0 + * @class BasePlugin + * @memberof Phaser.Plugins + * @constructor + * @since 3.8.0 * - * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has restarted. - * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. - * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation restarted. - * @param {string} frameKey - The unique key of the Animation Frame within the Animation. + * @param {Phaser.Plugins.PluginManager} pluginManager - A reference to the Plugin Manager. */ -module.exports = 'animationrestart'; - +var BasePlugin = new Class({ -/***/ }), -/* 729 */ -/***/ (function(module, exports) { + initialize: -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + function BasePlugin (pluginManager) + { + /** + * A handy reference to the Plugin Manager that is responsible for this plugin. + * Can be used as a route to gain access to game systems and events. + * + * @name Phaser.Plugins.BasePlugin#pluginManager + * @type {Phaser.Plugins.PluginManager} + * @protected + * @since 3.8.0 + */ + this.pluginManager = pluginManager; -/** - * The Animation Start Event. - * - * This event is dispatched by a Sprite when an animation starts playing on it. - * This happens when the animation is played, factoring in any delay that may have been specified. - * This event happens after the delay has expired and prior to the first update event. - * - * Listen for it on the Sprite using `sprite.on('animationstart', listener)` - * - * The animation event flow is as follows: - * - * 1. `ANIMATION_START` - * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) - * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) - * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) - * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) - * - * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. - * - * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. - * - * @event Phaser.Animations.Events#ANIMATION_START - * @since 3.50.0 - * - * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has started. - * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. - * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation started. - * @param {string} frameKey - The unique key of the Animation Frame within the Animation. - */ -module.exports = 'animationstart'; + /** + * A reference to the Game instance this plugin is running under. + * + * @name Phaser.Plugins.BasePlugin#game + * @type {Phaser.Game} + * @protected + * @since 3.8.0 + */ + this.game = pluginManager.game; + }, + /** + * The PluginManager calls this method on a Global Plugin when the plugin is first instantiated. + * It will never be called again on this instance. + * In here you can set-up whatever you need for this plugin to run. + * If a plugin is set to automatically start then `BasePlugin.start` will be called immediately after this. + * On a Scene Plugin, this method is never called. Use {@link Phaser.Plugins.ScenePlugin#boot} instead. + * + * @method Phaser.Plugins.BasePlugin#init + * @since 3.8.0 + * + * @param {?any} [data] - A value specified by the user, if any, from the `data` property of the plugin's configuration object (if started at game boot) or passed in the PluginManager's `install` method (if started manually). + */ + init: function () + { + }, -/***/ }), -/* 730 */ -/***/ (function(module, exports) { + /** + * The PluginManager calls this method on a Global Plugin when the plugin is started. + * If a plugin is stopped, and then started again, this will get called again. + * Typically called immediately after `BasePlugin.init`. + * On a Scene Plugin, this method is never called. + * + * @method Phaser.Plugins.BasePlugin#start + * @since 3.8.0 + */ + start: function () + { + // Here are the game-level events you can listen to. + // At the very least you should offer a destroy handler for when the game closes down. -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // var eventEmitter = this.game.events; -/** - * The Animation Stop Event. - * - * This event is dispatched by a Sprite when an animation is stopped on it. An animation - * will only be stopeed if a method such as `Sprite.stop` or `Sprite.anims.stopAfterDelay` - * is called. It can also be emitted if a new animation is started before the current one completes. - * - * Listen for it on the Sprite using `sprite.on('animationstop', listener)` - * - * The animation event flow is as follows: - * - * 1. `ANIMATION_START` - * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) - * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) - * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) - * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) - * - * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. - * - * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. - * - * @event Phaser.Animations.Events#ANIMATION_STOP - * @since 3.50.0 - * - * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has stopped. - * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. - * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation stopped. - * @param {string} frameKey - The unique key of the Animation Frame within the Animation. - */ -module.exports = 'animationstop'; + // eventEmitter.once('destroy', this.gameDestroy, this); + // eventEmitter.on('pause', this.gamePause, this); + // eventEmitter.on('resume', this.gameResume, this); + // eventEmitter.on('resize', this.gameResize, this); + // eventEmitter.on('prestep', this.gamePreStep, this); + // eventEmitter.on('step', this.gameStep, this); + // eventEmitter.on('poststep', this.gamePostStep, this); + // eventEmitter.on('prerender', this.gamePreRender, this); + // eventEmitter.on('postrender', this.gamePostRender, this); + }, + /** + * The PluginManager calls this method on a Global Plugin when the plugin is stopped. + * The game code has requested that your plugin stop doing whatever it does. + * It is now considered as 'inactive' by the PluginManager. + * Handle that process here (i.e. stop listening for events, etc) + * If the plugin is started again then `BasePlugin.start` will be called again. + * On a Scene Plugin, this method is never called. + * + * @method Phaser.Plugins.BasePlugin#stop + * @since 3.8.0 + */ + stop: function () + { + }, -/***/ }), -/* 731 */ -/***/ (function(module, exports) { + /** + * Game instance has been destroyed. + * You must release everything in here, all references, all objects, free it all up. + * + * @method Phaser.Plugins.BasePlugin#destroy + * @since 3.8.0 + */ + destroy: function () + { + this.pluginManager = null; + this.game = null; + this.scene = null; + this.systems = null; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +}); -/** - * The Animation Update Event. - * - * This event is dispatched by a Sprite when an animation playing on it updates. This happens when the animation changes frame. - * An animation will change frame based on the frme rate and other factors like `timeScale` and `delay`. It can also change - * frame when stopped or restarted. - * - * Listen for it on the Sprite using `sprite.on('animationupdate', listener)` - * - * If an animation is playing faster than the game frame-rate can handle, it's entirely possible for it to emit several - * update events in a single game frame, so please be aware of this in your code. The **final** event received that frame - * is the one that is rendered to the game. - * - * The animation event flow is as follows: - * - * 1. `ANIMATION_START` - * 2. `ANIMATION_UPDATE` (repeated for however many frames the animation has) - * 3. `ANIMATION_REPEAT` (only if the animation is set to repeat, it then emits more update events after this) - * 4. `ANIMATION_COMPLETE` (only if there is a finite, or zero, repeat count) - * 5. `ANIMATION_COMPLETE_KEY` (only if there is a finite, or zero, repeat count) - * - * If the animation is stopped directly, the `ANIMATION_STOP` event is dispatched instead of `ANIMATION_COMPLETE`. - * - * If the animation is restarted while it is already playing, `ANIMATION_RESTART` is emitted. - * - * @event Phaser.Animations.Events#ANIMATION_UPDATE - * @since 3.50.0 - * - * @param {Phaser.Animations.Animation} animation - A reference to the Animation that has updated. - * @param {Phaser.Animations.AnimationFrame} frame - The current Animation Frame of the Animation. - * @param {Phaser.GameObjects.Sprite} gameObject - A reference to the Game Object on which the animation updated. - * @param {string} frameKey - The unique key of the Animation Frame within the Animation. - */ -module.exports = 'animationupdate'; +module.exports = BasePlugin; /***/ }), -/* 732 */ -/***/ (function(module, exports) { + +/***/ 18360: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Pause All Animations Event. - * - * This event is dispatched when the global Animation Manager is told to pause. - * - * When this happens all current animations will stop updating, although it doesn't necessarily mean - * that the game has paused as well. + * The Default Plugins. * - * @event Phaser.Animations.Events#PAUSE_ALL + * @namespace Phaser.Plugins.DefaultPlugins + * @memberof Phaser.Plugins * @since 3.0.0 */ -module.exports = 'pauseall'; +var DefaultPlugins = { -/***/ }), -/* 733 */ -/***/ (function(module, exports) { + /** + * These are the Global Managers that are created by the Phaser.Game instance. + * They are referenced from Scene.Systems so that plugins can use them. + * + * @name Phaser.Plugins.DefaultPlugins.Global + * @type {array} + * @since 3.0.0 + */ + Global: [ -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + 'game', + 'anims', + 'cache', + 'plugins', + 'registry', + 'scale', + 'sound', + 'textures', + 'renderer' -/** - * The Remove Animation Event. - * - * This event is dispatched when an animation is removed from the global Animation Manager. - * - * @event Phaser.Animations.Events#REMOVE_ANIMATION - * @since 3.0.0 - * - * @param {string} key - The key of the Animation that was removed from the global Animation Manager. - * @param {Phaser.Animations.Animation} animation - An instance of the removed Animation. - */ -module.exports = 'remove'; + ], + /** + * These are the core plugins that are installed into every Scene.Systems instance, no matter what. + * They are optionally exposed in the Scene as well (see the InjectionMap for details) + * + * They are created in the order in which they appear in this array and EventEmitter is always first. + * + * @name Phaser.Plugins.DefaultPlugins.CoreScene + * @type {array} + * @since 3.0.0 + */ + CoreScene: [ -/***/ }), -/* 734 */ -/***/ (function(module, exports) { + 'EventEmitter', -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + 'CameraManager', + 'GameObjectCreator', + 'GameObjectFactory', + 'ScenePlugin', + 'DisplayList', + 'UpdateList' -/** - * The Resume All Animations Event. - * - * This event is dispatched when the global Animation Manager resumes, having been previously paused. - * - * When this happens all current animations will continue updating again. - * - * @event Phaser.Animations.Events#RESUME_ALL - * @since 3.0.0 - */ -module.exports = 'resumeall'; + ], + /** + * These plugins are created in Scene.Systems in addition to the CoreScenePlugins. + * + * You can elect not to have these plugins by either creating a DefaultPlugins object as part + * of the Game Config, by creating a Plugins object as part of a Scene Config, or by modifying this array + * and building your own bundle. + * + * They are optionally exposed in the Scene as well (see the InjectionMap for details) + * + * They are always created in the order in which they appear in the array. + * + * @name Phaser.Plugins.DefaultPlugins.DefaultScene + * @type {array} + * @since 3.0.0 + */ + DefaultScene: [ -/***/ }), -/* 735 */ -/***/ (function(module, exports, __webpack_require__) { + 'Clock', + 'DataManagerPlugin', + 'InputPlugin', + 'Loader', + 'TweenManager', + 'LightsPlugin' -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + ] -/** - * @namespace Phaser.Cache - */ +}; -module.exports = { +if (false) +{} - BaseCache: __webpack_require__(323), - CacheManager: __webpack_require__(325), - Events: __webpack_require__(324) +if (false) +{} -}; +module.exports = DefaultPlugins; /***/ }), -/* 736 */ -/***/ (function(module, exports) { + +/***/ 91963: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * The Cache Add Event. - * - * This event is dispatched by any Cache that extends the BaseCache each time a new object is added to it. - * - * @event Phaser.Cache.Events#ADD - * @since 3.0.0 - * - * @param {Phaser.Cache.BaseCache} cache - The cache to which the object was added. - * @param {string} key - The key of the object added to the cache. - * @param {*} object - A reference to the object that was added to the cache. - */ -module.exports = 'add'; +// Contains the plugins that Phaser uses globally and locally. +// These are the source objects, not instantiated. +var corePlugins = {}; +// Contains the plugins that the dev has loaded into their game +// These are the source objects, not instantiated. +var customPlugins = {}; -/***/ }), -/* 737 */ -/***/ (function(module, exports) { +var PluginCache = {}; /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * @namespace Phaser.Plugins.PluginCache */ /** - * The Cache Remove Event. - * - * This event is dispatched by any Cache that extends the BaseCache each time an object is removed from it. + * Static method called directly by the Core internal Plugins. + * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) + * Plugin is the object to instantiate to create the plugin + * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input) * - * @event Phaser.Cache.Events#REMOVE - * @since 3.0.0 - * - * @param {Phaser.Cache.BaseCache} cache - The cache from which the object was removed. - * @param {string} key - The key of the object removed from the cache. - * @param {*} object - A reference to the object that was removed from the cache. + * @method Phaser.Plugins.PluginCache.register + * @since 3.8.0 + * + * @param {string} key - A reference used to get this plugin from the plugin cache. + * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. + * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used. + * @param {boolean} [custom=false] - Core Scene plugin or a Custom Scene plugin? */ -module.exports = 'remove'; - +PluginCache.register = function (key, plugin, mapping, custom) +{ + if (custom === undefined) { custom = false; } -/***/ }), -/* 738 */ -/***/ (function(module, exports, __webpack_require__) { + corePlugins[key] = { plugin: plugin, mapping: mapping, custom: custom }; +}; /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Stores a custom plugin in the global plugin cache. + * The key must be unique, within the scope of the cache. + * + * @method Phaser.Plugins.PluginCache.registerCustom + * @since 3.8.0 + * + * @param {string} key - A reference used to get this plugin from the plugin cache. + * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated. + * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used. + * @param {?any} data - A value to be passed to the plugin's `init` method. */ +PluginCache.registerCustom = function (key, plugin, mapping, data) +{ + customPlugins[key] = { plugin: plugin, mapping: mapping, data: data }; +}; /** - * @namespace Phaser.Cameras + * Checks if the given key is already being used in the core plugin cache. + * + * @method Phaser.Plugins.PluginCache.hasCore + * @since 3.8.0 + * + * @param {string} key - The key to check for. + * + * @return {boolean} `true` if the key is already in use in the core cache, otherwise `false`. */ +PluginCache.hasCore = function (key) +{ + return corePlugins.hasOwnProperty(key); +}; /** - * @namespace Phaser.Types.Cameras + * Checks if the given key is already being used in the custom plugin cache. + * + * @method Phaser.Plugins.PluginCache.hasCustom + * @since 3.8.0 + * + * @param {string} key - The key to check for. + * + * @return {boolean} `true` if the key is already in use in the custom cache, otherwise `false`. */ - -module.exports = { - - Controls: __webpack_require__(739), - Scene2D: __webpack_require__(742) - +PluginCache.hasCustom = function (key) +{ + return customPlugins.hasOwnProperty(key); }; - -/***/ }), -/* 739 */ -/***/ (function(module, exports, __webpack_require__) { - /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Returns the core plugin object from the cache based on the given key. + * + * @method Phaser.Plugins.PluginCache.getCore + * @since 3.8.0 + * + * @param {string} key - The key of the core plugin to get. + * + * @return {Phaser.Types.Plugins.CorePluginContainer} The core plugin object. */ +PluginCache.getCore = function (key) +{ + return corePlugins[key]; +}; /** - * @namespace Phaser.Cameras.Controls + * Returns the custom plugin object from the cache based on the given key. + * + * @method Phaser.Plugins.PluginCache.getCustom + * @since 3.8.0 + * + * @param {string} key - The key of the custom plugin to get. + * + * @return {Phaser.Types.Plugins.CustomPluginContainer} The custom plugin object. */ - -module.exports = { - - FixedKeyControl: __webpack_require__(740), - SmoothedKeyControl: __webpack_require__(741) - +PluginCache.getCustom = function (key) +{ + return customPlugins[key]; }; - -/***/ }), -/* 740 */ -/***/ (function(module, exports, __webpack_require__) { - /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Returns an object from the custom cache based on the given key that can be instantiated. + * + * @method Phaser.Plugins.PluginCache.getCustomClass + * @since 3.8.0 + * + * @param {string} key - The key of the custom plugin to get. + * + * @return {function} The custom plugin object. */ - -var Class = __webpack_require__(0); -var GetValue = __webpack_require__(6); +PluginCache.getCustomClass = function (key) +{ + return (customPlugins.hasOwnProperty(key)) ? customPlugins[key].plugin : null; +}; /** - * @classdesc - * A Fixed Key Camera Control. + * Removes a core plugin based on the given key. * - * This allows you to control the movement and zoom of a camera using the defined keys. + * @method Phaser.Plugins.PluginCache.remove + * @since 3.8.0 * - * ```javascript - * var camControl = new FixedKeyControl({ - * camera: this.cameras.main, - * left: cursors.left, - * right: cursors.right, - * speed: float OR { x: 0, y: 0 } - * }); - * ``` + * @param {string} key - The key of the core plugin to remove. + */ +PluginCache.remove = function (key) +{ + if (corePlugins.hasOwnProperty(key)) + { + delete corePlugins[key]; + } +}; + +/** + * Removes a custom plugin based on the given key. * - * Movement is precise and has no 'smoothing' applied to it. + * @method Phaser.Plugins.PluginCache.removeCustom + * @since 3.8.0 * - * You must call the `update` method of this controller every frame. + * @param {string} key - The key of the custom plugin to remove. + */ +PluginCache.removeCustom = function (key) +{ + if (customPlugins.hasOwnProperty(key)) + { + delete customPlugins[key]; + } +}; + +/** + * Removes all Core Plugins. * - * @class FixedKeyControl - * @memberof Phaser.Cameras.Controls - * @constructor - * @since 3.0.0 + * This includes all of the internal system plugins that Phaser needs, like the Input Plugin and Loader Plugin. + * So be sure you only call this if you do not wish to run Phaser again. * - * @param {Phaser.Types.Cameras.Controls.FixedKeyControlConfig} config - The Fixed Key Control configuration object. + * @method Phaser.Plugins.PluginCache.destroyCorePlugins + * @since 3.12.0 */ -var FixedKeyControl = new Class({ - - initialize: - - function FixedKeyControl (config) +PluginCache.destroyCorePlugins = function () +{ + for (var key in corePlugins) { - /** - * The Camera that this Control will update. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#camera - * @type {?Phaser.Cameras.Scene2D.Camera} - * @default null - * @since 3.0.0 - */ - this.camera = GetValue(config, 'camera', null); - - /** - * The Key to be pressed that will move the Camera left. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#left - * @type {?Phaser.Input.Keyboard.Key} - * @default null - * @since 3.0.0 - */ - this.left = GetValue(config, 'left', null); - - /** - * The Key to be pressed that will move the Camera right. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#right - * @type {?Phaser.Input.Keyboard.Key} - * @default null - * @since 3.0.0 - */ - this.right = GetValue(config, 'right', null); - - /** - * The Key to be pressed that will move the Camera up. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#up - * @type {?Phaser.Input.Keyboard.Key} - * @default null - * @since 3.0.0 - */ - this.up = GetValue(config, 'up', null); - - /** - * The Key to be pressed that will move the Camera down. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#down - * @type {?Phaser.Input.Keyboard.Key} - * @default null - * @since 3.0.0 - */ - this.down = GetValue(config, 'down', null); - - /** - * The Key to be pressed that will zoom the Camera in. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#zoomIn - * @type {?Phaser.Input.Keyboard.Key} - * @default null - * @since 3.0.0 - */ - this.zoomIn = GetValue(config, 'zoomIn', null); - - /** - * The Key to be pressed that will zoom the Camera out. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#zoomOut - * @type {?Phaser.Input.Keyboard.Key} - * @default null - * @since 3.0.0 - */ - this.zoomOut = GetValue(config, 'zoomOut', null); - - /** - * The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#zoomSpeed - * @type {number} - * @default 0.01 - * @since 3.0.0 - */ - this.zoomSpeed = GetValue(config, 'zoomSpeed', 0.01); - - /** - * The smallest zoom value the camera will reach when zoomed out. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#minZoom - * @type {number} - * @default 0.001 - * @since 3.53.0 - */ - this.minZoom = GetValue(config, 'minZoom', 0.001); - - /** - * The largest zoom value the camera will reach when zoomed in. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#maxZoom - * @type {number} - * @default 1000 - * @since 3.53.0 - */ - this.maxZoom = GetValue(config, 'maxZoom', 1000); - - /** - * The horizontal speed the camera will move. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#speedX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.speedX = 0; - - /** - * The vertical speed the camera will move. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#speedY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.speedY = 0; - - var speed = GetValue(config, 'speed', null); - - if (typeof speed === 'number') - { - this.speedX = speed; - this.speedY = speed; - } - else + if (corePlugins.hasOwnProperty(key)) { - this.speedX = GetValue(config, 'speed.x', 0); - this.speedY = GetValue(config, 'speed.y', 0); + delete corePlugins[key]; } + } +}; - /** - * Internal property to track the current zoom level. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#_zoom - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._zoom = 0; - - /** - * A flag controlling if the Controls will update the Camera or not. - * - * @name Phaser.Cameras.Controls.FixedKeyControl#active - * @type {boolean} - * @since 3.0.0 - */ - this.active = (this.camera !== null); - }, - - /** - * Starts the Key Control running, providing it has been linked to a camera. - * - * @method Phaser.Cameras.Controls.FixedKeyControl#start - * @since 3.0.0 - * - * @return {this} This Key Control instance. - */ - start: function () - { - this.active = (this.camera !== null); - - return this; - }, - - /** - * Stops this Key Control from running. Call `start` to start it again. - * - * @method Phaser.Cameras.Controls.FixedKeyControl#stop - * @since 3.0.0 - * - * @return {this} This Key Control instance. - */ - stop: function () - { - this.active = false; - - return this; - }, - - /** - * Binds this Key Control to a camera. - * - * @method Phaser.Cameras.Controls.FixedKeyControl#setCamera - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to bind this Key Control to. - * - * @return {this} This Key Control instance. - */ - setCamera: function (camera) - { - this.camera = camera; - - return this; - }, - - /** - * Applies the results of pressing the control keys to the Camera. - * - * You must call this every step, it is not called automatically. - * - * @method Phaser.Cameras.Controls.FixedKeyControl#update - * @since 3.0.0 - * - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - update: function (delta) +/** + * Removes all Custom Plugins. + * + * @method Phaser.Plugins.PluginCache.destroyCustomPlugins + * @since 3.12.0 + */ +PluginCache.destroyCustomPlugins = function () +{ + for (var key in customPlugins) { - if (!this.active) - { - return; - } - - if (delta === undefined) { delta = 1; } - - var cam = this.camera; - - if (this.up && this.up.isDown) - { - cam.scrollY -= ((this.speedY * delta) | 0); - } - else if (this.down && this.down.isDown) - { - cam.scrollY += ((this.speedY * delta) | 0); - } - - if (this.left && this.left.isDown) - { - cam.scrollX -= ((this.speedX * delta) | 0); - } - else if (this.right && this.right.isDown) - { - cam.scrollX += ((this.speedX * delta) | 0); - } - - // Camera zoom - - if (this.zoomIn && this.zoomIn.isDown) - { - cam.zoom -= this.zoomSpeed; - - if (cam.zoom < this.minZoom) - { - cam.zoom = this.minZoom; - } - } - else if (this.zoomOut && this.zoomOut.isDown) + if (customPlugins.hasOwnProperty(key)) { - cam.zoom += this.zoomSpeed; - - if (cam.zoom > this.maxZoom) - { - cam.zoom = this.maxZoom; - } + delete customPlugins[key]; } - }, - - /** - * Destroys this Key Control. - * - * @method Phaser.Cameras.Controls.FixedKeyControl#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.camera = null; - - this.left = null; - this.right = null; - this.up = null; - this.down = null; - - this.zoomIn = null; - this.zoomOut = null; } +}; -}); - -module.exports = FixedKeyControl; +module.exports = PluginCache; /***/ }), -/* 741 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 49274: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var GetValue = __webpack_require__(6); +var Class = __webpack_require__(56694); +var GameEvents = __webpack_require__(97081); +var EventEmitter = __webpack_require__(6659); +var FileTypesManager = __webpack_require__(76846); +var GameObjectCreator = __webpack_require__(99325); +var GameObjectFactory = __webpack_require__(61286); +var GetFastValue = __webpack_require__(72632); +var PluginCache = __webpack_require__(91963); +var Remove = __webpack_require__(66458); /** * @classdesc - * A Smoothed Key Camera Control. + * The PluginManager is responsible for installing and adding plugins to Phaser. * - * This allows you to control the movement and zoom of a camera using the defined keys. - * Unlike the Fixed Camera Control you can also provide physics values for acceleration, drag and maxSpeed for smoothing effects. + * It is a global system and therefore belongs to the Game instance, not a specific Scene. + * + * It works in conjunction with the PluginCache. Core internal plugins automatically register themselves + * with the Cache, but it's the Plugin Manager that is responsible for injecting them into the Scenes. + * + * There are two types of plugin: + * + * 1. A Global Plugin + * 2. A Scene Plugin + * + * A Global Plugin is a plugin that lives within the Plugin Manager rather than a Scene. You can get + * access to it by calling `PluginManager.get` and providing a key. Any Scene that requests a plugin in + * this way will all get access to the same plugin instance, allowing you to use a single plugin across + * multiple Scenes. + * + * A Scene Plugin is a plugin dedicated to running within a Scene. These are different to Global Plugins + * in that their instances do not live within the Plugin Manager, but within the Scene Systems class instead. + * And that every Scene created is given its own unique instance of a Scene Plugin. Examples of core Scene + * Plugins include the Input Plugin, the Tween Plugin and the physics Plugins. + * + * You can add a plugin to Phaser in three different ways: + * + * 1. Preload it + * 2. Include it in your source code and install it via the Game Config + * 3. Include it in your source code and install it within a Scene * - * ```javascript - * var controlConfig = { - * camera: this.cameras.main, - * left: cursors.left, - * right: cursors.right, - * up: cursors.up, - * down: cursors.down, - * zoomIn: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.Q), - * zoomOut: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.E), - * zoomSpeed: 0.02, - * acceleration: 0.06, - * drag: 0.0005, - * maxSpeed: 1.0 - * }; - * ``` + * For examples of all of these approaches please see the Phaser 3 Examples Repo `plugins` folder. * - * You must call the `update` method of this controller every frame. + * For information on creating your own plugin please see the Phaser 3 Plugin Template. * - * @class SmoothedKeyControl - * @memberof Phaser.Cameras.Controls + * @class PluginManager + * @memberof Phaser.Plugins * @constructor * @since 3.0.0 * - * @param {Phaser.Types.Cameras.Controls.SmoothedKeyControlConfig} config - The Smoothed Key Control configuration object. + * @param {Phaser.Game} game - The game instance that owns this Plugin Manager. */ -var SmoothedKeyControl = new Class({ +var PluginManager = new Class({ + + Extends: EventEmitter, initialize: - function SmoothedKeyControl (config) + function PluginManager (game) { - /** - * The Camera that this Control will update. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#camera - * @type {?Phaser.Cameras.Scene2D.Camera} - * @default null - * @since 3.0.0 - */ - this.camera = GetValue(config, 'camera', null); - - /** - * The Key to be pressed that will move the Camera left. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#left - * @type {?Phaser.Input.Keyboard.Key} - * @default null - * @since 3.0.0 - */ - this.left = GetValue(config, 'left', null); - - /** - * The Key to be pressed that will move the Camera right. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#right - * @type {?Phaser.Input.Keyboard.Key} - * @default null - * @since 3.0.0 - */ - this.right = GetValue(config, 'right', null); - - /** - * The Key to be pressed that will move the Camera up. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#up - * @type {?Phaser.Input.Keyboard.Key} - * @default null - * @since 3.0.0 - */ - this.up = GetValue(config, 'up', null); - - /** - * The Key to be pressed that will move the Camera down. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#down - * @type {?Phaser.Input.Keyboard.Key} - * @default null - * @since 3.0.0 - */ - this.down = GetValue(config, 'down', null); - - /** - * The Key to be pressed that will zoom the Camera in. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomIn - * @type {?Phaser.Input.Keyboard.Key} - * @default null - * @since 3.0.0 - */ - this.zoomIn = GetValue(config, 'zoomIn', null); - - /** - * The Key to be pressed that will zoom the Camera out. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomOut - * @type {?Phaser.Input.Keyboard.Key} - * @default null - * @since 3.0.0 - */ - this.zoomOut = GetValue(config, 'zoomOut', null); + EventEmitter.call(this); /** - * The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed. + * The game instance that owns this Plugin Manager. * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomSpeed - * @type {number} - * @default 0.01 + * @name Phaser.Plugins.PluginManager#game + * @type {Phaser.Game} * @since 3.0.0 */ - this.zoomSpeed = GetValue(config, 'zoomSpeed', 0.01); + this.game = game; /** - * The smallest zoom value the camera will reach when zoomed out. + * The global plugins currently running and managed by this Plugin Manager. + * A plugin must have been started at least once in order to appear in this list. * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#minZoom - * @type {number} - * @default 0.001 - * @since 3.53.0 + * @name Phaser.Plugins.PluginManager#plugins + * @type {Phaser.Types.Plugins.GlobalPlugin[]} + * @since 3.8.0 */ - this.minZoom = GetValue(config, 'minZoom', 0.001); + this.plugins = []; /** - * The largest zoom value the camera will reach when zoomed in. + * A list of plugin keys that should be installed into Scenes as well as the Core Plugins. * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxZoom - * @type {number} - * @default 1000 - * @since 3.53.0 + * @name Phaser.Plugins.PluginManager#scenePlugins + * @type {string[]} + * @since 3.8.0 */ - this.maxZoom = GetValue(config, 'maxZoom', 1000); + this.scenePlugins = []; /** - * The horizontal acceleration the camera will move. + * A temporary list of plugins to install when the game has booted. * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#accelX - * @type {number} - * @default 0 - * @since 3.0.0 + * @name Phaser.Plugins.PluginManager#_pendingGlobal + * @private + * @type {array} + * @since 3.8.0 */ - this.accelX = 0; + this._pendingGlobal = []; /** - * The vertical acceleration the camera will move. + * A temporary list of scene plugins to install when the game has booted. * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#accelY - * @type {number} - * @default 0 - * @since 3.0.0 + * @name Phaser.Plugins.PluginManager#_pendingScene + * @private + * @type {array} + * @since 3.8.0 */ - this.accelY = 0; - - var accel = GetValue(config, 'acceleration', null); + this._pendingScene = []; - if (typeof accel === 'number') + if (game.isBooted) { - this.accelX = accel; - this.accelY = accel; + this.boot(); } else { - this.accelX = GetValue(config, 'acceleration.x', 0); - this.accelY = GetValue(config, 'acceleration.y', 0); + game.events.once(GameEvents.BOOT, this.boot, this); } + }, - /** - * The horizontal drag applied to the camera when it is moving. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#dragX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.dragX = 0; + /** + * Run once the game has booted and installs all of the plugins configured in the Game Config. + * + * @method Phaser.Plugins.PluginManager#boot + * @protected + * @since 3.0.0 + */ + boot: function () + { + var i; + var entry; + var key; + var plugin; + var start; + var mapping; + var data; + var config = this.game.config; - /** - * The vertical drag applied to the camera when it is moving. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#dragY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.dragY = 0; + // Any plugins to install? + var list = config.installGlobalPlugins; - var drag = GetValue(config, 'drag', null); + // Any plugins added outside of the game config, but before the game booted? + list = list.concat(this._pendingGlobal); - if (typeof drag === 'number') - { - this.dragX = drag; - this.dragY = drag; - } - else + for (i = 0; i < list.length; i++) { - this.dragX = GetValue(config, 'drag.x', 0); - this.dragY = GetValue(config, 'drag.y', 0); - } + entry = list[i]; - /** - * The maximum horizontal speed the camera will move. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedX - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.maxSpeedX = 0; + // { key: 'TestPlugin', plugin: TestPlugin, start: true, mapping: 'test', data: { msg: 'The plugin is alive' } } - /** - * The maximum vertical speed the camera will move. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#maxSpeedY - * @type {number} - * @default 0 - * @since 3.0.0 - */ - this.maxSpeedY = 0; + key = GetFastValue(entry, 'key', null); + plugin = GetFastValue(entry, 'plugin', null); + start = GetFastValue(entry, 'start', false); + mapping = GetFastValue(entry, 'mapping', null); + data = GetFastValue(entry, 'data', null); - var maxSpeed = GetValue(config, 'maxSpeed', null); + if (key) + { + if (plugin) + { + this.install(key, plugin, start, mapping, data); + } + else + { + console.warn('Missing `plugin` for key: ' + key); + } - if (typeof maxSpeed === 'number') - { - this.maxSpeedX = maxSpeed; - this.maxSpeedY = maxSpeed; + } } - else + + // Any scene plugins to install? + list = config.installScenePlugins; + + // Any plugins added outside of the game config, but before the game booted? + list = list.concat(this._pendingScene); + + for (i = 0; i < list.length; i++) { - this.maxSpeedX = GetValue(config, 'maxSpeed.x', 0); - this.maxSpeedY = GetValue(config, 'maxSpeed.y', 0); - } + entry = list[i]; - /** - * Internal property to track the speed of the control. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedX - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._speedX = 0; + // { key: 'moveSpritePlugin', plugin: MoveSpritePlugin, , mapping: 'move' } - /** - * Internal property to track the speed of the control. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#_speedY - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._speedY = 0; + key = GetFastValue(entry, 'key', null); + plugin = GetFastValue(entry, 'plugin', null); + mapping = GetFastValue(entry, 'mapping', null); - /** - * Internal property to track the zoom of the control. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#_zoom - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._zoom = 0; + if (key) + { + if (plugin) + { + this.installScenePlugin(key, plugin, mapping); + } + else + { + console.warn('Missing `plugin` for key: ' + key); + } + } + } - /** - * A flag controlling if the Controls will update the Camera or not. - * - * @name Phaser.Cameras.Controls.SmoothedKeyControl#active - * @type {boolean} - * @since 3.0.0 - */ - this.active = (this.camera !== null); + this._pendingGlobal = []; + this._pendingScene = []; + + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** - * Starts the Key Control running, providing it has been linked to a camera. + * Called by the Scene Systems class. Tells the plugin manager to install all Scene plugins into it. * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#start - * @since 3.0.0 + * First it will install global references, i.e. references from the Game systems into the Scene Systems (and Scene if mapped.) + * Then it will install Core Scene Plugins followed by Scene Plugins registered with the PluginManager. + * Finally it will install any references to Global Plugins that have a Scene mapping property into the Scene itself. * - * @return {this} This Key Control instance. + * @method Phaser.Plugins.PluginManager#addToScene + * @protected + * @since 3.8.0 + * + * @param {Phaser.Scenes.Systems} sys - The Scene Systems class to install all the plugins in to. + * @param {array} globalPlugins - An array of global plugins to install. + * @param {array} scenePlugins - An array of scene plugins to install. */ - start: function () + addToScene: function (sys, globalPlugins, scenePlugins) { - this.active = (this.camera !== null); + var i; + var pluginKey; + var pluginList; + var game = this.game; + var scene = sys.scene; + var map = sys.settings.map; + var isBooted = sys.settings.isBooted; - return this; + // Reference the GlobalPlugins from Game into Scene.Systems + for (i = 0; i < globalPlugins.length; i++) + { + pluginKey = globalPlugins[i]; + + if (game[pluginKey]) + { + sys[pluginKey] = game[pluginKey]; + + // Scene level injection + if (map.hasOwnProperty(pluginKey)) + { + scene[map[pluginKey]] = sys[pluginKey]; + } + } + else if (pluginKey === 'game' && map.hasOwnProperty(pluginKey)) + { + scene[map[pluginKey]] = game; + } + } + + for (var s = 0; s < scenePlugins.length; s++) + { + pluginList = scenePlugins[s]; + + for (i = 0; i < pluginList.length; i++) + { + pluginKey = pluginList[i]; + + if (!PluginCache.hasCore(pluginKey)) + { + continue; + } + + var source = PluginCache.getCore(pluginKey); + + var mapKey = source.mapping; + + var plugin = new source.plugin(scene, this, mapKey); + + sys[mapKey] = plugin; + + // Scene level injection + if (source.custom) + { + scene[mapKey] = plugin; + } + else if (map.hasOwnProperty(mapKey)) + { + scene[map[mapKey]] = plugin; + } + + // Scene is already booted, usually because this method is being called at run-time, so boot the plugin + if (isBooted) + { + plugin.boot(); + } + } + } + + // And finally, inject any 'global scene plugins' + pluginList = this.plugins; + + for (i = 0; i < pluginList.length; i++) + { + var entry = pluginList[i]; + + if (entry.mapping) + { + scene[entry.mapping] = entry.plugin; + } + } }, /** - * Stops this Key Control from running. Call `start` to start it again. + * Called by the Scene Systems class. Returns a list of plugins to be installed. * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#stop - * @since 3.0.0 + * @method Phaser.Plugins.PluginManager#getDefaultScenePlugins + * @protected + * @since 3.8.0 * - * @return {this} This Key Control instance. + * @return {string[]} A list keys of all the Scene Plugins to install. */ - stop: function () + getDefaultScenePlugins: function () { - this.active = false; + var list = this.game.config.defaultPlugins; - return this; + // Merge in custom Scene plugins + list = list.concat(this.scenePlugins); + + return list; }, /** - * Binds this Key Control to a camera. + * Installs a new Scene Plugin into the Plugin Manager and optionally adds it + * to the given Scene as well. A Scene Plugin added to the manager in this way + * will be automatically installed into all new Scenes using the key and mapping given. * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#setCamera - * @since 3.0.0 + * The `key` property is what the plugin is injected into Scene.Systems as. + * The `mapping` property is optional, and if specified is what the plugin is installed into + * the Scene as. For example: * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to bind this Key Control to. + * ```javascript + * this.plugins.installScenePlugin('powerupsPlugin', pluginCode, 'powerups'); * - * @return {this} This Key Control instance. - */ - setCamera: function (camera) - { - this.camera = camera; - - return this; - }, - - /** - * Applies the results of pressing the control keys to the Camera. + * // and from within the scene: + * this.sys.powerupsPlugin; // key value + * this.powerups; // mapping value + * ``` * - * You must call this every step, it is not called automatically. + * This method is called automatically by Phaser if you install your plugins using either the + * Game Configuration object, or by preloading them via the Loader. * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#update - * @since 3.0.0 + * @method Phaser.Plugins.PluginManager#installScenePlugin + * @since 3.8.0 * - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * @param {string} key - The property key that will be used to add this plugin to Scene.Systems. + * @param {function} plugin - The plugin code. This should be the non-instantiated version. + * @param {string} [mapping] - If this plugin is injected into the Phaser.Scene class, this is the property key to use. + * @param {Phaser.Scene} [addToScene] - Optionally automatically add this plugin to the given Scene. + * @param {boolean} [fromLoader=false] - Is this being called by the Loader? */ - update: function (delta) + installScenePlugin: function (key, plugin, mapping, addToScene, fromLoader) { - if (!this.active) + if (fromLoader === undefined) { fromLoader = false; } + + if (typeof plugin !== 'function') { + console.warn('Invalid Scene Plugin: ' + key); return; } - if (delta === undefined) { delta = 1; } - - var cam = this.camera; - - // Apply Deceleration - - if (this._speedX > 0) - { - this._speedX -= this.dragX * delta; - - if (this._speedX < 0) - { - this._speedX = 0; - } - } - else if (this._speedX < 0) + if (!PluginCache.hasCore(key)) { - this._speedX += this.dragX * delta; - - if (this._speedX > 0) - { - this._speedX = 0; - } + // Plugin is freshly loaded + PluginCache.register(key, plugin, mapping, true); } - if (this._speedY > 0) + if (this.scenePlugins.indexOf(key) === -1) { - this._speedY -= this.dragY * delta; - - if (this._speedY < 0) - { - this._speedY = 0; - } + this.scenePlugins.push(key); } - else if (this._speedY < 0) + else if (!fromLoader && PluginCache.hasCore(key)) { - this._speedY += this.dragY * delta; - - if (this._speedY > 0) - { - this._speedY = 0; - } + // Plugin wasn't from the loader but already exists + console.warn('Scene Plugin key in use: ' + key); + return; } - // Check for keys - - if (this.up && this.up.isDown) + if (addToScene) { - this._speedY += this.accelY; + var instance = new plugin(addToScene, this, key); - if (this._speedY > this.maxSpeedY) - { - this._speedY = this.maxSpeedY; - } - } - else if (this.down && this.down.isDown) - { - this._speedY -= this.accelY; + addToScene.sys[key] = instance; - if (this._speedY < -this.maxSpeedY) + if (mapping && mapping !== '') { - this._speedY = -this.maxSpeedY; + addToScene[mapping] = instance; } + + instance.boot(); } + }, - if (this.left && this.left.isDown) - { - this._speedX += this.accelX; + /** + * Installs a new Global Plugin into the Plugin Manager and optionally starts it running. + * A global plugin belongs to the Plugin Manager, rather than a specific Scene, and can be accessed + * and used by all Scenes in your game. + * + * The `key` property is what you use to access this plugin from the Plugin Manager. + * + * ```javascript + * this.plugins.install('powerupsPlugin', pluginCode); + * + * // and from within the scene: + * this.plugins.get('powerupsPlugin'); + * ``` + * + * This method is called automatically by Phaser if you install your plugins using either the + * Game Configuration object, or by preloading them via the Loader. + * + * The same plugin can be installed multiple times into the Plugin Manager by simply giving each + * instance its own unique key. + * + * @method Phaser.Plugins.PluginManager#install + * @since 3.8.0 + * + * @param {string} key - The unique handle given to this plugin within the Plugin Manager. + * @param {function} plugin - The plugin code. This should be the non-instantiated version. + * @param {boolean} [start=false] - Automatically start the plugin running? This is always `true` if you provide a mapping value. + * @param {string} [mapping] - If this plugin is injected into the Phaser.Scene class, this is the property key to use. + * @param {any} [data] - A value passed to the plugin's `init` method. + * + * @return {?Phaser.Plugins.BasePlugin} The plugin that was started, or `null` if `start` was false, or game isn't yet booted. + */ + install: function (key, plugin, start, mapping, data) + { + if (start === undefined) { start = false; } + if (mapping === undefined) { mapping = null; } + if (data === undefined) { data = null; } - if (this._speedX > this.maxSpeedX) - { - this._speedX = this.maxSpeedX; - } - } - else if (this.right && this.right.isDown) + if (typeof plugin !== 'function') { - this._speedX -= this.accelX; - - if (this._speedX < -this.maxSpeedX) - { - this._speedX = -this.maxSpeedX; - } + console.warn('Invalid Plugin: ' + key); + return null; } - // Camera zoom + if (PluginCache.hasCustom(key)) + { + console.warn('Plugin key in use: ' + key); + return null; + } - if (this.zoomIn && this.zoomIn.isDown) + if (mapping !== null) { - this._zoom = -this.zoomSpeed; + start = true; } - else if (this.zoomOut && this.zoomOut.isDown) + + if (!this.game.isBooted) { - this._zoom = this.zoomSpeed; + this._pendingGlobal.push({ key: key, plugin: plugin, start: start, mapping: mapping, data: data }); } else { - this._zoom = 0; - } - - // Apply to Camera + // Add it to the plugin store + PluginCache.registerCustom(key, plugin, mapping, data); - if (this._speedX !== 0) - { - cam.scrollX -= ((this._speedX * delta) | 0); + if (start) + { + return this.start(key); + } } - if (this._speedY !== 0) - { - cam.scrollY -= ((this._speedY * delta) | 0); - } + return null; + }, - if (this._zoom !== 0) + /** + * Gets an index of a global plugin based on the given key. + * + * @method Phaser.Plugins.PluginManager#getIndex + * @protected + * @since 3.8.0 + * + * @param {string} key - The unique plugin key. + * + * @return {number} The index of the plugin within the plugins array. + */ + getIndex: function (key) + { + var list = this.plugins; + + for (var i = 0; i < list.length; i++) { - cam.zoom += this._zoom; + var entry = list[i]; - if (cam.zoom < this.minZoom) - { - cam.zoom = this.minZoom; - } - else if (cam.zoom > this.maxZoom) + if (entry.key === key) { - cam.zoom = this.maxZoom; + return i; } } + + return -1; }, /** - * Destroys this Key Control. + * Gets a global plugin based on the given key. * - * @method Phaser.Cameras.Controls.SmoothedKeyControl#destroy - * @since 3.0.0 + * @method Phaser.Plugins.PluginManager#getEntry + * @protected + * @since 3.8.0 + * + * @param {string} key - The unique plugin key. + * + * @return {Phaser.Types.Plugins.GlobalPlugin} The plugin entry. */ - destroy: function () + getEntry: function (key) { - this.camera = null; + var idx = this.getIndex(key); - this.left = null; - this.right = null; - this.up = null; - this.down = null; + if (idx !== -1) + { + return this.plugins[idx]; + } + }, - this.zoomIn = null; - this.zoomOut = null; - } + /** + * Checks if the given global plugin, based on its key, is active or not. + * + * @method Phaser.Plugins.PluginManager#isActive + * @since 3.8.0 + * + * @param {string} key - The unique plugin key. + * + * @return {boolean} `true` if the plugin is active, otherwise `false`. + */ + isActive: function (key) + { + var entry = this.getEntry(key); -}); + return (entry && entry.active); + }, -module.exports = SmoothedKeyControl; + /** + * Starts a global plugin running. + * + * If the plugin was previously active then calling `start` will reset it to an active state and then + * call its `start` method. + * + * If the plugin has never been run before a new instance of it will be created within the Plugin Manager, + * its active state set and then both of its `init` and `start` methods called, in that order. + * + * If the plugin is already running under the given key then nothing happens. + * + * @method Phaser.Plugins.PluginManager#start + * @since 3.8.0 + * + * @param {string} key - The key of the plugin to start. + * @param {string} [runAs] - Run the plugin under a new key. This allows you to run one plugin multiple times. + * + * @return {?Phaser.Plugins.BasePlugin} The plugin that was started, or `null` if invalid key given or plugin is already stopped. + */ + start: function (key, runAs) + { + if (runAs === undefined) { runAs = key; } + var entry = this.getEntry(runAs); -/***/ }), -/* 742 */ -/***/ (function(module, exports, __webpack_require__) { + // Plugin already running under this key? + if (entry && !entry.active) + { + // It exists, we just need to start it up again + entry.active = true; + entry.plugin.start(); + } + else if (!entry) + { + entry = this.createEntry(key, runAs); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return (entry) ? entry.plugin : null; + }, -/** - * @namespace Phaser.Cameras.Scene2D - */ + /** + * Creates a new instance of a global plugin, adds an entry into the plugins array and returns it. + * + * @method Phaser.Plugins.PluginManager#createEntry + * @private + * @since 3.9.0 + * + * @param {string} key - The key of the plugin to create an instance of. + * @param {string} [runAs] - Run the plugin under a new key. This allows you to run one plugin multiple times. + * + * @return {?Phaser.Plugins.BasePlugin} The plugin that was started, or `null` if invalid key given. + */ + createEntry: function (key, runAs) + { + var entry = PluginCache.getCustom(key); -module.exports = { + if (entry) + { + var instance = new entry.plugin(this); - Camera: __webpack_require__(326), - BaseCamera: __webpack_require__(133), - CameraManager: __webpack_require__(799), - Effects: __webpack_require__(333), - Events: __webpack_require__(37) + entry = { + key: runAs, + plugin: instance, + active: true, + mapping: entry.mapping, + data: entry.data + }; -}; + this.plugins.push(entry); + instance.init(entry.data); + instance.start(); + } -/***/ }), -/* 743 */ -/***/ (function(module, exports) { + return entry; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Stops a global plugin from running. + * + * If the plugin is active then its active state will be set to false and the plugins `stop` method + * will be called. + * + * If the plugin is not already running, nothing will happen. + * + * @method Phaser.Plugins.PluginManager#stop + * @since 3.8.0 + * + * @param {string} key - The key of the plugin to stop. + * + * @return {this} The Plugin Manager. + */ + stop: function (key) + { + var entry = this.getEntry(key); -/** - * The Destroy Camera Event. - * - * This event is dispatched by a Camera instance when it is destroyed by the Camera Manager. - * - * @event Phaser.Cameras.Scene2D.Events#DESTROY - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that was destroyed. - */ -module.exports = 'cameradestroy'; + if (entry && entry.active) + { + entry.active = false; + entry.plugin.stop(); + } + return this; + }, -/***/ }), -/* 744 */ -/***/ (function(module, exports) { + /** + * Gets a global plugin from the Plugin Manager based on the given key and returns it. + * + * If it cannot find an active plugin based on the key, but there is one in the Plugin Cache with the same key, + * then it will create a new instance of the cached plugin and return that. + * + * @method Phaser.Plugins.PluginManager#get + * @since 3.8.0 + * + * @param {string} key - The key of the plugin to get. + * @param {boolean} [autoStart=true] - Automatically start a new instance of the plugin if found in the cache, but not actively running. + * + * @return {?(Phaser.Plugins.BasePlugin|function)} The plugin, or `null` if no plugin was found matching the key. + */ + get: function (key, autoStart) + { + if (autoStart === undefined) { autoStart = true; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var entry = this.getEntry(key); -/** - * The Camera Fade In Complete Event. - * - * This event is dispatched by a Camera instance when the Fade In Effect completes. - * - * Listen to it from a Camera instance using `Camera.on('camerafadeincomplete', listener)`. - * - * @event Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE - * @since 3.3.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - */ -module.exports = 'camerafadeincomplete'; + if (entry) + { + return entry.plugin; + } + else + { + var plugin = this.getClass(key); + if (plugin && autoStart) + { + entry = this.createEntry(key, key); -/***/ }), -/* 745 */ -/***/ (function(module, exports) { + return (entry) ? entry.plugin : null; + } + else if (plugin) + { + return plugin; + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return null; + }, -/** - * The Camera Fade In Start Event. - * - * This event is dispatched by a Camera instance when the Fade In Effect starts. - * - * Listen to it from a Camera instance using `Camera.on('camerafadeinstart', listener)`. - * - * @event Phaser.Cameras.Scene2D.Events#FADE_IN_START - * @since 3.3.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {number} duration - The duration of the effect. - * @param {number} red - The red color channel value. - * @param {number} green - The green color channel value. - * @param {number} blue - The blue color channel value. - */ -module.exports = 'camerafadeinstart'; + /** + * Returns the plugin class from the cache. + * Used internally by the Plugin Manager. + * + * @method Phaser.Plugins.PluginManager#getClass + * @since 3.8.0 + * + * @param {string} key - The key of the plugin to get. + * + * @return {Phaser.Plugins.BasePlugin} A Plugin object + */ + getClass: function (key) + { + return PluginCache.getCustomClass(key); + }, + /** + * Removes a global plugin from the Plugin Manager and Plugin Cache. + * + * It is up to you to remove all references to this plugin that you may hold within your game code. + * + * @method Phaser.Plugins.PluginManager#removeGlobalPlugin + * @since 3.8.0 + * + * @param {string} key - The key of the plugin to remove. + */ + removeGlobalPlugin: function (key) + { + var entry = this.getEntry(key); -/***/ }), -/* 746 */ -/***/ (function(module, exports) { + if (entry) + { + Remove(this.plugins, entry); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + PluginCache.removeCustom(key); + }, -/** - * The Camera Fade Out Complete Event. - * - * This event is dispatched by a Camera instance when the Fade Out Effect completes. - * - * Listen to it from a Camera instance using `Camera.on('camerafadeoutcomplete', listener)`. - * - * @event Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE - * @since 3.3.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - */ -module.exports = 'camerafadeoutcomplete'; + /** + * Removes a scene plugin from the Plugin Manager and Plugin Cache. + * + * This will not remove the plugin from any active Scenes that are already using it. + * + * It is up to you to remove all references to this plugin that you may hold within your game code. + * + * @method Phaser.Plugins.PluginManager#removeScenePlugin + * @since 3.8.0 + * + * @param {string} key - The key of the plugin to remove. + */ + removeScenePlugin: function (key) + { + Remove(this.scenePlugins, key); + + PluginCache.remove(key); + }, + /** + * Registers a new type of Game Object with the global Game Object Factory and / or Creator. + * This is usually called from within your Plugin code and is a helpful short-cut for creating + * new Game Objects. + * + * The key is the property that will be injected into the factories and used to create the + * Game Object. For example: + * + * ```javascript + * this.plugins.registerGameObject('clown', clownFactoryCallback, clownCreatorCallback); + * // later in your game code: + * this.add.clown(); + * this.make.clown(); + * ``` + * + * The callbacks are what are called when the factories try to create a Game Object + * matching the given key. It's important to understand that the callbacks are invoked within + * the context of the GameObjectFactory. In this context there are several properties available + * to use: + * + * this.scene - A reference to the Scene that owns the GameObjectFactory. + * this.displayList - A reference to the Display List the Scene owns. + * this.updateList - A reference to the Update List the Scene owns. + * + * See the GameObjectFactory and GameObjectCreator classes for more details. + * Any public property or method listed is available from your callbacks under `this`. + * + * @method Phaser.Plugins.PluginManager#registerGameObject + * @since 3.8.0 + * + * @param {string} key - The key of the Game Object that the given callbacks will create, i.e. `image`, `sprite`. + * @param {function} [factoryCallback] - The callback to invoke when the Game Object Factory is called. + * @param {function} [creatorCallback] - The callback to invoke when the Game Object Creator is called. + */ + registerGameObject: function (key, factoryCallback, creatorCallback) + { + if (factoryCallback) + { + GameObjectFactory.register(key, factoryCallback); + } -/***/ }), -/* 747 */ -/***/ (function(module, exports) { + if (creatorCallback) + { + GameObjectCreator.register(key, creatorCallback); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -/** - * The Camera Fade Out Start Event. - * - * This event is dispatched by a Camera instance when the Fade Out Effect starts. - * - * Listen to it from a Camera instance using `Camera.on('camerafadeoutstart', listener)`. - * - * @event Phaser.Cameras.Scene2D.Events#FADE_OUT_START - * @since 3.3.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Fade} effect - A reference to the effect instance. - * @param {number} duration - The duration of the effect. - * @param {number} red - The red color channel value. - * @param {number} green - The green color channel value. - * @param {number} blue - The blue color channel value. - */ -module.exports = 'camerafadeoutstart'; + /** + * Removes a previously registered Game Object from the global Game Object Factory and / or Creator. + * This is usually called from within your Plugin destruction code to help clean-up after your plugin has been removed. + * + * @method Phaser.Plugins.PluginManager#removeGameObject + * @since 3.19.0 + * + * @param {string} key - The key of the Game Object to be removed from the factories. + * @param {boolean} [removeFromFactory=true] - Should the Game Object be removed from the Game Object Factory? + * @param {boolean} [removeFromCreator=true] - Should the Game Object be removed from the Game Object Creator? + */ + removeGameObject: function (key, removeFromFactory, removeFromCreator) + { + if (removeFromFactory === undefined) { removeFromFactory = true; } + if (removeFromCreator === undefined) { removeFromCreator = true; } + if (removeFromFactory) + { + GameObjectFactory.remove(key); + } -/***/ }), -/* 748 */ -/***/ (function(module, exports) { + if (removeFromCreator) + { + GameObjectCreator.remove(key); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -/** - * The Camera Flash Complete Event. - * - * This event is dispatched by a Camera instance when the Flash Effect completes. - * - * @event Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE - * @since 3.3.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. - */ -module.exports = 'cameraflashcomplete'; + /** + * Registers a new file type with the global File Types Manager, making it available to all Loader + * Plugins created after this. + * + * This is usually called from within your Plugin code and is a helpful short-cut for creating + * new loader file types. + * + * The key is the property that will be injected into the Loader Plugin and used to load the + * files. For example: + * + * ```javascript + * this.plugins.registerFileType('wad', doomWadLoaderCallback); + * // later in your preload code: + * this.load.wad(); + * ``` + * + * The callback is what is called when the loader tries to load a file matching the given key. + * It's important to understand that the callback is invoked within + * the context of the LoaderPlugin. In this context there are several properties / methods available + * to use: + * + * this.addFile - A method to add the new file to the load queue. + * this.scene - The Scene that owns the Loader Plugin instance. + * + * See the LoaderPlugin class for more details. Any public property or method listed is available from + * your callback under `this`. + * + * @method Phaser.Plugins.PluginManager#registerFileType + * @since 3.8.0 + * + * @param {string} key - The key of the Game Object that the given callbacks will create, i.e. `image`, `sprite`. + * @param {function} callback - The callback to invoke when the Game Object Factory is called. + * @param {Phaser.Scene} [addToScene] - Optionally add this file type into the Loader Plugin owned by the given Scene. + */ + registerFileType: function (key, callback, addToScene) + { + FileTypesManager.register(key, callback); + if (addToScene && addToScene.sys.load) + { + addToScene.sys.load[key] = callback; + } + }, -/***/ }), -/* 749 */ -/***/ (function(module, exports) { + /** + * Destroys this Plugin Manager and all associated plugins. + * It will iterate all plugins found and call their `destroy` methods. + * + * The PluginCache will remove all custom plugins. + * + * @method Phaser.Plugins.PluginManager#destroy + * @since 3.8.0 + */ + destroy: function () + { + for (var i = 0; i < this.plugins.length; i++) + { + this.plugins[i].plugin.destroy(); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + PluginCache.destroyCustomPlugins(); -/** - * The Camera Flash Start Event. - * - * This event is dispatched by a Camera instance when the Flash Effect starts. - * - * @event Phaser.Cameras.Scene2D.Events#FLASH_START - * @since 3.3.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Flash} effect - A reference to the effect instance. - * @param {number} duration - The duration of the effect. - * @param {number} red - The red color channel value. - * @param {number} green - The green color channel value. - * @param {number} blue - The blue color channel value. - */ -module.exports = 'cameraflashstart'; + if (this.game.noReturn) + { + PluginCache.destroyCorePlugins(); + } + this.game = null; + this.plugins = []; + this.scenePlugins = []; + } -/***/ }), -/* 750 */ -/***/ (function(module, exports) { +}); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} +/* + * "Sometimes, the elegant implementation is just a function. + * Not a method. Not a class. Not a framework. Just a function." + * -- John Carmack */ -/** - * The Camera Follower Update Event. - * - * This event is dispatched by a Camera instance when it is following a - * Game Object and the Camera position has been updated as a result of - * that following. - * - * Listen to it from a Camera instance using: `camera.on('followupdate', listener)`. - * - * @event Phaser.Cameras.Scene2D.Events#FOLLOW_UPDATE - * @since 3.50.0 - * - * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that emitted the event. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the camera is following. - */ -module.exports = 'followupdate'; +module.exports = PluginManager; /***/ }), -/* 751 */ -/***/ (function(module, exports) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +/***/ 39283: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * The Camera Pan Complete Event. - * - * This event is dispatched by a Camera instance when the Pan Effect completes. - * - * @event Phaser.Cameras.Scene2D.Events#PAN_COMPLETE - * @since 3.3.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. - */ -module.exports = 'camerapancomplete'; - - -/***/ }), -/* 752 */ -/***/ (function(module, exports) { +* @author Richard Davey +* @copyright 2013-2023 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} +*/ -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var BasePlugin = __webpack_require__(88257); +var Class = __webpack_require__(56694); +var SceneEvents = __webpack_require__(7599); /** - * The Camera Pan Start Event. - * - * This event is dispatched by a Camera instance when the Pan Effect starts. + * @classdesc + * A Scene Level Plugin is installed into every Scene and belongs to that Scene. + * It can listen for Scene events and respond to them. + * It can map itself to a Scene property, or into the Scene Systems, or both. * - * @event Phaser.Cameras.Scene2D.Events#PAN_START - * @since 3.3.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Pan} effect - A reference to the effect instance. - * @param {number} duration - The duration of the effect. - * @param {number} x - The destination scroll x coordinate. - * @param {number} y - The destination scroll y coordinate. - */ -module.exports = 'camerapanstart'; - - -/***/ }), -/* 753 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Camera Post-Render Event. - * - * This event is dispatched by a Camera instance after is has finished rendering. - * It is only dispatched if the Camera is rendering to a texture. - * - * Listen to it from a Camera instance using: `camera.on('postrender', listener)`. + * @class ScenePlugin + * @memberof Phaser.Plugins + * @extends Phaser.Plugins.BasePlugin + * @constructor + * @since 3.8.0 * - * @event Phaser.Cameras.Scene2D.Events#POST_RENDER - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that has finished rendering to a texture. + * @param {Phaser.Scene} scene - A reference to the Scene that has installed this plugin. + * @param {Phaser.Plugins.PluginManager} pluginManager - A reference to the Plugin Manager. + * @param {string} pluginKey - The key under which this plugin has been installed into the Scene Systems. */ -module.exports = 'postrender'; - +var ScenePlugin = new Class({ -/***/ }), -/* 754 */ -/***/ (function(module, exports) { + Extends: BasePlugin, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + initialize: -/** - * The Camera Pre-Render Event. - * - * This event is dispatched by a Camera instance when it is about to render. - * It is only dispatched if the Camera is rendering to a texture. - * - * Listen to it from a Camera instance using: `camera.on('prerender', listener)`. - * - * @event Phaser.Cameras.Scene2D.Events#PRE_RENDER - * @since 3.0.0 - * - * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that is about to render to a texture. - */ -module.exports = 'prerender'; + function ScenePlugin (scene, pluginManager, pluginKey) + { + BasePlugin.call(this, pluginManager); + /** + * A reference to the Scene that has installed this plugin. + * Only set if it's a Scene Plugin, otherwise `null`. + * This property is only set when the plugin is instantiated and added to the Scene, not before. + * You can use it during the `boot` method. + * + * @name Phaser.Plugins.ScenePlugin#scene + * @type {?Phaser.Scene} + * @protected + * @since 3.8.0 + */ + this.scene = scene; -/***/ }), -/* 755 */ -/***/ (function(module, exports) { + /** + * A reference to the Scene Systems of the Scene that has installed this plugin. + * Only set if it's a Scene Plugin, otherwise `null`. + * This property is only set when the plugin is instantiated and added to the Scene, not before. + * You can use it during the `boot` method. + * + * @name Phaser.Plugins.ScenePlugin#systems + * @type {?Phaser.Scenes.Systems} + * @protected + * @since 3.8.0 + */ + this.systems = scene.sys; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The key under which this plugin was installed into the Scene Systems. + * + * This property is only set when the plugin is instantiated and added to the Scene, not before. + * You can use it during the `boot` method. + * + * @name Phaser.Plugins.ScenePlugin#pluginKey + * @type {string} + * @readonly + * @since 3.54.0 + */ + this.pluginKey = pluginKey; -/** - * The Camera Rotate Complete Event. - * - * This event is dispatched by a Camera instance when the Rotate Effect completes. - * - * @event Phaser.Cameras.Scene2D.Events#ROTATE_COMPLETE - * @since 3.23.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.RotateTo} effect - A reference to the effect instance. - */ -module.exports = 'camerarotatecomplete'; + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + }, + /** + * This method is called when the Scene boots. It is only ever called once. + * + * By this point the plugin properties `scene` and `systems` will have already been set. + * + * In here you can listen for {@link Phaser.Scenes.Events Scene events} and set-up whatever you need for this plugin to run. + * Here are the Scene events you can listen to: + * + * - start + * - ready + * - preupdate + * - update + * - postupdate + * - resize + * - pause + * - resume + * - sleep + * - wake + * - transitioninit + * - transitionstart + * - transitioncomplete + * - transitionout + * - shutdown + * - destroy + * + * At the very least you should offer a destroy handler for when the Scene closes down, i.e: + * + * ```javascript + * var eventEmitter = this.systems.events; + * eventEmitter.once('destroy', this.sceneDestroy, this); + * ``` + * + * @method Phaser.Plugins.ScenePlugin#boot + * @since 3.8.0 + */ + boot: function () + { + }, -/***/ }), -/* 756 */ -/***/ (function(module, exports) { + /** + * Game instance has been destroyed. + * + * You must release everything in here, all references, all objects, free it all up. + * + * @method Phaser.Plugins.ScenePlugin#destroy + * @since 3.8.0 + */ + destroy: function () + { + this.pluginManager = null; + this.game = null; + this.scene = null; + this.systems = null; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +}); -/** - * The Camera Rotate Start Event. - * - * This event is dispatched by a Camera instance when the Rotate Effect starts. - * - * @event Phaser.Cameras.Scene2D.Events#ROTATE_START - * @since 3.23.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.RotateTo} effect - A reference to the effect instance. - * @param {number} duration - The duration of the effect. - * @param {number} destination - The destination value. - */ -module.exports = 'camerarotatestart'; +module.exports = ScenePlugin; /***/ }), -/* 757 */ -/***/ (function(module, exports) { + +/***/ 45615: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Camera Shake Complete Event. - * - * This event is dispatched by a Camera instance when the Shake Effect completes. - * - * @event Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE - * @since 3.3.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. + * @namespace Phaser.Plugins */ -module.exports = 'camerashakecomplete'; +module.exports = { -/***/ }), -/* 758 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + BasePlugin: __webpack_require__(88257), + DefaultPlugins: __webpack_require__(18360), + PluginCache: __webpack_require__(91963), + PluginManager: __webpack_require__(49274), + ScenePlugin: __webpack_require__(39283) -/** - * The Camera Shake Start Event. - * - * This event is dispatched by a Camera instance when the Shake Effect starts. - * - * @event Phaser.Cameras.Scene2D.Events#SHAKE_START - * @since 3.3.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Shake} effect - A reference to the effect instance. - * @param {number} duration - The duration of the effect. - * @param {number} intensity - The intensity of the effect. - */ -module.exports = 'camerashakestart'; +}; /***/ }), -/* 759 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Camera Zoom Complete Event. - * - * This event is dispatched by a Camera instance when the Zoom Effect completes. - * - * @event Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE - * @since 3.3.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. - */ -module.exports = 'camerazoomcomplete'; +/***/ 75205: +/***/ (() => { -/***/ }), -/* 760 */ -/***/ (function(module, exports) { +// From https://github.com/ThaUnknown/rvfc-polyfill -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +if (!('requestVideoFrameCallback' in HTMLVideoElement.prototype) && 'getVideoPlaybackQuality' in HTMLVideoElement.prototype) +{ + HTMLVideoElement.prototype._rvfcpolyfillmap = {} + HTMLVideoElement.prototype.requestVideoFrameCallback = function (callback) { + const handle = performance.now() + const quality = this.getVideoPlaybackQuality() + const baseline = this.mozPresentedFrames || this.mozPaintedFrames || quality.totalVideoFrames - quality.droppedVideoFrames + + const check = (old, now) => { + const newquality = this.getVideoPlaybackQuality() + const presentedFrames = this.mozPresentedFrames || this.mozPaintedFrames || newquality.totalVideoFrames - newquality.droppedVideoFrames + if (presentedFrames > baseline) { + const processingDuration = this.mozFrameDelay || (newquality.totalFrameDelay - quality.totalFrameDelay) || 0 + const timediff = now - old // HighRes diff + callback(now, { + presentationTime: now + processingDuration * 1000, + expectedDisplayTime: now + timediff, + width: this.videoWidth, + height: this.videoHeight, + mediaTime: Math.max(0, this.currentTime || 0) + timediff / 1000, + presentedFrames, + processingDuration + }) + delete this._rvfcpolyfillmap[handle] + } else { + this._rvfcpolyfillmap[handle] = requestAnimationFrame(newer => check(now, newer)) + } + } + this._rvfcpolyfillmap[handle] = requestAnimationFrame(newer => check(handle, newer)) + return handle + } -/** - * The Camera Zoom Start Event. - * - * This event is dispatched by a Camera instance when the Zoom Effect starts. - * - * @event Phaser.Cameras.Scene2D.Events#ZOOM_START - * @since 3.3.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that the effect began on. - * @param {Phaser.Cameras.Scene2D.Effects.Zoom} effect - A reference to the effect instance. - * @param {number} duration - The duration of the effect. - * @param {number} zoom - The destination zoom value. - */ -module.exports = 'camerazoomstart'; + HTMLVideoElement.prototype.cancelVideoFrameCallback = function (handle) { + cancelAnimationFrame(this._rvfcpolyfillmap[handle]) + delete this._rvfcpolyfillmap[handle] + } +} /***/ }), -/* 761 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 95723: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(18); -var Class = __webpack_require__(0); -var Events = __webpack_require__(37); - /** - * @classdesc - * A Camera Fade effect. - * - * This effect will fade the camera viewport to the given color, over the duration specified. - * - * Only the camera viewport is faded. None of the objects it is displaying are impacted, i.e. their colors do - * not change. - * - * The effect will dispatch several events on the Camera itself and you can also specify an `onUpdate` callback, - * which is invoked each frame for the duration of the effect, if required. - * - * @class Fade - * @memberof Phaser.Cameras.Scene2D.Effects - * @constructor - * @since 3.5.0 + * Phaser Blend Modes. * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera this effect is acting upon. + * @namespace Phaser.BlendModes + * @since 3.0.0 */ -var Fade = new Class({ - - initialize: - - function Fade (camera) - { - /** - * The Camera this effect belongs to. - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#camera - * @type {Phaser.Cameras.Scene2D.Camera} - * @readonly - * @since 3.5.0 - */ - this.camera = camera; - - /** - * Is this effect actively running? - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#isRunning - * @type {boolean} - * @readonly - * @default false - * @since 3.5.0 - */ - this.isRunning = false; - - /** - * Has this effect finished running? - * - * This is different from `isRunning` because it remains set to `true` when the effect is over, - * until the effect is either reset or started again. - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#isComplete - * @type {boolean} - * @readonly - * @default false - * @since 3.5.0 - */ - this.isComplete = false; - - /** - * The direction of the fade. - * `true` = fade out (transparent to color), `false` = fade in (color to transparent) - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#direction - * @type {boolean} - * @readonly - * @since 3.5.0 - */ - this.direction = true; - - /** - * The duration of the effect, in milliseconds. - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#duration - * @type {number} - * @readonly - * @default 0 - * @since 3.5.0 - */ - this.duration = 0; - - /** - * The value of the red color channel the camera will use for the fade effect. - * A value between 0 and 255. - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#red - * @type {number} - * @private - * @since 3.5.0 - */ - this.red = 0; - - /** - * The value of the green color channel the camera will use for the fade effect. - * A value between 0 and 255. - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#green - * @type {number} - * @private - * @since 3.5.0 - */ - this.green = 0; - - /** - * The value of the blue color channel the camera will use for the fade effect. - * A value between 0 and 255. - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#blue - * @type {number} - * @private - * @since 3.5.0 - */ - this.blue = 0; - - /** - * The value of the alpha channel used during the fade effect. - * A value between 0 and 1. - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#alpha - * @type {number} - * @private - * @since 3.5.0 - */ - this.alpha = 0; - - /** - * If this effect is running this holds the current percentage of the progress, a value between 0 and 1. - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#progress - * @type {number} - * @since 3.5.0 - */ - this.progress = 0; - - /** - * Effect elapsed timer. - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#_elapsed - * @type {number} - * @private - * @since 3.5.0 - */ - this._elapsed = 0; - - /** - * This callback is invoked every frame for the duration of the effect. - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#_onUpdate - * @type {?Phaser.Types.Cameras.Scene2D.CameraFadeCallback} - * @private - * @default null - * @since 3.5.0 - */ - this._onUpdate; - /** - * On Complete callback scope. - * - * @name Phaser.Cameras.Scene2D.Effects.Fade#_onUpdateScope - * @type {any} - * @private - * @since 3.5.0 - */ - this._onUpdateScope; - }, +module.exports = { /** - * Fades the Camera to or from the given color over the duration specified. - * - * @method Phaser.Cameras.Scene2D.Effects.Fade#start - * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_START - * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_START - * @since 3.5.0 + * Skips the Blend Mode check in the renderer. * - * @param {boolean} [direction=true] - The direction of the fade. `true` = fade out (transparent to color), `false` = fade in (color to transparent) - * @param {number} [duration=1000] - The duration of the effect in milliseconds. - * @param {number} [red=0] - The amount to fade the red channel towards. A value between 0 and 255. - * @param {number} [green=0] - The amount to fade the green channel towards. A value between 0 and 255. - * @param {number} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255. - * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. - * @param {Phaser.Types.Cameras.Scene2D.CameraFadeCallback} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * @name Phaser.BlendModes.SKIP_CHECK + * @type {number} + * @const + * @since 3.0.0 + */ + SKIP_CHECK: -1, + + /** + * Normal blend mode. For Canvas and WebGL. + * This is the default setting and draws new shapes on top of the existing canvas content. * - * @return {Phaser.Cameras.Scene2D.Camera} The Camera on which the effect was started. + * @name Phaser.BlendModes.NORMAL + * @type {number} + * @const + * @since 3.0.0 */ - start: function (direction, duration, red, green, blue, force, callback, context) - { - if (direction === undefined) { direction = true; } - if (duration === undefined) { duration = 1000; } - if (red === undefined) { red = 0; } - if (green === undefined) { green = 0; } - if (blue === undefined) { blue = 0; } - if (force === undefined) { force = false; } - if (callback === undefined) { callback = null; } - if (context === undefined) { context = this.camera.scene; } + NORMAL: 0, - if (!force && this.isRunning) - { - return this.camera; - } + /** + * Add blend mode. For Canvas and WebGL. + * Where both shapes overlap the color is determined by adding color values. + * + * @name Phaser.BlendModes.ADD + * @type {number} + * @const + * @since 3.0.0 + */ + ADD: 1, - this.isRunning = true; - this.isComplete = false; - this.duration = duration; - this.direction = direction; - this.progress = 0; + /** + * Multiply blend mode. For Canvas and WebGL. + * The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result. + * + * @name Phaser.BlendModes.MULTIPLY + * @type {number} + * @const + * @since 3.0.0 + */ + MULTIPLY: 2, - this.red = red; - this.green = green; - this.blue = blue; - this.alpha = (direction) ? Number.MIN_VALUE : 1; + /** + * Screen blend mode. For Canvas and WebGL. + * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) + * + * @name Phaser.BlendModes.SCREEN + * @type {number} + * @const + * @since 3.0.0 + */ + SCREEN: 3, - this._elapsed = 0; + /** + * Overlay blend mode. For Canvas only. + * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter. + * + * @name Phaser.BlendModes.OVERLAY + * @type {number} + * @const + * @since 3.0.0 + */ + OVERLAY: 4, - this._onUpdate = callback; - this._onUpdateScope = context; + /** + * Darken blend mode. For Canvas only. + * Retains the darkest pixels of both layers. + * + * @name Phaser.BlendModes.DARKEN + * @type {number} + * @const + * @since 3.0.0 + */ + DARKEN: 5, - var eventName = (direction) ? Events.FADE_OUT_START : Events.FADE_IN_START; + /** + * Lighten blend mode. For Canvas only. + * Retains the lightest pixels of both layers. + * + * @name Phaser.BlendModes.LIGHTEN + * @type {number} + * @const + * @since 3.0.0 + */ + LIGHTEN: 6, - this.camera.emit(eventName, this.camera, this, duration, red, green, blue); + /** + * Color Dodge blend mode. For Canvas only. + * Divides the bottom layer by the inverted top layer. + * + * @name Phaser.BlendModes.COLOR_DODGE + * @type {number} + * @const + * @since 3.0.0 + */ + COLOR_DODGE: 7, - return this.camera; - }, + /** + * Color Burn blend mode. For Canvas only. + * Divides the inverted bottom layer by the top layer, and then inverts the result. + * + * @name Phaser.BlendModes.COLOR_BURN + * @type {number} + * @const + * @since 3.0.0 + */ + COLOR_BURN: 8, /** - * The main update loop for this effect. Called automatically by the Camera. + * Hard Light blend mode. For Canvas only. + * A combination of multiply and screen like overlay, but with top and bottom layer swapped. * - * @method Phaser.Cameras.Scene2D.Effects.Fade#update - * @since 3.5.0 + * @name Phaser.BlendModes.HARD_LIGHT + * @type {number} + * @const + * @since 3.0.0 + */ + HARD_LIGHT: 9, + + /** + * Soft Light blend mode. For Canvas only. + * A softer version of hard-light. Pure black or white does not result in pure black or white. * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @name Phaser.BlendModes.SOFT_LIGHT + * @type {number} + * @const + * @since 3.0.0 */ - update: function (time, delta) - { - if (!this.isRunning) - { - return; - } + SOFT_LIGHT: 10, - this._elapsed += delta; + /** + * Difference blend mode. For Canvas only. + * Subtracts the bottom layer from the top layer or the other way round to always get a positive value. + * + * @name Phaser.BlendModes.DIFFERENCE + * @type {number} + * @const + * @since 3.0.0 + */ + DIFFERENCE: 11, - this.progress = Clamp(this._elapsed / this.duration, 0, 1); + /** + * Exclusion blend mode. For Canvas only. + * Like difference, but with lower contrast. + * + * @name Phaser.BlendModes.EXCLUSION + * @type {number} + * @const + * @since 3.0.0 + */ + EXCLUSION: 12, - if (this._onUpdate) - { - this._onUpdate.call(this._onUpdateScope, this.camera, this.progress); - } + /** + * Hue blend mode. For Canvas only. + * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer. + * + * @name Phaser.BlendModes.HUE + * @type {number} + * @const + * @since 3.0.0 + */ + HUE: 13, - if (this._elapsed < this.duration) - { - this.alpha = (this.direction) ? this.progress : 1 - this.progress; - } - else - { - this.alpha = (this.direction) ? 1 : 0; - this.effectComplete(); - } - }, + /** + * Saturation blend mode. For Canvas only. + * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer. + * + * @name Phaser.BlendModes.SATURATION + * @type {number} + * @const + * @since 3.0.0 + */ + SATURATION: 14, /** - * Called internally by the Canvas Renderer. + * Color blend mode. For Canvas only. + * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer. * - * @method Phaser.Cameras.Scene2D.Effects.Fade#postRenderCanvas - * @since 3.5.0 + * @name Phaser.BlendModes.COLOR + * @type {number} + * @const + * @since 3.0.0 + */ + COLOR: 15, + + /** + * Luminosity blend mode. For Canvas only. + * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer. * - * @param {CanvasRenderingContext2D} ctx - The Canvas context to render to. + * @name Phaser.BlendModes.LUMINOSITY + * @type {number} + * @const + * @since 3.0.0 + */ + LUMINOSITY: 16, + + /** + * Alpha erase blend mode. For Canvas and WebGL. * - * @return {boolean} `true` if the effect drew to the renderer, otherwise `false`. + * @name Phaser.BlendModes.ERASE + * @type {number} + * @const + * @since 3.0.0 */ - postRenderCanvas: function (ctx) - { - if (!this.isRunning && !this.isComplete) - { - return false; - } + ERASE: 17, - var camera = this.camera; + /** + * Source-in blend mode. For Canvas only. + * The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent. + * + * @name Phaser.BlendModes.SOURCE_IN + * @type {number} + * @const + * @since 3.0.0 + */ + SOURCE_IN: 18, - ctx.fillStyle = 'rgba(' + this.red + ',' + this.green + ',' + this.blue + ',' + this.alpha + ')'; - ctx.fillRect(camera.x, camera.y, camera.width, camera.height); + /** + * Source-out blend mode. For Canvas only. + * The new shape is drawn where it doesn't overlap the existing canvas content. + * + * @name Phaser.BlendModes.SOURCE_OUT + * @type {number} + * @const + * @since 3.0.0 + */ + SOURCE_OUT: 19, - return true; - }, + /** + * Source-out blend mode. For Canvas only. + * The new shape is only drawn where it overlaps the existing canvas content. + * + * @name Phaser.BlendModes.SOURCE_ATOP + * @type {number} + * @const + * @since 3.0.0 + */ + SOURCE_ATOP: 20, /** - * Called internally by the WebGL Renderer. + * Destination-over blend mode. For Canvas only. + * New shapes are drawn behind the existing canvas content. * - * @method Phaser.Cameras.Scene2D.Effects.Fade#postRenderWebGL - * @since 3.5.0 + * @name Phaser.BlendModes.DESTINATION_OVER + * @type {number} + * @const + * @since 3.0.0 + */ + DESTINATION_OVER: 21, + + /** + * Destination-in blend mode. For Canvas only. + * The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent. * - * @param {Phaser.Renderer.WebGL.Pipelines.MultiPipeline} pipeline - The WebGL Pipeline to render to. Must provide the `drawFillRect` method. - * @param {function} getTintFunction - A function that will return the gl safe tint colors. + * @name Phaser.BlendModes.DESTINATION_IN + * @type {number} + * @const + * @since 3.0.0 + */ + DESTINATION_IN: 22, + + /** + * Destination-out blend mode. For Canvas only. + * The existing content is kept where it doesn't overlap the new shape. * - * @return {boolean} `true` if the effect drew to the renderer, otherwise `false`. + * @name Phaser.BlendModes.DESTINATION_OUT + * @type {number} + * @const + * @since 3.0.0 */ - postRenderWebGL: function (pipeline, getTintFunction) - { - if (!this.isRunning && !this.isComplete) - { - return false; - } + DESTINATION_OUT: 23, - var camera = this.camera; - var red = this.red / 255; - var green = this.green / 255; - var blue = this.blue / 255; + /** + * Destination-out blend mode. For Canvas only. + * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content. + * + * @name Phaser.BlendModes.DESTINATION_ATOP + * @type {number} + * @const + * @since 3.0.0 + */ + DESTINATION_ATOP: 24, - pipeline.drawFillRect( - camera.x, camera.y, camera.width, camera.height, - getTintFunction(blue, green, red, 1), - this.alpha - ); + /** + * Lighten blend mode. For Canvas only. + * Where both shapes overlap the color is determined by adding color values. + * + * @name Phaser.BlendModes.LIGHTER + * @type {number} + * @const + * @since 3.0.0 + */ + LIGHTER: 25, - return true; - }, + /** + * Copy blend mode. For Canvas only. + * Only the new shape is shown. + * + * @name Phaser.BlendModes.COPY + * @type {number} + * @const + * @since 3.0.0 + */ + COPY: 26, /** - * Called internally when the effect completes. + * Xor blend mode. For Canvas only. + * Shapes are made transparent where both overlap and drawn normal everywhere else. * - * @method Phaser.Cameras.Scene2D.Effects.Fade#effectComplete - * @fires Phaser.Cameras.Scene2D.Events#FADE_IN_COMPLETE - * @fires Phaser.Cameras.Scene2D.Events#FADE_OUT_COMPLETE - * @since 3.5.0 + * @name Phaser.BlendModes.XOR + * @type {number} + * @const + * @since 3.0.0 */ - effectComplete: function () - { - this._onUpdate = null; - this._onUpdateScope = null; + XOR: 27 - this.isRunning = false; - this.isComplete = true; +}; - var eventName = (this.direction) ? Events.FADE_OUT_COMPLETE : Events.FADE_IN_COMPLETE; - this.camera.emit(eventName, this.camera, this); - }, +/***/ }), + +/***/ 27394: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Phaser Scale Modes. + * + * @namespace Phaser.ScaleModes + * @since 3.0.0 + */ + +var ScaleModes = { /** - * Resets this camera effect. - * If it was previously running, it stops instantly without calling its onComplete callback or emitting an event. + * Default Scale Mode (Linear). * - * @method Phaser.Cameras.Scene2D.Effects.Fade#reset - * @since 3.5.0 + * @name Phaser.ScaleModes.DEFAULT + * @type {number} + * @readonly + * @since 3.0.0 */ - reset: function () - { - this.isRunning = false; - this.isComplete = false; - - this._onUpdate = null; - this._onUpdateScope = null; - }, + DEFAULT: 0, /** - * Destroys this effect, releasing it from the Camera. + * Linear Scale Mode. * - * @method Phaser.Cameras.Scene2D.Effects.Fade#destroy - * @since 3.5.0 + * @name Phaser.ScaleModes.LINEAR + * @type {number} + * @readonly + * @since 3.0.0 */ - destroy: function () - { - this.reset(); + LINEAR: 0, - this.camera = null; - } + /** + * Nearest Scale Mode. + * + * @name Phaser.ScaleModes.NEAREST + * @type {number} + * @readonly + * @since 3.0.0 + */ + NEAREST: 1 -}); +}; -module.exports = Fade; +module.exports = ScaleModes; /***/ }), -/* 762 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 91135: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(18); -var Class = __webpack_require__(0); -var Events = __webpack_require__(37); +var CameraEvents = __webpack_require__(89787); +var CanvasSnapshot = __webpack_require__(61840); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(86459); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(81044); +var GetBlendModes = __webpack_require__(32834); +var ScaleEvents = __webpack_require__(40444); +var TextureEvents = __webpack_require__(38203); +var TransformMatrix = __webpack_require__(69360); /** * @classdesc - * A Camera Flash effect. - * - * This effect will flash the camera viewport to the given color, over the duration specified. - * - * Only the camera viewport is flashed. None of the objects it is displaying are impacted, i.e. their colors do - * not change. - * - * The effect will dispatch several events on the Camera itself and you can also specify an `onUpdate` callback, - * which is invoked each frame for the duration of the effect, if required. + * The Canvas Renderer is responsible for managing 2D canvas rendering contexts, + * including the one used by the Games canvas. It tracks the internal state of a + * given context and can renderer textured Game Objects to it, taking into + * account alpha, blending, and scaling. * - * @class Flash - * @memberof Phaser.Cameras.Scene2D.Effects + * @class CanvasRenderer + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Renderer.Canvas * @constructor - * @since 3.5.0 + * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera this effect is acting upon. + * @param {Phaser.Game} game - The Phaser Game instance that owns this renderer. */ -var Flash = new Class({ +var CanvasRenderer = new Class({ + + Extends: EventEmitter, initialize: - function Flash (camera) + function CanvasRenderer (game) { + EventEmitter.call(this); + + var gameConfig = game.config; + /** - * The Camera this effect belongs to. + * The local configuration settings of the CanvasRenderer. * - * @name Phaser.Cameras.Scene2D.Effects.Flash#camera - * @type {Phaser.Cameras.Scene2D.Camera} - * @readonly - * @since 3.5.0 + * @name Phaser.Renderer.Canvas.CanvasRenderer#config + * @type {object} + * @since 3.0.0 */ - this.camera = camera; + this.config = { + clearBeforeRender: gameConfig.clearBeforeRender, + backgroundColor: gameConfig.backgroundColor, + antialias: gameConfig.antialias, + roundPixels: gameConfig.roundPixels + }; /** - * Is this effect actively running? + * The Phaser Game instance that owns this renderer. * - * @name Phaser.Cameras.Scene2D.Effects.Flash#isRunning - * @type {boolean} - * @readonly - * @default false - * @since 3.5.0 + * @name Phaser.Renderer.Canvas.CanvasRenderer#game + * @type {Phaser.Game} + * @since 3.0.0 */ - this.isRunning = false; + this.game = game; /** - * The duration of the effect, in milliseconds. + * A constant which allows the renderer to be easily identified as a Canvas Renderer. * - * @name Phaser.Cameras.Scene2D.Effects.Flash#duration + * @name Phaser.Renderer.Canvas.CanvasRenderer#type * @type {number} - * @readonly - * @default 0 - * @since 3.5.0 + * @since 3.0.0 */ - this.duration = 0; + this.type = CONST.CANVAS; /** - * The value of the red color channel the camera will use for the flash effect. - * A value between 0 and 255. + * The total number of Game Objects which were rendered in a frame. * - * @name Phaser.Cameras.Scene2D.Effects.Flash#red + * @name Phaser.Renderer.Canvas.CanvasRenderer#drawCount * @type {number} - * @private - * @since 3.5.0 + * @default 0 + * @since 3.0.0 */ - this.red = 0; + this.drawCount = 0; /** - * The value of the green color channel the camera will use for the flash effect. - * A value between 0 and 255. + * The width of the canvas being rendered to. * - * @name Phaser.Cameras.Scene2D.Effects.Flash#green + * @name Phaser.Renderer.Canvas.CanvasRenderer#width * @type {number} - * @private - * @since 3.5.0 + * @since 3.0.0 */ - this.green = 0; + this.width = 0; /** - * The value of the blue color channel the camera will use for the flash effect. - * A value between 0 and 255. + * The height of the canvas being rendered to. * - * @name Phaser.Cameras.Scene2D.Effects.Flash#blue + * @name Phaser.Renderer.Canvas.CanvasRenderer#height * @type {number} - * @private - * @since 3.5.0 + * @since 3.0.0 */ - this.blue = 0; + this.height = 0; /** - * The value of the alpha channel used during the flash effect. - * A value between 0 and 1. + * The canvas element which the Game uses. * - * @name Phaser.Cameras.Scene2D.Effects.Flash#alpha - * @type {number} - * @private - * @since 3.5.0 + * @name Phaser.Renderer.Canvas.CanvasRenderer#gameCanvas + * @type {HTMLCanvasElement} + * @since 3.0.0 */ - this.alpha = 0; + this.gameCanvas = game.canvas; + + var contextOptions = { + alpha: game.config.transparent, + desynchronized: game.config.desynchronized, + willReadFrequently: false + }; /** - * If this effect is running this holds the current percentage of the progress, a value between 0 and 1. + * The canvas context used to render all Cameras in all Scenes during the game loop. * - * @name Phaser.Cameras.Scene2D.Effects.Flash#progress - * @type {number} - * @since 3.5.0 + * @name Phaser.Renderer.Canvas.CanvasRenderer#gameContext + * @type {CanvasRenderingContext2D} + * @since 3.0.0 */ - this.progress = 0; + this.gameContext = (gameConfig.context) ? gameConfig.context : this.gameCanvas.getContext('2d', contextOptions); /** - * Effect elapsed timer. + * The canvas context currently used by the CanvasRenderer for all rendering operations. * - * @name Phaser.Cameras.Scene2D.Effects.Flash#_elapsed - * @type {number} + * @name Phaser.Renderer.Canvas.CanvasRenderer#currentContext + * @type {CanvasRenderingContext2D} + * @since 3.0.0 + */ + this.currentContext = this.gameContext; + + /** + * Should the Canvas use Image Smoothing or not when drawing Sprites? + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#antialias + * @type {boolean} + * @since 3.20.0 + */ + this.antialias = game.config.antialias; + + /** + * The blend modes supported by the Canvas Renderer. + * + * This object maps the {@link Phaser.BlendModes} to canvas compositing operations. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#blendModes + * @type {array} + * @since 3.0.0 + */ + this.blendModes = GetBlendModes(); + + /** + * Details about the currently scheduled snapshot. + * + * If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotState + * @type {Phaser.Types.Renderer.Snapshot.SnapshotState} + * @since 3.16.0 + */ + this.snapshotState = { + x: 0, + y: 0, + width: 1, + height: 1, + getPixel: false, + callback: null, + type: 'image/png', + encoder: 0.92 + }; + + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix1 * @private - * @since 3.5.0 + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 */ - this._elapsed = 0; + this._tempMatrix1 = new TransformMatrix(); /** - * This callback is invoked every frame for the duration of the effect. + * A temporary Transform Matrix, re-used internally during batching. * - * @name Phaser.Cameras.Scene2D.Effects.Flash#_onUpdate - * @type {?Phaser.Types.Cameras.Scene2D.CameraFlashCallback} + * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix2 * @private - * @default null - * @since 3.5.0 + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 */ - this._onUpdate; + this._tempMatrix2 = new TransformMatrix(); /** - * On Complete callback scope. + * A temporary Transform Matrix, re-used internally during batching. * - * @name Phaser.Cameras.Scene2D.Effects.Flash#_onUpdateScope - * @type {any} + * @name Phaser.Renderer.Canvas.CanvasRenderer#_tempMatrix3 * @private - * @since 3.5.0 + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 */ - this._onUpdateScope; + this._tempMatrix3 = new TransformMatrix(); + + /** + * Has this renderer fully booted yet? + * + * @name Phaser.Renderer.Canvas.CanvasRenderer#isBooted + * @type {boolean} + * @since 3.50.0 + */ + this.isBooted = false; + + this.init(); }, /** - * Flashes the Camera to or from the given color over the duration specified. - * - * @method Phaser.Cameras.Scene2D.Effects.Flash#start - * @fires Phaser.Cameras.Scene2D.Events#FLASH_START - * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE - * @since 3.5.0 - * - * @param {number} [duration=250] - The duration of the effect in milliseconds. - * @param {number} [red=255] - The amount to flash the red channel towards. A value between 0 and 255. - * @param {number} [green=255] - The amount to flash the green channel towards. A value between 0 and 255. - * @param {number} [blue=255] - The amount to flash the blue channel towards. A value between 0 and 255. - * @param {boolean} [force=false] - Force the effect to start immediately, even if already running. - * @param {Phaser.Types.Cameras.Scene2D.CameraFlashCallback} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * Prepares the game canvas for rendering. * - * @return {Phaser.Cameras.Scene2D.Camera} The Camera on which the effect was started. + * @method Phaser.Renderer.Canvas.CanvasRenderer#init + * @since 3.0.0 */ - start: function (duration, red, green, blue, force, callback, context) + init: function () { - if (duration === undefined) { duration = 250; } - if (red === undefined) { red = 255; } - if (green === undefined) { green = 255; } - if (blue === undefined) { blue = 255; } - if (force === undefined) { force = false; } - if (callback === undefined) { callback = null; } - if (context === undefined) { context = this.camera.scene; } - - if (!force && this.isRunning) - { - return this.camera; - } - - this.isRunning = true; - this.duration = duration; - this.progress = 0; - - this.red = red; - this.green = green; - this.blue = blue; - this.alpha = 1; - - this._elapsed = 0; - - this._onUpdate = callback; - this._onUpdateScope = context; - - this.camera.emit(Events.FLASH_START, this.camera, this, duration, red, green, blue); - - return this.camera; + this.game.textures.once(TextureEvents.READY, this.boot, this); }, /** - * The main update loop for this effect. Called automatically by the Camera. - * - * @method Phaser.Cameras.Scene2D.Effects.Flash#update - * @since 3.5.0 + * Internal boot handler. * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @method Phaser.Renderer.Canvas.CanvasRenderer#boot + * @private + * @since 3.50.0 */ - update: function (time, delta) + boot: function () { - if (!this.isRunning) - { - return; - } + var game = this.game; - this._elapsed += delta; + var baseSize = game.scale.baseSize; - this.progress = Clamp(this._elapsed / this.duration, 0, 1); + this.width = baseSize.width; + this.height = baseSize.height; - if (this._onUpdate) - { - this._onUpdate.call(this._onUpdateScope, this.camera, this.progress); - } + this.isBooted = true; - if (this._elapsed < this.duration) - { - this.alpha = 1 - this.progress; - } - else - { - this.effectComplete(); - } + game.scale.on(ScaleEvents.RESIZE, this.onResize, this); + + this.resize(baseSize.width, baseSize.height); }, /** - * Called internally by the Canvas Renderer. - * - * @method Phaser.Cameras.Scene2D.Effects.Flash#postRenderCanvas - * @since 3.5.0 + * The event handler that manages the `resize` event dispatched by the Scale Manager. * - * @param {CanvasRenderingContext2D} ctx - The Canvas context to render to. + * @method Phaser.Renderer.Canvas.CanvasRenderer#onResize + * @since 3.16.0 * - * @return {boolean} `true` if the effect drew to the renderer, otherwise `false`. + * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions multiplied by the resolution. The canvas width / height values match this. */ - postRenderCanvas: function (ctx) + onResize: function (gameSize, baseSize) { - if (!this.isRunning) + // Has the underlying canvas size changed? + if (baseSize.width !== this.width || baseSize.height !== this.height) { - return false; + this.resize(baseSize.width, baseSize.height); } - - var camera = this.camera; - - ctx.fillStyle = 'rgba(' + this.red + ',' + this.green + ',' + this.blue + ',' + this.alpha + ')'; - ctx.fillRect(camera.x, camera.y, camera.width, camera.height); - - return true; }, /** - * Called internally by the WebGL Renderer. - * - * @method Phaser.Cameras.Scene2D.Effects.Flash#postRenderWebGL - * @since 3.5.0 + * Resize the main game canvas. * - * @param {Phaser.Renderer.WebGL.Pipelines.MultiPipeline} pipeline - The WebGL Pipeline to render to. Must provide the `drawFillRect` method. - * @param {function} getTintFunction - A function that will return the gl safe tint colors. + * @method Phaser.Renderer.Canvas.CanvasRenderer#resize + * @fires Phaser.Renderer.Events#RESIZE + * @since 3.0.0 * - * @return {boolean} `true` if the effect drew to the renderer, otherwise `false`. + * @param {number} [width] - The new width of the renderer. + * @param {number} [height] - The new height of the renderer. */ - postRenderWebGL: function (pipeline, getTintFunction) + resize: function (width, height) { - if (!this.isRunning) - { - return false; - } - - var camera = this.camera; - var red = this.red / 255; - var green = this.green / 255; - var blue = this.blue / 255; - - pipeline.drawFillRect( - camera.x, camera.y, camera.width, camera.height, - getTintFunction(blue, green, red, 1), - this.alpha - ); + this.width = width; + this.height = height; - return true; + this.emit(Events.RESIZE, width, height); }, /** - * Called internally when the effect completes. + * Resets the transformation matrix of the current context to the identity matrix, thus resetting any transformation. * - * @method Phaser.Cameras.Scene2D.Effects.Flash#effectComplete - * @fires Phaser.Cameras.Scene2D.Events#FLASH_COMPLETE - * @since 3.5.0 + * @method Phaser.Renderer.Canvas.CanvasRenderer#resetTransform + * @since 3.0.0 */ - effectComplete: function () + resetTransform: function () { - this._onUpdate = null; - this._onUpdateScope = null; - - this.isRunning = false; - - this.camera.emit(Events.FLASH_COMPLETE, this.camera, this); + this.currentContext.setTransform(1, 0, 0, 1, 0, 0); }, /** - * Resets this camera effect. - * If it was previously running, it stops instantly without calling its onComplete callback or emitting an event. + * Sets the blend mode (compositing operation) of the current context. * - * @method Phaser.Cameras.Scene2D.Effects.Flash#reset - * @since 3.5.0 + * @method Phaser.Renderer.Canvas.CanvasRenderer#setBlendMode + * @since 3.0.0 + * + * @param {string} blendMode - The new blend mode which should be used. + * + * @return {this} This CanvasRenderer object. */ - reset: function () + setBlendMode: function (blendMode) { - this.isRunning = false; + this.currentContext.globalCompositeOperation = blendMode; - this._onUpdate = null; - this._onUpdateScope = null; + return this; }, /** - * Destroys this effect, releasing it from the Camera. + * Changes the Canvas Rendering Context that all draw operations are performed against. * - * @method Phaser.Cameras.Scene2D.Effects.Flash#destroy - * @since 3.5.0 + * @method Phaser.Renderer.Canvas.CanvasRenderer#setContext + * @since 3.12.0 + * + * @param {?CanvasRenderingContext2D} [ctx] - The new Canvas Rendering Context to draw everything to. Leave empty to reset to the Game Canvas. + * + * @return {this} The Canvas Renderer instance. */ - destroy: function () - { - this.reset(); - - this.camera = null; - } - -}); - -module.exports = Flash; - - -/***/ }), -/* 763 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Clamp = __webpack_require__(18); -var Class = __webpack_require__(0); -var EaseMap = __webpack_require__(134); -var Events = __webpack_require__(37); -var Vector2 = __webpack_require__(3); - -/** - * @classdesc - * A Camera Pan effect. - * - * This effect will scroll the Camera so that the center of its viewport finishes at the given destination, - * over the duration and with the ease specified. - * - * Only the camera scroll is moved. None of the objects it is displaying are impacted, i.e. their positions do - * not change. - * - * The effect will dispatch several events on the Camera itself and you can also specify an `onUpdate` callback, - * which is invoked each frame for the duration of the effect if required. - * - * @class Pan - * @memberof Phaser.Cameras.Scene2D.Effects - * @constructor - * @since 3.11.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera this effect is acting upon. - */ -var Pan = new Class({ - - initialize: - - function Pan (camera) + setContext: function (ctx) { - /** - * The Camera this effect belongs to. - * - * @name Phaser.Cameras.Scene2D.Effects.Pan#camera - * @type {Phaser.Cameras.Scene2D.Camera} - * @readonly - * @since 3.11.0 - */ - this.camera = camera; - - /** - * Is this effect actively running? - * - * @name Phaser.Cameras.Scene2D.Effects.Pan#isRunning - * @type {boolean} - * @readonly - * @default false - * @since 3.11.0 - */ - this.isRunning = false; - - /** - * The duration of the effect, in milliseconds. - * - * @name Phaser.Cameras.Scene2D.Effects.Pan#duration - * @type {number} - * @readonly - * @default 0 - * @since 3.11.0 - */ - this.duration = 0; - - /** - * The starting scroll coordinates to pan the camera from. - * - * @name Phaser.Cameras.Scene2D.Effects.Pan#source - * @type {Phaser.Math.Vector2} - * @since 3.11.0 - */ - this.source = new Vector2(); - - /** - * The constantly updated value based on zoom. - * - * @name Phaser.Cameras.Scene2D.Effects.Pan#current - * @type {Phaser.Math.Vector2} - * @since 3.11.0 - */ - this.current = new Vector2(); - - /** - * The destination scroll coordinates to pan the camera to. - * - * @name Phaser.Cameras.Scene2D.Effects.Pan#destination - * @type {Phaser.Math.Vector2} - * @since 3.11.0 - */ - this.destination = new Vector2(); - - /** - * The ease function to use during the pan. - * - * @name Phaser.Cameras.Scene2D.Effects.Pan#ease - * @type {function} - * @since 3.11.0 - */ - this.ease; - - /** - * If this effect is running this holds the current percentage of the progress, a value between 0 and 1. - * - * @name Phaser.Cameras.Scene2D.Effects.Pan#progress - * @type {number} - * @since 3.11.0 - */ - this.progress = 0; - - /** - * Effect elapsed timer. - * - * @name Phaser.Cameras.Scene2D.Effects.Pan#_elapsed - * @type {number} - * @private - * @since 3.11.0 - */ - this._elapsed = 0; - - /** - * This callback is invoked every frame for the duration of the effect. - * - * @name Phaser.Cameras.Scene2D.Effects.Pan#_onUpdate - * @type {?Phaser.Types.Cameras.Scene2D.CameraPanCallback} - * @private - * @default null - * @since 3.11.0 - */ - this._onUpdate; + this.currentContext = (ctx) ? ctx : this.gameContext; - /** - * On Complete callback scope. - * - * @name Phaser.Cameras.Scene2D.Effects.Pan#_onUpdateScope - * @type {any} - * @private - * @since 3.11.0 - */ - this._onUpdateScope; + return this; }, /** - * This effect will scroll the Camera so that the center of its viewport finishes at the given destination, - * over the duration and with the ease specified. + * Sets the global alpha of the current context. * - * @method Phaser.Cameras.Scene2D.Effects.Pan#start - * @fires Phaser.Cameras.Scene2D.Events#PAN_START - * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE - * @since 3.11.0 + * @method Phaser.Renderer.Canvas.CanvasRenderer#setAlpha + * @since 3.0.0 * - * @param {number} x - The destination x coordinate to scroll the center of the Camera viewport to. - * @param {number} y - The destination y coordinate to scroll the center of the Camera viewport to. - * @param {number} [duration=1000] - The duration of the effect in milliseconds. - * @param {(string|function)} [ease='Linear'] - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the pan effect to start immediately, even if already running. - * @param {Phaser.Types.Cameras.Scene2D.CameraPanCallback} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, - * the current camera scroll x coordinate and the current camera scroll y coordinate. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * @param {number} alpha - The new alpha to use, where 0 is fully transparent and 1 is fully opaque. * - * @return {Phaser.Cameras.Scene2D.Camera} The Camera on which the effect was started. + * @return {this} This CanvasRenderer object. */ - start: function (x, y, duration, ease, force, callback, context) + setAlpha: function (alpha) { - if (duration === undefined) { duration = 1000; } - if (ease === undefined) { ease = EaseMap.Linear; } - if (force === undefined) { force = false; } - if (callback === undefined) { callback = null; } - if (context === undefined) { context = this.camera.scene; } - - var cam = this.camera; - - if (!force && this.isRunning) - { - return cam; - } - - this.isRunning = true; - this.duration = duration; - this.progress = 0; - - // Starting from - this.source.set(cam.scrollX, cam.scrollY); - - // Destination - this.destination.set(x, y); - - // Zoom factored version - cam.getScroll(x, y, this.current); - - // Using this ease - if (typeof ease === 'string' && EaseMap.hasOwnProperty(ease)) - { - this.ease = EaseMap[ease]; - } - else if (typeof ease === 'function') - { - this.ease = ease; - } - - this._elapsed = 0; - - this._onUpdate = callback; - this._onUpdateScope = context; - - this.camera.emit(Events.PAN_START, this.camera, this, duration, x, y); + this.currentContext.globalAlpha = alpha; - return cam; + return this; }, /** - * The main update loop for this effect. Called automatically by the Camera. - * - * @method Phaser.Cameras.Scene2D.Effects.Pan#update - * @since 3.11.0 + * Called at the start of the render loop. * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @method Phaser.Renderer.Canvas.CanvasRenderer#preRender + * @fires Phaser.Renderer.Events#PRE_RENDER + * @since 3.0.0 */ - update: function (time, delta) + preRender: function () { - if (!this.isRunning) - { - return; - } - - this._elapsed += delta; - - var progress = Clamp(this._elapsed / this.duration, 0, 1); - - this.progress = progress; - - var cam = this.camera; - - if (this._elapsed < this.duration) - { - var v = this.ease(progress); - - cam.getScroll(this.destination.x, this.destination.y, this.current); + var ctx = this.gameContext; + var config = this.config; - var x = this.source.x + ((this.current.x - this.source.x) * v); - var y = this.source.y + ((this.current.y - this.source.y) * v); + var width = this.width; + var height = this.height; - cam.setScroll(x, y); + ctx.globalAlpha = 1; + ctx.globalCompositeOperation = 'source-over'; + ctx.setTransform(1, 0, 0, 1, 0, 0); - if (this._onUpdate) - { - this._onUpdate.call(this._onUpdateScope, cam, progress, x, y); - } - } - else + if (config.clearBeforeRender) { - cam.centerOn(this.destination.x, this.destination.y); + ctx.clearRect(0, 0, width, height); - if (this._onUpdate) + if (!config.transparent) { - this._onUpdate.call(this._onUpdateScope, cam, progress, cam.scrollX, cam.scrollY); + ctx.fillStyle = config.backgroundColor.rgba; + ctx.fillRect(0, 0, width, height); } - - this.effectComplete(); } - }, - /** - * Called internally when the effect completes. - * - * @method Phaser.Cameras.Scene2D.Effects.Pan#effectComplete - * @fires Phaser.Cameras.Scene2D.Events#PAN_COMPLETE - * @since 3.11.0 - */ - effectComplete: function () - { - this._onUpdate = null; - this._onUpdateScope = null; + ctx.save(); - this.isRunning = false; + this.drawCount = 0; - this.camera.emit(Events.PAN_COMPLETE, this.camera, this); + this.emit(Events.PRE_RENDER); }, /** - * Resets this camera effect. - * If it was previously running, it stops instantly without calling its onComplete callback or emitting an event. + * The core render step for a Scene Camera. * - * @method Phaser.Cameras.Scene2D.Effects.Pan#reset - * @since 3.11.0 - */ - reset: function () - { - this.isRunning = false; - - this._onUpdate = null; - this._onUpdateScope = null; - }, - - /** - * Destroys this effect, releasing it from the Camera. + * Iterates through the given array of Game Objects and renders them with the given Camera. * - * @method Phaser.Cameras.Scene2D.Effects.Pan#destroy - * @since 3.11.0 + * This is called by the `CameraManager.render` method. The Camera Manager instance belongs to a Scene, and is invoked + * by the Scene Systems.render method. + * + * This method is not called if `Camera.visible` is `false`, or `Camera.alpha` is zero. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#render + * @fires Phaser.Renderer.Events#RENDER + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to render. + * @param {Phaser.GameObjects.GameObject[]} children - An array of filtered Game Objects that can be rendered by the given Camera. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. */ - destroy: function () - { - this.reset(); - - this.camera = null; - this.source = null; - this.destination = null; - } - -}); - -module.exports = Pan; - - -/***/ }), -/* 764 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Back ease-in. - * - * @function Phaser.Math.Easing.Back.In - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * @param {number} [overshoot=1.70158] - The overshoot amount. - * - * @return {number} The tweened value. - */ -var In = function (v, overshoot) -{ - if (overshoot === undefined) { overshoot = 1.70158; } - - return v * v * ((overshoot + 1) * v - overshoot); -}; - -module.exports = In; - - -/***/ }), -/* 765 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Back ease-out. - * - * @function Phaser.Math.Easing.Back.Out - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * @param {number} [overshoot=1.70158] - The overshoot amount. - * - * @return {number} The tweened value. - */ -var Out = function (v, overshoot) -{ - if (overshoot === undefined) { overshoot = 1.70158; } - - return --v * v * ((overshoot + 1) * v + overshoot) + 1; -}; - -module.exports = Out; - - -/***/ }), -/* 766 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Back ease-in/out. - * - * @function Phaser.Math.Easing.Back.InOut - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * @param {number} [overshoot=1.70158] - The overshoot amount. - * - * @return {number} The tweened value. - */ -var InOut = function (v, overshoot) -{ - if (overshoot === undefined) { overshoot = 1.70158; } - - var s = overshoot * 1.525; - - if ((v *= 2) < 1) - { - return 0.5 * (v * v * ((s + 1) * v - s)); - } - else - { - return 0.5 * ((v -= 2) * v * ((s + 1) * v + s) + 2); - } -}; - -module.exports = InOut; - - -/***/ }), -/* 767 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Bounce ease-in. - * - * @function Phaser.Math.Easing.Bounce.In - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var In = function (v) -{ - v = 1 - v; - - if (v < 1 / 2.75) - { - return 1 - (7.5625 * v * v); - } - else if (v < 2 / 2.75) - { - return 1 - (7.5625 * (v -= 1.5 / 2.75) * v + 0.75); - } - else if (v < 2.5 / 2.75) - { - return 1 - (7.5625 * (v -= 2.25 / 2.75) * v + 0.9375); - } - else + render: function (scene, children, camera) { - return 1 - (7.5625 * (v -= 2.625 / 2.75) * v + 0.984375); - } -}; - -module.exports = In; - + var childCount = children.length; -/***/ }), -/* 768 */ -/***/ (function(module, exports) { + this.emit(Events.RENDER, scene, camera); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var cx = camera.x; + var cy = camera.y; + var cw = camera.width; + var ch = camera.height; -/** - * Bounce ease-out. - * - * @function Phaser.Math.Easing.Bounce.Out - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var Out = function (v) -{ - if (v < 1 / 2.75) - { - return 7.5625 * v * v; - } - else if (v < 2 / 2.75) - { - return 7.5625 * (v -= 1.5 / 2.75) * v + 0.75; - } - else if (v < 2.5 / 2.75) - { - return 7.5625 * (v -= 2.25 / 2.75) * v + 0.9375; - } - else - { - return 7.5625 * (v -= 2.625 / 2.75) * v + 0.984375; - } -}; + var ctx = (camera.renderToTexture) ? camera.context : scene.sys.context; -module.exports = Out; + // Save context pre-clip + ctx.save(); + if (this.game.scene.customViewports) + { + ctx.beginPath(); + ctx.rect(cx, cy, cw, ch); + ctx.clip(); + } -/***/ }), -/* 769 */ -/***/ (function(module, exports) { + camera.emit(CameraEvents.PRE_RENDER, camera); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.currentContext = ctx; -/** - * Bounce ease-in/out. - * - * @function Phaser.Math.Easing.Bounce.InOut - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var InOut = function (v) -{ - var reverse = false; + var mask = camera.mask; - if (v < 0.5) - { - v = 1 - (v * 2); - reverse = true; - } - else - { - v = (v * 2) - 1; - } + if (mask) + { + mask.preRenderCanvas(this, null, camera._maskCamera); + } - if (v < 1 / 2.75) - { - v = 7.5625 * v * v; - } - else if (v < 2 / 2.75) - { - v = 7.5625 * (v -= 1.5 / 2.75) * v + 0.75; - } - else if (v < 2.5 / 2.75) - { - v = 7.5625 * (v -= 2.25 / 2.75) * v + 0.9375; - } - else - { - v = 7.5625 * (v -= 2.625 / 2.75) * v + 0.984375; - } + if (!camera.transparent) + { + ctx.fillStyle = camera.backgroundColor.rgba; + ctx.fillRect(cx, cy, cw, ch); + } - if (reverse) - { - return (1 - v) * 0.5; - } - else - { - return v * 0.5 + 0.5; - } -}; + ctx.globalAlpha = camera.alpha; -module.exports = InOut; + ctx.globalCompositeOperation = 'source-over'; + this.drawCount += childCount; -/***/ }), -/* 770 */ -/***/ (function(module, exports) { + if (camera.renderToTexture) + { + camera.emit(CameraEvents.PRE_RENDER, camera); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + camera.matrix.copyToContext(ctx); -/** - * Circular ease-in. - * - * @function Phaser.Math.Easing.Circular.In - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var In = function (v) -{ - return 1 - Math.sqrt(1 - v * v); -}; + for (var i = 0; i < childCount; i++) + { + var child = children[i]; -module.exports = In; + if (child.mask) + { + child.mask.preRenderCanvas(this, child, camera); + } + child.renderCanvas(this, child, camera); -/***/ }), -/* 771 */ -/***/ (function(module, exports) { + if (child.mask) + { + child.mask.postRenderCanvas(this, child, camera); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + ctx.setTransform(1, 0, 0, 1, 0, 0); + ctx.globalCompositeOperation = 'source-over'; + ctx.globalAlpha = 1; -/** - * Circular ease-out. - * - * @function Phaser.Math.Easing.Circular.Out - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var Out = function (v) -{ - return Math.sqrt(1 - (--v * v)); -}; + camera.flashEffect.postRenderCanvas(ctx); + camera.fadeEffect.postRenderCanvas(ctx); -module.exports = Out; + camera.dirty = false; + if (mask) + { + mask.postRenderCanvas(this); + } -/***/ }), -/* 772 */ -/***/ (function(module, exports) { + // Restore pre-clip context + ctx.restore(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (camera.renderToTexture) + { + camera.emit(CameraEvents.POST_RENDER, camera); -/** - * Circular ease-in/out. - * - * @function Phaser.Math.Easing.Circular.InOut - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var InOut = function (v) -{ - if ((v *= 2) < 1) - { - return -0.5 * (Math.sqrt(1 - v * v) - 1); - } - else - { - return 0.5 * (Math.sqrt(1 - (v -= 2) * v) + 1); - } -}; + if (camera.renderToGame) + { + scene.sys.context.drawImage(camera.canvas, cx, cy); + } + } -module.exports = InOut; + camera.emit(CameraEvents.POST_RENDER, camera); + }, + /** + * Restores the game context's global settings and takes a snapshot if one is scheduled. + * + * The post-render step happens after all Cameras in all Scenes have been rendered. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#postRender + * @fires Phaser.Renderer.Events#POST_RENDER + * @since 3.0.0 + */ + postRender: function () + { + var ctx = this.gameContext; -/***/ }), -/* 773 */ -/***/ (function(module, exports) { + ctx.restore(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.emit(Events.POST_RENDER); -/** - * Cubic ease-in. - * - * @function Phaser.Math.Easing.Cubic.In - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var In = function (v) -{ - return v * v * v; -}; + var state = this.snapshotState; -module.exports = In; + if (state.callback) + { + CanvasSnapshot(this.gameCanvas, state); + state.callback = null; + } + }, -/***/ }), -/* 774 */ -/***/ (function(module, exports) { + /** + * Takes a snapshot of the given area of the given canvas. + * + * Unlike the other snapshot methods, this one is processed immediately and doesn't wait for the next render. + * + * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets + * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotCanvas + * @since 3.19.0 + * + * @param {HTMLCanvasElement} canvas - The canvas to grab from. + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {boolean} [getPixel=false] - Grab a single pixel as a Color object, or an area as an Image object? + * @param {number} [x=0] - The x coordinate to grab from. + * @param {number} [y=0] - The y coordinate to grab from. + * @param {number} [width=canvas.width] - The width of the area to grab. + * @param {number} [height=canvas.height] - The height of the area to grab. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This Canvas Renderer. + */ + snapshotCanvas: function (canvas, callback, getPixel, x, y, width, height, type, encoderOptions) + { + if (getPixel === undefined) { getPixel = false; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.snapshotArea(x, y, width, height, callback, type, encoderOptions); -/** - * Cubic ease-out. - * - * @function Phaser.Math.Easing.Cubic.Out - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var Out = function (v) -{ - return --v * v * v + 1; -}; + var state = this.snapshotState; -module.exports = Out; + state.getPixel = getPixel; + CanvasSnapshot(canvas, state); -/***/ }), -/* 775 */ -/***/ (function(module, exports) { + state.callback = null; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -/** - * Cubic ease-in/out. - * - * @function Phaser.Math.Easing.Cubic.InOut - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var InOut = function (v) -{ - if ((v *= 2) < 1) + /** + * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. + * + * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets + * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot + * @since 3.0.0 + * + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshot: function (callback, type, encoderOptions) { - return 0.5 * v * v * v; - } - else + return this.snapshotArea(0, 0, this.gameCanvas.width, this.gameCanvas.height, callback, type, encoderOptions); + }, + + /** + * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets + * more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotArea + * @since 3.16.0 + * + * @param {number} x - The x coordinate to grab from. + * @param {number} y - The y coordinate to grab from. + * @param {number} width - The width of the area to grab. + * @param {number} height - The height of the area to grab. + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshotArea: function (x, y, width, height, callback, type, encoderOptions) { - return 0.5 * ((v -= 2) * v * v + 2); - } -}; + var state = this.snapshotState; -module.exports = InOut; + state.callback = callback; + state.type = type; + state.encoder = encoderOptions; + state.getPixel = false; + state.x = x; + state.y = y; + state.width = Math.min(width, this.gameCanvas.width); + state.height = Math.min(height, this.gameCanvas.height); + return this; + }, -/***/ }), -/* 776 */ -/***/ (function(module, exports) { + /** + * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then + * calling this method will override it. + * + * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for + * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, + * using less memory. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshotPixel + * @since 3.16.0 + * + * @param {number} x - The x coordinate of the pixel to get. + * @param {number} y - The y coordinate of the pixel to get. + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * + * @return {this} This WebGL Renderer. + */ + snapshotPixel: function (x, y, callback) + { + this.snapshotArea(x, y, 1, 1, callback); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.snapshotState.getPixel = true; -/** - * Elastic ease-in. - * - * @function Phaser.Math.Easing.Elastic.In - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. - * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. - * - * @return {number} The tweened value. - */ -var In = function (v, amplitude, period) -{ - if (amplitude === undefined) { amplitude = 0.1; } - if (period === undefined) { period = 0.1; } + return this; + }, - if (v === 0) - { - return 0; - } - else if (v === 1) - { - return 1; - } - else + /** + * Takes a Sprite Game Object, or any object that extends it, and draws it to the current context. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#batchSprite + * @since 3.12.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The texture based Game Object to draw. + * @param {Phaser.Textures.Frame} frame - The frame to draw, doesn't have to be that owned by the Game Object. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set. + */ + batchSprite: function (sprite, frame, camera, parentTransformMatrix) { - var s = period / 4; + var alpha = camera.alpha * sprite.alpha; - if (amplitude < 1) - { - amplitude = 1; - } - else + if (alpha === 0) { - s = period * Math.asin(1 / amplitude) / (2 * Math.PI); + // Nothing to see, so abort early + return; } - return -(amplitude * Math.pow(2, 10 * (v -= 1)) * Math.sin((v - s) * (2 * Math.PI) / period)); - } -}; + var ctx = this.currentContext; -module.exports = In; + var camMatrix = this._tempMatrix1; + var spriteMatrix = this._tempMatrix2; + var cd = frame.canvasData; -/***/ }), -/* 777 */ -/***/ (function(module, exports) { + var frameX = cd.x; + var frameY = cd.y; + var frameWidth = frame.cutWidth; + var frameHeight = frame.cutHeight; + var customPivot = frame.customPivot; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var res = frame.source.resolution; -/** - * Elastic ease-out. - * - * @function Phaser.Math.Easing.Elastic.Out - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. - * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. - * - * @return {number} The tweened value. - */ -var Out = function (v, amplitude, period) -{ - if (amplitude === undefined) { amplitude = 0.1; } - if (period === undefined) { period = 0.1; } + var displayOriginX = sprite.displayOriginX; + var displayOriginY = sprite.displayOriginY; - if (v === 0) - { - return 0; - } - else if (v === 1) - { - return 1; - } - else - { - var s = period / 4; + var x = -displayOriginX + frame.x; + var y = -displayOriginY + frame.y; - if (amplitude < 1) - { - amplitude = 1; - } - else + if (sprite.isCropped) { - s = period * Math.asin(1 / amplitude) / (2 * Math.PI); - } + var crop = sprite._crop; - return (amplitude * Math.pow(2, -10 * v) * Math.sin((v - s) * (2 * Math.PI) / period) + 1); - } -}; + if (crop.flipX !== sprite.flipX || crop.flipY !== sprite.flipY) + { + frame.updateCropUVs(crop, sprite.flipX, sprite.flipY); + } -module.exports = Out; + frameWidth = crop.cw; + frameHeight = crop.ch; + + frameX = crop.cx; + frameY = crop.cy; + x = -displayOriginX + crop.x; + y = -displayOriginY + crop.y; -/***/ }), -/* 778 */ -/***/ (function(module, exports) { + if (sprite.flipX) + { + if (x >= 0) + { + x = -(x + frameWidth); + } + else if (x < 0) + { + x = (Math.abs(x) - frameWidth); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (sprite.flipY) + { + if (y >= 0) + { + y = -(y + frameHeight); + } + else if (y < 0) + { + y = (Math.abs(y) - frameHeight); + } + } + } -/** - * Elastic ease-in/out. - * - * @function Phaser.Math.Easing.Elastic.InOut - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * @param {number} [amplitude=0.1] - The amplitude of the elastic ease. - * @param {number} [period=0.1] - Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. - * - * @return {number} The tweened value. - */ -var InOut = function (v, amplitude, period) -{ - if (amplitude === undefined) { amplitude = 0.1; } - if (period === undefined) { period = 0.1; } + var flipX = 1; + var flipY = 1; - if (v === 0) - { - return 0; - } - else if (v === 1) - { - return 1; - } - else - { - var s = period / 4; + if (sprite.flipX) + { + if (!customPivot) + { + x += (-frame.realWidth + (displayOriginX * 2)); + } - if (amplitude < 1) + flipX = -1; + } + + // Auto-invert the flipY if this is coming from a GLTexture + if (sprite.flipY) { - amplitude = 1; + if (!customPivot) + { + y += (-frame.realHeight + (displayOriginY * 2)); + } + + flipY = -1; } - else + + var gx = sprite.x; + var gy = sprite.y; + + if (camera.roundPixels) { - s = period * Math.asin(1 / amplitude) / (2 * Math.PI); + gx = Math.floor(gx); + gy = Math.floor(gy); } - if ((v *= 2) < 1) + spriteMatrix.applyITRS(gx, gy, sprite.rotation, sprite.scaleX * flipX, sprite.scaleY * flipY); + + camMatrix.copyFrom(camera.matrix); + + if (parentTransformMatrix) { - return -0.5 * (amplitude * Math.pow(2, 10 * (v -= 1)) * Math.sin((v - s) * (2 * Math.PI) / period)); + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * sprite.scrollFactorX, -camera.scrollY * sprite.scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = gx; + spriteMatrix.f = gy; } else { - return amplitude * Math.pow(2, -10 * (v -= 1)) * Math.sin((v - s) * (2 * Math.PI) / period) * 0.5 + 1; + spriteMatrix.e -= camera.scrollX * sprite.scrollFactorX; + spriteMatrix.f -= camera.scrollY * sprite.scrollFactorY; } - } -}; - -module.exports = InOut; - - -/***/ }), -/* 779 */ -/***/ (function(module, exports) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Multiply by the Sprite matrix + camMatrix.multiply(spriteMatrix); -/** - * Exponential ease-in. - * - * @function Phaser.Math.Easing.Expo.In - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var In = function (v) -{ - return Math.pow(2, 10 * (v - 1)) - 0.001; -}; + if (camera.roundPixels) + { + camMatrix.e = Math.round(camMatrix.e); + camMatrix.f = Math.round(camMatrix.f); + } -module.exports = In; + ctx.save(); + camMatrix.setToContext(ctx); -/***/ }), -/* 780 */ -/***/ (function(module, exports) { + ctx.globalCompositeOperation = this.blendModes[sprite.blendMode]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + ctx.globalAlpha = alpha; -/** - * Exponential ease-out. - * - * @function Phaser.Math.Easing.Expo.Out - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var Out = function (v) -{ - return 1 - Math.pow(2, -10 * v); -}; + ctx.imageSmoothingEnabled = !frame.source.scaleMode; -module.exports = Out; + if (sprite.mask) + { + sprite.mask.preRenderCanvas(this, sprite, camera); + } + if (frameWidth > 0 && frameHeight > 0) + { + ctx.drawImage(frame.source.image, frameX, frameY, frameWidth, frameHeight, x, y, frameWidth / res, frameHeight / res); + } -/***/ }), -/* 781 */ -/***/ (function(module, exports) { + if (sprite.mask) + { + sprite.mask.postRenderCanvas(this, sprite, camera); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + ctx.restore(); + }, -/** - * Exponential ease-in/out. - * - * @function Phaser.Math.Easing.Expo.InOut - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var InOut = function (v) -{ - if ((v *= 2) < 1) - { - return 0.5 * Math.pow(2, 10 * (v - 1)); - } - else + /** + * Destroys all object references in the Canvas Renderer. + * + * @method Phaser.Renderer.Canvas.CanvasRenderer#destroy + * @since 3.0.0 + */ + destroy: function () { - return 0.5 * (2 - Math.pow(2, -10 * (v - 1))); + this.removeAllListeners(); + + this.game = null; + this.gameCanvas = null; + this.gameContext = null; } -}; -module.exports = InOut; +}); + +module.exports = CanvasRenderer; /***/ }), -/* 782 */ -/***/ (function(module, exports) { + +/***/ 6046: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Linear easing (no variation). - * - * @function Phaser.Math.Easing.Linear - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. + * @namespace Phaser.Renderer.Canvas */ -var Linear = function (v) -{ - return v; -}; - -module.exports = Linear; - -/***/ }), -/* 783 */ -/***/ (function(module, exports) { +module.exports = { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + CanvasRenderer: __webpack_require__(91135), + GetBlendModes: __webpack_require__(32834), + SetTransform: __webpack_require__(49584) -/** - * Quadratic ease-in. - * - * @function Phaser.Math.Easing.Quadratic.In - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var In = function (v) -{ - return v * v; }; -module.exports = In; - /***/ }), -/* 784 */ -/***/ (function(module, exports) { + +/***/ 32834: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var modes = __webpack_require__(95723); +var CanvasFeatures = __webpack_require__(98581); + /** - * Quadratic ease-out. + * Returns an array which maps the default blend modes to supported Canvas blend modes. * - * @function Phaser.Math.Easing.Quadratic.Out - * @since 3.0.0 + * If the browser doesn't support a blend mode, it will default to the normal `source-over` blend mode. * - * @param {number} v - The value to be tweened. + * @function Phaser.Renderer.Canvas.GetBlendModes + * @since 3.0.0 * - * @return {number} The tweened value. + * @return {array} Which Canvas blend mode corresponds to which default Phaser blend mode. */ -var Out = function (v) +var GetBlendModes = function () { - return v * (2 - v); -}; - -module.exports = Out; - - -/***/ }), -/* 785 */ -/***/ (function(module, exports) { + var output = []; + var useNew = CanvasFeatures.supportNewBlendModes; + var so = 'source-over'; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + output[modes.NORMAL] = so; + output[modes.ADD] = 'lighter'; + output[modes.MULTIPLY] = (useNew) ? 'multiply' : so; + output[modes.SCREEN] = (useNew) ? 'screen' : so; + output[modes.OVERLAY] = (useNew) ? 'overlay' : so; + output[modes.DARKEN] = (useNew) ? 'darken' : so; + output[modes.LIGHTEN] = (useNew) ? 'lighten' : so; + output[modes.COLOR_DODGE] = (useNew) ? 'color-dodge' : so; + output[modes.COLOR_BURN] = (useNew) ? 'color-burn' : so; + output[modes.HARD_LIGHT] = (useNew) ? 'hard-light' : so; + output[modes.SOFT_LIGHT] = (useNew) ? 'soft-light' : so; + output[modes.DIFFERENCE] = (useNew) ? 'difference' : so; + output[modes.EXCLUSION] = (useNew) ? 'exclusion' : so; + output[modes.HUE] = (useNew) ? 'hue' : so; + output[modes.SATURATION] = (useNew) ? 'saturation' : so; + output[modes.COLOR] = (useNew) ? 'color' : so; + output[modes.LUMINOSITY] = (useNew) ? 'luminosity' : so; + output[modes.ERASE] = 'destination-out'; + output[modes.SOURCE_IN] = 'source-in'; + output[modes.SOURCE_OUT] = 'source-out'; + output[modes.SOURCE_ATOP] = 'source-atop'; + output[modes.DESTINATION_OVER] = 'destination-over'; + output[modes.DESTINATION_IN] = 'destination-in'; + output[modes.DESTINATION_OUT] = 'destination-out'; + output[modes.DESTINATION_ATOP] = 'destination-atop'; + output[modes.LIGHTER] = 'lighter'; + output[modes.COPY] = 'copy'; + output[modes.XOR] = 'xor'; -/** - * Quadratic ease-in/out. - * - * @function Phaser.Math.Easing.Quadratic.InOut - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var InOut = function (v) -{ - if ((v *= 2) < 1) - { - return 0.5 * v * v; - } - else - { - return -0.5 * (--v * (v - 2) - 1); - } + return output; }; -module.exports = InOut; +module.exports = GetBlendModes; /***/ }), -/* 786 */ -/***/ (function(module, exports) { + +/***/ 49584: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var GetCalcMatrix = __webpack_require__(73329); + /** - * Quartic ease-in. + * Takes a reference to the Canvas Renderer, a Canvas Rendering Context, a Game Object, a Camera and a parent matrix + * and then performs the following steps: * - * @function Phaser.Math.Easing.Quartic.In - * @since 3.0.0 + * 1. Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts. + * 2. Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given. + * 3. Sets the blend mode of the context to be that used by the Game Object. + * 4. Sets the alpha value of the context to be that used by the Game Object combined with the Camera. + * 5. Saves the context state. + * 6. Sets the final matrix values into the context via setTransform. + * 7. If the Game Object has a texture frame, imageSmoothingEnabled is set based on frame.source.scaleMode. + * 8. If the Game Object does not have a texture frame, imageSmoothingEnabled is set based on Renderer.antialias. * - * @param {number} v - The value to be tweened. + * This function is only meant to be used internally. Most of the Canvas Renderer classes use it. * - * @return {number} The tweened value. + * @function Phaser.Renderer.Canvas.SetTransform + * @since 3.12.0 + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {CanvasRenderingContext2D} ctx - The canvas context to set the transform on. + * @param {Phaser.GameObjects.GameObject} src - The Game Object being rendered. Can be any type that extends the base class. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - A parent transform matrix to apply to the Game Object before rendering. + * + * @return {boolean} `true` if the Game Object context was set, otherwise `false`. */ -var In = function (v) +var SetTransform = function (renderer, ctx, src, camera, parentMatrix) { - return v * v * v * v; -}; - -module.exports = In; - + var alpha = camera.alpha * src.alpha; -/***/ }), -/* 787 */ -/***/ (function(module, exports) { + if (alpha <= 0) + { + // Nothing to see, so don't waste time calculating stuff + return false; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; -/** - * Quartic ease-out. - * - * @function Phaser.Math.Easing.Quartic.Out - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var Out = function (v) -{ - return 1 - (--v * v * v * v); -}; + // Blend Mode + ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; -module.exports = Out; + // Alpha + ctx.globalAlpha = alpha; + ctx.save(); -/***/ }), -/* 788 */ -/***/ (function(module, exports) { + calcMatrix.setToContext(ctx); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + ctx.imageSmoothingEnabled = src.frame ? !src.frame.source.scaleMode : renderer.antialias; -/** - * Quartic ease-in/out. - * - * @function Phaser.Math.Easing.Quartic.InOut - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. - */ -var InOut = function (v) -{ - if ((v *= 2) < 1) - { - return 0.5 * v * v * v * v; - } - else - { - return -0.5 * ((v -= 2) * v * v * v - 2); - } + return true; }; -module.exports = InOut; +module.exports = SetTransform; /***/ }), -/* 789 */ -/***/ (function(module, exports) { + +/***/ 70936: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Quintic ease-in. - * - * @function Phaser.Math.Easing.Quintic.In - * @since 3.0.0 + * The Post-Render Event. * - * @param {number} v - The value to be tweened. + * This event is dispatched by the Renderer when all rendering, for all cameras in all Scenes, + * has completed, but before any pending snap shots have been taken. * - * @return {number} The tweened value. + * @event Phaser.Renderer.Events#POST_RENDER + * @type {string} + * @since 3.50.0 */ -var In = function (v) -{ - return v * v * v * v * v; -}; - -module.exports = In; +module.exports = 'postrender'; /***/ }), -/* 790 */ -/***/ (function(module, exports) { + +/***/ 99298: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Quintic ease-out. - * - * @function Phaser.Math.Easing.Quintic.Out - * @since 3.0.0 + * The Pre-Render Event. * - * @param {number} v - The value to be tweened. + * This event is dispatched by the Phaser Renderer. This happens right at the start of the render + * process, after the context has been cleared, the scissors enabled (WebGL only) and everything has been + * reset ready for the render. * - * @return {number} The tweened value. + * @event Phaser.Renderer.Events#PRE_RENDER + * @type {string} + * @since 3.50.0 */ -var Out = function (v) -{ - return --v * v * v * v * v + 1; -}; - -module.exports = Out; +module.exports = 'prerender'; /***/ }), -/* 791 */ -/***/ (function(module, exports) { + +/***/ 7743: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Quintic ease-in/out. + * The Render Event. * - * @function Phaser.Math.Easing.Quintic.InOut - * @since 3.0.0 + * This event is dispatched by the Phaser Renderer for every camera in every Scene. * - * @param {number} v - The value to be tweened. + * It is dispatched before any of the children in the Scene have been rendered. * - * @return {number} The tweened value. + * @event Phaser.Renderer.Events#RENDER + * @type {string} + * @since 3.50.0 + * + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered. */ -var InOut = function (v) -{ - if ((v *= 2) < 1) - { - return 0.5 * v * v * v * v * v; - } - else - { - return 0.5 * ((v -= 2) * v * v * v * v + 2); - } -}; - -module.exports = InOut; +module.exports = 'render'; /***/ }), -/* 792 */ -/***/ (function(module, exports) { + +/***/ 99519: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Sinusoidal ease-in. + * The Renderer Resize Event. * - * @function Phaser.Math.Easing.Sine.In - * @since 3.0.0 + * This event is dispatched by the Phaser Renderer when it is resized, usually as a result + * of the Scale Manager resizing. * - * @param {number} v - The value to be tweened. + * @event Phaser.Renderer.Events#RESIZE + * @type {string} + * @since 3.50.0 * - * @return {number} The tweened value. + * @param {number} width - The new width of the renderer. + * @param {number} height - The new height of the renderer. */ -var In = function (v) -{ - if (v === 0) - { - return 0; - } - else if (v === 1) - { - return 1; - } - else - { - return 1 - Math.cos(v * Math.PI / 2); - } -}; - -module.exports = In; +module.exports = 'resize'; /***/ }), -/* 793 */ -/***/ (function(module, exports) { + +/***/ 81044: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Sinusoidal ease-out. - * - * @function Phaser.Math.Easing.Sine.Out - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. + * @namespace Phaser.Renderer.Events */ -var Out = function (v) -{ - if (v === 0) - { - return 0; - } - else if (v === 1) - { - return 1; - } - else - { - return Math.sin(v * Math.PI / 2); - } -}; -module.exports = Out; +module.exports = { + + POST_RENDER: __webpack_require__(70936), + PRE_RENDER: __webpack_require__(99298), + RENDER: __webpack_require__(7743), + RESIZE: __webpack_require__(99519) + +}; /***/ }), -/* 794 */ -/***/ (function(module, exports) { + +/***/ 42069: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Sinusoidal ease-in/out. - * - * @function Phaser.Math.Easing.Sine.InOut - * @since 3.0.0 - * - * @param {number} v - The value to be tweened. - * - * @return {number} The tweened value. + * @namespace Phaser.Renderer */ -var InOut = function (v) -{ - if (v === 0) - { - return 0; - } - else if (v === 1) - { - return 1; - } - else - { - return 0.5 * (1 - Math.cos(Math.PI * v)); - } -}; -module.exports = InOut; +/** + * @namespace Phaser.Types.Renderer + */ + +module.exports = { + + Canvas: __webpack_require__(6046), + Events: __webpack_require__(81044), + Snapshot: __webpack_require__(95528), + WebGL: __webpack_require__(55478) + +}; /***/ }), -/* 795 */ -/***/ (function(module, exports) { + +/***/ 61840: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var CanvasPool = __webpack_require__(61068); +var Color = __webpack_require__(27119); +var GetFastValue = __webpack_require__(72632); + /** - * Stepped easing. + * Takes a snapshot of an area from the current frame displayed by a canvas. * - * @function Phaser.Math.Easing.Stepped - * @since 3.0.0 + * This is then copied to an Image object. When this loads, the results are sent + * to the callback provided in the Snapshot Configuration object. * - * @param {number} v - The value to be tweened. - * @param {number} [steps=1] - The number of steps in the ease. + * @function Phaser.Renderer.Snapshot.Canvas + * @since 3.0.0 * - * @return {number} The tweened value. + * @param {HTMLCanvasElement} sourceCanvas - The canvas to take a snapshot of. + * @param {Phaser.Types.Renderer.Snapshot.SnapshotState} config - The snapshot configuration object. */ -var Stepped = function (v, steps) +var CanvasSnapshot = function (canvas, config) { - if (steps === undefined) { steps = 1; } + var callback = GetFastValue(config, 'callback'); + var type = GetFastValue(config, 'type', 'image/png'); + var encoderOptions = GetFastValue(config, 'encoder', 0.92); + var x = Math.abs(Math.round(GetFastValue(config, 'x', 0))); + var y = Math.abs(Math.round(GetFastValue(config, 'y', 0))); + var width = Math.floor(GetFastValue(config, 'width', canvas.width)); + var height = Math.floor(GetFastValue(config, 'height', canvas.height)); + var getPixel = GetFastValue(config, 'getPixel', false); - if (v <= 0) + if (getPixel) { - return 0; + var context = canvas.getContext('2d', { willReadFrequently: false }); + var imageData = context.getImageData(x, y, 1, 1); + var data = imageData.data; + + callback.call(null, new Color(data[0], data[1], data[2], data[3])); } - else if (v >= 1) + else if (x !== 0 || y !== 0 || width !== canvas.width || height !== canvas.height) { - return 1; + // Area Grab + var copyCanvas = CanvasPool.createWebGL(this, width, height); + var ctx = copyCanvas.getContext('2d', { willReadFrequently: true }); + + if (width > 0 && height > 0) + { + ctx.drawImage(canvas, x, y, width, height, 0, 0, width, height); + } + + var image1 = new Image(); + + image1.onerror = function () + { + callback.call(null); + + CanvasPool.remove(copyCanvas); + }; + + image1.onload = function () + { + callback.call(null, image1); + + CanvasPool.remove(copyCanvas); + }; + + image1.src = copyCanvas.toDataURL(type, encoderOptions); } else { - return (((steps * v) | 0) + 1) * (1 / steps); + // Full Grab + var image2 = new Image(); + + image2.onerror = function () + { + callback.call(null); + }; + + image2.onload = function () + { + callback.call(null, image2); + }; + + image2.src = canvas.toDataURL(type, encoderOptions); } }; -module.exports = Stepped; +module.exports = CanvasSnapshot; /***/ }), -/* 796 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 1217: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(18); -var Class = __webpack_require__(0); -var Events = __webpack_require__(37); -var Vector2 = __webpack_require__(3); +var CanvasPool = __webpack_require__(61068); +var Color = __webpack_require__(27119); +var GetFastValue = __webpack_require__(72632); /** - * @classdesc - * A Camera Shake effect. - * - * This effect will shake the camera viewport by a random amount, bounded by the specified intensity, each frame. - * - * Only the camera viewport is moved. None of the objects it is displaying are impacted, i.e. their positions do - * not change. + * Takes a snapshot of an area from the current frame displayed by a WebGL canvas. * - * The effect will dispatch several events on the Camera itself and you can also specify an `onUpdate` callback, - * which is invoked each frame for the duration of the effect if required. + * This is then copied to an Image object. When this loads, the results are sent + * to the callback provided in the Snapshot Configuration object. * - * @class Shake - * @memberof Phaser.Cameras.Scene2D.Effects - * @constructor - * @since 3.5.0 + * @function Phaser.Renderer.Snapshot.WebGL + * @since 3.0.0 * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera this effect is acting upon. + * @param {WebGLRenderingContext} sourceContext - The WebGL context to take a snapshot of. + * @param {Phaser.Types.Renderer.Snapshot.SnapshotState} config - The snapshot configuration object. */ -var Shake = new Class({ - - initialize: - - function Shake (camera) - { - /** - * The Camera this effect belongs to. - * - * @name Phaser.Cameras.Scene2D.Effects.Shake#camera - * @type {Phaser.Cameras.Scene2D.Camera} - * @readonly - * @since 3.5.0 - */ - this.camera = camera; - - /** - * Is this effect actively running? - * - * @name Phaser.Cameras.Scene2D.Effects.Shake#isRunning - * @type {boolean} - * @readonly - * @default false - * @since 3.5.0 - */ - this.isRunning = false; - - /** - * The duration of the effect, in milliseconds. - * - * @name Phaser.Cameras.Scene2D.Effects.Shake#duration - * @type {number} - * @readonly - * @default 0 - * @since 3.5.0 - */ - this.duration = 0; +var WebGLSnapshot = function (sourceContext, config) +{ + var gl = sourceContext; - /** - * The intensity of the effect. Use small float values. The default when the effect starts is 0.05. - * This is a Vector2 object, allowing you to control the shake intensity independently across x and y. - * You can modify this value while the effect is active to create more varied shake effects. - * - * @name Phaser.Cameras.Scene2D.Effects.Shake#intensity - * @type {Phaser.Math.Vector2} - * @since 3.5.0 - */ - this.intensity = new Vector2(); + var callback = GetFastValue(config, 'callback'); + var type = GetFastValue(config, 'type', 'image/png'); + var encoderOptions = GetFastValue(config, 'encoder', 0.92); + var x = Math.abs(Math.round(GetFastValue(config, 'x', 0))); + var y = Math.abs(Math.round(GetFastValue(config, 'y', 0))); - /** - * If this effect is running this holds the current percentage of the progress, a value between 0 and 1. - * - * @name Phaser.Cameras.Scene2D.Effects.Shake#progress - * @type {number} - * @since 3.5.0 - */ - this.progress = 0; + var getPixel = GetFastValue(config, 'getPixel', false); - /** - * Effect elapsed timer. - * - * @name Phaser.Cameras.Scene2D.Effects.Shake#_elapsed - * @type {number} - * @private - * @since 3.5.0 - */ - this._elapsed = 0; + var isFramebuffer = GetFastValue(config, 'isFramebuffer', false); - /** - * How much to offset the camera by horizontally. - * - * @name Phaser.Cameras.Scene2D.Effects.Shake#_offsetX - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._offsetX = 0; + var bufferWidth = (isFramebuffer) ? GetFastValue(config, 'bufferWidth', 1) : gl.drawingBufferWidth; + var bufferHeight = (isFramebuffer) ? GetFastValue(config, 'bufferHeight', 1) : gl.drawingBufferHeight; - /** - * How much to offset the camera by vertically. - * - * @name Phaser.Cameras.Scene2D.Effects.Shake#_offsetY - * @type {number} - * @private - * @default 0 - * @since 3.0.0 - */ - this._offsetY = 0; + if (getPixel) + { + var pixel = new Uint8Array(4); - /** - * This callback is invoked every frame for the duration of the effect. - * - * @name Phaser.Cameras.Scene2D.Effects.Shake#_onUpdate - * @type {?Phaser.Types.Cameras.Scene2D.CameraShakeCallback} - * @private - * @default null - * @since 3.5.0 - */ - this._onUpdate; + var destY = (isFramebuffer) ? y : bufferHeight - y; - /** - * On Complete callback scope. - * - * @name Phaser.Cameras.Scene2D.Effects.Shake#_onUpdateScope - * @type {any} - * @private - * @since 3.5.0 - */ - this._onUpdateScope; - }, + gl.readPixels(x, destY, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixel); - /** - * Shakes the Camera by the given intensity over the duration specified. - * - * @method Phaser.Cameras.Scene2D.Effects.Shake#start - * @fires Phaser.Cameras.Scene2D.Events#SHAKE_START - * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE - * @since 3.5.0 - * - * @param {number} [duration=100] - The duration of the effect in milliseconds. - * @param {(number|Phaser.Math.Vector2)} [intensity=0.05] - The intensity of the shake. - * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running. - * @param {Phaser.Types.Cameras.Scene2D.CameraShakeCallback} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. - * - * @return {Phaser.Cameras.Scene2D.Camera} The Camera on which the effect was started. - */ - start: function (duration, intensity, force, callback, context) + callback.call(null, new Color(pixel[0], pixel[1], pixel[2], pixel[3])); + } + else { - if (duration === undefined) { duration = 100; } - if (intensity === undefined) { intensity = 0.05; } - if (force === undefined) { force = false; } - if (callback === undefined) { callback = null; } - if (context === undefined) { context = this.camera.scene; } - - if (!force && this.isRunning) - { - return this.camera; - } + var width = Math.floor(GetFastValue(config, 'width', bufferWidth)); + var height = Math.floor(GetFastValue(config, 'height', bufferHeight)); - this.isRunning = true; - this.duration = duration; - this.progress = 0; + var total = width * height * 4; - if (typeof intensity === 'number') - { - this.intensity.set(intensity); - } - else - { - this.intensity.set(intensity.x, intensity.y); - } + var pixels = new Uint8Array(total); - this._elapsed = 0; - this._offsetX = 0; - this._offsetY = 0; + gl.readPixels(x, bufferHeight - y - height, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels); - this._onUpdate = callback; - this._onUpdateScope = context; + var canvas = CanvasPool.createWebGL(this, width, height); + var ctx = canvas.getContext('2d', { willReadFrequently: true }); - this.camera.emit(Events.SHAKE_START, this.camera, this, duration, intensity); + var imageData = ctx.getImageData(0, 0, width, height); - return this.camera; - }, + var data = imageData.data; - /** - * The pre-render step for this effect. Called automatically by the Camera. - * - * @method Phaser.Cameras.Scene2D.Effects.Shake#preRender - * @since 3.5.0 - */ - preRender: function () - { - if (this.isRunning) + for (var py = 0; py < height; py++) { - this.camera.matrix.translate(this._offsetX, this._offsetY); - } - }, + for (var px = 0; px < width; px++) + { + var sourceIndex = ((height - py - 1) * width + px) * 4; - /** - * The main update loop for this effect. Called automatically by the Camera. - * - * @method Phaser.Cameras.Scene2D.Effects.Shake#update - * @since 3.5.0 - * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. - */ - update: function (time, delta) - { - if (!this.isRunning) - { - return; - } + var destIndex = (isFramebuffer) ? total - ((py * width + (width - px)) * 4) : (py * width + px) * 4; - this._elapsed += delta; + data[destIndex + 0] = pixels[sourceIndex + 0]; + data[destIndex + 1] = pixels[sourceIndex + 1]; + data[destIndex + 2] = pixels[sourceIndex + 2]; + data[destIndex + 3] = pixels[sourceIndex + 3]; + } + } - this.progress = Clamp(this._elapsed / this.duration, 0, 1); + ctx.putImageData(imageData, 0, 0); - if (this._onUpdate) - { - this._onUpdate.call(this._onUpdateScope, this.camera, this.progress); - } + var image = new Image(); - if (this._elapsed < this.duration) + image.onerror = function () { - var intensity = this.intensity; - var width = this.camera.width; - var height = this.camera.height; - var zoom = this.camera.zoom; + callback.call(null); - this._offsetX = (Math.random() * intensity.x * width * 2 - intensity.x * width) * zoom; - this._offsetY = (Math.random() * intensity.y * height * 2 - intensity.y * height) * zoom; + CanvasPool.remove(canvas); + }; - if (this.camera.roundPixels) - { - this._offsetX = Math.round(this._offsetX); - this._offsetY = Math.round(this._offsetY); - } - } - else + image.onload = function () { - this.effectComplete(); - } - }, + callback.call(null, image); - /** - * Called internally when the effect completes. - * - * @method Phaser.Cameras.Scene2D.Effects.Shake#effectComplete - * @fires Phaser.Cameras.Scene2D.Events#SHAKE_COMPLETE - * @since 3.5.0 - */ - effectComplete: function () - { - this._offsetX = 0; - this._offsetY = 0; + CanvasPool.remove(canvas); + }; - this._onUpdate = null; - this._onUpdateScope = null; + image.src = canvas.toDataURL(type, encoderOptions); + } +}; - this.isRunning = false; +module.exports = WebGLSnapshot; - this.camera.emit(Events.SHAKE_COMPLETE, this.camera, this); - }, - /** - * Resets this camera effect. - * If it was previously running, it stops instantly without calling its onComplete callback or emitting an event. - * - * @method Phaser.Cameras.Scene2D.Effects.Shake#reset - * @since 3.5.0 - */ - reset: function () - { - this.isRunning = false; +/***/ }), - this._offsetX = 0; - this._offsetY = 0; +/***/ 95528: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this._onUpdate = null; - this._onUpdateScope = null; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Destroys this effect, releasing it from the Camera. - * - * @method Phaser.Cameras.Scene2D.Effects.Shake#destroy - * @since 3.5.0 - */ - destroy: function () - { - this.reset(); +/** + * @namespace Phaser.Renderer.Snapshot + */ - this.camera = null; - this.intensity = null; - } +module.exports = { -}); + Canvas: __webpack_require__(61840), + WebGL: __webpack_require__(1217) -module.exports = Shake; +}; /***/ }), -/* 797 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 35217: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @author Jason Nicholls - * @copyright 2018 Photon Storm Ltd. - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(18); -var Class = __webpack_require__(0); -var Events = __webpack_require__(37); -var EaseMap = __webpack_require__(134); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(65641); +var CustomMap = __webpack_require__(33885); +var Device = __webpack_require__(77290); +var GetFastValue = __webpack_require__(72632); +var RenderTarget = __webpack_require__(37410); +var SnapCeil = __webpack_require__(82127); + +// Default Phaser 3 Pipelines +var BitmapMaskPipeline = __webpack_require__(5583); +var FX = __webpack_require__(58136); +var FX_CONST = __webpack_require__(47406); +var FXPipeline = __webpack_require__(81828); +var LightPipeline = __webpack_require__(66901); +var MobilePipeline = __webpack_require__(71264); +var MultiPipeline = __webpack_require__(77310); +var PointLightPipeline = __webpack_require__(10919); +var RopePipeline = __webpack_require__(21213); +var SinglePipeline = __webpack_require__(51212); +var UtilityPipeline = __webpack_require__(60848); /** * @classdesc - * A Camera Rotate effect. + * The Pipeline Manager is responsible for the creation, activation, running and destruction + * of WebGL Pipelines and Post FX Pipelines in Phaser 3. * - * This effect will rotate the Camera so that the its viewport finishes at the given angle in radians, - * over the duration and with the ease specified. - * - * Camera rotation always takes place based on the Camera viewport. By default, rotation happens - * in the center of the viewport. You can adjust this with the `originX` and `originY` properties. + * The `WebGLRenderer` owns a single instance of the Pipeline Manager, which you can access + * via the `WebGLRenderer.pipelines` property. * - * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not - * rotate the Camera viewport itself, which always remains an axis-aligned rectangle. + * By default, there are 9 pipelines installed into the Pipeline Manager when Phaser boots: * - * Only the camera is rotates. None of the objects it is displaying are impacted, i.e. their positions do - * not change. + * 1. The Multi Pipeline. Responsible for all multi-texture rendering, i.e. Sprites and Tilemaps. + * 2. The Rope Pipeline. Responsible for rendering the Rope Game Object. + * 3. The Light Pipeline. Responsible for rendering the Light Game Object. + * 4. The Point Light Pipeline. Responsible for rendering the Point Light Game Object. + * 5. The Single Pipeline. Responsible for rendering Game Objects that explicitly require one bound texture. + * 6. The Bitmap Mask Pipeline. Responsible for Bitmap Mask rendering. + * 7. The Utility Pipeline. Responsible for providing lots of handy texture manipulation functions. + * 8. The Mobile Pipeline. Responsible for rendering on mobile with single-bound textures. + * 9. The FX Pipeline. Responsible for rendering Game Objects with special FX applied to them. * - * The effect will dispatch several events on the Camera itself and you can also specify an `onUpdate` callback, - * which is invoked each frame for the duration of the effect if required. + * You can add your own custom pipeline via the `PipelineManager.add` method. Pipelines are + * identified by unique string-based keys. * - * @class RotateTo - * @memberof Phaser.Cameras.Scene2D.Effects + * @class PipelineManager + * @memberof Phaser.Renderer.WebGL * @constructor - * @since 3.23.0 + * @since 3.50.0 * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera this effect is acting upon. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the WebGL Renderer that owns this Pipeline Manager. */ -var RotateTo = new Class({ +var PipelineManager = new Class({ initialize: - function RotateTo (camera) + function PipelineManager (renderer) { /** - * The Camera this effect belongs to. + * A reference to the Game instance. * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#camera - * @type {Phaser.Cameras.Scene2D.Camera} - * @readonly - * @since 3.23.0 + * @name Phaser.Renderer.WebGL.PipelineManager#game + * @type {Phaser.Game} + * @since 3.50.0 */ - this.camera = camera; + this.game = renderer.game; /** - * Is this effect actively running? + * A reference to the WebGL Renderer instance. * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#isRunning - * @type {boolean} - * @readonly - * @default false - * @since 3.23.0 + * @name Phaser.Renderer.WebGL.PipelineManager#renderer + * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.50.0 */ - this.isRunning = false; + this.renderer = renderer; /** - * The duration of the effect, in milliseconds. + * This map stores all pipeline classes available in this manager. * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#duration - * @type {number} - * @readonly - * @default 0 - * @since 3.23.0 - */ - this.duration = 0; - - /** - * The starting angle to rotate the camera from. - * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#source - * @type {number} - * @since 3.23.0 - */ - this.source = 0; - - /** - * The constantly updated value based on the force. - * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#current - * @type {number} - * @since 3.23.0 - */ - this.current = 0; - - /** - * The destination angle in radians to rotate the camera to. - * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#destination - * @type {number} - * @since 3.23.0 + * The Utility Class must always come first. + * + * @name Phaser.Renderer.WebGL.PipelineManager#classes + * @type {Phaser.Structs.Map.} + * @since 3.50.0 */ - this.destination = 0; + this.classes = new CustomMap([ + [ CONST.UTILITY_PIPELINE, UtilityPipeline ], + [ CONST.MULTI_PIPELINE, MultiPipeline ], + [ CONST.BITMAPMASK_PIPELINE, BitmapMaskPipeline ], + [ CONST.SINGLE_PIPELINE, SinglePipeline ], + [ CONST.ROPE_PIPELINE, RopePipeline ], + [ CONST.LIGHT_PIPELINE, LightPipeline ], + [ CONST.POINTLIGHT_PIPELINE, PointLightPipeline ], + [ CONST.MOBILE_PIPELINE, MobilePipeline ], + [ CONST.FX_PIPELINE, FXPipeline ] + ]); /** - * The ease function to use during the Rotate. - * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#ease - * @type {function} - * @since 3.23.0 + * This map stores all Post FX Pipeline classes available in this manager. + * + * As of v3.60 this is now populated by default with the following + * Post FX Pipelines: + * + * * Barrel + * * Bloom + * * Blur + * * Bokeh / TiltShift + * * Circle + * * ColorMatrix + * * Displacement + * * Glow + * * Gradient + * * Pixelate + * * Shadow + * * Shine + * * Vignette + * * Wipe + * + * See the FX Controller class for more details. + * + * @name Phaser.Renderer.WebGL.PipelineManager#postPipelineClasses + * @type {Phaser.Structs.Map.} + * @since 3.50.0 */ - this.ease; + this.postPipelineClasses = new CustomMap([ + [ String(FX_CONST.BARREL), FX.Barrel ], + [ String(FX_CONST.BLOOM), FX.Bloom ], + [ String(FX_CONST.BLUR), FX.Blur ], + [ String(FX_CONST.BOKEH), FX.Bokeh ], + [ String(FX_CONST.CIRCLE), FX.Circle ], + [ String(FX_CONST.COLOR_MATRIX), FX.ColorMatrix ], + [ String(FX_CONST.DISPLACEMENT), FX.Displacement ], + [ String(FX_CONST.GLOW), FX.Glow ], + [ String(FX_CONST.GRADIENT), FX.Gradient ], + [ String(FX_CONST.PIXELATE), FX.Pixelate ], + [ String(FX_CONST.SHADOW), FX.Shadow ], + [ String(FX_CONST.SHINE), FX.Shine ], + [ String(FX_CONST.VIGNETTE), FX.Vignette ], + [ String(FX_CONST.WIPE), FX.Wipe ] + ]); /** - * If this effect is running this holds the current percentage of the progress, a value between 0 and 1. + * This map stores all pipeline instances in this manager. * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#progress - * @type {number} - * @since 3.23.0 + * This is populated with the default pipelines in the `boot` method. + * + * @name Phaser.Renderer.WebGL.PipelineManager#pipelines + * @type {Phaser.Structs.Map.} + * @since 3.50.0 */ - this.progress = 0; + this.pipelines = new CustomMap(); /** - * Effect elapsed timer. + * The default Game Object pipeline. * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#_elapsed - * @type {number} - * @private - * @since 3.23.0 + * @name Phaser.Renderer.WebGL.PipelineManager#default + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @default null + * @since 3.60.0 */ - this._elapsed = 0; + this.default = null; /** - * @callback CameraRotateCallback + * Current pipeline in use by the WebGLRenderer. * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera on which the effect is running. - * @param {number} progress - The progress of the effect. A value between 0 and 1. - * @param {number} angle - The Camera's new angle in radians. + * @name Phaser.Renderer.WebGL.PipelineManager#current + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @default null + * @since 3.50.0 */ + this.current = null; /** - * This callback is invoked every frame for the duration of the effect. + * The previous WebGLPipeline that was in use. * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#_onUpdate - * @type {?CameraRotateCallback} - * @private + * This is set when `clearPipeline` is called and restored in `rebindPipeline` if none is given. + * + * @name Phaser.Renderer.WebGL.PipelineManager#previous + * @type {Phaser.Renderer.WebGL.WebGLPipeline} * @default null - * @since 3.23.0 + * @since 3.50.0 */ - this._onUpdate; + this.previous = null; /** - * On Complete callback scope. + * A constant-style reference to the Multi Pipeline Instance. * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#_onUpdateScope - * @type {any} - * @private - * @since 3.23.0 + * This is the default Phaser 3 pipeline and is used by the WebGL Renderer to manage + * camera effects and more. This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.PipelineManager#MULTI_PIPELINE + * @type {Phaser.Renderer.WebGL.Pipelines.MultiPipeline} + * @default null + * @since 3.50.0 */ - this._onUpdateScope; + this.MULTI_PIPELINE = null; /** - * The direction of the rotation. - * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#clockwise - * @type {boolean} - * @since 3.23.0 + * A constant-style reference to the Bitmap Mask Pipeline Instance. + * + * This is the default Phaser 3 mask pipeline and is used Game Objects using + * a Bitmap Mask. This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.PipelineManager#BITMAPMASK_PIPELINE + * @type {Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline} + * @default null + * @since 3.50.0 */ - this.clockwise = true; + this.BITMAPMASK_PIPELINE = null; /** - * The shortest direction to the target rotation. - * - * @name Phaser.Cameras.Scene2D.Effects.RotateTo#shortestPath - * @type {boolean} - * @since 3.23.0 + * A constant-style reference to the Utility Pipeline Instance. + * + * @name Phaser.Renderer.WebGL.PipelineManager#UTILITY_PIPELINE + * @type {Phaser.Renderer.WebGL.Pipelines.UtilityPipeline} + * @default null + * @since 3.50.0 */ - this.shortestPath = false; - }, - - /** - * This effect will scroll the Camera so that the center of its viewport finishes at the given angle, - * over the duration and with the ease specified. - * - * @method Phaser.Cameras.Scene2D.Effects.RotateTo#start - * @fires Phaser.Cameras.Scene2D.Events#ROTATE_START - * @fires Phaser.Cameras.Scene2D.Events#ROTATE_COMPLETE - * @since 3.23.0 - * - * @param {number} radians - The destination angle in radians to rotate the Camera viewport to. If the angle is positive then the rotation is clockwise else anticlockwise - * @param {boolean} [shortestPath=false] - If shortest path is set to true the camera will rotate in the quickest direction clockwise or anti-clockwise. - * @param {number} [duration=1000] - The duration of the effect in milliseconds. - * @param {(string|function)} [ease='Linear'] - The ease to use for the Rotate. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the rotation effect to start immediately, even if already running. - * @param {CameraRotateCallback} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, - * the current camera scroll x coordinate and the current camera scroll y coordinate. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. - * - * @return {Phaser.Cameras.Scene2D.Camera} The Camera on which the effect was started. - */ - start: function (radians, shortestPath, duration, ease, force, callback, context) - { - if (duration === undefined) { duration = 1000; } - if (ease === undefined) { ease = EaseMap.Linear; } - if (force === undefined) { force = false; } - if (callback === undefined) { callback = null; } - if (context === undefined) { context = this.camera.scene; } - if (shortestPath === undefined) { shortestPath = false; } - - this.shortestPath = shortestPath; - - var tmpDestination = radians; - - if (radians < 0) - { - tmpDestination = -1 * radians; - this.clockwise = false; - } - else - { - this.clockwise = true; - } - - var maxRad = (360 * Math.PI) / 180; - - tmpDestination = tmpDestination - (Math.floor(tmpDestination / maxRad) * maxRad); - - var cam = this.camera; - - if (!force && this.isRunning) - { - return cam; - } - - this.isRunning = true; - this.duration = duration; - this.progress = 0; - - // Starting from - this.source = cam.rotation; - - // Destination - this.destination = tmpDestination; - - // Using this ease - if (typeof ease === 'string' && EaseMap.hasOwnProperty(ease)) - { - this.ease = EaseMap[ease]; - } - else if (typeof ease === 'function') - { - this.ease = ease; - } - - this._elapsed = 0; - - this._onUpdate = callback; - this._onUpdateScope = context; - - - if (this.shortestPath) - { - // The shortest path is true so calculate the quickest direction - var cwDist = 0; - var acwDist = 0; - - if (this.destination > this.source) - { - cwDist = Math.abs(this.destination - this.source); - } - else - { - cwDist = (Math.abs(this.destination + maxRad) - this.source); - } - - if (this.source > this.destination) - { - acwDist = Math.abs(this.source - this.destination); - } - else - { - acwDist = (Math.abs(this.source + maxRad) - this.destination); - } - - if (cwDist < acwDist) - { - this.clockwise = true; - } - else if (cwDist > acwDist) - { - this.clockwise = false; - } - } - - this.camera.emit(Events.ROTATE_START, this.camera, this, duration, tmpDestination); - - return cam; - }, - - /** - * The main update loop for this effect. Called automatically by the Camera. - * - * @method Phaser.Cameras.Scene2D.Effects.RotateTo#update - * @since 3.23.0 - * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. - */ - update: function (time, delta) - { - if (!this.isRunning) - { - return; - } - - this._elapsed += delta; - - var progress = Clamp(this._elapsed / this.duration, 0, 1); - - this.progress = progress; - - var cam = this.camera; - - if (this._elapsed < this.duration) - { - var v = this.ease(progress); - - this.current = cam.rotation; - var distance = 0; - var maxRad = (360 * Math.PI) / 180; - var target = this.destination; - var current = this.current; - - if (this.clockwise === false) - { - target = this.current; - current = this.destination; - } - - if (target >= current) - { - distance = Math.abs(target - current); - } - else - { - distance = (Math.abs(target + maxRad) - current); - } - - var r = 0; - - if (this.clockwise) - { - r = (cam.rotation + (distance * v)); - } - else - { - r = (cam.rotation - (distance * v)); - } - - cam.rotation = r; - - if (this._onUpdate) - { - this._onUpdate.call(this._onUpdateScope, cam, progress, r); - } - } - else - { - cam.rotation = this.destination; - - if (this._onUpdate) - { - this._onUpdate.call(this._onUpdateScope, cam, progress, this.destination); - } - - this.effectComplete(); - } - }, - - /** - * Called internally when the effect completes. - * - * @method Phaser.Cameras.Scene2D.Effects.RotateTo#effectComplete - * @since 3.23.0 - */ - effectComplete: function () - { - this._onUpdate = null; - this._onUpdateScope = null; - - this.isRunning = false; - - this.camera.emit(Events.ROTATE_COMPLETE, this.camera, this); - }, - - /** - * Resets this camera effect. - * If it was previously running, it stops instantly without calling its onComplete callback or emitting an event. - * - * @method Phaser.Cameras.Scene2D.Effects.RotateTo#reset - * @since 3.23.0 - */ - reset: function () - { - this.isRunning = false; - - this._onUpdate = null; - this._onUpdateScope = null; - }, - - /** - * Destroys this effect, releasing it from the Camera. - * - * @method Phaser.Cameras.Scene2D.Effects.RotateTo#destroy - * @since 3.23.0 - */ - destroy: function () - { - this.reset(); - - this.camera = null; - this.source = null; - this.destination = null; - } - -}); - -module.exports = RotateTo; - - -/***/ }), -/* 798 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Clamp = __webpack_require__(18); -var Class = __webpack_require__(0); -var EaseMap = __webpack_require__(134); -var Events = __webpack_require__(37); - -/** - * @classdesc - * A Camera Zoom effect. - * - * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. - * - * The effect will dispatch several events on the Camera itself and you can also specify an `onUpdate` callback, - * which is invoked each frame for the duration of the effect if required. - * - * @class Zoom - * @memberof Phaser.Cameras.Scene2D.Effects - * @constructor - * @since 3.11.0 - * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera this effect is acting upon. - */ -var Zoom = new Class({ - - initialize: + this.UTILITY_PIPELINE = null; - function Zoom (camera) - { /** - * The Camera this effect belongs to. + * A constant-style reference to the Mobile Pipeline Instance. * - * @name Phaser.Cameras.Scene2D.Effects.Zoom#camera - * @type {Phaser.Cameras.Scene2D.Camera} - * @readonly - * @since 3.11.0 + * This is the default Phaser 3 mobile pipeline and is used by the WebGL Renderer to manage + * camera effects and more on mobile devices. This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.PipelineManager#MOBILE_PIPELINE + * @type {Phaser.Renderer.WebGL.Pipelines.MobilePipeline} + * @default null + * @since 3.60.0 */ - this.camera = camera; + this.MOBILE_PIPELINE = null; /** - * Is this effect actively running? + * A constant-style reference to the FX Pipeline Instance. * - * @name Phaser.Cameras.Scene2D.Effects.Zoom#isRunning - * @type {boolean} - * @readonly - * @default false - * @since 3.11.0 + * This is the default Phaser 3 FX pipeline and is used by the WebGL Renderer to manage + * Game Objects with special effects enabled. This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.PipelineManager#FX_PIPELINE + * @type {Phaser.Renderer.WebGL.Pipelines.FXPipeline} + * @default null + * @since 3.60.0 */ - this.isRunning = false; + this.FX_PIPELINE = null; /** - * The duration of the effect, in milliseconds. + * A reference to the Full Frame 1 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. * - * @name Phaser.Cameras.Scene2D.Effects.Zoom#duration - * @type {number} - * @readonly - * @default 0 - * @since 3.11.0 + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.PipelineManager#fullFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 */ - this.duration = 0; + this.fullFrame1; /** - * The starting zoom value; + * A reference to the Full Frame 2 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. * - * @name Phaser.Cameras.Scene2D.Effects.Zoom#source - * @type {number} - * @since 3.11.0 + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.PipelineManager#fullFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 */ - this.source = 1; + this.fullFrame2; /** - * The destination zoom value. + * A reference to the Half Frame 1 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. * - * @name Phaser.Cameras.Scene2D.Effects.Zoom#destination - * @type {number} - * @since 3.11.0 + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.PipelineManager#halfFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 */ - this.destination = 1; + this.halfFrame1; /** - * The ease function to use during the zoom. + * A reference to the Half Frame 2 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. * - * @name Phaser.Cameras.Scene2D.Effects.Zoom#ease - * @type {function} - * @since 3.11.0 + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.PipelineManager#halfFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 */ - this.ease; + this.halfFrame2; /** - * If this effect is running this holds the current percentage of the progress, a value between 0 and 1. + * An array of RenderTarget instances that belong to this pipeline. * - * @name Phaser.Cameras.Scene2D.Effects.Zoom#progress - * @type {number} - * @since 3.11.0 + * @name Phaser.Renderer.WebGL.PipelineManager#renderTargets + * @type {Phaser.Renderer.WebGL.RenderTarget[]} + * @since 3.60.0 */ - this.progress = 0; + this.renderTargets = []; /** - * Effect elapsed timer. + * The largest render target dimension before we just use a full-screen target. * - * @name Phaser.Cameras.Scene2D.Effects.Zoom#_elapsed + * @name Phaser.Renderer.WebGL.PipelineManager#maxDimension * @type {number} - * @private - * @since 3.11.0 + * @since 3.60.0 */ - this._elapsed = 0; + this.maxDimension = 0; /** - * This callback is invoked every frame for the duration of the effect. + * The amount in which each target frame will increase. * - * @name Phaser.Cameras.Scene2D.Effects.Zoom#_onUpdate - * @type {?Phaser.Types.Cameras.Scene2D.CameraZoomCallback} - * @private - * @default null - * @since 3.11.0 + * Defaults to 32px but can be overridden in the config. + * + * @name Phaser.Renderer.WebGL.PipelineManager#frameInc + * @type {number} + * @since 3.60.0 */ - this._onUpdate; + this.frameInc = 32; /** - * On Complete callback scope. + * The Render Target index. Used internally by the methods + * in this class. Do not modify directly. * - * @name Phaser.Cameras.Scene2D.Effects.Zoom#_onUpdateScope - * @type {any} - * @private - * @since 3.11.0 + * @name Phaser.Renderer.WebGL.PipelineManager#targetIndex + * @type {number} + * @since 3.60.0 */ - this._onUpdateScope; + this.targetIndex = 0; }, /** - * This effect will zoom the Camera to the given scale, over the duration and with the ease specified. + * Internal boot handler, called by the WebGLRenderer durings its boot process. * - * @method Phaser.Cameras.Scene2D.Effects.Zoom#start - * @fires Phaser.Cameras.Scene2D.Events#ZOOM_START - * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE - * @since 3.11.0 + * Adds all of the default pipelines, based on the game config, and then calls + * the `boot` method on each one of them. * - * @param {number} zoom - The target Camera zoom value. - * @param {number} [duration=1000] - The duration of the effect in milliseconds. - * @param {(string|function)} [ease='Linear'] - The ease to use for the Zoom. Can be any of the Phaser Easing constants or a custom function. - * @param {boolean} [force=false] - Force the zoom effect to start immediately, even if already running. - * @param {Phaser.Types.Cameras.Scene2D.CameraZoomCallback} [callback] - This callback will be invoked every frame for the duration of the effect. - * It is sent three arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, - * and the current camera zoom value. - * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. + * Finally, the default pipeline is set. * - * @return {Phaser.Cameras.Scene2D.Camera} The Camera on which the effect was started. + * @method Phaser.Renderer.WebGL.PipelineManager#boot + * @since 3.50.0 + * + * @param {Phaser.Types.Core.PipelineConfig} pipelineConfig - The pipeline configuration object as set in the Game Config. + * @param {string} defaultPipeline - The name of the default Game Object pipeline, as set in the Game Config + * @param {boolean} autoMobilePipeline - Automatically set the default pipeline to mobile if non-desktop detected? */ - start: function (zoom, duration, ease, force, callback, context) + boot: function (pipelineConfig, defaultPipeline, autoMobilePipeline) { - if (duration === undefined) { duration = 1000; } - if (ease === undefined) { ease = EaseMap.Linear; } - if (force === undefined) { force = false; } - if (callback === undefined) { callback = null; } - if (context === undefined) { context = this.camera.scene; } + // Create the default RenderTextures + var renderer = this.renderer; + var targets = this.renderTargets; - var cam = this.camera; + this.frameInc = Math.floor(GetFastValue(pipelineConfig, 'frameInc', 32)); - if (!force && this.isRunning) + var renderWidth = renderer.width; + var renderHeight = renderer.height; + + var minDimension = Math.min(renderWidth, renderHeight); + + var qty = Math.ceil(minDimension / this.frameInc); + + for (var i = 1; i < qty; i++) { - return cam; + var targetWidth = i * this.frameInc; + + targets.push(new RenderTarget(renderer, targetWidth, targetWidth)); + + // Duplicate RT for swap frame + targets.push(new RenderTarget(renderer, targetWidth, targetWidth)); + + // Duplicate RT for alt swap frame + targets.push(new RenderTarget(renderer, targetWidth, targetWidth)); + + this.maxDimension = targetWidth; } - this.isRunning = true; - this.duration = duration; - this.progress = 0; + // Full-screen RTs + targets.push(new RenderTarget(renderer, renderWidth, renderHeight, 1, 0, true, true)); + targets.push(new RenderTarget(renderer, renderWidth, renderHeight, 1, 0, true, true)); + targets.push(new RenderTarget(renderer, renderWidth, renderHeight, 1, 0, true, true)); - // Starting from - this.source = cam.zoom; + // Install each of the default pipelines - // Zooming to - this.destination = zoom; + var instance; + var pipelineName; - // Using this ease - if (typeof ease === 'string' && EaseMap.hasOwnProperty(ease)) + var _this = this; + var game = this.game; + + this.classes.each(function (pipelineName, pipeline) { - this.ease = EaseMap[ease]; - } - else if (typeof ease === 'function') + instance = _this.add(pipelineName, new pipeline({ game: game })); + + if (pipelineName === CONST.UTILITY_PIPELINE) + { + _this.UTILITY_PIPELINE = instance; + + // FBO references + _this.fullFrame1 = instance.fullFrame1; + _this.fullFrame2 = instance.fullFrame2; + _this.halfFrame1 = instance.halfFrame1; + _this.halfFrame2 = instance.halfFrame2; + } + }); + + // Our const-like references + this.MULTI_PIPELINE = this.get(CONST.MULTI_PIPELINE); + this.BITMAPMASK_PIPELINE = this.get(CONST.BITMAPMASK_PIPELINE); + this.MOBILE_PIPELINE = this.get(CONST.MOBILE_PIPELINE); + this.FX_PIPELINE = this.get(CONST.FX_PIPELINE); + + // And now the ones in the config, if any + + if (pipelineConfig) { - this.ease = ease; + for (pipelineName in pipelineConfig) + { + var pipelineClass = pipelineConfig[pipelineName]; + + instance = new pipelineClass(game); + + instance.name = pipelineName; + + if (instance.isPostFX) + { + this.postPipelineClasses.set(pipelineName, pipelineClass); + } + else if (!this.has(pipelineName)) + { + this.classes.set(pipelineName, pipelineClass); + + this.add(pipelineName, instance); + } + } } - this._elapsed = 0; + // Finally, set the Default Game Object pipeline + this.default = this.get(defaultPipeline); - this._onUpdate = callback; - this._onUpdateScope = context; + if (autoMobilePipeline && !Device.os.desktop) + { + this.default = this.MOBILE_PIPELINE; + } + }, - this.camera.emit(Events.ZOOM_START, this.camera, this, duration, zoom); + /** + * Sets the default pipeline being used by Game Objects. + * + * If no instance, or matching name, exists in this manager, it returns `undefined`. + * + * You can use this to override the default pipeline, for example by forcing + * the Mobile or Multi Tint Pipelines, which is especially useful for development + * testing. + * + * Make sure you call this method _before_ creating any Game Objects, as it will + * only impact Game Objects created after you call it. + * + * @method Phaser.Renderer.WebGL.PipelineManager#setDefaultPipeline + * @since 3.60.0 + * + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance to look-up. + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline instance that was set as default, or `undefined` if not found. + */ + setDefaultPipeline: function (pipeline) + { + var instance = this.get(pipeline); - return cam; + if (instance) + { + this.default = instance; + } + + return instance; }, /** - * The main update loop for this effect. Called automatically by the Camera. + * Adds a pipeline instance to this Pipeline Manager. * - * @method Phaser.Cameras.Scene2D.Effects.Zoom#update - * @since 3.11.0 + * The name of the instance must be unique within this manager. * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * Make sure to pass an instance to this method, not a base class. + * + * For example, you should pass it like this: + * + * ```javascript + * this.add('yourName', new CustomPipeline(game));` + * ``` + * + * and **not** like this: + * + * ```javascript + * this.add('yourName', CustomPipeline);` + * ``` + * + * To add a **Post Pipeline**, see `addPostPipeline` instead. + * + * @method Phaser.Renderer.WebGL.PipelineManager#add + * @since 3.50.0 + * + * @param {string} name - A unique string-based key for the pipeline within the manager. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - A pipeline _instance_ which must extend `WebGLPipeline`. + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline instance that was passed. */ - update: function (time, delta) + add: function (name, pipeline) { - if (!this.isRunning) + if (pipeline.isPostFX) { + console.warn(name + ' is a Post Pipeline. Use `addPostPipeline` instead'); + return; } - this._elapsed += delta; - - this.progress = Clamp(this._elapsed / this.duration, 0, 1); + var pipelines = this.pipelines; + var renderer = this.renderer; - if (this._elapsed < this.duration) + if (!pipelines.has(name)) { - this.camera.zoom = this.source + ((this.destination - this.source) * this.ease(this.progress)); + pipeline.name = name; + pipeline.manager = this; - if (this._onUpdate) - { - this._onUpdate.call(this._onUpdateScope, this.camera, this.progress, this.camera.zoom); - } + pipelines.set(name, pipeline); } else { - this.camera.zoom = this.destination; + console.warn('Pipeline exists: ' + name); + } - if (this._onUpdate) - { - this._onUpdate.call(this._onUpdateScope, this.camera, this.progress, this.destination); - } + if (!pipeline.hasBooted) + { + pipeline.boot(); + } - this.effectComplete(); + if (renderer.width !== 0 && renderer.height !== 0 && !pipeline.isPreFX) + { + pipeline.resize(renderer.width, renderer.height); } + + return pipeline; }, /** - * Called internally when the effect completes. + * Adds a Post Pipeline to this Pipeline Manager. * - * @method Phaser.Cameras.Scene2D.Effects.Zoom#effectComplete - * @fires Phaser.Cameras.Scene2D.Events#ZOOM_COMPLETE - * @since 3.11.0 + * Make sure to pass a base class to this method, not an instance. + * + * For example, you should pass it like this: + * + * ```javascript + * this.addPostPipeline('yourName', CustomPipeline);` + * ``` + * + * and **not** like this: + * + * ```javascript + * this.addPostPipeline('yourName', new CustomPipeline());` + * ``` + * + * To add a regular pipeline, see the `add` method instead. + * + * @method Phaser.Renderer.WebGL.PipelineManager#addPostPipeline + * @since 3.50.0 + * + * @param {string} name - A unique string-based key for the pipeline within the manager. + * @param {function} pipeline - A pipeline class which must extend `PostFXPipeline`. + * + * @return {this} This Pipeline Manager. */ - effectComplete: function () + addPostPipeline: function (name, pipeline) { - this._onUpdate = null; - this._onUpdateScope = null; - - this.isRunning = false; - - this.camera.emit(Events.ZOOM_COMPLETE, this.camera, this); + if (!this.postPipelineClasses.has(name)) + { + this.postPipelineClasses.set(name, pipeline); + } }, /** - * Resets this camera effect. - * If it was previously running, it stops instantly without calling its onComplete callback or emitting an event. + * Flushes the current pipeline, if one is bound. * - * @method Phaser.Cameras.Scene2D.Effects.Zoom#reset - * @since 3.11.0 + * @method Phaser.Renderer.WebGL.PipelineManager#flush + * @since 3.50.0 */ - reset: function () + flush: function () { - this.isRunning = false; - - this._onUpdate = null; - this._onUpdateScope = null; + if (this.current) + { + this.current.flush(); + } }, /** - * Destroys this effect, releasing it from the Camera. + * Checks if a pipeline is present in this Pipeline Manager. * - * @method Phaser.Cameras.Scene2D.Effects.Zoom#destroy - * @since 3.11.0 + * @method Phaser.Renderer.WebGL.PipelineManager#has + * @since 3.50.0 + * + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance to look-up. + * + * @return {boolean} `true` if the given pipeline is loaded, otherwise `false`. */ - destroy: function () - { - this.reset(); - - this.camera = null; - } - -}); - -module.exports = Zoom; - - -/***/ }), -/* 799 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Camera = __webpack_require__(326); -var Class = __webpack_require__(0); -var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(24); -var RectangleContains = __webpack_require__(57); -var ScaleEvents = __webpack_require__(104); -var SceneEvents = __webpack_require__(20); - -/** - * @classdesc - * The Camera Manager is a plugin that belongs to a Scene and is responsible for managing all of the Scene Cameras. - * - * By default you can access the Camera Manager from within a Scene using `this.cameras`, although this can be changed - * in your game config. - * - * Create new Cameras using the `add` method. Or extend the Camera class with your own addition code and then add - * the new Camera in using the `addExisting` method. - * - * Cameras provide a view into your game world, and can be positioned, rotated, zoomed and scrolled accordingly. - * - * A Camera consists of two elements: The viewport and the scroll values. - * - * The viewport is the physical position and size of the Camera within your game. Cameras, by default, are - * created the same size as your game, but their position and size can be set to anything. This means if you - * wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game, - * you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`). - * - * If you wish to change where the Camera is looking in your game, then you scroll it. You can do this - * via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the - * viewport, and changing the viewport has no impact on the scrolling. - * - * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method, - * allowing you to filter Game Objects out on a per-Camera basis. The Camera Manager can manage up to 31 unique - * 'Game Object ignore capable' Cameras. Any Cameras beyond 31 that you create will all be given a Camera ID of - * zero, meaning that they cannot be used for Game Object exclusion. This means if you need your Camera to ignore - * Game Objects, make sure it's one of the first 31 created. - * - * A Camera also has built-in special effects including Fade, Flash, Camera Shake, Pan and Zoom. - * - * @class CameraManager - * @memberof Phaser.Cameras.Scene2D - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene that owns the Camera Manager plugin. - */ -var CameraManager = new Class({ - - initialize: - - function CameraManager (scene) + has: function (pipeline) { - /** - * The Scene that owns the Camera Manager plugin. - * - * @name Phaser.Cameras.Scene2D.CameraManager#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; - - /** - * A reference to the Scene.Systems handler for the Scene that owns the Camera Manager. - * - * @name Phaser.Cameras.Scene2D.CameraManager#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; - - /** - * All Cameras created by, or added to, this Camera Manager, will have their `roundPixels` - * property set to match this value. By default it is set to match the value set in the - * game configuration, but can be changed at any point. Equally, individual cameras can - * also be changed as needed. - * - * @name Phaser.Cameras.Scene2D.CameraManager#roundPixels - * @type {boolean} - * @since 3.11.0 - */ - this.roundPixels = scene.sys.game.config.roundPixels; - - /** - * An Array of the Camera objects being managed by this Camera Manager. - * The Cameras are updated and rendered in the same order in which they appear in this array. - * Do not directly add or remove entries to this array. However, you can move the contents - * around the array should you wish to adjust the display order. - * - * @name Phaser.Cameras.Scene2D.CameraManager#cameras - * @type {Phaser.Cameras.Scene2D.Camera[]} - * @since 3.0.0 - */ - this.cameras = []; - - /** - * A handy reference to the 'main' camera. By default this is the first Camera the - * Camera Manager creates. You can also set it directly, or use the `makeMain` argument - * in the `add` and `addExisting` methods. It allows you to access it from your game: - * - * ```javascript - * var cam = this.cameras.main; - * ``` - * - * Also see the properties `camera1`, `camera2` and so on. - * - * @name Phaser.Cameras.Scene2D.CameraManager#main - * @type {Phaser.Cameras.Scene2D.Camera} - * @since 3.0.0 - */ - this.main; + var pipelines = this.pipelines; - /** - * A default un-transformed Camera that doesn't exist on the camera list and doesn't - * count towards the total number of cameras being managed. It exists for other - * systems, as well as your own code, should they require a basic un-transformed - * camera instance from which to calculate a view matrix. - * - * @name Phaser.Cameras.Scene2D.CameraManager#default - * @type {Phaser.Cameras.Scene2D.Camera} - * @since 3.17.0 - */ - this.default; + if (typeof pipeline === 'string') + { + return pipelines.has(pipeline); + } + else if (pipelines.contains(pipeline)) + { + return true; + } - scene.sys.events.once(SceneEvents.BOOT, this.boot, this); - scene.sys.events.on(SceneEvents.START, this.start, this); + return false; }, /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. + * Returns the pipeline instance based on the given name, or instance. * - * @method Phaser.Cameras.Scene2D.CameraManager#boot - * @private - * @listens Phaser.Scenes.Events#DESTROY - * @since 3.5.1 + * If no instance, or matching name, exists in this manager, it returns `undefined`. + * + * @method Phaser.Renderer.WebGL.PipelineManager#get + * @since 3.50.0 + * + * @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance to look-up. + * + * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline instance, or `undefined` if not found. */ - boot: function () + get: function (pipeline) { - var sys = this.systems; + var pipelines = this.pipelines; - if (sys.settings.cameras) + if (typeof pipeline === 'string') { - // We have cameras to create - this.fromJSON(sys.settings.cameras); + return pipelines.get(pipeline); } - else + else if (pipelines.contains(pipeline)) { - // Make one - this.add(); + return pipeline; } - - this.main = this.cameras[0]; - - // Create a default camera - this.default = new Camera(0, 0, sys.scale.width, sys.scale.height).setScene(this.scene); - - sys.game.scale.on(ScaleEvents.RESIZE, this.onResize, this); - - this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. + * Returns a _new instance_ of the post pipeline based on the given name, or class. * - * @method Phaser.Cameras.Scene2D.CameraManager#start - * @private - * @listens Phaser.Scenes.Events#UPDATE - * @listens Phaser.Scenes.Events#SHUTDOWN - * @since 3.5.0 + * If no instance, or matching name, exists in this manager, it returns `undefined`. + * + * @method Phaser.Renderer.WebGL.PipelineManager#getPostPipeline + * @since 3.50.0 + * + * @param {(string|function|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline)} pipeline - Either the string-based name of the pipeline to get, or a pipeline instance, or class to look-up. + * @param {Phaser.GameObjects.GameObject} [gameObject] - If this post pipeline is being installed into a Game Object or Camera, this is a reference to it. + * @param {object} [config] - Optional pipeline data object that is set in to the `postPipelineData` property of this Game Object. + * + * @return {Phaser.Renderer.WebGL.Pipelines.PostFXPipeline} The pipeline instance, or `undefined` if not found. */ - start: function () + getPostPipeline: function (pipeline, gameObject, config) { - if (!this.main) - { - var sys = this.systems; + var pipelineClasses = this.postPipelineClasses; - if (sys.settings.cameras) - { - // We have cameras to create - this.fromJSON(sys.settings.cameras); - } - else + var instance; + var pipelineName = ''; + var pipetype = typeof pipeline; + + if (pipetype === 'string' || pipetype === 'number') + { + instance = pipelineClasses.get(pipeline); + pipelineName = pipeline; + } + else if (pipetype === 'function') + { + // A class + if (pipelineClasses.contains(pipeline)) { - // Make one - this.add(); + instance = pipeline; } - this.main = this.cameras[0]; + pipelineName = pipeline.name; + } + else if (pipetype === 'object') + { + // Instance + instance = pipelineClasses.get(pipeline.name); + + pipelineName = pipeline.name; } - var eventEmitter = this.systems.events; + if (instance) + { + var newPipeline = new instance(this.game, config); - eventEmitter.on(SceneEvents.UPDATE, this.update, this); - eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); + newPipeline.name = pipelineName; + + if (gameObject) + { + newPipeline.gameObject = gameObject; + } + + return newPipeline; + } }, /** - * Adds a new Camera into the Camera Manager. The Camera Manager can support up to 31 different Cameras. - * - * Each Camera has its own viewport, which controls the size of the Camera and its position within the canvas. - * - * Use the `Camera.scrollX` and `Camera.scrollY` properties to change where the Camera is looking, or the - * Camera methods such as `centerOn`. Cameras also have built in special effects, such as fade, flash, shake, - * pan and zoom. - * - * By default Cameras are transparent and will render anything that they can see based on their `scrollX` - * and `scrollY` values. Game Objects can be set to be ignored by a Camera by using the `Camera.ignore` method. - * - * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change - * it after creation if required. + * Removes a pipeline instance based on the given name. * - * See the Camera class documentation for more details. + * If no pipeline matches the name, this method does nothing. * - * @method Phaser.Cameras.Scene2D.CameraManager#add - * @since 3.0.0 + * Note that the pipeline will not be flushed or destroyed, it's simply removed from + * this manager. * - * @param {number} [x=0] - The horizontal position of the Camera viewport. - * @param {number} [y=0] - The vertical position of the Camera viewport. - * @param {number} [width] - The width of the Camera viewport. If not given it'll be the game config size. - * @param {number} [height] - The height of the Camera viewport. If not given it'll be the game config size. - * @param {boolean} [makeMain=false] - Set this Camera as being the 'main' camera. This just makes the property `main` a reference to it. - * @param {string} [name=''] - The name of the Camera. + * @method Phaser.Renderer.WebGL.PipelineManager#remove + * @since 3.50.0 * - * @return {Phaser.Cameras.Scene2D.Camera} The newly created Camera. + * @param {string} name - The name of the pipeline to be removed. + * @param {boolean} [removeClass=true] - Remove the pipeline class as well as the instance? + * @param {boolean} [removePostPipelineClass=true] - Remove the post pipeline class as well as the instance? */ - add: function (x, y, width, height, makeMain, name) + remove: function (name, removeClass, removePostPipelineClass) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = this.scene.sys.scale.width; } - if (height === undefined) { height = this.scene.sys.scale.height; } - if (makeMain === undefined) { makeMain = false; } - if (name === undefined) { name = ''; } - - var camera = new Camera(x, y, width, height); - - camera.setName(name); - camera.setScene(this.scene); - camera.setRoundPixels(this.roundPixels); - - camera.id = this.getNextID(); + if (removeClass === undefined) { removeClass = true; } + if (removePostPipelineClass === undefined) { removePostPipelineClass = true; } - this.cameras.push(camera); + this.pipelines.delete(name); - if (makeMain) + if (removeClass) { - this.main = camera; + this.classes.delete(name); } - return camera; + if (removePostPipelineClass) + { + this.postPipelineClasses.delete(name); + } }, /** - * Adds an existing Camera into the Camera Manager. - * - * The Camera should either be a `Phaser.Cameras.Scene2D.Camera` instance, or a class that extends from it. + * Sets the current pipeline to be used by the `WebGLRenderer`. * - * The Camera will have its `roundPixels` property set to whatever `CameraManager.roundPixels` is. You can change - * it after addition if required. + * This method accepts a pipeline instance as its parameter, not the name. * - * The Camera will be assigned an ID, which is used for Game Object exclusion and then added to the - * manager. As long as it doesn't already exist in the manager it will be added then returned. + * If the pipeline isn't already the current one it will call `WebGLPipeline.bind` and then `onBind`. * - * If this method returns `null` then the Camera already exists in this Camera Manager. + * You cannot set Post FX Pipelines using this method. To use a Post FX Pipeline, you should + * apply it to either a Camera, Container or other supporting Game Object. * - * @method Phaser.Cameras.Scene2D.CameraManager#addExisting - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.PipelineManager#set + * @since 3.50.0 * - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to be added to the Camera Manager. - * @param {boolean} [makeMain=false] - Set this Camera as being the 'main' camera. This just makes the property `main` a reference to it. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline instance to be set as current. + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. * - * @return {?Phaser.Cameras.Scene2D.Camera} The Camera that was added to the Camera Manager, or `null` if it couldn't be added. + * @return {Phaser.Renderer.WebGL.WebGLPipeline} The pipeline that was set, or undefined if it couldn't be set. */ - addExisting: function (camera, makeMain) + set: function (pipeline, gameObject, currentShader) { - if (makeMain === undefined) { makeMain = false; } - - var index = this.cameras.indexOf(camera); - - if (index === -1) + if (pipeline.isPostFX) { - camera.id = this.getNextID(); - - camera.setRoundPixels(this.roundPixels); + return; + } - this.cameras.push(camera); + if (!this.isCurrent(pipeline, currentShader)) + { + this.flush(); - if (makeMain) + if (this.current) { - this.main = camera; + this.current.unbind(); } - return camera; + this.current = pipeline; + + pipeline.bind(currentShader); } - return null; + pipeline.updateProjectionMatrix(); + + pipeline.onBind(gameObject); + + return pipeline; }, /** - * Gets the next available Camera ID number. + * This method is called by the `WebGLPipeline.batchQuad` method, right before a quad + * belonging to a Game Object is about to be added to the batch. * - * The Camera Manager supports up to 31 unique cameras, after which the ID returned will always be zero. - * You can create additional cameras beyond 31, but they cannot be used for Game Object exclusion. + * It is also called directly bu custom Game Objects, such as Nine Slice or Mesh, + * from their render methods. * - * @method Phaser.Cameras.Scene2D.CameraManager#getNextID - * @private - * @since 3.11.0 + * It causes a batch flush, then calls the `preBatch` method on the Post FX Pipelines + * belonging to the Game Object. * - * @return {number} The next available Camera ID, or 0 if they're all already in use. + * It should be followed by a call to `postBatch` to complete the process. + * + * @method Phaser.Renderer.WebGL.PipelineManager#preBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object about to be batched. */ - getNextID: function () + preBatch: function (gameObject) { - var cameras = this.cameras; - - var testID = 1; - - // Find the first free camera ID we can use - - for (var t = 0; t < 32; t++) + if (gameObject.hasPostPipeline) { - var found = false; + this.flush(); - for (var i = 0; i < cameras.length; i++) + var pipelines = gameObject.postPipelines; + + // Iterate in reverse because we need them stacked in the order they're in the array + for (var i = pipelines.length - 1; i >= 0; i--) { - var camera = cameras[i]; + var pipeline = pipelines[i]; - if (camera && camera.id === testID) + if (pipeline.active) { - found = true; - continue; + pipeline.preBatch(gameObject); } } - - if (found) - { - testID = testID << 1; - } - else - { - return testID; - } } - - return 0; }, /** - * Gets the total number of Cameras in this Camera Manager. + * This method is called by the `WebGLPipeline.batchQuad` method, right after a quad + * belonging to a Game Object has been added to the batch. * - * If the optional `isVisible` argument is set it will only count Cameras that are currently visible. + * It is also called directly bu custom Game Objects, such as Nine Slice or Mesh, + * from their render methods. * - * @method Phaser.Cameras.Scene2D.CameraManager#getTotal - * @since 3.11.0 + * It causes a batch flush, then calls the `postBatch` method on the Post FX Pipelines + * belonging to the Game Object. * - * @param {boolean} [isVisible=false] - Set the `true` to only include visible Cameras in the total. + * It should be preceeded by a call to `preBatch` to start the process. * - * @return {number} The total number of Cameras in this Camera Manager. + * @method Phaser.Renderer.WebGL.PipelineManager#postBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was just added to the batch. */ - getTotal: function (isVisible) + postBatch: function (gameObject) { - if (isVisible === undefined) { isVisible = false; } - - var total = 0; - - var cameras = this.cameras; - - for (var i = 0; i < cameras.length; i++) + if (gameObject.hasPostPipeline) { - var camera = cameras[i]; + this.flush(); - if (!isVisible || (isVisible && camera.visible)) + var pipelines = gameObject.postPipelines; + + for (var i = 0; i < pipelines.length; i++) { - total++; + var pipeline = pipelines[i]; + + if (pipeline.active) + { + pipeline.postBatch(gameObject); + } } } - - return total; }, /** - * Populates this Camera Manager based on the given configuration object, or an array of config objects. - * - * See the `Phaser.Types.Cameras.Scene2D.CameraConfig` documentation for details of the object structure. + * Called at the start of the `WebGLRenderer.preRenderCamera` method. * - * @method Phaser.Cameras.Scene2D.CameraManager#fromJSON - * @since 3.0.0 + * If the Camera has post pipelines set, it will flush the batch and then call the + * `preBatch` method on the post-fx pipelines belonging to the Camera. * - * @param {(Phaser.Types.Cameras.Scene2D.CameraConfig|Phaser.Types.Cameras.Scene2D.CameraConfig[])} config - A Camera configuration object, or an array of them, to be added to this Camera Manager. + * @method Phaser.Renderer.WebGL.PipelineManager#preBatchCamera + * @since 3.50.0 * - * @return {this} This Camera Manager instance. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera about to be rendered. */ - fromJSON: function (config) + preBatchCamera: function (camera) { - if (!Array.isArray(config)) - { - config = [ config ]; - } - - var gameWidth = this.scene.sys.scale.width; - var gameHeight = this.scene.sys.scale.height; - - for (var i = 0; i < config.length; i++) + if (camera.hasPostPipeline) { - var cameraConfig = config[i]; - - var x = GetFastValue(cameraConfig, 'x', 0); - var y = GetFastValue(cameraConfig, 'y', 0); - var width = GetFastValue(cameraConfig, 'width', gameWidth); - var height = GetFastValue(cameraConfig, 'height', gameHeight); - - var camera = this.add(x, y, width, height); - - // Direct properties - camera.name = GetFastValue(cameraConfig, 'name', ''); - camera.zoom = GetFastValue(cameraConfig, 'zoom', 1); - camera.rotation = GetFastValue(cameraConfig, 'rotation', 0); - camera.scrollX = GetFastValue(cameraConfig, 'scrollX', 0); - camera.scrollY = GetFastValue(cameraConfig, 'scrollY', 0); - camera.roundPixels = GetFastValue(cameraConfig, 'roundPixels', false); - camera.visible = GetFastValue(cameraConfig, 'visible', true); - - // Background Color + this.flush(); - var backgroundColor = GetFastValue(cameraConfig, 'backgroundColor', false); + var pipelines = camera.postPipelines; - if (backgroundColor) + // Iterate in reverse because we need them stacked in the order they're in the array + for (var i = pipelines.length - 1; i >= 0; i--) { - camera.setBackgroundColor(backgroundColor); + var pipeline = pipelines[i]; + + if (pipeline.active) + { + pipeline.preBatch(camera); + } } + } + }, - // Bounds + /** + * Called at the end of the `WebGLRenderer.postRenderCamera` method. + * + * If the Camera has post pipelines set, it will flush the batch and then call the + * `postBatch` method on the post-fx pipelines belonging to the Camera. + * + * @method Phaser.Renderer.WebGL.PipelineManager#postBatchCamera + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that was just rendered. + */ + postBatchCamera: function (camera) + { + if (camera.hasPostPipeline) + { + this.flush(); - var boundsConfig = GetFastValue(cameraConfig, 'bounds', null); + var pipelines = camera.postPipelines; - if (boundsConfig) + for (var i = 0; i < pipelines.length; i++) { - var bx = GetFastValue(boundsConfig, 'x', 0); - var by = GetFastValue(boundsConfig, 'y', 0); - var bwidth = GetFastValue(boundsConfig, 'width', gameWidth); - var bheight = GetFastValue(boundsConfig, 'height', gameHeight); + var pipeline = pipelines[i]; - camera.setBounds(bx, by, bwidth, bheight); + if (pipeline.active) + { + pipeline.postBatch(camera); + } } } - - return this; }, /** - * Gets a Camera based on its name. - * - * Camera names are optional and don't have to be set, so this method is only of any use if you - * have given your Cameras unique names. + * Checks to see if the given pipeline is already the active pipeline, both within this + * Pipeline Manager and also has the same shader set in the Renderer. * - * @method Phaser.Cameras.Scene2D.CameraManager#getCamera - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.PipelineManager#isCurrent + * @since 3.50.0 * - * @param {string} name - The name of the Camera. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline instance to be checked. + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. * - * @return {?Phaser.Cameras.Scene2D.Camera} The first Camera with a name matching the given string, otherwise `null`. + * @return {boolean} `true` if the given pipeline is already the current pipeline, otherwise `false`. */ - getCamera: function (name) + isCurrent: function (pipeline, currentShader) { - var cameras = this.cameras; + var renderer = this.renderer; + var current = this.current; - for (var i = 0; i < cameras.length; i++) + if (current && !currentShader) { - if (cameras[i].name === name) - { - return cameras[i]; - } + currentShader = current.currentShader; } - return null; + return !(current !== pipeline || currentShader.program !== renderer.currentProgram); }, /** - * Returns an array of all cameras below the given Pointer. + * Copy the `source` Render Target to the `target` Render Target. * - * The first camera in the array is the top-most camera in the camera list. + * You can optionally set the brightness factor of the copy. * - * @method Phaser.Cameras.Scene2D.CameraManager#getCamerasBelowPointer - * @since 3.10.0 + * The difference between this method and `drawFrame` is that this method + * uses a faster copy shader, where only the brightness can be modified. + * If you need color level manipulation, see `drawFrame` instead. * - * @param {Phaser.Input.Pointer} pointer - The Pointer to check against. + * The copy itself is handled by the Utility Pipeline. * - * @return {Phaser.Cameras.Scene2D.Camera[]} An array of cameras below the Pointer. + * @method Phaser.Renderer.WebGL.PipelineManager#copyFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [brightness=1] - The brightness value applied to the frame copy. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * + * @return {this} This Pipeline Manager instance. */ - getCamerasBelowPointer: function (pointer) + copyFrame: function (source, target, brightness, clear, clearAlpha) { - var cameras = this.cameras; - - var x = pointer.x; - var y = pointer.y; - - var output = []; + this.setUtility(this.UTILITY_PIPELINE.copyShader).copyFrame(source, target, brightness, clear, clearAlpha); - for (var i = 0; i < cameras.length; i++) - { - var camera = cameras[i]; + return this; + }, - if (camera.visible && camera.inputEnabled && RectangleContains(camera, x, y)) - { - // So the top-most camera is at the top of the search array - output.unshift(camera); - } - } + /** + * Pops the framebuffer from the renderers FBO stack and sets that as the active target, + * then draws the `source` Render Target to it. It then resets the renderer textures. + * + * This should be done when you need to draw the _final_ results of a pipeline to the game + * canvas, or the next framebuffer in line on the FBO stack. You should only call this once + * in the `onDraw` handler and it should be the final thing called. Be careful not to call + * this if you need to actually use the pipeline shader, instead of the copy shader. In + * those cases, use the `bindAndDraw` method. + * + * @method Phaser.Renderer.WebGL.PipelineManager#copyToGame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. + */ + copyToGame: function (source) + { + this.setUtility(this.UTILITY_PIPELINE.copyShader).copyToGame(source); - return output; + return this; }, /** - * Removes the given Camera, or an array of Cameras, from this Camera Manager. + * Copy the `source` Render Target to the `target` Render Target, using the + * given Color Matrix. * - * If found in the Camera Manager it will be immediately removed from the local cameras array. - * If also currently the 'main' camera, 'main' will be reset to be camera 0. + * The difference between this method and `copyFrame` is that this method + * uses a color matrix shader, where you have full control over the luminance + * values used during the copy. If you don't need this, you can use the faster + * `copyFrame` method instead. * - * The removed Cameras are automatically destroyed if the `runDestroy` argument is `true`, which is the default. - * If you wish to re-use the cameras then set this to `false`, but know that they will retain their references - * and internal data until destroyed or re-added to a Camera Manager. + * The copy itself is handled by the Utility Pipeline. * - * @method Phaser.Cameras.Scene2D.CameraManager#remove - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.PipelineManager#drawFrame + * @since 3.50.0 * - * @param {(Phaser.Cameras.Scene2D.Camera|Phaser.Cameras.Scene2D.Camera[])} camera - The Camera, or an array of Cameras, to be removed from this Camera Manager. - * @param {boolean} [runDestroy=true] - Automatically call `Camera.destroy` on each Camera removed from this Camera Manager. + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {Phaser.Display.ColorMatrix} [colorMatrix] - The Color Matrix to use when performing the draw. * - * @return {number} The total number of Cameras removed. + * @return {this} This Pipeline Manager instance. */ - remove: function (camera, runDestroy) + drawFrame: function (source, target, clearAlpha, colorMatrix) { - if (runDestroy === undefined) { runDestroy = true; } - - if (!Array.isArray(camera)) - { - camera = [ camera ]; - } - - var total = 0; - var cameras = this.cameras; - - for (var i = 0; i < camera.length; i++) - { - var index = cameras.indexOf(camera[i]); + this.setUtility(this.UTILITY_PIPELINE.colorMatrixShader).drawFrame(source, target, clearAlpha, colorMatrix); - if (index !== -1) - { - if (runDestroy) - { - cameras[index].destroy(); - } - else - { - cameras[index].renderList = []; - } + return this; + }, - cameras.splice(index, 1); + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using a linear blend effect, which is controlled by the `strength` parameter. + * + * The draw itself is handled by the Utility Pipeline. + * + * @method Phaser.Renderer.WebGL.PipelineManager#blendFrames + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * + * @return {this} This Pipeline Manager instance. + */ + blendFrames: function (source1, source2, target, strength, clearAlpha) + { + this.setUtility(this.UTILITY_PIPELINE.linearShader).blendFrames(source1, source2, target, strength, clearAlpha); - total++; - } - } + return this; + }, - if (!this.main && cameras[0]) - { - this.main = cameras[0]; - } + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using an additive blend effect, which is controlled by the `strength` parameter. + * + * The draw itself is handled by the Utility Pipeline. + * + * @method Phaser.Renderer.WebGL.PipelineManager#blendFramesAdditive + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * + * @return {this} This Pipeline Manager instance. + */ + blendFramesAdditive: function (source1, source2, target, strength, clearAlpha) + { + this.setUtility(this.UTILITY_PIPELINE.addShader).blendFramesAdditive(source1, source2, target, strength, clearAlpha); - return total; + return this; }, /** - * The internal render method. This is called automatically by the Scene and should not be invoked directly. + * Clears the given Render Target. * - * It will iterate through all local cameras and render them in turn, as long as they're visible and have - * an alpha level > 0. + * @method Phaser.Renderer.WebGL.PipelineManager#clearFrame + * @since 3.50.0 * - * @method Phaser.Cameras.Scene2D.CameraManager#render - * @protected - * @since 3.0.0 + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The Render Target to clear. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? * - * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Renderer that will render the children to this camera. - * @param {Phaser.GameObjects.DisplayList} displayList - The Display List for the Scene. + * @return {this} This Pipeline Manager instance. */ - render: function (renderer, displayList) + clearFrame: function (target, clearAlpha) { - var scene = this.scene; - var cameras = this.cameras; - - for (var i = 0; i < this.cameras.length; i++) - { - var camera = cameras[i]; - - if (camera.visible && camera.alpha > 0) - { - camera.preRender(); - - var visibleChildren = this.getVisibleChildren(displayList.getChildren(), camera); + this.UTILITY_PIPELINE.clearFrame(target, clearAlpha); - renderer.render(scene, visibleChildren, camera); - } - } + return this; }, /** - * Takes an array of Game Objects and a Camera and returns a new array - * containing only those Game Objects that pass the `willRender` test - * against the given Camera. + * Copy the `source` Render Target to the `target` Render Target. * - * @method Phaser.Cameras.Scene2D.CameraManager#getVisibleChildren + * The difference with this copy is that no resizing takes place. If the `source` + * Render Target is larger than the `target` then only a portion the same size as + * the `target` dimensions is copied across. + * + * You can optionally set the brightness factor of the copy. + * + * @method Phaser.Renderer.WebGL.PipelineManager#blitFrame * @since 3.50.0 * - * @param {Phaser.GameObjects.GameObject[]} children - An array of Game Objects to be checked against the camera. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera to filte the Game Objects against. + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. + * @param {number} [brightness=1] - The brightness value applied to the frame copy. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {boolean} [eraseMode=false] - Erase source from target using ERASE Blend Mode? * - * @return {Phaser.GameObjects.GameObject[]} A filtered list of only Game Objects within the Scene that will render against the given Camera. + * @return {this} This Pipeline Manager instance. */ - getVisibleChildren: function (children, camera) + blitFrame: function (source, target, brightness, clear, clearAlpha, eraseMode) { - var visible = []; - - for (var i = 0; i < children.length; i++) - { - var child = children[i]; - - if (child.willRender(camera)) - { - visible.push(child); - } - } + this.setUtility(this.UTILITY_PIPELINE.copyShader).blitFrame(source, target, brightness, clear, clearAlpha, eraseMode); - return visible; + return this; }, /** - * Resets this Camera Manager. + * Binds the `source` Render Target and then copies a section of it to the `target` Render Target. * - * This will iterate through all current Cameras, destroying them all, then it will reset the - * cameras array, reset the ID counter and create 1 new single camera using the default values. + * This method is extremely fast because it uses `gl.copyTexSubImage2D` and doesn't + * require the use of any shaders. Remember the coordinates are given in standard WebGL format, + * where x and y specify the lower-left corner of the section, not the top-left. Also, the + * copy entirely replaces the contents of the target texture, no 'merging' or 'blending' takes + * place. * - * @method Phaser.Cameras.Scene2D.CameraManager#resetAll - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.PipelineManager#copyFrameRect + * @since 3.50.0 * - * @return {Phaser.Cameras.Scene2D.Camera} The freshly created main Camera. + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. + * @param {number} x - The x coordinate of the lower left corner where to start copying. + * @param {number} y - The y coordinate of the lower left corner where to start copying. + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * + * @return {this} This Pipeline Manager instance. */ - resetAll: function () + copyFrameRect: function (source, target, x, y, width, height, clear, clearAlpha) { - for (var i = 0; i < this.cameras.length; i++) - { - this.cameras[i].destroy(); - } - - this.cameras = []; - - this.main = this.add(); + this.UTILITY_PIPELINE.copyFrameRect(source, target, x, y, width, height, clear, clearAlpha); - return this.main; + return this; }, /** - * The main update loop. Called automatically when the Scene steps. + * Returns `true` if the current pipeline is forced to use texture unit zero. * - * @method Phaser.Cameras.Scene2D.CameraManager#update - * @protected - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.PipelineManager#forceZero + * @since 3.50.0 * - * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @return {boolean} `true` if the current pipeline is forced to use texture unit zero. */ - update: function (time, delta) + forceZero: function () { - for (var i = 0; i < this.cameras.length; i++) - { - this.cameras[i].update(time, delta); - } + return (this.current && this.current.forceZero); }, /** - * The event handler that manages the `resize` event dispatched by the Scale Manager. + * Sets the Multi Pipeline to be the currently bound pipeline. * - * @method Phaser.Cameras.Scene2D.CameraManager#onResize - * @since 3.18.0 + * This is the default Phaser 3 rendering pipeline. * - * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. - * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions. The canvas width / height values match this. + * @method Phaser.Renderer.WebGL.PipelineManager#setMulti + * @since 3.50.0 + * + * @return {Phaser.Renderer.WebGL.Pipelines.MultiPipeline} The Multi Pipeline instance. */ - onResize: function (gameSize, baseSize, displaySize, previousWidth, previousHeight) + setMulti: function () { - for (var i = 0; i < this.cameras.length; i++) - { - var cam = this.cameras[i]; - - // if camera is at 0x0 and was the size of the previous game size, then we can safely assume it - // should be updated to match the new game size too - - if (cam._x === 0 && cam._y === 0 && cam._width === previousWidth && cam._height === previousHeight) - { - cam.setSize(baseSize.width, baseSize.height); - } - } + return this.set(this.MULTI_PIPELINE); }, /** - * Resizes all cameras to the given dimensions. + * Sets the Utility Pipeline to be the currently bound pipeline. * - * @method Phaser.Cameras.Scene2D.CameraManager#resize - * @since 3.2.0 + * @method Phaser.Renderer.WebGL.PipelineManager#setUtility + * @since 3.50.0 * - * @param {number} width - The new width of the camera. - * @param {number} height - The new height of the camera. + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. + * + * @return {Phaser.Renderer.WebGL.Pipelines.UtilityPipeline} The Utility Pipeline instance. */ - resize: function (width, height) + setUtility: function (currentShader) { - for (var i = 0; i < this.cameras.length; i++) - { - this.cameras[i].setSize(width, height); - } + return this.UTILITY_PIPELINE.bind(currentShader); }, /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. + * Sets the FX Pipeline to be the currently bound pipeline. * - * @method Phaser.Cameras.Scene2D.CameraManager#shutdown - * @private - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.PipelineManager#setFX + * @since 3.60.0 + * + * @return {Phaser.Renderer.WebGL.Pipelines.FXPipeline} The FX Pipeline instance. */ - shutdown: function () + setFX: function () { - this.main = undefined; - - for (var i = 0; i < this.cameras.length; i++) - { - this.cameras[i].destroy(); - } - - this.cameras = []; - - var eventEmitter = this.systems.events; - - eventEmitter.off(SceneEvents.UPDATE, this.update, this); - eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); + return this.set(this.FX_PIPELINE); }, /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. + * Use this to reset the gl context to the state that Phaser requires to continue rendering. * - * @method Phaser.Cameras.Scene2D.CameraManager#destroy - * @private - * @since 3.0.0 + * Calling this will: + * + * * Disable `DEPTH_TEST`, `CULL_FACE` and `STENCIL_TEST`. + * * Clear the depth buffer and stencil buffers. + * * Reset the viewport size. + * * Reset the blend mode. + * * Bind a blank texture as the active texture on texture unit zero. + * * Rebinds the given pipeline instance. + * + * You should call this if you have previously called `clear`, and then wish to return + * rendering control to Phaser again. + * + * @method Phaser.Renderer.WebGL.PipelineManager#rebind + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLPipeline} [pipeline] - The pipeline instance to be rebound. If not given, the previous pipeline will be bound. */ - destroy: function () + rebind: function (pipeline) { - this.shutdown(); - - this.default.destroy(); - - this.scene.sys.events.off(SceneEvents.START, this.start, this); - - this.scene = null; - this.systems = null; - } - -}); - -PluginCache.register('CameraManager', CameraManager, 'cameras'); - -module.exports = CameraManager; - - -/***/ }), -/* 800 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Scale Manager has successfully entered fullscreen mode. - * - * @event Phaser.Scale.Events#ENTER_FULLSCREEN - * @since 3.16.1 - */ -module.exports = 'enterfullscreen'; - - -/***/ }), -/* 801 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Scale Manager tried to enter fullscreen mode but failed. - * - * @event Phaser.Scale.Events#FULLSCREEN_FAILED - * @since 3.17.0 - */ -module.exports = 'fullscreenfailed'; - - -/***/ }), -/* 802 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Scale Manager tried to enter fullscreen mode, but it is unsupported by the browser. - * - * @event Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED - * @since 3.16.1 - */ -module.exports = 'fullscreenunsupported'; - - -/***/ }), -/* 803 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Scale Manager was in fullscreen mode, but has since left, either directly via game code, - * or via a user gestured, such as pressing the ESC key. - * - * @event Phaser.Scale.Events#LEAVE_FULLSCREEN - * @since 3.16.1 - */ -module.exports = 'leavefullscreen'; - - -/***/ }), -/* 804 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Scale Manager Orientation Change Event. - * - * This event is dispatched whenever the Scale Manager detects an orientation change event from the browser. - * - * @event Phaser.Scale.Events#ORIENTATION_CHANGE - * @since 3.16.1 - * - * @param {string} orientation - The new orientation value. Either `Phaser.Scale.Orientation.LANDSCAPE` or `Phaser.Scale.Orientation.PORTRAIT`. - */ -module.exports = 'orientationchange'; - - -/***/ }), -/* 805 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Scale Manager Resize Event. - * - * This event is dispatched whenever the Scale Manager detects a resize event from the browser. - * It sends three parameters to the callback, each of them being Size components. You can read - * the `width`, `height`, `aspectRatio` and other properties of these components to help with - * scaling your own game content. - * - * @event Phaser.Scale.Events#RESIZE - * @since 3.16.1 - * - * @param {Phaser.Structs.Size} gameSize - A reference to the Game Size component. This is the un-scaled size of your game canvas. - * @param {Phaser.Structs.Size} baseSize - A reference to the Base Size component. This is the game size. - * @param {Phaser.Structs.Size} displaySize - A reference to the Display Size component. This is the scaled canvas size, after applying zoom and scale mode. - * @param {number} previousWidth - If the `gameSize` has changed, this value contains its previous width, otherwise it contains the current width. - * @param {number} previousHeight - If the `gameSize` has changed, this value contains its previous height, otherwise it contains the current height. - */ -module.exports = 'resize'; - - -/***/ }), -/* 806 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Core - */ - -module.exports = { + if (pipeline === undefined && this.previous) + { + pipeline = this.previous; + } - Config: __webpack_require__(346), - CreateRenderer: __webpack_require__(366), - DebugHeader: __webpack_require__(384), - Events: __webpack_require__(22), - TimeStep: __webpack_require__(385), - VisibilityHandler: __webpack_require__(387) + var renderer = this.renderer; + var gl = renderer.gl; -}; + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.CULL_FACE); + if (renderer.hasActiveStencilMask()) + { + gl.clear(gl.DEPTH_BUFFER_BIT); + } + else + { + // If there wasn't a stencil mask set before this call, we can disable it safely + gl.disable(gl.STENCIL_TEST); + gl.clear(gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); + } -/***/ }), -/* 807 */ -/***/ (function(module, exports) { + gl.viewport(0, 0, renderer.width, renderer.height); -// shim for using process in browser -var process = module.exports = {}; + renderer.currentProgram = null; -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. + renderer.setBlendMode(0, true); -var cachedSetTimeout; -var cachedClearTimeout; + var vao = renderer.vaoExtension; -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); + if (vao) + { + vao.bindVertexArrayOES(null); } - } + var entries = this.pipelines.entries; -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); + for (var key in entries) + { + entries[key].glReset = true; } - } - + if (pipeline) + { + this.current = pipeline; -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; + pipeline.rebind(); + } + }, -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} + /** + * Flushes the current pipeline being used and then clears it, along with the + * the current shader program and vertex buffer from the `WebGLRenderer`. + * + * Then resets the blend mode to NORMAL. + * + * Call this before jumping to your own gl context handler, and then call `rebind` when + * you wish to return control to Phaser again. + * + * @method Phaser.Renderer.WebGL.PipelineManager#clear + * @since 3.50.0 + */ + clear: function () + { + var renderer = this.renderer; -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; + this.flush(); - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } + if (this.current) + { + this.current.unbind(); + this.previous = this.current; + this.current = null; } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; + else + { + this.previous = null; } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } + renderer.currentProgram = null; -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; + renderer.setBlendMode(0, true); -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; + var vao = renderer.vaoExtension; + if (vao) + { + vao.bindVertexArrayOES(null); + } + }, -/***/ }), -/* 808 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Gets a Render Target the right size to render the Sprite on. + * + * If the Sprite exceeds the size of the renderer, the Render Target will only ever be the maximum + * size of the renderer. + * + * @method Phaser.Renderer.WebGL.PipelineManager#getRenderTarget + * @since 3.60.0 + * + * @param {number} size - The maximum dimension required. + * + * @return {Phaser.Renderer.WebGL.RenderTarget} A Render Target large enough to fit the sprite. + */ + getRenderTarget: function (size) + { + var targets = this.renderTargets; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // 2 for just swap + // 3 for swap + alt swap + var offset = 3; -var Browser = __webpack_require__(136); + if (size > this.maxDimension) + { + this.targetIndex = targets.length - offset; -/** - * Determines the input support of the browser running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.input` from within any Scene. - * - * @typedef {object} Phaser.Device.Input - * @since 3.0.0 - * - * @property {?string} wheelType - The newest type of Wheel/Scroll event supported: 'wheel', 'mousewheel', 'DOMMouseScroll' - * @property {boolean} gamepads - Is navigator.getGamepads available? - * @property {boolean} mspointer - Is mspointer available? - * @property {boolean} touch - Is touch available? - */ -var Input = { + return targets[this.targetIndex]; + } + else + { + var index = (SnapCeil(size, this.frameInc, 0, true) - 1) * offset; - gamepads: false, - mspointer: false, - touch: false, - wheelEvent: null + this.targetIndex = index; -}; + return targets[index]; + } + }, -function init () -{ - if (typeof importScripts === 'function') + /** + * Gets a matching Render Target, the same size as the one the Sprite was drawn to, + * useful for double-buffer style effects such as blurs. + * + * @method Phaser.Renderer.WebGL.PipelineManager#getSwapRenderTarget + * @since 3.60.0 + * + * @return {Phaser.Renderer.WebGL.RenderTarget} The Render Target swap frame. + */ + getSwapRenderTarget: function () { - return Input; - } + return this.renderTargets[this.targetIndex + 1]; + }, - if ('ontouchstart' in document.documentElement || (navigator.maxTouchPoints && navigator.maxTouchPoints >= 1)) + /** + * Gets a matching Render Target, the same size as the one the Sprite was drawn to, + * useful for double-buffer style effects such as blurs. + * + * @method Phaser.Renderer.WebGL.PipelineManager#getAltSwapRenderTarget + * @since 3.60.0 + * + * @return {Phaser.Renderer.WebGL.RenderTarget} The Render Target swap frame. + */ + getAltSwapRenderTarget: function () { - Input.touch = true; - } + return this.renderTargets[this.targetIndex + 2]; + }, - if (navigator.msPointerEnabled || navigator.pointerEnabled) + /** + * Destroy the Pipeline Manager, cleaning up all related resources and references. + * + * @method Phaser.Renderer.WebGL.PipelineManager#destroy + * @since 3.50.0 + */ + destroy: function () { - Input.mspointer = true; - } + this.flush(); - if (navigator.getGamepads) - { - Input.gamepads = true; - } + this.classes.clear(); + this.postPipelineClasses.clear(); + this.pipelines.clear(); - // See https://developer.mozilla.org/en-US/docs/Web/Events/wheel - if ('onwheel' in window || (Browser.ie && 'WheelEvent' in window)) - { - // DOM3 Wheel Event: FF 17+, IE 9+, Chrome 31+, Safari 7+ - Input.wheelEvent = 'wheel'; - } - else if ('onmousewheel' in window) - { - // Non-FF legacy: IE 6-9, Chrome 1-31, Safari 5-7. - Input.wheelEvent = 'mousewheel'; - } - else if (Browser.firefox && 'MouseScrollEvent' in window) - { - // FF prior to 17. This should probably be scrubbed. - Input.wheelEvent = 'DOMMouseScroll'; + this.renderer = null; + this.game = null; + this.classes = null; + this.postPipelineClasses = null; + this.pipelines = null; + this.default = null; + this.current = null; + this.previous = null; } - return Input; -} +}); -module.exports = init(); +module.exports = PipelineManager; /***/ }), -/* 809 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 37410: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Browser = __webpack_require__(136); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(81044); /** - * Determines the audio playback capabilities of the device running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.audio` from within any Scene. + * @classdesc + * A Render Target encapsulates a WebGL framebuffer and the WebGL Texture that displays it. * - * @typedef {object} Phaser.Device.Audio - * @since 3.0.0 + * Instances of this class are typically created by, and belong to WebGL Pipelines, however + * other Game Objects and classes can take advantage of Render Targets as well. * - * @property {boolean} audioData - Can this device play HTML Audio tags? - * @property {boolean} dolby - Can this device play EC-3 Dolby Digital Plus files? - * @property {boolean} m4a - Can this device can play m4a files. - * @property {boolean} mp3 - Can this device play mp3 files? - * @property {boolean} ogg - Can this device play ogg files? - * @property {boolean} opus - Can this device play opus files? - * @property {boolean} wav - Can this device play wav files? - * @property {boolean} webAudio - Does this device have the Web Audio API? - * @property {boolean} webm - Can this device play webm files? + * @class RenderTarget + * @memberof Phaser.Renderer.WebGL + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the WebGLRenderer. + * @param {number} width - The width of this Render Target. + * @param {number} height - The height of this Render Target. + * @param {number} [scale=1] - A value between 0 and 1. Controls the size of this Render Target in relation to the Renderer. + * @param {number} [minFilter=0] - The minFilter mode of the texture when created. 0 is `LINEAR`, 1 is `NEAREST`. + * @param {boolean} [autoClear=true] - Automatically clear this framebuffer when bound? + * @param {boolean} [autoResize=false] - Automatically resize this Render Target if the WebGL Renderer resizes? + * @param {boolean} [addDepthBuffer=true] - Add a DEPTH_STENCIL and attachment to this Render Target? + * @param {boolean} [forceClamp=true] - Force the texture to use the CLAMP_TO_EDGE wrap mode, even if a power of two? */ -var Audio = { - - audioData: false, - dolby: false, - m4a: false, - mp3: false, - ogg: false, - opus: false, - wav: false, - webAudio: false, - webm: false - -}; - -function init () -{ - if (typeof importScripts === 'function') - { - return Audio; - } - - Audio.audioData = !!(window['Audio']); - - Audio.webAudio = !!(window['AudioContext'] || window['webkitAudioContext']); - - var audioElement = document.createElement('audio'); +var RenderTarget = new Class({ - var result = !!audioElement.canPlayType; + initialize: - try + function RenderTarget (renderer, width, height, scale, minFilter, autoClear, autoResize, addDepthBuffer, forceClamp) { - if (result) - { - if (audioElement.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, '')) - { - Audio.ogg = true; - } - - if (audioElement.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, '') || audioElement.canPlayType('audio/opus;').replace(/^no$/, '')) - { - Audio.opus = true; - } - - if (audioElement.canPlayType('audio/mpeg;').replace(/^no$/, '')) - { - Audio.mp3 = true; - } - - // Mimetypes accepted: - // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements - if (audioElement.canPlayType('audio/wav').replace(/^no$/, '')) - { - Audio.wav = true; - } - - if (audioElement.canPlayType('audio/x-m4a;') || audioElement.canPlayType('audio/aac;').replace(/^no$/, '')) - { - Audio.m4a = true; - } + if (scale === undefined) { scale = 1; } + if (minFilter === undefined) { minFilter = 0; } + if (autoClear === undefined) { autoClear = true; } + if (autoResize === undefined) { autoResize = false; } + if (addDepthBuffer === undefined) { addDepthBuffer = true; } + if (forceClamp === undefined) { forceClamp = true; } - if (audioElement.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, '')) - { - Audio.webm = true; - } + /** + * A reference to the WebGLRenderer instance. + * + * @name Phaser.Renderer.WebGL.RenderTarget#renderer + * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.50.0 + */ + this.renderer = renderer; - if (audioElement.canPlayType('audio/mp4;codecs="ec-3"') !== '') - { - if (Browser.edge) - { - Audio.dolby = true; - } - else if (Browser.safari && Browser.safariVersion >= 9) - { - if ((/Mac OS X (\d+)_(\d+)/).test(navigator.userAgent)) - { - var major = parseInt(RegExp.$1, 10); - var minor = parseInt(RegExp.$2, 10); + /** + * The WebGLFramebuffer of this Render Target. + * + * This is created in the `RenderTarget.resize` method. + * + * @name Phaser.Renderer.WebGL.RenderTarget#framebuffer + * @type {WebGLFramebuffer} + * @since 3.50.0 + */ + this.framebuffer = null; - if ((major === 10 && minor >= 11) || major > 10) - { - Audio.dolby = true; - } - } - } - } - } - } - catch (e) - { - // Nothing to do here - } + /** + * The WebGLTexture of this Render Target. + * + * This is created in the `RenderTarget.resize` method. + * + * @name Phaser.Renderer.WebGL.RenderTarget#texture + * @type {WebGLTexture} + * @since 3.50.0 + */ + this.texture = null; - return Audio; -} + /** + * The width of the texture. + * + * @name Phaser.Renderer.WebGL.RenderTarget#width + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.width = 0; -module.exports = init(); + /** + * The height of the texture. + * + * @name Phaser.Renderer.WebGL.RenderTarget#height + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.height = 0; + /** + * A value between 0 and 1. Controls the size of this Render Target in relation to the Renderer. + * + * A value of 1 matches it. 0.5 makes the Render Target half the size of the renderer, etc. + * + * @name Phaser.Renderer.WebGL.RenderTarget#scale + * @type {number} + * @since 3.50.0 + */ + this.scale = scale; -/***/ }), -/* 810 */ -/***/ (function(module, exports) { + /** + * The minFilter mode of the texture. 0 is `LINEAR`, 1 is `NEAREST`. + * + * @name Phaser.Renderer.WebGL.RenderTarget#minFilter + * @type {number} + * @since 3.50.0 + */ + this.minFilter = minFilter; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Controls if this Render Target is automatically cleared (via `gl.COLOR_BUFFER_BIT`) + * during the `RenderTarget.bind` method. + * + * If you need more control over how, or if, the target is cleared, you can disable + * this via the config on creation, or even toggle it directly at runtime. + * + * @name Phaser.Renderer.WebGL.RenderTarget#autoClear + * @type {boolean} + * @since 3.50.0 + */ + this.autoClear = autoClear; -/** - * Determines the video support of the browser running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.video` from within any Scene. - * - * In Phaser 3.20 the properties were renamed to drop the 'Video' suffix. - * - * @typedef {object} Phaser.Device.Video - * @since 3.0.0 - * - * @property {boolean} h264 - Can this device play h264 mp4 video files? - * @property {boolean} hls - Can this device play hls video files? - * @property {boolean} mp4 - Can this device play h264 mp4 video files? - * @property {boolean} ogg - Can this device play ogg video files? - * @property {boolean} vp9 - Can this device play vp9 video files? - * @property {boolean} webm - Can this device play webm video files? - */ -var Video = { + /** + * Does this Render Target automatically resize when the WebGL Renderer does? + * + * Modify this property via the `setAutoResize` method. + * + * @name Phaser.Renderer.WebGL.RenderTarget#autoResize + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.autoResize = true; - h264: false, - hls: false, - mp4: false, - ogg: false, - vp9: false, - webm: false + /** + * Does this Render Target have a Depth Buffer? + * + * @name Phaser.Renderer.WebGL.RenderTarget#hasDepthBuffer + * @type {boolean} + * @readonly + * @since 3.60.0 + */ + this.hasDepthBuffer = addDepthBuffer; -}; + /** + * Force the WebGL Texture to use the CLAMP_TO_EDGE wrap mode, even if a power of two? + * + * If `false` it will use `gl.REPEAT` instead, which may be required for some effects, such + * as using this Render Target as a texture for a Shader. + * + * @name Phaser.Renderer.WebGL.RenderTarget#forceClamp + * @type {boolean} + * @since 3.60.0 + */ + this.forceClamp = forceClamp; -function init () -{ - if (typeof importScripts === 'function') - { - return Video; - } + this.resize(width, height); - var videoElement = document.createElement('video'); - var result = !!videoElement.canPlayType; + if (autoResize) + { + this.setAutoResize(true); + } + else + { + // Block resizing unless this RT allows it + this.autoResize = false; + } + }, - try + /** + * Sets if this Render Target should automatically resize when the WebGL Renderer + * emits a resize event. + * + * @method Phaser.Renderer.WebGL.RenderTarget#setAutoResize + * @since 3.50.0 + * + * @param {boolean} autoResize - Automatically resize this Render Target when the WebGL Renderer resizes? + * + * @return {this} This RenderTarget instance. + */ + setAutoResize: function (autoResize) { - if (result) + if (autoResize && !this.autoResize) { - if (videoElement.canPlayType('video/ogg; codecs="theora"').replace(/^no$/, '')) - { - Video.ogg = true; - } - - if (videoElement.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/, '')) - { - // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546 - Video.h264 = true; - Video.mp4 = true; - } - - if (videoElement.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/, '')) - { - Video.webm = true; - } - - if (videoElement.canPlayType('video/webm; codecs="vp9"').replace(/^no$/, '')) - { - Video.vp9 = true; - } + this.renderer.on(Events.RESIZE, this.resize, this); - if (videoElement.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/, '')) - { - Video.hls = true; - } + this.autoResize = true; } - } - catch (e) - { - // Nothing to do - } - - return Video; -} - -module.exports = init(); - - -/***/ }), -/* 811 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Determines the full screen support of the browser running this Phaser Game instance. - * These values are read-only and populated during the boot sequence of the game. - * They are then referenced by internal game systems and are available for you to access - * via `this.sys.game.device.fullscreen` from within any Scene. - * - * @typedef {object} Phaser.Device.Fullscreen - * @since 3.0.0 - * - * @property {boolean} available - Does the browser support the Full Screen API? - * @property {boolean} keyboard - Does the browser support access to the Keyboard during Full Screen mode? - * @property {string} cancel - If the browser supports the Full Screen API this holds the call you need to use to cancel it. - * @property {string} request - If the browser supports the Full Screen API this holds the call you need to use to activate it. - */ -var Fullscreen = { + else if (!autoResize && this.autoResize) + { + this.renderer.off(Events.RESIZE, this.resize, this); - available: false, - cancel: '', - keyboard: false, - request: '' + this.autoResize = false; + } -}; + return this; + }, -/** -* Checks for support of the Full Screen API. -* -* @ignore -*/ -function init () -{ - if (typeof importScripts === 'function') + /** + * Resizes this Render Target. + * + * Deletes both the frame buffer and texture, if they exist and then re-creates + * them using the new sizes. + * + * This method is called automatically by the pipeline during its resize handler. + * + * @method Phaser.Renderer.WebGL.RenderTarget#resize + * @since 3.50.0 + * + * @param {number} width - The new width of this Render Target. + * @param {number} height - The new height of this Render Target. + * + * @return {this} This RenderTarget instance. + */ + resize: function (width, height) { - return Fullscreen; - } + var scaledWidth = width * this.scale; + var scaledHeight = height * this.scale; - var i; + if (this.autoResize && (scaledWidth !== this.width || scaledHeight !== this.height)) + { + var renderer = this.renderer; - var suffix1 = 'Fullscreen'; - var suffix2 = 'FullScreen'; + renderer.deleteFramebuffer(this.framebuffer); - var fs = [ - 'request' + suffix1, - 'request' + suffix2, - 'webkitRequest' + suffix1, - 'webkitRequest' + suffix2, - 'msRequest' + suffix1, - 'msRequest' + suffix2, - 'mozRequest' + suffix2, - 'mozRequest' + suffix1 - ]; + renderer.deleteTexture(this.texture); - for (i = 0; i < fs.length; i++) - { - if (document.documentElement[fs[i]]) - { - Fullscreen.available = true; - Fullscreen.request = fs[i]; - break; - } - } + width *= this.scale; + height *= this.scale; - var cfs = [ - 'cancel' + suffix2, - 'exit' + suffix1, - 'webkitCancel' + suffix2, - 'webkitExit' + suffix1, - 'msCancel' + suffix2, - 'msExit' + suffix1, - 'mozCancel' + suffix2, - 'mozExit' + suffix1 - ]; + width = Math.round(width); + height = Math.round(height); - if (Fullscreen.available) - { - for (i = 0; i < cfs.length; i++) - { - if (document[cfs[i]]) + if (width <= 0) { - Fullscreen.cancel = cfs[i]; - break; + width = 1; } - } - } - - // Keyboard Input? - // Safari 5.1 says it supports fullscreen keyboard, but is lying. - if (window['Element'] && Element['ALLOW_KEYBOARD_INPUT'] && !(/ Version\/5\.1(?:\.\d+)? Safari\//).test(navigator.userAgent)) - { - Fullscreen.keyboard = true; - } - Object.defineProperty(Fullscreen, 'active', { get: function () { return !!(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement); } }); + if (height <= 0) + { + height = 1; + } - return Fullscreen; -} + this.texture = renderer.createTextureFromSource(null, width, height, this.minFilter, this.forceClamp); + this.framebuffer = renderer.createFramebuffer(width, height, this.texture, this.hasDepthBuffer); -module.exports = init(); + this.width = width; + this.height = height; + } + return this; + }, -/***/ }), -/* 812 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Pushes this Render Target as the current frame buffer of the renderer. + * + * If `autoClear` is set, then clears the texture. + * + * If `adjustViewport` is `true` then it will flush the renderer and then adjust the GL viewport. + * + * @method Phaser.Renderer.WebGL.RenderTarget#bind + * @since 3.50.0 + * + * @param {boolean} [adjustViewport=false] - Adjust the GL viewport by calling `RenderTarget.adjustViewport` ? + * @param {number} [width] - Optional new width of this Render Target. + * @param {number} [height] - Optional new height of this Render Target. + */ + bind: function (adjustViewport, width, height) + { + if (adjustViewport === undefined) { adjustViewport = false; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var renderer = this.renderer; -/** - * @namespace Phaser.Math.Angle - */ + if (adjustViewport) + { + renderer.flush(); + } -module.exports = { + if (width && height) + { + this.resize(width, height); + } - Between: __webpack_require__(349), - BetweenPoints: __webpack_require__(350), - BetweenPointsY: __webpack_require__(813), - BetweenY: __webpack_require__(814), - CounterClockwise: __webpack_require__(815), - Normalize: __webpack_require__(351), - Random: __webpack_require__(816), - RandomDegrees: __webpack_require__(817), - Reverse: __webpack_require__(818), - RotateTo: __webpack_require__(819), - ShortestBetween: __webpack_require__(820), - Wrap: __webpack_require__(269), - WrapDegrees: __webpack_require__(270) + renderer.pushFramebuffer(this.framebuffer, false, false); -}; + if (adjustViewport) + { + this.adjustViewport(); + } + if (this.autoClear) + { + var gl = this.renderer.gl; -/***/ }), -/* 813 */ -/***/ (function(module, exports) { + gl.clearColor(0, 0, 0, 0); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + gl.clear(gl.COLOR_BUFFER_BIT); + } -/** - * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). - * - * The difference between this method and {@link Phaser.Math.Angle.BetweenPoints} is that this assumes the y coordinate - * travels down the screen. - * - * @function Phaser.Math.Angle.BetweenPointsY - * @since 3.0.0 - * - * @param {Phaser.Types.Math.Vector2Like} point1 - The first point. - * @param {Phaser.Types.Math.Vector2Like} point2 - The second point. - * - * @return {number} The angle in radians. - */ -var BetweenPointsY = function (point1, point2) -{ - return Math.atan2(point2.x - point1.x, point2.y - point1.y); -}; + renderer.clearStencilMask(); + }, -module.exports = BetweenPointsY; + /** + * Adjusts the GL viewport to match the width and height of this Render Target. + * + * Also disables `SCISSOR_TEST`. + * + * @method Phaser.Renderer.WebGL.RenderTarget#adjustViewport + * @since 3.50.0 + */ + adjustViewport: function () + { + var gl = this.renderer.gl; + gl.viewport(0, 0, this.width, this.height); -/***/ }), -/* 814 */ -/***/ (function(module, exports) { + gl.disable(gl.SCISSOR_TEST); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Clears this Render Target. + * + * @method Phaser.Renderer.WebGL.RenderTarget#clear + * @since 3.50.0 + */ + clear: function () + { + var renderer = this.renderer; + var gl = renderer.gl; -/** - * Find the angle of a segment from (x1, y1) -> (x2, y2). - * - * The difference between this method and {@link Phaser.Math.Angle.Between} is that this assumes the y coordinate - * travels down the screen. - * - * @function Phaser.Math.Angle.BetweenY - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The angle in radians. - */ -var BetweenY = function (x1, y1, x2, y2) -{ - return Math.atan2(x2 - x1, y2 - y1); -}; + renderer.pushFramebuffer(this.framebuffer); -module.exports = BetweenY; + gl.disable(gl.SCISSOR_TEST); + gl.clearColor(0, 0, 0, 0); -/***/ }), -/* 815 */ -/***/ (function(module, exports, __webpack_require__) { + gl.clear(gl.COLOR_BUFFER_BIT); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + renderer.popFramebuffer(); -var CONST = __webpack_require__(14); + renderer.resetScissor(); + }, -/** - * Takes an angle in Phasers default clockwise format and converts it so that - * 0 is North, 90 is West, 180 is South and 270 is East, - * therefore running counter-clockwise instead of clockwise. - * - * You can pass in the angle from a Game Object using: - * - * ```javascript - * var converted = CounterClockwise(gameobject.rotation); - * ``` - * - * All values for this function are in radians. - * - * @function Phaser.Math.Angle.CounterClockwise - * @since 3.16.0 - * - * @param {number} angle - The angle to convert, in radians. - * - * @return {number} The converted angle, in radians. - */ -var CounterClockwise = function (angle) -{ - if (angle > Math.PI) + /** + * Unbinds this Render Target and optionally flushes the WebGL Renderer first. + * + * @name Phaser.Renderer.WebGL.RenderTarget#unbind + * @since 3.50.0 + * + * @param {boolean} [flush=false] - Flush the WebGL Renderer before unbinding? + * + * @return {WebGLFramebuffer} The Framebuffer that was set, or `null` if there aren't any more in the stack. + */ + unbind: function (flush) { - angle -= CONST.PI2; - } + if (flush === undefined) { flush = false; } - return Math.abs((((angle + CONST.TAU) % CONST.PI2) - CONST.PI2) % CONST.PI2); -}; + var renderer = this.renderer; -module.exports = CounterClockwise; + if (flush) + { + renderer.flush(); + } + return renderer.popFramebuffer(); + }, -/***/ }), -/* 816 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Removes all external references from this class and deletes the + * WebGL framebuffer and texture instances. + * + * Does not remove this Render Target from the parent pipeline. + * + * @name Phaser.Renderer.WebGL.RenderTarget#destroy + * @since 3.50.0 + */ + destroy: function () + { + var renderer = this.renderer; -/** - * @author Richard Davey - * @author @samme - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + renderer.deleteFramebuffer(this.framebuffer); + renderer.deleteTexture(this.texture); -var FloatBetween = __webpack_require__(137); + renderer.off(Events.RESIZE, this.resize, this); -/** - * Returns a random angle in the range [-pi, pi]. - * - * @function Phaser.Math.Angle.Random - * @since 3.23.0 - * - * @return {number} The angle, in radians. - */ -var Random = function () -{ - return FloatBetween(-Math.PI, Math.PI); -}; + this.renderer = null; + this.framebuffer = null; + this.texture = null; + } -module.exports = Random; +}); + +module.exports = RenderTarget; /***/ }), -/* 817 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 75512: +/***/ ((module) => { /** * @author Richard Davey - * @author @samme - * @copyright 2020 Photon Storm Ltd. + * @author Felipe Alfonso <@bitnenfer> + * @author Matthew Groves <@doormat> + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FloatBetween = __webpack_require__(137); - /** - * Returns a random angle in the range [-180, 180]. - * - * @function Phaser.Math.Angle.RandomDegrees - * @since 3.23.0 - * - * @return {number} The angle, in degrees. + * @namespace Phaser.Renderer.WebGL.Utils + * @since 3.0.0 */ -var RandomDegrees = function () -{ - return FloatBetween(-180, 180); -}; - -module.exports = RandomDegrees; +module.exports = { + /** + * Packs four floats on a range from 0.0 to 1.0 into a single Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintFromFloats + * @since 3.0.0 + * + * @param {number} r - Red component in a range from 0.0 to 1.0 + * @param {number} g - Green component in a range from 0.0 to 1.0 + * @param {number} b - Blue component in a range from 0.0 to 1.0 + * @param {number} a - Alpha component in a range from 0.0 to 1.0 + * + * @return {number} The packed RGBA values as a Uint32. + */ + getTintFromFloats: function (r, g, b, a) + { + var ur = ((r * 255) | 0) & 0xff; + var ug = ((g * 255) | 0) & 0xff; + var ub = ((b * 255) | 0) & 0xff; + var ua = ((a * 255) | 0) & 0xff; -/***/ }), -/* 818 */ -/***/ (function(module, exports, __webpack_require__) { + return ((ua << 24) | (ur << 16) | (ug << 8) | ub) >>> 0; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Packs a Uint24, representing RGB components, with a Float32, representing + * the alpha component, with a range between 0.0 and 1.0 and return a Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha + * @since 3.0.0 + * + * @param {number} rgb - Uint24 representing RGB components + * @param {number} a - Float32 representing Alpha component + * + * @return {number} Packed RGBA as Uint32 + */ + getTintAppendFloatAlpha: function (rgb, a) + { + var ua = ((a * 255) | 0) & 0xff; -var Normalize = __webpack_require__(351); + return ((ua << 24) | rgb) >>> 0; + }, -/** - * Reverse the given angle. - * - * @function Phaser.Math.Angle.Reverse - * @since 3.0.0 - * - * @param {number} angle - The angle to reverse, in radians. - * - * @return {number} The reversed angle, in radians. - */ -var Reverse = function (angle) -{ - return Normalize(angle + Math.PI); -}; + /** + * Packs a Uint24, representing RGB components, with a Float32, representing + * the alpha component, with a range between 0.0 and 1.0 and return a + * swizzled Uint32 + * + * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlphaAndSwap + * @since 3.0.0 + * + * @param {number} rgb - Uint24 representing RGB components + * @param {number} a - Float32 representing Alpha component + * + * @return {number} Packed RGBA as Uint32 + */ + getTintAppendFloatAlphaAndSwap: function (rgb, a) + { + var ur = ((rgb >> 16) | 0) & 0xff; + var ug = ((rgb >> 8) | 0) & 0xff; + var ub = (rgb | 0) & 0xff; + var ua = ((a * 255) | 0) & 0xff; -module.exports = Reverse; + return ((ua << 24) | (ub << 16) | (ug << 8) | ur) >>> 0; + }, + /** + * Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0 + * + * @function Phaser.Renderer.WebGL.Utils.getFloatsFromUintRGB + * @since 3.0.0 + * + * @param {number} rgb - RGB packed as a Uint24 + * + * @return {array} Array of floats representing each component as a float + */ + getFloatsFromUintRGB: function (rgb) + { + var ur = ((rgb >> 16) | 0) & 0xff; + var ug = ((rgb >> 8) | 0) & 0xff; + var ub = (rgb | 0) & 0xff; -/***/ }), -/* 819 */ -/***/ (function(module, exports, __webpack_require__) { + return [ ur / 255, ug / 255, ub / 255 ]; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Check to see how many texture units the GPU supports in a fragment shader + * and if the value specific in the game config is allowed. + * + * This value is hard-clamped to 16 for performance reasons on Android devices. + * + * @function Phaser.Renderer.WebGL.Utils.checkShaderMax + * @since 3.50.0 + * + * @param {WebGLRenderingContext} gl - The WebGLContext used to create the shaders. + * @param {number} maxTextures - The Game Config maxTextures value. + * + * @return {number} The number of texture units that is supported by this browser and GPU. + */ + checkShaderMax: function (gl, maxTextures) + { + // Note: This is the maximum number of TIUs that a _fragment_ shader supports + // https://www.khronos.org/opengl/wiki/Common_Mistakes#Texture_Unit -var MATH_CONST = __webpack_require__(14); + // Hard-clamp this to 16 to avoid run-away texture counts such as on Android + var gpuMax = Math.min(16, gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)); -/** - * Rotates `currentAngle` towards `targetAngle`, taking the shortest rotation distance. The `lerp` argument is the amount to rotate by in this call. - * - * @function Phaser.Math.Angle.RotateTo - * @since 3.0.0 - * - * @param {number} currentAngle - The current angle, in radians. - * @param {number} targetAngle - The target angle to rotate to, in radians. - * @param {number} [lerp=0.05] - The lerp value to add to the current angle. - * - * @return {number} The adjusted angle. - */ -var RotateTo = function (currentAngle, targetAngle, lerp) -{ - if (lerp === undefined) { lerp = 0.05; } + if (!maxTextures || maxTextures === -1) + { + return gpuMax; + } + else + { + return Math.min(gpuMax, maxTextures); + } + }, - if (currentAngle === targetAngle) + /** + * Checks the given Fragment Shader Source for `%count%` and `%forloop%` declarations and + * replaces those with GLSL code for setting `texture = texture2D(uMainSampler[i], outTexCoord)`. + * + * @function Phaser.Renderer.WebGL.Utils.parseFragmentShaderMaxTextures + * @since 3.50.0 + * + * @param {string} fragmentShaderSource - The Fragment Shader source code to operate on. + * @param {number} maxTextures - The number of maxTextures value. + * + * @return {string} The modified Fragment Shader source. + */ + parseFragmentShaderMaxTextures: function (fragmentShaderSource, maxTextures) { - return currentAngle; - } + if (!fragmentShaderSource) + { + return ''; + } - if (Math.abs(targetAngle - currentAngle) <= lerp || Math.abs(targetAngle - currentAngle) >= (MATH_CONST.PI2 - lerp)) - { - currentAngle = targetAngle; - } - else - { - if (Math.abs(targetAngle - currentAngle) > Math.PI) + var src = ''; + + for (var i = 0; i < maxTextures; i++) { - if (targetAngle < currentAngle) + if (i > 0) { - targetAngle += MATH_CONST.PI2; + src += '\n\telse '; } - else + + if (i < maxTextures - 1) { - targetAngle -= MATH_CONST.PI2; + src += 'if (outTexId < ' + i + '.5)'; } + + src += '\n\t{'; + src += '\n\t\ttexture = texture2D(uMainSampler[' + i + '], outTexCoord);'; + src += '\n\t}'; } - if (targetAngle > currentAngle) + fragmentShaderSource = fragmentShaderSource.replace(/%count%/gi, maxTextures.toString()); + + return fragmentShaderSource.replace(/%forloop%/gi, src); + }, + + /** + * Takes the Glow FX Shader source and parses out the __SIZE__ and __DIST__ + * consts with the configuration values. + * + * @function Phaser.Renderer.WebGL.Utils.setGlowQuality + * @since 3.60.0 + * + * @param {string} shader - The Fragment Shader source code to operate on. + * @param {Phaser.Game} game - The Phaser Game instance. + * @param {number} [quality] - The quality of the glow (defaults to 0.1) + * @param {number} [distance] - The distance of the glow (defaults to 10) + * + * @return {string} The modified Fragment Shader source. + */ + setGlowQuality: function (shader, game, quality, distance) + { + if (quality === undefined) { - currentAngle += lerp; + quality = game.config.glowFXQuality; } - else if (targetAngle < currentAngle) + + if (distance === undefined) { - currentAngle -= lerp; + distance = game.config.glowFXDistance; } + + shader = shader.replace(/__SIZE__/gi, (1 / quality / distance).toFixed(7)); + shader = shader.replace(/__DIST__/gi, distance.toFixed(0) + '.0'); + + return shader; } - return currentAngle; }; -module.exports = RotateTo; - /***/ }), -/* 820 */ -/***/ (function(module, exports) { + +/***/ 44775: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var DeepCopy = __webpack_require__(28699); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(18970); +var GetFastValue = __webpack_require__(72632); +var Matrix4 = __webpack_require__(16650); +var RendererEvents = __webpack_require__(81044); +var RenderTarget = __webpack_require__(37410); +var Utils = __webpack_require__(75512); +var WebGLShader = __webpack_require__(71305); + /** - * Gets the shortest angle between `angle1` and `angle2`. + * @classdesc + * The `WebGLPipeline` is a base class used by all of the core Phaser pipelines. * - * Both angles must be in the range -180 to 180, which is the same clamped - * range that `sprite.angle` uses, so you can pass in two sprite angles to - * this method and get the shortest angle back between the two of them. + * It describes the way elements will be rendered in WebGL. Internally, it handles + * compiling the shaders, creating vertex buffers, assigning primitive topology and + * binding vertex attributes, all based on the given configuration data. * - * The angle returned will be in the same range. If the returned angle is - * greater than 0 then it's a counter-clockwise rotation, if < 0 then it's - * a clockwise rotation. + * The pipeline is configured by passing in a `WebGLPipelineConfig` object. Please + * see the documentation for this type to fully understand the configuration options + * available to you. * - * @function Phaser.Math.Angle.ShortestBetween - * @since 3.0.0 + * Usually, you would not extend from this class directly, but would instead extend + * from one of the core pipelines, such as the Multi Pipeline. * - * @param {number} angle1 - The first angle in the range -180 to 180. - * @param {number} angle2 - The second angle in the range -180 to 180. + * The pipeline flow per render-step is as follows: * - * @return {number} The shortest angle, in degrees. If greater than zero it's a counter-clockwise rotation. + * 1) onPreRender - called once at the start of the render step + * 2) onRender - call for each Scene Camera that needs to render (so can be multiple times per render step) + * 3) Internal flow: + * 3a) bind (only called if a Game Object is using this pipeline and it's not currently active) + * 3b) onBind (called for every Game Object that uses this pipeline) + * 3c) flush (can be called by a Game Object, internal method or from outside by changing pipeline) + * 4) onPostRender - called once at the end of the render step + * + * @class WebGLPipeline + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Renderer.WebGL + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration object for this WebGL Pipeline. */ -var ShortestBetween = function (angle1, angle2) -{ - var difference = angle2 - angle1; - - if (difference === 0) - { - return 0; - } - - var times = Math.floor((difference - (-180)) / 360); +var WebGLPipeline = new Class({ - return difference - (times * 360); + Extends: EventEmitter, -}; + initialize: -module.exports = ShortestBetween; + function WebGLPipeline (config) + { + EventEmitter.call(this); + var game = config.game; + var renderer = game.renderer; + var gl = renderer.gl; -/***/ }), -/* 821 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Name of the pipeline. Used for identification and setting from Game Objects. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#name + * @type {string} + * @since 3.0.0 + */ + this.name = GetFastValue(config, 'name', 'WebGLPipeline'); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The Phaser Game instance to which this pipeline is bound. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game = game; -/** - * @namespace Phaser.Math.Distance - */ + /** + * The WebGL Renderer instance to which this pipeline is bound. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer + * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.0.0 + */ + this.renderer = renderer; -module.exports = { + /** + * A reference to the WebGL Pipeline Manager. + * + * This is initially undefined and only set when this pipeline is added + * to the manager. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#manager + * @type {?Phaser.Renderer.WebGL.PipelineManager} + * @since 3.50.0 + */ + this.manager; - Between: __webpack_require__(50), - BetweenPoints: __webpack_require__(352), - BetweenPointsSquared: __webpack_require__(822), - Chebyshev: __webpack_require__(823), - Power: __webpack_require__(824), - Snake: __webpack_require__(825), - Squared: __webpack_require__(353) + /** + * The WebGL context this WebGL Pipeline uses. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#gl + * @type {WebGLRenderingContext} + * @since 3.0.0 + */ + this.gl = gl; -}; + /** + * The canvas which this WebGL Pipeline renders to. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#view + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.view = game.canvas; + /** + * Width of the current viewport. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#width + * @type {number} + * @since 3.0.0 + */ + this.width = 0; -/***/ }), -/* 822 */ -/***/ (function(module, exports) { + /** + * Height of the current viewport. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#height + * @type {number} + * @since 3.0.0 + */ + this.height = 0; -/** - * @author samme - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The current number of vertices that have been added to the pipeline batch. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.vertexCount = 0; -/** - * Calculate the squared distance between two points. - * - * @function Phaser.Math.Distance.BetweenPointsSquared - * @since 3.22.0 - * - * @param {Phaser.Types.Math.Vector2Like} a - The first point. - * @param {Phaser.Types.Math.Vector2Like} b - The second point. - * - * @return {number} The squared distance between the points. - */ -var DistanceBetweenPointsSquared = function (a, b) -{ - var dx = a.x - b.x; - var dy = a.y - b.y; + /** + * The total number of vertices that this pipeline batch can hold before it will flush. + * + * This defaults to `renderer batchSize * 6`, where `batchSize` is defined in the Renderer Game Config. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity + * @type {number} + * @since 3.0.0 + */ + this.vertexCapacity = 0; - return dx * dx + dy * dy; -}; + /** + * Raw byte buffer of vertices. + * + * Either set via the config object `vertices` property, or generates a new Array Buffer of + * size `vertexCapacity * vertexSize`. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData + * @type {ArrayBuffer} + * @readonly + * @since 3.0.0 + */ + this.vertexData; -module.exports = DistanceBetweenPointsSquared; + /** + * The WebGLBuffer that holds the vertex data. + * + * Created from the `vertexData` ArrayBuffer. If `vertices` are set in the config, a `STATIC_DRAW` buffer + * is created. If not, a `DYNAMIC_DRAW` buffer is created. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer + * @type {WebGLBuffer} + * @readonly + * @since 3.0.0 + */ + this.vertexBuffer; + /** + * The currently active WebGLBuffer. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#activeBuffer + * @type {WebGLBuffer} + * @since 3.60.0 + */ + this.activeBuffer; -/***/ }), -/* 823 */ -/***/ (function(module, exports) { + /** + * The primitive topology which the pipeline will use to submit draw calls. + * + * Defaults to GL_TRIANGLES if not otherwise set in the config. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#topology + * @type {GLenum} + * @since 3.0.0 + */ + this.topology = GetFastValue(config, 'topology', gl.TRIANGLES); -/** - * @author samme - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Uint8 view to the `vertexData` ArrayBuffer. Used for uploading vertex buffer resources to the GPU. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#bytes + * @type {Uint8Array} + * @since 3.0.0 + */ + this.bytes; -/** - * Calculate the Chebyshev distance between two sets of coordinates (points). - * - * Chebyshev distance (or chessboard distance) is the maximum of the horizontal and vertical distances. - * It's the effective distance when movement can be horizontal, vertical, or diagonal. - * - * @function Phaser.Math.Distance.Chebyshev - * @since 3.22.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The distance between each point. - */ -var ChebyshevDistance = function (x1, y1, x2, y2) -{ - return Math.max(Math.abs(x1 - x2), Math.abs(y1 - y2)); -}; + /** + * Float32 view of the array buffer containing the pipeline's vertices. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexViewF32 + * @type {Float32Array} + * @since 3.0.0 + */ + this.vertexViewF32; -module.exports = ChebyshevDistance; + /** + * Uint32 view of the array buffer containing the pipeline's vertices. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexViewU32 + * @type {Uint32Array} + * @since 3.0.0 + */ + this.vertexViewU32; + /** + * Indicates if the current pipeline is active, or not. + * + * Toggle this property to enable or disable a pipeline from rendering anything. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#active + * @type {boolean} + * @since 3.10.0 + */ + this.active = true; -/***/ }), -/* 824 */ -/***/ (function(module, exports) { + /** + * Some pipelines require the forced use of texture zero (like the light pipeline). + * + * This property should be set when that is the case. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#forceZero + * @type {boolean} + * @since 3.50.0 + */ + this.forceZero = GetFastValue(config, 'forceZero', false); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Indicates if this pipeline has booted or not. + * + * A pipeline boots only when the Game instance itself, and all associated systems, is + * fully ready. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#hasBooted + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.hasBooted = false; -/** - * Calculate the distance between two sets of coordinates (points) to the power of `pow`. - * - * @function Phaser.Math.Distance.Power - * @since 3.0.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * @param {number} pow - The exponent. - * - * @return {number} The distance between each point. - */ -var DistancePower = function (x1, y1, x2, y2, pow) -{ - if (pow === undefined) { pow = 2; } + /** + * Indicates if this is a Post FX Pipeline, or not. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#isPostFX + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.isPostFX = false; - return Math.sqrt(Math.pow(x2 - x1, pow) + Math.pow(y2 - y1, pow)); -}; + /** + * Indicates if this is a Pre FX Pipeline, or not. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#isPreFX + * @type {boolean} + * @readonly + * @since 3.60.0 + */ + this.isPreFX = false; -module.exports = DistancePower; + /** + * An array of RenderTarget instances that belong to this pipeline. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#renderTargets + * @type {Phaser.Renderer.WebGL.RenderTarget[]} + * @since 3.50.0 + */ + this.renderTargets = []; + /** + * A reference to the currently bound Render Target instance from the `WebGLPipeline.renderTargets` array. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#currentRenderTarget + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.currentRenderTarget; -/***/ }), -/* 825 */ -/***/ (function(module, exports) { + /** + * An array of all the WebGLShader instances that belong to this pipeline. + * + * Shaders manage their own attributes and uniforms, but share the same vertex data buffer, + * which belongs to this pipeline. + * + * Shaders are set in a call to the `setShadersFromConfig` method, which happens automatically, + * but can also be called at any point in your game. See the method documentation for details. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#shaders + * @type {Phaser.Renderer.WebGL.WebGLShader[]} + * @since 3.50.0 + */ + this.shaders = []; -/** - * @author samme - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A reference to the currently bound WebGLShader instance from the `WebGLPipeline.shaders` array. + * + * For lots of pipelines, this is the only shader, so it is a quick way to reference it without + * an array look-up. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#currentShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.50.0 + */ + this.currentShader; -/** - * Calculate the snake distance between two sets of coordinates (points). - * - * Snake distance (rectilinear distance, Manhattan distance) is the sum of the horizontal and vertical distances. - * It's the effective distance when movement is allowed only horizontally or vertically (but not both). - * - * @function Phaser.Math.Distance.Snake - * @since 3.22.0 - * - * @param {number} x1 - The x coordinate of the first point. - * @param {number} y1 - The y coordinate of the first point. - * @param {number} x2 - The x coordinate of the second point. - * @param {number} y2 - The y coordinate of the second point. - * - * @return {number} The distance between each point. - */ -var SnakeDistance = function (x1, y1, x2, y2) -{ - return Math.abs(x1 - x2) + Math.abs(y1 - y2); -}; + /** + * The Projection matrix, used by shaders as 'uProjectionMatrix' uniform. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#projectionMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 + */ + this.projectionMatrix; -module.exports = SnakeDistance; + /** + * The cached width of the Projection matrix. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#projectionWidth + * @type {number} + * @since 3.50.0 + */ + this.projectionWidth = 0; + /** + * The cached height of the Projection matrix. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#projectionHeight + * @type {number} + * @since 3.50.0 + */ + this.projectionHeight = 0; -/***/ }), -/* 826 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The configuration object that was used to create this pipeline. + * + * Treat this object as 'read only', because changing it post-creation will not + * impact this pipeline in any way. However, it is used internally for cloning + * and post-boot set-up. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#config + * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} + * @since 3.50.0 + */ + this.config = config; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Has the GL Context been reset to the Phaser defaults since the last time + * this pipeline was bound? This is set automatically when the Pipeline Manager + * resets itself, usually after handing off to a 3rd party renderer like Spine. + * + * You should treat this property as read-only. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#glReset + * @type {boolean} + * @since 3.53.0 + */ + this.glReset = false; -/** - * @namespace Phaser.Math.Easing - */ + /** + * The temporary Pipeline batch. This array contains the batch entries for + * the current frame, which is a package of textures and vertex offsets used + * for drawing. This package is built dynamically as the frame is built + * and cleared during the flush method. + * + * Treat this array and all of its contents as read-only. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#batch + * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineBatchEntry[]} + * @since 3.60.0 + */ + this.batch = []; -module.exports = { + /** + * The most recently created Pipeline batch entry. + * + * Reset to null as part of the flush method. + * + * Treat this value as read-only. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#currentBatch + * @type {?Phaser.Types.Renderer.WebGL.WebGLPipelineBatchEntry} + * @since 3.60.0 + */ + this.currentBatch = null; - Back: __webpack_require__(334), - Bounce: __webpack_require__(335), - Circular: __webpack_require__(336), - Cubic: __webpack_require__(337), - Elastic: __webpack_require__(338), - Expo: __webpack_require__(339), - Linear: __webpack_require__(340), - Quadratic: __webpack_require__(341), - Quartic: __webpack_require__(342), - Quintic: __webpack_require__(343), - Sine: __webpack_require__(344), - Stepped: __webpack_require__(345) + /** + * The most recently bound WebGLTexture, used as part of the batch process. + * + * Reset to null as part of the flush method. + * + * Treat this value as read-only. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#currentTexture + * @type {?WebGLTexture} + * @since 3.60.0 + */ + this.currentTexture = null; -}; + /** + * Holds the most recently assigned texture unit. + * + * Treat this value as read-only. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#currentUnit + * @type {number} + * @since 3.50.0 + */ + this.currentUnit = 0; + /** + * The currently active WebGLTextures, used as part of the batch process. + * + * Reset to empty as part of the bind method. + * + * Treat this array as read-only. + * + * @name Phaser.Renderer.WebGL.WebGLPipeline#activeTextures + * @type {WebGLTexture[]} + * @since 3.60.0 + */ + this.activeTextures = []; + }, -/***/ }), -/* 827 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Called when the Game has fully booted and the Renderer has finished setting up. + * + * By this stage all Game level systems are now in place. You can perform any final tasks that the + * pipeline may need, that relies on game systems such as the Texture Manager being ready. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#boot + * @fires Phaser.Renderer.WebGL.Pipelines.Events#BOOT + * @since 3.11.0 + */ + boot: function () + { + var i; + var gl = this.gl; + var config = this.config; + var renderer = this.renderer; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (!this.isPostFX) + { + this.projectionMatrix = new Matrix4().identity(); + } -/** - * @namespace Phaser.Math.Fuzzy - */ + // Create the Render Targets -module.exports = { + var renderTargets = this.renderTargets; - Ceil: __webpack_require__(828), - Equal: __webpack_require__(124), - Floor: __webpack_require__(829), - GreaterThan: __webpack_require__(354), - LessThan: __webpack_require__(355) + var targets = GetFastValue(config, 'renderTarget', false); -}; + // If boolean, set to number = 1 + if (typeof(targets) === 'boolean' && targets) + { + targets = 1; + } + var width = renderer.width; + var height = renderer.height; -/***/ }), -/* 828 */ -/***/ (function(module, exports) { + if (typeof(targets) === 'number') + { + // Create this many default RTs + for (i = 0; i < targets; i++) + { + renderTargets.push(new RenderTarget(renderer, width, height, 1, 0, true)); + } + } + else if (Array.isArray(targets)) + { + for (i = 0; i < targets.length; i++) + { + var scale = GetFastValue(targets[i], 'scale', 1); + var minFilter = GetFastValue(targets[i], 'minFilter', 0); + var autoClear = GetFastValue(targets[i], 'autoClear', 1); + var targetWidth = GetFastValue(targets[i], 'width', null); + var targetHeight = GetFastValue(targets[i], 'height', targetWidth); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (targetWidth) + { + renderTargets.push(new RenderTarget(renderer, targetWidth, targetHeight, 1, minFilter, autoClear)); + } + else + { + renderTargets.push(new RenderTarget(renderer, width, height, scale, minFilter, autoClear)); + } + } + } -/** - * Calculate the fuzzy ceiling of the given value. - * - * @function Phaser.Math.Fuzzy.Ceil - * @since 3.0.0 - * - * @param {number} value - The value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {number} The fuzzy ceiling of the value. - */ -var Ceil = function (value, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } + if (renderTargets.length) + { + // Default to the first one in the array + this.currentRenderTarget = renderTargets[0]; + } - return Math.ceil(value - epsilon); -}; + // Create the Shaders -module.exports = Ceil; + this.setShadersFromConfig(config); + // Which shader has the largest vertex size? + var shaders = this.shaders; + var vertexSize = 0; -/***/ }), -/* 829 */ -/***/ (function(module, exports) { + for (i = 0; i < shaders.length; i++) + { + if (shaders[i].vertexSize > vertexSize) + { + vertexSize = shaders[i].vertexSize; + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var batchSize = GetFastValue(config, 'batchSize', renderer.config.batchSize); -/** - * Calculate the fuzzy floor of the given value. - * - * @function Phaser.Math.Fuzzy.Floor - * @since 3.0.0 - * - * @param {number} value - The value. - * @param {number} [epsilon=0.0001] - The epsilon. - * - * @return {number} The floor of the value. - */ -var Floor = function (value, epsilon) -{ - if (epsilon === undefined) { epsilon = 0.0001; } + // * 6 because there are 6 vertices in a quad and 'batchSize' represents the quantity of quads in the batch - return Math.floor(value + epsilon); -}; + this.vertexCapacity = batchSize * 6; -module.exports = Floor; + var data = new ArrayBuffer(this.vertexCapacity * vertexSize); + this.vertexData = data; + this.bytes = new Uint8Array(data); + this.vertexViewF32 = new Float32Array(data); + this.vertexViewU32 = new Uint32Array(data); -/***/ }), -/* 830 */ -/***/ (function(module, exports, __webpack_require__) { + var configVerts = GetFastValue(config, 'vertices', null); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (configVerts) + { + this.vertexViewF32.set(configVerts); -/** - * @namespace Phaser.Math.Interpolation - */ + this.vertexBuffer = renderer.createVertexBuffer(data, gl.STATIC_DRAW); + } + else + { + this.vertexBuffer = renderer.createVertexBuffer(data.byteLength, gl.DYNAMIC_DRAW); + } -module.exports = { + // Set-up shaders - Bezier: __webpack_require__(831), - CatmullRom: __webpack_require__(832), - CubicBezier: __webpack_require__(358), - Linear: __webpack_require__(833), - QuadraticBezier: __webpack_require__(359), - SmoothStep: __webpack_require__(360), - SmootherStep: __webpack_require__(834) + this.setVertexBuffer(); -}; + for (i = shaders.length - 1; i >= 0; i--) + { + shaders[i].rebind(); + } + this.hasBooted = true; -/***/ }), -/* 831 */ -/***/ (function(module, exports, __webpack_require__) { + renderer.on(RendererEvents.RESIZE, this.resize, this); + renderer.on(RendererEvents.PRE_RENDER, this.onPreRender, this); + renderer.on(RendererEvents.RENDER, this.onRender, this); + renderer.on(RendererEvents.POST_RENDER, this.onPostRender, this); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.emit(Events.BOOT, this); -var Bernstein = __webpack_require__(356); + this.onBoot(); + }, -/** - * A bezier interpolation method. - * - * @function Phaser.Math.Interpolation.Bezier - * @since 3.0.0 - * - * @param {number[]} v - The input array of values to interpolate between. - * @param {number} k - The percentage of interpolation, between 0 and 1. - * - * @return {number} The interpolated value. - */ -var BezierInterpolation = function (v, k) -{ - var b = 0; - var n = v.length - 1; + /** + * This method is called once when this pipeline has finished being set-up + * at the end of the boot process. By the time this method is called, all + * of the shaders are ready and configured. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBoot + * @since 3.50.0 + */ + onBoot: function () + { + }, - for (var i = 0; i <= n; i++) + /** + * This method is called once when this pipeline has finished being set-up + * at the end of the boot process. By the time this method is called, all + * of the shaders are ready and configured. It's also called if the renderer + * changes size. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onResize + * @since 3.50.0 + * + * @param {number} width - The new width of this WebGL Pipeline. + * @param {number} height - The new height of this WebGL Pipeline. + */ + onResize: function () { - b += Math.pow(1 - k, n - i) * Math.pow(k, i) * v[i] * Bernstein(n, i); - } + }, - return b; -}; + /** + * Sets the currently active shader within this pipeline. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setShader + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLShader} shader - The shader to set as being current. + * @param {boolean} [setAttributes=false] - Should the vertex attribute pointers be set? + * @param {WebGLBuffer} [vertexBuffer] - The vertex buffer to be set before the shader is bound. Defaults to the one owned by this pipeline. + * + * @return {this} This WebGLPipeline instance. + */ + setShader: function (shader, setAttributes, vertexBuffer) + { + var renderer = this.renderer; -module.exports = BezierInterpolation; + if (shader !== this.currentShader || renderer.currentProgram !== this.currentShader.program) + { + this.flush(); + var wasBound = this.setVertexBuffer(vertexBuffer); -/***/ }), -/* 832 */ -/***/ (function(module, exports, __webpack_require__) { + if (wasBound && !setAttributes) + { + setAttributes = true; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + shader.bind(setAttributes, false); -var CatmullRom = __webpack_require__(194); + this.currentShader = shader; + } -/** - * A Catmull-Rom interpolation method. - * - * @function Phaser.Math.Interpolation.CatmullRom - * @since 3.0.0 - * - * @param {number[]} v - The input array of values to interpolate between. - * @param {number} k - The percentage of interpolation, between 0 and 1. - * - * @return {number} The interpolated value. - */ -var CatmullRomInterpolation = function (v, k) -{ - var m = v.length - 1; - var f = m * k; - var i = Math.floor(f); + return this; + }, - if (v[0] === v[m]) + /** + * Searches all shaders in this pipeline for one matching the given name, then returns it. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#getShaderByName + * @since 3.50.0 + * + * @param {string} name - The index of the shader to set. + * + * @return {Phaser.Renderer.WebGL.WebGLShader} The WebGLShader instance, if found. + */ + getShaderByName: function (name) { - if (k < 0) + var shaders = this.shaders; + + for (var i = 0; i < shaders.length; i++) { - i = Math.floor(f = m * (1 + k)); + if (shaders[i].name === name) + { + return shaders[i]; + } } + }, - return CatmullRom(f - i, v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m]); - } - else + /** + * Destroys all shaders currently set in the `WebGLPipeline.shaders` array and then parses the given + * `config` object, extracting the shaders from it, creating `WebGLShader` instances and finally + * setting them into the `shaders` array of this pipeline. + * + * This is a destructive process. Be very careful when you call it, should you need to. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setShadersFromConfig + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration object for this WebGL Pipeline. + * + * @return {this} This WebGLPipeline instance. + */ + setShadersFromConfig: function (config) { - if (k < 0) - { - return v[0] - (CatmullRom(-f, v[0], v[0], v[1], v[1]) - v[0]); - } + var i; + var shaders = this.shaders; + var renderer = this.renderer; - if (k > 1) + for (i = 0; i < shaders.length; i++) { - return v[m] - (CatmullRom(f - m, v[m], v[m], v[m - 1], v[m - 1]) - v[m]); + shaders[i].destroy(); } - return CatmullRom(f - i, v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2]); - } -}; + var vName = 'vertShader'; + var fName = 'fragShader'; + var aName = 'attributes'; -module.exports = CatmullRomInterpolation; + var defaultVertShader = GetFastValue(config, vName, null); + var defaultFragShader = Utils.parseFragmentShaderMaxTextures(GetFastValue(config, fName, null), renderer.maxTextures); + var defaultAttribs = GetFastValue(config, aName, null); + var configShaders = GetFastValue(config, 'shaders', []); -/***/ }), -/* 833 */ -/***/ (function(module, exports, __webpack_require__) { + var len = configShaders.length; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (len === 0) + { + if (defaultVertShader && defaultFragShader) + { + this.shaders = [ new WebGLShader(this, 'default', defaultVertShader, defaultFragShader, DeepCopy(defaultAttribs)) ]; + } + } + else + { + var newShaders = []; -var Linear = __webpack_require__(135); + for (i = 0; i < len; i++) + { + var shaderEntry = configShaders[i]; -/** - * A linear interpolation method. - * - * @function Phaser.Math.Interpolation.Linear - * @since 3.0.0 - * @see {@link https://en.wikipedia.org/wiki/Linear_interpolation} - * - * @param {number[]} v - The input array of values to interpolate between. - * @param {!number} k - The percentage of interpolation, between 0 and 1. - * - * @return {!number} The interpolated value. - */ -var LinearInterpolation = function (v, k) -{ - var m = v.length - 1; - var f = m * k; - var i = Math.floor(f); + var name; + var vertShader; + var fragShader; + var attributes; - if (k < 0) - { - return Linear(v[0], v[1], f); - } - else if (k > 1) - { - return Linear(v[m], v[m - 1], m - f); - } - else - { - return Linear(v[i], v[(i + 1 > m) ? m : i + 1], f - i); - } -}; + if (typeof shaderEntry === 'string') + { + name = 'default'; + vertShader = defaultVertShader; + fragShader = Utils.parseFragmentShaderMaxTextures(shaderEntry, renderer.maxTextures); + attributes = defaultAttribs; + } + else + { + name = GetFastValue(shaderEntry, 'name', 'default'); + vertShader = GetFastValue(shaderEntry, vName, defaultVertShader); + fragShader = Utils.parseFragmentShaderMaxTextures(GetFastValue(shaderEntry, fName, defaultFragShader), renderer.maxTextures); + attributes = GetFastValue(shaderEntry, aName, defaultAttribs); + } -module.exports = LinearInterpolation; + if (name === 'default') + { + var lines = fragShader.split('\n'); + var test = lines[0].trim(); + if (test.indexOf('#define SHADER_NAME') > -1) + { + name = test.substring(20); + } + } -/***/ }), -/* 834 */ -/***/ (function(module, exports, __webpack_require__) { + if (vertShader && fragShader) + { + newShaders.push(new WebGLShader(this, name, vertShader, fragShader, DeepCopy(attributes))); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.shaders = newShaders; + } -var SmootherStep = __webpack_require__(183); + if (this.shaders.length === 0) + { + console.warn('Pipeline: ' + this.name + ' - Invalid shader config'); + } + else + { + this.currentShader = this.shaders[0]; + } -/** - * A Smoother Step interpolation method. - * - * @function Phaser.Math.Interpolation.SmootherStep - * @since 3.9.0 - * @see {@link https://en.wikipedia.org/wiki/Smoothstep#Variations} - * - * @param {number} t - The percentage of interpolation, between 0 and 1. - * @param {number} min - The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'. - * @param {number} max - The maximum value, also known as the 'right edge', assumed greater than the 'left edge'. - * - * @return {number} The interpolated value. - */ -var SmootherStepInterpolation = function (t, min, max) -{ - return min + (max - min) * SmootherStep(t, 0, 1); -}; + return this; + }, -module.exports = SmootherStepInterpolation; + /** + * Creates a new WebGL Pipeline Batch Entry, sets the texture unit as zero + * and pushes the entry into the batch. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#createBatch + * @since 3.60.0 + * + * @param {WebGLTexture} texture - The WebGLTexture assigned to this batch entry. + * + * @return {number} The texture unit that was bound. + */ + createBatch: function (texture) + { + this.currentBatch = { + start: this.vertexCount, + count: 0, + texture: [ texture ], + unit: 0, + maxUnit: 0 + }; + this.currentUnit = 0; + this.currentTexture = texture; -/***/ }), -/* 835 */ -/***/ (function(module, exports, __webpack_require__) { + this.batch.push(this.currentBatch); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return 0; + }, -/** - * @namespace Phaser.Math.Pow2 - */ + /** + * Adds the given texture to the current WebGL Pipeline Batch Entry and + * increases the batch entry unit and maxUnit values by 1. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#addTextureToBatch + * @since 3.60.0 + * + * @param {WebGLTexture} texture - The WebGLTexture assigned to this batch entry. + */ + addTextureToBatch: function (texture) + { + var batch = this.currentBatch; -module.exports = { + if (batch) + { + batch.texture.push(texture); + batch.unit++; + batch.maxUnit++; + } + }, - GetNext: __webpack_require__(361), - IsSize: __webpack_require__(138), - IsValue: __webpack_require__(836) + /** + * Takes the given WebGLTexture and determines what to do with it. + * + * If there is no current batch (i.e. after a flush) it will create a new + * batch from it. + * + * If the texture is already bound, it will return the current texture unit. + * + * If the texture already exists in the current batch, the unit gets reset + * to match it. + * + * If the texture cannot be found in the current batch, and it supports + * multiple textures, it's added into the batch and the unit indexes are + * advanced. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#pushBatch + * @since 3.60.0 + * + * @param {WebGLTexture} texture - The WebGLTexture assigned to this batch entry. + * + * @return {number} The texture unit that was bound. + */ + pushBatch: function (texture) + { + // No current batch? Create one and return + if (!this.currentBatch || (this.forceZero && texture !== this.currentTexture)) + { + return this.createBatch(texture); + } -}; + // Otherwise, check if the texture is in the current batch + if (texture === this.currentTexture) + { + return this.currentUnit; + } + else + { + var current = this.currentBatch; + var idx = current.texture.indexOf(texture); -/***/ }), -/* 836 */ -/***/ (function(module, exports) { + if (idx === -1) + { + // This is a brand new texture, not in the current batch -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Have we exceed our limit? + if (current.texture.length === this.renderer.maxTextures) + { + return this.createBatch(texture); + } + else + { + // We're good, push it in + current.unit++; + current.maxUnit++; + current.texture.push(texture); -/** - * Tests the value and returns `true` if it is a power of two. - * - * @function Phaser.Math.Pow2.IsValue - * @since 3.0.0 - * - * @param {number} value - The value to check if it's a power of two. - * - * @return {boolean} Returns `true` if `value` is a power of two, otherwise `false`. - */ -var IsValuePowerOfTwo = function (value) -{ - return (value > 0 && (value & (value - 1)) === 0); -}; + this.currentUnit = current.unit; + this.currentTexture = texture; -module.exports = IsValuePowerOfTwo; + return current.unit; + } + } + else + { + this.currentUnit = idx; + this.currentTexture = texture; + return idx; + } + } + }, -/***/ }), -/* 837 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Custom pipelines can use this method in order to perform any required pre-batch tasks + * for the given Game Object. It must return the texture unit the Game Object was assigned. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setGameObject + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object being rendered or added to the batch. + * @param {Phaser.Textures.Frame} [frame] - Optional frame to use. Can override that of the Game Object. + * + * @return {number} The texture unit the Game Object has been assigned. + */ + setGameObject: function (gameObject, frame) + { + if (frame === undefined) { frame = gameObject.frame; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this.pushBatch(frame.source.glTexture); + }, -/** - * @namespace Phaser.Math.Snap - */ + /** + * Check if the current batch of vertices is full. + * + * You can optionally provide an `amount` parameter. If given, it will check if the batch + * needs to flush _if_ the `amount` is added to it. This allows you to test if you should + * flush before populating the batch. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush + * @since 3.0.0 + * + * @param {number} [amount=0] - Will the batch need to flush if this many vertices are added to it? + * + * @return {boolean} `true` if the current batch should be flushed, otherwise `false`. + */ + shouldFlush: function (amount) + { + if (amount === undefined) { amount = 0; } -module.exports = { + return (this.vertexCount + amount > this.vertexCapacity); + }, - Ceil: __webpack_require__(139), - Floor: __webpack_require__(76), - To: __webpack_require__(838) + /** + * Returns the number of vertices that can be added to the current batch before + * it will trigger a flush to happen. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#vertexAvailable + * @since 3.60.0 + * + * @return {number} The number of vertices that can still be added to the current batch before it will flush. + */ + vertexAvailable: function () + { + return this.vertexCapacity - this.vertexCount; + }, -}; + /** + * Resizes the properties used to describe the viewport. + * + * This method is called automatically by the renderer during its resize handler. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#resize + * @fires Phaser.Renderer.WebGL.Pipelines.Events#RESIZE + * @since 3.0.0 + * + * @param {number} width - The new width of this WebGL Pipeline. + * @param {number} height - The new height of this WebGL Pipeline. + * + * @return {this} This WebGLPipeline instance. + */ + resize: function (width, height) + { + if (width !== this.width || height !== this.height) + { + this.flush(); + } + this.width = width; + this.height = height; -/***/ }), -/* 838 */ -/***/ (function(module, exports) { + var targets = this.renderTargets; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (var i = 0; i < targets.length; i++) + { + targets[i].resize(width, height); + } -/** - * Snap a value to nearest grid slice, using rounding. - * - * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10` whereas `14` will snap to `15`. - * - * @function Phaser.Math.Snap.To - * @since 3.0.0 - * - * @param {number} value - The value to snap. - * @param {number} gap - The interval gap of the grid. - * @param {number} [start=0] - Optional starting offset for gap. - * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning. - * - * @return {number} The snapped value. - */ -var SnapTo = function (value, gap, start, divide) -{ - if (start === undefined) { start = 0; } + this.setProjectionMatrix(width, height); - if (gap === 0) - { - return value; - } + this.emit(Events.RESIZE, width, height, this); - value -= start; - value = gap * Math.round(value / gap); + this.onResize(width, height); - return (divide) ? (start + value) / gap : start + value; -}; + return this; + }, -module.exports = SnapTo; + /** + * Adjusts this pipelines ortho Projection Matrix to use the given dimensions + * and resets the `uProjectionMatrix` uniform on all bound shaders. + * + * This method is called automatically by the renderer during its resize handler. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setProjectionMatrix + * @since 3.50.0 + * + * @param {number} width - The new width of this WebGL Pipeline. + * @param {number} height - The new height of this WebGL Pipeline. + * + * @return {this} This WebGLPipeline instance. + */ + setProjectionMatrix: function (width, height) + { + var projectionMatrix = this.projectionMatrix; + // Because not all pipelines have them + if (!projectionMatrix) + { + return this; + } -/***/ }), -/* 839 */ -/***/ (function(module, exports, __webpack_require__) { + this.projectionWidth = width; + this.projectionHeight = height; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + projectionMatrix.ortho(0, width, height, 0, -1000, 1000); -var Class = __webpack_require__(0); + var shaders = this.shaders; -/** - * @classdesc - * A seeded Random Data Generator. - * - * Access via `Phaser.Math.RND` which is an instance of this class pre-defined - * by Phaser. Or, create your own instance to use as you require. - * - * The `Math.RND` generator is seeded by the Game Config property value `seed`. - * If no such config property exists, a random number is used. - * - * If you create your own instance of this class you should provide a seed for it. - * If no seed is given it will use a 'random' one based on Date.now. - * - * @class RandomDataGenerator - * @memberof Phaser.Math - * @constructor - * @since 3.0.0 - * - * @param {(string|string[])} [seeds] - The seeds to use for the random number generator. - */ -var RandomDataGenerator = new Class({ + var name = 'uProjectionMatrix'; - initialize: + for (var i = 0; i < shaders.length; i++) + { + var shader = shaders[i]; - function RandomDataGenerator (seeds) - { - if (seeds === undefined) { seeds = [ (Date.now() * Math.random()).toString() ]; } + if (shader.hasUniform(name)) + { + shader.resetUniform(name); - /** - * Internal var. - * - * @name Phaser.Math.RandomDataGenerator#c - * @type {number} - * @default 1 - * @private - * @since 3.0.0 - */ - this.c = 1; + shader.setMatrix4fv(name, false, projectionMatrix.val, shader); + } + } - /** - * Internal var. - * - * @name Phaser.Math.RandomDataGenerator#s0 - * @type {number} - * @default 0 - * @private - * @since 3.0.0 - */ - this.s0 = 0; + return this; + }, - /** - * Internal var. - * - * @name Phaser.Math.RandomDataGenerator#s1 - * @type {number} - * @default 0 - * @private - * @since 3.0.0 - */ - this.s1 = 0; + /** + * Adjusts this pipelines ortho Projection Matrix to flip the y + * and bottom values. Call with 'false' as the parameter to flip + * them back again. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#flipProjectionMatrix + * @since 3.60.0 + * + * @param {boolean} [flipY=true] - Flip the y and bottom values? + */ + flipProjectionMatrix: function (flipY) + { + if (flipY === undefined) { flipY = true; } - /** - * Internal var. - * - * @name Phaser.Math.RandomDataGenerator#s2 - * @type {number} - * @default 0 - * @private - * @since 3.0.0 - */ - this.s2 = 0; + var projectionMatrix = this.projectionMatrix; - /** - * Internal var. - * - * @name Phaser.Math.RandomDataGenerator#n - * @type {number} - * @default 0 - * @private - * @since 3.2.0 - */ - this.n = 0; + // Because not all pipelines have them + if (!projectionMatrix) + { + return this; + } - /** - * Signs to choose from. - * - * @name Phaser.Math.RandomDataGenerator#signs - * @type {number[]} - * @since 3.0.0 - */ - this.signs = [ -1, 1 ]; + var width = this.projectionWidth; + var height = this.projectionHeight; - if (seeds) + if (flipY) { - this.init(seeds); + projectionMatrix.ortho(0, width, 0, height, -1000, 1000); + } + else + { + projectionMatrix.ortho(0, width, height, 0, -1000, 1000); } + + this.setMatrix4fv('uProjectionMatrix', false, projectionMatrix.val); }, /** - * Private random helper. + * Adjusts this pipelines ortho Projection Matrix to match that of the global + * WebGL Renderer Projection Matrix. * - * @method Phaser.Math.RandomDataGenerator#rnd - * @since 3.0.0 - * @private + * This method is called automatically by the Pipeline Manager when this + * pipeline is set. * - * @return {number} A random number. + * @method Phaser.Renderer.WebGL.WebGLPipeline#updateProjectionMatrix + * @since 3.50.0 */ - rnd: function () + updateProjectionMatrix: function () { - var t = 2091639 * this.s0 + this.c * 2.3283064365386963e-10; // 2^-32 - - this.c = t | 0; - this.s0 = this.s1; - this.s1 = this.s2; - this.s2 = t - this.c; + if (this.projectionMatrix) + { + var globalWidth = this.renderer.projectionWidth; + var globalHeight = this.renderer.projectionHeight; - return this.s2; + if (this.projectionWidth !== globalWidth || this.projectionHeight !== globalHeight) + { + this.setProjectionMatrix(globalWidth, globalHeight); + } + } }, /** - * Internal method that creates a seed hash. + * This method is called every time the Pipeline Manager makes this pipeline the currently active one. * - * @method Phaser.Math.RandomDataGenerator#hash + * It binds the resources and shader needed for this pipeline, including setting the vertex buffer + * and attribute pointers. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#bind + * @fires Phaser.Renderer.WebGL.Pipelines.Events#BIND * @since 3.0.0 - * @private * - * @param {string} data - The value to hash. + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. * - * @return {number} The hashed value. + * @return {this} This WebGLPipeline instance. */ - hash: function (data) + bind: function (currentShader) { - var h; - var n = this.n; + if (currentShader === undefined) { currentShader = this.currentShader; } - data = data.toString(); + if (this.glReset) + { + return this.rebind(currentShader); + } - for (var i = 0; i < data.length; i++) + var wasBound = false; + + var gl = this.gl; + + if (gl.getParameter(gl.ARRAY_BUFFER_BINDING) !== this.vertexBuffer) { - n += data.charCodeAt(i); - h = 0.02519603282416938 * n; - n = h >>> 0; - h -= n; - h *= n; - n = h >>> 0; - h -= n; - n += h * 0x100000000;// 2^32 + gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer); + + this.activeBuffer = this.vertexBuffer; + + wasBound = true; } - this.n = n; + currentShader.bind(wasBound); - return (n >>> 0) * 2.3283064365386963e-10;// 2^-32 + this.currentShader = currentShader; + + this.activeTextures.length = 0; + + this.emit(Events.BIND, this, currentShader); + + this.onActive(currentShader); + + return this; }, /** - * Initialize the state of the random data generator. + * This method is called every time the Pipeline Manager rebinds this pipeline. * - * @method Phaser.Math.RandomDataGenerator#init + * It resets all shaders this pipeline uses, setting their attributes again. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#rebind + * @fires Phaser.Renderer.WebGL.Pipelines.Events#REBIND * @since 3.0.0 * - * @param {(string|string[])} seeds - The seeds to initialize the random data generator with. + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to set as being current. + * + * @return {this} This WebGLPipeline instance. */ - init: function (seeds) + rebind: function (currentShader) { - if (typeof seeds === 'string') - { - this.state(seeds); - } - else + this.activeBuffer = null; + + this.setVertexBuffer(); + + var shaders = this.shaders; + + // Loop in reverse, so the first shader in the array is left as being bound + for (var i = shaders.length - 1; i >= 0; i--) { - this.sow(seeds); + var shader = shaders[i].rebind(); + + if (!currentShader || shader === currentShader) + { + this.currentShader = shader; + } } + + this.activeTextures.length = 0; + + this.emit(Events.REBIND, this.currentShader); + + this.onActive(this.currentShader); + + this.onRebind(); + + this.glReset = false; + + return this; }, /** - * Reset the seed of the random data generator. + * Binds the vertex buffer to be the active ARRAY_BUFFER on the WebGL context. * - * _Note_: the seed array is only processed up to the first `undefined` (or `null`) value, should such be present. + * It first checks to see if it's already set as the active buffer and only + * binds itself if not. * - * @method Phaser.Math.RandomDataGenerator#sow - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.WebGLPipeline#setVertexBuffer + * @since 3.50.0 * - * @param {string[]} seeds - The array of seeds: the `toString()` of each value is used. + * @param {WebGLBuffer} [buffer] - The Vertex Buffer to be bound. Defaults to the one owned by this pipeline. + * + * @return {boolean} `true` if the vertex buffer was bound, or `false` if it was already bound. */ - sow: function (seeds) + setVertexBuffer: function (buffer) { - // Always reset to default seed - this.n = 0xefc8249d; - this.s0 = this.hash(' '); - this.s1 = this.hash(' '); - this.s2 = this.hash(' '); - this.c = 1; + if (buffer === undefined) { buffer = this.vertexBuffer; } - if (!seeds) + if (buffer !== this.activeBuffer) { - return; - } + var gl = this.gl; - // Apply any seeds - for (var i = 0; i < seeds.length && (seeds[i] != null); i++) - { - var seed = seeds[i]; + this.gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - this.s0 -= this.hash(seed); - this.s0 += ~~(this.s0 < 0); - this.s1 -= this.hash(seed); - this.s1 += ~~(this.s1 < 0); - this.s2 -= this.hash(seed); - this.s2 += ~~(this.s2 < 0); + this.activeBuffer = buffer; + + return true; } + + return false; }, /** - * Returns a random integer between 0 and 2^32. + * This method is called as a result of the `WebGLPipeline.batchQuad` method, right before a quad + * belonging to a Game Object is about to be added to the batch. When this is called, the + * renderer has just performed a flush. It will bind the current render target, if any are set + * and finally call the `onPreBatch` hook. * - * @method Phaser.Math.RandomDataGenerator#integer - * @since 3.0.0 + * It is also called as part of the `PipelineManager.preBatch` method when processing Post FX Pipelines. * - * @return {number} A random integer between 0 and 2^32. + * @method Phaser.Renderer.WebGL.WebGLPipeline#preBatch + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.Cameras.Scene2D.Camera)} [gameObject] - The Game Object or Camera that invoked this pipeline, if any. + * + * @return {this} This WebGLPipeline instance. */ - integer: function () + preBatch: function (gameObject) { - // 2^32 - return this.rnd() * 0x100000000; + if (this.currentRenderTarget) + { + this.currentRenderTarget.bind(); + } + + this.onPreBatch(gameObject); + + return this; }, /** - * Returns a random real number between 0 and 1. + * This method is called as a result of the `WebGLPipeline.batchQuad` method, right after a quad + * belonging to a Game Object has been added to the batch. When this is called, the + * renderer has just performed a flush. * - * @method Phaser.Math.RandomDataGenerator#frac - * @since 3.0.0 + * It calls the `onDraw` hook followed by the `onPostBatch` hook, which can be used to perform + * additional Post FX Pipeline processing. * - * @return {number} A random real number between 0 and 1. + * It is also called as part of the `PipelineManager.postBatch` method when processing Post FX Pipelines. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#postBatch + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.GameObject|Phaser.Cameras.Scene2D.Camera)} [gameObject] - The Game Object or Camera that invoked this pipeline, if any. + * + * @return {this} This WebGLPipeline instance. */ - frac: function () + postBatch: function (gameObject) { - // 2^-53 - return this.rnd() + (this.rnd() * 0x200000 | 0) * 1.1102230246251565e-16; + this.onDraw(this.currentRenderTarget); + + this.onPostBatch(gameObject); + + return this; }, /** - * Returns a random real number between 0 and 2^32. + * This method is only used by Sprite FX and Post FX Pipelines and those that extend from them. * - * @method Phaser.Math.RandomDataGenerator#real - * @since 3.0.0 + * This method is called every time the `postBatch` method is called and is passed a + * reference to the current render target. * - * @return {number} A random real number between 0 and 2^32. + * At the very least a Post FX Pipeline should call `this.bindAndDraw(renderTarget)`, + * however, you can do as much additional processing as you like in this method if + * you override it from within your own pipelines. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onDraw + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} renderTarget - The Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [swapTarget] - A Swap Render Target, useful for double-buffer effects. Only set by SpriteFX Pipelines. */ - real: function () + onDraw: function () { - return this.integer() + this.frac(); }, /** - * Returns a random integer between and including min and max. + * This method is called every time the Pipeline Manager deactivates this pipeline, swapping from + * it to another one. This happens after a call to `flush` and before the new pipeline is bound. * - * @method Phaser.Math.RandomDataGenerator#integerInRange + * @method Phaser.Renderer.WebGL.WebGLPipeline#unbind + * @since 3.50.0 + */ + unbind: function () + { + if (this.currentRenderTarget) + { + this.currentRenderTarget.unbind(); + } + }, + + /** + * Uploads the vertex data and emits a draw call for the current batch of vertices. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#flush + * @fires Phaser.Renderer.WebGL.Pipelines.Events#BEFORE_FLUSH + * @fires Phaser.Renderer.WebGL.Pipelines.Events#AFTER_FLUSH * @since 3.0.0 * - * @param {number} min - The minimum value in the range. - * @param {number} max - The maximum value in the range. + * @param {boolean} [isPostFlush=false] - Was this flush invoked as part of a post-process, or not? * - * @return {number} A random number between min and max. + * @return {this} This WebGLPipeline instance. */ - integerInRange: function (min, max) + flush: function (isPostFlush) { - return Math.floor(this.realInRange(0, max - min + 1) + min); + if (isPostFlush === undefined) { isPostFlush = false; } + + if (this.vertexCount > 0) + { + this.emit(Events.BEFORE_FLUSH, this, isPostFlush); + + this.onBeforeFlush(isPostFlush); + + var gl = this.gl; + var vertexCount = this.vertexCount; + var vertexSize = this.currentShader.vertexSize; + var topology = this.topology; + + if (this.active) + { + this.setVertexBuffer(); + + if (vertexCount === this.vertexCapacity) + { + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.DYNAMIC_DRAW); + } + else + { + gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize)); + } + + var i; + var entry; + var texture; + var batch = this.batch; + var activeTextures = this.activeTextures; + + if (this.forceZero) + { + // Single Texture Pipeline + if (!activeTextures[0]) + { + gl.activeTexture(gl.TEXTURE0); + } + + for (i = 0; i < batch.length; i++) + { + entry = batch[i]; + texture = entry.texture[0]; + + if (activeTextures[0] !== texture) + { + gl.bindTexture(gl.TEXTURE_2D, texture); + + activeTextures[0] = texture; + } + + gl.drawArrays(topology, entry.start, entry.count); + } + } + else + { + for (i = 0; i < batch.length; i++) + { + entry = batch[i]; + + for (var t = 0; t <= entry.maxUnit; t++) + { + texture = entry.texture[t]; + + if (activeTextures[t] !== texture) + { + gl.activeTexture(gl.TEXTURE0 + t); + gl.bindTexture(gl.TEXTURE_2D, texture); + + activeTextures[t] = texture; + } + } + + gl.drawArrays(topology, entry.start, entry.count); + } + } + } + + this.vertexCount = 0; + + this.batch.length = 0; + this.currentBatch = null; + this.currentTexture = null; + this.currentUnit = 0; + + this.emit(Events.AFTER_FLUSH, this, isPostFlush); + + this.onAfterFlush(isPostFlush); + } + + return this; }, /** - * Returns a random integer between and including min and max. - * This method is an alias for RandomDataGenerator.integerInRange. + * By default this is an empty method hook that you can override and use in your own custom pipelines. * - * @method Phaser.Math.RandomDataGenerator#between - * @since 3.0.0 + * This method is called every time the Pipeline Manager makes this the active pipeline. It is called + * at the end of the `WebGLPipeline.bind` method, after the current shader has been set. The current + * shader is passed to this hook. * - * @param {number} min - The minimum value in the range. - * @param {number} max - The maximum value in the range. + * For example, if a display list has 3 Sprites in it that all use the same pipeline, this hook will + * only be called for the first one, as the 2nd and 3rd Sprites do not cause the pipeline to be changed. * - * @return {number} A random number between min and max. + * If you need to listen for that event instead, use the `onBind` hook. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onActive + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.WebGLShader} currentShader - The shader that was set as current. */ - between: function (min, max) + onActive: function () { - return Math.floor(this.realInRange(0, max - min + 1) + min); }, /** - * Returns a random real number between min and max. + * By default this is an empty method hook that you can override and use in your own custom pipelines. * - * @method Phaser.Math.RandomDataGenerator#realInRange - * @since 3.0.0 + * This method is called every time a **Game Object** asks the Pipeline Manager to use this pipeline, + * even if the pipeline is already active. * - * @param {number} min - The minimum value in the range. - * @param {number} max - The maximum value in the range. + * Unlike the `onActive` method, which is only called when the Pipeline Manager makes this pipeline + * active, this hook is called for every Game Object that requests use of this pipeline, allowing you to + * perform per-object set-up, such as loading shader uniform data. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. + */ + onBind: function () + { + }, + + /** + * By default this is an empty method hook that you can override and use in your own custom pipelines. + * + * This method is called when the Pipeline Manager needs to rebind this pipeline. This happens after a + * pipeline has been cleared, usually when passing control over to a 3rd party WebGL library, like Spine, + * and then returing to Phaser again. * - * @return {number} A random number between min and max. + * @method Phaser.Renderer.WebGL.WebGLPipeline#onRebind + * @since 3.50.0 */ - realInRange: function (min, max) + onRebind: function () { - return this.frac() * (max - min) + min; }, /** - * Returns a random real number between -1 and 1. + * By default this is an empty method hook that you can override and use in your own custom pipelines. * - * @method Phaser.Math.RandomDataGenerator#normal - * @since 3.0.0 + * This method is called every time the `batchQuad` or `batchTri` methods are called. If this was + * as a result of a Game Object, then the Game Object reference is passed to this hook too. * - * @return {number} A random real number between -1 and 1. + * This hook is called _after_ the quad (or tri) has been added to the batch, so you can safely + * call 'flush' from within this. + * + * Note that Game Objects may call `batchQuad` or `batchTri` multiple times for a single draw, + * for example the Graphics Game Object. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. */ - normal: function () + onBatch: function () { - return 1 - (2 * this.frac()); }, /** - * Returns a valid RFC4122 version4 ID hex string from https://gist.github.com/1308368 + * By default this is an empty method hook that you can override and use in your own custom pipelines. * - * @method Phaser.Math.RandomDataGenerator#uuid - * @since 3.0.0 + * This method is called immediately before a **Game Object** is about to add itself to the batch. * - * @return {string} A valid RFC4122 version4 ID hex string + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreBatch + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. */ - uuid: function () + onPreBatch: function () { - var a = ''; - var b = ''; - - for (b = a = ''; a++ < 36; b += ~a % 5 | a * 3 & 4 ? (a ^ 15 ? 8 ^ this.frac() * (a ^ 20 ? 16 : 4) : 4).toString(16) : '-') - { - // eslint-disable-next-line no-empty - } - - return b; }, /** - * Returns a random element from within the given array. + * By default this is an empty method hook that you can override and use in your own custom pipelines. * - * @method Phaser.Math.RandomDataGenerator#pick - * @since 3.0.0 - * - * @generic T - * @genericUse {T[]} - [array] - * @genericUse {T} - [$return] + * This method is called immediately after a **Game Object** has been added to the batch. * - * @param {T[]} array - The array to pick a random element from. + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostBatch + * @since 3.50.0 * - * @return {T} A random member of the array. + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object that invoked this pipeline, if any. */ - pick: function (array) + onPostBatch: function () { - return array[this.integerInRange(0, array.length - 1)]; }, /** - * Returns a sign to be used with multiplication operator. + * By default this is an empty method hook that you can override and use in your own custom pipelines. * - * @method Phaser.Math.RandomDataGenerator#sign - * @since 3.0.0 + * This method is called once per frame, right before anything has been rendered, but after the canvas + * has been cleared. If this pipeline has a render target, it will also have been cleared by this point. * - * @return {number} -1 or +1. + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender + * @since 3.50.0 */ - sign: function () + onPreRender: function () { - return this.pick(this.signs); }, /** - * Returns a random element from within the given array, favoring the earlier entries. + * By default this is an empty method hook that you can override and use in your own custom pipelines. * - * @method Phaser.Math.RandomDataGenerator#weightedPick - * @since 3.0.0 + * This method is called _once per frame_, by every Camera in a Scene that wants to render. * - * @generic T - * @genericUse {T[]} - [array] - * @genericUse {T} - [$return] + * It is called at the start of the rendering process, before anything has been drawn to the Camera. * - * @param {T[]} array - The array to pick a random element from. + * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender + * @since 3.50.0 * - * @return {T} A random member of the array. + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. */ - weightedPick: function (array) + onRender: function () { - return array[~~(Math.pow(this.frac(), 2) * (array.length - 1) + 0.5)]; }, /** - * Returns a random timestamp between min and max, or between the beginning of 2000 and the end of 2020 if min and max aren't specified. + * By default this is an empty method hook that you can override and use in your own custom pipelines. * - * @method Phaser.Math.RandomDataGenerator#timestamp - * @since 3.0.0 + * This method is called _once per frame_, after all rendering has happened and snapshots have been taken. * - * @param {number} min - The minimum value in the range. - * @param {number} max - The maximum value in the range. + * It is called at the very end of the rendering process, once all Cameras, for all Scenes, have + * been rendered. * - * @return {number} A random timestamp between min and max. + * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender + * @since 3.50.0 */ - timestamp: function (min, max) + onPostRender: function () { - return this.realInRange(min || 946684800000, max || 1577862000000); }, /** - * Returns a random angle between -180 and 180. + * By default this is an empty method hook that you can override and use in your own custom pipelines. * - * @method Phaser.Math.RandomDataGenerator#angle - * @since 3.0.0 + * This method is called every time this pipeline is asked to flush its batch. * - * @return {number} A random number between -180 and 180. + * It is called immediately before the `gl.bufferData` and `gl.drawArrays` calls are made, so you can + * perform any final pre-render modifications. To apply changes post-render, see `onAfterFlush`. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onBeforeFlush + * @since 3.50.0 + * + * @param {boolean} [isPostFlush=false] - Was this flush invoked as part of a post-process, or not? */ - angle: function () + onBeforeFlush: function () { - return this.integerInRange(-180, 180); }, /** - * Returns a random rotation in radians, between -3.141 and 3.141 + * By default this is an empty method hook that you can override and use in your own custom pipelines. * - * @method Phaser.Math.RandomDataGenerator#rotation - * @since 3.0.0 + * This method is called immediately after this pipeline has finished flushing its batch. * - * @return {number} A random number between -3.141 and 3.141 + * It is called after the `gl.drawArrays` call. + * + * You can perform additional post-render effects, but be careful not to call `flush` + * on this pipeline from within this method, or you'll cause an infinite loop. + * + * To apply changes pre-render, see `onBeforeFlush`. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#onAfterFlush + * @since 3.50.0 + * + * @param {boolean} [isPostFlush=false] - Was this flush invoked as part of a post-process, or not? */ - rotation: function () + onAfterFlush: function () { - return this.realInRange(-3.1415926, 3.1415926); }, /** - * Gets or Sets the state of the generator. This allows you to retain the values - * that the generator is using between games, i.e. in a game save file. - * - * To seed this generator with a previously saved state you can pass it as the - * `seed` value in your game config, or call this method directly after Phaser has booted. - * - * Call this method with no parameters to return the current state. + * Adds a single vertex to the current vertex buffer and increments the + * `vertexCount` property by 1. * - * If providing a state it should match the same format that this method - * returns, which is a string with a header `!rnd` followed by the `c`, - * `s0`, `s1` and `s2` values respectively, each comma-delimited. + * This method is called directly by `batchTri` and `batchQuad`. * - * @method Phaser.Math.RandomDataGenerator#state - * @since 3.0.0 + * It does not perform any batch limit checking itself, so if you need to call + * this method directly, do so in the same way that `batchQuad` does, for example. * - * @param {string} [state] - Generator state to be set. + * @method Phaser.Renderer.WebGL.WebGLPipeline#batchVert + * @since 3.50.0 * - * @return {string} The current state of the generator. + * @param {number} x - The vertex x position. + * @param {number} y - The vertex y position. + * @param {number} u - UV u value. + * @param {number} v - UV v value. + * @param {number} unit - Texture unit to which the texture needs to be bound. + * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {number} tint - The tint color value. */ - state: function (state) + batchVert: function (x, y, u, v, unit, tintEffect, tint) { - if (typeof state === 'string' && state.match(/^!rnd/)) - { - state = state.split(','); + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; - this.c = parseFloat(state[1]); - this.s0 = parseFloat(state[2]); - this.s1 = parseFloat(state[3]); - this.s2 = parseFloat(state[4]); - } + var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; - return [ '!rnd', this.c, this.s0, this.s1, this.s2 ].join(','); + vertexViewF32[++vertexOffset] = x; + vertexViewF32[++vertexOffset] = y; + vertexViewF32[++vertexOffset] = u; + vertexViewF32[++vertexOffset] = v; + vertexViewF32[++vertexOffset] = unit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = tint; + + this.vertexCount++; + + this.currentBatch.count = (this.vertexCount - this.currentBatch.start); }, /** - * Shuffles the given array, using the current seed. + * Adds the vertices data into the batch and flushes if full. * - * @method Phaser.Math.RandomDataGenerator#shuffle - * @since 3.7.0 + * Assumes 6 vertices in the following arrangement: * - * @generic T - * @genericUse {T[]} - [array,$return] + * ``` + * 0----3 + * |\ B| + * | \ | + * | \ | + * | A \| + * | \ + * 1----2 + * ``` * - * @param {T[]} [array] - The array to be shuffled. + * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3 * - * @return {T[]} The shuffled array. + * @method Phaser.Renderer.WebGL.WebGLPipeline#batchQuad + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.GameObject|null)} gameObject - The Game Object, if any, drawing this quad. + * @param {number} x0 - The top-left x position. + * @param {number} y0 - The top-left y position. + * @param {number} x1 - The bottom-left x position. + * @param {number} y1 - The bottom-left y position. + * @param {number} x2 - The bottom-right x position. + * @param {number} y2 - The bottom-right y position. + * @param {number} x3 - The top-right x position. + * @param {number} y3 - The top-right y position. + * @param {number} u0 - UV u0 value. + * @param {number} v0 - UV v0 value. + * @param {number} u1 - UV u1 value. + * @param {number} v1 - UV v1 value. + * @param {number} tintTL - The top-left tint color value. + * @param {number} tintTR - The top-right tint color value. + * @param {number} tintBL - The bottom-left tint color value. + * @param {number} tintBR - The bottom-right tint color value. + * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {number} [unit=0] - Texture unit to which the texture needs to be bound. + * + * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. */ - shuffle: function (array) + batchQuad: function (gameObject, x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, unit) { - var len = array.length - 1; + if (unit === undefined) { unit = this.currentUnit; } - for (var i = len; i > 0; i--) + var hasFlushed = false; + + if (this.shouldFlush(6)) { - var randomIndex = Math.floor(this.frac() * (i + 1)); - var itemAtIndex = array[randomIndex]; + this.flush(); - array[randomIndex] = array[i]; - array[i] = itemAtIndex; + hasFlushed = true; } - return array; - } - -}); - -module.exports = RandomDataGenerator; + if (!this.currentBatch) + { + unit = this.setTexture2D(texture); + } + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; -/***/ }), -/* 840 */ -/***/ (function(module, exports) { + var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + vertexViewF32[++vertexOffset] = x0; + vertexViewF32[++vertexOffset] = y0; + vertexViewF32[++vertexOffset] = u0; + vertexViewF32[++vertexOffset] = v0; + vertexViewF32[++vertexOffset] = unit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = tintTL; -/** - * Calculate the mean average of the given values. - * - * @function Phaser.Math.Average - * @since 3.0.0 - * - * @param {number[]} values - The values to average. - * - * @return {number} The average value. - */ -var Average = function (values) -{ - var sum = 0; + vertexViewF32[++vertexOffset] = x1; + vertexViewF32[++vertexOffset] = y1; + vertexViewF32[++vertexOffset] = u0; + vertexViewF32[++vertexOffset] = v1; + vertexViewF32[++vertexOffset] = unit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = tintBL; - for (var i = 0; i < values.length; i++) - { - sum += (+values[i]); - } + vertexViewF32[++vertexOffset] = x2; + vertexViewF32[++vertexOffset] = y2; + vertexViewF32[++vertexOffset] = u1; + vertexViewF32[++vertexOffset] = v1; + vertexViewF32[++vertexOffset] = unit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = tintBR; - return sum / values.length; -}; + vertexViewF32[++vertexOffset] = x0; + vertexViewF32[++vertexOffset] = y0; + vertexViewF32[++vertexOffset] = u0; + vertexViewF32[++vertexOffset] = v0; + vertexViewF32[++vertexOffset] = unit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = tintTL; -module.exports = Average; + vertexViewF32[++vertexOffset] = x2; + vertexViewF32[++vertexOffset] = y2; + vertexViewF32[++vertexOffset] = u1; + vertexViewF32[++vertexOffset] = v1; + vertexViewF32[++vertexOffset] = unit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = tintBR; + vertexViewF32[++vertexOffset] = x3; + vertexViewF32[++vertexOffset] = y3; + vertexViewF32[++vertexOffset] = u1; + vertexViewF32[++vertexOffset] = v0; + vertexViewF32[++vertexOffset] = unit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = tintTR; -/***/ }), -/* 841 */ -/***/ (function(module, exports) { + this.vertexCount += 6; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.currentBatch.count = (this.vertexCount - this.currentBatch.start); -/** - * Ceils to some place comparative to a `base`, default is 10 for decimal place. - * - * The `place` is represented by the power applied to `base` to get that place. - * - * @function Phaser.Math.CeilTo - * @since 3.0.0 - * - * @param {number} value - The value to round. - * @param {number} [place=0] - The place to round to. - * @param {number} [base=10] - The base to round in. Default is 10 for decimal. - * - * @return {number} The rounded value. - */ -var CeilTo = function (value, place, base) -{ - if (place === undefined) { place = 0; } - if (base === undefined) { base = 10; } + this.onBatch(gameObject); - var p = Math.pow(base, -place); + return hasFlushed; + }, - return Math.ceil(value * p) / p; -}; + /** + * Adds the vertices data into the batch and flushes if full. + * + * Assumes 3 vertices in the following arrangement: + * + * ``` + * 0 + * |\ + * | \ + * | \ + * | \ + * | \ + * 1-----2 + * ``` + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#batchTri + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.GameObject|null)} gameObject - The Game Object, if any, drawing this quad. + * @param {number} x1 - The bottom-left x position. + * @param {number} y1 - The bottom-left y position. + * @param {number} x2 - The bottom-right x position. + * @param {number} y2 - The bottom-right y position. + * @param {number} x3 - The top-right x position. + * @param {number} y3 - The top-right y position. + * @param {number} u0 - UV u0 value. + * @param {number} v0 - UV v0 value. + * @param {number} u1 - UV u1 value. + * @param {number} v1 - UV v1 value. + * @param {number} tintTL - The top-left tint color value. + * @param {number} tintTR - The top-right tint color value. + * @param {number} tintBL - The bottom-left tint color value. + * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {number} [unit=0] - Texture unit to which the texture needs to be bound. + * + * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. + */ + batchTri: function (gameObject, x0, y0, x1, y1, x2, y2, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect, texture, unit) + { + if (unit === undefined) { unit = this.currentUnit; } -module.exports = CeilTo; + var hasFlushed = false; + if (this.shouldFlush(3)) + { + this.flush(); -/***/ }), -/* 842 */ -/***/ (function(module, exports) { + hasFlushed = true; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (!this.currentBatch) + { + unit = this.setTexture2D(texture); + } -/** - * Calculates the positive difference of two given numbers. - * - * @function Phaser.Math.Difference - * @since 3.0.0 - * - * @param {number} a - The first number in the calculation. - * @param {number} b - The second number in the calculation. - * - * @return {number} The positive difference of the two given numbers. - */ -var Difference = function (a, b) -{ - return Math.abs(a - b); -}; + var vertexViewF32 = this.vertexViewF32; + var vertexViewU32 = this.vertexViewU32; -module.exports = Difference; + var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; + vertexViewF32[++vertexOffset] = x0; + vertexViewF32[++vertexOffset] = y0; + vertexViewF32[++vertexOffset] = u0; + vertexViewF32[++vertexOffset] = v0; + vertexViewF32[++vertexOffset] = unit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = tintTL; -/***/ }), -/* 843 */ -/***/ (function(module, exports, __webpack_require__) { + vertexViewF32[++vertexOffset] = x1; + vertexViewF32[++vertexOffset] = y1; + vertexViewF32[++vertexOffset] = u0; + vertexViewF32[++vertexOffset] = v1; + vertexViewF32[++vertexOffset] = unit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = tintTR; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + vertexViewF32[++vertexOffset] = x2; + vertexViewF32[++vertexOffset] = y2; + vertexViewF32[++vertexOffset] = u1; + vertexViewF32[++vertexOffset] = v1; + vertexViewF32[++vertexOffset] = unit; + vertexViewF32[++vertexOffset] = tintEffect; + vertexViewU32[++vertexOffset] = tintBL; -var Clamp = __webpack_require__(18); -var Class = __webpack_require__(0); -var Matrix4 = __webpack_require__(69); -var NOOP = __webpack_require__(1); + this.vertexCount += 3; -var tempMatrix = new Matrix4(); + this.currentBatch.count = (this.vertexCount - this.currentBatch.start); -/** - * @classdesc - * - * @class Euler - * @memberof Phaser.Math - * @constructor - * @since 3.50.0 - * - * @param {number} [x] - The x component. - * @param {number} [y] - The y component. - * @param {number} [z] - The z component. - */ -var Euler = new Class({ + this.onBatch(gameObject); - initialize: + return hasFlushed; + }, - function Euler (x, y, z, order) + /** + * Pushes a filled rectangle into the vertex batch. + * + * The dimensions are run through `Math.floor` before the quad is generated. + * + * Rectangle has no transform values and isn't transformed into the local space. + * + * Used for directly batching untransformed rectangles, such as Camera background colors. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#drawFillRect + * @since 3.50.0 + * + * @param {number} x - Horizontal top left coordinate of the rectangle. + * @param {number} y - Vertical top left coordinate of the rectangle. + * @param {number} width - Width of the rectangle. + * @param {number} height - Height of the rectangle. + * @param {number} color - Color of the rectangle to draw. + * @param {number} alpha - Alpha value of the rectangle to draw. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * @param {boolean} [flipUV=true] - Flip the vertical UV coordinates of the texture before rendering? + */ + drawFillRect: function (x, y, width, height, color, alpha, texture, flipUV) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (z === undefined) { z = 0; } - if (order === undefined) { order = Euler.DefaultOrder; } - - this._x = x; - this._y = y; - this._z = z; - this._order = order; + if (texture === undefined) { texture = this.renderer.whiteTexture; } + if (flipUV === undefined) { flipUV = true; } - this.onChangeCallback = NOOP; - }, + x = Math.floor(x); + y = Math.floor(y); - x: { - get: function () - { - return this._x; - }, + var xw = Math.floor(x + width); + var yh = Math.floor(y + height); - set: function (value) - { - this._x = value; + var unit = this.setTexture2D(texture); - this.onChangeCallback(this); - } - }, + var tint = Utils.getTintAppendFloatAlphaAndSwap(color, alpha); - y: { - get: function () - { - return this._y; - }, + var u0 = 0; + var v0 = 0; + var u1 = 1; + var v1 = 1; - set: function (value) + if (flipUV) { - this._y = value; - - this.onChangeCallback(this); + v0 = 1; + v1 = 0; } - }, - - z: { - get: function () - { - return this._z; - }, - - set: function (value) - { - this._z = value; - this.onChangeCallback(this); - } + this.batchQuad(null, x, y, x, yh, xw, yh, xw, y, u0, v0, u1, v1, tint, tint, tint, tint, 0, texture, unit); }, - order: { - get: function () - { - return this._order; - }, - - set: function (value) - { - this._order = value; + /** + * Sets the texture to be bound to the next available texture unit and returns + * the unit id. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setTexture2D + * @since 3.50.0 + * + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses `whiteTexture`. + * + * @return {number} The assigned texture unit. + */ + setTexture2D: function (texture) + { + if (texture === undefined) { texture = this.renderer.whiteTexture; } - this.onChangeCallback(this); - } + return this.pushBatch(texture); }, - set: function (x, y, z, order) + /** + * Activates the given WebGL Texture and binds it to the requested texture slot. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#bindTexture + * @since 3.50.0 + * + * @param {WebGLTexture} [target] - The WebGLTexture to activate and bind. + * @param {number} [unit=0] - The WebGL texture ID to activate. Defaults to `gl.TEXTURE0`. + * + * @return {this} This WebGL Pipeline instance. + */ + bindTexture: function (texture, unit) { - if (order === undefined) { order = this._order; } + if (unit === undefined) { unit = 0; } - this._x = x; - this._y = y; - this._z = z; - this._order = order; + var gl = this.gl; - this.onChangeCallback(this); + gl.activeTexture(gl.TEXTURE0 + unit); + + gl.bindTexture(gl.TEXTURE_2D, texture); return this; }, - copy: function (euler) + /** + * Activates the given Render Target texture and binds it to the + * requested WebGL texture slot. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#bindRenderTarget + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The Render Target to activate and bind. + * @param {number} [unit=0] - The WebGL texture ID to activate. Defaults to `gl.TEXTURE0`. + * + * @return {this} This WebGL Pipeline instance. + */ + bindRenderTarget: function (target, unit) { - return this.set(euler.x, euler.y, euler.z, euler.order); + return this.bindTexture(target.texture, unit); }, - setFromQuaternion: function (quaternion, order, update) + /** + * Sets the current duration into a 1f uniform value based on the given name. + * + * This can be used for mapping time uniform values, such as `iTime`. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setTime + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + setTime: function (name, shader) { - if (order === undefined) { order = this._order; } - if (update === undefined) { update = false; } - - tempMatrix.fromQuat(quaternion); + this.set1f(name, this.game.loop.getDuration(), shader); - return this.setFromRotationMatrix(tempMatrix, order, update); + return this; }, - setFromRotationMatrix: function (matrix, order, update) + /** + * Sets a boolean uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setBoolean + * @since 3.60.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} value - The new value of the `boolean` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + setBoolean: function (name, value, shader) { - if (order === undefined) { order = this._order; } - if (update === undefined) { update = false; } - - var elements = matrix.val; + if (shader === undefined) { shader = this.currentShader; } - // Upper 3x3 of matrix is un-scaled rotation matrix - var m11 = elements[0]; - var m12 = elements[4]; - var m13 = elements[8]; - var m21 = elements[1]; - var m22 = elements[5]; - var m23 = elements[9]; - var m31 = elements[2]; - var m32 = elements[6]; - var m33 = elements[10]; + shader.setBoolean(name, value); - var x = 0; - var y = 0; - var z = 0; - var epsilon = 0.99999; + return this; + }, - switch (order) - { - case 'XYZ': - { - y = Math.asin(Clamp(m13, -1, 1)); + /** + * Sets a 1f uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set1f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new value of the `float` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set1f: function (name, x, shader) + { + if (shader === undefined) { shader = this.currentShader; } - if (Math.abs(m13) < epsilon) - { - x = Math.atan2(-m23, m33); - z = Math.atan2(-m12, m11); - } - else - { - x = Math.atan2(m32, m22); - } + shader.set1f(name, x); - break; - } + return this; + }, - case 'YXZ': - { - x = Math.asin(-Clamp(m23, -1, 1)); + /** + * Sets a 2f uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set2f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `vec2` uniform. + * @param {number} y - The new Y component of the `vec2` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set2f: function (name, x, y, shader) + { + if (shader === undefined) { shader = this.currentShader; } - if (Math.abs(m23) < epsilon) - { - y = Math.atan2(m13, m33); - z = Math.atan2(m21, m22); - } - else - { - y = Math.atan2(-m31, m11); - } + shader.set2f(name, x, y); - break; - } + return this; + }, - case 'ZXY': - { - x = Math.asin(Clamp(m32, -1, 1)); + /** + * Sets a 3f uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set3f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `vec3` uniform. + * @param {number} y - The new Y component of the `vec3` uniform. + * @param {number} z - The new Z component of the `vec3` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set3f: function (name, x, y, z, shader) + { + if (shader === undefined) { shader = this.currentShader; } - if (Math.abs(m32) < epsilon) - { - y = Math.atan2(-m31, m33); - z = Math.atan2(-m12, m22); - } - else - { - z = Math.atan2(m21, m11); - } + shader.set3f(name, x, y, z); - break; - } + return this; + }, - case 'ZYX': - { - y = Math.asin(-Clamp(m31, -1, 1)); + /** + * Sets a 4f uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set4f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - X component of the uniform + * @param {number} y - Y component of the uniform + * @param {number} z - Z component of the uniform + * @param {number} w - W component of the uniform + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set4f: function (name, x, y, z, w, shader) + { + if (shader === undefined) { shader = this.currentShader; } - if (Math.abs(m31) < epsilon) - { - x = Math.atan2(m32, m33); - z = Math.atan2(m21, m11); - } - else - { - z = Math.atan2(-m12, m22); - } + shader.set4f(name, x, y, z, w); - break; - } + return this; + }, - case 'YZX': - { - z = Math.asin(Clamp(m21, -1, 1)); + /** + * Sets a 1fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set1fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set1fv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } - if (Math.abs(m21) < epsilon) - { - x = Math.atan2(-m23, m22); - y = Math.atan2(-m31, m11); - } - else - { - y = Math.atan2(m13, m33); - } + shader.set1fv(name, arr); - break; - } + return this; + }, - case 'XZY': - { - z = Math.asin(-Clamp(m12, -1, 1)); + /** + * Sets a 2fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set2fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set2fv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } - if (Math.abs(m12) < epsilon) - { - x = Math.atan2(m32, m22); - y = Math.atan2(m13, m11); - } - else - { - x = Math.atan2(-m23, m33); - } + shader.set2fv(name, arr); - break; - } - } + return this; + }, - this._x = x; - this._y = y; - this._z = z; - this._order = order; + /** + * Sets a 3fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set3fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set3fv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } - if (update) - { - this.onChangeCallback(this); - } + shader.set3fv(name, arr); return this; - } - -}); - -Euler.RotationOrders = [ 'XYZ', 'YXZ', 'ZXY', 'ZYX', 'YZX', 'XZY' ]; + }, -Euler.DefaultOrder = 'XYZ'; + /** + * Sets a 4fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set4fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set4fv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } -module.exports = Euler; + shader.set4fv(name, arr); + return this; + }, -/***/ }), -/* 844 */ -/***/ (function(module, exports) { + /** + * Sets a 1iv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set1iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set1iv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + shader.set1iv(name, arr); -/** - * Floors to some place comparative to a `base`, default is 10 for decimal place. - * - * The `place` is represented by the power applied to `base` to get that place. - * - * @function Phaser.Math.FloorTo - * @since 3.0.0 - * - * @param {number} value - The value to round. - * @param {number} [place=0] - The place to round to. - * @param {number} [base=10] - The base to round in. Default is 10 for decimal. - * - * @return {number} The rounded value. - */ -var FloorTo = function (value, place, base) -{ - if (place === undefined) { place = 0; } - if (base === undefined) { base = 10; } + return this; + }, - var p = Math.pow(base, -place); + /** + * Sets a 2iv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set2iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set2iv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } - return Math.floor(value * p) / p; -}; + shader.set2iv(name, arr); -module.exports = FloorTo; + return this; + }, + /** + * Sets a 3iv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set3iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set3iv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } -/***/ }), -/* 845 */ -/***/ (function(module, exports) { + shader.set3iv(name, arr); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -/** - * Calculate a per-ms speed from a distance and time (given in seconds). - * - * @function Phaser.Math.GetSpeed - * @since 3.0.0 - * - * @param {number} distance - The distance. - * @param {number} time - The time, in seconds. - * - * @return {number} The speed, in distance per ms. - * - * @example - * // 400px over 1 second is 0.4 px/ms - * Phaser.Math.GetSpeed(400, 1) // -> 0.4 - */ -var GetSpeed = function (distance, time) -{ - return (distance / time) / 1000; -}; + /** + * Sets a 4iv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set4iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set4iv: function (name, arr, shader) + { + if (shader === undefined) { shader = this.currentShader; } -module.exports = GetSpeed; + shader.set4iv(name, arr); + return this; + }, -/***/ }), -/* 846 */ -/***/ (function(module, exports) { + /** + * Sets a 1i uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set1i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new value of the `int` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set1i: function (name, x, shader) + { + if (shader === undefined) { shader = this.currentShader; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + shader.set1i(name, x); -/** - * Check if a given value is an even number. - * - * @function Phaser.Math.IsEven - * @since 3.0.0 - * - * @param {number} value - The number to perform the check with. - * - * @return {boolean} Whether the number is even or not. - */ -var IsEven = function (value) -{ - // Use abstract equality == for "is number" test + return this; + }, - // eslint-disable-next-line eqeqeq - return (value == parseFloat(value)) ? !(value % 2) : void 0; -}; + /** + * Sets a 2i uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set2i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `ivec2` uniform. + * @param {number} y - The new Y component of the `ivec2` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set2i: function (name, x, y, shader) + { + if (shader === undefined) { shader = this.currentShader; } -module.exports = IsEven; + shader.set2i(name, x, y); + return this; + }, -/***/ }), -/* 847 */ -/***/ (function(module, exports) { + /** + * Sets a 3i uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set3i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `ivec3` uniform. + * @param {number} y - The new Y component of the `ivec3` uniform. + * @param {number} z - The new Z component of the `ivec3` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set3i: function (name, x, y, z, shader) + { + if (shader === undefined) { shader = this.currentShader; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + shader.set3i(name, x, y, z); -/** - * Check if a given value is an even number using a strict type check. - * - * @function Phaser.Math.IsEvenStrict - * @since 3.0.0 - * - * @param {number} value - The number to perform the check with. - * - * @return {boolean} Whether the number is even or not. - */ -var IsEvenStrict = function (value) -{ - // Use strict equality === for "is number" test - return (value === parseFloat(value)) ? !(value % 2) : void 0; -}; + return this; + }, -module.exports = IsEvenStrict; + /** + * Sets a 4i uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#set4i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - X component of the uniform. + * @param {number} y - Y component of the uniform. + * @param {number} z - Z component of the uniform. + * @param {number} w - W component of the uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + set4i: function (name, x, y, z, w, shader) + { + if (shader === undefined) { shader = this.currentShader; } + shader.set4i(name, x, y, z, w); -/***/ }), -/* 848 */ -/***/ (function(module, exports) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Sets a matrix 2fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix2fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {number[]|Float32Array} matrix - The new values for the `mat2` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + setMatrix2fv: function (name, transpose, matrix, shader) + { + if (shader === undefined) { shader = this.currentShader; } -/** - * Add an `amount` to a `value`, limiting the maximum result to `max`. - * - * @function Phaser.Math.MaxAdd - * @since 3.0.0 - * - * @param {number} value - The value to add to. - * @param {number} amount - The amount to add. - * @param {number} max - The maximum value to return. - * - * @return {number} The resulting value. - */ -var MaxAdd = function (value, amount, max) -{ - return Math.min(value + amount, max); -}; + shader.setMatrix2fv(name, transpose, matrix); -module.exports = MaxAdd; + return this; + }, + /** + * Sets a matrix 3fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix3fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The new values for the `mat3` uniform. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + setMatrix3fv: function (name, transpose, matrix, shader) + { + if (shader === undefined) { shader = this.currentShader; } -/***/ }), -/* 849 */ -/***/ (function(module, exports) { + shader.setMatrix3fv(name, transpose, matrix); -/** - * @author Vladislav Forsh - * @copyright 2021 RoboWhale - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -/** - * Calculate the median of the given values. The values are sorted and the middle value is returned. - * In case of an even number of values, the average of the two middle values is returned. - * - * @function Phaser.Math.Median - * @since 3.54.0 - * - * @param {number[]} values - The values to average. - * - * @return {number} The median value. - */ -var Median = function (values) -{ - var valuesNum = values.length; - if (valuesNum === 0) + /** + * Sets a matrix 4fv uniform value based on the given name on the currently set shader. + * + * The current shader is bound, before the uniform is set, making it active within the + * WebGLRenderer. This means you can safely call this method from a location such as + * a Scene `create` or `update` method. However, when working within a Shader file + * directly, use the `WebGLShader` method equivalent instead, to avoid the program + * being set. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix4fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The matrix data. If using a Matrix4 this should be the `Matrix4.val` property. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to set the value on. If not given, the `currentShader` is used. + * + * @return {this} This WebGLPipeline instance. + */ + setMatrix4fv: function (name, transpose, matrix, shader) { - return 0; - } - - values.sort(function (a, b) { return a - b; }); - - var halfIndex = Math.floor(valuesNum / 2); + if (shader === undefined) { shader = this.currentShader; } - return valuesNum % 2 === 0 - ? (values[halfIndex] + values[halfIndex - 1]) / 2 - : values[halfIndex]; -}; + shader.setMatrix4fv(name, transpose, matrix); -module.exports = Median; + return this; + }, + /** + * Destroys all shader instances, removes all object references and nulls all external references. + * + * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy + * @fires Phaser.Renderer.WebGL.Pipelines.Events#DESTROY + * @since 3.0.0 + * + * @return {this} This WebGLPipeline instance. + */ + destroy: function () + { + this.emit(Events.DESTROY, this); -/***/ }), -/* 850 */ -/***/ (function(module, exports) { + var i; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var shaders = this.shaders; -/** - * Subtract an `amount` from `value`, limiting the minimum result to `min`. - * - * @function Phaser.Math.MinSub - * @since 3.0.0 - * - * @param {number} value - The value to subtract from. - * @param {number} amount - The amount to subtract. - * @param {number} min - The minimum value to return. - * - * @return {number} The resulting value. - */ -var MinSub = function (value, amount, min) -{ - return Math.max(value - amount, min); -}; + for (i = 0; i < shaders.length; i++) + { + shaders[i].destroy(); + } -module.exports = MinSub; + var targets = this.renderTargets; + for (i = 0; i < targets.length; i++) + { + targets[i].destroy(); + } -/***/ }), -/* 851 */ -/***/ (function(module, exports) { + this.gl.deleteBuffer(this.vertexBuffer); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var renderer = this.renderer; -/** - * Work out what percentage `value` is of the range between `min` and `max`. - * If `max` isn't given then it will return the percentage of `value` to `min`. - * - * You can optionally specify an `upperMax` value, which is a mid-way point in the range that represents 100%, after which the % starts to go down to zero again. - * - * @function Phaser.Math.Percent - * @since 3.0.0 - * - * @param {number} value - The value to determine the percentage of. - * @param {number} min - The minimum value. - * @param {number} [max] - The maximum value. - * @param {number} [upperMax] - The mid-way point in the range that represents 100%. - * - * @return {number} A value between 0 and 1 representing the percentage. - */ -var Percent = function (value, min, max, upperMax) -{ - if (max === undefined) { max = min + 1; } + renderer.off(RendererEvents.RESIZE, this.resize, this); + renderer.off(RendererEvents.PRE_RENDER, this.onPreRender, this); + renderer.off(RendererEvents.RENDER, this.onRender, this); + renderer.off(RendererEvents.POST_RENDER, this.onPostRender, this); - var percentage = (value - min) / (max - min); + this.removeAllListeners(); - if (percentage > 1) - { - if (upperMax !== undefined) - { - percentage = ((upperMax - value)) / (upperMax - max); + this.game = null; + this.renderer = null; + this.manager = null; + this.gl = null; + this.view = null; + this.shaders = null; + this.renderTargets = null; + this.bytes = null; + this.vertexViewF32 = null; + this.vertexViewU32 = null; + this.vertexData = null; + this.vertexBuffer = null; + this.currentShader = null; + this.currentRenderTarget = null; + this.activeTextures = null; - if (percentage < 0) - { - percentage = 0; - } - } - else - { - percentage = 1; - } - } - else if (percentage < 0) - { - percentage = 0; + return this; } - return percentage; -}; +}); -module.exports = Percent; +module.exports = WebGLPipeline; /***/ }), -/* 852 */ -/***/ (function(module, exports) { + +/***/ 11857: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * Compute a random unit vector. - * - * Computes random values for the given vector between -1 and 1 that can be used to represent a direction. - * - * Optionally accepts a scale value to scale the resulting vector by. - * - * @function Phaser.Math.RandomXY - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} vector - The Vector to compute random values for. - * @param {number} [scale=1] - The scale of the random values. - * - * @return {Phaser.Math.Vector2} The given Vector. - */ -var RandomXY = function (vector, scale) -{ - if (scale === undefined) { scale = 1; } - - var r = Math.random() * 2 * Math.PI; - - vector.x = Math.cos(r) * scale; - vector.y = Math.sin(r) * scale; - - return vector; -}; - -module.exports = RandomXY; +var ArrayRemove = __webpack_require__(66458); +var CameraEvents = __webpack_require__(89787); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(86459); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(81044); +var IsSizePowerOfTwo = __webpack_require__(28621); +var Matrix4 = __webpack_require__(16650); +var NOOP = __webpack_require__(72283); +var PipelineManager = __webpack_require__(35217); +var RenderTarget = __webpack_require__(37410); +var ScaleEvents = __webpack_require__(40444); +var TextureEvents = __webpack_require__(38203); +var Utils = __webpack_require__(75512); +var WebGLSnapshot = __webpack_require__(1217); +var DEBUG = false; -/***/ }), -/* 853 */ -/***/ (function(module, exports) { +if (false) +{ var SPECTOR; } /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * @callback WebGLContextCallback + * + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - The WebGL Renderer which owns the context. */ /** - * Compute a random position vector in a spherical area, optionally defined by the given radius. + * @classdesc + * WebGLRenderer is a class that contains the needed functionality to keep the + * WebGLRenderingContext state clean. The main idea of the WebGLRenderer is to keep track of + * any context change that happens for WebGL rendering inside of Phaser. This means + * if raw webgl functions are called outside the WebGLRenderer of the Phaser WebGL + * rendering ecosystem they might pollute the current WebGLRenderingContext state producing + * unexpected behavior. It's recommended that WebGL interaction is done through + * WebGLRenderer and/or WebGLPipeline. * - * @function Phaser.Math.RandomXYZ + * @class WebGLRenderer + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Renderer.WebGL + * @constructor * @since 3.0.0 * - * @param {Phaser.Math.Vector3} vec3 - The Vector to compute random values for. - * @param {number} [radius=1] - The radius. - * - * @return {Phaser.Math.Vector3} The given Vector. + * @param {Phaser.Game} game - The Game instance which owns this WebGL Renderer. */ -var RandomXYZ = function (vec3, radius) -{ - if (radius === undefined) { radius = 1; } - - var r = Math.random() * 2 * Math.PI; - var z = (Math.random() * 2) - 1; - var zScale = Math.sqrt(1 - z * z) * radius; - - vec3.x = Math.cos(r) * zScale; - vec3.y = Math.sin(r) * zScale; - vec3.z = z * radius; +var WebGLRenderer = new Class({ - return vec3; -}; + Extends: EventEmitter, -module.exports = RandomXYZ; + initialize: + function WebGLRenderer (game) + { + EventEmitter.call(this); -/***/ }), -/* 854 */ -/***/ (function(module, exports) { + var gameConfig = game.config; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var contextCreationConfig = { + alpha: gameConfig.transparent, + desynchronized: gameConfig.desynchronized, + depth: true, + antialias: gameConfig.antialiasGL, + premultipliedAlpha: gameConfig.premultipliedAlpha, + stencil: true, + failIfMajorPerformanceCaveat: gameConfig.failIfMajorPerformanceCaveat, + powerPreference: gameConfig.powerPreference, + preserveDrawingBuffer: gameConfig.preserveDrawingBuffer, + willReadFrequently: false + }; -/** - * Compute a random four-dimensional vector. - * - * @function Phaser.Math.RandomXYZW - * @since 3.0.0 - * - * @param {Phaser.Math.Vector4} vec4 - The Vector to compute random values for. - * @param {number} [scale=1] - The scale of the random values. - * - * @return {Phaser.Math.Vector4} The given Vector. - */ -var RandomXYZW = function (vec4, scale) -{ - if (scale === undefined) { scale = 1; } + /** + * The local configuration settings of this WebGL Renderer. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#config + * @type {object} + * @since 3.0.0 + */ + this.config = { + clearBeforeRender: gameConfig.clearBeforeRender, + antialias: gameConfig.antialias, + backgroundColor: gameConfig.backgroundColor, + contextCreation: contextCreationConfig, + roundPixels: gameConfig.roundPixels, + maxTextures: gameConfig.maxTextures, + maxTextureSize: gameConfig.maxTextureSize, + batchSize: gameConfig.batchSize, + maxLights: gameConfig.maxLights, + mipmapFilter: gameConfig.mipmapFilter + }; - vec4.x = (Math.random() * 2 - 1) * scale; - vec4.y = (Math.random() * 2 - 1) * scale; - vec4.z = (Math.random() * 2 - 1) * scale; - vec4.w = (Math.random() * 2 - 1) * scale; + /** + * The Game instance which owns this WebGL Renderer. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game = game; - return vec4; -}; + /** + * A constant which allows the renderer to be easily identified as a WebGL Renderer. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#type + * @type {number} + * @since 3.0.0 + */ + this.type = CONST.WEBGL; -module.exports = RandomXYZW; + /** + * An instance of the Pipeline Manager class, that handles all WebGL Pipelines. + * + * Use this to manage all of your interactions with pipelines, such as adding, getting, + * setting and rendering them. + * + * The Pipeline Manager class is created in the `init` method and then populated + * with pipelines during the `boot` method. + * + * Prior to Phaser v3.50.0 this was just a plain JavaScript object, not a class. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#pipelines + * @type {Phaser.Renderer.WebGL.PipelineManager} + * @since 3.50.0 + */ + this.pipelines = null; + /** + * The width of the canvas being rendered to. + * This is populated in the onResize event handler. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#width + * @type {number} + * @since 3.0.0 + */ + this.width = 0; -/***/ }), -/* 855 */ -/***/ (function(module, exports) { + /** + * The height of the canvas being rendered to. + * This is populated in the onResize event handler. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#height + * @type {number} + * @since 3.0.0 + */ + this.height = 0; -/** - * @author samme - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The canvas which this WebGL Renderer draws to. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.canvas = game.canvas; -/** - * Position a `point` at the given `angle` and `distance` to (`x`, `y`). - * - * @function Phaser.Math.RotateTo - * @since 3.24.0 - * - * @generic {Phaser.Types.Math.Vector2Like} T - [point,$return] - * - * @param {Phaser.Types.Math.Vector2Like} point - The point to be positioned. - * @param {number} x - The horizontal coordinate to position from. - * @param {number} y - The vertical coordinate to position from. - * @param {number} angle - The angle of rotation in radians. - * @param {number} distance - The distance from (x, y) to place the point at. - * - * @return {Phaser.Types.Math.Vector2Like} The given point. - */ -var RotateTo = function (point, x, y, angle, distance) -{ - point.x = x + (distance * Math.cos(angle)); - point.y = y + (distance * Math.sin(angle)); + /** + * An array of blend modes supported by the WebGL Renderer. + * + * This array includes the default blend modes as well as any custom blend modes added through {@link #addBlendMode}. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#blendModes + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.blendModes = []; - return point; -}; + /** + * This property is set to `true` if the WebGL context of the renderer is lost. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#contextLost + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.contextLost = false; -module.exports = RotateTo; + /** + * Details about the currently scheduled snapshot. + * + * If a non-null `callback` is set in this object, a snapshot of the canvas will be taken after the current frame is fully rendered. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#snapshotState + * @type {Phaser.Types.Renderer.Snapshot.SnapshotState} + * @since 3.0.0 + */ + this.snapshotState = { + x: 0, + y: 0, + width: 1, + height: 1, + getPixel: false, + callback: null, + type: 'image/png', + encoder: 0.92, + isFramebuffer: false, + bufferWidth: 0, + bufferHeight: 0 + }; + /** + * The maximum number of textures the GPU can handle. The minimum under the WebGL1 spec is 8. + * This is set via the Game Config `maxTextures` property and should never be changed after boot. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#maxTextures + * @type {number} + * @since 3.50.0 + */ + this.maxTextures = 0; -/***/ }), -/* 856 */ -/***/ (function(module, exports) { + /** + * An array of the available WebGL texture units, used to populate the uSampler uniforms. + * + * This array is populated during the init phase and should never be changed after boot. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#textureIndexes + * @type {array} + * @since 3.50.0 + */ + this.textureIndexes; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The currently bound framebuffer in use. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentFramebuffer + * @type {WebGLFramebuffer} + * @default null + * @since 3.0.0 + */ + this.currentFramebuffer = null; -/** - * Round a value to the given precision. - * - * For example: - * - * ```javascript - * RoundTo(123.456, 0) = 123 - * RoundTo(123.456, 1) = 120 - * RoundTo(123.456, 2) = 100 - * ``` - * - * To round the decimal, i.e. to round to precision, pass in a negative `place`: - * - * ```javascript - * RoundTo(123.456789, 0) = 123 - * RoundTo(123.456789, -1) = 123.5 - * RoundTo(123.456789, -2) = 123.46 - * RoundTo(123.456789, -3) = 123.457 - * ``` - * - * @function Phaser.Math.RoundTo - * @since 3.0.0 - * - * @param {number} value - The value to round. - * @param {number} [place=0] - The place to round to. Positive to round the units, negative to round the decimal. - * @param {number} [base=10] - The base to round in. Default is 10 for decimal. - * - * @return {number} The rounded value. - */ -var RoundTo = function (value, place, base) -{ - if (place === undefined) { place = 0; } - if (base === undefined) { base = 10; } + /** + * A stack into which the frame buffer objects are pushed and popped. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#fboStack + * @type {WebGLFramebuffer[]} + * @since 3.50.0 + */ + this.fboStack = []; - var p = Math.pow(base, -place); + /** + * Current WebGLProgram in use. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentProgram + * @type {WebGLProgram} + * @default null + * @since 3.0.0 + */ + this.currentProgram = null; - return Math.round(value * p) / p; -}; + /** + * Current blend mode in use + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentBlendMode + * @type {number} + * @since 3.0.0 + */ + this.currentBlendMode = Infinity; -module.exports = RoundTo; + /** + * Indicates if the the scissor state is enabled in WebGLRenderingContext + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissorEnabled + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.currentScissorEnabled = false; + /** + * Stores the current scissor data + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentScissor + * @type {Uint32Array} + * @since 3.0.0 + */ + this.currentScissor = null; -/***/ }), -/* 857 */ -/***/ (function(module, exports) { + /** + * Stack of scissor data + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#scissorStack + * @type {Uint32Array} + * @since 3.0.0 + */ + this.scissorStack = []; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The handler to invoke when the context is lost. + * This should not be changed and is set in the boot method. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#contextLostHandler + * @type {function} + * @since 3.19.0 + */ + this.contextLostHandler = NOOP; -/** - * Generate a series of sine and cosine values. - * - * @function Phaser.Math.SinCosTableGenerator - * @since 3.0.0 - * - * @param {number} length - The number of values to generate. - * @param {number} [sinAmp=1] - The sine value amplitude. - * @param {number} [cosAmp=1] - The cosine value amplitude. - * @param {number} [frequency=1] - The frequency of the values. - * - * @return {Phaser.Types.Math.SinCosTable} The generated values. - */ -var SinCosTableGenerator = function (length, sinAmp, cosAmp, frequency) -{ - if (sinAmp === undefined) { sinAmp = 1; } - if (cosAmp === undefined) { cosAmp = 1; } - if (frequency === undefined) { frequency = 1; } + /** + * The handler to invoke when the context is restored. + * This should not be changed and is set in the boot method. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#contextRestoredHandler + * @type {function} + * @since 3.19.0 + */ + this.contextRestoredHandler = NOOP; - frequency *= Math.PI / length; + /** + * The underlying WebGL context of the renderer. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#gl + * @type {WebGLRenderingContext} + * @default null + * @since 3.0.0 + */ + this.gl = null; - var cos = []; - var sin = []; + /** + * Array of strings that indicate which WebGL extensions are supported by the browser. + * This is populated in the `boot` method. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#supportedExtensions + * @type {string[]} + * @default null + * @since 3.0.0 + */ + this.supportedExtensions = null; - for (var c = 0; c < length; c++) - { - cosAmp -= sinAmp * frequency; - sinAmp += cosAmp * frequency; + /** + * If the browser supports the `ANGLE_instanced_arrays` extension, this property will hold + * a reference to the glExtension for it. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#instancedArraysExtension + * @type {ANGLE_instanced_arrays} + * @default null + * @since 3.50.0 + */ + this.instancedArraysExtension = null; - cos[c] = cosAmp; - sin[c] = sinAmp; - } + /** + * If the browser supports the `OES_vertex_array_object` extension, this property will hold + * a reference to the glExtension for it. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#vaoExtension + * @type {OES_vertex_array_object} + * @default null + * @since 3.50.0 + */ + this.vaoExtension = null; - return { - sin: sin, - cos: cos, - length: length - }; -}; + /** + * The WebGL Extensions loaded into the current context. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#extensions + * @type {object} + * @default {} + * @since 3.0.0 + */ + this.extensions = {}; -module.exports = SinCosTableGenerator; + /** + * Stores the current WebGL component formats for further use. + * + * This array is populated in the `init` method. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#glFormats + * @type {array} + * @since 3.2.0 + */ + this.glFormats; + /** + * Stores the WebGL texture compression formats that this device and browser supports. + * + * Support for using compressed texture formats was added in Phaser version 3.60. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#compression + * @type {Phaser.Types.Renderer.WebGL.WebGLTextureCompression} + * @since 3.8.0 + */ + this.compression; -/***/ }), -/* 858 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Cached drawing buffer height to reduce gl calls. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#drawingBufferHeight + * @type {number} + * @readonly + * @since 3.11.0 + */ + this.drawingBufferHeight = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A blank 32x32 transparent texture, as used by the Graphics system where needed. + * This is set in the `boot` method. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#blankTexture + * @type {WebGLTexture} + * @readonly + * @since 3.12.0 + */ + this.blankTexture = null; -var Vector2 = __webpack_require__(3); + /** + * A pure white 4x4 texture, as used by the Graphics system where needed. + * This is set in the `boot` method. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#whiteTexture + * @type {WebGLTexture} + * @readonly + * @since 3.50.0 + */ + this.whiteTexture = null; -/** - * Returns a Vector2 containing the x and y position of the given index in a `width` x `height` sized grid. - * - * For example, in a 6 x 4 grid, index 16 would equal x: 4 y: 2. - * - * If the given index is out of range an empty Vector2 is returned. - * - * @function Phaser.Math.ToXY - * @since 3.19.0 - * - * @param {number} index - The position within the grid to get the x/y value for. - * @param {number} width - The width of the grid. - * @param {number} height - The height of the grid. - * @param {Phaser.Math.Vector2} [out] - An optional Vector2 to store the result in. If not given, a new Vector2 instance will be created. - * - * @return {Phaser.Math.Vector2} A Vector2 where the x and y properties contain the given grid index. - */ -var ToXY = function (index, width, height, out) -{ - if (out === undefined) { out = new Vector2(); } + /** + * The total number of masks currently stacked. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#maskCount + * @type {number} + * @since 3.17.0 + */ + this.maskCount = 0; - var x = 0; - var y = 0; - var total = width * height; + /** + * The mask stack. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#maskStack + * @type {Phaser.Display.Masks.GeometryMask[]} + * @since 3.17.0 + */ + this.maskStack = []; - if (index > 0 && index <= total) - { - if (index > width - 1) - { - y = Math.floor(index / width); - x = index - (y * width); - } - else - { - x = index; - } - } + /** + * Internal property that tracks the currently set mask. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentMask + * @type {any} + * @since 3.17.0 + */ + this.currentMask = { mask: null, camera: null }; - return out.set(x, y); -}; + /** + * Internal property that tracks the currently set camera mask. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentCameraMask + * @type {any} + * @since 3.17.0 + */ + this.currentCameraMask = { mask: null, camera: null }; -module.exports = ToXY; + /** + * Internal gl function mapping for uniform look-up. + * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#glFuncMap + * @type {any} + * @since 3.17.0 + */ + this.glFuncMap = null; + /** + * The `type` of the Game Object being currently rendered. + * This can be used by advanced render functions for batching look-ahead. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentType + * @type {string} + * @since 3.19.0 + */ + this.currentType = ''; -/***/ }), -/* 859 */ -/***/ (function(module, exports) { + /** + * Is the `type` of the Game Object being currently rendered different than the + * type of the object before it in the display list? I.e. it's a 'new' type. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#newType + * @type {boolean} + * @since 3.19.0 + */ + this.newType = false; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Does the `type` of the next Game Object in the display list match that + * of the object being currently rendered? + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#nextTypeMatch + * @type {boolean} + * @since 3.19.0 + */ + this.nextTypeMatch = false; -/** - * Checks if the two values are within the given `tolerance` of each other. - * - * @function Phaser.Math.Within - * @since 3.0.0 - * - * @param {number} a - The first value to use in the calculation. - * @param {number} b - The second value to use in the calculation. - * @param {number} tolerance - The tolerance. Anything equal to or less than this value is considered as being within range. - * - * @return {boolean} Returns `true` if `a` is less than or equal to the tolerance of `b`. - */ -var Within = function (a, b, tolerance) -{ - return (Math.abs(a - b) <= tolerance); -}; + /** + * Is the Game Object being currently rendered the final one in the list? + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#finalType + * @type {boolean} + * @since 3.50.0 + */ + this.finalType = false; -module.exports = Within; + /** + * The mipmap magFilter to be used when creating textures. + * + * You can specify this as a string in the game config, i.e.: + * + * `render: { mipmapFilter: 'NEAREST_MIPMAP_LINEAR' }` + * + * The 6 options for WebGL1 are, in order from least to most computationally expensive: + * + * NEAREST (for pixel art) + * LINEAR (the default) + * NEAREST_MIPMAP_NEAREST + * LINEAR_MIPMAP_NEAREST + * NEAREST_MIPMAP_LINEAR + * LINEAR_MIPMAP_LINEAR + * + * Mipmaps only work with textures that are fully power-of-two in size. + * + * For more details see https://webglfundamentals.org/webgl/lessons/webgl-3d-textures.html + * + * As of v3.60 no mipmaps will be generated unless a string is given in + * the game config. This saves on VRAM use when it may not be required. + * To obtain the previous result set the property to `LINEAR` in the config. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#mipmapFilter + * @type {GLenum} + * @since 3.21.0 + */ + this.mipmapFilter = null; + /** + * The default scissor, set during `preRender` and modified during `resize`. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#defaultScissor + * @type {number[]} + * @private + * @since 3.50.0 + */ + this.defaultScissor = [ 0, 0, 0, 0 ]; -/***/ }), -/* 860 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Has this renderer fully booted yet? + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#isBooted + * @type {boolean} + * @since 3.50.0 + */ + this.isBooted = false; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A Render Target you can use to capture the current state of the Renderer. + * + * A Render Target encapsulates a framebuffer and texture for the WebGL Renderer. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#renderTarget + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.renderTarget = null; -var Vector3 = __webpack_require__(39); -var Matrix4 = __webpack_require__(69); -var Quaternion = __webpack_require__(365); + /** + * The global game Projection matrix, used by shaders as 'uProjectionMatrix' uniform. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#projectionMatrix + * @type {Phaser.Math.Matrix4} + * @since 3.50.0 + */ + this.projectionMatrix; -var tmpMat4 = new Matrix4(); -var tmpQuat = new Quaternion(); -var tmpVec3 = new Vector3(); + /** + * The cached width of the Projection matrix. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#projectionWidth + * @type {number} + * @since 3.50.0 + */ + this.projectionWidth = 0; -/** - * Rotates a vector in place by axis angle. - * - * This is the same as transforming a point by an - * axis-angle quaternion, but it has higher precision. - * - * @function Phaser.Math.RotateVec3 - * @since 3.0.0 - * - * @param {Phaser.Math.Vector3} vec - The vector to be rotated. - * @param {Phaser.Math.Vector3} axis - The axis to rotate around. - * @param {number} radians - The angle of rotation in radians. - * - * @return {Phaser.Math.Vector3} The given vector. - */ -var RotateVec3 = function (vec, axis, radians) -{ - // Set the quaternion to our axis angle - tmpQuat.setAxisAngle(axis, radians); + /** + * The cached height of the Projection matrix. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#projectionHeight + * @type {number} + * @since 3.50.0 + */ + this.projectionHeight = 0; - // Create a rotation matrix from the axis angle - tmpMat4.fromRotationTranslation(tmpQuat, tmpVec3.set(0, 0, 0)); + /** + * A RenderTarget used by the BitmapMask Pipeline. + * + * This is the source, i.e. the masked Game Object itself. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#maskSource + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.60.0 + */ + this.maskSource = null; - // Multiply our vector by the rotation matrix - return vec.transformMat4(tmpMat4); -}; + /** + * A RenderTarget used by the BitmapMask Pipeline. + * + * This is the target, i.e. the framebuffer the masked objects are drawn to. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#maskTarget + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.60.0 + */ + this.maskTarget = null; -module.exports = RotateVec3; + /** + * An instance of SpectorJS used for WebGL Debugging. + * + * Only available in the Phaser Debug build. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#spector + * @type {function} + * @since 3.60.0 + */ + this.spector = null; + /** + * Is Spector currently capturing a WebGL frame? + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#_debugCapture + * @type {boolean} + * @private + * @since 3.60.0 + */ + this._debugCapture = false; -/***/ }), -/* 861 */ -/***/ (function(module, exports) { + this.init(this.config); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Creates a new WebGLRenderingContext and initializes all internal state. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#init + * @since 3.0.0 + * + * @param {object} config - The configuration object for the renderer. + * + * @return {this} This WebGLRenderer instance. + */ + init: function (config) + { + var gl; + var game = this.game; + var canvas = this.canvas; + var clearColor = config.backgroundColor; -/** - * The Texture Add Event. - * - * This event is dispatched by the Texture Manager when a texture is added to it. - * - * Listen to this event from within a Scene using: `this.textures.on('addtexture', listener)`. - * - * @event Phaser.Textures.Events#ADD - * @since 3.0.0 - * - * @param {string} key - The key of the Texture that was added to the Texture Manager. - * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was added to the Texture Manager. - */ -module.exports = 'addtexture'; + if (DEBUG) + { + this.spector = new SPECTOR.Spector(); + this.spector.onCapture.add(this.onCapture.bind(this)); + } -/***/ }), -/* 862 */ -/***/ (function(module, exports) { + // Did they provide their own context? + if (game.config.context) + { + gl = game.config.context; + } + else + { + gl = canvas.getContext('webgl', config.contextCreation) || canvas.getContext('experimental-webgl', config.contextCreation); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (!gl || gl.isContextLost()) + { + this.contextLost = true; -/** - * The Texture Load Error Event. - * - * This event is dispatched by the Texture Manager when a texture it requested to load failed. - * This only happens when base64 encoded textures fail. All other texture types are loaded via the Loader Plugin. - * - * Listen to this event from within a Scene using: `this.textures.on('onerror', listener)`. - * - * @event Phaser.Textures.Events#ERROR - * @since 3.0.0 - * - * @param {string} key - The key of the Texture that failed to load into the Texture Manager. - */ -module.exports = 'onerror'; + throw new Error('WebGL unsupported'); + } + this.gl = gl; -/***/ }), -/* 863 */ -/***/ (function(module, exports) { + var _this = this; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.contextLostHandler = function (event) + { + _this.contextLost = true; -/** - * The Texture Load Event. - * - * This event is dispatched by the Texture Manager when a texture has finished loading on it. - * This only happens for base64 encoded textures. All other texture types are loaded via the Loader Plugin. - * - * Listen to this event from within a Scene using: `this.textures.on('onload', listener)`. - * - * This event is dispatched after the [ADD]{@linkcode Phaser.Textures.Events#event:ADD} event. - * - * @event Phaser.Textures.Events#LOAD - * @since 3.0.0 - * - * @param {string} key - The key of the Texture that was loaded by the Texture Manager. - * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was loaded by the Texture Manager. - */ -module.exports = 'onload'; + if (console) + { + console.warn('WebGL Context lost. Renderer disabled'); + } + event.preventDefault(); + }; -/***/ }), -/* 864 */ -/***/ (function(module, exports) { + canvas.addEventListener('webglcontextlost', this.contextLostHandler, false); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Set it back into the Game, so developers can access it from there too + game.context = gl; -/** - * This internal event signifies that the Texture Manager is now ready and the Game can continue booting. - * - * When a Phaser Game instance is booting for the first time, the Texture Manager has to wait on a couple of non-blocking - * async events before it's fully ready to carry on. When those complete the Texture Manager emits this event via the Game - * instance, which tells the Game to carry on booting. - * - * @event Phaser.Textures.Events#READY - * @since 3.16.1 - */ -module.exports = 'ready'; + for (var i = 0; i <= 27; i++) + { + this.blendModes.push({ func: [ gl.ONE, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_ADD }); + } + // ADD + this.blendModes[1].func = [ gl.ONE, gl.DST_ALPHA ]; -/***/ }), -/* 865 */ -/***/ (function(module, exports) { + // MULTIPLY + this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // SCREEN + this.blendModes[3].func = [ gl.ONE, gl.ONE_MINUS_SRC_COLOR ]; -/** - * The Texture Remove Event. - * - * This event is dispatched by the Texture Manager when a texture is removed from it. - * - * Listen to this event from within a Scene using: `this.textures.on('removetexture', listener)`. - * - * If you have any Game Objects still using the removed texture, they will start throwing - * errors the next time they try to render. Be sure to clear all use of the texture in this event handler. - * - * @event Phaser.Textures.Events#REMOVE - * @since 3.0.0 - * - * @param {string} key - The key of the Texture that was removed from the Texture Manager. - */ -module.exports = 'removetexture'; + // ERASE + this.blendModes[17] = { func: [ gl.ZERO, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_REVERSE_SUBTRACT }; + this.glFormats = [ gl.BYTE, gl.SHORT, gl.UNSIGNED_BYTE, gl.UNSIGNED_SHORT, gl.FLOAT ]; -/***/ }), -/* 866 */ -/***/ (function(module, exports) { + // Set the gl function map + this.glFuncMap = { -module.exports = [ - '#define SHADER_NAME PHASER_BITMAP_MASK_FS', - '', - 'precision mediump float;', - '', - 'uniform vec2 uResolution;', - 'uniform sampler2D uMainSampler;', - 'uniform sampler2D uMaskSampler;', - 'uniform bool uInvertMaskAlpha;', - '', - 'void main ()', - '{', - ' vec2 uv = gl_FragCoord.xy / uResolution;', - ' vec4 mainColor = texture2D(uMainSampler, uv);', - ' vec4 maskColor = texture2D(uMaskSampler, uv);', - ' float alpha = mainColor.a;', - '', - ' if (!uInvertMaskAlpha)', - ' {', - ' alpha *= (maskColor.a);', - ' }', - ' else', - ' {', - ' alpha *= (1.0 - maskColor.a);', - ' }', - '', - ' gl_FragColor = vec4(mainColor.rgb * alpha, alpha);', - '}', - '' -].join('\n'); + mat2: { func: gl.uniformMatrix2fv, length: 1, matrix: true }, + mat3: { func: gl.uniformMatrix3fv, length: 1, matrix: true }, + mat4: { func: gl.uniformMatrix4fv, length: 1, matrix: true }, + '1f': { func: gl.uniform1f, length: 1 }, + '1fv': { func: gl.uniform1fv, length: 1 }, + '1i': { func: gl.uniform1i, length: 1 }, + '1iv': { func: gl.uniform1iv, length: 1 }, -/***/ }), -/* 867 */ -/***/ (function(module, exports) { + '2f': { func: gl.uniform2f, length: 2 }, + '2fv': { func: gl.uniform2fv, length: 1 }, + '2i': { func: gl.uniform2i, length: 2 }, + '2iv': { func: gl.uniform2iv, length: 1 }, -module.exports = [ - '#define SHADER_NAME PHASER_BITMAP_MASK_VS', - '', - 'precision mediump float;', - '', - 'attribute vec2 inPosition;', - '', - 'void main ()', - '{', - ' gl_Position = vec4(inPosition, 0.0, 1.0);', - '}', - '' -].join('\n'); + '3f': { func: gl.uniform3f, length: 3 }, + '3fv': { func: gl.uniform3fv, length: 1 }, + '3i': { func: gl.uniform3i, length: 3 }, + '3iv': { func: gl.uniform3iv, length: 1 }, + '4f': { func: gl.uniform4f, length: 4 }, + '4fv': { func: gl.uniform4fv, length: 1 }, + '4i': { func: gl.uniform4i, length: 4 }, + '4iv': { func: gl.uniform4iv, length: 1 } -/***/ }), -/* 868 */ -/***/ (function(module, exports) { + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Load supported extensions + var exts = gl.getSupportedExtensions(); -/** - * The WebGLPipeline After Flush Event. - * - * This event is dispatched by a WebGLPipeline right after it has issued a drawArrays command - * and cleared its vertex count. - * - * @event Phaser.Renderer.WebGL.Pipelines.Events#AFTER_FLUSH - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that has flushed. - * @param {boolean} isPostFlush - Was this flush invoked as part of a post-process, or not? - */ -module.exports = 'pipelineafterflush'; + if (!config.maxTextures || config.maxTextures === -1) + { + config.maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); + } + if (!config.maxTextureSize) + { + config.maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); + } -/***/ }), -/* 869 */ -/***/ (function(module, exports) { + this.compression = this.getCompressedTextures(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.supportedExtensions = exts; -/** - * The WebGLPipeline Before Flush Event. - * - * This event is dispatched by a WebGLPipeline right before it is about to - * flush and issue a bufferData and drawArrays command. - * - * @event Phaser.Renderer.WebGL.Pipelines.Events#BEFORE_FLUSH - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that is about to flush. - * @param {boolean} isPostFlush - Was this flush invoked as part of a post-process, or not? - */ -module.exports = 'pipelinebeforeflush'; + var angleString = 'ANGLE_instanced_arrays'; + this.instancedArraysExtension = (exts.indexOf(angleString) > -1) ? gl.getExtension(angleString) : null; -/***/ }), -/* 870 */ -/***/ (function(module, exports) { + var vaoString = 'OES_vertex_array_object'; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.vaoExtension = (exts.indexOf(vaoString) > -1) ? gl.getExtension(vaoString) : null; -/** - * The WebGLPipeline Bind Event. - * - * This event is dispatched by a WebGLPipeline when it is bound by the Pipeline Manager. - * - * @event Phaser.Renderer.WebGL.Pipelines.Events#BIND - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that was bound. - * @param {Phaser.Renderer.WebGL.WebGLShader} currentShader - The shader that was set as being current. - */ -module.exports = 'pipelinebind'; + // Setup initial WebGL state + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.CULL_FACE); + gl.enable(gl.BLEND); -/***/ }), -/* 871 */ -/***/ (function(module, exports) { + gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, clearColor.alphaGL); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Mipmaps + if (config.mipmapFilter !== '') + { + this.mipmapFilter = gl[config.mipmapFilter]; + } -/** - * The WebGLPipeline Boot Event. - * - * This event is dispatched by a WebGLPipeline when it has completed its `boot` phase. - * - * @event Phaser.Renderer.WebGL.Pipelines.Events#BOOT - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that booted. - */ -module.exports = 'pipelineboot'; + // Check maximum supported textures + this.maxTextures = Utils.checkShaderMax(gl, config.maxTextures); + this.textureIndexes = []; -/***/ }), -/* 872 */ -/***/ (function(module, exports) { + // Create temporary WebGL textures to stop WebGL errors on mac os + for (var index = 0; index < this.maxTextures; index++) + { + var tempTexture = gl.createTexture(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + gl.activeTexture(gl.TEXTURE0 + index); -/** - * The WebGLPipeline Destroy Event. - * - * This event is dispatched by a WebGLPipeline when it is starting its destroy process. - * - * @event Phaser.Renderer.WebGL.Pipelines.Events#DESTROY - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that has flushed. - */ -module.exports = 'pipelinedestroy'; + gl.bindTexture(gl.TEXTURE_2D, tempTexture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([ 0, 0, 255, 255 ])); -/***/ }), -/* 873 */ -/***/ (function(module, exports) { + this.textureIndexes.push(index); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.pipelines = new PipelineManager(this); -/** - * The WebGLPipeline ReBind Event. - * - * This event is dispatched by a WebGLPipeline when it is re-bound by the Pipeline Manager. - * - * @event Phaser.Renderer.WebGL.Pipelines.Events#REBIND - * @since 3.50.0 - * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that was rebound. - * @param {Phaser.Renderer.WebGL.WebGLShader} currentShader - The shader that was set as being current. - */ -module.exports = 'pipelinerebind'; + this.setBlendMode(CONST.BlendModes.NORMAL); + this.projectionMatrix = new Matrix4().identity(); -/***/ }), -/* 874 */ -/***/ (function(module, exports) { + game.textures.once(TextureEvents.READY, this.boot, this); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -/** - * The WebGLPipeline Resize Event. - * - * This event is dispatched by a WebGLPipeline when it is resized, usually as a result - * of the Renderer resizing. - * - * @event Phaser.Renderer.WebGL.Pipelines.Events#RESIZE - * @since 3.50.0 - * - * @param {number} width - The new width of the pipeline. - * @param {number} height - The new height of the pipeline. - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that was resized. - */ -module.exports = 'pipelineresize'; + /** + * Internal boot handler. Calls 'boot' on each pipeline. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#boot + * @private + * @since 3.11.0 + */ + boot: function () + { + var game = this.game; + var pipelineManager = this.pipelines; + var baseSize = game.scale.baseSize; -/***/ }), -/* 875 */ -/***/ (function(module, exports) { + var width = baseSize.width; + var height = baseSize.height; -module.exports = [ - '#define SHADER_NAME PHASER_GRAPHICS_FS', - '', - 'precision mediump float;', - '', - 'varying vec4 outColor;', - '', - 'void main ()', - '{', - ' gl_FragColor = vec4(outColor.bgr * outColor.a, outColor.a);', - '}', - '' -].join('\n'); + this.width = width; + this.height = height; + this.isBooted = true; -/***/ }), -/* 876 */ -/***/ (function(module, exports) { + this.renderTarget = new RenderTarget(this, width, height, 1, 0, true, true); -module.exports = [ - '#define SHADER_NAME PHASER_GRAPHICS_VS', - '', - 'precision mediump float;', - '', - 'uniform mat4 uProjectionMatrix;', - '', - 'attribute vec2 inPosition;', - 'attribute vec4 inColor;', - '', - 'varying vec4 outColor;', - '', - 'void main ()', - '{', - ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', - '', - ' outColor = inColor;', - '}', - '' -].join('\n'); + this.maskTarget = new RenderTarget(this, width, height, 1, 0, true, true); + this.maskSource = new RenderTarget(this, width, height, 1, 0, true, true); + // Set-up pipelines + var config = game.config; -/***/ }), -/* 877 */ -/***/ (function(module, exports) { + pipelineManager.boot(config.pipeline, config.defaultPipeline, config.autoMobilePipeline); -module.exports = [ - '#define SHADER_NAME PHASER_LIGHT_FS', - '', - 'precision mediump float;', - '', - 'struct Light', - '{', - ' vec2 position;', - ' vec3 color;', - ' float intensity;', - ' float radius;', - '};', - '', - 'const int kMaxLights = %LIGHT_COUNT%;', - '', - 'uniform vec4 uCamera; /* x, y, rotation, zoom */', - 'uniform vec2 uResolution;', - 'uniform sampler2D uMainSampler;', - 'uniform sampler2D uNormSampler;', - 'uniform vec3 uAmbientLightColor;', - 'uniform Light uLights[kMaxLights];', - 'uniform mat3 uInverseRotationMatrix;', - '', - 'varying vec2 outTexCoord;', - 'varying vec4 outTint;', - '', - 'void main()', - '{', - ' vec3 finalColor = vec3(0.0, 0.0, 0.0);', - ' vec4 color = texture2D(uMainSampler, outTexCoord) * vec4(outTint.bgr * outTint.a, outTint.a);', - ' vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;', - ' vec3 normal = normalize(uInverseRotationMatrix * vec3(normalMap * 2.0 - 1.0));', - ' vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;', - '', - ' for (int index = 0; index < kMaxLights; ++index)', - ' {', - ' Light light = uLights[index];', - ' vec3 lightDir = vec3((light.position.xy / res) - (gl_FragCoord.xy / res), 0.1);', - ' vec3 lightNormal = normalize(lightDir);', - ' float distToSurf = length(lightDir) * uCamera.w;', - ' float diffuseFactor = max(dot(normal, lightNormal), 0.0);', - ' float radius = (light.radius / res.x * uCamera.w) * uCamera.w;', - ' float attenuation = clamp(1.0 - distToSurf * distToSurf / (radius * radius), 0.0, 1.0);', - ' vec3 diffuse = light.color * diffuseFactor;', - ' finalColor += (attenuation * diffuse) * light.intensity;', - ' }', - '', - ' vec4 colorOutput = vec4(uAmbientLightColor + finalColor, 1.0);', - '', - ' gl_FragColor = color * vec4(colorOutput.rgb * colorOutput.a, colorOutput.a);', - '}', - '' -].join('\n'); + // Set-up default textures, fbo and scissor + this.blankTexture = game.textures.getFrame('__DEFAULT').glTexture; + this.whiteTexture = game.textures.getFrame('__WHITE').glTexture; -/***/ }), -/* 878 */ -/***/ (function(module, exports) { + var gl = this.gl; -module.exports = [ - '#define SHADER_NAME PHASER_MULTI_FS', - '', - 'precision mediump float;', - '', - 'uniform sampler2D uMainSampler[%count%];', - '', - 'varying vec2 outTexCoord;', - 'varying float outTexId;', - 'varying float outTintEffect;', - 'varying vec4 outTint;', - '', - 'void main ()', - '{', - ' vec4 texture;', - '', - ' %forloop%', - '', - ' vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);', - '', - ' // Multiply texture tint', - ' vec4 color = texture * texel;', - '', - ' if (outTintEffect == 1.0)', - ' {', - ' // Solid color + texture alpha', - ' color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);', - ' }', - ' else if (outTintEffect == 2.0)', - ' {', - ' // Solid color, no texture', - ' color = texel;', - ' }', - '', - ' gl_FragColor = color;', - '}', - '' -].join('\n'); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.enable(gl.SCISSOR_TEST); -/***/ }), -/* 879 */ -/***/ (function(module, exports) { + game.scale.on(ScaleEvents.RESIZE, this.onResize, this); -module.exports = [ - '#define SHADER_NAME PHASER_MULTI_VS', - '', - 'precision mediump float;', - '', - 'uniform mat4 uProjectionMatrix;', - '', - 'attribute vec2 inPosition;', - 'attribute vec2 inTexCoord;', - 'attribute float inTexId;', - 'attribute float inTintEffect;', - 'attribute vec4 inTint;', - '', - 'varying vec2 outTexCoord;', - 'varying float outTexId;', - 'varying float outTintEffect;', - 'varying vec4 outTint;', - '', - 'void main ()', - '{', - ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', - '', - ' outTexCoord = inTexCoord;', - ' outTexId = inTexId;', - ' outTint = inTint;', - ' outTintEffect = inTintEffect;', - '}', - '' -].join('\n'); + this.resize(width, height); + }, + /** + * This method is only available in the Debug Build of Phaser, or a build with the + * `WEBGL_DEBUG` flag set in the Webpack Config. + * + * Phaser v3.60 Debug has a build of Spector.js embedded in it, which is a WebGL inspector + * that allows for live inspection of your WebGL calls. Although it's easy to add the Spector + * extension to a desktop browsr, by embedding it in Phaser we can make it available in mobile + * browsers too, making it a powerful tool for debugging WebGL games on mobile devices where + * extensions are not permitted. + * + * See https://github.com/BabylonJS/Spector.js for more details. + * + * This method will capture the current WebGL frame and send it to the Spector.js tool for inspection. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#captureFrame + * @since 3.60.0 + * + * @param {boolean} [quickCapture=false] - If `true` thumbnails are not captured in order to speed up the capture. + * @param {boolean} [fullCapture=false] - If `true` all details are captured. + */ + captureFrame: function (quickCapture, fullCapture) + { + if (quickCapture === undefined) { quickCapture = false; } + if (fullCapture === undefined) { fullCapture = false; } -/***/ }), -/* 880 */ -/***/ (function(module, exports) { + if (DEBUG && this.spector && !this._debugCapture) + { + this.spector.captureCanvas(this.canvas, 0, quickCapture, fullCapture); -module.exports = [ - '#define SHADER_NAME PHASER_POINTLIGHT_FS', - '', - 'precision mediump float;', - '', - 'uniform vec2 uResolution;', - 'uniform float uCameraZoom;', - '', - 'varying vec4 lightPosition;', - 'varying vec4 lightColor;', - 'varying float lightRadius;', - 'varying float lightAttenuation;', - '', - 'void main ()', - '{', - ' vec2 center = (lightPosition.xy + 1.0) * (uResolution.xy * 0.5);', - '', - ' float distToSurf = length(center - gl_FragCoord.xy);', - '', - ' float radius = 1.0 - distToSurf / (lightRadius * uCameraZoom);', - '', - ' float intensity = smoothstep(0.0, 1.0, radius * lightAttenuation);', - '', - ' vec4 color = vec4(intensity, intensity, intensity, 0.0) * lightColor;', - '', - ' gl_FragColor = vec4(color.rgb * lightColor.a, color.a);', - '}', - '' -].join('\n'); + this._debugCapture = true; + } + }, + /** + * This method is only available in the Debug Build of Phaser, or a build with the + * `WEBGL_DEBUG` flag set in the Webpack Config. + * + * Phaser v3.60 Debug has a build of Spector.js embedded in it, which is a WebGL inspector + * that allows for live inspection of your WebGL calls. Although it's easy to add the Spector + * extension to a desktop browsr, by embedding it in Phaser we can make it available in mobile + * browsers too, making it a powerful tool for debugging WebGL games on mobile devices where + * extensions are not permitted. + * + * See https://github.com/BabylonJS/Spector.js for more details. + * + * This method will capture the next WebGL frame and send it to the Spector.js tool for inspection. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#captureNextFrame + * @since 3.60.0 + */ + captureNextFrame: function () + { + if (DEBUG && this.spector && !this._debugCapture) + { + this._debugCapture = true; -/***/ }), -/* 881 */ -/***/ (function(module, exports) { + this.spector.captureNextFrame(this.canvas); + } + }, -module.exports = [ - '#define SHADER_NAME PHASER_POINTLIGHT_VS', - '', - 'precision mediump float;', - '', - 'uniform mat4 uProjectionMatrix;', - '', - 'attribute vec2 inPosition;', - 'attribute vec2 inLightPosition;', - 'attribute vec4 inLightColor;', - 'attribute float inLightRadius;', - 'attribute float inLightAttenuation;', - '', - 'varying vec4 lightPosition;', - 'varying vec4 lightColor;', - 'varying float lightRadius;', - 'varying float lightAttenuation;', - '', - 'void main ()', - '{', - ' lightColor = inLightColor;', - ' lightRadius = inLightRadius;', - ' lightAttenuation = inLightAttenuation;', - ' lightPosition = uProjectionMatrix * vec4(inLightPosition, 1.0, 1.0);', - '', - ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', - '}', - '' -].join('\n'); + /** + * This method is only available in the Debug Build of Phaser, or a build with the + * `WEBGL_DEBUG` flag set in the Webpack Config. + * + * Phaser v3.60 Debug has a build of Spector.js embedded in it, which is a WebGL inspector + * that allows for live inspection of your WebGL calls. Although it's easy to add the Spector + * extension to a desktop browsr, by embedding it in Phaser we can make it available in mobile + * browsers too, making it a powerful tool for debugging WebGL games on mobile devices where + * extensions are not permitted. + * + * See https://github.com/BabylonJS/Spector.js for more details. + * + * This method will return the current FPS of the WebGL canvas. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#getFps + * @since 3.60.0 + * + * @return {number} The current FPS of the WebGL canvas. + */ + getFps: function () + { + if (DEBUG && this.spector) + { + return this.spector.getFps(); + } + }, + /** + * This method is only available in the Debug Build of Phaser, or a build with the + * `WEBGL_DEBUG` flag set in the Webpack Config. + * + * Phaser v3.60 Debug has a build of Spector.js embedded in it, which is a WebGL inspector + * that allows for live inspection of your WebGL calls. Although it's easy to add the Spector + * extension to a desktop browsr, by embedding it in Phaser we can make it available in mobile + * browsers too, making it a powerful tool for debugging WebGL games on mobile devices where + * extensions are not permitted. + * + * See https://github.com/BabylonJS/Spector.js for more details. + * + * This method adds a command with the name value in the list. This can be filtered in the search. + * All logs can be filtered searching for "LOG". + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#log + * @since 3.60.0 + * + * @param {...*} arguments - The arguments to log to Spector. + * + * @return {string} The current log. + */ + log: function () + { + if (DEBUG && this.spector) + { + var t = Array.prototype.slice.call(arguments).join(' '); -/***/ }), -/* 882 */ -/***/ (function(module, exports) { + return this.spector.log(t); + } + }, -module.exports = [ - '#define SHADER_NAME PHASER_SINGLE_FS', - '', - 'precision mediump float;', - '', - 'uniform sampler2D uMainSampler;', - '', - 'varying vec2 outTexCoord;', - 'varying float outTintEffect;', - 'varying vec4 outTint;', - '', - 'void main ()', - '{', - ' vec4 texture = texture2D(uMainSampler, outTexCoord);', - ' vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);', - '', - ' // Multiply texture tint', - ' vec4 color = texture * texel;', - '', - ' if (outTintEffect == 1.0)', - ' {', - ' // Solid color + texture alpha', - ' color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);', - ' }', - ' else if (outTintEffect == 2.0)', - ' {', - ' // Solid color, no texture', - ' color = texel;', - ' }', - '', - ' gl_FragColor = color;', - '}', - '' -].join('\n'); + /** + * This method is only available in the Debug Build of Phaser, or a build with the + * `WEBGL_DEBUG` flag set in the Webpack Config. + * + * Phaser v3.60 Debug has a build of Spector.js embedded in it, which is a WebGL inspector + * that allows for live inspection of your WebGL calls. Although it's easy to add the Spector + * extension to a desktop browsr, by embedding it in Phaser we can make it available in mobile + * browsers too, making it a powerful tool for debugging WebGL games on mobile devices where + * extensions are not permitted. + * + * See https://github.com/BabylonJS/Spector.js for more details. + * + * This method will start a capture on the Phaser canvas. The capture will stop once it reaches + * the number of commands specified as a parameter, or after 10 seconds. If quick capture is true, + * the thumbnails are not captured in order to speed up the capture. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#startCapture + * @since 3.60.0 + * + * @param {number} [commandCount=0] - The number of commands to capture. If zero it will capture for 10 seconds. + * @param {boolean} [quickCapture=false] - If `true` thumbnails are not captured in order to speed up the capture. + * @param {boolean} [fullCapture=false] - If `true` all details are captured. + */ + startCapture: function (commandCount, quickCapture, fullCapture) + { + if (commandCount === undefined) { commandCount = 0; } + if (quickCapture === undefined) { quickCapture = false; } + if (fullCapture === undefined) { fullCapture = false; } + if (DEBUG && this.spector && !this._debugCapture) + { + this.spector.startCapture(this.canvas, commandCount, quickCapture, fullCapture); -/***/ }), -/* 883 */ -/***/ (function(module, exports) { + this._debugCapture = true; + } + }, -module.exports = [ - '#define SHADER_NAME PHASER_SINGLE_VS', - '', - 'precision mediump float;', - '', - 'uniform mat4 uProjectionMatrix;', - '', - 'attribute vec2 inPosition;', - 'attribute vec2 inTexCoord;', - 'attribute float inTexId;', - 'attribute float inTintEffect;', - 'attribute vec4 inTint;', - '', - 'varying vec2 outTexCoord;', - 'varying float outTintEffect;', - 'varying vec4 outTint;', - '', - 'void main ()', - '{', - ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', - '', - ' outTexCoord = inTexCoord;', - ' outTint = inTint;', - ' outTintEffect = inTintEffect;', - '}', - '' -].join('\n'); + /** + * This method is only available in the Debug Build of Phaser, or a build with the + * `WEBGL_DEBUG` flag set in the Webpack Config. + * + * Phaser v3.60 Debug has a build of Spector.js embedded in it, which is a WebGL inspector + * that allows for live inspection of your WebGL calls. Although it's easy to add the Spector + * extension to a desktop browsr, by embedding it in Phaser we can make it available in mobile + * browsers too, making it a powerful tool for debugging WebGL games on mobile devices where + * extensions are not permitted. + * + * See https://github.com/BabylonJS/Spector.js for more details. + * + * This method will stop the current capture and returns the result in JSON. It displays the + * result if the UI has been displayed. This returns undefined if the capture has not been completed + * or did not find any commands. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#stopCapture + * @since 3.60.0 + * + * @return {object} The current capture. + */ + stopCapture: function () + { + if (DEBUG && this.spector && this._debugCapture) + { + return this.spector.stopCapture(); + } + }, + /** + * This method is only available in the Debug Build of Phaser, or a build with the + * `WEBGL_DEBUG` flag set in the Webpack Config. + * + * Internal onCapture handler. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#onCapture + * @private + * @since 3.60.0 + * + * @param {object} capture - The capture data. + */ + onCapture: function (capture) + { + if (DEBUG) + { + var view = this.spector.getResultUI(); -/***/ }), -/* 884 */ -/***/ (function(module, exports) { + view.display(capture); -module.exports = [ - '#define SHADER_NAME PHASER_ADD_BLEND_FS', - '', - 'precision mediump float;', - '', - 'uniform sampler2D uMainSampler1;', - 'uniform sampler2D uMainSampler2;', - 'uniform float uStrength;', - '', - 'varying vec2 outTexCoord;', - '', - 'void main ()', - '{', - ' vec4 frame1 = texture2D(uMainSampler1, outTexCoord);', - ' vec4 frame2 = texture2D(uMainSampler2, outTexCoord);', - '', - ' gl_FragColor = frame1 + frame2 * uStrength;', - '}', - '' -].join('\n'); + this._debugCapture = false; + } + }, + /** + * The event handler that manages the `resize` event dispatched by the Scale Manager. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#onResize + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} gameSize - The default Game Size object. This is the un-modified game dimensions. + * @param {Phaser.Structs.Size} baseSize - The base Size object. The game dimensions. The canvas width / height values match this. + */ + onResize: function (gameSize, baseSize) + { + // Has the underlying canvas size changed? + if (baseSize.width !== this.width || baseSize.height !== this.height) + { + this.resize(baseSize.width, baseSize.height); + } + }, -/***/ }), -/* 885 */ -/***/ (function(module, exports) { + /** + * Binds the WebGL Renderers Render Target, so all drawn content is now redirected to it. + * + * Make sure to call `endCapture` when you are finished. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#beginCapture + * @since 3.50.0 + * + * @param {number} [width] - Optional new width of the Render Target. + * @param {number} [height] - Optional new height of the Render Target. + */ + beginCapture: function (width, height) + { + if (width === undefined) { width = this.width; } + if (height === undefined) { height = this.height; } -module.exports = [ - '#define SHADER_NAME PHASER_COLORMATRIX_FS', - '', - 'precision mediump float;', - '', - 'uniform sampler2D uMainSampler;', - 'uniform float uColorMatrix[20];', - 'uniform float uAlpha;', - '', - 'varying vec2 outTexCoord;', - '', - 'void main ()', - '{', - ' vec4 c = texture2D(uMainSampler, outTexCoord);', - '', - ' if (uAlpha == 0.0)', - ' {', - ' gl_FragColor = c;', - '', - ' return;', - ' }', - '', - ' if (c.a > 0.0)', - ' {', - ' c.rgb /= c.a;', - ' }', - '', - ' vec4 result;', - '', - ' result.r = (uColorMatrix[0] * c.r) + (uColorMatrix[1] * c.g) + (uColorMatrix[2] * c.b) + (uColorMatrix[3] * c.a) + uColorMatrix[4];', - ' result.g = (uColorMatrix[5] * c.r) + (uColorMatrix[6] * c.g) + (uColorMatrix[7] * c.b) + (uColorMatrix[8] * c.a) + uColorMatrix[9];', - ' result.b = (uColorMatrix[10] * c.r) + (uColorMatrix[11] * c.g) + (uColorMatrix[12] * c.b) + (uColorMatrix[13] * c.a) + uColorMatrix[14];', - ' result.a = (uColorMatrix[15] * c.r) + (uColorMatrix[16] * c.g) + (uColorMatrix[17] * c.b) + (uColorMatrix[18] * c.a) + uColorMatrix[19];', - '', - ' vec3 rgb = mix(c.rgb, result.rgb, uAlpha);', - '', - ' rgb *= result.a;', - '', - ' gl_FragColor = vec4(rgb, result.a);', - '}', - '' -].join('\n'); + this.renderTarget.bind(true, width, height); + this.setProjectionMatrix(width, height); + }, -/***/ }), -/* 886 */ -/***/ (function(module, exports) { + /** + * Unbinds the WebGL Renderers Render Target and returns it, stopping any further content being drawn to it. + * + * If the viewport or scissors were modified during the capture, you should reset them by calling + * `resetViewport` and `resetScissor` accordingly. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#endCapture + * @since 3.50.0 + * + * @return {Phaser.Renderer.WebGL.RenderTarget} A reference to the WebGL Renderer Render Target. + */ + endCapture: function () + { + this.renderTarget.unbind(true); -module.exports = [ - '#define SHADER_NAME PHASER_COPY_FS', - '', - 'precision mediump float;', - '', - 'uniform sampler2D uMainSampler;', - 'uniform float uBrightness;', - '', - 'varying vec2 outTexCoord;', - '', - 'void main ()', - '{', - ' gl_FragColor = texture2D(uMainSampler, outTexCoord) * uBrightness;', - '}', - '' -].join('\n'); + this.resetProjectionMatrix(); + return this.renderTarget; + }, -/***/ }), -/* 887 */ -/***/ (function(module, exports) { + /** + * Resizes the drawing buffer to match that required by the Scale Manager. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#resize + * @fires Phaser.Renderer.Events#RESIZE + * @since 3.0.0 + * + * @param {number} [width] - The new width of the renderer. + * @param {number} [height] - The new height of the renderer. + * + * @return {this} This WebGLRenderer instance. + */ + resize: function (width, height) + { + var gl = this.gl; -module.exports = [ - '#define SHADER_NAME PHASER_LINEAR_BLEND_FS', - '', - 'precision mediump float;', - '', - 'uniform sampler2D uMainSampler1;', - 'uniform sampler2D uMainSampler2;', - 'uniform float uStrength;', - '', - 'varying vec2 outTexCoord;', - '', - 'void main ()', - '{', - ' vec4 frame1 = texture2D(uMainSampler1, outTexCoord);', - ' vec4 frame2 = texture2D(uMainSampler2, outTexCoord);', - '', - ' gl_FragColor = mix(frame1, frame2 * uStrength, 0.5);', - '}', - '' -].join('\n'); + this.width = width; + this.height = height; + this.setProjectionMatrix(width, height); -/***/ }), -/* 888 */ -/***/ (function(module, exports, __webpack_require__) { + gl.viewport(0, 0, width, height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.drawingBufferHeight = gl.drawingBufferHeight; -/** - * @namespace Phaser.Create - */ + gl.scissor(0, (gl.drawingBufferHeight - height), width, height); -module.exports = { - - GenerateTexture: __webpack_require__(388), - Palettes: __webpack_require__(889) + this.defaultScissor[2] = width; + this.defaultScissor[3] = height; -}; + this.emit(Events.RESIZE, width, height); + return this; + }, -/***/ }), -/* 889 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Determines which compressed texture formats this browser and device supports. + * + * Called automatically as part of the WebGL Renderer init process. If you need to investigate + * which formats it supports, see the `Phaser.Renderer.WebGL.WebGLRenderer#compression` property instead. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#getCompressedTextures + * @since 3.60.0 + * + * @return {Phaser.Types.Renderer.WebGL.WebGLTextureCompression} The compression object. + */ + getCompressedTextures: function () + { + var extString = 'WEBGL_compressed_texture_'; + var wkExtString = 'WEBKIT_' + extString; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var hasExt = function (gl, format) + { + var results = gl.getExtension(extString + format) || gl.getExtension(wkExtString + format); -/** - * @namespace Phaser.Create.Palettes - */ + if (results) + { + var glEnums = {}; -module.exports = { + for (var key in results) + { + glEnums[results[key]] = key; + } - ARNE16: __webpack_require__(389), - C64: __webpack_require__(890), - CGA: __webpack_require__(891), - JMP: __webpack_require__(892), - MSX: __webpack_require__(893) + return glEnums; + } + }; -}; + var gl = this.gl; + return { + ETC: hasExt(gl, 'etc'), + ETC1: hasExt(gl, 'etc1'), + ATC: hasExt(gl, 'atc'), + ASTC: hasExt(gl, 'astc'), + BPTC: hasExt(gl, 'bptc'), + RGTC: hasExt(gl, 'rgtc'), + PVRTC: hasExt(gl, 'pvrtc'), + S3TC: hasExt(gl, 's3tc'), + S3TCSRGB: hasExt(gl, 's3tc_srgb'), + IMG: true + }; + }, -/***/ }), -/* 890 */ -/***/ (function(module, exports) { + /** + * Returns a compressed texture format GLenum name based on the given format. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#getCompressedTextureName + * @since 3.60.0 + * + * @param {string} baseFormat - The Base Format to check. + * @param {GLenum} [format] - An optional GLenum format to check within the base format. + * + * @return {string} The compressed texture format name, as a string. + */ + getCompressedTextureName: function (baseFormat, format) + { + var supportedFormats = this.compression[baseFormat.toUpperCase()]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (format in supportedFormats) + { + return supportedFormats[format]; + } + }, -/** - * A 16 color palette inspired by the Commodore 64. - * - * @name Phaser.Create.Palettes.C64 - * @since 3.0.0 - * - * @type {Phaser.Types.Create.Palette} - */ -module.exports = { - 0: '#000', - 1: '#fff', - 2: '#8b4131', - 3: '#7bbdc5', - 4: '#8b41ac', - 5: '#6aac41', - 6: '#3931a4', - 7: '#d5de73', - 8: '#945a20', - 9: '#5a4100', - A: '#bd736a', - B: '#525252', - C: '#838383', - D: '#acee8b', - E: '#7b73de', - F: '#acacac' -}; + /** + * Checks if the given compressed texture format is supported, or not. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#supportsCompressedTexture + * @since 3.60.0 + * + * @param {string} baseFormat - The Base Format to check. + * @param {GLenum} [format] - An optional GLenum format to check within the base format. + * + * @return {boolean} True if the format is supported, otherwise false. + */ + supportsCompressedTexture: function (baseFormat, format) + { + var supportedFormats = this.compression[baseFormat.toUpperCase()]; + if (supportedFormats) + { + if (format) + { + return format in supportedFormats; + } + else + { + return true; + } + } -/***/ }), -/* 891 */ -/***/ (function(module, exports) { + return false; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Gets the aspect ratio of the WebGLRenderer dimensions. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#getAspectRatio + * @since 3.50.0 + * + * @return {number} The aspect ratio of the WebGLRenderer dimensions. + */ + getAspectRatio: function () + { + return this.width / this.height; + }, -/** - * A 16 color CGA inspired palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.CGA - * @since 3.0.0 - * - * @type {Phaser.Types.Create.Palette} - */ -module.exports = { - 0: '#000', - 1: '#2234d1', - 2: '#0c7e45', - 3: '#44aacc', - 4: '#8a3622', - 5: '#5c2e78', - 6: '#aa5c3d', - 7: '#b5b5b5', - 8: '#5e606e', - 9: '#4c81fb', - A: '#6cd947', - B: '#7be2f9', - C: '#eb8a60', - D: '#e23d69', - E: '#ffd93f', - F: '#fff' -}; + /** + * Sets the Projection Matrix of this renderer to the given dimensions. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setProjectionMatrix + * @since 3.50.0 + * + * @param {number} width - The new width of the Projection Matrix. + * @param {number} height - The new height of the Projection Matrix. + * + * @return {this} This WebGLRenderer instance. + */ + setProjectionMatrix: function (width, height) + { + if (width !== this.projectionWidth || height !== this.projectionHeight) + { + this.projectionWidth = width; + this.projectionHeight = height; + this.projectionMatrix.ortho(0, width, height, 0, -1000, 1000); + } -/***/ }), -/* 892 */ -/***/ (function(module, exports) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Resets the Projection Matrix back to this renderers width and height. + * + * This is called during `endCapture`, should the matrix have been changed + * as a result of the capture process. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#resetProjectionMatrix + * @since 3.50.0 + * + * @return {this} This WebGLRenderer instance. + */ + resetProjectionMatrix: function () + { + return this.setProjectionMatrix(this.width, this.height); + }, -/** - * A 16 color JMP palette by [Arne](http://androidarts.com/palette/16pal.htm) - * - * @name Phaser.Create.Palettes.JMP - * @since 3.0.0 - * - * @type {Phaser.Types.Create.Palette} - */ -module.exports = { - 0: '#000', - 1: '#191028', - 2: '#46af45', - 3: '#a1d685', - 4: '#453e78', - 5: '#7664fe', - 6: '#833129', - 7: '#9ec2e8', - 8: '#dc534b', - 9: '#e18d79', - A: '#d6b97b', - B: '#e9d8a1', - C: '#216c4b', - D: '#d365c8', - E: '#afaab9', - F: '#f5f4eb' -}; + /** + * Checks if a WebGL extension is supported + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#hasExtension + * @since 3.0.0 + * + * @param {string} extensionName - Name of the WebGL extension + * + * @return {boolean} `true` if the extension is supported, otherwise `false`. + */ + hasExtension: function (extensionName) + { + return this.supportedExtensions ? this.supportedExtensions.indexOf(extensionName) : false; + }, + /** + * Loads a WebGL extension + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#getExtension + * @since 3.0.0 + * + * @param {string} extensionName - The name of the extension to load. + * + * @return {object} WebGL extension if the extension is supported + */ + getExtension: function (extensionName) + { + if (!this.hasExtension(extensionName)) { return null; } -/***/ }), -/* 893 */ -/***/ (function(module, exports) { + if (!(extensionName in this.extensions)) + { + this.extensions[extensionName] = this.gl.getExtension(extensionName); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this.extensions[extensionName]; + }, -/** - * A 16 color palette inspired by Japanese computers like the MSX. - * - * @name Phaser.Create.Palettes.MSX - * @since 3.0.0 - * - * @type {Phaser.Types.Create.Palette} - */ -module.exports = { - 0: '#000', - 1: '#191028', - 2: '#46af45', - 3: '#a1d685', - 4: '#453e78', - 5: '#7664fe', - 6: '#833129', - 7: '#9ec2e8', - 8: '#dc534b', - 9: '#e18d79', - A: '#d6b97b', - B: '#e9d8a1', - C: '#216c4b', - D: '#d365c8', - E: '#afaab9', - F: '#fff' -}; + /** + * Flushes the current pipeline if the pipeline is bound + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#flush + * @since 3.0.0 + */ + flush: function () + { + this.pipelines.flush(); + }, + /** + * Pushes a new scissor state. This is used to set nested scissor states. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#pushScissor + * @since 3.0.0 + * + * @param {number} x - The x position of the scissor. + * @param {number} y - The y position of the scissor. + * @param {number} width - The width of the scissor. + * @param {number} height - The height of the scissor. + * @param {number} [drawingBufferHeight] - Optional drawingBufferHeight override value. + * + * @return {number[]} An array containing the scissor values. + */ + pushScissor: function (x, y, width, height, drawingBufferHeight) + { + if (drawingBufferHeight === undefined) { drawingBufferHeight = this.drawingBufferHeight; } -/***/ }), -/* 894 */ -/***/ (function(module, exports, __webpack_require__) { + var scissorStack = this.scissorStack; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var scissor = [ x, y, width, height ]; -/** - * @namespace Phaser.Curves - */ + scissorStack.push(scissor); -module.exports = { - Path: __webpack_require__(895), - MoveTo: __webpack_require__(393), + this.setScissor(x, y, width, height, drawingBufferHeight); - CubicBezier: __webpack_require__(390), - Curve: __webpack_require__(94), - Ellipse: __webpack_require__(391), - Line: __webpack_require__(392), - QuadraticBezier: __webpack_require__(394), - Spline: __webpack_require__(395) -}; + this.currentScissor = scissor; + return scissor; + }, -/***/ }), -/* 895 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Sets the current scissor state. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setScissor + * @since 3.0.0 + * + * @param {number} x - The x position of the scissor. + * @param {number} y - The y position of the scissor. + * @param {number} width - The width of the scissor. + * @param {number} height - The height of the scissor. + * @param {number} [drawingBufferHeight] - Optional drawingBufferHeight override value. + */ + setScissor: function (x, y, width, height, drawingBufferHeight) + { + if (drawingBufferHeight === undefined) { drawingBufferHeight = this.drawingBufferHeight; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var gl = this.gl; -// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog) + var current = this.currentScissor; -var Class = __webpack_require__(0); -var CubicBezierCurve = __webpack_require__(390); -var EllipseCurve = __webpack_require__(391); -var GameObjectFactory = __webpack_require__(5); -var LineCurve = __webpack_require__(392); -var MovePathTo = __webpack_require__(393); -var QuadraticBezierCurve = __webpack_require__(394); -var Rectangle = __webpack_require__(10); -var SplineCurve = __webpack_require__(395); -var Vector2 = __webpack_require__(3); -var MATH_CONST = __webpack_require__(14); + var setScissor = (width > 0 && height > 0); -/** - * @classdesc - * A Path combines multiple Curves into one continuous compound curve. - * It does not matter how many Curves are in the Path or what type they are. - * - * A Curve in a Path does not have to start where the previous Curve ends - that is to say, a Path does not - * have to be an uninterrupted curve. Only the order of the Curves influences the actual points on the Path. - * - * @class Path - * @memberof Phaser.Curves - * @constructor - * @since 3.0.0 - * - * @param {number} [x=0] - The X coordinate of the Path's starting point or a {@link Phaser.Types.Curves.JSONPath}. - * @param {number} [y=0] - The Y coordinate of the Path's starting point. - */ -var Path = new Class({ + if (current && setScissor) + { + var cx = current[0]; + var cy = current[1]; + var cw = current[2]; + var ch = current[3]; - initialize: + setScissor = (cx !== x || cy !== y || cw !== width || ch !== height); + } - function Path (x, y) + if (setScissor) + { + this.flush(); + + // https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/scissor + gl.scissor(x, (drawingBufferHeight - y - height), width, height); + } + }, + + /** + * Resets the gl scissor state to be whatever the current scissor is, if there is one, without + * modifying the scissor stack. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#resetScissor + * @since 3.50.0 + */ + resetScissor: function () { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } + var gl = this.gl; - /** - * The name of this Path. - * Empty by default and never populated by Phaser, this is left for developers to use. - * - * @name Phaser.Curves.Path#name - * @type {string} - * @default '' - * @since 3.0.0 - */ - this.name = ''; + gl.enable(gl.SCISSOR_TEST); - /** - * The list of Curves which make up this Path. - * - * @name Phaser.Curves.Path#curves - * @type {Phaser.Curves.Curve[]} - * @default [] - * @since 3.0.0 - */ - this.curves = []; + var current = this.currentScissor; - /** - * The cached length of each Curve in the Path. - * - * Used internally by {@link #getCurveLengths}. - * - * @name Phaser.Curves.Path#cacheLengths - * @type {number[]} - * @default [] - * @since 3.0.0 - */ - this.cacheLengths = []; + if (current) + { + var x = current[0]; + var y = current[1]; + var width = current[2]; + var height = current[3]; - /** - * Automatically closes the path. - * - * @name Phaser.Curves.Path#autoClose - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.autoClose = false; + if (width > 0 && height > 0) + { + gl.scissor(x, (this.drawingBufferHeight - y - height), width, height); + } + } + }, - /** - * The starting point of the Path. - * - * This is not necessarily equivalent to the starting point of the first Curve in the Path. In an empty Path, it's also treated as the ending point. - * - * @name Phaser.Curves.Path#startPoint - * @type {Phaser.Math.Vector2} - * @since 3.0.0 - */ - this.startPoint = new Vector2(); + /** + * Pops the last scissor state and sets it. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#popScissor + * @since 3.0.0 + */ + popScissor: function () + { + var scissorStack = this.scissorStack; - /** - * A temporary vector used to avoid object creation when adding a Curve to the Path. - * - * @name Phaser.Curves.Path#_tmpVec2A - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2A = new Vector2(); + // Remove the current scissor + scissorStack.pop(); - /** - * A temporary vector used to avoid object creation when adding a Curve to the Path. - * - * @name Phaser.Curves.Path#_tmpVec2B - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tmpVec2B = new Vector2(); + // Reset the previous scissor + var scissor = scissorStack[scissorStack.length - 1]; - if (typeof x === 'object') - { - this.fromJSON(x); - } - else + if (scissor) { - this.startPoint.set(x, y); + this.setScissor(scissor[0], scissor[1], scissor[2], scissor[3]); } + + this.currentScissor = scissor; }, /** - * Appends a Curve to the end of the Path. - * - * The Curve does not have to start where the Path ends or, for an empty Path, at its defined starting point. + * Is there an active stencil mask? * - * @method Phaser.Curves.Path#add - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.WebGLRenderer#hasActiveStencilMask + * @since 3.17.0 * - * @param {Phaser.Curves.Curve} curve - The Curve to append. + * @return {boolean} `true` if there is an active stencil mask, otherwise `false`. + */ + hasActiveStencilMask: function () + { + var mask = this.currentMask.mask; + var camMask = this.currentCameraMask.mask; + + return ((mask && mask.isStencil) || (camMask && camMask.isStencil)); + }, + + /** + * Resets the gl viewport to the current renderer dimensions. * - * @return {this} This Path object. + * @method Phaser.Renderer.WebGL.WebGLRenderer#resetViewport + * @since 3.50.0 */ - add: function (curve) + resetViewport: function () { - this.curves.push(curve); + var gl = this.gl; - return this; + gl.viewport(0, 0, this.width, this.height); + + this.drawingBufferHeight = gl.drawingBufferHeight; }, /** - * Creates a circular Ellipse Curve positioned at the end of the Path. + * Sets the blend mode to the value given. * - * @method Phaser.Curves.Path#circleTo + * If the current blend mode is different from the one given, the pipeline is flushed and the new + * blend mode is enabled. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setBlendMode * @since 3.0.0 * - * @param {number} radius - The radius of the circle. - * @param {boolean} [clockwise=false] - `true` to create a clockwise circle as opposed to a counter-clockwise circle. - * @param {number} [rotation=0] - The rotation of the circle in degrees. + * @param {number} blendModeId - The blend mode to be set. Can be a `BlendModes` const or an integer value. + * @param {boolean} [force=false] - Force the blend mode to be set, regardless of the currently set blend mode. * - * @return {this} This Path object. + * @return {boolean} `true` if the blend mode was changed as a result of this call, forcing a flush, otherwise `false`. */ - circleTo: function (radius, clockwise, rotation) + setBlendMode: function (blendModeId, force) { - if (clockwise === undefined) { clockwise = false; } + if (force === undefined) { force = false; } - return this.ellipseTo(radius, radius, 0, 360, clockwise, rotation); + var gl = this.gl; + var blendMode = this.blendModes[blendModeId]; + + if (force || (blendModeId !== CONST.BlendModes.SKIP_CHECK && this.currentBlendMode !== blendModeId)) + { + this.flush(); + + gl.enable(gl.BLEND); + gl.blendEquation(blendMode.equation); + + if (blendMode.func.length > 2) + { + gl.blendFuncSeparate(blendMode.func[0], blendMode.func[1], blendMode.func[2], blendMode.func[3]); + } + else + { + gl.blendFunc(blendMode.func[0], blendMode.func[1]); + } + + this.currentBlendMode = blendModeId; + + return true; + } + + return false; }, /** - * Ensures that the Path is closed. - * - * A closed Path starts and ends at the same point. If the Path is not closed, a straight Line Curve will be created from the ending point directly to the starting point. During the check, the actual starting point of the Path, i.e. the starting point of the first Curve, will be used as opposed to the Path's defined {@link startPoint}, which could differ. + * Creates a new custom blend mode for the renderer. * - * Calling this method on an empty Path will result in an error. + * See https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Blending_modes * - * @method Phaser.Curves.Path#closePath + * @method Phaser.Renderer.WebGL.WebGLRenderer#addBlendMode * @since 3.0.0 * - * @return {this} This Path object. + * @param {GLenum[]} func - An array containing the WebGL functions to use for the source and the destination blending factors, respectively. See the possible constants for {@link WebGLRenderingContext#blendFunc()}. + * @param {GLenum} equation - The equation to use for combining the RGB and alpha components of a new pixel with a rendered one. See the possible constants for {@link WebGLRenderingContext#blendEquation()}. + * + * @return {number} The index of the new blend mode, used for referencing it in the future. */ - closePath: function () + addBlendMode: function (func, equation) { - // Add a line curve if start and end of lines are not connected - var startPoint = this.curves[0].getPoint(0); - var endPoint = this.curves[this.curves.length - 1].getPoint(1); + var index = this.blendModes.push({ func: func, equation: equation }); - if (!startPoint.equals(endPoint)) + return index - 1; + }, + + /** + * Updates the function bound to a given custom blend mode. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#updateBlendMode + * @since 3.0.0 + * + * @param {number} index - The index of the custom blend mode. + * @param {function} func - The function to use for the blend mode. + * @param {function} equation - The equation to use for the blend mode. + * + * @return {this} This WebGLRenderer instance. + */ + updateBlendMode: function (index, func, equation) + { + if (this.blendModes[index]) { - // This will copy a reference to the vectors, which probably isn't sensible - this.curves.push(new LineCurve(endPoint, startPoint)); + this.blendModes[index].func = func; + + if (equation) + { + this.blendModes[index].equation = equation; + } } return this; }, /** - * Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points. + * Removes a custom blend mode from the renderer. + * Any Game Objects still using this blend mode will error, so be sure to clear them first. * - * @method Phaser.Curves.Path#cubicBezierTo + * @method Phaser.Renderer.WebGL.WebGLRenderer#removeBlendMode * @since 3.0.0 * - * @param {(number|Phaser.Math.Vector2)} x - The x coordinate of the end point. Or, if a Vector2, the p1 value. - * @param {(number|Phaser.Math.Vector2)} y - The y coordinate of the end point. Or, if a Vector2, the p2 value. - * @param {(number|Phaser.Math.Vector2)} control1X - The x coordinate of the first control point. Or, if a Vector2, the p3 value. - * @param {number} [control1Y] - The y coordinate of the first control point. Not used if Vector2s are provided as the first 3 arguments. - * @param {number} [control2X] - The x coordinate of the second control point. Not used if Vector2s are provided as the first 3 arguments. - * @param {number} [control2Y] - The y coordinate of the second control point. Not used if Vector2s are provided as the first 3 arguments. + * @param {number} index - The index of the custom blend mode to be removed. * - * @return {this} This Path object. + * @return {this} This WebGLRenderer instance. */ - cubicBezierTo: function (x, y, control1X, control1Y, control2X, control2Y) + removeBlendMode: function (index) { - var p0 = this.getEndPoint(); - var p1; - var p2; - var p3; - - // Assume they're all Vector2s - if (x instanceof Vector2) - { - p1 = x; - p2 = y; - p3 = control1X; - } - else + if (index > 17 && this.blendModes[index]) { - p1 = new Vector2(control1X, control1Y); - p2 = new Vector2(control2X, control2Y); - p3 = new Vector2(x, y); + this.blendModes.splice(index, 1); } - return this.add(new CubicBezierCurve(p0, p1, p2, p3)); + return this; }, - // Creates a quadratic bezier curve starting at the previous end point and ending at p2, using p1 as a control point - /** - * Creates a Quadratic Bezier Curve starting at the ending point of the Path. + * Pushes a new framebuffer onto the FBO stack and makes it the currently bound framebuffer. * - * @method Phaser.Curves.Path#quadraticBezierTo - * @since 3.2.0 + * If there was another framebuffer already bound it will force a pipeline flush. * - * @param {(number|Phaser.Math.Vector2[])} x - The X coordinate of the second control point or, if it's a `Vector2`, the first control point. - * @param {number} [y] - The Y coordinate of the second control point or, if `x` is a `Vector2`, the second control point. - * @param {number} [controlX] - If `x` is not a `Vector2`, the X coordinate of the first control point. - * @param {number} [controlY] - If `x` is not a `Vector2`, the Y coordinate of the first control point. + * Call `popFramebuffer` to remove it again. * - * @return {this} This Path object. + * @method Phaser.Renderer.WebGL.WebGLRenderer#pushFramebuffer + * @since 3.50.0 + * + * @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound. + * @param {boolean} [updateScissor=false] - Set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. + * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? + * @param {WebGLTexture} [texture=null] - Bind the given frame buffer texture? + * @param {boolean} [clear=false] - Clear the frame buffer after binding? + * + * @return {this} This WebGLRenderer instance. */ - quadraticBezierTo: function (x, y, controlX, controlY) + pushFramebuffer: function (framebuffer, updateScissor, setViewport, texture, clear) { - var p0 = this.getEndPoint(); - var p1; - var p2; - - // Assume they're all Vector2s - if (x instanceof Vector2) - { - p1 = x; - p2 = y; - } - else + if (framebuffer === this.currentFramebuffer) { - p1 = new Vector2(controlX, controlY); - p2 = new Vector2(x, y); + return this; } - return this.add(new QuadraticBezierCurve(p0, p1, p2)); + this.fboStack.push(framebuffer); + + return this.setFramebuffer(framebuffer, updateScissor, setViewport, texture, clear); }, /** - * Draws all Curves in the Path to a Graphics Game Object. + * Sets the given framebuffer as the active and currently bound framebuffer. * - * @method Phaser.Curves.Path#draw - * @since 3.0.0 + * If there was another framebuffer already bound it will force a pipeline flush. * - * @generic {Phaser.GameObjects.Graphics} G - [out,$return] + * Typically, you should call `pushFramebuffer` instead of this method. * - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics Game Object to draw to. - * @param {number} [pointsTotal=32] - The number of points to draw for each Curve. Higher numbers result in a smoother curve but require more processing. + * @method Phaser.Renderer.WebGL.WebGLRenderer#setFramebuffer + * @since 3.0.0 * - * @return {Phaser.GameObjects.Graphics} The Graphics object which was drawn to. + * @param {WebGLFramebuffer} framebuffer - The framebuffer that needs to be bound. + * @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. + * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? + * @param {WebGLTexture} [texture=null] - Bind the given frame buffer texture? + * @param {boolean} [clear=false] - Clear the frame buffer after binding? + * + * @return {this} This WebGLRenderer instance. */ - draw: function (graphics, pointsTotal) + setFramebuffer: function (framebuffer, updateScissor, setViewport, texture, clear) { - for (var i = 0; i < this.curves.length; i++) + if (updateScissor === undefined) { updateScissor = false; } + if (setViewport === undefined) { setViewport = true; } + if (texture === undefined) { texture = null; } + if (clear === undefined) { clear = false; } + + if (framebuffer === this.currentFramebuffer) { - var curve = this.curves[i]; + return this; + } - if (!curve.active) + var gl = this.gl; + + var width = this.width; + var height = this.height; + + if (framebuffer && framebuffer.renderTexture && setViewport) + { + width = framebuffer.renderTexture.width; + height = framebuffer.renderTexture.height; + } + else + { + this.flush(); + } + + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + + if (setViewport) + { + gl.viewport(0, 0, width, height); + } + + if (texture) + { + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); + } + + if (clear) + { + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + } + + if (updateScissor) + { + if (framebuffer) { - continue; + this.drawingBufferHeight = height; + + this.pushScissor(0, 0, width, height); } + else + { + this.drawingBufferHeight = this.height; - curve.draw(graphics, pointsTotal); + this.popScissor(); + } } - return graphics; + this.currentFramebuffer = framebuffer; + + return this; }, /** - * Creates an ellipse curve positioned at the previous end point, using the given parameters. + * Pops the previous framebuffer from the fbo stack and sets it. * - * @method Phaser.Curves.Path#ellipseTo - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.WebGLRenderer#popFramebuffer + * @since 3.50.0 * - * @param {number} [xRadius=0] - The horizontal radius of ellipse. - * @param {number} [yRadius=0] - The vertical radius of ellipse. - * @param {number} [startAngle=0] - The start angle of the ellipse, in degrees. - * @param {number} [endAngle=360] - The end angle of the ellipse, in degrees. - * @param {boolean} [clockwise=false] - Whether the ellipse angles are given as clockwise (`true`) or counter-clockwise (`false`). - * @param {number} [rotation=0] - The rotation of the ellipse, in degrees. + * @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. + * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? * - * @return {this} This Path object. + * @return {WebGLFramebuffer} The Framebuffer that was set, or `null` if there aren't any more in the stack. */ - ellipseTo: function (xRadius, yRadius, startAngle, endAngle, clockwise, rotation) + popFramebuffer: function (updateScissor, setViewport) { - var ellipse = new EllipseCurve(0, 0, xRadius, yRadius, startAngle, endAngle, clockwise, rotation); + if (updateScissor === undefined) { updateScissor = false; } + if (setViewport === undefined) { setViewport = true; } - var end = this.getEndPoint(this._tmpVec2A); + var fboStack = this.fboStack; - // Calculate where to center the ellipse - var start = ellipse.getStartPoint(this._tmpVec2B); + // Remove the current fbo + fboStack.pop(); - end.subtract(start); + // Reset the previous framebuffer + var framebuffer = fboStack[fboStack.length - 1]; - ellipse.x = end.x; - ellipse.y = end.y; + if (!framebuffer) + { + framebuffer = null; + } - return this.add(ellipse); + this.setFramebuffer(framebuffer, updateScissor, setViewport); + + return framebuffer; }, /** - * Creates a Path from a Path Configuration object. - * - * The provided object should be a {@link Phaser.Types.Curves.JSONPath}, as returned by {@link #toJSON}. Providing a malformed object may cause errors. + * Restores the previous framebuffer from the fbo stack and sets it. * - * @method Phaser.Curves.Path#fromJSON - * @since 3.0.0 - * - * @param {Phaser.Types.Curves.JSONPath} data - The JSON object containing the Path data. + * @method Phaser.Renderer.WebGL.WebGLRenderer#restoreFramebuffer + * @since 3.60.0 * - * @return {this} This Path object. + * @param {boolean} [updateScissor=false] - If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. + * @param {boolean} [setViewport=true] - Should the WebGL viewport be set? */ - fromJSON: function (data) + restoreFramebuffer: function (updateScissor, setViewport) { - // data should be an object matching the Path.toJSON object structure. - - this.curves = []; - this.cacheLengths = []; + if (updateScissor === undefined) { updateScissor = false; } + if (setViewport === undefined) { setViewport = true; } - this.startPoint.set(data.x, data.y); + var fboStack = this.fboStack; - this.autoClose = data.autoClose; + var framebuffer = fboStack[fboStack.length - 1]; - for (var i = 0; i < data.curves.length; i++) + if (!framebuffer) { - var curve = data.curves[i]; + framebuffer = null; + } - switch (curve.type) - { - case 'LineCurve': - this.add(LineCurve.fromJSON(curve)); - break; + this.currentFramebuffer = null; - case 'EllipseCurve': - this.add(EllipseCurve.fromJSON(curve)); - break; + this.setFramebuffer(framebuffer, updateScissor, setViewport); + }, - case 'SplineCurve': - this.add(SplineCurve.fromJSON(curve)); - break; + /** + * Binds a shader program. + * + * If there was a different program already bound it will force a pipeline flush first. + * + * If the same program given to this method is already set as the current program, no change + * will take place and this method will return `false`. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setProgram + * @since 3.0.0 + * + * @param {WebGLProgram} program - The program that needs to be bound. + * + * @return {boolean} `true` if the given program was bound, otherwise `false`. + */ + setProgram: function (program) + { + if (program !== this.currentProgram) + { + this.flush(); - case 'CubicBezierCurve': - this.add(CubicBezierCurve.fromJSON(curve)); - break; + this.gl.useProgram(program); - case 'QuadraticBezierCurve': - this.add(QuadraticBezierCurve.fromJSON(curve)); - break; - } + this.currentProgram = program; + + return true; } + return false; + }, + + /** + * Rebinds whatever program `WebGLRenderer.currentProgram` is set as, without + * changing anything, or flushing. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#resetProgram + * @since 3.50.0 + * + * @return {this} This WebGLRenderer instance. + */ + resetProgram: function () + { + this.gl.useProgram(this.currentProgram); + return this; }, /** - * Returns a Rectangle with a position and size matching the bounds of this Path. + * Creates a texture from an image source. If the source is not valid it creates an empty texture. * - * @method Phaser.Curves.Path#getBounds + * @method Phaser.Renderer.WebGL.WebGLRenderer#createTextureFromSource * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Geom.Rectangle} [out] - The Rectangle to store the bounds in. - * @param {number} [accuracy=16] - The accuracy of the bounds calculations. Higher values are more accurate at the cost of calculation speed. + * @param {object} source - The source of the texture. + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {number} scaleMode - The scale mode to be used by the texture. + * @param {boolean} [forceClamp=false] - Force the texture to use the CLAMP_TO_EDGE wrap mode, even if a power of two? * - * @return {Phaser.Geom.Rectangle} The modified `out` Rectangle, or a new Rectangle if none was provided. + * @return {?WebGLTexture} The WebGL Texture that was created, or `null` if it couldn't be created. */ - getBounds: function (out, accuracy) + createTextureFromSource: function (source, width, height, scaleMode, forceClamp) { - if (out === undefined) { out = new Rectangle(); } - if (accuracy === undefined) { accuracy = 16; } + if (forceClamp === undefined) { forceClamp = false; } - out.x = Number.MAX_VALUE; - out.y = Number.MAX_VALUE; - - var bounds = new Rectangle(); - var maxRight = MATH_CONST.MIN_SAFE_INTEGER; - var maxBottom = MATH_CONST.MIN_SAFE_INTEGER; + var gl = this.gl; + var minFilter = gl.NEAREST; + var magFilter = gl.NEAREST; + var wrap = gl.CLAMP_TO_EDGE; + var texture = null; - for (var i = 0; i < this.curves.length; i++) - { - var curve = this.curves[i]; + width = source ? source.width : width; + height = source ? source.height : height; - if (!curve.active) - { - continue; - } + var pow = IsSizePowerOfTwo(width, height); - curve.getBounds(bounds, accuracy); + if (pow && !forceClamp) + { + wrap = gl.REPEAT; + } - out.x = Math.min(out.x, bounds.x); - out.y = Math.min(out.y, bounds.y); + if (scaleMode === CONST.ScaleModes.LINEAR && this.config.antialias) + { + minFilter = (pow && this.mipmapFilter) ? this.mipmapFilter : gl.LINEAR; + magFilter = gl.LINEAR; + } - maxRight = Math.max(maxRight, bounds.right); - maxBottom = Math.max(maxBottom, bounds.bottom); + if (source && source.compressed) + { + // If you don't set minFilter to LINEAR then the compressed textures don't work! + minFilter = gl.LINEAR; + magFilter = gl.LINEAR; } - out.right = maxRight; - out.bottom = maxBottom; + if (!source && typeof width === 'number' && typeof height === 'number') + { + texture = this.createTexture2D(0, minFilter, magFilter, wrap, wrap, gl.RGBA, null, width, height); + } + else + { + texture = this.createTexture2D(0, minFilter, magFilter, wrap, wrap, gl.RGBA, source); + } - return out; + return texture; }, /** - * Returns an array containing the length of the Path at the end of each Curve. - * - * The result of this method will be cached to avoid recalculating it in subsequent calls. The cache is only invalidated when the {@link #curves} array changes in length, leading to potential inaccuracies if a Curve in the Path is changed, or if a Curve is removed and another is added in its place. + * A wrapper for creating a WebGLTexture. If no pixel data is passed it will create an empty texture. * - * @method Phaser.Curves.Path#getCurveLengths + * @method Phaser.Renderer.WebGL.WebGLRenderer#createTexture2D * @since 3.0.0 * - * @return {number[]} An array containing the length of the Path at the end of each one of its Curves. + * @param {number} mipLevel - Mip level of the texture. + * @param {number} minFilter - Filtering of the texture. + * @param {number} magFilter - Filtering of the texture. + * @param {number} wrapT - Wrapping mode of the texture. + * @param {number} wrapS - Wrapping mode of the texture. + * @param {number} format - Which format does the texture use. + * @param {?object} pixels - pixel data. + * @param {number} width - Width of the texture in pixels. + * @param {number} height - Height of the texture in pixels. + * @param {boolean} [pma=true] - Does the texture have premultiplied alpha? + * @param {boolean} [forceSize=false] - If `true` it will use the width and height passed to this method, regardless of the pixels dimension. + * @param {boolean} [flipY=false] - Sets the `UNPACK_FLIP_Y_WEBGL` flag the WebGL Texture uses during upload. + * + * @return {WebGLTexture} The WebGLTexture that was created. */ - getCurveLengths: function () + createTexture2D: function (mipLevel, minFilter, magFilter, wrapT, wrapS, format, pixels, width, height, pma, forceSize, flipY) { - // We use cache values if curves and cache array are same length + pma = (pma === undefined || pma === null) ? true : pma; + if (forceSize === undefined) { forceSize = false; } + if (flipY === undefined) { flipY = false; } - if (this.cacheLengths.length === this.curves.length) + var gl = this.gl; + var texture = gl.createTexture(); + + gl.activeTexture(gl.TEXTURE0); + + var currentTexture = gl.getParameter(gl.TEXTURE_BINDING_2D); + + gl.bindTexture(gl.TEXTURE_2D, texture); + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapS); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrapT); + + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, pma); + + if (flipY) { - return this.cacheLengths; + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + } + + var generateMipmap = false; + + if (pixels === null || pixels === undefined) + { + gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, width, height, 0, format, gl.UNSIGNED_BYTE, null); + + generateMipmap = IsSizePowerOfTwo(width, height); + } + else if (pixels.compressed) + { + width = pixels.width; + height = pixels.height; + generateMipmap = pixels.generateMipmap; + + for (var i = 0; i < pixels.mipmaps.length; i++) + { + gl.compressedTexImage2D(gl.TEXTURE_2D, i, pixels.internalFormat, pixels.mipmaps[i].width, pixels.mipmaps[i].height, 0, pixels.mipmaps[i].data); + } } + else + { + if (!forceSize) + { + width = pixels.width; + height = pixels.height; + } - // Get length of sub-curve - // Push sums into cached array + gl.texImage2D(gl.TEXTURE_2D, mipLevel, format, format, gl.UNSIGNED_BYTE, pixels); - var lengths = []; - var sums = 0; + generateMipmap = IsSizePowerOfTwo(width, height); + } - for (var i = 0; i < this.curves.length; i++) + if (generateMipmap) { - sums += this.curves[i].getLength(); + gl.generateMipmap(gl.TEXTURE_2D); + } - lengths.push(sums); + if (currentTexture) + { + gl.bindTexture(gl.TEXTURE_2D, currentTexture); } - this.cacheLengths = lengths; + texture.isAlphaPremultiplied = pma; + texture.isRenderTexture = false; + texture.width = width; + texture.height = height; - return lengths; + return texture; }, /** - * Returns the ending point of the Path. - * - * A Path's ending point is equivalent to the ending point of the last Curve in the Path. For an empty Path, the ending point is at the Path's defined {@link #startPoint}. + * Creates a WebGL Framebuffer object and optionally binds a depth stencil render buffer. * - * @method Phaser.Curves.Path#getEndPoint + * @method Phaser.Renderer.WebGL.WebGLRenderer#createFramebuffer * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - The object to store the point in. + * @param {number} width - If `addDepthStencilBuffer` is true, this controls the width of the depth stencil. + * @param {number} height - If `addDepthStencilBuffer` is true, this controls the height of the depth stencil. + * @param {WebGLTexture} renderTexture - The color texture where the color pixels are written. + * @param {boolean} [addDepthStencilBuffer=false] - Create a Renderbuffer for the depth stencil? * - * @return {Phaser.Math.Vector2} The modified `out` object, or a new Vector2 if none was provided. + * @return {WebGLFramebuffer} Raw WebGLFramebuffer */ - getEndPoint: function (out) + createFramebuffer: function (width, height, renderTexture, addDepthStencilBuffer) { - if (out === undefined) { out = new Vector2(); } + if (addDepthStencilBuffer === undefined) { addDepthStencilBuffer = true; } - if (this.curves.length > 0) + var gl = this.gl; + var framebuffer = gl.createFramebuffer(); + var complete = 0; + + this.setFramebuffer(framebuffer); + + renderTexture.isRenderTexture = true; + renderTexture.isAlphaPremultiplied = false; + + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, renderTexture, 0); + + complete = gl.checkFramebufferStatus(gl.FRAMEBUFFER); + + if (complete !== gl.FRAMEBUFFER_COMPLETE) { - this.curves[this.curves.length - 1].getPoint(1, out); + var errors = { + 36054: 'Incomplete Attachment', + 36055: 'Missing Attachment', + 36057: 'Incomplete Dimensions', + 36061: 'Framebuffer Unsupported' + }; + + throw new Error('Framebuffer status: ' + (errors[complete] || complete)); } - else + + framebuffer.renderTexture = renderTexture; + + if (addDepthStencilBuffer) { - out.copy(this.startPoint); + var depthStencilBuffer = gl.createRenderbuffer(); + + gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer); } - return out; + this.setFramebuffer(null); + + return framebuffer; }, /** - * Returns the total length of the Path. - * - * @see {@link #getCurveLengths} + * Binds necessary resources and renders the mask to a separated framebuffer. + * The framebuffer for the masked object is also bound for further use. * - * @method Phaser.Curves.Path#getLength - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.WebGLRenderer#beginBitmapMask + * @since 3.60.0 * - * @return {number} The total length of the Path. + * @param {Phaser.Display.Masks.BitmapMask} mask - The BitmapMask instance that called beginMask. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera rendering the current mask. */ - getLength: function () + beginBitmapMask: function (bitmapMask, camera) { - var lens = this.getCurveLengths(); + var gl = this.gl; - return lens[lens.length - 1]; - }, + if (gl) + { + this.flush(); - // To get accurate point with reference to - // entire path distance at time t, - // following has to be done: + this.maskTarget.bind(); - // 1. Length of each sub path have to be known - // 2. Locate and identify type of curve - // 3. Get t for the curve - // 4. Return curve.getPointAt(t') + if (this.currentCameraMask.mask !== bitmapMask) + { + this.currentMask.mask = bitmapMask; + this.currentMask.camera = camera; + } + } + }, /** - * Calculates the coordinates of the point at the given normalized location (between 0 and 1) on the Path. - * - * The location is relative to the entire Path, not to an individual Curve. A location of 0.5 is always in the middle of the Path and is thus an equal distance away from both its starting and ending points. In a Path with one Curve, it would be in the middle of the Curve; in a Path with two Curves, it could be anywhere on either one of them depending on their lengths. - * - * @method Phaser.Curves.Path#getPoint - * @since 3.0.0 - * - * @generic {Phaser.Math.Vector2} O - [out,$return] + * Binds necessary resources and renders the mask to a separated framebuffer. + * The framebuffer for the masked object is also bound for further use. * - * @param {number} t - The location of the point to return, between 0 and 1. - * @param {Phaser.Math.Vector2} [out] - The object in which to store the calculated point. + * @method Phaser.Renderer.WebGL.WebGLRenderer#drawBitmapMask + * @since 3.60.0 * - * @return {?Phaser.Math.Vector2} The modified `out` object, or a new `Vector2` if none was provided. + * @param {Phaser.Display.Masks.BitmapMask} mask - The BitmapMask instance that called beginMask. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera rendering the current mask. + * @param {Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline} bitmapMaskPipeline - The BitmapMask Pipeline instance that is requesting the draw. */ - getPoint: function (t, out) + drawBitmapMask: function (bitmapMask, camera, bitmapMaskPipeline) { - if (out === undefined) { out = new Vector2(); } + // mask.mainFramebuffer should now contain all the Game Objects we want masked + this.flush(); - var d = t * this.getLength(); - var curveLengths = this.getCurveLengths(); - var i = 0; + this.maskSource.bind(); - while (i < curveLengths.length) - { - if (curveLengths[i] >= d) - { - var diff = curveLengths[i] - d; - var curve = this.curves[i]; + this.setBlendMode(0, true); - var segmentLength = curve.getLength(); - var u = (segmentLength === 0) ? 0 : 1 - diff / segmentLength; + bitmapMask.renderWebGL(this, bitmapMask, camera); - return curve.getPointAt(u, out); - } + this.maskSource.unbind(true); + this.maskTarget.unbind(); - i++; + // Is there a stencil further up the stack? + var gl = this.gl; + var prev = this.getCurrentStencilMask(); + + if (prev) + { + gl.enable(gl.STENCIL_TEST); + + prev.mask.applyStencil(this, prev.camera, true); + } + else + { + this.currentMask.mask = null; } - // loop where sum != 0, sum > d , sum+1 1 && !points[points.length - 1].equals(points[0])) + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { - points.push(points[0]); + throw new Error('Link ' + failed + gl.getProgramInfoLog(program)); } - return points; + gl.useProgram(program); + + return program; }, /** - * Returns a randomly chosen point anywhere on the path. This follows the same rules as `getPoint` in that it may return a point on any Curve inside this path. - * - * When calling this method multiple times, the points are not guaranteed to be equally spaced spatially. + * Wrapper for creating a vertex buffer. * - * @method Phaser.Curves.Path#getRandomPoint + * @method Phaser.Renderer.WebGL.WebGLRenderer#createVertexBuffer * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - `Vector2` instance that should be used for storing the result. If `undefined` a new `Vector2` will be created. + * @param {ArrayBuffer} initialDataOrSize - It's either ArrayBuffer or an integer indicating the size of the vbo + * @param {number} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW * - * @return {Phaser.Math.Vector2} The modified `out` object, or a new `Vector2` if none was provided. + * @return {WebGLBuffer} Raw vertex buffer */ - getRandomPoint: function (out) + createVertexBuffer: function (initialDataOrSize, bufferUsage) { - if (out === undefined) { out = new Vector2(); } + var gl = this.gl; + var vertexBuffer = gl.createBuffer(); - return this.getPoint(Math.random(), out); + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, initialDataOrSize, bufferUsage); + gl.bindBuffer(gl.ARRAY_BUFFER, null); + + return vertexBuffer; }, /** - * Divides this Path into a set of equally spaced points, - * - * The resulting points are equally spaced with respect to the points' position on the path, but not necessarily equally spaced spatially. + * Wrapper for creating a vertex buffer. * - * @method Phaser.Curves.Path#getSpacedPoints + * @method Phaser.Renderer.WebGL.WebGLRenderer#createIndexBuffer * @since 3.0.0 * - * @param {number} [divisions=40] - The amount of points to divide this Path into. + * @param {ArrayBuffer} initialDataOrSize - Either ArrayBuffer or an integer indicating the size of the vbo. + * @param {number} bufferUsage - How the buffer is used. gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW. * - * @return {Phaser.Math.Vector2[]} A list of the points this path was subdivided into. + * @return {WebGLBuffer} Raw index buffer */ - getSpacedPoints: function (divisions) + createIndexBuffer: function (initialDataOrSize, bufferUsage) { - if (divisions === undefined) { divisions = 40; } - - var points = []; - - for (var i = 0; i <= divisions; i++) - { - points.push(this.getPoint(i / divisions)); - } + var gl = this.gl; + var indexBuffer = gl.createBuffer(); - if (this.autoClose) - { - points.push(points[0]); - } + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, initialDataOrSize, bufferUsage); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null); - return points; + return indexBuffer; }, /** - * Returns the starting point of the Path. + * Calls `GL.deleteTexture` on the given WebGLTexture and also optionally + * resets the currently defined textures. * - * @method Phaser.Curves.Path#getStartPoint + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteTexture * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [out,$return] - * - * @param {Phaser.Math.Vector2} [out] - `Vector2` instance that should be used for storing the result. If `undefined` a new `Vector2` will be created. + * @param {WebGLTexture} texture - The WebGL Texture to be deleted. * - * @return {Phaser.Math.Vector2} The modified `out` object, or a new Vector2 if none was provided. + * @return {this} This WebGLRenderer instance. */ - getStartPoint: function (out) + deleteTexture: function (texture) { - if (out === undefined) { out = new Vector2(); } + if (texture) + { + this.gl.deleteTexture(texture); + } - return out.copy(this.startPoint); + return this; }, /** - * Gets a unit vector tangent at a relative position on the path. - * - * @method Phaser.Curves.Path#getTangent - * @since 3.23.0 + * Deletes a WebGLFramebuffer from the GL instance. * - * @generic {Phaser.Math.Vector2} O - [out,$return] + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteFramebuffer + * @since 3.0.0 * - * @param {number} t - The relative position on the path, [0..1]. - * @param {Phaser.Math.Vector2} [out] - A vector to store the result in. + * @param {WebGLFramebuffer} framebuffer - The Framebuffer to be deleted. * - * @return {Phaser.Math.Vector2} Vector approximating the tangent line at the point t (delta +/- 0.0001) + * @return {this} This WebGLRenderer instance. */ - getTangent: function (t, out) + deleteFramebuffer: function (framebuffer) { - if (out === undefined) { out = new Vector2(); } + if (framebuffer) + { + var gl = this.gl; - var d = t * this.getLength(); - var curveLengths = this.getCurveLengths(); - var i = 0; + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); - while (i < curveLengths.length) - { - if (curveLengths[i] >= d) + var renderBuffer = gl.getParameter(gl.RENDERBUFFER_BINDING); + + if (renderBuffer) { - var diff = curveLengths[i] - d; - var curve = this.curves[i]; + gl.deleteRenderbuffer(renderBuffer); + } - var segmentLength = curve.getLength(); - var u = (segmentLength === 0) ? 0 : 1 - diff / segmentLength; + gl.bindFramebuffer(gl.FRAMEBUFFER, null); - return curve.getTangentAt(u, out); - } + gl.deleteFramebuffer(framebuffer); - i++; + ArrayRemove(this.fboStack, framebuffer); + + if (this.currentFramebuffer === framebuffer) + { + this.currentFramebuffer = null; + } } - return null; + return this; }, /** - * Creates a line curve from the previous end point to x/y. + * Deletes a WebGLProgram from the GL instance. * - * @method Phaser.Curves.Path#lineTo + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteProgram * @since 3.0.0 * - * @param {(number|Phaser.Math.Vector2)} x - The X coordinate of the line's end point, or a `Vector2` containing the entire end point. - * @param {number} [y] - The Y coordinate of the line's end point, if a number was passed as the X parameter. + * @param {WebGLProgram} program - The shader program to be deleted. * - * @return {this} This Path object. + * @return {this} This WebGLRenderer instance. */ - lineTo: function (x, y) + deleteProgram: function (program) { - if (x instanceof Vector2) - { - this._tmpVec2B.copy(x); - } - else + if (program) { - this._tmpVec2B.set(x, y); + this.gl.deleteProgram(program); } - var end = this.getEndPoint(this._tmpVec2A); - - return this.add(new LineCurve([ end.x, end.y, this._tmpVec2B.x, this._tmpVec2B.y ])); + return this; }, /** - * Creates a spline curve starting at the previous end point, using the given points on the curve. + * Deletes a WebGLBuffer from the GL instance. * - * @method Phaser.Curves.Path#splineTo + * @method Phaser.Renderer.WebGL.WebGLRenderer#deleteBuffer * @since 3.0.0 * - * @param {Phaser.Math.Vector2[]} points - The points the newly created spline curve should consist of. + * @param {WebGLBuffer} vertexBuffer - The WebGLBuffer to be deleted. * - * @return {this} This Path object. + * @return {this} This WebGLRenderer instance. */ - splineTo: function (points) + deleteBuffer: function (buffer) { - points.unshift(this.getEndPoint()); + this.gl.deleteBuffer(buffer); - return this.add(new SplineCurve(points)); + return this; }, /** - * Creates a "gap" in this path from the path's current end point to the given coordinates. - * - * After calling this function, this Path's end point will be equal to the given coordinates + * Controls the pre-render operations for the given camera. + * Handles any clipping needed by the camera and renders the background color if a color is visible. * - * @method Phaser.Curves.Path#moveTo + * @method Phaser.Renderer.WebGL.WebGLRenderer#preRenderCamera * @since 3.0.0 * - * @param {(number|Phaser.Math.Vector2)} x - The X coordinate of the position to move the path's end point to, or a `Vector2` containing the entire new end point. - * @param {number} [y] - The Y coordinate of the position to move the path's end point to, if a number was passed as the X coordinate. - * - * @return {this} This Path object. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to pre-render. */ - moveTo: function (x, y) + preRenderCamera: function (camera) { - if (x instanceof Vector2) + var cx = camera.x; + var cy = camera.y; + var cw = camera.width; + var ch = camera.height; + + var color = camera.backgroundColor; + + camera.emit(CameraEvents.PRE_RENDER, camera); + + this.pipelines.preBatchCamera(camera); + + this.pushScissor(cx, cy, cw, ch); + + if (camera.mask) { - return this.add(new MovePathTo(x.x, x.y)); + this.currentCameraMask.mask = camera.mask; + this.currentCameraMask.camera = camera._maskCamera; + + camera.mask.preRenderWebGL(this, camera, camera._maskCamera); } - else + + if (color.alphaGL > 0) { - return this.add(new MovePathTo(x, y)); + var pipeline = this.pipelines.setMulti(); + + pipeline.drawFillRect( + cx, cy, cw, ch, + Utils.getTintFromFloats(color.blueGL, color.greenGL, color.redGL, 1), + color.alphaGL + ); } }, /** - * Converts this Path to a JSON object containing the path information and its constituent curves. - * - * @method Phaser.Curves.Path#toJSON - * @since 3.0.0 + * Return the current stencil mask. * - * @return {Phaser.Types.Curves.JSONPath} The JSON object containing this path's data. + * @method Phaser.Renderer.WebGL.WebGLRenderer#getCurrentStencilMask + * @private + * @since 3.50.0 */ - toJSON: function () + getCurrentStencilMask: function () { - var out = []; + var prev = null; + var stack = this.maskStack; + var cameraMask = this.currentCameraMask; - for (var i = 0; i < this.curves.length; i++) + if (stack.length > 0) { - out.push(this.curves[i].toJSON()); + prev = stack[stack.length - 1]; + } + else if (cameraMask.mask && cameraMask.mask.isStencil) + { + prev = cameraMask; } - return { - type: 'Path', - x: this.startPoint.x, - y: this.startPoint.y, - autoClose: this.autoClose, - curves: out - }; + return prev; }, /** - * cacheLengths must be recalculated. + * Controls the post-render operations for the given camera. * - * @method Phaser.Curves.Path#updateArcLengths - * @since 3.0.0 - */ - updateArcLengths: function () - { - this.cacheLengths = []; - - this.getCurveLengths(); - }, - - /** - * Disposes of this Path, clearing its internal references to objects so they can be garbage-collected. + * Renders the foreground camera effects like flash and fading, then resets the current scissor state. * - * @method Phaser.Curves.Path#destroy + * @method Phaser.Renderer.WebGL.WebGLRenderer#postRenderCamera * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to post-render. */ - destroy: function () + postRenderCamera: function (camera) { - this.curves.length = 0; - this.cacheLengths.length = 0; - this.startPoint = undefined; - } - -}); - -/** - * Creates a new Path Object. - * - * @method Phaser.GameObjects.GameObjectFactory#path - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Path. - * @param {number} y - The vertical position of this Path. - * - * @return {Phaser.Curves.Path} The Path Object that was created. - */ -GameObjectFactory.register('path', function (x, y) -{ - return new Path(x, y); -}); + var flashEffect = camera.flashEffect; + var fadeEffect = camera.fadeEffect; -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + if (flashEffect.isRunning || (fadeEffect.isRunning || fadeEffect.isComplete)) + { + var pipeline = this.pipelines.setMulti(); -module.exports = Path; + flashEffect.postRenderWebGL(pipeline, Utils.getTintFromFloats); + fadeEffect.postRenderWebGL(pipeline, Utils.getTintFromFloats); + } + camera.dirty = false; -/***/ }), -/* 896 */ -/***/ (function(module, exports, __webpack_require__) { + this.popScissor(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (camera.mask) + { + this.currentCameraMask.mask = null; -/** - * @namespace Phaser.Data - */ + camera.mask.postRenderWebGL(this, camera._maskCamera); + } -module.exports = { + this.pipelines.postBatchCamera(camera); - DataManager: __webpack_require__(101), - DataManagerPlugin: __webpack_require__(897), - Events: __webpack_require__(315) + camera.emit(CameraEvents.POST_RENDER, camera); + }, -}; + /** + * Clears the current vertex buffer and updates pipelines. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#preRender + * @fires Phaser.Renderer.Events#PRE_RENDER + * @since 3.0.0 + */ + preRender: function () + { + if (this.contextLost) { return; } + var gl = this.gl; -/***/ }), -/* 897 */ -/***/ (function(module, exports, __webpack_require__) { + // Make sure we are bound to the main frame buffer + gl.bindFramebuffer(gl.FRAMEBUFFER, null); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.config.clearBeforeRender) + { + var clearColor = this.config.backgroundColor; -var Class = __webpack_require__(0); -var DataManager = __webpack_require__(101); -var PluginCache = __webpack_require__(24); -var SceneEvents = __webpack_require__(20); + gl.clearColor(clearColor.redGL, clearColor.greenGL, clearColor.blueGL, clearColor.alphaGL); -/** - * @classdesc - * The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin. - * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter, - * or have a property called `events` that is an instance of it. - * - * @class DataManagerPlugin - * @extends Phaser.Data.DataManager - * @memberof Phaser.Data - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - A reference to the Scene that this DataManager belongs to. - */ -var DataManagerPlugin = new Class({ + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); + } - Extends: DataManager, + gl.enable(gl.SCISSOR_TEST); - initialize: + this.currentScissor = this.defaultScissor; - function DataManagerPlugin (scene) - { - DataManager.call(this, scene, scene.sys.events); + this.scissorStack.length = 0; + this.scissorStack.push(this.currentScissor); - /** - * A reference to the Scene that this DataManager belongs to. - * - * @name Phaser.Data.DataManagerPlugin#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; + if (this.game.scene.customViewports) + { + gl.scissor(0, (this.drawingBufferHeight - this.height), this.width, this.height); + } - /** - * A reference to the Scene's Systems. - * - * @name Phaser.Data.DataManagerPlugin#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; + this.currentMask.mask = null; + this.currentCameraMask.mask = null; + this.maskStack.length = 0; - scene.sys.events.once(SceneEvents.BOOT, this.boot, this); - scene.sys.events.on(SceneEvents.START, this.start, this); + this.emit(Events.PRE_RENDER); }, /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. + * The core render step for a Scene Camera. * - * @method Phaser.Data.DataManagerPlugin#boot - * @private - * @since 3.5.1 - */ - boot: function () - { - this.events = this.systems.events; - - this.events.once(SceneEvents.DESTROY, this.destroy, this); - }, - - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. + * Iterates through the given array of Game Objects and renders them with the given Camera. * - * @method Phaser.Data.DataManagerPlugin#start - * @private - * @since 3.5.0 - */ - start: function () - { - this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); - }, - - /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. + * This is called by the `CameraManager.render` method. The Camera Manager instance belongs to a Scene, and is invoked + * by the Scene Systems.render method. * - * @method Phaser.Data.DataManagerPlugin#shutdown - * @private - * @since 3.5.0 - */ - shutdown: function () - { - this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); - }, - - /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. + * This method is not called if `Camera.visible` is `false`, or `Camera.alpha` is zero. * - * @method Phaser.Data.DataManagerPlugin#destroy - * @since 3.5.0 + * @method Phaser.Renderer.WebGL.WebGLRenderer#render + * @fires Phaser.Renderer.Events#RENDER + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to render. + * @param {Phaser.GameObjects.GameObject[]} children - An array of filtered Game Objects that can be rendered by the given Camera. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera to render with. */ - destroy: function () - { - DataManager.prototype.destroy.call(this); - - this.events.off(SceneEvents.START, this.start, this); - - this.scene = null; - this.systems = null; - } - -}); - -PluginCache.register('DataManagerPlugin', DataManagerPlugin, 'data'); - -module.exports = DataManagerPlugin; - - -/***/ }), -/* 898 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Display - */ - -module.exports = { - - Align: __webpack_require__(899), - BaseShader: __webpack_require__(396), - Bounds: __webpack_require__(902), - Canvas: __webpack_require__(906), - Color: __webpack_require__(397), - ColorMatrix: __webpack_require__(198), - Masks: __webpack_require__(916), - RGB: __webpack_require__(200) - -}; - - -/***/ }), -/* 899 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CONST = __webpack_require__(123); -var Extend = __webpack_require__(17); - -/** - * @namespace Phaser.Display.Align - */ - -var Align = { - - In: __webpack_require__(900), - To: __webpack_require__(901) - -}; - -// Merge in the consts -Align = Extend(false, Align, CONST); - -module.exports = Align; - - -/***/ }), -/* 900 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Display.Align.In - */ - -module.exports = { - - BottomCenter: __webpack_require__(290), - BottomLeft: __webpack_require__(291), - BottomRight: __webpack_require__(292), - Center: __webpack_require__(293), - LeftCenter: __webpack_require__(295), - QuickSet: __webpack_require__(289), - RightCenter: __webpack_require__(296), - TopCenter: __webpack_require__(297), - TopLeft: __webpack_require__(298), - TopRight: __webpack_require__(299) - -}; - - -/***/ }), -/* 901 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Display.Align.To - */ - -module.exports = { - - BottomCenter: __webpack_require__(277), - BottomLeft: __webpack_require__(278), - BottomRight: __webpack_require__(279), - LeftBottom: __webpack_require__(280), - LeftCenter: __webpack_require__(281), - LeftTop: __webpack_require__(282), - QuickSet: __webpack_require__(276), - RightBottom: __webpack_require__(283), - RightCenter: __webpack_require__(284), - RightTop: __webpack_require__(285), - TopCenter: __webpack_require__(286), - TopLeft: __webpack_require__(287), - TopRight: __webpack_require__(288) - -}; - - -/***/ }), -/* 902 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Display.Bounds - */ - -module.exports = { - - CenterOn: __webpack_require__(294), - GetBottom: __webpack_require__(42), - GetBounds: __webpack_require__(903), - GetCenterX: __webpack_require__(87), - GetCenterY: __webpack_require__(89), - GetLeft: __webpack_require__(43), - GetOffsetX: __webpack_require__(904), - GetOffsetY: __webpack_require__(905), - GetRight: __webpack_require__(44), - GetTop: __webpack_require__(45), - SetBottom: __webpack_require__(55), - SetCenterX: __webpack_require__(88), - SetCenterY: __webpack_require__(90), - SetLeft: __webpack_require__(53), - SetRight: __webpack_require__(54), - SetTop: __webpack_require__(52) - -}; - - -/***/ }), -/* 903 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author samme - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var GetBottom = __webpack_require__(42); -var GetLeft = __webpack_require__(43); -var GetRight = __webpack_require__(44); -var GetTop = __webpack_require__(45); - -/** - * Returns the unrotated bounds of the Game Object as a rectangle. - * - * @function Phaser.Display.Bounds.GetBounds - * @since 3.24.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * @param {(Phaser.Geom.Rectangle|object)} [output] - An object to store the values in. - * - * @return {(Phaser.Geom.Rectangle|object)} - The bounds of the Game Object. - */ -var GetBounds = function (gameObject, output) -{ - if (output === undefined) { output = {}; } - - var left = GetLeft(gameObject); - var top = GetTop(gameObject); - - output.x = left; - output.y = top; - output.width = GetRight(gameObject) - left; - output.height = GetBottom(gameObject) - top; - - return output; -}; - -module.exports = GetBounds; - - -/***/ }), -/* 904 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Returns the amount the Game Object is visually offset from its x coordinate. - * This is the same as `width * origin.x`. - * This value will only be > 0 if `origin.x` is not equal to zero. - * - * @function Phaser.Display.Bounds.GetOffsetX - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * - * @return {number} The horizontal offset of the Game Object. - */ -var GetOffsetX = function (gameObject) -{ - return gameObject.width * gameObject.originX; -}; - -module.exports = GetOffsetX; - - -/***/ }), -/* 905 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Returns the amount the Game Object is visually offset from its y coordinate. - * This is the same as `width * origin.y`. - * This value will only be > 0 if `origin.y` is not equal to zero. - * - * @function Phaser.Display.Bounds.GetOffsetY - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from. - * - * @return {number} The vertical offset of the Game Object. - */ -var GetOffsetY = function (gameObject) -{ - return gameObject.height * gameObject.originY; -}; - -module.exports = GetOffsetY; - - -/***/ }), -/* 906 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Display.Canvas - */ - -module.exports = { - - CanvasInterpolation: __webpack_require__(367), - CanvasPool: __webpack_require__(31), - Smoothing: __webpack_require__(192), - TouchAction: __webpack_require__(907), - UserSelect: __webpack_require__(908) - -}; - - -/***/ }), -/* 907 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Sets the touch-action property on the canvas style. Can be used to disable default browser touch actions. - * - * @function Phaser.Display.Canvas.TouchAction - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to. - * @param {string} [value='none'] - The touch action value to set on the canvas. Set to `none` to disable touch actions. - * - * @return {HTMLCanvasElement} The canvas element. - */ -var TouchAction = function (canvas, value) -{ - if (value === undefined) { value = 'none'; } - - canvas.style['msTouchAction'] = value; - canvas.style['ms-touch-action'] = value; - canvas.style['touch-action'] = value; - - return canvas; -}; - -module.exports = TouchAction; - - -/***/ }), -/* 908 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Sets the user-select property on the canvas style. Can be used to disable default browser selection actions. - * - * @function Phaser.Display.Canvas.UserSelect - * @since 3.0.0 - * - * @param {HTMLCanvasElement} canvas - The canvas element to have the style applied to. - * @param {string} [value='none'] - The touch callout value to set on the canvas. Set to `none` to disable touch callouts. - * - * @return {HTMLCanvasElement} The canvas element. - */ -var UserSelect = function (canvas, value) -{ - if (value === undefined) { value = 'none'; } - - var vendors = [ - '-webkit-', - '-khtml-', - '-moz-', - '-ms-', - '' - ]; - - vendors.forEach(function (vendor) + render: function (scene, children, camera) { - canvas.style[vendor + 'user-select'] = value; - }); - - canvas.style['-webkit-touch-callout'] = value; - canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)'; - - return canvas; -}; - -module.exports = UserSelect; - - -/***/ }), -/* 909 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var GetColor = __webpack_require__(103); + if (this.contextLost) { return; } -/** - * Return an array of Colors in a Color Spectrum. - * - * The spectrum colors flow in the order: red, yellow, green, blue. - * - * By default this function will return an array with 1024 elements in. - * - * However, you can reduce this to a smaller quantity if needed, by specitying the `limit` parameter. - * - * @function Phaser.Display.Color.ColorSpectrum - * @since 3.50.0 - * - * @param {number} [limit=1024] - How many colors should be returned? The maximum is 1024 but you can set a smaller quantity if required. - * - * @return {Phaser.Types.Display.ColorObject[]} An array containing `limit` parameter number of elements, where each contains a Color Object. - */ -var ColorSpectrum = function (limit) -{ - if (limit === undefined) { limit = 1024; } + var childCount = children.length; - var colors = []; + this.emit(Events.RENDER, scene, camera); - var range = 255; + // Apply scissor for cam region + render background color, if not transparent + this.preRenderCamera(camera); - var i; - var r = 255; - var g = 0; - var b = 0; + // Nothing to render, so bail out + if (childCount === 0) + { + this.setBlendMode(CONST.BlendModes.NORMAL); - // Red to Yellow - for (i = 0; i <= range; i++) - { - colors.push({ r: r, g: i, b: b, color: GetColor(r, i, b) }); - } + // Applies camera effects and pops the scissor, if set + this.postRenderCamera(camera); - g = 255; + return; + } - // Yellow to Green - for (i = range; i >= 0; i--) - { - colors.push({ r: i, g: g, b: b, color: GetColor(i, g, b) }); - } + // Reset the current type + this.currentType = ''; - r = 0; + var current = this.currentMask; - // Green to Blue - for (i = 0; i <= range; i++, g--) - { - colors.push({ r: r, g: g, b: i, color: GetColor(r, g, i) }); - } + for (var i = 0; i < childCount; i++) + { + this.finalType = (i === childCount - 1); - g = 0; - b = 255; + var child = children[i]; - // Blue to Red - for (i = 0; i <= range; i++, b--, r++) - { - colors.push({ r: r, g: g, b: b, color: GetColor(r, g, b) }); - } + var mask = child.mask; - if (limit === 1024) - { - return colors; - } - else - { - var out = []; + current = this.currentMask; - var t = 0; - var inc = 1024 / limit; + if (current.mask && current.mask !== mask) + { + // Render out the previously set mask + current.mask.postRenderWebGL(this, current.camera); + } - for (i = 0; i < limit; i++) - { - out.push(colors[Math.floor(t)]); + if (mask && current.mask !== mask) + { + mask.preRenderWebGL(this, child, camera); + } - t += inc; - } + if (child.blendMode !== this.currentBlendMode) + { + this.setBlendMode(child.blendMode); + } - return out; - } -}; + var type = child.type; -module.exports = ColorSpectrum; + if (type !== this.currentType) + { + this.newType = true; + this.currentType = type; + } + if (!this.finalType) + { + this.nextTypeMatch = (children[i + 1].type === this.currentType); + } + else + { + this.nextTypeMatch = false; + } -/***/ }), -/* 910 */ -/***/ (function(module, exports) { + child.renderWebGL(this, child, camera); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.newType = false; + } -/** - * Converts the given color value into an Object containing r,g,b and a properties. - * - * @function Phaser.Display.Color.ColorToRGBA - * @since 3.0.0 - * - * @param {number} color - A color value, optionally including the alpha value. - * - * @return {Phaser.Types.Display.ColorObject} An object containing the parsed color values. - */ -var ColorToRGBA = function (color) -{ - var output = { - r: color >> 16 & 0xFF, - g: color >> 8 & 0xFF, - b: color & 0xFF, - a: 255 - }; + current = this.currentMask; - if (color > 16777215) - { - output.a = color >>> 24; - } + if (current.mask) + { + // Render out the previously set mask, if it was the last item in the display list + current.mask.postRenderWebGL(this, current.camera); + } - return output; -}; + this.setBlendMode(CONST.BlendModes.NORMAL); -module.exports = ColorToRGBA; + // Applies camera effects and pops the scissor, if set + this.postRenderCamera(camera); + }, + /** + * The post-render step happens after all Cameras in all Scenes have been rendered. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#postRender + * @fires Phaser.Renderer.Events#POST_RENDER + * @since 3.0.0 + */ + postRender: function () + { + if (this.contextLost) { return; } -/***/ }), -/* 911 */ -/***/ (function(module, exports, __webpack_require__) { + this.flush(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.emit(Events.POST_RENDER); -var Color = __webpack_require__(38); -var HueToComponent = __webpack_require__(399); + var state = this.snapshotState; -/** - * Converts HSL (hue, saturation and lightness) values to a Phaser Color object. - * - * @function Phaser.Display.Color.HSLToColor - * @since 3.0.0 - * - * @param {number} h - The hue value in the range 0 to 1. - * @param {number} s - The saturation value in the range 0 to 1. - * @param {number} l - The lightness value in the range 0 to 1. - * - * @return {Phaser.Display.Color} A Color object created from the results of the h, s and l values. - */ -var HSLToColor = function (h, s, l) -{ - // achromatic by default - var r = l; - var g = l; - var b = l; + if (state.callback) + { + WebGLSnapshot(this.gl, state); - if (s !== 0) + state.callback = null; + } + }, + + /** + * Disables the STENCIL_TEST but does not change the status + * of the current stencil mask. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#clearStencilMask + * @since 3.60.0 + */ + clearStencilMask: function () { - var q = (l < 0.5) ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; + this.gl.disable(this.gl.STENCIL_TEST); + }, - r = HueToComponent(p, q, h + 1 / 3); - g = HueToComponent(p, q, h); - b = HueToComponent(p, q, h - 1 / 3); - } + /** + * Restores the current stencil function to the one that was in place + * before `clearStencilMask` was called. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#restoreStencilMask + * @since 3.60.0 + */ + restoreStencilMask: function () + { + var gl = this.gl; - var color = new Color(); + var current = this.getCurrentStencilMask(); - return color.setGLTo(r, g, b, 1); -}; + if (current) + { + var mask = current.mask; -module.exports = HSLToColor; + gl.enable(gl.STENCIL_TEST); + // colorMask + stencilOp(KEEP) -/***/ }), -/* 912 */ -/***/ (function(module, exports, __webpack_require__) { + if (mask.invertAlpha) + { + gl.stencilFunc(gl.NOTEQUAL, mask.level, 0xff); + } + else + { + gl.stencilFunc(gl.EQUAL, mask.level, 0xff); + } + } + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. + * + * To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. + * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, + * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, + * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot + * @since 3.0.0 + * + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshot: function (callback, type, encoderOptions) + { + return this.snapshotArea(0, 0, this.gl.drawingBufferWidth, this.gl.drawingBufferHeight, callback, type, encoderOptions); + }, -var HSVToRGB = __webpack_require__(188); + /** + * Schedules a snapshot of the given area of the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific pixel, see `snapshotPixel`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then + * calling this method will override it. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. + * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, + * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, + * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotArea + * @since 3.16.0 + * + * @param {number} x - The x coordinate to grab from. This is based on the game viewport, not the world. + * @param {number} y - The y coordinate to grab from. This is based on the game viewport, not the world. + * @param {number} width - The width of the area to grab. + * @param {number} height - The height of the area to grab. + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshotArea: function (x, y, width, height, callback, type, encoderOptions) + { + var state = this.snapshotState; -/** - * Get HSV color wheel values in an array which will be 360 elements in size. - * - * @function Phaser.Display.Color.HSVColorWheel - * @since 3.0.0 - * - * @param {number} [s=1] - The saturation, in the range 0 - 1. - * @param {number} [v=1] - The value, in the range 0 - 1. - * - * @return {Phaser.Types.Display.ColorObject[]} An array containing 360 elements, where each contains a single numeric value corresponding to the color at that point in the HSV color wheel. - */ -var HSVColorWheel = function (s, v) -{ - if (s === undefined) { s = 1; } - if (v === undefined) { v = 1; } + state.callback = callback; + state.type = type; + state.encoder = encoderOptions; + state.getPixel = false; + state.x = x; + state.y = y; + state.width = width; + state.height = height; - var colors = []; + return this; + }, - for (var c = 0; c <= 359; c++) + /** + * Schedules a snapshot of the given pixel from the game viewport to be taken after the current frame is rendered. + * + * To capture the whole game viewport see the `snapshot` method. To capture a specific area, see `snapshotArea`. + * + * Only one snapshot can be active _per frame_. If you have already called `snapshotArea`, for example, then + * calling this method will override it. + * + * Unlike the other two snapshot methods, this one will return a `Color` object containing the color data for + * the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, + * using less memory. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotPixel + * @since 3.16.0 + * + * @param {number} x - The x coordinate of the pixel to get. This is based on the game viewport, not the world. + * @param {number} y - The y coordinate of the pixel to get. This is based on the game viewport, not the world. + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * + * @return {this} This WebGL Renderer. + */ + snapshotPixel: function (x, y, callback) { - colors.push(HSVToRGB(c / 359, s, v)); - } + this.snapshotArea(x, y, 1, 1, callback); - return colors; -}; + this.snapshotState.getPixel = true; -module.exports = HSVColorWheel; + return this; + }, + /** + * Takes a snapshot of the given area of the given frame buffer. + * + * Unlike the other snapshot methods, this one is processed immediately and doesn't wait for the next render. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer into an ArrayBufferView. + * It then parses this, copying the contents to a temporary Canvas and finally creating an Image object from it, + * which is the image returned to the callback provided. All in all, this is a computationally expensive and blocking process, + * which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshotFramebuffer + * @since 3.19.0 + * + * @param {WebGLFramebuffer} framebuffer - The framebuffer to grab from. + * @param {number} bufferWidth - The width of the framebuffer. + * @param {number} bufferHeight - The height of the framebuffer. + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {boolean} [getPixel=false] - Grab a single pixel as a Color object, or an area as an Image object? + * @param {number} [x=0] - The x coordinate to grab from. This is based on the framebuffer, not the world. + * @param {number} [y=0] - The y coordinate to grab from. This is based on the framebuffer, not the world. + * @param {number} [width=bufferWidth] - The width of the area to grab. + * @param {number} [height=bufferHeight] - The height of the area to grab. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This WebGL Renderer. + */ + snapshotFramebuffer: function (framebuffer, bufferWidth, bufferHeight, callback, getPixel, x, y, width, height, type, encoderOptions) + { + if (getPixel === undefined) { getPixel = false; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = bufferWidth; } + if (height === undefined) { height = bufferHeight; } -/***/ }), -/* 913 */ -/***/ (function(module, exports, __webpack_require__) { + if (type === 'pixel') + { + getPixel = true; + type = 'image/png'; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var currentFramebuffer = this.currentFramebuffer; -var Linear = __webpack_require__(135); + this.snapshotArea(x, y, width, height, callback, type, encoderOptions); -/** - * @namespace Phaser.Display.Color.Interpolate - * @memberof Phaser.Display.Color - * @since 3.0.0 - */ + var state = this.snapshotState; -/** - * Interpolates between the two given color ranges over the length supplied. - * - * @function Phaser.Display.Color.Interpolate.RGBWithRGB - * @memberof Phaser.Display.Color.Interpolate - * @static - * @since 3.0.0 - * - * @param {number} r1 - Red value. - * @param {number} g1 - Blue value. - * @param {number} b1 - Green value. - * @param {number} r2 - Red value. - * @param {number} g2 - Blue value. - * @param {number} b2 - Green value. - * @param {number} [length=100] - Distance to interpolate over. - * @param {number} [index=0] - Index to start from. - * - * @return {Phaser.Types.Display.ColorObject} An object containing the interpolated color values. - */ -var RGBWithRGB = function (r1, g1, b1, r2, g2, b2, length, index) -{ - if (length === undefined) { length = 100; } - if (index === undefined) { index = 0; } + state.getPixel = getPixel; - var t = index / length; + state.isFramebuffer = true; + state.bufferWidth = bufferWidth; + state.bufferHeight = bufferHeight; - return { - r: Linear(r1, r2, t), - g: Linear(g1, g2, t), - b: Linear(b1, b2, t) - }; -}; + // Ensure they're not trying to grab an area larger than the framebuffer + state.width = Math.min(state.width, bufferWidth); + state.height = Math.min(state.height, bufferHeight); -/** - * Interpolates between the two given color objects over the length supplied. - * - * @function Phaser.Display.Color.Interpolate.ColorWithColor - * @memberof Phaser.Display.Color.Interpolate - * @static - * @since 3.0.0 - * - * @param {Phaser.Display.Color} color1 - The first Color object. - * @param {Phaser.Display.Color} color2 - The second Color object. - * @param {number} [length=100] - Distance to interpolate over. - * @param {number} [index=0] - Index to start from. - * - * @return {Phaser.Types.Display.ColorObject} An object containing the interpolated color values. - */ -var ColorWithColor = function (color1, color2, length, index) -{ - if (length === undefined) { length = 100; } - if (index === undefined) { index = 0; } + this.setFramebuffer(framebuffer); - return RGBWithRGB(color1.r, color1.g, color1.b, color2.r, color2.g, color2.b, length, index); -}; + WebGLSnapshot(this.gl, state); -/** - * Interpolates between the Color object and color values over the length supplied. - * - * @function Phaser.Display.Color.Interpolate.ColorWithRGB - * @memberof Phaser.Display.Color.Interpolate - * @static - * @since 3.0.0 - * - * @param {Phaser.Display.Color} color1 - The first Color object. - * @param {number} r - Red value. - * @param {number} g - Blue value. - * @param {number} b - Green value. - * @param {number} [length=100] - Distance to interpolate over. - * @param {number} [index=0] - Index to start from. - * - * @return {Phaser.Types.Display.ColorObject} An object containing the interpolated color values. - */ -var ColorWithRGB = function (color, r, g, b, length, index) -{ - if (length === undefined) { length = 100; } - if (index === undefined) { index = 0; } + this.setFramebuffer(currentFramebuffer); - return RGBWithRGB(color.r, color.g, color.b, r, g, b, length, index); -}; + state.callback = null; + state.isFramebuffer = false; -module.exports = { + return this; + }, - RGBWithRGB: RGBWithRGB, - ColorWithRGB: ColorWithRGB, - ColorWithColor: ColorWithColor + /** + * Creates a new WebGL Texture based on the given Canvas Element. + * + * If the `dstTexture` parameter is given, the WebGL Texture is updated, rather than created fresh. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#canvasToTexture + * @since 3.0.0 + * + * @param {HTMLCanvasElement} srcCanvas - The Canvas to create the WebGL Texture from + * @param {WebGLTexture} [dstTexture] - The destination WebGL Texture to set. + * @param {boolean} [noRepeat=false] - Should this canvas be allowed to set `REPEAT` (such as for Text objects?) + * @param {boolean} [flipY=false] - Should the WebGL Texture set `UNPACK_MULTIPLY_FLIP_Y`? + * + * @return {WebGLTexture} The newly created, or updated, WebGL Texture. + */ + canvasToTexture: function (srcCanvas, dstTexture, noRepeat, flipY) + { + if (noRepeat === undefined) { noRepeat = false; } + if (flipY === undefined) { flipY = false; } -}; + if (!dstTexture) + { + return this.createCanvasTexture(srcCanvas, noRepeat, flipY); + } + else + { + return this.updateCanvasTexture(srcCanvas, dstTexture, flipY); + } + }, + /** + * Creates a new WebGL Texture based on the given Canvas Element. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createCanvasTexture + * @since 3.20.0 + * + * @param {HTMLCanvasElement} srcCanvas - The Canvas to create the WebGL Texture from. + * @param {boolean} [noRepeat=false] - Should this canvas be allowed to set `REPEAT` (such as for Text objects?) + * @param {boolean} [flipY=false] - Should the WebGL Texture set `UNPACK_MULTIPLY_FLIP_Y`? + * + * @return {WebGLTexture} The newly created WebGL Texture. + */ + createCanvasTexture: function (srcCanvas, noRepeat, flipY) + { + if (noRepeat === undefined) { noRepeat = false; } + if (flipY === undefined) { flipY = false; } -/***/ }), -/* 914 */ -/***/ (function(module, exports, __webpack_require__) { + var gl = this.gl; + var minFilter = gl.NEAREST; + var magFilter = gl.NEAREST; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var width = srcCanvas.width; + var height = srcCanvas.height; -var Between = __webpack_require__(195); -var Color = __webpack_require__(38); + var wrapping = gl.CLAMP_TO_EDGE; -/** - * Creates a new Color object where the r, g, and b values have been set to random values - * based on the given min max values. - * - * @function Phaser.Display.Color.RandomRGB - * @since 3.0.0 - * - * @param {number} [min=0] - The minimum value to set the random range from (between 0 and 255) - * @param {number} [max=255] - The maximum value to set the random range from (between 0 and 255) - * - * @return {Phaser.Display.Color} A Color object. - */ -var RandomRGB = function (min, max) -{ - if (min === undefined) { min = 0; } - if (max === undefined) { max = 255; } + var pow = IsSizePowerOfTwo(width, height); - return new Color(Between(min, max), Between(min, max), Between(min, max)); -}; + if (!noRepeat && pow) + { + wrapping = gl.REPEAT; + } -module.exports = RandomRGB; + if (this.config.antialias) + { + minFilter = (pow && this.mipmapFilter) ? this.mipmapFilter : gl.LINEAR; + magFilter = gl.LINEAR; + } + return this.createTexture2D(0, minFilter, magFilter, wrapping, wrapping, gl.RGBA, srcCanvas, width, height, true, false, flipY); + }, -/***/ }), -/* 915 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Updates a WebGL Texture based on the given Canvas Element. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#updateCanvasTexture + * @since 3.20.0 + * + * @param {HTMLCanvasElement} srcCanvas - The Canvas to update the WebGL Texture from. + * @param {WebGLTexture} dstTexture - The destination WebGL Texture to update. + * @param {boolean} [flipY=false] - Should the WebGL Texture set `UNPACK_MULTIPLY_FLIP_Y`? + * + * @return {WebGLTexture} The updated WebGL Texture. + */ + updateCanvasTexture: function (srcCanvas, dstTexture, flipY) + { + if (flipY === undefined) { flipY = false; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var gl = this.gl; -var ComponentToHex = __webpack_require__(398); + var width = srcCanvas.width; + var height = srcCanvas.height; -/** - * Converts the color values into an HTML compatible color string, prefixed with either `#` or `0x`. - * - * @function Phaser.Display.Color.RGBToString - * @since 3.0.0 - * - * @param {number} r - The red color value. A number between 0 and 255. - * @param {number} g - The green color value. A number between 0 and 255. - * @param {number} b - The blue color value. A number between 0 and 255. - * @param {number} [a=255] - The alpha value. A number between 0 and 255. - * @param {string} [prefix=#] - The prefix of the string. Either `#` or `0x`. - * - * @return {string} A string-based representation of the color values. - */ -var RGBToString = function (r, g, b, a, prefix) -{ - if (a === undefined) { a = 255; } - if (prefix === undefined) { prefix = '#'; } + if (width > 0 && height > 0) + { + gl.activeTexture(gl.TEXTURE0); + var currentTexture = gl.getParameter(gl.TEXTURE_BINDING_2D); + gl.bindTexture(gl.TEXTURE_2D, dstTexture); - if (prefix === '#') - { - return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1, 7); - } - else - { - return '0x' + ComponentToHex(a) + ComponentToHex(r) + ComponentToHex(g) + ComponentToHex(b); - } -}; + if (flipY) + { + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + } -module.exports = RGBToString; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, srcCanvas); -/***/ }), -/* 916 */ -/***/ (function(module, exports, __webpack_require__) { + dstTexture.width = width; + dstTexture.height = height; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (currentTexture) + { + gl.bindTexture(gl.TEXTURE_2D, currentTexture); + } + } -/** - * @namespace Phaser.Display.Masks - */ + return dstTexture; + }, -module.exports = { + /** + * Creates a new WebGL Texture based on the given HTML Video Element. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#createVideoTexture + * @since 3.20.0 + * + * @param {HTMLVideoElement} srcVideo - The Video to create the WebGL Texture from + * @param {boolean} [noRepeat=false] - Should this canvas be allowed to set `REPEAT`? + * @param {boolean} [flipY=false] - Should the WebGL Texture set `UNPACK_MULTIPLY_FLIP_Y`? + * + * @return {WebGLTexture} The newly created WebGL Texture. + */ + createVideoTexture: function (srcVideo, noRepeat, flipY) + { + if (noRepeat === undefined) { noRepeat = false; } + if (flipY === undefined) { flipY = false; } - BitmapMask: __webpack_require__(310), - GeometryMask: __webpack_require__(311) + var gl = this.gl; + var minFilter = gl.NEAREST; + var magFilter = gl.NEAREST; -}; + var width = srcVideo.videoWidth; + var height = srcVideo.videoHeight; + var wrapping = gl.CLAMP_TO_EDGE; -/***/ }), -/* 917 */ -/***/ (function(module, exports, __webpack_require__) { + var pow = IsSizePowerOfTwo(width, height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (!noRepeat && pow) + { + wrapping = gl.REPEAT; + } -/** - * @namespace Phaser.DOM - */ + if (this.config.antialias) + { + minFilter = (pow && this.mipmapFilter) ? this.mipmapFilter : gl.LINEAR; + magFilter = gl.LINEAR; + } -var Dom = { + return this.createTexture2D(0, minFilter, magFilter, wrapping, wrapping, gl.RGBA, srcVideo, width, height, true, true, flipY); + }, - AddToDOM: __webpack_require__(142), - DOMContentLoaded: __webpack_require__(400), - GetInnerHeight: __webpack_require__(401), - GetScreenOrientation: __webpack_require__(402), - GetTarget: __webpack_require__(407), - ParseXML: __webpack_require__(408), - RemoveFromDOM: __webpack_require__(202), - RequestAnimationFrame: __webpack_require__(386) + /** + * Updates a WebGL Texture based on the given HTML Video Element. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#updateVideoTexture + * @since 3.20.0 + * + * @param {HTMLVideoElement} srcVideo - The Video to update the WebGL Texture with. + * @param {WebGLTexture} dstTexture - The destination WebGL Texture to update. + * @param {boolean} [flipY=false] - Should the WebGL Texture set `UNPACK_MULTIPLY_FLIP_Y`? + * + * @return {WebGLTexture} The updated WebGL Texture. + */ + updateVideoTexture: function (srcVideo, dstTexture, flipY) + { + if (flipY === undefined) { flipY = false; } -}; + var gl = this.gl; -module.exports = Dom; + var width = srcVideo.videoWidth; + var height = srcVideo.videoHeight; + if (width > 0 && height > 0) + { + gl.activeTexture(gl.TEXTURE0); + var currentTexture = gl.getParameter(gl.TEXTURE_BINDING_2D); + gl.bindTexture(gl.TEXTURE_2D, dstTexture); -/***/ }), -/* 918 */ -/***/ (function(module, exports, __webpack_require__) { + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, srcVideo); -/** - * @namespace Phaser.Events - */ + dstTexture.width = width; + dstTexture.height = height; -module.exports = { EventEmitter: __webpack_require__(919) }; + if (currentTexture) + { + gl.bindTexture(gl.TEXTURE_2D, currentTexture); + } + } + return dstTexture; + }, -/***/ }), -/* 919 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Sets the minification and magnification filter for a texture. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#setTextureFilter + * @since 3.0.0 + * + * @param {number} texture - The texture to set the filter for. + * @param {number} filter - The filter to set. 0 for linear filtering, 1 for nearest neighbor (blocky) filtering. + * + * @return {this} This WebGL Renderer instance. + */ + setTextureFilter: function (texture, filter) + { + var gl = this.gl; + var glFilter = [ gl.LINEAR, gl.NEAREST ][filter]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + gl.activeTexture(gl.TEXTURE0); -var Class = __webpack_require__(0); -var EE = __webpack_require__(9); -var PluginCache = __webpack_require__(24); + var currentTexture = gl.getParameter(gl.TEXTURE_BINDING_2D); -/** - * @classdesc - * EventEmitter is a Scene Systems plugin compatible version of eventemitter3. - * - * @class EventEmitter - * @memberof Phaser.Events - * @constructor - * @since 3.0.0 - */ -var EventEmitter = new Class({ + gl.bindTexture(gl.TEXTURE_2D, texture); - Extends: EE, + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, glFilter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, glFilter); - initialize: + if (currentTexture) + { + gl.bindTexture(gl.TEXTURE_2D, currentTexture); + } - function EventEmitter () - { - EE.call(this); + return this; }, /** - * Removes all listeners. + * Returns the largest texture size (either width or height) that can be created. + * Note that VRAM may not allow a texture of any given size, it just expresses + * hardware / driver support for a given size. * - * @method Phaser.Events.EventEmitter#shutdown - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.WebGLRenderer#getMaxTextureSize + * @since 3.8.0 + * + * @return {number} The maximum supported texture size. */ - shutdown: function () + getMaxTextureSize: function () { - this.removeAllListeners(); + return this.config.maxTextureSize; }, /** - * Removes all listeners. + * Destroy this WebGLRenderer, cleaning up all related resources such as pipelines, native textures, etc. * - * @method Phaser.Events.EventEmitter#destroy + * @method Phaser.Renderer.WebGL.WebGLRenderer#destroy * @since 3.0.0 */ destroy: function () { - this.removeAllListeners(); - } - -}); - -/** - * Return an array listing the events for which the emitter has registered listeners. - * - * @method Phaser.Events.EventEmitter#eventNames - * @since 3.0.0 - * - * @return {Array.} - */ - -/** - * Return the listeners registered for a given event. - * - * @method Phaser.Events.EventEmitter#listeners - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * - * @return {Function[]} The registered listeners. - */ - -/** - * Return the number of listeners listening to a given event. - * - * @method Phaser.Events.EventEmitter#listenerCount - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * - * @return {number} The number of listeners. - */ - -/** - * Calls each of the listeners registered for a given event. - * - * @method Phaser.Events.EventEmitter#emit - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {...*} [args] - Additional arguments that will be passed to the event handler. - * - * @return {boolean} `true` if the event had listeners, else `false`. - */ + this.canvas.removeEventListener('webglcontextlost', this.contextLostHandler, false); -/** - * Add a listener for a given event. - * - * @method Phaser.Events.EventEmitter#on - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {this} `this`. - */ + this.maskTarget.destroy(); + this.maskSource.destroy(); -/** - * Add a listener for a given event. - * - * @method Phaser.Events.EventEmitter#addListener - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {this} `this`. - */ + this.pipelines.destroy(); -/** - * Add a one-time listener for a given event. - * - * @method Phaser.Events.EventEmitter#once - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} fn - The listener function. - * @param {*} [context=this] - The context to invoke the listener with. - * - * @return {this} `this`. - */ + this.removeAllListeners(); -/** - * Remove the listeners of a given event. - * - * @method Phaser.Events.EventEmitter#removeListener - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} [fn] - Only remove the listeners that match this function. - * @param {*} [context] - Only remove the listeners that have this context. - * @param {boolean} [once] - Only remove one-time listeners. - * - * @return {this} `this`. - */ + this.fboStack = []; + this.maskStack = []; + this.extensions = {}; + this.textureIndexes = []; -/** - * Remove the listeners of a given event. - * - * @method Phaser.Events.EventEmitter#off - * @since 3.0.0 - * - * @param {(string|symbol)} event - The event name. - * @param {function} [fn] - Only remove the listeners that match this function. - * @param {*} [context] - Only remove the listeners that have this context. - * @param {boolean} [once] - Only remove one-time listeners. - * - * @return {this} `this`. - */ + this.gl = null; + this.game = null; + this.canvas = null; + this.contextLost = true; + this.currentMask = null; + this.currentCameraMask = null; -/** - * Remove all listeners, or those of the specified event. - * - * @method Phaser.Events.EventEmitter#removeAllListeners - * @since 3.0.0 - * - * @param {(string|symbol)} [event] - The event name. - * - * @return {this} `this`. - */ + if (DEBUG) + { + this.spector = null; + } + } -PluginCache.register('EventEmitter', EventEmitter, 'events'); +}); -module.exports = EventEmitter; +module.exports = WebGLRenderer; /***/ }), -/* 920 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 71305: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AddToDOM = __webpack_require__(142); -var AnimationManager = __webpack_require__(321); -var CacheManager = __webpack_require__(325); -var CanvasPool = __webpack_require__(31); -var Class = __webpack_require__(0); -var Config = __webpack_require__(346); -var CreateDOMContainer = __webpack_require__(921); -var CreateRenderer = __webpack_require__(366); -var DataManager = __webpack_require__(101); -var DebugHeader = __webpack_require__(384); -var Device = __webpack_require__(347); -var DOMContentLoaded = __webpack_require__(400); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(22); -var InputManager = __webpack_require__(409); -var PluginCache = __webpack_require__(24); -var PluginManager = __webpack_require__(414); -var ScaleManager = __webpack_require__(415); -var SceneManager = __webpack_require__(417); -var TextureEvents = __webpack_require__(106); -var TextureManager = __webpack_require__(422); -var TimeStep = __webpack_require__(385); -var VisibilityHandler = __webpack_require__(387); - -if (true) -{ - var SoundManagerCreator = __webpack_require__(426); -} - -if (false) -{ var FacebookInstantGamesPlugin; } +var Class = __webpack_require__(56694); +var GetFastValue = __webpack_require__(72632); +var WEBGL_CONST = __webpack_require__(71402); /** * @classdesc - * The Phaser.Game instance is the main controller for the entire Phaser game. It is responsible - * for handling the boot process, parsing the configuration values, creating the renderer, - * and setting-up all of the global Phaser systems, such as sound and input. - * Once that is complete it will start the Scene Manager and then begin the main game loop. + * Instances of the WebGLShader class belong to the WebGL Pipeline classes. When the pipeline is + * created it will create an instance of this class for each one of its shaders, as defined in + * the pipeline configuration. * - * You should generally avoid accessing any of the systems created by Game, and instead use those - * made available to you via the Phaser.Scene Systems class instead. + * This class encapsulates everything needed to manage a shader in a pipeline, including the + * shader attributes and uniforms, as well as lots of handy methods such as `set2f`, for setting + * uniform values on this shader. * - * @class Game - * @memberof Phaser + * Typically, you do not create an instance of this class directly, as it works in unison with + * the pipeline to which it belongs. You can gain access to this class via a pipeline's `shaders` + * array, post-creation. + * + * @class WebGLShader + * @memberof Phaser.Renderer.WebGL * @constructor - * @fires Phaser.Core.Events#BLUR - * @fires Phaser.Core.Events#FOCUS - * @fires Phaser.Core.Events#HIDDEN - * @fires Phaser.Core.Events#VISIBLE - * @since 3.0.0 + * @since 3.50.0 * - * @param {Phaser.Types.Core.GameConfig} [GameConfig] - The configuration object for your Phaser Game instance. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The WebGLPipeline to which this Shader belongs. + * @param {string} name - The name of this Shader. + * @param {string} vertexShader - The vertex shader source code as a single string. + * @param {string} fragmentShader - The fragment shader source code as a single string. + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineAttributeConfig[]} attributes - An array of attributes. */ -var Game = new Class({ - - initialize: - - function Game (config) - { - /** - * The parsed Game Configuration object. - * - * The values stored within this object are read-only and should not be changed at run-time. - * - * @name Phaser.Game#config - * @type {Phaser.Core.Config} - * @readonly - * @since 3.0.0 - */ - this.config = new Config(config); - - /** - * A reference to either the Canvas or WebGL Renderer that this Game is using. - * - * @name Phaser.Game#renderer - * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} - * @since 3.0.0 - */ - this.renderer = null; - - /** - * A reference to an HTML Div Element used as the DOM Element Container. - * - * Only set if `createDOMContainer` is `true` in the game config (by default it is `false`) and - * if you provide a parent element to insert the Phaser Game inside. - * - * See the DOM Element Game Object for more details. - * - * @name Phaser.Game#domContainer - * @type {HTMLDivElement} - * @since 3.17.0 - */ - this.domContainer = null; - - /** - * A reference to the HTML Canvas Element that Phaser uses to render the game. - * This is created automatically by Phaser unless you provide a `canvas` property - * in your Game Config. - * - * @name Phaser.Game#canvas - * @type {HTMLCanvasElement} - * @since 3.0.0 - */ - this.canvas = null; - - /** - * A reference to the Rendering Context belonging to the Canvas Element this game is rendering to. - * If the game is running under Canvas it will be a 2d Canvas Rendering Context. - * If the game is running under WebGL it will be a WebGL Rendering Context. - * This context is created automatically by Phaser unless you provide a `context` property - * in your Game Config. - * - * @name Phaser.Game#context - * @type {(CanvasRenderingContext2D|WebGLRenderingContext)} - * @since 3.0.0 - */ - this.context = null; - - /** - * A flag indicating when this Game instance has finished its boot process. - * - * @name Phaser.Game#isBooted - * @type {boolean} - * @readonly - * @since 3.0.0 - */ - this.isBooted = false; - - /** - * A flag indicating if this Game is currently running its game step or not. - * - * @name Phaser.Game#isRunning - * @type {boolean} - * @readonly - * @since 3.0.0 - */ - this.isRunning = false; - - /** - * An Event Emitter which is used to broadcast game-level events from the global systems. - * - * @name Phaser.Game#events - * @type {Phaser.Events.EventEmitter} - * @since 3.0.0 - */ - this.events = new EventEmitter(); - - /** - * An instance of the Animation Manager. - * - * The Animation Manager is a global system responsible for managing all animations used within your game. - * - * @name Phaser.Game#anims - * @type {Phaser.Animations.AnimationManager} - * @since 3.0.0 - */ - this.anims = new AnimationManager(this); - - /** - * An instance of the Texture Manager. - * - * The Texture Manager is a global system responsible for managing all textures being used by your game. - * - * @name Phaser.Game#textures - * @type {Phaser.Textures.TextureManager} - * @since 3.0.0 - */ - this.textures = new TextureManager(this); - - /** - * An instance of the Cache Manager. - * - * The Cache Manager is a global system responsible for caching, accessing and releasing external game assets. - * - * @name Phaser.Game#cache - * @type {Phaser.Cache.CacheManager} - * @since 3.0.0 - */ - this.cache = new CacheManager(this); - - /** - * An instance of the Data Manager - * - * @name Phaser.Game#registry - * @type {Phaser.Data.DataManager} - * @since 3.0.0 - */ - this.registry = new DataManager(this); +var WebGLShader = new Class({ + + initialize: + function WebGLShader (pipeline, name, vertexShader, fragmentShader, attributes) + { /** - * An instance of the Input Manager. + * A reference to the WebGLPipeline that owns this Shader. * - * The Input Manager is a global system responsible for the capture of browser-level input events. + * A Shader class can only belong to a single pipeline. * - * @name Phaser.Game#input - * @type {Phaser.Input.InputManager} - * @since 3.0.0 + * @name Phaser.Renderer.WebGL.WebGLShader#pipeline + * @type {Phaser.Renderer.WebGL.WebGLPipeline} + * @since 3.50.0 */ - this.input = new InputManager(this, this.config); + this.pipeline = pipeline; /** - * An instance of the Scene Manager. - * - * The Scene Manager is a global system responsible for creating, modifying and updating the Scenes in your game. + * The name of this shader. * - * @name Phaser.Game#scene - * @type {Phaser.Scenes.SceneManager} - * @since 3.0.0 + * @name Phaser.Renderer.WebGL.WebGLShader#name + * @type {string} + * @since 3.50.0 */ - this.scene = new SceneManager(this, this.config.sceneConfig); + this.name = name; /** - * A reference to the Device inspector. - * - * Contains information about the device running this game, such as OS, browser vendor and feature support. - * Used by various systems to determine capabilities and code paths. + * A reference to the WebGLRenderer instance. * - * @name Phaser.Game#device - * @type {Phaser.DeviceConf} - * @since 3.0.0 + * @name Phaser.Renderer.WebGL.WebGLShader#renderer + * @type {Phaser.Renderer.WebGL.WebGLRenderer} + * @since 3.50.0 */ - this.device = Device; + this.renderer = pipeline.renderer; /** - * An instance of the Scale Manager. - * - * The Scale Manager is a global system responsible for handling scaling of the game canvas. + * A reference to the WebGL Rendering Context the WebGL Renderer is using. * - * @name Phaser.Game#scale - * @type {Phaser.Scale.ScaleManager} - * @since 3.16.0 + * @name Phaser.Renderer.WebGL.WebGLShader#gl + * @type {WebGLRenderingContext} + * @since 3.50.0 */ - this.scale = new ScaleManager(this, this.config); + this.gl = this.renderer.gl; /** - * An instance of the base Sound Manager. - * - * The Sound Manager is a global system responsible for the playback and updating of all audio in your game. - * - * You can disable the inclusion of the Sound Manager in your build by toggling the webpack `FEATURE_SOUND` flag. + * The fragment shader source code. * - * @name Phaser.Game#sound - * @type {(Phaser.Sound.NoAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager|Phaser.Sound.WebAudioSoundManager)} - * @since 3.0.0 + * @name Phaser.Renderer.WebGL.WebGLShader#fragSrc + * @type {string} + * @since 3.60.0 */ - this.sound = null; - - if (true) - { - this.sound = SoundManagerCreator.create(this); - } + this.fragSrc = fragmentShader; /** - * An instance of the Time Step. - * - * The Time Step is a global system responsible for setting-up and responding to the browser frame events, processing - * them and calculating delta values. It then automatically calls the game step. + * The vertex shader source code. * - * @name Phaser.Game#loop - * @type {Phaser.Core.TimeStep} - * @since 3.0.0 + * @name Phaser.Renderer.WebGL.WebGLShader#vertSrc + * @type {string} + * @since 3.60.0 */ - this.loop = new TimeStep(this, this.config.fps); + this.vertSrc = vertexShader; /** - * An instance of the Plugin Manager. - * - * The Plugin Manager is a global system that allows plugins to register themselves with it, and can then install - * those plugins into Scenes as required. + * The WebGLProgram created from the vertex and fragment shaders. * - * @name Phaser.Game#plugins - * @type {Phaser.Plugins.PluginManager} - * @since 3.0.0 + * @name Phaser.Renderer.WebGL.WebGLShader#program + * @type {WebGLProgram} + * @since 3.50.0 */ - this.plugins = new PluginManager(this, this.config); - - if (false) - {} + this.program = this.renderer.createProgram(vertexShader, fragmentShader); /** - * Is this Game pending destruction at the start of the next frame? + * Array of objects that describe the vertex attributes. * - * @name Phaser.Game#pendingDestroy - * @type {boolean} - * @private - * @since 3.5.0 + * @name Phaser.Renderer.WebGL.WebGLShader#attributes + * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineAttribute[]} + * @since 3.50.0 */ - this.pendingDestroy = false; + this.attributes; /** - * Remove the Canvas once the destroy is over? + * The amount of vertex attribute components of 32 bit length. * - * @name Phaser.Game#removeCanvas - * @type {boolean} - * @private - * @since 3.5.0 + * @name Phaser.Renderer.WebGL.WebGLShader#vertexComponentCount + * @type {number} + * @since 3.50.0 */ - this.removeCanvas = false; + this.vertexComponentCount = 0; /** - * Remove everything when the game is destroyed. - * You cannot create a new Phaser instance on the same web page after doing this. + * The size, in bytes, of a single vertex. * - * @name Phaser.Game#noReturn - * @type {boolean} - * @private - * @since 3.12.0 + * This is derived by adding together all of the vertex attributes. + * + * For example, the Multi Pipeline has the following attributes: + * + * inPosition - (size 2 x gl.FLOAT) = 8 + * inTexCoord - (size 2 x gl.FLOAT) = 8 + * inTexId - (size 1 x gl.FLOAT) = 4 + * inTintEffect - (size 1 x gl.FLOAT) = 4 + * inTint - (size 4 x gl.UNSIGNED_BYTE) = 4 + * + * The total, in this case, is 8 + 8 + 4 + 4 + 4 = 28. + * + * This is calculated automatically during the `createAttributes` method. + * + * @name Phaser.Renderer.WebGL.WebGLShader#vertexSize + * @type {number} + * @readonly + * @since 3.50.0 */ - this.noReturn = false; + this.vertexSize = 0; /** - * Does the window the game is running in currently have focus or not? - * This is modified by the VisibilityHandler. + * The active uniforms that this shader has. * - * @name Phaser.Game#hasFocus - * @type {boolean} - * @readonly - * @since 3.9.0 + * This is an object that maps the uniform names to their WebGL location and cached values. + * + * It is populated automatically via the `createUniforms` method. + * + * @name Phaser.Renderer.WebGL.WebGLShader#uniforms + * @type {Phaser.Types.Renderer.WebGL.WebGLPipelineUniformsConfig} + * @since 3.50.0 */ - this.hasFocus = false; + this.uniforms = {}; - // Wait for the DOM Ready event, then call boot. - DOMContentLoaded(this.boot.bind(this)); + this.createAttributes(attributes); + this.createUniforms(); }, /** - * This method is called automatically when the DOM is ready. It is responsible for creating the renderer, - * displaying the Debug Header, adding the game canvas to the DOM and emitting the 'boot' event. - * It listens for a 'ready' event from the base systems and once received it will call `Game.start`. + * Takes the vertex attributes config and parses it, creating the resulting array that is stored + * in this shaders `attributes` property, calculating the offset, normalization and location + * in the process. * - * @method Phaser.Game#boot - * @protected - * @fires Phaser.Core.Events#BOOT - * @listens Phaser.Textures.Events#READY - * @since 3.0.0 + * Calling this method resets `WebGLShader.attributes`, `WebGLShader.vertexSize` and + * `WebGLShader.vertexComponentCount`. + * + * It is called automatically when this class is created, but can be called manually if required. + * + * @method Phaser.Renderer.WebGL.WebGLShader#createAttributes + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineAttributeConfig[]} attributes - An array of attributes configs. */ - boot: function () + createAttributes: function (attributes) { - if (!PluginCache.hasCore('EventEmitter')) + var count = 0; + var offset = 0; + var result = []; + + this.vertexComponentCount = 0; + + for (var i = 0; i < attributes.length; i++) { - console.warn('Aborting. Core Plugins missing.'); - return; - } + var element = attributes[i]; - this.isBooted = true; + var name = element.name; + var size = GetFastValue(element, 'size', 1); // i.e. 1 for a float, 2 for a vec2, 4 for a vec4, etc + var glType = GetFastValue(element, 'type', WEBGL_CONST.FLOAT); + var type = glType.enum; // The GLenum + var typeSize = glType.size; // The size in bytes of the type - this.config.preBoot(this); + var normalized = (element.normalized) ? true : false; - this.scale.preBoot(); + result.push({ + name: name, + size: size, + type: type, + normalized: normalized, + offset: offset, + enabled: false, + location: -1 + }); - CreateRenderer(this); + if (typeSize === 4) + { + count += size; + } + else + { + count++; + } - CreateDOMContainer(this); + offset += size * typeSize; + } - DebugHeader(this); + this.vertexSize = offset; + this.vertexComponentCount = count; + this.attributes = result; + }, - AddToDOM(this.canvas, this.config.parent); + /** + * Sets the program this shader uses as being the active shader in the WebGL Renderer. + * + * This method is called every time the parent pipeline is made the current active pipeline. + * + * @method Phaser.Renderer.WebGL.WebGLShader#bind + * @since 3.50.0 + * + * @param {boolean} [setAttributes=false] - Should the vertex attribute pointers be set? + * @param {boolean} [flush=false] - Flush the pipeline before binding this shader? + * + * @return {this} This WebGLShader instance. + */ + bind: function (setAttributes, flush) + { + if (setAttributes === undefined) { setAttributes = false; } + if (flush === undefined) { flush = false; } - // The Texture Manager has to wait on a couple of non-blocking events before it's fully ready. - // So it will emit this internal event when done: - this.textures.once(TextureEvents.READY, this.texturesReady, this); + if (flush) + { + this.pipeline.flush(); + } - this.events.emit(Events.BOOT); + this.renderer.setProgram(this.program); + + if (setAttributes) + { + this.setAttribPointers(); + } + + return this; }, /** - * Called automatically when the Texture Manager has finished setting up and preparing the - * default textures. + * Sets the program this shader uses as being the active shader in the WebGL Renderer. * - * @method Phaser.Game#texturesReady - * @private - * @fires Phaser.Game#READY - * @since 3.12.0 + * Then resets all of the attribute pointers. + * + * @method Phaser.Renderer.WebGL.WebGLShader#rebind + * @since 3.50.0 + * + * @return {this} This WebGLShader instance. */ - texturesReady: function () + rebind: function () { - // Start all the other systems - this.events.emit(Events.READY); + this.renderer.setProgram(this.program); - this.start(); + this.setAttribPointers(true); + + return this; }, /** - * Called automatically by Game.boot once all of the global systems have finished setting themselves up. - * By this point the Game is now ready to start the main loop running. - * It will also enable the Visibility Handler. + * Sets the vertex attribute pointers. * - * @method Phaser.Game#start - * @protected - * @since 3.0.0 + * This should only be called after the vertex buffer has been bound. + * + * It is called automatically during the `bind` method. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setAttribPointers + * @since 3.50.0 + * + * @param {boolean} [reset=false] - Reset the vertex attribute locations? + * + * @return {this} This WebGLShader instance. */ - start: function () + setAttribPointers: function (reset) { - this.isRunning = true; + if (reset === undefined) { reset = false; } - this.config.postBoot(this); + var gl = this.gl; + var vertexSize = this.vertexSize; + var attributes = this.attributes; + var program = this.program; - if (this.renderer) + for (var i = 0; i < attributes.length; i++) { - this.loop.start(this.step.bind(this)); + var element = attributes[i]; + + var size = element.size; + var type = element.type; + var offset = element.offset; + var enabled = element.enabled; + var location = element.location; + var normalized = (element.normalized) ? true : false; + + if (reset) + { + var attribLocation = gl.getAttribLocation(program, element.name); + + if (attribLocation >= 0) + { + gl.enableVertexAttribArray(attribLocation); + + gl.vertexAttribPointer(attribLocation, size, type, normalized, vertexSize, offset); + + element.enabled = true; + element.location = attribLocation; + } + else if (attribLocation !== -1) + { + gl.disableVertexAttribArray(attribLocation); + } + } + else if (enabled) + { + gl.vertexAttribPointer(location, size, type, normalized, vertexSize, offset); + } + else if (!enabled && location > -1) + { + gl.disableVertexAttribArray(location); + + element.location = -1; + } } - else + + return this; + }, + + /** + * Sets up the `WebGLShader.uniforms` object, populating it with the names + * and locations of the shader uniforms this shader requires. + * + * It works by first calling `gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS)` to + * find out how many active uniforms this shader has. It then iterates through them, + * calling `gl.getActiveUniform` to get the WebGL Active Info from each one. Finally, + * the name and location are stored in the local array. + * + * This method is called automatically when this class is created. + * + * @method Phaser.Renderer.WebGL.WebGLShader#createUniforms + * @since 3.50.0 + * + * @return {this} This WebGLShader instance. + */ + createUniforms: function () + { + var gl = this.gl; + var program = this.program; + var uniforms = this.uniforms; + + var i; + var name; + var location; + + // Look-up all active uniforms + + var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + + for (i = 0; i < totalUniforms; i++) { - this.loop.start(this.headlessStep.bind(this)); + var info = gl.getActiveUniform(program, i); + + if (info) + { + name = info.name; + + location = gl.getUniformLocation(program, name); + + if (location !== null) + { + uniforms[name] = + { + name: name, + location: location, + value1: null, + value2: null, + value3: null, + value4: null + }; + } + + // If the uniform name contains [] for an array struct, + // we'll add an entry for the non-struct name as well. + // Such as uMainSampler[12] = uMainSampler + + var struct = name.indexOf('['); + + if (struct > 0) + { + name = name.substr(0, struct); + + if (!uniforms.hasOwnProperty(name)) + { + location = gl.getUniformLocation(program, name); + + if (location !== null) + { + uniforms[name] = + { + name: name, + location: location, + value1: null, + value2: null, + value3: null, + value4: null + }; + } + } + } + } } - VisibilityHandler(this); + return this; + }, - var eventEmitter = this.events; + /** + * Checks to see if the given uniform name exists and is active in this shader. + * + * @method Phaser.Renderer.WebGL.WebGLShader#hasUniform + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to check for. + * + * @return {boolean} `true` if the uniform exists, otherwise `false`. + */ + hasUniform: function (name) + { + return this.uniforms.hasOwnProperty(name); + }, - eventEmitter.on(Events.HIDDEN, this.onHidden, this); - eventEmitter.on(Events.VISIBLE, this.onVisible, this); - eventEmitter.on(Events.BLUR, this.onBlur, this); - eventEmitter.on(Events.FOCUS, this.onFocus, this); + /** + * Resets the cached values of the given uniform. + * + * @method Phaser.Renderer.WebGL.WebGLShader#resetUniform + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to reset. + * + * @return {this} This WebGLShader instance. + */ + resetUniform: function (name) + { + var uniform = this.uniforms[name]; + + if (uniform) + { + uniform.value1 = null; + uniform.value2 = null; + uniform.value3 = null; + uniform.value4 = null; + } + + return this; }, /** - * The main Game Step. Called automatically by the Time Step, once per browser frame (typically as a result of - * Request Animation Frame, or Set Timeout on very old browsers.) + * Sets the given uniform value/s based on the name and GL function. * - * The step will update the global managers first, then proceed to update each Scene in turn, via the Scene Manager. + * This method is called internally by other methods such as `set1f` and `set3iv`. * - * It will then render each Scene in turn, via the Renderer. This process emits `prerender` and `postrender` events. + * The uniform is only set if the value/s given are different to those previously set. * - * @method Phaser.Game#step - * @fires Phaser.Core.Events#PRE_STEP - * @fires Phaser.Core.Events#STEP - * @fires Phaser.Core.Events#POST_STEP - * @fires Phaser.Core.Events#PRE_RENDER - * @fires Phaser.Core.Events#POST_RENDER - * @since 3.0.0 + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * @method Phaser.Renderer.WebGL.WebGLShader#setUniform1 + * @since 3.50.0 + * + * @param {function} setter - The GL function to call. + * @param {string} name - The name of the uniform to set. + * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. + * @param {boolean} [skipCheck=false] - Skip the value comparison? + * + * @return {this} This WebGLShader instance. */ - step: function (time, delta) + setUniform1: function (setter, name, value1, skipCheck) { - if (this.pendingDestroy) + var uniform = this.uniforms[name]; + + if (!uniform) { - return this.runDestroy(); + return this; } - var eventEmitter = this.events; + if (skipCheck || uniform.value1 !== value1) + { + uniform.value1 = value1; - // Global Managers like Input and Sound update in the prestep + this.renderer.setProgram(this.program); - eventEmitter.emit(Events.PRE_STEP, time, delta); + setter.call(this.gl, uniform.location, value1); - // This is mostly meant for user-land code and plugins + this.pipeline.currentShader = this; + } - eventEmitter.emit(Events.STEP, time, delta); + return this; + }, - // Update the Scene Manager and all active Scenes + /** + * Sets the given uniform value/s based on the name and GL function. + * + * This method is called internally by other methods such as `set1f` and `set3iv`. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setUniform2 + * @since 3.50.0 + * + * @param {function} setter - The GL function to call. + * @param {string} name - The name of the uniform to set. + * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value2 - The new value of the uniform. + * @param {boolean} [skipCheck=false] - Skip the value comparison? + * + * @return {this} This WebGLShader instance. + */ + setUniform2: function (setter, name, value1, value2, skipCheck) + { + var uniform = this.uniforms[name]; - this.scene.update(time, delta); + if (!uniform) + { + return this; + } - // Our final event before rendering starts + if (skipCheck || uniform.value1 !== value1 || uniform.value2 !== value2) + { + uniform.value1 = value1; + uniform.value2 = value2; - eventEmitter.emit(Events.POST_STEP, time, delta); + this.renderer.setProgram(this.program); - var renderer = this.renderer; + setter.call(this.gl, uniform.location, value1, value2); - // Run the Pre-render (clearing the canvas, setting background colors, etc) + this.pipeline.currentShader = this; + } - renderer.preRender(); + return this; + }, - eventEmitter.emit(Events.PRE_RENDER, renderer, time, delta); + /** + * Sets the given uniform value/s based on the name and GL function. + * + * This method is called internally by other methods such as `set1f` and `set3iv`. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setUniform3 + * @since 3.50.0 + * + * @param {function} setter - The GL function to call. + * @param {string} name - The name of the uniform to set. + * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value2 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value3 - The new value of the uniform. + * @param {boolean} [skipCheck=false] - Skip the value comparison? + * + * @return {this} This WebGLShader instance. + */ + setUniform3: function (setter, name, value1, value2, value3, skipCheck) + { + var uniform = this.uniforms[name]; - // The main render loop. Iterates all Scenes and all Cameras in those scenes, rendering to the renderer instance. + if (!uniform) + { + return this; + } - this.scene.render(renderer); + if (skipCheck || uniform.value1 !== value1 || uniform.value2 !== value2 || uniform.value3 !== value3) + { + uniform.value1 = value1; + uniform.value2 = value2; + uniform.value3 = value3; - // The Post-Render call. Tidies up loose end, takes snapshots, etc. + this.renderer.setProgram(this.program); - renderer.postRender(); + setter.call(this.gl, uniform.location, value1, value2, value3); - // The final event before the step repeats. Your last chance to do anything to the canvas before it all starts again. + this.pipeline.currentShader = this; + } - eventEmitter.emit(Events.POST_RENDER, renderer, time, delta); + return this; }, /** - * A special version of the Game Step for the HEADLESS renderer only. + * Sets the given uniform value/s based on the name and GL function. * - * The main Game Step. Called automatically by the Time Step, once per browser frame (typically as a result of - * Request Animation Frame, or Set Timeout on very old browsers.) + * This method is called internally by other methods such as `set1f` and `set3iv`. * - * The step will update the global managers first, then proceed to update each Scene in turn, via the Scene Manager. + * The uniform is only set if the value/s given are different to those previously set. * - * This process emits `prerender` and `postrender` events, even though nothing actually displays. + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. * - * @method Phaser.Game#headlessStep - * @fires Phaser.Game#PRE_RENDER - * @fires Phaser.Game#POST_RENDER - * @since 3.2.0 + * @method Phaser.Renderer.WebGL.WebGLShader#setUniform4 + * @since 3.50.0 * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * @param {function} setter - The GL function to call. + * @param {string} name - The name of the uniform to set. + * @param {(boolean|number|number[]|Float32Array)} value1 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value2 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value3 - The new value of the uniform. + * @param {(boolean|number|number[]|Float32Array)} value4 - The new value of the uniform. + * @param {boolean} [skipCheck=false] - Skip the value comparison? + * + * @return {this} This WebGLShader instance. */ - headlessStep: function (time, delta) + setUniform4: function (setter, name, value1, value2, value3, value4, skipCheck) { - if (this.pendingDestroy) + var uniform = this.uniforms[name]; + + if (!uniform) { - return this.runDestroy(); + return this; } - var eventEmitter = this.events; + if (skipCheck || uniform.value1 !== value1 || uniform.value2 !== value2 || uniform.value3 !== value3 || uniform.value4 !== value4) + { + uniform.value1 = value1; + uniform.value2 = value2; + uniform.value3 = value3; + uniform.value4 = value4; - // Global Managers + this.renderer.setProgram(this.program); - eventEmitter.emit(Events.PRE_STEP, time, delta); + setter.call(this.gl, uniform.location, value1, value2, value3, value4); - eventEmitter.emit(Events.STEP, time, delta); + this.pipeline.currentShader = this; + } - // Scenes + return this; + }, - this.scene.update(time, delta); + /** + * Sets a boolean uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setBoolean + * @since 3.60.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} value - The new value of the `boolean` uniform. + * + * @return {this} This WebGLShader instance. + */ + setBoolean: function (name, value) + { + return this.setUniform1(this.gl.uniform1i, name, Number(value)); + }, - eventEmitter.emit(Events.POST_STEP, time, delta); + /** + * Sets a 1f uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set1f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new value of the `float` uniform. + * + * @return {this} This WebGLShader instance. + */ + set1f: function (name, x) + { + return this.setUniform1(this.gl.uniform1f, name, x); + }, - // Render + /** + * Sets a 2f uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set2f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `vec2` uniform. + * @param {number} y - The new Y component of the `vec2` uniform. + * + * @return {this} This WebGLShader instance. + */ + set2f: function (name, x, y) + { + return this.setUniform2(this.gl.uniform2f, name, x, y); + }, + + /** + * Sets a 3f uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set3f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `vec3` uniform. + * @param {number} y - The new Y component of the `vec3` uniform. + * @param {number} z - The new Z component of the `vec3` uniform. + * + * @return {this} This WebGLShader instance. + */ + set3f: function (name, x, y, z) + { + return this.setUniform3(this.gl.uniform3f, name, x, y, z); + }, + + /** + * Sets a 4f uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set4f + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - X component of the uniform + * @param {number} y - Y component of the uniform + * @param {number} z - Z component of the uniform + * @param {number} w - W component of the uniform + * + * @return {this} This WebGLShader instance. + */ + set4f: function (name, x, y, z, w) + { + return this.setUniform4(this.gl.uniform4f, name, x, y, z, w); + }, - eventEmitter.emit(Events.PRE_RENDER); + /** + * Sets a 1fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set1fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set1fv: function (name, arr) + { + return this.setUniform1(this.gl.uniform1fv, name, arr, true); + }, - eventEmitter.emit(Events.POST_RENDER); + /** + * Sets a 2fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set2fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set2fv: function (name, arr) + { + return this.setUniform1(this.gl.uniform2fv, name, arr, true); }, /** - * Called automatically by the Visibility Handler. - * This will pause the main loop and then emit a pause event. + * Sets a 3fv uniform value based on the given name on this shader. * - * @method Phaser.Game#onHidden - * @protected - * @fires Phaser.Core.Events#PAUSE - * @since 3.0.0 + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set3fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. */ - onHidden: function () + set3fv: function (name, arr) { - this.loop.pause(); + return this.setUniform1(this.gl.uniform3fv, name, arr, true); + }, - this.events.emit(Events.PAUSE); + /** + * Sets a 4fv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set4fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set4fv: function (name, arr) + { + return this.setUniform1(this.gl.uniform4fv, name, arr, true); }, /** - * Called automatically by the Visibility Handler. - * This will resume the main loop and then emit a resume event. + * Sets a 1iv uniform value based on the given name on this shader. * - * @method Phaser.Game#onVisible - * @protected - * @fires Phaser.Core.Events#RESUME - * @since 3.0.0 + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set1iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. */ - onVisible: function () + set1iv: function (name, arr) { - this.loop.resume(); + return this.setUniform1(this.gl.uniform1iv, name, arr, true); + }, - this.events.emit(Events.RESUME); + /** + * Sets a 2iv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set2iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set2iv: function (name, arr) + { + return this.setUniform1(this.gl.uniform2iv, name, arr, true); }, /** - * Called automatically by the Visibility Handler. - * This will set the main loop into a 'blurred' state, which pauses it. + * Sets a 3iv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set3iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set3iv: function (name, arr) + { + return this.setUniform1(this.gl.uniform3iv, name, arr, true); + }, + + /** + * Sets a 4iv uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set4iv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number[]|Float32Array} arr - The new value to be used for the uniform variable. + * + * @return {this} This WebGLShader instance. + */ + set4iv: function (name, arr) + { + return this.setUniform1(this.gl.uniform4iv, name, arr, true); + }, + + /** + * Sets a 1i uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set1i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new value of the `int` uniform. + * + * @return {this} This WebGLShader instance. + */ + set1i: function (name, x) + { + return this.setUniform1(this.gl.uniform1i, name, x); + }, + + /** + * Sets a 2i uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set2i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `ivec2` uniform. + * @param {number} y - The new Y component of the `ivec2` uniform. + * + * @return {this} This WebGLShader instance. + */ + set2i: function (name, x, y) + { + return this.setUniform2(this.gl.uniform2i, name, x, y); + }, + + /** + * Sets a 3i uniform value based on the given name on this shader. + * + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set3i + * @since 3.50.0 * - * @method Phaser.Game#onBlur - * @protected - * @since 3.0.0 + * @param {string} name - The name of the uniform to set. + * @param {number} x - The new X component of the `ivec3` uniform. + * @param {number} y - The new Y component of the `ivec3` uniform. + * @param {number} z - The new Z component of the `ivec3` uniform. + * + * @return {this} This WebGLShader instance. */ - onBlur: function () + set3i: function (name, x, y, z) { - this.hasFocus = false; - - this.loop.blur(); + return this.setUniform3(this.gl.uniform3i, name, x, y, z); }, /** - * Called automatically by the Visibility Handler. - * This will set the main loop into a 'focused' state, which resumes it. + * Sets a 4i uniform value based on the given name on this shader. * - * @method Phaser.Game#onFocus - * @protected - * @since 3.0.0 + * The uniform is only set if the value/s given are different to those previously set. + * + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#set4i + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {number} x - X component of the uniform + * @param {number} y - Y component of the uniform + * @param {number} z - Z component of the uniform + * @param {number} w - W component of the uniform + * + * @return {this} This WebGLShader instance. */ - onFocus: function () + set4i: function (name, x, y, z, w) { - this.hasFocus = true; - - this.loop.focus(); + return this.setUniform4(this.gl.uniform4i, name, x, y, z, w); }, /** - * Returns the current game frame. + * Sets a matrix 2fv uniform value based on the given name on this shader. * - * When the game starts running, the frame is incremented every time Request Animation Frame, or Set Timeout, fires. + * The uniform is only set if the value/s given are different to those previously set. * - * @method Phaser.Game#getFrame - * @since 3.16.0 + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. * - * @return {number} The current game frame. + * @method Phaser.Renderer.WebGL.WebGLShader#setMatrix2fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {number[]|Float32Array} matrix - The new values for the `mat2` uniform. + * + * @return {this} This WebGLShader instance. */ - getFrame: function () + setMatrix2fv: function (name, transpose, matrix) { - return this.loop.frame; + return this.setUniform2(this.gl.uniformMatrix2fv, name, transpose, matrix, true); }, /** - * Returns the time that the current game step started at, as based on `performance.now`. + * Sets a matrix 3fv uniform value based on the given name on this shader. * - * @method Phaser.Game#getTime - * @since 3.16.0 + * The uniform is only set if the value/s given are different to those previously set. * - * @return {number} The current game timestamp. + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. + * + * @method Phaser.Renderer.WebGL.WebGLShader#setMatrix3fv + * @since 3.50.0 + * + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Whether to transpose the matrix. Should be `false`. + * @param {Float32Array} matrix - The new values for the `mat3` uniform. + * + * @return {this} This WebGLShader instance. */ - getTime: function () + setMatrix3fv: function (name, transpose, matrix) { - return this.loop.now; + return this.setUniform2(this.gl.uniformMatrix3fv, name, transpose, matrix, true); }, /** - * Flags this Game instance as needing to be destroyed on the _next frame_, making this an asynchronous operation. + * Sets a matrix 4fv uniform value based on the given name on this shader. * - * It will wait until the current frame has completed and then call `runDestroy` internally. + * The uniform is only set if the value/s given are different to those previously set. * - * If you need to react to the games eventual destruction, listen for the `DESTROY` event. + * This method works by first setting this shader as being the current shader within the + * WebGL Renderer, if it isn't already. It also sets this shader as being the current + * one within the pipeline it belongs to. * - * If you **do not** need to run Phaser again on the same web page you can set the `noReturn` argument to `true` and it will free-up - * memory being held by the core Phaser plugins. If you do need to create another game instance on the same page, leave this as `false`. + * @method Phaser.Renderer.WebGL.WebGLShader#setMatrix4fv + * @since 3.50.0 * - * @method Phaser.Game#destroy - * @fires Phaser.Core.Events#DESTROY - * @since 3.0.0 + * @param {string} name - The name of the uniform to set. + * @param {boolean} transpose - Should the matrix be transpose + * @param {Float32Array} matrix - Matrix data * - * @param {boolean} removeCanvas - Set to `true` if you would like the parent canvas element removed from the DOM, or `false` to leave it in place. - * @param {boolean} [noReturn=false] - If `true` all the core Phaser plugins are destroyed. You cannot create another instance of Phaser on the same web page if you do this. + * @return {this} This WebGLShader instance. */ - destroy: function (removeCanvas, noReturn) + setMatrix4fv: function (name, transpose, matrix) { - if (noReturn === undefined) { noReturn = false; } - - this.pendingDestroy = true; - - this.removeCanvas = removeCanvas; - this.noReturn = noReturn; + return this.setUniform2(this.gl.uniformMatrix4fv, name, transpose, matrix, true); }, /** - * Destroys this Phaser.Game instance, all global systems, all sub-systems and all Scenes. + * This method will create the Shader Program on the current GL context. * - * @method Phaser.Game#runDestroy - * @private - * @since 3.5.0 + * If a program already exists, it will be destroyed and the new one will take its place. + * + * After the program is created the uniforms will be reset and + * this shader will be rebound. + * + * This is a very expensive process and if your shader is referenced elsewhere in + * your game those references may then be lost, so be sure to use this carefully. + * + * However, if you need to update say the fragment shader source, then you can pass + * the new source into this method and it'll rebuild the program using it. If you + * don't want to change the vertex shader src, pass `undefined` as the parameter. + * + * @method Phaser.Renderer.WebGL.WebGLShader#createProgram + * @since 3.60.0 + * + * @param {string} [vertSrc] - The source code of the vertex shader. If not given, uses the source already defined in this Shader. + * @param {string} [fragSrc] - The source code of the fragment shader. If not given, uses the source already defined in this Shader. + * + * @return {this} This WebGLShader instance. */ - runDestroy: function () + createProgram: function (vertSrc, fragSrc) { - this.scene.destroy(); - - this.events.emit(Events.DESTROY); + if (vertSrc === undefined) { vertSrc = this.vertSrc; } + if (fragSrc === undefined) { fragSrc = this.fragSrc; } - this.events.removeAllListeners(); + var gl = this.gl; - if (this.renderer) + if (this.program) { - this.renderer.destroy(); + gl.deleteProgram(this.program); } - if (this.removeCanvas && this.canvas) - { - CanvasPool.remove(this.canvas); + this.vertSrc = vertSrc; + this.fragSrc = fragSrc; - if (this.canvas.parentNode) - { - this.canvas.parentNode.removeChild(this.canvas); - } - } + this.program = this.renderer.createProgram(vertSrc, fragSrc); - if (this.domContainer) - { - this.domContainer.parentNode.removeChild(this.domContainer); - } + this.createUniforms(); - this.loop.destroy(); + return this.rebind(); + }, - this.pendingDestroy = false; + /** + * Removes all external references from this class and deletes the WebGL program from the WebGL context. + * + * Does not remove this shader from the parent pipeline. + * + * @method Phaser.Renderer.WebGL.WebGLShader#destroy + * @since 3.50.0 + */ + destroy: function () + { + this.gl.deleteProgram(this.program); + + this.pipeline = null; + this.renderer = null; + this.gl = null; + this.program = null; + this.attributes = null; + this.uniforms = null; } }); -module.exports = Game; - -/** - * "Computers are good at following instructions, but not at reading your mind." - Donald Knuth - */ +module.exports = WebGLShader; /***/ }), -/* 921 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 71402: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AddToDOM = __webpack_require__(142); - -var CreateDOMContainer = function (game) -{ - var config = game.config; - - if (!config.parent || !config.domCreateContainer) - { - return; - } +var WEBGL_CONST = { - // DOM Element Container - var div = document.createElement('div'); + /** + * 8-bit twos complement signed integer. + * + * @name Phaser.Renderer.WebGL.BYTE + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + BYTE: { enum: 0x1400, size: 1 }, - div.style.cssText = [ - 'display: block;', - 'width: ' + game.scale.width + 'px;', - 'height: ' + game.scale.height + 'px;', - 'padding: 0; margin: 0;', - 'position: absolute;', - 'overflow: hidden;', - 'pointer-events: ' + config.domPointerEvents + ';', - 'transform: scale(1);', - 'transform-origin: left top;' - ].join(' '); + /** + * 8-bit twos complement unsigned integer. + * + * @name Phaser.Renderer.WebGL.UNSIGNED_BYTE + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + UNSIGNED_BYTE: { enum: 0x1401, size: 1 }, - game.domContainer = div; + /** + * 16-bit twos complement signed integer. + * + * @name Phaser.Renderer.WebGL.SHORT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + SHORT: { enum: 0x1402, size: 2 }, - AddToDOM(div, config.parent); -}; + /** + * 16-bit twos complement unsigned integer. + * + * @name Phaser.Renderer.WebGL.UNSIGNED_SHORT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + UNSIGNED_SHORT: { enum: 0x1403, size: 2 }, -module.exports = CreateDOMContainer; + /** + * 32-bit twos complement signed integer. + * + * @name Phaser.Renderer.WebGL.INT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + INT: { enum: 0x1404, size: 4 }, + /** + * 32-bit twos complement unsigned integer. + * + * @name Phaser.Renderer.WebGL.UNSIGNED_INT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + UNSIGNED_INT: { enum: 0x1405, size: 4 }, -/***/ }), -/* 922 */ -/***/ (function(module, exports) { + /** + * 32-bit IEEE floating point number. + * + * @name Phaser.Renderer.WebGL.FLOAT + * @type {Phaser.Types.Renderer.WebGL.WebGLConst} + * @since 3.50.0 + */ + FLOAT: { enum: 0x1406, size: 4 } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +}; -/** - * The Input Plugin Boot Event. - * - * This internal event is dispatched by the Input Plugin when it boots, signalling to all of its systems to create themselves. - * - * @event Phaser.Input.Events#BOOT - * @since 3.0.0 - */ -module.exports = 'boot'; +module.exports = WEBGL_CONST; /***/ }), -/* 923 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Input Plugin Destroy Event. - * - * This internal event is dispatched by the Input Plugin when it is destroyed, signalling to all of its systems to destroy themselves. - * - * @event Phaser.Input.Events#DESTROY - * @since 3.0.0 - */ -module.exports = 'destroy'; - -/***/ }), -/* 924 */ -/***/ (function(module, exports) { +/***/ 55478: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * The Pointer Drag End Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer stops dragging a Game Object. - * - * Listen to this event from within a Scene using: `this.input.on('dragend', listener)`. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_END]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_END} event instead. - * - * @event Phaser.Input.Events#DRAG_END - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer stopped dragging. - */ -module.exports = 'dragend'; - - -/***/ }), -/* 925 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var WEBGL_CONST = __webpack_require__(71402); +var Extend = __webpack_require__(98611); /** - * The Pointer Drag Enter Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object into a Drag Target. - * - * Listen to this event from within a Scene using: `this.input.on('dragenter', listener)`. - * - * A Pointer can only drag a single Game Object at once. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_ENTER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_ENTER} event instead. - * - * @event Phaser.Input.Events#DRAG_ENTER - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. - * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved into. + * @namespace Phaser.Renderer.WebGL */ -module.exports = 'dragenter'; - -/***/ }), -/* 926 */ -/***/ (function(module, exports) { +var WebGL = { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + PipelineManager: __webpack_require__(35217), + Pipelines: __webpack_require__(62253), + RenderTarget: __webpack_require__(37410), + Utils: __webpack_require__(75512), + WebGLPipeline: __webpack_require__(44775), + WebGLRenderer: __webpack_require__(11857), + WebGLShader: __webpack_require__(71305) -/** - * The Pointer Drag Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves while dragging a Game Object. - * - * Listen to this event from within a Scene using: `this.input.on('drag', listener)`. - * - * A Pointer can only drag a single Game Object at once. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG} event instead. - * - * @event Phaser.Input.Events#DRAG - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. - * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. - * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. - */ -module.exports = 'drag'; +}; +// Merge in the consts -/***/ }), -/* 927 */ -/***/ (function(module, exports) { +WebGL = Extend(false, WebGL, WEBGL_CONST); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +// Export it -/** - * The Pointer Drag Leave Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object out of a Drag Target. - * - * Listen to this event from within a Scene using: `this.input.on('dragleave', listener)`. - * - * A Pointer can only drag a single Game Object at once. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_LEAVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_LEAVE} event instead. - * - * @event Phaser.Input.Events#DRAG_LEAVE - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. - * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has left. - */ -module.exports = 'dragleave'; +module.exports = WebGL; /***/ }), -/* 928 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Pointer Drag Over Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drags a Game Object over a Drag Target. - * - * When the Game Object first enters the drag target it will emit a `dragenter` event. If it then moves while within - * the drag target, it will emit this event instead. - * - * Listen to this event from within a Scene using: `this.input.on('dragover', listener)`. - * - * A Pointer can only drag a single Game Object at once. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_OVER} event instead. - * - * @event Phaser.Input.Events#DRAG_OVER - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. - * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved over. - */ -module.exports = 'dragover'; - -/***/ }), -/* 929 */ -/***/ (function(module, exports) { +/***/ 5583: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * The Pointer Drag Start Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer starts to drag any Game Object. - * - * Listen to this event from within a Scene using: `this.input.on('dragstart', listener)`. - * - * A Pointer can only drag a single Game Object at once. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DRAG_START]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DRAG_START} event instead. - * - * @event Phaser.Input.Events#DRAG_START - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer is dragging. - */ -module.exports = 'dragstart'; - - -/***/ }), -/* 930 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var Class = __webpack_require__(56694); +var GetFastValue = __webpack_require__(72632); +var ShaderSourceFS = __webpack_require__(91679); +var ShaderSourceVS = __webpack_require__(89053); +var WEBGL_CONST = __webpack_require__(71402); +var WebGLPipeline = __webpack_require__(44775); /** - * The Pointer Drop Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer drops a Game Object on a Drag Target. - * - * Listen to this event from within a Scene using: `this.input.on('drop', listener)`. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_DROP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DROP} event instead. + * @classdesc + * The Bitmap Mask Pipeline handles all of the bitmap mask rendering in WebGL for applying + * alpha masks to Game Objects. It works by sampling two texture on the fragment shader and + * using the fragments alpha to clip the region. * - * @event Phaser.Input.Events#DROP - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The interactive Game Object that this pointer was dragging. - * @param {Phaser.GameObjects.GameObject} target - The Drag Target the `gameObject` has been dropped on. - */ -module.exports = 'drop'; - - -/***/ }), -/* 931 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Input Plugin Game Out Event. - * - * This event is dispatched by the Input Plugin if the active pointer leaves the game canvas and is now - * outside of it, elsewhere on the web page. - * - * Listen to this event from within a Scene using: `this.input.on('gameout', listener)`. + * The fragment shader it uses can be found in `shaders/src/BitmapMask.frag`. + * The vertex shader it uses can be found in `shaders/src/BitmapMask.vert`. * - * @event Phaser.Input.Events#GAME_OUT - * @since 3.16.1 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {(MouseEvent|TouchEvent)} event - The DOM Event that triggered the canvas out. - */ -module.exports = 'gameout'; - - -/***/ }), -/* 932 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Input Plugin Game Over Event. - * - * This event is dispatched by the Input Plugin if the active pointer enters the game canvas and is now - * over of it, having previously been elsewhere on the web page. - * - * Listen to this event from within a Scene using: `this.input.on('gameover', listener)`. + * The default shader attributes for this pipeline are: * - * @event Phaser.Input.Events#GAME_OVER - * @since 3.16.1 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {(MouseEvent|TouchEvent)} event - The DOM Event that triggered the canvas over. - */ -module.exports = 'gameover'; - - -/***/ }), -/* 933 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Game Object Down Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down on _any_ interactive Game Object. - * - * Listen to this event from within a Scene using: `this.input.on('gameobjectdown', listener)`. - * - * To receive this event, the Game Objects must have been set as interactive. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} event instead. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} - * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} - * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. + * `inPosition` (vec2, offset 0) * - * @event Phaser.Input.Events#GAMEOBJECT_DOWN - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was pressed down on. - * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. - */ -module.exports = 'gameobjectdown'; - - -/***/ }), -/* 934 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Game Object Drag End Event. - * - * This event is dispatched by an interactive Game Object if a pointer stops dragging it. - * - * Listen to this event from a Game Object using: `gameObject.on('dragend', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive and enabled for drag. - * See [GameObject.setInteractive](Phaser.GameObjects.GameObject#setInteractive) for more details. + * The default shader uniforms for this pipeline are: * - * @event Phaser.Input.Events#GAMEOBJECT_DRAG_END + * `uResolution` (vec2) + * `uMainSampler` (sampler2D) + * `uMaskSampler` (sampler2D) + * `uInvertMaskAlpha` (bool) + * + * @class BitmapMaskPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {number} dragX - The x coordinate where the Pointer stopped dragging the Game Object, in world space. - * @param {number} dragY - The y coordinate where the Pointer stopped dragging the Game Object, in world space. + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. */ -module.exports = 'dragend'; - +var BitmapMaskPipeline = new Class({ -/***/ }), -/* 935 */ -/***/ (function(module, exports) { + Extends: WebGLPipeline, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + initialize: -/** - * The Game Object Drag Enter Event. - * - * This event is dispatched by an interactive Game Object if a pointer drags it into a drag target. - * - * Listen to this event from a Game Object using: `gameObject.on('dragenter', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive and enabled for drag. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * @event Phaser.Input.Events#GAMEOBJECT_DRAG_ENTER - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved into. - */ -module.exports = 'dragenter'; + function BitmapMaskPipeline (config) + { + config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS), + config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS), + config.batchSize = GetFastValue(config, 'batchSize', 1), + config.vertices = GetFastValue(config, 'vertices', [ -1, 1, -1, -7, 7, 1 ]), + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2, + type: WEBGL_CONST.FLOAT + } + ]); + WebGLPipeline.call(this, config); + }, -/***/ }), -/* 936 */ -/***/ (function(module, exports) { + boot: function () + { + WebGLPipeline.prototype.boot.call(this); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.set1i('uMainSampler', 0); + this.set1i('uMaskSampler', 1); + }, -/** - * The Game Object Drag Event. - * - * This event is dispatched by an interactive Game Object if a pointer moves while dragging it. - * - * Listen to this event from a Game Object using: `gameObject.on('drag', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive and enabled for drag. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * @event Phaser.Input.Events#GAMEOBJECT_DRAG - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. - * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. - */ -module.exports = 'drag'; + resize: function (width, height) + { + WebGLPipeline.prototype.resize.call(this, width, height); + this.set2f('uResolution', width, height); + }, -/***/ }), -/* 937 */ -/***/ (function(module, exports) { + /** + * Binds necessary resources and renders the mask to a separated framebuffer. + * The framebuffer for the masked object is also bound for further use. + * + * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#beginMask + * @since 3.0.0 + * + * @param {Phaser.Display.Masks.BitmapMask} mask - The BitmapMask instance that called beginMask. + * @param {Phaser.GameObjects.GameObject} maskedObject - GameObject masked by the mask GameObject. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera rendering the current mask. + */ + beginMask: function (mask, maskedObject, camera) + { + this.renderer.beginBitmapMask(mask, camera); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The masked game objects framebuffer is unbound and its texture + * is bound together with the mask texture and the mask shader and + * a draw call with a single quad is processed. Here is where the + * masking effect is applied. + * + * @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#endMask + * @since 3.0.0 + * + * @param {Phaser.Display.Masks.BitmapMask} mask - The BitmapMask instance that called endMask. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. + * @param {Phaser.Renderer.WebGL.RenderTarget} [renderTarget] - Optional WebGL RenderTarget. + */ + endMask: function (mask, camera, renderTarget) + { + var gl = this.gl; + var renderer = this.renderer; -/** - * The Game Object Drag Leave Event. - * - * This event is dispatched by an interactive Game Object if a pointer drags it out of a drag target. - * - * Listen to this event from a Game Object using: `gameObject.on('dragleave', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive and enabled for drag. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * @event Phaser.Input.Events#GAMEOBJECT_DRAG_LEAVE - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has left. - */ -module.exports = 'dragleave'; + // The renderable Game Object that is being used for the bitmap mask + var bitmapMask = mask.bitmapMask; + if (bitmapMask && gl) + { + renderer.drawBitmapMask(bitmapMask, camera, this); -/***/ }), -/* 938 */ -/***/ (function(module, exports) { + if (renderTarget) + { + this.set2f('uResolution', renderTarget.width, renderTarget.height); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.set1i('uInvertMaskAlpha', mask.invertAlpha); -/** - * The Game Object Drag Over Event. - * - * This event is dispatched by an interactive Game Object if a pointer drags it over a drag target. - * - * When the Game Object first enters the drag target it will emit a `dragenter` event. If it then moves while within - * the drag target, it will emit this event instead. - * - * Listen to this event from a Game Object using: `gameObject.on('dragover', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive and enabled for drag. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * @event Phaser.Input.Events#GAMEOBJECT_DRAG_OVER - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} target - The drag target that this pointer has moved over. - */ -module.exports = 'dragover'; + // Finally, draw a triangle filling the whole screen + gl.drawArrays(this.topology, 0, 3); + if (renderTarget) + { + this.set2f('uResolution', this.width, this.height); + } -/***/ }), -/* 939 */ -/***/ (function(module, exports) { + // Clear gl.TEXTURE1 + gl.bindTexture(gl.TEXTURE_2D, null); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +}); -/** - * The Game Object Drag Start Event. - * - * This event is dispatched by an interactive Game Object if a pointer starts to drag it. - * - * Listen to this event from a Game Object using: `gameObject.on('dragstart', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive and enabled for drag. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * There are lots of useful drag related properties that are set within the Game Object when dragging occurs. - * For example, `gameObject.input.dragStartX`, `dragStartY` and so on. - * - * @event Phaser.Input.Events#GAMEOBJECT_DRAG_START - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {number} dragX - The x coordinate where the Pointer is currently dragging the Game Object, in world space. - * @param {number} dragY - The y coordinate where the Pointer is currently dragging the Game Object, in world space. - */ -module.exports = 'dragstart'; +module.exports = BitmapMaskPipeline; /***/ }), -/* 940 */ -/***/ (function(module, exports) { + +/***/ 81828: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var FX = __webpack_require__(58136); +var FX_CONST = __webpack_require__(47406); +var GetFastValue = __webpack_require__(72632); +var PreFXPipeline = __webpack_require__(87228); +var Shaders = __webpack_require__(92462); +var Utils = __webpack_require__(75512); + /** - * The Game Object Drop Event. - * - * This event is dispatched by an interactive Game Object if a pointer drops it on a Drag Target. - * - * Listen to this event from a Game Object using: `gameObject.on('drop', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive and enabled for drag. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. + * @classdesc + * The FXPipeline is a built-in pipeline that controls the application of FX Controllers during + * the rendering process. It maintains all of the FX shaders, instances of Post FX Pipelines and + * is responsible for rendering. * - * @event Phaser.Input.Events#GAMEOBJECT_DROP - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} target - The Drag Target the `gameObject` has been dropped on. + * You should rarely interact with this pipeline directly. Instead, use the FX Controllers that + * is part of the Game Object class in order to manage the effects. + * + * @class FXPipeline + * @extends Phaser.Renderer.WebGL.Pipelines.PreFXPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser game instance. */ -module.exports = 'drop'; +var FXPipeline = new Class({ + Extends: PreFXPipeline, -/***/ }), -/* 941 */ -/***/ (function(module, exports) { + initialize: -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + function FXPipeline (config) + { + // This order is fixed to match with the FX_CONST. Do not adjust. + config.shaders = [ + Utils.setGlowQuality(Shaders.FXGlowFrag, config.game), + Shaders.FXShadowFrag, + Shaders.FXPixelateFrag, + Shaders.FXVignetteFrag, + Shaders.FXShineFrag, + Shaders.FXBlurLowFrag, + Shaders.FXBlurMedFrag, + Shaders.FXBlurHighFrag, + Shaders.FXGradientFrag, + Shaders.FXBloomFrag, + Shaders.ColorMatrixFrag, + Shaders.FXCircleFrag, + Shaders.FXBarrelFrag, + Shaders.FXDisplacementFrag, + Shaders.FXWipeFrag, + Shaders.FXBokehFrag + ]; -/** - * The Game Object Move Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is moved across _any_ interactive Game Object. - * - * Listen to this event from within a Scene using: `this.input.on('gameobjectmove', listener)`. - * - * To receive this event, the Game Objects must have been set as interactive. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} event instead. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} - * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} - * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#GAMEOBJECT_MOVE - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was moved on. - * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. - */ -module.exports = 'gameobjectmove'; + PreFXPipeline.call(this, config); + var game = this.game; -/***/ }), -/* 942 */ -/***/ (function(module, exports) { + /** + * An instance of the Glow Post FX Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#glow + * @type {Phaser.Renderer.WebGL.Pipelines.FX.GlowFXPipeline} + * @since 3.60.0 + */ + this.glow = new FX.Glow(game); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * An instance of the Shadow Post FX Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#shadow + * @type {Phaser.Renderer.WebGL.Pipelines.FX.ShadowFXPipeline} + * @since 3.60.0 + */ + this.shadow = new FX.Shadow(game); -/** - * The Game Object Out Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves out of _any_ interactive Game Object. - * - * Listen to this event from within a Scene using: `this.input.on('gameobjectout', listener)`. - * - * To receive this event, the Game Objects must have been set as interactive. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} event instead. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} - * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} - * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#GAMEOBJECT_OUT - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer moved out of. - * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. - */ -module.exports = 'gameobjectout'; + /** + * An instance of the Pixelate Post FX Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#pixelate + * @type {Phaser.Renderer.WebGL.Pipelines.FX.PixelateFXPipeline} + * @since 3.60.0 + */ + this.pixelate = new FX.Pixelate(game); + /** + * An instance of the Vignette Post FX Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#vignette + * @type {Phaser.Renderer.WebGL.Pipelines.FX.VignetteFXPipeline} + * @since 3.60.0 + */ + this.vignette = new FX.Vignette(game); -/***/ }), -/* 943 */ -/***/ (function(module, exports) { + /** + * An instance of the Shine Post FX Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#shine + * @type {Phaser.Renderer.WebGL.Pipelines.FX.ShineFXPipeline} + * @since 3.60.0 + */ + this.shine = new FX.Shine(game); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * An instance of the Gradient Post FX Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#gradient + * @type {Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline} + * @since 3.60.0 + */ + this.gradient = new FX.Gradient(game); -/** - * The Game Object Over Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves over _any_ interactive Game Object. - * - * Listen to this event from within a Scene using: `this.input.on('gameobjectover', listener)`. - * - * To receive this event, the Game Objects must have been set as interactive. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} event instead. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} - * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} - * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#GAMEOBJECT_OVER - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer moved over. - * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. - */ -module.exports = 'gameobjectover'; + /** + * An instance of the Circle Post FX Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#circle + * @type {Phaser.Renderer.WebGL.Pipelines.FX.CircleFXPipeline} + * @since 3.60.0 + */ + this.circle = new FX.Circle(game); + /** + * An instance of the Barrel Post FX Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#barrel + * @type {Phaser.Renderer.WebGL.Pipelines.FX.BarrelFXPipeline} + * @since 3.60.0 + */ + this.barrel = new FX.Barrel(game); -/***/ }), -/* 944 */ -/***/ (function(module, exports) { + /** + * An instance of the Wipe Post FX Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#wipe + * @type {Phaser.Renderer.WebGL.Pipelines.FX.WipeFXPipeline} + * @since 3.60.0 + */ + this.wipe = new FX.Wipe(game); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * An instance of the Bokeh Post FX Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#bokeh + * @type {Phaser.Renderer.WebGL.Pipelines.FX.BokehFXPipeline} + * @since 3.60.0 + */ + this.bokeh = new FX.Bokeh(game); -/** - * The Game Object Pointer Down Event. - * - * This event is dispatched by an interactive Game Object if a pointer is pressed down on it. - * - * Listen to this event from a Game Object using: `gameObject.on('pointerdown', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} - * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} - * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#GAMEOBJECT_POINTER_DOWN - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. - */ -module.exports = 'pointerdown'; + // This array is intentionally sparse. Do not adjust. + var fxHandlers = []; + fxHandlers[FX_CONST.GLOW] = this.onGlow; + fxHandlers[FX_CONST.SHADOW] = this.onShadow; + fxHandlers[FX_CONST.PIXELATE] = this.onPixelate; + fxHandlers[FX_CONST.VIGNETTE] = this.onVignette; + fxHandlers[FX_CONST.SHINE] = this.onShine; + fxHandlers[FX_CONST.BLUR] = this.onBlur; + fxHandlers[FX_CONST.GRADIENT] = this.onGradient; + fxHandlers[FX_CONST.BLOOM] = this.onBloom; + fxHandlers[FX_CONST.COLOR_MATRIX] = this.onColorMatrix; + fxHandlers[FX_CONST.CIRCLE] = this.onCircle; + fxHandlers[FX_CONST.BARREL] = this.onBarrel; + fxHandlers[FX_CONST.DISPLACEMENT] = this.onDisplacement; + fxHandlers[FX_CONST.WIPE] = this.onWipe; + fxHandlers[FX_CONST.BOKEH] = this.onBokeh; -/***/ }), -/* 945 */ -/***/ (function(module, exports) { + /** + * An array containing references to the methods that map to the FX CONSTs. + * + * This array is intentionally sparse. Do not adjust. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#fxHandlers + * @type {function[]} + * @since 3.60.0 + */ + this.fxHandlers = fxHandlers; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The source Render Target. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#source + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.60.0 + */ + this.source; -/** - * The Game Object Pointer Move Event. - * - * This event is dispatched by an interactive Game Object if a pointer is moved while over it. - * - * Listen to this event from a Game Object using: `gameObject.on('pointermove', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} - * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} - * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#GAMEOBJECT_POINTER_MOVE - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. - */ -module.exports = 'pointermove'; + /** + * The target Render Target. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#target + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.60.0 + */ + this.target; + /** + * The swap Render Target. + * + * @name Phaser.Renderer.WebGL.Pipelines.FXPipeline#swap + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.60.0 + */ + this.swap; + }, -/***/ }), -/* 946 */ -/***/ (function(module, exports) { + /** + * Takes the currently bound Game Object and runs all of its pre-render effects, + * using the given Render Target as the source. + * + * Finally calls `drawToGame` to copy the result to the Game Canvas. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onDraw + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} target1 - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} target2 - The target Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} target3 - The swap Render Target. + */ + onDraw: function (target1, target2, target3) + { + this.source = target1; + this.target = target2; + this.swap = target3; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var width = target1.width; + var height = target1.height; -/** - * The Game Object Pointer Out Event. - * - * This event is dispatched by an interactive Game Object if a pointer moves out of it. - * - * Listen to this event from a Game Object using: `gameObject.on('pointerout', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} - * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} - * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#GAMEOBJECT_POINTER_OUT - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. - */ -module.exports = 'pointerout'; + var sprite = this.tempSprite; + var handlers = this.fxHandlers; + if (sprite && sprite.preFX) + { + var fx = sprite.preFX.list; -/***/ }), -/* 947 */ -/***/ (function(module, exports) { + for (var i = 0; i < fx.length; i++) + { + var controller = fx[i]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (controller.active) + { + handlers[controller.type].call(this, controller, width, height); + } + } + } -/** - * The Game Object Pointer Over Event. - * - * This event is dispatched by an interactive Game Object if a pointer moves over it. - * - * Listen to this event from a Game Object using: `gameObject.on('pointerover', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} - * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} - * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#GAMEOBJECT_POINTER_OVER - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. - */ -module.exports = 'pointerover'; + this.drawToGame(this.source); + }, + /** + * Takes the source and target and runs a copy from source to target. + * + * This will use the current shader and pipeline. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#runDraw + * @since 3.60.0 + */ + runDraw: function () + { + var source = this.source; + var target = this.target; -/***/ }), -/* 948 */ -/***/ (function(module, exports) { + this.copy(source, target); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.source = target; + this.target = source; + }, -/** - * The Game Object Pointer Up Event. - * - * This event is dispatched by an interactive Game Object if a pointer is released while over it. - * - * Listen to this event from a Game Object using: `gameObject.on('pointerup', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} - * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} - * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#GAMEOBJECT_POINTER_UP - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {number} localX - The x coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {number} localY - The y coordinate that the Pointer interacted with this object on, relative to the Game Object's top-left position. - * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. - */ -module.exports = 'pointerup'; + /** + * Runs the Glow FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onGlow + * @since 3.60.0 + * + * @param {Phaser.FX.Glow} config - The Glow FX controller. + * @param {number} width - The width of the target. + * @param {number} height - The height of the target. + */ + onGlow: function (config, width, height) + { + var shader = this.shaders[FX_CONST.GLOW]; + this.setShader(shader); -/***/ }), -/* 949 */ -/***/ (function(module, exports) { + this.glow.onPreRender(config, shader, width, height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.runDraw(); + }, -/** - * The Game Object Pointer Wheel Event. - * - * This event is dispatched by an interactive Game Object if a pointer has its wheel moved while over it. - * - * Listen to this event from a Game Object using: `gameObject.on('wheel', listener)`. - * Note that the scope of the listener is automatically set to be the Game Object instance itself. - * - * To receive this event, the Game Object must have been set as interactive. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_WHEEL} - * 2. [GAMEOBJECT_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_WHEEL} - * 3. [POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:POINTER_WHEEL} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#GAMEOBJECT_POINTER_WHEEL - * @since 3.18.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {number} deltaX - The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device. - * @param {number} deltaY - The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device. This value will typically be less than 0 if the user scrolls up and greater than zero if scrolling down. - * @param {number} deltaZ - The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device. - * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. - */ -module.exports = 'wheel'; + /** + * Runs the Shadow FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onShadow + * @since 3.60.0 + * + * @param {Phaser.FX.Shadow} config - The Shadow FX controller. + */ + onShadow: function (config) + { + var shader = this.shaders[FX_CONST.SHADOW]; + this.setShader(shader); -/***/ }), -/* 950 */ -/***/ (function(module, exports) { + this.shadow.onPreRender(config, shader); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.runDraw(); + }, -/** - * The Game Object Up Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released while over _any_ interactive Game Object. - * - * Listen to this event from within a Scene using: `this.input.on('gameobjectup', listener)`. - * - * To receive this event, the Game Objects must have been set as interactive. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} event instead. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} - * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} - * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#GAMEOBJECT_UP - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was over when released. - * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. - */ -module.exports = 'gameobjectup'; + /** + * Runs the Pixelate FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onPixelate + * @since 3.60.0 + * + * @param {Phaser.FX.Pixelate} config - The Pixelate FX controller. + * @param {number} width - The width of the target. + * @param {number} height - The height of the target. + */ + onPixelate: function (config, width, height) + { + var shader = this.shaders[FX_CONST.PIXELATE]; + this.setShader(shader); -/***/ }), -/* 951 */ -/***/ (function(module, exports) { + this.pixelate.onPreRender(config, shader, width, height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.runDraw(); + }, -/** - * The Game Object Wheel Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer has its wheel moved while over _any_ interactive Game Object. - * - * Listen to this event from within a Scene using: `this.input.on('gameobjectwheel', listener)`. - * - * To receive this event, the Game Objects must have been set as interactive. - * See [GameObject.setInteractive]{@link Phaser.GameObjects.GameObject#setInteractive} for more details. - * - * To listen for this event from a _specific_ Game Object, use the [GAMEOBJECT_POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_WHEEL} event instead. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_WHEEL} - * 2. [GAMEOBJECT_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_WHEEL} - * 3. [POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:POINTER_WHEEL} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#GAMEOBJECT_WHEEL - * @since 3.18.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the pointer was over when the wheel changed. - * @param {number} deltaX - The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device. - * @param {number} deltaY - The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device. This value will typically be less than 0 if the user scrolls up and greater than zero if scrolling down. - * @param {number} deltaZ - The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device. - * @param {Phaser.Types.Input.EventData} event - The Phaser input event. You can call `stopPropagation()` to halt it from going any further in the event flow. - */ -module.exports = 'gameobjectwheel'; + /** + * Runs the Vignette FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onVignette + * @since 3.60.0 + * + * @param {Phaser.FX.Vignette} config - The Vignette FX controller. + */ + onVignette: function (config) + { + var shader = this.shaders[FX_CONST.VIGNETTE]; + this.setShader(shader); -/***/ }), -/* 952 */ -/***/ (function(module, exports) { + this.vignette.onPreRender(config, shader); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.runDraw(); + }, -/** - * The Input Manager Boot Event. - * - * This internal event is dispatched by the Input Manager when it boots. - * - * @event Phaser.Input.Events#MANAGER_BOOT - * @since 3.0.0 - */ -module.exports = 'boot'; + /** + * Runs the Shine FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onShine + * @since 3.60.0 + * + * @param {Phaser.FX.Shine} config - The Shine FX controller. + * @param {number} width - The width of the target. + * @param {number} height - The height of the target. + */ + onShine: function (config, width, height) + { + var shader = this.shaders[FX_CONST.SHINE]; + this.setShader(shader); -/***/ }), -/* 953 */ -/***/ (function(module, exports) { + this.shine.onPreRender(config, shader, width, height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.runDraw(); + }, -/** - * The Input Manager Process Event. - * - * This internal event is dispatched by the Input Manager when not using the legacy queue system, - * and it wants the Input Plugins to update themselves. - * - * @event Phaser.Input.Events#MANAGER_PROCESS - * @since 3.0.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ -module.exports = 'process'; + /** + * Runs the Blur FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onBlur + * @since 3.60.0 + * + * @param {Phaser.FX.Blur} config - The Blur FX controller. + * @param {number} width - The width of the target. + * @param {number} height - The height of the target. + */ + onBlur: function (config, width, height) + { + var quality = GetFastValue(config, 'quality'); + var shader = this.shaders[FX_CONST.BLUR + quality]; -/***/ }), -/* 954 */ -/***/ (function(module, exports) { + this.setShader(shader); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.set1i('uMainSampler', 0); + this.set2f('resolution', width, height); + this.set1f('strength', GetFastValue(config, 'strength')); + this.set3fv('color', GetFastValue(config, 'glcolor')); -/** - * The Input Manager Update Event. - * - * This internal event is dispatched by the Input Manager as part of its update step. - * - * @event Phaser.Input.Events#MANAGER_UPDATE - * @since 3.0.0 - */ -module.exports = 'update'; + var x = GetFastValue(config, 'x'); + var y = GetFastValue(config, 'y'); + var steps = GetFastValue(config, 'steps'); + for (var i = 0; i < steps; i++) + { + this.set2f('offset', x, 0); + this.runDraw(); -/***/ }), -/* 955 */ -/***/ (function(module, exports) { + this.set2f('offset', 0, y); + this.runDraw(); + } + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Runs the Gradient FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onGradient + * @since 3.60.0 + * + * @param {Phaser.FX.Gradient} config - The Gradient FX controller. + */ + onGradient: function (config) + { + var shader = this.shaders[FX_CONST.GRADIENT]; -/** - * The Pointer Down Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down anywhere. - * - * Listen to this event from within a Scene using: `this.input.on('pointerdown', listener)`. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} - * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} - * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#POINTER_DOWN - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. - */ -module.exports = 'pointerdown'; + this.setShader(shader); + this.gradient.onPreRender(config, shader); -/***/ }), -/* 956 */ -/***/ (function(module, exports) { + this.runDraw(); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Runs the Bloom FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onBloom + * @since 3.60.0 + * + * @param {Phaser.FX.Bloom} config - The Bloom FX controller. + * @param {number} width - The width of the target. + * @param {number} height - The height of the target. + */ + onBloom: function (config, width, height) + { + var shader = this.shaders[FX_CONST.BLOOM]; -/** - * The Pointer Down Outside Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is pressed down anywhere outside of the game canvas. - * - * Listen to this event from within a Scene using: `this.input.on('pointerdownoutside', listener)`. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_DOWN} - * 2. [GAMEOBJECT_DOWN]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_DOWN} - * 3. [POINTER_DOWN]{@linkcode Phaser.Input.Events#event:POINTER_DOWN} or [POINTER_DOWN_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_DOWN_OUTSIDE} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#POINTER_DOWN_OUTSIDE - * @since 3.16.1 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - */ -module.exports = 'pointerdownoutside'; + this.copySprite(this.source, this.swap); + this.setShader(shader); -/***/ }), -/* 957 */ -/***/ (function(module, exports) { + this.set1i('uMainSampler', 0); + this.set1f('strength', GetFastValue(config, 'blurStrength')); + this.set3fv('color', GetFastValue(config, 'glcolor')); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var x = (2 / width) * GetFastValue(config, 'offsetX'); + var y = (2 / height) * GetFastValue(config, 'offsetY'); + var steps = GetFastValue(config, 'steps'); -/** - * The Pointer Move Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is moved anywhere. - * - * Listen to this event from within a Scene using: `this.input.on('pointermove', listener)`. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_MOVE} - * 2. [GAMEOBJECT_MOVE]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_MOVE} - * 3. [POINTER_MOVE]{@linkcode Phaser.Input.Events#event:POINTER_MOVE} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#POINTER_MOVE - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. - */ -module.exports = 'pointermove'; + for (var i = 0; i < steps; i++) + { + this.set2f('offset', x, 0); + this.runDraw(); + this.set2f('offset', 0, y); + this.runDraw(); + } -/***/ }), -/* 958 */ -/***/ (function(module, exports) { + this.blendFrames(this.swap, this.source, this.target, GetFastValue(config, 'strength')); + this.copySprite(this.target, this.source); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Runs the ColorMatrix FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onColorMatrix + * @since 3.60.0 + * + * @param {Phaser.FX.ColorMatrix} config - The ColorMatrix FX controller. + */ + onColorMatrix: function (config) + { + this.setShader(this.colorMatrixShader); -/** - * The Pointer Out Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves out of any interactive Game Object. - * - * Listen to this event from within a Scene using: `this.input.on('pointerout', listener)`. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OUT} - * 2. [GAMEOBJECT_OUT]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OUT} - * 3. [POINTER_OUT]{@linkcode Phaser.Input.Events#event:POINTER_OUT} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#POINTER_OUT - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject[]} justOut - An array containing all interactive Game Objects that the pointer moved out of when the event was created. - */ -module.exports = 'pointerout'; + this.set1fv('uColorMatrix', config.getData()); + this.set1f('uAlpha', config.alpha); + this.runDraw(); + }, -/***/ }), -/* 959 */ -/***/ (function(module, exports) { + /** + * Runs the Circle FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onCircle + * @since 3.60.0 + * + * @param {Phaser.FX.Circle} config - The Circle FX controller. + * @param {number} width - The width of the target. + * @param {number} height - The height of the target. + */ + onCircle: function (config, width, height) + { + var shader = this.shaders[FX_CONST.CIRCLE]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.setShader(shader); -/** - * The Pointer Over Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer moves over any interactive Game Object. - * - * Listen to this event from within a Scene using: `this.input.on('pointerover', listener)`. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_OVER} - * 2. [GAMEOBJECT_OVER]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_OVER} - * 3. [POINTER_OVER]{@linkcode Phaser.Input.Events#event:POINTER_OVER} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#POINTER_OVER - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject[]} justOver - An array containing all interactive Game Objects that the pointer moved over when the event was created. - */ -module.exports = 'pointerover'; + this.circle.onPreRender(config, shader, width, height); + this.runDraw(); + }, -/***/ }), -/* 960 */ -/***/ (function(module, exports) { + /** + * Runs the Barrel FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onBarrel + * @since 3.60.0 + * + * @param {Phaser.FX.Barrel} config - The Barrel FX controller. + */ + onBarrel: function (config) + { + var shader = this.shaders[FX_CONST.BARREL]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.setShader(shader); -/** - * The Pointer Up Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released anywhere. - * - * Listen to this event from within a Scene using: `this.input.on('pointerup', listener)`. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} - * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} - * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#POINTER_UP - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. - */ -module.exports = 'pointerup'; + this.barrel.onPreRender(config, shader); + this.runDraw(); + }, -/***/ }), -/* 961 */ -/***/ (function(module, exports) { + /** + * Runs the Displacement FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onDisplacement + * @since 3.60.0 + * + * @param {Phaser.FX.Displacement} config - The Displacement FX controller. + */ + onDisplacement: function (config) + { + this.setShader(this.shaders[FX_CONST.DISPLACEMENT]); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.set1i('uDisplacementSampler', 1); + this.set2f('amount', config.x, config.y); -/** - * The Pointer Up Outside Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer is released anywhere outside of the game canvas. - * - * Listen to this event from within a Scene using: `this.input.on('pointerupoutside', listener)`. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_UP} - * 2. [GAMEOBJECT_UP]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_UP} - * 3. [POINTER_UP]{@linkcode Phaser.Input.Events#event:POINTER_UP} or [POINTER_UP_OUTSIDE]{@linkcode Phaser.Input.Events#event:POINTER_UP_OUTSIDE} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#POINTER_UP_OUTSIDE - * @since 3.16.1 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - */ -module.exports = 'pointerupoutside'; + this.bindTexture(config.glTexture, 1); + this.runDraw(); + }, -/***/ }), -/* 962 */ -/***/ (function(module, exports) { + /** + * Runs the Wipe FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onWipe + * @since 3.60.0 + * + * @param {Phaser.FX.Wipe} config - The Wipe FX controller. + */ + onWipe: function (config) + { + var shader = this.shaders[FX_CONST.WIPE]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.setShader(shader); -/** - * The Pointer Wheel Input Event. - * - * This event is dispatched by the Input Plugin belonging to a Scene if a pointer has its wheel updated. - * - * Listen to this event from within a Scene using: `this.input.on('wheel', listener)`. - * - * The event hierarchy is as follows: - * - * 1. [GAMEOBJECT_POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_POINTER_WHEEL} - * 2. [GAMEOBJECT_WHEEL]{@linkcode Phaser.Input.Events#event:GAMEOBJECT_WHEEL} - * 3. [POINTER_WHEEL]{@linkcode Phaser.Input.Events#event:POINTER_WHEEL} - * - * With the top event being dispatched first and then flowing down the list. Note that higher-up event handlers can stop - * the propagation of this event. - * - * @event Phaser.Input.Events#POINTER_WHEEL - * @since 3.18.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer responsible for triggering this event. - * @param {Phaser.GameObjects.GameObject[]} currentlyOver - An array containing all interactive Game Objects that the pointer was over when the event was created. - * @param {number} deltaX - The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device. - * @param {number} deltaY - The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device. This value will typically be less than 0 if the user scrolls up and greater than zero if scrolling down. - * @param {number} deltaZ - The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device. - */ -module.exports = 'wheel'; + this.wipe.onPreRender(config, shader); + this.runDraw(); + }, -/***/ }), -/* 963 */ -/***/ (function(module, exports) { + /** + * Runs the Bokeh FX controller. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#onBokeh + * @since 3.60.0 + * + * @param {Phaser.FX.Bokeh} config - The Bokeh FX controller. + */ + onBokeh: function (config, width, height) + { + var shader = this.shaders[FX_CONST.BOKEH]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.setShader(shader); -/** - * The Input Manager Pointer Lock Change Event. - * - * This event is dispatched by the Input Manager when it is processing a native Pointer Lock Change DOM Event. - * - * @event Phaser.Input.Events#POINTERLOCK_CHANGE - * @since 3.0.0 - * - * @param {Event} event - The native DOM Event. - * @param {boolean} locked - The locked state of the Mouse Pointer. - */ -module.exports = 'pointerlockchange'; + this.bokeh.onPreRender(config, shader, width, height); + this.runDraw(); + }, -/***/ }), -/* 964 */ -/***/ (function(module, exports) { + /** + * Destroys all shader instances, removes all object references and nulls all external references. + * + * @method Phaser.Renderer.WebGL.Pipelines.FXPipeline#destroy + * @since 3.60.0 + * + * @return {this} This WebGLPipeline instance. + */ + destroy: function () + { + this.glow.destroy(); + this.shadow.destroy(); + this.pixelate.destroy(); + this.vignette.destroy(); + this.shine.destroy(); + this.gradient.destroy(); + this.circle.destroy(); + this.barrel.destroy(); + this.wipe.destroy(); + this.bokeh.destroy(); + + this.fxHandlers = null; + this.source = null; + this.target = null; + this.swap = null; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + PreFXPipeline.prototype.destroy.call(this); -/** - * The Input Plugin Pre-Update Event. - * - * This internal event is dispatched by the Input Plugin at the start of its `preUpdate` method. - * This hook is designed specifically for input plugins, but can also be listened to from user-land code. - * - * @event Phaser.Input.Events#PRE_UPDATE - * @since 3.0.0 - */ -module.exports = 'preupdate'; + return this; + } +}); + +module.exports = FXPipeline; /***/ }), -/* 965 */ -/***/ (function(module, exports) { + +/***/ 66901: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var GetFastValue = __webpack_require__(72632); +var LightShaderSourceFS = __webpack_require__(65045); +var MultiPipeline = __webpack_require__(77310); +var TransformMatrix = __webpack_require__(69360); +var Vec2 = __webpack_require__(93736); +var WebGLPipeline = __webpack_require__(44775); + /** - * The Input Plugin Shutdown Event. - * - * This internal event is dispatched by the Input Plugin when it shuts down, signalling to all of its systems to shut themselves down. + * @classdesc + * The Light Pipeline is an extension of the Multi Pipeline and uses a custom shader + * designed to handle forward diffused rendering of 2D lights in a Scene. * - * @event Phaser.Input.Events#SHUTDOWN - * @since 3.0.0 + * The shader works in tandem with Light Game Objects, and optionally texture normal maps, + * to provide an ambient illumination effect. + * + * If you wish to provide your own shader, you can use the `%LIGHT_COUNT%` declaration in the source, + * and it will be automatically replaced at run-time with the total number of configured lights. + * + * The maximum number of lights can be set in the Render Config `maxLights` property and defaults to 10. + * + * Prior to Phaser v3.50 this pipeline was called the `ForwardDiffuseLightPipeline`. + * + * The fragment shader it uses can be found in `shaders/src/Light.frag`. + * The vertex shader it uses can be found in `shaders/src/Multi.vert`. + * + * The default shader attributes for this pipeline are: + * + * `inPosition` (vec2, offset 0) + * `inTexCoord` (vec2, offset 8) + * `inTexId` (float, offset 16) + * `inTintEffect` (float, offset 20) + * `inTint` (vec4, offset 24, normalized) + * + * The default shader uniforms for this pipeline are those from the Multi Pipeline, plus: + * + * `uMainSampler` (sampler2D) + * `uNormSampler` (sampler2D) + * `uCamera` (vec4) + * `uResolution` (vec2) + * `uAmbientLightColor` (vec3) + * `uInverseRotationMatrix` (mat3) + * `uLights` (Light struct) + * + * @class LightPipeline + * @extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. */ -module.exports = 'shutdown'; +var LightPipeline = new Class({ + Extends: MultiPipeline, -/***/ }), -/* 966 */ -/***/ (function(module, exports) { + initialize: -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + function LightPipeline (config) + { + var fragShader = GetFastValue(config, 'fragShader', LightShaderSourceFS); -/** - * The Input Plugin Start Event. - * - * This internal event is dispatched by the Input Plugin when it has finished setting-up, - * signalling to all of its internal systems to start. - * - * @event Phaser.Input.Events#START - * @since 3.0.0 - */ -module.exports = 'start'; + config.fragShader = fragShader.replace('%LIGHT_COUNT%', config.game.renderer.config.maxLights); + MultiPipeline.call(this, config); -/***/ }), -/* 967 */ -/***/ (function(module, exports) { + /** + * Inverse rotation matrix for normal map rotations. + * + * @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#inverseRotationMatrix + * @type {Float32Array} + * @private + * @since 3.16.0 + */ + this.inverseRotationMatrix = new Float32Array([ + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 + ]); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Stores a default normal map, which is an object with a `glTexture` property that + * maps to a 1x1 texture of the color #7f7fff created in the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#defaultNormalMap + * @type {object} + * @since 3.50.0 + */ + this.defaultNormalMap; -/** - * The Input Plugin Update Event. - * - * This internal event is dispatched by the Input Plugin at the start of its `update` method. - * This hook is designed specifically for input plugins, but can also be listened to from user-land code. - * - * @event Phaser.Input.Events#UPDATE - * @since 3.0.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ -module.exports = 'update'; + /** + * The currently bound normal map texture at texture unit one, if any. + * + * @name Phaser.Renderer.WebGL.WebGLRenderer#currentNormalMap; + * @type {?WebGLTexture} + * @since 3.60.0 + */ + this.currentNormalMap; + + /** + * A boolean that is set automatically during `onRender` that determines + * if the Scene LightManager is active, or not. + * + * @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#lightsActive + * @type {boolean} + * @readonly + * @since 3.53.0 + */ + this.lightsActive = true; + /** + * A persistent calculation vector used when processing the lights. + * + * @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#tempVec2 + * @type {Phaser.Math.Vector2} + * @since 3.60.0 + */ + this.tempVec2 = new Vec2(); -/***/ }), -/* 968 */ -/***/ (function(module, exports) { + /** + * A temporary Transform Matrix used for parent Container calculations without them needing their own local copy. + * + * @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#_tempMatrix + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @private + * @since 3.60.0 + */ + this._tempMatrix = new TransformMatrix(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A temporary Transform Matrix used for parent Container calculations without them needing their own local copy. + * + * @name Phaser.Renderer.WebGL.Pipelines.LightPipeline#_tempMatrix2 + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @private + * @since 3.60.0 + */ + this._tempMatrix2 = new TransformMatrix(); + }, -/** - * The Loader Plugin Add File Event. - * - * This event is dispatched when a new file is successfully added to the Loader and placed into the load queue. - * - * Listen to it from a Scene using: `this.load.on('addfile', listener)`. - * - * If you add lots of files to a Loader from a `preload` method, it will dispatch this event for each one of them. - * - * @event Phaser.Loader.Events#ADD - * @since 3.0.0 - * - * @param {string} key - The unique key of the file that was added to the Loader. - * @param {string} type - The [file type]{@link Phaser.Loader.File#type} string of the file that was added to the Loader, i.e. `image`. - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. - * @param {Phaser.Loader.File} file - A reference to the File which was added to the Loader. - */ -module.exports = 'addfile'; + /** + * Called when the Game has fully booted and the Renderer has finished setting up. + * + * By this stage all Game level systems are now in place and you can perform any final + * tasks that the pipeline may need that relied on game systems such as the Texture Manager. + * + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#boot + * @since 3.11.0 + */ + boot: function () + { + WebGLPipeline.prototype.boot.call(this); + var gl = this.gl; -/***/ }), -/* 969 */ -/***/ (function(module, exports) { + var tempTexture = gl.createTexture(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + gl.activeTexture(gl.TEXTURE0); -/** - * The Loader Plugin Complete Event. - * - * This event is dispatched when the Loader has fully processed everything in the load queue. - * By this point every loaded file will now be in its associated cache and ready for use. - * - * Listen to it from a Scene using: `this.load.on('complete', listener)`. - * - * @event Phaser.Loader.Events#COMPLETE - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. - * @param {number} totalComplete - The total number of files that successfully loaded. - * @param {number} totalFailed - The total number of files that failed to load. - */ -module.exports = 'complete'; + gl.bindTexture(gl.TEXTURE_2D, tempTexture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([ 127, 127, 255, 255 ])); -/***/ }), -/* 970 */ -/***/ (function(module, exports) { + this.defaultNormalMap = { glTexture: tempTexture }; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * This function sets all the needed resources for each camera pass. + * + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#onRender + * @ignore + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene being rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Scene Camera being rendered with. + */ + onRender: function (scene, camera) + { + var lightManager = scene.sys.lights; -/** - * The File Load Complete Event. - * - * This event is dispatched by the Loader Plugin when any file in the queue finishes loading. - * - * Listen to it from a Scene using: `this.load.on('filecomplete', listener)`. - * - * You can also listen for the completion of a specific file. See the [FILE_KEY_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_KEY_COMPLETE} event. - * - * @event Phaser.Loader.Events#FILE_COMPLETE - * @since 3.0.0 - * - * @param {string} key - The key of the file that just loaded and finished processing. - * @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`. - * @param {any} data - The raw data the file contained. - */ -module.exports = 'filecomplete'; + this.lightsActive = false; + if (!lightManager || !lightManager.active) + { + return; + } -/***/ }), -/* 971 */ -/***/ (function(module, exports) { + var lights = lightManager.getLights(camera); + var lightsCount = lights.length; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Ok, we're good to go ... -/** - * The File Load Complete Event. - * - * This event is dispatched by the Loader Plugin when any file in the queue finishes loading. - * - * It uses a special dynamic event name constructed from the key and type of the file. - * - * For example, if you have loaded an `image` with a key of `monster`, you can listen for it - * using the following: - * - * ```javascript - * this.load.on('filecomplete-image-monster', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * Or, if you have loaded a texture `atlas` with a key of `Level1`: - * - * ```javascript - * this.load.on('filecomplete-atlas-Level1', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`: - * - * ```javascript - * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) { - * // Your handler code - * }); - * ``` - * - * You can also listen for the generic completion of files. See the [FILE_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_COMPLETE} event. - * - * @event Phaser.Loader.Events#FILE_KEY_COMPLETE - * @since 3.0.0 - * - * @param {string} key - The key of the file that just loaded and finished processing. - * @param {string} type - The [file type]{@link Phaser.Loader.File#type} of the file that just loaded, i.e. `image`. - * @param {any} data - The raw data the file contained. - */ -module.exports = 'filecomplete-'; + this.lightsActive = true; + var i; + var renderer = this.renderer; + var height = renderer.height; + var cameraMatrix = camera.matrix; + var tempVec2 = this.tempVec2; -/***/ }), -/* 972 */ -/***/ (function(module, exports) { + this.set1i('uMainSampler', 0); + this.set1i('uNormSampler', 1); + this.set2f('uResolution', this.width / 2, this.height / 2); + this.set4f('uCamera', camera.x, camera.y, camera.rotation, camera.zoom); + this.set3f('uAmbientLightColor', lightManager.ambientColor.r, lightManager.ambientColor.g, lightManager.ambientColor.b); + this.set1i('uLightCount', lightsCount); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (i = 0; i < lightsCount; i++) + { + var light = lights[i].light; + var color = light.color; -/** - * The File Load Error Event. - * - * This event is dispatched by the Loader Plugin when a file fails to load. - * - * Listen to it from a Scene using: `this.load.on('loaderror', listener)`. - * - * @event Phaser.Loader.Events#FILE_LOAD_ERROR - * @since 3.0.0 - * - * @param {Phaser.Loader.File} file - A reference to the File which errored during load. - */ -module.exports = 'loaderror'; + var lightName = 'uLights[' + i + '].'; + cameraMatrix.transformPoint(light.x, light.y, tempVec2); -/***/ }), -/* 973 */ -/***/ (function(module, exports) { + this.set2f(lightName + 'position', tempVec2.x - (camera.scrollX * light.scrollFactorX * camera.zoom), height - (tempVec2.y - (camera.scrollY * light.scrollFactorY) * camera.zoom)); + this.set3f(lightName + 'color', color.r, color.g, color.b); + this.set1f(lightName + 'intensity', light.intensity); + this.set1f(lightName + 'radius', light.radius); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.currentNormalMapRotation = null; + }, + + /** + * Rotates the normal map vectors inversely by the given angle. + * Only works in 2D space. + * + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#setNormalMapRotation + * @since 3.16.0 + * + * @param {number} rotation - The angle of rotation in radians. + */ + setNormalMapRotation: function (rotation) + { + if (rotation !== this.currentNormalMapRotation || this.vertexCount === 0) + { + if (this.vertexCount > 0) + { + this.flush(); + } + + var inverseRotationMatrix = this.inverseRotationMatrix; + + if (rotation) + { + var rot = -rotation; + var c = Math.cos(rot); + var s = Math.sin(rot); + + inverseRotationMatrix[1] = s; + inverseRotationMatrix[3] = -s; + inverseRotationMatrix[0] = inverseRotationMatrix[4] = c; + } + else + { + inverseRotationMatrix[0] = inverseRotationMatrix[4] = 1; + inverseRotationMatrix[1] = inverseRotationMatrix[3] = 0; + } + + this.setMatrix3fv('uInverseRotationMatrix', false, inverseRotationMatrix); -/** - * The File Load Event. - * - * This event is dispatched by the Loader Plugin when a file finishes loading, - * but _before_ it is processed and added to the internal Phaser caches. - * - * Listen to it from a Scene using: `this.load.on('load', listener)`. - * - * @event Phaser.Loader.Events#FILE_LOAD - * @since 3.0.0 - * - * @param {Phaser.Loader.File} file - A reference to the File which just finished loading. - */ -module.exports = 'load'; + this.currentNormalMapRotation = rotation; + } + }, + /** + * Assigns a texture to the current batch. If a different texture is already set it creates a new batch object. + * + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#setTexture2D + * @ignore + * @since 3.50.0 + * + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch. If not given uses blankTexture. + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object being rendered or added to the batch. + */ + setTexture2D: function (texture, gameObject) + { + var renderer = this.renderer; -/***/ }), -/* 974 */ -/***/ (function(module, exports) { + if (texture === undefined) { texture = renderer.whiteTexture; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var normalMap = this.getNormalMap(gameObject); -/** - * The File Load Progress Event. - * - * This event is dispatched by the Loader Plugin during the load of a file, if the browser receives a DOM ProgressEvent and - * the `lengthComputable` event property is true. Depending on the size of the file and browser in use, this may, or may not happen. - * - * Listen to it from a Scene using: `this.load.on('fileprogress', listener)`. - * - * @event Phaser.Loader.Events#FILE_PROGRESS - * @since 3.0.0 - * - * @param {Phaser.Loader.File} file - A reference to the File which errored during load. - * @param {number} percentComplete - A value between 0 and 1 indicating how 'complete' this file is. - */ -module.exports = 'fileprogress'; + if (this.isNewNormalMap(texture, normalMap)) + { + this.flush(); + this.createBatch(texture); -/***/ }), -/* 975 */ -/***/ (function(module, exports) { + this.addTextureToBatch(normalMap); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.currentNormalMap = normalMap; + } -/** - * The Loader Plugin Post Process Event. - * - * This event is dispatched by the Loader Plugin when the Loader has finished loading everything in the load queue. - * It is dispatched before the internal lists are cleared and each File is destroyed. - * - * Use this hook to perform any last minute processing of files that can only happen once the - * Loader has completed, but prior to it emitting the `complete` event. - * - * Listen to it from a Scene using: `this.load.on('postprocess', listener)`. - * - * @event Phaser.Loader.Events#POST_PROCESS - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. - */ -module.exports = 'postprocess'; + var rotation = 0; + if (gameObject && gameObject.parentContainer) + { + var matrix = gameObject.getWorldTransformMatrix(this._tempMatrix, this._tempMatrix2); -/***/ }), -/* 976 */ -/***/ (function(module, exports) { + rotation = matrix.rotationNormalized; + } + else if (gameObject) + { + rotation = gameObject.rotation; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.setNormalMapRotation(rotation); -/** - * The Loader Plugin Progress Event. - * - * This event is dispatched when the Loader updates its load progress, typically as a result of a file having completed loading. - * - * Listen to it from a Scene using: `this.load.on('progress', listener)`. - * - * @event Phaser.Loader.Events#PROGRESS - * @since 3.0.0 - * - * @param {number} progress - The current progress of the load. A value between 0 and 1. - */ -module.exports = 'progress'; + return 0; + }, + /** + * Custom pipelines can use this method in order to perform any required pre-batch tasks + * for the given Game Object. It must return the texture unit the Game Object was assigned. + * + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#setGameObject + * @ignore + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object being rendered or added to the batch. + * @param {Phaser.Textures.Frame} [frame] - Optional frame to use. Can override that of the Game Object. + * + * @return {number} The texture unit the Game Object has been assigned. + */ + setGameObject: function (gameObject, frame) + { + if (frame === undefined) { frame = gameObject.frame; } -/***/ }), -/* 977 */ -/***/ (function(module, exports) { + var texture = frame.glTexture; + var normalMap = this.getNormalMap(gameObject); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.isNewNormalMap(texture, normalMap)) + { + this.flush(); -/** - * The Loader Plugin Start Event. - * - * This event is dispatched when the Loader starts running. At this point load progress is zero. - * - * This event is dispatched even if there aren't any files in the load queue. - * - * Listen to it from a Scene using: `this.load.on('start', listener)`. - * - * @event Phaser.Loader.Events#START - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader Plugin that dispatched this event. - */ -module.exports = 'start'; + this.createBatch(texture); + this.addTextureToBatch(normalMap); -/***/ }), -/* 978 */ -/***/ (function(module, exports, __webpack_require__) { + this.currentNormalMap = normalMap; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (gameObject.parentContainer) + { + var matrix = gameObject.getWorldTransformMatrix(this._tempMatrix, this._tempMatrix2); -// These properties get injected into the Scene and map to local systems -// The map value is the property that is injected into the Scene, the key is the Scene.Systems reference. -// These defaults can be modified via the Scene config object -// var config = { -// map: { -// add: 'makeStuff', -// load: 'loader' -// } -// }; + this.setNormalMapRotation(matrix.rotationNormalized); + } + else + { + this.setNormalMapRotation(gameObject.rotation); + } -var InjectionMap = { + return 0; + }, - game: 'game', - renderer: 'renderer', + /** + * Checks to see if the given diffuse and normal map textures are already bound, or not. + * + * @method Phaser.Renderer.WebGL.WebGLRenderer#isNewNormalMap + * @since 3.50.0 + * + * @param {WebGLTexture} texture - The WebGL diffuse texture. + * @param {WebGLTexture} normalMap - The WebGL normal map texture. + * + * @return {boolean} Returns `false` if this combination is already set, or `true` if it's a new combination. + */ + isNewNormalMap: function (texture, normalMap) + { + return (this.currentTexture !== texture || this.currentNormalMap !== normalMap); + }, - anims: 'anims', - cache: 'cache', - plugins: 'plugins', - registry: 'registry', - scale: 'scale', - sound: 'sound', - textures: 'textures', + /** + * Returns the normal map WebGLTexture from the given Game Object. + * If the Game Object doesn't have one, it returns the default normal map from this pipeline instead. + * + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#getNormalMap + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} [gameObject] - The Game Object to get the normal map from. + * + * @return {WebGLTexture} The normal map texture. + */ + getNormalMap: function (gameObject) + { + var normalMap; - events: 'events', - cameras: 'cameras', - add: 'add', - make: 'make', - scenePlugin: 'scene', - displayList: 'children', - lights: 'lights', + if (!gameObject) + { + normalMap = this.defaultNormalMap; + } + else if (gameObject.displayTexture) + { + normalMap = gameObject.displayTexture.dataSource[gameObject.displayFrame.sourceIndex]; + } + else if (gameObject.texture) + { + normalMap = gameObject.texture.dataSource[gameObject.frame.sourceIndex]; + } + else if (gameObject.tileset) + { + if (Array.isArray(gameObject.tileset)) + { + normalMap = gameObject.tileset[0].image.dataSource[0]; + } + else + { + normalMap = gameObject.tileset.image.dataSource[0]; + } + } - data: 'data', - input: 'input', - load: 'load', - time: 'time', - tweens: 'tweens', + if (!normalMap) + { + normalMap = this.defaultNormalMap; + } - arcadePhysics: 'physics', - impactPhysics: 'impact', - matterPhysics: 'matter' + return normalMap.glTexture; + }, -}; + /** + * Takes a Sprite Game Object, or any object that extends it, and adds it to the batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#batchSprite + * @since 3.50.0 + * + * @param {(Phaser.GameObjects.Image|Phaser.GameObjects.Sprite)} gameObject - The texture based Game Object to add to the batch. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set. + */ + batchSprite: function (gameObject, camera, parentTransformMatrix) + { + if (this.lightsActive) + { + MultiPipeline.prototype.batchSprite.call(this, gameObject, camera, parentTransformMatrix); + } + }, -if (false) -{} + /** + * Generic function for batching a textured quad using argument values instead of a Game Object. + * + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#batchTexture + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject. + * @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad. + * @param {number} textureWidth - Real texture width. + * @param {number} textureHeight - Real texture height. + * @param {number} srcX - X coordinate of the quad. + * @param {number} srcY - Y coordinate of the quad. + * @param {number} srcWidth - Width of the quad. + * @param {number} srcHeight - Height of the quad. + * @param {number} scaleX - X component of scale. + * @param {number} scaleY - Y component of scale. + * @param {number} rotation - Rotation of the quad. + * @param {boolean} flipX - Indicates if the quad is horizontally flipped. + * @param {boolean} flipY - Indicates if the quad is vertically flipped. + * @param {number} scrollFactorX - By which factor is the quad affected by the camera horizontal scroll. + * @param {number} scrollFactorY - By which factor is the quad effected by the camera vertical scroll. + * @param {number} displayOriginX - Horizontal origin in pixels. + * @param {number} displayOriginY - Vertical origin in pixels. + * @param {number} frameX - X coordinate of the texture frame. + * @param {number} frameY - Y coordinate of the texture frame. + * @param {number} frameWidth - Width of the texture frame. + * @param {number} frameHeight - Height of the texture frame. + * @param {number} tintTL - Tint for top left. + * @param {number} tintTR - Tint for top right. + * @param {number} tintBL - Tint for bottom left. + * @param {number} tintBR - Tint for bottom right. + * @param {number} tintEffect - The tint effect. + * @param {number} uOffset - Horizontal offset on texture coordinate. + * @param {number} vOffset - Vertical offset on texture coordinate. + * @param {Phaser.Cameras.Scene2D.Camera} camera - Current used camera. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - Parent container. + * @param {boolean} [skipFlip=false] - Skip the renderTexture check. + * @param {number} [textureUnit] - Use the currently bound texture unit? + */ + batchTexture: function ( + gameObject, + texture, + textureWidth, textureHeight, + srcX, srcY, + srcWidth, srcHeight, + scaleX, scaleY, + rotation, + flipX, flipY, + scrollFactorX, scrollFactorY, + displayOriginX, displayOriginY, + frameX, frameY, frameWidth, frameHeight, + tintTL, tintTR, tintBL, tintBR, tintEffect, + uOffset, vOffset, + camera, + parentTransformMatrix, + skipFlip, + textureUnit) + { + if (this.lightsActive) + { + MultiPipeline.prototype.batchTexture.call( + this, + gameObject, + texture, + textureWidth, textureHeight, + srcX, srcY, + srcWidth, srcHeight, + scaleX, scaleY, + rotation, + flipX, flipY, + scrollFactorX, scrollFactorY, + displayOriginX, displayOriginY, + frameX, frameY, frameWidth, frameHeight, + tintTL, tintTR, tintBL, tintBR, tintEffect, + uOffset, vOffset, + camera, + parentTransformMatrix, + skipFlip, + textureUnit + ); + } + }, -if (false) -{} + /** + * Adds a Texture Frame into the batch for rendering. + * + * @method Phaser.Renderer.WebGL.Pipelines.LightPipeline#batchTextureFrame + * @since 3.50.0 + * + * @param {Phaser.Textures.Frame} frame - The Texture Frame to be rendered. + * @param {number} x - The horizontal position to render the texture at. + * @param {number} y - The vertical position to render the texture at. + * @param {number} tint - The tint color. + * @param {number} alpha - The alpha value. + * @param {Phaser.GameObjects.Components.TransformMatrix} transformMatrix - The Transform Matrix to use for the texture. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - A parent Transform Matrix. + */ + batchTextureFrame: function ( + frame, + x, y, + tint, alpha, + transformMatrix, + parentTransformMatrix + ) + { + if (this.lightsActive) + { + MultiPipeline.prototype.batchTextureFrame.call( + this, + frame, + x, y, + tint, alpha, + transformMatrix, + parentTransformMatrix + ); + } + } -module.exports = InjectionMap; +}); + +module.exports = LightPipeline; /***/ }), -/* 979 */ -/***/ (function(module, exports) { + +/***/ 71264: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var GetFastValue = __webpack_require__(72632); +var MultiPipeline = __webpack_require__(77310); +var ShaderSourceFS = __webpack_require__(85060); +var ShaderSourceVS = __webpack_require__(18166); +var WEBGL_CONST = __webpack_require__(71402); +var WebGLPipeline = __webpack_require__(44775); + /** - * Parses an XML Texture Atlas object and adds all the Frames into a Texture. + * @classdesc + * The Mobile Pipeline is the core 2D texture rendering pipeline used by Phaser in WebGL + * when the device running the game is detected to be a mobile. * - * @function Phaser.Textures.Parsers.AtlasXML - * @memberof Phaser.Textures.Parsers - * @private - * @since 3.7.0 + * You can control the use of this pipeline by setting the Game Configuration + * property `autoMobilePipeline`. If set to `false` then all devices will use + * the Multi Tint Pipeline. You can also call the `PipelineManager.setDefaultPipeline` + * method at run-time, rather than boot-time, to modify the default Game Object + * pipeline. * - * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {number} sourceIndex - The index of the TextureSource. - * @param {*} xml - The XML data. + * Virtually all Game Objects use this pipeline by default, including Sprites, Graphics + * and Tilemaps. It handles the batching of quads and tris, as well as methods for + * drawing and batching geometry data. * - * @return {Phaser.Textures.Texture} The Texture modified by this parser. + * The fragment shader it uses can be found in `shaders/src/Mobile.frag`. + * The vertex shader it uses can be found in `shaders/src/Mobile.vert`. + * + * The default shader attributes for this pipeline are: + * + * `inPosition` (vec2, offset 0) + * `inTexCoord` (vec2, offset 8) + * `inTexId` (float, offset 16) + * `inTintEffect` (float, offset 20) + * `inTint` (vec4, offset 24, normalized) + * + * Note that `inTexId` isn't used in the shader, it's just kept to allow us + * to piggy-back on the Multi Tint Pipeline functions. + * + * The default shader uniforms for this pipeline are: + * + * `uProjectionMatrix` (mat4) + * `uMainSampler` (sampler2D) + * + * @class MobilePipeline + * @extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. */ -var AtlasXML = function (texture, sourceIndex, xml) -{ - // Malformed? - if (!xml.getElementsByTagName('TextureAtlas')) - { - console.warn('Invalid Texture Atlas XML given'); - return; - } - - // Add in a __BASE entry (for the entire atlas) - var source = texture.source[sourceIndex]; +var MobilePipeline = new Class({ - texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); - - // By this stage frames is a fully parsed array - var frames = xml.getElementsByTagName('SubTexture'); + Extends: MultiPipeline, - var newFrame; + initialize: - for (var i = 0; i < frames.length; i++) + function MobilePipeline (config) { - var frame = frames[i].attributes; - - var name = frame.name.value; - var x = parseInt(frame.x.value, 10); - var y = parseInt(frame.y.value, 10); - var width = parseInt(frame.width.value, 10); - var height = parseInt(frame.height.value, 10); + config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS); + config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2 + }, + { + name: 'inTexCoord', + size: 2 + }, + { + name: 'inTexId' + }, + { + name: 'inTintEffect' + }, + { + name: 'inTint', + size: 4, + type: WEBGL_CONST.UNSIGNED_BYTE, + normalized: true + } + ]); + config.forceZero = true; - // The frame values are the exact coordinates to cut the frame out of the atlas from - newFrame = texture.add(name, sourceIndex, x, y, width, height); + MultiPipeline.call(this, config); + }, - // These are the original (non-trimmed) sprite values - if (frame.frameX) - { - var frameX = Math.abs(parseInt(frame.frameX.value, 10)); - var frameY = Math.abs(parseInt(frame.frameY.value, 10)); - var frameWidth = parseInt(frame.frameWidth.value, 10); - var frameHeight = parseInt(frame.frameHeight.value, 10); + /** + * Called when the Game has fully booted and the Renderer has finished setting up. + * + * By this stage all Game level systems are now in place and you can perform any final + * tasks that the pipeline may need that relied on game systems such as the Texture Manager. + * + * @method Phaser.Renderer.WebGL.Pipelines.MobilePipeline#boot + * @since 3.60.0 + */ + boot: function () + { + WebGLPipeline.prototype.boot.call(this); - newFrame.setTrim( - width, - height, - frameX, - frameY, - frameWidth, - frameHeight - ); - } + this.set1i('uMainSampler', 0); } - return texture; -}; +}); -module.exports = AtlasXML; +module.exports = MobilePipeline; /***/ }), -/* 980 */ -/***/ (function(module, exports) { + +/***/ 77310: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Felipe Alfonso <@bitnenfer> + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var Earcut = __webpack_require__(11117); +var GetFastValue = __webpack_require__(72632); +var ShaderSourceFS = __webpack_require__(53787); +var ShaderSourceVS = __webpack_require__(15968); +var TransformMatrix = __webpack_require__(69360); +var Utils = __webpack_require__(75512); +var WEBGL_CONST = __webpack_require__(71402); +var WebGLPipeline = __webpack_require__(44775); + /** - * Adds a Canvas Element to a Texture. + * @classdesc + * The Multi Pipeline is the core 2D texture rendering pipeline used by Phaser in WebGL. + * Virtually all Game Objects use this pipeline by default, including Sprites, Graphics + * and Tilemaps. It handles the batching of quads and tris, as well as methods for + * drawing and batching geometry data. * - * @function Phaser.Textures.Parsers.Canvas - * @memberof Phaser.Textures.Parsers - * @private - * @since 3.0.0 + * Prior to Phaser v3.50 this pipeline was called the `TextureTintPipeline`. * - * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {number} sourceIndex - The index of the TextureSource. + * In previous versions of Phaser only one single texture unit was supported at any one time. + * The Multi Pipeline is an evolution of the old Texture Tint Pipeline, updated to support + * multi-textures for increased performance. * - * @return {Phaser.Textures.Texture} The Texture modified by this parser. + * The fragment shader it uses can be found in `shaders/src/Multi.frag`. + * The vertex shader it uses can be found in `shaders/src/Multi.vert`. + * + * The default shader attributes for this pipeline are: + * + * `inPosition` (vec2, offset 0) + * `inTexCoord` (vec2, offset 8) + * `inTexId` (float, offset 16) + * `inTintEffect` (float, offset 20) + * `inTint` (vec4, offset 24, normalized) + * + * The default shader uniforms for this pipeline are: + * + * `uProjectionMatrix` (mat4) + * `uMainSampler` (sampler2D array) + * + * If you wish to create a custom pipeline extending from this one, you should use the string + * declaration `%count%` in your fragment shader source, which is used to set the number of + * `sampler2Ds` available. Also add `%getSampler%` so Phaser can inject the getSampler glsl function. + * This function can be used to get the pixel vec4 from the texture: + * + * `vec4 texture = getSampler(int(outTexId), outTexCoord);` + * + * This pipeline will automatically inject the getSampler function for you, should the value exist + * in your shader source. If you wish to handle this yourself, you can also use the + * function `Utils.parseFragmentShaderMaxTextures`. + * + * If you wish to create a pipeline that works from a single texture, or that doesn't have + * internal texture iteration, please see the `SinglePipeline` instead. + * + * @class MultiPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. */ -var Canvas = function (texture, sourceIndex) -{ - var source = texture.source[sourceIndex]; +var MultiPipeline = new Class({ - texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); + Extends: WebGLPipeline, - return texture; -}; + initialize: -module.exports = Canvas; + function MultiPipeline (config) + { + var renderer = config.game.renderer; + var fragmentShaderSource = GetFastValue(config, 'fragShader', ShaderSourceFS); -/***/ }), -/* 981 */ -/***/ (function(module, exports) { + config.fragShader = Utils.parseFragmentShaderMaxTextures(fragmentShaderSource, renderer.maxTextures); + config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2 + }, + { + name: 'inTexCoord', + size: 2 + }, + { + name: 'inTexId' + }, + { + name: 'inTintEffect' + }, + { + name: 'inTint', + size: 4, + type: WEBGL_CONST.UNSIGNED_BYTE, + normalized: true + } + ]); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + WebGLPipeline.call(this, config); -/** - * Adds an Image Element to a Texture. - * - * @function Phaser.Textures.Parsers.Image - * @memberof Phaser.Textures.Parsers - * @private - * @since 3.0.0 - * - * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {number} sourceIndex - The index of the TextureSource. - * - * @return {Phaser.Textures.Texture} The Texture modified by this parser. - */ -var Image = function (texture, sourceIndex) -{ - var source = texture.source[sourceIndex]; + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix1 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this._tempMatrix1 = new TransformMatrix(); - texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix2 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this._tempMatrix2 = new TransformMatrix(); - return texture; -}; + /** + * A temporary Transform Matrix, re-used internally during batching. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#_tempMatrix3 + * @private + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.11.0 + */ + this._tempMatrix3 = new TransformMatrix(); -module.exports = Image; + /** + * A temporary Transform Matrix, re-used internally during batching by the + * Shape Game Objects. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#calcMatrix + * @type {Phaser.GameObjects.Components.TransformMatrix} + * @since 3.55.0 + */ + this.calcMatrix = new TransformMatrix(); + /** + * Used internally to draw stroked triangles. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#tempTriangle + * @type {array} + * @private + * @since 3.55.0 + */ + this.tempTriangle = [ + { x: 0, y: 0, width: 0 }, + { x: 0, y: 0, width: 0 }, + { x: 0, y: 0, width: 0 }, + { x: 0, y: 0, width: 0 } + ]; -/***/ }), -/* 982 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Cached stroke tint. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#strokeTint + * @type {object} + * @private + * @since 3.55.0 + */ + this.strokeTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Cached fill tint. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#fillTint + * @type {object} + * @private + * @since 3.55.0 + */ + this.fillTint = { TL: 0, TR: 0, BL: 0, BR: 0 }; -var Clone = __webpack_require__(77); + /** + * Internal texture frame reference. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#currentFrame + * @type {Phaser.Textures.Frame} + * @private + * @since 3.55.0 + */ + this.currentFrame = { u0: 0, v0: 0, u1: 1, v1: 1 }; -/** - * Parses a Texture Atlas JSON Array and adds the Frames to the Texture. - * JSON format expected to match that defined by Texture Packer, with the frames property containing an array of Frames. - * - * @function Phaser.Textures.Parsers.JSONArray - * @memberof Phaser.Textures.Parsers - * @private - * @since 3.0.0 - * - * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {number} sourceIndex - The index of the TextureSource. - * @param {object} json - The JSON data. - * - * @return {Phaser.Textures.Texture} The Texture modified by this parser. - */ -var JSONArray = function (texture, sourceIndex, json) -{ - // Malformed? - if (!json['frames'] && !json['textures']) - { - console.warn('Invalid Texture Atlas JSON Array'); - return; - } + /** + * Internal path quad cache. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#firstQuad + * @type {number[]} + * @private + * @since 3.55.0 + */ + this.firstQuad = [ 0, 0, 0, 0, 0 ]; - // Add in a __BASE entry (for the entire atlas) - var source = texture.source[sourceIndex]; + /** + * Internal path quad cache. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#prevQuad + * @type {number[]} + * @private + * @since 3.55.0 + */ + this.prevQuad = [ 0, 0, 0, 0, 0 ]; - texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); + /** + * Used internally for triangulating a polygon. + * + * @name Phaser.Renderer.WebGL.Pipelines.MultiPipeline#polygonCache + * @type {array} + * @private + * @since 3.55.0 + */ + this.polygonCache = []; + }, - // By this stage frames is a fully parsed array - var frames = (Array.isArray(json.textures)) ? json.textures[sourceIndex].frames : json.frames; + /** + * Called every time the pipeline is bound by the renderer. + * Sets the shader program, vertex buffer and other resources. + * Should only be called when changing pipeline. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#boot + * @since 3.50.0 + */ + boot: function () + { + WebGLPipeline.prototype.boot.call(this); - var newFrame; + this.currentShader.set1iv('uMainSampler', this.renderer.textureIndexes); + }, - for (var i = 0; i < frames.length; i++) + /** + * Takes a Sprite Game Object, or any object that extends it, and adds it to the batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchSprite + * @since 3.0.0 + * + * @param {(Phaser.GameObjects.Image|Phaser.GameObjects.Sprite)} gameObject - The texture based Game Object to add to the batch. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set. + */ + batchSprite: function (gameObject, camera, parentTransformMatrix) { - var src = frames[i]; + this.manager.set(this, gameObject); - // The frame values are the exact coordinates to cut the frame out of the atlas from - newFrame = texture.add(src.filename, sourceIndex, src.frame.x, src.frame.y, src.frame.w, src.frame.h); + var camMatrix = this._tempMatrix1; + var spriteMatrix = this._tempMatrix2; + var calcMatrix = this._tempMatrix3; - // These are the original (non-trimmed) sprite values - if (src.trimmed) - { - newFrame.setTrim( - src.sourceSize.w, - src.sourceSize.h, - src.spriteSourceSize.x, - src.spriteSourceSize.y, - src.spriteSourceSize.w, - src.spriteSourceSize.h - ); - } + var frame = gameObject.frame; + var texture = frame.glTexture; - if (src.rotated) + var u0 = frame.u0; + var v0 = frame.v0; + var u1 = frame.u1; + var v1 = frame.v1; + var frameX = frame.x; + var frameY = frame.y; + var frameWidth = frame.cutWidth; + var frameHeight = frame.cutHeight; + var customPivot = frame.customPivot; + + var displayOriginX = gameObject.displayOriginX; + var displayOriginY = gameObject.displayOriginY; + + var x = -displayOriginX + frameX; + var y = -displayOriginY + frameY; + + if (gameObject.isCropped) { - newFrame.rotated = true; - newFrame.updateUVsInverted(); + var crop = gameObject._crop; + + if (crop.flipX !== gameObject.flipX || crop.flipY !== gameObject.flipY) + { + frame.updateCropUVs(crop, gameObject.flipX, gameObject.flipY); + } + + u0 = crop.u0; + v0 = crop.v0; + u1 = crop.u1; + v1 = crop.v1; + + frameWidth = crop.width; + frameHeight = crop.height; + + frameX = crop.x; + frameY = crop.y; + + x = -displayOriginX + frameX; + y = -displayOriginY + frameY; } - var pivot = src.anchor || src.pivot; + var flipX = 1; + var flipY = 1; - if (pivot) + if (gameObject.flipX) { - newFrame.customPivot = true; - newFrame.pivotX = pivot.x; - newFrame.pivotY = pivot.y; + if (!customPivot) + { + x += (-frame.realWidth + (displayOriginX * 2)); + } + + flipX = -1; } - // Copy over any extra data - newFrame.customData = Clone(src); - } + // Auto-invert the flipY if this is coming from a GLTexture - // Copy over any additional data that was in the JSON to Texture.customData - for (var dataKey in json) - { - if (dataKey === 'frames') + if (gameObject.flipY || (frame.source.isGLTexture && !texture.flipY)) { - continue; + if (!customPivot) + { + y += (-frame.realHeight + (displayOriginY * 2)); + } + + flipY = -1; } - if (Array.isArray(json[dataKey])) + var gx = gameObject.x; + var gy = gameObject.y; + + // if (camera.roundPixels) + // { + // gx = Math.floor(gx); + // gy = Math.floor(gy); + // } + + spriteMatrix.applyITRS(gx, gy, gameObject.rotation, gameObject.scaleX * flipX, gameObject.scaleY * flipY); + + camMatrix.copyFrom(camera.matrix); + + if (parentTransformMatrix) { - texture.customData[dataKey] = json[dataKey].slice(0); + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * gameObject.scrollFactorX, -camera.scrollY * gameObject.scrollFactorY); + + // Undo the camera scroll + spriteMatrix.e = gx; + spriteMatrix.f = gy; } else { - texture.customData[dataKey] = json[dataKey]; + spriteMatrix.e -= camera.scrollX * gameObject.scrollFactorX; + spriteMatrix.f -= camera.scrollY * gameObject.scrollFactorY; } - } - return texture; -}; + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); -module.exports = JSONArray; + var quad = calcMatrix.setQuad(x, y, x + frameWidth, y + frameHeight, camera.roundPixels); + var getTint = Utils.getTintAppendFloatAlpha; + var cameraAlpha = camera.alpha; -/***/ }), -/* 983 */ -/***/ (function(module, exports, __webpack_require__) { + var tintTL = getTint(gameObject.tintTopLeft, cameraAlpha * gameObject._alphaTL); + var tintTR = getTint(gameObject.tintTopRight, cameraAlpha * gameObject._alphaTR); + var tintBL = getTint(gameObject.tintBottomLeft, cameraAlpha * gameObject._alphaBL); + var tintBR = getTint(gameObject.tintBottomRight, cameraAlpha * gameObject._alphaBR); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.shouldFlush(6)) + { + this.flush(); + } -var Clone = __webpack_require__(77); + var unit = this.setGameObject(gameObject, frame); -/** - * Parses a Texture Atlas JSON Hash and adds the Frames to the Texture. - * JSON format expected to match that defined by Texture Packer, with the frames property containing an object of Frames. - * - * @function Phaser.Textures.Parsers.JSONHash - * @memberof Phaser.Textures.Parsers - * @private - * @since 3.0.0 - * - * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {number} sourceIndex - The index of the TextureSource. - * @param {object} json - The JSON data. - * - * @return {Phaser.Textures.Texture} The Texture modified by this parser. - */ -var JSONHash = function (texture, sourceIndex, json) -{ - // Malformed? - if (!json['frames']) + this.manager.preBatch(gameObject); + + this.batchQuad(gameObject, quad[0], quad[1], quad[2], quad[3], quad[4], quad[5], quad[6], quad[7], u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, gameObject.tintFill, texture, unit); + + this.manager.postBatch(gameObject); + }, + + /** + * Generic function for batching a textured quad using argument values instead of a Game Object. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTexture + * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - Source GameObject. + * @param {WebGLTexture} texture - Raw WebGLTexture associated with the quad. + * @param {number} textureWidth - Real texture width. + * @param {number} textureHeight - Real texture height. + * @param {number} srcX - X coordinate of the quad. + * @param {number} srcY - Y coordinate of the quad. + * @param {number} srcWidth - Width of the quad. + * @param {number} srcHeight - Height of the quad. + * @param {number} scaleX - X component of scale. + * @param {number} scaleY - Y component of scale. + * @param {number} rotation - Rotation of the quad. + * @param {boolean} flipX - Indicates if the quad is horizontally flipped. + * @param {boolean} flipY - Indicates if the quad is vertically flipped. + * @param {number} scrollFactorX - By which factor is the quad affected by the camera horizontal scroll. + * @param {number} scrollFactorY - By which factor is the quad effected by the camera vertical scroll. + * @param {number} displayOriginX - Horizontal origin in pixels. + * @param {number} displayOriginY - Vertical origin in pixels. + * @param {number} frameX - X coordinate of the texture frame. + * @param {number} frameY - Y coordinate of the texture frame. + * @param {number} frameWidth - Width of the texture frame. + * @param {number} frameHeight - Height of the texture frame. + * @param {number} tintTL - Tint for top left. + * @param {number} tintTR - Tint for top right. + * @param {number} tintBL - Tint for bottom left. + * @param {number} tintBR - Tint for bottom right. + * @param {number} tintEffect - The tint effect. + * @param {number} uOffset - Horizontal offset on texture coordinate. + * @param {number} vOffset - Vertical offset on texture coordinate. + * @param {Phaser.Cameras.Scene2D.Camera} camera - Current used camera. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentTransformMatrix - Parent container. + * @param {boolean} [skipFlip=false] - Skip the renderTexture check. + * @param {number} [textureUnit] - Use the currently bound texture unit? + */ + batchTexture: function ( + gameObject, + texture, + textureWidth, textureHeight, + srcX, srcY, + srcWidth, srcHeight, + scaleX, scaleY, + rotation, + flipX, flipY, + scrollFactorX, scrollFactorY, + displayOriginX, displayOriginY, + frameX, frameY, frameWidth, frameHeight, + tintTL, tintTR, tintBL, tintBR, tintEffect, + uOffset, vOffset, + camera, + parentTransformMatrix, + skipFlip, + textureUnit) { - console.warn('Invalid Texture Atlas JSON Hash given, missing \'frames\' Object'); - return; - } + this.manager.set(this, gameObject); + + var camMatrix = this._tempMatrix1; + var spriteMatrix = this._tempMatrix2; + var calcMatrix = this._tempMatrix3; + + var u0 = (frameX / textureWidth) + uOffset; + var v0 = (frameY / textureHeight) + vOffset; + var u1 = (frameX + frameWidth) / textureWidth + uOffset; + var v1 = (frameY + frameHeight) / textureHeight + vOffset; + + var width = srcWidth; + var height = srcHeight; + + var x = -displayOriginX; + var y = -displayOriginY; + + if (gameObject.isCropped) + { + var crop = gameObject._crop; + + var cropWidth = crop.width; + var cropHeight = crop.height; + + width = cropWidth; + height = cropHeight; + + srcWidth = cropWidth; + srcHeight = cropHeight; + + frameX = crop.x; + frameY = crop.y; + + var ox = frameX; + var oy = frameY; - // Add in a __BASE entry (for the entire atlas) - var source = texture.source[sourceIndex]; + if (flipX) + { + ox = (frameWidth - crop.x - cropWidth); + } - texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); + if (flipY) + { + oy = (frameHeight - crop.y - cropHeight); + } - // By this stage frames is a fully parsed Object - var frames = json.frames; - var newFrame; + u0 = (ox / textureWidth) + uOffset; + v0 = (oy / textureHeight) + vOffset; + u1 = (ox + cropWidth) / textureWidth + uOffset; + v1 = (oy + cropHeight) / textureHeight + vOffset; - for (var key in frames) - { - if (!frames.hasOwnProperty(key)) - { - continue; + x = -displayOriginX + frameX; + y = -displayOriginY + frameY; } - var src = frames[key]; - - // The frame values are the exact coordinates to cut the frame out of the atlas from - newFrame = texture.add(key, sourceIndex, src.frame.x, src.frame.y, src.frame.w, src.frame.h); + // Invert the flipY if this is a RenderTexture + flipY = flipY ^ (!skipFlip && texture.isRenderTexture ? 1 : 0); - // These are the original (non-trimmed) sprite values - if (src.trimmed) + if (flipX) { - newFrame.setTrim( - src.sourceSize.w, - src.sourceSize.h, - src.spriteSourceSize.x, - src.spriteSourceSize.y, - src.spriteSourceSize.w, - src.spriteSourceSize.h - ); + width *= -1; + x += srcWidth; } - if (src.rotated) + if (flipY) { - newFrame.rotated = true; - newFrame.updateUVsInverted(); + height *= -1; + y += srcHeight; } - var pivot = src.anchor || src.pivot; + // if (camera.roundPixels) + // { + // srcX = Math.floor(srcX); + // srcY = Math.floor(srcY); + // } - if (pivot) - { - newFrame.customPivot = true; - newFrame.pivotX = pivot.x; - newFrame.pivotY = pivot.y; - } + spriteMatrix.applyITRS(srcX, srcY, rotation, scaleX, scaleY); - // Copy over any extra data - newFrame.customData = Clone(src); - } + camMatrix.copyFrom(camera.matrix); - // Copy over any additional data that was in the JSON to Texture.customData - for (var dataKey in json) - { - if (dataKey === 'frames') + if (parentTransformMatrix) { - continue; - } + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY); - if (Array.isArray(json[dataKey])) - { - texture.customData[dataKey] = json[dataKey].slice(0); + // Undo the camera scroll + spriteMatrix.e = srcX; + spriteMatrix.f = srcY; } else { - texture.customData[dataKey] = json[dataKey]; + spriteMatrix.e -= camera.scrollX * scrollFactorX; + spriteMatrix.f -= camera.scrollY * scrollFactorY; } - } - return texture; -}; - -module.exports = JSONHash; + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(spriteMatrix, calcMatrix); + var quad = calcMatrix.setQuad(x, y, x + width, y + height, camera.roundPixels); -/***/ }), -/* 984 */ -/***/ (function(module, exports, __webpack_require__) { + if (textureUnit === undefined) + { + // textureUnit = this.renderer.setTexture2D(texture); + textureUnit = this.setTexture2D(texture); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (gameObject) + { + this.manager.preBatch(gameObject); + } -var GetFastValue = __webpack_require__(2); + this.batchQuad(gameObject, quad[0], quad[1], quad[2], quad[3], quad[4], quad[5], quad[6], quad[7], u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); -/** - * Parses a Sprite Sheet and adds the Frames to the Texture. - * - * In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact - * same size and cannot be trimmed or rotated. - * - * @function Phaser.Textures.Parsers.SpriteSheet - * @memberof Phaser.Textures.Parsers - * @private - * @since 3.0.0 - * - * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {number} sourceIndex - The index of the TextureSource. - * @param {number} x - The top-left coordinate of the Sprite Sheet. Defaults to zero. Used when extracting sheets from atlases. - * @param {number} y - The top-left coordinate of the Sprite Sheet. Defaults to zero. Used when extracting sheets from atlases. - * @param {number} width - The width of the source image. - * @param {number} height - The height of the source image. - * @param {object} config - An object describing how to parse the Sprite Sheet. - * @param {number} config.frameWidth - Width in pixels of a single frame in the sprite sheet. - * @param {number} [config.frameHeight] - Height in pixels of a single frame in the sprite sheet. Defaults to frameWidth if not provided. - * @param {number} [config.startFrame=0] - The frame to start extracting from. Defaults to zero. - * @param {number} [config.endFrame=-1] - The frame to finish extracting at. Defaults to -1, which means 'all frames'. - * @param {number} [config.margin=0] - If the frames have been drawn with a margin, specify the amount here. - * @param {number} [config.spacing=0] - If the frames have been drawn with spacing between them, specify the amount here. - * - * @return {Phaser.Textures.Texture} The Texture modified by this parser. - */ -var SpriteSheet = function (texture, sourceIndex, x, y, width, height, config) -{ - var frameWidth = GetFastValue(config, 'frameWidth', null); - var frameHeight = GetFastValue(config, 'frameHeight', frameWidth); + if (gameObject) + { + this.manager.postBatch(gameObject); + } + }, - // If missing we can't proceed - if (frameWidth === null) + /** + * Adds a Texture Frame into the batch for rendering. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchTextureFrame + * @since 3.12.0 + * + * @param {Phaser.Textures.Frame} frame - The Texture Frame to be rendered. + * @param {number} x - The horizontal position to render the texture at. + * @param {number} y - The vertical position to render the texture at. + * @param {number} tint - The tint color. + * @param {number} alpha - The alpha value. + * @param {Phaser.GameObjects.Components.TransformMatrix} transformMatrix - The Transform Matrix to use for the texture. + * @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - A parent Transform Matrix. + */ + batchTextureFrame: function ( + frame, + x, y, + tint, alpha, + transformMatrix, + parentTransformMatrix + ) { - throw new Error('TextureManager.SpriteSheet: Invalid frameWidth given.'); - } + this.manager.set(this); - // Add in a __BASE entry (for the entire atlas) - var source = texture.source[sourceIndex]; + var spriteMatrix = this._tempMatrix1.copyFrom(transformMatrix); + var calcMatrix = this._tempMatrix2; - texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); + if (parentTransformMatrix) + { + spriteMatrix.multiply(parentTransformMatrix, calcMatrix); + } + else + { + calcMatrix = spriteMatrix; + } - var startFrame = GetFastValue(config, 'startFrame', 0); - var endFrame = GetFastValue(config, 'endFrame', -1); - var margin = GetFastValue(config, 'margin', 0); - var spacing = GetFastValue(config, 'spacing', 0); + var quad = calcMatrix.setQuad(x, y, x + frame.width, y + frame.height, false); - var row = Math.floor((width - margin + spacing) / (frameWidth + spacing)); - var column = Math.floor((height - margin + spacing) / (frameHeight + spacing)); - var total = row * column; + var unit = this.setTexture2D(frame.source.glTexture); - if (total === 0) - { - console.warn('SpriteSheet frame dimensions will result in zero frames for texture:', texture.key); - } + tint = Utils.getTintAppendFloatAlpha(tint, alpha); - if (startFrame > total || startFrame < -total) - { - startFrame = 0; - } + this.batchQuad(null, quad[0], quad[1], quad[2], quad[3], quad[4], quad[5], quad[6], quad[7], frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, 0, frame.glTexture, unit); + }, - if (startFrame < 0) + /** + * Pushes a filled rectangle into the vertex batch. + * + * Rectangle factors in the given transform matrices before adding to the batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchFillRect + * @since 3.55.0 + * + * @param {number} x - Horizontal top left coordinate of the rectangle. + * @param {number} y - Vertical top left coordinate of the rectangle. + * @param {number} width - Width of the rectangle. + * @param {number} height - Height of the rectangle. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchFillRect: function (x, y, width, height, currentMatrix, parentMatrix) { - // Allow negative skipframes. - startFrame = total + startFrame; - } + this.renderer.pipelines.set(this); - if (endFrame !== -1) - { - total = startFrame + (endFrame + 1); - } + var calcMatrix = this.calcMatrix; - var fx = margin; - var fy = margin; - var ax = 0; - var ay = 0; + // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix + if (parentMatrix) + { + parentMatrix.multiply(currentMatrix, calcMatrix); + } - for (var i = 0; i < total; i++) + var quad = calcMatrix.setQuad(x, y, x + width, y + height, false); + + var tint = this.fillTint; + + this.batchQuad(null, quad[0], quad[1], quad[2], quad[3], quad[4], quad[5], quad[6], quad[7], 0, 0, 1, 1, tint.TL, tint.TR, tint.BL, tint.BR, 2); + }, + + /** + * Pushes a filled triangle into the vertex batch. + * + * Triangle factors in the given transform matrices before adding to the batch. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchFillTriangle + * @since 3.55.0 + * + * @param {number} x0 - Point 0 x coordinate. + * @param {number} y0 - Point 0 y coordinate. + * @param {number} x1 - Point 1 x coordinate. + * @param {number} y1 - Point 1 y coordinate. + * @param {number} x2 - Point 2 x coordinate. + * @param {number} y2 - Point 2 y coordinate. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchFillTriangle: function (x0, y0, x1, y1, x2, y2, currentMatrix, parentMatrix) { - ax = 0; - ay = 0; + this.renderer.pipelines.set(this); - var w = fx + frameWidth; - var h = fy + frameHeight; + var calcMatrix = this.calcMatrix; - if (w > width) + // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix + if (parentMatrix) { - ax = w - width; + parentMatrix.multiply(currentMatrix, calcMatrix); } - if (h > height) - { - ay = h - height; - } + var tx0 = calcMatrix.getX(x0, y0); + var ty0 = calcMatrix.getY(x0, y0); - texture.add(i, sourceIndex, x + fx, y + fy, frameWidth - ax, frameHeight - ay); + var tx1 = calcMatrix.getX(x1, y1); + var ty1 = calcMatrix.getY(x1, y1); - fx += frameWidth + spacing; + var tx2 = calcMatrix.getX(x2, y2); + var ty2 = calcMatrix.getY(x2, y2); - if (fx + frameWidth > width) - { - fx = margin; - fy += frameHeight + spacing; - } - } + var tint = this.fillTint; - return texture; -}; + this.batchTri(null, tx0, ty0, tx1, ty1, tx2, ty2, 0, 0, 1, 1, tint.TL, tint.TR, tint.BL, 2); + }, -module.exports = SpriteSheet; + /** + * Pushes a stroked triangle into the vertex batch. + * + * Triangle factors in the given transform matrices before adding to the batch. + * + * The triangle is created from 3 lines and drawn using the `batchStrokePath` method. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchStrokeTriangle + * @since 3.55.0 + * + * @param {number} x0 - Point 0 x coordinate. + * @param {number} y0 - Point 0 y coordinate. + * @param {number} x1 - Point 1 x coordinate. + * @param {number} y1 - Point 1 y coordinate. + * @param {number} x2 - Point 2 x coordinate. + * @param {number} y2 - Point 2 y coordinate. + * @param {number} lineWidth - The width of the line in pixels. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchStrokeTriangle: function (x0, y0, x1, y1, x2, y2, lineWidth, currentMatrix, parentMatrix) + { + var tempTriangle = this.tempTriangle; + tempTriangle[0].x = x0; + tempTriangle[0].y = y0; + tempTriangle[0].width = lineWidth; -/***/ }), -/* 985 */ -/***/ (function(module, exports, __webpack_require__) { + tempTriangle[1].x = x1; + tempTriangle[1].y = y1; + tempTriangle[1].width = lineWidth; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + tempTriangle[2].x = x2; + tempTriangle[2].y = y2; + tempTriangle[2].width = lineWidth; -var GetFastValue = __webpack_require__(2); + tempTriangle[3].x = x0; + tempTriangle[3].y = y0; + tempTriangle[3].width = lineWidth; -/** - * Parses a Sprite Sheet and adds the Frames to the Texture, where the Sprite Sheet is stored as a frame within an Atlas. - * - * In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact - * same size and cannot be trimmed or rotated. - * - * @function Phaser.Textures.Parsers.SpriteSheetFromAtlas - * @memberof Phaser.Textures.Parsers - * @private - * @since 3.0.0 - * - * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {Phaser.Textures.Frame} frame - The Frame that contains the Sprite Sheet. - * @param {object} config - An object describing how to parse the Sprite Sheet. - * @param {number} config.frameWidth - Width in pixels of a single frame in the sprite sheet. - * @param {number} [config.frameHeight] - Height in pixels of a single frame in the sprite sheet. Defaults to frameWidth if not provided. - * @param {number} [config.startFrame=0] - Index of the start frame in the sprite sheet - * @param {number} [config.endFrame=-1] - Index of the end frame in the sprite sheet. -1 mean all the rest of the frames - * @param {number} [config.margin=0] - If the frames have been drawn with a margin, specify the amount here. - * @param {number} [config.spacing=0] - If the frames have been drawn with spacing between them, specify the amount here. - * - * @return {Phaser.Textures.Texture} The Texture modified by this parser. - */ -var SpriteSheetFromAtlas = function (texture, frame, config) -{ - var frameWidth = GetFastValue(config, 'frameWidth', null); - var frameHeight = GetFastValue(config, 'frameHeight', frameWidth); + this.batchStrokePath(tempTriangle, lineWidth, false, currentMatrix, parentMatrix); + }, - // If missing we can't proceed - if (!frameWidth) + /** + * Adds the given path to the vertex batch for rendering. + * + * It works by taking the array of path data and then passing it through Earcut, which + * creates a list of polygons. Each polygon is then added to the batch. + * + * The path is always automatically closed because it's filled. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchFillPath + * @since 3.55.0 + * + * @param {Phaser.Types.Math.Vector2Like[]} path - Collection of points that represent the path. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchFillPath: function (path, currentMatrix, parentMatrix) { - throw new Error('TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given.'); - } + this.renderer.pipelines.set(this); - // Add in a __BASE entry (for the entire atlas frame) - var source = texture.source[0]; - texture.add('__BASE', 0, 0, 0, source.width, source.height); + var calcMatrix = this.calcMatrix; - var startFrame = GetFastValue(config, 'startFrame', 0); - var endFrame = GetFastValue(config, 'endFrame', -1); - var margin = GetFastValue(config, 'margin', 0); - var spacing = GetFastValue(config, 'spacing', 0); + // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix + if (parentMatrix) + { + parentMatrix.multiply(currentMatrix, calcMatrix); + } - var x = frame.cutX; - var y = frame.cutY; + var length = path.length; + var polygonCache = this.polygonCache; + var polygonIndexArray; + var point; - var cutWidth = frame.cutWidth; - var cutHeight = frame.cutHeight; - var sheetWidth = frame.realWidth; - var sheetHeight = frame.realHeight; + var tintTL = this.fillTint.TL; + var tintTR = this.fillTint.TR; + var tintBL = this.fillTint.BL; - var row = Math.floor((sheetWidth - margin + spacing) / (frameWidth + spacing)); - var column = Math.floor((sheetHeight - margin + spacing) / (frameHeight + spacing)); - var total = row * column; + for (var pathIndex = 0; pathIndex < length; ++pathIndex) + { + point = path[pathIndex]; + polygonCache.push(point.x, point.y); + } - // trim offsets + polygonIndexArray = Earcut(polygonCache); + length = polygonIndexArray.length; - var leftPad = frame.x; - var leftWidth = frameWidth - leftPad; + for (var index = 0; index < length; index += 3) + { + var p0 = polygonIndexArray[index + 0] * 2; + var p1 = polygonIndexArray[index + 1] * 2; + var p2 = polygonIndexArray[index + 2] * 2; - var rightWidth = frameWidth - ((sheetWidth - cutWidth) - leftPad); + var x0 = polygonCache[p0 + 0]; + var y0 = polygonCache[p0 + 1]; + var x1 = polygonCache[p1 + 0]; + var y1 = polygonCache[p1 + 1]; + var x2 = polygonCache[p2 + 0]; + var y2 = polygonCache[p2 + 1]; - var topPad = frame.y; - var topHeight = frameHeight - topPad; + var tx0 = calcMatrix.getX(x0, y0); + var ty0 = calcMatrix.getY(x0, y0); - var bottomHeight = frameHeight - ((sheetHeight - cutHeight) - topPad); + var tx1 = calcMatrix.getX(x1, y1); + var ty1 = calcMatrix.getY(x1, y1); - if (startFrame > total || startFrame < -total) - { - startFrame = 0; - } + var tx2 = calcMatrix.getX(x2, y2); + var ty2 = calcMatrix.getY(x2, y2); - if (startFrame < 0) - { - // Allow negative skipframes. - startFrame = total + startFrame; - } + this.batchTri(null, tx0, ty0, tx1, ty1, tx2, ty2, 0, 0, 1, 1, tintTL, tintTR, tintBL, 2); + } - if (endFrame !== -1) + polygonCache.length = 0; + }, + + /** + * Adds the given path to the vertex batch for rendering. + * + * It works by taking the array of path data and calling `batchLine` for each section + * of the path. + * + * The path is optionally closed at the end. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchStrokePath + * @since 3.55.0 + * + * @param {Phaser.Types.Math.Vector2Like[]} path - Collection of points that represent the path. + * @param {number} lineWidth - The width of the line segments in pixels. + * @param {boolean} pathOpen - Indicates if the path should be closed or left open. + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchStrokePath: function (path, lineWidth, pathOpen, currentMatrix, parentMatrix) { - total = startFrame + (endFrame + 1); - } + this.renderer.pipelines.set(this); - var sheetFrame; - var frameX = margin; - var frameY = margin; - var frameIndex = 0; - var sourceIndex = frame.sourceIndex; + // Reset the closePath booleans + this.prevQuad[4] = 0; + this.firstQuad[4] = 0; - for (var sheetY = 0; sheetY < column; sheetY++) + var pathLength = path.length - 1; + + for (var pathIndex = 0; pathIndex < pathLength; pathIndex++) + { + var point0 = path[pathIndex]; + var point1 = path[pathIndex + 1]; + + this.batchLine( + point0.x, + point0.y, + point1.x, + point1.y, + point0.width / 2, + point1.width / 2, + lineWidth, + pathIndex, + !pathOpen && (pathIndex === pathLength - 1), + currentMatrix, + parentMatrix + ); + } + }, + + /** + * Creates a line out of 4 quads and adds it to the vertex batch based on the given line values. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchLine + * @since 3.55.0 + * + * @param {number} ax - x coordinate of the start of the line. + * @param {number} ay - y coordinate of the start of the line. + * @param {number} bx - x coordinate of the end of the line. + * @param {number} by - y coordinate of the end of the line. + * @param {number} aLineWidth - Width of the start of the line. + * @param {number} bLineWidth - Width of the end of the line. + * @param {number} index - If this line is part of a multi-line draw, the index of the line in the draw. + * @param {boolean} closePath - Does this line close a multi-line path? + * @param {Phaser.GameObjects.Components.TransformMatrix} currentMatrix - The current transform. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - The parent transform. + */ + batchLine: function (ax, ay, bx, by, aLineWidth, bLineWidth, lineWidth, index, closePath, currentMatrix, parentMatrix) { - var topRow = (sheetY === 0); - var bottomRow = (sheetY === column - 1); + this.renderer.pipelines.set(this); - for (var sheetX = 0; sheetX < row; sheetX++) + var calcMatrix = this.calcMatrix; + + // Multiply and store result in calcMatrix, only if the parentMatrix is set, otherwise we'll use whatever values are already in the calcMatrix + if (parentMatrix) { - var leftRow = (sheetX === 0); - var rightRow = (sheetX === row - 1); + parentMatrix.multiply(currentMatrix, calcMatrix); + } - sheetFrame = texture.add(frameIndex, sourceIndex, x + frameX, y + frameY, frameWidth, frameHeight); + var dx = bx - ax; + var dy = by - ay; - if (leftRow || topRow || rightRow || bottomRow) - { - var destX = (leftRow) ? leftPad : 0; - var destY = (topRow) ? topPad : 0; + var len = Math.sqrt(dx * dx + dy * dy); - var trimWidth = 0; - var trimHeight = 0; + if (len === 0) + { + // Because we cannot (and should not) divide by zero! + return; + } - if (leftRow) - { - trimWidth += (frameWidth - leftWidth); - } + var al0 = aLineWidth * (by - ay) / len; + var al1 = aLineWidth * (ax - bx) / len; + var bl0 = bLineWidth * (by - ay) / len; + var bl1 = bLineWidth * (ax - bx) / len; - if (rightRow) - { - trimWidth += (frameWidth - rightWidth); - } + var lx0 = bx - bl0; + var ly0 = by - bl1; + var lx1 = ax - al0; + var ly1 = ay - al1; + var lx2 = bx + bl0; + var ly2 = by + bl1; + var lx3 = ax + al0; + var ly3 = ay + al1; - if (topRow) - { - trimHeight += (frameHeight - topHeight); - } + // tx0 = bottom right + var brX = calcMatrix.getX(lx0, ly0); + var brY = calcMatrix.getY(lx0, ly0); - if (bottomRow) - { - trimHeight += (frameHeight - bottomHeight); - } + // tx1 = bottom left + var blX = calcMatrix.getX(lx1, ly1); + var blY = calcMatrix.getY(lx1, ly1); - var destWidth = frameWidth - trimWidth; - var destHeight = frameHeight - trimHeight; + // tx2 = top right + var trX = calcMatrix.getX(lx2, ly2); + var trY = calcMatrix.getY(lx2, ly2); - sheetFrame.cutWidth = destWidth; - sheetFrame.cutHeight = destHeight; + // tx3 = top left + var tlX = calcMatrix.getX(lx3, ly3); + var tlY = calcMatrix.getY(lx3, ly3); - sheetFrame.setTrim(frameWidth, frameHeight, destX, destY, destWidth, destHeight); - } + var tint = this.strokeTint; - frameX += spacing; + var tintTL = tint.TL; + var tintTR = tint.TR; + var tintBL = tint.BL; + var tintBR = tint.BR; - if (leftRow) - { - frameX += leftWidth; - } - else if (rightRow) - { - frameX += rightWidth; - } - else - { - frameX += frameWidth; - } + // TL, BL, BR, TR + this.batchQuad(null, tlX, tlY, blX, blY, brX, brY, trX, trY, 0, 0, 1, 1, tintTL, tintTR, tintBL, tintBR, 2); - frameIndex++; + if (lineWidth <= 2) + { + // No point doing a linejoin if the line isn't thick enough + return; } - frameX = margin; - frameY += spacing; + var prev = this.prevQuad; + var first = this.firstQuad; - if (topRow) + if (index > 0 && prev[4]) { - frameY += topHeight; + this.batchQuad(null, tlX, tlY, blX, blY, prev[0], prev[1], prev[2], prev[3], 0, 0, 1, 1, tintTL, tintTR, tintBL, tintBR, 2); } - else if (bottomRow) + else { - frameY += bottomHeight; + first[0] = tlX; + first[1] = tlY; + first[2] = blX; + first[3] = blY; + first[4] = 1; + } + + if (closePath && first[4]) + { + // Add a join for the final path segment + this.batchQuad(null, brX, brY, trX, trY, first[0], first[1], first[2], first[3], 0, 0, 1, 1, tintTL, tintTR, tintBL, tintBR, 2); } else { - frameY += frameHeight; + // Store it + + prev[0] = brX; + prev[1] = brY; + prev[2] = trX; + prev[3] = trY; + prev[4] = 1; } + }, + + /** + * Destroys all shader instances, removes all object references and nulls all external references. + * + * @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#destroy + * @fires Phaser.Renderer.WebGL.Pipelines.Events#DESTROY + * @since 3.60.0 + * + * @return {this} This WebGLPipeline instance. + */ + destroy: function () + { + this._tempMatrix1.destroy(); + this._tempMatrix2.destroy(); + this._tempMatrix3.destroy(); + + this._tempMatrix1 = null; + this._tempMatrix1 = null; + this._tempMatrix1 = null; + + WebGLPipeline.prototype.destroy.call(this); + + return this; } - return texture; -}; +}); -module.exports = SpriteSheetFromAtlas; +module.exports = MultiPipeline; /***/ }), -/* 986 */ -/***/ (function(module, exports) { + +/***/ 10919: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var imageHeight = 0; - -/** - * @function addFrame - * @private - * @since 3.0.0 - */ -var addFrame = function (texture, sourceIndex, name, frame) -{ - // The frame values are the exact coordinates to cut the frame out of the atlas from - - var y = imageHeight - frame.y - frame.height; - - texture.add(name, sourceIndex, frame.x, y, frame.width, frame.height); - - // These are the original (non-trimmed) sprite values - /* - if (src.trimmed) - { - newFrame.setTrim( - src.sourceSize.w, - src.sourceSize.h, - src.spriteSourceSize.x, - src.spriteSourceSize.y, - src.spriteSourceSize.w, - src.spriteSourceSize.h - ); - } - */ -}; +var Class = __webpack_require__(56694); +var GetFastValue = __webpack_require__(72632); +var PointLightShaderSourceFS = __webpack_require__(83327); +var PointLightShaderSourceVS = __webpack_require__(54677); +var WebGLPipeline = __webpack_require__(44775); /** - * Parses a Unity YAML File and creates Frames in the Texture. - * For more details about Sprite Meta Data see https://docs.unity3d.com/ScriptReference/SpriteMetaData.html + * @classdesc + * The Point Light Pipeline handles rendering the Point Light Game Objects in WebGL. * - * @function Phaser.Textures.Parsers.UnityYAML - * @memberof Phaser.Textures.Parsers - * @private - * @since 3.0.0 + * The fragment shader it uses can be found in `shaders/src/PointLight.frag`. + * The vertex shader it uses can be found in `shaders/src/PointLight.vert`. * - * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. - * @param {number} sourceIndex - The index of the TextureSource. - * @param {object} yaml - The YAML data. + * The default shader attributes for this pipeline are: * - * @return {Phaser.Textures.Texture} The Texture modified by this parser. + * `inPosition` (vec2) + * `inLightPosition` (vec2) + * `inLightRadius` (float) + * `inLightAttenuation` (float) + * `inLightColor` (vec4) + * + * The default shader uniforms for this pipeline are: + * + * `uProjectionMatrix` (mat4) + * `uResolution` (vec2) + * `uCameraZoom` (sampler2D) + * + * @class PointLightPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. */ -var UnityYAML = function (texture, sourceIndex, yaml) -{ - // Add in a __BASE entry (for the entire atlas) - var source = texture.source[sourceIndex]; - - texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); - - imageHeight = source.height; +var PointLightPipeline = new Class({ - var data = yaml.split('\n'); + Extends: WebGLPipeline, - var lineRegExp = /^[ ]*(- )*(\w+)+[: ]+(.*)/; + initialize: - var prevSprite = ''; - var currentSprite = ''; - var rect = { x: 0, y: 0, width: 0, height: 0 }; + function PointLightPipeline (config) + { + config.vertShader = GetFastValue(config, 'vertShader', PointLightShaderSourceVS); + config.fragShader = GetFastValue(config, 'fragShader', PointLightShaderSourceFS); + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2 + }, + { + name: 'inLightPosition', + size: 2 + }, + { + name: 'inLightRadius' + }, + { + name: 'inLightAttenuation' + }, + { + name: 'inLightColor', + size: 4 + } + ]); - // var pivot = { x: 0, y: 0 }; - // var border = { x: 0, y: 0, z: 0, w: 0 }; + WebGLPipeline.call(this, config); + }, - for (var i = 0; i < data.length; i++) + onRender: function (scene, camera) { - var results = data[i].match(lineRegExp); + this.set2f('uResolution', this.width, this.height); + this.set1f('uCameraZoom', camera.zoom); + }, - if (!results) - { - continue; - } + /** + * Adds a Point Light Game Object to the batch, flushing if required. + * + * @method Phaser.Renderer.WebGL.Pipelines.PointLightPipeline#batchPointLight + * @since 3.50.0 + * + * @param {Phaser.GameObjects.PointLight} light - The Point Light Game Object. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera rendering the Point Light. + * @param {number} x0 - The top-left x position. + * @param {number} y0 - The top-left y position. + * @param {number} x1 - The bottom-left x position. + * @param {number} y1 - The bottom-left y position. + * @param {number} x2 - The bottom-right x position. + * @param {number} y2 - The bottom-right y position. + * @param {number} x3 - The top-right x position. + * @param {number} y3 - The top-right y position. + * @param {number} lightX - The horizontal center of the light. + * @param {number} lightY - The vertical center of the light. + */ + batchPointLight: function (light, camera, x0, y0, x1, y1, x2, y2, x3, y3, lightX, lightY) + { + var color = light.color; + var intensity = light.intensity; + var radius = light.radius; + var attenuation = light.attenuation; - var isList = (results[1] === '- '); - var key = results[2]; - var value = results[3]; + var r = color.r * intensity; + var g = color.g * intensity; + var b = color.b * intensity; + var a = camera.alpha * light.alpha; - if (isList) + if (this.shouldFlush(6)) { - if (currentSprite !== prevSprite) - { - addFrame(texture, sourceIndex, currentSprite, rect); - - prevSprite = currentSprite; - } - - rect = { x: 0, y: 0, width: 0, height: 0 }; + this.flush(); } - if (key === 'name') + if (!this.currentBatch) { - // Start new list - currentSprite = value; - continue; + this.setTexture2D(); } - switch (key) - { - case 'x': - case 'y': - case 'width': - case 'height': - rect[key] = parseInt(value, 10); - break; - - // case 'pivot': - // pivot = eval('var obj = ' + value); - // break; + this.batchLightVert(x0, y0, lightX, lightY, radius, attenuation, r, g, b, a); + this.batchLightVert(x1, y1, lightX, lightY, radius, attenuation, r, g, b, a); + this.batchLightVert(x2, y2, lightX, lightY, radius, attenuation, r, g, b, a); + this.batchLightVert(x0, y0, lightX, lightY, radius, attenuation, r, g, b, a); + this.batchLightVert(x2, y2, lightX, lightY, radius, attenuation, r, g, b, a); + this.batchLightVert(x3, y3, lightX, lightY, radius, attenuation, r, g, b, a); - // case 'border': - // border = eval('var obj = ' + value); - // break; - } - } + this.currentBatch.count = (this.vertexCount - this.currentBatch.start); + }, - if (currentSprite !== prevSprite) + /** + * Adds a single Point Light vertex to the current vertex buffer and increments the + * `vertexCount` property by 1. + * + * This method is called directly by `batchPointLight`. + * + * @method Phaser.Renderer.WebGL.Pipelines.PointLightPipeline#batchLightVert + * @since 3.50.0 + * + * @param {number} x - The vertex x position. + * @param {number} y - The vertex y position. + * @param {number} lightX - The horizontal center of the light. + * @param {number} lightY - The vertical center of the light. + * @param {number} radius - The radius of the light. + * @param {number} attenuation - The attenuation of the light. + * @param {number} r - The red color channel of the light. + * @param {number} g - The green color channel of the light. + * @param {number} b - The blue color channel of the light. + * @param {number} a - The alpha color channel of the light. + */ + batchLightVert: function (x, y, lightX, lightY, radius, attenuation, r, g, b, a) { - addFrame(texture, sourceIndex, currentSprite, rect); - } + var vertexViewF32 = this.vertexViewF32; - return texture; -}; + var vertexOffset = (this.vertexCount * this.currentShader.vertexComponentCount) - 1; -module.exports = UnityYAML; + vertexViewF32[++vertexOffset] = x; + vertexViewF32[++vertexOffset] = y; + vertexViewF32[++vertexOffset] = lightX; + vertexViewF32[++vertexOffset] = lightY; + vertexViewF32[++vertexOffset] = radius; + vertexViewF32[++vertexOffset] = attenuation; + vertexViewF32[++vertexOffset] = r; + vertexViewF32[++vertexOffset] = g; + vertexViewF32[++vertexOffset] = b; + vertexViewF32[++vertexOffset] = a; -/* -Example data: + this.vertexCount++; + } -TextureImporter: - spritePivot: {x: .5, y: .5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - spriteSheet: - sprites: - - name: asteroids_0 - rect: - serializedVersion: 2 - x: 5 - y: 328 - width: 65 - height: 82 - alignment: 0 - pivot: {x: 0, y: 0} - border: {x: 0, y: 0, z: 0, w: 0} - - name: asteroids_1 - rect: - serializedVersion: 2 - x: 80 - y: 322 - width: 53 - height: 88 - alignment: 0 - pivot: {x: 0, y: 0} - border: {x: 0, y: 0, z: 0, w: 0} - spritePackingTag: Asteroids -*/ +}); + +module.exports = PointLightPipeline; /***/ }), -/* 987 */ -/***/ (function(module, exports) { + +/***/ 80486: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var ColorMatrix = __webpack_require__(65246); +var GetFastValue = __webpack_require__(72632); +var ShaderSourceFS = __webpack_require__(12569); +var ShaderSourceVS = __webpack_require__(99365); +var WebGLPipeline = __webpack_require__(44775); + /** - * The Sound Complete Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they complete playback. - * - * Listen to it from a Sound instance using `Sound.on('complete', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('complete', listener); - * music.play(); - * ``` + * @classdesc + * The Post FX Pipeline is a special kind of pipeline specifically for handling post + * processing effects. Where-as a standard Pipeline allows you to control the process + * of rendering Game Objects by configuring the shaders and attributes used to draw them, + * a Post FX Pipeline is designed to allow you to apply processing _after_ the Game Object/s + * have been rendered. Typical examples of post processing effects are bloom filters, + * blurs, light effects and color manipulation. + * + * The pipeline works by creating a tiny vertex buffer with just one single hard-coded quad + * in it. Game Objects can have a Post Pipeline set on them. Those objects are then rendered + * using their standard pipeline, but are redirected to the Render Targets owned by the + * post pipeline, which can then apply their own shaders and effects, before passing them + * back to the main renderer. + * + * Please see the Phaser 3 examples for further details on this extensive subject. + * + * The default fragment shader it uses can be found in `shaders/src/PostFX.frag`. + * The default vertex shader it uses can be found in `shaders/src/Quad.vert`. + * + * The default shader attributes for this pipeline are: + * + * `inPosition` (vec2, offset 0) + * `inTexCoord` (vec2, offset 8) + * + * The vertices array layout is: + * + * -1, 1 B----C 1, 1 + * 0, 1 | /| 1, 1 + * | / | + * | / | + * |/ | + * -1, -1 A----D 1, -1 + * 0, 0 1, 0 + * + * A = -1, -1 (pos) and 0, 0 (uv) + * B = -1, 1 (pos) and 0, 1 (uv) + * C = 1, 1 (pos) and 1, 1 (uv) + * D = 1, -1 (pos) and 1, 0 (uv) + * + * First tri: A, B, C + * Second tri: A, C, D + * + * Array index: + * + * 0 = Tri 1 - Vert A - x pos + * 1 = Tri 1 - Vert A - y pos + * 2 = Tri 1 - Vert A - uv u + * 3 = Tri 1 - Vert A - uv v + * + * 4 = Tri 1 - Vert B - x pos + * 5 = Tri 1 - Vert B - y pos + * 6 = Tri 1 - Vert B - uv u + * 7 = Tri 1 - Vert B - uv v + * + * 8 = Tri 1 - Vert C - x pos + * 9 = Tri 1 - Vert C - y pos + * 10 = Tri 1 - Vert C - uv u + * 11 = Tri 1 - Vert C - uv v + * + * 12 = Tri 2 - Vert A - x pos + * 13 = Tri 2 - Vert A - y pos + * 14 = Tri 2 - Vert A - uv u + * 15 = Tri 2 - Vert A - uv v + * + * 16 = Tri 2 - Vert C - x pos + * 17 = Tri 2 - Vert C - y pos + * 18 = Tri 2 - Vert C - uv u + * 19 = Tri 2 - Vert C - uv v + * + * 20 = Tri 2 - Vert D - x pos + * 21 = Tri 2 - Vert D - y pos + * 22 = Tri 2 - Vert D - uv u + * 23 = Tri 2 - Vert D - uv v + * + * @class PostFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 * - * @event Phaser.Sound.Events#COMPLETE - * @since 3.16.1 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. */ -module.exports = 'complete'; - - -/***/ }), -/* 988 */ -/***/ (function(module, exports) { +var PostFXPipeline = new Class({ -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + Extends: WebGLPipeline, -/** - * The Audio Data Decoded Event. - * - * This event is dispatched by the Web Audio Sound Manager as a result of calling the `decodeAudio` method. - * - * Listen to it from the Sound Manager in a Scene using `this.sound.on('decoded', listener)`, i.e.: - * - * ```javascript - * this.sound.on('decoded', handler); - * this.sound.decodeAudio(key, audioData); - * ``` - * - * @event Phaser.Sound.Events#DECODED - * @since 3.18.0 - * - * @param {string} key - The key of the audio file that was decoded and added to the audio cache. - */ -module.exports = 'decoded'; + initialize: + function PostFXPipeline (config) + { + config.renderTarget = GetFastValue(config, 'renderTarget', 1); + config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS); + config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2 + }, + { + name: 'inTexCoord', + size: 2 + } + ]); + config.batchSize = 1; + config.vertices = [ + -1, -1, 0, 0, + -1, 1, 0, 1, + 1, 1, 1, 1, + -1, -1, 0, 0, + 1, 1, 1, 1, + 1, -1, 1, 0 + ]; -/***/ }), -/* 989 */ -/***/ (function(module, exports) { + WebGLPipeline.call(this, config); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.isPostFX = true; -/** - * The Audio Data Decoded All Event. - * - * This event is dispatched by the Web Audio Sound Manager as a result of calling the `decodeAudio` method, - * once all files passed to the method have been decoded (or errored). - * - * Use `Phaser.Sound.Events#DECODED` to listen for single sounds being decoded, and `DECODED_ALL` to - * listen for them all completing. - * - * Listen to it from the Sound Manager in a Scene using `this.sound.on('decodedall', listener)`, i.e.: - * - * ```javascript - * this.sound.once('decodedall', handler); - * this.sound.decodeAudio([ audioFiles ]); - * ``` - * - * @event Phaser.Sound.Events#DECODED_ALL - * @since 3.18.0 - */ -module.exports = 'decodedall'; + /** + * If this Post Pipeline belongs to a Game Object or Camera, + * this property contains a reference to it. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#gameObject + * @type {(Phaser.GameObjects.GameObject|Phaser.Cameras.Scene2D.Camera)} + * @since 3.50.0 + */ + this.gameObject; + /** + * If this Post Pipeline belongs to an FX Controller, this is a + * reference to it. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#controller + * @type {Phaser.FX.Controller} + * @since 3.60.0 + */ + this.controller; -/***/ }), -/* 990 */ -/***/ (function(module, exports) { + /** + * A Color Matrix instance belonging to this pipeline. + * + * Used during calls to the `drawFrame` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#colorMatrix + * @type {Phaser.Display.ColorMatrix} + * @since 3.50.0 + */ + this.colorMatrix = new ColorMatrix(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A reference to the Full Frame 1 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#fullFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.fullFrame1; -/** - * The Sound Destroy Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are destroyed, either - * directly or via a Sound Manager. - * - * Listen to it from a Sound instance using `Sound.on('destroy', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('destroy', listener); - * music.destroy(); - * ``` - * - * @event Phaser.Sound.Events#DESTROY - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. - */ -module.exports = 'destroy'; + /** + * A reference to the Full Frame 2 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#fullFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.fullFrame2; + /** + * A reference to the Half Frame 1 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#halfFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.halfFrame1; -/***/ }), -/* 991 */ -/***/ (function(module, exports) { + /** + * A reference to the Half Frame 2 Render Target that belongs to the + * Utility Pipeline. This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#halfFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @default null + * @since 3.50.0 + */ + this.halfFrame2; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.renderer.isBooted) + { + this.manager = this.renderer.pipelines; -/** - * The Sound Detune Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their detune value changes. - * - * Listen to it from a Sound instance using `Sound.on('detune', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('detune', listener); - * music.play(); - * music.setDetune(200); - * ``` - * - * @event Phaser.Sound.Events#DETUNE - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. - * @param {number} detune - The new detune value of the Sound. - */ -module.exports = 'detune'; + this.boot(); + } + }, + boot: function () + { + WebGLPipeline.prototype.boot.call(this); -/***/ }), -/* 992 */ -/***/ (function(module, exports) { + var utility = this.manager.UTILITY_PIPELINE; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.fullFrame1 = utility.fullFrame1; + this.fullFrame2 = utility.fullFrame2; + this.halfFrame1 = utility.halfFrame1; + this.halfFrame2 = utility.halfFrame2; -/** - * The Sound Manager Global Detune Event. - * - * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, - * or the HTML5 Audio Manager. It is dispatched when the `detune` property of the Sound Manager is changed, which globally - * adjusts the detuning of all active sounds. - * - * Listen to it from a Scene using: `this.sound.on('rate', listener)`. - * - * @event Phaser.Sound.Events#GLOBAL_DETUNE - * @since 3.0.0 - * - * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. - * @param {number} detune - The updated detune value. - */ -module.exports = 'detune'; + this.set1i('uMainSampler', 0); + }, + onDraw: function (renderTarget) + { + this.bindAndDraw(renderTarget); + }, -/***/ }), -/* 993 */ -/***/ (function(module, exports) { + /** + * Returns the FX Controller for this Post FX Pipeline. + * + * This is called internally and not typically required outside. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#getController + * @since 3.60.0 + * + * @param {Phaser.FX.Controller} [controller] - An FX Controller, or undefined. + * + * @return {Phaser.FX.Controller|Phaser.Renderer.WebGL.Pipelines.PostFXPipeline} The FX Controller responsible, or this Pipeline. + */ + getController: function (controller) + { + if (controller !== undefined) + { + return controller; + } + else if (this.controller) + { + return this.controller; + } + else + { + return this; + } + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Copy the `source` Render Target to the `target` Render Target. + * + * This method does _not_ bind a shader. It uses whatever shader + * is currently bound in this pipeline. It also does _not_ clear + * the frame buffers after use. You should take care of both of + * these things if you call this method directly. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#copySprite + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. + */ + copySprite: function (source, target, reset) + { + if (reset === undefined) { reset = false; } -/** - * The Sound Manager Global Mute Event. - * - * This event is dispatched by the Sound Manager when its `mute` property is changed, either directly - * or via the `setMute` method. This changes the mute state of all active sounds. - * - * Listen to it from a Scene using: `this.sound.on('mute', listener)`. - * - * @event Phaser.Sound.Events#GLOBAL_MUTE - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the Sound Manager that emitted the event. - * @param {boolean} mute - The mute value. `true` if the Sound Manager is now muted, otherwise `false`. - */ -module.exports = 'mute'; + var gl = this.gl; + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); -/***/ }), -/* 994 */ -/***/ (function(module, exports) { + var currentFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); -/** - * The Sound Manager Global Rate Event. - * - * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, - * or the HTML5 Audio Manager. It is dispatched when the `rate` property of the Sound Manager is changed, which globally - * adjusts the playback rate of all active sounds. - * - * Listen to it from a Scene using: `this.sound.on('rate', listener)`. - * - * @event Phaser.Sound.Events#GLOBAL_RATE - * @since 3.0.0 - * - * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. - * @param {number} rate - The updated rate value. - */ -module.exports = 'rate'; + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); -/***/ }), -/* 995 */ -/***/ (function(module, exports) { + if (reset) + { + gl.bindTexture(gl.TEXTURE_2D, null); + gl.bindFramebuffer(gl.FRAMEBUFFER, currentFBO); + } + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Copy the `source` Render Target to the `target` Render Target. + * + * You can optionally set the brightness factor of the copy. + * + * The difference between this method and `drawFrame` is that this method + * uses a faster copy shader, where only the brightness can be modified. + * If you need color level manipulation, see `drawFrame` instead. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#copyFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [brightness=1] - The brightness value applied to the frame copy. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + copyFrame: function (source, target, brightness, clear, clearAlpha) + { + this.manager.copyFrame(source, target, brightness, clear, clearAlpha); + }, -/** - * The Sound Manager Global Volume Event. - * - * This event is dispatched by the Sound Manager when its `volume` property is changed, either directly - * or via the `setVolume` method. This changes the volume of all active sounds. - * - * Listen to it from a Scene using: `this.sound.on('volume', listener)`. - * - * @event Phaser.Sound.Events#GLOBAL_VOLUME - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the sound manager that emitted the event. - * @param {number} volume - The new global volume of the Sound Manager. - */ -module.exports = 'volume'; + /** + * Pops the framebuffer from the renderers FBO stack and sets that as the active target, + * then draws the `source` Render Target to it. It then resets the renderer textures. + * + * This should be done when you need to draw the _final_ results of a pipeline to the game + * canvas, or the next framebuffer in line on the FBO stack. You should only call this once + * in the `onDraw` handler and it should be the final thing called. Be careful not to call + * this if you need to actually use the pipeline shader, instead of the copy shader. In + * those cases, use the `bindAndDraw` method. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#copyToGame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. + */ + copyToGame: function (source) + { + this.manager.copyToGame(source); + }, + /** + * Copy the `source` Render Target to the `target` Render Target, using this pipelines + * Color Matrix. + * + * The difference between this method and `copyFrame` is that this method + * uses a color matrix shader, where you have full control over the luminance + * values used during the copy. If you don't need this, you can use the faster + * `copyFrame` method instead. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#drawFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + drawFrame: function (source, target, clearAlpha) + { + this.manager.drawFrame(source, target, clearAlpha, this.colorMatrix); + }, -/***/ }), -/* 996 */ -/***/ (function(module, exports) { + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using a linear blend effect, which is controlled by the `strength` parameter. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#blendFrames + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + blendFrames: function (source1, source2, target, strength, clearAlpha) + { + this.manager.blendFrames(source1, source2, target, strength, clearAlpha); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using an additive blend effect, which is controlled by the `strength` parameter. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#blendFramesAdditive + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + blendFramesAdditive: function (source1, source2, target, strength, clearAlpha) + { + this.manager.blendFramesAdditive(source1, source2, target, strength, clearAlpha); + }, -/** - * The Sound Loop Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their loop state is changed. - * - * Listen to it from a Sound instance using `Sound.on('loop', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('loop', listener); - * music.setLoop(true); - * ``` - * - * This is not to be confused with the [LOOPED]{@linkcode Phaser.Sound.Events#event:LOOPED} event, which emits each time a Sound loops during playback. - * - * @event Phaser.Sound.Events#LOOP - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. - * @param {boolean} loop - The new loop value. `true` if the Sound will loop, otherwise `false`. - */ -module.exports = 'loop'; + /** + * Clears the given Render Target. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#clearFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The Render Target to clear. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + clearFrame: function (target, clearAlpha) + { + this.manager.clearFrame(target, clearAlpha); + }, + /** + * Copy the `source` Render Target to the `target` Render Target. + * + * The difference with this copy is that no resizing takes place. If the `source` + * Render Target is larger than the `target` then only a portion the same size as + * the `target` dimensions is copied across. + * + * You can optionally set the brightness factor of the copy. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#blitFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. + * @param {number} [brightness=1] - The brightness value applied to the frame copy. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {boolean} [eraseMode=false] - Erase source from target using ERASE Blend Mode? + */ + blitFrame: function (source, target, brightness, clear, clearAlpha, eraseMode) + { + this.manager.blitFrame(source, target, brightness, clear, clearAlpha, eraseMode); + }, -/***/ }), -/* 997 */ -/***/ (function(module, exports) { + /** + * Binds the `source` Render Target and then copies a section of it to the `target` Render Target. + * + * This method is extremely fast because it uses `gl.copyTexSubImage2D` and doesn't + * require the use of any shaders. Remember the coordinates are given in standard WebGL format, + * where x and y specify the lower-left corner of the section, not the top-left. Also, the + * copy entirely replaces the contents of the target texture, no 'merging' or 'blending' takes + * place. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#copyFrameRect + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. + * @param {number} x - The x coordinate of the lower left corner where to start copying. + * @param {number} y - The y coordinate of the lower left corner where to start copying. + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + copyFrameRect: function (source, target, x, y, width, height, clear, clearAlpha) + { + this.manager.copyFrameRect(source, target, x, y, width, height, clear, clearAlpha); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Binds this pipeline and draws the `source` Render Target to the `target` Render Target. + * + * If no `target` is specified, it will pop the framebuffer from the Renderers FBO stack + * and use that instead, which should be done when you need to draw the final results of + * this pipeline to the game canvas. + * + * You can optionally set the shader to be used for the draw here, if this is a multi-shader + * pipeline. By default `currentShader` will be used. If you need to set a shader but not + * a target, just pass `null` as the `target` parameter. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#bindAndDraw + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The Render Target to draw to. If not set, it will pop the fbo from the stack. + * @param {boolean} [clear=true] - Clear the target before copying? Only used if `target` parameter is set. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to use during the draw. + */ + bindAndDraw: function (source, target, clear, clearAlpha, currentShader) + { + if (clear === undefined) { clear = true; } + if (clearAlpha === undefined) { clearAlpha = true; } -/** - * The Sound Looped Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they loop during playback. - * - * Listen to it from a Sound instance using `Sound.on('looped', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('looped', listener); - * music.setLoop(true); - * music.play(); - * ``` - * - * This is not to be confused with the [LOOP]{@linkcode Phaser.Sound.Events#event:LOOP} event, which only emits when the loop state of a Sound is changed. - * - * @event Phaser.Sound.Events#LOOPED - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. - */ -module.exports = 'looped'; + var gl = this.gl; + var renderer = this.renderer; + this.bind(currentShader); -/***/ }), -/* 998 */ -/***/ (function(module, exports) { + this.set1i('uMainSampler', 0); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (target) + { + gl.viewport(0, 0, target.width, target.height); + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); -/** - * The Sound Mute Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their mute state changes. - * - * Listen to it from a Sound instance using `Sound.on('mute', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('mute', listener); - * music.play(); - * music.setMute(true); - * ``` - * - * @event Phaser.Sound.Events#MUTE - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. - * @param {boolean} mute - The mute value. `true` if the Sound is now muted, otherwise `false`. - */ -module.exports = 'mute'; + if (clear) + { + if (clearAlpha) + { + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); + } + gl.clear(gl.COLOR_BUFFER_BIT); + } + } + else + { + renderer.popFramebuffer(false, false); -/***/ }), -/* 999 */ -/***/ (function(module, exports) { + if (!renderer.currentFramebuffer) + { + gl.viewport(0, 0, renderer.width, renderer.height); + } + } -/** - * @author pi-kei - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + renderer.restoreStencilMask(); -/** - * The Sound Pan Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their pan changes. - * - * Listen to it from a Sound instance using `Sound.on('pan', listener)`, i.e.: - * - * ```javascript - * var sound = this.sound.add('key'); - * sound.on('pan', listener); - * sound.play(); - * sound.setPan(0.5); - * ``` - * - * @event Phaser.Sound.Events#PAN - * @since 3.50.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. - * @param {number} pan - The new pan of the Sound. - */ -module.exports = 'pan'; + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); -/***/ }), -/* 1000 */ -/***/ (function(module, exports) { + if (target) + { + gl.bindTexture(gl.TEXTURE_2D, null); + gl.bindFramebuffer(gl.FRAMEBUFFER, renderer.currentFramebuffer); + } + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Destroys all shader instances, removes all object references and nulls all external references. + * + * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#destroy + * @since 3.60.0 + * + * @return {this} This WebGLPipeline instance. + */ + destroy: function () + { + if (this.controller) + { + this.controller.destroy(); + } -/** - * The Pause All Sounds Event. - * - * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, - * or the HTML5 Audio Manager. It is dispatched when the `pauseAll` method is invoked and after all current Sounds - * have been paused. - * - * Listen to it from a Scene using: `this.sound.on('pauseall', listener)`. - * - * @event Phaser.Sound.Events#PAUSE_ALL - * @since 3.0.0 - * - * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. - */ -module.exports = 'pauseall'; + this.gameObject = null; + this.controller = null; + this.colorMatrix = null; + this.fullFrame1 = null; + this.fullFrame2 = null; + this.halfFrame1 = null; + this.halfFrame2 = null; + WebGLPipeline.prototype.destroy.call(this); -/***/ }), -/* 1001 */ -/***/ (function(module, exports) { + return this; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +}); -/** - * The Sound Pause Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are paused. - * - * Listen to it from a Sound instance using `Sound.on('pause', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('pause', listener); - * music.play(); - * music.pause(); - * ``` - * - * @event Phaser.Sound.Events#PAUSE - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. - */ -module.exports = 'pause'; +module.exports = PostFXPipeline; /***/ }), -/* 1002 */ -/***/ (function(module, exports) { + +/***/ 87228: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var BlendModes = __webpack_require__(95723); +var CenterOn = __webpack_require__(79993); +var Class = __webpack_require__(56694); +var ColorMatrixFS = __webpack_require__(37486); +var GetFastValue = __webpack_require__(72632); +var MultiPipeline = __webpack_require__(77310); +var PostFXFS = __webpack_require__(12569); +var Rectangle = __webpack_require__(74118); +var RenderTarget = __webpack_require__(37410); +var SingleQuadFS = __webpack_require__(85060); +var SingleQuadVS = __webpack_require__(18166); +var WebGLPipeline = __webpack_require__(44775); + /** - * The Sound Play Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are played. - * - * Listen to it from a Sound instance using `Sound.on('play', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('play', listener); - * music.play(); - * ``` + * @classdesc + * The Pre FX Pipeline is a special kind of pipeline designed specifically for applying + * special effects to Game Objects before they are rendered. Where-as the Post FX Pipeline applies an effect _after_ the + * object has been rendered, the Pre FX Pipeline allows you to control the rendering of + * the object itself - passing it off to its own texture, where multi-buffer compositing + * can take place. + * + * You can only use the PreFX Pipeline on the following types of Game Objects, or those + * that extend from them: + * + * Sprite + * Image + * Text + * TileSprite + * RenderTexture + * Video + * + * @class PreFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.60.0 * - * @event Phaser.Sound.Events#PLAY - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. */ -module.exports = 'play'; - +var PreFXPipeline = new Class({ -/***/ }), -/* 1003 */ -/***/ (function(module, exports) { + Extends: MultiPipeline, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + initialize: -/** - * The Sound Rate Change Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their rate changes. - * - * Listen to it from a Sound instance using `Sound.on('rate', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('rate', listener); - * music.play(); - * music.setRate(0.5); - * ``` - * - * @event Phaser.Sound.Events#RATE - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. - * @param {number} rate - The new rate of the Sound. - */ -module.exports = 'rate'; + function PreFXPipeline (config) + { + var fragShader = GetFastValue(config, 'fragShader', PostFXFS); + var vertShader = GetFastValue(config, 'vertShader', SingleQuadVS); + var drawShader = GetFastValue(config, 'drawShader', PostFXFS); + var defaultShaders = [ + { + name: 'DrawSprite', + fragShader: SingleQuadFS, + vertShader: SingleQuadVS + }, + { + name: 'CopySprite', + fragShader: fragShader, + vertShader: vertShader + }, + { + name: 'DrawGame', + fragShader: drawShader, + vertShader: SingleQuadVS + }, + { + name: 'ColorMatrix', + fragShader: ColorMatrixFS + } + ]; -/***/ }), -/* 1004 */ -/***/ (function(module, exports) { + var configShaders = GetFastValue(config, 'shaders', []); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + config.shaders = defaultShaders.concat(configShaders); -/** - * The Resume All Sounds Event. - * - * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, - * or the HTML5 Audio Manager. It is dispatched when the `resumeAll` method is invoked and after all current Sounds - * have been resumed. - * - * Listen to it from a Scene using: `this.sound.on('resumeall', listener)`. - * - * @event Phaser.Sound.Events#RESUME_ALL - * @since 3.0.0 - * - * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. - */ -module.exports = 'resumeall'; + if (!config.vertShader) + { + config.vertShader = vertShader; + } + config.batchSize = 1; -/***/ }), -/* 1005 */ -/***/ (function(module, exports) { + MultiPipeline.call(this, config); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.isPreFX = true; -/** - * The Sound Resume Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are resumed from a paused state. - * - * Listen to it from a Sound instance using `Sound.on('resume', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('resume', listener); - * music.play(); - * music.pause(); - * music.resume(); - * ``` - * - * @event Phaser.Sound.Events#RESUME - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. - */ -module.exports = 'resume'; + this.customMainSampler = null; + /** + * A reference to the Draw Sprite Shader belonging to this Pipeline. + * + * This shader is used when the sprite is drawn to this fbo (or to the game if drawToFrame is false) + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#drawSpriteShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @default null + * @since 3.60.0 + */ + this.drawSpriteShader; -/***/ }), -/* 1006 */ -/***/ (function(module, exports) { + /** + * A reference to the Copy Shader belonging to this Pipeline. + * + * This shader is used when you call the `copySprite` method. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#copyShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @default null + * @since 3.60.0 + */ + this.copyShader; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A reference to the Game Draw Shader belonging to this Pipeline. + * + * This shader draws the fbo to the game. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#gameShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @default null + * @since 3.60.0 + */ + this.gameShader; -/** - * The Sound Seek Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are seeked to a new position. - * - * Listen to it from a Sound instance using `Sound.on('seek', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('seek', listener); - * music.play(); - * music.setSeek(5000); - * ``` - * - * @event Phaser.Sound.Events#SEEK - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. - * @param {number} detune - The new detune value of the Sound. - */ -module.exports = 'seek'; + /** + * A reference to the Color Matrix Shader belonging to this Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#colorMatrixShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.60.0 + */ + this.colorMatrixShader; + /** + * Raw byte buffer of vertices used specifically during the copySprite method. + * + * @name Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#quadVertexData + * @type {ArrayBuffer} + * @readonly + * @since 3.60.0 + */ + this.quadVertexData; -/***/ }), -/* 1007 */ -/***/ (function(module, exports) { + /** + * The WebGLBuffer that holds the quadVertexData. + * + * @name Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#quadVertexBuffer + * @type {WebGLBuffer} + * @readonly + * @since 3.60.0 + */ + this.quadVertexBuffer; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Float32 view of the quad array buffer. + * + * @name Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#quadVertexViewF32 + * @type {Float32Array} + * @since 3.60.0 + */ + this.quadVertexViewF32; -/** - * The Stop All Sounds Event. - * - * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, - * or the HTML5 Audio Manager. It is dispatched when the `stopAll` method is invoked and after all current Sounds - * have been stopped. - * - * Listen to it from a Scene using: `this.sound.on('stopall', listener)`. - * - * @event Phaser.Sound.Events#STOP_ALL - * @since 3.0.0 - * - * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. - */ -module.exports = 'stopall'; + /** + * A temporary Rectangle object re-used internally during sprite drawing. + * + * @name Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#spriteBounds + * @type {Phaser.Geom.Rectangle} + * @private + * @since 3.60.0 + */ + this.spriteBounds = new Rectangle(); + /** + * A temporary Rectangle object re-used internally during sprite drawing. + * + * @name Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#targetBounds + * @type {Phaser.Geom.Rectangle} + * @private + * @since 3.60.0 + */ + this.targetBounds = new Rectangle(); -/***/ }), -/* 1008 */ -/***/ (function(module, exports) { + /** + * The full-screen Render Target that the sprite is first drawn to. + * + * @name Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#fsTarget + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.60.0 + */ + this.fsTarget; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The most recent Game Object drawn. + * + * @name Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#tempSprite + * @type {Phaser.GameObjects.Sprite} + * @private + * @since 3.60.0 + */ + this.tempSprite; -/** - * The Sound Stop Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are stopped. - * - * Listen to it from a Sound instance using `Sound.on('stop', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('stop', listener); - * music.play(); - * music.stop(); - * ``` - * - * @event Phaser.Sound.Events#STOP - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. - */ -module.exports = 'stop'; + if (this.renderer.isBooted) + { + this.manager = this.renderer.pipelines; + this.boot(); + } + }, -/***/ }), -/* 1009 */ -/***/ (function(module, exports) { + boot: function () + { + WebGLPipeline.prototype.boot.call(this); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var shaders = this.shaders; + var renderer = this.renderer; -/** - * The Sound Manager Unlocked Event. - * - * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, - * or the HTML5 Audio Manager. It is dispatched during the update loop when the Sound Manager becomes unlocked. For - * Web Audio this is on the first user gesture on the page. - * - * Listen to it from a Scene using: `this.sound.on('unlocked', listener)`. - * - * @event Phaser.Sound.Events#UNLOCKED - * @since 3.0.0 - * - * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. - */ -module.exports = 'unlocked'; + this.drawSpriteShader = shaders[0]; + this.copyShader = shaders[1]; + this.gameShader = shaders[2]; + this.colorMatrixShader = shaders[3]; + // Our full-screen target (exclusive to this pipeline) + this.fsTarget = new RenderTarget(renderer, renderer.width, renderer.height, 1, 0, true, true); -/***/ }), -/* 1010 */ -/***/ (function(module, exports) { + // Copy by reference the RTs in the PipelineManager, plus add our fsTarget + this.renderTargets = this.manager.renderTargets.concat(this.fsTarget); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // 6 verts * 28 bytes + var data = new ArrayBuffer(168); -/** - * The Sound Volume Event. - * - * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their volume changes. - * - * Listen to it from a Sound instance using `Sound.on('volume', listener)`, i.e.: - * - * ```javascript - * var music = this.sound.add('key'); - * music.on('volume', listener); - * music.play(); - * music.setVolume(0.5); - * ``` - * - * @event Phaser.Sound.Events#VOLUME - * @since 3.0.0 - * - * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. - * @param {number} volume - The new volume of the Sound. - */ -module.exports = 'volume'; + this.quadVertexData = data; + this.quadVertexViewF32 = new Float32Array(data); -/***/ }), -/* 1011 */ -/***/ (function(module, exports, __webpack_require__) { + this.quadVertexBuffer = renderer.createVertexBuffer(data, this.gl.STATIC_DRAW); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.onResize(renderer.width, renderer.height); -/** - * @namespace Phaser.GameObjects - */ + // So calls to set uniforms in onPreRender target the right shader: + this.currentShader = this.copyShader; + }, -var GameObjects = { + /** + * Handles the resizing of the quad vertex data. + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#onResize + * @since 3.60.0 + * + * @param {number} width - The new width of the quad. + * @param {number} height - The new height of the quad. + */ + onResize: function (width, height) + { + var vertexViewF32 = this.quadVertexViewF32; - Events: __webpack_require__(75), - - DisplayList: __webpack_require__(1012), - GameObjectCreator: __webpack_require__(16), - GameObjectFactory: __webpack_require__(5), - UpdateList: __webpack_require__(1040), - - Components: __webpack_require__(11), - GetCalcMatrix: __webpack_require__(19), - - BuildGameObject: __webpack_require__(28), - BuildGameObjectAnimation: __webpack_require__(439), - GameObject: __webpack_require__(15), - BitmapText: __webpack_require__(148), - Blitter: __webpack_require__(213), - Bob: __webpack_require__(440), - Container: __webpack_require__(214), - DOMElement: __webpack_require__(442), - DynamicBitmapText: __webpack_require__(215), - Extern: __webpack_require__(444), - Graphics: __webpack_require__(216), - Group: __webpack_require__(113), - Image: __webpack_require__(125), - Layer: __webpack_require__(219), - Particles: __webpack_require__(1074), - PathFollower: __webpack_require__(457), - RenderTexture: __webpack_require__(221), - RetroFont: __webpack_require__(1082), - Rope: __webpack_require__(223), - Sprite: __webpack_require__(73), - - Text: __webpack_require__(224), - GetTextSize: __webpack_require__(458), - MeasureText: __webpack_require__(460), - TextStyle: __webpack_require__(459), - - TileSprite: __webpack_require__(225), - Zone: __webpack_require__(129), - Video: __webpack_require__(226), + // vertexBuffer indexes: - // Shapes + // Each vert: [ x, y, u, v, unit, mode, tint ] - Shape: __webpack_require__(34), - Arc: __webpack_require__(461), - Curve: __webpack_require__(462), - Ellipse: __webpack_require__(463), - Grid: __webpack_require__(464), - IsoBox: __webpack_require__(465), - IsoTriangle: __webpack_require__(466), - Line: __webpack_require__(467), - Polygon: __webpack_require__(468), - Rectangle: __webpack_require__(473), - Star: __webpack_require__(474), - Triangle: __webpack_require__(475), + // 0 - 6 - vert 1 - x0/y0 + // 7 - 13 - vert 2 - x1/y1 + // 14 - 20 - vert 3 - x2/y2 + // 21 - 27 - vert 4 - x0/y0 + // 28 - 34 - vert 5 - x2/y2 + // 35 - 41 - vert 6 - x3/y3 - // Game Object Factories + // Verts + vertexViewF32[1] = height; // y0 + vertexViewF32[22] = height; // y0 + vertexViewF32[14] = width; // x2 + vertexViewF32[28] = width; // x2 + vertexViewF32[35] = width; // x3 + vertexViewF32[36] = height; // y3 + }, - Factories: { - Blitter: __webpack_require__(1130), - Container: __webpack_require__(1131), - DOMElement: __webpack_require__(1132), - DynamicBitmapText: __webpack_require__(1133), - Extern: __webpack_require__(1134), - Graphics: __webpack_require__(1135), - Group: __webpack_require__(1136), - Image: __webpack_require__(1137), - Layer: __webpack_require__(1138), - Particles: __webpack_require__(1139), - PathFollower: __webpack_require__(1140), - RenderTexture: __webpack_require__(1141), - Rope: __webpack_require__(1142), - Sprite: __webpack_require__(1143), - StaticBitmapText: __webpack_require__(1144), - Text: __webpack_require__(1145), - TileSprite: __webpack_require__(1146), - Zone: __webpack_require__(1147), - Video: __webpack_require__(1148), + /** + * Adds the vertices data into the batch and flushes if full. + * + * Assumes 6 vertices in the following arrangement: + * + * ``` + * 0----3 + * |\ B| + * | \ | + * | \ | + * | A \| + * | \ + * 1----2 + * ``` + * + * Where x0 / y0 = 0, x1 / y1 = 1, x2 / y2 = 2 and x3 / y3 = 3 + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#batchQuad + * @since 3.60.0 + * + * @param {(Phaser.GameObjects.GameObject|null)} gameObject - The Game Object, if any, drawing this quad. + * @param {number} x0 - The top-left x position. + * @param {number} y0 - The top-left y position. + * @param {number} x1 - The bottom-left x position. + * @param {number} y1 - The bottom-left y position. + * @param {number} x2 - The bottom-right x position. + * @param {number} y2 - The bottom-right y position. + * @param {number} x3 - The top-right x position. + * @param {number} y3 - The top-right y position. + * @param {number} u0 - UV u0 value. + * @param {number} v0 - UV v0 value. + * @param {number} u1 - UV u1 value. + * @param {number} v1 - UV v1 value. + * @param {number} tintTL - The top-left tint color value. + * @param {number} tintTR - The top-right tint color value. + * @param {number} tintBL - The bottom-left tint color value. + * @param {number} tintBR - The bottom-right tint color value. + * @param {(number|boolean)} tintEffect - The tint effect for the shader to use. + * @param {WebGLTexture} [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs. + * + * @return {boolean} `true` if this method caused the batch to flush, otherwise `false`. + */ + batchQuad: function (gameObject, x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture) + { + var bx = Math.min(x0, x1, x2, x3); + var by = Math.min(y0, y1, y2, y3); + var br = Math.max(x0, x1, x2, x3); + var bb = Math.max(y0, y1, y2, y3); + var bw = br - bx; + var bh = bb - by; - // Shapes - Arc: __webpack_require__(1149), - Curve: __webpack_require__(1150), - Ellipse: __webpack_require__(1151), - Grid: __webpack_require__(1152), - IsoBox: __webpack_require__(1153), - IsoTriangle: __webpack_require__(1154), - Line: __webpack_require__(1155), - Polygon: __webpack_require__(1156), - Rectangle: __webpack_require__(1157), - Star: __webpack_require__(1158), - Triangle: __webpack_require__(1159) - }, + var bounds = this.spriteBounds.setTo(bx, by, bw, bh); - Creators: { - Blitter: __webpack_require__(1160), - Container: __webpack_require__(1161), - DynamicBitmapText: __webpack_require__(1162), - Graphics: __webpack_require__(1163), - Group: __webpack_require__(1164), - Image: __webpack_require__(1165), - Layer: __webpack_require__(1166), - Particles: __webpack_require__(1167), - RenderTexture: __webpack_require__(1168), - Rope: __webpack_require__(1169), - Sprite: __webpack_require__(1170), - StaticBitmapText: __webpack_require__(1171), - Text: __webpack_require__(1172), - TileSprite: __webpack_require__(1173), - Zone: __webpack_require__(1174), - Video: __webpack_require__(1175) - } + var padding = (gameObject) ? gameObject.preFX.padding : 0; + var width = bw + (padding * 2); + var height = bh + (padding * 2); + var maxDimension = Math.abs(Math.max(width, height)); -}; + var target = this.manager.getRenderTarget(maxDimension); -// WebGL only Game Objects -if (true) -{ - GameObjects.Shader = __webpack_require__(229); - GameObjects.Mesh = __webpack_require__(230); - GameObjects.PointLight = __webpack_require__(150); + var targetBounds = this.targetBounds.setTo(0, 0, target.width, target.height); - GameObjects.Factories.Shader = __webpack_require__(1184); - GameObjects.Factories.Mesh = __webpack_require__(1185); - GameObjects.Factories.PointLight = __webpack_require__(1186); + // targetBounds is the same size as the fbo and centered on the spriteBounds + // so we can use it when we re-render this back to the game + CenterOn(targetBounds, bounds.centerX, bounds.centerY); - GameObjects.Creators.Shader = __webpack_require__(1187); - GameObjects.Creators.Mesh = __webpack_require__(1188); - GameObjects.Creators.PointLight = __webpack_require__(1189); + this.tempSprite = gameObject; - GameObjects.Light = __webpack_require__(481); - GameObjects.LightsManager = __webpack_require__(482); - GameObjects.LightsPlugin = __webpack_require__(1190); -} + // Now draw the quad + var gl = this.gl; + var renderer = this.renderer; -module.exports = GameObjects; + renderer.clearStencilMask(); + this.setShader(this.drawSpriteShader); -/***/ }), -/* 1012 */ -/***/ (function(module, exports, __webpack_require__) { + this.set1i('uMainSampler', 0); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.flipProjectionMatrix(true); -var Class = __webpack_require__(0); -var List = __webpack_require__(110); -var PluginCache = __webpack_require__(24); -var GameObjectEvents = __webpack_require__(75); -var SceneEvents = __webpack_require__(20); -var StableSort = __webpack_require__(79); + if (gameObject) + { + this.onDrawSprite(gameObject, target); -/** - * @classdesc - * The Display List plugin. - * - * Display Lists belong to a Scene and maintain the list of Game Objects to render every frame. - * - * Some of these Game Objects may also be part of the Scene's [Update List]{@link Phaser.GameObjects.UpdateList}, for updating. - * - * @class DisplayList - * @extends Phaser.Structs.List. - * @memberof Phaser.GameObjects - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene that this Display List belongs to. - */ -var DisplayList = new Class({ + gameObject.preFX.onFX(this); + } - Extends: List, + var fsTarget = this.fsTarget; - initialize: + this.flush(); - function DisplayList (scene) - { - List.call(this, scene); + gl.viewport(0, 0, renderer.width, renderer.height); + gl.bindFramebuffer(gl.FRAMEBUFFER, fsTarget.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, fsTarget.texture, 0); - /** - * The flag the determines whether Game Objects should be sorted when `depthSort()` is called. - * - * @name Phaser.GameObjects.DisplayList#sortChildrenFlag - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.sortChildrenFlag = false; + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); - /** - * The Scene that this Display List belongs to. - * - * @name Phaser.GameObjects.DisplayList#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; + this.setTexture2D(texture); - /** - * The Scene's Systems. - * - * @name Phaser.GameObjects.DisplayList#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; + this.batchVert(x0, y0, u0, v0, 0, tintEffect, tintTL); + this.batchVert(x1, y1, u0, v1, 0, tintEffect, tintBL); + this.batchVert(x2, y2, u1, v1, 0, tintEffect, tintBR); - /** - * The Scene's Event Emitter. - * - * @name Phaser.GameObjects.DisplayList#events - * @type {Phaser.Events.EventEmitter} - * @since 3.50.0 - */ - this.events = scene.sys.events; + this.batchVert(x0, y0, u0, v0, 0, tintEffect, tintTL); + this.batchVert(x2, y2, u1, v1, 0, tintEffect, tintBR); + this.batchVert(x3, y3, u1, v0, 0, tintEffect, tintTR); - // Set the List callbacks - this.addCallback = this.addChildCallback; - this.removeCallback = this.removeChildCallback; + this.flush(); - this.events.once(SceneEvents.BOOT, this.boot, this); - this.events.on(SceneEvents.START, this.start, this); + this.flipProjectionMatrix(false); + + // Now we've got the sprite drawn to our screen-sized fbo, copy the rect we need to our target + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, target.texture); + gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, targetBounds.x, targetBounds.y, targetBounds.width, targetBounds.height); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindTexture(gl.TEXTURE_2D, null); + + // We've drawn the sprite to the target (using our pipeline shader) + // we can pass it to the pipeline in case they want to do further + // manipulations with it, post-fx style, then we need to draw the + // results back to the game in the correct position + + this.onBatch(gameObject); + + // Set this here, so we can immediately call the set uniform functions and it'll work on the correct shader + this.currentShader = this.copyShader; + + this.onDraw(target, this.manager.getSwapRenderTarget(), this.manager.getAltSwapRenderTarget()); + + return true; }, /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. + * This callback is invoked when a sprite is drawn by this pipeline. * - * @method Phaser.GameObjects.DisplayList#boot - * @private - * @since 3.5.1 + * It will fire after the shader has been set, but before the sprite has been drawn, + * so use it to set any additional uniforms you may need. + * + * Note: Manipulating the Sprite during this callback will _not_ change how it is drawn to the Render Target. + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#onDrawSprite + * @since 3.60.0 + * + * @param {Phaser.GameObjects.Sprite} gameObject - The Sprite being drawn. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The Render Target the Sprite will be drawn to. */ - boot: function () + onDrawSprite: function () { - this.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** - * Internal method called from `List.addCallback`. + * This callback is invoked when you call the `copySprite` method. * - * @method Phaser.GameObjects.DisplayList#addChildCallback - * @private - * @fires Phaser.Scenes.Events#ADDED_TO_SCENE - * @fires Phaser.GameObjects.Events#ADDED_TO_SCENE - * @since 3.50.0 + * It will fire after the shader has been set, but before the source target has been copied, + * so use it to set any additional uniforms you may need. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was added to the list. + * Note: Manipulating the Sprite during this callback will _not_ change the Render Targets. + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#onCopySprite + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target being copied from. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target that will be copied to. + * @param {Phaser.GameObjects.Sprite} gameObject - The Sprite being copied. */ - addChildCallback: function (gameObject) + onCopySprite: function () { - if (gameObject.displayList && gameObject.displayList !== this) + }, + + /** + * Copy the `source` Render Target to the `target` Render Target. + * + * No target resizing takes place. If the `source` Render Target is larger than the `target`, + * then only a portion the same size as the `target` dimensions is copied across. + * + * Calling this method will invoke the `onCopySprite` handler and will also call + * the `onFXCopy` callback on the Sprite. Both of these happen prior to the copy, allowing you + * to use them to set shader uniforms and other values. + * + * You can optionally pass in a ColorMatrix. If so, it will use the ColorMatrix shader + * during the copy, allowing you to manipulate the colors to a fine degree. + * See the `ColorMatrix` class for more details. + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#copySprite + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target being copied from. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target that will be copied to. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {boolean} [eraseMode=false] - Erase source from target using ERASE Blend Mode? + * @param {Phaser.Display.ColorMatrix} [colorMatrix] - Optional ColorMatrix to use when copying the Sprite. + * @param {Phaser.Renderer.WebGL.WebGLShader} [shader] - The shader to use to copy the target. Defaults to the `copyShader`. + */ + copySprite: function (source, target, clear, clearAlpha, eraseMode, colorMatrix, shader) + { + if (clear === undefined) { clear = true; } + if (clearAlpha === undefined) { clearAlpha = true; } + if (eraseMode === undefined) { eraseMode = false; } + if (shader === undefined) { shader = this.copyShader; } + + var gl = this.gl; + var sprite = this.tempSprite; + + if (colorMatrix) { - gameObject.removeFromDisplayList(); + shader = this.colorMatrixShader; } - if (!gameObject.displayList) + this.currentShader = shader; + + var wasBound = this.setVertexBuffer(this.quadVertexBuffer); + + shader.bind(wasBound, false); + + this.set1i('uMainSampler', 0); + + sprite.preFX.onFXCopy(this); + + this.onCopySprite(source, target, sprite); + + if (colorMatrix) { - this.queueDepthSort(); + this.set1fv('uColorMatrix', colorMatrix.getData()); + this.set1f('uAlpha', colorMatrix.alpha); + } - gameObject.displayList = this; + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); - gameObject.emit(GameObjectEvents.ADDED_TO_SCENE, gameObject, this.scene); + if (source.height > target.height) + { + gl.viewport(0, 0, source.width, source.height); - this.events.emit(SceneEvents.ADDED_TO_SCENE, gameObject, this.scene); + this.setTargetUVs(source, target); + } + else + { + var diff = target.height - source.height; + + gl.viewport(0, diff, source.width, source.height); + + this.resetUVs(); + } + + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); + + if (clear) + { + gl.clearColor(0, 0, 0, Number(!clearAlpha)); + + gl.clear(gl.COLOR_BUFFER_BIT); + } + + if (eraseMode) + { + var blendMode = this.renderer.currentBlendMode; + + this.renderer.setBlendMode(BlendModes.ERASE); + } + + gl.bufferData(gl.ARRAY_BUFFER, this.quadVertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + if (eraseMode) + { + this.renderer.setBlendMode(blendMode); } + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); }, /** - * Internal method called from `List.removeCallback`. + * Draws the `source` Render Target to the `target` Render Target. * - * @method Phaser.GameObjects.DisplayList#removeChildCallback - * @private - * @fires Phaser.Scenes.Events#REMOVED_FROM_SCENE - * @fires Phaser.GameObjects.Events#REMOVED_FROM_SCENE - * @since 3.50.0 + * This is done using whatever the currently bound shader is. This method does + * not set a shader. All it does is bind the source texture, set the viewport and UVs + * then bind the target framebuffer, clears it and draws the source to it. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was removed from the list. + * At the end a null framebuffer is bound. No other clearing-up takes place, so + * use this method carefully. + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#copy + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. */ - removeChildCallback: function (gameObject) + copy: function (source, target) { - this.queueDepthSort(); + var gl = this.gl; - gameObject.displayList = null; + this.set1i('uMainSampler', 0); - gameObject.emit(GameObjectEvents.REMOVED_FROM_SCENE, gameObject, this.scene); + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); - this.events.emit(SceneEvents.REMOVED_FROM_SCENE, gameObject, this.scene); + // source and target must always be the same size + gl.viewport(0, 0, source.width, source.height); + + this.setUVs(0, 0, 0, 1, 1, 1, 1, 0); + + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); + + gl.clearColor(0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + + gl.bufferData(gl.ARRAY_BUFFER, this.quadVertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); }, /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using a linear blend effect, which is controlled by the `strength` parameter. * - * @method Phaser.GameObjects.DisplayList#start - * @private - * @since 3.5.0 + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#blendFrames + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? */ - start: function () + blendFrames: function (source1, source2, target, strength, clearAlpha) { - this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); + this.manager.blendFrames(source1, source2, target, strength, clearAlpha); }, /** - * Force a sort of the display list on the next call to depthSort. + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using an additive blend effect, which is controlled by the `strength` parameter. * - * @method Phaser.GameObjects.DisplayList#queueDepthSort - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#blendFramesAdditive + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? */ - queueDepthSort: function () + blendFramesAdditive: function (source1, source2, target, strength, clearAlpha) { - this.sortChildrenFlag = true; + this.manager.blendFramesAdditive(source1, source2, target, strength, clearAlpha); }, /** - * Immediately sorts the display list if the flag is set. + * This method will copy the given Render Target to the game canvas using the `copyShader`. * - * @method Phaser.GameObjects.DisplayList#depthSort - * @since 3.0.0 + * This applies the results of the copy shader during the draw. + * + * If you wish to copy the target without any effects see the `copyToGame` method instead. + * + * This method should be the final thing called in your pipeline. + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#drawToGame + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw to the game. */ - depthSort: function () + drawToGame: function (source) { - if (this.sortChildrenFlag) - { - StableSort(this.list, this.sortByDepth); + this.currentShader = null; - this.sortChildrenFlag = false; - } + this.setShader(this.copyShader); + + this.bindAndDraw(source); }, /** - * Compare the depth of two Game Objects. + * This method will copy the given Render Target to the game canvas using the `gameShader`. * - * @method Phaser.GameObjects.DisplayList#sortByDepth - * @since 3.0.0 + * Unless you've changed it, the `gameShader` copies the target without modifying it, just + * ensuring it is placed in the correct location on the canvas. * - * @param {Phaser.GameObjects.GameObject} childA - The first Game Object. - * @param {Phaser.GameObjects.GameObject} childB - The second Game Object. + * If you wish to draw the target with and apply the fragment shader at the same time, + * see the `drawToGame` method instead. * - * @return {number} The difference between the depths of each Game Object. - */ - sortByDepth: function (childA, childB) - { - return childA._depth - childB._depth; - }, - - /** - * Returns an array which contains all objects currently on the Display List. - * This is a reference to the main list array, not a copy of it, so be careful not to modify it. + * This method should be the final thing called in your pipeline. * - * @method Phaser.GameObjects.DisplayList#getChildren - * @since 3.12.0 + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#copyToGame + * @since 3.60.0 * - * @return {Phaser.GameObjects.GameObject[]} The group members. + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to copy to the game. */ - getChildren: function () + copyToGame: function (source) { - return this.list; + this.currentShader = null; + + this.setShader(this.gameShader); + + this.bindAndDraw(source); }, /** - * The Scene that owns this plugin is shutting down. + * This method is called by `drawToGame` and `copyToGame`. It takes the source Render Target + * and copies it back to the game canvas, or the next frame buffer in the stack, and should + * be considered the very last thing this pipeline does. * - * We need to kill and reset all internal properties as well as stop listening to Scene events. + * You don't normally need to call this method, or override it, however it is left public + * should you wish to do so. * - * @method Phaser.GameObjects.DisplayList#shutdown - * @private - * @since 3.0.0 + * Note that it does _not_ set a shader. You should do this yourself if invoking this. + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#bindAndDraw + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw to the game. */ - shutdown: function () + bindAndDraw: function (source) { - var list = this.list; + var gl = this.gl; + var renderer = this.renderer; - var i = list.length; + this.set1i('uMainSampler', 0); - while (i--) + if (this.customMainSampler) + { + this.setTexture2D(this.customMainSampler); + } + else { - list[i].destroy(true); + this.setTexture2D(source.texture); } - list.length = 0; + var matrix = this._tempMatrix1.loadIdentity(); - this.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); - }, + var x = this.targetBounds.x; + var y = this.targetBounds.y; - /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. - * - * @method Phaser.GameObjects.DisplayList#destroy - * @private - * @since 3.0.0 - */ - destroy: function () - { - this.shutdown(); + var xw = x + source.width; + var yh = y + source.height; - this.events.off(SceneEvents.START, this.start, this); + var x0 = matrix.getX(x, y); + var x1 = matrix.getX(x, yh); + var x2 = matrix.getX(xw, yh); + var x3 = matrix.getX(xw, y); - this.scene = null; - this.systems = null; - this.events = null; - } + // Regular verts + var y0 = matrix.getY(x, y); + var y1 = matrix.getY(x, yh); + var y2 = matrix.getY(xw, yh); + var y3 = matrix.getY(xw, y); -}); + // Flip verts: + // var y0 = matrix.getY(x, yh); + // var y1 = matrix.getY(x, y); + // var y2 = matrix.getY(xw, y); + // var y3 = matrix.getY(xw, yh); -PluginCache.register('DisplayList', DisplayList, 'displayList'); + var white = 0xffffff; -module.exports = DisplayList; + this.batchVert(x0, y0, 0, 0, 0, 0, white); + this.batchVert(x1, y1, 0, 1, 0, 0, white); + this.batchVert(x2, y2, 1, 1, 0, 0, white); + this.batchVert(x0, y0, 0, 0, 0, 0, white); + this.batchVert(x2, y2, 1, 1, 0, 0, white); + this.batchVert(x3, y3, 1, 0, 0, 0, white); + renderer.restoreFramebuffer(false, true); -/***/ }), -/* 1013 */ -/***/ (function(module, exports, __webpack_require__) { + if (!renderer.currentFramebuffer) + { + gl.viewport(0, 0, renderer.width, renderer.height); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + renderer.restoreStencilMask(); -/** - * @namespace Phaser.Utils.Array.Matrix - */ + this.flush(); -module.exports = { + // Clear the source framebuffer out, ready for the next pass + // gl.clearColor(0, 0, 0, 0); + // gl.bindFramebuffer(gl.FRAMEBUFFER, source.framebuffer); + // gl.clear(gl.COLOR_BUFFER_BIT); + // gl.bindFramebuffer(gl.FRAMEBUFFER, null); - CheckMatrix: __webpack_require__(209), - MatrixToString: __webpack_require__(1014), - ReverseColumns: __webpack_require__(1015), - ReverseRows: __webpack_require__(1016), - Rotate180: __webpack_require__(1017), - RotateLeft: __webpack_require__(1018), - RotateMatrix: __webpack_require__(147), - RotateRight: __webpack_require__(1019), - Translate: __webpack_require__(1020), - TransposeMatrix: __webpack_require__(435) + // No hanging references + this.tempSprite = null; + }, -}; + /** + * This method is called every time the `batchSprite` method is called and is passed a + * reference to the current render target. + * + * If you override this method, then it should make sure it calls either the + * `drawToGame` or `copyToGame` methods as the final thing it does. However, you can do as + * much additional processing as you like prior to this. + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#onDraw + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The Render Target to draw to the game. + * @param {Phaser.Renderer.WebGL.RenderTarget} [swapTarget] - The Swap Render Target, useful for double-buffer effects. + * @param {Phaser.Renderer.WebGL.RenderTarget} [altSwapTarget] - The Swap Render Target, useful for double-buffer effects. + */ + onDraw: function (target) + { + this.drawToGame(target); + }, + + /** + * Set the UV values for the 6 vertices that make up the quad used by the copy shader. + * + * Be sure to call `resetUVs` once you have finished manipulating the UV coordinates. + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#setUVs + * @since 3.60.0 + * + * @param {number} uA - The u value of vertex A. + * @param {number} vA - The v value of vertex A. + * @param {number} uB - The u value of vertex B. + * @param {number} vB - The v value of vertex B. + * @param {number} uC - The u value of vertex C. + * @param {number} vC - The v value of vertex C. + * @param {number} uD - The u value of vertex D. + * @param {number} vD - The v value of vertex D. + */ + setUVs: function (uA, vA, uB, vB, uC, vC, uD, vD) + { + var vertexViewF32 = this.quadVertexViewF32; + vertexViewF32[2] = uA; + vertexViewF32[3] = vA; -/***/ }), -/* 1014 */ -/***/ (function(module, exports, __webpack_require__) { + vertexViewF32[9] = uB; + vertexViewF32[10] = vB; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + vertexViewF32[16] = uC; + vertexViewF32[17] = vC; -var Pad = __webpack_require__(186); -var CheckMatrix = __webpack_require__(209); + vertexViewF32[23] = uA; + vertexViewF32[24] = vA; -/** - * Generates a string (which you can pass to console.log) from the given Array Matrix. - * - * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) - * have the same length. There must be at least two rows. This is an example matrix: - * - * ``` - * [ - * [ 1, 1, 1, 1, 1, 1 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 2, 0, 1, 2, 0, 4 ], - * [ 2, 0, 3, 4, 0, 4 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 3, 3, 3, 3, 3, 3 ] - * ] - * ``` - * - * @function Phaser.Utils.Array.Matrix.MatrixToString - * @since 3.0.0 - * - * @generic T - * @genericUse {T[][]} - [matrix] - * - * @param {T[][]} [matrix] - A 2-dimensional array. - * - * @return {string} A string representing the matrix. - */ -var MatrixToString = function (matrix) -{ - var str = ''; + vertexViewF32[30] = uC; + vertexViewF32[31] = vC; - if (!CheckMatrix(matrix)) - { - return str; - } + vertexViewF32[37] = uD; + vertexViewF32[38] = vD; + }, - for (var r = 0; r < matrix.length; r++) + /** + * Sets the vertex UV coordinates of the quad used by the copy shaders + * so that they correctly adjust the texture coordinates for a blit frame effect. + * + * Be sure to call `resetUVs` once you have finished manipulating the UV coordinates. + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#setTargetUVs + * @since 3.60.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. + */ + setTargetUVs: function (source, target) { - for (var c = 0; c < matrix[r].length; c++) + var diff = (target.height / source.height); + + if (diff > 0.5) { - var cell = matrix[r][c].toString(); + diff = 0.5 - (diff - 0.5); + } + else + { + diff = 0.5 + (0.5 - diff); + } - if (cell !== 'undefined') - { - str += Pad(cell, 2); - } - else - { - str += '?'; - } + this.setUVs(0, diff, 0, 1 + diff, 1, 1 + diff, 1, diff); + }, - if (c < matrix[r].length - 1) - { - str += ' |'; - } - } + /** + * Resets the quad vertice UV values to their default settings. + * + * The quad is used by the copy shader in this pipeline. + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#resetUVs + * @since 3.60.0 + */ + resetUVs: function () + { + this.setUVs(0, 0, 0, 1, 1, 1, 1, 0); + }, - if (r < matrix.length - 1) - { - str += '\n'; + /** + * Destroys all shader instances, removes all object references and nulls all external references. + * + * @method Phaser.Renderer.WebGL.Pipelines.PreFXPipeline#destroy + * @fires Phaser.Renderer.WebGL.Pipelines.Events#DESTROY + * @since 3.60.0 + * + * @return {this} This WebGLPipeline instance. + */ + destroy: function () + { + this.gl.deleteBuffer(this.quadVertexBuffer); - for (var i = 0; i < matrix[r].length; i++) - { - str += '---'; + this.drawSpriteShader = null; + this.copyShader = null; + this.gameShader = null; + this.colorMatrixShader = null; - if (i < matrix[r].length - 1) - { - str += '+'; - } - } + this.quadVertexData = null; + this.quadVertexBuffer = null; + this.quadVertexViewF32 = null; - str += '\n'; - } + this.fsTarget = null; + this.tempSprite = null; + + MultiPipeline.prototype.destroy.call(this); + return this; } - return str; -}; +}); -module.exports = MatrixToString; +module.exports = PreFXPipeline; /***/ }), -/* 1015 */ -/***/ (function(module, exports) { + +/***/ 21213: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var GetFastValue = __webpack_require__(72632); +var MultiPipeline = __webpack_require__(77310); + /** - * Reverses the columns in the given Array Matrix. + * @classdesc + * The Rope Pipeline is a variation of the Multi Pipeline that uses a `TRIANGLE_STRIP` for + * its topology, instead of TRIANGLES. This is primarily used by the Rope Game Object, + * or anything that extends it. * - * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) - * have the same length. There must be at least two rows. This is an example matrix: + * Prior to Phaser v3.50 this pipeline was called the `TextureTintStripPipeline`. * - * ``` - * [ - * [ 1, 1, 1, 1, 1, 1 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 2, 0, 1, 2, 0, 4 ], - * [ 2, 0, 3, 4, 0, 4 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 3, 3, 3, 3, 3, 3 ] - * ] - * ``` + * The fragment shader it uses can be found in `shaders/src/Multi.frag`. + * The vertex shader it uses can be found in `shaders/src/Multi.vert`. * - * @function Phaser.Utils.Array.Matrix.ReverseColumns - * @since 3.0.0 + * The default shader attributes for this pipeline are: * - * @generic T - * @genericUse {T[][]} - [matrix,$return] + * `inPosition` (vec2, offset 0) + * `inTexCoord` (vec2, offset 8) + * `inTexId` (float, offset 16) + * `inTintEffect` (float, offset 20) + * `inTint` (vec4, offset 24, normalized) * - * @param {T[][]} [matrix] - The array matrix to reverse the columns for. + * The default shader uniforms for this pipeline are: * - * @return {T[][]} The column reversed matrix. + * `uProjectionMatrix` (mat4) + * `uMainSampler` (sampler2D array) + * + * The pipeline is structurally identical to the Multi Pipeline and should be treated as such. + * + * @class RopePipeline + * @extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. */ -var ReverseColumns = function (matrix) -{ - return matrix.reverse(); -}; +var RopePipeline = new Class({ -module.exports = ReverseColumns; + Extends: MultiPipeline, + + initialize: + + function RopePipeline (config) + { + // GLenum 5 = TRIANGLE_STRIP + config.topology = 5; + config.batchSize = GetFastValue(config, 'batchSize', 256); + + MultiPipeline.call(this, config); + } +}); + +module.exports = RopePipeline; /***/ }), -/* 1016 */ -/***/ (function(module, exports) { + +/***/ 51212: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var GetFastValue = __webpack_require__(72632); +var MultiPipeline = __webpack_require__(77310); +var ShaderSourceFS = __webpack_require__(85060); +var ShaderSourceVS = __webpack_require__(18166); +var WebGLPipeline = __webpack_require__(44775); + /** - * Reverses the rows in the given Array Matrix. + * @classdesc + * The Single Pipeline is a special version of the Multi Pipeline that only ever + * uses one texture, bound to texture unit zero. Although not as efficient as the + * Multi Pipeline, it provides an easier way to create custom pipelines that only require + * a single bound texture. * - * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) - * have the same length. There must be at least two rows. This is an example matrix: + * Prior to Phaser v3.50 this pipeline didn't exist, but could be compared to the old `TextureTintPipeline`. * - * ``` - * [ - * [ 1, 1, 1, 1, 1, 1 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 2, 0, 1, 2, 0, 4 ], - * [ 2, 0, 3, 4, 0, 4 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 3, 3, 3, 3, 3, 3 ] - * ] - * ``` + * The fragment shader it uses can be found in `shaders/src/Single.frag`. + * The vertex shader it uses can be found in `shaders/src/Single.vert`. * - * @function Phaser.Utils.Array.Matrix.ReverseRows - * @since 3.0.0 + * The default shader attributes for this pipeline are: * - * @generic T - * @genericUse {T[][]} - [matrix,$return] + * `inPosition` (vec2, offset 0) + * `inTexCoord` (vec2, offset 8) + * `inTexId` (float, offset 16) - this value is always zero in the Single Pipeline + * `inTintEffect` (float, offset 20) + * `inTint` (vec4, offset 24, normalized) * - * @param {T[][]} [matrix] - The array matrix to reverse the rows for. + * The default shader uniforms for this pipeline are: * - * @return {T[][]} The column reversed matrix. + * `uProjectionMatrix` (mat4) + * `uMainSampler` (sampler2D) + * + * @class SinglePipeline + * @extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. */ -var ReverseRows = function (matrix) -{ - for (var i = 0; i < matrix.length; i++) +var SinglePipeline = new Class({ + + Extends: MultiPipeline, + + initialize: + + function SinglePipeline (config) { - matrix[i].reverse(); + config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS), + config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS), + config.forceZero = true; + + MultiPipeline.call(this, config); + }, + + boot: function () + { + WebGLPipeline.prototype.boot.call(this); + + this.set1i('uMainSampler', 0); } - return matrix; -}; +}); -module.exports = ReverseRows; +module.exports = SinglePipeline; /***/ }), -/* 1017 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 60848: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateMatrix = __webpack_require__(147); +var AddBlendFS = __webpack_require__(2529); +var BlendModes = __webpack_require__(95723); +var Class = __webpack_require__(56694); +var ColorMatrix = __webpack_require__(65246); +var ColorMatrixFS = __webpack_require__(37486); +var CopyFS = __webpack_require__(79060); +var GetFastValue = __webpack_require__(72632); +var LinearBlendFS = __webpack_require__(98921); +var QuadVS = __webpack_require__(99365); +var WebGLPipeline = __webpack_require__(44775); /** - * Rotates the array matrix 180 degrees. + * @classdesc + * The Utility Pipeline is a special-use pipeline that belongs to the Pipeline Manager. * - * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) - * have the same length. There must be at least two rows. This is an example matrix: + * It provides 4 shaders and handy associated methods: * - * ``` - * [ - * [ 1, 1, 1, 1, 1, 1 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 2, 0, 1, 2, 0, 4 ], - * [ 2, 0, 3, 4, 0, 4 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 3, 3, 3, 3, 3, 3 ] - * ] - * ``` + * 1) Copy Shader. A fast texture to texture copy shader with optional brightness setting. + * 2) Additive Blend Mode Shader. Blends two textures using an additive blend mode. + * 3) Linear Blend Mode Shader. Blends two textures using a linear blend mode. + * 4) Color Matrix Copy Shader. Draws a texture to a target using a Color Matrix. * - * @function Phaser.Utils.Array.Matrix.Rotate180 - * @since 3.0.0 + * You do not extend this pipeline, but instead get a reference to it from the Pipeline + * Manager via the `setUtility` method. You can also access methods such as `copyFrame` + * directly from the Pipeline Manager. * - * @generic T - * @genericUse {T[][]} - [matrix,$return] + * This pipeline provides methods for manipulating framebuffer backed textures, such as + * copying or blending one texture to another, copying a portion of a texture, additively + * blending two textures, flipping textures and more. * - * @param {T[][]} [matrix] - The array to rotate. + * The default shader attributes for this pipeline are: * - * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. + * `inPosition` (vec2, offset 0) + * `inTexCoord` (vec2, offset 8) + * + * This pipeline has a hard-coded batch size of 1 and a hard coded set of vertices. + * + * @class UtilityPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines + * @constructor + * @since 3.50.0 + * + * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. */ -var Rotate180 = function (matrix) -{ - return RotateMatrix(matrix, 180); -}; +var UtilityPipeline = new Class({ -module.exports = Rotate180; + Extends: WebGLPipeline, + initialize: -/***/ }), -/* 1018 */ -/***/ (function(module, exports, __webpack_require__) { + function UtilityPipeline (config) + { + config.renderTarget = GetFastValue(config, 'renderTarget', [ + { + scale: 1 + }, + { + scale: 1 + }, + { + scale: 0.5 + }, + { + scale: 0.5 + } + ]); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + config.vertShader = GetFastValue(config, 'vertShader', QuadVS); -var RotateMatrix = __webpack_require__(147); + config.shaders = GetFastValue(config, 'shaders', [ + { + name: 'Copy', + fragShader: CopyFS + }, + { + name: 'AddBlend', + fragShader: AddBlendFS + }, + { + name: 'LinearBlend', + fragShader: LinearBlendFS + }, + { + name: 'ColorMatrix', + fragShader: ColorMatrixFS + } + ]); -/** - * Rotates the array matrix to the left (or 90 degrees) - * - * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) - * have the same length. There must be at least two rows. This is an example matrix: - * - * ``` - * [ - * [ 1, 1, 1, 1, 1, 1 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 2, 0, 1, 2, 0, 4 ], - * [ 2, 0, 3, 4, 0, 4 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 3, 3, 3, 3, 3, 3 ] - * ] - * ``` - * - * @function Phaser.Utils.Array.Matrix.RotateLeft - * @since 3.0.0 - * - * @generic T - * @genericUse {T[][]} - [matrix,$return] - * - * @param {T[][]} [matrix] - The array to rotate. - * - * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. - */ -var RotateLeft = function (matrix) -{ - return RotateMatrix(matrix, 90); -}; + config.attributes = GetFastValue(config, 'attributes', [ + { + name: 'inPosition', + size: 2 + }, + { + name: 'inTexCoord', + size: 2 + } + ]); -module.exports = RotateLeft; + config.vertices = [ + -1, -1, 0, 0, + -1, 1, 0, 1, + 1, 1, 1, 1, + -1, -1, 0, 0, + 1, 1, 1, 1, + 1, -1, 1, 0 + ]; + config.batchSize = 1; -/***/ }), -/* 1019 */ -/***/ (function(module, exports, __webpack_require__) { + WebGLPipeline.call(this, config); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A default Color Matrix, used by the Color Matrix Shader when one + * isn't provided. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#colorMatrix + * @type {Phaser.Display.ColorMatrix} + * @since 3.50.0 + */ + this.colorMatrix = new ColorMatrix(); -var RotateMatrix = __webpack_require__(147); + /** + * A reference to the Copy Shader belonging to this Utility Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @default null + * @since 3.50.0 + */ + this.copyShader; -/** - * Rotates the array matrix to the left (or -90 degrees) - * - * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) - * have the same length. There must be at least two rows. This is an example matrix: - * - * ``` - * [ - * [ 1, 1, 1, 1, 1, 1 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 2, 0, 1, 2, 0, 4 ], - * [ 2, 0, 3, 4, 0, 4 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 3, 3, 3, 3, 3, 3 ] - * ] - * ``` - * - * @function Phaser.Utils.Array.Matrix.RotateRight - * @since 3.0.0 - * - * @generic T - * @genericUse {T[][]} - [matrix,$return] - * - * @param {T[][]} [matrix] - The array to rotate. - * - * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. - */ -var RotateRight = function (matrix) -{ - return RotateMatrix(matrix, -90); -}; + /** + * A reference to the Additive Blend Shader belonging to this Utility Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#addShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.50.0 + */ + this.addShader; + + /** + * A reference to the Linear Blend Shader belonging to this Utility Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#linearShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.50.0 + */ + this.linearShader; + + /** + * A reference to the Color Matrix Shader belonging to this Utility Pipeline. + * + * This property is set during the `boot` method. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#colorMatrixShader + * @type {Phaser.Renderer.WebGL.WebGLShader} + * @since 3.50.0 + */ + this.colorMatrixShader; + + /** + * A reference to the Full Frame 1 Render Target. + * + * This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#fullFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.fullFrame1; + + /** + * A reference to the Full Frame 2 Render Target. + * + * This property is set during the `boot` method. + * + * This Render Target is the full size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#fullFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.fullFrame2; + + /** + * A reference to the Half Frame 1 Render Target. + * + * This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#halfFrame1 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.halfFrame1; + + /** + * A reference to the Half Frame 2 Render Target. + * + * This property is set during the `boot` method. + * + * This Render Target is half the size of the renderer. + * + * You can use this directly in Post FX Pipelines for multi-target effects. + * However, be aware that these targets are shared between all post fx pipelines. + * + * @name Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#halfFrame2 + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.50.0 + */ + this.halfFrame2; + }, + + boot: function () + { + WebGLPipeline.prototype.boot.call(this); + + var shaders = this.shaders; + var targets = this.renderTargets; -module.exports = RotateRight; + this.copyShader = shaders[0]; + this.addShader = shaders[1]; + this.linearShader = shaders[2]; + this.colorMatrixShader = shaders[3]; + this.fullFrame1 = targets[0]; + this.fullFrame2 = targets[1]; + this.halfFrame1 = targets[2]; + this.halfFrame2 = targets[3]; + }, -/***/ }), -/* 1020 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Copy the `source` Render Target to the `target` Render Target. + * + * You can optionally set the brightness factor of the copy. + * + * The difference between this method and `drawFrame` is that this method + * uses a faster copy shader, where only the brightness can be modified. + * If you need color level manipulation, see `drawFrame` instead. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [brightness=1] - The brightness value applied to the frame copy. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + copyFrame: function (source, target, brightness, clear, clearAlpha) + { + if (brightness === undefined) { brightness = 1; } + if (clear === undefined) { clear = true; } + if (clearAlpha === undefined) { clearAlpha = true; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var gl = this.gl; -var RotateLeft = __webpack_require__(178); -var RotateRight = __webpack_require__(179); + this.setShader(this.copyShader); -/** - * Translates the given Array Matrix by shifting each column and row the - * amount specified. - * - * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) - * have the same length. There must be at least two rows. This is an example matrix: - * - * ``` - * [ - * [ 1, 1, 1, 1, 1, 1 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 2, 0, 1, 2, 0, 4 ], - * [ 2, 0, 3, 4, 0, 4 ], - * [ 2, 0, 0, 0, 0, 4 ], - * [ 3, 3, 3, 3, 3, 3 ] - * ] - * ``` - * - * @function Phaser.Utils.Array.Matrix.Translate - * @since 3.50.0 - * - * @generic T - * @genericUse {T[][]} - [matrix,$return] - * - * @param {T[][]} [matrix] - The array matrix to translate. - * @param {number} [x=0] - The amount to horizontally translate the matrix by. - * @param {number} [y=0] - The amount to vertically translate the matrix by. - * - * @return {T[][]} The translated matrix. - */ -var TranslateMatrix = function (matrix, x, y) -{ - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } + this.set1i('uMainSampler', 0); + this.set1f('uBrightness', brightness); - // Vertical translation + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); - if (y !== 0) - { - if (y < 0) + if (target) { - // Shift Up - RotateLeft(matrix, Math.abs(y)); + gl.viewport(0, 0, target.width, target.height); + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); } else { - // Shift Down - RotateRight(matrix, y); + gl.viewport(0, 0, source.width, source.height); } - } - - // Horizontal translation - if (x !== 0) - { - for (var i = 0; i < matrix.length; i++) + if (clear) { - var row = matrix[i]; - - if (x < 0) + if (clearAlpha) { - RotateLeft(row, Math.abs(x)); + gl.clearColor(0, 0, 0, 0); } else { - RotateRight(row, x); + gl.clearColor(0, 0, 0, 1); } + + gl.clear(gl.COLOR_BUFFER_BIT); } - } - return matrix; -}; + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); -module.exports = TranslateMatrix; + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindTexture(gl.TEXTURE_2D, null); + }, + + /** + * Copy the `source` Render Target to the `target` Render Target. + * + * The difference with this copy is that no resizing takes place. If the `source` + * Render Target is larger than the `target` then only a portion the same size as + * the `target` dimensions is copied across. + * + * You can optionally set the brightness factor of the copy. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#blitFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. + * @param {number} [brightness=1] - The brightness value applied to the frame copy. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {boolean} [eraseMode=false] - Erase source from target using ERASE Blend Mode? + * @param {boolean} [flipY=false] - Flip the UV on the Y axis before drawing? + */ + blitFrame: function (source, target, brightness, clear, clearAlpha, eraseMode, flipY) + { + if (brightness === undefined) { brightness = 1; } + if (clear === undefined) { clear = true; } + if (clearAlpha === undefined) { clearAlpha = true; } + if (eraseMode === undefined) { eraseMode = false; } + if (flipY === undefined) { flipY = false; } + var gl = this.gl; -/***/ }), -/* 1021 */ -/***/ (function(module, exports) { + this.setShader(this.copyShader); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.set1i('uMainSampler', 0); + this.set1f('uBrightness', brightness); -/** - * Adds the given item, or array of items, to the array. - * - * Each item must be unique within the array. - * - * The array is modified in-place and returned. - * - * You can optionally specify a limit to the maximum size of the array. If the quantity of items being - * added will take the array length over this limit, it will stop adding once the limit is reached. - * - * You can optionally specify a callback to be invoked for each item successfully added to the array. - * - * @function Phaser.Utils.Array.Add - * @since 3.4.0 - * - * @param {array} array - The array to be added to. - * @param {any|any[]} item - The item, or array of items, to add to the array. Each item must be unique within the array. - * @param {number} [limit] - Optional limit which caps the size of the array. - * @param {function} [callback] - A callback to be invoked for each item successfully added to the array. - * @param {object} [context] - The context in which the callback is invoked. - * - * @return {array} The input array. - */ -var Add = function (array, item, limit, callback, context) -{ - if (context === undefined) { context = array; } + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); - if (limit > 0) - { - var remaining = limit - array.length; + if (source.height > target.height) + { + gl.viewport(0, 0, source.width, source.height); - // There's nothing more we can do here, the array is full - if (remaining <= 0) + this.setTargetUVs(source, target); + } + else { - return null; + var diff = target.height - source.height; + + gl.viewport(0, diff, source.width, source.height); } - } - // Fast path to avoid array mutation and iteration - if (!Array.isArray(item)) - { - if (array.indexOf(item) === -1) - { - array.push(item); + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); - if (callback) + if (clear) + { + if (clearAlpha) { - callback.call(context, item); + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); } - return item; + gl.clear(gl.COLOR_BUFFER_BIT); } - else + + if (eraseMode) { - return null; + var blendMode = this.renderer.currentBlendMode; + + this.renderer.setBlendMode(BlendModes.ERASE); } - } - // If we got this far, we have an array of items to insert + if (flipY) + { + this.flipY(); + } - // Ensure all the items are unique - var itemLength = item.length - 1; + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); - while (itemLength >= 0) - { - if (array.indexOf(item[itemLength]) !== -1) + if (eraseMode) { - // Already exists in array, so remove it - item.splice(itemLength, 1); + this.renderer.setBlendMode(blendMode); } - itemLength--; - } - - // Anything left? - itemLength = item.length; + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindTexture(gl.TEXTURE_2D, null); - if (itemLength === 0) - { - return null; - } + this.resetUVs(); + }, - if (limit > 0 && itemLength > remaining) + /** + * Binds the `source` Render Target and then copies a section of it to the `target` Render Target. + * + * This method is extremely fast because it uses `gl.copyTexSubImage2D` and doesn't + * require the use of any shaders. Remember the coordinates are given in standard WebGL format, + * where x and y specify the lower-left corner of the section, not the top-left. Also, the + * copy entirely replaces the contents of the target texture, no 'merging' or 'blending' takes + * place. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyFrameRect + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. + * @param {number} x - The x coordinate of the lower left corner where to start copying. + * @param {number} y - The y coordinate of the lower left corner where to start copying. + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {boolean} [clear=true] - Clear the target before copying? + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + copyFrameRect: function (source, target, x, y, width, height, clear, clearAlpha) { - item.splice(remaining); - - itemLength = remaining; - } + if (clear === undefined) { clear = true; } + if (clearAlpha === undefined) { clearAlpha = true; } - for (var i = 0; i < itemLength; i++) - { - var entry = item[i]; + var gl = this.gl; - array.push(entry); + gl.bindFramebuffer(gl.FRAMEBUFFER, source.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, source.texture, 0); - if (callback) + if (clear) { - callback.call(context, entry); + if (clearAlpha) + { + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); + } + + gl.clear(gl.COLOR_BUFFER_BIT); } - } - return item; -}; + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, target.texture); -module.exports = Add; + gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, x, y, width, height); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindTexture(gl.TEXTURE_2D, null); + }, -/***/ }), -/* 1022 */ -/***/ (function(module, exports) { + /** + * Pops the framebuffer from the renderers FBO stack and sets that as the active target, + * then draws the `source` Render Target to it. It then resets the renderer textures. + * + * This should be done when you need to draw the _final_ results of a pipeline to the game + * canvas, or the next framebuffer in line on the FBO stack. You should only call this once + * in the `onDraw` handler and it should be the final thing called. Be careful not to call + * this if you need to actually use the pipeline shader, instead of the copy shader. In + * those cases, use the `bindAndDraw` method. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyToGame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. + */ + copyToGame: function (source) + { + var gl = this.gl; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.setShader(this.copyShader); -/** - * Adds the given item, or array of items, to the array starting at the index specified. - * - * Each item must be unique within the array. - * - * Existing elements in the array are shifted up. - * - * The array is modified in-place and returned. - * - * You can optionally specify a limit to the maximum size of the array. If the quantity of items being - * added will take the array length over this limit, it will stop adding once the limit is reached. - * - * You can optionally specify a callback to be invoked for each item successfully added to the array. - * - * @function Phaser.Utils.Array.AddAt - * @since 3.4.0 - * - * @param {array} array - The array to be added to. - * @param {any|any[]} item - The item, or array of items, to add to the array. - * @param {number} [index=0] - The index in the array where the item will be inserted. - * @param {number} [limit] - Optional limit which caps the size of the array. - * @param {function} [callback] - A callback to be invoked for each item successfully added to the array. - * @param {object} [context] - The context in which the callback is invoked. - * - * @return {array} The input array. - */ -var AddAt = function (array, item, index, limit, callback, context) -{ - if (index === undefined) { index = 0; } - if (context === undefined) { context = array; } + this.set1i('uMainSampler', 0); + this.set1f('uBrightness', 1); - if (limit > 0) - { - var remaining = limit - array.length; + this.renderer.popFramebuffer(); - // There's nothing more we can do here, the array is full - if (remaining <= 0) - { - return null; - } - } + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); - // Fast path to avoid array mutation and iteration - if (!Array.isArray(item)) + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); + }, + + /** + * Copy the `source` Render Target to the `target` Render Target, using the + * given Color Matrix. + * + * The difference between this method and `copyFrame` is that this method + * uses a color matrix shader, where you have full control over the luminance + * values used during the copy. If you don't need this, you can use the faster + * `copyFrame` method instead. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#drawFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {Phaser.Display.ColorMatrix} [colorMatrix] - The Color Matrix to use when performing the draw. + */ + drawFrame: function (source, target, clearAlpha, colorMatrix) { - if (array.indexOf(item) === -1) - { - array.splice(index, 0, item); + if (clearAlpha === undefined) { clearAlpha = true; } + if (colorMatrix === undefined) { colorMatrix = this.colorMatrix; } - if (callback) - { - callback.call(context, item); - } + var gl = this.gl; - return item; + this.setShader(this.colorMatrixShader); + + this.set1i('uMainSampler', 0); + this.set1fv('uColorMatrix', colorMatrix.getData()); + this.set1f('uAlpha', colorMatrix.alpha); + + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source.texture); + + if (target) + { + gl.viewport(0, 0, target.width, target.height); + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); } else { - return null; + gl.viewport(0, 0, source.width, source.height); } - } - // If we got this far, we have an array of items to insert - - // Ensure all the items are unique - var itemLength = item.length - 1; - - while (itemLength >= 0) - { - if (array.indexOf(item[itemLength]) !== -1) + if (clearAlpha) { - // Already exists in array, so remove it - item.pop(); + gl.clearColor(0, 0, 0, 0); } - - itemLength--; - } - - // Anything left? - itemLength = item.length; - - if (itemLength === 0) - { - return null; - } - - // Truncate to the limit - if (limit > 0 && itemLength > remaining) - { - item.splice(remaining); - - itemLength = remaining; - } - - for (var i = itemLength - 1; i >= 0; i--) - { - var entry = item[i]; - - array.splice(index, 0, entry); - - if (callback) + else { - callback.call(context, entry); + gl.clearColor(0, 0, 0, 1); } - } - - return item; -}; - -module.exports = AddAt; + gl.clear(gl.COLOR_BUFFER_BIT); -/***/ }), -/* 1023 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); -/** - * Moves the given element to the top of the array. - * The array is modified in-place. - * - * @function Phaser.Utils.Array.BringToTop - * @since 3.4.0 - * - * @param {array} array - The array. - * @param {*} item - The element to move. - * - * @return {*} The element that was moved. - */ -var BringToTop = function (array, item) -{ - var currentIndex = array.indexOf(item); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindTexture(gl.TEXTURE_2D, null); + }, - if (currentIndex !== -1 && currentIndex < array.length) + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using a linear blend effect, which is controlled by the `strength` parameter. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#blendFrames + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @param {Phaser.Renderer.WebGL.WebGLShader} [blendShader] - The shader to use during the blend copy. + */ + blendFrames: function (source1, source2, target, strength, clearAlpha, blendShader) { - array.splice(currentIndex, 1); - array.push(item); - } - - return item; -}; - -module.exports = BringToTop; - + if (strength === undefined) { strength = 1; } + if (clearAlpha === undefined) { clearAlpha = true; } + if (blendShader === undefined) { blendShader = this.linearShader; } -/***/ }), -/* 1024 */ -/***/ (function(module, exports, __webpack_require__) { + var gl = this.gl; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.setShader(blendShader); -var SafeRange = __webpack_require__(78); + this.set1i('uMainSampler1', 0); + this.set1i('uMainSampler2', 1); + this.set1f('uStrength', strength); -/** - * Returns the total number of elements in the array which have a property matching the given value. - * - * @function Phaser.Utils.Array.CountAllMatching - * @since 3.4.0 - * - * @param {array} array - The array to search. - * @param {string} property - The property to test on each array element. - * @param {*} value - The value to test the property against. Must pass a strict (`===`) comparison check. - * @param {number} [startIndex] - An optional start index to search from. - * @param {number} [endIndex] - An optional end index to search to. - * - * @return {number} The total number of elements with properties matching the given value. - */ -var CountAllMatching = function (array, property, value, startIndex, endIndex) -{ - if (startIndex === undefined) { startIndex = 0; } - if (endIndex === undefined) { endIndex = array.length; } + gl.activeTexture(gl.TEXTURE0); + gl.bindTexture(gl.TEXTURE_2D, source1.texture); - var total = 0; + gl.activeTexture(gl.TEXTURE1); + gl.bindTexture(gl.TEXTURE_2D, source2.texture); - if (SafeRange(array, startIndex, endIndex)) - { - for (var i = startIndex; i < endIndex; i++) + if (target) { - var child = array[i]; - - if (child[property] === value) - { - total++; - } + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); + gl.viewport(0, 0, target.width, target.height); + } + else + { + gl.viewport(0, 0, source1.width, source1.height); } - } - - return total; -}; - -module.exports = CountAllMatching; + if (clearAlpha) + { + gl.clearColor(0, 0, 0, 0); + } + else + { + gl.clearColor(0, 0, 0, 1); + } -/***/ }), -/* 1025 */ -/***/ (function(module, exports) { + gl.clear(gl.COLOR_BUFFER_BIT); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); + gl.drawArrays(gl.TRIANGLES, 0, 6); -/** - * Passes each element in the array to the given callback. - * - * @function Phaser.Utils.Array.Each - * @since 3.4.0 - * - * @param {array} array - The array to search. - * @param {function} callback - A callback to be invoked for each item in the array. - * @param {object} context - The context in which the callback is invoked. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the current array item. - * - * @return {array} The input array. - */ -var Each = function (array, callback, context) -{ - var i; - var args = [ null ]; + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindTexture(gl.TEXTURE_2D, null); + }, - for (i = 3; i < arguments.length; i++) + /** + * Draws the `source1` and `source2` Render Targets to the `target` Render Target + * using an additive blend effect, which is controlled by the `strength` parameter. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#blendFramesAdditive + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. + * @param {number} [strength=1] - The strength of the blend. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + blendFramesAdditive: function (source1, source2, target, strength, clearAlpha) { - args.push(arguments[i]); - } + this.blendFrames(source1, source2, target, strength, clearAlpha, this.addShader); + }, - for (i = 0; i < array.length; i++) + /** + * Clears the given Render Target. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#clearFrame + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The Render Target to clear. + * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + */ + clearFrame: function (target, clearAlpha) { - args[0] = array[i]; - - callback.apply(context, args); - } - - return array; -}; - -module.exports = Each; - - -/***/ }), -/* 1026 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (clearAlpha === undefined) { clearAlpha = true; } -var SafeRange = __webpack_require__(78); + var gl = this.gl; -/** - * Passes each element in the array, between the start and end indexes, to the given callback. - * - * @function Phaser.Utils.Array.EachInRange - * @since 3.4.0 - * - * @param {array} array - The array to search. - * @param {function} callback - A callback to be invoked for each item in the array. - * @param {object} context - The context in which the callback is invoked. - * @param {number} startIndex - The start index to search from. - * @param {number} endIndex - The end index to search to. - * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. - * - * @return {array} The input array. - */ -var EachInRange = function (array, callback, context, startIndex, endIndex) -{ - if (startIndex === undefined) { startIndex = 0; } - if (endIndex === undefined) { endIndex = array.length; } + gl.viewport(0, 0, target.width, target.height); - if (SafeRange(array, startIndex, endIndex)) - { - var i; - var args = [ null ]; + gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); - for (i = 5; i < arguments.length; i++) + if (clearAlpha) { - args.push(arguments[i]); + gl.clearColor(0, 0, 0, 0); } - - for (i = startIndex; i < endIndex; i++) + else { - args[0] = array[i]; - - callback.apply(context, args); + gl.clearColor(0, 0, 0, 1); } - } - - return array; -}; -module.exports = EachInRange; - - -/***/ }), -/* 1027 */ -/***/ (function(module, exports) { + gl.clear(gl.COLOR_BUFFER_BIT); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var fbo = this.renderer.currentFramebuffer; -/** - * Moves the given array element down one place in the array. - * The array is modified in-place. - * - * @function Phaser.Utils.Array.MoveDown - * @since 3.4.0 - * - * @param {array} array - The input array. - * @param {*} item - The element to move down the array. - * - * @return {array} The input array. - */ -var MoveDown = function (array, item) -{ - var currentIndex = array.indexOf(item); + gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); + }, - if (currentIndex > 0) + /** + * Set the UV values for the 6 vertices that make up the quad used by the shaders + * in the Utility Pipeline. + * + * Be sure to call `resetUVs` once you have finished manipulating the UV coordinates. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#setUVs + * @since 3.50.0 + * + * @param {number} uA - The u value of vertex A. + * @param {number} vA - The v value of vertex A. + * @param {number} uB - The u value of vertex B. + * @param {number} vB - The v value of vertex B. + * @param {number} uC - The u value of vertex C. + * @param {number} vC - The v value of vertex C. + * @param {number} uD - The u value of vertex D. + * @param {number} vD - The v value of vertex D. + */ + setUVs: function (uA, vA, uB, vB, uC, vC, uD, vD) { - var item2 = array[currentIndex - 1]; - - var index2 = array.indexOf(item2); - - array[currentIndex] = item2; - array[index2] = item; - } - - return array; -}; - -module.exports = MoveDown; + var vertexViewF32 = this.vertexViewF32; + vertexViewF32[2] = uA; + vertexViewF32[3] = vA; + vertexViewF32[6] = uB; + vertexViewF32[7] = vB; + vertexViewF32[10] = uC; + vertexViewF32[11] = vC; + vertexViewF32[14] = uA; + vertexViewF32[15] = vA; + vertexViewF32[18] = uC; + vertexViewF32[19] = vC; + vertexViewF32[22] = uD; + vertexViewF32[23] = vD; + }, -/***/ }), -/* 1028 */ -/***/ (function(module, exports) { + /** + * Sets the vertex UV coordinates of the quad used by the shaders in the Utility Pipeline + * so that they correctly adjust the texture coordinates for a blit frame effect. + * + * Be sure to call `resetUVs` once you have finished manipulating the UV coordinates. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#setTargetUVs + * @since 3.50.0 + * + * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. + * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. + */ + setTargetUVs: function (source, target) + { + var diff = (target.height / source.height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (diff > 0.5) + { + diff = 0.5 - (diff - 0.5); + } + else + { + diff = 0.5 + (0.5 - diff); + } -/** - * Moves an element in an array to a new position within the same array. - * The array is modified in-place. - * - * @function Phaser.Utils.Array.MoveTo - * @since 3.4.0 - * - * @param {array} array - The array. - * @param {*} item - The element to move. - * @param {number} index - The new index that the element will be moved to. - * - * @return {*} The element that was moved. - */ -var MoveTo = function (array, item, index) -{ - var currentIndex = array.indexOf(item); + this.setUVs(0, diff, 0, 1 + diff, 1, 1 + diff, 1, diff); + }, - if (currentIndex === -1 || index < 0 || index >= array.length) + /** + * Horizontally flips the UV coordinates of the quad used by the shaders in this + * Utility Pipeline. + * + * Be sure to call `resetUVs` once you have finished manipulating the UV coordinates. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#flipX + * @since 3.50.0 + */ + flipX: function () { - throw new Error('Supplied index out of bounds'); - } + this.setUVs(1, 0, 1, 1, 0, 1, 0, 0); + }, - if (currentIndex !== index) + /** + * Vertically flips the UV coordinates of the quad used by the shaders in this + * Utility Pipeline. + * + * Be sure to call `resetUVs` once you have finished manipulating the UV coordinates. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#flipY + * @since 3.50.0 + */ + flipY: function () { - // Remove - array.splice(currentIndex, 1); + this.setUVs(0, 1, 0, 0, 1, 0, 1, 1); + }, - // Add in new location - array.splice(index, 0, item); + /** + * Resets the quad vertice UV values to their default settings. + * + * The quad is used by all shaders of the Utility Pipeline. + * + * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#resetUVs + * @since 3.50.0 + */ + resetUVs: function () + { + this.setUVs(0, 0, 0, 1, 1, 1, 1, 0); } - return item; -}; +}); -module.exports = MoveTo; +module.exports = UtilityPipeline; /***/ }), -/* 1029 */ -/***/ (function(module, exports) { + +/***/ 65641: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * Moves the given array element up one place in the array. - * The array is modified in-place. - * - * @function Phaser.Utils.Array.MoveUp - * @since 3.4.0 - * - * @param {array} array - The input array. - * @param {*} item - The element to move up the array. - * - * @return {array} The input array. - */ -var MoveUp = function (array, item) -{ - var currentIndex = array.indexOf(item); - - if (currentIndex !== -1 && currentIndex < array.length - 1) - { - // The element one above `item` in the array - var item2 = array[currentIndex + 1]; - var index2 = array.indexOf(item2); - - array[currentIndex] = item2; - array[index2] = item; - } +var PIPELINE_CONST = { - return array; -}; + /** + * The Bitmap Mask Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.BITMAPMASK_PIPELINE + * @type {string} + * @const + * @since 3.50.0 + */ + BITMAPMASK_PIPELINE: 'BitmapMaskPipeline', -module.exports = MoveUp; + /** + * The Light 2D Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.LIGHT_PIPELINE + * @type {string} + * @const + * @since 3.50.0 + */ + LIGHT_PIPELINE: 'Light2D', + /** + * The Point Light Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.POINTLIGHT_PIPELINE + * @type {string} + * @const + * @since 3.50.0 + */ + POINTLIGHT_PIPELINE: 'PointLightPipeline', -/***/ }), -/* 1030 */ -/***/ (function(module, exports) { + /** + * The Single Texture Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.SINGLE_PIPELINE + * @type {string} + * @const + * @since 3.50.0 + */ + SINGLE_PIPELINE: 'SinglePipeline', -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The Multi Texture Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.MULTI_PIPELINE + * @type {string} + * @const + * @since 3.50.0 + */ + MULTI_PIPELINE: 'MultiPipeline', -/** - * Moves the given array element above another one in the array. - * The array is modified in-place. - * - * @function Phaser.Utils.Array.MoveAbove - * @since 3.55.0 - * - * @param {array} array - The input array. - * @param {*} item1 - The element to move above base element. - * @param {*} item2 - The base element. - * - * - * @return {array} The input array. - */ -var MoveAbove = function (array, item1, item2) -{ - if (item1 === item2) - { - return array; - } + /** + * The Rope Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.ROPE_PIPELINE + * @type {string} + * @const + * @since 3.50.0 + */ + ROPE_PIPELINE: 'RopePipeline', - var currentIndex = array.indexOf(item1); - var baseIndex = array.indexOf(item2); + /** + * The Graphics and Shapes Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.GRAPHICS_PIPELINE + * @type {string} + * @const + * @since 3.50.0 + */ + GRAPHICS_PIPELINE: 'GraphicsPipeline', - if (currentIndex < 0 || baseIndex < 0) - { - throw new Error('Supplied items must be elements of the same array'); - } + /** + * The Post FX Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.POSTFX_PIPELINE + * @type {string} + * @const + * @since 3.50.0 + */ + POSTFX_PIPELINE: 'PostFXPipeline', - if (currentIndex > baseIndex) - { - // item1 is already above item2 - return array; - } + /** + * The Utility Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.UTILITY_PIPELINE + * @type {string} + * @const + * @since 3.50.0 + */ + UTILITY_PIPELINE: 'UtilityPipeline', - // Remove - array.splice(currentIndex, 1); + /** + * The Mobile Texture Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.MOBILE_PIPELINE + * @type {string} + * @const + * @since 3.60.0 + */ + MOBILE_PIPELINE: 'MobilePipeline', - // Add in new location - if (baseIndex === array.length - 1) - { - array.push(item1); - } - else - { - array.splice(baseIndex, 0, item1); - } + /** + * The Special FX Pipeline. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX_PIPELINE + * @type {string} + * @const + * @since 3.60.0 + */ + FX_PIPELINE: 'FxPipeline' - return array; }; -module.exports = MoveAbove; +module.exports = PIPELINE_CONST; /***/ }), -/* 1031 */ -/***/ (function(module, exports) { + +/***/ 68726: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Moves the given array element below another one in the array. - * The array is modified in-place. + * The WebGLPipeline After Flush Event. * - * @function Phaser.Utils.Array.MoveBelow - * @since 3.55.0 + * This event is dispatched by a WebGLPipeline right after it has issued a drawArrays command + * and cleared its vertex count. * - * @param {array} array - The input array. - * @param {*} item1 - The element to move below base element. - * @param {*} item2 - The base element. - * + * @event Phaser.Renderer.WebGL.Pipelines.Events#AFTER_FLUSH + * @since 3.50.0 * - * @return {array} The input array. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that has flushed. + * @param {boolean} isPostFlush - Was this flush invoked as part of a post-process, or not? */ -var MoveBelow = function (array, item1, item2) -{ - if (item1 === item2) - { - return array; - } - - var currentIndex = array.indexOf(item1); - var baseIndex = array.indexOf(item2); - - if (currentIndex < 0 || baseIndex < 0) - { - throw new Error('Supplied items must be elements of the same array'); - } - - if (currentIndex < baseIndex) - { - // item1 is already below item2 - return array; - } - - // Remove - array.splice(currentIndex, 1); - - // Add in new location - if (baseIndex === 0) - { - array.unshift(item1); - } - else - { - array.splice(baseIndex, 0, item1); - } - - return array; -}; - -module.exports = MoveBelow; +module.exports = 'pipelineafterflush'; /***/ }), -/* 1032 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 67186: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RoundAwayFromZero = __webpack_require__(363); - /** - * Create an array of numbers (positive and/or negative) progressing from `start` - * up to but not including `end` by advancing by `step`. - * - * If `start` is less than `end` a zero-length range is created unless a negative `step` is specified. - * - * Certain values for `start` and `end` (eg. NaN/undefined/null) are currently coerced to 0; - * for forward compatibility make sure to pass in actual numbers. - * - * @example - * NumberArrayStep(4); - * // => [0, 1, 2, 3] - * - * NumberArrayStep(1, 5); - * // => [1, 2, 3, 4] - * - * NumberArrayStep(0, 20, 5); - * // => [0, 5, 10, 15] - * - * NumberArrayStep(0, -4, -1); - * // => [0, -1, -2, -3] - * - * NumberArrayStep(1, 4, 0); - * // => [1, 1, 1] - * - * NumberArrayStep(0); - * // => [] + * The WebGLPipeline Before Flush Event. * - * @function Phaser.Utils.Array.NumberArrayStep - * @since 3.0.0 + * This event is dispatched by a WebGLPipeline right before it is about to + * flush and issue a bufferData and drawArrays command. * - * @param {number} [start=0] - The start of the range. - * @param {number} [end=null] - The end of the range. - * @param {number} [step=1] - The value to increment or decrement by. + * @event Phaser.Renderer.WebGL.Pipelines.Events#BEFORE_FLUSH + * @since 3.50.0 * - * @return {number[]} The array of number values. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that is about to flush. + * @param {boolean} isPostFlush - Was this flush invoked as part of a post-process, or not? */ -var NumberArrayStep = function (start, end, step) -{ - if (start === undefined) { start = 0; } - if (end === undefined) { end = null; } - if (step === undefined) { step = 1; } - - if (end === null) - { - end = start; - start = 0; - } - - var result = []; - - var total = Math.max(RoundAwayFromZero((end - start) / (step || 1)), 0); - - for (var i = 0; i < total; i++) - { - result.push(start); - start += step; - } - - return result; -}; - -module.exports = NumberArrayStep; +module.exports = 'pipelinebeforeflush'; /***/ }), -/* 1033 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 22709: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SpliceOne = __webpack_require__(74); - /** - * Removes the item from the given position in the array. - * - * The array is modified in-place. - * - * You can optionally specify a callback to be invoked for the item if it is successfully removed from the array. + * The WebGLPipeline Bind Event. * - * @function Phaser.Utils.Array.RemoveAt - * @since 3.4.0 + * This event is dispatched by a WebGLPipeline when it is bound by the Pipeline Manager. * - * @param {array} array - The array to be modified. - * @param {number} index - The array index to remove the item from. The index must be in bounds or it will throw an error. - * @param {function} [callback] - A callback to be invoked for the item removed from the array. - * @param {object} [context] - The context in which the callback is invoked. + * @event Phaser.Renderer.WebGL.Pipelines.Events#BIND + * @since 3.50.0 * - * @return {*} The item that was removed. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that was bound. + * @param {Phaser.Renderer.WebGL.WebGLShader} currentShader - The shader that was set as being current. */ -var RemoveAt = function (array, index, callback, context) -{ - if (context === undefined) { context = array; } - - if (index < 0 || index > array.length - 1) - { - throw new Error('Index out of bounds'); - } - - var item = SpliceOne(array, index); - - if (callback) - { - callback.call(context, item); - } - - return item; -}; - -module.exports = RemoveAt; +module.exports = 'pipelinebind'; /***/ }), -/* 1034 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 74469: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(78); - /** - * Removes the item within the given range in the array. - * - * The array is modified in-place. - * - * You can optionally specify a callback to be invoked for the item/s successfully removed from the array. + * The WebGLPipeline Boot Event. * - * @function Phaser.Utils.Array.RemoveBetween - * @since 3.4.0 + * This event is dispatched by a WebGLPipeline when it has completed its `boot` phase. * - * @param {array} array - The array to be modified. - * @param {number} startIndex - The start index to remove from. - * @param {number} endIndex - The end index to remove to. - * @param {function} [callback] - A callback to be invoked for the item removed from the array. - * @param {object} [context] - The context in which the callback is invoked. + * @event Phaser.Renderer.WebGL.Pipelines.Events#BOOT + * @since 3.50.0 * - * @return {Array.<*>} An array of items that were removed. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that booted. */ -var RemoveBetween = function (array, startIndex, endIndex, callback, context) -{ - if (startIndex === undefined) { startIndex = 0; } - if (endIndex === undefined) { endIndex = array.length; } - if (context === undefined) { context = array; } - - if (SafeRange(array, startIndex, endIndex)) - { - var size = endIndex - startIndex; - - var removed = array.splice(startIndex, size); - - if (callback) - { - for (var i = 0; i < removed.length; i++) - { - var entry = removed[i]; - - callback.call(context, entry); - } - } - - return removed; - } - else - { - return []; - } -}; - -module.exports = RemoveBetween; +module.exports = 'pipelineboot'; /***/ }), -/* 1035 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 93953: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SpliceOne = __webpack_require__(74); - /** - * Removes a random object from the given array and returns it. - * Will return null if there are no array items that fall within the specified range or if there is no item for the randomly chosen index. + * The WebGLPipeline Destroy Event. * - * @function Phaser.Utils.Array.RemoveRandomElement - * @since 3.0.0 + * This event is dispatched by a WebGLPipeline when it is starting its destroy process. * - * @param {array} array - The array to removed a random element from. - * @param {number} [start=0] - The array index to start the search from. - * @param {number} [length=array.length] - Optional restriction on the number of elements to randomly select from. + * @event Phaser.Renderer.WebGL.Pipelines.Events#DESTROY + * @since 3.50.0 * - * @return {object} The random element that was removed, or `null` if there were no array elements that fell within the given range. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that has flushed. */ -var RemoveRandomElement = function (array, start, length) -{ - if (start === undefined) { start = 0; } - if (length === undefined) { length = array.length; } - - var randomIndex = start + Math.floor(Math.random() * length); - - return SpliceOne(array, randomIndex); -}; - -module.exports = RemoveRandomElement; +module.exports = 'pipelinedestroy'; /***/ }), -/* 1036 */ -/***/ (function(module, exports) { + +/***/ 51687: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Replaces an element of the array with the new element. - * The new element cannot already be a member of the array. - * The array is modified in-place. + * The WebGLPipeline ReBind Event. * - * @function Phaser.Utils.Array.Replace - * @since 3.4.0 + * This event is dispatched by a WebGLPipeline when it is re-bound by the Pipeline Manager. * - * @param {array} array - The array to search within. - * @param {*} oldChild - The element in the array that will be replaced. - * @param {*} newChild - The element to be inserted into the array at the position of `oldChild`. + * @event Phaser.Renderer.WebGL.Pipelines.Events#REBIND + * @since 3.50.0 * - * @return {boolean} Returns true if the oldChild was successfully replaced, otherwise returns false. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that was rebound. + * @param {Phaser.Renderer.WebGL.WebGLShader} currentShader - The shader that was set as being current. */ -var Replace = function (array, oldChild, newChild) -{ - var index1 = array.indexOf(oldChild); - var index2 = array.indexOf(newChild); - - if (index1 !== -1 && index2 === -1) - { - array[index1] = newChild; - - return true; - } - else - { - return false; - } -}; - -module.exports = Replace; +module.exports = 'pipelinerebind'; /***/ }), -/* 1037 */ -/***/ (function(module, exports) { + +/***/ 25034: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Moves the given element to the bottom of the array. - * The array is modified in-place. + * The WebGLPipeline Resize Event. * - * @function Phaser.Utils.Array.SendToBack - * @since 3.4.0 + * This event is dispatched by a WebGLPipeline when it is resized, usually as a result + * of the Renderer resizing. * - * @param {array} array - The array. - * @param {*} item - The element to move. + * @event Phaser.Renderer.WebGL.Pipelines.Events#RESIZE + * @since 3.50.0 * - * @return {*} The element that was moved. + * @param {number} width - The new width of the pipeline. + * @param {number} height - The new height of the pipeline. + * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The pipeline that was resized. */ -var SendToBack = function (array, item) -{ - var currentIndex = array.indexOf(item); - - if (currentIndex !== -1 && currentIndex > 0) - { - array.splice(currentIndex, 1); - array.unshift(item); - } - - return item; -}; - -module.exports = SendToBack; +module.exports = 'pipelineresize'; /***/ }), -/* 1038 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 18970: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SafeRange = __webpack_require__(78); - /** - * Scans the array for elements with the given property. If found, the property is set to the `value`. - * - * For example: `SetAll('visible', true)` would set all elements that have a `visible` property to `false`. - * - * Optionally you can specify a start and end index. For example if the array had 100 elements, - * and you set `startIndex` to 0 and `endIndex` to 50, it would update only the first 50 elements. - * - * @function Phaser.Utils.Array.SetAll - * @since 3.4.0 - * - * @param {array} array - The array to search. - * @param {string} property - The property to test for on each array element. - * @param {*} value - The value to set the property to. - * @param {number} [startIndex] - An optional start index to search from. - * @param {number} [endIndex] - An optional end index to search to. - * - * @return {array} The input array. + * @namespace Phaser.Renderer.WebGL.Pipelines.Events */ -var SetAll = function (array, property, value, startIndex, endIndex) -{ - if (startIndex === undefined) { startIndex = 0; } - if (endIndex === undefined) { endIndex = array.length; } - if (SafeRange(array, startIndex, endIndex)) - { - for (var i = startIndex; i < endIndex; i++) - { - var entry = array[i]; +module.exports = { - if (entry.hasOwnProperty(property)) - { - entry[property] = value; - } - } - } + AFTER_FLUSH: __webpack_require__(68726), + BEFORE_FLUSH: __webpack_require__(67186), + BIND: __webpack_require__(22709), + BOOT: __webpack_require__(74469), + DESTROY: __webpack_require__(93953), + REBIND: __webpack_require__(51687), + RESIZE: __webpack_require__(25034) - return array; }; -module.exports = SetAll; - /***/ }), -/* 1039 */ -/***/ (function(module, exports) { + +/***/ 32469: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var BarrelFrag = __webpack_require__(87751); +var PostFXPipeline = __webpack_require__(80486); + /** - * Swaps the position of two elements in the given array. - * The elements must exist in the same array. - * The array is modified in-place. + * @classdesc + * The Barrel FX Pipeline. * - * @function Phaser.Utils.Array.Swap - * @since 3.4.0 + * A barrel effect allows you to apply either a 'pinch' or 'expand' distortion to + * a Game Object. The amount of the effect can be modified in real-time. * - * @param {array} array - The input array. - * @param {*} item1 - The first element to swap. - * @param {*} item2 - The second element to swap. + * A Barrel effect is added to a Game Object via the FX component: * - * @return {array} The input array. + * ```js + * const sprite = this.add.sprite(); + * + * sprite.postFX.addBarrel(); + * ``` + * + * @class BarrelFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. */ -var Swap = function (array, item1, item2) -{ - if (item1 === item2) +var BarrelFXPipeline = new Class({ + + Extends: PostFXPipeline, + + initialize: + + function BarrelFXPipeline (game) { - return array; - } + PostFXPipeline.call(this, { + game: game, + fragShader: BarrelFrag + }); - var index1 = array.indexOf(item1); - var index2 = array.indexOf(item2); + /** + * The amount of distortion applied to the barrel effect. + * + * Typically keep this within the range 1 (no distortion) to +- 1. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BarrelFXPipeline#amount + * @type {number} + * @since 3.60.0 + */ + this.amount = 1; + }, - if (index1 < 0 || index2 < 0) + onPreRender: function (controller, shader) { - throw new Error('Supplied items must be elements of the same array'); - } + controller = this.getController(controller); - array[index1] = item2; - array[index2] = item1; + this.set1f('amount', controller.amount, shader); + } - return array; -}; +}); -module.exports = Swap; +module.exports = BarrelFXPipeline; /***/ }), -/* 1040 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 2134: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var ProcessQueue = __webpack_require__(211); -var PluginCache = __webpack_require__(24); -var SceneEvents = __webpack_require__(20); +var Class = __webpack_require__(56694); +var BloomFrag = __webpack_require__(88222); +var PostFXPipeline = __webpack_require__(80486); /** * @classdesc - * The Update List plugin. + * The Bloom FX Pipeline. * - * Update Lists belong to a Scene and maintain the list Game Objects to be updated every frame. + * Bloom is an effect used to reproduce an imaging artifact of real-world cameras. + * The effect produces fringes of light extending from the borders of bright areas in an image, + * contributing to the illusion of an extremely bright light overwhelming the + * camera or eye capturing the scene. * - * Some or all of these Game Objects may also be part of the Scene's [Display List]{@link Phaser.GameObjects.DisplayList}, for Rendering. + * A Bloom effect is added to a Game Object via the FX component: * - * @class UpdateList - * @extends Phaser.Structs.ProcessQueue. - * @memberof Phaser.GameObjects + * ```js + * const sprite = this.add.sprite(); + * + * sprite.postFX.addBloom(); + * ``` + * + * @class BloomFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX * @constructor - * @since 3.0.0 + * @since 3.60.0 * - * @param {Phaser.Scene} scene - The Scene that the Update List belongs to. + * @param {Phaser.Game} game - A reference to the Phaser Game instance. */ -var UpdateList = new Class({ +var BloomFXPipeline = new Class({ - Extends: ProcessQueue, + Extends: PostFXPipeline, initialize: - function UpdateList (scene) + function BloomFXPipeline (game) { - ProcessQueue.call(this); - - // No duplicates in this list - this.checkQueue = true; + PostFXPipeline.call(this, { + game: game, + fragShader: BloomFrag + }); /** - * The Scene that the Update List belongs to. + * The number of steps to run the Bloom effect for. * - * @name Phaser.GameObjects.UpdateList#scene - * @type {Phaser.Scene} - * @since 3.0.0 + * This value should always be an integer. + * + * It defaults to 4. The higher the value, the smoother the Bloom, + * but at the cost of exponentially more gl operations. + * + * Keep this to the lowest possible number you can have it, while + * still looking correct for your game. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BloomFXPipeline#steps + * @type {number} + * @since 3.60.0 */ - this.scene = scene; + this.steps = 4; /** - * The Scene's Systems. + * The horizontal offset of the bloom effect. * - * @name Phaser.GameObjects.UpdateList#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 + * @name Phaser.Renderer.WebGL.Pipelines.FX.BloomFXPipeline#offsetX + * @type {number} + * @since 3.60.0 */ - this.systems = scene.sys; + this.offsetX = 1; /** - * The `pending` list is a selection of items which are due to be made 'active' in the next update. + * The vertical offset of the bloom effect. * - * @name Phaser.GameObjects.UpdateList#_pending - * @type {Array.<*>} - * @private - * @default [] - * @since 3.20.0 + * @name Phaser.Renderer.WebGL.Pipelines.FX.BloomFXPipeline#offsetY + * @type {number} + * @since 3.60.0 */ + this.offsetY = 1; /** - * The `active` list is a selection of items which are considered active and should be updated. + * The strength of the blur process of the bloom effect. * - * @name Phaser.GameObjects.UpdateList#_active - * @type {Array.<*>} - * @private - * @default [] - * @since 3.20.0 + * @name Phaser.Renderer.WebGL.Pipelines.FX.BloomFXPipeline#blurStrength + * @type {number} + * @since 3.60.0 */ + this.blurStrength = 1; /** - * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. + * The strength of the blend process of the bloom effect. * - * @name Phaser.GameObjects.UpdateList#_destroy - * @type {Array.<*>} - * @private - * @default [] - * @since 3.20.0 + * @name Phaser.Renderer.WebGL.Pipelines.FX.BloomFXPipeline#strength + * @type {number} + * @since 3.60.0 */ + this.strength = 1; /** - * The total number of items awaiting processing. + * The internal gl color array. * - * @name Phaser.GameObjects.UpdateList#_toProcess - * @type {number} - * @private - * @default 0 - * @since 3.0.0 + * @name Phaser.Renderer.WebGL.Pipelines.FX.BloomFXPipeline#glcolor + * @type {number[]} + * @since 3.60.0 */ - - scene.sys.events.once(SceneEvents.BOOT, this.boot, this); - scene.sys.events.on(SceneEvents.START, this.start, this); + this.glcolor = [ 1, 1, 1 ]; }, - /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. - * - * @method Phaser.GameObjects.UpdateList#boot - * @private - * @since 3.5.1 - */ - boot: function () + onPreRender: function (controller) { - this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); + controller = this.getController(controller); + + this.set1f('strength', controller.blurStrength); + this.set3fv('color', controller.glcolor); }, - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. - * - * @method Phaser.GameObjects.UpdateList#start - * @private - * @since 3.5.0 - */ - start: function () + onDraw: function (target1) { - var eventEmitter = this.systems.events; + var controller = this.getController(); - eventEmitter.on(SceneEvents.PRE_UPDATE, this.update, this); - eventEmitter.on(SceneEvents.UPDATE, this.sceneUpdate, this); - eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); - }, + var target2 = this.fullFrame1; + var target3 = this.fullFrame2; - /** - * The update step. - * - * Pre-updates every active Game Object in the list. - * - * @method Phaser.GameObjects.UpdateList#sceneUpdate - * @since 3.20.0 - * - * @param {number} time - The current timestamp. - * @param {number} delta - The delta time elapsed since the last frame. - */ - sceneUpdate: function (time, delta) - { - var list = this._active; - var length = list.length; + this.copyFrame(target1, target3); - for (var i = 0; i < length; i++) + var x = (2 / target1.width) * controller.offsetX; + var y = (2 / target1.height) * controller.offsetY; + + for (var i = 0; i < controller.steps; i++) { - var gameObject = list[i]; + this.set2f('offset', x, 0); + this.copySprite(target1, target2); - if (gameObject.active) - { - gameObject.preUpdate.call(gameObject, time, delta); - } + this.set2f('offset', 0, y); + this.copySprite(target2, target1); } - }, - /** - * The Scene that owns this plugin is shutting down. - * - * We need to kill and reset all internal properties as well as stop listening to Scene events. - * - * @method Phaser.GameObjects.UpdateList#shutdown - * @since 3.0.0 - */ - shutdown: function () - { - var i = this._active.length; + this.blendFrames(target3, target1, target2, controller.strength); - while (i--) - { - this._active[i].destroy(true); - } + this.copyToGame(target2); + } - i = this._pending.length; +}); - while (i--) - { - this._pending[i].destroy(true); - } +module.exports = BloomFXPipeline; - i = this._destroy.length; - while (i--) - { - this._destroy[i].destroy(true); - } +/***/ }), - this._toProcess = 0; +/***/ 63377: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this._pending = []; - this._active = []; - this._destroy = []; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.removeAllListeners(); +var Class = __webpack_require__(56694); +var BlurLowFrag = __webpack_require__(35491); +var BlurMedFrag = __webpack_require__(75568); +var BlurHighFrag = __webpack_require__(44481); +var PostFXPipeline = __webpack_require__(80486); - var eventEmitter = this.systems.events; +/** + * @classdesc + * The Blur FX Pipeline. + * + * A Gaussian blur is the result of blurring an image by a Gaussian function. It is a widely used effect, + * typically to reduce image noise and reduce detail. The visual effect of this blurring technique is a + * smooth blur resembling that of viewing the image through a translucent screen, distinctly different + * from the bokeh effect produced by an out-of-focus lens or the shadow of an object under usual illumination. + * + * A Blur effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.postFX.addBlur(); + * ``` + * + * @class BlurFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. + */ +var BlurFXPipeline = new Class({ - eventEmitter.off(SceneEvents.PRE_UPDATE, this.update, this); - eventEmitter.off(SceneEvents.UPDATE, this.sceneUpdate, this); - eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); - }, + Extends: PostFXPipeline, - /** - * The Scene that owns this plugin is being destroyed. - * - * We need to shutdown and then kill off all external references. - * - * @method Phaser.GameObjects.UpdateList#destroy - * @since 3.0.0 - */ - destroy: function () + initialize: + + function BlurFXPipeline (game) { - this.shutdown(); + PostFXPipeline.call(this, { + game: game, + shaders: [ + { + name: 'Gaussian5', + fragShader: BlurLowFrag + }, + { + name: 'Gaussian9', + fragShader: BlurMedFrag + }, + { + name: 'Gaussian13', + fragShader: BlurHighFrag + } + ] + }); - this.systems.events.off(SceneEvents.START, this.start, this); + this.activeShader = this.shaders[0]; - this.scene = null; - this.systems = null; - } + /** + * The horizontal offset of the blur effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BlurFXPipeline#x + * @type {number} + * @since 3.60.0 + */ + this.x = 2; - /** - * Adds a new item to the Update List. - * - * The item is added to the pending list and made active in the next update. - * - * @method Phaser.GameObjects.UpdateList#add - * @since 3.0.0 - * - * @param {*} item - The item to add to the queue. - * - * @return {*} The item that was added. - */ + /** + * The vertical offset of the blur effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BlurFXPipeline#y + * @type {number} + * @since 3.60.0 + */ + this.y = 2; - /** - * Removes an item from the Update List. - * - * The item is added to the pending destroy and fully removed in the next update. - * - * @method Phaser.GameObjects.UpdateList#remove - * @since 3.0.0 - * - * @param {*} item - The item to be removed from the queue. - * - * @return {*} The item that was removed. - */ + /** + * The number of steps to run the Blur effect for. + * + * This value should always be an integer. + * + * It defaults to 4. The higher the value, the smoother the blur, + * but at the cost of exponentially more gl operations. + * + * Keep this to the lowest possible number you can have it, while + * still looking correct for your game. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BlurFXPipeline#steps + * @type {number} + * @since 3.60.0 + */ + this.steps = 4; + + /** + * The strength of the blur effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BlurFXPipeline#strength + * @type {number} + * @since 3.60.0 + */ + this.strength = 1; + + /** + * The internal gl color array. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BlurFXPipeline#glcolor + * @type {number[]} + * @since 3.60.0 + */ + this.glcolor = [ 1, 1, 1 ]; + }, /** - * Removes all active items from this Update List. + * Sets the quality of the blur effect to low. * - * All the items are marked as 'pending destroy' and fully removed in the next update. - * - * @method Phaser.GameObjects.UpdateList#removeAll - * @since 3.20.0 + * @method Phaser.Renderer.WebGL.Pipelines.FX.BlurFXPipeline#setQualityLow + * @since 3.60.0 * - * @return {this} This Update List object. + * @return {this} This FX Pipeline. */ + setQualityLow: function () + { + this.activeShader = this.shaders[0]; + + return this; + }, /** - * Update this queue. First it will process any items awaiting destruction, and remove them. - * - * Then it will check to see if there are any items pending insertion, and move them to an - * active state. Finally, it will return a list of active items for further processing. + * Sets the quality of the blur effect to medium. * - * @method Phaser.GameObjects.UpdateList#update - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.Pipelines.FX.BlurFXPipeline#setQualityMedium + * @since 3.60.0 * - * @return {Array.<*>} A list of active items. + * @return {this} This FX Pipeline. */ + setQualityMedium: function () + { + this.activeShader = this.shaders[1]; + + return this; + }, /** - * Returns the current list of active items. - * - * This method returns a reference to the active list array, not a copy of it. - * Therefore, be careful to not modify this array outside of the ProcessQueue. + * Sets the quality of the blur effect to high. * - * @method Phaser.GameObjects.UpdateList#getActive - * @since 3.0.0 + * @method Phaser.Renderer.WebGL.Pipelines.FX.BlurFXPipeline#setQualityHigh + * @since 3.60.0 * - * @return {Array.<*>} A list of active items. + * @return {this} This FX Pipeline. */ + setQualityHigh: function () + { + this.activeShader = this.shaders[2]; - /** - * The number of entries in the active list. - * - * @name Phaser.GameObjects.UpdateList#length - * @type {number} - * @readonly - * @since 3.20.0 - */ -}); + return this; + }, -PluginCache.register('UpdateList', UpdateList, 'updateList'); + onDraw: function (target1) + { + var controller = this.getController(); -module.exports = UpdateList; + var gl = this.gl; + var target2 = this.fullFrame1; + var currentFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING); -/***/ }), -/* 1041 */ -/***/ (function(module, exports) { + this.bind(this.activeShader); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + gl.activeTexture(gl.TEXTURE0); + gl.viewport(0, 0, target1.width, target1.height); -/** - * The Process Queue Add Event. - * - * This event is dispatched by a Process Queue when a new item is successfully moved to its active list. - * - * You will most commonly see this used by a Scene's Update List when a new Game Object has been added. - * - * In that instance, listen to this event from within a Scene using: `this.sys.updateList.on('add', listener)`. - * - * @event Phaser.Structs.Events#PROCESS_QUEUE_ADD - * @since 3.20.0 - * - * @param {*} item - The item that was added to the Process Queue. - */ -module.exports = 'add'; + this.set1i('uMainSampler', 0); + this.set2f('resolution', target1.width, target1.height); + this.set1f('strength', controller.strength); + this.set3fv('color', controller.glcolor); + for (var i = 0; i < controller.steps; i++) + { + this.set2f('offset', controller.x, 0); + this.copySprite(target1, target2); -/***/ }), -/* 1042 */ -/***/ (function(module, exports) { + this.set2f('offset', 0, controller.y); + this.copySprite(target2, target1); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + gl.bindFramebuffer(gl.FRAMEBUFFER, currentFBO); + gl.bindTexture(gl.TEXTURE_2D, null); -/** - * The Process Queue Remove Event. - * - * This event is dispatched by a Process Queue when a new item is successfully removed from its active list. - * - * You will most commonly see this used by a Scene's Update List when a Game Object has been removed. - * - * In that instance, listen to this event from within a Scene using: `this.sys.updateList.on('remove', listener)`. - * - * @event Phaser.Structs.Events#PROCESS_QUEUE_REMOVE - * @since 3.20.0 - * - * @param {*} item - The item that was removed from the Process Queue. - */ -module.exports = 'remove'; + this.copyToGame(target1); + } + +}); + +module.exports = BlurFXPipeline; /***/ }), -/* 1043 */ -/***/ (function(module, exports) { + +/***/ 49745: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var BokehFrag = __webpack_require__(69960); +var PostFXPipeline = __webpack_require__(80486); + /** - * Calculate the full bounds, in local and world space, of a BitmapText Game Object. + * @classdesc + * The Bokeh FX Pipeline. * - * Returns a BitmapTextSize object that contains global and local variants of the Game Objects x and y coordinates and - * its width and height. Also includes an array of the line lengths and all word positions. + * Bokeh refers to a visual effect that mimics the photographic technique of creating a shallow depth of field. + * This effect is used to emphasize the game's main subject or action, by blurring the background or foreground + * elements, resulting in a more immersive and visually appealing experience. It is achieved through rendering + * techniques that simulate the out-of-focus areas, giving a sense of depth and realism to the game's graphics. * - * The global position and size take into account the Game Object's position and scale. + * This effect can also be used to generate a Tilt Shift effect, which is a technique used to create a miniature + * effect by blurring everything except a small area of the image. This effect is achieved by blurring the + * top and bottom elements, while keeping the center area in focus. * - * The local position and size just takes into account the font data. + * A Bokeh effect is added to a Game Object via the FX component: * - * @function GetBitmapTextSize - * @since 3.0.0 - * @private + * ```js + * const sprite = this.add.sprite(); * - * @param {(Phaser.GameObjects.DynamicBitmapText|Phaser.GameObjects.BitmapText)} src - The BitmapText to calculate the bounds values for. - * @param {boolean} [round=false] - Whether to round the positions to the nearest integer. - * @param {boolean} [updateOrigin=false] - Whether to update the origin of the BitmapText after bounds calculations? - * @param {object} [out] - Object to store the results in, to save constant object creation. If not provided an empty object is returned. + * sprite.postFX.addBokeh(); + * ``` * - * @return {Phaser.Types.GameObjects.BitmapText.BitmapTextSize} The calculated bounds values of the BitmapText. + * @class BokehFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. */ -var GetBitmapTextSize = function (src, round, updateOrigin, out) -{ - if (updateOrigin === undefined) { updateOrigin = false; } - - if (out === undefined) - { - out = { - local: { - x: 0, - y: 0, - width: 0, - height: 0 - }, - global: { - x: 0, - y: 0, - width: 0, - height: 0 - }, - lines: { - shortest: 0, - longest: 0, - lengths: null, - height: 0 - }, - wrappedText: '', - words: [], - characters: [], - scaleX: 0, - scaleY: 0 - }; +var BokehFXPipeline = new Class({ - return out; - } - - var text = src.text; - var textLength = text.length; - var maxWidth = src.maxWidth; - var wordWrapCharCode = src.wordWrapCharCode; - - var bx = Number.MAX_VALUE; - var by = Number.MAX_VALUE; - var bw = 0; - var bh = 0; + Extends: PostFXPipeline, - var chars = src.fontData.chars; - var lineHeight = src.fontData.lineHeight; - var letterSpacing = src.letterSpacing; + initialize: - var xAdvance = 0; - var yAdvance = 0; + function BokehFXPipeline (game) + { + PostFXPipeline.call(this, { + game: game, + fragShader: BokehFrag + }); - var charCode = 0; + /** + * Is this a Tilt Shift effect or a standard bokeh effect? + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BokehFXPipeline#isTiltShift + * @type {boolean} + * @since 3.60.0 + */ + this.isTiltShift = false; - var glyph = null; + /** + * If a Tilt Shift effect this controls the strength of the blur. + * + * Setting this value on a non-Tilt Shift effect will have no effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BokehFXPipeline#strength + * @type {number} + * @since 3.60.0 + */ + this.strength = 1; - var align = src._align; + /** + * If a Tilt Shift effect this controls the amount of horizontal blur. + * + * Setting this value on a non-Tilt Shift effect will have no effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BokehFXPipeline#blurX + * @type {number} + * @since 3.60.0 + */ + this.blurX = 1; - var x = 0; - var y = 0; + /** + * If a Tilt Shift effect this controls the amount of vertical blur. + * + * Setting this value on a non-Tilt Shift effect will have no effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BokehFXPipeline#blurY + * @type {number} + * @since 3.60.0 + */ + this.blurY = 1; - var scale = (src.fontSize / src.fontData.size); - var sx = scale * src.scaleX; - var sy = scale * src.scaleY; + /** + * The radius of the bokeh effect. + * + * This is a float value, where a radius of 0 will result in no effect being applied, + * and a radius of 1 will result in a strong bokeh. However, you can exceed this value + * for even stronger effects. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BokehFXPipeline#radius + * @type {number} + * @since 3.60.0 + */ + this.radius = 0.5; - var lastGlyph = null; - var lastCharCode = 0; - var lineWidths = []; - var shortestLine = Number.MAX_VALUE; - var longestLine = 0; - var currentLine = 0; - var currentLineWidth = 0; + /** + * The amount, or strength, of the bokeh effect. Defaults to 1. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BokehFXPipeline#amount + * @type {number} + * @since 3.60.0 + */ + this.amount = 1; - var i; - var words = []; - var characters = []; - var current = null; + /** + * The color contrast, or brightness, of the bokeh effect. Defaults to 0.2. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.BokehFXPipeline#contrast + * @type {number} + * @since 3.60.0 + */ + this.contrast = 0.2; + }, - // Scan for breach of maxWidth and insert carriage-returns - if (maxWidth > 0) + onPreRender: function (controller, shader, width, height) { - for (i = 0; i < textLength; i++) - { - charCode = text.charCodeAt(i); - - if (charCode === 10) - { - if (current !== null) - { - words.push({ - word: current.word, - i: current.i, - x: current.x * sx, - y: current.y * sy, - w: current.w * sx, - h: current.h * sy, - cr: true - }); - - current = null; - } + controller = this.getController(controller); - xAdvance = 0; - yAdvance += lineHeight; - lastGlyph = null; + this.set1f('radius', controller.radius, shader); + this.set1f('amount', controller.amount, shader); + this.set1f('contrast', controller.contrast, shader); + this.set1f('strength', controller.strength, shader); + this.set2f('blur', controller.blurX, controller.blurY, shader); + this.setBoolean('isTiltShift', controller.isTiltShift, shader); - continue; - } + if (width && height) + { + this.set2f('resolution', width, height, shader); + } + }, - glyph = chars[charCode]; + onDraw: function (target) + { + this.set2f('resolution', target.width, target.height); - if (!glyph) - { - continue; - } + this.bindAndDraw(target); + } - if (lastGlyph !== null) - { - var glyphKerningOffset = glyph.kerning[lastCharCode]; - } +}); - if (charCode === wordWrapCharCode) - { - if (current !== null) - { - words.push({ - word: current.word, - i: current.i, - x: current.x * sx, - y: current.y * sy, - w: current.w * sx, - h: current.h * sy, - cr: false - }); +module.exports = BokehFXPipeline; - current = null; - } - } - else - { - if (current === null) - { - // We're starting a new word, recording the starting index, etc - current = { word: '', i: i, x: xAdvance, y: yAdvance, w: 0, h: lineHeight, cr: false }; - } - current.word = current.word.concat(text[i]); - current.w += glyph.xOffset + glyph.xAdvance + ((glyphKerningOffset !== undefined) ? glyphKerningOffset : 0); - } +/***/ }), - xAdvance += glyph.xAdvance + letterSpacing; - lastGlyph = glyph; - lastCharCode = charCode; - } +/***/ 4323: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Last word - if (current !== null) - { - words.push({ - word: current.word, - i: current.i, - x: current.x * sx, - y: current.y * sy, - w: current.w * sx, - h: current.h * sy, - cr: false - }); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Reset for the next loop - xAdvance = 0; - yAdvance = 0; - lastGlyph = null; - lastCharCode = 0; +var Class = __webpack_require__(56694); +var CircleFrag = __webpack_require__(33754); +var PostFXPipeline = __webpack_require__(80486); - // Loop through the words array and see if we've got any > maxWidth - var prev; - var offset = 0; - var crs = []; +/** + * @classdesc + * The Circle FX Pipeline. + * + * This effect will draw a circle around the texture of the Game Object, effectively masking off + * any area outside of the circle without the need for an actual mask. You can control the thickness + * of the circle, the color of the circle and the color of the background, should the texture be + * transparent. You can also control the feathering applied to the circle, allowing for a harsh or soft edge. + * + * Please note that adding this effect to a Game Object will not change the input area or physics body of + * the Game Object, should it have one. + * + * A Circle effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.postFX.addCircle(); + * ``` + * + * @class CircleFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. + */ +var CircleFXPipeline = new Class({ - for (i = 0; i < words.length; i++) - { - var entry = words[i]; - var left = entry.x; - var right = entry.x + entry.w; + Extends: PostFXPipeline, - if (prev) - { - var diff = left - (prev.x + prev.w); + initialize: - offset = left - (diff + prev.w); + function CircleFXPipeline (game) + { + PostFXPipeline.call(this, { + game: game, + fragShader: CircleFrag + }); - prev = null; - } + /** + * The scale of the circle. The default scale is 1, which is a circle + * the full size of the underlying texture. Reduce this value to create + * a smaller circle, or increase it to create a circle that extends off + * the edges of the texture. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.CircleFXPipeline#scale + * @type {number} + * @since 3.60.0 + */ + this.scale = 1; - var checkLeft = left - offset; - var checkRight = right - offset; + /** + * The amount of feathering to apply to the circle from the ring, + * extending into the middle of the circle. The default is 0.005, + * which is a very low amount of feathering just making sure the ring + * has a smooth edge. Increase this amount to a value such as 0.5 + * or 0.025 for larger amounts of feathering. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.CircleFXPipeline#feather + * @type {number} + * @since 3.60.0 + */ + this.feather = 0.005; - if (checkLeft > maxWidth || checkRight > maxWidth) - { - crs.push(entry.i - 1); + /** + * The width of the circle around the texture, in pixels. This value + * doesn't factor in the feather, which can extend the thickness + * internally depending on its value. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.CircleFXPipeline#thickness + * @type {number} + * @since 3.60.0 + */ + this.thickness = 8; - if (entry.cr) - { - crs.push(entry.i + entry.word.length); + /** + * The internal gl color array for the ring color. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.CircleFXPipeline#glcolor + * @type {number[]} + * @since 3.60.0 + */ + this.glcolor = [ 1, 0.2, 0.7 ]; - offset = 0; - prev = null; - } - else - { - prev = entry; - } - } - else if (entry.cr) - { - crs.push(entry.i + entry.word.length); + /** + * The internal gl color array for the background color. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.CircleFXPipeline#glcolor2 + * @type {number[]} + * @since 3.60.0 + */ + this.glcolor2 = [ 1, 0, 0, 0.4 ]; + }, - offset = 0; - prev = null; - } - } + onPreRender: function (controller, shader, width, height) + { + controller = this.getController(controller); - var stringInsert = function (str, index, value) - { - return str.substr(0, index) + value + str.substr(index + 1); - }; + this.set1f('scale', controller.scale, shader); + this.set1f('feather', controller.feather, shader); + this.set1f('thickness', controller.thickness, shader); + this.set3fv('color', controller.glcolor, shader); + this.set4fv('backgroundColor', controller.glcolor2, shader); - for (i = crs.length - 1; i >= 0; i--) + if (width && height) { - // eslint-disable-next-line quotes - text = stringInsert(text, crs[i], "\n"); + this.set2f('resolution', width, height, shader); } + }, - out.wrappedText = text; - - textLength = text.length; + onDraw: function (target) + { + this.set2f('resolution', target.width, target.height); - // Recalculated in the next loop - words = []; - current = null; + this.bindAndDraw(target); } - var charIndex = 0; - - for (i = 0; i < textLength; i++) - { - charCode = text.charCodeAt(i); +}); - if (charCode === 10) - { - if (current !== null) - { - words.push({ - word: current.word, - i: current.i, - x: current.x * sx, - y: current.y * sy, - w: current.w * sx, - h: current.h * sy - }); +module.exports = CircleFXPipeline; - current = null; - } - xAdvance = 0; - yAdvance += lineHeight; - lastGlyph = null; +/***/ }), - lineWidths[currentLine] = currentLineWidth; +/***/ 92066: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (currentLineWidth > longestLine) - { - longestLine = currentLineWidth; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (currentLineWidth < shortestLine) - { - shortestLine = currentLineWidth; - } +var Class = __webpack_require__(56694); +var PostFXPipeline = __webpack_require__(80486); - currentLine++; - currentLineWidth = 0; +/** + * @classdesc + * The ColorMatrix FX Pipeline. + * + * The color matrix effect is a visual technique that involves manipulating the colors of an image + * or scene using a mathematical matrix. This process can adjust hue, saturation, brightness, and contrast, + * allowing developers to create various stylistic appearances or mood settings within the game. + * Common applications include simulating different lighting conditions, applying color filters, + * or achieving a specific visual style. + * + * A ColorMatrix effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.postFX.addColorMatrix(); + * ``` + * + * @class ColorMatrixFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. + */ +var ColorMatrixFXPipeline = new Class({ - continue; - } + Extends: PostFXPipeline, - glyph = chars[charCode]; + initialize: - if (!glyph) - { - continue; - } + function ColorMatrixFXPipeline (game) + { + PostFXPipeline.call(this, { + game: game + }); + }, - x = xAdvance; - y = yAdvance; + onDraw: function (source) + { + var target = this.fullFrame1; - if (lastGlyph !== null) + if (this.controller) { - var kerningOffset = glyph.kerning[lastCharCode]; - - x += (kerningOffset !== undefined) ? kerningOffset : 0; + this.manager.drawFrame(source, target, true, this.controller); } - - if (bx > x) + else { - bx = x; + this.drawFrame(source, target); } - if (by > y) - { - by = y; - } + this.copyToGame(target); + } - var gw = x + glyph.xAdvance; - var gh = y + lineHeight; +}); - if (bw < gw) - { - bw = gw; - } +module.exports = ColorMatrixFXPipeline; - if (bh < gh) - { - bh = gh; - } - var charWidth = glyph.xOffset + glyph.xAdvance + ((kerningOffset !== undefined) ? kerningOffset : 0); +/***/ }), - if (charCode === wordWrapCharCode) - { - if (current !== null) - { - words.push({ - word: current.word, - i: current.i, - x: current.x * sx, - y: current.y * sy, - w: current.w * sx, - h: current.h * sy - }); +/***/ 89581: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - current = null; - } - } - else - { - if (current === null) - { - // We're starting a new word, recording the starting index, etc - current = { word: '', i: charIndex, x: xAdvance, y: yAdvance, w: 0, h: lineHeight }; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - current.word = current.word.concat(text[i]); - current.w += charWidth; - } +var Class = __webpack_require__(56694); +var DisplacementFrag = __webpack_require__(35668); +var PostFXPipeline = __webpack_require__(80486); - characters.push({ - i: charIndex, - char: text[i], - code: charCode, - x: (glyph.xOffset + xAdvance) * scale, - y: (glyph.yOffset + yAdvance) * scale, - w: glyph.width * scale, - h: glyph.height * scale, - t: yAdvance * scale, - r: gw * scale, - b: lineHeight * scale, - line: currentLine, - glyph: glyph - }); +/** + * @classdesc + * The Displacement FX Pipeline. + * + * The displacement effect is a visual technique that alters the position of pixels in an image + * or texture based on the values of a displacement map. This effect is used to create the illusion + * of depth, surface irregularities, or distortion in otherwise flat elements. It can be applied to + * characters, objects, or backgrounds to enhance realism, convey movement, or achieve various + * stylistic appearances. + * + * A Displacement effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.postFX.addDisplacement(); + * ``` + * + * @class DisplacementFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. + */ +var DisplacementFXPipeline = new Class({ - xAdvance += glyph.xAdvance + letterSpacing; - lastGlyph = glyph; - lastCharCode = charCode; - currentLineWidth = gw * scale; - charIndex++; - } + Extends: PostFXPipeline, - // Last word - if (current !== null) + initialize: + + function DisplacementFXPipeline (game) { - words.push({ - word: current.word, - i: current.i, - x: current.x * sx, - y: current.y * sy, - w: current.w * sx, - h: current.h * sy + PostFXPipeline.call(this, { + game: game, + fragShader: DisplacementFrag }); - } - lineWidths[currentLine] = currentLineWidth; + /** + * The amount of horizontal displacement to apply. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.DisplacementFXPipeline#x + * @type {number} + * @since 3.60.0 + */ + this.x = 0.005; - if (currentLineWidth > longestLine) - { - longestLine = currentLineWidth; - } + /** + * The amount of vertical displacement to apply. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.DisplacementFXPipeline#y + * @type {number} + * @since 3.60.0 + */ + this.y = 0.005; - if (currentLineWidth < shortestLine) + /** + * The underlying WebGLTexture used for displacement. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.DisplacementFXPipeline#glTexture + * @type {WebGLTexture} + * @since 3.60.0 + */ + this.glTexture; + }, + + onBoot: function () { - shortestLine = currentLineWidth; - } + this.setTexture('__WHITE'); + }, - // Adjust all of the character positions based on alignment - if (align > 0) + setTexture: function (texture) { - for (var c = 0; c < characters.length; c++) + var phaserTexture = this.game.textures.getFrame(texture); + + if (phaserTexture) { - var currentChar = characters[c]; + this.glTexture = phaserTexture.glTexture; + } + }, - if (align === 1) - { - var ax1 = ((longestLine - lineWidths[currentChar.line]) / 2); + onDraw: function (source) + { + var controller = this.getController(); - currentChar.x += ax1; - currentChar.r += ax1; - } - else if (align === 2) - { - var ax2 = (longestLine - lineWidths[currentChar.line]); + var target = this.fullFrame1; - currentChar.x += ax2; - currentChar.r += ax2; - } - } + this.bind(); + + this.set1i('uMainSampler', 0); + this.set1i('uDisplacementSampler', 1); + this.set2f('amount', controller.x, controller.y); + + this.bindTexture(controller.glTexture, 1); + + this.copySprite(source, target); + + this.copyToGame(target); } - var local = out.local; - var global = out.global; - var lines = out.lines; +}); - local.x = bx * scale; - local.y = by * scale; - local.width = bw * scale; - local.height = bh * scale; +module.exports = DisplacementFXPipeline; - global.x = (src.x - src._displayOriginX) + (bx * sx); - global.y = (src.y - src._displayOriginY) + (by * sy); - global.width = bw * sx; - global.height = bh * sy; +/***/ }), - lines.shortest = shortestLine; - lines.longest = longestLine; - lines.lengths = lineWidths; +/***/ 55084: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (round) +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var GetFastValue = __webpack_require__(72632); +var GlowFrag = __webpack_require__(69675); +var PostFXPipeline = __webpack_require__(80486); +var Utils = __webpack_require__(75512); + +/** + * @classdesc + * The Glow FX Pipeline. + * + * The glow effect is a visual technique that creates a soft, luminous halo around game objects, + * characters, or UI elements. This effect is used to emphasize importance, enhance visual appeal, + * or convey a sense of energy, magic, or otherworldly presence. The effect can also be set on + * the inside of the Game Object. The color and strength of the glow can be modified. + * + * A Glow effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.postFX.addGlow(); + * ``` + * + * @class GlowFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. + * @param {object} config - The configuration options for this pipeline. + */ +var GlowFXPipeline = new Class({ + + Extends: PostFXPipeline, + + initialize: + + function GlowFXPipeline (game, config) { - local.x = Math.ceil(local.x); - local.y = Math.ceil(local.y); - local.width = Math.ceil(local.width); - local.height = Math.ceil(local.height); + var quality = GetFastValue(config, 'quality', 0.1); + var distance = GetFastValue(config, 'distance', 10); - global.x = Math.ceil(global.x); - global.y = Math.ceil(global.y); - global.width = Math.ceil(global.width); - global.height = Math.ceil(global.height); + PostFXPipeline.call(this, { + game: game, + fragShader: Utils.setGlowQuality(GlowFrag, game, quality, distance) + }); - lines.shortest = Math.ceil(shortestLine); - lines.longest = Math.ceil(longestLine); - } + /** + * The strength of the glow outward from the edge of the Sprite. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.GlowFXPipeline#outerStrength + * @type {number} + * @since 3.60.0 + */ + this.outerStrength = 4; - if (updateOrigin) + /** + * The strength of the glow inward from the edge of the Sprite. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.GlowFXPipeline#innerStrength + * @type {number} + * @since 3.60.0 + */ + this.innerStrength = 0; + + /** + * If `true` only the glow is drawn, not the texture itself. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.GlowFXPipeline#knockout + * @type {number} + * @since 3.60.0 + */ + this.knockout = false; + + /** + * A 4 element array of gl color values. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.GlowFXPipeline#glcolor + * @type {number[]} + * @since 3.60.0 + */ + this.glcolor = [ 1, 1, 1, 1 ]; + }, + + onPreRender: function (controller, shader, width, height) { - src._displayOriginX = (src.originX * local.width); - src._displayOriginY = (src.originY * local.height); + controller = this.getController(controller); - global.x = src.x - (src._displayOriginX * src.scaleX); - global.y = src.y - (src._displayOriginY * src.scaleY); + this.set1f('outerStrength', controller.outerStrength, shader); + this.set1f('innerStrength', controller.innerStrength, shader); + this.set4fv('glowColor', controller.glcolor, shader); + this.setBoolean('knockout', controller.knockout, shader); - if (round) + if (width && height) { - global.x = Math.ceil(global.x); - global.y = Math.ceil(global.y); + this.set2f('resolution', width, height, shader); } - } + }, - out.words = words; - out.characters = characters; - out.lines.height = lineHeight; - out.scale = scale; - out.scaleX = src.scaleX; - out.scaleY = src.scaleY; + onDraw: function (target) + { + this.set2f('resolution', target.width, target.height); - return out; -}; + this.bindAndDraw(target); + } -module.exports = GetBitmapTextSize; +}); + +module.exports = GlowFXPipeline; /***/ }), -/* 1044 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 41653: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ParseXMLBitmapFont = __webpack_require__(212); +var Class = __webpack_require__(56694); +var GradientFrag = __webpack_require__(90993); +var PostFXPipeline = __webpack_require__(80486); /** - * Parse an XML Bitmap Font from an Atlas. + * @classdesc + * The Gradient FX Pipeline. * - * Adds the parsed Bitmap Font data to the cache with the `fontName` key. + * The gradient overlay effect is a visual technique where a smooth color transition is applied over Game Objects, + * such as sprites or UI components. This effect is used to enhance visual appeal, emphasize depth, or create + * stylistic and atmospheric variations. It can also be utilized to convey information, such as representing + * progress or health status through color changes. * - * @function ParseFromAtlas - * @since 3.0.0 - * @private + * A Gradient effect is added to a Game Object via the FX component: * - * @param {Phaser.Scene} scene - The Scene to parse the Bitmap Font for. - * @param {string} fontName - The key of the font to add to the Bitmap Font cache. - * @param {string} textureKey - The key of the BitmapFont's texture. - * @param {string} frameKey - The key of the BitmapFont texture's frame. - * @param {string} xmlKey - The key of the XML data of the font to parse. - * @param {number} [xSpacing] - The x-axis spacing to add between each letter. - * @param {number} [ySpacing] - The y-axis spacing to add to the line height. + * ```js + * const sprite = this.add.sprite(); * - * @return {boolean} Whether the parsing was successful or not. + * sprite.postFX.addGradient(); + * ``` + * + * @class GradientFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. */ -var ParseFromAtlas = function (scene, fontName, textureKey, frameKey, xmlKey, xSpacing, ySpacing) -{ - var texture = scene.sys.textures.get(textureKey); - var frame = texture.get(frameKey); - var xml = scene.sys.cache.xml.get(xmlKey); +var GradientFXPipeline = new Class({ - if (frame && xml) + Extends: PostFXPipeline, + + initialize: + + function GradientFXPipeline (game) { - var data = ParseXMLBitmapFont(xml, frame, xSpacing, ySpacing, texture); + PostFXPipeline.call(this, { + game: game, + fragShader: GradientFrag + }); - scene.sys.cache.bitmapFont.add(fontName, { data: data, texture: textureKey, frame: frameKey, fromAtlas: true }); + /** + * The alpha value of the gradient effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#alpha + * @type {number} + * @since 3.60.0 + */ + this.alpha = 0.2; - return true; - } - else + /** + * Sets how many 'chunks' the gradient is divided in to, as spread over the + * entire height of the texture. Leave this at zero for a smooth gradient, + * or set to a higher number to split the gradient into that many sections, giving + * a more banded 'retro' effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#size + * @type {number} + * @since 3.60.0 + */ + this.size = 0; + + /** + * The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#fromX + * @type {number} + * @since 3.60.0 + */ + this.fromX = 0; + + /** + * The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#fromY + * @type {number} + * @since 3.60.0 + */ + this.fromY = 0; + + /** + * The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#toX + * @type {number} + * @since 3.60.0 + */ + this.toX = 0; + + /** + * The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#toY + * @type {number} + * @since 3.60.0 + */ + this.toY = 1; + + /** + * The internal gl color array for the starting color. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#glcolor1 + * @type {number[]} + * @since 3.60.0 + */ + this.glcolor1 = [ 255, 0, 0 ]; + + /** + * The internal gl color array for the ending color. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#glcolor2 + * @type {number[]} + * @since 3.60.0 + */ + this.glcolor2 = [ 0, 255, 0 ]; + }, + + onPreRender: function (controller, shader) { - return false; + controller = this.getController(controller); + + this.set1f('alpha', controller.alpha, shader); + this.set1i('size', controller.size, shader); + this.set3fv('color1', controller.glcolor1, shader); + this.set3fv('color2', controller.glcolor2, shader); + this.set2f('positionFrom', controller.fromX, controller.fromY, shader); + this.set2f('positionTo', controller.toX, controller.toY, shader); } -}; -module.exports = ParseFromAtlas; +}); + +module.exports = GradientFXPipeline; /***/ }), -/* 1045 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 73416: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); +var Class = __webpack_require__(56694); +var PixelateFrag = __webpack_require__(37945); +var PostFXPipeline = __webpack_require__(80486); -if (true) -{ - renderWebGL = __webpack_require__(1046); -} +/** + * @classdesc + * The Pixelate FX Pipeline. + * + * The pixelate effect is a visual technique that deliberately reduces the resolution or detail of an image, + * creating a blocky or mosaic appearance composed of large, visible pixels. This effect can be used for stylistic + * purposes, as a homage to retro gaming, or as a means to obscure certain elements within the game, such as + * during a transition or to censor specific content. + * + * A Pixelate effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.postFX.addPixelate(); + * ``` + * + * @class PixelateFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. + */ +var PixelateFXPipeline = new Class({ -if (true) -{ - renderCanvas = __webpack_require__(1048); -} + Extends: PostFXPipeline, -module.exports = { + initialize: - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + function PixelateFXPipeline (game) + { + PostFXPipeline.call(this, { + game: game, + fragShader: PixelateFrag + }); -}; + /** + * The amount of pixelation to apply. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.PixelateFXPipeline#amount + * @type {number} + * @since 3.60.0 + */ + this.amount = 1; + }, + + onPreRender: function (controller, shader, width, height) + { + controller = this.getController(controller); + + this.set1f('amount', controller.amount, shader); + + if (width && height) + { + this.set2f('resolution', width, height, shader); + } + }, + + onDraw: function (target) + { + this.set2f('resolution', target.width, target.height); + + this.bindAndDraw(target); + } + +}); + +module.exports = PixelateFXPipeline; /***/ }), -/* 1046 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 58049: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BatchChar = __webpack_require__(1047); -var GetCalcMatrix = __webpack_require__(19); -var Utils = __webpack_require__(12); +var Class = __webpack_require__(56694); +var ShadowFrag = __webpack_require__(85718); +var PostFXPipeline = __webpack_require__(80486); /** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * @classdesc + * The Shadow FX Pipeline. * - * @method Phaser.GameObjects.BitmapText#renderWebGL - * @since 3.0.0 - * @private + * The shadow effect is a visual technique used to create the illusion of depth and realism by adding darker, + * offset silhouettes or shapes beneath game objects, characters, or environments. These simulated shadows + * help to enhance the visual appeal and immersion, making the 2D game world appear more dynamic and three-dimensional. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.BitmapText} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * A Shadow effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.postFX.addShadow(); + * ``` + * + * @class ShadowFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. */ -var BitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - var text = src._text; - var textLength = text.length; +var ShadowFXPipeline = new Class({ - if (textLength === 0) + Extends: PostFXPipeline, + + initialize: + + function ShadowFXPipeline (game) { - return; - } + PostFXPipeline.call(this, { + game: game, + fragShader: ShadowFrag + }); - camera.addToRenderList(src); + /** + * The horizontal offset of the shadow effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.ShadowFXPipeline#x + * @type {number} + * @since 3.60.0 + */ + this.x = 0; - var pipeline = renderer.pipelines.set(src.pipeline, src); + /** + * The vertical offset of the shadow effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.ShadowFXPipeline#y + * @type {number} + * @since 3.60.0 + */ + this.y = 0; - var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + /** + * The amount of decay for the shadow effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.ShadowFXPipeline#decay + * @type {number} + * @since 3.60.0 + */ + this.decay = 0.1; - var roundPixels = camera.roundPixels; + /** + * The power of the shadow effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.ShadowFXPipeline#power + * @type {number} + * @since 3.60.0 + */ + this.power = 1; - var cameraAlpha = camera.alpha; + /** + * The internal gl color array. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.ShadowFXPipeline#glcolor + * @type {number[]} + * @since 3.60.0 + */ + this.glcolor = [ 0, 0, 0, 1 ]; - var charColors = src.charColors; + /** + * The number of samples that the shadow effect will run for. + * + * This should be an integer with a minimum value of 1 and a maximum of 12. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.ShadowFXPipeline#samples + * @type {number} + * @since 3.60.0 + */ + this.samples = 6; - var tintEffect = src.tintFill; + /** + * The intensity of the shadow effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.ShadowFXPipeline#intensity + * @type {number} + * @since 3.60.0 + */ + this.intensity = 1; + }, - var getTint = Utils.getTintAppendFloatAlpha; + onPreRender: function (controller, shader) + { + controller = this.getController(controller); - var tintTL = getTint(src.tintTopLeft, cameraAlpha * src._alphaTL); - var tintTR = getTint(src.tintTopRight, cameraAlpha * src._alphaTR); - var tintBL = getTint(src.tintBottomLeft, cameraAlpha * src._alphaBL); - var tintBR = getTint(src.tintBottomRight, cameraAlpha * src._alphaBR); + var samples = controller.samples; - var texture = src.frame.glTexture; - var textureUnit = pipeline.setGameObject(src); + this.set1i('samples', samples, shader); + this.set1f('intensity', controller.intensity, shader); + this.set1f('decay', controller.decay, shader); + this.set1f('power', (controller.power / samples), shader); + this.set2f('lightPosition', controller.x, controller.y, shader); + this.set4fv('color', controller.glcolor, shader); + } - // Update the bounds - skipped internally if not dirty - var bounds = src.getTextBounds(false); +}); - var i; - var char; - var glyph; +module.exports = ShadowFXPipeline; - var characters = bounds.characters; - var dropShadowX = src.dropShadowX; - var dropShadowY = src.dropShadowY; +/***/ }), - var dropShadow = (dropShadowX !== 0 || dropShadowY !== 0); +/***/ 18026: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - renderer.pipelines.preBatch(src); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (dropShadow) +var Class = __webpack_require__(56694); +var ShineFrag = __webpack_require__(13740); +var PostFXPipeline = __webpack_require__(80486); + +/** + * @classdesc + * The Shine FX Pipeline. + * + * The shine effect is a visual technique that simulates the appearance of reflective + * or glossy surfaces by passing a light beam across a Game Object. This effect is used to + * enhance visual appeal, emphasize certain features, and create a sense of depth or + * material properties. + * + * A Shine effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.postFX.addShine(); + * ``` + * + * @class ShineFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. + */ +var ShineFXPipeline = new Class({ + + Extends: PostFXPipeline, + + initialize: + + function ShineFXPipeline (game) { - var srcShadowColor = src.dropShadowColor; - var srcShadowAlpha = src.dropShadowAlpha; + PostFXPipeline.call(this, { + game: game, + fragShader: ShineFrag + }); - var shadowTL = getTint(srcShadowColor, cameraAlpha * srcShadowAlpha * src._alphaTL); - var shadowTR = getTint(srcShadowColor, cameraAlpha * srcShadowAlpha * src._alphaTR); - var shadowBL = getTint(srcShadowColor, cameraAlpha * srcShadowAlpha * src._alphaBL); - var shadowBR = getTint(srcShadowColor, cameraAlpha * srcShadowAlpha * src._alphaBR); + /** + * The speed of the Shine effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.ShineFXPipeline#speed + * @type {number} + * @since 3.60.0 + */ + this.speed = 0.5; - for (i = 0; i < characters.length; i++) - { - char = characters[i]; - glyph = char.glyph; + /** + * The line width of the Shine effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.ShineFXPipeline#lineWidth + * @type {number} + * @since 3.60.0 + */ + this.lineWidth = 0.5; - if (char.code === 32 || glyph.width === 0 || glyph.height === 0) - { - continue; - } + /** + * The gradient of the Shine effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.ShineFXPipeline#gradient + * @type {number} + * @since 3.60.0 + */ + this.gradient = 3; - BatchChar(pipeline, src, char, glyph, dropShadowX, dropShadowY, calcMatrix, roundPixels, shadowTL, shadowTR, shadowBL, shadowBR, 1, texture, textureUnit); - } - } + /** + * Does this Shine effect reveal or get added to its target? + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.ShineFXPipeline#reveal + * @type {boolean} + * @since 3.60.0 + */ + this.reveal = false; + }, - for (i = 0; i < characters.length; i++) + onPreRender: function (controller, shader, width, height) { - char = characters[i]; - glyph = char.glyph; - - if (char.code === 32 || glyph.width === 0 || glyph.height === 0) - { - continue; - } + controller = this.getController(controller); - if (charColors[char.i]) - { - var color = charColors[char.i]; + this.setTime('time', shader); - var charTintEffect = color.tintEffect; - var charTintTL = getTint(color.tintTL, cameraAlpha * src._alphaTL); - var charTintTR = getTint(color.tintTR, cameraAlpha * src._alphaTR); - var charTintBL = getTint(color.tintBL, cameraAlpha * src._alphaBL); - var charTintBR = getTint(color.tintBR, cameraAlpha * src._alphaBR); + this.set1f('speed', controller.speed, shader); + this.set1f('lineWidth', controller.lineWidth, shader); + this.set1f('gradient', controller.gradient, shader); + this.setBoolean('reveal', controller.reveal, shader); - BatchChar(pipeline, src, char, glyph, 0, 0, calcMatrix, roundPixels, charTintTL, charTintTR, charTintBL, charTintBR, charTintEffect, texture, textureUnit); - } - else + if (width && height) { - BatchChar(pipeline, src, char, glyph, 0, 0, calcMatrix, roundPixels, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); + this.set2f('resolution', width, height, shader); } + }, - // Debug test if the characters are in the correct place when rendered: - // pipeline.drawFillRect(tx0, ty0, tx2 - tx0, ty2 - ty0, 0x00ff00, 0.5); + onDraw: function (target) + { + this.set2f('resolution', target.width, target.height); + + this.bindAndDraw(target); } - renderer.pipelines.postBatch(src); -}; +}); -module.exports = BitmapTextWebGLRenderer; +module.exports = ShineFXPipeline; /***/ }), -/* 1047 */ -/***/ (function(module, exports) { + +/***/ 72381: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var VignetteFrag = __webpack_require__(80617); +var PostFXPipeline = __webpack_require__(80486); + /** - * Renders one character of the Bitmap Text to the WebGL Pipeline. + * @classdesc + * The Vignette FX Pipeline. * - * @function BatchChar - * @since 3.50.0 - * @private + * The vignette effect is a visual technique where the edges of the screen, or a Game Object, gradually darken or blur, + * creating a frame-like appearance. This effect is used to draw the player's focus towards the central action or subject, + * enhance immersion, and provide a cinematic or artistic quality to the game's visuals. * - * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The WebGLPipeline. Must have a `batchQuad` method. - * @param {Phaser.GameObjects.BitmapText} src - The BitmapText Game Object. - * @param {Phaser.Types.GameObjects.BitmapText.BitmapTextCharacter} char - The character to render. - * @param {Phaser.Types.GameObjects.BitmapText.BitmapFontCharacterData} glyph - The character glyph. - * @param {number} offsetX - The x offset. - * @param {number} offsetY - The y offset. - * @param {Phaser.GameObjects.Components.TransformMatrix} calcMatrix - The transform matrix. - * @param {boolean} roundPixels - Round the transform values or not? - * @param {number} tintTL - Top-left tint value. - * @param {number} tintTR - Top-right tint value. - * @param {number} tintBL - Bottom-left tint value. - * @param {number} tintBR - Bottom-right tint value. - * @param {number} tintEffect - The tint effect mode. - * @param {WebGLTexture} texture - The WebGL texture. - * @param {number} textureUnit - The texture unit. + * A Vignette effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.postFX.addVignette(); + * ``` + * + * @class VignetteFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. */ -var BatchChar = function (pipeline, src, char, glyph, offsetX, offsetY, calcMatrix, roundPixels, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit) -{ - var x = (char.x - src.displayOriginX) + offsetX; - var y = (char.y - src.displayOriginY) + offsetY; +var VignetteFXPipeline = new Class({ - var xw = x + char.w; - var yh = y + char.h; + Extends: PostFXPipeline, - var tx0 = calcMatrix.getXRound(x, y, roundPixels); - var ty0 = calcMatrix.getYRound(x, y, roundPixels); + initialize: - var tx1 = calcMatrix.getXRound(x, yh, roundPixels); - var ty1 = calcMatrix.getYRound(x, yh, roundPixels); + function VignetteFXPipeline (game) + { + PostFXPipeline.call(this, { + game: game, + fragShader: VignetteFrag + }); - var tx2 = calcMatrix.getXRound(xw, yh, roundPixels); - var ty2 = calcMatrix.getYRound(xw, yh, roundPixels); + /** + * The horizontal offset of the vignette effect. This value is normalized to the range 0 to 1. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.VignetteFXPipeline#x + * @type {number} + * @since 3.60.0 + */ + this.x = 0.5; - var tx3 = calcMatrix.getXRound(xw, y, roundPixels); - var ty3 = calcMatrix.getYRound(xw, y, roundPixels); + /** + * The vertical offset of the vignette effect. This value is normalized to the range 0 to 1. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.VignetteFXPipeline#y + * @type {number} + * @since 3.60.0 + */ + this.y = 0.5; - pipeline.batchQuad(src, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, glyph.u0, glyph.v0, glyph.u1, glyph.v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); -}; + /** + * The radius of the vignette effect. This value is normalized to the range 0 to 1. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.VignetteFXPipeline#radius + * @type {number} + * @since 3.60.0 + */ + this.radius = 0.5; -module.exports = BatchChar; + /** + * The strength of the vignette effect. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.VignetteFXPipeline#strength + * @type {number} + * @since 3.60.0 + */ + this.strength = 0.5; + }, + + onPreRender: function (controller, shader) + { + controller = this.getController(controller); + + this.set1f('radius', controller.radius, shader); + this.set1f('strength', controller.strength, shader); + this.set2f('position', controller.x, controller.y, shader); + } + +}); + +module.exports = VignetteFXPipeline; /***/ }), -/* 1048 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 80542: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var SetTransform = __webpack_require__(30); +var Class = __webpack_require__(56694); +var WipeFrag = __webpack_require__(62879); +var PostFXPipeline = __webpack_require__(80486); /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * @classdesc + * The Wipe FX Pipeline. * - * @method Phaser.GameObjects.BitmapText#renderCanvas - * @since 3.0.0 - * @private + * The wipe or reveal effect is a visual technique that gradually uncovers or conceals elements + * in the game, such as images, text, or scene transitions. This effect is often used to create + * a sense of progression, reveal hidden content, or provide a smooth and visually appealing transition + * between game states. * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.BitmapText} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * You can set both the direction and the axis of the wipe effect. The following combinations are possible: + * + * * left to right: direction 0, axis 0 + * * right to left: direction 1, axis 0 + * * top to bottom: direction 1, axis 1 + * * bottom to top: direction 1, axis 0 + * + * It is up to you to set the `progress` value yourself, i.e. via a Tween, in order to transition the effect. + * + * A Wipe effect is added to a Game Object via the FX component: + * + * ```js + * const sprite = this.add.sprite(); + * + * sprite.postFX.addWipe(); + * sprite.postFX.addReveal(); + * ``` + * + * @class WipeFXPipeline + * @extends Phaser.Renderer.WebGL.WebGLPipeline + * @memberof Phaser.Renderer.WebGL.Pipelines.FX + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. */ -var BitmapTextCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - var text = src._text; - var textLength = text.length; +var WipeFXPipeline = new Class({ - var ctx = renderer.currentContext; + Extends: PostFXPipeline, - if (textLength === 0 || !SetTransform(renderer, ctx, src, camera, parentMatrix)) + initialize: + + function WipeFXPipeline (game) { - return; + PostFXPipeline.call(this, { + game: game, + fragShader: WipeFrag + }); + + /** + * The progress of the Wipe effect. This value is normalized to the range 0 to 1. + * + * Adjust this value to make the wipe transition (i.e. via a Tween) + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.WipeFXPipeline#progress + * @type {number} + * @since 3.60.0 + */ + this.progress = 0; + + /** + * The width of the wipe effect. This value is normalized in the range 0 to 1. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.WipeFXPipeline#wipeWidth + * @type {number} + * @since 3.60.0 + */ + this.wipeWidth = 0.1; + + /** + * The direction of the wipe effect. Either 0 or 1. Set in conjunction with the axis property. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.WipeFXPipeline#direction + * @type {number} + * @since 3.60.0 + */ + this.direction = 0; + + /** + * The axis of the wipe effect. Either 0 or 1. Set in conjunction with the direction property. + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.WipeFXPipeline#axis + * @type {number} + * @since 3.60.0 + */ + this.axis = 0; + + /** + * Is this a reveal (true) or a fade (false) effect? + * + * @name Phaser.Renderer.WebGL.Pipelines.FX.WipeFXPipeline#reveal + * @type {boolean} + * @since 3.60.0 + */ + this.reveal = false; + }, + + onPreRender: function (controller, shader) + { + controller = this.getController(controller); + + var progress = controller.progress; + var wipeWidth = controller.wipeWidth; + var direction = controller.direction; + var axis = controller.axis; + + this.set4f('config', progress, wipeWidth, direction, axis, shader); + this.setBoolean('reveal', controller.reveal, shader); } - camera.addToRenderList(src); +}); - var textureFrame = src.fromAtlas - ? src.frame - : src.texture.frames['__BASE']; +module.exports = WipeFXPipeline; - var chars = src.fontData.chars; - var lineHeight = src.fontData.lineHeight; - var letterSpacing = src._letterSpacing; - var xAdvance = 0; - var yAdvance = 0; +/***/ }), - var charCode = 0; +/***/ 58136: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var glyph = null; - var glyphX = 0; - var glyphY = 0; - var glyphW = 0; - var glyphH = 0; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var x = 0; - var y = 0; +/** + * @namespace Phaser.Renderer.WebGL.Pipelines.FX + */ - var lastGlyph = null; - var lastCharCode = 0; +var FX = { - var image = textureFrame.source.image; + Barrel: __webpack_require__(32469), + Bloom: __webpack_require__(2134), + Blur: __webpack_require__(63377), + Bokeh: __webpack_require__(49745), + Circle: __webpack_require__(4323), + ColorMatrix: __webpack_require__(92066), + Displacement: __webpack_require__(89581), + Glow: __webpack_require__(55084), + Gradient: __webpack_require__(41653), + Pixelate: __webpack_require__(73416), + Shadow: __webpack_require__(58049), + Shine: __webpack_require__(18026), + Vignette: __webpack_require__(72381), + Wipe: __webpack_require__(80542) - var textureX = textureFrame.cutX; - var textureY = textureFrame.cutY; +}; - var scale = (src._fontSize / src.fontData.size); +// Export it - var align = src._align; - var currentLine = 0; - var lineOffsetX = 0; +module.exports = FX; - // Update the bounds - skipped internally if not dirty - var bounds = src.getTextBounds(false); - // In case the method above changed it (word wrapping) - if (src.maxWidth > 0) - { - text = bounds.wrappedText; - textLength = text.length; - } +/***/ }), - var lineData = src._bounds.lines; +/***/ 62253: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (align === 1) - { - lineOffsetX = (lineData.longest - lineData.lengths[0]) / 2; - } - else if (align === 2) - { - lineOffsetX = (lineData.longest - lineData.lengths[0]); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - ctx.translate(-src.displayOriginX, -src.displayOriginY); +var CONST = __webpack_require__(65641); +var Extend = __webpack_require__(98611); - var roundPixels = camera.roundPixels; +/** + * @namespace Phaser.Renderer.WebGL.Pipelines + */ - for (var i = 0; i < textLength; i++) - { - charCode = text.charCodeAt(i); +var Pipelines = { - if (charCode === 10) - { - currentLine++; + FX: __webpack_require__(58136), - if (align === 1) - { - lineOffsetX = (lineData.longest - lineData.lengths[currentLine]) / 2; - } - else if (align === 2) - { - lineOffsetX = (lineData.longest - lineData.lengths[currentLine]); - } + BitmapMaskPipeline: __webpack_require__(5583), + Events: __webpack_require__(18970), + FXPipeline: __webpack_require__(81828), + LightPipeline: __webpack_require__(66901), + MobilePipeline: __webpack_require__(71264), + MultiPipeline: __webpack_require__(77310), + PointLightPipeline: __webpack_require__(10919), + PostFXPipeline: __webpack_require__(80486), + PreFXPipeline: __webpack_require__(87228), + RopePipeline: __webpack_require__(21213), + SinglePipeline: __webpack_require__(51212), + UtilityPipeline: __webpack_require__(60848) - xAdvance = 0; - yAdvance += lineHeight; - lastGlyph = null; +}; - continue; - } +// Merge in the consts - glyph = chars[charCode]; +Pipelines = Extend(false, Pipelines, CONST); - if (!glyph) - { - continue; - } +// Export it - glyphX = textureX + glyph.x; - glyphY = textureY + glyph.y; +module.exports = Pipelines; - glyphW = glyph.width; - glyphH = glyph.height; - x = glyph.xOffset + xAdvance; - y = glyph.yOffset + yAdvance; +/***/ }), - if (lastGlyph !== null) - { - var kerningOffset = glyph.kerning[lastCharCode]; - x += (kerningOffset !== undefined) ? kerningOffset : 0; - } +/***/ 2529: +/***/ ((module) => { - x *= scale; - y *= scale; +module.exports = [ + '#define SHADER_NAME PHASER_ADD_BLEND_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler1;', + 'uniform sampler2D uMainSampler2;', + 'uniform float uStrength;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' vec4 frame1 = texture2D(uMainSampler1, outTexCoord);', + ' vec4 frame2 = texture2D(uMainSampler2, outTexCoord);', + ' gl_FragColor = frame1 + frame2 * uStrength;', + '}', +].join('\n'); - x += lineOffsetX; - xAdvance += glyph.xAdvance + letterSpacing; - lastGlyph = glyph; - lastCharCode = charCode; +/***/ }), - // Nothing to render or a space? Then skip to the next glyph - if (glyphW === 0 || glyphH === 0 || charCode === 32) - { - continue; - } +/***/ 91679: +/***/ ((module) => { + +module.exports = [ + '#define SHADER_NAME PHASER_BITMAP_MASK_FS', + 'precision mediump float;', + 'uniform vec2 uResolution;', + 'uniform sampler2D uMainSampler;', + 'uniform sampler2D uMaskSampler;', + 'uniform bool uInvertMaskAlpha;', + 'void main ()', + '{', + ' vec2 uv = gl_FragCoord.xy / uResolution;', + ' vec4 mainColor = texture2D(uMainSampler, uv);', + ' vec4 maskColor = texture2D(uMaskSampler, uv);', + ' if (!uInvertMaskAlpha)', + ' {', + ' mainColor *= maskColor.a;', + ' }', + ' else', + ' {', + ' mainColor *= (1.0 - maskColor.a);', + ' }', + ' gl_FragColor = mainColor;', + '}', +].join('\n'); + + +/***/ }), + +/***/ 89053: +/***/ ((module) => { + +module.exports = [ + '#define SHADER_NAME PHASER_BITMAP_MASK_VS', + 'precision mediump float;', + 'attribute vec2 inPosition;', + 'void main ()', + '{', + ' gl_Position = vec4(inPosition, 0.0, 1.0);', + '}', +].join('\n'); + + +/***/ }), + +/***/ 37486: +/***/ ((module) => { + +module.exports = [ + '#define SHADER_NAME PHASER_COLORMATRIX_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform float uColorMatrix[20];', + 'uniform float uAlpha;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' vec4 c = texture2D(uMainSampler, outTexCoord);', + ' if (uAlpha == 0.0)', + ' {', + ' gl_FragColor = c;', + ' return;', + ' }', + ' if (c.a > 0.0)', + ' {', + ' c.rgb /= c.a;', + ' }', + ' vec4 result;', + ' result.r = (uColorMatrix[0] * c.r) + (uColorMatrix[1] * c.g) + (uColorMatrix[2] * c.b) + (uColorMatrix[3] * c.a) + uColorMatrix[4];', + ' result.g = (uColorMatrix[5] * c.r) + (uColorMatrix[6] * c.g) + (uColorMatrix[7] * c.b) + (uColorMatrix[8] * c.a) + uColorMatrix[9];', + ' result.b = (uColorMatrix[10] * c.r) + (uColorMatrix[11] * c.g) + (uColorMatrix[12] * c.b) + (uColorMatrix[13] * c.a) + uColorMatrix[14];', + ' result.a = (uColorMatrix[15] * c.r) + (uColorMatrix[16] * c.g) + (uColorMatrix[17] * c.b) + (uColorMatrix[18] * c.a) + uColorMatrix[19];', + ' vec3 rgb = mix(c.rgb, result.rgb, uAlpha);', + ' rgb *= result.a;', + ' gl_FragColor = vec4(rgb, result.a);', + '}', +].join('\n'); + + +/***/ }), + +/***/ 79060: +/***/ ((module) => { + +module.exports = [ + '#define SHADER_NAME PHASER_COPY_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform float uBrightness;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' gl_FragColor = texture2D(uMainSampler, outTexCoord) * uBrightness;', + '}', +].join('\n'); - if (roundPixels) - { - x = Math.round(x); - y = Math.round(y); - } - ctx.save(); +/***/ }), - ctx.translate(x, y); +/***/ 87751: +/***/ ((module) => { - ctx.scale(scale, scale); +module.exports = [ + '#define SHADER_NAME BARREL_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform float amount;', + 'varying vec2 outTexCoord;', + 'vec2 Distort(vec2 p)', + '{', + ' float theta = atan(p.y, p.x);', + ' float radius = length(p);', + ' radius = pow(radius, amount);', + ' p.x = radius * cos(theta);', + ' p.y = radius * sin(theta);', + ' return 0.5 * (p + 1.0);', + '}', + 'void main()', + '{', + ' vec2 xy = 2.0 * outTexCoord - 1.0;', + ' vec2 texCoord = outTexCoord;', + ' if (length(xy) < 1.0)', + ' {', + ' texCoord = Distort(xy);', + ' }', + ' gl_FragColor = texture2D(uMainSampler, texCoord);', + '}', +].join('\n'); - ctx.drawImage(image, glyphX, glyphY, glyphW, glyphH, 0, 0, glyphW, glyphH); - ctx.restore(); - } +/***/ }), - ctx.restore(); -}; +/***/ 88222: +/***/ ((module) => { -module.exports = BitmapTextCanvasRenderer; +module.exports = [ + '#define SHADER_NAME BLOOM_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform vec2 offset;', + 'uniform float strength;', + 'uniform vec3 color;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' vec4 sum = texture2D(uMainSampler, outTexCoord) * 0.204164 * strength;', + ' sum = sum + texture2D(uMainSampler, outTexCoord + offset * 1.407333) * 0.304005;', + ' sum = sum + texture2D(uMainSampler, outTexCoord - offset * 1.407333) * 0.304005;', + ' sum = sum + texture2D(uMainSampler, outTexCoord + offset * 3.294215) * 0.093913;', + ' gl_FragColor = (sum + texture2D(uMainSampler, outTexCoord - offset * 3.294215) * 0.093913) * vec4(color, 1);', + '}', +].join('\n'); /***/ }), -/* 1049 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); +/***/ 44481: +/***/ ((module) => { -if (true) -{ - renderWebGL = __webpack_require__(1050); -} +module.exports = [ + '#define SHADER_NAME BLUR_HIGH_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform vec2 resolution;', + 'uniform vec2 offset;', + 'uniform float strength;', + 'uniform vec3 color;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' vec2 uv = outTexCoord;', + ' vec4 col = vec4(0.0);', + ' vec2 off1 = vec2(1.411764705882353) * offset * strength;', + ' vec2 off2 = vec2(3.2941176470588234) * offset * strength;', + ' vec2 off3 = vec2(5.176470588235294) * offset * strength;', + ' col += texture2D(uMainSampler, uv) * 0.1964825501511404;', + ' col += texture2D(uMainSampler, uv + (off1 / resolution)) * 0.2969069646728344;', + ' col += texture2D(uMainSampler, uv - (off1 / resolution)) * 0.2969069646728344;', + ' col += texture2D(uMainSampler, uv + (off2 / resolution)) * 0.09447039785044732;', + ' col += texture2D(uMainSampler, uv - (off2 / resolution)) * 0.09447039785044732;', + ' col += texture2D(uMainSampler, uv + (off3 / resolution)) * 0.010381362401148057;', + ' col += texture2D(uMainSampler, uv - (off3 / resolution)) * 0.010381362401148057;', + ' gl_FragColor = col * vec4(color, 1.0);', + '}', +].join('\n'); -if (true) -{ - renderCanvas = __webpack_require__(1051); -} -module.exports = { +/***/ }), - renderWebGL: renderWebGL, - renderCanvas: renderCanvas +/***/ 35491: +/***/ ((module) => { -}; +module.exports = [ + '#define SHADER_NAME BLUR_LOW_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform vec2 resolution;', + 'uniform float strength;', + 'uniform vec3 color;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' vec2 uv = outTexCoord;', + ' vec4 col = vec4(0.0);', + ' vec2 offset = vec2(1.333) * strength;', + ' col += texture2D(uMainSampler, uv) * 0.29411764705882354;', + ' col += texture2D(uMainSampler, uv + (offset / resolution)) * 0.35294117647058826;', + ' col += texture2D(uMainSampler, uv - (offset / resolution)) * 0.35294117647058826;', + ' gl_FragColor = col * vec4(color, 1.0);', + '}', +].join('\n'); /***/ }), -/* 1050 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ -var TransformMatrix = __webpack_require__(25); -var Utils = __webpack_require__(12); +/***/ 75568: +/***/ ((module) => { -var tempMatrix = new TransformMatrix(); - -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Blitter#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Blitter} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var BlitterWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - var list = src.getRenderList(); +module.exports = [ + '#define SHADER_NAME BLUR_MED_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform vec2 resolution;', + 'uniform vec2 offset;', + 'uniform float strength;', + 'uniform vec3 color;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' vec2 uv = outTexCoord;', + ' vec4 col = vec4(0.0);', + ' vec2 off1 = vec2(1.3846153846) * offset * strength;', + ' vec2 off2 = vec2(3.2307692308) * offset * strength;', + ' col += texture2D(uMainSampler, uv) * 0.2270270270;', + ' col += texture2D(uMainSampler, uv + (off1 / resolution)) * 0.3162162162;', + ' col += texture2D(uMainSampler, uv - (off1 / resolution)) * 0.3162162162;', + ' col += texture2D(uMainSampler, uv + (off2 / resolution)) * 0.0702702703;', + ' col += texture2D(uMainSampler, uv - (off2 / resolution)) * 0.0702702703;', + ' gl_FragColor = col * vec4(color, 1.0);', + '}', +].join('\n'); - if (list.length === 0) - { - return; - } - var alpha = camera.alpha * src.alpha; +/***/ }), - if (alpha === 0) - { - // Nothing to see, so abort early - return; - } +/***/ 69960: +/***/ ((module) => { - camera.addToRenderList(src); +module.exports = [ + '#define SHADER_NAME BOKEH_FS', + 'precision mediump float;', + '#define ITERATIONS 100.0', + '#define ONEOVER_ITR 1.0 / ITERATIONS', + '#define PI 3.141596', + '#define GOLDEN_ANGLE 2.39996323', + 'uniform sampler2D uMainSampler;', + 'uniform vec2 resolution;', + 'uniform float radius;', + 'uniform float amount;', + 'uniform float contrast;', + 'uniform bool isTiltShift;', + 'uniform float strength;', + 'uniform vec2 blur;', + 'varying vec2 outTexCoord;', + 'vec2 Sample (in float theta, inout float r)', + '{', + ' r += 1.0 / r;', + ' return (r - 1.0) * vec2(cos(theta), sin(theta)) * 0.06;', + '}', + 'vec3 Bokeh (sampler2D tex, vec2 uv, float radius)', + '{', + ' vec3 acc = vec3(0.0);', + ' vec3 div = vec3(0.0);', + ' vec2 pixel = vec2(resolution.y / resolution.x, 1.0) * radius * .025;', + ' float r = 1.0;', + ' for (float j = 0.0; j < GOLDEN_ANGLE * ITERATIONS; j += GOLDEN_ANGLE)', + ' {', + ' vec3 col = texture2D(tex, uv + pixel * Sample(j, r)).xyz;', + ' col = contrast > 0.0 ? col * col * (1.0 + contrast) : col;', + ' vec3 bokeh = vec3(0.5) + pow(col, vec3(10.0)) * amount;', + ' acc += col * bokeh;', + ' div += bokeh;', + ' }', + ' return acc / div;', + '}', + 'void main ()', + '{', + ' float shift = 1.0;', + ' if (isTiltShift)', + ' {', + ' vec2 uv = vec2(gl_FragCoord.xy / resolution + vec2(-0.5, -0.5)) * 2.0;', + ' float centerStrength = 1.0;', + ' shift = length(uv * blur * strength) * centerStrength;', + ' }', + ' gl_FragColor = vec4(Bokeh(uMainSampler, outTexCoord * vec2(1.0, 1.0), radius * shift), 0.0);', + '}', +].join('\n'); - var pipeline = renderer.pipelines.set(this.pipeline, src); - var cameraScrollX = camera.scrollX * src.scrollFactorX; - var cameraScrollY = camera.scrollY * src.scrollFactorY; +/***/ }), - var calcMatrix = tempMatrix.copyFrom(camera.matrix); +/***/ 33754: +/***/ ((module) => { - if (parentMatrix) - { - calcMatrix.multiplyWithOffset(parentMatrix, -cameraScrollX, -cameraScrollY); +module.exports = [ + '#define SHADER_NAME CIRCLE_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform vec2 resolution;', + 'uniform vec3 color;', + 'uniform vec4 backgroundColor;', + 'uniform float thickness;', + 'uniform float scale;', + 'uniform float feather;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' vec4 texture = texture2D(uMainSampler, outTexCoord);', + ' vec2 position = (gl_FragCoord.xy / resolution.xy) * 2.0 - 1.0;', + ' float aspectRatio = resolution.x / resolution.y;', + ' position.x *= aspectRatio;', + ' float grad = length(position);', + ' float outer = aspectRatio;', + ' float inner = outer - (thickness * 2.0 / resolution.y);', + ' if (aspectRatio >= 1.0)', + ' {', + ' float f = 2.0 + (resolution.y / resolution.x);', + ' outer = 1.0;', + ' inner = 1.0 - (thickness * f / resolution.x);', + ' }', + ' outer *= scale;', + ' inner *= scale;', + ' float circle = smoothstep(outer, outer - 0.01, grad);', + ' float ring = circle - smoothstep(inner, inner - feather, grad);', + ' texture = mix(backgroundColor * backgroundColor.a, texture, texture.a);', + ' texture = (texture * (circle - ring));', + ' gl_FragColor = vec4(texture.rgb + (ring * color), texture.a);', + '}', +].join('\n'); - cameraScrollX = 0; - cameraScrollY = 0; - } - var blitterX = src.x - cameraScrollX; - var blitterY = src.y - cameraScrollY; - var prevTextureSourceIndex = -1; - var tintEffect = false; - var roundPixels = camera.roundPixels; +/***/ }), - renderer.pipelines.preBatch(src); +/***/ 35668: +/***/ ((module) => { - for (var index = 0; index < list.length; index++) - { - var bob = list[index]; - var frame = bob.frame; - var bobAlpha = bob.alpha * alpha; +module.exports = [ + '#define SHADER_NAME DISPLACEMENT_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform sampler2D uDisplacementSampler;', + 'uniform vec2 amount;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' vec2 disp = (-vec2(0.5, 0.5) + texture2D(uDisplacementSampler, outTexCoord).rr) * amount;', + ' gl_FragColor = texture2D(uMainSampler, outTexCoord + disp).rgba;', + '}', +].join('\n'); - if (bobAlpha === 0) - { - continue; - } - var width = frame.width; - var height = frame.height; +/***/ }), - var x = blitterX + bob.x + frame.x; - var y = blitterY + bob.y + frame.y; +/***/ 69675: +/***/ ((module) => { - if (bob.flipX) - { - width *= -1; - x += frame.width; - } +module.exports = [ + '#define SHADER_NAME GLOW_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'varying vec2 outTexCoord;', + 'uniform float outerStrength;', + 'uniform float innerStrength;', + 'uniform vec2 resolution;', + 'uniform vec4 glowColor;', + 'uniform bool knockout;', + 'const float PI = 3.14159265358979323846264;', + 'const float DIST = __DIST__;', + 'const float SIZE = min(__SIZE__, PI * 2.0);', + 'const float STEP = ceil(PI * 2.0 / SIZE);', + 'const float MAX_ALPHA = STEP * DIST * (DIST + 1.0) / 2.0;', + 'void main ()', + '{', + ' vec2 px = vec2(1.0 / resolution.x, 1.0 / resolution.y);', + ' float totalAlpha = 0.0;', + ' vec2 direction;', + ' vec2 displaced;', + ' vec4 color;', + ' for (float angle = 0.0; angle < PI * 2.0; angle += SIZE)', + ' {', + ' direction = vec2(cos(angle), sin(angle)) * px;', + ' for (float curDistance = 0.0; curDistance < DIST; curDistance++)', + ' {', + ' displaced = outTexCoord + direction * (curDistance + 1.0);', + ' color = texture2D(uMainSampler, displaced);', + ' totalAlpha += (DIST - curDistance) * color.a;', + ' }', + ' }', + ' color = texture2D(uMainSampler, outTexCoord);', + ' float alphaRatio = (totalAlpha / MAX_ALPHA);', + ' float innerGlowAlpha = (1.0 - alphaRatio) * innerStrength * color.a;', + ' float innerGlowStrength = min(1.0, innerGlowAlpha);', + ' vec4 innerColor = mix(color, glowColor, innerGlowStrength);', + ' float outerGlowAlpha = alphaRatio * outerStrength * (1.0 - color.a);', + ' float outerGlowStrength = min(1.0 - innerColor.a, outerGlowAlpha);', + ' vec4 outerGlowColor = outerGlowStrength * glowColor.rgba;', + ' if (knockout)', + ' {', + ' float resultAlpha = outerGlowAlpha + innerGlowAlpha;', + ' gl_FragColor = vec4(glowColor.rgb * resultAlpha, resultAlpha);', + ' }', + ' else', + ' {', + ' gl_FragColor = innerColor + outerGlowColor;', + ' }', + '}', +].join('\n'); - if (bob.flipY) - { - height *= -1; - y += frame.height; - } - var xw = x + width; - var yh = y + height; +/***/ }), - var tx0 = calcMatrix.getX(x, y); - var ty0 = calcMatrix.getY(x, y); +/***/ 90993: +/***/ ((module) => { - var tx1 = calcMatrix.getX(xw, yh); - var ty1 = calcMatrix.getY(xw, yh); +module.exports = [ + '#define SHADER_NAME GRADIENT_FS', + '#define SRGB_TO_LINEAR(c) pow((c), vec3(2.2))', + '#define LINEAR_TO_SRGB(c) pow((c), vec3(1.0 / 2.2))', + '#define SRGB(r, g, b) SRGB_TO_LINEAR(vec3(float(r), float(g), float(b)) / 255.0)', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform vec2 positionFrom;', + 'uniform vec2 positionTo;', + 'uniform vec3 color1;', + 'uniform vec3 color2;', + 'uniform float alpha;', + 'uniform int size;', + 'varying vec2 outTexCoord;', + 'float gradientNoise(in vec2 uv)', + '{', + ' const vec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);', + ' return fract(magic.z * fract(dot(uv, magic.xy)));', + '}', + 'float stepped (in float s, in float scale, in int steps)', + '{', + ' return steps > 0 ? floor( s / ((1.0 * scale) / float(steps))) * 1.0 / float(steps - 1) : s;', + '}', + 'void main ()', + '{', + ' vec2 a = positionFrom;', + ' vec2 b = positionTo;', + ' vec2 ba = b - a;', + ' float d = dot(outTexCoord - a, ba) / dot(ba, ba);', + ' float t = size > 0 ? stepped(d, 1.0, size) : d;', + ' t = smoothstep(0.0, 1.0, clamp(t, 0.0, 1.0));', + ' vec3 color = mix(SRGB(color1.r, color1.g, color1.b), SRGB(color2.r, color2.g, color2.b), t);', + ' color = LINEAR_TO_SRGB(color);', + ' color += (1.0 / 255.0) * gradientNoise(outTexCoord) - (0.5 / 255.0);', + ' vec4 texture = texture2D(uMainSampler, outTexCoord);', + ' gl_FragColor = vec4(mix(color.rgb, texture.rgb, alpha), 1.0) * texture.a;', + '}', +].join('\n'); - var tint = Utils.getTintAppendFloatAlpha(bob.tint, bobAlpha); - // Bind texture only if the Texture Source is different from before - if (frame.sourceIndex !== prevTextureSourceIndex) - { - var textureUnit = pipeline.setGameObject(src, frame); +/***/ }), - prevTextureSourceIndex = frame.sourceIndex; - } +/***/ 37945: +/***/ ((module) => { - if (roundPixels) - { - tx0 = Math.round(tx0); - ty0 = Math.round(ty0); +module.exports = [ + '#define SHADER_NAME PIXELATE_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform vec2 resolution;', + 'uniform float amount;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' float pixelSize = floor(2.0 + amount);', + ' vec2 center = pixelSize * floor(outTexCoord * resolution / pixelSize) + pixelSize * vec2(0.5, 0.5);', + ' vec2 corner1 = center + pixelSize * vec2(-0.5, -0.5);', + ' vec2 corner2 = center + pixelSize * vec2(+0.5, -0.5);', + ' vec2 corner3 = center + pixelSize * vec2(+0.5, +0.5);', + ' vec2 corner4 = center + pixelSize * vec2(-0.5, +0.5);', + ' vec4 pixel = 0.4 * texture2D(uMainSampler, center / resolution);', + ' pixel += 0.15 * texture2D(uMainSampler, corner1 / resolution);', + ' pixel += 0.15 * texture2D(uMainSampler, corner2 / resolution);', + ' pixel += 0.15 * texture2D(uMainSampler, corner3 / resolution);', + ' pixel += 0.15 * texture2D(uMainSampler, corner4 / resolution);', + ' gl_FragColor = pixel;', + '}', +].join('\n'); - tx1 = Math.round(tx1); - ty1 = Math.round(ty1); - } - // TL x/y, BL x/y, BR x/y, TR x/y - if (pipeline.batchQuad(src, tx0, ty0, tx0, ty1, tx1, ty1, tx1, ty0, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, frame.glTexture, textureUnit)) - { - prevTextureSourceIndex = -1; - } - } +/***/ }), - renderer.pipelines.postBatch(src); -}; +/***/ 85718: +/***/ ((module) => { -module.exports = BlitterWebGLRenderer; +module.exports = [ + '#define SHADER_NAME SHADOW_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'varying vec2 outTexCoord;', + 'uniform vec2 lightPosition;', + 'uniform vec4 color;', + 'uniform float decay;', + 'uniform float power;', + 'uniform float intensity;', + 'uniform int samples;', + 'const int MAX = 12;', + 'void main ()', + '{', + ' vec4 texture = texture2D(uMainSampler, outTexCoord);', + ' vec2 pc = (lightPosition - outTexCoord) * intensity;', + ' float shadow = 0.0;', + ' float limit = max(float(MAX), float(samples));', + ' for (int i = 0; i < MAX; ++i)', + ' {', + ' if (i >= samples)', + ' {', + ' break;', + ' }', + ' shadow += texture2D(uMainSampler, outTexCoord + float(i) * decay / limit * pc).a * power;', + ' }', + ' float mask = 1.0 - texture.a;', + ' gl_FragColor = mix(texture, color, shadow * mask);', + '}', +].join('\n'); /***/ }), -/* 1051 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Blitter#renderCanvas - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Blitter} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var BlitterCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - var list = src.getRenderList(); +/***/ 13740: +/***/ ((module) => { - if (list.length === 0) - { - return; - } +module.exports = [ + '#define SHADER_NAME SHINE_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform vec2 resolution;', + 'uniform bool reveal;', + 'uniform float speed;', + 'uniform float time;', + 'uniform float lineWidth;', + 'uniform float gradient;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' vec2 uv = gl_FragCoord.xy / resolution.xy;', + ' vec4 tex = texture2D(uMainSampler, outTexCoord);', + ' vec4 col1 = vec4(0.3, 0.0, 0.0, 1.0);', + ' vec4 col2 = vec4(0.85, 0.85, 0.85, 1.0);', + ' uv.x = uv.x - mod(time * speed, 2.0) + 0.5;', + ' float y = uv.x * gradient;', + ' float s = smoothstep(y - lineWidth, y, uv.y) - smoothstep(y, y + lineWidth, uv.y);', + ' gl_FragColor = (((s * col1) + (s * col2)) * tex);', + ' if (!reveal)', + ' {', + ' gl_FragColor += tex;', + ' }', + '}', +].join('\n'); - var ctx = renderer.currentContext; - var alpha = camera.alpha * src.alpha; +/***/ }), - if (alpha === 0) - { - // Nothing to see, so abort early - return; - } +/***/ 80617: +/***/ ((module) => { - camera.addToRenderList(src); +module.exports = [ + '#define SHADER_NAME VIGNETTE_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform float radius;', + 'uniform float strength;', + 'uniform vec2 position;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' vec4 col = vec4(1.0);', + ' float d = length(outTexCoord - position);', + ' if (d <= radius)', + ' {', + ' float g = d / radius;', + ' g = sin(g * 3.14 * strength);', + ' col = vec4(g * g * g);', + ' }', + ' vec4 texture = texture2D(uMainSampler, outTexCoord);', + ' gl_FragColor = texture * (1.0 - col);', + '}', +].join('\n'); - // Blend Mode + Scale Mode - ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; - ctx.imageSmoothingEnabled = !(!renderer.antialias || src.frame.source.scaleMode); +/***/ }), - var cameraScrollX = src.x - camera.scrollX * src.scrollFactorX; - var cameraScrollY = src.y - camera.scrollY * src.scrollFactorY; +/***/ 62879: +/***/ ((module) => { - ctx.save(); +module.exports = [ + '#define SHADER_NAME WIPE_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'uniform vec4 config;', + 'uniform bool reveal;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' vec2 uv = outTexCoord;', + ' vec4 color0;', + ' vec4 color1;', + ' if (reveal)', + ' {', + ' color0 = vec4(0);', + ' color1 = texture2D(uMainSampler, uv);', + ' }', + ' else', + ' {', + ' color0 = texture2D(uMainSampler, uv);', + ' color1 = vec4(0);', + ' }', + ' float distance = config.x;', + ' float width = config.y;', + ' float direction = config.z;', + ' float axis = uv.x;', + ' if (config.w == 1.0)', + ' {', + ' axis = uv.y;', + ' }', + ' float adjust = mix(width, -width, distance);', + ' float value = smoothstep(distance - width, distance + width, abs(direction - axis) + adjust);', + ' gl_FragColor = mix(color1, color0, value);', + '}', +].join('\n'); - if (parentMatrix) - { - parentMatrix.copyToContext(ctx); - } - var roundPixels = camera.roundPixels; +/***/ }), - // Render bobs - for (var i = 0; i < list.length; i++) - { - var bob = list[i]; - var flip = (bob.flipX || bob.flipY); - var frame = bob.frame; - var cd = frame.canvasData; - var dx = frame.x; - var dy = frame.y; - var fx = 1; - var fy = 1; +/***/ 65045: +/***/ ((module) => { - var bobAlpha = bob.alpha * alpha; +module.exports = [ + '#define SHADER_NAME PHASER_LIGHT_FS', + 'precision mediump float;', + 'struct Light', + '{', + ' vec2 position;', + ' vec3 color;', + ' float intensity;', + ' float radius;', + '};', + 'const int kMaxLights = %LIGHT_COUNT%;', + 'uniform vec4 uCamera; /* x, y, rotation, zoom */', + 'uniform vec2 uResolution;', + 'uniform sampler2D uMainSampler;', + 'uniform sampler2D uNormSampler;', + 'uniform vec3 uAmbientLightColor;', + 'uniform Light uLights[kMaxLights];', + 'uniform mat3 uInverseRotationMatrix;', + 'uniform int uLightCount;', + 'varying vec2 outTexCoord;', + 'varying float outTexId;', + 'varying float outTintEffect;', + 'varying vec4 outTint;', + 'void main ()', + '{', + ' vec3 finalColor = vec3(0.0, 0.0, 0.0);', + ' vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);', + ' vec4 texture = texture2D(uMainSampler, outTexCoord);', + ' vec4 color = texture * texel;', + ' if (outTintEffect == 1.0)', + ' {', + ' color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);', + ' }', + ' else if (outTintEffect == 2.0)', + ' {', + ' color = texel;', + ' }', + ' vec3 normalMap = texture2D(uNormSampler, outTexCoord).rgb;', + ' vec3 normal = normalize(uInverseRotationMatrix * vec3(normalMap * 2.0 - 1.0));', + ' vec2 res = vec2(min(uResolution.x, uResolution.y)) * uCamera.w;', + ' for (int index = 0; index < kMaxLights; ++index)', + ' {', + ' if (index < uLightCount)', + ' {', + ' Light light = uLights[index];', + ' vec3 lightDir = vec3((light.position.xy / res) - (gl_FragCoord.xy / res), 0.1);', + ' vec3 lightNormal = normalize(lightDir);', + ' float distToSurf = length(lightDir) * uCamera.w;', + ' float diffuseFactor = max(dot(normal, lightNormal), 0.0);', + ' float radius = (light.radius / res.x * uCamera.w) * uCamera.w;', + ' float attenuation = clamp(1.0 - distToSurf * distToSurf / (radius * radius), 0.0, 1.0);', + ' vec3 diffuse = light.color * diffuseFactor;', + ' finalColor += (attenuation * diffuse) * light.intensity;', + ' }', + ' }', + ' vec4 colorOutput = vec4(uAmbientLightColor + finalColor, 1.0);', + ' gl_FragColor = color * vec4(colorOutput.rgb * colorOutput.a, colorOutput.a);', + '}', +].join('\n'); - if (bobAlpha === 0) - { - continue; - } - ctx.globalAlpha = bobAlpha; +/***/ }), - if (!flip) - { - if (roundPixels) - { - dx = Math.round(dx); - dy = Math.round(dy); - } +/***/ 98921: +/***/ ((module) => { - ctx.drawImage( - frame.source.image, - cd.x, - cd.y, - cd.width, - cd.height, - dx + bob.x + cameraScrollX, - dy + bob.y + cameraScrollY, - cd.width, - cd.height - ); - } - else - { - if (bob.flipX) - { - fx = -1; - dx -= cd.width; - } +module.exports = [ + '#define SHADER_NAME PHASER_LINEAR_BLEND_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler1;', + 'uniform sampler2D uMainSampler2;', + 'uniform float uStrength;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' vec4 frame1 = texture2D(uMainSampler1, outTexCoord);', + ' vec4 frame2 = texture2D(uMainSampler2, outTexCoord);', + ' gl_FragColor = mix(frame1, frame2 * uStrength, 0.5);', + '}', +].join('\n'); - if (bob.flipY) - { - fy = -1; - dy -= cd.height; - } - ctx.save(); - ctx.translate(bob.x + cameraScrollX, bob.y + cameraScrollY); - ctx.scale(fx, fy); - ctx.drawImage(frame.source.image, cd.x, cd.y, cd.width, cd.height, dx, dy, cd.width, cd.height); - ctx.restore(); - } - } +/***/ }), - ctx.restore(); -}; +/***/ 25005: +/***/ ((module) => { -module.exports = BlitterCanvasRenderer; +module.exports = [ + '#define SHADER_NAME PHASER_MESH_FS', + 'precision mediump float;', + 'uniform vec3 uLightPosition;', + 'uniform vec3 uLightAmbient;', + 'uniform vec3 uLightDiffuse;', + 'uniform vec3 uLightSpecular;', + 'uniform vec3 uFogColor;', + 'uniform float uFogNear;', + 'uniform float uFogFar;', + 'uniform vec3 uMaterialAmbient;', + 'uniform vec3 uMaterialDiffuse;', + 'uniform vec3 uMaterialSpecular;', + 'uniform float uMaterialShine;', + 'uniform vec3 uCameraPosition;', + 'uniform sampler2D uTexture;', + 'varying vec2 vTextureCoord;', + 'varying vec3 vNormal;', + 'varying vec3 vPosition;', + 'void main (void)', + '{', + ' vec4 color = texture2D(uTexture, vTextureCoord);', + ' vec3 ambient = uLightAmbient * uMaterialAmbient;', + ' vec3 norm = normalize(vNormal);', + ' vec3 lightDir = normalize(uLightPosition - vPosition);', + ' float diff = max(dot(norm, lightDir), 0.0);', + ' vec3 diffuse = uLightDiffuse * (diff * uMaterialDiffuse);', + ' vec3 viewDir = normalize(uCameraPosition - vPosition);', + ' vec3 reflectDir = reflect(-lightDir, norm);', + ' float spec = pow(max(dot(viewDir, reflectDir), 0.0), uMaterialShine);', + ' vec3 specular = uLightSpecular * (spec * uMaterialSpecular);', + ' vec3 result = (ambient + diffuse + specular) * color.rgb;', + ' float depth = gl_FragCoord.z / gl_FragCoord.w;', + ' float fogFactor = smoothstep(uFogNear, uFogFar, depth);', + ' gl_FragColor.rgb = mix(result.rgb, uFogColor, fogFactor);', + ' gl_FragColor.a = color.a;', + '}', +].join('\n'); /***/ }), -/* 1052 */ -/***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); +/***/ 94914: +/***/ ((module) => { -if (true) -{ - renderWebGL = __webpack_require__(1053); -} +module.exports = [ + '#define SHADER_NAME PHASER_MESH_VS', + 'precision mediump float;', + 'attribute vec3 aVertexPosition;', + 'attribute vec3 aVertexNormal;', + 'attribute vec2 aTextureCoord;', + 'uniform mat4 uViewProjectionMatrix;', + 'uniform mat4 uModelMatrix;', + 'uniform mat4 uNormalMatrix;', + 'varying vec2 vTextureCoord;', + 'varying vec3 vNormal;', + 'varying vec3 vPosition;', + 'void main ()', + '{', + ' vTextureCoord = aTextureCoord;', + ' vPosition = vec3(uModelMatrix * vec4(aVertexPosition, 1.0));', + ' vNormal = vec3(uNormalMatrix * vec4(aVertexNormal, 1.0));', + ' gl_Position = uViewProjectionMatrix * uModelMatrix * vec4(aVertexPosition, 1.0);', + '}', +].join('\n'); -if (true) -{ - renderCanvas = __webpack_require__(1054); -} -module.exports = { +/***/ }), - renderWebGL: renderWebGL, - renderCanvas: renderCanvas +/***/ 11263: +/***/ ((module) => { -}; +module.exports = [ + '#define SHADER_NAME PHASER_MOBILE_FS', + '#ifdef GL_FRAGMENT_PRECISION_HIGH', + 'precision highp float;', + '#else', + 'precision mediump float;', + '#endif', + 'uniform sampler2D uMainSampler;', + 'varying vec2 outTexCoord;', + 'varying float outTintEffect;', + 'varying vec4 outTint;', + 'void main ()', + '{', + ' vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);', + ' vec4 texture = texture2D(uMainSampler, outTexCoord);', + ' vec4 color = texture * texel;', + ' if (outTintEffect == 1.0)', + ' {', + ' color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);', + ' }', + ' else if (outTintEffect == 2.0)', + ' {', + ' color = texel;', + ' }', + ' gl_FragColor = color;', + '}', +].join('\n'); /***/ }), -/* 1053 */ -/***/ (function(module, exports) { -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +/***/ 51852: +/***/ ((module) => { -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Container#renderWebGL - * @since 3.4.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Container} container - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var ContainerWebGLRenderer = function (renderer, container, camera, parentMatrix) -{ - camera.addToRenderList(container); +module.exports = [ + '#define SHADER_NAME PHASER_MOBILE_VS', + '#ifdef GL_FRAGMENT_PRECISION_HIGH', + 'precision highp float;', + '#else', + 'precision mediump float;', + '#endif', + 'uniform mat4 uProjectionMatrix;', + 'attribute vec2 inPosition;', + 'attribute vec2 inTexCoord;', + 'attribute float inTexId;', + 'attribute float inTintEffect;', + 'attribute vec4 inTint;', + 'varying vec2 outTexCoord;', + 'varying float outTintEffect;', + 'varying vec4 outTint;', + 'void main ()', + '{', + ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', + ' outTexCoord = inTexCoord;', + ' outTint = inTint;', + ' outTintEffect = inTintEffect;', + '}', +].join('\n'); - var children = container.list; - var childCount = children.length; - if (childCount === 0) - { - return; - } +/***/ }), - var transformMatrix = container.localTransform; +/***/ 53787: +/***/ ((module) => { - if (parentMatrix) - { - transformMatrix.loadIdentity(); - transformMatrix.multiply(parentMatrix); - transformMatrix.translate(container.x, container.y); - transformMatrix.rotate(container.rotation); - transformMatrix.scale(container.scaleX, container.scaleY); - } - else - { - transformMatrix.applyITRS(container.x, container.y, container.rotation, container.scaleX, container.scaleY); - } +module.exports = [ + '#define SHADER_NAME PHASER_MULTI_FS', + '#ifdef GL_FRAGMENT_PRECISION_HIGH', + 'precision highp float;', + '#else', + 'precision mediump float;', + '#endif', + 'uniform sampler2D uMainSampler[%count%];', + 'varying vec2 outTexCoord;', + 'varying float outTexId;', + 'varying float outTintEffect;', + 'varying vec4 outTint;', + 'void main ()', + '{', + ' vec4 texture;', + ' %forloop%', + ' vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);', + ' vec4 color = texture * texel;', + ' if (outTintEffect == 1.0)', + ' {', + ' color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);', + ' }', + ' else if (outTintEffect == 2.0)', + ' {', + ' color = texel;', + ' }', + ' gl_FragColor = color;', + '}', +].join('\n'); - renderer.pipelines.preBatch(container); - var containerHasBlendMode = (container.blendMode !== -1); +/***/ }), - if (!containerHasBlendMode) - { - // If Container is SKIP_TEST then set blend mode to be Normal - renderer.setBlendMode(0); - } +/***/ 15968: +/***/ ((module) => { - var alpha = container.alpha; +module.exports = [ + '#define SHADER_NAME PHASER_MULTI_VS', + '#ifdef GL_FRAGMENT_PRECISION_HIGH', + 'precision highp float;', + '#else', + 'precision mediump float;', + '#endif', + 'uniform mat4 uProjectionMatrix;', + 'attribute vec2 inPosition;', + 'attribute vec2 inTexCoord;', + 'attribute float inTexId;', + 'attribute float inTintEffect;', + 'attribute vec4 inTint;', + 'varying vec2 outTexCoord;', + 'varying float outTexId;', + 'varying float outTintEffect;', + 'varying vec4 outTint;', + 'void main ()', + '{', + ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', + ' outTexCoord = inTexCoord;', + ' outTexId = inTexId;', + ' outTint = inTint;', + ' outTintEffect = inTintEffect;', + '}', +].join('\n'); - var scrollFactorX = container.scrollFactorX; - var scrollFactorY = container.scrollFactorY; - for (var i = 0; i < childCount; i++) - { - var child = children[i]; +/***/ }), - if (!child.willRender(camera)) - { - continue; - } +/***/ 83327: +/***/ ((module) => { - var childAlphaTopLeft; - var childAlphaTopRight; - var childAlphaBottomLeft; - var childAlphaBottomRight; +module.exports = [ + '#define SHADER_NAME PHASER_POINTLIGHT_FS', + 'precision mediump float;', + 'uniform vec2 uResolution;', + 'uniform float uCameraZoom;', + 'varying vec4 lightPosition;', + 'varying vec4 lightColor;', + 'varying float lightRadius;', + 'varying float lightAttenuation;', + 'void main ()', + '{', + ' vec2 center = (lightPosition.xy + 1.0) * (uResolution.xy * 0.5);', + ' float distToSurf = length(center - gl_FragCoord.xy);', + ' float radius = 1.0 - distToSurf / (lightRadius * uCameraZoom);', + ' float intensity = smoothstep(0.0, 1.0, radius * lightAttenuation);', + ' vec4 color = vec4(intensity, intensity, intensity, 0.0) * lightColor;', + ' gl_FragColor = vec4(color.rgb * lightColor.a, color.a);', + '}', +].join('\n'); - if (child.alphaTopLeft !== undefined) - { - childAlphaTopLeft = child.alphaTopLeft; - childAlphaTopRight = child.alphaTopRight; - childAlphaBottomLeft = child.alphaBottomLeft; - childAlphaBottomRight = child.alphaBottomRight; - } - else - { - var childAlpha = child.alpha; - childAlphaTopLeft = childAlpha; - childAlphaTopRight = childAlpha; - childAlphaBottomLeft = childAlpha; - childAlphaBottomRight = childAlpha; - } +/***/ }), - var childScrollFactorX = child.scrollFactorX; - var childScrollFactorY = child.scrollFactorY; +/***/ 54677: +/***/ ((module) => { - if (!containerHasBlendMode && child.blendMode !== renderer.currentBlendMode) - { - // If Container doesn't have its own blend mode, then a child can have one - renderer.setBlendMode(child.blendMode); - } +module.exports = [ + '#define SHADER_NAME PHASER_POINTLIGHT_VS', + 'precision mediump float;', + 'uniform mat4 uProjectionMatrix;', + 'attribute vec2 inPosition;', + 'attribute vec2 inLightPosition;', + 'attribute vec4 inLightColor;', + 'attribute float inLightRadius;', + 'attribute float inLightAttenuation;', + 'varying vec4 lightPosition;', + 'varying vec4 lightColor;', + 'varying float lightRadius;', + 'varying float lightAttenuation;', + 'void main ()', + '{', + ' lightColor = inLightColor;', + ' lightRadius = inLightRadius;', + ' lightAttenuation = inLightAttenuation;', + ' lightPosition = uProjectionMatrix * vec4(inLightPosition, 1.0, 1.0);', + ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', + '}', +].join('\n'); - var mask = child.mask; - if (mask) - { - mask.preRenderWebGL(renderer, child, camera); - } +/***/ }), - var type = child.type; +/***/ 12569: +/***/ ((module) => { - if (type !== renderer.currentType) - { - renderer.newType = true; - renderer.currentType = type; - } +module.exports = [ + '#define SHADER_NAME PHASER_POSTFX_FS', + 'precision mediump float;', + 'uniform sampler2D uMainSampler;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' gl_FragColor = texture2D(uMainSampler, outTexCoord);', + '}', +].join('\n'); - renderer.nextTypeMatch = (i < childCount - 1) ? (children[i + 1].type === renderer.currentType) : false; - // Set parent values - child.setScrollFactor(childScrollFactorX * scrollFactorX, childScrollFactorY * scrollFactorY); +/***/ }), - child.setAlpha(childAlphaTopLeft * alpha, childAlphaTopRight * alpha, childAlphaBottomLeft * alpha, childAlphaBottomRight * alpha); +/***/ 99365: +/***/ ((module) => { - // Render - child.renderWebGL(renderer, child, camera, transformMatrix); +module.exports = [ + '#define SHADER_NAME PHASER_QUAD_VS', + 'precision mediump float;', + 'attribute vec2 inPosition;', + 'attribute vec2 inTexCoord;', + 'varying vec2 outFragCoord;', + 'varying vec2 outTexCoord;', + 'void main ()', + '{', + ' outFragCoord = inPosition.xy * 0.5 + 0.5;', + ' outTexCoord = inTexCoord;', + ' gl_Position = vec4(inPosition, 0, 1);', + '}', +].join('\n'); - // Restore original values - child.setAlpha(childAlphaTopLeft, childAlphaTopRight, childAlphaBottomLeft, childAlphaBottomRight); +/***/ }), - child.setScrollFactor(childScrollFactorX, childScrollFactorY); +/***/ 85060: +/***/ ((module) => { - if (mask) - { - mask.postRenderWebGL(renderer, camera); - } +module.exports = [ + '#define SHADER_NAME PHASER_SINGLE_FS', + '#ifdef GL_FRAGMENT_PRECISION_HIGH', + 'precision highp float;', + '#else', + 'precision mediump float;', + '#endif', + 'uniform sampler2D uMainSampler;', + 'varying vec2 outTexCoord;', + 'varying float outTintEffect;', + 'varying vec4 outTint;', + 'void main ()', + '{', + ' vec4 texture = texture2D(uMainSampler, outTexCoord);', + ' vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);', + ' vec4 color = texture * texel;', + ' if (outTintEffect == 1.0)', + ' {', + ' color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);', + ' }', + ' else if (outTintEffect == 2.0)', + ' {', + ' color = texel;', + ' }', + ' gl_FragColor = color;', + '}', +].join('\n'); - renderer.newType = false; - } - renderer.pipelines.postBatch(container); -}; +/***/ }), -module.exports = ContainerWebGLRenderer; +/***/ 18166: +/***/ ((module) => { + +module.exports = [ + '#define SHADER_NAME PHASER_SINGLE_VS', + 'precision mediump float;', + 'uniform mat4 uProjectionMatrix;', + 'attribute vec2 inPosition;', + 'attribute vec2 inTexCoord;', + 'attribute float inTexId;', + 'attribute float inTintEffect;', + 'attribute vec4 inTint;', + 'varying vec2 outTexCoord;', + 'varying float outTintEffect;', + 'varying vec4 outTint;', + 'void main ()', + '{', + ' gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);', + ' outTexCoord = inTexCoord;', + ' outTint = inTint;', + ' outTintEffect = inTintEffect;', + '}', +].join('\n'); /***/ }), -/* 1054 */ -/***/ (function(module, exports) { + +/***/ 92462: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * @namespace Phaser.Renderer.WebGL.Shaders + */ + +module.exports = { + + AddBlendFrag: __webpack_require__(2529), + BitmapMaskFrag: __webpack_require__(91679), + BitmapMaskVert: __webpack_require__(89053), + ColorMatrixFrag: __webpack_require__(37486), + CopyFrag: __webpack_require__(79060), + FXBarrelFrag: __webpack_require__(87751), + FXBloomFrag: __webpack_require__(88222), + FXBlurHighFrag: __webpack_require__(44481), + FXBlurLowFrag: __webpack_require__(35491), + FXBlurMedFrag: __webpack_require__(75568), + FXBokehFrag: __webpack_require__(69960), + FXCircleFrag: __webpack_require__(33754), + FXDisplacementFrag: __webpack_require__(35668), + FXGlowFrag: __webpack_require__(69675), + FXGradientFrag: __webpack_require__(90993), + FXPixelateFrag: __webpack_require__(37945), + FXShadowFrag: __webpack_require__(85718), + FXShineFrag: __webpack_require__(13740), + FXVignetteFrag: __webpack_require__(80617), + FXWipeFrag: __webpack_require__(62879), + LightFrag: __webpack_require__(65045), + LinearBlendFrag: __webpack_require__(98921), + MeshFrag: __webpack_require__(25005), + MeshVert: __webpack_require__(94914), + MobileFrag: __webpack_require__(11263), + MobileVert: __webpack_require__(51852), + MultiFrag: __webpack_require__(53787), + MultiVert: __webpack_require__(15968), + PointLightFrag: __webpack_require__(83327), + PointLightVert: __webpack_require__(54677), + PostFXFrag: __webpack_require__(12569), + QuadVert: __webpack_require__(99365), + SingleFrag: __webpack_require__(85060), + SingleVert: __webpack_require__(18166) + +}; + + +/***/ }), + +/***/ 756: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(55301); +var Class = __webpack_require__(56694); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(40444); +var GameEvents = __webpack_require__(97081); +var GetInnerHeight = __webpack_require__(74181); +var GetTarget = __webpack_require__(2893); +var GetScreenOrientation = __webpack_require__(9229); +var NOOP = __webpack_require__(72283); +var Rectangle = __webpack_require__(74118); +var Size = __webpack_require__(90881); +var SnapFloor = __webpack_require__(84314); +var Vector2 = __webpack_require__(93736); +var Camera = __webpack_require__(47751); + +/** + * @classdesc + * The Scale Manager handles the scaling, resizing and alignment of the game canvas. * - * @method Phaser.GameObjects.Container#renderCanvas - * @since 3.4.0 - * @private + * The way scaling is handled is by setting the game canvas to a fixed size, which is defined in the + * game configuration. You also define the parent container in the game config. If no parent is given, + * it will default to using the document body. The Scale Manager will then look at the available space + * within the _parent_ and scale the canvas accordingly. Scaling is handled by setting the canvas CSS + * width and height properties, leaving the width and height of the canvas element itself untouched. + * Scaling is therefore achieved by keeping the core canvas the same size and 'stretching' + * it via its CSS properties. This gives the same result and speed as using the `transform-scale` CSS + * property, without the need for browser prefix handling. * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Container} container - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * The calculations for the scale are heavily influenced by the bounding parent size, which is the computed + * dimensions of the canvas's parent. The CSS rules of the parent element play an important role in the + * operation of the Scale Manager. For example, if the parent has no defined width or height, then actions + * like auto-centering will fail to achieve the required result. The Scale Manager works in tandem with the + * CSS you set-up on the page hosting your game, rather than taking control of it. + * + * #### Parent and Display canvas containment guidelines: + * + * - Style the Parent element (of the game canvas) to control the Parent size and thus the games size and layout. + * + * - The Parent element's CSS styles should _effectively_ apply maximum (and minimum) bounding behavior. + * + * - The Parent element should _not_ apply a padding as this is not accounted for. + * If a padding is required apply it to the Parent's parent or apply a margin to the Parent. + * If you need to add a border, margin or any other CSS around your game container, then use a parent element and + * apply the CSS to this instead, otherwise you'll be constantly resizing the shape of the game container. + * + * - The Display canvas layout CSS styles (i.e. margins, size) should not be altered / specified as + * they may be updated by the Scale Manager. + * + * #### Scale Modes + * + * The way the scaling is handled is determined by the `scaleMode` property. The default is `NONE`, + * which prevents Phaser from scaling or touching the canvas, or its parent, at all. In this mode, you are + * responsible for all scaling. The other scaling modes afford you automatic scaling. + * + * If you wish to scale your game so that it always fits into the available space within the parent, you + * should use the scale mode `FIT`. Look at the documentation for other scale modes to see what options are + * available. Here is a basic config showing how to set this scale mode: + * + * ```javascript + * scale: { + * parent: 'yourgamediv', + * mode: Phaser.Scale.FIT, + * width: 800, + * height: 600 + * } + * ``` + * + * Place the `scale` config object within your game config. + * + * If you wish for the canvas to be resized directly, so that the canvas itself fills the available space + * (i.e. it isn't scaled, it's resized) then use the `RESIZE` scale mode. This will give you a 1:1 mapping + * of canvas pixels to game size. In this mode CSS isn't used to scale the canvas, it's literally adjusted + * to fill all available space within the parent. You should be extremely careful about the size of the + * canvas you're creating when doing this, as the larger the area, the more work the GPU has to do and it's + * very easy to hit fill-rate limits quickly. + * + * For complex, custom-scaling requirements, you should probably consider using the `RESIZE` scale mode, + * with your own limitations in place re: canvas dimensions and managing the scaling with the game scenes + * yourself. For the vast majority of games, however, the `FIT` mode is likely to be the most used. + * + * Please appreciate that the Scale Manager cannot perform miracles. All it does is scale your game canvas + * as best it can, based on what it can infer from its surrounding area. There are all kinds of environments + * where it's up to you to guide and help the canvas position itself, especially when built into rendering + * frameworks like React and Vue. If your page requires meta tags to prevent user scaling gestures, or such + * like, then it's up to you to ensure they are present in the html. + * + * #### Centering + * + * You can also have the game canvas automatically centered. Again, this relies heavily on the parent being + * properly configured and styled, as the centering offsets are based entirely on the available space + * within the parent element. Centering is disabled by default, or can be applied horizontally, vertically, + * or both. Here's an example: + * + * ```javascript + * scale: { + * parent: 'yourgamediv', + * autoCenter: Phaser.Scale.CENTER_BOTH, + * width: 800, + * height: 600 + * } + * ``` + * + * #### Fullscreen API + * + * If the browser supports it, you can send your game into fullscreen mode. In this mode, the game will fill + * the entire display, removing all browser UI and anything else present on the screen. It will remain in this + * mode until your game either disables it, or until the user tabs out or presses ESCape if on desktop. It's a + * great way to achieve a desktop-game like experience from the browser, but it does require a modern browser + * to handle it. Some mobile browsers also support this. + * + * @class ScaleManager + * @memberof Phaser.Scale + * @extends Phaser.Events.EventEmitter + * @constructor + * @since 3.16.0 + * + * @param {Phaser.Game} game - A reference to the Phaser.Game instance. */ -var ContainerCanvasRenderer = function (renderer, container, camera, parentMatrix) -{ - camera.addToRenderList(container); +var ScaleManager = new Class({ - var children = container.list; + Extends: EventEmitter, - if (children.length === 0) + initialize: + + function ScaleManager (game) { - return; - } + EventEmitter.call(this); - var transformMatrix = container.localTransform; + /** + * A reference to the Phaser.Game instance. + * + * @name Phaser.Scale.ScaleManager#game + * @type {Phaser.Game} + * @readonly + * @since 3.15.0 + */ + this.game = game; - if (parentMatrix) - { - transformMatrix.loadIdentity(); - transformMatrix.multiply(parentMatrix); - transformMatrix.translate(container.x, container.y); - transformMatrix.rotate(container.rotation); - transformMatrix.scale(container.scaleX, container.scaleY); - } - else - { - transformMatrix.applyITRS(container.x, container.y, container.rotation, container.scaleX, container.scaleY); - } + /** + * A reference to the HTML Canvas Element that Phaser uses to render the game. + * + * @name Phaser.Scale.ScaleManager#canvas + * @type {HTMLCanvasElement} + * @since 3.16.0 + */ + this.canvas; - var containerHasBlendMode = (container.blendMode !== -1); + /** + * The DOM bounds of the canvas element. + * + * @name Phaser.Scale.ScaleManager#canvasBounds + * @type {Phaser.Geom.Rectangle} + * @since 3.16.0 + */ + this.canvasBounds = new Rectangle(); - if (!containerHasBlendMode) - { - // If Container is SKIP_TEST then set blend mode to be Normal - renderer.setBlendMode(0); - } + /** + * The parent object of the Canvas. Often a div, or the browser window, or nothing in non-browser environments. + * + * This is set in the Game Config as the `parent` property. If undefined (or just not present), it will default + * to use the document body. If specifically set to `null` Phaser will ignore all parent operations. + * + * @name Phaser.Scale.ScaleManager#parent + * @type {?any} + * @since 3.16.0 + */ + this.parent = null; - var alpha = container._alpha; - var scrollFactorX = container.scrollFactorX; - var scrollFactorY = container.scrollFactorY; + /** + * Is the parent element the browser window? + * + * @name Phaser.Scale.ScaleManager#parentIsWindow + * @type {boolean} + * @since 3.16.0 + */ + this.parentIsWindow = false; - if (container.mask) - { - container.mask.preRenderCanvas(renderer, null, camera); - } + /** + * The Parent Size component. + * + * @name Phaser.Scale.ScaleManager#parentSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.parentSize = new Size(); - for (var i = 0; i < children.length; i++) - { - var child = children[i]; + /** + * The Game Size component. + * + * The un-modified game size, as requested in the game config (the raw width / height), + * as used for world bounds, cameras, etc + * + * @name Phaser.Scale.ScaleManager#gameSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.gameSize = new Size(); + + /** + * The Base Size component. + * + * The modified game size, which is the auto-rounded gameSize, used to set the canvas width and height + * (but not the CSS style) + * + * @name Phaser.Scale.ScaleManager#baseSize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.baseSize = new Size(); - if (!child.willRender(camera)) - { - continue; - } + /** + * The Display Size component. + * + * The size used for the canvas style, factoring in the scale mode, parent and other values. + * + * @name Phaser.Scale.ScaleManager#displaySize + * @type {Phaser.Structs.Size} + * @since 3.16.0 + */ + this.displaySize = new Size(); - var childAlpha = child.alpha; - var childScrollFactorX = child.scrollFactorX; - var childScrollFactorY = child.scrollFactorY; + /** + * The game scale mode. + * + * @name Phaser.Scale.ScaleManager#scaleMode + * @type {Phaser.Scale.ScaleModeType} + * @since 3.16.0 + */ + this.scaleMode = CONST.SCALE_MODE.NONE; - if (!containerHasBlendMode && child.blendMode !== renderer.currentBlendMode) - { - // If Container doesn't have its own blend mode, then a child can have one - renderer.setBlendMode(child.blendMode); - } + /** + * The game zoom factor. + * + * This value allows you to multiply your games base size by the given zoom factor. + * This is then used when calculating the display size, even in `NONE` situations. + * If you don't want Phaser to touch the canvas style at all, this value should be 1. + * + * Can also be set to `MAX_ZOOM` in which case the zoom value will be derived based + * on the game size and available space within the parent. + * + * @name Phaser.Scale.ScaleManager#zoom + * @type {number} + * @since 3.16.0 + */ + this.zoom = 1; - // Set parent values - child.setScrollFactor(childScrollFactorX * scrollFactorX, childScrollFactorY * scrollFactorY); - child.setAlpha(childAlpha * alpha); + /** + * Internal flag set when the game zoom factor is modified. + * + * @name Phaser.Scale.ScaleManager#_resetZoom + * @type {boolean} + * @readonly + * @since 3.19.0 + */ + this._resetZoom = false; - // Render - child.renderCanvas(renderer, child, camera, transformMatrix); + /** + * The scale factor between the baseSize and the canvasBounds. + * + * @name Phaser.Scale.ScaleManager#displayScale + * @type {Phaser.Math.Vector2} + * @since 3.16.0 + */ + this.displayScale = new Vector2(1, 1); - // Restore original values - child.setAlpha(childAlpha); - child.setScrollFactor(childScrollFactorX, childScrollFactorY); - } + /** + * If set, the canvas sizes will be automatically passed through Math.floor. + * This results in rounded pixel display values, which is important for performance on legacy + * and low powered devices, but at the cost of not achieving a 'perfect' fit in some browser windows. + * + * @name Phaser.Scale.ScaleManager#autoRound + * @type {boolean} + * @since 3.16.0 + */ + this.autoRound = false; - if (container.mask) - { - container.mask.postRenderCanvas(renderer); - } -}; + /** + * Automatically center the canvas within the parent? The different centering modes are: + * + * 1. No centering. + * 2. Center both horizontally and vertically. + * 3. Center horizontally. + * 4. Center vertically. + * + * Please be aware that in order to center the game canvas, you must have specified a parent + * that has a size set, or the canvas parent is the document.body. + * + * @name Phaser.Scale.ScaleManager#autoCenter + * @type {Phaser.Scale.CenterType} + * @since 3.16.0 + */ + this.autoCenter = CONST.CENTER.NO_CENTER; -module.exports = ContainerCanvasRenderer; + /** + * The current device orientation. + * + * Orientation events are dispatched via the Device Orientation API, typically only on mobile browsers. + * + * @name Phaser.Scale.ScaleManager#orientation + * @type {Phaser.Scale.OrientationType} + * @since 3.16.0 + */ + this.orientation = CONST.ORIENTATION.LANDSCAPE; + /** + * A reference to the Device.Fullscreen object. + * + * @name Phaser.Scale.ScaleManager#fullscreen + * @type {Phaser.Device.Fullscreen} + * @since 3.16.0 + */ + this.fullscreen; -/***/ }), -/* 1055 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The DOM Element which is sent into fullscreen mode. + * + * @name Phaser.Scale.ScaleManager#fullscreenTarget + * @type {?any} + * @since 3.16.0 + */ + this.fullscreenTarget = null; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Did Phaser create the fullscreen target div, or was it provided in the game config? + * + * @name Phaser.Scale.ScaleManager#_createdFullscreenTarget + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._createdFullscreenTarget = false; -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + /** + * The dirty state of the Scale Manager. + * Set if there is a change between the parent size and the current size. + * + * @name Phaser.Scale.ScaleManager#dirty + * @type {boolean} + * @since 3.16.0 + */ + this.dirty = false; -if (true) -{ - renderWebGL = __webpack_require__(443); -} + /** + * How many milliseconds should elapse before checking if the browser size has changed? + * + * Most modern browsers dispatch a 'resize' event, which the Scale Manager will listen for. + * However, older browsers fail to do this, or do it consistently, so we fall back to a + * more traditional 'size check' based on a time interval. You can control how often it is + * checked here. + * + * @name Phaser.Scale.ScaleManager#resizeInterval + * @type {number} + * @since 3.16.0 + */ + this.resizeInterval = 500; -if (true) -{ - renderCanvas = __webpack_require__(443); -} + /** + * Internal size interval tracker. + * + * @name Phaser.Scale.ScaleManager#_lastCheck + * @type {number} + * @private + * @since 3.16.0 + */ + this._lastCheck = 0; -module.exports = { + /** + * Internal flag to check orientation state. + * + * @name Phaser.Scale.ScaleManager#_checkOrientation + * @type {boolean} + * @private + * @since 3.16.0 + */ + this._checkOrientation = false; - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + /** + * Internal object containing our defined event listeners. + * + * @name Phaser.Scale.ScaleManager#domlisteners + * @type {object} + * @private + * @since 3.16.0 + */ + this.domlisteners = { -}; + orientationChange: NOOP, + windowResize: NOOP, + fullScreenChange: NOOP, + fullScreenError: NOOP + }; + }, -/***/ }), -/* 1056 */ -/***/ (function(module, exports) { + /** + * Called _before_ the canvas object is created and added to the DOM. + * + * @method Phaser.Scale.ScaleManager#preBoot + * @protected + * @listens Phaser.Core.Events#BOOT + * @since 3.16.0 + */ + preBoot: function () + { + // Parse the config to get the scaling values we need + this.parseConfig(this.game.config); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.game.events.once(GameEvents.BOOT, this.boot, this); + }, -/** - * Phaser Blend Modes to CSS Blend Modes Map. - * - * @name Phaser.CSSBlendModes - * @ignore - * @enum {string} - * @memberof Phaser - * @readonly - * @since 3.12.0 - */ + /** + * The Boot handler is called by Phaser.Game when it first starts up. + * The renderer is available by now and the canvas has been added to the DOM. + * + * @method Phaser.Scale.ScaleManager#boot + * @protected + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + */ + boot: function () + { + var game = this.game; -module.exports = [ - 'normal', - 'multiply', - 'multiply', - 'screen', - 'overlay', - 'darken', - 'lighten', - 'color-dodge', - 'color-burn', - 'hard-light', - 'soft-light', - 'difference', - 'exclusion', - 'hue', - 'saturation', - 'color', - 'luminosity' -]; + this.canvas = game.canvas; + this.fullscreen = game.device.fullscreen; -/***/ }), -/* 1057 */ -/***/ (function(module, exports, __webpack_require__) { + if (this.scaleMode !== CONST.SCALE_MODE.RESIZE) + { + this.displaySize.setAspectMode(this.scaleMode); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.scaleMode === CONST.SCALE_MODE.NONE) + { + this.resize(this.width, this.height); + } + else + { + this.getParentBounds(); -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + // Only set the parent bounds if the parent has an actual size + if (this.parentSize.width > 0 && this.parentSize.height > 0) + { + this.displaySize.setParent(this.parentSize); + } -if (true) -{ - renderWebGL = __webpack_require__(1058); -} + this.refresh(); + } -if (true) -{ - renderCanvas = __webpack_require__(1059); -} + game.events.on(GameEvents.PRE_STEP, this.step, this); + game.events.once(GameEvents.READY, this.refresh, this); + game.events.once(GameEvents.DESTROY, this.destroy, this); -module.exports = { + this.startListeners(); + }, - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + /** + * Parses the game configuration to set-up the scale defaults. + * + * @method Phaser.Scale.ScaleManager#parseConfig + * @protected + * @since 3.16.0 + * + * @param {Phaser.Types.Core.GameConfig} config - The Game configuration object. + */ + parseConfig: function (config) + { + // Get the parent element, if any + this.getParent(config); -}; + // Get the size of the parent element + // This can often set a height of zero (especially for un-styled divs) + this.getParentBounds(); + var width = config.width; + var height = config.height; + var scaleMode = config.scaleMode; + var zoom = config.zoom; + var autoRound = config.autoRound; -/***/ }), -/* 1058 */ -/***/ (function(module, exports, __webpack_require__) { + // If width = '100%', or similar value + if (typeof width === 'string') + { + // If we have a parent with a height, we'll work it out from that + var parentWidth = this.parentSize.width; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (parentWidth === 0) + { + parentWidth = window.innerWidth; + } -var GetCalcMatrix = __webpack_require__(19); -var TransformMatrix = __webpack_require__(25); -var Utils = __webpack_require__(12); + var parentScaleX = parseInt(width, 10) / 100; -var tempMatrix = new TransformMatrix(); + width = Math.floor(parentWidth * parentScaleX); + } -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.DynamicBitmapText#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.DynamicBitmapText} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var DynamicBitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - var text = src.text; - var textLength = text.length; + // If height = '100%', or similar value + if (typeof height === 'string') + { + // If we have a parent with a height, we'll work it out from that + var parentHeight = this.parentSize.height; - if (textLength === 0) - { - return; - } + if (parentHeight === 0) + { + parentHeight = window.innerHeight; + } - camera.addToRenderList(src); + var parentScaleY = parseInt(height, 10) / 100; - var pipeline = renderer.pipelines.set(src.pipeline, src); + height = Math.floor(parentHeight * parentScaleY); + } - var result = GetCalcMatrix(src, camera, parentMatrix); + this.scaleMode = scaleMode; - var spriteMatrix = result.sprite; - var calcMatrix = result.calc; + this.autoRound = autoRound; - var fontMatrix = tempMatrix; + this.autoCenter = config.autoCenter; - var crop = (src.cropWidth > 0 || src.cropHeight > 0); + this.resizeInterval = config.resizeInterval; - if (crop) - { - pipeline.flush(); + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } - renderer.pushScissor( - calcMatrix.tx, - calcMatrix.ty, - src.cropWidth * calcMatrix.scaleX, - src.cropHeight * calcMatrix.scaleY - ); - } + // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc + this.gameSize.setSize(width, height); - var frame = src.frame; - var texture = frame.glTexture; + if (zoom === CONST.ZOOM.MAX_ZOOM) + { + zoom = this.getMaxZoom(); + } - var tintEffect = src.tintFill; - var tintTL = Utils.getTintAppendFloatAlpha(src.tintTopLeft, camera.alpha * src._alphaTL); - var tintTR = Utils.getTintAppendFloatAlpha(src.tintTopRight, camera.alpha * src._alphaTR); - var tintBL = Utils.getTintAppendFloatAlpha(src.tintBottomLeft, camera.alpha * src._alphaBL); - var tintBR = Utils.getTintAppendFloatAlpha(src.tintBottomRight, camera.alpha * src._alphaBR); + this.zoom = zoom; - var textureUnit = pipeline.setGameObject(src); + if (zoom !== 1) + { + this._resetZoom = true; + } - var xAdvance = 0; - var yAdvance = 0; - var charCode = 0; - var lastCharCode = 0; - var letterSpacing = src.letterSpacing; - var glyph; - var glyphW = 0; - var glyphH = 0; - var lastGlyph; - var scrollX = src.scrollX; - var scrollY = src.scrollY; + // The modified game size + this.baseSize.setSize(width, height); - var fontData = src.fontData; - var chars = fontData.chars; - var lineHeight = fontData.lineHeight; - var scale = (src.fontSize / fontData.size); - var rotation = 0; + if (autoRound) + { + this.baseSize.width = Math.floor(this.baseSize.width); + this.baseSize.height = Math.floor(this.baseSize.height); + } - var align = src._align; - var currentLine = 0; - var lineOffsetX = 0; + if (config.minWidth > 0) + { + this.displaySize.setMin(config.minWidth * zoom, config.minHeight * zoom); + } - // Update the bounds - skipped internally if not dirty - var bounds = src.getTextBounds(false); + if (config.maxWidth > 0) + { + this.displaySize.setMax(config.maxWidth * zoom, config.maxHeight * zoom); + } - // In case the method above changed it (word wrapping) - if (src.maxWidth > 0) - { - text = bounds.wrappedText; - textLength = text.length; - } + // The size used for the canvas style, factoring in the scale mode and parent and zoom value + // We just use the w/h here as this is what sets the aspect ratio (which doesn't then change) + this.displaySize.setSize(width, height); - var lineData = src._bounds.lines; + this.orientation = GetScreenOrientation(width, height); + }, - if (align === 1) - { - lineOffsetX = (lineData.longest - lineData.lengths[0]) / 2; - } - else if (align === 2) + /** + * Determines the parent element of the game canvas, if any, based on the game configuration. + * + * @method Phaser.Scale.ScaleManager#getParent + * @since 3.16.0 + * + * @param {Phaser.Types.Core.GameConfig} config - The Game configuration object. + */ + getParent: function (config) { - lineOffsetX = (lineData.longest - lineData.lengths[0]); - } - - var roundPixels = camera.roundPixels; - var displayCallback = src.displayCallback; - var callbackData = src.callbackData; + var parent = config.parent; - renderer.pipelines.preBatch(src); + if (parent === null) + { + // User is responsible for managing the parent + return; + } - for (var i = 0; i < textLength; i++) - { - charCode = text.charCodeAt(i); + this.parent = GetTarget(parent); + this.parentIsWindow = (this.parent === document.body); - // Carriage-return - if (charCode === 10) + if (config.expandParent && config.scaleMode !== CONST.SCALE_MODE.NONE) { - currentLine++; + var DOMRect = this.parent.getBoundingClientRect(); - if (align === 1) - { - lineOffsetX = (lineData.longest - lineData.lengths[currentLine]) / 2; - } - else if (align === 2) + if (this.parentIsWindow || DOMRect.height === 0) { - lineOffsetX = (lineData.longest - lineData.lengths[currentLine]); - } + document.documentElement.style.height = '100%'; + document.body.style.height = '100%'; - xAdvance = 0; - yAdvance += lineHeight; - lastGlyph = null; + DOMRect = this.parent.getBoundingClientRect(); - continue; + // The parent STILL has no height, clearly no CSS + // has been set on it even though we fixed the body :( + if (!this.parentIsWindow && DOMRect.height === 0) + { + this.parent.style.overflow = 'hidden'; + this.parent.style.width = '100%'; + this.parent.style.height = '100%'; + } + } } - glyph = chars[charCode]; + // And now get the fullscreenTarget + if (config.fullscreenTarget && !this.fullscreenTarget) + { + this.fullscreenTarget = GetTarget(config.fullscreenTarget); + } + }, - if (!glyph) + /** + * Calculates the size of the parent bounds and updates the `parentSize` + * properties, only if the canvas has a dom parent. + * + * @method Phaser.Scale.ScaleManager#getParentBounds + * @since 3.16.0 + * + * @return {boolean} `true` if the parent bounds have changed size or position, otherwise `false`. + */ + getParentBounds: function () + { + if (!this.parent) { - continue; + return false; } - glyphW = glyph.width; - glyphH = glyph.height; + var parentSize = this.parentSize; - var x = (glyph.xOffset + xAdvance) - scrollX; - var y = (glyph.yOffset + yAdvance) - scrollY; + // Ref. http://msdn.microsoft.com/en-us/library/hh781509(v=vs.85).aspx for getBoundingClientRect - if (lastGlyph !== null) - { - var kerningOffset = glyph.kerning[lastCharCode]; - x += (kerningOffset !== undefined) ? kerningOffset : 0; - } + // The returned value is a DOMRect object which is the smallest rectangle which contains the entire element, + // including its padding and border-width. The left, top, right, bottom, x, y, width, and height properties + // describe the position and size of the overall rectangle in pixels. Properties other than width and height + // are relative to the top-left of the viewport. - xAdvance += glyph.xAdvance + letterSpacing; - lastGlyph = glyph; - lastCharCode = charCode; + var DOMRect = this.parent.getBoundingClientRect(); - // Nothing to render or a space? Then skip to the next glyph - if (glyphW === 0 || glyphH === 0 || charCode === 32) + if (this.parentIsWindow && this.game.device.os.iOS) { - continue; + DOMRect.height = GetInnerHeight(true); } - scale = (src.fontSize / src.fontData.size); - rotation = 0; + var newWidth = DOMRect.width; + var newHeight = DOMRect.height; - if (displayCallback) + if (parentSize.width !== newWidth || parentSize.height !== newHeight) { - callbackData.color = 0; - callbackData.tint.topLeft = tintTL; - callbackData.tint.topRight = tintTR; - callbackData.tint.bottomLeft = tintBL; - callbackData.tint.bottomRight = tintBR; - callbackData.index = i; - callbackData.charCode = charCode; - callbackData.x = x; - callbackData.y = y; - callbackData.scale = scale; - callbackData.rotation = rotation; - callbackData.data = glyph.data; - - var output = displayCallback(callbackData); + parentSize.setSize(newWidth, newHeight); - x = output.x; - y = output.y; - scale = output.scale; - rotation = output.rotation; + return true; + } + else if (this.canvas) + { + var canvasBounds = this.canvasBounds; + var canvasRect = this.canvas.getBoundingClientRect(); - if (output.color) - { - tintTL = output.color; - tintTR = output.color; - tintBL = output.color; - tintBR = output.color; - } - else + if (canvasRect.x !== canvasBounds.x || canvasRect.y !== canvasBounds.y) { - tintTL = output.tint.topLeft; - tintTR = output.tint.topRight; - tintBL = output.tint.bottomLeft; - tintBR = output.tint.bottomRight; + return true; } - - tintTL = Utils.getTintAppendFloatAlpha(tintTL, camera.alpha * src._alphaTL); - tintTR = Utils.getTintAppendFloatAlpha(tintTR, camera.alpha * src._alphaTR); - tintBL = Utils.getTintAppendFloatAlpha(tintBL, camera.alpha * src._alphaBL); - tintBR = Utils.getTintAppendFloatAlpha(tintBR, camera.alpha * src._alphaBR); } - x *= scale; - y *= scale; + return false; + }, - x -= src.displayOriginX; - y -= src.displayOriginY; + /** + * Attempts to lock the orientation of the web browser using the Screen Orientation API. + * + * This API is only available on modern mobile browsers. + * See https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation for details. + * + * @method Phaser.Scale.ScaleManager#lockOrientation + * @since 3.16.0 + * + * @param {string} orientation - The orientation you'd like to lock the browser in. Should be an API string such as 'landscape', 'landscape-primary', 'portrait', etc. + * + * @return {boolean} `true` if the orientation was successfully locked, otherwise `false`. + */ + lockOrientation: function (orientation) + { + var lock = screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation; - x += lineOffsetX; + if (lock) + { + return lock.call(screen, orientation); + } - fontMatrix.applyITRS(x, y, rotation, scale, scale); + return false; + }, - calcMatrix.multiply(fontMatrix, spriteMatrix); + /** + * This method will set the size of the Parent Size component, which is used in scaling + * and centering calculations. You only need to call this method if you have explicitly + * disabled the use of a parent in your game config, but still wish to take advantage of + * other Scale Manager features. + * + * @method Phaser.Scale.ScaleManager#setParentSize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the parent. + * @param {number} height - The new height of the parent. + * + * @return {this} The Scale Manager instance. + */ + setParentSize: function (width, height) + { + this.parentSize.setSize(width, height); - var u0 = glyph.u0; - var v0 = glyph.v0; - var u1 = glyph.u1; - var v1 = glyph.v1; + return this.refresh(); + }, - var xw = glyphW; - var yh = glyphH; + /** + * This method will set a new size for your game. + * + * It should only be used if you're looking to change the base size of your game and are using + * one of the Scale Manager scaling modes, i.e. `FIT`. If you're using `NONE` and wish to + * change the game and canvas size directly, then please use the `resize` method instead. + * + * @method Phaser.Scale.ScaleManager#setGameSize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + * + * @return {this} The Scale Manager instance. + */ + setGameSize: function (width, height) + { + var autoRound = this.autoRound; - var tx0 = spriteMatrix.e; - var ty0 = spriteMatrix.f; + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } - var tx1 = yh * spriteMatrix.c + spriteMatrix.e; - var ty1 = yh * spriteMatrix.d + spriteMatrix.f; + var previousWidth = this.width; + var previousHeight = this.height; - var tx2 = xw * spriteMatrix.a + yh * spriteMatrix.c + spriteMatrix.e; - var ty2 = xw * spriteMatrix.b + yh * spriteMatrix.d + spriteMatrix.f; + // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc + this.gameSize.resize(width, height); - var tx3 = xw * spriteMatrix.a + spriteMatrix.e; - var ty3 = xw * spriteMatrix.b + spriteMatrix.f; + // The modified game size + this.baseSize.resize(width, height); - if (roundPixels) + if (autoRound) { - tx0 = Math.round(tx0); - ty0 = Math.round(ty0); - - tx1 = Math.round(tx1); - ty1 = Math.round(ty1); + this.baseSize.width = Math.floor(this.baseSize.width); + this.baseSize.height = Math.floor(this.baseSize.height); + } - tx2 = Math.round(tx2); - ty2 = Math.round(ty2); + // The size used for the canvas style, factoring in the scale mode and parent and zoom value + // Update the aspect ratio + this.displaySize.setAspectRatio(width / height); - tx3 = Math.round(tx3); - ty3 = Math.round(ty3); - } + this.canvas.width = this.baseSize.width; + this.canvas.height = this.baseSize.height; - pipeline.batchQuad(src, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit); - } + return this.refresh(previousWidth, previousHeight); + }, - if (crop) + /** + * Call this to modify the size of the Phaser canvas element directly. + * You should only use this if you are using the `NONE` scale mode, + * it will update all internal components completely. + * + * If all you want to do is change the size of the parent, see the `setParentSize` method. + * + * If all you want is to change the base size of the game, but still have the Scale Manager + * manage all the scaling (i.e. you're **not** using `NONE`), then see the `setGameSize` method. + * + * This method will set the `gameSize`, `baseSize` and `displaySize` components to the given + * dimensions. It will then resize the canvas width and height to the values given, by + * directly setting the properties. Finally, if you have set the Scale Manager zoom value + * to anything other than 1 (the default), it will set the canvas CSS width and height to + * be the given size multiplied by the zoom factor (the canvas pixel size remains untouched). + * + * If you have enabled `autoCenter`, it is then passed to the `updateCenter` method and + * the margins are set, allowing the canvas to be centered based on its parent element + * alone. Finally, the `displayScale` is adjusted and the RESIZE event dispatched. + * + * @method Phaser.Scale.ScaleManager#resize + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} width - The new width of the game. + * @param {number} height - The new height of the game. + * + * @return {this} The Scale Manager instance. + */ + resize: function (width, height) { - pipeline.flush(); + var zoom = this.zoom; + var autoRound = this.autoRound; - renderer.popScissor(); - } + if (autoRound) + { + width = Math.floor(width); + height = Math.floor(height); + } - renderer.pipelines.postBatch(src); -}; + var previousWidth = this.width; + var previousHeight = this.height; -module.exports = DynamicBitmapTextWebGLRenderer; + // The un-modified game size, as requested in the game config (the raw width / height) as used for world bounds, etc + this.gameSize.resize(width, height); + // The modified game size + this.baseSize.resize(width, height); -/***/ }), -/* 1059 */ -/***/ (function(module, exports, __webpack_require__) { + if (autoRound) + { + this.baseSize.width = Math.floor(this.baseSize.width); + this.baseSize.height = Math.floor(this.baseSize.height); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // The size used for the canvas style, factoring in the scale mode and parent and zoom value + // We just use the w/h here as this is what sets the aspect ratio (which doesn't then change) + this.displaySize.setSize((width * zoom), (height * zoom)); -var SetTransform = __webpack_require__(30); + this.canvas.width = this.baseSize.width; + this.canvas.height = this.baseSize.height; -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.DynamicBitmapText#renderCanvas - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.DynamicBitmapText} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var DynamicBitmapTextCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - var text = src._text; - var textLength = text.length; + var style = this.canvas.style; - var ctx = renderer.currentContext; + var styleWidth = width * zoom; + var styleHeight = height * zoom; - if (textLength === 0 || !SetTransform(renderer, ctx, src, camera, parentMatrix)) - { - return; - } + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } - camera.addToRenderList(src); + if (styleWidth !== width || styleHeight !== height) + { + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; + } - var textureFrame = src.fromAtlas - ? src.frame - : src.texture.frames['__BASE']; + return this.refresh(previousWidth, previousHeight); + }, - var displayCallback = src.displayCallback; - var callbackData = src.callbackData; + /** + * Sets the zoom value of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#setZoom + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} value - The new zoom value of the game. + * + * @return {this} The Scale Manager instance. + */ + setZoom: function (value) + { + this.zoom = value; + this._resetZoom = true; - var chars = src.fontData.chars; - var lineHeight = src.fontData.lineHeight; - var letterSpacing = src._letterSpacing; + return this.refresh(); + }, - var xAdvance = 0; - var yAdvance = 0; + /** + * Sets the zoom to be the maximum possible based on the _current_ parent size. + * + * @method Phaser.Scale.ScaleManager#setMaxZoom + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @return {this} The Scale Manager instance. + */ + setMaxZoom: function () + { + this.zoom = this.getMaxZoom(); + this._resetZoom = true; - var charCode = 0; + return this.refresh(); + }, - var glyph = null; - var glyphX = 0; - var glyphY = 0; - var glyphW = 0; - var glyphH = 0; + /** + * Refreshes the internal scale values, bounds sizes and orientation checks. + * + * Once finished, dispatches the resize event. + * + * This is called automatically by the Scale Manager when the browser window size changes, + * as long as it is using a Scale Mode other than 'NONE'. + * + * @method Phaser.Scale.ScaleManager#refresh + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {number} [previousWidth] - The previous width of the game. Only set if the gameSize has changed. + * @param {number} [previousHeight] - The previous height of the game. Only set if the gameSize has changed. + * + * @return {this} The Scale Manager instance. + */ + refresh: function (previousWidth, previousHeight) + { + if (previousWidth === undefined) { previousWidth = this.width; } + if (previousHeight === undefined) { previousHeight = this.height; } - var x = 0; - var y = 0; + this.updateScale(); + this.updateBounds(); + this.updateOrientation(); - var lastGlyph = null; - var lastCharCode = 0; + this.displayScale.set(this.baseSize.width / this.canvasBounds.width, this.baseSize.height / this.canvasBounds.height); - var image = src.frame.source.image; + var domContainer = this.game.domContainer; - var textureX = textureFrame.cutX; - var textureY = textureFrame.cutY; + if (domContainer) + { + this.baseSize.setCSS(domContainer); - var rotation = 0; - var scale = 0; - var baseScale = (src._fontSize / src.fontData.size); + var canvasStyle = this.canvas.style; + var domStyle = domContainer.style; - var align = src._align; - var currentLine = 0; - var lineOffsetX = 0; + domStyle.transform = 'scale(' + this.displaySize.width / this.baseSize.width + ',' + this.displaySize.height / this.baseSize.height + ')'; - // Update the bounds - skipped internally if not dirty - src.getTextBounds(false); + domStyle.marginLeft = canvasStyle.marginLeft; + domStyle.marginTop = canvasStyle.marginTop; + } - var lineData = src._bounds.lines; + this.emit(Events.RESIZE, this.gameSize, this.baseSize, this.displaySize, previousWidth, previousHeight); - if (align === 1) - { - lineOffsetX = (lineData.longest - lineData.lengths[0]) / 2; - } - else if (align === 2) + return this; + }, + + /** + * Internal method that checks the current screen orientation, only if the internal check flag is set. + * + * If the orientation has changed it updates the orientation property and then dispatches the orientation change event. + * + * @method Phaser.Scale.ScaleManager#updateOrientation + * @fires Phaser.Scale.Events#ORIENTATION_CHANGE + * @since 3.16.0 + */ + updateOrientation: function () { - lineOffsetX = (lineData.longest - lineData.lengths[0]); - } + if (this._checkOrientation) + { + this._checkOrientation = false; - ctx.translate(-src.displayOriginX, -src.displayOriginY); + var newOrientation = GetScreenOrientation(this.width, this.height); - var roundPixels = camera.roundPixels; + if (newOrientation !== this.orientation) + { + this.orientation = newOrientation; - if (src.cropWidth > 0 && src.cropHeight > 0) - { - ctx.beginPath(); - ctx.rect(0, 0, src.cropWidth, src.cropHeight); - ctx.clip(); - } + this.emit(Events.ORIENTATION_CHANGE, newOrientation); + } + } + }, - for (var i = 0; i < textLength; i++) + /** + * Internal method that manages updating the size components based on the scale mode. + * + * @method Phaser.Scale.ScaleManager#updateScale + * @since 3.16.0 + */ + updateScale: function () { - // Reset the scale (in case the callback changed it) - scale = baseScale; - rotation = 0; + var style = this.canvas.style; - charCode = text.charCodeAt(i); + var width = this.gameSize.width; + var height = this.gameSize.height; - if (charCode === 10) + var styleWidth; + var styleHeight; + + var zoom = this.zoom; + var autoRound = this.autoRound; + + if (this.scaleMode === CONST.SCALE_MODE.NONE) { - currentLine++; + // No scale + this.displaySize.setSize((width * zoom), (height * zoom)); - if (align === 1) - { - lineOffsetX = (lineData.longest - lineData.lengths[currentLine]) / 2; - } - else if (align === 2) + styleWidth = this.displaySize.width; + styleHeight = this.displaySize.height; + + if (autoRound) { - lineOffsetX = (lineData.longest - lineData.lengths[currentLine]); + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); } - xAdvance = 0; - yAdvance += lineHeight; - lastGlyph = null; + if (this._resetZoom) + { + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; - continue; + this._resetZoom = false; + } } + else if (this.scaleMode === CONST.SCALE_MODE.RESIZE) + { + // Resize to match parent - glyph = chars[charCode]; + // This will constrain using min/max + this.displaySize.setSize(this.parentSize.width, this.parentSize.height); - if (!glyph) - { - continue; - } + this.gameSize.setSize(this.displaySize.width, this.displaySize.height); - glyphX = textureX + glyph.x; - glyphY = textureY + glyph.y; + this.baseSize.setSize(this.displaySize.width, this.displaySize.height); - glyphW = glyph.width; - glyphH = glyph.height; + styleWidth = this.displaySize.width; + styleHeight = this.displaySize.height; - x = (glyph.xOffset + xAdvance) - src.scrollX; - y = (glyph.yOffset + yAdvance) - src.scrollY; + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } - if (lastGlyph !== null) - { - var kerningOffset = glyph.kerning[lastCharCode]; - x += (kerningOffset !== undefined) ? kerningOffset : 0; + this.canvas.width = styleWidth; + this.canvas.height = styleHeight; } - - if (displayCallback) + else { - callbackData.index = i; - callbackData.charCode = charCode; - callbackData.x = x; - callbackData.y = y; - callbackData.scale = scale; - callbackData.rotation = rotation; - callbackData.data = glyph.data; + // All other scale modes + this.displaySize.setSize(this.parentSize.width, this.parentSize.height); - var output = displayCallback(callbackData); + styleWidth = this.displaySize.width; + styleHeight = this.displaySize.height; - x = output.x; - y = output.y; - scale = output.scale; - rotation = output.rotation; + if (autoRound) + { + styleWidth = Math.floor(styleWidth); + styleHeight = Math.floor(styleHeight); + } + + style.width = styleWidth + 'px'; + style.height = styleHeight + 'px'; } - x *= scale; - y *= scale; + // Update the parentSize in case the canvas / style change modified it + this.getParentBounds(); - x += lineOffsetX; + // Finally, update the centering + this.updateCenter(); + }, - xAdvance += glyph.xAdvance + letterSpacing; - lastGlyph = glyph; - lastCharCode = charCode; + /** + * Calculates and returns the largest possible zoom factor, based on the current + * parent and game sizes. If the parent has no dimensions (i.e. an unstyled div), + * or is smaller than the un-zoomed game, then this will return a value of 1 (no zoom) + * + * @method Phaser.Scale.ScaleManager#getMaxZoom + * @since 3.16.0 + * + * @return {number} The maximum possible zoom factor. At a minimum this value is always at least 1. + */ + getMaxZoom: function () + { + var zoomH = SnapFloor(this.parentSize.width, this.gameSize.width, 0, true); + var zoomV = SnapFloor(this.parentSize.height, this.gameSize.height, 0, true); - // Nothing to render or a space? Then skip to the next glyph - if (glyphW === 0 || glyphH === 0 || charCode === 32) - { - continue; - } + return Math.max(Math.min(zoomH, zoomV), 1); + }, - if (roundPixels) + /** + * Calculates and updates the canvas CSS style in order to center it within the + * bounds of its parent. If you have explicitly set parent to be `null` in your + * game config then this method will likely give incorrect results unless you have called the + * `setParentSize` method first. + * + * It works by modifying the canvas CSS `marginLeft` and `marginTop` properties. + * + * If they have already been set by your own style sheet, or code, this will overwrite them. + * + * To prevent the Scale Manager from centering the canvas, either do not set the + * `autoCenter` property in your game config, or make sure it is set to `NO_CENTER`. + * + * @method Phaser.Scale.ScaleManager#updateCenter + * @since 3.16.0 + */ + updateCenter: function () + { + var autoCenter = this.autoCenter; + + if (autoCenter === CONST.CENTER.NO_CENTER) { - x = Math.round(x); - y = Math.round(y); + return; } - ctx.save(); - - ctx.translate(x, y); - - ctx.rotate(rotation); + var canvas = this.canvas; - ctx.scale(scale, scale); + var style = canvas.style; - ctx.drawImage(image, glyphX, glyphY, glyphW, glyphH, 0, 0, glyphW, glyphH); + var bounds = canvas.getBoundingClientRect(); - ctx.restore(); - } + // var width = parseInt(canvas.style.width, 10) || canvas.width; + // var height = parseInt(canvas.style.height, 10) || canvas.height; - ctx.restore(); -}; + var width = bounds.width; + var height = bounds.height; -module.exports = DynamicBitmapTextCanvasRenderer; + var offsetX = Math.floor((this.parentSize.width - width) / 2); + var offsetY = Math.floor((this.parentSize.height - height) / 2); + if (autoCenter === CONST.CENTER.CENTER_HORIZONTALLY) + { + offsetY = 0; + } + else if (autoCenter === CONST.CENTER.CENTER_VERTICALLY) + { + offsetX = 0; + } -/***/ }), -/* 1060 */ -/***/ (function(module, exports, __webpack_require__) { + style.marginLeft = offsetX + 'px'; + style.marginTop = offsetY + 'px'; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Updates the `canvasBounds` rectangle to match the bounding client rectangle of the + * canvas element being used to track input events. + * + * @method Phaser.Scale.ScaleManager#updateBounds + * @since 3.16.0 + */ + updateBounds: function () + { + var bounds = this.canvasBounds; + var clientRect = this.canvas.getBoundingClientRect(); -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + bounds.x = clientRect.left + (window.pageXOffset || 0) - (document.documentElement.clientLeft || 0); + bounds.y = clientRect.top + (window.pageYOffset || 0) - (document.documentElement.clientTop || 0); + bounds.width = clientRect.width; + bounds.height = clientRect.height; + }, -if (true) -{ - renderWebGL = __webpack_require__(1061); -} + /** + * Transforms the pageX value into the scaled coordinate space of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#transformX + * @since 3.16.0 + * + * @param {number} pageX - The DOM pageX value. + * + * @return {number} The translated value. + */ + transformX: function (pageX) + { + return (pageX - this.canvasBounds.left) * this.displayScale.x; + }, -if (true) -{ - renderCanvas = __webpack_require__(1062); -} + /** + * Transforms the pageY value into the scaled coordinate space of the Scale Manager. + * + * @method Phaser.Scale.ScaleManager#transformY + * @since 3.16.0 + * + * @param {number} pageY - The DOM pageY value. + * + * @return {number} The translated value. + */ + transformY: function (pageY) + { + return (pageY - this.canvasBounds.top) * this.displayScale.y; + }, -module.exports = { + /** + * Sends a request to the browser to ask it to go in to full screen mode, using the {@link https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API Fullscreen API}. + * + * If the browser does not support this, a `FULLSCREEN_UNSUPPORTED` event will be emitted. + * + * This method _must_ be called from a `pointerup` user-input gesture (**not** `pointerdown`). You cannot launch + * games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked + * from fullscreen unless the iframe has the `allowfullscreen` attribute. + * + * On touch devices, such as Android and iOS Safari, you should always use `pointerup` and NOT `pointerdown`, + * otherwise the request will fail unless the document in which your game is embedded has already received + * some form of touch input, which you cannot guarantee. Activating fullscreen via `pointerup` circumvents + * this issue. + * + * Performing an action that navigates to another page, or opens another tab, will automatically cancel + * fullscreen mode, as will the user pressing the ESC key. To cancel fullscreen mode directly from your game, + * i.e. by clicking an icon, call the `stopFullscreen` method. + * + * A browser can only send one DOM element into fullscreen. You can control which element this is by + * setting the `fullscreenTarget` property in your game config, or changing the property in the Scale Manager. + * Note that the game canvas _must_ be a child of the target. If you do not give a target, Phaser will + * automatically create a blank `
` element and move the canvas into it, before going fullscreen. + * When it leaves fullscreen, the div will be removed. + * + * @method Phaser.Scale.ScaleManager#startFullscreen + * @fires Phaser.Scale.Events#ENTER_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_FAILED + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {object} [fullscreenOptions] - The FullscreenOptions dictionary is used to provide configuration options when entering full screen. + */ + startFullscreen: function (fullscreenOptions) + { + if (fullscreenOptions === undefined) { fullscreenOptions = { navigationUI: 'hide' }; } - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + var fullscreen = this.fullscreen; -}; + if (!fullscreen.available) + { + this.emit(Events.FULLSCREEN_UNSUPPORTED); + return; + } -/***/ }), -/* 1061 */ -/***/ (function(module, exports, __webpack_require__) { + if (!fullscreen.active) + { + var fsTarget = this.getFullscreenTarget(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (fullscreen.keyboard) + { + fsTarget[fullscreen.request](Element.ALLOW_KEYBOARD_INPUT); + } + else + { + fsTarget[fullscreen.request](fullscreenOptions); + } + } + }, -var GetCalcMatrix = __webpack_require__(19); + /** + * The browser has successfully entered fullscreen mode. + * + * @method Phaser.Scale.ScaleManager#fullscreenSuccessHandler + * @private + * @fires Phaser.Scale.Events#ENTER_FULLSCREEN + * @fires Phaser.Scale.Events#RESIZE + * @since 3.17.0 + */ + fullscreenSuccessHandler: function () + { + this.getParentBounds(); -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Extern#renderWebGL - * @since 3.16.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Extern} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var ExternWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - renderer.pipelines.clear(); + this.refresh(); - var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + this.emit(Events.ENTER_FULLSCREEN); + }, - src.render.call(src, renderer, camera, calcMatrix); + /** + * The browser failed to enter fullscreen mode. + * + * @method Phaser.Scale.ScaleManager#fullscreenErrorHandler + * @private + * @fires Phaser.Scale.Events#FULLSCREEN_FAILED + * @fires Phaser.Scale.Events#RESIZE + * @since 3.17.0 + * + * @param {any} error - The DOM error event. + */ + fullscreenErrorHandler: function (error) + { + this.removeFullscreenTarget(); - renderer.pipelines.rebind(); -}; + this.emit(Events.FULLSCREEN_FAILED, error); + }, -module.exports = ExternWebGLRenderer; + /** + * An internal method that gets the target element that is used when entering fullscreen mode. + * + * @method Phaser.Scale.ScaleManager#getFullscreenTarget + * @since 3.16.0 + * + * @return {object} The fullscreen target element. + */ + getFullscreenTarget: function () + { + if (!this.fullscreenTarget) + { + var fsTarget = document.createElement('div'); + fsTarget.style.margin = '0'; + fsTarget.style.padding = '0'; + fsTarget.style.width = '100%'; + fsTarget.style.height = '100%'; -/***/ }), -/* 1062 */ -/***/ (function(module, exports) { + this.fullscreenTarget = fsTarget; + this._createdFullscreenTarget = true; + } + if (this._createdFullscreenTarget) + { + var canvasParent = this.canvas.parentNode; -/***/ }), -/* 1063 */ -/***/ (function(module, exports, __webpack_require__) { + canvasParent.insertBefore(this.fullscreenTarget, this.canvas); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.fullscreenTarget.appendChild(this.canvas); + } -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + return this.fullscreenTarget; + }, -if (true) -{ - renderWebGL = __webpack_require__(1064); + /** + * Removes the fullscreen target that was added to the DOM. + * + * @method Phaser.Scale.ScaleManager#removeFullscreenTarget + * @since 3.17.0 + */ + removeFullscreenTarget: function () + { + if (this._createdFullscreenTarget) + { + var fsTarget = this.fullscreenTarget; - // Needed for Graphics.generateTexture - renderCanvas = __webpack_require__(448); -} + if (fsTarget && fsTarget.parentNode) + { + var parent = fsTarget.parentNode; -if (true) -{ - renderCanvas = __webpack_require__(448); -} + parent.insertBefore(this.canvas, fsTarget); -module.exports = { + parent.removeChild(fsTarget); + } + } + }, - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + /** + * Calling this method will cancel fullscreen mode, if the browser has entered it. + * + * @method Phaser.Scale.ScaleManager#stopFullscreen + * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @since 3.16.0 + */ + stopFullscreen: function () + { + var fullscreen = this.fullscreen; -}; + if (!fullscreen.available) + { + this.emit(Events.FULLSCREEN_UNSUPPORTED); + return false; + } -/***/ }), -/* 1064 */ -/***/ (function(module, exports, __webpack_require__) { + if (fullscreen.active) + { + document[fullscreen.cancel](); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.removeFullscreenTarget(); -var Commands = __webpack_require__(217); -var GetCalcMatrix = __webpack_require__(19); -var TransformMatrix = __webpack_require__(25); -var Utils = __webpack_require__(12); + // Get the parent size again as it will have changed + this.getParentBounds(); -var Point = function (x, y, width) -{ - this.x = x; - this.y = y; - this.width = width; -}; + this.emit(Events.LEAVE_FULLSCREEN); -var Path = function (x, y, width) -{ - this.points = []; - this.pointsLength = 1; - this.points[0] = new Point(x, y, width); -}; + this.refresh(); + }, -var matrixStack = []; -var tempMatrix = new TransformMatrix(); + /** + * Toggles the fullscreen mode. If already in fullscreen, calling this will cancel it. + * If not in fullscreen, this will request the browser to enter fullscreen mode. + * + * If the browser does not support this, a `FULLSCREEN_UNSUPPORTED` event will be emitted. + * + * This method _must_ be called from a user-input gesture, such as `pointerdown`. You cannot launch + * games fullscreen without this, as most browsers block it. Games within an iframe will also be blocked + * from fullscreen unless the iframe has the `allowfullscreen` attribute. + * + * @method Phaser.Scale.ScaleManager#toggleFullscreen + * @fires Phaser.Scale.Events#ENTER_FULLSCREEN + * @fires Phaser.Scale.Events#LEAVE_FULLSCREEN + * @fires Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @fires Phaser.Scale.Events#RESIZE + * @since 3.16.0 + * + * @param {object} [fullscreenOptions] - The FullscreenOptions dictionary is used to provide configuration options when entering full screen. + */ + toggleFullscreen: function (fullscreenOptions) + { + if (this.fullscreen.active) + { + this.stopFullscreen(); + } + else + { + this.startFullscreen(fullscreenOptions); + } + }, -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Graphics#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Graphics} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var GraphicsWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - if (src.commandBuffer.length === 0) + /** + * An internal method that starts the different DOM event listeners running. + * + * @method Phaser.Scale.ScaleManager#startListeners + * @since 3.16.0 + */ + startListeners: function () { - return; - } + var _this = this; + var listeners = this.domlisteners; - camera.addToRenderList(src); + listeners.orientationChange = function () + { + _this.updateBounds(); - var pipeline = renderer.pipelines.set(src.pipeline, src); + _this._checkOrientation = true; + _this.dirty = true; + }; - renderer.pipelines.preBatch(src); + listeners.windowResize = function () + { + _this.updateBounds(); - var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + _this.dirty = true; + }; - var currentMatrix = tempMatrix.loadIdentity(); + // Only dispatched on mobile devices + window.addEventListener('orientationchange', listeners.orientationChange, false); - var commands = src.commandBuffer; - var alpha = camera.alpha * src.alpha; + window.addEventListener('resize', listeners.windowResize, false); - var lineWidth = 1; - var fillTint = pipeline.fillTint; - var strokeTint = pipeline.strokeTint; + if (this.fullscreen.available) + { + listeners.fullScreenChange = function (event) + { + return _this.onFullScreenChange(event); + }; - var tx = 0; - var ty = 0; - var ta = 0; - var iterStep = 0.01; - var PI2 = Math.PI * 2; + listeners.fullScreenError = function (event) + { + return _this.onFullScreenError(event); + }; - var cmd; + var vendors = [ 'webkit', 'moz', '' ]; - var path = []; - var pathIndex = 0; - var pathOpen = true; - var lastPath = null; + vendors.forEach(function (prefix) + { + document.addEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); + document.addEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); + }); - var getTint = Utils.getTintAppendFloatAlpha; + // MS Specific + document.addEventListener('MSFullscreenChange', listeners.fullScreenChange, false); + document.addEventListener('MSFullscreenError', listeners.fullScreenError, false); + } + }, - for (var cmdIndex = 0; cmdIndex < commands.length; cmdIndex++) + /** + * Triggered when a fullscreenchange event is dispatched by the DOM. + * + * @method Phaser.Scale.ScaleManager#onFullScreenChange + * @protected + * @since 3.16.0 + */ + onFullScreenChange: function () { - cmd = commands[cmdIndex]; - - switch (cmd) + if (document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement || document.mozFullScreenElement) { - case Commands.BEGIN_PATH: - { - path.length = 0; - lastPath = null; - pathOpen = true; - break; - } + this.fullscreenSuccessHandler(); + } + else + { + // They pressed ESC while in fullscreen mode + this.stopFullscreen(); + } + }, - case Commands.CLOSE_PATH: - { - pathOpen = false; + /** + * Triggered when a fullscreenerror event is dispatched by the DOM. + * + * @method Phaser.Scale.ScaleManager#onFullScreenError + * @since 3.16.0 + */ + onFullScreenError: function () + { + this.removeFullscreenTarget(); + }, - if (lastPath && lastPath.points.length) - { - lastPath.points.push(lastPath.points[0]); - } - break; - } + /** + * Get Rectange of visible area. + * + * @method Phaser.Scale.ScaleManager#getViewPort + * @since 3.60.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The camera this viewport is respond upon. + * @param {Phaser.Geom.Rectangle} [out] - The Rectangle of visible area. + * + * @return {Phaser.Geom.Rectangle} The Rectangle of visible area. + */ + getViewPort: function (camera, out) + { + if (!(camera instanceof Camera)) + { + out = camera; + camera = undefined; + } - case Commands.FILL_PATH: - { - for (pathIndex = 0; pathIndex < path.length; pathIndex++) - { - pipeline.batchFillPath( - path[pathIndex].points, - currentMatrix, - calcMatrix - ); - } - break; - } + if (out === undefined) + { + out = new Rectangle(); + } - case Commands.STROKE_PATH: - { - for (pathIndex = 0; pathIndex < path.length; pathIndex++) - { - pipeline.batchStrokePath( - path[pathIndex].points, - lineWidth, - pathOpen, - currentMatrix, - calcMatrix - ); - } - break; - } + var baseSize = this.baseSize; + var parentSize = this.parentSize; + var canvasBounds = this.canvasBounds; + var displayScale = this.displayScale; - case Commands.LINE_STYLE: - { - lineWidth = commands[++cmdIndex]; - var strokeColor = commands[++cmdIndex]; - var strokeAlpha = commands[++cmdIndex] * alpha; - var strokeTintColor = getTint(strokeColor, strokeAlpha); - strokeTint.TL = strokeTintColor; - strokeTint.TR = strokeTintColor; - strokeTint.BL = strokeTintColor; - strokeTint.BR = strokeTintColor; - break; - } + var x = (canvasBounds.x >= 0) ? 0 : -(canvasBounds.x * displayScale.x); - case Commands.FILL_STYLE: - { - var fillColor = commands[++cmdIndex]; - var fillAlpha = commands[++cmdIndex] * alpha; - var fillTintColor = getTint(fillColor, fillAlpha); - fillTint.TL = fillTintColor; - fillTint.TR = fillTintColor; - fillTint.BL = fillTintColor; - fillTint.BR = fillTintColor; - break; - } + var y = (canvasBounds.y >= 0) ? 0 : -(canvasBounds.y * displayScale.y); - case Commands.GRADIENT_FILL_STYLE: - { - var alphaTL = commands[++cmdIndex] * alpha; - var alphaTR = commands[++cmdIndex] * alpha; - var alphaBL = commands[++cmdIndex] * alpha; - var alphaBR = commands[++cmdIndex] * alpha; + var width; + if (parentSize.width >= canvasBounds.width) + { + width = baseSize.width; + } + else + { + width = baseSize.width - (canvasBounds.width - parentSize.width) * displayScale.x; + } - fillTint.TL = getTint(commands[++cmdIndex], alphaTL); - fillTint.TR = getTint(commands[++cmdIndex], alphaTR); - fillTint.BL = getTint(commands[++cmdIndex], alphaBL); - fillTint.BR = getTint(commands[++cmdIndex], alphaBR); - break; - } + var height; + if (parentSize.height >= canvasBounds.height) + { + height = baseSize.height; + } + else + { + height = baseSize.height - (canvasBounds.height - parentSize.height) * displayScale.y; + } - case Commands.GRADIENT_LINE_STYLE: - { - lineWidth = commands[++cmdIndex]; - var gradientLineAlpha = commands[++cmdIndex] * alpha; - strokeTint.TL = getTint(commands[++cmdIndex], gradientLineAlpha); - strokeTint.TR = getTint(commands[++cmdIndex], gradientLineAlpha); - strokeTint.BL = getTint(commands[++cmdIndex], gradientLineAlpha); - strokeTint.BR = getTint(commands[++cmdIndex], gradientLineAlpha); - break; - } + out.setTo(x, y, width, height); - case Commands.ARC: - { - var iteration = 0; - var x = commands[++cmdIndex]; - var y = commands[++cmdIndex]; - var radius = commands[++cmdIndex]; - var startAngle = commands[++cmdIndex]; - var endAngle = commands[++cmdIndex]; - var anticlockwise = commands[++cmdIndex]; - var overshoot = commands[++cmdIndex]; + if (camera) + { + out.width /= camera.zoomX; + out.height /= camera.zoomY; + out.centerX = camera.centerX + camera.scrollX; + out.centerY = camera.centerY + camera.scrollY; + } - endAngle -= startAngle; + return out; + }, - if (anticlockwise) - { - if (endAngle < -PI2) - { - endAngle = -PI2; - } - else if (endAngle > 0) - { - endAngle = -PI2 + endAngle % PI2; - } - } - else if (endAngle > PI2) - { - endAngle = PI2; - } - else if (endAngle < 0) - { - endAngle = PI2 + endAngle % PI2; - } + /** + * Internal method, called automatically by the game step. + * Monitors the elapsed time and resize interval to see if a parent bounds check needs to take place. + * + * @method Phaser.Scale.ScaleManager#step + * @since 3.16.0 + * + * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). + * @param {number} delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class. + */ + step: function (time, delta) + { + if (!this.parent) + { + return; + } - if (lastPath === null) - { - lastPath = new Path(x + Math.cos(startAngle) * radius, y + Math.sin(startAngle) * radius, lineWidth); - path.push(lastPath); - iteration += iterStep; - } + this._lastCheck += delta; - while (iteration < 1 + overshoot) - { - ta = endAngle * iteration + startAngle; - tx = x + Math.cos(ta) * radius; - ty = y + Math.sin(ta) * radius; + if (this.dirty || this._lastCheck > this.resizeInterval) + { + // Returns true if the parent bounds have changed size + if (this.getParentBounds()) + { + this.refresh(); + } - lastPath.points.push(new Point(tx, ty, lineWidth)); + this.dirty = false; + this._lastCheck = 0; + } + }, - iteration += iterStep; - } + /** + * Stops all DOM event listeners. + * + * @method Phaser.Scale.ScaleManager#stopListeners + * @since 3.16.0 + */ + stopListeners: function () + { + var listeners = this.domlisteners; - ta = endAngle + startAngle; - tx = x + Math.cos(ta) * radius; - ty = y + Math.sin(ta) * radius; + window.removeEventListener('orientationchange', listeners.orientationChange, false); + window.removeEventListener('resize', listeners.windowResize, false); - lastPath.points.push(new Point(tx, ty, lineWidth)); + var vendors = [ 'webkit', 'moz', '' ]; - break; - } + vendors.forEach(function (prefix) + { + document.removeEventListener(prefix + 'fullscreenchange', listeners.fullScreenChange, false); + document.removeEventListener(prefix + 'fullscreenerror', listeners.fullScreenError, false); + }); - case Commands.FILL_RECT: - { - pipeline.batchFillRect( - commands[++cmdIndex], - commands[++cmdIndex], - commands[++cmdIndex], - commands[++cmdIndex], - currentMatrix, - calcMatrix - ); - break; - } + // MS Specific + document.removeEventListener('MSFullscreenChange', listeners.fullScreenChange, false); + document.removeEventListener('MSFullscreenError', listeners.fullScreenError, false); + }, - case Commands.FILL_TRIANGLE: - { - pipeline.batchFillTriangle( - commands[++cmdIndex], - commands[++cmdIndex], - commands[++cmdIndex], - commands[++cmdIndex], - commands[++cmdIndex], - commands[++cmdIndex], - currentMatrix, - calcMatrix - ); - break; - } + /** + * Destroys this Scale Manager, releasing all references to external resources. + * Once destroyed, the Scale Manager cannot be used again. + * + * @method Phaser.Scale.ScaleManager#destroy + * @since 3.16.0 + */ + destroy: function () + { + this.removeAllListeners(); - case Commands.STROKE_TRIANGLE: - { - pipeline.batchStrokeTriangle( - commands[++cmdIndex], - commands[++cmdIndex], - commands[++cmdIndex], - commands[++cmdIndex], - commands[++cmdIndex], - commands[++cmdIndex], - lineWidth, - currentMatrix, - calcMatrix - ); - break; - } + this.stopListeners(); - case Commands.LINE_TO: - { - if (lastPath !== null) - { - lastPath.points.push(new Point(commands[++cmdIndex], commands[++cmdIndex], lineWidth)); - } - else - { - lastPath = new Path(commands[++cmdIndex], commands[++cmdIndex], lineWidth); - path.push(lastPath); - } - break; - } + this.game = null; + this.canvas = null; + this.canvasBounds = null; + this.parent = null; + this.fullscreenTarget = null; - case Commands.MOVE_TO: - { - lastPath = new Path(commands[++cmdIndex], commands[++cmdIndex], lineWidth); - path.push(lastPath); - break; - } + this.parentSize.destroy(); + this.gameSize.destroy(); + this.baseSize.destroy(); + this.displaySize.destroy(); + }, - case Commands.SAVE: - { - matrixStack.push(currentMatrix.copyToArray()); - break; - } + /** + * Is the browser currently in fullscreen mode or not? + * + * @name Phaser.Scale.ScaleManager#isFullscreen + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isFullscreen: { - case Commands.RESTORE: - { - currentMatrix.copyFromArray(matrixStack.pop()); - break; - } + get: function () + { + return this.fullscreen.active; + } - case Commands.TRANSLATE: - { - x = commands[++cmdIndex]; - y = commands[++cmdIndex]; - currentMatrix.translate(x, y); - break; - } + }, - case Commands.SCALE: - { - x = commands[++cmdIndex]; - y = commands[++cmdIndex]; - currentMatrix.scale(x, y); - break; - } + /** + * The game width. + * + * This is typically the size given in the game configuration. + * + * @name Phaser.Scale.ScaleManager#width + * @type {number} + * @readonly + * @since 3.16.0 + */ + width: { - case Commands.ROTATE: - { - currentMatrix.rotate(commands[++cmdIndex]); - break; - } + get: function () + { + return this.gameSize.width; } - } - renderer.pipelines.postBatch(src); -}; + }, -module.exports = GraphicsWebGLRenderer; + /** + * The game height. + * + * This is typically the size given in the game configuration. + * + * @name Phaser.Scale.ScaleManager#height + * @type {number} + * @readonly + * @since 3.16.0 + */ + height: { + get: function () + { + return this.gameSize.height; + } -/***/ }), -/* 1065 */ -/***/ (function(module, exports, __webpack_require__) { + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Is the device in a portrait orientation as reported by the Orientation API? + * This value is usually only available on mobile devices. + * + * @name Phaser.Scale.ScaleManager#isPortrait + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isPortrait: { -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + get: function () + { + return (this.orientation === CONST.ORIENTATION.PORTRAIT); + } -if (true) -{ - renderWebGL = __webpack_require__(1066); -} + }, -if (true) -{ - renderCanvas = __webpack_require__(1067); -} + /** + * Is the device in a landscape orientation as reported by the Orientation API? + * This value is usually only available on mobile devices. + * + * @name Phaser.Scale.ScaleManager#isLandscape + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isLandscape: { -module.exports = { + get: function () + { + return (this.orientation === CONST.ORIENTATION.LANDSCAPE); + } - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + }, -}; + /** + * Are the game dimensions portrait? (i.e. taller than they are wide) + * + * This is different to the device itself being in a portrait orientation. + * + * @name Phaser.Scale.ScaleManager#isGamePortrait + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isGamePortrait: { + get: function () + { + return (this.height > this.width); + } -/***/ }), -/* 1066 */ -/***/ (function(module, exports) { + }, + + /** + * Are the game dimensions landscape? (i.e. wider than they are tall) + * + * This is different to the device itself being in a landscape orientation. + * + * @name Phaser.Scale.ScaleManager#isGameLandscape + * @type {boolean} + * @readonly + * @since 3.16.0 + */ + isGameLandscape: { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + get: function () + { + return (this.width > this.height); + } -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Sprite#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var SpriteWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + } - src.pipeline.batchSprite(src, camera, parentMatrix); -}; +}); -module.exports = SpriteWebGLRenderer; +module.exports = ScaleManager; /***/ }), -/* 1067 */ -/***/ (function(module, exports) { + +/***/ 35098: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Sprite#renderCanvas - * @since 3.0.0 - * @private + * Phaser Scale Manager constants for centering the game canvas. * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Sprite} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @namespace Phaser.Scale.Center + * @memberof Phaser.Scale + * @since 3.16.0 */ -var SpriteCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - - renderer.batchSprite(src, src.frame, camera, parentMatrix); -}; - -module.exports = SpriteCanvasRenderer; - - -/***/ }), -/* 1068 */ -/***/ (function(module, exports, __webpack_require__) { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Phaser Scale Manager constants for centering the game canvas. + * + * To find out what each mode does please see [Phaser.Scale.Center]{@link Phaser.Scale.Center}. + * + * @typedef {Phaser.Scale.Center} Phaser.Scale.CenterType + * @memberof Phaser.Scale + * @since 3.16.0 */ -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); +module.exports = { -if (true) -{ - renderWebGL = __webpack_require__(1069); -} + /** + * The game canvas is not centered within the parent by Phaser. + * You can still center it yourself via CSS. + * + * @name Phaser.Scale.Center.NO_CENTER + * @type {number} + * @const + * @since 3.16.0 + */ + NO_CENTER: 0, -if (true) -{ - renderCanvas = __webpack_require__(1070); -} + /** + * The game canvas is centered both horizontally and vertically within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_BOTH + * @type {number} + * @const + * @since 3.16.0 + */ + CENTER_BOTH: 1, -module.exports = { + /** + * The game canvas is centered horizontally within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_HORIZONTALLY + * @type {number} + * @const + * @since 3.16.0 + */ + CENTER_HORIZONTALLY: 2, - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + /** + * The game canvas is centered both vertically within the parent. + * To do this, the parent has to have a bounds that can be calculated and not be empty. + * + * Centering is achieved by setting the margin left and top properties of the + * game canvas, and does not factor in any other CSS styles you may have applied. + * + * @name Phaser.Scale.Center.CENTER_VERTICALLY + * @type {number} + * @const + * @since 3.16.0 + */ + CENTER_VERTICALLY: 3 }; /***/ }), -/* 1069 */ -/***/ (function(module, exports) { + +/***/ 53539: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * Phaser Scale Manager constants for orientation. * - * @method Phaser.GameObjects.Image#renderWebGL - * @since 3.0.0 - * @private + * @namespace Phaser.Scale.Orientation + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for orientation. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * To find out what each mode does please see [Phaser.Scale.Orientation]{@link Phaser.Scale.Orientation}. + * + * @typedef {Phaser.Scale.Orientation} Phaser.Scale.OrientationType + * @memberof Phaser.Scale + * @since 3.16.0 */ -var ImageWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - this.pipeline.batchSprite(src, camera, parentMatrix); -}; +module.exports = { -module.exports = ImageWebGLRenderer; + /** + * A landscape orientation. + * + * @name Phaser.Scale.Orientation.LANDSCAPE + * @type {string} + * @const + * @since 3.16.0 + */ + LANDSCAPE: 'landscape-primary', + + /** + * A portrait orientation. + * + * @name Phaser.Scale.Orientation.PORTRAIT + * @type {string} + * @const + * @since 3.16.0 + */ + PORTRAIT: 'portrait-primary' + +}; /***/ }), -/* 1070 */ -/***/ (function(module, exports) { + +/***/ 12637: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Image#renderCanvas - * @since 3.0.0 - * @private + * Phaser Scale Manager constants for the different scale modes available. * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @namespace Phaser.Scale.ScaleModes + * @memberof Phaser.Scale + * @since 3.16.0 */ -var ImageCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - - renderer.batchSprite(src, src.frame, camera, parentMatrix); -}; - -module.exports = ImageCanvasRenderer; - - -/***/ }), -/* 1071 */ -/***/ (function(module, exports, __webpack_require__) { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Phaser Scale Manager constants for the different scale modes available. + * + * To find out what each mode does please see [Phaser.Scale.ScaleModes]{@link Phaser.Scale.ScaleModes}. + * + * @typedef {Phaser.Scale.ScaleModes} Phaser.Scale.ScaleModeType + * @memberof Phaser.Scale + * @since 3.16.0 */ -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); +module.exports = { -if (true) -{ - renderWebGL = __webpack_require__(1072); -} + /** + * No scaling happens at all. The canvas is set to the size given in the game config and Phaser doesn't change it + * again from that point on. If you change the canvas size, either via CSS, or directly via code, then you need + * to call the Scale Managers `resize` method to give the new dimensions, or input events will stop working. + * + * @name Phaser.Scale.ScaleModes.NONE + * @type {number} + * @const + * @since 3.16.0 + */ + NONE: 0, -if (true) -{ - renderCanvas = __webpack_require__(1073); -} + /** + * The height is automatically adjusted based on the width. + * + * @name Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT + * @type {number} + * @const + * @since 3.16.0 + */ + WIDTH_CONTROLS_HEIGHT: 1, -module.exports = { + /** + * The width is automatically adjusted based on the height. + * + * @name Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH + * @type {number} + * @const + * @since 3.16.0 + */ + HEIGHT_CONTROLS_WIDTH: 2, - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + /** + * The width and height are automatically adjusted to fit inside the given target area, + * while keeping the aspect ratio. Depending on the aspect ratio there may be some space + * inside the area which is not covered. + * + * @name Phaser.Scale.ScaleModes.FIT + * @type {number} + * @const + * @since 3.16.0 + */ + FIT: 3, + + /** + * The width and height are automatically adjusted to make the size cover the entire target + * area while keeping the aspect ratio. This may extend further out than the target size. + * + * @name Phaser.Scale.ScaleModes.ENVELOP + * @type {number} + * @const + * @since 3.16.0 + */ + ENVELOP: 4, + + /** + * The Canvas is resized to fit all available _parent_ space, regardless of aspect ratio. + * + * @name Phaser.Scale.ScaleModes.RESIZE + * @type {number} + * @const + * @since 3.16.0 + */ + RESIZE: 5 }; /***/ }), -/* 1072 */ -/***/ (function(module, exports) { + +/***/ 10217: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * Phaser Scale Manager constants for zoom modes. * - * @method Phaser.GameObjects.Layer#renderWebGL - * @since 3.50.0 - * @private + * @namespace Phaser.Scale.Zoom + * @memberof Phaser.Scale + * @since 3.16.0 + */ + +/** + * Phaser Scale Manager constants for zoom modes. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Layer} layer - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * To find out what each mode does please see [Phaser.Scale.Zoom]{@link Phaser.Scale.Zoom}. + * + * @typedef {Phaser.Scale.Zoom} Phaser.Scale.ZoomType + * @memberof Phaser.Scale + * @since 3.16.0 */ -var LayerWebGLRenderer = function (renderer, layer, camera) -{ - var children = layer.list; - var childCount = children.length; - if (childCount === 0) - { - return; - } +module.exports = { - layer.depthSort(); + /** + * The game canvas will not be zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.NO_ZOOM + * @type {number} + * @const + * @since 3.16.0 + */ + NO_ZOOM: 1, - renderer.pipelines.preBatch(layer); + /** + * The game canvas will be 2x zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.ZOOM_2X + * @type {number} + * @const + * @since 3.16.0 + */ + ZOOM_2X: 2, - var layerHasBlendMode = (layer.blendMode !== -1); + /** + * The game canvas will be 4x zoomed by Phaser. + * + * @name Phaser.Scale.Zoom.ZOOM_4X + * @type {number} + * @const + * @since 3.16.0 + */ + ZOOM_4X: 4, - if (!layerHasBlendMode) - { - // If Layer is SKIP_TEST then set blend mode to be Normal - renderer.setBlendMode(0); - } + /** + * Calculate the zoom value based on the maximum multiplied game size that will + * fit into the parent, or browser window if no parent is set. + * + * @name Phaser.Scale.Zoom.MAX_ZOOM + * @type {number} + * @const + * @since 3.16.0 + */ + MAX_ZOOM: -1 - var alpha = layer.alpha; +}; - for (var i = 0; i < childCount; i++) - { - var child = children[i]; - if (!child.willRender(camera)) - { - continue; - } +/***/ }), - var childAlphaTopLeft; - var childAlphaTopRight; - var childAlphaBottomLeft; - var childAlphaBottomRight; +/***/ 55301: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (child.alphaTopLeft !== undefined) - { - childAlphaTopLeft = child.alphaTopLeft; - childAlphaTopRight = child.alphaTopRight; - childAlphaBottomLeft = child.alphaBottomLeft; - childAlphaBottomRight = child.alphaBottomRight; - } - else - { - var childAlpha = child.alpha; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - childAlphaTopLeft = childAlpha; - childAlphaTopRight = childAlpha; - childAlphaBottomLeft = childAlpha; - childAlphaBottomRight = childAlpha; - } +var CONST = { - if (!layerHasBlendMode && child.blendMode !== renderer.currentBlendMode) - { - // If Layer doesn't have its own blend mode, then a child can have one - renderer.setBlendMode(child.blendMode); - } + CENTER: __webpack_require__(35098), + ORIENTATION: __webpack_require__(53539), + SCALE_MODE: __webpack_require__(12637), + ZOOM: __webpack_require__(10217) - var mask = child.mask; +}; - if (mask) - { - mask.preRenderWebGL(renderer, child, camera); - } +module.exports = CONST; - var type = child.type; - if (type !== renderer.currentType) - { - renderer.newType = true; - renderer.currentType = type; - } +/***/ }), - renderer.nextTypeMatch = (i < childCount - 1) ? (children[i + 1].type === renderer.currentType) : false; +/***/ 82085: +/***/ ((module) => { - child.setAlpha(childAlphaTopLeft * alpha, childAlphaTopRight * alpha, childAlphaBottomLeft * alpha, childAlphaBottomRight * alpha); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Render - child.renderWebGL(renderer, child, camera); +/** + * The Scale Manager has successfully entered fullscreen mode. + * + * @event Phaser.Scale.Events#ENTER_FULLSCREEN + * @type {string} + * @since 3.16.1 + */ +module.exports = 'enterfullscreen'; - // Restore original values - child.setAlpha(childAlphaTopLeft, childAlphaTopRight, childAlphaBottomLeft, childAlphaBottomRight); - if (mask) - { - mask.postRenderWebGL(renderer, camera); - } +/***/ }), - renderer.newType = false; - } +/***/ 11826: +/***/ ((module) => { - renderer.pipelines.postBatch(layer); -}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = LayerWebGLRenderer; +/** + * The Scale Manager tried to enter fullscreen mode but failed. + * + * @event Phaser.Scale.Events#FULLSCREEN_FAILED + * @type {string} + * @since 3.17.0 + */ +module.exports = 'fullscreenfailed'; /***/ }), -/* 1073 */ -/***/ (function(module, exports) { + +/***/ 56691: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Layer#renderCanvas - * @since 3.50.0 - * @private + * The Scale Manager tried to enter fullscreen mode, but it is unsupported by the browser. * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Layer} layer - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @event Phaser.Scale.Events#FULLSCREEN_UNSUPPORTED + * @type {string} + * @since 3.16.1 */ -var LayerCanvasRenderer = function (renderer, layer, camera) -{ - var children = layer.list; +module.exports = 'fullscreenunsupported'; - if (children.length === 0) - { - return; - } - layer.depthSort(); +/***/ }), - var layerHasBlendMode = (layer.blendMode !== -1); +/***/ 34739: +/***/ ((module) => { - if (!layerHasBlendMode) - { - // If Layer is SKIP_TEST then set blend mode to be Normal - renderer.setBlendMode(0); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var alpha = layer._alpha; +/** + * The Scale Manager was in fullscreen mode, but has since left, either directly via game code, + * or via a user gestured, such as pressing the ESC key. + * + * @event Phaser.Scale.Events#LEAVE_FULLSCREEN + * @type {string} + * @since 3.16.1 + */ +module.exports = 'leavefullscreen'; - if (layer.mask) - { - layer.mask.preRenderCanvas(renderer, null, camera); - } - for (var i = 0; i < children.length; i++) - { - var child = children[i]; +/***/ }), - if (!child.willRender(camera)) - { - continue; - } +/***/ 26681: +/***/ ((module) => { - var childAlpha = child.alpha; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (!layerHasBlendMode && child.blendMode !== renderer.currentBlendMode) - { - // If Layer doesn't have its own blend mode, then a child can have one - renderer.setBlendMode(child.blendMode); - } +/** + * The Scale Manager Orientation Change Event. + * + * This event is dispatched whenever the Scale Manager detects an orientation change event from the browser. + * + * @event Phaser.Scale.Events#ORIENTATION_CHANGE + * @type {string} + * @since 3.16.1 + * + * @param {string} orientation - The new orientation value. Either `Phaser.Scale.Orientation.LANDSCAPE` or `Phaser.Scale.Orientation.PORTRAIT`. + */ +module.exports = 'orientationchange'; - // Set parent values - child.setAlpha(childAlpha * alpha); - // Render - child.renderCanvas(renderer, child, camera); +/***/ }), - // Restore original values - child.setAlpha(childAlpha); - } +/***/ 11428: +/***/ ((module) => { - if (layer.mask) - { - layer.mask.postRenderCanvas(renderer); - } -}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = LayerCanvasRenderer; +/** + * The Scale Manager Resize Event. + * + * This event is dispatched whenever the Scale Manager detects a resize event from the browser. + * It sends three parameters to the callback, each of them being Size components. You can read + * the `width`, `height`, `aspectRatio` and other properties of these components to help with + * scaling your own game content. + * + * @event Phaser.Scale.Events#RESIZE + * @type {string} + * @since 3.16.1 + * + * @param {Phaser.Structs.Size} gameSize - A reference to the Game Size component. This is the un-scaled size of your game canvas. + * @param {Phaser.Structs.Size} baseSize - A reference to the Base Size component. This is the game size. + * @param {Phaser.Structs.Size} displaySize - A reference to the Display Size component. This is the scaled canvas size, after applying zoom and scale mode. + * @param {number} previousWidth - If the `gameSize` has changed, this value contains its previous width, otherwise it contains the current width. + * @param {number} previousHeight - If the `gameSize` has changed, this value contains its previous height, otherwise it contains the current height. + */ +module.exports = 'resize'; /***/ }), -/* 1074 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 40444: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @namespace Phaser.GameObjects.Particles + * @namespace Phaser.Scale.Events */ module.exports = { - EmitterOp: __webpack_require__(449), - GravityWell: __webpack_require__(450), - Particle: __webpack_require__(451), - ParticleEmitter: __webpack_require__(452), - ParticleEmitterManager: __webpack_require__(220), - Zones: __webpack_require__(1078) + ENTER_FULLSCREEN: __webpack_require__(82085), + FULLSCREEN_FAILED: __webpack_require__(11826), + FULLSCREEN_UNSUPPORTED: __webpack_require__(56691), + LEAVE_FULLSCREEN: __webpack_require__(34739), + ORIENTATION_CHANGE: __webpack_require__(26681), + RESIZE: __webpack_require__(11428) }; /***/ }), -/* 1075 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 86754: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); - -if (true) -{ - renderWebGL = __webpack_require__(1076); -} +var Extend = __webpack_require__(98611); +var CONST = __webpack_require__(55301); -if (true) -{ - renderCanvas = __webpack_require__(1077); -} +/** + * @namespace Phaser.Scale + * + * @borrows Phaser.Scale.Center.NO_CENTER as NO_CENTER + * @borrows Phaser.Scale.Center.CENTER_BOTH as CENTER_BOTH + * @borrows Phaser.Scale.Center.CENTER_HORIZONTALLY as CENTER_HORIZONTALLY + * @borrows Phaser.Scale.Center.CENTER_VERTICALLY as CENTER_VERTICALLY + * + * @borrows Phaser.Scale.Orientation.LANDSCAPE as LANDSCAPE + * @borrows Phaser.Scale.Orientation.PORTRAIT as PORTRAIT + * + * @borrows Phaser.Scale.ScaleModes.NONE as NONE + * @borrows Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT as WIDTH_CONTROLS_HEIGHT + * @borrows Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH as HEIGHT_CONTROLS_WIDTH + * @borrows Phaser.Scale.ScaleModes.FIT as FIT + * @borrows Phaser.Scale.ScaleModes.ENVELOP as ENVELOP + * @borrows Phaser.Scale.ScaleModes.RESIZE as RESIZE + * + * @borrows Phaser.Scale.Zoom.NO_ZOOM as NO_ZOOM + * @borrows Phaser.Scale.Zoom.ZOOM_2X as ZOOM_2X + * @borrows Phaser.Scale.Zoom.ZOOM_4X as ZOOM_4X + * @borrows Phaser.Scale.Zoom.MAX_ZOOM as MAX_ZOOM + */ -module.exports = { +var Scale = { - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + Center: __webpack_require__(35098), + Events: __webpack_require__(40444), + Orientation: __webpack_require__(53539), + ScaleManager: __webpack_require__(756), + ScaleModes: __webpack_require__(12637), + Zoom: __webpack_require__(10217) }; +Scale = Extend(false, Scale, CONST.CENTER); +Scale = Extend(false, Scale, CONST.ORIENTATION); +Scale = Extend(false, Scale, CONST.SCALE_MODE); +Scale = Extend(false, Scale, CONST.ZOOM); + +module.exports = Scale; + /***/ }), -/* 1076 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 47736: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TransformMatrix = __webpack_require__(25); -var Utils = __webpack_require__(12); - -var tempMatrix1 = new TransformMatrix(); -var tempMatrix2 = new TransformMatrix(); -var tempMatrix3 = new TransformMatrix(); -var tempMatrix4 = new TransformMatrix(); +var GetFastValue = __webpack_require__(72632); +var UppercaseFirst = __webpack_require__(40587); /** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * Builds an array of which physics plugins should be activated for the given Scene. * - * @method Phaser.GameObjects.Particles.EmitterManager#renderWebGL + * @function Phaser.Scenes.GetPhysicsPlugins * @since 3.0.0 - * @private * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @param {Phaser.Scenes.Systems} sys - The scene system to get the physics systems of. + * + * @return {array} An array of Physics systems to start for this Scene. */ -var ParticleManagerWebGLRenderer = function (renderer, emitterManager, camera, parentMatrix) +var GetPhysicsPlugins = function (sys) { - var emitters = emitterManager.emitters.list; - var emittersLength = emitters.length; + var defaultSystem = sys.game.config.defaultPhysicsSystem; + var sceneSystems = GetFastValue(sys.settings, 'physics', false); - if (emittersLength === 0) + if (!defaultSystem && !sceneSystems) { + // No default physics system or systems in this scene return; } - var pipeline = renderer.pipelines.set(emitterManager.pipeline); - - var camMatrix = tempMatrix1; - var calcMatrix = tempMatrix2; - var particleMatrix = tempMatrix3; - var managerMatrix = tempMatrix4; + // Let's build the systems array + var output = []; - if (parentMatrix) - { - managerMatrix.loadIdentity(); - managerMatrix.multiply(parentMatrix); - managerMatrix.translate(emitterManager.x, emitterManager.y); - managerMatrix.rotate(emitterManager.rotation); - managerMatrix.scale(emitterManager.scaleX, emitterManager.scaleY); - } - else + if (defaultSystem) { - managerMatrix.applyITRS(emitterManager.x, emitterManager.y, emitterManager.rotation, emitterManager.scaleX, emitterManager.scaleY); + output.push(UppercaseFirst(defaultSystem + 'Physics')); } - var roundPixels = camera.roundPixels; - var texture = emitterManager.defaultFrame.glTexture; - var getTint = Utils.getTintAppendFloatAlpha; - - var textureUnit = pipeline.setGameObject(emitterManager, emitterManager.defaultFrame); - - renderer.pipelines.preBatch(emitterManager); - - for (var e = 0; e < emittersLength; e++) + if (sceneSystems) { - var emitter = emitters[e]; - var particles = emitter.alive; - var particleCount = particles.length; - - if (!emitter.visible || particleCount === 0) - { - continue; - } - - camera.addToRenderList(emitter); - - var scrollFactorX = emitter.scrollFactorX; - var scrollFactorY = emitter.scrollFactorY; - - renderer.setBlendMode(emitter.blendMode); - - if (emitter.mask) - { - emitter.mask.preRenderWebGL(renderer, emitter, camera); - - renderer.pipelines.set(emitterManager.pipeline); - } - - var tintEffect = 0; - - for (var i = 0; i < particleCount; i++) + for (var key in sceneSystems) { - var particle = particles[i]; - - var alpha = particle.alpha * camera.alpha; + key = UppercaseFirst(key.concat('Physics')); - if (alpha <= 0) + if (output.indexOf(key) === -1) { - continue; + output.push(key); } - - particleMatrix.applyITRS(particle.x, particle.y, particle.rotation, particle.scaleX, particle.scaleY); - - camMatrix.copyFrom(camera.matrix); - - camMatrix.multiplyWithOffset(managerMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY); - - // Undo the camera scroll - particleMatrix.e = particle.x; - particleMatrix.f = particle.y; - - // Multiply by the particle matrix, store result in calcMatrix - camMatrix.multiply(particleMatrix, calcMatrix); - - var frame = particle.frame; - - var x = -frame.halfWidth; - var y = -frame.halfHeight; - var xw = x + frame.width; - var yh = y + frame.height; - - var tx0 = calcMatrix.getXRound(x, y, roundPixels); - var ty0 = calcMatrix.getYRound(x, y, roundPixels); - - var tx1 = calcMatrix.getXRound(x, yh, roundPixels); - var ty1 = calcMatrix.getYRound(x, yh, roundPixels); - - var tx2 = calcMatrix.getXRound(xw, yh, roundPixels); - var ty2 = calcMatrix.getYRound(xw, yh, roundPixels); - - var tx3 = calcMatrix.getXRound(xw, y, roundPixels); - var ty3 = calcMatrix.getYRound(xw, y, roundPixels); - - var tint = getTint(particle.tint, alpha); - - pipeline.batchQuad(emitter, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, frame.u0, frame.v0, frame.u1, frame.v1, tint, tint, tint, tint, tintEffect, texture, textureUnit); - } - - if (emitter.mask) - { - emitter.mask.postRenderWebGL(renderer, camera); } } - renderer.pipelines.postBatch(emitterManager); + // An array of Physics systems to start for this Scene + return output; }; -module.exports = ParticleManagerWebGLRenderer; +module.exports = GetPhysicsPlugins; /***/ }), -/* 1077 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 91088: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var TransformMatrix = __webpack_require__(25); - -var tempMatrix1 = new TransformMatrix(); -var tempMatrix2 = new TransformMatrix(); -var tempMatrix3 = new TransformMatrix(); -var tempMatrix4 = new TransformMatrix(); +var GetFastValue = __webpack_require__(72632); /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * Builds an array of which plugins (not including physics plugins) should be activated for the given Scene. * - * @method Phaser.GameObjects.Particles.EmitterManager#renderCanvas + * @function Phaser.Scenes.GetScenePlugins * @since 3.0.0 - * @private * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} emitterManager - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @param {Phaser.Scenes.Systems} sys - The Scene Systems object to check for plugins. + * + * @return {array} An array of all plugins which should be activated, either the default ones or the ones configured in the Scene Systems object. */ -var ParticleManagerCanvasRenderer = function (renderer, emitterManager, camera, parentMatrix) +var GetScenePlugins = function (sys) { - var emitters = emitterManager.emitters.list; - var emittersLength = emitters.length; + var defaultPlugins = sys.plugins.getDefaultScenePlugins(); + + var scenePlugins = GetFastValue(sys.settings, 'plugins', false); - if (emittersLength === 0) + // Scene Plugins always override Default Plugins + if (Array.isArray(scenePlugins)) { - return; + return scenePlugins; } - - var camMatrix = tempMatrix1.copyFrom(camera.matrix); - var calcMatrix = tempMatrix2; - var particleMatrix = tempMatrix3; - var managerMatrix = tempMatrix4; - - if (parentMatrix) + else if (defaultPlugins) { - managerMatrix.loadIdentity(); - managerMatrix.multiply(parentMatrix); - managerMatrix.translate(emitterManager.x, emitterManager.y); - managerMatrix.rotate(emitterManager.rotation); - managerMatrix.scale(emitterManager.scaleX, emitterManager.scaleY); + return defaultPlugins; } else { - managerMatrix.applyITRS(emitterManager.x, emitterManager.y, emitterManager.rotation, emitterManager.scaleX, emitterManager.scaleY); + // No default plugins or plugins in this scene + return []; } +}; - var ctx = renderer.currentContext; - var roundPixels = camera.roundPixels; +module.exports = GetScenePlugins; - for (var e = 0; e < emittersLength; e++) - { - var emitter = emitters[e]; - var particles = emitter.alive; - var particleCount = particles.length; - if (!emitter.visible || particleCount === 0) - { - continue; - } +/***/ }), - camera.addToRenderList(emitter); +/***/ 90415: +/***/ ((module) => { - var scrollFactorX = emitter.scrollFactorX; - var scrollFactorY = emitter.scrollFactorY; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - ctx.save(); +// These properties get injected into the Scene and map to local systems +// The map value is the property that is injected into the Scene, the key is the Scene.Systems reference. +// These defaults can be modified via the Scene config object +// var config = { +// map: { +// add: 'makeStuff', +// load: 'loader' +// } +// }; - ctx.globalCompositeOperation = renderer.blendModes[emitter.blendMode]; +var InjectionMap = { - for (var i = 0; i < particleCount; i++) - { - var particle = particles[i]; + game: 'game', + renderer: 'renderer', + + anims: 'anims', + cache: 'cache', + plugins: 'plugins', + registry: 'registry', + scale: 'scale', + sound: 'sound', + textures: 'textures', - var alpha = particle.alpha * camera.alpha; + events: 'events', + cameras: 'cameras', + add: 'add', + make: 'make', + scenePlugin: 'scene', + displayList: 'children', + lights: 'lights', - if (alpha <= 0) - { - continue; - } + data: 'data', + input: 'input', + load: 'load', + time: 'time', + tweens: 'tweens', - particleMatrix.applyITRS(particle.x, particle.y, particle.rotation, particle.scaleX, particle.scaleY); + arcadePhysics: 'physics', + impactPhysics: 'impact', + matterPhysics: 'matter' - camMatrix.copyFrom(camera.matrix); +}; - camMatrix.multiplyWithOffset(managerMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY); +if (false) +{} - // Undo the camera scroll - particleMatrix.e = particle.x; - particleMatrix.f = particle.y; +if (false) +{} - // Multiply by the particle matrix, store result in calcMatrix - camMatrix.multiply(particleMatrix, calcMatrix); +module.exports = InjectionMap; - var frame = particle.frame; - var cd = frame.canvasData; - var x = -(frame.halfWidth); - var y = -(frame.halfHeight); +/***/ }), - ctx.globalAlpha = alpha; +/***/ 87157: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - ctx.save(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - calcMatrix.setToContext(ctx); +var Class = __webpack_require__(56694); +var Systems = __webpack_require__(63946); - if (roundPixels) - { - x = Math.round(x); - y = Math.round(y); - } +/** + * @classdesc + * A base Phaser.Scene class which can be extended for your own use. + * + * You can also define the optional methods {@link Phaser.Types.Scenes.SceneInitCallback init()}, {@link Phaser.Types.Scenes.ScenePreloadCallback preload()}, and {@link Phaser.Types.Scenes.SceneCreateCallback create()}. + * + * @class Scene + * @memberof Phaser + * @constructor + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Scenes.SettingsConfig)} [config] - The scene key or scene specific configuration settings. + */ +var Scene = new Class({ - ctx.imageSmoothingEnabled = !(!renderer.antialias || frame.source.scaleMode); + initialize: - ctx.drawImage(frame.source.image, cd.x, cd.y, cd.width, cd.height, x, y, cd.width, cd.height); + function Scene (config) + { + /** + * The Scene Systems. You must never overwrite this property, or all hell will break lose. + * + * @name Phaser.Scene#sys + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.sys = new Systems(this, config); - ctx.restore(); - } + /** + * A reference to the Phaser.Game instance. + * + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game; - ctx.restore(); - } -}; + /** + * A reference to the global Animation Manager. + * + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#anims + * @type {Phaser.Animations.AnimationManager} + * @since 3.0.0 + */ + this.anims; -module.exports = ParticleManagerCanvasRenderer; + /** + * A reference to the global Cache. + * + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#cache + * @type {Phaser.Cache.CacheManager} + * @since 3.0.0 + */ + this.cache; + /** + * A reference to the global Data Manager. + * + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#registry + * @type {Phaser.Data.DataManager} + * @since 3.0.0 + */ + this.registry; -/***/ }), -/* 1078 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * A reference to the Sound Manager. + * + * This property will only be available if defined in the Scene Injection Map and the plugin is installed. + * + * @name Phaser.Scene#sound + * @type {(Phaser.Sound.NoAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager|Phaser.Sound.WebAudioSoundManager)} + * @since 3.0.0 + */ + this.sound; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A reference to the Texture Manager. + * + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#textures + * @type {Phaser.Textures.TextureManager} + * @since 3.0.0 + */ + this.textures; -/** - * @namespace Phaser.GameObjects.Particles.Zones - */ + /** + * A Scene specific Event Emitter. + * + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#events + * @type {Phaser.Events.EventEmitter} + * @since 3.0.0 + */ + this.events; -module.exports = { + /** + * The Scene Camera Manager. + * + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#cameras + * @type {Phaser.Cameras.Scene2D.CameraManager} + * @since 3.0.0 + */ + this.cameras; + + /** + * The Scene Game Object Factory. + * + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#add + * @type {Phaser.GameObjects.GameObjectFactory} + * @since 3.0.0 + */ + this.add; + + /** + * The Scene Game Object Creator. + * + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#make + * @type {Phaser.GameObjects.GameObjectCreator} + * @since 3.0.0 + */ + this.make; + + /** + * A reference to the Scene Manager Plugin. + * + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#scene + * @type {Phaser.Scenes.ScenePlugin} + * @since 3.0.0 + */ + this.scene; + + /** + * The Game Object Display List belonging to this Scene. + * + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#children + * @type {Phaser.GameObjects.DisplayList} + * @since 3.0.0 + */ + this.children; + + /** + * The Scene Lights Manager Plugin. + * + * This property will only be available if defined in the Scene Injection Map and the plugin is installed. + * + * @name Phaser.Scene#lights + * @type {Phaser.GameObjects.LightsManager} + * @since 3.0.0 + */ + this.lights; + + /** + * A Scene specific Data Manager Plugin. + * + * See the `registry` property for the global Data Manager. + * + * This property will only be available if defined in the Scene Injection Map and the plugin is installed. + * + * @name Phaser.Scene#data + * @type {Phaser.Data.DataManager} + * @since 3.0.0 + */ + this.data; + + /** + * The Scene Input Manager Plugin. + * + * This property will only be available if defined in the Scene Injection Map and the plugin is installed. + * + * @name Phaser.Scene#input + * @type {Phaser.Input.InputPlugin} + * @since 3.0.0 + */ + this.input; + + /** + * The Scene Loader Plugin. + * + * This property will only be available if defined in the Scene Injection Map and the plugin is installed. + * + * @name Phaser.Scene#load + * @type {Phaser.Loader.LoaderPlugin} + * @since 3.0.0 + */ + this.load; - DeathZone: __webpack_require__(453), - EdgeZone: __webpack_require__(454), - RandomZone: __webpack_require__(456) + /** + * The Scene Time and Clock Plugin. + * + * This property will only be available if defined in the Scene Injection Map and the plugin is installed. + * + * @name Phaser.Scene#time + * @type {Phaser.Time.Clock} + * @since 3.0.0 + */ + this.time; -}; + /** + * The Scene Tween Manager Plugin. + * + * This property will only be available if defined in the Scene Injection Map and the plugin is installed. + * + * @name Phaser.Scene#tweens + * @type {Phaser.Tweens.TweenManager} + * @since 3.0.0 + */ + this.tweens; + /** + * The Scene Arcade Physics Plugin. + * + * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured. + * + * @name Phaser.Scene#physics + * @type {Phaser.Physics.Arcade.ArcadePhysics} + * @since 3.0.0 + */ + this.physics; -/***/ }), -/* 1079 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The Scene Matter Physics Plugin. + * + * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured. + * + * @name Phaser.Scene#matter + * @type {Phaser.Physics.Matter.MatterPhysics} + * @since 3.0.0 + */ + this.matter; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (false) + {} -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + /** + * A reference to the global Scale Manager. + * + * This property will only be available if defined in the Scene Injection Map. + * + * @name Phaser.Scene#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.16.2 + */ + this.scale; -if (true) -{ - renderWebGL = __webpack_require__(1080); -} + /** + * A reference to the global Plugin Manager. + * + * The Plugin Manager is a global system that allows plugins to register themselves with it, and can then install + * those plugins into Scenes as required. + * + * @name Phaser.Scene#plugins + * @type {Phaser.Plugins.PluginManager} + * @since 3.0.0 + */ + this.plugins; -if (true) -{ - renderCanvas = __webpack_require__(1081); -} + /** + * A reference to the renderer instance Phaser is using, either Canvas Renderer or WebGL Renderer. + * + * @name Phaser.Scene#renderer + * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} + * @since 3.50.0 + */ + this.renderer; + }, -module.exports = { + /** + * This method should be overridden by your own Scenes. + * + * This method is called once per game step while the scene is running. + * + * @method Phaser.Scene#update + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + update: function () + { + } - renderWebGL: renderWebGL, - renderCanvas: renderCanvas +}); -}; +module.exports = Scene; /***/ }), -/* 1080 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 13553: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Utils = __webpack_require__(12); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(92980); +var Events = __webpack_require__(7599); +var GameEvents = __webpack_require__(97081); +var GetValue = __webpack_require__(10850); +var LoaderEvents = __webpack_require__(683); +var NOOP = __webpack_require__(72283); +var Scene = __webpack_require__(87157); +var Systems = __webpack_require__(63946); /** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * @classdesc + * The Scene Manager. * - * @method Phaser.GameObjects.RenderTexture#renderWebGL - * @since 3.2.0 - * @private + * The Scene Manager is a Game level system, responsible for creating, processing and updating all of the + * Scenes in a Game instance. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.RenderTexture} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * You should not usually interact directly with the Scene Manager at all. Instead, you should use + * the Scene Plugin, which is available from every Scene in your game via the `this.scene` property. + * + * Using methods in this Scene Manager directly will break queued operations and can cause runtime + * errors. Instead, go via the Scene Plugin. Every feature this Scene Manager provides is also + * available via the Scene Plugin. + * + * @class SceneManager + * @memberof Phaser.Scenes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Phaser.Game instance this Scene Manager belongs to. + * @param {object} sceneConfig - Scene specific configuration settings. */ -var RenderTextureWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - - var cameraAlpha = camera.alpha; - - var renderTarget = src.renderTarget; - var width = renderTarget.width; - var height = renderTarget.height; - - var getTint = Utils.getTintAppendFloatAlpha; +var SceneManager = new Class({ - var pipeline = renderer.pipelines.set(src.pipeline); + initialize: - var textureUnit = pipeline.setTexture2D(renderTarget.texture); + function SceneManager (game, sceneConfig) + { + /** + * The Game that this SceneManager belongs to. + * + * @name Phaser.Scenes.SceneManager#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game = game; - renderer.pipelines.preBatch(src); + /** + * An object that maps the keys to the scene so we can quickly get a scene from a key without iteration. + * + * @name Phaser.Scenes.SceneManager#keys + * @type {Record} + * @since 3.0.0 + */ + this.keys = {}; - pipeline.batchTexture( - src, - renderTarget.texture, - width, height, - src.x, src.y, - width, height, - src.scaleX, src.scaleY, - src.rotation, - src.flipX, !src.flipY, - src.scrollFactorX, src.scrollFactorY, - src.displayOriginX, src.displayOriginY, - 0, 0, width, height, - getTint(src.tintTopLeft, cameraAlpha * src._alphaTL), - getTint(src.tintTopRight, cameraAlpha * src._alphaTR), - getTint(src.tintBottomLeft, cameraAlpha * src._alphaBL), - getTint(src.tintBottomRight, cameraAlpha * src._alphaBR), - src.tintFill, - 0, 0, - camera, - parentMatrix, - true, - textureUnit - ); + /** + * The array in which all of the scenes are kept. + * + * @name Phaser.Scenes.SceneManager#scenes + * @type {Phaser.Scene[]} + * @since 3.0.0 + */ + this.scenes = []; - renderer.resetTextures(); + /** + * Scenes pending to be added are stored in here until the manager has time to add it. + * + * @name Phaser.Scenes.SceneManager#_pending + * @type {array} + * @private + * @since 3.0.0 + */ + this._pending = []; - renderer.pipelines.postBatch(src); -}; + /** + * An array of scenes waiting to be started once the game has booted. + * + * @name Phaser.Scenes.SceneManager#_start + * @type {array} + * @private + * @since 3.0.0 + */ + this._start = []; -module.exports = RenderTextureWebGLRenderer; + /** + * An operations queue, because we don't manipulate the scenes array during processing. + * + * @name Phaser.Scenes.SceneManager#_queue + * @type {array} + * @private + * @since 3.0.0 + */ + this._queue = []; + /** + * Boot time data to merge. + * + * @name Phaser.Scenes.SceneManager#_data + * @type {object} + * @private + * @since 3.4.0 + */ + this._data = {}; -/***/ }), -/* 1081 */ -/***/ (function(module, exports) { + /** + * Is the Scene Manager actively processing the Scenes list? + * + * @name Phaser.Scenes.SceneManager#isProcessing + * @type {boolean} + * @default false + * @readonly + * @since 3.0.0 + */ + this.isProcessing = false; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Has the Scene Manager properly started? + * + * @name Phaser.Scenes.SceneManager#isBooted + * @type {boolean} + * @default false + * @readonly + * @since 3.4.0 + */ + this.isBooted = false; -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.RenderTexture#renderCanvas - * @since 3.2.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.RenderTexture} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var RenderTextureCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + /** + * Do any of the Cameras in any of the Scenes require a custom viewport? + * If not we can skip scissor tests. + * + * @name Phaser.Scenes.SceneManager#customViewports + * @type {number} + * @default 0 + * @since 3.12.0 + */ + this.customViewports = 0; - renderer.batchSprite(src, src.frame, camera, parentMatrix); -}; + /** + * This system Scene is created during `bootQueue` and is a default + * empty Scene that lives outside of the Scene list, but can be used + * by plugins and managers that need access to a live Scene, without + * being tied to one. + * + * @name Phaser.Scenes.SceneManager#systemScene + * @type {Phaser.Scene} + * @since 3.60.0 + */ + this.systemScene; -module.exports = RenderTextureCanvasRenderer; + if (sceneConfig) + { + if (!Array.isArray(sceneConfig)) + { + sceneConfig = [ sceneConfig ]; + } + for (var i = 0; i < sceneConfig.length; i++) + { + // The i === 0 part just autostarts the first Scene given (unless it says otherwise in its config) + this._pending.push({ + key: 'default', + scene: sceneConfig[i], + autoStart: (i === 0), + data: {} + }); + } + } -/***/ }), -/* 1082 */ -/***/ (function(module, exports, __webpack_require__) { + game.events.once(GameEvents.READY, this.bootQueue, this); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Internal first-time Scene boot handler. + * + * @method Phaser.Scenes.SceneManager#bootQueue + * @private + * @since 3.2.0 + */ + bootQueue: function () + { + if (this.isBooted) + { + return; + } -var RETRO_FONT_CONST = __webpack_require__(1083); -var Extend = __webpack_require__(17); + // Create the system Scene + this.systemScene = this.createSceneFromInstance('__SYSTEM', new Scene()); -/** - * @namespace Phaser.GameObjects.RetroFont - * @since 3.6.0 - */ + var i; + var entry; + var key; + var sceneConfig; -var RetroFont = { Parse: __webpack_require__(1084) }; + for (i = 0; i < this._pending.length; i++) + { + entry = this._pending[i]; -// Merge in the consts -RetroFont = Extend(false, RetroFont, RETRO_FONT_CONST); + key = entry.key; + sceneConfig = entry.scene; -module.exports = RetroFont; + var newScene; + if (sceneConfig instanceof Scene) + { + newScene = this.createSceneFromInstance(key, sceneConfig); + } + else if (typeof sceneConfig === 'object') + { + newScene = this.createSceneFromObject(key, sceneConfig); + } + else if (typeof sceneConfig === 'function') + { + newScene = this.createSceneFromFunction(key, sceneConfig); + } -/***/ }), -/* 1083 */ -/***/ (function(module, exports) { + // Replace key in case the scene changed it + key = newScene.sys.settings.key; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.keys[key] = newScene; -var RETRO_FONT_CONST = { + this.scenes.push(newScene); - /** - * Text Set 1 = !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ - * - * @name Phaser.GameObjects.RetroFont.TEXT_SET1 - * @type {string} - * @since 3.6.0 - */ - TEXT_SET1: ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~', + // Any data to inject? + if (this._data[key]) + { + newScene.sys.settings.data = this._data[key].data; - /** - * Text Set 2 = !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ - * - * @name Phaser.GameObjects.RetroFont.TEXT_SET2 - * @type {string} - * @since 3.6.0 - */ - TEXT_SET2: ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ', + if (this._data[key].autoStart) + { + entry.autoStart = true; + } + } - /** - * Text Set 3 = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 - * - * @name Phaser.GameObjects.RetroFont.TEXT_SET3 - * @type {string} - * @since 3.6.0 - */ - TEXT_SET3: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ', + if (entry.autoStart || newScene.sys.settings.active) + { + this._start.push(key); + } + } - /** - * Text Set 4 = ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 - * - * @name Phaser.GameObjects.RetroFont.TEXT_SET4 - * @type {string} - * @since 3.6.0 - */ - TEXT_SET4: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789', + // Clear the pending lists + this._pending.length = 0; - /** - * Text Set 5 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789 - * - * @name Phaser.GameObjects.RetroFont.TEXT_SET5 - * @type {string} - * @since 3.6.0 - */ - TEXT_SET5: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() \'!?-*:0123456789', + this._data = {}; - /** - * Text Set 6 = ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789"(),-.' - * - * @name Phaser.GameObjects.RetroFont.TEXT_SET6 - * @type {string} - * @since 3.6.0 - */ - TEXT_SET6: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789"(),-.\' ', + this.isBooted = true; - /** - * Text Set 7 = AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW")28FLRX-'39 - * - * @name Phaser.GameObjects.RetroFont.TEXT_SET7 - * @type {string} - * @since 3.6.0 - */ - TEXT_SET7: 'AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW")28FLRX-\'39', + // _start might have been populated by the above + for (i = 0; i < this._start.length; i++) + { + entry = this._start[i]; - /** - * Text Set 8 = 0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ - * - * @name Phaser.GameObjects.RetroFont.TEXT_SET8 - * @type {string} - * @since 3.6.0 - */ - TEXT_SET8: '0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ', + this.start(entry); + } - /** - * Text Set 9 = ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'"?! - * - * @name Phaser.GameObjects.RetroFont.TEXT_SET9 - * @type {string} - * @since 3.6.0 - */ - TEXT_SET9: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,\'"?!', + this._start.length = 0; + }, /** - * Text Set 10 = ABCDEFGHIJKLMNOPQRSTUVWXYZ - * - * @name Phaser.GameObjects.RetroFont.TEXT_SET10 - * @type {string} - * @since 3.6.0 + * Process the Scene operations queue. + * + * @method Phaser.Scenes.SceneManager#processQueue + * @since 3.0.0 */ - TEXT_SET10: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', + processQueue: function () + { + var pendingLength = this._pending.length; + var queueLength = this._queue.length; - /** - * Text Set 11 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"-+!?()':;0123456789 - * - * @name Phaser.GameObjects.RetroFont.TEXT_SET11 - * @since 3.6.0 - * @type {string} - */ - TEXT_SET11: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"-+!?()\':;0123456789' + if (pendingLength === 0 && queueLength === 0) + { + return; + } -}; + var i; + var entry; -module.exports = RETRO_FONT_CONST; + if (pendingLength) + { + for (i = 0; i < pendingLength; i++) + { + entry = this._pending[i]; + this.add(entry.key, entry.scene, entry.autoStart, entry.data); + } -/***/ }), -/* 1084 */ -/***/ (function(module, exports, __webpack_require__) { + // _start might have been populated by this.add + for (i = 0; i < this._start.length; i++) + { + entry = this._start[i]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.start(entry); + } -var GetValue = __webpack_require__(6); + // Clear the pending lists + this._start.length = 0; + this._pending.length = 0; + } -/** - * Parses a Retro Font configuration object so you can pass it to the BitmapText constructor - * and create a BitmapText object using a fixed-width retro font. - * - * @function Phaser.GameObjects.RetroFont.Parse - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - A reference to the Phaser Scene. - * @param {Phaser.Types.GameObjects.BitmapText.RetroFontConfig} config - The font configuration object. - * - * @return {object} A parsed Bitmap Font data entry for the Bitmap Font cache. - */ -var ParseRetroFont = function (scene, config) -{ - var w = config.width; - var h = config.height; + for (i = 0; i < this._queue.length; i++) + { + entry = this._queue[i]; - var cx = Math.floor(w / 2); - var cy = Math.floor(h / 2); + this[entry.op](entry.keyA, entry.keyB); + } - var letters = GetValue(config, 'chars', ''); + this._queue.length = 0; + }, - if (letters === '') + /** + * Adds a new Scene into the SceneManager. + * You must give each Scene a unique key by which you'll identify it. + * + * The `sceneConfig` can be: + * + * * A `Phaser.Scene` object, or an object that extends it. + * * A plain JavaScript object + * * A JavaScript ES6 Class that extends `Phaser.Scene` + * * A JavaScript ES5 prototype based Class + * * A JavaScript function + * + * If a function is given then a new Scene will be created by calling it. + * + * @method Phaser.Scenes.SceneManager#add + * @since 3.0.0 + * + * @param {string} key - A unique key used to reference the Scene, i.e. `MainMenu` or `Level1`. + * @param {(Phaser.Types.Scenes.SceneType)} sceneConfig - The config for the Scene + * @param {boolean} [autoStart=false] - If `true` the Scene will be started immediately after being added. + * @param {object} [data] - Optional data object. This will be set as `Scene.settings.data` and passed to `Scene.init`, and `Scene.create`. + * + * @return {?Phaser.Scene} The added Scene, if it was added immediately, otherwise `null`. + */ + add: function (key, sceneConfig, autoStart, data) { - return; - } + if (autoStart === undefined) { autoStart = false; } + if (data === undefined) { data = {}; } - var key = GetValue(config, 'image', ''); + // If processing or not booted then put scene into a holding pattern + if (this.isProcessing || !this.isBooted) + { + this._pending.push({ + key: key, + scene: sceneConfig, + autoStart: autoStart, + data: data + }); - var frame = scene.sys.textures.getFrame(key); - var textureX = frame.cutX; - var textureY = frame.cutY; - var textureWidth = frame.source.width; - var textureHeight = frame.source.height; + if (!this.isBooted) + { + this._data[key] = { data: data }; + } - var offsetX = GetValue(config, 'offset.x', 0); - var offsetY = GetValue(config, 'offset.y', 0); - var spacingX = GetValue(config, 'spacing.x', 0); - var spacingY = GetValue(config, 'spacing.y', 0); - var lineSpacing = GetValue(config, 'lineSpacing', 0); + return null; + } - var charsPerRow = GetValue(config, 'charsPerRow', null); + key = this.getKey(key, sceneConfig); - if (charsPerRow === null) - { - charsPerRow = textureWidth / w; + var newScene; - if (charsPerRow > letters.length) + if (sceneConfig instanceof Scene) { - charsPerRow = letters.length; + newScene = this.createSceneFromInstance(key, sceneConfig); } - } + else if (typeof sceneConfig === 'object') + { + sceneConfig.key = key; - var x = offsetX; - var y = offsetY; + newScene = this.createSceneFromObject(key, sceneConfig); + } + else if (typeof sceneConfig === 'function') + { + newScene = this.createSceneFromFunction(key, sceneConfig); + } - var data = { - retroFont: true, - font: key, - size: w, - lineHeight: h + lineSpacing, - chars: {} - }; + // Any data to inject? + newScene.sys.settings.data = data; - var r = 0; + // Replace key in case the scene changed it + key = newScene.sys.settings.key; - for (var i = 0; i < letters.length; i++) - { - var charCode = letters.charCodeAt(i); + this.keys[key] = newScene; - var u0 = (textureX + x) / textureWidth; - var v0 = (textureY + y) / textureHeight; - var u1 = (textureX + x + w) / textureWidth; - var v1 = (textureY + y + h) / textureHeight; + this.scenes.push(newScene); - data.chars[charCode] = + if (autoStart || newScene.sys.settings.active) { - x: x, - y: y, - width: w, - height: h, - centerX: cx, - centerY: cy, - xOffset: 0, - yOffset: 0, - xAdvance: w, - data: {}, - kerning: {}, - u0: u0, - v0: v0, - u1: u1, - v1: v1 - }; + if (this._pending.length) + { + this._start.push(key); + } + else + { + this.start(key); + } + } - r++; + return newScene; + }, - if (r === charsPerRow) + /** + * Removes a Scene from the SceneManager. + * + * The Scene is removed from the local scenes array, it's key is cleared from the keys + * cache and Scene.Systems.destroy is then called on it. + * + * If the SceneManager is processing the Scenes when this method is called it will + * queue the operation for the next update sequence. + * + * @method Phaser.Scenes.SceneManager#remove + * @since 3.2.0 + * + * @param {string} key - A unique key used to reference the Scene, i.e. `MainMenu` or `Level1`. + * + * @return {this} This Scene Manager instance. + */ + remove: function (key) + { + if (this.isProcessing) { - r = 0; - x = offsetX; - y += h + spacingY; + this._queue.push({ op: 'remove', keyA: key, keyB: null }); } else { - x += w + spacingX; - } - } + var sceneToRemove = this.getScene(key); - var entry = { - data: data, - frame: null, - texture: key - }; + if (!sceneToRemove || sceneToRemove.sys.isTransitioning()) + { + return this; + } - return entry; -}; + var index = this.scenes.indexOf(sceneToRemove); + var sceneKey = sceneToRemove.sys.settings.key; -module.exports = ParseRetroFont; + if (index > -1) + { + delete this.keys[sceneKey]; + this.scenes.splice(index, 1); + if (this._start.indexOf(sceneKey) > -1) + { + index = this._start.indexOf(sceneKey); + this._start.splice(index, 1); + } -/***/ }), -/* 1085 */ -/***/ (function(module, exports, __webpack_require__) { + sceneToRemove.sys.destroy(); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + /** + * Boot the given Scene. + * + * @method Phaser.Scenes.SceneManager#bootScene + * @private + * @fires Phaser.Scenes.Events#TRANSITION_INIT + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to boot. + */ + bootScene: function (scene) + { + var sys = scene.sys; + var settings = sys.settings; -if (true) -{ - renderWebGL = __webpack_require__(1086); -} + sys.sceneUpdate = NOOP; -if (true) -{ - renderCanvas = __webpack_require__(1087); -} + if (scene.init) + { + scene.init.call(scene, settings.data); -module.exports = { + settings.status = CONST.INIT; - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + if (settings.isTransition) + { + sys.events.emit(Events.TRANSITION_INIT, settings.transitionFrom, settings.transitionDuration); + } + } -}; + var loader; + if (sys.load) + { + loader = sys.load; -/***/ }), -/* 1086 */ -/***/ (function(module, exports, __webpack_require__) { + loader.reset(); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (loader && scene.preload) + { + scene.preload.call(scene); -var GetCalcMatrix = __webpack_require__(19); -var Utils = __webpack_require__(12); + settings.status = CONST.LOADING; -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Rope#renderWebGL - * @since 3.23.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Rope} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var RopeWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + // Start the loader going as we have something in the queue + loader.once(LoaderEvents.COMPLETE, this.loadComplete, this); - var pipeline = renderer.pipelines.set(src.pipeline, src); + loader.start(); + } + else + { + // No preload? Then there was nothing to load either + this.create(scene); + } + }, - var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + /** + * Handles load completion for a Scene's Loader. + * + * Starts the Scene that the Loader belongs to. + * + * @method Phaser.Scenes.SceneManager#loadComplete + * @private + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - The loader that has completed loading. + */ + loadComplete: function (loader) + { + // TODO - Remove. This should *not* be handled here + // Try to unlock HTML5 sounds every time any loader completes + if (this.game.sound && this.game.sound.onBlurPausedSounds) + { + this.game.sound.unlock(); + } - var vertices = src.vertices; - var uvs = src.uv; - var colors = src.colors; - var alphas = src.alphas; - var alpha = src.alpha; - var getTint = Utils.getTintAppendFloatAlpha; - var roundPixels = camera.roundPixels; + this.create(loader.scene); + }, - var meshVerticesLength = vertices.length; - var vertexCount = Math.floor(meshVerticesLength * 0.5); + /** + * Handle payload completion for a Scene. + * + * @method Phaser.Scenes.SceneManager#payloadComplete + * @private + * @since 3.0.0 + * + * @param {Phaser.Loader.LoaderPlugin} loader - The loader that has completed loading its Scene's payload. + */ + payloadComplete: function (loader) + { + this.bootScene(loader.scene); + }, - // Because it's a triangle strip and we don't want lots of degenerate triangles joining things up - pipeline.flush(); + /** + * Updates the Scenes. + * + * @method Phaser.Scenes.SceneManager#update + * @since 3.0.0 + * + * @param {number} time - Time elapsed. + * @param {number} delta - Delta time from the last update. + */ + update: function (time, delta) + { + this.processQueue(); - renderer.pipelines.preBatch(src); + this.isProcessing = true; - var textureUnit = pipeline.setGameObject(src); + // Loop through the active scenes in reverse order + for (var i = this.scenes.length - 1; i >= 0; i--) + { + var sys = this.scenes[i].sys; - var vertexViewF32 = pipeline.vertexViewF32; - var vertexViewU32 = pipeline.vertexViewU32; + if (sys.settings.status > CONST.START && sys.settings.status <= CONST.RUNNING) + { + sys.step(time, delta); + } - var vertexOffset = (pipeline.vertexCount * pipeline.currentShader.vertexComponentCount) - 1; + if (sys.scenePlugin._target) + { + sys.scenePlugin.step(time, delta); + } + } + }, - var colorIndex = 0; + /** + * Renders the Scenes. + * + * @method Phaser.Scenes.SceneManager#render + * @since 3.0.0 + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer to use. + */ + render: function (renderer) + { + // Loop through the scenes in forward order + for (var i = 0; i < this.scenes.length; i++) + { + var sys = this.scenes[i].sys; - var tintEffect = src.tintFill; + if (sys.settings.visible && sys.settings.status >= CONST.LOADING && sys.settings.status < CONST.SLEEPING) + { + sys.render(renderer); + } + } - if (src.dirty) + this.isProcessing = false; + }, + + /** + * Calls the given Scene's {@link Phaser.Scene#create} method and updates its status. + * + * @method Phaser.Scenes.SceneManager#create + * @private + * @fires Phaser.Scenes.Events#CREATE + * @fires Phaser.Scenes.Events#TRANSITION_INIT + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene to create. + */ + create: function (scene) { - src.updateVertices(); - } + var sys = scene.sys; + var settings = sys.settings; - var debugCallback = src.debugCallback; - var debugVerts = []; + if (scene.create) + { + settings.status = CONST.CREATING; - for (var i = 0; i < meshVerticesLength; i += 2) - { - var x = vertices[i + 0]; - var y = vertices[i + 1]; + scene.create.call(scene, settings.data); - var tx = x * calcMatrix.a + y * calcMatrix.c + calcMatrix.e; - var ty = x * calcMatrix.b + y * calcMatrix.d + calcMatrix.f; + if (settings.status === CONST.DESTROYED) + { + return; + } + } - if (roundPixels) + if (settings.isTransition) { - tx = Math.round(tx); - ty = Math.round(ty); + sys.events.emit(Events.TRANSITION_START, settings.transitionFrom, settings.transitionDuration); } - vertexViewF32[++vertexOffset] = tx; - vertexViewF32[++vertexOffset] = ty; - vertexViewF32[++vertexOffset] = uvs[i + 0]; - vertexViewF32[++vertexOffset] = uvs[i + 1]; - vertexViewF32[++vertexOffset] = textureUnit; - vertexViewF32[++vertexOffset] = tintEffect; - vertexViewU32[++vertexOffset] = getTint(colors[colorIndex], camera.alpha * (alphas[colorIndex] * alpha)); - - colorIndex++; - - if (debugCallback) + // If the Scene has an update function we'll set it now, otherwise it'll remain as NOOP + if (scene.update) { - debugVerts[i + 0] = tx; - debugVerts[i + 1] = ty; + sys.sceneUpdate = scene.update; } - } - if (debugCallback) + settings.status = CONST.RUNNING; + + sys.events.emit(Events.CREATE, scene); + }, + + /** + * Creates and initializes a Scene from a function. + * + * @method Phaser.Scenes.SceneManager#createSceneFromFunction + * @private + * @since 3.0.0 + * + * @param {string} key - The key of the Scene. + * @param {function} scene - The function to create the Scene from. + * + * @return {Phaser.Scene} The created Scene. + */ + createSceneFromFunction: function (key, scene) { - debugCallback.call(src, src, meshVerticesLength, debugVerts); - } + var newScene = new scene(); - pipeline.vertexCount += vertexCount; + if (newScene instanceof Scene) + { + var configKey = newScene.sys.settings.key; - renderer.pipelines.postBatch(src); -}; + if (configKey !== '') + { + key = configKey; + } -module.exports = RopeWebGLRenderer; + if (this.keys.hasOwnProperty(key)) + { + throw new Error('Cannot add a Scene with duplicate key: ' + key); + } + return this.createSceneFromInstance(key, newScene); + } + else + { + newScene.sys = new Systems(newScene); -/***/ }), -/* 1087 */ -/***/ (function(module, exports) { + newScene.sys.settings.key = key; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + newScene.sys.init(this.game); -/** - * This is a stub function for Rope.Render. There is no Canvas renderer for Rope objects. - * - * @method Phaser.GameObjects.Rope#renderCanvas - * @since 3.23.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Rope} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var RopeCanvasRenderer = function () -{ -}; + return newScene; + } + }, + + /** + * Creates and initializes a Scene instance. + * + * @method Phaser.Scenes.SceneManager#createSceneFromInstance + * @private + * @since 3.0.0 + * + * @param {string} key - The key of the Scene. + * @param {Phaser.Scene} newScene - The Scene instance. + * + * @return {Phaser.Scene} The created Scene. + */ + createSceneFromInstance: function (key, newScene) + { + var configKey = newScene.sys.settings.key; + + if (configKey === '') + { + newScene.sys.settings.key = key; + } -module.exports = RopeCanvasRenderer; + newScene.sys.init(this.game); + return newScene; + }, -/***/ }), -/* 1088 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Creates and initializes a Scene from an Object definition. + * + * @method Phaser.Scenes.SceneManager#createSceneFromObject + * @private + * @since 3.0.0 + * + * @param {string} key - The key of the Scene. + * @param {(string|Phaser.Types.Scenes.SettingsConfig|Phaser.Types.Scenes.CreateSceneFromObjectConfig)} sceneConfig - The Scene config. + * + * @return {Phaser.Scene} The created Scene. + */ + createSceneFromObject: function (key, sceneConfig) + { + var newScene = new Scene(sceneConfig); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var configKey = newScene.sys.settings.key; -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + if (configKey !== '') + { + key = configKey; + } + else + { + newScene.sys.settings.key = key; + } -if (true) -{ - renderWebGL = __webpack_require__(1089); -} + newScene.sys.init(this.game); -if (true) -{ - renderCanvas = __webpack_require__(1090); -} + // Extract callbacks -module.exports = { + var defaults = [ 'init', 'preload', 'create', 'update', 'render' ]; - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + for (var i = 0; i < defaults.length; i++) + { + var sceneCallback = GetValue(sceneConfig, defaults[i], null); -}; + if (sceneCallback) + { + newScene[defaults[i]] = sceneCallback; + } + } + // Now let's move across any other functions or properties that may exist in the extend object: -/***/ }), -/* 1089 */ -/***/ (function(module, exports, __webpack_require__) { + /* + scene: { + preload: preload, + create: create, + extend: { + hello: 1, + test: 'atari', + addImage: addImage + } + } + */ -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (sceneConfig.hasOwnProperty('extend')) + { + for (var propertyKey in sceneConfig.extend) + { + if (!sceneConfig.extend.hasOwnProperty(propertyKey)) + { + continue; + } -var Utils = __webpack_require__(12); + var value = sceneConfig.extend[propertyKey]; -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Text#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Text} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var TextWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - if (src.width === 0 || src.height === 0) - { - return; - } + if (propertyKey === 'data' && newScene.hasOwnProperty('data') && typeof value === 'object') + { + // Populate the DataManager + newScene.data.merge(value); + } + else if (propertyKey !== 'sys') + { + newScene[propertyKey] = value; + } + } + } - camera.addToRenderList(src); + return newScene; + }, - var frame = src.frame; - var width = frame.width; - var height = frame.height; - var getTint = Utils.getTintAppendFloatAlpha; - var pipeline = renderer.pipelines.set(src.pipeline, src); + /** + * Retrieves the key of a Scene from a Scene config. + * + * @method Phaser.Scenes.SceneManager#getKey + * @private + * @since 3.0.0 + * + * @param {string} key - The key to check in the Scene config. + * @param {(Phaser.Scene|Phaser.Types.Scenes.SettingsConfig|function)} sceneConfig - The Scene config. + * + * @return {string} The Scene key. + */ + getKey: function (key, sceneConfig) + { + if (!key) { key = 'default'; } - var textureUnit = pipeline.setTexture2D(frame.glTexture, src); + if (typeof sceneConfig === 'function') + { + return key; + } + else if (sceneConfig instanceof Scene) + { + key = sceneConfig.sys.settings.key; + } + else if (typeof sceneConfig === 'object' && sceneConfig.hasOwnProperty('key')) + { + key = sceneConfig.key; + } - renderer.pipelines.preBatch(src); + // By this point it's either 'default' or extracted from the Scene - pipeline.batchTexture( - src, - frame.glTexture, - width, height, - src.x, src.y, - width / src.style.resolution, height / src.style.resolution, - src.scaleX, src.scaleY, - src.rotation, - src.flipX, src.flipY, - src.scrollFactorX, src.scrollFactorY, - src.displayOriginX, src.displayOriginY, - 0, 0, width, height, - getTint(src.tintTopLeft, camera.alpha * src._alphaTL), - getTint(src.tintTopRight, camera.alpha * src._alphaTR), - getTint(src.tintBottomLeft, camera.alpha * src._alphaBL), - getTint(src.tintBottomRight, camera.alpha * src._alphaBR), - src.tintFill, - 0, 0, - camera, - parentMatrix, - false, - textureUnit - ); + if (this.keys.hasOwnProperty(key)) + { + throw new Error('Cannot add a Scene with duplicate key: ' + key); + } + else + { + return key; + } + }, - renderer.pipelines.postBatch(src); -}; + /** + * Returns an array of all the current Scenes being managed by this Scene Manager. + * + * You can filter the output by the active state of the Scene and choose to have + * the array returned in normal or reversed order. + * + * @method Phaser.Scenes.SceneManager#getScenes + * @since 3.16.0 + * + * @generic {Phaser.Scene[]} T - [$return] + * + * @param {boolean} [isActive=true] - Only include Scene's that are currently active? + * @param {boolean} [inReverse=false] - Return the array of Scenes in reverse? + * + * @return {Phaser.Scene[]} An array containing all of the Scenes in the Scene Manager. + */ + getScenes: function (isActive, inReverse) + { + if (isActive === undefined) { isActive = true; } + if (inReverse === undefined) { inReverse = false; } -module.exports = TextWebGLRenderer; + var out = []; + var scenes = this.scenes; + for (var i = 0; i < scenes.length; i++) + { + var scene = scenes[i]; -/***/ }), -/* 1090 */ -/***/ (function(module, exports) { + if (scene && (!isActive || (isActive && scene.sys.isActive()))) + { + out.push(scene); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return (inReverse) ? out.reverse() : out; + }, -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Text#renderCanvas - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Text} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var TextCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - if (src.width === 0 || src.height === 0) + /** + * Retrieves a Scene based on the given key. + * + * If an actual Scene is passed to this method, it can be used to check if + * its currently within the Scene Manager, or not. + * + * @method Phaser.Scenes.SceneManager#getScene + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * @genericUse {T} - [$return] + * + * @param {(string|Phaser.Scene)} key - The key of the Scene to retrieve. + * + * @return {?Phaser.Scene} The Scene, or `null` if no matching Scene was found. + */ + getScene: function (key) { - return; - } + if (typeof key === 'string') + { + if (this.keys[key]) + { + return this.keys[key]; + } + } + else + { + for (var i = 0; i < this.scenes.length; i++) + { + if (key === this.scenes[i]) + { + return key; + } + } + } - camera.addToRenderList(src); + return null; + }, - renderer.batchSprite(src, src.frame, camera, parentMatrix); -}; + /** + * Determines whether a Scene is running. + * + * @method Phaser.Scenes.SceneManager#isActive + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to check. + * + * @return {boolean} Whether the Scene is running, or `null` if no matching Scene was found. + */ + isActive: function (key) + { + var scene = this.getScene(key); -module.exports = TextCanvasRenderer; + if (scene) + { + return scene.sys.isActive(); + } + return null; + }, -/***/ }), -/* 1091 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Determines whether a Scene is paused. + * + * @method Phaser.Scenes.SceneManager#isPaused + * @since 3.17.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to check. + * + * @return {boolean} Whether the Scene is paused, or `null` if no matching Scene was found. + */ + isPaused: function (key) + { + var scene = this.getScene(key); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (scene) + { + return scene.sys.isPaused(); + } -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + return null; + }, -if (true) -{ - renderWebGL = __webpack_require__(1092); -} + /** + * Determines whether a Scene is visible. + * + * @method Phaser.Scenes.SceneManager#isVisible + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to check. + * + * @return {boolean} Whether the Scene is visible, or `null` if no matching Scene was found. + */ + isVisible: function (key) + { + var scene = this.getScene(key); -if (true) -{ - renderCanvas = __webpack_require__(1093); -} + if (scene) + { + return scene.sys.isVisible(); + } -module.exports = { + return null; + }, - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + /** + * Determines whether a Scene is sleeping. + * + * @method Phaser.Scenes.SceneManager#isSleeping + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to check. + * + * @return {boolean} Whether the Scene is sleeping, or `null` if no matching Scene was found. + */ + isSleeping: function (key) + { + var scene = this.getScene(key); -}; + if (scene) + { + return scene.sys.isSleeping(); + } + return null; + }, -/***/ }), -/* 1092 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Pauses the given Scene. + * + * @method Phaser.Scenes.SceneManager#pause + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to pause. + * @param {object} [data] - An optional data object that will be passed to the Scene and emitted by its pause event. + * + * @return {this} This Scene Manager instance. + */ + pause: function (key, data) + { + var scene = this.getScene(key); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (scene) + { + scene.sys.pause(data); + } -var Utils = __webpack_require__(12); + return this; + }, -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.TileSprite#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.TileSprite} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var TileSpriteWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - src.updateCanvas(); + /** + * Resumes the given Scene. + * + * @method Phaser.Scenes.SceneManager#resume + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to resume. + * @param {object} [data] - An optional data object that will be passed to the Scene and emitted by its resume event. + * + * @return {this} This Scene Manager instance. + */ + resume: function (key, data) + { + var scene = this.getScene(key); - var width = src.width; - var height = src.height; + if (scene) + { + scene.sys.resume(data); + } - if (width === 0 || height === 0) + return this; + }, + + /** + * Puts the given Scene to sleep. + * + * @method Phaser.Scenes.SceneManager#sleep + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to put to sleep. + * @param {object} [data] - An optional data object that will be passed to the Scene and emitted by its sleep event. + * + * @return {this} This Scene Manager instance. + */ + sleep: function (key, data) { - return; - } + var scene = this.getScene(key); - camera.addToRenderList(src); + if (scene && !scene.sys.isTransitioning()) + { + scene.sys.sleep(data); + } - renderer.pipelines.preBatch(src); + return this; + }, - var getTint = Utils.getTintAppendFloatAlpha; + /** + * Awakens the given Scene. + * + * @method Phaser.Scenes.SceneManager#wake + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to wake up. + * @param {object} [data] - An optional data object that will be passed to the Scene and emitted by its wake event. + * + * @return {this} This Scene Manager instance. + */ + wake: function (key, data) + { + var scene = this.getScene(key); - var pipeline = renderer.pipelines.set(src.pipeline, src); + if (scene) + { + scene.sys.wake(data); + } - var textureUnit = pipeline.setTexture2D(src.fillPattern, src); + return this; + }, - pipeline.batchTexture( - src, - src.fillPattern, - src.displayFrame.width * src.tileScaleX, src.displayFrame.height * src.tileScaleY, - src.x, src.y, - width, height, - src.scaleX, src.scaleY, - src.rotation, - src.flipX, src.flipY, - src.scrollFactorX, src.scrollFactorY, - src.originX * width, src.originY * height, - 0, 0, width, height, - getTint(src.tintTopLeft, camera.alpha * src._alphaTL), - getTint(src.tintTopRight, camera.alpha * src._alphaTR), - getTint(src.tintBottomLeft, camera.alpha * src._alphaBL), - getTint(src.tintBottomRight, camera.alpha * src._alphaBR), - src.tintFill, - (src.tilePositionX % src.displayFrame.width) / src.displayFrame.width, - (src.tilePositionY % src.displayFrame.height) / src.displayFrame.height, - camera, - parentMatrix, - false, - textureUnit - ); + /** + * Runs the given Scene. + * + * If the given Scene is paused, it will resume it. If sleeping, it will wake it. + * If not running at all, it will be started. + * + * Use this if you wish to open a modal Scene by calling `pause` on the current + * Scene, then `run` on the modal Scene. + * + * @method Phaser.Scenes.SceneManager#run + * @since 3.10.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to run. + * @param {object} [data] - A data object that will be passed to the Scene on start, wake, or resume. + * + * @return {this} This Scene Manager instance. + */ + run: function (key, data) + { + var scene = this.getScene(key); - renderer.pipelines.postBatch(src); -}; + if (!scene) + { + for (var i = 0; i < this._pending.length; i++) + { + if (this._pending[i].key === key) + { + this.queueOp('start', key, data); + break; + } + } + return this; + } -module.exports = TileSpriteWebGLRenderer; + if (scene.sys.isSleeping()) + { + // Sleeping? + scene.sys.wake(data); + } + else if (scene.sys.isPaused()) + { + // Paused? + scene.sys.resume(data); + } + else + { + // Not actually running? + this.start(key, data); + } + }, + /** + * Starts the given Scene, if it is not starting, loading, or creating. + * + * If the Scene is running, paused, or sleeping, it will be shutdown and then started. + * + * @method Phaser.Scenes.SceneManager#start + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to start. + * @param {object} [data] - Optional data object to pass to `Scene.Settings` and `Scene.init`, and `Scene.create`. + * + * @return {this} This Scene Manager instance. + */ + start: function (key, data) + { + // If the Scene Manager is not running, then put the Scene into a holding pattern + if (!this.isBooted) + { + this._data[key] = { + autoStart: true, + data: data + }; -/***/ }), -/* 1093 */ -/***/ (function(module, exports) { + return this; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var scene = this.getScene(key); -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.TileSprite#renderCanvas - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.TileSprite} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var TileSpriteCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - src.updateCanvas(); + if (!scene) + { + console.warn('Scene not found for key: ' + key); + return this; + } - camera.addToRenderList(src); + var sys = scene.sys; + var status = sys.settings.status; - renderer.batchSprite(src, src.frame, camera, parentMatrix); -}; + // If the scene is already started but not yet running, + // let it continue. + if (status >= CONST.START && status <= CONST.CREATING) + { + return this; + } -module.exports = TileSpriteCanvasRenderer; + // If the Scene is already running, paused, or sleeping, + // close it down before starting it again. + else if (status >= CONST.RUNNING && status <= CONST.SLEEPING) + { + sys.shutdown(); + sys.sceneUpdate = NOOP; -/***/ }), -/* 1094 */ -/***/ (function(module, exports, __webpack_require__) { + sys.start(data); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // If the Scene is INIT or SHUTDOWN, + // start it directly. + else + { + sys.sceneUpdate = NOOP; -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + sys.start(data); -if (true) -{ - renderWebGL = __webpack_require__(1095); -} + var loader; -if (true) -{ - renderCanvas = __webpack_require__(1096); -} + if (sys.load) + { + loader = sys.load; + } -module.exports = { + // Files payload? + if (loader && sys.settings.hasOwnProperty('pack')) + { + loader.reset(); - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + if (loader.addPack({ payload: sys.settings.pack })) + { + sys.settings.status = CONST.LOADING; -}; + loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this); + loader.start(); -/***/ }), -/* 1095 */ -/***/ (function(module, exports) { + return this; + } + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.bootScene(scene); -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Video#renderWebGL - * @since 3.20.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Video} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var VideoWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - if (src.videoTexture) - { - camera.addToRenderList(src); + return this; + }, - src.pipeline.batchSprite(src, camera, parentMatrix); - } -}; + /** + * Stops the given Scene. + * + * @method Phaser.Scenes.SceneManager#stop + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to stop. + * @param {object} [data] - Optional data object to pass to Scene.shutdown. + * + * @return {this} This Scene Manager instance. + */ + stop: function (key, data) + { + var scene = this.getScene(key); -module.exports = VideoWebGLRenderer; + if (scene && !scene.sys.isTransitioning() && scene.sys.settings.status !== CONST.SHUTDOWN) + { + var loader = scene.sys.load; + if (loader) + { + loader.off(LoaderEvents.COMPLETE, this.loadComplete, this); + loader.off(LoaderEvents.COMPLETE, this.payloadComplete, this); + } -/***/ }), -/* 1096 */ -/***/ (function(module, exports) { + scene.sys.shutdown(data); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Video#renderCanvas - * @since 3.20.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Video} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var VideoCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - if (src.videoTexture) + /** + * Sleeps one one Scene and starts the other. + * + * @method Phaser.Scenes.SceneManager#switch + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [from,to] + * + * @param {(string|Phaser.Scene)} from - The Scene to sleep. + * @param {(string|Phaser.Scene)} to - The Scene to start. + * + * @return {this} This Scene Manager instance. + */ + switch: function (from, to) { - camera.addToRenderList(src); + var sceneA = this.getScene(from); + var sceneB = this.getScene(to); - renderer.batchSprite(src, src.frame, camera, parentMatrix); - } -}; + if (sceneA && sceneB && sceneA !== sceneB) + { + this.sleep(from); -module.exports = VideoCanvasRenderer; + if (this.isSleeping(to)) + { + this.wake(to); + } + else + { + this.start(to); + } + } + return this; + }, -/***/ }), -/* 1097 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Retrieves a Scene by numeric index. + * + * @method Phaser.Scenes.SceneManager#getAt + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {T} - [$return] + * + * @param {number} index - The index of the Scene to retrieve. + * + * @return {(Phaser.Scene|undefined)} The Scene. + */ + getAt: function (index) + { + return this.scenes[index]; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Retrieves the numeric index of a Scene. + * + * @method Phaser.Scenes.SceneManager#getIndex + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The key of the Scene. + * + * @return {number} The index of the Scene. + */ + getIndex: function (key) + { + var scene = this.getScene(key); -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + return this.scenes.indexOf(scene); + }, -if (true) -{ - renderWebGL = __webpack_require__(1098); -} + /** + * Brings a Scene to the top of the Scenes list. + * + * This means it will render above all other Scenes. + * + * @method Phaser.Scenes.SceneManager#bringToTop + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to move. + * + * @return {this} This Scene Manager instance. + */ + bringToTop: function (key) + { + if (this.isProcessing) + { + this._queue.push({ op: 'bringToTop', keyA: key, keyB: null }); + } + else + { + var index = this.getIndex(key); -if (true) -{ - renderCanvas = __webpack_require__(1099); -} + if (index !== -1 && index < this.scenes.length) + { + var scene = this.getScene(key); -module.exports = { + this.scenes.splice(index, 1); + this.scenes.push(scene); + } + } - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + return this; + }, -}; + /** + * Sends a Scene to the back of the Scenes list. + * + * This means it will render below all other Scenes. + * + * @method Phaser.Scenes.SceneManager#sendToBack + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to move. + * + * @return {this} This Scene Manager instance. + */ + sendToBack: function (key) + { + if (this.isProcessing) + { + this._queue.push({ op: 'sendToBack', keyA: key, keyB: null }); + } + else + { + var index = this.getIndex(key); + if (index !== -1 && index > 0) + { + var scene = this.getScene(key); -/***/ }), -/* 1098 */ -/***/ (function(module, exports, __webpack_require__) { + this.scenes.splice(index, 1); + this.scenes.unshift(scene); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -var GetCalcMatrix = __webpack_require__(19); -var FillPathWebGL = __webpack_require__(114); -var StrokePathWebGL = __webpack_require__(81); + /** + * Moves a Scene down one position in the Scenes list. + * + * @method Phaser.Scenes.SceneManager#moveDown + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to move. + * + * @return {this} This Scene Manager instance. + */ + moveDown: function (key) + { + if (this.isProcessing) + { + this._queue.push({ op: 'moveDown', keyA: key, keyB: null }); + } + else + { + var indexA = this.getIndex(key); -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Arc#renderWebGL - * @since 3.13.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Arc} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var ArcWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + if (indexA > 0) + { + var indexB = indexA - 1; + var sceneA = this.getScene(key); + var sceneB = this.getAt(indexB); - var pipeline = renderer.pipelines.set(src.pipeline); + this.scenes[indexA] = sceneB; + this.scenes[indexB] = sceneA; + } + } - var result = GetCalcMatrix(src, camera, parentMatrix); + return this; + }, - var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); + /** + * Moves a Scene up one position in the Scenes list. + * + * @method Phaser.Scenes.SceneManager#moveUp + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to move. + * + * @return {this} This Scene Manager instance. + */ + moveUp: function (key) + { + if (this.isProcessing) + { + this._queue.push({ op: 'moveUp', keyA: key, keyB: null }); + } + else + { + var indexA = this.getIndex(key); - var dx = src._displayOriginX; - var dy = src._displayOriginY; + if (indexA < this.scenes.length - 1) + { + var indexB = indexA + 1; + var sceneA = this.getScene(key); + var sceneB = this.getAt(indexB); - var alpha = camera.alpha * src.alpha; + this.scenes[indexA] = sceneB; + this.scenes[indexB] = sceneA; + } + } - renderer.pipelines.preBatch(src); + return this; + }, - if (src.isFilled) + /** + * Moves a Scene so it is immediately above another Scene in the Scenes list. + * + * This means it will render over the top of the other Scene. + * + * @method Phaser.Scenes.SceneManager#moveAbove + * @since 3.2.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [keyA,keyB] + * + * @param {(string|Phaser.Scene)} keyA - The Scene that Scene B will be moved above. + * @param {(string|Phaser.Scene)} keyB - The Scene to be moved. + * + * @return {this} This Scene Manager instance. + */ + moveAbove: function (keyA, keyB) { - FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); - } + if (keyA === keyB) + { + return this; + } - if (src.isStroked) - { - StrokePathWebGL(pipeline, src, alpha, dx, dy); - } + if (this.isProcessing) + { + this._queue.push({ op: 'moveAbove', keyA: keyA, keyB: keyB }); + } + else + { + var indexA = this.getIndex(keyA); + var indexB = this.getIndex(keyB); - renderer.pipelines.postBatch(src); -}; + if (indexA !== -1 && indexB !== -1 && indexB < indexA) + { + var tempScene = this.getAt(indexB); -module.exports = ArcWebGLRenderer; + // Remove + this.scenes.splice(indexB, 1); + // Add in new location + this.scenes.splice(indexA + (indexB > indexA), 0, tempScene); + } + } -/***/ }), -/* 1099 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, + + /** + * Moves a Scene so it is immediately below another Scene in the Scenes list. + * + * This means it will render behind the other Scene. + * + * @method Phaser.Scenes.SceneManager#moveBelow + * @since 3.2.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [keyA,keyB] + * + * @param {(string|Phaser.Scene)} keyA - The Scene that Scene B will be moved below. + * @param {(string|Phaser.Scene)} keyB - The Scene to be moved. + * + * @return {this} This Scene Manager instance. + */ + moveBelow: function (keyA, keyB) + { + if (keyA === keyB) + { + return this; + } + + if (this.isProcessing) + { + this._queue.push({ op: 'moveBelow', keyA: keyA, keyB: keyB }); + } + else + { + var indexA = this.getIndex(keyA); + var indexB = this.getIndex(keyB); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (indexA !== -1 && indexB !== -1 && indexB > indexA) + { + var tempScene = this.getAt(indexB); -var DegToRad = __webpack_require__(36); -var FillStyleCanvas = __webpack_require__(48); -var LineStyleCanvas = __webpack_require__(60); -var SetTransform = __webpack_require__(30); + // Remove + this.scenes.splice(indexB, 1); -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Arc#renderCanvas - * @since 3.13.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Arc} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var ArcCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + if (indexA === 0) + { + this.scenes.unshift(tempScene); + } + else + { + // Add in new location + this.scenes.splice(indexA - (indexB < indexA), 0, tempScene); + } + } + } - var ctx = renderer.currentContext; + return this; + }, - if (SetTransform(renderer, ctx, src, camera, parentMatrix)) + /** + * Queue a Scene operation for the next update. + * + * @method Phaser.Scenes.SceneManager#queueOp + * @private + * @since 3.0.0 + * + * @param {string} op - The operation to perform. + * @param {(string|Phaser.Scene)} keyA - Scene A. + * @param {(any|string|Phaser.Scene)} [keyB] - Scene B, or a data object. + * + * @return {this} This Scene Manager instance. + */ + queueOp: function (op, keyA, keyB) { - var radius = src.radius; - - ctx.beginPath(); + this._queue.push({ op: op, keyA: keyA, keyB: keyB }); - ctx.arc( - (radius) - src.originX * (radius * 2), - (radius) - src.originY * (radius * 2), - radius, - DegToRad(src._startAngle), - DegToRad(src._endAngle), - src.anticlockwise - ); + return this; + }, - if (src.closePath) + /** + * Swaps the positions of two Scenes in the Scenes list. + * + * @method Phaser.Scenes.SceneManager#swapPosition + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [keyA,keyB] + * + * @param {(string|Phaser.Scene)} keyA - The first Scene to swap. + * @param {(string|Phaser.Scene)} keyB - The second Scene to swap. + * + * @return {this} This Scene Manager instance. + */ + swapPosition: function (keyA, keyB) + { + if (keyA === keyB) { - ctx.closePath(); + return this; } - if (src.isFilled) + if (this.isProcessing) { - FillStyleCanvas(ctx, src); + this._queue.push({ op: 'swapPosition', keyA: keyA, keyB: keyB }); + } + else + { + var indexA = this.getIndex(keyA); + var indexB = this.getIndex(keyB); - ctx.fill(); + if (indexA !== indexB && indexA !== -1 && indexB !== -1) + { + var tempScene = this.getAt(indexA); + + this.scenes[indexA] = this.scenes[indexB]; + this.scenes[indexB] = tempScene; + } } - if (src.isStroked) + return this; + }, + + /** + * Dumps debug information about each Scene to the developer console. + * + * @method Phaser.Scenes.SceneManager#dump + * @since 3.2.0 + */ + dump: function () + { + var out = []; + var map = [ 'pending', 'init', 'start', 'loading', 'creating', 'running', 'paused', 'sleeping', 'shutdown', 'destroyed' ]; + + for (var i = 0; i < this.scenes.length; i++) { - LineStyleCanvas(ctx, src); + var sys = this.scenes[i].sys; - ctx.stroke(); - } + var key = (sys.settings.visible && (sys.settings.status === CONST.RUNNING || sys.settings.status === CONST.PAUSED)) ? '[*] ' : '[-] '; + key += sys.settings.key + ' (' + map[sys.settings.status] + ')'; - // Restore the context saved in SetTransform - ctx.restore(); - } -}; + out.push(key); + } -module.exports = ArcCanvasRenderer; + console.log(out.join('\n')); + }, + /** + * Destroy this Scene Manager and all of its systems. + * + * This process cannot be reversed. + * + * This method is called automatically when a Phaser Game instance is destroyed. + * + * @method Phaser.Scenes.SceneManager#destroy + * @since 3.0.0 + */ + destroy: function () + { + for (var i = 0; i < this.scenes.length; i++) + { + var sys = this.scenes[i].sys; -/***/ }), -/* 1100 */ -/***/ (function(module, exports, __webpack_require__) { + sys.destroy(); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.systemScene.sys.destroy(); -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + this.update = NOOP; -if (true) -{ - renderWebGL = __webpack_require__(1101); -} + this.scenes = []; -if (true) -{ - renderCanvas = __webpack_require__(1102); -} + this._pending = []; + this._start = []; + this._queue = []; -module.exports = { + this.game = null; + this.systemScene = null; + } - renderWebGL: renderWebGL, - renderCanvas: renderCanvas +}); -}; +module.exports = SceneManager; /***/ }), -/* 1101 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 64051: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(114); -var GetCalcMatrix = __webpack_require__(19); -var StrokePathWebGL = __webpack_require__(81); +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(7599); +var GetFastValue = __webpack_require__(72632); +var PluginCache = __webpack_require__(91963); /** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * @classdesc + * The Scene Plugin is the main interface to the Scene Manager and allows you to control + * any Scene running in your game. You should always use this plugin. By default, it is + * mapped to the Scene property `this.scene`. Meaning, from within a Scene, you can call + * methods such as `this.scene.start()`. * - * @method Phaser.GameObjects.Curve#renderWebGL - * @since 3.13.0 - * @private + * Note that nearly all methods in this class are run on a queue-basis and not + * immediately. For example, calling `this.scene.launch('SceneB')` will try to + * launch SceneB when the Scene Manager next updates, which is at the start of the game + * step. All operations are queued and run in the order in which they are invoked here. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Curve} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @class ScenePlugin + * @memberof Phaser.Scenes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene that this ScenePlugin belongs to. */ -var CurveWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); +var ScenePlugin = new Class({ - var pipeline = renderer.pipelines.set(src.pipeline); + initialize: - var result = GetCalcMatrix(src, camera, parentMatrix); + function ScenePlugin (scene) + { + /** + * The Scene that this ScenePlugin belongs to. + * + * @name Phaser.Scenes.ScenePlugin#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; - var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); + /** + * The Scene Systems instance of the Scene that this ScenePlugin belongs to. + * + * @name Phaser.Scenes.ScenePlugin#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; - var dx = src._displayOriginX + src._curveBounds.x; - var dy = src._displayOriginY + src._curveBounds.y; + /** + * The settings of the Scene this ScenePlugin belongs to. + * + * @name Phaser.Scenes.ScenePlugin#settings + * @type {Phaser.Types.Scenes.SettingsObject} + * @since 3.0.0 + */ + this.settings = scene.sys.settings; - var alpha = camera.alpha * src.alpha; + /** + * The key of the Scene this ScenePlugin belongs to. + * + * @name Phaser.Scenes.ScenePlugin#key + * @type {string} + * @since 3.0.0 + */ + this.key = scene.sys.settings.key; - renderer.pipelines.preBatch(src); + /** + * The Game's SceneManager. + * + * @name Phaser.Scenes.ScenePlugin#manager + * @type {Phaser.Scenes.SceneManager} + * @since 3.0.0 + */ + this.manager = scene.sys.game.scene; - if (src.isFilled) - { - FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); - } + /** + * If this Scene is currently transitioning to another, this holds + * the current percentage of the transition progress, between 0 and 1. + * + * @name Phaser.Scenes.ScenePlugin#transitionProgress + * @type {number} + * @since 3.5.0 + */ + this.transitionProgress = 0; - if (src.isStroked) - { - StrokePathWebGL(pipeline, src, alpha, dx, dy); - } + /** + * Transition elapsed timer. + * + * @name Phaser.Scenes.ScenePlugin#_elapsed + * @type {number} + * @private + * @since 3.5.0 + */ + this._elapsed = 0; - renderer.pipelines.postBatch(src); -}; + /** + * Transition elapsed timer. + * + * @name Phaser.Scenes.ScenePlugin#_target + * @type {?Phaser.Scene} + * @private + * @since 3.5.0 + */ + this._target = null; -module.exports = CurveWebGLRenderer; + /** + * Transition duration. + * + * @name Phaser.Scenes.ScenePlugin#_duration + * @type {number} + * @private + * @since 3.5.0 + */ + this._duration = 0; + /** + * Transition callback. + * + * @name Phaser.Scenes.ScenePlugin#_onUpdate + * @type {function} + * @private + * @since 3.5.0 + */ + this._onUpdate; -/***/ }), -/* 1102 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Transition callback scope. + * + * @name Phaser.Scenes.ScenePlugin#_onUpdateScope + * @type {object} + * @private + * @since 3.5.0 + */ + this._onUpdateScope; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Will this Scene sleep (true) after the transition, or stop (false) + * + * @name Phaser.Scenes.ScenePlugin#_willSleep + * @type {boolean} + * @private + * @since 3.5.0 + */ + this._willSleep = false; -var FillStyleCanvas = __webpack_require__(48); -var LineStyleCanvas = __webpack_require__(60); -var SetTransform = __webpack_require__(30); + /** + * Will this Scene be removed from the Scene Manager after the transition completes? + * + * @name Phaser.Scenes.ScenePlugin#_willRemove + * @type {boolean} + * @private + * @since 3.5.0 + */ + this._willRemove = false; -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Curve#renderCanvas - * @since 3.13.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Curve} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var CurveCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + scene.sys.events.once(Events.BOOT, this.boot, this); + scene.sys.events.on(Events.START, this.pluginStart, this); + }, - var ctx = renderer.currentContext; + /** + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. + * + * @method Phaser.Scenes.ScenePlugin#boot + * @private + * @since 3.0.0 + */ + boot: function () + { + this.systems.events.once(Events.DESTROY, this.destroy, this); + }, - if (SetTransform(renderer, ctx, src, camera, parentMatrix)) + /** + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. + * + * @method Phaser.Scenes.ScenePlugin#pluginStart + * @private + * @since 3.5.0 + */ + pluginStart: function () { - var dx = src._displayOriginX + src._curveBounds.x; - var dy = src._displayOriginY + src._curveBounds.y; + this._target = null; - var path = src.pathData; - var pathLength = path.length - 1; + this.systems.events.once(Events.SHUTDOWN, this.shutdown, this); + }, - var px1 = path[0] - dx; - var py1 = path[1] - dy; + /** + * Shutdown this Scene and run the given one. + * + * This will happen at the next Scene Manager update, not immediately. + * + * @method Phaser.Scenes.ScenePlugin#start + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to start. + * @param {object} [data] - The Scene data. If no value is given it will not overwrite any previous data that may exist. + * + * @return {this} This Scene Plugin instance. + */ + start: function (key, data) + { + if (key === undefined) { key = this.key; } - ctx.beginPath(); + this.manager.queueOp('stop', this.key); + this.manager.queueOp('start', key, data); - ctx.moveTo(px1, py1); + return this; + }, - if (!src.closePath) - { - pathLength -= 2; - } + /** + * Restarts this Scene. + * + * This will happen at the next Scene Manager update, not immediately. + * + * @method Phaser.Scenes.ScenePlugin#restart + * @since 3.4.0 + * + * @param {object} [data] - The Scene data. If no value is given it will not overwrite any previous data that may exist. + * + * @return {this} This Scene Plugin instance. + */ + restart: function (data) + { + var key = this.key; - for (var i = 2; i < pathLength; i += 2) - { - var px2 = path[i] - dx; - var py2 = path[i + 1] - dy; + this.manager.queueOp('stop', key); + this.manager.queueOp('start', key, data); - ctx.lineTo(px2, py2); - } + return this; + }, - if (src.closePath) - { - ctx.closePath(); - } + /** + * This will start a transition from the current Scene to the target Scene given. + * + * The target Scene cannot be the same as the current Scene. + * + * The transition will last for the duration specified in milliseconds. + * + * You can have the target Scene moved above or below this one in the display list. + * + * You can specify an update callback. This callback will be invoked _every frame_ for the duration + * of the transition. + * + * This Scene can either be sent to sleep at the end of the transition, or stopped. The default is to stop. + * + * There are also 5 transition related events: This scene will emit the event `transitionout` when + * the transition begins, which is typically the frame after calling this method. + * + * The target Scene will emit the event `transitioninit` when that Scene's `init` method is called. + * It will then emit the event `transitionstart` when its `create` method is called. + * If the Scene was sleeping and has been woken up, it will emit the event `transitionwake` instead of these two, + * as the Scenes `init` and `create` methods are not invoked when a Scene wakes up. + * + * When the duration of the transition has elapsed it will emit the event `transitioncomplete`. + * These events are cleared of all listeners when the Scene shuts down, but not if it is sent to sleep. + * + * It's important to understand that the duration of the transition begins the moment you call this method. + * If the Scene you are transitioning to includes delayed processes, such as waiting for files to load, the + * time still counts down even while that is happening. If the game itself pauses, or something else causes + * this Scenes update loop to stop, then the transition will also pause for that duration. There are + * checks in place to prevent you accidentally stopping a transitioning Scene but if you've got code to + * override this understand that until the target Scene completes it might never be unlocked for input events. + * + * @method Phaser.Scenes.ScenePlugin#transition + * @fires Phaser.Scenes.Events#TRANSITION_OUT + * @since 3.5.0 + * + * @param {Phaser.Types.Scenes.SceneTransitionConfig} config - The transition configuration object. + * + * @return {boolean} `true` is the transition was started, otherwise `false`. + */ + transition: function (config) + { + if (config === undefined) { config = {}; } - if (src.isFilled) - { - FillStyleCanvas(ctx, src); + var key = GetFastValue(config, 'target', false); - ctx.fill(); - } + var target = this.manager.getScene(key); - if (src.isStroked) + if (!key || !this.checkValidTransition(target)) { - LineStyleCanvas(ctx, src); - - ctx.stroke(); + return false; } - // Restore the context saved in SetTransform - ctx.restore(); - } -}; - -module.exports = CurveCanvasRenderer; - - -/***/ }), -/* 1103 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); - -if (true) -{ - renderWebGL = __webpack_require__(1104); -} - -if (true) -{ - renderCanvas = __webpack_require__(1105); -} + var duration = GetFastValue(config, 'duration', 1000); -module.exports = { + this._elapsed = 0; + this._target = target; + this._duration = duration; + this._willSleep = GetFastValue(config, 'sleep', false); + this._willRemove = GetFastValue(config, 'remove', false); - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + var callback = GetFastValue(config, 'onUpdate', null); -}; + if (callback) + { + this._onUpdate = callback; + this._onUpdateScope = GetFastValue(config, 'onUpdateScope', this.scene); + } + var allowInput = GetFastValue(config, 'allowInput', false); -/***/ }), -/* 1104 */ -/***/ (function(module, exports, __webpack_require__) { + this.settings.transitionAllowInput = allowInput; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var targetSettings = target.sys.settings; -var FillPathWebGL = __webpack_require__(114); -var GetCalcMatrix = __webpack_require__(19); -var StrokePathWebGL = __webpack_require__(81); + targetSettings.isTransition = true; + targetSettings.transitionFrom = this.scene; + targetSettings.transitionDuration = duration; + targetSettings.transitionAllowInput = allowInput; -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Ellipse#renderWebGL - * @since 3.13.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Ellipse} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var EllipseWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + if (GetFastValue(config, 'moveAbove', false)) + { + this.manager.moveAbove(this.key, key); + } + else if (GetFastValue(config, 'moveBelow', false)) + { + this.manager.moveBelow(this.key, key); + } - var pipeline = renderer.pipelines.set(src.pipeline); + if (target.sys.isSleeping()) + { + target.sys.wake(GetFastValue(config, 'data')); + } + else + { + this.manager.start(key, GetFastValue(config, 'data')); + } - var result = GetCalcMatrix(src, camera, parentMatrix); + var onStartCallback = GetFastValue(config, 'onStart', null); - var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); + var onStartScope = GetFastValue(config, 'onStartScope', this.scene); - var dx = src._displayOriginX; - var dy = src._displayOriginY; + if (onStartCallback) + { + onStartCallback.call(onStartScope, this.scene, target, duration); + } - var alpha = camera.alpha * src.alpha; + this.systems.events.emit(Events.TRANSITION_OUT, target, duration); - renderer.pipelines.preBatch(src); + return true; + }, - if (src.isFilled) + /** + * Checks to see if this Scene can transition to the target Scene or not. + * + * @method Phaser.Scenes.ScenePlugin#checkValidTransition + * @private + * @since 3.5.0 + * + * @param {Phaser.Scene} target - The Scene to test against. + * + * @return {boolean} `true` if this Scene can transition, otherwise `false`. + */ + checkValidTransition: function (target) { - FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); - } + // Not a valid target if it doesn't exist, isn't active or is already transitioning in or out + if (!target || target.sys.isActive() || target.sys.isTransitioning() || target === this.scene || this.systems.isTransitioning()) + { + return false; + } - if (src.isStroked) + return true; + }, + + /** + * A single game step. This is only called if the parent Scene is transitioning + * out to another Scene. + * + * @method Phaser.Scenes.ScenePlugin#step + * @private + * @since 3.5.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + step: function (time, delta) { - StrokePathWebGL(pipeline, src, alpha, dx, dy); - } + this._elapsed += delta; - renderer.pipelines.postBatch(src); -}; + this.transitionProgress = Clamp(this._elapsed / this._duration, 0, 1); -module.exports = EllipseWebGLRenderer; + if (this._onUpdate) + { + this._onUpdate.call(this._onUpdateScope, this.transitionProgress); + } + if (this._elapsed >= this._duration) + { + this.transitionComplete(); + } + }, -/***/ }), -/* 1105 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Called by `step` when the transition out of this scene to another is over. + * + * @method Phaser.Scenes.ScenePlugin#transitionComplete + * @private + * @fires Phaser.Scenes.Events#TRANSITION_COMPLETE + * @since 3.5.0 + */ + transitionComplete: function () + { + var targetSys = this._target.sys; + var targetSettings = this._target.sys.settings; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Notify target scene + targetSys.events.emit(Events.TRANSITION_COMPLETE, this.scene); -var FillStyleCanvas = __webpack_require__(48); -var LineStyleCanvas = __webpack_require__(60); -var SetTransform = __webpack_require__(30); + // Clear target scene settings + targetSettings.isTransition = false; + targetSettings.transitionFrom = null; -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Ellipse#renderCanvas - * @since 3.13.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Ellipse} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var EllipseCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + // Clear local settings + this._duration = 0; + this._target = null; + this._onUpdate = null; + this._onUpdateScope = null; - var ctx = renderer.currentContext; + // Now everything is clear we can handle what happens to this Scene + if (this._willRemove) + { + this.manager.remove(this.key); + } + else if (this._willSleep) + { + this.systems.sleep(); + } + else + { + this.manager.stop(this.key); + } + }, - if (SetTransform(renderer, ctx, src, camera, parentMatrix)) + /** + * Add the Scene into the Scene Manager and start it if 'autoStart' is true or the Scene config 'active' property is set. + * + * @method Phaser.Scenes.ScenePlugin#add + * @since 3.0.0 + * + * @param {string} key - A unique key used to reference the Scene, i.e. `MainMenu` or `Level1`. + * @param {(Phaser.Types.Scenes.SceneType)} sceneConfig - The config for the Scene + * @param {boolean} [autoStart=false] - If `true` the Scene will be started immediately after being added. + * @param {object} [data] - Optional data object. This will be set as `Scene.settings.data` and passed to `Scene.init`, and `Scene.create`. + * + * @return {?Phaser.Scene} The added Scene, if it was added immediately, otherwise `null`. + */ + add: function (key, sceneConfig, autoStart, data) { - var dx = src._displayOriginX; - var dy = src._displayOriginY; - - var path = src.pathData; - var pathLength = path.length - 1; - - var px1 = path[0] - dx; - var py1 = path[1] - dy; + return this.manager.add(key, sceneConfig, autoStart, data); + }, - ctx.beginPath(); + /** + * Launch the given Scene and run it in parallel with this one. + * + * This will happen at the next Scene Manager update, not immediately. + * + * @method Phaser.Scenes.ScenePlugin#launch + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to launch. + * @param {object} [data] - The Scene data. + * + * @return {this} This Scene Plugin instance. + */ + launch: function (key, data) + { + if (key && key !== this.key) + { + this.manager.queueOp('start', key, data); + } - ctx.moveTo(px1, py1); + return this; + }, - if (!src.closePath) + /** + * Runs the given Scene, but does not change the state of this Scene. + * + * This will happen at the next Scene Manager update, not immediately. + * + * If the given Scene is paused, it will resume it. If sleeping, it will wake it. + * If not running at all, it will be started. + * + * Use this if you wish to open a modal Scene by calling `pause` on the current + * Scene, then `run` on the modal Scene. + * + * @method Phaser.Scenes.ScenePlugin#run + * @since 3.10.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to run. + * @param {object} [data] - A data object that will be passed to the Scene and emitted in its ready, wake, or resume events. + * + * @return {this} This Scene Plugin instance. + */ + run: function (key, data) + { + if (key && key !== this.key) { - pathLength -= 2; + this.manager.queueOp('run', key, data); } - for (var i = 2; i < pathLength; i += 2) - { - var px2 = path[i] - dx; - var py2 = path[i + 1] - dy; + return this; + }, - ctx.lineTo(px2, py2); - } + /** + * Pause the Scene - this stops the update step from happening but it still renders. + * + * This will happen at the next Scene Manager update, not immediately. + * + * @method Phaser.Scenes.ScenePlugin#pause + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to pause. + * @param {object} [data] - An optional data object that will be passed to the Scene and emitted in its pause event. + * + * @return {this} This Scene Plugin instance. + */ + pause: function (key, data) + { + if (key === undefined) { key = this.key; } - ctx.closePath(); + this.manager.queueOp('pause', key, data); - if (src.isFilled) - { - FillStyleCanvas(ctx, src); + return this; + }, - ctx.fill(); - } + /** + * Resume the Scene - starts the update loop again. + * + * This will happen at the next Scene Manager update, not immediately. + * + * @method Phaser.Scenes.ScenePlugin#resume + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to resume. + * @param {object} [data] - An optional data object that will be passed to the Scene and emitted in its resume event. + * + * @return {this} This Scene Plugin instance. + */ + resume: function (key, data) + { + if (key === undefined) { key = this.key; } - if (src.isStroked) - { - LineStyleCanvas(ctx, src); + this.manager.queueOp('resume', key, data); - ctx.stroke(); - } + return this; + }, - // Restore the context saved in SetTransform - ctx.restore(); - } -}; + /** + * Makes the Scene sleep (no update, no render) but doesn't shutdown. + * + * This will happen at the next Scene Manager update, not immediately. + * + * @method Phaser.Scenes.ScenePlugin#sleep + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to put to sleep. + * @param {object} [data] - An optional data object that will be passed to the Scene and emitted in its sleep event. + * + * @return {this} This Scene Plugin instance. + */ + sleep: function (key, data) + { + if (key === undefined) { key = this.key; } -module.exports = EllipseCanvasRenderer; + this.manager.queueOp('sleep', key, data); + return this; + }, -/***/ }), -/* 1106 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Makes the Scene wake-up (starts update and render) + * + * This will happen at the next Scene Manager update, not immediately. + * + * @method Phaser.Scenes.ScenePlugin#wake + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to wake up. + * @param {object} [data] - An optional data object that will be passed to the Scene and emitted in its wake event. + * + * @return {this} This Scene Plugin instance. + */ + wake: function (key, data) + { + if (key === undefined) { key = this.key; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.manager.queueOp('wake', key, data); -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + return this; + }, -if (true) -{ - renderWebGL = __webpack_require__(1107); -} + /** + * Makes this Scene sleep then starts the Scene given. + * + * This will happen at the next Scene Manager update, not immediately. + * + * @method Phaser.Scenes.ScenePlugin#switch + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to start. + * + * @return {this} This Scene Plugin instance. + */ + switch: function (key) + { + if (key !== this.key) + { + this.manager.queueOp('switch', this.key, key); + } -if (true) -{ - renderCanvas = __webpack_require__(1108); -} + return this; + }, -module.exports = { + /** + * Shutdown the Scene, clearing display list, timers, etc. + * + * This happens at the next Scene Manager update, not immediately. + * + * @method Phaser.Scenes.ScenePlugin#stop + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to stop. + * @param {any} [data] - Optional data object to pass to Scene.Systems.shutdown. + * + * @return {this} This Scene Plugin instance. + */ + stop: function (key, data) + { + if (key === undefined) { key = this.key; } - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + this.manager.queueOp('stop', key, data); -}; + return this; + }, + /** + * Sets the active state of the given Scene. + * + * @method Phaser.Scenes.ScenePlugin#setActive + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {boolean} value - If `true` the Scene will be resumed. If `false` it will be paused. + * @param {(string|Phaser.Scene)} [key] - The Scene to set the active state of. + * @param {object} [data] - An optional data object that will be passed to the Scene and emitted with its events. + * + * @return {this} This Scene Plugin instance. + */ + setActive: function (value, key, data) + { + if (key === undefined) { key = this.key; } -/***/ }), -/* 1107 */ -/***/ (function(module, exports, __webpack_require__) { + var scene = this.manager.getScene(key); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (scene) + { + scene.sys.setActive(value, data); + } -var GetCalcMatrix = __webpack_require__(19); -var Utils = __webpack_require__(12); + return this; + }, -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Grid#renderWebGL - * @since 3.13.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Grid} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var GridWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + /** + * Sets the visible state of the given Scene. + * + * @method Phaser.Scenes.ScenePlugin#setVisible + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {boolean} value - The visible value. + * @param {(string|Phaser.Scene)} [key] - The Scene to set the visible state for. + * + * @return {this} This Scene Plugin instance. + */ + setVisible: function (value, key) + { + if (key === undefined) { key = this.key; } - var pipeline = renderer.pipelines.set(src.pipeline); + var scene = this.manager.getScene(key); - var result = GetCalcMatrix(src, camera, parentMatrix); + if (scene) + { + scene.sys.setVisible(value); + } - var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); + return this; + }, - calcMatrix.translate(-src._displayOriginX, -src._displayOriginY); + /** + * Checks if the given Scene is sleeping or not? + * + * @method Phaser.Scenes.ScenePlugin#isSleeping + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to check. + * + * @return {boolean} Whether the Scene is sleeping, or `null` if no matching Scene was found. + */ + isSleeping: function (key) + { + if (key === undefined) { key = this.key; } - var alpha = camera.alpha * src.alpha; + return this.manager.isSleeping(key); + }, - // Work out the grid size + /** + * Checks if the given Scene is running or not? + * + * @method Phaser.Scenes.ScenePlugin#isActive + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to check. + * + * @return {boolean} Whether the Scene is running, or `null` if no matching Scene was found. + */ + isActive: function (key) + { + if (key === undefined) { key = this.key; } - var width = src.width; - var height = src.height; + return this.manager.isActive(key); + }, - var cellWidth = src.cellWidth; - var cellHeight = src.cellHeight; + /** + * Checks if the given Scene is paused or not? + * + * @method Phaser.Scenes.ScenePlugin#isPaused + * @since 3.17.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to check. + * + * @return {boolean} Whether the Scene is paused, or `null` if no matching Scene was found. + */ + isPaused: function (key) + { + if (key === undefined) { key = this.key; } - var gridWidth = Math.ceil(width / cellWidth); - var gridHeight = Math.ceil(height / cellHeight); + return this.manager.isPaused(key); + }, - var cellWidthA = cellWidth; - var cellHeightA = cellHeight; + /** + * Checks if the given Scene is visible or not? + * + * @method Phaser.Scenes.ScenePlugin#isVisible + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to check. + * + * @return {boolean} Whether the Scene is visible, or `null` if no matching Scene was found. + */ + isVisible: function (key) + { + if (key === undefined) { key = this.key; } - var cellWidthB = cellWidth - ((gridWidth * cellWidth) - width); - var cellHeightB = cellHeight - ((gridHeight * cellHeight) - height); + return this.manager.isVisible(key); + }, - var fillTint; - var fillTintColor; + /** + * Swaps the position of two scenes in the Scenes list. + * + * This controls the order in which they are rendered and updated. + * + * @method Phaser.Scenes.ScenePlugin#swapPosition + * @since 3.2.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [keyA,keyB] + * + * @param {(string|Phaser.Scene)} keyA - The first Scene to swap. + * @param {(string|Phaser.Scene)} [keyB] - The second Scene to swap. If none is given it defaults to this Scene. + * + * @return {this} This Scene Plugin instance. + */ + swapPosition: function (keyA, keyB) + { + if (keyB === undefined) { keyB = this.key; } - var showCells = src.showCells; - var showAltCells = src.showAltCells; - var showOutline = src.showOutline; + if (keyA !== keyB) + { + this.manager.swapPosition(keyA, keyB); + } - var x = 0; - var y = 0; - var r = 0; - var cw = 0; - var ch = 0; + return this; + }, - if (showOutline) + /** + * Swaps the position of two scenes in the Scenes list, so that Scene B is directly above Scene A. + * + * This controls the order in which they are rendered and updated. + * + * @method Phaser.Scenes.ScenePlugin#moveAbove + * @since 3.2.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [keyA,keyB] + * + * @param {(string|Phaser.Scene)} keyA - The Scene that Scene B will be moved to be above. + * @param {(string|Phaser.Scene)} [keyB] - The Scene to be moved. If none is given it defaults to this Scene. + * + * @return {this} This Scene Plugin instance. + */ + moveAbove: function (keyA, keyB) { - // To make room for the grid lines (in case alpha < 1) - cellWidthA--; - cellHeightA--; + if (keyB === undefined) { keyB = this.key; } - if (cellWidthB === cellWidth) + if (keyA !== keyB) { - cellWidthB--; + this.manager.moveAbove(keyA, keyB); } - if (cellHeightB === cellHeight) + return this; + }, + + /** + * Swaps the position of two scenes in the Scenes list, so that Scene B is directly below Scene A. + * + * This controls the order in which they are rendered and updated. + * + * @method Phaser.Scenes.ScenePlugin#moveBelow + * @since 3.2.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [keyA,keyB] + * + * @param {(string|Phaser.Scene)} keyA - The Scene that Scene B will be moved to be below. + * @param {(string|Phaser.Scene)} [keyB] - The Scene to be moved. If none is given it defaults to this Scene. + * + * @return {this} This Scene Plugin instance. + */ + moveBelow: function (keyA, keyB) + { + if (keyB === undefined) { keyB = this.key; } + + if (keyA !== keyB) { - cellHeightB--; + this.manager.moveBelow(keyA, keyB); } - } - renderer.pipelines.preBatch(src); + return this; + }, - if (showCells && src.fillAlpha > 0) + /** + * Removes a Scene from the SceneManager. + * + * The Scene is removed from the local scenes array, it's key is cleared from the keys + * cache and Scene.Systems.destroy is then called on it. + * + * If the SceneManager is processing the Scenes when this method is called it will + * queue the operation for the next update sequence. + * + * @method Phaser.Scenes.ScenePlugin#remove + * @since 3.2.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to be removed. + * + * @return {this} This Scene Plugin instance. + */ + remove: function (key) { - fillTint = pipeline.fillTint; - fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); + if (key === undefined) { key = this.key; } - fillTint.TL = fillTintColor; - fillTint.TR = fillTintColor; - fillTint.BL = fillTintColor; - fillTint.BR = fillTintColor; + this.manager.remove(key); - for (y = 0; y < gridHeight; y++) - { - if (showAltCells) - { - r = y % 2; - } + return this; + }, - for (x = 0; x < gridWidth; x++) - { - if (showAltCells && r) - { - r = 0; - continue; - } + /** + * Moves a Scene up one position in the Scenes list. + * + * @method Phaser.Scenes.ScenePlugin#moveUp + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to move. + * + * @return {this} This Scene Plugin instance. + */ + moveUp: function (key) + { + if (key === undefined) { key = this.key; } - r++; + this.manager.moveUp(key); - cw = (x < gridWidth - 1) ? cellWidthA : cellWidthB; - ch = (y < gridHeight - 1) ? cellHeightA : cellHeightB; + return this; + }, - pipeline.batchFillRect( - x * cellWidth, - y * cellHeight, - cw, - ch - ); - } - } - } + /** + * Moves a Scene down one position in the Scenes list. + * + * @method Phaser.Scenes.ScenePlugin#moveDown + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to move. + * + * @return {this} This Scene Plugin instance. + */ + moveDown: function (key) + { + if (key === undefined) { key = this.key; } - if (showAltCells && src.altFillAlpha > 0) + this.manager.moveDown(key); + + return this; + }, + + /** + * Brings a Scene to the top of the Scenes list. + * + * This means it will render above all other Scenes. + * + * @method Phaser.Scenes.ScenePlugin#bringToTop + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to move. + * + * @return {this} This Scene Plugin instance. + */ + bringToTop: function (key) { - fillTint = pipeline.fillTint; - fillTintColor = Utils.getTintAppendFloatAlpha(src.altFillColor, src.altFillAlpha * alpha); + if (key === undefined) { key = this.key; } - fillTint.TL = fillTintColor; - fillTint.TR = fillTintColor; - fillTint.BL = fillTintColor; - fillTint.BR = fillTintColor; + this.manager.bringToTop(key); - for (y = 0; y < gridHeight; y++) - { - if (showAltCells) - { - r = y % 2; - } + return this; + }, - for (x = 0; x < gridWidth; x++) - { - if (showAltCells && !r) - { - r = 1; - continue; - } + /** + * Sends a Scene to the back of the Scenes list. + * + * This means it will render below all other Scenes. + * + * @method Phaser.Scenes.ScenePlugin#sendToBack + * @since 3.0.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to move. + * + * @return {this} This Scene Plugin instance. + */ + sendToBack: function (key) + { + if (key === undefined) { key = this.key; } - r = 0; + this.manager.sendToBack(key); - cw = (x < gridWidth - 1) ? cellWidthA : cellWidthB; - ch = (y < gridHeight - 1) ? cellHeightA : cellHeightB; + return this; + }, - pipeline.batchFillRect( - x * cellWidth, - y * cellHeight, - cw, - ch - ); - } + /** + * Retrieve a Scene. + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * @genericUse {T} - [$return] + * + * @method Phaser.Scenes.ScenePlugin#get + * @since 3.0.0 + * + * @param {(string|Phaser.Scene)} key - The Scene to retrieve. + * + * @return {Phaser.Scene} The Scene. + */ + get: function (key) + { + return this.manager.getScene(key); + }, + + /** + * Return the status of the Scene. + * + * @method Phaser.Scenes.ScenePlugin#getStatus + * @since 3.60.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} key - The Scene to get the status from. + * + * @return {number} The Scene status. This maps to the `Phaser.Scene` constants, such as `Phaser.Scene.LOADING`. + */ + getStatus: function (key) + { + var scene = this.manager.getScene(key); + + if (scene) + { + return scene.sys.getStatus(); } - } + }, - if (showOutline && src.outlineFillAlpha > 0) + /** + * Retrieves the numeric index of a Scene in the Scenes list. + * + * @method Phaser.Scenes.ScenePlugin#getIndex + * @since 3.7.0 + * + * @generic {Phaser.Scene} T + * @genericUse {(T|string)} - [key] + * + * @param {(string|Phaser.Scene)} [key] - The Scene to get the index of. + * + * @return {number} The index of the Scene. + */ + getIndex: function (key) { - var strokeTint = pipeline.strokeTint; - var color = Utils.getTintAppendFloatAlpha(src.outlineFillColor, src.outlineFillAlpha * alpha); + if (key === undefined) { key = this.key; } - strokeTint.TL = color; - strokeTint.TR = color; - strokeTint.BL = color; - strokeTint.BR = color; + return this.manager.getIndex(key); + }, - for (x = 1; x < gridWidth; x++) - { - var x1 = x * cellWidth; + /** + * The Scene that owns this plugin is shutting down. + * + * We need to kill and reset all internal properties as well as stop listening to Scene events. + * + * @method Phaser.Scenes.ScenePlugin#shutdown + * @private + * @since 3.0.0 + */ + shutdown: function () + { + var eventEmitter = this.systems.events; - pipeline.batchLine(x1, 0, x1, height, 1, 1, 1, 0, false); - } + eventEmitter.off(Events.SHUTDOWN, this.shutdown, this); + eventEmitter.off(Events.TRANSITION_OUT); + }, - for (y = 1; y < gridHeight; y++) - { - var y1 = y * cellHeight; + /** + * The Scene that owns this plugin is being destroyed. + * + * We need to shutdown and then kill off all external references. + * + * @method Phaser.Scenes.ScenePlugin#destroy + * @private + * @since 3.0.0 + */ + destroy: function () + { + this.shutdown(); - pipeline.batchLine(0, y1, width, y1, 1, 1, 1, 0, false); - } + this.scene.sys.events.off(Events.START, this.start, this); + + this.scene = null; + this.systems = null; + this.settings = null; + this.manager = null; } - renderer.pipelines.postBatch(src); -}; +}); -module.exports = GridWebGLRenderer; +PluginCache.register('ScenePlugin', ScenePlugin, 'scenePlugin'); + +module.exports = ScenePlugin; /***/ }), -/* 1108 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 36765: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(48); -var LineStyleCanvas = __webpack_require__(60); -var SetTransform = __webpack_require__(30); +var CONST = __webpack_require__(92980); +var GetValue = __webpack_require__(10850); +var Merge = __webpack_require__(30657); +var InjectionMap = __webpack_require__(90415); /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Grid#renderCanvas - * @since 3.13.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Grid} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @namespace Phaser.Scenes.Settings */ -var GridCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - var ctx = renderer.currentContext; +var Settings = { - if (SetTransform(renderer, ctx, src, camera, parentMatrix)) + /** + * Takes a Scene configuration object and returns a fully formed System Settings object. + * + * @function Phaser.Scenes.Settings.create + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Scenes.SettingsConfig)} config - The Scene configuration object used to create this Scene Settings. + * + * @return {Phaser.Types.Scenes.SettingsObject} The Scene Settings object created as a result of the config and default settings. + */ + create: function (config) { - var dx = -src._displayOriginX; - var dy = -src._displayOriginY; - - var alpha = camera.alpha * src.alpha; - - // Work out the grid size - - var width = src.width; - var height = src.height; - - var cellWidth = src.cellWidth; - var cellHeight = src.cellHeight; - - var gridWidth = Math.ceil(width / cellWidth); - var gridHeight = Math.ceil(height / cellHeight); - - var cellWidthA = cellWidth; - var cellHeightA = cellHeight; - - var cellWidthB = cellWidth - ((gridWidth * cellWidth) - width); - var cellHeightB = cellHeight - ((gridHeight * cellHeight) - height); - - var showCells = src.showCells; - var showAltCells = src.showAltCells; - var showOutline = src.showOutline; - - var x = 0; - var y = 0; - var r = 0; - var cw = 0; - var ch = 0; - - if (showOutline) + if (typeof config === 'string') { - // To make room for the grid lines (in case alpha < 1) - cellWidthA--; - cellHeightA--; - - if (cellWidthB === cellWidth) - { - cellWidthB--; - } - - if (cellHeightB === cellHeight) - { - cellHeightB--; - } + config = { key: config }; } - - if (showCells && src.fillAlpha > 0) + else if (config === undefined) { - FillStyleCanvas(ctx, src); + // Pass the 'hasOwnProperty' checks + config = {}; + } - for (y = 0; y < gridHeight; y++) - { - if (showAltCells) - { - r = y % 2; - } + return { - for (x = 0; x < gridWidth; x++) - { - if (showAltCells && r) - { - r = 0; - continue; - } + status: CONST.PENDING, - r++; + key: GetValue(config, 'key', ''), + active: GetValue(config, 'active', false), + visible: GetValue(config, 'visible', true), - cw = (x < gridWidth - 1) ? cellWidthA : cellWidthB; - ch = (y < gridHeight - 1) ? cellHeightA : cellHeightB; + isBooted: false, - ctx.fillRect( - dx + x * cellWidth, - dy + y * cellHeight, - cw, - ch - ); - } - } - } + isTransition: false, + transitionFrom: null, + transitionDuration: 0, + transitionAllowInput: true, - if (showAltCells && src.altFillAlpha > 0) - { - FillStyleCanvas(ctx, src, src.altFillColor, src.altFillAlpha * alpha); + // Loader payload array - for (y = 0; y < gridHeight; y++) - { - if (showAltCells) - { - r = y % 2; - } + data: {}, - for (x = 0; x < gridWidth; x++) - { - if (showAltCells && !r) - { - r = 1; - continue; - } + pack: GetValue(config, 'pack', false), - r = 0; + // Cameras - cw = (x < gridWidth - 1) ? cellWidthA : cellWidthB; - ch = (y < gridHeight - 1) ? cellHeightA : cellHeightB; + cameras: GetValue(config, 'cameras', null), - ctx.fillRect( - dx + x * cellWidth, - dy + y * cellHeight, - cw, - ch - ); - } - } - } + // Scene Property Injection Map - if (showOutline && src.outlineFillAlpha > 0) - { - LineStyleCanvas(ctx, src, src.outlineFillColor, src.outlineFillAlpha * alpha); + map: GetValue(config, 'map', Merge(InjectionMap, GetValue(config, 'mapAdd', {}))), - for (x = 1; x < gridWidth; x++) - { - var x1 = x * cellWidth; + // Physics - ctx.beginPath(); + physics: GetValue(config, 'physics', {}), - ctx.moveTo(x1 + dx, dy); - ctx.lineTo(x1 + dx, height + dy); + // Loader - ctx.stroke(); - } + loader: GetValue(config, 'loader', {}), - for (y = 1; y < gridHeight; y++) - { - var y1 = y * cellHeight; + // Plugins - ctx.beginPath(); + plugins: GetValue(config, 'plugins', false), - ctx.moveTo(dx, y1 + dy); - ctx.lineTo(dx + width, y1 + dy); + // Input - ctx.stroke(); - } - } + input: GetValue(config, 'input', {}) - // Restore the context saved in SetTransform - ctx.restore(); + }; } + }; -module.exports = GridCanvasRenderer; +module.exports = Settings; /***/ }), -/* 1109 */ -/***/ (function(module, exports, __webpack_require__) { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); - -if (true) -{ - renderWebGL = __webpack_require__(1110); -} - -if (true) -{ - renderCanvas = __webpack_require__(1111); -} - -module.exports = { - - renderWebGL: renderWebGL, - renderCanvas: renderCanvas - -}; - - -/***/ }), -/* 1110 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ 63946: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCalcMatrix = __webpack_require__(19); -var Utils = __webpack_require__(12); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(92980); +var DefaultPlugins = __webpack_require__(18360); +var Events = __webpack_require__(7599); +var GetPhysicsPlugins = __webpack_require__(47736); +var GetScenePlugins = __webpack_require__(91088); +var NOOP = __webpack_require__(72283); +var Settings = __webpack_require__(36765); /** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * @classdesc + * The Scene Systems class. * - * @method Phaser.GameObjects.IsoBox#renderWebGL - * @since 3.13.0 - * @private + * This class is available from within a Scene under the property `sys`. + * It is responsible for managing all of the plugins a Scene has running, including the display list, and + * handling the update step and renderer. It also contains references to global systems belonging to Game. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.IsoBox} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @class Systems + * @memberof Phaser.Scenes + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene that owns this Systems instance. + * @param {(string|Phaser.Types.Scenes.SettingsConfig)} config - Scene specific configuration settings. */ -var IsoBoxWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - - var pipeline = renderer.pipelines.set(src.pipeline); - - var result = GetCalcMatrix(src, camera, parentMatrix); - - var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); - - var size = src.width; - var height = src.height; - - var sizeA = size / 2; - var sizeB = size / src.projection; +var Systems = new Class({ - var alpha = camera.alpha * src.alpha; + initialize: - if (!src.isFilled) + function Systems (scene, config) { - return; - } - - var tint; - - var x0; - var y0; - - var x1; - var y1; + /** + * A reference to the Scene that these Systems belong to. + * + * @name Phaser.Scenes.Systems#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; - var x2; - var y2; + /** + * A reference to the Phaser Game instance. + * + * @name Phaser.Scenes.Systems#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game; - var x3; - var y3; + /** + * A reference to either the Canvas or WebGL Renderer that this Game is using. + * + * @name Phaser.Scenes.Systems#renderer + * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} + * @since 3.17.0 + */ + this.renderer; + if (false) + {} - renderer.pipelines.preBatch(src); + /** + * The Scene Configuration object, as passed in when creating the Scene. + * + * @name Phaser.Scenes.Systems#config + * @type {(string|Phaser.Types.Scenes.SettingsConfig)} + * @since 3.0.0 + */ + this.config = config; - // Top Face + /** + * The Scene Settings. This is the parsed output based on the Scene configuration. + * + * @name Phaser.Scenes.Systems#settings + * @type {Phaser.Types.Scenes.SettingsObject} + * @since 3.0.0 + */ + this.settings = Settings.create(config); - if (src.showTop) - { - tint = Utils.getTintAppendFloatAlpha(src.fillTop, alpha); + /** + * A handy reference to the Scene canvas / context. + * + * @name Phaser.Scenes.Systems#canvas + * @type {HTMLCanvasElement} + * @since 3.0.0 + */ + this.canvas; - x0 = calcMatrix.getX(-sizeA, -height); - y0 = calcMatrix.getY(-sizeA, -height); + /** + * A reference to the Canvas Rendering Context being used by the renderer. + * + * @name Phaser.Scenes.Systems#context + * @type {CanvasRenderingContext2D} + * @since 3.0.0 + */ + this.context; - x1 = calcMatrix.getX(0, -sizeB - height); - y1 = calcMatrix.getY(0, -sizeB - height); + // Global Systems - these are single-instance global managers that belong to Game - x2 = calcMatrix.getX(sizeA, -height); - y2 = calcMatrix.getY(sizeA, -height); + /** + * A reference to the global Animations Manager. + * + * In the default set-up you can access this from within a Scene via the `this.anims` property. + * + * @name Phaser.Scenes.Systems#anims + * @type {Phaser.Animations.AnimationManager} + * @since 3.0.0 + */ + this.anims; - x3 = calcMatrix.getX(0, sizeB - height); - y3 = calcMatrix.getY(0, sizeB - height); + /** + * A reference to the global Cache. The Cache stores all files bought in to Phaser via + * the Loader, with the exception of images. Images are stored in the Texture Manager. + * + * In the default set-up you can access this from within a Scene via the `this.cache` property. + * + * @name Phaser.Scenes.Systems#cache + * @type {Phaser.Cache.CacheManager} + * @since 3.0.0 + */ + this.cache; - pipeline.batchQuad(src, x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); - } + /** + * A reference to the global Plugins Manager. + * + * In the default set-up you can access this from within a Scene via the `this.plugins` property. + * + * @name Phaser.Scenes.Systems#plugins + * @type {Phaser.Plugins.PluginManager} + * @since 3.0.0 + */ + this.plugins; - // Left Face + /** + * A reference to the global registry. This is a game-wide instance of the Data Manager, allowing + * you to exchange data between Scenes via a universal and shared point. + * + * In the default set-up you can access this from within a Scene via the `this.registry` property. + * + * @name Phaser.Scenes.Systems#registry + * @type {Phaser.Data.DataManager} + * @since 3.0.0 + */ + this.registry; - if (src.showLeft) - { - tint = Utils.getTintAppendFloatAlpha(src.fillLeft, alpha); + /** + * A reference to the global Scale Manager. + * + * In the default set-up you can access this from within a Scene via the `this.scale` property. + * + * @name Phaser.Scenes.Systems#scale + * @type {Phaser.Scale.ScaleManager} + * @since 3.15.0 + */ + this.scale; - x0 = calcMatrix.getX(-sizeA, 0); - y0 = calcMatrix.getY(-sizeA, 0); + /** + * A reference to the global Sound Manager. + * + * In the default set-up you can access this from within a Scene via the `this.sound` property. + * + * @name Phaser.Scenes.Systems#sound + * @type {(Phaser.Sound.NoAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager|Phaser.Sound.WebAudioSoundManager)} + * @since 3.0.0 + */ + this.sound; - x1 = calcMatrix.getX(0, sizeB); - y1 = calcMatrix.getY(0, sizeB); + /** + * A reference to the global Texture Manager. + * + * In the default set-up you can access this from within a Scene via the `this.textures` property. + * + * @name Phaser.Scenes.Systems#textures + * @type {Phaser.Textures.TextureManager} + * @since 3.0.0 + */ + this.textures; - x2 = calcMatrix.getX(0, sizeB - height); - y2 = calcMatrix.getY(0, sizeB - height); + // Core Plugins - these are non-optional Scene plugins, needed by lots of the other systems - x3 = calcMatrix.getX(-sizeA, -height); - y3 = calcMatrix.getY(-sizeA, -height); + /** + * A reference to the Scene's Game Object Factory. + * + * Use this to quickly and easily create new Game Object's. + * + * In the default set-up you can access this from within a Scene via the `this.add` property. + * + * @name Phaser.Scenes.Systems#add + * @type {Phaser.GameObjects.GameObjectFactory} + * @since 3.0.0 + */ + this.add; - pipeline.batchQuad(src, x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); - } + /** + * A reference to the Scene's Camera Manager. + * + * Use this to manipulate and create Cameras for this specific Scene. + * + * In the default set-up you can access this from within a Scene via the `this.cameras` property. + * + * @name Phaser.Scenes.Systems#cameras + * @type {Phaser.Cameras.Scene2D.CameraManager} + * @since 3.0.0 + */ + this.cameras; - // Right Face + /** + * A reference to the Scene's Display List. + * + * Use this to organize the children contained in the display list. + * + * In the default set-up you can access this from within a Scene via the `this.children` property. + * + * @name Phaser.Scenes.Systems#displayList + * @type {Phaser.GameObjects.DisplayList} + * @since 3.0.0 + */ + this.displayList; - if (src.showRight) - { - tint = Utils.getTintAppendFloatAlpha(src.fillRight, alpha); + /** + * A reference to the Scene's Event Manager. + * + * Use this to listen for Scene specific events, such as `pause` and `shutdown`. + * + * In the default set-up you can access this from within a Scene via the `this.events` property. + * + * @name Phaser.Scenes.Systems#events + * @type {Phaser.Events.EventEmitter} + * @since 3.0.0 + */ + this.events; - x0 = calcMatrix.getX(sizeA, 0); - y0 = calcMatrix.getY(sizeA, 0); + /** + * A reference to the Scene's Game Object Creator. + * + * Use this to quickly and easily create new Game Object's. The difference between this and the + * Game Object Factory, is that the Creator just creates and returns Game Object instances, it + * doesn't then add them to the Display List or Update List. + * + * In the default set-up you can access this from within a Scene via the `this.make` property. + * + * @name Phaser.Scenes.Systems#make + * @type {Phaser.GameObjects.GameObjectCreator} + * @since 3.0.0 + */ + this.make; - x1 = calcMatrix.getX(0, sizeB); - y1 = calcMatrix.getY(0, sizeB); + /** + * A reference to the Scene Manager Plugin. + * + * Use this to manipulate both this and other Scene's in your game, for example to launch a parallel Scene, + * or pause or resume a Scene, or switch from this Scene to another. + * + * In the default set-up you can access this from within a Scene via the `this.scene` property. + * + * @name Phaser.Scenes.Systems#scenePlugin + * @type {Phaser.Scenes.ScenePlugin} + * @since 3.0.0 + */ + this.scenePlugin; - x2 = calcMatrix.getX(0, sizeB - height); - y2 = calcMatrix.getY(0, sizeB - height); + /** + * A reference to the Scene's Update List. + * + * Use this to organize the children contained in the update list. + * + * The Update List is responsible for managing children that need their `preUpdate` methods called, + * in order to process so internal components, such as Sprites with Animations. + * + * In the default set-up there is no reference to this from within the Scene itself. + * + * @name Phaser.Scenes.Systems#updateList + * @type {Phaser.GameObjects.UpdateList} + * @since 3.0.0 + */ + this.updateList; - x3 = calcMatrix.getX(sizeA, -height); - y3 = calcMatrix.getY(sizeA, -height); + /** + * The Scene Update function. + * + * This starts out as NOOP during init, preload and create, and at the end of create + * it swaps to be whatever the Scene.update function is. + * + * @name Phaser.Scenes.Systems#sceneUpdate + * @type {function} + * @private + * @since 3.10.0 + */ + this.sceneUpdate = NOOP; + }, - pipeline.batchQuad(src, x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); - } + /** + * This method is called only once by the Scene Manager when the Scene is instantiated. + * It is responsible for setting up all of the Scene plugins and references. + * It should never be called directly. + * + * @method Phaser.Scenes.Systems#init + * @protected + * @fires Phaser.Scenes.Events#BOOT + * @since 3.0.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. + */ + init: function (game) + { + this.settings.status = CONST.INIT; - renderer.pipelines.postBatch(src); -}; + // This will get replaced by the SceneManager with the actual update function, if it exists, once create is over. + this.sceneUpdate = NOOP; -module.exports = IsoBoxWebGLRenderer; + this.game = game; + this.renderer = game.renderer; + this.canvas = game.canvas; + this.context = game.context; -/***/ }), -/* 1111 */ -/***/ (function(module, exports, __webpack_require__) { + var pluginManager = game.plugins; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.plugins = pluginManager; -var FillStyleCanvas = __webpack_require__(48); -var SetTransform = __webpack_require__(30); + pluginManager.addToScene(this, DefaultPlugins.Global, [ DefaultPlugins.CoreScene, GetScenePlugins(this), GetPhysicsPlugins(this) ]); -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.IsoBox#renderCanvas - * @since 3.13.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.IsoBox} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var IsoBoxCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + this.events.emit(Events.BOOT, this); - var ctx = renderer.currentContext; + this.settings.isBooted = true; + }, - if (SetTransform(renderer, ctx, src, camera, parentMatrix) && src.isFilled) + /** + * A single game step. Called automatically by the Scene Manager as a result of a Request Animation + * Frame or Set Timeout call to the main Game instance. + * + * @method Phaser.Scenes.Systems#step + * @fires Phaser.Scenes.Events#PRE_UPDATE + * @fires Phaser.Scenes.Events#UPDATE + * @fires Phaser.Scenes.Events#POST_UPDATE + * @since 3.0.0 + * + * @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now(). + * @param {number} delta - The delta value since the last frame. This is smoothed to avoid delta spikes by the TimeStep class. + */ + step: function (time, delta) { - var size = src.width; - var height = src.height; + var events = this.events; - var sizeA = size / 2; - var sizeB = size / src.projection; + events.emit(Events.PRE_UPDATE, time, delta); - // Top Face + events.emit(Events.UPDATE, time, delta); - if (src.showTop) - { - FillStyleCanvas(ctx, src, src.fillTop); + this.sceneUpdate.call(this.scene, time, delta); - ctx.beginPath(); + events.emit(Events.POST_UPDATE, time, delta); + }, - ctx.moveTo(-sizeA, -height); - ctx.lineTo(0, -sizeB - height); - ctx.lineTo(sizeA, -height); - ctx.lineTo(sizeA, -1); - ctx.lineTo(0, sizeB - 1); - ctx.lineTo(-sizeA, -1); - ctx.lineTo(-sizeA, -height); + /** + * Called automatically by the Scene Manager. + * Instructs the Scene to render itself via its Camera Manager to the renderer given. + * + * @method Phaser.Scenes.Systems#render + * @fires Phaser.Scenes.Events#PRE_RENDER + * @fires Phaser.Scenes.Events#RENDER + * @since 3.0.0 + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that invoked the render call. + */ + render: function (renderer) + { + var displayList = this.displayList; - ctx.fill(); - } + displayList.depthSort(); - // Left Face + this.events.emit(Events.PRE_RENDER, renderer); - if (src.showLeft) - { - FillStyleCanvas(ctx, src, src.fillLeft); + this.cameras.render(renderer, displayList); - ctx.beginPath(); + this.events.emit(Events.RENDER, renderer); + }, - ctx.moveTo(-sizeA, 0); - ctx.lineTo(0, sizeB); - ctx.lineTo(0, sizeB - height); - ctx.lineTo(-sizeA, -height); - ctx.lineTo(-sizeA, 0); + /** + * Force a sort of the display list on the next render. + * + * @method Phaser.Scenes.Systems#queueDepthSort + * @since 3.0.0 + */ + queueDepthSort: function () + { + this.displayList.queueDepthSort(); + }, - ctx.fill(); - } + /** + * Immediately sorts the display list if the flag is set. + * + * @method Phaser.Scenes.Systems#depthSort + * @since 3.0.0 + */ + depthSort: function () + { + this.displayList.depthSort(); + }, - // Right Face + /** + * Pause this Scene. + * + * A paused Scene still renders, it just doesn't run any of its update handlers or systems. + * + * @method Phaser.Scenes.Systems#pause + * @fires Phaser.Scenes.Events#PAUSE + * @since 3.0.0 + * + * @param {object} [data] - A data object that will be passed in the 'pause' event. + * + * @return {Phaser.Scenes.Systems} This Systems object. + */ + pause: function (data) + { + var settings = this.settings; + var status = this.getStatus(); - if (src.showRight) + if (status !== CONST.CREATING && status !== CONST.RUNNING) { - FillStyleCanvas(ctx, src, src.fillRight); - - ctx.beginPath(); + console.warn('Cannot pause non-running Scene', settings.key); + } + else if (this.settings.active) + { + settings.status = CONST.PAUSED; - ctx.moveTo(sizeA, 0); - ctx.lineTo(0, sizeB); - ctx.lineTo(0, sizeB - height); - ctx.lineTo(sizeA, -height); - ctx.lineTo(sizeA, 0); + settings.active = false; - ctx.fill(); + this.events.emit(Events.PAUSE, this, data); } - // Restore the context saved in SetTransform - ctx.restore(); - } -}; + return this; + }, -module.exports = IsoBoxCanvasRenderer; + /** + * Resume this Scene from a paused state. + * + * @method Phaser.Scenes.Systems#resume + * @fires Phaser.Scenes.Events#RESUME + * @since 3.0.0 + * + * @param {object} [data] - A data object that will be passed in the 'resume' event. + * + * @return {Phaser.Scenes.Systems} This Systems object. + */ + resume: function (data) + { + var events = this.events; + var settings = this.settings; + if (!this.settings.active) + { + settings.status = CONST.RUNNING; -/***/ }), -/* 1112 */ -/***/ (function(module, exports, __webpack_require__) { + settings.active = true; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + events.emit(Events.RESUME, this, data); + } -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + return this; + }, -if (true) -{ - renderWebGL = __webpack_require__(1113); -} + /** + * Send this Scene to sleep. + * + * A sleeping Scene doesn't run its update step or render anything, but it also isn't shut down + * or has any of its systems or children removed, meaning it can be re-activated at any point and + * will carry on from where it left off. It also keeps everything in memory and events and callbacks + * from other Scenes may still invoke changes within it, so be careful what is left active. + * + * @method Phaser.Scenes.Systems#sleep + * @fires Phaser.Scenes.Events#SLEEP + * @since 3.0.0 + * + * @param {object} [data] - A data object that will be passed in the 'sleep' event. + * + * @return {Phaser.Scenes.Systems} This Systems object. + */ + sleep: function (data) + { + var settings = this.settings; + var status = this.getStatus(); -if (true) -{ - renderCanvas = __webpack_require__(1114); -} + if (status !== CONST.CREATING && status !== CONST.RUNNING) + { + console.warn('Cannot sleep non-running Scene', settings.key); + } + else + { + settings.status = CONST.SLEEPING; -module.exports = { + settings.active = false; + settings.visible = false; - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + this.events.emit(Events.SLEEP, this, data); + } -}; + return this; + }, + /** + * Wake-up this Scene if it was previously asleep. + * + * @method Phaser.Scenes.Systems#wake + * @fires Phaser.Scenes.Events#WAKE + * @since 3.0.0 + * + * @param {object} [data] - A data object that will be passed in the 'wake' event. + * + * @return {Phaser.Scenes.Systems} This Systems object. + */ + wake: function (data) + { + var events = this.events; + var settings = this.settings; -/***/ }), -/* 1113 */ -/***/ (function(module, exports, __webpack_require__) { + settings.status = CONST.RUNNING; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + settings.active = true; + settings.visible = true; -var GetCalcMatrix = __webpack_require__(19); -var Utils = __webpack_require__(12); + events.emit(Events.WAKE, this, data); -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.IsoTriangle#renderWebGL - * @since 3.13.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.IsoTriangle} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var IsoTriangleWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + if (settings.isTransition) + { + events.emit(Events.TRANSITION_WAKE, settings.transitionFrom, settings.transitionDuration); + } - var pipeline = renderer.pipelines.set(src.pipeline); + return this; + }, - var result = GetCalcMatrix(src, camera, parentMatrix); + /** + * Returns any data that was sent to this Scene by another Scene. + * + * The data is also passed to `Scene.init` and in various Scene events, but + * you can access it at any point via this method. + * + * @method Phaser.Scenes.Systems#getData + * @since 3.22.0 + * + * @return {any} The Scene Data. + */ + getData: function () + { + return this.settings.data; + }, - var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); + /** + * Returns the current status of this Scene. + * + * @method Phaser.Scenes.Systems#getStatus + * @since 3.60.0 + * + * @return {number} The status of this Scene. One of the `Phaser.Scene` constants. + */ + getStatus: function () + { + return this.settings.status; + }, - var size = src.width; - var height = src.height; + /** + * Can this Scene receive Input events? + * + * @method Phaser.Scenes.Systems#canInput + * @since 3.60.0 + * + * @return {boolean} `true` if this Scene can receive Input events. + */ + canInput: function () + { + var status = this.settings.status; - var sizeA = size / 2; - var sizeB = size / src.projection; + return (status > CONST.PENDING && status <= CONST.RUNNING); + }, - var reversed = src.isReversed; + /** + * Is this Scene sleeping? + * + * @method Phaser.Scenes.Systems#isSleeping + * @since 3.0.0 + * + * @return {boolean} `true` if this Scene is asleep, otherwise `false`. + */ + isSleeping: function () + { + return (this.settings.status === CONST.SLEEPING); + }, - var alpha = camera.alpha * src.alpha; + /** + * Is this Scene running? + * + * @method Phaser.Scenes.Systems#isActive + * @since 3.0.0 + * + * @return {boolean} `true` if this Scene is running, otherwise `false`. + */ + isActive: function () + { + return (this.settings.status === CONST.RUNNING); + }, - if (!src.isFilled) + /** + * Is this Scene paused? + * + * @method Phaser.Scenes.Systems#isPaused + * @since 3.13.0 + * + * @return {boolean} `true` if this Scene is paused, otherwise `false`. + */ + isPaused: function () { - return; - } + return (this.settings.status === CONST.PAUSED); + }, - renderer.pipelines.preBatch(src); + /** + * Is this Scene currently transitioning out to, or in from another Scene? + * + * @method Phaser.Scenes.Systems#isTransitioning + * @since 3.5.0 + * + * @return {boolean} `true` if this Scene is currently transitioning, otherwise `false`. + */ + isTransitioning: function () + { + return (this.settings.isTransition || this.scenePlugin._target !== null); + }, - var tint; + /** + * Is this Scene currently transitioning out from itself to another Scene? + * + * @method Phaser.Scenes.Systems#isTransitionOut + * @since 3.5.0 + * + * @return {boolean} `true` if this Scene is in transition to another Scene, otherwise `false`. + */ + isTransitionOut: function () + { + return (this.scenePlugin._target !== null && this.scenePlugin._duration > 0); + }, - var x0; - var y0; + /** + * Is this Scene currently transitioning in from another Scene? + * + * @method Phaser.Scenes.Systems#isTransitionIn + * @since 3.5.0 + * + * @return {boolean} `true` if this Scene is transitioning in from another Scene, otherwise `false`. + */ + isTransitionIn: function () + { + return (this.settings.isTransition); + }, - var x1; - var y1; + /** + * Is this Scene visible and rendering? + * + * @method Phaser.Scenes.Systems#isVisible + * @since 3.0.0 + * + * @return {boolean} `true` if this Scene is visible, otherwise `false`. + */ + isVisible: function () + { + return this.settings.visible; + }, - var x2; - var y2; + /** + * Sets the visible state of this Scene. + * An invisible Scene will not render, but will still process updates. + * + * @method Phaser.Scenes.Systems#setVisible + * @since 3.0.0 + * + * @param {boolean} value - `true` to render this Scene, otherwise `false`. + * + * @return {Phaser.Scenes.Systems} This Systems object. + */ + setVisible: function (value) + { + this.settings.visible = value; - // Top Face + return this; + }, - if (src.showTop && reversed) + /** + * Set the active state of this Scene. + * + * An active Scene will run its core update loop. + * + * @method Phaser.Scenes.Systems#setActive + * @since 3.0.0 + * + * @param {boolean} value - If `true` the Scene will be resumed, if previously paused. If `false` it will be paused. + * @param {object} [data] - A data object that will be passed in the 'resume' or 'pause' events. + * + * @return {Phaser.Scenes.Systems} This Systems object. + */ + setActive: function (value, data) { - tint = Utils.getTintAppendFloatAlpha(src.fillTop, alpha); + if (value) + { + return this.resume(data); + } + else + { + return this.pause(data); + } + }, - x0 = calcMatrix.getX(-sizeA, -height); - y0 = calcMatrix.getY(-sizeA, -height); + /** + * Start this Scene running and rendering. + * Called automatically by the SceneManager. + * + * @method Phaser.Scenes.Systems#start + * @fires Phaser.Scenes.Events#START + * @fires Phaser.Scenes.Events#READY + * @since 3.0.0 + * + * @param {object} data - Optional data object that may have been passed to this Scene from another. + */ + start: function (data) + { + var events = this.events; + var settings = this.settings; - x1 = calcMatrix.getX(0, -sizeB - height); - y1 = calcMatrix.getY(0, -sizeB - height); + if (data) + { + settings.data = data; + } - x2 = calcMatrix.getX(sizeA, -height); - y2 = calcMatrix.getY(sizeA, -height); + settings.status = CONST.START; - var x3 = calcMatrix.getX(0, sizeB - height); - var y3 = calcMatrix.getY(0, sizeB - height); + settings.active = true; + settings.visible = true; - pipeline.batchQuad(src, x0, y0, x1, y1, x2, y2, x3, y3, 0, 0, 1, 1, tint, tint, tint, tint, 2); - } + // For plugins to listen out for + events.emit(Events.START, this); - // Left Face + // For user-land code to listen out for + events.emit(Events.READY, this, data); + }, - if (src.showLeft) + /** + * Shutdown this Scene and send a shutdown event to all of its systems. + * A Scene that has been shutdown will not run its update loop or render, but it does + * not destroy any of its plugins or references. It is put into hibernation for later use. + * If you don't ever plan to use this Scene again, then it should be destroyed instead + * to free-up resources. + * + * @method Phaser.Scenes.Systems#shutdown + * @fires Phaser.Scenes.Events#SHUTDOWN + * @since 3.0.0 + * + * @param {object} [data] - A data object that will be passed in the 'shutdown' event. + */ + shutdown: function (data) { - tint = Utils.getTintAppendFloatAlpha(src.fillLeft, alpha); + var events = this.events; + var settings = this.settings; - if (reversed) - { - x0 = calcMatrix.getX(-sizeA, -height); - y0 = calcMatrix.getY(-sizeA, -height); + events.off(Events.TRANSITION_INIT); + events.off(Events.TRANSITION_START); + events.off(Events.TRANSITION_COMPLETE); + events.off(Events.TRANSITION_OUT); - x1 = calcMatrix.getX(0, sizeB); - y1 = calcMatrix.getY(0, sizeB); + settings.status = CONST.SHUTDOWN; - x2 = calcMatrix.getX(0, sizeB - height); - y2 = calcMatrix.getY(0, sizeB - height); - } - else - { - x0 = calcMatrix.getX(-sizeA, 0); - y0 = calcMatrix.getY(-sizeA, 0); + settings.active = false; + settings.visible = false; - x1 = calcMatrix.getX(0, sizeB); - y1 = calcMatrix.getY(0, sizeB); + events.emit(Events.SHUTDOWN, this, data); + }, - x2 = calcMatrix.getX(0, sizeB - height); - y2 = calcMatrix.getY(0, sizeB - height); - } + /** + * Destroy this Scene and send a destroy event all of its systems. + * A destroyed Scene cannot be restarted. + * You should not call this directly, instead use `SceneManager.remove`. + * + * @method Phaser.Scenes.Systems#destroy + * @private + * @fires Phaser.Scenes.Events#DESTROY + * @since 3.0.0 + */ + destroy: function () + { + var events = this.events; + var settings = this.settings; - pipeline.batchTri(src, x0, y0, x1, y1, x2, y2, 0, 0, 1, 1, tint, tint, tint, 2); - } + settings.status = CONST.DESTROYED; - // Right Face + settings.active = false; + settings.visible = false; - if (src.showRight) - { - tint = Utils.getTintAppendFloatAlpha(src.fillRight, alpha); + events.emit(Events.DESTROY, this); - if (reversed) - { - x0 = calcMatrix.getX(sizeA, -height); - y0 = calcMatrix.getY(sizeA, -height); + events.removeAllListeners(); - x1 = calcMatrix.getX(0, sizeB); - y1 = calcMatrix.getY(0, sizeB); + var props = [ 'scene', 'game', 'anims', 'cache', 'plugins', 'registry', 'sound', 'textures', 'add', 'camera', 'displayList', 'events', 'make', 'scenePlugin', 'updateList' ]; - x2 = calcMatrix.getX(0, sizeB - height); - y2 = calcMatrix.getY(0, sizeB - height); - } - else + for (var i = 0; i < props.length; i++) { - x0 = calcMatrix.getX(sizeA, 0); - y0 = calcMatrix.getY(sizeA, 0); - - x1 = calcMatrix.getX(0, sizeB); - y1 = calcMatrix.getY(0, sizeB); - - x2 = calcMatrix.getX(0, sizeB - height); - y2 = calcMatrix.getY(0, sizeB - height); + this[props[i]] = null; } - - pipeline.batchTri(src, x0, y0, x1, y1, x2, y2, 0, 0, 1, 1, tint, tint, tint, 2); } - renderer.pipelines.postBatch(src); -}; +}); -module.exports = IsoTriangleWebGLRenderer; +module.exports = Systems; /***/ }), -/* 1114 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 92980: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(48); -var SetTransform = __webpack_require__(30); - /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.IsoTriangle#renderCanvas - * @since 3.13.0 - * @private + * Scene consts. * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.IsoTriangle} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @ignore */ -var IsoTriangleCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - - var ctx = renderer.currentContext; - - if (SetTransform(renderer, ctx, src, camera, parentMatrix) && src.isFilled) - { - var size = src.width; - var height = src.height; - - var sizeA = size / 2; - var sizeB = size / src.projection; - - var reversed = src.isReversed; - - // Top Face - - if (src.showTop && reversed) - { - FillStyleCanvas(ctx, src, src.fillTop); - ctx.beginPath(); - - ctx.moveTo(-sizeA, -height); - ctx.lineTo(0, -sizeB - height); - ctx.lineTo(sizeA, -height); - ctx.lineTo(0, sizeB - height); - - ctx.fill(); - } +var CONST = { - // Left Face + /** + * Scene state. + * + * @name Phaser.Scenes.PENDING + * @readonly + * @type {number} + * @since 3.0.0 + */ + PENDING: 0, - if (src.showLeft) - { - FillStyleCanvas(ctx, src, src.fillLeft); + /** + * Scene state. + * + * @name Phaser.Scenes.INIT + * @readonly + * @type {number} + * @since 3.0.0 + */ + INIT: 1, - ctx.beginPath(); + /** + * Scene state. + * + * @name Phaser.Scenes.START + * @readonly + * @type {number} + * @since 3.0.0 + */ + START: 2, - if (reversed) - { - ctx.moveTo(-sizeA, -height); - ctx.lineTo(0, sizeB); - ctx.lineTo(0, sizeB - height); - } - else - { - ctx.moveTo(-sizeA, 0); - ctx.lineTo(0, sizeB); - ctx.lineTo(0, sizeB - height); - } + /** + * Scene state. + * + * @name Phaser.Scenes.LOADING + * @readonly + * @type {number} + * @since 3.0.0 + */ + LOADING: 3, - ctx.fill(); - } + /** + * Scene state. + * + * @name Phaser.Scenes.CREATING + * @readonly + * @type {number} + * @since 3.0.0 + */ + CREATING: 4, - // Right Face + /** + * Scene state. + * + * @name Phaser.Scenes.RUNNING + * @readonly + * @type {number} + * @since 3.0.0 + */ + RUNNING: 5, - if (src.showRight) - { - FillStyleCanvas(ctx, src, src.fillRight); + /** + * Scene state. + * + * @name Phaser.Scenes.PAUSED + * @readonly + * @type {number} + * @since 3.0.0 + */ + PAUSED: 6, - ctx.beginPath(); + /** + * Scene state. + * + * @name Phaser.Scenes.SLEEPING + * @readonly + * @type {number} + * @since 3.0.0 + */ + SLEEPING: 7, - if (reversed) - { - ctx.moveTo(sizeA, -height); - ctx.lineTo(0, sizeB); - ctx.lineTo(0, sizeB - height); - } - else - { - ctx.moveTo(sizeA, 0); - ctx.lineTo(0, sizeB); - ctx.lineTo(0, sizeB - height); - } + /** + * Scene state. + * + * @name Phaser.Scenes.SHUTDOWN + * @readonly + * @type {number} + * @since 3.0.0 + */ + SHUTDOWN: 8, - ctx.fill(); - } + /** + * Scene state. + * + * @name Phaser.Scenes.DESTROYED + * @readonly + * @type {number} + * @since 3.0.0 + */ + DESTROYED: 9 - // Restore the context saved in SetTransform - ctx.restore(); - } }; -module.exports = IsoTriangleCanvasRenderer; +module.exports = CONST; /***/ }), -/* 1115 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 31803: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); +/** + * The Game Object Added to Scene Event. + * + * This event is dispatched when a Game Object is added to a Scene. + * + * Listen for it from a Scene using `this.events.on('addedtoscene', listener)`. + * + * @event Phaser.Scenes.Events#ADDED_TO_SCENE + * @type {string} + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was added to the Scene. + * @param {Phaser.Scene} scene - The Scene to which the Game Object was added. + */ +module.exports = 'addedtoscene'; -if (true) -{ - renderWebGL = __webpack_require__(1116); -} -if (true) -{ - renderCanvas = __webpack_require__(1117); -} +/***/ }), -module.exports = { +/***/ 94817: +/***/ ((module) => { - renderWebGL: renderWebGL, - renderCanvas: renderCanvas +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -}; +/** + * The Scene Systems Boot Event. + * + * This event is dispatched by a Scene during the Scene Systems boot process. Primarily used by Scene Plugins. + * + * Listen to it from a Scene using `this.events.on('boot', listener)`. + * + * @event Phaser.Scenes.Events#BOOT + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + */ +module.exports = 'boot'; /***/ }), -/* 1116 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 28977: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCalcMatrix = __webpack_require__(19); -var Utils = __webpack_require__(12); - /** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * The Scene Create Event. * - * @method Phaser.GameObjects.Line#renderWebGL - * @since 3.13.0 - * @private + * This event is dispatched by a Scene after it has been created by the Scene Manager. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Line} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * If a Scene has a `create` method then this event is emitted _after_ that has run. + * + * If there is a transition, this event will be fired after the `TRANSITION_START` event. + * + * Listen to it from a Scene using `this.events.on('create', listener)`. + * + * @event Phaser.Scenes.Events#CREATE + * @type {string} + * @since 3.17.0 + * + * @param {Phaser.Scene} scene - A reference to the Scene that emitted this event. */ -var LineWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - - var pipeline = renderer.pipelines.set(src.pipeline); +module.exports = 'create'; - var result = GetCalcMatrix(src, camera, parentMatrix); - pipeline.calcMatrix.copyFrom(result.calc); +/***/ }), - var dx = src._displayOriginX; - var dy = src._displayOriginY; - var alpha = camera.alpha * src.alpha; +/***/ 91959: +/***/ ((module) => { - renderer.pipelines.preBatch(src); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (src.isStroked) - { - var strokeTint = pipeline.strokeTint; - var color = Utils.getTintAppendFloatAlpha(src.strokeColor, src.strokeAlpha * alpha); +/** + * The Scene Systems Destroy Event. + * + * This event is dispatched by a Scene during the Scene Systems destroy process. + * + * Listen to it from a Scene using `this.events.on('destroy', listener)`. + * + * You should destroy any resources that may be in use by your Scene in this event handler. + * + * @event Phaser.Scenes.Events#DESTROY + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + */ +module.exports = 'destroy'; - strokeTint.TL = color; - strokeTint.TR = color; - strokeTint.BL = color; - strokeTint.BR = color; - var startWidth = src._startWidth; - var endWidth = src._endWidth; +/***/ }), - pipeline.batchLine( - src.geom.x1 - dx, - src.geom.y1 - dy, - src.geom.x2 - dx, - src.geom.y2 - dy, - startWidth, - endWidth, - 1, - 0, - false, - result.sprite, - result.camera - ); - } +/***/ 363: +/***/ ((module) => { - renderer.pipelines.postBatch(src); -}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = LineWebGLRenderer; +/** + * The Scene Systems Pause Event. + * + * This event is dispatched by a Scene when it is paused, either directly via the `pause` method, or as an + * action from another Scene. + * + * Listen to it from a Scene using `this.events.on('pause', listener)`. + * + * @event Phaser.Scenes.Events#PAUSE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was paused. + */ +module.exports = 'pause'; /***/ }), -/* 1117 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 15643: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var LineStyleCanvas = __webpack_require__(60); -var SetTransform = __webpack_require__(30); - /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * The Scene Systems Post Update Event. * - * @method Phaser.GameObjects.Line#renderCanvas - * @since 3.13.0 - * @private + * This event is dispatched by a Scene during the main game loop step. * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Line} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [PRE_RENDER]{@linkcode Phaser.Scenes.Events#event:PRE_RENDER} + * 6. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.events.on('postupdate', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#POST_UPDATE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ -var LineCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); +module.exports = 'postupdate'; - var ctx = renderer.currentContext; - if (SetTransform(renderer, ctx, src, camera, parentMatrix)) - { - var dx = src._displayOriginX; - var dy = src._displayOriginY; +/***/ }), - if (src.isStroked) - { - LineStyleCanvas(ctx, src); +/***/ 17058: +/***/ ((module) => { - ctx.beginPath(); +/** + * @author samme + * @copyright 2021 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - ctx.moveTo(src.geom.x1 - dx, src.geom.y1 - dy); - ctx.lineTo(src.geom.x2 - dx, src.geom.y2 - dy); +/** + * The Scene Systems Pre-Render Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [PRE_RENDER]{@linkcode Phaser.Scenes.Events#event:PRE_RENDER} + * 6. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to this event from a Scene using `this.events.on('prerender', listener)`. + * + * A Scene will only render if it is visible. + * + * This event is dispatched after the Scene Display List is sorted and before the Scene is rendered. + * + * @event Phaser.Scenes.Events#PRE_RENDER + * @type {string} + * @since 3.53.0 + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that rendered the Scene. + */ +module.exports = 'prerender'; - ctx.stroke(); - } - // Restore the context saved in SetTransform - ctx.restore(); - } -}; +/***/ }), -module.exports = LineCanvasRenderer; +/***/ 77125: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Scene Systems Pre Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [PRE_RENDER]{@linkcode Phaser.Scenes.Events#event:PRE_RENDER} + * 6. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.events.on('preupdate', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#PRE_UPDATE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'preupdate'; /***/ }), -/* 1118 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 76018: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); +/** + * The Scene Systems Ready Event. + * + * This event is dispatched by a Scene during the Scene Systems start process. + * By this point in the process the Scene is now fully active and rendering. + * This event is meant for your game code to use, as all plugins have responded to the earlier 'start' event. + * + * Listen to it from a Scene using `this.events.on('ready', listener)`. + * + * @event Phaser.Scenes.Events#READY + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was started. + */ +module.exports = 'ready'; -if (true) -{ - renderWebGL = __webpack_require__(1119); -} -if (true) -{ - renderCanvas = __webpack_require__(1120); -} +/***/ }), -module.exports = { +/***/ 28620: +/***/ ((module) => { - renderWebGL: renderWebGL, - renderCanvas: renderCanvas +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -}; +/** + * The Game Object Removed from Scene Event. + * + * This event is dispatched when a Game Object is removed from a Scene. + * + * Listen for it from a Scene using `this.events.on('removedfromscene', listener)`. + * + * @event Phaser.Scenes.Events#REMOVED_FROM_SCENE + * @type {string} + * @since 3.50.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was removed from the Scene. + * @param {Phaser.Scene} scene - The Scene from which the Game Object was removed. + */ +module.exports = 'removedfromscene'; /***/ }), -/* 1119 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 41538: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(114); -var GetCalcMatrix = __webpack_require__(19); -var StrokePathWebGL = __webpack_require__(81); - /** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * The Scene Systems Render Event. * - * @method Phaser.GameObjects.Polygon#renderWebGL - * @since 3.13.0 - * @private + * This event is dispatched by a Scene during the main game loop step. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Polygon} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [PRE_RENDER]{@linkcode Phaser.Scenes.Events#event:PRE_RENDER} + * 6. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.events.on('render', listener)`. + * + * A Scene will only render if it is visible. + * + * By the time this event is dispatched, the Scene will have already been rendered. + * + * @event Phaser.Scenes.Events#RENDER + * @type {string} + * @since 3.0.0 + * + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that rendered the Scene. */ -var PolygonWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - - var pipeline = renderer.pipelines.set(src.pipeline); - - var result = GetCalcMatrix(src, camera, parentMatrix); - - var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); - - var dx = src._displayOriginX; - var dy = src._displayOriginY; - - var alpha = camera.alpha * src.alpha; +module.exports = 'render'; - renderer.pipelines.preBatch(src); - if (src.isFilled) - { - FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); - } +/***/ }), - if (src.isStroked) - { - StrokePathWebGL(pipeline, src, alpha, dx, dy); - } +/***/ 34268: +/***/ ((module) => { - renderer.pipelines.postBatch(src); -}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = PolygonWebGLRenderer; +/** + * The Scene Systems Resume Event. + * + * This event is dispatched by a Scene when it is resumed from a paused state, either directly via the `resume` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.events.on('resume', listener)`. + * + * @event Phaser.Scenes.Events#RESUME + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was resumed. + */ +module.exports = 'resume'; /***/ }), -/* 1120 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 2342: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(48); -var LineStyleCanvas = __webpack_require__(60); -var SetTransform = __webpack_require__(30); - /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * The Scene Systems Shutdown Event. * - * @method Phaser.GameObjects.Polygon#renderCanvas - * @since 3.13.0 - * @private + * This event is dispatched by a Scene during the Scene Systems shutdown process. * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Polygon} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * Listen to it from a Scene using `this.events.on('shutdown', listener)`. + * + * You should free-up any resources that may be in use by your Scene in this event handler, on the understanding + * that the Scene may, at any time, become active again. A shutdown Scene is not 'destroyed', it's simply not + * currently active. Use the [DESTROY]{@linkcode Phaser.Scenes.Events#event:DESTROY} event to completely clear resources. + * + * @event Phaser.Scenes.Events#SHUTDOWN + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was shutdown. */ -var PolygonCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - - var ctx = renderer.currentContext; +module.exports = 'shutdown'; - if (SetTransform(renderer, ctx, src, camera, parentMatrix)) - { - var dx = src._displayOriginX; - var dy = src._displayOriginY; - var path = src.pathData; - var pathLength = path.length - 1; +/***/ }), - var px1 = path[0] - dx; - var py1 = path[1] - dy; +/***/ 96541: +/***/ ((module) => { - ctx.beginPath(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - ctx.moveTo(px1, py1); +/** + * The Scene Systems Sleep Event. + * + * This event is dispatched by a Scene when it is sent to sleep, either directly via the `sleep` method, + * or as an action from another Scene. + * + * Listen to it from a Scene using `this.events.on('sleep', listener)`. + * + * @event Phaser.Scenes.Events#SLEEP + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was sent to sleep. + */ +module.exports = 'sleep'; - if (!src.closePath) - { - pathLength -= 2; - } - for (var i = 2; i < pathLength; i += 2) - { - var px2 = path[i] - dx; - var py2 = path[i + 1] - dy; +/***/ }), - ctx.lineTo(px2, py2); - } +/***/ 74244: +/***/ ((module) => { - ctx.closePath(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (src.isFilled) - { - FillStyleCanvas(ctx, src); +/** + * The Scene Systems Start Event. + * + * This event is dispatched by a Scene during the Scene Systems start process. Primarily used by Scene Plugins. + * + * Listen to it from a Scene using `this.events.on('start', listener)`. + * + * @event Phaser.Scenes.Events#START + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + */ +module.exports = 'start'; - ctx.fill(); - } - if (src.isStroked) - { - LineStyleCanvas(ctx, src); +/***/ }), - ctx.stroke(); - } +/***/ 17046: +/***/ ((module) => { - // Restore the context saved in SetTransform - ctx.restore(); - } -}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = PolygonCanvasRenderer; +/** + * The Scene Transition Complete Event. + * + * This event is dispatched by the Target Scene of a transition. + * + * It happens when the transition process has completed. This occurs when the duration timer equals or exceeds the duration + * of the transition. + * + * Listen to it from a Scene using `this.events.on('transitioncomplete', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_COMPLETE + * @type {string} + * @since 3.5.0 + * + * @param {Phaser.Scene} scene -The Scene on which the transitioned completed. + */ +module.exports = 'transitioncomplete'; /***/ }), -/* 1121 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 13637: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); +/** + * The Scene Transition Init Event. + * + * This event is dispatched by the Target Scene of a transition. + * + * It happens immediately after the `Scene.init` method is called. If the Scene does not have an `init` method, + * this event is not dispatched. + * + * Listen to it from a Scene using `this.events.on('transitioninit', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_INIT + * @type {string} + * @since 3.5.0 + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. + */ +module.exports = 'transitioninit'; -if (true) -{ - renderWebGL = __webpack_require__(1122); -} -if (true) -{ - renderCanvas = __webpack_require__(1123); -} +/***/ }), -module.exports = { +/***/ 14733: +/***/ ((module) => { - renderWebGL: renderWebGL, - renderCanvas: renderCanvas +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -}; +/** + * The Scene Transition Out Event. + * + * This event is dispatched by a Scene when it initiates a transition to another Scene. + * + * Listen to it from a Scene using `this.events.on('transitionout', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_OUT + * @type {string} + * @since 3.5.0 + * + * @param {Phaser.Scene} target - A reference to the Scene that is being transitioned to. + * @param {number} duration - The duration of the transition in ms. + */ +module.exports = 'transitionout'; /***/ }), -/* 1122 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 33899: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetCalcMatrix = __webpack_require__(19); -var StrokePathWebGL = __webpack_require__(81); -var Utils = __webpack_require__(12); - /** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * The Scene Transition Start Event. * - * @method Phaser.GameObjects.Rectangle#renderWebGL - * @since 3.13.0 - * @private + * This event is dispatched by the Target Scene of a transition, only if that Scene was not asleep. * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Rectangle} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * It happens immediately after the `Scene.create` method is called. If the Scene does not have a `create` method, + * this event is dispatched anyway. + * + * If the Target Scene was sleeping then the [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} event is + * dispatched instead of this event. + * + * Listen to it from a Scene using `this.events.on('transitionstart', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_START + * @type {string} + * @since 3.5.0 + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. */ -var RectangleWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - - var pipeline = renderer.pipelines.set(src.pipeline); +module.exports = 'transitionstart'; - var result = GetCalcMatrix(src, camera, parentMatrix); - pipeline.calcMatrix.copyFrom(result.calc); +/***/ }), - var dx = src._displayOriginX; - var dy = src._displayOriginY; - var alpha = camera.alpha * src.alpha; +/***/ 52418: +/***/ ((module) => { - renderer.pipelines.preBatch(src); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (src.isFilled) - { - var fillTint = pipeline.fillTint; - var fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); +/** + * The Scene Transition Wake Event. + * + * This event is dispatched by the Target Scene of a transition, only if that Scene was asleep before + * the transition began. If the Scene was not asleep the [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} event is dispatched instead. + * + * Listen to it from a Scene using `this.events.on('transitionwake', listener)`. + * + * The Scene Transition event flow is as follows: + * + * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event. + * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method. + * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ... + * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to. + * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes. + * + * @event Phaser.Scenes.Events#TRANSITION_WAKE + * @type {string} + * @since 3.5.0 + * + * @param {Phaser.Scene} from - A reference to the Scene that is being transitioned from. + * @param {number} duration - The duration of the transition in ms. + */ +module.exports = 'transitionwake'; - fillTint.TL = fillTintColor; - fillTint.TR = fillTintColor; - fillTint.BL = fillTintColor; - fillTint.BR = fillTintColor; - pipeline.batchFillRect( - -dx, - -dy, - src.width, - src.height - ); - } +/***/ }), - if (src.isStroked) - { - StrokePathWebGL(pipeline, src, alpha, dx, dy); - } +/***/ 31735: +/***/ ((module) => { - renderer.pipelines.postBatch(src); -}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = RectangleWebGLRenderer; +/** + * The Scene Systems Update Event. + * + * This event is dispatched by a Scene during the main game loop step. + * + * The event flow for a single step of a Scene is as follows: + * + * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE} + * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE} + * 3. The `Scene.update` method is called, if it exists and the Scene is in a Running state, otherwise this is skipped. + * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE} + * 5. [PRE_RENDER]{@linkcode Phaser.Scenes.Events#event:PRE_RENDER} + * 6. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER} + * + * Listen to it from a Scene using `this.events.on('update', listener)`. + * + * A Scene will only run its step if it is active. + * + * @event Phaser.Scenes.Events#UPDATE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ +module.exports = 'update'; /***/ }), -/* 1123 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 8470: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillStyleCanvas = __webpack_require__(48); -var LineStyleCanvas = __webpack_require__(60); -var SetTransform = __webpack_require__(30); - /** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * The Scene Systems Wake Event. * - * @method Phaser.GameObjects.Rectangle#renderCanvas - * @since 3.13.0 - * @private + * This event is dispatched by a Scene when it is woken from sleep, either directly via the `wake` method, + * or as an action from another Scene. * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Rectangle} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * Listen to it from a Scene using `this.events.on('wake', listener)`. + * + * @event Phaser.Scenes.Events#WAKE + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Scenes.Systems} sys - A reference to the Scene Systems class of the Scene that emitted this event. + * @param {any} [data] - An optional data object that was passed to this Scene when it was woken up. */ -var RectangleCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - - var ctx = renderer.currentContext; +module.exports = 'wake'; - if (SetTransform(renderer, ctx, src, camera, parentMatrix)) - { - var dx = src._displayOriginX; - var dy = src._displayOriginY; - if (src.isFilled) - { - FillStyleCanvas(ctx, src); +/***/ }), - ctx.fillRect( - -dx, - -dy, - src.width, - src.height - ); - } +/***/ 7599: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (src.isStroked) - { - LineStyleCanvas(ctx, src); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - ctx.beginPath(); +/** + * @namespace Phaser.Scenes.Events + */ - ctx.rect( - -dx, - -dy, - src.width, - src.height - ); +module.exports = { - ctx.stroke(); - } + ADDED_TO_SCENE: __webpack_require__(31803), + BOOT: __webpack_require__(94817), + CREATE: __webpack_require__(28977), + DESTROY: __webpack_require__(91959), + PAUSE: __webpack_require__(363), + POST_UPDATE: __webpack_require__(15643), + PRE_RENDER: __webpack_require__(17058), + PRE_UPDATE: __webpack_require__(77125), + READY: __webpack_require__(76018), + REMOVED_FROM_SCENE: __webpack_require__(28620), + RENDER: __webpack_require__(41538), + RESUME: __webpack_require__(34268), + SHUTDOWN: __webpack_require__(2342), + SLEEP: __webpack_require__(96541), + START: __webpack_require__(74244), + TRANSITION_COMPLETE: __webpack_require__(17046), + TRANSITION_INIT: __webpack_require__(13637), + TRANSITION_OUT: __webpack_require__(14733), + TRANSITION_START: __webpack_require__(33899), + TRANSITION_WAKE: __webpack_require__(52418), + UPDATE: __webpack_require__(31735), + WAKE: __webpack_require__(8470) - // Restore the context saved in SetTransform - ctx.restore(); - } }; -module.exports = RectangleCanvasRenderer; - /***/ }), -/* 1124 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 20436: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); +var CONST = __webpack_require__(92980); +var Extend = __webpack_require__(98611); -if (true) -{ - renderWebGL = __webpack_require__(1125); -} - -if (true) -{ - renderCanvas = __webpack_require__(1126); -} +/** + * @namespace Phaser.Scenes + */ -module.exports = { +var Scene = { - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + Events: __webpack_require__(7599), + GetPhysicsPlugins: __webpack_require__(47736), + GetScenePlugins: __webpack_require__(91088), + SceneManager: __webpack_require__(13553), + ScenePlugin: __webpack_require__(64051), + Settings: __webpack_require__(36765), + Systems: __webpack_require__(63946) }; +// Merge in the consts +Scene = Extend(false, Scene, CONST); + +module.exports = Scene; + /***/ }), -/* 1125 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 25798: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Pavle Goloskokovic (http://prunegames.com) + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var FillPathWebGL = __webpack_require__(114); -var GetCalcMatrix = __webpack_require__(19); -var StrokePathWebGL = __webpack_require__(81); +var Class = __webpack_require__(56694); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(76038); +var Extend = __webpack_require__(98611); +var NOOP = __webpack_require__(72283); /** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. + * @classdesc + * Class containing all the shared state and behavior of a sound object, independent of the implementation. * - * @method Phaser.GameObjects.Star#renderWebGL - * @since 3.13.0 - * @private + * @class BaseSound + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Sound + * @constructor + * @since 3.0.0 * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Star} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + * @param {Phaser.Sound.BaseSoundManager} manager - Reference to the current sound manager instance. + * @param {string} key - Asset key for the sound. + * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. */ -var StarWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); - - var pipeline = renderer.pipelines.set(src.pipeline); - - var result = GetCalcMatrix(src, camera, parentMatrix); - - var calcMatrix = pipeline.calcMatrix.copyFrom(result.calc); - - var dx = src._displayOriginX; - var dy = src._displayOriginY; +var BaseSound = new Class({ - var alpha = camera.alpha * src.alpha; + Extends: EventEmitter, - renderer.pipelines.preBatch(src); + initialize: - if (src.isFilled) + function BaseSound (manager, key, config) { - FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy); - } + EventEmitter.call(this); - if (src.isStroked) - { - StrokePathWebGL(pipeline, src, alpha, dx, dy); - } + /** + * Local reference to the sound manager. + * + * @name Phaser.Sound.BaseSound#manager + * @type {Phaser.Sound.BaseSoundManager} + * @since 3.0.0 + */ + this.manager = manager; - renderer.pipelines.postBatch(src); -}; + /** + * Asset key for the sound. + * + * @name Phaser.Sound.BaseSound#key + * @type {string} + * @readonly + * @since 3.0.0 + */ + this.key = key; -module.exports = StarWebGLRenderer; + /** + * Flag indicating if sound is currently playing. + * + * @name Phaser.Sound.BaseSound#isPlaying + * @type {boolean} + * @default false + * @readonly + * @since 3.0.0 + */ + this.isPlaying = false; + /** + * Flag indicating if sound is currently paused. + * + * @name Phaser.Sound.BaseSound#isPaused + * @type {boolean} + * @default false + * @readonly + * @since 3.0.0 + */ + this.isPaused = false; -/***/ }), -/* 1126 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * A property that holds the value of sound's actual playback rate, + * after its rate and detune values has been combined with global + * rate and detune values. + * + * @name Phaser.Sound.BaseSound#totalRate + * @type {number} + * @default 1 + * @readonly + * @since 3.0.0 + */ + this.totalRate = 1; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A value representing the duration, in seconds. + * It could be total sound duration or a marker duration. + * + * @name Phaser.Sound.BaseSound#duration + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.duration = this.duration || 0; -var FillStyleCanvas = __webpack_require__(48); -var LineStyleCanvas = __webpack_require__(60); -var SetTransform = __webpack_require__(30); + /** + * The total duration of the sound in seconds. + * + * @name Phaser.Sound.BaseSound#totalDuration + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.totalDuration = this.totalDuration || 0; -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Star#renderCanvas - * @since 3.13.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Star} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var StarCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + /** + * A config object used to store default sound settings' values. + * Default values will be set by properties' setters. + * + * @name Phaser.Sound.BaseSound#config + * @type {Phaser.Types.Sound.SoundConfig} + * @private + * @since 3.0.0 + */ + this.config = { - var ctx = renderer.currentContext; + mute: false, + volume: 1, + rate: 1, + detune: 0, + seek: 0, + loop: false, + delay: 0, + pan: 0 - if (SetTransform(renderer, ctx, src, camera, parentMatrix)) - { - var dx = src._displayOriginX; - var dy = src._displayOriginY; + }; - var path = src.pathData; - var pathLength = path.length - 1; + /** + * Reference to the currently used config. + * It could be default config or marker config. + * + * @name Phaser.Sound.BaseSound#currentConfig + * @type {Phaser.Types.Sound.SoundConfig} + * @private + * @since 3.0.0 + */ + this.currentConfig = this.config; - var px1 = path[0] - dx; - var py1 = path[1] - dy; + this.config = Extend(this.config, config); - ctx.beginPath(); + /** + * Object containing markers definitions. + * + * @name Phaser.Sound.BaseSound#markers + * @type {Object.} + * @default {} + * @readonly + * @since 3.0.0 + */ + this.markers = {}; - ctx.moveTo(px1, py1); + /** + * Currently playing marker. + * 'null' if whole sound is playing. + * + * @name Phaser.Sound.BaseSound#currentMarker + * @type {Phaser.Types.Sound.SoundMarker} + * @default null + * @readonly + * @since 3.0.0 + */ + this.currentMarker = null; - if (!src.closePath) + /** + * Flag indicating if destroy method was called on this sound. + * + * @name Phaser.Sound.BaseSound#pendingRemove + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.pendingRemove = false; + }, + + /** + * Adds a marker into the current sound. A marker is represented by name, start time, duration, and optionally config object. + * This allows you to bundle multiple sounds together into a single audio file and use markers to jump between them for playback. + * + * @method Phaser.Sound.BaseSound#addMarker + * @since 3.0.0 + * + * @param {Phaser.Types.Sound.SoundMarker} marker - Marker object. + * + * @return {boolean} Whether the marker was added successfully. + */ + addMarker: function (marker) + { + if (!marker || !marker.name || typeof marker.name !== 'string') { - pathLength -= 2; + return false; } - for (var i = 2; i < pathLength; i += 2) + if (this.markers[marker.name]) { - var px2 = path[i] - dx; - var py2 = path[i + 1] - dy; + // eslint-disable-next-line no-console + console.error('addMarker ' + marker.name + ' already exists in Sound'); - ctx.lineTo(px2, py2); + return false; } - ctx.closePath(); + marker = Extend(true, { + name: '', + start: 0, + duration: this.totalDuration - (marker.start || 0), + config: { + mute: false, + volume: 1, + rate: 1, + detune: 0, + seek: 0, + loop: false, + delay: 0, + pan: 0 + } + }, marker); - if (src.isFilled) - { - FillStyleCanvas(ctx, src); + this.markers[marker.name] = marker; - ctx.fill(); - } + return true; + }, - if (src.isStroked) + /** + * Updates previously added marker. + * + * @method Phaser.Sound.BaseSound#updateMarker + * @since 3.0.0 + * + * @param {Phaser.Types.Sound.SoundMarker} marker - Marker object with updated values. + * + * @return {boolean} Whether the marker was updated successfully. + */ + updateMarker: function (marker) + { + if (!marker || !marker.name || typeof marker.name !== 'string') { - LineStyleCanvas(ctx, src); - - ctx.stroke(); + return false; } - // Restore the context saved in SetTransform - ctx.restore(); - } -}; - -module.exports = StarCanvasRenderer; - - -/***/ }), -/* 1127 */ -/***/ (function(module, exports, __webpack_require__) { + if (!this.markers[marker.name]) + { + // eslint-disable-next-line no-console + console.warn('Audio Marker: ' + marker.name + ' missing in Sound: ' + this.key); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return false; + } -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + this.markers[marker.name] = Extend(true, this.markers[marker.name], marker); -if (true) -{ - renderWebGL = __webpack_require__(1128); -} + return true; + }, -if (true) -{ - renderCanvas = __webpack_require__(1129); -} + /** + * Removes a marker from the sound. + * + * @method Phaser.Sound.BaseSound#removeMarker + * @since 3.0.0 + * + * @param {string} markerName - The name of the marker to remove. + * + * @return {?Phaser.Types.Sound.SoundMarker} Removed marker object or 'null' if there was no marker with provided name. + */ + removeMarker: function (markerName) + { + var marker = this.markers[markerName]; -module.exports = { + if (!marker) + { + return null; + } - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + this.markers[markerName] = null; -}; + return marker; + }, + /** + * Play this sound, or a marked section of it. + * + * It always plays the sound from the start. If you want to start playback from a specific time + * you can set 'seek' setting of the config object, provided to this call, to that value. + * + * @method Phaser.Sound.BaseSound#play + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Sound.SoundConfig)} [markerName=''] - If you want to play a marker then provide the marker name here. Alternatively, this parameter can be a SoundConfig object. + * @param {Phaser.Types.Sound.SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound. + * + * @return {boolean} Whether the sound started playing successfully. + */ + play: function (markerName, config) + { + if (markerName === undefined) { markerName = ''; } -/***/ }), -/* 1128 */ -/***/ (function(module, exports, __webpack_require__) { + if (typeof markerName === 'object') + { + config = markerName; + markerName = ''; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (typeof markerName !== 'string') + { + return false; + } -var GetCalcMatrix = __webpack_require__(19); -var StrokePathWebGL = __webpack_require__(81); -var Utils = __webpack_require__(12); + if (!markerName) + { + this.currentMarker = null; + this.currentConfig = this.config; + this.duration = this.totalDuration; + } + else + { + if (!this.markers[markerName]) + { + // eslint-disable-next-line no-console + console.warn('Marker: ' + markerName + ' missing in Sound: ' + this.key); -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Triangle#renderWebGL - * @since 3.13.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Triangle} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var TriangleWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + return false; + } - var pipeline = renderer.pipelines.set(src.pipeline); + this.currentMarker = this.markers[markerName]; + this.currentConfig = this.currentMarker.config; + this.duration = this.currentMarker.duration; + } - var result = GetCalcMatrix(src, camera, parentMatrix); + this.resetConfig(); - pipeline.calcMatrix.copyFrom(result.calc); + this.currentConfig = Extend(this.currentConfig, config); - var dx = src._displayOriginX; - var dy = src._displayOriginY; - var alpha = camera.alpha * src.alpha; + this.isPlaying = true; + this.isPaused = false; - renderer.pipelines.preBatch(src); + return true; + }, - if (src.isFilled) + /** + * Pauses the sound. This only works if the sound is currently playing. + * + * You can inspect the `isPlaying` and `isPaused` properties to check the state. + * + * @method Phaser.Sound.BaseSound#pause + * @since 3.0.0 + * + * @return {boolean} Whether the sound was paused successfully. + */ + pause: function () { - var fillTint = pipeline.fillTint; - var fillTintColor = Utils.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); - - fillTint.TL = fillTintColor; - fillTint.TR = fillTintColor; - fillTint.BL = fillTintColor; - fillTint.BR = fillTintColor; + if (this.isPaused || !this.isPlaying) + { + return false; + } - var x1 = src.geom.x1 - dx; - var y1 = src.geom.y1 - dy; - var x2 = src.geom.x2 - dx; - var y2 = src.geom.y2 - dy; - var x3 = src.geom.x3 - dx; - var y3 = src.geom.y3 - dy; + this.isPlaying = false; + this.isPaused = true; - pipeline.batchFillTriangle( - x1, - y1, - x2, - y2, - x3, - y3, - result.sprite, - result.camera - ); - } + return true; + }, - if (src.isStroked) + /** + * Resumes the sound. This only works if the sound is paused and not already playing. + * + * You can inspect the `isPlaying` and `isPaused` properties to check the state. + * + * @method Phaser.Sound.BaseSound#resume + * @since 3.0.0 + * + * @return {boolean} Whether the sound was resumed successfully. + */ + resume: function () { - StrokePathWebGL(pipeline, src, alpha, dx, dy); - } - - renderer.pipelines.postBatch(src); -}; - -module.exports = TriangleWebGLRenderer; + if (!this.isPaused || this.isPlaying) + { + return false; + } + this.isPlaying = true; + this.isPaused = false; -/***/ }), -/* 1129 */ -/***/ (function(module, exports, __webpack_require__) { + return true; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Stop playing this sound. + * + * @method Phaser.Sound.BaseSound#stop + * @since 3.0.0 + * + * @return {boolean} Whether the sound was stopped successfully. + */ + stop: function () + { + if (!this.isPaused && !this.isPlaying) + { + return false; + } -var FillStyleCanvas = __webpack_require__(48); -var LineStyleCanvas = __webpack_require__(60); -var SetTransform = __webpack_require__(30); + this.isPlaying = false; + this.isPaused = false; -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Triangle#renderCanvas - * @since 3.13.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Triangle} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var TriangleCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + this.resetConfig(); - var ctx = renderer.currentContext; + return true; + }, - if (SetTransform(renderer, ctx, src, camera, parentMatrix)) + /** + * Method used internally for applying config values to some of the sound properties. + * + * @method Phaser.Sound.BaseSound#applyConfig + * @since 3.0.0 + */ + applyConfig: function () { - var dx = src._displayOriginX; - var dy = src._displayOriginY; + this.mute = this.currentConfig.mute; + this.volume = this.currentConfig.volume; + this.rate = this.currentConfig.rate; + this.detune = this.currentConfig.detune; + this.loop = this.currentConfig.loop; + this.pan = this.currentConfig.pan; + }, - var x1 = src.geom.x1 - dx; - var y1 = src.geom.y1 - dy; - var x2 = src.geom.x2 - dx; - var y2 = src.geom.y2 - dy; - var x3 = src.geom.x3 - dx; - var y3 = src.geom.y3 - dy; + /** + * Method used internally for resetting values of some of the config properties. + * + * @method Phaser.Sound.BaseSound#resetConfig + * @since 3.0.0 + */ + resetConfig: function () + { + this.currentConfig.seek = 0; + this.currentConfig.delay = 0; + }, - ctx.beginPath(); + /** + * Update method called automatically by sound manager on every game step. + * + * @method Phaser.Sound.BaseSound#update + * @since 3.0.0 + * + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time elapsed since the last frame. + */ + update: NOOP, - ctx.moveTo(x1, y1); - ctx.lineTo(x2, y2); - ctx.lineTo(x3, y3); + /** + * Method used internally to calculate total playback rate of the sound. + * + * @method Phaser.Sound.BaseSound#calculateRate + * @since 3.0.0 + */ + calculateRate: function () + { + var cent = 1.0005777895065548; // Math.pow(2, 1/1200); + var totalDetune = this.currentConfig.detune + this.manager.detune; + var detuneRate = Math.pow(cent, totalDetune); - ctx.closePath(); + this.totalRate = this.currentConfig.rate * this.manager.rate * detuneRate; + }, - if (src.isFilled) + /** + * Destroys this sound and all associated events and marks it for removal from the sound manager. + * + * @method Phaser.Sound.BaseSound#destroy + * @fires Phaser.Sound.Events#DESTROY + * @since 3.0.0 + */ + destroy: function () + { + if (this.pendingRemove) { - FillStyleCanvas(ctx, src); - - ctx.fill(); + return; } - if (src.isStroked) - { - LineStyleCanvas(ctx, src); + this.emit(Events.DESTROY, this); - ctx.stroke(); - } + this.removeAllListeners(); - // Restore the context saved in SetTransform - ctx.restore(); + this.pendingRemove = true; + + this.manager = null; + this.config = null; + this.currentConfig = null; + this.markers = null; + this.currentMarker = null; } -}; -module.exports = TriangleCanvasRenderer; +}); + +module.exports = BaseSound; /***/ }), -/* 1130 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 12486: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Pavle Goloskokovic (http://prunegames.com) + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Blitter = __webpack_require__(213); -var GameObjectFactory = __webpack_require__(5); +var Class = __webpack_require__(56694); +var Clone = __webpack_require__(32742); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(76038); +var GameEvents = __webpack_require__(97081); +var GetAll = __webpack_require__(71608); +var GetFirst = __webpack_require__(51463); +var NOOP = __webpack_require__(72283); +var Vector2 = __webpack_require__(93736); /** - * Creates a new Blitter Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Blitter Game Object has been built into Phaser. + * @classdesc + * Base class for other Sound Manager classes. * - * @method Phaser.GameObjects.GameObjectFactory#blitter + * @class BaseSoundManager + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Sound + * @constructor * @since 3.0.0 * - * @param {number} x - The x position of the Game Object. - * @param {number} y - The y position of the Game Object. - * @param {string} key - The key of the Texture the Blitter object will use. - * @param {(string|number)} [frame] - The default Frame children of the Blitter will use. + * @param {Phaser.Game} game - Reference to the current game instance. * - * @return {Phaser.GameObjects.Blitter} The Game Object that was created. + * @see Phaser.Sound.HTML5AudioSoundManager + * @see Phaser.Sound.NoAudioSoundManager + * @see Phaser.Sound.WebAudioSoundManager */ -GameObjectFactory.register('blitter', function (x, y, key, frame) -{ - return this.displayList.add(new Blitter(this.scene, x, y, key, frame)); -}); - -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns +var BaseSoundManager = new Class({ + Extends: EventEmitter, -/***/ }), -/* 1131 */ -/***/ (function(module, exports, __webpack_require__) { + initialize: -/** - * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + function BaseSoundManager (game) + { + EventEmitter.call(this); -var Container = __webpack_require__(214); -var GameObjectFactory = __webpack_require__(5); + /** + * Local reference to game. + * + * @name Phaser.Sound.BaseSoundManager#game + * @type {Phaser.Game} + * @readonly + * @since 3.0.0 + */ + this.game = game; -/** - * Creates a new Container Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Container Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#container - * @since 3.4.0 - * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Container. - * - * @return {Phaser.GameObjects.Container} The Game Object that was created. - */ -GameObjectFactory.register('container', function (x, y, children) -{ - return this.displayList.add(new Container(this.scene, x, y, children)); -}); + /** + * Local reference to the JSON Cache, as used by Audio Sprites. + * + * @name Phaser.Sound.BaseSoundManager#jsonCache + * @type {Phaser.Cache.BaseCache} + * @readonly + * @since 3.7.0 + */ + this.jsonCache = game.cache.json; + /** + * An array containing all added sounds. + * + * @name Phaser.Sound.BaseSoundManager#sounds + * @type {Phaser.Sound.BaseSound[]} + * @default [] + * @private + * @since 3.0.0 + */ + this.sounds = []; -/***/ }), -/* 1132 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Global mute setting. + * + * @name Phaser.Sound.BaseSoundManager#mute + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.mute = false; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Global volume setting. + * + * @name Phaser.Sound.BaseSoundManager#volume + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.volume = 1; -var DOMElement = __webpack_require__(442); -var GameObjectFactory = __webpack_require__(5); + /** + * Flag indicating if sounds should be paused when game looses focus, + * for instance when user switches to another tab/program/app. + * + * @name Phaser.Sound.BaseSoundManager#pauseOnBlur + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.pauseOnBlur = true; -/** - * DOM Element Game Objects are a way to control and manipulate HTML Elements over the top of your game. - * - * In order for DOM Elements to display you have to enable them by adding the following to your game - * configuration object: - * - * ```javascript - * dom { - * createContainer: true - * } - * ``` - * - * When this is added, Phaser will automatically create a DOM Container div that is positioned over the top - * of the game canvas. This div is sized to match the canvas, and if the canvas size changes, as a result of - * settings within the Scale Manager, the dom container is resized accordingly. - * - * You can create a DOM Element by either passing in DOMStrings, or by passing in a reference to an existing - * Element that you wish to be placed under the control of Phaser. For example: - * - * ```javascript - * this.add.dom(x, y, 'div', 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser'); - * ``` - * - * The above code will insert a div element into the DOM Container at the given x/y coordinate. The DOMString in - * the 4th argument sets the initial CSS style of the div and the final argument is the inner text. In this case, - * it will create a lime colored div that is 220px by 100px in size with the text Phaser in it, in an Arial font. - * - * You should nearly always, without exception, use explicitly sized HTML Elements, in order to fully control - * alignment and positioning of the elements next to regular game content. - * - * Rather than specify the CSS and HTML directly you can use the `load.html` File Loader to load it into the - * cache and then use the `createFromCache` method instead. You can also use `createFromHTML` and various other - * methods available in this class to help construct your elements. - * - * Once the element has been created you can then control it like you would any other Game Object. You can set its - * position, scale, rotation, alpha and other properties. It will move as the main Scene Camera moves and be clipped - * at the edge of the canvas. It's important to remember some limitations of DOM Elements: The obvious one is that - * they appear above or below your game canvas. You cannot blend them into the display list, meaning you cannot have - * a DOM Element, then a Sprite, then another DOM Element behind it. - * - * They also cannot be enabled for input. To do that, you have to use the `addListener` method to add native event - * listeners directly. The final limitation is to do with cameras. The DOM Container is sized to match the game canvas - * entirely and clipped accordingly. DOM Elements respect camera scrolling and scrollFactor settings, but if you - * change the size of the camera so it no longer matches the size of the canvas, they won't be clipped accordingly. - * - * Also, all DOM Elements are inserted into the same DOM Container, regardless of which Scene they are created in. - * - * DOM Elements are a powerful way to align native HTML with your Phaser Game Objects. For example, you can insert - * a login form for a multiplayer game directly into your title screen. Or a text input box for a highscore table. - * Or a banner ad from a 3rd party service. Or perhaps you'd like to use them for high resolution text display and - * UI. The choice is up to you, just remember that you're dealing with standard HTML and CSS floating over the top - * of your game, and should treat it accordingly. - * - * Note: This method will only be available if the DOM Element Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#dom - * @since 3.17.0 - * - * @param {number} x - The horizontal position of this DOM Element in the world. - * @param {number} y - The vertical position of this DOM Element in the world. - * @param {(HTMLElement|string)} [element] - An existing DOM element, or a string. If a string starting with a # it will do a `getElementById` look-up on the string (minus the hash). Without a hash, it represents the type of element to create, i.e. 'div'. - * @param {(string|any)} [style] - If a string, will be set directly as the elements `style` property value. If a plain object, will be iterated and the values transferred. In both cases the values replacing whatever CSS styles may have been previously set. - * @param {string} [innerText] - If given, will be set directly as the elements `innerText` property value, replacing whatever was there before. - * - * @return {Phaser.GameObjects.DOMElement} The Game Object that was created. - */ -GameObjectFactory.register('dom', function (x, y, element, style, innerText) -{ - var gameObject = new DOMElement(this.scene, x, y, element, style, innerText); + /** + * Property that actually holds the value of global playback rate. + * + * @name Phaser.Sound.BaseSoundManager#_rate + * @type {number} + * @private + * @default 1 + * @since 3.0.0 + */ + this._rate = 1; - this.displayList.add(gameObject); + /** + * Property that actually holds the value of global detune. + * + * @name Phaser.Sound.BaseSoundManager#_detune + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._detune = 0; - return gameObject; -}); + /** + * Mobile devices require sounds to be triggered from an explicit user action, + * such as a tap, before any sound can be loaded/played on a web page. + * Set to true if the audio system is currently locked awaiting user interaction. + * + * @name Phaser.Sound.BaseSoundManager#locked + * @type {boolean} + * @readonly + * @since 3.0.0 + */ + this.locked = this.locked || false; + /** + * Flag used internally for handling when the audio system + * has been unlocked, if there ever was a need for it. + * + * @name Phaser.Sound.BaseSoundManager#unlocked + * @type {boolean} + * @default false + * @private + * @since 3.0.0 + */ + this.unlocked = false; -/***/ }), -/* 1133 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Flag used to track if the game has lost focus. + * + * @name Phaser.Sound.BaseSoundManager#gameLostFocus + * @type {boolean} + * @default false + * @since 3.60.0 + */ + this.gameLostFocus = false; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The Spatial Audio listener position. + * + * Only available with WebAudio. + * + * You can modify the x/y properties of this Vec2 directly to + * adjust the listener position within the game world. + * + * @name Phaser.Sound.BaseSoundManager#listenerPosition + * @type {Phaser.Math.Vector2} + * @since 3.60.0 + */ + this.listenerPosition = new Vector2(); -var DynamicBitmapText = __webpack_require__(215); -var GameObjectFactory = __webpack_require__(5); + game.events.on(GameEvents.BLUR, this.onGameBlur, this); + game.events.on(GameEvents.FOCUS, this.onGameFocus, this); + game.events.on(GameEvents.PRE_STEP, this.update, this); + game.events.once(GameEvents.DESTROY, this.destroy, this); + }, -/** - * Creates a new Dynamic Bitmap Text Game Object and adds it to the Scene. - * - * BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure. - * - * During rendering for each letter of the text is rendered to the display, proportionally spaced out and aligned to - * match the font structure. - * - * Dynamic Bitmap Text objects are different from Static Bitmap Text in that they invoke a callback for each - * letter being rendered during the render pass. This callback allows you to manipulate the properties of - * each letter being rendered, such as its position, scale or tint, allowing you to create interesting effects - * like jiggling text, which can't be done with Static text. This means that Dynamic Text takes more processing - * time, so only use them if you require the callback ability they have. - * - * BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability - * to use Web Fonts, however you trade this flexibility for rendering speed. You can also create visually compelling BitmapTexts by - * processing the font texture in an image editor, applying fills and any other effects required. - * - * To create multi-line text insert \r, \n or \r\n escape codes into the text string. - * - * To create a BitmapText data files you need a 3rd party app such as: - * - * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/ - * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner - * Littera (Web-based, free): http://kvazars.com/littera/ - * - * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of - * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson - * - * Note: This method will only be available if the Dynamic Bitmap Text Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#dynamicBitmapText - * @since 3.0.0 - * - * @param {number} x - The x position of the Game Object. - * @param {number} y - The y position of the Game Object. - * @param {string} font - The key of the font to use from the BitmapFont cache. - * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text. - * @param {number} [size] - The font size to set. - * - * @return {Phaser.GameObjects.DynamicBitmapText} The Game Object that was created. - */ -GameObjectFactory.register('dynamicBitmapText', function (x, y, font, text, size) -{ - return this.displayList.add(new DynamicBitmapText(this.scene, x, y, font, text, size)); -}); + /** + * Adds a new sound into the sound manager. + * + * @method Phaser.Sound.BaseSoundManager#add + * @override + * @since 3.0.0 + * + * @param {string} key - Asset key for the sound. + * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. + * + * @return {Phaser.Sound.BaseSound} The new sound instance. + */ + add: NOOP, -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + /** + * Adds a new audio sprite sound into the sound manager. + * Audio Sprites are a combination of audio files and a JSON configuration. + * The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite + * + * @method Phaser.Sound.BaseSoundManager#addAudioSprite + * @since 3.0.0 + * + * @param {string} key - Asset key for the sound. + * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. + * + * @return {(Phaser.Sound.NoAudioSound|Phaser.Sound.HTML5AudioSound|Phaser.Sound.WebAudioSound)} The new audio sprite sound instance. + */ + addAudioSprite: function (key, config) + { + if (config === undefined) { config = {}; } + var sound = this.add(key, config); -/***/ }), -/* 1134 */ -/***/ (function(module, exports, __webpack_require__) { + sound.spritemap = this.jsonCache.get(key).spritemap; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (var markerName in sound.spritemap) + { + if (!sound.spritemap.hasOwnProperty(markerName)) + { + continue; + } -var Extern = __webpack_require__(444); -var GameObjectFactory = __webpack_require__(5); + var markerConfig = Clone(config); -/** - * Creates a new Extern Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Extern Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#extern - * @since 3.16.0 - * - * @return {Phaser.GameObjects.Extern} The Game Object that was created. - */ -GameObjectFactory.register('extern', function () -{ - var extern = new Extern(this.scene); + var marker = sound.spritemap[markerName]; - this.displayList.add(extern); + markerConfig.loop = (marker.hasOwnProperty('loop')) ? marker.loop : false; - return extern; -}); + sound.addMarker({ + name: markerName, + start: marker.start, + duration: marker.end - marker.start, + config: markerConfig + }); + } -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + return sound; + }, + /** + * Gets the first sound in this Sound Manager that matches the given key. + * If none can be found it returns `null`. + * + * @method Phaser.Sound.BaseSoundManager#get + * @since 3.23.0 + * + * @generic {Phaser.Sound.BaseSound} T + * @genericUse {T} - [$return] + * + * @param {string} key - Sound asset key. + * + * @return {?Phaser.Sound.BaseSound} - The sound, or null. + */ + get: function (key) + { + return GetFirst(this.sounds, 'key', key); + }, -/***/ }), -/* 1135 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Gets all sounds in this Sound Manager. + * + * You can optionally specify a key, in which case only Sound instances that match the given key + * will be returned. + * + * @method Phaser.Sound.BaseSoundManager#getAll + * @since 3.23.0 + * + * @generic {Phaser.Sound.BaseSound} T + * @genericUse {T[]} - [$return] + * + * @param {string} [key] - Optional asset key. If given, only Sound instances with this key will be returned. + * + * @return {Phaser.Sound.BaseSound[]} - The sounds, or an empty array. + */ + getAll: function (key) + { + if (key) + { + return GetAll(this.sounds, 'key', key); + } + else + { + return GetAll(this.sounds); + } + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Returns all sounds from this Sound Manager that are currently + * playing. That is, Sound instances that have their `isPlaying` + * property set to `true`. + * + * @method Phaser.Sound.BaseSoundManager#getAllPlaying + * @since 3.60.0 + * + * @generic {Phaser.Sound.BaseSound} T + * @genericUse {T[]} - [$return] + * + * @return {Phaser.Sound.BaseSound[]} - All currently playing sounds, or an empty array. + */ + getAllPlaying: function () + { + return GetAll(this.sounds, 'isPlaying', true); + }, -var Graphics = __webpack_require__(216); -var GameObjectFactory = __webpack_require__(5); + /** + * Adds a new sound to the sound manager and plays it. + * + * The sound will be automatically removed (destroyed) once playback ends. + * + * This lets you play a new sound on the fly without the need to keep a reference to it. + * + * @method Phaser.Sound.BaseSoundManager#play + * @listens Phaser.Sound.Events#COMPLETE + * @since 3.0.0 + * + * @param {string} key - Asset key for the sound. + * @param {(Phaser.Types.Sound.SoundConfig|Phaser.Types.Sound.SoundMarker)} [extra] - An optional additional object containing settings to be applied to the sound. It could be either config or marker object. + * + * @return {boolean} Whether the sound started playing successfully. + */ + play: function (key, extra) + { + var sound = this.add(key); -/** - * Creates a new Graphics Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Graphics Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#graphics - * @since 3.0.0 - * - * @param {Phaser.Types.GameObjects.Graphics.Options} [config] - The Graphics configuration. - * - * @return {Phaser.GameObjects.Graphics} The Game Object that was created. - */ -GameObjectFactory.register('graphics', function (config) -{ - return this.displayList.add(new Graphics(this.scene, config)); -}); + sound.once(Events.COMPLETE, sound.destroy, sound); -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + if (extra) + { + if (extra.name) + { + sound.addMarker(extra); + return sound.play(extra.name); + } + else + { + return sound.play(extra); + } + } + else + { + return sound.play(); + } + }, -/***/ }), -/* 1136 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Adds a new audio sprite sound to the sound manager and plays it. + * The sprite will be automatically removed (destroyed) once playback ends. + * This lets you play a new sound on the fly without the need to keep a reference to it. + * + * @method Phaser.Sound.BaseSoundManager#playAudioSprite + * @listens Phaser.Sound.Events#COMPLETE + * @since 3.0.0 + * + * @param {string} key - Asset key for the sound. + * @param {string} spriteName - The name of the sound sprite to play. + * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. + * + * @return {boolean} Whether the audio sprite sound started playing successfully. + */ + playAudioSprite: function (key, spriteName, config) + { + var sound = this.addAudioSprite(key); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + sound.once(Events.COMPLETE, sound.destroy, sound); -var Group = __webpack_require__(113); -var GameObjectFactory = __webpack_require__(5); + return sound.play(spriteName, config); + }, -/** - * Creates a new Group Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Group Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#group - * @since 3.0.0 - * - * @param {(Phaser.GameObjects.GameObject[]|Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupConfig[])} [children] - Game Objects to add to this Group; or the `config` argument. - * @param {Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} [config] - A Group Configuration object. - * - * @return {Phaser.GameObjects.Group} The Game Object that was created. - */ -GameObjectFactory.register('group', function (children, config) -{ - return this.updateList.add(new Group(this.scene, children, config)); -}); + /** + * Removes a sound from the sound manager. + * The removed sound is destroyed before removal. + * + * @method Phaser.Sound.BaseSoundManager#remove + * @since 3.0.0 + * + * @param {Phaser.Sound.BaseSound} sound - The sound object to remove. + * + * @return {boolean} True if the sound was removed successfully, otherwise false. + */ + remove: function (sound) + { + var index = this.sounds.indexOf(sound); + if (index !== -1) + { + sound.destroy(); -/***/ }), -/* 1137 */ -/***/ (function(module, exports, __webpack_require__) { + this.sounds.splice(index, 1); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return true; + } -var Image = __webpack_require__(125); -var GameObjectFactory = __webpack_require__(5); + return false; + }, -/** - * Creates a new Image Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Image Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#image - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * - * @return {Phaser.GameObjects.Image} The Game Object that was created. - */ -GameObjectFactory.register('image', function (x, y, key, frame) -{ - return this.displayList.add(new Image(this.scene, x, y, key, frame)); -}); + /** + * Removes all sounds from the manager, destroying the sounds. + * + * @method Phaser.Sound.BaseSoundManager#removeAll + * @since 3.23.0 + */ + removeAll: function () + { + this.sounds.forEach(function (sound) + { + sound.destroy(); + }); -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + this.sounds.length = 0; + }, + /** + * Removes all sounds from the sound manager that have an asset key matching the given value. + * The removed sounds are destroyed before removal. + * + * @method Phaser.Sound.BaseSoundManager#removeByKey + * @since 3.0.0 + * + * @param {string} key - The key to match when removing sound objects. + * + * @return {number} The number of matching sound objects that were removed. + */ + removeByKey: function (key) + { + var removed = 0; -/***/ }), -/* 1138 */ -/***/ (function(module, exports, __webpack_require__) { + for (var i = this.sounds.length - 1; i >= 0; i--) + { + var sound = this.sounds[i]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (sound.key === key) + { + sound.destroy(); -var Layer = __webpack_require__(219); -var GameObjectFactory = __webpack_require__(5); + this.sounds.splice(i, 1); -/** - * Creates a new Layer Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Layer Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#layer - * @since 3.50.0 - * - * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Layer. - * - * @return {Phaser.GameObjects.Layer} The Game Object that was created. - */ -GameObjectFactory.register('layer', function (children) -{ - return this.displayList.add(new Layer(this.scene, children)); -}); + removed++; + } + } + return removed; + }, -/***/ }), -/* 1139 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Pauses all the sounds in the game. + * + * @method Phaser.Sound.BaseSoundManager#pauseAll + * @fires Phaser.Sound.Events#PAUSE_ALL + * @since 3.0.0 + */ + pauseAll: function () + { + this.forEachActiveSound(function (sound) + { + sound.pause(); + }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.emit(Events.PAUSE_ALL, this); + }, -var GameObjectFactory = __webpack_require__(5); -var ParticleEmitterManager = __webpack_require__(220); + /** + * Resumes all the sounds in the game. + * + * @method Phaser.Sound.BaseSoundManager#resumeAll + * @fires Phaser.Sound.Events#RESUME_ALL + * @since 3.0.0 + */ + resumeAll: function () + { + this.forEachActiveSound(function (sound) + { + sound.resume(); + }); -/** - * Creates a new Particle Emitter Manager Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Particles Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#particles - * @since 3.0.0 - * - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number|object)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig|Phaser.Types.GameObjects.Particles.ParticleEmitterConfig[]} [emitters] - Configuration settings for one or more emitters to create. - * - * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} The Game Object that was created. - */ -GameObjectFactory.register('particles', function (key, frame, emitters) -{ - return this.displayList.add(new ParticleEmitterManager(this.scene, key, frame, emitters)); -}); + this.emit(Events.RESUME_ALL, this); + }, + /** + * Sets the X and Y position of the Spatial Audio listener on this Web Audios context. + * + * If you call this method with no parameters it will default to the center-point of + * the game canvas. Depending on the type of game you're making, you may need to call + * this method constantly to reset the listener position as the camera scrolls. + * + * Calling this method does nothing on HTML5Audio. + * + * @method Phaser.Sound.BaseSoundManager#setListenerPosition + * @since 3.60.0 + * + * @param {number} [x] - The x position of the Spatial Audio listener. + * @param {number} [y] - The y position of the Spatial Audio listener. + */ + setListenerPosition: NOOP, -/***/ }), -/* 1140 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Stops all the sounds in the game. + * + * @method Phaser.Sound.BaseSoundManager#stopAll + * @fires Phaser.Sound.Events#STOP_ALL + * @since 3.0.0 + */ + stopAll: function () + { + this.forEachActiveSound(function (sound) + { + sound.stop(); + }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.emit(Events.STOP_ALL, this); + }, -var GameObjectFactory = __webpack_require__(5); -var PathFollower = __webpack_require__(457); + /** + * Stops any sounds matching the given key. + * + * @method Phaser.Sound.BaseSoundManager#stopByKey + * @since 3.23.0 + * + * @param {string} key - Sound asset key. + * + * @return {number} - How many sounds were stopped. + */ + stopByKey: function (key) + { + var stopped = 0; -/** - * Creates a new PathFollower Game Object and adds it to the Scene. - * - * Note: This method will only be available if the PathFollower Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#follower - * @since 3.0.0 - * - * @param {Phaser.Curves.Path} path - The Path this PathFollower is connected to. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * - * @return {Phaser.GameObjects.PathFollower} The Game Object that was created. - */ -GameObjectFactory.register('follower', function (path, x, y, key, frame) -{ - var sprite = new PathFollower(this.scene, path, x, y, key, frame); + this.getAll(key).forEach(function (sound) + { + if (sound.stop()) { stopped++; } + }); - this.displayList.add(sprite); - this.updateList.add(sprite); + return stopped; + }, - return sprite; -}); + /** + * Method used internally for unlocking audio playback on devices that + * require user interaction before any sound can be played on a web page. + * + * Read more about how this issue is handled here in [this article](https://medium.com/@pgoloskokovic/unlocking-web-audio-the-smarter-way-8858218c0e09). + * + * @method Phaser.Sound.BaseSoundManager#unlock + * @override + * @protected + * @since 3.0.0 + */ + unlock: NOOP, -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + /** + * Method used internally for pausing sound manager if + * Phaser.Sound.BaseSoundManager#pauseOnBlur is set to true. + * + * @method Phaser.Sound.BaseSoundManager#onBlur + * @override + * @protected + * @since 3.0.0 + */ + onBlur: NOOP, + /** + * Method used internally for resuming sound manager if + * Phaser.Sound.BaseSoundManager#pauseOnBlur is set to true. + * + * @method Phaser.Sound.BaseSoundManager#onFocus + * @override + * @protected + * @since 3.0.0 + */ + onFocus: NOOP, -/***/ }), -/* 1141 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Internal handler for Phaser.Core.Events#BLUR. + * + * @method Phaser.Sound.BaseSoundManager#onGameBlur + * @private + * @since 3.23.0 + */ + onGameBlur: function () + { + this.gameLostFocus = true; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.pauseOnBlur) + { + this.onBlur(); + } + }, -var GameObjectFactory = __webpack_require__(5); -var RenderTexture = __webpack_require__(221); + /** + * Internal handler for Phaser.Core.Events#FOCUS. + * + * @method Phaser.Sound.BaseSoundManager#onGameFocus + * @private + * @since 3.23.0 + */ + onGameFocus: function () + { + this.gameLostFocus = false; -/** - * Creates a new Render Texture Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Render Texture Game Object has been built into Phaser. - * - * A Render Texture is a special texture that allows any number of Game Objects to be drawn to it. You can take many complex objects and - * draw them all to this one texture, which can they be used as the texture for other Game Object's. It's a way to generate dynamic - * textures at run-time that are WebGL friendly and don't invoke expensive GPU uploads. - * - * @method Phaser.GameObjects.GameObjectFactory#renderTexture - * @since 3.2.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {number} [width=32] - The width of the Render Texture. - * @param {number} [height=32] - The height of the Render Texture. - * @property {string} [key] - The texture key to make the RenderTexture from. - * @property {string} [frame] - the frame to make the RenderTexture from. - * - * @return {Phaser.GameObjects.RenderTexture} The Game Object that was created. - */ -GameObjectFactory.register('renderTexture', function (x, y, width, height, key, frame) -{ - return this.displayList.add(new RenderTexture(this.scene, x, y, width, height, key, frame)); -}); + if (this.pauseOnBlur) + { + this.onFocus(); + } + }, + /** + * Update method called on every game step. + * Removes destroyed sounds and updates every active sound in the game. + * + * @method Phaser.Sound.BaseSoundManager#update + * @protected + * @fires Phaser.Sound.Events#UNLOCKED + * @since 3.0.0 + * + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time elapsed since the last frame. + */ + update: function (time, delta) + { + if (this.unlocked) + { + this.unlocked = false; + this.locked = false; -/***/ }), -/* 1142 */ -/***/ (function(module, exports, __webpack_require__) { + this.emit(Events.UNLOCKED, this); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (var i = this.sounds.length - 1; i >= 0; i--) + { + if (this.sounds[i].pendingRemove) + { + this.sounds.splice(i, 1); + } + } -var Rope = __webpack_require__(223); -var GameObjectFactory = __webpack_require__(5); + this.sounds.forEach(function (sound) + { + sound.update(time, delta); + }); + }, -/** - * Creates a new Rope Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Rope Game Object and WebGL support have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#rope - * @webglOnly - * @since 3.23.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {Phaser.Types.Math.Vector2Like[]} [points] - An array containing the vertices data for this Rope. If none is provided a simple quad is created. See `setPoints` to set this post-creation. - * @param {boolean} [horizontal=true] - Should the vertices of this Rope be aligned horizontally (`true`), or vertically (`false`)? - * @param {number[]} [colors] - An optional array containing the color data for this Rope. You should provide one color value per pair of vertices. - * @param {number[]} [alphas] - An optional array containing the alpha data for this Rope. You should provide one alpha value per pair of vertices. - * - * @return {Phaser.GameObjects.Rope} The Game Object that was created. - */ -if (true) -{ - GameObjectFactory.register('rope', function (x, y, texture, frame, points, horizontal, colors, alphas) + /** + * Destroys all the sounds in the game and all associated events. + * + * @method Phaser.Sound.BaseSoundManager#destroy + * @since 3.0.0 + */ + destroy: function () { - return this.displayList.add(new Rope(this.scene, x, y, texture, frame, points, horizontal, colors, alphas)); - }); -} - - -/***/ }), -/* 1143 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.game.events.off(GameEvents.BLUR, this.onGameBlur, this); + this.game.events.off(GameEvents.FOCUS, this.onGameFocus, this); + this.game.events.off(GameEvents.PRE_STEP, this.update, this); -var GameObjectFactory = __webpack_require__(5); -var Sprite = __webpack_require__(73); + this.removeAllListeners(); -/** - * Creates a new Sprite Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Sprite Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#sprite - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * - * @return {Phaser.GameObjects.Sprite} The Game Object that was created. - */ -GameObjectFactory.register('sprite', function (x, y, key, frame) -{ - var sprite = new Sprite(this.scene, x, y, key, frame); + this.removeAll(); - this.displayList.add(sprite); + this.sounds.length = 0; + this.sounds = null; + this.listenerPosition = null; + this.game = null; + }, - return sprite; -}); + /** + * Method used internally for iterating only over active sounds and skipping sounds that are marked for removal. + * + * @method Phaser.Sound.BaseSoundManager#forEachActiveSound + * @private + * @since 3.0.0 + * + * @param {Phaser.Types.Sound.EachActiveSoundCallback} callback - Callback function. (manager: Phaser.Sound.BaseSoundManager, sound: Phaser.Sound.BaseSound, index: number, sounds: Phaser.Manager.BaseSound[]) => void + * @param {*} [scope] - Callback context. + */ + forEachActiveSound: function (callback, scope) + { + var _this = this; -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + this.sounds.forEach(function (sound, index) + { + if (sound && !sound.pendingRemove) + { + callback.call(scope || _this, sound, index, _this.sounds); + } + }); + }, + /** + * Sets the global playback rate at which all the sounds will be played. + * + * For example, a value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed + * and 2.0 doubles the audios playback speed. + * + * @method Phaser.Sound.BaseSoundManager#setRate + * @fires Phaser.Sound.Events#GLOBAL_RATE + * @since 3.3.0 + * + * @param {number} value - Global playback rate at which all the sounds will be played. + * + * @return {this} This Sound Manager. + */ + setRate: function (value) + { + this.rate = value; -/***/ }), -/* 1144 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Global playback rate at which all the sounds will be played. + * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed + * and 2.0 doubles the audio's playback speed. + * + * @name Phaser.Sound.BaseSoundManager#rate + * @type {number} + * @default 1 + * @since 3.0.0 + */ + rate: { -var BitmapText = __webpack_require__(148); -var GameObjectFactory = __webpack_require__(5); + get: function () + { + return this._rate; + }, -/** - * Creates a new Bitmap Text Game Object and adds it to the Scene. - * - * BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure. - * - * During rendering for each letter of the text is rendered to the display, proportionally spaced out and aligned to - * match the font structure. - * - * BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability - * to use Web Fonts, however you trade this flexibility for rendering speed. You can also create visually compelling BitmapTexts by - * processing the font texture in an image editor, applying fills and any other effects required. - * - * To create multi-line text insert \r, \n or \r\n escape codes into the text string. - * - * To create a BitmapText data files you need a 3rd party app such as: - * - * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/ - * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner - * Littera (Web-based, free): http://kvazars.com/littera/ - * - * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of - * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson - * - * Note: This method will only be available if the Bitmap Text Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#bitmapText - * @since 3.0.0 - * - * @param {number} x - The x position of the Game Object. - * @param {number} y - The y position of the Game Object. - * @param {string} font - The key of the font to use from the BitmapFont cache. - * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text. - * @param {number} [size] - The font size to set. - * @param {number} [align=0] - The alignment of the text in a multi-line BitmapText object. - * - * @return {Phaser.GameObjects.BitmapText} The Game Object that was created. - */ -GameObjectFactory.register('bitmapText', function (x, y, font, text, size, align) -{ - return this.displayList.add(new BitmapText(this.scene, x, y, font, text, size, align)); -}); + set: function (value) + { + this._rate = value; -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + this.forEachActiveSound(function (sound) + { + sound.calculateRate(); + }); + this.emit(Events.GLOBAL_RATE, this, value); + } -/***/ }), -/* 1145 */ -/***/ (function(module, exports, __webpack_require__) { + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Sets the global detuning of all sounds in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). + * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @method Phaser.Sound.BaseSoundManager#setDetune + * @fires Phaser.Sound.Events#GLOBAL_DETUNE + * @since 3.3.0 + * + * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @return {this} This Sound Manager. + */ + setDetune: function (value) + { + this.detune = value; -var Text = __webpack_require__(224); -var GameObjectFactory = __webpack_require__(5); + return this; + }, -/** - * Creates a new Text Game Object and adds it to the Scene. - * - * A Text Game Object. - * - * Text objects work by creating their own internal hidden Canvas and then renders text to it using - * the standard Canvas `fillText` API. It then creates a texture from this canvas which is rendered - * to your game during the render pass. - * - * Because it uses the Canvas API you can take advantage of all the features this offers, such as - * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts - * loaded externally, such as Google or TypeKit Web fonts. - * - * You can only display fonts that are currently loaded and available to the browser: therefore fonts must - * be pre-loaded. Phaser does not do ths for you, so you will require the use of a 3rd party font loader, - * or have the fonts ready available in the CSS on the page in which your Phaser game resides. - * - * See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts - * across mobile browsers. - * - * A note on performance: Every time the contents of a Text object changes, i.e. changing the text being - * displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the - * new texture to the GPU. This can be an expensive operation if used often, or with large quantities of - * Text objects in your game. If you run into performance issues you would be better off using Bitmap Text - * instead, as it benefits from batching and avoids expensive Canvas API calls. - * - * Note: This method will only be available if the Text Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#text - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|string[])} text - The text this Text object will display. - * @param {Phaser.Types.GameObjects.Text.TextStyle} [style] - The Text style configuration object. - * - * @return {Phaser.GameObjects.Text} The Game Object that was created. - */ -GameObjectFactory.register('text', function (x, y, text, style) -{ - return this.displayList.add(new Text(this.scene, x, y, text, style)); -}); + /** + * Global detuning of all sounds in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). + * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @name Phaser.Sound.BaseSoundManager#detune + * @type {number} + * @default 0 + * @since 3.0.0 + */ + detune: { -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + get: function () + { + return this._detune; + }, + set: function (value) + { + this._detune = value; -/***/ }), -/* 1146 */ -/***/ (function(module, exports, __webpack_require__) { + this.forEachActiveSound(function (sound) + { + sound.calculateRate(); + }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.emit(Events.GLOBAL_DETUNE, this, value); + } -var TileSprite = __webpack_require__(225); -var GameObjectFactory = __webpack_require__(5); + } -/** - * Creates a new TileSprite Game Object and adds it to the Scene. - * - * Note: This method will only be available if the TileSprite Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#tileSprite - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {number} width - The width of the Game Object. If zero it will use the size of the texture frame. - * @param {number} height - The height of the Game Object. If zero it will use the size of the texture frame. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * - * @return {Phaser.GameObjects.TileSprite} The Game Object that was created. - */ -GameObjectFactory.register('tileSprite', function (x, y, width, height, key, frame) -{ - return this.displayList.add(new TileSprite(this.scene, x, y, width, height, key, frame)); }); -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns +module.exports = BaseSoundManager; /***/ }), -/* 1147 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 84191: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Pavle Goloskokovic (http://prunegames.com) + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Zone = __webpack_require__(129); -var GameObjectFactory = __webpack_require__(5); +var HTML5AudioSoundManager = __webpack_require__(27622); +var NoAudioSoundManager = __webpack_require__(17546); +var WebAudioSoundManager = __webpack_require__(55491); /** - * Creates a new Zone Game Object and adds it to the Scene. + * Creates a Web Audio, HTML5 Audio or No Audio Sound Manager based on config and device settings. * - * Note: This method will only be available if the Zone Game Object has been built into Phaser. + * Be aware of https://developers.google.com/web/updates/2017/09/autoplay-policy-changes * - * @method Phaser.GameObjects.GameObjectFactory#zone + * @function Phaser.Sound.SoundManagerCreator * @since 3.0.0 * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {number} width - The width of the Game Object. - * @param {number} height - The height of the Game Object. - * - * @return {Phaser.GameObjects.Zone} The Game Object that was created. + * @param {Phaser.Game} game - Reference to the current game instance. + * + * @return {(Phaser.Sound.HTML5AudioSoundManager|Phaser.Sound.WebAudioSoundManager|Phaser.Sound.NoAudioSoundManager)} The Sound Manager instance that was created. */ -GameObjectFactory.register('zone', function (x, y, width, height) -{ - return this.displayList.add(new Zone(this.scene, x, y, width, height)); -}); +var SoundManagerCreator = { -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + create: function (game) + { + var audioConfig = game.config.audio; + var deviceAudio = game.device.audio; + if (audioConfig.noAudio || (!deviceAudio.webAudio && !deviceAudio.audioData)) + { + return new NoAudioSoundManager(game); + } -/***/ }), -/* 1148 */ -/***/ (function(module, exports, __webpack_require__) { + if (deviceAudio.webAudio && !audioConfig.disableWebAudio) + { + return new WebAudioSoundManager(game); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return new HTML5AudioSoundManager(game); + } -var Video = __webpack_require__(226); -var GameObjectFactory = __webpack_require__(5); +}; -/** - * Creates a new Video Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Video Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#video - * @since 3.20.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {string} [key] - Optional key of the Video this Game Object will play, as stored in the Video Cache. - * - * @return {Phaser.GameObjects.Video} The Game Object that was created. - */ -GameObjectFactory.register('video', function (x, y, key) -{ - return this.displayList.add(new Video(this.scene, x, y, key)); -}); +module.exports = SoundManagerCreator; /***/ }), -/* 1149 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 77578: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Arc = __webpack_require__(461); -var GameObjectFactory = __webpack_require__(5); - /** - * Creates a new Arc Shape Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Arc Game Object has been built into Phaser. - * - * The Arc Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * When it renders it displays an arc shape. You can control the start and end angles of the arc, - * as well as if the angles are winding clockwise or anti-clockwise. With the default settings - * it renders as a complete circle. By changing the angles you can create other arc shapes, - * such as half-circles. - * - * @method Phaser.GameObjects.GameObjectFactory#arc - * @since 3.13.0 - * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [radius=128] - The radius of the arc. - * @param {number} [startAngle=0] - The start angle of the arc, in degrees. - * @param {number} [endAngle=360] - The end angle of the arc, in degrees. - * @param {boolean} [anticlockwise=false] - The winding order of the start and end angles. - * @param {number} [fillColor] - The color the arc will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the arc will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * The Sound Complete Event. * - * @return {Phaser.GameObjects.Arc} The Game Object that was created. - */ -GameObjectFactory.register('arc', function (x, y, radius, startAngle, endAngle, anticlockwise, fillColor, fillAlpha) -{ - return this.displayList.add(new Arc(this.scene, x, y, radius, startAngle, endAngle, anticlockwise, fillColor, fillAlpha)); -}); - -/** - * Creates a new Circle Shape Game Object and adds it to the Scene. - * - * A Circle is an Arc with no defined start and end angle, making it render as a complete circle. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they complete playback. * - * Note: This method will only be available if the Arc Game Object has been built into Phaser. + * Listen to it from a Sound instance using `Sound.on('complete', listener)`, i.e.: * - * @method Phaser.GameObjects.GameObjectFactory#circle - * @since 3.13.0 + * ```javascript + * var music = this.sound.add('key'); + * music.on('complete', listener); + * music.play(); + * ``` * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [radius=128] - The radius of the circle. - * @param {number} [fillColor] - The color the circle will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the circle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * @event Phaser.Sound.Events#COMPLETE + * @type {string} + * @since 3.16.1 * - * @return {Phaser.GameObjects.Arc} The Game Object that was created. + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. */ -GameObjectFactory.register('circle', function (x, y, radius, fillColor, fillAlpha) -{ - return this.displayList.add(new Arc(this.scene, x, y, radius, 0, 360, false, fillColor, fillAlpha)); -}); +module.exports = 'complete'; /***/ }), -/* 1150 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 19679: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectFactory = __webpack_require__(5); -var Curve = __webpack_require__(462); - /** - * Creates a new Curve Shape Game Object and adds it to the Scene. + * The Audio Data Decoded All Event. * - * Note: This method will only be available if the Curve Game Object has been built into Phaser. - * - * The Curve Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * To render a Curve Shape you must first create a `Phaser.Curves.Curve` object, then pass it to - * the Curve Shape in the constructor. - * - * The Curve shape also has a `smoothness` property and corresponding `setSmoothness` method. - * This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations - * that take place during construction. Increase and decrease the default value for smoother, or more - * jagged, shapes. + * This event is dispatched by the Web Audio Sound Manager as a result of calling the `decodeAudio` method, + * once all files passed to the method have been decoded (or errored). * - * @method Phaser.GameObjects.GameObjectFactory#curve - * @since 3.13.0 + * Use `Phaser.Sound.Events#DECODED` to listen for single sounds being decoded, and `DECODED_ALL` to + * listen for them all completing. * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {Phaser.Curves.Curve} [curve] - The Curve object to use to create the Shape. - * @param {number} [fillColor] - The color the curve will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the curve will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * Listen to it from the Sound Manager in a Scene using `this.sound.on('decodedall', listener)`, i.e.: * - * @return {Phaser.GameObjects.Curve} The Game Object that was created. + * ```javascript + * this.sound.once('decodedall', handler); + * this.sound.decodeAudio([ audioFiles ]); + * ``` + * + * @event Phaser.Sound.Events#DECODED_ALL + * @type {string} + * @since 3.18.0 */ -GameObjectFactory.register('curve', function (x, y, curve, fillColor, fillAlpha) -{ - return this.displayList.add(new Curve(this.scene, x, y, curve, fillColor, fillAlpha)); -}); +module.exports = 'decodedall'; /***/ }), -/* 1151 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 56951: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Ellipse = __webpack_require__(463); -var GameObjectFactory = __webpack_require__(5); - /** - * Creates a new Ellipse Shape Game Object and adds it to the Scene. + * The Audio Data Decoded Event. * - * Note: This method will only be available if the Ellipse Game Object has been built into Phaser. - * - * The Ellipse Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * When it renders it displays an ellipse shape. You can control the width and height of the ellipse. - * If the width and height match it will render as a circle. If the width is less than the height, - * it will look more like an egg shape. - * - * The Ellipse shape also has a `smoothness` property and corresponding `setSmoothness` method. - * This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations - * that take place during construction. Increase and decrease the default value for smoother, or more - * jagged, shapes. + * This event is dispatched by the Web Audio Sound Manager as a result of calling the `decodeAudio` method. * - * @method Phaser.GameObjects.GameObjectFactory#ellipse - * @since 3.13.0 + * Listen to it from the Sound Manager in a Scene using `this.sound.on('decoded', listener)`, i.e.: * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [width=128] - The width of the ellipse. An ellipse with equal width and height renders as a circle. - * @param {number} [height=128] - The height of the ellipse. An ellipse with equal width and height renders as a circle. - * @param {number} [fillColor] - The color the ellipse will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the ellipse will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * ```javascript + * this.sound.on('decoded', handler); + * this.sound.decodeAudio(key, audioData); + * ``` * - * @return {Phaser.GameObjects.Ellipse} The Game Object that was created. + * @event Phaser.Sound.Events#DECODED + * @type {string} + * @since 3.18.0 + * + * @param {string} key - The key of the audio file that was decoded and added to the audio cache. */ -GameObjectFactory.register('ellipse', function (x, y, width, height, fillColor, fillAlpha) -{ - return this.displayList.add(new Ellipse(this.scene, x, y, width, height, fillColor, fillAlpha)); -}); +module.exports = 'decoded'; /***/ }), -/* 1152 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 16436: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectFactory = __webpack_require__(5); -var Grid = __webpack_require__(464); - /** - * Creates a new Grid Shape Game Object and adds it to the Scene. + * The Sound Destroy Event. * - * Note: This method will only be available if the Grid Game Object has been built into Phaser. - * - * The Grid Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports only fill colors and cannot be stroked. - * - * A Grid Shape allows you to display a grid in your game, where you can control the size of the - * grid as well as the width and height of the grid cells. You can set a fill color for each grid - * cell as well as an alternate fill color. When the alternate fill color is set then the grid - * cells will alternate the fill colors as they render, creating a chess-board effect. You can - * also optionally have an outline fill color. If set, this draws lines between the grid cells - * in the given color. If you specify an outline color with an alpha of zero, then it will draw - * the cells spaced out, but without the lines between them. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are destroyed, either + * directly or via a Sound Manager. * - * @method Phaser.GameObjects.GameObjectFactory#grid - * @since 3.13.0 + * Listen to it from a Sound instance using `Sound.on('destroy', listener)`, i.e.: * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [width=128] - The width of the grid. - * @param {number} [height=128] - The height of the grid. - * @param {number} [cellWidth=32] - The width of one cell in the grid. - * @param {number} [cellHeight=32] - The height of one cell in the grid. - * @param {number} [fillColor] - The color the grid cells will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. - * @param {number} [outlineFillColor] - The color of the lines between the grid cells. - * @param {number} [outlineFillAlpha] - The alpha of the lines between the grid cells. + * ```javascript + * var music = this.sound.add('key'); + * music.on('destroy', listener); + * music.destroy(); + * ``` * - * @return {Phaser.GameObjects.Grid} The Game Object that was created. + * @event Phaser.Sound.Events#DESTROY + * @type {string} + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. */ -GameObjectFactory.register('grid', function (x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha) -{ - return this.displayList.add(new Grid(this.scene, x, y, width, height, cellWidth, cellHeight, fillColor, fillAlpha, outlineFillColor, outlineFillAlpha)); -}); +module.exports = 'destroy'; /***/ }), -/* 1153 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 55154: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectFactory = __webpack_require__(5); -var IsoBox = __webpack_require__(465); - /** - * Creates a new IsoBox Shape Game Object and adds it to the Scene. + * The Sound Detune Event. * - * Note: This method will only be available if the IsoBox Game Object has been built into Phaser. - * - * The IsoBox Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports only fill colors and cannot be stroked. - * - * An IsoBox is an 'isometric' rectangle. Each face of it has a different fill color. You can set - * the color of the top, left and right faces of the rectangle respectively. You can also choose - * which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties. - * - * You cannot view an IsoBox from under-neath, however you can change the 'angle' by setting - * the `projection` property. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their detune value changes. * - * @method Phaser.GameObjects.GameObjectFactory#isobox - * @since 3.13.0 + * Listen to it from a Sound instance using `Sound.on('detune', listener)`, i.e.: * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [size=48] - The width of the iso box in pixels. The left and right faces will be exactly half this value. - * @param {number} [height=32] - The height of the iso box. The left and right faces will be this tall. The overall height of the isobox will be this value plus half the `size` value. - * @param {number} [fillTop=0xeeeeee] - The fill color of the top face of the iso box. - * @param {number} [fillLeft=0x999999] - The fill color of the left face of the iso box. - * @param {number} [fillRight=0xcccccc] - The fill color of the right face of the iso box. + * ```javascript + * var music = this.sound.add('key'); + * music.on('detune', listener); + * music.play(); + * music.setDetune(200); + * ``` * - * @return {Phaser.GameObjects.IsoBox} The Game Object that was created. + * @event Phaser.Sound.Events#DETUNE + * @type {string} + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} detune - The new detune value of the Sound. */ -GameObjectFactory.register('isobox', function (x, y, size, height, fillTop, fillLeft, fillRight) -{ - return this.displayList.add(new IsoBox(this.scene, x, y, size, height, fillTop, fillLeft, fillRight)); -}); +module.exports = 'detune'; /***/ }), -/* 1154 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 57818: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectFactory = __webpack_require__(5); -var IsoTriangle = __webpack_require__(466); - /** - * Creates a new IsoTriangle Shape Game Object and adds it to the Scene. + * The Sound Manager Global Detune Event. * - * Note: This method will only be available if the IsoTriangle Game Object has been built into Phaser. - * - * The IsoTriangle Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports only fill colors and cannot be stroked. - * - * An IsoTriangle is an 'isometric' triangle. Think of it like a pyramid. Each face has a different - * fill color. You can set the color of the top, left and right faces of the triangle respectively - * You can also choose which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties. - * - * You cannot view an IsoTriangle from under-neath, however you can change the 'angle' by setting - * the `projection` property. The `reversed` property controls if the IsoTriangle is rendered upside - * down or not. + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `detune` property of the Sound Manager is changed, which globally + * adjusts the detuning of all active sounds. * - * @method Phaser.GameObjects.GameObjectFactory#isotriangle - * @since 3.13.0 + * Listen to it from a Scene using: `this.sound.on('rate', listener)`. * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [size=48] - The width of the iso triangle in pixels. The left and right faces will be exactly half this value. - * @param {number} [height=32] - The height of the iso triangle. The left and right faces will be this tall. The overall height of the iso triangle will be this value plus half the `size` value. - * @param {boolean} [reversed=false] - Is the iso triangle upside down? - * @param {number} [fillTop=0xeeeeee] - The fill color of the top face of the iso triangle. - * @param {number} [fillLeft=0x999999] - The fill color of the left face of the iso triangle. - * @param {number} [fillRight=0xcccccc] - The fill color of the right face of the iso triangle. + * @event Phaser.Sound.Events#GLOBAL_DETUNE + * @type {string} + * @since 3.0.0 * - * @return {Phaser.GameObjects.IsoTriangle} The Game Object that was created. + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + * @param {number} detune - The updated detune value. */ -GameObjectFactory.register('isotriangle', function (x, y, size, height, reversed, fillTop, fillLeft, fillRight) -{ - return this.displayList.add(new IsoTriangle(this.scene, x, y, size, height, reversed, fillTop, fillLeft, fillRight)); -}); +module.exports = 'detune'; /***/ }), -/* 1155 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 57890: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectFactory = __webpack_require__(5); -var Line = __webpack_require__(467); - /** - * Creates a new Line Shape Game Object and adds it to the Scene. + * The Sound Manager Global Mute Event. * - * Note: This method will only be available if the Line Game Object has been built into Phaser. - * - * The Line Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports only stroke colors and cannot be filled. - * - * A Line Shape allows you to draw a line between two points in your game. You can control the - * stroke color and thickness of the line. In WebGL only you can also specify a different - * thickness for the start and end of the line, allowing you to render lines that taper-off. - * - * If you need to draw multiple lines in a sequence you may wish to use the Polygon Shape instead. + * This event is dispatched by the Sound Manager when its `mute` property is changed, either directly + * or via the `setMute` method. This changes the mute state of all active sounds. * - * @method Phaser.GameObjects.GameObjectFactory#line - * @since 3.13.0 + * Listen to it from a Scene using: `this.sound.on('mute', listener)`. * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [x1=0] - The horizontal position of the start of the line. - * @param {number} [y1=0] - The vertical position of the start of the line. - * @param {number} [x2=128] - The horizontal position of the end of the line. - * @param {number} [y2=0] - The vertical position of the end of the line. - * @param {number} [strokeColor] - The color the line will be drawn in, i.e. 0xff0000 for red. - * @param {number} [strokeAlpha] - The alpha the line will be drawn in. You can also set the alpha of the overall Shape using its `alpha` property. + * @event Phaser.Sound.Events#GLOBAL_MUTE + * @type {string} + * @since 3.0.0 * - * @return {Phaser.GameObjects.Line} The Game Object that was created. + * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the Sound Manager that emitted the event. + * @param {boolean} mute - The mute value. `true` if the Sound Manager is now muted, otherwise `false`. */ -GameObjectFactory.register('line', function (x, y, x1, y1, x2, y2, strokeColor, strokeAlpha) -{ - return this.displayList.add(new Line(this.scene, x, y, x1, y1, x2, y2, strokeColor, strokeAlpha)); -}); +module.exports = 'mute'; /***/ }), -/* 1156 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 83022: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectFactory = __webpack_require__(5); -var Polygon = __webpack_require__(468); - /** - * Creates a new Polygon Shape Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Polygon Game Object has been built into Phaser. - * - * The Polygon Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * The Polygon Shape is created by providing a list of points, which are then used to create an - * internal Polygon geometry object. The points can be set from a variety of formats: + * The Sound Manager Global Rate Event. * - * - An array of Point or Vector2 objects: `[new Phaser.Math.Vector2(x1, y1), ...]` - * - An array of objects with public x/y properties: `[obj1, obj2, ...]` - * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]` - * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]` - * - * By default the `x` and `y` coordinates of this Shape refer to the center of it. However, depending - * on the coordinates of the points provided, the final shape may be rendered offset from its origin. + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `rate` property of the Sound Manager is changed, which globally + * adjusts the playback rate of all active sounds. * - * @method Phaser.GameObjects.GameObjectFactory#polygon - * @since 3.13.0 + * Listen to it from a Scene using: `this.sound.on('rate', listener)`. * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {any} [points] - The points that make up the polygon. - * @param {number} [fillColor] - The color the polygon will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the polygon will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * @event Phaser.Sound.Events#GLOBAL_RATE + * @type {string} + * @since 3.0.0 * - * @return {Phaser.GameObjects.Polygon} The Game Object that was created. + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + * @param {number} rate - The updated rate value. */ -GameObjectFactory.register('polygon', function (x, y, points, fillColor, fillAlpha) -{ - return this.displayList.add(new Polygon(this.scene, x, y, points, fillColor, fillAlpha)); -}); +module.exports = 'rate'; /***/ }), -/* 1157 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 99170: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectFactory = __webpack_require__(5); -var Rectangle = __webpack_require__(473); - /** - * Creates a new Rectangle Shape Game Object and adds it to the Scene. + * The Sound Manager Global Volume Event. * - * Note: This method will only be available if the Rectangle Game Object has been built into Phaser. - * - * The Rectangle Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * You can change the size of the rectangle by changing the `width` and `height` properties. + * This event is dispatched by the Sound Manager when its `volume` property is changed, either directly + * or via the `setVolume` method. This changes the volume of all active sounds. * - * @method Phaser.GameObjects.GameObjectFactory#rectangle - * @since 3.13.0 + * Listen to it from a Scene using: `this.sound.on('volume', listener)`. * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [width=128] - The width of the rectangle. - * @param {number} [height=128] - The height of the rectangle. - * @param {number} [fillColor] - The color the rectangle will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the rectangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * @event Phaser.Sound.Events#GLOBAL_VOLUME + * @type {string} + * @since 3.0.0 * - * @return {Phaser.GameObjects.Rectangle} The Game Object that was created. + * @param {(Phaser.Sound.WebAudioSoundManager|Phaser.Sound.HTML5AudioSoundManager)} soundManager - A reference to the sound manager that emitted the event. + * @param {number} volume - The new global volume of the Sound Manager. */ -GameObjectFactory.register('rectangle', function (x, y, width, height, fillColor, fillAlpha) -{ - return this.displayList.add(new Rectangle(this.scene, x, y, width, height, fillColor, fillAlpha)); -}); +module.exports = 'volume'; /***/ }), -/* 1158 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 64289: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Star = __webpack_require__(474); -var GameObjectFactory = __webpack_require__(5); - /** - * Creates a new Star Shape Game Object and adds it to the Scene. + * The Sound Looped Event. * - * Note: This method will only be available if the Star Game Object has been built into Phaser. - * - * The Star Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * As the name implies, the Star shape will display a star in your game. You can control several - * aspects of it including the number of points that constitute the star. The default is 5. If - * you change it to 4 it will render as a diamond. If you increase them, you'll get a more spiky - * star shape. - * - * You can also control the inner and outer radius, which is how 'long' each point of the star is. - * Modify these values to create more interesting shapes. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they loop during playback. * - * @method Phaser.GameObjects.GameObjectFactory#star - * @since 3.13.0 + * Listen to it from a Sound instance using `Sound.on('looped', listener)`, i.e.: * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [points=5] - The number of points on the star. - * @param {number} [innerRadius=32] - The inner radius of the star. - * @param {number} [outerRadius=64] - The outer radius of the star. - * @param {number} [fillColor] - The color the star will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the star will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * ```javascript + * var music = this.sound.add('key'); + * music.on('looped', listener); + * music.setLoop(true); + * music.play(); + * ``` * - * @return {Phaser.GameObjects.Star} The Game Object that was created. + * This is not to be confused with the [LOOP]{@linkcode Phaser.Sound.Events#event:LOOP} event, which only emits when the loop state of a Sound is changed. + * + * @event Phaser.Sound.Events#LOOPED + * @type {string} + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. */ -GameObjectFactory.register('star', function (x, y, points, innerRadius, outerRadius, fillColor, fillAlpha) -{ - return this.displayList.add(new Star(this.scene, x, y, points, innerRadius, outerRadius, fillColor, fillAlpha)); -}); +module.exports = 'looped'; /***/ }), -/* 1159 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 67214: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectFactory = __webpack_require__(5); -var Triangle = __webpack_require__(475); - /** - * Creates a new Triangle Shape Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Triangle Game Object has been built into Phaser. - * - * The Triangle Shape is a Game Object that can be added to a Scene, Group or Container. You can - * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling - * it for input or physics. It provides a quick and easy way for you to render this shape in your - * game without using a texture, while still taking advantage of being fully batched in WebGL. - * - * This shape supports both fill and stroke colors. - * - * The Triangle consists of 3 lines, joining up to form a triangular shape. You can control the - * position of each point of these lines. The triangle is always closed and cannot have an open - * face. If you require that, consider using a Polygon instead. + * The Sound Loop Event. * - * @method Phaser.GameObjects.GameObjectFactory#triangle - * @since 3.13.0 + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their loop state is changed. * - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [x1=0] - The horizontal position of the first point in the triangle. - * @param {number} [y1=128] - The vertical position of the first point in the triangle. - * @param {number} [x2=64] - The horizontal position of the second point in the triangle. - * @param {number} [y2=0] - The vertical position of the second point in the triangle. - * @param {number} [x3=128] - The horizontal position of the third point in the triangle. - * @param {number} [y3=128] - The vertical position of the third point in the triangle. - * @param {number} [fillColor] - The color the triangle will be filled with, i.e. 0xff0000 for red. - * @param {number} [fillAlpha] - The alpha the triangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property. + * Listen to it from a Sound instance using `Sound.on('loop', listener)`, i.e.: * - * @return {Phaser.GameObjects.Triangle} The Game Object that was created. - */ -GameObjectFactory.register('triangle', function (x, y, x1, y1, x2, y2, x3, y3, fillColor, fillAlpha) -{ - return this.displayList.add(new Triangle(this.scene, x, y, x1, y1, x2, y2, x3, y3, fillColor, fillAlpha)); -}); - - -/***/ }), -/* 1160 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Blitter = __webpack_require__(213); -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); - -/** - * Creates a new Blitter Game Object and returns it. + * ```javascript + * var music = this.sound.add('key'); + * music.on('loop', listener); + * music.setLoop(true); + * ``` * - * Note: This method will only be available if the Blitter Game Object has been built into Phaser. + * This is not to be confused with the [LOOPED]{@linkcode Phaser.Sound.Events#event:LOOPED} event, which emits each time a Sound loops during playback. * - * @method Phaser.GameObjects.GameObjectCreator#blitter + * @event Phaser.Sound.Events#LOOP + * @type {string} * @since 3.0.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. - * - * @return {Phaser.GameObjects.Blitter} The Game Object that was created. + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {boolean} loop - The new loop value. `true` if the Sound will loop, otherwise `false`. */ -GameObjectCreator.register('blitter', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var key = GetAdvancedValue(config, 'key', null); - var frame = GetAdvancedValue(config, 'frame', null); - - var blitter = new Blitter(this.scene, 0, 0, key, frame); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, blitter, config); - - return blitter; -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. +module.exports = 'loop'; /***/ }), -/* 1161 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 53128: +/***/ ((module) => { /** * @author Richard Davey - * @author Felipe Alfonso <@bitnenfer> - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var Container = __webpack_require__(214); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); - /** - * Creates a new Container Game Object and returns it. + * The Sound Mute Event. * - * Note: This method will only be available if the Container Game Object has been built into Phaser. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their mute state changes. * - * @method Phaser.GameObjects.GameObjectCreator#container - * @since 3.4.0 + * Listen to it from a Sound instance using `Sound.on('mute', listener)`, i.e.: * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * ```javascript + * var music = this.sound.add('key'); + * music.on('mute', listener); + * music.play(); + * music.setMute(true); + * ``` * - * @return {Phaser.GameObjects.Container} The Game Object that was created. + * @event Phaser.Sound.Events#MUTE + * @type {string} + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {boolean} mute - The mute value. `true` if the Sound is now muted, otherwise `false`. */ -GameObjectCreator.register('container', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var x = GetAdvancedValue(config, 'x', 0); - var y = GetAdvancedValue(config, 'y', 0); - var children = GetAdvancedValue(config, 'children', null); - - var container = new Container(this.scene, x, y, children); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, container, config); - - return container; -}); +module.exports = 'mute'; /***/ }), -/* 1162 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 73078: +/***/ ((module) => { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author pi-kei + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapText = __webpack_require__(215); -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); - /** - * Creates a new Dynamic Bitmap Text Game Object and returns it. + * The Sound Pan Event. * - * Note: This method will only be available if the Dynamic Bitmap Text Game Object has been built into Phaser. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their pan changes. * - * @method Phaser.GameObjects.GameObjectCreator#dynamicBitmapText - * @since 3.0.0 - *² - * @param {Phaser.Types.GameObjects.BitmapText.BitmapTextConfig} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * Listen to it from a Sound instance using `Sound.on('pan', listener)`, i.e.: * - * @return {Phaser.GameObjects.DynamicBitmapText} The Game Object that was created. + * ```javascript + * var sound = this.sound.add('key'); + * sound.on('pan', listener); + * sound.play(); + * sound.setPan(0.5); + * ``` + * + * @event Phaser.Sound.Events#PAN + * @type {string} + * @since 3.50.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} pan - The new pan of the Sound. */ -GameObjectCreator.register('dynamicBitmapText', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var font = GetAdvancedValue(config, 'font', ''); - var text = GetAdvancedValue(config, 'text', ''); - var size = GetAdvancedValue(config, 'size', false); - - var bitmapText = new BitmapText(this.scene, 0, 0, font, text, size); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, bitmapText, config); - - return bitmapText; -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. +module.exports = 'pan'; /***/ }), -/* 1163 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 76763: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); -var Graphics = __webpack_require__(216); - /** - * Creates a new Graphics Game Object and returns it. - * - * Note: This method will only be available if the Graphics Game Object has been built into Phaser. + * The Pause All Sounds Event. * - * @method Phaser.GameObjects.GameObjectCreator#graphics - * @since 3.0.0 + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `pauseAll` method is invoked and after all current Sounds + * have been paused. * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * Listen to it from a Scene using: `this.sound.on('pauseall', listener)`. * - * @return {Phaser.GameObjects.Graphics} The Game Object that was created. - */ -GameObjectCreator.register('graphics', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - var graphics = new Graphics(this.scene, config); - - if (config.add) - { - this.scene.sys.displayList.add(graphics); - } - - return graphics; -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. + * @event Phaser.Sound.Events#PAUSE_ALL + * @type {string} + * @since 3.0.0 + * + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. + */ +module.exports = 'pauseall'; /***/ }), -/* 1164 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 88426: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); -var Group = __webpack_require__(113); - /** - * Creates a new Group Game Object and returns it. + * The Sound Pause Event. * - * Note: This method will only be available if the Group Game Object has been built into Phaser. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are paused. * - * @method Phaser.GameObjects.GameObjectCreator#group - * @since 3.0.0 + * Listen to it from a Sound instance using `Sound.on('pause', listener)`, i.e.: * - * @param {Phaser.Types.GameObjects.Group.GroupConfig|Phaser.Types.GameObjects.Group.GroupCreateConfig} config - The configuration object this Game Object will use to create itself. + * ```javascript + * var music = this.sound.add('key'); + * music.on('pause', listener); + * music.play(); + * music.pause(); + * ``` * - * @return {Phaser.GameObjects.Group} The Game Object that was created. + * @event Phaser.Sound.Events#PAUSE + * @type {string} + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. */ -GameObjectCreator.register('group', function (config) -{ - return new Group(this.scene, null, config); -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. +module.exports = 'pause'; /***/ }), -/* 1165 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 13765: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var Image = __webpack_require__(125); - /** - * Creates a new Image Game Object and returns it. + * The Sound Play Event. * - * Note: This method will only be available if the Image Game Object has been built into Phaser. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are played. * - * @method Phaser.GameObjects.GameObjectCreator#image - * @since 3.0.0 + * Listen to it from a Sound instance using `Sound.on('play', listener)`, i.e.: * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * ```javascript + * var music = this.sound.add('key'); + * music.on('play', listener); + * music.play(); + * ``` * - * @return {Phaser.GameObjects.Image} The Game Object that was created. + * @event Phaser.Sound.Events#PLAY + * @type {string} + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. */ -GameObjectCreator.register('image', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var key = GetAdvancedValue(config, 'key', null); - var frame = GetAdvancedValue(config, 'frame', null); - - var image = new Image(this.scene, 0, 0, key, frame); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, image, config); - - return image; -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. +module.exports = 'play'; /***/ }), -/* 1166 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 80291: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var Layer = __webpack_require__(219); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); - /** - * Creates a new Layer Game Object and returns it. + * The Sound Rate Change Event. * - * Note: This method will only be available if the Layer Game Object has been built into Phaser. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their rate changes. * - * @method Phaser.GameObjects.GameObjectCreator#layer - * @since 3.50.0 + * Listen to it from a Sound instance using `Sound.on('rate', listener)`, i.e.: * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * ```javascript + * var music = this.sound.add('key'); + * music.on('rate', listener); + * music.play(); + * music.setRate(0.5); + * ``` * - * @return {Phaser.GameObjects.Layer} The Game Object that was created. + * @event Phaser.Sound.Events#RATE + * @type {string} + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} rate - The new rate of the Sound. */ -GameObjectCreator.register('layer', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var children = GetAdvancedValue(config, 'children', null); - - var layer = new Layer(this.scene, children); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, layer, config); - - return layer; -}); +module.exports = 'rate'; /***/ }), -/* 1167 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 11124: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var GetFastValue = __webpack_require__(2); -var ParticleEmitterManager = __webpack_require__(220); - /** - * Creates a new Particle Emitter Manager Game Object and returns it. + * The Resume All Sounds Event. * - * Note: This method will only be available if the Particles Game Object has been built into Phaser. + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `resumeAll` method is invoked and after all current Sounds + * have been resumed. * - * @method Phaser.GameObjects.GameObjectCreator#particles - * @since 3.0.0 + * Listen to it from a Scene using: `this.sound.on('resumeall', listener)`. * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * @event Phaser.Sound.Events#RESUME_ALL + * @type {string} + * @since 3.0.0 * - * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} The Game Object that was created. + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. */ -GameObjectCreator.register('particles', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var key = GetAdvancedValue(config, 'key', null); - var frame = GetAdvancedValue(config, 'frame', null); - var emitters = GetFastValue(config, 'emitters', null); - - // frame is optional and can contain the emitters array or object if skipped - var manager = new ParticleEmitterManager(this.scene, key, frame, emitters); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - var add = GetFastValue(config, 'add', false); - - if (add) - { - this.displayList.add(manager); - } - else - { - this.updateList.add(manager); - } - - return manager; -}); +module.exports = 'resumeall'; /***/ }), -/* 1168 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 55382: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var RenderTexture = __webpack_require__(221); - /** - * Creates a new Render Texture Game Object and returns it. + * The Sound Resume Event. * - * Note: This method will only be available if the Render Texture Game Object has been built into Phaser. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are resumed from a paused state. * - * @method Phaser.GameObjects.GameObjectCreator#renderTexture - * @since 3.2.0 + * Listen to it from a Sound instance using `Sound.on('resume', listener)`, i.e.: * - * @param {Phaser.Types.GameObjects.RenderTexture.RenderTextureConfig} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * ```javascript + * var music = this.sound.add('key'); + * music.on('resume', listener); + * music.play(); + * music.pause(); + * music.resume(); + * ``` * - * @return {Phaser.GameObjects.RenderTexture} The Game Object that was created. + * @event Phaser.Sound.Events#RESUME + * @type {string} + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. */ -GameObjectCreator.register('renderTexture', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var x = GetAdvancedValue(config, 'x', 0); - var y = GetAdvancedValue(config, 'y', 0); - var width = GetAdvancedValue(config, 'width', 32); - var height = GetAdvancedValue(config, 'height', 32); - var key = GetAdvancedValue(config, 'key', undefined); - var frame = GetAdvancedValue(config, 'frame', undefined); - - var renderTexture = new RenderTexture(this.scene, x, y, width, height, key, frame); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, renderTexture, config); - - return renderTexture; -}); +module.exports = 'resume'; /***/ }), -/* 1169 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 71157: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var GetValue = __webpack_require__(6); -var Rope = __webpack_require__(223); - /** - * Creates a new Rope Game Object and returns it. + * The Sound Seek Event. * - * Note: This method will only be available if the Rope Game Object and WebGL support have been built into Phaser. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are seeked to a new position. * - * @method Phaser.GameObjects.GameObjectCreator#rope - * @since 3.23.0 + * Listen to it from a Sound instance using `Sound.on('seek', listener)`, i.e.: * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * ```javascript + * var music = this.sound.add('key'); + * music.on('seek', listener); + * music.play(); + * music.setSeek(5000); + * ``` * - * @return {Phaser.GameObjects.Rope} The Game Object that was created. + * @event Phaser.Sound.Events#SEEK + * @type {string} + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} detune - The new detune value of the Sound. */ -GameObjectCreator.register('rope', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var key = GetAdvancedValue(config, 'key', null); - var frame = GetAdvancedValue(config, 'frame', null); - var horizontal = GetAdvancedValue(config, 'horizontal', true); - var points = GetValue(config, 'points', undefined); - var colors = GetValue(config, 'colors', undefined); - var alphas = GetValue(config, 'alphas', undefined); - - var rope = new Rope(this.scene, 0, 0, key, frame, points, horizontal, colors, alphas); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, rope, config); - - if (!config.add) - { - this.updateList.add(rope); - } - - return rope; -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. +module.exports = 'seek'; /***/ }), -/* 1170 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 31776: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var BuildGameObjectAnimation = __webpack_require__(439); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var Sprite = __webpack_require__(73); - /** - * Creates a new Sprite Game Object and returns it. + * The Stop All Sounds Event. * - * Note: This method will only be available if the Sprite Game Object has been built into Phaser. + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched when the `stopAll` method is invoked and after all current Sounds + * have been stopped. * - * @method Phaser.GameObjects.GameObjectCreator#sprite - * @since 3.0.0 + * Listen to it from a Scene using: `this.sound.on('stopall', listener)`. * - * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * @event Phaser.Sound.Events#STOP_ALL + * @type {string} + * @since 3.0.0 * - * @return {Phaser.GameObjects.Sprite} The Game Object that was created. + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. */ -GameObjectCreator.register('sprite', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var key = GetAdvancedValue(config, 'key', null); - var frame = GetAdvancedValue(config, 'frame', null); - - var sprite = new Sprite(this.scene, 0, 0, key, frame); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, sprite, config); - - // Sprite specific config options: - - BuildGameObjectAnimation(sprite, config); - - return sprite; -}); +module.exports = 'stopall'; /***/ }), -/* 1171 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 39450: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BitmapText = __webpack_require__(148); -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var GetValue = __webpack_require__(6); - /** - * Creates a new Bitmap Text Game Object and returns it. + * The Sound Stop Event. * - * Note: This method will only be available if the Bitmap Text Game Object has been built into Phaser. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when they are stopped. * - * @method Phaser.GameObjects.GameObjectCreator#bitmapText + * Listen to it from a Sound instance using `Sound.on('stop', listener)`, i.e.: + * + * ```javascript + * var music = this.sound.add('key'); + * music.on('stop', listener); + * music.play(); + * music.stop(); + * ``` + * + * @event Phaser.Sound.Events#STOP + * @type {string} * @since 3.0.0 * - * @param {Phaser.Types.GameObjects.BitmapText.BitmapTextConfig} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. - * - * @return {Phaser.GameObjects.BitmapText} The Game Object that was created. + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. */ -GameObjectCreator.register('bitmapText', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var font = GetValue(config, 'font', ''); - var text = GetAdvancedValue(config, 'text', ''); - var size = GetAdvancedValue(config, 'size', false); - var align = GetValue(config, 'align', 0); - - var bitmapText = new BitmapText(this.scene, 0, 0, font, text, size, align); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, bitmapText, config); - - return bitmapText; -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. +module.exports = 'stop'; /***/ }), -/* 1172 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 21939: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var Text = __webpack_require__(224); - /** - * Creates a new Text Game Object and returns it. + * The Sound Manager Unlocked Event. * - * Note: This method will only be available if the Text Game Object has been built into Phaser. + * This event is dispatched by the Base Sound Manager, or more typically, an instance of the Web Audio Sound Manager, + * or the HTML5 Audio Manager. It is dispatched during the update loop when the Sound Manager becomes unlocked. For + * Web Audio this is on the first user gesture on the page. * - * @method Phaser.GameObjects.GameObjectCreator#text - * @since 3.0.0 + * Listen to it from a Scene using: `this.sound.on('unlocked', listener)`. * - * @param {Phaser.Types.GameObjects.Text.TextConfig} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * @event Phaser.Sound.Events#UNLOCKED + * @type {string} + * @since 3.0.0 * - * @return {Phaser.GameObjects.Text} The Game Object that was created. + * @param {Phaser.Sound.BaseSoundManager} soundManager - A reference to the sound manager that emitted the event. */ -GameObjectCreator.register('text', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - // style Object = { - // font: [ 'font', '16px Courier' ], - // backgroundColor: [ 'backgroundColor', null ], - // fill: [ 'fill', '#fff' ], - // stroke: [ 'stroke', '#fff' ], - // strokeThickness: [ 'strokeThickness', 0 ], - // shadowOffsetX: [ 'shadow.offsetX', 0 ], - // shadowOffsetY: [ 'shadow.offsetY', 0 ], - // shadowColor: [ 'shadow.color', '#000' ], - // shadowBlur: [ 'shadow.blur', 0 ], - // shadowStroke: [ 'shadow.stroke', false ], - // shadowFill: [ 'shadow.fill', false ], - // align: [ 'align', 'left' ], - // maxLines: [ 'maxLines', 0 ], - // fixedWidth: [ 'fixedWidth', false ], - // fixedHeight: [ 'fixedHeight', false ], - // rtl: [ 'rtl', false ] - // } - - var content = GetAdvancedValue(config, 'text', ''); - var style = GetAdvancedValue(config, 'style', null); - - // Padding - // { padding: 2 } - // { padding: { x: , y: }} - // { padding: { left: , top: }} - // { padding: { left: , right: , top: , bottom: }} - - var padding = GetAdvancedValue(config, 'padding', null); - - if (padding !== null) - { - style.padding = padding; - } - - var text = new Text(this.scene, 0, 0, content, style); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, text, config); - - // Text specific config options: - - text.autoRound = GetAdvancedValue(config, 'autoRound', true); - text.resolution = GetAdvancedValue(config, 'resolution', 1); - - return text; -}); - -// When registering a factory function 'this' refers to the GameObjectCreator context. +module.exports = 'unlocked'; /***/ }), -/* 1173 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 33019: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var TileSprite = __webpack_require__(225); - /** - * Creates a new TileSprite Game Object and returns it. + * The Sound Volume Event. * - * Note: This method will only be available if the TileSprite Game Object has been built into Phaser. + * This event is dispatched by both Web Audio and HTML5 Audio Sound objects when their volume changes. * - * @method Phaser.GameObjects.GameObjectCreator#tileSprite - * @since 3.0.0 + * Listen to it from a Sound instance using `Sound.on('volume', listener)`, i.e.: * - * @param {Phaser.Types.GameObjects.TileSprite.TileSpriteConfig} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * ```javascript + * var music = this.sound.add('key'); + * music.on('volume', listener); + * music.play(); + * music.setVolume(0.5); + * ``` * - * @return {Phaser.GameObjects.TileSprite} The Game Object that was created. + * @event Phaser.Sound.Events#VOLUME + * @type {string} + * @since 3.0.0 + * + * @param {(Phaser.Sound.WebAudioSound|Phaser.Sound.HTML5AudioSound)} sound - A reference to the Sound that emitted the event. + * @param {number} volume - The new volume of the Sound. */ -GameObjectCreator.register('tileSprite', function (config, addToScene) -{ - if (config === undefined) { config = {}; } - - var x = GetAdvancedValue(config, 'x', 0); - var y = GetAdvancedValue(config, 'y', 0); - var width = GetAdvancedValue(config, 'width', 512); - var height = GetAdvancedValue(config, 'height', 512); - var key = GetAdvancedValue(config, 'key', ''); - var frame = GetAdvancedValue(config, 'frame', ''); - - var tile = new TileSprite(this.scene, x, y, width, height, key, frame); - - if (addToScene !== undefined) - { - config.add = addToScene; - } - - BuildGameObject(this.scene, tile, config); - - return tile; -}); +module.exports = 'volume'; /***/ }), -/* 1174 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 76038: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var Zone = __webpack_require__(129); - /** - * Creates a new Zone Game Object and returns it. - * - * Note: This method will only be available if the Zone Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectCreator#zone - * @since 3.0.0 - * - * @param {object} config - The configuration object this Game Object will use to create itself. - * - * @return {Phaser.GameObjects.Zone} The Game Object that was created. + * @namespace Phaser.Sound.Events */ -GameObjectCreator.register('zone', function (config) -{ - var x = GetAdvancedValue(config, 'x', 0); - var y = GetAdvancedValue(config, 'y', 0); - var width = GetAdvancedValue(config, 'width', 1); - var height = GetAdvancedValue(config, 'height', width); - return new Zone(this.scene, x, y, width, height); -}); +module.exports = { -// When registering a factory function 'this' refers to the GameObjectCreator context. + COMPLETE: __webpack_require__(77578), + DECODED: __webpack_require__(56951), + DECODED_ALL: __webpack_require__(19679), + DESTROY: __webpack_require__(16436), + DETUNE: __webpack_require__(55154), + GLOBAL_DETUNE: __webpack_require__(57818), + GLOBAL_MUTE: __webpack_require__(57890), + GLOBAL_RATE: __webpack_require__(83022), + GLOBAL_VOLUME: __webpack_require__(99170), + LOOP: __webpack_require__(67214), + LOOPED: __webpack_require__(64289), + MUTE: __webpack_require__(53128), + PAN: __webpack_require__(73078), + PAUSE_ALL: __webpack_require__(76763), + PAUSE: __webpack_require__(88426), + PLAY: __webpack_require__(13765), + RATE: __webpack_require__(80291), + RESUME_ALL: __webpack_require__(11124), + RESUME: __webpack_require__(55382), + SEEK: __webpack_require__(71157), + STOP_ALL: __webpack_require__(31776), + STOP: __webpack_require__(39450), + UNLOCKED: __webpack_require__(21939), + VOLUME: __webpack_require__(33019) + +}; /***/ }), -/* 1175 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 34350: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Pavle Goloskokovic (http://prunegames.com) + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var Video = __webpack_require__(226); +var BaseSound = __webpack_require__(25798); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(76038); +var Clamp = __webpack_require__(82897); /** - * Creates a new Video Game Object and returns it. - * - * Note: This method will only be available if the Video Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectCreator#video - * @since 3.20.0 + * @classdesc + * HTML5 Audio implementation of the sound. * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. + * @class HTML5AudioSound + * @extends Phaser.Sound.BaseSound + * @memberof Phaser.Sound + * @constructor + * @since 3.0.0 * - * @return {Phaser.GameObjects.Video} The Game Object that was created. + * @param {Phaser.Sound.HTML5AudioSoundManager} manager - Reference to the current sound manager instance. + * @param {string} key - Asset key for the sound. + * @param {Phaser.Types.Sound.SoundConfig} [config={}] - An optional config object containing default sound settings. */ -GameObjectCreator.register('video', function (config, addToScene) -{ - if (config === undefined) { config = {}; } +var HTML5AudioSound = new Class({ - var key = GetAdvancedValue(config, 'key', null); + Extends: BaseSound, - var video = new Video(this.scene, 0, 0, key); + initialize: - if (addToScene !== undefined) + function HTML5AudioSound (manager, key, config) { - config.add = addToScene; - } + if (config === undefined) { config = {}; } - BuildGameObject(this.scene, video, config); + /** + * An array containing all HTML5 Audio tags that could be used for individual + * sound playback. Number of instances depends on the config value passed + * to the `Loader#audio` method call, default is 1. + * + * @name Phaser.Sound.HTML5AudioSound#tags + * @type {HTMLAudioElement[]} + * @since 3.0.0 + */ + this.tags = manager.game.cache.audio.get(key); - if (!config.add) - { - this.updateList.add(video); - } + if (!this.tags) + { + throw new Error('No cached audio asset with key "' + key); + } - return video; -}); + /** + * Reference to an HTML5 Audio tag used for playing sound. + * + * @name Phaser.Sound.HTML5AudioSound#audio + * @type {HTMLAudioElement} + * @default null + * @since 3.0.0 + */ + this.audio = null; -// When registering a factory function 'this' refers to the GameObjectCreator context. + /** + * Timestamp as generated by the Request Animation Frame or SetTimeout + * representing the time at which the delayed sound playback should start. + * Set to 0 if sound playback is not delayed. + * + * @name Phaser.Sound.HTML5AudioSound#startTime + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.startTime = 0; + /** + * Audio tag's playback position recorded on previous + * update method call. Set to 0 if sound is not playing. + * + * @name Phaser.Sound.HTML5AudioSound#previousTime + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.previousTime = 0; -/***/ }), -/* 1176 */ -/***/ (function(module, exports, __webpack_require__) { + this.duration = this.tags[0].duration; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.totalDuration = this.tags[0].duration; -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + BaseSound.call(this, manager, key, config); + }, -if (true) -{ - renderWebGL = __webpack_require__(1177); -} + /** + * Play this sound, or a marked section of it. + * + * It always plays the sound from the start. If you want to start playback from a specific time + * you can set 'seek' setting of the config object, provided to this call, to that value. + * + * If you want to play the same sound simultaneously, then you need to create another instance + * of it and play that Sound. For HTML5 Audio this also requires creating multiple audio instances + * when loading the audio files. + * + * @method Phaser.Sound.HTML5AudioSound#play + * @fires Phaser.Sound.Events#PLAY + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Sound.SoundConfig)} [markerName=''] - If you want to play a marker then provide the marker name here. Alternatively, this parameter can be a SoundConfig object. + * @param {Phaser.Types.Sound.SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound. + * + * @return {boolean} Whether the sound started playing successfully. + */ + play: function (markerName, config) + { + if (this.manager.isLocked(this, 'play', [ markerName, config ])) + { + return false; + } -if (true) -{ - renderCanvas = __webpack_require__(1178); -} + if (!BaseSound.prototype.play.call(this, markerName, config)) + { + return false; + } -module.exports = { + // \/\/\/ isPlaying = true, isPaused = false \/\/\/ + if (!this.pickAndPlayAudioTag()) + { + return false; + } - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + this.emit(Events.PLAY, this); -}; + return true; + }, + /** + * Pauses the sound. + * + * @method Phaser.Sound.HTML5AudioSound#pause + * @fires Phaser.Sound.Events#PAUSE + * @since 3.0.0 + * + * @return {boolean} Whether the sound was paused successfully. + */ + pause: function () + { + if (this.manager.isLocked(this, 'pause')) + { + return false; + } -/***/ }), -/* 1177 */ -/***/ (function(module, exports, __webpack_require__) { + if (this.startTime > 0) + { + return false; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (!BaseSound.prototype.pause.call(this)) + { + return false; + } -var GetCalcMatrix = __webpack_require__(19); + // \/\/\/ isPlaying = false, isPaused = true \/\/\/ + this.currentConfig.seek = this.audio.currentTime - (this.currentMarker ? this.currentMarker.start : 0); -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Shader#renderWebGL - * @since 3.17.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Shader} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var ShaderWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - if (!src.shader) + this.stopAndReleaseAudioTag(); + + this.emit(Events.PAUSE, this); + + return true; + }, + + /** + * Resumes the sound. + * + * @method Phaser.Sound.HTML5AudioSound#resume + * @fires Phaser.Sound.Events#RESUME + * @since 3.0.0 + * + * @return {boolean} Whether the sound was resumed successfully. + */ + resume: function () { - return; - } + if (this.manager.isLocked(this, 'resume')) + { + return false; + } - camera.addToRenderList(src); + if (this.startTime > 0) + { + return false; + } - renderer.pipelines.clear(); + if (!BaseSound.prototype.resume.call(this)) + { + return false; + } - if (src.renderToTexture) + // \/\/\/ isPlaying = true, isPaused = false \/\/\/ + if (!this.pickAndPlayAudioTag()) + { + return false; + } + + this.emit(Events.RESUME, this); + + return true; + }, + + /** + * Stop playing this sound. + * + * @method Phaser.Sound.HTML5AudioSound#stop + * @fires Phaser.Sound.Events#STOP + * @since 3.0.0 + * + * @return {boolean} Whether the sound was stopped successfully. + */ + stop: function () { - src.load(); - src.flush(); - } - else + if (this.manager.isLocked(this, 'stop')) + { + return false; + } + + if (!BaseSound.prototype.stop.call(this)) + { + return false; + } + + // \/\/\/ isPlaying = false, isPaused = false \/\/\/ + this.stopAndReleaseAudioTag(); + + this.emit(Events.STOP, this); + + return true; + }, + + /** + * This method is used internally to pick and play the next available audio tag. + * + * @method Phaser.Sound.HTML5AudioSound#pickAndPlayAudioTag + * @since 3.0.0 + * + * @return {boolean} Whether the sound was assigned an audio tag successfully. + */ + pickAndPlayAudioTag: function () { - var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + if (!this.pickAudioTag()) + { + this.reset(); - // Renderer size changed? - if (renderer.width !== src._rendererWidth || renderer.height !== src._rendererHeight) + return false; + } + + var seek = this.currentConfig.seek; + var delay = this.currentConfig.delay; + var offset = (this.currentMarker ? this.currentMarker.start : 0) + seek; + + this.previousTime = offset; + this.audio.currentTime = offset; + this.applyConfig(); + + if (delay === 0) { - src.projOrtho(0, renderer.width, renderer.height, 0); + this.startTime = 0; + + if (this.audio.paused) + { + this.playCatchPromise(); + } } + else + { + this.startTime = window.performance.now() + delay * 1000; - src.load(calcMatrix.matrix); - src.flush(); - } + if (!this.audio.paused) + { + this.audio.pause(); + } + } - renderer.pipelines.rebind(); -}; + this.resetConfig(); -module.exports = ShaderWebGLRenderer; + return true; + }, + /** + * This method performs the audio tag pooling logic. It first looks for + * unused audio tag to assign to this sound object. If there are no unused + * audio tags, based on HTML5AudioSoundManager#override property value, it + * looks for sound with most advanced playback and hijacks its audio tag or + * does nothing. + * + * @method Phaser.Sound.HTML5AudioSound#pickAudioTag + * @since 3.0.0 + * + * @return {boolean} Whether the sound was assigned an audio tag successfully. + */ + pickAudioTag: function () + { + if (this.audio) + { + return true; + } -/***/ }), -/* 1178 */ -/***/ (function(module, exports) { + for (var i = 0; i < this.tags.length; i++) + { + var audio = this.tags[i]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (audio.dataset.used === 'false') + { + audio.dataset.used = 'true'; + this.audio = audio; + return true; + } + } -/** - * This is a stub function for Shader.Render. There is no Canvas renderer for Shader objects. - * - * @method Phaser.GameObjects.Shader#renderCanvas - * @since 3.17.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Shader} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var ShaderCanvasRenderer = function () -{ -}; + if (!this.manager.override) + { + return false; + } -module.exports = ShaderCanvasRenderer; + var otherSounds = []; + this.manager.forEachActiveSound(function (sound) + { + if (sound.key === this.key && sound.audio) + { + otherSounds.push(sound); + } + }, this); -/***/ }), -/* 1179 */ -/***/ (function(module, exports, __webpack_require__) { + otherSounds.sort(function (a1, a2) + { + if (a1.loop === a2.loop) + { + // sort by progress + return (a2.seek / a2.duration) - (a1.seek / a1.duration); + } + return a1.loop ? 1 : -1; + }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var selectedSound = otherSounds[0]; -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + this.audio = selectedSound.audio; -if (true) -{ - renderWebGL = __webpack_require__(1180); -} + selectedSound.reset(); + selectedSound.audio = null; + selectedSound.startTime = 0; + selectedSound.previousTime = 0; -if (true) -{ - renderCanvas = __webpack_require__(1181); -} + return true; + }, -module.exports = { + /** + * Method used for playing audio tag and catching possible exceptions + * thrown from rejected Promise returned from play method call. + * + * @method Phaser.Sound.HTML5AudioSound#playCatchPromise + * @since 3.0.0 + */ + playCatchPromise: function () + { + var playPromise = this.audio.play(); - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + if (playPromise) + { + // eslint-disable-next-line no-unused-vars + playPromise.catch(function (reason) + { + console.warn(reason); + }); + } + }, -}; + /** + * This method is used internally to stop and release the current audio tag. + * + * @method Phaser.Sound.HTML5AudioSound#stopAndReleaseAudioTag + * @since 3.0.0 + */ + stopAndReleaseAudioTag: function () + { + this.startTime = 0; + this.previousTime = 0; + if (this.audio) + { + this.audio.pause(); + this.audio.dataset.used = 'false'; + this.audio = null; + } + }, -/***/ }), -/* 1180 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Method used internally to reset sound state, usually when stopping sound + * or when hijacking audio tag from another sound. + * + * @method Phaser.Sound.HTML5AudioSound#reset + * @since 3.0.0 + */ + reset: function () + { + BaseSound.prototype.stop.call(this); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Method used internally by sound manager for pausing sound if + * Phaser.Sound.HTML5AudioSoundManager#pauseOnBlur is set to true. + * + * @method Phaser.Sound.HTML5AudioSound#onBlur + * @since 3.0.0 + */ + onBlur: function () + { + this.isPlaying = false; + this.isPaused = true; -var GetCalcMatrix = __webpack_require__(19); + this.currentConfig.seek = this.audio.currentTime - (this.currentMarker ? this.currentMarker.start : 0); -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.Mesh#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var MeshWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - var faces = src.faces; - var totalFaces = faces.length; + this.currentConfig.delay = Math.max(0, (this.startTime - window.performance.now()) / 1000); - if (totalFaces === 0) + this.stopAndReleaseAudioTag(); + }, + + /** + * Method used internally by sound manager for resuming sound if + * Phaser.Sound.HTML5AudioSoundManager#pauseOnBlur is set to true. + * + * @method Phaser.Sound.HTML5AudioSound#onFocus + * @since 3.0.0 + */ + onFocus: function () { - return; - } + this.isPlaying = true; + this.isPaused = false; + this.pickAndPlayAudioTag(); + }, - camera.addToRenderList(src); + /** + * Update method called automatically by sound manager on every game step. + * + * @method Phaser.Sound.HTML5AudioSound#update + * @fires Phaser.Sound.Events#COMPLETE + * @fires Phaser.Sound.Events#LOOPED + * @since 3.0.0 + * + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + */ + update: function (time) + { + if (!this.isPlaying) + { + return; + } - var pipeline = renderer.pipelines.set(src.pipeline, src); + // handling delayed playback + if (this.startTime > 0) + { + if (this.startTime < time - this.manager.audioPlayDelay) + { + this.audio.currentTime += Math.max(0, time - this.startTime) / 1000; + this.startTime = 0; + this.previousTime = this.audio.currentTime; + this.playCatchPromise(); + } - var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + return; + } + + // handle looping and ending + var startTime = this.currentMarker ? this.currentMarker.start : 0; + var endTime = startTime + this.duration; + var currentTime = this.audio.currentTime; + + if (this.currentConfig.loop) + { + if (currentTime >= endTime - this.manager.loopEndOffset) + { + this.audio.currentTime = startTime + Math.max(0, currentTime - endTime); + currentTime = this.audio.currentTime; + } + else if (currentTime < startTime) + { + this.audio.currentTime += startTime; + currentTime = this.audio.currentTime; + } - var textureUnit = pipeline.setGameObject(src); + if (currentTime < this.previousTime) + { + this.emit(Events.LOOPED, this); + } + } + else if (currentTime >= endTime) + { + this.reset(); - var F32 = pipeline.vertexViewF32; - var U32 = pipeline.vertexViewU32; + this.stopAndReleaseAudioTag(); - var vertexOffset = (pipeline.vertexCount * pipeline.currentShader.vertexComponentCount) - 1; + this.emit(Events.COMPLETE, this); - var tintEffect = src.tintFill; + return; + } - var debugFaces = []; - var debugCallback = src.debugCallback; + this.previousTime = currentTime; + }, - var a = calcMatrix.a; - var b = calcMatrix.b; - var c = calcMatrix.c; - var d = calcMatrix.d; - var e = calcMatrix.e; - var f = calcMatrix.f; + /** + * Calls Phaser.Sound.BaseSound#destroy method + * and cleans up all HTML5 Audio related stuff. + * + * @method Phaser.Sound.HTML5AudioSound#destroy + * @since 3.0.0 + */ + destroy: function () + { + BaseSound.prototype.destroy.call(this); - var z = src.viewPosition.z; + this.tags = null; - var hideCCW = src.hideCCW; - var roundPixels = camera.roundPixels; - var alpha = camera.alpha * src.alpha; + if (this.audio) + { + this.stopAndReleaseAudioTag(); + } + }, - var totalFacesRendered = 0; + /** + * This method is used internally to update the mute setting of this sound. + * + * @method Phaser.Sound.HTML5AudioSound#updateMute + * @since 3.0.0 + */ + updateMute: function () + { + if (this.audio) + { + this.audio.muted = this.currentConfig.mute || this.manager.mute; + } + }, - renderer.pipelines.preBatch(src); + /** + * This method is used internally to update the volume of this sound. + * + * @method Phaser.Sound.HTML5AudioSound#updateVolume + * @since 3.0.0 + */ + updateVolume: function () + { + if (this.audio) + { + this.audio.volume = Clamp(this.currentConfig.volume * this.manager.volume, 0, 1); + } + }, - for (var i = 0; i < totalFaces; i++) + /** + * This method is used internally to update the playback rate of this sound. + * + * @method Phaser.Sound.HTML5AudioSound#calculateRate + * @since 3.0.0 + */ + calculateRate: function () { - var face = faces[i]; + BaseSound.prototype.calculateRate.call(this); - // If face has alpha <= 0, or hideCCW + clockwise, or isn't in camera view, then don't draw it - if (!face.isInView(camera, hideCCW, z, alpha, a, b, c, d, e, f, roundPixels)) + if (this.audio) { - continue; + this.audio.playbackRate = this.totalRate; } + }, - if (pipeline.shouldFlush(3)) + /** + * Boolean indicating whether the sound is muted or not. + * Gets or sets the muted state of this sound. + * + * @name Phaser.Sound.HTML5AudioSound#mute + * @type {boolean} + * @default false + * @fires Phaser.Sound.Events#MUTE + * @since 3.0.0 + */ + mute: { + + get: function () { - pipeline.flush(); + return this.currentConfig.mute; + }, - vertexOffset = 0; - } + set: function (value) + { + this.currentConfig.mute = value; - vertexOffset = face.load(F32, U32, vertexOffset, textureUnit, tintEffect); + if (this.manager.isLocked(this, 'mute', value)) + { + return; + } - totalFacesRendered++; - pipeline.vertexCount += 3; + this.updateMute(); - if (debugCallback) - { - debugFaces.push(face); + this.emit(Events.MUTE, this, value); } - } - - src.totalFrame += totalFacesRendered; + }, - if (debugCallback) + /** + * Sets the muted state of this Sound. + * + * @method Phaser.Sound.HTML5AudioSound#setMute + * @fires Phaser.Sound.Events#MUTE + * @since 3.4.0 + * + * @param {boolean} value - `true` to mute this sound, `false` to unmute it. + * + * @return {this} This Sound instance. + */ + setMute: function (value) { - debugCallback.call(src, src, debugFaces); - } + this.mute = value; - renderer.pipelines.postBatch(src); -}; + return this; + }, -module.exports = MeshWebGLRenderer; + /** + * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). + * + * @name Phaser.Sound.HTML5AudioSound#volume + * @type {number} + * @default 1 + * @fires Phaser.Sound.Events#VOLUME + * @since 3.0.0 + */ + volume: { + get: function () + { + return this.currentConfig.volume; + }, -/***/ }), -/* 1181 */ -/***/ (function(module, exports) { + set: function (value) + { + this.currentConfig.volume = value; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.manager.isLocked(this, 'volume', value)) + { + return; + } -/** - * This is a stub function for Mesh.Render. There is no Canvas renderer for Mesh objects. - * - * @method Phaser.GameObjects.Mesh#renderCanvas - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.GameObjects.Mesh} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var MeshCanvasRenderer = function () -{ -}; + this.updateVolume(); -module.exports = MeshCanvasRenderer; + this.emit(Events.VOLUME, this, value); + } + }, + /** + * Sets the volume of this Sound. + * + * @method Phaser.Sound.HTML5AudioSound#setVolume + * @fires Phaser.Sound.Events#VOLUME + * @since 3.4.0 + * + * @param {number} value - The volume of the sound. + * + * @return {this} This Sound instance. + */ + setVolume: function (value) + { + this.volume = value; -/***/ }), -/* 1182 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Rate at which this Sound will be played. + * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed + * and 2.0 doubles the audios playback speed. + * + * @name Phaser.Sound.HTML5AudioSound#rate + * @type {number} + * @default 1 + * @fires Phaser.Sound.Events#RATE + * @since 3.0.0 + */ + rate: { -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); + get: function () + { + return this.currentConfig.rate; + }, -if (true) -{ - renderWebGL = __webpack_require__(1183); -} + set: function (value) + { + this.currentConfig.rate = value; -module.exports = { + if (this.manager.isLocked(this, Events.RATE, value)) + { + return; + } + else + { + this.calculateRate(); - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + this.emit(Events.RATE, this, value); + } + } -}; + }, + + /** + * Sets the playback rate of this Sound. + * + * For example, a value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed + * and 2.0 doubles the audios playback speed. + * + * @method Phaser.Sound.HTML5AudioSound#setRate + * @fires Phaser.Sound.Events#RATE + * @since 3.3.0 + * + * @param {number} value - The playback rate at of this Sound. + * + * @return {this} This Sound instance. + */ + setRate: function (value) + { + this.rate = value; + return this; + }, -/***/ }), -/* 1183 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The detune value of this Sound, given in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). + * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @name Phaser.Sound.HTML5AudioSound#detune + * @type {number} + * @default 0 + * @fires Phaser.Sound.Events#DETUNE + * @since 3.0.0 + */ + detune: { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + get: function () + { + return this.currentConfig.detune; + }, -var GetCalcMatrix = __webpack_require__(19); + set: function (value) + { + this.currentConfig.detune = value; -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.GameObjects.PointLight#renderWebGL - * @since 3.50.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.GameObjects.PointLight} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var PointLightWebGLRenderer = function (renderer, src, camera, parentMatrix) -{ - camera.addToRenderList(src); + if (this.manager.isLocked(this, Events.DETUNE, value)) + { + return; + } + else + { + this.calculateRate(); - var pipeline = renderer.pipelines.set(src.pipeline); + this.emit(Events.DETUNE, this, value); + } + } - var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc; + }, - var width = src.width; - var height = src.height; + /** + * Sets the detune value of this Sound, given in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). + * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @method Phaser.Sound.HTML5AudioSound#setDetune + * @fires Phaser.Sound.Events#DETUNE + * @since 3.3.0 + * + * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @return {this} This Sound instance. + */ + setDetune: function (value) + { + this.detune = value; - var x = -src._radius; - var y = -src._radius; + return this; + }, - var xw = x + width; - var yh = y + height; + /** + * Property representing the position of playback for this sound, in seconds. + * Setting it to a specific value moves current playback to that position. + * The value given is clamped to the range 0 to current marker duration. + * Setting seek of a stopped sound has no effect. + * + * @name Phaser.Sound.HTML5AudioSound#seek + * @type {number} + * @fires Phaser.Sound.Events#SEEK + * @since 3.0.0 + */ + seek: { - var lightX = calcMatrix.getX(0, 0); - var lightY = calcMatrix.getY(0, 0); + get: function () + { + if (this.isPlaying) + { + return this.audio.currentTime - (this.currentMarker ? this.currentMarker.start : 0); + } + else if (this.isPaused) + { + return this.currentConfig.seek; + } + else + { + return 0; + } + }, - var tx0 = calcMatrix.getX(x, y); - var ty0 = calcMatrix.getY(x, y); + set: function (value) + { + if (this.manager.isLocked(this, 'seek', value)) + { + return; + } - var tx1 = calcMatrix.getX(x, yh); - var ty1 = calcMatrix.getY(x, yh); + if (this.startTime > 0) + { + return; + } - var tx2 = calcMatrix.getX(xw, yh); - var ty2 = calcMatrix.getY(xw, yh); + if (this.isPlaying || this.isPaused) + { + value = Math.min(Math.max(0, value), this.duration); - var tx3 = calcMatrix.getX(xw, y); - var ty3 = calcMatrix.getY(xw, y); + if (this.isPlaying) + { + this.previousTime = value; + this.audio.currentTime = value; + } + else if (this.isPaused) + { + this.currentConfig.seek = value; + } - renderer.pipelines.preBatch(src); + this.emit(Events.SEEK, this, value); + } + } + }, - pipeline.batchPointLight(src, camera, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, lightX, lightY); + /** + * Seeks to a specific point in this sound. + * + * @method Phaser.Sound.HTML5AudioSound#setSeek + * @fires Phaser.Sound.Events#SEEK + * @since 3.4.0 + * + * @param {number} value - The point in the sound to seek to. + * + * @return {this} This Sound instance. + */ + setSeek: function (value) + { + this.seek = value; - renderer.pipelines.postBatch(src); -}; + return this; + }, -module.exports = PointLightWebGLRenderer; + /** + * Flag indicating whether or not the sound or current sound marker will loop. + * + * @name Phaser.Sound.HTML5AudioSound#loop + * @type {boolean} + * @default false + * @fires Phaser.Sound.Events#LOOP + * @since 3.0.0 + */ + loop: { + get: function () + { + return this.currentConfig.loop; + }, -/***/ }), -/* 1184 */ -/***/ (function(module, exports, __webpack_require__) { + set: function (value) + { + this.currentConfig.loop = value; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.manager.isLocked(this, 'loop', value)) + { + return; + } -var Shader = __webpack_require__(229); -var GameObjectFactory = __webpack_require__(5); + if (this.audio) + { + this.audio.loop = value; + } -/** - * Creates a new Shader Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Shader Game Object and WebGL support have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#shader - * @webglOnly - * @since 3.17.0 - * - * @param {(string|Phaser.Display.BaseShader)} key - The key of the shader to use from the shader cache, or a BaseShader instance. - * @param {number} [x=0] - The horizontal position of this Game Object in the world. - * @param {number} [y=0] - The vertical position of this Game Object in the world. - * @param {number} [width=128] - The width of the Game Object. - * @param {number} [height=128] - The height of the Game Object. - * @param {string[]} [textures] - Optional array of texture keys to bind to the iChannel0...3 uniforms. The textures must already exist in the Texture Manager. - * @param {object} [textureData] - Optional additional texture data. - * - * @return {Phaser.GameObjects.Shader} The Game Object that was created. - */ -if (true) -{ - GameObjectFactory.register('shader', function (key, x, y, width, height, textures, textureData) + this.emit(Events.LOOP, this, value); + } + + }, + + /** + * Sets the loop state of this Sound. + * + * @method Phaser.Sound.HTML5AudioSound#setLoop + * @fires Phaser.Sound.Events#LOOP + * @since 3.4.0 + * + * @param {boolean} value - `true` to loop this sound, `false` to not loop it. + * + * @return {Phaser.Sound.HTML5AudioSound} This Sound instance. + */ + setLoop: function (value) { - return this.displayList.add(new Shader(this.scene, key, x, y, width, height, textures, textureData)); - }); -} + this.loop = value; + return this; + }, -/***/ }), -/* 1185 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Gets or sets the pan of this sound, a value between -1 (full left pan) and 1 (full right pan). + * + * Has no audible effect on HTML5 Audio Sound, but still generates the PAN Event. + * + * @name Phaser.Sound.HTML5AudioSound#pan + * @type {number} + * @default 0 + * @fires Phaser.Sound.Events#PAN + * @since 3.50.0 + */ + pan: { -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + get: function () + { + return this.currentConfig.pan; + }, -var Mesh = __webpack_require__(230); -var GameObjectFactory = __webpack_require__(5); + set: function (value) + { + this.currentConfig.pan = value; -/** - * Creates a new Mesh Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectFactory#mesh - * @webglOnly - * @since 3.0.0 - * - * @param {number} [x] - The horizontal position of this Game Object in the world. - * @param {number} [y] - The vertical position of this Game Object in the world. - * @param {string|Phaser.Textures.Texture} [texture] - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {string|number} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {number[]} [vertices] - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. - * @param {number[]} [uvs] - The UVs pairs array. - * @param {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. - * @param {boolean} [containsZ=false] - Does the vertices data include a `z` component? - * @param {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. - * @param {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. - * @param {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. - * - * @return {Phaser.GameObjects.Mesh} The Game Object that was created. - */ -if (true) -{ - GameObjectFactory.register('mesh', function (x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas) + this.emit(Events.PAN, this, value); + } + }, + + /** + * Sets the pan of this sound, a value between -1 (full left pan) and 1 (full right pan). + * + * Has no audible effect on HTML5 Audio Sound, but still generates the PAN Event. + * + * @method Phaser.Sound.HTML5AudioSound#setPan + * @fires Phaser.Sound.Events#PAN + * @since 3.50.0 + * + * @param {number} value - The pan of the sound. A value between -1 (full left pan) and 1 (full right pan). + * + * @return {this} This Sound instance. + */ + setPan: function (value) { - return this.displayList.add(new Mesh(this.scene, x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas)); - }); -} + this.pan = value; + + return this; + } + +}); + +module.exports = HTML5AudioSound; /***/ }), -/* 1186 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 27622: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Pavle Goloskokovic (http://prunegames.com) + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GameObjectFactory = __webpack_require__(5); -var PointLight = __webpack_require__(150); +var BaseSoundManager = __webpack_require__(12486); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(76038); +var HTML5AudioSound = __webpack_require__(34350); /** - * Creates a new Point Light Game Object and adds it to the Scene. - * - * Note: This method will only be available if the Point Light Game Object has been built into Phaser. - * - * The Point Light Game Object provides a way to add a point light effect into your game, - * without the expensive shader processing requirements of the traditional Light Game Object. - * - * The difference is that the Point Light renders using a custom shader, designed to give the - * impression of a point light source, of variable radius, intensity and color, in your game. - * However, unlike the Light Game Object, it does not impact any other Game Objects, or use their - * normal maps for calcuations. This makes them extremely fast to render compared to Lights - * and perfect for special effects, such as flickering torches or muzzle flashes. - * - * For maximum performance you should batch Point Light Game Objects together. This means - * ensuring they follow each other consecutively on the display list. Ideally, use a Layer - * Game Object and then add just Point Lights to it, so that it can batch together the rendering - * of the lights. You don't _have_ to do this, and if you've only a handful of Point Lights in - * your game then it's perfectly safe to mix them into the dislay list as normal. However, if - * you're using a large number of them, please consider how they are mixed into the display list. + * HTML5 Audio implementation of the Sound Manager. * - * The renderer will automatically cull Point Lights. Those with a radius that does not intersect - * with the Camera will be skipped in the rendering list. This happens automatically and the - * culled state is refreshed every frame, for every camera. + * To play multiple instances of the same HTML5 Audio sound, you need to provide an `instances` value when + * loading the sound with the Loader: * - * The origin of a Point Light is always 0.5 and it cannot be changed. + * ```javascript + * this.load.audio('explosion', 'explosion.mp3', { + * instances: 2 + * }); + * ``` * - * Point Lights are a WebGL only feature and do not have a Canvas counterpart. + * Not all browsers can play all audio formats. * - * @method Phaser.GameObjects.GameObjectFactory#pointlight - * @since 3.50.0 + * There is a good guide to what's supported: [Cross-browser audio basics: Audio codec support](https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics#Audio_Codec_Support). * - * @param {number} x - The horizontal position of this Point Light in the world. - * @param {number} y - The vertical position of this Point Light in the world. - * @param {number} [color=0xffffff] - The color of the Point Light, given as a hex value. - * @param {number} [radius=128] - The radius of the Point Light. - * @param {number} [intensity=1] - The intensity, or colr blend, of the Point Light. - * @param {number} [attenuation=0.1] - The attenuation of the Point Light. This is the reduction of light from the center point. + * @class HTML5AudioSoundManager + * @extends Phaser.Sound.BaseSoundManager + * @memberof Phaser.Sound + * @constructor + * @since 3.0.0 * - * @return {Phaser.GameObjects.PointLight} The Game Object that was created. + * @param {Phaser.Game} game - Reference to the current game instance. */ -GameObjectFactory.register('pointlight', function (x, y, color, radius, intensity, attenuation) -{ - return this.displayList.add(new PointLight(this.scene, x, y, color, radius, intensity, attenuation)); -}); +var HTML5AudioSoundManager = new Class({ + Extends: BaseSoundManager, -/***/ }), -/* 1187 */ -/***/ (function(module, exports, __webpack_require__) { + initialize: -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + function HTML5AudioSoundManager (game) + { + /** + * Flag indicating whether if there are no idle instances of HTML5 Audio tag, + * for any particular sound, if one of the used tags should be hijacked and used + * for succeeding playback or if succeeding Phaser.Sound.HTML5AudioSound#play + * call should be ignored. + * + * @name Phaser.Sound.HTML5AudioSoundManager#override + * @type {boolean} + * @default true + * @since 3.0.0 + */ + this.override = true; -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var Shader = __webpack_require__(229); + /** + * Value representing time difference, in seconds, between calling + * play method on an audio tag and when it actually starts playing. + * It is used to achieve more accurate delayed sound playback. + * + * You might need to tweak this value to get the desired results + * since audio play delay varies depending on the browser/platform. + * + * @name Phaser.Sound.HTML5AudioSoundManager#audioPlayDelay + * @type {number} + * @default 0.1 + * @since 3.0.0 + */ + this.audioPlayDelay = 0.1; -/** - * Creates a new Shader Game Object and returns it. - * - * Note: This method will only be available if the Shader Game Object and WebGL support have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectCreator#shader - * @since 3.17.0 - * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. - * - * @return {Phaser.GameObjects.Shader} The Game Object that was created. - */ -GameObjectCreator.register('shader', function (config, addToScene) -{ - if (config === undefined) { config = {}; } + /** + * A value by which we should offset the loop end marker of the + * looping sound to compensate for lag, caused by changing audio + * tag playback position, in order to achieve gapless looping. + * + * You might need to tweak this value to get the desired results + * since loop lag varies depending on the browser/platform. + * + * @name Phaser.Sound.HTML5AudioSoundManager#loopEndOffset + * @type {number} + * @default 0.05 + * @since 3.0.0 + */ + this.loopEndOffset = 0.05; - var key = GetAdvancedValue(config, 'key', null); - var x = GetAdvancedValue(config, 'x', 0); - var y = GetAdvancedValue(config, 'y', 0); - var width = GetAdvancedValue(config, 'width', 128); - var height = GetAdvancedValue(config, 'height', 128); + /** + * An array for keeping track of all the sounds + * that were paused when game lost focus. + * + * @name Phaser.Sound.HTML5AudioSoundManager#onBlurPausedSounds + * @type {Phaser.Sound.HTML5AudioSound[]} + * @private + * @default [] + * @since 3.0.0 + */ + this.onBlurPausedSounds = []; - var shader = new Shader(this.scene, key, x, y, width, height); + this.locked = 'ontouchstart' in window; - if (addToScene !== undefined) + /** + * A queue of all actions performed on sound objects while audio was locked. + * Once the audio gets unlocked, after an explicit user interaction, + * all actions will be performed in chronological order. + * Array of object types: { sound: Phaser.Sound.HTML5AudioSound, name: string, value?: * } + * + * @name Phaser.Sound.HTML5AudioSoundManager#lockedActionsQueue + * @type {array} + * @private + * @since 3.0.0 + */ + this.lockedActionsQueue = this.locked ? [] : null; + + /** + * Property that actually holds the value of global mute + * for HTML5 Audio sound manager implementation. + * + * @name Phaser.Sound.HTML5AudioSoundManager#_mute + * @type {boolean} + * @private + * @default false + * @since 3.0.0 + */ + this._mute = false; + + /** + * Property that actually holds the value of global volume + * for HTML5 Audio sound manager implementation. + * + * @name Phaser.Sound.HTML5AudioSoundManager#_volume + * @type {boolean} + * @private + * @default 1 + * @since 3.0.0 + */ + this._volume = 1; + + BaseSoundManager.call(this, game); + }, + + /** + * Adds a new sound into the sound manager. + * + * @method Phaser.Sound.HTML5AudioSoundManager#add + * @since 3.0.0 + * + * @param {string} key - Asset key for the sound. + * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. + * + * @return {Phaser.Sound.HTML5AudioSound} The new sound instance. + */ + add: function (key, config) { - config.add = addToScene; - } + var sound = new HTML5AudioSound(this, key, config); - BuildGameObject(this.scene, shader, config); + this.sounds.push(sound); - return shader; -}); + return sound; + }, -// When registering a factory function 'this' refers to the GameObjectCreator context. + /** + * Unlocks HTML5 Audio loading and playback on mobile + * devices on the initial explicit user interaction. + * + * @method Phaser.Sound.HTML5AudioSoundManager#unlock + * @since 3.0.0 + */ + unlock: function () + { + this.locked = false; + var _this = this; -/***/ }), -/* 1188 */ -/***/ (function(module, exports, __webpack_require__) { + this.game.cache.audio.entries.each(function (key, tags) + { + for (var i = 0; i < tags.length; i++) + { + if (tags[i].dataset.locked === 'true') + { + _this.locked = true; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return false; + } + } -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var GetValue = __webpack_require__(6); -var Mesh = __webpack_require__(230); + return true; + }); -/** - * Creates a new Mesh Game Object and returns it. - * - * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectCreator#mesh - * @since 3.0.0 - * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. - * - * @return {Phaser.GameObjects.Mesh} The Game Object that was created. - */ -GameObjectCreator.register('mesh', function (config, addToScene) -{ - if (config === undefined) { config = {}; } + if (!this.locked) + { + return; + } - var key = GetAdvancedValue(config, 'key', null); - var frame = GetAdvancedValue(config, 'frame', null); - var vertices = GetValue(config, 'vertices', []); - var uvs = GetValue(config, 'uvs', []); - var indicies = GetValue(config, 'indicies', []); - var containsZ = GetValue(config, 'containsZ', false); - var normals = GetValue(config, 'normals', []); - var colors = GetValue(config, 'colors', 0xffffff); - var alphas = GetValue(config, 'alphas', 1); + var moved = false; - var mesh = new Mesh(this.scene, 0, 0, key, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas); + var detectMove = function () + { + moved = true; + }; - if (addToScene !== undefined) - { - config.add = addToScene; - } + var unlock = function () + { + if (moved) + { + moved = false; + return; + } - BuildGameObject(this.scene, mesh, config); + document.body.removeEventListener('touchmove', detectMove); + document.body.removeEventListener('touchend', unlock); - return mesh; -}); + var lockedTags = []; + _this.game.cache.audio.entries.each(function (key, tags) + { + for (var i = 0; i < tags.length; i++) + { + var tag = tags[i]; -/***/ }), -/* 1189 */ -/***/ (function(module, exports, __webpack_require__) { + if (tag.dataset.locked === 'true') + { + lockedTags.push(tag); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return true; + }); -var BuildGameObject = __webpack_require__(28); -var GameObjectCreator = __webpack_require__(16); -var GetAdvancedValue = __webpack_require__(13); -var PointLight = __webpack_require__(150); + if (lockedTags.length === 0) + { + return; + } -/** - * Creates a new Point Light Game Object and returns it. - * - * Note: This method will only be available if the Point Light Game Object has been built into Phaser. - * - * @method Phaser.GameObjects.GameObjectCreator#pointlight - * @since 3.50.0 - * - * @param {object} config - The configuration object this Game Object will use to create itself. - * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. - * - * @return {Phaser.GameObjects.PointLight} The Game Object that was created. - */ -GameObjectCreator.register('pointlight', function (config, addToScene) -{ - if (config === undefined) { config = {}; } + var lastTag = lockedTags[lockedTags.length - 1]; - var color = GetAdvancedValue(config, 'color', 0xffffff); - var radius = GetAdvancedValue(config, 'radius', 128); - var intensity = GetAdvancedValue(config, 'intensity', 1); - var attenuation = GetAdvancedValue(config, 'attenuation', 0.1); + lastTag.oncanplaythrough = function () + { + lastTag.oncanplaythrough = null; - var layer = new PointLight(this.scene, 0, 0, color, radius, intensity, attenuation); + lockedTags.forEach(function (tag) + { + tag.dataset.locked = 'false'; + }); - if (addToScene !== undefined) - { - config.add = addToScene; - } + _this.unlocked = true; + }; - BuildGameObject(this.scene, layer, config); + lockedTags.forEach(function (tag) + { + tag.load(); + }); + }; - return layer; -}); + this.once(Events.UNLOCKED, function () + { + this.forEachActiveSound(function (sound) + { + if (sound.currentMarker === null && sound.duration === 0) + { + sound.duration = sound.tags[0].duration; + } + sound.totalDuration = sound.tags[0].duration; + }); -/***/ }), -/* 1190 */ -/***/ (function(module, exports, __webpack_require__) { + while (this.lockedActionsQueue.length) + { + var lockedAction = this.lockedActionsQueue.shift(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (lockedAction.sound[lockedAction.prop].apply) + { + lockedAction.sound[lockedAction.prop].apply(lockedAction.sound, lockedAction.value || []); + } + else + { + lockedAction.sound[lockedAction.prop] = lockedAction.value; + } + } -var Class = __webpack_require__(0); -var LightsManager = __webpack_require__(482); -var PluginCache = __webpack_require__(24); -var SceneEvents = __webpack_require__(20); + }, this); -/** - * @classdesc - * A Scene plugin that provides a {@link Phaser.GameObjects.LightsManager} for the Light2D pipeline. - * - * Available from within a Scene via `this.lights`. - * - * Add Lights using the {@link Phaser.GameObjects.LightsManager#addLight} method: - * - * ```javascript - * // Enable the Lights Manager because it is disabled by default - * this.lights.enable(); - * - * // Create a Light at [400, 300] with a radius of 200 - * this.lights.addLight(400, 300, 200); - * ``` - * - * For Game Objects to be affected by the Lights when rendered, you will need to set them to use the `Light2D` pipeline like so: - * - * ```javascript - * sprite.setPipeline('Light2D'); - * ``` - * - * Note that you cannot use this pipeline on Graphics Game Objects or Shape Game Objects. - * - * @class LightsPlugin - * @extends Phaser.GameObjects.LightsManager - * @memberof Phaser.GameObjects - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Scene} scene - The Scene that this Lights Plugin belongs to. - */ -var LightsPlugin = new Class({ + document.body.addEventListener('touchmove', detectMove, false); + document.body.addEventListener('touchend', unlock, false); + }, - Extends: LightsManager, + /** + * Method used internally for pausing sound manager if + * Phaser.Sound.HTML5AudioSoundManager#pauseOnBlur is set to true. + * + * @method Phaser.Sound.HTML5AudioSoundManager#onBlur + * @protected + * @since 3.0.0 + */ + onBlur: function () + { + this.forEachActiveSound(function (sound) + { + if (sound.isPlaying) + { + this.onBlurPausedSounds.push(sound); + sound.onBlur(); + } + }); + }, + + /** + * Method used internally for resuming sound manager if + * Phaser.Sound.HTML5AudioSoundManager#pauseOnBlur is set to true. + * + * @method Phaser.Sound.HTML5AudioSoundManager#onFocus + * @protected + * @since 3.0.0 + */ + onFocus: function () + { + this.onBlurPausedSounds.forEach(function (sound) + { + sound.onFocus(); + }); - initialize: + this.onBlurPausedSounds.length = 0; + }, - function LightsPlugin (scene) + /** + * Calls Phaser.Sound.BaseSoundManager#destroy method + * and cleans up all HTML5 Audio related stuff. + * + * @method Phaser.Sound.HTML5AudioSoundManager#destroy + * @since 3.0.0 + */ + destroy: function () { - /** - * A reference to the Scene that this Lights Plugin belongs to. - * - * @name Phaser.GameObjects.LightsPlugin#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; + BaseSoundManager.prototype.destroy.call(this); - /** - * A reference to the Scene's systems. - * - * @name Phaser.GameObjects.LightsPlugin#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; + this.onBlurPausedSounds.length = 0; + this.onBlurPausedSounds = null; + }, - if (!scene.sys.settings.isBooted) + /** + * Method used internally by Phaser.Sound.HTML5AudioSound class methods and property setters + * to check if sound manager is locked and then either perform action immediately or queue it + * to be performed once the sound manager gets unlocked. + * + * @method Phaser.Sound.HTML5AudioSoundManager#isLocked + * @protected + * @since 3.0.0 + * + * @param {Phaser.Sound.HTML5AudioSound} sound - Sound object on which to perform queued action. + * @param {string} prop - Name of the method to be called or property to be assigned a value to. + * @param {*} [value] - An optional parameter that either holds an array of arguments to be passed to the method call or value to be set to the property. + * + * @return {boolean} Whether the sound manager is locked. + */ + isLocked: function (sound, prop, value) + { + if (sound.tags[0].dataset.locked === 'true') { - scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + this.lockedActionsQueue.push({ + sound: sound, + prop: prop, + value: value + }); + + return true; } - LightsManager.call(this); + return false; }, /** - * Boot the Lights Plugin. + * Sets the muted state of all this Sound Manager. * - * @method Phaser.GameObjects.LightsPlugin#boot - * @since 3.0.0 + * @method Phaser.Sound.HTML5AudioSoundManager#setMute + * @fires Phaser.Sound.Events#GLOBAL_MUTE + * @since 3.3.0 + * + * @param {boolean} value - `true` to mute all sounds, `false` to unmute them. + * + * @return {Phaser.Sound.HTML5AudioSoundManager} This Sound Manager. */ - boot: function () + setMute: function (value) { - var eventEmitter = this.systems.events; + this.mute = value; - eventEmitter.on(SceneEvents.SHUTDOWN, this.shutdown, this); - eventEmitter.on(SceneEvents.DESTROY, this.destroy, this); + return this; }, /** - * Destroy the Lights Plugin. + * @name Phaser.Sound.HTML5AudioSoundManager#mute + * @type {boolean} + * @fires Phaser.Sound.Events#GLOBAL_MUTE + * @since 3.0.0 + */ + mute: { + + get: function () + { + return this._mute; + }, + + set: function (value) + { + this._mute = value; + + this.forEachActiveSound(function (sound) + { + sound.updateMute(); + }); + + this.emit(Events.GLOBAL_MUTE, this, value); + } + + }, + + /** + * Sets the volume of this Sound Manager. * - * Cleans up all references. + * @method Phaser.Sound.HTML5AudioSoundManager#setVolume + * @fires Phaser.Sound.Events#GLOBAL_VOLUME + * @since 3.3.0 * - * @method Phaser.GameObjects.LightsPlugin#destroy - * @since 3.0.0 + * @param {number} value - The global volume of this Sound Manager. + * + * @return {Phaser.Sound.HTML5AudioSoundManager} This Sound Manager. */ - destroy: function () + setVolume: function (value) { - this.shutdown(); - - this.scene = undefined; - this.systems = undefined; - } + this.volume = value; -}); + return this; + }, -PluginCache.register('LightsPlugin', LightsPlugin, 'lights'); + /** + * @name Phaser.Sound.HTML5AudioSoundManager#volume + * @type {number} + * @fires Phaser.Sound.Events#GLOBAL_VOLUME + * @since 3.0.0 + */ + volume: { -module.exports = LightsPlugin; + get: function () + { + return this._volume; + }, + set: function (value) + { + this._volume = value; -/***/ }), -/* 1191 */ -/***/ (function(module, exports, __webpack_require__) { + this.forEachActiveSound(function (sound) + { + sound.updateVolume(); + }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.emit(Events.GLOBAL_VOLUME, this, value); + } -var Circle = __webpack_require__(65); + } -Circle.Area = __webpack_require__(1192); -Circle.Circumference = __webpack_require__(302); -Circle.CircumferencePoint = __webpack_require__(169); -Circle.Clone = __webpack_require__(1193); -Circle.Contains = __webpack_require__(66); -Circle.ContainsPoint = __webpack_require__(1194); -Circle.ContainsRect = __webpack_require__(1195); -Circle.CopyFrom = __webpack_require__(1196); -Circle.Equals = __webpack_require__(1197); -Circle.GetBounds = __webpack_require__(1198); -Circle.GetPoint = __webpack_require__(300); -Circle.GetPoints = __webpack_require__(301); -Circle.Offset = __webpack_require__(1199); -Circle.OffsetPoint = __webpack_require__(1200); -Circle.Random = __webpack_require__(170); +}); -module.exports = Circle; +module.exports = HTML5AudioSoundManager; /***/ }), -/* 1192 */ -/***/ (function(module, exports) { + +/***/ 56751: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Pavle Goloskokovic (http://prunegames.com) + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Calculates the area of the circle. - * - * @function Phaser.Geom.Circle.Area - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the area of. - * - * @return {number} The area of the Circle. + * @namespace Phaser.Sound */ -var Area = function (circle) -{ - return (circle.radius > 0) ? Math.PI * circle.radius * circle.radius : 0; -}; -module.exports = Area; +module.exports = { + SoundManagerCreator: __webpack_require__(84191), -/***/ }), -/* 1193 */ -/***/ (function(module, exports, __webpack_require__) { + Events: __webpack_require__(76038), -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + BaseSound: __webpack_require__(25798), + BaseSoundManager: __webpack_require__(12486), -var Circle = __webpack_require__(65); + WebAudioSound: __webpack_require__(96008), + WebAudioSoundManager: __webpack_require__(55491), -/** - * Creates a new Circle instance based on the values contained in the given source. - * - * @function Phaser.Geom.Circle.Clone - * @since 3.0.0 - * - * @param {(Phaser.Geom.Circle|object)} source - The Circle to be cloned. Can be an instance of a Circle or a circle-like object, with x, y and radius properties. - * - * @return {Phaser.Geom.Circle} A clone of the source Circle. - */ -var Clone = function (source) -{ - return new Circle(source.x, source.y, source.radius); -}; + HTML5AudioSound: __webpack_require__(34350), + HTML5AudioSoundManager: __webpack_require__(27622), -module.exports = Clone; + NoAudioSound: __webpack_require__(38662), + NoAudioSoundManager: __webpack_require__(17546) + +}; /***/ }), -/* 1194 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 38662: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Pavle Goloskokovic (http://prunegames.com) + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(66); +var BaseSound = __webpack_require__(25798); +var Class = __webpack_require__(56694); +var EventEmitter = __webpack_require__(6659); +var Extend = __webpack_require__(98611); +var NOOP = __webpack_require__(72283); -/** - * Check to see if the Circle contains the given Point object. - * - * @function Phaser.Geom.Circle.ContainsPoint - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The Circle to check. - * @param {(Phaser.Geom.Point|object)} point - The Point object to check if it's within the Circle or not. - * - * @return {boolean} True if the Point coordinates are within the circle, otherwise false. - */ -var ContainsPoint = function (circle, point) +var returnFalse = function () { - return Contains(circle, point.x, point.y); + return false; }; -module.exports = ContainsPoint; - - -/***/ }), -/* 1195 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var returnNull = function () +{ + return null; +}; -var Contains = __webpack_require__(66); +var returnThis = function () +{ + return this; +}; /** - * Check to see if the Circle contains all four points of the given Rectangle object. + * @classdesc + * No audio implementation of the sound. It is used if audio has been + * disabled in the game config or the device doesn't support any audio. * - * @function Phaser.Geom.Circle.ContainsRect - * @since 3.0.0 + * It represents a graceful degradation of sound logic that provides + * minimal functionality and prevents Phaser projects that use audio from + * breaking on devices that don't support any audio playback technologies. * - * @param {Phaser.Geom.Circle} circle - The Circle to check. - * @param {(Phaser.Geom.Rectangle|object)} rect - The Rectangle object to check if it's within the Circle or not. + * @class NoAudioSound + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Sound + * @constructor + * @since 3.0.0 * - * @return {boolean} True if all of the Rectangle coordinates are within the circle, otherwise false. + * @param {Phaser.Sound.NoAudioSoundManager} manager - Reference to the current sound manager instance. + * @param {string} key - Asset key for the sound. + * @param {Phaser.Types.Sound.SoundConfig} [config={}] - An optional config object containing default sound settings. */ -var ContainsRect = function (circle, rect) -{ - return ( - Contains(circle, rect.x, rect.y) && - Contains(circle, rect.right, rect.y) && - Contains(circle, rect.x, rect.bottom) && - Contains(circle, rect.right, rect.bottom) - ); -}; +var NoAudioSound = new Class({ -module.exports = ContainsRect; + Extends: EventEmitter, + initialize: -/***/ }), -/* 1196 */ -/***/ (function(module, exports) { + function NoAudioSound (manager, key, config) + { + if (config === void 0) { config = {}; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + EventEmitter.call(this); -/** - * Copies the `x`, `y` and `radius` properties from the `source` Circle - * into the given `dest` Circle, then returns the `dest` Circle. - * - * @function Phaser.Geom.Circle.CopyFrom - * @since 3.0.0 - * - * @generic {Phaser.Geom.Circle} O - [dest,$return] - * - * @param {Phaser.Geom.Circle} source - The source Circle to copy the values from. - * @param {Phaser.Geom.Circle} dest - The destination Circle to copy the values to. - * - * @return {Phaser.Geom.Circle} The destination Circle. - */ -var CopyFrom = function (source, dest) -{ - return dest.setTo(source.x, source.y, source.radius); -}; + /** + * Local reference to the sound manager. + * + * @name Phaser.Sound.NoAudioSound#manager + * @type {Phaser.Sound.BaseSoundManager} + * @since 3.0.0 + */ + this.manager = manager; -module.exports = CopyFrom; + /** + * Asset key for the sound. + * + * @name Phaser.Sound.NoAudioSound#key + * @type {string} + * @readonly + * @since 3.0.0 + */ + this.key = key; + /** + * Flag indicating if sound is currently playing. + * + * @name Phaser.Sound.NoAudioSound#isPlaying + * @type {boolean} + * @default false + * @readonly + * @since 3.0.0 + */ + this.isPlaying = false; -/***/ }), -/* 1197 */ -/***/ (function(module, exports) { + /** + * Flag indicating if sound is currently paused. + * + * @name Phaser.Sound.NoAudioSound#isPaused + * @type {boolean} + * @default false + * @readonly + * @since 3.0.0 + */ + this.isPaused = false; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A property that holds the value of sound's actual playback rate, + * after its rate and detune values has been combined with global + * rate and detune values. + * + * @name Phaser.Sound.NoAudioSound#totalRate + * @type {number} + * @default 1 + * @readonly + * @since 3.0.0 + */ + this.totalRate = 1; -/** - * Compares the `x`, `y` and `radius` properties of the two given Circles. - * Returns `true` if they all match, otherwise returns `false`. - * - * @function Phaser.Geom.Circle.Equals - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The first Circle to compare. - * @param {Phaser.Geom.Circle} toCompare - The second Circle to compare. - * - * @return {boolean} `true` if the two Circles equal each other, otherwise `false`. - */ -var Equals = function (circle, toCompare) -{ - return ( - circle.x === toCompare.x && - circle.y === toCompare.y && - circle.radius === toCompare.radius - ); -}; + /** + * A value representing the duration, in seconds. + * It could be total sound duration or a marker duration. + * + * @name Phaser.Sound.NoAudioSound#duration + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.duration = 0; -module.exports = Equals; + /** + * The total duration of the sound in seconds. + * + * @name Phaser.Sound.NoAudioSound#totalDuration + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.totalDuration = 0; + /** + * A config object used to store default sound settings' values. + * Default values will be set by properties' setters. + * + * @name Phaser.Sound.NoAudioSound#config + * @type {Phaser.Types.Sound.SoundConfig} + * @since 3.0.0 + */ + this.config = Extend({ + mute: false, + volume: 1, + rate: 1, + detune: 0, + seek: 0, + loop: false, + delay: 0, + pan: 0 + }, config); -/***/ }), -/* 1198 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Reference to the currently used config. + * It could be default config or marker config. + * + * @name Phaser.Sound.NoAudioSound#currentConfig + * @type {Phaser.Types.Sound.SoundConfig} + * @since 3.0.0 + */ + this.currentConfig = this.config; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Boolean indicating whether the sound is muted or not. + * Gets or sets the muted state of this sound. + * + * @name Phaser.Sound.NoAudioSound#mute + * @type {boolean} + * @default false + * @fires Phaser.Sound.Events#MUTE + * @since 3.0.0 + */ + this.mute = false; -var Rectangle = __webpack_require__(10); + /** + * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). + * + * @name Phaser.Sound.NoAudioSound#volume + * @type {number} + * @default 1 + * @fires Phaser.Sound.Events#VOLUME + * @since 3.0.0 + */ + this.volume = 1; -/** - * Returns the bounds of the Circle object. - * - * @function Phaser.Geom.Circle.GetBounds - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [out,$return] - * - * @param {Phaser.Geom.Circle} circle - The Circle to get the bounds from. - * @param {(Phaser.Geom.Rectangle|object)} [out] - A Rectangle, or rectangle-like object, to store the circle bounds in. If not given a new Rectangle will be created. - * - * @return {(Phaser.Geom.Rectangle|object)} The Rectangle object containing the Circles bounds. - */ -var GetBounds = function (circle, out) -{ - if (out === undefined) { out = new Rectangle(); } + /** + * Rate at which this Sound will be played. + * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed + * and 2.0 doubles the audios playback speed. + * + * @name Phaser.Sound.NoAudioSound#rate + * @type {number} + * @default 1 + * @fires Phaser.Sound.Events#RATE + * @since 3.0.0 + */ + this.rate = 1; - out.x = circle.left; - out.y = circle.top; - out.width = circle.diameter; - out.height = circle.diameter; + /** + * The detune value of this Sound, given in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). + * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @name Phaser.Sound.NoAudioSound#detune + * @type {number} + * @default 0 + * @fires Phaser.Sound.Events#DETUNE + * @since 3.0.0 + */ + this.detune = 0; - return out; -}; + /** + * Property representing the position of playback for this sound, in seconds. + * Setting it to a specific value moves current playback to that position. + * The value given is clamped to the range 0 to current marker duration. + * Setting seek of a stopped sound has no effect. + * + * @name Phaser.Sound.NoAudioSound#seek + * @type {number} + * @fires Phaser.Sound.Events#SEEK + * @since 3.0.0 + */ + this.seek = 0; -module.exports = GetBounds; + /** + * Flag indicating whether or not the sound or current sound marker will loop. + * + * @name Phaser.Sound.NoAudioSound#loop + * @type {boolean} + * @default false + * @fires Phaser.Sound.Events#LOOP + * @since 3.0.0 + */ + this.loop = false; + /** + * Gets or sets the pan of this sound, a value between -1 (full left pan) and 1 (full right pan). + * + * Always returns zero on iOS / Safari as it doesn't support the stereo panner node. + * + * @name Phaser.Sound.NoAudioSound#pan + * @type {number} + * @default 0 + * @fires Phaser.Sound.Events#PAN + * @since 3.50.0 + */ + this.pan = 0; -/***/ }), -/* 1199 */ -/***/ (function(module, exports) { + /** + * Object containing markers definitions. + * + * @name Phaser.Sound.NoAudioSound#markers + * @type {Object.} + * @default {} + * @readonly + * @since 3.0.0 + */ + this.markers = {}; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Currently playing marker. + * 'null' if whole sound is playing. + * + * @name Phaser.Sound.NoAudioSound#currentMarker + * @type {Phaser.Types.Sound.SoundMarker} + * @default null + * @readonly + * @since 3.0.0 + */ + this.currentMarker = null; -/** - * Offsets the Circle by the values given. - * - * @function Phaser.Geom.Circle.Offset - * @since 3.0.0 - * - * @generic {Phaser.Geom.Circle} O - [circle,$return] - * - * @param {Phaser.Geom.Circle} circle - The Circle to be offset (translated.) - * @param {number} x - The amount to horizontally offset the Circle by. - * @param {number} y - The amount to vertically offset the Circle by. - * - * @return {Phaser.Geom.Circle} The Circle that was offset. - */ -var Offset = function (circle, x, y) -{ - circle.x += x; - circle.y += y; + /** + * Flag indicating if destroy method was called on this sound. + * + * @name Phaser.Sound.NoAudioSound#pendingRemove + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.pendingRemove = false; + }, - return circle; -}; + /** + * @method Phaser.Sound.NoAudioSound#addMarker + * @since 3.0.0 + * + * @param {Phaser.Types.Sound.SoundMarker} marker - Marker object. + * + * @return {boolean} false + */ + addMarker: returnFalse, -module.exports = Offset; + /** + * @method Phaser.Sound.NoAudioSound#updateMarker + * @since 3.0.0 + * + * @param {Phaser.Types.Sound.SoundMarker} marker - Marker object with updated values. + * + * @return {boolean} false + */ + updateMarker: returnFalse, + /** + * @method Phaser.Sound.NoAudioSound#removeMarker + * @since 3.0.0 + * + * @param {string} markerName - The name of the marker to remove. + * + * @return {null} null + */ + removeMarker: returnNull, -/***/ }), -/* 1200 */ -/***/ (function(module, exports) { + /** + * @method Phaser.Sound.NoAudioSound#play + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Sound.SoundConfig)} [markerName=''] - If you want to play a marker then provide the marker name here. Alternatively, this parameter can be a SoundConfig object. + * @param {Phaser.Types.Sound.SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound. + * + * @return {boolean} false + */ + play: returnFalse, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * @method Phaser.Sound.NoAudioSound#pause + * @since 3.0.0 + * + * @return {boolean} false + */ + pause: returnFalse, -/** - * Offsets the Circle by the values given in the `x` and `y` properties of the Point object. - * - * @function Phaser.Geom.Circle.OffsetPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Circle} O - [circle,$return] - * - * @param {Phaser.Geom.Circle} circle - The Circle to be offset (translated.) - * @param {(Phaser.Geom.Point|object)} point - The Point object containing the values to offset the Circle by. - * - * @return {Phaser.Geom.Circle} The Circle that was offset. - */ -var OffsetPoint = function (circle, point) -{ - circle.x += point.x; - circle.y += point.y; + /** + * Resumes the sound. + * + * @method Phaser.Sound.NoAudioSound#resume + * @since 3.0.0 + * + * @return {boolean} false + */ + resume: returnFalse, - return circle; -}; + /** + * Stop playing this sound. + * + * @method Phaser.Sound.NoAudioSound#stop + * @since 3.0.0 + * + * @return {boolean} false + */ + stop: returnFalse, -module.exports = OffsetPoint; + /** + * Sets the muted state of this Sound. + * + * @method Phaser.Sound.NoAudioSound#setMute + * @since 3.4.0 + * + * @param {boolean} value - `true` to mute this sound, `false` to unmute it. + * + * @return {this} This Sound instance. + */ + setMute: returnThis, + + /** + * Sets the volume of this Sound. + * + * @method Phaser.Sound.NoAudioSound#setVolume + * @since 3.4.0 + * + * @param {number} value - The volume of the sound. + * + * @return {this} This Sound instance. + */ + setVolume: returnThis, + /** + * Sets the playback rate of this Sound. + * + * For example, a value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed + * and 2.0 doubles the audios playback speed. + * + * @method Phaser.Sound.NoAudioSound#setRate + * @since 3.3.0 + * + * @param {number} value - The playback rate at of this Sound. + * + * @return {this} This Sound instance. + */ + setRate: returnThis, -/***/ }), -/* 1201 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Sets the detune value of this Sound, given in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). + * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @method Phaser.Sound.NoAudioSound#setDetune + * @since 3.3.0 + * + * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @return {this} This Sound instance. + */ + setDetune: returnThis, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Seeks to a specific point in this sound. + * + * @method Phaser.Sound.NoAudioSound#setSeek + * @since 3.4.0 + * + * @param {number} value - The point in the sound to seek to. + * + * @return {this} This Sound instance. + */ + setSeek: returnThis, -var Ellipse = __webpack_require__(111); + /** + * Sets the loop state of this Sound. + * + * @method Phaser.Sound.NoAudioSound#setLoop + * @since 3.4.0 + * + * @param {boolean} value - `true` to loop this sound, `false` to not loop it. + * + * @return {this} This Sound instance. + */ + setLoop: returnThis, -Ellipse.Area = __webpack_require__(1202); -Ellipse.Circumference = __webpack_require__(447); -Ellipse.CircumferencePoint = __webpack_require__(218); -Ellipse.Clone = __webpack_require__(1203); -Ellipse.Contains = __webpack_require__(112); -Ellipse.ContainsPoint = __webpack_require__(1204); -Ellipse.ContainsRect = __webpack_require__(1205); -Ellipse.CopyFrom = __webpack_require__(1206); -Ellipse.Equals = __webpack_require__(1207); -Ellipse.GetBounds = __webpack_require__(1208); -Ellipse.GetPoint = __webpack_require__(445); -Ellipse.GetPoints = __webpack_require__(446); -Ellipse.Offset = __webpack_require__(1209); -Ellipse.OffsetPoint = __webpack_require__(1210); -Ellipse.Random = __webpack_require__(180); + /** + * Sets the pan of this sound, a value between -1 (full left pan) and 1 (full right pan). + * + * Note: iOS / Safari doesn't support the stereo panner node. + * + * @method Phaser.Sound.NoAudioSound#setPan + * @since 3.50.0 + * + * @param {number} value - The pan of the sound. A value between -1 (full left pan) and 1 (full right pan). + * + * @return {this} This Sound instance. + */ + setPan: returnThis, -module.exports = Ellipse; + /** + * Method used internally for applying config values to some of the sound properties. + * + * @method Phaser.Sound.NoAudioSound#applyConfig + * @since 3.0.0 + */ + applyConfig: returnNull, + /** + * Method used internally for resetting values of some of the config properties. + * + * @method Phaser.Sound.NoAudioSound#resetConfig + * @since 3.0.0 + */ + resetConfig: returnNull, -/***/ }), -/* 1202 */ -/***/ (function(module, exports) { + /** + * Update method called automatically by sound manager on every game step. + * + * @method Phaser.Sound.NoAudioSound#update + * @override + * @since 3.0.0 + * + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time elapsed since the last frame. + */ + update: NOOP, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Method used internally to calculate total playback rate of the sound. + * + * @method Phaser.Sound.NoAudioSound#calculateRate + * @since 3.0.0 + */ + calculateRate: returnNull, -/** - * Calculates the area of the Ellipse. - * - * @function Phaser.Geom.Ellipse.Area - * @since 3.0.0 - * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the area of. - * - * @return {number} The area of the Ellipse. - */ -var Area = function (ellipse) -{ - if (ellipse.isEmpty()) + /** + * Destroys this sound and all associated events and marks it for removal from the sound manager. + * + * @method Phaser.Sound.NoAudioSound#destroy + * @fires Phaser.Sound.Events#DESTROY + * @since 3.0.0 + */ + destroy: function () { - return 0; + BaseSound.prototype.destroy.call(this); } - // units squared - return (ellipse.getMajorRadius() * ellipse.getMinorRadius() * Math.PI); -}; +}); -module.exports = Area; +module.exports = NoAudioSound; /***/ }), -/* 1203 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 17546: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Pavle Goloskokovic (http://prunegames.com) + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Ellipse = __webpack_require__(111); +var BaseSoundManager = __webpack_require__(12486); +var Class = __webpack_require__(56694); +var EventEmitter = __webpack_require__(6659); +var NoAudioSound = __webpack_require__(38662); +var NOOP = __webpack_require__(72283); /** - * Creates a new Ellipse instance based on the values contained in the given source. + * @classdesc + * No-audio implementation of the Sound Manager. It is used if audio has been + * disabled in the game config or the device doesn't support any audio. * - * @function Phaser.Geom.Ellipse.Clone - * @since 3.0.0 + * It represents a graceful degradation of Sound Manager logic that provides + * minimal functionality and prevents Phaser projects that use audio from + * breaking on devices that don't support any audio playback technologies. * - * @param {Phaser.Geom.Ellipse} source - The Ellipse to be cloned. Can be an instance of an Ellipse or a ellipse-like object, with x, y, width and height properties. + * @class NoAudioSoundManager + * @extends Phaser.Sound.BaseSoundManager + * @memberof Phaser.Sound + * @constructor + * @since 3.0.0 * - * @return {Phaser.Geom.Ellipse} A clone of the source Ellipse. + * @param {Phaser.Game} game - Reference to the current game instance. */ -var Clone = function (source) -{ - return new Ellipse(source.x, source.y, source.width, source.height); -}; +var NoAudioSoundManager = new Class({ -module.exports = Clone; + Extends: EventEmitter, + initialize: -/***/ }), -/* 1204 */ -/***/ (function(module, exports, __webpack_require__) { + function NoAudioSoundManager (game) + { + EventEmitter.call(this); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.game = game; + this.sounds = []; + this.mute = false; + this.volume = 1; + this.rate = 1; + this.detune = 0; + this.pauseOnBlur = true; + this.locked = false; + }, -var Contains = __webpack_require__(112); + /** + * Adds a new sound into the sound manager. + * + * @method Phaser.Sound.NoAudioSoundManager#add + * @since 3.60.0 + * + * @param {string} key - Asset key for the sound. + * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. + * + * @return {Phaser.Sound.NoAudioSound} The new sound instance. + */ + add: function (key, config) + { + var sound = new NoAudioSound(this, key, config); -/** - * Check to see if the Ellipse contains the given Point object. - * - * @function Phaser.Geom.Ellipse.ContainsPoint - * @since 3.0.0 - * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to check. - * @param {(Phaser.Geom.Point|object)} point - The Point object to check if it's within the Circle or not. - * - * @return {boolean} True if the Point coordinates are within the circle, otherwise false. - */ -var ContainsPoint = function (ellipse, point) -{ - return Contains(ellipse, point.x, point.y); -}; + this.sounds.push(sound); -module.exports = ContainsPoint; + return sound; + }, + /** + * Adds a new audio sprite sound into the sound manager. + * Audio Sprites are a combination of audio files and a JSON configuration. + * The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite + * + * @method Phaser.Sound.NoAudioSoundManager#addAudioSprite + * @since 3.60.0 + * + * @param {string} key - Asset key for the sound. + * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. + * + * @return {Phaser.Sound.NoAudioSound} The new audio sprite sound instance. + */ + addAudioSprite: function (key, config) + { + var sound = this.add(key, config); -/***/ }), -/* 1205 */ -/***/ (function(module, exports, __webpack_require__) { + sound.spritemap = {}; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return sound; + }, -var Contains = __webpack_require__(112); + /** + * Gets the first sound in the manager matching the given key, if any. + * + * @method Phaser.Sound.NoAudioSoundManager#get + * @since 3.23.0 + * + * @generic {Phaser.Sound.BaseSound} T + * @genericUse {T} - [$return] + * + * @param {string} key - Sound asset key. + * + * @return {?Phaser.Sound.BaseSound} - The sound, or null. + */ + get: function (key) + { + return BaseSoundManager.prototype.get.call(this, key); + }, -/** - * Check to see if the Ellipse contains all four points of the given Rectangle object. - * - * @function Phaser.Geom.Ellipse.ContainsRect - * @since 3.0.0 - * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to check. - * @param {(Phaser.Geom.Rectangle|object)} rect - The Rectangle object to check if it's within the Ellipse or not. - * - * @return {boolean} True if all of the Rectangle coordinates are within the ellipse, otherwise false. - */ -var ContainsRect = function (ellipse, rect) -{ - return ( - Contains(ellipse, rect.x, rect.y) && - Contains(ellipse, rect.right, rect.y) && - Contains(ellipse, rect.x, rect.bottom) && - Contains(ellipse, rect.right, rect.bottom) - ); -}; + /** + * Gets any sounds in the manager matching the given key. + * + * @method Phaser.Sound.NoAudioSoundManager#getAll + * @since 3.23.0 + * + * @generic {Phaser.Sound.BaseSound} T + * @genericUse {T[]} - [$return] + * + * @param {string} key - Sound asset key. + * + * @return {Phaser.Sound.BaseSound[]} - The sounds, or an empty array. + */ + getAll: function (key) + { + return BaseSoundManager.prototype.getAll.call(this, key); + }, + + /** + * This method does nothing but return 'false' for the No Audio Sound Manager, to maintain + * compatibility with the other Sound Managers. + * + * @method Phaser.Sound.NoAudioSoundManager#play + * @since 3.0.0 + * + * @param {string} key - Asset key for the sound. + * @param {(Phaser.Types.Sound.SoundConfig|Phaser.Types.Sound.SoundMarker)} [extra] - An optional additional object containing settings to be applied to the sound. It could be either config or marker object. + * + * @return {boolean} Always 'false' for the No Audio Sound Manager. + */ + // eslint-disable-next-line no-unused-vars + play: function (key, extra) + { + return false; + }, + + /** + * This method does nothing but return 'false' for the No Audio Sound Manager, to maintain + * compatibility with the other Sound Managers. + * + * @method Phaser.Sound.NoAudioSoundManager#playAudioSprite + * @since 3.0.0 + * + * @param {string} key - Asset key for the sound. + * @param {string} spriteName - The name of the sound sprite to play. + * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. + * + * @return {boolean} Always 'false' for the No Audio Sound Manager. + */ + // eslint-disable-next-line no-unused-vars + playAudioSprite: function (key, spriteName, config) + { + return false; + }, + + /** + * Removes a sound from the sound manager. + * The removed sound is destroyed before removal. + * + * @method Phaser.Sound.NoAudioSoundManager#remove + * @since 3.0.0 + * + * @param {Phaser.Sound.BaseSound} sound - The sound object to remove. + * + * @return {boolean} True if the sound was removed successfully, otherwise false. + */ + remove: function (sound) + { + return BaseSoundManager.prototype.remove.call(this, sound); + }, + + /** + * Removes all sounds from the manager, destroying the sounds. + * + * @method Phaser.Sound.NoAudioSoundManager#removeAll + * @since 3.23.0 + */ + removeAll: function () + { + return BaseSoundManager.prototype.removeAll.call(this); + }, + + /** + * Removes all sounds from the sound manager that have an asset key matching the given value. + * The removed sounds are destroyed before removal. + * + * @method Phaser.Sound.NoAudioSoundManager#removeByKey + * @since 3.0.0 + * + * @param {string} key - The key to match when removing sound objects. + * + * @return {number} The number of matching sound objects that were removed. + */ + removeByKey: function (key) + { + return BaseSoundManager.prototype.removeByKey.call(this, key); + }, + + /** + * Stops any sounds matching the given key. + * + * @method Phaser.Sound.NoAudioSoundManager#stopByKey + * @since 3.23.0 + * + * @param {string} key - Sound asset key. + * + * @return {number} - How many sounds were stopped. + */ + stopByKey: function (key) + { + return BaseSoundManager.prototype.stopByKey.call(this, key); + }, + + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#onBlur + * @since 3.0.0 + */ + onBlur: NOOP, + + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#onFocus + * @since 3.0.0 + */ + onFocus: NOOP, + + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#onGameBlur + * @since 3.0.0 + */ + onGameBlur: NOOP, + + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#onGameFocus + * @since 3.0.0 + */ + onGameFocus: NOOP, + + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#pauseAll + * @since 3.0.0 + */ + pauseAll: NOOP, + + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#resumeAll + * @since 3.0.0 + */ + resumeAll: NOOP, -module.exports = ContainsRect; + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#stopAll + * @since 3.0.0 + */ + stopAll: NOOP, + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#update + * @since 3.0.0 + */ + update: NOOP, -/***/ }), -/* 1206 */ -/***/ (function(module, exports) { + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#setRate + * @since 3.0.0 + * + * @return {this} This Sound Manager. + */ + setRate: NOOP, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#setDetune + * @since 3.0.0 + * + * @return {this} This Sound Manager. + */ + setDetune: NOOP, -/** - * Copies the `x`, `y`, `width` and `height` properties from the `source` Ellipse - * into the given `dest` Ellipse, then returns the `dest` Ellipse. - * - * @function Phaser.Geom.Ellipse.CopyFrom - * @since 3.0.0 - * - * @generic {Phaser.Geom.Ellipse} O - [dest,$return] - * - * @param {Phaser.Geom.Ellipse} source - The source Ellipse to copy the values from. - * @param {Phaser.Geom.Ellipse} dest - The destination Ellipse to copy the values to. - * - * @return {Phaser.Geom.Ellipse} The destination Ellipse. - */ -var CopyFrom = function (source, dest) -{ - return dest.setTo(source.x, source.y, source.width, source.height); -}; + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#setMute + * @since 3.0.0 + */ + setMute: NOOP, -module.exports = CopyFrom; + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#setVolume + * @since 3.0.0 + */ + setVolume: NOOP, + /** + * Empty function for the No Audio Sound Manager. + * + * @method Phaser.Sound.NoAudioSoundManager#unlock + * @since 3.0.0 + */ + unlock: NOOP, -/***/ }), -/* 1207 */ -/***/ (function(module, exports) { + /** + * Method used internally for iterating only over active sounds and skipping sounds that are marked for removal. + * + * @method Phaser.Sound.NoAudioSoundManager#forEachActiveSound + * @private + * @since 3.0.0 + * + * @param {Phaser.Types.Sound.EachActiveSoundCallback} callback - Callback function. (manager: Phaser.Sound.BaseSoundManager, sound: Phaser.Sound.BaseSound, index: number, sounds: Phaser.Manager.BaseSound[]) => void + * @param {*} [scope] - Callback context. + */ + forEachActiveSound: function (callbackfn, scope) + { + BaseSoundManager.prototype.forEachActiveSound.call(this, callbackfn, scope); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Destroys all the sounds in the game and all associated events. + * + * @method Phaser.Sound.NoAudioSoundManager#destroy + * @since 3.0.0 + */ + destroy: function () + { + BaseSoundManager.prototype.destroy.call(this); + } -/** - * Compares the `x`, `y`, `width` and `height` properties of the two given Ellipses. - * Returns `true` if they all match, otherwise returns `false`. - * - * @function Phaser.Geom.Ellipse.Equals - * @since 3.0.0 - * - * @param {Phaser.Geom.Ellipse} ellipse - The first Ellipse to compare. - * @param {Phaser.Geom.Ellipse} toCompare - The second Ellipse to compare. - * - * @return {boolean} `true` if the two Ellipse equal each other, otherwise `false`. - */ -var Equals = function (ellipse, toCompare) -{ - return ( - ellipse.x === toCompare.x && - ellipse.y === toCompare.y && - ellipse.width === toCompare.width && - ellipse.height === toCompare.height - ); -}; +}); -module.exports = Equals; +module.exports = NoAudioSoundManager; /***/ }), -/* 1208 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 96008: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Pavle Goloskokovic (http://prunegames.com) + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Rectangle = __webpack_require__(10); +var BaseSound = __webpack_require__(25798); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(76038); +var GetFastValue = __webpack_require__(72632); /** - * Returns the bounds of the Ellipse object. + * @classdesc + * Web Audio API implementation of the sound. * - * @function Phaser.Geom.Ellipse.GetBounds + * @class WebAudioSound + * @extends Phaser.Sound.BaseSound + * @memberof Phaser.Sound + * @constructor * @since 3.0.0 * - * @generic {Phaser.Geom.Rectangle} O - [out,$return] - * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the bounds from. - * @param {(Phaser.Geom.Rectangle|object)} [out] - A Rectangle, or rectangle-like object, to store the ellipse bounds in. If not given a new Rectangle will be created. - * - * @return {(Phaser.Geom.Rectangle|object)} The Rectangle object containing the Ellipse bounds. + * @param {Phaser.Sound.WebAudioSoundManager} manager - Reference to the WebAudio Sound Manager that owns this Sound instance. + * @param {string} key - Asset key for the sound. + * @param {Phaser.Types.Sound.SoundConfig} [config={}] - An optional config object containing default sound settings. */ -var GetBounds = function (ellipse, out) -{ - if (out === undefined) { out = new Rectangle(); } - - out.x = ellipse.left; - out.y = ellipse.top; - out.width = ellipse.width; - out.height = ellipse.height; - - return out; -}; - -module.exports = GetBounds; - +var WebAudioSound = new Class({ -/***/ }), -/* 1209 */ -/***/ (function(module, exports) { + Extends: BaseSound, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + initialize: -/** - * Offsets the Ellipse by the values given. - * - * @function Phaser.Geom.Ellipse.Offset - * @since 3.0.0 - * - * @generic {Phaser.Geom.Ellipse} O - [ellipse,$return] - * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to be offset (translated.) - * @param {number} x - The amount to horizontally offset the Ellipse by. - * @param {number} y - The amount to vertically offset the Ellipse by. - * - * @return {Phaser.Geom.Ellipse} The Ellipse that was offset. - */ -var Offset = function (ellipse, x, y) -{ - ellipse.x += x; - ellipse.y += y; + function WebAudioSound (manager, key, config) + { + if (config === undefined) { config = {}; } - return ellipse; -}; + /** + * Audio buffer containing decoded data of the audio asset to be played. + * + * @name Phaser.Sound.WebAudioSound#audioBuffer + * @type {AudioBuffer} + * @since 3.0.0 + */ + this.audioBuffer = manager.game.cache.audio.get(key); -module.exports = Offset; + if (!this.audioBuffer) + { + throw new Error('Audio key "' + key + '" missing from cache'); + } + /** + * A reference to an audio source node used for playing back audio from + * audio data stored in Phaser.Sound.WebAudioSound#audioBuffer. + * + * @name Phaser.Sound.WebAudioSound#source + * @type {AudioBufferSourceNode} + * @default null + * @since 3.0.0 + */ + this.source = null; -/***/ }), -/* 1210 */ -/***/ (function(module, exports) { + /** + * A reference to a second audio source used for gapless looped playback. + * + * @name Phaser.Sound.WebAudioSound#loopSource + * @type {AudioBufferSourceNode} + * @default null + * @since 3.0.0 + */ + this.loopSource = null; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Gain node responsible for controlling this sound's muting. + * + * @name Phaser.Sound.WebAudioSound#muteNode + * @type {GainNode} + * @since 3.0.0 + */ + this.muteNode = manager.context.createGain(); -/** - * Offsets the Ellipse by the values given in the `x` and `y` properties of the Point object. - * - * @function Phaser.Geom.Ellipse.OffsetPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Ellipse} O - [ellipse,$return] - * - * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to be offset (translated.) - * @param {(Phaser.Geom.Point|object)} point - The Point object containing the values to offset the Ellipse by. - * - * @return {Phaser.Geom.Ellipse} The Ellipse that was offset. - */ -var OffsetPoint = function (ellipse, point) -{ - ellipse.x += point.x; - ellipse.y += point.y; + /** + * Gain node responsible for controlling this sound's volume. + * + * @name Phaser.Sound.WebAudioSound#volumeNode + * @type {GainNode} + * @since 3.0.0 + */ + this.volumeNode = manager.context.createGain(); - return ellipse; -}; + /** + * Panner node responsible for controlling this sound's pan. + * + * Doesn't work on iOS / Safari. + * + * @name Phaser.Sound.WebAudioSound#pannerNode + * @type {StereoPannerNode} + * @since 3.50.0 + */ + this.pannerNode = null; -module.exports = OffsetPoint; + /** + * The Stereo Spatial Panner node. + * + * @name Phaser.Sound.WebAudioSound#spatialNode + * @type {PannerNode} + * @since 3.60.0 + */ + this.spatialNode = null; + /** + * If the Spatial Panner node has been set to track a vector or + * Game Object, this retains a reference to it. + * + * @name Phaser.Sound.WebAudioSound#spatialSource + * @type {Phaser.Types.Math.Vector2Like} + * @since 3.60.0 + */ + this.spatialSource = null; -/***/ }), -/* 1211 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The time at which the sound should have started playback from the beginning. + * + * Treat this property as read-only. + * + * Based on `BaseAudioContext.currentTime` value. + * + * @name Phaser.Sound.WebAudioSound#playTime + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.playTime = 0; -/** - * @author Florian Vazelle - * @author Geoffrey Glaive - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The time at which the sound source should have actually started playback. + * + * Treat this property as read-only. + * + * Based on `BaseAudioContext.currentTime` value. + * + * @name Phaser.Sound.WebAudioSound#startTime + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.startTime = 0; -var Point = __webpack_require__(4); -var CircleToCircle = __webpack_require__(231); + /** + * The time at which the sound loop source should actually start playback. + * + * Based on `BaseAudioContext.currentTime` value. + * + * @name Phaser.Sound.WebAudioSound#loopTime + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.loopTime = 0; -/** - * Checks if two Circles intersect and returns the intersection points as a Point object array. - * - * @function Phaser.Geom.Intersects.GetCircleToCircle - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circleA - The first Circle to check for intersection. - * @param {Phaser.Geom.Circle} circleB - The second Circle to check for intersection. - * @param {array} [out] - An optional array in which to store the points of intersection. - * - * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. - */ -var GetCircleToCircle = function (circleA, circleB, out) -{ - if (out === undefined) { out = []; } + /** + * An array where we keep track of all rate updates during playback. + * + * Treat this property as read-only. + * + * Array of object types: `{ time: number, rate: number }` + * + * @name Phaser.Sound.WebAudioSound#rateUpdates + * @type {array} + * @default [] + * @since 3.0.0 + */ + this.rateUpdates = []; - if (CircleToCircle(circleA, circleB)) - { - var x0 = circleA.x; - var y0 = circleA.y; - var r0 = circleA.radius; + /** + * Used for keeping track when sound source playback has ended + * so its state can be updated accordingly. + * + * @name Phaser.Sound.WebAudioSound#hasEnded + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.hasEnded = false; - var x1 = circleB.x; - var y1 = circleB.y; - var r1 = circleB.radius; + /** + * Used for keeping track when sound source has looped + * so its state can be updated accordingly. + * + * @name Phaser.Sound.WebAudioSound#hasLooped + * @type {boolean} + * @readonly + * @default false + * @since 3.0.0 + */ + this.hasLooped = false; - var coefficientA, coefficientB, coefficientC, lambda, x; + this.muteNode.connect(this.volumeNode); - if (y0 === y1) + if (manager.context.createPanner) { - x = ((r1 * r1) - (r0 * r0) - (x1 * x1) + (x0 * x0)) / (2 * (x0 - x1)); + this.spatialNode = manager.context.createPanner(); - coefficientA = 1; - coefficientB = -2 * y1; - coefficientC = (x1 * x1) + (x * x) - (2 * x1 * x) + (y1 * y1) - (r1 * r1); + this.volumeNode.connect(this.spatialNode); + } - lambda = (coefficientB * coefficientB) - (4 * coefficientA * coefficientC); + if (manager.context.createStereoPanner) + { + this.pannerNode = manager.context.createStereoPanner(); - if (lambda === 0) + if (manager.context.createPanner) { - out.push(new Point(x, (-coefficientB / (2 * coefficientA)))); + this.spatialNode.connect(this.pannerNode); } - else if (lambda > 0) + else { - out.push(new Point(x, (-coefficientB + Math.sqrt(lambda)) / (2 * coefficientA))); - out.push(new Point(x, (-coefficientB - Math.sqrt(lambda)) / (2 * coefficientA))); + this.volumeNode.connect(this.pannerNode); } + + this.pannerNode.connect(manager.destination); + } + else if (manager.context.createPanner) + { + this.spatialNode.connect(manager.destination); } else { - var v1 = (x0 - x1) / (y0 - y1); - var n = (r1 * r1 - r0 * r0 - x1 * x1 + x0 * x0 - y1 * y1 + y0 * y0) / (2 * (y0 - y1)); - - coefficientA = (v1 * v1) + 1; - coefficientB = (2 * y0 * v1) - (2 * n * v1) - (2 * x0); - coefficientC = (x0 * x0) + (y0 * y0) + (n * n) - (r0 * r0) - (2 * y0 * n); - - lambda = (coefficientB * coefficientB) - (4 * coefficientA * coefficientC); - - if (lambda === 0) - { - x = (-coefficientB / (2 * coefficientA)); - out.push(new Point(x, (n - (x * v1)))); - } - else if (lambda > 0) - { - x = (-coefficientB + Math.sqrt(lambda)) / (2 * coefficientA); - out.push(new Point(x, (n - (x * v1)))); - x = (-coefficientB - Math.sqrt(lambda)) / (2 * coefficientA); - out.push(new Point(x, (n - (x * v1)))); - } + this.volumeNode.connect(manager.destination); } - } - - return out; -}; - -module.exports = GetCircleToCircle; - - -/***/ }), -/* 1212 */ -/***/ (function(module, exports, __webpack_require__) { -/** - * @author Florian Vazelle - * @author Geoffrey Glaive - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.duration = this.audioBuffer.duration; -var GetLineToCircle = __webpack_require__(232); -var CircleToRectangle = __webpack_require__(151); + this.totalDuration = this.audioBuffer.duration; -/** - * Checks for intersection between a circle and a rectangle, - * and returns the intersection points as a Point object array. - * - * @function Phaser.Geom.Intersects.GetCircleToRectangle - * @since 3.0.0 - * - * @param {Phaser.Geom.Circle} circle - The circle to be checked. - * @param {Phaser.Geom.Rectangle} rect - The rectangle to be checked. - * @param {array} [out] - An optional array in which to store the points of intersection. - * - * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. - */ -var GetCircleToRectangle = function (circle, rect, out) -{ - if (out === undefined) { out = []; } + BaseSound.call(this, manager, key, config); + }, - if (CircleToRectangle(circle, rect)) + /** + * Play this sound, or a marked section of it. + * + * It always plays the sound from the start. If you want to start playback from a specific time + * you can set 'seek' setting of the config object, provided to this call, to that value. + * + * If you want to play the same sound simultaneously, then you need to create another instance + * of it and play that Sound. + * + * @method Phaser.Sound.WebAudioSound#play + * @fires Phaser.Sound.Events#PLAY + * @since 3.0.0 + * + * @param {(string|Phaser.Types.Sound.SoundConfig)} [markerName=''] - If you want to play a marker then provide the marker name here. Alternatively, this parameter can be a SoundConfig object. + * @param {Phaser.Types.Sound.SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound. + * + * @return {boolean} Whether the sound started playing successfully. + */ + play: function (markerName, config) { - var lineA = rect.getLineA(); - var lineB = rect.getLineB(); - var lineC = rect.getLineC(); - var lineD = rect.getLineD(); - - GetLineToCircle(lineA, circle, out); - GetLineToCircle(lineB, circle, out); - GetLineToCircle(lineC, circle, out); - GetLineToCircle(lineD, circle, out); - } - - return out; -}; - -module.exports = GetCircleToRectangle; - - -/***/ }), -/* 1213 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Vector4 = __webpack_require__(140); -var GetLineToPolygon = __webpack_require__(487); -var Line = __webpack_require__(47); - -// Temp calculation segment -var segment = new Line(); + if (!BaseSound.prototype.play.call(this, markerName, config)) + { + return false; + } -/** - * @ignore - */ -function CheckIntersects (angle, x, y, polygons, intersects) -{ - var dx = Math.cos(angle); - var dy = Math.sin(angle); + // \/\/\/ isPlaying = true, isPaused = false \/\/\/ + this.stopAndRemoveBufferSource(); + this.createAndStartBufferSource(); - segment.setTo(x, y, x + dx, y + dy); + this.emit(Events.PLAY, this); - var closestIntersect = GetLineToPolygon(segment, polygons); + return true; + }, - if (closestIntersect) + /** + * Pauses the sound. + * + * @method Phaser.Sound.WebAudioSound#pause + * @fires Phaser.Sound.Events#PAUSE + * @since 3.0.0 + * + * @return {boolean} Whether the sound was paused successfully. + */ + pause: function () { - intersects.push(new Vector4(closestIntersect.x, closestIntersect.y, angle, closestIntersect.w)); - } -} + if (this.manager.context.currentTime < this.startTime) + { + return false; + } -/** - * @ignore - */ -function SortIntersects (a, b) -{ - return a.z - b.z; -} + if (!BaseSound.prototype.pause.call(this)) + { + return false; + } -/** - * Projects rays out from the given point to each line segment of the polygons. - * - * If the rays intersect with the polygons, the points of intersection are returned in an array. - * - * If no intersections are found, the returned array will be empty. - * - * Each Vector4 intersection result has the following properties: - * - * The `x` and `y` components contain the point of the intersection. - * The `z` component contains the angle of intersection. - * The `w` component contains the index of the polygon, in the given array, that triggered the intersection. - * - * @function Phaser.Geom.Intersects.GetRaysFromPointToPolygon - * @since 3.50.0 - * - * @param {number} x - The x coordinate to project the rays from. - * @param {number} y - The y coordinate to project the rays from. - * @param {Phaser.Geom.Polygon | Phaser.Geom.Polygon[]} polygons - A single polygon, or array of polygons, to check against the rays. - * - * @return {Phaser.Math.Vector4[]} An array containing all intersections in Vector4s. - */ -var GetRaysFromPointToPolygon = function (x, y, polygons) -{ - if (!Array.isArray(polygons)) - { - polygons = [ polygons ]; - } + // \/\/\/ isPlaying = false, isPaused = true \/\/\/ + this.currentConfig.seek = this.getCurrentTime(); // Equivalent to setting paused time + this.stopAndRemoveBufferSource(); - var intersects = []; - var angles = []; + this.emit(Events.PAUSE, this); - for (var i = 0; i < polygons.length; i++) - { - var points = polygons[i].points; + return true; + }, - for (var p = 0; p < points.length; p++) + /** + * Resumes the sound. + * + * @method Phaser.Sound.WebAudioSound#resume + * @fires Phaser.Sound.Events#RESUME + * @since 3.0.0 + * + * @return {boolean} Whether the sound was resumed successfully. + */ + resume: function () + { + if (this.manager.context.currentTime < this.startTime) { - var angle = Math.atan2(points[p].y - y, points[p].x - x); - - if (angles.indexOf(angle) === -1) - { - // +- 0.00001 rads to catch lines behind segment corners - - CheckIntersects(angle, x, y, polygons, intersects); - CheckIntersects(angle - 0.00001, x, y, polygons, intersects); - CheckIntersects(angle + 0.00001, x, y, polygons, intersects); + return false; + } - angles.push(angle); - } + if (!BaseSound.prototype.resume.call(this)) + { + return false; } - } - return intersects.sort(SortIntersects); -}; + // \/\/\/ isPlaying = true, isPaused = false \/\/\/ + this.createAndStartBufferSource(); -module.exports = GetRaysFromPointToPolygon; + this.emit(Events.RESUME, this); + return true; + }, -/***/ }), -/* 1214 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Stop playing this sound. + * + * @method Phaser.Sound.WebAudioSound#stop + * @fires Phaser.Sound.Events#STOP + * @since 3.0.0 + * + * @return {boolean} Whether the sound was stopped successfully. + */ + stop: function () + { + if (!BaseSound.prototype.stop.call(this)) + { + return false; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // \/\/\/ isPlaying = false, isPaused = false \/\/\/ + this.stopAndRemoveBufferSource(); -var Rectangle = __webpack_require__(10); -var RectangleToRectangle = __webpack_require__(152); + this.emit(Events.STOP, this); -/** - * Checks if two Rectangle shapes intersect and returns the area of this intersection as Rectangle object. - * - * If optional `output` parameter is omitted, new Rectangle object is created and returned. If there is intersection, it will contain intersection area. If there is no intersection, it wil be empty Rectangle (all values set to zero). - * - * If Rectangle object is passed as `output` and there is intersection, then intersection area data will be loaded into it and it will be returned. If there is no intersection, it will be returned without any change. - * - * @function Phaser.Geom.Intersects.GetRectangleIntersection - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [output,$return] - * - * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle object. - * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle object. - * @param {Phaser.Geom.Rectangle} [output] - Optional Rectangle object. If given, the intersection data will be loaded into it (in case of no intersection, it will be left unchanged). Otherwise, new Rectangle object will be created and returned with either intersection data or empty (all values set to zero), if there is no intersection. - * - * @return {Phaser.Geom.Rectangle} A rectangle object with intersection data. - */ -var GetRectangleIntersection = function (rectA, rectB, output) -{ - if (output === undefined) { output = new Rectangle(); } + return true; + }, - if (RectangleToRectangle(rectA, rectB)) + /** + * Used internally. + * + * @method Phaser.Sound.WebAudioSound#createAndStartBufferSource + * @private + * @since 3.0.0 + */ + createAndStartBufferSource: function () { - output.x = Math.max(rectA.x, rectB.x); - output.y = Math.max(rectA.y, rectB.y); - output.width = Math.min(rectA.right, rectB.right) - output.x; - output.height = Math.min(rectA.bottom, rectB.bottom) - output.y; - } - - return output; -}; + var seek = this.currentConfig.seek; + var delay = this.currentConfig.delay; + var when = this.manager.context.currentTime + delay; + var offset = (this.currentMarker ? this.currentMarker.start : 0) + seek; + var duration = this.duration - seek; -module.exports = GetRectangleIntersection; + this.playTime = when - seek; + this.startTime = when; + this.source = this.createBufferSource(); + this.applyConfig(); -/***/ }), -/* 1215 */ -/***/ (function(module, exports, __webpack_require__) { + this.source.start(Math.max(0, when), Math.max(0, offset), Math.max(0, duration)); -/** - * @author Florian Vazelle - * @author Geoffrey Glaive - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.resetConfig(); + }, -var GetLineToRectangle = __webpack_require__(234); -var RectangleToRectangle = __webpack_require__(152); + /** + * This method is only used internally and it creates a looping buffer source. + * + * @method Phaser.Sound.WebAudioSound#createAndStartLoopBufferSource + * @since 3.0.0 + */ + createAndStartLoopBufferSource: function () + { + var when = this.getLoopTime(); + var offset = this.currentMarker ? this.currentMarker.start : 0; + var duration = this.duration; -/** - * Checks if two Rectangles intersect and returns the intersection points as a Point object array. - * - * A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. As such, the two Rectangles are considered "solid". A Rectangle with no width or no height will never intersect another Rectangle. - * - * @function Phaser.Geom.Intersects.GetRectangleToRectangle - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check for intersection. - * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check for intersection. - * @param {array} [out] - An optional array in which to store the points of intersection. - * - * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. - */ -var GetRectangleToRectangle = function (rectA, rectB, out) -{ - if (out === undefined) { out = []; } + this.loopTime = when; + this.loopSource = this.createBufferSource(); + this.loopSource.playbackRate.setValueAtTime(this.totalRate, 0); + this.loopSource.start(Math.max(0, when), Math.max(0, offset), Math.max(0, duration)); + }, - if (RectangleToRectangle(rectA, rectB)) + /** + * This method is only used internally and it creates a buffer source. + * + * @method Phaser.Sound.WebAudioSound#createBufferSource + * @since 3.0.0 + * + * @return {AudioBufferSourceNode} + */ + createBufferSource: function () { - var lineA = rectA.getLineA(); - var lineB = rectA.getLineB(); - var lineC = rectA.getLineC(); - var lineD = rectA.getLineD(); + var _this = this; + var source = this.manager.context.createBufferSource(); - GetLineToRectangle(lineA, rectB, out); - GetLineToRectangle(lineB, rectB, out); - GetLineToRectangle(lineC, rectB, out); - GetLineToRectangle(lineD, rectB, out); - } + source.buffer = this.audioBuffer; - return out; -}; + source.connect(this.muteNode); -module.exports = GetRectangleToRectangle; + source.onended = function (ev) + { + if (ev.target === _this.source) + { + // sound ended + if (_this.currentConfig.loop) + { + _this.hasLooped = true; + } + else + { + _this.hasEnded = true; + } + } + // else was stopped + }; -/***/ }), -/* 1216 */ -/***/ (function(module, exports, __webpack_require__) { + return source; + }, -/** - * @author Florian Vazelle - * @author Geoffrey Glaive - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * This method is only used internally and it stops and removes a buffer source. + * + * @method Phaser.Sound.WebAudioSound#stopAndRemoveBufferSource + * @since 3.0.0 + */ + stopAndRemoveBufferSource: function () + { + if (this.source) + { + this.source.stop(); + this.source.disconnect(); + this.source = null; + } -var RectangleToTriangle = __webpack_require__(489); -var GetLineToRectangle = __webpack_require__(234); + this.playTime = 0; + this.startTime = 0; -/** - * Checks for intersection between Rectangle shape and Triangle shape, - * and returns the intersection points as a Point object array. - * - * @function Phaser.Geom.Intersects.GetRectangleToTriangle - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rect - Rectangle object to test. - * @param {Phaser.Geom.Triangle} triangle - Triangle object to test. - * @param {array} [out] - An optional array in which to store the points of intersection. - * - * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. - */ -var GetRectangleToTriangle = function (rect, triangle, out) -{ - if (out === undefined) { out = []; } + this.stopAndRemoveLoopBufferSource(); + }, - if (RectangleToTriangle(rect, triangle)) + /** + * This method is only used internally and it stops and removes a looping buffer source. + * + * @method Phaser.Sound.WebAudioSound#stopAndRemoveLoopBufferSource + * @since 3.0.0 + */ + stopAndRemoveLoopBufferSource: function () { - var lineA = triangle.getLineA(); - var lineB = triangle.getLineB(); - var lineC = triangle.getLineC(); - - GetLineToRectangle(lineA, rect, out); - GetLineToRectangle(lineB, rect, out); - GetLineToRectangle(lineC, rect, out); - } - - return out; -}; + if (this.loopSource) + { + this.loopSource.stop(); + this.loopSource.disconnect(); + this.loopSource = null; + } -module.exports = GetRectangleToTriangle; + this.loopTime = 0; + }, + /** + * Method used internally for applying config values to some of the sound properties. + * + * @method Phaser.Sound.WebAudioSound#applyConfig + * @since 3.0.0 + */ + applyConfig: function () + { + this.rateUpdates.length = 0; -/***/ }), -/* 1217 */ -/***/ (function(module, exports, __webpack_require__) { + this.rateUpdates.push({ + time: 0, + rate: 1 + }); -/** - * @author Florian Vazelle - * @author Geoffrey Glaive - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var source = this.currentConfig.source; -var GetLineToCircle = __webpack_require__(232); -var TriangleToCircle = __webpack_require__(491); + if (source && this.manager.context.createPanner) + { + var node = this.spatialNode; -/** - * Checks if a Triangle and a Circle intersect, and returns the intersection points as a Point object array. - * - * A Circle intersects a Triangle if its center is located within it or if any of the Triangle's sides intersect the Circle. As such, the Triangle and the Circle are considered "solid" for the intersection. - * - * @function Phaser.Geom.Intersects.GetTriangleToCircle - * @since 3.0.0 - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to check for intersection. - * @param {Phaser.Geom.Circle} circle - The Circle to check for intersection. - * @param {array} [out] - An optional array in which to store the points of intersection. - * - * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. - */ -var GetTriangleToCircle = function (triangle, circle, out) -{ - if (out === undefined) { out = []; } + node.panningModel = GetFastValue(source, 'panningModel', 'equalpower'); + node.distanceModel = GetFastValue(source, 'distanceModel', 'inverse'); + node.orientationX.value = GetFastValue(source, 'orientationX', 0); + node.orientationY.value = GetFastValue(source, 'orientationY', 0); + node.orientationZ.value = GetFastValue(source, 'orientationZ', -1); + node.refDistance = GetFastValue(source, 'refDistance', 1); + node.maxDistance = GetFastValue(source, 'maxDistance', 10000); + node.rolloffFactor = GetFastValue(source, 'rolloffFactor', 1); + node.coneInnerAngle = GetFastValue(source, 'coneInnerAngle', 360); + node.coneOuterAngle = GetFastValue(source, 'coneOuterAngle', 0); + node.coneOuterGain = GetFastValue(source, 'coneOuterGain', 0); - if (TriangleToCircle(triangle, circle)) - { - var lineA = triangle.getLineA(); - var lineB = triangle.getLineB(); - var lineC = triangle.getLineC(); + this.spatialSource = GetFastValue(source, 'follow', null); - GetLineToCircle(lineA, circle, out); - GetLineToCircle(lineB, circle, out); - GetLineToCircle(lineC, circle, out); - } + if (!this.spatialSource) + { + node.positionX.value = GetFastValue(source, 'x', 0); + node.positionY.value = GetFastValue(source, 'y', 0); + node.positionZ.value = GetFastValue(source, 'z', 0); + } + } - return out; -}; + BaseSound.prototype.applyConfig.call(this); + }, -module.exports = GetTriangleToCircle; + /** + * Sets the x position of this Sound in Spatial Audio space. + * + * This only has any effect if the sound was created with a SpatialSoundConfig object. + * + * Also see the `WebAudioSoundManager.setListenerPosition` method. + * + * If you find that the sound becomes too quiet, too quickly, as it moves away from + * the listener, then try different `refDistance` property values when configuring + * the spatial sound. + * + * @name Phaser.Sound.WebAudioSound#x + * @type {number} + * @since 3.60.0 + */ + x: { + get: function () + { + if (this.spatialNode) + { + return this.spatialNode.positionX; + } + else + { + return 0; + } + }, -/***/ }), -/* 1218 */ -/***/ (function(module, exports, __webpack_require__) { + set: function (value) + { + if (this.spatialNode) + { + this.spatialNode.positionX.value = value; + } + } + }, -/** - * @author Florian Vazelle - * @author Geoffrey Glaive - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Sets the y position of this Sound in Spatial Audio space. + * + * This only has any effect if the sound was created with a SpatialSoundConfig object. + * + * Also see the `WebAudioSoundManager.setListenerPosition` method. + * + * If you find that the sound becomes too quiet, too quickly, as it moves away from + * the listener, then try different `refDistance` property values when configuring + * the spatial sound. + * + * @name Phaser.Sound.WebAudioSound#y + * @type {number} + * @since 3.60.0 + */ + y: { -var TriangleToTriangle = __webpack_require__(494); -var GetTriangleToLine = __webpack_require__(492); + get: function () + { + if (this.spatialNode) + { + return this.spatialNode.positionY; + } + else + { + return 0; + } + }, -/** - * Checks if two Triangles intersect, and returns the intersection points as a Point object array. - * - * A Triangle intersects another Triangle if any pair of their lines intersects or if any point of one Triangle is within the other Triangle. Thus, the Triangles are considered "solid". - * - * @function Phaser.Geom.Intersects.GetTriangleToTriangle - * @since 3.0.0 - * - * @param {Phaser.Geom.Triangle} triangleA - The first Triangle to check for intersection. - * @param {Phaser.Geom.Triangle} triangleB - The second Triangle to check for intersection. - * @param {array} [out] - An optional array in which to store the points of intersection. - * - * @return {array} An array with the points of intersection if objects intersect, otherwise an empty array. - */ -var GetTriangleToTriangle = function (triangleA, triangleB, out) -{ - if (out === undefined) { out = []; } + set: function (value) + { + if (this.spatialNode) + { + this.spatialNode.positionY.value = value; + } + } + }, - if (TriangleToTriangle(triangleA, triangleB)) + /** + * Update method called automatically by sound manager on every game step. + * + * @method Phaser.Sound.WebAudioSound#update + * @fires Phaser.Sound.Events#COMPLETE + * @fires Phaser.Sound.Events#LOOPED + * @since 3.0.0 + */ + update: function () { - var lineA = triangleB.getLineA(); - var lineB = triangleB.getLineB(); - var lineC = triangleB.getLineC(); - - GetTriangleToLine(triangleA, lineA, out); - GetTriangleToLine(triangleA, lineB, out); - GetTriangleToLine(triangleA, lineC, out); - } - - return out; -}; + if (this.isPlaying && this.spatialSource) + { + var x = GetFastValue(this.spatialSource, 'x', null); + var y = GetFastValue(this.spatialSource, 'y', null); -module.exports = GetTriangleToTriangle; + if (x && x !== this._spatialx) + { + this._spatialx = this.spatialNode.positionX.value = x; + } + if (y && y !== this._spatialy) + { + this._spatialy = this.spatialNode.positionY.value = y; + } + } + if (this.hasEnded) + { + this.hasEnded = false; -/***/ }), -/* 1219 */ -/***/ (function(module, exports, __webpack_require__) { + BaseSound.prototype.stop.call(this); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.stopAndRemoveBufferSource(); -var PointToLine = __webpack_require__(496); + this.emit(Events.COMPLETE, this); + } + else if (this.hasLooped) + { + this.hasLooped = false; + this.source = this.loopSource; + this.loopSource = null; + this.playTime = this.startTime = this.loopTime; + this.rateUpdates.length = 0; -/** - * Checks if a Point is located on the given line segment. - * - * @function Phaser.Geom.Intersects.PointToLineSegment - * @since 3.0.0 - * - * @param {Phaser.Geom.Point} point - The Point to check for intersection. - * @param {Phaser.Geom.Line} line - The line segment to check for intersection. - * - * @return {boolean} `true` if the Point is on the given line segment, otherwise `false`. - */ -var PointToLineSegment = function (point, line) -{ - if (!PointToLine(point, line)) - { - return false; - } + this.rateUpdates.push({ + time: 0, + rate: this.totalRate + }); - var xMin = Math.min(line.x1, line.x2); - var xMax = Math.max(line.x1, line.x2); - var yMin = Math.min(line.y1, line.y2); - var yMax = Math.max(line.y1, line.y2); + this.createAndStartLoopBufferSource(); - return ((point.x >= xMin && point.x <= xMax) && (point.y >= yMin && point.y <= yMax)); -}; + this.emit(Events.LOOPED, this); + } + }, -module.exports = PointToLineSegment; + /** + * Calls Phaser.Sound.BaseSound#destroy method + * and cleans up all Web Audio API related stuff. + * + * @method Phaser.Sound.WebAudioSound#destroy + * @since 3.0.0 + */ + destroy: function () + { + if (this.pendingRemove) + { + return; + } + BaseSound.prototype.destroy.call(this); -/***/ }), -/* 1220 */ -/***/ (function(module, exports) { + this.audioBuffer = null; + this.stopAndRemoveBufferSource(); + this.muteNode.disconnect(); + this.muteNode = null; + this.volumeNode.disconnect(); + this.volumeNode = null; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.pannerNode) + { + this.pannerNode.disconnect(); + this.pannerNode = null; + } -/** - * Check if rectangle intersects with values. - * - * @function Phaser.Geom.Intersects.RectangleToValues - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rect - The rectangle object - * @param {number} left - The x coordinate of the left of the Rectangle. - * @param {number} right - The x coordinate of the right of the Rectangle. - * @param {number} top - The y coordinate of the top of the Rectangle. - * @param {number} bottom - The y coordinate of the bottom of the Rectangle. - * @param {number} [tolerance=0] - Tolerance allowed in the calculation, expressed in pixels. - * - * @return {boolean} Returns true if there is an intersection. - */ -var RectangleToValues = function (rect, left, right, top, bottom, tolerance) -{ - if (tolerance === undefined) { tolerance = 0; } + if (this.spatialNode) + { + this.spatialNode.disconnect(); + this.spatialNode = null; + this.spatialSource = null; + } - return !( - left > rect.right + tolerance || - right < rect.left - tolerance || - top > rect.bottom + tolerance || - bottom < rect.top - tolerance - ); -}; + this.rateUpdates.length = 0; + this.rateUpdates = null; + }, -module.exports = RectangleToValues; + /** + * Method used internally to calculate total playback rate of the sound. + * + * @method Phaser.Sound.WebAudioSound#calculateRate + * @since 3.0.0 + */ + calculateRate: function () + { + BaseSound.prototype.calculateRate.call(this); + var now = this.manager.context.currentTime; -/***/ }), -/* 1221 */ -/***/ (function(module, exports, __webpack_require__) { + if (this.source && typeof this.totalRate === 'number') + { + this.source.playbackRate.setValueAtTime(this.totalRate, now); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.isPlaying) + { + this.rateUpdates.push({ + time: Math.max(this.startTime, now) - this.playTime, + rate: this.totalRate + }); -var Line = __webpack_require__(47); + if (this.loopSource) + { + this.stopAndRemoveLoopBufferSource(); + this.createAndStartLoopBufferSource(); + } + } + }, -Line.Angle = __webpack_require__(97); -Line.BresenhamPoints = __webpack_require__(317); -Line.CenterOn = __webpack_require__(1222); -Line.Clone = __webpack_require__(1223); -Line.CopyFrom = __webpack_require__(1224); -Line.Equals = __webpack_require__(1225); -Line.Extend = __webpack_require__(1226); -Line.GetEasedPoints = __webpack_require__(1227); -Line.GetMidPoint = __webpack_require__(1228); -Line.GetNearestPoint = __webpack_require__(1229); -Line.GetNormal = __webpack_require__(1230); -Line.GetPoint = __webpack_require__(307); -Line.GetPoints = __webpack_require__(172); -Line.GetShortestDistance = __webpack_require__(1231); -Line.Height = __webpack_require__(1232); -Line.Length = __webpack_require__(67); -Line.NormalAngle = __webpack_require__(497); -Line.NormalX = __webpack_require__(1233); -Line.NormalY = __webpack_require__(1234); -Line.Offset = __webpack_require__(1235); -Line.PerpSlope = __webpack_require__(1236); -Line.Random = __webpack_require__(173); -Line.ReflectAngle = __webpack_require__(1237); -Line.Rotate = __webpack_require__(1238); -Line.RotateAroundPoint = __webpack_require__(1239); -Line.RotateAroundXY = __webpack_require__(236); -Line.SetToAngle = __webpack_require__(1240); -Line.Slope = __webpack_require__(1241); -Line.Width = __webpack_require__(1242); + /** + * Method used internally for calculating current playback time of a playing sound. + * + * @method Phaser.Sound.WebAudioSound#getCurrentTime + * @since 3.0.0 + */ + getCurrentTime: function () + { + var currentTime = 0; -module.exports = Line; + for (var i = 0; i < this.rateUpdates.length; i++) + { + var nextTime = 0; + if (i < this.rateUpdates.length - 1) + { + nextTime = this.rateUpdates[i + 1].time; + } + else + { + nextTime = this.manager.context.currentTime - this.playTime; + } -/***/ }), -/* 1222 */ -/***/ (function(module, exports) { + currentTime += (nextTime - this.rateUpdates[i].time) * this.rateUpdates[i].rate; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return currentTime; + }, + /** + * Method used internally for calculating the time + * at witch the loop source should start playing. + * + * @method Phaser.Sound.WebAudioSound#getLoopTime + * @since 3.0.0 + */ + getLoopTime: function () + { + var lastRateUpdateCurrentTime = 0; -/** - * Center a line on the given coordinates. - * - * @function Phaser.Geom.Line.CenterOn - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The line to center. - * @param {number} x - The horizontal coordinate to center the line on. - * @param {number} y - The vertical coordinate to center the line on. - * - * @return {Phaser.Geom.Line} The centered line. - */ -var CenterOn = function (line, x, y) -{ - var tx = x - ((line.x1 + line.x2) / 2); - var ty = y - ((line.y1 + line.y2) / 2); + for (var i = 0; i < this.rateUpdates.length - 1; i++) + { + lastRateUpdateCurrentTime += (this.rateUpdates[i + 1].time - this.rateUpdates[i].time) * this.rateUpdates[i].rate; + } - line.x1 += tx; - line.y1 += ty; + var lastRateUpdate = this.rateUpdates[this.rateUpdates.length - 1]; - line.x2 += tx; - line.y2 += ty; + return this.playTime + lastRateUpdate.time + (this.duration - lastRateUpdateCurrentTime) / lastRateUpdate.rate; + }, - return line; -}; + /** + * Rate at which this Sound will be played. + * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed + * and 2.0 doubles the audios playback speed. + * + * @name Phaser.Sound.WebAudioSound#rate + * @type {number} + * @default 1 + * @fires Phaser.Sound.Events#RATE + * @since 3.0.0 + */ + rate: { -module.exports = CenterOn; + get: function () + { + return this.currentConfig.rate; + }, + set: function (value) + { + this.currentConfig.rate = value; -/***/ }), -/* 1223 */ -/***/ (function(module, exports, __webpack_require__) { + this.calculateRate(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.emit(Events.RATE, this, value); + } -var Line = __webpack_require__(47); + }, -/** - * Clone the given line. - * - * @function Phaser.Geom.Line.Clone - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} source - The source line to clone. - * - * @return {Phaser.Geom.Line} The cloned line. - */ -var Clone = function (source) -{ - return new Line(source.x1, source.y1, source.x2, source.y2); -}; + /** + * Sets the playback rate of this Sound. + * + * For example, a value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed + * and 2.0 doubles the audios playback speed. + * + * @method Phaser.Sound.WebAudioSound#setRate + * @fires Phaser.Sound.Events#RATE + * @since 3.3.0 + * + * @param {number} value - The playback rate at of this Sound. + * + * @return {this} This Sound instance. + */ + setRate: function (value) + { + this.rate = value; -module.exports = Clone; + return this; + }, + /** + * The detune value of this Sound, given in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). + * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @name Phaser.Sound.WebAudioSound#detune + * @type {number} + * @default 0 + * @fires Phaser.Sound.Events#DETUNE + * @since 3.0.0 + */ + detune: { -/***/ }), -/* 1224 */ -/***/ (function(module, exports) { + get: function () + { + return this.currentConfig.detune; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + set: function (value) + { + this.currentConfig.detune = value; -/** - * Copy the values of one line to a destination line. - * - * @function Phaser.Geom.Line.CopyFrom - * @since 3.0.0 - * - * @generic {Phaser.Geom.Line} O - [dest,$return] - * - * @param {Phaser.Geom.Line} source - The source line to copy the values from. - * @param {Phaser.Geom.Line} dest - The destination line to copy the values to. - * - * @return {Phaser.Geom.Line} The destination line. - */ -var CopyFrom = function (source, dest) -{ - return dest.setTo(source.x1, source.y1, source.x2, source.y2); -}; + this.calculateRate(); -module.exports = CopyFrom; + this.emit(Events.DETUNE, this, value); + } + }, -/***/ }), -/* 1225 */ -/***/ (function(module, exports) { + /** + * Sets the detune value of this Sound, given in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29). + * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @method Phaser.Sound.WebAudioSound#setDetune + * @fires Phaser.Sound.Events#DETUNE + * @since 3.3.0 + * + * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent). + * + * @return {this} This Sound instance. + */ + setDetune: function (value) + { + this.detune = value; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -/** - * Compare two lines for strict equality. - * - * @function Phaser.Geom.Line.Equals - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The first line to compare. - * @param {Phaser.Geom.Line} toCompare - The second line to compare. - * - * @return {boolean} Whether the two lines are equal. - */ -var Equals = function (line, toCompare) -{ - return ( - line.x1 === toCompare.x1 && - line.y1 === toCompare.y1 && - line.x2 === toCompare.x2 && - line.y2 === toCompare.y2 - ); -}; + /** + * Boolean indicating whether the sound is muted or not. + * Gets or sets the muted state of this sound. + * + * @name Phaser.Sound.WebAudioSound#mute + * @type {boolean} + * @default false + * @fires Phaser.Sound.Events#MUTE + * @since 3.0.0 + */ + mute: { -module.exports = Equals; + get: function () + { + return (this.muteNode.gain.value === 0); + }, + set: function (value) + { + this.currentConfig.mute = value; + this.muteNode.gain.setValueAtTime(value ? 0 : 1, 0); -/***/ }), -/* 1226 */ -/***/ (function(module, exports, __webpack_require__) { + this.emit(Events.MUTE, this, value); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + }, -var Length = __webpack_require__(67); + /** + * Sets the muted state of this Sound. + * + * @method Phaser.Sound.WebAudioSound#setMute + * @fires Phaser.Sound.Events#MUTE + * @since 3.4.0 + * + * @param {boolean} value - `true` to mute this sound, `false` to unmute it. + * + * @return {this} This Sound instance. + */ + setMute: function (value) + { + this.mute = value; -/** - * Extends the start and end points of a Line by the given amounts. - * - * The amounts can be positive or negative. Positive points will increase the length of the line, - * while negative ones will decrease it. - * - * If no `right` value is provided it will extend the length of the line equally in both directions. - * - * Pass a value of zero to leave the start or end point unchanged. - * - * @function Phaser.Geom.Line.Extend - * @since 3.16.0 - * - * @param {Phaser.Geom.Line} line - The line instance to extend. - * @param {number} left - The amount to extend the start of the line by. - * @param {number} [right] - The amount to extend the end of the line by. If not given it will be set to the `left` value. - * - * @return {Phaser.Geom.Line} The modified Line instance. - */ -var Extend = function (line, left, right) -{ - if (right === undefined) { right = left; } + return this; + }, - var length = Length(line); + /** + * Gets or sets the volume of this sound, a value between 0 (silence) and 1 (full volume). + * + * @name Phaser.Sound.WebAudioSound#volume + * @type {number} + * @default 1 + * @fires Phaser.Sound.Events#VOLUME + * @since 3.0.0 + */ + volume: { - var slopX = line.x2 - line.x1; - var slopY = line.y2 - line.y1; + get: function () + { + return this.volumeNode.gain.value; + }, - if (left) - { - line.x1 = line.x1 - slopX / length * left; - line.y1 = line.y1 - slopY / length * left; - } + set: function (value) + { + this.currentConfig.volume = value; + this.volumeNode.gain.setValueAtTime(value, 0); - if (right) + this.emit(Events.VOLUME, this, value); + } + }, + + /** + * Sets the volume of this Sound. + * + * @method Phaser.Sound.WebAudioSound#setVolume + * @fires Phaser.Sound.Events#VOLUME + * @since 3.4.0 + * + * @param {number} value - The volume of the sound. + * + * @return {this} This Sound instance. + */ + setVolume: function (value) { - line.x2 = line.x2 + slopX / length * right; - line.y2 = line.y2 + slopY / length * right; - } + this.volume = value; - return line; -}; + return this; + }, -module.exports = Extend; + /** + * Property representing the position of playback for this sound, in seconds. + * Setting it to a specific value moves current playback to that position. + * The value given is clamped to the range 0 to current marker duration. + * Setting seek of a stopped sound has no effect. + * + * @name Phaser.Sound.WebAudioSound#seek + * @type {number} + * @fires Phaser.Sound.Events#SEEK + * @since 3.0.0 + */ + seek: { + get: function () + { + if (this.isPlaying) + { + if (this.manager.context.currentTime < this.startTime) + { + return this.startTime - this.playTime; + } -/***/ }), -/* 1227 */ -/***/ (function(module, exports, __webpack_require__) { + return this.getCurrentTime(); + } + else if (this.isPaused) + { + return this.currentConfig.seek; + } + else + { + return 0; + } + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + set: function (value) + { + if (this.manager.context.currentTime < this.startTime) + { + return; + } -var DistanceBetweenPoints = __webpack_require__(352); -var GetEaseFunction = __webpack_require__(80); -var Point = __webpack_require__(4); + if (this.isPlaying || this.isPaused) + { + value = Math.min(Math.max(0, value), this.duration); -/** - * Returns an array of `quantity` Points where each point is taken from the given Line, - * spaced out according to the ease function specified. - * - * ```javascript - * const line = new Phaser.Geom.Line(100, 300, 700, 300); - * const points = Phaser.Geom.Line.GetEasedPoints(line, 'sine.out', 32) - * ``` - * - * In the above example, the `points` array will contain 32 points spread-out across - * the length of `line`, where the position of each point is determined by the `Sine.out` - * ease function. - * - * You can optionally provide a collinear threshold. In this case, the resulting points - * are checked against each other, and if they are `< collinearThreshold` distance apart, - * they are dropped from the results. This can help avoid lots of clustered points at - * far ends of the line with tightly-packed eases such as Quartic. Leave the value set - * to zero to skip this check. - * - * Note that if you provide a collinear threshold, the resulting array may not always - * contain `quantity` points. - * - * @function Phaser.Geom.Line.GetEasedPoints - * @since 3.23.0 - * - * @generic {Phaser.Geom.Point[]} O - [out,$return] - * - * @param {Phaser.Geom.Line} line - The Line object. - * @param {(string|function)} ease - The ease to use. This can be either a string from the EaseMap, or a custom function. - * @param {number} quantity - The number of points to return. Note that if you provide a `collinearThreshold`, the resulting array may not always contain this number of points. - * @param {number} [collinearThreshold=0] - An optional threshold. The final array is reduced so that each point is spaced out at least this distance apart. This helps reduce clustering in noisey eases. - * @param {number[]} [easeParams] - An optional array of ease parameters to go with the ease. - * - * @return {Phaser.Geom.Point[]} An array of Geom.Points containing the coordinates of the points on the line. - */ -var GetEasedPoints = function (line, ease, quantity, collinearThreshold, easeParams) -{ - if (collinearThreshold === undefined) { collinearThreshold = 0; } - if (easeParams === undefined) { easeParams = []; } + this.currentConfig.seek = value; - var results = []; + if (this.isPlaying) + { + this.stopAndRemoveBufferSource(); + this.createAndStartBufferSource(); + } - var x1 = line.x1; - var y1 = line.y1; + this.emit(Events.SEEK, this, value); + } + } + }, - var spaceX = line.x2 - x1; - var spaceY = line.y2 - y1; + /** + * Seeks to a specific point in this sound. + * + * @method Phaser.Sound.WebAudioSound#setSeek + * @fires Phaser.Sound.Events#SEEK + * @since 3.4.0 + * + * @param {number} value - The point in the sound to seek to. + * + * @return {this} This Sound instance. + */ + setSeek: function (value) + { + this.seek = value; - var easeFunc = GetEaseFunction(ease, easeParams); + return this; + }, - var i; - var v; - var q = quantity - 1; + /** + * Flag indicating whether or not the sound or current sound marker will loop. + * + * @name Phaser.Sound.WebAudioSound#loop + * @type {boolean} + * @default false + * @fires Phaser.Sound.Events#LOOP + * @since 3.0.0 + */ + loop: { - for (i = 0; i < q; i++) - { - v = easeFunc(i / q); + get: function () + { + return this.currentConfig.loop; + }, - results.push(new Point(x1 + (spaceX * v), y1 + (spaceY * v))); - } + set: function (value) + { + this.currentConfig.loop = value; - // Always include the end of the line - v = easeFunc(1); + if (this.isPlaying) + { + this.stopAndRemoveLoopBufferSource(); - results.push(new Point(x1 + (spaceX * v), y1 + (spaceY * v))); + if (value) + { + this.createAndStartLoopBufferSource(); + } + } - // Remove collinear parts - if (collinearThreshold > 0) + this.emit(Events.LOOP, this, value); + } + }, + + /** + * Sets the loop state of this Sound. + * + * @method Phaser.Sound.WebAudioSound#setLoop + * @fires Phaser.Sound.Events#LOOP + * @since 3.4.0 + * + * @param {boolean} value - `true` to loop this sound, `false` to not loop it. + * + * @return {this} This Sound instance. + */ + setLoop: function (value) { - var prevPoint = results[0]; + this.loop = value; - // Store the new results here - var sortedResults = [ prevPoint ]; + return this; + }, - for (i = 1; i < results.length - 1; i++) - { - var point = results[i]; + /** + * Gets or sets the pan of this sound, a value between -1 (full left pan) and 1 (full right pan). + * + * Always returns zero on iOS / Safari as it doesn't support the stereo panner node. + * + * @name Phaser.Sound.WebAudioSound#pan + * @type {number} + * @default 0 + * @fires Phaser.Sound.Events#PAN + * @since 3.50.0 + */ + pan: { - if (DistanceBetweenPoints(prevPoint, point) >= collinearThreshold) + get: function () + { + if (this.pannerNode) { - sortedResults.push(point); - prevPoint = point; + return this.pannerNode.pan.value; } - } - - // Top and tail - var endPoint = results[results.length - 1]; + else + { + return 0; + } + }, - if (DistanceBetweenPoints(prevPoint, endPoint) < collinearThreshold) + set: function (value) { - sortedResults.pop(); - } + this.currentConfig.pan = value; - sortedResults.push(endPoint); + if (this.pannerNode) + { + this.pannerNode.pan.setValueAtTime(value, this.manager.context.currentTime); + } - return sortedResults; - } - else + this.emit(Events.PAN, this, value); + } + }, + + /** + * Sets the pan of this sound, a value between -1 (full left pan) and 1 (full right pan). + * + * Note: iOS / Safari doesn't support the stereo panner node. + * + * @method Phaser.Sound.WebAudioSound#setPan + * @fires Phaser.Sound.Events#PAN + * @since 3.50.0 + * + * @param {number} value - The pan of the sound. A value between -1 (full left pan) and 1 (full right pan). + * + * @return {this} This Sound instance. + */ + setPan: function (value) { - return results; + this.pan = value; + + return this; } -}; -module.exports = GetEasedPoints; +}); + +module.exports = WebAudioSound; /***/ }), -/* 1228 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 55491: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Pavle Goloskokovic (http://prunegames.com) + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Point = __webpack_require__(4); +var Base64ToArrayBuffer = __webpack_require__(82329); +var BaseSoundManager = __webpack_require__(12486); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(76038); +var GameEvents = __webpack_require__(97081); +var WebAudioSound = __webpack_require__(96008); +var GetFastValue = __webpack_require__(72632); /** - * Get the midpoint of the given line. + * @classdesc + * Web Audio API implementation of the Sound Manager. * - * @function Phaser.Geom.Line.GetMidPoint - * @since 3.0.0 + * Not all browsers can play all audio formats. * - * @generic {Phaser.Geom.Point} O - [out,$return] + * There is a good guide to what's supported: [Cross-browser audio basics: Audio codec support](https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics#Audio_Codec_Support). * - * @param {Phaser.Geom.Line} line - The line to get the midpoint of. - * @param {(Phaser.Geom.Point|object)} [out] - An optional point object to store the midpoint in. + * @class WebAudioSoundManager + * @extends Phaser.Sound.BaseSoundManager + * @memberof Phaser.Sound + * @constructor + * @since 3.0.0 * - * @return {(Phaser.Geom.Point|object)} The midpoint of the Line. + * @param {Phaser.Game} game - Reference to the current game instance. */ -var GetMidPoint = function (line, out) -{ - if (out === undefined) { out = new Point(); } +var WebAudioSoundManager = new Class({ - out.x = (line.x1 + line.x2) / 2; - out.y = (line.y1 + line.y2) / 2; + Extends: BaseSoundManager, - return out; -}; + initialize: -module.exports = GetMidPoint; + function WebAudioSoundManager (game) + { + /** + * The AudioContext being used for playback. + * + * @name Phaser.Sound.WebAudioSoundManager#context + * @type {AudioContext} + * @since 3.0.0 + */ + this.context = this.createAudioContext(game); + /** + * Gain node responsible for controlling global muting. + * + * @name Phaser.Sound.WebAudioSoundManager#masterMuteNode + * @type {GainNode} + * @since 3.0.0 + */ + this.masterMuteNode = this.context.createGain(); -/***/ }), -/* 1229 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Gain node responsible for controlling global volume. + * + * @name Phaser.Sound.WebAudioSoundManager#masterVolumeNode + * @type {GainNode} + * @since 3.0.0 + */ + this.masterVolumeNode = this.context.createGain(); -/** - * @author Richard Davey - * @author Florian Mertens - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.masterMuteNode.connect(this.masterVolumeNode); -var Point = __webpack_require__(4); + this.masterVolumeNode.connect(this.context.destination); -/** - * Get the nearest point on a line perpendicular to the given point. - * - * @function Phaser.Geom.Line.GetNearestPoint - * @since 3.16.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Line} line - The line to get the nearest point on. - * @param {(Phaser.Geom.Point|object)} point - The point to get the nearest point to. - * @param {(Phaser.Geom.Point|object)} [out] - An optional point, or point-like object, to store the coordinates of the nearest point on the line. - * - * @return {(Phaser.Geom.Point|object)} The nearest point on the line. - */ -var GetNearestPoint = function (line, point, out) -{ - if (out === undefined) { out = new Point(); } + /** + * Destination node for connecting individual sounds to. + * + * @name Phaser.Sound.WebAudioSoundManager#destination + * @type {AudioNode} + * @since 3.0.0 + */ + this.destination = this.masterMuteNode; - var x1 = line.x1; - var y1 = line.y1; + this.locked = this.context.state === 'suspended' && ('ontouchstart' in window || 'onclick' in window); - var x2 = line.x2; - var y2 = line.y2; + BaseSoundManager.call(this, game); - var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); + if (this.locked && game.isBooted) + { + this.unlock(); + } + else + { + game.events.once(GameEvents.BOOT, this.unlock, this); + } + }, - if (L2 === 0) + /** + * Method responsible for instantiating and returning AudioContext instance. + * If an instance of an AudioContext class was provided through the game config, + * that instance will be returned instead. This can come in handy if you are reloading + * a Phaser game on a page that never properly refreshes (such as in an SPA project) + * and you want to reuse already instantiated AudioContext. + * + * @method Phaser.Sound.WebAudioSoundManager#createAudioContext + * @since 3.0.0 + * + * @param {Phaser.Game} game - Reference to the current game instance. + * + * @return {AudioContext} The AudioContext instance to be used for playback. + */ + createAudioContext: function (game) { - return out; - } - - var r = (((point.x - x1) * (x2 - x1)) + ((point.y - y1) * (y2 - y1))) / L2; + var audioConfig = game.config.audio; - out.x = x1 + (r * (x2 - x1)); - out.y = y1 + (r * (y2 - y1)); + if (audioConfig.context) + { + audioConfig.context.resume(); - return out; -}; + return audioConfig.context; + } -module.exports = GetNearestPoint; + if (window.hasOwnProperty('AudioContext')) + { + return new AudioContext(); + } + else if (window.hasOwnProperty('webkitAudioContext')) + { + return new window.webkitAudioContext(); + } + }, + /** + * This method takes a new AudioContext reference and then sets + * this Sound Manager to use that context for all playback. + * + * As part of this call it also disconnects the master mute and volume + * nodes and then re-creates them on the new given context. + * + * @method Phaser.Sound.WebAudioSoundManager#setAudioContext + * @since 3.21.0 + * + * @param {AudioContext} context - Reference to an already created AudioContext instance. + * + * @return {this} The WebAudioSoundManager instance. + */ + setAudioContext: function (context) + { + if (this.context) + { + this.context.close(); + } -/***/ }), -/* 1230 */ -/***/ (function(module, exports, __webpack_require__) { + if (this.masterMuteNode) + { + this.masterMuteNode.disconnect(); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.masterVolumeNode) + { + this.masterVolumeNode.disconnect(); + } -var MATH_CONST = __webpack_require__(14); -var Angle = __webpack_require__(97); -var Point = __webpack_require__(4); + this.context = context; -/** - * Calculate the normal of the given line. - * - * The normal of a line is a vector that points perpendicular from it. - * - * @function Phaser.Geom.Line.GetNormal - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Line} line - The line to calculate the normal of. - * @param {(Phaser.Geom.Point|object)} [out] - An optional point object to store the normal in. - * - * @return {(Phaser.Geom.Point|object)} The normal of the Line. - */ -var GetNormal = function (line, out) -{ - if (out === undefined) { out = new Point(); } + this.masterMuteNode = context.createGain(); + this.masterVolumeNode = context.createGain(); - var a = Angle(line) - MATH_CONST.TAU; + this.masterMuteNode.connect(this.masterVolumeNode); + this.masterVolumeNode.connect(context.destination); - out.x = Math.cos(a); - out.y = Math.sin(a); + this.destination = this.masterMuteNode; - return out; -}; + return this; + }, -module.exports = GetNormal; + /** + * Adds a new sound into the sound manager. + * + * @method Phaser.Sound.WebAudioSoundManager#add + * @since 3.0.0 + * + * @param {string} key - Asset key for the sound. + * @param {Phaser.Types.Sound.SoundConfig} [config] - An optional config object containing default sound settings. + * + * @return {Phaser.Sound.WebAudioSound} The new sound instance. + */ + add: function (key, config) + { + var sound = new WebAudioSound(this, key, config); + this.sounds.push(sound); -/***/ }), -/* 1231 */ -/***/ (function(module, exports) { + return sound; + }, -/** - * @author Richard Davey - * @author Florian Mertens - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Decode audio data into a format ready for playback via Web Audio. + * + * The audio data can be a base64 encoded string, an audio media-type data uri, or an ArrayBuffer instance. + * + * The `audioKey` is the key that will be used to save the decoded audio to the audio cache. + * + * Instead of passing a single entry you can instead pass an array of `Phaser.Types.Sound.DecodeAudioConfig` + * objects as the first and only argument. + * + * Decoding is an async process, so be sure to listen for the events to know when decoding has completed. + * + * Once the audio has decoded it can be added to the Sound Manager or played via its key. + * + * @method Phaser.Sound.WebAudioSoundManager#decodeAudio + * @fires Phaser.Sound.Events#DECODED + * @fires Phaser.Sound.Events#DECODED_ALL + * @since 3.18.0 + * + * @param {(Phaser.Types.Sound.DecodeAudioConfig[]|string)} [audioKey] - The string-based key to be used to reference the decoded audio in the audio cache, or an array of audio config objects. + * @param {(ArrayBuffer|string)} [audioData] - The audio data, either a base64 encoded string, an audio media-type data uri, or an ArrayBuffer instance. + */ + decodeAudio: function (audioKey, audioData) + { + var audioFiles; -/** - * Get the shortest distance from a Line to the given Point. - * - * @function Phaser.Geom.Line.GetShortestDistance - * @since 3.16.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Line} line - The line to get the distance from. - * @param {(Phaser.Geom.Point|object)} point - The point to get the shortest distance to. - * - * @return {number} The shortest distance from the line to the point. - */ -var GetShortestDistance = function (line, point) -{ - var x1 = line.x1; - var y1 = line.y1; + if (!Array.isArray(audioKey)) + { + audioFiles = [ { key: audioKey, data: audioData } ]; + } + else + { + audioFiles = audioKey; + } - var x2 = line.x2; - var y2 = line.y2; + var cache = this.game.cache.audio; + var remaining = audioFiles.length; - var L2 = (((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); + for (var i = 0; i < audioFiles.length; i++) + { + var entry = audioFiles[i]; - if (L2 === 0) - { - return false; - } + var key = entry.key; + var data = entry.data; - var s = (((y1 - point.y) * (x2 - x1)) - ((x1 - point.x) * (y2 - y1))) / L2; + if (typeof data === 'string') + { + data = Base64ToArrayBuffer(data); + } - return Math.abs(s) * Math.sqrt(L2); -}; + var success = function (key, audioBuffer) + { + cache.add(key, audioBuffer); -module.exports = GetShortestDistance; + this.emit(Events.DECODED, key); + remaining--; -/***/ }), -/* 1232 */ -/***/ (function(module, exports) { + if (remaining === 0) + { + this.emit(Events.DECODED_ALL); + } + }.bind(this, key); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var failure = function (key, error) + { + // eslint-disable-next-line no-console + console.error('Error decoding audio: ' + key + ' - ', error ? error.message : ''); -/** - * Calculate the height of the given line. - * - * @function Phaser.Geom.Line.Height - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The line to calculate the height of. - * - * @return {number} The height of the line. - */ -var Height = function (line) -{ - return Math.abs(line.y1 - line.y2); -}; + remaining--; -module.exports = Height; + if (remaining === 0) + { + this.emit(Events.DECODED_ALL); + } + }.bind(this, key); + this.context.decodeAudioData(data, success, failure); + } + }, -/***/ }), -/* 1233 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Sets the X and Y position of the Spatial Audio listener on this Web Audios context. + * + * If you call this method with no parameters it will default to the center-point of + * the game canvas. Depending on the type of game you're making, you may need to call + * this method constantly to reset the listener position as the camera scrolls. + * + * Calling this method does nothing on HTML5Audio. + * + * @method Phaser.Sound.WebAudioSoundManager#setListenerPosition + * @since 3.60.0 + * + * @param {number} [x] - The x position of the Spatial Audio listener. + * @param {number} [y] - The y position of the Spatial Audio listener. + */ + setListenerPosition: function (x, y) + { + if (x === undefined) { x = this.game.scale.width / 2; } + if (y === undefined) { y = this.game.scale.height / 2; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.listenerPosition.set(x, y); -var MATH_CONST = __webpack_require__(14); -var Angle = __webpack_require__(97); + return this; + }, -/** - * Returns the x component of the normal vector of the given line. - * - * @function Phaser.Geom.Line.NormalX - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The Line object to get the normal value from. - * - * @return {number} The x component of the normal vector of the line. - */ -var NormalX = function (line) -{ - return Math.cos(Angle(line) - MATH_CONST.TAU); -}; + /** + * Unlocks Web Audio API on the initial input event. + * + * Read more about how this issue is handled here in [this article](https://medium.com/@pgoloskokovic/unlocking-web-audio-the-smarter-way-8858218c0e09). + * + * @method Phaser.Sound.WebAudioSoundManager#unlock + * @since 3.0.0 + */ + unlock: function () + { + var _this = this; -module.exports = NormalX; + var body = document.body; + var unlockHandler = function unlockHandler () + { + if (_this.context && body) + { + var bodyRemove = body.removeEventListener; -/***/ }), -/* 1234 */ -/***/ (function(module, exports, __webpack_require__) { + _this.context.resume().then(function () + { + bodyRemove('touchstart', unlockHandler); + bodyRemove('touchend', unlockHandler); + bodyRemove('click', unlockHandler); + bodyRemove('keydown', unlockHandler); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + _this.unlocked = true; + }, function () + { + bodyRemove('touchstart', unlockHandler); + bodyRemove('touchend', unlockHandler); + bodyRemove('click', unlockHandler); + bodyRemove('keydown', unlockHandler); + }); + } + }; -var MATH_CONST = __webpack_require__(14); -var Angle = __webpack_require__(97); + if (body) + { + body.addEventListener('touchstart', unlockHandler, false); + body.addEventListener('touchend', unlockHandler, false); + body.addEventListener('click', unlockHandler, false); + body.addEventListener('keydown', unlockHandler, false); + } + }, -/** - * The Y value of the normal of the given line. - * The normal of a line is a vector that points perpendicular from it. - * - * @function Phaser.Geom.Line.NormalY - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The line to calculate the normal of. - * - * @return {number} The Y value of the normal of the Line. - */ -var NormalY = function (line) -{ - return Math.sin(Angle(line) - MATH_CONST.TAU); -}; + /** + * Method used internally for pausing sound manager if + * Phaser.Sound.WebAudioSoundManager#pauseOnBlur is set to true. + * + * @method Phaser.Sound.WebAudioSoundManager#onBlur + * @protected + * @since 3.0.0 + */ + onBlur: function () + { + if (!this.locked) + { + this.context.suspend(); + } + }, -module.exports = NormalY; + /** + * Method used internally for resuming sound manager if + * Phaser.Sound.WebAudioSoundManager#pauseOnBlur is set to true. + * + * @method Phaser.Sound.WebAudioSoundManager#onFocus + * @protected + * @since 3.0.0 + */ + onFocus: function () + { + var context = this.context; + + if (context && !this.locked && (context.state === 'suspended' || context.state === 'interrupted')) + { + context.resume(); + } + }, + /** + * Update method called on every game step. + * + * Removes destroyed sounds and updates every active sound in the game. + * + * @method Phaser.Sound.WebAudioSoundManager#update + * @protected + * @fires Phaser.Sound.Events#UNLOCKED + * @since 3.0.0 + * + * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. + * @param {number} delta - The delta time elapsed since the last frame. + */ + update: function (time, delta) + { + var listener = this.context.listener; -/***/ }), -/* 1235 */ -/***/ (function(module, exports) { + if (listener && listener.positionX !== undefined) + { + var x = GetFastValue(this.listenerPosition, 'x', null); + var y = GetFastValue(this.listenerPosition, 'y', null); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (x && x !== this._spatialx) + { + this._spatialx = listener.positionX.value = x; + } + if (y && y !== this._spatialy) + { + this._spatialy = listener.positionY.value = y; + } + } -/** - * Offset a line by the given amount. - * - * @function Phaser.Geom.Line.Offset - * @since 3.0.0 - * - * @generic {Phaser.Geom.Line} O - [line,$return] - * - * @param {Phaser.Geom.Line} line - The line to offset. - * @param {number} x - The horizontal offset to add to the line. - * @param {number} y - The vertical offset to add to the line. - * - * @return {Phaser.Geom.Line} The offset line. - */ -var Offset = function (line, x, y) -{ - line.x1 += x; - line.y1 += y; + BaseSoundManager.prototype.update.call(this, time, delta); - line.x2 += x; - line.y2 += y; + // Resume interrupted audio on iOS only if the game has focus + if (!this.gameLostFocus) + { + this.onFocus(); + } + }, - return line; -}; + /** + * Calls Phaser.Sound.BaseSoundManager#destroy method + * and cleans up all Web Audio API related stuff. + * + * @method Phaser.Sound.WebAudioSoundManager#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.destination = null; + this.masterVolumeNode.disconnect(); + this.masterVolumeNode = null; + this.masterMuteNode.disconnect(); + this.masterMuteNode = null; -module.exports = Offset; + if (this.game.config.audio.context) + { + this.context.suspend(); + } + else + { + var _this = this; + this.context.close().then(function () + { + _this.context = null; + }); + } -/***/ }), -/* 1236 */ -/***/ (function(module, exports) { + BaseSoundManager.prototype.destroy.call(this); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Sets the muted state of all this Sound Manager. + * + * @method Phaser.Sound.WebAudioSoundManager#setMute + * @fires Phaser.Sound.Events#GLOBAL_MUTE + * @since 3.3.0 + * + * @param {boolean} value - `true` to mute all sounds, `false` to unmute them. + * + * @return {Phaser.Sound.WebAudioSoundManager} This Sound Manager. + */ + setMute: function (value) + { + this.mute = value; -/** - * Calculate the perpendicular slope of the given line. - * - * @function Phaser.Geom.Line.PerpSlope - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The line to calculate the perpendicular slope of. - * - * @return {number} The perpendicular slope of the line. - */ -var PerpSlope = function (line) -{ - return -((line.x2 - line.x1) / (line.y2 - line.y1)); -}; + return this; + }, -module.exports = PerpSlope; + /** + * @name Phaser.Sound.WebAudioSoundManager#mute + * @type {boolean} + * @fires Phaser.Sound.Events#GLOBAL_MUTE + * @since 3.0.0 + */ + mute: { + get: function () + { + return (this.masterMuteNode.gain.value === 0); + }, -/***/ }), -/* 1237 */ -/***/ (function(module, exports, __webpack_require__) { + set: function (value) + { + this.masterMuteNode.gain.setValueAtTime(value ? 0 : 1, 0); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.emit(Events.GLOBAL_MUTE, this, value); + } -var Angle = __webpack_require__(97); -var NormalAngle = __webpack_require__(497); + }, -/** - * Calculate the reflected angle between two lines. - * - * This is the outgoing angle based on the angle of Line 1 and the normalAngle of Line 2. - * - * @function Phaser.Geom.Line.ReflectAngle - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} lineA - The first line. - * @param {Phaser.Geom.Line} lineB - The second line. - * - * @return {number} The reflected angle between each line. - */ -var ReflectAngle = function (lineA, lineB) -{ - return (2 * NormalAngle(lineB) - Math.PI - Angle(lineA)); -}; + /** + * Sets the volume of this Sound Manager. + * + * @method Phaser.Sound.WebAudioSoundManager#setVolume + * @fires Phaser.Sound.Events#GLOBAL_VOLUME + * @since 3.3.0 + * + * @param {number} value - The global volume of this Sound Manager. + * + * @return {Phaser.Sound.WebAudioSoundManager} This Sound Manager. + */ + setVolume: function (value) + { + this.volume = value; -module.exports = ReflectAngle; + return this; + }, + /** + * @name Phaser.Sound.WebAudioSoundManager#volume + * @type {number} + * @fires Phaser.Sound.Events#GLOBAL_VOLUME + * @since 3.0.0 + */ + volume: { -/***/ }), -/* 1238 */ -/***/ (function(module, exports, __webpack_require__) { + get: function () + { + return this.masterVolumeNode.gain.value; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + set: function (value) + { + this.masterVolumeNode.gain.setValueAtTime(value, 0); -var RotateAroundXY = __webpack_require__(236); + this.emit(Events.GLOBAL_VOLUME, this, value); + } -/** - * Rotate a line around its midpoint by the given angle in radians. - * - * @function Phaser.Geom.Line.Rotate - * @since 3.0.0 - * - * @generic {Phaser.Geom.Line} O - [line,$return] - * - * @param {Phaser.Geom.Line} line - The line to rotate. - * @param {number} angle - The angle of rotation in radians. - * - * @return {Phaser.Geom.Line} The rotated line. - */ -var Rotate = function (line, angle) -{ - var x = (line.x1 + line.x2) / 2; - var y = (line.y1 + line.y2) / 2; + } - return RotateAroundXY(line, x, y, angle); -}; +}); -module.exports = Rotate; +module.exports = WebAudioSoundManager; /***/ }), -/* 1239 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 71207: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var RotateAroundXY = __webpack_require__(236); +var ArrayUtils = __webpack_require__(59959); +var Class = __webpack_require__(56694); +var NOOP = __webpack_require__(72283); +var StableSort = __webpack_require__(17922); /** - * Rotate a line around a point by the given angle in radians. - * - * @function Phaser.Geom.Line.RotateAroundPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Line} O - [line,$return] - * - * @param {Phaser.Geom.Line} line - The line to rotate. - * @param {(Phaser.Geom.Point|object)} point - The point to rotate the line around. - * @param {number} angle - The angle of rotation in radians. + * @callback EachListCallback * - * @return {Phaser.Geom.Line} The rotated line. - */ -var RotateAroundPoint = function (line, point, angle) -{ - return RotateAroundXY(line, point.x, point.y, angle); -}; - -module.exports = RotateAroundPoint; - - -/***/ }), -/* 1240 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * @param {I} item - The item which is currently being processed. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. */ /** - * Set a line to a given position, angle and length. + * @classdesc + * List is a generic implementation of an ordered list which contains utility methods for retrieving, manipulating, and iterating items. * - * @function Phaser.Geom.Line.SetToAngle + * @class List + * @memberof Phaser.Structs + * @constructor * @since 3.0.0 * - * @generic {Phaser.Geom.Line} O - [line,$return] - * - * @param {Phaser.Geom.Line} line - The line to set. - * @param {number} x - The horizontal start position of the line. - * @param {number} y - The vertical start position of the line. - * @param {number} angle - The angle of the line in radians. - * @param {number} length - The length of the line. + * @generic T * - * @return {Phaser.Geom.Line} The updated line. + * @param {*} parent - The parent of this list. */ -var SetToAngle = function (line, x, y, angle, length) -{ - line.x1 = x; - line.y1 = y; +var List = new Class({ - line.x2 = x + (Math.cos(angle) * length); - line.y2 = y + (Math.sin(angle) * length); + initialize: - return line; -}; + function List (parent) + { + /** + * The parent of this list. + * + * @name Phaser.Structs.List#parent + * @type {*} + * @since 3.0.0 + */ + this.parent = parent; -module.exports = SetToAngle; + /** + * The objects that belong to this collection. + * + * @genericUse {T[]} - [$type] + * + * @name Phaser.Structs.List#list + * @type {Array.<*>} + * @default [] + * @since 3.0.0 + */ + this.list = []; + /** + * The index of the current element. + * + * This is used internally when iterating through the list with the {@link #first}, {@link #last}, {@link #get}, and {@link #previous} properties. + * + * @name Phaser.Structs.List#position + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.position = 0; -/***/ }), -/* 1241 */ -/***/ (function(module, exports) { + /** + * A callback that is invoked every time a child is added to this list. + * + * @name Phaser.Structs.List#addCallback + * @type {function} + * @since 3.4.0 + */ + this.addCallback = NOOP; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * A callback that is invoked every time a child is removed from this list. + * + * @name Phaser.Structs.List#removeCallback + * @type {function} + * @since 3.4.0 + */ + this.removeCallback = NOOP; -/** - * Calculate the slope of the given line. - * - * @function Phaser.Geom.Line.Slope - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The line to calculate the slope of. - * - * @return {number} The slope of the line. - */ -var Slope = function (line) -{ - return (line.y2 - line.y1) / (line.x2 - line.x1); -}; + /** + * The property key to sort by. + * + * @name Phaser.Structs.List#_sortKey + * @type {string} + * @since 3.4.0 + */ + this._sortKey = ''; + }, -module.exports = Slope; + /** + * Adds the given item to the end of the list. Each item must be unique. + * + * @method Phaser.Structs.List#add + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*|Array.<*>} child - The item, or array of items, to add to the list. + * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully. + * + * @return {*} The list's underlying array. + */ + add: function (child, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.Add(this.list, child); + } + else + { + return ArrayUtils.Add(this.list, child, 0, this.addCallback, this); + } + }, + + /** + * Adds an item to list, starting at a specified index. Each item must be unique within the list. + * + * @method Phaser.Structs.List#addAt + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item, or array of items, to add to the list. + * @param {number} [index=0] - The index in the list at which the element(s) will be inserted. + * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully. + * + * @return {*} The List's underlying array. + */ + addAt: function (child, index, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.AddAt(this.list, child, index); + } + else + { + return ArrayUtils.AddAt(this.list, child, index, 0, this.addCallback, this); + } + }, + /** + * Retrieves the item at a given position inside the List. + * + * @method Phaser.Structs.List#getAt + * @since 3.0.0 + * + * @genericUse {T} - [$return] + * + * @param {number} index - The index of the item. + * + * @return {*} The retrieved item, or `undefined` if it's outside the List's bounds. + */ + getAt: function (index) + { + return this.list[index]; + }, -/***/ }), -/* 1242 */ -/***/ (function(module, exports) { + /** + * Locates an item within the List and returns its index. + * + * @method Phaser.Structs.List#getIndex + * @since 3.0.0 + * + * @genericUse {T} - [child] + * + * @param {*} child - The item to locate. + * + * @return {number} The index of the item within the List, or -1 if it's not in the List. + */ + getIndex: function (child) + { + // Return -1 if given child isn't a child of this display list + return this.list.indexOf(child); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Sort the contents of this List so the items are in order based on the given property. + * For example, `sort('alpha')` would sort the List contents based on the value of their `alpha` property. + * + * @method Phaser.Structs.List#sort + * @since 3.0.0 + * + * @genericUse {T[]} - [children,$return] + * + * @param {string} property - The property to lexically sort by. + * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean. + * + * @return {Phaser.Structs.List} This List object. + */ + sort: function (property, handler) + { + if (!property) + { + return this; + } -/** - * Calculate the width of the given line. - * - * @function Phaser.Geom.Line.Width - * @since 3.0.0 - * - * @param {Phaser.Geom.Line} line - The line to calculate the width of. - * - * @return {number} The width of the line. - */ -var Width = function (line) -{ - return Math.abs(line.x1 - line.x2); -}; + if (handler === undefined) + { + handler = function (childA, childB) + { + return childA[property] - childB[property]; + }; + } -module.exports = Width; + StableSort(this.list, handler); + return this; + }, -/***/ }), -/* 1243 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Searches for the first instance of a child with its `name` + * property matching the given argument. Should more than one child have + * the same name only the first is returned. + * + * @method Phaser.Structs.List#getByName + * @since 3.0.0 + * + * @genericUse {T | null} - [$return] + * + * @param {string} name - The name to search for. + * + * @return {?*} The first child with a matching name, or null if none were found. + */ + getByName: function (name) + { + return ArrayUtils.GetFirst(this.list, 'name', name); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Returns a random child from the group. + * + * @method Phaser.Structs.List#getRandom + * @since 3.0.0 + * + * @genericUse {T | null} - [$return] + * + * @param {number} [startIndex=0] - Offset from the front of the group (lowest child). + * @param {number} [length=(to top)] - Restriction on the number of values you want to randomly select from. + * + * @return {?*} A random child of this Group. + */ + getRandom: function (startIndex, length) + { + return ArrayUtils.GetRandom(this.list, startIndex, length); + }, -/** - * @namespace Phaser.Geom.Mesh - */ + /** + * Returns the first element in a given part of the List which matches a specific criterion. + * + * @method Phaser.Structs.List#getFirst + * @since 3.0.0 + * + * @genericUse {T | null} - [$return] + * + * @param {string} property - The name of the property to test or a falsey value to have no criterion. + * @param {*} value - The value to test the `property` against, or `undefined` to allow any value and only check for existence. + * @param {number} [startIndex=0] - The position in the List to start the search at. + * @param {number} [endIndex] - The position in the List to optionally stop the search at. It won't be checked. + * + * @return {?*} The first item which matches the given criterion, or `null` if no such item exists. + */ + getFirst: function (property, value, startIndex, endIndex) + { + return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex); + }, -var Mesh = { + /** + * Returns all children in this List. + * + * You can optionally specify a matching criteria using the `property` and `value` arguments. + * + * For example: `getAll('parent')` would return only children that have a property called `parent`. + * + * You can also specify a value to compare the property to: + * + * `getAll('visible', true)` would return only children that have their visible property set to `true`. + * + * Optionally you can specify a start and end index. For example if this List had 100 children, + * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only + * the first 50 children in the List. + * + * @method Phaser.Structs.List#getAll + * @since 3.0.0 + * + * @genericUse {T[]} - [$return] + * + * @param {string} [property] - An optional property to test against the value argument. + * @param {any} [value] - If property is set then Child.property must strictly equal this value to be included in the results. + * @param {number} [startIndex] - The first child index to start the search from. + * @param {number} [endIndex] - The last child index to search up until. + * + * @return {Array.<*>} All items of the List which match the given criterion, if any. + */ + getAll: function (property, value, startIndex, endIndex) + { + return ArrayUtils.GetAll(this.list, property, value, startIndex, endIndex); + }, - Face: __webpack_require__(116), - GenerateGridVerts: __webpack_require__(1244), - GenerateObjVerts: __webpack_require__(480), - GenerateVerts: __webpack_require__(479), - ParseObj: __webpack_require__(498), - ParseObjMaterial: __webpack_require__(499), - RotateFace: __webpack_require__(1245), - Vertex: __webpack_require__(117) + /** + * Returns the total number of items in the List which have a property matching the given value. + * + * @method Phaser.Structs.List#count + * @since 3.0.0 + * + * @genericUse {T} - [value] + * + * @param {string} property - The property to test on each item. + * @param {*} value - The value to test the property against. + * + * @return {number} The total number of matching elements. + */ + count: function (property, value) + { + return ArrayUtils.CountAllMatching(this.list, property, value); + }, -}; + /** + * Swaps the positions of two items in the list. + * + * @method Phaser.Structs.List#swap + * @since 3.0.0 + * + * @genericUse {T} - [child1,child2] + * + * @param {*} child1 - The first item to swap. + * @param {*} child2 - The second item to swap. + */ + swap: function (child1, child2) + { + ArrayUtils.Swap(this.list, child1, child2); + }, -module.exports = Mesh; + /** + * Moves an item in the List to a new position. + * + * @method Phaser.Structs.List#moveTo + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to move. + * @param {number} index - Moves an item in the List to a new position. + * + * @return {*} The item that was moved. + */ + moveTo: function (child, index) + { + return ArrayUtils.MoveTo(this.list, child, index); + }, + /** + * Moves the given array element above another one in the array. + * + * @method Phaser.Structs.List#moveAbove + * @since 3.55.0 + * + * @genericUse {T} - [child1,child2] + * + * @param {*} child1 - The element to move above base element. + * @param {*} child2 - The base element. + */ + moveAbove: function (child1, child2) + { + return ArrayUtils.MoveAbove(this.list, child1, child2); + }, -/***/ }), -/* 1244 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Moves the given array element below another one in the array. + * + * @method Phaser.Structs.List#moveBelow + * @since 3.55.0 + * + * @genericUse {T} - [child1,child2] + * + * @param {*} child1 - The element to move below base element. + * @param {*} child2 - The base element. + */ + moveBelow: function (child1, child2) + { + return ArrayUtils.MoveBelow(this.list, child1, child2); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Removes one or many items from the List. + * + * @method Phaser.Structs.List#remove + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item, or array of items, to remove. + * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. + * + * @return {*} The item, or array of items, which were successfully removed from the List. + */ + remove: function (child, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.Remove(this.list, child); + } + else + { + return ArrayUtils.Remove(this.list, child, this.removeCallback, this); + } + }, -var Face = __webpack_require__(116); -var GetFastValue = __webpack_require__(2); -var Matrix4 = __webpack_require__(69); -var Vector3 = __webpack_require__(39); -var Vertex = __webpack_require__(117); + /** + * Removes the item at the given position in the List. + * + * @method Phaser.Structs.List#removeAt + * @since 3.0.0 + * + * @genericUse {T} - [$return] + * + * @param {number} index - The position to remove the item from. + * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. + * + * @return {*} The item that was removed. + */ + removeAt: function (index, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.RemoveAt(this.list, index); + } + else + { + return ArrayUtils.RemoveAt(this.list, index, this.removeCallback, this); + } + }, -var tempPosition = new Vector3(); -var tempRotation = new Vector3(); -var tempMatrix = new Matrix4(); + /** + * Removes the items within the given range in the List. + * + * @method Phaser.Structs.List#removeBetween + * @since 3.0.0 + * + * @genericUse {T[]} - [$return] + * + * @param {number} [startIndex=0] - The index to start removing from. + * @param {number} [endIndex] - The position to stop removing at. The item at this position won't be removed. + * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. + * + * @return {Array.<*>} An array of the items which were removed. + */ + removeBetween: function (startIndex, endIndex, skipCallback) + { + if (skipCallback) + { + return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex); + } + else + { + return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex, this.removeCallback, this); + } + }, -/** - * Creates a grid of vertices based on the given configuration object and optionally adds it to a Mesh. - * - * The size of the grid is given in pixels. An example configuration may be: - * - * `{ width: 256, height: 256, widthSegments: 2, heightSegments: 2, tile: true }` - * - * This will create a grid 256 x 256 pixels in size, split into 2 x 2 segments, with - * the texture tiling across the cells. - * - * You can split the grid into segments both vertically and horizontally. This will - * generate two faces per grid segment as a result. - * - * The `tile` parameter allows you to control if the tile will repeat across the grid - * segments, or be displayed in full. - * - * If adding this grid to a Mesh you can offset the grid via the `x` and `y` properties. - * - * UV coordinates are generated based on the given texture and frame in the config. For - * example, no frame is given, the UVs will be in the range 0 to 1. If a frame is given, - * such as from a texture atlas, the UVs will be generated within the range of that frame. - * - * @function Phaser.Geom.Mesh.GenerateGridVerts - * @since 3.50.0 - * - * @param {Phaser.Types.Geom.Mesh.GenerateGridConfig} config - A Grid configuration object. - * - * @return {Phaser.Types.Geom.Mesh.GenerateGridVertsResult} A Grid Result object, containing the generated vertices and indicies. - */ -var GenerateGridVerts = function (config) -{ - var mesh = GetFastValue(config, 'mesh'); - var texture = GetFastValue(config, 'texture', null); - var frame = GetFastValue(config, 'frame'); - var width = GetFastValue(config, 'width', 1); - var height = GetFastValue(config, 'height', width); - var widthSegments = GetFastValue(config, 'widthSegments', 1); - var heightSegments = GetFastValue(config, 'heightSegments', widthSegments); - var posX = GetFastValue(config, 'x', 0); - var posY = GetFastValue(config, 'y', 0); - var posZ = GetFastValue(config, 'z', 0); - var rotateX = GetFastValue(config, 'rotateX', 0); - var rotateY = GetFastValue(config, 'rotateY', 0); - var rotateZ = GetFastValue(config, 'rotateZ', 0); - var zIsUp = GetFastValue(config, 'zIsUp', true); - var isOrtho = GetFastValue(config, 'isOrtho', (mesh) ? mesh.dirtyCache[11] : false); - var colors = GetFastValue(config, 'colors', [ 0xffffff ]); - var alphas = GetFastValue(config, 'alphas', [ 1 ]); - var tile = GetFastValue(config, 'tile', false); - var flipY = GetFastValue(config, 'flipY', false); + /** + * Removes all the items. + * + * @method Phaser.Structs.List#removeAll + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.List.} - [$return] + * + * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback. + * + * @return {Phaser.Structs.List} This List object. + */ + removeAll: function (skipCallback) + { + var i = this.list.length; - var widthSet = GetFastValue(config, 'width', null); + while (i--) + { + this.remove(this.list[i], skipCallback); + } - var result = { - faces: [], - verts: [] - }; + return this; + }, - tempPosition.set(posX, posY, posZ); - tempRotation.set(rotateX, rotateY, rotateZ); - tempMatrix.fromRotationXYTranslation(tempRotation, tempPosition, zIsUp); + /** + * Brings the given child to the top of this List. + * + * @method Phaser.Structs.List#bringToTop + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to bring to the top of the List. + * + * @return {*} The item which was moved. + */ + bringToTop: function (child) + { + return ArrayUtils.BringToTop(this.list, child); + }, - if (!texture && mesh) + /** + * Sends the given child to the bottom of this List. + * + * @method Phaser.Structs.List#sendToBack + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to send to the back of the list. + * + * @return {*} The item which was moved. + */ + sendToBack: function (child) { - texture = mesh.texture; - } - else if (mesh && typeof(texture) === 'string') + return ArrayUtils.SendToBack(this.list, child); + }, + + /** + * Moves the given child up one place in this group unless it's already at the top. + * + * @method Phaser.Structs.List#moveUp + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to move up. + * + * @return {*} The item which was moved. + */ + moveUp: function (child) { - texture = mesh.scene.sys.textures.get(texture); - } - else + ArrayUtils.MoveUp(this.list, child); + + return child; + }, + + /** + * Moves the given child down one place in this group unless it's already at the bottom. + * + * @method Phaser.Structs.List#moveDown + * @since 3.0.0 + * + * @genericUse {T} - [child,$return] + * + * @param {*} child - The item to move down. + * + * @return {*} The item which was moved. + */ + moveDown: function (child) { - // There's nothing more we can do without a texture - return result; - } + ArrayUtils.MoveDown(this.list, child); - var textureFrame = texture.get(frame); + return child; + }, - // If the Mesh is ortho and no width / height is given, we'll default to texture sizes (if set!) - if (!widthSet && isOrtho && texture && mesh) + /** + * Reverses the order of all children in this List. + * + * @method Phaser.Structs.List#reverse + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.List.} - [$return] + * + * @return {Phaser.Structs.List} This List object. + */ + reverse: function () { - width = textureFrame.width / mesh.height; - height = textureFrame.height / mesh.height; - } + this.list.reverse(); - var halfWidth = width / 2; - var halfHeight = height / 2; + return this; + }, - var gridX = Math.floor(widthSegments); - var gridY = Math.floor(heightSegments); + /** + * Shuffles the items in the list. + * + * @method Phaser.Structs.List#shuffle + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.List.} - [$return] + * + * @return {Phaser.Structs.List} This List object. + */ + shuffle: function () + { + ArrayUtils.Shuffle(this.list); - var gridX1 = gridX + 1; - var gridY1 = gridY + 1; + return this; + }, - var segmentWidth = width / gridX; - var segmentHeight = height / gridY; + /** + * Replaces a child of this List with the given newChild. The newChild cannot be a member of this List. + * + * @method Phaser.Structs.List#replace + * @since 3.0.0 + * + * @genericUse {T} - [oldChild,newChild,$return] + * + * @param {*} oldChild - The child in this List that will be replaced. + * @param {*} newChild - The child to be inserted into this List. + * + * @return {*} Returns the oldChild that was replaced within this group. + */ + replace: function (oldChild, newChild) + { + return ArrayUtils.Replace(this.list, oldChild, newChild); + }, - var uvs = []; - var vertices = []; + /** + * Checks if an item exists within the List. + * + * @method Phaser.Structs.List#exists + * @since 3.0.0 + * + * @genericUse {T} - [child] + * + * @param {*} child - The item to check for the existence of. + * + * @return {boolean} `true` if the item is found in the list, otherwise `false`. + */ + exists: function (child) + { + return (this.list.indexOf(child) > -1); + }, - var ix; - var iy; + /** + * Sets the property `key` to the given value on all members of this List. + * + * @method Phaser.Structs.List#setAll + * @since 3.0.0 + * + * @genericUse {T} - [value] + * + * @param {string} property - The name of the property to set. + * @param {*} value - The value to set the property to. + * @param {number} [startIndex] - The first child index to start the search from. + * @param {number} [endIndex] - The last child index to search up until. + */ + setAll: function (property, value, startIndex, endIndex) + { + ArrayUtils.SetAll(this.list, property, value, startIndex, endIndex); - var frameU0 = 0; - var frameU1 = 1; - var frameV0 = 0; - var frameV1 = 1; + return this; + }, - if (textureFrame) + /** + * Passes all children to the given callback. + * + * @method Phaser.Structs.List#each + * @since 3.0.0 + * + * @genericUse {EachListCallback.} - [callback] + * + * @param {EachListCallback} callback - The function to call. + * @param {*} [context] - Value to use as `this` when executing callback. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + */ + each: function (callback, context) { - frameU0 = textureFrame.u0; - frameU1 = textureFrame.u1; + var args = [ null ]; - if (!flipY) - { - frameV0 = textureFrame.v0; - frameV1 = textureFrame.v1; - } - else + for (var i = 2; i < arguments.length; i++) { - frameV0 = textureFrame.v1; - frameV1 = textureFrame.v0; + args.push(arguments[i]); } - } - - var frameU = frameU1 - frameU0; - var frameV = frameV1 - frameV0; - - for (iy = 0; iy < gridY1; iy++) - { - var y = iy * segmentHeight - halfHeight; - for (ix = 0; ix < gridX1; ix++) + for (i = 0; i < this.list.length; i++) { - var x = ix * segmentWidth - halfWidth; - - vertices.push(x, -y); - - var tu = frameU0 + frameU * (ix / gridX); - var tv = frameV0 + frameV * (iy / gridY); + args[0] = this.list[i]; - uvs.push(tu, tv); + callback.apply(context, args); } - } + }, - if (!Array.isArray(colors)) + /** + * Clears the List and recreates its internal array. + * + * @method Phaser.Structs.List#shutdown + * @since 3.0.0 + */ + shutdown: function () { - colors = [ colors ]; - } + this.removeAll(); - if (!Array.isArray(alphas)) + this.list = []; + }, + + /** + * Destroys this List. + * + * @method Phaser.Structs.List#destroy + * @since 3.0.0 + */ + destroy: function () { - alphas = [ alphas ]; - } + this.removeAll(); - var alphaIndex = 0; - var colorIndex = 0; + this.parent = null; + this.addCallback = null; + this.removeCallback = null; + }, - for (iy = 0; iy < gridY; iy++) - { - for (ix = 0; ix < gridX; ix++) - { - var a = (ix + gridX1 * iy) * 2; - var b = (ix + gridX1 * (iy + 1)) * 2; - var c = ((ix + 1) + gridX1 * (iy + 1)) * 2; - var d = ((ix + 1) + gridX1 * iy) * 2; + /** + * The number of items inside the List. + * + * @name Phaser.Structs.List#length + * @type {number} + * @readonly + * @since 3.0.0 + */ + length: { - var color = colors[colorIndex]; - var alpha = alphas[alphaIndex]; + get: function () + { + return this.list.length; + } - var vert1 = new Vertex(vertices[a], vertices[a + 1], 0, uvs[a], uvs[a + 1], color, alpha).transformMat4(tempMatrix); - var vert2 = new Vertex(vertices[b], vertices[b + 1], 0, uvs[b], uvs[b + 1], color, alpha).transformMat4(tempMatrix); - var vert3 = new Vertex(vertices[d], vertices[d + 1], 0, uvs[d], uvs[d + 1], color, alpha).transformMat4(tempMatrix); - var vert4 = new Vertex(vertices[b], vertices[b + 1], 0, uvs[b], uvs[b + 1], color, alpha).transformMat4(tempMatrix); - var vert5 = new Vertex(vertices[c], vertices[c + 1], 0, uvs[c], uvs[c + 1], color, alpha).transformMat4(tempMatrix); - var vert6 = new Vertex(vertices[d], vertices[d + 1], 0, uvs[d], uvs[d + 1], color, alpha).transformMat4(tempMatrix); + }, - if (tile) - { - vert1.setUVs(frameU0, frameV1); - vert2.setUVs(frameU0, frameV0); - vert3.setUVs(frameU1, frameV1); - vert4.setUVs(frameU0, frameV0); - vert5.setUVs(frameU1, frameV0); - vert6.setUVs(frameU1, frameV1); - } + /** + * The first item in the List or `null` for an empty List. + * + * @name Phaser.Structs.List#first + * @genericUse {T} - [$type] + * @type {*} + * @readonly + * @since 3.0.0 + */ + first: { - colorIndex++; + get: function () + { + this.position = 0; - if (colorIndex === colors.length) + if (this.list.length > 0) { - colorIndex = 0; + return this.list[0]; } - - alphaIndex++; - - if (alphaIndex === alphas.length) + else { - alphaIndex = 0; + return null; } - - result.verts.push(vert1, vert2, vert3, vert4, vert5, vert6); - - result.faces.push( - new Face(vert1, vert2, vert3), - new Face(vert4, vert5, vert6) - ); } - } - - if (mesh) - { - mesh.faces = mesh.faces.concat(result.faces); - mesh.vertices = mesh.vertices.concat(result.verts); - } - - return result; -}; - -module.exports = GenerateGridVerts; - - -/***/ }), -/* 1245 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Rotates the vertices of a Face to the given angle. - * - * The actual vertex positions are adjusted, not their transformed positions. - * - * Therefore, this updates the vertex data directly. - * - * @function Phaser.Geom.Mesh.RotateFace - * @since 3.50.0 - * - * @param {Phaser.Geom.Mesh.Face} face - The Face to rotate. - * @param {number} angle - The angle to rotate to, in radians. - * @param {number} [cx] - An optional center of rotation. If not given, the Face in-center is used. - * @param {number} [cy] - An optional center of rotation. If not given, the Face in-center is used. - */ -var RotateFace = function (face, angle, cx, cy) -{ - var x; - var y; - - // No point of rotation? Use the inCenter instead, then. - if (cx === undefined && cy === undefined) - { - var inCenter = face.getInCenter(); - - x = inCenter.x; - y = inCenter.y; - } - var c = Math.cos(angle); - var s = Math.sin(angle); + }, - var v1 = face.vertex1; - var v2 = face.vertex2; - var v3 = face.vertex3; + /** + * The last item in the List, or `null` for an empty List. + * + * @name Phaser.Structs.List#last + * @genericUse {T} - [$type] + * @type {*} + * @readonly + * @since 3.0.0 + */ + last: { - var tx = v1.x - x; - var ty = v1.y - y; + get: function () + { + if (this.list.length > 0) + { + this.position = this.list.length - 1; - v1.set(tx * c - ty * s + x, tx * s + ty * c + y); + return this.list[this.position]; + } + else + { + return null; + } + } - tx = v2.x - x; - ty = v2.y - y; + }, - v2.set(tx * c - ty * s + x, tx * s + ty * c + y); + /** + * The next item in the List, or `null` if the entire List has been traversed. + * + * This property can be read successively after reading {@link #first} or manually setting the {@link #position} to iterate the List. + * + * @name Phaser.Structs.List#next + * @genericUse {T} - [$type] + * @type {*} + * @readonly + * @since 3.0.0 + */ + next: { - tx = v3.x - x; - ty = v3.y - y; + get: function () + { + if (this.position < this.list.length) + { + this.position++; - v3.set(tx * c - ty * s + x, tx * s + ty * c + y); -}; + return this.list[this.position]; + } + else + { + return null; + } + } -module.exports = RotateFace; + }, + /** + * The previous item in the List, or `null` if the entire List has been traversed. + * + * This property can be read successively after reading {@link #last} or manually setting the {@link #position} to iterate the List backwards. + * + * @name Phaser.Structs.List#previous + * @genericUse {T} - [$type] + * @type {*} + * @readonly + * @since 3.0.0 + */ + previous: { -/***/ }), -/* 1246 */ -/***/ (function(module, exports, __webpack_require__) { + get: function () + { + if (this.position > 0) + { + this.position--; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this.list[this.position]; + } + else + { + return null; + } + } -var Point = __webpack_require__(4); + } -Point.Ceil = __webpack_require__(1247); -Point.Clone = __webpack_require__(1248); -Point.CopyFrom = __webpack_require__(1249); -Point.Equals = __webpack_require__(1250); -Point.Floor = __webpack_require__(1251); -Point.GetCentroid = __webpack_require__(1252); -Point.GetMagnitude = __webpack_require__(500); -Point.GetMagnitudeSq = __webpack_require__(501); -Point.GetRectangleFromPoints = __webpack_require__(1253); -Point.Interpolate = __webpack_require__(1254); -Point.Invert = __webpack_require__(1255); -Point.Negative = __webpack_require__(1256); -Point.Project = __webpack_require__(1257); -Point.ProjectUnit = __webpack_require__(1258); -Point.SetMagnitude = __webpack_require__(1259); +}); -module.exports = Point; +module.exports = List; /***/ }), -/* 1247 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Apply `Math.ceil()` to each coordinate of the given Point. - * - * @function Phaser.Geom.Point.Ceil - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [point,$return] - * - * @param {Phaser.Geom.Point} point - The Point to ceil. - * - * @return {Phaser.Geom.Point} The Point with `Math.ceil()` applied to its coordinates. - */ -var Ceil = function (point) -{ - return point.setTo(Math.ceil(point.x), Math.ceil(point.y)); -}; - -module.exports = Ceil; - -/***/ }), -/* 1248 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ 33885: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Point = __webpack_require__(4); - -/** - * Clone the given Point. - * - * @function Phaser.Geom.Point.Clone - * @since 3.0.0 - * - * @param {Phaser.Geom.Point} source - The source Point to clone. - * - * @return {Phaser.Geom.Point} The cloned Point. - */ -var Clone = function (source) -{ - return new Point(source.x, source.y); -}; - -module.exports = Clone; - - -/***/ }), -/* 1249 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +var Class = __webpack_require__(56694); /** - * Copy the values of one Point to a destination Point. - * - * @function Phaser.Geom.Point.CopyFrom - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [dest,$return] + * @callback EachMapCallback * - * @param {Phaser.Geom.Point} source - The source Point to copy the values from. - * @param {Phaser.Geom.Point} dest - The destination Point to copy the values to. + * @param {string} key - The key of the Map entry. + * @param {E} entry - The value of the Map entry. * - * @return {Phaser.Geom.Point} The destination Point. - */ -var CopyFrom = function (source, dest) -{ - return dest.setTo(source.x, source.y); -}; - -module.exports = CopyFrom; - - -/***/ }), -/* 1250 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * @return {?boolean} The callback result. */ /** - * A comparison of two `Point` objects to see if they are equal. - * - * @function Phaser.Geom.Point.Equals - * @since 3.0.0 - * - * @param {Phaser.Geom.Point} point - The original `Point` to compare against. - * @param {Phaser.Geom.Point} toCompare - The second `Point` to compare. + * @classdesc + * The keys of a Map can be arbitrary values. * - * @return {boolean} Returns true if the both `Point` objects are equal. - */ -var Equals = function (point, toCompare) -{ - return (point.x === toCompare.x && point.y === toCompare.y); -}; - -module.exports = Equals; - - -/***/ }), -/* 1251 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Apply `Math.ceil()` to each coordinate of the given Point. + * ```javascript + * var map = new Map([ + * [ 1, 'one' ], + * [ 2, 'two' ], + * [ 3, 'three' ] + * ]); + * ``` * - * @function Phaser.Geom.Point.Floor + * @class Map + * @memberof Phaser.Structs + * @constructor * @since 3.0.0 * - * @generic {Phaser.Geom.Point} O - [point,$return] - * - * @param {Phaser.Geom.Point} point - The Point to floor. + * @generic K + * @generic V + * @genericUse {V[]} - [elements] * - * @return {Phaser.Geom.Point} The Point with `Math.floor()` applied to its coordinates. - */ -var Floor = function (point) -{ - return point.setTo(Math.floor(point.x), Math.floor(point.y)); -}; - -module.exports = Floor; - - -/***/ }), -/* 1252 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * @param {Array.<*>} elements - An optional array of key-value pairs to populate this Map with. */ +var Map = new Class({ -var Point = __webpack_require__(4); - -/** - * Get the centroid or geometric center of a plane figure (the arithmetic mean position of all the points in the figure). - * Informally, it is the point at which a cutout of the shape could be perfectly balanced on the tip of a pin. - * - * @function Phaser.Geom.Point.GetCentroid - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Types.Math.Vector2Like[]} points - An array of Vector2Like objects to get the geometric center of. - * @param {Phaser.Geom.Point} [out] - A Point object to store the output coordinates in. If not given, a new Point instance is created. - * - * @return {Phaser.Geom.Point} A Point object representing the geometric center of the given points. - */ -var GetCentroid = function (points, out) -{ - if (out === undefined) { out = new Point(); } + initialize: - if (!Array.isArray(points)) + function Map (elements) { - throw new Error('GetCentroid points argument must be an array'); - } + /** + * The entries in this Map. + * + * @genericUse {Object.} - [$type] + * + * @name Phaser.Structs.Map#entries + * @type {Object.} + * @default {} + * @since 3.0.0 + */ + this.entries = {}; - var len = points.length; + /** + * The number of key / value pairs in this Map. + * + * @name Phaser.Structs.Map#size + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.size = 0; - if (len < 1) - { - throw new Error('GetCentroid points array must not be empty'); - } - else if (len === 1) - { - out.x = points[0].x; - out.y = points[0].y; - } - else - { - for (var i = 0; i < len; i++) + if (Array.isArray(elements)) { - out.x += points[i].x; - out.y += points[i].y; + for (var i = 0; i < elements.length; i++) + { + this.set(elements[i][0], elements[i][1]); + } } + }, - out.x /= len; - out.y /= len; - } - - return out; -}; - -module.exports = GetCentroid; - - -/***/ }), -/* 1253 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Rectangle = __webpack_require__(10); - -/** - * Calculates the Axis Aligned Bounding Box (or aabb) from an array of points. - * - * @function Phaser.Geom.Point.GetRectangleFromPoints - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [out,$return] - * - * @param {Phaser.Types.Math.Vector2Like[]} points - An array of Vector2Like objects to get the AABB from. - * @param {Phaser.Geom.Rectangle} [out] - A Rectangle object to store the results in. If not given, a new Rectangle instance is created. - * - * @return {Phaser.Geom.Rectangle} A Rectangle object holding the AABB values for the given points. - */ -var GetRectangleFromPoints = function (points, out) -{ - if (out === undefined) { out = new Rectangle(); } - - var xMax = Number.NEGATIVE_INFINITY; - var xMin = Number.POSITIVE_INFINITY; - var yMax = Number.NEGATIVE_INFINITY; - var yMin = Number.POSITIVE_INFINITY; - - for (var i = 0; i < points.length; i++) + /** + * Adds an element with a specified `key` and `value` to this Map. + * If the `key` already exists, the value will be replaced. + * + * @method Phaser.Structs.Map#set + * @since 3.0.0 + * + * @genericUse {K} - [key] + * @genericUse {V} - [value] + * @genericUse {Phaser.Structs.Map.} - [$return] + * + * @param {string} key - The key of the element to be added to this Map. + * @param {*} value - The value of the element to be added to this Map. + * + * @return {Phaser.Structs.Map} This Map object. + */ + set: function (key, value) { - var point = points[i]; - - if (point.x > xMax) + if (!this.has(key)) { - xMax = point.x; + this.size++; } - if (point.x < xMin) - { - xMin = point.x; - } + this.entries[key] = value; - if (point.y > yMax) - { - yMax = point.y; - } + return this; + }, - if (point.y < yMin) + /** + * Returns the value associated to the `key`, or `undefined` if there is none. + * + * @method Phaser.Structs.Map#get + * @since 3.0.0 + * + * @genericUse {K} - [key] + * @genericUse {V} - [$return] + * + * @param {string} key - The key of the element to return from the `Map` object. + * + * @return {*} The element associated with the specified key or `undefined` if the key can't be found in this Map object. + */ + get: function (key) + { + if (this.has(key)) { - yMin = point.y; + return this.entries[key]; } - } - - out.x = xMin; - out.y = yMin; - out.width = xMax - xMin; - out.height = yMax - yMin; - - return out; -}; - -module.exports = GetRectangleFromPoints; + }, + /** + * Returns an `Array` of all the values stored in this Map. + * + * @method Phaser.Structs.Map#getArray + * @since 3.0.0 + * + * @genericUse {V[]} - [$return] + * + * @return {Array.<*>} An array of the values stored in this Map. + */ + getArray: function () + { + var output = []; + var entries = this.entries; -/***/ }), -/* 1254 */ -/***/ (function(module, exports, __webpack_require__) { + for (var key in entries) + { + output.push(entries[key]); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return output; + }, -var Point = __webpack_require__(4); + /** + * Returns a boolean indicating whether an element with the specified key exists or not. + * + * @method Phaser.Structs.Map#has + * @since 3.0.0 + * + * @genericUse {K} - [key] + * + * @param {string} key - The key of the element to test for presence of in this Map. + * + * @return {boolean} Returns `true` if an element with the specified key exists in this Map, otherwise `false`. + */ + has: function (key) + { + return (this.entries.hasOwnProperty(key)); + }, -/** - * Returns the linear interpolation point between the two given points, based on `t`. - * - * @function Phaser.Geom.Point.Interpolate - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Point} pointA - The starting `Point` for the interpolation. - * @param {Phaser.Geom.Point} pointB - The target `Point` for the interpolation. - * @param {number} [t=0] - The amount to interpolate between the two points. Generally, a value between 0 (returns the starting `Point`) and 1 (returns the target `Point`). If omitted, 0 is used. - * @param {(Phaser.Geom.Point|object)} [out] - An optional `Point` object whose `x` and `y` values will be set to the result of the interpolation (can also be any object with `x` and `y` properties). If omitted, a new `Point` created and returned. - * - * @return {(Phaser.Geom.Point|object)} Either the object from the `out` argument with the properties `x` and `y` set to the result of the interpolation or a newly created `Point` object. - */ -var Interpolate = function (pointA, pointB, t, out) -{ - if (t === undefined) { t = 0; } - if (out === undefined) { out = new Point(); } + /** + * Delete the specified element from this Map. + * + * @method Phaser.Structs.Map#delete + * @since 3.0.0 + * + * @genericUse {K} - [key] + * @genericUse {Phaser.Structs.Map.} - [$return] + * + * @param {string} key - The key of the element to delete from this Map. + * + * @return {Phaser.Structs.Map} This Map object. + */ + delete: function (key) + { + if (this.has(key)) + { + delete this.entries[key]; + this.size--; + } - out.x = pointA.x + ((pointB.x - pointA.x) * t); - out.y = pointA.y + ((pointB.y - pointA.y) * t); + return this; + }, - return out; -}; + /** + * Delete all entries from this Map. + * + * @method Phaser.Structs.Map#clear + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.Map.} - [$return] + * + * @return {Phaser.Structs.Map} This Map object. + */ + clear: function () + { + Object.keys(this.entries).forEach(function (prop) + { + delete this.entries[prop]; -module.exports = Interpolate; + }, this); + this.size = 0; -/***/ }), -/* 1255 */ -/***/ (function(module, exports) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Returns all entries keys in this Map. + * + * @method Phaser.Structs.Map#keys + * @since 3.0.0 + * + * @genericUse {K[]} - [$return] + * + * @return {string[]} Array containing entries' keys. + */ + keys: function () + { + return Object.keys(this.entries); + }, -/** - * Swaps the X and the Y coordinate of a point. - * - * @function Phaser.Geom.Point.Invert - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [point,$return] - * - * @param {Phaser.Geom.Point} point - The Point to modify. - * - * @return {Phaser.Geom.Point} The modified `point`. - */ -var Invert = function (point) -{ - return point.setTo(point.y, point.x); -}; + /** + * Returns an `Array` of all entries. + * + * @method Phaser.Structs.Map#values + * @since 3.0.0 + * + * @genericUse {V[]} - [$return] + * + * @return {Array.<*>} An `Array` of entries. + */ + values: function () + { + var output = []; + var entries = this.entries; -module.exports = Invert; + for (var key in entries) + { + output.push(entries[key]); + } + return output; + }, -/***/ }), -/* 1256 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Dumps the contents of this Map to the console via `console.group`. + * + * @method Phaser.Structs.Map#dump + * @since 3.0.0 + */ + dump: function () + { + var entries = this.entries; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // eslint-disable-next-line no-console + console.group('Map'); -var Point = __webpack_require__(4); + for (var key in entries) + { + console.log(key, entries[key]); + } -/** - * Inverts a Point's coordinates. - * - * @function Phaser.Geom.Point.Negative - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Point} point - The Point to invert. - * @param {Phaser.Geom.Point} [out] - The Point to return the inverted coordinates in. - * - * @return {Phaser.Geom.Point} The modified `out` Point, or a new Point if none was provided. - */ -var Negative = function (point, out) -{ - if (out === undefined) { out = new Point(); } + // eslint-disable-next-line no-console + console.groupEnd(); + }, - return out.setTo(-point.x, -point.y); -}; + /** + * Iterates through all entries in this Map, passing each one to the given callback. + * + * If the callback returns `false`, the iteration will break. + * + * @method Phaser.Structs.Map#each + * @since 3.0.0 + * + * @genericUse {EachMapCallback.} - [callback] + * @genericUse {Phaser.Structs.Map.} - [$return] + * + * @param {EachMapCallback} callback - The callback which will receive the keys and entries held in this Map. + * + * @return {Phaser.Structs.Map} This Map object. + */ + each: function (callback) + { + var entries = this.entries; -module.exports = Negative; + for (var key in entries) + { + if (callback(key, entries[key]) === false) + { + break; + } + } + return this; + }, -/***/ }), -/* 1257 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Returns `true` if the value exists within this Map. Otherwise, returns `false`. + * + * @method Phaser.Structs.Map#contains + * @since 3.0.0 + * + * @genericUse {V} - [value] + * + * @param {*} value - The value to search for. + * + * @return {boolean} `true` if the value is found, otherwise `false`. + */ + contains: function (value) + { + var entries = this.entries; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (var key in entries) + { + if (entries[key] === value) + { + return true; + } + } -var Point = __webpack_require__(4); -var GetMagnitudeSq = __webpack_require__(501); + return false; + }, -/** - * Calculates the vector projection of `pointA` onto the nonzero `pointB`. This is the - * orthogonal projection of `pointA` onto a straight line parallel to `pointB`. - * - * @function Phaser.Geom.Point.Project - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Point} pointA - Point A, to be projected onto Point B. - * @param {Phaser.Geom.Point} pointB - Point B, to have Point A projected upon it. - * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. - * - * @return {Phaser.Geom.Point} A Point object holding the coordinates of the vector projection of `pointA` onto `pointB`. - */ -var Project = function (pointA, pointB, out) -{ - if (out === undefined) { out = new Point(); } + /** + * Merges all new keys from the given Map into this one. + * If it encounters a key that already exists it will be skipped unless override is set to `true`. + * + * @method Phaser.Structs.Map#merge + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.Map.} - [map,$return] + * + * @param {Phaser.Structs.Map} map - The Map to merge in to this Map. + * @param {boolean} [override=false] - Set to `true` to replace values in this Map with those from the source map, or `false` to skip them. + * + * @return {Phaser.Structs.Map} This Map object. + */ + merge: function (map, override) + { + if (override === undefined) { override = false; } - var dot = ((pointA.x * pointB.x) + (pointA.y * pointB.y)); - var amt = dot / GetMagnitudeSq(pointB); + var local = this.entries; + var source = map.entries; - if (amt !== 0) - { - out.x = amt * pointB.x; - out.y = amt * pointB.y; + for (var key in source) + { + if (local.hasOwnProperty(key) && override) + { + local[key] = source[key]; + } + else + { + this.set(key, source[key]); + } + } + + return this; } - return out; -}; +}); -module.exports = Project; +module.exports = Map; /***/ }), -/* 1258 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 74623: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Point = __webpack_require__(4); +var Class = __webpack_require__(56694); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(36716); /** - * Calculates the vector projection of `pointA` onto the nonzero `pointB`. This is the - * orthogonal projection of `pointA` onto a straight line paralle to `pointB`. + * @classdesc + * A Process Queue maintains three internal lists. * - * @function Phaser.Geom.Point.ProjectUnit - * @since 3.0.0 + * The `pending` list is a selection of items which are due to be made 'active' in the next update. + * The `active` list is a selection of items which are considered active and should be updated. + * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. * - * @generic {Phaser.Geom.Point} O - [out,$return] + * When new items are added to a Process Queue they are put in the pending list, rather than being added + * immediately the active list. Equally, items that are removed are put into the destroy list, rather than + * being destroyed immediately. This allows the Process Queue to carefully process each item at a specific, fixed + * time, rather than at the time of the request from the API. * - * @param {Phaser.Geom.Point} pointA - Point A, to be projected onto Point B. Must be a normalized point with a magnitude of 1. - * @param {Phaser.Geom.Point} pointB - Point B, to have Point A projected upon it. - * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. + * @class ProcessQueue + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Structs + * @constructor + * @since 3.0.0 * - * @return {Phaser.Geom.Point} A unit Point object holding the coordinates of the vector projection of `pointA` onto `pointB`. + * @generic T */ -var ProjectUnit = function (pointA, pointB, out) -{ - if (out === undefined) { out = new Point(); } +var ProcessQueue = new Class({ - var amt = ((pointA.x * pointB.x) + (pointA.y * pointB.y)); + Extends: EventEmitter, - if (amt !== 0) + initialize: + + function ProcessQueue () { - out.x = amt * pointB.x; - out.y = amt * pointB.y; - } + EventEmitter.call(this); - return out; -}; + /** + * The `pending` list is a selection of items which are due to be made 'active' in the next update. + * + * @genericUse {T[]} - [$type] + * + * @name Phaser.Structs.ProcessQueue#_pending + * @type {Array.<*>} + * @private + * @default [] + * @since 3.0.0 + */ + this._pending = []; -module.exports = ProjectUnit; + /** + * The `active` list is a selection of items which are considered active and should be updated. + * + * @genericUse {T[]} - [$type] + * + * @name Phaser.Structs.ProcessQueue#_active + * @type {Array.<*>} + * @private + * @default [] + * @since 3.0.0 + */ + this._active = []; + /** + * The `destroy` list is a selection of items that were active and are awaiting being destroyed in the next update. + * + * @genericUse {T[]} - [$type] + * + * @name Phaser.Structs.ProcessQueue#_destroy + * @type {Array.<*>} + * @private + * @default [] + * @since 3.0.0 + */ + this._destroy = []; -/***/ }), -/* 1259 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The total number of items awaiting processing. + * + * @name Phaser.Structs.ProcessQueue#_toProcess + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._toProcess = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * If `true` only unique objects will be allowed in the queue. + * + * @name Phaser.Structs.ProcessQueue#checkQueue + * @type {boolean} + * @since 3.50.0 + */ + this.checkQueue = false; + }, -var GetMagnitude = __webpack_require__(500); + /** + * Checks the given item to see if it is already active within this Process Queue. + * + * @method Phaser.Structs.ProcessQueue#isActive + * @since 3.60.0 + * + * @genericUse {T} - [item] + * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] + * + * @param {*} item - The item to check. + * + * @return {boolean} `true` if the item is active, otherwise `false`. + */ + isActive: function (item) + { + return (this._active.indexOf(item) > -1); + }, -/** - * Changes the magnitude (length) of a two-dimensional vector without changing its direction. - * - * @function Phaser.Geom.Point.SetMagnitude - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [point,$return] - * - * @param {Phaser.Geom.Point} point - The Point to treat as the end point of the vector. - * @param {number} magnitude - The new magnitude of the vector. - * - * @return {Phaser.Geom.Point} The modified Point. - */ -var SetMagnitude = function (point, magnitude) -{ - if (point.x !== 0 || point.y !== 0) + /** + * Checks the given item to see if it is already pending addition to this Process Queue. + * + * @method Phaser.Structs.ProcessQueue#isPending + * @since 3.60.0 + * + * @genericUse {T} - [item] + * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] + * + * @param {*} item - The item to check. + * + * @return {boolean} `true` if the item is pending insertion, otherwise `false`. + */ + isPending: function (item) { - var m = GetMagnitude(point); + return (this._toProcess > 0 && this._pending.indexOf(item) > -1); + }, - point.x /= m; - point.y /= m; - } + /** + * Checks the given item to see if it is already pending destruction from this Process Queue. + * + * @method Phaser.Structs.ProcessQueue#isDestroying + * @since 3.60.0 + * + * @genericUse {T} - [item] + * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] + * + * @param {*} item - The item to check. + * + * @return {boolean} `true` if the item is pending destruction, otherwise `false`. + */ + isDestroying: function (item) + { + return (this._destroy.indexOf(item) > -1); + }, - point.x *= magnitude; - point.y *= magnitude; + /** + * Adds a new item to the Process Queue. + * + * The item is added to the pending list and made active in the next update. + * + * @method Phaser.Structs.ProcessQueue#add + * @since 3.0.0 + * + * @genericUse {T} - [item] + * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] + * + * @param {*} item - The item to add to the queue. + * + * @return {*} The item that was added. + */ + add: function (item) + { + // Don't add if already active or pending, but DO add if active AND in the destroy list + if (this.checkQueue && (this.isActive() && !this.isDestroying()) || this.isPending()) + { + return item; + } - return point; -}; + this._pending.push(item); -module.exports = SetMagnitude; + this._toProcess++; + return item; + }, -/***/ }), -/* 1260 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Removes an item from the Process Queue. + * + * The item is added to the 'destroy' list and is fully removed in the next update. + * + * @method Phaser.Structs.ProcessQueue#remove + * @since 3.0.0 + * + * @genericUse {T} - [item] + * @genericUse {Phaser.Structs.ProcessQueue.} - [$return] + * + * @param {*} item - The item to be removed from the queue. + * + * @return {*} The item that was removed. + */ + remove: function (item) + { + // Check if it's in the _pending list + if (this.isPending(item)) + { + var pending = this._pending; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var idx = pending.indexOf(item); -var Polygon = __webpack_require__(227); + if (idx !== -1) + { + // Remove directly, no need to wait for an update loop + pending.splice(idx, 1); + } + } + else if (this.isActive(item)) + { + // Item is actively running? Queue it for deletion + this._destroy.push(item); -Polygon.Clone = __webpack_require__(1261); -Polygon.Contains = __webpack_require__(228); -Polygon.ContainsPoint = __webpack_require__(1262); -Polygon.Earcut = __webpack_require__(59); -Polygon.GetAABB = __webpack_require__(469); -Polygon.GetNumberArray = __webpack_require__(1263); -Polygon.GetPoints = __webpack_require__(470); -Polygon.Perimeter = __webpack_require__(471); -Polygon.Reverse = __webpack_require__(1264); -Polygon.Simplify = __webpack_require__(1265); -Polygon.Smooth = __webpack_require__(472); -Polygon.Translate = __webpack_require__(1266); + this._toProcess++; + } -module.exports = Polygon; + // If neither of the above conditions pass, then the item is either already in the destroy list, + // or isn't pending or active, so cannot be removed anyway + return item; + }, -/***/ }), -/* 1261 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Removes all active items from this Process Queue. + * + * All the items are marked as 'pending destroy' and fully removed in the next update. + * + * @method Phaser.Structs.ProcessQueue#removeAll + * @since 3.20.0 + * + * @return {this} This Process Queue object. + */ + removeAll: function () + { + var list = this._active; + var destroy = this._destroy; + var i = list.length; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + while (i--) + { + destroy.push(list[i]); -var Polygon = __webpack_require__(227); + this._toProcess++; + } -/** - * Create a new polygon which is a copy of the specified polygon - * - * @function Phaser.Geom.Polygon.Clone - * @since 3.0.0 - * - * @param {Phaser.Geom.Polygon} polygon - The polygon to create a clone of - * - * @return {Phaser.Geom.Polygon} A new separate Polygon cloned from the specified polygon, based on the same points. - */ -var Clone = function (polygon) -{ - return new Polygon(polygon.points); -}; + return this; + }, -module.exports = Clone; + /** + * Update this queue. First it will process any items awaiting destruction, and remove them. + * + * Then it will check to see if there are any items pending insertion, and move them to an + * active state. Finally, it will return a list of active items for further processing. + * + * @method Phaser.Structs.ProcessQueue#update + * @since 3.0.0 + * + * @genericUse {T[]} - [$return] + * + * @return {Array.<*>} A list of active items. + */ + update: function () + { + if (this._toProcess === 0) + { + // Quick bail + return this._active; + } + var list = this._destroy; + var active = this._active; + var i; + var item; -/***/ }), -/* 1262 */ -/***/ (function(module, exports, __webpack_require__) { + // Clear the 'destroy' list + for (i = 0; i < list.length; i++) + { + item = list[i]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Remove from the 'active' array + var idx = active.indexOf(item); -var Contains = __webpack_require__(228); + if (idx !== -1) + { + active.splice(idx, 1); -/** - * Checks the given Point again the Polygon to see if the Point lays within its vertices. - * - * @function Phaser.Geom.Polygon.ContainsPoint - * @since 3.0.0 - * - * @param {Phaser.Geom.Polygon} polygon - The Polygon to check. - * @param {Phaser.Geom.Point} point - The Point to check if it's within the Polygon. - * - * @return {boolean} `true` if the Point is within the Polygon, otherwise `false`. - */ -var ContainsPoint = function (polygon, point) -{ - return Contains(polygon, point.x, point.y); -}; + this.emit(Events.PROCESS_QUEUE_REMOVE, item); + } + } -module.exports = ContainsPoint; + list.length = 0; + // Process the pending addition list + // This stops callbacks and out of sync events from populating the active array mid-way during an update -/***/ }), -/* 1263 */ -/***/ (function(module, exports) { + list = this._pending; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (i = 0; i < list.length; i++) + { + item = list[i]; -// Export the points as an array of flat numbers, following the sequence [ x,y, x,y, x,y ] + if (!this.checkQueue || (this.checkQueue && active.indexOf(item) === -1)) + { + active.push(item); -/** - * Stores all of the points of a Polygon into a flat array of numbers following the sequence [ x,y, x,y, x,y ], - * i.e. each point of the Polygon, in the order it's defined, corresponds to two elements of the resultant - * array for the point's X and Y coordinate. - * - * @function Phaser.Geom.Polygon.GetNumberArray - * @since 3.0.0 - * - * @generic {number[]} O - [output,$return] - * - * @param {Phaser.Geom.Polygon} polygon - The Polygon whose points to export. - * @param {(array|number[])} [output] - An array to which the points' coordinates should be appended. - * - * @return {(array|number[])} The modified `output` array, or a new array if none was given. - */ -var GetNumberArray = function (polygon, output) -{ - if (output === undefined) { output = []; } + this.emit(Events.PROCESS_QUEUE_ADD, item); + } + } - for (var i = 0; i < polygon.points.length; i++) - { - output.push(polygon.points[i].x); - output.push(polygon.points[i].y); - } + list.length = 0; - return output; -}; + this._toProcess = 0; -module.exports = GetNumberArray; + // The owner of this queue can now safely do whatever it needs to with the active list + return active; + }, + + /** + * Returns the current list of active items. + * + * This method returns a reference to the active list array, not a copy of it. + * Therefore, be careful to not modify this array outside of the ProcessQueue. + * + * @method Phaser.Structs.ProcessQueue#getActive + * @since 3.0.0 + * + * @genericUse {T[]} - [$return] + * + * @return {Array.<*>} A list of active items. + */ + getActive: function () + { + return this._active; + }, + /** + * The number of entries in the active list. + * + * @name Phaser.Structs.ProcessQueue#length + * @type {number} + * @readonly + * @since 3.20.0 + */ + length: { -/***/ }), -/* 1264 */ -/***/ (function(module, exports) { + get: function () + { + return this._active.length; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + }, -/** - * Reverses the order of the points of a Polygon. - * - * @function Phaser.Geom.Polygon.Reverse - * @since 3.0.0 - * - * @generic {Phaser.Geom.Polygon} O - [polygon,$return] - * - * @param {Phaser.Geom.Polygon} polygon - The Polygon to modify. - * - * @return {Phaser.Geom.Polygon} The modified Polygon. - */ -var Reverse = function (polygon) -{ - polygon.points.reverse(); + /** + * Immediately destroys this process queue, clearing all of its internal arrays and resetting the process totals. + * + * @method Phaser.Structs.ProcessQueue#destroy + * @since 3.0.0 + */ + destroy: function () + { + this._toProcess = 0; - return polygon; -}; + this._pending = []; + this._active = []; + this._destroy = []; + } -module.exports = Reverse; +}); + +module.exports = ProcessQueue; /***/ }), -/* 1265 */ -/***/ (function(module, exports) { + +/***/ 68687: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @author Richard Davey * @author Vladimir Agafonkin - * @see Based on Simplify.js mourner.github.io/simplify-js + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var quickselect = __webpack_require__(53466); + /** - * Copyright (c) 2017, Vladimir Agafonkin - * All rights reserved. + * @classdesc + * RBush is a high-performance JavaScript library for 2D spatial indexing of points and rectangles. + * It's based on an optimized R-tree data structure with bulk insertion support. * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: + * Spatial index is a special data structure for points and rectangles that allows you to perform queries like + * "all items within this bounding box" very efficiently (e.g. hundreds of times faster than looping over all items). * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. + * This version of RBush uses a fixed min/max accessor structure of `[ '.left', '.top', '.right', '.bottom' ]`. + * This is to avoid the eval like function creation that the original library used, which caused CSP policy violations. * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. + * rbush is forked from https://github.com/mourner/rbush by Vladimir Agafonkin * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * @ignore + * @class RTree + * @memberof Phaser.Structs + * @constructor + * @since 3.0.0 */ -function getSqDist (p1, p2) -{ - var dx = p1.x - p2.x, - dy = p1.y - p2.y; - return dx * dx + dy * dy; -} - -/** - * Square distance from a point to a segment - * - * @ignore - */ -function getSqSegDist (p, p1, p2) +function rbush (maxEntries) { - var x = p1.x, - y = p1.y, - dx = p2.x - x, - dy = p2.y - y; - - if (dx !== 0 || dy !== 0) - { - var t = ((p.x - x) * dx + (p.y - y) * dy) / (dx * dx + dy * dy); + var format = [ '.left', '.top', '.right', '.bottom' ]; - if (t > 1) - { - x = p2.x; - y = p2.y; - } - else if (t > 0) - { - x += dx * t; - y += dy * t; - } - } + if (!(this instanceof rbush)) return new rbush(maxEntries, format); - dx = p.x - x; - dy = p.y - y; + // max entries in a node is 9 by default; min node fill is 40% for best performance + this._maxEntries = Math.max(4, maxEntries || 9); + this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)); - return dx * dx + dy * dy; + this.clear(); } -/** - * Basic distance-based simplification - * - * @ignore - */ -function simplifyRadialDist (points, sqTolerance) -{ - var prevPoint = points[0], - newPoints = [ prevPoint ], - point; +rbush.prototype = { - for (var i = 1, len = points.length; i < len; i++) + all: function () { - point = points[i]; - - if (getSqDist(point, prevPoint) > sqTolerance) - { - newPoints.push(point); - prevPoint = point; - } - } + return this._all(this.data, []); + }, - if (prevPoint !== point) + search: function (bbox) { - newPoints.push(point); - } + var node = this.data, + result = [], + toBBox = this.toBBox; - return newPoints; -} + if (!intersects(bbox, node)) return result; -/** - * @ignore - */ -function simplifyDPStep (points, first, last, sqTolerance, simplified) -{ - var maxSqDist = sqTolerance, - index; + var nodesToSearch = [], + i, len, child, childBBox; - for (var i = first + 1; i < last; i++) - { - var sqDist = getSqSegDist(points[i], points[first], points[last]); + while (node) { + for (i = 0, len = node.children.length; i < len; i++) { - if (sqDist > maxSqDist) - { - index = i; - maxSqDist = sqDist; - } - } + child = node.children[i]; + childBBox = node.leaf ? toBBox(child) : child; - if (maxSqDist > sqTolerance) - { - if (index - first > 1) - { - simplifyDPStep(points, first, index, sqTolerance, simplified); + if (intersects(bbox, childBBox)) { + if (node.leaf) result.push(child); + else if (contains(bbox, childBBox)) this._all(child, result); + else nodesToSearch.push(child); + } + } + node = nodesToSearch.pop(); } - simplified.push(points[index]); - - if (last - index > 1) - { - simplifyDPStep(points, index, last, sqTolerance, simplified); - } - } -} + return result; + }, -/** - * Simplification using Ramer-Douglas-Peucker algorithm - * - * @ignore - */ -function simplifyDouglasPeucker (points, sqTolerance) -{ - var last = points.length - 1; + collides: function (bbox) + { + var node = this.data, + toBBox = this.toBBox; - var simplified = [ points[0] ]; + if (!intersects(bbox, node)) return false; - simplifyDPStep(points, 0, last, sqTolerance, simplified); + var nodesToSearch = [], + i, len, child, childBBox; - simplified.push(points[last]); + while (node) { + for (i = 0, len = node.children.length; i < len; i++) { - return simplified; -} + child = node.children[i]; + childBBox = node.leaf ? toBBox(child) : child; -/** - * Takes a Polygon object and simplifies the points by running them through a combination of - * Douglas-Peucker and Radial Distance algorithms. Simplification dramatically reduces the number of - * points in a polygon while retaining its shape, giving a huge performance boost when processing - * it and also reducing visual noise. - * - * @function Phaser.Geom.Polygon.Simplify - * @since 3.50.0 - * - * @generic {Phaser.Geom.Polygon} O - [polygon,$return] - * - * @param {Phaser.Geom.Polygon} polygon - The polygon to be simplified. The polygon will be modified in-place and returned. - * @param {number} [tolerance=1] - Affects the amount of simplification (in the same metric as the point coordinates). - * @param {boolean} [highestQuality=false] - Excludes distance-based preprocessing step which leads to highest quality simplification but runs ~10-20 times slower. - * - * @return {Phaser.Geom.Polygon} The input polygon. - */ -var Simplify = function (polygon, tolerance, highestQuality) -{ - if (tolerance === undefined) { tolerance = 1; } - if (highestQuality === undefined) { highestQuality = false; } + if (intersects(bbox, childBBox)) { + if (node.leaf || contains(bbox, childBBox)) return true; + nodesToSearch.push(child); + } + } + node = nodesToSearch.pop(); + } - var points = polygon.points; + return false; + }, - if (points.length > 2) + load: function (data) { - var sqTolerance = tolerance * tolerance; + if (!(data && data.length)) return this; - if (!highestQuality) - { - points = simplifyRadialDist(points, sqTolerance); + if (data.length < this._minEntries) { + for (var i = 0, len = data.length; i < len; i++) { + this.insert(data[i]); + } + return this; } - polygon.setTo(simplifyDouglasPeucker(points, sqTolerance)); - } - - return polygon; -}; + // recursively build the tree with the given data from scratch using OMT algorithm + var node = this._build(data.slice(), 0, data.length - 1, 0); -module.exports = Simplify; + if (!this.data.children.length) { + // save as is if tree is empty + this.data = node; + } else if (this.data.height === node.height) { + // split root if trees have the same height + this._splitRoot(this.data, node); -/***/ }), -/* 1266 */ -/***/ (function(module, exports) { + } else { + if (this.data.height < node.height) { + // swap trees if inserted one is bigger + var tmpNode = this.data; + this.data = node; + node = tmpNode; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // insert the small tree into the large tree at appropriate level + this._insert(node, this.data.height - node.height - 1, true); + } -/** - * Tranlates the points of the given Polygon. - * - * @function Phaser.Geom.Polygon.Translate - * @since 3.50.0 - * - * @generic {Phaser.Geom.Polygon} O - [polygon,$return] - * - * @param {Phaser.Geom.Polygon} polygon - The Polygon to modify. - * @param {number} x - The amount to horizontally translate the points by. - * @param {number} y - The amount to vertically translate the points by. - * - * @return {Phaser.Geom.Polygon} The modified Polygon. - */ -var Translate = function (polygon, x, y) -{ - var points = polygon.points; + return this; + }, - for (var i = 0; i < points.length; i++) + insert: function (item) { - points[i].x += x; - points[i].y += y; - } - - return polygon; -}; - -module.exports = Translate; - - -/***/ }), -/* 1267 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Calculates the area of the given Rectangle object. - * - * @function Phaser.Geom.Rectangle.Area - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rect - The rectangle to calculate the area of. - * - * @return {number} The area of the Rectangle object. - */ -var Area = function (rect) -{ - return rect.width * rect.height; -}; - -module.exports = Area; - - -/***/ }), -/* 1268 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Rounds a Rectangle's position up to the smallest integer greater than or equal to each current coordinate. - * - * @function Phaser.Geom.Rectangle.Ceil - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [rect,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to adjust. - * - * @return {Phaser.Geom.Rectangle} The adjusted Rectangle. - */ -var Ceil = function (rect) -{ - rect.x = Math.ceil(rect.x); - rect.y = Math.ceil(rect.y); - - return rect; -}; - -module.exports = Ceil; + if (item) this._insert(item, this.data.height - 1); + return this; + }, + clear: function () + { + this.data = createNode([]); + return this; + }, -/***/ }), -/* 1269 */ -/***/ (function(module, exports) { + remove: function (item, equalsFn) + { + if (!item) return this; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var node = this.data, + bbox = this.toBBox(item), + path = [], + indexes = [], + i, parent, index, goingUp; -/** - * Rounds a Rectangle's position and size up to the smallest integer greater than or equal to each respective value. - * - * @function Phaser.Geom.Rectangle.CeilAll - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [rect,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to modify. - * - * @return {Phaser.Geom.Rectangle} The modified Rectangle. - */ -var CeilAll = function (rect) -{ - rect.x = Math.ceil(rect.x); - rect.y = Math.ceil(rect.y); - rect.width = Math.ceil(rect.width); - rect.height = Math.ceil(rect.height); + // depth-first iterative tree traversal + while (node || path.length) { - return rect; -}; + if (!node) { // go up + node = path.pop(); + parent = path[path.length - 1]; + i = indexes.pop(); + goingUp = true; + } -module.exports = CeilAll; + if (node.leaf) { // check current node + index = findItem(item, node.children, equalsFn); + if (index !== -1) { + // item found, remove the item and condense tree upwards + node.children.splice(index, 1); + path.push(node); + this._condense(path); + return this; + } + } -/***/ }), -/* 1270 */ -/***/ (function(module, exports, __webpack_require__) { + if (!goingUp && !node.leaf && contains(node, bbox)) { // go down + path.push(node); + indexes.push(i); + i = 0; + parent = node; + node = node.children[0]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + } else if (parent) { // go right + i++; + node = parent.children[i]; + goingUp = false; -var Rectangle = __webpack_require__(10); + } else node = null; // nothing found + } -/** - * Creates a new Rectangle which is identical to the given one. - * - * @function Phaser.Geom.Rectangle.Clone - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} source - The Rectangle to clone. - * - * @return {Phaser.Geom.Rectangle} The newly created Rectangle, which is separate from the given one. - */ -var Clone = function (source) -{ - return new Rectangle(source.x, source.y, source.width, source.height); -}; + return this; + }, -module.exports = Clone; + toBBox: function (item) { return item; }, + compareMinX: compareNodeMinX, + compareMinY: compareNodeMinY, -/***/ }), -/* 1271 */ -/***/ (function(module, exports, __webpack_require__) { + toJSON: function () { return this.data; }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + fromJSON: function (data) + { + this.data = data; + return this; + }, -var Contains = __webpack_require__(57); + _all: function (node, result) + { + var nodesToSearch = []; + while (node) { + if (node.leaf) result.push.apply(result, node.children); + else nodesToSearch.push.apply(nodesToSearch, node.children); -/** - * Determines whether the specified point is contained within the rectangular region defined by this Rectangle object. - * - * @function Phaser.Geom.Rectangle.ContainsPoint - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle object. - * @param {Phaser.Geom.Point} point - The point object to be checked. Can be a Phaser Point object or any object with x and y values. - * - * @return {boolean} A value of true if the Rectangle object contains the specified point, otherwise false. - */ -var ContainsPoint = function (rect, point) -{ - return Contains(rect, point.x, point.y); -}; + node = nodesToSearch.pop(); + } + return result; + }, -module.exports = ContainsPoint; + _build: function (items, left, right, height) + { + var N = right - left + 1, + M = this._maxEntries, + node; + if (N <= M) { + // reached leaf level; return leaf + node = createNode(items.slice(left, right + 1)); + calcBBox(node, this.toBBox); + return node; + } -/***/ }), -/* 1272 */ -/***/ (function(module, exports) { + if (!height) { + // target height of the bulk-loaded tree + height = Math.ceil(Math.log(N) / Math.log(M)); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // target number of root entries to maximize storage utilization + M = Math.ceil(N / Math.pow(M, height - 1)); + } -/** - * Copy the values of one Rectangle to a destination Rectangle. - * - * @function Phaser.Geom.Rectangle.CopyFrom - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [dest,$return] - * - * @param {Phaser.Geom.Rectangle} source - The source Rectangle to copy the values from. - * @param {Phaser.Geom.Rectangle} dest - The destination Rectangle to copy the values to. - * - * @return {Phaser.Geom.Rectangle} The destination Rectangle. - */ -var CopyFrom = function (source, dest) -{ - return dest.setTo(source.x, source.y, source.width, source.height); -}; + node = createNode([]); + node.leaf = false; + node.height = height; -module.exports = CopyFrom; + // split the items into M mostly square tiles + var N2 = Math.ceil(N / M), + N1 = N2 * Math.ceil(Math.sqrt(M)), + i, j, right2, right3; -/***/ }), -/* 1273 */ -/***/ (function(module, exports) { + multiSelect(items, left, right, N1, this.compareMinX); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + for (i = left; i <= right; i += N1) { -/** - * Compares the `x`, `y`, `width` and `height` properties of two rectangles. - * - * @function Phaser.Geom.Rectangle.Equals - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rect - Rectangle A - * @param {Phaser.Geom.Rectangle} toCompare - Rectangle B - * - * @return {boolean} `true` if the rectangles' properties are an exact match, otherwise `false`. - */ -var Equals = function (rect, toCompare) -{ - return ( - rect.x === toCompare.x && - rect.y === toCompare.y && - rect.width === toCompare.width && - rect.height === toCompare.height - ); -}; + right2 = Math.min(i + N1 - 1, right); -module.exports = Equals; + multiSelect(items, i, right2, N2, this.compareMinY); + for (j = i; j <= right2; j += N2) { -/***/ }), -/* 1274 */ -/***/ (function(module, exports, __webpack_require__) { + right3 = Math.min(j + N2 - 1, right2); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // pack each entry recursively + node.children.push(this._build(items, j, right3, height - 1)); + } + } -var GetAspectRatio = __webpack_require__(237); + calcBBox(node, this.toBBox); -/** - * Adjusts the target rectangle, changing its width, height and position, - * so that it fits inside the area of the source rectangle, while maintaining its original - * aspect ratio. - * - * Unlike the `FitOutside` function, there may be some space inside the source area not covered. - * - * @function Phaser.Geom.Rectangle.FitInside - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [target,$return] - * - * @param {Phaser.Geom.Rectangle} target - The target rectangle to adjust. - * @param {Phaser.Geom.Rectangle} source - The source rectangle to envelop the target in. - * - * @return {Phaser.Geom.Rectangle} The modified target rectangle instance. - */ -var FitInside = function (target, source) -{ - var ratio = GetAspectRatio(target); + return node; + }, - if (ratio < GetAspectRatio(source)) - { - // Taller than Wide - target.setSize(source.height * ratio, source.height); - } - else + _chooseSubtree: function (bbox, node, level, path) { - // Wider than Tall - target.setSize(source.width, source.width / ratio); - } + var i, len, child, targetNode, area, enlargement, minArea, minEnlargement; - return target.setPosition( - source.centerX - (target.width / 2), - source.centerY - (target.height / 2) - ); -}; + while (true) { + path.push(node); -module.exports = FitInside; + if (node.leaf || path.length - 1 === level) break; + minArea = minEnlargement = Infinity; -/***/ }), -/* 1275 */ -/***/ (function(module, exports, __webpack_require__) { + for (i = 0, len = node.children.length; i < len; i++) { + child = node.children[i]; + area = bboxArea(child); + enlargement = enlargedArea(bbox, child) - area; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // choose entry with the least area enlargement + if (enlargement < minEnlargement) { + minEnlargement = enlargement; + minArea = area < minArea ? area : minArea; + targetNode = child; -var GetAspectRatio = __webpack_require__(237); + } else if (enlargement === minEnlargement) { + // otherwise choose one with the smallest area + if (area < minArea) { + minArea = area; + targetNode = child; + } + } + } -/** - * Adjusts the target rectangle, changing its width, height and position, - * so that it fully covers the area of the source rectangle, while maintaining its original - * aspect ratio. - * - * Unlike the `FitInside` function, the target rectangle may extend further out than the source. - * - * @function Phaser.Geom.Rectangle.FitOutside - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [target,$return] - * - * @param {Phaser.Geom.Rectangle} target - The target rectangle to adjust. - * @param {Phaser.Geom.Rectangle} source - The source rectangle to envelope the target in. - * - * @return {Phaser.Geom.Rectangle} The modified target rectangle instance. - */ -var FitOutside = function (target, source) -{ - var ratio = GetAspectRatio(target); + node = targetNode || node.children[0]; + } - if (ratio > GetAspectRatio(source)) - { - // Wider than Tall - target.setSize(source.height * ratio, source.height); - } - else - { - // Taller than Wide - target.setSize(source.width, source.width / ratio); - } + return node; + }, - return target.setPosition( - source.centerX - target.width / 2, - source.centerY - target.height / 2 - ); -}; + _insert: function (item, level, isNode) + { + var toBBox = this.toBBox, + bbox = isNode ? item : toBBox(item), + insertPath = []; -module.exports = FitOutside; + // find the best node for accommodating the item, saving all nodes along the path too + var node = this._chooseSubtree(bbox, this.data, level, insertPath); + // put the item into the node + node.children.push(item); + extend(node, bbox); -/***/ }), -/* 1276 */ -/***/ (function(module, exports) { + // split on node overflow; propagate upwards if necessary + while (level >= 0) { + if (insertPath[level].children.length > this._maxEntries) { + this._split(insertPath, level); + level--; + } else break; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // adjust bboxes along the insertion path + this._adjustParentBBoxes(bbox, insertPath, level); + }, -/** - * Rounds down (floors) the top left X and Y coordinates of the given Rectangle to the largest integer less than or equal to them - * - * @function Phaser.Geom.Rectangle.Floor - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [rect,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The rectangle to floor the top left X and Y coordinates of - * - * @return {Phaser.Geom.Rectangle} The rectangle that was passed to this function with its coordinates floored. - */ -var Floor = function (rect) -{ - rect.x = Math.floor(rect.x); - rect.y = Math.floor(rect.y); + // split overflowed node into two + _split: function (insertPath, level) + { + var node = insertPath[level], + M = node.children.length, + m = this._minEntries; - return rect; -}; + this._chooseSplitAxis(node, m, M); -module.exports = Floor; + var splitIndex = this._chooseSplitIndex(node, m, M); + var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex)); + newNode.height = node.height; + newNode.leaf = node.leaf; -/***/ }), -/* 1277 */ -/***/ (function(module, exports) { + calcBBox(node, this.toBBox); + calcBBox(newNode, this.toBBox); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (level) insertPath[level - 1].children.push(newNode); + else this._splitRoot(node, newNode); + }, -/** - * Rounds a Rectangle's position and size down to the largest integer less than or equal to each current coordinate or dimension. - * - * @function Phaser.Geom.Rectangle.FloorAll - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [rect,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to adjust. - * - * @return {Phaser.Geom.Rectangle} The adjusted Rectangle. - */ -var FloorAll = function (rect) -{ - rect.x = Math.floor(rect.x); - rect.y = Math.floor(rect.y); - rect.width = Math.floor(rect.width); - rect.height = Math.floor(rect.height); + _splitRoot: function (node, newNode) + { + // split root node + this.data = createNode([node, newNode]); + this.data.height = node.height + 1; + this.data.leaf = false; + calcBBox(this.data, this.toBBox); + }, - return rect; -}; + _chooseSplitIndex: function (node, m, M) + { + var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index; -module.exports = FloorAll; + minOverlap = minArea = Infinity; + for (i = m; i <= M - m; i++) { + bbox1 = distBBox(node, 0, i, this.toBBox); + bbox2 = distBBox(node, i, M, this.toBBox); -/***/ }), -/* 1278 */ -/***/ (function(module, exports, __webpack_require__) { + overlap = intersectionArea(bbox1, bbox2); + area = bboxArea(bbox1) + bboxArea(bbox2); -/** - * @author samme - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // choose distribution with minimum overlap + if (overlap < minOverlap) { + minOverlap = overlap; + index = i; -var Rectangle = __webpack_require__(10); + minArea = area < minArea ? area : minArea; -/** - * Create the smallest Rectangle containing two coordinate pairs. - * - * @function Phaser.Geom.Rectangle.FromXY - * @since 3.23.0 - * - * @generic {Phaser.Geom.Rectangle} O - [out,$return] - * - * @param {number} x1 - The X coordinate of the first point. - * @param {number} y1 - The Y coordinate of the first point. - * @param {number} x2 - The X coordinate of the second point. - * @param {number} y2 - The Y coordinate of the second point. - * @param {Phaser.Geom.Rectangle} [out] - Optional Rectangle to adjust. - * - * @return {Phaser.Geom.Rectangle} The adjusted `out` Rectangle, or a new Rectangle if none was provided. - */ -var FromXY = function (x1, y1, x2, y2, out) -{ - if (out === undefined) { out = new Rectangle(); } + } else if (overlap === minOverlap) { + // otherwise choose distribution with minimum area + if (area < minArea) { + minArea = area; + index = i; + } + } + } - return out.setTo( - Math.min(x1, x2), - Math.min(y1, y2), - Math.abs(x1 - x2), - Math.abs(y1 - y2) - ); -}; + return index; + }, -module.exports = FromXY; + // sorts node children by the best axis for split + _chooseSplitAxis: function (node, m, M) + { + var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, + compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, + xMargin = this._allDistMargin(node, m, M, compareMinX), + yMargin = this._allDistMargin(node, m, M, compareMinY); + // if total distributions margin value is minimal for x, sort by minX, + // otherwise it's already sorted by minY + if (xMargin < yMargin) node.children.sort(compareMinX); + }, -/***/ }), -/* 1279 */ -/***/ (function(module, exports, __webpack_require__) { + // total margin of all possible split distributions where each node is at least m full + _allDistMargin: function (node, m, M, compare) + { + node.children.sort(compare); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var toBBox = this.toBBox, + leftBBox = distBBox(node, 0, m, toBBox), + rightBBox = distBBox(node, M - m, M, toBBox), + margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), + i, child; -var Point = __webpack_require__(4); + for (i = m; i < M - m; i++) { + child = node.children[i]; + extend(leftBBox, node.leaf ? toBBox(child) : child); + margin += bboxMargin(leftBBox); + } -/** - * Returns the center of a Rectangle as a Point. - * - * @function Phaser.Geom.Rectangle.GetCenter - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the center of. - * @param {(Phaser.Geom.Point|object)} [out] - Optional point-like object to update with the center coordinates. - * - * @return {(Phaser.Geom.Point|object)} The modified `out` object, or a new Point if none was provided. - */ -var GetCenter = function (rect, out) -{ - if (out === undefined) { out = new Point(); } + for (i = M - m - 1; i >= m; i--) { + child = node.children[i]; + extend(rightBBox, node.leaf ? toBBox(child) : child); + margin += bboxMargin(rightBBox); + } - out.x = rect.centerX; - out.y = rect.centerY; + return margin; + }, - return out; -}; + _adjustParentBBoxes: function (bbox, path, level) + { + // adjust bboxes along the given tree path + for (var i = level; i >= 0; i--) { + extend(path[i], bbox); + } + }, -module.exports = GetCenter; + _condense: function (path) + { + // go through the path, removing empty nodes and updating bboxes + for (var i = path.length - 1, siblings; i >= 0; i--) { + if (path[i].children.length === 0) { + if (i > 0) { + siblings = path[i - 1].children; + siblings.splice(siblings.indexOf(path[i]), 1); + } else this.clear(); -/***/ }), -/* 1280 */ -/***/ (function(module, exports, __webpack_require__) { + } else calcBBox(path[i], this.toBBox); + } + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + compareMinX: function (a, b) + { + return a.left - b.left; + }, -var Point = __webpack_require__(4); + compareMinY: function (a, b) + { + return a.top - b.top; + }, + toBBox: function (a) + { + return { + minX: a.left, + minY: a.top, + maxX: a.right, + maxY: a.bottom + }; + } +}; -/** - * Returns the size of the Rectangle, expressed as a Point object. - * With the value of the `width` as the `x` property and the `height` as the `y` property. - * - * @function Phaser.Geom.Rectangle.GetSize - * @since 3.0.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to get the size from. - * @param {(Phaser.Geom.Point|object)} [out] - The Point object to store the size in. If not given, a new Point instance is created. - * - * @return {(Phaser.Geom.Point|object)} A Point object where `x` holds the width and `y` holds the height of the Rectangle. - */ -var GetSize = function (rect, out) +function findItem (item, items, equalsFn) { - if (out === undefined) { out = new Point(); } + if (!equalsFn) return items.indexOf(item); - out.x = rect.width; - out.y = rect.height; + for (var i = 0; i < items.length; i++) { + if (equalsFn(item, items[i])) return i; + } + return -1; +} - return out; -}; +// calculate node's bbox from bboxes of its children +function calcBBox (node, toBBox) +{ + distBBox(node, 0, node.children.length, toBBox, node); +} -module.exports = GetSize; +// min bounding rectangle of node children from k to p-1 +function distBBox (node, k, p, toBBox, destNode) +{ + if (!destNode) destNode = createNode(null); + destNode.minX = Infinity; + destNode.minY = Infinity; + destNode.maxX = -Infinity; + destNode.maxY = -Infinity; + for (var i = k, child; i < p; i++) { + child = node.children[i]; + extend(destNode, node.leaf ? toBBox(child) : child); + } -/***/ }), -/* 1281 */ -/***/ (function(module, exports, __webpack_require__) { + return destNode; +} -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +function extend (a, b) +{ + a.minX = Math.min(a.minX, b.minX); + a.minY = Math.min(a.minY, b.minY); + a.maxX = Math.max(a.maxX, b.maxX); + a.maxY = Math.max(a.maxY, b.maxY); + return a; +} -var CenterOn = __webpack_require__(190); +function compareNodeMinX (a, b) { return a.minX - b.minX; } +function compareNodeMinY (a, b) { return a.minY - b.minY; } +function bboxArea (a) { return (a.maxX - a.minX) * (a.maxY - a.minY); } +function bboxMargin (a) { return (a.maxX - a.minX) + (a.maxY - a.minY); } -/** - * Increases the size of a Rectangle by a specified amount. - * - * The center of the Rectangle stays the same. The amounts are added to each side, so the actual increase in width or height is two times bigger than the respective argument. - * - * @function Phaser.Geom.Rectangle.Inflate - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [rect,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to inflate. - * @param {number} x - How many pixels the left and the right side should be moved by horizontally. - * @param {number} y - How many pixels the top and the bottom side should be moved by vertically. - * - * @return {Phaser.Geom.Rectangle} The inflated Rectangle. - */ -var Inflate = function (rect, x, y) +function enlargedArea (a, b) { - var cx = rect.centerX; - var cy = rect.centerY; - - rect.setSize(rect.width + (x * 2), rect.height + (y * 2)); + return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) * + (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY)); +} - return CenterOn(rect, cx, cy); -}; +function intersectionArea (a, b) +{ + var minX = Math.max(a.minX, b.minX), + minY = Math.max(a.minY, b.minY), + maxX = Math.min(a.maxX, b.maxX), + maxY = Math.min(a.maxY, b.maxY); -module.exports = Inflate; + return Math.max(0, maxX - minX) * + Math.max(0, maxY - minY); +} +function contains (a, b) +{ + return a.minX <= b.minX && + a.minY <= b.minY && + b.maxX <= a.maxX && + b.maxY <= a.maxY; +} -/***/ }), -/* 1282 */ -/***/ (function(module, exports, __webpack_require__) { +function intersects (a, b) +{ + return b.minX <= a.maxX && + b.minY <= a.maxY && + b.maxX >= a.minX && + b.maxY >= a.minY; +} -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +function createNode (children) +{ + return { + children: children, + height: 1, + leaf: true, + minX: Infinity, + minY: Infinity, + maxX: -Infinity, + maxY: -Infinity + }; +} -var Rectangle = __webpack_require__(10); -var Intersects = __webpack_require__(152); +// sort an array so that items come in groups of n unsorted items, with groups sorted between each other; +// combines selection algorithm with binary divide & conquer approach -/** - * Takes two Rectangles and first checks to see if they intersect. - * If they intersect it will return the area of intersection in the `out` Rectangle. - * If they do not intersect, the `out` Rectangle will have a width and height of zero. - * - * @function Phaser.Geom.Rectangle.Intersection - * @since 3.11.0 - * - * @generic {Phaser.Geom.Rectangle} O - [rect,$return] - * - * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to get the intersection from. - * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to get the intersection from. - * @param {Phaser.Geom.Rectangle} [out] - A Rectangle to store the intersection results in. - * - * @return {Phaser.Geom.Rectangle} The intersection result. If the width and height are zero, no intersection occurred. - */ -var Intersection = function (rectA, rectB, out) +function multiSelect (arr, left, right, n, compare) { - if (out === undefined) { out = new Rectangle(); } + var stack = [left, right], + mid; - if (Intersects(rectA, rectB)) - { - out.x = Math.max(rectA.x, rectB.x); - out.y = Math.max(rectA.y, rectB.y); - out.width = Math.min(rectA.right, rectB.right) - out.x; - out.height = Math.min(rectA.bottom, rectB.bottom) - out.y; - } - else + while (stack.length) { - out.setEmpty(); - } + right = stack.pop(); + left = stack.pop(); - return out; -}; + if (right - left <= n) continue; -module.exports = Intersection; + mid = left + Math.ceil((right - left) / n / 2) * n; + quickselect(arr, mid, left, right, compare); + + stack.push(left, mid, mid, right); + } +} + +module.exports = rbush; /***/ }), -/* 1283 */ -/***/ (function(module, exports) { + +/***/ 58403: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); + /** - * Merges a Rectangle with a list of points by repositioning and/or resizing it such that all points are located on or within its bounds. + * @callback EachSetCallback * - * @function Phaser.Geom.Rectangle.MergePoints - * @since 3.0.0 + * @param {E} entry - The Set entry. + * @param {number} index - The index of the entry within the Set. * - * @generic {Phaser.Geom.Rectangle} O - [target,$return] + * @return {?boolean} The callback result. + */ + +/** + * @classdesc + * A Set is a collection of unique elements. * - * @param {Phaser.Geom.Rectangle} target - The Rectangle which should be merged. - * @param {Phaser.Geom.Point[]} points - An array of Points (or any object with public `x` and `y` properties) which should be merged with the Rectangle. + * @class Set + * @memberof Phaser.Structs + * @constructor + * @since 3.0.0 * - * @return {Phaser.Geom.Rectangle} The modified Rectangle. + * @generic T + * @genericUse {T[]} - [elements] + * + * @param {Array.<*>} [elements] - An optional array of elements to insert into this Set. */ -var MergePoints = function (target, points) -{ - var minX = target.x; - var maxX = target.right; - var minY = target.y; - var maxY = target.bottom; +var Set = new Class({ - for (var i = 0; i < points.length; i++) + initialize: + + function Set (elements) { - minX = Math.min(minX, points[i].x); - maxX = Math.max(maxX, points[i].x); - minY = Math.min(minY, points[i].y); - maxY = Math.max(maxY, points[i].y); - } + /** + * The entries of this Set. Stored internally as an array. + * + * @genericUse {T[]} - [$type] + * + * @name Phaser.Structs.Set#entries + * @type {Array.<*>} + * @default [] + * @since 3.0.0 + */ + this.entries = []; - target.x = minX; - target.y = minY; - target.width = maxX - minX; - target.height = maxY - minY; + if (Array.isArray(elements)) + { + for (var i = 0; i < elements.length; i++) + { + this.set(elements[i]); + } + } + }, - return target; -}; + /** + * Inserts the provided value into this Set. If the value is already contained in this Set this method will have no effect. + * + * @method Phaser.Structs.Set#set + * @since 3.0.0 + * + * @genericUse {T} - [value] + * @genericUse {Phaser.Structs.Set.} - [$return] + * + * @param {*} value - The value to insert into this Set. + * + * @return {Phaser.Structs.Set} This Set object. + */ + set: function (value) + { + if (this.entries.indexOf(value) === -1) + { + this.entries.push(value); + } -module.exports = MergePoints; + return this; + }, + /** + * Get an element of this Set which has a property of the specified name, if that property is equal to the specified value. + * If no elements of this Set satisfy the condition then this method will return `null`. + * + * @method Phaser.Structs.Set#get + * @since 3.0.0 + * + * @genericUse {T} - [value,$return] + * + * @param {string} property - The property name to check on the elements of this Set. + * @param {*} value - The value to check for. + * + * @return {*} The first element of this Set that meets the required condition, or `null` if this Set contains no elements that meet the condition. + */ + get: function (property, value) + { + for (var i = 0; i < this.entries.length; i++) + { + var entry = this.entries[i]; -/***/ }), -/* 1284 */ -/***/ (function(module, exports) { + if (entry[property] === value) + { + return entry; + } + } + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Returns an array containing all the values in this Set. + * + * @method Phaser.Structs.Set#getArray + * @since 3.0.0 + * + * @genericUse {T[]} - [$return] + * + * @return {Array.<*>} An array containing all the values in this Set. + */ + getArray: function () + { + return this.entries.slice(0); + }, -// Merges source rectangle into target rectangle and returns target -// Neither rect should have negative widths or heights + /** + * Removes the given value from this Set if this Set contains that value. + * + * @method Phaser.Structs.Set#delete + * @since 3.0.0 + * + * @genericUse {T} - [value] + * @genericUse {Phaser.Structs.Set.} - [$return] + * + * @param {*} value - The value to remove from the Set. + * + * @return {Phaser.Structs.Set} This Set object. + */ + delete: function (value) + { + var index = this.entries.indexOf(value); -/** - * Merges the source rectangle into the target rectangle and returns the target. - * Neither rectangle should have a negative width or height. - * - * @function Phaser.Geom.Rectangle.MergeRect - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [target,$return] - * - * @param {Phaser.Geom.Rectangle} target - Target rectangle. Will be modified to include source rectangle. - * @param {Phaser.Geom.Rectangle} source - Rectangle that will be merged into target rectangle. - * - * @return {Phaser.Geom.Rectangle} Modified target rectangle that contains source rectangle. - */ -var MergeRect = function (target, source) -{ - var minX = Math.min(target.x, source.x); - var maxX = Math.max(target.right, source.right); + if (index > -1) + { + this.entries.splice(index, 1); + } - target.x = minX; - target.width = maxX - minX; + return this; + }, - var minY = Math.min(target.y, source.y); - var maxY = Math.max(target.bottom, source.bottom); + /** + * Dumps the contents of this Set to the console via `console.group`. + * + * @method Phaser.Structs.Set#dump + * @since 3.0.0 + */ + dump: function () + { + // eslint-disable-next-line no-console + console.group('Set'); - target.y = minY; - target.height = maxY - minY; + for (var i = 0; i < this.entries.length; i++) + { + var entry = this.entries[i]; + console.log(entry); + } - return target; -}; + // eslint-disable-next-line no-console + console.groupEnd(); + }, -module.exports = MergeRect; + /** + * Passes each value in this Set to the given callback. + * Use this function when you know this Set will be modified during the iteration, otherwise use `iterate`. + * + * @method Phaser.Structs.Set#each + * @since 3.0.0 + * + * @genericUse {EachSetCallback.} - [callback] + * @genericUse {Phaser.Structs.Set.} - [$return] + * + * @param {EachSetCallback} callback - The callback to be invoked and passed each value this Set contains. + * @param {*} [callbackScope] - The scope of the callback. + * + * @return {Phaser.Structs.Set} This Set object. + */ + each: function (callback, callbackScope) + { + var i; + var temp = this.entries.slice(); + var len = temp.length; + if (callbackScope) + { + for (i = 0; i < len; i++) + { + if (callback.call(callbackScope, temp[i], i) === false) + { + break; + } + } + } + else + { + for (i = 0; i < len; i++) + { + if (callback(temp[i], i) === false) + { + break; + } + } + } -/***/ }), -/* 1285 */ -/***/ (function(module, exports) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Passes each value in this Set to the given callback. + * + * For when you absolutely know this Set won't be modified during the iteration. + * + * The callback must return a boolean. If it returns `false` then it will abort + * the Set iteration immediately. If it returns `true`, it will carry on + * iterating the next child in the Set. + * + * @method Phaser.Structs.Set#iterate + * @since 3.0.0 + * + * @genericUse {EachSetCallback.} - [callback] + * @genericUse {Phaser.Structs.Set.} - [$return] + * + * @param {EachSetCallback} callback - The callback to be invoked and passed each value this Set contains. + * @param {*} [callbackScope] - The scope of the callback. + * + * @return {Phaser.Structs.Set} This Set object. + */ + iterate: function (callback, callbackScope) + { + var i; + var len = this.entries.length; -/** - * Merges a Rectangle with a point by repositioning and/or resizing it so that the point is on or within its bounds. - * - * @function Phaser.Geom.Rectangle.MergeXY - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [target,$return] - * - * @param {Phaser.Geom.Rectangle} target - The Rectangle which should be merged and modified. - * @param {number} x - The X coordinate of the point which should be merged. - * @param {number} y - The Y coordinate of the point which should be merged. - * - * @return {Phaser.Geom.Rectangle} The modified `target` Rectangle. - */ -var MergeXY = function (target, x, y) -{ - var minX = Math.min(target.x, x); - var maxX = Math.max(target.right, x); + if (callbackScope) + { + for (i = 0; i < len; i++) + { + if (callback.call(callbackScope, this.entries[i], i) === false) + { + break; + } + } + } + else + { + for (i = 0; i < len; i++) + { + if (callback(this.entries[i], i) === false) + { + break; + } + } + } - target.x = minX; - target.width = maxX - minX; + return this; + }, - var minY = Math.min(target.y, y); - var maxY = Math.max(target.bottom, y); + /** + * Goes through each entry in this Set and invokes the given function on them, passing in the arguments. + * + * @method Phaser.Structs.Set#iterateLocal + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.Set.} - [$return] + * + * @param {string} callbackKey - The key of the function to be invoked on each Set entry. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + * + * @return {Phaser.Structs.Set} This Set object. + */ + iterateLocal: function (callbackKey) + { + var i; + var args = []; - target.y = minY; - target.height = maxY - minY; + for (i = 1; i < arguments.length; i++) + { + args.push(arguments[i]); + } - return target; -}; + var len = this.entries.length; -module.exports = MergeXY; + for (i = 0; i < len; i++) + { + var entry = this.entries[i]; + entry[callbackKey].apply(entry, args); + } -/***/ }), -/* 1286 */ -/***/ (function(module, exports) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Clears this Set so that it no longer contains any values. + * + * @method Phaser.Structs.Set#clear + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.Set.} - [$return] + * + * @return {Phaser.Structs.Set} This Set object. + */ + clear: function () + { + this.entries.length = 0; -/** - * Nudges (translates) the top left corner of a Rectangle by a given offset. - * - * @function Phaser.Geom.Rectangle.Offset - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [rect,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to adjust. - * @param {number} x - The distance to move the Rectangle horizontally. - * @param {number} y - The distance to move the Rectangle vertically. - * - * @return {Phaser.Geom.Rectangle} The adjusted Rectangle. - */ -var Offset = function (rect, x, y) -{ - rect.x += x; - rect.y += y; + return this; + }, - return rect; -}; + /** + * Returns `true` if this Set contains the given value, otherwise returns `false`. + * + * @method Phaser.Structs.Set#contains + * @since 3.0.0 + * + * @genericUse {T} - [value] + * + * @param {*} value - The value to check for in this Set. + * + * @return {boolean} `true` if the given value was found in this Set, otherwise `false`. + */ + contains: function (value) + { + return (this.entries.indexOf(value) > -1); + }, -module.exports = Offset; + /** + * Returns a new Set containing all values that are either in this Set or in the Set provided as an argument. + * + * @method Phaser.Structs.Set#union + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.Set.} - [set,$return] + * + * @param {Phaser.Structs.Set} set - The Set to perform the union with. + * + * @return {Phaser.Structs.Set} A new Set containing all the values in this Set and the Set provided as an argument. + */ + union: function (set) + { + var newSet = new Set(); + set.entries.forEach(function (value) + { + newSet.set(value); + }); -/***/ }), -/* 1287 */ -/***/ (function(module, exports) { + this.entries.forEach(function (value) + { + newSet.set(value); + }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return newSet; + }, -/** - * Nudges (translates) the top-left corner of a Rectangle by the coordinates of a point (translation vector). - * - * @function Phaser.Geom.Rectangle.OffsetPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [rect,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The Rectangle to adjust. - * @param {(Phaser.Geom.Point|Phaser.Math.Vector2)} point - The point whose coordinates should be used as an offset. - * - * @return {Phaser.Geom.Rectangle} The adjusted Rectangle. - */ -var OffsetPoint = function (rect, point) -{ - rect.x += point.x; - rect.y += point.y; + /** + * Returns a new Set that contains only the values which are in this Set and that are also in the given Set. + * + * @method Phaser.Structs.Set#intersect + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.Set.} - [set,$return] + * + * @param {Phaser.Structs.Set} set - The Set to intersect this set with. + * + * @return {Phaser.Structs.Set} The result of the intersection, as a new Set. + */ + intersect: function (set) + { + var newSet = new Set(); - return rect; -}; + this.entries.forEach(function (value) + { + if (set.contains(value)) + { + newSet.set(value); + } + }); -module.exports = OffsetPoint; + return newSet; + }, + + /** + * Returns a new Set containing all the values in this Set which are *not* also in the given Set. + * + * @method Phaser.Structs.Set#difference + * @since 3.0.0 + * + * @genericUse {Phaser.Structs.Set.} - [set,$return] + * + * @param {Phaser.Structs.Set} set - The Set to perform the difference with. + * + * @return {Phaser.Structs.Set} A new Set containing all the values in this Set that are not also in the Set provided as an argument to this method. + */ + difference: function (set) + { + var newSet = new Set(); + + this.entries.forEach(function (value) + { + if (!set.contains(value)) + { + newSet.set(value); + } + }); + + return newSet; + }, + + /** + * The size of this Set. This is the number of entries within it. + * Changing the size will truncate the Set if the given value is smaller than the current size. + * Increasing the size larger than the current size has no effect. + * + * @name Phaser.Structs.Set#size + * @type {number} + * @since 3.0.0 + */ + size: { + get: function () + { + return this.entries.length; + }, -/***/ }), -/* 1288 */ -/***/ (function(module, exports) { + set: function (value) + { + if (value < this.entries.length) + { + return this.entries.length = value; + } + else + { + return this.entries.length; + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + } -/** - * Checks if two Rectangles overlap. If a Rectangle is within another Rectangle, the two will be considered overlapping. Thus, the Rectangles are treated as "solid". - * - * @function Phaser.Geom.Rectangle.Overlaps - * @since 3.0.0 - * - * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check. - * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check. - * - * @return {boolean} `true` if the two Rectangles overlap, `false` otherwise. - */ -var Overlaps = function (rectA, rectB) -{ - return ( - rectA.x < rectB.right && - rectA.right > rectB.x && - rectA.y < rectB.bottom && - rectA.bottom > rectB.y - ); -}; +}); -module.exports = Overlaps; +module.exports = Set; /***/ }), -/* 1289 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 90881: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Point = __webpack_require__(4); -var DegToRad = __webpack_require__(36); +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var SnapFloor = __webpack_require__(84314); +var Vector2 = __webpack_require__(93736); /** - * Returns a Point from the perimeter of a Rectangle based on the given angle. - * - * @function Phaser.Geom.Rectangle.PerimeterPoint - * @since 3.0.0 + * @classdesc + * The Size component allows you to set `width` and `height` properties and define the relationship between them. * - * @generic {Phaser.Geom.Point} O - [out,$return] + * The component can automatically maintain the aspect ratios between the two values, and clamp them + * to a defined min-max range. You can also control the dominant axis. When dimensions are given to the Size component + * that would cause it to exceed its min-max range, the dimensions are adjusted based on the dominant axis. * - * @param {Phaser.Geom.Rectangle} rectangle - The Rectangle to get the perimeter point from. - * @param {number} angle - The angle of the point, in degrees. - * @param {Phaser.Geom.Point} [out] - The Point object to store the position in. If not given, a new Point instance is created. + * @class Size + * @memberof Phaser.Structs + * @constructor + * @since 3.16.0 * - * @return {Phaser.Geom.Point} A Point object holding the coordinates of the Rectangle perimeter. + * @param {number} [width=0] - The width of the Size component. + * @param {number} [height=width] - The height of the Size component. If not given, it will use the `width`. + * @param {number} [aspectMode=0] - The aspect mode of the Size component. Defaults to 0, no mode. + * @param {any} [parent=null] - The parent of this Size component. Can be any object with public `width` and `height` properties. Dimensions are clamped to keep them within the parent bounds where possible. */ -var PerimeterPoint = function (rectangle, angle, out) -{ - if (out === undefined) { out = new Point(); } - - angle = DegToRad(angle); - - var s = Math.sin(angle); - var c = Math.cos(angle); +var Size = new Class({ - var dx = (c > 0) ? rectangle.width / 2 : rectangle.width / -2; - var dy = (s > 0) ? rectangle.height / 2 : rectangle.height / -2; + initialize: - if (Math.abs(dx * s) < Math.abs(dy * c)) - { - dy = (dx * s) / c; - } - else + function Size (width, height, aspectMode, parent) { - dx = (dy * c) / s; - } + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + if (aspectMode === undefined) { aspectMode = 0; } + if (parent === undefined) { parent = null; } - out.x = dx + rectangle.centerX; - out.y = dy + rectangle.centerY; + /** + * Internal width value. + * + * @name Phaser.Structs.Size#_width + * @type {number} + * @private + * @since 3.16.0 + */ + this._width = width; - return out; -}; + /** + * Internal height value. + * + * @name Phaser.Structs.Size#_height + * @type {number} + * @private + * @since 3.16.0 + */ + this._height = height; -module.exports = PerimeterPoint; + /** + * Internal parent reference. + * + * @name Phaser.Structs.Size#_parent + * @type {any} + * @private + * @since 3.16.0 + */ + this._parent = parent; + /** + * The aspect mode this Size component will use when calculating its dimensions. + * This property is read-only. To change it use the `setAspectMode` method. + * + * @name Phaser.Structs.Size#aspectMode + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.aspectMode = aspectMode; -/***/ }), -/* 1290 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The proportional relationship between the width and height. + * + * This property is read-only and is updated automatically when either the `width` or `height` properties are changed, + * depending on the aspect mode. + * + * @name Phaser.Structs.Size#aspectRatio + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.aspectRatio = (height === 0) ? 1 : width / height; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The minimum allowed width. + * Cannot be less than zero. + * This value is read-only. To change it see the `setMin` method. + * + * @name Phaser.Structs.Size#minWidth + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.minWidth = 0; -var Between = __webpack_require__(195); -var ContainsRect = __webpack_require__(503); -var Point = __webpack_require__(4); + /** + * The minimum allowed height. + * Cannot be less than zero. + * This value is read-only. To change it see the `setMin` method. + * + * @name Phaser.Structs.Size#minHeight + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.minHeight = 0; -/** - * Calculates a random point that lies within the `outer` Rectangle, but outside of the `inner` Rectangle. - * The inner Rectangle must be fully contained within the outer rectangle. - * - * @function Phaser.Geom.Rectangle.RandomOutside - * @since 3.10.0 - * - * @generic {Phaser.Geom.Point} O - [out,$return] - * - * @param {Phaser.Geom.Rectangle} outer - The outer Rectangle to get the random point within. - * @param {Phaser.Geom.Rectangle} inner - The inner Rectangle to exclude from the returned point. - * @param {Phaser.Geom.Point} [out] - A Point, or Point-like object to store the result in. If not specified, a new Point will be created. - * - * @return {Phaser.Geom.Point} A Point object containing the random values in its `x` and `y` properties. - */ -var RandomOutside = function (outer, inner, out) -{ - if (out === undefined) { out = new Point(); } + /** + * The maximum allowed width. + * This value is read-only. To change it see the `setMax` method. + * + * @name Phaser.Structs.Size#maxWidth + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.maxWidth = Number.MAX_VALUE; - if (ContainsRect(outer, inner)) - { - // Pick a random quadrant - // - // The quadrants don't extend the full widths / heights of the outer rect to give - // us a better uniformed distribution, otherwise you get clumping in the corners where - // the 4 quads would overlap + /** + * The maximum allowed height. + * This value is read-only. To change it see the `setMax` method. + * + * @name Phaser.Structs.Size#maxHeight + * @type {number} + * @readonly + * @since 3.16.0 + */ + this.maxHeight = Number.MAX_VALUE; - switch (Between(0, 3)) - { - case 0: // Top - out.x = outer.x + (Math.random() * (inner.right - outer.x)); - out.y = outer.y + (Math.random() * (inner.top - outer.y)); - break; + /** + * A Vector2 containing the horizontal and vertical snap values, which the width and height are snapped to during resizing. + * + * By default this is disabled. + * + * This property is read-only. To change it see the `setSnap` method. + * + * @name Phaser.Structs.Size#snapTo + * @type {Phaser.Math.Vector2} + * @readonly + * @since 3.16.0 + */ + this.snapTo = new Vector2(); + }, - case 1: // Bottom - out.x = inner.x + (Math.random() * (outer.right - inner.x)); - out.y = inner.bottom + (Math.random() * (outer.bottom - inner.bottom)); - break; + /** + * Sets the aspect mode of this Size component. + * + * The aspect mode controls what happens when you modify the `width` or `height` properties, or call `setSize`. + * + * It can be a number from 0 to 4, or a Size constant: + * + * 0. NONE = Do not make the size fit the aspect ratio. Change the ratio when the size changes. + * 1. WIDTH_CONTROLS_HEIGHT = The height is automatically adjusted based on the width. + * 2. HEIGHT_CONTROLS_WIDTH = The width is automatically adjusted based on the height. + * 3. FIT = The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered. + * 4. ENVELOP = The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size. + * + * Calling this method automatically recalculates the `width` and the `height`, if required. + * + * @method Phaser.Structs.Size#setAspectMode + * @since 3.16.0 + * + * @param {number} [value=0] - The aspect mode value. + * + * @return {this} This Size component instance. + */ + setAspectMode: function (value) + { + if (value === undefined) { value = 0; } - case 2: // Left - out.x = outer.x + (Math.random() * (inner.x - outer.x)); - out.y = inner.y + (Math.random() * (outer.bottom - inner.y)); - break; + this.aspectMode = value; - case 3: // Right - out.x = inner.right + (Math.random() * (outer.right - inner.right)); - out.y = outer.y + (Math.random() * (inner.bottom - outer.y)); - break; - } - } + return this.setSize(this._width, this._height); + }, - return out; -}; + /** + * By setting a Snap To value when this Size component is modified its dimensions will automatically + * by snapped to the nearest grid slice, using floor. For example, if you have snap value of 16, + * and the width changes to 68, then it will snap down to 64 (the closest multiple of 16 when floored) + * + * Note that snapping takes place before adjustments by the parent, or the min / max settings. If these + * values are not multiples of the given snap values, then this can result in un-snapped dimensions. + * + * Call this method with no arguments to reset the snap values. + * + * Calling this method automatically recalculates the `width` and the `height`, if required. + * + * @method Phaser.Structs.Size#setSnap + * @since 3.16.0 + * + * @param {number} [snapWidth=0] - The amount to snap the width to. If you don't want to snap the width, pass a value of zero. + * @param {number} [snapHeight=snapWidth] - The amount to snap the height to. If not provided it will use the `snapWidth` value. If you don't want to snap the height, pass a value of zero. + * + * @return {this} This Size component instance. + */ + setSnap: function (snapWidth, snapHeight) + { + if (snapWidth === undefined) { snapWidth = 0; } + if (snapHeight === undefined) { snapHeight = snapWidth; } -module.exports = RandomOutside; + this.snapTo.set(snapWidth, snapHeight); + return this.setSize(this._width, this._height); + }, -/***/ }), -/* 1291 */ -/***/ (function(module, exports) { + /** + * Sets, or clears, the parent of this Size component. + * + * To clear the parent call this method with no arguments. + * + * The parent influences the maximum extents to which this Size component can expand, + * based on the aspect mode: + * + * NONE - The parent clamps both the width and height. + * WIDTH_CONTROLS_HEIGHT - The parent clamps just the width. + * HEIGHT_CONTROLS_WIDTH - The parent clamps just the height. + * FIT - The parent clamps whichever axis is required to ensure the size fits within it. + * ENVELOP - The parent is used to ensure the size fully envelops the parent. + * + * Calling this method automatically calls `setSize`. + * + * @method Phaser.Structs.Size#setParent + * @since 3.16.0 + * + * @param {any} [parent] - Sets the parent of this Size component. Don't provide a value to clear an existing parent. + * + * @return {this} This Size component instance. + */ + setParent: function (parent) + { + this._parent = parent; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this.setSize(this._width, this._height); + }, -/** - * Determines if the two objects (either Rectangles or Rectangle-like) have the same width and height values under strict equality. - * - * @function Phaser.Geom.Rectangle.SameDimensions - * @since 3.15.0 - * - * @param {Phaser.Geom.Rectangle} rect - The first Rectangle object. - * @param {Phaser.Geom.Rectangle} toCompare - The second Rectangle object. - * - * @return {boolean} `true` if the objects have equivalent values for the `width` and `height` properties, otherwise `false`. - */ -var SameDimensions = function (rect, toCompare) -{ - return (rect.width === toCompare.width && rect.height === toCompare.height); -}; + /** + * Set the minimum width and height values this Size component will allow. + * + * The minimum values can never be below zero, or greater than the maximum values. + * + * Setting this will automatically adjust both the `width` and `height` properties to ensure they are within range. + * + * Note that based on the aspect mode, and if this Size component has a parent set or not, the minimums set here + * _can_ be exceed in some situations. + * + * @method Phaser.Structs.Size#setMin + * @since 3.16.0 + * + * @param {number} [width=0] - The minimum allowed width of the Size component. + * @param {number} [height=width] - The minimum allowed height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + setMin: function (width, height) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } -module.exports = SameDimensions; + this.minWidth = Clamp(width, 0, this.maxWidth); + this.minHeight = Clamp(height, 0, this.maxHeight); + return this.setSize(this._width, this._height); + }, -/***/ }), -/* 1292 */ -/***/ (function(module, exports) { + /** + * Set the maximum width and height values this Size component will allow. + * + * Setting this will automatically adjust both the `width` and `height` properties to ensure they are within range. + * + * Note that based on the aspect mode, and if this Size component has a parent set or not, the maximums set here + * _can_ be exceed in some situations. + * + * @method Phaser.Structs.Size#setMax + * @since 3.16.0 + * + * @param {number} [width=Number.MAX_VALUE] - The maximum allowed width of the Size component. + * @param {number} [height=width] - The maximum allowed height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + setMax: function (width, height) + { + if (width === undefined) { width = Number.MAX_VALUE; } + if (height === undefined) { height = width; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.maxWidth = Clamp(width, this.minWidth, Number.MAX_VALUE); + this.maxHeight = Clamp(height, this.minHeight, Number.MAX_VALUE); -// Scales the width and height of this Rectangle by the given amounts. + return this.setSize(this._width, this._height); + }, -/** - * Scales the width and height of this Rectangle by the given amounts. - * - * @function Phaser.Geom.Rectangle.Scale - * @since 3.0.0 - * - * @generic {Phaser.Geom.Rectangle} O - [rect,$return] - * - * @param {Phaser.Geom.Rectangle} rect - The `Rectangle` object that will be scaled by the specified amount(s). - * @param {number} x - The factor by which to scale the rectangle horizontally. - * @param {number} y - The amount by which to scale the rectangle vertically. If this is not specified, the rectangle will be scaled by the factor `x` in both directions. - * - * @return {Phaser.Geom.Rectangle} The rectangle object with updated `width` and `height` properties as calculated from the scaling factor(s). - */ -var Scale = function (rect, x, y) -{ - if (y === undefined) { y = x; } + /** + * Sets the width and height of this Size component based on the aspect mode. + * + * If the aspect mode is 'none' then calling this method will change the aspect ratio, otherwise the current + * aspect ratio is honored across all other modes. + * + * If snapTo values have been set then the given width and height are snapped first, prior to any further + * adjustment via min/max values, or a parent. + * + * If minimum and/or maximum dimensions have been specified, the values given to this method will be clamped into + * that range prior to adjustment, but may still exceed them depending on the aspect mode. + * + * If this Size component has a parent set, and the aspect mode is `fit` or `envelop`, then the given sizes will + * be clamped to the range specified by the parent. + * + * @method Phaser.Structs.Size#setSize + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height=width] - The new height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + setSize: function (width, height) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } - rect.width *= x; - rect.height *= y; + switch (this.aspectMode) + { + case Size.NONE: + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this.aspectRatio = (this._height === 0) ? 1 : this._width / this._height; + break; - return rect; -}; + case Size.WIDTH_CONTROLS_HEIGHT: + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(this._width * (1 / this.aspectRatio), false); + break; -module.exports = Scale; + case Size.HEIGHT_CONTROLS_WIDTH: + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this._width = this.getNewWidth(this._height * this.aspectRatio, false); + break; + case Size.FIT: + this.constrain(width, height, true); + break; -/***/ }), -/* 1293 */ -/***/ (function(module, exports, __webpack_require__) { + case Size.ENVELOP: + this.constrain(width, height, false); + break; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -var Triangle = __webpack_require__(82); + /** + * Sets a new aspect ratio, overriding what was there previously. + * + * It then calls `setSize` immediately using the current dimensions. + * + * @method Phaser.Structs.Size#setAspectRatio + * @since 3.16.0 + * + * @param {number} ratio - The new aspect ratio. + * + * @return {this} This Size component instance. + */ + setAspectRatio: function (ratio) + { + this.aspectRatio = ratio; -Triangle.Area = __webpack_require__(1294); -Triangle.BuildEquilateral = __webpack_require__(1295); -Triangle.BuildFromPolygon = __webpack_require__(1296); -Triangle.BuildRight = __webpack_require__(1297); -Triangle.CenterOn = __webpack_require__(1298); -Triangle.Centroid = __webpack_require__(504); -Triangle.CircumCenter = __webpack_require__(1299); -Triangle.CircumCircle = __webpack_require__(1300); -Triangle.Clone = __webpack_require__(1301); -Triangle.Contains = __webpack_require__(115); -Triangle.ContainsArray = __webpack_require__(235); -Triangle.ContainsPoint = __webpack_require__(1302); -Triangle.CopyFrom = __webpack_require__(1303); -Triangle.Decompose = __webpack_require__(495); -Triangle.Equals = __webpack_require__(1304); -Triangle.GetPoint = __webpack_require__(476); -Triangle.GetPoints = __webpack_require__(477); -Triangle.InCenter = __webpack_require__(506); -Triangle.Perimeter = __webpack_require__(1305); -Triangle.Offset = __webpack_require__(505); -Triangle.Random = __webpack_require__(181); -Triangle.Rotate = __webpack_require__(1306); -Triangle.RotateAroundPoint = __webpack_require__(1307); -Triangle.RotateAroundXY = __webpack_require__(238); + return this.setSize(this._width, this._height); + }, -module.exports = Triangle; + /** + * Sets a new width and height for this Size component and updates the aspect ratio based on them. + * + * It _doesn't_ change the `aspectMode` and still factors in size limits such as the min max and parent bounds. + * + * @method Phaser.Structs.Size#resize + * @since 3.16.0 + * + * @param {number} width - The new width of the Size component. + * @param {number} [height=width] - The new height of the Size component. If not given, it will use the `width`. + * + * @return {this} This Size component instance. + */ + resize: function (width, height) + { + this._width = this.getNewWidth(SnapFloor(width, this.snapTo.x)); + this._height = this.getNewHeight(SnapFloor(height, this.snapTo.y)); + this.aspectRatio = (this._height === 0) ? 1 : this._width / this._height; + return this; + }, -/***/ }), -/* 1294 */ -/***/ (function(module, exports) { + /** + * Takes a new width and passes it through the min/max clamp and then checks it doesn't exceed the parent width. + * + * @method Phaser.Structs.Size#getNewWidth + * @since 3.16.0 + * + * @param {number} value - The value to clamp and check. + * @param {boolean} [checkParent=true] - Check the given value against the parent, if set. + * + * @return {number} The modified width value. + */ + getNewWidth: function (value, checkParent) + { + if (checkParent === undefined) { checkParent = true; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + value = Clamp(value, this.minWidth, this.maxWidth); -// The 2D area of a triangle. The area value is always non-negative. + if (checkParent && this._parent && value > this._parent.width) + { + value = Math.max(this.minWidth, this._parent.width); + } -/** - * Returns the area of a Triangle. - * - * @function Phaser.Geom.Triangle.Area - * @since 3.0.0 - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to use. - * - * @return {number} The area of the Triangle, always non-negative. - */ -var Area = function (triangle) -{ - var x1 = triangle.x1; - var y1 = triangle.y1; + return value; + }, - var x2 = triangle.x2; - var y2 = triangle.y2; + /** + * Takes a new height and passes it through the min/max clamp and then checks it doesn't exceed the parent height. + * + * @method Phaser.Structs.Size#getNewHeight + * @since 3.16.0 + * + * @param {number} value - The value to clamp and check. + * @param {boolean} [checkParent=true] - Check the given value against the parent, if set. + * + * @return {number} The modified height value. + */ + getNewHeight: function (value, checkParent) + { + if (checkParent === undefined) { checkParent = true; } - var x3 = triangle.x3; - var y3 = triangle.y3; + value = Clamp(value, this.minHeight, this.maxHeight); - return Math.abs(((x3 - x1) * (y2 - y1) - (x2 - x1) * (y3 - y1)) / 2); -}; + if (checkParent && this._parent && value > this._parent.height) + { + value = Math.max(this.minHeight, this._parent.height); + } -module.exports = Area; + return value; + }, + /** + * The current `width` and `height` are adjusted to fit inside the given dimensions, while keeping the aspect ratio. + * + * If `fit` is true there may be some space inside the target area which is not covered if its aspect ratio differs. + * If `fit` is false the size may extend further out than the target area if the aspect ratios differ. + * + * If this Size component has a parent set, then the width and height passed to this method will be clamped so + * it cannot exceed that of the parent. + * + * @method Phaser.Structs.Size#constrain + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * @param {boolean} [fit=true] - Perform a `fit` (true) constraint, or an `envelop` (false) constraint. + * + * @return {this} This Size component instance. + */ + constrain: function (width, height, fit) + { + if (width === undefined) { width = 0; } + if (height === undefined) { height = width; } + if (fit === undefined) { fit = true; } -/***/ }), -/* 1295 */ -/***/ (function(module, exports, __webpack_require__) { + width = this.getNewWidth(width); + height = this.getNewHeight(height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var snap = this.snapTo; + var newRatio = (height === 0) ? 1 : width / height; -var Triangle = __webpack_require__(82); + if ((fit && this.aspectRatio > newRatio) || (!fit && this.aspectRatio < newRatio)) + { + // We need to change the height to fit the width -/** - * Builds an equilateral triangle. In the equilateral triangle, all the sides are the same length (congruent) and all the angles are the same size (congruent). - * The x/y specifies the top-middle of the triangle (x1/y1) and length is the length of each side. - * - * @function Phaser.Geom.Triangle.BuildEquilateral - * @since 3.0.0 - * - * @param {number} x - x coordinate of the top point of the triangle. - * @param {number} y - y coordinate of the top point of the triangle. - * @param {number} length - Length of each side of the triangle. - * - * @return {Phaser.Geom.Triangle} The Triangle object of the given size. - */ -var BuildEquilateral = function (x, y, length) -{ - var height = length * (Math.sqrt(3) / 2); + width = SnapFloor(width, snap.x); - var x1 = x; - var y1 = y; + height = width / this.aspectRatio; - var x2 = x + (length / 2); - var y2 = y + height; + if (snap.y > 0) + { + height = SnapFloor(height, snap.y); - var x3 = x - (length / 2); - var y3 = y + height; + // Reduce the width accordingly + width = height * this.aspectRatio; + } + } + else if ((fit && this.aspectRatio < newRatio) || (!fit && this.aspectRatio > newRatio)) + { + // We need to change the width to fit the height - return new Triangle(x1, y1, x2, y2, x3, y3); -}; + height = SnapFloor(height, snap.y); -module.exports = BuildEquilateral; + width = height * this.aspectRatio; + if (snap.x > 0) + { + width = SnapFloor(width, snap.x); -/***/ }), -/* 1296 */ -/***/ (function(module, exports, __webpack_require__) { + // Reduce the height accordingly + height = width * (1 / this.aspectRatio); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this._width = width; + this._height = height; -var EarCut = __webpack_require__(59); -var Triangle = __webpack_require__(82); + return this; + }, -/** - * Takes an array of vertex coordinates, and optionally an array of hole indices, then returns an array - * of Triangle instances, where the given vertices have been decomposed into a series of triangles. - * - * @function Phaser.Geom.Triangle.BuildFromPolygon - * @since 3.0.0 - * - * @generic {Phaser.Geom.Triangle[]} O - [out,$return] - * - * @param {array} data - A flat array of vertex coordinates like [x0,y0, x1,y1, x2,y2, ...] - * @param {array} [holes=null] - An array of hole indices if any (e.g. [5, 8] for a 12-vertex input would mean one hole with vertices 5–7 and another with 8–11). - * @param {number} [scaleX=1] - Horizontal scale factor to multiply the resulting points by. - * @param {number} [scaleY=1] - Vertical scale factor to multiply the resulting points by. - * @param {(array|Phaser.Geom.Triangle[])} [out] - An array to store the resulting Triangle instances in. If not provided, a new array is created. - * - * @return {(array|Phaser.Geom.Triangle[])} An array of Triangle instances, where each triangle is based on the decomposed vertices data. - */ -var BuildFromPolygon = function (data, holes, scaleX, scaleY, out) -{ - if (holes === undefined) { holes = null; } - if (scaleX === undefined) { scaleX = 1; } - if (scaleY === undefined) { scaleY = 1; } - if (out === undefined) { out = []; } + /** + * The current `width` and `height` are adjusted to fit inside the given dimensions, while keeping the aspect ratio. + * + * There may be some space inside the target area which is not covered if its aspect ratio differs. + * + * If this Size component has a parent set, then the width and height passed to this method will be clamped so + * it cannot exceed that of the parent. + * + * @method Phaser.Structs.Size#fitTo + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * + * @return {this} This Size component instance. + */ + fitTo: function (width, height) + { + return this.constrain(width, height, true); + }, - var tris = EarCut(data, holes); + /** + * The current `width` and `height` are adjusted so that they fully envelope the given dimensions, while keeping the aspect ratio. + * + * The size may extend further out than the target area if the aspect ratios differ. + * + * If this Size component has a parent set, then the values are clamped so that it never exceeds the parent + * on the longest axis. + * + * @method Phaser.Structs.Size#envelop + * @since 3.16.0 + * + * @param {number} [width=0] - The new width of the Size component. + * @param {number} [height] - The new height of the Size component. If not given, it will use the width value. + * + * @return {this} This Size component instance. + */ + envelop: function (width, height) + { + return this.constrain(width, height, false); + }, - var a; - var b; - var c; + /** + * Sets the width of this Size component. + * + * Depending on the aspect mode, changing the width may also update the height and aspect ratio. + * + * @method Phaser.Structs.Size#setWidth + * @since 3.16.0 + * + * @param {number} width - The new width of the Size component. + * + * @return {this} This Size component instance. + */ + setWidth: function (value) + { + return this.setSize(value, this._height); + }, - var x1; - var y1; + /** + * Sets the height of this Size component. + * + * Depending on the aspect mode, changing the height may also update the width and aspect ratio. + * + * @method Phaser.Structs.Size#setHeight + * @since 3.16.0 + * + * @param {number} height - The new height of the Size component. + * + * @return {this} This Size component instance. + */ + setHeight: function (value) + { + return this.setSize(this._width, value); + }, - var x2; - var y2; + /** + * Returns a string representation of this Size component. + * + * @method Phaser.Structs.Size#toString + * @since 3.16.0 + * + * @return {string} A string representation of this Size component. + */ + toString: function () + { + return '[{ Size (width=' + this._width + ' height=' + this._height + ' aspectRatio=' + this.aspectRatio + ' aspectMode=' + this.aspectMode + ') }]'; + }, - var x3; - var y3; + /** + * Sets the values of this Size component to the `element.style.width` and `height` + * properties of the given DOM Element. The properties are set as `px` values. + * + * @method Phaser.Structs.Size#setCSS + * @since 3.17.0 + * + * @param {HTMLElement} element - The DOM Element to set the CSS style on. + */ + setCSS: function (element) + { + if (element && element.style) + { + element.style.width = this._width + 'px'; + element.style.height = this._height + 'px'; + } + }, - for (var i = 0; i < tris.length; i += 3) + /** + * Copies the aspect mode, aspect ratio, width and height from this Size component + * to the given Size component. Note that the parent, if set, is not copied across. + * + * @method Phaser.Structs.Size#copy + * @since 3.16.0 + * + * @param {Phaser.Structs.Size} destination - The Size component to copy the values to. + * + * @return {Phaser.Structs.Size} The updated destination Size component. + */ + copy: function (destination) { - a = tris[i]; - b = tris[i + 1]; - c = tris[i + 2]; + destination.setAspectMode(this.aspectMode); - x1 = data[a * 2] * scaleX; - y1 = data[(a * 2) + 1] * scaleY; + destination.aspectRatio = this.aspectRatio; - x2 = data[b * 2] * scaleX; - y2 = data[(b * 2) + 1] * scaleY; + return destination.setSize(this.width, this.height); + }, - x3 = data[c * 2] * scaleX; - y3 = data[(c * 2) + 1] * scaleY; + /** + * Destroys this Size component. + * + * This clears the local properties and any parent object, if set. + * + * A destroyed Size component cannot be re-used. + * + * @method Phaser.Structs.Size#destroy + * @since 3.16.0 + */ + destroy: function () + { + this._parent = null; + this.snapTo = null; + }, - out.push(new Triangle(x1, y1, x2, y2, x3, y3)); - } + /** + * The width of this Size component. + * + * This value is clamped to the range specified by `minWidth` and `maxWidth`, if enabled. + * + * A width can never be less than zero. + * + * Changing this value will automatically update the `height` if the aspect ratio lock is enabled. + * You can also use the `setWidth` and `getWidth` methods. + * + * @name Phaser.Structs.Size#width + * @type {number} + * @since 3.16.0 + */ + width: { - return out; -}; + get: function () + { + return this._width; + }, -module.exports = BuildFromPolygon; + set: function (value) + { + this.setSize(value, this._height); + } + + }, + /** + * The height of this Size component. + * + * This value is clamped to the range specified by `minHeight` and `maxHeight`, if enabled. + * + * A height can never be less than zero. + * + * Changing this value will automatically update the `width` if the aspect ratio lock is enabled. + * You can also use the `setHeight` and `getHeight` methods. + * + * @name Phaser.Structs.Size#height + * @type {number} + * @since 3.16.0 + */ + height: { -/***/ }), -/* 1297 */ -/***/ (function(module, exports, __webpack_require__) { + get: function () + { + return this._height; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + set: function (value) + { + this.setSize(this._width, value); + } -var Triangle = __webpack_require__(82); + } -// Builds a right triangle, with one 90 degree angle and two acute angles -// The x/y is the coordinate of the 90 degree angle (and will map to x1/y1 in the resulting Triangle) -// w/h can be positive or negative and represent the length of each side +}); /** - * Builds a right triangle, i.e. one which has a 90-degree angle and two acute angles. - * - * @function Phaser.Geom.Triangle.BuildRight - * @since 3.0.0 - * - * @param {number} x - The X coordinate of the right angle, which will also be the first X coordinate of the constructed Triangle. - * @param {number} y - The Y coordinate of the right angle, which will also be the first Y coordinate of the constructed Triangle. - * @param {number} width - The length of the side which is to the left or to the right of the right angle. - * @param {number} height - The length of the side which is above or below the right angle. + * Do not make the size fit the aspect ratio. Change the ratio when the size changes. * - * @return {Phaser.Geom.Triangle} The constructed right Triangle. + * @name Phaser.Structs.Size.NONE + * @constant + * @type {number} + * @since 3.16.0 */ -var BuildRight = function (x, y, width, height) -{ - if (height === undefined) { height = width; } - - // 90 degree angle - var x1 = x; - var y1 = y; - - var x2 = x; - var y2 = y - height; - - var x3 = x + width; - var y3 = y; - - return new Triangle(x1, y1, x2, y2, x3, y3); -}; - -module.exports = BuildRight; - - -/***/ }), -/* 1298 */ -/***/ (function(module, exports, __webpack_require__) { +Size.NONE = 0; /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * The height is automatically adjusted based on the width. + * + * @name Phaser.Structs.Size.WIDTH_CONTROLS_HEIGHT + * @constant + * @type {number} + * @since 3.16.0 */ - -var Centroid = __webpack_require__(504); -var Offset = __webpack_require__(505); +Size.WIDTH_CONTROLS_HEIGHT = 1; /** - * @callback CenterFunction - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to return the center coordinates of. + * The width is automatically adjusted based on the height. * - * @return {Phaser.Math.Vector2} The center point of the Triangle according to the function. + * @name Phaser.Structs.Size.HEIGHT_CONTROLS_WIDTH + * @constant + * @type {number} + * @since 3.16.0 */ +Size.HEIGHT_CONTROLS_WIDTH = 2; /** - * Positions the Triangle so that it is centered on the given coordinates. - * - * @function Phaser.Geom.Triangle.CenterOn - * @since 3.0.0 - * - * @generic {Phaser.Geom.Triangle} O - [triangle,$return] - * - * @param {Phaser.Geom.Triangle} triangle - The triangle to be positioned. - * @param {number} x - The horizontal coordinate to center on. - * @param {number} y - The vertical coordinate to center on. - * @param {CenterFunction} [centerFunc] - The function used to center the triangle. Defaults to Centroid centering. + * The width and height are automatically adjusted to fit inside the given target area, while keeping the aspect ratio. Depending on the aspect ratio there may be some space inside the area which is not covered. * - * @return {Phaser.Geom.Triangle} The Triangle that was centered. + * @name Phaser.Structs.Size.FIT + * @constant + * @type {number} + * @since 3.16.0 */ -var CenterOn = function (triangle, x, y, centerFunc) -{ - if (centerFunc === undefined) { centerFunc = Centroid; } - - // Get the center of the triangle - var center = centerFunc(triangle); - - // Difference - var diffX = x - center.x; - var diffY = y - center.y; +Size.FIT = 3; - return Offset(triangle, diffX, diffY); -}; +/** + * The width and height are automatically adjusted to make the size cover the entire target area while keeping the aspect ratio. This may extend further out than the target size. + * + * @name Phaser.Structs.Size.ENVELOP + * @constant + * @type {number} + * @since 3.16.0 + */ +Size.ENVELOP = 4; -module.exports = CenterOn; +module.exports = Size; /***/ }), -/* 1299 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 94160: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Vector2 = __webpack_require__(3); - -// Adapted from http://bjornharrtell.github.io/jsts/doc/api/jsts_geom_Triangle.js.html - /** - * Computes the determinant of a 2x2 matrix. Uses standard double-precision arithmetic, so is susceptible to round-off error. - * - * @function det - * @private - * @since 3.0.0 - * - * @param {number} m00 - The [0,0] entry of the matrix. - * @param {number} m01 - The [0,1] entry of the matrix. - * @param {number} m10 - The [1,0] entry of the matrix. - * @param {number} m11 - The [1,1] entry of the matrix. + * The Process Queue Add Event. * - * @return {number} the determinant. - */ -function det (m00, m01, m10, m11) -{ - return (m00 * m11) - (m01 * m10); -} - -/** - * Computes the circumcentre of a triangle. The circumcentre is the centre of - * the circumcircle, the smallest circle which encloses the triangle. It is also - * the common intersection point of the perpendicular bisectors of the sides of - * the triangle, and is the only point which has equal distance to all three - * vertices of the triangle. + * This event is dispatched by a Process Queue when a new item is successfully moved to its active list. * - * @function Phaser.Geom.Triangle.CircumCenter - * @since 3.0.0 + * You will most commonly see this used by a Scene's Update List when a new Game Object has been added. * - * @generic {Phaser.Math.Vector2} O - [out,$return] + * In that instance, listen to this event from within a Scene using: `this.sys.updateList.on('add', listener)`. * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the circumcenter of. - * @param {Phaser.Math.Vector2} [out] - The Vector2 object to store the position in. If not given, a new Vector2 instance is created. + * @event Phaser.Structs.Events#PROCESS_QUEUE_ADD + * @type {string} + * @since 3.20.0 * - * @return {Phaser.Math.Vector2} A Vector2 object holding the coordinates of the circumcenter of the Triangle. + * @param {*} item - The item that was added to the Process Queue. */ -var CircumCenter = function (triangle, out) -{ - if (out === undefined) { out = new Vector2(); } - - var cx = triangle.x3; - var cy = triangle.y3; - - var ax = triangle.x1 - cx; - var ay = triangle.y1 - cy; - - var bx = triangle.x2 - cx; - var by = triangle.y2 - cy; - - var denom = 2 * det(ax, ay, bx, by); - var numx = det(ay, ax * ax + ay * ay, by, bx * bx + by * by); - var numy = det(ax, ax * ax + ay * ay, bx, bx * bx + by * by); - - out.x = cx - numx / denom; - out.y = cy + numy / denom; - - return out; -}; - -module.exports = CircumCenter; +module.exports = 'add'; /***/ }), -/* 1300 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 95393: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circle = __webpack_require__(65); - -// Adapted from https://gist.github.com/mutoo/5617691 - /** - * Finds the circumscribed circle (circumcircle) of a Triangle object. The circumcircle is the circle which touches all of the triangle's vertices. + * The Process Queue Remove Event. * - * @function Phaser.Geom.Triangle.CircumCircle - * @since 3.0.0 + * This event is dispatched by a Process Queue when a new item is successfully removed from its active list. * - * @generic {Phaser.Geom.Circle} O - [out,$return] + * You will most commonly see this used by a Scene's Update List when a Game Object has been removed. * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to use as input. - * @param {Phaser.Geom.Circle} [out] - An optional Circle to store the result in. + * In that instance, listen to this event from within a Scene using: `this.sys.updateList.on('remove', listener)`. * - * @return {Phaser.Geom.Circle} The updated `out` Circle, or a new Circle if none was provided. + * @event Phaser.Structs.Events#PROCESS_QUEUE_REMOVE + * @type {string} + * @since 3.20.0 + * + * @param {*} item - The item that was removed from the Process Queue. */ -var CircumCircle = function (triangle, out) -{ - if (out === undefined) { out = new Circle(); } - - // A - var x1 = triangle.x1; - var y1 = triangle.y1; +module.exports = 'remove'; - // B - var x2 = triangle.x2; - var y2 = triangle.y2; - // C - var x3 = triangle.x3; - var y3 = triangle.y3; +/***/ }), - var A = x2 - x1; - var B = y2 - y1; - var C = x3 - x1; - var D = y3 - y1; - var E = A * (x1 + x2) + B * (y1 + y2); - var F = C * (x1 + x3) + D * (y1 + y3); - var G = 2 * (A * (y3 - y2) - B * (x3 - x2)); +/***/ 36716: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var dx; - var dy; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // If the points of the triangle are collinear, then just find the - // extremes and use the midpoint as the center of the circumcircle. +/** + * @namespace Phaser.Structs.Events + */ - if (Math.abs(G) < 0.000001) - { - var minX = Math.min(x1, x2, x3); - var minY = Math.min(y1, y2, y3); - dx = (Math.max(x1, x2, x3) - minX) * 0.5; - dy = (Math.max(y1, y2, y3) - minY) * 0.5; +module.exports = { - out.x = minX + dx; - out.y = minY + dy; - out.radius = Math.sqrt(dx * dx + dy * dy); - } - else - { - out.x = (D * E - B * F) / G; - out.y = (A * F - C * E) / G; - dx = out.x - x1; - dy = out.y - y1; - out.radius = Math.sqrt(dx * dx + dy * dy); - } + PROCESS_QUEUE_ADD: __webpack_require__(94160), + PROCESS_QUEUE_REMOVE: __webpack_require__(95393) - return out; }; -module.exports = CircumCircle; - /***/ }), -/* 1301 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 20010: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Triangle = __webpack_require__(82); - /** - * Clones a Triangle object. - * - * @function Phaser.Geom.Triangle.Clone - * @since 3.0.0 - * - * @param {Phaser.Geom.Triangle} source - The Triangle to clone. - * - * @return {Phaser.Geom.Triangle} A new Triangle identical to the given one but separate from it. + * @namespace Phaser.Structs */ -var Clone = function (source) -{ - return new Triangle(source.x1, source.y1, source.x2, source.y2, source.x3, source.y3); -}; -module.exports = Clone; +module.exports = { + + Events: __webpack_require__(36716), + List: __webpack_require__(71207), + Map: __webpack_require__(33885), + ProcessQueue: __webpack_require__(74623), + RTree: __webpack_require__(68687), + Set: __webpack_require__(58403), + Size: __webpack_require__(90881) + +}; /***/ }), -/* 1302 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 17487: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Contains = __webpack_require__(115); +var Class = __webpack_require__(56694); +var Clamp = __webpack_require__(82897); +var Color = __webpack_require__(27119); +var CONST = __webpack_require__(86459); +var IsSizePowerOfTwo = __webpack_require__(28621); +var Texture = __webpack_require__(31673); /** - * Tests if a triangle contains a point. + * @classdesc + * A Canvas Texture is a special kind of Texture that is backed by an HTML Canvas Element as its source. * - * @function Phaser.Geom.Triangle.ContainsPoint - * @since 3.0.0 + * You can use the properties of this texture to draw to the canvas element directly, using all of the standard + * canvas operations available in the browser. Any Game Object can be given this texture and will render with it. * - * @param {Phaser.Geom.Triangle} triangle - The triangle. - * @param {(Phaser.Geom.Point|Phaser.Math.Vector2|any)} point - The point to test, or any point-like object with public `x` and `y` properties. + * Note: When running under WebGL the Canvas Texture needs to re-generate its base WebGLTexture and reupload it to + * the GPU every time you modify it, otherwise the changes you make to this texture will not be visible. To do this + * you should call `CanvasTexture.refresh()` once you are finished with your changes to the canvas. Try and keep + * this to a minimum, especially on large canvas sizes, or you may inadvertently thrash the GPU by constantly uploading + * texture data to it. This restriction does not apply if using the Canvas Renderer. * - * @return {boolean} `true` if the point is within the triangle, otherwise `false`. + * It starts with only one frame that covers the whole of the canvas. You can add further frames, that specify + * sections of the canvas using the `add` method. + * + * Should you need to resize the canvas use the `setSize` method so that it accurately updates all of the underlying + * texture data as well. Forgetting to do this (i.e. by changing the canvas size directly from your code) could cause + * graphical errors. + * + * @class CanvasTexture + * @extends Phaser.Textures.Texture + * @memberof Phaser.Textures + * @constructor + * @since 3.7.0 + * + * @param {Phaser.Textures.TextureManager} manager - A reference to the Texture Manager this Texture belongs to. + * @param {string} key - The unique string-based key of this Texture. + * @param {HTMLCanvasElement} source - The canvas element that is used as the base of this texture. + * @param {number} width - The width of the canvas. + * @param {number} height - The height of the canvas. */ -var ContainsPoint = function (triangle, point) -{ - return Contains(triangle, point.x, point.y); -}; +var CanvasTexture = new Class({ -module.exports = ContainsPoint; + Extends: Texture, + initialize: -/***/ }), -/* 1303 */ -/***/ (function(module, exports) { + function CanvasTexture (manager, key, source, width, height) + { + Texture.call(this, manager, key, source, width, height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.add('__BASE', 0, 0, 0, width, height); -/** - * Copy the values of one Triangle to a destination Triangle. - * - * @function Phaser.Geom.Triangle.CopyFrom - * @since 3.0.0 - * - * @generic {Phaser.Geom.Triangle} O - [dest,$return] - * - * @param {Phaser.Geom.Triangle} source - The source Triangle to copy the values from. - * @param {Phaser.Geom.Triangle} dest - The destination Triangle to copy the values to. - * - * @return {Phaser.Geom.Triangle} The destination Triangle. - */ -var CopyFrom = function (source, dest) -{ - return dest.setTo(source.x1, source.y1, source.x2, source.y2, source.x3, source.y3); -}; + /** + * A reference to the Texture Source of this Canvas. + * + * @name Phaser.Textures.CanvasTexture#_source + * @type {Phaser.Textures.TextureSource} + * @private + * @since 3.7.0 + */ + this._source = this.frames['__BASE'].source; -module.exports = CopyFrom; + /** + * The source Canvas Element. + * + * @name Phaser.Textures.CanvasTexture#canvas + * @readonly + * @type {HTMLCanvasElement} + * @since 3.7.0 + */ + this.canvas = this._source.image; + /** + * The 2D Canvas Rendering Context. + * + * @name Phaser.Textures.CanvasTexture#context + * @readonly + * @type {CanvasRenderingContext2D} + * @since 3.7.0 + */ + this.context = this.canvas.getContext('2d', { willReadFrequently: true }); -/***/ }), -/* 1304 */ -/***/ (function(module, exports) { + /** + * The width of the Canvas. + * This property is read-only, if you wish to change it use the `setSize` method. + * + * @name Phaser.Textures.CanvasTexture#width + * @readonly + * @type {number} + * @since 3.7.0 + */ + this.width = width; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The height of the Canvas. + * This property is read-only, if you wish to change it use the `setSize` method. + * + * @name Phaser.Textures.CanvasTexture#height + * @readonly + * @type {number} + * @since 3.7.0 + */ + this.height = height; -/** - * Returns true if two triangles have the same coordinates. - * - * @function Phaser.Geom.Triangle.Equals - * @since 3.0.0 - * - * @param {Phaser.Geom.Triangle} triangle - The first triangle to check. - * @param {Phaser.Geom.Triangle} toCompare - The second triangle to check. - * - * @return {boolean} `true` if the two given triangles have the exact same coordinates, otherwise `false`. - */ -var Equals = function (triangle, toCompare) -{ - return ( - triangle.x1 === toCompare.x1 && - triangle.y1 === toCompare.y1 && - triangle.x2 === toCompare.x2 && - triangle.y2 === toCompare.y2 && - triangle.x3 === toCompare.x3 && - triangle.y3 === toCompare.y3 - ); -}; + /** + * The context image data. + * Use the `update` method to populate this when the canvas changes. + * + * @name Phaser.Textures.CanvasTexture#imageData + * @type {ImageData} + * @since 3.13.0 + */ + this.imageData = this.context.getImageData(0, 0, width, height); -module.exports = Equals; + /** + * A Uint8ClampedArray view into the `buffer`. + * Use the `update` method to populate this when the canvas changes. + * Note that this is unavailable in some browsers, such as Epic Browser, due to their security restrictions. + * + * @name Phaser.Textures.CanvasTexture#data + * @type {Uint8ClampedArray} + * @since 3.13.0 + */ + this.data = null; + if (this.imageData) + { + this.data = this.imageData.data; + } -/***/ }), -/* 1305 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * An Uint32Array view into the `buffer`. + * + * @name Phaser.Textures.CanvasTexture#pixels + * @type {Uint32Array} + * @since 3.13.0 + */ + this.pixels = null; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * An ArrayBuffer the same size as the context ImageData. + * + * @name Phaser.Textures.CanvasTexture#buffer + * @type {ArrayBuffer} + * @since 3.13.0 + */ + this.buffer; -var Length = __webpack_require__(67); + if (this.data) + { + if (this.imageData.data.buffer) + { + this.buffer = this.imageData.data.buffer; + this.pixels = new Uint32Array(this.buffer); + } + else if (window.ArrayBuffer) + { + this.buffer = new ArrayBuffer(this.imageData.data.length); + this.pixels = new Uint32Array(this.buffer); + } + else + { + this.pixels = this.imageData.data; + } + } + }, -/** - * Gets the length of the perimeter of the given triangle. - * Calculated by adding together the length of each of the three sides. - * - * @function Phaser.Geom.Triangle.Perimeter - * @since 3.0.0 - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to get the length from. - * - * @return {number} The length of the Triangle. - */ -var Perimeter = function (triangle) -{ - var line1 = triangle.getLineA(); - var line2 = triangle.getLineB(); - var line3 = triangle.getLineC(); + /** + * This re-creates the `imageData` from the current context. + * It then re-builds the ArrayBuffer, the `data` Uint8ClampedArray reference and the `pixels` Int32Array. + * + * Warning: This is a very expensive operation, so use it sparingly. + * + * @method Phaser.Textures.CanvasTexture#update + * @since 3.13.0 + * + * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. + */ + update: function () + { + this.imageData = this.context.getImageData(0, 0, this.width, this.height); - return (Length(line1) + Length(line2) + Length(line3)); -}; + this.data = this.imageData.data; -module.exports = Perimeter; + if (this.imageData.data.buffer) + { + this.buffer = this.imageData.data.buffer; + this.pixels = new Uint32Array(this.buffer); + } + else if (window.ArrayBuffer) + { + this.buffer = new ArrayBuffer(this.imageData.data.length); + this.pixels = new Uint32Array(this.buffer); + } + else + { + this.pixels = this.imageData.data; + } + if (this.manager.game.config.renderType === CONST.WEBGL) + { + this.refresh(); + } -/***/ }), -/* 1306 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Draws the given Image or Canvas element to this CanvasTexture, then updates the internal + * ImageData buffer and arrays. + * + * @method Phaser.Textures.CanvasTexture#draw + * @since 3.13.0 + * + * @param {number} x - The x coordinate to draw the source at. + * @param {number} y - The y coordinate to draw the source at. + * @param {(HTMLImageElement|HTMLCanvasElement)} source - The element to draw to this canvas. + * @param {boolean} [update=true] - Update the internal ImageData buffer and arrays. + * + * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. + */ + draw: function (x, y, source, update) + { + if (update === undefined) { update = true; } -var RotateAroundXY = __webpack_require__(238); -var InCenter = __webpack_require__(506); + this.context.drawImage(source, x, y); -/** - * Rotates a Triangle about its incenter, which is the point at which its three angle bisectors meet. - * - * @function Phaser.Geom.Triangle.Rotate - * @since 3.0.0 - * - * @generic {Phaser.Geom.Triangle} O - [triangle,$return] - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. - * @param {number} angle - The angle by which to rotate the Triangle, in radians. - * - * @return {Phaser.Geom.Triangle} The rotated Triangle. - */ -var Rotate = function (triangle, angle) -{ - var point = InCenter(triangle); + if (update) + { + this.update(); + } - return RotateAroundXY(triangle, point.x, point.y, angle); -}; + return this; + }, -module.exports = Rotate; + /** + * Draws the given texture frame to this CanvasTexture, then updates the internal + * ImageData buffer and arrays. + * + * @method Phaser.Textures.CanvasTexture#drawFrame + * @since 3.16.0 + * + * @param {string} key - The unique string-based key of the Texture. + * @param {(string|number)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. + * @param {number} [x=0] - The x coordinate to draw the source at. + * @param {number} [y=0] - The y coordinate to draw the source at. + * @param {boolean} [update=true] - Update the internal ImageData buffer and arrays. + * + * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. + */ + drawFrame: function (key, frame, x, y, update) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (update === undefined) { update = true; } + var textureFrame = this.manager.getFrame(key, frame); -/***/ }), -/* 1307 */ -/***/ (function(module, exports, __webpack_require__) { + if (textureFrame) + { + var cd = textureFrame.canvasData; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var width = textureFrame.cutWidth; + var height = textureFrame.cutHeight; + var res = textureFrame.source.resolution; -var RotateAroundXY = __webpack_require__(238); + this.context.drawImage( + textureFrame.source.image, + cd.x, cd.y, + width, + height, + x, y, + width / res, + height / res + ); -/** - * Rotates a Triangle at a certain angle about a given Point or object with public `x` and `y` properties. - * - * @function Phaser.Geom.Triangle.RotateAroundPoint - * @since 3.0.0 - * - * @generic {Phaser.Geom.Triangle} O - [triangle,$return] - * - * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate. - * @param {Phaser.Geom.Point} point - The Point to rotate the Triangle about. - * @param {number} angle - The angle by which to rotate the Triangle, in radians. - * - * @return {Phaser.Geom.Triangle} The rotated Triangle. - */ -var RotateAroundPoint = function (triangle, point, angle) -{ - return RotateAroundXY(triangle, point.x, point.y, angle); -}; + if (update) + { + this.update(); + } + } -module.exports = RotateAroundPoint; + return this; + }, + /** + * Sets a pixel in the CanvasTexture to the given color and alpha values. + * + * This is an expensive operation to run in large quantities, so use sparingly. + * + * @method Phaser.Textures.CanvasTexture#setPixel + * @since 3.16.0 + * + * @param {number} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} red - The red color value. A number between 0 and 255. + * @param {number} green - The green color value. A number between 0 and 255. + * @param {number} blue - The blue color value. A number between 0 and 255. + * @param {number} [alpha=255] - The alpha value. A number between 0 and 255. + * + * @return {this} This CanvasTexture. + */ + setPixel: function (x, y, red, green, blue, alpha) + { + if (alpha === undefined) { alpha = 255; } -/***/ }), -/* 1308 */ -/***/ (function(module, exports, __webpack_require__) { + x = Math.abs(Math.floor(x)); + y = Math.abs(Math.floor(y)); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var index = this.getIndex(x, y); -var CONST = __webpack_require__(203); -var Extend = __webpack_require__(17); + if (index > -1) + { + var imageData = this.context.getImageData(x, y, 1, 1); -/** - * @namespace Phaser.Input - */ + imageData.data[0] = red; + imageData.data[1] = green; + imageData.data[2] = blue; + imageData.data[3] = alpha; -var Input = { + this.context.putImageData(imageData, x, y); + } - CreatePixelPerfectHandler: __webpack_require__(507), - CreateInteractiveObject: __webpack_require__(508), - Events: __webpack_require__(51), - Gamepad: __webpack_require__(1309), - InputManager: __webpack_require__(409), - InputPlugin: __webpack_require__(1321), - InputPluginCache: __webpack_require__(153), - Keyboard: __webpack_require__(1322), - Mouse: __webpack_require__(1336), - Pointer: __webpack_require__(412), - Touch: __webpack_require__(1337) + return this; + }, -}; + /** + * Puts the ImageData into the context of this CanvasTexture at the given coordinates. + * + * @method Phaser.Textures.CanvasTexture#putData + * @since 3.16.0 + * + * @param {ImageData} imageData - The ImageData to put at the given location. + * @param {number} x - The x coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate to put the imageData. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} [dirtyX=0] - Horizontal position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {number} [dirtyY=0] - Vertical position (x coordinate) of the top-left corner from which the image data will be extracted. + * @param {number} [dirtyWidth] - Width of the rectangle to be painted. Defaults to the width of the image data. + * @param {number} [dirtyHeight] - Height of the rectangle to be painted. Defaults to the height of the image data. + * + * @return {this} This CanvasTexture. + */ + putData: function (imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight) + { + if (dirtyX === undefined) { dirtyX = 0; } + if (dirtyY === undefined) { dirtyY = 0; } + if (dirtyWidth === undefined) { dirtyWidth = imageData.width; } + if (dirtyHeight === undefined) { dirtyHeight = imageData.height; } -// Merge in the consts -Input = Extend(false, Input, CONST); + this.context.putImageData(imageData, x, y, dirtyX, dirtyY, dirtyWidth, dirtyHeight); -module.exports = Input; + return this; + }, + /** + * Gets an ImageData region from this CanvasTexture from the position and size specified. + * You can write this back using `CanvasTexture.putData`, or manipulate it. + * + * @method Phaser.Textures.CanvasTexture#getData + * @since 3.16.0 + * + * @param {number} x - The x coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate of the top-left of the area to get the ImageData from. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} width - The width of the rectangle from which the ImageData will be extracted. Positive values are to the right, and negative to the left. + * @param {number} height - The height of the rectangle from which the ImageData will be extracted. Positive values are down, and negative are up. + * + * @return {ImageData} The ImageData extracted from this CanvasTexture. + */ + getData: function (x, y, width, height) + { + x = Clamp(Math.floor(x), 0, this.width - 1); + y = Clamp(Math.floor(y), 0, this.height - 1); + width = Clamp(width, 1, this.width - x); + height = Clamp(height, 1, this.height - y); -/***/ }), -/* 1309 */ -/***/ (function(module, exports, __webpack_require__) { + var imageData = this.context.getImageData(x, y, width, height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return imageData; + }, -/** - * @namespace Phaser.Input.Gamepad - */ + /** + * Get the color of a specific pixel from this texture and store it in a Color object. + * + * If you have drawn anything to this CanvasTexture since it was created you must call `CanvasTexture.update` to refresh the array buffer, + * otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist. + * + * @method Phaser.Textures.CanvasTexture#getPixel + * @since 3.13.0 + * + * @param {number} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {Phaser.Display.Color} [out] - A Color object to store the pixel values in. If not provided a new Color object will be created. + * + * @return {Phaser.Display.Color} An object with the red, green, blue and alpha values set in the r, g, b and a properties. + */ + getPixel: function (x, y, out) + { + if (!out) + { + out = new Color(); + } -module.exports = { + var index = this.getIndex(x, y); - Axis: __webpack_require__(509), - Button: __webpack_require__(510), - Events: __webpack_require__(239), - Gamepad: __webpack_require__(511), - GamepadPlugin: __webpack_require__(1316), - - Configs: __webpack_require__(1317) -}; + if (index > -1) + { + var data = this.data; + var r = data[index + 0]; + var g = data[index + 1]; + var b = data[index + 2]; + var a = data[index + 3]; -/***/ }), -/* 1310 */ -/***/ (function(module, exports) { + out.setTo(r, g, b, a); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return out; + }, -/** - * The Gamepad Button Down Event. - * - * This event is dispatched by the Gamepad Plugin when a button has been pressed on any active Gamepad. - * - * Listen to this event from within a Scene using: `this.input.gamepad.on('down', listener)`. - * - * You can also listen for a DOWN event from a Gamepad instance. See the [GAMEPAD_BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_DOWN} event for details. - * - * @event Phaser.Input.Gamepad.Events#BUTTON_DOWN - * @since 3.10.0 - * - * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad on which the button was pressed. - * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. - * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. - */ -module.exports = 'down'; + /** + * Returns an array containing all of the pixels in the given region. + * + * If the requested region extends outside the bounds of this CanvasTexture, + * the region is truncated to fit. + * + * If you have drawn anything to this CanvasTexture since it was created you must call `CanvasTexture.update` to refresh the array buffer, + * otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist. + * + * @method Phaser.Textures.CanvasTexture#getPixels + * @since 3.16.0 + * + * @param {number} [x=0] - The x coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} [y=0] - The y coordinate of the top-left of the region. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} [width] - The width of the region to get. Must be an integer. Defaults to the canvas width if not given. + * @param {number} [height] - The height of the region to get. Must be an integer. If not given will be set to the `width`. + * + * @return {Phaser.Types.Textures.PixelConfig[][]} A 2d array of Pixel objects. + */ + getPixels: function (x, y, width, height) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.width; } + if (height === undefined) { height = width; } + x = Math.abs(Math.round(x)); + y = Math.abs(Math.round(y)); -/***/ }), -/* 1311 */ -/***/ (function(module, exports) { + var left = Clamp(x, 0, this.width); + var right = Clamp(x + width, 0, this.width); + var top = Clamp(y, 0, this.height); + var bottom = Clamp(y + height, 0, this.height); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var pixel = new Color(); -/** - * The Gamepad Button Up Event. - * - * This event is dispatched by the Gamepad Plugin when a button has been released on any active Gamepad. - * - * Listen to this event from within a Scene using: `this.input.gamepad.on('up', listener)`. - * - * You can also listen for an UP event from a Gamepad instance. See the [GAMEPAD_BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_UP} event for details. - * - * @event Phaser.Input.Gamepad.Events#BUTTON_UP - * @since 3.10.0 - * - * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad on which the button was released. - * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. - * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. - */ -module.exports = 'up'; + var out = []; + for (var py = top; py < bottom; py++) + { + var row = []; -/***/ }), -/* 1312 */ -/***/ (function(module, exports) { + for (var px = left; px < right; px++) + { + pixel = this.getPixel(px, py, pixel); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + row.push({ x: px, y: py, color: pixel.color, alpha: pixel.alphaGL }); + } -/** - * The Gamepad Connected Event. - * - * This event is dispatched by the Gamepad Plugin when a Gamepad has been connected. - * - * Listen to this event from within a Scene using: `this.input.gamepad.once('connected', listener)`. - * - * Note that the browser may require you to press a button on a gamepad before it will allow you to access it, - * this is for security reasons. However, it may also trust the page already, in which case you won't get the - * 'connected' event and instead should check `GamepadPlugin.total` to see if it thinks there are any gamepads - * already connected. - * - * @event Phaser.Input.Gamepad.Events#CONNECTED - * @since 3.0.0 - * - * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad which was connected. - * @param {Event} event - The native DOM Event that triggered the connection. - */ -module.exports = 'connected'; + out.push(row); + } + return out; + }, -/***/ }), -/* 1313 */ -/***/ (function(module, exports) { + /** + * Returns the Image Data index for the given pixel in this CanvasTexture. + * + * The index can be used to read directly from the `this.data` array. + * + * The index points to the red value in the array. The subsequent 3 indexes + * point to green, blue and alpha respectively. + * + * @method Phaser.Textures.CanvasTexture#getIndex + * @since 3.16.0 + * + * @param {number} x - The x coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * @param {number} y - The y coordinate of the pixel to get. Must lay within the dimensions of this CanvasTexture and be an integer. + * + * @return {number} + */ + getIndex: function (x, y) + { + x = Math.abs(Math.round(x)); + y = Math.abs(Math.round(y)); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (x < this.width && y < this.height) + { + return (x + y * this.width) * 4; + } + else + { + return -1; + } + }, -/** - * The Gamepad Disconnected Event. - * - * This event is dispatched by the Gamepad Plugin when a Gamepad has been disconnected. - * - * Listen to this event from within a Scene using: `this.input.gamepad.once('disconnected', listener)`. - * - * @event Phaser.Input.Gamepad.Events#DISCONNECTED - * @since 3.0.0 - * - * @param {Phaser.Input.Gamepad} pad - A reference to the Gamepad which was disconnected. - * @param {Event} event - The native DOM Event that triggered the disconnection. - */ -module.exports = 'disconnected'; + /** + * This should be called manually if you are running under WebGL. + * It will refresh the WebGLTexture from the Canvas source. Only call this if you know that the + * canvas has changed, as there is a significant GPU texture allocation cost involved in doing so. + * + * @method Phaser.Textures.CanvasTexture#refresh + * @since 3.7.0 + * + * @return {Phaser.Textures.CanvasTexture} This CanvasTexture. + */ + refresh: function () + { + this._source.update(); + return this; + }, -/***/ }), -/* 1314 */ -/***/ (function(module, exports) { + /** + * Gets the Canvas Element. + * + * @method Phaser.Textures.CanvasTexture#getCanvas + * @since 3.7.0 + * + * @return {HTMLCanvasElement} The Canvas DOM element this texture is using. + */ + getCanvas: function () + { + return this.canvas; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Gets the 2D Canvas Rendering Context. + * + * @method Phaser.Textures.CanvasTexture#getContext + * @since 3.7.0 + * + * @return {CanvasRenderingContext2D} The Canvas Rendering Context this texture is using. + */ + getContext: function () + { + return this.context; + }, -/** - * The Gamepad Button Down Event. - * - * This event is dispatched by a Gamepad instance when a button has been pressed on it. - * - * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin: - * `this.input.gamepad.pad1.on('down', listener)`. - * - * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'. - * - * You can also listen for a DOWN event from the Gamepad Plugin. See the [BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_DOWN} event for details. - * - * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_DOWN - * @since 3.10.0 - * - * @param {number} index - The index of the button that was pressed. - * @param {number} value - The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. - * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was pressed. - */ -module.exports = 'down'; + /** + * Clears the given region of this Canvas Texture, resetting it back to transparent. + * If no region is given, the whole Canvas Texture is cleared. + * + * @method Phaser.Textures.CanvasTexture#clear + * @since 3.7.0 + * + * @param {number} [x=0] - The x coordinate of the top-left of the region to clear. + * @param {number} [y=0] - The y coordinate of the top-left of the region to clear. + * @param {number} [width] - The width of the region. + * @param {number} [height] - The height of the region. + * @param {boolean} [update=true] - Update the internal ImageData buffer and arrays. + * + * @return {Phaser.Textures.CanvasTexture} The Canvas Texture. + */ + clear: function (x, y, width, height, update) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.width; } + if (height === undefined) { height = this.height; } + if (update === undefined) { update = true; } + this.context.clearRect(x, y, width, height); -/***/ }), -/* 1315 */ -/***/ (function(module, exports) { + if (update) + { + this.update(); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -/** - * The Gamepad Button Up Event. - * - * This event is dispatched by a Gamepad instance when a button has been released on it. - * - * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin: - * `this.input.gamepad.pad1.on('up', listener)`. - * - * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'. - * - * You can also listen for an UP event from the Gamepad Plugin. See the [BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_UP} event for details. - * - * @event Phaser.Input.Gamepad.Events#GAMEPAD_BUTTON_UP - * @since 3.10.0 - * - * @param {number} index - The index of the button that was released. - * @param {number} value - The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons. - * @param {Phaser.Input.Gamepad.Button} button - A reference to the Button which was released. - */ -module.exports = 'up'; + /** + * Changes the size of this Canvas Texture. + * + * @method Phaser.Textures.CanvasTexture#setSize + * @since 3.7.0 + * + * @param {number} width - The new width of the Canvas. + * @param {number} [height] - The new height of the Canvas. If not given it will use the width as the height. + * + * @return {Phaser.Textures.CanvasTexture} The Canvas Texture. + */ + setSize: function (width, height) + { + if (height === undefined) { height = width; } + + if (width !== this.width || height !== this.height) + { + // Update the Canvas + this.canvas.width = width; + this.canvas.height = height; + + // Update the Texture Source + this._source.width = width; + this._source.height = height; + this._source.isPowerOf2 = IsSizePowerOfTwo(width, height); + + // Update the Frame + this.frames['__BASE'].setSize(width, height, 0, 0); + + // Update this + this.width = width; + this.height = height; + + this.refresh(); + } + + return this; + }, + + /** + * Destroys this Texture and releases references to its sources and frames. + * + * @method Phaser.Textures.CanvasTexture#destroy + * @since 3.16.0 + */ + destroy: function () + { + Texture.prototype.destroy.call(this); + + this._source = null; + this.canvas = null; + this.context = null; + this.imageData = null; + this.data = null; + this.pixels = null; + this.buffer = null; + } + +}); + +module.exports = CanvasTexture; /***/ }), -/* 1316 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 845: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(239); -var Gamepad = __webpack_require__(511); -var GetValue = __webpack_require__(6); -var InputPluginCache = __webpack_require__(153); -var InputEvents = __webpack_require__(51); +var BlendModes = __webpack_require__(95723); +var Camera = __webpack_require__(51052); +var CanvasPool = __webpack_require__(61068); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(86459); +var Frame = __webpack_require__(82047); +var GetFastValue = __webpack_require__(72632); +var PIPELINES = __webpack_require__(65641); +var RenderTarget = __webpack_require__(37410); +var Texture = __webpack_require__(31673); +var Utils = __webpack_require__(75512); /** * @classdesc - * The Gamepad Plugin is an input plugin that belongs to the Scene-owned Input system. - * - * Its role is to listen for native DOM Gamepad Events and then process them. - * - * You do not need to create this class directly, the Input system will create an instance of it automatically. - * - * You can access it from within a Scene using `this.input.gamepad`. - * - * To listen for a gamepad being connected: - * - * ```javascript - * this.input.gamepad.once('connected', function (pad) { - * // 'pad' is a reference to the gamepad that was just connected - * }); - * ``` + * A Dynamic Texture is a special texture that allows you to draw textures, frames and most kind of + * Game Objects directly to it. * - * Note that the browser may require you to press a button on a gamepad before it will allow you to access it, - * this is for security reasons. However, it may also trust the page already, in which case you won't get the - * 'connected' event and instead should check `GamepadPlugin.total` to see if it thinks there are any gamepads - * already connected. + * You can take many complex objects and draw them to this one texture, which can then be used as the + * base texture for other Game Objects, such as Sprites. Should you then update this texture, all + * Game Objects using it will instantly be updated as well, reflecting the changes immediately. * - * Once you have received the connected event, or polled the gamepads and found them enabled, you can access - * them via the built-in properties `GamepadPlugin.pad1` to `pad4`, for up to 4 game pads. With a reference - * to the gamepads you can poll its buttons and axis sticks. See the properties and methods available on - * the `Gamepad` class for more details. + * It's a powerful way to generate dynamic textures at run-time that are WebGL friendly and don't invoke + * expensive GPU uploads on each change. * - * As of September 2020 Chrome, and likely other browsers, will soon start to require that games requesting - * access to the Gamepad API are running under SSL. They will actively block API access if they are not. + * ```js + * const t = this.textures.addDynamicTexture('player', 64, 128); + * // draw objects to t + * this.add.sprite(x, y, 'player'); + * ``` * - * For more information about Gamepad support in browsers see the following resources: + * Because this is a standard Texture within Phaser, you can add frames to it, meaning you can use it + * to generate sprite sheets, texture atlases or tile sets. * - * https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API - * https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API - * https://www.smashingmagazine.com/2015/11/gamepad-api-in-web-games/ - * http://html5gamepad.com/ + * Under WebGL1, a FrameBuffer, which is what this Dynamic Texture uses internally, cannot be anti-aliased. + * This means that when drawing objects such as Shapes or Graphics instances to this texture, they may appear + * to be drawn with no aliasing around the edges. This is a technical limitation of WebGL1. To get around it, + * create your shape as a texture in an art package, then draw that to this texture. * - * @class GamepadPlugin - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Input.Gamepad + * Based on the assumption that you will be using this Dynamic Texture as a source for Sprites, it will + * automatically invert any drawing done to it on the y axis. If you do not require this, please call the + * `setIsSpriteTexture()` method and pass it `false` as its parameter. Do this before you start drawing + * to this texture, otherwise you will get vertically inverted frames under WebGL. This isn't required + * for Canvas. + * + * @class DynamicTexture + * @extends Phaser.Textures.Texture + * @memberof Phaser.Textures * @constructor - * @since 3.10.0 + * @since 3.60.0 * - * @param {Phaser.Input.InputPlugin} sceneInputPlugin - A reference to the Scene Input Plugin that the KeyboardPlugin belongs to. + * @param {Phaser.Textures.TextureManager} manager - A reference to the Texture Manager this Texture belongs to. + * @param {string} key - The unique string-based key of this Texture. + * @param {number} [width=256] - The width of this Dymamic Texture in pixels. Defaults to 256 x 256. + * @param {number} [height=256] - The height of this Dymamic Texture in pixels. Defaults to 256 x 256. */ -var GamepadPlugin = new Class({ +var DynamicTexture = new Class({ - Extends: EventEmitter, + Extends: Texture, initialize: - function GamepadPlugin (sceneInputPlugin) + function DynamicTexture (manager, key, width, height) { - EventEmitter.call(this); + if (width === undefined) { width = 256; } + if (height === undefined) { height = 256; } /** - * A reference to the Scene that this Input Plugin is responsible for. + * The internal data type of this object. * - * @name Phaser.Input.Gamepad.GamepadPlugin#scene - * @type {Phaser.Scene} - * @since 3.10.0 + * @name Phaser.Textures.DynamicTexture#type + * @type {string} + * @readonly + * @since 3.60.0 */ - this.scene = sceneInputPlugin.scene; + this.type = 'DynamicTexture'; - /** - * A reference to the Scene Systems Settings. - * - * @name Phaser.Input.Gamepad.GamepadPlugin#settings - * @type {Phaser.Types.Scenes.SettingsObject} - * @since 3.10.0 - */ - this.settings = this.scene.sys.settings; + var renderer = manager.game.renderer; + + var isCanvas = (renderer && renderer.type === CONST.CANVAS); + + var source = (isCanvas) ? CanvasPool.create2D(this, width, height) : [ this ]; + + Texture.call(this, manager, key, source, width, height); + + this.add('__BASE', 0, 0, 0, width, height); /** - * A reference to the Scene Input Plugin that created this Keyboard Plugin. + * A reference to either the Canvas or WebGL Renderer that the Game instance is using. * - * @name Phaser.Input.Gamepad.GamepadPlugin#sceneInputPlugin - * @type {Phaser.Input.InputPlugin} - * @since 3.10.0 + * @name Phaser.Textures.DynamicTexture#renderer + * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} + * @since 3.2.0 */ - this.sceneInputPlugin = sceneInputPlugin; + this.renderer = renderer; /** - * A boolean that controls if the Gamepad Manager is enabled or not. - * Can be toggled on the fly. + * This flag is set to 'true' during `beginDraw` and reset to 'false` in `endDraw`, + * allowing you to determine if this Dynamic Texture is batch drawing, or not. * - * @name Phaser.Input.Gamepad.GamepadPlugin#enabled + * @name Phaser.Textures.DynamicTexture#isDrawing * @type {boolean} - * @default true - * @since 3.10.0 + * @readonly + * @since 3.60.0 */ - this.enabled = true; + this.isDrawing = false; /** - * The Gamepad Event target, as defined in the Game Config. - * Typically the browser window, but can be any interactive DOM element. + * A reference to the Rendering Context belonging to the Canvas Element this Dynamic Texture is drawing to. * - * @name Phaser.Input.Gamepad.GamepadPlugin#target - * @type {any} - * @since 3.10.0 + * @name Phaser.Textures.DynamicTexture#canvas + * @type {HTMLCanvasElement} + * @since 3.2.0 */ - this.target; + this.canvas = (isCanvas) ? source : null; /** - * An array of the connected Gamepads. + * The 2D Canvas Rendering Context. * - * @name Phaser.Input.Gamepad.GamepadPlugin#gamepads - * @type {Phaser.Input.Gamepad.Gamepad[]} - * @default [] - * @since 3.10.0 + * @name Phaser.Textures.DynamicTexture#context + * @readonly + * @type {CanvasRenderingContext2D} + * @since 3.7.0 */ - this.gamepads = []; + this.context = (isCanvas) ? source.getContext('2d', { willReadFrequently: true }) : null; /** - * An internal event queue. + * Is this Dynamic Texture dirty or not? If not it won't spend time clearing or filling itself. * - * @name Phaser.Input.Gamepad.GamepadPlugin#queue - * @type {GamepadEvent[]} - * @private - * @since 3.10.0 + * @name Phaser.Textures.DynamicTexture#dirty + * @type {boolean} + * @since 3.12.0 */ - this.queue = []; + this.dirty = false; /** - * Internal event handler. + * Is this Dynamic Texture being used as the base texture for a Sprite Game Object? * - * @name Phaser.Input.Gamepad.GamepadPlugin#onGamepadHandler - * @type {function} - * @private - * @since 3.10.0 + * This is enabled by default, as we expect that will be the core use for Dynamic Textures. + * + * However, to disable it, call `RenderTexture.setIsSpriteTexture(false)`. + * + * You should do this _before_ drawing to this texture, so that it correctly + * inverses the frames for WebGL rendering. Not doing so will result in vertically flipped frames. + * + * This property is used in the `endDraw` method. + * + * @name Phaser.Textures.DynamicTexture#isSpriteTexture + * @type {boolean} + * @since 3.60.0 */ - this.onGamepadHandler; + this.isSpriteTexture = true; /** - * Internal Gamepad reference. + * Internal erase mode flag. * - * @name Phaser.Input.Gamepad.GamepadPlugin#_pad1 - * @type {Phaser.Input.Gamepad.Gamepad} + * @name Phaser.Textures.DynamicTexture#_eraseMode + * @type {boolean} * @private - * @since 3.10.0 + * @since 3.16.0 */ - this._pad1; + this._eraseMode = false; /** - * Internal Gamepad reference. + * An internal Camera that can be used to move around this Dynamic Texture. * - * @name Phaser.Input.Gamepad.GamepadPlugin#_pad2 - * @type {Phaser.Input.Gamepad.Gamepad} - * @private - * @since 3.10.0 + * Control it just like you would any Scene Camera. The difference is that it only impacts + * the placement of **Game Objects** (not textures) that you then draw to this texture. + * + * You can scroll, zoom and rotate this Camera. + * + * @name Phaser.Textures.DynamicTexture#camera + * @type {Phaser.Cameras.Scene2D.BaseCamera} + * @since 3.12.0 */ - this._pad2; + this.camera = new Camera(0, 0, width, height).setScene(manager.game.scene.systemScene, false); /** - * Internal Gamepad reference. + * The Render Target that belongs to this Dynamic Texture. * - * @name Phaser.Input.Gamepad.GamepadPlugin#_pad3 - * @type {Phaser.Input.Gamepad.Gamepad} - * @private - * @since 3.10.0 + * A Render Target encapsulates a framebuffer and texture for the WebGL Renderer. + * + * This property remains `null` under Canvas. + * + * @name Phaser.Textures.DynamicTexture#renderTarget + * @type {Phaser.Renderer.WebGL.RenderTarget} + * @since 3.60.0 */ - this._pad3; + this.renderTarget = (!isCanvas) ? new RenderTarget(renderer, width, height, 1, 0, false, true, true, false) : null; /** - * Internal Gamepad reference. + * A reference to the WebGL Single Pipeline. * - * @name Phaser.Input.Gamepad.GamepadPlugin#_pad4 - * @type {Phaser.Input.Gamepad.Gamepad} - * @private - * @since 3.10.0 + * This property remains `null` under Canvas. + * + * @name Phaser.Textures.DynamicTexture#pipeline + * @type {Phaser.Renderer.WebGL.Pipelines.SinglePipeline} + * @since 3.60.0 */ - this._pad4; + this.pipeline = (!isCanvas) ? renderer.pipelines.get(PIPELINES.SINGLE_PIPELINE) : null; - sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this); - sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this); + this.setSize(width, height); }, /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. + * Resizes this Dynamic Texture to the new dimensions given. * - * @method Phaser.Input.Gamepad.GamepadPlugin#boot - * @private + * In WebGL it will destroy and then re-create the frame buffer being used by this Dynamic Texture. + * In Canvas it will resize the underlying canvas DOM element. + * + * Both approaches will erase everything currently drawn to this texture. + * + * If the dimensions given are the same as those already being used, calling this method will do nothing. + * + * @method Phaser.Textures.DynamicTexture#setSize * @since 3.10.0 + * + * @param {number} width - The new width of this Dynamic Texture. + * @param {number} [height=width] - The new height of this Dynamic Texture. If not specified, will be set the same as the `width`. + * + * @return {this} This Dynamic Texture. */ - boot: function () + setSize: function (width, height) { - var game = this.scene.sys.game; - var settings = this.settings.input; - var config = game.config; + if (height === undefined) { height = width; } - this.enabled = GetValue(settings, 'gamepad', config.inputGamepad) && game.device.input.gamepads; - this.target = GetValue(settings, 'gamepad.target', config.inputGamepadEventTarget); + var frame = this.get(); + var source = frame.source; - this.sceneInputPlugin.pluginEvents.once(InputEvents.DESTROY, this.destroy, this); + if (width !== this.width || height !== this.height) + { + if (this.canvas) + { + this.canvas.width = width; + this.canvas.height = height; + } + + var renderTarget = this.renderTarget; + + if (renderTarget) + { + renderTarget.resize(width, height); + + frame.glTexture = renderTarget.texture; + + source.isRenderTexture = true; + source.isGLTexture = true; + source.glTexture = renderTarget.texture; + source.glTexture.flipY = true; + } + + this.camera.setSize(width, height); + + source.width = width; + source.height = height; + + frame.setSize(width, height); + + this.width = width; + this.height = height; + } + else + { + // Resize the frame + var baseFrame = this.getSourceImage(); + + if (frame.cutX + width > baseFrame.width) + { + width = baseFrame.width - frame.cutX; + } + + if (frame.cutY + height > baseFrame.height) + { + height = baseFrame.height - frame.cutY; + } + + frame.setSize(width, height, frame.cutX, frame.cutY); + } + + return this; }, /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. + * If you are planning on using this Render Texture as a base texture for Sprite + * Game Objects, then you should call this method with a value of `true` before + * drawing anything to it, otherwise you will get inverted frames in WebGL. * - * @method Phaser.Input.Gamepad.GamepadPlugin#start - * @private - * @since 3.10.0 + * @method Phaser.Textures.DynamicTexture#setIsSpriteTexture + * @since 3.60.0 + * + * @param {boolean} value - Is this Render Target being used as a Sprite Texture, or not? + * + * @return {this} This Game Object instance. */ - start: function () + setIsSpriteTexture: function (value) { - if (this.enabled) + this.isSpriteTexture = value; + + return this; + }, + + /** + * Fills this Dynamic Texture with the given color. + * + * By default it will fill the entire texture, however you can set it to fill a specific + * rectangular area by using the x, y, width and height arguments. + * + * The color should be given in hex format, i.e. 0xff0000 for red, 0x00ff00 for green, etc. + * + * @method Phaser.Textures.DynamicTexture#fill + * @since 3.2.0 + * + * @param {number} rgb - The color to fill this Dynamic Texture with, such as 0xff0000 for red. + * @param {number} [alpha=1] - The alpha value used by the fill. + * @param {number} [x=0] - The left coordinate of the fill rectangle. + * @param {number} [y=0] - The top coordinate of the fill rectangle. + * @param {number} [width=this.width] - The width of the fill rectangle. + * @param {number} [height=this.height] - The height of the fill rectangle. + * + * @return {this} This Dynamic Texture instance. + */ + fill: function (rgb, alpha, x, y, width, height) + { + var camera = this.camera; + var renderer = this.renderer; + + if (alpha === undefined) { alpha = 1; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.width; } + if (height === undefined) { height = this.height; } + + var r = (rgb >> 16 & 0xFF); + var g = (rgb >> 8 & 0xFF); + var b = (rgb & 0xFF); + + var renderTarget = this.renderTarget; + + camera.preRender(); + + if (renderTarget) { - this.startListeners(); + renderTarget.bind(true); - this.refreshPads(); + var pipeline = this.pipeline.manager.set(this.pipeline); + + var sx = renderer.width / renderTarget.width; + var sy = renderer.height / renderTarget.height; + + pipeline.drawFillRect( + x * sx, y * sy, width * sx, height * sy, + Utils.getTintFromFloats(b / 255, g / 255, r / 255, 1), + alpha + ); + + renderTarget.unbind(true); } + else + { + var ctx = this.context; - this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); + renderer.setContext(ctx); + + ctx.globalCompositeOperation = 'source-over'; + ctx.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + alpha + ')'; + ctx.fillRect(x, y, width, height); + + renderer.setContext(); + } + + this.dirty = true; + + return this; }, /** - * Checks to see if both this plugin and the Scene to which it belongs is active. + * Fully clears this Dynamic Texture, erasing everything from it and resetting it back to + * a blank, transparent, texture. * - * @method Phaser.Input.Gamepad.GamepadPlugin#isActive - * @since 3.10.0 + * @method Phaser.Textures.DynamicTexture#clear + * @since 3.2.0 * - * @return {boolean} `true` if the plugin and the Scene it belongs to is active. + * @return {this} This Dynamic Texture instance. */ - isActive: function () + clear: function () { - return (this.enabled && this.scene.sys.isActive()); + if (this.dirty) + { + var ctx = this.context; + var renderTarget = this.renderTarget; + + if (renderTarget) + { + renderTarget.clear(); + } + else if (ctx) + { + ctx.save(); + ctx.setTransform(1, 0, 0, 1, 0, 0); + ctx.clearRect(0, 0, this.width, this.height); + ctx.restore(); + } + + this.dirty = false; + } + + return this; }, /** - * Starts the Gamepad Event listeners running. - * This is called automatically and does not need to be manually invoked. + * Takes the given texture key and frame and then stamps it at the given + * x and y coordinates. You can use the optional 'config' argument to provide + * lots more options about how the stamp is applied, including the alpha, + * tint, angle, scale and origin. * - * @method Phaser.Input.Gamepad.GamepadPlugin#startListeners - * @private - * @since 3.10.0 + * By default, the frame will stamp on the x/y coordinates based on its center. + * + * If you wish to stamp from the top-left, set the config `originX` and + * `originY` properties both to zero. + * + * @method Phaser.Textures.DynamicTexture#stamp + * @since 3.60.0 + * + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. Set to `null` to skip this argument if not required. + * @param {number} [x=0] - The x position to draw the frame at. + * @param {number} [y=0] - The y position to draw the frame at. + * @param {Phaser.Types.Textures.StampConfig} [config] - The stamp configuration object, allowing you to set the alpha, tint, angle, scale and origin of the stamp. + * + * @return {this} This Dynamic Texture instance. */ - startListeners: function () + stamp: function (key, frame, x, y, config) { - var _this = this; - var target = this.target; + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } - var handler = function (event) - { - if (event.defaultPrevented || !_this.isActive()) - { - // Do nothing if event already handled - return; - } + var alpha = GetFastValue(config, 'alpha', 1); + var tint = GetFastValue(config, 'tint', 0xffffff); + var angle = GetFastValue(config, 'angle', 0); + var rotation = GetFastValue(config, 'rotation', 0); + var scale = GetFastValue(config, 'scale', 1); + var scaleX = GetFastValue(config, 'scaleX', scale); + var scaleY = GetFastValue(config, 'scaleY', scale); + var originX = GetFastValue(config, 'originX', 0.5); + var originY = GetFastValue(config, 'originY', 0.5); + var blendMode = GetFastValue(config, 'blendMode', 0); + var erase = GetFastValue(config, 'erase', false); + var skipBatch = GetFastValue(config, 'skipBatch', false); - _this.refreshPads(); + var stamp = this.manager.resetStamp(alpha, tint); - _this.queue.push(event); - }; + stamp.setAngle(0); - this.onGamepadHandler = handler; + if (angle !== 0) + { + stamp.setAngle(angle); + } + else if (rotation !== 0) + { + stamp.setRotation(rotation); + } - target.addEventListener('gamepadconnected', handler, false); - target.addEventListener('gamepaddisconnected', handler, false); + stamp.setScale(scaleX, scaleY); + stamp.setTexture(key, frame); + stamp.setOrigin(originX, originY); + stamp.setBlendMode(blendMode); - // FF also supports gamepadbuttondown, gamepadbuttonup and gamepadaxismove but - // nothing else does, and we can get those values via the gamepads anyway, so we will - // until more browsers support this + if (erase) + { + this._eraseMode = true; + } - // Finally, listen for an update event from the Input Plugin - this.sceneInputPlugin.pluginEvents.on(InputEvents.UPDATE, this.update, this); + if (!skipBatch) + { + this.draw(stamp, x, y); + } + else + { + this.batchGameObject(stamp, x, y); + } + + if (erase) + { + this._eraseMode = false; + } + + return this; }, /** - * Stops the Gamepad Event listeners. - * This is called automatically and does not need to be manually invoked. + * Draws the given object, or an array of objects, to this Dynamic Texture using a blend mode of ERASE. + * This has the effect of erasing any filled pixels present in the objects from this texture. * - * @method Phaser.Input.Gamepad.GamepadPlugin#stopListeners - * @private - * @since 3.10.0 + * It can accept any of the following: + * + * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite. + * * Tilemap Layers. + * * A Group. The contents of which will be iterated and drawn in turn. + * * A Container. The contents of which will be iterated fully, and drawn in turn. + * * A Scene Display List. Pass in `Scene.children` to draw the whole list. + * * Another Dynamic Texture, or a Render Texture. + * * A Texture Frame instance. + * * A string. This is used to look-up the texture from the Texture Manager. + * + * Note: You cannot erase a Dynamic Texture from itself. + * + * If passing in a Group or Container it will only draw children that return `true` + * when their `willRender()` method is called. I.e. a Container with 10 children, + * 5 of which have `visible=false` will only draw the 5 visible ones. + * + * If passing in an array of Game Objects it will draw them all, regardless if + * they pass a `willRender` check or not. + * + * You can pass in a string in which case it will look for a texture in the Texture + * Manager matching that string, and draw the base frame. + * + * You can pass in the `x` and `y` coordinates to draw the objects at. The use of + * the coordinates differ based on what objects are being drawn. If the object is + * a Group, Container or Display List, the coordinates are _added_ to the positions + * of the children. For all other types of object, the coordinates are exact. + * + * Calling this method causes the WebGL batch to flush, so it can write the texture + * data to the framebuffer being used internally. The batch is flushed at the end, + * after the entries have been iterated. So if you've a bunch of objects to draw, + * try and pass them in an array in one single call, rather than making lots of + * separate calls. + * + * If you are not planning on using this Dynamic Texture as a base texture for Sprite + * Game Objects, then you should set `DynamicTexture.isSpriteTexture = false` before + * calling this method, otherwise you will get vertically inverted frames in WebGL. + * + * @method Phaser.Textures.DynamicTexture#erase + * @since 3.16.0 + * + * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, Render Texture, Texture Frame, or an array of any of these. + * @param {number} [x=0] - The x position to draw the Frame at, or the offset applied to the object. + * @param {number} [y=0] - The y position to draw the Frame at, or the offset applied to the object. + * + * @return {this} This Dynamic Texture instance. */ - stopListeners: function () + erase: function (entries, x, y) { - this.target.removeEventListener('gamepadconnected', this.onGamepadHandler); - this.target.removeEventListener('gamepaddisconnected', this.onGamepadHandler); + this._eraseMode = true; - this.sceneInputPlugin.pluginEvents.off(InputEvents.UPDATE, this.update); + this.draw(entries, x, y); - for (var i = 0; i < this.gamepads.length; i++) - { - this.gamepads[i].removeAllListeners(); - } + this._eraseMode = false; + + return this; }, /** - * Disconnects all current Gamepads. + * Draws the given object, or an array of objects, to this Dynamic Texture. * - * @method Phaser.Input.Gamepad.GamepadPlugin#disconnectAll - * @since 3.10.0 + * It can accept any of the following: + * + * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite. + * * Tilemap Layers. + * * A Group. The contents of which will be iterated and drawn in turn. + * * A Container. The contents of which will be iterated fully, and drawn in turn. + * * A Scene Display List. Pass in `Scene.children` to draw the whole list. + * * Another Dynamic Texture, or a Render Texture. + * * A Texture Frame instance. + * * A string. This is used to look-up the texture from the Texture Manager. + * + * Note 1: You cannot draw a Dynamic Texture to itself. + * + * Note 2: For Game Objects that have Post FX Pipelines, the pipeline _cannot_ be + * used when drawn to this texture. + * + * If passing in a Group or Container it will only draw children that return `true` + * when their `willRender()` method is called. I.e. a Container with 10 children, + * 5 of which have `visible=false` will only draw the 5 visible ones. + * + * If passing in an array of Game Objects it will draw them all, regardless if + * they pass a `willRender` check or not. + * + * You can pass in a string in which case it will look for a texture in the Texture + * Manager matching that string, and draw the base frame. If you need to specify + * exactly which frame to draw then use the method `drawFrame` instead. + * + * You can pass in the `x` and `y` coordinates to draw the objects at. The use of + * the coordinates differ based on what objects are being drawn. If the object is + * a Group, Container or Display List, the coordinates are _added_ to the positions + * of the children. For all other types of object, the coordinates are exact. + * + * The `alpha` and `tint` values are only used by Texture Frames. + * Game Objects use their own alpha and tint values when being drawn. + * + * Calling this method causes the WebGL batch to flush, so it can write the texture + * data to the framebuffer being used internally. The batch is flushed at the end, + * after the entries have been iterated. So if you've a bunch of objects to draw, + * try and pass them in an array in one single call, rather than making lots of + * separate calls. + * + * If you are not planning on using this Dynamic Texture as a base texture for Sprite + * Game Objects, then you should set `DynamicTexture.isSpriteTexture = false` before + * calling this method, otherwise you will get vertically inverted frames in WebGL. + * + * @method Phaser.Textures.DynamicTexture#draw + * @since 3.2.0 + * + * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, other Render Texture, Texture Frame or an array of any of these. + * @param {number} [x=0] - The x position to draw the Frame at, or the offset applied to the object. + * @param {number} [y=0] - The y position to draw the Frame at, or the offset applied to the object. + * @param {number} [alpha=1] - The alpha value. Only used when drawing Texture Frames to this texture. Game Objects use their own alpha. + * @param {number} [tint=0xffffff] - The tint color value. Only used when drawing Texture Frames to this texture. Game Objects use their own tint. WebGL only. + * + * @return {this} This Dynamic Texture instance. */ - disconnectAll: function () + draw: function (entries, x, y, alpha, tint) { - for (var i = 0; i < this.gamepads.length; i++) - { - this.gamepads[i].pad.connected = false; - } + this.beginDraw(); + this.batchDraw(entries, x, y, alpha, tint); + this.endDraw(); + + return this; }, /** - * Refreshes the list of connected Gamepads. + * Draws the Texture Frame to the Render Texture at the given position. * - * This is called automatically when a gamepad is connected or disconnected, - * and during the update loop. + * Textures are referenced by their string-based keys, as stored in the Texture Manager. * - * @method Phaser.Input.Gamepad.GamepadPlugin#refreshPads - * @private - * @since 3.10.0 + * ```javascript + * var rt = this.add.renderTexture(0, 0, 800, 600); + * rt.drawFrame(key, frame); + * ``` + * + * You can optionally provide a position, alpha and tint value to apply to the frame + * before it is drawn. + * + * Calling this method will cause a batch flush, so if you've got a stack of things to draw + * in a tight loop, try using the `draw` method instead. + * + * If you need to draw a Sprite to this Render Texture, use the `draw` method instead. + * + * If you are not planning on using this Dynamic Texture as a base texture for Sprite + * Game Objects, then you should set `DynamicTexture.isSpriteTexture = false` before + * calling this method, otherwise you will get vertically inverted frames in WebGL. + * + * @method Phaser.Textures.DynamicTexture#drawFrame + * @since 3.12.0 + * + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. Set to `null` to skip this argument if not required. + * @param {number} [x=0] - The x position to draw the frame at. + * @param {number} [y=0] - The y position to draw the frame at. + * @param {number} [alpha=1] - The alpha value. Only used when drawing Texture Frames to this texture. + * @param {number} [tint=0xffffff] - The tint color value. Only used when drawing Texture Frames to this texture. WebGL only. + * + * @return {this} This Dynamic Texture instance. */ - refreshPads: function () + drawFrame: function (key, frame, x, y, alpha, tint) { - var connectedPads = navigator.getGamepads(); + this.beginDraw(); + this.batchDrawFrame(key, frame, x, y, alpha, tint); + this.endDraw(); - if (!connectedPads) + return this; + }, + + /** + * Takes the given Texture Frame and draws it to this Dynamic Texture as a fill pattern, + * i.e. in a grid-layout based on the frame dimensions. + * + * Textures are referenced by their string-based keys, as stored in the Texture Manager. + * + * You can optionally provide a position, width, height, alpha and tint value to apply to + * the frames before they are drawn. The position controls the top-left where the repeating + * fill will start from. The width and height control the size of the filled area. + * + * The position can be negative if required, but the dimensions cannot. + * + * Calling this method will cause a batch flush by default. Use the `skipBatch` argument + * to disable this if this call is part of a larger batch draw. + * + * If you are not planning on using this Dynamic Texture as a base texture for Sprite + * Game Objects, then you should set `DynamicTexture.isSpriteTexture = false` before + * calling this method, otherwise you will get vertically inverted frames in WebGL. + * + * @method Phaser.Textures.DynamicTexture#repeat + * @since 3.60.0 + * + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. Set to `null` to skip this argument if not required. + * @param {number} [x=0] - The x position to start drawing the frames from (can be negative to offset). + * @param {number} [y=0] - The y position to start drawing the frames from (can be negative to offset). + * @param {number} [width=this.width] - The width of the area to repeat the frame within. Defaults to the width of this Dynamic Texture. + * @param {number} [height=this.height] - The height of the area to repeat the frame within. Defaults to the height of this Dynamic Texture. + * @param {number} [alpha=1] - The alpha to use. Defaults to 1, no alpha. + * @param {number} [tint=0xffffff] - WebGL only. The tint color to use. Leave as undefined, or 0xffffff to have no tint. + * @param {boolean} [skipBatch=false] - Skip beginning and ending a batch with this call. Use if this is part of a bigger batched draw. + * + * @return {this} This Dynamic Texture instance. + */ + repeat: function (key, frame, x, y, width, height, alpha, tint, skipBatch) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.width; } + if (height === undefined) { height = this.height; } + if (alpha === undefined) { alpha = 1; } + if (tint === undefined) { tint = 0xffffff; } + if (skipBatch === undefined) { skipBatch = false; } + + if (key instanceof Frame) { - this.disconnectAll(); + frame = key; } else { - var currentPads = this.gamepads; + frame = this.manager.getFrame(key, frame); + } - for (var i = 0; i < connectedPads.length; i++) + if (!frame) + { + return this; + } + + var stamp = this.manager.resetStamp(alpha, tint); + + stamp.setFrame(frame); + stamp.setOrigin(0); + + var frameWidth = frame.width; + var frameHeight = frame.height; + + // Clamp to integer + width = Math.floor(width); + height = Math.floor(height); + + // How many stamps can we fit in horizontally and vertically? + // We round this number up to allow for excess overflow + var hmax = Math.ceil(width / frameWidth); + var vmax = Math.ceil(height / frameHeight); + + // How much extra horizontal and vertical space do we have on the right/bottom? + var hdiff = (hmax * frameWidth) - width; + var vdiff = (vmax * frameHeight) - height; + + if (hdiff > 0) + { + hdiff = frameWidth - hdiff; + } + + if (vdiff > 0) + { + vdiff = frameHeight - vdiff; + } + + // x/y may be negative + + if (x < 0) + { + hmax += Math.ceil(Math.abs(x) / frameWidth); + } + + if (y < 0) + { + vmax += Math.ceil(Math.abs(y) / frameHeight); + } + + var dx = x; + var dy = y; + + var useCrop = false; + var cropRect = this.manager.stampCrop.setTo(0, 0, frameWidth, frameHeight); + + if (!skipBatch) + { + this.beginDraw(); + } + + for (var ty = 0; ty < vmax; ty++) + { + // Negative offset? + if (dy + frameHeight < 0) { - var livePad = connectedPads[i]; + // We can't see it, as it's off the top + dy += frameHeight; + continue; + } - // Because sometimes they're null (yes, really) - if (!livePad) + for (var tx = 0; tx < hmax; tx++) + { + useCrop = false; + + // Negative offset? + if (dx + frameWidth < 0) { + // We can't see it, as it's fully off the left + dx += frameWidth; continue; } - - var id = livePad.id; - var index = livePad.index; - var currentPad = currentPads[index]; - - if (!currentPad) + else if (dx < 0) { - // A new Gamepad, not currently stored locally - var newPad = new Gamepad(this, livePad); - - currentPads[index] = newPad; + // Partially off the left + useCrop = true; + cropRect.width = (frameWidth + dx); + cropRect.x = frameWidth - cropRect.width; + } - if (!this._pad1) - { - this._pad1 = newPad; - } - else if (!this._pad2) - { - this._pad2 = newPad; - } - else if (!this._pad3) - { - this._pad3 = newPad; - } - else if (!this._pad4) - { - this._pad4 = newPad; - } + // Negative vertical offset + if (dy < 0) + { + // Partially off the top + useCrop = true; + cropRect.height = (frameHeight + dy); + cropRect.y = frameHeight - cropRect.height; } - else if (currentPad.id !== id) + + if (hdiff > 0 && tx === hmax - 1) { - // A new Gamepad with a different vendor string, but it has got the same index as an old one - currentPad.destroy(); + useCrop = true; + cropRect.width = hdiff; + } - currentPads[index] = new Gamepad(this, livePad); + if (vdiff > 0 && ty === vmax - 1) + { + useCrop = true; + cropRect.height = vdiff; } - else + + if (useCrop) { - // If neither of these, it's a pad we've already got, so update it - currentPad.update(livePad); + stamp.setCrop(cropRect); } + + this.batchGameObject(stamp, dx, dy); + + // Reset crop + stamp.isCropped = false; + + cropRect.setTo(0, 0, frameWidth, frameHeight); + + dx += frameWidth; } + + dx = x; + dy += frameHeight; + } + + if (!skipBatch) + { + this.endDraw(); } + + return this; }, /** - * Returns an array of all currently connected Gamepads. + * Use this method if you need to batch draw a large number of Game Objects to + * this Dynamic Texture in a single pass, or on a frequent basis. This is especially + * useful under WebGL, however, if your game is using Canvas only, it will not make + * any speed difference in that situation. * - * @method Phaser.Input.Gamepad.GamepadPlugin#getAll - * @since 3.10.0 + * This method starts the beginning of a batched draw, unless one is already open. * - * @return {Phaser.Input.Gamepad.Gamepad[]} An array of all currently connected Gamepads. + * Batched drawing is faster than calling `draw` in loop, but you must be careful + * to manage the flow of code and remember to call `endDraw()` when you're finished. + * + * If you don't need to draw large numbers of objects it's much safer and easier + * to use the `draw` method instead. + * + * The flow should be: + * + * ```javascript + * // Call once: + * DynamicTexture.beginDraw(); + * + * // repeat n times: + * DynamicTexture.batchDraw(); + * // or + * DynamicTexture.batchDrawFrame(); + * + * // Call once: + * DynamicTexture.endDraw(); + * ``` + * + * Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you + * have started a batch. Also, be very careful not to destroy this Dynamic Texture while the + * batch is still open. Doing so will cause a run-time error in the WebGL Renderer. + * + * You can use the `DynamicTexture.isDrawing` boolean property to tell if a batch is + * currently open, or not. + * + * @method Phaser.Textures.DynamicTexture#beginDraw + * @since 3.50.0 + * + * @return {this} This Dynamic Texture instance. */ - getAll: function () + beginDraw: function () { - var out = []; - var pads = this.gamepads; - - for (var i = 0; i < pads.length; i++) + if (!this.isDrawing) { - if (pads[i]) + var camera = this.camera; + var renderer = this.renderer; + var renderTarget = this.renderTarget; + + camera.preRender(); + + if (renderTarget) { - out.push(pads[i]); + renderer.beginCapture(renderTarget.width, renderTarget.height); } + else + { + renderer.setContext(this.context); + } + + this.isDrawing = true; } - return out; + return this; }, /** - * Looks-up a single Gamepad based on the given index value. + * Use this method if you have already called `beginDraw` and need to batch + * draw a large number of objects to this Dynamic Texture. * - * @method Phaser.Input.Gamepad.GamepadPlugin#getPad - * @since 3.10.0 + * This method batches the drawing of the given objects to this texture, + * without causing a WebGL bind or batch flush for each one. * - * @param {number} index - The index of the Gamepad to get. + * It is faster than calling `draw`, but you must be careful to manage the + * flow of code and remember to call `endDraw()`. If you don't need to draw large + * numbers of objects it's much safer and easier to use the `draw` method instead. * - * @return {Phaser.Input.Gamepad.Gamepad} The Gamepad matching the given index, or undefined if none were found. + * The flow should be: + * + * ```javascript + * // Call once: + * DynamicTexture.beginDraw(); + * + * // repeat n times: + * DynamicTexture.batchDraw(); + * // or + * DynamicTexture.batchDrawFrame(); + * + * // Call once: + * DynamicTexture.endDraw(); + * ``` + * + * Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you + * have started a batch. Also, be very careful not to destroy this Dynamic Texture while the + * batch is still open. Doing so will cause a run-time error in the WebGL Renderer. + * + * You can use the `DynamicTexture.isDrawing` boolean property to tell if a batch is + * currently open, or not. + * + * This method can accept any of the following: + * + * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite. + * * Tilemap Layers. + * * A Group. The contents of which will be iterated and drawn in turn. + * * A Container. The contents of which will be iterated fully, and drawn in turn. + * * A Scene's Display List. Pass in `Scene.children` to draw the whole list. + * * Another Dynamic Texture or Render Texture. + * * A Texture Frame instance. + * * A string. This is used to look-up a texture from the Texture Manager. + * + * Note: You cannot draw a Dynamic Texture to itself. + * + * If passing in a Group or Container it will only draw children that return `true` + * when their `willRender()` method is called. I.e. a Container with 10 children, + * 5 of which have `visible=false` will only draw the 5 visible ones. + * + * If passing in an array of Game Objects it will draw them all, regardless if + * they pass a `willRender` check or not. + * + * You can pass in a string in which case it will look for a texture in the Texture + * Manager matching that string, and draw the base frame. If you need to specify + * exactly which frame to draw then use the method `drawFrame` instead. + * + * You can pass in the `x` and `y` coordinates to draw the objects at. The use of + * the coordinates differ based on what objects are being drawn. If the object is + * a Group, Container or Display List, the coordinates are _added_ to the positions + * of the children. For all other types of object, the coordinates are exact. + * + * The `alpha` and `tint` values are only used by Texture Frames. + * Game Objects use their own alpha and tint values when being drawn. + * + * @method Phaser.Textures.DynamicTexture#batchDraw + * @since 3.50.0 + * + * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, other Dynamic or Texture, Texture Frame or an array of any of these. + * @param {number} [x=0] - The x position to draw the Frame at, or the offset applied to the object. + * @param {number} [y=0] - The y position to draw the Frame at, or the offset applied to the object. + * @param {number} [alpha=1] - The alpha value. Only used when drawing Texture Frames to this texture. Game Objects use their own alpha. + * @param {number} [tint=0xffffff] - The tint color value. Only used when drawing Texture Frames to this texture. Game Objects use their own tint. WebGL only. + * + * @return {this} This Dynamic Texture instance. */ - getPad: function (index) + batchDraw: function (entries, x, y, alpha, tint) { - var pads = this.gamepads; + if (!Array.isArray(entries)) + { + entries = [ entries ]; + } - for (var i = 0; i < pads.length; i++) + this.batchList(entries, x, y, alpha, tint); + + return this; + }, + + /** + * Use this method if you have already called `beginDraw` and need to batch + * draw a large number of texture frames to this Dynamic Texture. + * + * This method batches the drawing of the given frames to this Dynamic Texture, + * without causing a WebGL bind or batch flush for each one. + * + * It is faster than calling `drawFrame`, but you must be careful to manage the + * flow of code and remember to call `endDraw()`. If you don't need to draw large + * numbers of frames it's much safer and easier to use the `drawFrame` method instead. + * + * The flow should be: + * + * ```javascript + * // Call once: + * DynamicTexture.beginDraw(); + * + * // repeat n times: + * DynamicTexture.batchDraw(); + * // or + * DynamicTexture.batchDrawFrame(); + * + * // Call once: + * DynamicTexture.endDraw(); + * ``` + * + * Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you + * have started a batch. Also, be very careful not to destroy this Dynamic Texture while the + * batch is still open. Doing so will cause a run-time error in the WebGL Renderer. + * + * You can use the `DynamicTexture.isDrawing` boolean property to tell if a batch is + * currently open, or not. + * + * Textures are referenced by their string-based keys, as stored in the Texture Manager. + * + * You can optionally provide a position, alpha and tint value to apply to the frame + * before it is drawn. + * + * @method Phaser.Textures.DynamicTexture#batchDrawFrame + * @since 3.50.0 + * + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. + * @param {number} [x=0] - The x position to draw the frame at. + * @param {number} [y=0] - The y position to draw the frame at. + * @param {number} [alpha=1] - The alpha value. Only used when drawing Texture Frames to this texture. Game Objects use their own alpha. + * @param {number} [tint=0xffffff] - The tint color value. Only used when drawing Texture Frames to this texture. Game Objects use their own tint. WebGL only. + * + * @return {this} This Dynamic Texture instance. + */ + batchDrawFrame: function (key, frame, x, y, alpha, tint) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (alpha === undefined) { alpha = 1; } + if (tint === undefined) { tint = 0xffffff; } + + var textureFrame = this.manager.getFrame(key, frame); + + if (textureFrame) { - if (pads[i] && pads[i].index === index) + if (this.renderTarget) { - return pads[i]; + this.pipeline.batchTextureFrame(textureFrame, x, y, tint, alpha, this.camera.matrix, null); + } + else + { + this.batchTextureFrame(textureFrame, x, y, alpha, tint); } } + + return this; }, /** - * The internal update loop. Refreshes all connected gamepads and processes their events. + * Use this method to finish batch drawing to this Dynamic Texture. * - * Called automatically by the Input Manager, invoked from the Game step. + * Doing so will stop the WebGL Renderer from capturing draws and then blit the + * framebuffer to the Render Target owned by this texture. * - * @method Phaser.Input.Gamepad.GamepadPlugin#update - * @private - * @fires Phaser.Input.Gamepad.Events#CONNECTED - * @fires Phaser.Input.Gamepad.Events#DISCONNECTED - * @since 3.10.0 + * Calling this method without first calling `beginDraw` will have no effect. + * + * Batch drawing is faster than calling `draw`, but you must be careful to manage the + * flow of code and remember to call `endDraw()` when you're finished. + * + * If you don't need to draw large numbers of objects it's much safer and easier + * to use the `draw` method instead. + * + * The flow should be: + * + * ```javascript + * // Call once: + * DynamicTexture.beginDraw(); + * + * // repeat n times: + * DynamicTexture.batchDraw(); + * // or + * DynamicTexture.batchDrawFrame(); + * + * // Call once: + * DynamicTexture.endDraw(); + * ``` + * + * Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you + * have started a batch. Also, be very careful not to destroy this Dynamic Texture while the + * batch is still open. Doing so will cause a run-time error in the WebGL Renderer. + * + * You can use the `DynamicTexture.isDrawing` boolean property to tell if a batch is + * currently open, or not. + * + * @method Phaser.Textures.DynamicTexture#endDraw + * @since 3.50.0 + * + * @param {boolean} [erase=false] - Draws all objects in this batch using a blend mode of ERASE. This has the effect of erasing any filled pixels in the objects being drawn. + * + * @return {this} This Dynamic Texture instance. */ - update: function () + endDraw: function (erase) { - if (!this.enabled) + if (erase === undefined) { erase = this._eraseMode; } + + if (this.isDrawing) { - return; + var renderer = this.renderer; + + var renderTarget = this.renderTarget; + + if (renderTarget) + { + var canvasTarget = renderer.endCapture(); + + var util = renderer.pipelines.setUtility(); + + util.blitFrame(canvasTarget, renderTarget, 1, false, false, erase, this.isSpriteTexture); + + renderer.resetScissor(); + renderer.resetViewport(); + } + else + { + renderer.setContext(); + } + + this.dirty = true; + this.isDrawing = false; } - this.refreshPads(); + return this; + }, - var len = this.queue.length; + /** + * Internal method that handles the drawing of an array of children. + * + * @method Phaser.Textures.DynamicTexture#batchList + * @private + * @since 3.12.0 + * + * @param {array} children - The array of Game Objects, Textures or Frames to draw. + * @param {number} [x=0] - The x position to offset the Game Object by. + * @param {number} [y=0] - The y position to offset the Game Object by. + * @param {number} [alpha=1] - The alpha value. Only used when drawing Texture Frames to this texture. Game Objects use their own alpha. + * @param {number} [tint=0xffffff] - The tint color value. Only used when drawing Texture Frames to this texture. Game Objects use their own tint. WebGL only. + */ + batchList: function (children, x, y, alpha, tint) + { + var len = children.length; if (len === 0) { return; } - var queue = this.queue.splice(0, len); - - // Process the event queue, dispatching all of the events that have stored up for (var i = 0; i < len; i++) { - var event = queue[i]; - var pad = this.getPad(event.gamepad.index); + var entry = children[i]; - if (event.type === 'gamepadconnected') + if (!entry || entry === this) { - this.emit(Events.CONNECTED, pad, event); + continue; } - else if (event.type === 'gamepaddisconnected') + + if (entry.renderWebGL || entry.renderCanvas) { - this.emit(Events.DISCONNECTED, pad, event); + // Game Objects + this.batchGameObject(entry, x, y); + } + else if (entry.isParent || entry.list) + { + // Groups / Display Lists + this.batchGroup(entry.getChildren(), x, y); + } + else if (typeof entry === 'string') + { + // Texture key + this.batchTextureFrameKey(entry, null, x, y, alpha, tint); + } + else if (entry instanceof Frame) + { + // Texture Frame instance + this.batchTextureFrame(entry, x, y, alpha, tint); + } + else if (Array.isArray(entry)) + { + // Another Array + this.batchList(entry, x, y, alpha, tint); } } }, /** - * Shuts the Gamepad Plugin down. - * All this does is remove any listeners bound to it. + * Internal method that handles drawing the contents of a Phaser Group to this Dynamic Texture. * - * @method Phaser.Input.Gamepad.GamepadPlugin#shutdown + * @method Phaser.Textures.DynamicTexture#batchGroup * @private - * @since 3.10.0 + * @since 3.12.0 + * + * @param {array} children - The array of Game Objects to draw. + * @param {number} [x=0] - The x position to offset the Game Objects by. + * @param {number} [y=0] - The y position to offset the Game Objects by. */ - shutdown: function () + batchGroup: function (children, x, y) { - this.stopListeners(); + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } - this.removeAllListeners(); + for (var i = 0; i < children.length; i++) + { + var entry = children[i]; + + if (entry.willRender(this.camera)) + { + this.batchGameObject(entry, entry.x + x, entry.y + y); + } + } }, /** - * Destroys this Gamepad Plugin, disconnecting all Gamepads and releasing internal references. + * Internal method that handles drawing a single Phaser Game Object to this Dynamic Texture. * - * @method Phaser.Input.Gamepad.GamepadPlugin#destroy + * @method Phaser.Textures.DynamicTexture#batchGameObject * @private - * @since 3.10.0 + * @since 3.12.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to draw. + * @param {number} [x=0] - The x position to draw the Game Object at. + * @param {number} [y=0] - The y position to draw the Game Object at. */ - destroy: function () + batchGameObject: function (gameObject, x, y) { - this.shutdown(); + if (x === undefined) { x = gameObject.x; } + if (y === undefined) { y = gameObject.y; } - for (var i = 0; i < this.gamepads.length; i++) + var prevX = gameObject.x; + var prevY = gameObject.y; + + var camera = this.camera; + var renderer = this.renderer; + var eraseMode = this._eraseMode; + + var mask = gameObject.mask; + + gameObject.setPosition(x, y); + + if (this.canvas) { - if (this.gamepads[i]) + if (eraseMode) { - this.gamepads[i].destroy(); + var blendMode = gameObject.blendMode; + + gameObject.blendMode = BlendModes.ERASE; + } + + if (mask) + { + mask.preRenderCanvas(renderer, gameObject, camera); + } + + gameObject.renderCanvas(renderer, gameObject, camera, null); + + if (mask) + { + mask.postRenderCanvas(renderer, gameObject, camera); + } + + if (eraseMode) + { + gameObject.blendMode = blendMode; } } + else if (renderer) + { + if (mask) + { + mask.preRenderWebGL(renderer, gameObject, camera); + } - this.gamepads = []; + if (!eraseMode) + { + renderer.setBlendMode(gameObject.blendMode); + } - this.scene = null; - this.settings = null; - this.sceneInputPlugin = null; - this.target = null; + gameObject.renderWebGL(renderer, gameObject, camera); + + if (mask) + { + mask.postRenderWebGL(renderer, camera, this.renderTarget); + } + } + + gameObject.setPosition(prevX, prevY); }, /** - * The total number of connected game pads. + * Internal method that handles the drawing a Texture Frame based on its key. * - * @name Phaser.Input.Gamepad.GamepadPlugin#total - * @type {number} - * @since 3.10.0 + * @method Phaser.Textures.DynamicTexture#batchTextureFrameKey + * @private + * @since 3.12.0 + * + * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. + * @param {(string|number)} [frame] - The name or index of the frame within the Texture. + * @param {number} [x=0] - The x position to offset the Game Object by. + * @param {number} [y=0] - The y position to offset the Game Object by. + * @param {number} [alpha=1] - The alpha value. Only used when drawing Texture Frames to this texture. Game Objects use their own alpha. + * @param {number} [tint=0xffffff] - The tint color value. Only used when drawing Texture Frames to this texture. Game Objects use their own tint. WebGL only. */ - total: { + batchTextureFrameKey: function (key, frame, x, y, alpha, tint) + { + var textureFrame = this.manager.getFrame(key, frame); - get: function () + if (textureFrame) + { + this.batchTextureFrame(textureFrame, x, y, alpha, tint); + } + }, + + /** + * Internal method that handles the drawing of a Texture Frame to this Dynamic Texture. + * + * @method Phaser.Textures.DynamicTexture#batchTextureFrame + * @private + * @since 3.12.0 + * + * @param {Phaser.Textures.Frame} textureFrame - The Texture Frame to draw. + * @param {number} [x=0] - The x position to draw the Frame at. + * @param {number} [y=0] - The y position to draw the Frame at. + * @param {number} [alpha=1] - The alpha value. Only used when drawing Texture Frames to this texture. Game Objects use their own alpha. + * @param {number} [tint=0xffffff] - The tint color value. Only used when drawing Texture Frames to this texture. Game Objects use their own tint. WebGL only. + */ + batchTextureFrame: function (textureFrame, x, y, alpha, tint) + { + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (alpha === undefined) { alpha = 1; } + if (tint === undefined) { tint = 0xffffff; } + + var matrix = this.camera.matrix; + var renderTarget = this.renderTarget; + + if (renderTarget) + { + this.pipeline.batchTextureFrame(textureFrame, x, y, tint, alpha, matrix, null); + } + else + { + var ctx = this.context; + var cd = textureFrame.canvasData; + var source = textureFrame.source.image; + + ctx.save(); + + ctx.globalCompositeOperation = (this._eraseMode) ? 'destination-out' : 'source-over'; + + ctx.globalAlpha = alpha; + + matrix.setToContext(ctx); + + if (cd.width > 0 && cd.height > 0) + { + ctx.drawImage(source, cd.x, cd.y, cd.width, cd.height, x, y, cd.width, cd.height); + } + + ctx.restore(); + } + }, + + /** + * Takes a snapshot of the given area of this Dynamic Texture. + * + * The snapshot is taken immediately, but the results are returned via the given callback. + * + * To capture the whole Dynamic Texture see the `snapshot` method. + * To capture just a specific pixel, see the `snapshotPixel` method. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer + * into an ArrayBufferView. It then parses this, copying the contents to a temporary Canvas and finally + * creating an Image object from it, which is the image returned to the callback provided. + * + * All in all, this is a computationally expensive and blocking process, which gets more expensive + * the larger the resolution this Dynamic Texture has, so please be careful how you employ this in your game. + * + * @method Phaser.Textures.DynamicTexture#snapshotArea + * @since 3.19.0 + * + * @param {number} x - The x coordinate to grab from. + * @param {number} y - The y coordinate to grab from. + * @param {number} width - The width of the area to grab. + * @param {number} height - The height of the area to grab. + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This Dynamic Texture instance. + */ + snapshotArea: function (x, y, width, height, callback, type, encoderOptions) + { + if (this.renderTarget) + { + this.renderer.snapshotFramebuffer(this.renderTarget.framebuffer, this.width, this.height, callback, false, x, y, width, height, type, encoderOptions); + } + else { - return this.gamepads.length; + this.renderer.snapshotCanvas(this.canvas, callback, false, x, y, width, height, type, encoderOptions); } + return this; }, /** - * A reference to the first connected Gamepad. + * Takes a snapshot of the whole of this Dynamic Texture. * - * This will be undefined if either no pads are connected, or the browser - * has not yet issued a gamepadconnect, which can happen even if a Gamepad - * is plugged in, but hasn't yet had any buttons pressed on it. + * The snapshot is taken immediately, but the results are returned via the given callback. * - * @name Phaser.Input.Gamepad.GamepadPlugin#pad1 - * @type {Phaser.Input.Gamepad.Gamepad} - * @since 3.10.0 + * To capture a portion of this Dynamic Texture see the `snapshotArea` method. + * To capture just a specific pixel, see the `snapshotPixel` method. + * + * Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer + * into an ArrayBufferView. It then parses this, copying the contents to a temporary Canvas and finally + * creating an Image object from it, which is the image returned to the callback provided. + * + * All in all, this is a computationally expensive and blocking process, which gets more expensive + * the larger the resolution this Dynamic Texture has, so please be careful how you employ this in your game. + * + * @method Phaser.Textures.DynamicTexture#snapshot + * @since 3.19.0 + * + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot image is created. + * @param {string} [type='image/png'] - The format of the image to create, usually `image/png` or `image/jpeg`. + * @param {number} [encoderOptions=0.92] - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. + * + * @return {this} This Dynamic Texture instance. */ - pad1: { - - get: function () - { - return this._pad1; - } - + snapshot: function (callback, type, encoderOptions) + { + return this.snapshotArea(0, 0, this.width, this.height, callback, type, encoderOptions); }, /** - * A reference to the second connected Gamepad. + * Takes a snapshot of the given pixel from this Dynamic Texture. * - * This will be undefined if either no pads are connected, or the browser - * has not yet issued a gamepadconnect, which can happen even if a Gamepad - * is plugged in, but hasn't yet had any buttons pressed on it. + * The snapshot is taken immediately, but the results are returned via the given callback. * - * @name Phaser.Input.Gamepad.GamepadPlugin#pad2 - * @type {Phaser.Input.Gamepad.Gamepad} - * @since 3.10.0 + * To capture the whole Dynamic Texture see the `snapshot` method. + * To capture a portion of this Dynamic Texture see the `snapshotArea` method. + * + * Unlike the two other snapshot methods, this one will send your callback a `Color` object + * containing the color data for the requested pixel. It doesn't need to create an internal + * Canvas or Image object, so is a lot faster to execute, using less memory than the other snapshot methods. + * + * @method Phaser.Textures.DynamicTexture#snapshotPixel + * @since 3.19.0 + * + * @param {number} x - The x coordinate of the pixel to get. + * @param {number} y - The y coordinate of the pixel to get. + * @param {Phaser.Types.Renderer.Snapshot.SnapshotCallback} callback - The Function to invoke after the snapshot pixel data is extracted. + * + * @return {this} This Dynamic Texture instance. */ - pad2: { + snapshotPixel: function (x, y, callback) + { + return this.snapshotArea(x, y, 1, 1, callback, 'pixel'); + }, - get: function () + /** + * Returns the underlying WebGLTexture, if not running in Canvas mode. + * + * @method Phaser.Textures.DynamicTexture#getWebGLTexture + * @since 3.60.0 + * + * @return {?WebGLTexture} The underlying WebGLTexture, if not running in Canvas mode. + */ + getWebGLTexture: function () + { + if (this.renderTarget) { - return this._pad2; + return this.renderTarget.texture; } - }, /** - * A reference to the third connected Gamepad. + * Renders this Dynamic Texture onto the Stamp Game Object as a BitmapMask. * - * This will be undefined if either no pads are connected, or the browser - * has not yet issued a gamepadconnect, which can happen even if a Gamepad - * is plugged in, but hasn't yet had any buttons pressed on it. + * @method Phaser.Textures.DynamicTexture#renderWebGL + * @since 3.60.0 * - * @name Phaser.Input.Gamepad.GamepadPlugin#pad3 - * @type {Phaser.Input.Gamepad.Gamepad} - * @since 3.10.0 + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.GameObjects.Image} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested */ - pad3: { + renderWebGL: function (renderer, src, camera, parentMatrix) + { + var stamp = this.manager.resetStamp(); - get: function () - { - return this._pad3; - } + stamp.setTexture(this); + stamp.setOrigin(0); + stamp.renderWebGL(renderer, stamp, camera, parentMatrix); }, /** - * A reference to the fourth connected Gamepad. + * This is a NOOP method. Bitmap Masks are not supported by the Canvas Renderer. * - * This will be undefined if either no pads are connected, or the browser - * has not yet issued a gamepadconnect, which can happen even if a Gamepad - * is plugged in, but hasn't yet had any buttons pressed on it. + * @method Phaser.Textures.DynamicTexture#renderCanvas + * @since 3.60.0 * - * @name Phaser.Input.Gamepad.GamepadPlugin#pad4 - * @type {Phaser.Input.Gamepad.Gamepad} - * @since 3.10.0 + * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The Canvas Renderer which would be rendered to. + * @param {Phaser.GameObjects.GameObject} mask - The masked Game Object which would be rendered. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to. */ - pad4: { + renderCanvas: function () + { + // NOOP + }, - get: function () + /** + * Internal destroy handler, called as part of the destroy process. + * + * @method Phaser.Textures.DynamicTexture#preDestroy + * @protected + * @since 3.9.0 + */ + preDestroy: function () + { + CanvasPool.remove(this.canvas); + + if (this.renderTarget) { - return this._pad4; + this.renderTarget.destroy(); } + this.camera.destroy(); + this.stamp.destroy(); + + this.canvas = null; + this.context = null; + this.renderer = null; + this.scene = null; } }); -/** - * An instance of the Gamepad Plugin class, if enabled via the `input.gamepad` Scene or Game Config property. - * Use this to create access Gamepads connected to the browser and respond to gamepad buttons. - * - * @name Phaser.Input.InputPlugin#gamepad - * @type {?Phaser.Input.Gamepad.GamepadPlugin} - * @since 3.10.0 - */ -InputPluginCache.register('GamepadPlugin', GamepadPlugin, 'gamepad', 'gamepad', 'inputGamepad'); - -module.exports = GamepadPlugin; - - -/***/ }), -/* 1317 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Input.Gamepad.Configs - */ - -module.exports = { - - DUALSHOCK_4: __webpack_require__(1318), - SNES_USB: __webpack_require__(1319), - XBOX_360: __webpack_require__(1320) - -}; - - -/***/ }), -/* 1318 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * PlayStation DualShock 4 Gamepad Configuration. - * Sony PlayStation DualShock 4 (v2) wireless controller - * - * @name Phaser.Input.Gamepad.Configs.DUALSHOCK_4 - * @type {object} - * @since 3.0.0 - */ -module.exports = { - - UP: 12, - DOWN: 13, - LEFT: 14, - RIGHT: 15, - - SHARE: 8, - OPTIONS: 9, - PS: 16, - TOUCHBAR: 17, - - X: 0, - CIRCLE: 1, - SQUARE: 2, - TRIANGLE: 3, - - L1: 4, - R1: 5, - L2: 6, - R2: 7, - L3: 10, - R3: 11, - - LEFT_STICK_H: 0, - LEFT_STICK_V: 1, - RIGHT_STICK_H: 2, - RIGHT_STICK_V: 3 - -}; - - -/***/ }), -/* 1319 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * Tatar SNES USB Controller Gamepad Configuration. - * USB Gamepad (STANDARD GAMEPAD Vendor: 0079 Product: 0011) - * - * @name Phaser.Input.Gamepad.Configs.SNES_USB - * @type {object} - * @since 3.0.0 - */ -module.exports = { - - UP: 12, - DOWN: 13, - LEFT: 14, - RIGHT: 15, - - SELECT: 8, - START: 9, - - B: 0, - A: 1, - Y: 2, - X: 3, - - LEFT_SHOULDER: 4, - RIGHT_SHOULDER: 5 - -}; +module.exports = DynamicTexture; /***/ }), -/* 1320 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * XBox 360 Gamepad Configuration. - * - * @name Phaser.Input.Gamepad.Configs.XBOX_360 - * @type {object} - * @since 3.0.0 - */ -module.exports = { - - UP: 12, - DOWN: 13, - LEFT: 14, - RIGHT: 15, - - MENU: 16, - - A: 0, - B: 1, - X: 2, - Y: 3, - - LB: 4, - RB: 5, - - LT: 6, - RT: 7, - - BACK: 8, - START: 9, - - LS: 10, - RS: 11, - - LEFT_STICK_H: 0, - LEFT_STICK_V: 1, - RIGHT_STICK_H: 2, - RIGHT_STICK_V: 3 - -}; - -/***/ }), -/* 1321 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ 82047: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Circle = __webpack_require__(65); -var CircleContains = __webpack_require__(66); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(203); -var CreateInteractiveObject = __webpack_require__(508); -var CreatePixelPerfectHandler = __webpack_require__(507); -var DistanceBetween = __webpack_require__(50); -var Ellipse = __webpack_require__(111); -var EllipseContains = __webpack_require__(112); -var Events = __webpack_require__(51); -var EventEmitter = __webpack_require__(9); -var GetFastValue = __webpack_require__(2); -var GEOM_CONST = __webpack_require__(56); -var InputPluginCache = __webpack_require__(153); -var IsPlainObject = __webpack_require__(7); -var PluginCache = __webpack_require__(24); -var Rectangle = __webpack_require__(10); -var RectangleContains = __webpack_require__(57); -var SceneEvents = __webpack_require__(20); -var Triangle = __webpack_require__(82); -var TriangleContains = __webpack_require__(115); +var Class = __webpack_require__(56694); +var Clamp = __webpack_require__(82897); +var Extend = __webpack_require__(98611); /** * @classdesc - * The Input Plugin belongs to a Scene and handles all input related events and operations for it. - * - * You can access it from within a Scene using `this.input`. - * - * It emits events directly. For example, you can do: - * - * ```javascript - * this.input.on('pointerdown', callback, context); - * ``` - * - * To listen for a pointer down event anywhere on the game canvas. - * - * Game Objects can be enabled for input by calling their `setInteractive` method. After which they - * will directly emit input events: - * - * ```javascript - * var sprite = this.add.sprite(x, y, texture); - * sprite.setInteractive(); - * sprite.on('pointerdown', callback, context); - * ``` - * - * There are lots of game configuration options available relating to input. - * See the [Input Config object]{@linkcode Phaser.Types.Core.InputConfig} for more details, including how to deal with Phaser - * listening for input events outside of the canvas, how to set a default number of pointers, input - * capture settings and more. - * - * Please also see the Input examples and tutorials for further information. - * - * **Incorrect input coordinates with Angular** - * - * If you are using Phaser within Angular, and use nglf or the router, to make the component in which the Phaser game resides - * change state (i.e. appear or disappear) then you'll need to notify the Scale Manager about this, as Angular will mess with - * the DOM in a way in which Phaser can't detect directly. Call `this.scale.updateBounds()` as part of your game init in order - * to refresh the canvas DOM bounds values, which Phaser uses for input point position calculations. + * A Frame is a section of a Texture. * - * @class InputPlugin - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Input + * @class Frame + * @memberof Phaser.Textures * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - A reference to the Scene that this Input Plugin is responsible for. + * @param {Phaser.Textures.Texture} texture - The Texture this Frame is a part of. + * @param {(number|string)} name - The name of this Frame. The name is unique within the Texture. + * @param {number} sourceIndex - The index of the TextureSource that this Frame is a part of. + * @param {number} x - The x coordinate of the top-left of this Frame. + * @param {number} y - The y coordinate of the top-left of this Frame. + * @param {number} width - The width of this Frame. + * @param {number} height - The height of this Frame. */ -var InputPlugin = new Class({ - - Extends: EventEmitter, +var Frame = new Class({ initialize: - function InputPlugin (scene) + function Frame (texture, name, sourceIndex, x, y, width, height) { - EventEmitter.call(this); - /** - * A reference to the Scene that this Input Plugin is responsible for. + * The Texture this Frame is a part of. * - * @name Phaser.Input.InputPlugin#scene - * @type {Phaser.Scene} + * @name Phaser.Textures.Frame#texture + * @type {Phaser.Textures.Texture} * @since 3.0.0 */ - this.scene = scene; + this.texture = texture; /** - * A reference to the Scene Systems class. + * The name of this Frame. + * The name is unique within the Texture. * - * @name Phaser.Input.InputPlugin#systems - * @type {Phaser.Scenes.Systems} + * @name Phaser.Textures.Frame#name + * @type {string} * @since 3.0.0 */ - this.systems = scene.sys; + this.name = name; /** - * A reference to the Scene Systems Settings. + * The TextureSource this Frame is part of. * - * @name Phaser.Input.InputPlugin#settings - * @type {Phaser.Types.Scenes.SettingsObject} - * @since 3.5.0 + * @name Phaser.Textures.Frame#source + * @type {Phaser.Textures.TextureSource} + * @since 3.0.0 */ - this.settings = scene.sys.settings; + this.source = texture.source[sourceIndex]; /** - * A reference to the Game Input Manager. + * The index of the TextureSource in the Texture sources array. * - * @name Phaser.Input.InputPlugin#manager - * @type {Phaser.Input.InputManager} + * @name Phaser.Textures.Frame#sourceIndex + * @type {number} * @since 3.0.0 */ - this.manager = scene.sys.game.input; + this.sourceIndex = sourceIndex; /** - * Internal event queue used for plugins only. + * A reference to the Texture Source WebGL Texture that this Frame is using. * - * @name Phaser.Input.InputPlugin#pluginEvents - * @type {Phaser.Events.EventEmitter} - * @private - * @since 3.10.0 + * @name Phaser.Textures.Frame#glTexture + * @type {?WebGLTexture} + * @default null + * @since 3.11.0 */ - this.pluginEvents = new EventEmitter(); + this.glTexture = this.source.glTexture; /** - * If `true` this Input Plugin will process DOM input events. + * X position within the source image to cut from. * - * @name Phaser.Input.InputPlugin#enabled - * @type {boolean} - * @default true - * @since 3.5.0 + * @name Phaser.Textures.Frame#cutX + * @type {number} + * @since 3.0.0 */ - this.enabled = true; + this.cutX; /** - * A reference to the Scene Display List. This property is set during the `boot` method. + * Y position within the source image to cut from. * - * @name Phaser.Input.InputPlugin#displayList - * @type {Phaser.GameObjects.DisplayList} + * @name Phaser.Textures.Frame#cutY + * @type {number} * @since 3.0.0 */ - this.displayList; + this.cutY; /** - * A reference to the Scene Cameras Manager. This property is set during the `boot` method. + * The width of the area in the source image to cut. * - * @name Phaser.Input.InputPlugin#cameras - * @type {Phaser.Cameras.Scene2D.CameraManager} + * @name Phaser.Textures.Frame#cutWidth + * @type {number} * @since 3.0.0 */ - this.cameras; - - // Inject the available input plugins into this class - InputPluginCache.install(this); + this.cutWidth; /** - * A reference to the Mouse Manager. - * - * This property is only set if Mouse support has been enabled in your Game Configuration file. - * - * If you just wish to get access to the mouse pointer, use the `mousePointer` property instead. + * The height of the area in the source image to cut. * - * @name Phaser.Input.InputPlugin#mouse - * @type {?Phaser.Input.Mouse.MouseManager} + * @name Phaser.Textures.Frame#cutHeight + * @type {number} * @since 3.0.0 */ - this.mouse = this.manager.mouse; + this.cutHeight; /** - * When set to `true` (the default) the Input Plugin will emulate DOM behavior by only emitting events from - * the top-most Game Objects in the Display List. - * - * If set to `false` it will emit events from all Game Objects below a Pointer, not just the top one. + * The X rendering offset of this Frame, taking trim into account. * - * @name Phaser.Input.InputPlugin#topOnly - * @type {boolean} - * @default true + * @name Phaser.Textures.Frame#x + * @type {number} + * @default 0 * @since 3.0.0 */ - this.topOnly = true; + this.x = 0; /** - * How often should the Pointers be checked? - * - * The value is a time, given in ms, and is the time that must have elapsed between game steps before - * the Pointers will be polled again. When a pointer is polled it runs a hit test to see which Game - * Objects are currently below it, or being interacted with it. - * - * Pointers will *always* be checked if they have been moved by the user, or press or released. - * - * This property only controls how often they will be polled if they have not been updated. - * You should set this if you want to have Game Objects constantly check against the pointers, even - * if the pointer didn't itself move. - * - * Set to 0 to poll constantly. Set to -1 to only poll on user movement. + * The Y rendering offset of this Frame, taking trim into account. * - * @name Phaser.Input.InputPlugin#pollRate + * @name Phaser.Textures.Frame#y * @type {number} - * @default -1 + * @default 0 * @since 3.0.0 */ - this.pollRate = -1; + this.y = 0; /** - * Internal poll timer value. + * The rendering width of this Frame, taking trim into account. * - * @name Phaser.Input.InputPlugin#_pollTimer + * @name Phaser.Textures.Frame#width * @type {number} - * @private - * @default 0 * @since 3.0.0 */ - this._pollTimer = 0; - - var _eventData = { cancelled: false }; + this.width; /** - * Internal event propagation callback container. + * The rendering height of this Frame, taking trim into account. * - * @name Phaser.Input.InputPlugin#_eventContainer - * @type {Phaser.Types.Input.EventData} - * @private - * @since 3.13.0 + * @name Phaser.Textures.Frame#height + * @type {number} + * @since 3.0.0 */ - this._eventContainer = { - stopPropagation: function () - { - _eventData.cancelled = true; - } - }; + this.height; /** - * Internal event propagation data object. + * Half the width, floored. + * Precalculated for the renderer. * - * @name Phaser.Input.InputPlugin#_eventData - * @type {object} - * @private - * @since 3.13.0 + * @name Phaser.Textures.Frame#halfWidth + * @type {number} + * @since 3.0.0 */ - this._eventData = _eventData; + this.halfWidth; /** - * The distance, in pixels, a pointer has to move while being held down, before it thinks it is being dragged. + * Half the height, floored. + * Precalculated for the renderer. * - * @name Phaser.Input.InputPlugin#dragDistanceThreshold + * @name Phaser.Textures.Frame#halfHeight * @type {number} - * @default 0 * @since 3.0.0 */ - this.dragDistanceThreshold = 0; + this.halfHeight; /** - * The amount of time, in ms, a pointer has to be held down before it thinks it is dragging. - * - * The default polling rate is to poll only on move so once the time threshold is reached the - * drag event will not start until you move the mouse. If you want it to start immediately - * when the time threshold is reached, you must increase the polling rate by calling - * [setPollAlways]{@linkcode Phaser.Input.InputPlugin#setPollAlways} or - * [setPollRate]{@linkcode Phaser.Input.InputPlugin#setPollRate}. + * The x center of this frame, floored. * - * @name Phaser.Input.InputPlugin#dragTimeThreshold + * @name Phaser.Textures.Frame#centerX * @type {number} - * @default 0 * @since 3.0.0 */ - this.dragTimeThreshold = 0; + this.centerX; /** - * Used to temporarily store the results of the Hit Test + * The y center of this frame, floored. * - * @name Phaser.Input.InputPlugin#_temp - * @type {array} - * @private - * @default [] + * @name Phaser.Textures.Frame#centerY + * @type {number} * @since 3.0.0 */ - this._temp = []; + this.centerY; /** - * Used to temporarily store the results of the Hit Test dropZones + * The horizontal pivot point of this Frame. * - * @name Phaser.Input.InputPlugin#_tempZones - * @type {array} - * @private - * @default [] + * @name Phaser.Textures.Frame#pivotX + * @type {number} + * @default 0 * @since 3.0.0 */ - this._tempZones = []; + this.pivotX = 0; /** - * A list of all Game Objects that have been set to be interactive in the Scene this Input Plugin is managing. + * The vertical pivot point of this Frame. * - * @name Phaser.Input.InputPlugin#_list - * @type {Phaser.GameObjects.GameObject[]} - * @private - * @default [] + * @name Phaser.Textures.Frame#pivotY + * @type {number} + * @default 0 * @since 3.0.0 */ - this._list = []; + this.pivotY = 0; /** - * Objects waiting to be inserted to the list on the next call to 'begin'. + * Does this Frame have a custom pivot point? * - * @name Phaser.Input.InputPlugin#_pendingInsertion - * @type {Phaser.GameObjects.GameObject[]} - * @private - * @default [] + * @name Phaser.Textures.Frame#customPivot + * @type {boolean} + * @default false * @since 3.0.0 */ - this._pendingInsertion = []; + this.customPivot = false; /** - * Objects waiting to be removed from the list on the next call to 'begin'. + * **CURRENTLY UNSUPPORTED** * - * @name Phaser.Input.InputPlugin#_pendingRemoval - * @type {Phaser.GameObjects.GameObject[]} - * @private - * @default [] + * Is this frame is rotated or not in the Texture? + * Rotation allows you to use rotated frames in texture atlas packing. + * It has nothing to do with Sprite rotation. + * + * @name Phaser.Textures.Frame#rotated + * @type {boolean} + * @default false * @since 3.0.0 */ - this._pendingRemoval = []; + this.rotated = false; /** - * A list of all Game Objects that have been enabled for dragging. + * Over-rides the Renderer setting. + * -1 = use Renderer Setting + * 0 = No rounding + * 1 = Round * - * @name Phaser.Input.InputPlugin#_draggable - * @type {Phaser.GameObjects.GameObject[]} - * @private - * @default [] + * @name Phaser.Textures.Frame#autoRound + * @type {number} + * @default -1 * @since 3.0.0 */ - this._draggable = []; + this.autoRound = -1; /** - * A list of all Interactive Objects currently considered as being 'draggable' by any pointer, indexed by pointer ID. + * Any Frame specific custom data can be stored here. * - * @name Phaser.Input.InputPlugin#_drag - * @type {{0:Array,1:Array,2:Array,3:Array,4:Array,5:Array,6:Array,7:Array,8:Array,9:Array,10:Array}} - * @private + * @name Phaser.Textures.Frame#customData + * @type {object} * @since 3.0.0 */ - this._drag = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [] }; + this.customData = {}; /** - * A array containing the dragStates, for this Scene, index by the Pointer ID. + * WebGL UV u0 value. * - * @name Phaser.Input.InputPlugin#_dragState - * @type {number[]} - * @private - * @since 3.16.0 + * @name Phaser.Textures.Frame#u0 + * @type {number} + * @default 0 + * @since 3.11.0 */ - this._dragState = []; + this.u0 = 0; /** - * A list of all Interactive Objects currently considered as being 'over' by any pointer, indexed by pointer ID. + * WebGL UV v0 value. * - * @name Phaser.Input.InputPlugin#_over - * @type {{0:Array,1:Array,2:Array,3:Array,4:Array,5:Array,6:Array,7:Array,8:Array,9:Array,10:Array}} - * @private - * @since 3.0.0 + * @name Phaser.Textures.Frame#v0 + * @type {number} + * @default 0 + * @since 3.11.0 */ - this._over = { 0: [], 1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: [], 8: [], 9: [], 10: [] }; + this.v0 = 0; /** - * A list of valid DOM event types. + * WebGL UV u1 value. * - * @name Phaser.Input.InputPlugin#_validTypes - * @type {string[]} - * @private - * @since 3.0.0 + * @name Phaser.Textures.Frame#u1 + * @type {number} + * @default 0 + * @since 3.11.0 */ - this._validTypes = [ 'onDown', 'onUp', 'onOver', 'onOut', 'onMove', 'onDragStart', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragLeave', 'onDragOver', 'onDrop' ]; + this.u1 = 0; /** - * Internal property that tracks frame event state. + * WebGL UV v1 value. * - * @name Phaser.Input.InputPlugin#_updatedThisFrame - * @type {boolean} - * @private - * @since 3.18.0 + * @name Phaser.Textures.Frame#v1 + * @type {number} + * @default 0 + * @since 3.11.0 */ - this._updatedThisFrame = false; - - scene.sys.events.once(SceneEvents.BOOT, this.boot, this); - scene.sys.events.on(SceneEvents.START, this.start, this); - }, - - /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. - * - * @method Phaser.Input.InputPlugin#boot - * @fires Phaser.Input.Events#BOOT - * @private - * @since 3.5.1 - */ - boot: function () - { - this.cameras = this.systems.cameras; - - this.displayList = this.systems.displayList; - - this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); - - // Registered input plugins listen for this - this.pluginEvents.emit(Events.BOOT); - }, - - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. - * - * @method Phaser.Input.InputPlugin#start - * @fires Phaser.Input.Events#START - * @private - * @since 3.5.0 - */ - start: function () - { - var eventEmitter = this.systems.events; - - eventEmitter.on(SceneEvents.TRANSITION_START, this.transitionIn, this); - eventEmitter.on(SceneEvents.TRANSITION_OUT, this.transitionOut, this); - eventEmitter.on(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); - eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); - eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); - - this.manager.events.on(Events.GAME_OUT, this.onGameOut, this); - this.manager.events.on(Events.GAME_OVER, this.onGameOver, this); - - this.enabled = true; - - // Populate the pointer drag states - this._dragState = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; - - // Registered input plugins listen for this - this.pluginEvents.emit(Events.START); - }, - - /** - * Game Over handler. - * - * @method Phaser.Input.InputPlugin#onGameOver - * @fires Phaser.Input.Events#GAME_OVER - * @private - * @since 3.16.2 - */ - onGameOver: function (event) - { - if (this.isActive()) - { - this.emit(Events.GAME_OVER, event.timeStamp, event); - } - }, - - /** - * Game Out handler. - * - * @method Phaser.Input.InputPlugin#onGameOut - * @fires Phaser.Input.Events#GAME_OUT - * @private - * @since 3.16.2 - */ - onGameOut: function (event) - { - if (this.isActive()) - { - this.emit(Events.GAME_OUT, event.timeStamp, event); - } - }, - - /** - * The pre-update handler is responsible for checking the pending removal and insertion lists and - * deleting old Game Objects. - * - * @method Phaser.Input.InputPlugin#preUpdate - * @private - * @fires Phaser.Input.Events#PRE_UPDATE - * @since 3.0.0 - */ - preUpdate: function () - { - // Registered input plugins listen for this - this.pluginEvents.emit(Events.PRE_UPDATE); - - var removeList = this._pendingRemoval; - var insertList = this._pendingInsertion; - - var toRemove = removeList.length; - var toInsert = insertList.length; - - if (toRemove === 0 && toInsert === 0) - { - // Quick bail - return; - } - - var current = this._list; - - // Delete old gameObjects - for (var i = 0; i < toRemove; i++) - { - var gameObject = removeList[i]; - - var index = current.indexOf(gameObject); - - if (index > -1) - { - current.splice(index, 1); - - this.clear(gameObject, true); - } - } - - // Clear the removal list - removeList.length = 0; - this._pendingRemoval.length = 0; - - // Move pendingInsertion to list (also clears pendingInsertion at the same time) - this._list = current.concat(insertList.splice(0)); - }, - - /** - * Checks to see if both this plugin and the Scene to which it belongs is active. - * - * @method Phaser.Input.InputPlugin#isActive - * @since 3.10.0 - * - * @return {boolean} `true` if the plugin and the Scene it belongs to is active. - */ - isActive: function () - { - return (this.enabled && this.scene.sys.isActive()); - }, - - /** - * This is called automatically by the Input Manager. - * It emits events for plugins to listen to and also handles polling updates, if enabled. - * - * @method Phaser.Input.InputPlugin#updatePoll - * @since 3.18.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - * - * @return {boolean} `true` if the plugin and the Scene it belongs to is active. - */ - updatePoll: function (time, delta) - { - if (!this.isActive()) - { - return false; - } - - // The plugins should update every frame, regardless if there has been - // any DOM input events or not (such as the Gamepad and Keyboard) - this.pluginEvents.emit(Events.UPDATE, time, delta); - - // We can leave now if we've already updated once this frame via the immediate DOM event handlers - if (this._updatedThisFrame) - { - this._updatedThisFrame = false; - - return false; - } - - var i; - var manager = this.manager; - - var pointers = manager.pointers; - var pointersTotal = manager.pointersTotal; - - for (i = 0; i < pointersTotal; i++) - { - pointers[i].updateMotion(); - } - - // No point going any further if there aren't any interactive objects - if (this._list.length === 0) - { - return false; - } - - var rate = this.pollRate; - - if (rate === -1) - { - return false; - } - else if (rate > 0) - { - this._pollTimer -= delta; - - if (this._pollTimer < 0) - { - // Discard timer diff, we're ready to poll again - this._pollTimer = this.pollRate; - } - else - { - // Not enough time has elapsed since the last poll, so abort now - return false; - } - } - - // We got this far? Then we should poll for movement - var captured = false; - - for (i = 0; i < pointersTotal; i++) - { - var total = 0; - - var pointer = pointers[i]; - - // Always reset this array - this._tempZones = []; - - // _temp contains a hit tested and camera culled list of IO objects - this._temp = this.hitTestPointer(pointer); - - this.sortGameObjects(this._temp, pointer); - this.sortDropZones(this._tempZones); - - if (this.topOnly) - { - // Only the top-most one counts now, so safely ignore the rest - if (this._temp.length) - { - this._temp.splice(1); - } - - if (this._tempZones.length) - { - this._tempZones.splice(1); - } - } - - total += this.processOverOutEvents(pointer); - - if (this.getDragState(pointer) === 2) - { - this.processDragThresholdEvent(pointer, time); - } - - if (total > 0) - { - // We interacted with an event in this Scene, so block any Scenes below us from doing the same this frame - captured = true; - } - } - - return captured; - }, - - /** - * This method is called when a DOM Event is received by the Input Manager. It handles dispatching the events - * to relevant input enabled Game Objects in this scene. - * - * @method Phaser.Input.InputPlugin#update - * @private - * @fires Phaser.Input.Events#UPDATE - * @since 3.0.0 - * - * @param {number} type - The type of event to process. - * @param {Phaser.Input.Pointer[]} pointers - An array of Pointers on which the event occurred. - * - * @return {boolean} `true` if this Scene has captured the input events from all other Scenes, otherwise `false`. - */ - update: function (type, pointers) - { - if (!this.isActive()) - { - return false; - } - - var pointersTotal = pointers.length; - var captured = false; - - for (var i = 0; i < pointersTotal; i++) - { - var total = 0; - var pointer = pointers[i]; - - // Always reset this array - this._tempZones = []; - - // _temp contains a hit tested and camera culled list of IO objects - this._temp = this.hitTestPointer(pointer); - - this.sortGameObjects(this._temp, pointer); - this.sortDropZones(this._tempZones); - - if (this.topOnly) - { - // Only the top-most one counts now, so safely ignore the rest - if (this._temp.length) - { - this._temp.splice(1); - } - - if (this._tempZones.length) - { - this._tempZones.splice(1); - } - } - - switch (type) - { - case CONST.MOUSE_DOWN: - total += this.processDragDownEvent(pointer); - total += this.processDownEvents(pointer); - total += this.processOverOutEvents(pointer); - break; - - case CONST.MOUSE_UP: - total += this.processDragUpEvent(pointer); - total += this.processUpEvents(pointer); - total += this.processOverOutEvents(pointer); - break; - - case CONST.TOUCH_START: - total += this.processDragDownEvent(pointer); - total += this.processDownEvents(pointer); - total += this.processOverEvents(pointer); - break; - - case CONST.TOUCH_END: - case CONST.TOUCH_CANCEL: - total += this.processDragUpEvent(pointer); - total += this.processUpEvents(pointer); - total += this.processOutEvents(pointer); - break; - - case CONST.MOUSE_MOVE: - case CONST.TOUCH_MOVE: - total += this.processDragMoveEvent(pointer); - total += this.processMoveEvents(pointer); - total += this.processOverOutEvents(pointer); - break; - - case CONST.MOUSE_WHEEL: - total += this.processWheelEvent(pointer); - break; - } + this.v1 = 0; - if (total > 0) - { - // We interacted with an event in this Scene, so block any Scenes below us from doing the same this frame - captured = true; + /** + * The un-modified source frame, trim and UV data. + * + * @name Phaser.Textures.Frame#data + * @type {object} + * @private + * @since 3.0.0 + */ + this.data = { + cut: { + x: 0, + y: 0, + w: 0, + h: 0, + r: 0, + b: 0 + }, + trim: false, + sourceSize: { + w: 0, + h: 0 + }, + spriteSourceSize: { + x: 0, + y: 0, + w: 0, + h: 0, + r: 0, + b: 0 + }, + radius: 0, + drawImage: { + x: 0, + y: 0, + width: 0, + height: 0 } - } - - this._updatedThisFrame = true; + }; - return captured; + this.setSize(width, height, x, y); }, /** - * Clears a Game Object so it no longer has an Interactive Object associated with it. - * The Game Object is then queued for removal from the Input Plugin on the next update. + * Sets the width, height, x and y of this Frame. * - * @method Phaser.Input.InputPlugin#clear - * @since 3.0.0 + * This is called automatically by the constructor + * and should rarely be changed on-the-fly. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will have its Interactive Object removed. - * @param {boolean} [skipQueue=false] - Skip adding this Game Object into the removal queue? + * @method Phaser.Textures.Frame#setSize + * @since 3.7.0 * - * @return {Phaser.GameObjects.GameObject} The Game Object that had its Interactive Object removed. + * @param {number} width - The width of the frame before being trimmed. + * @param {number} height - The height of the frame before being trimmed. + * @param {number} [x=0] - The x coordinate of the top-left of this Frame. + * @param {number} [y=0] - The y coordinate of the top-left of this Frame. + * + * @return {this} This Frame object. */ - clear: function (gameObject, skipQueue) + setSize: function (width, height, x, y) { - if (skipQueue === undefined) { skipQueue = false; } - - var input = gameObject.input; - - // If GameObject.input already cleared from higher class - if (!input) - { - return; - } - - if (!skipQueue) - { - this.queueForRemoval(gameObject); - } - - input.gameObject = undefined; - input.target = undefined; - input.hitArea = undefined; - input.hitAreaCallback = undefined; - input.callbackContext = undefined; - - gameObject.input = null; - - // Clear from _draggable, _drag and _over - var index = this._draggable.indexOf(gameObject); + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } - if (index > -1) - { - this._draggable.splice(index, 1); - } + this.cutX = x; + this.cutY = y; + this.cutWidth = width; + this.cutHeight = height; - index = this._drag[0].indexOf(gameObject); + this.width = width; + this.height = height; - if (index > -1) - { - this._drag[0].splice(index, 1); - } + this.halfWidth = Math.floor(width * 0.5); + this.halfHeight = Math.floor(height * 0.5); - index = this._over[0].indexOf(gameObject); + this.centerX = Math.floor(width / 2); + this.centerY = Math.floor(height / 2); - if (index > -1) - { - this._over[0].splice(index, 1); + var data = this.data; + var cut = data.cut; - this.manager.resetCursor(input); - } + cut.x = x; + cut.y = y; + cut.w = width; + cut.h = height; + cut.r = x + width; + cut.b = y + height; - return gameObject; - }, + data.sourceSize.w = width; + data.sourceSize.h = height; - /** - * Disables Input on a single Game Object. - * - * An input disabled Game Object still retains its Interactive Object component and can be re-enabled - * at any time, by passing it to `InputPlugin.enable`. - * - * @method Phaser.Input.InputPlugin#disable - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to have its input system disabled. - */ - disable: function (gameObject) - { - gameObject.input.enabled = false; - }, + data.spriteSourceSize.w = width; + data.spriteSourceSize.h = height; - /** - * Enable a Game Object for interaction. - * - * If the Game Object already has an Interactive Object component, it is enabled and returned. - * - * Otherwise, a new Interactive Object component is created and assigned to the Game Object's `input` property. - * - * Input works by using hit areas, these are nearly always geometric shapes, such as rectangles or circles, that act as the hit area - * for the Game Object. However, you can provide your own hit area shape and callback, should you wish to handle some more advanced - * input detection. - * - * If no arguments are provided it will try and create a rectangle hit area based on the texture frame the Game Object is using. If - * this isn't a texture-bound object, such as a Graphics or BitmapText object, this will fail, and you'll need to provide a specific - * shape for it to use. - * - * You can also provide an Input Configuration Object as the only argument to this method. - * - * @method Phaser.Input.InputPlugin#enable - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to be enabled for input. - * @param {(Phaser.Types.Input.InputConfiguration|any)} [hitArea] - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. - * @param {Phaser.Types.Input.HitAreaCallback} [hitAreaCallback] - The 'contains' function to invoke to check if the pointer is within the hit area. - * @param {boolean} [dropZone=false] - Is this Game Object a drop zone or not? - * - * @return {this} This Input Plugin. - */ - enable: function (gameObject, hitArea, hitAreaCallback, dropZone) - { - if (dropZone === undefined) { dropZone = false; } + data.radius = 0.5 * Math.sqrt(width * width + height * height); - if (gameObject.input) - { - // If it is already has an InteractiveObject then just enable it and return - gameObject.input.enabled = true; - } - else - { - // Create an InteractiveObject and enable it - this.setHitArea(gameObject, hitArea, hitAreaCallback); - } + var drawImage = data.drawImage; - if (gameObject.input && dropZone && !gameObject.input.dropZone) - { - gameObject.input.dropZone = dropZone; - } + drawImage.x = x; + drawImage.y = y; + drawImage.width = width; + drawImage.height = height; - return this; + return this.updateUVs(); }, /** - * Takes the given Pointer and performs a hit test against it, to see which interactive Game Objects - * it is currently above. - * - * The hit test is performed against which-ever Camera the Pointer is over. If it is over multiple - * cameras, it starts checking the camera at the top of the camera list, and if nothing is found, iterates down the list. + * If the frame was trimmed when added to the Texture Atlas, this records the trim and source data. * - * @method Phaser.Input.InputPlugin#hitTestPointer + * @method Phaser.Textures.Frame#setTrim * @since 3.0.0 * - * @param {Phaser.Input.Pointer} pointer - The Pointer to check against the Game Objects. + * @param {number} actualWidth - The width of the frame before being trimmed. + * @param {number} actualHeight - The height of the frame before being trimmed. + * @param {number} destX - The destination X position of the trimmed frame for display. + * @param {number} destY - The destination Y position of the trimmed frame for display. + * @param {number} destWidth - The destination width of the trimmed frame for display. + * @param {number} destHeight - The destination height of the trimmed frame for display. * - * @return {Phaser.GameObjects.GameObject[]} An array of all the interactive Game Objects the Pointer was above. + * @return {this} This Frame object. */ - hitTestPointer: function (pointer) + setTrim: function (actualWidth, actualHeight, destX, destY, destWidth, destHeight) { - var cameras = this.cameras.getCamerasBelowPointer(pointer); + var data = this.data; + var ss = data.spriteSourceSize; - for (var c = 0; c < cameras.length; c++) - { - var camera = cameras[c]; + // Store actual values - // Get a list of all objects that can be seen by the camera below the pointer in the scene and store in 'over' array. - // All objects in this array are input enabled, as checked by the hitTest method, so we don't need to check later on as well. - var over = this.manager.hitTest(pointer, this._list, camera); + data.trim = true; - // Filter out the drop zones - for (var i = 0; i < over.length; i++) - { - var obj = over[i]; + data.sourceSize.w = actualWidth; + data.sourceSize.h = actualHeight; - if (obj.input.dropZone) - { - this._tempZones.push(obj); - } - } + ss.x = destX; + ss.y = destY; + ss.w = destWidth; + ss.h = destHeight; + ss.r = destX + destWidth; + ss.b = destY + destHeight; - if (over.length > 0) - { - pointer.camera = camera; + // Adjust properties + this.x = destX; + this.y = destY; - return over; - } - } + this.width = destWidth; + this.height = destHeight; - // If we got this far then there were no Game Objects below the pointer, but it was still over - // a camera, so set that the top-most one into the pointer + this.halfWidth = destWidth * 0.5; + this.halfHeight = destHeight * 0.5; - pointer.camera = cameras[0]; + this.centerX = Math.floor(destWidth / 2); + this.centerY = Math.floor(destHeight / 2); - return []; + return this.updateUVs(); }, /** - * An internal method that handles the Pointer down event. + * Takes a crop data object and, based on the rectangular region given, calculates the + * required UV coordinates in order to crop this Frame for WebGL and Canvas rendering. * - * @method Phaser.Input.InputPlugin#processDownEvents - * @private - * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_DOWN - * @fires Phaser.Input.Events#GAMEOBJECT_DOWN - * @fires Phaser.Input.Events#POINTER_DOWN - * @fires Phaser.Input.Events#POINTER_DOWN_OUTSIDE - * @since 3.0.0 + * This is called directly by the Game Object Texture Components `setCrop` method. + * Please use that method to crop a Game Object. * - * @param {Phaser.Input.Pointer} pointer - The Pointer being tested. + * @method Phaser.Textures.Frame#setCropUVs + * @since 3.11.0 * - * @return {number} The total number of objects interacted with. + * @param {object} crop - The crop data object. This is the `GameObject._crop` property. + * @param {number} x - The x coordinate to start the crop from. Cannot be negative or exceed the Frame width. + * @param {number} y - The y coordinate to start the crop from. Cannot be negative or exceed the Frame height. + * @param {number} width - The width of the crop rectangle. Cannot exceed the Frame width. + * @param {number} height - The height of the crop rectangle. Cannot exceed the Frame height. + * @param {boolean} flipX - Does the parent Game Object have flipX set? + * @param {boolean} flipY - Does the parent Game Object have flipY set? + * + * @return {object} The updated crop data object. */ - processDownEvents: function (pointer) + setCropUVs: function (crop, x, y, width, height, flipX, flipY) { - var total = 0; - var currentlyOver = this._temp; + // Clamp the input values - var _eventData = this._eventData; - var _eventContainer = this._eventContainer; + var cx = this.cutX; + var cy = this.cutY; + var cw = this.cutWidth; + var ch = this.cutHeight; + var rw = this.realWidth; + var rh = this.realHeight; - _eventData.cancelled = false; + x = Clamp(x, 0, rw); + y = Clamp(y, 0, rh); - var aborted = false; + width = Clamp(width, 0, rw - x); + height = Clamp(height, 0, rh - y); - // Go through all objects the pointer was over and fire their events / callbacks - for (var i = 0; i < currentlyOver.length; i++) + var ox = cx + x; + var oy = cy + y; + var ow = width; + var oh = height; + + var data = this.data; + + if (data.trim) { - var gameObject = currentlyOver[i]; + var ss = data.spriteSourceSize; - if (!gameObject.input) - { - continue; - } + // Need to check for intersection between the cut area and the crop area + // If there is none, we set UV to be empty, otherwise set it to be the intersection area - total++; + width = Clamp(width, 0, cw - x); + height = Clamp(height, 0, ch - y); - gameObject.emit(Events.GAMEOBJECT_POINTER_DOWN, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + var cropRight = x + width; + var cropBottom = y + height; - if (_eventData.cancelled || !gameObject.input) + var intersects = !(ss.r < x || ss.b < y || ss.x > cropRight || ss.y > cropBottom); + + if (intersects) { - aborted = true; - break; - } + var ix = Math.max(ss.x, x); + var iy = Math.max(ss.y, y); + var iw = Math.min(ss.r, cropRight) - ix; + var ih = Math.min(ss.b, cropBottom) - iy; - this.emit(Events.GAMEOBJECT_DOWN, pointer, gameObject, _eventContainer); + ow = iw; + oh = ih; - if (_eventData.cancelled || !gameObject.input) + if (flipX) + { + ox = cx + (cw - (ix - ss.x) - iw); + } + else + { + ox = cx + (ix - ss.x); + } + + if (flipY) + { + oy = cy + (ch - (iy - ss.y) - ih); + } + else + { + oy = cy + (iy - ss.y); + } + + x = ix; + y = iy; + + width = iw; + height = ih; + } + else { - aborted = true; - break; + ox = 0; + oy = 0; + ow = 0; + oh = 0; } } - - // If they released outside the canvas, but pressed down inside it, we'll still dispatch the event. - if (!aborted && this.manager) + else { - if (pointer.downElement === this.manager.game.canvas) + if (flipX) { - this.emit(Events.POINTER_DOWN, pointer, currentlyOver); + ox = cx + (cw - x - width); } - else + + if (flipY) { - this.emit(Events.POINTER_DOWN_OUTSIDE, pointer); + oy = cy + (ch - y - height); } } - return total; + var tw = this.source.width; + var th = this.source.height; + + // Map the given coordinates into UV space, clamping to the 0-1 range. + + crop.u0 = Math.max(0, ox / tw); + crop.v0 = Math.max(0, oy / th); + crop.u1 = Math.min(1, (ox + ow) / tw); + crop.v1 = Math.min(1, (oy + oh) / th); + + crop.x = x; + crop.y = y; + + crop.cx = ox; + crop.cy = oy; + crop.cw = ow; + crop.ch = oh; + + crop.width = width; + crop.height = height; + + crop.flipX = flipX; + crop.flipY = flipY; + + return crop; }, /** - * Returns the drag state of the given Pointer for this Input Plugin. - * - * The state will be one of the following: - * - * 0 = Not dragging anything - * 1 = Primary button down and objects below, so collect a draglist - * 2 = Pointer being checked if meets drag criteria - * 3 = Pointer meets criteria, notify the draglist - * 4 = Pointer actively dragging the draglist and has moved - * 5 = Pointer actively dragging but has been released, notify draglist + * Takes a crop data object and recalculates the UVs based on the dimensions inside the crop object. + * Called automatically by `setFrame`. * - * @method Phaser.Input.InputPlugin#getDragState - * @since 3.16.0 + * @method Phaser.Textures.Frame#updateCropUVs + * @since 3.11.0 * - * @param {Phaser.Input.Pointer} pointer - The Pointer to get the drag state for. + * @param {object} crop - The crop data object. This is the `GameObject._crop` property. + * @param {boolean} flipX - Does the parent Game Object have flipX set? + * @param {boolean} flipY - Does the parent Game Object have flipY set? * - * @return {number} The drag state of the given Pointer. + * @return {object} The updated crop data object. */ - getDragState: function (pointer) + updateCropUVs: function (crop, flipX, flipY) { - return this._dragState[pointer.id]; + return this.setCropUVs(crop, crop.x, crop.y, crop.width, crop.height, flipX, flipY); }, /** - * Sets the drag state of the given Pointer for this Input Plugin. + * Directly sets the canvas and WebGL UV data for this frame. * - * The state must be one of the following values: + * Use this if you need to override the values that are generated automatically + * when the Frame is created. * - * 0 = Not dragging anything - * 1 = Primary button down and objects below, so collect a draglist - * 2 = Pointer being checked if meets drag criteria - * 3 = Pointer meets criteria, notify the draglist - * 4 = Pointer actively dragging the draglist and has moved - * 5 = Pointer actively dragging but has been released, notify draglist + * @method Phaser.Textures.Frame#setUVs + * @since 3.50.0 * - * @method Phaser.Input.InputPlugin#setDragState - * @since 3.16.0 + * @param {number} width - Width of this frame for the Canvas data. + * @param {number} height - Height of this frame for the Canvas data. + * @param {number} u0 - UV u0 value. + * @param {number} v0 - UV v0 value. + * @param {number} u1 - UV u1 value. + * @param {number} v1 - UV v1 value. * - * @param {Phaser.Input.Pointer} pointer - The Pointer to set the drag state for. - * @param {number} state - The drag state value. An integer between 0 and 5. + * @return {this} This Frame object. */ - setDragState: function (pointer, state) + setUVs: function (width, height, u0, v0, u1, v1) { - this._dragState[pointer.id] = state; + // Canvas data + + var cd = this.data.drawImage; + + cd.width = width; + cd.height = height; + + // WebGL data + + this.u0 = u0; + this.v0 = v0; + + this.u1 = u1; + this.v1 = v1; + + return this; }, /** - * Checks to see if a Pointer is ready to drag the objects below it, based on either a distance - * or time threshold. + * Updates the internal WebGL UV cache and the drawImage cache. * - * @method Phaser.Input.InputPlugin#processDragThresholdEvent - * @private - * @since 3.18.0 + * @method Phaser.Textures.Frame#updateUVs + * @since 3.0.0 * - * @param {Phaser.Input.Pointer} pointer - The Pointer to check the drag thresholds on. - * @param {number} time - The current time. + * @return {this} This Frame object. */ - processDragThresholdEvent: function (pointer, time) + updateUVs: function () { - var passed = false; - var timeThreshold = this.dragTimeThreshold; - var distanceThreshold = this.dragDistanceThreshold; + var cx = this.cutX; + var cy = this.cutY; + var cw = this.cutWidth; + var ch = this.cutHeight; - if (distanceThreshold > 0 && DistanceBetween(pointer.x, pointer.y, pointer.downX, pointer.downY) >= distanceThreshold) - { - // It has moved far enough to be considered a drag - passed = true; - } - else if (timeThreshold > 0 && (time >= pointer.downTime + timeThreshold)) - { - // It has been held down long enough to be considered a drag - passed = true; - } + // Canvas data - if (passed) - { - this.setDragState(pointer, 3); + var cd = this.data.drawImage; - return this.processDragStartList(pointer); - } + cd.width = cw; + cd.height = ch; + + // WebGL data + + var tw = this.source.width; + var th = this.source.height; + + this.u0 = cx / tw; + this.v0 = cy / th; + + this.u1 = (cx + cw) / tw; + this.v1 = (cy + ch) / th; + + return this; }, /** - * Processes the drag list for the given pointer and dispatches the start events for each object on it. - * - * @method Phaser.Input.InputPlugin#processDragStartList - * @private - * @fires Phaser.Input.Events#DRAG_START - * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_START - * @since 3.18.0 + * Updates the internal WebGL UV cache. * - * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. + * @method Phaser.Textures.Frame#updateUVsInverted + * @since 3.0.0 * - * @return {number} The number of items that DRAG_START was called on. + * @return {this} This Frame object. */ - processDragStartList: function (pointer) + updateUVsInverted: function () { - // 3 = Pointer meets criteria and is freshly down, notify the draglist - if (this.getDragState(pointer) !== 3) - { - return 0; - } + var tw = this.source.width; + var th = this.source.height; - var list = this._drag[pointer.id]; + this.u0 = (this.cutX + this.cutHeight) / tw; + this.v0 = this.cutY / th; - for (var i = 0; i < list.length; i++) - { - var gameObject = list[i]; + this.u1 = this.cutX / tw; + this.v1 = (this.cutY + this.cutWidth) / th; - var input = gameObject.input; + return this; + }, - input.dragState = 2; + /** + * Clones this Frame into a new Frame object. + * + * @method Phaser.Textures.Frame#clone + * @since 3.0.0 + * + * @return {Phaser.Textures.Frame} A clone of this Frame. + */ + clone: function () + { + var clone = new Frame(this.texture, this.name, this.sourceIndex); - input.dragStartX = gameObject.x; - input.dragStartY = gameObject.y; + clone.cutX = this.cutX; + clone.cutY = this.cutY; + clone.cutWidth = this.cutWidth; + clone.cutHeight = this.cutHeight; - input.dragStartXGlobal = pointer.worldX; - input.dragStartYGlobal = pointer.worldY; + clone.x = this.x; + clone.y = this.y; - input.dragX = input.dragStartXGlobal - input.dragStartX; - input.dragY = input.dragStartYGlobal - input.dragStartY; + clone.width = this.width; + clone.height = this.height; - gameObject.emit(Events.GAMEOBJECT_DRAG_START, pointer, input.dragX, input.dragY); + clone.halfWidth = this.halfWidth; + clone.halfHeight = this.halfHeight; - this.emit(Events.DRAG_START, pointer, gameObject); - } + clone.centerX = this.centerX; + clone.centerY = this.centerY; - this.setDragState(pointer, 4); + clone.rotated = this.rotated; - return list.length; + clone.data = Extend(true, clone.data, this.data); + + clone.updateUVs(); + + return clone; }, /** - * Processes a 'drag down' event for the given pointer. Checks the pointer state, builds-up the drag list - * and prepares them all for interaction. - * - * @method Phaser.Input.InputPlugin#processDragDownEvent - * @private - * @since 3.18.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. + * Destroys this Frame by nulling its reference to the parent Texture and and data objects. * - * @return {number} The number of items that were collected on the drag list. + * @method Phaser.Textures.Frame#destroy + * @since 3.0.0 */ - processDragDownEvent: function (pointer) + destroy: function () { - var currentlyOver = this._temp; + this.source = null; + this.texture = null; + this.glTexture = null; + this.customData = null; + this.data = null; + }, - if (this._draggable.length === 0 || currentlyOver.length === 0 || !pointer.primaryDown || this.getDragState(pointer) !== 0) + /** + * The width of the Frame in its un-trimmed, un-padded state, as prepared in the art package, + * before being packed. + * + * @name Phaser.Textures.Frame#realWidth + * @type {number} + * @readonly + * @since 3.0.0 + */ + realWidth: { + + get: function () { - // There are no draggable items, no over items or the pointer isn't down, so let's not even bother going further - return 0; + return this.data.sourceSize.w; } - // 1 = Primary button down and objects below, so collect a draglist - this.setDragState(pointer, 1); - - // Get draggable objects, sort them, pick the top (or all) and store them somewhere - var draglist = []; - - for (var i = 0; i < currentlyOver.length; i++) - { - var gameObject = currentlyOver[i]; + }, - if (gameObject.input.draggable && (gameObject.input.dragState === 0)) - { - draglist.push(gameObject); - } - } + /** + * The height of the Frame in its un-trimmed, un-padded state, as prepared in the art package, + * before being packed. + * + * @name Phaser.Textures.Frame#realHeight + * @type {number} + * @readonly + * @since 3.0.0 + */ + realHeight: { - if (draglist.length === 0) + get: function () { - this.setDragState(pointer, 0); - - return 0; + return this.data.sourceSize.h; } - else if (draglist.length > 1) - { - this.sortGameObjects(draglist, pointer); - if (this.topOnly) - { - draglist.splice(1); - } - } + }, - // draglist now contains all potential candidates for dragging - this._drag[pointer.id] = draglist; + /** + * The radius of the Frame (derived from sqrt(w * w + h * h) / 2) + * + * @name Phaser.Textures.Frame#radius + * @type {number} + * @readonly + * @since 3.0.0 + */ + radius: { - if (this.dragDistanceThreshold === 0 && this.dragTimeThreshold === 0) + get: function () { - // No drag criteria, so snap immediately to mode 3 - this.setDragState(pointer, 3); - - return this.processDragStartList(pointer); + return this.data.radius; } - else - { - // Check the distance / time on the next event - this.setDragState(pointer, 2); - return 0; - } }, /** - * Processes a 'drag move' event for the given pointer. - * - * @method Phaser.Input.InputPlugin#processDragMoveEvent - * @private - * @fires Phaser.Input.Events#DRAG_ENTER - * @fires Phaser.Input.Events#DRAG - * @fires Phaser.Input.Events#DRAG_LEAVE - * @fires Phaser.Input.Events#DRAG_OVER - * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_ENTER - * @fires Phaser.Input.Events#GAMEOBJECT_DRAG - * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_LEAVE - * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_OVER - * @since 3.18.0 - * - * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. + * Is the Frame trimmed or not? * - * @return {number} The number of items that were updated by this drag event. + * @name Phaser.Textures.Frame#trimmed + * @type {boolean} + * @readonly + * @since 3.0.0 */ - processDragMoveEvent: function (pointer) - { - // 2 = Pointer being checked if meets drag criteria - if (this.getDragState(pointer) === 2) - { - this.processDragThresholdEvent(pointer, this.manager.game.loop.now); - } + trimmed: { - if (this.getDragState(pointer) !== 4) + get: function () { - return 0; + return this.data.trim; } - // 4 = Pointer actively dragging the draglist and has moved - var dropZones = this._tempZones; + }, - var list = this._drag[pointer.id]; + /** + * The Canvas drawImage data object. + * + * @name Phaser.Textures.Frame#canvasData + * @type {object} + * @readonly + * @since 3.0.0 + */ + canvasData: { - for (var i = 0; i < list.length; i++) + get: function () { - var gameObject = list[i]; - - var input = gameObject.input; + return this.data.drawImage; + } - var target = input.target; + } - // If this GO has a target then let's check it - if (target) - { - var index = dropZones.indexOf(target); +}); - // Got a target, are we still over it? - if (index === 0) - { - // We're still over it, and it's still the top of the display list, phew ... - gameObject.emit(Events.GAMEOBJECT_DRAG_OVER, pointer, target); +module.exports = Frame; - this.emit(Events.DRAG_OVER, pointer, gameObject, target); - } - else if (index > 0) - { - // Still over it but it's no longer top of the display list (targets must always be at the top) - gameObject.emit(Events.GAMEOBJECT_DRAG_LEAVE, pointer, target); - this.emit(Events.DRAG_LEAVE, pointer, gameObject, target); +/***/ }), - input.target = dropZones[0]; +/***/ 31673: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - target = input.target; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, target); +var Class = __webpack_require__(56694); +var Frame = __webpack_require__(82047); +var TextureSource = __webpack_require__(32547); - this.emit(Events.DRAG_ENTER, pointer, gameObject, target); - } - else - { - // Nope, we've moved on (or the target has!), leave the old target - gameObject.emit(Events.GAMEOBJECT_DRAG_LEAVE, pointer, target); +var TEXTURE_MISSING_ERROR = 'Texture "%s" has no frame "%s"'; - this.emit(Events.DRAG_LEAVE, pointer, gameObject, target); +/** + * @classdesc + * A Texture consists of a source, usually an Image from the Cache, and a collection of Frames. + * The Frames represent the different areas of the Texture. For example a texture atlas + * may have many Frames, one for each element within the atlas. Where-as a single image would have + * just one frame, that encompasses the whole image. + * + * Every Texture, no matter where it comes from, always has at least 1 frame called the `__BASE` frame. + * This frame represents the entirety of the source image. + * + * Textures are managed by the global TextureManager. This is a singleton class that is + * responsible for creating and delivering Textures and their corresponding Frames to Game Objects. + * + * Sprites and other Game Objects get the texture data they need from the TextureManager. + * + * @class Texture + * @memberof Phaser.Textures + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Textures.TextureManager} manager - A reference to the Texture Manager this Texture belongs to. + * @param {string} key - The unique string-based key of this Texture. + * @param {(HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[])} source - An array of sources that are used to create the texture. Usually Images, but can also be a Canvas. + * @param {number} [width] - The width of the Texture. This is optional and automatically derived from the source images. + * @param {number} [height] - The height of the Texture. This is optional and automatically derived from the source images. + */ +var Texture = new Class({ - // Anything new to replace it? - // Yup! - if (dropZones[0]) - { - input.target = dropZones[0]; + initialize: - target = input.target; + function Texture (manager, key, source, width, height) + { + if (!Array.isArray(source)) + { + source = [ source ]; + } - gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, target); + /** + * A reference to the Texture Manager this Texture belongs to. + * + * @name Phaser.Textures.Texture#manager + * @type {Phaser.Textures.TextureManager} + * @since 3.0.0 + */ + this.manager = manager; - this.emit(Events.DRAG_ENTER, pointer, gameObject, target); - } - else - { - // Nope - input.target = null; - } - } - } - else if (!target && dropZones[0]) - { - input.target = dropZones[0]; + /** + * The unique string-based key of this Texture. + * + * @name Phaser.Textures.Texture#key + * @type {string} + * @since 3.0.0 + */ + this.key = key; - target = input.target; + /** + * An array of TextureSource instances. + * These are unique to this Texture and contain the actual Image (or Canvas) data. + * + * @name Phaser.Textures.Texture#source + * @type {Phaser.Textures.TextureSource[]} + * @since 3.0.0 + */ + this.source = []; - gameObject.emit(Events.GAMEOBJECT_DRAG_ENTER, pointer, target); + /** + * An array of TextureSource data instances. + * Used to store additional data images, such as normal maps or specular maps. + * + * @name Phaser.Textures.Texture#dataSource + * @type {array} + * @since 3.0.0 + */ + this.dataSource = []; - this.emit(Events.DRAG_ENTER, pointer, gameObject, target); - } + /** + * A key-value object pair associating the unique Frame keys with the Frames objects. + * + * @name Phaser.Textures.Texture#frames + * @type {object} + * @since 3.0.0 + */ + this.frames = {}; - var dragX; - var dragY; + /** + * Any additional data that was set in the source JSON (if any), + * or any extra data you'd like to store relating to this texture + * + * @name Phaser.Textures.Texture#customData + * @type {object} + * @since 3.0.0 + */ + this.customData = {}; - if (!gameObject.parentContainer) - { - dragX = pointer.worldX - input.dragX; - dragY = pointer.worldY - input.dragY; - } - else - { - var dx = pointer.worldX - input.dragStartXGlobal; - var dy = pointer.worldY - input.dragStartYGlobal; + /** + * The name of the first frame of the Texture. + * + * @name Phaser.Textures.Texture#firstFrame + * @type {string} + * @since 3.0.0 + */ + this.firstFrame = '__BASE'; - var rotation = gameObject.getParentRotation(); + /** + * The total number of Frames in this Texture, including the `__BASE` frame. + * + * A Texture will always contain at least 1 frame because every Texture contains a `__BASE` frame by default, + * in addition to any extra frames that have been added to it, such as when parsing a Sprite Sheet or Texture Atlas. + * + * @name Phaser.Textures.Texture#frameTotal + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.frameTotal = 0; - var dxRotated = dx * Math.cos(rotation) + dy * Math.sin(rotation); - var dyRotated = dy * Math.cos(rotation) - dx * Math.sin(rotation); + // Load the Sources + for (var i = 0; i < source.length; i++) + { + this.source.push(new TextureSource(this, source[i], width, height)); + } + }, - dxRotated *= (1 / gameObject.parentContainer.scaleX); - dyRotated *= (1 / gameObject.parentContainer.scaleY); + /** + * Adds a new Frame to this Texture. + * + * A Frame is a rectangular region of a TextureSource with a unique index or string-based key. + * + * The name given must be unique within this Texture. If it already exists, this method will return `null`. + * + * @method Phaser.Textures.Texture#add + * @since 3.0.0 + * + * @param {(number|string)} name - The name of this Frame. The name is unique within the Texture. + * @param {number} sourceIndex - The index of the TextureSource that this Frame is a part of. + * @param {number} x - The x coordinate of the top-left of this Frame. + * @param {number} y - The y coordinate of the top-left of this Frame. + * @param {number} width - The width of this Frame. + * @param {number} height - The height of this Frame. + * + * @return {?Phaser.Textures.Frame} The Frame that was added to this Texture, or `null` if the given name already exists. + */ + add: function (name, sourceIndex, x, y, width, height) + { + if (this.has(name)) + { + return null; + } - dragX = dxRotated + input.dragStartX; - dragY = dyRotated + input.dragStartY; - } + var frame = new Frame(this, name, sourceIndex, x, y, width, height); - gameObject.emit(Events.GAMEOBJECT_DRAG, pointer, dragX, dragY); + this.frames[name] = frame; - this.emit(Events.DRAG, pointer, gameObject, dragX, dragY); + // Set the first frame of the Texture (other than __BASE) + // This is used to ensure we don't spam the display with entire + // atlases of sprite sheets, but instead just the first frame of them + // should the dev incorrectly specify the frame index + if (this.firstFrame === '__BASE') + { + this.firstFrame = name; } - return list.length; + this.frameTotal++; + + return frame; }, /** - * Processes a 'drag down' event for the given pointer. Checks the pointer state, builds-up the drag list - * and prepares them all for interaction. + * Removes the given Frame from this Texture. The Frame is destroyed immediately. * - * @method Phaser.Input.InputPlugin#processDragUpEvent - * @fires Phaser.Input.Events#DRAG_END - * @fires Phaser.Input.Events#DROP - * @fires Phaser.Input.Events#GAMEOBJECT_DRAG_END - * @fires Phaser.Input.Events#GAMEOBJECT_DROP - * @private - * @since 3.18.0 + * Any Game Objects using this Frame should stop using it _before_ you remove it, + * as it does not happen automatically. * - * @param {Phaser.Input.Pointer} pointer - The Pointer to process the drag event on. + * @method Phaser.Textures.Texture#remove + * @since 3.19.0 * - * @return {number} The number of items that were updated by this drag event. + * @param {string} name - The key of the Frame to remove. + * + * @return {boolean} True if a Frame with the matching key was removed from this Texture. */ - processDragUpEvent: function (pointer) + remove: function (name) { - // 5 = Pointer was actively dragging but has been released, notify draglist - var list = this._drag[pointer.id]; - - for (var i = 0; i < list.length; i++) + if (this.has(name)) { - var gameObject = list[i]; - - var input = gameObject.input; - - if (input && input.dragState === 2) - { - input.dragState = 0; - - input.dragX = input.localX - gameObject.displayOriginX; - input.dragY = input.localY - gameObject.displayOriginY; + var frame = this.get(name); - var dropped = false; + frame.destroy(); - var target = input.target; + delete this.frames[name]; - if (target) - { - gameObject.emit(Events.GAMEOBJECT_DROP, pointer, target); + return true; + } - this.emit(Events.DROP, pointer, gameObject, target); + return false; + }, - input.target = null; + /** + * Checks to see if a Frame matching the given key exists within this Texture. + * + * @method Phaser.Textures.Texture#has + * @since 3.0.0 + * + * @param {string} name - The key of the Frame to check for. + * + * @return {boolean} True if a Frame with the matching key exists in this Texture. + */ + has: function (name) + { + return this.frames.hasOwnProperty(name); + }, - dropped = true; - } + /** + * Gets a Frame from this Texture based on either the key or the index of the Frame. + * + * In a Texture Atlas Frames are typically referenced by a key. + * In a Sprite Sheet Frames are referenced by an index. + * Passing no value for the name returns the base texture. + * + * @method Phaser.Textures.Texture#get + * @since 3.0.0 + * + * @param {(string|number)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. + * + * @return {Phaser.Textures.Frame} The Texture Frame. + */ + get: function (name) + { + // null, undefined, empty string, zero + if (!name) + { + name = this.firstFrame; + } - // And finally the dragend event + var frame = this.frames[name]; - if (gameObject.input) - { - gameObject.emit(Events.GAMEOBJECT_DRAG_END, pointer, input.dragX, input.dragY, dropped); + if (!frame) + { + console.warn(TEXTURE_MISSING_ERROR, this.key, name); - this.emit(Events.DRAG_END, pointer, gameObject, dropped); - } - } + frame = this.frames[this.firstFrame]; } - this.setDragState(pointer, 0); - - list.splice(0); - - return 0; + return frame; }, /** - * An internal method that handles the Pointer movement event. + * Takes the given TextureSource and returns the index of it within this Texture. + * If it's not in this Texture, it returns -1. + * Unless this Texture has multiple TextureSources, such as with a multi-atlas, this + * method will always return zero or -1. * - * @method Phaser.Input.InputPlugin#processMoveEvents - * @private - * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_MOVE - * @fires Phaser.Input.Events#GAMEOBJECT_MOVE - * @fires Phaser.Input.Events#POINTER_MOVE + * @method Phaser.Textures.Texture#getTextureSourceIndex * @since 3.0.0 * - * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. + * @param {Phaser.Textures.TextureSource} source - The TextureSource to check. * - * @return {number} The total number of objects interacted with. + * @return {number} The index of the TextureSource within this Texture, or -1 if not in this Texture. */ - processMoveEvents: function (pointer) + getTextureSourceIndex: function (source) { - var total = 0; - var currentlyOver = this._temp; - - var _eventData = this._eventData; - var _eventContainer = this._eventContainer; - - _eventData.cancelled = false; - - var aborted = false; - - // Go through all objects the pointer was over and fire their events / callbacks - for (var i = 0; i < currentlyOver.length; i++) + for (var i = 0; i < this.source.length; i++) { - var gameObject = currentlyOver[i]; - - if (!gameObject.input) - { - continue; - } - - total++; - - gameObject.emit(Events.GAMEOBJECT_POINTER_MOVE, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); - - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } - - this.emit(Events.GAMEOBJECT_MOVE, pointer, gameObject, _eventContainer); - - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } - - if (this.topOnly) + if (this.source[i] === source) { - break; + return i; } } - if (!aborted) - { - this.emit(Events.POINTER_MOVE, pointer, currentlyOver); - } - - return total; + return -1; }, /** - * An internal method that handles a mouse wheel event. + * Returns an array of all the Frames in the given TextureSource. * - * @method Phaser.Input.InputPlugin#processWheelEvent - * @private - * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_WHEEL - * @fires Phaser.Input.Events#GAMEOBJECT_WHEEL - * @fires Phaser.Input.Events#POINTER_WHEEL - * @since 3.18.0 + * @method Phaser.Textures.Texture#getFramesFromTextureSource + * @since 3.0.0 * - * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. + * @param {number} sourceIndex - The index of the TextureSource to get the Frames from. + * @param {boolean} [includeBase=false] - Include the `__BASE` Frame in the output array? * - * @return {number} The total number of objects interacted with. + * @return {Phaser.Textures.Frame[]} An array of Texture Frames. */ - processWheelEvent: function (pointer) + getFramesFromTextureSource: function (sourceIndex, includeBase) { - var total = 0; - var currentlyOver = this._temp; - - var _eventData = this._eventData; - var _eventContainer = this._eventContainer; - - _eventData.cancelled = false; - - var aborted = false; + if (includeBase === undefined) { includeBase = false; } - var dx = pointer.deltaX; - var dy = pointer.deltaY; - var dz = pointer.deltaZ; + var out = []; - // Go through all objects the pointer was over and fire their events / callbacks - for (var i = 0; i < currentlyOver.length; i++) + for (var frameName in this.frames) { - var gameObject = currentlyOver[i]; - - if (!gameObject.input) + if (frameName === '__BASE' && !includeBase) { continue; } - total++; - - gameObject.emit(Events.GAMEOBJECT_POINTER_WHEEL, pointer, dx, dy, dz, _eventContainer); - - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } - - this.emit(Events.GAMEOBJECT_WHEEL, pointer, gameObject, dx, dy, dz, _eventContainer); + var frame = this.frames[frameName]; - if (_eventData.cancelled || !gameObject.input) + if (frame.sourceIndex === sourceIndex) { - aborted = true; - break; + out.push(frame); } } - if (!aborted) - { - this.emit(Events.POINTER_WHEEL, pointer, currentlyOver, dx, dy, dz); - } - - return total; + return out; }, /** - * An internal method that handles the Pointer over events. - * This is called when a touch input hits the canvas, having previously been off of it. + * Returns an array with all of the names of the Frames in this Texture. * - * @method Phaser.Input.InputPlugin#processOverEvents - * @private - * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OVER - * @fires Phaser.Input.Events#GAMEOBJECT_OVER - * @fires Phaser.Input.Events#POINTER_OVER - * @since 3.18.0 + * Useful if you want to randomly assign a Frame to a Game Object, as you can + * pick a random element from the returned array. * - * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. + * @method Phaser.Textures.Texture#getFrameNames + * @since 3.0.0 * - * @return {number} The total number of objects interacted with. + * @param {boolean} [includeBase=false] - Include the `__BASE` Frame in the output array? + * + * @return {string[]} An array of all Frame names in this Texture. */ - processOverEvents: function (pointer) + getFrameNames: function (includeBase) { - var currentlyOver = this._temp; - - var totalInteracted = 0; - - var total = currentlyOver.length; + if (includeBase === undefined) { includeBase = false; } - var justOver = []; + var out = Object.keys(this.frames); - if (total > 0) + if (!includeBase) { - var manager = this.manager; - - var _eventData = this._eventData; - var _eventContainer = this._eventContainer; - - _eventData.cancelled = false; - - var aborted = false; - - for (var i = 0; i < total; i++) - { - var gameObject = currentlyOver[i]; - - if (!gameObject.input) - { - continue; - } - - justOver.push(gameObject); - - manager.setCursor(gameObject.input); - - gameObject.emit(Events.GAMEOBJECT_POINTER_OVER, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); - - totalInteracted++; - - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } - - this.emit(Events.GAMEOBJECT_OVER, pointer, gameObject, _eventContainer); - - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } - } + var idx = out.indexOf('__BASE'); - if (!aborted) + if (idx !== -1) { - this.emit(Events.POINTER_OVER, pointer, justOver); + out.splice(idx, 1); } } - // Then sort it into display list order - this._over[pointer.id] = justOver; - - return totalInteracted; + return out; }, /** - * An internal method that handles the Pointer out events. - * This is called when a touch input leaves the canvas, as it can never be 'over' in this case. + * Given a Frame name, return the source image it uses to render with. * - * @method Phaser.Input.InputPlugin#processOutEvents - * @private - * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OUT - * @fires Phaser.Input.Events#GAMEOBJECT_OUT - * @fires Phaser.Input.Events#POINTER_OUT - * @since 3.18.0 + * This will return the actual DOM Image or Canvas element. * - * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. + * @method Phaser.Textures.Texture#getSourceImage + * @since 3.0.0 * - * @return {number} The total number of objects interacted with. + * @param {(string|number)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. + * + * @return {(HTMLImageElement|HTMLCanvasElement|Phaser.GameObjects.RenderTexture)} The DOM Image, Canvas Element or Render Texture. */ - processOutEvents: function (pointer) + getSourceImage: function (name) { - var previouslyOver = this._over[pointer.id]; - - var totalInteracted = 0; - - var total = previouslyOver.length; - - if (total > 0) + if (name === undefined || name === null || this.frameTotal === 1) { - var manager = this.manager; - - var _eventData = this._eventData; - var _eventContainer = this._eventContainer; - - _eventData.cancelled = false; - - var aborted = false; - - this.sortGameObjects(previouslyOver, pointer); + name = '__BASE'; + } - for (var i = 0; i < total; i++) - { - var gameObject = previouslyOver[i]; + var frame = this.frames[name]; - // Call onOut for everything in the previouslyOver array - gameObject = previouslyOver[i]; + if (frame) + { + return frame.source.image; + } + else + { + console.warn(TEXTURE_MISSING_ERROR, this.key, name); - if (!gameObject.input) - { - continue; - } + return this.frames['__BASE'].source.image; + } + }, - manager.resetCursor(gameObject.input); + /** + * Given a Frame name, return the data source image it uses to render with. + * You can use this to get the normal map for an image for example. + * + * This will return the actual DOM Image. + * + * @method Phaser.Textures.Texture#getDataSourceImage + * @since 3.7.0 + * + * @param {(string|number)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture. + * + * @return {(HTMLImageElement|HTMLCanvasElement)} The DOM Image or Canvas Element. + */ + getDataSourceImage: function (name) + { + if (name === undefined || name === null || this.frameTotal === 1) + { + name = '__BASE'; + } - gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, _eventContainer); + var frame = this.frames[name]; + var idx; - totalInteracted++; + if (!frame) + { + console.warn(TEXTURE_MISSING_ERROR, this.key, name); - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } + idx = this.frames['__BASE'].sourceIndex; + } + else + { + idx = frame.sourceIndex; + } - this.emit(Events.GAMEOBJECT_OUT, pointer, gameObject, _eventContainer); + return this.dataSource[idx].image; + }, - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } + /** + * Adds a data source image to this Texture. + * + * An example of a data source image would be a normal map, where all of the Frames for this Texture + * equally apply to the normal map. + * + * @method Phaser.Textures.Texture#setDataSource + * @since 3.0.0 + * + * @param {(HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[])} data - The source image. + */ + setDataSource: function (data) + { + if (!Array.isArray(data)) + { + data = [ data ]; + } - if (!aborted) - { - this.emit(Events.POINTER_OUT, pointer, previouslyOver); - } - } + for (var i = 0; i < data.length; i++) + { + var source = this.source[i]; - this._over[pointer.id] = []; + this.dataSource.push(new TextureSource(this, data[i], source.width, source.height)); } - - return totalInteracted; }, /** - * An internal method that handles the Pointer over and out events. + * Sets the Filter Mode for this Texture. * - * @method Phaser.Input.InputPlugin#processOverOutEvents - * @private - * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OVER - * @fires Phaser.Input.Events#GAMEOBJECT_OVER - * @fires Phaser.Input.Events#POINTER_OVER - * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_OUT - * @fires Phaser.Input.Events#GAMEOBJECT_OUT - * @fires Phaser.Input.Events#POINTER_OUT - * @since 3.0.0 + * The mode can be either Linear, the default, or Nearest. * - * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. + * For pixel-art you should use Nearest. * - * @return {number} The total number of objects interacted with. + * The mode applies to the entire Texture, not just a specific Frame of it. + * + * @method Phaser.Textures.Texture#setFilter + * @since 3.0.0 + * + * @param {Phaser.Textures.FilterMode} filterMode - The Filter Mode. */ - processOverOutEvents: function (pointer) + setFilter: function (filterMode) { - var currentlyOver = this._temp; - var i; - var gameObject; - var justOut = []; - var justOver = []; - var stillOver = []; - var previouslyOver = this._over[pointer.id]; - var currentlyDragging = this._drag[pointer.id]; - var manager = this.manager; - - // Go through all objects the pointer was previously over, and see if it still is. - // Splits the previouslyOver array into two parts: justOut and stillOver + for (i = 0; i < this.source.length; i++) + { + this.source[i].setFilter(filterMode); + } - for (i = 0; i < previouslyOver.length; i++) + for (i = 0; i < this.dataSource.length; i++) { - gameObject = previouslyOver[i]; + this.dataSource[i].setFilter(filterMode); + } + }, - if (currentlyOver.indexOf(gameObject) === -1 && currentlyDragging.indexOf(gameObject) === -1) + /** + * Destroys this Texture and releases references to its sources and frames. + * + * @method Phaser.Textures.Texture#destroy + * @since 3.0.0 + */ + destroy: function () + { + var i; + var source = this.source; + var dataSource = this.dataSource; + + for (i = 0; i < source.length; i++) + { + if (source[i]) { - // Not in the currentlyOver array, so must be outside of this object now - justOut.push(gameObject); + source[i].destroy(); } - else + } + + for (i = 0; i < dataSource.length; i++) + { + if (dataSource[i]) { - // In the currentlyOver array - stillOver.push(gameObject); + dataSource[i].destroy(); } } - // Go through all objects the pointer is currently over (the hit test results) - // and if not in the previouslyOver array we know it's a new entry, so add to justOver - for (i = 0; i < currentlyOver.length; i++) + for (var frameName in this.frames) { - gameObject = currentlyOver[i]; - - // Is this newly over? + var frame = this.frames[frameName]; - if (previouslyOver.indexOf(gameObject) === -1) + if (frame) { - justOver.push(gameObject); + frame.destroy(); } } - // By this point the arrays are filled, so now we can process what happened... - - // Process the Just Out objects - var total = justOut.length; - - var totalInteracted = 0; + this.source = []; + this.dataSource = []; + this.frames = {}; - var _eventData = this._eventData; - var _eventContainer = this._eventContainer; + this.manager.removeKey(this.key); - _eventData.cancelled = false; + this.manager = null; + } - var aborted = false; +}); - if (total > 0) - { - this.sortGameObjects(justOut, pointer); +module.exports = Texture; - // Call onOut for everything in the justOut array - for (i = 0; i < total; i++) - { - gameObject = justOut[i]; - if (!gameObject.input) - { - continue; - } +/***/ }), - // Reset cursor before we emit the event, in case they want to change it during the event - manager.resetCursor(gameObject.input); +/***/ 6237: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - gameObject.emit(Events.GAMEOBJECT_POINTER_OUT, pointer, _eventContainer); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - totalInteracted++; +var CanvasPool = __webpack_require__(61068); +var CanvasTexture = __webpack_require__(17487); +var Class = __webpack_require__(56694); +var Color = __webpack_require__(27119); +var CONST = __webpack_require__(86459); +var DynamicTexture = __webpack_require__(845); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(38203); +var Frame = __webpack_require__(82047); +var GameEvents = __webpack_require__(97081); +var GenerateTexture = __webpack_require__(52780); +var GetValue = __webpack_require__(10850); +var ImageGameObject = __webpack_require__(1539); +var IsPlainObject = __webpack_require__(42911); +var Parser = __webpack_require__(69150); +var Rectangle = __webpack_require__(74118); +var Texture = __webpack_require__(31673); - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } +/** + * @callback EachTextureCallback + * + * @param {Phaser.Textures.Texture} texture - Each texture in Texture Manager. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + */ - this.emit(Events.GAMEOBJECT_OUT, pointer, gameObject, _eventContainer); +/** + * @classdesc + * When Phaser boots it will create an instance of this Texture Manager class. + * + * It is a global manager that handles all textures in your game. You can access it from within + * a Scene via the `this.textures` property. + * + * Its role is as a manager for all textures that your game uses. It can create, update and remove + * textures globally, as well as parse texture data from external files, such as sprite sheets + * and texture atlases. + * + * Sprites and other texture-based Game Objects get their texture data directly from this class. + * + * @class TextureManager + * @extends Phaser.Events.EventEmitter + * @memberof Phaser.Textures + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Game} game - The Phaser.Game instance this Texture Manager belongs to. + */ +var TextureManager = new Class({ - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } - } + Extends: EventEmitter, - if (!aborted) - { - this.emit(Events.POINTER_OUT, pointer, justOut); - } - } + initialize: - // Process the Just Over objects - total = justOver.length; + function TextureManager (game) + { + EventEmitter.call(this); - _eventData.cancelled = false; + /** + * The Game that the Texture Manager belongs to. + * + * A game will only ever have one instance of a Texture Manager. + * + * @name Phaser.Textures.TextureManager#game + * @type {Phaser.Game} + * @since 3.0.0 + */ + this.game = game; - aborted = false; + /** + * The internal name of this manager. + * + * @name Phaser.Textures.TextureManager#name + * @type {string} + * @readonly + * @since 3.0.0 + */ + this.name = 'TextureManager'; - if (total > 0) - { - this.sortGameObjects(justOver, pointer); + /** + * This object contains all Textures that belong to this Texture Manager. + * + * Textures are identified by string-based keys, which are used as the property + * within this object. Therefore, you can access any texture directly from this + * object without any iteration. + * + * You should not typically modify this object directly, but instead use the + * methods provided by the Texture Manager to add and remove entries from it. + * + * @name Phaser.Textures.TextureManager#list + * @type {object} + * @default {} + * @since 3.0.0 + */ + this.list = {}; - // Call onOver for everything in the justOver array - for (i = 0; i < total; i++) - { - gameObject = justOver[i]; + /** + * The temporary canvas element used to save the pixel data of an arbitrary texture + * during the `TextureManager.getPixel` and `getPixelAlpha` methods. + * + * @name Phaser.Textures.TextureManager#_tempCanvas + * @type {HTMLCanvasElement} + * @private + * @since 3.0.0 + */ + this._tempCanvas = CanvasPool.create2D(this); - if (!gameObject.input) - { - continue; - } + /** + * The 2d context of the `_tempCanvas` element. + * + * @name Phaser.Textures.TextureManager#_tempContext + * @type {CanvasRenderingContext2D} + * @private + * @since 3.0.0 + */ + this._tempContext = this._tempCanvas.getContext('2d', { willReadFrequently: true }); - // Set cursor before we emit the event, in case they want to change it during the event - manager.setCursor(gameObject.input); + /** + * An internal tracking value used for emitting the 'READY' event after all of + * the managers in the game have booted. + * + * @name Phaser.Textures.TextureManager#_pending + * @type {number} + * @private + * @default 0 + * @since 3.0.0 + */ + this._pending = 0; - gameObject.emit(Events.GAMEOBJECT_POINTER_OVER, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + /** + * An Image Game Object that belongs to this Texture Manager. + * + * Used as a drawing stamp within Dynamic Textures. + * + * This is not part of the display list and doesn't render. + * + * @name Phaser.Textures.TextureManager#stamp + * @type {Phaser.GameObjects.Image} + * @readonly + * @since 3.60.0 + */ + this.stamp; - totalInteracted++; + /** + * The crop Rectangle as used by the Stamp when it needs to crop itself. + * + * @name Phaser.Textures.TextureManager#stampCrop + * @type {Phaser.Geom.Rectangle} + * @since 3.60.0 + */ + this.stampCrop = new Rectangle(); - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } + /** + * If this flag is `true` then the Texture Manager will never emit any + * warnings to the console log that report missing textures. + * + * @name Phaser.Textures.TextureManager#silentWarnings + * @type {boolean} + * @default false + * @since 3.60.0 + */ + this.silentWarnings = false; - this.emit(Events.GAMEOBJECT_OVER, pointer, gameObject, _eventContainer); + game.events.once(GameEvents.BOOT, this.boot, this); + }, - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } - } + /** + * The Boot Handler called by Phaser.Game when it first starts up. + * + * @method Phaser.Textures.TextureManager#boot + * @private + * @since 3.0.0 + */ + boot: function () + { + this._pending = 3; - if (!aborted) - { - this.emit(Events.POINTER_OVER, pointer, justOver); - } - } + this.on(Events.LOAD, this.updatePending, this); + this.on(Events.ERROR, this.updatePending, this); - // Add the contents of justOver to the previously over array - previouslyOver = stillOver.concat(justOver); + var config = this.game.config; - // Then sort it into display list order - this._over[pointer.id] = this.sortGameObjects(previouslyOver, pointer); + this.addBase64('__DEFAULT', config.defaultImage); + this.addBase64('__MISSING', config.missingImage); + this.addBase64('__WHITE', config.whiteImage); - return totalInteracted; + this.game.events.once(GameEvents.DESTROY, this.destroy, this); }, /** - * An internal method that handles the Pointer up events. + * After 'onload' or 'onerror' invoked twice, emit 'ready' event. * - * @method Phaser.Input.InputPlugin#processUpEvents + * @method Phaser.Textures.TextureManager#updatePending * @private - * @fires Phaser.Input.Events#GAMEOBJECT_POINTER_UP - * @fires Phaser.Input.Events#GAMEOBJECT_UP - * @fires Phaser.Input.Events#POINTER_UP - * @fires Phaser.Input.Events#POINTER_UP_OUTSIDE * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - The pointer to check for events against. - * - * @return {number} The total number of objects interacted with. */ - processUpEvents: function (pointer) + updatePending: function () { - var currentlyOver = this._temp; - - var _eventData = this._eventData; - var _eventContainer = this._eventContainer; - - _eventData.cancelled = false; - - var aborted = false; + this._pending--; - // Go through all objects the pointer was over and fire their events / callbacks - for (var i = 0; i < currentlyOver.length; i++) + if (this._pending === 0) { - var gameObject = currentlyOver[i]; + this.off(Events.LOAD); + this.off(Events.ERROR); - if (!gameObject.input) - { - continue; - } + this.emit(Events.READY); - gameObject.emit(Events.GAMEOBJECT_POINTER_UP, pointer, gameObject.input.localX, gameObject.input.localY, _eventContainer); + this.stamp = new ImageGameObject(this.game.scene.systemScene).setOrigin(0); + } + }, - if (_eventData.cancelled || !gameObject.input) + /** + * Checks the given texture key and throws a console.warn if the key is already in use, then returns false. + * + * If you wish to avoid the console.warn then use `TextureManager.exists` instead. + * + * @method Phaser.Textures.TextureManager#checkKey + * @since 3.7.0 + * + * @param {string} key - The texture key to check. + * + * @return {boolean} `true` if it's safe to use the texture key, otherwise `false`. + */ + checkKey: function (key) + { + if (this.exists(key)) + { + if (!this.silentWarnings) { - aborted = true; - break; + // eslint-disable-next-line no-console + console.error('Texture key already in use: ' + key); } - this.emit(Events.GAMEOBJECT_UP, pointer, gameObject, _eventContainer); - - if (_eventData.cancelled || !gameObject.input) - { - aborted = true; - break; - } + return false; } - // If they released outside the canvas, but pressed down inside it, we'll still dispatch the event. - if (!aborted && this.manager) + return true; + }, + + /** + * Removes a Texture from the Texture Manager and destroys it. This will immediately + * clear all references to it from the Texture Manager, and if it has one, destroy its + * WebGLTexture. This will emit a `removetexture` event. + * + * Note: If you have any Game Objects still using this texture they will start throwing + * errors the next time they try to render. Make sure that removing the texture is the final + * step when clearing down to avoid this. + * + * @method Phaser.Textures.TextureManager#remove + * @fires Phaser.Textures.Events#REMOVE + * @since 3.7.0 + * + * @param {(string|Phaser.Textures.Texture)} key - The key of the Texture to remove, or a reference to it. + * + * @return {Phaser.Textures.TextureManager} The Texture Manager. + */ + remove: function (key) + { + if (typeof key === 'string') { - if (pointer.upElement === this.manager.game.canvas) + if (this.exists(key)) { - this.emit(Events.POINTER_UP, pointer, currentlyOver); + key = this.get(key); } else { - this.emit(Events.POINTER_UP_OUTSIDE, pointer); + if (!this.silentWarnings) + { + console.warn('No texture found matching key: ' + key); + } + + return this; } } - return currentlyOver.length; + // By this point key should be a Texture, if not, the following fails anyway + if (this.list.hasOwnProperty(key.key)) + { + key.destroy(); + + this.emit(Events.REMOVE, key.key); + this.emit(Events.REMOVE_KEY + key.key); + } + + return this; }, /** - * Queues a Game Object for insertion into this Input Plugin on the next update. + * Removes a key from the Texture Manager but does not destroy the Texture that was using the key. * - * @method Phaser.Input.InputPlugin#queueForInsertion - * @private - * @since 3.0.0 + * @method Phaser.Textures.TextureManager#removeKey + * @since 3.17.0 * - * @param {Phaser.GameObjects.GameObject} child - The Game Object to add. + * @param {string} key - The key to remove from the texture list. * - * @return {this} This InputPlugin object. + * @return {Phaser.Textures.TextureManager} The Texture Manager. */ - queueForInsertion: function (child) + removeKey: function (key) { - if (this._pendingInsertion.indexOf(child) === -1 && this._list.indexOf(child) === -1) + if (this.list.hasOwnProperty(key)) { - this._pendingInsertion.push(child); + delete this.list[key]; } return this; }, /** - * Queues a Game Object for removal from this Input Plugin on the next update. + * Adds a new Texture to the Texture Manager created from the given Base64 encoded data. * - * @method Phaser.Input.InputPlugin#queueForRemoval - * @private + * It works by creating an `Image` DOM object, then setting the `src` attribute to + * the given base64 encoded data. As a result, the process is asynchronous by its nature, + * so be sure to listen for the events this method dispatches before using the texture. + * + * @method Phaser.Textures.TextureManager#addBase64 + * @fires Phaser.Textures.Events#ADD + * @fires Phaser.Textures.Events#ERROR + * @fires Phaser.Textures.Events#LOAD * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} child - The Game Object to remove. + * @param {string} key - The unique string-based key of the Texture. + * @param {*} data - The Base64 encoded data. * - * @return {this} This InputPlugin object. + * @return {this} This Texture Manager instance. */ - queueForRemoval: function (child) + addBase64: function (key, data) { - this._pendingRemoval.push(child); + if (this.checkKey(key)) + { + var _this = this; + + var image = new Image(); + + image.onerror = function () + { + _this.emit(Events.ERROR, key); + }; + + image.onload = function () + { + var texture = _this.create(key, image); + + Parser.Image(texture, 0); + + _this.emit(Events.ADD, key, texture); + _this.emit(Events.ADD_KEY + key, texture); + _this.emit(Events.LOAD, key, texture); + }; + + image.src = data; + } return this; }, /** - * Sets the draggable state of the given array of Game Objects. + * Gets an existing texture frame and converts it into a base64 encoded image and returns the base64 data. * - * They can either be set to be draggable, or can have their draggable state removed by passing `false`. + * You can also provide the image type and encoder options. * - * A Game Object will not fire drag events unless it has been specifically enabled for drag. + * This will only work with bitmap based texture frames, such as those created from Texture Atlases. + * It will not work with GL Texture objects, such as Shaders, or Render Textures. For those please + * see the WebGL Snapshot function instead. * - * @method Phaser.Input.InputPlugin#setDraggable - * @since 3.0.0 + * @method Phaser.Textures.TextureManager#getBase64 + * @since 3.12.0 * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to change the draggable state on. - * @param {boolean} [value=true] - Set to `true` if the Game Objects should be made draggable, `false` if they should be unset. + * @param {string} key - The unique string-based key of the Texture. + * @param {(string|number)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. + * @param {string} [type='image/png'] - A DOMString indicating the image format. The default format type is image/png. + * @param {number} [encoderOptions=0.92] - A Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp. If this argument is anything else, the default value for image quality is used. The default value is 0.92. Other arguments are ignored. * - * @return {this} This InputPlugin object. + * @return {string} The base64 encoded data, or an empty string if the texture frame could not be found. */ - setDraggable: function (gameObjects, value) + getBase64: function (key, frame, type, encoderOptions) { - if (value === undefined) { value = true; } + if (type === undefined) { type = 'image/png'; } + if (encoderOptions === undefined) { encoderOptions = 0.92; } - if (!Array.isArray(gameObjects)) + var data = ''; + + var textureFrame = this.getFrame(key, frame); + + if (textureFrame && (textureFrame.source.isRenderTexture || textureFrame.source.isGLTexture)) { - gameObjects = [ gameObjects ]; + if (!this.silentWarnings) + { + console.warn('Cannot getBase64 from WebGL Texture'); + } } - - for (var i = 0; i < gameObjects.length; i++) + else if (textureFrame) { - var gameObject = gameObjects[i]; + var cd = textureFrame.canvasData; - gameObject.input.draggable = value; + var canvas = CanvasPool.create2D(this, cd.width, cd.height); + var ctx = canvas.getContext('2d', { willReadFrequently: true }); + + if (cd.width > 0 && cd.height > 0) + { + ctx.drawImage( + textureFrame.source.image, + cd.x, + cd.y, + cd.width, + cd.height, + 0, + 0, + cd.width, + cd.height + ); + } - var index = this._draggable.indexOf(gameObject); + data = canvas.toDataURL(type, encoderOptions); - if (value && index === -1) - { - this._draggable.push(gameObject); - } - else if (!value && index > -1) - { - this._draggable.splice(index, 1); - } + CanvasPool.remove(canvas); } - return this; + return data; }, /** - * Creates a function that can be passed to `setInteractive`, `enable` or `setHitArea` that will handle - * pixel-perfect input detection on an Image or Sprite based Game Object, or any custom class that extends them. - * - * The following will create a sprite that is clickable on any pixel that has an alpha value >= 1. - * - * ```javascript - * this.add.sprite(x, y, key).setInteractive(this.input.makePixelPerfect()); - * ``` - * - * The following will create a sprite that is clickable on any pixel that has an alpha value >= 150. - * - * ```javascript - * this.add.sprite(x, y, key).setInteractive(this.input.makePixelPerfect(150)); - * ``` - * - * Once you have made an Interactive Object pixel perfect it impacts all input related events for it: down, up, - * dragstart, drag, etc. - * - * As a pointer interacts with the Game Object it will constantly poll the texture, extracting a single pixel from - * the given coordinates and checking its color values. This is an expensive process, so should only be enabled on - * Game Objects that really need it. - * - * You cannot make non-texture based Game Objects pixel perfect. So this will not work on Graphics, BitmapText, - * Render Textures, Text, Tilemaps, Containers or Particles. + * Adds a new Texture to the Texture Manager created from the given Image element. * - * @method Phaser.Input.InputPlugin#makePixelPerfect - * @since 3.10.0 + * @method Phaser.Textures.TextureManager#addImage + * @fires Phaser.Textures.Events#ADD + * @since 3.0.0 * - * @param {number} [alphaTolerance=1] - The alpha level that the pixel should be above to be included as a successful interaction. + * @param {string} key - The unique string-based key of the Texture. + * @param {HTMLImageElement} source - The source Image element. + * @param {HTMLImageElement|HTMLCanvasElement} [dataSource] - An optional data Image element. * - * @return {function} A Pixel Perfect Handler for use as a hitArea shape callback. + * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ - makePixelPerfect: function (alphaTolerance) + addImage: function (key, source, dataSource) { - if (alphaTolerance === undefined) { alphaTolerance = 1; } + var texture = null; - var textureManager = this.systems.textures; + if (this.checkKey(key)) + { + texture = this.create(key, source); - return CreatePixelPerfectHandler(textureManager, alphaTolerance); + Parser.Image(texture, 0); + + if (dataSource) + { + texture.setDataSource(dataSource); + } + + this.emit(Events.ADD, key, texture); + this.emit(Events.ADD_KEY + key, texture); + } + + return texture; }, /** - * Sets the hit area for the given array of Game Objects. + * Takes a WebGL Texture and creates a Phaser Texture from it, which is added to the Texture Manager using the given key. * - * A hit area is typically one of the geometric shapes Phaser provides, such as a `Phaser.Geom.Rectangle` - * or `Phaser.Geom.Circle`. However, it can be any object as long as it works with the provided callback. + * This allows you to then use the Texture as a normal texture for texture based Game Objects like Sprites. * - * If no hit area is provided a Rectangle is created based on the size of the Game Object, if possible - * to calculate. + * If the `width` and `height` arguments are omitted, but the WebGL Texture was created by Phaser's WebGL Renderer + * and has `glTexture.width` and `glTexture.height` properties, these values will be used instead. * - * The hit area callback is the function that takes an `x` and `y` coordinate and returns a boolean if - * those values fall within the area of the shape or not. All of the Phaser geometry objects provide this, - * such as `Phaser.Geom.Rectangle.Contains`. + * This is a WebGL only feature. * - * @method Phaser.Input.InputPlugin#setHitArea - * @since 3.0.0 + * @method Phaser.Textures.TextureManager#addGLTexture + * @fires Phaser.Textures.Events#ADD + * @since 3.19.0 * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set the hit area on. - * @param {(Phaser.Types.Input.InputConfiguration|any)} [hitArea] - Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. - * @param {Phaser.Types.Input.HitAreaCallback} [hitAreaCallback] - The 'contains' function to invoke to check if the pointer is within the hit area. + * @param {string} key - The unique string-based key of the Texture. + * @param {WebGLTexture} glTexture - The source Render Texture. + * @param {number} [width] - The new width of the Texture. Read from `glTexture.width` if omitted. + * @param {number} [height] - The new height of the Texture. Read from `glTexture.height` if omitted. * - * @return {this} This InputPlugin object. + * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ - setHitArea: function (gameObjects, hitArea, hitAreaCallback) + addGLTexture: function (key, glTexture, width, height) { - if (hitArea === undefined) - { - return this.setHitAreaFromTexture(gameObjects); - } - - if (!Array.isArray(gameObjects)) - { - gameObjects = [ gameObjects ]; - } - - var draggable = false; - var dropZone = false; - var cursor = false; - var useHandCursor = false; - var pixelPerfect = false; - var customHitArea = true; + var texture = null; - // Config object? - if (IsPlainObject(hitArea)) + if (this.checkKey(key)) { - var config = hitArea; - - hitArea = GetFastValue(config, 'hitArea', null); - hitAreaCallback = GetFastValue(config, 'hitAreaCallback', null); - draggable = GetFastValue(config, 'draggable', false); - dropZone = GetFastValue(config, 'dropZone', false); - cursor = GetFastValue(config, 'cursor', false); - useHandCursor = GetFastValue(config, 'useHandCursor', false); + if (width === undefined) { width = glTexture.width; } + if (height === undefined) { height = glTexture.height; } - pixelPerfect = GetFastValue(config, 'pixelPerfect', false); - var alphaTolerance = GetFastValue(config, 'alphaTolerance', 1); + texture = this.create(key, glTexture, width, height); - if (pixelPerfect) - { - hitArea = {}; - hitAreaCallback = this.makePixelPerfect(alphaTolerance); - } + texture.add('__BASE', 0, 0, 0, width, height); - // Still no hitArea or callback? - if (!hitArea || !hitAreaCallback) - { - this.setHitAreaFromTexture(gameObjects); - customHitArea = false; - } - } - else if (typeof hitArea === 'function' && !hitAreaCallback) - { - hitAreaCallback = hitArea; - hitArea = {}; + this.emit(Events.ADD, key, texture); + this.emit(Events.ADD_KEY + key, texture); } - for (var i = 0; i < gameObjects.length; i++) - { - var gameObject = gameObjects[i]; - - if (pixelPerfect && gameObject.type === 'Container') - { - console.warn('Cannot pixelPerfect test a Container. Use a custom callback.'); - continue; - } + return texture; + }, - var io = (!gameObject.input) ? CreateInteractiveObject(gameObject, hitArea, hitAreaCallback) : gameObject.input; + /** + * Adds a Compressed Texture to this Texture Manager. + * + * The texture should typically have been loaded via the `CompressedTextureFile` loader, + * in order to prepare the correct data object this method requires. + * + * You can optionally also pass atlas data to this method, in which case a texture atlas + * will be generated from the given compressed texture, combined with the atlas data. + * + * @method Phaser.Textures.TextureManager#addCompressedTexture + * @fires Phaser.Textures.Events#ADD + * @since 3.60.0 + * + * @param {string} key - The unique string-based key of the Texture. + * @param {Phaser.Types.Textures.CompressedTextureData} textureData - The Compressed Texture data object. + * @param {object} [atlasData] - Optional Texture Atlas data. + * + * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. + */ + addCompressedTexture: function (key, textureData, atlasData) + { + var texture = null; - io.customHitArea = customHitArea; - io.dropZone = dropZone; - io.cursor = (useHandCursor) ? 'pointer' : cursor; + if (this.checkKey(key)) + { + texture = this.create(key, textureData); - gameObject.input = io; + texture.add('__BASE', 0, 0, 0, textureData.width, textureData.height); - if (draggable) + if (atlasData) { - this.setDraggable(gameObject); + if (Array.isArray(atlasData)) + { + for (var i = 0; i < atlasData.length; i++) + { + Parser.JSONHash(texture, i, atlasData[i]); + } + } + else + { + Parser.JSONHash(texture, 0, atlasData); + } } - this.queueForInsertion(gameObject); + this.emit(Events.ADD, key, texture); + this.emit(Events.ADD_KEY + key, texture); } - return this; + return texture; }, /** - * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Circle` shape, using - * the given coordinates and radius to control its position and size. + * Adds a Render Texture to the Texture Manager using the given key. + * This allows you to then use the Render Texture as a normal texture for texture based Game Objects like Sprites. * - * @method Phaser.Input.InputPlugin#setHitAreaCircle - * @since 3.0.0 + * @method Phaser.Textures.TextureManager#addRenderTexture + * @fires Phaser.Textures.Events#ADD + * @since 3.12.0 * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set as having a circle hit area. - * @param {number} x - The center of the circle. - * @param {number} y - The center of the circle. - * @param {number} radius - The radius of the circle. - * @param {Phaser.Types.Input.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Circle.Contains. + * @param {string} key - The unique string-based key of the Texture. + * @param {Phaser.GameObjects.RenderTexture} renderTexture - The source Render Texture. * - * @return {this} This InputPlugin object. + * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ - setHitAreaCircle: function (gameObjects, x, y, radius, callback) + addRenderTexture: function (key, renderTexture) { - if (callback === undefined) { callback = CircleContains; } + var texture = null; - var shape = new Circle(x, y, radius); + if (this.checkKey(key)) + { + texture = this.create(key, renderTexture); - return this.setHitArea(gameObjects, shape, callback); + texture.add('__BASE', 0, 0, 0, renderTexture.width, renderTexture.height); + + this.emit(Events.ADD, key, texture); + this.emit(Events.ADD_KEY + key, texture); + } + + return texture; }, /** - * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Ellipse` shape, using - * the given coordinates and dimensions to control its position and size. + * Creates a new Texture using the given config values. * - * @method Phaser.Input.InputPlugin#setHitAreaEllipse + * Generated textures consist of a Canvas element to which the texture data is drawn. + * + * Generates a texture based on the given Create configuration object. + * + * The texture is drawn using a fixed-size indexed palette of 16 colors, where the hex value in the + * data cells map to a single color. For example, if the texture config looked like this: + * + * ```javascript + * var star = [ + * '.....828.....', + * '....72227....', + * '....82228....', + * '...7222227...', + * '2222222222222', + * '8222222222228', + * '.72222222227.', + * '..787777787..', + * '..877777778..', + * '.78778887787.', + * '.27887.78872.', + * '.787.....787.' + * ]; + * + * this.textures.generate('star', { data: star, pixelWidth: 4 }); + * ``` + * + * Then it would generate a texture that is 52 x 48 pixels in size, because each cell of the data array + * represents 1 pixel multiplied by the `pixelWidth` value. The cell values, such as `8`, maps to color + * number 8 in the palette. If a cell contains a period character `.` then it is transparent. + * + * The default palette is Arne16, but you can specify your own using the `palette` property. + * + * @method Phaser.Textures.TextureManager#generate * @since 3.0.0 * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set as having an ellipse hit area. - * @param {number} x - The center of the ellipse. - * @param {number} y - The center of the ellipse. - * @param {number} width - The width of the ellipse. - * @param {number} height - The height of the ellipse. - * @param {Phaser.Types.Input.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Ellipse.Contains. + * @param {string} key - The unique string-based key of the Texture. + * @param {Phaser.Types.Create.GenerateTextureConfig} config - The configuration object needed to generate the texture. * - * @return {this} This InputPlugin object. + * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ - setHitAreaEllipse: function (gameObjects, x, y, width, height, callback) + generate: function (key, config) { - if (callback === undefined) { callback = EllipseContains; } + if (this.checkKey(key)) + { + var canvas = CanvasPool.create(this, 1, 1); - var shape = new Ellipse(x, y, width, height); + config.canvas = canvas; - return this.setHitArea(gameObjects, shape, callback); + GenerateTexture(config); + + return this.addCanvas(key, canvas); + } + else + { + return null; + } }, /** - * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Rectangle` shape, using - * the Game Objects texture frame to define the position and size of the hit area. + * Creates a new Texture using a blank Canvas element of the size given. * - * @method Phaser.Input.InputPlugin#setHitAreaFromTexture + * Canvas elements are automatically pooled and calling this method will + * extract a free canvas from the CanvasPool, or create one if none are available. + * + * @method Phaser.Textures.TextureManager#createCanvas * @since 3.0.0 * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set as having an ellipse hit area. - * @param {Phaser.Types.Input.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Rectangle.Contains. + * @param {string} key - The unique string-based key of the Texture. + * @param {number} [width=256] - The width of the Canvas element. + * @param {number} [height=256] - The height of the Canvas element. * - * @return {this} This InputPlugin object. + * @return {?Phaser.Textures.CanvasTexture} The Canvas Texture that was created, or `null` if the key is already in use. */ - setHitAreaFromTexture: function (gameObjects, callback) + createCanvas: function (key, width, height) { - if (callback === undefined) { callback = RectangleContains; } + if (width === undefined) { width = 256; } + if (height === undefined) { height = 256; } - if (!Array.isArray(gameObjects)) + if (this.checkKey(key)) { - gameObjects = [ gameObjects ]; - } + var canvas = CanvasPool.create(this, width, height, CONST.CANVAS, true); - for (var i = 0; i < gameObjects.length; i++) - { - var gameObject = gameObjects[i]; + return this.addCanvas(key, canvas); + } - var frame = gameObject.frame; + return null; + }, - var width = 0; - var height = 0; + /** + * Creates a new Canvas Texture object from an existing Canvas element + * and adds it to this Texture Manager, unless `skipCache` is true. + * + * @method Phaser.Textures.TextureManager#addCanvas + * @fires Phaser.Textures.Events#ADD + * @since 3.0.0 + * + * @param {string} key - The unique string-based key of the Texture. + * @param {HTMLCanvasElement} source - The Canvas element to form the base of the new Texture. + * @param {boolean} [skipCache=false] - Skip adding this Texture into the Cache? + * + * @return {?Phaser.Textures.CanvasTexture} The Canvas Texture that was created, or `null` if the key is already in use. + */ + addCanvas: function (key, source, skipCache) + { + if (skipCache === undefined) { skipCache = false; } - if (gameObject.width) - { - width = gameObject.width; - height = gameObject.height; - } - else if (frame) - { - width = frame.realWidth; - height = frame.realHeight; - } + var texture = null; - if (gameObject.type === 'Container' && (width === 0 || height === 0)) - { - console.warn('Container.setInteractive must specify a Shape or call setSize() first'); - continue; - } + if (skipCache) + { + texture = new CanvasTexture(this, key, source, source.width, source.height); + } + else if (this.checkKey(key)) + { + texture = new CanvasTexture(this, key, source, source.width, source.height); - if (width !== 0 && height !== 0) - { - gameObject.input = CreateInteractiveObject(gameObject, new Rectangle(0, 0, width, height), callback); + this.list[key] = texture; - this.queueForInsertion(gameObject); - } + this.emit(Events.ADD, key, texture); + this.emit(Events.ADD_KEY + key, texture); } - return this; + return texture; }, /** - * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Rectangle` shape, using - * the given coordinates and dimensions to control its position and size. + * Creates a Dynamic Texture instance and adds itself to this Texture Manager. * - * @method Phaser.Input.InputPlugin#setHitAreaRectangle - * @since 3.0.0 + * A Dynamic Texture is a special texture that allows you to draw textures, frames and most kind of + * Game Objects directly to it. * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set as having a rectangular hit area. - * @param {number} x - The top-left of the rectangle. - * @param {number} y - The top-left of the rectangle. - * @param {number} width - The width of the rectangle. - * @param {number} height - The height of the rectangle. - * @param {Phaser.Types.Input.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Rectangle.Contains. + * You can take many complex objects and draw them to this one texture, which can then be used as the + * base texture for other Game Objects, such as Sprites. Should you then update this texture, all + * Game Objects using it will instantly be updated as well, reflecting the changes immediately. * - * @return {this} This InputPlugin object. + * It's a powerful way to generate dynamic textures at run-time that are WebGL friendly and don't invoke + * expensive GPU uploads on each change. + * + * See the methods available on the `DynamicTexture` class for more details. + * + * Optionally, you can also pass a Dynamic Texture instance to this method to have + * it added to the Texture Manager. + * + * @method Phaser.Textures.TextureManager#addDynamicTexture + * @fires Phaser.Textures.Events#ADD + * @since 3.60.0 + * + * @param {(string|Phaser.Textures.DynamicTexture)} key - The string-based key of this Texture. Must be unique within the Texture Manager. Or, a DynamicTexture instance. + * @param {number} [width=256] - The width of this Dynamic Texture in pixels. Defaults to 256 x 256. Ignored if an instance is passed as the key. + * @param {number} [height=256] - The height of this Dynamic Texture in pixels. Defaults to 256 x 256. Ignored if an instance is passed as the key. + * + * @return {?Phaser.Textures.DynamicTexture} The Dynamic Texture that was created, or `null` if the key is already in use. */ - setHitAreaRectangle: function (gameObjects, x, y, width, height, callback) + addDynamicTexture: function (key, width, height) { - if (callback === undefined) { callback = RectangleContains; } + var texture = null; - var shape = new Rectangle(x, y, width, height); + if (typeof(key) === 'string' && !this.exists(key)) + { + texture = new DynamicTexture(this, key, width, height); + } + else + { + texture = key; + key = texture.key; + } - return this.setHitArea(gameObjects, shape, callback); + if (this.checkKey(key)) + { + this.list[key] = texture; + + this.emit(Events.ADD, key, texture); + this.emit(Events.ADD_KEY + key, texture); + } + else + { + texture = null; + } + + return texture; }, /** - * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Triangle` shape, using - * the given coordinates to control the position of its points. + * Adds a Texture Atlas to this Texture Manager. * - * @method Phaser.Input.InputPlugin#setHitAreaTriangle + * In Phaser terminology, a Texture Atlas is a combination of an atlas image and a JSON data file, + * such as those exported by applications like Texture Packer. + * + * It can accept either JSON Array or JSON Hash formats, as exported by Texture Packer and similar software. + * + * As of Phaser 3.60 you can use this method to add a atlas data to an existing Phaser Texture. + * + * @method Phaser.Textures.TextureManager#addAtlas * @since 3.0.0 * - * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObjects - An array of Game Objects to set as having a triangular hit area. - * @param {number} x1 - The x coordinate of the first point of the triangle. - * @param {number} y1 - The y coordinate of the first point of the triangle. - * @param {number} x2 - The x coordinate of the second point of the triangle. - * @param {number} y2 - The y coordinate of the second point of the triangle. - * @param {number} x3 - The x coordinate of the third point of the triangle. - * @param {number} y3 - The y coordinate of the third point of the triangle. - * @param {Phaser.Types.Input.HitAreaCallback} [callback] - The hit area callback. If undefined it uses Triangle.Contains. + * @param {string} key - The unique string-based key of the Texture. + * @param {(HTMLImageElement|HTMLImageElement[]|Phaser.Textures.Texture)} source - The source Image element/s, or a Phaser Texture. + * @param {(object|object[])} data - The Texture Atlas data/s. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * - * @return {this} This InputPlugin object. + * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ - setHitAreaTriangle: function (gameObjects, x1, y1, x2, y2, x3, y3, callback) + addAtlas: function (key, source, data, dataSource) { - if (callback === undefined) { callback = TriangleContains; } - - var shape = new Triangle(x1, y1, x2, y2, x3, y3); - - return this.setHitArea(gameObjects, shape, callback); + // New Texture Packer format? + if (Array.isArray(data.textures) || Array.isArray(data.frames)) + { + return this.addAtlasJSONArray(key, source, data, dataSource); + } + else + { + return this.addAtlasJSONHash(key, source, data, dataSource); + } }, /** - * Creates an Input Debug Shape for the given Game Object. - * - * The Game Object must have _already_ been enabled for input prior to calling this method. - * - * This is intended to assist you during development and debugging. - * - * Debug Shapes can only be created for Game Objects that are using standard Phaser Geometry for input, - * including: Circle, Ellipse, Line, Polygon, Rectangle and Triangle. + * Adds a Texture Atlas to this Texture Manager. * - * Game Objects that are using their automatic hit areas are using Rectangles by default, so will also work. + * In Phaser terminology, a Texture Atlas is a combination of an atlas image and a JSON data file, + * such as those exported by applications like Texture Packer. * - * The Debug Shape is created and added to the display list and is then kept in sync with the Game Object - * it is connected with. Should you need to modify it yourself, such as to hide it, you can access it via - * the Game Object property: `GameObject.input.hitAreaDebug`. + * The frame data of the atlas must be stored in an Array within the JSON. * - * Calling this method on a Game Object that already has a Debug Shape will first destroy the old shape, - * before creating a new one. If you wish to remove the Debug Shape entirely, you should call the - * method `InputPlugin.removeDebug`. + * This is known as a JSON Array in software such as Texture Packer. * - * Note that the debug shape will only show the outline of the input area. If the input test is using a - * pixel perfect check, for example, then this is not displayed. If you are using a custom shape, that - * doesn't extend one of the base Phaser Geometry objects, as your hit area, then this method will not - * work. + * As of Phaser 3.60 you can use this method to add a atlas data to an existing Phaser Texture. * - * @method Phaser.Input.InputPlugin#enableDebug - * @since 3.19.0 + * @method Phaser.Textures.TextureManager#addAtlasJSONArray + * @fires Phaser.Textures.Events#ADD + * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to create the input debug shape for. - * @param {number} [color=0x00ff00] - The outline color of the debug shape. + * @param {string} key - The unique string-based key of the Texture. + * @param {(HTMLImageElement|HTMLImageElement[]|Phaser.Textures.Texture)} source - The source Image element/s, or a Phaser Texture. + * @param {(object|object[])} data - The Texture Atlas data/s. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * - * @return {this} This Input Plugin. + * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ - enableDebug: function (gameObject, color) + addAtlasJSONArray: function (key, source, data, dataSource) { - if (color === undefined) { color = 0x00ff00; } - - var input = gameObject.input; - - if (!input || !input.hitArea) - { - return this; - } - - var shape = input.hitArea; - var shapeType = shape.type; - var debug = input.hitAreaDebug; - var factory = this.systems.add; - var updateList = this.systems.updateList; + var texture = null; - if (debug) + if (source instanceof Texture) { - updateList.remove(debug); - - debug.destroy(); - - debug = null; + key = texture.key; + texture = source; } - - var offsetx = 0; - var offsety = 0; - switch (shapeType) + else if (this.checkKey(key)) { - case GEOM_CONST.CIRCLE: - debug = factory.arc(0, 0, shape.radius); - offsetx = shape.x - shape.radius; - offsety = shape.y - shape.radius; - break; - - case GEOM_CONST.ELLIPSE: - debug = factory.ellipse(0, 0, shape.width, shape.height); - offsetx = shape.x - shape.width / 2; - offsety = shape.y - shape.height / 2; - break; - - case GEOM_CONST.LINE: - debug = factory.line(0, 0, shape.x1, shape.y1, shape.x2, shape.y2); - break; - - case GEOM_CONST.POLYGON: - debug = factory.polygon(0, 0, shape.points); - break; - - case GEOM_CONST.RECTANGLE: - debug = factory.rectangle(0, 0, shape.width, shape.height); - offsetx = shape.x; - offsety = shape.y; - break; - - case GEOM_CONST.TRIANGLE: - debug = factory.triangle(0, 0, shape.x1, shape.y1, shape.x2, shape.y2, shape.x3, shape.y3); - break; + texture = this.create(key, source); } - if (debug) + if (texture) { - debug.isFilled = false; - - debug.preUpdate = function () + // Multi-Atlas? + if (Array.isArray(data)) { - debug.setStrokeStyle(1 / gameObject.scale, color); - - debug.setDisplayOrigin(gameObject.displayOriginX, gameObject.displayOriginY); - - var x = gameObject.x; - var y = gameObject.y; - var rotation = gameObject.rotation; - var scaleX = gameObject.scaleX; - var scaleY = gameObject.scaleY; + var singleAtlasFile = (data.length === 1); // multi-pack with one atlas file for all images - if (gameObject.parentContainer) + // !! Assumes the textures are in the same order in the source array as in the json data !! + for (var i = 0; i < texture.source.length; i++) { - var matrix = gameObject.getWorldTransformMatrix(); + var atlasData = singleAtlasFile ? data[0] : data[i]; - x = matrix.tx; - y = matrix.ty; - rotation = matrix.rotation; - scaleX = matrix.scaleX; - scaleY = matrix.scaleY; + Parser.JSONArray(texture, i, atlasData); } + } + else + { + Parser.JSONArray(texture, 0, data); + } - debug.setRotation(rotation); - debug.setScale(scaleX, scaleY); - debug.setPosition(x + offsetx, y + offsety); - debug.setScrollFactor(gameObject.scrollFactorX, gameObject.scrollFactorY); - debug.setDepth(gameObject.depth); - }; - - updateList.add(debug); + if (dataSource) + { + texture.setDataSource(dataSource); + } - input.hitAreaDebug = debug; + this.emit(Events.ADD, key, texture); + this.emit(Events.ADD_KEY + key, texture); } - return this; + return texture; }, /** - * Removes an Input Debug Shape from the given Game Object. + * Adds a Texture Atlas to this Texture Manager. * - * The shape is destroyed immediately and the `hitAreaDebug` property is set to `null`. + * In Phaser terminology, a Texture Atlas is a combination of an atlas image and a JSON data file, + * such as those exported by applications like Texture Packer. * - * @method Phaser.Input.InputPlugin#removeDebug - * @since 3.19.0 + * The frame data of the atlas must be stored in an Object within the JSON. * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to remove the input debug shape from. + * This is known as a JSON Hash in software such as Texture Packer. * - * @return {this} This Input Plugin. + * As of Phaser 3.60 you can use this method to add a atlas data to an existing Phaser Texture. + * + * @method Phaser.Textures.TextureManager#addAtlasJSONHash + * @fires Phaser.Textures.Events#ADD + * @since 3.0.0 + * + * @param {string} key - The unique string-based key of the Texture. + * @param {(HTMLImageElement|HTMLImageElement[]|Phaser.Textures.Texture)} source - The source Image element/s, or a Phaser Texture. + * @param {(object|object[])} data - The Texture Atlas data/s. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. + * + * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ - removeDebug: function (gameObject) + addAtlasJSONHash: function (key, source, data, dataSource) { - var input = gameObject.input; + var texture = null; - if (input && input.hitAreaDebug) + if (source instanceof Texture) { - var debug = input.hitAreaDebug; + key = texture.key; + texture = source; + } + else if (this.checkKey(key)) + { + texture = this.create(key, source); + } - this.systems.updateList.remove(debug); + if (texture) + { + if (Array.isArray(data)) + { + for (var i = 0; i < data.length; i++) + { + Parser.JSONHash(texture, i, data[i]); + } + } + else + { + Parser.JSONHash(texture, 0, data); + } - debug.destroy(); + if (dataSource) + { + texture.setDataSource(dataSource); + } - input.hitAreaDebug = null; + this.emit(Events.ADD, key, texture); + this.emit(Events.ADD_KEY + key, texture); } - return this; + return texture; }, /** - * Sets the Pointers to always poll. + * Adds a Texture Atlas to this Texture Manager. * - * When a pointer is polled it runs a hit test to see which Game Objects are currently below it, - * or being interacted with it, regardless if the Pointer has actually moved or not. + * In Phaser terminology, a Texture Atlas is a combination of an atlas image and a data file, + * such as those exported by applications like Texture Packer. * - * You should enable this if you want objects in your game to fire over / out events, and the objects - * are constantly moving, but the pointer may not have. Polling every frame has additional computation - * costs, especially if there are a large number of interactive objects in your game. + * The frame data of the atlas must be stored in an XML file. * - * @method Phaser.Input.InputPlugin#setPollAlways - * @since 3.0.0 + * As of Phaser 3.60 you can use this method to add a atlas data to an existing Phaser Texture. * - * @return {this} This InputPlugin object. + * @method Phaser.Textures.TextureManager#addAtlasXML + * @fires Phaser.Textures.Events#ADD + * @since 3.7.0 + * + * @param {string} key - The unique string-based key of the Texture. + * @param {(HTMLImageElement|Phaser.Textures.Texture)} source - The source Image element, or a Phaser Texture. + * @param {object} data - The Texture Atlas XML data. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. + * + * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ - setPollAlways: function () + addAtlasXML: function (key, source, data, dataSource) { - return this.setPollRate(0); + var texture = null; + + if (source instanceof Texture) + { + key = texture.key; + texture = source; + } + else if (this.checkKey(key)) + { + texture = this.create(key, source); + } + + if (texture) + { + Parser.AtlasXML(texture, 0, data); + + if (dataSource) + { + texture.setDataSource(dataSource); + } + + this.emit(Events.ADD, key, texture); + this.emit(Events.ADD_KEY + key, texture); + } + + return texture; }, /** - * Sets the Pointers to only poll when they are moved or updated. + * Adds a Unity Texture Atlas to this Texture Manager. * - * When a pointer is polled it runs a hit test to see which Game Objects are currently below it, - * or being interacted with it. + * In Phaser terminology, a Texture Atlas is a combination of an atlas image and a data file, + * such as those exported by applications like Texture Packer or Unity. * - * @method Phaser.Input.InputPlugin#setPollOnMove - * @since 3.0.0 + * The frame data of the atlas must be stored in a Unity YAML file. * - * @return {this} This InputPlugin object. - */ - setPollOnMove: function () - { - return this.setPollRate(-1); - }, - - /** - * Sets the poll rate value. This is the amount of time that should have elapsed before a pointer - * will be polled again. See the `setPollAlways` and `setPollOnMove` methods. + * As of Phaser 3.60 you can use this method to add a atlas data to an existing Phaser Texture. * - * @method Phaser.Input.InputPlugin#setPollRate + * @method Phaser.Textures.TextureManager#addUnityAtlas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * - * @param {number} value - The amount of time, in ms, that should elapsed before re-polling the pointers. + * @param {string} key - The unique string-based key of the Texture. + * @param {HTMLImageElement} source - The source Image element. + * @param {object} data - The Texture Atlas data. + * @param {HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[]} [dataSource] - An optional data Image element. * - * @return {this} This InputPlugin object. + * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ - setPollRate: function (value) + addUnityAtlas: function (key, source, data, dataSource) { - this.pollRate = value; - this._pollTimer = 0; + var texture = null; - return this; + if (source instanceof Texture) + { + key = texture.key; + texture = source; + } + else if (this.checkKey(key)) + { + texture = this.create(key, source); + } + + if (texture) + { + Parser.UnityYAML(texture, 0, data); + + if (dataSource) + { + texture.setDataSource(dataSource); + } + + this.emit(Events.ADD, key, texture); + this.emit(Events.ADD_KEY + key, texture); + } + + return texture; }, /** - * When set to `true` the global Input Manager will emulate DOM behavior by only emitting events from - * the top-most Scene in the Scene List. By default, if a Scene receives an input event it will then stop the event - * from flowing down to any Scenes below it in the Scene list. To disable this behavior call this method with `false`. + * Adds a Sprite Sheet to this Texture Manager. * - * @method Phaser.Input.InputPlugin#setGlobalTopOnly + * In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact + * same size and cannot be trimmed or rotated. This is different to a Texture Atlas, created by tools such as + * Texture Packer, and more akin with the fixed-frame exports you get from apps like Aseprite or old arcade + * games. + * + * As of Phaser 3.60 you can use this method to add a sprite sheet to an existing Phaser Texture. + * + * @method Phaser.Textures.TextureManager#addSpriteSheet + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * - * @param {boolean} value - Set to `true` to stop processing input events on the Scene that receives it, or `false` to let the event continue down the Scene list. + * @param {string} key - The unique string-based key of the Texture. Give an empty string if you provide a Phaser Texture as the 2nd argument. + * @param {(HTMLImageElement|Phaser.Textures.Texture)} source - The source Image element, or a Phaser Texture. + * @param {Phaser.Types.Textures.SpriteSheetConfig} config - The configuration object for this Sprite Sheet. + * @param {HTMLImageElement|HTMLCanvasElement} [dataSource] - An optional data Image element. * - * @return {this} This InputPlugin object. + * @return {?Phaser.Textures.Texture} The Texture that was created or updated, or `null` if the key is already in use. */ - setGlobalTopOnly: function (value) + addSpriteSheet: function (key, source, config, dataSource) { - this.manager.globalTopOnly = value; + var texture = null; - return this; + if (source instanceof Texture) + { + key = texture.key; + texture = source; + } + else if (this.checkKey(key)) + { + texture = this.create(key, source); + } + + if (texture) + { + var width = texture.source[0].width; + var height = texture.source[0].height; + + Parser.SpriteSheet(texture, 0, 0, 0, width, height, config); + + if (dataSource) + { + texture.setDataSource(dataSource); + } + + this.emit(Events.ADD, key, texture); + this.emit(Events.ADD_KEY + key, texture); + } + + return texture; }, /** - * When set to `true` this Input Plugin will emulate DOM behavior by only emitting events from - * the top-most Game Objects in the Display List. + * Adds a Sprite Sheet to this Texture Manager, where the Sprite Sheet exists as a Frame within a Texture Atlas. * - * If set to `false` it will emit events from all Game Objects below a Pointer, not just the top one. + * In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact + * same size and cannot be trimmed or rotated. * - * @method Phaser.Input.InputPlugin#setTopOnly + * @method Phaser.Textures.TextureManager#addSpriteSheetFromAtlas + * @fires Phaser.Textures.Events#ADD * @since 3.0.0 * - * @param {boolean} value - `true` to only include the top-most Game Object, or `false` to include all Game Objects in a hit test. + * @param {string} key - The unique string-based key of the Texture. + * @param {Phaser.Types.Textures.SpriteSheetFromAtlasConfig} config - The configuration object for this Sprite Sheet. * - * @return {this} This InputPlugin object. + * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ - setTopOnly: function (value) + addSpriteSheetFromAtlas: function (key, config) { - this.topOnly = value; + if (!this.checkKey(key)) + { + return null; + } - return this; + var atlasKey = GetValue(config, 'atlas', null); + var atlasFrame = GetValue(config, 'frame', null); + + if (!atlasKey || !atlasFrame) + { + return; + } + + var atlas = this.get(atlasKey); + var sheet = atlas.get(atlasFrame); + + if (sheet) + { + var texture = this.create(key, sheet.source.image); + + if (sheet.trimmed) + { + // If trimmed we need to help the parser adjust + Parser.SpriteSheetFromAtlas(texture, sheet, config); + } + else + { + Parser.SpriteSheet(texture, 0, sheet.cutX, sheet.cutY, sheet.cutWidth, sheet.cutHeight, config); + } + + this.emit(Events.ADD, key, texture); + this.emit(Events.ADD_KEY + key, texture); + + return texture; + } }, /** - * Given an array of Game Objects and a Pointer, sort the array and return it, - * so that the objects are in render order with the lowest at the bottom. + * Creates a new Texture using the given source and dimensions. * - * @method Phaser.Input.InputPlugin#sortGameObjects + * @method Phaser.Textures.TextureManager#create * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject[]} gameObjects - An array of Game Objects to be sorted. - * @param {Phaser.Input.Pointer} pointer - The Pointer to check against the Game Objects. + * @param {string} key - The unique string-based key of the Texture. + * @param {HTMLImageElement} source - The source Image element. + * @param {number} width - The width of the Texture. + * @param {number} height - The height of the Texture. * - * @return {Phaser.GameObjects.GameObject[]} The sorted array of Game Objects. + * @return {?Phaser.Textures.Texture} The Texture that was created, or `null` if the key is already in use. */ - sortGameObjects: function (gameObjects, pointer) + create: function (key, source, width, height) { - if (gameObjects.length < 2) + var texture = null; + + if (this.checkKey(key)) { - return gameObjects; - } + texture = new Texture(this, key, source, width, height); - var list = pointer.camera.renderList; + this.list[key] = texture; + } - return gameObjects.sort(function (childA, childB) - { - return list.indexOf(childB) - list.indexOf(childA); - }); + return texture; }, /** - * Given an array of Drop Zone Game Objects, sort the array and return it, - * so that the objects are in depth index order with the lowest at the bottom. + * Checks the given key to see if a Texture using it exists within this Texture Manager. * - * @method Phaser.Input.InputPlugin#sortDropZones - * @since 3.52.0 + * @method Phaser.Textures.TextureManager#exists + * @since 3.0.0 * - * @param {Phaser.GameObjects.GameObject[]} gameObjects - An array of Game Objects to be sorted. + * @param {string} key - The unique string-based key of the Texture. * - * @return {Phaser.GameObjects.GameObject[]} The sorted array of Game Objects. + * @return {boolean} Returns `true` if a Texture matching the given key exists in this Texture Manager. */ - sortDropZones: function (gameObjects) + exists: function (key) { - if (gameObjects.length < 2) - { - return gameObjects; - } - - this.scene.sys.depthSort(); - - return gameObjects.sort(this.sortDropZoneHandler.bind(this)); + return (this.list.hasOwnProperty(key)); }, /** - * Return the child lowest down the display list (with the smallest index) - * Will iterate through all parent containers, if present. + * Returns a Texture from the Texture Manager that matches the given key. * - * Prior to version 3.52.0 this method was called `sortHandlerGO`. + * If the key is `undefined` it will return the `__DEFAULT` Texture. * - * @method Phaser.Input.InputPlugin#sortDropZoneHandler - * @private - * @since 3.52.0 + * If the key is an instance of a Texture, it will return the instance. * - * @param {Phaser.GameObjects.GameObject} childA - The first Game Object to compare. - * @param {Phaser.GameObjects.GameObject} childB - The second Game Object to compare. + * If the key is an instance of a Frame, it will return the frames parent Texture instance. * - * @return {number} Returns either a negative or positive integer, or zero if they match. + * Finally, if the key is given, but not found, and not a Texture or Frame instance, it will return the `__MISSING` Texture. + * + * @method Phaser.Textures.TextureManager#get + * @since 3.0.0 + * + * @param {(string|Phaser.Textures.Texture|Phaser.Textures.Frame)} key - The unique string-based key of the Texture, or a Texture, or Frame instance. + * + * @return {Phaser.Textures.Texture} The Texture matching the given key. */ - sortDropZoneHandler: function (childA, childB) + get: function (key) { - if (!childA.parentContainer && !childB.parentContainer) - { - // Quick bail out when neither child has a container - return this.displayList.getIndex(childB) - this.displayList.getIndex(childA); - } - else if (childA.parentContainer === childB.parentContainer) + if (key === undefined) { key = '__DEFAULT'; } + + if (this.list[key]) { - // Quick bail out when both children have the same container - return childB.parentContainer.getIndex(childB) - childA.parentContainer.getIndex(childA); + return this.list[key]; } - else if (childA.parentContainer === childB) + else if (key instanceof Texture) { - // Quick bail out when childA is a child of childB - return -1; + return key; } - else if (childB.parentContainer === childA) + else if (key instanceof Frame) { - // Quick bail out when childA is a child of childB - return 1; + return key.texture; } else { - // Container index check - var listA = childA.getIndexList(); - var listB = childB.getIndexList(); - var len = Math.min(listA.length, listB.length); - - for (var i = 0; i < len; i++) - { - var indexA = listA[i]; - var indexB = listB[i]; - - if (indexA === indexB) - { - // Go to the next level down - continue; - } - else - { - // Non-matching parents, so return - return indexB - indexA; - } - } - - return listB.length - listA.length; + return this.list['__MISSING']; } - - // Technically this shouldn't happen, but ... - // eslint-disable-next-line no-unreachable - return 0; }, /** - * This method should be called from within an input event handler, such as `pointerdown`. - * - * When called, it stops the Input Manager from allowing _this specific event_ to be processed by any other Scene - * not yet handled in the scene list. + * Takes a Texture key and Frame name and returns a clone of that Frame if found. * - * @method Phaser.Input.InputPlugin#stopPropagation + * @method Phaser.Textures.TextureManager#cloneFrame * @since 3.0.0 * - * @return {this} This InputPlugin object. + * @param {string} key - The unique string-based key of the Texture. + * @param {(string|number)} frame - The string or index of the Frame to be cloned. + * + * @return {Phaser.Textures.Frame} A Clone of the given Frame. */ - stopPropagation: function () + cloneFrame: function (key, frame) { - this.manager._tempSkip = true; - - return this; + if (this.list[key]) + { + return this.list[key].get(frame).clone(); + } }, /** - * Adds new Pointer objects to the Input Manager. - * - * By default Phaser creates 2 pointer objects: `mousePointer` and `pointer1`. - * - * You can create more either by calling this method, or by setting the `input.activePointers` property - * in the Game Config, up to a maximum of 10 pointers. - * - * The first 10 pointers are available via the `InputPlugin.pointerX` properties, once they have been added - * via this method. + * Takes a Texture key and Frame name and returns a reference to that Frame, if found. * - * @method Phaser.Input.InputPlugin#addPointer - * @since 3.10.0 + * @method Phaser.Textures.TextureManager#getFrame + * @since 3.0.0 * - * @param {number} [quantity=1] The number of new Pointers to create. A maximum of 10 is allowed in total. + * @param {string} key - The unique string-based key of the Texture. + * @param {(string|number)} [frame] - The string-based name, or integer based index, of the Frame to get from the Texture. * - * @return {Phaser.Input.Pointer[]} An array containing all of the new Pointer objects that were created. + * @return {Phaser.Textures.Frame} A Texture Frame object. */ - addPointer: function (quantity) + getFrame: function (key, frame) { - return this.manager.addPointer(quantity); + if (this.list[key]) + { + return this.list[key].get(frame); + } }, /** - * Tells the Input system to set a custom cursor. - * - * This cursor will be the default cursor used when interacting with the game canvas. - * - * If an Interactive Object also sets a custom cursor, this is the cursor that is reset after its use. - * - * Any valid CSS cursor value is allowed, including paths to image files, i.e.: - * - * ```javascript - * this.input.setDefaultCursor('url(assets/cursors/sword.cur), pointer'); - * ``` - * - * Please read about the differences between browsers when it comes to the file formats and sizes they support: + * Parses the 'key' parameter and returns a Texture Frame instance. * - * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor - * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_User_Interface/Using_URL_values_for_the_cursor_property + * It can accept the following formats: * - * It's up to you to pick a suitable cursor format that works across the range of browsers you need to support. + * 1) A string + * 2) An array where the elements are: [ key, [frame] ] + * 3) An object with the properties: { key, [frame] } + * 4) A Texture instance - which returns the default frame from the Texture + * 5) A Frame instance - returns itself * - * @method Phaser.Input.InputPlugin#setDefaultCursor - * @since 3.10.0 + * @method Phaser.Textures.TextureManager#parseFrame + * @since 3.60.0 * - * @param {string} cursor - The CSS to be used when setting the default cursor. + * @param {(string|array|object|Phaser.Textures.Texture|Phaser.Textures.Frame)} key - The key to be parsed. * - * @return {this} This Input instance. + * @return {Phaser.Textures.Frame} A Texture Frame object, if found, or undefined if not. */ - setDefaultCursor: function (cursor) + parseFrame: function (key) { - this.manager.setDefaultCursor(cursor); - - return this; + if (!key) + { + return undefined; + } + else if (typeof key === 'string') + { + return this.getFrame(key); + } + else if (Array.isArray(key) && key.length === 2) + { + return this.getFrame(key[0], key[1]); + } + else if (IsPlainObject(key)) + { + return this.getFrame(key.key, key.frame); + } + else if (key instanceof Texture) + { + return key.get(); + } + else if (key instanceof Frame) + { + return key; + } }, /** - * The Scene that owns this plugin is transitioning in. + * Returns an array with all of the keys of all Textures in this Texture Manager. + * The output array will exclude the `__DEFAULT`, `__MISSING`, and `__WHITE` keys. * - * @method Phaser.Input.InputPlugin#transitionIn - * @private - * @since 3.5.0 - */ - transitionIn: function () - { - this.enabled = this.settings.transitionAllowInput; - }, - - /** - * The Scene that owns this plugin has finished transitioning in. + * @method Phaser.Textures.TextureManager#getTextureKeys + * @since 3.0.0 * - * @method Phaser.Input.InputPlugin#transitionComplete - * @private - * @since 3.5.0 + * @return {string[]} An array containing all of the Texture keys stored in this Texture Manager. */ - transitionComplete: function () + getTextureKeys: function () { - if (!this.settings.transitionAllowInput) + var output = []; + + for (var key in this.list) { - this.enabled = true; + if (key !== '__DEFAULT' && key !== '__MISSING' && key !== '__WHITE') + { + output.push(key); + } } - }, - /** - * The Scene that owns this plugin is transitioning out. - * - * @method Phaser.Input.InputPlugin#transitionOut - * @private - * @since 3.5.0 - */ - transitionOut: function () - { - this.enabled = this.settings.transitionAllowInput; + return output; }, /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. + * Given a Texture and an `x` and `y` coordinate this method will return a new + * Color object that has been populated with the color and alpha values of the pixel + * at that location in the Texture. * - * @method Phaser.Input.InputPlugin#shutdown - * @fires Phaser.Input.Events#SHUTDOWN - * @private + * @method Phaser.Textures.TextureManager#getPixel * @since 3.0.0 + * + * @param {number} x - The x coordinate of the pixel within the Texture. + * @param {number} y - The y coordinate of the pixel within the Texture. + * @param {string} key - The unique string-based key of the Texture. + * @param {(string|number)} [frame] - The string or index of the Frame. + * + * @return {?Phaser.Display.Color} A Color object populated with the color values of the requested pixel, + * or `null` if the coordinates were out of bounds. */ - shutdown: function () + getPixel: function (x, y, key, frame) { - // Registered input plugins listen for this - this.pluginEvents.emit(Events.SHUTDOWN); - - this._temp.length = 0; - this._list.length = 0; - this._draggable.length = 0; - this._pendingRemoval.length = 0; - this._pendingInsertion.length = 0; - this._dragState.length = 0; + var textureFrame = this.getFrame(key, frame); - for (var i = 0; i < 10; i++) + if (textureFrame) { - this._drag[i] = []; - this._over[i] = []; - } + // Adjust for trim (if not trimmed x and y are just zero) + x -= textureFrame.x; + y -= textureFrame.y; - this.removeAllListeners(); + var data = textureFrame.data.cut; - var manager = this.manager; + x += data.x; + y += data.y; - manager.canvas.style.cursor = manager.defaultCursor; + if (x >= data.x && x < data.r && y >= data.y && y < data.b) + { + var ctx = this._tempContext; - var eventEmitter = this.systems.events; + ctx.clearRect(0, 0, 1, 1); + ctx.drawImage(textureFrame.source.image, x, y, 1, 1, 0, 0, 1, 1); - eventEmitter.off(SceneEvents.TRANSITION_START, this.transitionIn, this); - eventEmitter.off(SceneEvents.TRANSITION_OUT, this.transitionOut, this); - eventEmitter.off(SceneEvents.TRANSITION_COMPLETE, this.transitionComplete, this); - eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + var rgb = ctx.getImageData(0, 0, 1, 1); - manager.events.off(Events.GAME_OUT, this.onGameOut, this); - manager.events.off(Events.GAME_OVER, this.onGameOver, this); + return new Color(rgb.data[0], rgb.data[1], rgb.data[2], rgb.data[3]); + } + } - eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); + return null; }, /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. + * Given a Texture and an `x` and `y` coordinate this method will return a value between 0 and 255 + * corresponding to the alpha value of the pixel at that location in the Texture. If the coordinate + * is out of bounds it will return null. * - * @method Phaser.Input.InputPlugin#destroy - * @fires Phaser.Input.Events#DESTROY - * @private - * @since 3.0.0 + * @method Phaser.Textures.TextureManager#getPixelAlpha + * @since 3.10.0 + * + * @param {number} x - The x coordinate of the pixel within the Texture. + * @param {number} y - The y coordinate of the pixel within the Texture. + * @param {string} key - The unique string-based key of the Texture. + * @param {(string|number)} [frame] - The string or index of the Frame. + * + * @return {number} A value between 0 and 255, or `null` if the coordinates were out of bounds. */ - destroy: function () + getPixelAlpha: function (x, y, key, frame) { - this.shutdown(); + var textureFrame = this.getFrame(key, frame); - // Registered input plugins listen for this - this.pluginEvents.emit(Events.DESTROY); + if (textureFrame) + { + // Adjust for trim (if not trimmed x and y are just zero) + x -= textureFrame.x; + y -= textureFrame.y; - this.pluginEvents.removeAllListeners(); + var data = textureFrame.data.cut; - this.scene.sys.events.off(SceneEvents.START, this.start, this); + x += data.x; + y += data.y; - this.scene = null; - this.cameras = null; - this.manager = null; - this.events = null; - this.mouse = null; + if (x >= data.x && x < data.r && y >= data.y && y < data.b) + { + var ctx = this._tempContext; + + ctx.clearRect(0, 0, 1, 1); + ctx.drawImage(textureFrame.source.image, x, y, 1, 1, 0, 0, 1, 1); + + var rgb = ctx.getImageData(0, 0, 1, 1); + + return rgb.data[3]; + } + } + + return null; }, /** - * The x coordinates of the ActivePointer based on the first camera in the camera list. - * This is only safe to use if your game has just 1 non-transformed camera and doesn't use multi-touch. + * Sets the given Game Objects `texture` and `frame` properties so that it uses + * the Texture and Frame specified in the `key` and `frame` arguments to this method. * - * @name Phaser.Input.InputPlugin#x - * @type {number} - * @readonly + * @method Phaser.Textures.TextureManager#setTexture * @since 3.0.0 + * + * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object the texture would be set on. + * @param {string} key - The unique string-based key of the Texture. + * @param {(string|number)} [frame] - The string or index of the Frame. + * + * @return {Phaser.GameObjects.GameObject} The Game Object the texture was set on. */ - x: { - - get: function () + setTexture: function (gameObject, key, frame) + { + if (this.list[key]) { - return this.manager.activePointer.x; + gameObject.texture = this.list[key]; + gameObject.frame = gameObject.texture.get(frame); } + return gameObject; }, /** - * The y coordinates of the ActivePointer based on the first camera in the camera list. - * This is only safe to use if your game has just 1 non-transformed camera and doesn't use multi-touch. + * Changes the key being used by a Texture to the new key provided. * - * @name Phaser.Input.InputPlugin#y - * @type {number} - * @readonly - * @since 3.0.0 + * The old key is removed, allowing it to be re-used. + * + * Game Objects are linked to Textures by a reference to the Texture object, so + * all existing references will be retained. + * + * @method Phaser.Textures.TextureManager#renameTexture + * @since 3.12.0 + * + * @param {string} currentKey - The current string-based key of the Texture you wish to rename. + * @param {string} newKey - The new unique string-based key to use for the Texture. + * + * @return {boolean} `true` if the Texture key was successfully renamed, otherwise `false`. */ - y: { + renameTexture: function (currentKey, newKey) + { + var texture = this.get(currentKey); - get: function () + if (texture && currentKey !== newKey) { - return this.manager.activePointer.y; + texture.key = newKey; + + this.list[newKey] = texture; + + delete this.list[currentKey]; + + return true; } + return false; }, /** - * Are any mouse or touch pointers currently over the game canvas? + * Passes all Textures to the given callback. * - * @name Phaser.Input.InputPlugin#isOver - * @type {boolean} - * @readonly - * @since 3.16.0 + * @method Phaser.Textures.TextureManager#each + * @since 3.0.0 + * + * @param {EachTextureCallback} callback - The callback function to be sent the Textures. + * @param {object} scope - The value to use as `this` when executing the callback. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. */ - isOver: { + each: function (callback, scope) + { + var args = [ null ]; - get: function () + for (var i = 1; i < arguments.length; i++) { - return this.manager.isOver; + args.push(arguments[i]); } + for (var texture in this.list) + { + args[0] = this.list[texture]; + + callback.apply(scope, args); + } }, /** - * The mouse has its own unique Pointer object, which you can reference directly if making a _desktop specific game_. - * If you are supporting both desktop and touch devices then do not use this property, instead use `activePointer` - * which will always map to the most recently interacted pointer. + * Resets the internal Stamp object, ready for drawing and returns it. * - * @name Phaser.Input.InputPlugin#mousePointer - * @type {Phaser.Input.Pointer} - * @readonly - * @since 3.10.0 + * @method Phaser.Textures.TextureManager#resetStamp + * @since 3.60.0 + * + * @param {number} [alpha=1] - The alpha to use. + * @param {number} [tint=0xffffff] - WebGL only. The tint color to use. + * + * @return {Phaser.GameObjects.Image} A reference to the Stamp Game Object. */ - mousePointer: { + resetStamp: function (alpha, tint) + { + if (alpha === undefined) { alpha = 1; } + if (tint === undefined) { tint = 0xffffff; } - get: function () - { - return this.manager.mousePointer; - } + var stamp = this.stamp; + + stamp.setCrop(); + stamp.setPosition(0); + stamp.setAngle(0); + stamp.setScale(1); + stamp.setAlpha(alpha); + stamp.setTint(tint); + return stamp; }, /** - * The current active input Pointer. + * Destroys the Texture Manager and all Textures stored within it. * - * @name Phaser.Input.InputPlugin#activePointer - * @type {Phaser.Input.Pointer} - * @readonly + * @method Phaser.Textures.TextureManager#destroy * @since 3.0.0 */ - activePointer: { - - get: function () + destroy: function () + { + for (var texture in this.list) { - return this.manager.activePointer; + this.list[texture].destroy(); } - }, + this.list = {}; - /** - * A touch-based Pointer object. - * This will be `undefined` by default unless you add a new Pointer using `addPointer`. - * - * @name Phaser.Input.InputPlugin#pointer1 - * @type {Phaser.Input.Pointer} - * @readonly - * @since 3.10.0 - */ - pointer1: { + this.stamp.destroy(); - get: function () - { - return this.manager.pointers[1]; - } + this.game = null; + this.stamp = null; - }, + CanvasPool.remove(this._tempCanvas); + } - /** - * A touch-based Pointer object. - * This will be `undefined` by default unless you add a new Pointer using `addPointer`. - * - * @name Phaser.Input.InputPlugin#pointer2 - * @type {Phaser.Input.Pointer} - * @readonly - * @since 3.10.0 - */ - pointer2: { +}); - get: function () - { - return this.manager.pointers[2]; - } +module.exports = TextureManager; - }, - /** - * A touch-based Pointer object. - * This will be `undefined` by default unless you add a new Pointer using `addPointer`. - * - * @name Phaser.Input.InputPlugin#pointer3 - * @type {Phaser.Input.Pointer} - * @readonly - * @since 3.10.0 - */ - pointer3: { +/***/ }), - get: function () - { - return this.manager.pointers[3]; - } +/***/ 32547: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * A touch-based Pointer object. - * This will be `undefined` by default unless you add a new Pointer using `addPointer`. - * - * @name Phaser.Input.InputPlugin#pointer4 - * @type {Phaser.Input.Pointer} - * @readonly - * @since 3.10.0 - */ - pointer4: { +var CanvasPool = __webpack_require__(61068); +var Class = __webpack_require__(56694); +var IsSizePowerOfTwo = __webpack_require__(28621); +var ScaleModes = __webpack_require__(27394); - get: function () - { - return this.manager.pointers[4]; - } +/** + * @classdesc + * A Texture Source is the encapsulation of the actual source data for a Texture. + * + * This is typically an Image Element, loaded from the file system or network, a Canvas Element or a Video Element. + * + * A Texture can contain multiple Texture Sources, which only happens when a multi-atlas is loaded. + * + * @class TextureSource + * @memberof Phaser.Textures + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Textures.Texture} texture - The Texture this TextureSource belongs to. + * @param {(HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|Phaser.GameObjects.RenderTexture|WebGLTexture|Phaser.Types.Textures.CompressedTextureData|Phaser.Textures.DynamicTexture)} source - The source image data. + * @param {number} [width] - Optional width of the source image. If not given it's derived from the source itself. + * @param {number} [height] - Optional height of the source image. If not given it's derived from the source itself. + * @param {boolean} [flipY=false] - Sets the `UNPACK_FLIP_Y_WEBGL` flag the WebGL Texture uses during upload. + */ +var TextureSource = new Class({ - }, + initialize: - /** - * A touch-based Pointer object. - * This will be `undefined` by default unless you add a new Pointer using `addPointer`. - * - * @name Phaser.Input.InputPlugin#pointer5 - * @type {Phaser.Input.Pointer} - * @readonly - * @since 3.10.0 - */ - pointer5: { + function TextureSource (texture, source, width, height, flipY) + { + if (flipY === undefined) { flipY = false; } - get: function () - { - return this.manager.pointers[5]; - } + var game = texture.manager.game; + + /** + * A reference to the Canvas or WebGL Renderer. + * + * @name Phaser.Textures.TextureSource#renderer + * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} + * @since 3.7.0 + */ + this.renderer = game.renderer; + + /** + * The Texture this TextureSource instance belongs to. + * + * @name Phaser.Textures.TextureSource#texture + * @type {Phaser.Textures.Texture} + * @since 3.0.0 + */ + this.texture = texture; + + /** + * The source of the image data. + * + * This is either an Image Element, a Canvas Element, a Video Element, a RenderTexture or a WebGLTexture. + * + * In Phaser 3.60 and above it can also be a Compressed Texture data object. + * + * @name Phaser.Textures.TextureSource#source + * @type {(HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|Phaser.GameObjects.RenderTexture|WebGLTexture|Phaser.Types.Textures.CompressedTextureData|Phaser.Textures.DynamicTexture)} + * @since 3.12.0 + */ + this.source = source; + + /** + * The image data. + * + * This is either an Image element, Canvas element or a Video Element. + * + * @name Phaser.Textures.TextureSource#image + * @type {(HTMLImageElement|HTMLCanvasElement|HTMLVideoElement)} + * @since 3.0.0 + */ + this.image = (source.compressed) ? null : source; + + /** + * Holds the compressed textured algorithm, or `null` if it's not a compressed texture. + * + * Prior to Phaser 3.60 this value always held `null`. + * + * @name Phaser.Textures.TextureSource#compressionAlgorithm + * @type {number} + * @default null + * @since 3.0.0 + */ + this.compressionAlgorithm = (source.compressed) ? source.format : null; + + /** + * The resolution of the source image. + * + * @name Phaser.Textures.TextureSource#resolution + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.resolution = 1; + + /** + * The width of the source image. If not specified in the constructor it will check + * the `naturalWidth` and then `width` properties of the source image. + * + * @name Phaser.Textures.TextureSource#width + * @type {number} + * @since 3.0.0 + */ + this.width = width || source.naturalWidth || source.videoWidth || source.width || 0; + + /** + * The height of the source image. If not specified in the constructor it will check + * the `naturalHeight` and then `height` properties of the source image. + * + * @name Phaser.Textures.TextureSource#height + * @type {number} + * @since 3.0.0 + */ + this.height = height || source.naturalHeight || source.videoHeight || source.height || 0; + + /** + * The Scale Mode the image will use when rendering. + * Either Linear or Nearest. + * + * @name Phaser.Textures.TextureSource#scaleMode + * @type {number} + * @since 3.0.0 + */ + this.scaleMode = ScaleModes.DEFAULT; + + /** + * Is the source image a Canvas Element? + * + * @name Phaser.Textures.TextureSource#isCanvas + * @type {boolean} + * @since 3.0.0 + */ + this.isCanvas = (source instanceof HTMLCanvasElement); + + /** + * Is the source image a Video Element? + * + * @name Phaser.Textures.TextureSource#isVideo + * @type {boolean} + * @since 3.20.0 + */ + this.isVideo = (window.hasOwnProperty('HTMLVideoElement') && source instanceof HTMLVideoElement); + + /** + * Is the source image a Render Texture? + * + * @name Phaser.Textures.TextureSource#isRenderTexture + * @type {boolean} + * @since 3.12.0 + */ + this.isRenderTexture = (source.type === 'RenderTexture' || source.type === 'DynamicTexture'); + + /** + * Is the source image a WebGLTexture? + * + * @name Phaser.Textures.TextureSource#isGLTexture + * @type {boolean} + * @since 3.19.0 + */ + this.isGLTexture = (window.hasOwnProperty('WebGLTexture') && source instanceof WebGLTexture); + + /** + * Are the source image dimensions a power of two? + * + * @name Phaser.Textures.TextureSource#isPowerOf2 + * @type {boolean} + * @since 3.0.0 + */ + this.isPowerOf2 = IsSizePowerOfTwo(this.width, this.height); + + /** + * The WebGL Texture of the source image. If this TextureSource is driven from a WebGLTexture + * already, then this is a reference to that WebGLTexture. + * + * @name Phaser.Textures.TextureSource#glTexture + * @type {?WebGLTexture} + * @default null + * @since 3.0.0 + */ + this.glTexture = null; + + /** + * Sets the `UNPACK_FLIP_Y_WEBGL` flag the WebGL Texture uses during upload. + * + * @name Phaser.Textures.TextureSource#flipY + * @type {boolean} + * @since 3.20.0 + */ + this.flipY = flipY; + this.init(game); }, /** - * A touch-based Pointer object. - * This will be `undefined` by default unless you add a new Pointer using `addPointer`. + * Creates a WebGL Texture, if required, and sets the Texture filter mode. * - * @name Phaser.Input.InputPlugin#pointer6 - * @type {Phaser.Input.Pointer} - * @readonly - * @since 3.10.0 + * @method Phaser.Textures.TextureSource#init + * @since 3.0.0 + * + * @param {Phaser.Game} game - A reference to the Phaser Game instance. */ - pointer6: { + init: function (game) + { + var renderer = this.renderer; - get: function () + if (renderer) { - return this.manager.pointers[6]; + var source = this.source; + + if (renderer.gl) + { + var image = this.image; + var flipY = this.flipY; + var width = this.width; + var height = this.height; + var scaleMode = this.scaleMode; + + if (this.isCanvas) + { + this.glTexture = renderer.createCanvasTexture(image, false, flipY); + } + else if (this.isVideo) + { + this.glTexture = renderer.createVideoTexture(image, false, flipY); + } + else if (this.isRenderTexture) + { + this.glTexture = renderer.createTextureFromSource(null, width, height, scaleMode); + } + else if (this.isGLTexture) + { + this.glTexture = source; + } + else if (this.compressionAlgorithm) + { + this.glTexture = renderer.createTextureFromSource(source); + } + else + { + this.glTexture = renderer.createTextureFromSource(image, width, height, scaleMode); + } + + if (false) + {} + } + else if (this.isRenderTexture) + { + this.image = source.canvas; + } } + if (!game.config.antialias) + { + this.setFilter(1); + } }, /** - * A touch-based Pointer object. - * This will be `undefined` by default unless you add a new Pointer using `addPointer`. + * Sets the Filter Mode for this Texture. * - * @name Phaser.Input.InputPlugin#pointer7 - * @type {Phaser.Input.Pointer} - * @readonly - * @since 3.10.0 + * The mode can be either Linear, the default, or Nearest. + * + * For pixel-art you should use Nearest. + * + * @method Phaser.Textures.TextureSource#setFilter + * @since 3.0.0 + * + * @param {Phaser.Textures.FilterMode} filterMode - The Filter Mode. */ - pointer7: { - - get: function () + setFilter: function (filterMode) + { + if (this.renderer.gl) { - return this.manager.pointers[7]; + this.renderer.setTextureFilter(this.glTexture, filterMode); } + this.scaleMode = filterMode; }, /** - * A touch-based Pointer object. - * This will be `undefined` by default unless you add a new Pointer using `addPointer`. + * Sets the `UNPACK_FLIP_Y_WEBGL` flag for the WebGL Texture during texture upload. * - * @name Phaser.Input.InputPlugin#pointer8 - * @type {Phaser.Input.Pointer} - * @readonly - * @since 3.10.0 + * @method Phaser.Textures.TextureSource#setFlipY + * @since 3.20.0 + * + * @param {boolean} [value=true] - Should the WebGL Texture be flipped on the Y axis on texture upload or not? */ - pointer8: { + setFlipY: function (value) + { + if (value === undefined) { value = true; } - get: function () - { - return this.manager.pointers[8]; - } + this.flipY = value; + return this; }, /** - * A touch-based Pointer object. - * This will be `undefined` by default unless you add a new Pointer using `addPointer`. + * If this TextureSource is backed by a Canvas and is running under WebGL, + * it updates the WebGLTexture using the canvas data. * - * @name Phaser.Input.InputPlugin#pointer9 - * @type {Phaser.Input.Pointer} - * @readonly - * @since 3.10.0 + * @method Phaser.Textures.TextureSource#update + * @since 3.7.0 */ - pointer9: { + update: function () + { + var renderer = this.renderer; + var image = this.image; + var flipY = this.flipY; + var gl = renderer.gl; - get: function () + if (gl && this.isCanvas) { - return this.manager.pointers[9]; + this.glTexture = renderer.updateCanvasTexture(image, this.glTexture, flipY); + } + else if (gl && this.isVideo) + { + this.glTexture = renderer.updateVideoTexture(image, this.glTexture, flipY); } - }, /** - * A touch-based Pointer object. - * This will be `undefined` by default unless you add a new Pointer using `addPointer`. + * Destroys this Texture Source and nulls the references. * - * @name Phaser.Input.InputPlugin#pointer10 - * @type {Phaser.Input.Pointer} - * @readonly - * @since 3.10.0 + * @method Phaser.Textures.TextureSource#destroy + * @since 3.0.0 */ - pointer10: { + destroy: function () + { + if (this.glTexture) + { + this.renderer.deleteTexture(this.glTexture, true); + } - get: function () + if (this.isCanvas) { - return this.manager.pointers[10]; + CanvasPool.remove(this.image); } + this.renderer = null; + this.texture = null; + this.source = null; + this.image = null; + this.glTexture = null; } }); -PluginCache.register('InputPlugin', InputPlugin, 'input'); - -module.exports = InputPlugin; +module.exports = TextureSource; /***/ }), -/* 1322 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 65154: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @namespace Phaser.Input.Keyboard + * Filter Types. + * + * @namespace Phaser.Textures.FilterMode + * @memberof Phaser.Textures + * @since 3.0.0 */ +var CONST = { -module.exports = { + /** + * Linear filter type. + * + * @name Phaser.Textures.FilterMode.LINEAR + * @type {number} + * @const + * @since 3.0.0 + */ + LINEAR: 0, - Events: __webpack_require__(154), + /** + * Nearest neighbor filter type. + * + * @name Phaser.Textures.FilterMode.NEAREST + * @type {number} + * @const + * @since 3.0.0 + */ + NEAREST: 1 - KeyboardManager: __webpack_require__(410), - KeyboardPlugin: __webpack_require__(1330), +}; - Key: __webpack_require__(512), - KeyCodes: __webpack_require__(143), +module.exports = CONST; - KeyCombo: __webpack_require__(513), - AdvanceKeyCombo: __webpack_require__(515), - ProcessKeyCombo: __webpack_require__(514), - ResetKeyCombo: __webpack_require__(516), +/***/ }), - JustDown: __webpack_require__(1332), - JustUp: __webpack_require__(1333), - DownDuration: __webpack_require__(1334), - UpDuration: __webpack_require__(1335) +/***/ 49644: +/***/ ((module) => { -}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * The Texture Add Event. + * + * This event is dispatched by the Texture Manager when a texture is added to it. + * + * Listen to this event from within a Scene using: `this.textures.on('addtexture', listener)`. + * + * @event Phaser.Textures.Events#ADD + * @type {string} + * @since 3.0.0 + * + * @param {string} key - The key of the Texture that was added to the Texture Manager. + * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was added to the Texture Manager. + */ +module.exports = 'addtexture'; /***/ }), -/* 1323 */ -/***/ (function(module, exports) { + +/***/ 29569: +/***/ ((module) => { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Global Key Down Event. - * - * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down. - * - * Listen to this event from within a Scene using: `this.input.keyboard.on('keydown', listener)`. - * - * You can also listen for a specific key being pressed. See [Keyboard.Events.KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_DOWN} for details. - * - * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details. - * - * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. - * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details. + * The Texture Add Key Event. * - * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. - * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. - * There are others. So, please check your extensions if you find you have specific keys that don't work. + * This event is dispatched by the Texture Manager when a texture with the given key is added to it. * - * @event Phaser.Input.Keyboard.Events#ANY_KEY_DOWN - * @since 3.0.0 - * - * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc. + * Listen to this event from within a Scene using: `this.textures.on('addtexture-key', listener)`. + * + * @event Phaser.Textures.Events#ADD_KEY + * @type {string} + * @since 3.60.0 + * + * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was added to the Texture Manager. */ -module.exports = 'keydown'; +module.exports = 'addtexture-'; /***/ }), -/* 1324 */ -/***/ (function(module, exports) { + +/***/ 60079: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Global Key Up Event. - * - * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released. - * - * Listen to this event from within a Scene using: `this.input.keyboard.on('keyup', listener)`. - * - * You can also listen for a specific key being released. See [Keyboard.Events.KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_UP} for details. - * - * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details. + * The Texture Load Error Event. * - * @event Phaser.Input.Keyboard.Events#ANY_KEY_UP + * This event is dispatched by the Texture Manager when a texture it requested to load failed. + * This only happens when base64 encoded textures fail. All other texture types are loaded via the Loader Plugin. + * + * Listen to this event from within a Scene using: `this.textures.on('onerror', listener)`. + * + * @event Phaser.Textures.Events#ERROR + * @type {string} * @since 3.0.0 - * - * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc. + * + * @param {string} key - The key of the Texture that failed to load into the Texture Manager. */ -module.exports = 'keyup'; +module.exports = 'onerror'; /***/ }), -/* 1325 */ -/***/ (function(module, exports) { + +/***/ 72665: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Key Combo Match Event. - * - * This event is dispatched by the Keyboard Plugin when a [Key Combo]{@link Phaser.Input.Keyboard.KeyCombo} is matched. - * - * Listen for this event from the Key Plugin after a combo has been created: - * - * ```javascript - * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true }); + * The Texture Load Event. * - * this.input.keyboard.on('keycombomatch', function (event) { - * console.log('Konami Code entered!'); - * }); - * ``` + * This event is dispatched by the Texture Manager when a texture has finished loading on it. + * This only happens for base64 encoded textures. All other texture types are loaded via the Loader Plugin. * - * @event Phaser.Input.Keyboard.Events#COMBO_MATCH + * Listen to this event from within a Scene using: `this.textures.on('onload', listener)`. + * + * This event is dispatched after the [ADD]{@linkcode Phaser.Textures.Events#event:ADD} event. + * + * @event Phaser.Textures.Events#LOAD + * @type {string} * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.KeyCombo} keycombo - The Key Combo object that was matched. - * @param {KeyboardEvent} event - The native DOM Keyboard Event of the final key in the combo. You can inspect this to learn more about any modifiers, etc. + * + * @param {string} key - The key of the Texture that was loaded by the Texture Manager. + * @param {Phaser.Textures.Texture} texture - A reference to the Texture that was loaded by the Texture Manager. */ -module.exports = 'keycombomatch'; +module.exports = 'onload'; /***/ }), -/* 1326 */ -/***/ (function(module, exports) { + +/***/ 93006: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Key Down Event. - * - * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is pressed. - * - * Listen for this event from the Key object instance directly: - * - * ```javascript - * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); - * - * spaceBar.on('down', listener) - * ``` - * - * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details. + * This internal event signifies that the Texture Manager is now ready and the Game can continue booting. * - * @event Phaser.Input.Keyboard.Events#DOWN - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.Key} key - The Key object that was pressed. - * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc. + * When a Phaser Game instance is booting for the first time, the Texture Manager has to wait on a couple of non-blocking + * async events before it's fully ready to carry on. When those complete the Texture Manager emits this event via the Game + * instance, which tells the Game to carry on booting. + * + * @event Phaser.Textures.Events#READY + * @type {string} + * @since 3.16.1 */ -module.exports = 'down'; +module.exports = 'ready'; /***/ }), -/* 1327 */ -/***/ (function(module, exports) { + +/***/ 69018: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Key Down Event. - * - * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down. - * - * Unlike the `ANY_KEY_DOWN` event, this one has a special dynamic event name. For example, to listen for the `A` key being pressed - * use the following from within a Scene: `this.input.keyboard.on('keydown-A', listener)`. You can replace the `-A` part of the event - * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar: - * `this.input.keyboard.on('keydown-SPACE', listener)`. - * - * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details. - * - * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details. - * - * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. - * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details. + * The Texture Remove Event. * - * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. - * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. - * There are others. So, please check your extensions if you find you have specific keys that don't work. + * This event is dispatched by the Texture Manager when a texture is removed from it. * - * @event Phaser.Input.Keyboard.Events#KEY_DOWN + * Listen to this event from within a Scene using: `this.textures.on('removetexture', listener)`. + * + * If you have any Game Objects still using the removed texture, they will start throwing + * errors the next time they try to render. Be sure to clear all use of the texture in this event handler. + * + * @event Phaser.Textures.Events#REMOVE + * @type {string} * @since 3.0.0 - * - * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc. + * + * @param {string} key - The key of the Texture that was removed from the Texture Manager. */ -module.exports = 'keydown-'; +module.exports = 'removetexture'; /***/ }), -/* 1328 */ -/***/ (function(module, exports) { + +/***/ 85549: +/***/ ((module) => { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Key Up Event. - * - * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released. - * - * Unlike the `ANY_KEY_UP` event, this one has a special dynamic event name. For example, to listen for the `A` key being released - * use the following from within a Scene: `this.input.keyboard.on('keyup-A', listener)`. You can replace the `-A` part of the event - * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar: - * `this.input.keyboard.on('keyup-SPACE', listener)`. - * - * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details. - * - * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details. + * The Texture Remove Key Event. * - * @event Phaser.Input.Keyboard.Events#KEY_UP - * @since 3.0.0 - * - * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc. + * This event is dispatched by the Texture Manager when a texture with the given key is removed from it. + * + * Listen to this event from within a Scene using: `this.textures.on('removetexture-key', listener)`. + * + * If you have any Game Objects still using the removed texture, they will start throwing + * errors the next time they try to render. Be sure to clear all use of the texture in this event handler. + * + * @event Phaser.Textures.Events#REMOVE_KEY + * @type {string} + * @since 3.60.0 */ -module.exports = 'keyup-'; +module.exports = 'removetexture-'; /***/ }), -/* 1329 */ -/***/ (function(module, exports) { + +/***/ 38203: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Key Up Event. - * - * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is released. - * - * Listen for this event from the Key object instance directly: - * - * ```javascript - * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); - * - * spaceBar.on('up', listener) - * ``` - * - * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details. - * - * @event Phaser.Input.Keyboard.Events#UP - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.Key} key - The Key object that was released. - * @param {KeyboardEvent} event - The native DOM Keyboard Event. You can inspect this to learn more about any modifiers, etc. + * @namespace Phaser.Textures.Events */ -module.exports = 'up'; + +module.exports = { + + ADD: __webpack_require__(49644), + ADD_KEY: __webpack_require__(29569), + ERROR: __webpack_require__(60079), + LOAD: __webpack_require__(72665), + READY: __webpack_require__(93006), + REMOVE: __webpack_require__(69018), + REMOVE_KEY: __webpack_require__(85549) + +}; /***/ }), -/* 1330 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 87499: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(154); -var GameEvents = __webpack_require__(22); -var GetValue = __webpack_require__(6); -var InputEvents = __webpack_require__(51); -var InputPluginCache = __webpack_require__(153); -var Key = __webpack_require__(512); -var KeyCodes = __webpack_require__(143); -var KeyCombo = __webpack_require__(513); -var KeyMap = __webpack_require__(1331); -var SceneEvents = __webpack_require__(20); -var SnapFloor = __webpack_require__(76); +var Extend = __webpack_require__(98611); +var FilterMode = __webpack_require__(65154); /** - * @classdesc - * The Keyboard Plugin is an input plugin that belongs to the Scene-owned Input system. - * - * Its role is to listen for native DOM Keyboard Events and then process them. - * - * You do not need to create this class directly, the Input system will create an instance of it automatically. + * @namespace Phaser.Textures + */ + +/** + * Linear filter type. * - * You can access it from within a Scene using `this.input.keyboard`. For example, you can do: + * @name Phaser.Textures.LINEAR + * @type {number} + * @const + * @since 3.0.0 + */ + +/** + * Nearest Neighbor filter type. * - * ```javascript - * this.input.keyboard.on('keydown', callback, context); - * ``` + * @name Phaser.Textures.NEAREST + * @type {number} + * @const + * @since 3.0.0 + */ + +var Textures = { + + CanvasTexture: __webpack_require__(17487), + DynamicTexture: __webpack_require__(845), + Events: __webpack_require__(38203), + FilterMode: FilterMode, + Frame: __webpack_require__(82047), + Parsers: __webpack_require__(69150), + Texture: __webpack_require__(31673), + TextureManager: __webpack_require__(6237), + TextureSource: __webpack_require__(32547) + +}; + +Textures = Extend(false, Textures, FilterMode); + +module.exports = Textures; + + +/***/ }), + +/***/ 35082: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Parses an XML Texture Atlas object and adds all the Frames into a Texture. * - * Or, to listen for a specific key: + * @function Phaser.Textures.Parsers.AtlasXML + * @memberof Phaser.Textures.Parsers + * @private + * @since 3.7.0 * - * ```javascript - * this.input.keyboard.on('keydown-A', callback, context); - * ``` + * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. + * @param {number} sourceIndex - The index of the TextureSource. + * @param {*} xml - The XML data. * - * You can also create Key objects, which you can then poll in your game loop: + * @return {Phaser.Textures.Texture} The Texture modified by this parser. + */ +var AtlasXML = function (texture, sourceIndex, xml) +{ + // Malformed? + if (!xml.getElementsByTagName('TextureAtlas')) + { + console.warn('Invalid Texture Atlas XML given'); + return; + } + + // Add in a __BASE entry (for the entire atlas) + var source = texture.source[sourceIndex]; + + texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); + + // By this stage frames is a fully parsed array + var frames = xml.getElementsByTagName('SubTexture'); + + var newFrame; + + for (var i = 0; i < frames.length; i++) + { + var frame = frames[i].attributes; + + var name = frame.name.value; + var x = parseInt(frame.x.value, 10); + var y = parseInt(frame.y.value, 10); + var width = parseInt(frame.width.value, 10); + var height = parseInt(frame.height.value, 10); + + // The frame values are the exact coordinates to cut the frame out of the atlas from + newFrame = texture.add(name, sourceIndex, x, y, width, height); + + // These are the original (non-trimmed) sprite values + if (frame.frameX) + { + var frameX = Math.abs(parseInt(frame.frameX.value, 10)); + var frameY = Math.abs(parseInt(frame.frameY.value, 10)); + var frameWidth = parseInt(frame.frameWidth.value, 10); + var frameHeight = parseInt(frame.frameHeight.value, 10); + + newFrame.setTrim( + width, + height, + frameX, + frameY, + frameWidth, + frameHeight + ); + } + } + + return texture; +}; + +module.exports = AtlasXML; + + +/***/ }), + +/***/ 83332: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Adds a Canvas Element to a Texture. * - * ```javascript - * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); - * ``` + * @function Phaser.Textures.Parsers.Canvas + * @memberof Phaser.Textures.Parsers + * @private + * @since 3.0.0 * - * If you have multiple parallel Scenes, each trying to get keyboard input, be sure to disable capture on them to stop them from - * stealing input from another Scene in the list. You can do this with `this.input.keyboard.enabled = false` within the - * Scene to stop all input, or `this.input.keyboard.preventDefault = false` to stop a Scene halting input on another Scene. + * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. + * @param {number} sourceIndex - The index of the TextureSource. * - * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. - * See http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/ for more details. + * @return {Phaser.Textures.Texture} The Texture modified by this parser. + */ +var Canvas = function (texture, sourceIndex) +{ + var source = texture.source[sourceIndex]; + + texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); + + return texture; +}; + +module.exports = Canvas; + + +/***/ }), + +/***/ 21560: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Adds an Image Element to a Texture. * - * Also please be aware that certain browser extensions can disable or override Phaser keyboard handling. - * For example the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. - * And there are others. So, please check your extensions before opening Phaser issues about keys that don't work. + * @function Phaser.Textures.Parsers.Image + * @memberof Phaser.Textures.Parsers + * @private + * @since 3.0.0 * - * @class KeyboardPlugin - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Input.Keyboard - * @constructor - * @since 3.10.0 + * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. + * @param {number} sourceIndex - The index of the TextureSource. * - * @param {Phaser.Input.InputPlugin} sceneInputPlugin - A reference to the Scene Input Plugin that the KeyboardPlugin belongs to. + * @return {Phaser.Textures.Texture} The Texture modified by this parser. */ -var KeyboardPlugin = new Class({ - - Extends: EventEmitter, - - initialize: +var Image = function (texture, sourceIndex) +{ + var source = texture.source[sourceIndex]; - function KeyboardPlugin (sceneInputPlugin) - { - EventEmitter.call(this); + texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); - /** - * A reference to the core game, so we can listen for visibility events. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#game - * @type {Phaser.Game} - * @since 3.16.0 - */ - this.game = sceneInputPlugin.systems.game; + return texture; +}; - /** - * A reference to the Scene that this Input Plugin is responsible for. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#scene - * @type {Phaser.Scene} - * @since 3.10.0 - */ - this.scene = sceneInputPlugin.scene; +module.exports = Image; - /** - * A reference to the Scene Systems Settings. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#settings - * @type {Phaser.Types.Scenes.SettingsObject} - * @since 3.10.0 - */ - this.settings = this.scene.sys.settings; - /** - * A reference to the Scene Input Plugin that created this Keyboard Plugin. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#sceneInputPlugin - * @type {Phaser.Input.InputPlugin} - * @since 3.10.0 - */ - this.sceneInputPlugin = sceneInputPlugin; +/***/ }), - /** - * A reference to the global Keyboard Manager. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#manager - * @type {Phaser.Input.Keyboard.KeyboardManager} - * @since 3.16.0 - */ - this.manager = sceneInputPlugin.manager.keyboard; +/***/ 64423: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * A boolean that controls if this Keyboard Plugin is enabled or not. - * Can be toggled on the fly. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#enabled - * @type {boolean} - * @default true - * @since 3.10.0 - */ - this.enabled = true; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * An array of Key objects to process. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#keys - * @type {Phaser.Input.Keyboard.Key[]} - * @since 3.10.0 - */ - this.keys = []; +var Clone = __webpack_require__(32742); - /** - * An array of KeyCombo objects to process. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#combos - * @type {Phaser.Input.Keyboard.KeyCombo[]} - * @since 3.10.0 - */ - this.combos = []; +/** + * Parses a Texture Atlas JSON Array and adds the Frames to the Texture. + * JSON format expected to match that defined by Texture Packer, with the frames property containing an array of Frames. + * + * @function Phaser.Textures.Parsers.JSONArray + * @memberof Phaser.Textures.Parsers + * @private + * @since 3.0.0 + * + * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. + * @param {number} sourceIndex - The index of the TextureSource. + * @param {object} json - The JSON data. + * + * @return {Phaser.Textures.Texture} The Texture modified by this parser. + */ +var JSONArray = function (texture, sourceIndex, json) +{ + // Malformed? + if (!json['frames'] && !json['textures']) + { + console.warn('Invalid Texture Atlas JSON Array'); + return; + } - /** - * Internal repeat key flag. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#prevCode - * @type {string} - * @private - * @since 3.50.0 - */ - this.prevCode = null; + // Add in a __BASE entry (for the entire atlas) + var source = texture.source[sourceIndex]; - /** - * Internal repeat key flag. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#prevTime - * @type {number} - * @private - * @since 3.50.0 - */ - this.prevTime = 0; + texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); - /** - * Internal repeat key flag. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#prevType - * @type {string} - * @private - * @since 3.50.1 - */ - this.prevType = null; + // By this stage frames is a fully parsed array + var frames = (Array.isArray(json.textures)) ? json.textures[sourceIndex].frames : json.frames; - sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this); - sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this); - }, + var newFrame; - /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#boot - * @private - * @since 3.10.0 - */ - boot: function () + for (var i = 0; i < frames.length; i++) { - var settings = this.settings.input; + var src = frames[i]; - this.enabled = GetValue(settings, 'keyboard', true); + // The frame values are the exact coordinates to cut the frame out of the atlas from + newFrame = texture.add(src.filename, sourceIndex, src.frame.x, src.frame.y, src.frame.w, src.frame.h); - var captures = GetValue(settings, 'keyboard.capture', null); + if (!newFrame) + { + console.warn('Invalid atlas json, frame already exists: ' + src.filename); - if (captures) + continue; + } + + // These are the original (non-trimmed) sprite values + if (src.trimmed) { - this.addCaptures(captures); + newFrame.setTrim( + src.sourceSize.w, + src.sourceSize.h, + src.spriteSourceSize.x, + src.spriteSourceSize.y, + src.spriteSourceSize.w, + src.spriteSourceSize.h + ); } - this.sceneInputPlugin.pluginEvents.once(InputEvents.DESTROY, this.destroy, this); - }, + if (src.rotated) + { + newFrame.rotated = true; + newFrame.updateUVsInverted(); + } - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#start - * @private - * @since 3.10.0 - */ - start: function () + var pivot = src.anchor || src.pivot; + + if (pivot) + { + newFrame.customPivot = true; + newFrame.pivotX = pivot.x; + newFrame.pivotY = pivot.y; + } + + // Copy over any extra data + newFrame.customData = Clone(src); + } + + // Copy over any additional data that was in the JSON to Texture.customData + for (var dataKey in json) { - this.sceneInputPlugin.manager.events.on(InputEvents.MANAGER_PROCESS, this.update, this); + if (dataKey === 'frames') + { + continue; + } - this.sceneInputPlugin.pluginEvents.once(InputEvents.SHUTDOWN, this.shutdown, this); + if (Array.isArray(json[dataKey])) + { + texture.customData[dataKey] = json[dataKey].slice(0); + } + else + { + texture.customData[dataKey] = json[dataKey]; + } + } - this.game.events.on(GameEvents.BLUR, this.resetKeys, this); + return texture; +}; - this.scene.sys.events.on(SceneEvents.PAUSE, this.resetKeys, this); - this.scene.sys.events.on(SceneEvents.SLEEP, this.resetKeys, this); - }, +module.exports = JSONArray; - /** - * Checks to see if both this plugin and the Scene to which it belongs is active. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#isActive - * @since 3.10.0 - * - * @return {boolean} `true` if the plugin and the Scene it belongs to is active. - */ - isActive: function () - { - return (this.enabled && this.scene.sys.isActive()); - }, - /** - * By default when a key is pressed Phaser will not stop the event from propagating up to the browser. - * There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll. - * - * This `addCapture` method enables consuming keyboard events for specific keys, so they don't bubble up the browser - * and cause the default behaviors. - * - * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to say prevent - * the SPACE BAR from triggering a page scroll, then it will prevent it for any Scene in your game, not just the calling one. - * - * You can pass a single key code value: - * - * ```javascript - * this.input.keyboard.addCapture(62); - * ``` - * - * An array of key codes: - * - * ```javascript - * this.input.keyboard.addCapture([ 62, 63, 64 ]); - * ``` - * - * Or, a comma-delimited string: - * - * ```javascript - * this.input.keyboard.addCapture('W,S,A,D'); - * ``` - * - * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. - * - * You can also provide an array mixing both strings and key code integers. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#addCapture - * @since 3.16.0 - * - * @param {(string|number|number[]|any[])} keycode - The Key Codes to enable event capture for. - * - * @return {this} This KeyboardPlugin object. - */ - addCapture: function (keycode) - { - this.manager.addCapture(keycode); +/***/ }), - return this; - }, +/***/ 17264: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Removes an existing key capture. - * - * Please note that keyboard captures are global. This means that if you call this method from within a Scene, to remove - * the capture of a key, then it will remove it for any Scene in your game, not just the calling one. - * - * You can pass a single key code value: - * - * ```javascript - * this.input.keyboard.removeCapture(62); - * ``` - * - * An array of key codes: - * - * ```javascript - * this.input.keyboard.removeCapture([ 62, 63, 64 ]); - * ``` - * - * Or, a comma-delimited string: - * - * ```javascript - * this.input.keyboard.removeCapture('W,S,A,D'); - * ``` - * - * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. - * - * You can also provide an array mixing both strings and key code integers. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#removeCapture - * @since 3.16.0 - * - * @param {(string|number|number[]|any[])} keycode - The Key Codes to disable event capture for. - * - * @return {this} This KeyboardPlugin object. - */ - removeCapture: function (keycode) - { - this.manager.removeCapture(keycode); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var Clone = __webpack_require__(32742); - /** - * Returns an array that contains all of the keyboard captures currently enabled. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#getCaptures - * @since 3.16.0 - * - * @return {number[]} An array of all the currently capturing key codes. - */ - getCaptures: function () +/** + * Parses a Texture Atlas JSON Hash and adds the Frames to the Texture. + * JSON format expected to match that defined by Texture Packer, with the frames property containing an object of Frames. + * + * @function Phaser.Textures.Parsers.JSONHash + * @memberof Phaser.Textures.Parsers + * @private + * @since 3.0.0 + * + * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. + * @param {number} sourceIndex - The index of the TextureSource. + * @param {object} json - The JSON data. + * + * @return {Phaser.Textures.Texture} The Texture modified by this parser. + */ +var JSONHash = function (texture, sourceIndex, json) +{ + // Malformed? + if (!json['frames']) { - return this.manager.captures; - }, + console.warn('Invalid Texture Atlas JSON Hash given, missing \'frames\' Object'); + return; + } - /** - * Allows Phaser to prevent any key captures you may have defined from bubbling up the browser. - * You can use this to re-enable event capturing if you had paused it via `disableGlobalCapture`. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#enableGlobalCapture - * @since 3.16.0 - * - * @return {this} This KeyboardPlugin object. - */ - enableGlobalCapture: function () - { - this.manager.preventDefault = true; + // Add in a __BASE entry (for the entire atlas) + var source = texture.source[sourceIndex]; - return this; - }, + texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); - /** - * Disables Phaser from preventing any key captures you may have defined, without actually removing them. - * You can use this to temporarily disable event capturing if, for example, you swap to a DOM element. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#disableGlobalCapture - * @since 3.16.0 - * - * @return {this} This KeyboardPlugin object. - */ - disableGlobalCapture: function () + // By this stage frames is a fully parsed Object + var frames = json.frames; + var newFrame; + + for (var key in frames) { - this.manager.preventDefault = false; + if (!frames.hasOwnProperty(key)) + { + continue; + } - return this; - }, + var src = frames[key]; - /** - * Removes all keyboard captures. - * - * Note that this is a global change. It will clear all event captures across your game, not just for this specific Scene. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#clearCaptures - * @since 3.16.0 - * - * @return {this} This KeyboardPlugin object. - */ - clearCaptures: function () - { - this.manager.clearCaptures(); + // The frame values are the exact coordinates to cut the frame out of the atlas from + newFrame = texture.add(key, sourceIndex, src.frame.x, src.frame.y, src.frame.w, src.frame.h); - return this; - }, + if (!newFrame) + { + console.warn('Invalid atlas json, frame already exists: ' + key); - /** - * Creates and returns an object containing 4 hotkeys for Up, Down, Left and Right, and also Space Bar and shift. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#createCursorKeys - * @since 3.10.0 - * - * @return {Phaser.Types.Input.Keyboard.CursorKeys} An object containing the properties: `up`, `down`, `left`, `right`, `space` and `shift`. - */ - createCursorKeys: function () - { - return this.addKeys({ - up: KeyCodes.UP, - down: KeyCodes.DOWN, - left: KeyCodes.LEFT, - right: KeyCodes.RIGHT, - space: KeyCodes.SPACE, - shift: KeyCodes.SHIFT - }); - }, + continue; + } - /** - * A practical way to create an object containing user selected hotkeys. - * - * For example: - * - * ```javascript - * this.input.keyboard.addKeys({ 'up': Phaser.Input.Keyboard.KeyCodes.W, 'down': Phaser.Input.Keyboard.KeyCodes.S }); - * ``` - * - * would return an object containing the properties (`up` and `down`) mapped to W and S {@link Phaser.Input.Keyboard.Key} objects. - * - * You can also pass in a comma-separated string: - * - * ```javascript - * this.input.keyboard.addKeys('W,S,A,D'); - * ``` - * - * Which will return an object with the properties W, S, A and D mapped to the relevant Key objects. - * - * To use non-alpha numeric keys, use a string, such as 'UP', 'SPACE' or 'LEFT'. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#addKeys - * @since 3.10.0 - * - * @param {(object|string)} keys - An object containing Key Codes, or a comma-separated string. - * @param {boolean} [enableCapture=true] - Automatically call `preventDefault` on the native DOM browser event for the key codes being added. - * @param {boolean} [emitOnRepeat=false] - Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). - * - * @return {object} An object containing Key objects mapped to the input properties. - */ - addKeys: function (keys, enableCapture, emitOnRepeat) - { - if (enableCapture === undefined) { enableCapture = true; } - if (emitOnRepeat === undefined) { emitOnRepeat = false; } + // These are the original (non-trimmed) sprite values + if (src.trimmed) + { + newFrame.setTrim( + src.sourceSize.w, + src.sourceSize.h, + src.spriteSourceSize.x, + src.spriteSourceSize.y, + src.spriteSourceSize.w, + src.spriteSourceSize.h + ); + } - var output = {}; + if (src.rotated) + { + newFrame.rotated = true; + newFrame.updateUVsInverted(); + } - if (typeof keys === 'string') + var pivot = src.anchor || src.pivot; + + if (pivot) { - keys = keys.split(','); + newFrame.customPivot = true; + newFrame.pivotX = pivot.x; + newFrame.pivotY = pivot.y; + } - for (var i = 0; i < keys.length; i++) - { - var currentKey = keys[i].trim(); + // Copy over any extra data + newFrame.customData = Clone(src); + } - if (currentKey) - { - output[currentKey] = this.addKey(currentKey, enableCapture, emitOnRepeat); - } - } + // Copy over any additional data that was in the JSON to Texture.customData + for (var dataKey in json) + { + if (dataKey === 'frames') + { + continue; + } + + if (Array.isArray(json[dataKey])) + { + texture.customData[dataKey] = json[dataKey].slice(0); } else { - for (var key in keys) - { - output[key] = this.addKey(keys[key], enableCapture, emitOnRepeat); - } + texture.customData[dataKey] = json[dataKey]; } + } - return output; - }, + return texture; +}; - /** - * Adds a Key object to this Keyboard Plugin. - * - * The given argument can be either an existing Key object, a string, such as `A` or `SPACE`, or a key code value. - * - * If a Key object is given, and one already exists matching the same key code, the existing one is replaced with the new one. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#addKey - * @since 3.10.0 - * - * @param {(Phaser.Input.Keyboard.Key|string|number)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. - * @param {boolean} [enableCapture=true] - Automatically call `preventDefault` on the native DOM browser event for the key codes being added. - * @param {boolean} [emitOnRepeat=false] - Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). - * - * @return {Phaser.Input.Keyboard.Key} The newly created Key object, or a reference to it if it already existed in the keys array. - */ - addKey: function (key, enableCapture, emitOnRepeat) - { - if (enableCapture === undefined) { enableCapture = true; } - if (emitOnRepeat === undefined) { emitOnRepeat = false; } +module.exports = JSONHash; - var keys = this.keys; - if (key instanceof Key) - { - var idx = keys.indexOf(key); +/***/ }), - if (idx > -1) - { - keys[idx] = key; - } - else - { - keys[key.keyCode] = key; - } +/***/ 67409: +/***/ ((module) => { - if (enableCapture) - { - this.addCapture(key.keyCode); - } +/** + * @author Richard Davey + * @copyright 2021 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - key.setEmitOnRepeat(emitOnRepeat); +/** + * Parses a KTX format Compressed Texture file and generates texture data suitable for WebGL from it. + * + * @function Phaser.Textures.Parsers.KTXParser + * @memberof Phaser.Textures.Parsers + * @since 3.60.0 + * + * @param {ArrayBuffer} data - The data object created by the Compressed Texture File Loader. + * + * @return {Phaser.Types.Textures.CompressedTextureData} The Compressed Texture data. + */ +var KTXParser = function (data) +{ + var idCheck = [ 0xab, 0x4b, 0x54, 0x58, 0x20, 0x31, 0x31, 0xbb, 0x0d, 0x0a, 0x1a, 0x0a ]; - return key; - } + var i; + var id = new Uint8Array(data, 0, 12); - if (typeof key === 'string') + for (i = 0; i < id.length; i++) + { + if (id[i] !== idCheck[i]) { - key = KeyCodes[key.toUpperCase()]; + console.warn('KTXParser - Invalid file format'); + + return; } + } - if (!keys[key]) - { - keys[key] = new Key(this, key); + var size = Uint32Array.BYTES_PER_ELEMENT; - if (enableCapture) - { - this.addCapture(key); - } + var head = new DataView(data, 12, 13 * size); - keys[key].setEmitOnRepeat(emitOnRepeat); - } + var littleEndian = (head.getUint32(0, true) === 0x04030201); - return keys[key]; - }, + var glType = head.getUint32(1 * size, littleEndian); - /** - * Removes a Key object from this Keyboard Plugin. - * - * The given argument can be either a Key object, a string, such as `A` or `SPACE`, or a key code value. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#removeKey - * @since 3.10.0 - * - * @param {(Phaser.Input.Keyboard.Key|string|number)} key - Either a Key object, a string, such as `A` or `SPACE`, or a key code value. - * @param {boolean} [destroy=false] - Call `Key.destroy` on the removed Key object? - * - * @return {this} This KeyboardPlugin object. - */ - removeKey: function (key, destroy) + if (glType !== 0) { - if (destroy === undefined) { destroy = false; } + console.warn('KTXParser - Only compressed formats supported'); - var keys = this.keys; - var ref; + return; + } - if (key instanceof Key) - { - var idx = keys.indexOf(key); + var internalFormat = head.getUint32(4 * size, littleEndian); + var width = head.getUint32(6 * size, littleEndian); + var height = head.getUint32(7 * size, littleEndian); - if (idx > -1) - { - ref = this.keys[idx]; + var mipmapLevels = Math.max(1, head.getUint32(11 * size, littleEndian)); - this.keys[idx] = undefined; - } - } - else if (typeof key === 'string') - { - key = KeyCodes[key.toUpperCase()]; - } + var bytesOfKeyValueData = head.getUint32(12 * size, littleEndian); - if (keys[key]) - { - ref = keys[key]; + var mipmaps = new Array(mipmapLevels); - keys[key] = undefined; - } + var offset = 12 + 13 * 4 + bytesOfKeyValueData; + var levelWidth = width; + var levelHeight = height; - if (ref) - { - ref.plugin = null; + for (i = 0; i < mipmapLevels; i++) + { + var levelSize = new Int32Array(data, offset, 1)[0]; - if (destroy) - { - ref.destroy(); - } - } + // levelSize field + offset += 4; - return this; - }, + mipmaps[i] = { + data: new Uint8Array(data, offset, levelSize), + width: levelWidth, + height: levelHeight + }; - /** - * Removes all Key objects created by _this_ Keyboard Plugin. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#removeAllKeys - * @since 3.24.0 - * - * @param {boolean} [destroy=false] - Call `Key.destroy` on each removed Key object? - * - * @return {this} This KeyboardPlugin object. - */ - removeAllKeys: function (destroy) - { - var keys = this.keys; + // add padding for odd sized image + // offset += 3 - ((levelSize + 3) % 4); - for (var i = 0; i < keys.length; i++) - { - var key = keys[i]; + levelWidth = Math.max(1, levelWidth >> 1); + levelHeight = Math.max(1, levelHeight >> 1); - if (key) - { - keys[i] = undefined; + offset += levelSize; + } - if (destroy) - { - key.destroy(); - } - } - } + return { + mipmaps: mipmaps, + width: width, + height: height, + internalFormat: internalFormat, + compressed: true, + generateMipmap: false + }; +}; - return this; - }, +module.exports = KTXParser; - /** - * Creates a new KeyCombo. - * - * A KeyCombo will listen for a specific string of keys from the Keyboard, and when it receives them - * it will emit a `keycombomatch` event from this Keyboard Plugin. - * - * The keys to be listened for can be defined as: - * - * A string (i.e. 'ATARI') - * An array of either integers (key codes) or strings, or a mixture of both - * An array of objects (such as Key objects) with a public 'keyCode' property - * - * For example, to listen for the Konami code (up, up, down, down, left, right, left, right, b, a, enter) - * you could pass the following array of key codes: - * - * ```javascript - * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true }); - * - * this.input.keyboard.on('keycombomatch', function (event) { - * console.log('Konami Code entered!'); - * }); - * ``` - * - * Or, to listen for the user entering the word PHASER: - * - * ```javascript - * this.input.keyboard.createCombo('PHASER'); - * ``` - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#createCombo - * @since 3.10.0 - * - * @param {(string|number[]|object[])} keys - The keys that comprise this combo. - * @param {Phaser.Types.Input.Keyboard.KeyComboConfig} [config] - A Key Combo configuration object. - * - * @return {Phaser.Input.Keyboard.KeyCombo} The new KeyCombo object. - */ - createCombo: function (keys, config) - { - return new KeyCombo(this, keys, config); - }, - /** - * Checks if the given Key object is currently being held down. - * - * The difference between this method and checking the `Key.isDown` property directly is that you can provide - * a duration to this method. For example, if you wanted a key press to fire a bullet, but you only wanted - * it to be able to fire every 100ms, then you can call this method with a `duration` of 100 and it - * will only return `true` every 100ms. - * - * If the Keyboard Plugin has been disabled, this method will always return `false`. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#checkDown - * @since 3.11.0 - * - * @param {Phaser.Input.Keyboard.Key} key - A Key object. - * @param {number} [duration=0] - The duration which must have elapsed before this Key is considered as being down. - * - * @return {boolean} `true` if the Key is down within the duration specified, otherwise `false`. - */ - checkDown: function (key, duration) - { - if (duration === undefined) { duration = 0; } +/***/ }), - if (this.enabled && key.isDown) - { - var t = SnapFloor(this.time - key.timeDown, duration); +/***/ 24904: +/***/ ((module) => { - if (t > key._tick) - { - key._tick = t; +/** + * @author Richard Davey + * @copyright 2021 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return true; - } - } +/** + * @ignore + */ +function GetSize (width, height, x, y, dx, dy, mult) +{ + if (mult === undefined) { mult = 16; } - return false; - }, + return Math.floor((width + x) / dx) * Math.floor((height + y) / dy) * mult; +} - /** - * Internal update handler called by the Input Plugin, which is in turn invoked by the Game step. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#update - * @private - * @since 3.10.0 - */ - update: function () - { - var queue = this.manager.queue; - var len = queue.length; +/** + * @ignore + */ +function PVRTC2bppSize (width, height) +{ + width = Math.max(width, 16); + height = Math.max(height, 8); - if (!this.isActive() || len === 0) - { - return; - } + return width * height / 4; +} - var keys = this.keys; +/** + * @ignore + */ +function PVRTC4bppSize (width, height) +{ + width = Math.max(width, 8); + height = Math.max(height, 8); - // Process the event queue, dispatching all of the events that have stored up - for (var i = 0; i < len; i++) - { - var event = queue[i]; - var code = event.keyCode; - var key = keys[code]; - var repeat = false; + return width * height / 2; +} - // Override the default functions (it's too late for the browser to use them anyway, so we may as well) - if (event.cancelled === undefined) - { - // Event allowed to flow across all handlers in this Scene, and any other Scene in the Scene list - event.cancelled = 0; +/** + * @ignore + */ +function DXTEtcSmallSize (width, height) +{ + return GetSize(width, height, 3, 3, 4, 4, 8); +} - // Won't reach any more local (Scene level) handlers - event.stopImmediatePropagation = function () - { - event.cancelled = 1; - }; +/** + * @ignore + */ +function DXTEtcAstcBigSize (width, height) +{ + return GetSize(width, height, 3, 3, 4, 4); +} - // Won't reach any more handlers in any Scene further down the Scene list - event.stopPropagation = function () - { - event.cancelled = -1; - }; - } +/** + * @ignore + */ +function ATC5x4Size (width, height) +{ + return GetSize(width, height, 4, 3, 5, 4); +} - if (event.cancelled === -1) - { - // This event has been stopped from broadcasting to any other Scene, so abort. - continue; - } +/** + * @ignore + */ +function ATC5x5Size (width, height) +{ + return GetSize(width, height, 4, 4, 5, 5); +} - // Duplicate event bailout - if (code === this.prevCode && event.timeStamp === this.prevTime && event.type === this.prevType) - { - // On some systems, the exact same event will fire multiple times. This prevents it. - continue; - } +/** + * @ignore + */ +function ATC6x5Size (width, height) +{ + return GetSize(width, height, 5, 4, 6, 5); +} - this.prevCode = code; - this.prevTime = event.timeStamp; - this.prevType = event.type; +/** + * @ignore + */ +function ATC6x6Size (width, height) +{ + return GetSize(width, height, 5, 5, 6, 6); +} - if (event.type === 'keydown') - { - // Key specific callback first - if (key) - { - repeat = key.isDown; +/** + * @ignore + */ +function ATC8x5Size (width, height) +{ + return GetSize(width, height, 7, 4, 8, 5); +} - key.onDown(event); - } +/** + * @ignore + */ +function ATC8x6Size (width, height) +{ + return GetSize(width, height, 7, 5, 8, 6); +} - if (!event.cancelled && (!key || !repeat)) - { - if (KeyMap[code]) - { - this.emit(Events.KEY_DOWN + KeyMap[code], event); - } +/** + * @ignore + */ +function ATC8x8Size (width, height) +{ + return GetSize(width, height, 7, 7, 8, 8); +} - if (!event.cancelled) - { - this.emit(Events.ANY_KEY_DOWN, event); - } - } - } - else - { - // Key specific callback first - if (key) - { - key.onUp(event); - } +/** + * @ignore + */ +function ATC10x5Size (width, height) +{ + return GetSize(width, height, 9, 4, 10, 5); +} - if (!event.cancelled) - { - if (KeyMap[code]) - { - this.emit(Events.KEY_UP + KeyMap[code], event); - } +/** + * @ignore + */ +function ATC10x6Size (width, height) +{ + return GetSize(width, height, 9, 5, 10, 6); +} - if (!event.cancelled) - { - this.emit(Events.ANY_KEY_UP, event); - } - } - } +/** + * @ignore + */ +function ATC10x8Size (width, height) +{ + return GetSize(width, height, 9, 7, 10, 8); +} - // Reset the cancel state for other Scenes to use - if (event.cancelled === 1) - { - event.cancelled = 0; - } - } - }, +/** + * @ignore + */ +function ATC10x10Size (width, height) +{ + return GetSize(width, height, 9, 9, 10, 10); +} - /** - * Resets all Key objects created by _this_ Keyboard Plugin back to their default un-pressed states. - * This can only reset keys created via the `addKey`, `addKeys` or `createCursorKeys` methods. - * If you have created a Key object directly you'll need to reset it yourself. - * - * This method is called automatically when the Keyboard Plugin shuts down, but can be - * invoked directly at any time you require. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#resetKeys - * @since 3.15.0 - * - * @return {this} This KeyboardPlugin object. - */ - resetKeys: function () - { - var keys = this.keys; +/** + * @ignore + */ +function ATC12x10Size (width, height) +{ + return GetSize(width, height, 11, 9, 12, 10); +} - for (var i = 0; i < keys.length; i++) - { - // Because it's a sparsely populated array - if (keys[i]) - { - keys[i].reset(); - } - } +/** + * @ignore + */ +function ATC12x12Size (width, height) +{ + return GetSize(width, height, 11, 11, 12, 12); +} - return this; - }, +/** + * 0: COMPRESSED_RGB_PVRTC_2BPPV1_IMG + * 1: COMPRESSED_RGBA_PVRTC_2BPPV1_IMG + * 2: COMPRESSED_RGB_PVRTC_4BPPV1_IMG + * 3: COMPRESSED_RGBA_PVRTC_4BPPV1_IMG + * 6: COMPRESSED_RGB_ETC1 + * 7: COMPRESSED_RGB_S3TC_DXT1_EXT + * 8: COMPRESSED_RGBA_S3TC_DXT1_EXT + * 9: COMPRESSED_RGBA_S3TC_DXT3_EXT + * 11: COMPRESSED_RGBA_S3TC_DXT5_EXT + * 22: COMPRESSED_RGB8_ETC2 + * 23: COMPRESSED_RGBA8_ETC2_EAC + * 24: COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 + * 25: COMPRESSED_R11_EAC + * 26: COMPRESSED_RG11_EAC + * 27: COMPRESSED_RGBA_ASTC_4x4_KHR + * 28: COMPRESSED_RGBA_ASTC_5x4_KHR + * 29: COMPRESSED_RGBA_ASTC_5x5_KHR + * 30: COMPRESSED_RGBA_ASTC_6x5_KHR + * 31: COMPRESSED_RGBA_ASTC_6x6_KHR + * 32: COMPRESSED_RGBA_ASTC_8x5_KHR + * 33: COMPRESSED_RGBA_ASTC_8x6_KHR + * 34: COMPRESSED_RGBA_ASTC_8x8_KHR + * 35: COMPRESSED_RGBA_ASTC_10x5_KHR + * 36: COMPRESSED_RGBA_ASTC_10x6_KHR + * 37: COMPRESSED_RGBA_ASTC_10x8_KHR + * 38: COMPRESSED_RGBA_ASTC_10x10_KHR + * 39: COMPRESSED_RGBA_ASTC_12x10_KHR + * 40: COMPRESSED_RGBA_ASTC_12x12_KHR + */ - /** - * Shuts this Keyboard Plugin down. This performs the following tasks: - * - * 1 - Removes all keys created by this Keyboard plugin. - * 2 - Stops and removes the keyboard event listeners. - * 3 - Clears out any pending requests in the queue, without processing them. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#shutdown - * @private - * @since 3.10.0 - */ - shutdown: function () +/** + * @ignore + */ +var FORMATS = { + 0: { sizeFunc: PVRTC2bppSize, glFormat: 0x8C01 }, + 1: { sizeFunc: PVRTC2bppSize, glFormat: 0x8C03 }, + 2: { sizeFunc: PVRTC4bppSize, glFormat: 0x8C00 }, + 3: { sizeFunc: PVRTC4bppSize, glFormat: 0x8C02 }, + 6: { sizeFunc: DXTEtcSmallSize , glFormat: 0x8D64 }, + 7: { sizeFunc: DXTEtcSmallSize, glFormat: 0x83F0 }, + 8: { sizeFunc: DXTEtcAstcBigSize, glFormat: 0x83F1 }, + 9: { sizeFunc: DXTEtcAstcBigSize, glFormat: 0x83F2 }, + 11: { sizeFunc: DXTEtcAstcBigSize, glFormat: 0x83F3 }, + 22: { sizeFunc: DXTEtcSmallSize , glFormat: 0x9274 }, + 23: { sizeFunc: DXTEtcAstcBigSize, glFormat: 0x9278 }, + 24: { sizeFunc: DXTEtcSmallSize, glFormat: 0x9276 }, + 25: { sizeFunc: DXTEtcSmallSize, glFormat: 0x9270 }, + 26: { sizeFunc: DXTEtcAstcBigSize, glFormat: 0x9272 }, + 27: { sizeFunc: DXTEtcAstcBigSize, glFormat: 0x93B0 }, + 28: { sizeFunc: ATC5x4Size, glFormat: 0x93B1 }, + 29: { sizeFunc: ATC5x5Size, glFormat: 0x93B2 }, + 30: { sizeFunc: ATC6x5Size, glFormat: 0x93B3 }, + 31: { sizeFunc: ATC6x6Size, glFormat: 0x93B4 }, + 32: { sizeFunc: ATC8x5Size, glFormat: 0x93B5 }, + 33: { sizeFunc: ATC8x6Size, glFormat: 0x93B6 }, + 34: { sizeFunc: ATC8x8Size, glFormat: 0x93B7 }, + 35: { sizeFunc: ATC10x5Size, glFormat: 0x93B8 }, + 36: { sizeFunc: ATC10x6Size, glFormat: 0x93B9 }, + 37: { sizeFunc: ATC10x8Size, glFormat: 0x93BA }, + 38: { sizeFunc: ATC10x10Size, glFormat: 0x93BB }, + 39: { sizeFunc: ATC12x10Size, glFormat: 0x93BC }, + 40: { sizeFunc: ATC12x12Size, glFormat: 0x93BD } +}; + +/** + * Parses a PVR format Compressed Texture file and generates texture data suitable for WebGL from it. + * + * @function Phaser.Textures.Parsers.PVRParser + * @memberof Phaser.Textures.Parsers + * @since 3.60.0 + * + * @param {ArrayBuffer} data - The data object created by the Compressed Texture File Loader. + * + * @return {Phaser.Types.Textures.CompressedTextureData} The Compressed Texture data. + */ +var PVRParser = function (data) +{ + var header = new Uint32Array(data, 0, 13); + + // PIXEL_FORMAT_INDEX + var pvrFormat = header[2]; + + var internalFormat = FORMATS[pvrFormat].glFormat; + var sizeFunction = FORMATS[pvrFormat].sizeFunc; + + // MIPMAPCOUNT_INDEX + var mipmapLevels = header[11]; + + // WIDTH_INDEX + var width = header[7]; + + // HEIGHT_INDEX + var height = header[6]; + + // HEADER_SIZE + METADATA_SIZE_INDEX + var dataOffset = 52 + header[12]; + + var image = new Uint8Array(data, dataOffset); + + var mipmaps = new Array(mipmapLevels); + + var offset = 0; + var levelWidth = width; + var levelHeight = height; + + for (var i = 0; i < mipmapLevels; i++) { - this.removeAllKeys(true); - this.removeAllListeners(); + var levelSize = sizeFunction(levelWidth, levelHeight); - this.sceneInputPlugin.manager.events.off(InputEvents.MANAGER_PROCESS, this.update, this); + mipmaps[i] = { + data: new Uint8Array(image.buffer, image.byteOffset + offset, levelSize), + width: levelWidth, + height: levelHeight + }; - this.game.events.off(GameEvents.BLUR, this.resetKeys); + levelWidth = Math.max(1, levelWidth >> 1); + levelHeight = Math.max(1, levelHeight >> 1); - this.scene.sys.events.off(SceneEvents.PAUSE, this.resetKeys, this); - this.scene.sys.events.off(SceneEvents.SLEEP, this.resetKeys, this); + offset += levelSize; + } - this.queue = []; - }, + return { + mipmaps: mipmaps, + width: width, + height: height, + internalFormat: internalFormat, + compressed: true, + generateMipmap: false + }; +}; - /** - * Destroys this Keyboard Plugin instance and all references it holds, plus clears out local arrays. - * - * @method Phaser.Input.Keyboard.KeyboardPlugin#destroy - * @private - * @since 3.10.0 - */ - destroy: function () +module.exports = PVRParser; + + +/***/ }), + +/***/ 6143: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetFastValue = __webpack_require__(72632); + +/** + * Parses a Sprite Sheet and adds the Frames to the Texture. + * + * In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact + * same size and cannot be trimmed or rotated. + * + * @function Phaser.Textures.Parsers.SpriteSheet + * @memberof Phaser.Textures.Parsers + * @private + * @since 3.0.0 + * + * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. + * @param {number} sourceIndex - The index of the TextureSource. + * @param {number} x - The top-left coordinate of the Sprite Sheet. Defaults to zero. Used when extracting sheets from atlases. + * @param {number} y - The top-left coordinate of the Sprite Sheet. Defaults to zero. Used when extracting sheets from atlases. + * @param {number} width - The width of the source image. + * @param {number} height - The height of the source image. + * @param {object} config - An object describing how to parse the Sprite Sheet. + * @param {number} config.frameWidth - Width in pixels of a single frame in the sprite sheet. + * @param {number} [config.frameHeight] - Height in pixels of a single frame in the sprite sheet. Defaults to frameWidth if not provided. + * @param {number} [config.startFrame=0] - The frame to start extracting from. Defaults to zero. + * @param {number} [config.endFrame=-1] - The frame to finish extracting at. Defaults to -1, which means 'all frames'. + * @param {number} [config.margin=0] - If the frames have been drawn with a margin, specify the amount here. + * @param {number} [config.spacing=0] - If the frames have been drawn with spacing between them, specify the amount here. + * + * @return {Phaser.Textures.Texture} The Texture modified by this parser. + */ +var SpriteSheet = function (texture, sourceIndex, x, y, width, height, config) +{ + var frameWidth = GetFastValue(config, 'frameWidth', null); + var frameHeight = GetFastValue(config, 'frameHeight', frameWidth); + + // If missing we can't proceed + if (frameWidth === null) { - this.shutdown(); + throw new Error('TextureManager.SpriteSheet: Invalid frameWidth given.'); + } - var keys = this.keys; + // Add in a __BASE entry (for the entire atlas) + var source = texture.source[sourceIndex]; - for (var i = 0; i < keys.length; i++) - { - // Because it's a sparsely populated array - if (keys[i]) - { - keys[i].destroy(); - } - } + texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); - this.keys = []; - this.combos = []; - this.queue = []; + var startFrame = GetFastValue(config, 'startFrame', 0); + var endFrame = GetFastValue(config, 'endFrame', -1); + var margin = GetFastValue(config, 'margin', 0); + var spacing = GetFastValue(config, 'spacing', 0); - this.scene = null; - this.settings = null; - this.sceneInputPlugin = null; - this.manager = null; - }, + var row = Math.floor((width - margin + spacing) / (frameWidth + spacing)); + var column = Math.floor((height - margin + spacing) / (frameHeight + spacing)); + var total = row * column; - /** - * Internal time value. - * - * @name Phaser.Input.Keyboard.KeyboardPlugin#time - * @type {number} - * @private - * @since 3.11.0 - */ - time: { + if (total === 0) + { + console.warn('SpriteSheet frame dimensions will result in zero frames for texture:', texture.key); + } - get: function () - { - return this.sceneInputPlugin.manager.time; - } + if (startFrame > total || startFrame < -total) + { + startFrame = 0; + } + if (startFrame < 0) + { + // Allow negative skipframes. + startFrame = total + startFrame; } -}); + if (endFrame === -1 || endFrame > total || endFrame < startFrame) + { + endFrame = total; + } -/** - * An instance of the Keyboard Plugin class, if enabled via the `input.keyboard` Scene or Game Config property. - * Use this to create Key objects and listen for keyboard specific events. - * - * @name Phaser.Input.InputPlugin#keyboard - * @type {?Phaser.Input.Keyboard.KeyboardPlugin} - * @since 3.10.0 - */ -InputPluginCache.register('KeyboardPlugin', KeyboardPlugin, 'keyboard', 'keyboard', 'inputKeyboard'); + var fx = margin; + var fy = margin; + var ax = 0; + var ay = 0; + var c = 0; -module.exports = KeyboardPlugin; + for (var i = 0; i < total; i++) + { + ax = 0; + ay = 0; + var w = fx + frameWidth; + var h = fy + frameHeight; -/***/ }), -/* 1331 */ -/***/ (function(module, exports, __webpack_require__) { + if (w > width) + { + ax = w - width; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (h > height) + { + ay = h - height; + } -var KeyCodes = __webpack_require__(143); + if (i >= startFrame && i <= endFrame) + { + texture.add(c, sourceIndex, x + fx, y + fy, frameWidth - ax, frameHeight - ay); -var KeyMap = {}; + c++; + } -for (var key in KeyCodes) -{ - KeyMap[KeyCodes[key]] = key; -} + fx += frameWidth + spacing; -module.exports = KeyMap; + if (fx + frameWidth > width) + { + fx = margin; + fy += frameHeight + spacing; + } + } + + return texture; +}; + +module.exports = SpriteSheet; /***/ }), -/* 1332 */ -/***/ (function(module, exports) { + +/***/ 20030: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var GetFastValue = __webpack_require__(72632); + /** - * The justDown value allows you to test if this Key has just been pressed down or not. - * - * When you check this value it will return `true` if the Key is down, otherwise `false`. - * - * You can only call justDown once per key press. It will only return `true` once, until the Key is released and pressed down again. - * This allows you to use it in situations where you want to check if this key is down without using an event, such as in a core game loop. + * Parses a Sprite Sheet and adds the Frames to the Texture, where the Sprite Sheet is stored as a frame within an Atlas. * - * @function Phaser.Input.Keyboard.JustDown + * In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact + * same size and cannot be trimmed or rotated. + * + * @function Phaser.Textures.Parsers.SpriteSheetFromAtlas + * @memberof Phaser.Textures.Parsers + * @private * @since 3.0.0 * - * @param {Phaser.Input.Keyboard.Key} key - The Key to check to see if it's just down or not. + * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. + * @param {Phaser.Textures.Frame} frame - The Frame that contains the Sprite Sheet. + * @param {object} config - An object describing how to parse the Sprite Sheet. + * @param {number} config.frameWidth - Width in pixels of a single frame in the sprite sheet. + * @param {number} [config.frameHeight] - Height in pixels of a single frame in the sprite sheet. Defaults to frameWidth if not provided. + * @param {number} [config.startFrame=0] - Index of the start frame in the sprite sheet + * @param {number} [config.endFrame=-1] - Index of the end frame in the sprite sheet. -1 mean all the rest of the frames + * @param {number} [config.margin=0] - If the frames have been drawn with a margin, specify the amount here. + * @param {number} [config.spacing=0] - If the frames have been drawn with spacing between them, specify the amount here. * - * @return {boolean} `true` if the Key was just pressed, otherwise `false`. + * @return {Phaser.Textures.Texture} The Texture modified by this parser. */ -var JustDown = function (key) +var SpriteSheetFromAtlas = function (texture, frame, config) { - if (key._justDown) - { - key._justDown = false; + var frameWidth = GetFastValue(config, 'frameWidth', null); + var frameHeight = GetFastValue(config, 'frameHeight', frameWidth); - return true; - } - else + // If missing we can't proceed + if (!frameWidth) { - return false; + throw new Error('TextureManager.SpriteSheetFromAtlas: Invalid frameWidth given.'); } -}; -module.exports = JustDown; + // Add in a __BASE entry (for the entire atlas frame) + var source = texture.source[0]; + texture.add('__BASE', 0, 0, 0, source.width, source.height); + var startFrame = GetFastValue(config, 'startFrame', 0); + var endFrame = GetFastValue(config, 'endFrame', -1); + var margin = GetFastValue(config, 'margin', 0); + var spacing = GetFastValue(config, 'spacing', 0); -/***/ }), -/* 1333 */ -/***/ (function(module, exports) { + var x = frame.cutX; + var y = frame.cutY; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var cutWidth = frame.cutWidth; + var cutHeight = frame.cutHeight; + var sheetWidth = frame.realWidth; + var sheetHeight = frame.realHeight; -/** - * The justUp value allows you to test if this Key has just been released or not. - * - * When you check this value it will return `true` if the Key is up, otherwise `false`. - * - * You can only call JustUp once per key release. It will only return `true` once, until the Key is pressed down and released again. - * This allows you to use it in situations where you want to check if this key is up without using an event, such as in a core game loop. - * - * @function Phaser.Input.Keyboard.JustUp - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.Key} key - The Key to check to see if it's just up or not. - * - * @return {boolean} `true` if the Key was just released, otherwise `false`. - */ -var JustUp = function (key) -{ - if (key._justUp) + var row = Math.floor((sheetWidth - margin + spacing) / (frameWidth + spacing)); + var column = Math.floor((sheetHeight - margin + spacing) / (frameHeight + spacing)); + var total = row * column; + + // trim offsets + + var leftPad = frame.x; + var leftWidth = frameWidth - leftPad; + + var rightWidth = frameWidth - ((sheetWidth - cutWidth) - leftPad); + + var topPad = frame.y; + var topHeight = frameHeight - topPad; + + var bottomHeight = frameHeight - ((sheetHeight - cutHeight) - topPad); + + if (startFrame > total || startFrame < -total) { - key._justUp = false; + startFrame = 0; + } - return true; + if (startFrame < 0) + { + // Allow negative skipframes. + startFrame = total + startFrame; } - else + + if (endFrame !== -1) { - return false; + total = startFrame + (endFrame + 1); } -}; -module.exports = JustUp; + var sheetFrame; + var frameX = margin; + var frameY = margin; + var frameIndex = 0; + var sourceIndex = 0; + for (var sheetY = 0; sheetY < column; sheetY++) + { + var topRow = (sheetY === 0); + var bottomRow = (sheetY === column - 1); -/***/ }), -/* 1334 */ -/***/ (function(module, exports) { + for (var sheetX = 0; sheetX < row; sheetX++) + { + var leftRow = (sheetX === 0); + var rightRow = (sheetX === row - 1); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + sheetFrame = texture.add(frameIndex, sourceIndex, x + frameX, y + frameY, frameWidth, frameHeight); -/** - * Returns `true` if the Key was pressed down within the `duration` value given, based on the current - * game clock time. Or `false` if it either isn't down, or was pressed down longer ago than the given duration. - * - * @function Phaser.Input.Keyboard.DownDuration - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.Key} key - The Key object to test. - * @param {number} [duration=50] - The duration, in ms, within which the key must have been pressed down. - * - * @return {boolean} `true` if the Key was pressed down within `duration` ms ago, otherwise `false`. - */ -var DownDuration = function (key, duration) -{ - if (duration === undefined) { duration = 50; } + if (leftRow || topRow || rightRow || bottomRow) + { + var destX = (leftRow) ? leftPad : 0; + var destY = (topRow) ? topPad : 0; - var current = key.plugin.game.loop.time - key.timeDown; + var trimWidth = 0; + var trimHeight = 0; - return (key.isDown && current < duration); -}; + if (leftRow) + { + trimWidth += (frameWidth - leftWidth); + } -module.exports = DownDuration; + if (rightRow) + { + trimWidth += (frameWidth - rightWidth); + } + if (topRow) + { + trimHeight += (frameHeight - topHeight); + } -/***/ }), -/* 1335 */ -/***/ (function(module, exports) { + if (bottomRow) + { + trimHeight += (frameHeight - bottomHeight); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var destWidth = frameWidth - trimWidth; + var destHeight = frameHeight - trimHeight; -/** - * Returns `true` if the Key was released within the `duration` value given, based on the current - * game clock time. Or returns `false` if it either isn't up, or was released longer ago than the given duration. - * - * @function Phaser.Input.Keyboard.UpDuration - * @since 3.0.0 - * - * @param {Phaser.Input.Keyboard.Key} key - The Key object to test. - * @param {number} [duration=50] - The duration, in ms, within which the key must have been released. - * - * @return {boolean} `true` if the Key was released within `duration` ms ago, otherwise `false`. - */ -var UpDuration = function (key, duration) -{ - if (duration === undefined) { duration = 50; } + sheetFrame.cutWidth = destWidth; + sheetFrame.cutHeight = destHeight; - var current = key.plugin.game.loop.time - key.timeUp; + sheetFrame.setTrim(frameWidth, frameHeight, destX, destY, destWidth, destHeight); + } - return (key.isUp && current < duration); + frameX += spacing; + + if (leftRow) + { + frameX += leftWidth; + } + else if (rightRow) + { + frameX += rightWidth; + } + else + { + frameX += frameWidth; + } + + frameIndex++; + } + + frameX = margin; + frameY += spacing; + + if (topRow) + { + frameY += topHeight; + } + else if (bottomRow) + { + frameY += bottomHeight; + } + else + { + frameY += frameHeight; + } + } + + return texture; }; -module.exports = UpDuration; +module.exports = SpriteSheetFromAtlas; /***/ }), -/* 1336 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 89187: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var imageHeight = 0; + /** - * @namespace Phaser.Input.Mouse + * @function addFrame + * @private + * @since 3.0.0 */ +var addFrame = function (texture, sourceIndex, name, frame) +{ + // The frame values are the exact coordinates to cut the frame out of the atlas from -/* eslint-disable */ -module.exports = { - - MouseManager: __webpack_require__(411) - -}; -/* eslint-enable */ + var y = imageHeight - frame.y - frame.height; + texture.add(name, sourceIndex, frame.x, y, frame.width, frame.height); -/***/ }), -/* 1337 */ -/***/ (function(module, exports, __webpack_require__) { + // These are the original (non-trimmed) sprite values + /* + if (src.trimmed) + { + newFrame.setTrim( + src.sourceSize.w, + src.sourceSize.h, + src.spriteSourceSize.x, + src.spriteSourceSize.y, + src.spriteSourceSize.w, + src.spriteSourceSize.h + ); + } + */ +}; /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Parses a Unity YAML File and creates Frames in the Texture. + * For more details about Sprite Meta Data see https://docs.unity3d.com/ScriptReference/SpriteMetaData.html + * + * @function Phaser.Textures.Parsers.UnityYAML + * @memberof Phaser.Textures.Parsers + * @private + * @since 3.0.0 + * + * @param {Phaser.Textures.Texture} texture - The Texture to add the Frames to. + * @param {number} sourceIndex - The index of the TextureSource. + * @param {object} yaml - The YAML data. + * + * @return {Phaser.Textures.Texture} The Texture modified by this parser. */ +var UnityYAML = function (texture, sourceIndex, yaml) +{ + // Add in a __BASE entry (for the entire atlas) + var source = texture.source[sourceIndex]; -/** - * @namespace Phaser.Input.Touch - */ + texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height); -/* eslint-disable */ -module.exports = { + imageHeight = source.height; - TouchManager: __webpack_require__(413) - -}; -/* eslint-enable */ + var data = yaml.split('\n'); + var lineRegExp = /^[ ]*(- )*(\w+)+[: ]+(.*)/; -/***/ }), -/* 1338 */ -/***/ (function(module, exports, __webpack_require__) { + var prevSprite = ''; + var currentSprite = ''; + var rect = { x: 0, y: 0, width: 0, height: 0 }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // var pivot = { x: 0, y: 0 }; + // var border = { x: 0, y: 0, z: 0, w: 0 }; -var CONST = __webpack_require__(21); -var Extend = __webpack_require__(17); + for (var i = 0; i < data.length; i++) + { + var results = data[i].match(lineRegExp); -/** - * @namespace Phaser.Loader - */ + if (!results) + { + continue; + } -var Loader = { + var isList = (results[1] === '- '); + var key = results[2]; + var value = results[3]; + + if (isList) + { + if (currentSprite !== prevSprite) + { + addFrame(texture, sourceIndex, currentSprite, rect); + + prevSprite = currentSprite; + } + + rect = { x: 0, y: 0, width: 0, height: 0 }; + } + + if (key === 'name') + { + // Start new list + currentSprite = value; + continue; + } + + switch (key) + { + case 'x': + case 'y': + case 'width': + case 'height': + rect[key] = parseInt(value, 10); + break; - Events: __webpack_require__(95), + // case 'pivot': + // pivot = eval('var obj = ' + value); + // break; - FileTypes: __webpack_require__(1339), + // case 'border': + // border = eval('var obj = ' + value); + // break; + } + } - File: __webpack_require__(23), - FileTypesManager: __webpack_require__(8), - GetURL: __webpack_require__(155), - LoaderPlugin: __webpack_require__(1365), - MergeXHRSettings: __webpack_require__(240), - MultiFile: __webpack_require__(49), - XHRLoader: __webpack_require__(517), - XHRSettings: __webpack_require__(156) + if (currentSprite !== prevSprite) + { + addFrame(texture, sourceIndex, currentSprite, rect); + } + return texture; }; -// Merge in the consts -Loader = Extend(false, Loader, CONST); +module.exports = UnityYAML; -module.exports = Loader; +/* +Example data: + +TextureImporter: + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + spriteSheet: + sprites: + - name: asteroids_0 + rect: + serializedVersion: 2 + x: 5 + y: 328 + width: 65 + height: 82 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + - name: asteroids_1 + rect: + serializedVersion: 2 + x: 80 + y: 322 + width: 53 + height: 88 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + spritePackingTag: Asteroids +*/ /***/ }), -/* 1339 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 69150: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @namespace Phaser.Loader.FileTypes + * @namespace Phaser.Textures.Parsers */ module.exports = { - AnimationJSONFile: __webpack_require__(1340), - AsepriteFile: __webpack_require__(1341), - AtlasJSONFile: __webpack_require__(1342), - AtlasXMLFile: __webpack_require__(1343), - AudioFile: __webpack_require__(518), - AudioSpriteFile: __webpack_require__(1344), - BinaryFile: __webpack_require__(1345), - BitmapFontFile: __webpack_require__(1346), - CSSFile: __webpack_require__(1347), - GLSLFile: __webpack_require__(1348), - HTML5AudioFile: __webpack_require__(519), - HTMLFile: __webpack_require__(1349), - HTMLTextureFile: __webpack_require__(1350), - ImageFile: __webpack_require__(71), - JSONFile: __webpack_require__(61), - MultiAtlasFile: __webpack_require__(1351), - MultiScriptFile: __webpack_require__(1352), - OBJFile: __webpack_require__(1353), - PackFile: __webpack_require__(1354), - PluginFile: __webpack_require__(1355), - SceneFile: __webpack_require__(1356), - ScenePluginFile: __webpack_require__(1357), - ScriptFile: __webpack_require__(520), - SpriteSheetFile: __webpack_require__(1358), - SVGFile: __webpack_require__(1359), - TextFile: __webpack_require__(242), - TilemapCSVFile: __webpack_require__(1360), - TilemapImpactFile: __webpack_require__(1361), - TilemapJSONFile: __webpack_require__(1362), - UnityAtlasFile: __webpack_require__(1363), - VideoFile: __webpack_require__(1364), - XMLFile: __webpack_require__(241) + AtlasXML: __webpack_require__(35082), + Canvas: __webpack_require__(83332), + Image: __webpack_require__(21560), + JSONArray: __webpack_require__(64423), + JSONHash: __webpack_require__(17264), + KTXParser: __webpack_require__(67409), + PVRParser: __webpack_require__(24904), + SpriteSheet: __webpack_require__(6143), + SpriteSheetFromAtlas: __webpack_require__(20030), + UnityYAML: __webpack_require__(89187) }; /***/ }), -/* 1340 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 93560: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var JSONFile = __webpack_require__(61); -var LoaderEvents = __webpack_require__(95); - /** - * @classdesc - * A single Animation JSON File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#animation method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#animation. - * - * @class AnimationJSONFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. + * @namespace Phaser.Tilemaps.Formats */ -var AnimationJSONFile = new Class({ - - Extends: JSONFile, - initialize: - - // url can either be a string, in which case it is treated like a proper url, or an object, in which case it is treated as a ready-made JS Object - // dataKey allows you to pluck a specific object out of the JSON and put just that into the cache, rather than the whole thing - - function AnimationJSONFile (loader, key, url, xhrSettings, dataKey) - { - JSONFile.call(this, loader, key, url, xhrSettings, dataKey); - - this.type = 'animationJSON'; - }, +module.exports = { /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * CSV Map Type * - * @method Phaser.Loader.FileTypes.AnimationJSONFile#onProcess - * @since 3.7.0 + * @name Phaser.Tilemaps.Formats.CSV + * @type {number} + * @since 3.0.0 */ - onProcess: function () - { - // We need to hook into this event: - this.loader.once(LoaderEvents.POST_PROCESS, this.onLoadComplete, this); - - // But the rest is the same as a normal JSON file - JSONFile.prototype.onProcess.call(this); - }, + CSV: 0, /** - * Called at the end of the load process, after the Loader has finished all files in its queue. + * Tiled JSON Map Type * - * @method Phaser.Loader.FileTypes.AnimationJSONFile#onLoadComplete - * @since 3.7.0 + * @name Phaser.Tilemaps.Formats.TILED_JSON + * @type {number} + * @since 3.0.0 */ - onLoadComplete: function () - { - this.loader.systems.anims.fromJSON(this.data); - } - -}); - -/** - * Adds an Animation JSON Data file, or array of Animation JSON files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.animation('baddieAnims', 'files/BaddieAnims.json'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring - * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. - * - * The key must be a unique String. It is used to add the file to the global JSON Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the JSON Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the JSON Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.animation({ - * key: 'baddieAnims', - * url: 'files/BaddieAnims.json' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.JSONFileConfig` for more details. - * - * Once the file has finished loading it will automatically be passed to the global Animation Managers `fromJSON` method. - * This will parse all of the JSON data and create animation data from it. This process happens at the very end - * of the Loader, once every other file in the load queue has finished. The reason for this is to allow you to load - * both animation data and the images it relies upon in the same load call. - * - * Once the animation data has been parsed you will be able to play animations using that data. - * Please see the Animation Manager `fromJSON` method for more details about the format and playback. - * - * You can also access the raw animation data from its Cache using its key: - * - * ```javascript - * this.load.animation('baddieAnims', 'files/BaddieAnims.json'); - * // and later in your game ... - * var data = this.cache.json.get('baddieAnims'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and - * this is what you would use to retrieve the text from the JSON Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" - * and no URL is given then the Loader will set the URL to be "data.json". It will always add `.json` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * You can also optionally provide a `dataKey` to use. This allows you to extract only a part of the JSON and store it in the Cache, - * rather than the whole file. For example, if your JSON data had a structure like this: - * - * ```json - * { - * "level1": { - * "baddies": { - * "aliens": {}, - * "boss": {} - * } - * }, - * "level2": {}, - * "level3": {} - * } - * ``` - * - * And if you only wanted to create animations from the `boss` data, then you could pass `level1.baddies.boss`as the `dataKey`. - * - * Note: The ability to load this type of file will only be available if the JSON File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#animation - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {string} [dataKey] - When the Animation JSON file loads only this property will be stored in the Cache and used to create animation data. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('animation', function (key, url, dataKey, xhrSettings) -{ - // Supports an Object file definition in the key argument - // Or an array of objects in the key argument - // Or a single entry where all arguments have been defined + TILED_JSON: 1, - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - this.addFile(new AnimationJSONFile(this, key[i])); - } - } - else - { - this.addFile(new AnimationJSONFile(this, key, url, xhrSettings, dataKey)); - } + /** + * 2D Array Map Type + * + * @name Phaser.Tilemaps.Formats.ARRAY_2D + * @type {number} + * @since 3.0.0 + */ + ARRAY_2D: 2, - return this; -}); + /** + * Weltmeister (Impact.js) Map Type + * + * @name Phaser.Tilemaps.Formats.WELTMEISTER + * @type {number} + * @since 3.0.0 + */ + WELTMEISTER: 3 -module.exports = AnimationJSONFile; +}; /***/ }), -/* 1341 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 97042: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(71); -var IsPlainObject = __webpack_require__(7); -var JSONFile = __webpack_require__(61); -var MultiFile = __webpack_require__(49); +var Class = __webpack_require__(56694); /** * @classdesc - * A single JSON based Texture Atlas File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#atlas method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlas. + * An Image Collection is a special Tile Set containing multiple images, with no slicing into each image. * - * https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-for-phaser3?source=photonstorm + * Image Collections are normally created automatically when Tiled data is loaded. * - * @class AsepriteFile - * @extends Phaser.Loader.MultiFile - * @memberof Phaser.Loader.FileTypes + * @class ImageCollection + * @memberof Phaser.Tilemaps * @constructor - * @since 3.50.0 + * @since 3.0.0 * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.AsepriteFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {object|string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. - * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + * @param {string} name - The name of the image collection in the map data. + * @param {number} firstgid - The first image index this image collection contains. + * @param {number} [width=32] - Width of widest image (in pixels). + * @param {number} [height=32] - Height of tallest image (in pixels). + * @param {number} [margin=0] - The margin around all images in the collection (in pixels). + * @param {number} [spacing=0] - The spacing between each image in the collection (in pixels). + * @param {object} [properties={}] - Custom Image Collection properties. */ -var AsepriteFile = new Class({ - - Extends: MultiFile, +var ImageCollection = new Class({ initialize: - function AsepriteFile (loader, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) + function ImageCollection (name, firstgid, width, height, margin, spacing, properties) { - var image; - var data; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - - image = new ImageFile(loader, { - key: key, - url: GetFastValue(config, 'textureURL'), - extension: GetFastValue(config, 'textureExtension', 'png'), - normalMap: GetFastValue(config, 'normalMap'), - xhrSettings: GetFastValue(config, 'textureXhrSettings') - }); + if (width === undefined || width <= 0) { width = 32; } + if (height === undefined || height <= 0) { height = 32; } + if (margin === undefined) { margin = 0; } + if (spacing === undefined) { spacing = 0; } - data = new JSONFile(loader, { - key: key, - url: GetFastValue(config, 'atlasURL'), - extension: GetFastValue(config, 'atlasExtension', 'json'), - xhrSettings: GetFastValue(config, 'atlasXhrSettings') - }); - } - else - { - image = new ImageFile(loader, key, textureURL, textureXhrSettings); - data = new JSONFile(loader, key, atlasURL, atlasXhrSettings); - } + /** + * The name of the Image Collection. + * + * @name Phaser.Tilemaps.ImageCollection#name + * @type {string} + * @since 3.0.0 + */ + this.name = name; - if (image.linkFile) - { - // Image has a normal map - MultiFile.call(this, loader, 'atlasjson', key, [ image, data, image.linkFile ]); - } - else - { - MultiFile.call(this, loader, 'atlasjson', key, [ image, data ]); - } - }, + /** + * The Tiled firstgid value. + * This is the starting index of the first image index this Image Collection contains. + * + * @name Phaser.Tilemaps.ImageCollection#firstgid + * @type {number} + * @since 3.0.0 + */ + this.firstgid = firstgid | 0; - /** - * Adds this file to its target cache upon successful loading and processing. - * - * @method Phaser.Loader.FileTypes.AsepriteFile#addToCache - * @since 3.7.0 - */ - addToCache: function () - { - if (this.isReadyToProcess()) - { - var image = this.files[0]; - var json = this.files[1]; - var normalMap = (this.files[2]) ? this.files[2].data : null; + /** + * The width of the widest image (in pixels). + * + * @name Phaser.Tilemaps.ImageCollection#imageWidth + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.imageWidth = width | 0; - this.loader.textureManager.addAtlas(image.key, image.data, json.data, normalMap); + /** + * The height of the tallest image (in pixels). + * + * @name Phaser.Tilemaps.ImageCollection#imageHeight + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.imageHeight = height | 0; - json.addToCache(); + /** + * The margin around the images in the collection (in pixels). + * Use `setSpacing` to change. + * + * @name Phaser.Tilemaps.ImageCollection#imageMarge + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.imageMargin = margin | 0; - this.complete = true; - } - } + /** + * The spacing between each image in the collection (in pixels). + * Use `setSpacing` to change. + * + * @name Phaser.Tilemaps.ImageCollection#imageSpacing + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.imageSpacing = spacing | 0; -}); + /** + * Image Collection-specific properties that are typically defined in the Tiled editor. + * + * @name Phaser.Tilemaps.ImageCollection#properties + * @type {object} + * @since 3.0.0 + */ + this.properties = properties || {}; -/** - * Aseprite is a powerful animated sprite editor and pixel art tool. - * - * You can find more details at https://www.aseprite.org/ - * - * Adds a JSON based Aseprite Animation, or array of animations, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.aseprite('gladiator', 'images/Gladiator.png', 'images/Gladiator.json'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring - * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. - * - * To export a compatible JSON file in Aseprite, please do the following: - * - * 1. Go to "File - Export Sprite Sheet" - * - * 2. On the **Layout** tab: - * 2a. Set the "Sheet type" to "Packed" - * 2b. Set the "Constraints" to "None" - * 2c. Check the "Merge Duplicates" checkbox - * - * 3. On the **Sprite** tab: - * 3a. Set "Layers" to "Visible layers" - * 3b. Set "Frames" to "All frames", unless you only wish to export a sub-set of tags - * - * 4. On the **Borders** tab: - * 4a. Check the "Trim Sprite" and "Trim Cells" options - * 4b. Ensure "Border Padding", "Spacing" and "Inner Padding" are all > 0 (1 is usually enough) - * - * 5. On the **Output** tab: - * 5a. Check "Output File", give your image a name and make sure you choose "png files" as the file type - * 5b. Check "JSON Data" and give your json file a name - * 5c. The JSON Data type can be either a Hash or Array, Phaser doesn't mind. - * 5d. Make sure "Tags" is checked in the Meta options - * 5e. In the "Item Filename" input box, make sure it says just "{frame}" and nothing more. - * - * 6. Click export - * - * This was tested with Aseprite 1.2.25. - * - * This will export a png and json file which you can load using the Aseprite Loader, i.e.: - * - * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. - * - * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Texture Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.aseprite({ - * key: 'gladiator', - * textureURL: 'images/Gladiator.png', - * atlasURL: 'images/Gladiator.json' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.AsepriteFileConfig` for more details. - * - * Instead of passing a URL for the JSON data you can also pass in a well formed JSON object instead. - * - * Once loaded, you can call this method from within a Scene with the 'atlas' key: - * - * ```javascript - * this.anims.createFromAseprite('paladin'); - * ``` - * - * Any animations defined in the JSON will now be available to use in Phaser and you play them - * via their Tag name. For example, if you have an animation called 'War Cry' on your Aseprite timeline, - * you can play it in Phaser using that Tag name: - * - * ```javascript - * this.add.sprite(400, 300).play('War Cry'); - * ``` - * - * When calling this method you can optionally provide an array of tag names, and only those animations - * will be created. For example: - * - * ```javascript - * this.anims.createFromAseprite('paladin', [ 'step', 'War Cry', 'Magnum Break' ]); - * ``` - * - * This will only create the 3 animations defined. Note that the tag names are case-sensitive. - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and - * this is what you would use to retrieve the image from the Texture Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Aseprite File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#aseprite - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.50.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.AsepriteFileConfig|Phaser.Types.Loader.FileTypes.AsepriteFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {object|string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. - * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('aseprite', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) -{ - var multifile; + /** + * The cached images that are a part of this collection. + * + * @name Phaser.Tilemaps.ImageCollection#images + * @type {array} + * @readonly + * @since 3.0.0 + */ + this.images = []; - // Supports an Object file definition in the key argument - // Or an array of objects in the key argument - // Or a single entry where all arguments have been defined + /** + * The total number of images in the image collection. + * + * @name Phaser.Tilemaps.ImageCollection#total + * @type {number} + * @readonly + * @since 3.0.0 + */ + this.total = 0; + }, - if (Array.isArray(key)) + /** + * Returns true if and only if this image collection contains the given image index. + * + * @method Phaser.Tilemaps.ImageCollection#containsImageIndex + * @since 3.0.0 + * + * @param {number} imageIndex - The image index to search for. + * + * @return {boolean} True if this Image Collection contains the given index. + */ + containsImageIndex: function (imageIndex) { - for (var i = 0; i < key.length; i++) - { - multifile = new AsepriteFile(this, key[i]); + return (imageIndex >= this.firstgid && imageIndex < (this.firstgid + this.total)); + }, - this.addFile(multifile.files); - } - } - else + /** + * Add an image to this Image Collection. + * + * @method Phaser.Tilemaps.ImageCollection#addImage + * @since 3.0.0 + * + * @param {number} gid - The gid of the image in the Image Collection. + * @param {string} image - The the key of the image in the Image Collection and in the cache. + * + * @return {Phaser.Tilemaps.ImageCollection} This ImageCollection object. + */ + addImage: function (gid, image) { - multifile = new AsepriteFile(this, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings); + this.images.push({ gid: gid, image: image }); + this.total++; - this.addFile(multifile.files); + return this; } - return this; }); -module.exports = AsepriteFile; +module.exports = ImageCollection; /***/ }), -/* 1342 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 46422: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2021 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(71); -var IsPlainObject = __webpack_require__(7); -var JSONFile = __webpack_require__(61); -var MultiFile = __webpack_require__(49); +var Class = __webpack_require__(56694); /** * @classdesc - * A single JSON based Texture Atlas File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#atlas method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlas. - * - * https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-for-phaser3?source=photonstorm + * The ObjectHelper helps tie objects with `gids` into the tileset + * that sits behind them. * - * @class AtlasJSONFile - * @extends Phaser.Loader.MultiFile - * @memberof Phaser.Loader.FileTypes + * @class ObjectHelper + * @memberof Phaser.Tilemaps * @constructor - * @since 3.0.0 + * @since 3.60.0 * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.AtlasJSONFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {object|string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. - * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Tilemaps.Tileset[]} tilesets - The backing tileset data. */ -var AtlasJSONFile = new Class({ - - Extends: MultiFile, +var ObjectHelper = new Class({ initialize: - function AtlasJSONFile (loader, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) + function ObjectHelper (tilesets) { - var image; - var data; + /** + * The Tile GIDs array. + * + * @name Phaser.Tilemaps.ObjectHelper#gids + * @type {array} + * @since 3.60.0 + */ + this.gids = []; - if (IsPlainObject(key)) + if (tilesets !== undefined) { - var config = key; + for (var t = 0; t < tilesets.length; ++t) + { + var tileset = tilesets[t]; - key = GetFastValue(config, 'key'); + for (var i = 0; i < tileset.total; ++i) + { + this.gids[tileset.firstgid + i] = tileset; + } + } + } - image = new ImageFile(loader, { - key: key, - url: GetFastValue(config, 'textureURL'), - extension: GetFastValue(config, 'textureExtension', 'png'), - normalMap: GetFastValue(config, 'normalMap'), - xhrSettings: GetFastValue(config, 'textureXhrSettings') - }); + /** + * The Tile GIDs array. + * + * @name Phaser.Tilemaps.ObjectHelper#_gids + * @type {array} + * @private + * @since 3.60.0 + */ + this._gids = this.gids; + }, - data = new JSONFile(loader, { - key: key, - url: GetFastValue(config, 'atlasURL'), - extension: GetFastValue(config, 'atlasExtension', 'json'), - xhrSettings: GetFastValue(config, 'atlasXhrSettings') - }); + /** + * Enabled if the object helper reaches in to tilesets for data. + * Disabled if it only uses data directly on a gid object. + * + * @name Phaser.Tilemaps.ObjectHelper#enabled + * @type {boolean} + * @since 3.60.0 + */ + enabled: { + + get: function () + { + return !!this.gids; + }, + + set: function (v) + { + this.gids = v ? this._gids : undefined; } - else + + }, + + /** + * Gets the Tiled `type` field value from the object or the `gid` behind it. + * + * @method Phaser.Tilemaps.ObjectHelper#getTypeIncludingTile + * @since 3.60.0 + * + * @param {Phaser.Types.Tilemaps.TiledObject} obj - The Tiled object to investigate. + * + * @return {?string} The `type` of the object, the tile behind the `gid` of the object, or `undefined`. + */ + getTypeIncludingTile: function (obj) + { + if (obj.type !== undefined && obj.type !== '') { - image = new ImageFile(loader, key, textureURL, textureXhrSettings); - data = new JSONFile(loader, key, atlasURL, atlasXhrSettings); + return obj.type; } - if (image.linkFile) + if (!this.gids || obj.gid === undefined) { - // Image has a normal map - MultiFile.call(this, loader, 'atlasjson', key, [ image, data, image.linkFile ]); + return undefined; } - else + + var tileset = this.gids[obj.gid]; + + if (!tileset) { - MultiFile.call(this, loader, 'atlasjson', key, [ image, data ]); + return undefined; + } + + var tileData = tileset.getTileData(obj.gid); + + if (!tileData) + { + return undefined; } + + return tileData.type; }, /** - * Adds this file to its target cache upon successful loading and processing. + * Sets the sprite texture data as specified (usually in a config) or, failing that, + * as specified in the `gid` of the object being loaded (if any). * - * @method Phaser.Loader.FileTypes.AtlasJSONFile#addToCache - * @since 3.7.0 + * This fallback will only work if the tileset was loaded as a spritesheet matching + * the geometry of sprites fed into tiled, so that, for example: "tile id #`3`"" within + * the tileset is the same as texture frame `3` from the image of the tileset. + * + * @method Phaser.Tilemaps.ObjectHelper#setTextureAndFrame + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} sprite - The Game Object to modify. + * @param {string|Phaser.Textures.Texture} [key] - The texture key to set (or else the `obj.gid`'s tile is used if available). + * @param {string|number|Phaser.Textures.Frame} [frame] - The frames key to set (or else the `obj.gid`'s tile is used if available). + * @param {Phaser.Types.Tilemaps.TiledObject} [obj] - The Tiled object for fallback. */ - addToCache: function () + setTextureAndFrame: function (sprite, key, frame, obj) { - if (this.isReadyToProcess()) + if ((key === null) && this.gids && obj.gid !== undefined) { - var image = this.files[0]; - var json = this.files[1]; - var normalMap = (this.files[2]) ? this.files[2].data : null; + var tileset = this.gids[obj.gid]; - this.loader.textureManager.addAtlas(image.key, image.data, json.data, normalMap); + if (tileset) + { + if (key === null && tileset.image !== undefined) + { + key = tileset.image.key; + } - json.pendingDestroy(); + if (frame === null) + { + // This relies on the tileset texture *also* having been loaded as a spritesheet. This isn't guaranteed! + frame = obj.gid - tileset.firstgid; + } - this.complete = true; + // If we can't satisfy the request, probably best to null it out rather than set a whole spritesheet or something. + if (!sprite.scene.textures.getFrame(key, frame)) + { + key = null; + frame = null; + } + } + } + + sprite.setTexture(key, frame); + }, + + /** + * Sets the `sprite.data` field from the tiled properties on the object and its tile (if any). + * + * @method Phaser.Tilemaps.ObjectHelper#setPropertiesFromTiledObject + * @since 3.60.0 + * + * @param {Phaser.GameObjects.GameObject} sprite + * @param {Phaser.Types.Tilemaps.TiledObject} obj + */ + setPropertiesFromTiledObject: function (sprite, obj) + { + if (this.gids !== undefined && obj.gid !== undefined) + { + var tileset = this.gids[obj.gid]; + + if (tileset !== undefined) + { + this.setFromJSON(sprite, tileset.getTileProperties(obj.gid)); + } + } + + this.setFromJSON(sprite, obj.properties); + }, + + /** + * Sets the sprite data from the JSON object. + * + * @method Phaser.Tilemaps.ObjectHelper#setFromJSON + * @since 3.60.0 + * @private + * + * @param {Phaser.GameObjects.GameObject} sprite - The object for which to populate `data`. + * @param {(Object.|Object[])} properties - The properties to set in either JSON object format or else a list of objects with `name` and `value` fields. + */ + setFromJSON: function (sprite, properties) + { + if (!properties) + { + return; + } + + if (Array.isArray(properties)) + { + // Tiled objects custom properties format + properties.forEach(function (propData) + { + sprite.setData(propData.name, propData.value); + }); + + return; } - } + for (var key in properties) + { + if (sprite[key] !== undefined) + { + sprite[key] = properties[key]; + } + else + { + sprite.setData(key, properties[key]); + } + } + } }); +module.exports = ObjectHelper; + + +/***/ }), + +/***/ 15043: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + /** - * Adds a JSON based Texture Atlas, or array of atlases, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.atlas('mainmenu', 'images/MainMenu.png', 'images/MainMenu.json'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring - * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. - * - * Phaser expects the atlas data to be provided in a JSON file, using either the JSON Hash or JSON Array format. - * These files are created by software such as Texture Packer, Shoebox and Adobe Flash / Animate. - * If you are using Texture Packer and have enabled multi-atlas support, then please use the Phaser Multi Atlas loader - * instead of this one. - * - * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. - * - * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Texture Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.atlas({ - * key: 'mainmenu', - * textureURL: 'images/MainMenu.png', - * atlasURL: 'images/MainMenu.json' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.AtlasJSONFileConfig` for more details. - * - * Instead of passing a URL for the atlas JSON data you can also pass in a well formed JSON object instead. - * - * Once the atlas has finished loading you can use frames from it as textures for a Game Object by referencing its key: - * - * ```javascript - * this.load.atlas('mainmenu', 'images/MainMenu.png', 'images/MainMenu.json'); - * // and later in your game ... - * this.add.image(x, y, 'mainmenu', 'background'); - * ``` - * - * To get a list of all available frames within an atlas please consult your Texture Atlas software. - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and - * this is what you would use to retrieve the image from the Texture Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, - * then you can specify it by providing an array as the `url` where the second element is the normal map: - * - * ```javascript - * this.load.atlas('mainmenu', [ 'images/MainMenu.png', 'images/MainMenu-n.png' ], 'images/MainMenu.json'); - * ``` - * - * Or, if you are using a config object use the `normalMap` property: - * - * ```javascript - * this.load.atlas({ - * key: 'mainmenu', - * textureURL: 'images/MainMenu.png', - * normalMap: 'images/MainMenu-n.png', - * atlasURL: 'images/MainMenu.json' - * }); - * ``` - * - * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. - * Normal maps are a WebGL only feature. - * - * Note: The ability to load this type of file will only be available if the Atlas JSON File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Formats = __webpack_require__(93560); +var MapData = __webpack_require__(16586); +var Parse = __webpack_require__(90715); +var Tilemap = __webpack_require__(89797); + +/** + * Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When + * loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing from + * a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map data. For + * an empty map, you should specify tileWidth, tileHeight, width & height. * - * @method Phaser.Loader.LoaderPlugin#atlas - * @fires Phaser.Loader.LoaderPlugin#ADD + * @function Phaser.Tilemaps.ParseToTilemap * @since 3.0.0 * - * @param {(string|Phaser.Types.Loader.FileTypes.AtlasJSONFileConfig|Phaser.Types.Loader.FileTypes.AtlasJSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {object|string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. - * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. + * @param {Phaser.Scene} scene - The Scene to which this Tilemap belongs. + * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. + * @param {number} [tileWidth=32] - The width of a tile in pixels. + * @param {number} [tileHeight=32] - The height of a tile in pixels. + * @param {number} [width=10] - The width of the map in tiles. + * @param {number} [height=10] - The height of the map in tiles. + * @param {number[][]} [data] - Instead of loading from the cache, you can also load directly from + * a 2D array of tile indexes. + * @param {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the + * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty + * location will get a Tile object with an index of -1. If you've a large sparsely populated map and + * the tile data doesn't need to change then setting this value to `true` will help with memory + * consumption. However if your map is small or you need to update the tiles dynamically, then leave + * the default value set. * - * @return {this} The Loader instance. + * @return {Phaser.Tilemaps.Tilemap} */ -FileTypesManager.register('atlas', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) +var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height, data, insertNull) { - var multifile; + if (tileWidth === undefined) { tileWidth = 32; } + if (tileHeight === undefined) { tileHeight = 32; } + if (width === undefined) { width = 10; } + if (height === undefined) { height = 10; } + if (insertNull === undefined) { insertNull = false; } - // Supports an Object file definition in the key argument - // Or an array of objects in the key argument - // Or a single entry where all arguments have been defined + var mapData = null; - if (Array.isArray(key)) + if (Array.isArray(data)) { - for (var i = 0; i < key.length; i++) - { - multifile = new AtlasJSONFile(this, key[i]); + var name = key !== undefined ? key : 'map'; + mapData = Parse(name, Formats.ARRAY_2D, data, tileWidth, tileHeight, insertNull); + } + else if (key !== undefined) + { + var tilemapData = scene.cache.tilemap.get(key); - this.addFile(multifile.files); + if (!tilemapData) + { + console.warn('No map data found for key ' + key); + } + else + { + mapData = Parse(key, tilemapData.format, tilemapData.data, tileWidth, tileHeight, insertNull); } } - else - { - multifile = new AtlasJSONFile(this, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings); - this.addFile(multifile.files); + if (mapData === null) + { + mapData = new MapData({ + tileWidth: tileWidth, + tileHeight: tileHeight, + width: width, + height: height + }); } - return this; -}); + return new Tilemap(scene, mapData); +}; -module.exports = AtlasJSONFile; +module.exports = ParseToTilemap; /***/ }), -/* 1343 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 29633: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(71); -var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(49); -var XMLFile = __webpack_require__(241); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var CONST = __webpack_require__(12920); +var DeepCopy = __webpack_require__(28699); +var Rectangle = __webpack_require__(66658); /** * @classdesc - * A single XML based Texture Atlas File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#atlasXML method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlasXML. + * A Tile is a representation of a single tile within the Tilemap. This is a lightweight data + * representation, so its position information is stored without factoring in scroll, layer + * scale or layer position. * - * @class AtlasXMLFile - * @extends Phaser.Loader.MultiFile - * @memberof Phaser.Loader.FileTypes + * @class Tile + * @memberof Phaser.Tilemaps * @constructor - * @since 3.7.0 + * @since 3.0.0 * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.AtlasXMLFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas xml file. Used in replacement of the Loaders default XHR Settings. + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Tilemaps.LayerData} layer - The LayerData object in the Tilemap that this tile belongs to. + * @param {number} index - The unique index of this tile within the map. + * @param {number} x - The x coordinate of this tile in tile coordinates. + * @param {number} y - The y coordinate of this tile in tile coordinates. + * @param {number} width - Width of the tile in pixels. + * @param {number} height - Height of the tile in pixels. + * @param {number} baseWidth - The base width a tile in the map (in pixels). Tiled maps support + * multiple tileset sizes within one map, but they are still placed at intervals of the base + * tile width. + * @param {number} baseHeight - The base height of the tile in pixels (in pixels). Tiled maps + * support multiple tileset sizes within one map, but they are still placed at intervals of the + * base tile height. */ -var AtlasXMLFile = new Class({ +var Tile = new Class({ - Extends: MultiFile, + Mixins: [ + Components.Alpha, + Components.Flip, + Components.Visible + ], initialize: - function AtlasXMLFile (loader, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) + function Tile (layer, index, x, y, width, height, baseWidth, baseHeight) { - var image; - var data; + /** + * The LayerData in the Tilemap data that this tile belongs to. + * + * @name Phaser.Tilemaps.Tile#layer + * @type {Phaser.Tilemaps.LayerData} + * @since 3.0.0 + */ + this.layer = layer; - if (IsPlainObject(key)) - { - var config = key; + /** + * The index of this tile within the map data corresponding to the tileset, or -1 if this + * represents a blank tile. + * + * @name Phaser.Tilemaps.Tile#index + * @type {number} + * @since 3.0.0 + */ + this.index = index; - key = GetFastValue(config, 'key'); + /** + * The x map coordinate of this tile in tile units. + * + * @name Phaser.Tilemaps.Tile#x + * @type {number} + * @since 3.0.0 + */ + this.x = x; - image = new ImageFile(loader, { - key: key, - url: GetFastValue(config, 'textureURL'), - extension: GetFastValue(config, 'textureExtension', 'png'), - normalMap: GetFastValue(config, 'normalMap'), - xhrSettings: GetFastValue(config, 'textureXhrSettings') - }); + /** + * The y map coordinate of this tile in tile units. + * + * @name Phaser.Tilemaps.Tile#y + * @type {number} + * @since 3.0.0 + */ + this.y = y; - data = new XMLFile(loader, { - key: key, - url: GetFastValue(config, 'atlasURL'), - extension: GetFastValue(config, 'atlasExtension', 'xml'), - xhrSettings: GetFastValue(config, 'atlasXhrSettings') - }); - } - else - { - image = new ImageFile(loader, key, textureURL, textureXhrSettings); - data = new XMLFile(loader, key, atlasURL, atlasXhrSettings); - } + /** + * The width of the tile in pixels. + * + * @name Phaser.Tilemaps.Tile#width + * @type {number} + * @since 3.0.0 + */ + this.width = width; - if (image.linkFile) - { - // Image has a normal map - MultiFile.call(this, loader, 'atlasxml', key, [ image, data, image.linkFile ]); - } - else - { - MultiFile.call(this, loader, 'atlasxml', key, [ image, data ]); - } + /** + * The height of the tile in pixels. + * + * @name Phaser.Tilemaps.Tile#height + * @type {number} + * @since 3.0.0 + */ + this.height = height; + + /** + * The right of the tile in pixels. + * + * Set in the `updatePixelXY` method. + * + * @name Phaser.Tilemaps.Tile#right + * @type {number} + * @since 3.50.0 + */ + this.right; + + /** + * The bottom of the tile in pixels. + * + * Set in the `updatePixelXY` method. + * + * @name Phaser.Tilemaps.Tile#bottom + * @type {number} + * @since 3.50.0 + */ + this.bottom; + + /** + * The maps base width of a tile in pixels. Tiled maps support multiple tileset sizes + * within one map, but they are still placed at intervals of the base tile size. + * + * @name Phaser.Tilemaps.Tile#baseWidth + * @type {number} + * @since 3.0.0 + */ + this.baseWidth = (baseWidth !== undefined) ? baseWidth : width; + + /** + * The maps base height of a tile in pixels. Tiled maps support multiple tileset sizes + * within one map, but they are still placed at intervals of the base tile size. + * + * @name Phaser.Tilemaps.Tile#baseHeight + * @type {number} + * @since 3.0.0 + */ + this.baseHeight = (baseHeight !== undefined) ? baseHeight : height; + + /** + * The x coordinate of the top left of this tile in pixels. This is relative to the top left + * of the layer this tile is being rendered within. This property does NOT factor in camera + * scroll, layer scale or layer position. + * + * @name Phaser.Tilemaps.Tile#pixelX + * @type {number} + * @since 3.0.0 + */ + this.pixelX = 0; + + /** + * The y coordinate of the top left of this tile in pixels. This is relative to the top left + * of the layer this tile is being rendered within. This property does NOT factor in camera + * scroll, layer scale or layer position. + * + * @name Phaser.Tilemaps.Tile#pixelY + * @type {number} + * @since 3.0.0 + */ + this.pixelY = 0; + + this.updatePixelXY(); + + /** + * Tile specific properties. These usually come from Tiled. + * + * @name Phaser.Tilemaps.Tile#properties + * @type {any} + * @since 3.0.0 + */ + this.properties = {}; + + /** + * The rotation angle of this tile. + * + * @name Phaser.Tilemaps.Tile#rotation + * @type {number} + * @since 3.0.0 + */ + this.rotation = 0; + + /** + * Whether the tile should collide with any object on the left side. + * + * This property is used by Arcade Physics only, however, you can also use it + * in your own checks. + * + * @name Phaser.Tilemaps.Tile#collideLeft + * @type {boolean} + * @since 3.0.0 + */ + this.collideLeft = false; + + /** + * Whether the tile should collide with any object on the right side. + * + * This property is used by Arcade Physics only, however, you can also use it + * in your own checks. + * + * @name Phaser.Tilemaps.Tile#collideRight + * @type {boolean} + * @since 3.0.0 + */ + this.collideRight = false; + + /** + * Whether the tile should collide with any object on the top side. + * + * This property is used by Arcade Physics only, however, you can also use it + * in your own checks. + * + * @name Phaser.Tilemaps.Tile#collideUp + * @type {boolean} + * @since 3.0.0 + */ + this.collideUp = false; + + /** + * Whether the tile should collide with any object on the bottom side. + * + * This property is used by Arcade Physics only, however, you can also use it + * in your own checks. + * + * @name Phaser.Tilemaps.Tile#collideDown + * @type {boolean} + * @since 3.0.0 + */ + this.collideDown = false; + + /** + * Whether the tiles left edge is interesting for collisions. + * + * @name Phaser.Tilemaps.Tile#faceLeft + * @type {boolean} + * @since 3.0.0 + */ + this.faceLeft = false; + + /** + * Whether the tiles right edge is interesting for collisions. + * + * @name Phaser.Tilemaps.Tile#faceRight + * @type {boolean} + * @since 3.0.0 + */ + this.faceRight = false; + + /** + * Whether the tiles top edge is interesting for collisions. + * + * @name Phaser.Tilemaps.Tile#faceTop + * @type {boolean} + * @since 3.0.0 + */ + this.faceTop = false; + + /** + * Whether the tiles bottom edge is interesting for collisions. + * + * @name Phaser.Tilemaps.Tile#faceBottom + * @type {boolean} + * @since 3.0.0 + */ + this.faceBottom = false; + + /** + * Tile collision callback. + * + * @name Phaser.Tilemaps.Tile#collisionCallback + * @type {function} + * @since 3.0.0 + */ + this.collisionCallback = undefined; + + /** + * The context in which the collision callback will be called. + * + * @name Phaser.Tilemaps.Tile#collisionCallbackContext + * @type {object} + * @since 3.0.0 + */ + this.collisionCallbackContext = this; + + /** + * The tint to apply to this tile. Note: tint is currently a single color value instead of + * the 4 corner tint component on other GameObjects. + * + * @name Phaser.Tilemaps.Tile#tint + * @type {number} + * @default + * @since 3.0.0 + */ + this.tint = 0xffffff; + + /** + * An empty object where physics-engine specific information (e.g. bodies) may be stored. + * + * @name Phaser.Tilemaps.Tile#physics + * @type {object} + * @since 3.0.0 + */ + this.physics = {}; }, /** - * Adds this file to its target cache upon successful loading and processing. + * Check if the given x and y world coordinates are within this Tile. This does not factor in + * camera scroll, layer scale or layer position. * - * @method Phaser.Loader.FileTypes.AtlasXMLFile#addToCache - * @since 3.7.0 + * @method Phaser.Tilemaps.Tile#containsPoint + * @since 3.0.0 + * + * @param {number} x - The x coordinate to test. + * @param {number} y - The y coordinate to test. + * + * @return {boolean} True if the coordinates are within this Tile, otherwise false. */ - addToCache: function () + containsPoint: function (x, y) { - if (this.isReadyToProcess()) - { - var image = this.files[0]; - var xml = this.files[1]; - var normalMap = (this.files[2]) ? this.files[2].data : null; + return !(x < this.pixelX || y < this.pixelY || x > this.right || y > this.bottom); + }, - this.loader.textureManager.addAtlasXML(image.key, image.data, xml.data, normalMap); + /** + * Copies the tile data and properties from the given Tile to this Tile. This copies everything + * except for position and interesting face calculations. + * + * @method Phaser.Tilemaps.Tile#copy + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.Tile} tile - The tile to copy from. + * + * @return {this} This Tile object instance. + */ + copy: function (tile) + { + this.index = tile.index; + this.alpha = tile.alpha; + this.properties = DeepCopy(tile.properties); + this.visible = tile.visible; + this.setFlip(tile.flipX, tile.flipY); + this.tint = tile.tint; + this.rotation = tile.rotation; + this.collideUp = tile.collideUp; + this.collideDown = tile.collideDown; + this.collideLeft = tile.collideLeft; + this.collideRight = tile.collideRight; + this.collisionCallback = tile.collisionCallback; + this.collisionCallbackContext = tile.collisionCallbackContext; - xml.pendingDestroy(); + return this; + }, - this.complete = true; + /** + * The collision group for this Tile, defined within the Tileset. This returns a reference to + * the collision group stored within the Tileset, so any modification of the returned object + * will impact all tiles that have the same index as this tile. + * + * @method Phaser.Tilemaps.Tile#getCollisionGroup + * @since 3.0.0 + * + * @return {?object} The collision group for this Tile, as defined in the Tileset, or `null` if no group was defined. + */ + getCollisionGroup: function () + { + return this.tileset ? this.tileset.getTileCollisionGroup(this.index) : null; + }, + + /** + * The tile data for this Tile, defined within the Tileset. This typically contains Tiled + * collision data, tile animations and terrain information. This returns a reference to the tile + * data stored within the Tileset, so any modification of the returned object will impact all + * tiles that have the same index as this tile. + * + * @method Phaser.Tilemaps.Tile#getTileData + * @since 3.0.0 + * + * @return {?object} The tile data for this Tile, as defined in the Tileset, or `null` if no data was defined. + */ + getTileData: function () + { + return this.tileset ? this.tileset.getTileData(this.index) : null; + }, + + /** + * Gets the world X position of the left side of the tile, factoring in the layers position, + * scale and scroll. + * + * @method Phaser.Tilemaps.Tile#getLeft + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * + * @return {number} The left (x) value of this tile. + */ + getLeft: function (camera) + { + var tilemapLayer = this.tilemapLayer; + + if (tilemapLayer) + { + var point = tilemapLayer.tileToWorldXY(this.x, this.y, undefined, camera); + + return point.x; } - } -}); + return this.x * this.baseWidth; + }, -/** - * Adds an XML based Texture Atlas, or array of atlases, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.atlasXML('mainmenu', 'images/MainMenu.png', 'images/MainMenu.xml'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring - * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. - * - * Phaser expects the atlas data to be provided in an XML file format. - * These files are created by software such as Shoebox and Adobe Flash / Animate. - * - * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. - * - * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Texture Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.atlasXML({ - * key: 'mainmenu', - * textureURL: 'images/MainMenu.png', - * atlasURL: 'images/MainMenu.xml' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.AtlasXMLFileConfig` for more details. - * - * Once the atlas has finished loading you can use frames from it as textures for a Game Object by referencing its key: - * - * ```javascript - * this.load.atlasXML('mainmenu', 'images/MainMenu.png', 'images/MainMenu.xml'); - * // and later in your game ... - * this.add.image(x, y, 'mainmenu', 'background'); - * ``` - * - * To get a list of all available frames within an atlas please consult your Texture Atlas software. - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and - * this is what you would use to retrieve the image from the Texture Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, - * then you can specify it by providing an array as the `url` where the second element is the normal map: - * - * ```javascript - * this.load.atlasXML('mainmenu', [ 'images/MainMenu.png', 'images/MainMenu-n.png' ], 'images/MainMenu.xml'); - * ``` - * - * Or, if you are using a config object use the `normalMap` property: - * - * ```javascript - * this.load.atlasXML({ - * key: 'mainmenu', - * textureURL: 'images/MainMenu.png', - * normalMap: 'images/MainMenu-n.png', - * atlasURL: 'images/MainMenu.xml' - * }); - * ``` - * - * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. - * Normal maps are a WebGL only feature. - * - * Note: The ability to load this type of file will only be available if the Atlas XML File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#atlasXML - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.7.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.AtlasXMLFileConfig|Phaser.Types.Loader.FileTypes.AtlasXMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas xml file. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('atlasXML', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) -{ - var multifile; + /** + * Gets the world X position of the right side of the tile, factoring in the layer's position, + * scale and scroll. + * + * @method Phaser.Tilemaps.Tile#getRight + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * + * @return {number} The right (x) value of this tile. + */ + getRight: function (camera) + { + var tilemapLayer = this.tilemapLayer; - // Supports an Object file definition in the key argument - // Or an array of objects in the key argument - // Or a single entry where all arguments have been defined + return (tilemapLayer) ? this.getLeft(camera) + this.width * tilemapLayer.scaleX : this.getLeft(camera) + this.width; + }, - if (Array.isArray(key)) + /** + * Gets the world Y position of the top side of the tile, factoring in the layer's position, + * scale and scroll. + * + * @method Phaser.Tilemaps.Tile#getTop + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * + * @return {number} The top (y) value of this tile. + */ + getTop: function (camera) { - for (var i = 0; i < key.length; i++) + var tilemapLayer = this.tilemapLayer; + + // Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile in grid + // units is the bottom left, so the y coordinate needs to be adjusted by the difference + // between the base size and this tile's size. + if (tilemapLayer) { - multifile = new AtlasXMLFile(this, key[i]); + var point = tilemapLayer.tileToWorldXY(this.x, this.y, undefined, camera); - this.addFile(multifile.files); + return point.y; } - } - else - { - multifile = new AtlasXMLFile(this, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings); - this.addFile(multifile.files); - } + return this.y * this.baseWidth - (this.height - this.baseHeight); + }, - return this; -}); + /** + * Gets the world Y position of the bottom side of the tile, factoring in the layer's position, + * scale and scroll. -module.exports = AtlasXMLFile; + * @method Phaser.Tilemaps.Tile#getBottom + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * + * @return {number} The bottom (y) value of this tile. + */ + getBottom: function (camera) + { + var tilemapLayer = this.tilemapLayer; + return tilemapLayer + ? this.getTop(camera) + this.height * tilemapLayer.scaleY + : this.getTop(camera) + this.height; + }, -/***/ }), -/* 1344 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Gets the world rectangle bounding box for the tile, factoring in the layers position, + * scale and scroll. + * + * @method Phaser.Tilemaps.Tile#getBounds + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * @param {Phaser.Geom.Rectangle} [output] - Optional Rectangle object to store the results in. + * + * @return {(Phaser.Geom.Rectangle|object)} The bounds of this Tile. + */ + getBounds: function (camera, output) + { + if (output === undefined) { output = new Rectangle(); } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + output.x = this.getLeft(camera); + output.y = this.getTop(camera); + output.width = this.getRight(camera) - output.x; + output.height = this.getBottom(camera) - output.y; -var AudioFile = __webpack_require__(518); -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); -var JSONFile = __webpack_require__(61); -var MultiFile = __webpack_require__(49); + return output; + }, -/** - * @classdesc - * An Audio Sprite File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#audioSprite method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audioSprite. - * - * @class AudioSpriteFile - * @extends Phaser.Loader.MultiFile - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.7.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.AudioSpriteFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} jsonURL - The absolute or relative URL to load the json file from. Or a well formed JSON object to use instead. - * @param {{(string|string[])}} [audioURL] - The absolute or relative URL to load the audio file from. If empty it will be obtained by parsing the JSON file. - * @param {any} [audioConfig] - The audio configuration options. - * @param {Phaser.Types.Loader.XHRSettingsObject} [audioXhrSettings] - An XHR Settings configuration object for the audio file. Used in replacement of the Loaders default XHR Settings. - * @param {Phaser.Types.Loader.XHRSettingsObject} [jsonXhrSettings] - An XHR Settings configuration object for the json file. Used in replacement of the Loaders default XHR Settings. - */ -var AudioSpriteFile = new Class({ + /** + * Gets the world X position of the center of the tile, factoring in the layer's position, + * scale and scroll. + * + * @method Phaser.Tilemaps.Tile#getCenterX + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * + * @return {number} The center x position of this Tile. + */ + getCenterX: function (camera) + { + return (this.getLeft(camera) + this.getRight(camera)) / 2; + }, - Extends: MultiFile, + /** + * Gets the world Y position of the center of the tile, factoring in the layer's position, + * scale and scroll. + * + * @method Phaser.Tilemaps.Tile#getCenterY + * @since 3.0.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use to perform the check. + * + * @return {number} The center y position of this Tile. + */ + getCenterY: function (camera) + { + return (this.getTop(camera) + this.getBottom(camera)) / 2; + }, - initialize: + /** + * Check for intersection with this tile. This does not factor in camera scroll, layer scale or + * layer position. + * + * @method Phaser.Tilemaps.Tile#intersects + * @since 3.0.0 + * + * @param {number} x - The x axis in pixels. + * @param {number} y - The y axis in pixels. + * @param {number} right - The right point. + * @param {number} bottom - The bottom point. + * + * @return {boolean} `true` if the Tile intersects with the given dimensions, otherwise `false`. + */ + intersects: function (x, y, right, bottom) + { + return !( + right <= this.pixelX || bottom <= this.pixelY || + x >= this.right || y >= this.bottom + ); + }, - function AudioSpriteFile (loader, key, jsonURL, audioURL, audioConfig, audioXhrSettings, jsonXhrSettings) + /** + * Checks if the tile is interesting. + * + * @method Phaser.Tilemaps.Tile#isInteresting + * @since 3.0.0 + * + * @param {boolean} collides - If true, will consider the tile interesting if it collides on any side. + * @param {boolean} faces - If true, will consider the tile interesting if it has an interesting face. + * + * @return {boolean} True if the Tile is interesting, otherwise false. + */ + isInteresting: function (collides, faces) { - if (IsPlainObject(key)) + if (collides && faces) { - var config = key; - - key = GetFastValue(config, 'key'); - jsonURL = GetFastValue(config, 'jsonURL'); - audioURL = GetFastValue(config, 'audioURL'); - audioConfig = GetFastValue(config, 'audioConfig'); - audioXhrSettings = GetFastValue(config, 'audioXhrSettings'); - jsonXhrSettings = GetFastValue(config, 'jsonXhrSettings'); + return (this.canCollide || this.hasInterestingFace); + } + else if (collides) + { + return this.collides; + } + else if (faces) + { + return this.hasInterestingFace; } - var data; + return false; + }, - // No url? then we're going to do a json load and parse it from that - if (!audioURL) - { - data = new JSONFile(loader, key, jsonURL, jsonXhrSettings); + /** + * Reset collision status flags. + * + * @method Phaser.Tilemaps.Tile#resetCollision + * @since 3.0.0 + * + * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate interesting faces for this tile and its neighbors. + * + * @return {this} This Tile object instance. + */ + resetCollision: function (recalculateFaces) + { + if (recalculateFaces === undefined) { recalculateFaces = true; } - MultiFile.call(this, loader, 'audiosprite', key, [ data ]); + this.collideLeft = false; + this.collideRight = false; + this.collideUp = false; + this.collideDown = false; - this.config.resourceLoad = true; - this.config.audioConfig = audioConfig; - this.config.audioXhrSettings = audioXhrSettings; - } - else + this.faceTop = false; + this.faceBottom = false; + this.faceLeft = false; + this.faceRight = false; + + if (recalculateFaces) { - var audio = AudioFile.create(loader, key, audioURL, audioConfig, audioXhrSettings); + var tilemapLayer = this.tilemapLayer; - if (audio) + if (tilemapLayer) { - data = new JSONFile(loader, key, jsonURL, jsonXhrSettings); - - MultiFile.call(this, loader, 'audiosprite', key, [ audio, data ]); - - this.config.resourceLoad = false; + this.tilemapLayer.calculateFacesAt(this.x, this.y); } } + + return this; }, /** - * Called by each File when it finishes loading. + * Reset faces. * - * @method Phaser.Loader.FileTypes.AudioSpriteFile#onFileComplete - * @since 3.7.0 + * @method Phaser.Tilemaps.Tile#resetFaces + * @since 3.0.0 * - * @param {Phaser.Loader.File} file - The File that has completed processing. + * @return {this} This Tile object instance. */ - onFileComplete: function (file) + resetFaces: function () { - var index = this.files.indexOf(file); + this.faceTop = false; + this.faceBottom = false; + this.faceLeft = false; + this.faceRight = false; - if (index !== -1) - { - this.pending--; + return this; + }, - if (this.config.resourceLoad && file.type === 'json' && file.data.hasOwnProperty('resources')) - { - // Inspect the data for the files to now load - var urls = file.data.resources; + /** + * Sets the collision flags for each side of this tile and updates the interesting faces list. + * + * @method Phaser.Tilemaps.Tile#setCollision + * @since 3.0.0 + * + * @param {boolean} left - Indicating collide with any object on the left. + * @param {boolean} [right] - Indicating collide with any object on the right. + * @param {boolean} [up] - Indicating collide with any object on the top. + * @param {boolean} [down] - Indicating collide with any object on the bottom. + * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate interesting faces for this tile and its neighbors. + * + * @return {this} This Tile object instance. + */ + setCollision: function (left, right, up, down, recalculateFaces) + { + if (right === undefined) { right = left; } + if (up === undefined) { up = left; } + if (down === undefined) { down = left; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - var audioConfig = GetFastValue(this.config, 'audioConfig'); - var audioXhrSettings = GetFastValue(this.config, 'audioXhrSettings'); + this.collideLeft = left; + this.collideRight = right; + this.collideUp = up; + this.collideDown = down; - var audio = AudioFile.create(this.loader, file.key, urls, audioConfig, audioXhrSettings); + this.faceLeft = left; + this.faceRight = right; + this.faceTop = up; + this.faceBottom = down; - if (audio) - { - this.addToMultiFile(audio); + if (recalculateFaces) + { + var tilemapLayer = this.tilemapLayer; - this.loader.addFile(audio); - } + if (tilemapLayer) + { + this.tilemapLayer.calculateFacesAt(this.x, this.y); } } + + return this; }, /** - * Adds this file to its target cache upon successful loading and processing. + * Set a callback to be called when this tile is hit by an object. The callback must true for + * collision processing to take place. * - * @method Phaser.Loader.FileTypes.AudioSpriteFile#addToCache - * @since 3.7.0 + * @method Phaser.Tilemaps.Tile#setCollisionCallback + * @since 3.0.0 + * + * @param {function} callback - Callback function. + * @param {object} context - Callback will be called within this context. + * + * @return {this} This Tile object instance. */ - addToCache: function () + setCollisionCallback: function (callback, context) { - if (this.isReadyToProcess()) + if (callback === null) { - var fileA = this.files[0]; - var fileB = this.files[1]; - - fileA.addToCache(); - fileB.addToCache(); - - this.complete = true; + this.collisionCallback = undefined; + this.collisionCallbackContext = undefined; + } + else + { + this.collisionCallback = callback; + this.collisionCallbackContext = context; } - } - -}); -/** - * Adds a JSON based Audio Sprite, or array of audio sprites, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.audioSprite('kyobi', 'kyobi.json', [ - * 'kyobi.ogg', - * 'kyobi.mp3', - * 'kyobi.m4a' - * ]); - * } - * ``` - * - * Audio Sprites are a combination of audio files and a JSON configuration. - * The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite - * - * If the JSON file includes a 'resource' object then you can let Phaser parse it and load the audio - * files automatically based on its content. To do this exclude the audio URLs from the load: - * - * ```javascript - * function preload () - * { - * this.load.audioSprite('kyobi', 'kyobi.json'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring - * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. - * - * The key must be a unique String. It is used to add the file to the global Audio Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Audio Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Audio Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.audioSprite({ - * key: 'kyobi', - * jsonURL: 'audio/Kyobi.json', - * audioURL: [ - * 'audio/Kyobi.ogg', - * 'audio/Kyobi.mp3', - * 'audio/Kyobi.m4a' - * ] - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.AudioSpriteFileConfig` for more details. - * - * Instead of passing a URL for the audio JSON data you can also pass in a well formed JSON object instead. - * - * Once the audio has finished loading you can use it create an Audio Sprite by referencing its key: - * - * ```javascript - * this.load.audioSprite('kyobi', 'kyobi.json'); - * // and later in your game ... - * var music = this.sound.addAudioSprite('kyobi'); - * music.play('title'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and - * this is what you would use to retrieve the image from the Texture Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * Due to different browsers supporting different audio file types you should usually provide your audio files in a variety of formats. - * ogg, mp3 and m4a are the most common. If you provide an array of URLs then the Loader will determine which _one_ file to load based on - * browser support. - * - * If audio has been disabled in your game, either via the game config, or lack of support from the device, then no audio will be loaded. - * - * Note: The ability to load this type of file will only be available if the Audio Sprite File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#audioSprite - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.AudioSpriteFileConfig|Phaser.Types.Loader.FileTypes.AudioSpriteFileConfig[])} key - The key to use for this file, or a file configuration object, or an array of objects. - * @param {string} jsonURL - The absolute or relative URL to load the json file from. Or a well formed JSON object to use instead. - * @param {(string|string[])} [audioURL] - The absolute or relative URL to load the audio file from. If empty it will be obtained by parsing the JSON file. - * @param {any} [audioConfig] - The audio configuration options. - * @param {Phaser.Types.Loader.XHRSettingsObject} [audioXhrSettings] - An XHR Settings configuration object for the audio file. Used in replacement of the Loaders default XHR Settings. - * @param {Phaser.Types.Loader.XHRSettingsObject} [jsonXhrSettings] - An XHR Settings configuration object for the json file. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader. - */ -FileTypesManager.register('audioSprite', function (key, jsonURL, audioURL, audioConfig, audioXhrSettings, jsonXhrSettings) -{ - var game = this.systems.game; - var gameAudioConfig = game.config.audio; - var deviceAudio = game.device.audio; + return this; + }, - if ((gameAudioConfig && gameAudioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) + /** + * Sets the size of the tile and updates its pixelX and pixelY. + * + * @method Phaser.Tilemaps.Tile#setSize + * @since 3.0.0 + * + * @param {number} tileWidth - The width of the tile in pixels. + * @param {number} tileHeight - The height of the tile in pixels. + * @param {number} baseWidth - The base width a tile in the map (in pixels). + * @param {number} baseHeight - The base height of the tile in pixels (in pixels). + * + * @return {this} This Tile object instance. + */ + setSize: function (tileWidth, tileHeight, baseWidth, baseHeight) { - // Sounds are disabled, so skip loading audio - return this; - } + if (tileWidth !== undefined) { this.width = tileWidth; } + if (tileHeight !== undefined) { this.height = tileHeight; } + if (baseWidth !== undefined) { this.baseWidth = baseWidth; } + if (baseHeight !== undefined) { this.baseHeight = baseHeight; } - var multifile; + this.updatePixelXY(); - // Supports an Object file definition in the key argument - // Or an array of objects in the key argument - // Or a single entry where all arguments have been defined + return this; + }, - if (Array.isArray(key)) + /** + * Used internally. Updates the tiles world XY position based on the current tile size. + * + * @method Phaser.Tilemaps.Tile#updatePixelXY + * @since 3.0.0 + * + * @return {this} This Tile object instance. + */ + updatePixelXY: function () { - for (var i = 0; i < key.length; i++) + var orientation = this.layer.orientation; + + if (orientation === CONST.ORTHOGONAL) { - multifile = new AudioSpriteFile(this, key[i]); + // In orthogonal mode, Tiled places tiles on a grid of baseWidth x baseHeight. The origin for a tile is the + // bottom left, while the Phaser renderer assumes the origin is the top left. The y + // coordinate needs to be adjusted by the difference. - if (multifile.files) - { - this.addFile(multifile.files); - } + this.pixelX = this.x * this.baseWidth; + this.pixelY = this.y * this.baseHeight; } - } - else - { - multifile = new AudioSpriteFile(this, key, jsonURL, audioURL, audioConfig, audioXhrSettings, jsonXhrSettings); + else if (orientation === CONST.ISOMETRIC) + { + // Reminder: For the tilemap to be centered we have to move the image to the right with the camera! + // This is crucial for wordtotile, tiletoworld to work. - if (multifile.files) + this.pixelX = (this.x - this.y) * this.baseWidth * 0.5; + this.pixelY = (this.x + this.y) * this.baseHeight * 0.5; + } + else if (orientation === CONST.STAGGERED) { - this.addFile(multifile.files); + this.pixelX = this.x * this.baseWidth + this.y % 2 * (this.baseWidth / 2); + this.pixelY = this.y * (this.baseHeight / 2); } - } - - return this; -}); - - -/***/ }), -/* 1345 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); - -/** - * @classdesc - * A single Binary File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#binary method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#binary. - * - * @class BinaryFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.BinaryFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.bin`, i.e. if `key` was "alien" then the URL will be "alien.bin". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - * @param {any} [dataType] - Optional type to cast the binary file to once loaded. For example, `Uint8Array`. - */ -var BinaryFile = new Class({ + else if (orientation === CONST.HEXAGONAL) + { + var staggerAxis = this.layer.staggerAxis; + var staggerIndex = this.layer.staggerIndex; + var len = this.layer.hexSideLength; + var rowWidth; + var rowHeight; - Extends: File, + if (staggerAxis === 'y') + { + rowHeight = ((this.baseHeight - len) / 2 + len); - initialize: + if (staggerIndex === 'odd') + { + this.pixelX = this.x * this.baseWidth + this.y % 2 * (this.baseWidth / 2); + } + else + { + this.pixelX = this.x * this.baseWidth - this.y % 2 * (this.baseWidth / 2); + } - function BinaryFile (loader, key, url, xhrSettings, dataType) - { - var extension = 'bin'; + this.pixelY = this.y * rowHeight; + } + else if (staggerAxis === 'x') + { + rowWidth = ((this.baseWidth - len) / 2 + len); - if (IsPlainObject(key)) - { - var config = key; + this.pixelX = this.x * rowWidth; - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - dataType = GetFastValue(config, 'dataType', dataType); + if (staggerIndex === 'odd') + { + this.pixelY = this.y * this.baseHeight + this.x % 2 * (this.baseHeight / 2); + } + else + { + this.pixelY = this.y * this.baseHeight - this.x % 2 * (this.baseHeight / 2); + } + } } - var fileConfig = { - type: 'binary', - cache: loader.cacheManager.binary, - extension: extension, - responseType: 'arraybuffer', - key: key, - url: url, - xhrSettings: xhrSettings, - config: { dataType: dataType } - }; + this.right = this.pixelX + this.baseWidth; + this.bottom = this.pixelY + this.baseHeight; - File.call(this, loader, fileConfig); + return this; }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * Clean up memory. * - * @method Phaser.Loader.FileTypes.BinaryFile#onProcess - * @since 3.7.0 + * @method Phaser.Tilemaps.Tile#destroy + * @since 3.0.0 */ - onProcess: function () + destroy: function () { - this.state = CONST.FILE_PROCESSING; - - var ctor = this.config.dataType; - - this.data = (ctor) ? new ctor(this.xhrLoader.response) : this.xhrLoader.response; - - this.onProcessComplete(); - } + this.collisionCallback = undefined; + this.collisionCallbackContext = undefined; + this.properties = undefined; + }, -}); + /** + * True if this tile can collide on any of its faces or has a collision callback set. + * + * @name Phaser.Tilemaps.Tile#canCollide + * @type {boolean} + * @readonly + * @since 3.0.0 + */ + canCollide: { -/** - * Adds a Binary file, or array of Binary files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.binary('doom', 'files/Doom.wad'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Binary Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Binary Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Binary Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.binary({ - * key: 'doom', - * url: 'files/Doom.wad', - * dataType: Uint8Array - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.BinaryFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.binary('doom', 'files/Doom.wad'); - * // and later in your game ... - * var data = this.cache.binary.get('doom'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Data` the final key will be `LEVEL1.Data` and - * this is what you would use to retrieve the text from the Binary Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "doom" - * and no URL is given then the Loader will set the URL to be "doom.bin". It will always add `.bin` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Binary File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#binary - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.BinaryFileConfig|Phaser.Types.Loader.FileTypes.BinaryFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.bin`, i.e. if `key` was "alien" then the URL will be "alien.bin". - * @param {any} [dataType] - Optional type to cast the binary file to once loaded. For example, `Uint8Array`. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('binary', function (key, url, dataType, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) + get: function () { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new BinaryFile(this, key[i])); + return (this.collideLeft || this.collideRight || this.collideUp || this.collideDown || (this.collisionCallback !== undefined)); } - } - else - { - this.addFile(new BinaryFile(this, key, url, xhrSettings, dataType)); - } - - return this; -}); - -module.exports = BinaryFile; - - -/***/ }), -/* 1346 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(71); -var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(49); -var ParseXMLBitmapFont = __webpack_require__(212); -var XMLFile = __webpack_require__(241); - -/** - * @classdesc - * A single Bitmap Font based File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#bitmapFont method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#bitmapFont. - * - * @class BitmapFontFile - * @extends Phaser.Loader.MultiFile - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.BitmapFontFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string|string[]} [textureURL] - The absolute or relative URL to load the font image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {string} [fontDataURL] - The absolute or relative URL to load the font xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the font image file. Used in replacement of the Loaders default XHR Settings. - * @param {Phaser.Types.Loader.XHRSettingsObject} [fontDataXhrSettings] - An XHR Settings configuration object for the font data xml file. Used in replacement of the Loaders default XHR Settings. - */ -var BitmapFontFile = new Class({ - - Extends: MultiFile, - - initialize: + }, - function BitmapFontFile (loader, key, textureURL, fontDataURL, textureXhrSettings, fontDataXhrSettings) - { - var image; - var data; + /** + * True if this tile can collide on any of its faces. + * + * @name Phaser.Tilemaps.Tile#collides + * @type {boolean} + * @readonly + * @since 3.0.0 + */ + collides: { - if (IsPlainObject(key)) + get: function () { - var config = key; + return (this.collideLeft || this.collideRight || this.collideUp || this.collideDown); + } - key = GetFastValue(config, 'key'); + }, - image = new ImageFile(loader, { - key: key, - url: GetFastValue(config, 'textureURL'), - extension: GetFastValue(config, 'textureExtension', 'png'), - normalMap: GetFastValue(config, 'normalMap'), - xhrSettings: GetFastValue(config, 'textureXhrSettings') - }); + /** + * True if this tile has any interesting faces. + * + * @name Phaser.Tilemaps.Tile#hasInterestingFace + * @type {boolean} + * @readonly + * @since 3.0.0 + */ + hasInterestingFace: { - data = new XMLFile(loader, { - key: key, - url: GetFastValue(config, 'fontDataURL'), - extension: GetFastValue(config, 'fontDataExtension', 'xml'), - xhrSettings: GetFastValue(config, 'fontDataXhrSettings') - }); - } - else + get: function () { - image = new ImageFile(loader, key, textureURL, textureXhrSettings); - data = new XMLFile(loader, key, fontDataURL, fontDataXhrSettings); + return (this.faceTop || this.faceBottom || this.faceLeft || this.faceRight); } - if (image.linkFile) - { - // Image has a normal map - MultiFile.call(this, loader, 'bitmapfont', key, [ image, data, image.linkFile ]); - } - else - { - MultiFile.call(this, loader, 'bitmapfont', key, [ image, data ]); - } }, /** - * Adds this file to its target cache upon successful loading and processing. + * The tileset that contains this Tile. This is null if accessed from a LayerData instance + * before the tile is placed in a TilemapLayer, or if the tile has an index that doesn't correspond + * to any of the maps tilesets. * - * @method Phaser.Loader.FileTypes.BitmapFontFile#addToCache - * @since 3.7.0 + * @name Phaser.Tilemaps.Tile#tileset + * @type {?Phaser.Tilemaps.Tileset} + * @readonly + * @since 3.0.0 */ - addToCache: function () - { - if (this.isReadyToProcess()) - { - var image = this.files[0]; - var xml = this.files[1]; - - image.addToCache(); - xml.pendingDestroy(); + tileset: { - var texture = image.cache.get(image.key); + get: function () + { + var tilemapLayer = this.layer.tilemapLayer; - var data = ParseXMLBitmapFont(xml.data, image.cache.getFrame(image.key), 0, 0, texture); + if (tilemapLayer) + { + var tileset = tilemapLayer.gidMap[this.index]; - this.loader.cacheManager.bitmapFont.add(image.key, { data: data, texture: image.key, frame: null }); + if (tileset) + { + return tileset; + } + } - this.complete = true; + return null; } - } -}); + }, -/** - * Adds an XML based Bitmap Font, or array of fonts, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: + /** + * The tilemap layer that contains this Tile. This will only return null if accessed from a + * LayerData instance before the tile is placed within a TilemapLayer. + * + * @name Phaser.Tilemaps.Tile#tilemapLayer + * @type {?Phaser.Tilemaps.TilemapLayer} + * @readonly + * @since 3.0.0 + */ + tilemapLayer: { - * ```javascript - * function preload () - * { - * this.load.bitmapFont('goldenFont', 'images/GoldFont.png', 'images/GoldFont.xml'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring - * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. - * - * Phaser expects the font data to be provided in an XML file format. - * These files are created by software such as the [Angelcode Bitmap Font Generator](http://www.angelcode.com/products/bmfont/), - * [Littera](http://kvazars.com/littera/) or [Glyph Designer](https://71squared.com/glyphdesigner) - * - * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. - * - * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Texture Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.bitmapFont({ - * key: 'goldenFont', - * textureURL: 'images/GoldFont.png', - * fontDataURL: 'images/GoldFont.xml' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.BitmapFontFileConfig` for more details. - * - * Once the atlas has finished loading you can use key of it when creating a Bitmap Text Game Object: - * - * ```javascript - * this.load.bitmapFont('goldenFont', 'images/GoldFont.png', 'images/GoldFont.xml'); - * // and later in your game ... - * this.add.bitmapText(x, y, 'goldenFont', 'Hello World'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and - * this is what you would use when creating a Bitmap Text object. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, - * then you can specify it by providing an array as the `url` where the second element is the normal map: - * - * ```javascript - * this.load.bitmapFont('goldenFont', [ 'images/GoldFont.png', 'images/GoldFont-n.png' ], 'images/GoldFont.xml'); - * ``` - * - * Or, if you are using a config object use the `normalMap` property: - * - * ```javascript - * this.load.bitmapFont({ - * key: 'goldenFont', - * textureURL: 'images/GoldFont.png', - * normalMap: 'images/GoldFont-n.png', - * fontDataURL: 'images/GoldFont.xml' - * }); - * ``` - * - * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. - * Normal maps are a WebGL only feature. - * - * Note: The ability to load this type of file will only be available if the Bitmap Font File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#bitmapFont - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.BitmapFontFileConfig|Phaser.Types.Loader.FileTypes.BitmapFontFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string|string[]} [textureURL] - The absolute or relative URL to load the font image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {string} [fontDataURL] - The absolute or relative URL to load the font xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml". - * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the font image file. Used in replacement of the Loaders default XHR Settings. - * @param {Phaser.Types.Loader.XHRSettingsObject} [fontDataXhrSettings] - An XHR Settings configuration object for the font data xml file. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('bitmapFont', function (key, textureURL, fontDataURL, textureXhrSettings, fontDataXhrSettings) -{ - var multifile; + get: function () + { + return this.layer.tilemapLayer; + } - // Supports an Object file definition in the key argument - // Or an array of objects in the key argument - // Or a single entry where all arguments have been defined + }, - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) + /** + * The tilemap that contains this Tile. This will only return null if accessed from a LayerData + * instance before the tile is placed within a TilemapLayer. + * + * @name Phaser.Tilemaps.Tile#tilemap + * @type {?Phaser.Tilemaps.Tilemap} + * @readonly + * @since 3.0.0 + */ + tilemap: { + + get: function () { - multifile = new BitmapFontFile(this, key[i]); + var tilemapLayer = this.tilemapLayer; - this.addFile(multifile.files); + return tilemapLayer ? tilemapLayer.tilemap : null; } - } - else - { - multifile = new BitmapFontFile(this, key, textureURL, fontDataURL, textureXhrSettings, fontDataXhrSettings); - this.addFile(multifile.files); } - return this; }); -module.exports = BitmapFontFile; +module.exports = Tile; /***/ }), -/* 1347 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 89797: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); +var BuildTilesetIndex = __webpack_require__(14556); +var Class = __webpack_require__(56694); +var DegToRad = __webpack_require__(75606); +var Formats = __webpack_require__(93560); +var GetFastValue = __webpack_require__(72632); +var LayerData = __webpack_require__(94990); +var ObjectHelper = __webpack_require__(46422); +var ORIENTATION = __webpack_require__(12920); +var Rotate = __webpack_require__(52257); +var SpliceOne = __webpack_require__(72677); +var Sprite = __webpack_require__(13747); +var Tile = __webpack_require__(29633); +var TilemapComponents = __webpack_require__(5047); +var TilemapLayer = __webpack_require__(87177); +var Tileset = __webpack_require__(47975); /** - * @classdesc - * A single CSS File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#css method and are not typically created directly. + * A predicate, to test each element of the array. * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#css. + * @callback TilemapFilterCallback * - * @class CSSFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.17.0 + * @param {Phaser.GameObjects.GameObject} value - An object found in the filtered area. + * @param {number} index - The index of the object within the array. + * @param {Phaser.GameObjects.GameObject[]} array - An array of all the objects found. * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.CSSFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @return {boolean} A value that coerces to `true` to keep the element, or to `false` otherwise. */ -var CSSFile = new Class({ - - Extends: File, - - initialize: - - function CSSFile (loader, key, url, xhrSettings) - { - var extension = 'css'; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - } - - var fileConfig = { - type: 'script', - cache: false, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings - }; - - File.call(this, loader, fileConfig); - }, - - /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. - * - * @method Phaser.Loader.FileTypes.CSSFile#onProcess - * @since 3.17.0 - */ - onProcess: function () - { - this.state = CONST.FILE_PROCESSING; - - this.data = document.createElement('style'); - this.data.defer = false; - this.data.innerHTML = this.xhrLoader.responseText; - - document.head.appendChild(this.data); - - this.onProcessComplete(); - } - -}); /** - * Adds a CSS file, or array of CSS files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.css('headers', 'styles/headers.css'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String and not already in-use by another file in the Loader. - * - * Instead of passing arguments you can pass a configuration object, such as: + * @callback TilemapFindCallback * - * ```javascript - * this.load.css({ - * key: 'headers', - * url: 'styles/headers.css' - * }); - * ``` + * @param {Phaser.GameObjects.GameObject} value - An object found. + * @param {number} index - The index of the object within the array. + * @param {Phaser.GameObjects.GameObject[]} array - An array of all the objects found. * - * See the documentation for `Phaser.Types.Loader.FileTypes.CSSFileConfig` for more details. + * @return {boolean} `true` if the callback should be invoked, otherwise `false`. + */ + +/** + * @classdesc + * A Tilemap is a container for Tilemap data. This isn't a display object, rather, it holds data + * about the map and allows you to add tilesets and tilemap layers to it. A map can have one or + * more tilemap layers, which are the display objects that actually render the tiles. * - * Once the file has finished loading it will automatically be converted into a style DOM element - * via `document.createElement('style')`. It will have its `defer` property set to false and then the - * resulting element will be appended to `document.head`. The CSS styles are then applied to the current document. + * The Tilemap data can be parsed from a Tiled JSON file, a CSV file or a 2D array. Tiled is a free + * software package specifically for creating tile maps, and is available from: + * http://www.mapeditor.org * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. + * As of Phaser 3.50.0 the Tilemap API now supports the following types of map: * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.css". It will always add `.css` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. + * 1) Orthogonal + * 2) Isometric + * 3) Hexagonal + * 4) Staggered * - * Note: The ability to load this type of file will only be available if the CSS File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. + * Prior to this release, only orthogonal maps were supported. * - * @method Phaser.Loader.LoaderPlugin#css - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.17.0 + * Another large change in 3.50 was the consolidation of Tilemap Layers. Previously, you created + * either a Static or Dynamic Tilemap Layer. However, as of 3.50 the features of both have been + * merged and the API simplified, so now there is just the single `TilemapLayer` class. * - * @param {(string|Phaser.Types.Loader.FileTypes.CSSFileConfig|Phaser.Types.Loader.FileTypes.CSSFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.css`, i.e. if `key` was "alien" then the URL will be "alien.css". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * A Tilemap has handy methods for getting and manipulating the tiles within a layer, allowing + * you to build or modify the tilemap data at runtime. * - * @return {this} The Loader instance. - */ -FileTypesManager.register('css', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new CSSFile(this, key[i])); - } - } - else - { - this.addFile(new CSSFile(this, key, url, xhrSettings)); - } - - return this; -}); - -module.exports = CSSFile; - - -/***/ }), -/* 1348 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); -var Shader = __webpack_require__(396); - -/** - * @classdesc - * A single GLSL File suitable for loading by the Loader. + * Note that all Tilemaps use a base tile size to calculate dimensions from, but that a + * TilemapLayer may have its own unique tile size that overrides this. * - * These are created when you use the Phaser.Loader.LoaderPlugin#glsl method and are not typically created directly. + * As of Phaser 3.21.0, if your tilemap includes layer groups (a feature of Tiled 1.2.0+) these + * will be traversed and the following properties will impact children: * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#glsl. + * - Opacity (blended with parent) and visibility (parent overrides child) + * - Vertical and horizontal offset * - * @class GLSLFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes + * The grouping hierarchy is not preserved and all layers will be flattened into a single array. + * + * Group layers are parsed during Tilemap construction but are discarded after parsing so dynamic + * layers will NOT continue to be affected by a parent. + * + * To avoid duplicate layer names, a layer that is a child of a group layer will have its parent + * group name prepended with a '/'. For example, consider a group called 'ParentGroup' with a + * child called 'Layer 1'. In the Tilemap object, 'Layer 1' will have the name + * 'ParentGroup/Layer 1'. + * + * The Phaser Tiled Parser does **not** support the 'Collection of Images' feature for a Tileset. + * You must ensure all of your tiles are contained in a single tileset image file (per layer) + * and have this 'embedded' in the exported Tiled JSON map data. + * + * @class Tilemap + * @memberof Phaser.Tilemaps * @constructor * @since 3.0.0 * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.GLSLFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {string} [shaderType='fragment'] - The type of shader. Either `fragment` for a fragment shader, or `vertex` for a vertex shader. This is ignored if you load a shader bundle. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Scene} scene - The Scene to which this Tilemap belongs. + * @param {Phaser.Tilemaps.MapData} mapData - A MapData instance containing Tilemap data. */ -var GLSLFile = new Class({ - - Extends: File, +var Tilemap = new Class({ initialize: - function GLSLFile (loader, key, url, shaderType, xhrSettings) + function Tilemap (scene, mapData) { - var extension = 'glsl'; + /** + * @name Phaser.Tilemaps.Tilemap#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; - if (IsPlainObject(key)) - { - var config = key; + /** + * The base width of a tile in pixels. Note that individual layers may have a different tile + * width. + * + * @name Phaser.Tilemaps.Tilemap#tileWidth + * @type {number} + * @since 3.0.0 + */ + this.tileWidth = mapData.tileWidth; - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - shaderType = GetFastValue(config, 'shaderType', 'fragment'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - } - else if (shaderType === undefined) - { - shaderType = 'fragment'; - } + /** + * The base height of a tile in pixels. Note that individual layers may have a different + * tile height. + * + * @name Phaser.Tilemaps.Tilemap#tileHeight + * @type {number} + * @since 3.0.0 + */ + this.tileHeight = mapData.tileHeight; - var fileConfig = { - type: 'glsl', - cache: loader.cacheManager.shader, - extension: extension, - responseType: 'text', - key: key, - url: url, - config: { - shaderType: shaderType - }, - xhrSettings: xhrSettings - }; + /** + * The width of the map (in tiles). + * + * @name Phaser.Tilemaps.Tilemap#width + * @type {number} + * @since 3.0.0 + */ + this.width = mapData.width; - File.call(this, loader, fileConfig); - }, + /** + * The height of the map (in tiles). + * + * @name Phaser.Tilemaps.Tilemap#height + * @type {number} + * @since 3.0.0 + */ + this.height = mapData.height; - /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. - * - * @method Phaser.Loader.FileTypes.GLSLFile#onProcess - * @since 3.7.0 - */ - onProcess: function () - { - this.state = CONST.FILE_PROCESSING; + /** + * The orientation of the map data (as specified in Tiled), usually 'orthogonal'. + * + * @name Phaser.Tilemaps.Tilemap#orientation + * @type {string} + * @since 3.0.0 + */ + this.orientation = mapData.orientation; - this.data = this.xhrLoader.responseText; + /** + * The render (draw) order of the map data (as specified in Tiled), usually 'right-down'. + * + * The draw orders are: + * + * right-down + * left-down + * right-up + * left-up + * + * This can be changed via the `setRenderOrder` method. + * + * @name Phaser.Tilemaps.Tilemap#renderOrder + * @type {string} + * @since 3.12.0 + */ + this.renderOrder = mapData.renderOrder; - this.onProcessComplete(); - }, + /** + * The format of the map data. + * + * @name Phaser.Tilemaps.Tilemap#format + * @type {number} + * @since 3.0.0 + */ + this.format = mapData.format; - /** - * Adds this file to its target cache upon successful loading and processing. - * - * @method Phaser.Loader.FileTypes.GLSLFile#addToCache - * @since 3.17.0 - */ - addToCache: function () - { - var data = this.data.split('\n'); + /** + * The version of the map data (as specified in Tiled, usually 1). + * + * @name Phaser.Tilemaps.Tilemap#version + * @type {number} + * @since 3.0.0 + */ + this.version = mapData.version; - // Check to see if this is a shader bundle, or raw glsl file. - var block = this.extractBlock(data, 0); + /** + * Map specific properties as specified in Tiled. + * + * @name Phaser.Tilemaps.Tilemap#properties + * @type {object} + * @since 3.0.0 + */ + this.properties = mapData.properties; - if (block) - { - while (block) - { - var key = this.getShaderName(block.header); - var shaderType = this.getShaderType(block.header); - var uniforms = this.getShaderUniforms(block.header); - var shaderSrc = block.shader; + /** + * The width of the map in pixels based on width * tileWidth. + * + * @name Phaser.Tilemaps.Tilemap#widthInPixels + * @type {number} + * @since 3.0.0 + */ + this.widthInPixels = mapData.widthInPixels; - if (this.cache.has(key)) - { - var shader = this.cache.get(key); + /** + * The height of the map in pixels based on height * tileHeight. + * + * @name Phaser.Tilemaps.Tilemap#heightInPixels + * @type {number} + * @since 3.0.0 + */ + this.heightInPixels = mapData.heightInPixels; - if (shaderType === 'fragment') - { - shader.fragmentSrc = shaderSrc; - } - else - { - shader.vertexSrc = shaderSrc; - } + /** + * A collection of Images, as parsed from Tiled map data. + * + * @name Phaser.Tilemaps.Tilemap#imageCollections + * @type {Phaser.Tilemaps.ImageCollection[]} + * @since 3.0.0 + */ + this.imageCollections = mapData.imageCollections; - if (!shader.uniforms) - { - shader.uniforms = uniforms; - } - } - else if (shaderType === 'fragment') - { - this.cache.add(key, new Shader(key, shaderSrc, '', uniforms)); - } - else - { - this.cache.add(key, new Shader(key, '', shaderSrc, uniforms)); - } + /** + * An array of Tiled Image Layers. + * + * @name Phaser.Tilemaps.Tilemap#images + * @type {array} + * @since 3.0.0 + */ + this.images = mapData.images; - block = this.extractBlock(data, block.offset); - } - } - else if (this.config.shaderType === 'fragment') - { - // Single shader - this.cache.add(this.key, new Shader(this.key, this.data)); - } - else - { - this.cache.add(this.key, new Shader(this.key, '', this.data)); - } + /** + * An array of Tilemap layer data. + * + * @name Phaser.Tilemaps.Tilemap#layers + * @type {Phaser.Tilemaps.LayerData[]} + * @since 3.0.0 + */ + this.layers = mapData.layers; + + /** + * Master list of tiles -> x, y, index in tileset. + * + * @name Phaser.Tilemaps.Tilemap#tiles + * @type {array} + * @since 3.60.0 + * @see Phaser.Tilemaps.Parsers.Tiled.BuildTilesetIndex + */ + this.tiles = mapData.tiles; + + /** + * An array of Tilesets used in the map. + * + * @name Phaser.Tilemaps.Tilemap#tilesets + * @type {Phaser.Tilemaps.Tileset[]} + * @since 3.0.0 + */ + this.tilesets = mapData.tilesets; + + /** + * An array of ObjectLayer instances parsed from Tiled object layers. + * + * @name Phaser.Tilemaps.Tilemap#objects + * @type {Phaser.Tilemaps.ObjectLayer[]} + * @since 3.0.0 + */ + this.objects = mapData.objects; + + /** + * The index of the currently selected LayerData object. + * + * @name Phaser.Tilemaps.Tilemap#currentLayerIndex + * @type {number} + * @since 3.0.0 + */ + this.currentLayerIndex = 0; + + /** + * The length of the horizontal sides of the hexagon. + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.Tilemap#hexSideLength + * @type {number} + * @since 3.50.0 + */ + this.hexSideLength = mapData.hexSideLength; + + var orientation = this.orientation; - this.pendingDestroy(); + /** + * Functions used to handle world to tile, and tile to world, conversion. + * Cached here for internal use by public methods such as `worldToTileXY`, etc. + * + * @name Phaser.Tilemaps.Tilemap#_convert + * @private + * @type {object} + * @since 3.50.0 + */ + this._convert = { + WorldToTileXY: TilemapComponents.GetWorldToTileXYFunction(orientation), + WorldToTileX: TilemapComponents.GetWorldToTileXFunction(orientation), + WorldToTileY: TilemapComponents.GetWorldToTileYFunction(orientation), + TileToWorldXY: TilemapComponents.GetTileToWorldXYFunction(orientation), + TileToWorldX: TilemapComponents.GetTileToWorldXFunction(orientation), + TileToWorldY: TilemapComponents.GetTileToWorldYFunction(orientation), + GetTileCorners: TilemapComponents.GetTileCornersFunction(orientation) + }; }, /** - * Returns the name of the shader from the header block. + * Sets the rendering (draw) order of the tiles in this map. * - * @method Phaser.Loader.FileTypes.GLSLFile#getShaderName - * @since 3.17.0 + * The default is 'right-down', meaning it will order the tiles starting from the top-left, + * drawing to the right and then moving down to the next row. * - * @param {string[]} headerSource - The header data. + * The draw orders are: * - * @return {string} The shader name. + * 0 = right-down + * 1 = left-down + * 2 = right-up + * 3 = left-up + * + * Setting the render order does not change the tiles or how they are stored in the layer, + * it purely impacts the order in which they are rendered. + * + * You can provide either an integer (0 to 3), or the string version of the order. + * + * Calling this method _after_ creating Tilemap Layers will **not** automatically + * update them to use the new render order. If you call this method after creating layers, use their + * own `setRenderOrder` methods to change them as needed. + * + * @method Phaser.Tilemaps.Tilemap#setRenderOrder + * @since 3.12.0 + * + * @param {(number|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. + * + * @return {this} This Tilemap object. */ - getShaderName: function (headerSource) + setRenderOrder: function (renderOrder) { - for (var i = 0; i < headerSource.length; i++) + var orders = [ 'right-down', 'left-down', 'right-up', 'left-up' ]; + + if (typeof renderOrder === 'number') { - var line = headerSource[i].trim(); + renderOrder = orders[renderOrder]; + } - if (line.substring(0, 5) === 'name:') - { - return line.substring(5).trim(); - } + if (orders.indexOf(renderOrder) > -1) + { + this.renderOrder = renderOrder; } - return this.key; + return this; }, /** - * Returns the type of the shader from the header block. + * Adds an image to the map to be used as a tileset. A single map may use multiple tilesets. + * Note that the tileset name can be found in the JSON file exported from Tiled, or in the Tiled + * editor. * - * @method Phaser.Loader.FileTypes.GLSLFile#getShaderType - * @since 3.17.0 + * @method Phaser.Tilemaps.Tilemap#addTilesetImage + * @since 3.0.0 * - * @param {string[]} headerSource - The header data. + * @param {string} tilesetName - The name of the tileset as specified in the map data. + * @param {string} [key] - The key of the Phaser.Cache image used for this tileset. If + * `undefined` or `null` it will look for an image with a key matching the tilesetName parameter. + * @param {number} [tileWidth] - The width of the tile (in pixels) in the Tileset Image. If not + * given it will default to the map's tileWidth value, or the tileWidth specified in the Tiled + * JSON file. + * @param {number} [tileHeight] - The height of the tiles (in pixels) in the Tileset Image. If + * not given it will default to the map's tileHeight value, or the tileHeight specified in the + * Tiled JSON file. + * @param {number} [tileMargin] - The margin around the tiles in the sheet (in pixels). If not + * specified, it will default to 0 or the value specified in the Tiled JSON file. + * @param {number} [tileSpacing] - The spacing between each the tile in the sheet (in pixels). + * If not specified, it will default to 0 or the value specified in the Tiled JSON file. + * @param {number} [gid=0] - If adding multiple tilesets to a blank map, specify the starting + * GID this set will use here. + * @param {object} [tileOffset={x: 0, y: 0}] - Tile texture drawing offset. + * If not specified, it will default to {0, 0} * - * @return {string} The shader type. Either 'fragment' or 'vertex'. + * @return {?Phaser.Tilemaps.Tileset} Returns the Tileset object that was created or updated, or null if it + * failed. */ - getShaderType: function (headerSource) + addTilesetImage: function (tilesetName, key, tileWidth, tileHeight, tileMargin, tileSpacing, gid, tileOffset) { - for (var i = 0; i < headerSource.length; i++) - { - var line = headerSource[i].trim(); + if (tilesetName === undefined) { return null; } + if (key === undefined || key === null) { key = tilesetName; } - if (line.substring(0, 5) === 'type:') - { - return line.substring(5).trim(); - } + if (!this.scene.sys.textures.exists(key)) + { + console.warn('Invalid Tileset Image: ' + key); + return null; } - return this.config.shaderType; - }, + var texture = this.scene.sys.textures.get(key); - /** - * Returns the shader uniforms from the header block. - * - * @method Phaser.Loader.FileTypes.GLSLFile#getShaderUniforms - * @since 3.17.0 - * - * @param {string[]} headerSource - The header data. - * - * @return {any} The shader uniforms object. - */ - getShaderUniforms: function (headerSource) - { - var uniforms = {}; + var index = this.getTilesetIndex(tilesetName); - for (var i = 0; i < headerSource.length; i++) + if (index === null && this.format === Formats.TILED_JSON) { - var line = headerSource[i].trim(); + console.warn('No data found for Tileset: ' + tilesetName); + return null; + } - if (line.substring(0, 8) === 'uniform.') - { - var pos = line.indexOf(':'); + var tileset = this.tilesets[index]; - if (pos) - { - var key = line.substring(8, pos); + if (tileset) + { + tileset.setTileSize(tileWidth, tileHeight); + tileset.setSpacing(tileMargin, tileSpacing); + tileset.setImage(texture); - try - { - uniforms[key] = JSON.parse(line.substring(pos + 1)); - } - catch (e) - { - console.warn('Invalid uniform JSON: ' + key); - } - } - } + return tileset; } - return uniforms; + if (tileWidth === undefined) { tileWidth = this.tileWidth; } + if (tileHeight === undefined) { tileHeight = this.tileHeight; } + if (tileMargin === undefined) { tileMargin = 0; } + if (tileSpacing === undefined) { tileSpacing = 0; } + if (gid === undefined) { gid = 0; } + if (tileOffset === undefined) { tileOffset = { x: 0, y: 0 }; } + + tileset = new Tileset(tilesetName, gid, tileWidth, tileHeight, tileMargin, tileSpacing, undefined, undefined, tileOffset); + + tileset.setImage(texture); + + this.tilesets.push(tileset); + + this.tiles = BuildTilesetIndex(this); + + return tileset; }, /** - * Processes the shader file and extracts the relevant data. + * Copies the tiles in the source rectangular area to a new destination (all specified in tile + * coordinates) within the layer. This copies all tile properties & recalculates collision + * information in the destination region. * - * @method Phaser.Loader.FileTypes.GLSLFile#extractBlock - * @private - * @since 3.17.0 + * If no layer specified, the map's current layer is used. This cannot be applied to StaticTilemapLayers. * - * @param {string[]} data - The array of shader data to process. - * @param {number} offset - The offset to start processing from. + * @method Phaser.Tilemaps.Tilemap#copy + * @since 3.0.0 * - * @return {any} The processed shader block, or null. + * @param {number} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. + * @param {number} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. + * @param {number} width - The width of the area to copy, in tiles, not pixels. + * @param {number} height - The height of the area to copy, in tiles, not pixels. + * @param {number} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. + * @param {number} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. + * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ - extractBlock: function (data, offset) + copy: function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, layer) { - var headerStart = -1; - var headerEnd = -1; - var blockEnd = -1; - var headerOpen = false; - var captureSource = false; - var headerSource = []; - var shaderSource = []; + layer = this.getLayer(layer); - for (var i = offset; i < data.length; i++) + if (layer !== null) { - var line = data[i].trim(); - - if (line === '---') - { - if (headerStart === -1) - { - headerStart = i; - headerOpen = true; - } - else if (headerOpen) - { - headerEnd = i; - headerOpen = false; - captureSource = true; - } - else - { - // We've hit another --- delimiter, break out - captureSource = false; - break; - } - } - else if (headerOpen) - { - headerSource.push(line); - } - else if (captureSource) - { - shaderSource.push(line); - blockEnd = i; - } - } + TilemapComponents.Copy( + srcTileX, srcTileY, + width, height, + destTileX, destTileY, + recalculateFaces, layer + ); - if (!headerOpen && headerEnd !== -1) - { - return { header: headerSource, shader: shaderSource.join('\n'), offset: blockEnd }; + return this; } else { return null; } - } - -}); + }, -/** - * Adds a GLSL file, or array of GLSL files, to the current load queue. - * In Phaser 3 GLSL files are just plain Text files at the current moment in time. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.glsl('plasma', 'shaders/Plasma.glsl'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Shader Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Shader Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Shader Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.glsl({ - * key: 'plasma', - * shaderType: 'fragment', - * url: 'shaders/Plasma.glsl' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.GLSLFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.glsl('plasma', 'shaders/Plasma.glsl'); - * // and later in your game ... - * var data = this.cache.shader.get('plasma'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `FX.` and the key was `Plasma` the final key will be `FX.Plasma` and - * this is what you would use to retrieve the text from the Shader Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "plasma" - * and no URL is given then the Loader will set the URL to be "plasma.glsl". It will always add `.glsl` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the GLSL File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#glsl - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.GLSLFileConfig|Phaser.Types.Loader.FileTypes.GLSLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.glsl`, i.e. if `key` was "alien" then the URL will be "alien.glsl". - * @param {string} [shaderType='fragment'] - The type of shader. Either `fragment` for a fragment shader, or `vertex` for a vertex shader. This is ignored if you load a shader bundle. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('glsl', function (key, url, shaderType, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new GLSLFile(this, key[i])); - } - } - else + /** + * Creates a new and empty Tilemap Layer. The currently selected layer in the map is set to this new layer. + * + * Prior to v3.50.0 this method was called `createBlankDynamicLayer`. + * + * @method Phaser.Tilemaps.Tilemap#createBlankLayer + * @since 3.0.0 + * + * @param {string} name - The name of this layer. Must be unique within the map. + * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. + * @param {number} [x=0] - The world x position where the top left of this layer will be placed. + * @param {number} [y=0] - The world y position where the top left of this layer will be placed. + * @param {number} [width] - The width of the layer in tiles. If not specified, it will default to the map's width. + * @param {number} [height] - The height of the layer in tiles. If not specified, it will default to the map's height. + * @param {number} [tileWidth] - The width of the tiles the layer uses for calculations. If not specified, it will default to the map's tileWidth. + * @param {number} [tileHeight] - The height of the tiles the layer uses for calculations. If not specified, it will default to the map's tileHeight. + * + * @return {?Phaser.Tilemaps.TilemapLayer} Returns the new layer that was created, or `null` if it failed. + */ + createBlankLayer: function (name, tileset, x, y, width, height, tileWidth, tileHeight) { - this.addFile(new GLSLFile(this, key, url, shaderType, xhrSettings)); - } - - return this; -}); + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = this.width; } + if (height === undefined) { height = this.height; } + if (tileWidth === undefined) { tileWidth = this.tileWidth; } + if (tileHeight === undefined) { tileHeight = this.tileHeight; } -module.exports = GLSLFile; + var index = this.getLayerIndex(name); + if (index !== null) + { + console.warn('Invalid Tilemap Layer ID: ' + name); + return null; + } -/***/ }), -/* 1349 */ -/***/ (function(module, exports, __webpack_require__) { + var layerData = new LayerData({ + name: name, + tileWidth: tileWidth, + tileHeight: tileHeight, + width: width, + height: height, + orientation: this.orientation + }); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var row; -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); + for (var tileY = 0; tileY < height; tileY++) + { + row = []; -/** - * @classdesc - * A single HTML File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#html method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#html. - * - * @class HTMLFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.12.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.HTMLFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.html`, i.e. if `key` was "alien" then the URL will be "alien.html". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var HTMLFile = new Class({ + for (var tileX = 0; tileX < width; tileX++) + { + row.push(new Tile(layerData, -1, tileX, tileY, tileWidth, tileHeight, this.tileWidth, this.tileHeight)); + } - Extends: File, + layerData.data.push(row); + } - initialize: + this.layers.push(layerData); - function HTMLFile (loader, key, url, xhrSettings) - { - var extension = 'html'; + this.currentLayerIndex = this.layers.length - 1; - if (IsPlainObject(key)) - { - var config = key; + var layer = new TilemapLayer(this.scene, this, this.currentLayerIndex, tileset, x, y); - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - } + layer.setRenderOrder(this.renderOrder); - var fileConfig = { - type: 'text', - cache: loader.cacheManager.html, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings - }; + this.scene.sys.displayList.add(layer); - File.call(this, loader, fileConfig); + return layer; }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * Creates a new Tilemap Layer that renders the LayerData associated with the given + * `layerID`. The currently selected layer in the map is set to this new layer. * - * @method Phaser.Loader.FileTypes.HTMLFile#onProcess - * @since 3.7.0 + * The `layerID` is important. If you've created your map in Tiled then you can get this by + * looking in Tiled and looking at the layer name. Or you can open the JSON file it exports and + * look at the layers[].name value. Either way it must match. + * + * Prior to v3.50.0 this method was called `createDynamicLayer`. + * + * @method Phaser.Tilemaps.Tilemap#createLayer + * @since 3.0.0 + * + * @param {(number|string)} layerID - The layer array index value, or if a string is given, the layer name from Tiled. + * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. + * @param {number} [x=0] - The x position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. + * @param {number} [y=0] - The y position to place the layer in the world. If not specified, it will default to the layer offset from Tiled or 0. + * + * @return {?Phaser.Tilemaps.TilemapLayer} Returns the new layer was created, or null if it failed. */ - onProcess: function () + createLayer: function (layerID, tileset, x, y) { - this.state = CONST.FILE_PROCESSING; - - this.data = this.xhrLoader.responseText; - - this.onProcessComplete(); - } - -}); + var index = this.getLayerIndex(layerID); -/** - * Adds an HTML file, or array of HTML files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.html('story', 'files/LoginForm.html'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global HTML Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the HTML Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the HTML Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.html({ - * key: 'login', - * url: 'files/LoginForm.html' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.HTMLFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.html('login', 'files/LoginForm.html'); - * // and later in your game ... - * var data = this.cache.html.get('login'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and - * this is what you would use to retrieve the html from the HTML Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" - * and no URL is given then the Loader will set the URL to be "story.html". It will always add `.html` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the HTML File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#html - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.12.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.HTMLFileConfig|Phaser.Types.Loader.FileTypes.HTMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.html`, i.e. if `key` was "alien" then the URL will be "alien.html". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('html', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) + if (index === null) { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new HTMLFile(this, key[i])); - } - } - else - { - this.addFile(new HTMLFile(this, key, url, xhrSettings)); - } - - return this; -}); - -module.exports = HTMLFile; - - -/***/ }), -/* 1350 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + console.warn('Invalid Tilemap Layer ID: ' + layerID); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); + if (typeof layerID === 'string') + { + console.warn('Valid tilelayer names: %o', this.getTileLayerNames()); + } -/** - * @classdesc - * A single HTML File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#htmlTexture method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#htmlTexture. - * - * @class HTMLTextureFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.12.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {number} [width] - The width of the texture the HTML will be rendered to. - * @param {number} [height] - The height of the texture the HTML will be rendered to. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var HTMLTextureFile = new Class({ + return null; + } - Extends: File, + var layerData = this.layers[index]; - initialize: + // Check for an associated tilemap layer + if (layerData.tilemapLayer) + { + console.warn('Tilemap Layer ID already exists:' + layerID); + return null; + } - function HTMLTextureFile (loader, key, url, width, height, xhrSettings) - { - if (width === undefined) { width = 512; } - if (height === undefined) { height = 512; } + this.currentLayerIndex = index; - var extension = 'html'; + // Default the x/y position to match Tiled layer offset, if it exists. - if (IsPlainObject(key)) + if (x === undefined) { - var config = key; + x = layerData.x; + } - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - width = GetFastValue(config, 'width', width); - height = GetFastValue(config, 'height', height); + if (y === undefined) + { + y = layerData.y; } - var fileConfig = { - type: 'html', - cache: loader.textureManager, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings, - config: { - width: width, - height: height - } - }; + var layer = new TilemapLayer(this.scene, this, index, tileset, x, y); - File.call(this, loader, fileConfig); + layer.setRenderOrder(this.renderOrder); + + this.scene.sys.displayList.add(layer); + + return layer; }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * This method will iterate through all of the objects defined in a Tiled Object Layer and then + * convert the matching results into Phaser Game Objects (by default, Sprites) + * + * Objects are matched on one of 4 criteria: The Object ID, the Object GID, the Object Name, or the Object Type. + * + * Within Tiled, Object IDs are unique per Object. Object GIDs, however, are shared by all objects + * using the same image. Finally, Object Names and Types are strings and the same name can be used on multiple + * Objects in Tiled, they do not have to be unique; Names are specific to Objects while Types can be inherited + * from Object GIDs using the same image. + * + * You set the configuration parameter accordingly, based on which type of criteria you wish + * to match against. For example, to convert all items on an Object Layer with a `gid` of 26: + * + * ```javascript + * createFromObjects(layerName, { + * gid: 26 + * }); + * ``` + * + * Or, to convert objects with the name 'bonus': + * + * ```javascript + * createFromObjects(layerName, { + * name: 'bonus' + * }); + * ``` + * + * Or, to convert an object with a specific id: + * + * ```javascript + * createFromObjects(layerName, { + * id: 9 + * }); + * ``` + * + * You should only specify either `id`, `gid`, `name`, `type`, or none of them. Do not add more than + * one criteria to your config. If you do not specify any criteria, then _all_ objects in the + * Object Layer will be converted. + * + * By default this method will convert Objects into {@link Phaser.GameObjects.Sprite} instances, but you can override + * this by providing your own class type: + * + * ```javascript + * createFromObjects(layerName, { + * gid: 26, + * classType: Coin + * }); + * ``` + * + * This will convert all Objects with a gid of 26 into your custom `Coin` class. You can pass + * any class type here, but it _must_ extend {@link Phaser.GameObjects.GameObject} as its base class. + * Your class will always be passed 1 parameter: `scene`, which is a reference to either the Scene + * specified in the config object or, if not given, the Scene to which this Tilemap belongs. The + * class must have {@link Phaser.GameObjects.Components.Transform#setPosition setPosition} and + * {@link Phaser.GameObjects.Components.Texture#setTexture setTexture} methods. + * + * Custom properties on the Object are copied onto any existing properties on the Game Object, so you can use this as an easy + * way to configure properties from within the map editor. For example giving an Object a + * property of `alpha: 0.5` in Tiled will be reflected in the Game Object that is created. + * + * Custom properties that do not exist on the Game Object are set in the + * Game Object's {@link Phaser.GameObjects.GameObject#data data store}. + * + * When `useTileset` is `true` (the default), Tile Objects will inherit the texture and any tile properties + * from the tileset, and the local tile ID will be used as the texture frame. For the frame selection to work + * you need to load the tileset texture as a spritesheet so its frame names match the local tile IDs. + * + * For instance, a tileset tile + * + * ``` + * { id: 3, type: 'treadmill', speed: 4 } + * ``` + * + * with gid 19 and an object + * + * ``` + * { id: 7, gid: 19, speed: 5, rotation: 90 } + * ``` + * + * will be interpreted as + * + * ``` + * { id: 7, gid: 19, speed: 5, rotation: 90, type: 'treadmill', texture: '[the tileset texture]', frame: 3 } + * ``` + * + * You can suppress this behavior by setting the boolean `ignoreTileset` for each `config` that should ignore + * object gid tilesets. + * + * You can set a `container` property in the config. If given, the new Game Object will be added to + * the Container or Layer instance instead of the Scene. + * + * You can set named texture-`key` and texture-`frame` properties, which will be set on the new Game Object. + * + * Finally, you can provide an array of config objects, to convert multiple types of object in + * a single call: + * + * ```javascript + * createFromObjects(layerName, [ + * { + * gid: 26, + * classType: Coin + * }, + * { + * id: 9, + * classType: BossMonster + * }, + * { + * name: 'lava', + * classType: LavaTile + * }, + * { + * type: 'endzone', + * classType: Phaser.GameObjects.Zone + * } + * ]); + * ``` * - * @method Phaser.Loader.FileTypes.HTMLTextureFile#onProcess - * @since 3.7.0 + * The signature of this method changed significantly in v3.60.0. Prior to this, it did not take config objects. + * + * @method Phaser.Tilemaps.Tilemap#createFromObjects + * @since 3.0.0 + * + * @param {string} objectLayerName - The name of the Tiled object layer to create the Game Objects from. + * @param {Phaser.Types.Tilemaps.CreateFromObjectLayerConfig|Phaser.Types.Tilemaps.CreateFromObjectLayerConfig[]} config - A CreateFromObjects configuration object, or an array of them. + * @param {boolean} [useTileset=true] - True if objects that set gids should also search the underlying tile for properties and data. + * + * @return {Phaser.GameObjects.GameObject[]} An array containing the Game Objects that were created. Empty if invalid object layer, or no matching id/gid/name was found. */ - onProcess: function () + createFromObjects: function (objectLayerName, config, useTileset) { - this.state = CONST.FILE_PROCESSING; - - var w = this.config.width; - var h = this.config.height; - - var data = []; + if (useTileset === undefined) { useTileset = true; } - data.push(''); - data.push(''); - data.push(''); - data.push(this.xhrLoader.responseText); - data.push(''); - data.push(''); - data.push(''); + var results = []; - var svg = [ data.join('\n') ]; - var _this = this; + var objectLayer = this.getObjectLayer(objectLayerName); - try + if (!objectLayer) { - var blob = new window.Blob(svg, { type: 'image/svg+xml;charset=utf-8' }); + console.warn('createFromObjects: Invalid objectLayerName given: ' + objectLayerName); + + return results; } - catch (e) - { - _this.state = CONST.FILE_ERRORED; - _this.onProcessComplete(); + var objectHelper = new ObjectHelper(useTileset ? this.tilesets : undefined); - return; + if (!Array.isArray(config)) + { + config = [ config ]; } - this.data = new Image(); - - this.data.crossOrigin = this.crossOrigin; + var objects = objectLayer.objects; - this.data.onload = function () + for (var c = 0; c < config.length; c++) { - File.revokeObjectURL(_this.data); + var singleConfig = config[c]; - _this.onProcessComplete(); - }; + var id = GetFastValue(singleConfig, 'id', null); + var gid = GetFastValue(singleConfig, 'gid', null); + var name = GetFastValue(singleConfig, 'name', null); + var type = GetFastValue(singleConfig, 'type', null); + objectHelper.enabled = !GetFastValue(singleConfig, 'ignoreTileset', null); - this.data.onerror = function () - { - File.revokeObjectURL(_this.data); + var obj; + var toConvert = []; - _this.onProcessError(); - }; + // Sweep to get all the objects we want to convert in this pass + for (var s = 0; s < objects.length; s++) + { + obj = objects[s]; - File.createObjectURL(this.data, blob, 'image/svg+xml'); - }, + if ( + (id === null && gid === null && name === null && type === null) || + (id !== null && obj.id === id) || + (gid !== null && obj.gid === gid) || + (name !== null && obj.name === name) || + (type !== null && objectHelper.getTypeIncludingTile(obj) === type) + ) + { + toConvert.push(obj); + } + } - /** - * Adds this file to its target cache upon successful loading and processing. - * - * @method Phaser.Loader.FileTypes.HTMLTextureFile#addToCache - * @since 3.7.0 - */ - addToCache: function () - { - var texture = this.cache.addImage(this.key, this.data); + // Now let's convert them ... - this.pendingDestroy(texture); - } + var classType = GetFastValue(singleConfig, 'classType', Sprite); + var scene = GetFastValue(singleConfig, 'scene', this.scene); + var container = GetFastValue(singleConfig, 'container', null); + var texture = GetFastValue(singleConfig, 'key', null); + var frame = GetFastValue(singleConfig, 'frame', null); -}); + for (var i = 0; i < toConvert.length; i++) + { + obj = toConvert[i]; -/** - * Adds an HTML File, or array of HTML Files, to the current load queue. When the files are loaded they - * will be rendered to textures and stored in the Texture Manager. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.htmlTexture('instructions', 'content/intro.html', 256, 512); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Texture Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.htmlTexture({ - * key: 'instructions', - * url: 'content/intro.html', - * width: 256, - * height: 512 - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig` for more details. - * - * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key: - * - * ```javascript - * this.load.htmlTexture('instructions', 'content/intro.html', 256, 512); - * // and later in your game ... - * this.add.image(x, y, 'instructions'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and - * this is what you would use to retrieve the image from the Texture Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.html". It will always add `.html` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * The width and height are the size of the texture to which the HTML will be rendered. It's not possible to determine these - * automatically, so you will need to provide them, either as arguments or in the file config object. - * When the HTML file has loaded a new SVG element is created with a size and viewbox set to the width and height given. - * The SVG file has a body tag added to it, with the HTML file contents included. It then calls `window.Blob` on the SVG, - * and if successful is added to the Texture Manager, otherwise it fails processing. The overall quality of the rendered - * HTML depends on your browser, and some of them may not even support the svg / blob process used. Be aware that there are - * limitations on what HTML can be inside an SVG. You can find out more details in this - * [Mozilla MDN entry](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Drawing_DOM_objects_into_a_canvas). - * - * Note: The ability to load this type of file will only be available if the HTMLTextureFile File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#htmlTexture - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.12.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig|Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.html`, i.e. if `key` was "alien" then the URL will be "alien.html". - * @param {number} [width=512] - The width of the texture the HTML will be rendered to. - * @param {number} [height=512] - The height of the texture the HTML will be rendered to. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('htmlTexture', function (key, url, width, height, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new HTMLTextureFile(this, key[i])); - } - } - else - { - this.addFile(new HTMLTextureFile(this, key, url, width, height, xhrSettings)); - } + var sprite = new classType(scene); - return this; -}); + sprite.setName(obj.name); + sprite.setPosition(obj.x, obj.y); + objectHelper.setTextureAndFrame(sprite, texture, frame, obj); -module.exports = HTMLTextureFile; + if (obj.width) + { + sprite.displayWidth = obj.width; + } + if (obj.height) + { + sprite.displayHeight = obj.height; + } -/***/ }), -/* 1351 */ -/***/ (function(module, exports, __webpack_require__) { + if (this.orientation === ORIENTATION.ISOMETRIC) + { + var isometricRatio = this.tileWidth / this.tileHeight; + var isometricPosition = { + x: sprite.x - sprite.y, + y: (sprite.x + sprite.y) / isometricRatio + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + sprite.x = isometricPosition.x; + sprite.y = isometricPosition.y; + } -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(71); -var IsPlainObject = __webpack_require__(7); -var JSONFile = __webpack_require__(61); -var MultiFile = __webpack_require__(49); + // Origin is (0, 1) for tile objects or (0, 0) for other objects in Tiled, so find the offset that matches the Sprites origin. + // Do not offset objects with zero dimensions (e.g. points). + var offset = { + x: sprite.originX * obj.width, + y: (sprite.originY - (obj.gid ? 1 : 0)) * obj.height + }; -/** - * @classdesc - * A single Multi Texture Atlas File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#multiatlas method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#multiatlas. - * - * @class MultiAtlasFile - * @extends Phaser.Loader.MultiFile - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.7.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.MultiAtlasFileConfig)} key - The key of the file. Must be unique within both the Loader and the Texture Manager. Or a config object. - * @param {string} [atlasURL] - The absolute or relative URL to load the multi atlas json file from. - * @param {string} [path] - Optional path to use when loading the textures defined in the atlas data. - * @param {string} [baseURL] - Optional Base URL to use when loading the textures defined in the atlas data. - * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - Extra XHR Settings specifically for the atlas json file. - * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - Extra XHR Settings specifically for the texture files. - */ -var MultiAtlasFile = new Class({ + // If the object is rotated, then the origin offset also needs to be rotated. + if (obj.rotation) + { + var angle = DegToRad(obj.rotation); - Extends: MultiFile, + Rotate(offset, angle); - initialize: + sprite.rotation = angle; + } - function MultiAtlasFile (loader, key, atlasURL, path, baseURL, atlasXhrSettings, textureXhrSettings) - { - if (IsPlainObject(key)) - { - var config = key; + sprite.x += offset.x; + sprite.y += offset.y; - key = GetFastValue(config, 'key'); + if (obj.flippedHorizontal !== undefined || obj.flippedVertical !== undefined) + { + sprite.setFlip(obj.flippedHorizontal, obj.flippedVertical); + } - if (GetFastValue(config, 'url', false)) - { - atlasURL = GetFastValue(config, 'url'); - } - else - { - atlasURL = GetFastValue(config, 'atlasURL'); - } + if (!obj.visible) + { + sprite.visible = false; + } - atlasXhrSettings = GetFastValue(config, 'xhrSettings'); - path = GetFastValue(config, 'path'); - baseURL = GetFastValue(config, 'baseURL'); - textureXhrSettings = GetFastValue(config, 'textureXhrSettings'); - } + objectHelper.setPropertiesFromTiledObject(sprite, obj); - var data = new JSONFile(loader, key, atlasURL, atlasXhrSettings); + if (container) + { + container.add(sprite); + } + else + { + scene.add.existing(sprite); + } - MultiFile.call(this, loader, 'multiatlas', key, [ data ]); + results.push(sprite); + } + } - this.config.path = path; - this.config.baseURL = baseURL; - this.config.textureXhrSettings = textureXhrSettings; + return results; }, /** - * Called by each File when it finishes loading. + * Creates a Sprite for every object matching the given tile indexes in the layer. You can + * optionally specify if each tile will be replaced with a new tile after the Sprite has been + * created. This is useful if you want to lay down special tiles in a level that are converted to + * Sprites, but want to replace the tile itself with a floor tile or similar once converted. * - * @method Phaser.Loader.FileTypes.MultiAtlasFile#onFileComplete - * @since 3.7.0 + * @method Phaser.Tilemaps.Tilemap#createFromTiles + * @since 3.0.0 * - * @param {Phaser.Loader.File} file - The File that has completed processing. + * @param {(number|array)} indexes - The tile index, or array of indexes, to create Sprites from. + * @param {?(number|array)} replacements - The tile index, or array of indexes, to change a converted + * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a + * one-to-one mapping with the indexes array. + * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. scene.make.sprite). + * @param {Phaser.Scene} [scene] - The Scene to create the Sprites within. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.GameObjects.Sprite[]} Returns an array of Tiles, or null if the layer given was invalid. */ - onFileComplete: function (file) + createFromTiles: function (indexes, replacements, spriteConfig, scene, camera, layer) { - var index = this.files.indexOf(file); + layer = this.getLayer(layer); - if (index !== -1) - { - this.pending--; + if (layer === null) { return null; } - if (file.type === 'json' && file.data.hasOwnProperty('textures')) - { - // Inspect the data for the files to now load - var textures = file.data.textures; + return TilemapComponents.CreateFromTiles(indexes, replacements, spriteConfig, scene, camera, layer); + }, - var config = this.config; - var loader = this.loader; + /** + * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the + * specified index. Tiles will be set to collide if the given index is a colliding index. + * Collision information in the region will be recalculated. + * + * If no layer specified, the map's current layer is used. + * This cannot be applied to StaticTilemapLayers. + * + * @method Phaser.Tilemaps.Tilemap#fill + * @since 3.0.0 + * + * @param {number} index - The tile index to fill the area with. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + */ + fill: function (index, tileX, tileY, width, height, recalculateFaces, layer) + { + if (recalculateFaces === undefined) { recalculateFaces = true; } - var currentBaseURL = loader.baseURL; - var currentPath = loader.path; - var currentPrefix = loader.prefix; + layer = this.getLayer(layer); - var baseURL = GetFastValue(config, 'baseURL', this.baseURL); - var path = GetFastValue(config, 'path', this.path); - var prefix = GetFastValue(config, 'prefix', this.prefix); - var textureXhrSettings = GetFastValue(config, 'textureXhrSettings'); + if (layer === null) { return null; } - loader.setBaseURL(baseURL); - loader.setPath(path); - loader.setPrefix(prefix); + TilemapComponents.Fill(index, tileX, tileY, width, height, recalculateFaces, layer); - for (var i = 0; i < textures.length; i++) - { - // "image": "texture-packer-multi-atlas-0.png", - var textureURL = textures[i].image; + return this; + }, - var key = 'MA' + this.multiKeyIndex + '_' + textureURL; + /** + * For each object in the given object layer, run the given filter callback function. Any + * objects that pass the filter test (i.e. where the callback returns true) will be returned in a + * new array. Similar to Array.prototype.Filter in vanilla JS. + * + * @method Phaser.Tilemaps.Tilemap#filterObjects + * @since 3.0.0 + * + * @param {(Phaser.Tilemaps.ObjectLayer|string)} objectLayer - The name of an object layer (from Tiled) or an ObjectLayer instance. + * @param {TilemapFilterCallback} callback - The callback. Each object in the given area will be passed to this callback as the first and only parameter. + * @param {object} [context] - The context under which the callback should be run. + * + * @return {?Phaser.Types.Tilemaps.TiledObject[]} An array of object that match the search, or null if the objectLayer given was invalid. + */ + filterObjects: function (objectLayer, callback, context) + { + if (typeof objectLayer === 'string') + { + var name = objectLayer; - var image = new ImageFile(loader, key, textureURL, textureXhrSettings); + objectLayer = this.getObjectLayer(objectLayer); - this.addToMultiFile(image); + if (!objectLayer) + { + console.warn('No object layer found with the name: ' + name); + return null; + } + } - loader.addFile(image); + return objectLayer.objects.filter(callback, context); + }, - // "normalMap": "texture-packer-multi-atlas-0_n.png", - if (textures[i].normalMap) - { - var normalMap = new ImageFile(loader, key, textures[i].normalMap, textureXhrSettings); + /** + * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given + * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns + * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS. + * If no layer specified, the map's current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#filterTiles + * @since 3.0.0 + * + * @param {function} callback - The callback. Each tile in the given area will be passed to this + * callback as the first and only parameter. The callback should return true for tiles that pass the + * filter. + * @param {object} [context] - The context under which the callback should be run. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. + */ + filterTiles: function (callback, context, tileX, tileY, width, height, filteringOptions, layer) + { + layer = this.getLayer(layer); - normalMap.type = 'normalMap'; + if (layer === null) { return null; } - image.setLink(normalMap); + return TilemapComponents.FilterTiles(callback, context, tileX, tileY, width, height, filteringOptions, layer); + }, - this.addToMultiFile(normalMap); + /** + * Searches the entire map layer for the first tile matching the given index, then returns that Tile + * object. If no match is found, it returns null. The search starts from the top-left tile and + * continues horizontally until it hits the end of the row, then it drops down to the next column. + * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to + * the top-left. + * If no layer specified, the map's current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#findByIndex + * @since 3.0.0 + * + * @param {number} index - The tile index value to search for. + * @param {number} [skip=0] - The number of times to skip a matching tile before returning. + * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. + */ + findByIndex: function (findIndex, skip, reverse, layer) + { + layer = this.getLayer(layer); - loader.addFile(normalMap); - } - } + if (layer === null) { return null; } - // Reset the loader settings - loader.setBaseURL(currentBaseURL); - loader.setPath(currentPath); - loader.setPrefix(currentPrefix); - } - } + return TilemapComponents.FindByIndex(findIndex, skip, reverse, layer); }, /** - * Adds this file to its target cache upon successful loading and processing. + * Find the first object in the given object layer that satisfies the provided testing function. + * I.e. finds the first object for which `callback` returns true. Similar to + * Array.prototype.find in vanilla JS. * - * @method Phaser.Loader.FileTypes.MultiAtlasFile#addToCache - * @since 3.7.0 + * @method Phaser.Tilemaps.Tilemap#findObject + * @since 3.0.0 + * + * @param {(Phaser.Tilemaps.ObjectLayer|string)} objectLayer - The name of an object layer (from Tiled) or an ObjectLayer instance. + * @param {TilemapFindCallback} callback - The callback. Each object in the given area will be passed to this callback as the first and only parameter. + * @param {object} [context] - The context under which the callback should be run. + * + * @return {?Phaser.Types.Tilemaps.TiledObject} An object that matches the search, or null if no object found. */ - addToCache: function () + findObject: function (objectLayer, callback, context) { - if (this.isReadyToProcess()) + if (typeof objectLayer === 'string') { - var fileJSON = this.files[0]; + var name = objectLayer; - var data = []; - var images = []; - var normalMaps = []; + objectLayer = this.getObjectLayer(objectLayer); - for (var i = 1; i < this.files.length; i++) + if (!objectLayer) { - var file = this.files[i]; - - if (file.type === 'normalMap') - { - continue; - } - - var pos = file.key.indexOf('_'); - var key = file.key.substr(pos + 1); + console.warn('No object layer found with the name: ' + name); + return null; + } + } - var image = file.data; + return objectLayer.objects.find(callback, context) || null; + }, - // Now we need to find out which json entry this mapped to - for (var t = 0; t < fileJSON.data.textures.length; t++) - { - var item = fileJSON.data.textures[t]; + /** + * Find the first tile in the given rectangular area (in tile coordinates) of the layer that + * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns + * true. Similar to Array.prototype.find in vanilla JS. + * If no layer specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#findTile + * @since 3.0.0 + * + * @param {FindTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. + * @param {object} [context] - The context under which the callback should be run. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * + * @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid. + */ + findTile: function (callback, context, tileX, tileY, width, height, filteringOptions, layer) + { + layer = this.getLayer(layer); - if (item.image === key) - { - images.push(image); + if (layer === null) { return null; } - data.push(item); + return TilemapComponents.FindTile(callback, context, tileX, tileY, width, height, filteringOptions, layer); + }, - if (file.linkFile) - { - normalMaps.push(file.linkFile.data); - } + /** + * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given + * callback. Similar to Array.prototype.forEach in vanilla JS. + * + * If no layer specified, the map's current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#forEachTile + * @since 3.0.0 + * + * @param {EachTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. + * @param {object} [context] - The context under which the callback should be run. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer. + * + * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + */ + forEachTile: function (callback, context, tileX, tileY, width, height, filteringOptions, layer) + { + layer = this.getLayer(layer); - break; - } - } - } + if (layer === null) { return null; } - if (normalMaps.length === 0) - { - normalMaps = undefined; - } + TilemapComponents.ForEachTile(callback, context, tileX, tileY, width, height, filteringOptions, layer); - this.loader.textureManager.addAtlasJSONArray(this.key, images, data, normalMaps); + return this; + }, - this.complete = true; + /** + * Gets the image layer index based on its name. + * + * @method Phaser.Tilemaps.Tilemap#getImageIndex + * @since 3.0.0 + * + * @param {string} name - The name of the image to get. + * + * @return {number} The index of the image in this tilemap, or null if not found. + */ + getImageIndex: function (name) + { + return this.getIndex(this.images, name); + }, - for (i = 0; i < this.files.length; i++) - { - this.files[i].pendingDestroy(); - } + /** + * Return a list of all valid imagelayer names loaded in this Tilemap. + * + * @method Phaser.Tilemaps.Tilemap#getImageLayerNames + * @since 3.21.0 + * + * @return {string[]} Array of valid imagelayer names / IDs loaded into this Tilemap. + */ + getImageLayerNames: function () + { + if (!this.images || !Array.isArray(this.images)) + { + return []; } - } - -}); - -/** - * Adds a Multi Texture Atlas, or array of multi atlases, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.multiatlas('level1', 'images/Level1.json'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring - * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. - * - * Phaser expects the atlas data to be provided in a JSON file as exported from the application Texture Packer, - * version 4.6.3 or above, where you have made sure to use the Phaser 3 Export option. - * - * The way it works internally is that you provide a URL to the JSON file. Phaser then loads this JSON, parses it and - * extracts which texture files it also needs to load to complete the process. If the JSON also defines normal maps, - * Phaser will load those as well. - * - * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Texture Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.multiatlas({ - * key: 'level1', - * atlasURL: 'images/Level1.json' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.MultiAtlasFileConfig` for more details. - * - * Instead of passing a URL for the atlas JSON data you can also pass in a well formed JSON object instead. - * - * Once the atlas has finished loading you can use frames from it as textures for a Game Object by referencing its key: - * - * ```javascript - * this.load.multiatlas('level1', 'images/Level1.json'); - * // and later in your game ... - * this.add.image(x, y, 'level1', 'background'); - * ``` - * - * To get a list of all available frames within an atlas please consult your Texture Atlas software. - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and - * this is what you would use to retrieve the image from the Texture Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Multi Atlas File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#multiatlas - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.7.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.MultiAtlasFileConfig|Phaser.Types.Loader.FileTypes.MultiAtlasFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {string} [path] - Optional path to use when loading the textures defined in the atlas data. - * @param {string} [baseURL] - Optional Base URL to use when loading the textures defined in the atlas data. - * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('multiatlas', function (key, atlasURL, path, baseURL, atlasXhrSettings) -{ - var multifile; - // Supports an Object file definition in the key argument - // Or an array of objects in the key argument - // Or a single entry where all arguments have been defined + return this.images.map(function (image) + { + return image.name; + }); + }, - if (Array.isArray(key)) + /** + * Internally used. Returns the index of the object in one of the Tilemaps arrays whose name + * property matches the given `name`. + * + * @method Phaser.Tilemaps.Tilemap#getIndex + * @since 3.0.0 + * + * @param {array} location - The Tilemap array to search. + * @param {string} name - The name of the array element to get. + * + * @return {number} The index of the element in the array, or null if not found. + */ + getIndex: function (location, name) { - for (var i = 0; i < key.length; i++) + for (var i = 0; i < location.length; i++) { - multifile = new MultiAtlasFile(this, key[i]); - - this.addFile(multifile.files); + if (location[i].name === name) + { + return i; + } } - } - else - { - multifile = new MultiAtlasFile(this, key, atlasURL, path, baseURL, atlasXhrSettings); - - this.addFile(multifile.files); - } - return this; -}); - -module.exports = MultiAtlasFile; - - -/***/ }), -/* 1352 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return null; + }, -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(49); -var ScriptFile = __webpack_require__(520); + /** + * Gets the LayerData from `this.layers` that is associated with the given `layer`, or null if the layer is invalid. + * + * @method Phaser.Tilemaps.Tilemap#getLayer + * @since 3.0.0 + * + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or Tilemap Layer. If not given will default to the maps current layer index. + * + * @return {?Phaser.Tilemaps.LayerData} The corresponding `LayerData` within `this.layers`, or null. + */ + getLayer: function (layer) + { + var index = this.getLayerIndex(layer); -/** - * @classdesc - * A Multi Script File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#scripts method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#scripts. - * - * @class MultiScriptFile - * @extends Phaser.Loader.MultiFile - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.17.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.MultiScriptFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string[]} [url] - An array of absolute or relative URLs to load the script files from. They are processed in the order given in the array. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object for the script files. Used in replacement of the Loaders default XHR Settings. - */ -var MultiScriptFile = new Class({ + return (index !== null) ? this.layers[index] : null; + }, - Extends: MultiFile, + /** + * Gets the ObjectLayer from `this.objects` that has the given `name`, or null if no ObjectLayer is found with that name. + * + * @method Phaser.Tilemaps.Tilemap#getObjectLayer + * @since 3.0.0 + * + * @param {string} [name] - The name of the object layer from Tiled. + * + * @return {?Phaser.Tilemaps.ObjectLayer} The corresponding `ObjectLayer` within `this.objects`, or null. + */ + getObjectLayer: function (name) + { + var index = this.getIndex(this.objects, name); - initialize: + return (index !== null) ? this.objects[index] : null; + }, - function MultiScriptFile (loader, key, url, xhrSettings) + /** + * Return a list of all valid objectgroup names loaded in this Tilemap. + * + * @method Phaser.Tilemaps.Tilemap#getObjectLayerNames + * @since 3.21.0 + * + * @return {string[]} Array of valid objectgroup names / IDs loaded into this Tilemap. + */ + getObjectLayerNames: function () { - var extension = 'js'; - var files = []; + if (!this.objects || !Array.isArray(this.objects)) + { + return []; + } - if (IsPlainObject(key)) + return this.objects.map(function (object) { - var config = key; + return object.name; + }); + }, - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); + /** + * Gets the LayerData index of the given `layer` within this.layers, or null if an invalid + * `layer` is given. + * + * @method Phaser.Tilemaps.Tilemap#getLayerIndex + * @since 3.0.0 + * + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or a Tilemap Layer. If not given will default to the map's current layer index. + * + * @return {number} The LayerData index within this.layers. + */ + getLayerIndex: function (layer) + { + if (layer === undefined) + { + return this.currentLayerIndex; } - - if (!Array.isArray(url)) + else if (typeof layer === 'string') { - url = [ url ]; + return this.getLayerIndexByName(layer); } - - for (var i = 0; i < url.length; i++) + else if (typeof layer === 'number' && layer < this.layers.length) { - var scriptFile = new ScriptFile(loader, { - key: key + '_' + i.toString(), - url: url[i], - extension: extension, - xhrSettings: xhrSettings - }); - - // Override the default onProcess function - scriptFile.onProcess = function () - { - this.onProcessComplete(); - }; - - files.push(scriptFile); + return layer; + } + else if (layer instanceof TilemapLayer && layer.tilemap === this) + { + return layer.layerIndex; + } + else + { + return null; } - - MultiFile.call(this, loader, 'scripts', key, files); }, /** - * Adds this file to its target cache upon successful loading and processing. + * Gets the index of the LayerData within this.layers that has the given `name`, or null if an + * invalid `name` is given. * - * @method Phaser.Loader.FileTypes.MultiScriptFile#addToCache - * @since 3.17.0 + * @method Phaser.Tilemaps.Tilemap#getLayerIndexByName + * @since 3.0.0 + * + * @param {string} name - The name of the layer to get. + * + * @return {number} The LayerData index within this.layers. */ - addToCache: function () + getLayerIndexByName: function (name) { - if (this.isReadyToProcess()) - { - for (var i = 0; i < this.files.length; i++) - { - var file = this.files[i]; - - file.data = document.createElement('script'); - file.data.language = 'javascript'; - file.data.type = 'text/javascript'; - file.data.defer = false; - file.data.text = file.xhrLoader.responseText; + return this.getIndex(this.layers, name); + }, - document.head.appendChild(file.data); - } + /** + * Gets a tile at the given tile coordinates from the given layer. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#getTileAt + * @since 3.0.0 + * + * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {boolean} [nonNull] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. + */ + getTileAt: function (tileX, tileY, nonNull, layer) + { + layer = this.getLayer(layer); - this.complete = true; - } - } + if (layer === null) { return null; } -}); + return TilemapComponents.GetTileAt(tileX, tileY, nonNull, layer); + }, -/** - * Adds an array of Script files to the current load queue. - * - * The difference between this and the `ScriptFile` file type is that you give an array of scripts to this method, - * and the scripts are then processed _exactly_ in that order. This allows you to load a bunch of scripts that - * may have dependencies on each other without worrying about the async nature of traditional script loading. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.scripts('PostProcess', [ - * 'libs/shaders/CopyShader.js', - * 'libs/postprocessing/EffectComposer.js', - * 'libs/postprocessing/RenderPass.js', - * 'libs/postprocessing/MaskPass.js', - * 'libs/postprocessing/ShaderPass.js', - * 'libs/postprocessing/AfterimagePass.js' - * ]); - * } - * ``` - * - * In the code above the script files will all be loaded in parallel but only processed (i.e. invoked) in the exact - * order given in the array. - * - * The files are **not** loaded right away. They are added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the files are queued - * it means you cannot use the files immediately after calling this method, but must wait for the files to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String and not already in-use by another file in the Loader. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.scripts({ - * key: 'PostProcess', - * url: [ - * 'libs/shaders/CopyShader.js', - * 'libs/postprocessing/EffectComposer.js', - * 'libs/postprocessing/RenderPass.js', - * 'libs/postprocessing/MaskPass.js', - * 'libs/postprocessing/ShaderPass.js', - * 'libs/postprocessing/AfterimagePass.js' - * ] - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.MultiScriptFileConfig` for more details. - * - * Once all the files have finished loading they will automatically be converted into a script element - * via `document.createElement('script')`. They will have their language set to JavaScript, `defer` set to - * false and then the resulting element will be appended to `document.head`. Any code then in the - * script will be executed. This is done in the exact order the files are specified in the url array. - * - * The URLs can be relative or absolute. If the URLs are relative the `Loader.baseURL` and `Loader.path` values will be prepended to them. - * - * Note: The ability to load this type of file will only be available if the MultiScript File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#scripts - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.17.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.MultiScriptFileConfig|Phaser.Types.Loader.FileTypes.MultiScriptFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string[]} [url] - An array of absolute or relative URLs to load the script files from. They are processed in the order given in the array. - * @param {string} [extension='js'] - The default file extension to use if no url is provided. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for these files. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('scripts', function (key, url, xhrSettings) -{ - var multifile; + /** + * Gets a tile at the given world coordinates from the given layer. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#getTileAtWorldXY + * @since 3.0.0 + * + * @param {number} worldX - X position to get the tile from (given in pixels) + * @param {number} worldY - Y position to get the tile from (given in pixels) + * @param {boolean} [nonNull] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. + */ + getTileAtWorldXY: function (worldX, worldY, nonNull, camera, layer) + { + layer = this.getLayer(layer); - // Supports an Object file definition in the key argument - // Or an array of objects in the key argument - // Or a single entry where all arguments have been defined + if (layer === null) { return null; } - if (Array.isArray(key)) + return TilemapComponents.GetTileAtWorldXY(worldX, worldY, nonNull, camera, layer); + }, + + /** + * Return a list of all valid tilelayer names loaded in this Tilemap. + * + * @method Phaser.Tilemaps.Tilemap#getTileLayerNames + * @since 3.21.0 + * + * @return {string[]} Array of valid tilelayer names / IDs loaded into this Tilemap. + */ + getTileLayerNames: function () { - for (var i = 0; i < key.length; i++) + if (!this.layers || !Array.isArray(this.layers)) { - multifile = new MultiScriptFile(this, key[i]); - - this.addFile(multifile.files); + return []; } - } - else + + return this.layers.map(function (layer) + { + return layer.name; + }); + }, + + /** + * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#getTilesWithin + * @since 3.0.0 + * + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. + */ + getTilesWithin: function (tileX, tileY, width, height, filteringOptions, layer) { - multifile = new MultiScriptFile(this, key, url, xhrSettings); + layer = this.getLayer(layer); - this.addFile(multifile.files); - } + if (layer === null) { return null; } - return this; -}); + return TilemapComponents.GetTilesWithin(tileX, tileY, width, height, filteringOptions, layer); + }, -module.exports = MultiScriptFile; + /** + * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, + * Line, Rectangle or Triangle. The shape should be in world coordinates. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#getTilesWithinShape + * @since 3.0.0 + * + * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. + */ + getTilesWithinShape: function (shape, filteringOptions, camera, layer) + { + layer = this.getLayer(layer); + if (layer === null) { return null; } -/***/ }), -/* 1353 */ -/***/ (function(module, exports, __webpack_require__) { + return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, layer); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Gets the tiles in the given rectangular area (in world coordinates) of the layer. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#getTilesWithinWorldXY + * @since 3.0.0 + * + * @param {number} worldX - The world x coordinate for the top-left of the area. + * @param {number} worldY - The world y coordinate for the top-left of the area. + * @param {number} width - The width of the area. + * @param {number} height - The height of the area. + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid. + */ + getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera, layer) + { + layer = this.getLayer(layer); -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(49); -var ParseObj = __webpack_require__(498); -var ParseObjMaterial = __webpack_require__(499); -var TextFile = __webpack_require__(242); + if (layer === null) { return null; } -/** - * @classdesc - * A single Wavefront OBJ File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#obj method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#obj. - * - * @class OBJFile - * @extends Phaser.Loader.MultiFile - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.50.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.OBJFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [objURL] - The absolute or relative URL to load the obj file from. If undefined or `null` it will be set to `.obj`, i.e. if `key` was "alien" then the URL will be "alien.obj". - * @param {string} [matURL] - The absolute or relative URL to load the material file from. If undefined or `null` it will be set to `.mat`, i.e. if `key` was "alien" then the URL will be "alien.mat". - * @param {boolean} [flipUV] - Flip the UV coordinates stored in the model data? - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for these files. - */ -var OBJFile = new Class({ + return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, layer); + }, - Extends: MultiFile, + /** + * Gets the Tileset that has the given `name`, or null if an invalid `name` is given. + * + * @method Phaser.Tilemaps.Tilemap#getTileset + * @since 3.14.0 + * + * @param {string} name - The name of the Tileset to get. + * + * @return {?Phaser.Tilemaps.Tileset} The Tileset, or `null` if no matching named tileset was found. + */ + getTileset: function (name) + { + var index = this.getIndex(this.tilesets, name); - initialize: + return (index !== null) ? this.tilesets[index] : null; + }, - function OBJFile (loader, key, objURL, matURL, flipUV, xhrSettings) + /** + * Gets the index of the Tileset within this.tilesets that has the given `name`, or null if an + * invalid `name` is given. + * + * @method Phaser.Tilemaps.Tilemap#getTilesetIndex + * @since 3.0.0 + * + * @param {string} name - The name of the Tileset to get. + * + * @return {number} The Tileset index within this.tilesets. + */ + getTilesetIndex: function (name) { - var obj; - var mat; + return this.getIndex(this.tilesets, name); + }, - var cache = loader.cacheManager.obj; + /** + * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns + * false if there is no tile or if the tile at that location has an index of -1. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#hasTileAt + * @since 3.0.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?boolean} Returns a boolean, or null if the layer given was invalid. + */ + hasTileAt: function (tileX, tileY, layer) + { + layer = this.getLayer(layer); - if (IsPlainObject(key)) - { - var config = key; + if (layer === null) { return null; } - key = GetFastValue(config, 'key'); + return TilemapComponents.HasTileAt(tileX, tileY, layer); + }, - obj = new TextFile(loader, { - key: key, - type: 'obj', - cache: cache, - url: GetFastValue(config, 'url'), - extension: GetFastValue(config, 'extension', 'obj'), - xhrSettings: GetFastValue(config, 'xhrSettings'), - config: { - flipUV: GetFastValue(config, 'flipUV', flipUV) - } - }); + /** + * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns + * false if there is no tile or if the tile at that location has an index of -1. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#hasTileAtWorldXY + * @since 3.0.0 + * + * @param {number} worldX - The x coordinate, in pixels. + * @param {number} worldY - The y coordinate, in pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?boolean} Returns a boolean, or null if the layer given was invalid. + */ + hasTileAtWorldXY: function (worldX, worldY, camera, layer) + { + layer = this.getLayer(layer); - matURL = GetFastValue(config, 'matURL'); + if (layer === null) { return null; } - if (matURL) - { - mat = new TextFile(loader, { - key: key, - type: 'mat', - cache: cache, - url: matURL, - extension: GetFastValue(config, 'matExtension', 'mat'), - xhrSettings: GetFastValue(config, 'xhrSettings') - }); - } - } - else + return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera, layer); + }, + + /** + * The LayerData object that is currently selected in the map. You can set this property using + * any type supported by setLayer. + * + * @name Phaser.Tilemaps.Tilemap#layer + * @type {Phaser.Tilemaps.LayerData} + * @since 3.0.0 + */ + layer: { + get: function () { - obj = new TextFile(loader, { - key: key, - url: objURL, - type: 'obj', - cache: cache, - extension: 'obj', - xhrSettings: xhrSettings, - config: { - flipUV: flipUV - } - }); + return this.layers[this.currentLayerIndex]; + }, - if (matURL) - { - mat = new TextFile(loader, { - key: key, - url: matURL, - type: 'mat', - cache: cache, - extension: 'mat', - xhrSettings: xhrSettings - }); - } + set: function (layer) + { + this.setLayer(layer); } - - MultiFile.call(this, loader, 'obj', key, [ obj, mat ]); }, /** - * Adds this file to its target cache upon successful loading and processing. + * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index + * or a Tile object. If you pass in a Tile, all attributes will be copied over to the specified + * location. If you pass in an index, only the index at the specified location will be changed. + * Collision information will be recalculated at the specified location. * - * @method Phaser.Loader.FileTypes.OBJFile#addToCache - * @since 3.50.0 + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#putTileAt + * @since 3.0.0 + * + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid or the coordinates were out of bounds. */ - addToCache: function () + putTileAt: function (tile, tileX, tileY, recalculateFaces, layer) { - if (this.isReadyToProcess()) - { - var obj = this.files[0]; - var mat = this.files[1]; + if (recalculateFaces === undefined) { recalculateFaces = true; } - var objData = ParseObj(obj.data, obj.config.flipUV); + layer = this.getLayer(layer); - if (mat) - { - objData.materials = ParseObjMaterial(mat.data); - } + if (layer === null) { return null; } - obj.cache.add(obj.key, objData); + return TilemapComponents.PutTileAt(tile, tileX, tileY, recalculateFaces, layer); + }, - this.complete = true; - } - } + /** + * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either + * an index or a Tile object. If you pass in a Tile, all attributes will be copied over to the + * specified location. If you pass in an index, only the index at the specified location will be + * changed. Collision information will be recalculated at the specified location. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#putTileAtWorldXY + * @since 3.0.0 + * + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {number} worldX - The x coordinate, in pixels. + * @param {number} worldY - The y coordinate, in pixels. + * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. + */ + putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera, layer) + { + if (recalculateFaces === undefined) { recalculateFaces = true; } -}); + layer = this.getLayer(layer); -/** - * Adds a Wavefront OBJ file, or array of OBJ files, to the current load queue. - * - * Note: You should ensure your 3D package has triangulated the OBJ file prior to export. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.obj('ufo', 'files/spaceship.obj'); - * } - * ``` - * - * You can optionally also load a Wavefront Material file as well, by providing the 3rd parameter: - * - * ```javascript - * function preload () - * { - * this.load.obj('ufo', 'files/spaceship.obj', 'files/spaceship.mtl'); - * } - * ``` - * - * If given, the material will be parsed and stored along with the obj data in the cache. - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global OBJ Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the OBJ Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the OBJ Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.obj({ - * key: 'ufo', - * url: 'files/spaceship.obj', - * matURL: 'files/spaceship.mtl', - * flipUV: true - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.OBJFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.obj('ufo', 'files/spaceship.obj'); - * // and later in your game ... - * var data = this.cache.obj.get('ufo'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and - * this is what you would use to retrieve the obj from the OBJ Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" - * and no URL is given then the Loader will set the URL to be "story.obj". It will always add `.obj` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the OBJ File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#obj - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.50.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.OBJFileConfig|Phaser.Types.Loader.FileTypes.OBJFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [objURL] - The absolute or relative URL to load the obj file from. If undefined or `null` it will be set to `.obj`, i.e. if `key` was "alien" then the URL will be "alien.obj". - * @param {string} [matURL] - Optional absolute or relative URL to load the obj material file from. - * @param {boolean} [flipUV] - Flip the UV coordinates stored in the model data? - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('obj', function (key, objURL, matURL, flipUVs, xhrSettings) -{ - var multifile; + if (layer === null) { return null; } - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - multifile = new OBJFile(this, key[i]); + return TilemapComponents.PutTileAtWorldXY(tile, worldX, worldY, recalculateFaces, camera, layer); + }, - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(multifile.files); - } - } - else + /** + * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified + * layer. The array can be composed of either tile indexes or Tile objects. If you pass in a Tile, + * all attributes will be copied over to the specified location. If you pass in an index, only the + * index at the specified location will be changed. Collision information will be recalculated + * within the region tiles were changed. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#putTilesAt + * @since 3.0.0 + * + * @param {(number[]|number[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + */ + putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces, layer) { - multifile = new OBJFile(this, key, objURL, matURL, flipUVs, xhrSettings); - - this.addFile(multifile.files); - } + if (recalculateFaces === undefined) { recalculateFaces = true; } - return this; -}); + layer = this.getLayer(layer); -module.exports = OBJFile; + if (layer === null) { return null; } + TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, layer); -/***/ }), -/* 1354 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the + * specified layer. Each tile will receive a new index. If an array of indexes is passed in, then + * those will be used for randomly assigning new tile indexes. If an array is not provided, the + * indexes found within the region (excluding -1) will be used for randomly assigning new tile + * indexes. This method only modifies tile indexes and does not change collision information. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#randomize + * @since 3.0.0 + * + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {number[]} [indexes] - An array of indexes to randomly draw from during randomization. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + */ + randomize: function (tileX, tileY, width, height, indexes, layer) + { + layer = this.getLayer(layer); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var FileTypesManager = __webpack_require__(8); -var JSONFile = __webpack_require__(61); + if (layer === null) { return null; } -/** - * @classdesc - * A single JSON Pack File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#pack method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#pack. - * - * @class PackFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.7.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.PackFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. - */ -var PackFile = new Class({ + TilemapComponents.Randomize(tileX, tileY, width, height, indexes, layer); - Extends: JSONFile, + return this; + }, - initialize: + /** + * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting + * faces are used internally for optimizing collisions against tiles. This method is mostly used + * internally to optimize recalculating faces when only one tile has been changed. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#calculateFacesAt + * @since 3.0.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + */ + calculateFacesAt: function (tileX, tileY, layer) + { + layer = this.getLayer(layer); - // url can either be a string, in which case it is treated like a proper url, or an object, in which case it is treated as a ready-made JS Object - // dataKey allows you to pluck a specific object out of the JSON and put just that into the cache, rather than the whole thing + if (layer === null) { return null; } - function PackFile (loader, key, url, xhrSettings, dataKey) - { - JSONFile.call(this, loader, key, url, xhrSettings, dataKey); + TilemapComponents.CalculateFacesAt(tileX, tileY, layer); - this.type = 'packfile'; + return this; }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the + * layer. Interesting faces are used internally for optimizing collisions against tiles. This method + * is mostly used internally. * - * @method Phaser.Loader.FileTypes.PackFile#onProcess - * @since 3.7.0 + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#calculateFacesWithin + * @since 3.0.0 + * + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. */ - onProcess: function () + calculateFacesWithin: function (tileX, tileY, width, height, layer) { - if (this.state !== CONST.FILE_POPULATED) - { - this.state = CONST.FILE_PROCESSING; - - this.data = JSON.parse(this.xhrLoader.responseText); - } - - // Let's pass the pack file data over to the Loader ... - this.loader.addPack(this.data, this.config); + layer = this.getLayer(layer); - this.onProcessComplete(); - } + if (layer === null) { return null; } -}); + TilemapComponents.CalculateFacesWithin(tileX, tileY, width, height, layer); -/** - * Adds a JSON File Pack, or array of packs, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.pack('level1', 'data/Level1Files.json'); - * } - * ``` - * - * A File Pack is a JSON file (or object) that contains details about other files that should be added into the Loader. - * Here is a small example: - * - * ```json - * { - * "test1": { - * "files": [ - * { - * "type": "image", - * "key": "taikodrummaster", - * "url": "assets/pics/taikodrummaster.jpg" - * }, - * { - * "type": "image", - * "key": "sukasuka-chtholly", - * "url": "assets/pics/sukasuka-chtholly.png" - * } - * ] - * }, - * "meta": { - * "generated": "1401380327373", - * "app": "Phaser 3 Asset Packer", - * "url": "https://phaser.io", - * "version": "1.0", - * "copyright": "Photon Storm Ltd. 2018" - * } - * } - * ``` - * - * The pack can be split into sections. In the example above you'll see a section called `test1. You can tell - * the `load.pack` method to parse only a particular section of a pack. The pack is stored in the JSON Cache, - * so you can pass it to the Loader to process additional sections as needed in your game, or you can just load - * them all at once without specifying anything. - * - * The pack file can contain an entry for any type of file that Phaser can load. The object structures exactly - * match that of the file type configs, and all properties available within the file type configs can be used - * in the pack file too. - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring - * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. - * - * The key must be a unique String. It is used to add the file to the global JSON Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the JSON Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the JSON Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.pack({ - * key: 'level1', - * url: 'data/Level1Files.json' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.PackFileConfig` for more details. - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and - * this is what you would use to retrieve the text from the JSON Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "data" - * and no URL is given then the Loader will set the URL to be "data.json". It will always add `.json` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * You can also optionally provide a `dataKey` to use. This allows you to extract only a part of the JSON and store it in the Cache, - * rather than the whole file. For example, if your JSON data had a structure like this: - * - * ```json - * { - * "level1": { - * "baddies": { - * "aliens": {}, - * "boss": {} - * } - * }, - * "level2": {}, - * "level3": {} - * } - * ``` - * - * And you only wanted to store the `boss` data in the Cache, then you could pass `level1.baddies.boss`as the `dataKey`. - * - * Note: The ability to load this type of file will only be available if the Pack File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#pack - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.7.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.PackFileConfig|Phaser.Types.Loader.FileTypes.PackFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {string} [dataKey] - When the JSON file loads only this property will be stored in the Cache. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('pack', function (key, url, packKey, xhrSettings) -{ - // Supports an Object file definition in the key argument - // Or an array of objects in the key argument - // Or a single entry where all arguments have been defined + return this; + }, - if (Array.isArray(key)) + /** + * Removes the given TilemapLayer from this Tilemap without destroying it. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#removeLayer + * @since 3.17.0 + * + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to be removed. + * + * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + */ + removeLayer: function (layer) { - for (var i = 0; i < key.length; i++) + var index = this.getLayerIndex(layer); + + if (index !== null) { - this.addFile(new PackFile(this, key[i])); - } - } - else - { - this.addFile(new PackFile(this, key, url, xhrSettings, packKey)); - } + SpliceOne(this.layers, index); - return this; -}); + for (var i = index; i < this.layers.length; i++) + { + if (this.layers[i].tilemapLayer) + { + this.layers[i].tilemapLayer.layerIndex--; + } + } -module.exports = PackFile; + if (this.currentLayerIndex === index) + { + this.currentLayerIndex = 0; + } + return this; + } + else + { + return null; + } + }, -/***/ }), -/* 1355 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Destroys the given TilemapLayer and removes it from this Tilemap. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#destroyLayer + * @since 3.17.0 + * + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to be destroyed. + * + * @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid. + */ + destroyLayer: function (layer) + { + var index = this.getLayerIndex(layer); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (index !== null) + { + layer = this.layers[index]; -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); + layer.tilemapLayer.destroy(); -/** - * @classdesc - * A single Plugin Script File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#plugin method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#plugin. - * - * @class PluginFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.PluginFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". - * @param {boolean} [start=false] - Automatically start the plugin after loading? - * @param {string} [mapping] - If this plugin is to be injected into the Scene, this is the property key used. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var PluginFile = new Class({ + SpliceOne(this.layers, index); - Extends: File, + if (this.currentLayerIndex === index) + { + this.currentLayerIndex = 0; + } - initialize: + return this; + } + else + { + return null; + } + }, - function PluginFile (loader, key, url, start, mapping, xhrSettings) + /** + * Removes all Tilemap Layers from this Tilemap and calls `destroy` on each of them. + * + * @method Phaser.Tilemaps.Tilemap#removeAllLayers + * @since 3.0.0 + * + * @return {this} This Tilemap object. + */ + removeAllLayers: function () { - var extension = 'js'; + var layers = this.layers; - if (IsPlainObject(key)) + for (var i = 0; i < layers.length; i++) { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - start = GetFastValue(config, 'start'); - mapping = GetFastValue(config, 'mapping'); - } - - var fileConfig = { - type: 'plugin', - cache: false, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings, - config: { - start: start, - mapping: mapping + if (layers[i].tilemapLayer) + { + layers[i].tilemapLayer.destroy(false); } - }; + } - File.call(this, loader, fileConfig); + layers.length = 0; - // If the url variable refers to a class, add the plugin directly - if (typeof url === 'function') - { - this.data = url; + this.currentLayerIndex = 0; - this.state = CONST.FILE_POPULATED; - } + return this; }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * Removes the given Tile, or an array of Tiles, from the layer to which they belong, + * and optionally recalculates the collision information. * - * @method Phaser.Loader.FileTypes.PluginFile#onProcess - * @since 3.7.0 + * @method Phaser.Tilemaps.Tilemap#removeTile + * @since 3.17.0 + * + * @param {(Phaser.Tilemaps.Tile|Phaser.Tilemaps.Tile[])} tiles - The Tile to remove, or an array of Tiles. + * @param {number} [replaceIndex=-1] - After removing the Tile, insert a brand new Tile into its location with the given index. Leave as -1 to just remove the tile. + * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * + * @return {Phaser.Tilemaps.Tile[]} Returns an array of Tiles that were removed. */ - onProcess: function () + removeTile: function (tiles, replaceIndex, recalculateFaces) { - var pluginManager = this.loader.systems.plugins; - var config = this.config; + if (replaceIndex === undefined) { replaceIndex = -1; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - var start = GetFastValue(config, 'start', false); - var mapping = GetFastValue(config, 'mapping', null); + var removed = []; - if (this.state === CONST.FILE_POPULATED) + if (!Array.isArray(tiles)) { - pluginManager.install(this.key, this.data, start, mapping); + tiles = [ tiles ]; } - else - { - // Plugin added via a js file - this.state = CONST.FILE_PROCESSING; - - this.data = document.createElement('script'); - this.data.language = 'javascript'; - this.data.type = 'text/javascript'; - this.data.defer = false; - this.data.text = this.xhrLoader.responseText; - document.head.appendChild(this.data); + for (var i = 0; i < tiles.length; i++) + { + var tile = tiles[i]; - var plugin = pluginManager.install(this.key, window[this.key], start, mapping); + removed.push(this.removeTileAt(tile.x, tile.y, true, recalculateFaces, tile.tilemapLayer)); - if (start || mapping) + if (replaceIndex > -1) { - // Install into the current Scene Systems and Scene - this.loader.systems[mapping] = plugin; - this.loader.scene[mapping] = plugin; + this.putTileAt(replaceIndex, tile.x, tile.y, recalculateFaces, tile.tilemapLayer); } } - this.onProcessComplete(); - } - -}); + return removed; + }, -/** - * Adds a Plugin Script file, or array of plugin files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.plugin('modplayer', 'plugins/ModPlayer.js'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String and not already in-use by another file in the Loader. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.plugin({ - * key: 'modplayer', - * url: 'plugins/ModPlayer.js' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.PluginFileConfig` for more details. - * - * Once the file has finished loading it will automatically be converted into a script element - * via `document.createElement('script')`. It will have its language set to JavaScript, `defer` set to - * false and then the resulting element will be appended to `document.head`. Any code then in the - * script will be executed. It will then be passed to the Phaser PluginCache.register method. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.js". It will always add `.js` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Plugin File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#plugin - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.PluginFileConfig|Phaser.Types.Loader.FileTypes.PluginFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {(string|function)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". Or, a plugin function. - * @param {boolean} [start] - Automatically start the plugin after loading? - * @param {string} [mapping] - If this plugin is to be injected into the Scene, this is the property key used. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('plugin', function (key, url, start, mapping, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new PluginFile(this, key[i])); - } - } - else + /** + * Removes the tile at the given tile coordinates in the specified layer and updates the layers collision information. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#removeTileAt + * @since 3.0.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [replaceWithNull] - If `true` (the default), this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} [recalculateFaces] - If `true` (the default), the faces data will be recalculated. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tile} Returns the Tile that was removed, or null if the layer given was invalid. + */ + removeTileAt: function (tileX, tileY, replaceWithNull, recalculateFaces, layer) { - this.addFile(new PluginFile(this, key, url, start, mapping, xhrSettings)); - } + if (replaceWithNull === undefined) { replaceWithNull = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - return this; -}); + layer = this.getLayer(layer); -module.exports = PluginFile; + if (layer === null) { return null; } + return TilemapComponents.RemoveTileAt(tileX, tileY, replaceWithNull, recalculateFaces, layer); + }, -/***/ }), -/* 1356 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Removes the tile at the given world coordinates in the specified layer and updates the layers collision information. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#removeTileAtWorldXY + * @since 3.0.0 + * + * @param {number} worldX - The x coordinate, in pixels. + * @param {number} worldY - The y coordinate, in pixels. + * @param {boolean} [replaceWithNull] - If `true` (the default), this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} [recalculateFaces] - If `true` (the default), the faces data will be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid. + */ + removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer) + { + if (replaceWithNull === undefined) { replaceWithNull = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + layer = this.getLayer(layer); -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); + if (layer === null) { return null; } -/** - * @classdesc - * An external Scene JavaScript File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#sceneFile method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#sceneFile. - * - * @class SceneFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.16.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.SceneFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var SceneFile = new Class({ + return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, layer); + }, - Extends: File, + /** + * Draws a debug representation of the layer to the given Graphics object. This is helpful when you want to + * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles + * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation + * wherever you want on the screen. + * + * If no layer is specified, the maps current layer is used. + * + * **Note:** This method currently only works with orthogonal tilemap layers. + * + * @method Phaser.Tilemaps.Tilemap#renderDebug + * @since 3.0.0 + * + * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. + * @param {Phaser.Types.Tilemaps.StyleConfig} [styleConfig] - An object specifying the colors to use for the debug drawing. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + */ + renderDebug: function (graphics, styleConfig, layer) + { + layer = this.getLayer(layer); - initialize: + if (layer === null) { return null; } - function SceneFile (loader, key, url, xhrSettings) + if (this.orientation === ORIENTATION.ORTHOGONAL) + { + TilemapComponents.RenderDebug(graphics, styleConfig, layer); + } + + return this; + }, + + /** + * Draws a debug representation of all layers within this Tilemap to the given Graphics object. + * + * This is helpful when you want to get a quick idea of which of your tiles are colliding and which + * have interesting faces. The tiles are drawn starting at (0, 0) in the Graphics, allowing you to + * place the debug representation wherever you want on the screen. + * + * @method Phaser.Tilemaps.Tilemap#renderDebugFull + * @since 3.17.0 + * + * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. + * @param {Phaser.Types.Tilemaps.StyleConfig} [styleConfig] - An object specifying the colors to use for the debug drawing. + * + * @return {this} This Tilemap instance. + */ + renderDebugFull: function (graphics, styleConfig) { - var extension = 'js'; + var layers = this.layers; - if (IsPlainObject(key)) + for (var i = 0; i < layers.length; i++) { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); + TilemapComponents.RenderDebug(graphics, styleConfig, layers[i]); } - var fileConfig = { - type: 'text', - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings - }; - - File.call(this, loader, fileConfig); + return this; }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching + * `findIndex` and updates their index to match `newIndex`. This only modifies the index and does + * not change collision information. * - * @method Phaser.Loader.FileTypes.SceneFile#onProcess - * @since 3.16.0 + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#replaceByIndex + * @since 3.0.0 + * + * @param {number} findIndex - The index of the tile to search for. + * @param {number} newIndex - The index of the tile to replace it with. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ - onProcess: function () + replaceByIndex: function (findIndex, newIndex, tileX, tileY, width, height, layer) { - this.state = CONST.FILE_PROCESSING; + layer = this.getLayer(layer); - this.data = this.xhrLoader.responseText; + if (layer === null) { return null; } - this.onProcessComplete(); + TilemapComponents.ReplaceByIndex(findIndex, newIndex, tileX, tileY, width, height, layer); + + return this; }, /** - * Adds this file to its target cache upon successful loading and processing. + * Sets collision on the given tile or tiles within a layer by index. You can pass in either a + * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if + * collision will be enabled (true) or disabled (false). * - * @method Phaser.Loader.FileTypes.SceneFile#addToCache - * @since 3.16.0 + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#setCollision + * @since 3.0.0 + * + * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. + * + * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ - addToCache: function () + setCollision: function (indexes, collides, recalculateFaces, layer, updateLayer) { - var code = this.data.concat('(function(){\n' + 'return new ' + this.key + '();\n' + '}).call(this);'); + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + if (updateLayer === undefined) { updateLayer = true; } - // Stops rollup from freaking out during build - var eval2 = eval; + layer = this.getLayer(layer); - this.loader.sceneManager.add(this.key, eval2(code)); + if (layer === null) { return null; } - this.complete = true; - } + TilemapComponents.SetCollision(indexes, collides, recalculateFaces, layer, updateLayer); -}); + return this; + }, -/** - * Adds an external Scene file, or array of Scene files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.sceneFile('Level1', 'src/Level1.js'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Scene Manager upon a successful load. - * - * For a Scene File it's vitally important that the key matches the class name in the JavaScript file. - * - * For example here is the source file: - * - * ```javascript - * class ExternalScene extends Phaser.Scene { - * - * constructor () - * { - * super('myScene'); - * } - * - * } - * ``` - * - * Because the class is called `ExternalScene` that is the exact same key you must use when loading it: - * - * ```javascript - * function preload () - * { - * this.load.sceneFile('ExternalScene', 'src/yourScene.js'); - * } - * ``` - * - * The key that is used within the Scene Manager can either be set to the same, or you can override it in the Scene - * constructor, as we've done in the example above, where the Scene key was changed to `myScene`. - * - * The key should be unique both in terms of files being loaded and Scenes already present in the Scene Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Scene Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.sceneFile({ - * key: 'Level1', - * url: 'src/Level1.js' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.SceneFileConfig` for more details. - * - * Once the file has finished loading it will be added to the Scene Manager. - * - * ```javascript - * this.load.sceneFile('Level1', 'src/Level1.js'); - * // and later in your game ... - * this.scene.start('Level1'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `WORLD1.` and the key was `Story` the final key will be `WORLD1.Story` and - * this is what you would use to retrieve the text from the Scene Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "story" - * and no URL is given then the Loader will set the URL to be "story.js". It will always add `.js` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Scene File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#sceneFile - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.16.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.SceneFileConfig|Phaser.Types.Loader.FileTypes.SceneFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('sceneFile', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new SceneFile(this, key[i])); - } - } - else + /** + * Sets collision on a range of tiles in a layer whose index is between the specified `start` and + * `stop` (inclusive). Calling this with a start value of 10 and a stop value of 14 would set + * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be + * enabled (true) or disabled (false). + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#setCollisionBetween + * @since 3.0.0 + * + * @param {number} start - The first index of the tile to be set for collision. + * @param {number} stop - The last index of the tile to be set for collision. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + */ + setCollisionBetween: function (start, stop, collides, recalculateFaces, layer) { - this.addFile(new SceneFile(this, key, url, xhrSettings)); - } + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - return this; -}); + layer = this.getLayer(layer); -module.exports = SceneFile; + if (layer === null) { return null; } + TilemapComponents.SetCollisionBetween(start, stop, collides, recalculateFaces, layer); -/***/ }), -/* 1357 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property + * that matches the given properties object, its collision flag will be set. The `collides` + * parameter controls if collision will be enabled (true) or disabled (false). Passing in + * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that + * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can + * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a + * "types" property that matches any of those values, its collision flag will be updated. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#setCollisionByProperty + * @since 3.0.0 + * + * @param {object} properties - An object with tile properties and corresponding values that should be checked. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + */ + setCollisionByProperty: function (properties, collides, recalculateFaces, layer) + { + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); + layer = this.getLayer(layer); -/** - * @classdesc - * A single Scene Plugin Script File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#scenePlugin method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#scenePlugin. - * - * @class ScenePluginFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.8.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.ScenePluginFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". - * @param {string} [systemKey] - If this plugin is to be added to Scene.Systems, this is the property key for it. - * @param {string} [sceneKey] - If this plugin is to be added to the Scene, this is the property key for it. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var ScenePluginFile = new Class({ + if (layer === null) { return null; } - Extends: File, + TilemapComponents.SetCollisionByProperty(properties, collides, recalculateFaces, layer); - initialize: + return this; + }, - function ScenePluginFile (loader, key, url, systemKey, sceneKey, xhrSettings) + /** + * Sets collision on all tiles in the given layer, except for tiles that have an index specified in + * the given array. The `collides` parameter controls if collision will be enabled (true) or + * disabled (false). Tile indexes not currently in the layer are not affected. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#setCollisionByExclusion + * @since 3.0.0 + * + * @param {number[]} indexes - An array of the tile indexes to not be counted for collision. + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + */ + setCollisionByExclusion: function (indexes, collides, recalculateFaces, layer) { - var extension = 'js'; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - systemKey = GetFastValue(config, 'systemKey'); - sceneKey = GetFastValue(config, 'sceneKey'); - } + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - var fileConfig = { - type: 'scenePlugin', - cache: false, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings, - config: { - systemKey: systemKey, - sceneKey: sceneKey - } - }; + layer = this.getLayer(layer); - File.call(this, loader, fileConfig); + if (layer === null) { return null; } - // If the url variable refers to a class, add the plugin directly - if (typeof url === 'function') - { - this.data = url; + TilemapComponents.SetCollisionByExclusion(indexes, collides, recalculateFaces, layer); - this.state = CONST.FILE_POPULATED; - } + return this; }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * Sets collision on the tiles within a layer by checking each tiles collision group data + * (typically defined in Tiled within the tileset collision editor). If any objects are found within + * a tiles collision group, the tiles colliding information will be set. The `collides` parameter + * controls if collision will be enabled (true) or disabled (false). * - * @method Phaser.Loader.FileTypes.ScenePluginFile#onProcess - * @since 3.8.0 + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#setCollisionFromCollisionGroup + * @since 3.0.0 + * + * @param {boolean} [collides] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces] - Whether or not to recalculate the tile faces after the update. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. */ - onProcess: function () + setCollisionFromCollisionGroup: function (collides, recalculateFaces, layer) { - var pluginManager = this.loader.systems.plugins; - var config = this.config; + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - var key = this.key; - var systemKey = GetFastValue(config, 'systemKey', key); - var sceneKey = GetFastValue(config, 'sceneKey', key); + layer = this.getLayer(layer); - if (this.state === CONST.FILE_POPULATED) - { - pluginManager.installScenePlugin(systemKey, this.data, sceneKey, this.loader.scene, true); - } - else - { - // Plugin added via a js file - this.state = CONST.FILE_PROCESSING; + if (layer === null) { return null; } - this.data = document.createElement('script'); - this.data.language = 'javascript'; - this.data.type = 'text/javascript'; - this.data.defer = false; - this.data.text = this.xhrLoader.responseText; + TilemapComponents.SetCollisionFromCollisionGroup(collides, recalculateFaces, layer); - document.head.appendChild(this.data); + return this; + }, - pluginManager.installScenePlugin(systemKey, window[this.key], sceneKey, this.loader.scene, true); - } + /** + * Sets a global collision callback for the given tile index within the layer. This will affect all + * tiles on this layer that have the same index. If a callback is already set for the tile index it + * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile + * at a specific location on the map then see `setTileLocationCallback`. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#setTileIndexCallback + * @since 3.0.0 + * + * @param {(number|number[])} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. All values should be integers. + * @param {function} callback - The callback that will be invoked when the tile is collided with. + * @param {object} callbackContext - The context under which the callback is called. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + */ + setTileIndexCallback: function (indexes, callback, callbackContext, layer) + { + layer = this.getLayer(layer); - this.onProcessComplete(); - } + if (layer === null) { return null; } -}); + TilemapComponents.SetTileIndexCallback(indexes, callback, callbackContext, layer); -/** - * Adds a Scene Plugin Script file, or array of plugin files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.scenePlugin('ModPlayer', 'plugins/ModPlayer.js', 'modPlayer', 'mods'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String and not already in-use by another file in the Loader. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.scenePlugin({ - * key: 'modplayer', - * url: 'plugins/ModPlayer.js' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.ScenePluginFileConfig` for more details. - * - * Once the file has finished loading it will automatically be converted into a script element - * via `document.createElement('script')`. It will have its language set to JavaScript, `defer` set to - * false and then the resulting element will be appended to `document.head`. Any code then in the - * script will be executed. It will then be passed to the Phaser PluginCache.register method. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.js". It will always add `.js` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Script File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#scenePlugin - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.8.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.ScenePluginFileConfig|Phaser.Types.Loader.FileTypes.ScenePluginFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {(string|function)} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js". Or, set to a plugin function. - * @param {string} [systemKey] - If this plugin is to be added to Scene.Systems, this is the property key for it. - * @param {string} [sceneKey] - If this plugin is to be added to the Scene, this is the property key for it. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('scenePlugin', function (key, url, systemKey, sceneKey, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new ScenePluginFile(this, key[i])); - } - } - else + return this; + }, + + /** + * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. + * If a callback is already set for the tile index it will be replaced. Set the callback to null to + * remove it. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#setTileLocationCallback + * @since 3.0.0 + * + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {function} callback - The callback that will be invoked when the tile is collided with. + * @param {object} [callbackContext] - The context under which the callback is called. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + */ + setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext, layer) { - this.addFile(new ScenePluginFile(this, key, url, systemKey, sceneKey, xhrSettings)); - } + layer = this.getLayer(layer); - return this; -}); + if (layer === null) { return null; } -module.exports = ScenePluginFile; + TilemapComponents.SetTileLocationCallback(tileX, tileY, width, height, callback, callbackContext, layer); + return this; + }, -/***/ }), -/* 1358 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Sets the current layer to the LayerData associated with `layer`. + * + * @method Phaser.Tilemaps.Tilemap#setLayer + * @since 3.0.0 + * + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or a TilemapLayer. If not given will default to the maps current layer index. + * + * @return {this} This Tilemap object. + */ + setLayer: function (layer) + { + var index = this.getLayerIndex(layer); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (index !== null) + { + this.currentLayerIndex = index; + } -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var ImageFile = __webpack_require__(71); + return this; + }, -/** - * @classdesc - * A single Sprite Sheet Image File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#spritesheet method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#spritesheet. - * - * @class SpriteSheetFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.SpriteSheetFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string|string[]} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {Phaser.Types.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var SpriteSheetFile = new Class({ + /** + * Sets the base tile size for the map. Note: this does not necessarily match the tileWidth and + * tileHeight for all layers. This also updates the base size on all tiles across all layers. + * + * @method Phaser.Tilemaps.Tilemap#setBaseTileSize + * @since 3.0.0 + * + * @param {number} tileWidth - The width of the tiles the map uses for calculations. + * @param {number} tileHeight - The height of the tiles the map uses for calculations. + * + * @return {this} This Tilemap object. + */ + setBaseTileSize: function (tileWidth, tileHeight) + { + this.tileWidth = tileWidth; + this.tileHeight = tileHeight; + this.widthInPixels = this.width * tileWidth; + this.heightInPixels = this.height * tileHeight; - Extends: ImageFile, + // Update the base tile size on all layers & tiles + for (var i = 0; i < this.layers.length; i++) + { + this.layers[i].baseTileWidth = tileWidth; + this.layers[i].baseTileHeight = tileHeight; - initialize: + var mapData = this.layers[i].data; + var mapWidth = this.layers[i].width; + var mapHeight = this.layers[i].height; - function SpriteSheetFile (loader, key, url, frameConfig, xhrSettings) - { - ImageFile.call(this, loader, key, url, xhrSettings, frameConfig); + for (var row = 0; row < mapHeight; row++) + { + for (var col = 0; col < mapWidth; col++) + { + var tile = mapData[row][col]; - this.type = 'spritesheet'; + if (tile !== null) + { + tile.setSize(undefined, undefined, tileWidth, tileHeight); + } + } + } + } + + return this; }, /** - * Adds this file to its target cache upon successful loading and processing. + * Sets the tile size for a specific `layer`. Note: this does not necessarily match the maps + * tileWidth and tileHeight for all layers. This will set the tile size for the layer and any + * tiles the layer has. * - * @method Phaser.Loader.FileTypes.SpriteSheetFile#addToCache - * @since 3.7.0 + * @method Phaser.Tilemaps.Tilemap#setLayerTileSize + * @since 3.0.0 + * + * @param {number} tileWidth - The width of the tiles (in pixels) in the layer. + * @param {number} tileHeight - The height of the tiles (in pixels) in the layer. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The name of the layer from Tiled, the index of the layer in the map or a TilemapLayer. If not given will default to the maps current layer index. + * + * @return {this} This Tilemap object. */ - addToCache: function () + setLayerTileSize: function (tileWidth, tileHeight, layer) { - var texture = this.cache.addSpriteSheet(this.key, this.data, this.config); + layer = this.getLayer(layer); - this.pendingDestroy(texture); - } + if (layer === null) { return this; } -}); + layer.tileWidth = tileWidth; + layer.tileHeight = tileHeight; -/** - * Adds a Sprite Sheet Image, or array of Sprite Sheet Images, to the current load queue. - * - * The term 'Sprite Sheet' in Phaser means a fixed-size sheet. Where every frame in the sheet is the exact same size, - * and you reference those frames using numbers, not frame names. This is not the same thing as a Texture Atlas, where - * the frames are packed in a way where they take up the least amount of space, and are referenced by their names, - * not numbers. Some articles and software use the term 'Sprite Sheet' to mean Texture Atlas, so please be aware of - * what sort of file you're actually trying to load. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.spritesheet('bot', 'images/robot.png', { frameWidth: 32, frameHeight: 38 }); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. - * If you try to load an animated gif only the first frame will be rendered. Browsers do not natively support playback - * of animated gifs to Canvas elements. - * - * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Texture Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.spritesheet({ - * key: 'bot', - * url: 'images/robot.png', - * frameConfig: { - * frameWidth: 32, - * frameHeight: 38, - * startFrame: 0, - * endFrame: 8 - * } - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.SpriteSheetFileConfig` for more details. - * - * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key: - * - * ```javascript - * this.load.spritesheet('bot', 'images/robot.png', { frameWidth: 32, frameHeight: 38 }); - * // and later in your game ... - * this.add.image(x, y, 'bot', 0); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `PLAYER.` and the key was `Running` the final key will be `PLAYER.Running` and - * this is what you would use to retrieve the image from the Texture Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, - * then you can specify it by providing an array as the `url` where the second element is the normal map: - * - * ```javascript - * this.load.spritesheet('logo', [ 'images/AtariLogo.png', 'images/AtariLogo-n.png' ], { frameWidth: 256, frameHeight: 80 }); - * ``` - * - * Or, if you are using a config object use the `normalMap` property: - * - * ```javascript - * this.load.spritesheet({ - * key: 'logo', - * url: 'images/AtariLogo.png', - * normalMap: 'images/AtariLogo-n.png', - * frameConfig: { - * frameWidth: 256, - * frameHeight: 80 - * } - * }); - * ``` - * - * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. - * Normal maps are a WebGL only feature. - * - * Note: The ability to load this type of file will only be available if the Sprite Sheet File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#spritesheet - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.SpriteSheetFileConfig|Phaser.Types.Loader.FileTypes.SpriteSheetFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {Phaser.Types.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. At a minimum it should have a `frameWidth` property. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('spritesheet', function (key, url, frameConfig, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) + var mapData = layer.data; + var mapWidth = layer.width; + var mapHeight = layer.height; + + for (var row = 0; row < mapHeight; row++) { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new SpriteSheetFile(this, key[i])); + for (var col = 0; col < mapWidth; col++) + { + var tile = mapData[row][col]; + + if (tile !== null) + { + tile.setSize(tileWidth, tileHeight); + } + } } - } - else - { - this.addFile(new SpriteSheetFile(this, key, url, frameConfig, xhrSettings)); - } - return this; -}); + return this; + }, -module.exports = SpriteSheetFile; + /** + * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given + * layer. It will only randomize the tiles in that area, so if they're all the same nothing will + * appear to have changed! This method only modifies tile indexes and does not change collision + * information. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#shuffle + * @since 3.0.0 + * + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + */ + shuffle: function (tileX, tileY, width, height, layer) + { + layer = this.getLayer(layer); + if (layer === null) { return null; } -/***/ }), -/* 1359 */ -/***/ (function(module, exports, __webpack_require__) { + TilemapComponents.Shuffle(tileX, tileY, width, height, layer); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); + /** + * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching + * `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision + * information. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#swapByIndex + * @since 3.0.0 + * + * @param {number} tileA - First tile index. + * @param {number} tileB - Second tile index. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + */ + swapByIndex: function (indexA, indexB, tileX, tileY, width, height, layer) + { + layer = this.getLayer(layer); -/** - * @classdesc - * A single SVG File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#svg method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#svg. - * - * @class SVGFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.SVGFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.svg`, i.e. if `key` was "alien" then the URL will be "alien.svg". - * @param {Phaser.Types.Loader.FileTypes.SVGSizeConfig} [svgConfig] - The svg size configuration object. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var SVGFile = new Class({ + if (layer === null) { return null; } - Extends: File, + TilemapComponents.SwapByIndex(indexA, indexB, tileX, tileY, width, height, layer); - initialize: + return this; + }, - function SVGFile (loader, key, url, svgConfig, xhrSettings) + /** + * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the + * layers position, scale and scroll. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#tileToWorldX + * @since 3.0.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?number} Returns a number, or null if the layer given was invalid. + */ + tileToWorldX: function (tileX, camera, layer) { - var extension = 'svg'; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - svgConfig = GetFastValue(config, 'svgConfig', {}); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - } + layer = this.getLayer(layer); - var fileConfig = { - type: 'svg', - cache: loader.textureManager, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings, - config: { - width: GetFastValue(svgConfig, 'width'), - height: GetFastValue(svgConfig, 'height'), - scale: GetFastValue(svgConfig, 'scale') - } - }; + if (layer === null) { return null; } - File.call(this, loader, fileConfig); + return this._convert.TileToWorldX(tileX, camera, layer); }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the + * layers position, scale and scroll. * - * @method Phaser.Loader.FileTypes.SVGFile#onProcess - * @since 3.7.0 + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#tileToWorldY + * @since 3.0.0 + * + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?number} Returns a number, or null if the layer given was invalid. */ - onProcess: function () + tileToWorldY: function (tileY, camera, layer) { - this.state = CONST.FILE_PROCESSING; - - var text = this.xhrLoader.responseText; - var svg = [ text ]; - var width = this.config.width; - var height = this.config.height; - var scale = this.config.scale; + layer = this.getLayer(layer); - resize: if (width && height || scale) - { - var xml = null; - var parser = new DOMParser(); - xml = parser.parseFromString(text, 'text/xml'); - var svgXML = xml.getElementsByTagName('svg')[0]; + if (layer === null) { return null; } - var hasViewBox = svgXML.hasAttribute('viewBox'); - var svgWidth = parseFloat(svgXML.getAttribute('width')); - var svgHeight = parseFloat(svgXML.getAttribute('height')); + return this._convert.TileToWorldY(tileY, camera, layer); + }, - if (!hasViewBox && svgWidth && svgHeight) - { - // If there's no viewBox attribute, set one - svgXML.setAttribute('viewBox', '0 0 ' + svgWidth + ' ' + svgHeight); - } - else if (hasViewBox && !svgWidth && !svgHeight) - { - // Get the w/h from the viewbox - var viewBox = svgXML.getAttribute('viewBox').split(/\s+|,/); + /** + * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layers position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#tileToWorldXY + * @since 3.0.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} [vec2] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Math.Vector2} Returns a Vector2, or null if the layer given was invalid. + */ + tileToWorldXY: function (tileX, tileY, vec2, camera, layer) + { + layer = this.getLayer(layer); - svgWidth = viewBox[2]; - svgHeight = viewBox[3]; - } + if (layer === null) { return null; } - if (scale) - { - if (svgWidth && svgHeight) - { - width = svgWidth * scale; - height = svgHeight * scale; - } - else - { - break resize; - } - } + return this._convert.TileToWorldXY(tileX, tileY, vec2, camera, layer); + }, - svgXML.setAttribute('width', width.toString() + 'px'); - svgXML.setAttribute('height', height.toString() + 'px'); + /** + * Returns an array of Vector2s where each entry corresponds to the corner of the requested tile. + * + * The `tileX` and `tileY` parameters are in tile coordinates, not world coordinates. + * + * The corner coordinates are in world space, having factored in TilemapLayer scale, position + * and the camera, if given. + * + * The size of the array will vary based on the orientation of the map. For example an + * orthographic map will return an array of 4 vectors, where-as a hexagonal map will, + * of course, return an array of 6 corner vectors. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#getTileCorners + * @since 3.60.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Math.Vector2[]} Returns an array of Vector2s, or null if the layer given was invalid. + */ + getTileCorners: function (tileX, tileY, camera, layer) + { + layer = this.getLayer(layer); - svg = [ (new XMLSerializer()).serializeToString(svgXML) ]; - } + if (layer === null) { return null; } - try - { - var blob = new window.Blob(svg, { type: 'image/svg+xml;charset=utf-8' }); - } - catch (e) - { - this.onProcessError(); + return this._convert.GetTileCorners(tileX, tileY, camera, layer); + }, - return; - } + /** + * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the + * specified layer. Each tile will receive a new index. New indexes are drawn from the given + * weightedIndexes array. An example weighted array: + * + * [ + * { index: 6, weight: 4 }, // Probability of index 6 is 4 / 8 + * { index: 7, weight: 2 }, // Probability of index 7 would be 2 / 8 + * { index: 8, weight: 1.5 }, // Probability of index 8 would be 1.5 / 8 + * { index: 26, weight: 0.5 } // Probability of index 27 would be 0.5 / 8 + * ] + * + * The probability of any index being picked is (the indexs weight) / (sum of all weights). This + * method only modifies tile indexes and does not change collision information. + * + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#weightedRandomize + * @since 3.0.0 + * + * @param {object[]} weightedIndexes - An array of objects to randomly draw from during randomization. They should be in the form: { index: 0, weight: 4 } or { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid. + */ + weightedRandomize: function (weightedIndexes, tileX, tileY, width, height, layer) + { + layer = this.getLayer(layer); - this.data = new Image(); + if (layer === null) { return null; } - this.data.crossOrigin = this.crossOrigin; + TilemapComponents.WeightedRandomize(tileX, tileY, width, height, weightedIndexes, layer); - var _this = this; - var retry = false; + return this; + }, - this.data.onload = function () - { - if (!retry) - { - File.revokeObjectURL(_this.data); - } + /** + * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the + * layers position, scale and scroll. + * + * If no layer is specified, the maps current layer is used. + * + * You cannot call this method for Isometric or Hexagonal tilemaps as they require + * both `worldX` and `worldY` values to determine the correct tile, instead you + * should use the `worldToTileXY` method. + * + * @method Phaser.Tilemaps.Tilemap#worldToTileX + * @since 3.0.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?number} Returns a number, or null if the layer given was invalid. + */ + worldToTileX: function (worldX, snapToFloor, camera, layer) + { + layer = this.getLayer(layer); - _this.onProcessComplete(); - }; + if (layer === null) { return null; } - this.data.onerror = function () - { - // Safari 8 re-try - if (!retry) - { - retry = true; + return this._convert.WorldToTileX(worldX, snapToFloor, camera, layer); + }, - File.revokeObjectURL(_this.data); + /** + * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the + * layers position, scale and scroll. + * + * If no layer is specified, the maps current layer is used. + * + * You cannot call this method for Isometric or Hexagonal tilemaps as they require + * both `worldX` and `worldY` values to determine the correct tile, instead you + * should use the `worldToTileXY` method. + * + * @method Phaser.Tilemaps.Tilemap#worldToTileY + * @since 3.0.0 + * + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?number} Returns a number, or null if the layer given was invalid. + */ + worldToTileY: function (worldY, snapToFloor, camera, layer) + { + layer = this.getLayer(layer); - _this.data.src = 'data:image/svg+xml,' + encodeURIComponent(svg.join('')); - } - else - { - _this.onProcessError(); - } - }; + if (layer === null) { return null; } - File.createObjectURL(this.data, blob, 'image/svg+xml'); + return this._convert.WorldToTileY(worldY, snapToFloor, camera, layer); }, /** - * Adds this file to its target cache upon successful loading and processing. + * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the + * layers position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. * - * @method Phaser.Loader.FileTypes.SVGFile#addToCache - * @since 3.7.0 + * If no layer is specified, the maps current layer is used. + * + * @method Phaser.Tilemaps.Tilemap#worldToTileXY + * @since 3.0.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} [vec2] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * @param {(string|number|Phaser.Tilemaps.TilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used. + * + * @return {?Phaser.Math.Vector2} Returns a vec2, or null if the layer given was invalid. */ - addToCache: function () + worldToTileXY: function (worldX, worldY, snapToFloor, vec2, camera, layer) { - var texture = this.cache.addImage(this.key, this.data); + layer = this.getLayer(layer); - this.pendingDestroy(texture); - } + if (layer === null) { return null; } -}); + return this._convert.WorldToTileXY(worldX, worldY, snapToFloor, vec2, camera, layer); + }, -/** - * Adds an SVG File, or array of SVG Files, to the current load queue. When the files are loaded they - * will be rendered to bitmap textures and stored in the Texture Manager. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.svg('morty', 'images/Morty.svg'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Texture Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.svg({ - * key: 'morty', - * url: 'images/Morty.svg' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.SVGFileConfig` for more details. - * - * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key: - * - * ```javascript - * this.load.svg('morty', 'images/Morty.svg'); - * // and later in your game ... - * this.add.image(x, y, 'morty'); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and - * this is what you would use to retrieve the image from the Texture Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.html". It will always add `.html` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * You can optionally pass an SVG Resize Configuration object when you load an SVG file. By default the SVG will be rendered to a texture - * at the same size defined in the SVG file attributes. However, this isn't always desirable. You may wish to resize the SVG (either down - * or up) to improve texture clarity, or reduce texture memory consumption. You can either specify an exact width and height to resize - * the SVG to: - * - * ```javascript - * function preload () - * { - * this.load.svg('morty', 'images/Morty.svg', { width: 300, height: 600 }); - * } - * ``` - * - * Or when using a configuration object: - * - * ```javascript - * this.load.svg({ - * key: 'morty', - * url: 'images/Morty.svg', - * svgConfig: { - * width: 300, - * height: 600 - * } - * }); - * ``` - * - * Alternatively, you can just provide a scale factor instead: - * - * ```javascript - * function preload () - * { - * this.load.svg('morty', 'images/Morty.svg', { scale: 2.5 }); - * } - * ``` - * - * Or when using a configuration object: - * - * ```javascript - * this.load.svg({ - * key: 'morty', - * url: 'images/Morty.svg', - * svgConfig: { - * scale: 2.5 - * } - * }); - * ``` - * - * If scale, width and height values are all given, the scale has priority and the width and height values are ignored. - * - * Note: The ability to load this type of file will only be available if the SVG File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#svg - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.SVGFileConfig|Phaser.Types.Loader.FileTypes.SVGFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.svg`, i.e. if `key` was "alien" then the URL will be "alien.svg". - * @param {Phaser.Types.Loader.FileTypes.SVGSizeConfig} [svgConfig] - The svg size configuration object. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('svg', function (key, url, svgConfig, xhrSettings) -{ - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new SVGFile(this, key[i])); - } - } - else + /** + * Removes all layer data from this Tilemap and nulls the scene reference. This will destroy any + * TilemapLayers that have been created. + * + * @method Phaser.Tilemaps.Tilemap#destroy + * @since 3.0.0 + */ + destroy: function () { - this.addFile(new SVGFile(this, key, url, svgConfig, xhrSettings)); + this.removeAllLayers(); + + this.tiles.length = 0; + this.tilesets.length = 0; + this.objects.length = 0; + + this.scene = null; } - return this; }); -module.exports = SVGFile; - +module.exports = Tilemap; /***/ }), -/* 1360 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 4843: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); -var TILEMAP_FORMATS = __webpack_require__(40); +var GameObjectCreator = __webpack_require__(99325); +var ParseToTilemap = __webpack_require__(15043); /** - * @classdesc - * A single Tilemap CSV File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#tilemapCSV method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#tilemapCSV. + * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. + * When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing + * from a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map + * data. For an empty map, you should specify tileWidth, tileHeight, width & height. * - * @class TilemapCSVFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor + * @method Phaser.GameObjects.GameObjectCreator#tilemap * @since 3.0.0 * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.TilemapCSVFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.csv`, i.e. if `key` was "alien" then the URL will be "alien.csv". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @param {Phaser.Types.Tilemaps.TilemapConfig} [config] - The config options for the Tilemap. + * + * @return {Phaser.Tilemaps.Tilemap} */ -var TilemapCSVFile = new Class({ - - Extends: File, - - initialize: - - function TilemapCSVFile (loader, key, url, xhrSettings) - { - var extension = 'csv'; - - if (IsPlainObject(key)) - { - var config = key; - - key = GetFastValue(config, 'key'); - url = GetFastValue(config, 'url'); - xhrSettings = GetFastValue(config, 'xhrSettings'); - extension = GetFastValue(config, 'extension', extension); - } - - var fileConfig = { - type: 'tilemapCSV', - cache: loader.cacheManager.tilemap, - extension: extension, - responseType: 'text', - key: key, - url: url, - xhrSettings: xhrSettings - }; - - File.call(this, loader, fileConfig); - - this.tilemapFormat = TILEMAP_FORMATS.CSV; - }, - - /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. - * - * @method Phaser.Loader.FileTypes.TilemapCSVFile#onProcess - * @since 3.7.0 - */ - onProcess: function () - { - this.state = CONST.FILE_PROCESSING; +GameObjectCreator.register('tilemap', function (config) +{ + // Defaults are applied in ParseToTilemap + var c = (config !== undefined) ? config : {}; - this.data = this.xhrLoader.responseText; + return ParseToTilemap( + this.scene, + c.key, + c.tileWidth, + c.tileHeight, + c.width, + c.height, + c.data, + c.insertNull + ); +}); - this.onProcessComplete(); - }, - /** - * Adds this file to its target cache upon successful loading and processing. - * - * @method Phaser.Loader.FileTypes.TilemapCSVFile#addToCache - * @since 3.7.0 - */ - addToCache: function () - { - var tiledata = { format: this.tilemapFormat, data: this.data }; +/***/ }), - this.cache.add(this.key, tiledata); +/***/ 37940: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - this.pendingDestroy(tiledata); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -}); +var GameObjectFactory = __webpack_require__(61286); +var ParseToTilemap = __webpack_require__(15043); /** - * Adds a CSV Tilemap file, or array of CSV files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.tilemapCSV('level1', 'maps/Level1.csv'); - * } - * ``` - * - * Tilemap CSV data can be created in a text editor, or a 3rd party app that exports as CSV. - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Tilemap Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Tilemap Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Text Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.tilemapCSV({ - * key: 'level1', - * url: 'maps/Level1.csv' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.TilemapCSVFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.tilemapCSV('level1', 'maps/Level1.csv'); - * // and later in your game ... - * var map = this.make.tilemap({ key: 'level1' }); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and - * this is what you would use to retrieve the text from the Tilemap Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "level" - * and no URL is given then the Loader will set the URL to be "level.csv". It will always add `.csv` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Tilemap CSV File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. + * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. + * When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing + * from a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map + * data. For an empty map, you should specify tileWidth, tileHeight, width & height. * - * @method Phaser.Loader.LoaderPlugin#tilemapCSV - * @fires Phaser.Loader.LoaderPlugin#ADD + * @method Phaser.GameObjects.GameObjectFactory#tilemap * @since 3.0.0 * - * @param {(string|Phaser.Types.Loader.FileTypes.TilemapCSVFileConfig|Phaser.Types.Loader.FileTypes.TilemapCSVFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.csv`, i.e. if `key` was "alien" then the URL will be "alien.csv". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. + * @param {number} [tileWidth=32] - The width of a tile in pixels. Pass in `null` to leave as the + * default. + * @param {number} [tileHeight=32] - The height of a tile in pixels. Pass in `null` to leave as the + * default. + * @param {number} [width=10] - The width of the map in tiles. Pass in `null` to leave as the + * default. + * @param {number} [height=10] - The height of the map in tiles. Pass in `null` to leave as the + * default. + * @param {number[][]} [data] - Instead of loading from the cache, you can also load directly from + * a 2D array of tile indexes. Pass in `null` for no data. + * @param {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the + * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty + * location will get a Tile object with an index of -1. If you've a large sparsely populated map and + * the tile data doesn't need to change then setting this value to `true` will help with memory + * consumption. However if your map is small or you need to update the tiles dynamically, then leave + * the default value set. * - * @return {this} The Loader instance. + * @return {Phaser.Tilemaps.Tilemap} */ -FileTypesManager.register('tilemapCSV', function (key, url, xhrSettings) +GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, width, height, data, insertNull) { - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new TilemapCSVFile(this, key[i])); - } - } - else - { - this.addFile(new TilemapCSVFile(this, key, url, xhrSettings)); - } + // Allow users to specify null to indicate that they want the default value, since null is + // shorter & more legible than undefined. Convert null to undefined to allow ParseToTilemap + // defaults to take effect. - return this; + if (key === null) { key = undefined; } + if (tileWidth === null) { tileWidth = undefined; } + if (tileHeight === null) { tileHeight = undefined; } + if (width === null) { width = undefined; } + if (height === null) { height = undefined; } + + return ParseToTilemap(this.scene, key, tileWidth, tileHeight, width, height, data, insertNull); }); -module.exports = TilemapCSVFile; +// When registering a factory function 'this' refers to the GameObjectFactory context. +// +// There are several properties available to use: +// +// this.scene - a reference to the Scene that owns the GameObjectFactory +// this.displayList - a reference to the Display List the Scene owns +// this.updateList - a reference to the Update List the Scene owns /***/ }), -/* 1361 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 87177: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var JSONFile = __webpack_require__(61); -var TILEMAP_FORMATS = __webpack_require__(40); +var Class = __webpack_require__(56694); +var Components = __webpack_require__(64937); +var GameObject = __webpack_require__(89980); +var TilemapComponents = __webpack_require__(5047); +var TilemapLayerRender = __webpack_require__(96193); +var Vector2 = __webpack_require__(93736); /** * @classdesc - * A single Impact.js Tilemap JSON File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#tilemapImpact method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#tilemapImpact. + * A Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination + * with one, or more, Tilesets. * - * @class TilemapImpactFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes + * @class TilemapLayer + * @extends Phaser.GameObjects.GameObject + * @memberof Phaser.Tilemaps * @constructor - * @since 3.7.0 + * @since 3.50.0 * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.TilemapImpactFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. + * @extends Phaser.GameObjects.Components.Alpha + * @extends Phaser.GameObjects.Components.BlendMode + * @extends Phaser.GameObjects.Components.ComputedSize + * @extends Phaser.GameObjects.Components.Depth + * @extends Phaser.GameObjects.Components.Flip + * @extends Phaser.GameObjects.Components.GetBounds + * @extends Phaser.GameObjects.Components.Mask + * @extends Phaser.GameObjects.Components.Origin + * @extends Phaser.GameObjects.Components.Pipeline + * @extends Phaser.GameObjects.Components.PostPipeline + * @extends Phaser.GameObjects.Components.ScrollFactor + * @extends Phaser.GameObjects.Components.Transform + * @extends Phaser.GameObjects.Components.Visible + * + * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. + * @param {Phaser.Tilemaps.Tilemap} tilemap - The Tilemap this layer is a part of. + * @param {number} layerIndex - The index of the LayerData associated with this layer. + * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. + * @param {number} [x=0] - The world x position where the top left of this layer will be placed. + * @param {number} [y=0] - The world y position where the top left of this layer will be placed. */ -var TilemapImpactFile = new Class({ +var TilemapLayer = new Class({ - Extends: JSONFile, + Extends: GameObject, + + Mixins: [ + Components.Alpha, + Components.BlendMode, + Components.ComputedSize, + Components.Depth, + Components.Flip, + Components.GetBounds, + Components.Mask, + Components.Origin, + Components.Pipeline, + Components.PostPipeline, + Components.Transform, + Components.Visible, + Components.ScrollFactor, + TilemapLayerRender + ], initialize: - function TilemapImpactFile (loader, key, url, xhrSettings) + function TilemapLayer (scene, tilemap, layerIndex, tileset, x, y) { - JSONFile.call(this, loader, key, url, xhrSettings); + GameObject.call(this, scene, 'TilemapLayer'); - this.type = 'tilemapJSON'; + /** + * Used internally by physics system to perform fast type checks. + * + * @name Phaser.Tilemaps.TilemapLayer#isTilemap + * @type {boolean} + * @readonly + * @since 3.50.0 + */ + this.isTilemap = true; - this.cache = loader.cacheManager.tilemap; + /** + * The Tilemap that this layer is a part of. + * + * @name Phaser.Tilemaps.TilemapLayer#tilemap + * @type {Phaser.Tilemaps.Tilemap} + * @since 3.50.0 + */ + this.tilemap = tilemap; + + /** + * The index of the LayerData associated with this layer. + * + * @name Phaser.Tilemaps.TilemapLayer#layerIndex + * @type {number} + * @since 3.50.0 + */ + this.layerIndex = layerIndex; + + /** + * The LayerData associated with this layer. LayerData can only be associated with one + * tilemap layer. + * + * @name Phaser.Tilemaps.TilemapLayer#layer + * @type {Phaser.Tilemaps.LayerData} + * @since 3.50.0 + */ + this.layer = tilemap.layers[layerIndex]; + + // Link the LayerData with this static tilemap layer + this.layer.tilemapLayer = this; + + /** + * An array of `Tileset` objects associated with this layer. + * + * @name Phaser.Tilemaps.TilemapLayer#tileset + * @type {Phaser.Tilemaps.Tileset[]} + * @since 3.50.0 + */ + this.tileset = []; + + /** + * The total number of tiles drawn by the renderer in the last frame. + * + * @name Phaser.Tilemaps.TilemapLayer#tilesDrawn + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.tilesDrawn = 0; + + /** + * The total number of tiles in this layer. Updated every frame. + * + * @name Phaser.Tilemaps.TilemapLayer#tilesTotal + * @type {number} + * @readonly + * @since 3.50.0 + */ + this.tilesTotal = this.layer.width * this.layer.height; + + /** + * Used internally during rendering. This holds the tiles that are visible within the Camera. + * + * @name Phaser.Tilemaps.TilemapLayer#culledTiles + * @type {Phaser.Tilemaps.Tile[]} + * @since 3.50.0 + */ + this.culledTiles = []; + + /** + * You can control if the camera should cull tiles on this layer before rendering them or not. + * + * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. + * + * However, there are some instances when you may wish to disable this, and toggling this flag allows + * you to do so. Also see `setSkipCull` for a chainable method that does the same thing. + * + * @name Phaser.Tilemaps.TilemapLayer#skipCull + * @type {boolean} + * @since 3.50.0 + */ + this.skipCull = false; + + /** + * The amount of extra tiles to add into the cull rectangle when calculating its horizontal size. + * + * See the method `setCullPadding` for more details. + * + * @name Phaser.Tilemaps.TilemapLayer#cullPaddingX + * @type {number} + * @default 1 + * @since 3.50.0 + */ + this.cullPaddingX = 1; + + /** + * The amount of extra tiles to add into the cull rectangle when calculating its vertical size. + * + * See the method `setCullPadding` for more details. + * + * @name Phaser.Tilemaps.TilemapLayer#cullPaddingY + * @type {number} + * @default 1 + * @since 3.50.0 + */ + this.cullPaddingY = 1; + + /** + * The callback that is invoked when the tiles are culled. + * + * It will call a different function based on the map orientation: + * + * Orthogonal (the default) is `TilemapComponents.CullTiles` + * Isometric is `TilemapComponents.IsometricCullTiles` + * Hexagonal is `TilemapComponents.HexagonalCullTiles` + * Staggered is `TilemapComponents.StaggeredCullTiles` + * + * However, you can override this to call any function you like. + * + * It will be sent 4 arguments: + * + * 1. The Phaser.Tilemaps.LayerData object for this Layer + * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull. + * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered. + * 4. The Render Order constant. + * + * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system. + * + * @name Phaser.Tilemaps.TilemapLayer#cullCallback + * @type {function} + * @since 3.50.0 + */ + this.cullCallback = TilemapComponents.GetCullTilesFunction(this.layer.orientation); + + /** + * The rendering (draw) order of the tiles in this layer. + * + * The default is 0 which is 'right-down', meaning it will draw the tiles starting from the top-left, + * drawing to the right and then moving down to the next row. + * + * The draw orders are: + * + * 0 = right-down + * 1 = left-down + * 2 = right-up + * 3 = left-up + * + * This can be changed via the `setRenderOrder` method. + * + * @name Phaser.Tilemaps.TilemapLayer#_renderOrder + * @type {number} + * @default 0 + * @private + * @since 3.50.0 + */ + this._renderOrder = 0; + + /** + * An array holding the mapping between the tile indexes and the tileset they belong to. + * + * @name Phaser.Tilemaps.TilemapLayer#gidMap + * @type {Phaser.Tilemaps.Tileset[]} + * @since 3.50.0 + */ + this.gidMap = []; + + /** + * A temporary Vector2 used in the tile coordinate methods. + * + * @name Phaser.Tilemaps.TilemapLayer#tempVec + * @type {Phaser.Math.Vector2} + * @private + * @since 3.60.0 + */ + this.tempVec = new Vector2(); + + /** + * The horizontal origin of this Tilemap Layer. + * + * @name Phaser.Tilemaps.TilemapLayer#originX + * @type {number} + * @default 0 + * @readOnly + * @since 3.0.0 + */ + + /** + * The vertical origin of this Tilemap Layer. + * + * @name Phaser.Tilemaps.TilemapLayer#originY + * @type {number} + * @default 0 + * @readOnly + * @since 3.0.0 + */ + + /** + * The horizontal display origin of this Tilemap Layer. + * + * @name Phaser.Tilemaps.TilemapLayer#displayOriginX + * @type {number} + * @default 0 + * @readOnly + * @since 3.0.0 + */ + + /** + * The vertical display origin of this Tilemap Layer. + * + * @name Phaser.Tilemaps.TilemapLayer#displayOriginY + * @type {number} + * @default 0 + * @readOnly + * @since 3.0.0 + */ + + this.setTilesets(tileset); + this.setAlpha(this.layer.alpha); + this.setPosition(x, y); + this.setOrigin(0, 0); + this.setSize(tilemap.tileWidth * this.layer.width, tilemap.tileHeight * this.layer.height); + + this.initPipeline(); + this.initPostPipeline(false); }, /** - * Adds this file to its target cache upon successful loading and processing. + * Populates the internal `tileset` array with the Tileset references this Layer requires for rendering. * - * @method Phaser.Loader.FileTypes.TilemapImpactFile#addToCache - * @since 3.7.0 + * @method Phaser.Tilemaps.TilemapLayer#setTilesets + * @private + * @since 3.50.0 + * + * @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object. */ - addToCache: function () + setTilesets: function (tilesets) { - var tiledata = { format: TILEMAP_FORMATS.WELTMEISTER, data: this.data }; + var gidMap = []; + var setList = []; + var map = this.tilemap; - this.cache.add(this.key, tiledata); + if (!Array.isArray(tilesets)) + { + tilesets = [ tilesets ]; + } - this.pendingDestroy(tiledata); - } + for (var i = 0; i < tilesets.length; i++) + { + var tileset = tilesets[i]; -}); + if (typeof tileset === 'string') + { + tileset = map.getTileset(tileset); + } -/** - * Adds an Impact.js Tilemap file, or array of map files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.tilemapImpact('level1', 'maps/Level1.json'); - * } - * ``` - * - * Impact Tilemap data is created the Impact.js Map Editor called Weltmeister. - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Tilemap Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Tilemap Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Text Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.tilemapImpact({ - * key: 'level1', - * url: 'maps/Level1.json' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.TilemapImpactFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.tilemapImpact('level1', 'maps/Level1.json'); - * // and later in your game ... - * var map = this.make.tilemap({ key: 'level1' }); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and - * this is what you would use to retrieve the text from the Tilemap Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "level" - * and no URL is given then the Loader will set the URL to be "level.json". It will always add `.json` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Tilemap Impact File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#tilemapImpact - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.7.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.TilemapImpactFileConfig|Phaser.Types.Loader.FileTypes.TilemapImpactFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('tilemapImpact', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) + if (tileset) + { + setList.push(tileset); + + var s = tileset.firstgid; + + for (var t = 0; t < tileset.total; t++) + { + gidMap[s + t] = tileset; + } + } + } + + this.gidMap = gidMap; + this.tileset = setList; + }, + + /** + * Sets the rendering (draw) order of the tiles in this layer. + * + * The default is 'right-down', meaning it will order the tiles starting from the top-left, + * drawing to the right and then moving down to the next row. + * + * The draw orders are: + * + * 0 = right-down + * 1 = left-down + * 2 = right-up + * 3 = left-up + * + * Setting the render order does not change the tiles or how they are stored in the layer, + * it purely impacts the order in which they are rendered. + * + * You can provide either an integer (0 to 3), or the string version of the order. + * + * @method Phaser.Tilemaps.TilemapLayer#setRenderOrder + * @since 3.50.0 + * + * @param {(number|string)} renderOrder - The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'. + * + * @return {this} This Tilemap Layer object. + */ + setRenderOrder: function (renderOrder) { - for (var i = 0; i < key.length; i++) + var orders = [ 'right-down', 'left-down', 'right-up', 'left-up' ]; + + if (typeof renderOrder === 'string') { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new TilemapImpactFile(this, key[i])); + renderOrder = orders.indexOf(renderOrder); } - } - else - { - this.addFile(new TilemapImpactFile(this, key, url, xhrSettings)); - } - - return this; -}); - -module.exports = TilemapImpactFile; + if (renderOrder >= 0 && renderOrder < 4) + { + this._renderOrder = renderOrder; + } -/***/ }), -/* 1362 */ -/***/ (function(module, exports, __webpack_require__) { + return this; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting + * faces are used internally for optimizing collisions against tiles. This method is mostly used + * internally to optimize recalculating faces when only one tile has been changed. + * + * @method Phaser.Tilemaps.TilemapLayer#calculateFacesAt + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate. + * @param {number} tileY - The y coordinate. + * + * @return {this} This Tilemap Layer object. + */ + calculateFacesAt: function (tileX, tileY) + { + TilemapComponents.CalculateFacesAt(tileX, tileY, this.layer); -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var JSONFile = __webpack_require__(61); -var TILEMAP_FORMATS = __webpack_require__(40); + return this; + }, -/** - * @classdesc - * A single Tiled Tilemap JSON File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#tilemapTiledJSON method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#tilemapTiledJSON. - * - * @class TilemapJSONFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.TilemapJSONFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {object|string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var TilemapJSONFile = new Class({ + /** + * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the + * layer. Interesting faces are used internally for optimizing collisions against tiles. This method + * is mostly used internally. + * + * @method Phaser.Tilemaps.TilemapLayer#calculateFacesWithin + * @since 3.50.0 + * + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * + * @return {this} This Tilemap Layer object. + */ + calculateFacesWithin: function (tileX, tileY, width, height) + { + TilemapComponents.CalculateFacesWithin(tileX, tileY, width, height, this.layer); - Extends: JSONFile, + return this; + }, - initialize: + /** + * Creates a Sprite for every object matching the given tile indexes in the layer. You can + * optionally specify if each tile will be replaced with a new tile after the Sprite has been + * created. This is useful if you want to lay down special tiles in a level that are converted to + * Sprites, but want to replace the tile itself with a floor tile or similar once converted. + * + * @method Phaser.Tilemaps.TilemapLayer#createFromTiles + * @since 3.50.0 + * + * @param {(number|array)} indexes - The tile index, or array of indexes, to create Sprites from. + * @param {?(number|array)} replacements - The tile index, or array of indexes, to change a converted + * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a + * one-to-one mapping with the indexes array. + * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} [spriteConfig] - The config object to pass into the Sprite creator (i.e. + * scene.make.sprite). + * @param {Phaser.Scene} [scene] - The Scene to create the Sprites within. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when determining the world XY + * + * @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created. + */ + createFromTiles: function (indexes, replacements, spriteConfig, scene, camera) + { + return TilemapComponents.CreateFromTiles(indexes, replacements, spriteConfig, scene, camera, this.layer); + }, - function TilemapJSONFile (loader, key, url, xhrSettings) + /** + * Returns the tiles in the given layer that are within the cameras viewport. + * This is used internally during rendering. + * + * @method Phaser.Tilemaps.TilemapLayer#cull + * @since 3.50.0 + * + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects to render. + */ + cull: function (camera) { - JSONFile.call(this, loader, key, url, xhrSettings); + return this.cullCallback(this.layer, camera, this.culledTiles, this._renderOrder); + }, - this.type = 'tilemapJSON'; + /** + * Copies the tiles in the source rectangular area to a new destination (all specified in tile + * coordinates) within the layer. This copies all tile properties & recalculates collision + * information in the destination region. + * + * @method Phaser.Tilemaps.TilemapLayer#copy + * @since 3.50.0 + * + * @param {number} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. + * @param {number} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. + * @param {number} width - The width of the area to copy, in tiles, not pixels. + * @param {number} height - The height of the area to copy, in tiles, not pixels. + * @param {number} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. + * @param {number} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. + * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * + * @return {this} This Tilemap Layer object. + */ + copy: function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces) + { + TilemapComponents.Copy(srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, this.layer); - this.cache = loader.cacheManager.tilemap; + return this; }, /** - * Adds this file to its target cache upon successful loading and processing. + * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the + * specified index. Tiles will be set to collide if the given index is a colliding index. + * Collision information in the region will be recalculated. * - * @method Phaser.Loader.FileTypes.TilemapJSONFile#addToCache - * @since 3.7.0 + * @method Phaser.Tilemaps.TilemapLayer#fill + * @since 3.50.0 + * + * @param {number} index - The tile index to fill the area with. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * + * @return {this} This Tilemap Layer object. */ - addToCache: function () + fill: function (index, tileX, tileY, width, height, recalculateFaces) { - var tiledata = { format: TILEMAP_FORMATS.TILED_JSON, data: this.data }; - - this.cache.add(this.key, tiledata); + TilemapComponents.Fill(index, tileX, tileY, width, height, recalculateFaces, this.layer); - this.pendingDestroy(tiledata); - } + return this; + }, -}); + /** + * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given + * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns + * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS. + * + * @method Phaser.Tilemaps.TilemapLayer#filterTiles + * @since 3.50.0 + * + * @param {function} callback - The callback. Each tile in the given area will be passed to this + * callback as the first and only parameter. The callback should return true for tiles that pass the + * filter. + * @param {object} [context] - The context under which the callback should be run. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + */ + filterTiles: function (callback, context, tileX, tileY, width, height, filteringOptions) + { + return TilemapComponents.FilterTiles(callback, context, tileX, tileY, width, height, filteringOptions, this.layer); + }, -/** - * Adds a Tiled JSON Tilemap file, or array of map files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.tilemapTiledJSON('level1', 'maps/Level1.json'); - * } - * ``` - * - * The Tilemap data is created using the Tiled Map Editor and selecting JSON as the export format. - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Tilemap Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Tilemap Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Text Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.tilemapTiledJSON({ - * key: 'level1', - * url: 'maps/Level1.json' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.TilemapJSONFileConfig` for more details. - * - * Once the file has finished loading you can access it from its Cache using its key: - * - * ```javascript - * this.load.tilemapTiledJSON('level1', 'maps/Level1.json'); - * // and later in your game ... - * var map = this.make.tilemap({ key: 'level1' }); - * ``` - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `LEVEL1.` and the key was `Story` the final key will be `LEVEL1.Story` and - * this is what you would use to retrieve the text from the Tilemap Cache. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "level" - * and no URL is given then the Loader will set the URL to be "level.json". It will always add `.json` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Note: The ability to load this type of file will only be available if the Tilemap JSON File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#tilemapTiledJSON - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.TilemapJSONFileConfig|Phaser.Types.Loader.FileTypes.TilemapJSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {object|string} [url] - The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json". Or, a well formed JSON object. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('tilemapTiledJSON', function (key, url, xhrSettings) -{ - if (Array.isArray(key)) + /** + * Searches the entire map layer for the first tile matching the given index, then returns that Tile + * object. If no match is found, it returns null. The search starts from the top-left tile and + * continues horizontally until it hits the end of the row, then it drops down to the next column. + * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to + * the top-left. + * + * @method Phaser.Tilemaps.TilemapLayer#findByIndex + * @since 3.50.0 + * + * @param {number} index - The tile index value to search for. + * @param {number} [skip=0] - The number of times to skip a matching tile before returning. + * @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. + * + * @return {Phaser.Tilemaps.Tile} The first matching Tile object. + */ + findByIndex: function (findIndex, skip, reverse) { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(new TilemapJSONFile(this, key[i])); - } - } - else + return TilemapComponents.FindByIndex(findIndex, skip, reverse, this.layer); + }, + + /** + * Find the first tile in the given rectangular area (in tile coordinates) of the layer that + * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns + * true. Similar to Array.prototype.find in vanilla JS. + * + * @method Phaser.Tilemaps.TilemapLayer#findTile + * @since 3.50.0 + * + * @param {FindTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. + * @param {object} [context] - The context under which the callback should be run. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * + * @return {?Phaser.Tilemaps.Tile} The first Tile found at the given location. + */ + findTile: function (callback, context, tileX, tileY, width, height, filteringOptions) { - this.addFile(new TilemapJSONFile(this, key, url, xhrSettings)); - } + return TilemapComponents.FindTile(callback, context, tileX, tileY, width, height, filteringOptions, this.layer); + }, - return this; -}); + /** + * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given + * callback. Similar to Array.prototype.forEach in vanilla JS. + * + * @method Phaser.Tilemaps.TilemapLayer#forEachTile + * @since 3.50.0 + * + * @param {EachTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. + * @param {object} [context] - The context, or scope, under which the callback should be run. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * + * @return {this} This Tilemap Layer object. + */ + forEachTile: function (callback, context, tileX, tileY, width, height, filteringOptions) + { + TilemapComponents.ForEachTile(callback, context, tileX, tileY, width, height, filteringOptions, this.layer); -module.exports = TilemapJSONFile; + return this; + }, + /** + * Sets an additive tint on each Tile within the given area. + * + * The tint works by taking the pixel color values from the tileset texture, and then + * multiplying it by the color value of the tint. + * + * If no area values are given then all tiles will be tinted to the given color. + * + * To remove a tint call this method with either no parameters, or by passing white `0xffffff` as the tint color. + * + * If a tile already has a tint set then calling this method will override that. + * + * @method Phaser.Tilemaps.TilemapLayer#setTint + * @webglOnly + * @since 3.60.0 + * + * @param {number} [tint=0xffffff] - The tint color being applied to each tile within the region. Given as a hex value, i.e. `0xff0000` for red. Set to white (`0xffffff`) to reset the tint. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * + * @return {this} This Tilemap Layer object. + */ + setTint: function (tint, tileX, tileY, width, height, filteringOptions) + { + if (tint === undefined) { tint = 0xffffff; } -/***/ }), -/* 1363 */ -/***/ (function(module, exports, __webpack_require__) { + var tintTile = function (tile) + { + tile.tint = tint; + }; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this.forEachTile(tintTile, this, tileX, tileY, width, height, filteringOptions); + }, -var Class = __webpack_require__(0); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var ImageFile = __webpack_require__(71); -var IsPlainObject = __webpack_require__(7); -var MultiFile = __webpack_require__(49); -var TextFile = __webpack_require__(242); + /** + * Gets a tile at the given tile coordinates from the given layer. + * + * @method Phaser.Tilemaps.TilemapLayer#getTileAt + * @since 3.50.0 + * + * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. + * + * @return {Phaser.Tilemaps.Tile} The Tile at the given coordinates or null if no tile was found or the coordinates were invalid. + */ + getTileAt: function (tileX, tileY, nonNull) + { + return TilemapComponents.GetTileAt(tileX, tileY, nonNull, this.layer); + }, -/** - * @classdesc - * A single text file based Unity Texture Atlas File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#unityAtlas method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#unityAtlas. - * - * @class UnityAtlasFile - * @extends Phaser.Loader.MultiFile - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.0.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.UnityAtlasFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas data file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas data file. Used in replacement of the Loaders default XHR Settings. - */ -var UnityAtlasFile = new Class({ + /** + * Gets a tile at the given world coordinates from the given layer. + * + * @method Phaser.Tilemaps.TilemapLayer#getTileAtWorldXY + * @since 3.50.0 + * + * @param {number} worldX - X position to get the tile from (given in pixels) + * @param {number} worldY - Y position to get the tile from (given in pixels) + * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * + * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. + */ + getTileAtWorldXY: function (worldX, worldY, nonNull, camera) + { + return TilemapComponents.GetTileAtWorldXY(worldX, worldY, nonNull, camera, this.layer); + }, - Extends: MultiFile, + /** + * Gets a tile at the given world coordinates from the given isometric layer. + * + * @method Phaser.Tilemaps.TilemapLayer#getIsoTileAtWorldXY + * @since 3.60.0 + * + * @param {number} worldX - X position to get the tile from (given in pixels) + * @param {number} worldY - Y position to get the tile from (given in pixels) + * @param {boolean} [originTop=true] - Which is the active face of the isometric tile? The top (default, true), or the base? (false) + * @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile object with an index of -1. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * + * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. + */ + getIsoTileAtWorldXY: function (worldX, worldY, originTop, nonNull, camera) + { + if (originTop === undefined) { originTop = true; } - initialize: + var point = this.tempVec; - function UnityAtlasFile (loader, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) - { - var image; - var data; + TilemapComponents.IsometricWorldToTileXY(worldX, worldY, true, point, camera, this.layer, originTop); - if (IsPlainObject(key)) - { - var config = key; + return this.getTileAt(point.x, point.y, nonNull); + }, - key = GetFastValue(config, 'key'); + /** + * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. + * + * @method Phaser.Tilemaps.TilemapLayer#getTilesWithin + * @since 3.50.0 + * + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects found within the area. + */ + getTilesWithin: function (tileX, tileY, width, height, filteringOptions) + { + return TilemapComponents.GetTilesWithin(tileX, tileY, width, height, filteringOptions, this.layer); + }, - image = new ImageFile(loader, { - key: key, - url: GetFastValue(config, 'textureURL'), - extension: GetFastValue(config, 'textureExtension', 'png'), - normalMap: GetFastValue(config, 'normalMap'), - xhrSettings: GetFastValue(config, 'textureXhrSettings') - }); + /** + * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, + * Line, Rectangle or Triangle. The shape should be in world coordinates. + * + * @method Phaser.Tilemaps.TilemapLayer#getTilesWithinShape + * @since 3.50.0 + * + * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects found within the shape. + */ + getTilesWithinShape: function (shape, filteringOptions, camera) + { + return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer); + }, - data = new TextFile(loader, { - key: key, - url: GetFastValue(config, 'atlasURL'), - extension: GetFastValue(config, 'atlasExtension', 'txt'), - xhrSettings: GetFastValue(config, 'atlasXhrSettings') - }); - } - else - { - image = new ImageFile(loader, key, textureURL, textureXhrSettings); - data = new TextFile(loader, key, atlasURL, atlasXhrSettings); - } + /** + * Gets the tiles in the given rectangular area (in world coordinates) of the layer. + * + * @method Phaser.Tilemaps.TilemapLayer#getTilesWithinWorldXY + * @since 3.50.0 + * + * @param {number} worldX - The world x coordinate for the top-left of the area. + * @param {number} worldY - The world y coordinate for the top-left of the area. + * @param {number} width - The width of the area. + * @param {number} height - The height of the area. + * @param {Phaser.Types.Tilemaps.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects found within the area. + */ + getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera) + { + return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer); + }, - if (image.linkFile) - { - // Image has a normal map - MultiFile.call(this, loader, 'unityatlas', key, [ image, data, image.linkFile ]); - } - else - { - MultiFile.call(this, loader, 'unityatlas', key, [ image, data ]); - } + /** + * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns + * false if there is no tile or if the tile at that location has an index of -1. + * + * @method Phaser.Tilemaps.TilemapLayer#hasTileAt + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * + * @return {boolean} `true` if a tile was found at the given location, otherwise `false`. + */ + hasTileAt: function (tileX, tileY) + { + return TilemapComponents.HasTileAt(tileX, tileY, this.layer); }, /** - * Adds this file to its target cache upon successful loading and processing. + * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns + * false if there is no tile or if the tile at that location has an index of -1. * - * @method Phaser.Loader.FileTypes.UnityAtlasFile#addToCache - * @since 3.7.0 + * @method Phaser.Tilemaps.TilemapLayer#hasTileAtWorldXY + * @since 3.50.0 + * + * @param {number} worldX - The x coordinate, in pixels. + * @param {number} worldY - The y coordinate, in pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when factoring in which tiles to return. + * + * @return {boolean} `true` if a tile was found at the given location, otherwise `false`. */ - addToCache: function () + hasTileAtWorldXY: function (worldX, worldY, camera) { - if (this.isReadyToProcess()) - { - var image = this.files[0]; - var text = this.files[1]; - var normalMap = (this.files[2]) ? this.files[2].data : null; + return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera, this.layer); + }, - this.loader.textureManager.addUnityAtlas(image.key, image.data, text.data, normalMap); + /** + * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index + * or a Tile object. If you pass in a Tile, all attributes will be copied over to the specified + * location. If you pass in an index, only the index at the specified location will be changed. + * Collision information will be recalculated at the specified location. + * + * @method Phaser.Tilemaps.TilemapLayer#putTileAt + * @since 3.50.0 + * + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * + * @return {Phaser.Tilemaps.Tile} The Tile object that was inserted at the given coordinates. + */ + putTileAt: function (tile, tileX, tileY, recalculateFaces) + { + return TilemapComponents.PutTileAt(tile, tileX, tileY, recalculateFaces, this.layer); + }, - text.pendingDestroy(); + /** + * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either + * an index or a Tile object. If you pass in a Tile, all attributes will be copied over to the + * specified location. If you pass in an index, only the index at the specified location will be + * changed. Collision information will be recalculated at the specified location. + * + * @method Phaser.Tilemaps.TilemapLayer#putTileAtWorldXY + * @since 3.50.0 + * + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {number} worldX - The x coordinate, in pixels. + * @param {number} worldY - The y coordinate, in pixels. + * @param {boolean} [recalculateFaces] - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * + * @return {Phaser.Tilemaps.Tile} The Tile object that was inserted at the given coordinates. + */ + putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera) + { + return TilemapComponents.PutTileAtWorldXY(tile, worldX, worldY, recalculateFaces, camera, this.layer); + }, - this.complete = true; - } - } + /** + * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified + * layer. The array can be composed of either tile indexes or Tile objects. If you pass in a Tile, + * all attributes will be copied over to the specified location. If you pass in an index, only the + * index at the specified location will be changed. Collision information will be recalculated + * within the region tiles were changed. + * + * @method Phaser.Tilemaps.TilemapLayer#putTilesAt + * @since 3.50.0 + * + * @param {(number[]|number[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * + * @return {this} This Tilemap Layer object. + */ + putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces) + { + TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer); -}); + return this; + }, -/** - * Adds a Unity YAML based Texture Atlas, or array of atlases, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.unityAtlas('mainmenu', 'images/MainMenu.png', 'images/MainMenu.txt'); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * If you call this from outside of `preload` then you are responsible for starting the Loader afterwards and monitoring - * its events to know when it's safe to use the asset. Please see the Phaser.Loader.LoaderPlugin class for more details. - * - * Phaser expects the atlas data to be provided in a YAML formatted text file as exported from Unity. - * - * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle. - * - * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Texture Manager. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Texture Manager first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.unityAtlas({ - * key: 'mainmenu', - * textureURL: 'images/MainMenu.png', - * atlasURL: 'images/MainMenu.txt' - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.UnityAtlasFileConfig` for more details. - * - * Once the atlas has finished loading you can use frames from it as textures for a Game Object by referencing its key: - * - * ```javascript - * this.load.unityAtlas('mainmenu', 'images/MainMenu.png', 'images/MainMenu.json'); - * // and later in your game ... - * this.add.image(x, y, 'mainmenu', 'background'); - * ``` - * - * To get a list of all available frames within an atlas please consult your Texture Atlas software. - * - * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files - * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and - * this is what you would use to retrieve the image from the Texture Manager. - * - * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it. - * - * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien" - * and no URL is given then the Loader will set the URL to be "alien.png". It will always add `.png` as the extension, although - * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL. - * - * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image, - * then you can specify it by providing an array as the `url` where the second element is the normal map: - * - * ```javascript - * this.load.unityAtlas('mainmenu', [ 'images/MainMenu.png', 'images/MainMenu-n.png' ], 'images/MainMenu.txt'); - * ``` - * - * Or, if you are using a config object use the `normalMap` property: - * - * ```javascript - * this.load.unityAtlas({ - * key: 'mainmenu', - * textureURL: 'images/MainMenu.png', - * normalMap: 'images/MainMenu-n.png', - * atlasURL: 'images/MainMenu.txt' - * }); - * ``` - * - * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings. - * Normal maps are a WebGL only feature. - * - * Note: The ability to load this type of file will only be available if the Unity Atlas File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#unityAtlas - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Loader.FileTypes.UnityAtlasFileConfig|Phaser.Types.Loader.FileTypes.UnityAtlasFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {string|string[]} [textureURL] - The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png". - * @param {string} [atlasURL] - The absolute or relative URL to load the texture atlas data file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt". - * @param {Phaser.Types.Loader.XHRSettingsObject} [textureXhrSettings] - An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings. - * @param {Phaser.Types.Loader.XHRSettingsObject} [atlasXhrSettings] - An XHR Settings configuration object for the atlas data file. Used in replacement of the Loaders default XHR Settings. - * - * @return {this} The Loader instance. - */ -FileTypesManager.register('unityAtlas', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings) -{ - var multifile; + /** + * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the + * specified layer. Each tile will receive a new index. If an array of indexes is passed in, then + * those will be used for randomly assigning new tile indexes. If an array is not provided, the + * indexes found within the region (excluding -1) will be used for randomly assigning new tile + * indexes. This method only modifies tile indexes and does not change collision information. + * + * @method Phaser.Tilemaps.TilemapLayer#randomize + * @since 3.50.0 + * + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {number[]} [indexes] - An array of indexes to randomly draw from during randomization. + * + * @return {this} This Tilemap Layer object. + */ + randomize: function (tileX, tileY, width, height, indexes) + { + TilemapComponents.Randomize(tileX, tileY, width, height, indexes, this.layer); - // Supports an Object file definition in the key argument - // Or an array of objects in the key argument - // Or a single entry where all arguments have been defined + return this; + }, - if (Array.isArray(key)) + /** + * Removes the tile at the given tile coordinates in the specified layer and updates the layers + * collision information. + * + * @method Phaser.Tilemaps.TilemapLayer#removeTileAt + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * + * @return {Phaser.Tilemaps.Tile} A Tile object. + */ + removeTileAt: function (tileX, tileY, replaceWithNull, recalculateFaces) { - for (var i = 0; i < key.length; i++) - { - multifile = new UnityAtlasFile(this, key[i]); + return TilemapComponents.RemoveTileAt(tileX, tileY, replaceWithNull, recalculateFaces, this.layer); + }, - this.addFile(multifile.files); - } - } - else + /** + * Removes the tile at the given world coordinates in the specified layer and updates the layers + * collision information. + * + * @method Phaser.Tilemaps.TilemapLayer#removeTileAtWorldXY + * @since 3.50.0 + * + * @param {number} worldX - The x coordinate, in pixels. + * @param {number} worldY - The y coordinate, in pixels. + * @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * + * @return {Phaser.Tilemaps.Tile} The Tile object that was removed from the given location. + */ + removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera) { - multifile = new UnityAtlasFile(this, key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings); + return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, this.layer); + }, - this.addFile(multifile.files); - } + /** + * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to + * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles + * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation + * wherever you want on the screen. + * + * @method Phaser.Tilemaps.TilemapLayer#renderDebug + * @since 3.50.0 + * + * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. + * @param {Phaser.Types.Tilemaps.StyleConfig} [styleConfig] - An object specifying the colors to use for the debug drawing. + * + * @return {this} This Tilemap Layer object. + */ + renderDebug: function (graphics, styleConfig) + { + TilemapComponents.RenderDebug(graphics, styleConfig, this.layer); - return this; -}); + return this; + }, -module.exports = UnityAtlasFile; + /** + * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching + * `findIndex` and updates their index to match `newIndex`. This only modifies the index and does + * not change collision information. + * + * @method Phaser.Tilemaps.TilemapLayer#replaceByIndex + * @since 3.50.0 + * + * @param {number} findIndex - The index of the tile to search for. + * @param {number} newIndex - The index of the tile to replace it with. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * + * @return {this} This Tilemap Layer object. + */ + replaceByIndex: function (findIndex, newIndex, tileX, tileY, width, height) + { + TilemapComponents.ReplaceByIndex(findIndex, newIndex, tileX, tileY, width, height, this.layer); + return this; + }, -/***/ }), -/* 1364 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * You can control if the Cameras should cull tiles before rendering them or not. + * + * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer. + * + * However, there are some instances when you may wish to disable this. + * + * @method Phaser.Tilemaps.TilemapLayer#setSkipCull + * @since 3.50.0 + * + * @param {boolean} [value=true] - Set to `true` to stop culling tiles. Set to `false` to enable culling again. + * + * @return {this} This Tilemap Layer object. + */ + setSkipCull: function (value) + { + if (value === undefined) { value = true; } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.skipCull = value; -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var File = __webpack_require__(23); -var FileTypesManager = __webpack_require__(8); -var GetURL = __webpack_require__(155); -var GetFastValue = __webpack_require__(2); -var IsPlainObject = __webpack_require__(7); + return this; + }, -/** - * @classdesc - * A single Video File suitable for loading by the Loader. - * - * These are created when you use the Phaser.Loader.LoaderPlugin#video method and are not typically created directly. - * - * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#video. - * - * @class VideoFile - * @extends Phaser.Loader.File - * @memberof Phaser.Loader.FileTypes - * @constructor - * @since 3.20.0 - * - * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file. - * @param {(string|Phaser.Types.Loader.FileTypes.VideoFileConfig)} key - The key to use for this file, or a file configuration object. - * @param {any} [urlConfig] - The absolute or relative URL to load this file from in a config object. - * @param {string} [loadEvent] - The load event to listen for when _not_ loading as a blob. Either 'loadeddata', 'canplay' or 'canplaythrough'. - * @param {boolean} [asBlob] - Load the video as a data blob, or via the Video element? - * @param {boolean} [noAudio] - Does the video have an audio track? If not you can enable auto-playing on it. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file. - */ -var VideoFile = new Class({ + /** + * When a Camera culls the tiles in this layer it does so using its view into the world, building up a + * rectangle inside which the tiles must exist or they will be culled. Sometimes you may need to expand the size + * of this 'cull rectangle', especially if you plan on rotating the Camera viewing the layer. Do so + * by providing the padding values. The values given are in tiles, not pixels. So if the tile width was 32px + * and you set `paddingX` to be 4, it would add 32px x 4 to the cull rectangle (adjusted for scale) + * + * @method Phaser.Tilemaps.TilemapLayer#setCullPadding + * @since 3.50.0 + * + * @param {number} [paddingX=1] - The amount of extra horizontal tiles to add to the cull check padding. + * @param {number} [paddingY=1] - The amount of extra vertical tiles to add to the cull check padding. + * + * @return {this} This Tilemap Layer object. + */ + setCullPadding: function (paddingX, paddingY) + { + if (paddingX === undefined) { paddingX = 1; } + if (paddingY === undefined) { paddingY = 1; } - Extends: File, + this.cullPaddingX = paddingX; + this.cullPaddingY = paddingY; - initialize: + return this; + }, - // URL is an object created by VideoFile.getVideoURL - function VideoFile (loader, key, urlConfig, loadEvent, asBlob, noAudio, xhrSettings) + /** + * Sets collision on the given tile or tiles within a layer by index. You can pass in either a + * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if + * collision will be enabled (true) or disabled (false). + * + * @method Phaser.Tilemaps.TilemapLayer#setCollision + * @since 3.50.0 + * + * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes. + * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. + * + * @return {this} This Tilemap Layer object. + */ + setCollision: function (indexes, collides, recalculateFaces, updateLayer) { - if (loadEvent === undefined) { loadEvent = 'loadeddata'; } - if (asBlob === undefined) { asBlob = false; } - if (noAudio === undefined) { noAudio = false; } + TilemapComponents.SetCollision(indexes, collides, recalculateFaces, this.layer, updateLayer); - if (loadEvent !== 'loadeddata' && loadEvent !== 'canplay' && loadEvent !== 'canplaythrough') - { - loadEvent = 'loadeddata'; - } + return this; + }, - var fileConfig = { - type: 'video', - cache: loader.cacheManager.video, - extension: urlConfig.type, - responseType: 'blob', - key: key, - url: urlConfig.url, - xhrSettings: xhrSettings, - config: { - loadEvent: loadEvent, - asBlob: asBlob, - noAudio: noAudio - } - }; + /** + * Sets collision on a range of tiles in a layer whose index is between the specified `start` and + * `stop` (inclusive). Calling this with a start value of 10 and a stop value of 14 would set + * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be + * enabled (true) or disabled (false). + * + * @method Phaser.Tilemaps.TilemapLayer#setCollisionBetween + * @since 3.50.0 + * + * @param {number} start - The first index of the tile to be set for collision. + * @param {number} stop - The last index of the tile to be set for collision. + * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * + * @return {this} This Tilemap Layer object. + */ + setCollisionBetween: function (start, stop, collides, recalculateFaces) + { + TilemapComponents.SetCollisionBetween(start, stop, collides, recalculateFaces, this.layer); - this.onLoadCallback = this.onVideoLoadHandler.bind(this); - this.onErrorCallback = this.onVideoErrorHandler.bind(this); + return this; + }, + + /** + * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property + * that matches the given properties object, its collision flag will be set. The `collides` + * parameter controls if collision will be enabled (true) or disabled (false). Passing in + * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that + * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can + * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a + * "types" property that matches any of those values, its collision flag will be updated. + * + * @method Phaser.Tilemaps.TilemapLayer#setCollisionByProperty + * @since 3.50.0 + * + * @param {object} properties - An object with tile properties and corresponding values that should be checked. + * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * + * @return {this} This Tilemap Layer object. + */ + setCollisionByProperty: function (properties, collides, recalculateFaces) + { + TilemapComponents.SetCollisionByProperty(properties, collides, recalculateFaces, this.layer); - File.call(this, loader, fileConfig); + return this; }, /** - * Called automatically by Loader.nextFile. - * This method controls what extra work this File does with its loaded data. + * Sets collision on all tiles in the given layer, except for tiles that have an index specified in + * the given array. The `collides` parameter controls if collision will be enabled (true) or + * disabled (false). Tile indexes not currently in the layer are not affected. * - * @method Phaser.Loader.FileTypes.VideoFile#onProcess - * @since 3.20.0 + * @method Phaser.Tilemaps.TilemapLayer#setCollisionByExclusion + * @since 3.50.0 + * + * @param {number[]} indexes - An array of the tile indexes to not be counted for collision. + * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * + * @return {this} This Tilemap Layer object. */ - onProcess: function () + setCollisionByExclusion: function (indexes, collides, recalculateFaces) { - this.state = CONST.FILE_PROCESSING; - - if (!this.config.asBlob) - { - this.onProcessComplete(); - - return; - } - - // Load Video as blob - - var video = this.createVideoElement(); + TilemapComponents.SetCollisionByExclusion(indexes, collides, recalculateFaces, this.layer); - this.data = video; + return this; + }, - var _this = this; + /** + * Sets collision on the tiles within a layer by checking each tiles collision group data + * (typically defined in Tiled within the tileset collision editor). If any objects are found within + * a tiles collision group, the tile's colliding information will be set. The `collides` parameter + * controls if collision will be enabled (true) or disabled (false). + * + * @method Phaser.Tilemaps.TilemapLayer#setCollisionFromCollisionGroup + * @since 3.50.0 + * + * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. + * @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the update. + * + * @return {this} This Tilemap Layer object. + */ + setCollisionFromCollisionGroup: function (collides, recalculateFaces) + { + TilemapComponents.SetCollisionFromCollisionGroup(collides, recalculateFaces, this.layer); - this.data.onloadeddata = function () - { - _this.onProcessComplete(); - }; + return this; + }, - this.data.onerror = function () - { - File.revokeObjectURL(_this.data); + /** + * Sets a global collision callback for the given tile index within the layer. This will affect all + * tiles on this layer that have the same index. If a callback is already set for the tile index it + * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile + * at a specific location on the map then see setTileLocationCallback. + * + * @method Phaser.Tilemaps.TilemapLayer#setTileIndexCallback + * @since 3.50.0 + * + * @param {(number|number[])} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. + * @param {function} callback - The callback that will be invoked when the tile is collided with. + * @param {object} callbackContext - The context under which the callback is called. + * + * @return {this} This Tilemap Layer object. + */ + setTileIndexCallback: function (indexes, callback, callbackContext) + { + TilemapComponents.SetTileIndexCallback(indexes, callback, callbackContext, this.layer); - _this.onProcessError(); - }; + return this; + }, - File.createObjectURL(video, this.xhrLoader.response, ''); + /** + * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. + * If a callback is already set for the tile index it will be replaced. Set the callback to null to + * remove it. + * + * @method Phaser.Tilemaps.TilemapLayer#setTileLocationCallback + * @since 3.50.0 + * + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * @param {function} [callback] - The callback that will be invoked when the tile is collided with. + * @param {object} [callbackContext] - The context, or scope, under which the callback is invoked. + * + * @return {this} This Tilemap Layer object. + */ + setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext) + { + TilemapComponents.SetTileLocationCallback(tileX, tileY, width, height, callback, callbackContext, this.layer); - video.load(); + return this; }, /** - * Creates a Video Element within the DOM. + * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given + * layer. It will only randomize the tiles in that area, so if they're all the same nothing will + * appear to have changed! This method only modifies tile indexes and does not change collision + * information. * - * @method Phaser.Loader.FileTypes.VideoFile#createVideoElement - * @private - * @since 3.20.0 + * @method Phaser.Tilemaps.TilemapLayer#shuffle + * @since 3.50.0 + * + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. * - * @return {HTMLVideoElement} The newly created Video element. + * @return {this} This Tilemap Layer object. */ - createVideoElement: function () + shuffle: function (tileX, tileY, width, height) { - var video = document.createElement('video'); - - video.controls = false; - video.crossOrigin = this.loader.crossOrigin; + TilemapComponents.Shuffle(tileX, tileY, width, height, this.layer); - if (this.config.noAudio) - { - video.muted = true; - video.defaultMuted = true; + return this; + }, - video.setAttribute('autoplay', 'autoplay'); - } + /** + * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching + * `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision + * information. + * + * @method Phaser.Tilemaps.TilemapLayer#swapByIndex + * @since 3.50.0 + * + * @param {number} tileA - First tile index. + * @param {number} tileB - Second tile index. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * + * @return {this} This Tilemap Layer object. + */ + swapByIndex: function (indexA, indexB, tileX, tileY, width, height) + { + TilemapComponents.SwapByIndex(indexA, indexB, tileX, tileY, width, height, this.layer); - video.setAttribute('playsinline', 'playsinline'); - video.setAttribute('preload', 'auto'); + return this; + }, - return video; + /** + * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the + * layers position, scale and scroll. + * + * @method Phaser.Tilemaps.TilemapLayer#tileToWorldX + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * + * @return {number} The Tile X coordinate converted to pixels. + */ + tileToWorldX: function (tileX, camera) + { + return this.tilemap.tileToWorldX(tileX, camera, this); }, /** - * Internal load event callback. + * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the + * layers position, scale and scroll. * - * @method Phaser.Loader.FileTypes.VideoFile#onVideoLoadHandler - * @private - * @since 3.20.0 + * @method Phaser.Tilemaps.TilemapLayer#tileToWorldY + * @since 3.50.0 * - * @param {ProgressEvent} event - The DOM ProgressEvent that resulted from this load. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * + * @return {number} The Tile Y coordinate converted to pixels. */ - onVideoLoadHandler: function (event) + tileToWorldY: function (tileY, camera) { - var video = event.target; + return this.tilemap.tileToWorldY(tileY, camera, this); + }, - video.removeEventListener(this.config.loadEvent, this.onLoadCallback, true); - video.removeEventListener('error', this.onErrorCallback, true); + /** + * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layers position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @method Phaser.Tilemaps.TilemapLayer#tileToWorldXY + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * + * @return {Phaser.Math.Vector2} A Vector2 containing the world coordinates of the Tile. + */ + tileToWorldXY: function (tileX, tileY, point, camera) + { + return this.tilemap.tileToWorldXY(tileX, tileY, point, camera, this); + }, - this.data = video; + /** + * Returns an array of Vector2s where each entry corresponds to the corner of the requested tile. + * + * The `tileX` and `tileY` parameters are in tile coordinates, not world coordinates. + * + * The corner coordinates are in world space, having factored in TilemapLayer scale, position + * and the camera, if given. + * + * The size of the array will vary based on the orientation of the map. For example an + * orthographic map will return an array of 4 vectors, where-as a hexagonal map will, + * of course, return an array of 6 corner vectors. + * + * @method Phaser.Tilemaps.TilemapLayer#getTileCorners + * @since 3.60.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * + * @return {?Phaser.Math.Vector2[]} Returns an array of Vector2s, or null if the layer given was invalid. + */ + getTileCorners: function (tileX, tileY, camera) + { + return this.tilemap.getTileCorners(tileX, tileY, camera, this); + }, - this.resetXHR(); + /** + * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the + * specified layer. Each tile will receive a new index. New indexes are drawn from the given + * weightedIndexes array. An example weighted array: + * + * [ + * { index: 6, weight: 4 }, // Probability of index 6 is 4 / 8 + * { index: 7, weight: 2 }, // Probability of index 7 would be 2 / 8 + * { index: 8, weight: 1.5 }, // Probability of index 8 would be 1.5 / 8 + * { index: 26, weight: 0.5 } // Probability of index 27 would be 0.5 / 8 + * ] + * + * The probability of any index being choose is (the index's weight) / (sum of all weights). This + * method only modifies tile indexes and does not change collision information. + * + * @method Phaser.Tilemaps.TilemapLayer#weightedRandomize + * @since 3.50.0 + * + * @param {object[]} weightedIndexes - An array of objects to randomly draw from during randomization. They should be in the form: { index: 0, weight: 4 } or { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. + * @param {number} [tileX] - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [tileY] - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} [width] - How many tiles wide from the `tileX` index the area will be. + * @param {number} [height] - How many tiles tall from the `tileY` index the area will be. + * + * @return {this} This Tilemap Layer object. + */ + weightedRandomize: function (weightedIndexes, tileX, tileY, width, height) + { + TilemapComponents.WeightedRandomize(tileX, tileY, width, height, weightedIndexes, this.layer); - this.loader.nextFile(this, true); + return this; }, /** - * Internal load error event callback. + * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the + * layers position, scale and scroll. * - * @method Phaser.Loader.FileTypes.VideoFile#onVideoErrorHandler - * @private - * @since 3.20.0 + * You cannot call this method for Isometric or Hexagonal tilemaps as they require + * both `worldX` and `worldY` values to determine the correct tile, instead you + * should use the `worldToTileXY` method. * - * @param {ProgressEvent} event - The DOM ProgressEvent that resulted from this load. + * @method Phaser.Tilemaps.TilemapLayer#worldToTileX + * @since 3.50.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * + * @return {number} The tile X coordinate based on the world value. */ - onVideoErrorHandler: function (event) + worldToTileX: function (worldX, snapToFloor, camera) { - var video = event.target; - - if (video) - { - video.removeEventListener(this.config.loadEvent, this.onLoadCallback, true); - video.removeEventListener('error', this.onErrorCallback, true); - } + return this.tilemap.worldToTileX(worldX, snapToFloor, camera, this); + }, - this.resetXHR(); + /** + * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the + * layers position, scale and scroll. + * + * You cannot call this method for Isometric or Hexagonal tilemaps as they require + * both `worldX` and `worldY` values to determine the correct tile, instead you + * should use the `worldToTileXY` method. + * + * @method Phaser.Tilemaps.TilemapLayer#worldToTileY + * @since 3.50.0 + * + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * + * @return {number} The tile Y coordinate based on the world value. + */ + worldToTileY: function (worldY, snapToFloor, camera) + { + return this.tilemap.worldToTileY(worldY, snapToFloor, camera, this); + }, - this.loader.nextFile(this, false); + /** + * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the + * layers position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @method Phaser.Tilemaps.TilemapLayer#worldToTileXY + * @since 3.50.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} [snapToFloor] - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to use when calculating the tile index from the world values. + * + * @return {Phaser.Math.Vector2} A Vector2 containing the tile coordinates of the world values. + */ + worldToTileXY: function (worldX, worldY, snapToFloor, point, camera) + { + return this.tilemap.worldToTileXY(worldX, worldY, snapToFloor, point, camera, this); }, /** - * Called by the Loader, starts the actual file downloading. - * During the load the methods onLoad, onError and onProgress are called, based on the XHR events. - * You shouldn't normally call this method directly, it's meant to be invoked by the Loader. + * Destroys this TilemapLayer and removes its link to the associated LayerData. * - * @method Phaser.Loader.FileTypes.VideoFile#load - * @since 3.20.0 + * @method Phaser.Tilemaps.TilemapLayer#destroy + * @since 3.50.0 + * + * @param {boolean} [removeFromTilemap=true] - Remove this layer from the parent Tilemap? */ - load: function () + destroy: function (removeFromTilemap) { - var loadEvent = this.config.loadEvent; + if (removeFromTilemap === undefined) { removeFromTilemap = true; } - if (this.config.asBlob) + if (!this.tilemap) { - File.prototype.load.call(this); + // Abort, we've already been destroyed + return; } - else + + // Uninstall this layer only if it is still installed on the LayerData object + if (this.layer.tilemapLayer === this) { - this.percentComplete = 0; + this.layer.tilemapLayer = undefined; + } - var video = this.createVideoElement(); + if (removeFromTilemap) + { + this.tilemap.removeLayer(this); + } - video.addEventListener(loadEvent, this.onLoadCallback, true); - video.addEventListener('error', this.onErrorCallback, true); + this.tilemap = undefined; + this.layer = undefined; + this.culledTiles.length = 0; + this.cullCallback = null; - video.src = GetURL(this, this.loader.baseURL); + this.gidMap = []; + this.tileset = []; - video.load(); - } + GameObject.prototype.destroy.call(this); } }); -VideoFile.create = function (loader, key, urls, loadEvent, asBlob, noAudio, xhrSettings) +module.exports = TilemapLayer; + + +/***/ }), + +/***/ 17394: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var TransformMatrix = __webpack_require__(69360); + +var tempMatrix1 = new TransformMatrix(); +var tempMatrix2 = new TransformMatrix(); +var tempMatrix3 = new TransformMatrix(); + +/** + * Renders this Game Object with the Canvas Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. + * + * @method Phaser.Tilemaps.TilemapLayer#renderCanvas + * @since 3.50.0 + * @private + * + * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. + * @param {Phaser.Tilemaps.TilemapLayer} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. + * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested + */ +var TilemapLayerCanvasRenderer = function (renderer, src, camera, parentMatrix) { - var game = loader.systems.game; + var renderTiles = src.cull(camera); - // url may be inside key, which may be an object - if (IsPlainObject(key)) + var tileCount = renderTiles.length; + var alpha = camera.alpha * src.alpha; + + if (tileCount === 0 || alpha <= 0) { - urls = GetFastValue(key, 'url', []); - loadEvent = GetFastValue(key, 'loadEvent', 'loadeddata'); - asBlob = GetFastValue(key, 'asBlob', false); - noAudio = GetFastValue(key, 'noAudio', false); - xhrSettings = GetFastValue(key, 'xhrSettings'); - key = GetFastValue(key, 'key'); + return; } - var urlConfig = VideoFile.getVideoURL(game, urls); - - if (urlConfig) + var camMatrix = tempMatrix1; + var layerMatrix = tempMatrix2; + var calcMatrix = tempMatrix3; + + layerMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); + + camMatrix.copyFrom(camera.matrix); + + var ctx = renderer.currentContext; + var gidMap = src.gidMap; + + ctx.save(); + + if (parentMatrix) + { + // Multiply the camera by the parent matrix + camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); + + // Undo the camera scroll + layerMatrix.e = src.x; + layerMatrix.f = src.y; + + // Multiply by the Sprite matrix, store result in calcMatrix + camMatrix.multiply(layerMatrix, calcMatrix); + + calcMatrix.copyToContext(ctx); + } + else { - return new VideoFile(loader, key, urlConfig, loadEvent, asBlob, noAudio, xhrSettings); + layerMatrix.e -= camera.scrollX * src.scrollFactorX; + layerMatrix.f -= camera.scrollY * src.scrollFactorY; + + layerMatrix.copyToContext(ctx); } -}; -VideoFile.getVideoURL = function (game, urls) -{ - if (!Array.isArray(urls)) + if (!renderer.antialias || src.scaleX > 1 || src.scaleY > 1) { - urls = [ urls ]; + ctx.imageSmoothingEnabled = false; } - for (var i = 0; i < urls.length; i++) + for (var i = 0; i < tileCount; i++) { - var url = GetFastValue(urls[i], 'url', urls[i]); + var tile = renderTiles[i]; + + var tileset = gidMap[tile.index]; - if (url.indexOf('blob:') === 0) + if (!tileset) { - return { - url: url, - type: '' - }; + continue; } - var videoType; + var image = tileset.image.getSourceImage(); + + var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); + var tileWidth = tileset.tileWidth; + var tileHeight = tileset.tileHeight; - if (url.indexOf('data:') === 0) + if (tileTexCoords === null || tileWidth === 0 || tileHeight === 0) { - videoType = url.split(',')[0].match(/\/(.*?);/); + continue; } - else + + var halfWidth = tileWidth * 0.5; + var halfHeight = tileHeight * 0.5; + + tileTexCoords.x += tileset.tileOffset.x; + tileTexCoords.y += tileset.tileOffset.y; + + ctx.save(); + + ctx.translate(tile.pixelX + halfWidth, tile.pixelY + halfHeight); + + if (tile.rotation !== 0) { - videoType = url.match(/\.([a-zA-Z0-9]+)($|\?)/); + ctx.rotate(tile.rotation); } - videoType = GetFastValue(urls[i], 'type', (videoType) ? videoType[1] : '').toLowerCase(); - - if (game.device.video[videoType]) + if (tile.flipX || tile.flipY) { - return { - url: url, - type: videoType - }; + ctx.scale((tile.flipX) ? -1 : 1, (tile.flipY) ? -1 : 1); } + + ctx.globalAlpha = alpha * tile.alpha; + + ctx.drawImage( + image, + tileTexCoords.x, tileTexCoords.y, + tileWidth , tileHeight, + -halfWidth, -halfHeight, + tileWidth, tileHeight + ); + + ctx.restore(); } - return null; + ctx.restore(); }; +module.exports = TilemapLayerCanvasRenderer; + + +/***/ }), + +/***/ 96193: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + /** - * Adds a Video file, or array of video files, to the current load queue. - * - * You can call this method from within your Scene's `preload`, along with any other files you wish to load: - * - * ```javascript - * function preload () - * { - * this.load.video('intro', [ 'video/level1.mp4', 'video/level1.webm', 'video/level1.mov' ]); - * } - * ``` - * - * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts, - * or if it's already running, when the next free load slot becomes available. This happens automatically if you - * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued - * it means you cannot use the file immediately after calling this method, but must wait for the file to complete. - * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the - * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been - * loaded. - * - * The key must be a unique String. It is used to add the file to the global Video Cache upon a successful load. - * The key should be unique both in terms of files being loaded and files already present in the Video Cache. - * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file - * then remove it from the Video Cache first, before loading a new one. - * - * Instead of passing arguments you can pass a configuration object, such as: - * - * ```javascript - * this.load.video({ - * key: 'intro', - * url: [ 'video/level1.mp4', 'video/level1.webm', 'video/level1.mov' ], - * asBlob: false, - * noAudio: true - * }); - * ``` - * - * See the documentation for `Phaser.Types.Loader.FileTypes.VideoFileConfig` for more details. - * - * The URLs can be relative or absolute. If the URLs are relative the `Loader.baseURL` and `Loader.path` values will be prepended to them. - * - * Due to different browsers supporting different video file types you should usually provide your video files in a variety of formats. - * mp4, mov and webm are the most common. If you provide an array of URLs then the Loader will determine which _one_ file to load based on - * browser support, starting with the first in the array and progressing to the end. - * - * Unlike most asset-types, videos do not _need_ to be preloaded. You can create a Video Game Object and then call its `loadURL` method, - * to load a video at run-time, rather than in advance. - * - * Note: The ability to load this type of file will only be available if the Video File type has been built into Phaser. - * It is available in the default build but can be excluded from custom builds. - * - * @method Phaser.Loader.LoaderPlugin#video - * @fires Phaser.Loader.LoaderPlugin#ADD - * @since 3.20.0 + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var NOOP = __webpack_require__(72283); +var renderWebGL = NOOP; +var renderCanvas = NOOP; + +if (true) +{ + renderWebGL = __webpack_require__(51395); +} + +if (true) +{ + renderCanvas = __webpack_require__(17394); +} + +module.exports = { + + renderWebGL: renderWebGL, + renderCanvas: renderCanvas + +}; + + +/***/ }), + +/***/ 51395: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Utils = __webpack_require__(75512); + +/** + * Renders this Game Object with the WebGL Renderer to the given Camera. + * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. + * This method should not be called directly. It is a utility function of the Render module. * - * @param {(string|Phaser.Types.Loader.FileTypes.VideoFileConfig|Phaser.Types.Loader.FileTypes.VideoFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. - * @param {(string|string[])} [urls] - The absolute or relative URL to load the video files from. - * @param {string} [loadEvent='loadeddata'] - The load event to listen for when _not_ loading as a blob. Either `loadeddata`, `canplay` or `canplaythrough`. - * @param {boolean} [asBlob=false] - Load the video as a data blob, or stream it via the Video element? - * @param {boolean} [noAudio=false] - Does the video have an audio track? If not you can enable auto-playing on it. - * @param {Phaser.Types.Loader.XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings. + * @method Phaser.Tilemaps.TilemapLayer#renderWebGL + * @since 3.0.0 + * @private * - * @return {this} The Loader instance. + * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. + * @param {Phaser.Tilemaps.TilemapLayer} src - The Game Object being rendered in this call. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. */ -FileTypesManager.register('video', function (key, urls, loadEvent, asBlob, noAudio, xhrSettings) +var TilemapLayerWebGLRenderer = function (renderer, src, camera) { - var videoFile; + var renderTiles = src.cull(camera); - if (Array.isArray(key)) - { - for (var i = 0; i < key.length; i++) - { - // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - videoFile = VideoFile.create(this, key[i]); + var tileCount = renderTiles.length; + var alpha = camera.alpha * src.alpha; - if (videoFile) - { - this.addFile(videoFile); - } - } + if (tileCount === 0 || alpha <= 0) + { + return; } - else + + var gidMap = src.gidMap; + var pipeline = renderer.pipelines.set(src.pipeline, src); + + var getTint = Utils.getTintAppendFloatAlpha; + + var scrollFactorX = src.scrollFactorX; + var scrollFactorY = src.scrollFactorY; + + var x = src.x; + var y = src.y; + + var sx = src.scaleX; + var sy = src.scaleY; + + renderer.pipelines.preBatch(src); + + for (var i = 0; i < tileCount; i++) { - videoFile = VideoFile.create(this, key, urls, loadEvent, asBlob, noAudio, xhrSettings); + var tile = renderTiles[i]; + + var tileset = gidMap[tile.index]; + + if (!tileset) + { + continue; + } + + var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); - if (videoFile) + if (tileTexCoords === null) { - this.addFile(videoFile); + continue; } + + var texture = tileset.glTexture; + + var textureUnit = pipeline.setTexture2D(texture, src); + + var frameWidth = tileset.tileWidth; + var frameHeight = tileset.tileHeight; + + var frameX = tileTexCoords.x; + var frameY = tileTexCoords.y; + + var tw = tileset.tileWidth * 0.5; + var th = tileset.tileHeight * 0.5; + + var tOffsetX = tileset.tileOffset.x; + var tOffsetY = tileset.tileOffset.y; + + var tint = getTint(tile.tint, alpha * tile.alpha); + + pipeline.batchTexture( + src, + texture, + texture.width, texture.height, + x + tile.pixelX * sx + (tw * sx - tOffsetX), y + tile.pixelY * sy + (th * sy - tOffsetY), + tile.width, tile.height, + sx, sy, + tile.rotation, + tile.flipX, tile.flipY, + scrollFactorX, scrollFactorY, + tw, th, + frameX, frameY, frameWidth, frameHeight, + tint, tint, tint, tint, false, + 0, 0, + camera, + null, + true, + textureUnit + ); } - return this; -}); + renderer.pipelines.postBatch(src); +}; -module.exports = VideoFile; +module.exports = TilemapLayerWebGLRenderer; /***/ }), -/* 1365 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 47975: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var CONST = __webpack_require__(21); -var CustomSet = __webpack_require__(149); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(95); -var FileTypesManager = __webpack_require__(8); -var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(24); -var SceneEvents = __webpack_require__(20); -var XHRSettings = __webpack_require__(156); +var Class = __webpack_require__(56694); +var Vector2 = __webpack_require__(93736); /** * @classdesc - * The Loader handles loading all external content such as Images, Sounds, Texture Atlases and data files. - * You typically interact with it via `this.load` in your Scene. Scenes can have a `preload` method, which is always - * called before the Scenes `create` method, allowing you to preload assets that the Scene may need. - * - * If you call any `this.load` methods from outside of `Scene.preload` then you need to start the Loader going - * yourself by calling `Loader.start()`. It's only automatically started during the Scene preload. - * - * The Loader uses a combination of tag loading (eg. Audio elements) and XHR and provides progress and completion events. - * Files are loaded in parallel by default. The amount of concurrent connections can be controlled in your Game Configuration. - * - * Once the Loader has started loading you are still able to add files to it. These can be injected as a result of a loader - * event, the type of file being loaded (such as a pack file) or other external events. As long as the Loader hasn't finished - * simply adding a new file to it, while running, will ensure it's added into the current queue. - * - * Every Scene has its own instance of the Loader and they are bound to the Scene in which they are created. However, - * assets loaded by the Loader are placed into global game-level caches. For example, loading an XML file will place that - * file inside `Game.cache.xml`, which is accessible from every Scene in your game, no matter who was responsible - * for loading it. The same is true of Textures. A texture loaded in one Scene is instantly available to all other Scenes - * in your game. - * - * The Loader works by using custom File Types. These are stored in the FileTypesManager, which injects them into the Loader - * when it's instantiated. You can create your own custom file types by extending either the File or MultiFile classes. - * See those files for more details. + * A Tileset is a combination of a single image containing the tiles and a container for data about + * each tile. * - * @class LoaderPlugin - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Loader + * @class Tileset + * @memberof Phaser.Tilemaps * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene which owns this Loader instance. + * @param {string} name - The name of the tileset in the map data. + * @param {number} firstgid - The first tile index this tileset contains. + * @param {number} [tileWidth=32] - Width of each tile (in pixels). + * @param {number} [tileHeight=32] - Height of each tile (in pixels). + * @param {number} [tileMargin=0] - The margin around all tiles in the sheet (in pixels). + * @param {number} [tileSpacing=0] - The spacing between each tile in the sheet (in pixels). + * @param {object} [tileProperties={}] - Custom properties defined per tile in the Tileset. + * These typically are custom properties created in Tiled when editing a tileset. + * @param {object} [tileData={}] - Data stored per tile. These typically are created in Tiled when editing a tileset, e.g. from Tiled's tile collision editor or terrain editor. + * @param {object} [tileOffset={x: 0, y: 0}] - Tile texture drawing offset. */ -var LoaderPlugin = new Class({ - - Extends: EventEmitter, +var Tileset = new Class({ initialize: - function LoaderPlugin (scene) + function Tileset (name, firstgid, tileWidth, tileHeight, tileMargin, tileSpacing, tileProperties, tileData, tileOffset) { - EventEmitter.call(this); - - var gameConfig = scene.sys.game.config; - var sceneConfig = scene.sys.settings.loader; - - /** - * The Scene which owns this Loader instance. - * - * @name Phaser.Loader.LoaderPlugin#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; - - /** - * A reference to the Scene Systems. - * - * @name Phaser.Loader.LoaderPlugin#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; - - /** - * A reference to the global Cache Manager. - * - * @name Phaser.Loader.LoaderPlugin#cacheManager - * @type {Phaser.Cache.CacheManager} - * @since 3.7.0 - */ - this.cacheManager = scene.sys.cache; - - /** - * A reference to the global Texture Manager. - * - * @name Phaser.Loader.LoaderPlugin#textureManager - * @type {Phaser.Textures.TextureManager} - * @since 3.7.0 - */ - this.textureManager = scene.sys.textures; - - /** - * A reference to the global Scene Manager. - * - * @name Phaser.Loader.LoaderPlugin#sceneManager - * @type {Phaser.Scenes.SceneManager} - * @protected - * @since 3.16.0 - */ - this.sceneManager = scene.sys.game.scene; - - // Inject the available filetypes into the Loader - FileTypesManager.install(this); - - /** - * An optional prefix that is automatically prepended to the start of every file key. - * If prefix was `MENU.` and you load an image with the key 'Background' the resulting key would be `MENU.Background`. - * You can set this directly, or call `Loader.setPrefix()`. It will then affect every file added to the Loader - * from that point on. It does _not_ change any file already in the load queue. - * - * @name Phaser.Loader.LoaderPlugin#prefix - * @type {string} - * @default '' - * @since 3.7.0 - */ - this.prefix = ''; + if (tileWidth === undefined || tileWidth <= 0) { tileWidth = 32; } + if (tileHeight === undefined || tileHeight <= 0) { tileHeight = 32; } + if (tileMargin === undefined) { tileMargin = 0; } + if (tileSpacing === undefined) { tileSpacing = 0; } + if (tileProperties === undefined) { tileProperties = {}; } + if (tileData === undefined) { tileData = {}; } /** - * The value of `path`, if set, is placed before any _relative_ file path given. For example: - * - * ```javascript - * this.load.path = "images/sprites/"; - * this.load.image("ball", "ball.png"); - * this.load.image("tree", "level1/oaktree.png"); - * this.load.image("boom", "http://server.com/explode.png"); - * ``` - * - * Would load the `ball` file from `images/sprites/ball.png` and the tree from - * `images/sprites/level1/oaktree.png` but the file `boom` would load from the URL - * given as it's an absolute URL. - * - * Please note that the path is added before the filename but *after* the baseURL (if set.) - * - * If you set this property directly then it _must_ end with a "/". Alternatively, call `setPath()` and it'll do it for you. + * The name of the Tileset. * - * @name Phaser.Loader.LoaderPlugin#path + * @name Phaser.Tilemaps.Tileset#name * @type {string} - * @default '' * @since 3.0.0 */ - this.path = ''; + this.name = name; /** - * If you want to append a URL before the path of any asset you can set this here. - * - * Useful if allowing the asset base url to be configured outside of the game code. - * - * If you set this property directly then it _must_ end with a "/". Alternatively, call `setBaseURL()` and it'll do it for you. + * The starting index of the first tile index this Tileset contains. * - * @name Phaser.Loader.LoaderPlugin#baseURL - * @type {string} - * @default '' + * @name Phaser.Tilemaps.Tileset#firstgid + * @type {number} * @since 3.0.0 */ - this.baseURL = ''; - - this.setBaseURL(GetFastValue(sceneConfig, 'baseURL', gameConfig.loaderBaseURL)); - - this.setPath(GetFastValue(sceneConfig, 'path', gameConfig.loaderPath)); - - this.setPrefix(GetFastValue(sceneConfig, 'prefix', gameConfig.loaderPrefix)); + this.firstgid = firstgid; /** - * The number of concurrent / parallel resources to try and fetch at once. - * - * Old browsers limit 6 requests per domain; modern ones, especially those with HTTP/2 don't limit it at all. - * - * The default is 32 but you can change this in your Game Config, or by changing this property before the Loader starts. + * The width of each tile (in pixels). Use setTileSize to change. * - * @name Phaser.Loader.LoaderPlugin#maxParallelDownloads + * @name Phaser.Tilemaps.Tileset#tileWidth * @type {number} + * @readonly * @since 3.0.0 */ - this.maxParallelDownloads = GetFastValue(sceneConfig, 'maxParallelDownloads', gameConfig.loaderMaxParallelDownloads); + this.tileWidth = tileWidth; /** - * xhr specific global settings (can be overridden on a per-file basis) + * The height of each tile (in pixels). Use setTileSize to change. * - * @name Phaser.Loader.LoaderPlugin#xhr - * @type {Phaser.Types.Loader.XHRSettingsObject} + * @name Phaser.Tilemaps.Tileset#tileHeight + * @type {number} + * @readonly * @since 3.0.0 */ - this.xhr = XHRSettings( - GetFastValue(sceneConfig, 'responseType', gameConfig.loaderResponseType), - GetFastValue(sceneConfig, 'async', gameConfig.loaderAsync), - GetFastValue(sceneConfig, 'user', gameConfig.loaderUser), - GetFastValue(sceneConfig, 'password', gameConfig.loaderPassword), - GetFastValue(sceneConfig, 'timeout', gameConfig.loaderTimeout), - GetFastValue(sceneConfig, 'withCredentials', gameConfig.loaderWithCredentials) - ); + this.tileHeight = tileHeight; /** - * The crossOrigin value applied to loaded images. Very often this needs to be set to 'anonymous'. + * The margin around the tiles in the sheet (in pixels). Use `setSpacing` to change. * - * @name Phaser.Loader.LoaderPlugin#crossOrigin - * @type {string} + * @name Phaser.Tilemaps.Tileset#tileMargin + * @type {number} + * @readonly * @since 3.0.0 */ - this.crossOrigin = GetFastValue(sceneConfig, 'crossOrigin', gameConfig.loaderCrossOrigin); + this.tileMargin = tileMargin; /** - * The total number of files to load. It may not always be accurate because you may add to the Loader during the process - * of loading, especially if you load a Pack File. Therefore this value can change, but in most cases remains static. + * The spacing between each the tile in the sheet (in pixels). Use `setSpacing` to change. * - * @name Phaser.Loader.LoaderPlugin#totalToLoad + * @name Phaser.Tilemaps.Tileset#tileSpacing * @type {number} - * @default 0 + * @readonly * @since 3.0.0 */ - this.totalToLoad = 0; + this.tileSpacing = tileSpacing; /** - * The progress of the current load queue, as a float value between 0 and 1. - * This is updated automatically as files complete loading. - * Note that it is possible for this value to go down again if you add content to the current load queue during a load. + * Tileset-specific properties per tile that are typically defined in the Tiled editor in the + * Tileset editor. * - * @name Phaser.Loader.LoaderPlugin#progress - * @type {number} - * @default 0 + * @name Phaser.Tilemaps.Tileset#tileProperties + * @type {object} * @since 3.0.0 */ - this.progress = 0; + this.tileProperties = tileProperties; /** - * Files are placed in this Set when they're added to the Loader via `addFile`. - * - * They are moved to the `inflight` Set when they start loading, and assuming a successful - * load, to the `queue` Set for further processing. - * - * By the end of the load process this Set will be empty. + * Tileset-specific data per tile that are typically defined in the Tiled editor, e.g. within + * the Tileset collision editor. This is where collision objects and terrain are stored. * - * @name Phaser.Loader.LoaderPlugin#list - * @type {Phaser.Structs.Set.} + * @name Phaser.Tilemaps.Tileset#tileData + * @type {object} * @since 3.0.0 */ - this.list = new CustomSet(); + this.tileData = tileData; /** - * Files are stored in this Set while they're in the process of being loaded. + * Controls the drawing offset from the tile origin. + * Defaults to 0x0, no offset. * - * Upon a successful load they are moved to the `queue` Set. - * - * By the end of the load process this Set will be empty. - * - * @name Phaser.Loader.LoaderPlugin#inflight - * @type {Phaser.Structs.Set.} - * @since 3.0.0 + * @name Phaser.Tilemaps.Tileset#tileOffset + * @type {Phaser.Math.Vector2} + * @since 3.60.0 */ - this.inflight = new CustomSet(); + this.tileOffset = new Vector2(); + + if (tileOffset !== undefined) + { + this.tileOffset.set(tileOffset.x, tileOffset.y); + } /** - * Files are stored in this Set while they're being processed. - * - * If the process is successful they are moved to their final destination, which could be - * a Cache or the Texture Manager. - * - * At the end of the load process this Set will be empty. + * The cached image that contains the individual tiles. Use setImage to set. * - * @name Phaser.Loader.LoaderPlugin#queue - * @type {Phaser.Structs.Set.} + * @name Phaser.Tilemaps.Tileset#image + * @type {?Phaser.Textures.Texture} + * @readonly * @since 3.0.0 */ - this.queue = new CustomSet(); + this.image = null; /** - * A temporary Set in which files are stored after processing, - * awaiting destruction at the end of the load process. + * The gl texture used by the WebGL renderer. * - * @name Phaser.Loader.LoaderPlugin#_deleteQueue - * @type {Phaser.Structs.Set.} - * @private - * @since 3.7.0 + * @name Phaser.Tilemaps.Tileset#glTexture + * @type {?WebGLTexture} + * @readonly + * @since 3.11.0 */ - this._deleteQueue = new CustomSet(); + this.glTexture = null; /** - * The total number of files that failed to load during the most recent load. - * This value is reset when you call `Loader.start`. + * The number of tile rows in the the tileset. * - * @name Phaser.Loader.LoaderPlugin#totalFailed + * @name Phaser.Tilemaps.Tileset#rows * @type {number} - * @default 0 - * @since 3.7.0 + * @readonly + * @since 3.0.0 */ - this.totalFailed = 0; + this.rows = 0; /** - * The total number of files that successfully loaded during the most recent load. - * This value is reset when you call `Loader.start`. + * The number of tile columns in the tileset. * - * @name Phaser.Loader.LoaderPlugin#totalComplete + * @name Phaser.Tilemaps.Tileset#columns * @type {number} - * @default 0 - * @since 3.7.0 + * @readonly + * @since 3.0.0 */ - this.totalComplete = 0; + this.columns = 0; /** - * The current state of the Loader. + * The total number of tiles in the tileset. * - * @name Phaser.Loader.LoaderPlugin#state + * @name Phaser.Tilemaps.Tileset#total * @type {number} * @readonly * @since 3.0.0 */ - this.state = CONST.LOADER_IDLE; + this.total = 0; /** - * The current index being used by multi-file loaders to avoid key clashes. + * The look-up table to specific tile image texture coordinates (UV in pixels). Each element + * contains the coordinates for a tile in an object of the form {x, y}. * - * @name Phaser.Loader.LoaderPlugin#multiKeyIndex - * @type {number} - * @private - * @since 3.20.0 - */ - this.multiKeyIndex = 0; + * @name Phaser.Tilemaps.Tileset#texCoordinates + * @type {object[]} + * @readonly + * @since 3.0.0 + */ + this.texCoordinates = []; + }, - scene.sys.events.once(SceneEvents.BOOT, this.boot, this); - scene.sys.events.on(SceneEvents.START, this.pluginStart, this); + /** + * Get a tiles properties that are stored in the Tileset. Returns null if tile index is not + * contained in this Tileset. This is typically defined in Tiled under the Tileset editor. + * + * @method Phaser.Tilemaps.Tileset#getTileProperties + * @since 3.0.0 + * + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. + * + * @return {?(object|undefined)} + */ + getTileProperties: function (tileIndex) + { + if (!this.containsTileIndex(tileIndex)) { return null; } + + return this.tileProperties[tileIndex - this.firstgid]; }, /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. + * Get a tile's data that is stored in the Tileset. Returns null if tile index is not contained + * in this Tileset. This is typically defined in Tiled and will contain both Tileset collision + * info and terrain mapping. * - * @method Phaser.Loader.LoaderPlugin#boot - * @private - * @since 3.5.1 + * @method Phaser.Tilemaps.Tileset#getTileData + * @since 3.0.0 + * + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. + * + * @return {?object|undefined} */ - boot: function () + getTileData: function (tileIndex) { - this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); + if (!this.containsTileIndex(tileIndex)) { return null; } + + return this.tileData[tileIndex - this.firstgid]; }, /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. + * Get a tile's collision group that is stored in the Tileset. Returns null if tile index is not + * contained in this Tileset. This is typically defined within Tiled's tileset collision editor. + * + * @method Phaser.Tilemaps.Tileset#getTileCollisionGroup + * @since 3.0.0 + * + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. + * + * @return {?object} + */ + getTileCollisionGroup: function (tileIndex) + { + var data = this.getTileData(tileIndex); + + return (data && data.objectgroup) ? data.objectgroup : null; + }, + + /** + * Returns true if and only if this Tileset contains the given tile index. + * + * @method Phaser.Tilemaps.Tileset#containsTileIndex + * @since 3.0.0 * - * @method Phaser.Loader.LoaderPlugin#pluginStart - * @private - * @since 3.5.1 + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. + * + * @return {boolean} */ - pluginStart: function () + containsTileIndex: function (tileIndex) { - this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); + return ( + tileIndex >= this.firstgid && + tileIndex < (this.firstgid + this.total) + ); }, /** - * If you want to append a URL before the path of any asset you can set this here. - * - * Useful if allowing the asset base url to be configured outside of the game code. - * - * Once a base URL is set it will affect every file loaded by the Loader from that point on. It does _not_ change any - * file _already_ being loaded. To reset it, call this method with no arguments. + * Returns the texture coordinates (UV in pixels) in the Tileset image for the given tile index. + * Returns null if tile index is not contained in this Tileset. * - * @method Phaser.Loader.LoaderPlugin#setBaseURL + * @method Phaser.Tilemaps.Tileset#getTileTextureCoordinates * @since 3.0.0 * - * @param {string} [url] - The URL to use. Leave empty to reset. + * @param {number} tileIndex - The unique id of the tile across all tilesets in the map. * - * @return {this} This Loader object. + * @return {?object} Object in the form { x, y } representing the top-left UV coordinate + * within the Tileset image. */ - setBaseURL: function (url) + getTileTextureCoordinates: function (tileIndex) { - if (url === undefined) { url = ''; } - - if (url !== '' && url.substr(-1) !== '/') - { - url = url.concat('/'); - } - - this.baseURL = url; + if (!this.containsTileIndex(tileIndex)) { return null; } - return this; + return this.texCoordinates[tileIndex - this.firstgid]; }, /** - * The value of `path`, if set, is placed before any _relative_ file path given. For example: - * - * ```javascript - * this.load.setPath("images/sprites/"); - * this.load.image("ball", "ball.png"); - * this.load.image("tree", "level1/oaktree.png"); - * this.load.image("boom", "http://server.com/explode.png"); - * ``` - * - * Would load the `ball` file from `images/sprites/ball.png` and the tree from - * `images/sprites/level1/oaktree.png` but the file `boom` would load from the URL - * given as it's an absolute URL. - * - * Please note that the path is added before the filename but *after* the baseURL (if set.) - * - * Once a path is set it will then affect every file added to the Loader from that point on. It does _not_ change any - * file _already_ in the load queue. To reset it, call this method with no arguments. + * Sets the image associated with this Tileset and updates the tile data (rows, columns, etc.). * - * @method Phaser.Loader.LoaderPlugin#setPath + * @method Phaser.Tilemaps.Tileset#setImage * @since 3.0.0 * - * @param {string} [path] - The path to use. Leave empty to reset. + * @param {Phaser.Textures.Texture} texture - The image that contains the tiles. * - * @return {this} This Loader object. + * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ - setPath: function (path) + setImage: function (texture) { - if (path === undefined) { path = ''; } + this.image = texture; - if (path !== '' && path.substr(-1) !== '/') - { - path = path.concat('/'); - } + this.glTexture = texture.get().source.glTexture; - this.path = path; + this.updateTileData(this.image.source[0].width, this.image.source[0].height); return this; }, /** - * An optional prefix that is automatically prepended to the start of every file key. - * - * If prefix was `MENU.` and you load an image with the key 'Background' the resulting key would be `MENU.Background`. - * - * Once a prefix is set it will then affect every file added to the Loader from that point on. It does _not_ change any - * file _already_ in the load queue. To reset it, call this method with no arguments. + * Sets the tile width & height and updates the tile data (rows, columns, etc.). * - * @method Phaser.Loader.LoaderPlugin#setPrefix - * @since 3.7.0 + * @method Phaser.Tilemaps.Tileset#setTileSize + * @since 3.0.0 * - * @param {string} [prefix] - The prefix to use. Leave empty to reset. + * @param {number} [tileWidth] - The width of a tile in pixels. + * @param {number} [tileHeight] - The height of a tile in pixels. * - * @return {this} This Loader object. + * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ - setPrefix: function (prefix) + setTileSize: function (tileWidth, tileHeight) { - if (prefix === undefined) { prefix = ''; } + if (tileWidth !== undefined) { this.tileWidth = tileWidth; } + if (tileHeight !== undefined) { this.tileHeight = tileHeight; } - this.prefix = prefix; + if (this.image) + { + this.updateTileData(this.image.source[0].width, this.image.source[0].height); + } return this; }, /** - * Sets the Cross Origin Resource Sharing value used when loading files. - * - * Files can override this value on a per-file basis by specifying an alternative `crossOrigin` value in their file config. - * - * Once CORs is set it will then affect every file loaded by the Loader from that point on, as long as they don't have - * their own CORs setting. To reset it, call this method with no arguments. - * - * For more details about CORs see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS + * Sets the tile margin & spacing and updates the tile data (rows, columns, etc.). * - * @method Phaser.Loader.LoaderPlugin#setCORS + * @method Phaser.Tilemaps.Tileset#setSpacing * @since 3.0.0 * - * @param {string} [crossOrigin] - The value to use for the `crossOrigin` property in the load request. + * @param {number} [margin] - The margin around the tiles in the sheet (in pixels). + * @param {number} [spacing] - The spacing between the tiles in the sheet (in pixels). * - * @return {this} This Loader object. + * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ - setCORS: function (crossOrigin) + setSpacing: function (margin, spacing) { - this.crossOrigin = crossOrigin; + if (margin !== undefined) { this.tileMargin = margin; } + if (spacing !== undefined) { this.tileSpacing = spacing; } + + if (this.image) + { + this.updateTileData(this.image.source[0].width, this.image.source[0].height); + } return this; }, /** - * Adds a file, or array of files, into the load queue. - * - * The file must be an instance of `Phaser.Loader.File`, or a class that extends it. The Loader will check that the key - * used by the file won't conflict with any other key either in the loader, the inflight queue or the target cache. - * If allowed it will then add the file into the pending list, read for the load to start. Or, if the load has already - * started, ready for the next batch of files to be pulled from the list to the inflight queue. - * - * You should not normally call this method directly, but rather use one of the Loader methods like `image` or `atlas`, - * however you can call this as long as the file given to it is well formed. + * Updates tile texture coordinates and tileset data. * - * @method Phaser.Loader.LoaderPlugin#addFile - * @fires Phaser.Loader.Events#ADD + * @method Phaser.Tilemaps.Tileset#updateTileData * @since 3.0.0 * - * @param {(Phaser.Loader.File|Phaser.Loader.File[])} file - The file, or array of files, to be added to the load queue. + * @param {number} imageWidth - The (expected) width of the image to slice. + * @param {number} imageHeight - The (expected) height of the image to slice. + * + * @return {Phaser.Tilemaps.Tileset} This Tileset object. */ - addFile: function (file) + updateTileData: function (imageWidth, imageHeight) { - if (!Array.isArray(file)) + var rowCount = (imageHeight - this.tileMargin * 2 + this.tileSpacing) / (this.tileHeight + this.tileSpacing); + var colCount = (imageWidth - this.tileMargin * 2 + this.tileSpacing) / (this.tileWidth + this.tileSpacing); + + if (rowCount % 1 !== 0 || colCount % 1 !== 0) { - file = [ file ]; + console.warn('Image tile area not tile size multiple in: ' + this.name); } - for (var i = 0; i < file.length; i++) - { - var item = file[i]; + // In Tiled a tileset image that is not an even multiple of the tile dimensions is truncated + // - hence the floor when calculating the rows/columns. + rowCount = Math.floor(rowCount); + colCount = Math.floor(colCount); - // Does the file already exist in the cache or texture manager? - // Or will it conflict with a file already in the queue or inflight? - if (!this.keyExists(item)) - { - this.list.set(item); + this.rows = rowCount; + this.columns = colCount; - this.emit(Events.ADD, item.key, item.type, this, item); + // In Tiled, "empty" spaces in a tileset count as tiles and hence count towards the gid + this.total = rowCount * colCount; - if (this.isLoading()) - { - this.totalToLoad++; - this.updateProgress(); - } - } - } - }, + this.texCoordinates.length = 0; - /** - * Checks the key and type of the given file to see if it will conflict with anything already - * in a Cache, the Texture Manager, or the list or inflight queues. - * - * @method Phaser.Loader.LoaderPlugin#keyExists - * @since 3.7.0 - * - * @param {Phaser.Loader.File} file - The file to check the key of. - * - * @return {boolean} `true` if adding this file will cause a cache or queue conflict, otherwise `false`. - */ - keyExists: function (file) - { - var keyConflict = file.hasCacheConflict(); + var tx = this.tileMargin; + var ty = this.tileMargin; - if (!keyConflict) + for (var y = 0; y < this.rows; y++) { - this.list.iterate(function (item) + for (var x = 0; x < this.columns; x++) { - if (item.type === file.type && item.key === file.key) - { - keyConflict = true; - - return false; - } + this.texCoordinates.push({ x: tx, y: ty }); + tx += this.tileWidth + this.tileSpacing; + } - }); + tx = this.tileMargin; + ty += this.tileHeight + this.tileSpacing; } - if (!keyConflict && this.isLoading()) - { - this.inflight.iterate(function (item) - { - if (item.type === file.type && item.key === file.key) - { - keyConflict = true; + return this; + } - return false; - } +}); - }); +module.exports = Tileset; - this.queue.iterate(function (item) - { - if (item.type === file.type && item.key === file.key) - { - keyConflict = true; - return false; - } +/***/ }), - }); +/***/ 92839: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetTileAt = __webpack_require__(15494); + +/** + * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting + * faces are used internally for optimizing collisions against tiles. This method is mostly used + * internally to optimize recalculating faces when only one tile has been changed. + * + * @function Phaser.Tilemaps.Components.CalculateFacesAt + * @since 3.0.0 + * + * @param {number} tileX - The x coordinate. + * @param {number} tileY - The y coordinate. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var CalculateFacesAt = function (tileX, tileY, layer) +{ + var tile = GetTileAt(tileX, tileY, true, layer); + var above = GetTileAt(tileX, tileY - 1, true, layer); + var below = GetTileAt(tileX, tileY + 1, true, layer); + var left = GetTileAt(tileX - 1, tileY, true, layer); + var right = GetTileAt(tileX + 1, tileY, true, layer); + var tileCollides = tile && tile.collides; + + // Assume the changed tile has all interesting edges + if (tileCollides) + { + tile.faceTop = true; + tile.faceBottom = true; + tile.faceLeft = true; + tile.faceRight = true; + } + + // Reset edges that are shared between tile and its neighbors + if (above && above.collides) + { + if (tileCollides) + { + tile.faceTop = false; } - return keyConflict; - }, + above.faceBottom = !tileCollides; + } - /** - * Takes a well formed, fully parsed pack file object and adds its entries into the load queue. Usually you do not call - * this method directly, but instead use `Loader.pack` and supply a path to a JSON file that holds the - * pack data. However, if you've got the data prepared you can pass it to this method. - * - * You can also provide an optional key. If you do then it will only add the entries from that part of the pack into - * to the load queue. If not specified it will add all entries it finds. For more details about the pack file format - * see the `LoaderPlugin.pack` method. - * - * @method Phaser.Loader.LoaderPlugin#addPack - * @since 3.7.0 - * - * @param {any} pack - The Pack File data to be parsed and each entry of it to added to the load queue. - * @param {string} [packKey] - An optional key to use from the pack file data. - * - * @return {boolean} `true` if any files were added to the queue, otherwise `false`. - */ - addPack: function (pack, packKey) + if (below && below.collides) { - // if no packKey provided we'll add everything to the queue - if (packKey && pack.hasOwnProperty(packKey)) + if (tileCollides) { - pack = { packKey: pack[packKey] }; + tile.faceBottom = false; } - var total = 0; + below.faceTop = !tileCollides; + } - // Store the loader settings in case this pack replaces them - var currentBaseURL = this.baseURL; - var currentPath = this.path; - var currentPrefix = this.prefix; + if (left && left.collides) + { + if (tileCollides) + { + tile.faceLeft = false; + } - // Here we go ... - for (var key in pack) + left.faceRight = !tileCollides; + } + + if (right && right.collides) + { + if (tileCollides) { - if (!Object.prototype.hasOwnProperty.call(pack, key)) - { - continue; - } + tile.faceRight = false; + } - var config = pack[key]; + right.faceLeft = !tileCollides; + } - // Any meta data to process? - var baseURL = GetFastValue(config, 'baseURL', currentBaseURL); - var path = GetFastValue(config, 'path', currentPath); - var prefix = GetFastValue(config, 'prefix', currentPrefix); - var files = GetFastValue(config, 'files', null); - var defaultType = GetFastValue(config, 'defaultType', 'void'); + if (tile && !tile.collides) + { + tile.resetFaces(); + } - if (Array.isArray(files)) - { - this.setBaseURL(baseURL); - this.setPath(path); - this.setPrefix(prefix); + return tile; +}; - for (var i = 0; i < files.length; i++) - { - var file = files[i]; - var type = (file.hasOwnProperty('type')) ? file.type : defaultType; +module.exports = CalculateFacesAt; - if (this[type]) - { - this[type](file); - total++; - } - } - } - } - // Reset the loader settings - this.setBaseURL(currentBaseURL); - this.setPath(currentPath); - this.setPrefix(currentPrefix); +/***/ }), - return (total > 0); - }, +/***/ 60386: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Is the Loader actively loading, or processing loaded files? - * - * @method Phaser.Loader.LoaderPlugin#isLoading - * @since 3.0.0 - * - * @return {boolean} `true` if the Loader is busy loading or processing, otherwise `false`. - */ - isLoading: function () - { - return (this.state === CONST.LOADER_LOADING || this.state === CONST.LOADER_PROCESSING); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Is the Loader ready to start a new load? - * - * @method Phaser.Loader.LoaderPlugin#isReady - * @since 3.0.0 - * - * @return {boolean} `true` if the Loader is ready to start a new load, otherwise `false`. - */ - isReady: function () - { - return (this.state === CONST.LOADER_IDLE || this.state === CONST.LOADER_COMPLETE); - }, +var GetTileAt = __webpack_require__(15494); +var GetTilesWithin = __webpack_require__(50811); - /** - * Starts the Loader running. This will reset the progress and totals and then emit a `start` event. - * If there is nothing in the queue the Loader will immediately complete, otherwise it will start - * loading the first batch of files. - * - * The Loader is started automatically if the queue is populated within your Scenes `preload` method. - * - * However, outside of this, you need to call this method to start it. - * - * If the Loader is already running this method will simply return. - * - * @method Phaser.Loader.LoaderPlugin#start - * @fires Phaser.Loader.Events#START - * @since 3.0.0 - */ - start: function () +/** + * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the + * layer. Interesting faces are used internally for optimizing collisions against tiles. This method + * is mostly used internally. + * + * @function Phaser.Tilemaps.Components.CalculateFacesWithin + * @since 3.0.0 + * + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var CalculateFacesWithin = function (tileX, tileY, width, height, layer) +{ + var above = null; + var below = null; + var left = null; + var right = null; + + var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + + for (var i = 0; i < tiles.length; i++) { - if (!this.isReady()) + var tile = tiles[i]; + + if (tile) { - return; + if (tile.collides) + { + above = GetTileAt(tile.x, tile.y - 1, true, layer); + below = GetTileAt(tile.x, tile.y + 1, true, layer); + left = GetTileAt(tile.x - 1, tile.y, true, layer); + right = GetTileAt(tile.x + 1, tile.y, true, layer); + + tile.faceTop = (above && above.collides) ? false : true; + tile.faceBottom = (below && below.collides) ? false : true; + tile.faceLeft = (left && left.collides) ? false : true; + tile.faceRight = (right && right.collides) ? false : true; + } + else + { + tile.resetFaces(); + } } + } +}; - this.progress = 0; +module.exports = CalculateFacesWithin; - this.totalFailed = 0; - this.totalComplete = 0; - this.totalToLoad = this.list.size; - this.emit(Events.START, this); +/***/ }), - if (this.list.size === 0) - { - this.loadComplete(); - } - else - { - this.state = CONST.LOADER_LOADING; +/***/ 13125: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.inflight.clear(); - this.queue.clear(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.updateProgress(); +var Vector2 = __webpack_require__(93736); - this.checkLoadQueue(); +var point = new Vector2(); - this.systems.events.on(SceneEvents.UPDATE, this.update, this); - } - }, +/** + * Checks if the given tile coordinate is within the isometric layer bounds, or not. + * + * @function Phaser.Tilemaps.Components.CheckIsoBounds + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to check against. + * @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against. + * + * @return {boolean} Returns `true` if the coordinates are within the iso bounds. + */ +var CheckIsoBounds = function (tileX, tileY, layer, camera) +{ + var tilemapLayer = layer.tilemapLayer; - /** - * Called automatically during the load process. - * It updates the `progress` value and then emits a progress event, which you can use to - * display a loading bar in your game. - * - * @method Phaser.Loader.LoaderPlugin#updateProgress - * @fires Phaser.Loader.Events#PROGRESS - * @since 3.0.0 - */ - updateProgress: function () - { - this.progress = 1 - ((this.list.size + this.inflight.size) / this.totalToLoad); + var cullPaddingX = tilemapLayer.cullPaddingX; + var cullPaddingY = tilemapLayer.cullPaddingY; - this.emit(Events.PROGRESS, this.progress); - }, + var pos = tilemapLayer.tilemap.tileToWorldXY(tileX, tileY, point, camera, tilemapLayer); - /** - * Called automatically during the load process. - * - * @method Phaser.Loader.LoaderPlugin#update - * @since 3.10.0 - */ - update: function () - { - if (this.state === CONST.LOADER_LOADING && this.list.size > 0 && this.inflight.size < this.maxParallelDownloads) - { - this.checkLoadQueue(); - } - }, + // we always subtract 1/2 of the tile's height/width to make the culling distance start from the center of the tiles. + return pos.x > camera.worldView.x + tilemapLayer.scaleX * layer.tileWidth * (-cullPaddingX - 0.5) + && pos.x < camera.worldView.right + tilemapLayer.scaleX * layer.tileWidth * (cullPaddingX - 0.5) + && pos.y > camera.worldView.y + tilemapLayer.scaleY * layer.tileHeight * (-cullPaddingY - 1.0) + && pos.y < camera.worldView.bottom + tilemapLayer.scaleY * layer.tileHeight * (cullPaddingY - 0.5); +}; - /** - * An internal method called by the Loader. - * - * It will check to see if there are any more files in the pending list that need loading, and if so it will move - * them from the list Set into the inflight Set, set their CORs flag and start them loading. - * - * It will carrying on doing this for each file in the pending list until it runs out, or hits the max allowed parallel downloads. - * - * @method Phaser.Loader.LoaderPlugin#checkLoadQueue - * @private - * @since 3.7.0 - */ - checkLoadQueue: function () - { - this.list.each(function (file) - { - if (file.state === CONST.FILE_POPULATED || (file.state === CONST.FILE_PENDING && this.inflight.size < this.maxParallelDownloads)) - { - this.inflight.set(file); +module.exports = CheckIsoBounds; - this.list.delete(file); - // If the file doesn't have its own crossOrigin set, we'll use the Loaders (which is undefined by default) - if (!file.crossOrigin) - { - file.crossOrigin = this.crossOrigin; - } +/***/ }), - file.load(); - } +/***/ 17347: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (this.inflight.size === this.maxParallelDownloads) - { - // Tells the Set iterator to abort - return false; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - }, this); - }, +var CalculateFacesWithin = __webpack_require__(60386); +var GetTilesWithin = __webpack_require__(50811); +var IsInLayerBounds = __webpack_require__(62839); +var Tile = __webpack_require__(29633); - /** - * An internal method called automatically by the XHRLoader belong to a File. - * - * This method will remove the given file from the inflight Set and update the load progress. - * If the file was successful its `onProcess` method is called, otherwise it is added to the delete queue. - * - * @method Phaser.Loader.LoaderPlugin#nextFile - * @fires Phaser.Loader.Events#FILE_LOAD - * @fires Phaser.Loader.Events#FILE_LOAD_ERROR - * @since 3.0.0 - * - * @param {Phaser.Loader.File} file - The File that just finished loading, or errored during load. - * @param {boolean} success - `true` if the file loaded successfully, otherwise `false`. - */ - nextFile: function (file, success) +/** + * Copies the tiles in the source rectangular area to a new destination (all specified in tile + * coordinates) within the layer. This copies all tile properties and recalculates collision + * information in the destination region. + * + * @function Phaser.Tilemaps.Components.Copy + * @since 3.0.0 + * + * @param {number} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. + * @param {number} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. + * @param {number} width - The width of the area to copy, in tiles, not pixels. + * @param {number} height - The height of the area to copy, in tiles, not pixels. + * @param {number} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. + * @param {number} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var Copy = function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, layer) +{ + if (recalculateFaces === undefined) { recalculateFaces = true; } + + // Returns an array of Tile references + var srcTiles = GetTilesWithin(srcTileX, srcTileY, width, height, null, layer); + + // Create a new array of fresh Tile objects + var copyTiles = []; + + srcTiles.forEach(function (tile) { - // Has the game been destroyed during load? If so, bail out now. - if (!this.inflight) + var newTile = new Tile( + tile.layer, + tile.index, + tile.x, + tile.y, + tile.width, + tile.height, + tile.baseWidth, + tile.baseHeight + ); + + newTile.copy(tile); + + copyTiles.push(newTile); + }); + + var offsetX = destTileX - srcTileX; + var offsetY = destTileY - srcTileY; + + for (var i = 0; i < copyTiles.length; i++) + { + var copy = copyTiles[i]; + var tileX = copy.x + offsetX; + var tileY = copy.y + offsetY; + + if (IsInLayerBounds(tileX, tileY, layer)) { - return; + if (layer.data[tileY][tileX]) + { + copy.x = tileX; + copy.y = tileY; + copy.updatePixelXY(); + + layer.data[tileY][tileX] = copy; + } } + } - this.inflight.delete(file); + if (recalculateFaces) + { + // Recalculate the faces within the destination area and neighboring tiles + CalculateFacesWithin(destTileX - 1, destTileY - 1, width + 2, height + 2, layer); + } - this.updateProgress(); + srcTiles.length = 0; + copyTiles.length = 0; +}; - if (success) - { - this.totalComplete++; +module.exports = Copy; - this.queue.set(file); - this.emit(Events.FILE_LOAD, file); +/***/ }), - file.onProcess(); - } - else - { - this.totalFailed++; +/***/ 93604: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this._deleteQueue.set(file); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.emit(Events.FILE_LOAD_ERROR, file); +var GetTilesWithin = __webpack_require__(50811); +var ReplaceByIndex = __webpack_require__(51202); - this.fileProcessComplete(file); - } - }, +/** + * Creates a Sprite for every object matching the given tile indexes in the layer. You can + * optionally specify if each tile will be replaced with a new tile after the Sprite has been + * created. This is useful if you want to lay down special tiles in a level that are converted to + * Sprites, but want to replace the tile itself with a floor tile or similar once converted. + * + * @function Phaser.Tilemaps.Components.CreateFromTiles + * @since 3.0.0 + * + * @param {(number|number[])} indexes - The tile index, or array of indexes, to create Sprites from. + * @param {?(number|number[])} replacements - The tile index, or array of indexes, to change a converted tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a one-to-one mapping with the indexes array. + * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. scene.make.sprite). + * @param {Phaser.Scene} scene - The Scene to create the Sprites within. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when determining the world XY + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created. + */ +var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, camera, layer) +{ + if (!spriteConfig) { spriteConfig = {}; } - /** - * An internal method that is called automatically by the File when it has finished processing. - * - * If the process was successful, and the File isn't part of a MultiFile, its `addToCache` method is called. - * - * It this then removed from the queue. If there are no more files to load `loadComplete` is called. - * - * @method Phaser.Loader.LoaderPlugin#fileProcessComplete - * @since 3.7.0 - * - * @param {Phaser.Loader.File} file - The file that has finished processing. - */ - fileProcessComplete: function (file) + if (!Array.isArray(indexes)) { - // Has the game been destroyed during load? If so, bail out now. - if (!this.scene || !this.systems || !this.systems.game || this.systems.game.pendingDestroy) + indexes = [ indexes ]; + } + + var tilemapLayer = layer.tilemapLayer; + + if (!scene) { scene = tilemapLayer.scene; } + if (!camera) { camera = scene.cameras.main; } + + var tiles = GetTilesWithin(0, 0, layer.width, layer.height, null, layer); + var sprites = []; + var i; + + for (i = 0; i < tiles.length; i++) + { + var tile = tiles[i]; + + if (indexes.indexOf(tile.index) !== -1) { - return; + var point = tilemapLayer.tileToWorldXY(tile.x, tile.y, undefined, camera,layer); + + spriteConfig.x = point.x; + spriteConfig.y = point.y; + + sprites.push(scene.make.sprite(spriteConfig)); } + } - // This file has failed, so move it to the failed Set - if (file.state === CONST.FILE_ERRORED) + if (typeof replacements === 'number') + { + // Assume 1 replacement for all types of tile given + for (i = 0; i < indexes.length; i++) { - if (file.multiFile) - { - file.multiFile.onFileFailed(file); - } + ReplaceByIndex(indexes[i], replacements, 0, 0, layer.width, layer.height, layer); } - else if (file.state === CONST.FILE_COMPLETE) + } + else if (Array.isArray(replacements)) + { + // Assume 1 to 1 mapping with indexes array + for (i = 0; i < indexes.length; i++) { - if (file.multiFile) - { - if (file.multiFile.isReadyToProcess()) - { - // If we got here then all files the link file needs are ready to add to the cache - file.multiFile.addToCache(); - } - } - else - { - // If we got here, then the file processed, so let it add itself to its cache - file.addToCache(); - } + ReplaceByIndex(indexes[i], replacements[i], 0, 0, layer.width, layer.height, layer); } + } - // Remove it from the queue - this.queue.delete(file); + return sprites; +}; - // Nothing left to do? +module.exports = CreateFromTiles; - if (this.list.size === 0 && this.inflight.size === 0 && this.queue.size === 0) - { - this.loadComplete(); - } - }, - /** - * Called at the end when the load queue is exhausted and all files have either loaded or errored. - * By this point every loaded file will now be in its associated cache and ready for use. - * - * Also clears down the Sets, puts progress to 1 and clears the deletion queue. - * - * @method Phaser.Loader.LoaderPlugin#loadComplete - * @fires Phaser.Loader.Events#COMPLETE - * @fires Phaser.Loader.Events#POST_PROCESS - * @since 3.7.0 - */ - loadComplete: function () - { - this.emit(Events.POST_PROCESS, this); +/***/ }), - this.list.clear(); - this.inflight.clear(); - this.queue.clear(); +/***/ 71586: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.progress = 1; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.state = CONST.LOADER_COMPLETE; +var Rectangle = __webpack_require__(74118); +var SnapCeil = __webpack_require__(82127); +var SnapFloor = __webpack_require__(84314); - this.systems.events.off(SceneEvents.UPDATE, this.update, this); +var bounds = new Rectangle(); - // Call 'destroy' on each file ready for deletion - this._deleteQueue.iterateLocal('destroy'); +/** + * Returns the bounds in the given orthogonal layer that are within the cameras viewport. + * This is used internally by the cull tiles function. + * + * @function Phaser.Tilemaps.Components.CullBounds + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * + * @return {Phaser.Geom.Rectangle} A rectangle containing the culled bounds. If you wish to retain this object, clone it, as it's recycled internally. + */ +var CullBounds = function (layer, camera) +{ + var tilemap = layer.tilemapLayer.tilemap; + var tilemapLayer = layer.tilemapLayer; - this._deleteQueue.clear(); + // We need to use the tile sizes defined for the map as a whole, not the layer, + // in order to calculate the bounds correctly. As different sized tiles may be + // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. + var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); + var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); - this.emit(Events.COMPLETE, this, this.totalComplete, this.totalFailed); - }, + var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; + var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; - /** - * Adds a File into the pending-deletion queue. - * - * @method Phaser.Loader.LoaderPlugin#flagForRemoval - * @since 3.7.0 - * - * @param {Phaser.Loader.File} file - The File to be queued for deletion when the Loader completes. - */ - flagForRemoval: function (file) - { - this._deleteQueue.set(file); - }, + var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, tileH, 0, true) - tilemapLayer.cullPaddingY; + var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, tileH, 0, true) + tilemapLayer.cullPaddingY; - /** - * Converts the given JSON data into a file that the browser then prompts you to download so you can save it locally. - * - * The data must be well formed JSON and ready-parsed, not a JavaScript object. - * - * @method Phaser.Loader.LoaderPlugin#saveJSON - * @since 3.0.0 - * - * @param {*} data - The JSON data, ready parsed. - * @param {string} [filename=file.json] - The name to save the JSON file as. - * - * @return {this} This Loader plugin. - */ - saveJSON: function (data, filename) - { - return this.save(JSON.stringify(data), filename); - }, + return bounds.setTo( + boundsLeft, + boundsTop, + (boundsRight - boundsLeft), + (boundsBottom - boundsTop) + ); +}; - /** - * Causes the browser to save the given data as a file to its default Downloads folder. - * - * Creates a DOM level anchor link, assigns it as being a `download` anchor, sets the href - * to be an ObjectURL based on the given data, and then invokes a click event. - * - * @method Phaser.Loader.LoaderPlugin#save - * @since 3.0.0 - * - * @param {*} data - The data to be saved. Will be passed through URL.createObjectURL. - * @param {string} [filename=file.json] - The filename to save the file as. - * @param {string} [filetype=application/json] - The file type to use when saving the file. Defaults to JSON. - * - * @return {this} This Loader plugin. - */ - save: function (data, filename, filetype) - { - if (filename === undefined) { filename = 'file.json'; } - if (filetype === undefined) { filetype = 'application/json'; } +module.exports = CullBounds; - var blob = new Blob([ data ], { type: filetype }); - var url = URL.createObjectURL(blob); +/***/ }), - var a = document.createElement('a'); +/***/ 381: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - a.download = filename; - a.textContent = 'Download ' + filename; - a.href = url; - a.click(); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var CullBounds = __webpack_require__(71586); +var RunCull = __webpack_require__(6987); - /** - * Resets the Loader. - * - * This will clear all lists and reset the base URL, path and prefix. - * - * Warning: If the Loader is currently downloading files, or has files in its queue, they will be aborted. - * - * @method Phaser.Loader.LoaderPlugin#reset - * @since 3.0.0 - */ - reset: function () - { - this.list.clear(); - this.inflight.clear(); - this.queue.clear(); +/** + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * + * @function Phaser.Tilemaps.Components.CullTiles + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {array} [outputArray] - An optional array to store the Tile objects within. + * @param {number} [renderOrder=0] - The rendering order constant. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + */ +var CullTiles = function (layer, camera, outputArray, renderOrder) +{ + if (outputArray === undefined) { outputArray = []; } + if (renderOrder === undefined) { renderOrder = 0; } - var gameConfig = this.systems.game.config; - var sceneConfig = this.systems.settings.loader; + outputArray.length = 0; - this.setBaseURL(GetFastValue(sceneConfig, 'baseURL', gameConfig.loaderBaseURL)); - this.setPath(GetFastValue(sceneConfig, 'path', gameConfig.loaderPath)); - this.setPrefix(GetFastValue(sceneConfig, 'prefix', gameConfig.loaderPrefix)); + var tilemapLayer = layer.tilemapLayer; - this.state = CONST.LOADER_IDLE; - }, + // Camera world view bounds, snapped for scaled tile size + // Cull Padding values are given in tiles, not pixels + var bounds = CullBounds(layer, camera); - /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. - * - * @method Phaser.Loader.LoaderPlugin#shutdown - * @private - * @since 3.0.0 - */ - shutdown: function () + if (tilemapLayer.skipCull || tilemapLayer.scrollFactorX !== 1 || tilemapLayer.scrollFactorY !== 1) { - this.reset(); + bounds.left = 0; + bounds.right = layer.width; + bounds.top = 0; + bounds.bottom = layer.height; + } - this.state = CONST.LOADER_SHUTDOWN; + RunCull(layer, bounds, renderOrder, outputArray); - this.systems.events.off(SceneEvents.UPDATE, this.update, this); - this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); - }, + return outputArray; +}; - /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. - * - * @method Phaser.Loader.LoaderPlugin#destroy - * @private - * @since 3.0.0 - */ - destroy: function () +module.exports = CullTiles; + + +/***/ }), + +/***/ 97734: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetTilesWithin = __webpack_require__(50811); +var CalculateFacesWithin = __webpack_require__(60386); +var SetTileCollision = __webpack_require__(68234); + +/** + * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the + * specified index. Tiles will be set to collide if the given index is a colliding index. + * Collision information in the region will be recalculated. + * + * @function Phaser.Tilemaps.Components.Fill + * @since 3.0.0 + * + * @param {number} index - The tile index to fill the area with. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. + * @param {Phaser.Tilemaps.LayerData} layer - The tile layer to use. If not given the current layer is used. + */ +var Fill = function (index, tileX, tileY, width, height, recalculateFaces, layer) +{ + var doesIndexCollide = (layer.collideIndexes.indexOf(index) !== -1); + + var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + + for (var i = 0; i < tiles.length; i++) { - this.shutdown(); + tiles[i].index = index; + + SetTileCollision(tiles[i], doesIndexCollide); + } + + if (recalculateFaces) + { + // Recalculate the faces within the area and neighboring tiles + CalculateFacesWithin(tileX - 1, tileY - 1, width + 2, height + 2, layer); + } +}; + +module.exports = Fill; + - this.state = CONST.LOADER_DESTROYED; +/***/ }), - this.systems.events.off(SceneEvents.UPDATE, this.update, this); - this.systems.events.off(SceneEvents.START, this.pluginStart, this); +/***/ 63555: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.list = null; - this.inflight = null; - this.queue = null; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.scene = null; - this.systems = null; - this.textureManager = null; - this.cacheManager = null; - this.sceneManager = null; - } +var GetTilesWithin = __webpack_require__(50811); -}); +/** + * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given + * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns + * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS. + * + * @function Phaser.Tilemaps.Components.FilterTiles + * @since 3.0.0 + * + * @param {function} callback - The callback. Each tile in the given area will be passed to this + * callback as the first and only parameter. The callback should return true for tiles that pass the + * filter. + * @param {object} context - The context under which the callback should be run. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile[]} The filtered array of Tiles. + */ +var FilterTiles = function (callback, context, tileX, tileY, width, height, filteringOptions, layer) +{ + var tiles = GetTilesWithin(tileX, tileY, width, height, filteringOptions, layer); -PluginCache.register('Loader', LoaderPlugin, 'load'); + return tiles.filter(callback, context); +}; -module.exports = LoaderPlugin; +module.exports = FilterTiles; /***/ }), -/* 1366 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 37982: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(62); -var Extend = __webpack_require__(17); - /** - * @namespace Phaser.Physics.Arcade + * Searches the entire map layer for the first tile matching the given index, then returns that Tile + * object. If no match is found, it returns null. The search starts from the top-left tile and + * continues horizontally until it hits the end of the row, then it drops down to the next column. + * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to + * the top-left. + * + * @function Phaser.Tilemaps.Components.FindByIndex + * @since 3.0.0 + * + * @param {number} index - The tile index value to search for. + * @param {number} skip - The number of times to skip a matching tile before returning. + * @param {boolean} reverse - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {?Phaser.Tilemaps.Tile} The first (or n skipped) tile with the matching index. */ +var FindByIndex = function (findIndex, skip, reverse, layer) +{ + if (skip === undefined) { skip = 0; } + if (reverse === undefined) { reverse = false; } -var Arcade = { + var count = 0; + var tx; + var ty; + var tile; - ArcadePhysics: __webpack_require__(1367), - Body: __webpack_require__(527), - Collider: __webpack_require__(528), - Components: __webpack_require__(243), - Events: __webpack_require__(245), - Factory: __webpack_require__(521), - GetOverlapX: __webpack_require__(246), - GetOverlapY: __webpack_require__(247), - SeparateX: __webpack_require__(537), - SeparateY: __webpack_require__(538), - Group: __webpack_require__(524), - Image: __webpack_require__(522), - Sprite: __webpack_require__(157), - StaticBody: __webpack_require__(539), - StaticGroup: __webpack_require__(525), - Tilemap: __webpack_require__(1391), - World: __webpack_require__(526) + if (reverse) + { + for (ty = layer.height - 1; ty >= 0; ty--) + { + for (tx = layer.width - 1; tx >= 0; tx--) + { + tile = layer.data[ty][tx]; + if (tile && tile.index === findIndex) + { + if (count === skip) + { + return tile; + } + else + { + count += 1; + } + } + } + } + } + else + { + for (ty = 0; ty < layer.height; ty++) + { + for (tx = 0; tx < layer.width; tx++) + { + tile = layer.data[ty][tx]; + if (tile && tile.index === findIndex) + { + if (count === skip) + { + return tile; + } + else + { + count += 1; + } + } + } + } + } + return null; }; -// Merge in the consts -Arcade = Extend(false, Arcade, CONST); - -module.exports = Arcade; +module.exports = FindByIndex; /***/ }), -/* 1367 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 48297: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var DegToRad = __webpack_require__(36); -var DistanceBetween = __webpack_require__(50); -var DistanceSquared = __webpack_require__(353); -var Factory = __webpack_require__(521); -var GetFastValue = __webpack_require__(2); -var Merge = __webpack_require__(127); -var OverlapCirc = __webpack_require__(523); -var OverlapRect = __webpack_require__(244); -var PluginCache = __webpack_require__(24); -var SceneEvents = __webpack_require__(20); -var Vector2 = __webpack_require__(3); -var World = __webpack_require__(526); +var GetTilesWithin = __webpack_require__(50811); /** - * @classdesc - * The Arcade Physics Plugin belongs to a Scene and sets up and manages the Scene's physics simulation. - * It also holds some useful methods for moving and rotating Arcade Physics Bodies. + * @callback FindTileCallback * - * You can access it from within a Scene using `this.physics`. + * @param {Phaser.Tilemaps.Tile} value - The Tile. + * @param {number} index - The index of the tile. + * @param {Phaser.Tilemaps.Tile[]} array - An array of Tile objects. * - * Arcade Physics uses the Projection Method of collision resolution and separation. While it's fast and suitable - * for 'arcade' style games it lacks stability when multiple objects are in close proximity or resting upon each other. - * The separation that stops two objects penetrating may create a new penetration against a different object. If you - * require a high level of stability please consider using an alternative physics system, such as Matter.js. + * @return {boolean} Return `true` if the callback should run, otherwise `false`. + */ + +/** + * Find the first tile in the given rectangular area (in tile coordinates) of the layer that + * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns + * true. Similar to Array.prototype.find in vanilla JS. * - * @class ArcadePhysics - * @memberof Phaser.Physics.Arcade - * @constructor + * @function Phaser.Tilemaps.Components.FindTile * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene that this Plugin belongs to. + * @param {FindTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. + * @param {object} context - The context under which the callback should be run. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {?Phaser.Tilemaps.Tile} A Tile that matches the search, or null if no Tile found */ -var ArcadePhysics = new Class({ - - initialize: - - function ArcadePhysics (scene) - { - /** - * The Scene that this Plugin belongs to. - * - * @name Phaser.Physics.Arcade.ArcadePhysics#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; +var FindTile = function (callback, context, tileX, tileY, width, height, filteringOptions, layer) +{ + var tiles = GetTilesWithin(tileX, tileY, width, height, filteringOptions, layer); - /** - * The Scene's Systems. - * - * @name Phaser.Physics.Arcade.ArcadePhysics#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; + return tiles.find(callback, context) || null; +}; - /** - * A configuration object. Union of the `physics.arcade.*` properties of the GameConfig and SceneConfig objects. - * - * @name Phaser.Physics.Arcade.ArcadePhysics#config - * @type {Phaser.Types.Physics.Arcade.ArcadeWorldConfig} - * @since 3.0.0 - */ - this.config = this.getConfig(); +module.exports = FindTile; - /** - * The physics simulation. - * - * @name Phaser.Physics.Arcade.ArcadePhysics#world - * @type {Phaser.Physics.Arcade.World} - * @since 3.0.0 - */ - this.world; - /** - * An object holding the Arcade Physics factory methods. - * - * @name Phaser.Physics.Arcade.ArcadePhysics#add - * @type {Phaser.Physics.Arcade.Factory} - * @since 3.0.0 - */ - this.add; +/***/ }), - scene.sys.events.once(SceneEvents.BOOT, this.boot, this); - scene.sys.events.on(SceneEvents.START, this.start, this); - }, +/***/ 80916: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#boot - * @private - * @since 3.5.1 - */ - boot: function () - { - this.world = new World(this.scene, this.config); - this.add = new Factory(this.world); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); - }, +var GetTilesWithin = __webpack_require__(50811); - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#start - * @private - * @since 3.5.0 - */ - start: function () - { - if (!this.world) - { - this.world = new World(this.scene, this.config); - this.add = new Factory(this.world); - } +/** + * @callback EachTileCallback + * + * @param {Phaser.Tilemaps.Tile} value - The Tile. + * @param {number} index - The index of the tile. + * @param {Phaser.Tilemaps.Tile[]} array - An array of Tile objects. + */ - var eventEmitter = this.systems.events; +/** + * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given + * callback. Similar to Array.prototype.forEach in vanilla JS. + * + * @function Phaser.Tilemaps.Components.ForEachTile + * @since 3.0.0 + * + * @param {EachTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. + * @param {object} context - The context under which the callback should be run. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area to filter. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var ForEachTile = function (callback, context, tileX, tileY, width, height, filteringOptions, layer) +{ + var tiles = GetTilesWithin(tileX, tileY, width, height, filteringOptions, layer); - if (!GetFastValue(this.config, 'customUpdate', false)) - { - eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); - } + tiles.forEach(callback, context); +}; - eventEmitter.on(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); - eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); - }, +module.exports = ForEachTile; - /** - * Causes `World.update` to be automatically called each time the Scene - * emits and `UPDATE` event. This is the default setting, so only needs - * calling if you have specifically disabled it. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#enableUpdate - * @since 3.50.0 - */ - enableUpdate: function () - { - this.systems.events.on(SceneEvents.UPDATE, this.world.update, this.world); - }, - /** - * Causes `World.update` to **not** be automatically called each time the Scene - * emits and `UPDATE` event. - * - * If you wish to run the World update at your own rate, or from your own - * component, then you should call this method to disable the built-in link, - * and then call `World.update(delta, time)` accordingly. - * - * Note that `World.postUpdate` is always automatically called when the Scene - * emits a `POST_UPDATE` event, regardless of this setting. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#disableUpdate - * @since 3.50.0 - */ - disableUpdate: function () - { - this.systems.events.off(SceneEvents.UPDATE, this.world.update, this.world); - }, +/***/ }), - /** - * Creates the physics configuration for the current Scene. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#getConfig - * @since 3.0.0 - * - * @return {Phaser.Types.Physics.Arcade.ArcadeWorldConfig} The physics configuration. - */ - getConfig: function () - { - var gameConfig = this.systems.game.config.physics; - var sceneConfig = this.systems.settings.physics; +/***/ 31493: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var config = Merge( - GetFastValue(sceneConfig, 'arcade', {}), - GetFastValue(gameConfig, 'arcade', {}) - ); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return config; - }, +var CONST = __webpack_require__(12920); +var CullTiles = __webpack_require__(381); +var HexagonalCullTiles = __webpack_require__(37524); +var IsometricCullTiles = __webpack_require__(20887); +var NOOP = __webpack_require__(72283); +var StaggeredCullTiles = __webpack_require__(19242); - /** - * Tests if Game Objects overlap. See {@link Phaser.Physics.Arcade.World#overlap} - * - * @method Phaser.Physics.Arcade.ArcadePhysics#overlap - * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object or array of objects to check. - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they overlap. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {*} [callbackContext] - The context in which to run the callbacks. - * - * @return {boolean} True if at least one Game Object overlaps another. - * - * @see Phaser.Physics.Arcade.World#overlap - */ - overlap: function (object1, object2, overlapCallback, processCallback, callbackContext) +/** + * Gets the correct function to use to cull tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetCullTilesFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to cull tiles for the given map type. + */ +var GetCullTilesFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) { - if (overlapCallback === undefined) { overlapCallback = null; } - if (processCallback === undefined) { processCallback = null; } - if (callbackContext === undefined) { callbackContext = overlapCallback; } - - return this.world.collideObjects(object1, object2, overlapCallback, processCallback, callbackContext, true); - }, - - /** - * Performs a collision check and separation between the two physics enabled objects given, which can be single - * Game Objects, arrays of Game Objects, Physics Groups, arrays of Physics Groups or normal Groups. - * - * If you don't require separation then use {@link #overlap} instead. - * - * If two Groups or arrays are passed, each member of one will be tested against each member of the other. - * - * If **only** one Group is passed (as `object1`), each member of the Group will be collided against the other members. - * - * If **only** one Array is passed, the array is iterated and every element in it is tested against the others. - * - * Two callbacks can be provided. The `collideCallback` is invoked if a collision occurs and the two colliding - * objects are passed to it. - * - * Arcade Physics uses the Projection Method of collision resolution and separation. While it's fast and suitable - * for 'arcade' style games it lacks stability when multiple objects are in close proximity or resting upon each other. - * The separation that stops two objects penetrating may create a new penetration against a different object. If you - * require a high level of stability please consider using an alternative physics system, such as Matter.js. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#collide - * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} object1 - The first object or array of objects to check. - * @param {Phaser.Types.Physics.Arcade.ArcadeColliderType} [object2] - The second object or array of objects to check, or `undefined`. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {*} [callbackContext] - The context in which to run the callbacks. - * - * @return {boolean} True if any overlapping Game Objects were separated, otherwise false. - * - * @see Phaser.Physics.Arcade.World#collide - */ - collide: function (object1, object2, collideCallback, processCallback, callbackContext) + return CullTiles; + } + else if (orientation === CONST.HEXAGONAL) { - if (collideCallback === undefined) { collideCallback = null; } - if (processCallback === undefined) { processCallback = null; } - if (callbackContext === undefined) { callbackContext = collideCallback; } - - return this.world.collideObjects(object1, object2, collideCallback, processCallback, callbackContext, false); - }, - - /** - * This advanced method is specifically for testing for collision between a single Sprite and an array of Tile objects. - * - * You should generally use the `collide` method instead, with a Sprite vs. a Tilemap Layer, as that will perform - * tile filtering and culling for you, as well as handle the interesting face collision automatically. - * - * This method is offered for those who would like to check for collision with specific Tiles in a layer, without - * having to set any collision attributes on the tiles in question. This allows you to perform quick dynamic collisions - * on small sets of Tiles. As such, no culling or checks are made to the array of Tiles given to this method, - * you should filter them before passing them to this method. - * - * Important: Use of this method skips the `interesting faces` system that Tilemap Layers use. This means if you have - * say a row or column of tiles, and you jump into, or walk over them, it's possible to get stuck on the edges of the - * tiles as the interesting face calculations are skipped. However, for quick-fire small collision set tests on - * dynamic maps, this method can prove very useful. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#collideTiles - * @fires Phaser.Physics.Arcade.Events#TILE_COLLIDE - * @since 3.17.0 - * - * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. - * @param {Phaser.Tilemaps.Tile[]} tiles - An array of Tiles to check for collision against. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects collide. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} [callbackContext] - The context in which to run the callbacks. - * - * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. - */ - collideTiles: function (sprite, tiles, collideCallback, processCallback, callbackContext) + return HexagonalCullTiles; + } + else if (orientation === CONST.STAGGERED) { - return this.world.collideTiles(sprite, tiles, collideCallback, processCallback, callbackContext); - }, - - /** - * This advanced method is specifically for testing for overlaps between a single Sprite and an array of Tile objects. - * - * You should generally use the `overlap` method instead, with a Sprite vs. a Tilemap Layer, as that will perform - * tile filtering and culling for you, as well as handle the interesting face collision automatically. - * - * This method is offered for those who would like to check for overlaps with specific Tiles in a layer, without - * having to set any collision attributes on the tiles in question. This allows you to perform quick dynamic overlap - * tests on small sets of Tiles. As such, no culling or checks are made to the array of Tiles given to this method, - * you should filter them before passing them to this method. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#overlapTiles - * @fires Phaser.Physics.Arcade.Events#TILE_OVERLAP - * @since 3.17.0 - * - * @param {Phaser.GameObjects.GameObject} sprite - The first object to check for collision. - * @param {Phaser.Tilemaps.Tile[]} tiles - An array of Tiles to check for collision against. - * @param {ArcadePhysicsCallback} [collideCallback] - An optional callback function that is called if the objects overlap. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. - * @param {any} [callbackContext] - The context in which to run the callbacks. - * - * @return {boolean} True if any objects overlap (with `overlapOnly`); or true if any overlapping objects were separated. - */ - overlapTiles: function (sprite, tiles, collideCallback, processCallback, callbackContext) + return StaggeredCullTiles; + } + else if (orientation === CONST.ISOMETRIC) { - return this.world.overlapTiles(sprite, tiles, collideCallback, processCallback, callbackContext); - }, - - /** - * Pauses the simulation. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#pause - * @since 3.0.0 - * - * @return {Phaser.Physics.Arcade.World} The simulation. - */ - pause: function () + return IsometricCullTiles; + } + else { - return this.world.pause(); - }, + return NOOP; + } +}; - /** - * Resumes the simulation (if paused). - * - * @method Phaser.Physics.Arcade.ArcadePhysics#resume - * @since 3.0.0 - * - * @return {Phaser.Physics.Arcade.World} The simulation. - */ - resume: function () - { - return this.world.resume(); - }, +module.exports = GetCullTilesFunction; - /** - * Sets the acceleration.x/y property on the game object so it will move towards the x/y coordinates at the given rate (in pixels per second squared) - * - * You must give a maximum speed value, beyond which the game object won't go any faster. - * - * Note: The game object does not continuously track the target. If the target changes location during transit the game object will not modify its course. - * Note: The game object doesn't stop moving once it reaches the destination coordinates. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#accelerateTo - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - Any Game Object with an Arcade Physics body. - * @param {number} x - The x coordinate to accelerate towards. - * @param {number} y - The y coordinate to accelerate towards. - * @param {number} [speed=60] - The acceleration (change in speed) in pixels per second squared. - * @param {number} [xSpeedMax=500] - The maximum x velocity the game object can reach. - * @param {number} [ySpeedMax=500] - The maximum y velocity the game object can reach. - * - * @return {number} The angle (in radians) that the object should be visually set to in order to match its new velocity. - */ - accelerateTo: function (gameObject, x, y, speed, xSpeedMax, ySpeedMax) - { - if (speed === undefined) { speed = 60; } - var angle = Math.atan2(y - gameObject.y, x - gameObject.x); +/***/ }), - gameObject.body.acceleration.setToPolar(angle, speed); +/***/ 15494: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (xSpeedMax !== undefined && ySpeedMax !== undefined) - { - gameObject.body.maxVelocity.set(xSpeedMax, ySpeedMax); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return angle; - }, +var IsInLayerBounds = __webpack_require__(62839); - /** - * Sets the acceleration.x/y property on the game object so it will move towards the x/y coordinates at the given rate (in pixels per second squared) - * - * You must give a maximum speed value, beyond which the game object won't go any faster. - * - * Note: The game object does not continuously track the target. If the target changes location during transit the game object will not modify its course. - * Note: The game object doesn't stop moving once it reaches the destination coordinates. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#accelerateToObject - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - Any Game Object with an Arcade Physics body. - * @param {Phaser.GameObjects.GameObject} destination - The Game Object to move towards. Can be any object but must have visible x/y properties. - * @param {number} [speed=60] - The acceleration (change in speed) in pixels per second squared. - * @param {number} [xSpeedMax=500] - The maximum x velocity the game object can reach. - * @param {number} [ySpeedMax=500] - The maximum y velocity the game object can reach. - * - * @return {number} The angle (in radians) that the object should be visually set to in order to match its new velocity. - */ - accelerateToObject: function (gameObject, destination, speed, xSpeedMax, ySpeedMax) - { - return this.accelerateTo(gameObject, destination.x, destination.y, speed, xSpeedMax, ySpeedMax); - }, +/** + * Gets a tile at the given tile coordinates from the given layer. + * + * @function Phaser.Tilemaps.Components.GetTileAt + * @since 3.0.0 + * + * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {boolean} nonNull - If true getTile won't return null for empty tiles, but a Tile object with an index of -1. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. + */ +var GetTileAt = function (tileX, tileY, nonNull, layer) +{ + if (nonNull === undefined) { nonNull = false; } - /** - * Finds the Body or Game Object closest to a source point or object. - * - * If a `targets` argument is passed, this method finds the closest of those. - * The targets can be Arcade Physics Game Objects, Dynamic Bodies, or Static Bodies. - * - * If no `targets` argument is passed, this method finds the closest Dynamic Body. - * - * If two or more targets are the exact same distance from the source point, only the first target - * is returned. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#closest - * @since 3.0.0 - * - * @param {any} source - Any object with public `x` and `y` properties, such as a Game Object or Geometry object. - * @param {(Phaser.Physics.Arcade.Body[]|Phaser.Physics.Arcade.StaticBody[]|Phaser.GameObjects.GameObject[])} [targets] - The targets. - * - * @return {?(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody|Phaser.GameObjects.GameObject)} The target closest to the given source point. - */ - closest: function (source, targets) + if (IsInLayerBounds(tileX, tileY, layer)) { - if (!targets) - { - targets = this.world.bodies.entries; - } - - var min = Number.MAX_VALUE; - var closest = null; - var x = source.x; - var y = source.y; - var len = targets.length; + var tile = layer.data[tileY][tileX] || null; - for (var i = 0; i < len; i++) + if (!tile) { - var target = targets[i]; - var body = target.body || target; - - if (source === target || source === body || source === body.gameObject || source === body.center) - { - continue; - } - - var distance = DistanceSquared(x, y, body.center.x, body.center.y); - - if (distance < min) - { - closest = target; - min = distance; - } + return null; } - - return closest; - }, - - /** - * Finds the Body or Game Object farthest from a source point or object. - * - * If a `targets` argument is passed, this method finds the farthest of those. - * The targets can be Arcade Physics Game Objects, Dynamic Bodies, or Static Bodies. - * - * If no `targets` argument is passed, this method finds the farthest Dynamic Body. - * - * If two or more targets are the exact same distance from the source point, only the first target - * is returned. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#furthest - * @since 3.0.0 - * - * @param {any} source - Any object with public `x` and `y` properties, such as a Game Object or Geometry object. - * @param {(Phaser.Physics.Arcade.Body[]|Phaser.Physics.Arcade.StaticBody[]|Phaser.GameObjects.GameObject[])} [targets] - The targets. - * - * @return {?(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody|Phaser.GameObjects.GameObject)} The target farthest from the given source point. - */ - furthest: function (source, targets) - { - if (!targets) + else if (tile.index === -1) { - targets = this.world.bodies.entries; + return nonNull ? tile : null; } - - var max = -1; - var farthest = null; - var x = source.x; - var y = source.y; - var len = targets.length; - - for (var i = 0; i < len; i++) + else { - var target = targets[i]; - var body = target.body || target; - - if (source === target || source === body || source === body.gameObject || source === body.center) - { - continue; - } - - var distance = DistanceSquared(x, y, body.center.x, body.center.y); - - if (distance > max) - { - farthest = target; - max = distance; - } - + return tile; } - - return farthest; - }, - - /** - * Move the given display object towards the x/y coordinates at a steady velocity. - * If you specify a maxTime then it will adjust the speed (over-writing what you set) so it arrives at the destination in that number of seconds. - * Timings are approximate due to the way browser timers work. Allow for a variance of +- 50ms. - * Note: The display object does not continuously track the target. If the target changes location during transit the display object will not modify its course. - * Note: The display object doesn't stop moving once it reaches the destination coordinates. - * Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set drag or acceleration too high this object may not move at all) - * - * @method Phaser.Physics.Arcade.ArcadePhysics#moveTo - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - Any Game Object with an Arcade Physics body. - * @param {number} x - The x coordinate to move towards. - * @param {number} y - The y coordinate to move towards. - * @param {number} [speed=60] - The speed it will move, in pixels per second (default is 60 pixels/sec) - * @param {number} [maxTime=0] - Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the object will arrive at destination in the given number of ms. - * - * @return {number} The angle (in radians) that the object should be visually set to in order to match its new velocity. - */ - moveTo: function (gameObject, x, y, speed, maxTime) + } + else { - if (speed === undefined) { speed = 60; } - if (maxTime === undefined) { maxTime = 0; } + return null; + } +}; - var angle = Math.atan2(y - gameObject.y, x - gameObject.x); +module.exports = GetTileAt; - if (maxTime > 0) - { - // We know how many pixels we need to move, but how fast? - speed = DistanceBetween(gameObject.x, gameObject.y, x, y) / (maxTime / 1000); - } - gameObject.body.velocity.setToPolar(angle, speed); +/***/ }), - return angle; - }, +/***/ 24640: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Move the given display object towards the destination object at a steady velocity. - * If you specify a maxTime then it will adjust the speed (overwriting what you set) so it arrives at the destination in that number of seconds. - * Timings are approximate due to the way browser timers work. Allow for a variance of +- 50ms. - * Note: The display object does not continuously track the target. If the target changes location during transit the display object will not modify its course. - * Note: The display object doesn't stop moving once it reaches the destination coordinates. - * Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set drag or acceleration too high this object may not move at all) - * - * @method Phaser.Physics.Arcade.ArcadePhysics#moveToObject - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - Any Game Object with an Arcade Physics body. - * @param {object} destination - Any object with public `x` and `y` properties, such as a Game Object or Geometry object. - * @param {number} [speed=60] - The speed it will move, in pixels per second (default is 60 pixels/sec) - * @param {number} [maxTime=0] - Time given in milliseconds (1000 = 1 sec). If set the speed is adjusted so the object will arrive at destination in the given number of ms. - * - * @return {number} The angle (in radians) that the object should be visually set to in order to match its new velocity. - */ - moveToObject: function (gameObject, destination, speed, maxTime) - { - return this.moveTo(gameObject, destination.x, destination.y, speed, maxTime); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Given the angle (in degrees) and speed calculate the velocity and return it as a vector, or set it to the given vector object. - * One way to use this is: velocityFromAngle(angle, 200, sprite.body.velocity) which will set the values directly to the sprite's velocity and not create a new vector object. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#velocityFromAngle - * @since 3.0.0 - * - * @param {number} angle - The angle in degrees calculated in clockwise positive direction (down = 90 degrees positive, right = 0 degrees positive, up = 90 degrees negative) - * @param {number} [speed=60] - The speed it will move, in pixels per second squared. - * @param {Phaser.Math.Vector2} [vec2] - The Vector2 in which the x and y properties will be set to the calculated velocity. - * - * @return {Phaser.Math.Vector2} The Vector2 that stores the velocity. - */ - velocityFromAngle: function (angle, speed, vec2) - { - if (speed === undefined) { speed = 60; } - if (vec2 === undefined) { vec2 = new Vector2(); } +var GetTileAt = __webpack_require__(15494); +var Vector2 = __webpack_require__(93736); - return vec2.setToPolar(DegToRad(angle), speed); - }, +var point = new Vector2(); - /** - * Given the rotation (in radians) and speed calculate the velocity and return it as a vector, or set it to the given vector object. - * One way to use this is: velocityFromRotation(rotation, 200, sprite.body.velocity) which will set the values directly to the sprite's velocity and not create a new vector object. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#velocityFromRotation - * @since 3.0.0 - * - * @param {number} rotation - The angle in radians. - * @param {number} [speed=60] - The speed it will move, in pixels per second squared - * @param {Phaser.Math.Vector2} [vec2] - The Vector2 in which the x and y properties will be set to the calculated velocity. - * - * @return {Phaser.Math.Vector2} The Vector2 that stores the velocity. - */ - velocityFromRotation: function (rotation, speed, vec2) - { - if (speed === undefined) { speed = 60; } - if (vec2 === undefined) { vec2 = new Vector2(); } +/** + * Gets a tile at the given world coordinates from the given layer. + * + * @function Phaser.Tilemaps.Components.GetTileAtWorldXY + * @since 3.0.0 + * + * @param {number} worldX - X position to get the tile from (given in pixels) + * @param {number} worldY - Y position to get the tile from (given in pixels) + * @param {boolean} nonNull - If true, function won't return null for empty tiles, but a Tile object with an index of -1. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. + */ +var GetTileAtWorldXY = function (worldX, worldY, nonNull, camera, layer) +{ + layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera); - return vec2.setToPolar(rotation, speed); - }, + return GetTileAt(point.x, point.y, nonNull, layer); +}; - /** - * This method will search the given rectangular area and return an array of all physics bodies that - * overlap with it. It can return either Dynamic, Static bodies or a mixture of both. - * - * A body only has to intersect with the search area to be considered, it doesn't have to be fully - * contained within it. - * - * If Arcade Physics is set to use the RTree (which it is by default) then the search for is extremely fast, - * otherwise the search is O(N) for Dynamic Bodies. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#overlapRect - * @since 3.17.0 - * - * @param {number} x - The top-left x coordinate of the area to search within. - * @param {number} y - The top-left y coordinate of the area to search within. - * @param {number} width - The width of the area to search within. - * @param {number} height - The height of the area to search within. - * @param {boolean} [includeDynamic=true] - Should the search include Dynamic Bodies? - * @param {boolean} [includeStatic=false] - Should the search include Static Bodies? - * - * @return {(Phaser.Physics.Arcade.Body[]|Phaser.Physics.Arcade.StaticBody[])} An array of bodies that overlap with the given area. - */ - overlapRect: function (x, y, width, height, includeDynamic, includeStatic) - { - return OverlapRect(this.world, x, y, width, height, includeDynamic, includeStatic); - }, +module.exports = GetTileAtWorldXY; - /** - * This method will search the given circular area and return an array of all physics bodies that - * overlap with it. It can return either Dynamic, Static bodies or a mixture of both. - * - * A body only has to intersect with the search area to be considered, it doesn't have to be fully - * contained within it. - * - * If Arcade Physics is set to use the RTree (which it is by default) then the search is rather fast, - * otherwise the search is O(N) for Dynamic Bodies. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#overlapCirc - * @since 3.21.0 - * - * @param {number} x - The x coordinate of the center of the area to search within. - * @param {number} y - The y coordinate of the center of the area to search within. - * @param {number} radius - The radius of the area to search within. - * @param {boolean} [includeDynamic=true] - Should the search include Dynamic Bodies? - * @param {boolean} [includeStatic=false] - Should the search include Static Bodies? - * - * @return {(Phaser.Physics.Arcade.Body[]|Phaser.Physics.Arcade.StaticBody[])} An array of bodies that overlap with the given area. - */ - overlapCirc: function (x, y, radius, includeDynamic, includeStatic) - { - return OverlapCirc(this.world, x, y, radius, includeDynamic, includeStatic); - }, - /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#shutdown - * @since 3.0.0 - */ - shutdown: function () - { - if (!this.world) - { - // Already destroyed - return; - } +/***/ }), - var eventEmitter = this.systems.events; +/***/ 48495: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); - eventEmitter.off(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); - eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.add.destroy(); - this.world.destroy(); +var Vector2 = __webpack_require__(93736); - this.add = null; - this.world = null; - }, +/** + * Gets the corners of the Tile as an array of Vector2s. + * + * @function Phaser.Tilemaps.Components.GetTileCorners + * @since 3.60.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2[]} An array of Vector2s corresponding to the world XY location of each tile corner. + */ +var GetTileCorners = function (tileX, tileY, camera, layer) +{ + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; - /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. - * - * @method Phaser.Physics.Arcade.ArcadePhysics#destroy - * @since 3.0.0 - */ - destroy: function () + var worldX = 0; + var worldY = 0; + + if (tilemapLayer) { - this.shutdown(); + if (!camera) { camera = tilemapLayer.scene.cameras.main; } - this.scene.sys.events.off(SceneEvents.START, this.start, this); + worldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + worldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - this.scene = null; - this.systems = null; + tileWidth *= tilemapLayer.scaleX; + tileHeight *= tilemapLayer.scaleY; } -}); + var x = worldX + tileX * tileWidth; + var y = worldY + tileY * tileHeight; -PluginCache.register('ArcadePhysics', ArcadePhysics, 'arcadePhysics'); + // Top Left + // Top Right + // Bottom Right + // Bottom Left -module.exports = ArcadePhysics; + return [ + new Vector2(x, y), + new Vector2(x + tileWidth, y), + new Vector2(x + tileWidth, y + tileHeight), + new Vector2(x, y + tileHeight) + ]; +}; + +module.exports = GetTileCorners; /***/ }), -/* 1368 */ -/***/ (function(module, exports) { + +/***/ 7160: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var CONST = __webpack_require__(12920); +var HexagonalGetTileCorners = __webpack_require__(63634); +var NOOP = __webpack_require__(72283); +var GetTileCorners = __webpack_require__(48495); + /** - * Provides methods used for setting the acceleration properties of an Arcade Physics Body. + * Gets the correct function to use to get the tile corners, based on the map orientation. * - * @namespace Phaser.Physics.Arcade.Components.Acceleration - * @since 3.0.0 + * @function Phaser.Tilemaps.Components.GetTileCornersFunction + * @since 3.60.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. */ -var Acceleration = { - - /** - * Sets the body's horizontal and vertical acceleration. If the vertical acceleration value is not provided, the vertical acceleration is set to the same value as the horizontal acceleration. - * - * @method Phaser.Physics.Arcade.Components.Acceleration#setAcceleration - * @since 3.0.0 - * - * @param {number} x - The horizontal acceleration - * @param {number} [y=x] - The vertical acceleration - * - * @return {this} This Game Object. - */ - setAcceleration: function (x, y) +var GetTileCornersFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) { - this.body.acceleration.set(x, y); + return GetTileCorners; + } + else if (orientation === CONST.ISOMETRIC) + { + return NOOP; + } + else if (orientation === CONST.HEXAGONAL) + { + return HexagonalGetTileCorners; + } + else if (orientation === CONST.STAGGERED) + { + return NOOP; + } + else + { + return NOOP; + } +}; - return this; - }, +module.exports = GetTileCornersFunction; - /** - * Sets the body's horizontal acceleration. - * - * @method Phaser.Physics.Arcade.Components.Acceleration#setAccelerationX - * @since 3.0.0 - * - * @param {number} value - The horizontal acceleration - * - * @return {this} This Game Object. - */ - setAccelerationX: function (value) - { - this.body.acceleration.x = value; - return this; - }, +/***/ }), - /** - * Sets the body's vertical acceleration. - * - * @method Phaser.Physics.Arcade.Components.Acceleration#setAccelerationY - * @since 3.0.0 - * - * @param {number} value - The vertical acceleration - * - * @return {this} This Game Object. - */ - setAccelerationY: function (value) - { - this.body.acceleration.y = value; +/***/ 16884: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CONST = __webpack_require__(12920); +var NOOP = __webpack_require__(72283); +var TileToWorldX = __webpack_require__(44150); + +/** + * Gets the correct function to use to translate tiles, based on the map orientation. + * + * @function Phaser.Tilemaps.Components.GetTileToWorldXFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. + */ +var GetTileToWorldXFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) + { + return TileToWorldX; + } + else + { + return NOOP; } - }; -module.exports = Acceleration; +module.exports = GetTileToWorldXFunction; /***/ }), -/* 1369 */ -/***/ (function(module, exports) { + +/***/ 68182: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var CONST = __webpack_require__(12920); +var HexagonalTileToWorldXY = __webpack_require__(21715); +var IsometricTileToWorldXY = __webpack_require__(21808); +var NOOP = __webpack_require__(72283); +var StaggeredTileToWorldXY = __webpack_require__(33388); +var TileToWorldXY = __webpack_require__(46836); + /** - * Provides methods used for setting the angular acceleration properties of an Arcade Physics Body. + * Gets the correct function to use to translate tiles, based on the map orientation. * - * @namespace Phaser.Physics.Arcade.Components.Angular - * @since 3.0.0 + * @function Phaser.Tilemaps.Components.GetTileToWorldXYFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. */ -var Angular = { - - /** - * Sets the angular velocity of the body. - * - * In Arcade Physics, bodies cannot rotate. They are always axis-aligned. - * However, they can have angular motion, which is passed on to the Game Object bound to the body, - * causing them to visually rotate, even though the body remains axis-aligned. - * - * @method Phaser.Physics.Arcade.Components.Angular#setAngularVelocity - * @since 3.0.0 - * - * @param {number} value - The amount of angular velocity. - * - * @return {this} This Game Object. - */ - setAngularVelocity: function (value) +var GetTileToWorldXYFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) { - this.body.angularVelocity = value; - - return this; - }, - - /** - * Sets the angular acceleration of the body. - * - * In Arcade Physics, bodies cannot rotate. They are always axis-aligned. - * However, they can have angular motion, which is passed on to the Game Object bound to the body, - * causing them to visually rotate, even though the body remains axis-aligned. - * - * @method Phaser.Physics.Arcade.Components.Angular#setAngularAcceleration - * @since 3.0.0 - * - * @param {number} value - The amount of angular acceleration. - * - * @return {this} This Game Object. - */ - setAngularAcceleration: function (value) + return TileToWorldXY; + } + else if (orientation === CONST.ISOMETRIC) { - this.body.angularAcceleration = value; - - return this; - }, - - /** - * Sets the angular drag of the body. Drag is applied to the current velocity, providing a form of deceleration. - * - * @method Phaser.Physics.Arcade.Components.Angular#setAngularDrag - * @since 3.0.0 - * - * @param {number} value - The amount of drag. - * - * @return {this} This Game Object. - */ - setAngularDrag: function (value) + return IsometricTileToWorldXY; + } + else if (orientation === CONST.HEXAGONAL) { - this.body.angularDrag = value; - - return this; + return HexagonalTileToWorldXY; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredTileToWorldXY; + } + else + { + return NOOP; } - }; -module.exports = Angular; +module.exports = GetTileToWorldXYFunction; /***/ }), -/* 1370 */ -/***/ (function(module, exports) { + +/***/ 3752: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var CONST = __webpack_require__(12920); +var NOOP = __webpack_require__(72283); +var StaggeredTileToWorldY = __webpack_require__(84132); +var TileToWorldY = __webpack_require__(42477); + /** - * Provides methods used for setting the bounce properties of an Arcade Physics Body. + * Gets the correct function to use to translate tiles, based on the map orientation. * - * @namespace Phaser.Physics.Arcade.Components.Bounce - * @since 3.0.0 + * @function Phaser.Tilemaps.Components.GetTileToWorldYFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. */ -var Bounce = { - - /** - * Sets the bounce values of this body. - * - * Bounce is the amount of restitution, or elasticity, the body has when it collides with another object. - * A value of 1 means that it will retain its full velocity after the rebound. A value of 0 means it will not rebound at all. - * - * @method Phaser.Physics.Arcade.Components.Bounce#setBounce - * @since 3.0.0 - * - * @param {number} x - The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1. - * @param {number} [y=x] - The amount of vertical bounce to apply on collision. A float, typically between 0 and 1. - * - * @return {this} This Game Object. - */ - setBounce: function (x, y) - { - this.body.bounce.set(x, y); - - return this; - }, - - /** - * Sets the horizontal bounce value for this body. - * - * @method Phaser.Physics.Arcade.Components.Bounce#setBounceX - * @since 3.0.0 - * - * @param {number} value - The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1. - * - * @return {this} This Game Object. - */ - setBounceX: function (value) +var GetTileToWorldYFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) { - this.body.bounce.x = value; - - return this; - }, - - /** - * Sets the vertical bounce value for this body. - * - * @method Phaser.Physics.Arcade.Components.Bounce#setBounceY - * @since 3.0.0 - * - * @param {number} value - The amount of vertical bounce to apply on collision. A float, typically between 0 and 1. - * - * @return {this} This Game Object. - */ - setBounceY: function (value) + return TileToWorldY; + } + else if (orientation === CONST.STAGGERED) { - this.body.bounce.y = value; - - return this; - }, - - /** - * Sets whether this Body collides with the world boundary. - * - * Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Phaser.Math.Vector2 first. - * - * @method Phaser.Physics.Arcade.Components.Bounce#setCollideWorldBounds - * @since 3.0.0 - * - * @param {boolean} [value=true] - `true` if this body should collide with the world bounds, otherwise `false`. - * @param {number} [bounceX] - If given this will be replace the `worldBounce.x` value. - * @param {number} [bounceY] - If given this will be replace the `worldBounce.y` value. - * - * @return {this} This Game Object. - */ - setCollideWorldBounds: function (value, bounceX, bounceY) + return StaggeredTileToWorldY; + } + else { - this.body.setCollideWorldBounds(value, bounceX, bounceY); - - return this; + return NOOP; } - }; -module.exports = Bounce; +module.exports = GetTileToWorldYFunction; /***/ }), -/* 1371 */ -/***/ (function(module, exports) { + +/***/ 50811: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var GetFastValue = __webpack_require__(72632); + /** - * Provides methods used for setting the debug properties of an Arcade Physics Body. + * Gets the tiles in the given rectangular area (in tile coordinates) of the layer. * - * @namespace Phaser.Physics.Arcade.Components.Debug + * This returns an array with references to the Tile instances in, so be aware of + * modifying them directly. + * + * @function Phaser.Tilemaps.Components.GetTilesWithin * @since 3.0.0 + * + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. */ -var Debug = { - - /** - * Sets the debug values of this body. - * - * Bodies will only draw their debug if debug has been enabled for Arcade Physics as a whole. - * Note that there is a performance cost in drawing debug displays. It should never be used in production. - * - * @method Phaser.Physics.Arcade.Components.Debug#setDebug - * @since 3.0.0 - * - * @param {boolean} showBody - Set to `true` to have this body render its outline to the debug display. - * @param {boolean} showVelocity - Set to `true` to have this body render a velocity marker to the debug display. - * @param {number} bodyColor - The color of the body outline when rendered to the debug display. - * - * @return {this} This Game Object. - */ - setDebug: function (showBody, showVelocity, bodyColor) - { - this.debugShowBody = showBody; - this.debugShowVelocity = showVelocity; - this.debugBodyColor = bodyColor; +var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer) +{ + if (tileX === undefined) { tileX = 0; } + if (tileY === undefined) { tileY = 0; } + if (width === undefined) { width = layer.width; } + if (height === undefined) { height = layer.height; } + if (!filteringOptions) { filteringOptions = {}; } - return this; - }, + var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false); + var isColliding = GetFastValue(filteringOptions, 'isColliding', false); + var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false); - /** - * Sets the color of the body outline when it renders to the debug display. - * - * @method Phaser.Physics.Arcade.Components.Debug#setDebugBodyColor - * @since 3.0.0 - * - * @param {number} value - The color of the body outline when rendered to the debug display. - * - * @return {this} This Game Object. - */ - setDebugBodyColor: function (value) + // Clip x, y to top left of map, while shrinking width/height to match. + if (tileX < 0) { - this.body.debugBodyColor = value; - - return this; - }, - - /** - * Set to `true` to have this body render its outline to the debug display. - * - * @name Phaser.Physics.Arcade.Components.Debug#debugShowBody - * @type {boolean} - * @since 3.0.0 - */ - debugShowBody: { - - get: function () - { - return this.body.debugShowBody; - }, + width += tileX; + tileX = 0; + } - set: function (value) - { - this.body.debugShowBody = value; - } + if (tileY < 0) + { + height += tileY; + tileY = 0; + } - }, + // Clip width and height to bottom right of map. + if (tileX + width > layer.width) + { + width = Math.max(layer.width - tileX, 0); + } - /** - * Set to `true` to have this body render a velocity marker to the debug display. - * - * @name Phaser.Physics.Arcade.Components.Debug#debugShowVelocity - * @type {boolean} - * @since 3.0.0 - */ - debugShowVelocity: { + if (tileY + height > layer.height) + { + height = Math.max(layer.height - tileY, 0); + } - get: function () - { - return this.body.debugShowVelocity; - }, + var results = []; - set: function (value) + for (var ty = tileY; ty < tileY + height; ty++) + { + for (var tx = tileX; tx < tileX + width; tx++) { - this.body.debugShowVelocity = value; - } + var tile = layer.data[ty][tx]; - }, + if (tile !== null) + { + if (isNotEmpty && tile.index === -1) + { + continue; + } - /** - * The color of the body outline when it renders to the debug display. - * - * @name Phaser.Physics.Arcade.Components.Debug#debugBodyColor - * @type {number} - * @since 3.0.0 - */ - debugBodyColor: { + if (isColliding && !tile.collides) + { + continue; + } - get: function () - { - return this.body.debugBodyColor; - }, + if (hasInterestingFace && !tile.hasInterestingFace) + { + continue; + } - set: function (value) - { - this.body.debugBodyColor = value; + results.push(tile); + } } - } + return results; }; -module.exports = Debug; +module.exports = GetTilesWithin; /***/ }), -/* 1372 */ -/***/ (function(module, exports) { + +/***/ 31674: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Geom = __webpack_require__(84068); +var GetTilesWithin = __webpack_require__(50811); +var Intersects = __webpack_require__(7563); +var NOOP = __webpack_require__(72283); +var Vector2 = __webpack_require__(93736); + +var TriangleToRectangle = function (triangle, rect) +{ + return Intersects.RectangleToTriangle(rect, triangle); +}; + +var point = new Vector2(); +var pointStart = new Vector2(); +var pointEnd = new Vector2(); + /** - * Provides methods used for setting the drag properties of an Arcade Physics Body. + * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, + * Line, Rectangle or Triangle. The shape should be in world coordinates. * - * @namespace Phaser.Physics.Arcade.Components.Drag + * @function Phaser.Tilemaps.Components.GetTilesWithinShape * @since 3.0.0 + * + * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. */ -var Drag = { +var GetTilesWithinShape = function (shape, filteringOptions, camera, layer) +{ + if (shape === undefined) { return []; } - /** - * Sets the body's horizontal and vertical drag. If the vertical drag value is not provided, the vertical drag is set to the same value as the horizontal drag. - * - * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. - * It is the absolute loss of velocity due to movement, in pixels per second squared. - * The x and y components are applied separately. - * - * When `useDamping` is true, this is 1 minus the damping factor. - * A value of 1 means the Body loses no velocity. - * A value of 0.95 means the Body loses 5% of its velocity per step. - * A value of 0.5 means the Body loses 50% of its velocity per step. - * - * Drag is applied only when `acceleration` is zero. - * - * @method Phaser.Physics.Arcade.Components.Drag#setDrag - * @since 3.0.0 - * - * @param {number} x - The amount of horizontal drag to apply. - * @param {number} [y=x] - The amount of vertical drag to apply. - * - * @return {this} This Game Object. - */ - setDrag: function (x, y) + // intersectTest is a function with parameters: shape, rect + var intersectTest = NOOP; + + if (shape instanceof Geom.Circle) { - this.body.drag.set(x, y); + intersectTest = Intersects.CircleToRectangle; + } + else if (shape instanceof Geom.Rectangle) + { + intersectTest = Intersects.RectangleToRectangle; + } + else if (shape instanceof Geom.Triangle) + { + intersectTest = TriangleToRectangle; + } + else if (shape instanceof Geom.Line) + { + intersectTest = Intersects.LineToRectangle; + } - return this; - }, + // Top left corner of the shapes's bounding box, rounded down to include partial tiles + layer.tilemapLayer.worldToTileXY(shape.left, shape.top, true, pointStart, camera); - /** - * Sets the body's horizontal drag. - * - * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. - * It is the absolute loss of velocity due to movement, in pixels per second squared. - * The x and y components are applied separately. - * - * When `useDamping` is true, this is 1 minus the damping factor. - * A value of 1 means the Body loses no velocity. - * A value of 0.95 means the Body loses 5% of its velocity per step. - * A value of 0.5 means the Body loses 50% of its velocity per step. - * - * Drag is applied only when `acceleration` is zero. - * - * @method Phaser.Physics.Arcade.Components.Drag#setDragX - * @since 3.0.0 - * - * @param {number} value - The amount of horizontal drag to apply. - * - * @return {this} This Game Object. - */ - setDragX: function (value) - { - this.body.drag.x = value; + var xStart = pointStart.x; + var yStart = pointStart.y; - return this; - }, + // Bottom right corner of the shapes's bounding box, rounded up to include partial tiles + layer.tilemapLayer.worldToTileXY(shape.right, shape.bottom, false, pointEnd, camera); - /** - * Sets the body's vertical drag. - * - * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time. - * It is the absolute loss of velocity due to movement, in pixels per second squared. - * The x and y components are applied separately. - * - * When `useDamping` is true, this is 1 minus the damping factor. - * A value of 1 means the Body loses no velocity. - * A value of 0.95 means the Body loses 5% of its velocity per step. - * A value of 0.5 means the Body loses 50% of its velocity per step. - * - * Drag is applied only when `acceleration` is zero. - * - * @method Phaser.Physics.Arcade.Components.Drag#setDragY - * @since 3.0.0 - * - * @param {number} value - The amount of vertical drag to apply. - * - * @return {this} This Game Object. - */ - setDragY: function (value) + var xEnd = Math.ceil(pointEnd.x); + var yEnd = Math.ceil(pointEnd.y); + + // Tiles within bounding rectangle of shape. Bounds are forced to be at least 1 x 1 tile in size + // to grab tiles for shapes that don't have a height or width (e.g. a horizontal line). + var width = Math.max(xEnd - xStart, 1); + var height = Math.max(yEnd - yStart, 1); + + var tiles = GetTilesWithin(xStart, yStart, width, height, filteringOptions, layer); + + var tileWidth = layer.tileWidth; + var tileHeight = layer.tileHeight; + + if (layer.tilemapLayer) { - this.body.drag.y = value; + tileWidth *= layer.tilemapLayer.scaleX; + tileHeight *= layer.tilemapLayer.scaleY; + } - return this; - }, + var results = []; + var tileRect = new Geom.Rectangle(0, 0, tileWidth, tileHeight); - /** - * If this Body is using `drag` for deceleration this function controls how the drag is applied. - * If set to `true` drag will use a damping effect rather than a linear approach. If you are - * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in - * the game Asteroids) then you will get a far smoother and more visually correct deceleration - * by using damping, avoiding the axis-drift that is prone with linear deceleration. - * - * If you enable this property then you should use far smaller `drag` values than with linear, as - * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow - * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately. - * - * @method Phaser.Physics.Arcade.Components.Drag#setDamping - * @since 3.10.0 - * - * @param {boolean} value - `true` to use damping for deceleration, or `false` to use linear deceleration. - * - * @return {this} This Game Object. - */ - setDamping: function (value) + for (var i = 0; i < tiles.length; i++) { - this.body.useDamping = value; + var tile = tiles[i]; - return this; + layer.tilemapLayer.tileToWorldXY(tile.x, tile.y, point, camera); + + tileRect.x = point.x; + tileRect.y = point.y; + + if (intersectTest(shape, tileRect)) + { + results.push(tile); + } } + return results; }; -module.exports = Drag; +module.exports = GetTilesWithinShape; /***/ }), -/* 1373 */ -/***/ (function(module, exports) { + +/***/ 44662: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var GetTilesWithin = __webpack_require__(50811); +var Vector2 = __webpack_require__(93736); + +var pointStart = new Vector2(); +var pointEnd = new Vector2(); + /** - * Provides methods used for setting the enable properties of an Arcade Physics Body. + * Gets the tiles in the given rectangular area (in world coordinates) of the layer. * - * @namespace Phaser.Physics.Arcade.Components.Enable + * @function Phaser.Tilemaps.Components.GetTilesWithinWorldXY * @since 3.0.0 + * + * @param {number} worldX - The world x coordinate for the top-left of the area. + * @param {number} worldY - The world y coordinate for the top-left of the area. + * @param {number} width - The width of the area. + * @param {number} height - The height of the area. + * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. */ -var Enable = { +var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer) +{ + var worldToTileXY = layer.tilemapLayer.tilemap._convert.WorldToTileXY; - /** - * Enables this Game Object's Body. - * - * @method Phaser.Physics.Arcade.Components.Enable#enableBody - * @since 3.0.0 - * - * @param {boolean} reset - Also reset the Body and place it at (x, y). - * @param {number} x - The horizontal position to place the Game Object and Body. - * @param {number} y - The horizontal position to place the Game Object and Body. - * @param {boolean} enableGameObject - Also activate this Game Object. - * @param {boolean} showGameObject - Also show this Game Object. - * - * @return {this} This Game Object. - * - * @see Phaser.Physics.Arcade.Body#enable - * @see Phaser.Physics.Arcade.StaticBody#enable - * @see Phaser.Physics.Arcade.Body#reset - * @see Phaser.Physics.Arcade.StaticBody#reset - * @see Phaser.GameObjects.GameObject#active - * @see Phaser.GameObjects.GameObject#visible - */ - enableBody: function (reset, x, y, enableGameObject, showGameObject) - { - if (reset) - { - this.body.reset(x, y); - } + // Top left corner of the rect, rounded down to include partial tiles + worldToTileXY(worldX, worldY, true, pointStart, camera, layer); - if (enableGameObject) - { - this.body.gameObject.active = true; - } + var xStart = pointStart.x; + var yStart = pointStart.y; - if (showGameObject) - { - this.body.gameObject.visible = true; - } + // Bottom right corner of the rect, rounded up to include partial tiles + worldToTileXY(worldX + width, worldY + height, false, pointEnd, camera, layer); - this.body.enable = true; + var xEnd = Math.ceil(pointEnd.x); + var yEnd = Math.ceil(pointEnd.y); - return this; - }, + return GetTilesWithin(xStart, yStart, xEnd - xStart, yEnd - yStart, filteringOptions, layer); +}; - /** - * Stops and disables this Game Object's Body. - * - * @method Phaser.Physics.Arcade.Components.Enable#disableBody - * @since 3.0.0 - * - * @param {boolean} [disableGameObject=false] - Also deactivate this Game Object. - * @param {boolean} [hideGameObject=false] - Also hide this Game Object. - * - * @return {this} This Game Object. - * - * @see Phaser.Physics.Arcade.Body#enable - * @see Phaser.Physics.Arcade.StaticBody#enable - * @see Phaser.GameObjects.GameObject#active - * @see Phaser.GameObjects.GameObject#visible - */ - disableBody: function (disableGameObject, hideGameObject) - { - if (disableGameObject === undefined) { disableGameObject = false; } - if (hideGameObject === undefined) { hideGameObject = false; } +module.exports = GetTilesWithinWorldXY; - this.body.stop(); - this.body.enable = false; +/***/ }), - if (disableGameObject) - { - this.body.gameObject.active = false; - } +/***/ 29296: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (hideGameObject) - { - this.body.gameObject.visible = false; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var CONST = __webpack_require__(12920); +var NULL = __webpack_require__(10618); +var WorldToTileX = __webpack_require__(806); - /** - * Syncs the Body's position and size with its parent Game Object. - * You don't need to call this for Dynamic Bodies, as it happens automatically. - * But for Static bodies it's a useful way of modifying the position of a Static Body - * in the Physics World, based on its Game Object. - * - * @method Phaser.Physics.Arcade.Components.Enable#refreshBody - * @since 3.1.0 - * - * @return {this} This Game Object. - * - * @see Phaser.Physics.Arcade.StaticBody#updateFromGameObject - */ - refreshBody: function () +/** + * Gets the correct function to use to translate tiles, based on the map orientation. + * + * Only orthogonal maps support this feature. + * + * @function Phaser.Tilemaps.Components.GetWorldToTileXFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. + */ +var GetWorldToTileXFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) { - this.body.updateFromGameObject(); - - return this; + return WorldToTileX; + } + else + { + return NULL; } - }; -module.exports = Enable; +module.exports = GetWorldToTileXFunction; /***/ }), -/* 1374 */ -/***/ (function(module, exports) { + +/***/ 32688: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var CONST = __webpack_require__(12920); +var HexagonalWorldToTileXY = __webpack_require__(11516); +var IsometricWorldToTileXY = __webpack_require__(18750); +var NOOP = __webpack_require__(72283); +var StaggeredWorldToTileXY = __webpack_require__(90562); +var WorldToTileXY = __webpack_require__(45676); + /** - * Methods for setting the friction of an Arcade Physics Body. + * Gets the correct function to use to translate tiles, based on the map orientation. * - * In Arcade Physics, friction is a special case of motion transfer from an "immovable" body to a riding body. + * @function Phaser.Tilemaps.Components.GetWorldToTileXYFunction + * @since 3.50.0 * - * @namespace Phaser.Physics.Arcade.Components.Friction - * @since 3.0.0 + * @param {number} orientation - The Tilemap orientation constant. * - * @see Phaser.Physics.Arcade.Body#friction + * @return {function} The function to use to translate tiles for the given map type. */ -var Friction = { - - /** - * Sets the friction of this game object's physics body. - * In Arcade Physics, friction is a special case of motion transfer from an "immovable" body to a riding body. - * - * @method Phaser.Physics.Arcade.Components.Friction#setFriction - * @since 3.0.0 - * - * @param {number} x - The amount of horizontal friction to apply, [0, 1]. - * @param {number} [y=x] - The amount of vertical friction to apply, [0, 1]. - * - * @return {this} This Game Object. - * - * @see Phaser.Physics.Arcade.Body#friction - */ - setFriction: function (x, y) +var GetWorldToTileXYFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) { - this.body.friction.set(x, y); - - return this; - }, - - /** - * Sets the horizontal friction of this game object's physics body. - * This can move a riding body horizontally when it collides with this one on the vertical axis. - * - * @method Phaser.Physics.Arcade.Components.Friction#setFrictionX - * @since 3.0.0 - * - * @param {number} x - The amount of friction to apply, [0, 1]. - * - * @return {this} This Game Object. - * - * @see Phaser.Physics.Arcade.Body#friction - */ - setFrictionX: function (x) + return WorldToTileXY; + } + else if (orientation === CONST.ISOMETRIC) { - this.body.friction.x = x; - - return this; - }, - - /** - * Sets the vertical friction of this game object's physics body. - * This can move a riding body vertically when it collides with this one on the horizontal axis. - * - * @method Phaser.Physics.Arcade.Components.Friction#setFrictionY - * @since 3.0.0 - * - * @param {number} y - The amount of friction to apply, [0, 1]. - * - * @return {this} This Game Object. - * - * @see Phaser.Physics.Arcade.Body#friction - */ - setFrictionY: function (y) + return IsometricWorldToTileXY; + } + else if (orientation === CONST.HEXAGONAL) { - this.body.friction.y = y; - - return this; + return HexagonalWorldToTileXY; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredWorldToTileXY; + } + else + { + return NOOP; } - }; -module.exports = Friction; +module.exports = GetWorldToTileXYFunction; /***/ }), -/* 1375 */ -/***/ (function(module, exports) { + +/***/ 74326: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var CONST = __webpack_require__(12920); +var NULL = __webpack_require__(10618); +var StaggeredWorldToTileY = __webpack_require__(3689); +var WorldToTileY = __webpack_require__(70520); + /** - * Provides methods for setting the gravity properties of an Arcade Physics Game Object. - * Should be applied as a mixin and not used directly. + * Gets the correct function to use to translate tiles, based on the map orientation. * - * @namespace Phaser.Physics.Arcade.Components.Gravity - * @since 3.0.0 + * @function Phaser.Tilemaps.Components.GetWorldToTileYFunction + * @since 3.50.0 + * + * @param {number} orientation - The Tilemap orientation constant. + * + * @return {function} The function to use to translate tiles for the given map type. */ -var Gravity = { - - /** - * Set the X and Y values of the gravitational pull to act upon this Arcade Physics Game Object. Values can be positive or negative. Larger values result in a stronger effect. - * - * If only one value is provided, this value will be used for both the X and Y axis. - * - * @method Phaser.Physics.Arcade.Components.Gravity#setGravity - * @since 3.0.0 - * - * @param {number} x - The gravitational force to be applied to the X-axis. - * @param {number} [y=x] - The gravitational force to be applied to the Y-axis. If this is not specified, the X value will be used. - * - * @return {this} This Game Object. - */ - setGravity: function (x, y) +var GetWorldToTileYFunction = function (orientation) +{ + if (orientation === CONST.ORTHOGONAL) { - this.body.gravity.set(x, y); + return WorldToTileY; + } + else if (orientation === CONST.STAGGERED) + { + return StaggeredWorldToTileY; + } + else + { + return NULL; + } +}; - return this; - }, +module.exports = GetWorldToTileYFunction; - /** - * Set the gravitational force to be applied to the X axis. Value can be positive or negative. Larger values result in a stronger effect. - * - * @method Phaser.Physics.Arcade.Components.Gravity#setGravityX - * @since 3.0.0 - * - * @param {number} x - The gravitational force to be applied to the X-axis. - * - * @return {this} This Game Object. - */ - setGravityX: function (x) - { - this.body.gravity.x = x; - return this; - }, +/***/ }), - /** - * Set the gravitational force to be applied to the Y axis. Value can be positive or negative. Larger values result in a stronger effect. - * - * @method Phaser.Physics.Arcade.Components.Gravity#setGravityY - * @since 3.0.0 - * - * @param {number} y - The gravitational force to be applied to the Y-axis. - * - * @return {this} This Game Object. - */ - setGravityY: function (y) +/***/ 46598: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var IsInLayerBounds = __webpack_require__(62839); + +/** + * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns + * false if there is no tile or if the tile at that location has an index of -1. + * + * @function Phaser.Tilemaps.Components.HasTileAt + * @since 3.0.0 + * + * @param {number} tileX - X position to get the tile from (given in tile units, not pixels). + * @param {number} tileY - Y position to get the tile from (given in tile units, not pixels). + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {?boolean} Returns a boolean, or null if the layer given was invalid. + */ +var HasTileAt = function (tileX, tileY, layer) +{ + if (IsInLayerBounds(tileX, tileY, layer)) { - this.body.gravity.y = y; + var tile = layer.data[tileY][tileX]; - return this; + return (tile !== null && tile.index > -1); + } + else + { + return false; } - }; -module.exports = Gravity; +module.exports = HasTileAt; /***/ }), -/* 1376 */ -/***/ (function(module, exports) { + +/***/ 28654: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var HasTileAt = __webpack_require__(46598); +var Vector2 = __webpack_require__(93736); + +var point = new Vector2(); + /** - * Provides methods used for setting the immovable properties of an Arcade Physics Body. + * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns + * false if there is no tile or if the tile at that location has an index of -1. * - * @namespace Phaser.Physics.Arcade.Components.Immovable + * @function Phaser.Tilemaps.Components.HasTileAtWorldXY * @since 3.0.0 + * + * @param {number} worldX - The X coordinate of the world position. + * @param {number} worldY - The Y coordinate of the world position. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when factoring in which tiles to return. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {?boolean} Returns a boolean, or null if the layer given was invalid. */ -var Immovable = { - - /** - * Sets if this Body can be separated during collisions with other bodies. - * - * When a body is immovable it means it won't move at all, not even to separate it from collision - * overlap. If you just wish to prevent a body from being knocked around by other bodies, see - * the `setPushable` method instead. - * - * @method Phaser.Physics.Arcade.Components.Immovable#setImmovable - * @since 3.0.0 - * - * @param {boolean} [value=true] - Sets if this body will be separated during collisions with other bodies. - * - * @return {this} This Game Object. - */ - setImmovable: function (value) - { - if (value === undefined) { value = true; } - - this.body.immovable = value; +var HasTileAtWorldXY = function (worldX, worldY, camera, layer) +{ + layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera); - return this; - } + var tileX = point.x; + var tileY = point.y; + return HasTileAt(tileX, tileY, layer); }; -module.exports = Immovable; +module.exports = HasTileAtWorldXY; /***/ }), -/* 1377 */ -/***/ (function(module, exports) { + +/***/ 6358: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var SnapCeil = __webpack_require__(82127); +var SnapFloor = __webpack_require__(84314); + /** - * Provides methods used for setting the mass properties of an Arcade Physics Body. + * Returns the bounds in the given layer that are within the camera's viewport. + * This is used internally by the cull tiles function. * - * @namespace Phaser.Physics.Arcade.Components.Mass - * @since 3.0.0 + * @function Phaser.Tilemaps.Components.HexagonalCullBounds + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * + * @return {object} An object containing the `left`, `right`, `top` and `bottom` bounds. */ -var Mass = { +var HexagonalCullBounds = function (layer, camera) +{ + var tilemap = layer.tilemapLayer.tilemap; + var tilemapLayer = layer.tilemapLayer; - /** - * Sets the mass of the physics body - * - * @method Phaser.Physics.Arcade.Components.Mass#setMass - * @since 3.0.0 - * - * @param {number} value - New value for the mass of the body. - * - * @return {this} This Game Object. - */ - setMass: function (value) + // We need to use the tile sizes defined for the map as a whole, not the layer, + // in order to calculate the bounds correctly. As different sized tiles may be + // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. + var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); + var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); + + var len = layer.hexSideLength; + + var boundsLeft; + var boundsRight; + var boundsTop; + var boundsBottom; + + if (this.staggerAxis === 'y') { - this.body.mass = value; + var rowH = ((tileH - len) / 2 + len); - return this; + boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; + boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; + + boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, rowH, 0, true) - tilemapLayer.cullPaddingY; + boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, rowH, 0, true) + tilemapLayer.cullPaddingY; + } + else + { + var rowW = ((tileW - len) / 2 + len); + + boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, rowW, 0, true) - tilemapLayer.cullPaddingX; + boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, rowW, 0, true) + tilemapLayer.cullPaddingX; + + boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, tileH, 0, true) - tilemapLayer.cullPaddingY; + boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, tileH, 0, true) + tilemapLayer.cullPaddingY; } + return { + left: boundsLeft, + right: boundsRight, + top: boundsTop, + bottom: boundsBottom + }; }; -module.exports = Mass; +module.exports = HexagonalCullBounds; /***/ }), -/* 1378 */ -/***/ (function(module, exports) { + +/***/ 37524: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var CullBounds = __webpack_require__(6358); +var RunCull = __webpack_require__(6987); + /** - * Provides methods used for setting the pushable property of an Arcade Physics Body. + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. * - * @namespace Phaser.Physics.Arcade.Components.Pushable + * @function Phaser.Tilemaps.Components.HexagonalCullTiles * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {array} [outputArray] - An optional array to store the Tile objects within. + * @param {number} [renderOrder=0] - The rendering order constant. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ -var Pushable = { +var HexagonalCullTiles = function (layer, camera, outputArray, renderOrder) +{ + if (outputArray === undefined) { outputArray = []; } + if (renderOrder === undefined) { renderOrder = 0; } - /** - * Sets if this Body can be pushed by another Body. - * - * A body that cannot be pushed will reflect back all of the velocity it is given to the - * colliding body. If that body is also not pushable, then the separation will be split - * between them evenly. - * - * If you want your body to never move or seperate at all, see the `setImmovable` method. - * - * @method Phaser.Physics.Arcade.Components.Pushable#setPushable - * @since 3.50.0 - * - * @param {boolean} [value=true] - Sets if this body can be pushed by collisions with another Body. - * - * @return {this} This Game Object. - */ - setPushable: function (value) - { - if (value === undefined) { value = true; } + outputArray.length = 0; - this.body.pushable = value; + var tilemapLayer = layer.tilemapLayer; - return this; + // Camera world view bounds, snapped for scaled tile size + // Cull Padding values are given in tiles, not pixels + + var bounds = CullBounds(layer, camera); + + if (tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1) + { + bounds.left = 0; + bounds.right = layer.width; + bounds.top = 0; + bounds.bottom = layer.height; } + RunCull(layer, bounds, renderOrder, outputArray); + + return outputArray; }; -module.exports = Pushable; +module.exports = HexagonalCullTiles; /***/ }), -/* 1379 */ -/***/ (function(module, exports) { + +/***/ 63634: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var HexagonalTileToWorldXY = __webpack_require__(21715); +var Vector2 = __webpack_require__(93736); + +var tempVec = new Vector2(); + /** - * Provides methods for setting the size of an Arcade Physics Game Object. - * Should be applied as a mixin and not used directly. + * Gets the corners of the Hexagonal Tile as an array of Vector2s. * - * @namespace Phaser.Physics.Arcade.Components.Size - * @since 3.0.0 + * @function Phaser.Tilemaps.Components.HexagonalGetTileCorners + * @since 3.60.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2[]} An array of Vector2s corresponding to the world XY location of each tile corner. */ -var Size = { +var HexagonalGetTileCorners = function (tileX, tileY, camera, layer) +{ + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; - /** - * Sets the body offset. This allows you to adjust the difference between the center of the body - * and the x and y coordinates of the parent Game Object. - * - * @method Phaser.Physics.Arcade.Components.Size#setOffset - * @since 3.0.0 - * - * @param {number} x - The amount to offset the body from the parent Game Object along the x-axis. - * @param {number} [y=x] - The amount to offset the body from the parent Game Object along the y-axis. Defaults to the value given for the x-axis. - * - * @return {this} This Game Object. - */ - setOffset: function (x, y) + if (tilemapLayer) { - this.body.setOffset(x, y); + tileWidth *= tilemapLayer.scaleX; + tileHeight *= tilemapLayer.scaleY; + } - return this; - }, + // Sets the center of the tile into tempVec + var center = HexagonalTileToWorldXY(tileX, tileY, tempVec, camera, layer); - /** - * **DEPRECATED**: Please use `setBodySize` instead. - * - * Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object. - * - * @method Phaser.Physics.Arcade.Components.Size#setSize - * @since 3.0.0 - * @deprecated - * - * @param {number} width - The new width of the physics body, in pixels. - * @param {number} height - The new height of the physics body, in pixels. - * @param {boolean} [center=true] - Should the body be re-positioned so its center aligns with the parent Game Object? - * - * @return {this} This Game Object. - */ - setSize: function (width, height, center) - { - this.body.setSize(width, height, center); + var corners = []; - return this; - }, + // Hard-coded orientation values for Pointy-Top Hexagons only + var b0 = 0.5773502691896257; // Math.sqrt(3) / 3 - /** - * Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object. - * - * @method Phaser.Physics.Arcade.Components.Size#setBodySize - * @since 3.24.0 - * - * @param {number} width - The new width of the physics body, in pixels. - * @param {number} height - The new height of the physics body, in pixels. - * @param {boolean} [center=true] - Should the body be re-positioned so its center aligns with the parent Game Object? - * - * @return {this} This Game Object. - */ - setBodySize: function (width, height, center) - { - this.body.setSize(width, height, center); + var hexWidth; + var hexHeight; - return this; - }, + if (this.staggerAxis === 'y') + { + hexWidth = b0 * tileWidth; + hexHeight = tileHeight / 2; + } + else + { + hexWidth = tileWidth / 2; + hexHeight = b0 * tileHeight; + } - /** - * Sets this physics body to use a circle for collision instead of a rectangle. - * - * @method Phaser.Physics.Arcade.Components.Size#setCircle - * @since 3.0.0 - * - * @param {number} radius - The radius of the physics body, in pixels. - * @param {number} [offsetX] - The amount to offset the body from the parent Game Object along the x-axis. - * @param {number} [offsetY] - The amount to offset the body from the parent Game Object along the y-axis. - * - * @return {this} This Game Object. - */ - setCircle: function (radius, offsetX, offsetY) + for (var i = 0; i < 6; i++) { - this.body.setCircle(radius, offsetX, offsetY); + var angle = 2 * Math.PI * (0.5 - i) / 6; - return this; + corners.push(new Vector2(center.x + (hexWidth * Math.cos(angle)), center.y + (hexHeight * Math.sin(angle)))); } + return corners; }; -module.exports = Size; +module.exports = HexagonalGetTileCorners; /***/ }), -/* 1380 */ -/***/ (function(module, exports) { + +/***/ 21715: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Vector2 = __webpack_require__(93736); + /** - * Provides methods for modifying the velocity of an Arcade Physics body. + * Converts from hexagonal tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. * - * Should be applied as a mixin and not used directly. + * @function Phaser.Tilemaps.Components.HexagonalTileToWorldXY + * @since 3.50.0 * - * @namespace Phaser.Physics.Arcade.Components.Velocity - * @since 3.0.0 + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in world coordinates. */ -var Velocity = { +var HexagonalTileToWorldXY = function (tileX, tileY, point, camera, layer) +{ + if (!point) { point = new Vector2(); } - /** - * Sets the velocity of the Body. - * - * @method Phaser.Physics.Arcade.Components.Velocity#setVelocity - * @since 3.0.0 - * - * @param {number} x - The horizontal velocity of the body. Positive values move the body to the right, while negative values move it to the left. - * @param {number} [y=x] - The vertical velocity of the body. Positive values move the body down, while negative values move it up. - * - * @return {this} This Game Object. - */ - setVelocity: function (x, y) - { - this.body.setVelocity(x, y); + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; - return this; - }, + var worldX = 0; + var worldY = 0; - /** - * Sets the horizontal component of the body's velocity. - * - * Positive values move the body to the right, while negative values move it to the left. - * - * @method Phaser.Physics.Arcade.Components.Velocity#setVelocityX - * @since 3.0.0 - * - * @param {number} x - The new horizontal velocity. - * - * @return {this} This Game Object. - */ - setVelocityX: function (x) + if (tilemapLayer) { - this.body.setVelocityX(x); + if (!camera) { camera = tilemapLayer.scene.cameras.main; } - return this; - }, + worldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); + worldY = tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY); - /** - * Sets the vertical component of the body's velocity. - * - * Positive values move the body down, while negative values move it up. - * - * @method Phaser.Physics.Arcade.Components.Velocity#setVelocityY - * @since 3.0.0 - * - * @param {number} y - The new vertical velocity of the body. - * - * @return {this} This Game Object. - */ - setVelocityY: function (y) - { - this.body.setVelocityY(y); + tileWidth *= tilemapLayer.scaleX; + tileHeight *= tilemapLayer.scaleY; + } - return this; - }, + // Hard-coded orientation values for Pointy-Top Hexagons only - /** - * Sets the maximum velocity of the body. - * - * @method Phaser.Physics.Arcade.Components.Velocity#setMaxVelocity - * @since 3.0.0 - * - * @param {number} x - The new maximum horizontal velocity. - * @param {number} [y=x] - The new maximum vertical velocity. - * - * @return {this} This Game Object. - */ - setMaxVelocity: function (x, y) + // origin + var tileWidthHalf = tileWidth / 2; + var tileHeightHalf = tileHeight / 2; + + var x; + var y; + + if (this.staggerAxis === 'y') { - this.body.maxVelocity.set(x, y); + x = worldX + (tileWidth * tileX) + tileWidth; + y = worldY + ((1.5 * tileY) * tileHeightHalf) + tileHeightHalf; - return this; + if (tileY % 2 === 0) + { + if (this.staggerIndex === 'odd') + { + x -= tileWidthHalf; + } + else + { + x += tileWidthHalf; + } + } + } + else if ((this.staggerAxis === 'x') && (this.staggerIndex === 'odd')) + { + x = worldX + ((1.5 * tileX) * tileWidthHalf) + tileWidthHalf; + y = worldY + (tileHeight * tileX) + tileHeight; + + if (tileX % 2 === 0) + { + if (this.staggerIndex === 'odd') + { + y -= tileHeightHalf; + } + else + { + y += tileHeightHalf; + } + } } + return point.set(x, y); }; -module.exports = Velocity; +module.exports = HexagonalTileToWorldXY; /***/ }), -/* 1381 */ -/***/ (function(module, exports) { + +/***/ 11516: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Vector2 = __webpack_require__(93736); + /** - * The Arcade Physics World Collide Event. - * - * This event is dispatched by an Arcade Physics World instance if two bodies collide _and_ at least - * one of them has their [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`. - * - * It provides an alternative means to handling collide events rather than using the callback approach. - * - * Listen to it from a Scene using: `this.physics.world.on('collide', listener)`. - * - * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. + * Converts from world XY coordinates (pixels) to hexagonal tile XY coordinates (tile units), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. * - * @event Phaser.Physics.Arcade.Events#COLLIDE - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject1 - The first Game Object involved in the collision. This is the parent of `body1`. - * @param {Phaser.GameObjects.GameObject} gameObject2 - The second Game Object involved in the collision. This is the parent of `body2`. - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - The first Physics Body involved in the collision. - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - The second Physics Body involved in the collision. + * @function Phaser.Tilemaps.Components.HexagonalWorldToTileXY + * @since 3.50.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinates down to the nearest integer. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in tile units. */ -module.exports = 'collide'; - +var HexagonalWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +{ + if (!point) { point = new Vector2(); } -/***/ }), -/* 1382 */ -/***/ (function(module, exports) { + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } -/** - * The Arcade Physics World Overlap Event. - * - * This event is dispatched by an Arcade Physics World instance if two bodies overlap _and_ at least - * one of them has their [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`. - * - * It provides an alternative means to handling overlap events rather than using the callback approach. - * - * Listen to it from a Scene using: `this.physics.world.on('overlap', listener)`. - * - * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. - * - * @event Phaser.Physics.Arcade.Events#OVERLAP - * @since 3.0.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject1 - The first Game Object involved in the overlap. This is the parent of `body1`. - * @param {Phaser.GameObjects.GameObject} gameObject2 - The second Game Object involved in the overlap. This is the parent of `body2`. - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body1 - The first Physics Body involved in the overlap. - * @param {Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody} body2 - The second Physics Body involved in the overlap. - */ -module.exports = 'overlap'; + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll + worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); -/***/ }), -/* 1383 */ -/***/ (function(module, exports) { + tileWidth *= tilemapLayer.scaleX; + tileHeight *= tilemapLayer.scaleY; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // Hard-coded orientation values for Pointy-Top Hexagons only + var b0 = 0.5773502691896257; // Math.sqrt(3) / 3 + var b1 = -0.3333333333333333; // -1 / 3 + var b2 = 0; + var b3 = 0.6666666666666666; // 2 / 3 -/** - * The Arcade Physics World Pause Event. - * - * This event is dispatched by an Arcade Physics World instance when it is paused. - * - * Listen to it from a Scene using: `this.physics.world.on('pause', listener)`. - * - * @event Phaser.Physics.Arcade.Events#PAUSE - * @since 3.0.0 - */ -module.exports = 'pause'; + // origin + var tileWidthHalf = tileWidth / 2; + var tileHeightHalf = tileHeight / 2; + var px; + var py; + var q; + var r; + var s; -/***/ }), -/* 1384 */ -/***/ (function(module, exports) { + // size + if (layer.staggerAxis === 'y') + { + // x = b0 * tileWidth + // y = tileHeightHalf + px = (worldX - tileWidthHalf) / (b0 * tileWidth); + py = (worldY - tileHeightHalf) / tileHeightHalf; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + q = b0 * px + b1 * py; + r = b2 * px + b3 * py; + } + else + { + // x = tileWidthHalf + // y = b0 * tileHeight + px = (worldX - tileWidthHalf) / tileWidthHalf; + py = (worldY - tileHeightHalf) / (b0 * tileHeight); -/** - * The Arcade Physics World Resume Event. - * - * This event is dispatched by an Arcade Physics World instance when it resumes from a paused state. - * - * Listen to it from a Scene using: `this.physics.world.on('resume', listener)`. - * - * @event Phaser.Physics.Arcade.Events#RESUME - * @since 3.0.0 - */ -module.exports = 'resume'; + q = b1 * px + b0 * py; + r = b3 * px + b2 * py; + } + s = -q - r; -/***/ }), -/* 1385 */ -/***/ (function(module, exports) { + var qi = Math.round(q); + var ri = Math.round(r); + var si = Math.round(s); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var qDiff = Math.abs(qi - q); + var rDiff = Math.abs(ri - r); + var sDiff = Math.abs(si - s); -/** - * The Arcade Physics Tile Collide Event. - * - * This event is dispatched by an Arcade Physics World instance if a body collides with a Tile _and_ - * has its [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`. - * - * It provides an alternative means to handling collide events rather than using the callback approach. - * - * Listen to it from a Scene using: `this.physics.world.on('tilecollide', listener)`. - * - * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. - * - * @event Phaser.Physics.Arcade.Events#TILE_COLLIDE - * @since 3.16.1 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object involved in the collision. This is the parent of `body`. - * @param {Phaser.Tilemaps.Tile} tile - The tile the body collided with. - * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body of the Game Object involved in the collision. - */ -module.exports = 'tilecollide'; + if (qDiff > rDiff && qDiff > sDiff) + { + qi = -ri - si; + } + else if (rDiff > sDiff) + { + ri = -qi - si; + } + var x; + var y = ri; -/***/ }), -/* 1386 */ -/***/ (function(module, exports) { + if (layer.staggerIndex === 'odd') + { + x = (y % 2 === 0) ? (ri / 2) + qi : (ri / 2) + qi - 0.5; + } + else + { + x = (y % 2 === 0) ? (ri / 2) + qi : (ri / 2) + qi + 0.5; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return point.set(x, y); +}; -/** - * The Arcade Physics Tile Overlap Event. - * - * This event is dispatched by an Arcade Physics World instance if a body overlaps with a Tile _and_ - * has its [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`. - * - * It provides an alternative means to handling overlap events rather than using the callback approach. - * - * Listen to it from a Scene using: `this.physics.world.on('tileoverlap', listener)`. - * - * Please note that 'collide' and 'overlap' are two different things in Arcade Physics. - * - * @event Phaser.Physics.Arcade.Events#TILE_OVERLAP - * @since 3.16.1 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object involved in the overlap. This is the parent of `body`. - * @param {Phaser.Tilemaps.Tile} tile - The tile the body overlapped. - * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body of the Game Object involved in the overlap. - */ -module.exports = 'tileoverlap'; +module.exports = HexagonalWorldToTileXY; /***/ }), -/* 1387 */ -/***/ (function(module, exports) { + +/***/ 62839: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Arcade Physics World Bounds Event. - * - * This event is dispatched by an Arcade Physics World instance if a body makes contact with the world bounds _and_ - * it has its [onWorldBounds]{@link Phaser.Physics.Arcade.Body#onWorldBounds} property set to `true`. - * - * It provides an alternative means to handling collide events rather than using the callback approach. - * - * Listen to it from a Scene using: `this.physics.world.on('worldbounds', listener)`. + * Checks if the given tile coordinates are within the bounds of the layer. * - * @event Phaser.Physics.Arcade.Events#WORLD_BOUNDS + * @function Phaser.Tilemaps.Components.IsInLayerBounds * @since 3.0.0 - * - * @param {Phaser.Physics.Arcade.Body} body - The Arcade Physics Body that hit the world bounds. - * @param {boolean} up - Is the Body blocked up? I.e. collided with the top of the world bounds. - * @param {boolean} down - Is the Body blocked down? I.e. collided with the bottom of the world bounds. - * @param {boolean} left - Is the Body blocked left? I.e. collided with the left of the world bounds. - * @param {boolean} right - Is the Body blocked right? I.e. collided with the right of the world bounds. + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {boolean} `true` if the tile coordinates are within the bounds of the layer, otherwise `false`. */ -module.exports = 'worldbounds'; +var IsInLayerBounds = function (tileX, tileY, layer) +{ + return (tileX >= 0 && tileX < layer.width && tileY >= 0 && tileY < layer.height); +}; + +module.exports = IsInLayerBounds; /***/ }), -/* 1388 */ -/***/ (function(module, exports) { + +/***/ 20887: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var CheckIsoBounds = __webpack_require__(13125); + /** - * The Arcade Physics World Step Event. - * - * This event is dispatched by an Arcade Physics World instance whenever a physics step is run. - * It is emitted _after_ the bodies and colliders have been updated. - * - * In high framerate settings this can be multiple times per game frame. + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. * - * Listen to it from a Scene using: `this.physics.world.on('worldstep', listener)`. + * @function Phaser.Tilemaps.Components.IsometricCullTiles + * @since 3.50.0 * - * @event Phaser.Physics.Arcade.Events#WORLD_STEP - * @since 3.18.0 + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {array} [outputArray] - An optional array to store the Tile objects within. + * @param {number} [renderOrder=0] - The rendering order constant. * - * @param {number} delta - The delta time amount of this step, in seconds. + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ -module.exports = 'worldstep'; +var IsometricCullTiles = function (layer, camera, outputArray, renderOrder) +{ + if (outputArray === undefined) { outputArray = []; } + if (renderOrder === undefined) { renderOrder = 0; } + + outputArray.length = 0; + + var tilemapLayer = layer.tilemapLayer; + + var mapData = layer.data; + var mapWidth = layer.width; + var mapHeight = layer.height; + var skipCull = tilemapLayer.skipCull; + + var drawLeft = 0; + var drawRight = mapWidth; + var drawTop = 0; + var drawBottom = mapHeight; + + var x; + var y; + var tile; + + if (renderOrder === 0) + { + // right-down + + for (y = drawTop; y < drawBottom; y++) + { + for (x = drawLeft; x < drawRight; x++) + { + if (skipCull || CheckIsoBounds(x, y, layer, camera)) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + } + else if (renderOrder === 1) + { + // left-down + + for (y = drawTop; y < drawBottom; y++) + { + for (x = drawRight; x >= drawLeft; x--) + { + if (skipCull || CheckIsoBounds(x, y, layer, camera)) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + } + else if (renderOrder === 2) + { + // right-up + + for (y = drawBottom; y >= drawTop; y--) + { + for (x = drawLeft; x < drawRight; x++) + { + if (skipCull || CheckIsoBounds(x, y, layer, camera)) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + } + else if (renderOrder === 3) + { + // left-up + + for (y = drawBottom; y >= drawTop; y--) + { + for (x = drawRight; x >= drawLeft; x--) + { + if (skipCull || CheckIsoBounds(x, y, layer, camera)) + { + tile = mapData[y][x]; + + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } + } + } + } + + tilemapLayer.tilesDrawn = outputArray.length; + tilemapLayer.tilesTotal = mapWidth * mapHeight; + + return outputArray; +}; + +module.exports = IsometricCullTiles; /***/ }), -/* 1389 */ -/***/ (function(module, exports) { + +/***/ 21808: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var body1; -var body2; -var body1Pushable; -var body2Pushable; -var body1MassImpact; -var body2MassImpact; -var body1FullImpact; -var body2FullImpact; -var body1MovingLeft; -var body1MovingRight; -var body1Stationary; -var body2MovingLeft; -var body2MovingRight; -var body2Stationary; -var body1OnLeft; -var body2OnLeft; -var overlap; +var Vector2 = __webpack_require__(93736); /** - * Sets all of the local processing values and calculates the velocity exchanges. - * - * Then runs `BlockCheck` and returns the value from it. - * - * This method is called by `Phaser.Physics.Arcade.SeparateX` and should not be - * called directly. + * Converts from isometric tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. * - * @function Phaser.Physics.Arcade.ProcessX.Set - * @ignore + * @function Phaser.Tilemaps.Components.IsometricTileToWorldXY * @since 3.50.0 * - * @param {Phaser.Physics.Arcade.Body} b1 - The first Body to separate. - * @param {Phaser.Physics.Arcade.Body} b2 - The second Body to separate. - * @param {number} ov - The overlap value. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * - * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + * @return {Phaser.Math.Vector2} The XY location in world coordinates. */ -var Set = function (b1, b2, ov) +var IsometricTileToWorldXY = function (tileX, tileY, point, camera, layer) { - body1 = b1; - body2 = b2; + if (!point) { point = new Vector2(); } - var v1 = body1.velocity.x; - var v2 = body2.velocity.x; + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; - body1Pushable = body1.pushable; - body1MovingLeft = body1._dx < 0; - body1MovingRight = body1._dx > 0; - body1Stationary = body1._dx === 0; - body1OnLeft = Math.abs(body1.right - body2.x) <= Math.abs(body2.right - body1.x); - body1FullImpact = v2 - v1 * body1.bounce.x; + var layerWorldX = 0; + var layerWorldY = 0; - body2Pushable = body2.pushable; - body2MovingLeft = body2._dx < 0; - body2MovingRight = body2._dx > 0; - body2Stationary = body2._dx === 0; - body2OnLeft = !body1OnLeft; - body2FullImpact = v1 - v2 * body2.bounce.x; + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } - // negative delta = up, positive delta = down (inc. gravity) - overlap = Math.abs(ov); + layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); - return BlockCheck(); -}; + tileWidth *= tilemapLayer.scaleX; -/** - * Blocked Direction checks, because it doesn't matter if an object can be pushed - * or not, blocked is blocked. - * - * @function Phaser.Physics.Arcade.ProcessX.BlockCheck - * @ignore - * @since 3.50.0 - * - * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. - */ -var BlockCheck = function () -{ - // Body1 is moving right and Body2 is blocked from going right any further - if (body1MovingRight && body1OnLeft && body2.blocked.right) - { - body1.processX(-overlap, body1FullImpact, false, true); + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - return 1; + tileHeight *= tilemapLayer.scaleY; } - // Body1 is moving up and Body2 is blocked from going up any further - if (body1MovingLeft && body2OnLeft && body2.blocked.left) - { - body1.processX(overlap, body1FullImpact, true); + var x = layerWorldX + (tileX - tileY) * (tileWidth / 2); + var y = layerWorldY + (tileX + tileY) * (tileHeight / 2); - return 1; - } + return point.set(x, y); +}; - // Body2 is moving right and Body1 is blocked from going right any further - if (body2MovingRight && body2OnLeft && body1.blocked.right) - { - body2.processX(-overlap, body2FullImpact, false, true); +module.exports = IsometricTileToWorldXY; - return 2; - } - // Body2 is moving up and Body1 is blocked from going up any further - if (body2MovingLeft && body1OnLeft && body1.blocked.left) - { - body2.processX(overlap, body2FullImpact, true); +/***/ }), - return 2; - } +/***/ 18750: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return 0; -}; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Vector2 = __webpack_require__(93736); /** - * The main check function. Runs through one of the four possible tests and returns the results. + * Converts from world XY coordinates (pixels) to isometric tile XY coordinates (tile units), factoring in the + * layers position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. * - * @function Phaser.Physics.Arcade.ProcessX.Check - * @ignore + * @function Phaser.Tilemaps.Components.IsometricWorldToTileXY * @since 3.50.0 * - * @return {boolean} `true` if a check passed, otherwise `false`. + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {boolean} [originTop=true] - Which is the active face of the isometric tile? The top (default, true), or the base? (false) + * + * @return {Phaser.Math.Vector2} The XY location in tile units. */ -var Check = function () +var IsometricWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer, originTop) { - var v1 = body1.velocity.x; - var v2 = body2.velocity.x; + if (!point) { point = new Vector2(); } - var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); - var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); - var avg = (nv1 + nv2) * 0.5; + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; - nv1 -= avg; - nv2 -= avg; + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } - body1MassImpact = avg + nv1 * body1.bounce.x; - body2MassImpact = avg + nv2 * body2.bounce.x; + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll - // Body1 hits Body2 on the right hand side - if (body1MovingLeft && body2OnLeft) - { - return Run(0); - } + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - // Body2 hits Body1 on the right hand side - if (body2MovingLeft && body1OnLeft) - { - return Run(1); + tileHeight *= tilemapLayer.scaleY; + + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's horizontal scroll + + worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + + tileWidth *= tilemapLayer.scaleX; } - // Body1 hits Body2 on the left hand side - if (body1MovingRight && body1OnLeft) + var tileWidthHalf = tileWidth / 2; + var tileHeightHalf = tileHeight / 2; + + worldX = worldX - tileWidthHalf; + + if (!originTop) { - return Run(2); + worldY = worldY - tileHeight; } - // Body2 hits Body1 on the left hand side - if (body2MovingRight && body2OnLeft) + var x = 0.5 * (worldX / tileWidthHalf + worldY / tileHeightHalf); + var y = 0.5 * (-worldX / tileWidthHalf + worldY / tileHeightHalf); + + if (snapToFloor) { - return Run(3); + x = Math.floor(x); + y = Math.floor(y); } - return false; + return point.set(x, y); }; +module.exports = IsometricWorldToTileXY; + + +/***/ }), + +/***/ 29003: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + /** - * The main check function. Runs through one of the four possible tests and returns the results. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Tile = __webpack_require__(29633); +var IsInLayerBounds = __webpack_require__(62839); +var CalculateFacesAt = __webpack_require__(92839); +var SetTileCollision = __webpack_require__(68234); + +/** + * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index + * or a Tile object. If you pass in a Tile, all attributes will be copied over to the specified + * location. If you pass in an index, only the index at the specified location will be changed. + * Collision information will be recalculated at the specified location. * - * @function Phaser.Physics.Arcade.ProcessX.Run - * @ignore - * @since 3.50.0 + * @function Phaser.Tilemaps.Components.PutTileAt + * @since 3.0.0 * - * @param {number} side - The side to test. As passed in by the `Check` function. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * - * @return {boolean} Always returns `true`. + * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map. */ -var Run = function (side) +var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer) { - if (body1Pushable && body2Pushable) + if (recalculateFaces === undefined) { recalculateFaces = true; } + + if (!IsInLayerBounds(tileX, tileY, layer)) { - // Both pushable, or both moving at the same time, so equal rebound - overlap *= 0.5; + return null; + } - if (side === 0 || side === 3) - { - // body1MovingLeft && body2OnLeft - // body2MovingRight && body2OnLeft - body1.processX(overlap, body1MassImpact); - body2.processX(-overlap, body2MassImpact); - } - else + var index; + var oldTile = layer.data[tileY][tileX]; + var oldTileCollides = oldTile && oldTile.collides; + + if (tile instanceof Tile) + { + if (layer.data[tileY][tileX] === null) { - // body2MovingLeft && body1OnLeft - // body1MovingRight && body1OnLeft - body1.processX(-overlap, body1MassImpact); - body2.processX(overlap, body2MassImpact); + layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, layer.tileWidth, layer.tileHeight); } + + layer.data[tileY][tileX].copy(tile); } - else if (body1Pushable && !body2Pushable) + else { - // Body1 pushable, Body2 not + index = tile; - if (side === 0 || side === 3) + if (layer.data[tileY][tileX] === null) { - // body1MovingLeft && body2OnLeft - // body2MovingRight && body2OnLeft - body1.processX(overlap, body1FullImpact, true); + layer.data[tileY][tileX] = new Tile(layer, index, tileX, tileY, layer.tileWidth, layer.tileHeight); } else { - // body2MovingLeft && body1OnLeft - // body1MovingRight && body1OnLeft - body1.processX(-overlap, body1FullImpact, false, true); + layer.data[tileY][tileX].index = index; } } - else if (!body1Pushable && body2Pushable) - { - // Body2 pushable, Body1 not - if (side === 0 || side === 3) - { - // body1MovingLeft && body2OnLeft - // body2MovingRight && body2OnLeft - body2.processX(-overlap, body2FullImpact, false, true); - } - else - { - // body2MovingLeft && body1OnLeft - // body1MovingRight && body1OnLeft - body2.processX(overlap, body2FullImpact, true); - } + // Updating colliding flag on the new tile + var newTile = layer.data[tileY][tileX]; + var collides = layer.collideIndexes.indexOf(newTile.index) !== -1; + + index = tile instanceof Tile ? tile.index : tile; + + if (index === -1) + { + newTile.width = layer.tileWidth; + newTile.height = layer.tileHeight; } else { - // Neither body is pushable, so base it on movement + var tiles = layer.tilemapLayer.tilemap.tiles; + var sid = tiles[index][2]; + var set = layer.tilemapLayer.tileset[sid]; - var halfOverlap = overlap * 0.5; + newTile.width = set.tileWidth; + newTile.height = set.tileHeight; + } - if (side === 0) - { - // body1MovingLeft && body2OnLeft + SetTileCollision(newTile, collides); - if (body2Stationary) - { - body1.processX(overlap, 0, true); - body2.processX(0, null, false, true); - } - else if (body2MovingRight) - { - body1.processX(halfOverlap, 0, true); - body2.processX(-halfOverlap, 0, false, true); - } - else - { - // Body2 moving same direction as Body1 - body1.processX(halfOverlap, body2.velocity.x, true); - body2.processX(-halfOverlap, null, false, true); - } - } - else if (side === 1) - { - // body2MovingLeft && body1OnLeft + // Recalculate faces only if the colliding flag at (tileX, tileY) has changed + if (recalculateFaces && (oldTileCollides !== newTile.collides)) + { + CalculateFacesAt(tileX, tileY, layer); + } - if (body1Stationary) - { - body1.processX(0, null, false, true); - body2.processX(overlap, 0, true); - } - else if (body1MovingRight) - { - body1.processX(-halfOverlap, 0, false, true); - body2.processX(halfOverlap, 0, true); - } - else - { - // Body1 moving same direction as Body2 - body1.processX(-halfOverlap, null, false, true); - body2.processX(halfOverlap, body1.velocity.x, true); - } - } - else if (side === 2) - { - // body1MovingRight && body1OnLeft + return newTile; +}; - if (body2Stationary) - { - body1.processX(-overlap, 0, false, true); - body2.processX(0, null, true); - } - else if (body2MovingLeft) - { - body1.processX(-halfOverlap, 0, false, true); - body2.processX(halfOverlap, 0, true); - } - else - { - // Body2 moving same direction as Body1 - body1.processX(-halfOverlap, body2.velocity.x, false, true); - body2.processX(halfOverlap, null, true); - } - } - else if (side === 3) - { - // body2MovingRight && body2OnLeft +module.exports = PutTileAt; - if (body1Stationary) - { - body1.processX(0, null, true); - body2.processX(-overlap, 0, false, true); - } - else if (body1MovingLeft) - { - body1.processX(halfOverlap, 0, true); - body2.processX(-halfOverlap, 0, false, true); - } - else - { - // Body1 moving same direction as Body2 - body1.processX(halfOverlap, body2.velocity.y, true); - body2.processX(-halfOverlap, null, false, true); - } - } - } - return true; -}; +/***/ }), + +/***/ 48565: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * This function is run when Body1 is Immovable and Body2 is not. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var PutTileAt = __webpack_require__(29003); +var Vector2 = __webpack_require__(93736); + +var point = new Vector2(); + +/** + * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either + * an index or a Tile object. If you pass in a Tile, all attributes will be copied over to the + * specified location. If you pass in an index, only the index at the specified location will be + * changed. Collision information will be recalculated at the specified location. * - * @function Phaser.Physics.Arcade.ProcessX.RunImmovableBody1 - * @ignore - * @since 3.50.0 + * @function Phaser.Tilemaps.Components.PutTileAtWorldXY + * @since 3.0.0 * - * @param {number} blockedState - The block state value. + * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. + * @param {number} worldX - The x coordinate, in pixels. + * @param {number} worldY - The y coordinate, in pixels. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map. */ -var RunImmovableBody1 = function (blockedState) +var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer) { - if (blockedState === 1) - { - // But Body2 cannot go anywhere either, so we cancel out velocity - // Separation happened in the block check - body2.velocity.x = 0; - } - else if (body1OnLeft) - { - body2.processX(overlap, body2FullImpact, true); - } - else - { - body2.processX(-overlap, body2FullImpact, false, true); - } + layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera, layer); - // This is special case code that handles things like vertically moving platforms you can ride - if (body1.moves) - { - body2.y += (body1.y - body1.prev.y) * body1.friction.y; - body2._dy = body2.y - body2.prev.y; - } + return PutTileAt(tile, point.x, point.y, recalculateFaces, layer); }; +module.exports = PutTileAtWorldXY; + + +/***/ }), + +/***/ 56547: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + /** - * This function is run when Body2 is Immovable and Body1 is not. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var CalculateFacesWithin = __webpack_require__(60386); +var PutTileAt = __webpack_require__(29003); + +/** + * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified + * layer. The array can be composed of either tile indexes or Tile objects. If you pass in a Tile, + * all attributes will be copied over to the specified location. If you pass in an index, only the + * index at the specified location will be changed. Collision information will be recalculated + * within the region tiles were changed. * - * @function Phaser.Physics.Arcade.ProcessX.RunImmovableBody2 - * @ignore - * @since 3.50.0 + * @function Phaser.Tilemaps.Components.PutTilesAt + * @since 3.0.0 * - * @param {number} blockedState - The block state value. + * @param {(number[]|number[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ -var RunImmovableBody2 = function (blockedState) +var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer) { - if (blockedState === 2) + if (recalculateFaces === undefined) { recalculateFaces = true; } + + if (!Array.isArray(tilesArray)) { - // But Body1 cannot go anywhere either, so we cancel out velocity - // Separation happened in the block check - body1.velocity.x = 0; + return null; } - else if (body2OnLeft) + + // Force the input array to be a 2D array + if (!Array.isArray(tilesArray[0])) { - body1.processX(overlap, body1FullImpact, true); + tilesArray = [ tilesArray ]; } - else + + var height = tilesArray.length; + var width = tilesArray[0].length; + + for (var ty = 0; ty < height; ty++) { - body1.processX(-overlap, body1FullImpact, false, true); + for (var tx = 0; tx < width; tx++) + { + var tile = tilesArray[ty][tx]; + + PutTileAt(tile, tileX + tx, tileY + ty, false, layer); + } } - // This is special case code that handles things like vertically moving platforms you can ride - if (body2.moves) + if (recalculateFaces) { - body1.y += (body2.y - body2.prev.y) * body2.friction.y; - body1._dy = body1.y - body1.prev.y; + // Recalculate the faces within the destination area and neighboring tiles + CalculateFacesWithin(tileX - 1, tileY - 1, width + 2, height + 2, layer); } }; -/** - * @namespace Phaser.Physics.Arcade.ProcessX - * @ignore - */ - -module.exports = { - BlockCheck: BlockCheck, - Check: Check, - Set: Set, - Run: Run, - RunImmovableBody1: RunImmovableBody1, - RunImmovableBody2: RunImmovableBody2 -}; +module.exports = PutTilesAt; /***/ }), -/* 1390 */ -/***/ (function(module, exports) { + +/***/ 91180: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var body1; -var body2; -var body1Pushable; -var body2Pushable; -var body1MassImpact; -var body2MassImpact; -var body1FullImpact; -var body2FullImpact; -var body1MovingUp; -var body1MovingDown; -var body1Stationary; -var body2MovingUp; -var body2MovingDown; -var body2Stationary; -var body1OnTop; -var body2OnTop; -var overlap; +var GetTilesWithin = __webpack_require__(50811); +var GetRandom = __webpack_require__(72861); /** - * Sets all of the local processing values and calculates the velocity exchanges. - * - * Then runs `BlockCheck` and returns the value from it. - * - * This method is called by `Phaser.Physics.Arcade.SeparateY` and should not be - * called directly. - * - * @function Phaser.Physics.Arcade.ProcessY.Set - * @ignore - * @since 3.50.0 + * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the + * specified layer. Each tile will receive a new index. If an array of indexes is passed in, then + * those will be used for randomly assigning new tile indexes. If an array is not provided, the + * indexes found within the region (excluding -1) will be used for randomly assigning new tile + * indexes. This method only modifies tile indexes and does not change collision information. * - * @param {Phaser.Physics.Arcade.Body} b1 - The first Body to separate. - * @param {Phaser.Physics.Arcade.Body} b2 - The second Body to separate. - * @param {number} ov - The overlap value. + * @function Phaser.Tilemaps.Components.Randomize + * @since 3.0.0 * - * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {number[]} indexes - An array of indexes to randomly draw from during randomization. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ -var Set = function (b1, b2, ov) +var Randomize = function (tileX, tileY, width, height, indexes, layer) { - body1 = b1; - body2 = b2; + var i; + var tiles = GetTilesWithin(tileX, tileY, width, height, {}, layer); - var v1 = body1.velocity.y; - var v2 = body2.velocity.y; + // If no indices are given, then find all the unique indexes within the specified region + if (!indexes) + { + indexes = []; - body1Pushable = body1.pushable; - body1MovingUp = body1._dy < 0; - body1MovingDown = body1._dy > 0; - body1Stationary = body1._dy === 0; - body1OnTop = Math.abs(body1.bottom - body2.y) <= Math.abs(body2.bottom - body1.y); - body1FullImpact = v2 - v1 * body1.bounce.y; + for (i = 0; i < tiles.length; i++) + { + if (indexes.indexOf(tiles[i].index) === -1) + { + indexes.push(tiles[i].index); + } + } + } - body2Pushable = body2.pushable; - body2MovingUp = body2._dy < 0; - body2MovingDown = body2._dy > 0; - body2Stationary = body2._dy === 0; - body2OnTop = !body1OnTop; - body2FullImpact = v1 - v2 * body2.bounce.y; + for (i = 0; i < tiles.length; i++) + { + tiles[i].index = GetRandom(indexes); + } +}; - // negative delta = up, positive delta = down (inc. gravity) - overlap = Math.abs(ov); +module.exports = Randomize; - return BlockCheck(); -}; + +/***/ }), + +/***/ 929: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * Blocked Direction checks, because it doesn't matter if an object can be pushed - * or not, blocked is blocked. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Tile = __webpack_require__(29633); +var IsInLayerBounds = __webpack_require__(62839); +var CalculateFacesAt = __webpack_require__(92839); + +/** + * Removes the tile at the given tile coordinates in the specified layer and updates the layer's + * collision information. * - * @function Phaser.Physics.Arcade.ProcessY.BlockCheck - * @ignore - * @since 3.50.0 + * @function Phaser.Tilemaps.Components.RemoveTileAt + * @since 3.0.0 * - * @return {number} The BlockCheck result. 0 = not blocked. 1 = Body 1 blocked. 2 = Body 2 blocked. + * @param {number} tileX - The x coordinate. + * @param {number} tileY - The y coordinate. + * @param {boolean} replaceWithNull - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile} The Tile object that was removed. */ -var BlockCheck = function () +var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, layer) { - // Body1 is moving down and Body2 is blocked from going down any further - if (body1MovingDown && body1OnTop && body2.blocked.down) - { - body1.processY(-overlap, body1FullImpact, false, true); + if (replaceWithNull === undefined) { replaceWithNull = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - return 1; + if (!IsInLayerBounds(tileX, tileY, layer)) + { + return null; } - // Body1 is moving up and Body2 is blocked from going up any further - if (body1MovingUp && body2OnTop && body2.blocked.up) - { - body1.processY(overlap, body1FullImpact, true); + var tile = layer.data[tileY][tileX]; - return 1; + if (!tile) + { + return null; } - - // Body2 is moving down and Body1 is blocked from going down any further - if (body2MovingDown && body2OnTop && body1.blocked.down) + else { - body2.processY(-overlap, body2FullImpact, false, true); - - return 2; + layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, layer.tileWidth, layer.tileHeight); } - // Body2 is moving up and Body1 is blocked from going up any further - if (body2MovingUp && body1OnTop && body1.blocked.up) + // Recalculate faces only if the removed tile was a colliding tile + if (recalculateFaces && tile && tile.collides) { - body2.processY(overlap, body2FullImpact, true); - - return 2; + CalculateFacesAt(tileX, tileY, layer); } - return 0; + return tile; }; +module.exports = RemoveTileAt; + + +/***/ }), + +/***/ 17384: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + /** - * The main check function. Runs through one of the four possible tests and returns the results. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var RemoveTileAt = __webpack_require__(929); +var Vector2 = __webpack_require__(93736); + +var point = new Vector2(); + +/** + * Removes the tile at the given world coordinates in the specified layer and updates the layer's + * collision information. * - * @function Phaser.Physics.Arcade.ProcessY.Check - * @ignore - * @since 3.50.0 + * @function Phaser.Tilemaps.Components.RemoveTileAtWorldXY + * @since 3.0.0 * - * @return {boolean} `true` if a check passed, otherwise `false`. + * @param {number} worldX - The x coordinate, in pixels. + * @param {number} worldY - The y coordinate, in pixels. + * @param {boolean} replaceWithNull - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. + * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Tilemaps.Tile} The Tile object that was removed. */ -var Check = function () +var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer) { - var v1 = body1.velocity.y; - var v2 = body2.velocity.y; + layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera, layer); - var nv1 = Math.sqrt((v2 * v2 * body2.mass) / body1.mass) * ((v2 > 0) ? 1 : -1); - var nv2 = Math.sqrt((v1 * v1 * body1.mass) / body2.mass) * ((v1 > 0) ? 1 : -1); - var avg = (nv1 + nv2) * 0.5; + return RemoveTileAt(point.x, point.y, replaceWithNull, recalculateFaces, layer); +}; - nv1 -= avg; - nv2 -= avg; +module.exports = RemoveTileAtWorldXY; - body1MassImpact = avg + nv1 * body1.bounce.y; - body2MassImpact = avg + nv2 * body2.bounce.y; - // Body1 hits Body2 on the bottom side - if (body1MovingUp && body2OnTop) - { - return Run(0); - } +/***/ }), - // Body2 hits Body1 on the bottom side - if (body2MovingUp && body1OnTop) - { - return Run(1); - } +/***/ 93763: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Body1 hits Body2 on the top side - if (body1MovingDown && body1OnTop) - { - return Run(2); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Body2 hits Body1 on the top side - if (body2MovingDown && body2OnTop) - { - return Run(3); - } +var GetTilesWithin = __webpack_require__(50811); +var Color = __webpack_require__(95509); - return false; -}; +var defaultTileColor = new Color(105, 210, 231, 150); +var defaultCollidingTileColor = new Color(243, 134, 48, 200); +var defaultFaceColor = new Color(40, 39, 37, 150); /** - * The main check function. Runs through one of the four possible tests and returns the results. - * - * @function Phaser.Physics.Arcade.ProcessY.Run - * @ignore - * @since 3.50.0 + * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to + * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles + * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation + * wherever you want on the screen. * - * @param {number} side - The side to test. As passed in by the `Check` function. + * @function Phaser.Tilemaps.Components.RenderDebug + * @since 3.0.0 * - * @return {boolean} Always returns `true`. + * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. + * @param {Phaser.Types.Tilemaps.DebugStyleOptions} styleConfig - An object specifying the colors to use for the debug drawing. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ -var Run = function (side) +var RenderDebug = function (graphics, styleConfig, layer) { - if (body1Pushable && body2Pushable) - { - // Both pushable, or both moving at the same time, so equal rebound - overlap *= 0.5; + if (styleConfig === undefined) { styleConfig = {}; } - if (side === 0 || side === 3) - { - // body1MovingUp && body2OnTop - // body2MovingDown && body2OnTop - body1.processY(overlap, body1MassImpact); - body2.processY(-overlap, body2MassImpact); - } - else - { - // body2MovingUp && body1OnTop - // body1MovingDown && body1OnTop - body1.processY(-overlap, body1MassImpact); - body2.processY(overlap, body2MassImpact); - } - } - else if (body1Pushable && !body2Pushable) + // Default colors without needlessly creating Color objects + var tileColor = (styleConfig.tileColor !== undefined) ? styleConfig.tileColor : defaultTileColor; + var collidingTileColor = (styleConfig.collidingTileColor !== undefined) ? styleConfig.collidingTileColor : defaultCollidingTileColor; + var faceColor = (styleConfig.faceColor !== undefined) ? styleConfig.faceColor : defaultFaceColor; + + var tiles = GetTilesWithin(0, 0, layer.width, layer.height, null, layer); + + graphics.translateCanvas(layer.tilemapLayer.x, layer.tilemapLayer.y); + graphics.scaleCanvas(layer.tilemapLayer.scaleX, layer.tilemapLayer.scaleY); + + for (var i = 0; i < tiles.length; i++) { - // Body1 pushable, Body2 not + var tile = tiles[i]; - if (side === 0 || side === 3) + var tw = tile.width; + var th = tile.height; + var x = tile.pixelX; + var y = tile.pixelY; + + var color = tile.collides ? collidingTileColor : tileColor; + + if (color !== null) { - // body1MovingUp && body2OnTop - // body2MovingDown && body2OnTop - body1.processY(overlap, body1FullImpact, true); + graphics.fillStyle(color.color, color.alpha / 255); + graphics.fillRect(x, y, tw, th); } - else + + // Inset the face line to prevent neighboring tile's lines from overlapping + x += 1; + y += 1; + tw -= 2; + th -= 2; + + if (faceColor !== null) { - // body2MovingUp && body1OnTop - // body1MovingDown && body1OnTop - body1.processY(-overlap, body1FullImpact, false, true); + graphics.lineStyle(1, faceColor.color, faceColor.alpha / 255); + + if (tile.faceTop) { graphics.lineBetween(x, y, x + tw, y); } + if (tile.faceRight) { graphics.lineBetween(x + tw, y, x + tw, y + th); } + if (tile.faceBottom) { graphics.lineBetween(x, y + th, x + tw, y + th); } + if (tile.faceLeft) { graphics.lineBetween(x, y, x, y + th); } } } - else if (!body1Pushable && body2Pushable) - { - // Body2 pushable, Body1 not +}; - if (side === 0 || side === 3) +module.exports = RenderDebug; + +/** + +function Orientation(f0, f1, f2, f3, b0, b1, b2, b3, start_angle) { + return {f0: f0, f1: f1, f2: f2, f3: f3, b0: b0, b1: b1, b2: b2, b3: b3, start_angle: start_angle}; +} + +function Layout(orientation, size, origin) { + return {orientation: orientation, size: size, origin: origin}; +} + +function Hex(q, r, s) { + return {q: q, r: r, s: s}; +} + +function hex_round(h) +{ + var qi = Math.round(h.q); + var ri = Math.round(h.r); + var si = Math.round(h.s); + var q_diff = Math.abs(qi - h.q); + var r_diff = Math.abs(ri - h.r); + var s_diff = Math.abs(si - h.s); + if (q_diff > r_diff && q_diff > s_diff) + { + qi = -ri - si; + } + else + if (r_diff > s_diff) { - // body1MovingUp && body2OnTop - // body2MovingDown && body2OnTop - body2.processY(-overlap, body2FullImpact, false, true); + ri = -qi - si; } else { - // body2MovingUp && body1OnTop - // body1MovingDown && body1OnTop - body2.processY(overlap, body2FullImpact, true); + si = -qi - ri; } - } - else - { - // Neither body is pushable, so base it on movement + return Hex(qi, ri, si); +} - var halfOverlap = overlap * 0.5; +var layout_pointy = Orientation(Math.sqrt(3.0), Math.sqrt(3.0) / 2.0, 0.0, 3.0 / 2.0, Math.sqrt(3.0) / 3.0, -1.0 / 3.0, 0.0, 2.0 / 3.0, 0.5); - if (side === 0) - { - // body1MovingUp && body2OnTop +function OffsetCoord(col, row) { + return {col: col, row: row}; +} - if (body2Stationary) - { - body1.processY(overlap, 0, true); - body2.processY(0, null, false, true); - } - else if (body2MovingDown) - { - body1.processY(halfOverlap, 0, true); - body2.processY(-halfOverlap, 0, false, true); - } - else - { - // Body2 moving same direction as Body1 - body1.processY(halfOverlap, body2.velocity.y, true); - body2.processY(-halfOverlap, null, false, true); - } - } - else if (side === 1) - { - // body2MovingUp && body1OnTop +var EVEN = 1; +var ODD = -1; - if (body1Stationary) - { - body1.processY(0, null, false, true); - body2.processY(overlap, 0, true); - } - else if (body1MovingDown) - { - body1.processY(-halfOverlap, 0, false, true); - body2.processY(halfOverlap, 0, true); - } - else - { - // Body1 moving same direction as Body2 - body1.processY(-halfOverlap, null, false, true); - body2.processY(halfOverlap, body1.velocity.y, true); - } - } - else if (side === 2) - { - // body1MovingDown && body1OnTop +function roffset_from_cube(offset, h) +{ + var col = h.q + (h.r + offset * (h.r & 1)) / 2; + var row = h.r; + return OffsetCoord(col, row); +} - if (body2Stationary) - { - body1.processY(-overlap, 0, false, true); - body2.processY(0, null, true); - } - else if (body2MovingUp) - { - body1.processY(-halfOverlap, 0, false, true); - body2.processY(halfOverlap, 0, true); - } - else - { - // Body2 moving same direction as Body1 - body1.processY(-halfOverlap, body2.velocity.y, false, true); - body2.processY(halfOverlap, null, true); - } - } - else if (side === 3) - { - // body2MovingDown && body2OnTop +function roffset_to_cube(offset, h) +{ + var q = h.col - (h.row + offset * (h.row & 1)) / 2; + var r = h.row; + var s = -q - r; + return Hex(q, r, s); +} - if (body1Stationary) - { - body1.processY(0, null, true); - body2.processY(-overlap, 0, false, true); - } - else if (body1MovingUp) - { - body1.processY(halfOverlap, 0, true); - body2.processY(-halfOverlap, 0, false, true); - } - else - { - // Body1 moving same direction as Body2 - body1.processY(halfOverlap, body2.velocity.y, true); - body2.processY(-halfOverlap, null, false, true); - } - } - } +function hex_to_pixel(layout, h) +{ + var M = layout.orientation; + var size = layout.size; + var origin = layout.origin; + var x = (M.f0 * h.q + M.f1 * h.r) * size.x; + var y = (M.f2 * h.q + M.f3 * h.r) * size.y; + return new Vector2(x + origin.x, y + origin.y); +} - return true; -}; +function hex_corner_offset(layout, corner) +{ + var M = layout.orientation; + var size = layout.size; + var angle = 2.0 * Math.PI * (M.start_angle - corner) / 6.0; + return new Vector2(size.x * Math.cos(angle), size.y * Math.sin(angle)); +} -/** - * This function is run when Body1 is Immovable and Body2 is not. - * - * @function Phaser.Physics.Arcade.ProcessY.RunImmovableBody1 - * @ignore - * @since 3.50.0 - * - * @param {number} blockedState - The block state value. - */ -var RunImmovableBody1 = function (blockedState) +function polygon_corners(layout, h) { - if (blockedState === 1) - { - // But Body2 cannot go anywhere either, so we cancel out velocity - // Separation happened in the block check - body2.velocity.y = 0; - } - else if (body1OnTop) - { - body2.processY(overlap, body2FullImpact, true); - } - else + var corners = []; + var center = hex_to_pixel(layout, h); + for (var i = 0; i < 6; i++) { - body2.processY(-overlap, body2FullImpact, false, true); + var offset = hex_corner_offset(layout, i); + corners.push(new Vector2(center.x + offset.x, center.y + offset.y)); } + return corners; +} - // This is special case code that handles things like horizontally moving platforms you can ride - if (body1.moves) - { - body2.x += (body1.x - body1.prev.x) * body1.friction.x; - body2._dx = body2.x - body2.prev.x; - } -}; +var layout = Layout(layout_pointy, new Vector2(tileHeight/2, tileWidth/2), new Vector2(tileWidth/2, tileWidth/2)); -/** - * This function is run when Body2 is Immovable and Body1 is not. - * - * @function Phaser.Physics.Arcade.ProcessY.RunImmovableBody2 - * @ignore - * @since 3.50.0 - * - * @param {number} blockedState - The block state value. - */ -var RunImmovableBody2 = function (blockedState) +for (var q = 0; q <= 9; q++) { - if (blockedState === 2) - { - // But Body1 cannot go anywhere either, so we cancel out velocity - // Separation happened in the block check - body1.velocity.y = 0; - } - else if (body2OnTop) - { - body1.processY(overlap, body1FullImpact, true); - } - else + for (var r = 0; r <= 9; r++) { - body1.processY(-overlap, body1FullImpact, false, true); - } + var h = Hex(q, r, -q - r); // cubed + // var hr = hex_round(h); + // var o = roffset_from_cube(ODD, hr); + // var b = roffset_to_cube(ODD, o); - // This is special case code that handles things like horizontally moving platforms you can ride - if (body2.moves) - { - body1.x += (body2.x - body2.prev.x) * body2.friction.x; - body1._dx = body1.x - body1.prev.x; - } -}; + var c = polygon_corners(layout, h); -/** - * @namespace Phaser.Physics.Arcade.ProcessY - * @ignore - */ + if (q === 0 && r === 0) + { + console.log(c); + } -module.exports = { - BlockCheck: BlockCheck, - Check: Check, - Set: Set, - Run: Run, - RunImmovableBody1: RunImmovableBody1, - RunImmovableBody2: RunImmovableBody2 -}; + g.beginPath(); + g.moveTo(Math.floor(c[0].x), Math.floor(c[0].y)); + for (var i = 1; i < c.length; i++) + { + g.lineTo(Math.floor(c[i].x), Math.floor(c[i].y)); + } -/***/ }), -/* 1391 */ -/***/ (function(module, exports, __webpack_require__) { + g.closePath(); + g.strokePath(); + } +} -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var c = polygon_corners(layout, hr); -/** - * @namespace Phaser.Physics.Arcade.Tilemap - */ + g.beginPath(); + g.moveTo(Math.floor(c[0].x), Math.floor(c[0].y)); -var Tilemap = { + for (var i = 1; i < c.length; i++) + { + g.lineTo(Math.floor(c[i].x), Math.floor(c[i].y)); + } - ProcessTileCallbacks: __webpack_require__(530), - ProcessTileSeparationX: __webpack_require__(534), - ProcessTileSeparationY: __webpack_require__(536), - SeparateTile: __webpack_require__(532), - TileCheckX: __webpack_require__(533), - TileCheckY: __webpack_require__(535), - TileIntersectsBody: __webpack_require__(248) + g.closePath(); + g.fillPath(); -}; + // g.scene.add.text(c[3].x + 2, c[3].y + 6, `${hr.q} x ${hr.r}`); + g.scene.add.text(c[3].x + 2, c[3].y + 6, `${x} x ${y}`); -module.exports = Tilemap; + +*/ /***/ }), -/* 1392 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 51202: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Vector2 = __webpack_require__(3); +var GetTilesWithin = __webpack_require__(50811); /** - * @classdesc - * - * The Body Bounds class contains methods to help you extract the world coordinates from various points around - * the bounds of a Matter Body. Because Matter bodies are positioned based on their center of mass, and not a - * dimension based center, you often need to get the bounds coordinates in order to properly align them in the world. - * - * You can access this class via the MatterPhysics class from a Scene, i.e.: - * - * ```javascript - * this.matter.bodyBounds.getTopLeft(body); - * ``` - * - * See also the `MatterPhysics.alignBody` method. + * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching + * `findIndex` and updates their index to match `newIndex`. This only modifies the index and does + * not change collision information. * - * @class BodyBounds - * @memberof Phaser.Physics.Matter - * @constructor - * @since 3.22.0 + * @function Phaser.Tilemaps.Components.ReplaceByIndex + * @since 3.0.0 + * + * @param {number} findIndex - The index of the tile to search for. + * @param {number} newIndex - The index of the tile to replace it with. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ -var BodyBounds = new Class({ - - initialize: - - function BodyBounds () - { - /** - * A Vector2 that stores the temporary bounds center value during calculations by methods in this class. - * - * @name Phaser.Physics.Matter.BodyBounds#boundsCenter - * @type {Phaser.Math.Vector2} - * @since 3.22.0 - */ - this.boundsCenter = new Vector2(); - - /** - * A Vector2 that stores the temporary center diff values during calculations by methods in this class. - * - * @name Phaser.Physics.Matter.BodyBounds#centerDiff - * @type {Phaser.Math.Vector2} - * @since 3.22.0 - */ - this.centerDiff = new Vector2(); - }, +var ReplaceByIndex = function (findIndex, newIndex, tileX, tileY, width, height, layer) +{ + var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); - /** - * Parses the given body to get the bounds diff values from it. - * - * They're stored in this class in the temporary properties `boundsCenter` and `centerDiff`. - * - * This method is called automatically by all other methods in this class. - * - * @method Phaser.Physics.Matter.BodyBounds#parseBody - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the bounds position from. - * - * @return {boolean} `true` if it was able to get the bounds, otherwise `false`. - */ - parseBody: function (body) + for (var i = 0; i < tiles.length; i++) { - body = (body.hasOwnProperty('body')) ? body.body : body; - - if (!body.hasOwnProperty('bounds') || !body.hasOwnProperty('centerOfMass')) + if (tiles[i] && tiles[i].index === findIndex) { - return false; + tiles[i].index = newIndex; } + } +}; - var boundsCenter = this.boundsCenter; - var centerDiff = this.centerDiff; +module.exports = ReplaceByIndex; - var boundsWidth = body.bounds.max.x - body.bounds.min.x; - var boundsHeight = body.bounds.max.y - body.bounds.min.y; - var bodyCenterX = boundsWidth * body.centerOfMass.x; - var bodyCenterY = boundsHeight * body.centerOfMass.y; +/***/ }), - boundsCenter.set(boundsWidth / 2, boundsHeight / 2); - centerDiff.set(bodyCenterX - boundsCenter.x, bodyCenterY - boundsCenter.y); +/***/ 6987: +/***/ ((module) => { - return true; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Takes a Body and returns the world coordinates of the top-left of its _bounds_. - * - * Body bounds are updated by Matter each step and factor in scale and rotation. - * This will return the world coordinate based on the bodies _current_ position and bounds. - * - * @method Phaser.Physics.Matter.BodyBounds#getTopLeft - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. - * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. - * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. - * - * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. - */ - getTopLeft: function (body, x, y) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } +/** + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. + * + * @function Phaser.Tilemaps.Components.RunCull + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {object} bounds - An object containing the `left`, `right`, `top` and `bottom` bounds. + * @param {number} renderOrder - The rendering order constant. + * @param {array} outputArray - The array to store the Tile objects within. + * + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. + */ +var RunCull = function (layer, bounds, renderOrder, outputArray) +{ + var mapData = layer.data; + var mapWidth = layer.width; + var mapHeight = layer.height; - if (this.parseBody(body)) - { - var center = this.boundsCenter; - var diff = this.centerDiff; + var tilemapLayer = layer.tilemapLayer; - return new Vector2( - x + center.x + diff.x, - y + center.y + diff.y - ); - } + var drawLeft = Math.max(0, bounds.left); + var drawRight = Math.min(mapWidth, bounds.right); + var drawTop = Math.max(0, bounds.top); + var drawBottom = Math.min(mapHeight, bounds.bottom); - return false; - }, + var x; + var y; + var tile; - /** - * Takes a Body and returns the world coordinates of the top-center of its _bounds_. - * - * Body bounds are updated by Matter each step and factor in scale and rotation. - * This will return the world coordinate based on the bodies _current_ position and bounds. - * - * @method Phaser.Physics.Matter.BodyBounds#getTopCenter - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. - * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. - * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. - * - * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. - */ - getTopCenter: function (body, x, y) + if (renderOrder === 0) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } + // right-down - if (this.parseBody(body)) + for (y = drawTop; y < drawBottom; y++) { - var center = this.boundsCenter; - var diff = this.centerDiff; - - return new Vector2( - x + diff.x, - y + center.y + diff.y - ); - } + for (x = drawLeft; mapData[y] && x < drawRight; x++) + { + tile = mapData[y][x]; - return false; - }, + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } - /** - * Takes a Body and returns the world coordinates of the top-right of its _bounds_. - * - * Body bounds are updated by Matter each step and factor in scale and rotation. - * This will return the world coordinate based on the bodies _current_ position and bounds. - * - * @method Phaser.Physics.Matter.BodyBounds#getTopRight - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. - * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. - * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. - * - * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. - */ - getTopRight: function (body, x, y) + outputArray.push(tile); + } + } + } + else if (renderOrder === 1) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } + // left-down - if (this.parseBody(body)) + for (y = drawTop; y < drawBottom; y++) { - var center = this.boundsCenter; - var diff = this.centerDiff; - - return new Vector2( - x - (center.x - diff.x), - y + center.y + diff.y - ); - } + for (x = drawRight; mapData[y] && x >= drawLeft; x--) + { + tile = mapData[y][x]; - return false; - }, + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } - /** - * Takes a Body and returns the world coordinates of the left-center of its _bounds_. - * - * Body bounds are updated by Matter each step and factor in scale and rotation. - * This will return the world coordinate based on the bodies _current_ position and bounds. - * - * @method Phaser.Physics.Matter.BodyBounds#getLeftCenter - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. - * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. - * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. - * - * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. - */ - getLeftCenter: function (body, x, y) + outputArray.push(tile); + } + } + } + else if (renderOrder === 2) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } + // right-up - if (this.parseBody(body)) + for (y = drawBottom; y >= drawTop; y--) { - var center = this.boundsCenter; - var diff = this.centerDiff; - - return new Vector2( - x + center.x + diff.x, - y + diff.y - ); - } + for (x = drawLeft; mapData[y] && x < drawRight; x++) + { + tile = mapData[y][x]; - return false; - }, + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } - /** - * Takes a Body and returns the world coordinates of the center of its _bounds_. - * - * Body bounds are updated by Matter each step and factor in scale and rotation. - * This will return the world coordinate based on the bodies _current_ position and bounds. - * - * @method Phaser.Physics.Matter.BodyBounds#getCenter - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. - * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. - * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. - * - * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. - */ - getCenter: function (body, x, y) + outputArray.push(tile); + } + } + } + else if (renderOrder === 3) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } + // left-up - if (this.parseBody(body)) + for (y = drawBottom; y >= drawTop; y--) { - var diff = this.centerDiff; + for (x = drawRight; mapData[y] && x >= drawLeft; x--) + { + tile = mapData[y][x]; - return new Vector2( - x + diff.x, - y + diff.y - ); + if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0) + { + continue; + } + + outputArray.push(tile); + } } + } - return false; - }, + tilemapLayer.tilesDrawn = outputArray.length; + tilemapLayer.tilesTotal = mapWidth * mapHeight; - /** - * Takes a Body and returns the world coordinates of the right-center of its _bounds_. - * - * Body bounds are updated by Matter each step and factor in scale and rotation. - * This will return the world coordinate based on the bodies _current_ position and bounds. - * - * @method Phaser.Physics.Matter.BodyBounds#getRightCenter - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. - * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. - * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. - * - * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. - */ - getRightCenter: function (body, x, y) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } + return outputArray; +}; - if (this.parseBody(body)) - { - var center = this.boundsCenter; - var diff = this.centerDiff; +module.exports = RunCull; - return new Vector2( - x - (center.x - diff.x), - y + diff.y - ); - } - return false; - }, +/***/ }), - /** - * Takes a Body and returns the world coordinates of the bottom-left of its _bounds_. - * - * Body bounds are updated by Matter each step and factor in scale and rotation. - * This will return the world coordinate based on the bodies _current_ position and bounds. - * - * @method Phaser.Physics.Matter.BodyBounds#getBottomLeft - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. - * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. - * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. - * - * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. - */ - getBottomLeft: function (body, x, y) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } +/***/ 51710: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (this.parseBody(body)) - { - var center = this.boundsCenter; - var diff = this.centerDiff; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return new Vector2( - x + center.x + diff.x, - y - (center.y - diff.y) - ); - } +var SetTileCollision = __webpack_require__(68234); +var CalculateFacesWithin = __webpack_require__(60386); +var SetLayerCollisionIndex = __webpack_require__(91181); - return false; - }, +/** + * Sets collision on the given tile or tiles within a layer by index. You can pass in either a + * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if + * collision will be enabled (true) or disabled (false). + * + * @function Phaser.Tilemaps.Components.SetCollision + * @since 3.0.0 + * + * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. + */ +var SetCollision = function (indexes, collides, recalculateFaces, layer, updateLayer) +{ + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + if (updateLayer === undefined) { updateLayer = true; } - /** - * Takes a Body and returns the world coordinates of the bottom-center of its _bounds_. - * - * Body bounds are updated by Matter each step and factor in scale and rotation. - * This will return the world coordinate based on the bodies _current_ position and bounds. - * - * @method Phaser.Physics.Matter.BodyBounds#getBottomCenter - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. - * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. - * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. - * - * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. - */ - getBottomCenter: function (body, x, y) + if (!Array.isArray(indexes)) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - - if (this.parseBody(body)) - { - var center = this.boundsCenter; - var diff = this.centerDiff; - - return new Vector2( - x + diff.x, - y - (center.y - diff.y) - ); - } - - return false; - }, + indexes = [ indexes ]; + } - /** - * Takes a Body and returns the world coordinates of the bottom-right of its _bounds_. - * - * Body bounds are updated by Matter each step and factor in scale and rotation. - * This will return the world coordinate based on the bodies _current_ position and bounds. - * - * @method Phaser.Physics.Matter.BodyBounds#getBottomRight - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to get the position from. - * @param {number} [x=0] - Optional horizontal offset to add to the returned coordinates. - * @param {number} [y=0] - Optional vertical offset to add to the returned coordinates. - * - * @return {(Phaser.Math.Vector2|false)} A Vector2 containing the coordinates, or `false` if it was unable to parse the body. - */ - getBottomRight: function (body, x, y) + // Update the array of colliding indexes + for (var i = 0; i < indexes.length; i++) { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } + SetLayerCollisionIndex(indexes[i], collides, layer); + } - if (this.parseBody(body)) + // Update the tiles + if (updateLayer) + { + for (var ty = 0; ty < layer.height; ty++) { - var center = this.boundsCenter; - var diff = this.centerDiff; + for (var tx = 0; tx < layer.width; tx++) + { + var tile = layer.data[ty][tx]; - return new Vector2( - x - (center.x - diff.x), - y - (center.y - diff.y) - ); + if (tile && indexes.indexOf(tile.index) !== -1) + { + SetTileCollision(tile, collides); + } + } } - - return false; } -}); + if (recalculateFaces) + { + CalculateFacesWithin(0, 0, layer.width, layer.height, layer); + } +}; -module.exports = BodyBounds; +module.exports = SetCollision; /***/ }), -/* 1393 */ -/***/ (function(module, exports) { + +/***/ 15216: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @author Stefan Hedman (http://steffe.se) + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// v0.3.0 - -module.exports = { - decomp: polygonDecomp, - quickDecomp: polygonQuickDecomp, - isSimple: polygonIsSimple, - removeCollinearPoints: polygonRemoveCollinearPoints, - removeDuplicatePoints: polygonRemoveDuplicatePoints, - makeCCW: polygonMakeCCW -}; +var SetTileCollision = __webpack_require__(68234); +var CalculateFacesWithin = __webpack_require__(60386); +var SetLayerCollisionIndex = __webpack_require__(91181); /** - * Compute the intersection between two lines. - * @static - * @method lineInt - * @param {Array} l1 Line vector 1 - * @param {Array} l2 Line vector 2 - * @param {Number} precision Precision to use when checking if the lines are parallel - * @return {Array} The intersection point. + * Sets collision on a range of tiles in a layer whose index is between the specified `start` and + * `stop` (inclusive). Calling this with a start value of 10 and a stop value of 14 would set + * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be + * enabled (true) or disabled (false). + * + * @function Phaser.Tilemaps.Components.SetCollisionBetween + * @since 3.0.0 + * + * @param {number} start - The first index of the tile to be set for collision. + * @param {number} stop - The last index of the tile to be set for collision. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. */ -function lineInt(l1,l2,precision){ - precision = precision || 0; - var i = [0,0]; // point - var a1, b1, c1, a2, b2, c2, det; // scalars - a1 = l1[1][1] - l1[0][1]; - b1 = l1[0][0] - l1[1][0]; - c1 = a1 * l1[0][0] + b1 * l1[0][1]; - a2 = l2[1][1] - l2[0][1]; - b2 = l2[0][0] - l2[1][0]; - c2 = a2 * l2[0][0] + b2 * l2[0][1]; - det = a1 * b2 - a2*b1; - if (!scalar_eq(det, 0, precision)) { // lines are not parallel - i[0] = (b2 * c1 - b1 * c2) / det; - i[1] = (a1 * c2 - a2 * c1) / det; +var SetCollisionBetween = function (start, stop, collides, recalculateFaces, layer, updateLayer) +{ + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } + if (updateLayer === undefined) { updateLayer = true; } + + if (start > stop) + { + return; } - return i; -} -/** - * Checks if two line segments intersects. - * @method segmentsIntersect - * @param {Array} p1 The start vertex of the first line segment. - * @param {Array} p2 The end vertex of the first line segment. - * @param {Array} q1 The start vertex of the second line segment. - * @param {Array} q2 The end vertex of the second line segment. - * @return {Boolean} True if the two line segments intersect - */ -function lineSegmentsIntersect(p1, p2, q1, q2){ - var dx = p2[0] - p1[0]; - var dy = p2[1] - p1[1]; - var da = q2[0] - q1[0]; - var db = q2[1] - q1[1]; + // Update the array of colliding indexes + for (var index = start; index <= stop; index++) + { + SetLayerCollisionIndex(index, collides, layer); + } - // segments are parallel - if((da*dy - db*dx) === 0){ - return false; - } + // Update the tiles + if (updateLayer) + { + for (var ty = 0; ty < layer.height; ty++) + { + for (var tx = 0; tx < layer.width; tx++) + { + var tile = layer.data[ty][tx]; - var s = (dx * (q1[1] - p1[1]) + dy * (p1[0] - q1[0])) / (da * dy - db * dx); - var t = (da * (p1[1] - q1[1]) + db * (q1[0] - p1[0])) / (db * dx - da * dy); + if (tile) + { + if (tile.index >= start && tile.index <= stop) + { + SetTileCollision(tile, collides); + } + } + } + } + } - return (s>=0 && s<=1 && t>=0 && t<=1); -} + if (recalculateFaces) + { + CalculateFacesWithin(0, 0, layer.width, layer.height, layer); + } +}; -/** - * Get the area of a triangle spanned by the three given points. Note that the area will be negative if the points are not given in counter-clockwise order. - * @static - * @method area - * @param {Array} a - * @param {Array} b - * @param {Array} c - * @return {Number} - */ -function triangleArea(a,b,c){ - return (((b[0] - a[0])*(c[1] - a[1]))-((c[0] - a[0])*(b[1] - a[1]))); -} +module.exports = SetCollisionBetween; -function isLeft(a,b,c){ - return triangleArea(a,b,c) > 0; -} -function isLeftOn(a,b,c) { - return triangleArea(a, b, c) >= 0; -} +/***/ }), -function isRight(a,b,c) { - return triangleArea(a, b, c) < 0; -} +/***/ 33158: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -function isRightOn(a,b,c) { - return triangleArea(a, b, c) <= 0; -} +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -var tmpPoint1 = [], - tmpPoint2 = []; +var SetTileCollision = __webpack_require__(68234); +var CalculateFacesWithin = __webpack_require__(60386); +var SetLayerCollisionIndex = __webpack_require__(91181); /** - * Check if three points are collinear - * @method collinear - * @param {Array} a - * @param {Array} b - * @param {Array} c - * @param {Number} [thresholdAngle=0] Threshold angle to use when comparing the vectors. The function will return true if the angle between the resulting vectors is less than this value. Use zero for max precision. - * @return {Boolean} + * Sets collision on all tiles in the given layer, except for tiles that have an index specified in + * the given array. The `collides` parameter controls if collision will be enabled (true) or + * disabled (false). Tile indexes not currently in the layer are not affected. + * + * @function Phaser.Tilemaps.Components.SetCollisionByExclusion + * @since 3.0.0 + * + * @param {number[]} indexes - An array of the tile indexes to not be counted for collision. + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ -function collinear(a,b,c,thresholdAngle) { - if(!thresholdAngle){ - return triangleArea(a, b, c) === 0; - } else { - var ab = tmpPoint1, - bc = tmpPoint2; +var SetCollisionByExclusion = function (indexes, collides, recalculateFaces, layer) +{ + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - ab[0] = b[0]-a[0]; - ab[1] = b[1]-a[1]; - bc[0] = c[0]-b[0]; - bc[1] = c[1]-b[1]; + if (!Array.isArray(indexes)) + { + indexes = [ indexes ]; + } - var dot = ab[0]*bc[0] + ab[1]*bc[1], - magA = Math.sqrt(ab[0]*ab[0] + ab[1]*ab[1]), - magB = Math.sqrt(bc[0]*bc[0] + bc[1]*bc[1]), - angle = Math.acos(dot/(magA*magB)); - return angle < thresholdAngle; + // Note: this only updates layer.collideIndexes for tile indexes found currently in the layer + for (var ty = 0; ty < layer.height; ty++) + { + for (var tx = 0; tx < layer.width; tx++) + { + var tile = layer.data[ty][tx]; + + if (tile && indexes.indexOf(tile.index) === -1) + { + SetTileCollision(tile, collides); + SetLayerCollisionIndex(tile.index, collides, layer); + } + } } -} -function sqdist(a,b){ - var dx = b[0] - a[0]; - var dy = b[1] - a[1]; - return dx * dx + dy * dy; -} + if (recalculateFaces) + { + CalculateFacesWithin(0, 0, layer.width, layer.height, layer); + } +}; -/** - * Get a vertex at position i. It does not matter if i is out of bounds, this function will just cycle. - * @method at - * @param {Number} i - * @return {Array} - */ -function polygonAt(polygon, i){ - var s = polygon.length; - return polygon[i < 0 ? i % s + s : i % s]; -} +module.exports = SetCollisionByExclusion; -/** - * Clear the polygon data - * @method clear - * @return {Array} - */ -function polygonClear(polygon){ - polygon.length = 0; -} + +/***/ }), + +/***/ 4180: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * Append points "from" to "to"-1 from an other polygon "poly" onto this one. - * @method append - * @param {Polygon} poly The polygon to get points from. - * @param {Number} from The vertex index in "poly". - * @param {Number} to The end vertex index in "poly". Note that this vertex is NOT included when appending. - * @return {Array} + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -function polygonAppend(polygon, poly, from, to){ - for(var i=from; i v[br][0])) { - br = i; + for (var ty = 0; ty < layer.height; ty++) + { + for (var tx = 0; tx < layer.width; tx++) + { + var tile = layer.data[ty][tx]; + + if (!tile) { continue; } + + for (var property in properties) + { + if (!HasValue(tile.properties, property)) { continue; } + + var values = properties[property]; + + if (!Array.isArray(values)) + { + values = [ values ]; + } + + for (var i = 0; i < values.length; i++) + { + if (tile.properties[property] === values[i]) + { + SetTileCollision(tile, collides); + } + } + } } } - // reverse poly if clockwise - if (!isLeft(polygonAt(polygon, br - 1), polygonAt(polygon, br), polygonAt(polygon, br + 1))) { - polygonReverse(polygon); - return true; - } else { - return false; + if (recalculateFaces) + { + CalculateFacesWithin(0, 0, layer.width, layer.height, layer); } -} +}; -/** - * Reverse the vertices in the polygon - * @method reverse - */ -function polygonReverse(polygon){ - var tmp = []; - var N = polygon.length; - for(var i=0; i!==N; i++){ - tmp.push(polygon.pop()); - } - for(var i=0; i!==N; i++){ - polygon[i] = tmp[i]; - } -} +module.exports = SetCollisionByProperty; + + +/***/ }), + +/***/ 18625: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * Check if a point in the polygon is a reflex point - * @method isReflex - * @param {Number} i - * @return {Boolean} + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -function polygonIsReflex(polygon, i){ - return isRight(polygonAt(polygon, i - 1), polygonAt(polygon, i), polygonAt(polygon, i + 1)); -} -var tmpLine1=[], - tmpLine2=[]; +var SetTileCollision = __webpack_require__(68234); +var CalculateFacesWithin = __webpack_require__(60386); /** - * Check if two vertices in the polygon can see each other - * @method canSee - * @param {Number} a Vertex index 1 - * @param {Number} b Vertex index 2 - * @return {Boolean} + * Sets collision on the tiles within a layer by checking each tile's collision group data + * (typically defined in Tiled within the tileset collision editor). If any objects are found within + * a tile's collision group, the tile's colliding information will be set. The `collides` parameter + * controls if collision will be enabled (true) or disabled (false). + * + * @function Phaser.Tilemaps.Components.SetCollisionFromCollisionGroup + * @since 3.0.0 + * + * @param {boolean} collides - If true it will enable collision. If false it will clear collision. + * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ -function polygonCanSee(polygon, a,b) { - var p, dist, l1=tmpLine1, l2=tmpLine2; +var SetCollisionFromCollisionGroup = function (collides, recalculateFaces, layer) +{ + if (collides === undefined) { collides = true; } + if (recalculateFaces === undefined) { recalculateFaces = true; } - if (isLeftOn(polygonAt(polygon, a + 1), polygonAt(polygon, a), polygonAt(polygon, b)) && isRightOn(polygonAt(polygon, a - 1), polygonAt(polygon, a), polygonAt(polygon, b))) { - return false; - } - dist = sqdist(polygonAt(polygon, a), polygonAt(polygon, b)); - for (var i = 0; i !== polygon.length; ++i) { // for each edge - if ((i + 1) % polygon.length === a || i === a){ // ignore incident edges - continue; - } - if (isLeftOn(polygonAt(polygon, a), polygonAt(polygon, b), polygonAt(polygon, i + 1)) && isRightOn(polygonAt(polygon, a), polygonAt(polygon, b), polygonAt(polygon, i))) { // if diag intersects an edge - l1[0] = polygonAt(polygon, a); - l1[1] = polygonAt(polygon, b); - l2[0] = polygonAt(polygon, i); - l2[1] = polygonAt(polygon, i + 1); - p = lineInt(l1,l2); - if (sqdist(polygonAt(polygon, a), p) < dist) { // if edge is blocking visibility to b - return false; + for (var ty = 0; ty < layer.height; ty++) + { + for (var tx = 0; tx < layer.width; tx++) + { + var tile = layer.data[ty][tx]; + + if (!tile) { continue; } + + var collisionGroup = tile.getCollisionGroup(); + + // It's possible in Tiled to have a collision group without any shapes, e.g. create a + // shape and then delete the shape. + if (collisionGroup && collisionGroup.objects && collisionGroup.objects.length > 0) + { + SetTileCollision(tile, collides); } } } - return true; -} - -/** - * Check if two vertices in the polygon can see each other - * @method canSee2 - * @param {Number} a Vertex index 1 - * @param {Number} b Vertex index 2 - * @return {Boolean} - */ -function polygonCanSee2(polygon, a,b) { - // for each edge - for (var i = 0; i !== polygon.length; ++i) { - // ignore incident edges - if (i === a || i === b || (i + 1) % polygon.length === a || (i + 1) % polygon.length === b){ - continue; - } - if( lineSegmentsIntersect(polygonAt(polygon, a), polygonAt(polygon, b), polygonAt(polygon, i), polygonAt(polygon, i+1)) ){ - return false; - } + if (recalculateFaces) + { + CalculateFacesWithin(0, 0, layer.width, layer.height, layer); } - return true; -} +}; -/** - * Copy the polygon from vertex i to vertex j. - * @method copy - * @param {Number} i - * @param {Number} j - * @param {Polygon} [targetPoly] Optional target polygon to save in. - * @return {Polygon} The resulting copy. - */ -function polygonCopy(polygon, i,j,targetPoly){ - var p = targetPoly || []; - polygonClear(p); - if (i < j) { - // Insert all vertices from i to j - for(var k=i; k<=j; k++){ - p.push(polygon[k]); - } +module.exports = SetCollisionFromCollisionGroup; - } else { - // Insert vertices 0 to j - for(var k=0; k<=j; k++){ - p.push(polygon[k]); - } +/***/ }), - // Insert vertices i to end - for(var k=i; k { - return p; -} +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ /** - * Decomposes the polygon into convex pieces. Returns a list of edges [[p1,p2],[p2,p3],...] that cuts the polygon. - * Note that this algorithm has complexity O(N^4) and will be very slow for polygons with many vertices. - * @method getCutEdges - * @return {Array} + * Internally used method to keep track of the tile indexes that collide within a layer. This + * updates LayerData.collideIndexes to either contain or not contain the given `tileIndex`. + * + * @function Phaser.Tilemaps.Components.SetLayerCollisionIndex + * @since 3.0.0 + * + * @param {number} tileIndex - The tile index to set the collision boolean for. + * @param {boolean} collides - Should the tile index collide or not? + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ -function polygonGetCutEdges(polygon) { - var min=[], tmp1=[], tmp2=[], tmpPoly = []; - var nDiags = Number.MAX_VALUE; +var SetLayerCollisionIndex = function (tileIndex, collides, layer) +{ + var loc = layer.collideIndexes.indexOf(tileIndex); - for (var i = 0; i < polygon.length; ++i) { - if (polygonIsReflex(polygon, i)) { - for (var j = 0; j < polygon.length; ++j) { - if (polygonCanSee(polygon, i, j)) { - tmp1 = polygonGetCutEdges(polygonCopy(polygon, i, j, tmpPoly)); - tmp2 = polygonGetCutEdges(polygonCopy(polygon, j, i, tmpPoly)); + if (collides && loc === -1) + { + layer.collideIndexes.push(tileIndex); + } + else if (!collides && loc !== -1) + { + layer.collideIndexes.splice(loc, 1); + } +}; - for(var k=0; k { /** - * Decomposes the polygon into one or more convex sub-Polygons. - * @method decomp - * @return {Array} An array or Polygon objects. + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -function polygonDecomp(polygon){ - var edges = polygonGetCutEdges(polygon); - if(edges.length > 0){ - return polygonSlice(polygon, edges); - } else { - return [polygon]; - } -} /** - * Slices the polygon given one or more cut edges. If given one, this function will return two polygons (false on failure). If many, an array of polygons. - * @method slice - * @param {Array} cutEdges A list of edges, as returned by .getCutEdges() - * @return {Array} + * Internally used method to set the colliding state of a tile. This does not recalculate + * interesting faces. + * + * @function Phaser.Tilemaps.Components.SetTileCollision + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.Tile} tile - The Tile to set the collision on. + * @param {boolean} [collides=true] - Should the tile index collide or not? */ -function polygonSlice(polygon, cutEdges){ - if(cutEdges.length === 0){ - return [polygon]; +var SetTileCollision = function (tile, collides) +{ + if (collides) + { + tile.setCollision(true, true, true, true, false); } - if(cutEdges instanceof Array && cutEdges.length && cutEdges[0] instanceof Array && cutEdges[0].length===2 && cutEdges[0][0] instanceof Array){ + else + { + tile.resetCollision(false); + } +}; - var polys = [polygon]; +module.exports = SetTileCollision; - for(var i=0; i { - if(i !== -1 && j !== -1){ - return [polygonCopy(polygon, i,j), - polygonCopy(polygon, j,i)]; - } else { - return false; - } - } -} +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ /** - * Checks that the line segments of this polygon do not intersect each other. - * @method isSimple - * @param {Array} path An array of vertices e.g. [[0,0],[0,1],...] - * @return {Boolean} - * @todo Should it check all segments with all others? + * Sets a global collision callback for the given tile index within the layer. This will affect all + * tiles on this layer that have the same index. If a callback is already set for the tile index it + * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile + * at a specific location on the map then see setTileLocationCallback. + * + * @function Phaser.Tilemaps.Components.SetTileIndexCallback + * @since 3.0.0 + * + * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. + * @param {function} callback - The callback that will be invoked when the tile is collided with. + * @param {object} callbackContext - The context under which the callback is called. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ -function polygonIsSimple(polygon){ - var path = polygon, i; - // Check - for(i=0; i { /** - * Quickly decompose the Polygon into convex sub-polygons. - * @method quickDecomp - * @param {Array} result - * @param {Array} [reflexVertices] - * @param {Array} [steinerPoints] - * @param {Number} [delta] - * @param {Number} [maxlevel] - * @param {Number} [level] - * @return {Array} + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -function polygonQuickDecomp(polygon, result,reflexVertices,steinerPoints,delta,maxlevel,level){ - maxlevel = maxlevel || 100; - level = level || 0; - delta = delta || 25; - result = typeof(result)!=="undefined" ? result : []; - reflexVertices = reflexVertices || []; - steinerPoints = steinerPoints || []; - var upperInt=[0,0], lowerInt=[0,0], p=[0,0]; // Points - var upperDist=0, lowerDist=0, d=0, closestDist=0; // scalars - var upperIndex=0, lowerIndex=0, closestIndex=0; // Integers - var lowerPoly=[], upperPoly=[]; // polygons - var poly = polygon, - v = polygon; +var GetTilesWithin = __webpack_require__(50811); - if(v.length < 3){ - return result; - } +/** + * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. + * If a callback is already set for the tile index it will be replaced. Set the callback to null to + * remove it. + * + * @function Phaser.Tilemaps.Components.SetTileLocationCallback + * @since 3.0.0 + * + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {function} callback - The callback that will be invoked when the tile is collided with. + * @param {object} callbackContext - The context under which the callback is called. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var SetTileLocationCallback = function (tileX, tileY, width, height, callback, callbackContext, layer) +{ + var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); - level++; - if(level > maxlevel){ - console.warn("quickDecomp: max level ("+maxlevel+") reached."); - return result; + for (var i = 0; i < tiles.length; i++) + { + tiles[i].setCollisionCallback(callback, callbackContext); } +}; - for (var i = 0; i < polygon.length; ++i) { - if (polygonIsReflex(poly, i)) { - reflexVertices.push(poly[i]); - upperDist = lowerDist = Number.MAX_VALUE; - +module.exports = SetTileLocationCallback; - for (var j = 0; j < polygon.length; ++j) { - if (isLeft(polygonAt(poly, i - 1), polygonAt(poly, i), polygonAt(poly, j)) && isRightOn(polygonAt(poly, i - 1), polygonAt(poly, i), polygonAt(poly, j - 1))) { // if line intersects with an edge - p = getIntersectionPoint(polygonAt(poly, i - 1), polygonAt(poly, i), polygonAt(poly, j), polygonAt(poly, j - 1)); // find the point of intersection - if (isRight(polygonAt(poly, i + 1), polygonAt(poly, i), p)) { // make sure it's inside the poly - d = sqdist(poly[i], p); - if (d < lowerDist) { // keep only the closest intersection - lowerDist = d; - lowerInt = p; - lowerIndex = j; - } - } - } - if (isLeft(polygonAt(poly, i + 1), polygonAt(poly, i), polygonAt(poly, j + 1)) && isRightOn(polygonAt(poly, i + 1), polygonAt(poly, i), polygonAt(poly, j))) { - p = getIntersectionPoint(polygonAt(poly, i + 1), polygonAt(poly, i), polygonAt(poly, j), polygonAt(poly, j + 1)); - if (isLeft(polygonAt(poly, i - 1), polygonAt(poly, i), p)) { - d = sqdist(poly[i], p); - if (d < upperDist) { - upperDist = d; - upperInt = p; - upperIndex = j; - } - } - } - } - // if there are no vertices to connect to, choose a point in the middle - if (lowerIndex === (upperIndex + 1) % polygon.length) { - //console.log("Case 1: Vertex("+i+"), lowerIndex("+lowerIndex+"), upperIndex("+upperIndex+"), poly.size("+polygon.length+")"); - p[0] = (lowerInt[0] + upperInt[0]) / 2; - p[1] = (lowerInt[1] + upperInt[1]) / 2; - steinerPoints.push(p); +/***/ }), - if (i < upperIndex) { - //lowerPoly.insert(lowerPoly.end(), poly.begin() + i, poly.begin() + upperIndex + 1); - polygonAppend(lowerPoly, poly, i, upperIndex+1); - lowerPoly.push(p); - upperPoly.push(p); - if (lowerIndex !== 0){ - //upperPoly.insert(upperPoly.end(), poly.begin() + lowerIndex, poly.end()); - polygonAppend(upperPoly, poly,lowerIndex,poly.length); - } - //upperPoly.insert(upperPoly.end(), poly.begin(), poly.begin() + i + 1); - polygonAppend(upperPoly, poly,0,i+1); - } else { - if (i !== 0){ - //lowerPoly.insert(lowerPoly.end(), poly.begin() + i, poly.end()); - polygonAppend(lowerPoly, poly,i,poly.length); - } - //lowerPoly.insert(lowerPoly.end(), poly.begin(), poly.begin() + upperIndex + 1); - polygonAppend(lowerPoly, poly,0,upperIndex+1); - lowerPoly.push(p); - upperPoly.push(p); - //upperPoly.insert(upperPoly.end(), poly.begin() + lowerIndex, poly.begin() + i + 1); - polygonAppend(upperPoly, poly,lowerIndex,i+1); - } - } else { - // connect to the closest point within the triangle - //console.log("Case 2: Vertex("+i+"), closestIndex("+closestIndex+"), poly.size("+polygon.length+")\n"); +/***/ 34397: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (lowerIndex > upperIndex) { - upperIndex += polygon.length; - } - closestDist = Number.MAX_VALUE; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if(upperIndex < lowerIndex){ - return result; - } +var GetTilesWithin = __webpack_require__(50811); +var ShuffleArray = __webpack_require__(18592); - for (var j = lowerIndex; j <= upperIndex; ++j) { - if ( - isLeftOn(polygonAt(poly, i - 1), polygonAt(poly, i), polygonAt(poly, j)) && - isRightOn(polygonAt(poly, i + 1), polygonAt(poly, i), polygonAt(poly, j)) - ) { - d = sqdist(polygonAt(poly, i), polygonAt(poly, j)); - if (d < closestDist && polygonCanSee2(poly, i, j)) { - closestDist = d; - closestIndex = j % polygon.length; - } - } - } +/** + * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given + * layer. It will only randomize the tiles in that area, so if they're all the same nothing will + * appear to have changed! This method only modifies tile indexes and does not change collision + * information. + * + * @function Phaser.Tilemaps.Components.Shuffle + * @since 3.0.0 + * + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var Shuffle = function (tileX, tileY, width, height, layer) +{ + var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); - if (i < closestIndex) { - polygonAppend(lowerPoly, poly,i,closestIndex+1); - if (closestIndex !== 0){ - polygonAppend(upperPoly, poly,closestIndex,v.length); - } - polygonAppend(upperPoly, poly,0,i+1); - } else { - if (i !== 0){ - polygonAppend(lowerPoly, poly,i,v.length); - } - polygonAppend(lowerPoly, poly,0,closestIndex+1); - polygonAppend(upperPoly, poly,closestIndex,i+1); - } - } + var indexes = tiles.map(function (tile) { return tile.index; }); - // solve smallest poly first - if (lowerPoly.length < upperPoly.length) { - polygonQuickDecomp(lowerPoly,result,reflexVertices,steinerPoints,delta,maxlevel,level); - polygonQuickDecomp(upperPoly,result,reflexVertices,steinerPoints,delta,maxlevel,level); - } else { - polygonQuickDecomp(upperPoly,result,reflexVertices,steinerPoints,delta,maxlevel,level); - polygonQuickDecomp(lowerPoly,result,reflexVertices,steinerPoints,delta,maxlevel,level); - } + ShuffleArray(indexes); - return result; - } + for (var i = 0; i < tiles.length; i++) + { + tiles[i].index = indexes[i]; } - result.push(polygon); +}; - return result; -} +module.exports = Shuffle; -/** - * Remove collinear points in the polygon. - * @method removeCollinearPoints - * @param {Number} [precision] The threshold angle to use when determining whether two edges are collinear. Use zero for finest precision. - * @return {Number} The number of points removed - */ -function polygonRemoveCollinearPoints(polygon, precision){ - var num = 0; - for(var i=polygon.length-1; polygon.length>3 && i>=0; --i){ - if(collinear(polygonAt(polygon, i-1),polygonAt(polygon, i),polygonAt(polygon, i+1),precision)){ - // Remove the middle point - polygon.splice(i%polygon.length,1); - num++; - } - } - return num; -} -/** - * Remove duplicate points in the polygon. - * @method removeDuplicatePoints - * @param {Number} [precision] The threshold to use when determining whether two points are the same. Use zero for best precision. - */ -function polygonRemoveDuplicatePoints(polygon, precision){ - for(var i=polygon.length-1; i>=1; --i){ - var pi = polygon[i]; - for(var j=i-1; j>=0; --j){ - if(points_eq(pi, polygon[j], precision)){ - polygon.splice(i,1); - continue; - } - } - } -} +/***/ }), + +/***/ 53945: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * Check if two scalars are equal - * @static - * @method eq - * @param {Number} a - * @param {Number} b - * @param {Number} [precision] - * @return {Boolean} + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -function scalar_eq(a,b,precision){ - precision = precision || 0; - return Math.abs(a-b) <= precision; -} + +var SnapCeil = __webpack_require__(82127); +var SnapFloor = __webpack_require__(84314); /** - * Check if two points are equal - * @static - * @method points_eq - * @param {Array} a - * @param {Array} b - * @param {Number} [precision] - * @return {Boolean} + * Returns the bounds in the given layer that are within the camera's viewport. + * This is used internally by the cull tiles function. + * + * @function Phaser.Tilemaps.Components.StaggeredCullBounds + * @since 3.50.0 + * + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * + * @return {object} An object containing the `left`, `right`, `top` and `bottom` bounds. */ -function points_eq(a,b,precision){ - return scalar_eq(a[0],b[0],precision) && scalar_eq(a[1],b[1],precision); -} +var StaggeredCullBounds = function (layer, camera) +{ + var tilemap = layer.tilemapLayer.tilemap; + var tilemapLayer = layer.tilemapLayer; + + // We need to use the tile sizes defined for the map as a whole, not the layer, + // in order to calculate the bounds correctly. As different sized tiles may be + // placed on the grid and we cannot trust layer.baseTileWidth to give us the true size. + var tileW = Math.floor(tilemap.tileWidth * tilemapLayer.scaleX); + var tileH = Math.floor(tilemap.tileHeight * tilemapLayer.scaleY); + + var boundsLeft = SnapFloor(camera.worldView.x - tilemapLayer.x, tileW, 0, true) - tilemapLayer.cullPaddingX; + var boundsRight = SnapCeil(camera.worldView.right - tilemapLayer.x, tileW, 0, true) + tilemapLayer.cullPaddingX; + + var boundsTop = SnapFloor(camera.worldView.y - tilemapLayer.y, tileH / 2, 0, true) - tilemapLayer.cullPaddingY; + var boundsBottom = SnapCeil(camera.worldView.bottom - tilemapLayer.y, tileH / 2, 0, true) + tilemapLayer.cullPaddingY; + + return { + left: boundsLeft, + right: boundsRight, + top: boundsTop, + bottom: boundsBottom + }; +}; + +module.exports = StaggeredCullBounds; /***/ }), -/* 1394 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 19242: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bodies = __webpack_require__(86); -var Class = __webpack_require__(0); -var Composites = __webpack_require__(591); -var Constraint = __webpack_require__(128); -var Svg = __webpack_require__(592); -var MatterGameObject = __webpack_require__(1395); -var MatterImage = __webpack_require__(1396); -var MatterSprite = __webpack_require__(1397); -var MatterTileBody = __webpack_require__(593); -var PhysicsEditorParser = __webpack_require__(589); -var PhysicsJSONParser = __webpack_require__(590); -var PointerConstraint = __webpack_require__(1398); -var Vertices = __webpack_require__(64); +var CullBounds = __webpack_require__(53945); +var RunCull = __webpack_require__(6987); /** - * @classdesc - * The Matter Factory is responsible for quickly creating a variety of different types of - * bodies, constraints and Game Objects and adding them into the physics world. - * - * You access the factory from within a Scene using `add`: - * - * ```javascript - * this.matter.add.rectangle(x, y, width, height); - * ``` + * Returns the tiles in the given layer that are within the cameras viewport. This is used internally. * - * Use of the Factory is optional. All of the objects it creates can also be created - * directly via your own code or constructors. It is provided as a means to keep your - * code concise. + * @function Phaser.Tilemaps.Components.StaggeredCullTiles + * @since 3.50.0 * - * @class Factory - * @memberof Phaser.Physics.Matter - * @constructor - * @since 3.0.0 + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to run the cull check against. + * @param {array} [outputArray] - An optional array to store the Tile objects within. + * @param {number} [renderOrder=0] - The rendering order constant. * - * @param {Phaser.Physics.Matter.World} world - The Matter World which this Factory adds to. + * @return {Phaser.Tilemaps.Tile[]} An array of Tile objects. */ -var Factory = new Class({ - - initialize: +var StaggeredCullTiles = function (layer, camera, outputArray, renderOrder) +{ + if (outputArray === undefined) { outputArray = []; } + if (renderOrder === undefined) { renderOrder = 0; } - function Factory (world) - { - /** - * The Matter World which this Factory adds to. - * - * @name Phaser.Physics.Matter.Factory#world - * @type {Phaser.Physics.Matter.World} - * @since 3.0.0 - */ - this.world = world; + outputArray.length = 0; - /** - * The Scene which this Factory's Matter World belongs to. - * - * @name Phaser.Physics.Matter.Factory#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = world.scene; + var tilemapLayer = layer.tilemapLayer; - /** - * A reference to the Scene.Systems this Matter Physics instance belongs to. - * - * @name Phaser.Physics.Matter.Factory#sys - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.sys = world.scene.sys; - }, + // Camera world view bounds, snapped for scaled tile size + // Cull Padding values are given in tiles, not pixels - /** - * Creates a new rigid rectangular Body and adds it to the World. - * - * @method Phaser.Physics.Matter.Factory#rectangle - * @since 3.0.0 - * - * @param {number} x - The X coordinate of the center of the Body. - * @param {number} y - The Y coordinate of the center of the Body. - * @param {number} width - The width of the Body. - * @param {number} height - The height of the Body. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {MatterJS.BodyType} A Matter JS Body. - */ - rectangle: function (x, y, width, height, options) + var bounds = CullBounds(layer, camera); + + if (tilemapLayer.skipCull && tilemapLayer.scrollFactorX === 1 && tilemapLayer.scrollFactorY === 1) { - var body = Bodies.rectangle(x, y, width, height, options); + bounds.left = 0; + bounds.right = layer.width; + bounds.top = 0; + bounds.bottom = layer.height; + } - this.world.add(body); + RunCull(layer, bounds, renderOrder, outputArray); - return body; - }, + return outputArray; +}; - /** - * Creates a new rigid trapezoidal Body and adds it to the World. - * - * @method Phaser.Physics.Matter.Factory#trapezoid - * @since 3.0.0 - * - * @param {number} x - The X coordinate of the center of the Body. - * @param {number} y - The Y coordinate of the center of the Body. - * @param {number} width - The width of the trapezoid Body. - * @param {number} height - The height of the trapezoid Body. - * @param {number} slope - The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {MatterJS.BodyType} A Matter JS Body. - */ - trapezoid: function (x, y, width, height, slope, options) - { - var body = Bodies.trapezoid(x, y, width, height, slope, options); +module.exports = StaggeredCullTiles; - this.world.add(body); - return body; - }, +/***/ }), - /** - * Creates a new rigid circular Body and adds it to the World. - * - * @method Phaser.Physics.Matter.Factory#circle - * @since 3.0.0 - * - * @param {number} x - The X coordinate of the center of the Body. - * @param {number} y - The Y coordinate of the center of the Body. - * @param {number} radius - The radius of the circle. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * @param {number} [maxSides] - The maximum amount of sides to use for the polygon which will approximate this circle. - * - * @return {MatterJS.BodyType} A Matter JS Body. - */ - circle: function (x, y, radius, options, maxSides) - { - var body = Bodies.circle(x, y, radius, options, maxSides); +/***/ 33388: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.world.add(body); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return body; - }, +var Vector2 = __webpack_require__(93736); - /** - * Creates a new rigid polygonal Body and adds it to the World. - * - * @method Phaser.Physics.Matter.Factory#polygon - * @since 3.0.0 - * - * @param {number} x - The X coordinate of the center of the Body. - * @param {number} y - The Y coordinate of the center of the Body. - * @param {number} sides - The number of sides the polygon will have. - * @param {number} radius - The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {MatterJS.BodyType} A Matter JS Body. - */ - polygon: function (x, y, sides, radius, options) - { - var body = Bodies.polygon(x, y, sides, radius, options); +/** + * Converts from staggered tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.StaggeredTileToWorldXY + * @since 3.50.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in world coordinates. + */ +var StaggeredTileToWorldXY = function (tileX, tileY, point, camera, layer) +{ + if (!point) { point = new Vector2(); } - this.world.add(body); + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; - return body; - }, + var layerWorldX = 0; + var layerWorldY = 0; - /** - * Creates a body using the supplied vertices (or an array containing multiple sets of vertices) and adds it to the World. - * If the vertices are convex, they will pass through as supplied. Otherwise, if the vertices are concave, they will be decomposed. Note that this process is not guaranteed to support complex sets of vertices, e.g. ones with holes. - * - * @method Phaser.Physics.Matter.Factory#fromVertices - * @since 3.0.0 - * - * @param {number} x - The X coordinate of the center of the Body. - * @param {number} y - The Y coordinate of the center of the Body. - * @param {(string|array)} vertexSets - The vertices data. Either a path string or an array of vertices. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * @param {boolean} [flagInternal=false] - Flag internal edges (coincident part edges) - * @param {number} [removeCollinear=0.01] - Whether Matter.js will discard collinear edges (to improve performance). - * @param {number} [minimumArea=10] - During decomposition discard parts that have an area less than this. - * - * @return {MatterJS.BodyType} A Matter JS Body. - */ - fromVertices: function (x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea) + if (tilemapLayer) { - if (typeof vertexSets === 'string') - { - vertexSets = Vertices.fromPath(vertexSets); - } + if (!camera) { camera = tilemapLayer.scene.cameras.main; } - var body = Bodies.fromVertices(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea); + layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); - this.world.add(body); + tileWidth *= tilemapLayer.scaleX; - return body; - }, + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - /** - * Creates a body using data exported from the application PhysicsEditor (https://www.codeandweb.com/physicseditor) - * - * The PhysicsEditor file should be loaded as JSON: - * - * ```javascript - * preload () - * { - * this.load.json('vehicles', 'assets/vehicles.json); - * } - * - * create () - * { - * const vehicleShapes = this.cache.json.get('vehicles'); - * this.matter.add.fromPhysicsEditor(400, 300, vehicleShapes.truck); - * } - * ``` - * - * Do not pass the entire JSON file to this method, but instead pass one of the shapes contained within it. - * - * If you pas in an `options` object, any settings in there will override those in the PhysicsEditor config object. - * - * @method Phaser.Physics.Matter.Factory#fromPhysicsEditor - * @since 3.22.0 - * - * @param {number} x - The horizontal world location of the body. - * @param {number} y - The vertical world location of the body. - * @param {any} config - The JSON data exported from PhysicsEditor. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * @param {boolean} [addToWorld=true] - Should the newly created body be immediately added to the World? - * - * @return {MatterJS.BodyType} A Matter JS Body. - */ - fromPhysicsEditor: function (x, y, config, options, addToWorld) - { - if (addToWorld === undefined) { addToWorld = true; } + tileHeight *= tilemapLayer.scaleY; + } - var body = PhysicsEditorParser.parseBody(x, y, config, options); + var x = layerWorldX + tileX * tileWidth + tileY % 2 * (tileWidth / 2); + var y = layerWorldY + tileY * (tileHeight / 2); - if (addToWorld && !this.world.has(body)) - { - this.world.add(body); - } + return point.set(x, y); +}; - return body; - }, +module.exports = StaggeredTileToWorldXY; - /** - * Creates a body using the path data from an SVG file. - * - * SVG Parsing requires the pathseg polyfill from https://github.com/progers/pathseg - * - * The SVG file should be loaded as XML, as this method requires the ability to extract - * the path data from it. I.e.: - * - * ```javascript - * preload () - * { - * this.load.xml('face', 'assets/face.svg); - * } - * - * create () - * { - * this.matter.add.fromSVG(400, 300, this.cache.xml.get('face')); - * } - * ``` - * - * @method Phaser.Physics.Matter.Factory#fromSVG - * @since 3.22.0 - * - * @param {number} x - The X coordinate of the body. - * @param {number} y - The Y coordinate of the body. - * @param {object} xml - The SVG Path data. - * @param {number} [scale=1] - Scale the vertices by this amount after creation. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * @param {boolean} [addToWorld=true] - Should the newly created body be immediately added to the World? - * - * @return {MatterJS.BodyType} A Matter JS Body. - */ - fromSVG: function (x, y, xml, scale, options, addToWorld) + +/***/ }), + +/***/ 84132: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Converts from staggered tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the + * layers position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.StaggeredTileToWorldY + * @since 3.50.0 + * + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in world coordinates. + */ +var StaggeredTileToWorldY = function (tileY, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + var layerWorldY = 0; + + if (tilemapLayer) { - if (scale === undefined) { scale = 1; } - if (options === undefined) { options = {}; } - if (addToWorld === undefined) { addToWorld = true; } + if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; } - var path = xml.getElementsByTagName('path'); - var vertexSets = []; + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - for (var i = 0; i < path.length; i++) - { - var points = Svg.pathToVertices(path[i], 30); + tileHeight *= tilemapLayer.scaleY; + } - if (scale !== 1) - { - Vertices.scale(points, scale, scale); - } + return layerWorldY + tileY * (tileHeight / 2) + tileHeight; +}; - vertexSets.push(points); - } +module.exports = StaggeredTileToWorldY; - var body = Bodies.fromVertices(x, y, vertexSets, options); - if (addToWorld) - { - this.world.add(body); - } +/***/ }), - return body; - }, +/***/ 90562: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Creates a body using the supplied physics data, as provided by a JSON file. - * - * The data file should be loaded as JSON: - * - * ```javascript - * preload () - * { - * this.load.json('ninjas', 'assets/ninjas.json); - * } - * - * create () - * { - * const ninjaShapes = this.cache.json.get('ninjas'); - * - * this.matter.add.fromJSON(400, 300, ninjaShapes.shinobi); - * } - * ``` - * - * Do not pass the entire JSON file to this method, but instead pass one of the shapes contained within it. - * - * If you pas in an `options` object, any settings in there will override those in the config object. - * - * The structure of the JSON file is as follows: - * - * ```text - * { - * 'generator_info': // The name of the application that created the JSON data - * 'shapeName': { - * 'type': // The type of body - * 'label': // Optional body label - * 'vertices': // An array, or an array of arrays, containing the vertex data in x/y object pairs - * } - * } - * ``` - * - * At the time of writing, only the Phaser Physics Tracer App exports in this format. - * - * @method Phaser.Physics.Matter.Factory#fromJSON - * @since 3.22.0 - * - * @param {number} x - The X coordinate of the body. - * @param {number} y - The Y coordinate of the body. - * @param {any} config - The JSON physics data. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * @param {boolean} [addToWorld=true] - Should the newly created body be immediately added to the World? - * - * @return {MatterJS.BodyType} A Matter JS Body. - */ - fromJSON: function (x, y, config, options, addToWorld) - { - if (options === undefined) { options = {}; } - if (addToWorld === undefined) { addToWorld = true; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var body = PhysicsJSONParser.parseBody(x, y, config, options); +var Vector2 = __webpack_require__(93736); - if (body && addToWorld) - { - this.world.add(body); - } +/** + * Converts from world XY coordinates (pixels) to staggered tile XY coordinates (tile units), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.StaggeredWorldToTileXY + * @since 3.50.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in tile units. + */ +var StaggeredWorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +{ + if (!point) { point = new Vector2(); } - return body; - }, + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; - /** - * Create a new composite containing Matter Image objects created in a grid arrangement. - * This function uses the body bounds to prevent overlaps. - * - * @method Phaser.Physics.Matter.Factory#imageStack - * @since 3.0.0 - * - * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} frame - An optional frame from the Texture this Game Object is rendering with. Set to `null` to skip this value. - * @param {number} x - The horizontal position of this composite in the world. - * @param {number} y - The vertical position of this composite in the world. - * @param {number} columns - The number of columns in the grid. - * @param {number} rows - The number of rows in the grid. - * @param {number} [columnGap=0] - The distance between each column. - * @param {number} [rowGap=0] - The distance between each row. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {MatterJS.CompositeType} A Matter JS Composite Stack. - */ - imageStack: function (key, frame, x, y, columns, rows, columnGap, rowGap, options) + if (tilemapLayer) { - if (columnGap === undefined) { columnGap = 0; } - if (rowGap === undefined) { rowGap = 0; } - if (options === undefined) { options = {}; } + if (!camera) { camera = tilemapLayer.scene.cameras.main; } - var world = this.world; - var displayList = this.sys.displayList; + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll - options.addToWorld = false; + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - var stack = Composites.stack(x, y, columns, rows, columnGap, rowGap, function (x, y) - { - var image = new MatterImage(world, x, y, key, frame, options); + tileHeight *= tilemapLayer.scaleY; - displayList.add(image); + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's horizontal scroll - return image.body; - }); + worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); - world.add(stack); + tileWidth *= tilemapLayer.scaleX; + } - return stack; - }, + var y = (snapToFloor) ? Math.floor((worldY / (tileHeight / 2))) : (worldY / (tileHeight / 2)); + var x = (snapToFloor) ? Math.floor((worldX + (y % 2) * 0.5 * tileWidth) / tileWidth) : (worldX + (y % 2) * 0.5 * tileWidth) / tileWidth; - /** - * Create a new composite containing bodies created in the callback in a grid arrangement. - * - * This function uses the body bounds to prevent overlaps. - * - * @method Phaser.Physics.Matter.Factory#stack - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this composite in the world. - * @param {number} y - The vertical position of this composite in the world. - * @param {number} columns - The number of columns in the grid. - * @param {number} rows - The number of rows in the grid. - * @param {number} columnGap - The distance between each column. - * @param {number} rowGap - The distance between each row. - * @param {function} callback - The callback that creates the stack. - * - * @return {MatterJS.CompositeType} A new composite containing objects created in the callback. - */ - stack: function (x, y, columns, rows, columnGap, rowGap, callback) - { - var stack = Composites.stack(x, y, columns, rows, columnGap, rowGap, callback); + return point.set(x, y); +}; - this.world.add(stack); +module.exports = StaggeredWorldToTileXY; - return stack; - }, - /** - * Create a new composite containing bodies created in the callback in a pyramid arrangement. - * This function uses the body bounds to prevent overlaps. - * - * @method Phaser.Physics.Matter.Factory#pyramid - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this composite in the world. - * @param {number} y - The vertical position of this composite in the world. - * @param {number} columns - The number of columns in the pyramid. - * @param {number} rows - The number of rows in the pyramid. - * @param {number} columnGap - The distance between each column. - * @param {number} rowGap - The distance between each row. - * @param {function} callback - The callback function to be invoked. - * - * @return {MatterJS.CompositeType} A Matter JS Composite pyramid. - */ - pyramid: function (x, y, columns, rows, columnGap, rowGap, callback) - { - var stack = Composites.pyramid(x, y, columns, rows, columnGap, rowGap, callback); +/***/ }), - this.world.add(stack); +/***/ 3689: +/***/ ((module) => { - return stack; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Chains all bodies in the given composite together using constraints. - * - * @method Phaser.Physics.Matter.Factory#chain - * @since 3.0.0 - * - * @param {MatterJS.CompositeType} composite - The composite in which all bodies will be chained together sequentially. - * @param {number} xOffsetA - The horizontal offset of the BodyA constraint. This is a percentage based on the body size, not a world position. - * @param {number} yOffsetA - The vertical offset of the BodyA constraint. This is a percentage based on the body size, not a world position. - * @param {number} xOffsetB - The horizontal offset of the BodyB constraint. This is a percentage based on the body size, not a world position. - * @param {number} yOffsetB - The vertical offset of the BodyB constraint. This is a percentage based on the body size, not a world position. - * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. - * - * @return {MatterJS.CompositeType} The original composite that was passed to this method. - */ - chain: function (composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options) - { - return Composites.chain(composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options); - }, +/** + * Converts from world Y coordinates (pixels) to staggered tile Y coordinates (tile units), factoring in the + * layers position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.StaggeredWorldToTileY + * @since 3.50.0 + * + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in tile units. + */ +var StaggeredWorldToTileY = function (worldY, snapToFloor, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; - /** - * Connects bodies in the composite with constraints in a grid pattern, with optional cross braces. - * - * @method Phaser.Physics.Matter.Factory#mesh - * @since 3.0.0 - * - * @param {MatterJS.CompositeType} composite - The composite in which all bodies will be chained together. - * @param {number} columns - The number of columns in the mesh. - * @param {number} rows - The number of rows in the mesh. - * @param {boolean} crossBrace - Create cross braces for the mesh as well? - * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. - * - * @return {MatterJS.CompositeType} The original composite that was passed to this method. - */ - mesh: function (composite, columns, rows, crossBrace, options) + if (tilemapLayer) { - return Composites.mesh(composite, columns, rows, crossBrace, options); - }, + if (!camera) { camera = tilemapLayer.scene.cameras.main; } - /** - * Creates a composite with a Newton's Cradle setup of bodies and constraints. - * - * @method Phaser.Physics.Matter.Factory#newtonsCradle - * @since 3.0.0 - * - * @param {number} x - The horizontal position of the start of the cradle. - * @param {number} y - The vertical position of the start of the cradle. - * @param {number} number - The number of balls in the cradle. - * @param {number} size - The radius of each ball in the cradle. - * @param {number} length - The length of the 'string' the balls hang from. - * - * @return {MatterJS.CompositeType} A Newton's cradle composite. - */ - newtonsCradle: function (x, y, number, size, length) - { - var composite = Composites.newtonsCradle(x, y, number, size, length); + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's vertical scroll - this.world.add(composite); + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - return composite; - }, + tileHeight *= tilemapLayer.scaleY; + } - /** - * Creates a composite with simple car setup of bodies and constraints. - * - * @method Phaser.Physics.Matter.Factory#car - * @since 3.0.0 - * - * @param {number} x - The horizontal position of the car in the world. - * @param {number} y - The vertical position of the car in the world. - * @param {number} width - The width of the car chasis. - * @param {number} height - The height of the car chasis. - * @param {number} wheelSize - The radius of the car wheels. - * - * @return {MatterJS.CompositeType} A new composite car body. - */ - car: function (x, y, width, height, wheelSize) - { - var composite = Composites.car(x, y, width, height, wheelSize); + return (snapToFloor) ? Math.floor(worldY / (tileHeight / 2)) : worldY / (tileHeight / 2); +}; - this.world.add(composite); +module.exports = StaggeredWorldToTileY; - return composite; - }, - /** - * Creates a simple soft body like object. - * - * @method Phaser.Physics.Matter.Factory#softBody - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this composite in the world. - * @param {number} y - The vertical position of this composite in the world. - * @param {number} columns - The number of columns in the Composite. - * @param {number} rows - The number of rows in the Composite. - * @param {number} columnGap - The distance between each column. - * @param {number} rowGap - The distance between each row. - * @param {boolean} crossBrace - `true` to create cross braces between the bodies, or `false` to create just straight braces. - * @param {number} particleRadius - The radius of this circlular composite. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [particleOptions] - An optional Body configuration object that is used to set initial Body properties on creation. - * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [constraintOptions] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. - * - * @return {MatterJS.CompositeType} A new composite simple soft body. - */ - softBody: function (x, y, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions) - { - var composite = Composites.softBody(x, y, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions); +/***/ }), - this.world.add(composite); +/***/ 55217: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return composite; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * This method is an alias for `Factory.constraint`. - * - * Constraints (or joints) are used for specifying that a fixed distance must be maintained - * between two bodies, or a body and a fixed world-space position. - * - * The stiffness of constraints can be modified to create springs or elastic. - * - * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` - * value (e.g. `0.7` or above). - * - * If the constraint is unstable, try lowering the `stiffness` value and / or increasing - * `constraintIterations` within the Matter Config. - * - * For compound bodies, constraints must be applied to the parent body and not one of its parts. - * - * @method Phaser.Physics.Matter.Factory#joint - * @since 3.0.0 - * - * @param {MatterJS.BodyType} bodyA - The first possible `Body` that this constraint is attached to. - * @param {MatterJS.BodyType} bodyB - The second possible `Body` that this constraint is attached to. - * @param {number} [length] - A Number that specifies the target resting length of the constraint. If not given it is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. - * @param {number} [stiffness=1] - A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts as a soft spring. - * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. - * - * @return {MatterJS.ConstraintType} A Matter JS Constraint. - */ - joint: function (bodyA, bodyB, length, stiffness, options) - { - return this.constraint(bodyA, bodyB, length, stiffness, options); - }, +var GetTilesWithin = __webpack_require__(50811); - /** - * This method is an alias for `Factory.constraint`. - * - * Constraints (or joints) are used for specifying that a fixed distance must be maintained - * between two bodies, or a body and a fixed world-space position. - * - * The stiffness of constraints can be modified to create springs or elastic. - * - * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` - * value (e.g. `0.7` or above). - * - * If the constraint is unstable, try lowering the `stiffness` value and / or increasing - * `constraintIterations` within the Matter Config. - * - * For compound bodies, constraints must be applied to the parent body and not one of its parts. - * - * @method Phaser.Physics.Matter.Factory#spring - * @since 3.0.0 - * - * @param {MatterJS.BodyType} bodyA - The first possible `Body` that this constraint is attached to. - * @param {MatterJS.BodyType} bodyB - The second possible `Body` that this constraint is attached to. - * @param {number} [length] - A Number that specifies the target resting length of the constraint. If not given it is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. - * @param {number} [stiffness=1] - A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts as a soft spring. - * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. - * - * @return {MatterJS.ConstraintType} A Matter JS Constraint. - */ - spring: function (bodyA, bodyB, length, stiffness, options) - { - return this.constraint(bodyA, bodyB, length, stiffness, options); - }, +/** + * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching + * `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision + * information. + * + * @function Phaser.Tilemaps.Components.SwapByIndex + * @since 3.0.0 + * + * @param {number} tileA - First tile index. + * @param {number} tileB - Second tile index. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + */ +var SwapByIndex = function (indexA, indexB, tileX, tileY, width, height, layer) +{ + var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); - /** - * Constraints (or joints) are used for specifying that a fixed distance must be maintained - * between two bodies, or a body and a fixed world-space position. - * - * The stiffness of constraints can be modified to create springs or elastic. - * - * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` - * value (e.g. `0.7` or above). - * - * If the constraint is unstable, try lowering the `stiffness` value and / or increasing - * `constraintIterations` within the Matter Config. - * - * For compound bodies, constraints must be applied to the parent body and not one of its parts. - * - * @method Phaser.Physics.Matter.Factory#constraint - * @since 3.0.0 - * - * @param {MatterJS.BodyType} bodyA - The first possible `Body` that this constraint is attached to. - * @param {MatterJS.BodyType} bodyB - The second possible `Body` that this constraint is attached to. - * @param {number} [length] - A Number that specifies the target resting length of the constraint. If not given it is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. - * @param {number} [stiffness=1] - A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts as a soft spring. - * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. - * - * @return {MatterJS.ConstraintType} A Matter JS Constraint. - */ - constraint: function (bodyA, bodyB, length, stiffness, options) + for (var i = 0; i < tiles.length; i++) { - if (stiffness === undefined) { stiffness = 1; } - if (options === undefined) { options = {}; } - - options.bodyA = (bodyA.type === 'body') ? bodyA : bodyA.body; - options.bodyB = (bodyB.type === 'body') ? bodyB : bodyB.body; - - if (!isNaN(length)) + if (tiles[i]) { - options.length = length; + if (tiles[i].index === indexA) + { + tiles[i].index = indexB; + } + else if (tiles[i].index === indexB) + { + tiles[i].index = indexA; + } } + } +}; - options.stiffness = stiffness; +module.exports = SwapByIndex; - var constraint = Constraint.create(options); - this.world.add(constraint); +/***/ }), - return constraint; - }, +/***/ 44150: +/***/ ((module) => { - /** - * Constraints (or joints) are used for specifying that a fixed distance must be maintained - * between two bodies, or a body and a fixed world-space position. - * - * A world constraint has only one body, you should specify a `pointA` position in - * the constraint options parameter to attach the constraint to the world. - * - * The stiffness of constraints can be modified to create springs or elastic. - * - * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness` - * value (e.g. `0.7` or above). - * - * If the constraint is unstable, try lowering the `stiffness` value and / or increasing - * `constraintIterations` within the Matter Config. - * - * For compound bodies, constraints must be applied to the parent body and not one of its parts. - * - * @method Phaser.Physics.Matter.Factory#worldConstraint - * @since 3.0.0 - * - * @param {MatterJS.BodyType} body - The Matter `Body` that this constraint is attached to. - * @param {number} [length] - A number that specifies the target resting length of the constraint. If not given it is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`. - * @param {number} [stiffness=1] - A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts as a soft spring. - * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. - * - * @return {MatterJS.ConstraintType} A Matter JS Constraint. - */ - worldConstraint: function (body, length, stiffness, options) - { - if (stiffness === undefined) { stiffness = 1; } - if (options === undefined) { options = {}; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - options.bodyB = (body.type === 'body') ? body : body.body; +/** + * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.TileToWorldX + * @since 3.0.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} + */ +var TileToWorldX = function (tileX, camera, layer) +{ + var tileWidth = layer.baseTileWidth; + var tilemapLayer = layer.tilemapLayer; + var layerWorldX = 0; - if (!isNaN(length)) - { - options.length = length; - } + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } - options.stiffness = stiffness; + layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX); - var constraint = Constraint.create(options); + tileWidth *= tilemapLayer.scaleX; + } - this.world.add(constraint); + return layerWorldX + tileX * tileWidth; +}; - return constraint; - }, +module.exports = TileToWorldX; - /** - * This method is an alias for `Factory.pointerConstraint`. - * - * A Pointer Constraint is a special type of constraint that allows you to click - * and drag bodies in a Matter World. It monitors the active Pointers in a Scene, - * and when one is pressed down it checks to see if that hit any part of any active - * body in the world. If it did, and the body has input enabled, it will begin to - * drag it until either released, or you stop it via the `stopDrag` method. - * - * You can adjust the stiffness, length and other properties of the constraint via - * the `options` object on creation. - * - * @method Phaser.Physics.Matter.Factory#mouseSpring - * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. - * - * @return {MatterJS.ConstraintType} A Matter JS Constraint. - */ - mouseSpring: function (options) - { - return this.pointerConstraint(options); - }, - /** - * A Pointer Constraint is a special type of constraint that allows you to click - * and drag bodies in a Matter World. It monitors the active Pointers in a Scene, - * and when one is pressed down it checks to see if that hit any part of any active - * body in the world. If it did, and the body has input enabled, it will begin to - * drag it until either released, or you stop it via the `stopDrag` method. - * - * You can adjust the stiffness, length and other properties of the constraint via - * the `options` object on creation. - * - * @method Phaser.Physics.Matter.Factory#pointerConstraint - * @since 3.0.0 - * - * @param {Phaser.Types.Physics.Matter.MatterConstraintConfig} [options] - An optional Constraint configuration object that is used to set initial Constraint properties on creation. - * - * @return {MatterJS.ConstraintType} A Matter JS Constraint. - */ - pointerConstraint: function (options) - { - if (options === undefined) { options = {}; } +/***/ }), - if (!options.hasOwnProperty('render')) - { - options.render = { visible: false }; - } +/***/ 46836: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var pointerConstraint = new PointerConstraint(this.scene, this.world, options); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.world.add(pointerConstraint.constraint); +var TileToWorldX = __webpack_require__(44150); +var TileToWorldY = __webpack_require__(42477); +var Vector2 = __webpack_require__(93736); - return pointerConstraint; - }, +/** + * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. + * + * @function Phaser.Tilemaps.Components.TileToWorldXY + * @since 3.0.0 + * + * @param {number} tileX - The x coordinate, in tiles, not pixels. + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {Phaser.Math.Vector2} The XY location in world coordinates. + */ +var TileToWorldXY = function (tileX, tileY, point, camera, layer) +{ + if (!point) { point = new Vector2(0, 0); } - /** - * Creates a Matter Physics Image Game Object. - * - * An Image is a light-weight Game Object useful for the display of static images in your game, - * such as logos, backgrounds, scenery or other non-animated elements. Images can have input - * events and physics bodies, or be tweened, tinted or scrolled. The main difference between an - * Image and a Sprite is that you cannot animate an Image as they do not have the Animation component. - * - * @method Phaser.Physics.Matter.Factory#image - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. Set to `null` to skip this value. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {Phaser.Physics.Matter.Image} The Matter Image Game Object. - */ - image: function (x, y, key, frame, options) - { - var image = new MatterImage(this.world, x, y, key, frame, options); + point.x = TileToWorldX(tileX, camera, layer); + point.y = TileToWorldY(tileY, camera, layer); - this.sys.displayList.add(image); + return point; +}; - return image; - }, +module.exports = TileToWorldXY; - /** - * Creates a wrapper around a Tile that provides access to a corresponding Matter body. A tile can only - * have one Matter body associated with it. You can either pass in an existing Matter body for - * the tile or allow the constructor to create the corresponding body for you. If the Tile has a - * collision group (defined in Tiled), those shapes will be used to create the body. If not, the - * tile's rectangle bounding box will be used. - * - * The corresponding body will be accessible on the Tile itself via Tile.physics.matterBody. - * - * Note: not all Tiled collision shapes are supported. See - * Phaser.Physics.Matter.TileBody#setFromTileCollision for more information. - * - * @method Phaser.Physics.Matter.Factory#tileBody - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.Tile} tile - The target tile that should have a Matter body. - * @param {Phaser.Types.Physics.Matter.MatterTileOptions} [options] - Options to be used when creating the Matter body. - * - * @return {Phaser.Physics.Matter.TileBody} The Matter Tile Body Game Object. - */ - tileBody: function (tile, options) - { - return new MatterTileBody(this.world, tile, options); - }, - /** - * Creates a Matter Physics Sprite Game Object. - * - * A Sprite Game Object is used for the display of both static and animated images in your game. - * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled - * and animated. - * - * The main difference between a Sprite and an Image Game Object is that you cannot animate Images. - * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation - * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases. - * - * @method Phaser.Physics.Matter.Factory#sprite - * @since 3.0.0 - * - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {string} key - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. Set to `null` to skip this value. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {Phaser.Physics.Matter.Sprite} The Matter Sprite Game Object. - */ - sprite: function (x, y, key, frame, options) - { - var sprite = new MatterSprite(this.world, x, y, key, frame, options); +/***/ }), - this.sys.displayList.add(sprite); - this.sys.updateList.add(sprite); +/***/ 42477: +/***/ ((module) => { - return sprite; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Takes an existing Game Object and injects all of the Matter Components into it. - * - * This enables you to use component methods such as `setVelocity` or `isSensor` directly from - * this Game Object. - * - * You can also pass in either a Matter Body Configuration object, or a Matter Body instance - * to link with this Game Object. - * - * @method Phaser.Physics.Matter.Factory#gameObject - * @since 3.3.0 - * - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to inject the Matter Components in to. - * @param {(Phaser.Types.Physics.Matter.MatterBodyConfig|MatterJS.Body)} [options] - A Matter Body configuration object, or an instance of a Matter Body. - * @param {boolean} [addToWorld=true] - Add this Matter Body to the World? - * - * @return {(Phaser.Physics.Matter.Image|Phaser.Physics.Matter.Sprite|Phaser.GameObjects.GameObject)} The Game Object that had the Matter Components injected into it. - */ - gameObject: function (gameObject, options, addToWorld) - { - return MatterGameObject(this.world, gameObject, options, addToWorld); - }, +/** + * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.TileToWorldY + * @since 3.0.0 + * + * @param {number} tileY - The y coordinate, in tiles, not pixels. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in world coordinates. + */ +var TileToWorldY = function (tileY, camera, layer) +{ + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; + var layerWorldY = 0; - /** - * Destroys this Factory. - * - * @method Phaser.Physics.Matter.Factory#destroy - * @since 3.5.0 - */ - destroy: function () + if (tilemapLayer) { - this.world = null; - this.scene = null; - this.sys = null; + if (!camera) { camera = tilemapLayer.scene.cameras.main; } + + layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); + + tileHeight *= tilemapLayer.scaleY; } -}); + return layerWorldY + tileY * tileHeight; +}; -module.exports = Factory; +module.exports = TileToWorldY; /***/ }), -/* 1395 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 39677: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Components = __webpack_require__(249); -var GetFastValue = __webpack_require__(2); -var Vector2 = __webpack_require__(3); +var GetTilesWithin = __webpack_require__(50811); /** - * Internal function to check if the object has a getter or setter. - * - * @function hasGetterOrSetter - * @private - * - * @param {object} def - The object to check. + * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the + * specified layer. Each tile will receive a new index. New indexes are drawn from the given + * weightedIndexes array. An example weighted array: * - * @return {boolean} True if it has a getter or setter, otherwise false. - */ -function hasGetterOrSetter (def) -{ - return (!!def.get && typeof def.get === 'function') || (!!def.set && typeof def.set === 'function'); -} - -/** - * A Matter Game Object is a generic object that allows you to combine any Phaser Game Object, - * including those you have extended or created yourself, with all of the Matter Components. - * - * This enables you to use component methods such as `setVelocity` or `isSensor` directly from - * this Game Object. + * [ + * { index: 6, weight: 4 }, // Probability of index 6 is 4 / 8 + * { index: 7, weight: 2 }, // Probability of index 7 would be 2 / 8 + * { index: 8, weight: 1.5 }, // Probability of index 8 would be 1.5 / 8 + * { index: 26, weight: 0.5 } // Probability of index 27 would be 0.5 / 8 + * ] * - * @function Phaser.Physics.Matter.MatterGameObject - * @since 3.3.0 + * The probability of any index being choose is (the index's weight) / (sum of all weights). This + * method only modifies tile indexes and does not change collision information. * - * @param {Phaser.Physics.Matter.World} world - The Matter world to add the body to. - * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will have the Matter body applied to it. - * @param {(Phaser.Types.Physics.Matter.MatterBodyConfig|MatterJS.Body)} [options] - A Matter Body configuration object, or an instance of a Matter Body. - * @param {boolean} [addToWorld=true] - Should the newly created body be immediately added to the World? + * @function Phaser.Tilemaps.Components.WeightedRandomize + * @since 3.0.0 * - * @return {Phaser.GameObjects.GameObject} The Game Object that was created with the Matter body. + * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. + * @param {number} width - How many tiles wide from the `tileX` index the area will be. + * @param {number} height - How many tiles tall from the `tileY` index the area will be. + * @param {object[]} weightedIndexes - An array of objects to randomly draw from during + * randomization. They should be in the form: { index: 0, weight: 4 } or + * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. */ -var MatterGameObject = function (world, gameObject, options, addToWorld) +var WeightedRandomize = function (tileX, tileY, width, height, weightedIndexes, layer) { - if (options === undefined) { options = {}; } - if (addToWorld === undefined) { addToWorld = true; } + if (!weightedIndexes) { return; } - var x = gameObject.x; - var y = gameObject.y; + var i; + var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); - // Temp body pos to avoid body null checks - gameObject.body = { - temp: true, - position: { - x: x, - y: y - } - }; + var weightTotal = 0; - var mixins = [ - Components.Bounce, - Components.Collision, - Components.Force, - Components.Friction, - Components.Gravity, - Components.Mass, - Components.Sensor, - Components.SetBody, - Components.Sleep, - Components.Static, - Components.Transform, - Components.Velocity - ]; + for (i = 0; i < weightedIndexes.length; i++) + { + weightTotal += weightedIndexes[i].weight; + } - // First let's inject all of the components into the Game Object - mixins.forEach(function (mixin) + if (weightTotal <= 0) { return; } + + for (i = 0; i < tiles.length; i++) { - for (var key in mixin) + var rand = Math.random() * weightTotal; + var sum = 0; + var randomIndex = -1; + + for (var j = 0; j < weightedIndexes.length; j++) { - if (hasGetterOrSetter(mixin[key])) - { - Object.defineProperty(gameObject, key, { - get: mixin[key].get, - set: mixin[key].set - }); - } - else + sum += weightedIndexes[j].weight; + + if (rand <= sum) { - Object.defineProperty(gameObject, key, {value: mixin[key]}); + var chosen = weightedIndexes[j].index; + + randomIndex = Array.isArray(chosen) + ? chosen[Math.floor(Math.random() * chosen.length)] + : chosen; + break; } } - }); + tiles[i].index = randomIndex; + } +}; - gameObject.world = world; +module.exports = WeightedRandomize; - gameObject._tempVec2 = new Vector2(x, y); - if (options.hasOwnProperty('type') && options.type === 'body') - { - gameObject.setExistingBody(options, addToWorld); - } - else - { - var shape = GetFastValue(options, 'shape', null); +/***/ }), - if (!shape) - { - shape = 'rectangle'; - } +/***/ 806: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - options.addToWorld = addToWorld; - - gameObject.setBody(shape, options); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return gameObject; +var WorldToTileXY = __webpack_require__(45676); +var Vector2 = __webpack_require__(93736); + +var tempVec = new Vector2(); + +/** + * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.WorldToTileX + * @since 3.0.0 + * + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {?Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The X location in tile units. + */ +var WorldToTileX = function (worldX, snapToFloor, camera, layer) +{ + WorldToTileXY(worldX, 0, snapToFloor, tempVec, camera, layer); + + return tempVec.x; }; -module.exports = MatterGameObject; +module.exports = WorldToTileX; /***/ }), -/* 1396 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 45676: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var Components = __webpack_require__(249); -var GameObject = __webpack_require__(15); -var GetFastValue = __webpack_require__(2); -var Image = __webpack_require__(125); -var Pipeline = __webpack_require__(167); -var Vector2 = __webpack_require__(3); +var Vector2 = __webpack_require__(93736); /** - * @classdesc - * A Matter Physics Image Game Object. - * - * An Image is a light-weight Game Object useful for the display of static images in your game, - * such as logos, backgrounds, scenery or other non-animated elements. Images can have input - * events and physics bodies, or be tweened, tinted or scrolled. The main difference between an - * Image and a Sprite is that you cannot animate an Image as they do not have the Animation component. + * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the + * layer's position, scale and scroll. This will return a new Vector2 object or update the given + * `point` object. * - * @class Image - * @extends Phaser.GameObjects.Image - * @memberof Phaser.Physics.Matter - * @constructor + * @function Phaser.Tilemaps.Components.WorldToTileXY * @since 3.0.0 * - * @extends Phaser.Physics.Matter.Components.Bounce - * @extends Phaser.Physics.Matter.Components.Collision - * @extends Phaser.Physics.Matter.Components.Force - * @extends Phaser.Physics.Matter.Components.Friction - * @extends Phaser.Physics.Matter.Components.Gravity - * @extends Phaser.Physics.Matter.Components.Mass - * @extends Phaser.Physics.Matter.Components.Sensor - * @extends Phaser.Physics.Matter.Components.SetBody - * @extends Phaser.Physics.Matter.Components.Sleep - * @extends Phaser.Physics.Matter.Components.Static - * @extends Phaser.Physics.Matter.Components.Transform - * @extends Phaser.Physics.Matter.Components.Velocity - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible + * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles. + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {Phaser.Math.Vector2} point - A Vector2 to store the coordinates in. If not given a new Vector2 is created. + * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. * - * @param {Phaser.Physics.Matter.World} world - A reference to the Matter.World instance that this body belongs to. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * @return {Phaser.Math.Vector2} The XY location in tile units. */ -var MatterImage = new Class({ +var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer) +{ + if (snapToFloor === undefined) { snapToFloor = true; } + if (!point) { point = new Vector2(); } - Extends: Image, + var tileWidth = layer.baseTileWidth; + var tileHeight = layer.baseTileHeight; + var tilemapLayer = layer.tilemapLayer; - Mixins: [ - Components.Bounce, - Components.Collision, - Components.Force, - Components.Friction, - Components.Gravity, - Components.Mass, - Components.Sensor, - Components.SetBody, - Components.Sleep, - Components.Static, - Components.Transform, - Components.Velocity, - Pipeline - ], + if (tilemapLayer) + { + if (!camera) { camera = tilemapLayer.scene.cameras.main; } - initialize: + // Find the world position relative to the static or dynamic layer's top left origin, + // factoring in the camera's horizontal scroll + worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX)); + worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY)); - function MatterImage (world, x, y, texture, frame, options) + tileWidth *= tilemapLayer.scaleX; + tileHeight *= tilemapLayer.scaleY; + } + + var x = worldX / tileWidth; + var y = worldY / tileHeight; + + if (snapToFloor) { - GameObject.call(this, world.scene, 'Image'); + x = Math.floor(x); + y = Math.floor(y); + } - /** - * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. - * - * @name Phaser.Physics.Matter.Image#_crop - * @type {object} - * @private - * @since 3.24.0 - */ - this._crop = this.resetCropObject(); + return point.set(x, y); +}; - this.setTexture(texture, frame); - this.setSizeToFrame(); - this.setOrigin(); +module.exports = WorldToTileXY; - /** - * A reference to the Matter.World instance that this body belongs to. - * - * @name Phaser.Physics.Matter.Image#world - * @type {Phaser.Physics.Matter.World} - * @since 3.0.0 - */ - this.world = world; - /** - * An internal temp vector used for velocity and force calculations. - * - * @name Phaser.Physics.Matter.Image#_tempVec2 - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tempVec2 = new Vector2(x, y); +/***/ }), - var shape = GetFastValue(options, 'shape', null); +/***/ 70520: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (shape) - { - this.setBody(shape, options); - } - else - { - this.setRectangle(this.width, this.height, options); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.setPosition(x, y); +var WorldToTileXY = __webpack_require__(45676); +var Vector2 = __webpack_require__(93736); - this.initPipeline(); - } +var tempVec = new Vector2(); -}); +/** + * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the + * layer's position, scale and scroll. + * + * @function Phaser.Tilemaps.Components.WorldToTileY + * @since 3.0.0 + * + * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles. + * @param {boolean} snapToFloor - Whether or not to round the tile coordinate down to the nearest integer. + * @param {?Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. + * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * + * @return {number} The Y location in tile units. + */ +var WorldToTileY = function (worldY, snapToFloor, camera, layer) +{ + WorldToTileXY(0, worldY, snapToFloor, tempVec, camera, layer); -module.exports = MatterImage; + return tempVec.y; +}; + +module.exports = WorldToTileY; /***/ }), -/* 1397 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 5047: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var AnimationState = __webpack_require__(164); -var Class = __webpack_require__(0); -var Components = __webpack_require__(249); -var GameObject = __webpack_require__(15); -var GetFastValue = __webpack_require__(2); -var Pipeline = __webpack_require__(167); -var Sprite = __webpack_require__(73); -var Vector2 = __webpack_require__(3); +/** + * @namespace Phaser.Tilemaps.Components + */ + +module.exports = { + + CalculateFacesAt: __webpack_require__(92839), + CalculateFacesWithin: __webpack_require__(60386), + CheckIsoBounds: __webpack_require__(13125), + Copy: __webpack_require__(17347), + CreateFromTiles: __webpack_require__(93604), + CullBounds: __webpack_require__(71586), + CullTiles: __webpack_require__(381), + Fill: __webpack_require__(97734), + FilterTiles: __webpack_require__(63555), + FindByIndex: __webpack_require__(37982), + FindTile: __webpack_require__(48297), + ForEachTile: __webpack_require__(80916), + GetCullTilesFunction: __webpack_require__(31493), + GetTileAt: __webpack_require__(15494), + GetTileAtWorldXY: __webpack_require__(24640), + GetTileCorners: __webpack_require__(48495), + GetTileCornersFunction: __webpack_require__(7160), + GetTilesWithin: __webpack_require__(50811), + GetTilesWithinShape: __webpack_require__(31674), + GetTilesWithinWorldXY: __webpack_require__(44662), + GetTileToWorldXFunction: __webpack_require__(16884), + GetTileToWorldXYFunction: __webpack_require__(68182), + GetTileToWorldYFunction: __webpack_require__(3752), + GetWorldToTileXFunction: __webpack_require__(29296), + GetWorldToTileXYFunction: __webpack_require__(32688), + GetWorldToTileYFunction: __webpack_require__(74326), + HasTileAt: __webpack_require__(46598), + HasTileAtWorldXY: __webpack_require__(28654), + HexagonalCullBounds: __webpack_require__(6358), + HexagonalCullTiles: __webpack_require__(37524), + HexagonalGetTileCorners: __webpack_require__(63634), + HexagonalTileToWorldXY: __webpack_require__(21715), + HexagonalWorldToTileXY: __webpack_require__(11516), + IsInLayerBounds: __webpack_require__(62839), + IsometricCullTiles: __webpack_require__(20887), + IsometricTileToWorldXY: __webpack_require__(21808), + IsometricWorldToTileXY: __webpack_require__(18750), + PutTileAt: __webpack_require__(29003), + PutTileAtWorldXY: __webpack_require__(48565), + PutTilesAt: __webpack_require__(56547), + Randomize: __webpack_require__(91180), + RemoveTileAt: __webpack_require__(929), + RemoveTileAtWorldXY: __webpack_require__(17384), + RenderDebug: __webpack_require__(93763), + ReplaceByIndex: __webpack_require__(51202), + RunCull: __webpack_require__(6987), + SetCollision: __webpack_require__(51710), + SetCollisionBetween: __webpack_require__(15216), + SetCollisionByExclusion: __webpack_require__(33158), + SetCollisionByProperty: __webpack_require__(4180), + SetCollisionFromCollisionGroup: __webpack_require__(18625), + SetLayerCollisionIndex: __webpack_require__(91181), + SetTileCollision: __webpack_require__(68234), + SetTileIndexCallback: __webpack_require__(11628), + SetTileLocationCallback: __webpack_require__(72732), + Shuffle: __webpack_require__(34397), + StaggeredCullBounds: __webpack_require__(53945), + StaggeredCullTiles: __webpack_require__(19242), + StaggeredTileToWorldXY: __webpack_require__(33388), + StaggeredTileToWorldY: __webpack_require__(84132), + StaggeredWorldToTileXY: __webpack_require__(90562), + StaggeredWorldToTileY: __webpack_require__(3689), + SwapByIndex: __webpack_require__(55217), + TileToWorldX: __webpack_require__(44150), + TileToWorldXY: __webpack_require__(46836), + TileToWorldY: __webpack_require__(42477), + WeightedRandomize: __webpack_require__(39677), + WorldToTileX: __webpack_require__(806), + WorldToTileXY: __webpack_require__(45676), + WorldToTileY: __webpack_require__(70520) + +}; + + +/***/ }), + +/***/ 12920: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ /** - * @classdesc - * A Matter Physics Sprite Game Object. - * - * A Sprite Game Object is used for the display of both static and animated images in your game. - * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled - * and animated. - * - * The main difference between a Sprite and an Image Game Object is that you cannot animate Images. - * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation - * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases. + * Phaser Tilemap constants for orientation. * - * @class Sprite - * @extends Phaser.GameObjects.Sprite - * @memberof Phaser.Physics.Matter - * @constructor - * @since 3.0.0 + * @namespace Phaser.Tilemaps.Orientation + * @memberof Phaser.Tilemaps + * @since 3.50.0 + */ + +/** + * Phaser Tilemap constants for orientation. * - * @extends Phaser.Physics.Matter.Components.Bounce - * @extends Phaser.Physics.Matter.Components.Collision - * @extends Phaser.Physics.Matter.Components.Force - * @extends Phaser.Physics.Matter.Components.Friction - * @extends Phaser.Physics.Matter.Components.Gravity - * @extends Phaser.Physics.Matter.Components.Mass - * @extends Phaser.Physics.Matter.Components.Sensor - * @extends Phaser.Physics.Matter.Components.SetBody - * @extends Phaser.Physics.Matter.Components.Sleep - * @extends Phaser.Physics.Matter.Components.Static - * @extends Phaser.Physics.Matter.Components.Transform - * @extends Phaser.Physics.Matter.Components.Velocity - * @extends Phaser.GameObjects.Components.Alpha - * @extends Phaser.GameObjects.Components.BlendMode - * @extends Phaser.GameObjects.Components.Depth - * @extends Phaser.GameObjects.Components.Flip - * @extends Phaser.GameObjects.Components.GetBounds - * @extends Phaser.GameObjects.Components.Origin - * @extends Phaser.GameObjects.Components.Pipeline - * @extends Phaser.GameObjects.Components.ScrollFactor - * @extends Phaser.GameObjects.Components.Size - * @extends Phaser.GameObjects.Components.Texture - * @extends Phaser.GameObjects.Components.Tint - * @extends Phaser.GameObjects.Components.Transform - * @extends Phaser.GameObjects.Components.Visible + * To find out what each mode does please see [Phaser.Tilemaps.Orientation]{@link Phaser.Tilemaps.Orientation}. * - * @param {Phaser.Physics.Matter.World} world - A reference to the Matter.World instance that this body belongs to. - * @param {number} x - The horizontal position of this Game Object in the world. - * @param {number} y - The vertical position of this Game Object in the world. - * @param {(string|Phaser.Textures.Texture)} texture - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. - * @param {(string|number)} [frame] - An optional frame from the Texture this Game Object is rendering with. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. + * @typedef {Phaser.Tilemaps.Orientation} Phaser.Tilemaps.OrientationType + * @memberof Phaser.Tilemaps + * @since 3.50.0 */ -var MatterSprite = new Class({ - Extends: Sprite, +module.exports = { - Mixins: [ - Components.Bounce, - Components.Collision, - Components.Force, - Components.Friction, - Components.Gravity, - Components.Mass, - Components.Sensor, - Components.SetBody, - Components.Sleep, - Components.Static, - Components.Transform, - Components.Velocity, - Pipeline - ], + /** + * Orthogonal Tilemap orientation constant. + * + * @name Phaser.Tilemaps.Orientation.ORTHOGONAL + * @type {number} + * @const + * @since 3.50.0 + */ + ORTHOGONAL: 0, - initialize: + /** + * Isometric Tilemap orientation constant. + * + * @name Phaser.Tilemaps.Orientation.ISOMETRIC + * @type {number} + * @const + * @since 3.50.0 + */ + ISOMETRIC: 1, - function MatterSprite (world, x, y, texture, frame, options) - { - GameObject.call(this, world.scene, 'Sprite'); + /** + * Staggered Tilemap orientation constant. + * + * @name Phaser.Tilemaps.Orientation.STAGGERED + * @type {number} + * @const + * @since 3.50.0 + */ + STAGGERED: 2, - /** - * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method. - * - * @name Phaser.Physics.Matter.Sprite#_crop - * @type {object} - * @private - * @since 3.24.0 - */ - this._crop = this.resetCropObject(); + /** + * Hexagonal Tilemap orientation constant. + * + * @name Phaser.Tilemaps.Orientation.HEXAGONAL + * @type {number} + * @const + * @since 3.50.0 + */ + HEXAGONAL: 3 - this.anims = new AnimationState(this); +}; - this.setTexture(texture, frame); - this.setSizeToFrame(); - this.setOrigin(); - /** - * A reference to the Matter.World instance that this body belongs to. - * - * @name Phaser.Physics.Matter.Sprite#world - * @type {Phaser.Physics.Matter.World} - * @since 3.0.0 - */ - this.world = world; +/***/ }), - /** - * An internal temp vector used for velocity and force calculations. - * - * @name Phaser.Physics.Matter.Sprite#_tempVec2 - * @type {Phaser.Math.Vector2} - * @private - * @since 3.0.0 - */ - this._tempVec2 = new Vector2(x, y); +/***/ 84758: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var shape = GetFastValue(options, 'shape', null); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (shape) - { - this.setBody(shape, options); - } - else - { - this.setRectangle(this.width, this.height, options); - } +var CONST = { - this.setPosition(x, y); + ORIENTATION: __webpack_require__(12920) - this.initPipeline(); - } +}; -}); +module.exports = CONST; -module.exports = MatterSprite; + +/***/ }), + +/***/ 52678: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Extend = __webpack_require__(98611); +var CONST = __webpack_require__(84758); + +/** + * @namespace Phaser.Tilemaps + * + * @borrows Phaser.Tilemaps.Orientation.ORTHOGONAL as ORTHOGONAL + * @borrows Phaser.Tilemaps.Orientation.ISOMETRIC as ISOMETRIC + * @borrows Phaser.Tilemaps.Orientation.STAGGERED as STAGGERED + * @borrows Phaser.Tilemaps.Orientation.HEXAGONAL as HEXAGONAL + */ + +var Tilemaps = { + + Components: __webpack_require__(5047), + Parsers: __webpack_require__(34124), + + Formats: __webpack_require__(93560), + ImageCollection: __webpack_require__(97042), + ParseToTilemap: __webpack_require__(15043), + Tile: __webpack_require__(29633), + Tilemap: __webpack_require__(89797), + TilemapCreator: __webpack_require__(4843), + TilemapFactory: __webpack_require__(37940), + Tileset: __webpack_require__(47975), + TilemapLayer: __webpack_require__(87177), + Orientation: __webpack_require__(12920), + + LayerData: __webpack_require__(94990), + MapData: __webpack_require__(16586), + ObjectLayer: __webpack_require__(15256) + +}; + +Tilemaps = Extend(false, Tilemaps, CONST.ORIENTATION); + +module.exports = Tilemaps; /***/ }), -/* 1398 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 94990: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bounds = __webpack_require__(84); -var Class = __webpack_require__(0); -var Composite = __webpack_require__(118); -var Constraint = __webpack_require__(128); -var Detector = __webpack_require__(273); -var Events = __webpack_require__(272); -var InputEvents = __webpack_require__(51); -var Merge = __webpack_require__(127); -var Sleeping = __webpack_require__(165); -var Vector2 = __webpack_require__(3); -var Vertices = __webpack_require__(64); +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12920); +var GetFastValue = __webpack_require__(72632); /** * @classdesc - * A Pointer Constraint is a special type of constraint that allows you to click - * and drag bodies in a Matter World. It monitors the active Pointers in a Scene, - * and when one is pressed down it checks to see if that hit any part of any active - * body in the world. If it did, and the body has input enabled, it will begin to - * drag it until either released, or you stop it via the `stopDrag` method. - * - * You can adjust the stiffness, length and other properties of the constraint via - * the `options` object on creation. + * A class for representing data about about a layer in a map. Maps are parsed from CSV, Tiled, + * etc. into this format. Tilemap and TilemapLayer objects have a reference + * to this data and use it to look up and perform operations on tiles. * - * @class PointerConstraint - * @memberof Phaser.Physics.Matter + * @class LayerData + * @memberof Phaser.Tilemaps * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - A reference to the Scene to which this Pointer Constraint belongs. - * @param {Phaser.Physics.Matter.World} world - A reference to the Matter World instance to which this Constraint belongs. - * @param {object} [options] - A Constraint configuration object. + * @param {Phaser.Types.Tilemaps.LayerDataConfig} [config] - The Layer Data configuration object. */ -var PointerConstraint = new Class({ +var LayerData = new Class({ initialize: - function PointerConstraint (scene, world, options) + function LayerData (config) { - if (options === undefined) { options = {}; } - - // Defaults - var defaults = { - label: 'Pointer Constraint', - pointA: { x: 0, y: 0 }, - pointB: { x: 0, y: 0 }, - length: 0.01, - stiffness: 0.1, - angularStiffness: 1, - collisionFilter: { - category: 0x0001, - mask: 0xFFFFFFFF, - group: 0 - } - }; + if (config === undefined) { config = {}; } /** - * A reference to the Scene to which this Pointer Constraint belongs. - * This is the same Scene as the Matter World instance. + * The name of the layer, if specified in Tiled. * - * @name Phaser.Physics.Matter.PointerConstraint#scene - * @type {Phaser.Scene} + * @name Phaser.Tilemaps.LayerData#name + * @type {string} * @since 3.0.0 */ - this.scene = scene; + this.name = GetFastValue(config, 'name', 'layer'); /** - * A reference to the Matter World instance to which this Constraint belongs. + * The x offset of where to draw from the top left. * - * @name Phaser.Physics.Matter.PointerConstraint#world - * @type {Phaser.Physics.Matter.World} + * @name Phaser.Tilemaps.LayerData#x + * @type {number} * @since 3.0.0 */ - this.world = world; + this.x = GetFastValue(config, 'x', 0); /** - * The Camera the Pointer was interacting with when the input - * down event was processed. + * The y offset of where to draw from the top left. * - * @name Phaser.Physics.Matter.PointerConstraint#camera - * @type {Phaser.Cameras.Scene2D.Camera} + * @name Phaser.Tilemaps.LayerData#y + * @type {number} * @since 3.0.0 */ - this.camera = null; + this.y = GetFastValue(config, 'y', 0); /** - * A reference to the Input Pointer that activated this Constraint. - * This is set in the `onDown` handler. + * The width of the layer in tiles. * - * @name Phaser.Physics.Matter.PointerConstraint#pointer - * @type {Phaser.Input.Pointer} - * @default null + * @name Phaser.Tilemaps.LayerData#width + * @type {number} * @since 3.0.0 */ - this.pointer = null; + this.width = GetFastValue(config, 'width', 0); /** - * Is this Constraint active or not? - * - * An active constraint will be processed each update. An inactive one will be skipped. - * Use this to toggle a Pointer Constraint on and off. + * The height of the layer in tiles. * - * @name Phaser.Physics.Matter.PointerConstraint#active - * @type {boolean} - * @default true + * @name Phaser.Tilemaps.LayerData#height + * @type {number} * @since 3.0.0 */ - this.active = true; + this.height = GetFastValue(config, 'height', 0); /** - * The internal transformed position. + * The pixel width of the tiles. * - * @name Phaser.Physics.Matter.PointerConstraint#position - * @type {Phaser.Math.Vector2} + * @name Phaser.Tilemaps.LayerData#tileWidth + * @type {number} * @since 3.0.0 */ - this.position = new Vector2(); + this.tileWidth = GetFastValue(config, 'tileWidth', 0); /** - * The body that is currently being dragged, if any. + * The pixel height of the tiles. * - * @name Phaser.Physics.Matter.PointerConstraint#body - * @type {?MatterJS.BodyType} - * @since 3.16.2 + * @name Phaser.Tilemaps.LayerData#tileHeight + * @type {number} + * @since 3.0.0 */ - this.body = null; + this.tileHeight = GetFastValue(config, 'tileHeight', 0); /** - * The part of the body that was clicked on to start the drag. + * The base tile width. * - * @name Phaser.Physics.Matter.PointerConstraint#part - * @type {?MatterJS.BodyType} - * @since 3.16.2 + * @name Phaser.Tilemaps.LayerData#baseTileWidth + * @type {number} + * @since 3.0.0 */ - this.part = null; + this.baseTileWidth = GetFastValue(config, 'baseTileWidth', this.tileWidth); /** - * The native Matter Constraint that is used to attach to bodies. + * The base tile height. * - * @name Phaser.Physics.Matter.PointerConstraint#constraint - * @type {MatterJS.ConstraintType} + * @name Phaser.Tilemaps.LayerData#baseTileHeight + * @type {number} * @since 3.0.0 */ - this.constraint = Constraint.create(Merge(options, defaults)); - - this.world.on(Events.BEFORE_UPDATE, this.update, this); - - scene.sys.input.on(InputEvents.POINTER_DOWN, this.onDown, this); - scene.sys.input.on(InputEvents.POINTER_UP, this.onUp, this); - }, - - /** - * A Pointer has been pressed down onto the Scene. - * - * If this Constraint doesn't have an active Pointer then a hit test is set to - * run against all active bodies in the world during the _next_ call to `update`. - * If a body is found, it is bound to this constraint and the drag begins. - * - * @method Phaser.Physics.Matter.PointerConstraint#onDown - * @since 3.0.0 - * - * @param {Phaser.Input.Pointer} pointer - A reference to the Pointer that was pressed. - */ - onDown: function (pointer) - { - if (!this.pointer) - { - this.pointer = pointer; - this.camera = pointer.camera; - } - }, - - /** - * A Pointer has been released from the Scene. If it was the one this constraint was using, it's cleared. - * - * @method Phaser.Physics.Matter.PointerConstraint#onUp - * @since 3.22.0 - * - * @param {Phaser.Input.Pointer} pointer - A reference to the Pointer that was pressed. - */ - onUp: function (pointer) - { - if (pointer === this.pointer) - { - this.pointer = null; - } - }, - - /** - * Scans all active bodies in the current Matter World to see if any of them - * are hit by the Pointer. The _first one_ found to hit is set as the active contraint - * body. - * - * @method Phaser.Physics.Matter.PointerConstraint#getBody - * @fires Phaser.Physics.Matter.Events#DRAG_START - * @since 3.16.2 - * - * @return {boolean} `true` if a body was found and set, otherwise `false`. - */ - getBody: function (pointer) - { - var pos = this.position; - var constraint = this.constraint; - - this.camera.getWorldPoint(pointer.x, pointer.y, pos); - - var bodies = Composite.allBodies(this.world.localWorld); - - for (var i = 0; i < bodies.length; i++) - { - var body = bodies[i]; - - if (!body.ignorePointer && - Bounds.contains(body.bounds, pos) && - Detector.canCollide(body.collisionFilter, constraint.collisionFilter)) - { - if (this.hitTestBody(body, pos)) - { - this.world.emit(Events.DRAG_START, body, this.part, this); - - return true; - } - } - } - - return false; - }, - - /** - * Scans the current body to determine if a part of it was clicked on. - * If a part is found the body is set as the `constraint.bodyB` property, - * as well as the `body` property of this class. The part is also set. - * - * @method Phaser.Physics.Matter.PointerConstraint#hitTestBody - * @since 3.16.2 - * - * @param {MatterJS.BodyType} body - The Matter Body to check. - * @param {Phaser.Math.Vector2} position - A translated hit test position. - * - * @return {boolean} `true` if a part of the body was hit, otherwise `false`. - */ - hitTestBody: function (body, position) - { - var constraint = this.constraint; - var partsLength = body.parts.length; - - var start = (partsLength > 1) ? 1 : 0; - - for (var i = start; i < partsLength; i++) - { - var part = body.parts[i]; - - if (Vertices.contains(part.vertices, position)) - { - constraint.pointA = position; - constraint.pointB = { x: position.x - body.position.x, y: position.y - body.position.y }; - - constraint.bodyB = body; - constraint.angleB = body.angle; - - Sleeping.set(body, false); - - this.part = part; - this.body = body; - - return true; - } - } - - return false; - }, - - /** - * Internal update handler. Called in the Matter BEFORE_UPDATE step. - * - * @method Phaser.Physics.Matter.PointerConstraint#update - * @fires Phaser.Physics.Matter.Events#DRAG - * @since 3.0.0 - */ - update: function () - { - var pointer = this.pointer; - var body = this.body; - - if (!this.active || !pointer) - { - if (body) - { - this.stopDrag(); - } - - return; - } - - if (!pointer.isDown && body) - { - this.stopDrag(); - - return; - } - else if (pointer.isDown) - { - if (!body && !this.getBody(pointer)) - { - return; - } - - body = this.body; - - var pos = this.position; - var constraint = this.constraint; - - this.camera.getWorldPoint(pointer.x, pointer.y, pos); - - // Drag update - constraint.pointA.x = pos.x; - constraint.pointA.y = pos.y; - - Sleeping.set(body, false); + this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight); - this.world.emit(Events.DRAG, body, this); - } - }, + /** + * The layers orientation, necessary to be able to determine a tiles pixelX and pixelY as well as the layers width and height. + * + * @name Phaser.Tilemaps.LayerData#orientation + * @type {Phaser.Tilemaps.OrientationType} + * @since 3.50.0 + */ + this.orientation = GetFastValue(config, 'orientation', CONST.ORTHOGONAL); - /** - * Stops the Pointer Constraint from dragging the body any further. - * - * This is called automatically if the Pointer is released while actively - * dragging a body. Or, you can call it manually to release a body from a - * constraint without having to first release the pointer. - * - * @method Phaser.Physics.Matter.PointerConstraint#stopDrag - * @fires Phaser.Physics.Matter.Events#DRAG_END - * @since 3.16.2 - */ - stopDrag: function () - { - var body = this.body; - var constraint = this.constraint; + /** + * The width in pixels of the entire layer. + * + * @name Phaser.Tilemaps.LayerData#widthInPixels + * @type {number} + * @since 3.0.0 + */ + this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.baseTileWidth); - constraint.bodyB = null; - constraint.pointB = null; + /** + * The height in pixels of the entire layer. + * + * @name Phaser.Tilemaps.LayerData#heightInPixels + * @type {number} + * @since 3.0.0 + */ + this.heightInPixels = GetFastValue(config, 'heightInPixels', this.height * this.baseTileHeight); - this.pointer = null; - this.body = null; - this.part = null; + /** + * The alpha value of the layer. + * + * @name Phaser.Tilemaps.LayerData#alpha + * @type {number} + * @since 3.0.0 + */ + this.alpha = GetFastValue(config, 'alpha', 1); - if (body) - { - this.world.emit(Events.DRAG_END, body, this); - } - }, + /** + * Is the layer visible or not? + * + * @name Phaser.Tilemaps.LayerData#visible + * @type {boolean} + * @since 3.0.0 + */ + this.visible = GetFastValue(config, 'visible', true); - /** - * Destroys this Pointer Constraint instance and all of its references. - * - * @method Phaser.Physics.Matter.PointerConstraint#destroy - * @since 3.0.0 - */ - destroy: function () - { - this.world.removeConstraint(this.constraint); + /** + * Layer specific properties (can be specified in Tiled) + * + * @name Phaser.Tilemaps.LayerData#properties + * @type {object[]} + * @since 3.0.0 + */ + this.properties = GetFastValue(config, 'properties', []); - this.pointer = null; - this.constraint = null; - this.body = null; - this.part = null; + /** + * Tile ID index map. + * + * @name Phaser.Tilemaps.LayerData#indexes + * @type {array} + * @since 3.0.0 + */ + this.indexes = GetFastValue(config, 'indexes', []); - this.world.off(Events.BEFORE_UPDATE, this.update); + /** + * Tile Collision ID index map. + * + * @name Phaser.Tilemaps.LayerData#collideIndexes + * @type {array} + * @since 3.0.0 + */ + this.collideIndexes = GetFastValue(config, 'collideIndexes', []); - this.scene.sys.input.off(InputEvents.POINTER_DOWN, this.onDown, this); - this.scene.sys.input.off(InputEvents.POINTER_UP, this.onUp, this); - } + /** + * An array of callbacks. + * + * @name Phaser.Tilemaps.LayerData#callbacks + * @type {array} + * @since 3.0.0 + */ + this.callbacks = GetFastValue(config, 'callbacks', []); -}); + /** + * An array of physics bodies. + * + * @name Phaser.Tilemaps.LayerData#bodies + * @type {array} + * @since 3.0.0 + */ + this.bodies = GetFastValue(config, 'bodies', []); -module.exports = PointerConstraint; + /** + * An array of the tile data indexes. + * + * @name Phaser.Tilemaps.LayerData#data + * @type {Phaser.Tilemaps.Tile[][]} + * @since 3.0.0 + */ + this.data = GetFastValue(config, 'data', []); + /** + * A reference to the Tilemap layer that owns this data. + * + * @name Phaser.Tilemaps.LayerData#tilemapLayer + * @type {Phaser.Tilemaps.TilemapLayer} + * @since 3.0.0 + */ + this.tilemapLayer = GetFastValue(config, 'tilemapLayer', null); -/***/ }), -/* 1399 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The length of the horizontal sides of the hexagon. + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.LayerData#hexSideLength + * @type {number} + * @since 3.50.0 + */ + this.hexSideLength = GetFastValue(config, 'hexSideLength', 0); -/** -* The `Matter` module is the top level namespace. It also includes a function for installing plugins on top of the library. -* -* @class Matter -*/ + /** + * The Stagger Axis as defined in Tiled. + * + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.LayerData#staggerAxis + * @type {string} + * @since 3.60.0 + */ + this.staggerAxis = GetFastValue(config, 'staggerAxis', 'y'); -var Matter = {}; + /** + * The Stagger Index as defined in Tiled. + * + * Either 'odd' or 'even'. + * + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.LayerData#staggerIndex + * @type {string} + * @since 3.60.0 + */ + this.staggerIndex = GetFastValue(config, 'staggerIndex', 'odd'); + } -module.exports = Matter; +}); -var Plugin = __webpack_require__(595); -var Common = __webpack_require__(32); +module.exports = LayerData; -(function() { - /** - * The library name. - * @property name - * @readOnly - * @type {String} - */ - Matter.name = 'matter-js'; +/***/ }), - /** - * The library version. - * @property version - * @readOnly - * @type {String} - */ - Matter.version = '0.14.2'; +/***/ 16586: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * A list of plugin dependencies to be installed. These are normally set and installed through `Matter.use`. - * Alternatively you may set `Matter.uses` manually and install them by calling `Plugin.use(Matter)`. - * @property uses - * @type {Array} - */ - Matter.uses = []; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The plugins that have been installed through `Matter.Plugin.install`. Read only. - * @property used - * @readOnly - * @type {Array} - */ - Matter.used = []; +var Class = __webpack_require__(56694); +var CONST = __webpack_require__(12920); +var GetFastValue = __webpack_require__(72632); - /** - * Installs the given plugins on the `Matter` namespace. - * This is a short-hand for `Plugin.use`, see it for more information. - * Call this function once at the start of your code, with all of the plugins you wish to install as arguments. - * Avoid calling this function multiple times unless you intend to manually control installation order. - * @method use - * @param ...plugin {Function} The plugin(s) to install on `base` (multi-argument). - */ - Matter.use = function() { - Plugin.use(Matter, Array.prototype.slice.call(arguments)); - }; +/** + * @classdesc + * A class for representing data about a map. Maps are parsed from CSV, Tiled, etc. into this + * format. A Tilemap object get a copy of this data and then unpacks the needed properties into + * itself. + * + * @class MapData + * @memberof Phaser.Tilemaps + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Types.Tilemaps.MapDataConfig} [config] - The Map configuration object. + */ +var MapData = new Class({ - /** - * Chains a function to excute before the original function on the given `path` relative to `Matter`. - * See also docs for `Common.chain`. - * @method before - * @param {string} path The path relative to `Matter` - * @param {function} func The function to chain before the original - * @return {function} The chained function that replaced the original - */ - Matter.before = function(path, func) { - path = path.replace(/^Matter./, ''); - return Common.chainPathBefore(Matter, path, func); - }; + initialize: - /** - * Chains a function to excute after the original function on the given `path` relative to `Matter`. - * See also docs for `Common.chain`. - * @method after - * @param {string} path The path relative to `Matter` - * @param {function} func The function to chain after the original - * @return {function} The chained function that replaced the original - */ - Matter.after = function(path, func) { - path = path.replace(/^Matter./, ''); - return Common.chainPathAfter(Matter, path, func); - }; + function MapData (config) + { + if (config === undefined) { config = {}; } -})(); + /** + * The key in the Phaser cache that corresponds to the loaded tilemap data. + * + * @name Phaser.Tilemaps.MapData#name + * @type {string} + * @since 3.0.0 + */ + this.name = GetFastValue(config, 'name', 'map'); + /** + * The width of the entire tilemap. + * + * @name Phaser.Tilemaps.MapData#width + * @type {number} + * @since 3.0.0 + */ + this.width = GetFastValue(config, 'width', 0); -/***/ }), -/* 1400 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The height of the entire tilemap. + * + * @name Phaser.Tilemaps.MapData#height + * @type {number} + * @since 3.0.0 + */ + this.height = GetFastValue(config, 'height', 0); -/** -* The `Matter.Query` module contains methods for performing collision queries. -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class Query -*/ + /** + * If the map is infinite or not. + * + * @name Phaser.Tilemaps.MapData#infinite + * @type {boolean} + * @since 3.17.0 + */ + this.infinite = GetFastValue(config, 'infinite', false); -var Query = {}; + /** + * The width of the tiles. + * + * @name Phaser.Tilemaps.MapData#tileWidth + * @type {number} + * @since 3.0.0 + */ + this.tileWidth = GetFastValue(config, 'tileWidth', 0); -module.exports = Query; + /** + * The height of the tiles. + * + * @name Phaser.Tilemaps.MapData#tileHeight + * @type {number} + * @since 3.0.0 + */ + this.tileHeight = GetFastValue(config, 'tileHeight', 0); -var Vector = __webpack_require__(83); -var SAT = __webpack_require__(274); -var Bounds = __webpack_require__(84); -var Bodies = __webpack_require__(86); -var Vertices = __webpack_require__(64); + /** + * The width in pixels of the entire tilemap. + * + * @name Phaser.Tilemaps.MapData#widthInPixels + * @type {number} + * @since 3.0.0 + */ + this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.tileWidth); -(function() { + /** + * The height in pixels of the entire tilemap. + * + * @name Phaser.Tilemaps.MapData#heightInPixels + * @type {number} + * @since 3.0.0 + */ + this.heightInPixels = GetFastValue(config, 'heightInPixels', this.height * this.tileHeight); - /** - * Returns a list of collisions between `body` and `bodies`. - * @method collides - * @param {body} body - * @param {body[]} bodies - * @return {object[]} Collisions - */ - Query.collides = function(body, bodies) { - var collisions = []; + /** + * The format of the map data. + * + * @name Phaser.Tilemaps.MapData#format + * @type {number} + * @since 3.0.0 + */ + this.format = GetFastValue(config, 'format', null); - for (var i = 0; i < bodies.length; i++) { - var bodyA = bodies[i]; + /** + * The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'. + * + * @name Phaser.Tilemaps.MapData#orientation + * @type {Phaser.Tilemaps.OrientationType} + * @since 3.50.0 + */ + this.orientation = GetFastValue(config, 'orientation', CONST.ORTHOGONAL); - // Phaser addition - skip same body checks - if (body === bodyA) - { - continue; - } - - if (Bounds.overlaps(bodyA.bounds, body.bounds)) { - for (var j = bodyA.parts.length === 1 ? 0 : 1; j < bodyA.parts.length; j++) { - var part = bodyA.parts[j]; + /** + * Determines the draw order of tilemap. Default is right-down + * + * 0, or 'right-down' + * 1, or 'left-down' + * 2, or 'right-up' + * 3, or 'left-up' + * + * @name Phaser.Tilemaps.MapData#renderOrder + * @type {string} + * @since 3.12.0 + */ + this.renderOrder = GetFastValue(config, 'renderOrder', 'right-down'); - if (Bounds.overlaps(part.bounds, body.bounds)) { - var collision = SAT.collides(part, body); + /** + * The version of the map data (as specified in Tiled). + * + * @name Phaser.Tilemaps.MapData#version + * @type {string} + * @since 3.0.0 + */ + this.version = GetFastValue(config, 'version', '1'); - if (collision.collided) { - collisions.push(collision); - break; - } - } - } - } - } + /** + * Map specific properties (can be specified in Tiled) + * + * @name Phaser.Tilemaps.MapData#properties + * @type {object} + * @since 3.0.0 + */ + this.properties = GetFastValue(config, 'properties', {}); - return collisions; - }; + /** + * An array with all the layers configured to the MapData. + * + * @name Phaser.Tilemaps.MapData#layers + * @type {(Phaser.Tilemaps.LayerData[]|Phaser.Tilemaps.ObjectLayer)} + * @since 3.0.0 + */ + this.layers = GetFastValue(config, 'layers', []); - /** - * Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided. - * @method ray - * @param {body[]} bodies - * @param {vector} startPoint - * @param {vector} endPoint - * @param {number} [rayWidth] - * @return {object[]} Collisions - */ - Query.ray = function(bodies, startPoint, endPoint, rayWidth) { - rayWidth = rayWidth || 1e-100; + /** + * An array of Tiled Image Layers. + * + * @name Phaser.Tilemaps.MapData#images + * @type {array} + * @since 3.0.0 + */ + this.images = GetFastValue(config, 'images', []); - var rayAngle = Vector.angle(startPoint, endPoint), - rayLength = Vector.magnitude(Vector.sub(startPoint, endPoint)), - rayX = (endPoint.x + startPoint.x) * 0.5, - rayY = (endPoint.y + startPoint.y) * 0.5, - ray = Bodies.rectangle(rayX, rayY, rayLength, rayWidth, { angle: rayAngle }), - collisions = Query.collides(ray, bodies); + /** + * An object of Tiled Object Layers. + * + * @name Phaser.Tilemaps.MapData#objects + * @type {Phaser.Types.Tilemaps.ObjectLayerConfig[]} + * @since 3.0.0 + */ + this.objects = GetFastValue(config, 'objects', []); - for (var i = 0; i < collisions.length; i += 1) { - var collision = collisions[i]; - collision.body = collision.bodyB = collision.bodyA; + // Because Tiled can sometimes create an empty object if you don't populate it, not an empty array + if (!Array.isArray(this.objects)) + { + this.objects = []; } - return collisions; - }; + /** + * An object of collision data. Must be created as physics object or will return undefined. + * + * @name Phaser.Tilemaps.MapData#collision + * @type {object} + * @since 3.0.0 + */ + this.collision = GetFastValue(config, 'collision', {}); - /** - * Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies. - * @method region - * @param {body[]} bodies - * @param {bounds} bounds - * @param {bool} [outside=false] - * @return {body[]} The bodies matching the query - */ - Query.region = function(bodies, bounds, outside) { - var result = []; + /** + * An array of Tilesets. + * + * @name Phaser.Tilemaps.MapData#tilesets + * @type {Phaser.Tilemaps.Tileset[]} + * @since 3.0.0 + */ + this.tilesets = GetFastValue(config, 'tilesets', []); - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i], - overlaps = Bounds.overlaps(body.bounds, bounds); - if ((overlaps && !outside) || (!overlaps && outside)) - result.push(body); - } + /** + * The collection of images the map uses(specified in Tiled) + * + * @name Phaser.Tilemaps.MapData#imageCollections + * @type {array} + * @since 3.0.0 + */ + this.imageCollections = GetFastValue(config, 'imageCollections', []); - return result; - }; + /** + * An array of tile instances. + * + * @name Phaser.Tilemaps.MapData#tiles + * @type {array} + * @since 3.0.0 + */ + this.tiles = GetFastValue(config, 'tiles', []); - /** - * Returns all bodies whose vertices contain the given point, from the given set of bodies. - * @method point - * @param {body[]} bodies - * @param {vector} point - * @return {body[]} The bodies matching the query - */ - Query.point = function(bodies, point) { - var result = []; + /** + * The length of the horizontal sides of the hexagon. + * + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.MapData#hexSideLength + * @type {number} + * @since 3.50.0 + */ + this.hexSideLength = GetFastValue(config, 'hexSideLength', 0); - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - - if (Bounds.contains(body.bounds, point)) { - for (var j = body.parts.length === 1 ? 0 : 1; j < body.parts.length; j++) { - var part = body.parts[j]; + /** + * The Stagger Axis as defined in Tiled. + * + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.MapData#staggerAxis + * @type {string} + * @since 3.60.0 + */ + this.staggerAxis = GetFastValue(config, 'staggerAxis', 'y'); - if (Bounds.contains(part.bounds, point) - && Vertices.contains(part.vertices, point)) { - result.push(body); - break; - } - } - } - } + /** + * The Stagger Index as defined in Tiled. + * + * Either 'odd' or 'even'. + * + * Only used for hexagonal orientation Tilemaps. + * + * @name Phaser.Tilemaps.MapData#staggerIndex + * @type {string} + * @since 3.60.0 + */ + this.staggerIndex = GetFastValue(config, 'staggerIndex', 'odd'); + } - return result; - }; +}); -})(); +module.exports = MapData; /***/ }), -/* 1401 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 15256: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** -* The `Matter.Engine` module contains methods for creating and manipulating engines. -* An engine is a controller that manages updating the simulation of the world. -* See `Matter.Runner` for an optional game loop utility. -* -* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples). -* -* @class Engine -*/ + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -var Engine = {}; +var Class = __webpack_require__(56694); +var GetFastValue = __webpack_require__(72632); -module.exports = Engine; +/** + * @classdesc + * A class for representing a Tiled object layer in a map. This mirrors the structure of a Tiled + * object layer, except: + * - "x" & "y" properties are ignored since these cannot be changed in Tiled. + * - "offsetx" & "offsety" are applied to the individual object coordinates directly, so they + * are ignored as well. + * - "draworder" is ignored. + * + * @class ObjectLayer + * @memberof Phaser.Tilemaps + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Types.Tilemaps.ObjectLayerConfig} [config] - The data for the layer from the Tiled JSON object. + */ +var ObjectLayer = new Class({ -var World = __webpack_require__(596); -var Sleeping = __webpack_require__(165); -var Resolver = __webpack_require__(599); -var Pairs = __webpack_require__(598); -var Metrics = __webpack_require__(1523); -var Grid = __webpack_require__(597); -var Events = __webpack_require__(166); -var Composite = __webpack_require__(118); -var Constraint = __webpack_require__(128); -var Common = __webpack_require__(32); -var Body = __webpack_require__(41); + initialize: -(function() { + function ObjectLayer (config) + { + if (config === undefined) { config = {}; } - /** - * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. - * All properties have default values, and many are pre-calculated automatically based on other properties. - * See the properties section below for detailed information on what you can pass via the `options` object. - * @method create - * @param {object} [options] - * @return {engine} engine - */ - Engine.create = function(element, options) { - // options may be passed as the first (and only) argument - options = Common.isElement(element) ? options : element; - element = Common.isElement(element) ? element : null; - options = options || {}; + /** + * The name of the Object Layer. + * + * @name Phaser.Tilemaps.ObjectLayer#name + * @type {string} + * @since 3.0.0 + */ + this.name = GetFastValue(config, 'name', 'object layer'); - if (element || options.render) { - Common.warn('Engine.create: engine.render is deprecated (see docs)'); - } + /** + * The opacity of the layer, between 0 and 1. + * + * @name Phaser.Tilemaps.ObjectLayer#opacity + * @type {number} + * @since 3.0.0 + */ + this.opacity = GetFastValue(config, 'opacity', 1); - var defaults = { - positionIterations: 6, - velocityIterations: 4, - constraintIterations: 2, - enableSleeping: false, - events: [], - plugin: {}, - timing: { - timestamp: 0, - timeScale: 1 - }, - broadphase: { - controller: Grid - } - }; + /** + * The custom properties defined on the Object Layer, keyed by their name. + * + * @name Phaser.Tilemaps.ObjectLayer#properties + * @type {object} + * @since 3.0.0 + */ + this.properties = GetFastValue(config, 'properties', {}); - var engine = Common.extend(defaults, options); + /** + * The type of each custom property defined on the Object Layer, keyed by its name. + * + * @name Phaser.Tilemaps.ObjectLayer#propertyTypes + * @type {object} + * @since 3.0.0 + */ + this.propertyTypes = GetFastValue(config, 'propertytypes', {}); - engine.world = options.world || World.create(engine.world); - engine.pairs = Pairs.create(); - engine.broadphase = engine.broadphase.controller.create(engine.broadphase); - engine.metrics = engine.metrics || { extended: false }; + /** + * The type of the layer, which should be `objectgroup`. + * + * @name Phaser.Tilemaps.ObjectLayer#type + * @type {string} + * @since 3.0.0 + */ + this.type = GetFastValue(config, 'type', 'objectgroup'); - // @if DEBUG - engine.metrics = Metrics.create(engine.metrics); - // @endif + /** + * Whether the layer is shown (`true`) or hidden (`false`). + * + * @name Phaser.Tilemaps.ObjectLayer#visible + * @type {boolean} + * @since 3.0.0 + */ + this.visible = GetFastValue(config, 'visible', true); - return engine; - }; + /** + * An array of all objects on this Object Layer. + * + * Each Tiled object corresponds to a JavaScript object in this array. It has an `id` (unique), + * `name` (as assigned in Tiled), `type` (as assigned in Tiled), `rotation` (in clockwise degrees), + * `properties` (if any), `visible` state (`true` if visible, `false` otherwise), + * `x` and `y` coordinates (in pixels, relative to the tilemap), and a `width` and `height` (in pixels). + * + * An object tile has a `gid` property (GID of the represented tile), a `flippedHorizontal` property, + * a `flippedVertical` property, and `flippedAntiDiagonal` property. + * The {@link http://docs.mapeditor.org/en/latest/reference/tmx-map-format/|Tiled documentation} contains + * information on flipping and rotation. + * + * Polylines have a `polyline` property, which is an array of objects corresponding to points, + * where each point has an `x` property and a `y` property. Polygons have an identically structured + * array in their `polygon` property. Text objects have a `text` property with the text's properties. + * + * Rectangles and ellipses have a `rectangle` or `ellipse` property set to `true`. + * + * @name Phaser.Tilemaps.ObjectLayer#objects + * @type {Phaser.Types.Tilemaps.TiledObject[]} + * @since 3.0.0 + */ + this.objects = GetFastValue(config, 'objects', []); - /** - * Moves the simulation forward in time by `delta` ms. - * The `correction` argument is an optional `Number` that specifies the time correction factor to apply to the update. - * This can help improve the accuracy of the simulation in cases where `delta` is changing between updates. - * The value of `correction` is defined as `delta / lastDelta`, i.e. the percentage change of `delta` over the last step. - * Therefore the value is always `1` (no correction) when `delta` constant (or when no correction is desired, which is the default). - * See the paper on Time Corrected Verlet for more information. - * - * Triggers `beforeUpdate` and `afterUpdate` events. - * Triggers `collisionStart`, `collisionActive` and `collisionEnd` events. - * @method update - * @param {engine} engine - * @param {number} [delta=16.666] - * @param {number} [correction=1] - */ - Engine.update = function(engine, delta, correction) { - delta = delta || 1000 / 60; - correction = correction || 1; + // Because Tiled can sometimes create an empty object if you don't populate it, not an empty array + if (!Array.isArray(this.objects)) + { + this.objects = []; + } + } - var world = engine.world, - timing = engine.timing, - broadphase = engine.broadphase, - broadphasePairs = [], - i; +}); - // increment timestamp - timing.timestamp += delta * timing.timeScale; +module.exports = ObjectLayer; - // create an event object - var event = { - timestamp: timing.timestamp - }; - Events.trigger(engine, 'beforeUpdate', event); +/***/ }), - // get lists of all bodies and constraints, no matter what composites they are in - var allBodies = Composite.allBodies(world), - allConstraints = Composite.allConstraints(world); +/***/ 21394: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // @if DEBUG - // reset metrics logging - Metrics.reset(engine.metrics); - // @endif +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // if sleeping enabled, call the sleeping controller - if (engine.enableSleeping) - Sleeping.update(allBodies, timing.timeScale); +var CONST = __webpack_require__(12920); - // applies gravity to all bodies - Engine._bodiesApplyGravity(allBodies, world.gravity); +/** + * Get the Tilemap orientation from the given string. + * + * @function Phaser.Tilemaps.Parsers.FromOrientationString + * @since 3.50.0 + * + * @param {string} [orientation] - The orientation type as a string. + * + * @return {Phaser.Tilemaps.OrientationType} The Tilemap Orientation type. + */ +var FromOrientationString = function (orientation) +{ + orientation = orientation.toLowerCase(); - // update all body position and rotation by integration - Engine._bodiesUpdate(allBodies, delta, timing.timeScale, correction, world.bounds); + if (orientation === 'isometric') + { + return CONST.ISOMETRIC; + } + else if (orientation === 'staggered') + { + return CONST.STAGGERED; + } + else if (orientation === 'hexagonal') + { + return CONST.HEXAGONAL; + } + else + { + return CONST.ORTHOGONAL; + } +}; - // update all constraints (first pass) - Constraint.preSolveAll(allBodies); - for (i = 0; i < engine.constraintIterations; i++) { - Constraint.solveAll(allConstraints, timing.timeScale); - } - Constraint.postSolveAll(allBodies); +module.exports = FromOrientationString; - // broadphase pass: find potential collision pairs - if (broadphase.controller) { - // if world is dirty, we must flush the whole grid - if (world.isModified) - broadphase.controller.clear(broadphase); - // update the grid buckets based on current bodies - broadphase.controller.update(broadphase, allBodies, engine, world.isModified); - broadphasePairs = broadphase.pairsList; - } else { - // if no broadphase set, we just pass all bodies - broadphasePairs = allBodies; - } +/***/ }), - // clear all composite modified flags - if (world.isModified) { - Composite.setModified(world, false, false, true); - } +/***/ 90715: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // narrowphase pass: find actual collisions, then create or update collision pairs - var collisions = broadphase.detector(broadphasePairs, engine); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // update collision pairs - var pairs = engine.pairs, - timestamp = timing.timestamp; - Pairs.update(pairs, collisions, timestamp); - Pairs.removeOld(pairs, timestamp); +var Formats = __webpack_require__(93560); +var Parse2DArray = __webpack_require__(84346); +var ParseCSV = __webpack_require__(96097); +var ParseJSONTiled = __webpack_require__(2378); +var ParseWeltmeister = __webpack_require__(44909); - // wake up bodies involved in collisions - if (engine.enableSleeping) - Sleeping.afterCollisions(pairs.list, timing.timeScale); +/** + * Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format + * is found, returns `null`. When loading from CSV or a 2D array, you should specify the tileWidth & + * tileHeight. When parsing from a map from Tiled, the tileWidth & tileHeight will be pulled from + * the map data. + * + * @function Phaser.Tilemaps.Parsers.Parse + * @since 3.0.0 + * + * @param {string} name - The name of the tilemap, used to set the name on the MapData. + * @param {number} mapFormat - See ../Formats.js. + * @param {(number[][]|string|object)} data - 2D array, CSV string or Tiled JSON object. + * @param {number} tileWidth - The width of a tile in pixels. Required for 2D array and CSV, but + * ignored for Tiled JSON. + * @param {number} tileHeight - The height of a tile in pixels. Required for 2D array and CSV, but + * ignored for Tiled JSON. + * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map + * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty + * location will get a Tile object with an index of -1. If you've a large sparsely populated map and + * the tile data doesn't need to change then setting this value to `true` will help with memory + * consumption. However if your map is small or you need to update the tiles dynamically, then leave + * the default value set. + * + * @return {Phaser.Tilemaps.MapData} The created `MapData` object. + */ +var Parse = function (name, mapFormat, data, tileWidth, tileHeight, insertNull) +{ + var newMap; - // trigger collision events - if (pairs.collisionStart.length > 0) - Events.trigger(engine, 'collisionStart', { pairs: pairs.collisionStart }); + switch (mapFormat) + { + case (Formats.ARRAY_2D): + newMap = Parse2DArray(name, data, tileWidth, tileHeight, insertNull); + break; + case (Formats.CSV): + newMap = ParseCSV(name, data, tileWidth, tileHeight, insertNull); + break; + case (Formats.TILED_JSON): + newMap = ParseJSONTiled(name, data, insertNull); + break; + case (Formats.WELTMEISTER): + newMap = ParseWeltmeister(name, data, insertNull); + break; + default: + console.warn('Unrecognized tilemap data format: ' + mapFormat); + newMap = null; + } - // iteratively resolve position between collisions - Resolver.preSolvePosition(pairs.list); - for (i = 0; i < engine.positionIterations; i++) { - Resolver.solvePosition(pairs.list, allBodies, timing.timeScale); - } - Resolver.postSolvePosition(allBodies); + return newMap; +}; - // update all constraints (second pass) - Constraint.preSolveAll(allBodies); - for (i = 0; i < engine.constraintIterations; i++) { - Constraint.solveAll(allConstraints, timing.timeScale); - } - Constraint.postSolveAll(allBodies); +module.exports = Parse; - // iteratively resolve velocity between collisions - Resolver.preSolveVelocity(pairs.list); - for (i = 0; i < engine.velocityIterations; i++) { - Resolver.solveVelocity(pairs.list, timing.timeScale); - } - // trigger collision events - if (pairs.collisionActive.length > 0) - Events.trigger(engine, 'collisionActive', { pairs: pairs.collisionActive }); +/***/ }), - if (pairs.collisionEnd.length > 0) - Events.trigger(engine, 'collisionEnd', { pairs: pairs.collisionEnd }); +/***/ 84346: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // @if DEBUG - // update metrics log - Metrics.update(engine.metrics, engine); - // @endif +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // clear force buffers - Engine._bodiesClearForces(allBodies); +var Formats = __webpack_require__(93560); +var LayerData = __webpack_require__(94990); +var MapData = __webpack_require__(16586); +var Tile = __webpack_require__(29633); - Events.trigger(engine, 'afterUpdate', event); +/** + * Parses a 2D array of tile indexes into a new MapData object with a single layer. + * + * @function Phaser.Tilemaps.Parsers.Parse2DArray + * @since 3.0.0 + * + * @param {string} name - The name of the tilemap, used to set the name on the MapData. + * @param {number[][]} data - 2D array, CSV string or Tiled JSON object. + * @param {number} tileWidth - The width of a tile in pixels. + * @param {number} tileHeight - The height of a tile in pixels. + * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map + * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty + * location will get a Tile object with an index of -1. If you've a large sparsely populated map and + * the tile data doesn't need to change then setting this value to `true` will help with memory + * consumption. However if your map is small or you need to update the tiles dynamically, then leave + * the default value set. + * + * @return {Phaser.Tilemaps.MapData} The MapData object. + */ +var Parse2DArray = function (name, data, tileWidth, tileHeight, insertNull) +{ + var layerData = new LayerData({ + tileWidth: tileWidth, + tileHeight: tileHeight + }); - return engine; - }; - - /** - * Merges two engines by keeping the configuration of `engineA` but replacing the world with the one from `engineB`. - * @method merge - * @param {engine} engineA - * @param {engine} engineB - */ - Engine.merge = function(engineA, engineB) { - Common.extend(engineA, engineB); - - if (engineB.world) { - engineA.world = engineB.world; + var mapData = new MapData({ + name: name, + tileWidth: tileWidth, + tileHeight: tileHeight, + format: Formats.ARRAY_2D, + layers: [ layerData ] + }); - Engine.clear(engineA); + var tiles = []; + var height = data.length; + var width = 0; - var bodies = Composite.allBodies(engineA.world); + for (var y = 0; y < data.length; y++) + { + tiles[y] = []; + var row = data[y]; - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - Sleeping.set(body, false); - body.id = Common.nextId(); + for (var x = 0; x < row.length; x++) + { + var tileIndex = parseInt(row[x], 10); + + if (isNaN(tileIndex) || tileIndex === -1) + { + tiles[y][x] = insertNull + ? null + : new Tile(layerData, -1, x, y, tileWidth, tileHeight); + } + else + { + tiles[y][x] = new Tile(layerData, tileIndex, x, y, tileWidth, tileHeight); } } - }; - - /** - * Clears the engine including the world, pairs and broadphase. - * @method clear - * @param {engine} engine - */ - Engine.clear = function(engine) { - var world = engine.world; - - Pairs.clear(engine.pairs); - var broadphase = engine.broadphase; - if (broadphase.controller) { - var bodies = Composite.allBodies(world); - broadphase.controller.clear(broadphase); - broadphase.controller.update(broadphase, bodies, engine, true); + if (width === 0) + { + width = row.length; } - }; + } - /** - * Zeroes the `body.force` and `body.torque` force buffers. - * @method _bodiesClearForces - * @private - * @param {body[]} bodies - */ - Engine._bodiesClearForces = function(bodies) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; + mapData.width = layerData.width = width; + mapData.height = layerData.height = height; + mapData.widthInPixels = layerData.widthInPixels = width * tileWidth; + mapData.heightInPixels = layerData.heightInPixels = height * tileHeight; + layerData.data = tiles; - // reset force buffers - body.force.x = 0; - body.force.y = 0; - body.torque = 0; - } - }; + return mapData; +}; - /** - * Applys a mass dependant force to all given bodies. - * @method _bodiesApplyGravity - * @private - * @param {body[]} bodies - * @param {vector} gravity - */ - Engine._bodiesApplyGravity = function(bodies, gravity) { - var gravityScale = typeof gravity.scale !== 'undefined' ? gravity.scale : 0.001; +module.exports = Parse2DArray; - if ((gravity.x === 0 && gravity.y === 0) || gravityScale === 0) { - return; - } - - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; - if (body.ignoreGravity || body.isStatic || body.isSleeping) - continue; +/***/ }), - // apply gravity - body.force.x += (body.mass * gravity.x * gravityScale) * body.gravityScale.x; - body.force.y += (body.mass * gravity.y * gravityScale) * body.gravityScale.y; - } - }; +/***/ 96097: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Applys `Body.update` to all given `bodies`. - * @method _bodiesUpdate - * @private - * @param {body[]} bodies - * @param {number} deltaTime - * The amount of time elapsed between updates - * @param {number} timeScale - * @param {number} correction - * The Verlet correction factor (deltaTime / lastDeltaTime) - * @param {bounds} worldBounds - */ - Engine._bodiesUpdate = function(bodies, deltaTime, timeScale, correction, worldBounds) { - for (var i = 0; i < bodies.length; i++) { - var body = bodies[i]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (body.isStatic || body.isSleeping) - continue; +var Formats = __webpack_require__(93560); +var Parse2DArray = __webpack_require__(84346); - Body.update(body, deltaTime, timeScale, correction); - } - }; +/** + * Parses a CSV string of tile indexes into a new MapData object with a single layer. + * + * @function Phaser.Tilemaps.Parsers.ParseCSV + * @since 3.0.0 + * + * @param {string} name - The name of the tilemap, used to set the name on the MapData. + * @param {string} data - CSV string of tile indexes. + * @param {number} tileWidth - The width of a tile in pixels. + * @param {number} tileHeight - The height of a tile in pixels. + * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map + * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty + * location will get a Tile object with an index of -1. If you've a large sparsely populated map and + * the tile data doesn't need to change then setting this value to `true` will help with memory + * consumption. However if your map is small or you need to update the tiles dynamically, then leave + * the default value set. + * + * @return {Phaser.Tilemaps.MapData} The resulting MapData object. + */ +var ParseCSV = function (name, data, tileWidth, tileHeight, insertNull) +{ + var array2D = data + .trim() + .split('\n') + .map(function (row) { return row.split(','); }); - /** - * An alias for `Runner.run`, see `Matter.Runner` for more information. - * @method run - * @param {engine} engine - */ + var map = Parse2DArray(name, array2D, tileWidth, tileHeight, insertNull); + map.format = Formats.CSV; - /** - * Fired just before an update - * - * @event beforeUpdate - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ + return map; +}; - /** - * Fired after engine update and all collision events - * - * @event afterUpdate - * @param {} event An event object - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ +module.exports = ParseCSV; - /** - * Fired after engine update, provides a list of all pairs that have started to collide in the current tick (if any) - * - * @event collisionStart - * @param {} event An event object - * @param {} event.pairs List of affected pairs - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ - /** - * Fired after engine update, provides a list of all pairs that are colliding in the current tick (if any) - * - * @event collisionActive - * @param {} event An event object - * @param {} event.pairs List of affected pairs - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ +/***/ }), - /** - * Fired after engine update, provides a list of all pairs that have ended collision in the current tick (if any) - * - * @event collisionEnd - * @param {} event An event object - * @param {} event.pairs List of affected pairs - * @param {number} event.timestamp The engine.timing.timestamp of the event - * @param {} event.source The source object of the event - * @param {} event.name The name of the event - */ +/***/ 30951: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /* - * - * Properties Documentation - * - */ +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * An integer `Number` that specifies the number of position iterations to perform each update. - * The higher the value, the higher quality the simulation will be at the expense of performance. - * - * @property positionIterations - * @type number - * @default 6 - */ +var LayerData = __webpack_require__(94990); +var Tile = __webpack_require__(29633); - /** - * An integer `Number` that specifies the number of velocity iterations to perform each update. - * The higher the value, the higher quality the simulation will be at the expense of performance. - * - * @property velocityIterations - * @type number - * @default 4 - */ +/** + * Parses all tilemap layers in an Impact JSON object into new LayerData objects. + * + * @function Phaser.Tilemaps.Parsers.Impact.ParseTileLayers + * @since 3.0.0 + * + * @param {object} json - The Impact JSON object. + * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map + * data are handled (see {@link Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled}). + * + * @return {Phaser.Tilemaps.LayerData[]} - An array of LayerData objects, one for each entry in + * json.layers with the type 'tilelayer'. + */ +var ParseTileLayers = function (json, insertNull) +{ + var tileLayers = []; - /** - * An integer `Number` that specifies the number of constraint iterations to perform each update. - * The higher the value, the higher quality the simulation will be at the expense of performance. - * The default value of `2` is usually very adequate. - * - * @property constraintIterations - * @type number - * @default 2 - */ + for (var i = 0; i < json.layer.length; i++) + { + var layer = json.layer[i]; - /** - * A flag that specifies whether the engine should allow sleeping via the `Matter.Sleeping` module. - * Sleeping can improve stability and performance, but often at the expense of accuracy. - * - * @property enableSleeping - * @type boolean - * @default false - */ + var layerData = new LayerData({ + name: layer.name, + width: layer.width, + height: layer.height, + tileWidth: layer.tilesize, + tileHeight: layer.tilesize, + visible: layer.visible === 1 + }); - /** - * An `Object` containing properties regarding the timing systems of the engine. - * - * @property timing - * @type object - */ + var row = []; + var tileGrid = []; - /** - * A `Number` that specifies the global scaling factor of time for all bodies. - * A value of `0` freezes the simulation. - * A value of `0.1` gives a slow-motion effect. - * A value of `1.2` gives a speed-up effect. - * - * @property timing.timeScale - * @type number - * @default 1 - */ + // Loop through the data field in the JSON. This is a 2D array containing the tile indexes, + // one after the other. The indexes are relative to the tileset that contains the tile. + for (var y = 0; y < layer.data.length; y++) + { + for (var x = 0; x < layer.data[y].length; x++) + { + // In Weltmeister, 0 = no tile, but the Tilemap API expects -1 = no tile. + var index = layer.data[y][x] - 1; - /** - * A `Number` that specifies the current simulation-time in milliseconds starting from `0`. - * It is incremented on every `Engine.update` by the given `delta` argument. - * - * @property timing.timestamp - * @type number - * @default 0 - */ + var tile; - /** - * An instance of a `Render` controller. The default value is a `Matter.Render` instance created by `Engine.create`. - * One may also develop a custom renderer module based on `Matter.Render` and pass an instance of it to `Engine.create` via `options.render`. - * - * A minimal custom renderer object must define at least three functions: `create`, `clear` and `world` (see `Matter.Render`). - * It is also possible to instead pass the _module_ reference via `options.render.controller` and `Engine.create` will instantiate one for you. - * - * @property render - * @type render - * @deprecated see Demo.js for an example of creating a renderer - * @default a Matter.Render instance - */ + if (index > -1) + { + tile = new Tile(layerData, index, x, y, layer.tilesize, layer.tilesize); + } + else + { + tile = insertNull + ? null + : new Tile(layerData, -1, x, y, layer.tilesize, layer.tilesize); + } - /** - * An instance of a broadphase controller. The default value is a `Matter.Grid` instance created by `Engine.create`. - * - * @property broadphase - * @type grid - * @default a Matter.Grid instance - */ + row.push(tile); + } + + tileGrid.push(row); + row = []; + } + + layerData.data = tileGrid; - /** - * A `World` composite object that will contain all simulated bodies and constraints. - * - * @property world - * @type world - * @default a Matter.World instance - */ + tileLayers.push(layerData); + } - /** - * An object reserved for storing plugin-specific properties. - * - * @property plugin - * @type {} - */ + return tileLayers; +}; -})(); +module.exports = ParseTileLayers; /***/ }), -/* 1402 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 47488: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bodies = __webpack_require__(86); -var Body = __webpack_require__(41); -var Class = __webpack_require__(0); -var Common = __webpack_require__(32); -var Composite = __webpack_require__(118); -var Engine = __webpack_require__(1401); -var EventEmitter = __webpack_require__(9); -var Events = __webpack_require__(272); -var GetFastValue = __webpack_require__(2); -var GetValue = __webpack_require__(6); -var MatterBody = __webpack_require__(41); -var MatterEvents = __webpack_require__(166); -var MatterTileBody = __webpack_require__(593); -var MatterWorld = __webpack_require__(596); -var Vector = __webpack_require__(83); +var Tileset = __webpack_require__(47975); /** - * @classdesc - * The Matter World class is responsible for managing one single instance of a Matter Physics World for Phaser. - * - * Access this via `this.matter.world` from within a Scene. - * - * This class creates a Matter JS World Composite along with the Matter JS Engine during instantiation. It also - * handles delta timing, bounds, body and constraint creation and debug drawing. - * - * If you wish to access the Matter JS World object directly, see the `localWorld` property. - * If you wish to access the Matter Engine directly, see the `engine` property. - * - * This class is an Event Emitter and will proxy _all_ Matter JS events, as they are received. + * Tilesets and Image Collections * - * @class World - * @extends Phaser.Events.EventEmitter - * @memberof Phaser.Physics.Matter - * @constructor + * @function Phaser.Tilemaps.Parsers.Impact.ParseTilesets * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene to which this Matter World instance belongs. - * @param {Phaser.Types.Physics.Matter.MatterWorldConfig} config - The Matter World configuration object. + * @param {object} json - The Impact JSON data. + * + * @return {array} An array of Tilesets. */ -var World = new Class({ +var ParseTilesets = function (json) +{ + var tilesets = []; + var tilesetsNames = []; - Extends: EventEmitter, + for (var i = 0; i < json.layer.length; i++) + { + var layer = json.layer[i]; - initialize: + // A relative filepath to the source image (within Weltmeister) is used for the name + var tilesetName = layer.tilesetName; - function World (scene, config) - { - EventEmitter.call(this); + // Only add unique tilesets that have a valid name. Collision layers will have a blank name. + if (tilesetName !== '' && tilesetsNames.indexOf(tilesetName) === -1) + { + tilesetsNames.push(tilesetName); - /** - * The Scene to which this Matter World instance belongs. - * - * @name Phaser.Physics.Matter.World#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; + // Tiles are stored with an ID relative to the tileset, rather than a globally unique ID + // across all tilesets. Also, tilesets in Weltmeister have no margin or padding. + tilesets.push(new Tileset(tilesetName, 0, layer.tilesize, layer.tilesize, 0, 0)); + } + } - /** - * An instance of the MatterJS Engine. - * - * @name Phaser.Physics.Matter.World#engine - * @type {MatterJS.Engine} - * @since 3.0.0 - */ - this.engine = Engine.create(config); + return tilesets; +}; - /** - * A `World` composite object that will contain all simulated bodies and constraints. - * - * @name Phaser.Physics.Matter.World#localWorld - * @type {MatterJS.World} - * @since 3.0.0 - */ - this.localWorld = this.engine.world; +module.exports = ParseTilesets; - var gravity = GetValue(config, 'gravity', null); - if (gravity) - { - this.setGravity(gravity.x, gravity.y, gravity.scale); - } - else if (gravity === false) - { - this.setGravity(0, 0, 0); - } +/***/ }), - /** - * An object containing the 4 wall bodies that bound the physics world. - * - * @name Phaser.Physics.Matter.World#walls - * @type {object} - * @since 3.0.0 - */ - this.walls = { left: null, right: null, top: null, bottom: null }; +/***/ 44909: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * A flag that toggles if the world is enabled or not. - * - * @name Phaser.Physics.Matter.World#enabled - * @type {boolean} - * @default true - * @since 3.0.0 - */ - this.enabled = GetValue(config, 'enabled', true); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The correction argument is an optional Number that specifies the time correction factor to apply to the update. - * This can help improve the accuracy of the simulation in cases where delta is changing between updates. - * The value of correction is defined as delta / lastDelta, i.e. the percentage change of delta over the last step. - * Therefore the value is always 1 (no correction) when delta is constant (or when no correction is desired, which is the default). - * See the paper on Time Corrected Verlet for more information. - * - * @name Phaser.Physics.Matter.World#correction - * @type {number} - * @default 1 - * @since 3.4.0 - */ - this.correction = GetValue(config, 'correction', 1); +var Formats = __webpack_require__(93560); +var MapData = __webpack_require__(16586); +var ParseTileLayers = __webpack_require__(30951); +var ParseTilesets = __webpack_require__(47488); - /** - * This function is called every time the core game loop steps, which is bound to the - * Request Animation Frame frequency unless otherwise modified. - * - * The function is passed two values: `time` and `delta`, both of which come from the game step values. - * - * It must return a number. This number is used as the delta value passed to Matter.Engine.update. - * - * You can override this function with your own to define your own timestep. - * - * If you need to update the Engine multiple times in a single game step then call - * `World.update` as many times as required. Each call will trigger the `getDelta` function. - * If you wish to have full control over when the Engine updates then see the property `autoUpdate`. - * - * You can also adjust the number of iterations that Engine.update performs. - * Use the Scene Matter Physics config object to set the following properties: - * - * positionIterations (defaults to 6) - * velocityIterations (defaults to 4) - * constraintIterations (defaults to 2) - * - * Adjusting these values can help performance in certain situations, depending on the physics requirements - * of your game. - * - * @name Phaser.Physics.Matter.World#getDelta - * @type {function} - * @since 3.4.0 - */ - this.getDelta = GetValue(config, 'getDelta', this.update60Hz); +/** + * Parses a Weltmeister JSON object into a new MapData object. + * + * @function Phaser.Tilemaps.Parsers.Impact.ParseWeltmeister + * @since 3.0.0 + * + * @param {string} name - The name of the tilemap, used to set the name on the MapData. + * @param {object} json - The Weltmeister JSON object. + * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map + * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty + * location will get a Tile object with an index of -1. If you've a large sparsely populated map and + * the tile data doesn't need to change then setting this value to `true` will help with memory + * consumption. However if your map is small or you need to update the tiles dynamically, then leave + * the default value set. + * + * @return {?Phaser.Tilemaps.MapData} The created MapData object, or `null` if the data can't be parsed. + */ +var ParseWeltmeister = function (name, json, insertNull) +{ + if (json.layer.length === 0) + { + console.warn('No layers found in the Weltmeister map: ' + name); + return null; + } - var runnerConfig = GetFastValue(config, 'runner', {}); + var width = 0; + var height = 0; - var hasFPS = GetFastValue(runnerConfig, 'fps', false); + for (var i = 0; i < json.layer.length; i++) + { + if (json.layer[i].width > width) { width = json.layer[i].width; } + if (json.layer[i].height > height) { height = json.layer[i].height; } + } - var fps = GetFastValue(runnerConfig, 'fps', 60); + var mapData = new MapData({ + width: width, + height: height, + name: name, + tileWidth: json.layer[0].tilesize, + tileHeight: json.layer[0].tilesize, + format: Formats.WELTMEISTER + }); - var delta = GetFastValue(runnerConfig, 'delta', 1000 / fps); - var deltaMin = GetFastValue(runnerConfig, 'deltaMin', 1000 / fps); - var deltaMax = GetFastValue(runnerConfig, 'deltaMax', 1000 / (fps * 0.5)); + mapData.layers = ParseTileLayers(json, insertNull); + mapData.tilesets = ParseTilesets(json); - if (!hasFPS) - { - fps = 1000 / delta; - } + return mapData; +}; - /** - * The Matter JS Runner Configuration object. - * - * This object is populated via the Matter Configuration object's `runner` property and is - * updated constantly during the game step. - * - * @name Phaser.Physics.Matter.World#runner - * @type {Phaser.Types.Physics.Matter.MatterRunnerConfig} - * @since 3.22.0 - */ - this.runner = { - fps: fps, - correction: GetFastValue(runnerConfig, 'correction', 1), - deltaSampleSize: GetFastValue(runnerConfig, 'deltaSampleSize', 60), - counterTimestamp: 0, - frameCounter: 0, - deltaHistory: [], - timePrev: null, - timeScalePrev: 1, - frameRequestId: null, - isFixed: GetFastValue(runnerConfig, 'isFixed', false), - delta: delta, - deltaMin: deltaMin, - deltaMax: deltaMax - }; +module.exports = ParseWeltmeister; - /** - * Automatically call Engine.update every time the game steps. - * If you disable this then you are responsible for calling `World.step` directly from your game. - * If you call `set60Hz` or `set30Hz` then `autoUpdate` is reset to `true`. - * - * @name Phaser.Physics.Matter.World#autoUpdate - * @type {boolean} - * @default true - * @since 3.4.0 - */ - this.autoUpdate = GetValue(config, 'autoUpdate', true); - var debugConfig = GetValue(config, 'debug', false); +/***/ }), - /** - * A flag that controls if the debug graphics will be drawn to or not. - * - * @name Phaser.Physics.Matter.World#drawDebug - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.drawDebug = (typeof(debugConfig) === 'object') ? true : debugConfig; +/***/ 24507: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * An instance of the Graphics object the debug bodies are drawn to, if enabled. - * - * @name Phaser.Physics.Matter.World#debugGraphic - * @type {Phaser.GameObjects.Graphics} - * @since 3.0.0 - */ - this.debugGraphic; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * The debug configuration object. - * - * The values stored in this object are read from the Matter World Config `debug` property. - * - * When a new Body or Constraint is _added to the World_, they are given the values stored in this object, - * unless they have their own `render` object set that will override them. - * - * Note that while you can modify the values of properties in this object at run-time, it will not change - * any of the Matter objects _already added_. It will only impact objects newly added to the world, or one - * that is removed and then re-added at a later time. - * - * @name Phaser.Physics.Matter.World#debugConfig - * @type {Phaser.Types.Physics.Matter.MatterDebugConfig} - * @since 3.22.0 - */ - this.debugConfig = { - showAxes: GetFastValue(debugConfig, 'showAxes', false), - showAngleIndicator: GetFastValue(debugConfig, 'showAngleIndicator', false), - angleColor: GetFastValue(debugConfig, 'angleColor', 0xe81153), +/** + * @namespace Phaser.Tilemaps.Parsers.Impact + */ - showBroadphase: GetFastValue(debugConfig, 'showBroadphase', false), - broadphaseColor: GetFastValue(debugConfig, 'broadphaseColor', 0xffb400), +module.exports = { - showBounds: GetFastValue(debugConfig, 'showBounds', false), - boundsColor: GetFastValue(debugConfig, 'boundsColor', 0xffffff), + ParseTileLayers: __webpack_require__(30951), + ParseTilesets: __webpack_require__(47488), + ParseWeltmeister: __webpack_require__(44909) - showVelocity: GetFastValue(debugConfig, 'showVelocity', false), - velocityColor: GetFastValue(debugConfig, 'velocityColor', 0x00aeef), +}; - showCollisions: GetFastValue(debugConfig, 'showCollisions', false), - collisionColor: GetFastValue(debugConfig, 'collisionColor', 0xf5950c), - showSeparations: GetFastValue(debugConfig, 'showSeparations', false), - separationColor: GetFastValue(debugConfig, 'separationColor', 0xffa500), +/***/ }), - showBody: GetFastValue(debugConfig, 'showBody', true), - showStaticBody: GetFastValue(debugConfig, 'showStaticBody', true), - showInternalEdges: GetFastValue(debugConfig, 'showInternalEdges', false), +/***/ 34124: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - renderFill: GetFastValue(debugConfig, 'renderFill', false), - renderLine: GetFastValue(debugConfig, 'renderLine', true), +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - fillColor: GetFastValue(debugConfig, 'fillColor', 0x106909), - fillOpacity: GetFastValue(debugConfig, 'fillOpacity', 1), - lineColor: GetFastValue(debugConfig, 'lineColor', 0x28de19), - lineOpacity: GetFastValue(debugConfig, 'lineOpacity', 1), - lineThickness: GetFastValue(debugConfig, 'lineThickness', 1), +/** + * @namespace Phaser.Tilemaps.Parsers + */ - staticFillColor: GetFastValue(debugConfig, 'staticFillColor', 0x0d177b), - staticLineColor: GetFastValue(debugConfig, 'staticLineColor', 0x1327e4), +module.exports = { - showSleeping: GetFastValue(debugConfig, 'showSleeping', false), - staticBodySleepOpacity: GetFastValue(debugConfig, 'staticBodySleepOpacity', 0.7), - sleepFillColor: GetFastValue(debugConfig, 'sleepFillColor', 0x464646), - sleepLineColor: GetFastValue(debugConfig, 'sleepLineColor', 0x999a99), + FromOrientationString: __webpack_require__(21394), + Parse: __webpack_require__(90715), + Parse2DArray: __webpack_require__(84346), + ParseCSV: __webpack_require__(96097), - showSensors: GetFastValue(debugConfig, 'showSensors', true), - sensorFillColor: GetFastValue(debugConfig, 'sensorFillColor', 0x0d177b), - sensorLineColor: GetFastValue(debugConfig, 'sensorLineColor', 0x1327e4), + Impact: __webpack_require__(24507), + Tiled: __webpack_require__(50044) - showPositions: GetFastValue(debugConfig, 'showPositions', true), - positionSize: GetFastValue(debugConfig, 'positionSize', 4), - positionColor: GetFastValue(debugConfig, 'positionColor', 0xe042da), +}; - showJoint: GetFastValue(debugConfig, 'showJoint', true), - jointColor: GetFastValue(debugConfig, 'jointColor', 0xe0e042), - jointLineOpacity: GetFastValue(debugConfig, 'jointLineOpacity', 1), - jointLineThickness: GetFastValue(debugConfig, 'jointLineThickness', 2), - pinSize: GetFastValue(debugConfig, 'pinSize', 4), - pinColor: GetFastValue(debugConfig, 'pinColor', 0x42e0e0), +/***/ }), - springColor: GetFastValue(debugConfig, 'springColor', 0xe042e0), +/***/ 48646: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - anchorColor: GetFastValue(debugConfig, 'anchorColor', 0xefefef), - anchorSize: GetFastValue(debugConfig, 'anchorSize', 4), +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - showConvexHulls: GetFastValue(debugConfig, 'showConvexHulls', false), - hullColor: GetFastValue(debugConfig, 'hullColor', 0xd703d0) - }; +var Extend = __webpack_require__(98611); - if (this.drawDebug) - { - this.createDebugGraphic(); - } +/** + * Copy properties from tileset to tiles. + * + * @function Phaser.Tilemaps.Parsers.Tiled.AssignTileProperties + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.MapData} mapData - The Map Data object. + */ +var AssignTileProperties = function (mapData) +{ + var layerData; + var tile; + var sid; + var set; + var row; - this.setEventsProxy(); + // go through each of the map data layers + for (var i = 0; i < mapData.layers.length; i++) + { + layerData = mapData.layers[i]; - // Create the walls + set = null; - if (GetFastValue(config, 'setBounds', false)) + // rows of tiles + for (var j = 0; j < layerData.data.length; j++) { - var boundsConfig = config['setBounds']; + row = layerData.data[j]; - if (typeof boundsConfig === 'boolean') - { - this.setBounds(); - } - else + // individual tiles + for (var k = 0; k < row.length; k++) { - var x = GetFastValue(boundsConfig, 'x', 0); - var y = GetFastValue(boundsConfig, 'y', 0); - var width = GetFastValue(boundsConfig, 'width', scene.sys.scale.width); - var height = GetFastValue(boundsConfig, 'height', scene.sys.scale.height); - var thickness = GetFastValue(boundsConfig, 'thickness', 64); - var left = GetFastValue(boundsConfig, 'left', true); - var right = GetFastValue(boundsConfig, 'right', true); - var top = GetFastValue(boundsConfig, 'top', true); - var bottom = GetFastValue(boundsConfig, 'bottom', true); + tile = row[k]; - this.setBounds(x, y, width, height, thickness, left, right, top, bottom); + if (tile === null || tile.index < 0) + { + continue; + } + + // find the relevant tileset + sid = mapData.tiles[tile.index][2]; + set = mapData.tilesets[sid]; + + // Ensure that a tile's size matches its tileset + tile.width = set.tileWidth; + tile.height = set.tileHeight; + + // if that tile type has any properties, add them to the tile object + if (set.tileProperties && set.tileProperties[tile.index - set.firstgid]) + { + tile.properties = Extend( + tile.properties, set.tileProperties[tile.index - set.firstgid] + ); + } } } - }, + } +}; - /** - * Sets the debug render style for the children of the given Matter Composite. - * - * Composites themselves do not render, but they can contain bodies, constraints and other composites that may do. - * So the children of this composite are passed to the `setBodyRenderStyle`, `setCompositeRenderStyle` and - * `setConstraintRenderStyle` methods accordingly. - * - * @method Phaser.Physics.Matter.World#setCompositeRenderStyle - * @since 3.22.0 - * - * @param {MatterJS.CompositeType} composite - The Matter Composite to set the render style on. - * - * @return {this} This Matter World instance for method chaining. - */ - setCompositeRenderStyle: function (composite) - { - var bodies = composite.bodies; - var constraints = composite.constraints; - var composites = composite.composites; +module.exports = AssignTileProperties; - var i; - var obj; - var render; - for (i = 0; i < bodies.length; i++) - { - obj = bodies[i]; - render = obj.render; +/***/ }), - this.setBodyRenderStyle(obj, render.lineColor, render.lineOpacity, render.lineThickness, render.fillColor, render.fillOpacity); - } +/***/ 43908: +/***/ ((module) => { - for (i = 0; i < constraints.length; i++) - { - obj = constraints[i]; - render = obj.render; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.setConstraintRenderStyle(obj, render.lineColor, render.lineOpacity, render.lineThickness, render.pinSize, render.anchorColor, render.anchorSize); - } +/** + * Decode base-64 encoded data, for example as exported by Tiled. + * + * @function Phaser.Tilemaps.Parsers.Tiled.Base64Decode + * @since 3.0.0 + * + * @param {object} data - Base-64 encoded data to decode. + * + * @return {array} Array containing the decoded bytes. + */ +var Base64Decode = function (data) +{ + var binaryString = window.atob(data); + var len = binaryString.length; + var bytes = new Array(len / 4); - for (i = 0; i < composites.length; i++) - { - obj = composites[i]; + // Interpret binaryString as an array of bytes representing little-endian encoded uint32 values. + for (var i = 0; i < len; i += 4) + { + bytes[i / 4] = ( + binaryString.charCodeAt(i) | + binaryString.charCodeAt(i + 1) << 8 | + binaryString.charCodeAt(i + 2) << 16 | + binaryString.charCodeAt(i + 3) << 24 + ) >>> 0; + } - this.setCompositeRenderStyle(obj); - } + return bytes; +}; - return this; - }, +module.exports = Base64Decode; - /** - * Sets the debug render style for the given Matter Body. - * - * If you are using this on a Phaser Game Object, such as a Matter Sprite, then pass in the body property - * to this method, not the Game Object itself. - * - * If you wish to skip a parameter, so it retains its current value, pass `false` for it. - * - * If you wish to reset the Body render colors to the defaults found in the World Debug Config, then call - * this method with just the `body` parameter provided and no others. - * - * @method Phaser.Physics.Matter.World#setBodyRenderStyle - * @since 3.22.0 - * - * @param {MatterJS.BodyType} body - The Matter Body to set the render style on. - * @param {number} [lineColor] - The line color. If `null` it will use the World Debug Config value. - * @param {number} [lineOpacity] - The line opacity, between 0 and 1. If `null` it will use the World Debug Config value. - * @param {number} [lineThickness] - The line thickness. If `null` it will use the World Debug Config value. - * @param {number} [fillColor] - The fill color. If `null` it will use the World Debug Config value. - * @param {number} [fillOpacity] - The fill opacity, between 0 and 1. If `null` it will use the World Debug Config value. - * - * @return {this} This Matter World instance for method chaining. - */ - setBodyRenderStyle: function (body, lineColor, lineOpacity, lineThickness, fillColor, fillOpacity) - { - var render = body.render; - var config = this.debugConfig; - if (!render) - { - return this; - } +/***/ }), - if (lineColor === undefined || lineColor === null) - { - lineColor = (body.isStatic) ? config.staticLineColor : config.lineColor; - } +/***/ 14556: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (lineOpacity === undefined || lineOpacity === null) - { - lineOpacity = config.lineOpacity; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (lineThickness === undefined || lineThickness === null) - { - lineThickness = config.lineThickness; - } +var Tileset = __webpack_require__(47975); - if (fillColor === undefined || fillColor === null) - { - fillColor = (body.isStatic) ? config.staticFillColor : config.fillColor; - } +/** + * Master list of tiles -> x, y, index in tileset. + * + * @function Phaser.Tilemaps.Parsers.Tiled.BuildTilesetIndex + * @since 3.0.0 + * + * @param {Phaser.Tilemaps.MapData} mapData - The Map Data object. + * + * @return {array} An array of Tileset objects. + */ +var BuildTilesetIndex = function (mapData) +{ + var i; + var set; + var tiles = []; - if (fillOpacity === undefined || fillOpacity === null) - { - fillOpacity = config.fillOpacity; - } + for (i = 0; i < mapData.imageCollections.length; i++) + { + var collection = mapData.imageCollections[i]; + var images = collection.images; - if (lineColor !== false) + for (var j = 0; j < images.length; j++) { - render.lineColor = lineColor; - } + var image = images[j]; - if (lineOpacity !== false) - { - render.lineOpacity = lineOpacity; - } + set = new Tileset(image.image, image.gid, collection.imageWidth, collection.imageHeight, 0, 0); - if (lineThickness !== false) - { - render.lineThickness = lineThickness; - } + set.updateTileData(collection.imageWidth, collection.imageHeight); - if (fillColor !== false) - { - render.fillColor = fillColor; + mapData.tilesets.push(set); } + } - if (fillOpacity !== false) - { - render.fillOpacity = fillOpacity; - } + for (i = 0; i < mapData.tilesets.length; i++) + { + set = mapData.tilesets[i]; - return this; - }, + var x = set.tileMargin; + var y = set.tileMargin; - /** - * Sets the debug render style for the given Matter Constraint. - * - * If you are using this on a Phaser Game Object, then pass in the body property - * to this method, not the Game Object itself. - * - * If you wish to skip a parameter, so it retains its current value, pass `false` for it. - * - * If you wish to reset the Constraint render colors to the defaults found in the World Debug Config, then call - * this method with just the `constraint` parameter provided and no others. - * - * @method Phaser.Physics.Matter.World#setConstraintRenderStyle - * @since 3.22.0 - * - * @param {MatterJS.ConstraintType} constraint - The Matter Constraint to set the render style on. - * @param {number} [lineColor] - The line color. If `null` it will use the World Debug Config value. - * @param {number} [lineOpacity] - The line opacity, between 0 and 1. If `null` it will use the World Debug Config value. - * @param {number} [lineThickness] - The line thickness. If `null` it will use the World Debug Config value. - * @param {number} [pinSize] - If this constraint is a pin, this sets the size of the pin circle. If `null` it will use the World Debug Config value. - * @param {number} [anchorColor] - The color used when rendering this constraints anchors. If `null` it will use the World Debug Config value. - * @param {number} [anchorSize] - The size of the anchor circle, if this constraint has anchors. If `null` it will use the World Debug Config value. - * - * @return {this} This Matter World instance for method chaining. - */ - setConstraintRenderStyle: function (constraint, lineColor, lineOpacity, lineThickness, pinSize, anchorColor, anchorSize) - { - var render = constraint.render; - var config = this.debugConfig; + var count = 0; + var countX = 0; + var countY = 0; - if (!render) + for (var t = set.firstgid; t < set.firstgid + set.total; t++) { - return this; - } + // Can add extra properties here as needed + tiles[t] = [ x, y, i ]; - // Reset them - if (lineColor === undefined || lineColor === null) - { - var type = render.type; + x += set.tileWidth + set.tileSpacing; - if (type === 'line') - { - lineColor = config.jointColor; - } - else if (type === 'pin') - { - lineColor = config.pinColor; - } - else if (type === 'spring') + count++; + + if (count === set.total) { - lineColor = config.springColor; + break; } - } - if (lineOpacity === undefined || lineOpacity === null) - { - lineOpacity = config.jointLineOpacity; - } - - if (lineThickness === undefined || lineThickness === null) - { - lineThickness = config.jointLineThickness; - } + countX++; - if (pinSize === undefined || pinSize === null) - { - pinSize = config.pinSize; - } + if (countX === set.columns) + { + x = set.tileMargin; + y += set.tileHeight + set.tileSpacing; - if (anchorColor === undefined || anchorColor === null) - { - anchorColor = config.anchorColor; - } + countX = 0; + countY++; - if (anchorSize === undefined || anchorSize === null) - { - anchorSize = config.anchorSize; + if (countY === set.rows) + { + break; + } + } } + } - if (lineColor !== false) - { - render.lineColor = lineColor; - } + return tiles; +}; - if (lineOpacity !== false) - { - render.lineOpacity = lineOpacity; - } +module.exports = BuildTilesetIndex; - if (lineThickness !== false) - { - render.lineThickness = lineThickness; - } - if (pinSize !== false) - { - render.pinSize = pinSize; - } +/***/ }), - if (anchorColor !== false) - { - render.anchorColor = anchorColor; - } +/***/ 92044: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (anchorSize !== false) - { - render.anchorSize = anchorSize; - } +/** + * @author Seth Berrier + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +var GetFastValue = __webpack_require__(72632); - /** - * This internal method acts as a proxy between all of the Matter JS events and then re-emits them - * via this class. - * - * @method Phaser.Physics.Matter.World#setEventsProxy - * @since 3.0.0 - */ - setEventsProxy: function () +/** + * Parse a Tiled group layer and create a state object for inheriting. + * + * @function Phaser.Tilemaps.Parsers.Tiled.CreateGroupLayer + * @since 3.21.0 + * + * @param {object} json - The Tiled JSON object. + * @param {object} [group] - The current group layer from the Tiled JSON file. + * @param {object} [parentState] - The state of the parent group (if any). + * + * @return {object} A group state object with proper values for updating children layers. + */ +var CreateGroupLayer = function (json, group, parentState) +{ + if (!group) { - var _this = this; - var engine = this.engine; - var world = this.localWorld; - - // Inject debug styles + // Return a default group state object + return { + i: 0, // Current layer array iterator + layers: json.layers, // Current array of layers + // Values inherited from parent group + name: '', + opacity: 1, + visible: true, + x: 0, + y: 0 + }; + } - if (this.drawDebug) - { - MatterEvents.on(world, 'compositeModified', function (composite) - { - _this.setCompositeRenderStyle(composite); - }); + // Compute group layer x, y + var layerX = group.x + GetFastValue(group, 'startx', 0) * json.tilewidth + GetFastValue(group, 'offsetx', 0); + var layerY = group.y + GetFastValue(group, 'starty', 0) * json.tileheight + GetFastValue(group, 'offsety', 0); - MatterEvents.on(world, 'beforeAdd', function (event) - { - var objects = [].concat(event.object); - - for (var i = 0; i < objects.length; i++) - { - var obj = objects[i]; - var render = obj.render; - - if (obj.type === 'body') - { - _this.setBodyRenderStyle(obj, render.lineColor, render.lineOpacity, render.lineThickness, render.fillColor, render.fillOpacity); - } - else if (obj.type === 'composite') - { - _this.setCompositeRenderStyle(obj); - } - else if (obj.type === 'constraint') - { - _this.setConstraintRenderStyle(obj, render.lineColor, render.lineOpacity, render.lineThickness, render.pinSize, render.anchorColor, render.anchorSize); - } - } - }); - } + // Compute next state inherited from group + return { + i: 0, + layers: group.layers, + name: parentState.name + group.name + '/', + opacity: parentState.opacity * group.opacity, + visible: parentState.visible && group.visible, + x: parentState.x + layerX, + y: parentState.y + layerY + }; +}; - MatterEvents.on(world, 'beforeAdd', function (event) - { - _this.emit(Events.BEFORE_ADD, event); - }); +module.exports = CreateGroupLayer; - MatterEvents.on(world, 'afterAdd', function (event) - { - _this.emit(Events.AFTER_ADD, event); - }); - MatterEvents.on(world, 'beforeRemove', function (event) - { - _this.emit(Events.BEFORE_REMOVE, event); - }); +/***/ }), - MatterEvents.on(world, 'afterRemove', function (event) - { - _this.emit(Events.AFTER_REMOVE, event); - }); +/***/ 8847: +/***/ ((module) => { - MatterEvents.on(engine, 'beforeUpdate', function (event) - { - _this.emit(Events.BEFORE_UPDATE, event); - }); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - MatterEvents.on(engine, 'afterUpdate', function (event) - { - _this.emit(Events.AFTER_UPDATE, event); - }); +var FLIPPED_HORIZONTAL = 0x80000000; +var FLIPPED_VERTICAL = 0x40000000; +var FLIPPED_ANTI_DIAGONAL = 0x20000000; // Top-right is swapped with bottom-left corners - MatterEvents.on(engine, 'collisionStart', function (event) - { - var pairs = event.pairs; - var bodyA; - var bodyB; +/** + * See Tiled documentation on tile flipping: + * http://docs.mapeditor.org/en/latest/reference/tmx-map-format/ + * + * @function Phaser.Tilemaps.Parsers.Tiled.ParseGID + * @since 3.0.0 + * + * @param {number} gid - A Tiled GID. + * + * @return {Phaser.Types.Tilemaps.GIDData} The GID Data. + */ +var ParseGID = function (gid) +{ + var flippedHorizontal = Boolean(gid & FLIPPED_HORIZONTAL); + var flippedVertical = Boolean(gid & FLIPPED_VERTICAL); + var flippedAntiDiagonal = Boolean(gid & FLIPPED_ANTI_DIAGONAL); + gid = gid & ~(FLIPPED_HORIZONTAL | FLIPPED_VERTICAL | FLIPPED_ANTI_DIAGONAL); - if (pairs.length > 0) - { - bodyA = pairs[0].bodyA; - bodyB = pairs[0].bodyB; - } + // Parse the flip flags into something Phaser can use + var rotation = 0; + var flipped = false; - _this.emit(Events.COLLISION_START, event, bodyA, bodyB); - }); + if (flippedHorizontal && flippedVertical && flippedAntiDiagonal) + { + rotation = Math.PI / 2; + flipped = true; + } + else if (flippedHorizontal && flippedVertical && !flippedAntiDiagonal) + { + rotation = Math.PI; + flipped = false; + } + else if (flippedHorizontal && !flippedVertical && flippedAntiDiagonal) + { + rotation = Math.PI / 2; + flipped = false; + } + else if (flippedHorizontal && !flippedVertical && !flippedAntiDiagonal) + { + rotation = 0; + flipped = true; + } + else if (!flippedHorizontal && flippedVertical && flippedAntiDiagonal) + { + rotation = 3 * Math.PI / 2; + flipped = false; + } + else if (!flippedHorizontal && flippedVertical && !flippedAntiDiagonal) + { + rotation = Math.PI; + flipped = true; + } + else if (!flippedHorizontal && !flippedVertical && flippedAntiDiagonal) + { + rotation = 3 * Math.PI / 2; + flipped = true; + } + else if (!flippedHorizontal && !flippedVertical && !flippedAntiDiagonal) + { + rotation = 0; + flipped = false; + } - MatterEvents.on(engine, 'collisionActive', function (event) - { - var pairs = event.pairs; - var bodyA; - var bodyB; + return { + gid: gid, + flippedHorizontal: flippedHorizontal, + flippedVertical: flippedVertical, + flippedAntiDiagonal: flippedAntiDiagonal, + rotation: rotation, + flipped: flipped + }; +}; - if (pairs.length > 0) - { - bodyA = pairs[0].bodyA; - bodyB = pairs[0].bodyB; - } +module.exports = ParseGID; - _this.emit(Events.COLLISION_ACTIVE, event, bodyA, bodyB); - }); - MatterEvents.on(engine, 'collisionEnd', function (event) - { - var pairs = event.pairs; - var bodyA; - var bodyB; +/***/ }), - if (pairs.length > 0) - { - bodyA = pairs[0].bodyA; - bodyB = pairs[0].bodyB; - } +/***/ 78339: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - _this.emit(Events.COLLISION_END, event, bodyA, bodyB); - }); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets the bounds of the Physics world to match the given world pixel dimensions. - * You can optionally set which 'walls' to create: left, right, top or bottom. - * If none of the walls are given it will default to use the walls settings it had previously. - * I.e. if you previously told it to not have the left or right walls, and you then adjust the world size - * the newly created bounds will also not have the left and right walls. - * Explicitly state them in the parameters to override this. - * - * @method Phaser.Physics.Matter.World#setBounds - * @since 3.0.0 - * - * @param {number} [x=0] - The x coordinate of the top-left corner of the bounds. - * @param {number} [y=0] - The y coordinate of the top-left corner of the bounds. - * @param {number} [width] - The width of the bounds. - * @param {number} [height] - The height of the bounds. - * @param {number} [thickness=64] - The thickness of each wall, in pixels. - * @param {boolean} [left=true] - If true will create the left bounds wall. - * @param {boolean} [right=true] - If true will create the right bounds wall. - * @param {boolean} [top=true] - If true will create the top bounds wall. - * @param {boolean} [bottom=true] - If true will create the bottom bounds wall. - * - * @return {Phaser.Physics.Matter.World} This Matter World object. - */ - setBounds: function (x, y, width, height, thickness, left, right, top, bottom) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 0; } - if (width === undefined) { width = this.scene.sys.scale.width; } - if (height === undefined) { height = this.scene.sys.scale.height; } - if (thickness === undefined) { thickness = 64; } - if (left === undefined) { left = true; } - if (right === undefined) { right = true; } - if (top === undefined) { top = true; } - if (bottom === undefined) { bottom = true; } +var GetFastValue = __webpack_require__(72632); +var CreateGroupLayer = __webpack_require__(92044); - this.updateWall(left, 'left', x - thickness, y - thickness, thickness, height + (thickness * 2)); - this.updateWall(right, 'right', x + width, y - thickness, thickness, height + (thickness * 2)); - this.updateWall(top, 'top', x, y - thickness, width, thickness); - this.updateWall(bottom, 'bottom', x, y + height, width, thickness); +/** + * Parses a Tiled JSON object into an array of objects with details about the image layers. + * + * @function Phaser.Tilemaps.Parsers.Tiled.ParseImageLayers + * @since 3.0.0 + * + * @param {object} json - The Tiled JSON object. + * + * @return {array} Array of objects that include critical info about the map's image layers + */ +var ParseImageLayers = function (json) +{ + var images = []; - return this; - }, + // State inherited from a parent group + var groupStack = []; + var curGroupState = CreateGroupLayer(json); - /** - * Updates the 4 rectangle bodies that were created, if `setBounds` was set in the Matter config, to use - * the new positions and sizes. This method is usually only called internally via the `setBounds` method. - * - * @method Phaser.Physics.Matter.World#updateWall - * @since 3.0.0 - * - * @param {boolean} add - `true` if the walls are being added or updated, `false` to remove them from the world. - * @param {string} [position] - Either `left`, `right`, `top` or `bottom`. Only optional if `add` is `false`. - * @param {number} [x] - The horizontal position to place the walls at. Only optional if `add` is `false`. - * @param {number} [y] - The vertical position to place the walls at. Only optional if `add` is `false`. - * @param {number} [width] - The width of the walls, in pixels. Only optional if `add` is `false`. - * @param {number} [height] - The height of the walls, in pixels. Only optional if `add` is `false`. - */ - updateWall: function (add, position, x, y, width, height) + while (curGroupState.i < curGroupState.layers.length || groupStack.length > 0) { - var wall = this.walls[position]; - - if (add) + if (curGroupState.i >= curGroupState.layers.length) { - if (wall) + // Ensure recursion stack is not empty first + if (groupStack.length < 1) { - MatterWorld.remove(this.localWorld, wall); + console.warn( + 'TilemapParser.parseTiledJSON - Invalid layer group hierarchy' + ); + break; } - // adjust center - x += (width / 2); - y += (height / 2); - - this.walls[position] = this.create(x, y, width, height, { isStatic: true, friction: 0, frictionStatic: 0 }); + // Return to previous recursive state + curGroupState = groupStack.pop(); + continue; } - else + + // Get current layer and advance iterator + var curi = curGroupState.layers[curGroupState.i]; + curGroupState.i++; + + if (curi.type !== 'imagelayer') { - if (wall) + if (curi.type === 'group') { - MatterWorld.remove(this.localWorld, wall); + // Compute next state inherited from group + var nextGroupState = CreateGroupLayer(json, curi, curGroupState); + + // Preserve current state before recursing + groupStack.push(curGroupState); + curGroupState = nextGroupState; } - this.walls[position] = null; + // Skip this layer OR 'recurse' (iterative style) into the group + continue; } - }, - - /** - * Creates a Phaser.GameObjects.Graphics object that is used to render all of the debug bodies and joints to. - * - * This method is called automatically by the constructor, if debugging has been enabled. - * - * The created Graphics object is automatically added to the Scene at 0x0 and given a depth of `Number.MAX_VALUE`, - * so it renders above all else in the Scene. - * - * The Graphics object is assigned to the `debugGraphic` property of this class and `drawDebug` is enabled. - * - * @method Phaser.Physics.Matter.World#createDebugGraphic - * @since 3.0.0 - * - * @return {Phaser.GameObjects.Graphics} The newly created Graphics object. - */ - createDebugGraphic: function () - { - var graphic = this.scene.sys.add.graphics({ x: 0, y: 0 }); - graphic.setDepth(Number.MAX_VALUE); + var layerOffsetX = GetFastValue(curi, 'offsetx', 0) + GetFastValue(curi, 'startx', 0); + var layerOffsetY = GetFastValue(curi, 'offsety', 0) + GetFastValue(curi, 'starty', 0); + images.push({ + name: (curGroupState.name + curi.name), + image: curi.image, + x: (curGroupState.x + layerOffsetX + curi.x), + y: (curGroupState.y + layerOffsetY + curi.y), + alpha: (curGroupState.opacity * curi.opacity), + visible: (curGroupState.visible && curi.visible), + properties: GetFastValue(curi, 'properties', {}) + }); + } - this.debugGraphic = graphic; + return images; +}; - this.drawDebug = true; +module.exports = ParseImageLayers; - return graphic; - }, - /** - * Sets the world gravity and gravity scale to 0. - * - * @method Phaser.Physics.Matter.World#disableGravity - * @since 3.0.0 - * - * @return {this} This Matter World object. - */ - disableGravity: function () - { - this.localWorld.gravity.x = 0; - this.localWorld.gravity.y = 0; - this.localWorld.gravity.scale = 0; +/***/ }), - return this; - }, +/***/ 2378: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Sets the worlds gravity to the values given. - * - * Gravity effects all bodies in the world, unless they have the `ignoreGravity` flag set. - * - * @method Phaser.Physics.Matter.World#setGravity - * @since 3.0.0 - * - * @param {number} [x=0] - The world gravity x component. - * @param {number} [y=1] - The world gravity y component. - * @param {number} [scale=0.001] - The gravity scale factor. - * - * @return {this} This Matter World object. - */ - setGravity: function (x, y, scale) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = 1; } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.localWorld.gravity.x = x; - this.localWorld.gravity.y = y; +var AssignTileProperties = __webpack_require__(48646); +var BuildTilesetIndex = __webpack_require__(14556); +var CONST = __webpack_require__(12920); +var DeepCopy = __webpack_require__(28699); +var Formats = __webpack_require__(93560); +var FromOrientationString = __webpack_require__(21394); +var MapData = __webpack_require__(16586); +var ParseImageLayers = __webpack_require__(78339); +var ParseObjectLayers = __webpack_require__(61136); +var ParseTileLayers = __webpack_require__(95925); +var ParseTilesets = __webpack_require__(93392); - if (scale !== undefined) - { - this.localWorld.gravity.scale = scale; - } +/** + * Parses a Tiled JSON object into a new MapData object. + * + * @function Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled + * @since 3.0.0 + * + * @param {string} name - The name of the tilemap, used to set the name on the MapData. + * @param {object} source - The original Tiled JSON object. This is deep copied by this function. + * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map + * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty + * location will get a Tile object with an index of -1. If you've a large sparsely populated map and + * the tile data doesn't need to change then setting this value to `true` will help with memory + * consumption. However if your map is small or you need to update the tiles dynamically, then leave + * the default value set. + * + * @return {?Phaser.Tilemaps.MapData} The created MapData object, or `null` if the data can't be parsed. + */ +var ParseJSONTiled = function (name, source, insertNull) +{ + var json = DeepCopy(source); - return this; - }, + // Map data will consist of: layers, objects, images, tilesets, sizes + var mapData = new MapData({ + width: json.width, + height: json.height, + name: name, + tileWidth: json.tilewidth, + tileHeight: json.tileheight, + orientation: FromOrientationString(json.orientation), + format: Formats.TILED_JSON, + version: json.version, + properties: json.properties, + renderOrder: json.renderorder, + infinite: json.infinite + }); - /** - * Creates a rectangle Matter body and adds it to the world. - * - * @method Phaser.Physics.Matter.World#create - * @since 3.0.0 - * - * @param {number} x - The horizontal position of the body in the world. - * @param {number} y - The vertical position of the body in the world. - * @param {number} width - The width of the body. - * @param {number} height - The height of the body. - * @param {object} options - Optional Matter configuration object. - * - * @return {MatterJS.BodyType} The Matter.js body that was created. - */ - create: function (x, y, width, height, options) + if (mapData.orientation === CONST.HEXAGONAL) { - var body = Bodies.rectangle(x, y, width, height, options); + mapData.hexSideLength = json.hexsidelength; + mapData.staggerAxis = json.staggeraxis; + mapData.staggerIndex = json.staggerindex; + } - MatterWorld.add(this.localWorld, body); + mapData.layers = ParseTileLayers(json, insertNull); + mapData.images = ParseImageLayers(json); - return body; - }, + var sets = ParseTilesets(json); - /** - * Adds a Matter JS object, or array of objects, to the world. - * - * The objects should be valid Matter JS entities, such as a Body, Composite or Constraint. - * - * Triggers `beforeAdd` and `afterAdd` events. - * - * @method Phaser.Physics.Matter.World#add - * @since 3.0.0 - * - * @param {(object|object[])} object - Can be single object, or an array, and can be a body, composite or constraint. - * - * @return {this} This Matter World object. - */ - add: function (object) - { - MatterWorld.add(this.localWorld, object); + mapData.tilesets = sets.tilesets; + mapData.imageCollections = sets.imageCollections; - return this; - }, + mapData.objects = ParseObjectLayers(json); - /** - * Removes a Matter JS object, or array of objects, from the world. - * - * The objects should be valid Matter JS entities, such as a Body, Composite or Constraint. - * - * Triggers `beforeRemove` and `afterRemove` events. - * - * @method Phaser.Physics.Matter.World#remove - * @since 3.0.0 - * - * @param {(object|object[])} object - Can be single object, or an array, and can be a body, composite or constraint. - * @param {boolean} [deep=false] - Optionally search the objects children and recursively remove those as well. - * - * @return {this} This Matter World object. - */ - remove: function (object, deep) - { - if (!Array.isArray(object)) - { - object = [ object ]; - } + mapData.tiles = BuildTilesetIndex(mapData); - for (var i = 0; i < object.length; i++) - { - var entity = object[i]; + AssignTileProperties(mapData); - var body = (entity.body) ? entity.body : entity; + return mapData; +}; - Composite.remove(this.localWorld, body, deep); - } +module.exports = ParseJSONTiled; - return this; - }, - /** - * Removes a Matter JS constraint, or array of constraints, from the world. - * - * Triggers `beforeRemove` and `afterRemove` events. - * - * @method Phaser.Physics.Matter.World#removeConstraint - * @since 3.0.0 - * - * @param {(MatterJS.ConstraintType|MatterJS.ConstraintType[])} constraint - A Matter JS Constraint, or an array of constraints, to be removed. - * @param {boolean} [deep=false] - Optionally search the objects children and recursively remove those as well. - * - * @return {this} This Matter World object. - */ - removeConstraint: function (constraint, deep) - { - Composite.remove(this.localWorld, constraint, deep); +/***/ }), - return this; - }, +/***/ 4281: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Adds `MatterTileBody` instances for all the colliding tiles within the given tilemap layer. - * - * Set the appropriate tiles in your layer to collide before calling this method! - * - * @method Phaser.Physics.Matter.World#convertTilemapLayer - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.TilemapLayer} tilemapLayer - An array of tiles. - * @param {object} [options] - Options to be passed to the MatterTileBody constructor. {@see Phaser.Physics.Matter.TileBody} - * - * @return {this} This Matter World object. - */ - convertTilemapLayer: function (tilemapLayer, options) - { - var layerData = tilemapLayer.layer; - var tiles = tilemapLayer.getTilesWithin(0, 0, layerData.width, layerData.height, { isColliding: true }); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.convertTiles(tiles, options); +var Pick = __webpack_require__(28820); +var ParseGID = __webpack_require__(8847); - return this; - }, +var copyPoints = function (p) { return { x: p.x, y: p.y }; }; - /** - * Adds `MatterTileBody` instances for the given tiles. This adds bodies regardless of whether the - * tiles are set to collide or not. - * - * @method Phaser.Physics.Matter.World#convertTiles - * @since 3.0.0 - * - * @param {Phaser.Tilemaps.Tile[]} tiles - An array of tiles. - * @param {object} [options] - Options to be passed to the MatterTileBody constructor. {@see Phaser.Physics.Matter.TileBody} - * - * @return {this} This Matter World object. - */ - convertTiles: function (tiles, options) - { - if (tiles.length === 0) - { - return this; - } +var commonObjectProps = [ 'id', 'name', 'type', 'rotation', 'properties', 'visible', 'x', 'y', 'width', 'height' ]; - for (var i = 0; i < tiles.length; i++) - { - new MatterTileBody(this, tiles[i], options); - } +/** + * Convert a Tiled object to an internal parsed object normalising and copying properties over, while applying optional x and y offsets. The parsed object will always have the properties `id`, `name`, `type`, `rotation`, `properties`, `visible`, `x`, `y`, `width` and `height`. Other properties will be added according to the object type (such as text, polyline, gid etc.) + * + * @function Phaser.Tilemaps.Parsers.Tiled.ParseObject + * @since 3.0.0 + * + * @param {object} tiledObject - Tiled object to convert to an internal parsed object normalising and copying properties over. + * @param {number} [offsetX=0] - Optional additional offset to apply to the object's x property. Defaults to 0. + * @param {number} [offsetY=0] - Optional additional offset to apply to the object's y property. Defaults to 0. + * + * @return {object} The parsed object containing properties read from the Tiled object according to it's type with x and y values updated according to the given offsets. + */ +var ParseObject = function (tiledObject, offsetX, offsetY) +{ + if (offsetX === undefined) { offsetX = 0; } + if (offsetY === undefined) { offsetY = 0; } - return this; - }, + var parsedObject = Pick(tiledObject, commonObjectProps); - /** - * Returns the next unique group index for which bodies will collide. - * If `isNonColliding` is `true`, returns the next unique group index for which bodies will not collide. - * - * @method Phaser.Physics.Matter.World#nextGroup - * @since 3.0.0 - * - * @param {boolean} [isNonColliding=false] - If `true`, returns the next unique group index for which bodies will _not_ collide. - * - * @return {number} Unique category bitfield - */ - nextGroup: function (isNonColliding) - { - return MatterBody.nextGroup(isNonColliding); - }, + parsedObject.x += offsetX; + parsedObject.y += offsetY; - /** - * Returns the next unique category bitfield (starting after the initial default category 0x0001). - * There are 32 available. - * - * @method Phaser.Physics.Matter.World#nextCategory - * @since 3.0.0 - * - * @return {number} Unique category bitfield - */ - nextCategory: function () + if (tiledObject.gid) { - return MatterBody.nextCategory(); - }, - - /** - * Pauses this Matter World instance and sets `enabled` to `false`. - * - * A paused world will not run any simulations for the duration it is paused. - * - * @method Phaser.Physics.Matter.World#pause - * @fires Phaser.Physics.Matter.Events#PAUSE - * @since 3.0.0 - * - * @return {this} This Matter World object. - */ - pause: function () + // Object tiles + var gidInfo = ParseGID(tiledObject.gid); + parsedObject.gid = gidInfo.gid; + parsedObject.flippedHorizontal = gidInfo.flippedHorizontal; + parsedObject.flippedVertical = gidInfo.flippedVertical; + parsedObject.flippedAntiDiagonal = gidInfo.flippedAntiDiagonal; + } + else if (tiledObject.polyline) { - this.enabled = false; + parsedObject.polyline = tiledObject.polyline.map(copyPoints); + } + else if (tiledObject.polygon) + { + parsedObject.polygon = tiledObject.polygon.map(copyPoints); + } + else if (tiledObject.ellipse) + { + parsedObject.ellipse = tiledObject.ellipse; + } + else if (tiledObject.text) + { + parsedObject.text = tiledObject.text; + } + else if (tiledObject.point) + { + parsedObject.point = true; + } + else + { + // Otherwise, assume it is a rectangle + parsedObject.rectangle = true; + } - this.emit(Events.PAUSE); + return parsedObject; +}; - return this; - }, +module.exports = ParseObject; - /** - * Resumes this Matter World instance from a paused state and sets `enabled` to `true`. - * - * @method Phaser.Physics.Matter.World#resume - * @fires Phaser.Physics.Matter.Events#RESUME - * @since 3.0.0 - * - * @return {this} This Matter World object. - */ - resume: function () - { - this.enabled = true; - this.emit(Events.RESUME); +/***/ }), - return this; - }, +/***/ 61136: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * The internal update method. This is called automatically by the parent Scene. - * - * Moves the simulation forward in time by delta ms. Uses `World.correction` value as an optional number that - * specifies the time correction factor to apply to the update. This can help improve the accuracy of the - * simulation in cases where delta is changing between updates. The value of correction is defined as `delta / lastDelta`, - * i.e. the percentage change of delta over the last step. Therefore the value is always 1 (no correction) when - * delta is constant (or when no correction is desired, which is the default). - * See the paper on Time Corrected Verlet for more information. - * - * Triggers `beforeUpdate` and `afterUpdate` events. Triggers `collisionStart`, `collisionActive` and `collisionEnd` events. - * - * If the World is paused, `update` is still run, but exits early and does not update the Matter Engine. - * - * @method Phaser.Physics.Matter.World#update - * @since 3.0.0 - * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. - */ - update: function (time, delta) +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var GetFastValue = __webpack_require__(72632); +var ParseObject = __webpack_require__(4281); +var ObjectLayer = __webpack_require__(15256); +var CreateGroupLayer = __webpack_require__(92044); + +/** + * Parses a Tiled JSON object into an array of ObjectLayer objects. + * + * @function Phaser.Tilemaps.Parsers.Tiled.ParseObjectLayers + * @since 3.0.0 + * + * @param {object} json - The Tiled JSON object. + * + * @return {array} An array of all object layers in the tilemap as `ObjectLayer`s. + */ +var ParseObjectLayers = function (json) +{ + var objectLayers = []; + + // State inherited from a parent group + var groupStack = []; + var curGroupState = CreateGroupLayer(json); + + while (curGroupState.i < curGroupState.layers.length || groupStack.length > 0) { - if (!this.enabled || !this.autoUpdate) + if (curGroupState.i >= curGroupState.layers.length) { - return; + // Ensure recursion stack is not empty first + if (groupStack.length < 1) + { + console.warn( + 'TilemapParser.parseTiledJSON - Invalid layer group hierarchy' + ); + break; + } + + // Return to previous recursive state + curGroupState = groupStack.pop(); + continue; } - var engine = this.engine; - var runner = this.runner; + // Get current layer and advance iterator + var curo = curGroupState.layers[curGroupState.i]; + curGroupState.i++; - var timing = engine.timing; - var correction = this.correction; + // Modify inherited properties + curo.opacity *= curGroupState.opacity; + curo.visible = curGroupState.visible && curo.visible; - if (runner.isFixed) - { - // fixed timestep - delta = this.getDelta(time, delta); - } - else + if (curo.type !== 'objectgroup') { - // dynamic timestep based on wall clock between calls - delta = (time - runner.timePrev) || runner.delta; - runner.timePrev = time; - - // optimistically filter delta over a few frames, to improve stability - runner.deltaHistory.push(delta); - runner.deltaHistory = runner.deltaHistory.slice(-runner.deltaSampleSize); - delta = Math.min.apply(null, runner.deltaHistory); - - // limit delta - delta = delta < runner.deltaMin ? runner.deltaMin : delta; - delta = delta > runner.deltaMax ? runner.deltaMax : delta; + if (curo.type === 'group') + { + // Compute next state inherited from group + var nextGroupState = CreateGroupLayer(json, curo, curGroupState); - // correction for delta - correction = delta / runner.delta; + // Preserve current state before recursing + groupStack.push(curGroupState); + curGroupState = nextGroupState; + } - // update engine timing object - runner.delta = delta; + // Skip this layer OR 'recurse' (iterative style) into the group + continue; } - // time correction for time scaling - if (runner.timeScalePrev !== 0) - { - correction *= timing.timeScale / runner.timeScalePrev; - } + curo.name = curGroupState.name + curo.name; + var offsetX = curGroupState.x + GetFastValue(curo, 'startx', 0) + GetFastValue(curo, 'offsetx', 0); + var offsetY = curGroupState.y + GetFastValue(curo, 'starty', 0) + GetFastValue(curo, 'offsety', 0); - if (timing.timeScale === 0) + var objects = []; + for (var j = 0; j < curo.objects.length; j++) { - correction = 0; - } + var parsedObject = ParseObject(curo.objects[j], offsetX, offsetY); - runner.timeScalePrev = timing.timeScale; - runner.correction = correction; + objects.push(parsedObject); + } - // fps counter - runner.frameCounter += 1; + var objectLayer = new ObjectLayer(curo); + objectLayer.objects = objects; - if (time - runner.counterTimestamp >= 1000) - { - runner.fps = runner.frameCounter * ((time - runner.counterTimestamp) / 1000); - runner.counterTimestamp = time; - runner.frameCounter = 0; - } + objectLayers.push(objectLayer); + } - Engine.update(engine, delta, correction); - }, + return objectLayers; +}; - /** - * Manually advances the physics simulation by one iteration. - * - * You can optionally pass in the `delta` and `correction` values to be used by Engine.update. - * If undefined they use the Matter defaults of 60Hz and no correction. - * - * Calling `step` directly bypasses any checks of `enabled` or `autoUpdate`. - * - * It also ignores any custom `getDelta` functions, as you should be passing the delta - * value in to this call. - * - * You can adjust the number of iterations that Engine.update performs internally. - * Use the Scene Matter Physics config object to set the following properties: - * - * positionIterations (defaults to 6) - * velocityIterations (defaults to 4) - * constraintIterations (defaults to 2) - * - * Adjusting these values can help performance in certain situations, depending on the physics requirements - * of your game. - * - * @method Phaser.Physics.Matter.World#step - * @since 3.4.0 - * - * @param {number} [delta=16.666] - The delta value. - * @param {number} [correction=1] - Optional delta correction value. - */ - step: function (delta, correction) - { - Engine.update(this.engine, delta, correction); - }, +module.exports = ParseObjectLayers; - /** - * Runs the Matter Engine.update at a fixed timestep of 60Hz. - * - * @method Phaser.Physics.Matter.World#update60Hz - * @since 3.4.0 - * - * @return {number} The delta value to be passed to Engine.update. - */ - update60Hz: function () - { - return 1000 / 60; - }, - /** - * Runs the Matter Engine.update at a fixed timestep of 30Hz. - * - * @method Phaser.Physics.Matter.World#update30Hz - * @since 3.4.0 - * - * @return {number} The delta value to be passed to Engine.update. - */ - update30Hz: function () - { - return 1000 / 30; - }, +/***/ }), - /** - * Returns `true` if the given body can be found within the World. - * - * @method Phaser.Physics.Matter.World#has - * @since 3.22.0 - * - * @param {(MatterJS.Body|Phaser.GameObjects.GameObject)} body - The Matter Body, or Game Object, to search for within the world. - * - * @return {MatterJS.BodyType[]} An array of all the Matter JS Bodies in this World. - */ - has: function (body) - { - var src = (body.hasOwnProperty('body')) ? body.body : body; +/***/ 95925: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return (Composite.get(this.localWorld, src.id, src.type) !== null); - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Returns all the bodies in the Matter World, including all bodies in children, recursively. - * - * @method Phaser.Physics.Matter.World#getAllBodies - * @since 3.22.0 - * - * @return {MatterJS.BodyType[]} An array of all the Matter JS Bodies in this World. - */ - getAllBodies: function () - { - return Composite.allBodies(this.localWorld); - }, +var Base64Decode = __webpack_require__(43908); +var CONST = __webpack_require__(12920); +var CreateGroupLayer = __webpack_require__(92044); +var FromOrientationString = __webpack_require__(21394); +var GetFastValue = __webpack_require__(72632); +var LayerData = __webpack_require__(94990); +var ParseGID = __webpack_require__(8847); +var Tile = __webpack_require__(29633); - /** - * Returns all the constraints in the Matter World, including all constraints in children, recursively. - * - * @method Phaser.Physics.Matter.World#getAllConstraints - * @since 3.22.0 - * - * @return {MatterJS.ConstraintType[]} An array of all the Matter JS Constraints in this World. - */ - getAllConstraints: function () - { - return Composite.allConstraints(this.localWorld); - }, +/** + * Parses all tilemap layers in a Tiled JSON object into new LayerData objects. + * + * @function Phaser.Tilemaps.Parsers.Tiled.ParseTileLayers + * @since 3.0.0 + * + * @param {object} json - The Tiled JSON object. + * @param {boolean} insertNull - Controls how empty tiles, tiles with an index of -1, in the map + * data are handled (see {@link Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled}). + * + * @return {Phaser.Tilemaps.LayerData[]} - An array of LayerData objects, one for each entry in + * json.layers with the type 'tilelayer'. + */ +var ParseTileLayers = function (json, insertNull) +{ + var infiniteMap = GetFastValue(json, 'infinite', false); + var tileLayers = []; - /** - * Returns all the composites in the Matter World, including all composites in children, recursively. - * - * @method Phaser.Physics.Matter.World#getAllComposites - * @since 3.22.0 - * - * @return {MatterJS.CompositeType[]} An array of all the Matter JS Composites in this World. - */ - getAllComposites: function () - { - return Composite.allComposites(this.localWorld); - }, + // State inherited from a parent group + var groupStack = []; + var curGroupState = CreateGroupLayer(json); - /** - * Handles the rendering of bodies and debug information to the debug Graphics object, if enabled. - * - * This method is called automatically by the Scene after all processing has taken place. - * - * @method Phaser.Physics.Matter.World#postUpdate - * @private - * @since 3.0.0 - */ - postUpdate: function () + while (curGroupState.i < curGroupState.layers.length || groupStack.length > 0) { - if (!this.drawDebug) + if (curGroupState.i >= curGroupState.layers.length) { - return; - } - - var config = this.debugConfig; - var engine = this.engine; - var graphics = this.debugGraphic; + // Ensure recursion stack is not empty first + if (groupStack.length < 1) + { + console.warn( + 'TilemapParser.parseTiledJSON - Invalid layer group hierarchy' + ); + break; + } - var bodies = Composite.allBodies(this.localWorld); + // Return to previous recursive state + curGroupState = groupStack.pop(); + continue; + } - this.debugGraphic.clear(); + var curl = curGroupState.layers[curGroupState.i]; + curGroupState.i++; - if (config.showBroadphase && engine.broadphase.controller) + if (curl.type !== 'tilelayer') { - this.renderGrid(engine.broadphase, graphics, config.broadphaseColor, 0.5); - } + if (curl.type === 'group') + { + // Compute next state inherited from group + var nextGroupState = CreateGroupLayer(json, curl, curGroupState); - if (config.showBounds) - { - this.renderBodyBounds(bodies, graphics, config.boundsColor, 0.5); - } + // Preserve current state before recursing + groupStack.push(curGroupState); + curGroupState = nextGroupState; + } - if (config.showBody || config.showStaticBody) - { - this.renderBodies(bodies); + // Skip this layer OR 'recurse' (iterative style) into the group + continue; } - if (config.showJoint) + // Base64 decode data if necessary. NOTE: uncompressed base64 only. + if (curl.compression) { - this.renderJoints(); + console.warn( + 'TilemapParser.parseTiledJSON - Layer compression is unsupported, skipping layer \'' + + curl.name + '\'' + ); + continue; } - - if (config.showAxes || config.showAngleIndicator) + else if (curl.encoding && curl.encoding === 'base64') { - this.renderBodyAxes(bodies, graphics, config.showAxes, config.angleColor, 0.5); - } + // Chunks for an infinite map + if (curl.chunks) + { + for (var i = 0; i < curl.chunks.length; i++) + { + curl.chunks[i].data = Base64Decode(curl.chunks[i].data); + } + } - if (config.showVelocity) - { - this.renderBodyVelocity(bodies, graphics, config.velocityColor, 1, 2); - } + // Non-infinite map data + if (curl.data) + { + curl.data = Base64Decode(curl.data); + } - if (config.showSeparations) - { - this.renderSeparations(engine.pairs.list, graphics, config.separationColor); + delete curl.encoding; // Allow the same map to be parsed multiple times } - if (config.showCollisions) - { - this.renderCollisions(engine.pairs.list, graphics, config.collisionColor); - } - }, + // This is an array containing the tile indexes, one after the other. -1 = no tile, + // everything else = the tile index (starting at 1 for Tiled, 0 for CSV) If the map + // contains multiple tilesets then the indexes are relative to that which the set starts + // from. Need to set which tileset in the cache = which tileset in the JSON, if you do this + // manually it means you can use the same map data but a new tileset. - /** - * Renders the Engine Broadphase Controller Grid to the given Graphics instance. - * - * The debug renderer calls this method if the `showBroadphase` config value is set. - * - * This method is used internally by the Matter Debug Renderer, but is also exposed publically should - * you wish to render the Grid to your own Graphics instance. - * - * @method Phaser.Physics.Matter.World#renderGrid - * @since 3.22.0 - * - * @param {MatterJS.Grid} grid - The Matter Grid to be rendered. - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. - * @param {number} lineColor - The line color. - * @param {number} lineOpacity - The line opacity, between 0 and 1. - * - * @return {this} This Matter World instance for method chaining. - */ - renderGrid: function (grid, graphics, lineColor, lineOpacity) - { - graphics.lineStyle(1, lineColor, lineOpacity); + var layerData; + var gidInfo; + var tile; + var blankTile; - var bucketKeys = Common.keys(grid.buckets); + var output = []; + var x = 0; - for (var i = 0; i < bucketKeys.length; i++) + if (infiniteMap) { - var bucketId = bucketKeys[i]; + var layerOffsetX = (GetFastValue(curl, 'startx', 0) + curl.x); + var layerOffsetY = (GetFastValue(curl, 'starty', 0) + curl.y); - if (grid.buckets[bucketId].length < 2) + layerData = new LayerData({ + name: (curGroupState.name + curl.name), + x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + layerOffsetX * json.tilewidth), + y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + layerOffsetY * json.tileheight), + width: curl.width, + height: curl.height, + tileWidth: json.tilewidth, + tileHeight: json.tileheight, + alpha: (curGroupState.opacity * curl.opacity), + visible: (curGroupState.visible && curl.visible), + properties: GetFastValue(curl, 'properties', []), + orientation: FromOrientationString(json.orientation) + }); + + if (layerData.orientation === CONST.HEXAGONAL) { - continue; + layerData.hexSideLength = json.hexsidelength; + layerData.staggerAxis = json.staggeraxis; + layerData.staggerIndex = json.staggerindex; } - var region = bucketId.split(/C|R/); + for (var c = 0; c < curl.height; c++) + { + output[c] = [ null ]; - graphics.strokeRect( - parseInt(region[1], 10) * grid.bucketWidth, - parseInt(region[2], 10) * grid.bucketHeight, - grid.bucketWidth, - grid.bucketHeight - ); - } + for (var j = 0; j < curl.width; j++) + { + output[c][j] = null; + } + } - return this; - }, + for (c = 0, len = curl.chunks.length; c < len; c++) + { + var chunk = curl.chunks[c]; - /** - * Renders the list of Pair separations to the given Graphics instance. - * - * The debug renderer calls this method if the `showSeparations` config value is set. - * - * This method is used internally by the Matter Debug Renderer, but is also exposed publically should - * you wish to render the Grid to your own Graphics instance. - * - * @method Phaser.Physics.Matter.World#renderSeparations - * @since 3.22.0 - * - * @param {MatterJS.Pair[]} pairs - An array of Matter Pairs to be rendered. - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. - * @param {number} lineColor - The line color. - * - * @return {this} This Matter World instance for method chaining. - */ - renderSeparations: function (pairs, graphics, lineColor) - { - graphics.lineStyle(1, lineColor, 1); + var offsetX = (chunk.x - layerOffsetX); + var offsetY = (chunk.y - layerOffsetY); - for (var i = 0; i < pairs.length; i++) + var y = 0; + + for (var t = 0, len2 = chunk.data.length; t < len2; t++) + { + var newOffsetX = x + offsetX; + var newOffsetY = y + offsetY; + + gidInfo = ParseGID(chunk.data[t]); + + // index, x, y, width, height + if (gidInfo.gid > 0) + { + tile = new Tile(layerData, gidInfo.gid, newOffsetX, newOffsetY, json.tilewidth, json.tileheight); + + // Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal + // propeties into flipX, flipY and rotation + tile.rotation = gidInfo.rotation; + tile.flipX = gidInfo.flipped; + + output[newOffsetY][newOffsetX] = tile; + } + else + { + blankTile = insertNull + ? null + : new Tile(layerData, -1, newOffsetX, newOffsetY, json.tilewidth, json.tileheight); + + output[newOffsetY][newOffsetX] = blankTile; + } + + x++; + + if (x === chunk.width) + { + y++; + x = 0; + } + } + } + } + else { - var pair = pairs[i]; + layerData = new LayerData({ + name: (curGroupState.name + curl.name), + x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + curl.x), + y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + curl.y), + width: curl.width, + height: curl.height, + tileWidth: json.tilewidth, + tileHeight: json.tileheight, + alpha: (curGroupState.opacity * curl.opacity), + visible: (curGroupState.visible && curl.visible), + properties: GetFastValue(curl, 'properties', []), + orientation: FromOrientationString(json.orientation) + }); - if (!pair.isActive) + if (layerData.orientation === CONST.HEXAGONAL) { - continue; + layerData.hexSideLength = json.hexsidelength; + layerData.staggerAxis = json.staggeraxis; + layerData.staggerIndex = json.staggerindex; } + var row = []; - var collision = pair.collision; - var bodyA = collision.bodyA; - var bodyB = collision.bodyB; - var posA = bodyA.position; - var posB = bodyB.position; - var penetration = collision.penetration; - - var k = (!bodyA.isStatic && !bodyB.isStatic) ? 4 : 1; - - if (bodyB.isStatic) + // Loop through the data field in the JSON. + for (var k = 0, len = curl.data.length; k < len; k++) { - k = 0; - } + gidInfo = ParseGID(curl.data[k]); - graphics.lineBetween( - posB.x, - posB.y, - posB.x - (penetration.x * k), - posB.y - (penetration.y * k) - ); + // index, x, y, width, height + if (gidInfo.gid > 0) + { + tile = new Tile(layerData, gidInfo.gid, x, output.length, json.tilewidth, json.tileheight); - k = (!bodyA.isStatic && !bodyB.isStatic) ? 4 : 1; + // Turning Tiled's FlippedHorizontal, FlippedVertical and FlippedAntiDiagonal + // propeties into flipX, flipY and rotation + tile.rotation = gidInfo.rotation; + tile.flipX = gidInfo.flipped; - if (bodyA.isStatic) - { - k = 0; + row.push(tile); + } + else + { + blankTile = insertNull + ? null + : new Tile(layerData, -1, x, output.length, json.tilewidth, json.tileheight); + row.push(blankTile); + } + + x++; + + if (x === curl.width) + { + output.push(row); + x = 0; + row = []; + } } + } - graphics.lineBetween( - posA.x, - posA.y, - posA.x - (penetration.x * k), - posA.y - (penetration.y * k) - ); + layerData.data = output; + tileLayers.push(layerData); + } + + return tileLayers; +}; + +module.exports = ParseTileLayers; + + +/***/ }), + +/***/ 93392: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Tileset = __webpack_require__(47975); +var ImageCollection = __webpack_require__(97042); +var ParseObject = __webpack_require__(4281); +var ParseWangsets = __webpack_require__(39642); + +/** + * Tilesets and Image Collections. + * + * @function Phaser.Tilemaps.Parsers.Tiled.ParseTilesets + * @since 3.0.0 + * + * @param {object} json - The Tiled JSON data. + * + * @return {object} An object containing the tileset and image collection data. + */ +var ParseTilesets = function (json) +{ + var tilesets = []; + var imageCollections = []; + var lastSet = null; + var stringID; + + for (var i = 0; i < json.tilesets.length; i++) + { + // name, firstgid, width, height, margin, spacing, properties + var set = json.tilesets[i]; + + if (set.source) + { + console.warn('External tilesets unsupported. Use Embed Tileset and re-export'); } + else if (set.image) + { + var newSet = new Tileset(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing, undefined, undefined, set.tileoffset); - return this; - }, + if (json.version > 1) + { + var datas = undefined; + var props = undefined; - /** - * Renders the list of collision points and normals to the given Graphics instance. - * - * The debug renderer calls this method if the `showCollisions` config value is set. - * - * This method is used internally by the Matter Debug Renderer, but is also exposed publically should - * you wish to render the Grid to your own Graphics instance. - * - * @method Phaser.Physics.Matter.World#renderCollisions - * @since 3.22.0 - * - * @param {MatterJS.Pair[]} pairs - An array of Matter Pairs to be rendered. - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. - * @param {number} lineColor - The line color. - * - * @return {this} This Matter World instance for method chaining. - */ - renderCollisions: function (pairs, graphics, lineColor) - { - graphics.lineStyle(1, lineColor, 0.5); - graphics.fillStyle(lineColor, 1); + if (Array.isArray(set.tiles)) + { + datas = datas || {}; + props = props || {}; - var i; - var pair; + // Tiled 1.2+ + for (var t = 0; t < set.tiles.length; t++) + { + var tile = set.tiles[t]; - // Collision Positions + // Convert tileproperties. + if (tile.properties) + { + var newPropData = {}; - for (i = 0; i < pairs.length; i++) - { - pair = pairs[i]; + tile.properties.forEach(function (propData) + { + newPropData[propData['name']] = propData['value']; + }); - if (!pair.isActive) - { - continue; - } + props[tile.id] = newPropData; + } - for (var j = 0; j < pair.activeContacts.length; j++) - { - var contact = pair.activeContacts[j]; - var vertex = contact.vertex; + // Convert objectgroup + if (tile.objectgroup) + { + (datas[tile.id] || (datas[tile.id] = {})).objectgroup = tile.objectgroup; - graphics.fillRect(vertex.x - 2, vertex.y - 2, 5, 5); - } - } + if (tile.objectgroup.objects) + { + var parsedObjects2 = tile.objectgroup.objects.map(function (obj) + { + return ParseObject(obj); + }); - // Collision Normals + datas[tile.id].objectgroup.objects = parsedObjects2; + } + } - for (i = 0; i < pairs.length; i++) - { - pair = pairs[i]; + // Copy animation data + if (tile.animation) + { + (datas[tile.id] || (datas[tile.id] = {})).animation = tile.animation; + } - if (!pair.isActive) - { - continue; - } + // Copy tile `type` field + // (see https://doc.mapeditor.org/en/latest/manual/custom-properties/#typed-tiles). + if (tile.type) + { + (datas[tile.id] || (datas[tile.id] = {})).type = tile.type; + } + } + } - var collision = pair.collision; - var contacts = pair.activeContacts; + if (Array.isArray(set.wangsets)) + { + datas = datas || {}; + props = props || {}; - if (contacts.length > 0) - { - var normalPosX = contacts[0].vertex.x; - var normalPosY = contacts[0].vertex.y; + ParseWangsets(set.wangsets, datas); + } - if (contacts.length === 2) + if (datas) // Implies also props is set. { - normalPosX = (contacts[0].vertex.x + contacts[1].vertex.x) / 2; - normalPosY = (contacts[0].vertex.y + contacts[1].vertex.y) / 2; + newSet.tileData = datas; + newSet.tileProperties = props; } + } + else + { + // Tiled 1 - if (collision.bodyB === collision.supports[0].body || collision.bodyA.isStatic) + // Properties stored per-tile in object with string indexes starting at "0" + if (set.tileproperties) { - graphics.lineBetween( - normalPosX - collision.normal.x * 8, - normalPosY - collision.normal.y * 8, - normalPosX, - normalPosY - ); + newSet.tileProperties = set.tileproperties; } - else + + // Object & terrain shapes stored per-tile in object with string indexes starting at "0" + if (set.tiles) { - graphics.lineBetween( - normalPosX + collision.normal.x * 8, - normalPosY + collision.normal.y * 8, - normalPosX, - normalPosY - ); + newSet.tileData = set.tiles; + + // Parse the objects into Phaser format to match handling of other Tiled objects + for (stringID in newSet.tileData) + { + var objectGroup = newSet.tileData[stringID].objectgroup; + + if (objectGroup && objectGroup.objects) + { + var parsedObjects1 = objectGroup.objects.map(function (obj) + { + return ParseObject(obj); + }); + + newSet.tileData[stringID].objectgroup.objects = parsedObjects1; + } + } } } - } - return this; - }, - - /** - * Renders the bounds of an array of Bodies to the given Graphics instance. - * - * If the body is a compound body, it will render the bounds for the parent compound. - * - * The debug renderer calls this method if the `showBounds` config value is set. - * - * This method is used internally by the Matter Debug Renderer, but is also exposed publically should - * you wish to render bounds to your own Graphics instance. - * - * @method Phaser.Physics.Matter.World#renderBodyBounds - * @since 3.22.0 - * - * @param {array} bodies - An array of bodies from the localWorld. - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. - * @param {number} lineColor - The line color. - * @param {number} lineOpacity - The line opacity, between 0 and 1. - */ - renderBodyBounds: function (bodies, graphics, lineColor, lineOpacity) - { - graphics.lineStyle(1, lineColor, lineOpacity); + // For a normal sliced tileset the row/count/size information is computed when updated. + // This is done (again) after the image is set. + newSet.updateTileData(set.imagewidth, set.imageheight); - for (var i = 0; i < bodies.length; i++) + tilesets.push(newSet); + } + else { - var body = bodies[i]; + var newCollection = new ImageCollection(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing, set.properties); - // 1) Don't show invisible bodies - if (!body.render.visible) + var maxId = 0; + + for (t = 0; t < set.tiles.length; t++) { - continue; - } + tile = set.tiles[t]; - var bounds = body.bounds; + var image = tile.image; + var tileId = parseInt(tile.id, 10); + var gid = set.firstgid + tileId; + newCollection.addImage(gid, image); - if (bounds) - { - graphics.strokeRect( - bounds.min.x, - bounds.min.y, - bounds.max.x - bounds.min.x, - bounds.max.y - bounds.min.y - ); + maxId = Math.max(tileId, maxId); } - else - { - var parts = body.parts; - for (var j = parts.length > 1 ? 1 : 0; j < parts.length; j++) - { - var part = parts[j]; - - graphics.strokeRect( - part.bounds.min.x, - part.bounds.min.y, - part.bounds.max.x - part.bounds.min.x, - part.bounds.max.y - part.bounds.min.y - ); - } - } + newCollection.maxId = maxId; + + imageCollections.push(newCollection); } - return this; - }, + // We've got a new Tileset, so set the lastgid into the previous one + if (lastSet) + { + lastSet.lastgid = set.firstgid - 1; + } - /** - * Renders either all axes, or a single axis indicator, for an array of Bodies, to the given Graphics instance. - * - * The debug renderer calls this method if the `showAxes` or `showAngleIndicator` config values are set. - * - * This method is used internally by the Matter Debug Renderer, but is also exposed publically should - * you wish to render bounds to your own Graphics instance. - * - * @method Phaser.Physics.Matter.World#renderBodyAxes - * @since 3.22.0 - * - * @param {array} bodies - An array of bodies from the localWorld. - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. - * @param {boolean} showAxes - If `true` it will render all body axes. If `false` it will render a single axis indicator. - * @param {number} lineColor - The line color. - * @param {number} lineOpacity - The line opacity, between 0 and 1. - */ - renderBodyAxes: function (bodies, graphics, showAxes, lineColor, lineOpacity) + lastSet = set; + } + + return { tilesets: tilesets, imageCollections: imageCollections }; +}; + +module.exports = ParseTilesets; + + +/***/ }), + +/***/ 39642: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Parses out the Wangset information from Tiled 1.1.5+ map data, if present. + * + * Since a given tile can be in more than one wangset, the resulting properties + * are nested. `tile.data.wangid[someWangsetName]` will return the array-based wang id in + * this implementation. + * + * Note that we're not guaranteed that there will be any 'normal' tiles if the only + * thing in the tilset are wangtile definitions, so this has to be parsed separately. + * + * See https://doc.mapeditor.org/en/latest/manual/using-wang-tiles/ for more information. + * + * @function Phaser.Tilemaps.Parsers.Tiled.ParseWangsets + * @since 3.53.0 + * + * @param {Array.} wangsets - The array of wangset objects (parsed from JSON) + * @param {object} datas - The field into which to put wangset data from Tiled. + * + * @return {object} An object containing the tileset and image collection data. + */ +var ParseWangsets = function (wangsets, datas) +{ + for (var w = 0; w < wangsets.length; w++) { - graphics.lineStyle(1, lineColor, lineOpacity); + var wangset = wangsets[w]; + var identifier = w; - for (var i = 0; i < bodies.length; i++) + if (wangset.name && wangset.name !== '') { - var body = bodies[i]; - var parts = body.parts; + identifier = wangset.name; + } - // 1) Don't show invisible bodies - if (!body.render.visible) - { - continue; - } + if (Array.isArray(wangset.wangtiles) && wangset.wangtiles.length > 0) + { + var edgeColors = {}; + var cornerColors = {}; - var part; - var j; - var k; + var c; + var color; + var colorIndex; - if (showAxes) + // Tiled before v2020.09.09 + if (Array.isArray(wangset.edgecolors)) { - for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) + for (c = 0; c < wangset.edgecolors.length; c++) { - part = parts[j]; - - for (k = 0; k < part.axes.length; k++) - { - var axis = part.axes[k]; + colorIndex = 1 + c; + color = wangset.edgecolors[c]; - graphics.lineBetween( - part.position.x, - part.position.y, - part.position.x + axis.x * 20, - part.position.y + axis.y * 20 - ); + if (color.name !== '') + { + edgeColors[colorIndex] = color.name; } } } - else + + if (Array.isArray(wangset.cornercolors)) { - for (j = parts.length > 1 ? 1 : 0; j < parts.length; j++) + for (c = 0; c < wangset.cornercolors.length; c++) { - part = parts[j]; - - for (k = 0; k < part.axes.length; k++) + colorIndex = 1 + c; + color = wangset.cornercolors[c]; + + if (color.name !== '') { - graphics.lineBetween( - part.position.x, - part.position.y, - (part.vertices[0].x + part.vertices[part.vertices.length - 1].x) / 2, - (part.vertices[0].y + part.vertices[part.vertices.length - 1].y) / 2 - ); + cornerColors[colorIndex] = color.name; } } } - } - return this; - }, + // Tiled after v2020.09.09 + if (Array.isArray(wangset.colors)) + { + for (c = 0; c < wangset.colors.length; c++) + { + color = wangset.colors[c]; + colorIndex = 1 + c; - /** - * Renders a velocity indicator for an array of Bodies, to the given Graphics instance. - * - * The debug renderer calls this method if the `showVelocity` config value is set. - * - * This method is used internally by the Matter Debug Renderer, but is also exposed publically should - * you wish to render bounds to your own Graphics instance. - * - * @method Phaser.Physics.Matter.World#renderBodyVelocity - * @since 3.22.0 - * - * @param {array} bodies - An array of bodies from the localWorld. - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. - * @param {number} lineColor - The line color. - * @param {number} lineOpacity - The line opacity, between 0 and 1. - * @param {number} lineThickness - The line thickness. - */ - renderBodyVelocity: function (bodies, graphics, lineColor, lineOpacity, lineThickness) - { - graphics.lineStyle(lineThickness, lineColor, lineOpacity); + if (color.name !== '') + { + edgeColors[colorIndex] = cornerColors[colorIndex] = color.name; + } + } + } - for (var i = 0; i < bodies.length; i++) - { - var body = bodies[i]; + // The wangid layout is north, northeast, east, southeast, etc. + var idLayout = [ + edgeColors, cornerColors, edgeColors, cornerColors, + edgeColors, cornerColors, edgeColors, cornerColors + ]; - // 1) Don't show invisible bodies - if (!body.render.visible) + for (var t = 0; t < wangset.wangtiles.length; t++) { - continue; - } - - graphics.lineBetween( - body.position.x, - body.position.y, - body.position.x + (body.position.x - body.positionPrev.x) * 2, - body.position.y + (body.position.y - body.positionPrev.y) * 2 - ); - } + var wangtile = wangset.wangtiles[t]; - return this; - }, + var obj = (datas[wangtile.tileid] || (datas[wangtile.tileid] = {})); - /** - * Renders the given array of Bodies to the debug graphics instance. - * - * Called automatically by the `postUpdate` method. - * - * @method Phaser.Physics.Matter.World#renderBodies - * @private - * @since 3.14.0 - * - * @param {array} bodies - An array of bodies from the localWorld. - */ - renderBodies: function (bodies) - { - var graphics = this.debugGraphic; + obj = (obj.wangid || (obj.wangid = {})); - var config = this.debugConfig; + var wangid = []; - var showBody = config.showBody; - var showStaticBody = config.showStaticBody; - var showSleeping = config.showSleeping; - var showInternalEdges = config.showInternalEdges; - var showConvexHulls = config.showConvexHulls; + for (var i = 0; i < Math.min(idLayout.length, wangtile.wangid.length); i++) + { + color = wangtile.wangid[i]; - var renderFill = config.renderFill; - var renderLine = config.renderLine; + if (color === 0) + { + wangid.push(undefined); + continue; + } - var staticBodySleepOpacity = config.staticBodySleepOpacity; - var sleepFillColor = config.sleepFillColor; - var sleepLineColor = config.sleepLineColor; + var renamed = idLayout[i][color]; - var hullColor = config.hullColor; + if (renamed !== undefined) + { + wangid.push(renamed); + continue; + } - for (var i = 0; i < bodies.length; i++) - { - var body = bodies[i]; + wangid.push(color); + } - // 1) Don't show invisible bodies - if (!body.render.visible) - { - continue; + obj[identifier] = wangid; } + } + } +}; - // 2) Don't show static bodies, OR - // 3) Don't show dynamic bodies - if ((!showStaticBody && body.isStatic) || (!showBody && !body.isStatic)) - { - continue; - } +module.exports = ParseWangsets; - var lineColor = body.render.lineColor; - var lineOpacity = body.render.lineOpacity; - var lineThickness = body.render.lineThickness; - var fillColor = body.render.fillColor; - var fillOpacity = body.render.fillOpacity; - if (showSleeping && body.isSleeping) - { - if (body.isStatic) - { - lineOpacity *= staticBodySleepOpacity; - fillOpacity *= staticBodySleepOpacity; - } - else - { - lineColor = sleepLineColor; - fillColor = sleepFillColor; - } - } +/***/ }), - if (!renderFill) - { - fillColor = null; - } +/***/ 50044: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (!renderLine) - { - lineColor = null; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this.renderBody(body, graphics, showInternalEdges, lineColor, lineOpacity, lineThickness, fillColor, fillOpacity); +/** + * @namespace Phaser.Tilemaps.Parsers.Tiled + */ - var partsLength = body.parts.length; +module.exports = { - if (showConvexHulls && partsLength > 1) - { - this.renderConvexHull(body, graphics, hullColor, lineThickness); - } - } - }, + AssignTileProperties: __webpack_require__(48646), + Base64Decode: __webpack_require__(43908), + BuildTilesetIndex: __webpack_require__(14556), + CreateGroupLayer: __webpack_require__(92044), + ParseGID: __webpack_require__(8847), + ParseImageLayers: __webpack_require__(78339), + ParseJSONTiled: __webpack_require__(2378), + ParseObject: __webpack_require__(4281), + ParseObjectLayers: __webpack_require__(61136), + ParseTileLayers: __webpack_require__(95925), + ParseTilesets: __webpack_require__(93392) - /** - * Renders a single Matter Body to the given Phaser Graphics Game Object. - * - * This method is used internally by the Matter Debug Renderer, but is also exposed publically should - * you wish to render a Body to your own Graphics instance. - * - * If you don't wish to render a line around the body, set the `lineColor` parameter to `null`. - * Equally, if you don't wish to render a fill, set the `fillColor` parameter to `null`. - * - * @method Phaser.Physics.Matter.World#renderBody - * @since 3.22.0 - * - * @param {MatterJS.BodyType} body - The Matter Body to be rendered. - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. - * @param {boolean} showInternalEdges - Render internal edges of the polygon? - * @param {number} [lineColor] - The line color. - * @param {number} [lineOpacity] - The line opacity, between 0 and 1. - * @param {number} [lineThickness=1] - The line thickness. - * @param {number} [fillColor] - The fill color. - * @param {number} [fillOpacity] - The fill opacity, between 0 and 1. - * - * @return {this} This Matter World instance for method chaining. - */ - renderBody: function (body, graphics, showInternalEdges, lineColor, lineOpacity, lineThickness, fillColor, fillOpacity) - { - if (lineColor === undefined) { lineColor = null; } - if (lineOpacity === undefined) { lineOpacity = null; } - if (lineThickness === undefined) { lineThickness = 1; } - if (fillColor === undefined) { fillColor = null; } - if (fillOpacity === undefined) { fillOpacity = null; } +}; - var config = this.debugConfig; - var sensorFillColor = config.sensorFillColor; - var sensorLineColor = config.sensorLineColor; +/***/ }), - // Handle compound parts - var parts = body.parts; - var partsLength = parts.length; +/***/ 73779: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - for (var k = (partsLength > 1) ? 1 : 0; k < partsLength; k++) - { - var part = parts[k]; - var render = part.render; - var opacity = render.opacity; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (!render.visible || opacity === 0 || (part.isSensor && !config.showSensors)) - { - continue; - } +var Class = __webpack_require__(56694); +var PluginCache = __webpack_require__(91963); +var SceneEvents = __webpack_require__(7599); +var TimerEvent = __webpack_require__(57911); +var Remove = __webpack_require__(66458); - // Part polygon - var circleRadius = part.circleRadius; +/** + * @classdesc + * The Clock is a Scene plugin which creates and updates Timer Events for its Scene. + * + * @class Clock + * @memberof Phaser.Time + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Scene} scene - The Scene which owns this Clock. + */ +var Clock = new Class({ - graphics.beginPath(); + initialize: - if (part.isSensor) - { - if (fillColor !== null) - { - graphics.fillStyle(sensorFillColor, fillOpacity * opacity); - } - - if (lineColor !== null) - { - graphics.lineStyle(lineThickness, sensorLineColor, lineOpacity * opacity); - } - } - else - { - if (fillColor !== null) - { - graphics.fillStyle(fillColor, fillOpacity * opacity); - } - - if (lineColor !== null) - { - graphics.lineStyle(lineThickness, lineColor, lineOpacity * opacity); - } - } + function Clock (scene) + { + /** + * The Scene which owns this Clock. + * + * @name Phaser.Time.Clock#scene + * @type {Phaser.Scene} + * @since 3.0.0 + */ + this.scene = scene; - if (circleRadius) - { - graphics.arc(part.position.x, part.position.y, circleRadius, 0, 2 * Math.PI); - } - else - { - var vertices = part.vertices; - var vertLength = vertices.length; + /** + * The Scene Systems object of the Scene which owns this Clock. + * + * @name Phaser.Time.Clock#systems + * @type {Phaser.Scenes.Systems} + * @since 3.0.0 + */ + this.systems = scene.sys; - graphics.moveTo(vertices[0].x, vertices[0].y); + /** + * The current time of the Clock, in milliseconds. + * + * If accessed externally, this is equivalent to the `time` parameter normally passed to a Scene's `update` method. + * + * @name Phaser.Time.Clock#now + * @type {number} + * @since 3.0.0 + */ + this.now = 0; - for (var j = 1; j < vertLength; j++) - { - var vert = vertices[j]; + /** + * The time the Clock (and Scene) started, in milliseconds. + * + * This can be compared to the `time` parameter passed to a Scene's `update` method. + * + * @name Phaser.Time.Clock#startTime + * @type {number} + * @since 3.60.0 + */ + this.startTime = 0; - if (!vertices[j - 1].isInternal || showInternalEdges) - { - graphics.lineTo(vert.x, vert.y); - } - else - { - graphics.moveTo(vert.x, vert.y); - } + /** + * The scale of the Clock's time delta. + * + * The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Clock and anything which uses it, such as its Timer Events. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing the Clock. + * + * @name Phaser.Time.Clock#timeScale + * @type {number} + * @default 1 + * @since 3.0.0 + */ + this.timeScale = 1; - if (j < vertLength && vert.isInternal && !showInternalEdges) - { - var nextIndex = (j + 1) % vertLength; + /** + * Whether the Clock is paused (`true`) or active (`false`). + * + * When paused, the Clock will not update any of its Timer Events, thus freezing time. + * + * @name Phaser.Time.Clock#paused + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.paused = false; - graphics.moveTo(vertices[nextIndex].x, vertices[nextIndex].y); - } - } - - graphics.closePath(); - } + /** + * An array of all Timer Events whose delays haven't expired - these are actively updating Timer Events. + * + * @name Phaser.Time.Clock#_active + * @type {Phaser.Time.TimerEvent[]} + * @private + * @default [] + * @since 3.0.0 + */ + this._active = []; - if (fillColor !== null) - { - graphics.fillPath(); - } + /** + * An array of all Timer Events which will be added to the Clock at the start of the next frame. + * + * @name Phaser.Time.Clock#_pendingInsertion + * @type {Phaser.Time.TimerEvent[]} + * @private + * @default [] + * @since 3.0.0 + */ + this._pendingInsertion = []; - if (lineColor !== null) - { - graphics.strokePath(); - } - } + /** + * An array of all Timer Events which will be removed from the Clock at the start of the next frame. + * + * @name Phaser.Time.Clock#_pendingRemoval + * @type {Phaser.Time.TimerEvent[]} + * @private + * @default [] + * @since 3.0.0 + */ + this._pendingRemoval = []; - if (config.showPositions && !body.isStatic) - { - var px = body.position.x; - var py = body.position.y; - var hs = Math.ceil(config.positionSize / 2); + scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + scene.sys.events.on(SceneEvents.START, this.start, this); + }, - graphics.fillStyle(config.positionColor, 1); - graphics.fillRect(px - hs, py - hs, config.positionSize, config.positionSize); - } + /** + * This method is called automatically, only once, when the Scene is first created. + * Do not invoke it directly. + * + * @method Phaser.Time.Clock#boot + * @private + * @since 3.5.1 + */ + boot: function () + { + // Sync with the TimeStep + this.now = this.systems.game.loop.time; - return this; + this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** - * Renders the Convex Hull for a single Matter Body to the given Phaser Graphics Game Object. - * - * This method is used internally by the Matter Debug Renderer, but is also exposed publically should - * you wish to render a Body hull to your own Graphics instance. - * - * @method Phaser.Physics.Matter.World#renderConvexHull - * @since 3.22.0 - * - * @param {MatterJS.BodyType} body - The Matter Body to be rendered. - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. - * @param {number} hullColor - The color used to render the hull. - * @param {number} [lineThickness=1] - The hull line thickness. - * - * @return {this} This Matter World instance for method chaining. + * This method is called automatically by the Scene when it is starting up. + * It is responsible for creating local systems, properties and listening for Scene events. + * Do not invoke it directly. + * + * @method Phaser.Time.Clock#start + * @private + * @since 3.5.0 */ - renderConvexHull: function (body, graphics, hullColor, lineThickness) + start: function () { - if (lineThickness === undefined) { lineThickness = 1; } + this.startTime = this.systems.game.loop.time; - var parts = body.parts; - var partsLength = parts.length; - - // Render Convex Hulls - if (partsLength > 1) - { - var verts = body.vertices; + var eventEmitter = this.systems.events; - graphics.lineStyle(lineThickness, hullColor); + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); + }, - graphics.beginPath(); + /** + * Creates a Timer Event and adds it to this Clock at the start of the next frame. + * + * You can pass in either a `TimerEventConfig` object, from with a new `TimerEvent` will + * be created, or you can pass in a `TimerEvent` instance. + * + * If passing an instance please make sure that this instance hasn't been used before. + * If it has ever entered a 'completed' state then it will no longer be suitable to + * run again. + * + * Also, if the `TimerEvent` instance is being used by _another_ Clock (in another Scene) + * it will still be updated by that Clock as well, so be careful when using this feature. + * + * @method Phaser.Time.Clock#addEvent + * @since 3.0.0 + * + * @param {(Phaser.Time.TimerEvent | Phaser.Types.Time.TimerEventConfig)} config - The configuration for the Timer Event, or an existing Timer Event object. + * + * @return {Phaser.Time.TimerEvent} The Timer Event which was created, or passed in. + */ + addEvent: function (config) + { + var event; - graphics.moveTo(verts[0].x, verts[0].y); + if (config instanceof TimerEvent) + { + event = config; - for (var v = 1; v < verts.length; v++) - { - graphics.lineTo(verts[v].x, verts[v].y); - } - - graphics.lineTo(verts[0].x, verts[0].y); + this.removeEvent(event); - graphics.strokePath(); + event.elapsed = event.startAt; + event.hasDispatched = false; + event.repeatCount = (event.repeat === -1 || event.loop) ? 999999999999 : event.repeat; + } + else + { + event = new TimerEvent(config); } - return this; + this._pendingInsertion.push(event); + + return event; }, /** - * Renders all of the constraints in the world (unless they are specifically set to invisible). - * - * Called automatically by the `postUpdate` method. + * Creates a Timer Event and adds it to the Clock at the start of the frame. * - * @method Phaser.Physics.Matter.World#renderJoints - * @private - * @since 3.14.0 + * This is a shortcut for {@link #addEvent} which can be shorter and is compatible with the syntax of the GreenSock Animation Platform (GSAP). + * + * @method Phaser.Time.Clock#delayedCall + * @since 3.0.0 + * + * @param {number} delay - The delay of the function call, in milliseconds. + * @param {function} callback - The function to call after the delay expires. + * @param {Array.<*>} [args] - The arguments to call the function with. + * @param {*} [callbackScope] - The scope (`this` object) to call the function with. + * + * @return {Phaser.Time.TimerEvent} The Timer Event which was created. */ - renderJoints: function () + delayedCall: function (delay, callback, args, callbackScope) { - var graphics = this.debugGraphic; + return this.addEvent({ delay: delay, callback: callback, args: args, callbackScope: callbackScope }); + }, - // Render constraints - var constraints = Composite.allConstraints(this.localWorld); + /** + * Clears and recreates the array of pending Timer Events. + * + * @method Phaser.Time.Clock#clearPendingEvents + * @since 3.0.0 + * + * @return {this} - This Clock instance. + */ + clearPendingEvents: function () + { + this._pendingInsertion = []; - for (var i = 0; i < constraints.length; i++) + return this; + }, + + /** + * Removes the given Timer Event, or an array of Timer Events, from this Clock. + * + * The events are removed from all internal lists (active, pending and removal), + * freeing the event up to be re-used. + * + * @method Phaser.Time.Clock#removeEvent + * @since 3.50.0 + * + * @param {(Phaser.Time.TimerEvent | Phaser.Time.TimerEvent[])} events - The Timer Event, or an array of Timer Events, to remove from this Clock. + * + * @return {this} - This Clock instance. + */ + removeEvent: function (events) + { + if (!Array.isArray(events)) { - var config = constraints[i].render; + events = [ events ]; + } - var lineColor = config.lineColor; - var lineOpacity = config.lineOpacity; - var lineThickness = config.lineThickness; - var pinSize = config.pinSize; - var anchorColor = config.anchorColor; - var anchorSize = config.anchorSize; + for (var i = 0; i < events.length; i++) + { + var event = events[i]; - this.renderConstraint(constraints[i], graphics, lineColor, lineOpacity, lineThickness, pinSize, anchorColor, anchorSize); + Remove(this._pendingRemoval, event); + Remove(this._pendingInsertion, event); + Remove(this._active, event); } + + return this; }, /** - * Renders a single Matter Constraint, such as a Pin or a Spring, to the given Phaser Graphics Game Object. - * - * This method is used internally by the Matter Debug Renderer, but is also exposed publically should - * you wish to render a Constraint to your own Graphics instance. - * - * @method Phaser.Physics.Matter.World#renderConstraint - * @since 3.22.0 - * - * @param {MatterJS.ConstraintType} constraint - The Matter Constraint to render. - * @param {Phaser.GameObjects.Graphics} graphics - The Graphics object to render to. - * @param {number} lineColor - The line color. - * @param {number} lineOpacity - The line opacity, between 0 and 1. - * @param {number} lineThickness - The line thickness. - * @param {number} pinSize - If this constraint is a pin, this sets the size of the pin circle. - * @param {number} anchorColor - The color used when rendering this constraints anchors. Set to `null` to not render anchors. - * @param {number} anchorSize - The size of the anchor circle, if this constraint has anchors and is rendering them. - * - * @return {this} This Matter World instance for method chaining. + * Schedules all active Timer Events for removal at the start of the frame. + * + * @method Phaser.Time.Clock#removeAllEvents + * @since 3.0.0 + * + * @return {this} - This Clock instance. */ - renderConstraint: function (constraint, graphics, lineColor, lineOpacity, lineThickness, pinSize, anchorColor, anchorSize) + removeAllEvents: function () { - var render = constraint.render; + this._pendingRemoval = this._pendingRemoval.concat(this._active); - if (!render.visible || !constraint.pointA || !constraint.pointB) + return this; + }, + + /** + * Updates the arrays of active and pending Timer Events. Called at the start of the frame. + * + * @method Phaser.Time.Clock#preUpdate + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + preUpdate: function () + { + var toRemove = this._pendingRemoval.length; + var toInsert = this._pendingInsertion.length; + + if (toRemove === 0 && toInsert === 0) { - return this; + // Quick bail + return; } - graphics.lineStyle(lineThickness, lineColor, lineOpacity); + var i; + var event; - var bodyA = constraint.bodyA; - var bodyB = constraint.bodyB; - var start; - var end; + // Delete old events + for (i = 0; i < toRemove; i++) + { + event = this._pendingRemoval[i]; + + var index = this._active.indexOf(event); + + if (index > -1) + { + this._active.splice(index, 1); + } + + // Pool them? + event.destroy(); + } + + for (i = 0; i < toInsert; i++) + { + event = this._pendingInsertion[i]; + + this._active.push(event); + } + + // Clear the lists + this._pendingRemoval.length = 0; + this._pendingInsertion.length = 0; + }, + + /** + * Updates the Clock's internal time and all of its Timer Events. + * + * @method Phaser.Time.Clock#update + * @since 3.0.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + update: function (time, delta) + { + this.now = time; - if (bodyA) - { - start = Vector.add(bodyA.position, constraint.pointA); - } - else + if (this.paused) { - start = constraint.pointA; + return; } - if (render.type === 'pin') - { - graphics.strokeCircle(start.x, start.y, pinSize); - } - else + delta *= this.timeScale; + + for (var i = 0; i < this._active.length; i++) { - if (bodyB) - { - end = Vector.add(bodyB.position, constraint.pointB); - } - else + var event = this._active[i]; + + if (event.paused) { - end = constraint.pointB; + continue; } - graphics.beginPath(); - graphics.moveTo(start.x, start.y); + // Use delta time to increase elapsed. + // Avoids needing to adjust for pause / resume. + // Automatically smoothed by TimeStep class. + // In testing accurate to +- 1ms! + event.elapsed += delta * event.timeScale; - if (render.type === 'spring') + if (event.elapsed >= event.delay) { - var delta = Vector.sub(end, start); - var normal = Vector.perp(Vector.normalise(delta)); - var coils = Math.ceil(Common.clamp(constraint.length / 5, 12, 20)); - var offset; + var remainder = event.elapsed - event.delay; - for (var j = 1; j < coils; j += 1) - { - offset = (j % 2 === 0) ? 1 : -1; + // Limit it, in case it's checked in the callback + event.elapsed = event.delay; - graphics.lineTo( - start.x + delta.x * (j / coils) + normal.x * offset * 4, - start.y + delta.y * (j / coils) + normal.y * offset * 4 - ); + // Process the event + if (!event.hasDispatched && event.callback) + { + event.hasDispatched = true; + event.callback.apply(event.callbackScope, event.args); } - } - - graphics.lineTo(end.x, end.y); - } - graphics.strokePath(); - - if (render.anchors && anchorSize > 0) - { - graphics.fillStyle(anchorColor); - graphics.fillCircle(start.x, start.y, anchorSize); - graphics.fillCircle(end.x, end.y, anchorSize); - } + if (event.repeatCount > 0) + { + event.repeatCount--; - return this; - }, + // Very short delay + if (remainder >= event.delay) + { + while ((remainder >= event.delay) && (event.repeatCount > 0)) + { + if (event.callback) + { + event.callback.apply(event.callbackScope, event.args); + } - /** - * Resets the internal collision IDs that Matter.JS uses for Body collision groups. - * - * You should call this before destroying your game if you need to restart the game - * again on the same page, without first reloading the page. Or, if you wish to - * consistently destroy a Scene that contains Matter.js and then run it again - * later in the same game. - * - * @method Phaser.Physics.Matter.World#resetCollisionIDs - * @since 3.17.0 - */ - resetCollisionIDs: function () - { - Body._nextCollidingGroupId = 1; - Body._nextNonCollidingGroupId = -1; - Body._nextCategory = 0x0001; + remainder -= event.delay; + event.repeatCount--; + } + } - return this; + event.elapsed = remainder; + event.hasDispatched = false; + } + else if (event.hasDispatched) + { + this._pendingRemoval.push(event); + } + } + } }, /** - * Will remove all Matter physics event listeners and clear the matter physics world, - * engine and any debug graphics, if any. + * The Scene that owns this plugin is shutting down. + * We need to kill and reset all internal properties as well as stop listening to Scene events. * - * @method Phaser.Physics.Matter.World#shutdown + * @method Phaser.Time.Clock#shutdown + * @private * @since 3.0.0 */ shutdown: function () { - MatterEvents.off(this.engine); - - this.removeAllListeners(); + var i; - MatterWorld.clear(this.localWorld, false); + for (i = 0; i < this._pendingInsertion.length; i++) + { + this._pendingInsertion[i].destroy(); + } - Engine.clear(this.engine); + for (i = 0; i < this._active.length; i++) + { + this._active[i].destroy(); + } - if (this.drawDebug) + for (i = 0; i < this._pendingRemoval.length; i++) { - this.debugGraphic.destroy(); + this._pendingRemoval[i].destroy(); } + + this._active.length = 0; + this._pendingRemoval.length = 0; + this._pendingInsertion.length = 0; + + var eventEmitter = this.systems.events; + + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * Will remove all Matter physics event listeners and clear the matter physics world, - * engine and any debug graphics, if any. - * - * After destroying the world it cannot be re-used again. + * The Scene that owns this plugin is being destroyed. + * We need to shutdown and then kill off all external references. * - * @method Phaser.Physics.Matter.World#destroy + * @method Phaser.Time.Clock#destroy + * @private * @since 3.0.0 */ destroy: function () { this.shutdown(); + + this.scene.sys.events.off(SceneEvents.START, this.start, this); + + this.scene = null; + this.systems = null; } }); -module.exports = World; +PluginCache.register('Clock', Clock, 'time'); + +module.exports = Clock; /***/ }), -/* 1403 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 20517: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @namespace Phaser.Plugins - */ - -module.exports = { - - BasePlugin: __webpack_require__(540), - DefaultPlugins: __webpack_require__(197), - PluginCache: __webpack_require__(24), - PluginManager: __webpack_require__(414), - ScenePlugin: __webpack_require__(1404) - -}; - - -/***/ }), -/* 1404 */ -/***/ (function(module, exports, __webpack_require__) { - -/** -* @author Richard Davey -* @copyright 2020 Photon Storm Ltd. -* @license {@link https://github.com/photonstorm/phaser3-plugin-template/blob/master/LICENSE|MIT License} -*/ - -var BasePlugin = __webpack_require__(540); -var Class = __webpack_require__(0); -var SceneEvents = __webpack_require__(20); +var Class = __webpack_require__(56694); +var EventEmitter = __webpack_require__(6659); +var GameObjectFactory = __webpack_require__(61286); +var GetFastValue = __webpack_require__(72632); +var SceneEvents = __webpack_require__(7599); /** * @classdesc - * A Scene Level Plugin is installed into every Scene and belongs to that Scene. - * It can listen for Scene events and respond to them. - * It can map itself to a Scene property, or into the Scene Systems, or both. + * A Timeline is a way to schedule events to happen at specific times in the future. * - * @class ScenePlugin - * @memberof Phaser.Plugins - * @extends Phaser.Plugins.BasePlugin + * You can think of it as an event sequencer for your game, allowing you to schedule the + * running of callbacks, events and other actions at specific times in the future. + * + * A Timeline is a Scene level system, meaning you can have as many Timelines as you like, each + * belonging to a different Scene. You can also have multiple Timelines running at the same time. + * + * If the Scene is paused, the Timeline will also pause. If the Scene is destroyed, the Timeline + * will be automatically destroyed. However, you can control the Timeline directly, pausing, + * resuming and stopping it at any time. + * + * Create an instance of a Timeline via the Game Object Factory: + * + * ```js + * const timeline = this.add.timeline(); + * ``` + * + * The Timeline always starts paused. You must call `play` on it to start it running. + * + * You can also pass in a configuration object on creation, or an array of them: + * + * ```js + * const timeline = this.add.timeline({ + * at: 1000, + * run: () => { + * this.add.sprite(400, 300, 'logo'); + * } + * }); + * + * timeline.play(); + * ``` + * + * In this example we sequence a few different events: + * + * ```js + * const timeline = this.add.timeline([ + * { + * at: 1000, + * run: () => { this.logo = this.add.sprite(400, 300, 'logo'); }, + * sound: 'TitleMusic' + * }, + * { + * at: 2500, + * tween: { + * targets: this.logo, + * y: 600, + * yoyo: true + * }, + * sound: 'Explode' + * }, + * { + * at: 8000, + * event: 'HURRY_PLAYER', + * target: this.background, + * set: { + * tint: 0xff0000 + * } + * } + * ]); + * + * timeline.play(); + * ``` + * + * There are lots of options available to you via the configuration object. See the + * {@link Phaser.Types.Time.TimelineEventConfig} typedef for more details. + * + * @class Timeline + * @memberof Phaser.Time * @constructor - * @since 3.8.0 + * @since 3.60.0 * - * @param {Phaser.Scene} scene - A reference to the Scene that has installed this plugin. - * @param {Phaser.Plugins.PluginManager} pluginManager - A reference to the Plugin Manager. - * @param {string} pluginKey - The key under which this plugin has been installed into the Scene Systems. + * @param {Phaser.Scene} scene - The Scene which owns this Timeline. + * @param {Phaser.Types.Time.TimelineEventConfig|Phaser.Types.Time.TimelineEventConfig[]} config - The configuration object for this Timeline Event, or an array of them. */ -var ScenePlugin = new Class({ +var Timeline = new Class({ - Extends: BasePlugin, + Extends: EventEmitter, initialize: - function ScenePlugin (scene, pluginManager, pluginKey) + function Timeline (scene, config) { - BasePlugin.call(this, pluginManager); + EventEmitter.call(this); /** - * A reference to the Scene that has installed this plugin. - * Only set if it's a Scene Plugin, otherwise `null`. - * This property is only set when the plugin is instantiated and added to the Scene, not before. - * You can use it during the `boot` method. + * The Scene to which this Timeline belongs. * - * @name Phaser.Plugins.ScenePlugin#scene - * @type {?Phaser.Scene} - * @protected - * @since 3.8.0 + * @name Phaser.Time.Timeline#scene + * @type {Phaser.Scene} + * @since 3.60.0 */ this.scene = scene; /** - * A reference to the Scene Systems of the Scene that has installed this plugin. - * Only set if it's a Scene Plugin, otherwise `null`. - * This property is only set when the plugin is instantiated and added to the Scene, not before. - * You can use it during the `boot` method. + * A reference to the Scene Systems. * - * @name Phaser.Plugins.ScenePlugin#systems - * @type {?Phaser.Scenes.Systems} - * @protected - * @since 3.8.0 + * @name Phaser.Time.Timeline#systems + * @type {Phaser.Scenes.Systems} + * @since 3.60.0 */ this.systems = scene.sys; /** - * The key under which this plugin was installed into the Scene Systems. + * The elapsed time counter. * - * This property is only set when the plugin is instantiated and added to the Scene, not before. - * You can use it during the `boot` method. + * Treat this as read-only. * - * @name Phaser.Plugins.ScenePlugin#pluginKey - * @type {string} - * @readonly - * @since 3.54.0 + * @name Phaser.Time.Timeline#elapsed + * @type {number} + * @since 3.60.0 */ - this.pluginKey = pluginKey; + this.elapsed = 0; - scene.sys.events.once(SceneEvents.BOOT, this.boot, this); + /** + * Whether the Timeline is running (`true`) or active (`false`). + * + * When paused, the Timeline will not run any of its actions. + * + * By default a Timeline is always paused and should be started by + * calling the `Timeline.play` method. + * + * You can use the `Timeline.pause` and `Timeline.resume` methods to control + * this value in a chainable way. + * + * @name Phaser.Time.Timeline#paused + * @type {boolean} + * @default true + * @since 3.60.0 + */ + this.paused = true; + + /** + * Whether the Timeline is complete (`true`) or not (`false`). + * + * A Timeline is considered complete when all of its events have been run. + * + * If you wish to restart a Timeline after it has completed, you can do so + * by calling the `Timeline.restart` method. + * + * You can also use the `Timeline.stop` method to stop a running Timeline, + * at any point, without resetting it. + * + * @name Phaser.Time.Timeline#complete + * @type {boolean} + * @default false + * @since 3.60.0 + */ + this.complete = false; + + /** + * The total number of events that have been run. + * + * This value is reset to zero if the Timeline is restarted. + * + * Treat this as read-only. + * + * @name Phaser.Time.Timeline#totalComplete + * @type {number} + * @since 3.60.0 + */ + this.totalComplete = 0; + + /** + * An array of all the Timeline Events. + * + * @name Phaser.Time.Timeline#events + * @type {Phaser.Types.Time.TimelineEvent[]} + * @since 3.60.0 + */ + this.events = []; + + var eventEmitter = this.systems.events; + + eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.on(SceneEvents.UPDATE, this.update, this); + eventEmitter.once(SceneEvents.SHUTDOWN, this.destroy, this); + + if (config) + { + this.add(config); + } }, /** - * This method is called when the Scene boots. It is only ever called once. - * - * By this point the plugin properties `scene` and `systems` will have already been set. - * - * In here you can listen for {@link Phaser.Scenes.Events Scene events} and set-up whatever you need for this plugin to run. - * Here are the Scene events you can listen to: - * - * - start - * - ready - * - preupdate - * - update - * - postupdate - * - resize - * - pause - * - resume - * - sleep - * - wake - * - transitioninit - * - transitionstart - * - transitioncomplete - * - transitionout - * - shutdown - * - destroy - * - * At the very least you should offer a destroy handler for when the Scene closes down, i.e: + * Updates the elapsed time counter, if this Timeline is not paused. * - * ```javascript - * var eventEmitter = this.systems.events; - * eventEmitter.once('destroy', this.sceneDestroy, this); - * ``` + * @method Phaser.Time.Timeline#preUpdate + * @since 3.60.0 * - * @method Phaser.Plugins.ScenePlugin#boot - * @since 3.8.0 + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ - boot: function () + preUpdate: function (time, delta) { + if (this.paused) + { + return; + } + + this.elapsed += delta; }, /** - * Game instance has been destroyed. + * Called automatically by the Scene update step. * - * You must release everything in here, all references, all objects, free it all up. + * Iterates through all of the Timeline Events and checks to see if they should be run. * - * @method Phaser.Plugins.ScenePlugin#destroy - * @since 3.8.0 + * If they should be run, then the `TimelineEvent.action` callback is invoked. + * + * If the `TimelineEvent.once` property is `true` then the event is removed from the Timeline. + * + * If the `TimelineEvent.event` property is set then the Timeline emits that event. + * + * If the `TimelineEvent.run` property is set then the Timeline invokes that method. + * + * If the `TimelineEvent.target` property is set then the Timeline invokes the `run` method on that target. + * + * @method Phaser.Time.Timeline#update + * @since 3.60.0 + * + * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. */ - destroy: function () + update: function () { - this.pluginManager = null; - this.game = null; - this.scene = null; - this.systems = null; - } - -}); - -module.exports = ScenePlugin; + if (this.paused) + { + return; + } + var i; + var events = this.events; + var removeSweep = false; + var sys = this.systems; + var target; -/***/ }), -/* 1405 */ -/***/ (function(module, exports, __webpack_require__) { + for (i = 0; i < events.length; i++) + { + var event = events[i]; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (!event.complete && event.time <= this.elapsed) + { + event.complete = true; -/** - * @namespace Phaser.Renderer - */ + this.totalComplete++; -/** - * @namespace Phaser.Types.Renderer - */ + if (event.once) + { + removeSweep = true; + } -module.exports = { + if (event.set && event.target) + { + // set is an object of key value pairs, apply them to target + for (var key in event.set) + { + event.target[key] = event.set[key]; + } + } - Canvas: __webpack_require__(1406), - Events: __webpack_require__(91), - Snapshot: __webpack_require__(1407), - WebGL: __webpack_require__(1408) + if (event.tween) + { + sys.tweens.add(event.tween); + } -}; + if (event.sound) + { + if (typeof event.sound === 'string') + { + sys.sound.play(event.sound); + } + else + { + sys.sound.play(event.sound.key, event.sound.config); + } + } + target = (event.target) ? event.target : this; -/***/ }), -/* 1406 */ -/***/ (function(module, exports, __webpack_require__) { + if (event.event) + { + this.emit(event.event, target); + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (event.run) + { + event.run.call(target); + } -/** - * @namespace Phaser.Renderer.Canvas - */ + if (event.stop) + { + this.stop(); + } + } + } -module.exports = { + if (removeSweep) + { + for (i = 0; i < events.length; i++) + { + if (events[i].complete && events[i].once) + { + events.splice(i, 1); - CanvasRenderer: __webpack_require__(368), - GetBlendModes: __webpack_require__(370), - SetTransform: __webpack_require__(30) + i--; + } + } + } -}; + // It may be greater than the length if events have been removed + if (this.totalComplete >= events.length) + { + this.complete = true; + } + }, + /** + * Starts this Timeline running. + * + * If the Timeline is already running and the `fromStart` parameter is `true`, + * then calling this method will reset the Timeline events as incomplete. + * + * If you wish to resume a paused Timeline, then use the `Timeline.resume` method instead. + * + * @method Phaser.Time.Timeline#play + * @since 3.60.0 + * + * @param {boolean} [fromStart=true] - Reset this Timeline back to the start before playing. + * + * @return {this} This Timeline instance. + */ + play: function (fromStart) + { + if (fromStart === undefined) { fromStart = true; } -/***/ }), -/* 1407 */ -/***/ (function(module, exports, __webpack_require__) { + this.paused = false; + this.complete = false; + this.totalComplete = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (fromStart) + { + this.reset(); + } -/** - * @namespace Phaser.Renderer.Snapshot - */ + return this; + }, -module.exports = { + /** + * Pauses this Timeline. + * + * To resume it again, call the `Timeline.resume` method or set the `Timeline.paused` property to `false`. + * + * If the Timeline is paused while processing the current game step, then it + * will carry on with all events that are due to run during that step and pause + * from the next game step. + * + * @method Phaser.Time.Timeline#pause + * @since 3.60.0 + * + * @return {this} This Timeline instance. + */ + pause: function () + { + this.paused = true; - Canvas: __webpack_require__(369), - WebGL: __webpack_require__(383) + return this; + }, -}; + /** + * Resumes this Timeline from a paused state. + * + * The Timeline will carry on from where it left off. + * + * If you need to reset the Timeline to the start, then call the `Timeline.reset` method. + * + * @method Phaser.Time.Timeline#resume + * @since 3.60.0 + * + * @return {this} This Timeline instance. + */ + resume: function () + { + this.paused = false; + return this; + }, -/***/ }), -/* 1408 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Stops this Timeline. + * + * This will set the `paused` and `complete` properties to `true`. + * + * If you wish to reset the Timeline to the start, then call the `Timeline.reset` method. + * + * @method Phaser.Time.Timeline#stop + * @since 3.60.0 + * + * @return {this} This Timeline instance. + */ + stop: function () + { + this.paused = true; + this.complete = true; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -var WEBGL_CONST = __webpack_require__(107); -var Extend = __webpack_require__(17); + /** + * Resets this Timeline back to the start. + * + * This will set the elapsed time to zero and set all events to be incomplete. + * + * If the Timeline had any events that were set to `once` that have already + * been removed, they will **not** be present again after calling this method. + * + * If the Timeline isn't currently running (i.e. it's paused or complete) then + * calling this method resets those states, the same as calling `Timeline.play(true)`. + * + * @method Phaser.Time.Timeline#reset + * @since 3.60.0 + * + * @return {this} This Timeline instance. + */ + reset: function () + { + this.elapsed = 0; -/** - * @namespace Phaser.Renderer.WebGL - */ + for (var i = 0; i < this.events.length; i++) + { + this.events[i].complete = false; + } -var WebGL = { + return this.play(false); + }, - PipelineManager: __webpack_require__(372), - Pipelines: __webpack_require__(1409), - RenderTarget: __webpack_require__(141), - Utils: __webpack_require__(12), - WebGLPipeline: __webpack_require__(58), - WebGLRenderer: __webpack_require__(371), - WebGLShader: __webpack_require__(375) + /** + * Adds one or more events to this Timeline. + * + * You can pass in a single configuration object, or an array of them: + * + * ```js + * const timeline = this.add.timeline({ + * at: 1000, + * run: () => { + * this.add.sprite(400, 300, 'logo'); + * } + * }); + * ``` + * + * @method Phaser.Time.Timeline#add + * @since 3.60.0 + * + * @param {Phaser.Types.Time.TimelineEventConfig|Phaser.Types.Time.TimelineEventConfig[]} config - The configuration object for this Timeline Event, or an array of them. + * + * @return {this} This Timeline instance. + */ + add: function (config) + { + if (!Array.isArray(config)) + { + config = [ config ]; + } -}; + var events = this.events; + var prevTime = 0; -// Merge in the consts + if (events.length > 0) + { + prevTime = events[events.length - 1].time; + } -WebGL = Extend(false, WebGL, WEBGL_CONST); + for (var i = 0; i < config.length; i++) + { + var entry = config[i]; -// Export it + // Start at the exact time given, based on elapsed time (i.e. x ms from the start of the Timeline) + var startTime = GetFastValue(entry, 'at', 0); -module.exports = WebGL; + // Start in x ms from whatever the current elapsed time is (i.e. x ms from now) + var offsetTime = GetFastValue(entry, 'in', null); + if (offsetTime !== null) + { + startTime = this.elapsed + offsetTime; + } -/***/ }), -/* 1409 */ -/***/ (function(module, exports, __webpack_require__) { + // Start in x ms from whatever the previous event's start time was (i.e. x ms after the previous event) + var fromTime = GetFastValue(entry, 'from', null); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (fromTime !== null) + { + startTime = prevTime + fromTime; + } -var CONST = __webpack_require__(92); -var Extend = __webpack_require__(17); + events.push({ + complete: false, + time: startTime, + run: GetFastValue(entry, 'run', null), + event: GetFastValue(entry, 'event', null), + target: GetFastValue(entry, 'target', null), + set: GetFastValue(entry, 'set', null), + tween: GetFastValue(entry, 'tween', null), + sound: GetFastValue(entry, 'sound', null), + once: GetFastValue(entry, 'once', false), + stop: GetFastValue(entry, 'stop', false) + }); -/** - * @namespace Phaser.Renderer.WebGL.Pipelines - */ + prevTime = startTime; + } -var Pipelines = { + this.complete = false; - BitmapMaskPipeline: __webpack_require__(373), - Events: __webpack_require__(374), - GraphicsPipeline: __webpack_require__(376), - LightPipeline: __webpack_require__(377), - MultiPipeline: __webpack_require__(108), - PointLightPipeline: __webpack_require__(378), - PostFXPipeline: __webpack_require__(1410), - RopePipeline: __webpack_require__(379), - SinglePipeline: __webpack_require__(380), - UtilityPipeline: __webpack_require__(381) + return this; + }, -}; + /** + * Removes all events from this Timeline, resets the elapsed time to zero + * and pauses the Timeline. + * + * @method Phaser.Time.Timeline#clear + * @since 3.60.0 + * + * @return {this} This Timeline instance. + */ + clear: function () + { + this.events = []; + this.elapsed = 0; + this.paused = true; -// Merge in the consts + return this; + }, -Pipelines = Extend(false, Pipelines, CONST); + /** + * Returns `true` if this Timeline is currently playing. + * + * A Timeline is playing if it is not paused or not complete. + * + * @method Phaser.Time.Timeline#isPlaying + * @since 3.60.0 + * + * @return {boolean} `true` if this Timeline is playing, otherwise `false`. + */ + isPlaying: function () + { + return (!this.paused && !this.complete); + }, -// Export it + /** + * Returns a number between 0 and 1 representing the progress of this Timeline. + * + * A value of 0 means the Timeline has just started, 0.5 means it's half way through, + * and 1 means it's complete. + * + * If the Timeline has no events, or all events have been removed, this will return 1. + * + * If the Timeline is paused, this will return the progress value at the time it was paused. + * + * Note that the value returned is based on the number of events that have been completed, + * not the 'duration' of the events (as this is unknown to the Timeline). + * + * @method Phaser.Time.Timeline#getProgress + * @since 3.60.0 + * + * @return {number} A number between 0 and 1 representing the progress of this Timeline. + */ + getProgress: function () + { + var total = Math.min(this.totalComplete, this.events.length); -module.exports = Pipelines; + return total / this.events.length; + }, + /** + * Destroys this Timeline. + * + * This will remove all events from the Timeline and stop it from processing. + * + * This method is called automatically when the Scene shuts down, but you may + * also call it directly should you need to destroy the Timeline earlier. + * + * @method Phaser.Time.Timeline#destroy + * @since 3.60.0 + */ + destroy: function () + { + var eventEmitter = this.systems.events; -/***/ }), -/* 1410 */ -/***/ (function(module, exports, __webpack_require__) { + eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); + eventEmitter.off(SceneEvents.UPDATE, this.update, this); + eventEmitter.off(SceneEvents.SHUTDOWN, this.destroy, this); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.scene = null; + this.systems = null; + this.events = []; + } -var Class = __webpack_require__(0); -var ColorMatrix = __webpack_require__(198); -var GetFastValue = __webpack_require__(2); -var ShaderSourceFS = __webpack_require__(1411); -var ShaderSourceVS = __webpack_require__(382); -var WebGLPipeline = __webpack_require__(58); +}); /** - * @classdesc - * The Post FX Pipeline is a special kind of pipeline specifically for handling post - * processing effects. Where-as a standard Pipeline allows you to control the process - * of rendering Game Objects by configuring the shaders and attributes used to draw them, - * a Post FX Pipeline is designed to allow you to apply processing _after_ the Game Object/s - * have been rendered. Typical examples of post processing effects are bloom filters, - * blurs, light effects and color manipulation. + * A Timeline is a way to schedule events to happen at specific times in the future. * - * The pipeline works by creating a tiny vertex buffer with just one single hard-coded quad - * in it. Game Objects can have a Post Pipeline set on them. Those objects are then rendered - * using their standard pipeline, but are redirected to the Render Targets owned by the - * post pipeline, which can then apply their own shaders and effects, before passing them - * back to the main renderer. + * You can think of it as an event sequencer for your game, allowing you to schedule the + * running of callbacks, events and other actions at specific times in the future. * - * Please see the Phaser 3 examples for further details on this extensive subject. + * A Timeline is a Scene level system, meaning you can have as many Timelines as you like, each + * belonging to a different Scene. You can also have multiple Timelines running at the same time. * - * The default fragment shader it uses can be found in `shaders/src/PostFX.frag`. - * The default vertex shader it uses can be found in `shaders/src/Quad.vert`. + * If the Scene is paused, the Timeline will also pause. If the Scene is destroyed, the Timeline + * will be automatically destroyed. However, you can control the Timeline directly, pausing, + * resuming and stopping it at any time. * - * The default shader attributes for this pipeline are: + * Create an instance of a Timeline via the Game Object Factory: * - * `inPosition` (vec2, offset 0) - * `inTexCoord` (vec2, offset 8) + * ```js + * const timeline = this.add.timeline(); + * ``` * - * The vertices array layout is: + * The Timeline always starts paused. You must call `play` on it to start it running. * - * -1, 1 B----C 1, 1 - * 0, 1 | /| 1, 1 - * | / | - * | / | - * |/ | - * -1, -1 A----D 1, -1 - * 0, 0 1, 0 + * You can also pass in a configuration object on creation, or an array of them: * - * A = -1, -1 (pos) and 0, 0 (uv) - * B = -1, 1 (pos) and 0, 1 (uv) - * C = 1, 1 (pos) and 1, 1 (uv) - * D = 1, -1 (pos) and 1, 0 (uv) + * ```js + * const timeline = this.add.timeline({ + * at: 1000, + * run: () => { + * this.add.sprite(400, 300, 'logo'); + * } + * }); * - * First tri: A, B, C - * Second tri: A, C, D + * timeline.play(); + * ``` * - * Array index: + * In this example we sequence a few different events: * - * 0 = Tri 1 - Vert A - x pos - * 1 = Tri 1 - Vert A - y pos - * 2 = Tri 1 - Vert A - uv u - * 3 = Tri 1 - Vert A - uv v + * ```js + * const timeline = this.add.timeline([ + * { + * at: 1000, + * run: () => { this.logo = this.add.sprite(400, 300, 'logo'); }, + * sound: 'TitleMusic' + * }, + * { + * at: 2500, + * tween: { + * targets: this.logo, + * y: 600, + * yoyo: true + * }, + * sound: 'Explode' + * }, + * { + * at: 8000, + * event: 'HURRY_PLAYER', + * target: this.background, + * set: { + * tint: 0xff0000 + * } + * } + * ]); * - * 4 = Tri 1 - Vert B - x pos - * 5 = Tri 1 - Vert B - y pos - * 6 = Tri 1 - Vert B - uv u - * 7 = Tri 1 - Vert B - uv v + * timeline.play(); + * ``` * - * 8 = Tri 1 - Vert C - x pos - * 9 = Tri 1 - Vert C - y pos - * 10 = Tri 1 - Vert C - uv u - * 11 = Tri 1 - Vert C - uv v + * There are lots of options available to you via the configuration object. See the + * {@link Phaser.Types.Time.TimelineEventConfig} typedef for more details. * - * 12 = Tri 2 - Vert A - x pos - * 13 = Tri 2 - Vert A - y pos - * 14 = Tri 2 - Vert A - uv u - * 15 = Tri 2 - Vert A - uv v + * @method Phaser.GameObjects.GameObjectFactory#timeline + * @since 3.60.0 * - * 16 = Tri 2 - Vert C - x pos - * 17 = Tri 2 - Vert C - y pos - * 18 = Tri 2 - Vert C - uv u - * 19 = Tri 2 - Vert C - uv v + * @param {Phaser.Types.Time.TimelineEventConfig|Phaser.Types.Time.TimelineEventConfig[]} config - The configuration object for this Timeline Event, or an array of them. * - * 20 = Tri 2 - Vert D - x pos - * 21 = Tri 2 - Vert D - y pos - * 22 = Tri 2 - Vert D - uv u - * 23 = Tri 2 - Vert D - uv v + * @return {Phaser.Time.Timeline} The Timeline that was created. + */ +GameObjectFactory.register('timeline', function (config) +{ + return new Timeline(this.scene, config); +}); + +module.exports = Timeline; + + +/***/ }), + +/***/ 57911: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Class = __webpack_require__(56694); +var GetFastValue = __webpack_require__(72632); + +/** + * @classdesc + * A Timer Event represents a delayed function call. It's managed by a Scene's {@link Clock} and will call its function after a set amount of time has passed. The Timer Event can optionally repeat - i.e. call its function multiple times before finishing, or loop indefinitely. * - * @class PostFXPipeline - * @extends Phaser.Renderer.WebGL.WebGLPipeline - * @memberof Phaser.Renderer.WebGL.Pipelines + * Because it's managed by a Clock, a Timer Event is based on game time, will be affected by its Clock's time scale, and will pause if its Clock pauses. + * + * @class TimerEvent + * @memberof Phaser.Time * @constructor - * @since 3.50.0 + * @since 3.0.0 * - * @param {Phaser.Types.Renderer.WebGL.WebGLPipelineConfig} config - The configuration options for this pipeline. + * @param {Phaser.Types.Time.TimerEventConfig} config - The configuration for the Timer Event, including its delay and callback. */ -var PostFXPipeline = new Class({ - - Extends: WebGLPipeline, +var TimerEvent = new Class({ initialize: - function PostFXPipeline (config) + function TimerEvent (config) { - config.renderTarget = GetFastValue(config, 'renderTarget', 1); - config.fragShader = GetFastValue(config, 'fragShader', ShaderSourceFS); - config.vertShader = GetFastValue(config, 'vertShader', ShaderSourceVS); - config.attributes = GetFastValue(config, 'attributes', [ - { - name: 'inPosition', - size: 2 - }, - { - name: 'inTexCoord', - size: 2 - } - ]); - config.batchSize = 1; - config.vertices = [ - -1, -1, 0, 0, - -1, 1, 0, 1, - 1, 1, 1, 1, - -1, -1, 0, 0, - 1, 1, 1, 1, - 1, -1, 1, 0 - ]; - - WebGLPipeline.call(this, config); - - this.isPostFX = true; - /** - * If this post-pipeline belongs to a Game Object or Camera, this contains a reference to it. + * The delay in ms at which this TimerEvent fires. * - * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#gameObject - * @type {Phaser.GameObjects.GameObject} - * @since 3.50.0 + * @name Phaser.Time.TimerEvent#delay + * @type {number} + * @default 0 + * @readonly + * @since 3.0.0 */ - this.gameObject; + this.delay = 0; /** - * A Color Matrix instance belonging to this pipeline. - * - * Used during calls to the `drawFrame` method. + * The total number of times this TimerEvent will repeat before finishing. * - * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#colorMatrix - * @type {Phaser.Display.ColorMatrix} - * @since 3.50.0 + * @name Phaser.Time.TimerEvent#repeat + * @type {number} + * @default 0 + * @readonly + * @since 3.0.0 */ - this.colorMatrix = new ColorMatrix(); + this.repeat = 0; /** - * A reference to the Full Frame 1 Render Target that belongs to the - * Utility Pipeline. This property is set during the `boot` method. + * If repeating this contains the current repeat count. * - * This Render Target is the full size of the renderer. + * @name Phaser.Time.TimerEvent#repeatCount + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.repeatCount = 0; + + /** + * True if this TimerEvent loops, otherwise false. * - * You can use this directly in Post FX Pipelines for multi-target effects. - * However, be aware that these targets are shared between all post fx pipelines. + * @name Phaser.Time.TimerEvent#loop + * @type {boolean} + * @default false + * @readonly + * @since 3.0.0 + */ + this.loop = false; + + /** + * The callback that will be called when the TimerEvent occurs. * - * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#fullFrame1 - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @default null - * @since 3.50.0 + * @name Phaser.Time.TimerEvent#callback + * @type {function} + * @since 3.0.0 */ - this.fullFrame1; + this.callback; /** - * A reference to the Full Frame 2 Render Target that belongs to the - * Utility Pipeline. This property is set during the `boot` method. + * The scope in which the callback will be called. * - * This Render Target is the full size of the renderer. + * @name Phaser.Time.TimerEvent#callbackScope + * @type {object} + * @since 3.0.0 + */ + this.callbackScope; + + /** + * Additional arguments to be passed to the callback. * - * You can use this directly in Post FX Pipelines for multi-target effects. - * However, be aware that these targets are shared between all post fx pipelines. + * @name Phaser.Time.TimerEvent#args + * @type {array} + * @since 3.0.0 + */ + this.args; + + /** + * Scale the time causing this TimerEvent to update. * - * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#fullFrame2 - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @default null - * @since 3.50.0 + * @name Phaser.Time.TimerEvent#timeScale + * @type {number} + * @default 1 + * @since 3.0.0 */ - this.fullFrame2; + this.timeScale = 1; /** - * A reference to the Half Frame 1 Render Target that belongs to the - * Utility Pipeline. This property is set during the `boot` method. + * Start this many MS into the elapsed (useful if you want a long duration with repeat, but for the first loop to fire quickly) * - * This Render Target is half the size of the renderer. + * @name Phaser.Time.TimerEvent#startAt + * @type {number} + * @default 0 + * @since 3.0.0 + */ + this.startAt = 0; + + /** + * The time in milliseconds which has elapsed since the Timer Event's creation. * - * You can use this directly in Post FX Pipelines for multi-target effects. - * However, be aware that these targets are shared between all post fx pipelines. + * This value is local for the Timer Event and is relative to its Clock. As such, it's influenced by the Clock's time scale and paused state, the Timer Event's initial {@link #startAt} property, and the Timer Event's {@link #timeScale} and {@link #paused} state. * - * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#halfFrame1 - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @default null - * @since 3.50.0 + * @name Phaser.Time.TimerEvent#elapsed + * @type {number} + * @default 0 + * @since 3.0.0 */ - this.halfFrame1; + this.elapsed = 0; /** - * A reference to the Half Frame 2 Render Target that belongs to the - * Utility Pipeline. This property is set during the `boot` method. + * Whether or not this timer is paused. * - * This Render Target is half the size of the renderer. + * @name Phaser.Time.TimerEvent#paused + * @type {boolean} + * @default false + * @since 3.0.0 + */ + this.paused = false; + + /** + * Whether the Timer Event's function has been called. * - * You can use this directly in Post FX Pipelines for multi-target effects. - * However, be aware that these targets are shared between all post fx pipelines. + * When the Timer Event fires, this property will be set to `true` before the callback function is invoked and will be reset immediately afterward if the Timer Event should repeat. The value of this property does not directly influence whether the Timer Event will be removed from its Clock, but can prevent it from firing. * - * @name Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#halfFrame2 - * @type {Phaser.Renderer.WebGL.RenderTarget} - * @default null - * @since 3.50.0 + * @name Phaser.Time.TimerEvent#hasDispatched + * @type {boolean} + * @default false + * @since 3.0.0 */ - this.halfFrame2; - - if (this.renderer.isBooted) - { - this.manager = this.renderer.pipelines; + this.hasDispatched = false; - this.boot(); - } + this.reset(config); }, - boot: function () + /** + * Completely reinitializes the Timer Event, regardless of its current state, according to a configuration object. + * + * @method Phaser.Time.TimerEvent#reset + * @since 3.0.0 + * + * @param {Phaser.Types.Time.TimerEventConfig} config - The new state for the Timer Event. + * + * @return {Phaser.Time.TimerEvent} This TimerEvent object. + */ + reset: function (config) { - WebGLPipeline.prototype.boot.call(this); + this.delay = GetFastValue(config, 'delay', 0); - var utility = this.manager.UTILITY_PIPELINE; + // Can also be set to -1 for an infinite loop (same as setting loop: true) + this.repeat = GetFastValue(config, 'repeat', 0); - this.fullFrame1 = utility.fullFrame1; - this.fullFrame2 = utility.fullFrame2; - this.halfFrame1 = utility.halfFrame1; - this.halfFrame2 = utility.halfFrame2; + this.loop = GetFastValue(config, 'loop', false); - this.set1i('uMainSampler', 0); - }, + this.callback = GetFastValue(config, 'callback', undefined); - onDraw: function (renderTarget) - { - this.bindAndDraw(renderTarget); + this.callbackScope = GetFastValue(config, 'callbackScope', this); + + this.args = GetFastValue(config, 'args', []); + + this.timeScale = GetFastValue(config, 'timeScale', 1); + + this.startAt = GetFastValue(config, 'startAt', 0); + + this.paused = GetFastValue(config, 'paused', false); + + this.elapsed = this.startAt; + this.hasDispatched = false; + this.repeatCount = (this.repeat === -1 || this.loop) ? 999999999999 : this.repeat; + + if (this.delay === 0 && (this.repeat > 0 || this.loop)) + { + throw new Error('TimerEvent infinite loop created via zero delay'); + } + + return this; }, /** - * Copy the `source` Render Target to the `target` Render Target. + * Gets the progress of the current iteration, not factoring in repeats. * - * You can optionally set the brightness factor of the copy. + * @method Phaser.Time.TimerEvent#getProgress + * @since 3.0.0 * - * The difference between this method and `drawFrame` is that this method - * uses a faster copy shader, where only the brightness can be modified. - * If you need color level manipulation, see `drawFrame` instead. + * @return {number} A number between 0 and 1 representing the current progress. + */ + getProgress: function () + { + return (this.elapsed / this.delay); + }, + + /** + * Gets the progress of the timer overall, factoring in repeats. * - * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#copyFrame - * @since 3.50.0 + * @method Phaser.Time.TimerEvent#getOverallProgress + * @since 3.0.0 * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. - * @param {number} [brightness=1] - The brightness value applied to the frame copy. - * @param {boolean} [clear=true] - Clear the target before copying? - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @return {number} The overall progress of the Timer Event, between 0 and 1. */ - copyFrame: function (source, target, brightness, clear, clearAlpha) + getOverallProgress: function () { - this.manager.copyFrame(source, target, brightness, clear, clearAlpha); + if (this.repeat > 0) + { + var totalDuration = this.delay + (this.delay * this.repeat); + var totalElapsed = this.elapsed + (this.delay * (this.repeat - this.repeatCount)); + + return (totalElapsed / totalDuration); + } + else + { + return this.getProgress(); + } }, /** - * Pops the framebuffer from the renderers FBO stack and sets that as the active target, - * then draws the `source` Render Target to it. It then resets the renderer textures. + * Returns the number of times this Timer Event will repeat before finishing. * - * This should be done when you need to draw the _final_ results of a pipeline to the game - * canvas, or the next framebuffer in line on the FBO stack. You should only call this once - * in the `onDraw` handler and it should be the final thing called. Be careful not to call - * this if you need to actually use the pipeline shader, instead of the copy shader. In - * those cases, use the `bindAndDraw` method. + * This should not be confused with the number of times the Timer Event will fire before finishing. A return value of 0 doesn't indicate that the Timer Event has finished running - it indicates that it will not repeat after the next time it fires. * - * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#copyToGame - * @since 3.50.0 + * @method Phaser.Time.TimerEvent#getRepeatCount + * @since 3.0.0 * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. + * @return {number} How many times the Timer Event will repeat. */ - copyToGame: function (source) + getRepeatCount: function () { - this.manager.copyToGame(source); + return this.repeatCount; }, /** - * Copy the `source` Render Target to the `target` Render Target, using the - * given Color Matrix. - * - * The difference between this method and `copyFrame` is that this method - * uses a color matrix shader, where you have full control over the luminance - * values used during the copy. If you don't need this, you can use the faster - * `copyFrame` method instead. + * Returns the local elapsed time for the current iteration of the Timer Event. * - * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#drawFrame - * @since 3.50.0 + * @method Phaser.Time.TimerEvent#getElapsed + * @since 3.0.0 * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @return {number} The local elapsed time in milliseconds. */ - drawFrame: function (source, target, clearAlpha) + getElapsed: function () { - this.manager.drawFrame(source, target, clearAlpha, this.colorMatrix); + return this.elapsed; }, /** - * Draws the `source1` and `source2` Render Targets to the `target` Render Target - * using a linear blend effect, which is controlled by the `strength` parameter. + * Returns the local elapsed time for the current iteration of the Timer Event in seconds. * - * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#blendFrames - * @since 3.50.0 + * @method Phaser.Time.TimerEvent#getElapsedSeconds + * @since 3.0.0 * - * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. - * @param {number} [strength=1] - The strength of the blend. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @return {number} The local elapsed time in seconds. */ - blendFrames: function (source1, source2, target, strength, clearAlpha) + getElapsedSeconds: function () { - this.manager.blendFrames(source1, source2, target, strength, clearAlpha); + return this.elapsed * 0.001; }, /** - * Draws the `source1` and `source2` Render Targets to the `target` Render Target - * using an additive blend effect, which is controlled by the `strength` parameter. + * Returns the time interval until the next iteration of the Timer Event. * - * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#blendFramesAdditive + * @method Phaser.Time.TimerEvent#getRemaining * @since 3.50.0 * - * @param {Phaser.Renderer.WebGL.RenderTarget} source1 - The first source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} source2 - The second source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The target Render Target. - * @param {number} [strength=1] - The strength of the blend. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @return {number} The time interval in milliseconds. */ - blendFramesAdditive: function (source1, source2, target, strength, clearAlpha) + getRemaining: function () { - this.manager.blendFramesAdditive(source1, source2, target, strength, clearAlpha); + return this.delay - this.elapsed; }, /** - * Clears the given Render Target. + * Returns the time interval until the next iteration of the Timer Event in seconds. * - * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#clearFrame + * @method Phaser.Time.TimerEvent#getRemainingSeconds * @since 3.50.0 * - * @param {Phaser.Renderer.WebGL.RenderTarget} target - The Render Target to clear. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @return {number} The time interval in seconds. */ - clearFrame: function (target, clearAlpha) + getRemainingSeconds: function () { - this.manager.clearFrame(target, clearAlpha); + return this.getRemaining() * 0.001; }, /** - * Copy the `source` Render Target to the `target` Render Target. - * - * The difference with this copy is that no resizing takes place. If the `source` - * Render Target is larger than the `target` then only a portion the same size as - * the `target` dimensions is copied across. - * - * You can optionally set the brightness factor of the copy. + * Returns the time interval until the last iteration of the Timer Event. * - * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#blitFrame + * @method Phaser.Time.TimerEvent#getOverallRemaining * @since 3.50.0 * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. - * @param {number} [brightness=1] - The brightness value applied to the frame copy. - * @param {boolean} [clear=true] - Clear the target before copying? - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? - * @param {boolean} [eraseMode=false] - Erase source from target using ERASE Blend Mode? + * @return {number} The time interval in milliseconds. */ - blitFrame: function (source, target, brightness, clear, clearAlpha, eraseMode) + getOverallRemaining: function () { - this.manager.blitFrame(source, target, brightness, clear, clearAlpha, eraseMode); + return this.delay * (1 + this.repeatCount) - this.elapsed; }, /** - * Binds the `source` Render Target and then copies a section of it to the `target` Render Target. - * - * This method is extremely fast because it uses `gl.copyTexSubImage2D` and doesn't - * require the use of any shaders. Remember the coordinates are given in standard WebGL format, - * where x and y specify the lower-left corner of the section, not the top-left. Also, the - * copy entirely replaces the contents of the target texture, no 'merging' or 'blending' takes - * place. + * Returns the time interval until the last iteration of the Timer Event in seconds. * - * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#copyFrameRect + * @method Phaser.Time.TimerEvent#getOverallRemainingSeconds * @since 3.50.0 * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The source Render Target. - * @param {Phaser.Renderer.WebGL.RenderTarget} target - The target Render Target. - * @param {number} x - The x coordinate of the lower left corner where to start copying. - * @param {number} y - The y coordinate of the lower left corner where to start copying. - * @param {number} width - The width of the texture. - * @param {number} height - The height of the texture. - * @param {boolean} [clear=true] - Clear the target before copying? - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? + * @return {number} The time interval in seconds. */ - copyFrameRect: function (source, target, x, y, width, height, clear, clearAlpha) + getOverallRemainingSeconds: function () { - this.manager.copyFrameRect(source, target, x, y, width, height, clear, clearAlpha); + return this.getOverallRemaining() * 0.001; }, /** - * Binds this pipeline and draws the `source` Render Target to the `target` Render Target. - * - * If no `target` is specified, it will pop the framebuffer from the Renderers FBO stack - * and use that instead, which should be done when you need to draw the final results of - * this pipeline to the game canvas. - * - * You can optionally set the shader to be used for the draw here, if this is a multi-shader - * pipeline. By default `currentShader` will be used. If you need to set a shader but not - * a target, just pass `null` as the `target` parameter. + * Forces the Timer Event to immediately expire, thus scheduling its removal in the next frame. * - * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#bindAndDraw - * @since 3.50.0 + * @method Phaser.Time.TimerEvent#remove + * @since 3.0.0 * - * @param {Phaser.Renderer.WebGL.RenderTarget} source - The Render Target to draw from. - * @param {Phaser.Renderer.WebGL.RenderTarget} [target] - The Render Target to draw to. If not set, it will pop the fbo from the stack. - * @param {boolean} [clear=true] - Clear the target before copying? Only used if `target` parameter is set. - * @param {boolean} [clearAlpha=true] - Clear the alpha channel when running `gl.clear` on the target? - * @param {Phaser.Renderer.WebGL.WebGLShader} [currentShader] - The shader to use during the draw. + * @param {boolean} [dispatchCallback=false] - If `true`, the function of the Timer Event will be called before its removal. */ - bindAndDraw: function (source, target, clear, clearAlpha, currentShader) + remove: function (dispatchCallback) { - if (clear === undefined) { clear = true; } - if (clearAlpha === undefined) { clearAlpha = true; } - - var gl = this.gl; - var renderer = this.renderer; - - this.bind(currentShader); - - this.set1i('uMainSampler', 0); - - if (target) - { - gl.viewport(0, 0, target.width, target.height); - gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0); - - if (clear) - { - if (clearAlpha) - { - gl.clearColor(0, 0, 0, 0); - } - else - { - gl.clearColor(0, 0, 0, 1); - } - - gl.clear(gl.COLOR_BUFFER_BIT); - } - } - else - { - renderer.popFramebuffer(false, false, false); + if (dispatchCallback === undefined) { dispatchCallback = false; } - if (!renderer.currentFramebuffer) - { - gl.viewport(0, 0, renderer.width, renderer.height); - } - } + this.elapsed = this.delay; - gl.activeTexture(gl.TEXTURE0); - gl.bindTexture(gl.TEXTURE_2D, source.texture); + this.hasDispatched = !dispatchCallback; - gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); - gl.drawArrays(gl.TRIANGLES, 0, 6); + this.repeatCount = 0; + }, - if (!target) - { - renderer.resetTextures(); - } - else - { - gl.bindTexture(gl.TEXTURE_2D, null); - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - } + /** + * Destroys all object references in the Timer Event, i.e. its callback, scope, and arguments. + * + * Normally, this method is only called by the Clock when it shuts down. As such, it doesn't stop the Timer Event. If called manually, the Timer Event will still be updated by the Clock, but it won't do anything when it fires. + * + * @method Phaser.Time.TimerEvent#destroy + * @since 3.0.0 + */ + destroy: function () + { + this.callback = undefined; + this.callbackScope = undefined; + this.args = []; } }); -module.exports = PostFXPipeline; +module.exports = TimerEvent; /***/ }), -/* 1411 */ -/***/ (function(module, exports) { - -module.exports = [ - '#define SHADER_NAME PHASER_POSTFX_FS', - '', - 'precision mediump float;', - '', - 'uniform sampler2D uMainSampler;', - '', - 'varying vec2 outTexCoord;', - '', - 'void main ()', - '{', - ' gl_FragColor = texture2D(uMainSampler, outTexCoord);', - '}', - '' -].join('\n'); - -/***/ }), -/* 1412 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ 97121: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extend = __webpack_require__(17); -var CONST = __webpack_require__(201); - /** - * @namespace Phaser.Scale - * - * @borrows Phaser.Scale.Center.NO_CENTER as NO_CENTER - * @borrows Phaser.Scale.Center.CENTER_BOTH as CENTER_BOTH - * @borrows Phaser.Scale.Center.CENTER_HORIZONTALLY as CENTER_HORIZONTALLY - * @borrows Phaser.Scale.Center.CENTER_VERTICALLY as CENTER_VERTICALLY - * - * @borrows Phaser.Scale.Orientation.LANDSCAPE as LANDSCAPE - * @borrows Phaser.Scale.Orientation.PORTRAIT as PORTRAIT - * - * @borrows Phaser.Scale.ScaleModes.NONE as NONE - * @borrows Phaser.Scale.ScaleModes.WIDTH_CONTROLS_HEIGHT as WIDTH_CONTROLS_HEIGHT - * @borrows Phaser.Scale.ScaleModes.HEIGHT_CONTROLS_WIDTH as HEIGHT_CONTROLS_WIDTH - * @borrows Phaser.Scale.ScaleModes.FIT as FIT - * @borrows Phaser.Scale.ScaleModes.ENVELOP as ENVELOP - * @borrows Phaser.Scale.ScaleModes.RESIZE as RESIZE - * - * @borrows Phaser.Scale.Zoom.NO_ZOOM as NO_ZOOM - * @borrows Phaser.Scale.Zoom.ZOOM_2X as ZOOM_2X - * @borrows Phaser.Scale.Zoom.ZOOM_4X as ZOOM_4X - * @borrows Phaser.Scale.Zoom.MAX_ZOOM as MAX_ZOOM + * @namespace Phaser.Time */ -var Scale = { +module.exports = { - Center: __webpack_require__(403), - Events: __webpack_require__(104), - Orientation: __webpack_require__(404), - ScaleManager: __webpack_require__(415), - ScaleModes: __webpack_require__(405), - Zoom: __webpack_require__(406) + Clock: __webpack_require__(73779), + Timeline: __webpack_require__(20517), + TimerEvent: __webpack_require__(57911) }; -Scale = Extend(false, Scale, CONST.CENTER); -Scale = Extend(false, Scale, CONST.ORIENTATION); -Scale = Extend(false, Scale, CONST.SCALE_MODE); -Scale = Extend(false, Scale, CONST.ZOOM); - -module.exports = Scale; - /***/ }), -/* 1413 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CONST = __webpack_require__(144); -var Extend = __webpack_require__(17); -/** - * @namespace Phaser.Scenes - */ - -var Scene = { - - Events: __webpack_require__(20), - GetPhysicsPlugins: __webpack_require__(419), - GetScenePlugins: __webpack_require__(420), - SceneManager: __webpack_require__(417), - ScenePlugin: __webpack_require__(1414), - Settings: __webpack_require__(421), - Systems: __webpack_require__(204) - -}; - -// Merge in the consts -Scene = Extend(false, Scene, CONST); - -module.exports = Scene; - - -/***/ }), -/* 1414 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ 64532: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clamp = __webpack_require__(18); -var Class = __webpack_require__(0); -var Events = __webpack_require__(20); -var GetFastValue = __webpack_require__(2); -var PluginCache = __webpack_require__(24); +var ArrayRemove = __webpack_require__(66458); +var Class = __webpack_require__(56694); +var Flatten = __webpack_require__(5454); +var NumberTweenBuilder = __webpack_require__(68710); +var PluginCache = __webpack_require__(91963); +var SceneEvents = __webpack_require__(7599); +var StaggerBuilder = __webpack_require__(91944); +var Tween = __webpack_require__(39366); +var TweenBuilder = __webpack_require__(68061); +var TweenChain = __webpack_require__(45641); +var TweenChainBuilder = __webpack_require__(56034); /** * @classdesc - * The Scene Plugin is the main interface to the Scene Manager and allows you to control - * any Scene running in your game. You should always use this plugin. By default, it is - * mapped to the Scene property `this.scene`. Meaning, from within a Scene, you can call - * methods such as `this.scene.start()`. + * The Tween Manager is a default Scene Plugin which controls and updates Tweens. * - * Note that nearly all methods in this class are run on a queue-basis and not - * immediately. For example, calling `this.scene.launch('SceneB')` will try to - * launch SceneB when the Scene Manager next updates, which is at the start of the game - * step. All operations are queued and run in the order in which they are invoked here. + * A tween is a way to alter one or more properties of a target object over a defined period of time. * - * @class ScenePlugin - * @memberof Phaser.Scenes + * Tweens are created by calling the `add` method and passing in the configuration object. + * + * ```js + * const logo = this.add.image(100, 100, 'logo'); + * + * this.tweens.add({ + * targets: logo, + * x: 600, + * ease: 'Power1', + * duration: 2000 + * }); + * ``` + * + * See the `TweenBuilderConfig` for all of the options you have available. + * + * Playback will start immediately unless the tween has been configured to be paused. + * + * Please note that a Tween will not manipulate any target property that begins with an underscore. + * + * Tweens are designed to be 'fire-and-forget'. They automatically destroy themselves once playback + * is complete, to free-up memory and resources. If you wish to keep a tween after playback, i.e. to + * play it again at a later time, then you should set the `persist` property to `true` in the config. + * However, doing so means it's entirely up to _you_ to destroy the tween when you're finished with it, + * otherwise it will linger in memory forever. + * + * If you wish to chain Tweens together for sequential playback, see the `TweenManager.chain` method. + * + * @class TweenManager + * @memberof Phaser.Tweens * @constructor * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Scene that this ScenePlugin belongs to. + * @param {Phaser.Scene} scene - The Scene which owns this Tween Manager. */ -var ScenePlugin = new Class({ +var TweenManager = new Class({ initialize: - function ScenePlugin (scene) + function TweenManager (scene) { /** - * The Scene that this ScenePlugin belongs to. + * The Scene which owns this Tween Manager. * - * @name Phaser.Scenes.ScenePlugin#scene + * @name Phaser.Tweens.TweenManager#scene * @type {Phaser.Scene} * @since 3.0.0 */ this.scene = scene; /** - * The Scene Systems instance of the Scene that this ScenePlugin belongs to. + * The Scene Systems Event Emitter. * - * @name Phaser.Scenes.ScenePlugin#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 + * @name Phaser.Tweens.TweenManager#events + * @type {Phaser.Events.EventEmitter} + * @since 3.60.0 */ - this.systems = scene.sys; + this.events = scene.sys.events; /** - * The settings of the Scene this ScenePlugin belongs to. + * The time scale of the Tween Manager. * - * @name Phaser.Scenes.ScenePlugin#settings - * @type {Phaser.Types.Scenes.SettingsObject} + * This value scales the time delta between two frames, thus influencing the speed of time for all Tweens owned by this Tween Manager. + * + * @name Phaser.Tweens.TweenManager#timeScale + * @type {number} + * @default 1 * @since 3.0.0 */ - this.settings = scene.sys.settings; + this.timeScale = 1; /** - * The key of the Scene this ScenePlugin belongs to. + * This toggles the updating state of this Tween Manager. * - * @name Phaser.Scenes.ScenePlugin#key - * @type {string} - * @since 3.0.0 + * Setting `paused` to `true` (or calling the `pauseAll` method) will + * stop this Tween Manager from updating any of its tweens, including + * newly created ones. Set back to `false` to resume playback. + * + * @name Phaser.Tweens.TweenManager#paused + * @type {boolean} + * @default false + * @since 3.60.0 */ - this.key = scene.sys.settings.key; + this.paused = false; /** - * The Game's SceneManager. + * Is this Tween Manager currently processing the tweens as part of + * its 'update' loop? This is set to 'true' at the start of 'update' + * and reset to 'false' at the end of the function. Allows you to trap + * Tween Manager status during tween callbacks. * - * @name Phaser.Scenes.ScenePlugin#manager - * @type {Phaser.Scenes.SceneManager} - * @since 3.0.0 + * @name Phaser.Tweens.TweenManager#processing + * @type {boolean} + * @default false + * @since 3.60.0 */ - this.manager = scene.sys.game.scene; + this.processing = false; /** - * If this Scene is currently transitioning to another, this holds - * the current percentage of the transition progress, between 0 and 1. + * An array of Tweens which are actively being processed by the Tween Manager. * - * @name Phaser.Scenes.ScenePlugin#transitionProgress - * @type {number} - * @since 3.5.0 + * @name Phaser.Tweens.TweenManager#tweens + * @type {Phaser.Tweens.Tween[]} + * @since 3.60.0 */ - this.transitionProgress = 0; + this.tweens = []; /** - * Transition elapsed timer. + * The time the Tween Manager was updated. * - * @name Phaser.Scenes.ScenePlugin#_elapsed + * @name Phaser.Tweens.TweenManager#time * @type {number} - * @private - * @since 3.5.0 + * @since 3.60.0 */ - this._elapsed = 0; + this.time = 0; /** - * Transition elapsed timer. + * The time the Tween Manager was started. * - * @name Phaser.Scenes.ScenePlugin#_target - * @type {?Phaser.Scenes.Scene} - * @private - * @since 3.5.0 + * @name Phaser.Tweens.TweenManager#startTime + * @type {number} + * @since 3.60.0 */ - this._target = null; + this.startTime = 0; /** - * Transition duration. + * The time the Tween Manager should next update. * - * @name Phaser.Scenes.ScenePlugin#_duration + * @name Phaser.Tweens.TweenManager#nextTime * @type {number} - * @private - * @since 3.5.0 + * @since 3.60.0 */ - this._duration = 0; + this.nextTime = 0; /** - * Transition callback. + * The time the Tween Manager previously updated. * - * @name Phaser.Scenes.ScenePlugin#_onUpdate - * @type {function} - * @private - * @since 3.5.0 + * @name Phaser.Tweens.TweenManager#prevTime + * @type {number} + * @since 3.60.0 */ - this._onUpdate; + this.prevTime = 0; /** - * Transition callback scope. + * The maximum amount of time, in milliseconds, the browser can + * lag for, before lag smoothing is applied. * - * @name Phaser.Scenes.ScenePlugin#_onUpdateScope - * @type {object} - * @private - * @since 3.5.0 + * See the `TweenManager.setLagSmooth` method for further details. + * + * @name Phaser.Tweens.TweenManager#maxLag + * @type {number} + * @default 500 + * @since 3.60.0 */ - this._onUpdateScope; + this.maxLag = 500; /** - * Will this Scene sleep (true) after the transition, or stop (false) + * The amount of time, in milliseconds, that is used to set the + * delta when lag smoothing is applied. * - * @name Phaser.Scenes.ScenePlugin#_willSleep - * @type {boolean} - * @private - * @since 3.5.0 + * See the `TweenManager.setLagSmooth` method for further details. + * + * @name Phaser.Tweens.TweenManager#lagSkip + * @type {number} + * @default 33 + * @since 3.60.0 */ - this._willSleep = false; + this.lagSkip = 33; /** - * Will this Scene be removed from the Scene Manager after the transition completes? + * An internal value that holds the fps rate. * - * @name Phaser.Scenes.ScenePlugin#_willRemove - * @type {boolean} - * @private - * @since 3.5.0 + * @name Phaser.Tweens.TweenManager#gap + * @type {number} + * @since 3.60.0 */ - this._willRemove = false; + this.gap = 1000 / 240; - scene.sys.events.once(Events.BOOT, this.boot, this); - scene.sys.events.on(Events.START, this.pluginStart, this); + this.events.once(SceneEvents.BOOT, this.boot, this); + this.events.on(SceneEvents.START, this.start, this); }, /** * This method is called automatically, only once, when the Scene is first created. * Do not invoke it directly. * - * @method Phaser.Scenes.ScenePlugin#boot + * @method Phaser.Tweens.TweenManager#boot * @private - * @since 3.0.0 + * @since 3.5.1 */ boot: function () { - this.systems.events.once(Events.DESTROY, this.destroy, this); + this.events.once(SceneEvents.DESTROY, this.destroy, this); }, /** @@ -232093,790 +254146,896 @@ var ScenePlugin = new Class({ * It is responsible for creating local systems, properties and listening for Scene events. * Do not invoke it directly. * - * @method Phaser.Scenes.ScenePlugin#pluginStart + * @method Phaser.Tweens.TweenManager#start * @private * @since 3.5.0 */ - pluginStart: function () + start: function () { - this._target = null; + this.timeScale = 1; + this.paused = false; - this.systems.events.once(Events.SHUTDOWN, this.shutdown, this); + this.startTime = Date.now(); + this.prevTime = this.startTime; + this.nextTime = this.gap; + + this.events.on(SceneEvents.UPDATE, this.update, this); + this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** - * Shutdown this Scene and run the given one. + * Create a Tween and return it, but does not add it to this Tween Manager. * - * This will happen at the next Scene Manager update, not immediately. + * Please note that a Tween will not manipulate any target property that begins with an underscore. * - * @method Phaser.Scenes.ScenePlugin#start + * In order to play this tween, you'll need to add it to a Tween Manager via + * the `TweenManager.existing` method. + * + * You can optionally pass an **array** of Tween Configuration objects to this method and it will create + * one Tween per entry in the array. If an array is given, an array of tweens is returned. + * + * @method Phaser.Tweens.TweenManager#create * @since 3.0.0 * - * @param {(string|Phaser.Scene)} [key] - The Scene to start. - * @param {object} [data] - The Scene data. + * @param {Phaser.Types.Tweens.TweenBuilderConfig|Phaser.Types.Tweens.TweenBuilderConfig[]|object|object[]} config - A Tween Configuration object. Or an array of Tween Configuration objects. * - * @return {this} This Scene Plugin instance. + * @return {Phaser.Tweens.Tween|Phaser.Tweens.Tween[]} The created Tween, or an array of Tweens if an array of tween configs was provided. */ - start: function (key, data) + create: function (config) { - if (key === undefined) { key = this.key; } - - this.manager.queueOp('stop', this.key); - this.manager.queueOp('start', key, data); + if (!Array.isArray(config)) + { + config = [ config ]; + } - return this; - }, + var result = []; - /** - * Restarts this Scene. - * - * This will happen at the next Scene Manager update, not immediately. - * - * @method Phaser.Scenes.ScenePlugin#restart - * @since 3.4.0 - * - * @param {object} [data] - The Scene data. - * - * @return {this} This Scene Plugin instance. - */ - restart: function (data) - { - var key = this.key; + for (var i = 0; i < config.length; i++) + { + var tween = config[i]; - this.manager.queueOp('stop', key); - this.manager.queueOp('start', key, data); + if (tween instanceof Tween || tween instanceof TweenChain) + { + // Allow them to send an array of mixed instances and configs + result.push(tween); + } + else if (Array.isArray(tween.tweens)) + { + result.push(TweenChainBuilder(this, tween)); + } + else + { + result.push(TweenBuilder(this, tween)); + } + } - return this; + return (result.length === 1) ? result[0] : result; }, /** - * This will start a transition from the current Scene to the target Scene given. + * Create a Tween and add it to this Tween Manager by passing a Tween Configuration object. * - * The transition will last for the duration specified in milliseconds. + * Example, run from within a Scene: * - * You can have the target Scene moved above or below this one in the display list. + * ```js + * const logo = this.add.image(100, 100, 'logo'); * - * You can specify an update callback. This callback will be invoked _every frame_ for the duration - * of the transition. + * this.tweens.add({ + * targets: logo, + * x: 600, + * ease: 'Power1', + * duration: 2000 + * }); + * ``` * - * This Scene can either be sent to sleep at the end of the transition, or stopped. The default is to stop. + * See the `TweenBuilderConfig` for all of the options you have available. * - * There are also 5 transition related events: This scene will emit the event `transitionout` when - * the transition begins, which is typically the frame after calling this method. + * Playback will start immediately unless the tween has been configured to be paused. * - * The target Scene will emit the event `transitioninit` when that Scene's `init` method is called. - * It will then emit the event `transitionstart` when its `create` method is called. - * If the Scene was sleeping and has been woken up, it will emit the event `transitionwake` instead of these two, - * as the Scenes `init` and `create` methods are not invoked when a Scene wakes up. + * Please note that a Tween will not manipulate any target property that begins with an underscore. * - * When the duration of the transition has elapsed it will emit the event `transitioncomplete`. - * These events are cleared of all listeners when the Scene shuts down, but not if it is sent to sleep. + * Tweens are designed to be 'fire-and-forget'. They automatically destroy themselves once playback + * is complete, to free-up memory and resources. If you wish to keep a tween after playback, i.e. to + * play it again at a later time, then you should set the `persist` property to `true` in the config. + * However, doing so means it's entirely up to _you_ to destroy the tween when you're finished with it, + * otherwise it will linger in memory forever. * - * It's important to understand that the duration of the transition begins the moment you call this method. - * If the Scene you are transitioning to includes delayed processes, such as waiting for files to load, the - * time still counts down even while that is happening. If the game itself pauses, or something else causes - * this Scenes update loop to stop, then the transition will also pause for that duration. There are - * checks in place to prevent you accidentally stopping a transitioning Scene but if you've got code to - * override this understand that until the target Scene completes it might never be unlocked for input events. + * If you wish to chain Tweens together for sequential playback, see the `TweenManager.chain` method. * - * @method Phaser.Scenes.ScenePlugin#transition - * @fires Phaser.Scenes.Events#TRANSITION_OUT - * @since 3.5.0 + * @method Phaser.Tweens.TweenManager#add + * @since 3.0.0 * - * @param {Phaser.Types.Scenes.SceneTransitionConfig} config - The transition configuration object. + * @param {Phaser.Types.Tweens.TweenBuilderConfig|Phaser.Types.Tweens.TweenChainBuilderConfig|Phaser.Tweens.Tween|Phaser.Tweens.TweenChain} config - A Tween Configuration object, or a Tween or TweenChain instance. * - * @return {boolean} `true` is the transition was started, otherwise `false`. + * @return {Phaser.Tweens.Tween} The created Tween. */ - transition: function (config) + add: function (config) { - if (config === undefined) { config = {}; } - - var key = GetFastValue(config, 'target', false); - - var target = this.manager.getScene(key); - - if (!key || !this.checkValidTransition(target)) - { - return false; - } - - var duration = GetFastValue(config, 'duration', 1000); - - this._elapsed = 0; - this._target = target; - this._duration = duration; - this._willSleep = GetFastValue(config, 'sleep', false); - this._willRemove = GetFastValue(config, 'remove', false); - - var callback = GetFastValue(config, 'onUpdate', null); - - if (callback) - { - this._onUpdate = callback; - this._onUpdateScope = GetFastValue(config, 'onUpdateScope', this.scene); - } - - var allowInput = GetFastValue(config, 'allowInput', false); - - this.settings.transitionAllowInput = allowInput; - - var targetSettings = target.sys.settings; - - targetSettings.isTransition = true; - targetSettings.transitionFrom = this.scene; - targetSettings.transitionDuration = duration; - targetSettings.transitionAllowInput = allowInput; - - if (GetFastValue(config, 'moveAbove', false)) - { - this.manager.moveAbove(this.key, key); - } - else if (GetFastValue(config, 'moveBelow', false)) - { - this.manager.moveBelow(this.key, key); - } + var tween = config; + var tweens = this.tweens; - if (target.sys.isSleeping()) + if (tween instanceof Tween || tween instanceof TweenChain) { - target.sys.wake(GetFastValue(config, 'data')); + tweens.push(tween.reset()); } else { - this.manager.start(key, GetFastValue(config, 'data')); - } - - this.systems.events.emit(Events.TRANSITION_OUT, target, duration); + if (Array.isArray(tween.tweens)) + { + tween = TweenChainBuilder(this, tween); + } + else + { + tween = TweenBuilder(this, tween); + } - this.systems.events.on(Events.UPDATE, this.step, this); + tweens.push(tween.reset()); + } - return true; + return tween; }, /** - * Checks to see if this Scene can transition to the target Scene or not. + * Create multiple Tweens and add them all to this Tween Manager, by passing an array of Tween Configuration objects. * - * @method Phaser.Scenes.ScenePlugin#checkValidTransition - * @private - * @since 3.5.0 + * See the `TweenBuilderConfig` for all of the options you have available. * - * @param {Phaser.Scene} target - The Scene to test against. + * Playback will start immediately unless the tweens have been configured to be paused. * - * @return {boolean} `true` if this Scene can transition, otherwise `false`. - */ - checkValidTransition: function (target) - { - // Not a valid target if it doesn't exist, isn't active or is already transitioning in or out - if (!target || target.sys.isActive() || target.sys.isTransitioning() || target === this.scene || this.systems.isTransitioning()) - { - return false; - } - - return true; - }, - - /** - * A single game step. This is only called if the parent Scene is transitioning - * out to another Scene. + * Please note that a Tween will not manipulate any target property that begins with an underscore. * - * @method Phaser.Scenes.ScenePlugin#step - * @private - * @since 3.5.0 + * Tweens are designed to be 'fire-and-forget'. They automatically destroy themselves once playback + * is complete, to free-up memory and resources. If you wish to keep a tween after playback, i.e. to + * play it again at a later time, then you should set the `persist` property to `true` in the config. + * However, doing so means it's entirely up to _you_ to destroy the tween when you're finished with it, + * otherwise it will linger in memory forever. * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * If you wish to chain Tweens together for sequential playback, see the `TweenManager.chain` method. + * + * @method Phaser.Tweens.TweenManager#addMultiple + * @since 3.60.0 + * + * @param {Phaser.Types.Tweens.TweenBuilderConfig[]|object[]} configs - An array of Tween Configuration objects. + * + * @return {Phaser.Tweens.Tween[]} An array of created Tweens. */ - step: function (time, delta) + addMultiple: function (configs) { - this._elapsed += delta; - - this.transitionProgress = Clamp(this._elapsed / this._duration, 0, 1); + var tween; + var result = []; + var tweens = this.tweens; - if (this._onUpdate) + for (var i = 0; i < configs.length; i++) { - this._onUpdate.call(this._onUpdateScope, this.transitionProgress); - } + tween = configs[i]; - if (this._elapsed >= this._duration) - { - this.transitionComplete(); + if (tween instanceof Tween || tween instanceof TweenChain) + { + tweens.push(tween.reset()); + } + else + { + if (Array.isArray(tween.tweens)) + { + tween = TweenChainBuilder(this, tween); + } + else + { + tween = TweenBuilder(this, tween); + } + + tweens.push(tween.reset()); + } + + result.push(tween); } + + return result; }, /** - * Called by `step` when the transition out of this scene to another is over. + * Create a sequence of Tweens, chained to one-another, and add them to this Tween Manager. * - * @method Phaser.Scenes.ScenePlugin#transitionComplete - * @private - * @fires Phaser.Scenes.Events#TRANSITION_COMPLETE - * @since 3.5.0 + * The tweens are played in order, from start to finish. You can optionally set the chain + * to repeat as many times as you like. Once the chain has finished playing, or repeating if set, + * all tweens in the chain will be destroyed automatically. To override this, set the 'persists' + * argument to 'true'. + * + * Playback will start immediately unless the _first_ Tween has been configured to be paused. + * + * Please note that Tweens will not manipulate any target property that begins with an underscore. + * + * @method Phaser.Tweens.TweenManager#chain + * @since 3.60.0 + * + * @param {Phaser.Types.Tweens.TweenChainBuilderConfig|object} tweens - A Tween Chain configuration object. + * + * @return {Phaser.Tweens.TweenChain} The Tween Chain instance. */ - transitionComplete: function () + chain: function (config) { - var targetSys = this._target.sys; - var targetSettings = this._target.sys.settings; - - // Stop the step - this.systems.events.off(Events.UPDATE, this.step, this); - - // Notify target scene - targetSys.events.emit(Events.TRANSITION_COMPLETE, this.scene); - - // Clear target scene settings - targetSettings.isTransition = false; - targetSettings.transitionFrom = null; + var chain = TweenChainBuilder(this, config); - // Clear local settings - this._duration = 0; - this._target = null; - this._onUpdate = null; - this._onUpdateScope = null; + this.tweens.push(chain.init()); - // Now everything is clear we can handle what happens to this Scene - if (this._willRemove) - { - this.manager.remove(this.key); - } - else if (this._willSleep) - { - this.systems.sleep(); - } - else - { - this.manager.stop(this.key); - } + return chain; }, /** - * Add the Scene into the Scene Manager and start it if 'autoStart' is true or the Scene config 'active' property is set. + * Returns an array containing this Tween and all Tweens chained to it, + * in the order in which they will be played. * - * @method Phaser.Scenes.ScenePlugin#add - * @since 3.0.0 + * If there are no chained Tweens an empty array is returned. * - * @param {string} key - A unique key used to reference the Scene, i.e. `MainMenu` or `Level1`. - * @param {(Phaser.Scene|Phaser.Types.Scenes.SettingsConfig|Phaser.Types.Scenes.CreateSceneFromObjectConfig|function)} sceneConfig - The config for the Scene - * @param {boolean} [autoStart=false] - If `true` the Scene will be started immediately after being added. - * @param {object} [data] - Optional data object. This will be set as `Scene.settings.data` and passed to `Scene.init`, and `Scene.create`. + * @method Phaser.Tweens.TweenManager#getChainedTweens + * @since 3.60.0 * - * @return {?Phaser.Scene} The added Scene, if it was added immediately, otherwise `null`. + * @param {Phaser.Tweens.Tween} tween - The Tween to return the chain from. + * + * @return {Phaser.Tweens.Tween[]} An array of the chained tweens, or an empty array if there aren't any. */ - add: function (key, sceneConfig, autoStart, data) + getChainedTweens: function (tween) { - return this.manager.add(key, sceneConfig, autoStart, data); + return tween.getChainedTweens(); }, /** - * Launch the given Scene and run it in parallel with this one. + * Check to see if the given Tween instance exists within this Tween Manager. * - * This will happen at the next Scene Manager update, not immediately. + * Will return `true` as long as the Tween is being processed by this Tween Manager. * - * @method Phaser.Scenes.ScenePlugin#launch - * @since 3.0.0 + * Will return `false` if not present, or has a state of `REMOVED` or `DESTROYED`. * - * @param {(string|Phaser.Scene)} key - The Scene to launch. - * @param {object} [data] - The Scene data. + * @method Phaser.Tweens.TweenManager#has + * @since 3.60.0 * - * @return {this} This Scene Plugin instance. + * @param {Phaser.Tweens.Tween} tween - The Tween instance to check. + * + * @return {boolean} `true` if the Tween exists within this Tween Manager, otherwise `false`. */ - launch: function (key, data) + has: function (tween) { - if (key && key !== this.key) - { - this.manager.queueOp('start', key, data); - } - - return this; + return (this.tweens.indexOf(tween) > -1); }, /** - * Runs the given Scene, but does not change the state of this Scene. - * - * This will happen at the next Scene Manager update, not immediately. - * - * If the given Scene is paused, it will resume it. If sleeping, it will wake it. - * If not running at all, it will be started. + * Add an existing Tween to this Tween Manager. * - * Use this if you wish to open a modal Scene by calling `pause` on the current - * Scene, then `run` on the modal Scene. + * Playback will start immediately unless the tween has been configured to be paused. * - * @method Phaser.Scenes.ScenePlugin#run - * @since 3.10.0 + * @method Phaser.Tweens.TweenManager#existing + * @since 3.0.0 * - * @param {(string|Phaser.Scene)} key - The Scene to run. - * @param {object} [data] - A data object that will be passed to the Scene and emitted in its ready, wake, or resume events. + * @param {Phaser.Tweens.Tween} tween - The Tween to add. * - * @return {this} This Scene Plugin instance. + * @return {this} This Tween Manager instance. */ - run: function (key, data) + existing: function (tween) { - if (key && key !== this.key) + if (!this.has(tween)) { - this.manager.queueOp('run', key, data); + this.tweens.push(tween.reset()); } return this; }, /** - * Pause the Scene - this stops the update step from happening but it still renders. + * Create a Number Tween and add it to the active Tween list. * - * This will happen at the next Scene Manager update, not immediately. + * A Number Tween is a special kind of tween that doesn't have a target. Instead, + * it allows you to tween between 2 numeric values. The default values are + * `0` and `1`, but you can change them via the `from` and `to` properties. * - * @method Phaser.Scenes.ScenePlugin#pause + * You can get the current tweened value via the `Tween.getValue()` method. + * + * Playback will start immediately unless the tween has been configured to be paused. + * + * Please note that a Tween will not manipulate any target property that begins with an underscore. + * + * @method Phaser.Tweens.TweenManager#addCounter * @since 3.0.0 * - * @param {(string|Phaser.Scene)} [key] - The Scene to pause. - * @param {object} [data] - An optional data object that will be passed to the Scene and emitted in its pause event. + * @param {Phaser.Types.Tweens.NumberTweenBuilderConfig} config - The configuration object for the Number Tween. * - * @return {this} This Scene Plugin instance. + * @return {Phaser.Tweens.Tween} The created Number Tween. */ - pause: function (key, data) + addCounter: function (config) { - if (key === undefined) { key = this.key; } + var tween = NumberTweenBuilder(this, config); - this.manager.queueOp('pause', key, data); + this.tweens.push(tween.reset()); - return this; + return tween; }, /** - * Resume the Scene - starts the update loop again. + * Creates a Stagger function to be used by a Tween property. * - * This will happen at the next Scene Manager update, not immediately. + * The stagger function will allow you to stagger changes to the value of the property across all targets of the tween. * - * @method Phaser.Scenes.ScenePlugin#resume - * @since 3.0.0 + * This is only worth using if the tween has multiple targets. * - * @param {(string|Phaser.Scene)} [key] - The Scene to resume. - * @param {object} [data] - An optional data object that will be passed to the Scene and emitted in its resume event. + * The following will stagger the delay by 100ms across all targets of the tween, causing them to scale down to 0.2 + * over the duration specified: * - * @return {this} This Scene Plugin instance. + * ```javascript + * this.tweens.add({ + * targets: [ ... ], + * scale: 0.2, + * ease: 'linear', + * duration: 1000, + * delay: this.tweens.stagger(100) + * }); + * ``` + * + * The following will stagger the delay by 500ms across all targets of the tween using a 10 x 6 grid, staggering + * from the center out, using a cubic ease. + * + * ```javascript + * this.tweens.add({ + * targets: [ ... ], + * scale: 0.2, + * ease: 'linear', + * duration: 1000, + * delay: this.tweens.stagger(500, { grid: [ 10, 6 ], from: 'center', ease: 'cubic.out' }) + * }); + * ``` + * + * @method Phaser.Tweens.TweenManager#stagger + * @since 3.19.0 + * + * @param {(number|number[])} value - The amount to stagger by, or an array containing two elements representing the min and max values to stagger between. + * @param {Phaser.Types.Tweens.StaggerConfig} config - The configuration object for the Stagger function. + * + * @return {function} The stagger function. */ - resume: function (key, data) + stagger: function (value, options) { - if (key === undefined) { key = this.key; } - - this.manager.queueOp('resume', key, data); - - return this; + return StaggerBuilder(value, options); }, /** - * Makes the Scene sleep (no update, no render) but doesn't shutdown. + * Set the limits that are used when a browser encounters lag, or delays that cause the elapsed + * time between two frames to exceed the expected amount. If this occurs, the Tween Manager will + * act as if the 'skip' amount of times has passed, in order to maintain strict tween sequencing. * - * This will happen at the next Scene Manager update, not immediately. + * This is enabled by default with the values 500ms for the lag limit and 33ms for the skip. * - * @method Phaser.Scenes.ScenePlugin#sleep - * @since 3.0.0 + * You should not set these to low values, as it won't give time for the browser to ever + * catch-up with itself and reclaim sync. * - * @param {(string|Phaser.Scene)} [key] - The Scene to put to sleep. - * @param {object} [data] - An optional data object that will be passed to the Scene and emitted in its sleep event. + * Call this method with no arguments to disable smoothing. * - * @return {this} This Scene Plugin instance. + * Call it with the arguments `500` and `33` to reset to the defaults. + * + * @method Phaser.Tweens.TweenManager#setLagSmooth + * @since 3.60.0 + * + * @param {number} [limit=0] - If the browser exceeds this amount, in milliseconds, it will act as if the 'skip' amount has elapsed instead. + * @param {number} [skip=0] - The amount, in milliseconds, to use as the step delta should the browser lag beyond the 'limit'. + * + * @return {this} This Tween Manager instance. */ - sleep: function (key, data) + setLagSmooth: function (limit, skip) { - if (key === undefined) { key = this.key; } + if (limit === undefined) { limit = 1 / 1e-8; } + if (skip === undefined) { skip = 0; } - this.manager.queueOp('sleep', key, data); + this.maxLag = limit; + this.lagSkip = Math.min(skip, this.maxLag); return this; }, /** - * Makes the Scene wake-up (starts update and render) + * Limits the Tween system to run at a particular frame rate. * - * This will happen at the next Scene Manager update, not immediately. + * You should not set this _above_ the frequency of the browser, + * but instead can use it to throttle the frame rate lower, should + * you need to in certain situations. * - * @method Phaser.Scenes.ScenePlugin#wake - * @since 3.0.0 + * @method Phaser.Tweens.TweenManager#setFps + * @since 3.60.0 * - * @param {(string|Phaser.Scene)} [key] - The Scene to wake up. - * @param {object} [data] - An optional data object that will be passed to the Scene and emitted in its wake event. + * @param {number} [fps=240] - The frame rate to tick at. * - * @return {this} This Scene Plugin instance. + * @return {this} This Tween Manager instance. */ - wake: function (key, data) + setFps: function (fps) { - if (key === undefined) { key = this.key; } + if (fps === undefined) { fps = 240; } - this.manager.queueOp('wake', key, data); + this.gap = 1000 / fps; + this.nextTime = this.time * 1000 + this.gap; return this; }, /** - * Makes this Scene sleep then starts the Scene given. + * Internal method that calculates the delta value, along with the other timing values, + * and returns the new delta. * - * This will happen at the next Scene Manager update, not immediately. + * You should not typically call this method directly. * - * @method Phaser.Scenes.ScenePlugin#switch - * @since 3.0.0 + * @method Phaser.Tweens.TweenManager#getDelta + * @since 3.60.0 * - * @param {(string|Phaser.Scene)} key - The Scene to start. + * @param {boolean} [tick=false] - Is this a manual tick, or an automated tick? * - * @return {this} This Scene Plugin instance. + * @return {number} The new delta value. */ - switch: function (key) + getDelta: function (tick) { - if (key !== this.key) + var elapsed = Date.now() - this.prevTime; + + if (elapsed > this.maxLag) { - this.manager.queueOp('switch', this.key, key); + this.startTime += elapsed - this.lagSkip; } - return this; + this.prevTime += elapsed; + + var time = this.prevTime - this.startTime; + var overlap = time - this.nextTime; + var delta = time - this.time * 1000; + + if (overlap > 0 || tick) + { + time /= 1000; + this.time = time; + this.nextTime += overlap + (overlap >= this.gap ? 4 : this.gap - overlap); + } + else + { + delta = 0; + } + + return delta; }, /** - * Shutdown the Scene, clearing display list, timers, etc. - * - * This happens at the next Scene Manager update, not immediately. + * Manually advance the Tween system by one step. * - * @method Phaser.Scenes.ScenePlugin#stop - * @since 3.0.0 + * This will update all Tweens even if the Tween Manager is currently + * paused. * - * @param {(string|Phaser.Scene)} [key] - The Scene to stop. - * @param {any} [data] - Optional data object to pass to Scene.Systems.shutdown. + * @method Phaser.Tweens.TweenManager#tick + * @since 3.60.0 * - * @return {this} This Scene Plugin instance. + * @return {this} This Tween Manager instance. */ - stop: function (key, data) + tick: function () { - if (key === undefined) { key = this.key; } - - this.manager.queueOp('stop', key, data); + this.step(true); return this; }, /** - * Sets the active state of the given Scene. + * Internal update handler. * - * @method Phaser.Scenes.ScenePlugin#setActive - * @since 3.0.0 - * - * @param {boolean} value - If `true` the Scene will be resumed. If `false` it will be paused. - * @param {(string|Phaser.Scene)} [key] - The Scene to set the active state of. - * @param {object} [data] - An optional data object that will be passed to the Scene and emitted with its events. + * Calls `TweenManager.step` as long as the Tween Manager has not + * been paused. * - * @return {this} This Scene Plugin instance. + * @method Phaser.Tweens.TweenManager#update + * @since 3.0.0 */ - setActive: function (value, key, data) + update: function () { - if (key === undefined) { key = this.key; } - - var scene = this.manager.getScene(key); - - if (scene) + if (!this.paused) { - scene.sys.setActive(value, data); + this.step(false); } - - return this; }, /** - * Sets the visible state of the given Scene. + * Updates all Tweens belonging to this Tween Manager. * - * @method Phaser.Scenes.ScenePlugin#setVisible - * @since 3.0.0 + * Called automatically by `update` and `tick`. * - * @param {boolean} value - The visible value. - * @param {(string|Phaser.Scene)} [key] - The Scene to set the visible state for. + * @method Phaser.Tweens.TweenManager#step + * @since 3.60.0 * - * @return {this} This Scene Plugin instance. + * @param {boolean} [tick=false] - Is this a manual tick, or an automated tick? */ - setVisible: function (value, key) + step: function (tick) { - if (key === undefined) { key = this.key; } + if (tick === undefined) { tick = false; } - var scene = this.manager.getScene(key); + var delta = this.getDelta(tick); - if (scene) + if (delta <= 0) { - scene.sys.setVisible(value); + // If we've got a negative delta, skip this step + return; } - return this; - }, + this.processing = true; - /** - * Checks if the given Scene is sleeping or not? - * - * @method Phaser.Scenes.ScenePlugin#isSleeping - * @since 3.0.0 - * - * @param {(string|Phaser.Scene)} [key] - The Scene to check. - * - * @return {boolean} Whether the Scene is sleeping, or `null` if no matching Scene was found. - */ - isSleeping: function (key) - { - if (key === undefined) { key = this.key; } + var i; + var tween; + var toDestroy = []; + var list = this.tweens; - return this.manager.isSleeping(key); + // By not caching the length we can immediately update tweens added + // this frame (such as chained tweens) + for (i = 0; i < list.length; i++) + { + tween = list[i]; + + // If Tween.update returns 'true' then it means it has completed, + // so move it to the destroy list + if (tween.update(delta)) + { + toDestroy.push(tween); + } + } + + // Clean-up the 'toDestroy' list + var count = toDestroy.length; + + if (count && list.length > 0) + { + for (i = 0; i < count; i++) + { + tween = toDestroy[i]; + + var idx = list.indexOf(tween); + + if (idx > -1 && (tween.isPendingRemove() || tween.isDestroyed())) + { + list.splice(idx, 1); + + tween.destroy(); + } + } + + toDestroy.length = 0; + } + + this.processing = false; }, /** - * Checks if the given Scene is running or not? + * Removes the given Tween from this Tween Manager, even if it hasn't started + * playback yet. If this method is called while the Tween Manager is processing + * an update loop, then the tween will be flagged for removal at the start of + * the next frame. Otherwise, it is removed immediately. * - * @method Phaser.Scenes.ScenePlugin#isActive - * @since 3.0.0 + * The removed tween is _not_ destroyed. It is just removed from this Tween Manager. * - * @param {(string|Phaser.Scene)} [key] - The Scene to check. + * @method Phaser.Tweens.TweenManager#remove + * @since 3.17.0 * - * @return {boolean} Whether the Scene is running, or `null` if no matching Scene was found. + * @param {Phaser.Tweens.Tween} tween - The Tween to be removed. + * + * @return {this} This Tween Manager instance. */ - isActive: function (key) + remove: function (tween) { - if (key === undefined) { key = this.key; } + if (this.processing) + { + // Remove it on the next frame + tween.setPendingRemoveState(); + } + else + { + // Remove it immediately + ArrayRemove(this.tweens, tween); - return this.manager.isActive(key); + tween.setRemovedState(); + } + + return this; }, /** - * Checks if the given Scene is paused or not? + * Resets the given Tween. * - * @method Phaser.Scenes.ScenePlugin#isPaused - * @since 3.17.0 + * If the Tween does not belong to this Tween Manager, it will first be added. * - * @param {(string|Phaser.Scene)} [key] - The Scene to check. + * Then it will seek to position 0 and playback will start on the next frame. * - * @return {boolean} Whether the Scene is paused, or `null` if no matching Scene was found. + * @method Phaser.Tweens.TweenManager#reset + * @since 3.60.0 + * + * @param {Phaser.Tweens.Tween} tween - The Tween to be reset. + * + * @return {this} This Tween Manager instance. */ - isPaused: function (key) + reset: function (tween) { - if (key === undefined) { key = this.key; } + this.existing(tween); - return this.manager.isPaused(key); + tween.seek(); + + tween.setActiveState(); + + return this; }, /** - * Checks if the given Scene is visible or not? + * Checks if a Tween is active and adds it to the Tween Manager at the start of the frame if it isn't. * - * @method Phaser.Scenes.ScenePlugin#isVisible + * @method Phaser.Tweens.TweenManager#makeActive * @since 3.0.0 * - * @param {(string|Phaser.Scene)} [key] - The Scene to check. + * @param {Phaser.Tweens.Tween} tween - The Tween to check. * - * @return {boolean} Whether the Scene is visible, or `null` if no matching Scene was found. + * @return {this} This Tween Manager instance. */ - isVisible: function (key) + makeActive: function (tween) { - if (key === undefined) { key = this.key; } + this.existing(tween); - return this.manager.isVisible(key); + tween.setActiveState(); + + return this; }, /** - * Swaps the position of two scenes in the Scenes list. - * - * This controls the order in which they are rendered and updated. + * Passes all Tweens to the given callback. * - * @method Phaser.Scenes.ScenePlugin#swapPosition - * @since 3.2.0 + * @method Phaser.Tweens.TweenManager#each + * @since 3.0.0 * - * @param {(string|Phaser.Scene)} keyA - The first Scene to swap. - * @param {(string|Phaser.Scene)} [keyB] - The second Scene to swap. If none is given it defaults to this Scene. + * @param {function} callback - The function to call. + * @param {object} [scope] - The scope (`this` object) to call the function with. + * @param {...*} [args] - The arguments to pass into the function. Its first argument will always be the Tween currently being iterated. * - * @return {this} This Scene Plugin instance. + * @return {this} This Tween Manager instance. */ - swapPosition: function (keyA, keyB) + each: function (callback, scope) { - if (keyB === undefined) { keyB = this.key; } + var i; + var args = [ null ]; - if (keyA !== keyB) + for (i = 1; i < arguments.length; i++) { - this.manager.swapPosition(keyA, keyB); + args.push(arguments[i]); } + this.tweens.forEach(function (tween) + { + args[0] = tween; + + callback.apply(scope, args); + }); + return this; }, /** - * Swaps the position of two scenes in the Scenes list, so that Scene B is directly above Scene A. + * Returns an array containing references to all Tweens in this Tween Manager. * - * This controls the order in which they are rendered and updated. + * It is safe to mutate the returned array. However, acting upon any of the Tweens + * within it, will adjust those stored in this Tween Manager, as they are passed + * by reference and not cloned. * - * @method Phaser.Scenes.ScenePlugin#moveAbove - * @since 3.2.0 + * If you wish to get tweens for a specific target, see `getTweensOf`. * - * @param {(string|Phaser.Scene)} keyA - The Scene that Scene B will be moved to be above. - * @param {(string|Phaser.Scene)} [keyB] - The Scene to be moved. If none is given it defaults to this Scene. + * @method Phaser.Tweens.TweenManager#getTweens + * @since 3.0.0 * - * @return {this} This Scene Plugin instance. + * @return {Phaser.Tweens.Tween[]} A new array containing references to all Tweens. */ - moveAbove: function (keyA, keyB) + getTweens: function () { - if (keyB === undefined) { keyB = this.key; } - - if (keyA !== keyB) - { - this.manager.moveAbove(keyA, keyB); - } - - return this; + return this.tweens.slice(); }, /** - * Swaps the position of two scenes in the Scenes list, so that Scene B is directly below Scene A. + * Returns an array of all Tweens in the Tween Manager which affect the given target, or array of targets. * - * This controls the order in which they are rendered and updated. + * It's possible for this method to return tweens that are about to be removed from + * the Tween Manager. You should check the state of the returned tween before acting + * upon it. * - * @method Phaser.Scenes.ScenePlugin#moveBelow - * @since 3.2.0 + * @method Phaser.Tweens.TweenManager#getTweensOf + * @since 3.0.0 * - * @param {(string|Phaser.Scene)} keyA - The Scene that Scene B will be moved to be below. - * @param {(string|Phaser.Scene)} [keyB] - The Scene to be moved. If none is given it defaults to this Scene. + * @param {(object|object[])} target - The target to look for. Provide an array to look for multiple targets. * - * @return {this} This Scene Plugin instance. + * @return {Phaser.Tweens.Tween[]} A new array containing all Tweens which affect the given target(s). */ - moveBelow: function (keyA, keyB) + getTweensOf: function (target) { - if (keyB === undefined) { keyB = this.key; } + var output = []; + var list = this.tweens; - if (keyA !== keyB) + if (!Array.isArray(target)) { - this.manager.moveBelow(keyA, keyB); + target = [ target ]; + } + else + { + target = Flatten(target); } - return this; + var targetLen = target.length; + + for (var i = 0; i < list.length; i++) + { + var tween = list[i]; + + for (var t = 0; t < targetLen; t++) + { + if (!tween.isDestroyed() && tween.hasTarget(target[t])) + { + output.push(tween); + } + } + } + + return output; }, /** - * Removes a Scene from the SceneManager. - * - * The Scene is removed from the local scenes array, it's key is cleared from the keys - * cache and Scene.Systems.destroy is then called on it. - * - * If the SceneManager is processing the Scenes when this method is called it will - * queue the operation for the next update sequence. - * - * @method Phaser.Scenes.ScenePlugin#remove - * @since 3.2.0 + * Returns the scale of the time delta for all Tweens owned by this Tween Manager. * - * @param {(string|Phaser.Scene)} [key] - The Scene to be removed. + * @method Phaser.Tweens.TweenManager#getGlobalTimeScale + * @since 3.0.0 * - * @return {this} This Scene Plugin instance. + * @return {number} The scale of the time delta, usually 1. */ - remove: function (key) + getGlobalTimeScale: function () { - if (key === undefined) { key = this.key; } - - this.manager.remove(key); - - return this; + return this.timeScale; }, /** - * Moves a Scene up one position in the Scenes list. + * Sets a new scale of the time delta for this Tween Manager. * - * @method Phaser.Scenes.ScenePlugin#moveUp + * The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Tween Manager and all Tweens it owns. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing all Tweens. + * + * @method Phaser.Tweens.TweenManager#setGlobalTimeScale * @since 3.0.0 * - * @param {(string|Phaser.Scene)} [key] - The Scene to move. + * @param {number} value - The new scale of the time delta, where 1 is the normal speed. * - * @return {this} This Scene Plugin instance. + * @return {this} This Tween Manager instance. */ - moveUp: function (key) - { - if (key === undefined) { key = this.key; } - - this.manager.moveUp(key); + setGlobalTimeScale: function (value) + { + this.timeScale = value; return this; }, /** - * Moves a Scene down one position in the Scenes list. + * Checks if the given object is being affected by a _playing_ Tween. * - * @method Phaser.Scenes.ScenePlugin#moveDown + * If the Tween is paused, this method will return false. + * + * @method Phaser.Tweens.TweenManager#isTweening * @since 3.0.0 * - * @param {(string|Phaser.Scene)} [key] - The Scene to move. + * @param {object} target - The object to check if a tween is active for it, or not. * - * @return {this} This Scene Plugin instance. + * @return {boolean} Returns `true` if a tween is active on the given target, otherwise `false`. */ - moveDown: function (key) + isTweening: function (target) { - if (key === undefined) { key = this.key; } + var list = this.tweens; + var tween; - this.manager.moveDown(key); + for (var i = 0; i < list.length; i++) + { + tween = list[i]; - return this; + if (tween.isPlaying() && tween.hasTarget(target)) + { + return true; + } + } + + return false; }, /** - * Brings a Scene to the top of the Scenes list. + * Destroys all Tweens in this Tween Manager. * - * This means it will render above all other Scenes. + * The tweens will erase all references to any targets they hold + * and be stopped immediately. * - * @method Phaser.Scenes.ScenePlugin#bringToTop - * @since 3.0.0 + * If this method is called while the Tween Manager is running its + * update process, then the tweens will be removed at the start of + * the next frame. Outside of this, they are removed immediately. * - * @param {(string|Phaser.Scene)} [key] - The Scene to move. + * @method Phaser.Tweens.TweenManager#killAll + * @since 3.0.0 * - * @return {this} This Scene Plugin instance. + * @return {this} This Tween Manager instance. */ - bringToTop: function (key) + killAll: function () { - if (key === undefined) { key = this.key; } + var tweens = (this.processing) ? this.getTweens() : this.tweens; - this.manager.bringToTop(key); + for (var i = 0; i < tweens.length; i++) + { + tweens[i].destroy(); + } + + if (!this.processing) + { + tweens.length = 0; + } return this; }, /** - * Sends a Scene to the back of the Scenes list. + * Stops all Tweens which affect the given target or array of targets. * - * This means it will render below all other Scenes. + * The tweens will erase all references to any targets they hold + * and be stopped immediately. * - * @method Phaser.Scenes.ScenePlugin#sendToBack + * If this method is called while the Tween Manager is running its + * update process, then the tweens will be removed at the start of + * the next frame. Outside of this, they are removed immediately. + * + * @see {@link #getTweensOf} + * + * @method Phaser.Tweens.TweenManager#killTweensOf * @since 3.0.0 * - * @param {(string|Phaser.Scene)} [key] - The Scene to move. + * @param {(object|array)} target - The target to kill the tweens of. Provide an array to use multiple targets. * - * @return {this} This Scene Plugin instance. + * @return {this} This Tween Manager instance. */ - sendToBack: function (key) + killTweensOf: function (target) { - if (key === undefined) { key = this.key; } + var tweens = this.getTweensOf(target); - this.manager.sendToBack(key); + for (var i = 0; i < tweens.length; i++) + { + tweens[i].destroy(); + } return this; }, /** - * Retrieve a Scene. + * Pauses this Tween Manager. No Tweens will update while paused. * - * @method Phaser.Scenes.ScenePlugin#get - * @since 3.0.0 + * This includes tweens created after this method was called. * - * @param {(string|Phaser.Scene)} key - The Scene to retrieve. + * See `TweenManager#resumeAll` to resume the playback. * - * @return {Phaser.Scene} The Scene. + * As of Phaser 3.60 you can also toggle the boolean property `TweenManager.paused`. + * + * @method Phaser.Tweens.TweenManager#pauseAll + * @since 3.0.0 + * + * @return {this} This Tween Manager instance. */ - get: function (key) + pauseAll: function () { - return this.manager.getScene(key); + this.paused = true; + + return this; }, /** - * Retrieves the numeric index of a Scene in the Scenes list. + * Resumes playback of this Tween Manager. * - * @method Phaser.Scenes.ScenePlugin#getIndex - * @since 3.7.0 + * All active Tweens will continue updating. * - * @param {(string|Phaser.Scene)} [key] - The Scene to get the index of. + * See `TweenManager#pauseAll` to pause the playback. * - * @return {number} The index of the Scene. + * As of Phaser 3.60 you can also toggle the boolean property `TweenManager.paused`. + * + * @method Phaser.Tweens.TweenManager#resumeAll + * @since 3.0.0 + * + * @return {this} This Tween Manager instance. */ - getIndex: function (key) + resumeAll: function () { - if (key === undefined) { key = this.key; } + this.paused = false; - return this.manager.getIndex(key); + return this; }, /** @@ -232884,9384 +255043,10841 @@ var ScenePlugin = new Class({ * * We need to kill and reset all internal properties as well as stop listening to Scene events. * - * @method Phaser.Scenes.ScenePlugin#shutdown - * @private + * @method Phaser.Tweens.TweenManager#shutdown * @since 3.0.0 */ shutdown: function () { - var eventEmitter = this.systems.events; + this.killAll(); - eventEmitter.off(Events.SHUTDOWN, this.shutdown, this); - eventEmitter.off(Events.POST_UPDATE, this.step, this); - eventEmitter.off(Events.TRANSITION_OUT); + this.tweens = []; + + this.events.off(SceneEvents.UPDATE, this.update, this); + this.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); }, /** * The Scene that owns this plugin is being destroyed. - * * We need to shutdown and then kill off all external references. * - * @method Phaser.Scenes.ScenePlugin#destroy - * @private + * @method Phaser.Tweens.TweenManager#destroy * @since 3.0.0 */ destroy: function () { this.shutdown(); - this.scene.sys.events.off(Events.START, this.start, this); + this.events.off(SceneEvents.START, this.start, this); this.scene = null; - this.systems = null; - this.settings = null; - this.manager = null; + this.events = null; } }); -PluginCache.register('ScenePlugin', ScenePlugin, 'scenePlugin'); +PluginCache.register('TweenManager', TweenManager, 'tweens'); -module.exports = ScenePlugin; +module.exports = TweenManager; /***/ }), -/* 1415 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 63130: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @namespace Phaser.Structs + * Retrieves the value of the given key from an object. + * + * @function Phaser.Tweens.Builders.GetBoolean + * @since 3.0.0 + * + * @param {object} source - The object to retrieve the value from. + * @param {string} key - The key to look for in the `source` object. + * @param {boolean} defaultValue - The default value to return if the `key` doesn't exist or if no `source` object is provided. + * + * @return {boolean} The retrieved value. */ - -module.exports = { - - Events: __webpack_require__(438), - List: __webpack_require__(110), - Map: __webpack_require__(102), - ProcessQueue: __webpack_require__(211), - RTree: __webpack_require__(531), - Set: __webpack_require__(149), - Size: __webpack_require__(416) - +var GetBoolean = function (source, key, defaultValue) +{ + if (!source) + { + return defaultValue; + } + else if (source.hasOwnProperty(key)) + { + return source[key]; + } + else + { + return defaultValue; + } }; +module.exports = GetBoolean; + /***/ }), -/* 1416 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 21902: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extend = __webpack_require__(17); -var FilterMode = __webpack_require__(1417); +var EaseMap = __webpack_require__(35060); +var UppercaseFirst = __webpack_require__(40587); /** - * @namespace Phaser.Textures + * This internal function is used to return the correct ease function for a Tween. + * + * It can take a variety of input, including an EaseMap based string, or a custom function. + * + * @function Phaser.Tweens.Builders.GetEaseFunction + * @since 3.0.0 + * + * @param {(string|function)} ease - The ease to find. This can be either a string from the EaseMap, or a custom function. + * @param {number[]} [easeParams] - An optional array of ease parameters to go with the ease. + * + * @return {function} The ease function. */ +var GetEaseFunction = function (ease, easeParams) +{ + // Default ease function + var easeFunction = EaseMap.Power0; + + // Prepare ease function + if (typeof ease === 'string') + { + // String based look-up + + // 1) They specified it correctly + if (EaseMap.hasOwnProperty(ease)) + { + easeFunction = EaseMap[ease]; + } + else + { + // Do some string manipulation to try and find it + var direction = ''; + + if (ease.indexOf('.')) + { + // quad.in = Quad.easeIn + // quad.out = Quad.easeOut + // quad.inout = Quad.easeInOut + + direction = ease.substring(ease.indexOf('.') + 1); + + var directionLower = direction.toLowerCase(); + + if (directionLower === 'in') + { + direction = 'easeIn'; + } + else if (directionLower === 'out') + { + direction = 'easeOut'; + } + else if (directionLower === 'inout') + { + direction = 'easeInOut'; + } + } + + ease = UppercaseFirst(ease.substring(0, ease.indexOf('.') + 1) + direction); + + if (EaseMap.hasOwnProperty(ease)) + { + easeFunction = EaseMap[ease]; + } + } + } + else if (typeof ease === 'function') + { + // Custom function + easeFunction = ease; + } + + // No custom ease parameters? + if (!easeParams) + { + // Return ease function + return easeFunction; + } + + var cloneParams = easeParams.slice(0); + + cloneParams.unshift(0); + + // Return ease function with custom ease parameters + return function (v) + { + cloneParams[0] = v; + + return easeFunction.apply(this, cloneParams); + }; +}; + +module.exports = GetEaseFunction; + + +/***/ }), + +/***/ 4840: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * Linear filter type. - * - * @name Phaser.Textures.LINEAR - * @type {number} - * @const - * @since 3.0.0 + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Bezier = __webpack_require__(63210); +var CatmullRom = __webpack_require__(88332); +var Linear = __webpack_require__(47614); + +var FuncMap = { + bezier: Bezier, + catmull: CatmullRom, + catmullrom: CatmullRom, + linear: Linear +}; + /** - * Nearest Neighbor filter type. - * - * @name Phaser.Textures.NEAREST - * @type {number} - * @const - * @since 3.0.0 + * This internal function is used to return the correct interpolation function for a Tween. + * + * It can take a variety of input, including a string, or a custom function. + * + * @function Phaser.Tweens.Builders.GetInterpolationFunction + * @since 3.60.0 + * + * @param {(string|function|null)} interpolation - The interpolation function to find. This can be either a string, or a custom function, or null. + * + * @return {?function} The interpolation function to use, or `null`. */ +var GetInterpolationFunction = function (interpolation) +{ + if (interpolation === null) + { + return null; + } -var Textures = { + // Default interpolation function + var interpolationFunction = FuncMap.linear; - CanvasTexture: __webpack_require__(423), - Events: __webpack_require__(106), - FilterMode: FilterMode, - Frame: __webpack_require__(109), - Parsers: __webpack_require__(425), - Texture: __webpack_require__(206), - TextureManager: __webpack_require__(422), - TextureSource: __webpack_require__(424) + // Prepare interpolation function + if (typeof interpolation === 'string') + { + // String based look-up -}; + // 1) They specified it correctly + if (FuncMap.hasOwnProperty(interpolation)) + { + interpolationFunction = FuncMap[interpolation]; + } + } + else if (typeof interpolation === 'function') + { + // Custom function + interpolationFunction = interpolation; + } -Textures = Extend(false, Textures, FilterMode); + // Return interpolation function + return interpolationFunction; +}; -module.exports = Textures; +module.exports = GetInterpolationFunction; /***/ }), -/* 1417 */ -/***/ (function(module, exports) { + +/***/ 28348: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Filter Types. + * Internal function used by the Tween Builder to create a function that will return + * the given value from the source. * - * @namespace Phaser.Textures.FilterMode - * @memberof Phaser.Textures + * @function Phaser.Tweens.Builders.GetNewValue * @since 3.0.0 + * + * @param {any} source - The source object to get the value from. + * @param {string} key - The property to get from the source. + * @param {any} defaultValue - A default value to return should the source not have the property set. + * + * @return {function} A function which, when called, will return the property value from the source. */ -var CONST = { +var GetNewValue = function (source, key, defaultValue) +{ + var valueCallback; - /** - * Linear filter type. - * - * @name Phaser.Textures.FilterMode.LINEAR - * @type {number} - * @const - * @since 3.0.0 - */ - LINEAR: 0, + if (source.hasOwnProperty(key)) + { + var t = typeof(source[key]); - /** - * Nearest neighbor filter type. - * - * @name Phaser.Textures.FilterMode.NEAREST - * @type {number} - * @const - * @since 3.0.0 - */ - NEAREST: 1 - + if (t === 'function') + { + valueCallback = function (target, targetKey, value, targetIndex, totalTargets, tween) + { + return source[key](target, targetKey, value, targetIndex, totalTargets, tween); + }; + } + else + { + valueCallback = function () + { + return source[key]; + }; + } + } + else if (typeof defaultValue === 'function') + { + valueCallback = defaultValue; + } + else + { + valueCallback = function () + { + return defaultValue; + }; + } + + return valueCallback; }; -module.exports = CONST; +module.exports = GetNewValue; /***/ }), -/* 1418 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 92407: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Extend = __webpack_require__(17); -var CONST = __webpack_require__(1419); +var RESERVED = __webpack_require__(53709); /** - * @namespace Phaser.Tilemaps + * Internal function used by the Tween Builder to return an array of properties + * that the Tween will be operating on. It takes a tween configuration object + * and then checks that none of the `props` entries start with an underscore, or that + * none of the direct properties are on the Reserved list. * - * @borrows Phaser.Tilemaps.Orientation.ORTHOGONAL as ORTHOGONAL - * @borrows Phaser.Tilemaps.Orientation.ISOMETRIC as ISOMETRIC - * @borrows Phaser.Tilemaps.Orientation.STAGGERED as STAGGERED - * @borrows Phaser.Tilemaps.Orientation.HEXAGONAL as HEXAGONAL + * @function Phaser.Tweens.Builders.GetProps + * @since 3.0.0 + * + * @param {Phaser.Types.Tweens.TweenBuilderConfig} config - The configuration object of the Tween to get the properties from. + * + * @return {string[]} An array of all the properties the tween will operate on. */ +var GetProps = function (config) +{ + var key; + var keys = []; -var Tilemaps = { - - Components: __webpack_require__(251), - Parsers: __webpack_require__(1452), - - Formats: __webpack_require__(40), - ImageCollection: __webpack_require__(576), - ParseToTilemap: __webpack_require__(262), - Tile: __webpack_require__(85), - Tilemap: __webpack_require__(580), - TilemapCreator: __webpack_require__(1459), - TilemapFactory: __webpack_require__(1460), - Tileset: __webpack_require__(122), - TilemapLayer: __webpack_require__(581), - Orientation: __webpack_require__(29), + // First see if we have a props object - LayerData: __webpack_require__(120), - MapData: __webpack_require__(121), - ObjectLayer: __webpack_require__(572) + if (config.hasOwnProperty('props')) + { + for (key in config.props) + { + // Skip any property that starts with an underscore + if (key.substring(0, 1) !== '_') + { + keys.push({ key: key, value: config.props[key] }); + } + } + } + else + { + for (key in config) + { + // Skip any property that is in the ReservedProps list or that starts with an underscore + if (RESERVED.indexOf(key) === -1 && key.substring(0, 1) !== '_') + { + keys.push({ key: key, value: config[key] }); + } + } + } + return keys; }; -Tilemaps = Extend(false, Tilemaps, CONST.ORIENTATION); - -module.exports = Tilemaps; +module.exports = GetProps; /***/ }), -/* 1419 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 65868: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = { +var GetValue = __webpack_require__(10850); + +/** + * Extracts an array of targets from a Tween configuration object. + * + * The targets will be looked for in a `targets` property. If it's a function, its return value will be used as the result. + * + * @function Phaser.Tweens.Builders.GetTargets + * @since 3.0.0 + * + * @param {object} config - The configuration object to use. + * + * @return {array} An array of targets (may contain only one element), or `null` if no targets were specified. + */ +var GetTargets = function (config) +{ + var targets = GetValue(config, 'targets', null); + + if (targets === null) + { + return targets; + } + + if (typeof targets === 'function') + { + targets = targets.call(); + } - ORIENTATION: __webpack_require__(29) + if (!Array.isArray(targets)) + { + targets = [ targets ]; + } + return targets; }; -module.exports = CONST; +module.exports = GetTargets; /***/ }), -/* 1420 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 9744: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(26); -var CalculateFacesWithin = __webpack_require__(63); +var Between = __webpack_require__(17489); +var FloatBetween = __webpack_require__(61616); /** - * Copies the tiles in the source rectangular area to a new destination (all specified in tile - * coordinates) within the layer. This copies all tile properties & recalculates collision - * information in the destination region. + * @ignore + */ +function hasGetActive (def) +{ + return (!!def.getActive && typeof def.getActive === 'function'); +} + +/** + * @ignore + */ +function hasGetStart (def) +{ + return (!!def.getStart && typeof def.getStart === 'function'); +} + +/** + * @ignore + */ +function hasGetEnd (def) +{ + return (!!def.getEnd && typeof def.getEnd === 'function'); +} + +/** + * @ignore + */ +function hasGetters (def) +{ + return hasGetStart(def) || hasGetEnd(def) || hasGetActive(def); +} + +/** + * Returns `getActive`, `getStart` and `getEnd` functions for a TweenData based on a target property and end value. * - * @function Phaser.Tilemaps.Components.Copy + * `getActive` if not null, is invoked _immediately_ as soon as the TweenData is running, and is set on the target property. + * `getEnd` is invoked once any start delays have expired and returns what the value should tween to. + * `getStart` is invoked when the tween reaches the end and needs to either repeat or yoyo, it returns the value to go back to. + * + * If the end value is a number, it will be treated as an absolute value and the property will be tweened to it. + * A string can be provided to specify a relative end value which consists of an operation + * (`+=` to add to the current value, `-=` to subtract from the current value, `*=` to multiply the current + * value, or `/=` to divide the current value) followed by its operand. + * + * A function can be provided to allow greater control over the end value; it will receive the target + * object being tweened, the name of the property being tweened, and the current value of the property + * as its arguments and must return a value. + * + * If both the starting and the ending values need to be controlled, an object with `getStart` and `getEnd` + * callbacks, which will receive the same arguments, can be provided instead. If an object with a `value` + * property is provided, the property will be used as the effective value under the same rules described here. + * + * @function Phaser.Tweens.Builders.GetValueOp * @since 3.0.0 * - * @param {number} srcTileX - The x coordinate of the area to copy from, in tiles, not pixels. - * @param {number} srcTileY - The y coordinate of the area to copy from, in tiles, not pixels. - * @param {number} width - The width of the area to copy, in tiles, not pixels. - * @param {number} height - The height of the area to copy, in tiles, not pixels. - * @param {number} destTileX - The x coordinate of the area to copy to, in tiles, not pixels. - * @param {number} destTileY - The y coordinate of the area to copy to, in tiles, not pixels. - * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {string} key - The name of the property to modify. + * @param {*} propertyValue - The ending value of the property, as described above. + * + * @return {function} An array of functions, `getActive`, `getStart` and `getEnd`, which return the starting and the ending value of the property based on the provided value. */ -var Copy = function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, layer) +var GetValueOp = function (key, propertyValue) { - if (recalculateFaces === undefined) { recalculateFaces = true; } + var callbacks; - if (srcTileX < 0) { srcTileX = 0; } - if (srcTileY < 0) { srcTileY = 0; } + // The returned value sets what the property will be at the END of the Tween (usually called at the start of the Tween) + var getEnd = function (target, key, value) { return value; }; - var srcTiles = GetTilesWithin(srcTileX, srcTileY, width, height, null, layer); + // The returned value sets what the property will be at the START of the Tween (usually called at the end of the Tween) + var getStart = function (target, key, value) { return value; }; - var offsetX = destTileX - srcTileX; - var offsetY = destTileY - srcTileY; + // What to set the property to the moment the TweenData is invoked + var getActive = null; + + var t = typeof(propertyValue); - for (var i = 0; i < srcTiles.length; i++) + if (t === 'number') { - var tileX = srcTiles[i].x + offsetX; - var tileY = srcTiles[i].y + offsetY; + // props: { + // x: 400, + // y: 300 + // } - if (tileX >= 0 && tileX < layer.width && tileY >= 0 && tileY < layer.height) + getEnd = function () { - if (layer.data[tileY][tileX]) + return propertyValue; + }; + } + else if (Array.isArray(propertyValue)) + { + // props: { + // x: [ 400, 300, 200 ], + // y: [ 10, 500, 10 ] + // } + + getStart = function () + { + return propertyValue[0]; + }; + + getEnd = function () + { + return propertyValue[propertyValue.length - 1]; + }; + } + else if (t === 'string') + { + // props: { + // x: '+=400', + // y: '-=300', + // z: '*=2', + // w: '/=2', + // p: 'random(10, 100)' - random float + // p: 'int(10, 100)' - random int + // } + + var op = propertyValue.toLowerCase(); + var isRandom = (op.substring(0, 6) === 'random'); + var isInt = (op.substring(0, 3) === 'int'); + + if (isRandom || isInt) + { + // random(0.5, 3.45) + // int(10, 100) + var brace1 = op.indexOf('('); + var brace2 = op.indexOf(')'); + var comma = op.indexOf(','); + + if (brace1 && brace2 && comma) + { + var value1 = parseFloat(op.substring(brace1 + 1, comma)); + var value2 = parseFloat(op.substring(comma + 1, brace2)); + + if (isRandom) + { + getEnd = function () + { + return FloatBetween(value1, value2); + }; + } + else + { + getEnd = function () + { + return Between(value1, value2); + }; + } + } + else + { + throw new Error('invalid random() format'); + } + } + else + { + op = op[0]; + var num = parseFloat(propertyValue.substr(2)); + + switch (op) { - layer.data[tileY][tileX].copy(srcTiles[i]); + case '+': + getEnd = function (target, key, value) + { + return value + num; + }; + break; + + case '-': + getEnd = function (target, key, value) + { + return value - num; + }; + break; + + case '*': + getEnd = function (target, key, value) + { + return value * num; + }; + break; + + case '/': + getEnd = function (target, key, value) + { + return value / num; + }; + break; + + default: + getEnd = function () + { + return parseFloat(propertyValue); + }; } } } + else if (t === 'function') + { + // The same as setting just the getEnd function and no getStart - if (recalculateFaces) + // props: { + // x: function (target, key, value, targetIndex, totalTargets, tween, tweenData) { return value + 50); }, + // } + + getEnd = propertyValue; + } + else if (t === 'object') { - // Recalculate the faces within the destination area and neighboring tiles - CalculateFacesWithin(destTileX - 1, destTileY - 1, width + 2, height + 2, layer); + if (hasGetters(propertyValue)) + { + /* + x: { + // Called the moment Tween is active. The returned value sets the property on the target immediately. + getActive: function (target, key, value, targetIndex, totalTargets, tween, tweenData) + { + return value; + }, + + // Called at the start of the Tween. The returned value sets what the property will be at the END of the Tween. + getEnd: function (target, key, value, targetIndex, totalTargets, tween, tweenData) + { + return value; + }, + + // Called at the end of the Tween. The returned value sets what the property will be at the START of the Tween. + getStart: function (target, key, value, targetIndex, totalTargets, tween, tweenData) + { + return value; + } + } + */ + + if (hasGetActive(propertyValue)) + { + getActive = propertyValue.getActive; + } + + if (hasGetEnd(propertyValue)) + { + getEnd = propertyValue.getEnd; + } + + if (hasGetStart(propertyValue)) + { + getStart = propertyValue.getStart; + } + } + else if (propertyValue.hasOwnProperty('value')) + { + // 'value' may still be a string, function or a number + // props: { + // x: { value: 400, ... }, + // y: { value: 300, ... } + // } + + callbacks = GetValueOp(key, propertyValue.value); + } + else + { + // 'from' and 'to' may still be a string, function or a number + // props: { + // x: { from: 400, to: 600 }, + // y: { from: 300, to: 500 } + // } + + // Same as above, but the 'start' value is set immediately on the target + // props: { + // x: { start: 400, to: 600 }, + // y: { start: 300, to: 500 } + // } + + // 'start' value is set immediately, then it goes 'from' to 'to' during the tween + // props: { + // x: { start: 200, from: 400, to: 600 }, + // y: { start: 300, from: 300, to: 500 } + // } + + var hasTo = propertyValue.hasOwnProperty('to'); + var hasFrom = propertyValue.hasOwnProperty('from'); + var hasStart = propertyValue.hasOwnProperty('start'); + + if (hasTo && (hasFrom || hasStart)) + { + callbacks = GetValueOp(key, propertyValue.to); + + if (hasStart) + { + var startCallbacks = GetValueOp(key, propertyValue.start); + + callbacks.getActive = startCallbacks.getEnd; + } + + if (hasFrom) + { + var fromCallbacks = GetValueOp(key, propertyValue.from); + + callbacks.getStart = fromCallbacks.getEnd; + } + } + } + } + + // If callback not set by the else if block above then set it here and return it + if (!callbacks) + { + callbacks = { + getActive: getActive, + getEnd: getEnd, + getStart: getStart + }; } + + return callbacks; }; -module.exports = Copy; +module.exports = GetValueOp; /***/ }), -/* 1421 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 68710: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(26); -var ReplaceByIndex = __webpack_require__(542); +var BaseTween = __webpack_require__(502); +var Defaults = __webpack_require__(99730); +var GetAdvancedValue = __webpack_require__(20494); +var GetBoolean = __webpack_require__(63130); +var GetEaseFunction = __webpack_require__(21902); +var GetNewValue = __webpack_require__(28348); +var GetValue = __webpack_require__(10850); +var GetValueOp = __webpack_require__(9744); +var MergeRight = __webpack_require__(72066); +var Tween = __webpack_require__(39366); /** - * Creates a Sprite for every object matching the given tile indexes in the layer. You can - * optionally specify if each tile will be replaced with a new tile after the Sprite has been - * created. This is useful if you want to lay down special tiles in a level that are converted to - * Sprites, but want to replace the tile itself with a floor tile or similar once converted. + * Creates a new Number Tween. * - * @function Phaser.Tilemaps.Components.CreateFromTiles + * @function Phaser.Tweens.Builders.NumberTweenBuilder * @since 3.0.0 * - * @param {(number|number[])} indexes - The tile index, or array of indexes, to create Sprites from. - * @param {(number|number[])} replacements - The tile index, or array of indexes, to change a converted tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a one-to-one mapping with the indexes array. - * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} spriteConfig - The config object to pass into the Sprite creator (i.e. scene.make.sprite). - * @param {Phaser.Scene} scene - The Scene to create the Sprites within. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when determining the world XY - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Tweens.TweenManager} parent - The owner of the new Tween. + * @param {Phaser.Types.Tweens.NumberTweenBuilderConfig} config - Configuration for the new Tween. + * @param {Phaser.Types.Tweens.TweenConfigDefaults} defaults - Tween configuration defaults. * - * @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created. + * @return {Phaser.Tweens.Tween} The new tween. */ -var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, camera, layer) +var NumberTweenBuilder = function (parent, config, defaults) { - if (!spriteConfig) { spriteConfig = {}; } + if (config instanceof Tween) + { + config.parent = parent; - if (!Array.isArray(indexes)) + return config; + } + + if (defaults === undefined) { - indexes = [ indexes ]; + defaults = Defaults; + } + else + { + defaults = MergeRight(Defaults, defaults); } - var tilemapLayer = layer.tilemapLayer; + // var tween = this.tweens.addCounter({ + // from: 100, + // to: 200, + // ... (normal tween properties) + // }) + // + // Then use it in your game via: + // + // tween.getValue() - if (!scene) { scene = tilemapLayer.scene; } - if (!camera) { camera = scene.cameras.main; } + var from = GetValue(config, 'from', 0); + var to = GetValue(config, 'to', 1); - var tiles = GetTilesWithin(0, 0, layer.width, layer.height, null, layer); - var sprites = []; - var i; + var targets = [ { value: from } ]; - for (i = 0; i < tiles.length; i++) - { - var tile = tiles[i]; + var delay = GetValue(config, 'delay', defaults.delay); + var easeParams = GetValue(config, 'easeParams', defaults.easeParams); + var ease = GetValue(config, 'ease', defaults.ease); - if (indexes.indexOf(tile.index) !== -1) - { - var point = tilemapLayer.tileToWorldXY(tile.x, tile.y, undefined, camera,layer); + var ops = GetValueOp('value', to); - spriteConfig.x = point.x; - spriteConfig.y = point.y; + var tween = new Tween(parent, targets); - sprites.push(scene.make.sprite(spriteConfig)); - } - } + var tweenData = tween.add( + 0, + 'value', + ops.getEnd, + ops.getStart, + ops.getActive, + GetEaseFunction(GetValue(config, 'ease', ease), GetValue(config, 'easeParams', easeParams)), + GetNewValue(config, 'delay', delay), + GetValue(config, 'duration', defaults.duration), + GetBoolean(config, 'yoyo', defaults.yoyo), + GetValue(config, 'hold', defaults.hold), + GetValue(config, 'repeat', defaults.repeat), + GetValue(config, 'repeatDelay', defaults.repeatDelay), + false, + false + ); - if (typeof replacements === 'number') - { - // Assume 1 replacement for all types of tile given - for (i = 0; i < indexes.length; i++) - { - ReplaceByIndex(indexes[i], replacements, 0, 0, layer.width, layer.height, layer); - } - } - else if (Array.isArray(replacements)) + tweenData.start = from; + tweenData.current = from; + + tween.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); + tween.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); + tween.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); + tween.paused = GetBoolean(config, 'paused', false); + tween.persist = GetBoolean(config, 'persist', false); + + // Set the Callbacks + tween.callbackScope = GetValue(config, 'callbackScope', tween); + + var callbacks = BaseTween.TYPES; + + for (var i = 0; i < callbacks.length; i++) { - // Assume 1 to 1 mapping with indexes array - for (i = 0; i < indexes.length; i++) + var type = callbacks[i]; + + var callback = GetValue(config, type, false); + + if (callback) { - ReplaceByIndex(indexes[i], replacements[i], 0, 0, layer.width, layer.height, layer); + var callbackParams = GetValue(config, type + 'Params', []); + + tween.setCallback(type, callback, callbackParams); } } - return sprites; + return tween; }; -module.exports = CreateFromTiles; +module.exports = NumberTweenBuilder; /***/ }), -/* 1422 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 91944: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(26); -var CalculateFacesWithin = __webpack_require__(63); -var SetTileCollision = __webpack_require__(72); +var GetEaseFunction = __webpack_require__(21902); +var GetValue = __webpack_require__(10850); +var MATH_CONST = __webpack_require__(83392); /** - * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the - * specified index. Tiles will be set to collide if the given index is a colliding index. - * Collision information in the region will be recalculated. + * Creates a Stagger function to be used by a Tween property. * - * @function Phaser.Tilemaps.Components.Fill - * @since 3.0.0 + * The stagger function will allow you to stagger changes to the value of the property across all targets of the tween. * - * @param {number} index - The tile index to fill the area with. - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} layer - The tile layer to use. If not given the current layer is used. + * This is only worth using if the tween has multiple targets. + * + * The following will stagger the delay by 100ms across all targets of the tween, causing them to scale down to 0.2 + * over the duration specified: + * + * ```javascript + * this.tweens.add({ + * targets: [ ... ], + * scale: 0.2, + * ease: 'linear', + * duration: 1000, + * delay: this.tweens.stagger(100) + * }); + * ``` + * + * The following will stagger the delay by 500ms across all targets of the tween using a 10 x 6 grid, staggering + * from the center out, using a cubic ease. + * + * ```javascript + * this.tweens.add({ + * targets: [ ... ], + * scale: 0.2, + * ease: 'linear', + * duration: 1000, + * delay: this.tweens.stagger(500, { grid: [ 10, 6 ], from: 'center', ease: 'cubic.out' }) + * }); + * ``` + * + * @function Phaser.Tweens.Builders.StaggerBuilder + * @since 3.19.0 + * + * @param {(number|number[])} value - The amount to stagger by, or an array containing two elements representing the min and max values to stagger between. + * @param {Phaser.Types.Tweens.StaggerConfig} [config] - A Stagger Configuration object. + * + * @return {function} The stagger function. */ -var Fill = function (index, tileX, tileY, width, height, recalculateFaces, layer) +var StaggerBuilder = function (value, options) { - var doesIndexCollide = (layer.collideIndexes.indexOf(index) !== -1); + if (options === undefined) { options = {}; } - var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + var result; - for (var i = 0; i < tiles.length; i++) + var start = GetValue(options, 'start', 0); + var ease = GetValue(options, 'ease', null); + var grid = GetValue(options, 'grid', null); + + var from = GetValue(options, 'from', 0); + + var fromFirst = (from === 'first'); + var fromCenter = (from === 'center'); + var fromLast = (from === 'last'); + var fromValue = (typeof(from) === 'number'); + + var isRange = (Array.isArray(value)); + var value1 = (isRange) ? parseFloat(value[0]) : parseFloat(value); + var value2 = (isRange) ? parseFloat(value[1]) : 0; + var maxValue = Math.max(value1, value2); + + if (isRange) { - tiles[i].index = index; + start += value1; + } + + if (grid) + { + // Pre-calc the grid to save doing it for every TweenData update + var gridWidth = grid[0]; + var gridHeight = grid[1]; + + var fromX = 0; + var fromY = 0; + + var distanceX = 0; + var distanceY = 0; + + var gridValues = []; + + if (fromLast) + { + fromX = gridWidth - 1; + fromY = gridHeight - 1; + } + else if (fromValue) + { + fromX = from % gridWidth; + fromY = Math.floor(from / gridWidth); + } + else if (fromCenter) + { + fromX = (gridWidth - 1) / 2; + fromY = (gridHeight - 1) / 2; + } + + var gridMax = MATH_CONST.MIN_SAFE_INTEGER; + + for (var toY = 0; toY < gridHeight; toY++) + { + gridValues[toY] = []; + + for (var toX = 0; toX < gridWidth; toX++) + { + distanceX = fromX - toX; + distanceY = fromY - toY; + + var dist = Math.sqrt(distanceX * distanceX + distanceY * distanceY); + + if (dist > gridMax) + { + gridMax = dist; + } + + gridValues[toY][toX] = dist; + } + } + } + + var easeFunction = (ease) ? GetEaseFunction(ease) : null; + + if (grid) + { + result = function (target, key, value, index) + { + var gridSpace = 0; + var toX = index % gridWidth; + var toY = Math.floor(index / gridWidth); + + if (toX >= 0 && toX < gridWidth && toY >= 0 && toY < gridHeight) + { + gridSpace = gridValues[toY][toX]; + } + + var output; + + if (isRange) + { + var diff = (value2 - value1); + + if (easeFunction) + { + output = ((gridSpace / gridMax) * diff) * easeFunction(gridSpace / gridMax); + } + else + { + output = (gridSpace / gridMax) * diff; + } + } + else if (easeFunction) + { + output = (gridSpace * value1) * easeFunction(gridSpace / gridMax); + } + else + { + output = gridSpace * value1; + } + + return output + start; + }; + } + else + { + result = function (target, key, value, index, total) + { + // zero offset + total--; + + var fromIndex; + + if (fromFirst) + { + fromIndex = index; + } + else if (fromCenter) + { + fromIndex = Math.abs((total / 2) - index); + } + else if (fromLast) + { + fromIndex = total - index; + } + else if (fromValue) + { + fromIndex = Math.abs(from - index); + } + + var output; + + if (isRange) + { + var spacing; + + if (fromCenter) + { + spacing = ((value2 - value1) / total) * (fromIndex * 2); + } + else + { + spacing = ((value2 - value1) / total) * fromIndex; + } + + if (easeFunction) + { + output = spacing * easeFunction(fromIndex / total); + } + else + { + output = spacing; + } + } + else if (easeFunction) + { + output = (total * maxValue) * easeFunction(fromIndex / total); + } + else + { + output = fromIndex * value1; + } - SetTileCollision(tiles[i], doesIndexCollide); + return output + start; + }; } - if (recalculateFaces) - { - // Recalculate the faces within the area and neighboring tiles - CalculateFacesWithin(tileX - 1, tileY - 1, width + 2, height + 2, layer); - } + return result; }; -module.exports = Fill; +module.exports = StaggerBuilder; /***/ }), -/* 1423 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 68061: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(26); +var BaseTween = __webpack_require__(502); +var Defaults = __webpack_require__(99730); +var GetAdvancedValue = __webpack_require__(20494); +var GetBoolean = __webpack_require__(63130); +var GetEaseFunction = __webpack_require__(21902); +var GetInterpolationFunction = __webpack_require__(4840); +var GetNewValue = __webpack_require__(28348); +var GetProps = __webpack_require__(92407); +var GetTargets = __webpack_require__(65868); +var GetValue = __webpack_require__(10850); +var GetValueOp = __webpack_require__(9744); +var MergeRight = __webpack_require__(72066); +var Tween = __webpack_require__(39366); /** - * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given - * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns - * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS. + * Creates a new Tween. * - * @function Phaser.Tilemaps.Components.FilterTiles + * @function Phaser.Tweens.Builders.TweenBuilder * @since 3.0.0 * - * @param {function} callback - The callback. Each tile in the given area will be passed to this - * callback as the first and only parameter. The callback should return true for tiles that pass the - * filter. - * @param {object} context - The context under which the callback should be run. - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Tweens.TweenManager} parent - The owner of the new Tween. + * @param {Phaser.Types.Tweens.TweenBuilderConfig|object} config - Configuration for the new Tween. + * @param {Phaser.Types.Tweens.TweenConfigDefaults} defaults - Tween configuration defaults. * - * @return {Phaser.Tilemaps.Tile[]} The filtered array of Tiles. + * @return {Phaser.Tweens.Tween} The new tween. */ -var FilterTiles = function (callback, context, tileX, tileY, width, height, filteringOptions, layer) +var TweenBuilder = function (parent, config, defaults) { - var tiles = GetTilesWithin(tileX, tileY, width, height, filteringOptions, layer); + if (config instanceof Tween) + { + config.parent = parent; - return tiles.filter(callback, context); -}; + return config; + } -module.exports = FilterTiles; + if (defaults === undefined) + { + defaults = Defaults; + } + else + { + defaults = MergeRight(Defaults, defaults); + } + // Create arrays of the Targets and the Properties + var targets = GetTargets(config); -/***/ }), -/* 1424 */ -/***/ (function(module, exports) { + if (!targets && defaults.targets) + { + targets = defaults.targets; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var props = GetProps(config); -/** - * Searches the entire map layer for the first tile matching the given index, then returns that Tile - * object. If no match is found, it returns null. The search starts from the top-left tile and - * continues horizontally until it hits the end of the row, then it drops down to the next column. - * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to - * the top-left. - * - * @function Phaser.Tilemaps.Components.FindByIndex - * @since 3.0.0 - * - * @param {number} index - The tile index value to search for. - * @param {number} skip - The number of times to skip a matching tile before returning. - * @param {boolean} reverse - If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {?Phaser.Tilemaps.Tile} The first (or n skipped) tile with the matching index. - */ -var FindByIndex = function (findIndex, skip, reverse, layer) -{ - if (skip === undefined) { skip = 0; } - if (reverse === undefined) { reverse = false; } + // Default Tween values - var count = 0; - var tx; - var ty; - var tile; + var delay = GetValue(config, 'delay', defaults.delay); + var duration = GetValue(config, 'duration', defaults.duration); + var easeParams = GetValue(config, 'easeParams', defaults.easeParams); + var ease = GetValue(config, 'ease', defaults.ease); + var hold = GetValue(config, 'hold', defaults.hold); + var repeat = GetValue(config, 'repeat', defaults.repeat); + var repeatDelay = GetValue(config, 'repeatDelay', defaults.repeatDelay); + var yoyo = GetBoolean(config, 'yoyo', defaults.yoyo); + var flipX = GetBoolean(config, 'flipX', defaults.flipX); + var flipY = GetBoolean(config, 'flipY', defaults.flipY); + var interpolation = GetValue(config, 'interpolation', defaults.interpolation); - if (reverse) + var addTarget = function (tween, targetIndex, key, value) { - for (ty = layer.height - 1; ty >= 0; ty--) + if (key === 'texture') { - for (tx = layer.width - 1; tx >= 0; tx--) + var texture = value; + var frame = undefined; + + if (Array.isArray(value)) { - tile = layer.data[ty][tx]; - if (tile && tile.index === findIndex) + texture = value[0]; + frame = value[1]; + } + else if (value.hasOwnProperty('value')) + { + texture = value.value; + + if (Array.isArray(value.value)) { - if (count === skip) - { - return tile; - } - else - { - count += 1; - } + texture = value.value[0]; + frame = value.value[1]; } + else if (typeof value.value === 'string') + { + texture = value.value; + } + } + else if (typeof value === 'string') + { + texture = value; } + + tween.addFrame( + targetIndex, + texture, + frame, + GetNewValue(value, 'delay', delay), + GetValue(value, 'duration', duration), + GetValue(value, 'hold', hold), + GetValue(value, 'repeat', repeat), + GetValue(value, 'repeatDelay', repeatDelay), + GetBoolean(value, 'flipX', flipX), + GetBoolean(value, 'flipY', flipY) + ); } - } - else + else + { + var ops = GetValueOp(key, value); + + var interpolationFunc = GetInterpolationFunction(GetValue(value, 'interpolation', interpolation)); + + tween.add( + targetIndex, + key, + ops.getEnd, + ops.getStart, + ops.getActive, + GetEaseFunction(GetValue(value, 'ease', ease), GetValue(value, 'easeParams', easeParams)), + GetNewValue(value, 'delay', delay), + GetValue(value, 'duration', duration), + GetBoolean(value, 'yoyo', yoyo), + GetValue(value, 'hold', hold), + GetValue(value, 'repeat', repeat), + GetValue(value, 'repeatDelay', repeatDelay), + GetBoolean(value, 'flipX', flipX), + GetBoolean(value, 'flipY', flipY), + interpolationFunc, + (interpolationFunc) ? value : null + ); + } + }; + + var tween = new Tween(parent, targets); + + // Loop through every property defined in the Tween, i.e.: props { x, y, alpha } + for (var p = 0; p < props.length; p++) { - for (ty = 0; ty < layer.height; ty++) + var key = props[p].key; + var value = props[p].value; + + // Create 1 TweenData per target, per property + for (var targetIndex = 0; targetIndex < targets.length; targetIndex++) { - for (tx = 0; tx < layer.width; tx++) + // Special-case for scale short-cut: + if (key === 'scale' && !targets[targetIndex].hasOwnProperty('scale')) { - tile = layer.data[ty][tx]; - if (tile && tile.index === findIndex) - { - if (count === skip) - { - return tile; - } - else - { - count += 1; - } - } + addTarget(tween, targetIndex, 'scaleX', value); + addTarget(tween, targetIndex, 'scaleY', value); + } + else + { + addTarget(tween, targetIndex, key, value); } } } - return null; + tween.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); + tween.loop = Math.round(GetAdvancedValue(config, 'loop', 0)); + tween.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0)); + tween.paused = GetBoolean(config, 'paused', false); + tween.persist = GetBoolean(config, 'persist', false); + + // Set the Callbacks + tween.callbackScope = GetValue(config, 'callbackScope', tween); + + var callbacks = BaseTween.TYPES; + + for (var i = 0; i < callbacks.length; i++) + { + var type = callbacks[i]; + + var callback = GetValue(config, type, false); + + if (callback) + { + var callbackParams = GetValue(config, type + 'Params', []); + + tween.setCallback(type, callback, callbackParams); + } + } + + return tween; }; -module.exports = FindByIndex; +module.exports = TweenBuilder; /***/ }), -/* 1425 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 56034: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(26); - -/** - * @callback FindTileCallback - * - * @param {Phaser.Tilemaps.Tile} value - The Tile. - * @param {number} index - The index of the tile. - * @param {Phaser.Tilemaps.Tile[]} array - An array of Tile objects. - * - * @return {boolean} Return `true` if the callback should run, otherwise `false`. - */ +var BaseTween = __webpack_require__(502); +var GetAdvancedValue = __webpack_require__(20494); +var GetBoolean = __webpack_require__(63130); +var GetTargets = __webpack_require__(65868); +var GetValue = __webpack_require__(10850); +var TweenBuilder = __webpack_require__(68061); +var TweenChain = __webpack_require__(45641); /** - * Find the first tile in the given rectangular area (in tile coordinates) of the layer that - * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns - * true. Similar to Array.prototype.find in vanilla JS. + * Creates a new Tween Chain instance. * - * @function Phaser.Tilemaps.Components.FindTile - * @since 3.0.0 + * @function Phaser.Tweens.Builders.TweenChainBuilder + * @since 3.60.0 * - * @param {FindTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. - * @param {object} context - The context under which the callback should be run. - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @param {Phaser.Tweens.TweenManager} parent - The owner of the new Tween. + * @param {Phaser.Types.Tweens.TweenChainBuilderConfig|object} config - Configuration for the new Tween. * - * @return {?Phaser.Tilemaps.Tile} A Tile that matches the search, or null if no Tile found + * @return {Phaser.Tweens.TweenChain} The new Tween Chain. */ -var FindTile = function (callback, context, tileX, tileY, width, height, filteringOptions, layer) +var TweenChainBuilder = function (parent, config) { - var tiles = GetTilesWithin(tileX, tileY, width, height, filteringOptions, layer); + if (config instanceof TweenChain) + { + config.parent = parent; - return tiles.find(callback, context) || null; + return config; + } + + // Default TweenChain values + + var chain = new TweenChain(parent); + + chain.startDelay = GetValue(config, 'delay', 0); + chain.completeDelay = GetAdvancedValue(config, 'completeDelay', 0); + chain.loop = Math.round(GetAdvancedValue(config, 'loop', GetValue(config, 'repeat', 0))); + chain.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', GetValue(config, 'repeatDelay', 0))); + chain.paused = GetBoolean(config, 'paused', false); + chain.persist = GetBoolean(config, 'persist', true); + + // Set the Callbacks + chain.callbackScope = GetValue(config, 'callbackScope', chain); + + var i; + var callbacks = BaseTween.TYPES; + + for (i = 0; i < callbacks.length; i++) + { + var type = callbacks[i]; + + var callback = GetValue(config, type, false); + + if (callback) + { + var callbackParams = GetValue(config, type + 'Params', []); + + chain.setCallback(type, callback, callbackParams); + } + } + + // Add in the Tweens + var tweens = GetValue(config, 'tweens', null); + + if (Array.isArray(tweens)) + { + var chainedTweens = []; + + var targets = GetTargets(config); + var defaults = undefined; + + if (targets) + { + defaults = { targets: targets }; + } + + for (i = 0; i < tweens.length; i++) + { + chainedTweens.push(TweenBuilder(chain, tweens[i], defaults)); + } + + chain.add(chainedTweens); + } + + return chain; }; -module.exports = FindTile; +module.exports = TweenChainBuilder; /***/ }), -/* 1426 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 79619: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(26); - /** - * @callback EachTileCallback - * - * @param {Phaser.Tilemaps.Tile} value - The Tile. - * @param {number} index - The index of the tile. - * @param {Phaser.Tilemaps.Tile[]} array - An array of Tile objects. + * @namespace Phaser.Tweens.Builders */ -/** - * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given - * callback. Similar to Array.prototype.forEach in vanilla JS. - * - * @function Phaser.Tilemaps.Components.ForEachTile - * @since 3.0.0 - * - * @param {EachTileCallback} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter. - * @param {object} context - The context under which the callback should be run. - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area to filter. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var ForEachTile = function (callback, context, tileX, tileY, width, height, filteringOptions, layer) -{ - var tiles = GetTilesWithin(tileX, tileY, width, height, filteringOptions, layer); +module.exports = { - tiles.forEach(callback, context); -}; + GetBoolean: __webpack_require__(63130), + GetEaseFunction: __webpack_require__(21902), + GetInterpolationFunction: __webpack_require__(4840), + GetNewValue: __webpack_require__(28348), + GetProps: __webpack_require__(92407), + GetTargets: __webpack_require__(65868), + GetValueOp: __webpack_require__(9744), + NumberTweenBuilder: __webpack_require__(68710), + StaggerBuilder: __webpack_require__(91944), + TweenBuilder: __webpack_require__(68061) -module.exports = ForEachTile; +}; /***/ }), -/* 1427 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 5570: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(29); -var CullTiles = __webpack_require__(544); -var HexagonalCullTiles = __webpack_require__(545); -var IsometricCullTiles = __webpack_require__(547); -var NOOP = __webpack_require__(1); -var StaggeredCullTiles = __webpack_require__(548); - /** - * Gets the correct function to use to cull tiles, based on the map orientation. + * The Tween Active Event. * - * @function Phaser.Tilemaps.Components.GetCullTilesFunction - * @since 3.50.0 + * This event is dispatched by a Tween when it becomes active within the Tween Manager. * - * @param {number} orientation - The Tilemap orientation constant. + * An 'active' Tween is one that is now progressing, although it may not yet be updating + * any target properties, due to settings such as `delay`. If you need an event for when + * the Tween starts actually updating its first property, see `TWEEN_START`. * - * @return {function} The function to use to cull tiles for the given map type. + * Listen to it from a Tween instance using `Tween.on('active', listener)`, i.e.: + * + * ```javascript + * var tween = this.tweens.create({ + * targets: image, + * x: 500, + * ease: 'Power1', + * duration: 3000 + * }); + * tween.on('active', listener); + * this.tweens.existing(tween); + * ``` + * + * Note that this event is usually dispatched already by the time you call `this.tweens.add()`, and is + * meant for use with `tweens.create()` and/or `tweens.existing()`. + * + * @event Phaser.Tweens.Events#TWEEN_ACTIVE + * @type {string} + * @since 3.19.0 + * + * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. + * @param {(any|any[])} targets - The targets of the Tween. If this Tween has multiple targets this will be an array of the targets. */ -var GetCullTilesFunction = function (orientation) -{ - if (orientation === CONST.ORTHOGONAL) - { - return CullTiles; - } - else if (orientation === CONST.HEXAGONAL) - { - return HexagonalCullTiles; - } - else if (orientation === CONST.STAGGERED) - { - return StaggeredCullTiles; - } - else if (orientation === CONST.ISOMETRIC) - { - return IsometricCullTiles; - } - else - { - return NOOP; - } -}; - -module.exports = GetCullTilesFunction; +module.exports = 'active'; /***/ }), -/* 1428 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 6383: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTileAt = __webpack_require__(158); -var Vector2 = __webpack_require__(3); - -var point = new Vector2(); - /** - * Gets a tile at the given world coordinates from the given layer. + * The Tween Complete Event. * - * @function Phaser.Tilemaps.Components.GetTileAtWorldXY - * @since 3.0.0 + * This event is dispatched by a Tween when it completes playback entirely, factoring in repeats and loops. * - * @param {number} worldX - X position to get the tile from (given in pixels) - * @param {number} worldY - Y position to get the tile from (given in pixels) - * @param {boolean} nonNull - If true, function won't return null for empty tiles, but a Tile object with an index of -1. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * If the Tween has been set to loop or repeat infinitely, this event will not be dispatched + * unless the `Tween.stop` method is called. * - * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates were invalid. + * If a Tween has a `completeDelay` set, this event will fire after that delay expires. + * + * Listen to it from a Tween instance using `Tween.on('complete', listener)`, i.e.: + * + * ```javascript + * var tween = this.tweens.add({ + * targets: image, + * x: 500, + * ease: 'Power1', + * duration: 3000 + * }); + * tween.on('complete', listener); + * ``` + * + * @event Phaser.Tweens.Events#TWEEN_COMPLETE + * @type {string} + * @since 3.19.0 + * + * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. + * @param {(any|any[])} targets - The targets of the Tween. If this Tween has multiple targets this will be an array of the targets. */ -var GetTileAtWorldXY = function (worldX, worldY, nonNull, camera, layer) -{ - layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera); - - return GetTileAt(point.x, point.y, nonNull, layer); -}; - -module.exports = GetTileAtWorldXY; +module.exports = 'complete'; /***/ }), -/* 1429 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 72582: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Geom = __webpack_require__(483); -var GetTilesWithin = __webpack_require__(26); -var Intersects = __webpack_require__(484); -var NOOP = __webpack_require__(1); -var Vector2 = __webpack_require__(3); - -var TriangleToRectangle = function (triangle, rect) -{ - return Intersects.RectangleToTriangle(rect, triangle); -}; - -var point = new Vector2(); -var pointStart = new Vector2(); -var pointEnd = new Vector2(); - /** - * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle, - * Line, Rectangle or Triangle. The shape should be in world coordinates. + * The Tween Loop Event. * - * @function Phaser.Tilemaps.Components.GetTilesWithinShape - * @since 3.0.0 + * This event is dispatched by a Tween when it loops. * - * @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates - * @param {Phaser.Types.Tilemaps.FilteringOptions} filteringOptions - Optional filters to apply when getting the tiles. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * This event will only be dispatched if the Tween has a loop count set. * - * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects. + * If a Tween has a `loopDelay` set, this event will fire after that delay expires. + * + * The difference between `loop` and `repeat` is that `repeat` is a property setting, + * where-as `loop` applies to the entire Tween. + * + * Listen to it from a Tween instance using `Tween.on('loop', listener)`, i.e.: + * + * ```javascript + * var tween = this.tweens.add({ + * targets: image, + * x: 500, + * ease: 'Power1', + * duration: 3000, + * loop: 6 + * }); + * tween.on('loop', listener); + * ``` + * + * @event Phaser.Tweens.Events#TWEEN_LOOP + * @type {string} + * @since 3.19.0 + * + * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. + * @param {(any|any[])} targets - The targets of the Tween. If this Tween has multiple targets this will be an array of the targets. */ -var GetTilesWithinShape = function (shape, filteringOptions, camera, layer) -{ - if (shape === undefined) { return []; } - - // intersectTest is a function with parameters: shape, rect - var intersectTest = NOOP; - - if (shape instanceof Geom.Circle) - { - intersectTest = Intersects.CircleToRectangle; - } - else if (shape instanceof Geom.Rectangle) - { - intersectTest = Intersects.RectangleToRectangle; - } - else if (shape instanceof Geom.Triangle) - { - intersectTest = TriangleToRectangle; - } - else if (shape instanceof Geom.Line) - { - intersectTest = Intersects.LineToRectangle; - } - - // Top left corner of the shapes's bounding box, rounded down to include partial tiles - layer.tilemapLayer.worldToTileXY(shape.left, shape.top, true, pointStart, camera); - - var xStart = pointStart.x; - var yStart = pointStart.y; - - // Bottom right corner of the shapes's bounding box, rounded up to include partial tiles - layer.tilemapLayer.worldToTileXY(shape.right, shape.bottom, true, pointEnd, camera); - - var xEnd = Math.ceil(pointEnd.x); - var yEnd = Math.ceil(pointEnd.y); - - // Tiles within bounding rectangle of shape. Bounds are forced to be at least 1 x 1 tile in size - // to grab tiles for shapes that don't have a height or width (e.g. a horizontal line). - var width = Math.max(xEnd - xStart, 1); - var height = Math.max(yEnd - yStart, 1); - - var tiles = GetTilesWithin(xStart, yStart, width, height, filteringOptions, layer); - - var tileWidth = layer.tileWidth; - var tileHeight = layer.tileHeight; - - if (layer.tilemapLayer) - { - tileWidth *= layer.tilemapLayer.scaleX; - tileHeight *= layer.tilemapLayer.scaleY; - } - - var results = []; - var tileRect = new Geom.Rectangle(0, 0, tileWidth, tileHeight); - - for (var i = 0; i < tiles.length; i++) - { - var tile = tiles[i]; - - layer.tilemapLayer.tileToWorldXY(tile.x, tile.y, point, camera); - - tileRect.x = point.x; - tileRect.y = point.y; - - if (intersectTest(shape, tileRect)) - { - results.push(tile); - } - } - - return results; -}; - -module.exports = GetTilesWithinShape; +module.exports = 'loop'; /***/ }), -/* 1430 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 90281: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(29); -var NOOP = __webpack_require__(1); -var TileToWorldX = __webpack_require__(253); - /** - * Gets the correct function to use to translate tiles, based on the map orientation. + * The Tween Pause Event. * - * @function Phaser.Tilemaps.Components.GetTileToWorldXFunction - * @since 3.50.0 + * This event is dispatched by a Tween when it is paused. * - * @param {number} orientation - The Tilemap orientation constant. + * Listen to it from a Tween instance using `Tween.on('pause', listener)`, i.e.: * - * @return {function} The function to use to translate tiles for the given map type. + * ```javascript + * var tween = this.tweens.add({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * x: 600 + * }); + * tween.on('pause', listener); + * // At some point later ... + * tween.pause(); + * ``` + * + * @event Phaser.Tweens.Events#TWEEN_PAUSE + * @type {string} + * @since 3.60.0 + * + * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. */ -var GetTileToWorldXFunction = function (orientation) -{ - if (orientation === CONST.ORTHOGONAL) - { - return TileToWorldX; - } - else - { - return NOOP; - } -}; - -module.exports = GetTileToWorldXFunction; +module.exports = 'pause'; /***/ }), -/* 1431 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 80803: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(29); -var HexagonalTileToWorldXY = __webpack_require__(550); -var IsometricTileToWorldXY = __webpack_require__(551); -var NOOP = __webpack_require__(1); -var StaggeredTileToWorldXY = __webpack_require__(552); -var TileToWorldXY = __webpack_require__(553); - /** - * Gets the correct function to use to translate tiles, based on the map orientation. + * The Tween Repeat Event. * - * @function Phaser.Tilemaps.Components.GetTileToWorldXYFunction - * @since 3.50.0 + * This event is dispatched by a Tween when one of the properties it is tweening repeats. * - * @param {number} orientation - The Tilemap orientation constant. + * This event will only be dispatched if the Tween has a property with a repeat count set. * - * @return {function} The function to use to translate tiles for the given map type. + * If a Tween has a `repeatDelay` set, this event will fire after that delay expires. + * + * The difference between `loop` and `repeat` is that `repeat` is a property setting, + * where-as `loop` applies to the entire Tween. + * + * Listen to it from a Tween instance using `Tween.on('repeat', listener)`, i.e.: + * + * ```javascript + * var tween = this.tweens.add({ + * targets: image, + * x: 500, + * ease: 'Power1', + * duration: 3000, + * repeat: 4 + * }); + * tween.on('repeat', listener); + * ``` + * + * @event Phaser.Tweens.Events#TWEEN_REPEAT + * @type {string} + * @since 3.19.0 + * + * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. + * @param {string} key - The property on the target that has just repeated, i.e. `x` or `scaleY`, or whatever property you are tweening. + * @param {any} target - The target object that was repeated. Usually a Game Object, but can be of any type. + * @param {number} current - The current value of the property being set on the target. + * @param {number} previous - The previous value of the property being set on the target. */ -var GetTileToWorldXYFunction = function (orientation) -{ - if (orientation === CONST.ORTHOGONAL) - { - return TileToWorldXY; - } - else if (orientation === CONST.ISOMETRIC) - { - return IsometricTileToWorldXY; - } - else if (orientation === CONST.HEXAGONAL) - { - return HexagonalTileToWorldXY; - } - else if (orientation === CONST.STAGGERED) - { - return StaggeredTileToWorldXY; - } - else - { - return NOOP; - } -}; - -module.exports = GetTileToWorldXYFunction; +module.exports = 'repeat'; /***/ }), -/* 1432 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 13640: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(29); -var HexagonalTileToWorldY = __webpack_require__(554); -var NOOP = __webpack_require__(1); -var StaggeredTileToWorldY = __webpack_require__(555); -var TileToWorldY = __webpack_require__(254); - /** - * Gets the correct function to use to translate tiles, based on the map orientation. + * The Tween Resume Event. * - * @function Phaser.Tilemaps.Components.GetTileToWorldYFunction - * @since 3.50.0 + * This event is dispatched by a Tween when it is resumed from a paused state. * - * @param {number} orientation - The Tilemap orientation constant. + * Listen to it from a Tween instance using `Tween.on('resume', listener)`, i.e.: * - * @return {function} The function to use to translate tiles for the given map type. + * ```javascript + * var tween = this.tweens.add({ + * targets: image, + * ease: 'Power1', + * duration: 3000, + * x: 600 + * }); + * tween.on('resume', listener); + * // At some point later ... + * tween.resume(); + * ``` + * + * @event Phaser.Tweens.Events#TWEEN_RESUME + * @type {string} + * @since 3.60.0 + * + * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. */ -var GetTileToWorldYFunction = function (orientation) -{ - if (orientation === CONST.ORTHOGONAL) - { - return TileToWorldY; - } - else if (orientation === CONST.HEXAGONAL) - { - return HexagonalTileToWorldY; - } - else if (orientation === CONST.STAGGERED) - { - return StaggeredTileToWorldY; - } - else - { - return NOOP; - } -}; - -module.exports = GetTileToWorldYFunction; +module.exports = 'resume'; /***/ }), -/* 1433 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 10472: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(29); -var NOOP = __webpack_require__(1); -var WorldToTileX = __webpack_require__(255); - /** - * Gets the correct function to use to translate tiles, based on the map orientation. + * The Tween Start Event. * - * @function Phaser.Tilemaps.Components.GetWorldToTileXFunction - * @since 3.50.0 + * This event is dispatched by a Tween when it starts tweening its first property. * - * @param {number} orientation - The Tilemap orientation constant. + * A Tween will only emit this event once, as it can only start once. * - * @return {function} The function to use to translate tiles for the given map type. + * If a Tween has a `delay` set, this event will fire after that delay expires. + * + * Listen to it from a Tween instance using `Tween.on('start', listener)`, i.e.: + * + * ```javascript + * var tween = this.tweens.add({ + * targets: image, + * x: 500, + * ease: 'Power1', + * duration: 3000 + * }); + * tween.on('start', listener); + * ``` + * + * @event Phaser.Tweens.Events#TWEEN_START + * @type {string} + * @since 3.19.0 + * + * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. + * @param {(any|any[])} targets - The targets of the Tween. If this Tween has multiple targets this will be an array of the targets. */ -var GetWorldToTileXFunction = function (orientation) -{ - if (orientation === CONST.ORTHOGONAL) - { - return WorldToTileX; - } - else - { - return NOOP; - } -}; - -module.exports = GetWorldToTileXFunction; +module.exports = 'start'; /***/ }), -/* 1434 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 5379: +/***/ ((module) => { /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author samme + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(29); -var HexagonalWorldToTileXY = __webpack_require__(556); -var IsometricWorldToTileXY = __webpack_require__(557); -var NOOP = __webpack_require__(1); -var StaggeredWorldToTileXY = __webpack_require__(558); -var WorldToTileXY = __webpack_require__(559); - /** - * Gets the correct function to use to translate tiles, based on the map orientation. + * The Tween Stop Event. * - * @function Phaser.Tilemaps.Components.GetWorldToTileXYFunction - * @since 3.50.0 + * This event is dispatched by a Tween when it is stopped. * - * @param {number} orientation - The Tilemap orientation constant. + * Listen to it from a Tween instance using `Tween.on('stop', listener)`, i.e.: * - * @return {function} The function to use to translate tiles for the given map type. + * ```javascript + * var tween = this.tweens.add({ + * targets: image, + * x: 500, + * ease: 'Power1', + * duration: 3000 + * }); + * tween.on('stop', listener); + * ``` + * + * @event Phaser.Tweens.Events#TWEEN_STOP + * @type {string} + * @since 3.24.0 + * + * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. + * @param {(any|any[])} targets - The targets of the Tween. If this Tween has multiple targets this will be an array of the targets. */ -var GetWorldToTileXYFunction = function (orientation) -{ - if (orientation === CONST.ORTHOGONAL) - { - return WorldToTileXY; - } - else if (orientation === CONST.ISOMETRIC) - { - return IsometricWorldToTileXY; - } - else if (orientation === CONST.HEXAGONAL) - { - return HexagonalWorldToTileXY; - } - else if (orientation === CONST.STAGGERED) - { - return StaggeredWorldToTileXY; - } - else - { - return NOOP; - } -}; - -module.exports = GetWorldToTileXYFunction; +module.exports = 'stop'; /***/ }), -/* 1435 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 43449: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(29); -var HexagonalWorldToTileY = __webpack_require__(560); -var NOOP = __webpack_require__(1); -var StaggeredWorldToTileY = __webpack_require__(561); -var WorldToTileY = __webpack_require__(256); - /** - * Gets the correct function to use to translate tiles, based on the map orientation. + * The Tween Update Event. * - * @function Phaser.Tilemaps.Components.GetWorldToTileYFunction - * @since 3.50.0 + * This event is dispatched by a Tween every time it updates _any_ of the properties it is tweening. * - * @param {number} orientation - The Tilemap orientation constant. + * A Tween that is changing 3 properties of a target will emit this event 3 times per change, once per property. * - * @return {function} The function to use to translate tiles for the given map type. + * **Note:** This is a very high frequency event and may be dispatched multiple times, every single frame. + * + * Listen to it from a Tween instance using `Tween.on('update', listener)`, i.e.: + * + * ```javascript + * var tween = this.tweens.add({ + * targets: image, + * x: 500, + * ease: 'Power1', + * duration: 3000, + * }); + * tween.on('update', listener); + * ``` + * + * @event Phaser.Tweens.Events#TWEEN_UPDATE + * @type {string} + * @since 3.19.0 + * + * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. + * @param {string} key - The property on the target that has just updated, i.e. `x` or `scaleY`, or whatever property you are tweening. + * @param {any} target - The target object that was updated. Usually a Game Object, but can be of any type. + * @param {number} current - The current value of the property that was tweened. + * @param {number} previous - The previous value of the property that was tweened, prior to this update. */ -var GetWorldToTileYFunction = function (orientation) -{ - if (orientation === CONST.ORTHOGONAL) - { - return WorldToTileY; - } - else if (orientation === CONST.HEXAGONAL) - { - return HexagonalWorldToTileY; - } - else if (orientation === CONST.STAGGERED) - { - return StaggeredWorldToTileY; - } - else - { - return NOOP; - } -}; - -module.exports = GetWorldToTileYFunction; +module.exports = 'update'; /***/ }), -/* 1436 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 61541: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var HasTileAt = __webpack_require__(562); -var Vector2 = __webpack_require__(3); - -var point = new Vector2(); - /** - * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns - * false if there is no tile or if the tile at that location has an index of -1. + * The Tween Yoyo Event. * - * @function Phaser.Tilemaps.Components.HasTileAtWorldXY - * @since 3.0.0 + * This event is dispatched by a Tween whenever a property it is tweening yoyos. * - * @param {number} worldX - The X coordinate of the world position. - * @param {number} worldY - The Y coordinate of the world position. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when factoring in which tiles to return. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * This event will only be dispatched if the Tween has a property with `yoyo` set. * - * @return {?boolean} Returns a boolean, or null if the layer given was invalid. + * If the Tween has a `hold` value, this event is dispatched when the hold expires. + * + * This event is dispatched for every property, and for every target, that yoyos. + * For example, if a Tween was updating 2 properties and had 10 targets, this event + * would be dispatched 20 times (twice per target). So be careful how you use it! + * + * Listen to it from a Tween instance using `Tween.on('yoyo', listener)`, i.e.: + * + * ```javascript + * var tween = this.tweens.add({ + * targets: image, + * x: 500, + * ease: 'Power1', + * duration: 3000, + * yoyo: true + * }); + * tween.on('yoyo', listener); + * ``` + * + * @event Phaser.Tweens.Events#TWEEN_YOYO + * @type {string} + * @since 3.19.0 + * + * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. + * @param {string} key - The property on the target that has just yoyo'd, i.e. `x` or `scaleY`, or whatever property you are tweening. + * @param {any} target - The target object that was yoyo'd. Usually a Game Object, but can be of any type. + * @param {number} current - The current value of the property being set on the target. + * @param {number} previous - The previous value of the property being set on the target. */ -var HasTileAtWorldXY = function (worldX, worldY, camera, layer) -{ - layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera); - - var tileX = point.x; - var tileY = point.y; - - return HasTileAt(tileX, tileY, layer); -}; - -module.exports = HasTileAtWorldXY; +module.exports = 'yoyo'; /***/ }), -/* 1437 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 54272: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var PutTileAt = __webpack_require__(257); -var Vector2 = __webpack_require__(3); - -var point = new Vector2(); - /** - * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either - * an index or a Tile object. If you pass in a Tile, all attributes will be copied over to the - * specified location. If you pass in an index, only the index at the specified location will be - * changed. Collision information will be recalculated at the specified location. - * - * @function Phaser.Tilemaps.Components.PutTileAtWorldXY - * @since 3.0.0 - * - * @param {(number|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object. - * @param {number} worldX - The x coordinate, in pixels. - * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map. + * @namespace Phaser.Tweens.Events */ -var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer) -{ - layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera, layer); - return PutTileAt(tile, point.x, point.y, recalculateFaces, layer); -}; +module.exports = { -module.exports = PutTileAtWorldXY; + TWEEN_ACTIVE: __webpack_require__(5570), + TWEEN_COMPLETE: __webpack_require__(6383), + TWEEN_LOOP: __webpack_require__(72582), + TWEEN_PAUSE: __webpack_require__(90281), + TWEEN_RESUME: __webpack_require__(13640), + TWEEN_REPEAT: __webpack_require__(80803), + TWEEN_START: __webpack_require__(10472), + TWEEN_STOP: __webpack_require__(5379), + TWEEN_UPDATE: __webpack_require__(43449), + TWEEN_YOYO: __webpack_require__(61541) + +}; /***/ }), -/* 1438 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 75193: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CalculateFacesWithin = __webpack_require__(63); -var PutTileAt = __webpack_require__(257); - /** - * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified - * layer. The array can be composed of either tile indexes or Tile objects. If you pass in a Tile, - * all attributes will be copied over to the specified location. If you pass in an index, only the - * index at the specified location will be changed. Collision information will be recalculated - * within the region tiles were changed. - * - * @function Phaser.Tilemaps.Components.PutTilesAt - * @since 3.0.0 - * - * @param {(number[]|number[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][])} tile - A row (array) or grid (2D array) of Tiles or tile indexes to place. - * @param {number} tileX - The x coordinate, in tiles, not pixels. - * @param {number} tileY - The y coordinate, in tiles, not pixels. - * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @namespace Phaser.Tweens */ -var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer) -{ - if (recalculateFaces === undefined) { recalculateFaces = true; } - - if (!Array.isArray(tilesArray)) - { - return null; - } - // Force the input array to be a 2D array - if (!Array.isArray(tilesArray[0])) - { - tilesArray = [ tilesArray ]; - } +var Tweens = { - var height = tilesArray.length; - var width = tilesArray[0].length; + States: __webpack_require__(55303), - for (var ty = 0; ty < height; ty++) - { - for (var tx = 0; tx < width; tx++) - { - var tile = tilesArray[ty][tx]; + Builders: __webpack_require__(79619), + Events: __webpack_require__(54272), - PutTileAt(tile, tileX + tx, tileY + ty, false, layer); - } - } + TweenManager: __webpack_require__(64532), + Tween: __webpack_require__(39366), + TweenData: __webpack_require__(15718), + TweenFrameData: __webpack_require__(96490), - if (recalculateFaces) - { - // Recalculate the faces within the destination area and neighboring tiles - CalculateFacesWithin(tileX - 1, tileY - 1, width + 2, height + 2, layer); - } + BaseTween: __webpack_require__(502), + TweenChain: __webpack_require__(45641) }; -module.exports = PutTilesAt; +module.exports = Tweens; /***/ }), -/* 1439 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 502: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetTilesWithin = __webpack_require__(26); -var GetRandom = __webpack_require__(210); +var Class = __webpack_require__(56694); +var EventEmitter = __webpack_require__(6659); +var Events = __webpack_require__(54272); +var TWEEN_CONST = __webpack_require__(55303); /** - * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the - * specified layer. Each tile will receive a new index. If an array of indexes is passed in, then - * those will be used for randomly assigning new tile indexes. If an array is not provided, the - * indexes found within the region (excluding -1) will be used for randomly assigning new tile - * indexes. This method only modifies tile indexes and does not change collision information. + * @classdesc + * As the name implies, this is the base Tween class that both the Tween and TweenChain + * inherit from. It contains shared properties and methods common to both types of Tween. * - * @function Phaser.Tilemaps.Components.Randomize - * @since 3.0.0 + * Typically you would never instantiate this class directly, although you could certainly + * use it to create your own variation of Tweens from. * - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {number[]} indexes - An array of indexes to randomly draw from during randomization. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @class BaseTween + * @memberof Phaser.Tweens + * @extends Phaser.Events.EventEmitter + * @constructor + * @since 3.60.0 + * + * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.TweenChain)} parent - A reference to the Tween Manager, or Tween Chain, that owns this Tween. */ -var Randomize = function (tileX, tileY, width, height, indexes, layer) -{ - var i; - var tiles = GetTilesWithin(tileX, tileY, width, height, {}, layer); +var BaseTween = new Class({ - // If no indices are given, then find all the unique indexes within the specified region - if (!indexes) - { - indexes = []; + Extends: EventEmitter, - for (i = 0; i < tiles.length; i++) - { - if (indexes.indexOf(tiles[i].index) === -1) - { - indexes.push(tiles[i].index); - } - } - } + initialize: - for (i = 0; i < tiles.length; i++) + function BaseTween (parent) { - tiles[i].index = GetRandom(indexes); - } -}; + EventEmitter.call(this); -module.exports = Randomize; + /** + * A reference to the Tween Manager, or Tween Chain, that owns this Tween. + * + * @name Phaser.Tweens.BaseTween#parent + * @type {(Phaser.Tweens.TweenManager|Phaser.Tweens.TweenChain)} + * @since 3.60.0 + */ + this.parent = parent; + /** + * The main data array. For a Tween, this contains all of the `TweenData` objects, each + * containing a unique property and target that is being tweened. + * + * For a TweenChain, this contains an array of `Tween` instances, which are being played + * through in sequence. + * + * @name Phaser.Tweens.BaseTween#data + * @type {(Phaser.Tweens.TweenData[]|Phaser.Tweens.Tween[])} + * @since 3.60.0 + */ + this.data = []; -/***/ }), -/* 1440 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The cached size of the data array. + * + * @name Phaser.Tweens.BaseTween#totalData + * @type {number} + * @since 3.60.0 + */ + this.totalData = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The time in milliseconds before the 'onStart' event fires. + * + * For a Tween, this is the shortest `delay` value across all of the TweenDatas it owns. + * For a TweenChain, it is whatever delay value was given in the configuration. + * + * @name Phaser.Tweens.BaseTween#startDelay + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.startDelay = 0; -var RemoveTileAt = __webpack_require__(563); -var Vector2 = __webpack_require__(3); + /** + * Has this Tween started playback yet? + * + * This boolean is toggled when the Tween leaves the 'start delayed' state and begins running. + * + * @name Phaser.Tweens.BaseTween#hasStarted + * @type {boolean} + * @readonly + * @since 3.60.0 + */ + this.hasStarted = false; -var point = new Vector2(); + /** + * Scales the time applied to this Tween. A value of 1 runs in real-time. A value of 0.5 runs 50% slower, and so on. + * + * The value isn't used when calculating total duration of the tween, it's a run-time delta adjustment only. + * + * This value is multiplied by the `TweenManager.timeScale`. + * + * @name Phaser.Tweens.BaseTween#timeScale + * @type {number} + * @default 1 + * @since 3.60.0 + */ + this.timeScale = 1; -/** - * Removes the tile at the given world coordinates in the specified layer and updates the layer's - * collision information. - * - * @function Phaser.Tilemaps.Components.RemoveTileAtWorldXY - * @since 3.0.0 - * - * @param {number} worldX - The x coordinate, in pixels. - * @param {number} worldY - The y coordinate, in pixels. - * @param {boolean} replaceWithNull - If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. - * @param {boolean} recalculateFaces - `true` if the faces data should be recalculated. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use when calculating the tile index from the world values. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * - * @return {Phaser.Tilemaps.Tile} The Tile object that was removed. - */ -var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer) -{ - layer.tilemapLayer.worldToTileXY(worldX, worldY, true, point, camera, layer); + /** + * The number of times this Tween will loop. + * + * Can be -1 for an infinite loop, zero for none, or a positive integer. + * + * Typically this is set in the configuration object, but can also be set directly + * as long as this Tween is paused and hasn't started playback. + * + * When enabled it will play through ALL Tweens again. + * + * Use TweenData.repeat to loop a single element. + * + * @name Phaser.Tweens.BaseTween#loop + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.loop = 0; - return RemoveTileAt(point.x, point.y, replaceWithNull, recalculateFaces, layer); -}; + /** + * The time in milliseconds before the Tween loops. + * + * Only used if `loop` is > 0. + * + * @name Phaser.Tweens.BaseTween#loopDelay + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.loopDelay = 0; -module.exports = RemoveTileAtWorldXY; + /** + * Internal counter recording how many loops are left to run. + * + * @name Phaser.Tweens.BaseTween#loopCounter + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.loopCounter = 0; + /** + * The time in milliseconds before the 'onComplete' event fires. + * + * This never fires if `loop = -1` as it never completes because it has been + * set to loop forever. + * + * @name Phaser.Tweens.BaseTween#completeDelay + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.completeDelay = 0; -/***/ }), -/* 1441 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * An internal countdown timer (used by loopDelay and completeDelay) + * + * @name Phaser.Tweens.BaseTween#countdown + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.countdown = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The current state of the Tween. + * + * @name Phaser.Tweens.BaseTween#state + * @type {Phaser.Tweens.StateType} + * @since 3.60.0 + */ + this.state = TWEEN_CONST.PENDING; -var GetTilesWithin = __webpack_require__(26); -var Color = __webpack_require__(397); + /** + * Is the Tween currently paused? + * + * A paused Tween needs to be started with the `play` method, or resumed with the `resume` method. + * + * This property can be toggled at runtime if required. + * + * @name Phaser.Tweens.BaseTween#paused + * @type {boolean} + * @default false + * @since 3.60.0 + */ + this.paused = false; -var defaultTileColor = new Color(105, 210, 231, 150); -var defaultCollidingTileColor = new Color(243, 134, 48, 200); -var defaultFaceColor = new Color(40, 39, 37, 150); + /** + * An object containing the different Tween callback functions. + * + * You can either set these in the Tween config, or by calling the `Tween.setCallback` method. + * + * The types available are: + * + * `onActive` - When the Tween is first created it moves to an 'active' state when added to the Tween Manager. 'Active' does not mean 'playing'. + * `onStart` - When the Tween starts playing after a delayed or paused state. This will happen at the same time as `onActive` if the tween has no delay and isn't paused. + * `onLoop` - When a Tween loops, if it has been set to do so. This happens _after_ the `loopDelay` expires, if set. + * `onComplete` - When the Tween finishes playback fully. Never invoked if the Tween is set to repeat infinitely. + * `onStop` - Invoked only if the `Tween.stop` method is called. + * `onPause` - Invoked only if the `Tween.pause` method is called. Not invoked if the Tween Manager is paused. + * `onResume` - Invoked only if the `Tween.resume` method is called. Not invoked if the Tween Manager is resumed. + * + * The following types are also available and are invoked on a `TweenData` level - that is per-object, per-property, being tweened. + * + * `onYoyo` - When a TweenData starts a yoyo. This happens _after_ the `hold` delay expires, if set. + * `onRepeat` - When a TweenData repeats playback. This happens _after_ the `repeatDelay` expires, if set. + * `onUpdate` - When a TweenData updates a property on a source target during playback. + * + * @name Phaser.Tweens.BaseTween#callbacks + * @type {Phaser.Types.Tweens.TweenCallbacks} + * @since 3.60.0 + */ + this.callbacks = { + onActive: null, + onComplete: null, + onLoop: null, + onPause: null, + onRepeat: null, + onResume: null, + onStart: null, + onStop: null, + onUpdate: null, + onYoyo: null + }; -/** - * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to - * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles - * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation - * wherever you want on the screen. - * - * @function Phaser.Tilemaps.Components.RenderDebug - * @since 3.0.0 - * - * @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon. - * @param {Phaser.Types.Tilemaps.DebugStyleOptions} styleConfig - An object specifying the colors to use for the debug drawing. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var RenderDebug = function (graphics, styleConfig, layer) -{ - if (styleConfig === undefined) { styleConfig = {}; } + /** + * The scope (or context) in which all of the callbacks are invoked. + * + * This defaults to be this Tween, but you can override this property + * to set it to whatever object you require. + * + * @name Phaser.Tweens.BaseTween#callbackScope + * @type {any} + * @since 3.60.0 + */ + this.callbackScope; - // Default colors without needlessly creating Color objects - var tileColor = (styleConfig.tileColor !== undefined) ? styleConfig.tileColor : defaultTileColor; - var collidingTileColor = (styleConfig.collidingTileColor !== undefined) ? styleConfig.collidingTileColor : defaultCollidingTileColor; - var faceColor = (styleConfig.faceColor !== undefined) ? styleConfig.faceColor : defaultFaceColor; + /** + * Will this Tween persist after playback? A Tween that persists will _not_ be destroyed by the + * Tween Manager, or when calling `Tween.stop`, and can be re-played as required. You can either + * set this property when creating the tween in the tween config, or set it _prior_ to playback. + * + * However, it's up to you to ensure you destroy persistent tweens when you are finished with them, + * or they will retain references you may no longer require and waste memory. + * + * By default, `Tweens` are set to _not_ persist, so they are automatically cleaned-up by + * the Tween Manager. But `TweenChains` _do_ persist by default, unless overridden in their + * config. This is because the type of situations you use a chain for is far more likely to + * need to be replayed again in the future, rather than disposed of. + * + * @name Phaser.Tweens.BaseTween#persist + * @type {boolean} + * @since 3.60.0 + */ + this.persist = false; + }, - var tiles = GetTilesWithin(0, 0, layer.width, layer.height, null, layer); + /** + * Sets the value of the time scale applied to this Tween. A value of 1 runs in real-time. + * A value of 0.5 runs 50% slower, and so on. + * + * The value isn't used when calculating total duration of the tween, it's a run-time delta adjustment only. + * + * This value is multiplied by the `TweenManager.timeScale`. + * + * @method Phaser.Tweens.BaseTween#setTimeScale + * @since 3.60.0 + * + * @param {number} value - The time scale value to set. + * + * @return {this} This Tween instance. + */ + setTimeScale: function (value) + { + this.timeScale = value; - graphics.translateCanvas(layer.tilemapLayer.x, layer.tilemapLayer.y); - graphics.scaleCanvas(layer.tilemapLayer.scaleX, layer.tilemapLayer.scaleY); + return this; + }, - for (var i = 0; i < tiles.length; i++) + /** + * Gets the value of the time scale applied to this Tween. A value of 1 runs in real-time. + * A value of 0.5 runs 50% slower, and so on. + * + * @method Phaser.Tweens.BaseTween#getTimeScale + * @since 3.60.0 + * + * @return {number} The value of the time scale applied to this Tween. + */ + getTimeScale: function () { - var tile = tiles[i]; + return this.timeScale; + }, - var tw = tile.width; - var th = tile.height; - var x = tile.pixelX; - var y = tile.pixelY; + /** + * Checks if this Tween is currently playing. + * + * If this Tween is paused, or not active, this method will return false. + * + * @method Phaser.Tweens.BaseTween#isPlaying + * @since 3.60.0 + * + * @return {boolean} `true` if the Tween is playing, otherwise `false`. + */ + isPlaying: function () + { + return (!this.paused && this.isActive()); + }, - var color = tile.collides ? collidingTileColor : tileColor; + /** + * Checks if the Tween is currently paused. + * + * This is the same as inspecting the `BaseTween.paused` property directly. + * + * @method Phaser.Tweens.BaseTween#isPaused + * @since 3.60.0 + * + * @return {boolean} `true` if the Tween is paused, otherwise `false`. + */ + isPaused: function () + { + return this.paused; + }, - if (color !== null) + /** + * Pauses the Tween immediately. Use `resume` to continue playback. + * + * You can also toggle the `Tween.paused` boolean property, but doing so will not trigger the PAUSE event. + * + * @method Phaser.Tweens.BaseTween#pause + * @fires Phaser.Tweens.Events#TWEEN_PAUSE + * @since 3.60.0 + * + * @return {this} This Tween instance. + */ + pause: function () + { + if (!this.paused) { - graphics.fillStyle(color.color, color.alpha / 255); - graphics.fillRect(x, y, tw, th); + this.paused = true; + + this.dispatchEvent(Events.TWEEN_PAUSE, 'onPause'); } - // Inset the face line to prevent neighboring tile's lines from overlapping - x += 1; - y += 1; - tw -= 2; - th -= 2; + return this; + }, - if (faceColor !== null) + /** + * Resumes the playback of a previously paused Tween. + * + * You can also toggle the `Tween.paused` boolean property, but doing so will not trigger the RESUME event. + * + * @method Phaser.Tweens.BaseTween#resume + * @fires Phaser.Tweens.Events#TWEEN_RESUME + * @since 3.60.0 + * + * @return {this} This Tween instance. + */ + resume: function () + { + if (this.paused) { - graphics.lineStyle(1, faceColor.color, faceColor.alpha / 255); + this.paused = false; - if (tile.faceTop) { graphics.lineBetween(x, y, x + tw, y); } - if (tile.faceRight) { graphics.lineBetween(x + tw, y, x + tw, y + th); } - if (tile.faceBottom) { graphics.lineBetween(x, y + th, x + tw, y + th); } - if (tile.faceLeft) { graphics.lineBetween(x, y, x, y + th); } + this.dispatchEvent(Events.TWEEN_RESUME, 'onResume'); } - } -}; - -module.exports = RenderDebug; - -/***/ }), -/* 1442 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -var SetTileCollision = __webpack_require__(72); -var CalculateFacesWithin = __webpack_require__(63); -var SetLayerCollisionIndex = __webpack_require__(160); + /** + * Internal method that makes this Tween active within the TweenManager + * and emits the onActive event and callback. + * + * @method Phaser.Tweens.BaseTween#makeActive + * @fires Phaser.Tweens.Events#TWEEN_ACTIVE + * @since 3.60.0 + */ + makeActive: function () + { + this.parent.makeActive(this); -/** - * Sets collision on the given tile or tiles within a layer by index. You can pass in either a - * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if - * collision will be enabled (true) or disabled (false). - * - * @function Phaser.Tilemaps.Components.SetCollision - * @since 3.0.0 - * - * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes. - * @param {boolean} collides - If true it will enable collision. If false it will clear collision. - * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. - */ -var SetCollision = function (indexes, collides, recalculateFaces, layer, updateLayer) -{ - if (collides === undefined) { collides = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - if (updateLayer === undefined) { updateLayer = true; } + this.dispatchEvent(Events.TWEEN_ACTIVE, 'onActive'); + }, - if (!Array.isArray(indexes)) + /** + * Internal method that handles this tween completing and emitting the onComplete event + * and callback. + * + * @method Phaser.Tweens.BaseTween#onCompleteHandler + * @since 3.60.0 + */ + onCompleteHandler: function () { - indexes = [ indexes ]; - } + this.setPendingRemoveState(); - // Update the array of colliding indexes - for (var i = 0; i < indexes.length; i++) - { - SetLayerCollisionIndex(indexes[i], collides, layer); - } + this.dispatchEvent(Events.TWEEN_COMPLETE, 'onComplete'); + }, - // Update the tiles - if (updateLayer) + /** + * Flags the Tween as being complete, whatever stage of progress it is at. + * + * If an `onComplete` callback has been defined it will automatically invoke it, unless a `delay` + * argument is provided, in which case the Tween will delay for that period of time before calling the callback. + * + * If you don't need a delay or don't have an `onComplete` callback then call `Tween.stop` instead. + * + * @method Phaser.Tweens.BaseTween#complete + * @fires Phaser.Tweens.Events#TWEEN_COMPLETE + * @since 3.2.0 + * + * @param {number} [delay=0] - The time to wait before invoking the complete callback. If zero it will fire immediately. + * + * @return {this} This Tween instance. + */ + complete: function (delay) { - for (var ty = 0; ty < layer.height; ty++) + if (delay === undefined) { delay = 0; } + + if (delay) { - for (var tx = 0; tx < layer.width; tx++) - { - var tile = layer.data[ty][tx]; + this.setCompleteDelayState(); - if (tile && indexes.indexOf(tile.index) !== -1) - { - SetTileCollision(tile, collides); - } - } + this.countdown = delay; + } + else + { + this.onCompleteHandler(); } - } - if (recalculateFaces) + return this; + }, + + /** + * Flags the Tween as being complete only once the current loop has finished. + * + * This is a useful way to stop an infinitely looping tween once a complete cycle is over, + * rather than abruptly. + * + * If you don't have a loop then call `Tween.stop` instead. + * + * @method Phaser.Tweens.BaseTween#completeAfterLoop + * @fires Phaser.Tweens.Events#TWEEN_COMPLETE + * @since 3.60.0 + * + * @param {number} [loops=0] - The number of loops that should finish before this tween completes. Zero means complete just the current loop. + * + * @return {this} This Tween instance. + */ + completeAfterLoop: function (loops) { - CalculateFacesWithin(0, 0, layer.width, layer.height, layer); - } -}; + if (loops === undefined) { loops = 0; } -module.exports = SetCollision; + if (this.loopCounter > loops) + { + this.loopCounter = loops; + } + return this; + }, -/***/ }), -/* 1443 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Immediately removes this Tween from the TweenManager and all of its internal arrays, + * no matter what stage it is at. Then sets the tween state to `REMOVED`. + * + * You should dispose of your reference to this tween after calling this method, to + * free it from memory. If you no longer require it, call `Tween.destroy()` on it. + * + * @method Phaser.Tweens.BaseTween#remove + * @since 3.60.0 + * + * @return {this} This Tween instance. + */ + remove: function () + { + this.parent.remove(this); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return this; + }, -var SetTileCollision = __webpack_require__(72); -var CalculateFacesWithin = __webpack_require__(63); -var SetLayerCollisionIndex = __webpack_require__(160); + /** + * Stops the Tween immediately, whatever stage of progress it is at. + * + * If not a part of a Tween Chain it is also flagged for removal by the Tween Manager. + * + * If an `onStop` callback has been defined it will automatically invoke it. + * + * The Tween will be removed during the next game frame, but should be considered 'destroyed' from this point on. + * + * Typically, you cannot play a Tween that has been stopped. If you just wish to pause the tween, not destroy it, + * then call the `pause` method instead and use `resume` to continue playback. If you wish to restart the Tween, + * use the `restart` or `seek` methods. + * + * @method Phaser.Tweens.BaseTween#stop + * @fires Phaser.Tweens.Events#TWEEN_STOP + * @since 3.60.0 + * + * @return {this} This Tween instance. + */ + stop: function () + { + if (!this.isRemoved() && !this.isPendingRemove() && !this.isDestroyed()) + { + this.dispatchEvent(Events.TWEEN_STOP, 'onStop'); -/** - * Sets collision on a range of tiles in a layer whose index is between the specified `start` and - * `stop` (inclusive). Calling this with a start value of 10 and a stop value of 14 would set - * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be - * enabled (true) or disabled (false). - * - * @function Phaser.Tilemaps.Components.SetCollisionBetween - * @since 3.0.0 - * - * @param {number} start - The first index of the tile to be set for collision. - * @param {number} stop - The last index of the tile to be set for collision. - * @param {boolean} collides - If true it will enable collision. If false it will clear collision. - * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - * @param {boolean} [updateLayer=true] - If true, updates the current tiles on the layer. Set to false if no tiles have been placed for significant performance boost. - */ -var SetCollisionBetween = function (start, stop, collides, recalculateFaces, layer, updateLayer) -{ - if (collides === undefined) { collides = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } - if (updateLayer === undefined) { updateLayer = true; } + this.setPendingRemoveState(); + } - if (start > stop) - { - return; - } + return this; + }, - // Update the array of colliding indexes - for (var index = start; index <= stop; index++) + /** + * Internal method that handles the processing of the loop delay countdown timer and + * the dispatch of related events. Called automatically by `Tween.update`. + * + * @method Phaser.Tweens.BaseTween#updateLoopCountdown + * @since 3.60.0 + * + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + updateLoopCountdown: function (delta) { - SetLayerCollisionIndex(index, collides, layer); - } + this.countdown -= delta; - // Update the tiles - if (updateLayer) - { - for (var ty = 0; ty < layer.height; ty++) + if (this.countdown <= 0) { - for (var tx = 0; tx < layer.width; tx++) - { - var tile = layer.data[ty][tx]; + this.setActiveState(); - if (tile) - { - if (tile.index >= start && tile.index <= stop) - { - SetTileCollision(tile, collides); - } - } - } + this.dispatchEvent(Events.TWEEN_LOOP, 'onLoop'); } - } + }, - if (recalculateFaces) + /** + * Internal method that handles the processing of the start delay countdown timer and + * the dispatch of related events. Called automatically by `Tween.update`. + * + * @method Phaser.Tweens.BaseTween#updateStartCountdown + * @since 3.60.0 + * + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + updateStartCountdown: function (delta) { - CalculateFacesWithin(0, 0, layer.width, layer.height, layer); - } -}; - -module.exports = SetCollisionBetween; + this.countdown -= delta; + if (this.countdown <= 0) + { + this.hasStarted = true; -/***/ }), -/* 1444 */ -/***/ (function(module, exports, __webpack_require__) { + this.setActiveState(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.dispatchEvent(Events.TWEEN_START, 'onStart'); -var SetTileCollision = __webpack_require__(72); -var CalculateFacesWithin = __webpack_require__(63); -var SetLayerCollisionIndex = __webpack_require__(160); + // Reset the delta so we always start progress from zero + delta = 0; + } -/** - * Sets collision on all tiles in the given layer, except for tiles that have an index specified in - * the given array. The `collides` parameter controls if collision will be enabled (true) or - * disabled (false). Tile indexes not currently in the layer are not affected. - * - * @function Phaser.Tilemaps.Components.SetCollisionByExclusion - * @since 3.0.0 - * - * @param {number[]} indexes - An array of the tile indexes to not be counted for collision. - * @param {boolean} collides - If true it will enable collision. If false it will clear collision. - * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var SetCollisionByExclusion = function (indexes, collides, recalculateFaces, layer) -{ - if (collides === undefined) { collides = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } + return delta; + }, - if (!Array.isArray(indexes)) + /** + * Internal method that handles the processing of the complete delay countdown timer and + * the dispatch of related events. Called automatically by `Tween.update`. + * + * @method Phaser.Tweens.BaseTween#updateCompleteDelay + * @since 3.60.0 + * + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + */ + updateCompleteDelay: function (delta) { - indexes = [ indexes ]; - } + this.countdown -= delta; - // Note: this only updates layer.collideIndexes for tile indexes found currently in the layer - for (var ty = 0; ty < layer.height; ty++) - { - for (var tx = 0; tx < layer.width; tx++) + if (this.countdown <= 0) { - var tile = layer.data[ty][tx]; - - if (tile && indexes.indexOf(tile.index) === -1) - { - SetTileCollision(tile, collides); - SetLayerCollisionIndex(tile.index, collides, layer); - } + this.onCompleteHandler(); } - } + }, - if (recalculateFaces) + /** + * Sets an event based callback to be invoked during playback. + * + * Calling this method will replace a previously set callback for the given type, if any exists. + * + * The types available are: + * + * `onActive` - When the Tween is first created it moves to an 'active' state when added to the Tween Manager. 'Active' does not mean 'playing'. + * `onStart` - When the Tween starts playing after a delayed or paused state. This will happen at the same time as `onActive` if the tween has no delay and isn't paused. + * `onLoop` - When a Tween loops, if it has been set to do so. This happens _after_ the `loopDelay` expires, if set. + * `onComplete` - When the Tween finishes playback fully. Never invoked if the Tween is set to repeat infinitely. + * `onStop` - Invoked only if the `Tween.stop` method is called. + * `onPause` - Invoked only if the `Tween.pause` method is called. Not invoked if the Tween Manager is paused. + * `onResume` - Invoked only if the `Tween.resume` method is called. Not invoked if the Tween Manager is resumed. + * + * The following types are also available and are invoked on a `TweenData` level - that is per-object, per-property, being tweened. + * + * `onYoyo` - When a TweenData starts a yoyo. This happens _after_ the `hold` delay expires, if set. + * `onRepeat` - When a TweenData repeats playback. This happens _after_ the `repeatDelay` expires, if set. + * `onUpdate` - When a TweenData updates a property on a source target during playback. + * + * @method Phaser.Tweens.BaseTween#setCallback + * @since 3.60.0 + * + * @param {Phaser.Types.Tweens.TweenCallbackTypes} type - The type of callback to set. One of: `onActive`, `onComplete`, `onLoop`, `onPause`, `onRepeat`, `onResume`, `onStart`, `onStop`, `onUpdate` or `onYoyo`. + * @param {function} callback - Your callback that will be invoked. + * @param {array} [params] - The parameters to pass to the callback. Pass an empty array if you don't want to define any, but do wish to set the scope. + * + * @return {this} This Tween instance. + */ + setCallback: function (type, callback, params) { - CalculateFacesWithin(0, 0, layer.width, layer.height, layer); - } -}; + if (params === undefined) { params = []; } -module.exports = SetCollisionByExclusion; + if (this.callbacks.hasOwnProperty(type)) + { + this.callbacks[type] = { func: callback, params: params }; + } + return this; + }, -/***/ }), -/* 1445 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Sets this Tween state to PENDING. + * + * @method Phaser.Tweens.BaseTween#setPendingState + * @since 3.60.0 + */ + setPendingState: function () + { + this.state = TWEEN_CONST.PENDING; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Sets this Tween state to ACTIVE. + * + * @method Phaser.Tweens.BaseTween#setActiveState + * @since 3.60.0 + */ + setActiveState: function () + { + this.state = TWEEN_CONST.ACTIVE; + }, -var SetTileCollision = __webpack_require__(72); -var CalculateFacesWithin = __webpack_require__(63); -var HasValue = __webpack_require__(126); + /** + * Sets this Tween state to LOOP_DELAY. + * + * @method Phaser.Tweens.BaseTween#setLoopDelayState + * @since 3.60.0 + */ + setLoopDelayState: function () + { + this.state = TWEEN_CONST.LOOP_DELAY; + }, -/** - * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property - * that matches the given properties object, its collision flag will be set. The `collides` - * parameter controls if collision will be enabled (true) or disabled (false). Passing in - * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that - * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can - * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a - * "types" property that matches any of those values, its collision flag will be updated. - * - * @function Phaser.Tilemaps.Components.SetCollisionByProperty - * @since 3.0.0 - * - * @param {object} properties - An object with tile properties and corresponding values that should be checked. - * @param {boolean} collides - If true it will enable collision. If false it will clear collision. - * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var SetCollisionByProperty = function (properties, collides, recalculateFaces, layer) -{ - if (collides === undefined) { collides = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } + /** + * Sets this Tween state to COMPLETE_DELAY. + * + * @method Phaser.Tweens.BaseTween#setCompleteDelayState + * @since 3.60.0 + */ + setCompleteDelayState: function () + { + this.state = TWEEN_CONST.COMPLETE_DELAY; + }, - for (var ty = 0; ty < layer.height; ty++) + /** + * Sets this Tween state to START_DELAY. + * + * @method Phaser.Tweens.BaseTween#setStartDelayState + * @since 3.60.0 + */ + setStartDelayState: function () { - for (var tx = 0; tx < layer.width; tx++) - { - var tile = layer.data[ty][tx]; + this.state = TWEEN_CONST.START_DELAY; - if (!tile) { continue; } + this.countdown = this.startDelay; - for (var property in properties) - { - if (!HasValue(tile.properties, property)) { continue; } + this.hasStarted = false; + }, - var values = properties[property]; + /** + * Sets this Tween state to PENDING_REMOVE. + * + * @method Phaser.Tweens.BaseTween#setPendingRemoveState + * @since 3.60.0 + */ + setPendingRemoveState: function () + { + this.state = TWEEN_CONST.PENDING_REMOVE; + }, - if (!Array.isArray(values)) - { - values = [ values ]; - } + /** + * Sets this Tween state to REMOVED. + * + * @method Phaser.Tweens.BaseTween#setRemovedState + * @since 3.60.0 + */ + setRemovedState: function () + { + this.state = TWEEN_CONST.REMOVED; + }, - for (var i = 0; i < values.length; i++) - { - if (tile.properties[property] === values[i]) - { - SetTileCollision(tile, collides); - } - } - } - } - } + /** + * Sets this Tween state to FINISHED. + * + * @method Phaser.Tweens.BaseTween#setFinishedState + * @since 3.60.0 + */ + setFinishedState: function () + { + this.state = TWEEN_CONST.FINISHED; + }, - if (recalculateFaces) + /** + * Sets this Tween state to DESTROYED. + * + * @method Phaser.Tweens.BaseTween#setDestroyedState + * @since 3.60.0 + */ + setDestroyedState: function () { - CalculateFacesWithin(0, 0, layer.width, layer.height, layer); - } -}; + this.state = TWEEN_CONST.DESTROYED; + }, -module.exports = SetCollisionByProperty; + /** + * Returns `true` if this Tween has a _current_ state of PENDING, otherwise `false`. + * + * @method Phaser.Tweens.BaseTween#isPending + * @since 3.60.0 + * + * @return {boolean} `true` if this Tween has a _current_ state of PENDING, otherwise `false`. + */ + isPending: function () + { + return (this.state === TWEEN_CONST.PENDING); + }, + /** + * Returns `true` if this Tween has a _current_ state of ACTIVE, otherwise `false`. + * + * @method Phaser.Tweens.BaseTween#isActive + * @since 3.60.0 + * + * @return {boolean} `true` if this Tween has a _current_ state of ACTIVE, otherwise `false`. + */ + isActive: function () + { + return (this.state === TWEEN_CONST.ACTIVE); + }, -/***/ }), -/* 1446 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Returns `true` if this Tween has a _current_ state of LOOP_DELAY, otherwise `false`. + * + * @method Phaser.Tweens.BaseTween#isLoopDelayed + * @since 3.60.0 + * + * @return {boolean} `true` if this Tween has a _current_ state of LOOP_DELAY, otherwise `false`. + */ + isLoopDelayed: function () + { + return (this.state === TWEEN_CONST.LOOP_DELAY); + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Returns `true` if this Tween has a _current_ state of COMPLETE_DELAY, otherwise `false`. + * + * @method Phaser.Tweens.BaseTween#isCompleteDelayed + * @since 3.60.0 + * + * @return {boolean} `true` if this Tween has a _current_ state of COMPLETE_DELAY, otherwise `false`. + */ + isCompleteDelayed: function () + { + return (this.state === TWEEN_CONST.COMPLETE_DELAY); + }, -var SetTileCollision = __webpack_require__(72); -var CalculateFacesWithin = __webpack_require__(63); + /** + * Returns `true` if this Tween has a _current_ state of START_DELAY, otherwise `false`. + * + * @method Phaser.Tweens.BaseTween#isStartDelayed + * @since 3.60.0 + * + * @return {boolean} `true` if this Tween has a _current_ state of START_DELAY, otherwise `false`. + */ + isStartDelayed: function () + { + return (this.state === TWEEN_CONST.START_DELAY); + }, -/** - * Sets collision on the tiles within a layer by checking each tile's collision group data - * (typically defined in Tiled within the tileset collision editor). If any objects are found within - * a tile's collision group, the tile's colliding information will be set. The `collides` parameter - * controls if collision will be enabled (true) or disabled (false). - * - * @function Phaser.Tilemaps.Components.SetCollisionFromCollisionGroup - * @since 3.0.0 - * - * @param {boolean} collides - If true it will enable collision. If false it will clear collision. - * @param {boolean} recalculateFaces - Whether or not to recalculate the tile faces after the update. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var SetCollisionFromCollisionGroup = function (collides, recalculateFaces, layer) -{ - if (collides === undefined) { collides = true; } - if (recalculateFaces === undefined) { recalculateFaces = true; } + /** + * Returns `true` if this Tween has a _current_ state of PENDING_REMOVE, otherwise `false`. + * + * @method Phaser.Tweens.BaseTween#isPendingRemove + * @since 3.60.0 + * + * @return {boolean} `true` if this Tween has a _current_ state of PENDING_REMOVE, otherwise `false`. + */ + isPendingRemove: function () + { + return (this.state === TWEEN_CONST.PENDING_REMOVE); + }, - for (var ty = 0; ty < layer.height; ty++) + /** + * Returns `true` if this Tween has a _current_ state of REMOVED, otherwise `false`. + * + * @method Phaser.Tweens.BaseTween#isRemoved + * @since 3.60.0 + * + * @return {boolean} `true` if this Tween has a _current_ state of REMOVED, otherwise `false`. + */ + isRemoved: function () { - for (var tx = 0; tx < layer.width; tx++) - { - var tile = layer.data[ty][tx]; + return (this.state === TWEEN_CONST.REMOVED); + }, - if (!tile) { continue; } + /** + * Returns `true` if this Tween has a _current_ state of FINISHED, otherwise `false`. + * + * @method Phaser.Tweens.BaseTween#isFinished + * @since 3.60.0 + * + * @return {boolean} `true` if this Tween has a _current_ state of FINISHED, otherwise `false`. + */ + isFinished: function () + { + return (this.state === TWEEN_CONST.FINISHED); + }, - var collisionGroup = tile.getCollisionGroup(); + /** + * Returns `true` if this Tween has a _current_ state of DESTROYED, otherwise `false`. + * + * @method Phaser.Tweens.BaseTween#isDestroyed + * @since 3.60.0 + * + * @return {boolean} `true` if this Tween has a _current_ state of DESTROYED, otherwise `false`. + */ + isDestroyed: function () + { + return (this.state === TWEEN_CONST.DESTROYED); + }, - // It's possible in Tiled to have a collision group without any shapes, e.g. create a - // shape and then delete the shape. - if (collisionGroup && collisionGroup.objects && collisionGroup.objects.length > 0) + /** + * Handles the destroy process of this Tween, clearing out the + * Tween Data and resetting the targets. A Tween that has been + * destroyed cannot ever be played or used again. + * + * @method Phaser.Tweens.BaseTween#destroy + * @since 3.60.0 + */ + destroy: function () + { + if (this.data) + { + this.data.forEach(function (tweenData) { - SetTileCollision(tile, collides); - } + tweenData.destroy(); + }); } - } - if (recalculateFaces) - { - CalculateFacesWithin(0, 0, layer.width, layer.height, layer); + this.removeAllListeners(); + + this.callbacks = null; + this.data = null; + this.parent = null; + + this.setDestroyedState(); } -}; -module.exports = SetCollisionFromCollisionGroup; +}); + +BaseTween.TYPES = [ + 'onActive', + 'onComplete', + 'onLoop', + 'onPause', + 'onRepeat', + 'onResume', + 'onStart', + 'onStop', + 'onUpdate', + 'onYoyo' +]; + +module.exports = BaseTween; /***/ }), -/* 1447 */ -/***/ (function(module, exports) { + +/***/ 65521: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Class = __webpack_require__(56694); +var Events = __webpack_require__(54272); +var TWEEN_CONST = __webpack_require__(55303); + /** - * Sets a global collision callback for the given tile index within the layer. This will affect all - * tiles on this layer that have the same index. If a callback is already set for the tile index it - * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile - * at a specific location on the map then see setTileLocationCallback. + * @classdesc + * BaseTweenData is the class that the TweenData and TweenFrameData classes + * extend from. You should not typically instantiate this class directly, but instead + * use it to form your own tween data classes from, should you require it. * - * @function Phaser.Tilemaps.Components.SetTileIndexCallback - * @since 3.0.0 + * Prior to Phaser 3.60 the TweenData was just an object, but was refactored to a class, + * to make it responsible for its own state and updating. * - * @param {(number|array)} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. - * @param {function} callback - The callback that will be invoked when the tile is collided with. - * @param {object} callbackContext - The context under which the callback is called. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. + * @class BaseTweenData + * @memberof Phaser.Tweens + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Tweens.Tween} tween - The tween this TweenData instance belongs to. + * @param {number} targetIndex - The target index within the Tween targets array. + * @param {string} key - The property of the target to tween. + * @param {Phaser.Types.Tweens.GetEndCallback} getEnd - What the property will be at the END of the Tween. + * @param {Phaser.Types.Tweens.GetStartCallback} getStart - What the property will be at the START of the Tween. + * @param {?Phaser.Types.Tweens.GetActiveCallback} getActive - If not null, is invoked _immediately_ as soon as the TweenData is running, and is set on the target property. + * @param {function} ease - The ease function this tween uses. + * @param {function} delay - Function that returns the time in milliseconds before tween will start. + * @param {number} duration - The duration of the tween in milliseconds. + * @param {boolean} yoyo - Determines whether the tween should return back to its start value after hold has expired. + * @param {number} hold - Function that returns the time in milliseconds the tween will pause before repeating or returning to its starting value if yoyo is set to true. + * @param {number} repeat - Function that returns the number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @param {number} repeatDelay - Function that returns the time in milliseconds before the repeat will start. + * @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens? + * @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens? + * @param {?function} interpolation - The interpolation function to be used for arrays of data. Defaults to 'null'. + * @param {?number[]} interpolationData - The array of interpolation data to be set. Defaults to 'null'. */ -var SetTileIndexCallback = function (indexes, callback, callbackContext, layer) -{ - if (typeof indexes === 'number') - { - layer.callbacks[indexes] = (callback !== null) - ? { callback: callback, callbackContext: callbackContext } - : undefined; - } - else +var BaseTweenData = new Class({ + + initialize: + + function BaseTweenData (tween, targetIndex, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY) { - for (var i = 0, len = indexes.length; i < len; i++) - { - layer.callbacks[indexes[i]] = (callback !== null) - ? { callback: callback, callbackContext: callbackContext } - : undefined; - } - } -}; + /** + * A reference to the Tween that this TweenData instance belongs to. + * + * @name Phaser.Tweens.BaseTweenData#tween + * @type {Phaser.Tweens.Tween} + * @since 3.60.0 + */ + this.tween = tween; -module.exports = SetTileIndexCallback; + /** + * The index of the target within the Tween `targets` array. + * + * @name Phaser.Tweens.BaseTweenData#targetIndex + * @type {number} + * @since 3.60.0 + */ + this.targetIndex = targetIndex; + /** + * The duration of the tween in milliseconds, excluding any time required + * for yoyo or repeats. + * + * @name Phaser.Tweens.BaseTweenData#duration + * @type {number} + * @since 3.60.0 + */ + this.duration = duration; -/***/ }), -/* 1448 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The total calculated duration, in milliseconds, of this TweenData. + * Factoring in the duration, repeats, delays and yoyos. + * + * @name Phaser.Tweens.BaseTweenData#totalDuration + * @type {number} + * @since 3.60.0 + */ + this.totalDuration = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * The time, in milliseconds, before this tween will start playing. + * + * This value is generated by the `getDelay` function. + * + * @name Phaser.Tweens.BaseTweenData#delay + * @type {number} + * @since 3.60.0 + */ + this.delay = 0; -var GetTilesWithin = __webpack_require__(26); + /** + * This function returns the value to be used for `TweenData.delay`. + * + * @name Phaser.Tweens.BaseTweenData#getDelay + * @type {function} + * @since 3.60.0 + */ + this.getDelay = delay; -/** - * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer. - * If a callback is already set for the tile index it will be replaced. Set the callback to null to - * remove it. - * - * @function Phaser.Tilemaps.Components.SetTileLocationCallback - * @since 3.0.0 - * - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {function} callback - The callback that will be invoked when the tile is collided with. - * @param {object} callbackContext - The context under which the callback is called. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var SetTileLocationCallback = function (tileX, tileY, width, height, callback, callbackContext, layer) -{ - var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + /** + * Will the Tween ease back to its starting values, after reaching the end + * and any `hold` value that may be set? + * + * @name Phaser.Tweens.BaseTweenData#yoyo + * @type {boolean} + * @since 3.60.0 + */ + this.yoyo = yoyo; - for (var i = 0; i < tiles.length; i++) - { - tiles[i].setCollisionCallback(callback, callbackContext); - } -}; + /** + * The time, in milliseconds, before this tween will start a yoyo to repeat. + * + * @name Phaser.Tweens.BaseTweenData#hold + * @type {number} + * @since 3.60.0 + */ + this.hold = hold; -module.exports = SetTileLocationCallback; + /** + * The number of times this tween will repeat. + * + * The tween will always run once regardless of this value, + * so a repeat value of '1' will play the tween twice: I.e. the original + * play-through and then it repeats that once (1). + * + * If this value is set to -1 this tween will repeat forever. + * + * @name Phaser.Tweens.BaseTweenData#repeat + * @type {number} + * @since 3.60.0 + */ + this.repeat = repeat; + /** + * The time, in milliseconds, before the repeat will start. + * + * @name Phaser.Tweens.BaseTweenData#repeatDelay + * @type {number} + * @since 3.60.0 + */ + this.repeatDelay = repeatDelay; -/***/ }), -/* 1449 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * How many repeats are left to run? + * + * @name Phaser.Tweens.BaseTweenData#repeatCounter + * @type {number} + * @since 3.60.0 + */ + this.repeatCounter = 0; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * If `true` this Tween will call `toggleFlipX` on the Tween target + * whenever it yoyo's or repeats. It will only be called if the target + * has a function matching this name, like most Phaser GameObjects do. + * + * @name Phaser.Tweens.BaseTweenData#flipX + * @type {boolean} + * @since 3.60.0 + */ + this.flipX = flipX; -var GetTilesWithin = __webpack_require__(26); -var ShuffleArray = __webpack_require__(131); + /** + * If `true` this Tween will call `toggleFlipY` on the Tween target + * whenever it yoyo's or repeats. It will only be called if the target + * has a function matching this name, like most Phaser GameObjects do. + * + * @name Phaser.Tweens.BaseTweenData#flipY + * @type {boolean} + * @since 3.60.0 + */ + this.flipY = flipY; -/** - * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given - * layer. It will only randomize the tiles in that area, so if they're all the same nothing will - * appear to have changed! This method only modifies tile indexes and does not change collision - * information. - * - * @function Phaser.Tilemaps.Components.Shuffle - * @since 3.0.0 - * - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var Shuffle = function (tileX, tileY, width, height, layer) -{ - var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + /** + * A value between 0 and 1 holding the progress of this TweenData. + * + * @name Phaser.Tweens.BaseTweenData#progress + * @type {number} + * @since 3.60.0 + */ + this.progress = 0; - var indexes = tiles.map(function (tile) { return tile.index; }); + /** + * The amount of time, in milliseconds, that has elapsed since this + * TweenData was made active. + * + * @name Phaser.Tweens.BaseTweenData#elapsed + * @type {number} + * @since 3.60.0 + */ + this.elapsed = 0; - ShuffleArray(indexes); + /** + * The state of this TweenData. + * + * @name Phaser.Tweens.BaseTweenData#state + * @type {Phaser.Tweens.StateType} + * @since 3.60.0 + */ + this.state = 0; - for (var i = 0; i < tiles.length; i++) + /** + * Is this Tween Data currently waiting for a countdown to elapse, or not? + * + * @name Phaser.Tweens.BaseTweenData#isCountdown + * @type {boolean} + * @since 3.60.0 + */ + this.isCountdown = false; + }, + + /** + * Returns a reference to the target object belonging to this TweenData. + * + * @method Phaser.Tweens.BaseTweenData#getTarget + * @since 3.60.0 + * + * @return {object} The target object. Can be any JavaScript object, but is typically a Game Object. + */ + getTarget: function () { - tiles[i].index = indexes[i]; - } -}; + return this.tween.targets[this.targetIndex]; + }, -module.exports = Shuffle; + /** + * Sets this TweenData's target object property to be the given value. + * + * @method Phaser.Tweens.BaseTweenData#setTargetValue + * @since 3.60.0 + * + * @param {number} [value] - The value to set on the target. If not given, sets it to the last `current` value. + */ + setTargetValue: function (value) + { + if (value === undefined) { value = this.current; } + this.tween.targets[this.targetIndex][this.key] = value; + }, -/***/ }), -/* 1450 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Sets this TweenData state to CREATED. + * + * @method Phaser.Tweens.BaseTweenData#setCreatedState + * @since 3.60.0 + */ + setCreatedState: function () + { + this.state = TWEEN_CONST.CREATED; + this.isCountdown = false; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Sets this TweenData state to DELAY. + * + * @method Phaser.Tweens.BaseTweenData#setDelayState + * @since 3.60.0 + */ + setDelayState: function () + { + this.state = TWEEN_CONST.DELAY; + this.isCountdown = true; + }, -var GetTilesWithin = __webpack_require__(26); + /** + * Sets this TweenData state to PENDING_RENDER. + * + * @method Phaser.Tweens.BaseTweenData#setPendingRenderState + * @since 3.60.0 + */ + setPendingRenderState: function () + { + this.state = TWEEN_CONST.PENDING_RENDER; + this.isCountdown = false; + }, -/** - * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching - * `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision - * information. - * - * @function Phaser.Tilemaps.Components.SwapByIndex - * @since 3.0.0 - * - * @param {number} tileA - First tile index. - * @param {number} tileB - Second tile index. - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var SwapByIndex = function (indexA, indexB, tileX, tileY, width, height, layer) -{ - var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + /** + * Sets this TweenData state to PLAYING_FORWARD. + * + * @method Phaser.Tweens.BaseTweenData#setPlayingForwardState + * @since 3.60.0 + */ + setPlayingForwardState: function () + { + this.state = TWEEN_CONST.PLAYING_FORWARD; + this.isCountdown = false; + }, - for (var i = 0; i < tiles.length; i++) + /** + * Sets this TweenData state to PLAYING_BACKWARD. + * + * @method Phaser.Tweens.BaseTweenData#setPlayingBackwardState + * @since 3.60.0 + */ + setPlayingBackwardState: function () { - if (tiles[i]) - { - if (tiles[i].index === indexA) - { - tiles[i].index = indexB; - } - else if (tiles[i].index === indexB) - { - tiles[i].index = indexA; - } - } - } -}; + this.state = TWEEN_CONST.PLAYING_BACKWARD; + this.isCountdown = false; + }, -module.exports = SwapByIndex; + /** + * Sets this TweenData state to HOLD_DELAY. + * + * @method Phaser.Tweens.BaseTweenData#setHoldState + * @since 3.60.0 + */ + setHoldState: function () + { + this.state = TWEEN_CONST.HOLD_DELAY; + this.isCountdown = true; + }, + /** + * Sets this TweenData state to REPEAT_DELAY. + * + * @method Phaser.Tweens.BaseTweenData#setRepeatState + * @since 3.60.0 + */ + setRepeatState: function () + { + this.state = TWEEN_CONST.REPEAT_DELAY; + this.isCountdown = true; + }, -/***/ }), -/* 1451 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Sets this TweenData state to COMPLETE. + * + * @method Phaser.Tweens.BaseTweenData#setCompleteState + * @since 3.60.0 + */ + setCompleteState: function () + { + this.state = TWEEN_CONST.COMPLETE; + this.isCountdown = false; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Returns `true` if this TweenData has a _current_ state of CREATED, otherwise `false`. + * + * @method Phaser.Tweens.BaseTweenData#isCreated + * @since 3.60.0 + * + * @return {boolean} `true` if this TweenData has a _current_ state of CREATED, otherwise `false`. + */ + isCreated: function () + { + return (this.state === TWEEN_CONST.CREATED); + }, -var GetTilesWithin = __webpack_require__(26); + /** + * Returns `true` if this TweenData has a _current_ state of DELAY, otherwise `false`. + * + * @method Phaser.Tweens.BaseTweenData#isDelayed + * @since 3.60.0 + * + * @return {boolean} `true` if this TweenData has a _current_ state of DELAY, otherwise `false`. + */ + isDelayed: function () + { + return (this.state === TWEEN_CONST.DELAY); + }, -/** - * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the - * specified layer. Each tile will receive a new index. New indexes are drawn from the given - * weightedIndexes array. An example weighted array: - * - * [ - * { index: 6, weight: 4 }, // Probability of index 6 is 4 / 8 - * { index: 7, weight: 2 }, // Probability of index 7 would be 2 / 8 - * { index: 8, weight: 1.5 }, // Probability of index 8 would be 1.5 / 8 - * { index: 26, weight: 0.5 } // Probability of index 27 would be 0.5 / 8 - * ] - * - * The probability of any index being choose is (the index's weight) / (sum of all weights). This - * method only modifies tile indexes and does not change collision information. - * - * @function Phaser.Tilemaps.Components.WeightedRandomize - * @since 3.0.0 - * - * @param {number} tileX - The left most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} tileY - The top most tile index (in tile coordinates) to use as the origin of the area. - * @param {number} width - How many tiles wide from the `tileX` index the area will be. - * @param {number} height - How many tiles tall from the `tileY` index the area will be. - * @param {object[]} weightedIndexes - An array of objects to randomly draw from during - * randomization. They should be in the form: { index: 0, weight: 4 } or - * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes. - * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon. - */ -var WeightedRandomize = function (tileX, tileY, width, height, weightedIndexes, layer) -{ - if (!weightedIndexes) { return; } + /** + * Returns `true` if this TweenData has a _current_ state of PENDING_RENDER, otherwise `false`. + * + * @method Phaser.Tweens.BaseTweenData#isPendingRender + * @since 3.60.0 + * + * @return {boolean} `true` if this TweenData has a _current_ state of PENDING_RENDER, otherwise `false`. + */ + isPendingRender: function () + { + return (this.state === TWEEN_CONST.PENDING_RENDER); + }, - var i; - var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer); + /** + * Returns `true` if this TweenData has a _current_ state of PLAYING_FORWARD, otherwise `false`. + * + * @method Phaser.Tweens.BaseTweenData#isPlayingForward + * @since 3.60.0 + * + * @return {boolean} `true` if this TweenData has a _current_ state of PLAYING_FORWARD, otherwise `false`. + */ + isPlayingForward: function () + { + return (this.state === TWEEN_CONST.PLAYING_FORWARD); + }, - var weightTotal = 0; + /** + * Returns `true` if this TweenData has a _current_ state of PLAYING_BACKWARD, otherwise `false`. + * + * @method Phaser.Tweens.BaseTweenData#isPlayingBackward + * @since 3.60.0 + * + * @return {boolean} `true` if this TweenData has a _current_ state of PLAYING_BACKWARD, otherwise `false`. + */ + isPlayingBackward: function () + { + return (this.state === TWEEN_CONST.PLAYING_BACKWARD); + }, - for (i = 0; i < weightedIndexes.length; i++) + /** + * Returns `true` if this TweenData has a _current_ state of HOLD_DELAY, otherwise `false`. + * + * @method Phaser.Tweens.BaseTweenData#isHolding + * @since 3.60.0 + * + * @return {boolean} `true` if this TweenData has a _current_ state of HOLD_DELAY, otherwise `false`. + */ + isHolding: function () { - weightTotal += weightedIndexes[i].weight; - } + return (this.state === TWEEN_CONST.HOLD_DELAY); + }, - if (weightTotal <= 0) { return; } + /** + * Returns `true` if this TweenData has a _current_ state of REPEAT_DELAY, otherwise `false`. + * + * @method Phaser.Tweens.BaseTweenData#isRepeating + * @since 3.60.0 + * + * @return {boolean} `true` if this TweenData has a _current_ state of REPEAT_DELAY, otherwise `false`. + */ + isRepeating: function () + { + return (this.state === TWEEN_CONST.REPEAT_DELAY); + }, - for (i = 0; i < tiles.length; i++) + /** + * Returns `true` if this TweenData has a _current_ state of COMPLETE, otherwise `false`. + * + * @method Phaser.Tweens.BaseTweenData#isComplete + * @since 3.60.0 + * + * @return {boolean} `true` if this TweenData has a _current_ state of COMPLETE, otherwise `false`. + */ + isComplete: function () { - var rand = Math.random() * weightTotal; - var sum = 0; - var randomIndex = -1; + return (this.state === TWEEN_CONST.COMPLETE); + }, - for (var j = 0; j < weightedIndexes.length; j++) + /** + * Internal method used as part of the playback process that checks if this + * TweenData should yoyo, repeat, or has completed. + * + * @method Phaser.Tweens.BaseTweenData#setStateFromEnd + * @fires Phaser.Tweens.Events#TWEEN_REPEAT + * @fires Phaser.Tweens.Events#TWEEN_YOYO + * @since 3.60.0 + * + * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. + */ + setStateFromEnd: function (diff) + { + if (this.yoyo) { - sum += weightedIndexes[j].weight; - - if (rand <= sum) - { - var chosen = weightedIndexes[j].index; + this.onRepeat(diff, true, true); + } + else if (this.repeatCounter > 0) + { + this.onRepeat(diff, true, false); + } + else + { + this.setCompleteState(); + } + }, - randomIndex = Array.isArray(chosen) - ? chosen[Math.floor(Math.random() * chosen.length)] - : chosen; - break; - } + /** + * Internal method used as part of the playback process that checks if this + * TweenData should repeat or has completed. + * + * @method Phaser.Tweens.BaseTweenData#setStateFromStart + * @fires Phaser.Tweens.Events#TWEEN_REPEAT + * @since 3.60.0 + * + * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. + */ + setStateFromStart: function (diff) + { + if (this.repeatCounter > 0) + { + this.onRepeat(diff, false); + } + else + { + this.setCompleteState(); } + }, - tiles[i].index = randomIndex; - } -}; + /** + * Internal method that resets this Tween Data entirely, including the progress and elapsed values. + * + * Called automatically by the parent Tween. Should not be called directly. + * + * @method Phaser.Tweens.BaseTweenData#reset + * @since 3.60.0 + */ + reset: function () + { + var tween = this.tween; + var totalTargets = tween.totalTargets; -module.exports = WeightedRandomize; + var targetIndex = this.targetIndex; + var target = tween.targets[targetIndex]; + var key = this.key; + this.progress = 0; + this.elapsed = 0; -/***/ }), -/* 1452 */ -/***/ (function(module, exports, __webpack_require__) { + // Function signature: target, key, value, index, total, tween -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.delay = this.getDelay(target, key, 0, targetIndex, totalTargets, tween); -/** - * @namespace Phaser.Tilemaps.Parsers - */ + this.repeatCounter = (this.repeat === -1) ? TWEEN_CONST.MAX : this.repeat; -module.exports = { + this.setPendingRenderState(); - FromOrientationString: __webpack_require__(258), - Parse: __webpack_require__(564), - Parse2DArray: __webpack_require__(259), - ParseCSV: __webpack_require__(565), + // calcDuration: - Impact: __webpack_require__(1454), - Tiled: __webpack_require__(1455) + // Set t1 (duration + hold + yoyo) + var t1 = this.duration + this.hold; -}; + if (this.yoyo) + { + t1 += this.duration; + } + // Set t2 (repeatDelay + duration + hold + yoyo) + var t2 = t1 + this.repeatDelay; -/***/ }), -/* 1453 */ -/***/ (function(module, exports) { + // Total Duration + this.totalDuration = this.delay + t1; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (this.repeat === -1) + { + this.totalDuration += (t2 * TWEEN_CONST.MAX); + tween.isInfinite = true; + } + else if (this.repeat > 0) + { + this.totalDuration += (t2 * this.repeat); + } -/** - * Parses out the Wangset information from Tiled 1.1.5+ map data, if present. - * - * Since a given tile can be in more than one wangset, the resulting properties - * are nested. `tile.data.wangid[someWangsetName]` will return the array-based wang id in - * this implementation. - * - * Note that we're not guaranteed that there will be any 'normal' tiles if the only - * thing in the tilset are wangtile definitions, so this has to be parsed separately. - * - * See https://doc.mapeditor.org/en/latest/manual/using-wang-tiles/ for more information. - * - * @function Phaser.Tilemaps.Parsers.Tiled.ParseWangsets - * @since 3.53.0 - * - * @param {Array.} wangsets - The array of wangset objects (parsed from JSON) - * @param {object} datas - The field into which to put wangset data from Tiled. - * - * @return {object} An object containing the tileset and image collection data. - */ -var ParseWangsets = function (wangsets, datas) -{ - for (var w = 0; w < wangsets.length; w++) - { - var wangset = wangsets[w]; - var identifier = w; + if (this.totalDuration > tween.duration) + { + // Set the longest duration in the parent Tween + tween.duration = this.totalDuration; + } - if (wangset.name && wangset.name !== '') + if (this.delay < tween.startDelay) { - identifier = wangset.name; + tween.startDelay = this.delay; } - if (Array.isArray(wangset.wangtiles) && wangset.wangtiles.length > 0) + if (this.delay > 0) { - var edgeColors = {}; - var cornerColors = {}; + this.elapsed = this.delay; - var c; - var color; - var colorIndex; + this.setDelayState(); + } + }, - // Tiled before v2020.09.09 - if (Array.isArray(wangset.edgecolors)) - { - for (c = 0; c < wangset.edgecolors.length; c++) - { - colorIndex = 1 + c; - color = wangset.edgecolors[c]; + /** + * Internal method that handles repeating or yoyo'ing this TweenData. + * + * Called automatically by `setStateFromStart` and `setStateFromEnd`. + * + * @method Phaser.Tweens.BaseTweenData#onRepeat + * @fires Phaser.Tweens.Events#TWEEN_REPEAT + * @fires Phaser.Tweens.Events#TWEEN_YOYO + * @since 3.60.0 + * + * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values. + * @param {boolean} setStart - Set the TweenData start values? + * @param {boolean} isYoyo - Is this call a Yoyo check? + */ + onRepeat: function (diff, setStart, isYoyo) + { + var tween = this.tween; + var totalTargets = tween.totalTargets; - if (color.name !== '') - { - edgeColors[colorIndex] = color.name; - } - } - } + var targetIndex = this.targetIndex; + var target = tween.targets[targetIndex]; + var key = this.key; - if (Array.isArray(wangset.cornercolors)) - { - for (c = 0; c < wangset.cornercolors.length; c++) - { - colorIndex = 1 + c; - color = wangset.cornercolors[c]; + var isTweenData = (key !== 'texture'); - if (color.name !== '') - { - cornerColors[colorIndex] = color.name; - } - } - } + // Account for any extra time we got from the previous frame + this.elapsed = diff; + this.progress = diff / this.duration; - // Tiled after v2020.09.09 - if (Array.isArray(wangset.colors)) - { - for (c = 0; c < wangset.colors.length; c++) - { - color = wangset.colors[c]; - colorIndex = 1 + c; + if (this.flipX) + { + target.toggleFlipX(); + } - if (color.name !== '') - { - edgeColors[colorIndex] = cornerColors[colorIndex] = color.name; - } - } - } + if (this.flipY) + { + target.toggleFlipY(); + } - // The wangid layout is north, northeast, east, southeast, etc. - var idLayout = [ - edgeColors, cornerColors, edgeColors, cornerColors, - edgeColors, cornerColors, edgeColors, cornerColors - ]; + if (isTweenData && (setStart || isYoyo)) + { + this.start = this.getStartValue(target, key, this.start, targetIndex, totalTargets, tween); + } - for (var t = 0; t < wangset.wangtiles.length; t++) - { - var wangtile = wangset.wangtiles[t]; + if (isYoyo) + { + this.setPlayingBackwardState(); - var obj = (datas[wangtile.tileid] || (datas[wangtile.tileid] = {})); + this.dispatchEvent(Events.TWEEN_YOYO, 'onYoyo'); - obj = (obj.wangid || (obj.wangid = {})); + return; + } - var wangid = []; + this.repeatCounter--; - for (var i = 0; i < Math.min(idLayout.length, wangtile.wangid.length); i++) - { - color = wangtile.wangid[i]; + // Custom + if (isTweenData) + { + this.end = this.getEndValue(target, key, this.start, targetIndex, totalTargets, tween); + } - if (color === 0) - { - wangid.push(undefined); - continue; - } + // Delay? + if (this.repeatDelay > 0) + { + this.elapsed = this.repeatDelay - diff; - var renamed = idLayout[i][color]; + if (isTweenData) + { + this.current = this.start; - if (renamed !== undefined) - { - wangid.push(renamed); - continue; - } + target[key] = this.current; + } - wangid.push(color); - } + this.setRepeatState(); + } + else + { + this.setPlayingForwardState(); - obj[identifier] = wangid; - } + this.dispatchEvent(Events.TWEEN_REPEAT, 'onRepeat'); } + }, + + /** + * Immediately destroys this TweenData, nulling of all its references. + * + * @method Phaser.Tweens.BaseTweenData#destroy + * @since 3.60.0 + */ + destroy: function () + { + this.tween = null; + this.getDelay = null; + this.setCompleteState(); } -}; -module.exports = ParseWangsets; +}); + +module.exports = BaseTweenData; /***/ }), -/* 1454 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 99730: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @namespace Phaser.Tilemaps.Parsers.Impact + * @typedef {object} Phaser.Types.Tweens.TweenConfigDefaults + * @since 3.0.0 + * + * @property {(object|object[])} targets - The object, or an array of objects, to run the tween on. + * @property {number} [delay=0] - The number of milliseconds to delay before the tween will start. + * @property {number} [duration=1000] - The duration of the tween in milliseconds. + * @property {string} [ease='Power0'] - The easing equation to use for the tween. + * @property {array} [easeParams] - Optional easing parameters. + * @property {number} [hold=0] - The number of milliseconds to hold the tween for before yoyo'ing. + * @property {number} [repeat=0] - The number of times to repeat the tween. + * @property {number} [repeatDelay=0] - The number of milliseconds to pause before a tween will repeat. + * @property {boolean} [yoyo=false] - Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take `duration` milliseconds to complete. + * @property {boolean} [flipX=false] - Horizontally flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipX` property. + * @property {boolean} [flipY=false] - Vertically flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipY` property. + * @property {boolean} [persist=false] - Retain the tween within the Tween Manager, even after playback completes? + * @property {function} [interpolation=null] - The interpolation function to use for array-based tween values. */ -module.exports = { - - ParseTileLayers: __webpack_require__(578), - ParseTilesets: __webpack_require__(579), - ParseWeltmeister: __webpack_require__(577) - +var TWEEN_DEFAULTS = { + targets: null, + delay: 0, + duration: 1000, + ease: 'Power0', + easeParams: null, + hold: 0, + repeat: 0, + repeatDelay: 0, + yoyo: false, + flipX: false, + flipY: false, + persist: false, + interpolation: null }; +module.exports = TWEEN_DEFAULTS; + /***/ }), -/* 1455 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 53709: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @namespace Phaser.Tilemaps.Parsers.Tiled - */ - -module.exports = { +// RESERVED properties that a Tween config object uses - AssignTileProperties: __webpack_require__(567), - Base64Decode: __webpack_require__(574), - BuildTilesetIndex: __webpack_require__(568), - CreateGroupLayer: __webpack_require__(161), - ParseGID: __webpack_require__(261), - ParseImageLayers: __webpack_require__(569), - ParseJSONTiled: __webpack_require__(566), - ParseObject: __webpack_require__(260), - ParseObjectLayers: __webpack_require__(570), - ParseTileLayers: __webpack_require__(573), - ParseTilesets: __webpack_require__(575) +// completeDelay: The time the tween will wait before the onComplete event is dispatched once it has completed +// delay: The time the tween will wait before it first starts +// duration: The duration of the tween +// ease: The ease function used by the tween +// easeParams: The parameters to go with the ease function (if any) +// flipX: flip X the GameObject on tween end +// flipY: flip Y the GameObject on tween end +// hold: The time the tween will pause before running a yoyo +// loop: The time the tween will pause before starting either a yoyo or returning to the start for a repeat +// loopDelay: +// paused: Does the tween start in a paused state, or playing? +// props: The properties being tweened by the tween +// repeat: The number of times the tween will repeat itself (a value of 1 means the tween will play twice, as it repeated once) +// repeatDelay: The time the tween will pause for before starting a repeat. The tween holds in the start state. +// targets: The targets the tween is updating. +// yoyo: boolean - Does the tween reverse itself (yoyo) when it reaches the end? -}; +module.exports = [ + 'callbackScope', + 'completeDelay', + 'delay', + 'duration', + 'ease', + 'easeParams', + 'flipX', + 'flipY', + 'hold', + 'interpolation', + 'loop', + 'loopDelay', + 'onActive', + 'onActiveParams', + 'onComplete', + 'onCompleteParams', + 'onLoop', + 'onLoopParams', + 'onPause', + 'onPauseParams', + 'onRepeat', + 'onRepeatParams', + 'onResume', + 'onResumeParams', + 'onStart', + 'onStartParams', + 'onStop', + 'onStopParams', + 'onUpdate', + 'onUpdateParams', + 'onYoyo', + 'onYoyoParams', + 'paused', + 'persist', + 'props', + 'repeat', + 'repeatDelay', + 'targets', + 'yoyo' +]; /***/ }), -/* 1456 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 39366: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var renderWebGL = __webpack_require__(1); -var renderCanvas = __webpack_require__(1); +var BaseTween = __webpack_require__(502); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(54272); +var GameObjectCreator = __webpack_require__(99325); +var GameObjectFactory = __webpack_require__(61286); +var MATH_CONST = __webpack_require__(83392); +var TWEEN_CONST = __webpack_require__(55303); +var TweenData = __webpack_require__(15718); +var TweenFrameData = __webpack_require__(96490); -if (true) -{ - renderWebGL = __webpack_require__(1457); -} +/** + * @classdesc + * A Tween is able to manipulate the properties of one or more objects to any given value, based + * on a duration and type of ease. They are rarely instantiated directly and instead should be + * created via the TweenManager. + * + * Please note that a Tween will not manipulate any property that begins with an underscore. + * + * @class Tween + * @memberof Phaser.Tweens + * @extends Phaser.Tweens.BaseTween + * @constructor + * @since 3.0.0 + * + * @param {Phaser.Tweens.TweenManager} parent - A reference to the Tween Manager that owns this Tween. + * @param {object[]} targets - An array of targets to be tweened. + */ +var Tween = new Class({ -if (true) -{ - renderCanvas = __webpack_require__(1458); -} + Extends: BaseTween, -module.exports = { + initialize: - renderWebGL: renderWebGL, - renderCanvas: renderCanvas + function Tween (parent, targets) + { + BaseTween.call(this, parent); -}; + /** + * An array of references to the target/s this Tween is operating on. + * + * This array should not be manipulated outside of this Tween. + * + * @name Phaser.Tweens.Tween#targets + * @type {object[]} + * @since 3.0.0 + */ + this.targets = targets; + /** + * Cached target total. + * + * Used internally and should be treated as read-only. + * + * This is not necessarily the same as the data total. + * + * @name Phaser.Tweens.Tween#totalTargets + * @type {number} + * @since 3.0.0 + */ + this.totalTargets = targets.length; -/***/ }), -/* 1457 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Is this Tween currently seeking? + * + * This boolean is toggled in the `Tween.seek` method. + * + * When a tween is seeking, by default it will not dispatch any events or callbacks. + * + * @name Phaser.Tweens.Tween#isSeeking + * @type {boolean} + * @readonly + * @since 3.19.0 + */ + this.isSeeking = false; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Does this Tween loop or repeat infinitely? + * + * @name Phaser.Tweens.Tween#isInfinite + * @type {boolean} + * @readonly + * @since 3.60.0 + */ + this.isInfinite = false; -var Utils = __webpack_require__(12); + /** + * Elapsed time in milliseconds of this run through of the Tween. + * + * @name Phaser.Tweens.Tween#elapsed + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.elapsed = 0; -/** - * Renders this Game Object with the WebGL Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.Tilemaps.TilemapLayer#renderWebGL - * @since 3.0.0 - * @private - * - * @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active WebGL renderer. - * @param {Phaser.Tilemaps.TilemapLayer} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - */ -var TilemapLayerWebGLRenderer = function (renderer, src, camera) -{ - var renderTiles = src.cull(camera); + /** + * Total elapsed time in milliseconds of the entire Tween, including looping. + * + * @name Phaser.Tweens.Tween#totalElapsed + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.totalElapsed = 0; - var tileCount = renderTiles.length; - var alpha = camera.alpha * src.alpha; + /** + * Time in milliseconds for the whole Tween to play through once, excluding loop amounts and loop delays. + * + * This value is set in the `Tween.initTweenData` method and is zero before that point. + * + * @name Phaser.Tweens.Tween#duration + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.duration = 0; - if (tileCount === 0 || alpha <= 0) - { - return; - } + /** + * Value between 0 and 1. The amount of progress through the Tween, excluding loops. + * + * @name Phaser.Tweens.Tween#progress + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.progress = 0; - var gidMap = src.gidMap; - var pipeline = renderer.pipelines.set(src.pipeline, src); + /** + * Time in milliseconds it takes for the Tween to complete a full playthrough (including looping) + * + * For an infinite Tween, this value is a very large integer. + * + * @name Phaser.Tweens.Tween#totalDuration + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.totalDuration = 0; - var getTint = Utils.getTintAppendFloatAlpha; + /** + * The amount of progress that has been made through the entire Tween, including looping. + * + * A value between 0 and 1. + * + * @name Phaser.Tweens.Tween#totalProgress + * @type {number} + * @default 0 + * @since 3.60.0 + */ + this.totalProgress = 0; + }, - var scrollFactorX = src.scrollFactorX; - var scrollFactorY = src.scrollFactorY; + /** + * Adds a new TweenData to this Tween. Typically, this method is called + * automatically by the TweenBuilder, however you can also invoke it + * yourself. + * + * @method Phaser.Tweens.Tween#add + * @since 3.60.0 + * + * @param {number} targetIndex - The target index within the Tween targets array. + * @param {string} key - The property of the target to tween. + * @param {Phaser.Types.Tweens.GetEndCallback} getEnd - What the property will be at the END of the Tween. + * @param {Phaser.Types.Tweens.GetStartCallback} getStart - What the property will be at the START of the Tween. + * @param {?Phaser.Types.Tweens.GetActiveCallback} getActive - If not null, is invoked _immediately_ as soon as the TweenData is running, and is set on the target property. + * @param {function} ease - The ease function this tween uses. + * @param {function} delay - Function that returns the time in milliseconds before tween will start. + * @param {number} duration - The duration of the tween in milliseconds. + * @param {boolean} yoyo - Determines whether the tween should return back to its start value after hold has expired. + * @param {number} hold - Function that returns the time in milliseconds the tween will pause before repeating or returning to its starting value if yoyo is set to true. + * @param {number} repeat - Function that returns the number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @param {number} repeatDelay - Function that returns the time in milliseconds before the repeat will start. + * @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens? + * @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens? + * @param {?function} interpolation - The interpolation function to be used for arrays of data. Defaults to 'null'. + * @param {?number[]} interpolationData - The array of interpolation data to be set. Defaults to 'null'. + * + * @return {Phaser.Tweens.TweenData} The TweenData instance that was added. + */ + add: function (targetIndex, key, getEnd, getStart, getActive, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY, interpolation, interpolationData) + { + var tweenData = new TweenData(this, targetIndex, key, getEnd, getStart, getActive, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY, interpolation, interpolationData); - var x = src.x; - var y = src.y; + this.totalData = this.data.push(tweenData); - var sx = src.scaleX; - var sy = src.scaleY; + return tweenData; + }, - renderer.pipelines.preBatch(src); + /** + * Adds a new TweenFrameData to this Tween. Typically, this method is called + * automatically by the TweenBuilder, however you can also invoke it + * yourself. + * + * @method Phaser.Tweens.Tween#addFrame + * @since 3.60.0 + * + * @param {number} targetIndex - The target index within the Tween targets array. + * @param {string} texture - The texture to set on the target at the end of the tween. + * @param {string|number} frame - The texture frame to set on the target at the end of the tween. + * @param {function} delay - Function that returns the time in milliseconds before tween will start. + * @param {number} duration - The duration of the tween in milliseconds. + * @param {number} hold - Function that returns the time in milliseconds the tween will pause before repeating or returning to its starting value if yoyo is set to true. + * @param {number} repeat - Function that returns the number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @param {number} repeatDelay - Function that returns the time in milliseconds before the repeat will start. + * @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens? + * @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens? + * + * @return {Phaser.Tweens.TweenFrameData} The TweenFrameData instance that was added. + */ + addFrame: function (targetIndex, texture, frame, delay, duration, hold, repeat, repeatDelay, flipX, flipY) + { + var tweenData = new TweenFrameData(this, targetIndex, texture, frame, delay, duration, hold, repeat, repeatDelay, flipX, flipY); - for (var i = 0; i < tileCount; i++) + this.totalData = this.data.push(tweenData); + + return tweenData; + }, + + /** + * Returns the current value of the specified Tween Data. + * + * If this Tween has been destroyed, it will return `null`. + * + * @method Phaser.Tweens.Tween#getValue + * @since 3.0.0 + * + * @param {number} [index=0] - The Tween Data to return the value from. + * + * @return {number} The value of the requested Tween Data, or `null` if this Tween has been destroyed. + */ + getValue: function (index) { - var tile = renderTiles[i]; + if (index === undefined) { index = 0; } - var tileset = gidMap[tile.index]; + var value = null; - if (!tileset) + if (this.data) { - continue; + value = this.data[index].current; } - var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); + return value; + }, - if (tileTexCoords === null) + /** + * See if this Tween is currently acting upon the given target. + * + * @method Phaser.Tweens.Tween#hasTarget + * @since 3.0.0 + * + * @param {object} target - The target to check against this Tween. + * + * @return {boolean} `true` if the given target is a target of this Tween, otherwise `false`. + */ + hasTarget: function (target) + { + return (this.targets && this.targets.indexOf(target) !== -1); + }, + + /** + * Updates the 'end' value of the given property across all matching targets, as long + * as this Tween is currently playing (either forwards or backwards). + * + * Calling this does not adjust the duration of the Tween, or the current progress. + * + * You can optionally tell it to set the 'start' value to be the current value. + * + * If this Tween is in any other state other than playing then calling this method has no effect. + * + * Additionally, if the Tween repeats, is reset, or is seeked, it will revert to the original + * starting and ending values. + * + * @method Phaser.Tweens.Tween#updateTo + * @since 3.0.0 + * + * @param {string} key - The property to set the new value for. You cannot update the 'texture' property via this method. + * @param {number} value - The new value of the property. + * @param {boolean} [startToCurrent=false] - Should this change set the start value to be the current value? + * + * @return {this} This Tween instance. + */ + updateTo: function (key, value, startToCurrent) + { + if (startToCurrent === undefined) { startToCurrent = false; } + + if (key !== 'texture') { - continue; + for (var i = 0; i < this.totalData; i++) + { + var tweenData = this.data[i]; + + if (tweenData.key === key && (tweenData.isPlayingForward() || tweenData.isPlayingBackward())) + { + tweenData.end = value; + + if (startToCurrent) + { + tweenData.start = tweenData.current; + } + } + } } - var texture = tileset.glTexture; + return this; + }, - var textureUnit = pipeline.setTexture2D(texture, src); + /** + * Restarts the Tween from the beginning. + * + * If the Tween has already finished and been destroyed, restarting it will throw an error. + * + * If you wish to restart the Tween from a specific point, use the `Tween.seek` method instead. + * + * @method Phaser.Tweens.Tween#restart + * @since 3.0.0 + * + * @return {this} This Tween instance. + */ + restart: function () + { + switch (this.state) + { + case TWEEN_CONST.REMOVED: + case TWEEN_CONST.FINISHED: + this.seek(); + this.parent.makeActive(this); + break; - var frameWidth = tileset.tileWidth; - var frameHeight = tileset.tileHeight; + case TWEEN_CONST.PENDING: + case TWEEN_CONST.PENDING_REMOVE: + this.parent.reset(this); + break; - var frameX = tileTexCoords.x; - var frameY = tileTexCoords.y; + case TWEEN_CONST.DESTROYED: + console.warn('Cannot restart destroyed Tween', this); + break; - var tw = tileset.tileWidth * 0.5; - var th = tileset.tileHeight * 0.5; + default: + this.seek(); + break; + } - var tint = getTint(tile.tint, alpha * tile.alpha); + this.paused = false; + this.hasStarted = false; - pipeline.batchTexture( - src, - texture, - texture.width, texture.height, - x + ((tw + tile.pixelX) * sx), y + ((th + tile.pixelY) * sy), - tile.width, tile.height, - sx, sy, - tile.rotation, - tile.flipX, tile.flipY, - scrollFactorX, scrollFactorY, - tw, th, - frameX, frameY, frameWidth, frameHeight, - tint, tint, tint, tint, false, - 0, 0, - camera, - null, - true, - textureUnit - ); - } + return this; + }, - renderer.pipelines.postBatch(src); -}; + /** + * Internal method that advances to the next state of the Tween during playback. + * + * @method Phaser.Tweens.Tween#nextState + * @fires Phaser.Tweens.Events#TWEEN_COMPLETE + * @fires Phaser.Tweens.Events#TWEEN_LOOP + * @since 3.0.0 + * + * @return {boolean} `true` if this Tween has completed, otherwise `false`. + */ + nextState: function () + { + if (this.loopCounter > 0) + { + this.elapsed = 0; + this.progress = 0; + this.loopCounter--; -module.exports = TilemapLayerWebGLRenderer; + this.initTweenData(true); + if (this.loopDelay > 0) + { + this.countdown = this.loopDelay; -/***/ }), -/* 1458 */ -/***/ (function(module, exports, __webpack_require__) { + this.setLoopDelayState(); + } + else + { + this.setActiveState(); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.dispatchEvent(Events.TWEEN_LOOP, 'onLoop'); + } + } + else if (this.completeDelay > 0) + { + this.countdown = this.completeDelay; -var TransformMatrix = __webpack_require__(25); + this.setCompleteDelayState(); + } + else + { + this.onCompleteHandler(); -var tempMatrix1 = new TransformMatrix(); -var tempMatrix2 = new TransformMatrix(); -var tempMatrix3 = new TransformMatrix(); + return true; + } -/** - * Renders this Game Object with the Canvas Renderer to the given Camera. - * The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera. - * This method should not be called directly. It is a utility function of the Render module. - * - * @method Phaser.Tilemaps.TilemapLayer#renderCanvas - * @since 3.50.0 - * @private - * - * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer. - * @param {Phaser.Tilemaps.TilemapLayer} src - The Game Object being rendered in this call. - * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object. - * @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested - */ -var TilemapLayerCanvasRenderer = function (renderer, src, camera, parentMatrix) -{ - var renderTiles = src.cull(camera); + return false; + }, - var tileCount = renderTiles.length; - var alpha = camera.alpha * src.alpha; + /** + * Internal method that handles this tween completing and starting + * the next tween in the chain, if any. + * + * @method Phaser.Tweens.Tween#onCompleteHandler + * @since 3.60.0 + */ + onCompleteHandler: function () + { + this.progress = 1; + this.totalProgress = 1; - if (tileCount === 0 || alpha <= 0) + BaseTween.prototype.onCompleteHandler.call(this); + }, + + /** + * Starts a Tween playing. + * + * You only need to call this method if you have configured the tween to be paused on creation. + * + * If the Tween is already playing, calling this method again will have no effect. If you wish to + * restart the Tween, use `Tween.restart` instead. + * + * Calling this method after the Tween has completed will start the Tween playing again from the beginning. + * This is the same as calling `Tween.seek(0)` and then `Tween.play()`. + * + * @method Phaser.Tweens.Tween#play + * @since 3.0.0 + * + * @return {this} This Tween instance. + */ + play: function () { - return; - } + if (this.isDestroyed()) + { + console.warn('Cannot play destroyed Tween', this); - var camMatrix = tempMatrix1; - var layerMatrix = tempMatrix2; - var calcMatrix = tempMatrix3; + return this; + } - layerMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY); + if (this.isPendingRemove() || this.isFinished()) + { + this.seek(); + } - camMatrix.copyFrom(camera.matrix); + this.paused = false; - var ctx = renderer.currentContext; - var gidMap = src.gidMap; + this.setActiveState(); - ctx.save(); + return this; + }, - if (parentMatrix) + /** + * Seeks to a specific point in the Tween. + * + * The given amount is a value in milliseconds that represents how far into the Tween + * you wish to seek, based on the start of the Tween. + * + * Note that the seek amount takes the entire duration of the Tween into account, including delays, loops and repeats. + * For example, a Tween that lasts for 2 seconds, but that loops 3 times, would have a total duration of 6 seconds, + * so seeking to 3000 ms would seek to the Tweens half-way point based on its _entire_ duration. + * + * Prior to Phaser 3.60 this value was given as a number between 0 and 1 and didn't + * work for Tweens had an infinite repeat. This new method works for all Tweens. + * + * Seeking works by resetting the Tween to its initial values and then iterating through the Tween at `delta` + * jumps per step. The longer the Tween, the longer this can take. If you need more precision you can + * reduce the delta value. If you need a faster seek, you can increase it. When the Tween is + * reset it will refresh the starting and ending values. If these are coming from a dynamic function, + * or a random array, it will be called for each seek. + * + * While seeking the Tween will _not_ emit any of its events or callbacks unless + * the 3rd parameter is set to `true`. + * + * If this Tween is paused, seeking will not change this fact. It will advance the Tween + * to the desired point and then pause it again. + * + * @method Phaser.Tweens.Tween#seek + * @since 3.0.0 + * + * @param {number} [amount=0] - The number of milliseconds to seek into the Tween from the beginning. + * @param {number} [delta=16.6] - The size of each step when seeking through the Tween. A higher value completes faster but at the cost of less precision. + * @param {boolean} [emit=false] - While seeking, should the Tween emit any of its events or callbacks? The default is 'false', i.e. to seek silently. + * + * @return {this} This Tween instance. + */ + seek: function (amount, delta, emit) { - // Multiply the camera by the parent matrix - camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY); + if (amount === undefined) { amount = 0; } + if (delta === undefined) { delta = 16.6; } + if (emit === undefined) { emit = false; } - // Undo the camera scroll - layerMatrix.e = src.x; - layerMatrix.f = src.y; + if (this.isDestroyed()) + { + console.warn('Cannot seek destroyed Tween', this); - // Multiply by the Sprite matrix, store result in calcMatrix - camMatrix.multiply(layerMatrix, calcMatrix); + return this; + } - calcMatrix.copyToContext(ctx); - } - else - { - layerMatrix.e -= camera.scrollX * src.scrollFactorX; - layerMatrix.f -= camera.scrollY * src.scrollFactorY; + if (!emit) + { + this.isSeeking = true; + } - layerMatrix.copyToContext(ctx); - } + this.reset(true); - if (!renderer.antialias || src.scaleX > 1 || src.scaleY > 1) - { - ctx.imageSmoothingEnabled = false; - } + this.initTweenData(true); - for (var i = 0; i < tileCount; i++) + this.setActiveState(); + + this.dispatchEvent(Events.TWEEN_ACTIVE, 'onActive'); + + var isPaused = this.paused; + + this.paused = false; + + if (amount > 0) + { + var iterations = Math.floor(amount / delta); + var remainder = amount - (iterations * delta); + + for (var i = 0; i < iterations; i++) + { + this.update(delta); + } + + if (remainder > 0) + { + this.update(remainder); + } + } + + this.paused = isPaused; + + this.isSeeking = false; + + return this; + }, + + /** + * Initialises all of the Tween Data and Tween values. + * + * This is called automatically and should not typically be invoked directly. + * + * @method Phaser.Tweens.Tween#initTweenData + * @since 3.60.0 + * + * @param {boolean} [isSeeking=false] - Is the Tween Data being reset as part of a seek? + */ + initTweenData: function (isSeeking) { - var tile = renderTiles[i]; + if (isSeeking === undefined) { isSeeking = false; } - var tileset = gidMap[tile.index]; + // These two values are updated directly during TweenData.reset: + this.duration = 0; + this.startDelay = MATH_CONST.MAX_SAFE_INTEGER; - if (!tileset) + var data = this.data; + + for (var i = 0; i < this.totalData; i++) { - continue; + data[i].reset(isSeeking); } - var image = tileset.image.getSourceImage(); + // Clamp duration to ensure we never divide by zero + this.duration = Math.max(this.duration, 0.01); - var tileTexCoords = tileset.getTileTextureCoordinates(tile.index); + var duration = this.duration; + var completeDelay = this.completeDelay; + var loopCounter = this.loopCounter; + var loopDelay = this.loopDelay; - if (tileTexCoords === null) + if (loopCounter > 0) { - continue; + this.totalDuration = duration + completeDelay + ((duration + loopDelay) * loopCounter); + } + else + { + this.totalDuration = duration + completeDelay; } + }, - var tileWidth = tileset.tileWidth; - var tileHeight = tileset.tileHeight; + /** + * Resets this Tween ready for another play-through. + * + * This is called automatically from the Tween Manager, or from the parent TweenChain, + * and should not typically be invoked directly. + * + * If you wish to restart this Tween, use the `Tween.restart` or `Tween.seek` methods instead. + * + * @method Phaser.Tweens.Tween#reset + * @fires Phaser.Tweens.Events#TWEEN_ACTIVE + * @since 3.60.0 + * + * @param {boolean} [skipInit=false] - Skip resetting the TweenData and Active State? + * + * @return {this} This Tween instance. + */ + reset: function (skipInit) + { + if (skipInit === undefined) { skipInit = false; } - var halfWidth = tileWidth * 0.5; - var halfHeight = tileHeight * 0.5; + this.elapsed = 0; + this.totalElapsed = 0; + this.progress = 0; + this.totalProgress = 0; + this.loopCounter = this.loop; - ctx.save(); + if (this.loop === -1) + { + this.isInfinite = true; + this.loopCounter = TWEEN_CONST.MAX; + } - ctx.translate(tile.pixelX + halfWidth, tile.pixelY + halfHeight); + if (!skipInit) + { + this.initTweenData(); - if (tile.rotation !== 0) + this.setActiveState(); + + this.dispatchEvent(Events.TWEEN_ACTIVE, 'onActive'); + } + + return this; + }, + + /** + * Internal method that advances the Tween based on the time values. + * + * @method Phaser.Tweens.Tween#update + * @fires Phaser.Tweens.Events#TWEEN_COMPLETE + * @fires Phaser.Tweens.Events#TWEEN_LOOP + * @fires Phaser.Tweens.Events#TWEEN_START + * @since 3.0.0 + * + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * + * @return {boolean} Returns `true` if this Tween has finished and should be removed from the Tween Manager, otherwise returns `false`. + */ + update: function (delta) + { + if (this.isPendingRemove() || this.isDestroyed()) { - ctx.rotate(tile.rotation); + return true; + } + else if (this.paused || this.isFinished()) + { + return false; } - if (tile.flipX || tile.flipY) + delta *= this.timeScale * this.parent.timeScale; + + if (this.isLoopDelayed()) { - ctx.scale((tile.flipX) ? -1 : 1, (tile.flipY) ? -1 : 1); + this.updateLoopCountdown(delta); + + return false; } + else if (this.isCompleteDelayed()) + { + this.updateCompleteDelay(delta); - ctx.globalAlpha = alpha * tile.alpha; + return false; + } + else if (!this.hasStarted) + { + this.startDelay -= delta; - ctx.drawImage( - image, - tileTexCoords.x, tileTexCoords.y, - tileWidth , tileHeight, - -halfWidth, -halfHeight, - tileWidth, tileHeight - ); + if (this.startDelay <= 0) + { + this.hasStarted = true; - ctx.restore(); - } + this.dispatchEvent(Events.TWEEN_START, 'onStart'); - ctx.restore(); -}; + // Reset the delta so we always start progress from zero + delta = 0; + } + } -module.exports = TilemapLayerCanvasRenderer; + var stillRunning = false; + if (this.isActive()) + { + var data = this.data; -/***/ }), -/* 1459 */ -/***/ (function(module, exports, __webpack_require__) { + for (var i = 0; i < this.totalData; i++) + { + if (data[i].update(delta)) + { + stillRunning = true; + } + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.elapsed += delta; + this.progress = Math.min(this.elapsed / this.duration, 1); -var GameObjectCreator = __webpack_require__(16); -var ParseToTilemap = __webpack_require__(262); + this.totalElapsed += delta; + this.totalProgress = Math.min(this.totalElapsed / this.totalDuration, 1); -/** - * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. - * When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing - * from a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map - * data. For an empty map, you should specify tileWidth, tileHeight, width & height. - * - * @method Phaser.GameObjects.GameObjectCreator#tilemap - * @since 3.0.0 - * - * @param {Phaser.Types.Tilemaps.TilemapConfig} [config] - The config options for the Tilemap. - * - * @return {Phaser.Tilemaps.Tilemap} - */ -GameObjectCreator.register('tilemap', function (config) -{ - // Defaults are applied in ParseToTilemap - var c = (config !== undefined) ? config : {}; + // Anything still running? If not, we're done + if (!stillRunning) + { + // This calls onCompleteHandler if this tween is over + this.nextState(); + } - return ParseToTilemap( - this.scene, - c.key, - c.tileWidth, - c.tileHeight, - c.width, - c.height, - c.data, - c.insertNull - ); -}); + // if nextState called onCompleteHandler then we're ready to be removed, unless we persist + var remove = this.isPendingRemove(); + if (remove && this.persist) + { + this.setFinishedState(); -/***/ }), -/* 1460 */ -/***/ (function(module, exports, __webpack_require__) { + remove = false; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + return remove; + }, -var GameObjectFactory = __webpack_require__(5); -var ParseToTilemap = __webpack_require__(262); + /** + * Moves this Tween forward by the given amount of milliseconds. + * + * It will only advance through the current loop of the Tween. For example, if the + * Tween is set to repeat or yoyo, it can only fast forward through a single + * section of the sequence. Use `Tween.seek` for more complex playhead control. + * + * If the Tween is paused or has already finished, calling this will have no effect. + * + * @method Phaser.Tweens.Tween#forward + * @since 3.60.0 + * + * @param {number} ms - The number of milliseconds to advance this Tween by. + * + * @return {this} This Tween instance. + */ + forward: function (ms) + { + this.update(ms); -/** - * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. - * When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing - * from a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map - * data. For an empty map, you should specify tileWidth, tileHeight, width & height. - * - * @method Phaser.GameObjects.GameObjectFactory#tilemap - * @since 3.0.0 - * - * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data. - * @param {number} [tileWidth=32] - The width of a tile in pixels. Pass in `null` to leave as the - * default. - * @param {number} [tileHeight=32] - The height of a tile in pixels. Pass in `null` to leave as the - * default. - * @param {number} [width=10] - The width of the map in tiles. Pass in `null` to leave as the - * default. - * @param {number} [height=10] - The height of the map in tiles. Pass in `null` to leave as the - * default. - * @param {number[][]} [data] - Instead of loading from the cache, you can also load directly from - * a 2D array of tile indexes. Pass in `null` for no data. - * @param {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the - * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty - * location will get a Tile object with an index of -1. If you've a large sparsely populated map and - * the tile data doesn't need to change then setting this value to `true` will help with memory - * consumption. However if your map is small or you need to update the tiles dynamically, then leave - * the default value set. - * - * @return {Phaser.Tilemaps.Tilemap} - */ -GameObjectFactory.register('tilemap', function (key, tileWidth, tileHeight, width, height, data, insertNull) -{ - // Allow users to specify null to indicate that they want the default value, since null is - // shorter & more legible than undefined. Convert null to undefined to allow ParseToTilemap - // defaults to take effect. + return this; + }, - if (key === null) { key = undefined; } - if (tileWidth === null) { tileWidth = undefined; } - if (tileHeight === null) { tileHeight = undefined; } - if (width === null) { width = undefined; } - if (height === null) { height = undefined; } + /** + * Moves this Tween backward by the given amount of milliseconds. + * + * It will only rewind through the current loop of the Tween. For example, if the + * Tween is set to repeat or yoyo, it can only fast forward through a single + * section of the sequence. Use `Tween.seek` for more complex playhead control. + * + * If the Tween is paused or has already finished, calling this will have no effect. + * + * @method Phaser.Tweens.Tween#rewind + * @since 3.60.0 + * + * @param {number} ms - The number of milliseconds to rewind this Tween by. + * + * @return {this} This Tween instance. + */ + rewind: function (ms) + { + this.update(-ms); - return ParseToTilemap(this.scene, key, tileWidth, tileHeight, width, height, data, insertNull); -}); + return this; + }, -// When registering a factory function 'this' refers to the GameObjectFactory context. -// -// There are several properties available to use: -// -// this.scene - a reference to the Scene that owns the GameObjectFactory -// this.displayList - a reference to the Display List the Scene owns -// this.updateList - a reference to the Update List the Scene owns + /** + * Internal method that will emit a Tween based Event and invoke the given callback. + * + * @method Phaser.Tweens.Tween#dispatchEvent + * @since 3.60.0 + * + * @param {Phaser.Types.Tweens.Event} event - The Event to be dispatched. + * @param {Phaser.Types.Tweens.TweenCallbackTypes} [callback] - The name of the callback to be invoked. Can be `null` or `undefined` to skip invocation. + */ + dispatchEvent: function (event, callback) + { + if (!this.isSeeking) + { + this.emit(event, this, this.targets); + var handler = this.callbacks[callback]; -/***/ }), -/* 1461 */ -/***/ (function(module, exports, __webpack_require__) { + if (handler) + { + handler.func.apply(this.callbackScope, [ this, this.targets ].concat(handler.params)); + } + } + }, + + /** + * Handles the destroy process of this Tween, clearing out the + * Tween Data and resetting the targets. A Tween that has been + * destroyed cannot ever be played or used again. + * + * @method Phaser.Tweens.Tween#destroy + * @since 3.60.0 + */ + destroy: function () + { + BaseTween.prototype.destroy.call(this); + + this.targets = null; + } + +}); /** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * Creates a new Tween object. + * + * Note: This method will only be available if Tweens have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectFactory#tween + * @since 3.0.0 + * + * @param {Phaser.Types.Tweens.TweenBuilderConfig|Phaser.Types.Tweens.TweenChainBuilderConfig|Phaser.Tweens.Tween|Phaser.Tweens.TweenChain} config - A Tween Configuration object, or a Tween or TweenChain instance. + * + * @return {Phaser.Tweens.Tween} The Tween that was created. */ +GameObjectFactory.register('tween', function (config) +{ + return this.scene.sys.tweens.add(config); +}); /** - * @namespace Phaser.Time + * Creates a new Tween object and returns it. + * + * Note: This method will only be available if Tweens have been built into Phaser. + * + * @method Phaser.GameObjects.GameObjectCreator#tween + * @since 3.0.0 + * + * @param {Phaser.Types.Tweens.TweenBuilderConfig|Phaser.Types.Tweens.TweenChainBuilderConfig|Phaser.Tweens.Tween|Phaser.Tweens.TweenChain} config - A Tween Configuration object, or a Tween or TweenChain instance. + * + * @return {Phaser.Tweens.Tween} The Tween that was created. */ +GameObjectCreator.register('tween', function (config) +{ + return this.scene.sys.tweens.create(config); +}); -module.exports = { - - Clock: __webpack_require__(1462), - TimerEvent: __webpack_require__(582) - -}; +module.exports = Tween; /***/ }), -/* 1462 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 45641: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Class = __webpack_require__(0); -var PluginCache = __webpack_require__(24); -var SceneEvents = __webpack_require__(20); -var TimerEvent = __webpack_require__(582); -var Remove = __webpack_require__(93); +var ArrayRemove = __webpack_require__(66458); +var BaseTween = __webpack_require__(502); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(54272); +var GameObjectCreator = __webpack_require__(99325); +var GameObjectFactory = __webpack_require__(61286); +var TWEEN_CONST = __webpack_require__(55303); /** * @classdesc - * The Clock is a Scene plugin which creates and updates Timer Events for its Scene. + * A TweenChain is a special type of Tween that allows you to create a sequence of Tweens, chained to one-another, + * and add them to the Tween Manager. * - * @class Clock - * @memberof Phaser.Time + * The tweens are played in order, from start to finish. You can optionally set the chain + * to repeat as many times as you like. Once the chain has finished playing, or repeating if set, + * all tweens in the chain will be destroyed automatically. To override this, set the 'persists' + * argument to 'true'. + * + * Playback will start immediately unless the _first_ Tween has been configured to be paused. + * + * Please note that Tweens will not manipulate any target property that begins with an underscore. + * + * @class TweenChain + * @memberof Phaser.Tweens + * @extends Phaser.Tweens.BaseTween * @constructor - * @since 3.0.0 + * @since 3.60.0 * - * @param {Phaser.Scene} scene - The Scene which owns this Clock. + * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.TweenChain)} parent - A reference to the Tween Manager, or TweenChain, that owns this TweenChain. */ -var Clock = new Class({ +var TweenChain = new Class({ + + Extends: BaseTween, initialize: - function Clock (scene) + function TweenChain (parent) { - /** - * The Scene which owns this Clock. - * - * @name Phaser.Time.Clock#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; - - /** - * The Scene Systems object of the Scene which owns this Clock. - * - * @name Phaser.Time.Clock#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; + BaseTween.call(this, parent); /** - * The current time of the Clock, in milliseconds. - * - * If accessed externally, this is equivalent to the `time` parameter normally passed to a Scene's `update` method. + * A reference to the Tween that this TweenChain is currently playing. * - * @name Phaser.Time.Clock#now - * @type {number} - * @since 3.0.0 + * @name Phaser.Tweens.TweenChain#currentTween + * @type {Phaser.Tweens.Tween} + * @since 3.60.0 */ - this.now = 0; + this.currentTween = null; /** - * The scale of the Clock's time delta. - * - * The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Clock and anything which uses it, such as its Timer Events. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing the Clock. + * A reference to the data array index of the currently playing tween. * - * @name Phaser.Time.Clock#timeScale + * @name Phaser.Tweens.TweenChain#currentIndex * @type {number} - * @default 1 - * @since 3.0.0 - */ - this.timeScale = 1; - - /** - * Whether the Clock is paused (`true`) or active (`false`). - * - * When paused, the Clock will not update any of its Timer Events, thus freezing time. - * - * @name Phaser.Time.Clock#paused - * @type {boolean} - * @default false - * @since 3.0.0 - */ - this.paused = false; - - /** - * An array of all Timer Events whose delays haven't expired - these are actively updating Timer Events. - * - * @name Phaser.Time.Clock#_active - * @type {Phaser.Time.TimerEvent[]} - * @private - * @default [] - * @since 3.0.0 - */ - this._active = []; - - /** - * An array of all Timer Events which will be added to the Clock at the start of the next frame. - * - * @name Phaser.Time.Clock#_pendingInsertion - * @type {Phaser.Time.TimerEvent[]} - * @private - * @default [] - * @since 3.0.0 - */ - this._pendingInsertion = []; - - /** - * An array of all Timer Events which will be removed from the Clock at the start of the next frame. - * - * @name Phaser.Time.Clock#_pendingRemoval - * @type {Phaser.Time.TimerEvent[]} - * @private - * @default [] - * @since 3.0.0 + * @since 3.60.0 */ - this._pendingRemoval = []; - - scene.sys.events.once(SceneEvents.BOOT, this.boot, this); - scene.sys.events.on(SceneEvents.START, this.start, this); + this.currentIndex = 0; }, /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. + * Prepares this TweenChain for playback. * - * @method Phaser.Time.Clock#boot - * @private - * @since 3.5.1 + * Called automatically by the TweenManager. Should not be called directly. + * + * @method Phaser.Tweens.TweenChain#init + * @fires Phaser.Tweens.Events#TWEEN_ACTIVE + * @since 3.60.0 + * + * @return {this} This TweenChain instance. */ - boot: function () + init: function () { - // Sync with the TimeStep - this.now = this.systems.game.loop.time; + this.loopCounter = (this.loop === -1) ? TWEEN_CONST.MAX : this.loop; - this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); - }, + this.setCurrentTween(0); - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. - * - * @method Phaser.Time.Clock#start - * @private - * @since 3.5.0 - */ - start: function () - { - var eventEmitter = this.systems.events; + if (this.startDelay > 0 && !this.isStartDelayed()) + { + this.setStartDelayState(); + } + else + { + this.setActiveState(); + } - eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); - eventEmitter.on(SceneEvents.UPDATE, this.update, this); - eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); + this.dispatchEvent(Events.TWEEN_ACTIVE, 'onActive'); + + return this; }, /** - * Creates a Timer Event and adds it to this Clock at the start of the next frame. + * Create a sequence of Tweens, chained to one-another, and add them to this Tween Manager. * - * You can pass in either a `TimerEventConfig` object, from with a new `TimerEvent` will - * be created, or you can pass in a `TimerEvent` instance. + * The tweens are played in order, from start to finish. You can optionally set the chain + * to repeat as many times as you like. Once the chain has finished playing, or repeating if set, + * all tweens in the chain will be destroyed automatically. To override this, set the 'persists' + * argument to 'true'. * - * If passing an instance please make sure that this instance hasn't been used before. - * If it has ever entered a 'completed' state then it will no longer be suitable to - * run again. + * Playback will start immediately unless the _first_ Tween has been configured to be paused. * - * Also, if the `TimerEvent` instance is being used by _another_ Clock (in another Scene) - * it will still be updated by that Clock as well, so be careful when using this feature. + * Please note that Tweens will not manipulate any target property that begins with an underscore. * - * @method Phaser.Time.Clock#addEvent - * @since 3.0.0 + * @method Phaser.Tweens.TweenChain#add + * @since 3.60.0 * - * @param {(Phaser.Time.TimerEvent | Phaser.Types.Time.TimerEventConfig)} config - The configuration for the Timer Event, or an existing Timer Event object. + * @param {Phaser.Types.Tweens.TweenBuilderConfig[]|object[]} tweens - An array of Tween configuration objects for the Tweens in this chain. * - * @return {Phaser.Time.TimerEvent} The Timer Event which was created, or passed in. + * @return {this} This TweenChain instance. */ - addEvent: function (config) + add: function (tweens) { - var event; + var newTweens = this.parent.create(tweens); - if (config instanceof TimerEvent) + if (!Array.isArray(newTweens)) { - event = config; + newTweens = [ newTweens ]; + } - this.removeEvent(event); + var data = this.data; - event.elapsed = event.startAt; - event.hasDispatched = false; - event.repeatCount = (event.repeat === -1 || event.loop) ? 999999999999 : event.repeat; - } - else + for (var i = 0; i < newTweens.length; i++) { - event = new TimerEvent(config); + var tween = newTweens[i]; + + tween.parent = this; + + data.push(tween.reset()); } - this._pendingInsertion.push(event); + this.totalData = data.length; - return event; + return this; }, /** - * Creates a Timer Event and adds it to the Clock at the start of the frame. + * Removes the given Tween from this Tween Chain. * - * This is a shortcut for {@link #addEvent} which can be shorter and is compatible with the syntax of the GreenSock Animation Platform (GSAP). + * The removed tween is _not_ destroyed. It is just removed from this Tween Chain. * - * @method Phaser.Time.Clock#delayedCall - * @since 3.0.0 + * If the given Tween is currently playing then the chain will automatically move + * to the next tween in the chain. If there are no more tweens, this chain will complete. * - * @param {number} delay - The delay of the function call, in milliseconds. - * @param {function} callback - The function to call after the delay expires. - * @param {Array.<*>} [args] - The arguments to call the function with. - * @param {*} [callbackScope] - The scope (`this` object) to call the function with. + * @method Phaser.Tweens.TweenChain#remove + * @since 3.60.0 + * @override * - * @return {Phaser.Time.TimerEvent} The Timer Event which was created. + * @param {Phaser.Tweens.Tween} tween - The Tween to be removed. + * + * @return {this} This Tween Chain instance. */ - delayedCall: function (delay, callback, args, callbackScope) + remove: function (tween) { - return this.addEvent({ delay: delay, callback: callback, args: args, callbackScope: callbackScope }); + // Remove it immediately + ArrayRemove(this.data, tween); + + tween.setRemovedState(); + + if (tween === this.currentTween) + { + this.nextTween(); + } + + this.totalData = this.data.length; + + return this; }, /** - * Clears and recreates the array of pending Timer Events. + * See if any of the tweens in this Tween Chain is currently acting upon the given target. * - * @method Phaser.Time.Clock#clearPendingEvents - * @since 3.0.0 + * @method Phaser.Tweens.TweenChain#hasTarget + * @since 3.60.0 * - * @return {this} - This Clock instance. + * @param {object} target - The target to check against this TweenChain. + * + * @return {boolean} `true` if the given target is a target of this TweenChain, otherwise `false`. */ - clearPendingEvents: function () + hasTarget: function (target) { - this._pendingInsertion = []; + var data = this.data; - return this; + for (var i = 0; i < this.totalData; i++) + { + if (data[i].hasTarget(target)) + { + return true; + } + } + + return false; }, /** - * Removes the given Timer Event, or an array of Timer Events, from this Clock. - * - * The events are removed from all internal lists (active, pending and removal), - * freeing the event up to be re-used. + * Restarts the TweenChain from the beginning. * - * @method Phaser.Time.Clock#removeEvent - * @since 3.50.0 + * If this TweenChain was configured to have a loop, or start delay, those + * are reset to their initial values as well. It will also dispatch the + * `onActive` callback and event again. * - * @param {(Phaser.Time.TimerEvent | Phaser.Time.TimerEvent[])} events - The Timer Event, or an array of Timer Events, to remove from this Clock. + * @method Phaser.Tweens.TweenChain#restart + * @since 3.60.0 * - * @return {this} - This Clock instance. + * @return {this} This TweenChain instance. */ - removeEvent: function (events) + restart: function () { - if (!Array.isArray(events)) + if (this.isDestroyed()) { - events = [ events ]; + console.warn('Cannot restart destroyed TweenChain', this); + + return this; } - for (var i = 0; i < events.length; i++) + if (this.isRemoved()) { - var event = events[i]; - - Remove(this._pendingRemoval, event); - Remove(this._pendingInsertion, event); - Remove(this._active, event); + this.parent.makeActive(this); } - return this; + this.resetTweens(); + + this.paused = false; + + return this.init(); }, /** - * Schedules all active Timer Events for removal at the start of the frame. + * Resets the given Tween. * - * @method Phaser.Time.Clock#removeAllEvents - * @since 3.0.0 + * It will seek to position 0 and playback will start on the next frame. * - * @return {this} - This Clock instance. + * @method Phaser.Tweens.TweenChain#reset + * @since 3.60.0 + * + * @param {Phaser.Tweens.Tween} tween - The Tween to be reset. + * + * @return {this} This TweenChain instance. */ - removeAllEvents: function () + reset: function (tween) { - this._pendingRemoval = this._pendingRemoval.concat(this._active); + tween.seek(); + + tween.setActiveState(); return this; }, /** - * Updates the arrays of active and pending Timer Events. Called at the start of the frame. + * Re-initiases the given Tween and sets it to the Active state. * - * @method Phaser.Time.Clock#preUpdate - * @since 3.0.0 + * @method Phaser.Tweens.TweenChain#makeActive + * @since 3.60.0 + * @override * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * @param {Phaser.Tweens.Tween} tween - The Tween to check. + * + * @return {this} This TweenChain instance. */ - preUpdate: function () + makeActive: function (tween) { - var toRemove = this._pendingRemoval.length; - var toInsert = this._pendingInsertion.length; + tween.reset(); - if (toRemove === 0 && toInsert === 0) - { - // Quick bail - return; - } + tween.setActiveState(); - var i; - var event; + return this; + }, - // Delete old events - for (i = 0; i < toRemove; i++) + /** + * Internal method that advances to the next state of the TweenChain playback. + * + * @method Phaser.Tweens.TweenChain#nextState + * @fires Phaser.Tweens.Events#TWEEN_COMPLETE + * @fires Phaser.Tweens.Events#TWEEN_LOOP + * @since 3.60.0 + * + * @return {boolean} `true` if this TweenChain has completed, otherwise `false`. + */ + nextState: function () + { + if (this.loopCounter > 0) { - event = this._pendingRemoval[i]; + this.loopCounter--; - var index = this._active.indexOf(event); + this.resetTweens(); - if (index > -1) + if (this.loopDelay > 0) { - this._active.splice(index, 1); + this.countdown = this.loopDelay; + + this.setLoopDelayState(); } + else + { + this.setActiveState(); - // Pool them? - event.destroy(); + this.dispatchEvent(Events.TWEEN_LOOP, 'onLoop'); + } } + else if (this.completeDelay > 0) + { + this.countdown = this.completeDelay; - for (i = 0; i < toInsert; i++) + this.setCompleteDelayState(); + } + else { - event = this._pendingInsertion[i]; + this.onCompleteHandler(); - this._active.push(event); + return true; } - // Clear the lists - this._pendingRemoval.length = 0; - this._pendingInsertion.length = 0; + return false; }, /** - * Updates the Clock's internal time and all of its Timer Events. + * Starts this TweenChain playing. * - * @method Phaser.Time.Clock#update - * @since 3.0.0 + * You only need to call this method if you have configured this TweenChain to be paused on creation. * - * @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * If the TweenChain is already playing, calling this method again will have no effect. If you wish to + * restart the chain, use `TweenChain.restart` instead. + * + * Calling this method after the TweenChain has completed will start the chain playing again from the beginning. + * + * @method Phaser.Tweens.TweenChain#play + * @since 3.60.0 + * + * @return {this} This TweenChain instance. */ - update: function (time, delta) + play: function () { - this.now = time; - - if (this.paused) + if (this.isDestroyed()) { - return; - } + console.warn('Cannot play destroyed TweenChain', this); - delta *= this.timeScale; + return this; + } - for (var i = 0; i < this._active.length; i++) + if (this.isPendingRemove() || this.isPending()) { - var event = this._active[i]; - - if (event.paused) - { - continue; - } - - // Use delta time to increase elapsed. - // Avoids needing to adjust for pause / resume. - // Automatically smoothed by TimeStep class. - // In testing accurate to +- 1ms! - event.elapsed += delta * event.timeScale; - - if (event.elapsed >= event.delay) - { - var remainder = event.elapsed - event.delay; - - // Limit it, in case it's checked in the callback - event.elapsed = event.delay; - - // Process the event - if (!event.hasDispatched && event.callback) - { - event.hasDispatched = true; - event.callback.apply(event.callbackScope, event.args); - } + this.resetTweens(); + } - if (event.repeatCount > 0) - { - event.repeatCount--; + this.paused = false; - event.elapsed = remainder; - event.hasDispatched = false; - } - else - { - this._pendingRemoval.push(event); - } - } + if (this.startDelay > 0 && !this.isStartDelayed()) + { + this.setStartDelayState(); + } + else + { + this.setActiveState(); } + + return this; }, /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. + * Internal method that resets all of the Tweens and the current index pointer. * - * @method Phaser.Time.Clock#shutdown - * @private - * @since 3.0.0 + * @method Phaser.Tweens.TweenChain#resetTweens + * @since 3.60.0 */ - shutdown: function () + resetTweens: function () { - var i; - - for (i = 0; i < this._pendingInsertion.length; i++) - { - this._pendingInsertion[i].destroy(); - } - - for (i = 0; i < this._active.length; i++) - { - this._active[i].destroy(); - } + var data = this.data; + var total = this.totalData; - for (i = 0; i < this._pendingRemoval.length; i++) + for (var i = 0; i < total; i++) { - this._pendingRemoval[i].destroy(); + data[i].reset(false); } - this._active.length = 0; - this._pendingRemoval.length = 0; - this._pendingInsertion.length = 0; - - var eventEmitter = this.systems.events; - - eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); - eventEmitter.off(SceneEvents.UPDATE, this.update, this); - eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); + this.currentIndex = 0; + this.currentTween = data[0]; }, /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. + * Internal method that advances the TweenChain based on the time values. * - * @method Phaser.Time.Clock#destroy - * @private - * @since 3.0.0 + * @method Phaser.Tweens.TweenChain#update + * @fires Phaser.Tweens.Events#TWEEN_COMPLETE + * @fires Phaser.Tweens.Events#TWEEN_LOOP + * @fires Phaser.Tweens.Events#TWEEN_START + * @since 3.60.0 + * + * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * + * @return {boolean} Returns `true` if this TweenChain has finished and should be removed from the Tween Manager, otherwise returns `false`. */ - destroy: function () + update: function (delta) { - this.shutdown(); - - this.scene.sys.events.off(SceneEvents.START, this.start, this); - - this.scene = null; - this.systems = null; - } - -}); - -PluginCache.register('Clock', Clock, 'time'); - -module.exports = Clock; - - -/***/ }), -/* 1463 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var CONST = __webpack_require__(100); -var Extend = __webpack_require__(17); - -/** - * @namespace Phaser.Tweens - */ - -var Tweens = { - - Builders: __webpack_require__(1464), - Events: __webpack_require__(267), - - TweenManager: __webpack_require__(1480), - Tween: __webpack_require__(266), - TweenData: __webpack_require__(268), - Timeline: __webpack_require__(588) - -}; - -// Merge in the consts -Tweens = Extend(false, Tweens, CONST); - -module.exports = Tweens; - - -/***/ }), -/* 1464 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Tweens.Builders - */ - -module.exports = { - - GetBoolean: __webpack_require__(99), - GetEaseFunction: __webpack_require__(80), - GetNewValue: __webpack_require__(162), - GetProps: __webpack_require__(583), - GetTargets: __webpack_require__(263), - GetTweens: __webpack_require__(584), - GetValueOp: __webpack_require__(264), - NumberTweenBuilder: __webpack_require__(585), - StaggerBuilder: __webpack_require__(586), - TimelineBuilder: __webpack_require__(587), - TweenBuilder: __webpack_require__(163) - -}; - - -/***/ }), -/* 1465 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -// RESERVED properties that a Tween config object uses - -// completeDelay: The time the tween will wait before the onComplete event is dispatched once it has completed -// delay: The time the tween will wait before it first starts -// duration: The duration of the tween -// ease: The ease function used by the tween -// easeParams: The parameters to go with the ease function (if any) -// flipX: flip X the GameObject on tween end -// flipY: flip Y the GameObject on tween end// hold: The time the tween will pause before running a yoyo -// hold: The time the tween will pause before running a yoyo -// loop: The time the tween will pause before starting either a yoyo or returning to the start for a repeat -// loopDelay: -// offset: Used when the Tween is part of a Timeline -// paused: Does the tween start in a paused state, or playing? -// props: The properties being tweened by the tween -// repeat: The number of times the tween will repeat itself (a value of 1 means the tween will play twice, as it repeated once) -// repeatDelay: The time the tween will pause for before starting a repeat. The tween holds in the start state. -// targets: The targets the tween is updating. -// useFrames: Use frames or milliseconds? -// yoyo: boolean - Does the tween reverse itself (yoyo) when it reaches the end? - -module.exports = [ - 'callbackScope', - 'completeDelay', - 'delay', - 'duration', - 'ease', - 'easeParams', - 'flipX', - 'flipY', - 'hold', - 'loop', - 'loopDelay', - 'offset', - 'onActive', - 'onActiveParams', - 'onActiveScope', - 'onComplete', - 'onCompleteParams', - 'onCompleteScope', - 'onLoop', - 'onLoopParams', - 'onLoopScope', - 'onRepeat', - 'onRepeatParams', - 'onRepeatScope', - 'onStart', - 'onStartParams', - 'onStartScope', - 'onStop', - 'onStopParams', - 'onStopScope', - 'onUpdate', - 'onUpdateParams', - 'onUpdateScope', - 'onYoyo', - 'onYoyoParams', - 'onYoyoScope', - 'paused', - 'props', - 'repeat', - 'repeatDelay', - 'targets', - 'useFrames', - 'yoyo' -]; - - -/***/ }), -/* 1466 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Timeline Complete Event. - * - * This event is dispatched by a Tween Timeline when it completes playback. - * - * Listen to it from a Timeline instance using `Timeline.on('complete', listener)`, i.e.: - * - * ```javascript - * var timeline = this.tweens.timeline({ - * targets: image, - * ease: 'Power1', - * duration: 3000, - * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] - * }); - * timeline.on('complete', listener); - * timeline.play(); - * ``` - * - * @event Phaser.Tweens.Events#TIMELINE_COMPLETE - * @since 3.0.0 - * - * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. - */ -module.exports = 'complete'; - - -/***/ }), -/* 1467 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Timeline Loop Event. - * - * This event is dispatched by a Tween Timeline every time it loops. - * - * Listen to it from a Timeline instance using `Timeline.on('loop', listener)`, i.e.: - * - * ```javascript - * var timeline = this.tweens.timeline({ - * targets: image, - * ease: 'Power1', - * duration: 3000, - * loop: 4, - * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] - * }); - * timeline.on('loop', listener); - * timeline.play(); - * ``` - * - * @event Phaser.Tweens.Events#TIMELINE_LOOP - * @since 3.0.0 - * - * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. - */ -module.exports = 'loop'; - - -/***/ }), -/* 1468 */ -/***/ (function(module, exports) { + if (this.isPendingRemove() || this.isDestroyed()) + { + return true; + } + else if (this.isFinished() || this.paused) + { + return false; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // The TweehChain.timeScale is applied within Tween.update, so doesn't need including here + delta *= this.parent.timeScale; -/** - * The Timeline Pause Event. - * - * This event is dispatched by a Tween Timeline when it is paused. - * - * Listen to it from a Timeline instance using `Timeline.on('pause', listener)`, i.e.: - * - * ```javascript - * var timeline = this.tweens.timeline({ - * targets: image, - * ease: 'Power1', - * duration: 3000, - * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] - * }); - * timeline.on('pause', listener); - * // At some point later ... - * timeline.pause(); - * ``` - * - * @event Phaser.Tweens.Events#TIMELINE_PAUSE - * @since 3.0.0 - * - * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. - */ -module.exports = 'pause'; + if (this.isLoopDelayed()) + { + this.updateLoopCountdown(delta); + } + else if (this.isCompleteDelayed()) + { + this.updateCompleteDelay(delta); + } + else if (this.isStartDelayed()) + { + // Reset the delta so we always start progress from zero + delta = this.updateStartCountdown(delta); + } + var remove = false; -/***/ }), -/* 1469 */ -/***/ (function(module, exports) { + if (this.isActive() && this.currentTween) + { + if (this.currentTween.update(delta)) + { + // This tween has finshed playback, so move to the next one + if (this.nextTween()) + { + this.nextState(); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // if nextState called onCompleteHandler then we're ready to be removed, unless we persist + remove = this.isPendingRemove(); -/** - * The Timeline Resume Event. - * - * This event is dispatched by a Tween Timeline when it is resumed from a paused state. - * - * Listen to it from a Timeline instance using `Timeline.on('resume', listener)`, i.e.: - * - * ```javascript - * var timeline = this.tweens.timeline({ - * targets: image, - * ease: 'Power1', - * duration: 3000, - * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] - * }); - * timeline.on('resume', listener); - * // At some point later ... - * timeline.resume(); - * ``` - * - * @event Phaser.Tweens.Events#TIMELINE_RESUME - * @since 3.0.0 - * - * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. - */ -module.exports = 'resume'; + if (remove && this.persist) + { + this.setFinishedState(); + remove = false; + } + } -/***/ }), -/* 1470 */ -/***/ (function(module, exports) { + return remove; + }, -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + /** + * Immediately advances to the next Tween in the chain. + * + * This is typically called internally, but can be used if you need to + * advance playback for some reason. + * + * @method Phaser.Tweens.TweenChain#nextTween + * @since 3.60.0 + * + * @return {boolean} `true` if there are no more Tweens in the chain, otherwise `false`. + */ + nextTween: function () + { + this.currentIndex++; -/** - * The Timeline Start Event. - * - * This event is dispatched by a Tween Timeline when it starts. - * - * Listen to it from a Timeline instance using `Timeline.on('start', listener)`, i.e.: - * - * ```javascript - * var timeline = this.tweens.timeline({ - * targets: image, - * ease: 'Power1', - * duration: 3000, - * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] - * }); - * timeline.on('start', listener); - * timeline.play(); - * ``` - * - * @event Phaser.Tweens.Events#TIMELINE_START - * @since 3.0.0 - * - * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. - */ -module.exports = 'start'; + if (this.currentIndex === this.totalData) + { + return true; + } + else + { + this.setCurrentTween(this.currentIndex); + } + return false; + }, -/***/ }), -/* 1471 */ -/***/ (function(module, exports) { + /** + * Sets the current active Tween to the given index, based on its + * entry in the TweenChain data array. + * + * @method Phaser.Tweens.TweenChain#setCurrentTween + * @since 3.60.0 + * + * @param {number} index - The index of the Tween to be made current. + */ + setCurrentTween: function (index) + { + this.currentIndex = index; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + this.currentTween = this.data[index]; -/** - * The Timeline Update Event. - * - * This event is dispatched by a Tween Timeline every time it updates, which can happen a lot of times per second, - * so be careful about listening to this event unless you absolutely require it. - * - * Listen to it from a Timeline instance using `Timeline.on('update', listener)`, i.e.: - * - * ```javascript - * var timeline = this.tweens.timeline({ - * targets: image, - * ease: 'Power1', - * duration: 3000, - * tweens: [ { x: 600 }, { y: 500 }, { x: 100 }, { y: 100 } ] - * }); - * timeline.on('update', listener); - * timeline.play(); - * ``` - * - * @event Phaser.Tweens.Events#TIMELINE_UPDATE - * @since 3.0.0 - * - * @param {Phaser.Tweens.Timeline} timeline - A reference to the Timeline instance that emitted the event. - */ -module.exports = 'update'; + this.currentTween.setActiveState(); + this.currentTween.dispatchEvent(Events.TWEEN_ACTIVE, 'onActive'); + }, -/***/ }), -/* 1472 */ -/***/ (function(module, exports) { + /** + * Internal method that will emit a TweenChain based Event and invoke the given callback. + * + * @method Phaser.Tweens.TweenChain#dispatchEvent + * @since 3.60.0 + * + * @param {Phaser.Types.Tweens.Event} event - The Event to be dispatched. + * @param {Phaser.Types.Tweens.TweenCallbackTypes} [callback] - The name of the callback to be invoked. Can be `null` or `undefined` to skip invocation. + */ + dispatchEvent: function (event, callback) + { + this.emit(event, this); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + var handler = this.callbacks[callback]; -/** - * The Tween Active Event. - * - * This event is dispatched by a Tween when it becomes active within the Tween Manager. - * - * An 'active' Tween is one that is now progressing, although it may not yet be updating - * any target properties, due to settings such as `delay`. If you need an event for when - * the Tween starts actually updating its first property, see `TWEEN_START`. - * - * Listen to it from a Tween instance using `Tween.on('active', listener)`, i.e.: - * - * ```javascript - * var tween = this.tweens.add({ - * targets: image, - * x: 500, - * ease: 'Power1', - * duration: 3000 - * }); - * tween.on('active', listener); - * ``` - * - * @event Phaser.Tweens.Events#TWEEN_ACTIVE - * @since 3.19.0 - * - * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. - * @param {any[]} targets - An array of references to the target/s the Tween is operating on. - */ -module.exports = 'active'; + if (handler) + { + handler.func.apply(this.callbackScope, [ this ].concat(handler.params)); + } + }, + /** + * Immediately destroys this TweenChain, nulling of all its references. + * + * @method Phaser.Tweens.TweenChain#destroy + * @since 3.60.0 + */ + destroy: function () + { + BaseTween.prototype.destroy.call(this); -/***/ }), -/* 1473 */ -/***/ (function(module, exports) { + this.currentTween = null; + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ +}); /** - * The Tween Complete Event. - * - * This event is dispatched by a Tween when it completes playback entirely, factoring in repeats and loops. - * - * If the Tween has been set to loop or repeat infinitely, this event will not be dispatched - * unless the `Tween.stop` method is called. - * - * If a Tween has a `completeDelay` set, this event will fire after that delay expires. - * - * Listen to it from a Tween instance using `Tween.on('complete', listener)`, i.e.: - * - * ```javascript - * var tween = this.tweens.add({ - * targets: image, - * x: 500, - * ease: 'Power1', - * duration: 3000 - * }); - * tween.on('complete', listener); - * ``` + * Creates a new TweenChain object and adds it to the Tween Manager. * - * @event Phaser.Tweens.Events#TWEEN_COMPLETE - * @since 3.19.0 - * - * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. - * @param {any[]} targets - An array of references to the target/s the Tween is operating on. - */ -module.exports = 'complete'; - - -/***/ }), -/* 1474 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Tween Loop Event. - * - * This event is dispatched by a Tween when it loops. - * - * This event will only be dispatched if the Tween has a loop count set. - * - * If a Tween has a `loopDelay` set, this event will fire after that delay expires. - * - * The difference between `loop` and `repeat` is that `repeat` is a property setting, - * where-as `loop` applies to the entire Tween. - * - * Listen to it from a Tween instance using `Tween.on('loop', listener)`, i.e.: - * - * ```javascript - * var tween = this.tweens.add({ - * targets: image, - * x: 500, - * ease: 'Power1', - * duration: 3000, - * loop: 6 - * }); - * tween.on('loop', listener); - * ``` + * Note: This method will only be available if Tweens have been built into Phaser. * - * @event Phaser.Tweens.Events#TWEEN_LOOP - * @since 3.19.0 - * - * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. - * @param {any[]} targets - An array of references to the target/s the Tween is operating on. - */ -module.exports = 'loop'; - - -/***/ }), -/* 1475 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Tween Repeat Event. - * - * This event is dispatched by a Tween when one of the properties it is tweening repeats. - * - * This event will only be dispatched if the Tween has a property with a repeat count set. - * - * If a Tween has a `repeatDelay` set, this event will fire after that delay expires. - * - * The difference between `loop` and `repeat` is that `repeat` is a property setting, - * where-as `loop` applies to the entire Tween. - * - * Listen to it from a Tween instance using `Tween.on('repeat', listener)`, i.e.: - * - * ```javascript - * var tween = this.tweens.add({ - * targets: image, - * x: 500, - * ease: 'Power1', - * duration: 3000, - * repeat: 4 - * }); - * tween.on('repeat', listener); - * ``` + * @method Phaser.GameObjects.GameObjectFactory#tweenchain + * @since 3.60.0 * - * @event Phaser.Tweens.Events#TWEEN_REPEAT - * @since 3.19.0 - * - * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. - * @param {string} key - The key of the property that just repeated. - * @param {any} target - The target that the property just repeated on. - */ -module.exports = 'repeat'; - - -/***/ }), -/* 1476 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Tween Start Event. - * - * This event is dispatched by a Tween when it starts tweening its first property. - * - * A Tween will only emit this event once, as it can only start once. - * - * If a Tween has a `delay` set, this event will fire after that delay expires. - * - * Listen to it from a Tween instance using `Tween.on('start', listener)`, i.e.: - * - * ```javascript - * var tween = this.tweens.add({ - * targets: image, - * x: 500, - * ease: 'Power1', - * duration: 3000 - * }); - * tween.on('start', listener); - * ``` + * @param {Phaser.Types.Tweens.TweenBuilderConfig|object} config - The TweenChain configuration. * - * @event Phaser.Tweens.Events#TWEEN_START - * @since 3.19.0 - * - * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. - * @param {any[]} targets - An array of references to the target/s the Tween is operating on. - */ -module.exports = 'start'; - - -/***/ }), -/* 1477 */ -/***/ (function(module, exports) { - -/** - * @author samme - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * @return {Phaser.Tweens.TweenChain} The TweenChain that was created. */ +GameObjectFactory.register('tweenchain', function (config) +{ + return this.scene.sys.tweens.chain(config); +}); /** - * The Tween Stop Event. - * - * This event is dispatched by a Tween when it is stopped. + * Creates a new TweenChain object and returns it, without adding it to the Tween Manager. * - * Listen to it from a Tween instance using `Tween.on('stop', listener)`, i.e.: + * Note: This method will only be available if Tweens have been built into Phaser. * - * ```javascript - * var tween = this.tweens.add({ - * targets: image, - * x: 500, - * ease: 'Power1', - * duration: 3000 - * }); - * tween.on('stop', listener); - * ``` + * @method Phaser.GameObjects.GameObjectCreator#tweenchain + * @since 3.60.0 * - * @event Phaser.Tweens.Events#TWEEN_STOP - * @since 3.24.0 + * @param {Phaser.Types.Tweens.TweenBuilderConfig|object} config - The TweenChain configuration. * - * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. - * @param {any[]} targets - An array of references to the target/s the Tween is operating on. - */ -module.exports = 'stop'; - - -/***/ }), -/* 1478 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} + * @return {Phaser.Tweens.TweenChain} The TweenChain that was created. */ +GameObjectCreator.register('tweenchain', function (config) +{ + return this.scene.sys.tweens.create(config); +}); -/** - * The Tween Update Event. - * - * This event is dispatched by a Tween every time it updates _any_ of the properties it is tweening. - * - * A Tween that is changing 3 properties of a target will emit this event 3 times per change, once per property. - * - * **Note:** This is a very high frequency event and may be dispatched multiple times, every single frame. - * - * Listen to it from a Tween instance using `Tween.on('update', listener)`, i.e.: - * - * ```javascript - * var tween = this.tweens.add({ - * targets: image, - * x: 500, - * ease: 'Power1', - * duration: 3000, - * }); - * tween.on('update', listener); - * ``` - * - * @event Phaser.Tweens.Events#TWEEN_UPDATE - * @since 3.19.0 - * - * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. - * @param {string} key - The property that was updated, i.e. `x` or `scale`. - * @param {any} target - The target object that was updated. Usually a Game Object, but can be of any type. - * @param {number} current - The current value of the property that was tweened. - * @param {number} previous - The previous value of the property that was tweened, prior to this update. - */ -module.exports = 'update'; +module.exports = TweenChain; /***/ }), -/* 1479 */ -/***/ (function(module, exports) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * The Tween Yoyo Event. - * - * This event is dispatched by a Tween whenever a property it is tweening yoyos. - * - * This event will only be dispatched if the Tween has a property with `yoyo` set. - * - * If the Tween has a `hold` value, this event is dispatched when the hold expires. - * - * This event is dispatched for every property, and for every target, that yoyos. - * For example, if a Tween was updating 2 properties and had 10 targets, this event - * would be dispatched 20 times (twice per target). So be careful how you use it! - * - * Listen to it from a Tween instance using `Tween.on('yoyo', listener)`, i.e.: - * - * ```javascript - * var tween = this.tweens.add({ - * targets: image, - * x: 500, - * ease: 'Power1', - * duration: 3000, - * yoyo: true - * }); - * tween.on('yoyo', listener); - * ``` - * - * @event Phaser.Tweens.Events#TWEEN_YOYO - * @since 3.19.0 - * - * @param {Phaser.Tweens.Tween} tween - A reference to the Tween instance that emitted the event. - * @param {string} key - The property that yoyo'd, i.e. `x` or `scale`. - * @param {any} target - The target object that was yoyo'd. Usually a Game Object, but can be of any type. - */ -module.exports = 'yoyo'; - -/***/ }), -/* 1480 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ 15718: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var ArrayRemove = __webpack_require__(93); -var Class = __webpack_require__(0); -var NumberTweenBuilder = __webpack_require__(585); -var PluginCache = __webpack_require__(24); -var SceneEvents = __webpack_require__(20); -var StaggerBuilder = __webpack_require__(586); -var TimelineBuilder = __webpack_require__(587); -var TWEEN_CONST = __webpack_require__(100); -var TweenBuilder = __webpack_require__(163); +var BaseTweenData = __webpack_require__(65521); +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(54272); /** * @classdesc - * The Tween Manager is a default Scene Plugin which controls and updates Tweens and Timelines. + * The TweenData is a class that contains a single target and property that is being tweened. * - * @class TweenManager + * Tweens create TweenData instances when they are created, with one TweenData instance per + * target, per property. A Tween can own multiple TweenData instances, but a TweenData only + * ever belongs to a single Tween. + * + * You should not typically create these yourself, but rather use the TweenBuilder, + * or the `Tween.add` method. + * + * Prior to Phaser 3.60 the TweenData was just an object, but was refactored to a class, + * to make it responsible for its own state and updating. + * + * @class TweenData * @memberof Phaser.Tweens + * @extends Phaser.Tweens.BaseTweenData * @constructor - * @since 3.0.0 + * @since 3.60.0 * - * @param {Phaser.Scene} scene - The Scene which owns this Tween Manager. + * @param {Phaser.Tweens.Tween} tween - The tween this TweenData instance belongs to. + * @param {number} targetIndex - The target index within the Tween targets array. + * @param {string} key - The property of the target to tween. + * @param {Phaser.Types.Tweens.GetEndCallback} getEnd - What the property will be at the END of the Tween. + * @param {Phaser.Types.Tweens.GetStartCallback} getStart - What the property will be at the START of the Tween. + * @param {?Phaser.Types.Tweens.GetActiveCallback} getActive - If not null, is invoked _immediately_ as soon as the TweenData is running, and is set on the target property. + * @param {function} ease - The ease function this tween uses. + * @param {function} delay - Function that returns the time in milliseconds before tween will start. + * @param {number} duration - The duration of the tween in milliseconds. + * @param {boolean} yoyo - Determines whether the tween should return back to its start value after hold has expired. + * @param {number} hold - Function that returns the time in milliseconds the tween will pause before repeating or returning to its starting value if yoyo is set to true. + * @param {number} repeat - Function that returns the number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @param {number} repeatDelay - Function that returns the time in milliseconds before the repeat will start. + * @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens? + * @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens? + * @param {?function} interpolation - The interpolation function to be used for arrays of data. Defaults to 'null'. + * @param {?number[]} interpolationData - The array of interpolation data to be set. Defaults to 'null'. */ -var TweenManager = new Class({ +var TweenData = new Class({ + + Extends: BaseTweenData, initialize: - function TweenManager (scene) + function TweenData (tween, targetIndex, key, getEnd, getStart, getActive, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY, interpolation, interpolationData) { + BaseTweenData.call(this, tween, targetIndex, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY); + /** - * The Scene which owns this Tween Manager. + * The property of the target to be tweened. * - * @name Phaser.Tweens.TweenManager#scene - * @type {Phaser.Scene} - * @since 3.0.0 + * @name Phaser.Tweens.TweenData#key + * @type {string} + * @readonly + * @since 3.60.0 */ - this.scene = scene; + this.key = key; /** - * The Systems object of the Scene which owns this Tween Manager. + * A function that returns what to set the target property to, + * the moment the TweenData is invoked. * - * @name Phaser.Tweens.TweenManager#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 + * This is called when this TweenData is inititalised or reset. + * + * @name Phaser.Tweens.TweenData#getActiveValue + * @type {?Phaser.Types.Tweens.GetActiveCallback} + * @since 3.60.0 */ - this.systems = scene.sys; + this.getActiveValue = getActive; /** - * The time scale of the Tween Manager. + * A function that returns what to set the target property to + * at the end of the tween. * - * This value scales the time delta between two frames, thus influencing the speed of time for all Tweens owned by this Tween Manager. + * This is called when the tween starts playing, after any initial + * start delay, or if the tween is reset, or is set to repeat. * - * @name Phaser.Tweens.TweenManager#timeScale - * @type {number} - * @default 1 - * @since 3.0.0 + * @name Phaser.Tweens.TweenData#getEndValue + * @type {Phaser.Types.Tweens.GetEndCallback} + * @since 3.60.0 */ - this.timeScale = 1; + this.getEndValue = getEnd; /** - * An array of Tweens and Timelines which will be added to the Tween Manager at the start of the frame. + * A function that returns what to set the target property to + * at the start of the tween. * - * @name Phaser.Tweens.TweenManager#_add - * @type {array} - * @private - * @since 3.0.0 + * This is called when the tween starts playing, after any initial + * start delay, or if the tween is reset, or is set to repeat. + * + * @name Phaser.Tweens.TweenData#getStartValue + * @type {Phaser.Types.Tweens.GetStartCallback} + * @since 3.60.0 */ - this._add = []; + this.getStartValue = getStart; /** - * An array of Tweens and Timelines pending to be later added to the Tween Manager. + * The ease function this Tween uses to calculate the target value. * - * @name Phaser.Tweens.TweenManager#_pending - * @type {array} - * @private - * @since 3.0.0 + * @name Phaser.Tweens.TweenData#ease + * @type {function} + * @since 3.60.0 */ - this._pending = []; + this.ease = ease; /** - * An array of Tweens and Timelines which are still incomplete and are actively processed by the Tween Manager. + * The targets starting value, as returned by `getStartValue`. * - * @name Phaser.Tweens.TweenManager#_active - * @type {array} - * @private - * @since 3.0.0 + * @name Phaser.Tweens.TweenData#start + * @type {number} + * @since 3.60.0 */ - this._active = []; + this.start = 0; /** - * An array of Tweens and Timelines which will be removed from the Tween Manager at the start of the frame. + * The target value from the previous step. * - * @name Phaser.Tweens.TweenManager#_destroy - * @type {array} - * @private - * @since 3.0.0 + * @name Phaser.Tweens.TweenData#previous + * @type {number} + * @since 3.60.0 */ - this._destroy = []; + this.previous = 0; /** - * The number of Tweens and Timelines which need to be processed by the Tween Manager at the start of the frame. + * The targets current value, as recorded in the most recent step. * - * @name Phaser.Tweens.TweenManager#_toProcess + * @name Phaser.Tweens.TweenData#current * @type {number} - * @private - * @default 0 - * @since 3.0.0 + * @since 3.60.0 */ - this._toProcess = 0; - - scene.sys.events.once(SceneEvents.BOOT, this.boot, this); - scene.sys.events.on(SceneEvents.START, this.start, this); - }, - - /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. - * - * @method Phaser.Tweens.TweenManager#boot - * @private - * @since 3.5.1 - */ - boot: function () - { - this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); - }, + this.current = 0; - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. - * - * @method Phaser.Tweens.TweenManager#start - * @private - * @since 3.5.0 - */ - start: function () - { - var eventEmitter = this.systems.events; + /** + * The targets ending value, as returned by `getEndValue`. + * + * @name Phaser.Tweens.TweenData#end + * @type {number} + * @since 3.60.0 + */ + this.end = 0; - eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this); - eventEmitter.on(SceneEvents.UPDATE, this.update, this); - eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); + /** + * The interpolation function to be used for arrays of data. + * + * @name Phaser.Tweens.TweenData#interpolation + * @type {?function} + * @default null + * @since 3.60.0 + */ + this.interpolation = interpolation; - this.timeScale = 1; + /** + * The array of data to interpolate, if interpolation is being used. + * + * @name Phaser.Tweens.TweenData#interpolationData + * @type {?number[]} + * @since 3.60.0 + */ + this.interpolationData = interpolationData; }, /** - * Create a Tween Timeline and return it, but do NOT add it to the active or pending Tween lists. + * Internal method that resets this Tween Data entirely, including the progress and elapsed values. * - * @method Phaser.Tweens.TweenManager#createTimeline - * @since 3.0.0 + * Called automatically by the parent Tween. Should not be called directly. * - * @param {Phaser.Types.Tweens.TimelineBuilderConfig} [config] - The configuration object for the Timeline and its Tweens. + * @method Phaser.Tweens.TweenData#reset + * @since 3.60.0 * - * @return {Phaser.Tweens.Timeline} The created Timeline object. + * @param {boolean} [isSeeking=false] - Is the Tween Data being reset as part of a Tween seek? */ - createTimeline: function (config) + reset: function (isSeeking) { - return TimelineBuilder(this, config); - }, + BaseTweenData.prototype.reset.call(this); - /** - * Create a Tween Timeline and add it to the active Tween list. - * - * @method Phaser.Tweens.TweenManager#timeline - * @since 3.0.0 - * - * @param {Phaser.Types.Tweens.TimelineBuilderConfig} [config] - The configuration object for the Timeline and its Tweens. - * - * @return {Phaser.Tweens.Timeline} The created Timeline object. - */ - timeline: function (config) - { - var timeline = TimelineBuilder(this, config); + var target = this.tween.targets[this.targetIndex]; + var key = this.key; - if (!timeline.paused) + if (isSeeking) { - this._add.push(timeline); - - this._toProcess++; + target[key] = this.start; } - return timeline; - }, + this.start = 0; + this.previous = 0; + this.current = 0; + this.end = 0; - /** - * Create a Tween and return it, but do NOT add it to the active or pending Tween lists. - * - * @method Phaser.Tweens.TweenManager#create - * @since 3.0.0 - * - * @param {Phaser.Types.Tweens.TweenBuilderConfig|object} config - The configuration object for the Tween. - * - * @return {Phaser.Tweens.Tween} The created Tween object. - */ - create: function (config) - { - return TweenBuilder(this, config); + if (this.getActiveValue) + { + target[key] = this.getActiveValue(target, key, 0); + } }, /** - * Create a Tween and add it to the active Tween list. + * Internal method that advances this TweenData based on the delta value given. * - * @method Phaser.Tweens.TweenManager#add - * @since 3.0.0 + * @method Phaser.Tweens.TweenData#update + * @fires Phaser.Tweens.Events#TWEEN_UPDATE + * @fires Phaser.Tweens.Events#TWEEN_REPEAT + * @since 3.60.0 * - * @param {Phaser.Types.Tweens.TweenBuilderConfig|object} config - The configuration object for the Tween. + * @param {number} delta - The elapsed delta time in ms. * - * @return {Phaser.Tweens.Tween} The created Tween. + * @return {boolean} `true` if this TweenData is still playing, or `false` if it has finished entirely. */ - add: function (config) + update: function (delta) { - var tween = TweenBuilder(this, config); + var tween = this.tween; + var totalTargets = tween.totalTargets; - this._add.push(tween); + var targetIndex = this.targetIndex; + var target = tween.targets[targetIndex]; + var key = this.key; - this._toProcess++; + // Bail out if we don't have a target to act upon + if (!target) + { + this.setCompleteState(); - return tween; - }, + return false; + } - /** - * Add an existing tween into the active Tween list. - * - * @method Phaser.Tweens.TweenManager#existing - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - The Tween to add. - * - * @return {Phaser.Tweens.TweenManager} This Tween Manager object. - */ - existing: function (tween) - { - this._add.push(tween); + if (this.isCountdown) + { + this.elapsed -= delta; - this._toProcess++; + if (this.elapsed <= 0) + { + this.elapsed = 0; - return this; - }, + delta = 0; - /** - * Create a Number Tween and add it to the active Tween list. - * - * @method Phaser.Tweens.TweenManager#addCounter - * @since 3.0.0 - * - * @param {Phaser.Types.Tweens.NumberTweenBuilderConfig} config - The configuration object for the Number Tween. - * - * @return {Phaser.Tweens.Tween} The created Number Tween. - */ - addCounter: function (config) - { - var tween = NumberTweenBuilder(this, config); + if (this.isDelayed()) + { + this.setPendingRenderState(); + } + else if (this.isRepeating()) + { + this.setPlayingForwardState(); - this._add.push(tween); + this.dispatchEvent(Events.TWEEN_REPEAT, 'onRepeat'); + } + else if (this.isHolding()) + { + this.setStateFromEnd(0); + } + } + } - this._toProcess++; + // All of the above have the ability to change the state, so put this in its own check - return tween; - }, + if (this.isPendingRender()) + { + this.start = this.getStartValue(target, key, target[key], targetIndex, totalTargets, tween); - /** - * Creates a Stagger function to be used by a Tween property. - * - * The stagger function will allow you to stagger changes to the value of the property across all targets of the tween. - * - * This is only worth using if the tween has multiple targets. - * - * The following will stagger the delay by 100ms across all targets of the tween, causing them to scale down to 0.2 - * over the duration specified: - * - * ```javascript - * this.tweens.add({ - * targets: [ ... ], - * scale: 0.2, - * ease: 'linear', - * duration: 1000, - * delay: this.tweens.stagger(100) - * }); - * ``` - * - * The following will stagger the delay by 500ms across all targets of the tween using a 10 x 6 grid, staggering - * from the center out, using a cubic ease. - * - * ```javascript - * this.tweens.add({ - * targets: [ ... ], - * scale: 0.2, - * ease: 'linear', - * duration: 1000, - * delay: this.tweens.stagger(500, { grid: [ 10, 6 ], from: 'center', ease: 'cubic.out' }) - * }); - * ``` - * - * @method Phaser.Tweens.TweenManager#stagger - * @since 3.19.0 - * - * @param {(number|number[])} value - The amount to stagger by, or an array containing two elements representing the min and max values to stagger between. - * @param {Phaser.Types.Tweens.StaggerConfig} config - The configuration object for the Stagger function. - * - * @return {function} The stagger function. - */ - stagger: function (value, options) - { - return StaggerBuilder(value, options); - }, + this.end = this.getEndValue(target, key, this.start, targetIndex, totalTargets, tween); - /** - * Updates the Tween Manager's internal lists at the start of the frame. - * - * This method will return immediately if no changes have been indicated. - * - * @method Phaser.Tweens.TweenManager#preUpdate - * @since 3.0.0 - */ - preUpdate: function () - { - if (this._toProcess === 0) - { - // Quick bail - return; + this.current = this.start; + + target[key] = this.start; + + this.setPlayingForwardState(); + + return true; } - var list = this._destroy; - var active = this._active; - var pending = this._pending; - var i; - var tween; + var forward = this.isPlayingForward(); + var backward = this.isPlayingBackward(); - // Clear the 'destroy' list - for (i = 0; i < list.length; i++) + if (forward || backward) { - tween = list[i]; + var elapsed = this.elapsed; + var duration = this.duration; + var diff = 0; + var complete = false; - // Remove from the 'active' array - var idx = active.indexOf(tween); + elapsed += delta; - if (idx === -1) + if (elapsed >= duration) { - // Not in the active array, is it in pending instead? - idx = pending.indexOf(tween); - - if (idx > -1) - { - tween.state = TWEEN_CONST.REMOVED; - pending.splice(idx, 1); - } + diff = elapsed - duration; + elapsed = duration; + complete = true; } - else + else if (elapsed < 0) { - tween.state = TWEEN_CONST.REMOVED; - active.splice(idx, 1); + elapsed = 0; } - } - list.length = 0; + var progress = Clamp(elapsed / duration, 0, 1); - // Process the addition list - // This stops callbacks and out of sync events from populating the active array mid-way during the update + this.elapsed = elapsed; + this.progress = progress; + this.previous = this.current; - list = this._add; + if (complete) + { + if (forward) + { + this.current = this.end; - for (i = 0; i < list.length; i++) - { - tween = list[i]; + target[key] = this.end; + + if (this.hold > 0) + { + this.elapsed = this.hold; - if (tween.state === TWEEN_CONST.PENDING_ADD) + this.setHoldState(); + } + else + { + this.setStateFromEnd(diff); + } + } + else + { + this.current = this.start; + + target[key] = this.start; + + this.setStateFromStart(diff); + } + } + else { - // Return true if the Tween should be started right away, otherwise false - if (tween.init()) + if (!forward) { - tween.play(); + progress = 1 - progress; + } + + var v = this.ease(progress); - this._active.push(tween); + if (this.interpolation) + { + this.current = this.interpolation(this.interpolationData, v); } else { - this._pending.push(tween); + this.current = this.start + ((this.end - this.start) * v); } + + target[key] = this.current; } - } - list.length = 0; + this.dispatchEvent(Events.TWEEN_UPDATE, 'onUpdate'); + } - this._toProcess = 0; + // Return TRUE if this TweenData still playing, otherwise FALSE + return !this.isComplete(); }, /** - * Updates all Tweens and Timelines of the Tween Manager. + * Internal method that will emit a TweenData based Event on the + * parent Tween and also invoke the given callback, if provided. * - * @method Phaser.Tweens.TweenManager#update - * @since 3.0.0 + * @method Phaser.Tweens.TweenData#dispatchEvent + * @since 3.60.0 * - * @param {number} timestamp - The current time in milliseconds. - * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. + * @param {Phaser.Types.Tweens.Event} event - The Event to be dispatched. + * @param {Phaser.Types.Tweens.TweenCallbackTypes} [callback] - The name of the callback to be invoked. Can be `null` or `undefined` to skip invocation. */ - update: function (timestamp, delta) + dispatchEvent: function (event, callback) { - // Process active tweens - var list = this._active; - var tween; - - // Scale the delta - delta *= this.timeScale; + var tween = this.tween; - for (var i = 0; i < list.length; i++) + if (!tween.isSeeking) { - tween = list[i]; + var target = tween.targets[this.targetIndex]; + var key = this.key; - // If Tween.update returns 'true' then it means it has completed, - // so move it to the destroy list - if (tween.update(timestamp, delta)) + var current = this.current; + var previous = this.previous; + + tween.emit(event, tween, key, target, current, previous); + + var handler = tween.callbacks[callback]; + + if (handler) { - this._destroy.push(tween); - this._toProcess++; + handler.func.apply(tween.callbackScope, [ tween, target, key, current, previous ].concat(handler.params)); } } }, /** - * Removes the given tween from the Tween Manager, regardless of its state (pending or active). - * - * @method Phaser.Tweens.TweenManager#remove - * @since 3.17.0 + * Immediately destroys this TweenData, nulling of all its references. * - * @param {Phaser.Tweens.Tween} tween - The Tween to be removed. - * - * @return {Phaser.Tweens.TweenManager} This Tween Manager object. + * @method Phaser.Tweens.TweenData#destroy + * @since 3.60.0 */ - remove: function (tween) + destroy: function () { - ArrayRemove(this._add, tween); - ArrayRemove(this._pending, tween); - ArrayRemove(this._active, tween); - ArrayRemove(this._destroy, tween); + BaseTweenData.prototype.destroy.call(this); - tween.state = TWEEN_CONST.REMOVED; + this.getActiveValue = null; + this.getEndValue = null; + this.getStartValue = null; + this.ease = null; + } - return this; - }, +}); - /** - * Checks if a Tween or Timeline is active and adds it to the Tween Manager at the start of the frame if it isn't. - * - * @method Phaser.Tweens.TweenManager#makeActive - * @since 3.0.0 - * - * @param {Phaser.Tweens.Tween} tween - The Tween to check. - * - * @return {Phaser.Tweens.TweenManager} This Tween Manager object. - */ - makeActive: function (tween) - { - if (this._add.indexOf(tween) !== -1 || this._active.indexOf(tween) !== -1) - { - return this; - } +module.exports = TweenData; - var idx = this._pending.indexOf(tween); - if (idx !== -1) - { - this._pending.splice(idx, 1); - } +/***/ }), - this._add.push(tween); +/***/ 96490: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - tween.state = TWEEN_CONST.PENDING_ADD; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - this._toProcess++; +var BaseTweenData = __webpack_require__(65521); +var Clamp = __webpack_require__(82897); +var Class = __webpack_require__(56694); +var Events = __webpack_require__(54272); - return this; - }, +/** + * @classdesc + * The TweenFrameData is a class that contains a single target that will change the texture frame + * at the conclusion of the Tween. + * + * TweenFrameData instances are typically created by the TweenBuilder automatically, when it + * detects the prescence of a 'texture' property as the key being tweened. + * + * A Tween can own multiple TweenFrameData instances, but a TweenFrameData only + * ever belongs to a single Tween. + * + * You should not typically create these yourself, but rather use the TweenBuilder, + * or the `Tween.addFrame` method. + * + * @class TweenFrameData + * @memberof Phaser.Tweens + * @extends Phaser.Tweens.BaseTweenData + * @constructor + * @since 3.60.0 + * + * @param {Phaser.Tweens.Tween} tween - The tween this TweenData instance belongs to. + * @param {number} targetIndex - The target index within the Tween targets array. + * @param {string} texture - The texture key to set at the end of this tween. + * @param {(string|number)} frame - The texture frame to set at the end of this tween. + * @param {function} delay - Function that returns the time in milliseconds before tween will start. + * @param {number} duration - The duration of the tween in milliseconds. + * @param {number} hold - Function that returns the time in milliseconds the tween will pause before repeating or returning to its starting value if yoyo is set to true. + * @param {number} repeat - Function that returns the number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice. + * @param {number} repeatDelay - Function that returns the time in milliseconds before the repeat will start. + * @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens? + * @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens? + */ +var TweenFrameData = new Class({ - /** - * Passes all Tweens to the given callback. - * - * @method Phaser.Tweens.TweenManager#each - * @since 3.0.0 - * - * @param {function} callback - The function to call. - * @param {object} [scope] - The scope (`this` object) to call the function with. - * @param {...*} [args] - The arguments to pass into the function. Its first argument will always be the Tween currently being iterated. - */ - each: function (callback, scope) + Extends: BaseTweenData, + + initialize: + + function TweenFrameData (tween, targetIndex, texture, frame, delay, duration, hold, repeat, repeatDelay, flipX, flipY) { - var args = [ null ]; + BaseTweenData.call(this, tween, targetIndex, delay, duration, false, hold, repeat, repeatDelay, flipX, flipY); - for (var i = 1; i < arguments.length; i++) - { - args.push(arguments[i]); - } + /** + * The property of the target to be tweened. + * + * Always 'texture' for a TweenFrameData object. + * + * @name Phaser.Tweens.TweenFrameData#key + * @type {string} + * @readonly + * @since 3.60.0 + */ + this.key = 'texture'; - for (var texture in this.list) - { - args[0] = this.list[texture]; + /** + * The texture to be set at the start of the tween. + * + * @name Phaser.Tweens.TweenFrameData#startTexture + * @type {string} + * @since 3.60.0 + */ + this.startTexture = null; - callback.apply(scope, args); - } + /** + * The texture to be set at the end of the tween. + * + * @name Phaser.Tweens.TweenFrameData#endTexture + * @type {string} + * @since 3.60.0 + */ + this.endTexture = texture; + + /** + * The frame to be set at the start of the tween. + * + * @name Phaser.Tweens.TweenFrameData#startFrame + * @type {(string|number)} + * @since 3.60.0 + */ + this.startFrame = null; + + /** + * The frame to be set at the end of the tween. + * + * @name Phaser.Tweens.TweenFrameData#endFrame + * @type {(string|number)} + * @since 3.60.0 + */ + this.endFrame = frame; + + /** + * Will the Tween ease back to its starting values, after reaching the end + * and any `hold` value that may be set? + * + * @name Phaser.Tweens.TweenFrameData#yoyo + * @type {boolean} + * @since 3.60.0 + */ + this.yoyo = (repeat !== 0) ? true : false; }, /** - * Returns an array of all active Tweens and Timelines in the Tween Manager. + * Internal method that resets this Tween Data entirely, including the progress and elapsed values. * - * @method Phaser.Tweens.TweenManager#getAllTweens - * @since 3.0.0 + * Called automatically by the parent Tween. Should not be called directly. * - * @return {Phaser.Tweens.Tween[]} A new array containing references to all active Tweens and Timelines. + * @method Phaser.Tweens.TweenFrameData#reset + * @since 3.60.0 + * + * @param {boolean} [isSeeking=false] - Is the Tween Data being reset as part of a Tween seek? */ - getAllTweens: function () + reset: function (isSeeking) { - var list = this._active; - var output = []; + BaseTweenData.prototype.reset.call(this); - for (var i = 0; i < list.length; i++) + var target = this.tween.targets[this.targetIndex]; + + if (!this.startTexture) { - output.push(list[i]); + this.startTexture = target.texture.key; + this.startFrame = target.frame.name; } - return output; - }, - - /** - * Returns the scale of the time delta for all Tweens and Timelines owned by this Tween Manager. - * - * @method Phaser.Tweens.TweenManager#getGlobalTimeScale - * @since 3.0.0 - * - * @return {number} The scale of the time delta, usually 1. - */ - getGlobalTimeScale: function () - { - return this.timeScale; + if (isSeeking) + { + target.setTexture(this.startTexture, this.startFrame); + } }, /** - * Returns an array of all Tweens or Timelines in the Tween Manager which affect the given target or array of targets. - * - * Only the currently active tweens are tested. A tween that has completed and is - * awaiting removal will not be included in the results. - * - * If you wish to also search pending tweens, use the `includePending` flag. + * Internal method that advances this TweenData based on the delta value given. * - * @method Phaser.Tweens.TweenManager#getTweensOf - * @since 3.0.0 + * @method Phaser.Tweens.TweenFrameData#update + * @fires Phaser.Tweens.Events#TWEEN_UPDATE + * @fires Phaser.Tweens.Events#TWEEN_REPEAT + * @since 3.60.0 * - * @param {(object|array)} target - The target to look for. Provide an array to look for multiple targets. - * @param {boolean} [includePending=false] - Also check for pending tweens, not just active ones? + * @param {number} delta - The elapsed delta time in ms. * - * @return {Phaser.Tweens.Tween[]} A new array containing all Tweens and Timelines which affect the given target(s). + * @return {boolean} `true` if this TweenData is still playing, or `false` if it has finished entirely. */ - getTweensOf: function (target, includePending) + update: function (delta) { - if (includePending === undefined) { includePending = false; } - - var list = this._active; - var tween; - var output = []; - var i; - var t; + var tween = this.tween; + var targetIndex = this.targetIndex; + var target = tween.targets[targetIndex]; - if (!Array.isArray(target)) + // Bail out if we don't have a target to act upon + if (!target) { - target = [ target ]; + this.setCompleteState(); + + return false; } - for (i = 0; i < list.length; i++) + if (this.isCountdown) { - tween = list[i]; + this.elapsed -= delta; - for (t = 0; t < target.length; t++) + if (this.elapsed <= 0) { - if (tween.hasTarget(target[t])) + this.elapsed = 0; + + delta = 0; + + if (this.isDelayed()) { - output.push(tween); + this.setPendingRenderState(); + } + else if (this.isRepeating()) + { + this.setPlayingForwardState(); + + this.dispatchEvent(Events.TWEEN_REPEAT, 'onRepeat'); + } + else if (this.isHolding()) + { + this.setStateFromEnd(0); } } } - if (includePending) + // All of the above have the ability to change the state, so put this in its own check + + if (this.isPendingRender()) { - list = this._pending; + if (this.startTexture) + { + target.setTexture(this.startTexture, this.startFrame); + } - for (i = 0; i < list.length; i++) + this.setPlayingForwardState(); + + return true; + } + + var forward = this.isPlayingForward(); + var backward = this.isPlayingBackward(); + + if (forward || backward) + { + var elapsed = this.elapsed; + var duration = this.duration; + var diff = 0; + var complete = false; + + elapsed += delta; + + if (elapsed >= duration) + { + diff = elapsed - duration; + elapsed = duration; + complete = true; + } + else if (elapsed < 0) { - tween = list[i]; + elapsed = 0; + } + + var progress = Clamp(elapsed / duration, 0, 1); + + this.elapsed = elapsed; + this.progress = progress; - for (t = 0; t < target.length; t++) + if (complete) + { + if (forward) { - if (tween.hasTarget(target[t])) + target.setTexture(this.endTexture, this.endFrame); + + if (this.hold > 0) + { + this.elapsed = this.hold; + + this.setHoldState(); + } + else { - output.push(tween); + this.setStateFromEnd(diff); } } + else + { + target.setTexture(this.startTexture, this.startFrame); + + this.setStateFromStart(diff); + } } + + this.dispatchEvent(Events.TWEEN_UPDATE, 'onUpdate'); } - return output; + // Return TRUE if this TweenData still playing, otherwise FALSE + return !this.isComplete(); }, /** - * Checks if the given object is being affected by a playing Tween. + * Internal method that will emit a TweenData based Event on the + * parent Tween and also invoke the given callback, if provided. * - * @method Phaser.Tweens.TweenManager#isTweening - * @since 3.0.0 + * @method Phaser.Tweens.TweenFrameData#dispatchEvent + * @since 3.60.0 * - * @param {object} target - target Phaser.Tweens.Tween object - * - * @return {boolean} returns if target tween object is active or not + * @param {Phaser.Types.Tweens.Event} event - The Event to be dispatched. + * @param {Phaser.Types.Tweens.TweenCallbackTypes} [callback] - The name of the callback to be invoked. Can be `null` or `undefined` to skip invocation. */ - isTweening: function (target) + dispatchEvent: function (event, callback) { - var list = this._active; - var tween; + var tween = this.tween; - for (var i = 0; i < list.length; i++) + if (!tween.isSeeking) { - tween = list[i]; + var target = tween.targets[this.targetIndex]; + var key = this.key; + + tween.emit(event, tween, key, target); - if (tween.hasTarget(target) && tween.isPlaying()) + var handler = tween.callbacks[callback]; + + if (handler) { - return true; + handler.func.apply(tween.callbackScope, [ tween, target, key ].concat(handler.params)); } } - - return false; }, /** - * Stops all Tweens in this Tween Manager. They will be removed at the start of the frame. - * - * @method Phaser.Tweens.TweenManager#killAll - * @since 3.0.0 + * Immediately destroys this TweenData, nulling of all its references. * - * @return {Phaser.Tweens.TweenManager} This Tween Manager. + * @method Phaser.Tweens.TweenFrameData#destroy + * @since 3.60.0 */ - killAll: function () + destroy: function () { - var tweens = this.getAllTweens(); + BaseTweenData.prototype.destroy.call(this); - for (var i = 0; i < tweens.length; i++) - { - tweens[i].stop(); - } + this.startTexture = null; + this.endTexture = null; + this.startFrame = null; + this.endFrame = null; + } - return this; - }, +}); + +module.exports = TweenFrameData; + + +/***/ }), + +/***/ 55303: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Phaser Tween States. + * + * @namespace Phaser.Tweens.States + * @memberof Phaser.Tweens + * @since 3.60.0 + */ + +/** + * Phaser Tween state constants. + * + * @typedef {Phaser.Tweens.States} Phaser.Tweens.StateType + * @memberof Phaser.Tweens + * @since 3.60.0 + */ + +var TWEEN_CONST = { /** - * Stops all Tweens which affect the given target or array of targets. The Tweens will be removed from the Tween Manager at the start of the frame. - * - * @see {@link #getTweensOf} + * TweenData state. * - * @method Phaser.Tweens.TweenManager#killTweensOf + * @name Phaser.Tweens.States.CREATED + * @type {number} + * @const * @since 3.0.0 + */ + CREATED: 0, + + // 1 used to be INIT prior to 3.60 + + /** + * TweenData state. * - * @param {(object|array)} target - The target to look for. Provide an array to look for multiple targets. + * @name Phaser.Tweens.States.DELAY + * @type {number} + * @const + * @since 3.0.0 + */ + DELAY: 2, + + // 3 used to be OFFSET_DELAY prior to 3.60 + + /** + * TweenData state. * - * @return {Phaser.Tweens.TweenManager} This Tween Manager. + * @name Phaser.Tweens.States.PENDING_RENDER + * @type {number} + * @const + * @since 3.0.0 */ - killTweensOf: function (target) - { - var tweens = this.getTweensOf(target); + PENDING_RENDER: 4, - for (var i = 0; i < tweens.length; i++) - { - tweens[i].stop(); - } + /** + * TweenData state. + * + * @name Phaser.Tweens.States.PLAYING_FORWARD + * @type {number} + * @const + * @since 3.0.0 + */ + PLAYING_FORWARD: 5, - return this; - }, + /** + * TweenData state. + * + * @name Phaser.Tweens.States.PLAYING_BACKWARD + * @type {number} + * @const + * @since 3.0.0 + */ + PLAYING_BACKWARD: 6, /** - * Pauses all Tweens in this Tween Manager. + * TweenData state. * - * @method Phaser.Tweens.TweenManager#pauseAll + * @name Phaser.Tweens.States.HOLD_DELAY + * @type {number} + * @const * @since 3.0.0 + */ + HOLD_DELAY: 7, + + /** + * TweenData state. * - * @return {Phaser.Tweens.TweenManager} This Tween Manager. + * @name Phaser.Tweens.States.REPEAT_DELAY + * @type {number} + * @const + * @since 3.0.0 */ - pauseAll: function () - { - var list = this._active; + REPEAT_DELAY: 8, - for (var i = 0; i < list.length; i++) - { - list[i].pause(); - } + /** + * TweenData state. + * + * @name Phaser.Tweens.States.COMPLETE + * @type {number} + * @const + * @since 3.0.0 + */ + COMPLETE: 9, - return this; - }, + // Tween specific (starts from 20 to cleanly allow extra TweenData consts in the future) /** - * Resumes all Tweens in this Tween Manager. + * Tween state. The Tween has been created but has not yet been added to the Tween Manager. * - * @method Phaser.Tweens.TweenManager#resumeAll + * @name Phaser.Tweens.States.PENDING + * @type {number} + * @const * @since 3.0.0 + */ + PENDING: 20, + + /** + * Tween state. The Tween is active within the Tween Manager. This means it is either playing, + * or was playing and is currently paused, but in both cases it's still being processed by + * the Tween Manager, so is considered 'active'. * - * @return {Phaser.Tweens.TweenManager} This Tween Manager. + * @name Phaser.Tweens.States.ACTIVE + * @type {number} + * @const + * @since 3.0.0 */ - resumeAll: function () - { - var list = this._active; + ACTIVE: 21, - for (var i = 0; i < list.length; i++) - { - list[i].resume(); - } + /** + * Tween state. The Tween is waiting for a loop countdown to elapse. + * + * @name Phaser.Tweens.States.LOOP_DELAY + * @type {number} + * @const + * @since 3.0.0 + */ + LOOP_DELAY: 22, - return this; - }, + /** + * Tween state. The Tween is waiting for a complete delay to elapse. + * + * @name Phaser.Tweens.States.COMPLETE_DELAY + * @type {number} + * @const + * @since 3.0.0 + */ + COMPLETE_DELAY: 23, /** - * Sets a new scale of the time delta for this Tween Manager. + * Tween state. The Tween is waiting for a starting delay to elapse. * - * The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Tween Manager and all Tweens it owns. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing all Tweens. + * @name Phaser.Tweens.States.START_DELAY + * @type {number} + * @const + * @since 3.0.0 + */ + START_DELAY: 24, + + /** + * Tween state. The Tween has finished playback and is waiting to be removed from the Tween Manager. * - * @method Phaser.Tweens.TweenManager#setGlobalTimeScale + * @name Phaser.Tweens.States.PENDING_REMOVE + * @type {number} + * @const * @since 3.0.0 + */ + PENDING_REMOVE: 25, + + /** + * Tween state. The Tween has been removed from the Tween Manager. * - * @param {number} value - The new scale of the time delta, where 1 is the normal speed. + * @name Phaser.Tweens.States.REMOVED + * @type {number} + * @const + * @since 3.0.0 + */ + REMOVED: 26, + + /** + * Tween state. The Tween has finished playback but was flagged as 'persistent' during creation, + * so will not be automatically removed by the Tween Manager. * - * @return {Phaser.Tweens.TweenManager} This Tween Manager. + * @name Phaser.Tweens.States.FINISHED + * @type {number} + * @const + * @since 3.60.0 */ - setGlobalTimeScale: function (value) - { - this.timeScale = value; + FINISHED: 27, - return this; - }, + /** + * Tween state. The Tween has been destroyed and can no longer be played by a Tween Manager. + * + * @name Phaser.Tweens.States.DESTROYED + * @type {number} + * @const + * @since 3.60.0 + */ + DESTROYED: 28, /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. + * A large integer value used for 'infinite' style countdowns. * - * @method Phaser.Tweens.TweenManager#shutdown - * @since 3.0.0 + * Similar use-case to Number.MAX_SAFE_INTEGER but we cannot use that because it's not + * supported on IE. + * + * @name Phaser.Tweens.States.MAX + * @type {number} + * @const + * @since 3.60.0 */ - shutdown: function () + MAX: 999999999999 + +}; + +module.exports = TWEEN_CONST; + + +/***/ }), + +/***/ 56694: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +// Taken from klasse by mattdesl https://github.com/mattdesl/klasse + +function hasGetterOrSetter (def) +{ + return (!!def.get && typeof def.get === 'function') || (!!def.set && typeof def.set === 'function'); +} + +function getProperty (definition, k, isClassDescriptor) +{ + // This may be a lightweight object, OR it might be a property that was defined previously. + + // For simple class descriptors we can just assume its NOT previously defined. + var def = (isClassDescriptor) ? definition[k] : Object.getOwnPropertyDescriptor(definition, k); + + if (!isClassDescriptor && def.value && typeof def.value === 'object') { - this.killAll(); + def = def.value; + } - this._add = []; - this._pending = []; - this._active = []; - this._destroy = []; + // This might be a regular property, or it may be a getter/setter the user defined in a class. + if (def && hasGetterOrSetter(def)) + { + if (typeof def.enumerable === 'undefined') + { + def.enumerable = true; + } - this._toProcess = 0; + if (typeof def.configurable === 'undefined') + { + def.configurable = true; + } - var eventEmitter = this.systems.events; + return def; + } + else + { + return false; + } +} - eventEmitter.off(SceneEvents.PRE_UPDATE, this.preUpdate, this); - eventEmitter.off(SceneEvents.UPDATE, this.update, this); - eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); - }, +function hasNonConfigurable (obj, k) +{ + var prop = Object.getOwnPropertyDescriptor(obj, k); + + if (!prop) + { + return false; + } + + if (prop.value && typeof prop.value === 'object') + { + prop = prop.value; + } + + if (prop.configurable === false) + { + return true; + } + + return false; +} + +/** + * Extends the given `myClass` object's prototype with the properties of `definition`. + * + * @function extend + * @ignore + * @param {Object} ctor The constructor object to mix into. + * @param {Object} definition A dictionary of functions for the class. + * @param {boolean} isClassDescriptor Is the definition a class descriptor? + * @param {Object} [extend] The parent constructor object. + */ +function extend (ctor, definition, isClassDescriptor, extend) +{ + for (var k in definition) + { + if (!definition.hasOwnProperty(k)) + { + continue; + } + + var def = getProperty(definition, k, isClassDescriptor); + + if (def !== false) + { + // If Extends is used, we will check its prototype to see if the final variable exists. + + var parent = extend || ctor; + + if (hasNonConfigurable(parent.prototype, k)) + { + // Just skip the final property + if (Class.ignoreFinals) + { + continue; + } + + // We cannot re-define a property that is configurable=false. + // So we will consider them final and throw an error. This is by + // default so it is clear to the developer what is happening. + // You can set ignoreFinals to true if you need to extend a class + // which has configurable=false; it will simply not re-define final properties. + throw new Error('cannot override final property \'' + k + '\', set Class.ignoreFinals = true to skip'); + } + + Object.defineProperty(ctor.prototype, k, def); + } + else + { + ctor.prototype[k] = definition[k]; + } + } +} + +/** + * Applies the given `mixins` to the prototype of `myClass`. + * + * @function mixin + * @ignore + * @param {Object} myClass The constructor object to mix into. + * @param {Object|Array} mixins The mixins to apply to the constructor. + */ +function mixin (myClass, mixins) +{ + if (!mixins) + { + return; + } + + if (!Array.isArray(mixins)) + { + mixins = [ mixins ]; + } + + for (var i = 0; i < mixins.length; i++) + { + extend(myClass, mixins[i].prototype || mixins[i]); + } +} + +/** + * Creates a new class with the given descriptor. + * The constructor, defined by the name `initialize`, + * is an optional function. If unspecified, an anonymous + * function will be used which calls the parent class (if + * one exists). + * + * You can also use `Extends` and `Mixins` to provide subclassing + * and inheritance. + * + * @class Phaser.Class + * @constructor + * @param {Object} definition a dictionary of functions for the class + * @example + * + * var MyClass = new Phaser.Class({ + * + * initialize: function() { + * this.foo = 2.0; + * }, + * + * bar: function() { + * return this.foo + 5; + * } + * }); + */ +function Class (definition) +{ + if (!definition) + { + definition = {}; + } + + // The variable name here dictates what we see in Chrome debugger + var initialize; + var Extends; + + if (definition.initialize) + { + if (typeof definition.initialize !== 'function') + { + throw new Error('initialize must be a function'); + } + + initialize = definition.initialize; + + // Usually we should avoid 'delete' in V8 at all costs. + // However, its unlikely to make any performance difference + // here since we only call this on class creation (i.e. not object creation). + delete definition.initialize; + } + else if (definition.Extends) + { + var base = definition.Extends; + + initialize = function () + { + base.apply(this, arguments); + }; + } + else + { + initialize = function () {}; + } + + if (definition.Extends) + { + initialize.prototype = Object.create(definition.Extends.prototype); + initialize.prototype.constructor = initialize; + + // For getOwnPropertyDescriptor to work, we need to act directly on the Extends (or Mixin) + + Extends = definition.Extends; + + delete definition.Extends; + } + else + { + initialize.prototype.constructor = initialize; + } + + // Grab the mixins, if they are specified... + var mixins = null; + + if (definition.Mixins) + { + mixins = definition.Mixins; + delete definition.Mixins; + } + + // First, mixin if we can. + mixin(initialize, mixins); + + // Now we grab the actual definition which defines the overrides. + extend(initialize, definition, true, Extends); + + return initialize; +} + +Class.extend = extend; +Class.mixin = mixin; +Class.ignoreFinals = false; + +module.exports = Class; + + +/***/ }), + +/***/ 72283: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * A NOOP (No Operation) callback function. + * + * Used internally by Phaser when it's more expensive to determine if a callback exists + * than it is to just invoke an empty function. + * + * @function Phaser.Utils.NOOP + * @since 3.0.0 + */ +var NOOP = function () +{ + // NOOP +}; + +module.exports = NOOP; + + +/***/ }), + +/***/ 10618: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * A NULL OP callback function. + * + * This function always returns `null`. + * + * Used internally by Phaser when it's more expensive to determine if a callback exists + * than it is to just invoke an empty function. + * + * @function Phaser.Utils.NULL + * @since 3.60.0 + */ +var NULL = function () +{ + return null; +}; + +module.exports = NULL; + + +/***/ }), + +/***/ 78991: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Adds the given item, or array of items, to the array. + * + * Each item must be unique within the array. + * + * The array is modified in-place and returned. + * + * You can optionally specify a limit to the maximum size of the array. If the quantity of items being + * added will take the array length over this limit, it will stop adding once the limit is reached. + * + * You can optionally specify a callback to be invoked for each item successfully added to the array. + * + * @function Phaser.Utils.Array.Add + * @since 3.4.0 + * + * @param {array} array - The array to be added to. + * @param {any|any[]} item - The item, or array of items, to add to the array. Each item must be unique within the array. + * @param {number} [limit] - Optional limit which caps the size of the array. + * @param {function} [callback] - A callback to be invoked for each item successfully added to the array. + * @param {object} [context] - The context in which the callback is invoked. + * + * @return {array} The input array. + */ +var Add = function (array, item, limit, callback, context) +{ + if (context === undefined) { context = array; } - /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. - * - * @method Phaser.Tweens.TweenManager#destroy - * @since 3.0.0 - */ - destroy: function () + if (limit > 0) { - this.shutdown(); - - this.scene.sys.events.off(SceneEvents.START, this.start, this); + var remaining = limit - array.length; - this.scene = null; - this.systems = null; + // There's nothing more we can do here, the array is full + if (remaining <= 0) + { + return null; + } } -}); - -PluginCache.register('TweenManager', TweenManager, 'tweens'); - -module.exports = TweenManager; + // Fast path to avoid array mutation and iteration + if (!Array.isArray(item)) + { + if (array.indexOf(item) === -1) + { + array.push(item); + if (callback) + { + callback.call(context, item); + } -/***/ }), -/* 1481 */ -/***/ (function(module, exports, __webpack_require__) { + return item; + } + else + { + return null; + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + // If we got this far, we have an array of items to insert -/** - * @namespace Phaser.Utils - */ + // Ensure all the items are unique + var itemLength = item.length - 1; -module.exports = { + while (itemLength >= 0) + { + if (array.indexOf(item[itemLength]) !== -1) + { + // Already exists in array, so remove it + item.splice(itemLength, 1); + } - Array: __webpack_require__(208), - Base64: __webpack_require__(1482), - Objects: __webpack_require__(1484), - String: __webpack_require__(1488), - NOOP: __webpack_require__(1) + itemLength--; + } -}; + // Anything left? + itemLength = item.length; + if (itemLength === 0) + { + return null; + } -/***/ }), -/* 1482 */ -/***/ (function(module, exports, __webpack_require__) { + if (limit > 0 && itemLength > remaining) + { + item.splice(remaining); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + itemLength = remaining; + } -/** - * @namespace Phaser.Utils.Base64 - */ + for (var i = 0; i < itemLength; i++) + { + var entry = item[i]; -module.exports = { + array.push(entry); - ArrayBufferToBase64: __webpack_require__(1483), - Base64ToArrayBuffer: __webpack_require__(433) + if (callback) + { + callback.call(context, entry); + } + } + return item; }; +module.exports = Add; + /***/ }), -/* 1483 */ -/***/ (function(module, exports) { + +/***/ 48522: +/***/ ((module) => { /** - * @author Niklas von Hertzen (https://github.com/niklasvh/base64-arraybuffer) * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - /** - * Converts an ArrayBuffer into a base64 string. - * - * The resulting string can optionally be a data uri if the `mediaType` argument is provided. - * - * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs for more details. + * Adds the given item, or array of items, to the array starting at the index specified. * - * @function Phaser.Utils.Base64.ArrayBufferToBase64 - * @since 3.18.0 - * - * @param {ArrayBuffer} arrayBuffer - The Array Buffer to encode. - * @param {string} [mediaType] - An optional media type, i.e. `audio/ogg` or `image/jpeg`. If included the resulting string will be a data URI. - * - * @return {string} The base64 encoded Array Buffer. + * Each item must be unique within the array. + * + * Existing elements in the array are shifted up. + * + * The array is modified in-place and returned. + * + * You can optionally specify a limit to the maximum size of the array. If the quantity of items being + * added will take the array length over this limit, it will stop adding once the limit is reached. + * + * You can optionally specify a callback to be invoked for each item successfully added to the array. + * + * @function Phaser.Utils.Array.AddAt + * @since 3.4.0 + * + * @param {array} array - The array to be added to. + * @param {any|any[]} item - The item, or array of items, to add to the array. + * @param {number} [index=0] - The index in the array where the item will be inserted. + * @param {number} [limit] - Optional limit which caps the size of the array. + * @param {function} [callback] - A callback to be invoked for each item successfully added to the array. + * @param {object} [context] - The context in which the callback is invoked. + * + * @return {array} The input array. */ -var ArrayBufferToBase64 = function (arrayBuffer, mediaType) +var AddAt = function (array, item, index, limit, callback, context) { - var bytes = new Uint8Array(arrayBuffer); - var len = bytes.length; - - var base64 = (mediaType) ? 'data:' + mediaType + ';base64,' : ''; + if (index === undefined) { index = 0; } + if (context === undefined) { context = array; } - for (var i = 0; i < len; i += 3) + if (limit > 0) { - base64 += chars[bytes[i] >> 2]; - base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; - base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; - base64 += chars[bytes[i + 2] & 63]; + var remaining = limit - array.length; + + // There's nothing more we can do here, the array is full + if (remaining <= 0) + { + return null; + } } - if ((len % 3) === 2) + // Fast path to avoid array mutation and iteration + if (!Array.isArray(item)) { - base64 = base64.substring(0, base64.length - 1) + '='; + if (array.indexOf(item) === -1) + { + array.splice(index, 0, item); + + if (callback) + { + callback.call(context, item); + } + + return item; + } + else + { + return null; + } } - else if (len % 3 === 1) + + // If we got this far, we have an array of items to insert + + // Ensure all the items are unique + var itemLength = item.length - 1; + + while (itemLength >= 0) { - base64 = base64.substring(0, base64.length - 2) + '=='; + if (array.indexOf(item[itemLength]) !== -1) + { + // Already exists in array, so remove it + item.pop(); + } + + itemLength--; } - - return base64; -}; -module.exports = ArrayBufferToBase64; + // Anything left? + itemLength = item.length; + if (itemLength === 0) + { + return null; + } -/***/ }), -/* 1484 */ -/***/ (function(module, exports, __webpack_require__) { + // Truncate to the limit + if (limit > 0 && itemLength > remaining) + { + item.splice(remaining); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + itemLength = remaining; + } -/** - * @namespace Phaser.Utils.Objects - */ + for (var i = itemLength - 1; i >= 0; i--) + { + var entry = item[i]; -module.exports = { + array.splice(index, 0, entry); - Clone: __webpack_require__(77), - DeepCopy: __webpack_require__(175), - Extend: __webpack_require__(17), - GetAdvancedValue: __webpack_require__(13), - GetFastValue: __webpack_require__(2), - GetMinMaxValue: __webpack_require__(1485), - GetValue: __webpack_require__(6), - HasAll: __webpack_require__(1486), - HasAny: __webpack_require__(455), - HasValue: __webpack_require__(126), - IsPlainObject: __webpack_require__(7), - Merge: __webpack_require__(127), - MergeRight: __webpack_require__(1487), - Pick: __webpack_require__(571), - SetValue: __webpack_require__(478) + if (callback) + { + callback.call(context, entry); + } + } + return item; }; +module.exports = AddAt; + /***/ }), -/* 1485 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 58742: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var GetValue = __webpack_require__(6); -var Clamp = __webpack_require__(18); - /** - * Retrieves and clamps a numerical value from an object. + * Moves the given element to the top of the array. + * The array is modified in-place. * - * @function Phaser.Utils.Objects.GetMinMaxValue - * @since 3.0.0 + * @function Phaser.Utils.Array.BringToTop + * @since 3.4.0 * - * @param {object} source - The object to retrieve the value from. - * @param {string} key - The name of the property to retrieve from the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`). - * @param {number} min - The minimum value which can be returned. - * @param {number} max - The maximum value which can be returned. - * @param {number} defaultValue - The value to return if the property doesn't exist. It's also constrained to the given bounds. + * @param {array} array - The array. + * @param {*} item - The element to move. * - * @return {number} The clamped value from the `source` object. + * @return {*} The element that was moved. */ -var GetMinMaxValue = function (source, key, min, max, defaultValue) +var BringToTop = function (array, item) { - if (defaultValue === undefined) { defaultValue = min; } + var currentIndex = array.indexOf(item); - var value = GetValue(source, key, defaultValue); + if (currentIndex !== -1 && currentIndex < array.length) + { + array.splice(currentIndex, 1); + array.push(item); + } - return Clamp(value, min, max); + return item; }; -module.exports = GetMinMaxValue; +module.exports = BringToTop; /***/ }), -/* 1486 */ -/***/ (function(module, exports) { + +/***/ 30164: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var SafeRange = __webpack_require__(45838); + /** - * Verifies that an object contains all requested keys + * Returns the total number of elements in the array which have a property matching the given value. * - * @function Phaser.Utils.Objects.HasAll - * @since 3.0.0 + * @function Phaser.Utils.Array.CountAllMatching + * @since 3.4.0 * - * @param {object} source - an object on which to check for key existence - * @param {string[]} keys - an array of keys to ensure the source object contains + * @param {array} array - The array to search. + * @param {string} property - The property to test on each array element. + * @param {*} value - The value to test the property against. Must pass a strict (`===`) comparison check. + * @param {number} [startIndex] - An optional start index to search from. + * @param {number} [endIndex] - An optional end index to search to. * - * @return {boolean} true if the source object contains all keys, false otherwise. + * @return {number} The total number of elements with properties matching the given value. */ -var HasAll = function (source, keys) +var CountAllMatching = function (array, property, value, startIndex, endIndex) { - for (var i = 0; i < keys.length; i++) + if (startIndex === undefined) { startIndex = 0; } + if (endIndex === undefined) { endIndex = array.length; } + + var total = 0; + + if (SafeRange(array, startIndex, endIndex)) { - if (!source.hasOwnProperty(keys[i])) + for (var i = startIndex; i < endIndex; i++) { - return false; + var child = array[i]; + + if (child[property] === value) + { + total++; + } } } - return true; + return total; }; -module.exports = HasAll; +module.exports = CountAllMatching; /***/ }), -/* 1487 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 36337: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Clone = __webpack_require__(77); - /** - * Creates a new Object using all values from obj1. - * - * Then scans obj2. If a property is found in obj2 that *also* exists in obj1, the value from obj2 is used, otherwise the property is skipped. + * Passes each element in the array to the given callback. * - * @function Phaser.Utils.Objects.MergeRight - * @since 3.0.0 + * @function Phaser.Utils.Array.Each + * @since 3.4.0 * - * @param {object} obj1 - The first object to merge. - * @param {object} obj2 - The second object to merge. Keys from this object which also exist in `obj1` will be copied to `obj1`. + * @param {array} array - The array to search. + * @param {function} callback - A callback to be invoked for each item in the array. + * @param {object} context - The context in which the callback is invoked. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the current array item. * - * @return {object} The merged object. `obj1` and `obj2` are not modified. + * @return {array} The input array. */ -var MergeRight = function (obj1, obj2) +var Each = function (array, callback, context) { - var clone = Clone(obj1); + var i; + var args = [ null ]; - for (var key in obj2) + for (i = 3; i < arguments.length; i++) { - if (clone.hasOwnProperty(key)) - { - clone[key] = obj2[key]; - } + args.push(arguments[i]); } - return clone; + for (i = 0; i < array.length; i++) + { + args[0] = array[i]; + + callback.apply(context, args); + } + + return array; }; -module.exports = MergeRight; +module.exports = Each; /***/ }), -/* 1488 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 46208: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var SafeRange = __webpack_require__(45838); + /** - * @namespace Phaser.Utils.String + * Passes each element in the array, between the start and end indexes, to the given callback. + * + * @function Phaser.Utils.Array.EachInRange + * @since 3.4.0 + * + * @param {array} array - The array to search. + * @param {function} callback - A callback to be invoked for each item in the array. + * @param {object} context - The context in which the callback is invoked. + * @param {number} startIndex - The start index to search from. + * @param {number} endIndex - The end index to search to. + * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child. + * + * @return {array} The input array. */ +var EachInRange = function (array, callback, context, startIndex, endIndex) +{ + if (startIndex === undefined) { startIndex = 0; } + if (endIndex === undefined) { endIndex = array.length; } -module.exports = { + if (SafeRange(array, startIndex, endIndex)) + { + var i; + var args = [ null ]; + + for (i = 5; i < arguments.length; i++) + { + args.push(arguments[i]); + } + + for (i = startIndex; i < endIndex; i++) + { + args[0] = array[i]; - Format: __webpack_require__(1489), - Pad: __webpack_require__(186), - RemoveAt: __webpack_require__(1490), - Reverse: __webpack_require__(1491), - UppercaseFirst: __webpack_require__(205), - UUID: __webpack_require__(222) + callback.apply(context, args); + } + } + return array; }; +module.exports = EachInRange; + /***/ }), -/* 1489 */ -/***/ (function(module, exports) { + +/***/ 2406: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Takes a string and replaces instances of markers with values in the given array. - * The markers take the form of `%1`, `%2`, etc. I.e.: + * Searches a pre-sorted array for the closet value to the given number. * - * `Format("The %1 is worth %2 gold", [ 'Sword', 500 ])` + * If the `key` argument is given it will assume the array contains objects that all have the required `key` property name, + * and will check for the closest value of those to the given number. * - * @function Phaser.Utils.String.Format + * @function Phaser.Utils.Array.FindClosestInSorted * @since 3.0.0 * - * @param {string} string - The string containing the replacement markers. - * @param {array} values - An array containing values that will replace the markers. If no value exists an empty string is inserted instead. + * @param {number} value - The value to search for in the array. + * @param {array} array - The array to search, which must be sorted. + * @param {string} [key] - An optional property key. If specified the array elements property will be checked against value. * - * @return {string} The string containing replaced values. + * @return {(number|any)} The nearest value found in the array, or if a `key` was given, the nearest object with the matching property value. */ -var Format = function (string, values) +var FindClosestInSorted = function (value, array, key) { - return string.replace(/%([0-9]+)/g, function (s, n) + if (!array.length) { - return values[Number(n) - 1]; - }); -}; + return NaN; + } + else if (array.length === 1) + { + return array[0]; + } -module.exports = Format; + var i = 1; + var low; + var high; + if (key) + { + if (value < array[0][key]) + { + return array[0]; + } -/***/ }), -/* 1490 */ -/***/ (function(module, exports) { + while (array[i][key] < value) + { + i++; + } + } + else + { + while (array[i] < value) + { + i++; + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (i > array.length) + { + i = array.length; + } -/** - * Takes a string and removes the character at the given index. - * - * @function Phaser.Utils.String.RemoveAt - * @since 3.50.0 - * - * @param {string} string - The string to be worked on. - * @param {number} index - The index of the character to be removed. - * - * @return {string} The modified string. - */ -var RemoveAt = function (string, index) -{ - if (index === 0) + if (key) { - return string.slice(1); + low = array[i - 1][key]; + high = array[i][key]; + + return ((high - value) <= (value - low)) ? array[i] : array[i - 1]; } else { - return string.slice(0, index - 1) + string.slice(index); + low = array[i - 1]; + high = array[i]; + + return ((high - value) <= (value - low)) ? high : low; } }; -module.exports = RemoveAt; +module.exports = FindClosestInSorted; /***/ }), -/* 1491 */ -/***/ (function(module, exports) { + +/***/ 5454: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Takes the given string and reverses it, returning the reversed string. - * For example if given the string `Atari 520ST` it would return `TS025 iratA`. + * Takes an array and flattens it, returning a shallow-copy flattened array. * - * @function Phaser.Utils.String.Reverse - * @since 3.0.0 + * @function Phaser.Utils.Array.Flatten + * @since 3.60.0 * - * @param {string} string - The string to be reversed. + * @param {array} array - The array to flatten. + * @param {array} [output] - An array to hold the results in. * - * @return {string} The reversed string. + * @return {array} The flattened output array. */ -var Reverse = function (string) +var Flatten = function (array, output) { - return string.split('').reverse().join(''); + if (output === undefined) { output = []; } + + for (var i = 0; i < array.length; i++) + { + if (Array.isArray(array[i])) + { + Flatten(array[i], output); + } + else + { + output.push(array[i]); + } + } + + return output; }; -module.exports = Reverse; +module.exports = Flatten; /***/ }), -/* 1492 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 71608: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @author Pavle Goloskokovic (http://prunegames.com) - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var SafeRange = __webpack_require__(45838); + /** - * @namespace Phaser.Sound + * Returns all elements in the array. + * + * You can optionally specify a matching criteria using the `property` and `value` arguments. + * + * For example: `getAll('visible', true)` would return only elements that have their visible property set. + * + * Optionally you can specify a start and end index. For example if the array had 100 elements, + * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only + * the first 50 elements. + * + * @function Phaser.Utils.Array.GetAll + * @since 3.4.0 + * + * @param {array} array - The array to search. + * @param {string} [property] - The property to test on each array element. + * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. + * @param {number} [startIndex] - An optional start index to search from. + * @param {number} [endIndex] - An optional end index to search to. + * + * @return {array} All matching elements from the array. */ +var GetAll = function (array, property, value, startIndex, endIndex) +{ + if (startIndex === undefined) { startIndex = 0; } + if (endIndex === undefined) { endIndex = array.length; } -module.exports = { - - SoundManagerCreator: __webpack_require__(426), - - Events: __webpack_require__(70), - - BaseSound: __webpack_require__(146), - BaseSoundManager: __webpack_require__(145), - - WebAudioSound: __webpack_require__(434), - WebAudioSoundManager: __webpack_require__(432), + var output = []; - HTML5AudioSound: __webpack_require__(429), - HTML5AudioSoundManager: __webpack_require__(427), + if (SafeRange(array, startIndex, endIndex)) + { + for (var i = startIndex; i < endIndex; i++) + { + var child = array[i]; - NoAudioSound: __webpack_require__(431), - NoAudioSoundManager: __webpack_require__(430) + if (!property || + (property && value === undefined && child.hasOwnProperty(property)) || + (property && value !== undefined && child[property] === value)) + { + output.push(child); + } + } + } + return output; }; +module.exports = GetAll; + /***/ }), -/* 1493 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 51463: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @namespace Phaser.Physics - */ +var SafeRange = __webpack_require__(45838); /** - * @namespace Phaser.Types.Physics + * Returns the first element in the array. + * + * You can optionally specify a matching criteria using the `property` and `value` arguments. + * + * For example: `getAll('visible', true)` would return the first element that had its `visible` property set. + * + * Optionally you can specify a start and end index. For example if the array had 100 elements, + * and you set `startIndex` to 0 and `endIndex` to 50, it would search only the first 50 elements. + * + * @function Phaser.Utils.Array.GetFirst + * @since 3.4.0 + * + * @param {array} array - The array to search. + * @param {string} [property] - The property to test on each array element. + * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check. + * @param {number} [startIndex=0] - An optional start index to search from. + * @param {number} [endIndex=array.length] - An optional end index to search up to (but not included) + * + * @return {object} The first matching element from the array, or `null` if no element could be found in the range given. */ +var GetFirst = function (array, property, value, startIndex, endIndex) +{ + if (startIndex === undefined) { startIndex = 0; } + if (endIndex === undefined) { endIndex = array.length; } -module.exports = { + if (SafeRange(array, startIndex, endIndex)) + { + for (var i = startIndex; i < endIndex; i++) + { + var child = array[i]; - Arcade: __webpack_require__(1366), - Matter: __webpack_require__(1494) + if (!property || + (property && value === undefined && child.hasOwnProperty(property)) || + (property && value !== undefined && child[property] === value)) + { + return child; + } + } + } + return null; }; - -/***/ }), -/* 1494 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -/** - * @namespace Phaser.Physics.Matter - */ - -module.exports = { - - BodyBounds: __webpack_require__(1392), - Components: __webpack_require__(249), - Events: __webpack_require__(272), - Factory: __webpack_require__(1394), - MatterGameObject: __webpack_require__(1395), - Image: __webpack_require__(1396), - Matter: __webpack_require__(594), - MatterPhysics: __webpack_require__(1524), - PolyDecomp: __webpack_require__(1393), - Sprite: __webpack_require__(1397), - TileBody: __webpack_require__(593), - PhysicsEditorParser: __webpack_require__(589), - PhysicsJSONParser: __webpack_require__(590), - PointerConstraint: __webpack_require__(1398), - World: __webpack_require__(1402) - -}; +module.exports = GetFirst; /***/ }), -/* 1495 */ -/***/ (function(module, exports) { + +/***/ 72861: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * A component to set restitution on objects. + * Returns a Random element from the array. * - * @namespace Phaser.Physics.Matter.Components.Bounce + * @function Phaser.Utils.Array.GetRandom * @since 3.0.0 + * + * @param {array} array - The array to select the random entry from. + * @param {number} [startIndex=0] - An optional start index. + * @param {number} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from. + * + * @return {*} A random element from the array, or `null` if no element could be found in the range given. */ -var Bounce = { - - /** - * Sets the restitution on the physics object. - * - * @method Phaser.Physics.Matter.Components.Bounce#setBounce - * @since 3.0.0 - * - * @param {number} value - A Number that defines the restitution (elasticity) of the body. The value is always positive and is in the range (0, 1). A value of 0 means collisions may be perfectly inelastic and no bouncing may occur. A value of 0.8 means the body may bounce back with approximately 80% of its kinetic energy. Note that collision response is based on pairs of bodies, and that restitution values are combined with the following formula: `Math.max(bodyA.restitution, bodyB.restitution)` - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setBounce: function (value) - { - this.body.restitution = value; +var GetRandom = function (array, startIndex, length) +{ + if (startIndex === undefined) { startIndex = 0; } + if (length === undefined) { length = array.length; } - return this; - } + var randomIndex = startIndex + Math.floor(Math.random() * length); + return (array[randomIndex] === undefined) ? null : array[randomIndex]; }; -module.exports = Bounce; +module.exports = GetRandom; /***/ }), -/* 1496 */ -/***/ (function(module, exports) { + +/***/ 24218: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Contains methods for changing the collision filter of a Matter Body. Should be used as a mixin and not called directly. + * Moves the given array element above another one in the array. + * The array is modified in-place. * - * @namespace Phaser.Physics.Matter.Components.Collision - * @since 3.0.0 + * @function Phaser.Utils.Array.MoveAbove + * @since 3.55.0 + * + * @param {array} array - The input array. + * @param {*} item1 - The element to move above base element. + * @param {*} item2 - The base element. + * + * + * @return {array} The input array. */ -var Collision = { - - /** - * Sets the collision category of this Game Object's Matter Body. This number must be a power of two between 2^0 (= 1) and 2^31. - * Two bodies with different collision groups (see {@link #setCollisionGroup}) will only collide if their collision - * categories are included in their collision masks (see {@link #setCollidesWith}). - * - * @method Phaser.Physics.Matter.Components.Collision#setCollisionCategory - * @since 3.0.0 - * - * @param {number} value - Unique category bitfield. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setCollisionCategory: function (value) - { - this.body.collisionFilter.category = value; - - return this; - }, - - /** - * Sets the collision group of this Game Object's Matter Body. If this is zero or two Matter Bodies have different values, - * they will collide according to the usual rules (see {@link #setCollisionCategory} and {@link #setCollisionGroup}). - * If two Matter Bodies have the same positive value, they will always collide; if they have the same negative value, - * they will never collide. - * - * @method Phaser.Physics.Matter.Components.Collision#setCollisionGroup - * @since 3.0.0 - * - * @param {number} value - Unique group index. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setCollisionGroup: function (value) - { - this.body.collisionFilter.group = value; - - return this; - }, - - /** - * Sets the collision mask for this Game Object's Matter Body. Two Matter Bodies with different collision groups will only - * collide if each one includes the other's category in its mask based on a bitwise AND, i.e. `(categoryA & maskB) !== 0` - * and `(categoryB & maskA) !== 0` are both true. - * - * @method Phaser.Physics.Matter.Components.Collision#setCollidesWith - * @since 3.0.0 - * - * @param {(number|number[])} categories - A unique category bitfield, or an array of them. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setCollidesWith: function (categories) +var MoveAbove = function (array, item1, item2) +{ + if (item1 === item2) { - var flags = 0; - - if (!Array.isArray(categories)) - { - flags = categories; - } - else - { - for (var i = 0; i < categories.length; i++) - { - flags |= categories[i]; - } - } - - this.body.collisionFilter.mask = flags; + return array; + } - return this; - }, + var currentIndex = array.indexOf(item1); + var baseIndex = array.indexOf(item2); - /** - * The callback is sent a `Phaser.Types.Physics.Matter.MatterCollisionData` object. - * - * This does not change the bodies collision category, group or filter. Those must be set in addition - * to the callback. - * - * @method Phaser.Physics.Matter.Components.Collision#setOnCollide - * @since 3.22.0 - * - * @param {function} callback - The callback to invoke when this body starts colliding with another. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setOnCollide: function (callback) + if (currentIndex < 0 || baseIndex < 0) { - this.body.onCollideCallback = callback; - - return this; - }, + throw new Error('Supplied items must be elements of the same array'); + } - /** - * The callback is sent a `Phaser.Types.Physics.Matter.MatterCollisionData` object. - * - * This does not change the bodies collision category, group or filter. Those must be set in addition - * to the callback. - * - * @method Phaser.Physics.Matter.Components.Collision#setOnCollideEnd - * @since 3.22.0 - * - * @param {function} callback - The callback to invoke when this body stops colliding with another. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setOnCollideEnd: function (callback) + if (currentIndex > baseIndex) { - this.body.onCollideEndCallback = callback; + // item1 is already above item2 + return array; + } - return this; - }, + // Remove + array.splice(currentIndex, 1); - /** - * The callback is sent a `Phaser.Types.Physics.Matter.MatterCollisionData` object. - * - * This does not change the bodies collision category, group or filter. Those must be set in addition - * to the callback. - * - * @method Phaser.Physics.Matter.Components.Collision#setOnCollideActive - * @since 3.22.0 - * - * @param {function} callback - The callback to invoke for the duration of this body colliding with another. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setOnCollideActive: function (callback) + // Add in new location + if (baseIndex === array.length - 1) { - this.body.onCollideActiveCallback = callback; - - return this; - }, - - /** - * The callback is sent a reference to the other body, along with a `Phaser.Types.Physics.Matter.MatterCollisionData` object. - * - * This does not change the bodies collision category, group or filter. Those must be set in addition - * to the callback. - * - * @method Phaser.Physics.Matter.Components.Collision#setOnCollideWith - * @since 3.22.0 - * - * @param {(MatterJS.Body|MatterJS.Body[])} body - The body, or an array of bodies, to test for collisions with. - * @param {function} callback - The callback to invoke when this body collides with the given body or bodies. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setOnCollideWith: function (body, callback) + array.push(item1); + } + else { - if (!Array.isArray(body)) - { - body = [ body ]; - } - - for (var i = 0; i < body.length; i++) - { - var src = (body[i].hasOwnProperty('body')) ? body[i].body : body[i]; - - this.body.setOnCollideWith(src, callback); - } - - return this; + array.splice(baseIndex, 0, item1); } + return array; }; -module.exports = Collision; +module.exports = MoveAbove; /***/ }), -/* 1497 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 58258: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Body = __webpack_require__(41); - /** - * A component to apply force to Matter.js bodies. + * Moves the given array element below another one in the array. + * The array is modified in-place. * - * @namespace Phaser.Physics.Matter.Components.Force - * @since 3.0.0 + * @function Phaser.Utils.Array.MoveBelow + * @since 3.55.0 + * + * @param {array} array - The input array. + * @param {*} item1 - The element to move below base element. + * @param {*} item2 - The base element. + * + * + * @return {array} The input array. */ -var Force = { - - // force = vec2 / point - - /** - * Applies a force to a body. - * - * @method Phaser.Physics.Matter.Components.Force#applyForce - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} force - A Vector that specifies the force to apply. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - applyForce: function (force) - { - this._tempVec2.set(this.body.position.x, this.body.position.y); - - Body.applyForce(this.body, this._tempVec2, force); - - return this; - }, - - /** - * Applies a force to a body from a given position. - * - * @method Phaser.Physics.Matter.Components.Force#applyForceFrom - * @since 3.0.0 - * - * @param {Phaser.Math.Vector2} position - The position in which the force comes from. - * @param {Phaser.Math.Vector2} force - A Vector that specifies the force to apply. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - applyForceFrom: function (position, force) +var MoveBelow = function (array, item1, item2) +{ + if (item1 === item2) { - Body.applyForce(this.body, position, force); + return array; + } - return this; - }, + var currentIndex = array.indexOf(item1); + var baseIndex = array.indexOf(item2); - /** - * Apply thrust to the forward position of the body. - * - * Use very small values, such as 0.1, depending on the mass and required speed. - * - * @method Phaser.Physics.Matter.Components.Force#thrust - * @since 3.0.0 - * - * @param {number} speed - A speed value to be applied to a directional force. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - thrust: function (speed) + if (currentIndex < 0 || baseIndex < 0) { - var angle = this.body.angle; - - this._tempVec2.set(speed * Math.cos(angle), speed * Math.sin(angle)); - - Body.applyForce(this.body, { x: this.body.position.x, y: this.body.position.y }, this._tempVec2); - - return this; - }, + throw new Error('Supplied items must be elements of the same array'); + } - /** - * Apply thrust to the left position of the body. - * - * Use very small values, such as 0.1, depending on the mass and required speed. - * - * @method Phaser.Physics.Matter.Components.Force#thrustLeft - * @since 3.0.0 - * - * @param {number} speed - A speed value to be applied to a directional force. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - thrustLeft: function (speed) + if (currentIndex < baseIndex) { - var angle = this.body.angle - Math.PI / 2; - - this._tempVec2.set(speed * Math.cos(angle), speed * Math.sin(angle)); - - Body.applyForce(this.body, { x: this.body.position.x, y: this.body.position.y }, this._tempVec2); + // item1 is already below item2 + return array; + } - return this; - }, + // Remove + array.splice(currentIndex, 1); - /** - * Apply thrust to the right position of the body. - * - * Use very small values, such as 0.1, depending on the mass and required speed. - * - * @method Phaser.Physics.Matter.Components.Force#thrustRight - * @since 3.0.0 - * - * @param {number} speed - A speed value to be applied to a directional force. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - thrustRight: function (speed) + // Add in new location + if (baseIndex === 0) { - var angle = this.body.angle + Math.PI / 2; - - this._tempVec2.set(speed * Math.cos(angle), speed * Math.sin(angle)); - - Body.applyForce(this.body, { x: this.body.position.x, y: this.body.position.y }, this._tempVec2); - - return this; - }, - - /** - * Apply thrust to the back position of the body. - * - * Use very small values, such as 0.1, depending on the mass and required speed. - * - * @method Phaser.Physics.Matter.Components.Force#thrustBack - * @since 3.0.0 - * - * @param {number} speed - A speed value to be applied to a directional force. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - thrustBack: function (speed) + array.unshift(item1); + } + else { - var angle = this.body.angle - Math.PI; - - this._tempVec2.set(speed * Math.cos(angle), speed * Math.sin(angle)); - - Body.applyForce(this.body, { x: this.body.position.x, y: this.body.position.y }, this._tempVec2); - - return this; + array.splice(baseIndex, 0, item1); } + return array; }; -module.exports = Force; +module.exports = MoveBelow; /***/ }), -/* 1498 */ -/***/ (function(module, exports) { + +/***/ 51172: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * Contains methods for changing the friction of a Game Object's Matter Body. Should be used a mixin, not called directly. + * Moves the given array element down one place in the array. + * The array is modified in-place. * - * @namespace Phaser.Physics.Matter.Components.Friction - * @since 3.0.0 + * @function Phaser.Utils.Array.MoveDown + * @since 3.4.0 + * + * @param {array} array - The input array. + * @param {*} item - The element to move down the array. + * + * @return {array} The input array. */ -var Friction = { +var MoveDown = function (array, item) +{ + var currentIndex = array.indexOf(item); - /** - * Sets new friction values for this Game Object's Matter Body. - * - * @method Phaser.Physics.Matter.Components.Friction#setFriction - * @since 3.0.0 - * - * @param {number} value - The new friction of the body, between 0 and 1, where 0 allows the Body to slide indefinitely, while 1 allows it to stop almost immediately after a force is applied. - * @param {number} [air] - If provided, the new air resistance of the Body. The higher the value, the faster the Body will slow as it moves through space. 0 means the body has no air resistance. - * @param {number} [fstatic] - If provided, the new static friction of the Body. The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary. 0 means the body will never "stick" when it is nearly stationary. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setFriction: function (value, air, fstatic) + if (currentIndex > 0) { - this.body.friction = value; + var item2 = array[currentIndex - 1]; + + var index2 = array.indexOf(item2); + + array[currentIndex] = item2; + array[index2] = item; + } + + return array; +}; - if (air !== undefined) - { - this.body.frictionAir = air; - } +module.exports = MoveDown; - if (fstatic !== undefined) - { - this.body.frictionStatic = fstatic; - } - return this; - }, +/***/ }), - /** - * Sets a new air resistance for this Game Object's Matter Body. - * A value of 0 means the Body will never slow as it moves through space. - * The higher the value, the faster a Body slows when moving through space. - * - * @method Phaser.Physics.Matter.Components.Friction#setFrictionAir - * @since 3.0.0 - * - * @param {number} value - The new air resistance for the Body. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setFrictionAir: function (value) - { - this.body.frictionAir = value; +/***/ 68396: +/***/ ((module) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets a new static friction for this Game Object's Matter Body. - * A value of 0 means the Body will never "stick" when it is nearly stationary. - * The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary. - * - * @method Phaser.Physics.Matter.Components.Friction#setFrictionStatic - * @since 3.0.0 - * - * @param {number} value - The new static friction for the Body. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setFrictionStatic: function (value) +/** + * Moves an element in an array to a new position within the same array. + * The array is modified in-place. + * + * @function Phaser.Utils.Array.MoveTo + * @since 3.4.0 + * + * @param {array} array - The array. + * @param {*} item - The element to move. + * @param {number} index - The new index that the element will be moved to. + * + * @return {*} The element that was moved. + */ +var MoveTo = function (array, item, index) +{ + var currentIndex = array.indexOf(item); + + if (currentIndex === -1 || index < 0 || index >= array.length) { - this.body.frictionStatic = value; + throw new Error('Supplied index out of bounds'); + } - return this; + if (currentIndex !== index) + { + // Remove + array.splice(currentIndex, 1); + + // Add in new location + array.splice(index, 0, item); } + return item; }; -module.exports = Friction; +module.exports = MoveTo; /***/ }), -/* 1499 */ -/***/ (function(module, exports) { + +/***/ 27555: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * A component to manipulate world gravity for Matter.js bodies. + * Moves the given array element up one place in the array. + * The array is modified in-place. * - * @namespace Phaser.Physics.Matter.Components.Gravity - * @since 3.0.0 + * @function Phaser.Utils.Array.MoveUp + * @since 3.4.0 + * + * @param {array} array - The input array. + * @param {*} item - The element to move up the array. + * + * @return {array} The input array. */ -var Gravity = { +var MoveUp = function (array, item) +{ + var currentIndex = array.indexOf(item); - /** - * A togglable function for ignoring world gravity in real-time on the current body. - * - * @method Phaser.Physics.Matter.Components.Gravity#setIgnoreGravity - * @since 3.0.0 - * - * @param {boolean} value - Set to true to ignore the effect of world gravity, or false to not ignore it. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setIgnoreGravity: function (value) + if (currentIndex !== -1 && currentIndex < array.length - 1) { - this.body.ignoreGravity = value; + // The element one above `item` in the array + var item2 = array[currentIndex + 1]; + var index2 = array.indexOf(item2); - return this; + array[currentIndex] = item2; + array[index2] = item; } + return array; }; -module.exports = Gravity; +module.exports = MoveUp; /***/ }), -/* 1500 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 13401: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Body = __webpack_require__(41); -var Vector2 = __webpack_require__(3); - /** - * Allows accessing the mass, density, and center of mass of a Matter-enabled Game Object. Should be used as a mixin and not directly. + * Create an array representing the range of numbers (usually integers), between, and inclusive of, + * the given `start` and `end` arguments. For example: * - * @namespace Phaser.Physics.Matter.Components.Mass + * `var array = Phaser.Utils.Array.NumberArray(2, 4); // array = [2, 3, 4]` + * `var array = Phaser.Utils.Array.NumberArray(0, 9); // array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]` + * `var array = Phaser.Utils.Array.NumberArray(8, 2); // array = [8, 7, 6, 5, 4, 3, 2]` + * + * This is equivalent to `Phaser.Utils.Array.NumberArrayStep(start, end, 1)`. + * + * You can optionally provide a prefix and / or suffix string. If given the array will contain + * strings, not integers. For example: + * + * `var array = Phaser.Utils.Array.NumberArray(1, 4, 'Level '); // array = ["Level 1", "Level 2", "Level 3", "Level 4"]` + * `var array = Phaser.Utils.Array.NumberArray(5, 7, 'HD-', '.png'); // array = ["HD-5.png", "HD-6.png", "HD-7.png"]` + * + * @function Phaser.Utils.Array.NumberArray * @since 3.0.0 + * + * @param {number} start - The minimum value the array starts with. + * @param {number} end - The maximum value the array contains. + * @param {string} [prefix] - Optional prefix to place before the number. If provided the array will contain strings, not integers. + * @param {string} [suffix] - Optional suffix to place after the number. If provided the array will contain strings, not integers. + * + * @return {(number[]|string[])} The array of number values, or strings if a prefix or suffix was provided. */ -var Mass = { - - /** - * Sets the mass of the Game Object's Matter Body. - * - * @method Phaser.Physics.Matter.Components.Mass#setMass - * @since 3.0.0 - * - * @param {number} value - The new mass of the body. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setMass: function (value) - { - Body.setMass(this.body, value); +var NumberArray = function (start, end, prefix, suffix) +{ + var result = []; - return this; - }, + var i; + var asString = false; - /** - * Sets density of the body. - * - * @method Phaser.Physics.Matter.Components.Mass#setDensity - * @since 3.0.0 - * - * @param {number} value - The new density of the body. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setDensity: function (value) + if (prefix || suffix) { - Body.setDensity(this.body, value); + asString = true; - return this; - }, + if (!prefix) + { + prefix = ''; + } - /** - * The body's center of mass. - * - * Calling this creates a new `Vector2 each time to avoid mutation. - * - * If you only need to read the value and won't change it, you can get it from `GameObject.body.centerOfMass`. - * - * @name Phaser.Physics.Matter.Components.Mass#centerOfMass - * @type {Phaser.Math.Vector2} - * @readonly - * @since 3.10.0 - * - * @return {Phaser.Math.Vector2} The center of mass. - */ - centerOfMass: { + if (!suffix) + { + suffix = ''; + } + } - get: function () + if (end < start) + { + for (i = start; i >= end; i--) { - return new Vector2(this.body.centerOfMass.x, this.body.centerOfMass.y); + if (asString) + { + result.push(prefix + i.toString() + suffix); + } + else + { + result.push(i); + } + } + } + else + { + for (i = start; i <= end; i++) + { + if (asString) + { + result.push(prefix + i.toString() + suffix); + } + else + { + result.push(i); + } } } + return result; }; -module.exports = Mass; +module.exports = NumberArray; /***/ }), -/* 1501 */ -/***/ (function(module, exports) { + +/***/ 89955: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var RoundAwayFromZero = __webpack_require__(67233); + /** - * Enables a Matter-enabled Game Object to be a sensor. Should be used as a mixin and not directly. + * Create an array of numbers (positive and/or negative) progressing from `start` + * up to but not including `end` by advancing by `step`. * - * @namespace Phaser.Physics.Matter.Components.Sensor + * If `start` is less than `end` a zero-length range is created unless a negative `step` is specified. + * + * Certain values for `start` and `end` (eg. NaN/undefined/null) are currently coerced to 0; + * for forward compatibility make sure to pass in actual numbers. + * + * @example + * NumberArrayStep(4); + * // => [0, 1, 2, 3] + * + * NumberArrayStep(1, 5); + * // => [1, 2, 3, 4] + * + * NumberArrayStep(0, 20, 5); + * // => [0, 5, 10, 15] + * + * NumberArrayStep(0, -4, -1); + * // => [0, -1, -2, -3] + * + * NumberArrayStep(1, 4, 0); + * // => [1, 1, 1] + * + * NumberArrayStep(0); + * // => [] + * + * @function Phaser.Utils.Array.NumberArrayStep * @since 3.0.0 + * + * @param {number} [start=0] - The start of the range. + * @param {number} [end=null] - The end of the range. + * @param {number} [step=1] - The value to increment or decrement by. + * + * @return {number[]} The array of number values. */ -var Sensor = { +var NumberArrayStep = function (start, end, step) +{ + if (start === undefined) { start = 0; } + if (end === undefined) { end = null; } + if (step === undefined) { step = 1; } - /** - * Set the body belonging to this Game Object to be a sensor. - * Sensors trigger collision events, but don't react with colliding body physically. - * - * @method Phaser.Physics.Matter.Components.Sensor#setSensor - * @since 3.0.0 - * - * @param {boolean} value - `true` to set the body as a sensor, or `false` to disable it. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setSensor: function (value) + if (end === null) { - this.body.isSensor = value; + end = start; + start = 0; + } - return this; - }, + var result = []; - /** - * Is the body belonging to this Game Object a sensor or not? - * - * @method Phaser.Physics.Matter.Components.Sensor#isSensor - * @since 3.0.0 - * - * @return {boolean} `true` if the body is a sensor, otherwise `false`. - */ - isSensor: function () + var total = Math.max(RoundAwayFromZero((end - start) / (step || 1)), 0); + + for (var i = 0; i < total; i++) { - return this.body.isSensor; + result.push(start); + start += step; } + return result; }; -module.exports = Sensor; +module.exports = NumberArrayStep; /***/ }), -/* 1502 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 53466: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Bodies = __webpack_require__(86); -var Body = __webpack_require__(41); -var FuzzyEquals = __webpack_require__(124); -var GetFastValue = __webpack_require__(2); -var PhysicsEditorParser = __webpack_require__(589); -var PhysicsJSONParser = __webpack_require__(590); -var Vertices = __webpack_require__(64); +/** + * @ignore + */ +function swap (arr, i, j) +{ + var tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; +} + +/** + * @ignore + */ +function defaultCompare (a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; +} /** - * Enables a Matter-enabled Game Object to set its Body. Should be used as a mixin and not directly. + * A [Floyd-Rivest](https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm) quick selection algorithm. * - * @namespace Phaser.Physics.Matter.Components.SetBody + * Rearranges the array items so that all items in the [left, k] range are smaller than all items in [k, right]; + * The k-th element will have the (k - left + 1)th smallest value in [left, right]. + * + * The array is modified in-place. + * + * Based on code by [Vladimir Agafonkin](https://www.npmjs.com/~mourner) + * + * @function Phaser.Utils.Array.QuickSelect * @since 3.0.0 + * + * @param {array} arr - The array to sort. + * @param {number} k - The k-th element index. + * @param {number} [left=0] - The index of the left part of the range. + * @param {number} [right] - The index of the right part of the range. + * @param {function} [compare] - An optional comparison function. Is passed two elements and should return 0, 1 or -1. */ -var SetBody = { - - /** - * Set the body on a Game Object to a rectangle. - * - * Calling this methods resets previous properties you may have set on the body, including - * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed. - * - * @method Phaser.Physics.Matter.Components.SetBody#setRectangle - * @since 3.0.0 - * - * @param {number} width - Width of the rectangle. - * @param {number} height - Height of the rectangle. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setRectangle: function (width, height, options) - { - return this.setBody({ type: 'rectangle', width: width, height: height }, options); - }, - - /** - * Set the body on a Game Object to a circle. - * - * Calling this methods resets previous properties you may have set on the body, including - * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed. - * - * @method Phaser.Physics.Matter.Components.SetBody#setCircle - * @since 3.0.0 - * - * @param {number} radius - The radius of the circle. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setCircle: function (radius, options) - { - return this.setBody({ type: 'circle', radius: radius }, options); - }, - - /** - * Set the body on the Game Object to a polygon shape. - * - * Calling this methods resets previous properties you may have set on the body, including - * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed. - * - * @method Phaser.Physics.Matter.Components.SetBody#setPolygon - * @since 3.0.0 - * - * @param {number} radius - The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle. - * @param {number} sides - The number of sides the polygon will have. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setPolygon: function (radius, sides, options) - { - return this.setBody({ type: 'polygon', sides: sides, radius: radius }, options); - }, - - /** - * Set the body on the Game Object to a trapezoid shape. - * - * Calling this methods resets previous properties you may have set on the body, including - * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed. - * - * @method Phaser.Physics.Matter.Components.SetBody#setTrapezoid - * @since 3.0.0 - * - * @param {number} width - The width of the trapezoid Body. - * @param {number} height - The height of the trapezoid Body. - * @param {number} slope - The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setTrapezoid: function (width, height, slope, options) - { - return this.setBody({ type: 'trapezoid', width: width, height: height, slope: slope }, options); - }, +var QuickSelect = function (arr, k, left, right, compare) +{ + if (left === undefined) { left = 0; } + if (right === undefined) { right = arr.length - 1; } + if (compare === undefined) { compare = defaultCompare; } - /** - * Set this Game Object to use the given existing Matter Body. - * - * The body is first removed from the world before being added to this Game Object. - * - * @method Phaser.Physics.Matter.Components.SetBody#setExistingBody - * @since 3.0.0 - * - * @param {MatterJS.BodyType} body - The Body this Game Object should use. - * @param {boolean} [addToWorld=true] - Should the body be immediately added to the World? - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setExistingBody: function (body, addToWorld) + while (right > left) { - if (addToWorld === undefined) { addToWorld = true; } - - if (this.body) + if (right - left > 600) { - this.world.remove(this.body, true); - } - - this.body = body; + var n = right - left + 1; + var m = k - left + 1; + var z = Math.log(n); + var s = 0.5 * Math.exp(2 * z / 3); + var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); + var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); + var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - for (var i = 0; i < body.parts.length; i++) - { - body.parts[i].gameObject = this; + QuickSelect(arr, k, newLeft, newRight, compare); } - var _this = this; + var t = arr[k]; + var i = left; + var j = right; - body.destroy = function destroy () - { - _this.world.remove(_this.body, true); - _this.body.gameObject = null; - }; + swap(arr, left, k); - if (addToWorld) + if (compare(arr[right], t) > 0) { - if (this.world.has(body)) - { - // Because it could be part of another Composite - this.world.remove(body, true); - } - - this.world.add(body); + swap(arr, left, right); } - if (this._originComponent) + while (i < j) { - var rx = body.render.sprite.xOffset; - var ry = body.render.sprite.yOffset; + swap(arr, i, j); - var comx = body.centerOfMass.x; - var comy = body.centerOfMass.y; + i++; + j--; - if (FuzzyEquals(comx, 0.5) && FuzzyEquals(comy, 0.5)) + while (compare(arr[i], t) < 0) { - this.setOrigin(rx + 0.5, ry + 0.5); + i++; } - else - { - var cx = body.centerOffset.x; - var cy = body.centerOffset.y; - this.setOrigin(rx + (cx / this.displayWidth), ry + (cy / this.displayHeight)); + while (compare(arr[j], t) > 0) + { + j--; } } - return this; - }, - - /** - * Set this Game Object to create and use a new Body based on the configuration object given. - * - * Calling this method resets previous properties you may have set on the body, including - * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed. - * - * @method Phaser.Physics.Matter.Components.SetBody#setBody - * @since 3.0.0 - * - * @param {(string|Phaser.Types.Physics.Matter.MatterSetBodyConfig)} config - Either a string, such as `circle`, or a Matter Set Body Configuration object. - * @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setBody: function (config, options) - { - if (!config) + if (compare(arr[left], t) === 0) { - return this; + swap(arr, left, j); } - - var body; - - // Allow them to do: shape: 'circle' instead of shape: { type: 'circle' } - if (typeof config === 'string') + else { - // Using defaults - config = { type: config }; + j++; + swap(arr, j, right); } - var shapeType = GetFastValue(config, 'type', 'rectangle'); - var bodyX = GetFastValue(config, 'x', this._tempVec2.x); - var bodyY = GetFastValue(config, 'y', this._tempVec2.y); - var bodyWidth = GetFastValue(config, 'width', this.width); - var bodyHeight = GetFastValue(config, 'height', this.height); - - switch (shapeType) + if (j <= k) { - case 'rectangle': - body = Bodies.rectangle(bodyX, bodyY, bodyWidth, bodyHeight, options); - break; - - case 'circle': - var radius = GetFastValue(config, 'radius', Math.max(bodyWidth, bodyHeight) / 2); - var maxSides = GetFastValue(config, 'maxSides', 25); - body = Bodies.circle(bodyX, bodyY, radius, options, maxSides); - break; - - case 'trapezoid': - var slope = GetFastValue(config, 'slope', 0.5); - body = Bodies.trapezoid(bodyX, bodyY, bodyWidth, bodyHeight, slope, options); - break; - - case 'polygon': - var sides = GetFastValue(config, 'sides', 5); - var pRadius = GetFastValue(config, 'radius', Math.max(bodyWidth, bodyHeight) / 2); - body = Bodies.polygon(bodyX, bodyY, sides, pRadius, options); - break; - - case 'fromVertices': - case 'fromVerts': - - var verts = GetFastValue(config, 'verts', null); - - if (verts) - { - // Has the verts array come from Vertices.fromPath, or is it raw? - if (typeof verts === 'string') - { - verts = Vertices.fromPath(verts); - } - - if (this.body && !this.body.hasOwnProperty('temp')) - { - Body.setVertices(this.body, verts); - - body = this.body; - } - else - { - var flagInternal = GetFastValue(config, 'flagInternal', false); - var removeCollinear = GetFastValue(config, 'removeCollinear', 0.01); - var minimumArea = GetFastValue(config, 'minimumArea', 10); - - body = Bodies.fromVertices(bodyX, bodyY, verts, options, flagInternal, removeCollinear, minimumArea); - } - } - - break; - - case 'fromPhysicsEditor': - body = PhysicsEditorParser.parseBody(bodyX, bodyY, config, options); - break; - - case 'fromPhysicsTracer': - body = PhysicsJSONParser.parseBody(bodyX, bodyY, config, options); - break; + left = j + 1; } - if (body) + if (k <= j) { - this.setExistingBody(body, config.addToWorld); + right = j - 1; } - - return this; } - }; -module.exports = SetBody; +module.exports = QuickSelect; /***/ }), -/* 1503 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 75757: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Events = __webpack_require__(272); -var Sleeping = __webpack_require__(165); -var MatterEvents = __webpack_require__(166); +var GetValue = __webpack_require__(10850); +var Shuffle = __webpack_require__(18592); + +var BuildChunk = function (a, b, qty) +{ + var out = []; + + for (var aIndex = 0; aIndex < a.length; aIndex++) + { + for (var bIndex = 0; bIndex < b.length; bIndex++) + { + for (var i = 0; i < qty; i++) + { + out.push({ a: a[aIndex], b: b[bIndex] }); + } + } + } + + return out; +}; /** - * Enables a Matter-enabled Game Object to be able to go to sleep. Should be used as a mixin and not directly. + * Creates an array populated with a range of values, based on the given arguments and configuration object. * - * @namespace Phaser.Physics.Matter.Components.Sleep + * Range ([a,b,c], [1,2,3]) = + * a1, a2, a3, b1, b2, b3, c1, c2, c3 + * + * Range ([a,b], [1,2,3], qty = 3) = + * a1, a1, a1, a2, a2, a2, a3, a3, a3, b1, b1, b1, b2, b2, b2, b3, b3, b3 + * + * Range ([a,b,c], [1,2,3], repeat x1) = + * a1, a2, a3, b1, b2, b3, c1, c2, c3, a1, a2, a3, b1, b2, b3, c1, c2, c3 + * + * Range ([a,b], [1,2], repeat -1 = endless, max = 14) = + * Maybe if max is set then repeat goes to -1 automatically? + * a1, a2, b1, b2, a1, a2, b1, b2, a1, a2, b1, b2, a1, a2 (capped at 14 elements) + * + * Range ([a], [1,2,3,4,5], random = true) = + * a4, a1, a5, a2, a3 + * + * Range ([a, b], [1,2,3], random = true) = + * b3, a2, a1, b1, a3, b2 + * + * Range ([a, b, c], [1,2,3], randomB = true) = + * a3, a1, a2, b2, b3, b1, c1, c3, c2 + * + * Range ([a], [1,2,3,4,5], yoyo = true) = + * a1, a2, a3, a4, a5, a5, a4, a3, a2, a1 + * + * Range ([a, b], [1,2,3], yoyo = true) = + * a1, a2, a3, b1, b2, b3, b3, b2, b1, a3, a2, a1 + * + * @function Phaser.Utils.Array.Range * @since 3.0.0 + * + * @param {array} a - The first array of range elements. + * @param {array} b - The second array of range elements. + * @param {object} [options] - A range configuration object. Can contain: repeat, random, randomB, yoyo, max, qty. + * + * @return {array} An array of arranged elements. */ -var Sleep = { - - /** - * Sets this Body to sleep. - * - * @method Phaser.Physics.Matter.Components.Sleep#setToSleep - * @since 3.22.0 - * - * @return {this} This Game Object. - */ - setToSleep: function () - { - Sleeping.set(this.body, true); +var Range = function (a, b, options) +{ + var max = GetValue(options, 'max', 0); + var qty = GetValue(options, 'qty', 1); + var random = GetValue(options, 'random', false); + var randomB = GetValue(options, 'randomB', false); + var repeat = GetValue(options, 'repeat', 0); + var yoyo = GetValue(options, 'yoyo', false); - return this; - }, + var out = []; - /** - * Wakes this Body if asleep. - * - * @method Phaser.Physics.Matter.Components.Sleep#setAwake - * @since 3.22.0 - * - * @return {this} This Game Object. - */ - setAwake: function () + if (randomB) { - Sleeping.set(this.body, false); - - return this; - }, + Shuffle(b); + } - /** - * Sets the number of updates in which this body must have near-zero velocity before it is set as sleeping (if sleeping is enabled by the engine). - * - * @method Phaser.Physics.Matter.Components.Sleep#setSleepThreshold - * @since 3.0.0 - * - * @param {number} [value=60] - A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping. - * - * @return {this} This Game Object. - */ - setSleepThreshold: function (value) + // Endless repeat, so limit by max + if (repeat === -1) { - if (value === undefined) { value = 60; } - - this.body.sleepThreshold = value; - - return this; - }, + if (max === 0) + { + repeat = 0; + } + else + { + // Work out how many repeats we need + var total = (a.length * b.length) * qty; - /** - * Enable sleep and wake events for this body. - * - * By default when a body goes to sleep, or wakes up, it will not emit any events. - * - * The events are emitted by the Matter World instance and can be listened to via - * the `SLEEP_START` and `SLEEP_END` events. - * - * @method Phaser.Physics.Matter.Components.Sleep#setSleepEvents - * @since 3.0.0 - * - * @param {boolean} start - `true` if you want the sleep start event to be emitted for this body. - * @param {boolean} end - `true` if you want the sleep end event to be emitted for this body. - * - * @return {this} This Game Object. - */ - setSleepEvents: function (start, end) - { - this.setSleepStartEvent(start); - this.setSleepEndEvent(end); + if (yoyo) + { + total *= 2; + } - return this; - }, + repeat = Math.ceil(max / total); + } + } - /** - * Enables or disables the Sleep Start event for this body. - * - * @method Phaser.Physics.Matter.Components.Sleep#setSleepStartEvent - * @since 3.0.0 - * - * @param {boolean} value - `true` to enable the sleep event, or `false` to disable it. - * - * @return {this} This Game Object. - */ - setSleepStartEvent: function (value) + for (var i = 0; i <= repeat; i++) { - if (value) - { - var world = this.world; + var chunk = BuildChunk(a, b, qty); - MatterEvents.on(this.body, 'sleepStart', function (event) - { - world.emit(Events.SLEEP_START, event, this); - }); - } - else + if (random) { - MatterEvents.off(this.body, 'sleepStart'); + Shuffle(chunk); } - return this; - }, + out = out.concat(chunk); - /** - * Enables or disables the Sleep End event for this body. - * - * @method Phaser.Physics.Matter.Components.Sleep#setSleepEndEvent - * @since 3.0.0 - * - * @param {boolean} value - `true` to enable the sleep event, or `false` to disable it. - * - * @return {this} This Game Object. - */ - setSleepEndEvent: function (value) - { - if (value) + if (yoyo) { - var world = this.world; + chunk.reverse(); - MatterEvents.on(this.body, 'sleepEnd', function (event) - { - world.emit(Events.SLEEP_END, event, this); - }); - } - else - { - MatterEvents.off(this.body, 'sleepEnd'); + out = out.concat(chunk); } + } - return this; + if (max) + { + out.splice(max); } + return out; }; -module.exports = Sleep; +module.exports = Range; /***/ }), -/* 1504 */ -/***/ (function(module, exports) { + +/***/ 66458: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @typedef {object} Phaser.Physics.Matter.Events.AfterAddEvent - * - * @property {any[]} object - An array of the object(s) that have been added. May be a single body, constraint, composite or a mixture of these. - * @property {any} source - The source object of the event. - * @property {string} name - The name of the event. - */ +var SpliceOne = __webpack_require__(72677); /** - * The Matter Physics After Add Event. - * - * This event is dispatched by a Matter Physics World instance at the end of the process when a new Body - * or Constraint has just been added to the world. - * - * Listen to it from a Scene using: `this.matter.world.on('afteradd', listener)`. + * Removes the given item, or array of items, from the array. * - * @event Phaser.Physics.Matter.Events#AFTER_ADD - * @since 3.22.0 - * - * @param {Phaser.Physics.Matter.Events.AfterAddEvent} event - The Add Event object. + * The array is modified in-place. + * + * You can optionally specify a callback to be invoked for each item successfully removed from the array. + * + * @function Phaser.Utils.Array.Remove + * @since 3.4.0 + * + * @param {array} array - The array to be modified. + * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array. + * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array. + * @param {object} [context] - The context in which the callback is invoked. + * + * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array. */ -module.exports = 'afteradd'; +var Remove = function (array, item, callback, context) +{ + if (context === undefined) { context = array; } + var index; -/***/ }), -/* 1505 */ -/***/ (function(module, exports) { + // Fast path to avoid array mutation and iteration + if (!Array.isArray(item)) + { + index = array.indexOf(item); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (index !== -1) + { + SpliceOne(array, index); -/** - * @typedef {object} Phaser.Physics.Matter.Events.AfterRemoveEvent - * - * @property {any[]} object - An array of the object(s) that were removed. May be a single body, constraint, composite or a mixture of these. - * @property {any} source - The source object of the event. - * @property {string} name - The name of the event. - */ + if (callback) + { + callback.call(context, item); + } -/** - * The Matter Physics After Remove Event. - * - * This event is dispatched by a Matter Physics World instance at the end of the process when a - * Body or Constraint was removed from the world. - * - * Listen to it from a Scene using: `this.matter.world.on('afterremove', listener)`. - * - * @event Phaser.Physics.Matter.Events#AFTER_REMOVE - * @since 3.22.0 - * - * @param {Phaser.Physics.Matter.Events.AfterRemoveEvent} event - The Remove Event object. - */ -module.exports = 'afterremove'; + return item; + } + else + { + return null; + } + } + // If we got this far, we have an array of items to remove -/***/ }), -/* 1506 */ -/***/ (function(module, exports) { + var itemLength = item.length - 1; + var removed = []; -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + while (itemLength >= 0) + { + var entry = item[itemLength]; -/** - * @typedef {object} Phaser.Physics.Matter.Events.AfterUpdateEvent - * - * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. - * @property {any} source - The source object of the event. - * @property {string} name - The name of the event. - */ + index = array.indexOf(entry); -/** - * The Matter Physics After Update Event. - * - * This event is dispatched by a Matter Physics World instance after the engine has updated and all collision events have resolved. - * - * Listen to it from a Scene using: `this.matter.world.on('afterupdate', listener)`. - * - * @event Phaser.Physics.Matter.Events#AFTER_UPDATE - * @since 3.0.0 - * - * @param {Phaser.Physics.Matter.Events.AfterUpdateEvent} event - The Update Event object. - */ -module.exports = 'afterupdate'; + if (index !== -1) + { + SpliceOne(array, index); + removed.push(entry); -/***/ }), -/* 1507 */ -/***/ (function(module, exports) { + if (callback) + { + callback.call(context, entry); + } + } -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + itemLength--; + } -/** - * @typedef {object} Phaser.Physics.Matter.Events.BeforeAddEvent - * - * @property {any[]} object - An array of the object(s) to be added. May be a single body, constraint, composite or a mixture of these. - * @property {any} source - The source object of the event. - * @property {string} name - The name of the event. - */ + return removed; +}; -/** - * The Matter Physics Before Add Event. - * - * This event is dispatched by a Matter Physics World instance at the start of the process when a new Body - * or Constraint is being added to the world. - * - * Listen to it from a Scene using: `this.matter.world.on('beforeadd', listener)`. - * - * @event Phaser.Physics.Matter.Events#BEFORE_ADD - * @since 3.22.0 - * - * @param {Phaser.Physics.Matter.Events.BeforeAddEvent} event - The Add Event object. - */ -module.exports = 'beforeadd'; +module.exports = Remove; /***/ }), -/* 1508 */ -/***/ (function(module, exports) { + +/***/ 8324: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @typedef {object} Phaser.Physics.Matter.Events.BeforeRemoveEvent - * - * @property {any[]} object - An array of the object(s) to be removed. May be a single body, constraint, composite or a mixture of these. - * @property {any} source - The source object of the event. - * @property {string} name - The name of the event. - */ +var SpliceOne = __webpack_require__(72677); /** - * The Matter Physics Before Remove Event. - * - * This event is dispatched by a Matter Physics World instance at the start of the process when a - * Body or Constraint is being removed from the world. - * - * Listen to it from a Scene using: `this.matter.world.on('beforeremove', listener)`. + * Removes the item from the given position in the array. * - * @event Phaser.Physics.Matter.Events#BEFORE_REMOVE - * @since 3.22.0 - * - * @param {Phaser.Physics.Matter.Events.BeforeRemoveEvent} event - The Remove Event object. + * The array is modified in-place. + * + * You can optionally specify a callback to be invoked for the item if it is successfully removed from the array. + * + * @function Phaser.Utils.Array.RemoveAt + * @since 3.4.0 + * + * @param {array} array - The array to be modified. + * @param {number} index - The array index to remove the item from. The index must be in bounds or it will throw an error. + * @param {function} [callback] - A callback to be invoked for the item removed from the array. + * @param {object} [context] - The context in which the callback is invoked. + * + * @return {*} The item that was removed. */ -module.exports = 'beforeremove'; +var RemoveAt = function (array, index, callback, context) +{ + if (context === undefined) { context = array; } + + if (index < 0 || index > array.length - 1) + { + throw new Error('Index out of bounds'); + } + + var item = SpliceOne(array, index); + + if (callback) + { + callback.call(context, item); + } + + return item; +}; + +module.exports = RemoveAt; /***/ }), -/* 1509 */ -/***/ (function(module, exports) { + +/***/ 47427: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @typedef {object} Phaser.Physics.Matter.Events.BeforeUpdateEvent - * - * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. - * @property {any} source - The source object of the event. - * @property {string} name - The name of the event. - */ +var SafeRange = __webpack_require__(45838); /** - * The Matter Physics Before Update Event. - * - * This event is dispatched by a Matter Physics World instance right before all the collision processing takes place. - * - * Listen to it from a Scene using: `this.matter.world.on('beforeupdate', listener)`. + * Removes the item within the given range in the array. * - * @event Phaser.Physics.Matter.Events#BEFORE_UPDATE - * @since 3.0.0 - * - * @param {Phaser.Physics.Matter.Events.BeforeUpdateEvent} event - The Update Event object. + * The array is modified in-place. + * + * You can optionally specify a callback to be invoked for the item/s successfully removed from the array. + * + * @function Phaser.Utils.Array.RemoveBetween + * @since 3.4.0 + * + * @param {array} array - The array to be modified. + * @param {number} startIndex - The start index to remove from. + * @param {number} endIndex - The end index to remove to. + * @param {function} [callback] - A callback to be invoked for the item removed from the array. + * @param {object} [context] - The context in which the callback is invoked. + * + * @return {Array.<*>} An array of items that were removed. */ -module.exports = 'beforeupdate'; +var RemoveBetween = function (array, startIndex, endIndex, callback, context) +{ + if (startIndex === undefined) { startIndex = 0; } + if (endIndex === undefined) { endIndex = array.length; } + if (context === undefined) { context = array; } + if (SafeRange(array, startIndex, endIndex)) + { + var size = endIndex - startIndex; -/***/ }), -/* 1510 */ -/***/ (function(module, exports) { + var removed = array.splice(startIndex, size); -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ + if (callback) + { + for (var i = 0; i < removed.length; i++) + { + var entry = removed[i]; -/** - * @typedef {object} Phaser.Physics.Matter.Events.CollisionActiveEvent - * - * @property {Phaser.Types.Physics.Matter.MatterCollisionData[]} pairs - A list of all affected pairs in the collision. - * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. - * @property {any} source - The source object of the event. - * @property {string} name - The name of the event. - */ + callback.call(context, entry); + } + } -/** - * The Matter Physics Collision Active Event. - * - * This event is dispatched by a Matter Physics World instance after the engine has updated. - * It provides a list of all pairs that are colliding in the current tick (if any). - * - * Listen to it from a Scene using: `this.matter.world.on('collisionactive', listener)`. - * - * @event Phaser.Physics.Matter.Events#COLLISION_ACTIVE - * @since 3.0.0 - * - * @param {Phaser.Physics.Matter.Events.CollisionActiveEvent} event - The Collision Event object. - * @param {MatterJS.BodyType} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. - * @param {MatterJS.BodyType} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. - */ -module.exports = 'collisionactive'; + return removed; + } + else + { + return []; + } +}; + +module.exports = RemoveBetween; /***/ }), -/* 1511 */ -/***/ (function(module, exports) { + +/***/ 50147: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -/** - * @typedef {object} Phaser.Physics.Matter.Events.CollisionEndEvent - * - * @property {Phaser.Types.Physics.Matter.MatterCollisionData[]} pairs - A list of all affected pairs in the collision. - * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. - * @property {any} source - The source object of the event. - * @property {string} name - The name of the event. - */ +var SpliceOne = __webpack_require__(72677); /** - * The Matter Physics Collision End Event. - * - * This event is dispatched by a Matter Physics World instance after the engine has updated. - * It provides a list of all pairs that have finished colliding in the current tick (if any). - * - * Listen to it from a Scene using: `this.matter.world.on('collisionend', listener)`. + * Removes a random object from the given array and returns it. + * Will return null if there are no array items that fall within the specified range or if there is no item for the randomly chosen index. * - * @event Phaser.Physics.Matter.Events#COLLISION_END + * @function Phaser.Utils.Array.RemoveRandomElement * @since 3.0.0 - * - * @param {Phaser.Physics.Matter.Events.CollisionEndEvent} event - The Collision Event object. - * @param {MatterJS.BodyType} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. - * @param {MatterJS.BodyType} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * + * @param {array} array - The array to removed a random element from. + * @param {number} [start=0] - The array index to start the search from. + * @param {number} [length=array.length] - Optional restriction on the number of elements to randomly select from. + * + * @return {object} The random element that was removed, or `null` if there were no array elements that fell within the given range. */ -module.exports = 'collisionend'; +var RemoveRandomElement = function (array, start, length) +{ + if (start === undefined) { start = 0; } + if (length === undefined) { length = array.length; } + + var randomIndex = start + Math.floor(Math.random() * length); + + return SpliceOne(array, randomIndex); +}; + +module.exports = RemoveRandomElement; /***/ }), -/* 1512 */ -/***/ (function(module, exports) { + +/***/ 80402: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @typedef {object} Phaser.Physics.Matter.Events.CollisionStartEvent + * Replaces an element of the array with the new element. + * The new element cannot already be a member of the array. + * The array is modified in-place. * - * @property {Phaser.Types.Physics.Matter.MatterCollisionData[]} pairs - A list of all affected pairs in the collision. - * @property {number} timestamp - The Matter Engine `timing.timestamp` value for the event. - * @property {any} source - The source object of the event. - * @property {string} name - The name of the event. - */ - -/** - * The Matter Physics Collision Start Event. - * - * This event is dispatched by a Matter Physics World instance after the engine has updated. - * It provides a list of all pairs that have started to collide in the current tick (if any). - * - * Listen to it from a Scene using: `this.matter.world.on('collisionstart', listener)`. + * @function Phaser.Utils.Array.Replace + * @since 3.4.0 * - * @event Phaser.Physics.Matter.Events#COLLISION_START - * @since 3.0.0 - * - * @param {Phaser.Physics.Matter.Events.CollisionStartEvent} event - The Collision Event object. - * @param {MatterJS.BodyType} bodyA - The first body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. - * @param {MatterJS.BodyType} bodyB - The second body of the first colliding pair. The `event.pairs` array may contain more colliding bodies. + * @param {array} array - The array to search within. + * @param {*} oldChild - The element in the array that will be replaced. + * @param {*} newChild - The element to be inserted into the array at the position of `oldChild`. + * + * @return {boolean} Returns true if the oldChild was successfully replaced, otherwise returns false. */ -module.exports = 'collisionstart'; +var Replace = function (array, oldChild, newChild) +{ + var index1 = array.indexOf(oldChild); + var index2 = array.indexOf(newChild); + + if (index1 !== -1 && index2 === -1) + { + array[index1] = newChild; + + return true; + } + else + { + return false; + } +}; + +module.exports = Replace; /***/ }), -/* 1513 */ -/***/ (function(module, exports) { + +/***/ 77640: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Matter Physics Drag End Event. - * - * This event is dispatched by a Matter Physics World instance when a Pointer Constraint - * stops dragging a body. - * - * Listen to it from a Scene using: `this.matter.world.on('dragend', listener)`. + * Moves the element at the start of the array to the end, shifting all items in the process. + * The "rotation" happens to the left. * - * @event Phaser.Physics.Matter.Events#DRAG_END - * @since 3.16.2 - * - * @param {MatterJS.BodyType} body - The Body that has stopped being dragged. This is a Matter Body, not a Phaser Game Object. - * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that was dragging the body. + * @function Phaser.Utils.Array.RotateLeft + * @since 3.0.0 + * + * @param {array} array - The array to shift to the left. This array is modified in place. + * @param {number} [total=1] - The number of times to shift the array. + * + * @return {*} The most recently shifted element. */ -module.exports = 'dragend'; +var RotateLeft = function (array, total) +{ + if (total === undefined) { total = 1; } + + var element = null; + + for (var i = 0; i < total; i++) + { + element = array.shift(); + array.push(element); + } + + return element; +}; + +module.exports = RotateLeft; /***/ }), -/* 1514 */ -/***/ (function(module, exports) { + +/***/ 38487: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Matter Physics Drag Event. - * - * This event is dispatched by a Matter Physics World instance when a Pointer Constraint - * is actively dragging a body. It is emitted each time the pointer moves. - * - * Listen to it from a Scene using: `this.matter.world.on('drag', listener)`. + * Moves the element at the end of the array to the start, shifting all items in the process. + * The "rotation" happens to the right. * - * @event Phaser.Physics.Matter.Events#DRAG - * @since 3.16.2 - * - * @param {MatterJS.BodyType} body - The Body that is being dragged. This is a Matter Body, not a Phaser Game Object. - * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that is dragging the body. + * @function Phaser.Utils.Array.RotateRight + * @since 3.0.0 + * + * @param {array} array - The array to shift to the right. This array is modified in place. + * @param {number} [total=1] - The number of times to shift the array. + * + * @return {*} The most recently shifted element. */ -module.exports = 'drag'; +var RotateRight = function (array, total) +{ + if (total === undefined) { total = 1; } + + var element = null; + + for (var i = 0; i < total; i++) + { + element = array.pop(); + array.unshift(element); + } + + return element; +}; + +module.exports = RotateRight; /***/ }), -/* 1515 */ -/***/ (function(module, exports) { + +/***/ 45838: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Matter Physics Drag Start Event. - * - * This event is dispatched by a Matter Physics World instance when a Pointer Constraint - * starts dragging a body. - * - * Listen to it from a Scene using: `this.matter.world.on('dragstart', listener)`. + * Tests if the start and end indexes are a safe range for the given array. * - * @event Phaser.Physics.Matter.Events#DRAG_START - * @since 3.16.2 - * - * @param {MatterJS.BodyType} body - The Body that has started being dragged. This is a Matter Body, not a Phaser Game Object. - * @param {MatterJS.BodyType} part - The part of the body that was clicked on. - * @param {Phaser.Physics.Matter.PointerConstraint} constraint - The Pointer Constraint that is dragging the body. + * @function Phaser.Utils.Array.SafeRange + * @since 3.4.0 + * + * @param {array} array - The array to check. + * @param {number} startIndex - The start index. + * @param {number} endIndex - The end index. + * @param {boolean} [throwError=true] - Throw an error if the range is out of bounds. + * + * @return {boolean} True if the range is safe, otherwise false. */ -module.exports = 'dragstart'; +var SafeRange = function (array, startIndex, endIndex, throwError) +{ + var len = array.length; + + if (startIndex < 0 || + startIndex > len || + startIndex >= endIndex || + endIndex > len) + { + if (throwError) + { + throw new Error('Range Error: Values outside acceptable range'); + } + + return false; + } + else + { + return true; + } +}; + +module.exports = SafeRange; /***/ }), -/* 1516 */ -/***/ (function(module, exports) { + +/***/ 27847: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * The Matter Physics World Pause Event. - * - * This event is dispatched by an Matter Physics World instance when it is paused. - * - * Listen to it from a Scene using: `this.matter.world.on('pause', listener)`. + * Moves the given element to the bottom of the array. + * The array is modified in-place. * - * @event Phaser.Physics.Matter.Events#PAUSE - * @since 3.0.0 + * @function Phaser.Utils.Array.SendToBack + * @since 3.4.0 + * + * @param {array} array - The array. + * @param {*} item - The element to move. + * + * @return {*} The element that was moved. */ -module.exports = 'pause'; +var SendToBack = function (array, item) +{ + var currentIndex = array.indexOf(item); + + if (currentIndex !== -1 && currentIndex > 0) + { + array.splice(currentIndex, 1); + array.unshift(item); + } + + return item; +}; + +module.exports = SendToBack; /***/ }), -/* 1517 */ -/***/ (function(module, exports) { + +/***/ 6034: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var SafeRange = __webpack_require__(45838); + /** - * The Matter Physics World Resume Event. - * - * This event is dispatched by an Matter Physics World instance when it resumes from a paused state. - * - * Listen to it from a Scene using: `this.matter.world.on('resume', listener)`. + * Scans the array for elements with the given property. If found, the property is set to the `value`. * - * @event Phaser.Physics.Matter.Events#RESUME - * @since 3.0.0 + * For example: `SetAll('visible', true)` would set all elements that have a `visible` property to `false`. + * + * Optionally you can specify a start and end index. For example if the array had 100 elements, + * and you set `startIndex` to 0 and `endIndex` to 50, it would update only the first 50 elements. + * + * @function Phaser.Utils.Array.SetAll + * @since 3.4.0 + * + * @param {array} array - The array to search. + * @param {string} property - The property to test for on each array element. + * @param {*} value - The value to set the property to. + * @param {number} [startIndex] - An optional start index to search from. + * @param {number} [endIndex] - An optional end index to search to. + * + * @return {array} The input array. */ -module.exports = 'resume'; +var SetAll = function (array, property, value, startIndex, endIndex) +{ + if (startIndex === undefined) { startIndex = 0; } + if (endIndex === undefined) { endIndex = array.length; } + + if (SafeRange(array, startIndex, endIndex)) + { + for (var i = startIndex; i < endIndex; i++) + { + var entry = array[i]; + + if (entry.hasOwnProperty(property)) + { + entry[property] = value; + } + } + } + + return array; +}; + +module.exports = SetAll; /***/ }), -/* 1518 */ -/***/ (function(module, exports) { + +/***/ 18592: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @typedef {object} Phaser.Physics.Matter.Events.SleepEndEvent + * Shuffles the contents of the given array using the Fisher-Yates implementation. * - * @property {any} source - The source object of the event. - * @property {string} name - The name of the event. - */ - -/** - * The Matter Physics Sleep End Event. - * - * This event is dispatched by a Matter Physics World instance when a Body stop sleeping. - * - * Listen to it from a Scene using: `this.matter.world.on('sleepend', listener)`. + * The original array is modified directly and returned. * - * @event Phaser.Physics.Matter.Events#SLEEP_END + * @function Phaser.Utils.Array.Shuffle * @since 3.0.0 - * - * @param {Phaser.Physics.Matter.Events.SleepEndEvent} event - The Sleep Event object. - * @param {MatterJS.BodyType} body - The body that has stopped sleeping. + * + * @generic T + * @genericUse {T[]} - [array,$return] + * + * @param {T[]} array - The array to shuffle. This array is modified in place. + * + * @return {T[]} The shuffled array. */ -module.exports = 'sleepend'; +var Shuffle = function (array) +{ + for (var i = array.length - 1; i > 0; i--) + { + var j = Math.floor(Math.random() * (i + 1)); + var temp = array[i]; + array[i] = array[j]; + array[j] = temp; + } + + return array; +}; + +module.exports = Shuffle; /***/ }), -/* 1519 */ -/***/ (function(module, exports) { + +/***/ 28834: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * @typedef {object} Phaser.Physics.Matter.Events.SleepStartEvent + * Takes the given array and runs a numeric sort on it, ignoring any non-digits that + * may be in the entries. * - * @property {any} source - The source object of the event. - * @property {string} name - The name of the event. - */ - -/** - * The Matter Physics Sleep Start Event. - * - * This event is dispatched by a Matter Physics World instance when a Body goes to sleep. - * - * Listen to it from a Scene using: `this.matter.world.on('sleepstart', listener)`. + * You should only run this on arrays containing strings. * - * @event Phaser.Physics.Matter.Events#SLEEP_START - * @since 3.0.0 - * - * @param {Phaser.Physics.Matter.Events.SleepStartEvent} event - The Sleep Event object. - * @param {MatterJS.BodyType} body - The body that has gone to sleep. + * @function Phaser.Utils.Array.SortByDigits + * @since 3.50.0 + * + * @param {string[]} array - The input array of strings. + * + * @return {string[]} The sorted input array. */ -module.exports = 'sleepstart'; +var SortByDigits = function (array) +{ + var re = /\D/g; + + array.sort(function (a, b) + { + return (parseInt(a.replace(re, ''), 10) - parseInt(b.replace(re, ''), 10)); + }); + + return array; +}; + +module.exports = SortByDigits; /***/ }), -/* 1520 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 72677: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Body = __webpack_require__(41); - /** - * Provides methods used for getting and setting the static state of a physics body. + * Removes a single item from an array and returns it without creating gc, like the native splice does. + * Based on code by Mike Reinstein. * - * @namespace Phaser.Physics.Matter.Components.Static + * @function Phaser.Utils.Array.SpliceOne * @since 3.0.0 + * + * @param {array} array - The array to splice from. + * @param {number} index - The index of the item which should be spliced. + * + * @return {*} The item which was spliced (removed). */ -var Static = { - - /** - * Changes the physics body to be either static `true` or dynamic `false`. - * - * @method Phaser.Physics.Matter.Components.Static#setStatic - * @since 3.0.0 - * - * @param {boolean} value - `true` to set the body as being static, or `false` to make it dynamic. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setStatic: function (value) +var SpliceOne = function (array, index) +{ + if (index >= array.length) { - Body.setStatic(this.body, value); + return; + } - return this; - }, + var len = array.length - 1; - /** - * Returns `true` if the body is static, otherwise `false` for a dynamic body. - * - * @method Phaser.Physics.Matter.Components.Static#isStatic - * @since 3.0.0 - * - * @return {boolean} `true` if the body is static, otherwise `false`. - */ - isStatic: function () + var item = array[index]; + + for (var i = index; i < len; i++) { - return this.body.isStatic; + array[i] = array[i + 1]; } + array.length = len; + + return item; }; -module.exports = Static; +module.exports = SpliceOne; /***/ }), -/* 1521 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 17922: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @author Angry Bytes (and contributors) + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Body = __webpack_require__(41); -var MATH_CONST = __webpack_require__(14); -var WrapAngle = __webpack_require__(269); -var WrapAngleDegrees = __webpack_require__(270); +var Device = __webpack_require__(77290); -// global bitmask flag for GameObject.renderMask (used by Scale) -var _FLAG = 4; // 0100 - -// Transform Component +/** + * The comparator function. + * + * @ignore + * + * @param {*} a - The first item to test. + * @param {*} b - The second itemt to test. + * + * @return {boolean} True if they localCompare, otherwise false. + */ +function Compare (a, b) +{ + return String(a).localeCompare(b); +} /** - * Provides methods used for getting and setting the position, scale and rotation of a Game Object. + * Process the array contents. * - * @namespace Phaser.Physics.Matter.Components.Transform - * @since 3.0.0 + * @ignore + * + * @param {array} array - The array to process. + * @param {function} compare - The comparison function. + * + * @return {array} - The processed array. */ -var Transform = { +function Process (array, compare) +{ + // Short-circuit when there's nothing to sort. + var len = array.length; - /** - * The x position of this Game Object. - * - * @name Phaser.Physics.Matter.Components.Transform#x - * @type {number} - * @since 3.0.0 - */ - x: { + if (len <= 1) + { + return array; + } - get: function () - { - return this.body.position.x; - }, + // Rather than dividing input, simply iterate chunks of 1, 2, 4, 8, etc. + // Chunks are the size of the left or right hand in merge sort. + // Stop when the left-hand covers all of the array. + var buffer = new Array(len); - set: function (value) - { - this._tempVec2.set(value, this.y); + for (var chk = 1; chk < len; chk *= 2) + { + RunPass(array, compare, chk, buffer); - Body.setPosition(this.body, this._tempVec2); - } + var tmp = array; - }, + array = buffer; - /** - * The y position of this Game Object. - * - * @name Phaser.Physics.Matter.Components.Transform#y - * @type {number} - * @since 3.0.0 - */ - y: { + buffer = tmp; + } - get: function () - { - return this.body.position.y; - }, + return array; +} - set: function (value) - { - this._tempVec2.set(this.x, value); +/** + * Run a single pass with the given chunk size. + * + * @ignore + * + * @param {array} arr - The array to run the pass on. + * @param {function} comp - The comparison function. + * @param {number} chk - The number of iterations. + * @param {array} result - The array to store the result in. + */ +function RunPass (arr, comp, chk, result) +{ + var len = arr.length; + var i = 0; - Body.setPosition(this.body, this._tempVec2); - } + // Step size / double chunk size. + var dbl = chk * 2; - }, + // Bounds of the left and right chunks. + var l, r, e; - /** - * The horizontal scale of this Game Object. - * - * @name Phaser.Physics.Matter.Components.Transform#scaleX - * @type {number} - * @since 3.0.0 - */ - scaleX: { + // Iterators over the left and right chunk. + var li, ri; - get: function () + // Iterate over pairs of chunks. + for (l = 0; l < len; l += dbl) + { + r = l + chk; + e = r + chk; + + if (r > len) { - return this._scaleX; - }, + r = len; + } - set: function (value) + if (e > len) { - var factorX = 1 / this._scaleX; - var factorY = 1 / this._scaleY; - - this._scaleX = value; + e = len; + } - if (this._scaleX === 0) + // Iterate both chunks in parallel. + li = l; + ri = r; + + while (true) + { + // Compare the chunks. + if (li < r && ri < e) { - this.renderFlags &= ~_FLAG; + // This works for a regular `sort()` compatible comparator, + // but also for a simple comparator like: `a > b` + if (comp(arr[li], arr[ri]) <= 0) + { + result[i++] = arr[li++]; + } + else + { + result[i++] = arr[ri++]; + } + } + else if (li < r) + { + // Nothing to compare, just flush what's left. + result[i++] = arr[li++]; + } + else if (ri < e) + { + result[i++] = arr[ri++]; } else { - this.renderFlags |= _FLAG; + // Both iterators are at the chunk ends. + break; } + } + } +} - // Reset Matter scale back to 1 (sigh) - Body.scale(this.body, factorX, factorY); +/** + * An in-place stable array sort, because `Array#sort()` is not guaranteed stable. + * + * This is an implementation of merge sort, without recursion. + * + * Function based on the Two-Screen/stable sort 0.1.8 from https://github.com/Two-Screen/stable + * + * @function Phaser.Utils.Array.StableSort + * @since 3.0.0 + * + * @param {array} array - The input array to be sorted. + * @param {function} [compare] - The comparison function. + * + * @return {array} The sorted result. + */ +var StableSort = function (array, compare) +{ + if (compare === undefined) { compare = Compare; } - Body.scale(this.body, value, this._scaleY); - } + // Short-circuit when there's nothing to sort. + if (!array || array.length < 2) + { + return array; + } - }, + if (Device.features.stableSort) + { + return array.sort(compare); + } - /** - * The vertical scale of this Game Object. - * - * @name Phaser.Physics.Matter.Components.Transform#scaleY - * @type {number} - * @since 3.0.0 - */ - scaleY: { + var result = Process(array, compare); - get: function () - { - return this._scaleY; - }, + // This simply copies back if the result isn't in the original array, which happens on an odd number of passes. + if (result !== array) + { + RunPass(result, null, array.length, array); + } - set: function (value) - { - var factorX = 1 / this._scaleX; - var factorY = 1 / this._scaleY; + return array; +}; - this._scaleY = value; +module.exports = StableSort; - if (this._scaleY === 0) - { - this.renderFlags &= ~_FLAG; - } - else - { - this.renderFlags |= _FLAG; - } - Body.scale(this.body, factorX, factorY); +/***/ }), - Body.scale(this.body, this._scaleX, value); - } +/***/ 96928: +/***/ ((module) => { - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Use `angle` to set or get rotation of the physics body associated to this GameObject. - * Unlike rotation, when using set the value can be in degrees, which will be converted to radians internally. - * - * @name Phaser.Physics.Matter.Components.Transform#angle - * @type {number} - * @since 3.0.0 - */ - angle: { +/** + * Swaps the position of two elements in the given array. + * The elements must exist in the same array. + * The array is modified in-place. + * + * @function Phaser.Utils.Array.Swap + * @since 3.4.0 + * + * @param {array} array - The input array. + * @param {*} item1 - The first element to swap. + * @param {*} item2 - The second element to swap. + * + * @return {array} The input array. + */ +var Swap = function (array, item1, item2) +{ + if (item1 === item2) + { + return array; + } - get: function () - { - return WrapAngleDegrees(this.body.angle * MATH_CONST.RAD_TO_DEG); - }, + var index1 = array.indexOf(item1); + var index2 = array.indexOf(item2); - set: function (value) - { - // value is in degrees - this.rotation = WrapAngleDegrees(value) * MATH_CONST.DEG_TO_RAD; - } - }, + if (index1 < 0 || index2 < 0) + { + throw new Error('Supplied items must be elements of the same array'); + } - /** - * Use `rotation` to set or get the rotation of the physics body associated with this GameObject. - * The value when set must be in radians. - * - * @name Phaser.Physics.Matter.Components.Transform#rotation - * @type {number} - * @since 3.0.0 - */ - rotation: { + array[index1] = item2; + array[index2] = item1; - get: function () - { - return this.body.angle; - }, + return array; +}; - set: function (value) - { - // value is in radians - this._rotation = WrapAngle(value); +module.exports = Swap; - Body.setAngle(this.body, this._rotation); - } - }, - /** - * Sets the position of the physics body along x and y axes. - * Both the parameters to this function are optional and if not passed any they default to 0. - * Velocity, angle, force etc. are unchanged. - * - * @method Phaser.Physics.Matter.Components.Transform#setPosition - * @since 3.0.0 - * - * @param {number} [x=0] - The horizontal position of the body. - * @param {number} [y=x] - The vertical position of the body. - * - * @return {this} This Game Object. - */ - setPosition: function (x, y) - { - if (x === undefined) { x = 0; } - if (y === undefined) { y = x; } +/***/ }), - this._tempVec2.set(x, y); +/***/ 59959: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - Body.setPosition(this.body, this._tempVec2); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +/** + * @namespace Phaser.Utils.Array + */ - /** - * Immediately sets the angle of the Body. - * Angular velocity, position, force etc. are unchanged. - * - * @method Phaser.Physics.Matter.Components.Transform#setRotation - * @since 3.0.0 - * - * @param {number} [radians=0] - The angle of the body, in radians. - * - * @return {this} This Game Object. - */ - setRotation: function (radians) - { - if (radians === undefined) { radians = 0; } +module.exports = { - this._rotation = WrapAngle(radians); + Matrix: __webpack_require__(13515), - Body.setAngle(this.body, radians); + Add: __webpack_require__(78991), + AddAt: __webpack_require__(48522), + BringToTop: __webpack_require__(58742), + CountAllMatching: __webpack_require__(30164), + Each: __webpack_require__(36337), + EachInRange: __webpack_require__(46208), + FindClosestInSorted: __webpack_require__(2406), + Flatten: __webpack_require__(5454), + GetAll: __webpack_require__(71608), + GetFirst: __webpack_require__(51463), + GetRandom: __webpack_require__(72861), + MoveDown: __webpack_require__(51172), + MoveTo: __webpack_require__(68396), + MoveUp: __webpack_require__(27555), + MoveAbove: __webpack_require__(24218), + MoveBelow: __webpack_require__(58258), + NumberArray: __webpack_require__(13401), + NumberArrayStep: __webpack_require__(89955), + QuickSelect: __webpack_require__(53466), + Range: __webpack_require__(75757), + Remove: __webpack_require__(66458), + RemoveAt: __webpack_require__(8324), + RemoveBetween: __webpack_require__(47427), + RemoveRandomElement: __webpack_require__(50147), + Replace: __webpack_require__(80402), + RotateLeft: __webpack_require__(77640), + RotateRight: __webpack_require__(38487), + SafeRange: __webpack_require__(45838), + SendToBack: __webpack_require__(27847), + SetAll: __webpack_require__(6034), + Shuffle: __webpack_require__(18592), + SortByDigits: __webpack_require__(28834), + SpliceOne: __webpack_require__(72677), + StableSort: __webpack_require__(17922), + Swap: __webpack_require__(96928) - return this; - }, +}; - /** - * Setting fixed rotation sets the Body inertia to Infinity, which stops it - * from being able to rotate when forces are applied to it. - * - * @method Phaser.Physics.Matter.Components.Transform#setFixedRotation - * @since 3.0.0 - * - * @return {this} This Game Object. - */ - setFixedRotation: function () + +/***/ }), + +/***/ 97494: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Checks if an array can be used as a matrix. + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * + * @function Phaser.Utils.Array.Matrix.CheckMatrix + * @since 3.0.0 + * + * @generic T + * @genericUse {T[][]} - [matrix] + * + * @param {T[][]} [matrix] - The array to check. + * + * @return {boolean} `true` if the given `matrix` array is a valid matrix. + */ +var CheckMatrix = function (matrix) +{ + if (!Array.isArray(matrix) || !Array.isArray(matrix[0])) { - Body.setInertia(this.body, Infinity); + return false; + } - return this; - }, + // How long is the first row? + var size = matrix[0].length; - /** - * Immediately sets the angle of the Body. - * Angular velocity, position, force etc. are unchanged. - * - * @method Phaser.Physics.Matter.Components.Transform#setAngle - * @since 3.0.0 - * - * @param {number} [degrees=0] - The angle to set, in degrees. - * - * @return {this} This Game Object. - */ - setAngle: function (degrees) + // Validate the rest of the rows are the same length + for (var i = 1; i < matrix.length; i++) { - if (degrees === undefined) { degrees = 0; } + if (matrix[i].length !== size) + { + return false; + } + } - this.angle = degrees; + return true; +}; - Body.setAngle(this.body, this.rotation); +module.exports = CheckMatrix; - return this; - }, - /** - * Sets the scale of this Game Object. - * - * @method Phaser.Physics.Matter.Components.Transform#setScale - * @since 3.0.0 - * - * @param {number} [x=1] - The horizontal scale of this Game Object. - * @param {number} [y=x] - The vertical scale of this Game Object. If not set it will use the x value. - * @param {Phaser.Math.Vector2} [point] - The point (Vector2) from which scaling will occur. - * - * @return {this} This Game Object. - */ - setScale: function (x, y, point) +/***/ }), + +/***/ 68428: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +var Pad = __webpack_require__(76400); +var CheckMatrix = __webpack_require__(97494); + +/** + * Generates a string (which you can pass to console.log) from the given Array Matrix. + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * + * @function Phaser.Utils.Array.Matrix.MatrixToString + * @since 3.0.0 + * + * @generic T + * @genericUse {T[][]} - [matrix] + * + * @param {T[][]} [matrix] - A 2-dimensional array. + * + * @return {string} A string representing the matrix. + */ +var MatrixToString = function (matrix) +{ + var str = ''; + + if (!CheckMatrix(matrix)) { - if (x === undefined) { x = 1; } - if (y === undefined) { y = x; } + return str; + } + + for (var r = 0; r < matrix.length; r++) + { + for (var c = 0; c < matrix[r].length; c++) + { + var cell = matrix[r][c].toString(); - var factorX = 1 / this._scaleX; - var factorY = 1 / this._scaleY; + if (cell !== 'undefined') + { + str += Pad(cell, 2); + } + else + { + str += '?'; + } - this._scaleX = x; - this._scaleY = y; + if (c < matrix[r].length - 1) + { + str += ' |'; + } + } - Body.scale(this.body, factorX, factorY, point); + if (r < matrix.length - 1) + { + str += '\n'; - Body.scale(this.body, x, y, point); + for (var i = 0; i < matrix[r].length; i++) + { + str += '---'; + + if (i < matrix[r].length - 1) + { + str += '+'; + } + } + + str += '\n'; + } - return this; } + return str; }; -module.exports = Transform; +module.exports = MatrixToString; /***/ }), -/* 1522 */ -/***/ (function(module, exports, __webpack_require__) { + +/***/ 59521: +/***/ ((module) => { /** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var Body = __webpack_require__(41); - /** - * Contains methods for changing the velocity of a Matter Body. Should be used as a mixin and not called directly. + * Reverses the columns in the given Array Matrix. * - * @namespace Phaser.Physics.Matter.Components.Velocity + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * + * @function Phaser.Utils.Array.Matrix.ReverseColumns * @since 3.0.0 + * + * @generic T + * @genericUse {T[][]} - [matrix,$return] + * + * @param {T[][]} [matrix] - The array matrix to reverse the columns for. + * + * @return {T[][]} The column reversed matrix. */ -var Velocity = { - - /** - * Sets the angular velocity of the body instantly. - * Position, angle, force etc. are unchanged. - * - * @method Phaser.Physics.Matter.Components.Velocity#setAngularVelocity - * @since 3.0.0 - * - * @param {number} value - The angular velocity. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setAngularVelocity: function (value) - { - Body.setAngularVelocity(this.body, value); - - return this; - }, - - /** - * Sets the horizontal velocity of the physics body. - * - * @method Phaser.Physics.Matter.Components.Velocity#setVelocityX - * @since 3.0.0 - * - * @param {number} x - The horizontal velocity value. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setVelocityX: function (x) - { - this._tempVec2.set(x, this.body.velocity.y); +var ReverseColumns = function (matrix) +{ + return matrix.reverse(); +}; - Body.setVelocity(this.body, this._tempVec2); +module.exports = ReverseColumns; - return this; - }, - /** - * Sets vertical velocity of the physics body. - * - * @method Phaser.Physics.Matter.Components.Velocity#setVelocityY - * @since 3.0.0 - * - * @param {number} y - The vertical velocity value. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setVelocityY: function (y) - { - this._tempVec2.set(this.body.velocity.x, y); +/***/ }), - Body.setVelocity(this.body, this._tempVec2); +/***/ 51995: +/***/ ((module) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets both the horizontal and vertical velocity of the physics body. - * - * @method Phaser.Physics.Matter.Components.Velocity#setVelocity - * @since 3.0.0 - * - * @param {number} x - The horizontal velocity value. - * @param {number} [y=x] - The vertical velocity value, it can be either positive or negative. If not given, it will be the same as the `x` value. - * - * @return {Phaser.GameObjects.GameObject} This Game Object. - */ - setVelocity: function (x, y) +/** + * Reverses the rows in the given Array Matrix. + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * + * @function Phaser.Utils.Array.Matrix.ReverseRows + * @since 3.0.0 + * + * @generic T + * @genericUse {T[][]} - [matrix,$return] + * + * @param {T[][]} [matrix] - The array matrix to reverse the rows for. + * + * @return {T[][]} The column reversed matrix. + */ +var ReverseRows = function (matrix) +{ + for (var i = 0; i < matrix.length; i++) { - this._tempVec2.set(x, y); - - Body.setVelocity(this.body, this._tempVec2); - - return this; + matrix[i].reverse(); } + return matrix; }; -module.exports = Velocity; +module.exports = ReverseRows; /***/ }), -/* 1523 */ -/***/ (function(module, exports, __webpack_require__) { - -// @if DEBUG -/** -* _Internal Class_, not generally used outside of the engine's internals. -* -*/ -var Metrics = {}; +/***/ 89011: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = Metrics; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -var Composite = __webpack_require__(118); -var Common = __webpack_require__(32); +var RotateMatrix = __webpack_require__(63515); -(function() { +/** + * Rotates the array matrix 180 degrees. + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * + * @function Phaser.Utils.Array.Matrix.Rotate180 + * @since 3.0.0 + * + * @generic T + * @genericUse {T[][]} - [matrix,$return] + * + * @param {T[][]} [matrix] - The array to rotate. + * + * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. + */ +var Rotate180 = function (matrix) +{ + return RotateMatrix(matrix, 180); +}; - /** - * Creates a new metrics. - * @method create - * @private - * @return {metrics} A new metrics - */ - Metrics.create = function(options) { - var defaults = { - extended: false, - narrowDetections: 0, - narrowphaseTests: 0, - narrowReuse: 0, - narrowReuseCount: 0, - midphaseTests: 0, - broadphaseTests: 0, - narrowEff: 0.0001, - midEff: 0.0001, - broadEff: 0.0001, - collisions: 0, - buckets: 0, - bodies: 0, - pairs: 0 - }; +module.exports = Rotate180; - return Common.extend(defaults, false, options); - }; - /** - * Resets metrics. - * @method reset - * @private - * @param {metrics} metrics - */ - Metrics.reset = function(metrics) { - if (metrics.extended) { - metrics.narrowDetections = 0; - metrics.narrowphaseTests = 0; - metrics.narrowReuse = 0; - metrics.narrowReuseCount = 0; - metrics.midphaseTests = 0; - metrics.broadphaseTests = 0; - metrics.narrowEff = 0; - metrics.midEff = 0; - metrics.broadEff = 0; - metrics.collisions = 0; - metrics.buckets = 0; - metrics.pairs = 0; - metrics.bodies = 0; - } - }; +/***/ }), - /** - * Updates metrics. - * @method update - * @private - * @param {metrics} metrics - * @param {engine} engine - */ - Metrics.update = function(metrics, engine) { - if (metrics.extended) { - var world = engine.world, - bodies = Composite.allBodies(world); +/***/ 42549: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - metrics.collisions = metrics.narrowDetections; - metrics.pairs = engine.pairs.list.length; - metrics.bodies = bodies.length; - metrics.midEff = (metrics.narrowDetections / (metrics.midphaseTests || 1)).toFixed(2); - metrics.narrowEff = (metrics.narrowDetections / (metrics.narrowphaseTests || 1)).toFixed(2); - metrics.broadEff = (1 - (metrics.broadphaseTests / (bodies.length || 1))).toFixed(2); - metrics.narrowReuse = (metrics.narrowReuseCount / (metrics.narrowphaseTests || 1)).toFixed(2); - //var broadphase = engine.broadphase[engine.broadphase.current]; - //if (broadphase.instance) - // metrics.buckets = Common.keys(broadphase.instance.buckets).length; - } - }; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -})(); -// @endif - - -/***/ }), -/* 1524 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. - * @license {@link https://opensource.org/licenses/MIT|MIT License} - */ - -var ALIGN_CONST = __webpack_require__(123); -var Axes = __webpack_require__(271); -var Bodies = __webpack_require__(86); -var Body = __webpack_require__(41); -var BodyBounds = __webpack_require__(1392); -var Bounds = __webpack_require__(84); -var Class = __webpack_require__(0); -var Composite = __webpack_require__(118); -var Composites = __webpack_require__(591); -var Constraint = __webpack_require__(128); -var Detector = __webpack_require__(273); -var DistanceBetween = __webpack_require__(50); -var Factory = __webpack_require__(1394); -var GetFastValue = __webpack_require__(2); -var GetValue = __webpack_require__(6); -var Grid = __webpack_require__(597); -var MatterAttractors = __webpack_require__(1525); -var MatterCollisionEvents = __webpack_require__(1526); -var MatterLib = __webpack_require__(1399); -var MatterWrap = __webpack_require__(1527); -var Merge = __webpack_require__(127); -var Pair = __webpack_require__(250); -var Pairs = __webpack_require__(598); -var Plugin = __webpack_require__(595); -var PluginCache = __webpack_require__(24); -var Query = __webpack_require__(1400); -var Resolver = __webpack_require__(599); -var SAT = __webpack_require__(274); -var SceneEvents = __webpack_require__(20); -var Svg = __webpack_require__(592); -var Vector = __webpack_require__(83); -var Vertices = __webpack_require__(64); -var World = __webpack_require__(1402); +var RotateMatrix = __webpack_require__(63515); /** - * @classdesc - * The Phaser Matter plugin provides the ability to use the Matter JS Physics Engine within your Phaser games. - * - * Unlike Arcade Physics, the other physics system provided with Phaser, Matter JS is a full-body physics system. - * It features: - * - * * Rigid bodies - * * Compound bodies - * * Composite bodies - * * Concave and convex hulls - * * Physical properties (mass, area, density etc.) - * * Restitution (elastic and inelastic collisions) - * * Collisions (broad-phase, mid-phase and narrow-phase) - * * Stable stacking and resting - * * Conservation of momentum - * * Friction and resistance - * * Constraints - * * Gravity - * * Sleeping and static bodies - * * Rounded corners (chamfering) - * * Views (translate, zoom) - * * Collision queries (raycasting, region tests) - * * Time scaling (slow-mo, speed-up) - * - * Configuration of Matter is handled via the Matter World Config object, which can be passed in either the - * Phaser Game Config, or Phaser Scene Config. Here is a basic example: - * - * ```js - * physics: { - * default: 'matter', - * matter: { - * enableSleeping: true, - * gravity: { - * y: 0 - * }, - * debug: { - * showBody: true, - * showStaticBody: true - * } - * } - * } + * Rotates the array matrix to the left (or 90 degrees) + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] * ``` - * - * This class acts as an interface between a Phaser Scene and a single instance of the Matter Engine. - * - * Use it to access the most common Matter features and helper functions. - * - * You can find details, documentation and examples on the Matter JS website: https://brm.io/matter-js/ * - * @class MatterPhysics - * @memberof Phaser.Physics.Matter - * @constructor + * @function Phaser.Utils.Array.Matrix.RotateLeft * @since 3.0.0 * - * @param {Phaser.Scene} scene - The Phaser Scene that owns this Matter Physics instance. + * @generic T + * @genericUse {T[][]} - [matrix,$return] + * + * @param {T[][]} [matrix] - The array to rotate. + * + * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. */ -var MatterPhysics = new Class({ - - initialize: - - function MatterPhysics (scene) - { - /** - * The Phaser Scene that owns this Matter Physics instance - * - * @name Phaser.Physics.Matter.MatterPhysics#scene - * @type {Phaser.Scene} - * @since 3.0.0 - */ - this.scene = scene; - - /** - * A reference to the Scene Systems that belong to the Scene owning this Matter Physics instance. - * - * @name Phaser.Physics.Matter.MatterPhysics#systems - * @type {Phaser.Scenes.Systems} - * @since 3.0.0 - */ - this.systems = scene.sys; - - /** - * The parsed Matter Configuration object. - * - * @name Phaser.Physics.Matter.MatterPhysics#config - * @type {Phaser.Types.Physics.Matter.MatterWorldConfig} - * @since 3.0.0 - */ - this.config = this.getConfig(); - - /** - * An instance of the Matter World class. This class is responsible for the updating of the - * Matter Physics world, as well as handling debug drawing functions. - * - * @name Phaser.Physics.Matter.MatterPhysics#world - * @type {Phaser.Physics.Matter.World} - * @since 3.0.0 - */ - this.world; - - /** - * An instance of the Matter Factory. This class provides lots of functions for creating a - * wide variety of physics objects and adds them automatically to the Matter World. - * - * You can use this class to cut-down on the amount of code required in your game, however, - * use of the Factory is entirely optional and should be seen as a development aid. It's - * perfectly possible to create and add components to the Matter world without using it. - * - * @name Phaser.Physics.Matter.MatterPhysics#add - * @type {Phaser.Physics.Matter.Factory} - * @since 3.0.0 - */ - this.add; +var RotateLeft = function (matrix) +{ + return RotateMatrix(matrix, 90); +}; - /** - * An instance of the Body Bounds class. This class contains functions used for getting the - * world position from various points around the bounds of a physics body. - * - * @name Phaser.Physics.Matter.MatterPhysics#bodyBounds - * @type {Phaser.Physics.Matter.BodyBounds} - * @since 3.22.0 - */ - this.bodyBounds; +module.exports = RotateLeft; - // Body - /** - * A reference to the `Matter.Body` module. - * - * The `Matter.Body` module contains methods for creating and manipulating body models. - * A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`. - * Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the `Bodies` module. - * - * @name Phaser.Physics.Matter.MatterPhysics#body - * @type {MatterJS.BodyFactory} - * @since 3.18.0 - */ - this.body = Body; +/***/ }), - /** - * A reference to the `Matter.Composite` module. - * - * The `Matter.Composite` module contains methods for creating and manipulating composite bodies. - * A composite body is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`, therefore composites form a tree structure. - * It is important to use the functions in this module to modify composites, rather than directly modifying their properties. - * Note that the `Matter.World` object is also a type of `Matter.Composite` and as such all composite methods here can also operate on a `Matter.World`. - * - * @name Phaser.Physics.Matter.MatterPhysics#composite - * @type {MatterJS.CompositeFactory} - * @since 3.22.0 - */ - this.composite = Composite; +/***/ 63515: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Collision: +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * A reference to the `Matter.Detector` module. - * - * The `Matter.Detector` module contains methods for detecting collisions given a set of pairs. - * - * @name Phaser.Physics.Matter.MatterPhysics#detector - * @type {MatterJS.DetectorFactory} - * @since 3.22.0 - */ - this.detector = Detector; +var CheckMatrix = __webpack_require__(97494); +var TransposeMatrix = __webpack_require__(78581); - /** - * A reference to the `Matter.Grid` module. - * - * The `Matter.Grid` module contains methods for creating and manipulating collision broadphase grid structures. - * - * @name Phaser.Physics.Matter.MatterPhysics#grid - * @type {MatterJS.GridFactory} - * @since 3.22.0 - */ - this.grid = Grid; +/** + * Rotates the array matrix based on the given rotation value. + * + * The value can be given in degrees: 90, -90, 270, -270 or 180, + * or a string command: `rotateLeft`, `rotateRight` or `rotate180`. + * + * Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}. + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * + * @function Phaser.Utils.Array.Matrix.RotateMatrix + * @since 3.0.0 + * + * @generic T + * @genericUse {T[][]} - [matrix,$return] + * + * @param {T[][]} [matrix] - The array to rotate. + * @param {(number|string)} [direction=90] - The amount to rotate the matrix by. + * + * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. + */ +var RotateMatrix = function (matrix, direction) +{ + if (direction === undefined) { direction = 90; } - /** - * A reference to the `Matter.Pair` module. - * - * The `Matter.Pair` module contains methods for creating and manipulating collision pairs. - * - * @name Phaser.Physics.Matter.MatterPhysics#pair - * @type {MatterJS.PairFactory} - * @since 3.22.0 - */ - this.pair = Pair; + if (!CheckMatrix(matrix)) + { + return null; + } - /** - * A reference to the `Matter.Pairs` module. - * - * The `Matter.Pairs` module contains methods for creating and manipulating collision pair sets. - * - * @name Phaser.Physics.Matter.MatterPhysics#pairs - * @type {MatterJS.PairsFactory} - * @since 3.22.0 - */ - this.pairs = Pairs; + if (typeof direction !== 'string') + { + direction = ((direction % 360) + 360) % 360; + } - /** - * A reference to the `Matter.Query` module. - * - * The `Matter.Query` module contains methods for performing collision queries. - * - * @name Phaser.Physics.Matter.MatterPhysics#query - * @type {MatterJS.QueryFactory} - * @since 3.22.0 - */ - this.query = Query; + if (direction === 90 || direction === -270 || direction === 'rotateLeft') + { + matrix = TransposeMatrix(matrix); + matrix.reverse(); + } + else if (direction === -90 || direction === 270 || direction === 'rotateRight') + { + matrix.reverse(); + matrix = TransposeMatrix(matrix); + } + else if (Math.abs(direction) === 180 || direction === 'rotate180') + { + for (var i = 0; i < matrix.length; i++) + { + matrix[i].reverse(); + } - /** - * A reference to the `Matter.Resolver` module. - * - * The `Matter.Resolver` module contains methods for resolving collision pairs. - * - * @name Phaser.Physics.Matter.MatterPhysics#resolver - * @type {MatterJS.ResolverFactory} - * @since 3.22.0 - */ - this.resolver = Resolver; + matrix.reverse(); + } - /** - * A reference to the `Matter.SAT` module. - * - * The `Matter.SAT` module contains methods for detecting collisions using the Separating Axis Theorem. - * - * @name Phaser.Physics.Matter.MatterPhysics#sat - * @type {MatterJS.SATFactory} - * @since 3.22.0 - */ - this.sat = SAT; + return matrix; +}; - // Constraint +module.exports = RotateMatrix; - /** - * A reference to the `Matter.Constraint` module. - * - * The `Matter.Constraint` module contains methods for creating and manipulating constraints. - * Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position). - * The stiffness of constraints can be modified to create springs or elastic. - * - * @name Phaser.Physics.Matter.MatterPhysics#constraint - * @type {MatterJS.ConstraintFactory} - * @since 3.22.0 - */ - this.constraint = Constraint; - // Factory +/***/ }), - /** - * A reference to the `Matter.Bodies` module. - * - * The `Matter.Bodies` module contains factory methods for creating rigid bodies - * with commonly used body configurations (such as rectangles, circles and other polygons). - * - * @name Phaser.Physics.Matter.MatterPhysics#bodies - * @type {MatterJS.BodiesFactory} - * @since 3.18.0 - */ - this.bodies = Bodies; +/***/ 14305: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * A reference to the `Matter.Composites` module. - * - * The `Matter.Composites` module contains factory methods for creating composite bodies - * with commonly used configurations (such as stacks and chains). - * - * @name Phaser.Physics.Matter.MatterPhysics#composites - * @type {MatterJS.CompositesFactory} - * @since 3.22.0 - */ - this.composites = Composites; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - // Geometry +var RotateMatrix = __webpack_require__(63515); - /** - * A reference to the `Matter.Axes` module. - * - * The `Matter.Axes` module contains methods for creating and manipulating sets of axes. - * - * @name Phaser.Physics.Matter.MatterPhysics#axes - * @type {MatterJS.AxesFactory} - * @since 3.22.0 - */ - this.axes = Axes; +/** + * Rotates the array matrix to the left (or -90 degrees) + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * + * @function Phaser.Utils.Array.Matrix.RotateRight + * @since 3.0.0 + * + * @generic T + * @genericUse {T[][]} - [matrix,$return] + * + * @param {T[][]} [matrix] - The array to rotate. + * + * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. + */ +var RotateRight = function (matrix) +{ + return RotateMatrix(matrix, -90); +}; - /** - * A reference to the `Matter.Bounds` module. - * - * The `Matter.Bounds` module contains methods for creating and manipulating axis-aligned bounding boxes (AABB). - * - * @name Phaser.Physics.Matter.MatterPhysics#bounds - * @type {MatterJS.BoundsFactory} - * @since 3.22.0 - */ - this.bounds = Bounds; +module.exports = RotateRight; - /** - * A reference to the `Matter.Svg` module. - * - * The `Matter.Svg` module contains methods for converting SVG images into an array of vector points. - * - * To use this module you also need the SVGPathSeg polyfill: https://github.com/progers/pathseg - * - * @name Phaser.Physics.Matter.MatterPhysics#svg - * @type {MatterJS.SvgFactory} - * @since 3.22.0 - */ - this.svg = Svg; - /** - * A reference to the `Matter.Vector` module. - * - * The `Matter.Vector` module contains methods for creating and manipulating vectors. - * Vectors are the basis of all the geometry related operations in the engine. - * A `Matter.Vector` object is of the form `{ x: 0, y: 0 }`. - * - * @name Phaser.Physics.Matter.MatterPhysics#vector - * @type {MatterJS.VectorFactory} - * @since 3.22.0 - */ - this.vector = Vector; +/***/ }), - /** - * A reference to the `Matter.Vertices` module. - * - * The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. - * A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. - * A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull). - * - * @name Phaser.Physics.Matter.MatterPhysics#vertices - * @type {MatterJS.VerticesFactory} - * @since 3.22.0 - */ - this.vertices = Vertices; +/***/ 27365: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * A reference to the `Matter.Vertices` module. - * - * The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices. - * A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`. - * A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull). - * - * @name Phaser.Physics.Matter.MatterPhysics#verts - * @type {MatterJS.VerticesFactory} - * @since 3.14.0 - */ - this.verts = Vertices; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * An internal temp vector used for velocity and force calculations. - * - * @name Phaser.Physics.Matter.MatterPhysics#_tempVec2 - * @type {MatterJS.Vector} - * @private - * @since 3.22.0 - */ - this._tempVec2 = Vector.create(); +var RotateLeft = __webpack_require__(77640); +var RotateRight = __webpack_require__(38487); - // Matter plugins +/** + * Translates the given Array Matrix by shifting each column and row the + * amount specified. + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * + * @function Phaser.Utils.Array.Matrix.Translate + * @since 3.50.0 + * + * @generic T + * @genericUse {T[][]} - [matrix,$return] + * + * @param {T[][]} [matrix] - The array matrix to translate. + * @param {number} [x=0] - The amount to horizontally translate the matrix by. + * @param {number} [y=0] - The amount to vertically translate the matrix by. + * + * @return {T[][]} The translated matrix. + */ +var TranslateMatrix = function (matrix, x, y) +{ + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } - if (GetValue(this.config, 'plugins.collisionevents', true)) - { - this.enableCollisionEventsPlugin(); - } + // Vertical translation - if (GetValue(this.config, 'plugins.attractors', false)) + if (y !== 0) + { + if (y < 0) { - this.enableAttractorPlugin(); + // Shift Up + RotateLeft(matrix, Math.abs(y)); } - - if (GetValue(this.config, 'plugins.wrap', false)) + else { - this.enableWrapPlugin(); + // Shift Down + RotateRight(matrix, y); } + } - Resolver._restingThresh = GetValue(this.config, 'restingThresh', 4); - Resolver._restingThreshTangent = GetValue(this.config, 'restingThreshTangent', 6); - Resolver._positionDampen = GetValue(this.config, 'positionDampen', 0.9); - Resolver._positionWarming = GetValue(this.config, 'positionWarming', 0.8); - Resolver._frictionNormalMultiplier = GetValue(this.config, 'frictionNormalMultiplier', 5); - - scene.sys.events.once(SceneEvents.BOOT, this.boot, this); - scene.sys.events.on(SceneEvents.START, this.start, this); - }, - - /** - * This method is called automatically, only once, when the Scene is first created. - * Do not invoke it directly. - * - * @method Phaser.Physics.Matter.MatterPhysics#boot - * @private - * @since 3.5.1 - */ - boot: function () - { - this.world = new World(this.scene, this.config); - this.add = new Factory(this.world); - this.bodyBounds = new BodyBounds(); - - this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); - }, + // Horizontal translation - /** - * This method is called automatically by the Scene when it is starting up. - * It is responsible for creating local systems, properties and listening for Scene events. - * Do not invoke it directly. - * - * @method Phaser.Physics.Matter.MatterPhysics#start - * @private - * @since 3.5.0 - */ - start: function () + if (x !== 0) { - if (!this.world) + for (var i = 0; i < matrix.length; i++) { - this.world = new World(this.scene, this.config); - this.add = new Factory(this.world); + var row = matrix[i]; + + if (x < 0) + { + RotateLeft(row, Math.abs(x)); + } + else + { + RotateRight(row, x); + } } + } - var eventEmitter = this.systems.events; + return matrix; +}; - eventEmitter.on(SceneEvents.UPDATE, this.world.update, this.world); - eventEmitter.on(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); - eventEmitter.once(SceneEvents.SHUTDOWN, this.shutdown, this); - }, +module.exports = TranslateMatrix; - /** - * This internal method is called when this class starts and retrieves the final Matter World Config. - * - * @method Phaser.Physics.Matter.MatterPhysics#getConfig - * @since 3.0.0 - * - * @return {Phaser.Types.Physics.Matter.MatterWorldConfig} The Matter World Config. - */ - getConfig: function () - { - var gameConfig = this.systems.game.config.physics; - var sceneConfig = this.systems.settings.physics; - var config = Merge( - GetFastValue(sceneConfig, 'matter', {}), - GetFastValue(gameConfig, 'matter', {}) - ); +/***/ }), - return config; - }, +/***/ 78581: +/***/ ((module) => { - /** - * Enables the Matter Attractors Plugin. - * - * The attractors plugin that makes it easy to apply continual forces on bodies. - * It's possible to simulate effects such as wind, gravity and magnetism. - * - * https://github.com/liabru/matter-attractors - * - * This method is called automatically if `plugins.attractors` is set in the Matter World Config. - * However, you can also call it directly from within your game. - * - * @method Phaser.Physics.Matter.MatterPhysics#enableAttractorPlugin - * @since 3.0.0 - * - * @return {this} This Matter Physics instance. - */ - enableAttractorPlugin: function () - { - Plugin.register(MatterAttractors); - Plugin.use(MatterLib, MatterAttractors); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - return this; - }, +/** + * Transposes the elements of the given matrix (array of arrays). + * + * The transpose of a matrix is a new matrix whose rows are the columns of the original. + * + * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) + * have the same length. There must be at least two rows. This is an example matrix: + * + * ``` + * [ + * [ 1, 1, 1, 1, 1, 1 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 2, 0, 1, 2, 0, 4 ], + * [ 2, 0, 3, 4, 0, 4 ], + * [ 2, 0, 0, 0, 0, 4 ], + * [ 3, 3, 3, 3, 3, 3 ] + * ] + * ``` + * + * @function Phaser.Utils.Array.Matrix.TransposeMatrix + * @since 3.0.0 + * + * @generic T + * @genericUse {T[][]} - [array,$return] + * + * @param {T[][]} [array] - The array matrix to transpose. + * + * @return {T[][]} A new array matrix which is a transposed version of the given array. + */ +var TransposeMatrix = function (array) +{ + var sourceRowCount = array.length; + var sourceColCount = array[0].length; - /** - * Enables the Matter Wrap Plugin. - * - * The coordinate wrapping plugin that automatically wraps the position of bodies such that they always stay - * within the given bounds. Upon crossing a boundary the body will appear on the opposite side of the bounds, - * while maintaining its velocity. - * - * https://github.com/liabru/matter-wrap - * - * This method is called automatically if `plugins.wrap` is set in the Matter World Config. - * However, you can also call it directly from within your game. - * - * @method Phaser.Physics.Matter.MatterPhysics#enableWrapPlugin - * @since 3.0.0 - * - * @return {this} This Matter Physics instance. - */ - enableWrapPlugin: function () + var result = new Array(sourceColCount); + + for (var i = 0; i < sourceColCount; i++) { - Plugin.register(MatterWrap); - Plugin.use(MatterLib, MatterWrap); + result[i] = new Array(sourceRowCount); - return this; - }, + for (var j = sourceRowCount - 1; j > -1; j--) + { + result[i][j] = array[j][i]; + } + } - /** - * Enables the Matter Collision Events Plugin. - * - * Note that this plugin is enabled by default. So you should only ever need to call this - * method if you have specifically disabled the plugin in your Matter World Config. - * You can disable it by setting `plugins.collisionevents: false` in your Matter World Config. - * - * This plugin triggers three new events on Matter.Body: - * - * 1. `onCollide` - * 2. `onCollideEnd` - * 3. `onCollideActive` - * - * These events correspond to the Matter.js events `collisionStart`, `collisionActive` and `collisionEnd`, respectively. - * You can listen to these events via Matter.Events or they will also be emitted from the Matter World. - * - * This plugin also extends Matter.Body with three convenience functions: - * - * `Matter.Body.setOnCollide(callback)` - * `Matter.Body.setOnCollideEnd(callback)` - * `Matter.Body.setOnCollideActive(callback)` - * - * You can register event callbacks by providing a function of type (pair: Matter.Pair) => void - * - * https://github.com/dxu/matter-collision-events - * - * @method Phaser.Physics.Matter.MatterPhysics#enableCollisionEventsPlugin - * @since 3.22.0 - * - * @return {this} This Matter Physics instance. - */ - enableCollisionEventsPlugin: function () - { - Plugin.register(MatterCollisionEvents); - Plugin.use(MatterLib, MatterCollisionEvents); + return result; +}; - return this; - }, +module.exports = TransposeMatrix; - /** - * Pauses the Matter World instance and sets `enabled` to `false`. - * - * A paused world will not run any simulations for the duration it is paused. - * - * @method Phaser.Physics.Matter.MatterPhysics#pause - * @fires Phaser.Physics.Matter.Events#PAUSE - * @since 3.0.0 - * - * @return {Phaser.Physics.Matter.World} The Matter World object. - */ - pause: function () - { - return this.world.pause(); - }, - /** - * Resumes this Matter World instance from a paused state and sets `enabled` to `true`. - * - * @method Phaser.Physics.Matter.MatterPhysics#resume - * @since 3.0.0 - * - * @return {Phaser.Physics.Matter.World} The Matter World object. - */ - resume: function () - { - return this.world.resume(); - }, +/***/ }), - /** - * Sets the Matter Engine to run at fixed timestep of 60Hz and enables `autoUpdate`. - * If you have set a custom `getDelta` function then this will override it. - * - * @method Phaser.Physics.Matter.MatterPhysics#set60Hz - * @since 3.4.0 - * - * @return {this} This Matter Physics instance. - */ - set60Hz: function () - { - this.world.getDelta = this.world.update60Hz; - this.world.autoUpdate = true; +/***/ 13515: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Sets the Matter Engine to run at fixed timestep of 30Hz and enables `autoUpdate`. - * If you have set a custom `getDelta` function then this will override it. - * - * @method Phaser.Physics.Matter.MatterPhysics#set30Hz - * @since 3.4.0 - * - * @return {this} This Matter Physics instance. - */ - set30Hz: function () - { - this.world.getDelta = this.world.update30Hz; - this.world.autoUpdate = true; +/** + * @namespace Phaser.Utils.Array.Matrix + */ + +module.exports = { - return this; - }, + CheckMatrix: __webpack_require__(97494), + MatrixToString: __webpack_require__(68428), + ReverseColumns: __webpack_require__(59521), + ReverseRows: __webpack_require__(51995), + Rotate180: __webpack_require__(89011), + RotateLeft: __webpack_require__(42549), + RotateMatrix: __webpack_require__(63515), + RotateRight: __webpack_require__(14305), + Translate: __webpack_require__(27365), + TransposeMatrix: __webpack_require__(78581) - /** - * Manually advances the physics simulation by one iteration. - * - * You can optionally pass in the `delta` and `correction` values to be used by Engine.update. - * If undefined they use the Matter defaults of 60Hz and no correction. - * - * Calling `step` directly bypasses any checks of `enabled` or `autoUpdate`. - * - * It also ignores any custom `getDelta` functions, as you should be passing the delta - * value in to this call. - * - * You can adjust the number of iterations that Engine.update performs internally. - * Use the Scene Matter Physics config object to set the following properties: - * - * positionIterations (defaults to 6) - * velocityIterations (defaults to 4) - * constraintIterations (defaults to 2) - * - * Adjusting these values can help performance in certain situations, depending on the physics requirements - * of your game. - * - * @method Phaser.Physics.Matter.MatterPhysics#step - * @since 3.4.0 - * - * @param {number} [delta=16.666] - The delta value. - * @param {number} [correction=1] - Optional delta correction value. - */ - step: function (delta, correction) - { - this.world.step(delta, correction); - }, +}; - /** - * Checks if the vertices of the given body, or an array of bodies, contains the given point, or not. - * - * You can pass in either a single body, or an array of bodies to be checked. This method will - * return `true` if _any_ of the bodies in the array contain the point. See the `intersectPoint` method if you need - * to get a list of intersecting bodies. - * - * The point should be transformed into the Matter World coordinate system in advance. This happens by - * default with Input Pointers, but if you wish to use points from another system you may need to - * transform them before passing them. - * - * @method Phaser.Physics.Matter.MatterPhysics#containsPoint - * @since 3.22.0 - * - * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} body - The body, or an array of bodies, to check against the point. - * @param {number} x - The horizontal coordinate of the point. - * @param {number} y - The vertical coordinate of the point. - * - * @return {boolean} `true` if the point is within one of the bodies given, otherwise `false`. - */ - containsPoint: function (body, x, y) - { - body = this.getMatterBodies(body); - var position = Vector.create(x, y); +/***/ }), - var result = Query.point(body, position); +/***/ 40581: +/***/ ((module) => { - return (result.length > 0) ? true : false; - }, +/** + * @author Niklas von Hertzen (https://github.com/niklasvh/base64-arraybuffer) + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Checks the given coordinates to see if any vertices of the given bodies contain it. - * - * If no bodies are provided it will search all bodies in the Matter World, including within Composites. - * - * The coordinates should be transformed into the Matter World coordinate system in advance. This happens by - * default with Input Pointers, but if you wish to use coordinates from another system you may need to - * transform them before passing them. - * - * @method Phaser.Physics.Matter.MatterPhysics#intersectPoint - * @since 3.22.0 - * - * @param {number} x - The horizontal coordinate of the point. - * @param {number} y - The vertical coordinate of the point. - * @param {Phaser.Types.Physics.Matter.MatterBody[]} [bodies] - An array of bodies to check. If not provided it will search all bodies in the world. - * - * @return {Phaser.Types.Physics.Matter.MatterBody[]} An array of bodies which contain the given point. - */ - intersectPoint: function (x, y, bodies) +var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + +/** + * Converts an ArrayBuffer into a base64 string. + * + * The resulting string can optionally be a data uri if the `mediaType` argument is provided. + * + * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs for more details. + * + * @function Phaser.Utils.Base64.ArrayBufferToBase64 + * @since 3.18.0 + * + * @param {ArrayBuffer} arrayBuffer - The Array Buffer to encode. + * @param {string} [mediaType] - An optional media type, i.e. `audio/ogg` or `image/jpeg`. If included the resulting string will be a data URI. + * + * @return {string} The base64 encoded Array Buffer. + */ +var ArrayBufferToBase64 = function (arrayBuffer, mediaType) +{ + var bytes = new Uint8Array(arrayBuffer); + var len = bytes.length; + + var base64 = (mediaType) ? 'data:' + mediaType + ';base64,' : ''; + + for (var i = 0; i < len; i += 3) { - bodies = this.getMatterBodies(bodies); + base64 += chars[bytes[i] >> 2]; + base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; + base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; + base64 += chars[bytes[i + 2] & 63]; + } - var position = Vector.create(x, y); + if ((len % 3) === 2) + { + base64 = base64.substring(0, base64.length - 1) + '='; + } + else if (len % 3 === 1) + { + base64 = base64.substring(0, base64.length - 2) + '=='; + } - var output = []; + return base64; +}; - var result = Query.point(bodies, position); +module.exports = ArrayBufferToBase64; - result.forEach(function (body) - { - if (output.indexOf(body) === -1) - { - output.push(body); - } - }); - return output; - }, +/***/ }), - /** - * Checks the given rectangular area to see if any vertices of the given bodies intersect with it. - * Or, if the `outside` parameter is set to `true`, it checks to see which bodies do not - * intersect with it. - * - * If no bodies are provided it will search all bodies in the Matter World, including within Composites. - * - * @method Phaser.Physics.Matter.MatterPhysics#intersectRect - * @since 3.22.0 - * - * @param {number} x - The horizontal coordinate of the top-left of the area. - * @param {number} y - The vertical coordinate of the top-left of the area. - * @param {number} width - The width of the area. - * @param {number} height - The height of the area. - * @param {boolean} [outside=false] - If `false` it checks for vertices inside the area, if `true` it checks for vertices outside the area. - * @param {Phaser.Types.Physics.Matter.MatterBody[]} [bodies] - An array of bodies to check. If not provided it will search all bodies in the world. - * - * @return {Phaser.Types.Physics.Matter.MatterBody[]} An array of bodies that intersect with the given area. - */ - intersectRect: function (x, y, width, height, outside, bodies) - { - if (outside === undefined) { outside = false; } +/***/ 82329: +/***/ ((module) => { - bodies = this.getMatterBodies(bodies); +/** + * @author Niklas von Hertzen (https://github.com/niklasvh/base64-arraybuffer) + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var bounds = { - min: { x: x, y: y }, - max: { x: x + width, y: y + height } - }; +var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - var output = []; +// Use a lookup table to find the index. +var lookup = new Uint8Array(256); - var result = Query.region(bodies, bounds, outside); +for (var i = 0; i < chars.length; i++) +{ + lookup[chars.charCodeAt(i)] = i; +} - result.forEach(function (body) - { - if (output.indexOf(body) === -1) - { - output.push(body); - } - }); +/** + * Converts a base64 string, either with or without a data uri, into an Array Buffer. + * + * @function Phaser.Utils.Base64.Base64ToArrayBuffer + * @since 3.18.0 + * + * @param {string} base64 - The base64 string to be decoded. Can optionally contain a data URI header, which will be stripped out prior to decoding. + * + * @return {ArrayBuffer} An ArrayBuffer decoded from the base64 data. + */ +var Base64ToArrayBuffer = function (base64) +{ + // Is it a data uri? if so, strip the header away + base64 = base64.substr(base64.indexOf(',') + 1); - return output; - }, + var len = base64.length; + var bufferLength = len * 0.75; + var p = 0; + var encoded1; + var encoded2; + var encoded3; + var encoded4; - /** - * Checks the given ray segment to see if any vertices of the given bodies intersect with it. - * - * If no bodies are provided it will search all bodies in the Matter World. - * - * The width of the ray can be specified via the `rayWidth` parameter. - * - * @method Phaser.Physics.Matter.MatterPhysics#intersectRay - * @since 3.22.0 - * - * @param {number} x1 - The horizontal coordinate of the start of the ray segment. - * @param {number} y1 - The vertical coordinate of the start of the ray segment. - * @param {number} x2 - The horizontal coordinate of the end of the ray segment. - * @param {number} y2 - The vertical coordinate of the end of the ray segment. - * @param {number} [rayWidth=1] - The width of the ray segment. - * @param {Phaser.Types.Physics.Matter.MatterBody[]} [bodies] - An array of bodies to check. If not provided it will search all bodies in the world. - * - * @return {Phaser.Types.Physics.Matter.MatterBody[]} An array of bodies whos vertices intersect with the ray segment. - */ - intersectRay: function (x1, y1, x2, y2, rayWidth, bodies) + if (base64[len - 1] === '=') { - if (rayWidth === undefined) { rayWidth = 1; } - - bodies = this.getMatterBodies(bodies); - - var result = []; - var collisions = Query.ray(bodies, Vector.create(x1, y1), Vector.create(x2, y2), rayWidth); + bufferLength--; - for (var i = 0; i < collisions.length; i++) + if (base64[len - 2] === '=') { - result.push(collisions[i].body); + bufferLength--; } + } - return result; - }, + var arrayBuffer = new ArrayBuffer(bufferLength); + var bytes = new Uint8Array(arrayBuffer); - /** - * Checks the given Matter Body to see if it intersects with any of the given bodies. - * - * If no bodies are provided it will check against all bodies in the Matter World. - * - * @method Phaser.Physics.Matter.MatterPhysics#intersectBody - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody} body - The target body. - * @param {Phaser.Types.Physics.Matter.MatterBody[]} [bodies] - An array of bodies to check the target body against. If not provided it will search all bodies in the world. - * - * @return {Phaser.Types.Physics.Matter.MatterBody[]} An array of bodies whos vertices intersect with target body. - */ - intersectBody: function (body, bodies) + for (var i = 0; i < len; i += 4) { - bodies = this.getMatterBodies(bodies); + encoded1 = lookup[base64.charCodeAt(i)]; + encoded2 = lookup[base64.charCodeAt(i + 1)]; + encoded3 = lookup[base64.charCodeAt(i + 2)]; + encoded4 = lookup[base64.charCodeAt(i + 3)]; - var result = []; - var collisions = Query.collides(body, bodies); + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); + } - for (var i = 0; i < collisions.length; i++) - { - var pair = collisions[i]; + return arrayBuffer; +}; - if (pair.bodyA === body) - { - result.push(pair.bodyB); - } - else - { - result.push(pair.bodyA); - } - } +module.exports = Base64ToArrayBuffer; - return result; - }, - /** - * Checks to see if the target body, or an array of target bodies, intersects with any of the given bodies. - * - * If intersection occurs this method will return `true` and, if provided, invoke the callbacks. - * - * If no bodies are provided for the second parameter the target will check again all bodies in the Matter World. - * - * Note that bodies can only overlap if they are in non-colliding collision groups or categories. - * - * If you provide a `processCallback` then the two bodies that overlap are sent to it. This callback - * must return a boolean and is used to allow you to perform additional processing tests before a final - * outcome is decided. If it returns `true` then the bodies are finally passed to the `overlapCallback`, if set. - * - * If you provide an `overlapCallback` then the matching pairs of overlapping bodies will be sent to it. - * - * Both callbacks have the following signature: `function (bodyA, bodyB, collisionInfo)` where `bodyA` is always - * the target body. The `collisionInfo` object contains additional data, such as the angle and depth of penetration. - * - * @method Phaser.Physics.Matter.MatterPhysics#overlap - * @since 3.22.0 - * - * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} target - The target body, or array of target bodies, to check. - * @param {Phaser.Types.Physics.Matter.MatterBody[]} [bodies] - The second body, or array of bodies, to check. If falsey it will check against all bodies in the world. - * @param {ArcadePhysicsCallback} [overlapCallback] - An optional callback function that is called if the bodies overlap. - * @param {ArcadePhysicsCallback} [processCallback] - An optional callback function that lets you perform additional checks against the two bodies if they overlap. If this is set then `overlapCallback` will only be invoked if this callback returns `true`. - * @param {*} [callbackContext] - The context, or scope, in which to run the callbacks. - * - * @return {boolean} `true` if the target body intersects with _any_ of the bodies given, otherwise `false`. - */ - overlap: function (target, bodies, overlapCallback, processCallback, callbackContext) - { - if (overlapCallback === undefined) { overlapCallback = null; } - if (processCallback === undefined) { processCallback = null; } - if (callbackContext === undefined) { callbackContext = overlapCallback; } +/***/ }), - if (!Array.isArray(target)) - { - target = [ target ]; - } +/***/ 78417: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - target = this.getMatterBodies(target); - bodies = this.getMatterBodies(bodies); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var match = false; +/** + * @namespace Phaser.Utils.Base64 + */ - for (var i = 0; i < target.length; i++) - { - var entry = target[i]; +module.exports = { - var collisions = Query.collides(entry, bodies); + ArrayBufferToBase64: __webpack_require__(40581), + Base64ToArrayBuffer: __webpack_require__(82329) - for (var c = 0; c < collisions.length; c++) - { - var info = collisions[c]; - var bodyB = (info.bodyA.id === entry.id) ? info.bodyB : info.bodyA; +}; - if (!processCallback || processCallback.call(callbackContext, entry, bodyB, info)) - { - match = true; - if (overlapCallback) - { - overlapCallback.call(callbackContext, entry, bodyB, info); - } - else if (!processCallback) - { - // If there are no callbacks we don't need to test every body, just exit when the first is found - return true; - } - } - } - } +/***/ }), - return match; - }, +/***/ 22178: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Sets the collision filter category of all given Matter Bodies to the given value. - * - * This number must be a power of two between 2^0 (= 1) and 2^31. - * - * Bodies with different collision groups (see {@link #setCollisionGroup}) will only collide if their collision - * categories are included in their collision masks (see {@link #setCollidesWith}). - * - * @method Phaser.Physics.Matter.MatterPhysics#setCollisionCategory - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody[]} bodies - An array of bodies to update. If falsey it will use all bodies in the world. - * @param {number} value - Unique category bitfield. - * - * @return {this} This Matter Physics instance. - */ - setCollisionCategory: function (bodies, value) - { - bodies = this.getMatterBodies(bodies); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - bodies.forEach(function (body) - { - body.collisionFilter.category = value; - }); +/** + * @namespace Phaser.Utils + */ - return this; - }, +module.exports = { - /** - * Sets the collision filter group of all given Matter Bodies to the given value. - * - * If the group value is zero, or if two Matter Bodies have different group values, - * they will collide according to the usual collision filter rules (see {@link #setCollisionCategory} and {@link #setCollisionGroup}). - * - * If two Matter Bodies have the same positive group value, they will always collide; - * if they have the same negative group value they will never collide. - * - * @method Phaser.Physics.Matter.MatterPhysics#setCollisionGroup - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody[]} bodies - An array of bodies to update. If falsey it will use all bodies in the world. - * @param {number} value - Unique group index. - * - * @return {this} This Matter Physics instance. - */ - setCollisionGroup: function (bodies, value) - { - bodies = this.getMatterBodies(bodies); + Array: __webpack_require__(59959), + Base64: __webpack_require__(78417), + Objects: __webpack_require__(64615), + String: __webpack_require__(50379), + NOOP: __webpack_require__(72283), + NULL: __webpack_require__(10618) - bodies.forEach(function (body) - { - body.collisionFilter.group = value; - }); +}; - return this; - }, - /** - * Sets the collision filter mask of all given Matter Bodies to the given value. - * - * Two Matter Bodies with different collision groups will only collide if each one includes the others - * category in its mask based on a bitwise AND operation: `(categoryA & maskB) !== 0` and - * `(categoryB & maskA) !== 0` are both true. - * - * @method Phaser.Physics.Matter.MatterPhysics#setCollidesWith - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody[]} bodies - An array of bodies to update. If falsey it will use all bodies in the world. - * @param {(number|number[])} categories - A unique category bitfield, or an array of them. - * - * @return {this} This Matter Physics instance. - */ - setCollidesWith: function (bodies, categories) - { - bodies = this.getMatterBodies(bodies); +/***/ }), - var flags = 0; +/***/ 32742: +/***/ ((module) => { - if (!Array.isArray(categories)) +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Shallow Object Clone. Will not clone nested objects. + * + * @function Phaser.Utils.Objects.Clone + * @since 3.0.0 + * + * @param {object} obj - The object to clone. + * + * @return {object} A new object with the same properties as the input object. + */ +var Clone = function (obj) +{ + var clone = {}; + + for (var key in obj) + { + if (Array.isArray(obj[key])) { - flags = categories; + clone[key] = obj[key].slice(0); } else { - for (var i = 0; i < categories.length; i++) - { - flags |= categories[i]; - } + clone[key] = obj[key]; } + } - bodies.forEach(function (body) - { - body.collisionFilter.mask = flags; - }); + return clone; +}; - return this; - }, +module.exports = Clone; - /** - * Takes an array and returns a new array made from all of the Matter Bodies found in the original array. - * - * For example, passing in Matter Game Objects, such as a bunch of Matter Sprites, to this method, would - * return an array containing all of their native Matter Body objects. - * - * If the `bodies` argument is falsey, it will return all bodies in the world. - * - * @method Phaser.Physics.Matter.MatterPhysics#getMatterBodies - * @since 3.22.0 - * - * @param {array} [bodies] - An array of objects to extract the bodies from. If falsey, it will return all bodies in the world. - * - * @return {MatterJS.BodyType[]} An array of native Matter Body objects. - */ - getMatterBodies: function (bodies) - { - if (!bodies) - { - return this.world.getAllBodies(); - } - if (!Array.isArray(bodies)) - { - bodies = [ bodies ]; - } +/***/ }), - var output = []; +/***/ 28699: +/***/ ((module) => { - for (var i = 0; i < bodies.length; i++) - { - var body = (bodies[i].hasOwnProperty('body')) ? bodies[i].body : bodies[i]; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - output.push(body); - } +/** + * Deep Copy the given object or array. + * + * @function Phaser.Utils.Objects.DeepCopy + * @since 3.50.0 + * + * @param {object} obj - The object to deep copy. + * + * @return {object} A deep copy of the original object. + */ +var DeepCopy = function (inObject) +{ + var outObject; + var value; + var key; - return output; - }, + if (typeof inObject !== 'object' || inObject === null) + { + // inObject is not an object + return inObject; + } - /** - * Sets both the horizontal and vertical linear velocity of the physics bodies. - * - * @method Phaser.Physics.Matter.MatterPhysics#setVelocity - * @since 3.22.0 - * - * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. - * @param {number} x - The horizontal linear velocity value. - * @param {number} y - The vertical linear velocity value. - * - * @return {this} This Matter Physics instance. - */ - setVelocity: function (bodies, x, y) + // Create an array or object to hold the values + outObject = Array.isArray(inObject) ? [] : {}; + + for (key in inObject) { - bodies = this.getMatterBodies(bodies); + value = inObject[key]; - var vec2 = this._tempVec2; + // Recursively (deep) copy for nested objects, including arrays + outObject[key] = DeepCopy(value); + } - vec2.x = x; - vec2.y = y; + return outObject; +}; - bodies.forEach(function (body) - { - Body.setVelocity(body, vec2); - }); +module.exports = DeepCopy; - return this; - }, - /** - * Sets just the horizontal linear velocity of the physics bodies. - * The vertical velocity of the body is unchanged. - * - * @method Phaser.Physics.Matter.MatterPhysics#setVelocityX - * @since 3.22.0 - * - * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. - * @param {number} x - The horizontal linear velocity value. - * - * @return {this} This Matter Physics instance. - */ - setVelocityX: function (bodies, x) - { - bodies = this.getMatterBodies(bodies); +/***/ }), - var vec2 = this._tempVec2; +/***/ 98611: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - vec2.x = x; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - bodies.forEach(function (body) - { - vec2.y = body.velocity.y; - Body.setVelocity(body, vec2); - }); +var IsPlainObject = __webpack_require__(42911); - return this; - }, +// @param {boolean} deep - Perform a deep copy? +// @param {object} target - The target object to copy to. +// @return {object} The extended object. - /** - * Sets just the vertical linear velocity of the physics bodies. - * The horizontal velocity of the body is unchanged. - * - * @method Phaser.Physics.Matter.MatterPhysics#setVelocityY - * @since 3.22.0 - * - * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. - * @param {number} y - The vertical linear velocity value. - * - * @return {this} This Matter Physics instance. - */ - setVelocityY: function (bodies, y) +/** + * This is a slightly modified version of http://api.jquery.com/jQuery.extend/ + * + * @function Phaser.Utils.Objects.Extend + * @since 3.0.0 + * + * @param {...*} [args] - The objects that will be mixed. + * + * @return {object} The extended object. + */ +var Extend = function () +{ + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if (typeof target === 'boolean') { - bodies = this.getMatterBodies(bodies); + deep = target; + target = arguments[1] || {}; - var vec2 = this._tempVec2; + // skip the boolean and the target + i = 2; + } - vec2.y = y; + // extend Phaser if only one argument is passed + if (length === i) + { + target = this; + --i; + } - bodies.forEach(function (body) + for (; i < length; i++) + { + // Only deal with non-null/undefined values + if ((options = arguments[i]) != null) { - vec2.x = body.velocity.x; - Body.setVelocity(body, vec2); - }); + // Extend the base object + for (name in options) + { + src = target[name]; + copy = options[name]; - return this; - }, + // Prevent never-ending loop + if (target === copy) + { + continue; + } - /** - * Sets the angular velocity of the bodies instantly. - * Position, angle, force etc. are unchanged. - * - * @method Phaser.Physics.Matter.MatterPhysics#setAngularVelocity - * @since 3.22.0 - * - * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. - * @param {number} value - The angular velocity. - * - * @return {this} This Matter Physics instance. - */ - setAngularVelocity: function (bodies, value) - { - bodies = this.getMatterBodies(bodies); + // Recurse if we're merging plain objects or arrays + if (deep && copy && (IsPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) + { + if (copyIsArray) + { + copyIsArray = false; + clone = src && Array.isArray(src) ? src : []; + } + else + { + clone = src && IsPlainObject(src) ? src : {}; + } - bodies.forEach(function (body) - { - Body.setAngularVelocity(body, value); - }); + // Never move original objects, clone them + target[name] = Extend(deep, clone, copy); - return this; - }, + // Don't bring in undefined values + } + else if (copy !== undefined) + { + target[name] = copy; + } + } + } + } - /** - * Applies a force to a body, at the bodies current position, including resulting torque. - * - * @method Phaser.Physics.Matter.MatterPhysics#applyForce - * @since 3.22.0 - * - * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. - * @param {Phaser.Types.Math.Vector2Like} force - A Vector that specifies the force to apply. - * - * @return {this} This Matter Physics instance. - */ - applyForce: function (bodies, force) - { - bodies = this.getMatterBodies(bodies); + // Return the modified object + return target; +}; - var vec2 = this._tempVec2; +module.exports = Extend; - bodies.forEach(function (body) - { - vec2.x = body.position.x; - vec2.y = body.position.y; - Body.applyForce(body, vec2, force); - }); +/***/ }), - return this; - }, +/***/ 20494: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Applies a force to a body, from the given world position, including resulting torque. - * If no angle is given, the current body angle is used. - * - * Use very small speed values, such as 0.1, depending on the mass and required velocity. - * - * @method Phaser.Physics.Matter.MatterPhysics#applyForceFromPosition - * @since 3.22.0 - * - * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. - * @param {Phaser.Types.Math.Vector2Like} position - A Vector that specifies the world-space position to apply the force at. - * @param {number} speed - A speed value to be applied to a directional force. - * @param {number} [angle] - The angle, in radians, to apply the force from. Leave undefined to use the current body angle. - * - * @return {this} This Matter Physics instance. - */ - applyForceFromPosition: function (bodies, position, speed, angle) - { - bodies = this.getMatterBodies(bodies); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - var vec2 = this._tempVec2; +var MATH = __webpack_require__(5923); +var GetValue = __webpack_require__(10850); - bodies.forEach(function (body) +/** + * Retrieves a value from an object. Allows for more advanced selection options, including: + * + * Allowed types: + * + * Implicit + * { + * x: 4 + * } + * + * From function + * { + * x: function () + * } + * + * Randomly pick one element from the array + * { + * x: [a, b, c, d, e, f] + * } + * + * Random integer between min and max: + * { + * x: { randInt: [min, max] } + * } + * + * Random float between min and max: + * { + * x: { randFloat: [min, max] } + * } + * + * + * @function Phaser.Utils.Objects.GetAdvancedValue + * @since 3.0.0 + * + * @param {object} source - The object to retrieve the value from. + * @param {string} key - The name of the property to retrieve from the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`) - `banner.hideBanner` would return the value of the `hideBanner` property from the object stored in the `banner` property of the `source` object. + * @param {*} defaultValue - The value to return if the `key` isn't found in the `source` object. + * + * @return {*} The value of the requested key. + */ +var GetAdvancedValue = function (source, key, defaultValue) +{ + var value = GetValue(source, key, null); + + if (value === null) + { + return defaultValue; + } + else if (Array.isArray(value)) + { + return MATH.RND.pick(value); + } + else if (typeof value === 'object') + { + if (value.hasOwnProperty('randInt')) { - if (angle === undefined) - { - angle = body.angle; - } + return MATH.RND.integerInRange(value.randInt[0], value.randInt[1]); + } + else if (value.hasOwnProperty('randFloat')) + { + return MATH.RND.realInRange(value.randFloat[0], value.randFloat[1]); + } + } + else if (typeof value === 'function') + { + return value(key); + } - vec2.x = speed * Math.cos(angle); - vec2.y = speed * Math.sin(angle); + return value; +}; - Body.applyForce(body, position, vec2); - }); +module.exports = GetAdvancedValue; - return this; - }, - /** - * Apply a force to a body based on the given angle and speed. - * If no angle is given, the current body angle is used. - * - * Use very small speed values, such as 0.1, depending on the mass and required velocity. - * - * @method Phaser.Physics.Matter.MatterPhysics#applyForceFromAngle - * @since 3.22.0 - * - * @param {(Phaser.Types.Physics.Matter.MatterBody|Phaser.Types.Physics.Matter.MatterBody[])} bodies - Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world. - * @param {number} speed - A speed value to be applied to a directional force. - * @param {number} [angle] - The angle, in radians, to apply the force from. Leave undefined to use the current body angle. - * - * @return {this} This Matter Physics instance. - */ - applyForceFromAngle: function (bodies, speed, angle) +/***/ }), + +/***/ 72632: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Finds the key within the top level of the {@link source} object, or returns {@link defaultValue} + * + * @function Phaser.Utils.Objects.GetFastValue + * @since 3.0.0 + * + * @param {object} source - The object to search + * @param {string} key - The key for the property on source. Must exist at the top level of the source object (no periods) + * @param {*} [defaultValue] - The default value to use if the key does not exist. + * + * @return {*} The value if found; otherwise, defaultValue (null if none provided) + */ +var GetFastValue = function (source, key, defaultValue) +{ + var t = typeof(source); + + if (!source || t === 'number' || t === 'string') { - bodies = this.getMatterBodies(bodies); + return defaultValue; + } + else if (source.hasOwnProperty(key) && source[key] !== undefined) + { + return source[key]; + } + else + { + return defaultValue; + } +}; - var vec2 = this._tempVec2; +module.exports = GetFastValue; - bodies.forEach(function (body) - { - if (angle === undefined) - { - angle = body.angle; - } - vec2.x = speed * Math.cos(angle); - vec2.y = speed * Math.sin(angle); +/***/ }), - Body.applyForce(body, { x: body.position.x, y: body.position.y }, vec2); - }); +/***/ 94324: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return this; - }, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * Returns the length of the given constraint, which is the distance between the two points. - * - * @method Phaser.Physics.Matter.MatterPhysics#getConstraintLength - * @since 3.22.0 - * - * @param {MatterJS.ConstraintType} constraint - The constraint to get the length from. - * - * @return {number} The length of the constraint. - */ - getConstraintLength: function (constraint) - { - var aX = constraint.pointA.x; - var aY = constraint.pointA.y; - var bX = constraint.pointB.x; - var bY = constraint.pointB.y; +var GetValue = __webpack_require__(10850); +var Clamp = __webpack_require__(82897); - if (constraint.bodyA) - { - aX += constraint.bodyA.position.x; - aY += constraint.bodyA.position.y; - } +/** + * Retrieves and clamps a numerical value from an object. + * + * @function Phaser.Utils.Objects.GetMinMaxValue + * @since 3.0.0 + * + * @param {object} source - The object to retrieve the value from. + * @param {string} key - The name of the property to retrieve from the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`). + * @param {number} min - The minimum value which can be returned. + * @param {number} max - The maximum value which can be returned. + * @param {number} defaultValue - The value to return if the property doesn't exist. It's also constrained to the given bounds. + * + * @return {number} The clamped value from the `source` object. + */ +var GetMinMaxValue = function (source, key, min, max, defaultValue) +{ + if (defaultValue === undefined) { defaultValue = min; } - if (constraint.bodyB) - { - bX += constraint.bodyB.position.x; - bY += constraint.bodyB.position.y; - } + var value = GetValue(source, key, defaultValue); - return DistanceBetween(aX, aY, bX, bY); - }, + return Clamp(value, min, max); +}; - /** - * Aligns a Body, or Matter Game Object, against the given coordinates. - * - * The alignment takes place using the body bounds, which take into consideration things - * like body scale and rotation. - * - * Although a Body has a `position` property, it is based on the center of mass for the body, - * not a dimension based center. This makes aligning bodies difficult, especially if they have - * rotated or scaled. This method will derive the correct position based on the body bounds and - * its center of mass offset, in order to align the body with the given coordinate. - * - * For example, if you wanted to align a body so it sat in the bottom-center of the - * Scene, and the world was 800 x 600 in size: - * - * ```javascript - * this.matter.alignBody(body, 400, 600, Phaser.Display.Align.BOTTOM_CENTER); - * ``` - * - * You pass in 400 for the x coordinate, because that is the center of the world, and 600 for - * the y coordinate, as that is the base of the world. - * - * @method Phaser.Physics.Matter.MatterPhysics#alignBody - * @since 3.22.0 - * - * @param {Phaser.Types.Physics.Matter.MatterBody} body - The Body to align. - * @param {number} x - The horizontal position to align the body to. - * @param {number} y - The vertical position to align the body to. - * @param {number} align - One of the `Phaser.Display.Align` constants, such as `Phaser.Display.Align.TOP_LEFT`. - * - * @return {this} This Matter Physics instance. - */ - alignBody: function (body, x, y, align) +module.exports = GetMinMaxValue; + + +/***/ }), + +/***/ 10850: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Retrieves a value from an object, or an alternative object, falling to a back-up default value if not found. + * + * The key is a string, which can be split based on the use of the period character. + * + * For example: + * + * ```javascript + * const source = { + * lives: 3, + * render: { + * screen: { + * width: 1024 + * } + * } + * } + * + * const lives = GetValue(source, 'lives', 1); + * const width = GetValue(source, 'render.screen.width', 800); + * const height = GetValue(source, 'render.screen.height', 600); + * ``` + * + * In the code above, `lives` will be 3 because it's defined at the top level of `source`. + * The `width` value will be 1024 because it can be found inside the `render.screen` object. + * The `height` value will be 600, the default value, because it is missing from the `render.screen` object. + * + * @function Phaser.Utils.Objects.GetValue + * @since 3.0.0 + * + * @param {object} source - The primary object to try to retrieve the value from. If not found in here, `altSource` is checked. + * @param {string} key - The name of the property to retrieve from the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`) - `banner.hideBanner` would return the value of the `hideBanner` property from the object stored in the `banner` property of the `source` object. + * @param {*} defaultValue - The value to return if the `key` isn't found in the `source` object. + * @param {object} [altSource] - An alternative object to retrieve the value from. If the property exists in `source` then `altSource` will not be used. + * + * @return {*} The value of the requested key. + */ +var GetValue = function (source, key, defaultValue, altSource) +{ + if ((!source && !altSource) || typeof source === 'number') { - body = (body.hasOwnProperty('body')) ? body.body : body; - - var pos; + return defaultValue; + } + else if (source && source.hasOwnProperty(key)) + { + return source[key]; + } + else if (altSource && altSource.hasOwnProperty(key)) + { + return altSource[key]; + } + else if (key.indexOf('.') !== -1) + { + var keys = key.split('.'); + var parentA = source; + var parentB = altSource; + var valueA = defaultValue; + var valueB = defaultValue; + var valueAFound = true; + var valueBFound = true; - switch (align) + // Use for loop here so we can break early + for (var i = 0; i < keys.length; i++) { - case ALIGN_CONST.TOP_LEFT: - case ALIGN_CONST.LEFT_TOP: - pos = this.bodyBounds.getTopLeft(body, x, y); - break; + if (parentA && parentA.hasOwnProperty(keys[i])) + { + // Yes parentA has a key property, let's carry on down + valueA = parentA[keys[i]]; + parentA = parentA[keys[i]]; + } + else + { + valueAFound = false; + } - case ALIGN_CONST.TOP_CENTER: - pos = this.bodyBounds.getTopCenter(body, x, y); - break; - - case ALIGN_CONST.TOP_RIGHT: - case ALIGN_CONST.RIGHT_TOP: - pos = this.bodyBounds.getTopRight(body, x, y); - break; + if (parentB && parentB.hasOwnProperty(keys[i])) + { + // Yes parentB has a key property, let's carry on down + valueB = parentB[keys[i]]; + parentB = parentB[keys[i]]; + } + else + { + valueBFound = false; + } + } - case ALIGN_CONST.LEFT_CENTER: - pos = this.bodyBounds.getLeftCenter(body, x, y); - break; + if (valueAFound) + { + return valueA; + } + else if (valueBFound) + { + return valueB; + } + else + { + return defaultValue; + } + } + else + { + return defaultValue; + } +}; - case ALIGN_CONST.CENTER: - pos = this.bodyBounds.getCenter(body, x, y); - break; +module.exports = GetValue; - case ALIGN_CONST.RIGHT_CENTER: - pos = this.bodyBounds.getRightCenter(body, x, y); - break; - case ALIGN_CONST.LEFT_BOTTOM: - case ALIGN_CONST.BOTTOM_LEFT: - pos = this.bodyBounds.getBottomLeft(body, x, y); - break; +/***/ }), - case ALIGN_CONST.BOTTOM_CENTER: - pos = this.bodyBounds.getBottomCenter(body, x, y); - break; +/***/ 87701: +/***/ ((module) => { - case ALIGN_CONST.BOTTOM_RIGHT: - case ALIGN_CONST.RIGHT_BOTTOM: - pos = this.bodyBounds.getBottomRight(body, x, y); - break; - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (pos) +/** + * Verifies that an object contains all requested keys + * + * @function Phaser.Utils.Objects.HasAll + * @since 3.0.0 + * + * @param {object} source - an object on which to check for key existence + * @param {string[]} keys - an array of keys to ensure the source object contains + * + * @return {boolean} true if the source object contains all keys, false otherwise. + */ +var HasAll = function (source, keys) +{ + for (var i = 0; i < keys.length; i++) + { + if (!source.hasOwnProperty(keys[i])) { - Body.setPosition(body, pos); + return false; } + } - return this; - }, + return true; +}; - /** - * The Scene that owns this plugin is shutting down. - * We need to kill and reset all internal properties as well as stop listening to Scene events. - * - * @method Phaser.Physics.Matter.MatterPhysics#shutdown - * @private - * @since 3.0.0 - */ - shutdown: function () - { - var eventEmitter = this.systems.events; +module.exports = HasAll; - if (this.world) - { - eventEmitter.off(SceneEvents.UPDATE, this.world.update, this.world); - eventEmitter.off(SceneEvents.POST_UPDATE, this.world.postUpdate, this.world); - } - eventEmitter.off(SceneEvents.SHUTDOWN, this.shutdown, this); +/***/ }), - if (this.add) - { - this.add.destroy(); - } +/***/ 53523: +/***/ ((module) => { - if (this.world) +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Verifies that an object contains at least one of the requested keys + * + * @function Phaser.Utils.Objects.HasAny + * @since 3.0.0 + * + * @param {object} source - an object on which to check for key existence + * @param {string[]} keys - an array of keys to search the object for + * + * @return {boolean} true if the source object contains at least one of the keys, false otherwise + */ +var HasAny = function (source, keys) +{ + for (var i = 0; i < keys.length; i++) + { + if (source.hasOwnProperty(keys[i])) { - this.world.destroy(); + return true; } + } - this.add = null; - this.world = null; - }, + return false; +}; - /** - * The Scene that owns this plugin is being destroyed. - * We need to shutdown and then kill off all external references. - * - * @method Phaser.Physics.Matter.MatterPhysics#destroy - * @private - * @since 3.0.0 - */ - destroy: function () - { - this.shutdown(); +module.exports = HasAny; - this.scene.sys.events.off(SceneEvents.START, this.start, this); - this.scene = null; - this.systems = null; - } +/***/ }), -}); +/***/ 19256: +/***/ ((module) => { -PluginCache.register('MatterPhysics', MatterPhysics, 'matterPhysics'); +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ -module.exports = MatterPhysics; +/** + * Determine whether the source object has a property with the specified key. + * + * @function Phaser.Utils.Objects.HasValue + * @since 3.0.0 + * + * @param {object} source - The source object to be checked. + * @param {string} key - The property to check for within the object + * + * @return {boolean} `true` if the provided `key` exists on the `source` object, otherwise `false`. + */ +var HasValue = function (source, key) +{ + return (source.hasOwnProperty(key)); +}; + +module.exports = HasValue; /***/ }), -/* 1525 */ -/***/ (function(module, exports, __webpack_require__) { -var Matter = __webpack_require__(594); +/***/ 42911: +/***/ ((module) => { /** - * An attractors plugin for matter.js. - * See the readme for usage and examples. - * @module MatterAttractors + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MatterAttractors = -{ - name: 'matter-attractors', - version: '0.1.7', - for: 'matter-js@^0.14.2', - silent: true, - // installs the plugin where `base` is `Matter` - // you should not need to call this directly. - install: function (base) +/** + * This is a slightly modified version of jQuery.isPlainObject. + * A plain object is an object whose internal class property is [object Object]. + * + * @function Phaser.Utils.Objects.IsPlainObject + * @since 3.0.0 + * + * @param {object} obj - The object to inspect. + * + * @return {boolean} `true` if the object is plain, otherwise `false`. + */ +var IsPlainObject = function (obj) +{ + // Not plain objects: + // - Any object or value whose internal [[Class]] property is not "[object Object]" + // - DOM nodes + // - window + if (!obj || typeof(obj) !== 'object' || obj.nodeType || obj === obj.window) { - base.after('Body.create', function () - { - MatterAttractors.Body.init(this); - }); - - base.before('Engine.update', function (engine) - { - MatterAttractors.Engine.update(engine); - }); - }, + return false; + } - Body: + // Support: Firefox <20 + // The try/catch suppresses exceptions thrown when attempting to access + // the "constructor" property of certain host objects, ie. |window.location| + // https://bugzilla.mozilla.org/show_bug.cgi?id=814622 + try { - /** - * Initialises the `body` to support attractors. - * This is called automatically by the plugin. - * @function MatterAttractors.Body.init - * @param {Matter.Body} body The body to init. - * @returns {void} No return value. - */ - init: function (body) + if (obj.constructor && !({}).hasOwnProperty.call(obj.constructor.prototype, 'isPrototypeOf')) { - body.plugin.attractors = body.plugin.attractors || []; + return false; } - }, - - Engine: + } + catch (e) { - /** - * Applies all attractors for all bodies in the `engine`. - * This is called automatically by the plugin. - * @function MatterAttractors.Engine.update - * @param {Matter.Engine} engine The engine to update. - * @returns {void} No return value. - */ - update: function (engine) - { - var bodies = Matter.Composite.allBodies(engine.world); + return false; + } - for (var i = 0; i < bodies.length; i++) - { - var bodyA = bodies[i]; - var attractors = bodyA.plugin.attractors; + // If the function hasn't returned already, we're confident that + // |obj| is a plain object, created by {} or constructed with new Object + return true; +}; - if (attractors && attractors.length > 0) - { - for (var j = 0; j < bodies.length; j++) - { - var bodyB = bodies[j]; +module.exports = IsPlainObject; - if (i !== j) - { - for (var k = 0; k < attractors.length; k++) - { - var attractor = attractors[k]; - var forceVector = attractor; - if (Matter.Common.isFunction(attractor)) - { - forceVector = attractor(bodyA, bodyB); - } +/***/ }), - if (forceVector) - { - Matter.Body.applyForce(bodyB, bodyB.position, forceVector); - } - } - } - } - } - } - } - }, +/***/ 30657: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Defines some useful common attractor functions that can be used - * by pushing them to your body's `body.plugin.attractors` array. - * @namespace MatterAttractors.Attractors - * @property {number} gravityConstant The gravitational constant used by the gravity attractor. - */ - Attractors: - { - gravityConstant: 0.001, +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - /** - * An attractor function that applies Newton's law of gravitation. - * Use this by pushing `MatterAttractors.Attractors.gravity` to your body's `body.plugin.attractors` array. - * The gravitational constant defaults to `0.001` which you can change - * at `MatterAttractors.Attractors.gravityConstant`. - * @function MatterAttractors.Attractors.gravity - * @param {Matter.Body} bodyA The first body. - * @param {Matter.Body} bodyB The second body. - * @returns {void} No return value. - */ - gravity: function (bodyA, bodyB) - { - // use Newton's law of gravitation - var bToA = Matter.Vector.sub(bodyB.position, bodyA.position); - var distanceSq = Matter.Vector.magnitudeSquared(bToA) || 0.0001; - var normal = Matter.Vector.normalise(bToA); - var magnitude = -MatterAttractors.Attractors.gravityConstant * (bodyA.mass * bodyB.mass / distanceSq); - var force = Matter.Vector.mult(normal, magnitude); +var Clone = __webpack_require__(32742); - // to apply forces to both bodies - Matter.Body.applyForce(bodyA, bodyA.position, Matter.Vector.neg(force)); - Matter.Body.applyForce(bodyB, bodyB.position, force); +/** + * Creates a new Object using all values from obj1 and obj2. + * If a value exists in both obj1 and obj2, the value in obj1 is used. + * + * This is only a shallow copy. Deeply nested objects are not cloned, so be sure to only use this + * function on shallow objects. + * + * @function Phaser.Utils.Objects.Merge + * @since 3.0.0 + * + * @param {object} obj1 - The first object. + * @param {object} obj2 - The second object. + * + * @return {object} A new object containing the union of obj1's and obj2's properties. + */ +var Merge = function (obj1, obj2) +{ + var clone = Clone(obj1); + + for (var key in obj2) + { + if (!clone.hasOwnProperty(key)) + { + clone[key] = obj2[key]; } } + + return clone; }; -module.exports = MatterAttractors; +module.exports = Merge; -/** - * @namespace Matter.Body - * @see http://brm.io/matter-js/docs/classes/Body.html - */ + +/***/ }), + +/***/ 72066: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * This plugin adds a new property `body.plugin.attractors` to instances of `Matter.Body`. - * This is an array of callback functions that will be called automatically - * for every pair of bodies, on every engine update. - * @property {Function[]} body.plugin.attractors - * @memberof Matter.Body + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ +var Clone = __webpack_require__(32742); + /** - * An attractor function calculates the force to be applied - * to `bodyB`, it should either: - * - return the force vector to be applied to `bodyB` - * - or apply the force to the body(s) itself - * @callback AttractorFunction - * @param {Matter.Body} bodyA - * @param {Matter.Body} bodyB - * @returns {(Vector|undefined)} a force vector (optional) + * Creates a new Object using all values from obj1. + * + * Then scans obj2. If a property is found in obj2 that *also* exists in obj1, the value from obj2 is used, otherwise the property is skipped. + * + * @function Phaser.Utils.Objects.MergeRight + * @since 3.0.0 + * + * @param {object} obj1 - The first object to merge. + * @param {object} obj2 - The second object to merge. Keys from this object which also exist in `obj1` will be copied to `obj1`. + * + * @return {object} The merged object. `obj1` and `obj2` are not modified. */ +var MergeRight = function (obj1, obj2) +{ + var clone = Clone(obj1); + + for (var key in obj2) + { + if (clone.hasOwnProperty(key)) + { + clone[key] = obj2[key]; + } + } + + return clone; +}; + +module.exports = MergeRight; /***/ }), -/* 1526 */ -/***/ (function(module, exports) { + +/***/ 28820: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * @author @dxu https://github.com/dxu/matter-collision-events * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MatterCollisionEvents = { +var HasValue = __webpack_require__(19256); - name: 'matter-collision-events', - version: '0.1.6', - for: 'matter-js@^0.14.2', - silent: true, +/** + * Returns a new object that only contains the `keys` that were found on the object provided. + * If no `keys` are found, an empty object is returned. + * + * @function Phaser.Utils.Objects.Pick + * @since 3.18.0 + * + * @param {object} object - The object to pick the provided keys from. + * @param {array} keys - An array of properties to retrieve from the provided object. + * + * @return {object} A new object that only contains the `keys` that were found on the provided object. If no `keys` were found, an empty object will be returned. + */ +var Pick = function (object, keys) +{ + var obj = {}; - install: function (matter) + for (var i = 0; i < keys.length; i++) { - matter.after('Engine.create', function () + var key = keys[i]; + + if (HasValue(object, key)) { - matter.Events.on(this, 'collisionStart', function (event) - { - event.pairs.map(function (pair) - { - var bodyA = pair.bodyA; - var bodyB = pair.bodyB; + obj[key] = object[key]; + } + } - if (bodyA.gameObject) - { - bodyA.gameObject.emit('collide', bodyA, bodyB, pair); - } + return obj; +}; - if (bodyB.gameObject) - { - bodyB.gameObject.emit('collide', bodyB, bodyA, pair); - } +module.exports = Pick; - matter.Events.trigger(bodyA, 'onCollide', { pair: pair }); - matter.Events.trigger(bodyB, 'onCollide', { pair: pair }); - if (bodyA.onCollideCallback) - { - bodyA.onCollideCallback(pair); - } +/***/ }), - if (bodyB.onCollideCallback) - { - bodyB.onCollideCallback(pair); - } +/***/ 22440: +/***/ ((module) => { - if (bodyA.onCollideWith[bodyB.id]) - { - bodyA.onCollideWith[bodyB.id](bodyB, pair); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (bodyB.onCollideWith[bodyA.id]) - { - bodyB.onCollideWith[bodyA.id](bodyA, pair); - } - }); - }); +/** + * Sets a value in an object, allowing for dot notation to control the depth of the property. + * + * For example: + * + * ```javascript + * var data = { + * world: { + * position: { + * x: 200, + * y: 100 + * } + * } + * }; + * + * SetValue(data, 'world.position.y', 300); + * + * console.log(data.world.position.y); // 300 + * ``` + * + * @function Phaser.Utils.Objects.SetValue + * @since 3.17.0 + * + * @param {object} source - The object to set the value in. + * @param {string} key - The name of the property in the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`) + * @param {any} value - The value to set into the property, if found in the source object. + * + * @return {boolean} `true` if the property key was valid and the value was set, otherwise `false`. + */ +var SetValue = function (source, key, value) +{ + if (!source || typeof source === 'number') + { + return false; + } + else if (source.hasOwnProperty(key)) + { + source[key] = value; - matter.Events.on(this, 'collisionActive', function (event) + return true; + } + else if (key.indexOf('.') !== -1) + { + var keys = key.split('.'); + var parent = source; + var prev = source; + + // Use for loop here so we can break early + for (var i = 0; i < keys.length; i++) + { + if (parent.hasOwnProperty(keys[i])) { - event.pairs.map(function (pair) - { - var bodyA = pair.bodyA; - var bodyB = pair.bodyB; + // Yes it has a key property, let's carry on down + prev = parent; + parent = parent[keys[i]]; + } + else + { + return false; + } + } - if (bodyA.gameObject) - { - bodyA.gameObject.emit('collideActive', bodyA, bodyB, pair); - } + prev[keys[keys.length - 1]] = value; - if (bodyB.gameObject) - { - bodyB.gameObject.emit('collideActive', bodyB, bodyA, pair); - } + return true; + } - matter.Events.trigger(bodyA, 'onCollideActive', { pair: pair }); - matter.Events.trigger(bodyB, 'onCollideActive', { pair: pair }); + return false; +}; - if (bodyA.onCollideActiveCallback) - { - bodyA.onCollideActiveCallback(pair); - } +module.exports = SetValue; - if (bodyB.onCollideActiveCallback) - { - bodyB.onCollideActiveCallback(pair); - } - }); - }); - matter.Events.on(this, 'collisionEnd', function (event) - { - event.pairs.map(function (pair) - { - var bodyA = pair.bodyA; - var bodyB = pair.bodyB; +/***/ }), - if (bodyA.gameObject) - { - bodyA.gameObject.emit('collideEnd', bodyA, bodyB, pair); - } +/***/ 64615: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (bodyB.gameObject) - { - bodyB.gameObject.emit('collideEnd', bodyB, bodyA, pair); - } +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - matter.Events.trigger(bodyA, 'onCollideEnd', { pair: pair }); - matter.Events.trigger(bodyB, 'onCollideEnd', { pair: pair }); +/** + * @namespace Phaser.Utils.Objects + */ - if (bodyA.onCollideEndCallback) - { - bodyA.onCollideEndCallback(pair); - } +module.exports = { - if (bodyB.onCollideEndCallback) - { - bodyB.onCollideEndCallback(pair); - } - }); - }); - }); - } -}; + Clone: __webpack_require__(32742), + DeepCopy: __webpack_require__(28699), + Extend: __webpack_require__(98611), + GetAdvancedValue: __webpack_require__(20494), + GetFastValue: __webpack_require__(72632), + GetMinMaxValue: __webpack_require__(94324), + GetValue: __webpack_require__(10850), + HasAll: __webpack_require__(87701), + HasAny: __webpack_require__(53523), + HasValue: __webpack_require__(19256), + IsPlainObject: __webpack_require__(42911), + Merge: __webpack_require__(30657), + MergeRight: __webpack_require__(72066), + Pick: __webpack_require__(28820), + SetValue: __webpack_require__(22440) -module.exports = MatterCollisionEvents; +}; /***/ }), -/* 1527 */ -/***/ (function(module, exports, __webpack_require__) { -var Matter = __webpack_require__(594); +/***/ 69429: +/***/ ((module) => { /** - * A coordinate wrapping plugin for matter.js. - * See the readme for usage and examples. - * @module MatterWrap + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var MatterWrap = { - // plugin meta - name: 'matter-wrap', // PLUGIN_NAME - version: '0.1.4', // PLUGIN_VERSION - for: 'matter-js@^0.14.2', - silent: true, // no console log please - // installs the plugin where `base` is `Matter` - // you should not need to call this directly. - install: function(base) { - base.after('Engine.update', function() { - MatterWrap.Engine.update(this); +/** + * Takes a string and replaces instances of markers with values in the given array. + * The markers take the form of `%1`, `%2`, etc. I.e.: + * + * `Format("The %1 is worth %2 gold", [ 'Sword', 500 ])` + * + * @function Phaser.Utils.String.Format + * @since 3.0.0 + * + * @param {string} string - The string containing the replacement markers. + * @param {array} values - An array containing values that will replace the markers. If no value exists an empty string is inserted instead. + * + * @return {string} The string containing replaced values. + */ +var Format = function (string, values) +{ + return string.replace(/%([0-9]+)/g, function (s, n) + { + return values[Number(n) - 1]; }); - }, - - Engine: { - /** - * Updates the engine by wrapping bodies and composites inside `engine.world`. - * This is called automatically by the plugin. - * @function MatterWrap.Engine.update - * @param {Matter.Engine} engine The engine to update. - * @returns {void} No return value. - */ - update: function(engine) { - var world = engine.world, - bodies = Matter.Composite.allBodies(world), - composites = Matter.Composite.allComposites(world); +}; - for (var i = 0; i < bodies.length; i += 1) { - var body = bodies[i]; +module.exports = Format; - if (body.plugin.wrap) { - MatterWrap.Body.wrap(body, body.plugin.wrap); - } - } - for (i = 0; i < composites.length; i += 1) { - var composite = composites[i]; +/***/ }), - if (composite.plugin.wrap) { - MatterWrap.Composite.wrap(composite, composite.plugin.wrap); - } - } - } - }, +/***/ 76400: +/***/ ((module) => { - Bounds: { - /** - * Returns a translation vector that wraps the `objectBounds` inside the `bounds`. - * @function MatterWrap.Bounds.wrap - * @param {Matter.Bounds} objectBounds The bounds of the object to wrap inside the bounds. - * @param {Matter.Bounds} bounds The bounds to wrap the body inside. - * @returns {?Matter.Vector} A translation vector (only if wrapping is required). - */ - wrap: function(objectBounds, bounds) { - var x = null, - y = null; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ - if (typeof bounds.min.x !== 'undefined' && typeof bounds.max.x !== 'undefined') { - if (objectBounds.min.x > bounds.max.x) { - x = bounds.min.x - objectBounds.max.x; - } else if (objectBounds.max.x < bounds.min.x) { - x = bounds.max.x - objectBounds.min.x; - } - } +/** + * Takes the given string and pads it out, to the length required, using the character + * specified. For example if you need a string to be 6 characters long, you can call: + * + * `pad('bob', 6, '-', 2)` + * + * This would return: `bob---` as it has padded it out to 6 characters, using the `-` on the right. + * + * You can also use it to pad numbers (they are always returned as strings): + * + * `pad(512, 6, '0', 1)` + * + * Would return: `000512` with the string padded to the left. + * + * If you don't specify a direction it'll pad to both sides: + * + * `pad('c64', 7, '*')` + * + * Would return: `**c64**` + * + * @function Phaser.Utils.String.Pad + * @since 3.0.0 + * + * @param {string|number|object} str - The target string. `toString()` will be called on the string, which means you can also pass in common data types like numbers. + * @param {number} [len=0] - The number of characters to be added. + * @param {string} [pad=" "] - The string to pad it out with (defaults to a space). + * @param {number} [dir=3] - The direction dir = 1 (left), 2 (right), 3 (both). + * + * @return {string} The padded string. + */ +var Pad = function (str, len, pad, dir) +{ + if (len === undefined) { len = 0; } + if (pad === undefined) { pad = ' '; } + if (dir === undefined) { dir = 3; } - if (typeof bounds.min.y !== 'undefined' && typeof bounds.max.y !== 'undefined') { - if (objectBounds.min.y > bounds.max.y) { - y = bounds.min.y - objectBounds.max.y; - } else if (objectBounds.max.y < bounds.min.y) { - y = bounds.max.y - objectBounds.min.y; - } - } + str = str.toString(); - if (x !== null || y !== null) { - return { - x: x || 0, - y: y || 0 - }; - } - } - }, + var padlen = 0; - Body: { - /** - * Wraps the `body` position such that it always stays within the given bounds. - * Upon crossing a boundary the body will appear on the opposite side of the bounds, - * while maintaining its velocity. - * This is called automatically by the plugin. - * @function MatterWrap.Body.wrap - * @param {Matter.Body} body The body to wrap. - * @param {Matter.Bounds} bounds The bounds to wrap the body inside. - * @returns {?Matter.Vector} The translation vector that was applied (only if wrapping was required). - */ - wrap: function(body, bounds) { - var translation = MatterWrap.Bounds.wrap(body.bounds, bounds); + if (len + 1 >= str.length) + { + switch (dir) + { + case 1: + str = new Array(len + 1 - str.length).join(pad) + str; + break; - if (translation) { - Matter.Body.translate(body, translation); - } + case 3: + var right = Math.ceil((padlen = len - str.length) / 2); + var left = padlen - right; + str = new Array(left + 1).join(pad) + str + new Array(right + 1).join(pad); + break; - return translation; + default: + str = str + new Array(len + 1 - str.length).join(pad); + break; + } } - }, - Composite: { - /** - * Returns the union of the bounds of all of the composite's bodies - * (not accounting for constraints). - * @function MatterWrap.Composite.bounds - * @param {Matter.Composite} composite The composite. - * @returns {Matter.Bounds} The composite bounds. - */ - bounds: function(composite) { - var bodies = Matter.Composite.allBodies(composite), - vertices = []; - - for (var i = 0; i < bodies.length; i += 1) { - var body = bodies[i]; - vertices.push(body.bounds.min, body.bounds.max); - } + return str; +}; - return Matter.Bounds.create(vertices); - }, +module.exports = Pad; - /** - * Wraps the `composite` position such that it always stays within the given bounds. - * Upon crossing a boundary the composite will appear on the opposite side of the bounds, - * while maintaining its velocity. - * This is called automatically by the plugin. - * @function MatterWrap.Composite.wrap - * @param {Matter.Composite} composite The composite to wrap. - * @param {Matter.Bounds} bounds The bounds to wrap the composite inside. - * @returns {?Matter.Vector} The translation vector that was applied (only if wrapping was required). - */ - wrap: function(composite, bounds) { - var translation = MatterWrap.Bounds.wrap( - MatterWrap.Composite.bounds(composite), - bounds - ); - if (translation) { - Matter.Composite.translate(composite, translation); - } +/***/ }), - return translation; - } - } -}; +/***/ 76872: +/***/ ((module) => { -module.exports = MatterWrap; +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ /** - * @namespace Matter.Body - * @see http://brm.io/matter-js/docs/classes/Body.html + * Takes a string and removes the character at the given index. + * + * @function Phaser.Utils.String.RemoveAt + * @since 3.50.0 + * + * @param {string} string - The string to be worked on. + * @param {number} index - The index of the character to be removed. + * + * @return {string} The modified string. */ +var RemoveAt = function (string, index) +{ + if (index === 0) + { + return string.slice(1); + } + else + { + return string.slice(0, index - 1) + string.slice(index); + } +}; + +module.exports = RemoveAt; + + +/***/ }), + +/***/ 8051: +/***/ ((module) => { /** - * This plugin adds a new property `body.plugin.wrap` to instances of `Matter.Body`. - * This is a `Matter.Bounds` instance that specifies the wrapping region. - * @property {Matter.Bounds} body.plugin.wrap - * @memberof Matter.Body + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ /** - * This plugin adds a new property `composite.plugin.wrap` to instances of `Matter.Composite`. - * This is a `Matter.Bounds` instance that specifies the wrapping region. - * @property {Matter.Bounds} composite.plugin.wrap - * @memberof Matter.Composite + * Takes the given string and reverses it, returning the reversed string. + * For example if given the string `Atari 520ST` it would return `TS025 iratA`. + * + * @function Phaser.Utils.String.Reverse + * @since 3.0.0 + * + * @param {string} string - The string to be reversed. + * + * @return {string} The reversed string. */ +var Reverse = function (string) +{ + return string.split('').reverse().join(''); +}; + +module.exports = Reverse; + /***/ }), -/* 1528 */ -/***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(global) {/** +/***/ 76583: +/***/ ((module) => { + +/** * @author Richard Davey - * @copyright 2020 Photon Storm Ltd. + * @copyright 2013-2023 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -var CONST = __webpack_require__(33); -var Extend = __webpack_require__(17); - /** - * @namespace Phaser + * Creates and returns an RFC4122 version 4 compliant UUID. + * + * The string is in the form: `xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx` where each `x` is replaced with a random + * hexadecimal digit from 0 to f, and `y` is replaced with a random hexadecimal digit from 8 to b. + * + * @function Phaser.Utils.String.UUID + * @since 3.12.0 + * + * @return {string} The UUID string. */ +var UUID = function () +{ + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) + { + var r = Math.random() * 16 | 0; + var v = (c === 'x') ? r : (r & 0x3 | 0x8); -var Phaser = { + return v.toString(16); + }); +}; - Actions: __webpack_require__(275), - Animations: __webpack_require__(723), - BlendModes: __webpack_require__(35), - Cache: __webpack_require__(735), - Cameras: __webpack_require__(738), - Core: __webpack_require__(806), - Class: __webpack_require__(0), - Create: __webpack_require__(888), - Curves: __webpack_require__(894), - Data: __webpack_require__(896), - Display: __webpack_require__(898), - DOM: __webpack_require__(917), - Events: __webpack_require__(918), - Game: __webpack_require__(920), - GameObjects: __webpack_require__(1011), - Geom: __webpack_require__(483), - Input: __webpack_require__(1308), - Loader: __webpack_require__(1338), - Math: __webpack_require__(193), - Physics: __webpack_require__(1493), - Plugins: __webpack_require__(1403), - Renderer: __webpack_require__(1405), - Scale: __webpack_require__(1412), - ScaleModes: __webpack_require__(168), - Scene: __webpack_require__(418), - Scenes: __webpack_require__(1413), - Structs: __webpack_require__(1415), - Textures: __webpack_require__(1416), - Tilemaps: __webpack_require__(1418), - Time: __webpack_require__(1461), - Tweens: __webpack_require__(1463), - Utils: __webpack_require__(1481) +module.exports = UUID; -}; -// Merge in the optional plugins and WebGL only features +/***/ }), -if (true) +/***/ 40587: +/***/ ((module) => { + +/** + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * Capitalizes the first letter of a string if there is one. + * @example + * UppercaseFirst('abc'); + * // returns 'Abc' + * @example + * UppercaseFirst('the happy family'); + * // returns 'The happy family' + * @example + * UppercaseFirst(''); + * // returns '' + * + * @function Phaser.Utils.String.UppercaseFirst + * @since 3.0.0 + * + * @param {string} str - The string to capitalize. + * + * @return {string} A new string, same as the first, but with the first letter capitalized. + */ +var UppercaseFirst = function (str) { - Phaser.Sound = __webpack_require__(1492); -} + return str && str[0].toUpperCase() + str.slice(1); +}; -if (false) -{} +module.exports = UppercaseFirst; -if (false) -{} -// Merge in the consts +/***/ }), -Phaser = Extend(false, Phaser, CONST); +/***/ 50379: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { /** - * The root types namespace. - * - * @namespace Phaser.Types - * @since 3.17.0 + * @author Richard Davey + * @copyright 2013-2023 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} */ -// Export it +/** + * @namespace Phaser.Utils.String + */ -module.exports = Phaser; +module.exports = { -global.Phaser = Phaser; + Format: __webpack_require__(69429), + Pad: __webpack_require__(76400), + RemoveAt: __webpack_require__(76872), + Reverse: __webpack_require__(8051), + UppercaseFirst: __webpack_require__(40587), + UUID: __webpack_require__(76583) -/* - * "Documentation is like pizza: when it is good, it is very, very good; - * and when it is bad, it is better than nothing." - * -- Dick Brandon - */ +}; -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(600))) /***/ }) -/******/ ]); + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/global */ +/******/ (() => { +/******/ __webpack_require__.g = (function() { +/******/ if (typeof globalThis === 'object') return globalThis; +/******/ try { +/******/ return this || new Function('return this')(); +/******/ } catch (e) { +/******/ if (typeof window === 'object') return window; +/******/ } +/******/ })(); +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ var __webpack_exports__ = __webpack_require__(92491); +/******/ +/******/ return __webpack_exports__; +/******/ })() +; }); ;define("phaser/dist/phaser", ["Phaser"], function(m){return m;}); ; @@ -242702,11 +266318,6 @@ define('aurelia-templating-binding',['aurelia-templating-binding/dist/commonjs/a define('aurelia-templating-resources',['aurelia-templating-resources/dist/commonjs/aurelia-templating-resources'],function(m){return m;}); define('aurelia-templating-router',['aurelia-templating-router/dist/commonjs/aurelia-templating-router'],function(m){return m;}); define('aurelia-testing',['aurelia-testing/dist/commonjs/aurelia-testing'],function(m){return m;}); -define('aurelia-testing/aurelia-testing',['aurelia-testing/dist/commonjs/aurelia-testing'],function(m){return m;}); -define('aurelia-testing/compile-spy',['aurelia-testing/dist/commonjs/compile-spy'],function(m){return m;}); -define('aurelia-testing/component-tester',['aurelia-testing/dist/commonjs/component-tester'],function(m){return m;}); -define('aurelia-testing/view-spy',['aurelia-testing/dist/commonjs/view-spy'],function(m){return m;}); -define('aurelia-testing/wait',['aurelia-testing/dist/commonjs/wait'],function(m){return m;}); define('clipboard',['clipboard/dist/clipboard'],function(m){return m;}); define('phaser',['phaser/dist/phaser'],function(m){return m;}); define('text',['text/text'],function(m){return m;}); diff --git a/scripts/vendor-bundle.js.map b/scripts/vendor-bundle.js.map index 9ad3713..6daf8e1 100644 --- a/scripts/vendor-bundle.js.map +++ b/scripts/vendor-bundle.js.map @@ -1 +1 @@ -{"version":3,"sources":["../node_modules/promise-polyfill/dist/polyfill.min.js","../node_modules/requirejs/require.js","../node_modules/aurelia-binding/dist/commonjs/aurelia-binding.js","../node_modules/aurelia-bootstrapper/dist/commonjs/aurelia-bootstrapper.js","../node_modules/aurelia-cli/node_modules/aurelia-dependency-injection/dist/commonjs/aurelia-dependency-injection.js","../node_modules/aurelia-event-aggregator/dist/commonjs/aurelia-event-aggregator.js","../node_modules/aurelia-framework/dist/commonjs/aurelia-framework.js","../node_modules/aurelia-history-browser/src/link-handler.ts","../node_modules/aurelia-history-browser/src/browser-history.ts","../node_modules/aurelia-history-browser/src/aurelia-history-browser.ts","../node_modules/aurelia-history/dist/commonjs/aurelia-history.js","../node_modules/aurelia-loader-default/dist/commonjs/aurelia-loader-default.js","../node_modules/aurelia-loader/dist/commonjs/aurelia-loader.js","../node_modules/aurelia-logging-console/dist/commonjs/aurelia-logging-console.js","../node_modules/aurelia-logging/dist/commonjs/aurelia-logging.js","../node_modules/aurelia-metadata/dist/commonjs/aurelia-metadata.js","../node_modules/aurelia-pal-browser/dist/commonjs/aurelia-pal-browser.js","../node_modules/aurelia-pal/dist/commonjs/aurelia-pal.js","../node_modules/aurelia-path/dist/commonjs/aurelia-path.js","../node_modules/aurelia-polyfills/dist/commonjs/aurelia-polyfills.js","../node_modules/aurelia-route-recognizer/dist/commonjs/aurelia-route-recognizer.js","../node_modules/aurelia-router/src/navigation-instruction.ts","../node_modules/aurelia-router/src/nav-model.ts","../node_modules/aurelia-router/src/util.ts","../node_modules/aurelia-router/src/router-configuration.ts","../node_modules/aurelia-router/src/router.ts","../node_modules/aurelia-router/src/next.ts","../node_modules/aurelia-router/src/pipeline.ts","../node_modules/aurelia-router/src/navigation-commands.ts","../node_modules/aurelia-router/src/navigation-plan.ts","../node_modules/aurelia-router/src/step-build-navigation-plan.ts","../node_modules/aurelia-router/src/utilities-route-loading.ts","../node_modules/aurelia-router/src/route-loader.ts","../node_modules/aurelia-router/src/step-load-route.ts","../node_modules/aurelia-router/src/step-commit-changes.ts","../node_modules/aurelia-router/src/activation-strategy.ts","../node_modules/aurelia-router/src/utilities-activation.ts","../node_modules/aurelia-router/src/step-activation.ts","../node_modules/aurelia-router/src/pipeline-provider.ts","../node_modules/aurelia-router/src/app-router.ts","../node_modules/aurelia-router/src/pipeline-status.ts","../node_modules/aurelia-router/src/router-event.ts","../node_modules/aurelia-router/src/pipeline-slot-name.ts","../node_modules/aurelia-task-queue/dist/commonjs/aurelia-task-queue.js","../node_modules/aurelia-templating-binding/dist/commonjs/aurelia-templating-binding.js","../node_modules/aurelia-templating-resources/dist/commonjs/aurelia-templating-resources.js","../node_modules/aurelia-templating-router/src/router-view.ts","../node_modules/aurelia-templating-router/src/route-loader.ts","../node_modules/aurelia-templating-router/src/route-href.ts","../node_modules/aurelia-templating-router/src/aurelia-templating-router.ts","../node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js","../node_modules/aurelia-testing/dist/commonjs/aurelia-testing.js","../node_modules/aurelia-testing/dist/commonjs/compile-spy.js","../node_modules/aurelia-testing/dist/commonjs/component-tester.js","../node_modules/aurelia-testing/dist/commonjs/view-spy.js","../node_modules/aurelia-testing/dist/commonjs/wait.js","../node_modules/clipboard/dist/clipboard.js","../node_modules/phaser/dist/phaser.js","../node_modules/text/text.js"],"names":["tslib_1.__extends","DOM","PLATFORM","History","RouteRecognizer","Container","LogManager.getLogger","EventAggregator","PipelineStatus","RouterEvent","PipelineSlotName","ViewSlot","Router","ViewLocator","CompositionTransaction","CompositionEngine","Origin","BehaviorInstruction","SwapStrategies","ShadowDOM","createOverrideContext","inlineView","relativeToFile","RouteLoader","customElement","useView","AppRouter"],"mappings":"AAAA;AACA;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjmEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvhLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9qBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IClnBA;KAYC;IANC,8BAAQ,GAAR,UAAS,OAAuB,KAAc;IAK9C,gCAAU,GAAV,eAAyB;IAC3B,kBAAC;CAAA,IAAA;;IAMuCA,sCAAW;IAUjD;QAAA,YACE,iBAAO,SAUR;QARC,KAAI,CAAC,OAAO,GAAG,UAAC,CAAC;YACX,IAAA,uCAAgE,EAA9D,wCAAiB,EAAE,cAA2C,CAAC;YAErE,IAAI,iBAAiB,EAAE;gBACrB,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,KAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;aAC7B;SACF,CAAC;;KACH;IAOD,qCAAQ,GAAR,UAAS,OAAuB;QAC9B,IAAI,OAAO,CAAC,aAAa,EAAE;YACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvBC,cAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;SACnD;KACF;IAKD,uCAAU,GAAV;QACEA,cAAG,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;KACtD;IAOM,+BAAY,GAAnB,UAAoB,KAAY;QAC9B,IAAI,MAAM,GAAG,KAAmB,CAAC;QACjC,IAAI,IAAI,GAAG;YACT,iBAAiB,EAAE,KAAK;YACxB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;SACb,CAAC;QAEF,IAAI,MAAM,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAiB,CAAC,CAAC;QAC5E,IAAI,CAAC,MAAM,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE;YAC7D,OAAO,IAAI,CAAC;SACb;QAED,IAAI,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC;eAC/B,YAAY,CAAC,MAAM,EAAE,eAAe,CAAC;eACrC,YAAY,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAC7C;YACA,OAAO,IAAI,CAAC;SACb;QAED,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE;YACxE,OAAO,IAAI,CAAC;SACb;QAED,IAAI,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,iBAAiB,GAAG,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC;QAC3C,IAAI,UAAU,GAAG,IAAI,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAE/E,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,IAAI,UAAU,CAAC;QACzD,OAAO,IAAI,CAAC;KACb;IAQM,oCAAiB,GAAxB,UAAyB,EAAW;QAClC,OAAO,EAAE,EAAE;YACT,IAAI,EAAE,CAAC,OAAO,KAAK,GAAG,EAAE;gBACtB,OAAO,EAAE,CAAC;aACX;YAED,EAAE,GAAG,EAAE,CAAC,UAAqB,CAAC;SAC/B;KACF;IAQM,qCAAkB,GAAzB,UAA0B,MAAe;QACvC,IAAI,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,GAAG,GAAGC,mBAAQ,CAAC,MAAM,CAAC;QAE1B,OAAO,CAAC,YAAY;YAClB,YAAY,KAAK,GAAG,CAAC,IAAI;YACzB,YAAY,KAAK,OAAO,CAAC;KAC5B;IACH,yBAAC;CAhHD,CAAwC,WAAW,GAgHlD;AAED,IAAM,YAAY,GAAG,UAAC,EAAW,EAAE,IAAY,IAAK,OAAA,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,GAAA,CAAC;;;ICpItCF,kCAAO;IA8BzC,wBAAY,WAAwB;QAApC,YACE,iBAAO,SAQR;QANC,KAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,KAAI,CAAC,iBAAiB,GAAG,KAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;QAEnD,KAAI,CAAC,QAAQ,GAAGE,mBAAQ,CAAC,QAAQ,CAAC;QAClC,KAAI,CAAC,OAAO,GAAGA,mBAAQ,CAAC,OAAO,CAAC;QAChC,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;;KAChC;IAOD,iCAAQ,GAAR,UAAS,OAAgB;QACvB,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;SACxD;QAED,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,cAAc,GAAG,CAAC,CAAE,OAAe,CAAC,SAAS,CAAC;QAElD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,iBAAiB,GAAG,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAG/F,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,GAAG,iBAAiB,CAAC,IAAI,GAAG,GAAG,EAAE,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAE1F,IAAI,eAAe,GAAG,IAAI,CAAC,gBAAgB,GAAG,iBAAiB,CAAC,UAAU,KAAK,KAAK,CAAC;QACrF,IAAI,YAAY,GAAG,IAAI,CAAC,aAAa,GAAG,CAAC,EAAE,iBAAiB,CAAC,SAAS,IAAI,QAAQ,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC;QAG1G,IAAI,SAAiB,CAAC;QACtB,IAAI,YAAY,EAAE;YAChB,SAAS,GAAG,UAAU,CAAC;SACxB;aAAM,IAAI,eAAe,EAAE;YAC1B,SAAS,GAAG,YAAY,CAAC;SAC1B;QAEDA,mBAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAI7D,IAAI,eAAe,IAAI,cAAc,EAAE;YAErC,IAAI,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC9B,IAAI,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,OAAO,CAAC;YAIrE,IAAI,CAAC,YAAY,IAAI,CAAC,MAAM,EAAE;gBAC5B,IAAI,QAAQ,GAAI,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC9D,SAAS,CAAC,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,MAAM,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC;gBAE/D,OAAO,IAAI,CAAC;aAIb;iBAAM,IAAI,YAAY,IAAI,MAAM,IAAI,SAAS,CAAC,IAAI,EAAE;gBACnD,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;gBAC1E,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAED,cAAG,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;aAC7E;SACF;QAED,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;SACvC;QAED,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEhC,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE;YAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;SAC1B;KACF;IAKD,mCAAU,GAAV;QACE,IAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC;QACvCC,mBAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAClDA,mBAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;KAC/B;IAMD,wCAAe,GAAf;QACE,IAAI,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QAClF,OAAO,KAAG,MAAM,GAAG,IAAI,CAAC,IAAM,CAAC;KAChC;IASD,iCAAQ,GAAR,UAAS,QAAiB,EAAE,EAAsC;YAAtC,4BAAsC,EAArC,eAAc,EAAd,mCAAc,EAAE,eAAe,EAAf,oCAAe;QAC1D,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,IAAI,QAAQ,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAC1C,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC;YACzB,OAAO,IAAI,CAAC;SACb;QAED,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,OAAO,KAAK,CAAC;SACd;QAED,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QAE7C,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,OAAO,EAAE;YAC1C,OAAO,KAAK,CAAC;SACd;QAED,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QAG/B,IAAI,QAAQ,KAAK,EAAE,IAAI,GAAG,KAAK,GAAG,EAAE;YAClC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SACxB;QAGD,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,cAAc,GAAG,WAAW,CAAC,CAAC,EAAE,EAAED,cAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;SAC1E;aAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE;YAGhC,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SACzC;aAAM;YAGL,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACtB;QAED,IAAI,OAAO,EAAE;YACX,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SAChC;QAED,OAAO,IAAI,CAAC;KACb;IAKD,qCAAY,GAAZ;QACE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;KACrB;IAKD,iCAAQ,GAAR,UAAS,KAAa;QACpBA,cAAG,CAAC,KAAK,GAAG,KAAK,CAAC;KACnB;IAOD,iCAAQ,GAAR,UAAS,GAAW,EAAE,KAAU;QAC9B,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAA,kBAA0C,EAAxC,sBAAQ,EAAE,kBAAM,EAAE,cAAsB,CAAC;QAC/C,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACnB,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,KAAG,QAAQ,GAAG,MAAM,GAAG,IAAM,CAAC,CAAC;KACnE;IAOD,iCAAQ,GAAR,UAAS,GAAW;QAClB,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAClD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;KACnB;IAMD,wCAAe,GAAf;QACE,IAAI,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QACjD,IAAI,YAAY,KAAK,SAAS,EAAE;YAC9B,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;YACvC,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;SAC7C;QACD,OAAO,YAAY,CAAC;KACrB;IAMD,2BAAE,GAAF,UAAG,QAAgB;QACjB,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;KAC3B;IAKD,iCAAQ,GAAR;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KACrC;IAKD,qCAAY,GAAZ,UAAa,QAAgB,EAAE,cAAwB;QACrD,IAAI,OAAe,CAAC;QAEpB,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,cAAc,EAAE;gBAClE,IAAI,UAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;gBAC7B,QAAQ,GAAG,UAAQ,CAAC,QAAQ,GAAG,UAAQ,CAAC,MAAM,CAAC;gBAC/C,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;gBAC/C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;oBAC9B,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;iBAC5C;aACF;iBAAM;gBACL,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;aAC5B;SACF;QAED,OAAO,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;KAClD;IAOD,kCAAS,GAAT;QACE,IAAI,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACpC,IAAI,OAAO,KAAK,IAAI,CAAC,QAAQ,EAAE;YAC7B,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;SACnB;KACF;IAMD,iCAAQ,GAAR,UAAS,gBAAwB;QAC/B,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;QAEnE,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY;YAC9B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC;YACnC,KAAK,CAAC;KACT;IAjSM,qBAAM,GAAG,CAAC,WAAW,CAAC,CAAC;IAkShC,qBAAC;CAAA,CApSmCE,sBAAO,GAoS1C;AAGD,IAAM,aAAa,GAAG,cAAc,CAAC;AAGrC,IAAM,YAAY,GAAG,YAAY,CAAC;AAGlC,IAAM,aAAa,GAAG,KAAK,CAAC;AAK5B,IAAM,WAAW,GAAG,8BAA8B,CAAC;AAInD,SAAS,UAAU,CAAC,SAAmB,EAAE,QAAgB,EAAE,OAAgB;IACzE,IAAI,OAAO,EAAE;QACX,IAAI,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;QAC5D,SAAS,CAAC,OAAO,CAAC,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC;KAC1C;SAAM;QAEL,SAAS,CAAC,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAC;KACjC;CACF;AAED,SAAS,YAAY,CAAC,QAAgB,EAAE,QAAgB,EAAE,IAAY;IACpE,OAAU,QAAQ,UAAK,QAAQ,IAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,EAAE,CAAE,CAAC;CAC5D;;SCjUe,SAAS,CAAC,MAAc;IAEtC,IAAM,OAAO,GAAG,MAAa,CAAC;IAC9B,OAAO,CAAC,SAAS,CAACA,sBAAO,EAAE,cAAc,CAAC,CAAC;IAC3C,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;CACpD;;;;;;;;;;ACbD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACl1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACleA;;;AAGA;IA4DE,+BAAY,IAA+B;;;;QAT3C,SAAI,GAAwC,IAAI,CAAC;QAEjD,YAAO,GAAwB,EAAE,CAAC;QAQhC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAE1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;QAChC,IAAI,CAAC,oBAAoB,GAAG,EAAE,CAAC;QAE/B,IAAI,cAAc,GAAG,EAAE,CAAC;QACxB,IAAI,OAAO,GAA0B,IAAI,CAAC;QAC1C,GAAG;YACD,IAAI,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACtD,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE;;gBAEnD,OAAO,aAAa,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;aACjD;YAED,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YACtC,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;SACrC,QAAQ,OAAO,EAAE;QAElB,IAAI,SAAS,GAAG,MAAM,CAAC,MAAM,OAAb,MAAM,GAAQ,EAAE,EAAE,IAAI,CAAC,WAAW,SAAK,cAAc,EAAC,CAAC;QACvE,IAAI,CAAC,aAAa,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KACrD;;;;IAKD,kDAAkB,GAAlB;QACE,IAAI,YAAY,GAA4B,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,oBAAoB,GAAwC,IAAI,CAAC,oBAAoB,CAAC;QAE1F,KAAK,IAAI,GAAG,IAAI,oBAAoB,EAAE;YACpC,IAAI,gBAAgB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,0BAA0B,CAAC;YAC5E,IAAI,gBAAgB,EAAE;gBACpB,YAAY,CAAC,IAAI,OAAjB,YAAY,EAAS,gBAAgB,CAAC,kBAAkB,EAAE,EAAE;aAC7D;SACF;QAED,OAAO,YAAY,CAAC;KACrB;;;;;IAMD,0DAA0B,GAA1B;QACE,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,mBAAmB,GAAA,CAAC,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,GAAA,CAAC,CAAC;KACjF;IAOD,sDAAsB,GAAtB,UACE,iBAAmD,EACnD,QAAiC,EACjC,QAAiB,EACjB,SAAe;QAGf,IAAI,mBAAwC,CAAC;QAC7C,IAAI,YAAY,GAAG,OAAO,iBAAiB,KAAK,QAAQ,GAAG,iBAAiB,GAAG,iBAAiB,CAAC,IAAI,CAAC;QACtG,IAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,IAAM,MAAM,GAAgB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC,CAAC;QAEnG,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE;YACzC,mBAAmB,GAAG;gBACpB,IAAI,EAAE,iBAAiB;gBACvB,QAAQ,EAAE,QAAQ;gBAClB,QAAQ,EAAE,QAAQ;gBAClB,SAAS,EAAE,SAAS;gBACpB,WAAW,EAAE,SAAS,CAAC,WAAW;gBAClC,aAAa,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAuB;aAClF,CAAC;SACH;aAAM;YACL,mBAAmB,GAAG;gBACpB,IAAI,EAAE,YAAY;gBAClB,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;gBACpC,SAAS,EAAE,iBAAiB,CAAC,SAAS;gBACtC,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;gBACpC,WAAW,EAAE,iBAAiB,CAAC,SAAS,CAAC,WAAW;gBACpD,aAAa,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAuB;aAClF,CAAC;SACH;QAED,OAAO,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,GAAG,mBAAmB,CAAC;KACtE;;;;IAKD,+CAAe,GAAf;;QAEE,IAAI,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,KAAe,CAAC;QAC9C,IAAI,aAAa,GAAG,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACjD,OAAO,WAAW,CAAC,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;KAC9C;;;;;IAMD,+CAAe,GAAf;QACE,IAAI,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAC1C,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QAC3C,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAEnC,IAAI,WAAW,EAAE;YACf,IAAI,IAAI,GAAG,GAAG,WAAW,CAAC;SAC3B;QAED,OAAO,IAAI,CAAC;KACb;;;;IAKD,0CAAU,GAAV;QAAA,iBA0BC;QAzBC,IAAI,UAAU,GAAG,SAAS,CAAC;QAC3B,IAAI,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAExC,IAAI,QAAQ,KAAK,EAAE,EAAE;YACnB,IAAI,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAA,KAAK;gBAC/C,OAAO,KAAK,CAAC,IAAI,KAAK,KAAI,CAAC,MAAM,CAAC,IAAI;oBACpC,KAAK,CAAC,KAAK,KAAK,EAAE,CAAC;aACtB,CAAC,CAAC;YACH,IAAI,aAAa,EAAE;gBACjB,QAAQ,GAAG,aAAa,CAAC,KAAY,CAAC;aACvC;SACF;QAED,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;SAC7B;QAED,IAAI,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAC1C,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QAE3C,IAAI,CAAC,IAAI,EAAE;YACT,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;SAC7B;QAED,OAAO,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACnE;;;;;IAMD,8CAAc,GAAd,UAAe,UAAmB;QAAlC,iBAwDC;QAvDC,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAEjC,IAAM,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACrD,IAAI,mBAAmB,EAAE;YACvB,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,KAAK,CAAC;SACtD;QAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAE3B,IAAI,KAAK,GAAoB,EAAE,CAAC;QAChC,IAAI,UAAU,GAAgB,EAAE,CAAC;QACjC,IAAI,oBAAoB,GAAwC,IAAI,CAAC,oBAAoB,CAAC;gCAEjF,YAAY;YACnB,IAAI,mBAAmB,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;YAC7D,IAAI,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAE9C,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,oDAAkD,mBAAmB,CAAC,QAAQ,MAAG,CAAC,CAAC;aACpG;YAED,IAAI,mBAAmB,GAAG,mBAAmB,CAAC,0BAA0B,CAAC;YACzE,IAAI,mBAAmB,CAAC,QAAQ,8BAAyC;gBACvE,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,kBAAkB,EAAE;oBACjE,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;iBAC5D;qBAAM;oBACL,IAAI,UAAU,EAAE;wBACd,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,UAAA,EAAE,mBAAmB,qBAAA,EAAE,CAAC,CAAC;qBACpD;oBACD,KAAK,CAAC,IAAI,CACR,QAAQ;yBACL,OAAO,CAAC,mBAAmB,EAAE,UAAU,CAAC;yBACxC,IAAI,CAAC,cAAM,OAAA,mBAAmB;0BAC3B,mBAAmB,CAAC,cAAc,CAAC,UAAU,CAAC;0BAC9C,OAAO,CAAC,OAAO,EAAE,GAAA,CACpB,CACJ,CAAC;iBACH;aACF;iBAAM;gBACL,IAAI,mBAAmB,EAAE;oBACvB,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;iBAC5D;aACF;;QA7BH,KAAK,IAAI,YAAY,IAAI,oBAAoB;oBAApC,YAAY;SA8BpB;QAED,OAAO,OAAO;aACX,GAAG,CAAC,KAAK,CAAC;aACV,IAAI,CAAC;YACJ,UAAU,CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAA,CAAC,CAAC;YAChE,OAAO,IAAI,CAAC;SACb,CAAC;aACD,IAAI,CAAC,cAAM,OAAA,KAAK,CAAC,KAAI,CAAC,GAAA,CAAC,CAAC;KAC5B;;IAGD,4CAAY,GAAZ;QACE,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QACpD,IAAI,KAAK,EAAE;YACT,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAChC;KACF;;IAGD,2CAAW,GAAX,UAAY,SAAyB;QAAzB,0BAAA,EAAA,iBAAyB;QACnC,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,IAAI,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC/C,IAAI,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC;QACpC,IAAI,oBAAoB,GAAwC,IAAI,CAAC,oBAAoB,CAAC;QAE1F,IAAI,aAAa,EAAE;YACjB,KAAK,GAAG,iBAAiB,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;SACzD;QAED,KAAK,IAAI,YAAY,IAAI,oBAAoB,EAAE;YAC7C,IAAI,mBAAmB,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;YAC7D,IAAI,qBAAqB,GAAG,mBAAmB,CAAC,0BAA0B,CAAC;YAE3E,IAAI,qBAAqB,EAAE;gBACzB,IAAI,UAAU,GAAG,qBAAqB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;gBAC9D,IAAI,UAAU,EAAE;oBACd,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;iBAC9B;aACF;SACF;QAED,IAAI,WAAW,CAAC,MAAM,EAAE;YACtB,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,GAAG,SAAS,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;SACxE;QAED,IAAI,iBAAiB,CAAC,KAAK,EAAE;YAC3B,KAAK,IAAI,CAAC,KAAK,GAAG,SAAS,GAAG,EAAE,IAAI,iBAAiB,CAAC,cAAc,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;SAC/F;QAED,OAAO,KAAK,CAAC;KACd;IACH,4BAAC;CAAA,IAAA;AAED,IAAM,KAAK,GAAG,UAAC,WAAkC;IAC/C,WAAW,CAAC,mBAAmB,GAAG,IAAI,CAAC;IACvC,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;CACzB,CAAC;;ACtVF;;;AAGA;IAuCE,kBAAY,MAAc,EAAE,YAAoB;;;;QAlChD,aAAQ,GAAY,KAAK,CAAC;;;;QAK1B,UAAK,GAAW,IAAI,CAAC;;;;QAKrB,SAAI,GAAW,IAAI,CAAC;;;;QAKpB,iBAAY,GAAW,IAAI,CAAC;;;;QAK5B,aAAQ,GAAQ,EAAE,CAAC;;;;QAKnB,WAAM,GAAgB,IAAI,CAAC;QAUzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;KAClC;;;;;;;;IASD,2BAAQ,GAAR,UAAS,KAAa;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;SAC3B;KACF;IACH,eAAC;CAAA;;SC9De,sBAAsB,CAAC,IAAY,EAAE,YAAqB,EAAE,QAAyB;IAAzB,yBAAA,EAAA,gBAAyB;IACnG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACpC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC;KACnB;IAED,IAAI,YAAY,IAAI,QAAQ,EAAE;QAC5B,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;KACvC;IAED,OAAO,IAAI,CAAC;CACb;AAED,SAAgB,iBAAiB,CAAC,QAAgB,EAAE,OAAe,EAAE,YAAqB,EAAE,QAAkB;IAC5G,IAAI,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAChC,OAAO,QAAQ,CAAC;KACjB;IAED,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACxC,IAAI,IAAI,GAAG,CAAC;KACb;IAED,IAAI,IAAI,OAAO,CAAC;IAEhB,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QAC1E,IAAI,IAAI,GAAG,CAAC;KACb;IAED,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACvE,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,sBAAsB,CAAC,IAAI,GAAG,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;CACxE;AAED,SAAgB,WAAW,CAAC,QAAgB,EAAE,OAAe,EAAE,YAAsB;IACnF,IAAI,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAC/B,OAAO,sBAAsB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;KACvD;IAED,OAAO,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;CAC3D;AAED,SAAgB,oCAAoC,CAAC,MAAmB;IACtE,IAAI,YAAY,GAAG,EAAE,CAAC;IAEtB,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YACrD,IAAI,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;YACxC,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAC5B;KACF;SAAM;QACL,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;KAC9C;IAED,OAAO,YAAY,CAAC;CACrB;AAED,IAAM,YAAY,GAAG,OAAO,CAAC;AAC7B,IAAM,aAAa,GAAG,8BAA8B,CAAC;;ACzDrD;;;;;AAKA;IAAA;QACE,iBAAY,GAAoC,EAAE,CAAC;QACnD,YAAO,GAOH,EAAE,CAAC;QACP,kBAAa,GAA2D,EAAE,CAAC;KA4L5E;;;;;;;;IA5KC,6CAAe,GAAf,UAAgB,IAAY,EAAE,IAA6B;QACzD,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE;YACvC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SAC/D;QACD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,MAAA,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;KACb;;;;;;;IAQD,8CAAgB,GAAhB,UAAiB,IAA6B;QAC5C,OAAO,IAAI,CAAC,eAAe,8BAA6B,IAAI,CAAC,CAAC;KAC/D;;;;;;;IAQD,gDAAkB,GAAlB,UAAmB,IAA6B;QAC9C,OAAO,IAAI,CAAC,eAAe,kCAA+B,IAAI,CAAC,CAAC;KACjE;;;;;;;IAQD,8CAAgB,GAAhB,UAAiB,IAA6B;QAC5C,OAAO,IAAI,CAAC,eAAe,8BAA6B,IAAI,CAAC,CAAC;KAC/D;;;;;;;IAQD,+CAAiB,GAAjB,UAAkB,IAA6B;QAC7C,OAAO,IAAI,CAAC,eAAe,gCAA8B,IAAI,CAAC,CAAC;KAChE;;;;;;;IAQD,2CAAa,GAAb,UAAc,QAAgB;QAC5B,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;QAC/B,OAAO,IAAI,CAAC;KACb;;;;;;;IAQD,iCAAG,GAAH,UAAI,KAAkC;QAAtC,iBAOC;QANC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,KAAK,CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;YAChC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;KAC7B;;;;;;;;IASD,iDAAmB,GAAnB,UAAoB,cAAwE;QAC1F,IAAI,CAAC,gBAAgB,GAAG,cAAc,CAAC;QACvC,OAAO,IAAI,CAAC;KACb;;;;;;;IAQD,sCAAQ,GAAR,UAAS,MAAmB;QAC1B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAA,MAAM;YAC3B,IAAI,YAAY,GAAG,oCAAoC,CAAC,MAAM,CAAC,CAAC;YAEhE,IAAI,QAAQ,CAAC;YACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;gBACrD,IAAI,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBAClC,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,IAAI,EAAE,CAAC;gBAClD,IAAI,CAAC,QAAQ,EAAE;oBACb,QAAQ,GAAG,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;iBAC/C;gBAED,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;aACxC;SACF,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;KACb;;;;;;;;IASD,8CAAgB,GAAhB,UAAiB,MAA4B;QAC3C,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC;QACjC,OAAO,IAAI,CAAC;KACb;;;;;;IAOD,4CAAc,GAAd,UAAe,MAAc;QAC3B,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YACrD,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;SACzB;QAEG,IAAA,SAAsF,EAApF,gBAAK,EAAE,kCAAc,EAAE,0CAAkB,EAAE,kCAAc,EAAE,sCAAyB,CAAC;QAE3F,IAAI,KAAK,EAAE;YACT,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;SACtB;QAED,IAAI,cAAc,EAAE;YAClB,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;SACxC;QAED,IAAI,kBAAkB,EAAE;YACtB,MAAM,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;SAChD;QAED,IAAI,cAAc,EAAE;YAClB,MAAM,CAAC,aAAa,GAAG,cAAc,CAAC;SACvC;QAED,IAAI,gBAAgB,EAAE;YACpB,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE5C,IAAI,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACvC,IAAI,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC;QAC7C,IAAI,iBAAiB,EAAE;YACrB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;gBAClB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;aACxE;YAED,IAAI,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;YAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,iBAAiB,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;gBAC/C,IAAA,qBAAiC,EAA/B,gBAAI,EAAE,cAAyB,CAAC;gBACtC,gBAAgB,CAAC,OAAO,CAAC,MAAI,EAAE,IAAI,CAAC,CAAC;aACtC;SACF;KACF;IACH,0BAAC;CAAA;;AC/JD;;;AAGA;;;;;IAoJE,gBAAY,SAAoB,EAAE,OAAgB;QAAlD,iBAIC;;;;QA9CD,WAAM,GAAW,IAAI,CAAC;QAEtB,YAAO,GAAQ,EAAE,CAAC;;;;QAKlB,qBAAgB,GAAwB,EAAE,CAAC;;;;;;QAwB3C,mBAAc,GAA8B,UAAC,KAAa;YACxD,IAAI,KAAI,CAAC,MAAM,EAAE;gBACf,OAAO,KAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;aAC1C;YACD,OAAO,KAAK,CAAC;SACd,CAAA;QAOC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,EAAE,CAAC;KACd;;;;;IAMD,sBAAK,GAAL;QAAA,iBAuBC;QAtBC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;QAClC,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC;QACtC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACjC,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACjC,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC;QAC1B,IAAI,CAAC,WAAW,GAAG,IAAIC,sCAAe,EAAE,CAAC;QACzC,IAAI,CAAC,gBAAgB,GAAG,IAAIA,sCAAe,EAAE,CAAC;QAC9C,IAAI,CAAC,kBAAkB,GAAG,IAAI,OAAO,CAAC,UAAA,OAAO;YAC3C,KAAI,CAAC,yBAAyB,GAAG,OAAO,CAAC;SAC1C,CAAC,CAAC;KACJ;IAKD,sBAAI,0BAAM;;;;aAAV;YACE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;SACrB;;;OAAA;;;;;;;IAQD,iCAAgB,GAAhB,UAAiB,QAAyB,EAAE,IAAa;QACvD,IAAI,GAAG,IAAI,IAAI,SAAS,CAAC;QACzB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;KACjC;;;;IAKD,iCAAgB,GAAhB;QACE,OAAO,IAAI,CAAC,kBAAkB,CAAC;KAChC;;;;;;IAOD,0BAAS,GAAT,UAAU,gBAA8F;QAAxG,iBAqBC;QApBC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAEzB,IAAI,MAAM,GAAkC,gBAAuC,CAAC;QACpF,IAAI,MAA2B,CAAC;QAChC,IAAI,OAAO,gBAAgB,KAAK,UAAU,EAAE;YAC1C,MAAM,GAAG,IAAI,mBAAmB,EAAE,CAAC;YACnC,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;SACnC;QAED,OAAO,OAAO;aACX,OAAO,CAAC,MAAM,CAAC;aACf,IAAI,CAAC,UAAC,CAAC;YACN,IAAI,CAAC,IAAK,CAAyB,CAAC,cAAc,EAAE;gBAClD,MAAM,GAAG,CAAC,CAAC;aACZ;YAED,MAAM,CAAC,cAAc,CAAC,KAAI,CAAC,CAAC;YAC5B,KAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,KAAI,CAAC,yBAAyB,EAAE,CAAC;SAClC,CAAC,CAAC;KACN;;;;;;;IAQD,yBAAQ,GAAR,UAAS,QAAgB,EAAE,OAA2B;QACpD,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,MAAM,EAAE;YACrC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SAChD;QAED,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC,CAAC;KACxG;;;;;;;;;IAUD,gCAAe,GAAf,UAAgB,KAAa,EAAE,MAAY,EAAE,OAA2B;QACtE,IAAI,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACrC;;;;IAKD,6BAAY,GAAZ;QACE,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;KAC7B;;;;;;;IAQD,4BAAW,GAAX,UAAY,SAAqB;QAC/B,IAAI,WAAW,GAAG,IAAI,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtF,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC;QAC1B,OAAO,WAAW,CAAC;KACpB;;;;;;;;;IAUD,yBAAQ,GAAR,UAAS,WAAiC,EAAE,MAAgB,EAAE,OAAiB;QAAnC,uBAAA,EAAA,WAAgB;QAAE,wBAAA,EAAA,YAAiB;;;;QAI7E,IAAI,UAAU,GAAG,YAAY,IAAI,MAAM,GAAG,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC;QACnF,IAAI,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,WAAoC,CAAC,CAAC;QACzE,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,IAAI,CAAC,MAAM,EAAE;gBACf,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;aAC3D;YACD,MAAM,IAAI,KAAK,CAAC,wBAAsB,WAAW,iDAA6C,WAAW,4CAA0C,CAAC,CAAC;SACtJ;QACD,IAAI,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,WAAoC,EAAE,MAAM,CAAC,CAAC;QAC7E,IAAI,UAAU,GAAG,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QACrG,OAAO,OAAO,CAAC,QAAQ,GAAG,KAAG,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,UAAY,GAAG,UAAU,CAAC;KACzF;;;;;;IAOD,+BAAc,GAAd,UAAe,MAAmB;QAChC,IAAI,QAAQ,GAAG,IAAI,QAAQ,CACzB,IAAI,EACJ,MAAM,IAAI,MAAM;cACZ,MAAM,CAAC,IAAI;;cAEX,MAAM,CAAC,KAAe,CAAC,CAAC;QAC9B,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC9B,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC;QAC5B,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QAC5B,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACpC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;QAEzB,OAAO,QAAQ,CAAC;KACjB;;;;;;;IAQD,yBAAQ,GAAR,UAAS,MAAmB,EAAE,QAAmB;QAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YAC/B,IAAI,YAAY,GAAG,oCAAoC,CAAC,MAAM,CAAC,CAAC;;YAEhE,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAC/C,OAAO;SACR;QAED,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAE5B,IAAI,EAAE,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE;YAC1D,MAAM,CAAC,SAAS,GAAG;gBACjB,SAAS,EAAE;oBACT,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,IAAI,EAAE,MAAM,CAAC,IAAI;iBAClB;aACF,CAAC;SACH;QAED,IAAI,CAAC,QAAQ,EAAE;YACb,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;SACxC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEzB,IAAI,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC;QACxB,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YAC1B,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACvB;QACD,IAAI,aAAa,GAAG,MAAM,CAAC,aAAa,KAAK,IAAI,CAAC;QAClD,IAAI,KAAK,GAAU,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;YACtC,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,MAAsB;YAC/B,aAAa,EAAE,aAAa;SACR,CAAC,CAAC;QAExB,IAAI,IAAI,EAAE;YACR,IAAI,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;YAC/B,OAAO,MAAM,CAAC,QAAQ,CAAC;YACvB,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;YACnD,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC3B,SAAS,CAAC,KAAK,GAAM,IAAI,iBAAc,CAAC;YACxC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC;YAChC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC;gBACxB,IAAI,EAAE,SAAS,CAAC,KAAK;gBACrB,OAAO,EAAE,SAAS;gBAClB,aAAa,EAAE,aAAa;aAC7B,CAAC,CAAC;YAEH,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC9B,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;YACrC,SAAS,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;SAC1D;QAED,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAE3B,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAEjC,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,KAAK,CAAC,KAAK,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;YACnF,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBAC3F,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,MAAM,CAAC,KAAK,GAAG,oFAAoF,CAAC,CAAC;aACrJ;YAED,IAAI,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,EAAE;gBACtC,QAAQ,CAAC,KAAK,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC;aACxC;YAED,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;;;;;;;;YAQ1B,UAAU,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAK,CAAC,CAAC,KAAK,GAAQ,CAAC,CAAC,KAAK,GAAA,CAAC,CAAC;SACxD;KACF;;;;;;IAOD,yBAAQ,GAAR,UAAS,IAAY;QACnB,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;KACzF;;;;;;IAOD,4BAAW,GAAX,UAAY,IAAY;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KACxC;;;;;;IAOD,oCAAmB,GAAnB,UAAoB,MAA6B;QAAjD,iBAaC;QAZC,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;SAClD;QAED,IAAI,CAAC,eAAe,GAAG,UAAA,WAAW;YAChC,OAAO,KAAI;iBACR,kBAAkB,CAAC,MAAM,EAAE,WAAW,CAAC;iBACvC,IAAI,CAAC,UAAA,CAAC;gBACL,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;gBACvB,OAAO,WAAW,CAAC;aACpB,CAAC,CAAC;SACN,CAAC;KACH;;;;IAKD,4BAAW,GAAX;QACE,IAAI,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;QAC/B,IAAI,YAAY,EAAE;YAChB,OAAO,YAAY,CAAC,WAAW,EAAE,CAAC;SACnC;QAED,IAAI,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACjD,IAAI,kBAAkB,EAAE;YACtB,kBAAkB,CAAC,YAAY,EAAE,CAAC;SACnC;QACD,OAAO,SAAS,CAAC;KAClB;;;;;IAMD,kCAAiB,GAAjB;QACE,IAAI,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC;QAE1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,QAAM,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,QAAM,EAAE,CAAC,EAAE,EAAE;YACpD,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YACrB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE;gBACxB,OAAO,CAAC,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;aAClG;iBAAM;gBACL,OAAO,CAAC,IAAI,GAAG,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;aACxF;SACF;KACF;;;;;;IAOD,oCAAmB,GAAnB,UAAoB,iBAAsC;;QAExD,IAAI,gBAAgB,GAAwC,iBAAiB,CAAC;QAC9E,KAAK,IAAI,YAAY,IAAI,gBAAgB,EAAE;YACzC,IAAI,cAAc,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;YACpD,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,GAAG;gBACpC,QAAQ,EAAE,cAAc,CAAC,QAAQ;aAClC,CAAC;SACH;KACF;;IAGD,gCAAe,GAAf;QACE,IAAI,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;QAC/B,IAAI,YAAY,EAAE;YAChB,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC,YAAY,EAAE,YAAY,CAAC,kBAAkB,CAAC,CAAC;SAC/E;KACF;;IAGD,6CAA4B,GAA5B,UAA6B,GAAgB,EAAE,iBAA+C;QAAjE,oBAAA,EAAA,QAAgB;QAAE,kCAAA,EAAA,wBAA+C;QAC5F,IAAI,QAAQ,GAAG,GAAG,CAAC;QACnB,IAAI,WAAW,GAAG,EAAE,CAAC;QAErB,IAAI,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE;YACrB,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;YACrC,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;SAC1C;QAED,IAAI,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAA+B,CAAC;QAC5F,IAAI,CAAC,uBAAuB,IAAI,CAAC,uBAAuB,CAAC,MAAM,EAAE;YAC/D,uBAAuB,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAA+B,CAAC;SAC9F;QAED,IAAI,eAAe,GAA8B;YAC/C,QAAQ,UAAA;YACR,WAAW,aAAA;YACX,MAAM,EAAE,IAAI;YACZ,iBAAiB,mBAAA;YACjB,mBAAmB,EAAE,IAAI,CAAC,kBAAkB;YAC5C,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,kBAAkB,EAAE,IAAI,CAAC,OAAO,CAAC,kBAAkB;aACpD;SACF,CAAC;QAEF,IAAI,MAAsC,CAAC;QAE3C,IAAI,uBAAuB,IAAI,uBAAuB,CAAC,MAAM,EAAE;YAC7D,IAAI,KAAK,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC;YACvC,IAAI,WAAW,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,eAAe,EAAE;gBAC7E,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,uBAAuB,CAAC,WAAW;gBACrE,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO;aACtC,CAAC,CAAC,CAAC;YAEJ,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,UAAU,EAAE;gBACvC,MAAM,GAAG,0BAA0B,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;aACxE;iBAAM,IAAI,KAAK,CAAC,OAAO,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,kBAAkB,KAAK,UAAU,EAAE;gBAClF,MAAM,GAAG,0BAA0B,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,kBAAkB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;aACnG;iBAAM;gBACL,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;aACvC;SACF;aAAM,IAAI,IAAI,CAAC,eAAe,EAAE;YAC/B,IAAI,WAAW,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,eAAe,EAAE;gBAC7E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC1B,WAAW,EAAE,uBAAuB,GAAG,uBAAuB,CAAC,WAAW,GAAG,EAAE;gBAC/E,MAAM,EAAE,IAAI;aACb,CAAC,CAAC,CAAC;YAEJ,MAAM,GAAG,0BAA0B,CAAC,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;SACxE;aAAM,IAAI,IAAI,CAAC,MAAM,EAAE;YACtB,IAAI,MAAM,GAAG,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAEtD,IAAI,MAAM,EAAE;gBACV,IAAI,oBAAoB,GAAG,IAAI,CAAC,gCAAgC,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;gBAE5F,IAAI,WAAW,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,eAAe,EAAE;oBAC7E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC1B,WAAW,EAAE,uBAAuB,GAAG,uBAAuB,CAAC,WAAW,GAAG,EAAE;oBAC/E,MAAM,EAAE,MAAM;oBACd,iBAAiB,EAAE,oBAAoB;oBACvC,kBAAkB,EAAE,IAAI;oBACxB,MAAM,EAAE,IAAI;iBACb,CAAC,CAAC,CAAC;gBAEJ,MAAM,GAAG,0BAA0B,CAAC,WAAW,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;aAC1E;SACF;QAED,IAAI,MAAM,IAAI,iBAAiB,EAAE;YAC/B,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;SAChE;QAED,OAAO,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,sBAAoB,GAAK,CAAC,CAAC,CAAC;KACvE;;IAGD,iDAAgC,GAAhC,UAAiC,MAAc,EAAE,WAAkC;QACjF,IAAI,WAAW,CAAC,MAAM,KAAK,MAAM,EAAE;YACjC,WAAW,CAAC,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC;YACtC,OAAO,WAAW,CAAC;SACpB;aAAM,IAAI,WAAW,CAAC,iBAAiB,EAAE;YACxC,OAAO,IAAI,CAAC,gCAAgC,CAAC,MAAM,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;SACrF;QACD,OAAO,SAAS,CAAC;KAClB;;IAGD,uCAAsB,GAAtB,UAAuB,MAAc;QACnC,IAAI,MAAM,CAAC,eAAe,EAAE;YAC1B,OAAO,MAAM,CAAC;SACf;aAAM,IAAI,MAAM,CAAC,MAAM,EAAE;YACxB,OAAO,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SACnD;QACD,OAAO,KAAK,CAAC;KACd;;;;IAKD,mCAAkB,GAAlB,UAAmB,MAA4B,EAAE,WAAkC;QAAnF,iBA0BC;QAzBC,OAAO,OAAO;aACX,OAAO,CAAC,MAAM,CAAC;aACf,IAAI,CAAC,UAAC,CAAM;YACX,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;gBACzB,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAiB,CAAC;aACvC;iBAAM,IAAI,OAAO,CAAC,KAAK,UAAU,EAAE;gBAClC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;aACvB;YAED,OAAO,CAAC,CAAC;SACV,CAAC;;;;aAID,IAAI,CAAC,UAAC,CAAuB,IAAK,OAAA,OAAO,CAAC,KAAK,QAAQ,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAiB,GAAG,CAAC,GAAA,CAAC;aAC7F,IAAI,CAAC,UAAC,CAAc;YACnB,CAAC,CAAC,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;YAClC,mBAAmB,CAAC,CAAC,CAAC,CAAC;YAEvB,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE;gBACf,CAAC,CAAC,QAAQ,GAAG,KAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;aACrC;YAED,OAAO,CAAC,CAAC;SACV,CAAC,CAAC;KACN;IACH,aAAC;CAAA,IAAA;AAED;AACA,AAAO,IAAM,eAAe,GAAG,UAAC,MAAc,EAAE,WAAkC;IAChF,OAAO,MAAG,MAAM,CAAC,OAAO,IAAI,EAAE,KAAG,WAAW,CAAC,UAAU,EAAE,IAAI,EAAE,CAAE,CAAC;CACnE,CAAC;;AAGF,AAAO,IAAM,mBAAmB,GAAG,UAAC,MAAmB;IACrD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KACzC;IAED,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE;QACpC,IAAI,MAAI,GAAG,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,MAAI,GAAG,yCAAyC,CAAC,CAAC;KAClG;IAED,IAAI,EAAE,UAAU,IAAI,MAAM,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,kBAAkB,IAAI,MAAM,CAAC,SAAS,CAAC,EAAE;QAC/F,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,MAAM,CAAC,KAAK,GAAG,yFAAyF,CAAC,CAAC;KAC1J;CACF,CAAC;;AAGF,AAAO,IAAM,0BAA0B,GAAG,UACxC,WAAkC,EAClC,SAAmB,EACnB,OAAa;IAEb,OAAO,OAAO;SACX,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;SAC7C,IAAI,CAAC;QACJ,IAAI,EAAE,WAAW,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;YACxC,WAAW,CAAC,MAAM,CAAC,SAAS,GAAG;gBAC7B,SAAS,EAAE;oBACT,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ;iBACtC;aACF,CAAC;SACH;QAED,OAAO,WAAW,CAAC;KACpB,CAAC,CAAC;CACN,CAAC;;AC3tBF;AACA,AAAO,IAAM,YAAY,GAAG,UAAC,WAAkC,EAAE,KAA2B;IAC1F,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;IACf,IAAM,IAAI,GAAS;QACjB,KAAK,EAAE,CAAC;QAER,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE;YACxB,IAAI,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;YAE/B,IAAI;gBACF,OAAO,WAAW,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;aACvC;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;aACvB;SACF;aAAM;YACL,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;SACxB;KACM,CAAC;IAEV,IAAI,CAAC,QAAQ,GAAG,uBAAuB,CAAC,IAAI,8BAA2B,CAAC;IACxE,IAAI,CAAC,MAAM,GAAG,uBAAuB,CAAC,IAAI,4BAA0B,CAAC;IACrE,IAAI,CAAC,MAAM,GAAG,uBAAuB,CAAC,IAAI,4BAA0B,CAAC;IAErE,OAAO,IAAI,CAAC;CACb,CAAC;;AAGF,AAAO,IAAM,uBAAuB,GAAG,UAAC,IAAU,EAAE,MAAsB;IACxE,OAAO,UAAC,MAAW,IAAK,OAAA,OAAO;SAC5B,OAAO,CAAC;QACP,MAAM,QAAA;QACN,MAAM,QAAA;QACN,SAAS,EAAE,MAAM;KAClB,CAAC,GAAA,CAAC;CACN,CAAC;;AClCF;;;AAGA;IAAA;;;;;QAKE,UAAK,GAAyB,EAAE,CAAC;KAuClC;;;;;;IAhCC,0BAAO,GAAP,UAAQ,IAAuD;QAC7D,IAAI,GAAG,CAAC;QAER,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;YAC9B,GAAG,GAAG,IAAI,CAAC;SACZ;aAAM,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,UAAU,EAAE;;;YAG9C,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBAC5C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aACxB;YAED,OAAO,IAAI,CAAC;SACb;aAAM;YACL,GAAG,GAAI,IAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC7C;QAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;KACb;;;;;;IAOD,sBAAG,GAAH,UAAI,WAAkC;QACpC,IAAM,MAAM,GAAG,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACrD,OAAO,MAAM,EAAE,CAAC;KACjB;IACH,eAAC;CAAA;;AC5BD;;;;;;AAMA,SAAgB,mBAAmB,CAAC,GAAQ;IAC1C,OAAO,GAAG,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,UAAU,CAAC;CAClD;;;;AAKD;;;;;IAcE,kBAAY,GAAW,EAAE,OAA+B;QAA/B,wBAAA,EAAA,YAA+B;QACtD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC;KACvC;;;;;;IAOD,4BAAS,GAAT,UAAU,MAAc;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;KACtB;;;;;;IAOD,2BAAQ,GAAR,UAAS,SAAiB;QACxB,IAAI,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,SAAS,IAAI,IAAI,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC;QAC1F,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;KACnD;IACH,eAAC;CAAA,IAAA;AAED;;;AAGA;;;;;;IAkBE,yBAAY,KAAa,EAAE,MAAgB,EAAE,OAA+B;QAAjD,uBAAA,EAAA,WAAgB;QAAE,wBAAA,EAAA,YAA+B;QAC1E,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC;KACvC;;;;;;IAOD,mCAAS,GAAT,UAAU,MAAc;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;KACtB;;;;;;IAOD,kCAAQ,GAAR,UAAS,SAAiB;QACxB,IAAI,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,SAAS,IAAI,IAAI,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC;QAC1F,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;KACzE;IACH,sBAAC;CAAA;;ACnHD;;;AAGA,SAAgB,oBAAoB,CAClC,WAAkC,EAClC,qBAA+B;IAE/B,IAAI,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAEhC,IAAI,UAAU,IAAI,MAAM,EAAE;QACxB,OAAO,iBAAiB,CAAC,WAAW,CAAC,CAAC;KACvC;IAED,IAAM,eAAe,GAAG,WAAW,CAAC,mBAAmB,CAAC;IACxD,IAAM,sBAAsB,GAAG,WAAW,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAEnE,IAAI,eAAe,EAAE;QACnB,OAAO,oBAAoB,CAAC,WAAW,EAAE,eAAe,EAAE,sBAAsB,EAAE,qBAAqB,CAAC,CAAC;KAC1G;;IAGD,IAAM,aAAa,GAAwB,EAAE,CAAC;IAC9C,IAAI,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC;IACvC,KAAK,IAAI,YAAY,IAAI,eAAe,EAAE;QACxC,IAAI,cAAc,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;QACnD,IAAI,cAAc,CAAC,QAAQ,KAAK,IAAI,IAAI,YAAY,IAAI,sBAAsB,EAAE;YAC9E,cAAc,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC;SACvD;QACD,aAAa,CAAC,YAAY,CAAC,GAAG;YAC5B,IAAI,EAAE,YAAY;YAClB,QAAQ;YACR,MAAM,EAAE,cAAc;SACvB,CAAC;KACH;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACvC;;;;;AAMD,AAAO,IAAM,iBAAiB,GAAG,UAAC,WAAkC;IAClE,IAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAClC,IAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAClC,OAAO,MAAM;SACV,4BAA4B,CAAC,MAAM,CAAC,QAAQ,CAAC;SAC7C,IAAI,CAAC,UAAA,mBAAmB;QAEvB,IAAM,MAAM,GAAwB,EAAE,CAAC;QACvC,IAAM,yBAAyB,GAAG,WAAW,CAAC,MAAM,CAAC;QACrD,IAAM,yBAAyB,GAAG,mBAAmB,CAAC,MAAM,CAAC;QAE7D,KAAK,IAAI,GAAG,IAAI,yBAAyB,EAAE;;YAEzC,IAAI,GAAG,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;YACzC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;gBAC7C,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;;gBAEnB,IAAI,GAAG,IAAI,yBAAyB,EAAE;oBACpC,MAAM,CAAC,GAAG,CAAC,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;iBAC9C;aACF;iBAAM;gBACL,MAAM,CAAC,GAAG,CAAC,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;aAC9C;SACF;QACD,IAAI,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;;QAGhG,KAAK,IAAI,GAAG,IAAI,yBAAyB,EAAE;YACzC,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAI,GAAK,EAAE,yBAAyB,CAAC,GAAG,CAAC,CAAC,CAAC;SACxF;QAED,IAAI,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;QAC1C,IAAI,WAAW,EAAE;YACf,gBAAgB,IAAI,GAAG,GAAG,WAAW,CAAC;SACvC;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC;KACxD,CAAC,CAAC;CACN,CAAC;;;;;AAMF,AAAO,IAAM,oBAAoB,GAAG,UAClC,kBAAyC,EACzC,mBAA0C,EAC1C,sBAA2D,EAC3D,qBAA+B;IAG/B,IAAI,aAAa,GAAwB,EAAE,CAAC;IAC5C,IAAI,oBAAoB,GAAG,kBAAkB,CAAC,MAAM,CAAC;IACrD,IAAI,YAAY,GAAG,2BAA2B,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;IACxF,IAAI,OAAO,GAAoB,EAAE,CAAC;IAClC,IAAI,4BAA4B,GAAG,mBAAmB,CAAC,oBAA2D,CAAC;4BAE1G,YAAY;QAEnB,IAAM,uBAAuB,GAAG,4BAA4B,CAAC,YAAY,CAAC,CAAC;QAC3E,IAAM,qBAAqB,GAAG,uBAAuB,CAAC,SAAS,CAAC;QAChE,IAAM,6BAA6B,GAAG,oBAAoB,CAAC,SAAwC,CAAC;;;QAIpG,IAAI,kBAAkB,GAAG,YAAY,IAAI,6BAA6B;cAClE,6BAA6B,CAAC,YAAY,CAAC;cAC3C,uBAAuB,CAAC;QAE5B,IAAI,kBAAkB,CAAC,QAAQ,KAAK,IAAI,IAAI,YAAY,IAAI,sBAAsB,EAAE;YAClF,kBAAkB,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC;SAC3D;QAED,IAAM,0BAA0B,GAAG,2BAA2B,CAC5D,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,CACtB,CAAC;QACF,IAAM,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG;YACjD,IAAI,EAAE,YAAY;;YAElB,MAAM,EAAE,kBAAiC;YACzC,aAAa,EAAE,qBAAqB;YACpC,YAAY,EAAE,uBAAuB,CAAC,QAAQ;YAC9C,QAAQ,EAAE,0BAA0B;SACrB,CAAC;;;;QAKlB,IAAI,0BAA0B,gCAA2C,uBAAuB,CAAC,WAAW,EAAE;YAC5G,IAAM,IAAI,GAAG,kBAAkB,CAAC,eAAe,EAAE,CAAC;YAClD,IAAM,IAAI,GAAkB,uBAAuB;iBAChD,WAAW;iBACX,4BAA4B,CAAC,IAAI,EAAE,kBAAkB,CAAC;iBACtD,IAAI,CAAC,UAAC,gBAAuC;gBAC5C,YAAY,CAAC,0BAA0B,GAAG,gBAAgB,CAAC;gBAE3D,OAAO,oBAAoB,CACzB,gBAAgB;;;;gBAIhB,YAAY,CAAC,QAAQ,8CACtB;qBACE,IAAI,CAAC,UAAA,SAAS;oBACb,IAAI,SAAS,YAAY,QAAQ,EAAE;wBACjC,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;qBAClC;oBACD,gBAAgB,CAAC,IAAI,GAAG,SAAS,CAAC;;oBAElC,OAAO,IAAI,CAAC;iBACb,CAAC,CAAC;aACN,CAAC,CAAC;YAEL,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACpB;;IA7DH,KAAK,IAAI,YAAY,IAAI,4BAA4B;gBAA5C,YAAY;KA8DpB;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,cAAM,OAAA,aAAa,GAAA,CAAC,CAAC;CACvD,CAAC;;;;;AAMF,AAAO,IAAM,2BAA2B,GAAG,UACzC,qBAA4C,EAC5C,uBAA4C,EAC5C,iBAAoD;;AAEpD,YAAqB,EACrB,qBAA+B;IAG/B,IAAI,oBAAoB,GAAG,qBAAqB,CAAC,MAAM,CAAC;IACxD,IAAI,qBAAqB,GAAG,uBAAuB,CAAC,SAAS,CAAC,SAAS,CAAC;IACxE,IAAI,oBAA4C,CAAC;IAEjD,IAAI,uBAAuB,CAAC,QAAQ,KAAK,iBAAiB,CAAC,QAAQ,EAAE;QACnE,oBAAoB,2BAAsC;KAC3D;SAAM,IAAI,6BAA6B,IAAI,qBAAqB,EAAE;QACjE,oBAAoB,GAAG,qBAAqB,CAAC,2BAA2B,OAAjD,qBAAqB,EAAgC,qBAAqB,CAAC,aAAa,CAAC,CAAC;KAClH;SAAM,IAAI,oBAAoB,CAAC,kBAAkB,EAAE;QAClD,oBAAoB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC;KAChE;SAAM,IAAI,YAAY,IAAI,qBAAqB,EAAE;QAChD,oBAAoB,4CAA8C;KACnE;SAAM;QACL,oBAAoB,8BAAuC;KAC5D;IACD,OAAO,oBAAoB,CAAC;CAC7B,CAAC;;AAGF,AAAO,IAAM,2BAA2B,GAAG,UAAC,IAA2B,EAAE,IAA2B;IAClG,IAAI,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC7B,IAAI,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC7B,IAAI,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC;IAElF,KAAK,IAAI,GAAG,IAAI,UAAU,EAAE;QAC1B,IAAI,GAAG,KAAK,gBAAgB,EAAE;YAC5B,SAAS;SACV;QAED,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,UAAU,CAAC,GAAG,CAAC,EAAE;YACvC,OAAO,IAAI,CAAC;SACb;KACF;IAED,KAAK,IAAI,GAAG,IAAI,UAAU,EAAE;QAC1B,IAAI,GAAG,KAAK,gBAAgB,EAAE;YAC5B,SAAS;SACV;QAED,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,UAAU,CAAC,GAAG,CAAC,EAAE;YACvC,OAAO,IAAI,CAAC;SACb;KACF;IAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE;QACpC,OAAO,KAAK,CAAC;KACd;IAED,IAAI,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC;IACvC,IAAI,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC;IACvC,KAAK,IAAI,GAAG,IAAI,eAAe,EAAE;QAC/B,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,eAAe,CAAC,GAAG,CAAC,EAAE;YACjD,OAAO,IAAI,CAAC;SACb;KACF;IAED,KAAK,IAAI,GAAG,IAAI,eAAe,EAAE;QAC/B,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,eAAe,CAAC,GAAG,CAAC,EAAE;YACjD,OAAO,IAAI,CAAC;SACb;KACF;IAED,OAAO,KAAK,CAAC;CACd,CAAC;;ACpPF;;;;AAIA;IAAA;KAYC;IAXC,qCAAG,GAAH,UAAI,qBAA4C,EAAE,IAAU;QAC1D,OAAO,oBAAoB,CAAC,qBAAqB,CAAC;aAC/C,IAAI,CAAC,UAAA,IAAI;YACR,IAAI,IAAI,YAAY,QAAQ,EAAE;gBAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aAC1B;YACD,qBAAqB,CAAC,IAAI,GAAG,IAAI,CAAC;YAClC,OAAO,IAAI,EAAE,CAAC;SACf,CAAC;aACD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACvB;IACH,8BAAC;CAAA;;ACND;;;AAGA,AAAO,IAAM,YAAY,GAAG,UAC1B,WAAwB,EACxB,qBAA4C;IAE5C,IAAI,YAAY,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,CAAC;IAChE,IAAI,YAAY,GAAG,YAAY,CAAC,GAAG,CAAC,UAAC,WAAyB,IAAK,OAAA,SAAS,CAC1E,WAAW,EACX,WAAW,CAAC,qBAAqB,EACjC,WAAW,CAAC,YAAY,CACzB,GAAA,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;CAClC,CAAC;;;;AAKF,AAAO,IAAM,qBAAqB,GAAG,UACnC,qBAA4C,EAC5C,YAAiC;IAAjC,6BAAA,EAAA,iBAAiC;IAEjC,IAAI,aAAa,GAAiC,qBAAqB,CAAC,IAAI,CAAC;IAE7E,KAAK,IAAI,YAAY,IAAI,aAAa,EAAE;QACtC,IAAI,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAI,mBAAmB,GAAG,YAAY,CAAC,0BAA0B,CAAC;QAElE,IAAI,YAAY,CAAC,QAAQ,8BAAyC;YAChE,YAAY,CAAC,IAAI,CAAC,EAAE,YAAY,cAAA,EAAE,qBAAqB,uBAAA,EAAkB,CAAC,CAAC;YAE3E,IAAI,mBAAmB,EAAE;gBACvB,qBAAqB,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;aAC1D;SACF;aAAM;YACL,IAAI,mBAAmB,GAAG,qBAAqB,CAAC,sBAAsB,CAAC;gBACrE,IAAI,EAAE,YAAY;gBAClB,QAAQ,EAAE,YAAY,CAAC,QAAQ;gBAC/B,QAAQ,EAAE,YAAY,CAAC,YAAY;gBACnC,SAAS,EAAE,YAAY,CAAC,aAAa;aACtC,CAAwB,CAAC;YAE1B,IAAI,mBAAmB,EAAE;gBACvB,mBAAmB,CAAC,0BAA0B,GAAG,mBAAmB,CAAC;gBACrE,qBAAqB,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;aAC1D;SACF;KACF;IAED,OAAO,YAAY,CAAC;CACrB,CAAC;;;;AAKF,AAAO,IAAM,SAAS,GAAG,UACvB,WAAwB,EACxB,qBAA4C,EAC5C,YAA0B;IAE1B,IAAI,UAAU,GAAG,YAAY,CAAC,MAAM,CAAC;IACrC,IAAI,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC;IAEvD,OAAO,aAAa,CAAC,WAAW,EAAE,qBAAqB,EAAE,UAAU,CAAC;SACjE,IAAI,CAAC,UAAC,SAAS;QACd,IAAI,mBAAmB,GAAG,qBAAqB,CAAC,sBAAsB,CAAC;YACrE,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,QAAQ,EAAE,YAAY,CAAC,QAAQ;YAC/B,QAAQ,EAAE,QAAQ;YAClB,SAAS,EAAE,SAAS;SACrB,CAAwB,CAAC;QAE1B,IAAI,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QACxC,IAAI,WAAW,EAAE;YACf,IAAI,IAAI,GAAG,qBAAqB,CAAC,eAAe,EAAE,CAAC;YAEnD,OAAO,WAAW;iBACf,4BAA4B,CAAC,IAAI,EAAE,qBAAqB,CAAC;iBACzD,IAAI,CAAC,UAAC,gBAAgB;gBACrB,YAAY,CAAC,0BAA0B,GAAG,gBAAgB,CAAC;gBAE3D,OAAO,oBAAoB,CAAC,gBAAgB,CAAC;qBAC1C,IAAI,CAAC,UAAC,SAAS;oBACd,IAAI,SAAS,YAAY,QAAQ,EAAE;wBACjC,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;qBAClC;oBACD,gBAAgB,CAAC,IAAI,GAAG,SAAS,CAAC;oBAClC,mBAAmB,CAAC,0BAA0B,GAAG,gBAAgB,CAAC;oBAElE,OAAO,YAAY,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;iBACpD,CAAC,CAAC;aACN,CAAC,CAAC;SACN;;QAED,OAAO,KAAK,CAAC,CAAC;KACf,CAAC,CAAC;CACN,CAAC;;;;;AAMF,AAAO,IAAM,aAAa,GAAG,UAC3B,WAAwB,EACxB,qBAA4C,EAC5C,MAAmB;IAEnB,IAAI,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC;IAC1C,IAAI,aAAa,GAAG,qBAAqB,CAAC,aAAa,CAAC;IAExD,OAAO,OAAO,CAAC,OAAO,EAAE;SACrB,IAAI,CAAC,cAAM,OAAA,WAAW,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,qBAAqB,CAAC,GAAA,CAAC;SACxE,IAAI;;;;;IAKH,UAAC,SAA4B;QACrB,IAAA,+BAAS,EAAE,yCAAc,CAAe;QAC9C,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC;QAC1B,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC;QAE1B,IAAI,iBAAiB,IAAI,SAAS,EAAE;YAClC,IAAI,aAAW,GAAG,cAAc,CAAC,cAAc,EAAE,CAAC;YAClD,SAAS,CAAC,WAAW,GAAG,aAAW,CAAC;YAEpC,OAAO,aAAW;iBACf,SAAS,CAAC,UAAA,CAAC,IAAI,OAAA,SAAS,CAAC,eAAe,CAAC,CAAC,EAAE,aAAW,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,GAAA,CAAC;iBAC/G,IAAI,CAAC,cAAM,OAAA,SAAS,GAAA,CAAC,CAAC;SAC1B;QAED,OAAO,SAAS,CAAC;KAClB,CACF,CAAC;CACL,CAAC;;ACnJF;;;;AAIA;IAAA;KASC;;;;;;IAHC,+BAAS,GAAT,UAAU,MAAc,EAAE,MAAmB,EAAE,qBAA4C;QACzF,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;KACrG;IACH,kBAAC;CAAA;;ACbD;;;AAGA;IAQE,uBAAY,WAAwB;QAClC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;KAChC;;IARM,oBAAM,GAAb,cAAkB,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE;;;;IAYzC,2BAAG,GAAH,UAAI,qBAA4C,EAAE,IAAU;QAC1D,OAAO,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,qBAAqB,CAAC;aACzD,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;KAC5B;IACH,oBAAC;CAAA;;ACvBD;;;AAGA;IAAA;KASC;IARC,+BAAG,GAAH,UAAI,qBAA4C,EAAE,IAAc;QAC9D,OAAO,qBAAqB;aACzB,cAAc,mBAAmB,IAAI,CAAC;aACtC,IAAI,CAAC;YACJ,qBAAqB,CAAC,YAAY,EAAE,CAAC;YACrC,OAAO,IAAI,EAAE,CAAC;SACf,CAAC,CAAC;KACN;IACH,wBAAC;CAAA;;ACdD;;;;AAIA,IAAkB,0BAajB;AAbD,WAAkB,0BAA0B;;;;IAI1C,oDAAsB,CAAA;;;;IAItB,kEAAoC,CAAA;;;;IAIpC,iDAAmB,CAAA;CACpB,EAbiB,0BAA0B,KAA1B,0BAA0B,QAa3C;;;;;AAMD,IAAa,kBAAkB,GAAuB;IACpD,QAAQ;IACR,eAAe;IACf,OAAO;CACR;;ACrBD;;;;;AAKA,AAAO,IAAM,oBAAoB,GAAG,UAClC,qBAA4C,EAC5C,YAA4C,EAC5C,IAAU,EACV,YAAsB;IAEtB,IAAI,IAAI,GAAiC,qBAAqB,CAAC,IAAI,CAAC;IACpE,IAAI,KAAK,GAAG,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAClD,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAErB,SAAS,OAAO,CAAC,GAAQ;QACvB,IAAI,YAAY,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE;YACvC,OAAO,OAAO,EAAE,CAAC;SAClB;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KACzB;IAED,SAAS,OAAO;QACd,IAAI,CAAC,EAAE,EAAE;YACP,IAAI;gBACF,IAAI,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBACzB,IAAI,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC;gBAC5D,OAAO,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;aACvD;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAC3B;SACF;QAED,qBAAqB,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;QAEpD,OAAO,IAAI,EAAE,CAAC;KACf;IAED,OAAO,OAAO,EAAE,CAAC;CAClB,CAAC;;;;;AAMF,AAAO,IAAM,iBAAiB,GAAG,UAC/B,IAAkC,EAClC,YAAoB,EACpB,IAA6B;IAA7B,qBAAA,EAAA,SAA6B;IAE7B,KAAK,IAAI,YAAY,IAAI,IAAI,EAAE;QAC7B,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;QACtC,IAAI,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC;QAE/C,IAAI,CAAC,YAAY,CAAC,QAAQ,KAAK,kBAAkB,CAAC,eAAe,IAAI,YAAY,CAAC,QAAQ,KAAK,kBAAkB,CAAC,OAAO;eACpH,aAAa,EAChB;YACA,IAAI,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;YAExC,IAAI,YAAY,IAAI,SAAS,EAAE;gBAC7B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aACtB;SACF;QAED,IAAI,YAAY,CAAC,QAAQ,KAAK,kBAAkB,CAAC,OAAO,IAAI,aAAa,EAAE;YACzE,wBAAwB,CAAC,aAAa,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;SAC7D;aAAM,IAAI,YAAY,CAAC,0BAA0B,EAAE;YAClD,iBAAiB,CAAC,YAAY,CAAC,0BAA0B,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;SACrF;KACF;IAED,OAAO,IAAI,CAAC;CACb,CAAC;;;;AAKF,AAAO,IAAM,wBAAwB,GAAG,UACtC,SAA4B,EAC5B,YAAoB,EACpB,IAAwB;IAExB,IAAI,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;IAExC,IAAI,WAAW,IAAI,WAAW,CAAC,kBAAkB,EAAE;QACjD,IAAI,oBAAoB,GAAG,WAAW,CAAC,kBAAkB,CAAC,oBAAoB,CAAC;QAE/E,KAAK,IAAI,YAAY,IAAI,oBAAoB,EAAE;YAC7C,IAAI,mBAAmB,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;YAC7D,IAAI,aAAa,GAAG,mBAAmB,CAAC,SAAS,CAAC;YAClD,IAAI,aAAa,GAAG,aAAa,CAAC,SAAS,CAAC;YAE5C,IAAI,YAAY,IAAI,aAAa,EAAE;gBACjC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aAC1B;YAED,wBAAwB,CAAC,aAAa,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;SAC7D;KACF;CACF,CAAC;;;;AAKF,AAAO,IAAM,kBAAkB,GAAG,UAChC,qBAA4C,EAC5C,YAAwC,EACxC,IAAU,EACV,YAAsB;IAEtB,IAAI,KAAK,GAAG,eAAe,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC;IACjE,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC1B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEX,SAAS,OAAO,CAAC,GAAQ,EAAE,MAAc;QACvC,IAAI,YAAY,IAAI,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;YAC/C,OAAO,OAAO,EAAE,CAAC;SAClB;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KACzB;IAED,SAAS,OAAO;;QACd,CAAC,EAAE,CAAC;QAEJ,IAAI,CAAC,GAAG,MAAM,EAAE;YACd,IAAI;gBACF,IAAI,SAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBACvB,IAAI,MAAM,GAAG,CAAA,KAAA,SAAO,CAAC,SAAS,EAAC,YAAY,CAAC,WAAI,SAAO,CAAC,aAAa,CAAC,CAAC;gBACvE,OAAO,gBAAgB,CAAC,MAAM,EAAE,UAAC,GAAQ,IAAK,OAAA,OAAO,CAAC,GAAG,EAAE,SAAO,CAAC,MAAM,CAAC,GAAA,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;aAC1F;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAC3B;SACF;QAED,OAAO,IAAI,EAAE,CAAC;KACf;IAED,OAAO,OAAO,EAAE,CAAC;CAClB,CAAC;;;;;AAYF,AAAO,IAAM,eAAe,GAAG,UAC7B,qBAA4C,EAC5C,YAAwC,EACxC,IAA6B,EAC7B,MAAe;IADf,qBAAA,EAAA,SAA6B;IAG7B,IAAI,IAAI,GAAiC,qBAAqB,CAAC,IAAI,CAAC;IAEpE,MAAM;SACH,IAAI,CAAC,IAAI,CAAC;SACV,OAAO,CAAC,UAAC,YAAY;QACpB,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;QACtC,IAAI,mBAAmB,GAAG,qBAAqB,CAAC,oBAAoB,CAAC,YAAY,CAAwB,CAAC;QAC1G,IAAI,iBAAiB,GAAG,mBAAmB,CAAC,SAAS,CAAC;QACtD,IAAI,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC;QAE5C,IACE,CAAC,YAAY,CAAC,QAAQ,KAAK,kBAAkB,CAAC,eAAe;eACxD,YAAY,CAAC,QAAQ,KAAK,kBAAkB,CAAC,OAAO;eAEtD,YAAY,IAAI,SAAS,EAC5B;YACA,IAAI,CAAC,IAAI,CAAC;gBACR,SAAS,WAAA;gBACT,aAAa,EAAE,mBAAmB,CAAC,aAAa;gBAChD,MAAM,QAAA;aACP,CAAC,CAAC;SACJ;QAED,IAAI,mBAAmB,GAAG,YAAY,CAAC,0BAA0B,CAAC;QAElE,IAAI,mBAAmB,EAAE;YACvB,eAAe,CACb,mBAAmB,EACnB,YAAY,EACZ,IAAI,EACJ,iBAAiB,CAAC,WAAW,IAAI,MAAM,CACxC,CAAC;SACH;KACF,CAAC,CAAC;IAEL,OAAO,IAAI,CAAC;CACb,CAAC;AAEF,IAAM,cAAc,GAAG,UAAU,MAAS,EAAE,MAAe;IACzD,IAAI,MAAM,YAAY,KAAK,EAAE;QAC3B,OAAO,KAAK,CAAC;KACd;IAED,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE;QAC/B,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,UAAU,EAAE;YAC1C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;SAC1B;QAED,OAAO,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC;KAC1C;IAED,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,MAAM,CAAC;CACf,CAAC;;;;;AA4BF;IAKE,0BAAY,gBAAsC;QAChD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAE5C,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,WAAW,EAAE,CAAC;SACpB;KACF;IAED,sBAAI,wCAAU;aAAd;YACE,OAAO,IAAI,CAAC,WAAW,CAAC;SACzB;;;OAAA;IAED,sCAAW,GAAX;QACE,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,aAAa,EAAE;YAC1C,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;SAClC;QAED,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;KAC1B;IACH,uBAAC;CAAA,IAAA;;;;;;;AAQD,IAAM,gBAAgB,GAAG,UAAC,GAAQ,EAAE,OAA2B,EAAE,MAA0B;;IAEzF,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE;QACzC,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KACzD;;IAGD,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU,EAAE;QAC9C,IAAI,KAAG,GAAgB,GAAG,CAAC;QAC3B,OAAO,IAAI,gBAAgB,CAAC,UAAA,GAAG,IAAI,OAAA,KAAG,CAAC,SAAS,CAAC;YAC/C,IAAI;gBACF,IAAI,GAAG,CAAC,UAAU,EAAE;oBAClB,GAAG,CAAC,WAAW,EAAE,CAAC;oBAClB,OAAO,CAAC,GAAG,CAAC,CAAC;iBACd;aACF;YACD,KAAK,YAAC,KAAK;gBACT,IAAI,GAAG,CAAC,UAAU,EAAE;oBAClB,GAAG,CAAC,WAAW,EAAE,CAAC;oBAClB,MAAM,CAAC,KAAK,CAAC,CAAC;iBACf;aACF;YACD,QAAQ;gBACN,IAAI,GAAG,CAAC,UAAU,EAAE;oBAClB,GAAG,CAAC,WAAW,EAAE,CAAC;oBAClB,OAAO,CAAC,GAAG,CAAC,CAAC;iBACd;aACF;SACF,CAAC,GAAA,CAAC,CAAC;KACL;;IAGD,IAAI;QACF,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;KACrB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;KACtB;CACF,CAAC;;AC1TF;;;AAGA;IAAA;KAIC;IAHC,uCAAG,GAAH,UAAI,qBAA4C,EAAE,IAAU;QAC1D,OAAO,oBAAoB,CAAC,qBAAqB,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;KAC3E;IACH,gCAAC;CAAA,IAAA;AAED;;;AAGA;IAAA;KAIC;IAHC,iCAAG,GAAH,UAAI,qBAA4C,EAAE,IAAU;QAC1D,OAAO,kBAAkB,CAAC,qBAAqB,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;KACvE;IACH,0BAAC;CAAA,IAAA;AAED;;;AAGA;IAAA;KAIC;IAHC,oCAAG,GAAH,UAAI,qBAA4C,EAAE,IAAU;QAC1D,OAAO,oBAAoB,CAAC,qBAAqB,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC9E;IACH,6BAAC;CAAA,IAAA;AAED;;;AAGA;IAAA;KAIC;IAHC,8BAAG,GAAH,UAAI,qBAA4C,EAAE,IAAU;QAC1D,OAAO,kBAAkB,CAAC,qBAAqB,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC1E;IACH,uBAAC;CAAA;;AC7BD;;;AAGA;IAWE,sBAAY,SAAoB,EAAE,IAAY,EAAE,KAAc;QAF9D,UAAK,GAAgC,EAAE,CAAC;QAGtC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;KACxB;IAED,+BAAQ,GAAR;QAAA,iBAEC;QADC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;KACnD;IACH,mBAAC;CAAA,IAAA;;;;AAKD;IASE,0BAAY,SAAoB;QAC9B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG;YACX,uBAAuB;YACvB,yBAAyB;YACzB,aAAa;YACb,kBAAkB,CAAC,SAAS,8BAA6B;YACzD,mBAAmB;YACnB,kBAAkB,CAAC,SAAS,mCAAgC,WAAW,CAAC;;YAExE,sBAAsB;YACtB,gBAAgB;YAChB,kBAAkB,CAAC,SAAS,+BAA8B,WAAW,CAAC;YACtE,iBAAiB;YACjB,kBAAkB,CAAC,SAAS,iCAA+B,cAAc,CAAC;SAC3E,CAAC;KACH;;IAtBM,uBAAM,GAAb,cAAkB,OAAO,CAACC,oCAAS,CAAC,CAAC,EAAE;;;;IA2BvC,yCAAc,GAAd,UAAe,oBAAoC;QAAnD,iBAQC;QARc,qCAAA,EAAA,2BAAoC;QACjD,IAAI,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;YACrB,IAAI,oBAAoB,IAAI,IAAI,KAAK,yBAAyB,EAAE;gBAC9D,QAAQ,CAAC,OAAO,CAAC,KAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;aAC5C;SACF,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;KACjB;;IAGD,oCAAS,GAAT,UAAU,IAAY;;QAEpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAC,CAAkB,CAAC,QAAQ,KAAK,IAAI,IAAK,CAAkB,CAAC,SAAS,KAAK,IAAI,GAAA,CAAiB,CAAC;KAC9H;;;;IAKD,kCAAO,GAAP,UAAQ,IAAY,EAAE,IAA6B;QACjD,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,KAAK,EAAE;YACT,IAAI,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC;;YAE5B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBAC7B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACtB;SACF;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,iCAA+B,IAAI,MAAG,CAAC,CAAC;SACzD;KACF;;;;IAKD,qCAAU,GAAV,UAAW,IAAY,EAAE,IAAkB;QACzC,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,IAAI,EAAE;YACR,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;YAC3B,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;SAC9C;KACF;;;;;IAMD,sCAAW,GAAX,UAAY,IAAiB;QAAjB,qBAAA,EAAA,SAAiB;QAC3B,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;SACjB;KACF;;;;IAKD,gCAAK,GAAL;QACE,IAAI,CAAC,WAAW,6BAA4B,CAAC;QAC7C,IAAI,CAAC,WAAW,iCAA8B,CAAC;QAC/C,IAAI,CAAC,WAAW,6BAA4B,CAAC;QAC7C,IAAI,CAAC,WAAW,+BAA6B,CAAC;KAC/C;IACH,uBAAC;CAAA,IAAA;AAED;AACA,IAAM,kBAAkB,GAAG,UAAC,SAAoB,EAAE,IAAsB,EAAE,KAAc;IACtF,OAAO,IAAI,YAAY,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;CACjD,CAAC;;ACpHF,IAAM,MAAM,GAAGC,oBAAoB,CAAC,YAAY,CAAC,CAAC;;;;AAKlD;IAA+BN,6BAAM;IAanC,mBAAY,SAAoB,EAAE,OAAgB,EAAE,gBAAkC,EAAE,MAAuB;QAA/G,YACE,kBAAM,SAAS,EAAE,OAAO,CAAC,SAG1B;QAFC,KAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;KACtB;;IAdM,gBAAM,GAAb,cAAkB,OAAO,CAACK,oCAAS,EAAEF,sBAAO,EAAE,gBAAgB,EAAEI,sCAAe,CAAC,CAAC,EAAE;;;;;IAoBnF,yBAAK,GAAL;QACE,iBAAM,KAAK,WAAE,CAAC;QACd,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;SAClB;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;SACxB;KACF;;;;;;IAOD,2BAAO,GAAP,UAAQ,GAAW;QAAnB,iBAQC;QAPC,OAAO,IAAI;aACR,4BAA4B,CAAC,GAAG,CAAC;aACjC,IAAI,CAAC,UAAA,WAAW,IAAI,OAAA,KAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,GAAA,CAAC;aACxD,KAAK,CAAC,UAAA,KAAK;YACV,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpB,uBAAuB,CAAC,KAAI,CAAC,CAAC;SAC/B,CAAC,CAAC;KACN;;;;;;;IAQD,oCAAgB,GAAhB,UAAiB,QAA0B,EAAE,IAAa;QAA1D,iBA4CC;;QA1CC,IAAM,SAAS,GAAa,QAAQ,CAAC;QACrC,iBAAM,gBAAgB,YAAC,SAAS,EAAE,IAAI,CAAC,CAAC;;;;;QAMxC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAM,WAAS,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;YACjD,IAAI,iBAAiB,IAAI,WAAS,EAAE;;;;gBAIlC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;;;oBAGtB,IAAM,0BAAwB,GAAG,IAAI,CAAC,yBAAyB,CAAC;oBAChE,IAAI,CAAC,yBAAyB,GAAG,eAAY,CAAC;oBAC9C,OAAO,IAAI;yBACR,SAAS,CAAC,UAAA,MAAM;wBACf,OAAA,OAAO;6BACJ,OAAO,CAAC,WAAS,CAAC,eAAe,CAAC,MAAM,EAAE,KAAI,CAAC,CAAC;;;6BAGhD,IAAI,CAAC,cAAM,OAAA,MAAM,GAAA,CAAQ;qBAAA,CAC7B;yBACA,IAAI,CAAC;wBACJ,KAAI,CAAC,QAAQ,EAAE,CAAC;wBAChB,0BAAwB,EAAE,CAAC;qBAC5B,CAAC,CAAC;iBACN;aACF;iBAAM;gBACL,IAAI,CAAC,QAAQ,EAAE,CAAC;aACjB;SACF;;;aAGI;YACH,IAAI,CAAC,mBAAmB,EAAE,CAAC;SAC5B;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;KAC1B;;;;;;IAOD,4BAAQ,GAAR,UAAS,OAA2B;QAClC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO;SACR;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;;;QAGrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/F,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,mBAAmB,EAAE,CAAC;KAC5B;;;;IAKD,8BAAU,GAAV;QACE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;KAC3B;;IAGD,qCAAiB,GAAjB,UAAkB,WAAkC;QAApD,iBAMC;QALC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO;YACzB,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;YAC9B,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACjC,KAAI,CAAC,mBAAmB,EAAE,CAAC;SAC5B,CAAC,CAAC;KACJ;;IAGD,uCAAmB,GAAnB,UAAoB,gBAA4B;QAAhD,iBA6DC;QA7DmB,iCAAA,EAAA,oBAA4B;QAC9C,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;YAC5B,IAAI,KAAI,CAAC,YAAY,IAAI,CAAC,gBAAgB,EAAE;;gBAE1C,OAAO,KAAK,CAAC,CAAC;aACf;YAED,IAAI,WAAW,GAAG,KAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACtC,KAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;YAEvB,IAAI,CAAC,WAAW,EAAE;;gBAEhB,OAAO,KAAK,CAAC,CAAC;aACf;YAED,KAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YAEzB,IAAI,UAAU,GAAW,KAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;YACpE,IAAI,iBAAiB,GAAG,KAAI,CAAC,wBAAwB,CAAC;YAEtD,IAAI,CAAC,UAAU,IAAI,CAAC,iBAAiB,EAAE;gBACrC,KAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAC9B,KAAI,CAAC,eAAe,GAAG,IAAI,CAAC;aAC7B;iBAAM,IAAI,CAAC,UAAU,EAAE;gBACtB,KAAI,CAAC,eAAe,GAAG,IAAI,CAAC;aAC7B;iBAAM,IAAI,CAAC,iBAAiB,EAAE;gBAC7B,KAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;aACjC;iBAAM,IAAI,iBAAiB,GAAG,UAAU,EAAE;gBACzC,KAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;aACjC;iBAAM,IAAI,iBAAiB,GAAG,UAAU,EAAE;gBACzC,KAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;aAC9B;YAAC,IAAI,CAAC,UAAU,EAAE;gBACjB,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;gBACxB,KAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;aACxD;YACD,KAAI,CAAC,wBAAwB,GAAG,UAAU,CAAC;YAE3C,WAAW,CAAC,mBAAmB,GAAG,KAAI,CAAC,kBAAkB,CAAC;YAE1D,IAAI,mBAAmB,GAAG,KAAI,CAAC,mBAAmB,CAAC;YAEnD,IAAI,CAAC,gBAAgB,EAAE;gBACrB,KAAI,CAAC,MAAM,CAAC,OAAO,kDAAyB,EAAE,WAAW,aAAA,EAAE,CAAC,CAAC;aAC9D;iBAAM,IAAI,gBAAgB,KAAK,mBAAmB,GAAG,CAAC,EAAE;gBACvD,MAAM,CAAC,KAAK,CAAI,gBAAgB,GAAG,CAAC,sGAAmG,CAAC,CAAC;gBACzI,uBAAuB,CAAC,KAAI,CAAC,CAAC;gBAC9B,OAAO,KAAI,CAAC,mBAAmB,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC;aACvD;iBAAM,IAAI,gBAAgB,GAAG,mBAAmB,EAAE;gBACjD,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;aACrE;YAED,IAAI,QAAQ,GAAG,KAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,KAAI,CAAC,eAAe,CAAC,CAAC;YAE3E,OAAO,QAAQ;iBACZ,GAAG,CAAC,WAAW,CAAC;iBAChB,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAI,CAAC,GAAA,CAAC;iBAC1E,KAAK,CAAC,UAAA,KAAK;gBACV,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,EAAoB,CAAC;aACxF,CAAC;iBACD,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,gBAAgB,EAAE,KAAI,CAAC,GAAA,CAAC,CAAC;SACtF,CAAC,CAAC;KACJ;;IAGD,kCAAc,GAAd,UAAe,QAAkB;QAC/B,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;SACjC;QAED,IAAI,QAAQ,CAAC,SAAS,EAAE;YACtB,IAAI,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;YAEnC,OAAO,SAAS,EAAE;gBAChB,IAAI,SAAS,CAAC,SAAS,EAAE;oBACvB,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;oBAC/C,OAAO,SAAS,CAAC,SAAS,CAAC;iBAC5B;gBAED,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC;aAC9B;SACF;QAED,OAAO,SAAS,CAAC;KAClB;IACH,gBAAC;CA5ND,CAA+B,MAAM,GA4NpC;AAED,IAAM,aAAa,GAAG,UACpB,WAAkC,EAClC,MAAsB,EACtB,gBAAwB,EACxB,MAAiB;IAEjB,IAAI,EAAE,MAAM,IAAI,WAAW,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,EAAE;QAC5D,MAAM,GAAG,MAAM,IAAI,EAAoB,CAAC;QACxC,MAAM,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,sEAAoE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,eAAY,CAAC,CAAC;KACnI;IAED,IAAI,WAAW,GAAmB,IAAI,CAAC;IACvC,IAAI,uBAAuB,GAAG,IAAI,CAAC;IACnC,IAAI,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QACtC,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KAC1D;SAAM;QACL,WAAW,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACrB,IAAI,MAAM,CAAC,MAAM,YAAY,KAAK,EAAE;gBAClC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;aACxC;YAED,uBAAuB,CAAC,MAAM,CAAC,CAAC;SACjC;KACF;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC;SAC5C,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,GAAG,CAAC,CAAC,GAAA,CAAC;SAC3D,IAAI,CAAC,UAAA,WAAW,IAAI,OAAA,WAAW,IAAI,WAAW,IAAI,MAAM,GAAA,CAAC,CAAC;CAC9D,CAAC;AAEF,IAAM,kBAAkB,GAAG,UACzB,WAAkC,EAClC,MAAsB,EACtB,kBAA2B,EAC3B,MAAiB;IAEjB,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5B,IAAI,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC,IAAI,SAAS,GAAG,EAAE,WAAW,aAAA,EAAE,MAAM,QAAA,EAAE,CAAC;IACxC,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC;QAC5B,MAAM,CAAC,oBAAoB,GAAG,KAAK,CAAC;QACpC,MAAM,CAAC,wBAAwB,GAAG,KAAK,CAAC;QACxC,MAAM,CAAC,iBAAiB,GAAG,KAAK,CAAC;QACjC,MAAM,CAAC,eAAe,GAAG,KAAK,CAAC;QAC/B,MAAM,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACnC,MAAM,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACnC,MAAM,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAChC,MAAM,CAAC,eAAe,GAAG,KAAK,CAAC;QAE/B,IAAI,SAAS,SAAQ,CAAC;QAEtB,IAAI,MAAM,CAAC,MAAM,YAAY,KAAK,EAAE;YAClC,SAAS,yCAAqB;SAC/B;aAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YAC5B,SAAS,+CAAwB;SAClC;aAAM;YACL,IAAI,WAAW,GAAG,WAAW,CAAC,WAAW,IAAI,GAAG,GAAG,WAAW,CAAC,WAAW,IAAI,EAAE,CAAC;YACjF,MAAM,CAAC,OAAO,CAAC,gBAAgB,GAAG,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC;YACrE,SAAS,6CAAuB;SACjC;QAED,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAC9C,eAAe,CAAC,OAAO,8CAAuB,SAAS,CAAC,CAAC;KAC1D;SAAM;QACL,eAAe,CAAC,OAAO,yDAA4B,SAAS,CAAC,CAAC;KAC/D;IAED,OAAO,MAAM,CAAC;CACf,CAAC;AAEF,IAAM,uBAAuB,GAAG,UAAC,MAAiB;IAChD,IAAI,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACvD,IAAI,gBAAgB,EAAE;QACpB,MAAM,CAAC,QAAQ,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;KACtE;SAAM,IAAI,MAAM,CAAC,aAAa,EAAE;QAC/B,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;KACzE;SAAM;QACL,MAAM,CAAC,KAAK,CAAC,wFAAwF,CAAC,CAAC;KACxG;CACF,CAAC;;ACzUF;;;AAGA,WAAkB,cAAc;IAC9B,yCAAuB,CAAA;IACvB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,qCAAmB,CAAA;CACpB,EALiBC,sBAAc,KAAdA,sBAAc,QAK/B;;ACRD;;;;AAIA,AACA,WAAkB,WAAW;IAC3B,0DAA2C,CAAA;IAC3C,gDAAiC,CAAA;IACjC,sDAAuC,CAAA;IACvC,sDAAuC,CAAA;IACvC,oDAAqC,CAAA;IACrC,iEAAkD,CAAA;CACnD,EAPiBC,mBAAW,KAAXA,mBAAW,QAO5B;;ACZD;;;AAGA,AACA,WAAkB,gBAAgB;;;;;IAKhC,2CAAuB,CAAA;;;;;;;;;IASvB,+CAA2B,CAAA;;;;;;;IAO3B,2CAAuB,CAAA;;;;IAIvB,6CAAyB,CAAA;CAC1B,EA1BiBC,wBAAgB,KAAhBA,wBAAgB,QA0BjC;;;;;;;;;;;;;;;;;;;;;;;;;AC9BD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC32BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACz5DA;IAAA;KAEC;IAAD,2BAAC;CAAA,IAAA;;;;AAKD;IAsHE,oBACE,OAAgB,EAChB,SAAoB,EACpB,QAAkB,EAClB,MAAc,EACd,WAAwB,EACxB,sBAA8C,EAC9C,iBAAoC;QAEpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;QACrD,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;;;;QAI3C,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;;;;;;QAOtE,IAAI,EAAE,oBAAoB,IAAI,sBAAsB,CAAC,EAAE;YACrD,sBAAsB,CAAC,kBAAkB,GAAG,IAAI,CAAC;YACjD,IAAI,CAAC,8BAA8B,GAAG,sBAAsB,CAAC,MAAM,EAAE,CAAC;SACvE;KACF;;IAjJM,iBAAM,GAAb;QACE,OAAO,CAACT,cAAG,CAAC,OAAO,EAAEI,oCAAS,EAAEM,0BAAQ,EAAEC,oBAAM,EAAEC,6BAAW,EAAEC,wCAAsB,EAAEC,mCAAiB,CAAC,CAAC;KAC3G;IAiJD,4BAAO,GAAP,UAAQ,UAAgB;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;KAC9B;IAED,yBAAI,GAAJ,UAAK,cAAmB,EAAE,eAAgC;;;QAGxD,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,cAAc,CAAC;QAC1C,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;KACxC;;;;IAKD,4BAAO,GAAP,UAAQ,oBAAyB,EAAE,UAAoB;QAAvD,iBA+DC;;QA7DC,IAAM,mBAAmB,GAAG,oBAAsD,CAAC;QACnF,IAAM,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;QAChD,IAAM,cAAc,GAAG,SAAS,CAAC,cAAc,CAAC;QAChD,IAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;QACtC,IAAM,iBAAiB,GAAG,SAAS,CAAC,iBAAmD,CAAC;QACxF,IAAM,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC;QAC5C,IAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC;QAC1D,IAAM,cAAc,GAAG,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;QAEjG,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAuB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;;QAG3E,IAAM,iBAAiB,GAAG;YACxB,SAAS,EAAE,cAAc,CAAC,eAAe,IAAI,MAAM,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe;YAC3F,IAAI,EAAE,cAAc,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU;YACvE,KAAK,EAAE,cAAc,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW;YAC3E,MAAM,EAAE,mBAAmB,CAAC,SAAS,CAAC,MAAM;YAC5C,cAAc,EAAE,cAAc;YAC9B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;;;;;QAMF,IAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,CAAC;QACnF,IAAI,YAAY,IAAI,SAAS,CAAC,IAAI,EAAE;YAClC,YAAY,CAAC,cAAc,CAACC,sBAAM,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;SACpG;;QAGD,OAAO,QAAQ;aACZ,IAAI,CAAC,cAAc,EAAE,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC;;;aAGvE,IAAI,CAAC,UAAC,WAA+C;;;;;YAKpD,IAAI,CAAC,KAAI,CAAC,8BAA8B,EAAE;gBACxC,KAAI,CAAC,oCAAoC,GAAG,KAAI,CAAC,sBAAsB,CAAC,UAAU,EAAE,CAAC;aACtF;YAED,IAAI,iBAAiB,CAAC,SAAS,IAAI,iBAAiB,CAAC,IAAI,EAAE;gBACzD,mBAAmB,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;aAC3D;YAED,IAAM,oCAAoC,GAAGC,qCAAmB,CAAC,OAAO,CACtE,KAAI,CAAC,OAAO,EACZ,SAAS,EACT,WAA0B,CAC3B,CAAC;YACF,mBAAmB,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,oCAAoC,CAAC,CAAC;YAEvG,IAAI,UAAU,EAAE;gBACd,OAAO,IAAI,CAAC;aACb;YAED,KAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;SAChC,CAAC,CAAC;KACN;IAED,yBAAI,GAAJ,UAAK,oBAAyB;QAA9B,iBAgFC;;QA9EC,IAAM,mBAAmB,GAAmC,oBAAoB,CAAC;QACjF,IAAM,kBAAkB,GAAG,mBAAmB,CAAC,UAAU,CAAC;QAC1D,IAAM,iBAAiB,GAAG,mBAAmB,CAAC,iBAAiB,CAAC;QAChE,IAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC;;QAG/B,IAAM,IAAI,GAAG;YACX,IAAM,YAAY,GAAGC,gCAAc,CAAC,KAAI,CAAC,SAAS,CAAC,IAAIA,gCAAc,CAAC,KAAK,CAAC;YAC5E,IAAM,QAAQ,GAAG,KAAI,CAAC,QAAQ,CAAC;YAE/B,YAAY,CACV,QAAQ,EACR,YAAY,EACZ,cAAM,OAAA,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAI,CAAC,IAAI,CAAC,CAAC,GAAA,CAC/C,CAAC,IAAI,CAAC;gBACL,KAAI,CAAC,OAAO,EAAE,CAAC;aAChB,CAAC,CAAC;SACJ,CAAC;;QAGF,IAAM,KAAK,GAAG,UAAC,wBAA8B;YAC3C,kBAAkB,CAAC,QAAQ,CAAC,KAAI,CAAC,eAAe,EAAE,wBAAwB,CAAC,CAAC;YAC5E,IAAM,yBAAyB,GAAG,KAAI,CAAC,oCAAoC,CAAC;;;;;YAM5E,IAAI,yBAAyB,EAAE;gBAC7B,OAAO,yBAAyB;qBAC7B,0BAA0B,EAAE;qBAC5B,IAAI,CAAC;oBACJ,KAAI,CAAC,oCAAoC,GAAG,IAAI,CAAC;oBACjD,OAAO,IAAI,EAAE,CAAC;iBACf,CAAC,CAAC;aACN;;YAGD,OAAO,IAAI,EAAE,CAAC;SACf,CAAC;;;QAIF,IAAI,iBAAiB,EAAE;YACrB,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE;;;gBAGhC,iBAAiB,CAAC,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;aAC1D;;YAGD,OAAO,IAAI,CAAC,iBAAiB;;;;iBAI1B,gBAAgB,CAAC,iBAAuC,CAAC;iBACzD,IAAI,CAAC,UAAC,gBAA4B;gBACjC,IAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC;gBACzCC,2BAAS,CAAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;;;gBAG9F,gBAAgB,CAAC,QAAQ,CAACC,oCAAqB,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,KAAI,CAAC,UAAU,CAAC,CAAC;gBAC/F,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;gBAClD,OAAO,UAAU,IAAI,gBAAgB,CAAC;aACvC,CAAC;iBACD,IAAI,CAAC,UAAC,OAA0B;gBAC/B,KAAI,CAAC,IAAI,GAAG,OAAe,CAAC;gBAC5B,OAAO,KAAK,CAAC,OAAe,CAAC,CAAC;aAC/B,CAAC,CAAC;SACN;;;;;QAMD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC;QAEpC,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KAC/B;;;;;;IAOD,4BAAO,GAAP;QACE,IAAM,QAAQ,GAAG,IAAI,CAAC,8BAA8B,CAAC;QACrD,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,IAAI,EAAE,CAAC;YAChB,IAAI,CAAC,8BAA8B,GAAG,IAAI,CAAC;SAC5C;KACF;;;;;;;IArTM,gBAAK,GAAsB,IAAI,CAAC;;;;IAIhC,oBAAS,GAA0B;QACxC,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,yBAAyB,CAAQ;KAC3G,CAAC;IA+SJ,iBAAC;CAnUD,IAmUC;AAED;;;AAGA;;;;IAWE;QAAA,iBAEC;QADC,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,UAAC,OAAO,IAAK,OAAA,KAAI,CAAC,OAAO,GAAG,OAAO,GAAA,CAAC,CAAC;KACjE;;;;;IAMD,uCAAW,GAAX;QACE,OAAO,IAAI,CAAC,OAAO,CAAC;KACrB;;IAGD,mCAAO,GAAP,UAAQ,UAAsB;QAC5B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;KAC1B;IACH,wBAAC;CAAA,IAAA;;AC/XD;AACA;IAAA;KAA2B;IAAD,iBAAC;CAAA,IAAA;AAC3BC,4BAAU,CAAC,uBAAuB,CAAC,CAAC,UAAU,CAAC,CAAC;;;;AAKhD;IAA2CrB,yCAAW;IAQpD,+BACE,iBAAoC;QADtC,YAGE,iBAAO,SAER;QADC,KAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;;KAC5C;;;;;;IAOD,gDAAgB,GAAhB,UAAiB,MAAc,EAAE,MAAmB;QAClD,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACjC,IAAI,SAAmC,CAAC;YACxC,IAAI,UAAU,IAAI,MAAM,EAAE;gBACxB,IAAI,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;gBAC/B,IAAI,QAAQ,KAAK,IAAI,EAAE;oBACrB,SAAS,GAAG,UAAU,CAAC;iBACxB;qBAAM;;;;oBAIL,QAAQ,GAAGsB,0BAAc,CAAC,QAAQ,EAAEN,sBAAM,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;oBACjG,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;wBAC5B,SAAS,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;qBAC1C;yBAAM;wBACL,SAAS,GAAG,QAAQ,CAAC;qBACtB;iBACF;gBACD,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;aAC3B;;YAED,MAAM,CAAC,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC,CAAC;SACjE,CAAC,CAAC;KACJ;;;;;;IAOD,oDAAoB,GAApB,UAAqB,MAAc;QACjC,IAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAEtD,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;QACpD,cAAc,CAAC,cAAc,GAAG;YAC9B,IAAI,WAAmB,CAAC;YAExB,cAAc,CAAC,eAAe,CAC5BJ,oBAAM,EACN,cAAM,OAAA,WAAW,KAAK,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,GAAA,CACxE,CAAC;YAEF,OAAO,cAAc,CAAC,GAAG,CAACA,oBAAM,CAAC,CAAC;SACnC,CAAC;QACF,OAAO,cAAc,CAAC;KACvB;;;;IAKD,yCAAS,GAAT,UAAU,MAAc,EAAE,MAAmB,EAAE,eAAsC;QAArF,iBASC;QARC,OAAO,IAAI;aACR,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC;aAChC,IAAI,CAAC,UAAA,SAAS,IAAI,OAAA,KAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC;YACxD,SAAS,EAAE,SAAS;YACpB,cAAc,EAAE,KAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC;YACjD,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,YAAY;YACxC,MAAM,EAAE,MAAM;SACO,CAAC,GAAA,CAAC,CAAC;KAC7B;;IA5EM,4BAAM,GAAG,CAACG,mCAAiB,CAAC,CAAC;IA6EtC,4BAAC;CAAA,CAhF0CQ,yBAAW,GAgFrD;AAED;AACA,SAAgB,kBAAkB,CAAC,QAAgB;IACjD,IAAM,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpD;QAAA;SAOC;QAHC,2BAAI,GAAJ,UAAK,cAAmB;YACtB,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC;SAC/B;QACH,mBAAC;KAAA,IAAA;IAEDC,+BAAa,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;IAClCC,yBAAO,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;IAEhC,OAAO,YAAY,CAAC;CACrB;;AC5GD,IAAM,MAAM,GAAGnB,oBAAoB,CAAC,YAAY,CAAC,CAAC;;;;AAKlD;IAiDE,mBACE,MAAc,EACd,OAAgB;QAEhB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;KACzB;;IArDM,gBAAM,GAAb;QACE,OAAO,CAACM,oBAAM,EAAEX,cAAG,CAAC,OAAO,CAAC,CAAC;KAC9B;IAqDD,wBAAI,GAAJ;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,aAAa,EAAE,CAAC;KACtB;IAED,0BAAM,GAAN;QACE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;KACvB;IAED,oCAAgB,GAAhB,UAAiB,KAAU,EAAE,QAAa;QACxC,IAAI,QAAQ,EAAE;YACZ,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;SACxC;QAED,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;KAC7B;IAED,iCAAa,GAAb;QAAA,iBAwBC;QAvBC,OAAO,IAAI,CAAC,MAAM;aACf,gBAAgB,EAAE;aAClB,IAAI,CAAC;YACJ,IAAI,CAAC,KAAI,CAAC,QAAQ,EAAE;;gBAElB,OAAO,IAAI,CAAC;aACb;YACD,IAAM,OAAO,GAAG,KAAI,CAAC,OAAgC,CAAC;YAEtD,IAAM,IAAI,GAAG,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,MAAM,CAAC,CAAC;YAE3D,IAAI,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE;gBACzB,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,KAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;aACxD;iBAAM;gBACL,OAAO,CAAC,YAAY,CAAC,KAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;aAC5C;;YAGD,OAAO,IAAI,CAAC;SACb,CAAC;aACD,KAAK,CAAC,UAAC,MAAW;YACjB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SACtB,CAAC,CAAC;KACN;;;;IAzFM,mBAAS,GAA0B;QACxC,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE;YACT,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE;YACxE,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE;YAClD,WAAW;SACL;KACT,CAAC;IAkFJ,gBAAC;CApGD;;SCJgB,SAAS,CAAC,MAA+B;IACvD,MAAM;SACH,SAAS,CAACsB,yBAAW,EAAE,qBAAqB,CAAC;SAC7C,SAAS,CAACX,oBAAM,EAAEc,uBAAS,CAAC;SAC5B,eAAe,CACd,UAAU,EACV,SAAS,CACV,CAAC;IAEJ,MAAM,CAAC,SAAS,CAAC,aAAa,CAACd,oBAAM,EAAEc,uBAAS,CAAC,CAAC;CACnD;;;;;;;;;;AChBD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxnKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC32BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACx6nNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"vendor-bundle.js","sourcesContent":[null,null,null,null,null,null,null,"import { DOM, PLATFORM } from 'aurelia-pal';\nimport { BrowserHistory } from './browser-history';\nimport { AnchorEventInfo } from './interfaces';\n\n/**\n * Class responsible for handling interactions that should trigger browser history navigations.\n */\nexport class LinkHandler {\n /**\n * Activate the instance.\n *\n * @param history The BrowserHistory instance that navigations should be dispatched to.\n */\n activate(history: BrowserHistory): void {/**/}\n\n /**\n * Deactivate the instance. Event handlers and other resources should be cleaned up here.\n */\n deactivate(): void {/**/}\n}\n\n/**\n * The default LinkHandler implementation. Navigations are triggered by click events on\n * anchor elements with relative hrefs when the history instance is using pushstate.\n */\nexport class DefaultLinkHandler extends LinkHandler {\n\n /**@internal */\n handler: (e: Event) => void;\n\n /**@internal */\n history: BrowserHistory;\n /**\n * Creates an instance of DefaultLinkHandler.\n */\n constructor() {\n super();\n\n this.handler = (e) => {\n let { shouldHandleEvent, href } = DefaultLinkHandler.getEventInfo(e);\n\n if (shouldHandleEvent) {\n e.preventDefault();\n this.history.navigate(href);\n }\n };\n }\n\n /**\n * Activate the instance.\n *\n * @param history The BrowserHistory instance that navigations should be dispatched to.\n */\n activate(history: BrowserHistory): void {\n if (history._hasPushState) {\n this.history = history;\n DOM.addEventListener('click', this.handler, true);\n }\n }\n\n /**\n * Deactivate the instance. Event handlers and other resources should be cleaned up here.\n */\n deactivate(): void {\n DOM.removeEventListener('click', this.handler, true);\n }\n\n /**\n * Gets the href and a \"should handle\" recommendation, given an Event.\n *\n * @param event The Event to inspect for target anchor and href.\n */\n static getEventInfo(event: Event): AnchorEventInfo {\n let $event = event as MouseEvent;\n let info = {\n shouldHandleEvent: false,\n href: null,\n anchor: null\n };\n\n let target = DefaultLinkHandler.findClosestAnchor($event.target as Element);\n if (!target || !DefaultLinkHandler.targetIsThisWindow(target)) {\n return info;\n }\n\n if (hasAttribute(target, 'download')\n || hasAttribute(target, 'router-ignore')\n || hasAttribute(target, 'data-router-ignore')\n ) {\n return info;\n }\n\n if ($event.altKey || $event.ctrlKey || $event.metaKey || $event.shiftKey) {\n return info;\n }\n\n let href = target.getAttribute('href');\n info.anchor = target;\n info.href = href;\n\n let leftButtonClicked = $event.which === 1;\n let isRelative = href && !(href.charAt(0) === '#' || (/^[a-z]+:/i).test(href));\n\n info.shouldHandleEvent = leftButtonClicked && isRelative;\n return info;\n }\n\n /**\n * Finds the closest ancestor that's an anchor element.\n *\n * @param el The element to search upward from.\n * @returns The link element that is the closest ancestor.\n */\n static findClosestAnchor(el: Element): Element {\n while (el) {\n if (el.tagName === 'A') {\n return el;\n }\n\n el = el.parentNode as Element;\n }\n }\n\n /**\n * Gets a value indicating whether or not an anchor targets the current window.\n *\n * @param target The anchor element whose target should be inspected.\n * @returns True if the target of the link element is this window; false otherwise.\n */\n static targetIsThisWindow(target: Element): boolean {\n let targetWindow = target.getAttribute('target');\n let win = PLATFORM.global;\n\n return !targetWindow ||\n targetWindow === win.name ||\n targetWindow === '_self';\n }\n}\n\nconst hasAttribute = (el: Element, attr: string) => el.hasAttribute(attr);\n","import { DOM, PLATFORM } from 'aurelia-pal';\nimport { LinkHandler } from './link-handler';\nimport { History } from 'aurelia-history';\n\n/**\n * An implementation of the basic history API.\n */\nexport class BrowserHistory extends History {\n /**@internal */\n static inject = [LinkHandler];\n\n /**@internal */\n _isActive: boolean;\n\n /**@internal*/\n _checkUrlCallback: any;\n /**@internal*/\n location: Location;\n /**@internal*/\n history: typeof PLATFORM['history'];\n /**@internal*/\n linkHandler: LinkHandler;\n /**@internal*/\n options: any;\n /**@internal*/\n root: string;\n /**@internal*/\n _wantsHashChange: boolean;\n /**@internal*/\n _hasPushState: boolean;\n /**@internal*/\n fragment: string;\n\n /**\n * Creates an instance of BrowserHistory\n * @param linkHandler An instance of LinkHandler.\n */\n constructor(linkHandler: LinkHandler) {\n super();\n\n this._isActive = false;\n this._checkUrlCallback = this._checkUrl.bind(this);\n\n this.location = PLATFORM.location;\n this.history = PLATFORM.history;\n this.linkHandler = linkHandler;\n }\n\n /**\n * Activates the history object.\n * @param options The set of options to activate history with.\n * @returns Whether or not activation occurred.\n */\n activate(options?: Object): boolean {\n if (this._isActive) {\n throw new Error('History has already been activated.');\n }\n\n let $history = this.history;\n let wantsPushState = !!(options as any).pushState;\n\n this._isActive = true;\n let normalizedOptions = this.options = Object.assign({}, { root: '/' }, this.options, options);\n\n // Normalize root to always include a leading and trailing slash.\n let rootUrl = this.root = ('/' + normalizedOptions.root + '/').replace(rootStripper, '/');\n\n let wantsHashChange = this._wantsHashChange = normalizedOptions.hashChange !== false;\n let hasPushState = this._hasPushState = !!(normalizedOptions.pushState && $history && $history.pushState);\n\n // Determine how we check the URL state.\n let eventName: string;\n if (hasPushState) {\n eventName = 'popstate';\n } else if (wantsHashChange) {\n eventName = 'hashchange';\n }\n\n PLATFORM.addEventListener(eventName, this._checkUrlCallback);\n\n // Determine if we need to change the base url, for a pushState link\n // opened by a non-pushState browser.\n if (wantsHashChange && wantsPushState) {\n // Transition from hashChange to pushState or vice versa if both are requested.\n let $location = this.location;\n let atRoot = $location.pathname.replace(/[^\\/]$/, '$&/') === rootUrl;\n\n // If we've started off with a route from a `pushState`-enabled\n // browser, but we're currently in a browser that doesn't support it...\n if (!hasPushState && !atRoot) {\n let fragment = this.fragment = this._getFragment(null, true);\n $location.replace(rootUrl + $location.search + '#' + fragment);\n // Return immediately as browser will do redirect to new url\n return true;\n\n // Or if we've started out with a hash-based route, but we're currently\n // in a browser where it could be `pushState`-based instead...\n } else if (hasPushState && atRoot && $location.hash) {\n let fragment = this.fragment = this._getHash().replace(routeStripper, '');\n $history.replaceState({}, DOM.title, rootUrl + fragment + $location.search);\n }\n }\n\n if (!this.fragment) {\n this.fragment = this._getFragment('');\n }\n\n this.linkHandler.activate(this);\n\n if (!normalizedOptions.silent) {\n return this._loadUrl('');\n }\n }\n\n /**\n * Deactivates the history object.\n */\n deactivate(): void {\n const handler = this._checkUrlCallback;\n PLATFORM.removeEventListener('popstate', handler);\n PLATFORM.removeEventListener('hashchange', handler);\n this._isActive = false;\n this.linkHandler.deactivate();\n }\n\n /**\n * Returns the fully-qualified root of the current history object.\n * @returns The absolute root of the application.\n */\n getAbsoluteRoot(): string {\n let $location = this.location;\n let origin = createOrigin($location.protocol, $location.hostname, $location.port);\n return `${origin}${this.root}`;\n }\n\n /**\n * Causes a history navigation to occur.\n *\n * @param fragment The history fragment to navigate to.\n * @param options The set of options that specify how the navigation should occur.\n * @return Promise if triggering navigation, otherwise true/false indicating if navigation occurred.\n */\n navigate(fragment?: string, {trigger = true, replace = false} = {}): boolean {\n let location = this.location;\n if (fragment && absoluteUrl.test(fragment)) {\n location.href = fragment;\n return true;\n }\n\n if (!this._isActive) {\n return false;\n }\n\n fragment = this._getFragment(fragment || '');\n\n if (this.fragment === fragment && !replace) {\n return false;\n }\n\n this.fragment = fragment;\n\n let url = this.root + fragment;\n\n // Don't include a trailing slash on the root.\n if (fragment === '' && url !== '/') {\n url = url.slice(0, -1);\n }\n\n // If pushState is available, we use it to set the fragment as a real URL.\n if (this._hasPushState) {\n url = url.replace('//', '/');\n this.history[replace ? 'replaceState' : 'pushState']({}, DOM.title, url);\n } else if (this._wantsHashChange) {\n // If hash changes haven't been explicitly disabled, update the hash\n // fragment to store history.\n updateHash(location, fragment, replace);\n } else {\n // If you've told us that you explicitly don't want fallback hashchange-\n // based history, then `navigate` becomes a page refresh.\n location.assign(url);\n }\n\n if (trigger) {\n return this._loadUrl(fragment);\n }\n\n return true;\n }\n\n /**\n * Causes the history state to navigate back.\n */\n navigateBack(): void {\n this.history.back();\n }\n\n /**\n * Sets the document title.\n */\n setTitle(title: string): void {\n DOM.title = title;\n }\n\n /**\n * Sets a key in the history page state.\n * @param key The key for the value.\n * @param value The value to set.\n */\n setState(key: string, value: any): void {\n let $history = this.history;\n let state = Object.assign({}, $history.state);\n let { pathname, search, hash } = this.location;\n state[key] = value;\n $history.replaceState(state, null, `${pathname}${search}${hash}`);\n }\n\n /**\n * Gets a key in the history page state.\n * @param key The key for the value.\n * @return The value for the key.\n */\n getState(key: string): any {\n let state = Object.assign({}, this.history.state);\n return state[key];\n }\n\n /**\n * Returns the current index in the navigation history.\n * @returns The current index.\n */\n getHistoryIndex(): number {\n let historyIndex = this.getState('HistoryIndex');\n if (historyIndex === undefined) {\n historyIndex = this.history.length - 1;\n this.setState('HistoryIndex', historyIndex);\n }\n return historyIndex;\n }\n\n /**\n * Move to a specific position in the navigation history.\n * @param movement The amount of steps, positive or negative, to move.\n */\n go(movement: number): void {\n this.history.go(movement);\n }\n\n /**\n * @internal\n */\n _getHash(): string {\n return this.location.hash.substr(1);\n }\n\n /**\n * @internal\n */\n _getFragment(fragment: string, forcePushState?: boolean): string {\n let rootUrl: string;\n\n if (!fragment) {\n if (this._hasPushState || !this._wantsHashChange || forcePushState) {\n let location = this.location;\n fragment = location.pathname + location.search;\n rootUrl = this.root.replace(trailingSlash, '');\n if (!fragment.indexOf(rootUrl)) {\n fragment = fragment.substr(rootUrl.length);\n }\n } else {\n fragment = this._getHash();\n }\n }\n\n return '/' + fragment.replace(routeStripper, '');\n }\n\n /**\n * Url change handler.\n * Invoked when current fragment is different with previous fragment\n * @internal\n */\n _checkUrl(): void {\n let current = this._getFragment('');\n if (current !== this.fragment) {\n this._loadUrl('');\n }\n }\n\n /**\n * invoke routeHandler\n * @internal\n */\n _loadUrl(fragmentOverride: string): boolean {\n let fragment = this.fragment = this._getFragment(fragmentOverride);\n\n return this.options.routeHandler ?\n this.options.routeHandler(fragment) :\n false;\n }\n}\n\n// Cached regex for stripping a leading hash/slash and trailing space.\nconst routeStripper = /^#?\\/*|\\s+$/g;\n\n// Cached regex for stripping leading and trailing slashes.\nconst rootStripper = /^\\/+|\\/+$/g;\n\n// Cached regex for removing a trailing slash.\nconst trailingSlash = /\\/$/;\n\n// Cached regex for detecting if a URL is absolute,\n// i.e., starts with a scheme or is scheme-relative.\n// See http://www.ietf.org/rfc/rfc2396.txt section 3.1 for valid scheme format\nconst absoluteUrl = /^([a-z][a-z0-9+\\-.]*:)?\\/\\//i;\n\n// Update the hash location, either replacing the current entry, or adding\n// a new one to the browser history.\nfunction updateHash($location: Location, fragment: string, replace: boolean) {\n if (replace) {\n let href = $location.href.replace(/(javascript:|#).*$/, '');\n $location.replace(href + '#' + fragment);\n } else {\n // Some browsers require that `hash` contains a leading #.\n $location.hash = '#' + fragment;\n }\n}\n\nfunction createOrigin(protocol: string, hostname: string, port: string) {\n return `${protocol}//${hostname}${port ? ':' + port : ''}`;\n}\n","import {History} from 'aurelia-history';\nimport {LinkHandler, DefaultLinkHandler} from './link-handler';\nimport { BrowserHistory } from './browser-history';\n\n/**\n * Configures the plugin by registering BrowserHistory as the implementation of History in the DI container.\n * @param config The FrameworkConfiguration object provided by Aurelia.\n */\nexport function configure(config: Object): void {\n // work around for converting to TS without breaking compat\n const $config = config as any;\n $config.singleton(History, BrowserHistory);\n $config.transient(LinkHandler, DefaultLinkHandler);\n}\n\nexport {\n LinkHandler,\n DefaultLinkHandler,\n BrowserHistory\n};\n",null,null,null,null,null,null,null,null,null,null,null,"import { ViewPortInstruction, RouteConfig, ViewPort, LifecycleArguments, ViewPortComponent } from './interfaces';\nimport { Router } from './router';\nimport { ActivationStrategyType, InternalActivationStrategy } from './activation-strategy';\n\n/**\n * Initialization options for a navigation instruction\n */\nexport interface NavigationInstructionInit {\n fragment: string;\n queryString?: string;\n params?: Record;\n queryParams?: Record;\n config: RouteConfig;\n parentInstruction?: NavigationInstruction;\n previousInstruction?: NavigationInstruction;\n router: Router;\n options?: Object;\n plan?: Record;\n}\n\nexport interface ViewPortInstructionInit {\n name: string;\n strategy: ActivationStrategyType;\n moduleId: string;\n component: ViewPortComponent;\n}\n\n/**\n * Class used to represent an instruction during a navigation.\n */\nexport class NavigationInstruction {\n /**\n * The URL fragment.\n */\n fragment: string;\n\n /**\n * The query string.\n */\n queryString: string;\n\n /**\n * Parameters extracted from the route pattern.\n */\n params: any;\n\n /**\n * Parameters extracted from the query string.\n */\n queryParams: any;\n\n /**\n * The route config for the route matching this instruction.\n */\n config: RouteConfig;\n\n /**\n * The parent instruction, if this instruction was created by a child router.\n */\n parentInstruction: NavigationInstruction;\n\n parentCatchHandler: any;\n\n /**\n * The instruction being replaced by this instruction in the current router.\n */\n previousInstruction: NavigationInstruction;\n\n /**\n * viewPort instructions to used activation.\n */\n viewPortInstructions: Record;\n\n /**\n * The router instance.\n */\n router: Router;\n\n /**\n * Current built viewport plan of this nav instruction\n */\n plan: Record = null;\n\n options: Record = {};\n\n /**@internal */\n lifecycleArgs: LifecycleArguments;\n /**@internal */\n resolve?: (val?: any) => void;\n\n constructor(init: NavigationInstructionInit) {\n Object.assign(this, init);\n\n this.params = this.params || {};\n this.viewPortInstructions = {};\n\n let ancestorParams = [];\n let current: NavigationInstruction = this;\n do {\n let currentParams = Object.assign({}, current.params);\n if (current.config && current.config.hasChildRouter) {\n // remove the param for the injected child route segment\n delete currentParams[current.getWildCardName()];\n }\n\n ancestorParams.unshift(currentParams);\n current = current.parentInstruction;\n } while (current);\n\n let allParams = Object.assign({}, this.queryParams, ...ancestorParams);\n this.lifecycleArgs = [allParams, this.config, this];\n }\n\n /**\n * Gets an array containing this instruction and all child instructions for the current navigation.\n */\n getAllInstructions(): Array {\n let instructions: NavigationInstruction[] = [this];\n let viewPortInstructions: Record = this.viewPortInstructions;\n\n for (let key in viewPortInstructions) {\n let childInstruction = viewPortInstructions[key].childNavigationInstruction;\n if (childInstruction) {\n instructions.push(...childInstruction.getAllInstructions());\n }\n }\n\n return instructions;\n }\n\n /**\n * Gets an array containing the instruction and all child instructions for the previous navigation.\n * Previous instructions are no longer available after navigation completes.\n */\n getAllPreviousInstructions(): Array {\n return this.getAllInstructions().map(c => c.previousInstruction).filter(c => c);\n }\n\n /**\n * Adds a viewPort instruction. Returns the newly created instruction based on parameters\n */\n addViewPortInstruction(initOptions: ViewPortInstructionInit): /*ViewPortInstruction*/ any;\n addViewPortInstruction(viewPortName: string, strategy: ActivationStrategyType, moduleId: string, component: any): /*ViewPortInstruction*/ any;\n addViewPortInstruction(\n nameOrInitOptions: string | ViewPortInstructionInit,\n strategy?: ActivationStrategyType,\n moduleId?: string,\n component?: any\n ): /*ViewPortInstruction*/ any {\n\n let viewPortInstruction: ViewPortInstruction;\n let viewPortName = typeof nameOrInitOptions === 'string' ? nameOrInitOptions : nameOrInitOptions.name;\n const lifecycleArgs = this.lifecycleArgs;\n const config: RouteConfig = Object.assign({}, lifecycleArgs[1], { currentViewPort: viewPortName });\n\n if (typeof nameOrInitOptions === 'string') {\n viewPortInstruction = {\n name: nameOrInitOptions,\n strategy: strategy,\n moduleId: moduleId,\n component: component,\n childRouter: component.childRouter,\n lifecycleArgs: [lifecycleArgs[0], config, lifecycleArgs[2]] as LifecycleArguments\n };\n } else {\n viewPortInstruction = {\n name: viewPortName,\n strategy: nameOrInitOptions.strategy,\n component: nameOrInitOptions.component,\n moduleId: nameOrInitOptions.moduleId,\n childRouter: nameOrInitOptions.component.childRouter,\n lifecycleArgs: [lifecycleArgs[0], config, lifecycleArgs[2]] as LifecycleArguments\n };\n }\n\n return this.viewPortInstructions[viewPortName] = viewPortInstruction;\n }\n\n /**\n * Gets the name of the route pattern's wildcard parameter, if applicable.\n */\n getWildCardName(): string {\n // todo: potential issue, or at least unsafe typings\n let configRoute = this.config.route as string;\n let wildcardIndex = configRoute.lastIndexOf('*');\n return configRoute.substr(wildcardIndex + 1);\n }\n\n /**\n * Gets the path and query string created by filling the route\n * pattern's wildcard parameter with the matching param.\n */\n getWildcardPath(): string {\n let wildcardName = this.getWildCardName();\n let path = this.params[wildcardName] || '';\n let queryString = this.queryString;\n\n if (queryString) {\n path += '?' + queryString;\n }\n\n return path;\n }\n\n /**\n * Gets the instruction's base URL, accounting for wildcard route parameters.\n */\n getBaseUrl(): string {\n let $encodeURI = encodeURI;\n let fragment = decodeURI(this.fragment);\n\n if (fragment === '') {\n let nonEmptyRoute = this.router.routes.find(route => {\n return route.name === this.config.name &&\n route.route !== '';\n });\n if (nonEmptyRoute) {\n fragment = nonEmptyRoute.route as any;\n }\n }\n\n if (!this.params) {\n return $encodeURI(fragment);\n }\n\n let wildcardName = this.getWildCardName();\n let path = this.params[wildcardName] || '';\n\n if (!path) {\n return $encodeURI(fragment);\n }\n\n return $encodeURI(fragment.substr(0, fragment.lastIndexOf(path)));\n }\n\n /**\n * Finalize a viewport instruction\n * @internal\n */\n _commitChanges(waitToSwap: boolean): Promise {\n let router = this.router;\n router.currentInstruction = this;\n\n const previousInstruction = this.previousInstruction;\n if (previousInstruction) {\n previousInstruction.config.navModel.isActive = false;\n }\n\n this.config.navModel.isActive = true;\n\n router.refreshNavigation();\n\n let loads: Promise[] = [];\n let delaySwaps: ISwapPlan[] = [];\n let viewPortInstructions: Record = this.viewPortInstructions;\n\n for (let viewPortName in viewPortInstructions) {\n let viewPortInstruction = viewPortInstructions[viewPortName];\n let viewPort = router.viewPorts[viewPortName];\n\n if (!viewPort) {\n throw new Error(`There was no router-view found in the view for ${viewPortInstruction.moduleId}.`);\n }\n\n let childNavInstruction = viewPortInstruction.childNavigationInstruction;\n if (viewPortInstruction.strategy === InternalActivationStrategy.Replace) {\n if (childNavInstruction && childNavInstruction.parentCatchHandler) {\n loads.push(childNavInstruction._commitChanges(waitToSwap));\n } else {\n if (waitToSwap) {\n delaySwaps.push({ viewPort, viewPortInstruction });\n }\n loads.push(\n viewPort\n .process(viewPortInstruction, waitToSwap)\n .then(() => childNavInstruction\n ? childNavInstruction._commitChanges(waitToSwap)\n : Promise.resolve()\n )\n );\n }\n } else {\n if (childNavInstruction) {\n loads.push(childNavInstruction._commitChanges(waitToSwap));\n }\n }\n }\n\n return Promise\n .all(loads)\n .then(() => {\n delaySwaps.forEach(x => x.viewPort.swap(x.viewPortInstruction));\n return null;\n })\n .then(() => prune(this));\n }\n\n /**@internal */\n _updateTitle(): void {\n let router = this.router;\n let title = this._buildTitle(router.titleSeparator);\n if (title) {\n router.history.setTitle(title);\n }\n }\n\n /**@internal */\n _buildTitle(separator: string = ' | '): string {\n let title = '';\n let childTitles = [];\n let navModelTitle = this.config.navModel.title;\n let instructionRouter = this.router;\n let viewPortInstructions: Record = this.viewPortInstructions;\n\n if (navModelTitle) {\n title = instructionRouter.transformTitle(navModelTitle);\n }\n\n for (let viewPortName in viewPortInstructions) {\n let viewPortInstruction = viewPortInstructions[viewPortName];\n let child_nav_instruction = viewPortInstruction.childNavigationInstruction;\n\n if (child_nav_instruction) {\n let childTitle = child_nav_instruction._buildTitle(separator);\n if (childTitle) {\n childTitles.push(childTitle);\n }\n }\n }\n\n if (childTitles.length) {\n title = childTitles.join(separator) + (title ? separator : '') + title;\n }\n\n if (instructionRouter.title) {\n title += (title ? separator : '') + instructionRouter.transformTitle(instructionRouter.title);\n }\n\n return title;\n }\n}\n\nconst prune = (instruction: NavigationInstruction): void => {\n instruction.previousInstruction = null;\n instruction.plan = null;\n};\n\ninterface ISwapPlan {\n viewPort: ViewPort;\n viewPortInstruction: ViewPortInstruction;\n}\n","import { Router } from './router';\nimport { RouteConfig } from './interfaces';\n\n/**\n* Class for storing and interacting with a route's navigation settings.\n*/\nexport class NavModel {\n\n /**\n * True if this nav item is currently active.\n */\n isActive: boolean = false;\n\n /**\n * The title.\n */\n title: string = null;\n\n /**\n * This nav item's absolute href.\n */\n href: string = null;\n\n /**\n * This nav item's relative href.\n */\n relativeHref: string = null;\n\n /**\n * Data attached to the route at configuration time.\n */\n settings: any = {};\n\n /**\n * The route config.\n */\n config: RouteConfig = null;\n\n /**\n * The router associated with this navigation model.\n */\n router: Router;\n\n order: number | boolean;\n\n constructor(router: Router, relativeHref: string) {\n this.router = router;\n this.relativeHref = relativeHref;\n }\n\n /**\n * Sets the route's title and updates document.title.\n * If the a navigation is in progress, the change will be applied\n * to document.title when the navigation completes.\n *\n * @param title The new title.\n */\n setTitle(title: string): void {\n this.title = title;\n\n if (this.isActive) {\n this.router.updateTitle();\n }\n }\n}\n","import { RouteConfig } from './interfaces';\n\nexport function _normalizeAbsolutePath(path: string, hasPushState: boolean, absolute: boolean = false) {\n if (!hasPushState && path[0] !== '#') {\n path = '#' + path;\n }\n\n if (hasPushState && absolute) {\n path = path.substring(1, path.length);\n }\n\n return path;\n}\n\nexport function _createRootedPath(fragment: string, baseUrl: string, hasPushState: boolean, absolute?: boolean) {\n if (isAbsoluteUrl.test(fragment)) {\n return fragment;\n }\n\n let path = '';\n\n if (baseUrl.length && baseUrl[0] !== '/') {\n path += '/';\n }\n\n path += baseUrl;\n\n if ((!path.length || path[path.length - 1] !== '/') && fragment[0] !== '/') {\n path += '/';\n }\n\n if (path.length && path[path.length - 1] === '/' && fragment[0] === '/') {\n path = path.substring(0, path.length - 1);\n }\n\n return _normalizeAbsolutePath(path + fragment, hasPushState, absolute);\n}\n\nexport function _resolveUrl(fragment: string, baseUrl: string, hasPushState?: boolean) {\n if (isRootedPath.test(fragment)) {\n return _normalizeAbsolutePath(fragment, hasPushState);\n }\n\n return _createRootedPath(fragment, baseUrl, hasPushState);\n}\n\nexport function _ensureArrayWithSingleRoutePerConfig(config: RouteConfig) {\n let routeConfigs = [];\n\n if (Array.isArray(config.route)) {\n for (let i = 0, ii = config.route.length; i < ii; ++i) {\n let current = Object.assign({}, config);\n current.route = config.route[i];\n routeConfigs.push(current);\n }\n } else {\n routeConfigs.push(Object.assign({}, config));\n }\n\n return routeConfigs;\n}\n\nconst isRootedPath = /^#?\\//;\nconst isAbsoluteUrl = /^([a-z][a-z0-9+\\-.]*:)?\\/\\//i;\n","import { RouteConfig, PipelineStep, RouteConfigSpecifier } from './interfaces';\nimport { _ensureArrayWithSingleRoutePerConfig } from './util';\nimport { Router } from './router';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { PipelineSlotName } from './pipeline-slot-name';\n\n/**\n * Class used to configure a [[Router]] instance.\n *\n * @constructor\n */\nexport class RouterConfiguration {\n instructions: Array<(router: Router) => void> = [];\n options: {\n [key: string]: any;\n compareQueryParams?: boolean;\n root?: string;\n pushState?: boolean;\n hashChange?: boolean;\n silent?: boolean;\n } = {};\n pipelineSteps: Array<{ name: string, step: Function | PipelineStep }> = [];\n title: string;\n titleSeparator: string;\n unknownRouteConfig: RouteConfigSpecifier;\n viewPortDefaults: Record;\n\n /**@internal */\n _fallbackRoute: string;\n\n /**\n * Adds a step to be run during the [[Router]]'s navigation pipeline.\n *\n * @param name The name of the pipeline slot to insert the step into.\n * @param step The pipeline step.\n * @chainable\n */\n addPipelineStep(name: string, step: Function | PipelineStep): RouterConfiguration {\n if (step === null || step === undefined) {\n throw new Error('Pipeline step cannot be null or undefined.');\n }\n this.pipelineSteps.push({ name, step });\n return this;\n }\n\n /**\n * Adds a step to be run during the [[Router]]'s authorize pipeline slot.\n *\n * @param step The pipeline step.\n * @chainable\n */\n addAuthorizeStep(step: Function | PipelineStep): RouterConfiguration {\n return this.addPipelineStep(PipelineSlotName.Authorize, step);\n }\n\n /**\n * Adds a step to be run during the [[Router]]'s preActivate pipeline slot.\n *\n * @param step The pipeline step.\n * @chainable\n */\n addPreActivateStep(step: Function | PipelineStep): RouterConfiguration {\n return this.addPipelineStep(PipelineSlotName.PreActivate, step);\n }\n\n /**\n * Adds a step to be run during the [[Router]]'s preRender pipeline slot.\n *\n * @param step The pipeline step.\n * @chainable\n */\n addPreRenderStep(step: Function | PipelineStep): RouterConfiguration {\n return this.addPipelineStep(PipelineSlotName.PreRender, step);\n }\n\n /**\n * Adds a step to be run during the [[Router]]'s postRender pipeline slot.\n *\n * @param step The pipeline step.\n * @chainable\n */\n addPostRenderStep(step: Function | PipelineStep): RouterConfiguration {\n return this.addPipelineStep(PipelineSlotName.PostRender, step);\n }\n\n /**\n * Configures a route that will be used if there is no previous location available on navigation cancellation.\n *\n * @param fragment The URL fragment to use as the navigation destination.\n * @chainable\n */\n fallbackRoute(fragment: string): RouterConfiguration {\n this._fallbackRoute = fragment;\n return this;\n }\n\n /**\n * Maps one or more routes to be registered with the router.\n *\n * @param route The [[RouteConfig]] to map, or an array of [[RouteConfig]] to map.\n * @chainable\n */\n map(route: RouteConfig | RouteConfig[]): RouterConfiguration {\n if (Array.isArray(route)) {\n route.forEach(r => this.map(r));\n return this;\n }\n\n return this.mapRoute(route);\n }\n\n /**\n * Configures defaults to use for any view ports.\n *\n * @param viewPortConfig a view port configuration object to use as a\n * default, of the form { viewPortName: { moduleId } }.\n * @chainable\n */\n useViewPortDefaults(viewPortConfig: Record): RouterConfiguration {\n this.viewPortDefaults = viewPortConfig;\n return this;\n }\n\n /**\n * Maps a single route to be registered with the router.\n *\n * @param route The [[RouteConfig]] to map.\n * @chainable\n */\n mapRoute(config: RouteConfig): RouterConfiguration {\n this.instructions.push(router => {\n let routeConfigs = _ensureArrayWithSingleRoutePerConfig(config);\n\n let navModel;\n for (let i = 0, ii = routeConfigs.length; i < ii; ++i) {\n let routeConfig = routeConfigs[i];\n routeConfig.settings = routeConfig.settings || {};\n if (!navModel) {\n navModel = router.createNavModel(routeConfig);\n }\n\n router.addRoute(routeConfig, navModel);\n }\n });\n\n return this;\n }\n\n /**\n * Registers an unknown route handler to be run when the URL fragment doesn't match any registered routes.\n *\n * @param config A string containing a moduleId to load, or a [[RouteConfig]], or a function that takes the\n * [[NavigationInstruction]] and selects a moduleId to load.\n * @chainable\n */\n mapUnknownRoutes(config: RouteConfigSpecifier): RouterConfiguration {\n this.unknownRouteConfig = config;\n return this;\n }\n\n /**\n * Applies the current configuration to the specified [[Router]].\n *\n * @param router The [[Router]] to apply the configuration to.\n */\n exportToRouter(router: Router): void {\n let instructions = this.instructions;\n for (let i = 0, ii = instructions.length; i < ii; ++i) {\n instructions[i](router);\n }\n\n let { title, titleSeparator, unknownRouteConfig, _fallbackRoute, viewPortDefaults } = this;\n\n if (title) {\n router.title = title;\n }\n\n if (titleSeparator) {\n router.titleSeparator = titleSeparator;\n }\n\n if (unknownRouteConfig) {\n router.handleUnknownRoutes(unknownRouteConfig);\n }\n\n if (_fallbackRoute) {\n router.fallbackRoute = _fallbackRoute;\n }\n\n if (viewPortDefaults) {\n router.useViewPortDefaults(viewPortDefaults);\n }\n\n Object.assign(router.options, this.options);\n\n let pipelineSteps = this.pipelineSteps;\n let pipelineStepCount = pipelineSteps.length;\n if (pipelineStepCount) {\n if (!router.isRoot) {\n throw new Error('Pipeline steps can only be added to the root router');\n }\n\n let pipelineProvider = router.pipelineProvider;\n for (let i = 0, ii = pipelineStepCount; i < ii; ++i) {\n let { name, step } = pipelineSteps[i];\n pipelineProvider.addStep(name, step);\n }\n }\n }\n}\n","import { RouteRecognizer, RouteHandler, ConfigurableRoute, State, RecognizedRoute } from 'aurelia-route-recognizer';\nimport { Container } from 'aurelia-dependency-injection';\nimport { History, NavigationOptions } from 'aurelia-history';\nimport { NavigationInstruction, NavigationInstructionInit } from './navigation-instruction';\nimport { NavModel } from './nav-model';\nimport { RouterConfiguration } from './router-configuration';\nimport {\n _ensureArrayWithSingleRoutePerConfig,\n _normalizeAbsolutePath,\n _createRootedPath,\n _resolveUrl\n} from './util';\nimport { RouteConfig, RouteConfigSpecifier, ViewPortInstruction } from './interfaces';\nimport { PipelineProvider } from './pipeline-provider';\n\n/**@internal */\ndeclare module 'aurelia-history' {\n interface History {\n // This is wrong, as it's an implementation detail from aurelia-history-browser\n // but we are poking it in here so probably will need to make it official in `aurelia-history`\n /**\n * A private flag of Aurelia History implementation to indicate if push state should be used\n */\n _hasPushState: boolean;\n\n previousLocation: string;\n }\n}\n\n/**@internal */\ndeclare module 'aurelia-route-recognizer' {\n interface State {\n types: {\n dynamics: DynamicSegment;\n stars: StarSegment;\n };\n }\n\n interface RouteHandler {\n navigationStrategy?: (instruction: NavigationInstruction) => any;\n }\n\n interface RecognizedRoute {\n config?: RouteConfig;\n queryParams?: Record;\n }\n}\n\ntype RouterConfigurationResolution = RouterConfiguration | ((cfg: RouterConfiguration) => void | RouterConfiguration | Promise);\n\n/**\n * The primary class responsible for handling routing and navigation.\n */\nexport class Router {\n\n /**\n * Container associated with this router. Also used to create child container for creating child router.\n */\n container: Container;\n\n /**\n * History instance of Aurelia abstract class for wrapping platform history global object\n */\n history: History;\n\n /**\n * A registry of registered viewport. Will be used to handle process navigation instruction route loading\n * and dom swapping\n */\n viewPorts: Record;\n\n /**\n * List of route configs registered with this router\n */\n routes: RouteConfig[];\n\n /**\n * The [[Router]]'s current base URL, typically based on the [[Router.currentInstruction]].\n */\n baseUrl: string;\n\n /**\n * If defined, used in generation of document title for [[Router]]'s routes.\n */\n title: string | undefined;\n\n /**\n * The separator used in the document title between [[Router]]'s routes.\n */\n titleSeparator: string | undefined;\n\n /**\n * True if the [[Router]] has been configured.\n */\n isConfigured: boolean;\n\n /**\n * True if the [[Router]] is currently processing a navigation.\n */\n isNavigating: boolean;\n\n /**\n * True if the [[Router]] is navigating due to explicit call to navigate function(s).\n */\n isExplicitNavigation: boolean;\n\n /**\n * True if the [[Router]] is navigating due to explicit call to navigateBack function.\n */\n isExplicitNavigationBack: boolean;\n\n /**\n * True if the [[Router]] is navigating into the app for the first time in the browser session.\n */\n isNavigatingFirst: boolean;\n\n /**\n * True if the [[Router]] is navigating to a page instance not in the browser session history.\n */\n isNavigatingNew: boolean;\n\n /**\n * True if the [[Router]] is navigating forward in the browser session history.\n */\n isNavigatingForward: boolean;\n\n /**\n * True if the [[Router]] is navigating back in the browser session history.\n */\n isNavigatingBack: boolean;\n\n /**\n * True if the [[Router]] is navigating due to a browser refresh.\n */\n isNavigatingRefresh: boolean;\n\n /**\n * True if the previous instruction successfully completed the CanDeactivatePreviousStep in the current navigation.\n */\n couldDeactivate: boolean;\n\n /**\n * The currently active navigation tracker.\n */\n currentNavigationTracker: number;\n\n /**\n * The navigation models for routes that specified [[RouteConfig.nav]].\n */\n navigation: NavModel[];\n\n /**\n * The currently active navigation instruction.\n */\n currentInstruction: NavigationInstruction;\n\n /**\n * The parent router, or null if this instance is not a child router.\n */\n parent: Router = null;\n\n options: any = {};\n\n /**\n * The defaults used when a viewport lacks specified content\n */\n viewPortDefaults: Record = {};\n\n /**@internal */\n catchAllHandler: (instruction: NavigationInstruction) => NavigationInstruction | Promise;\n /**@internal */\n fallbackRoute: string;\n /**@internal */\n pipelineProvider: PipelineProvider;\n /**@internal */\n _fallbackOrder: number;\n /**@internal */\n _recognizer: RouteRecognizer;\n /**@internal */\n _childRecognizer: RouteRecognizer;\n /**@internal */\n _configuredPromise: Promise;\n /**@internal */\n _resolveConfiguredPromise: (value?: any) => void;\n\n /**\n * Extension point to transform the document title before it is built and displayed.\n * By default, child routers delegate to the parent router, and the app router\n * returns the title unchanged.\n */\n transformTitle: (title: string) => string = (title: string) => {\n if (this.parent) {\n return this.parent.transformTitle(title);\n }\n return title;\n }\n\n /**\n * @param container The [[Container]] to use when child routers.\n * @param history The [[History]] implementation to delegate navigation requests to.\n */\n constructor(container: Container, history: History) {\n this.container = container;\n this.history = history;\n this.reset();\n }\n\n /**\n * Fully resets the router's internal state. Primarily used internally by the framework when multiple calls to setRoot are made.\n * Use with caution (actually, avoid using this). Do not use this to simply change your navigation model.\n */\n reset() {\n this.viewPorts = {};\n this.routes = [];\n this.baseUrl = '';\n this.isConfigured = false;\n this.isNavigating = false;\n this.isExplicitNavigation = false;\n this.isExplicitNavigationBack = false;\n this.isNavigatingFirst = false;\n this.isNavigatingNew = false;\n this.isNavigatingRefresh = false;\n this.isNavigatingForward = false;\n this.isNavigatingBack = false;\n this.couldDeactivate = false;\n this.navigation = [];\n this.currentInstruction = null;\n this.viewPortDefaults = {};\n this._fallbackOrder = 100;\n this._recognizer = new RouteRecognizer();\n this._childRecognizer = new RouteRecognizer();\n this._configuredPromise = new Promise(resolve => {\n this._resolveConfiguredPromise = resolve;\n });\n }\n\n /**\n * Gets a value indicating whether or not this [[Router]] is the root in the router tree. I.e., it has no parent.\n */\n get isRoot(): boolean {\n return !this.parent;\n }\n\n /**\n * Registers a viewPort to be used as a rendering target for activated routes.\n *\n * @param viewPort The viewPort.\n * @param name The name of the viewPort. 'default' if unspecified.\n */\n registerViewPort(viewPort: /*ViewPort*/any, name?: string): void {\n name = name || 'default';\n this.viewPorts[name] = viewPort;\n }\n\n /**\n * Returns a Promise that resolves when the router is configured.\n */\n ensureConfigured(): Promise {\n return this._configuredPromise;\n }\n\n /**\n * Configures the router.\n *\n * @param callbackOrConfig The [[RouterConfiguration]] or a callback that takes a [[RouterConfiguration]].\n */\n configure(callbackOrConfig: RouterConfiguration | ((config: RouterConfiguration) => RouterConfiguration)): Promise {\n this.isConfigured = true;\n\n let result: RouterConfigurationResolution = callbackOrConfig as RouterConfiguration;\n let config: RouterConfiguration;\n if (typeof callbackOrConfig === 'function') {\n config = new RouterConfiguration();\n result = callbackOrConfig(config);\n }\n\n return Promise\n .resolve(result)\n .then((c) => {\n if (c && (c as RouterConfiguration).exportToRouter) {\n config = c;\n }\n\n config.exportToRouter(this);\n this.isConfigured = true;\n this._resolveConfiguredPromise();\n });\n }\n\n /**\n * Navigates to a new location.\n *\n * @param fragment The URL fragment to use as the navigation destination.\n * @param options The navigation options.\n */\n navigate(fragment: string, options?: NavigationOptions): boolean {\n if (!this.isConfigured && this.parent) {\n return this.parent.navigate(fragment, options);\n }\n\n this.isExplicitNavigation = true;\n return this.history.navigate(_resolveUrl(fragment, this.baseUrl, this.history._hasPushState), options);\n }\n\n /**\n * Navigates to a new location corresponding to the route and params specified. Equivallent to [[Router.generate]] followed\n * by [[Router.navigate]].\n *\n * @param route The name of the route to use when generating the navigation location.\n * @param params The route parameters to be used when populating the route pattern.\n * @param options The navigation options.\n */\n navigateToRoute(route: string, params?: any, options?: NavigationOptions): boolean {\n let path = this.generate(route, params);\n return this.navigate(path, options);\n }\n\n /**\n * Navigates back to the most recent location in history.\n */\n navigateBack(): void {\n this.isExplicitNavigationBack = true;\n this.history.navigateBack();\n }\n\n /**\n * Creates a child router of the current router.\n *\n * @param container The [[Container]] to provide to the child router. Uses the current [[Router]]'s [[Container]] if unspecified.\n * @returns {Router} The new child Router.\n */\n createChild(container?: Container): Router {\n let childRouter = new Router(container || this.container.createChild(), this.history);\n childRouter.parent = this;\n return childRouter;\n }\n\n /**\n * Generates a URL fragment matching the specified route pattern.\n *\n * @param name The name of the route whose pattern should be used to generate the fragment.\n * @param params The route params to be used to populate the route pattern.\n * @param options If options.absolute = true, then absolute url will be generated; otherwise, it will be relative url.\n * @returns {string} A string containing the generated URL fragment.\n */\n generate(nameOrRoute: string | RouteConfig, params: any = {}, options: any = {}): string {\n // A child recognizer generates routes for potential child routes. Any potential child route is added\n // to the childRoute property of params for the childRouter to recognize. When generating routes, we\n // use the childRecognizer when childRoute params are available to generate a child router enabled route.\n let recognizer = 'childRoute' in params ? this._childRecognizer : this._recognizer;\n let hasRoute = recognizer.hasRoute(nameOrRoute as string | RouteHandler);\n if (!hasRoute) {\n if (this.parent) {\n return this.parent.generate(nameOrRoute, params, options);\n }\n throw new Error(`A route with name '${nameOrRoute}' could not be found. Check that \\`name: '${nameOrRoute}'\\` was specified in the route's config.`);\n }\n let path = recognizer.generate(nameOrRoute as string | RouteHandler, params);\n let rootedPath = _createRootedPath(path, this.baseUrl, this.history._hasPushState, options.absolute);\n return options.absolute ? `${this.history.getAbsoluteRoot()}${rootedPath}` : rootedPath;\n }\n\n /**\n * Creates a [[NavModel]] for the specified route config.\n *\n * @param config The route config.\n */\n createNavModel(config: RouteConfig): NavModel {\n let navModel = new NavModel(\n this,\n 'href' in config\n ? config.href\n // potential error when config.route is a string[] ?\n : config.route as string);\n navModel.title = config.title;\n navModel.order = config.nav;\n navModel.href = config.href;\n navModel.settings = config.settings;\n navModel.config = config;\n\n return navModel;\n }\n\n /**\n * Registers a new route with the router.\n *\n * @param config The [[RouteConfig]].\n * @param navModel The [[NavModel]] to use for the route. May be omitted for single-pattern routes.\n */\n addRoute(config: RouteConfig, navModel?: NavModel): void {\n if (Array.isArray(config.route)) {\n let routeConfigs = _ensureArrayWithSingleRoutePerConfig(config);\n // the following is wrong. todo: fix this after TS refactoring release\n routeConfigs.forEach(this.addRoute.bind(this));\n return;\n }\n\n validateRouteConfig(config);\n\n if (!('viewPorts' in config) && !config.navigationStrategy) {\n config.viewPorts = {\n 'default': {\n moduleId: config.moduleId,\n view: config.view\n }\n };\n }\n\n if (!navModel) {\n navModel = this.createNavModel(config);\n }\n\n this.routes.push(config);\n\n let path = config.route;\n if (path.charAt(0) === '/') {\n path = path.substr(1);\n }\n let caseSensitive = config.caseSensitive === true;\n let state: State = this._recognizer.add({\n path: path,\n handler: config as RouteHandler,\n caseSensitive: caseSensitive\n } as ConfigurableRoute);\n\n if (path) {\n let settings = config.settings;\n delete config.settings;\n let withChild = JSON.parse(JSON.stringify(config));\n config.settings = settings;\n withChild.route = `${path}/*childRoute`;\n withChild.hasChildRouter = true;\n this._childRecognizer.add({\n path: withChild.route,\n handler: withChild,\n caseSensitive: caseSensitive\n });\n\n withChild.navModel = navModel;\n withChild.settings = config.settings;\n withChild.navigationStrategy = config.navigationStrategy;\n }\n\n config.navModel = navModel;\n\n let navigation = this.navigation;\n\n if ((navModel.order || navModel.order === 0) && navigation.indexOf(navModel) === -1) {\n if ((!navModel.href && navModel.href !== '') && (state.types.dynamics || state.types.stars)) {\n throw new Error('Invalid route config for \"' + config.route + '\" : dynamic routes must specify an \"href:\" to be included in the navigation model.');\n }\n\n if (typeof navModel.order !== 'number') {\n navModel.order = ++this._fallbackOrder;\n }\n\n navigation.push(navModel);\n // this is a potential error / inconsistency between browsers\n //\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort\n // If compareFunction(a, b) returns 0, leave a and b unchanged with respect to each other,\n // but sorted with respect to all different elements.\n // Note: the ECMAscript standard does not guarantee this behaviour,\n // and thus not all browsers (e.g. Mozilla versions dating back to at least 2003) respect this.\n navigation.sort((a, b) => a.order - b.order);\n }\n }\n\n /**\n * Gets a value indicating whether or not this [[Router]] or one of its ancestors has a route registered with the specified name.\n *\n * @param name The name of the route to check.\n */\n hasRoute(name: string): boolean {\n return !!(this._recognizer.hasRoute(name) || this.parent && this.parent.hasRoute(name));\n }\n\n /**\n * Gets a value indicating whether or not this [[Router]] has a route registered with the specified name.\n *\n * @param name The name of the route to check.\n */\n hasOwnRoute(name: string): boolean {\n return this._recognizer.hasRoute(name);\n }\n\n /**\n * Register a handler to use when the incoming URL fragment doesn't match any registered routes.\n *\n * @param config The moduleId, or a function that selects the moduleId, or a [[RouteConfig]].\n */\n handleUnknownRoutes(config?: RouteConfigSpecifier): void {\n if (!config) {\n throw new Error('Invalid unknown route handler');\n }\n\n this.catchAllHandler = instruction => {\n return this\n ._createRouteConfig(config, instruction)\n .then(c => {\n instruction.config = c;\n return instruction;\n });\n };\n }\n\n /**\n * Updates the document title using the current navigation instruction.\n */\n updateTitle(): void {\n let parentRouter = this.parent;\n if (parentRouter) {\n return parentRouter.updateTitle();\n }\n\n let currentInstruction = this.currentInstruction;\n if (currentInstruction) {\n currentInstruction._updateTitle();\n }\n return undefined;\n }\n\n /**\n * Updates the navigation routes with hrefs relative to the current location.\n * Note: This method will likely move to a plugin in a future release.\n */\n refreshNavigation(): void {\n let nav = this.navigation;\n\n for (let i = 0, length = nav.length; i < length; i++) {\n let current = nav[i];\n if (!current.config.href) {\n current.href = _createRootedPath(current.relativeHref, this.baseUrl, this.history._hasPushState);\n } else {\n current.href = _normalizeAbsolutePath(current.config.href, this.history._hasPushState);\n }\n }\n }\n\n /**\n * Sets the default configuration for the view ports. This specifies how to\n * populate a view port for which no module is specified. The default is\n * an empty view/view-model pair.\n */\n useViewPortDefaults($viewPortDefaults: Record): void {\n // a workaround to have strong typings while not requiring to expose interface ViewPortInstruction\n let viewPortDefaults: Record = $viewPortDefaults;\n for (let viewPortName in viewPortDefaults) {\n let viewPortConfig = viewPortDefaults[viewPortName];\n this.viewPortDefaults[viewPortName] = {\n moduleId: viewPortConfig.moduleId\n };\n }\n }\n\n /**@internal */\n _refreshBaseUrl(): void {\n let parentRouter = this.parent;\n if (parentRouter) {\n this.baseUrl = generateBaseUrl(parentRouter, parentRouter.currentInstruction);\n }\n }\n\n /**@internal */\n _createNavigationInstruction(url: string = '', parentInstruction: NavigationInstruction = null): Promise {\n let fragment = url;\n let queryString = '';\n\n let queryIndex = url.indexOf('?');\n if (queryIndex !== -1) {\n fragment = url.substr(0, queryIndex);\n queryString = url.substr(queryIndex + 1);\n }\n\n let urlRecognizationResults = this._recognizer.recognize(url) as IRouteRecognizationResults;\n if (!urlRecognizationResults || !urlRecognizationResults.length) {\n urlRecognizationResults = this._childRecognizer.recognize(url) as IRouteRecognizationResults;\n }\n\n let instructionInit: NavigationInstructionInit = {\n fragment,\n queryString,\n config: null,\n parentInstruction,\n previousInstruction: this.currentInstruction,\n router: this,\n options: {\n compareQueryParams: this.options.compareQueryParams\n }\n };\n\n let result: Promise;\n\n if (urlRecognizationResults && urlRecognizationResults.length) {\n let first = urlRecognizationResults[0];\n let instruction = new NavigationInstruction(Object.assign({}, instructionInit, {\n params: first.params,\n queryParams: first.queryParams || urlRecognizationResults.queryParams,\n config: first.config || first.handler\n }));\n\n if (typeof first.handler === 'function') {\n result = evaluateNavigationStrategy(instruction, first.handler, first);\n } else if (first.handler && typeof first.handler.navigationStrategy === 'function') {\n result = evaluateNavigationStrategy(instruction, first.handler.navigationStrategy, first.handler);\n } else {\n result = Promise.resolve(instruction);\n }\n } else if (this.catchAllHandler) {\n let instruction = new NavigationInstruction(Object.assign({}, instructionInit, {\n params: { path: fragment },\n queryParams: urlRecognizationResults ? urlRecognizationResults.queryParams : {},\n config: null // config will be created by the catchAllHandler\n }));\n\n result = evaluateNavigationStrategy(instruction, this.catchAllHandler);\n } else if (this.parent) {\n let router = this._parentCatchAllHandler(this.parent);\n\n if (router) {\n let newParentInstruction = this._findParentInstructionFromRouter(router, parentInstruction);\n\n let instruction = new NavigationInstruction(Object.assign({}, instructionInit, {\n params: { path: fragment },\n queryParams: urlRecognizationResults ? urlRecognizationResults.queryParams : {},\n router: router,\n parentInstruction: newParentInstruction,\n parentCatchHandler: true,\n config: null // config will be created by the chained parent catchAllHandler\n }));\n\n result = evaluateNavigationStrategy(instruction, router.catchAllHandler);\n }\n }\n\n if (result && parentInstruction) {\n this.baseUrl = generateBaseUrl(this.parent, parentInstruction);\n }\n\n return result || Promise.reject(new Error(`Route not found: ${url}`));\n }\n\n /**@internal */\n _findParentInstructionFromRouter(router: Router, instruction: NavigationInstruction): NavigationInstruction {\n if (instruction.router === router) {\n instruction.fragment = router.baseUrl; // need to change the fragment in case of a redirect instead of moduleId\n return instruction;\n } else if (instruction.parentInstruction) {\n return this._findParentInstructionFromRouter(router, instruction.parentInstruction);\n }\n return undefined;\n }\n\n /**@internal */\n _parentCatchAllHandler(router: Router): Router | false {\n if (router.catchAllHandler) {\n return router;\n } else if (router.parent) {\n return this._parentCatchAllHandler(router.parent);\n }\n return false;\n }\n\n /**\n * @internal\n */\n _createRouteConfig(config: RouteConfigSpecifier, instruction: NavigationInstruction): Promise {\n return Promise\n .resolve(config)\n .then((c: any) => {\n if (typeof c === 'string') {\n return { moduleId: c } as RouteConfig;\n } else if (typeof c === 'function') {\n return c(instruction);\n }\n\n return c;\n })\n // typing here could be either RouteConfig or RedirectConfig\n // but temporarily treat both as RouteConfig\n // todo: improve typings precision\n .then((c: string | RouteConfig) => typeof c === 'string' ? { moduleId: c } as RouteConfig : c)\n .then((c: RouteConfig) => {\n c.route = instruction.params.path;\n validateRouteConfig(c);\n\n if (!c.navModel) {\n c.navModel = this.createNavModel(c);\n }\n\n return c;\n });\n }\n}\n\n/* @internal exported for unit testing */\nexport const generateBaseUrl = (router: Router, instruction: NavigationInstruction): string => {\n return `${router.baseUrl || ''}${instruction.getBaseUrl() || ''}`;\n};\n\n/* @internal exported for unit testing */\nexport const validateRouteConfig = (config: RouteConfig): void => {\n if (typeof config !== 'object') {\n throw new Error('Invalid Route Config');\n }\n\n if (typeof config.route !== 'string') {\n let name = config.name || '(no name)';\n throw new Error('Invalid Route Config for \"' + name + '\": You must specify a \"route:\" pattern.');\n }\n\n if (!('redirect' in config || config.moduleId || config.navigationStrategy || config.viewPorts)) {\n throw new Error('Invalid Route Config for \"' + config.route + '\": You must specify a \"moduleId:\", \"redirect:\", \"navigationStrategy:\", or \"viewPorts:\".');\n }\n};\n\n/* @internal exported for unit testing */\nexport const evaluateNavigationStrategy = (\n instruction: NavigationInstruction,\n evaluator: Function,\n context?: any\n): Promise => {\n return Promise\n .resolve(evaluator.call(context, instruction))\n .then(() => {\n if (!('viewPorts' in instruction.config)) {\n instruction.config.viewPorts = {\n 'default': {\n moduleId: instruction.config.moduleId\n }\n };\n }\n\n return instruction;\n });\n};\n\ninterface IRouteRecognizationResults extends Array {\n queryParams: Record;\n}\n","import { PipelineStatus } from './pipeline-status';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { Next, StepRunnerFunction, NextCompletionHandler } from './interfaces';\n\n/**@internal exported for unit testing */\nexport const createNextFn = (instruction: NavigationInstruction, steps: StepRunnerFunction[]): Next => {\n let index = -1;\n const next: Next = function() {\n index++;\n\n if (index < steps.length) {\n let currentStep = steps[index];\n\n try {\n return currentStep(instruction, next);\n } catch (e) {\n return next.reject(e);\n }\n } else {\n return next.complete();\n }\n } as Next;\n\n next.complete = createCompletionHandler(next, PipelineStatus.Completed);\n next.cancel = createCompletionHandler(next, PipelineStatus.Canceled);\n next.reject = createCompletionHandler(next, PipelineStatus.Rejected);\n\n return next;\n};\n\n/**@internal exported for unit testing */\nexport const createCompletionHandler = (next: Next, status: PipelineStatus): NextCompletionHandler => {\n return (output: any) => Promise\n .resolve({\n status,\n output,\n completed: status === PipelineStatus.Completed\n });\n};\n","import { PipelineStep, PipelineResult, Next, StepRunnerFunction, IPipelineSlot } from './interfaces';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { createNextFn } from './next';\n\n/**\n * The class responsible for managing and processing the navigation pipeline.\n */\nexport class Pipeline {\n /**\n * The pipeline steps. And steps added via addStep will be converted to a function\n * The actualy running functions with correct step contexts of this pipeline\n */\n steps: StepRunnerFunction[] = [];\n\n /**\n * Adds a step to the pipeline.\n *\n * @param step The pipeline step.\n */\n addStep(step: StepRunnerFunction | PipelineStep | IPipelineSlot): Pipeline {\n let run;\n\n if (typeof step === 'function') {\n run = step;\n } else if (typeof step.getSteps === 'function') {\n // getSteps is to enable support open slots\n // where devs can add multiple steps into the same slot name\n let steps = step.getSteps();\n for (let i = 0, l = steps.length; i < l; i++) {\n this.addStep(steps[i]);\n }\n\n return this;\n } else {\n run = (step as PipelineStep).run.bind(step);\n }\n\n this.steps.push(run);\n\n return this;\n }\n\n /**\n * Runs the pipeline.\n *\n * @param instruction The navigation instruction to process.\n */\n run(instruction: NavigationInstruction): Promise {\n const nextFn = createNextFn(instruction, this.steps);\n return nextFn();\n }\n}\n","import { NavigationOptions } from 'aurelia-history';\nimport { Router } from './router';\n\n/**@internal */\ndeclare module 'aurelia-history' {\n interface NavigationOptions {\n useAppRouter?: boolean;\n }\n}\n\n/**\n* When a navigation command is encountered, the current navigation\n* will be cancelled and control will be passed to the navigation\n* command so it can determine the correct action.\n*/\nexport interface NavigationCommand {\n navigate: (router: Router) => void;\n /**@internal */\n shouldContinueProcessing?: boolean;\n /**@internal */\n setRouter?: (router: Router) => void;\n}\n\n/**\n* Determines if the provided object is a navigation command.\n* A navigation command is anything with a navigate method.\n*\n* @param obj The object to check.\n*/\nexport function isNavigationCommand(obj: any): obj is NavigationCommand {\n return obj && typeof obj.navigate === 'function';\n}\n\n/**\n* Used during the activation lifecycle to cause a redirect.\n*/\nexport class Redirect implements NavigationCommand {\n\n url: string;\n /**@internal */\n options: NavigationOptions;\n /**@internal */\n shouldContinueProcessing: boolean;\n\n private router: Router;\n\n /**\n * @param url The URL fragment to use as the navigation destination.\n * @param options The navigation options.\n */\n constructor(url: string, options: NavigationOptions = {}) {\n this.url = url;\n this.options = Object.assign({ trigger: true, replace: true }, options);\n this.shouldContinueProcessing = false;\n }\n\n /**\n * Called by the activation system to set the child router.\n *\n * @param router The router.\n */\n setRouter(router: Router): void {\n this.router = router;\n }\n\n /**\n * Called by the navigation pipeline to navigate.\n *\n * @param appRouter The router to be redirected.\n */\n navigate(appRouter: Router): void {\n let navigatingRouter = this.options.useAppRouter ? appRouter : (this.router || appRouter);\n navigatingRouter.navigate(this.url, this.options);\n }\n}\n\n/**\n * Used during the activation lifecycle to cause a redirect to a named route.\n */\nexport class RedirectToRoute implements NavigationCommand {\n\n route: string;\n params: any;\n /**@internal */\n options: NavigationOptions;\n\n /**@internal */\n shouldContinueProcessing: boolean;\n\n /**@internal */\n router: Router;\n\n /**\n * @param route The name of the route.\n * @param params The parameters to be sent to the activation method.\n * @param options The options to use for navigation.\n */\n constructor(route: string, params: any = {}, options: NavigationOptions = {}) {\n this.route = route;\n this.params = params;\n this.options = Object.assign({ trigger: true, replace: true }, options);\n this.shouldContinueProcessing = false;\n }\n\n /**\n * Called by the activation system to set the child router.\n *\n * @param router The router.\n */\n setRouter(router: Router): void {\n this.router = router;\n }\n\n /**\n * Called by the navigation pipeline to navigate.\n *\n * @param appRouter The router to be redirected.\n */\n navigate(appRouter: Router): void {\n let navigatingRouter = this.options.useAppRouter ? appRouter : (this.router || appRouter);\n navigatingRouter.navigateToRoute(this.route, this.params, this.options);\n }\n}\n","import { ViewPortPlan, ViewPortInstruction, RouteConfig, ViewPort } from './interfaces';\nimport { Redirect } from './navigation-commands';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { InternalActivationStrategy, ActivationStrategyType } from './activation-strategy';\n\ntype ViewPortPlansRecord = Record;\n\n/**\n * @internal exported for unit testing\n */\nexport function _buildNavigationPlan(\n instruction: NavigationInstruction,\n forceLifecycleMinimum?: boolean\n): Promise {\n let config = instruction.config;\n\n if ('redirect' in config) {\n return buildRedirectPlan(instruction);\n }\n\n const prevInstruction = instruction.previousInstruction;\n const defaultViewPortConfigs = instruction.router.viewPortDefaults;\n\n if (prevInstruction) {\n return buildTransitionPlans(instruction, prevInstruction, defaultViewPortConfigs, forceLifecycleMinimum);\n }\n\n // first navigation, only need to prepare a few information for each viewport plan\n const viewPortPlans: ViewPortPlansRecord = {};\n let viewPortConfigs = config.viewPorts;\n for (let viewPortName in viewPortConfigs) {\n let viewPortConfig = viewPortConfigs[viewPortName];\n if (viewPortConfig.moduleId === null && viewPortName in defaultViewPortConfigs) {\n viewPortConfig = defaultViewPortConfigs[viewPortName];\n }\n viewPortPlans[viewPortName] = {\n name: viewPortName,\n strategy: InternalActivationStrategy.Replace,\n config: viewPortConfig\n };\n }\n\n return Promise.resolve(viewPortPlans);\n}\n\n/**\n * Build redirect plan based on config of a navigation instruction\n * @internal exported for unit testing\n */\nexport const buildRedirectPlan = (instruction: NavigationInstruction) => {\n const config = instruction.config;\n const router = instruction.router;\n return router\n ._createNavigationInstruction(config.redirect)\n .then(redirectInstruction => {\n\n const params: Record = {};\n const originalInstructionParams = instruction.params;\n const redirectInstructionParams = redirectInstruction.params;\n\n for (let key in redirectInstructionParams) {\n // If the param on the redirect points to another param, e.g. { route: first/:this, redirect: second/:this }\n let val = redirectInstructionParams[key];\n if (typeof val === 'string' && val[0] === ':') {\n val = val.slice(1);\n // And if that param is found on the original instruction then use it\n if (val in originalInstructionParams) {\n params[key] = originalInstructionParams[val];\n }\n } else {\n params[key] = redirectInstructionParams[key];\n }\n }\n let redirectLocation = router.generate(redirectInstruction.config, params, instruction.options);\n\n // Special handling for child routes\n for (let key in originalInstructionParams) {\n redirectLocation = redirectLocation.replace(`:${key}`, originalInstructionParams[key]);\n }\n\n let queryString = instruction.queryString;\n if (queryString) {\n redirectLocation += '?' + queryString;\n }\n\n return Promise.resolve(new Redirect(redirectLocation));\n });\n};\n\n/**\n * @param viewPortPlans the Plan record that holds information about built plans\n * @internal exported for unit testing\n */\nexport const buildTransitionPlans = (\n currentInstruction: NavigationInstruction,\n previousInstruction: NavigationInstruction,\n defaultViewPortConfigs: Record,\n forceLifecycleMinimum?: boolean\n): Promise => {\n\n let viewPortPlans: ViewPortPlansRecord = {};\n let newInstructionConfig = currentInstruction.config;\n let hasNewParams = hasDifferentParameterValues(previousInstruction, currentInstruction);\n let pending: Promise[] = [];\n let previousViewPortInstructions = previousInstruction.viewPortInstructions as Record;\n\n for (let viewPortName in previousViewPortInstructions) {\n\n const prevViewPortInstruction = previousViewPortInstructions[viewPortName];\n const prevViewPortComponent = prevViewPortInstruction.component;\n const newInstructionViewPortConfigs = newInstructionConfig.viewPorts as Record;\n\n // if this is invoked on a viewport without any changes, based on new url,\n // newViewPortConfig will be the existing viewport instruction\n let nextViewPortConfig = viewPortName in newInstructionViewPortConfigs\n ? newInstructionViewPortConfigs[viewPortName]\n : prevViewPortInstruction;\n\n if (nextViewPortConfig.moduleId === null && viewPortName in defaultViewPortConfigs) {\n nextViewPortConfig = defaultViewPortConfigs[viewPortName];\n }\n\n const viewPortActivationStrategy = determineActivationStrategy(\n currentInstruction,\n prevViewPortInstruction,\n nextViewPortConfig,\n hasNewParams,\n forceLifecycleMinimum\n );\n const viewPortPlan = viewPortPlans[viewPortName] = {\n name: viewPortName,\n // ViewPortInstruction can quack like a RouteConfig\n config: nextViewPortConfig as RouteConfig,\n prevComponent: prevViewPortComponent,\n prevModuleId: prevViewPortInstruction.moduleId,\n strategy: viewPortActivationStrategy\n } as ViewPortPlan;\n\n // recursively build nav plans for all existing child routers/viewports of this viewport\n // this is possible because existing child viewports and routers already have necessary information\n // to process the wildcard path from parent instruction\n if (viewPortActivationStrategy !== InternalActivationStrategy.Replace && prevViewPortInstruction.childRouter) {\n const path = currentInstruction.getWildcardPath();\n const task: Promise = prevViewPortInstruction\n .childRouter\n ._createNavigationInstruction(path, currentInstruction)\n .then((childInstruction: NavigationInstruction) => {\n viewPortPlan.childNavigationInstruction = childInstruction;\n\n return _buildNavigationPlan(\n childInstruction,\n // is it safe to assume viewPortPlan has not been changed from previous assignment?\n // if so, can just use local variable viewPortPlanStrategy\n // there could be user code modifying viewport plan during _createNavigationInstruction?\n viewPortPlan.strategy === InternalActivationStrategy.InvokeLifecycle\n )\n .then(childPlan => {\n if (childPlan instanceof Redirect) {\n return Promise.reject(childPlan);\n }\n childInstruction.plan = childPlan;\n // for bluebird ?\n return null;\n });\n });\n\n pending.push(task);\n }\n }\n\n return Promise.all(pending).then(() => viewPortPlans);\n};\n\n/**\n * @param newViewPortConfig if this is invoked on a viewport without any changes, based on new url, newViewPortConfig will be the existing viewport instruction\n * @internal exported for unit testing\n */\nexport const determineActivationStrategy = (\n currentNavInstruction: NavigationInstruction,\n prevViewPortInstruction: ViewPortInstruction,\n newViewPortConfig: RouteConfig | ViewPortInstruction,\n // indicates whether there is difference between old and new url params\n hasNewParams: boolean,\n forceLifecycleMinimum?: boolean\n): ActivationStrategyType => {\n\n let newInstructionConfig = currentNavInstruction.config;\n let prevViewPortViewModel = prevViewPortInstruction.component.viewModel;\n let viewPortPlanStrategy: ActivationStrategyType;\n\n if (prevViewPortInstruction.moduleId !== newViewPortConfig.moduleId) {\n viewPortPlanStrategy = InternalActivationStrategy.Replace;\n } else if ('determineActivationStrategy' in prevViewPortViewModel) {\n viewPortPlanStrategy = prevViewPortViewModel.determineActivationStrategy(...currentNavInstruction.lifecycleArgs);\n } else if (newInstructionConfig.activationStrategy) {\n viewPortPlanStrategy = newInstructionConfig.activationStrategy;\n } else if (hasNewParams || forceLifecycleMinimum) {\n viewPortPlanStrategy = InternalActivationStrategy.InvokeLifecycle;\n } else {\n viewPortPlanStrategy = InternalActivationStrategy.NoChange;\n }\n return viewPortPlanStrategy;\n};\n\n/**@internal exported for unit testing */\nexport const hasDifferentParameterValues = (prev: NavigationInstruction, next: NavigationInstruction): boolean => {\n let prevParams = prev.params;\n let nextParams = next.params;\n let nextWildCardName = next.config.hasChildRouter ? next.getWildCardName() : null;\n\n for (let key in nextParams) {\n if (key === nextWildCardName) {\n continue;\n }\n\n if (prevParams[key] !== nextParams[key]) {\n return true;\n }\n }\n\n for (let key in prevParams) {\n if (key === nextWildCardName) {\n continue;\n }\n\n if (prevParams[key] !== nextParams[key]) {\n return true;\n }\n }\n\n if (!next.options.compareQueryParams) {\n return false;\n }\n\n let prevQueryParams = prev.queryParams;\n let nextQueryParams = next.queryParams;\n for (let key in nextQueryParams) {\n if (prevQueryParams[key] !== nextQueryParams[key]) {\n return true;\n }\n }\n\n for (let key in prevQueryParams) {\n if (prevQueryParams[key] !== nextQueryParams[key]) {\n return true;\n }\n }\n\n return false;\n};\n","import { Next } from './interfaces';\nimport { Redirect } from './navigation-commands';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { _buildNavigationPlan } from './navigation-plan';\n\n/**\n * Transform a navigation instruction into viewport plan record object,\n * or a redirect request if user viewmodel demands\n */\nexport class BuildNavigationPlanStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise {\n return _buildNavigationPlan(navigationInstruction)\n .then(plan => {\n if (plan instanceof Redirect) {\n return next.cancel(plan);\n }\n navigationInstruction.plan = plan;\n return next();\n })\n .catch(next.cancel);\n }\n}\n","import { RouteConfig, ViewPortComponent, ViewPortPlan, ViewPortInstruction } from './interfaces';\nimport { Redirect } from './navigation-commands';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { _buildNavigationPlan } from './navigation-plan';\nimport { InternalActivationStrategy } from './activation-strategy';\nimport { RouteLoader } from './route-loader';\n\n/**\n * Loading plan calculated based on a navigration-instruction and a viewport plan\n */\ninterface ILoadingPlan {\n viewPortPlan: ViewPortPlan;\n navigationInstruction: NavigationInstruction;\n}\n\n/**\n * @internal Exported for unit testing\n */\nexport const loadNewRoute = (\n routeLoader: RouteLoader,\n navigationInstruction: NavigationInstruction\n): Promise => {\n let loadingPlans = determineLoadingPlans(navigationInstruction);\n let loadPromises = loadingPlans.map((loadingPlan: ILoadingPlan) => loadRoute(\n routeLoader,\n loadingPlan.navigationInstruction,\n loadingPlan.viewPortPlan\n ));\n\n return Promise.all(loadPromises);\n};\n\n/**\n * @internal Exported for unit testing\n */\nexport const determineLoadingPlans = (\n navigationInstruction: NavigationInstruction,\n loadingPlans: ILoadingPlan[] = []\n): ILoadingPlan[] => {\n let viewPortPlans: Record = navigationInstruction.plan;\n\n for (let viewPortName in viewPortPlans) {\n let viewPortPlan = viewPortPlans[viewPortName];\n let childNavInstruction = viewPortPlan.childNavigationInstruction;\n\n if (viewPortPlan.strategy === InternalActivationStrategy.Replace) {\n loadingPlans.push({ viewPortPlan, navigationInstruction } as ILoadingPlan);\n\n if (childNavInstruction) {\n determineLoadingPlans(childNavInstruction, loadingPlans);\n }\n } else {\n let viewPortInstruction = navigationInstruction.addViewPortInstruction({\n name: viewPortName,\n strategy: viewPortPlan.strategy,\n moduleId: viewPortPlan.prevModuleId,\n component: viewPortPlan.prevComponent\n }) as ViewPortInstruction;\n\n if (childNavInstruction) {\n viewPortInstruction.childNavigationInstruction = childNavInstruction;\n determineLoadingPlans(childNavInstruction, loadingPlans);\n }\n }\n }\n\n return loadingPlans;\n};\n\n/**\n * @internal Exported for unit testing\n */\nexport const loadRoute = (\n routeLoader: RouteLoader,\n navigationInstruction: NavigationInstruction,\n viewPortPlan: ViewPortPlan\n): Promise => {\n let planConfig = viewPortPlan.config;\n let moduleId = planConfig ? planConfig.moduleId : null;\n\n return loadComponent(routeLoader, navigationInstruction, planConfig)\n .then((component) => {\n let viewPortInstruction = navigationInstruction.addViewPortInstruction({\n name: viewPortPlan.name,\n strategy: viewPortPlan.strategy,\n moduleId: moduleId,\n component: component\n }) as ViewPortInstruction;\n\n let childRouter = component.childRouter;\n if (childRouter) {\n let path = navigationInstruction.getWildcardPath();\n\n return childRouter\n ._createNavigationInstruction(path, navigationInstruction)\n .then((childInstruction) => {\n viewPortPlan.childNavigationInstruction = childInstruction;\n\n return _buildNavigationPlan(childInstruction)\n .then((childPlan) => {\n if (childPlan instanceof Redirect) {\n return Promise.reject(childPlan);\n }\n childInstruction.plan = childPlan;\n viewPortInstruction.childNavigationInstruction = childInstruction;\n\n return loadNewRoute(routeLoader, childInstruction);\n });\n });\n }\n // ts complains without this, though they are same\n return void 0;\n });\n};\n\n/**\n * Load a routed-component based on navigation instruction and route config\n * @internal exported for unit testing only\n */\nexport const loadComponent = (\n routeLoader: RouteLoader,\n navigationInstruction: NavigationInstruction,\n config: RouteConfig\n): Promise => {\n let router = navigationInstruction.router;\n let lifecycleArgs = navigationInstruction.lifecycleArgs;\n\n return Promise.resolve()\n .then(() => routeLoader.loadRoute(router, config, navigationInstruction))\n .then(\n /**\n * @param component an object carrying information about loaded route\n * typically contains information about view model, childContainer, view and router\n */\n (component: ViewPortComponent) => {\n let { viewModel, childContainer } = component;\n component.router = router;\n component.config = config;\n\n if ('configureRouter' in viewModel) {\n let childRouter = childContainer.getChildRouter();\n component.childRouter = childRouter;\n\n return childRouter\n .configure(c => viewModel.configureRouter(c, childRouter, lifecycleArgs[0], lifecycleArgs[1], lifecycleArgs[2]))\n .then(() => component);\n }\n\n return component;\n }\n );\n};\n","import { RouteConfig } from './interfaces';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { Router } from './router';\n\n/**\n * Abstract class that is responsible for loading view / view model from a route config\n * The default implementation can be found in `aurelia-templating-router`\n */\nexport class RouteLoader {\n /**\n * Load a route config based on its viewmodel / view configuration\n */\n // return typing: return typings used to be never\n // as it was a throw. Changing it to Promise should not cause any issues\n loadRoute(router: Router, config: RouteConfig, navigationInstruction: NavigationInstruction): Promise {\n throw new Error('Route loaders must implement \"loadRoute(router, config, navigationInstruction)\".');\n }\n}\n","import { Next } from './interfaces';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { loadNewRoute } from './utilities-route-loading';\nimport { RouteLoader } from './route-loader';\n/**\n * A pipeline step responsible for loading a route config of a navigation instruction\n */\nexport class LoadRouteStep {\n /**@internal */\n static inject() { return [RouteLoader]; }\n /**\n * Route loader isntance that will handle loading route config\n * @internal\n */\n routeLoader: RouteLoader;\n constructor(routeLoader: RouteLoader) {\n this.routeLoader = routeLoader;\n }\n /**\n * Run the internal to load route config of a navigation instruction to prepare for next steps in the pipeline\n */\n run(navigationInstruction: NavigationInstruction, next: Next): Promise {\n return loadNewRoute(this.routeLoader, navigationInstruction)\n .then(next, next.cancel);\n }\n}\n","import { NavigationInstruction } from './navigation-instruction';\n\n/**\n * A pipeline step for instructing a piepline to commit changes on a navigation instruction\n */\nexport class CommitChangesStep {\n run(navigationInstruction: NavigationInstruction, next: Function): Promise {\n return navigationInstruction\n ._commitChanges(/*wait to swap?*/ true)\n .then(() => {\n navigationInstruction._updateTitle();\n return next();\n });\n }\n}\n","/**\n * An optional interface describing the available activation strategies.\n * @internal Used internally.\n */\nexport const enum InternalActivationStrategy {\n /**\n * Reuse the existing view model, without invoking Router lifecycle hooks.\n */\n NoChange = 'no-change',\n /**\n * Reuse the existing view model, invoking Router lifecycle hooks.\n */\n InvokeLifecycle = 'invoke-lifecycle',\n /**\n * Replace the existing view model, invoking Router lifecycle hooks.\n */\n Replace = 'replace'\n}\n\n/**\n * The strategy to use when activating modules during navigation.\n */\n// kept for compat reason\nexport const activationStrategy: ActivationStrategy = {\n noChange: InternalActivationStrategy.NoChange,\n invokeLifecycle: InternalActivationStrategy.InvokeLifecycle,\n replace: InternalActivationStrategy.Replace\n};\n\n/**\n * An optional interface describing the available activation strategies.\n */\nexport interface ActivationStrategy {\n /**\n * Reuse the existing view model, without invoking Router lifecycle hooks.\n */\n noChange: 'no-change';\n /**\n * Reuse the existing view model, invoking Router lifecycle hooks.\n */\n invokeLifecycle: 'invoke-lifecycle';\n /**\n * Replace the existing view model, invoking Router lifecycle hooks.\n */\n replace: 'replace';\n}\n\n/**\n * Enum like type for activation strategy built-in values\n */\nexport type ActivationStrategyType = ActivationStrategy[keyof ActivationStrategy];\n","import { Next, ViewPortComponent, ViewPortPlan, ViewPortInstruction, LifecycleArguments } from './interfaces';\nimport { isNavigationCommand } from './navigation-commands';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { activationStrategy } from './activation-strategy';\nimport { Router } from './router';\n\n/**\n * Recursively find list of deactivate-able view models\n * and invoke the either 'canDeactivate' or 'deactivate' on each\n * @internal exported for unit testing\n */\nexport const processDeactivatable = (\n navigationInstruction: NavigationInstruction,\n callbackName: 'canDeactivate' | 'deactivate',\n next: Next,\n ignoreResult?: boolean\n): Promise => {\n let plan: Record = navigationInstruction.plan;\n let infos = findDeactivatable(plan, callbackName);\n let i = infos.length; // query from inside out\n\n function inspect(val: any): Promise {\n if (ignoreResult || shouldContinue(val)) {\n return iterate();\n }\n\n return next.cancel(val);\n }\n\n function iterate(): Promise {\n if (i--) {\n try {\n let viewModel = infos[i];\n let result = viewModel[callbackName](navigationInstruction);\n return processPotential(result, inspect, next.cancel);\n } catch (error) {\n return next.cancel(error);\n }\n }\n\n navigationInstruction.router.couldDeactivate = true;\n\n return next();\n }\n\n return iterate();\n};\n\n/**\n * Recursively find and returns a list of deactivate-able view models\n * @internal exported for unit testing\n */\nexport const findDeactivatable = (\n plan: Record,\n callbackName: string,\n list: IActivatableInfo[] = []\n): any[] => {\n for (let viewPortName in plan) {\n let viewPortPlan = plan[viewPortName];\n let prevComponent = viewPortPlan.prevComponent;\n\n if ((viewPortPlan.strategy === activationStrategy.invokeLifecycle || viewPortPlan.strategy === activationStrategy.replace)\n && prevComponent\n ) {\n let viewModel = prevComponent.viewModel;\n\n if (callbackName in viewModel) {\n list.push(viewModel);\n }\n }\n\n if (viewPortPlan.strategy === activationStrategy.replace && prevComponent) {\n addPreviousDeactivatable(prevComponent, callbackName, list);\n } else if (viewPortPlan.childNavigationInstruction) {\n findDeactivatable(viewPortPlan.childNavigationInstruction.plan, callbackName, list);\n }\n }\n\n return list;\n};\n\n/**\n * @internal exported for unit testing\n */\nexport const addPreviousDeactivatable = (\n component: ViewPortComponent,\n callbackName: string,\n list: IActivatableInfo[]\n): void => {\n let childRouter = component.childRouter;\n\n if (childRouter && childRouter.currentInstruction) {\n let viewPortInstructions = childRouter.currentInstruction.viewPortInstructions;\n\n for (let viewPortName in viewPortInstructions) {\n let viewPortInstruction = viewPortInstructions[viewPortName];\n let prevComponent = viewPortInstruction.component;\n let prevViewModel = prevComponent.viewModel;\n\n if (callbackName in prevViewModel) {\n list.push(prevViewModel);\n }\n\n addPreviousDeactivatable(prevComponent, callbackName, list);\n }\n }\n};\n\n/**\n * @internal exported for unit testing\n */\nexport const processActivatable = (\n navigationInstruction: NavigationInstruction,\n callbackName: 'canActivate' | 'activate',\n next: Next,\n ignoreResult?: boolean\n): Promise => {\n let infos = findActivatable(navigationInstruction, callbackName);\n let length = infos.length;\n let i = -1; // query from top down\n\n function inspect(val: any, router: Router): Promise {\n if (ignoreResult || shouldContinue(val, router)) {\n return iterate();\n }\n\n return next.cancel(val);\n }\n\n function iterate(): Promise {\n i++;\n\n if (i < length) {\n try {\n let current = infos[i];\n let result = current.viewModel[callbackName](...current.lifecycleArgs);\n return processPotential(result, (val: any) => inspect(val, current.router), next.cancel);\n } catch (error) {\n return next.cancel(error);\n }\n }\n\n return next();\n }\n\n return iterate();\n};\n\ninterface IActivatableInfo {\n viewModel: any;\n lifecycleArgs: LifecycleArguments;\n router: Router;\n}\n\n/**\n * Find list of activatable view model and add to list (3rd parameter)\n * @internal exported for unit testing\n */\nexport const findActivatable = (\n navigationInstruction: NavigationInstruction,\n callbackName: 'canActivate' | 'activate',\n list: IActivatableInfo[] = [],\n router?: Router\n): IActivatableInfo[] => {\n let plan: Record = navigationInstruction.plan;\n\n Object\n .keys(plan)\n .forEach((viewPortName) => {\n let viewPortPlan = plan[viewPortName];\n let viewPortInstruction = navigationInstruction.viewPortInstructions[viewPortName] as ViewPortInstruction;\n let viewPortComponent = viewPortInstruction.component;\n let viewModel = viewPortComponent.viewModel;\n\n if (\n (viewPortPlan.strategy === activationStrategy.invokeLifecycle\n || viewPortPlan.strategy === activationStrategy.replace\n )\n && callbackName in viewModel\n ) {\n list.push({\n viewModel,\n lifecycleArgs: viewPortInstruction.lifecycleArgs,\n router\n });\n }\n\n let childNavInstruction = viewPortPlan.childNavigationInstruction;\n\n if (childNavInstruction) {\n findActivatable(\n childNavInstruction,\n callbackName,\n list,\n viewPortComponent.childRouter || router\n );\n }\n });\n\n return list;\n};\n\nconst shouldContinue = (output: T, router?: Router): boolean | T => {\n if (output instanceof Error) {\n return false;\n }\n\n if (isNavigationCommand(output)) {\n if (typeof output.setRouter === 'function') {\n output.setRouter(router);\n }\n\n return !!output.shouldContinueProcessing;\n }\n\n if (output === undefined) {\n return true;\n }\n\n return output;\n};\n\n/**\n * A basic interface for an Observable type\n */\nexport interface IObservable {\n subscribe(sub?: IObservableConfig): ISubscription;\n}\n\nexport interface IObservableConfig {\n next(): void;\n error(err?: any): void;\n complete(): void;\n}\n\n/**\n * A basic interface for a Subscription to an Observable\n */\ninterface ISubscription {\n unsubscribe(): void;\n}\n\ntype SafeSubscriptionFunc = (sub: SafeSubscription) => ISubscription;\n\n/**\n * wraps a subscription, allowing unsubscribe calls even if\n * the first value comes synchronously\n */\nclass SafeSubscription {\n\n private _subscribed: boolean;\n private _subscription: ISubscription;\n\n constructor(subscriptionFunc: SafeSubscriptionFunc) {\n this._subscribed = true;\n this._subscription = subscriptionFunc(this);\n\n if (!this._subscribed) {\n this.unsubscribe();\n }\n }\n\n get subscribed(): boolean {\n return this._subscribed;\n }\n\n unsubscribe(): void {\n if (this._subscribed && this._subscription) {\n this._subscription.unsubscribe();\n }\n\n this._subscribed = false;\n }\n}\n\n/**\n * A function to process return value from `activate`/`canActivate` steps\n * Supports observable/promise\n *\n * For observable, resolve at first next() or on complete()\n */\nconst processPotential = (obj: any, resolve: (val?: any) => any, reject: (err?: any) => any): any => {\n // if promise like\n if (obj && typeof obj.then === 'function') {\n return Promise.resolve(obj).then(resolve).catch(reject);\n }\n\n // if observable\n if (obj && typeof obj.subscribe === 'function') {\n let obs: IObservable = obj;\n return new SafeSubscription(sub => obs.subscribe({\n next() {\n if (sub.subscribed) {\n sub.unsubscribe();\n resolve(obj);\n }\n },\n error(error) {\n if (sub.subscribed) {\n sub.unsubscribe();\n reject(error);\n }\n },\n complete() {\n if (sub.subscribed) {\n sub.unsubscribe();\n resolve(obj);\n }\n }\n }));\n }\n\n // else just resolve\n try {\n return resolve(obj);\n } catch (error) {\n return reject(error);\n }\n};\n","import { Next } from './interfaces';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { processDeactivatable, processActivatable } from './utilities-activation';\n\n/**\n * A pipeline step responsible for finding and activating method `canDeactivate` on a view model of a route\n */\nexport class CanDeactivatePreviousStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise {\n return processDeactivatable(navigationInstruction, 'canDeactivate', next);\n }\n}\n\n/**\n * A pipeline step responsible for finding and activating method `canActivate` on a view model of a route\n */\nexport class CanActivateNextStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise {\n return processActivatable(navigationInstruction, 'canActivate', next);\n }\n}\n\n/**\n * A pipeline step responsible for finding and activating method `deactivate` on a view model of a route\n */\nexport class DeactivatePreviousStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise {\n return processDeactivatable(navigationInstruction, 'deactivate', next, true);\n }\n}\n\n/**\n * A pipeline step responsible for finding and activating method `activate` on a view model of a route\n */\nexport class ActivateNextStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise {\n return processActivatable(navigationInstruction, 'activate', next, true);\n }\n}\n","import { Container } from 'aurelia-dependency-injection';\nimport { Pipeline } from './pipeline';\nimport { BuildNavigationPlanStep } from './step-build-navigation-plan';\nimport { LoadRouteStep } from './step-load-route';\nimport { CommitChangesStep } from './step-commit-changes';\nimport { CanDeactivatePreviousStep, CanActivateNextStep, DeactivatePreviousStep, ActivateNextStep } from './step-activation';\nimport { PipelineStep, StepRunnerFunction, IPipelineSlot } from './interfaces';\nimport { PipelineSlotName } from './pipeline-slot-name';\n\n/**\n * A multi-slots Pipeline Placeholder Step for hooking into a pipeline execution\n */\nclass PipelineSlot implements IPipelineSlot {\n\n /**@internal */\n container: Container;\n /**@internal */\n slotName: string;\n /**@internal */\n slotAlias?: string;\n\n steps: (Function | PipelineStep)[] = [];\n\n constructor(container: Container, name: string, alias?: string) {\n this.container = container;\n this.slotName = name;\n this.slotAlias = alias;\n }\n\n getSteps(): (StepRunnerFunction | IPipelineSlot | PipelineStep)[] {\n return this.steps.map(x => this.container.get(x));\n }\n}\n\n/**\n * Class responsible for creating the navigation pipeline.\n */\nexport class PipelineProvider {\n\n /**@internal */\n static inject() { return [Container]; }\n /**@internal */\n container: Container;\n /**@internal */\n steps: (Function | PipelineSlot)[];\n\n constructor(container: Container) {\n this.container = container;\n this.steps = [\n BuildNavigationPlanStep,\n CanDeactivatePreviousStep, // optional\n LoadRouteStep,\n createPipelineSlot(container, PipelineSlotName.Authorize),\n CanActivateNextStep, // optional\n createPipelineSlot(container, PipelineSlotName.PreActivate, 'modelbind'),\n // NOTE: app state changes start below - point of no return\n DeactivatePreviousStep, // optional\n ActivateNextStep, // optional\n createPipelineSlot(container, PipelineSlotName.PreRender, 'precommit'),\n CommitChangesStep,\n createPipelineSlot(container, PipelineSlotName.PostRender, 'postcomplete')\n ];\n }\n\n /**\n * Create the navigation pipeline.\n */\n createPipeline(useCanDeactivateStep: boolean = true): Pipeline {\n let pipeline = new Pipeline();\n this.steps.forEach(step => {\n if (useCanDeactivateStep || step !== CanDeactivatePreviousStep) {\n pipeline.addStep(this.container.get(step));\n }\n });\n return pipeline;\n }\n\n /**@internal */\n _findStep(name: string): PipelineSlot {\n // Steps that are not PipelineSlots are constructor functions, and they will automatically fail. Probably.\n return this.steps.find(x => (x as PipelineSlot).slotName === name || (x as PipelineSlot).slotAlias === name) as PipelineSlot;\n }\n\n /**\n * Adds a step into the pipeline at a known slot location.\n */\n addStep(name: string, step: PipelineStep | Function): void {\n let found = this._findStep(name);\n if (found) {\n let slotSteps = found.steps;\n // prevent duplicates\n if (!slotSteps.includes(step)) {\n slotSteps.push(step);\n }\n } else {\n throw new Error(`Invalid pipeline slot name: ${name}.`);\n }\n }\n\n /**\n * Removes a step from a slot in the pipeline\n */\n removeStep(name: string, step: PipelineStep): void {\n let slot = this._findStep(name);\n if (slot) {\n let slotSteps = slot.steps;\n slotSteps.splice(slotSteps.indexOf(step), 1);\n }\n }\n\n /**\n * Clears all steps from a slot in the pipeline\n * @internal\n */\n _clearSteps(name: string = ''): void {\n let slot = this._findStep(name);\n if (slot) {\n slot.steps = [];\n }\n }\n\n /**\n * Resets all pipeline slots\n */\n reset(): void {\n this._clearSteps(PipelineSlotName.Authorize);\n this._clearSteps(PipelineSlotName.PreActivate);\n this._clearSteps(PipelineSlotName.PreRender);\n this._clearSteps(PipelineSlotName.PostRender);\n }\n}\n\n/**@internal */\nconst createPipelineSlot = (container: Container, name: PipelineSlotName, alias?: string): PipelineSlot => {\n return new PipelineSlot(container, name, alias);\n};\n","import * as LogManager from 'aurelia-logging';\nimport { Container } from 'aurelia-dependency-injection';\nimport { History, NavigationOptions } from 'aurelia-history';\nimport { Router } from './router';\nimport { PipelineProvider } from './pipeline-provider';\nimport { isNavigationCommand } from './navigation-commands';\nimport { EventAggregator } from 'aurelia-event-aggregator';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { ViewPort, ConfiguresRouter, PipelineResult } from './interfaces';\nimport { RouterEvent } from './router-event';\nimport { RouterConfiguration } from './router-configuration';\n\n/**@internal */\ndeclare module 'aurelia-dependency-injection' {\n interface Container {\n viewModel?: any;\n }\n}\n\nconst logger = LogManager.getLogger('app-router');\n\n/**\n * The main application router.\n */\nexport class AppRouter extends Router {\n\n /**@internal */\n static inject() { return [Container, History, PipelineProvider, EventAggregator]; }\n\n events: EventAggregator;\n /**@internal */\n maxInstructionCount: number;\n /**@internal */\n _queue: NavigationInstruction[];\n /**@internal */\n isActive: boolean;\n\n constructor(container: Container, history: History, pipelineProvider: PipelineProvider, events: EventAggregator) {\n super(container, history); // Note the super will call reset internally.\n this.pipelineProvider = pipelineProvider;\n this.events = events;\n }\n\n /**\n * Fully resets the router's internal state. Primarily used internally by the framework when multiple calls to setRoot are made.\n * Use with caution (actually, avoid using this). Do not use this to simply change your navigation model.\n */\n reset(): void {\n super.reset();\n this.maxInstructionCount = 10;\n if (!this._queue) {\n this._queue = [];\n } else {\n this._queue.length = 0;\n }\n }\n\n /**\n * Loads the specified URL.\n *\n * @param url The URL fragment to load.\n */\n loadUrl(url: string): Promise {\n return this\n ._createNavigationInstruction(url)\n .then(instruction => this._queueInstruction(instruction))\n .catch(error => {\n logger.error(error);\n restorePreviousLocation(this);\n });\n }\n\n /**\n * Registers a viewPort to be used as a rendering target for activated routes.\n *\n * @param viewPort The viewPort. This is typically a element in Aurelia default impl\n * @param name The name of the viewPort. 'default' if unspecified.\n */\n registerViewPort(viewPort: /*ViewPort*/ any, name?: string): Promise {\n // having strong typing without changing public API\n const $viewPort: ViewPort = viewPort;\n super.registerViewPort($viewPort, name);\n\n // beside adding viewport to the registry of this instance\n // AppRouter also configure routing/history to start routing functionality\n // There are situation where there are more than 1 element at root view\n // in that case, still only activate once via the following guard\n if (!this.isActive) {\n const viewModel = this._findViewModel($viewPort);\n if ('configureRouter' in viewModel) {\n // If there are more than one element at root view\n // use this flag to guard against configure method being invoked multiple times\n // this flag is set inside method configure\n if (!this.isConfigured) {\n // replace the real resolve with a noop to guarantee that any action in base class Router\n // won't resolve the configurePromise prematurely\n const resolveConfiguredPromise = this._resolveConfiguredPromise;\n this._resolveConfiguredPromise = () => {/**/};\n return this\n .configure(config =>\n Promise\n .resolve(viewModel.configureRouter(config, this))\n // an issue with configure interface. Should be fixed there\n // todo: fix this via configure interface in router\n .then(() => config) as any\n )\n .then(() => {\n this.activate();\n resolveConfiguredPromise();\n });\n }\n } else {\n this.activate();\n }\n }\n // when a viewport is added dynamically to a root view that is already activated\n // just process the navigation instruction\n else {\n this._dequeueInstruction();\n }\n\n return Promise.resolve();\n }\n\n /**\n * Activates the router. This instructs the router to begin listening for history changes and processing instructions.\n *\n * @params options The set of options to activate the router with.\n */\n activate(options?: NavigationOptions): void {\n if (this.isActive) {\n return;\n }\n\n this.isActive = true;\n // route handler property is responsible for handling url change\n // the interface of aurelia-history isn't clear on this perspective\n this.options = Object.assign({ routeHandler: this.loadUrl.bind(this) }, this.options, options);\n this.history.activate(this.options);\n this._dequeueInstruction();\n }\n\n /**\n * Deactivates the router.\n */\n deactivate(): void {\n this.isActive = false;\n this.history.deactivate();\n }\n\n /**@internal */\n _queueInstruction(instruction: NavigationInstruction): Promise {\n return new Promise((resolve) => {\n instruction.resolve = resolve;\n this._queue.unshift(instruction);\n this._dequeueInstruction();\n });\n }\n\n /**@internal */\n _dequeueInstruction(instructionCount: number = 0): Promise {\n return Promise.resolve().then(() => {\n if (this.isNavigating && !instructionCount) {\n // ts complains about inconsistent returns without void 0\n return void 0;\n }\n\n let instruction = this._queue.shift();\n this._queue.length = 0;\n\n if (!instruction) {\n // ts complains about inconsistent returns without void 0\n return void 0;\n }\n\n this.isNavigating = true;\n\n let navtracker: number = this.history.getState('NavigationTracker');\n let currentNavTracker = this.currentNavigationTracker;\n\n if (!navtracker && !currentNavTracker) {\n this.isNavigatingFirst = true;\n this.isNavigatingNew = true;\n } else if (!navtracker) {\n this.isNavigatingNew = true;\n } else if (!currentNavTracker) {\n this.isNavigatingRefresh = true;\n } else if (currentNavTracker < navtracker) {\n this.isNavigatingForward = true;\n } else if (currentNavTracker > navtracker) {\n this.isNavigatingBack = true;\n } if (!navtracker) {\n navtracker = Date.now();\n this.history.setState('NavigationTracker', navtracker);\n }\n this.currentNavigationTracker = navtracker;\n\n instruction.previousInstruction = this.currentInstruction;\n\n let maxInstructionCount = this.maxInstructionCount;\n\n if (!instructionCount) {\n this.events.publish(RouterEvent.Processing, { instruction });\n } else if (instructionCount === maxInstructionCount - 1) {\n logger.error(`${instructionCount + 1} navigation instructions have been attempted without success. Restoring last known good location.`);\n restorePreviousLocation(this);\n return this._dequeueInstruction(instructionCount + 1);\n } else if (instructionCount > maxInstructionCount) {\n throw new Error('Maximum navigation attempts exceeded. Giving up.');\n }\n\n let pipeline = this.pipelineProvider.createPipeline(!this.couldDeactivate);\n\n return pipeline\n .run(instruction)\n .then(result => processResult(instruction, result, instructionCount, this))\n .catch(error => {\n return { output: error instanceof Error ? error : new Error(error) } as PipelineResult;\n })\n .then(result => resolveInstruction(instruction, result, !!instructionCount, this));\n });\n }\n\n /**@internal */\n _findViewModel(viewPort: ViewPort): ConfiguresRouter | undefined {\n if (this.container.viewModel) {\n return this.container.viewModel;\n }\n\n if (viewPort.container) {\n let container = viewPort.container;\n\n while (container) {\n if (container.viewModel) {\n this.container.viewModel = container.viewModel;\n return container.viewModel;\n }\n\n container = container.parent;\n }\n }\n\n return undefined;\n }\n}\n\nconst processResult = (\n instruction: NavigationInstruction,\n result: PipelineResult,\n instructionCount: number,\n router: AppRouter\n): Promise => {\n if (!(result && 'completed' in result && 'output' in result)) {\n result = result || {} as PipelineResult;\n result.output = new Error(`Expected router pipeline to return a navigation result, but got [${JSON.stringify(result)}] instead.`);\n }\n\n let finalResult: PipelineResult = null;\n let navigationCommandResult = null;\n if (isNavigationCommand(result.output)) {\n navigationCommandResult = result.output.navigate(router);\n } else {\n finalResult = result;\n\n if (!result.completed) {\n if (result.output instanceof Error) {\n logger.error(result.output.toString());\n }\n\n restorePreviousLocation(router);\n }\n }\n\n return Promise.resolve(navigationCommandResult)\n .then(_ => router._dequeueInstruction(instructionCount + 1))\n .then(innerResult => finalResult || innerResult || result);\n};\n\nconst resolveInstruction = (\n instruction: NavigationInstruction,\n result: PipelineResult,\n isInnerInstruction: boolean,\n router: AppRouter\n): PipelineResult => {\n instruction.resolve(result);\n\n let eventAggregator = router.events;\n let eventArgs = { instruction, result };\n if (!isInnerInstruction) {\n router.isNavigating = false;\n router.isExplicitNavigation = false;\n router.isExplicitNavigationBack = false;\n router.isNavigatingFirst = false;\n router.isNavigatingNew = false;\n router.isNavigatingRefresh = false;\n router.isNavigatingForward = false;\n router.isNavigatingBack = false;\n router.couldDeactivate = false;\n\n let eventName: string;\n\n if (result.output instanceof Error) {\n eventName = RouterEvent.Error;\n } else if (!result.completed) {\n eventName = RouterEvent.Canceled;\n } else {\n let queryString = instruction.queryString ? ('?' + instruction.queryString) : '';\n router.history.previousLocation = instruction.fragment + queryString;\n eventName = RouterEvent.Success;\n }\n\n eventAggregator.publish(eventName, eventArgs);\n eventAggregator.publish(RouterEvent.Complete, eventArgs);\n } else {\n eventAggregator.publish(RouterEvent.ChildComplete, eventArgs);\n }\n\n return result;\n};\n\nconst restorePreviousLocation = (router: AppRouter): void => {\n let previousLocation = router.history.previousLocation;\n if (previousLocation) {\n router.navigate(previousLocation, { trigger: false, replace: true });\n } else if (router.fallbackRoute) {\n router.navigate(router.fallbackRoute, { trigger: true, replace: true });\n } else {\n logger.error('Router navigation failed, and no previous location or fallbackRoute could be restored.');\n }\n};\n","/**\n* The status of a Pipeline.\n*/\nexport const enum PipelineStatus {\n Completed = 'completed',\n Canceled = 'canceled',\n Rejected = 'rejected',\n Running = 'running'\n}\n","/**\n * A list of known router events used by the Aurelia router\n * to signal the pipeline has come to a certain state\n */\n// const enum is preserved in tsconfig\nexport const enum RouterEvent {\n Processing = 'router:navigation:processing',\n Error = 'router:navigation:error',\n Canceled = 'router:navigation:canceled',\n Complete = 'router:navigation:complete',\n Success = 'router:navigation:success',\n ChildComplete = 'router:navigation:child:complete'\n}\n","/**\n * Available pipeline slot names to insert interceptor into router pipeline\n */\n// const enum is preserved in tsconfig\nexport const enum PipelineSlotName {\n /**\n * Authorization slot. Invoked early in the pipeline,\n * before `canActivate` hook of incoming route\n */\n Authorize = 'authorize',\n /**\n * Pre-activation slot. Invoked early in the pipeline,\n * Invoked timing:\n * - after Authorization slot\n * - after canActivate hook on new view model\n * - before deactivate hook on old view model\n * - before activate hook on new view model\n */\n PreActivate = 'preActivate',\n /**\n * Pre-render slot. Invoked later in the pipeline\n * Invokcation timing:\n * - after activate hook on new view model\n * - before commit step on new navigation instruction\n */\n PreRender = 'preRender',\n /**\n * Post-render slot. Invoked last in the pipeline\n */\n PostRender = 'postRender'\n}\n",null,null,null,"import { Container } from 'aurelia-dependency-injection';\nimport { createOverrideContext, OverrideContext } from 'aurelia-binding';\nimport {\n ViewSlot,\n ViewLocator,\n BehaviorInstruction,\n CompositionTransaction,\n CompositionEngine,\n ShadowDOM,\n SwapStrategies,\n ResourceDescription,\n HtmlBehaviorResource,\n CompositionTransactionNotifier,\n View,\n CompositionTransactionOwnershipToken,\n Controller,\n ViewFactory,\n CompositionContext,\n IStaticResourceConfig,\n IStaticViewConfig\n} from 'aurelia-templating';\nimport {\n Router\n} from 'aurelia-router';\nimport { Origin } from 'aurelia-metadata';\nimport { DOM } from 'aurelia-pal';\nimport { IRouterViewViewPortInstruction, Constructable } from './interfaces';\n\nclass EmptyLayoutViewModel {\n\n}\n\n/**\n * Implementation of Aurelia Router ViewPort. Responsible for loading route, composing and swapping routes views\n */\nexport class RouterView {\n\n /**@internal */\n static inject() {\n return [DOM.Element, Container, ViewSlot, Router, ViewLocator, CompositionTransaction, CompositionEngine];\n }\n\n /**\n * @internal Actively avoid using decorator to reduce the amount of code generated\n *\n * There is no view to compose by default in a router view\n * This custom element is responsible for composing its own view, based on current config\n */\n static $view: IStaticViewConfig = null;\n /**\n * @internal Actively avoid using decorator to reduce the amount of code generated\n */\n static $resource: IStaticResourceConfig = {\n name: 'router-view',\n bindables: ['swapOrder', 'layoutView', 'layoutViewModel', 'layoutModel', 'inherit-binding-context'] as any\n };\n\n /**\n * Swapping order when going to a new route. By default, supports 3 value: before, after, with\n * - before = new in -> old out\n * - after = old out -> new in\n * - with = new in + old out\n *\n * These values are defined by swapStrategies export in aurelia-templating/ aurelia-framework\n * Can be extended there and used here\n */\n swapOrder?: string;\n\n /**\n * Layout view used for this router-view layout, if no layout-viewmodel specified\n */\n layoutView?: any;\n\n /**\n * Layout view model used as binding context for this router-view layout\n * Actual type would be {string | Constructable | object}\n */\n layoutViewModel?: any;\n\n /**\n * Layout model used to activate layout view model, if specified with `layoutViewModel`\n */\n layoutModel?: any;\n\n /**\n * Element associated with this custom element\n */\n readonly element: Element;\n\n /**\n * Current router associated with this \n */\n readonly router: Router;\n\n /**\n * Container at this level\n */\n container: Container;\n\n /**\n * @internal\n * the view slot for adding / removing Routing related views created dynamically\n */\n viewSlot: ViewSlot;\n\n /**\n * @internal\n * Used to mimic partially functionalities of CompositionEngine\n */\n viewLocator: ViewLocator;\n\n /**\n * @internal\n * View composed by the CompositionEngine, depends on layout / viewports/ moduleId / viewModel of routeconfig\n */\n view: View;\n\n /**\n * @internal\n * The view where this `` is placed in\n */\n owningView: View;\n\n /**\n * @internal\n * Composition Transaction of initial composition transaction, when this is created\n */\n compositionTransaction: CompositionTransaction;\n\n /**\n * @internal\n * CompositionEngine instance, responsible for composing view/view model during process changes phase of this \n */\n compositionEngine: CompositionEngine;\n\n /**\n * Composition transaction notifier instance. Created when this router-view composing its instruction\n * for the first time.\n * Null on 2nd time and after.\n * @internal\n */\n compositionTransactionNotifier: CompositionTransactionNotifier;\n\n /**\n * @internal\n */\n compositionTransactionOwnershipToken: CompositionTransactionOwnershipToken;\n\n /**\n * @internal\n */\n overrideContext: OverrideContext;\n\n constructor(\n element: Element,\n container: Container,\n viewSlot: ViewSlot,\n router: Router,\n viewLocator: ViewLocator,\n compositionTransaction: CompositionTransaction,\n compositionEngine: CompositionEngine\n ) {\n this.element = element;\n this.container = container;\n this.viewSlot = viewSlot;\n this.router = router;\n this.viewLocator = viewLocator;\n this.compositionTransaction = compositionTransaction;\n this.compositionEngine = compositionEngine;\n // add this to router view ports lookup based on name attribute\n // when this router is the root router-view\n // also trigger AppRouter registerViewPort extra flow\n this.router.registerViewPort(this, this.element.getAttribute('name'));\n\n // Each process its instruction as a composition transaction\n // there are differences between intial composition and subsequent compositions\n // also there are differences between root composition and child composition\n // mark the first composition transaction with a property initialComposition to distinguish it\n // when the root gets new instruction for the first time\n if (!('initialComposition' in compositionTransaction)) {\n compositionTransaction.initialComposition = true;\n this.compositionTransactionNotifier = compositionTransaction.enlist();\n }\n }\n\n created(owningView: View): void {\n this.owningView = owningView;\n }\n\n bind(bindingContext: any, overrideContext: OverrideContext): void {\n // router needs to get access to view model of current route parent\n // doing it in generic way via viewModel property on container\n this.container.viewModel = bindingContext;\n this.overrideContext = overrideContext;\n }\n\n /**\n * Implementation of `aurelia-router` ViewPort interface, responsible for templating related part in routing Pipeline\n */\n process($viewPortInstruction: any, waitToSwap?: boolean): Promise {\n // have strong typings without exposing it in public typings, this is to ensure maximum backward compat\n const viewPortInstruction = $viewPortInstruction as IRouterViewViewPortInstruction;\n const component = viewPortInstruction.component;\n const childContainer = component.childContainer;\n const viewModel = component.viewModel;\n const viewModelResource = component.viewModelResource as unknown as ResourceDescription;\n const metadata = viewModelResource.metadata;\n const config = component.router.currentInstruction.config;\n const viewPortConfig = config.viewPorts ? (config.viewPorts[viewPortInstruction.name] || {}) : {};\n\n (childContainer.get(RouterViewLocator) as RouterViewLocator)._notify(this);\n\n // layoutInstruction is our layout viewModel\n const layoutInstruction = {\n viewModel: viewPortConfig.layoutViewModel || config.layoutViewModel || this.layoutViewModel,\n view: viewPortConfig.layoutView || config.layoutView || this.layoutView,\n model: viewPortConfig.layoutModel || config.layoutModel || this.layoutModel,\n router: viewPortInstruction.component.router,\n childContainer: childContainer,\n viewSlot: this.viewSlot\n };\n\n // viewport will be a thin wrapper around composition engine\n // to process instruction/configuration from users\n // preparing all information related to a composition process\n // first by getting view strategy of a ViewPortComponent View\n const viewStrategy = this.viewLocator.getViewStrategy(component.view || viewModel);\n if (viewStrategy && component.view) {\n viewStrategy.makeRelativeTo(Origin.get(component.router.container.viewModel.constructor).moduleId);\n }\n\n // using metadata of a custom element view model to load appropriate view-factory instance\n return metadata\n .load(childContainer, viewModelResource.value, null, viewStrategy, true)\n // for custom element, viewFactory typing is always ViewFactory\n // for custom attribute, it will be HtmlBehaviorResource\n .then((viewFactory: ViewFactory | HtmlBehaviorResource) => {\n // if this is not the first time that this is composing its instruction\n // try to capture ownership of the composition transaction\n // child will not be able to capture, since root typically captures\n // the ownership token\n if (!this.compositionTransactionNotifier) {\n this.compositionTransactionOwnershipToken = this.compositionTransaction.tryCapture();\n }\n\n if (layoutInstruction.viewModel || layoutInstruction.view) {\n viewPortInstruction.layoutInstruction = layoutInstruction;\n }\n\n const viewPortComponentBehaviorInstruction = BehaviorInstruction.dynamic(\n this.element,\n viewModel,\n viewFactory as ViewFactory\n );\n viewPortInstruction.controller = metadata.create(childContainer, viewPortComponentBehaviorInstruction);\n\n if (waitToSwap) {\n return null;\n }\n\n this.swap(viewPortInstruction);\n });\n }\n\n swap($viewPortInstruction: any): void | Promise {\n // have strong typings without exposing it in public typings, this is to ensure maximum backward compat\n const viewPortInstruction: IRouterViewViewPortInstruction = $viewPortInstruction;\n const viewPortController = viewPortInstruction.controller;\n const layoutInstruction = viewPortInstruction.layoutInstruction;\n const previousView = this.view;\n\n // Final step of swapping a ViewPortComponent\n const work = () => {\n const swapStrategy = SwapStrategies[this.swapOrder] || SwapStrategies.after;\n const viewSlot = this.viewSlot;\n\n swapStrategy(\n viewSlot,\n previousView,\n () => Promise.resolve(viewSlot.add(this.view))\n ).then(() => {\n this._notify();\n });\n };\n\n // Ensure all users setups have been completed\n const ready = (owningView_or_layoutView: View) => {\n viewPortController.automate(this.overrideContext, owningView_or_layoutView);\n const transactionOwnerShipToken = this.compositionTransactionOwnershipToken;\n // if this router-view is the root of a normal startup via aurelia.setRoot\n // attemp to take control of the transaction\n\n // if ownership can be taken\n // wait for transaction to complete before swapping\n if (transactionOwnerShipToken) {\n return transactionOwnerShipToken\n .waitForCompositionComplete()\n .then(() => {\n this.compositionTransactionOwnershipToken = null;\n return work();\n });\n }\n\n // otherwise, just swap\n return work();\n };\n\n // If there is layout instruction, new to compose layout before processing ViewPortComponent\n // layout controller/view/view-model is composed using composition engine APIs\n if (layoutInstruction) {\n if (!layoutInstruction.viewModel) {\n // createController chokes if there's no viewmodel, so create a dummy one\n // but avoid using a POJO as it creates unwanted metadata in Object constructor\n layoutInstruction.viewModel = new EmptyLayoutViewModel();\n }\n\n // using composition engine to create compose layout\n return this.compositionEngine\n // first create controller from layoutInstruction\n // and treat it as CompositionContext\n // then emulate slot projection with ViewPortComponent view\n .createController(layoutInstruction as CompositionContext)\n .then((layoutController: Controller) => {\n const layoutView = layoutController.view;\n ShadowDOM.distributeView(viewPortController.view, layoutController.slots || layoutView.slots);\n // when there is a layout\n // view hierarchy is: owner view -> layout view -> ViewPortComponent view\n layoutController.automate(createOverrideContext(layoutInstruction.viewModel), this.owningView);\n layoutView.children.push(viewPortController.view);\n return layoutView || layoutController;\n })\n .then((newView: View | Controller) => {\n this.view = newView as View;\n return ready(newView as View);\n });\n }\n\n // if there is no layout, then get ViewPortComponent view ready as view property\n // and process controller/swapping\n // when there is no layout\n // view hierarchy is: owner view -> ViewPortComponent view\n this.view = viewPortController.view;\n\n return ready(this.owningView);\n }\n\n /**\n * Notify composition transaction that this router has finished processing\n * Happens when this is the root router-view\n * @internal\n */\n _notify() {\n const notifier = this.compositionTransactionNotifier;\n if (notifier) {\n notifier.done();\n this.compositionTransactionNotifier = null;\n }\n }\n}\n\n/**\n* Locator which finds the nearest RouterView, relative to the current dependency injection container.\n*/\nexport class RouterViewLocator {\n\n /*@internal */\n promise: Promise;\n\n /*@internal */\n resolve: (val?: any) => void;\n\n /**\n * Creates an instance of the RouterViewLocator class.\n */\n constructor() {\n this.promise = new Promise((resolve) => this.resolve = resolve);\n }\n\n /**\n * Finds the nearest RouterView instance.\n * @returns A promise that will be resolved with the located RouterView instance.\n */\n findNearest(): Promise {\n return this.promise;\n }\n\n /**@internal */\n _notify(routerView: RouterView): void {\n this.resolve(routerView);\n }\n}\n","import { Origin } from 'aurelia-metadata';\nimport { relativeToFile } from 'aurelia-path';\nimport { NavigationInstruction, RouteConfig, RouteLoader, Router } from 'aurelia-router';\nimport { CompositionEngine, customElement, inlineView, useView, CompositionContext } from 'aurelia-templating';\nimport { RouterViewLocator } from './router-view';\nimport { Container } from 'aurelia-dependency-injection';\n\n/**@internal exported for unit testing */\nexport class EmptyClass { }\ninlineView('')(EmptyClass);\n\n/**\n * Default implementation of `RouteLoader` used for loading component based on a route config\n */\nexport class TemplatingRouteLoader extends RouteLoader {\n\n /**@internal */\n static inject = [CompositionEngine];\n\n /**@internal */\n compositionEngine: CompositionEngine;\n\n constructor(\n compositionEngine: CompositionEngine\n ) {\n super();\n this.compositionEngine = compositionEngine;\n }\n\n /**\n * Resolve a view model from a RouteConfig\n * Throws when there is neither \"moduleId\" nor \"viewModel\" property\n * @internal\n */\n resolveViewModel(router: Router, config: RouteConfig): Promise {\n return new Promise((resolve, reject) => {\n let viewModel: string | null | Function;\n if ('moduleId' in config) {\n let moduleId = config.moduleId;\n if (moduleId === null) {\n viewModel = EmptyClass;\n } else {\n // this requires container of router has passes a certain point\n // where a view model has been setup on the container\n // it will fail in enhance scenario because no viewport has been registered\n moduleId = relativeToFile(moduleId, Origin.get(router.container.viewModel.constructor).moduleId);\n if (/\\.html/i.test(moduleId)) {\n viewModel = createDynamicClass(moduleId);\n } else {\n viewModel = moduleId;\n }\n }\n return resolve(viewModel);\n }\n // todo: add if ('viewModel' in config) to support static view model resolution\n reject(new Error('Invalid route config. No \"moduleId\" found.'));\n });\n }\n\n /**\n * Create child container based on a router container\n * Also ensures that child router are properly constructed in the newly created child container\n * @internal\n */\n createChildContainer(router: Router): Container {\n const childContainer = router.container.createChild();\n\n childContainer.registerSingleton(RouterViewLocator);\n childContainer.getChildRouter = function() {\n let childRouter: Router;\n\n childContainer.registerHandler(\n Router,\n () => childRouter || (childRouter = router.createChild(childContainer))\n );\n\n return childContainer.get(Router);\n };\n return childContainer;\n }\n\n /**\n * Load corresponding component of a route config of a navigation instruction\n */\n loadRoute(router: Router, config: RouteConfig, _navInstruction: NavigationInstruction): Promise {\n return this\n .resolveViewModel(router, config)\n .then(viewModel => this.compositionEngine.ensureViewModel({\n viewModel: viewModel,\n childContainer: this.createChildContainer(router),\n view: config.view || config.viewStrategy,\n router: router\n } as CompositionContext));\n }\n}\n\n/**@internal exported for unit testing */\nexport function createDynamicClass(moduleId: string) {\n const name = /([^\\/^\\?]+)\\.html/i.exec(moduleId)[1];\n\n class DynamicClass {\n\n $parent: any;\n\n bind(bindingContext: any) {\n this.$parent = bindingContext;\n }\n }\n\n customElement(name)(DynamicClass);\n useView(moduleId)(DynamicClass);\n\n return DynamicClass;\n}\n","import { IStaticResourceConfig } from 'aurelia-templating';\nimport { Router } from 'aurelia-router';\nimport { DOM } from 'aurelia-pal';\nimport * as LogManager from 'aurelia-logging';\n\nconst logger = LogManager.getLogger('route-href');\n\n/**\n * Helper custom attribute to help associate an element with a route by name\n */\nexport class RouteHref {\n\n /*@internal */\n static inject() {\n return [Router, DOM.Element];\n }\n\n /**\n * @internal Actively avoid using decorator to reduce the amount of code generated\n */\n static $resource: IStaticResourceConfig = {\n type: 'attribute',\n name: 'route-href',\n bindables: [\n { name: 'route', changeHandler: 'processChange', primaryProperty: true },\n { name: 'params', changeHandler: 'processChange' },\n 'attribute'\n ] as any // type definition of Aurelia templating is wrong\n };\n\n /**\n * Current router of this attribute\n */\n readonly router: Router;\n\n /**\n * Element this attribute is associated with\n */\n readonly element: Element;\n\n /**@internal */\n isActive: boolean;\n\n /**\n * Name of the route this attribute refers to. This name should exist in the current router hierarchy\n */\n route: string;\n\n /**\n * Parameters of this attribute to generate URL.\n */\n params: Record;\n\n /**\n * Target property on a custom element if this attribute is put on a custom element\n * OR an attribute if this attribute is put on a normal element\n */\n attribute: string;\n\n constructor(\n router: Router,\n element: Element\n ) {\n this.router = router;\n this.element = element;\n this.attribute = 'href';\n }\n\n bind() {\n this.isActive = true;\n this.processChange();\n }\n\n unbind() {\n this.isActive = false;\n }\n\n attributeChanged(value: any, previous: any) {\n if (previous) {\n this.element.removeAttribute(previous);\n }\n\n return this.processChange();\n }\n\n processChange() {\n return this.router\n .ensureConfigured()\n .then((): null => {\n if (!this.isActive) {\n // returning null to avoid Bluebird warning\n return null;\n }\n const element = this.element as Element & { au: any };\n\n const href = this.router.generate(this.route, this.params);\n\n if (element.au.controller) {\n element.au.controller.viewModel[this.attribute] = href;\n } else {\n element.setAttribute(this.attribute, href);\n }\n\n // returning null to avoid Bluebird warning\n return null;\n })\n .catch((reason: any) => {\n logger.error(reason);\n });\n }\n}\n\n","import { Router, AppRouter, RouteLoader } from 'aurelia-router';\nimport { TemplatingRouteLoader } from './route-loader';\nimport { RouterView } from './router-view';\nimport { RouteHref } from './route-href';\nimport { IFrameworkConfiguration } from './interfaces';\n\nexport function configure(config: IFrameworkConfiguration) {\n config\n .singleton(RouteLoader, TemplatingRouteLoader)\n .singleton(Router, AppRouter)\n .globalResources(\n RouterView,\n RouteHref\n );\n\n config.container.registerAlias(Router, AppRouter);\n}\n\nexport {\n TemplatingRouteLoader,\n RouterView,\n RouteHref\n};\n",null,null,null,null,null,null,null,null,null]} \ No newline at end of file +{"version":3,"sources":["../node_modules/promise-polyfill/dist/polyfill.min.js","../node_modules/requirejs/require.js","../node_modules/aurelia-binding/dist/commonjs/aurelia-binding.js","../node_modules/aurelia-bootstrapper/src/aurelia-bootstrapper.ts","../node_modules/aurelia-dependency-injection/dist/commonjs/aurelia-dependency-injection.js","../node_modules/aurelia-event-aggregator/dist/commonjs/aurelia-event-aggregator.js","../node_modules/aurelia-framework/src/framework-configuration.ts","../node_modules/aurelia-framework/src/aurelia.ts","../node_modules/aurelia-history-browser/src/link-handler.ts","../node_modules/aurelia-history-browser/src/browser-history.ts","../node_modules/aurelia-history-browser/src/aurelia-history-browser.ts","../node_modules/aurelia-history/dist/commonjs/aurelia-history.js","../node_modules/aurelia-loader-default/dist/commonjs/aurelia-loader-default.js","../node_modules/aurelia-loader/dist/commonjs/aurelia-loader.js","../node_modules/aurelia-logging-console/dist/commonjs/aurelia-logging-console.js","../node_modules/aurelia-logging/dist/commonjs/aurelia-logging.js","../node_modules/aurelia-metadata/dist/commonjs/aurelia-metadata.js","../node_modules/aurelia-pal-browser/dist/commonjs/aurelia-pal-browser.js","../node_modules/aurelia-pal/dist/commonjs/aurelia-pal.js","../node_modules/aurelia-path/src/index.ts","../node_modules/aurelia-polyfills/dist/commonjs/aurelia-polyfills.js","../node_modules/aurelia-route-recognizer/dist/commonjs/aurelia-route-recognizer.js","../node_modules/aurelia-router/src/navigation-instruction.ts","../node_modules/aurelia-router/src/nav-model.ts","../node_modules/aurelia-router/src/util.ts","../node_modules/aurelia-router/src/router-configuration.ts","../node_modules/aurelia-router/src/router.ts","../node_modules/aurelia-router/src/next.ts","../node_modules/aurelia-router/src/pipeline.ts","../node_modules/aurelia-router/src/navigation-commands.ts","../node_modules/aurelia-router/src/navigation-plan.ts","../node_modules/aurelia-router/src/step-build-navigation-plan.ts","../node_modules/aurelia-router/src/utilities-route-loading.ts","../node_modules/aurelia-router/src/route-loader.ts","../node_modules/aurelia-router/src/step-load-route.ts","../node_modules/aurelia-router/src/step-commit-changes.ts","../node_modules/aurelia-router/src/activation-strategy.ts","../node_modules/aurelia-router/src/utilities-activation.ts","../node_modules/aurelia-router/src/step-activation.ts","../node_modules/aurelia-router/src/pipeline-provider.ts","../node_modules/aurelia-router/src/app-router.ts","../node_modules/aurelia-router/src/pipeline-status.ts","../node_modules/aurelia-router/src/router-event.ts","../node_modules/aurelia-router/src/pipeline-slot-name.ts","../node_modules/aurelia-task-queue/dist/commonjs/aurelia-task-queue.js","../node_modules/aurelia-templating-binding/node_modules/tslib/tslib.es6.js","../node_modules/aurelia-templating-binding/src/attribute-map.ts","../node_modules/aurelia-templating-binding/src/interpolation-binding-expression.ts","../node_modules/aurelia-templating-binding/src/let-expression.ts","../node_modules/aurelia-templating-binding/src/let-interpolation-expression.ts","../node_modules/aurelia-templating-binding/src/syntax-interpreter.ts","../node_modules/aurelia-templating-binding/src/binding-language.ts","../node_modules/aurelia-templating-binding/src/aurelia-templating-binding.ts","../node_modules/aurelia-templating-resources/node_modules/tslib/tslib.es6.js","../node_modules/aurelia-templating-resources/src/compose.ts","../node_modules/aurelia-templating-resources/src/if-core.ts","../node_modules/aurelia-templating-resources/src/if.ts","../node_modules/aurelia-templating-resources/src/else.ts","../node_modules/aurelia-templating-resources/src/with.ts","../node_modules/aurelia-templating-resources/src/repeat-utilities.ts","../node_modules/aurelia-templating-resources/src/array-repeat-strategy.ts","../node_modules/aurelia-templating-resources/src/map-repeat-strategy.ts","../node_modules/aurelia-templating-resources/src/null-repeat-strategy.ts","../node_modules/aurelia-templating-resources/src/number-repeat-strategy.ts","../node_modules/aurelia-templating-resources/src/set-repeat-strategy.ts","../node_modules/aurelia-templating-resources/src/repeat-strategy-locator.ts","../node_modules/aurelia-templating-resources/src/analyze-view-factory.ts","../node_modules/aurelia-templating-resources/src/abstract-repeater.ts","../node_modules/aurelia-templating-resources/src/repeat.ts","../node_modules/aurelia-templating-resources/src/aurelia-hide-style.ts","../node_modules/aurelia-templating-resources/src/show.ts","../node_modules/aurelia-templating-resources/src/hide.ts","../node_modules/aurelia-templating-resources/src/html-sanitizer.ts","../node_modules/aurelia-templating-resources/src/sanitize-html.ts","../node_modules/aurelia-templating-resources/src/replaceable.ts","../node_modules/aurelia-templating-resources/src/focus.ts","../node_modules/aurelia-templating-resources/src/css-resource.ts","../node_modules/aurelia-templating-resources/src/attr-binding-behavior.ts","../node_modules/aurelia-templating-resources/src/binding-mode-behaviors.ts","../node_modules/aurelia-templating-resources/src/throttle-binding-behavior.ts","../node_modules/aurelia-templating-resources/src/debounce-binding-behavior.ts","../node_modules/aurelia-templating-resources/src/self-binding-behavior.ts","../node_modules/aurelia-templating-resources/src/binding-signaler.ts","../node_modules/aurelia-templating-resources/src/signal-binding-behavior.ts","../node_modules/aurelia-templating-resources/src/update-trigger-binding-behavior.ts","../node_modules/aurelia-templating-resources/src/dynamic-element.ts","../node_modules/aurelia-templating-resources/src/html-resource-plugin.ts","../node_modules/aurelia-templating-resources/src/aurelia-templating-resources.ts","../node_modules/aurelia-templating-router/node_modules/tslib/tslib.es6.js","../node_modules/aurelia-templating-router/src/router-view.ts","../node_modules/aurelia-templating-router/src/route-loader.ts","../node_modules/aurelia-templating-router/src/route-href.ts","../node_modules/aurelia-templating-router/src/aurelia-templating-router.ts","../node_modules/aurelia-templating/src/element-events.ts","../node_modules/aurelia-templating/src/instructions.ts","../node_modules/aurelia-templating/node_modules/tslib/tslib.es6.js","../node_modules/aurelia-templating/src/util.ts","../node_modules/aurelia-templating/src/behavior-property-observer.ts","../node_modules/aurelia-templating/src/bindable-property.ts","../node_modules/aurelia-templating/src/view-locator.ts","../node_modules/aurelia-templating/src/binding-language.ts","../node_modules/aurelia-templating/src/shadow-dom.ts","../node_modules/aurelia-templating/src/composition-transaction.ts","../node_modules/aurelia-templating/src/view.ts","../node_modules/aurelia-templating/src/animator.ts","../node_modules/aurelia-templating/src/view-slot.ts","../node_modules/aurelia-templating/src/view-factory.ts","../node_modules/aurelia-templating/src/view-compiler.ts","../node_modules/aurelia-templating/src/view-engine-hooks-resource.ts","../node_modules/aurelia-templating/src/module-analyzer.ts","../node_modules/aurelia-templating/src/view-engine.ts","../node_modules/aurelia-templating/src/controller.ts","../node_modules/aurelia-templating/src/html-behavior.ts","../node_modules/aurelia-templating/src/view-resources.ts","../node_modules/aurelia-templating/src/view-strategy.ts","../node_modules/aurelia-templating/src/swap-strategies.ts","../node_modules/aurelia-templating/src/composition-engine.ts","../node_modules/aurelia-templating/src/animation-event.ts","../node_modules/aurelia-templating/src/child-observation.ts","../node_modules/aurelia-templating/src/element-config.ts","../node_modules/aurelia-templating/src/decorators.ts","../node_modules/aurelia-templating/src/templating-engine.ts","../node_modules/aurelia-testing/src/compile-spy.ts","../node_modules/aurelia-testing/src/view-spy.ts","../node_modules/aurelia-testing/node_modules/tslib/tslib.es6.js","../node_modules/aurelia-testing/src/wait.ts","../node_modules/aurelia-testing/src/component-tester.ts","../node_modules/aurelia-testing/src/aurelia-testing.ts","../node_modules/clipboard/dist/clipboard.js","../node_modules/phaser/dist/phaser.js","../node_modules/text/text.js"],"names":["PLATFORM","isInitialized","TheLogManager","ViewEngine","join","HtmlBehaviorResource","DOM","Container","ViewResources","Loader","BindingLanguage","TemplatingEngine","CompositionTransaction","relativeToFile","ViewSlot","tslib_1.__extends","History","RouteRecognizer","LogManager.getLogger","EventAggregator","PipelineStatus","RouterEvent","PipelineSlotName","camelCase","SVGAnalyzer","LogManager","bindingMode","enqueueBindingConnect","connectable","sourceContext","BehaviorInstruction","BindingExpression","ListenerExpression","delegationStrategy","CallExpression","Parser","ObserverLocator","EventManager","NameExpression","LiteralString","CompositionEngine","TaskQueue","bindable","noView","customElement","customAttribute","templateController","inject","BoundViewFactory","createOverrideContext","BindingBehavior","ValueConverter","mergeSplice","TargetInstruction","FEATURE","Animator","Optional","valueConverter","resource","DataAttributeObserver","bindingBehavior","mixin","targetContext","EventSubscriber","useView","useShadowDOM","getLogger","configure","configureHtmlResourcePlugin","Router","ViewLocator","Origin","SwapStrategies","ShadowDOM","inlineView","RouteLoader","AppRouter","subscriberCollection","metadata","resolver","TemplateRegistryEntry","ValueConverterResource","BindingBehaviorResource","protocol","View"],"mappings":"AAAA;AACA;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjmEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACzhLA,IAAI,iBAAiB,GAAG,EAAE,CAAC;AAC3B,IAAI,YAA2E,CAAC;AAEhF,IAAM,YAAY,GAAG,IAAI,OAAO,CAAmB,UAAA,OAAO,EAAI,EAAA,OAAA,YAAY,GAAG,OAAO,CAAtB,EAAsB,CAAC,CAAC;AACtF,IAAM,IAAI,GAAGA,mBAAQ,CAAC,MAAM,CAAC;AAC7B,IAAM,UAAU,GAAG,OAAO,OAAO,KAAK,WAAW,IAAI,CAAE,OAA0B,CAAC,OAAO,CAAC;AAE1F,SAAS,KAAK,GAAA;AACZ,IAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,KAAK,UAAU,EAAE;AAC7D,QAAA,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC1B,KAAA;AAED,IAAA,OAAO,IAAI,OAAO,CAAO,UAAA,OAAO,EAAA;QAC9B,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;AAC9D,QAAA,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEzC,QAAA,SAAS,SAAS,GAAA;YAChB,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;AACjE,YAAA,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAC5C,YAAA,OAAO,EAAE,CAAC;SACX;AACH,KAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,YAAY,GAAA;IASnB,IAAIA,mBAAQ,CAAC,MAAM,EAAE;QACnB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAIA,mBAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;AAC/C,KAAA;AAED,IAAA,IAAI,OAAO,mBAAmB,KAAK,WAAW,EAAE;AAE9C,QAAA,IAAI,OAAO,mBAAmB,KAAK,WAAW,EAAE;YAI9C,IAAM,CAAC,GAAG,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC,CAAC;YACzE,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;AAC/C,SAAA;AAGD,QAAA,IAAI,IAAI,CAAC,MAAM,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE;AAC3D,YAAA,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,UAAA,GAAG,EAAA;gBAC3D,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;AAC9D,aAAC,CAAC,CAAC,IAAI,CAAC,UAAA,UAAU,EAAA;gBAChB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAA,CAAC,EAAA,EAAI,OAAA,IAAI,CAAC,CAAC,aAAa,EAAE,CAAA,EAAA,CAAC,CAAC;AACzE,aAAC,CAAC,CAAC;AACJ,SAAA;QAGD,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,QAAQ,EAAE;AAClH,YAAA,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM,EAAA,EAAK,OAAA,IAAI,CAAC,OAAO,CAAC,CAAC,wBAAwB,CAAC,EAAE,UAAA,CAAC,EAAA,EAAI,OAAA,OAAO,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC,CAAA,EAAA,EAAE,MAAM,CAAC,CAArF,EAAqF,CAAC,CAAC;AAChI,SAAA;AAGD,QAAA,IAAI,UAAU,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,WAAW,EAAE;YAIxF,IAAM,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;YAClD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;AAC9C,SAAA;AACF,KAAA;AAED,IAAA,OAAO,OAAO,CAAC,MAAM,CAAC,mIAAmI,CAAC,CAAC;AAC7J,CAAC;AAED,SAAS,aAAa,CAAC,MAAc,EAAA;AACnC,IAAA,IAAIC,wBAAa;AAAE,QAAA,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAE5C,IAAA,IAAI,IAAI,CAAC;AAET,IAAA,IAAM,UAAU,GAAG,UAAU,KAAM,OAA0B,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAEtH,IAAA,IAAI,UAAU,IAAI,CAAC,UAAU,EAAE;QAC7B,IAAI,GAAG,QAAQ,CAAC;AACjB,KAAA;AAAM,SAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACxC,IAAI,GAAG,SAAS,CAAC;AAClB,KAAA;AAAM,SAAA,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QACtC,IAAI,GAAG,QAAQ,CAAC;AACjB,KAAA;AAAM,SAAA;AACL,QAAA,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;AACzE,KAAA;AAKD,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC,cAAc,GAAG,IAAI,CAAC;SACjC,IAAI,CAAC,UAAA,SAAS,EAAI,EAAA,OAAA,IAAI,KAAK,QAAQ,IAAI,CAACA,wBAAa,IAAI,SAAS,CAAC,SAAS,EAAE,IAAI,SAAS,CAAC,UAAU,EAAE,CAAA,EAAA,CAAC,CAAC;AAC1H,CAAC;AAED,SAAS,eAAe,CAAC,MAAc,EAAA;AACrC,IAAA,IAAM,GAAG,GAAG,UAAC,QAAQ,EAAE,UAAU,EAAA;AAC/B,QAAA,OAAA,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC;aAC/B,IAAI,CAAC,UAAA,UAAU,EAAA;AACd,YAAA,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AACjC,YAAA,OAAO,UAAU,CAAC;AACpB,SAAC,CAAC,CAAA;AAJR,KAIQ,CAAC;IAEX,OAAO,aAAa,CAAC,MAAM,CAAC;SACzB,IAAI,CAAC,YAAM,EAAA,OAAA,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAxC,EAAwC,CAAC;SACpD,IAAI,CAAC,UAAA,gBAAgB,EAAA;QAIpB,IAAM,gBAAgB,GAAG,GAAG,CAACD,mBAAQ,CAAC,UAAU,CAAC,mBAAmB,EAAE,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,EAClE,gBAAgB,CAAC,CAAC;QAG/C,OAAO,OAAO,CAAC,GAAG,CAAC;YACjB,gBAAgB;AAChB,YAAA,gBAAgB,CAAC,IAAI,CAAC,UAAA,aAAa,EAAI,EAAA,OAAA,GAAG,CAAC,8BAA8B,EAAE,aAAa,CAAC,CAAA,EAAA,CAAC;AAC1F,YAAA,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;AACvC,YAAA,GAAG,CAAC,yBAAyB,EAAE,gBAAgB,CAAC;AACjD,SAAA,CAAC,CAAC;AACL,KAAC,CAAC;SACD,IAAI,CAAC,UAAC,EAAe,EAAA;AAAd,QAAA,IAAA,aAAa,GAAA,EAAA,CAAA,CAAA,CAAA,CAAA;AAAM,QAAA,OAAA,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;AAAhC,KAAgC,CAAC;SAC3D,IAAI,CAAC,UAAC,EAAsC,EAAA,EAAK,OAAA,YAAY,CAAC,YAAM,EAAA,OAAA,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA,EAAA,CAAC,CAAA,EAAA,CAAC,CAAC;AAClG,CAAC;AAED,SAAS,MAAM,CAAC,OAAgB,EAAE,cAAsB,EAAE,OAAgB,EAAA;AACxE,IAAA,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC;AACvB,IAAA,OAAO,CAAC,cAAc,GAAG,cAAc,IAAI,IAAI,CAAC;AAEhD,IAAA,IAAI,cAAc,EAAE;QAClB,OAAO,OAAO,CAAC,MAAM;aAClB,UAAU,CAAC,cAAc,CAAC;aAC1B,IAAI,CAAC,UAAA,YAAY,EAAA;AAChB,YAAA,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE;AAC3B,gBAAA,MAAM,IAAI,KAAK,CAAC,oCAA6B,cAAc,EAAA,iCAAA,CAAiC,CAAC,CAAC;AAC/F,aAAA;AAED,YAAA,OAAO,YAAY,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACzC,SAAC,CAAC,CAAC;AACN,KAAA;AAED,IAAA,OAAO,CAAC,GAAG;AACH,SAAA,qBAAqB,EAAE;AACvB,SAAA,kBAAkB,EAAE,CAAC;AAE7B,IAAA,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,YAAA,EAAM,OAAA,OAAO,CAAC,OAAO,EAAE,CAAjB,EAAiB,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,GAAG,GAAA;AACV,IAAA,OAAO,KAAK,EAAE;SACX,IAAI,CAAC,YAAY,CAAC;SAClB,IAAI,CAAC,eAAe,CAAC;AACrB,SAAA,IAAI,CAAC,YAAA;QACJ,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,kCAAkC,CAAC,CAAC;AACpF,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACjD,YAAA,IAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC5B,YAAA,IAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;AACrG,YAAA,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AACrD,SAAA;QAID,IAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC9C,QAAA,IAAM,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,UAAA,CAAC,EAAA,EAAI,OAAA,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAlB,EAAkB,CAAC,CAAC;QAClE,iBAAiB,GAAG,IAAI,CAAC;AACzB,QAAA,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACjC,KAAC,CAAC,CAAC;AACP,CAAC;AASK,SAAU,SAAS,CAAC,SAAmB,EAAA;AAC3C,IAAA,IAAM,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,UAAA,OAAO,EAAA,EAAI,OAAA,SAAS,CAAC,OAAO,EAAE,CAAC,CAApB,EAAoB,CAAC,CAAC;AAC7D,IAAA,IAAI,iBAAiB;AAAE,QAAA,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjD,IAAA,OAAO,CAAC,CAAC;AACX,CAAC;AAMY,IAAA,QAAQ,GAAG,GAAG;;;;;;;;ACnM3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9qBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC9IA,IAAM,MAAM,GAAGE,wBAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAClD,IAAM,UAAU,GAAG,WAAW,CAAC;AAE/B,SAAS,QAAQ,CAAC,MAA8B,EAAE,KAAK,EAAA;AACrD,IAAA,IAAI,OAAO,CAAC;AACZ,IAAA,IAAI,IAAI,GAAG,YAAA;AACT,QAAA,OAAO,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;AACxB,QAAA,IAAI,OAAO,EAAE;AACX,YAAA,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACpD,SAAA;AAED,QAAA,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC3B,KAAC,CAAC;IAEF,OAAO,IAAI,EAAE,CAAC;AAChB,CAAC;AASD,SAAS,UAAU,CAAC,QAAgC,EAAE,MAAc,EAAE,IAAyB,EAAA;IAC7F,MAAM,CAAC,KAAK,CAAC,iBAAA,CAAA,MAAA,CAAkB,IAAI,CAAC,QAAQ,EAAG,GAAA,CAAA,CAAC,CAAC;AACjD,IAAA,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE;AACrC,QAAA,QAAQ,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;AAExD,QAAA,IAAI,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;AAEvB,QAAA,IAAI,IAAI,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAG;AACxC,YAAA,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAChE,iBAAA,IAAI,CAAC,UAAA,YAAY,EAAA,EAAI,OAAA,WAAW,CAAC,YAAY,CAAC,CAAA,EAAA,CAAC,CAAC;AACpD,SAAA;AAED,QAAA,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC;AACxB,KAAA;AAAM,SAAA,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,UAAU,EAAE;AAC/C,QAAA,IAAI,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;AAC7D,YAAA,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC1B,SAAA;QACD,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEhD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;AAChF,KAAA;AACD,IAAA,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE7E,SAAS,WAAW,CAAC,QAAQ,EAAA;QAC3B,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAA,CAAC,EAAA;YACvC,IAAI,WAAW,IAAI,CAAC,EAAE;AACpB,gBAAA,IAAI,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;AAC1D,oBAAA,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC1B,iBAAA;AACD,gBAAA,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAA;oBACpE,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAC7C,oBAAA,QAAQ,CAAC,mBAAmB,GAAG,IAAI,CAAC;oBACpC,MAAM,CAAC,KAAK,CAAC,oBAAA,CAAA,MAAA,CAAqB,IAAI,CAAC,QAAQ,EAAG,GAAA,CAAA,CAAC,CAAC;AACtD,iBAAC,CAAC,CAAC;AACJ,aAAA;AAED,YAAA,QAAQ,CAAC,mBAAmB,GAAG,IAAI,CAAC;YACpC,MAAM,CAAC,KAAK,CAAC,gBAAA,CAAA,MAAA,CAAiB,IAAI,CAAC,QAAQ,EAAG,GAAA,CAAA,CAAC,CAAC;AAClD,SAAC,CAAC,CAAC;KACJ;AACH,CAAC;AAED,SAAS,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAA;IAI3D,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;AAC7C,QAAA,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC1B,KAAA;IACD,IAAI,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,CAACC,4BAAU,CAAC,CAAC;IAEnD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,UAAA,CAAC,EAAI,EAAA,OAAA,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA,EAAA,CAAC,CAAC;SACtF,IAAI,CAAC,UAAA,KAAK,EAAA;QACT,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,IAAI,SAAS,GAAG,EAAE,CAAC;AAEnB,QAAA,KAAK,CAAC,OAAO,CAAC,UAAA,CAAC,EAAA;AACb,YAAA,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACtB,YAAA,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC7B,SAAC,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC,mBAAmB,CAAC,SAAS,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;AACxE,KAAC,CAAC,CAAC;IAEL,SAAS,UAAU,CAAC,IAAI,EAAA;AACtB,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC7B,QAAA,IAAI,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAE3B,QAAA,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE;AAC7B,YAAA,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAChC,SAAA;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC;aACvD,IAAI,CAAC,UAAA,UAAU,EAAA;YACd,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,QAAQ;AACnB,gBAAA,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,UAAU;aACxF,CAAC;AACJ,SAAC,CAAC,CAAC;KACN;IAED,SAAS,eAAe,CAAC,IAAI,EAAA;AAC3B,QAAA,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AACvB,QAAA,IAAI,CAAC,GAAG;AAAE,YAAA,OAAO,KAAK,CAAC;QACvB,IAAI,GAAG,KAAK,EAAE;AAAE,YAAA,OAAO,KAAK,CAAC;AAC7B,QAAA,IAAI,GAAG,KAAK,KAAK,IAAI,GAAG,KAAK,KAAK;AAAE,YAAA,OAAO,KAAK,CAAC;AACjD,QAAA,OAAO,IAAI,CAAC;KACb;IAED,SAAS,SAAS,CAAC,IAAI,EAAA;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;KACrC;AAED,IAAA,SAAS,cAAc,CAAC,UAAU,EAAE,GAAG,EAAA;QACrC,OAAO,SAAS,CAAC,UAAU,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;KAC1C;AACH,CAAC;AAED,SAAS,MAAM,CAAC,IAAY,EAAA;IAC1B,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AACnC,IAAA,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;AAC7B,QAAA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AACjC,KAAA;AACH,CAAC;AAED,SAAS,aAAa,CAAC,MAA8B,EAAA;AACnD,IAAA,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,UAAA,CAAC,EAAA,EAAI,OAAA,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA,EAAA,CAAC,CAAC,CAAC,IAAI,CAAC,YAAA;AAC3F,QAAA,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;AAChC,KAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,eAAe,CAAC,OAA+B,EAAA;IACtD,IAAI,OAAO,CAAC,SAAS,EAAE;AACrB,QAAA,MAAM,IAAI,KAAK,CAAC,wIAAwI,CAAC,CAAC;AAC3J,KAAA;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAQ,EAAE,IAAY,EAAA;AAC9C,IAAA,OAAO,kBAAW,IAAI,EAAA,IAAA,CAAA,CAAA,MAAA,CAAK,GAAG,EAAM,KAAA,CAAA,CAAA,MAAA,CAAA,IAAI,4DAAyD,CAAC;AACpG,CAAC;AAKD,IAAA,sBAAA,IAAA,YAAA;AA+CE,IAAA,SAAA,sBAAA,CAAY,OAAgB,EAAA;QAA5B,IAqBC,KAAA,GAAA,IAAA,CAAA;AApBC,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,QAAA,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;AACnC,QAAA,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;AACf,QAAA,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;AACvB,QAAA,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;AACnB,QAAA,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;AAKpB,QAAA,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;AAK1B,QAAA,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;AAC5B,QAAA,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;AAC1B,QAAA,IAAI,CAAC,OAAO,CAAC,YAAA,EAAM,OAAA,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,sBAAsB,EAAE,SAAS,CAAC;AAC3E,aAAA,IAAI,CAAC,UAAA,IAAI,EAAI,EAAA,OAAA,KAAI,CAAC,gBAAgB,GAAG,IAAI,GAAA,CAAC,CAD1B,EAC0B,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ,CAAC,YAAA,EAAM,OAAA,aAAa,CAAC,OAAO,EAAE,KAAI,CAAC,eAAe,EAAE,OAAO,CAAC,SAAS,CAAC,CAA/D,EAA+D,CAAC,CAAC;KACtF;AAQD,IAAA,sBAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,IAAS,EAAE,QAAa,EAAA;QAC/B,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAChD,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAQD,IAAA,sBAAA,CAAA,SAAA,CAAA,SAAS,GAAT,UAAU,IAAS,EAAE,cAAyB,EAAA;QAC5C,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,cAAqB,CAAC,CAAC;AAC9D,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAQD,IAAA,sBAAA,CAAA,SAAA,CAAA,SAAS,GAAT,UAAU,IAAS,EAAE,cAAyB,EAAA;QAC5C,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,cAAqB,CAAC,CAAC;AAC9D,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;IAOD,sBAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,IAAc,EAAA;QACpB,eAAe,CAAC,IAAI,CAAC,CAAC;AACtB,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;IAOD,sBAAQ,CAAA,SAAA,CAAA,QAAA,GAAR,UAAS,IAAc,EAAA;QACrB,eAAe,CAAC,IAAI,CAAC,CAAC;AACtB,QAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAQD,IAAA,sBAAA,CAAA,SAAA,CAAA,OAAO,GAAP,UAAQ,MAA8E,EAAE,MAAgB,EAAA;AAAhB,QAAA,IAAA,MAAA,KAAA,KAAA,CAAA,EAAA,EAAA,MAAgB,GAAA,EAAA,CAAA,EAAA;QACtG,QAAQ,OAAO,MAAM;AACrB,YAAA,KAAK,QAAQ;gBACX,IAAI,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACxC,gBAAA,IAAI,QAAQ,GAAG,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AACvE,gBAAA,IAAI,IAAI,GAAG,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;gBACnD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,UAAA,EAAE,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,MAAM,EAAA,MAAA,EAAE,CAAC,CAAC;gBACtE,MAAM;AAER,YAAA,KAAK,UAAU;AACb,gBAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC;gBAC5D,MAAM;AACR,YAAA;gBACE,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AACtD,SAAA;AACD,QAAA,OAAO,IAAI,CAAC;KAEb,CAAA;IAOD,sBAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,SAAuD,EAAA;QAAvE,IAoCC,KAAA,GAAA,IAAA,CAAA;QAnCC,eAAe,CAAC,IAAI,CAAC,CAAC;AAGtB,QAAA,IAAI,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,SAAS,CAAC;AAC7D,QAAA,IAAI,QAAQ,CAAC;QACb,IAAI,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAE/D,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC9C,YAAA,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACpB,QAAQ,OAAO,QAAQ;AACvB,gBAAA,KAAK,QAAQ;AACX,oBAAA,IAAI,QAAM,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC;AACpC,oBAAA,IAAI,WAAW,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC;oBACzC,IAAI,MAAI,GAAG,QAAQ,CAAC;AAEpB,oBAAA,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,QAAM,KAAK,EAAE,EAAE;AAC9E,wBAAA,MAAI,GAAGC,gBAAI,CAAC,QAAM,EAAE,QAAQ,CAAC,CAAC;AAC/B,qBAAA;AAED,oBAAA,IAAI,CAAC,eAAe,CAAC,MAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAI,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;oBACzE,MAAM;AACR,gBAAA,KAAK,UAAU;AACb,oBAAA,IAAI,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;oBACzE,IAAI,IAAI,YAAYC,sCAAoB,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;wBACrE,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;AACzC,4BAAA,IAAI,CAAC,QAAQ,CAAC,YAAA,EAAM,OAAA,aAAa,CAAC,KAAI,CAAC,CAAA,EAAA,CAAC,CAAC;AAC1C,yBAAA;AACF,qBAAA;oBACD,MAAM;AACR,gBAAA;oBACE,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AACzD,aAAA;AACF,SAAA;AAED,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAQD,IAAA,sBAAA,CAAA,SAAA,CAAA,UAAU,GAAV,UAAW,YAAoB,EAAE,OAAe,EAAA;QAC9C,eAAe,CAAC,IAAI,CAAC,CAAC;AACtB,QAAA,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;AAC3E,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAQD,IAAA,sBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,UACE,MAAyF,EACzF,YAAkB,EAAA;QAElB,eAAe,CAAC,IAAI,CAAC,CAAC;AAEtB,QAAA,IAAI,IAAyB,CAAC;QAC9B,QAAQ,OAAO,MAAM;AACrB,YAAA,KAAK,QAAQ;gBACX,IAAI,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,YAAY,IAAI,EAAE,EAAE,CAAC;gBAC3F,MAAM;AACR,YAAA,KAAK,UAAU;AACb,gBAAA,IAAI,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,IAAI,EAAE,EAAE,CAAC;gBACzD,MAAM;AACR,YAAA;gBACE,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AACrD,SAAA;AACD,QAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAGD,IAAA,sBAAA,CAAA,SAAA,CAAA,oBAAoB,GAApB,UAAqB,IAAI,EAAE,MAAO,EAAA;QAAlC,IAYC,KAAA,GAAA,IAAA,CAAA;QAXC,IAAI,MAAM,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC;AACvF,QAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEvB,IAAI,CAAC,OAAO,CAAC,YAAA;YACX,IAAI,UAAU,GAAG,CAAC,IAAI,EAAE,KAAI,CAAC,gBAAgB,CAAC,CAAC;AAC/C,YAAA,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;AACvB,YAAA,MAAM,CAAC,mBAAmB,GAAG,UAAU,CAAC;AACxC,YAAA,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC3B,SAAC,CAAC,CAAC;AAEH,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAcD,IAAA,sBAAA,CAAA,SAAA,CAAA,sBAAsB,GAAtB,YAAA;AACE,QAAA,OAAO,IAAI,CAAC,oBAAoB,CAAC,4BAA4B,CAAC,CAAC;KAChE,CAAA;AAMD,IAAA,sBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,OAAO,IAAI,CAAC,oBAAoB,CAAC,2BAA2B,CAAC,CAAC;KAC/D,CAAA;AAMD,IAAA,sBAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;AACE,QAAA,OAAO,IAAI,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,CAAC;KAC7D,CAAA;AAMD,IAAA,sBAAA,CAAA,SAAA,CAAA,gBAAgB,GAAhB,YAAA;AACE,QAAA,OAAO,IAAI,CAAC,oBAAoB,CAAC,8BAA8B,CAAC,CAAC;KAClE,CAAA;AAMD,IAAA,sBAAA,CAAA,SAAA,CAAA,eAAe,GAAf,YAAA;AACE,QAAA,OAAO,IAAI,CAAC,oBAAoB,CAAC,0BAA0B,CAAC,CAAC;KAC9D,CAAA;AAMD,IAAA,sBAAA,CAAA,SAAA,CAAA,kBAAkB,GAAlB,YAAA;QACE,OAAO,IAAI,CAAC,sBAAsB,EAAE,CAAC,gBAAgB,EAAE,CAAC,eAAe,EAAE,CAAC;KAC3E,CAAA;AAMD,IAAA,sBAAA,CAAA,SAAA,CAAA,qBAAqB,GAArB,YAAA;QACE,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC;KACrD,CAAA;IAOD,sBAAkB,CAAA,SAAA,CAAA,kBAAA,GAAlB,UAAmB,KAAc,EAAA;QAAjC,IAiBC,KAAA,GAAA,IAAA,CAAA;AAhBC,QAAA,IAAI,QAAQ,GAAG,KAAK,GAAGH,wBAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;QAEjE,IAAI,QAAQ,KAAK,SAAS,EAAE;AAC1B,YAAA,QAAQ,GAAGA,wBAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;AACzC,SAAA;QAED,IAAI,CAAC,OAAO,CAAC,YAAA;AACX,YAAA,OAAO,KAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,yBAAyB,EAAE,KAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,UAAA,IAAI,EAAA;AAC9F,gBAAA,OAAO,KAAI,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAA,CAAC,EAAA;oBAChDA,wBAAa,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;AACnD,oBAAAA,wBAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACnC,iBAAC,CAAC,CAAC;AACL,aAAC,CAAC,CAAC;AACL,SAAC,CAAC,CAAC;AAEH,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAMD,IAAA,sBAAA,CAAA,SAAA,CAAA,KAAK,GAAL,YAAA;QAAA,IAuBC,KAAA,GAAA,IAAA,CAAA;QAtBC,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,YAAA,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC1B,SAAA;QAED,OAAO,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,YAAA;AACxC,YAAA,IAAI,MAAM,GAAG,KAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AACjC,YAAA,IAAI,IAAI,GAAG,KAAI,CAAC,IAAI,CAAC;AACrB,YAAA,IAAI,OAAO,CAAC;AAEZ,YAAA,IAAI,IAAI,GAAG,YAAA;AACT,gBAAA,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;AACvB,gBAAA,IAAI,OAAO,EAAE;AACX,oBAAA,OAAO,UAAU,CAAC,KAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrD,iBAAA;AAED,gBAAA,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;AACtB,gBAAA,KAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;AAC9B,gBAAA,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC3B,aAAC,CAAC;AAEF,YAAA,OAAO,IAAI,EAAE,CAAC,IAAI,CAAC,YAAA,EAAM,OAAA,QAAQ,CAAC,KAAI,EAAE,KAAI,CAAC,SAAS,CAAC,CAA9B,EAA8B,CAAC,CAAC;AAC3D,SAAC,CAAC,CAAC;KACJ,CAAA;IACH,OAAC,sBAAA,CAAA;AAAD,CAAC,EAAA;;AC/fD,SAAS,2BAA2B,GAAA;AAClC,IAAAI,cAAG,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAA,GAAG,EAAA;AAChC,QAAA,IAAM,MAAM,GAAG,GAAG,CAAC,MAAyB,CAAC;AAC7C,QAAA,IAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAE7B,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,MAAM,IAAI,CAAC,MAAM,EAAE;YACtD,GAAG,CAAC,cAAc,EAAE,CAAC;AACtB,SAAA;KACF,EAAE,KAAK,CAAC,CAAC;AACZ,CAAC;AAKD,IAAA,OAAA,IAAA,YAAA;AAgDE,IAAA,SAAA,OAAA,CAAY,MAAe,EAAE,SAAqB,EAAE,SAAyB,EAAA;QAC3E,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,IAAIN,mBAAQ,CAAC,MAAM,EAAE,CAAC;AAC9C,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,CAAC,IAAIO,oCAAS,EAAE,EAAE,UAAU,EAAE,CAAC;QAC7D,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,IAAIC,+BAAa,EAAE,CAAC;QAClD,IAAI,CAAC,GAAG,GAAG,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAGN,wBAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACjD,QAAA,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;AAC5B,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAACO,oBAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAACD,+BAAa,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;KAClD;AAMD,IAAA,OAAA,CAAA,SAAA,CAAA,KAAK,GAAL,YAAA;QAAA,IAoBC,KAAA,GAAA,IAAA,CAAA;QAnBC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;AACtB,SAAA;AAED,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AACrC,QAAA,OAAO,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,YAAA;AAC3C,YAAA,2BAA2B,EAAE,CAAC;YAE9B,IAAI,CAAC,KAAI,CAAC,SAAS,CAAC,WAAW,CAACE,iCAAe,CAAC,EAAE;gBAChD,IAAI,OAAO,GAAG,mEAAmE,CAAC;AAClF,gBAAA,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3B,gBAAA,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC1B,aAAA;AAED,YAAA,KAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;AACpC,YAAA,IAAI,GAAG,GAAGJ,cAAG,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AACxF,YAAAA,cAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;AACvB,YAAA,OAAO,KAAI,CAAC;AACd,SAAC,CAAC,CAAC;KACJ,CAAA;AAQD,IAAA,OAAA,CAAA,SAAA,CAAA,OAAO,GAAP,UAAQ,cAA2B,EAAE,eAAwC,EAAA;QAA7E,IAUC,KAAA,GAAA,IAAA,CAAA;AAVO,QAAA,IAAA,cAAA,KAAA,KAAA,CAAA,EAAA,EAAA,cAA2B,GAAA,EAAA,CAAA,EAAA;AAAE,QAAA,IAAA,eAAA,KAAA,KAAA,CAAA,EAAA,EAAA,eAAwC,GAAA,IAAA,CAAA,EAAA;AAC3E,QAAA,IAAI,CAAC,cAAc,CAAC,eAAe,IAAIA,cAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAExE,QAAA,OAAO,IAAI,OAAO,CAAC,UAAA,OAAO,EAAA;YACxB,IAAI,MAAM,GAAG,KAAI,CAAC,SAAS,CAAC,GAAG,CAACK,kCAAgB,CAAqB,CAAC;AACtE,YAAA,KAAI,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,EAAC,SAAS,EAAE,KAAI,CAAC,SAAS,EAAE,OAAO,EAAE,KAAI,CAAC,IAAI,EAAE,SAAS,EAAE,KAAI,CAAC,SAAS,EAAE,cAAc,EAAE,cAAc,EAAC,CAAC,CAAC;AACvI,YAAA,KAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrB,KAAI,CAAC,kBAAkB,EAAE,CAAC;YAC1B,OAAO,CAAC,KAAI,CAAC,CAAC;AAChB,SAAC,CAAC,CAAC;KACJ,CAAA;AASD,IAAA,OAAA,CAAA,SAAA,CAAA,OAAO,GAAP,UAAQ,IAA8B,EAAE,eAAwC,EAAA;QAAhF,IAiCC,KAAA,GAAA,IAAA,CAAA;AAjCO,QAAA,IAAA,IAAA,KAAA,KAAA,CAAA,EAAA,EAAA,IAA8B,GAAA,IAAA,CAAA,EAAA;AAAE,QAAA,IAAA,eAAA,KAAA,KAAA,CAAA,EAAA,EAAA,eAAwC,GAAA,IAAA,CAAA,EAAA;QAC9E,IAAI,WAAW,GAAG,EAAwB,CAAC;AAE3C,QAAA,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YAClE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YACxC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;AACpC,SAAA;AAED,QAAA,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;QAErC,IAAI,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAACA,kCAAgB,CAAqB,CAAC;QACtE,IAAI,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAACC,wCAAsB,CAAC,CAAC;QAC7D,OAAQ,WAAmB,CAAC,kBAAkB,CAAC;QAE/C,IAAI,CAAC,IAAI,EAAE;YACT,IAAI,IAAI,CAAC,cAAc,EAAE;gBACvB,IAAI,GAAGC,0BAAc,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;AACrD,aAAA;AAAM,iBAAA;gBACL,IAAI,GAAG,KAAK,CAAC;AACd,aAAA;AACF,SAAA;AAED,QAAA,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC;QAC7B,WAAW,CAAC,SAAS,GAAG,WAAW,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;AACpE,QAAA,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACrC,QAAA,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAE7B,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,UAAC,CAAO,EAAA;AAC9C,YAAA,KAAI,CAAC,IAAI,GAAG,CAAC,CAAC;AACd,YAAA,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YAChC,KAAI,CAAC,kBAAkB,EAAE,CAAC;AAC1B,YAAA,OAAO,KAAI,CAAC;AACd,SAAC,CAAC,CAAC;KACJ,CAAA;IAGD,OAAc,CAAA,SAAA,CAAA,cAAA,GAAd,UAAe,eAAe,EAAA;QAC5B,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,OAAO;AACR,SAAA;AACD,QAAA,eAAe,GAAG,eAAe,IAAI,IAAI,CAAC,IAAI,CAAC;AAE/C,QAAA,IAAI,CAAC,eAAe,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE;YAC3D,IAAI,CAAC,IAAI,GAAGP,cAAG,CAAC,cAAc,CAAC,eAAe,IAAI,iBAAiB,CAAC,CAAC;AACtE,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;AAC7B,SAAA;AAED,QAAA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;AACd,YAAA,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;AACtD,SAAA;AAED,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AAC1B,QAAA,IAAI,CAAC,IAAY,CAAC,OAAO,GAAG,IAAI,CAAC;AAClC,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAIQ,0BAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9C,QAAA,IAAI,CAAC,QAAQ,CAAC,2BAA2B,EAAE,CAAC;AAC5C,QAAA,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAACR,cAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;KAC1D,CAAA;AAGD,IAAA,OAAA,CAAA,SAAA,CAAA,kBAAkB,GAAlB,YAAA;AACE,QAAA,IAAI,GAAG,GAAGA,cAAG,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AACzF,QAAA,UAAU,CAAC,YAAA,EAAM,OAAAA,cAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAtB,EAAsB,EAAE,CAAC,CAAC,CAAC;KAC7C,CAAA;IACH,OAAC,OAAA,CAAA;AAAD,CAAC,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IChMD;KAYC;IANC,8BAAQ,GAAR,UAAS,OAAuB,KAAc;IAK9C,gCAAU,GAAV,eAAyB;IAC3B,kBAAC;CAAA,IAAA;;IAMuCS,sCAAW;IAUjD;QAAA,YACE,iBAAO,SAUR;QARC,KAAI,CAAC,OAAO,GAAG,UAAC,CAAC;YACX,IAAA,uCAAgE,EAA9D,wCAAiB,EAAE,cAA2C,CAAC;YAErE,IAAI,iBAAiB,EAAE;gBACrB,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,KAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;aAC7B;SACF,CAAC;;KACH;IAOD,qCAAQ,GAAR,UAAS,OAAuB;QAC9B,IAAI,OAAO,CAAC,aAAa,EAAE;YACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YACvBT,cAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;SACnD;KACF;IAKD,uCAAU,GAAV;QACEA,cAAG,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;KACtD;IAOM,+BAAY,GAAnB,UAAoB,KAAY;QAC9B,IAAI,MAAM,GAAG,KAAmB,CAAC;QACjC,IAAI,IAAI,GAAG;YACT,iBAAiB,EAAE,KAAK;YACxB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;SACb,CAAC;QAEF,IAAI,MAAM,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAiB,CAAC,CAAC;QAC5E,IAAI,CAAC,MAAM,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE;YAC7D,OAAO,IAAI,CAAC;SACb;QAED,IAAI,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC;eAC/B,YAAY,CAAC,MAAM,EAAE,eAAe,CAAC;eACrC,YAAY,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAC7C;YACA,OAAO,IAAI,CAAC;SACb;QAED,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE;YACxE,OAAO,IAAI,CAAC;SACb;QAED,IAAI,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,iBAAiB,GAAG,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC;QAC3C,IAAI,UAAU,GAAG,IAAI,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAE/E,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,IAAI,UAAU,CAAC;QACzD,OAAO,IAAI,CAAC;KACb;IAQM,oCAAiB,GAAxB,UAAyB,EAAW;QAClC,OAAO,EAAE,EAAE;YACT,IAAI,EAAE,CAAC,OAAO,KAAK,GAAG,EAAE;gBACtB,OAAO,EAAE,CAAC;aACX;YAED,EAAE,GAAG,EAAE,CAAC,UAAqB,CAAC;SAC/B;KACF;IAQM,qCAAkB,GAAzB,UAA0B,MAAe;QACvC,IAAI,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,GAAG,GAAGN,mBAAQ,CAAC,MAAM,CAAC;QAE1B,OAAO,CAAC,YAAY;YAClB,YAAY,KAAK,GAAG,CAAC,IAAI;YACzB,YAAY,KAAK,OAAO,CAAC;KAC5B;IACH,yBAAC;CAhHD,CAAwC,WAAW,GAgHlD;AAED,IAAM,YAAY,GAAG,UAAC,EAAW,EAAE,IAAY,IAAK,OAAA,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,GAAA,CAAC;;;ICpItCe,kCAAO;IA8BzC,wBAAY,WAAwB;QAApC,YACE,iBAAO,SAQR;QANC,KAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,KAAI,CAAC,iBAAiB,GAAG,KAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;QAEnD,KAAI,CAAC,QAAQ,GAAGf,mBAAQ,CAAC,QAAQ,CAAC;QAClC,KAAI,CAAC,OAAO,GAAGA,mBAAQ,CAAC,OAAO,CAAC;QAChC,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;;KAChC;IAOD,iCAAQ,GAAR,UAAS,OAAgB;QACvB,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;SACxD;QAED,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,cAAc,GAAG,CAAC,CAAE,OAAe,CAAC,SAAS,CAAC;QAElD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,iBAAiB,GAAG,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAG/F,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,GAAG,iBAAiB,CAAC,IAAI,GAAG,GAAG,EAAE,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAE1F,IAAI,eAAe,GAAG,IAAI,CAAC,gBAAgB,GAAG,iBAAiB,CAAC,UAAU,KAAK,KAAK,CAAC;QACrF,IAAI,YAAY,GAAG,IAAI,CAAC,aAAa,GAAG,CAAC,EAAE,iBAAiB,CAAC,SAAS,IAAI,QAAQ,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC;QAG1G,IAAI,SAAiB,CAAC;QACtB,IAAI,YAAY,EAAE;YAChB,SAAS,GAAG,UAAU,CAAC;SACxB;aAAM,IAAI,eAAe,EAAE;YAC1B,SAAS,GAAG,YAAY,CAAC;SAC1B;QAEDA,mBAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAI7D,IAAI,eAAe,IAAI,cAAc,EAAE;YAErC,IAAI,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC9B,IAAI,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,OAAO,CAAC;YAIrE,IAAI,CAAC,YAAY,IAAI,CAAC,MAAM,EAAE;gBAC5B,IAAI,QAAQ,GAAI,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC9D,SAAS,CAAC,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,MAAM,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC;gBAE/D,OAAO,IAAI,CAAC;aAIb;iBAAM,IAAI,YAAY,IAAI,MAAM,IAAI,SAAS,CAAC,IAAI,EAAE;gBACnD,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;gBAC1E,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAEM,cAAG,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;aAC7E;SACF;QAED,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;SACvC;QAED,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEhC,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE;YAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;SAC1B;KACF;IAKD,mCAAU,GAAV;QACE,IAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC;QACvCN,mBAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAClDA,mBAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;KAC/B;IAMD,wCAAe,GAAf;QACE,IAAI,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QAClF,OAAO,KAAG,MAAM,GAAG,IAAI,CAAC,IAAM,CAAC;KAChC;IASD,iCAAQ,GAAR,UAAS,QAAiB,EAAE,EAAsC;YAAtC,4BAAsC,EAArC,eAAc,EAAd,mCAAc,EAAE,eAAe,EAAf,oCAAe;QAC1D,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,IAAI,QAAQ,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAC1C,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC;YACzB,OAAO,IAAI,CAAC;SACb;QAED,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,OAAO,KAAK,CAAC;SACd;QAED,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QAE7C,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,OAAO,EAAE;YAC1C,OAAO,KAAK,CAAC;SACd;QAED,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QAG/B,IAAI,QAAQ,KAAK,EAAE,IAAI,GAAG,KAAK,GAAG,EAAE;YAClC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SACxB;QAGD,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,cAAc,GAAG,WAAW,CAAC,CAAC,EAAE,EAAEM,cAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;SAC1E;aAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE;YAGhC,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;SACzC;aAAM;YAGL,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACtB;QAED,IAAI,OAAO,EAAE;YACX,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SAChC;QAED,OAAO,IAAI,CAAC;KACb;IAKD,qCAAY,GAAZ;QACE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;KACrB;IAKD,iCAAQ,GAAR,UAAS,KAAa;QACpBA,cAAG,CAAC,KAAK,GAAG,KAAK,CAAC;KACnB;IAOD,iCAAQ,GAAR,UAAS,GAAW,EAAE,KAAU;QAC9B,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAA,kBAA0C,EAAxC,sBAAQ,EAAE,kBAAM,EAAE,cAAsB,CAAC;QAC/C,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACnB,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,KAAG,QAAQ,GAAG,MAAM,GAAG,IAAM,CAAC,CAAC;KACnE;IAOD,iCAAQ,GAAR,UAAS,GAAW;QAClB,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAClD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;KACnB;IAMD,wCAAe,GAAf;QACE,IAAI,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QACjD,IAAI,YAAY,KAAK,SAAS,EAAE;YAC9B,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;YACvC,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;SAC7C;QACD,OAAO,YAAY,CAAC;KACrB;IAMD,2BAAE,GAAF,UAAG,QAAgB;QACjB,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;KAC3B;IAKD,iCAAQ,GAAR;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KACrC;IAKD,qCAAY,GAAZ,UAAa,QAAgB,EAAE,cAAwB;QACrD,IAAI,OAAe,CAAC;QAEpB,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,cAAc,EAAE;gBAClE,IAAI,UAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;gBAC7B,QAAQ,GAAG,UAAQ,CAAC,QAAQ,GAAG,UAAQ,CAAC,MAAM,CAAC;gBAC/C,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;gBAC/C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;oBAC9B,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;iBAC5C;aACF;iBAAM;gBACL,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;aAC5B;SACF;QAED,OAAO,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;KAClD;IAOD,kCAAS,GAAT;QACE,IAAI,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACpC,IAAI,OAAO,KAAK,IAAI,CAAC,QAAQ,EAAE;YAC7B,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;SACnB;KACF;IAMD,iCAAQ,GAAR,UAAS,gBAAwB;QAC/B,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;QAEnE,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY;YAC9B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC;YACnC,KAAK,CAAC;KACT;IAjSM,qBAAM,GAAG,CAAC,WAAW,CAAC,CAAC;IAkShC,qBAAC;CAAA,CApSmCU,sBAAO,GAoS1C;AAGD,IAAM,aAAa,GAAG,cAAc,CAAC;AAGrC,IAAM,YAAY,GAAG,YAAY,CAAC;AAGlC,IAAM,aAAa,GAAG,KAAK,CAAC;AAK5B,IAAM,WAAW,GAAG,8BAA8B,CAAC;AAInD,SAAS,UAAU,CAAC,SAAmB,EAAE,QAAgB,EAAE,OAAgB;IACzE,IAAI,OAAO,EAAE;QACX,IAAI,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;QAC5D,SAAS,CAAC,OAAO,CAAC,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC;KAC1C;SAAM;QAEL,SAAS,CAAC,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAC;KACjC;CACF;AAED,SAAS,YAAY,CAAC,QAAgB,EAAE,QAAgB,EAAE,IAAY;IACpE,OAAU,QAAQ,UAAK,QAAQ,IAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,EAAE,CAAE,CAAC;CAC5D;;SCjUe,SAAS,CAAC,MAAc;IAEtC,IAAM,OAAO,GAAG,MAAa,CAAC;IAC9B,OAAO,CAAC,SAAS,CAACA,sBAAO,EAAE,cAAc,CAAC,CAAC;IAC3C,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;CACpD;;;;;;;;;;ACbD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACrGA,SAAS,QAAQ,CAAC,GAAa;IAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QACnC,IAAI,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,IAAI,KAAK,GAAG,EAAE;YAChB,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACjB,CAAC,IAAI,CAAC,CAAC;SACR;aAAM,IAAI,IAAI,KAAK,IAAI,EAAE;YAMxB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE;gBAClE,SAAS;aACV;iBAAM,IAAI,CAAC,GAAG,CAAC,EAAE;gBAChB,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;gBACrB,CAAC,IAAI,CAAC,CAAC;aACR;SACF;KACF;AACH,CAAC;SASe,cAAc,CAAC,IAAY,EAAE,IAAY;IACvD,IAAI,SAAS,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,SAAS,EAAE;QAM/C,IAAI,mBAAmB,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACnE,SAAS,CAAC,OAAO,OAAjB,SAAS,EAAY,mBAAmB,EAAE;KAC3C;IAED,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEpB,OAAO,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;SASe,IAAI,CAAC,KAAa,EAAE,KAAa;IAC/C,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,KAAK,CAAC;KACd;IAED,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,KAAK,CAAC;KACd;IAED,IAAI,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC9C,IAAI,MAAM,GAAG,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IAC3E,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEpC,IAAI,SAAS,CAAC;IACd,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,MAAM,KAAK,OAAO,EAAE;QACpD,SAAS,GAAG,KAAK,CAAC;KACnB;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACpC,SAAS,GAAG,IAAI,CAAC;KAClB;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACnC,SAAS,GAAG,GAAG,CAAC;KACjB;SAAM;QACL,SAAS,GAAG,EAAE,CAAC;KAChB;IAED,IAAI,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;IAEvD,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;QAC7C,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;YAIpB,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE;gBACjD,IAAI,CAAC,GAAG,EAAE,CAAC;aACZ;iBAAM;gBACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;aACpB;SACF;aAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YAC5C,SAAS;SACV;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SACpB;KACF;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;QAC7C,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;YACpB,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE;gBACjD,IAAI,CAAC,GAAG,EAAE,CAAC;aACZ;iBAAM;gBACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;aACpB;SACF;aAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YAC5C,SAAS;SACV;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SACpB;KACF;IAED,OAAO,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC;AAC7D,CAAC;AAED,IAAI,MAAM,GAAG,kBAAkB,CAAC;AAChC,IAAI,SAAS,GAAG,UAAA,CAAC,IAAI,OAAA,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,GAAA,CAAC;AASnD,SAAS,UAAU,CAAC,GAAW,EAAE,KAAU,EAAE,WAAqB;IAChE,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,MAAM,CAAC;KACf;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAC5C,IAAI,WAAW,EAAE;gBACf,MAAM,CAAC,IAAI,CAAI,SAAS,CAAC,GAAG,CAAC,SAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAG,CAAC,CAAC;aACtD;iBAAM;gBACL,IAAI,QAAQ,GAAG,GAAG,GAAG,GAAG,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC;gBAC9F,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACxD;SACF;KACF;SAAM,IAAI,QAAQ,KAAK,CAAC,KAAK,QAAQ,IAAI,CAAC,WAAW,EAAE;QACtD,KAAK,IAAI,YAAY,IAAI,KAAK,EAAE;YAC9B,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,GAAG,GAAG,GAAG,YAAY,GAAG,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;SACzF;KACF;SAAM;QACL,MAAM,CAAC,IAAI,CAAI,SAAS,CAAC,GAAG,CAAC,SAAK,MAAM,CAAC,KAAK,CAAI,CAAC,CAAC;KACrD;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;SASe,gBAAgB,CAAC,MAAe,EAAE,WAAqB;IACrE,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QAC/C,IAAI,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;KACjE;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AASD,SAAS,kBAAkB,CAAC,YAAoB,EAAE,KAAa;IAC7D,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;QAE/B,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,OAAO,YAAY,CAAC;KACrB;IACD,IAAI,YAAY,KAAK,SAAS,EAAE;QAG9B,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;KAC9B;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAUD,SAAS,iBAAiB,CAAC,WAAmB,EAAE,IAAyB,EAAE,KAAU;IACnF,IAAI,aAAa,GAAG,WAAW,CAAC;IAChC,IAAI,aAAa,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,aAAa,EAAE,CAAC,EAAE,EAAE;QACvC,IAAI,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,GAAI,aAAqB,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACnE,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,GAAG,aAAa,EAAE;YAGrB,IAAI,SAAS,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,OAAO,aAAa,CAAC,GAAG,CAAC,KAAK,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1H,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAW,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;SAC5F;aAAM;YACL,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SAC5C;KACF;AACH,CAAC;SASe,gBAAgB,CAAC,WAAmB;IAClD,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,IAAI,CAAC,WAAW,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnD,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,KAAK,GAAG,WAAW,CAAC;IACxB,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QAC3B,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KACzB;IAED,IAAI,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,IAAI,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,IAAI,CAAC,GAAG,EAAE;YACR,SAAS;SACV;QAED,IAAI,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,aAAa,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAKpC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE;YACzD,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC7D,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC5C,aAAa,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC;aAAM;YACL,aAAa,GAAG,CAAC,CAAC;SACnB;QAED,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE;YACpB,IAAI,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;YACvD,IAAI,aAAa,EAAE;gBACjB,iBAAiB,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;aAC7C;iBAAM;gBACL,gBAAgB,CAAC,GAAG,CAAC,CAAC;gBACtB,WAAW,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;aAChE;SACF;aAAM;YACL,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;SACzB;KACF;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW;IACnC,IAAI,GAAG,KAAK,WAAW,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAClD;AACH;;;;;;;;;;ACzRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACl1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACleA;;;AAGA;IA4DE,+BAAY,IAA+B;;;;QAT3C,SAAI,GAAwC,IAAI,CAAC;QAEjD,YAAO,GAAwB,EAAE,CAAC;QAQhC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAE1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;QAChC,IAAI,CAAC,oBAAoB,GAAG,EAAE,CAAC;QAE/B,IAAI,cAAc,GAAG,EAAE,CAAC;QACxB,IAAI,OAAO,GAA0B,IAAI,CAAC;QAC1C,GAAG;YACD,IAAI,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACtD,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE;;gBAEnD,OAAO,aAAa,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;aACjD;YAED,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YACtC,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;SACrC,QAAQ,OAAO,EAAE;QAElB,IAAI,SAAS,GAAG,MAAM,CAAC,MAAM,OAAb,MAAM,GAAQ,EAAE,EAAE,IAAI,CAAC,WAAW,SAAK,cAAc,EAAC,CAAC;QACvE,IAAI,CAAC,aAAa,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KACrD;;;;IAKD,kDAAkB,GAAlB;QACE,IAAI,YAAY,GAA4B,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,oBAAoB,GAAwC,IAAI,CAAC,oBAAoB,CAAC;QAE1F,KAAK,IAAI,GAAG,IAAI,oBAAoB,EAAE;YACpC,IAAI,gBAAgB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,0BAA0B,CAAC;YAC5E,IAAI,gBAAgB,EAAE;gBACpB,YAAY,CAAC,IAAI,OAAjB,YAAY,EAAS,gBAAgB,CAAC,kBAAkB,EAAE,EAAE;aAC7D;SACF;QAED,OAAO,YAAY,CAAC;KACrB;;;;;IAMD,0DAA0B,GAA1B;QACE,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,mBAAmB,GAAA,CAAC,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,GAAA,CAAC,CAAC;KACjF;IAOD,sDAAsB,GAAtB,UACE,iBAAmD,EACnD,QAAiC,EACjC,QAAiB,EACjB,SAAe;QAGf,IAAI,mBAAwC,CAAC;QAC7C,IAAI,YAAY,GAAG,OAAO,iBAAiB,KAAK,QAAQ,GAAG,iBAAiB,GAAG,iBAAiB,CAAC,IAAI,CAAC;QACtG,IAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,IAAM,MAAM,GAAgB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC,CAAC;QAEnG,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE;YACzC,mBAAmB,GAAG;gBACpB,IAAI,EAAE,iBAAiB;gBACvB,QAAQ,EAAE,QAAQ;gBAClB,QAAQ,EAAE,QAAQ;gBAClB,SAAS,EAAE,SAAS;gBACpB,WAAW,EAAE,SAAS,CAAC,WAAW;gBAClC,aAAa,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAuB;aAClF,CAAC;SACH;aAAM;YACL,mBAAmB,GAAG;gBACpB,IAAI,EAAE,YAAY;gBAClB,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;gBACpC,SAAS,EAAE,iBAAiB,CAAC,SAAS;gBACtC,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;gBACpC,WAAW,EAAE,iBAAiB,CAAC,SAAS,CAAC,WAAW;gBACpD,aAAa,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAuB;aAClF,CAAC;SACH;QAED,OAAO,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,GAAG,mBAAmB,CAAC;KACtE;;;;IAKD,+CAAe,GAAf;;QAEE,IAAI,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,KAAe,CAAC;QAC9C,IAAI,aAAa,GAAG,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACjD,OAAO,WAAW,CAAC,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC;KAC9C;;;;;IAMD,+CAAe,GAAf;QACE,IAAI,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAC1C,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QAC3C,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAEnC,IAAI,WAAW,EAAE;YACf,IAAI,IAAI,GAAG,GAAG,WAAW,CAAC;SAC3B;QAED,OAAO,IAAI,CAAC;KACb;;;;IAKD,0CAAU,GAAV;QAAA,iBA0BC;QAzBC,IAAI,UAAU,GAAG,SAAS,CAAC;QAC3B,IAAI,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAExC,IAAI,QAAQ,KAAK,EAAE,EAAE;YACnB,IAAI,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAA,KAAK;gBAC/C,OAAO,KAAK,CAAC,IAAI,KAAK,KAAI,CAAC,MAAM,CAAC,IAAI;oBACpC,KAAK,CAAC,KAAK,KAAK,EAAE,CAAC;aACtB,CAAC,CAAC;YACH,IAAI,aAAa,EAAE;gBACjB,QAAQ,GAAG,aAAa,CAAC,KAAY,CAAC;aACvC;SACF;QAED,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;SAC7B;QAED,IAAI,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAC1C,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QAE3C,IAAI,CAAC,IAAI,EAAE;YACT,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;SAC7B;QAED,OAAO,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACnE;;;;;IAMD,8CAAc,GAAd,UAAe,UAAmB;QAAlC,iBAwDC;QAvDC,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAEjC,IAAM,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACrD,IAAI,mBAAmB,EAAE;YACvB,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,KAAK,CAAC;SACtD;QAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAE3B,IAAI,KAAK,GAAoB,EAAE,CAAC;QAChC,IAAI,UAAU,GAAgB,EAAE,CAAC;QACjC,IAAI,oBAAoB,GAAwC,IAAI,CAAC,oBAAoB,CAAC;gCAEjF,YAAY;YACnB,IAAI,mBAAmB,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;YAC7D,IAAI,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAE9C,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,oDAAkD,mBAAmB,CAAC,QAAQ,MAAG,CAAC,CAAC;aACpG;YAED,IAAI,mBAAmB,GAAG,mBAAmB,CAAC,0BAA0B,CAAC;YACzE,IAAI,mBAAmB,CAAC,QAAQ,8BAAyC;gBACvE,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,kBAAkB,EAAE;oBACjE,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;iBAC5D;qBAAM;oBACL,IAAI,UAAU,EAAE;wBACd,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,UAAA,EAAE,mBAAmB,qBAAA,EAAE,CAAC,CAAC;qBACpD;oBACD,KAAK,CAAC,IAAI,CACR,QAAQ;yBACL,OAAO,CAAC,mBAAmB,EAAE,UAAU,CAAC;yBACxC,IAAI,CAAC,cAAM,OAAA,mBAAmB;0BAC3B,mBAAmB,CAAC,cAAc,CAAC,UAAU,CAAC;0BAC9C,OAAO,CAAC,OAAO,EAAE,GAAA,CACpB,CACJ,CAAC;iBACH;aACF;iBAAM;gBACL,IAAI,mBAAmB,EAAE;oBACvB,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;iBAC5D;aACF;;QA7BH,KAAK,IAAI,YAAY,IAAI,oBAAoB;oBAApC,YAAY;SA8BpB;QAED,OAAO,OAAO;aACX,GAAG,CAAC,KAAK,CAAC;aACV,IAAI,CAAC;YACJ,UAAU,CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAA,CAAC,CAAC;YAChE,OAAO,IAAI,CAAC;SACb,CAAC;aACD,IAAI,CAAC,cAAM,OAAA,KAAK,CAAC,KAAI,CAAC,GAAA,CAAC,CAAC;KAC5B;;IAGD,4CAAY,GAAZ;QACE,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QACpD,IAAI,KAAK,EAAE;YACT,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAChC;KACF;;IAGD,2CAAW,GAAX,UAAY,SAAyB;QAAzB,0BAAA,EAAA,iBAAyB;QACnC,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,IAAI,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC/C,IAAI,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC;QACpC,IAAI,oBAAoB,GAAwC,IAAI,CAAC,oBAAoB,CAAC;QAE1F,IAAI,aAAa,EAAE;YACjB,KAAK,GAAG,iBAAiB,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;SACzD;QAED,KAAK,IAAI,YAAY,IAAI,oBAAoB,EAAE;YAC7C,IAAI,mBAAmB,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;YAC7D,IAAI,qBAAqB,GAAG,mBAAmB,CAAC,0BAA0B,CAAC;YAE3E,IAAI,qBAAqB,EAAE;gBACzB,IAAI,UAAU,GAAG,qBAAqB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;gBAC9D,IAAI,UAAU,EAAE;oBACd,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;iBAC9B;aACF;SACF;QAED,IAAI,WAAW,CAAC,MAAM,EAAE;YACtB,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,GAAG,SAAS,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;SACxE;QAED,IAAI,iBAAiB,CAAC,KAAK,EAAE;YAC3B,KAAK,IAAI,CAAC,KAAK,GAAG,SAAS,GAAG,EAAE,IAAI,iBAAiB,CAAC,cAAc,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;SAC/F;QAED,OAAO,KAAK,CAAC;KACd;IACH,4BAAC;CAAA,IAAA;AAED,IAAM,KAAK,GAAG,UAAC,WAAkC;IAC/C,WAAW,CAAC,mBAAmB,GAAG,IAAI,CAAC;IACvC,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;CACzB,CAAC;;ACtVF;;;AAGA;IAuCE,kBAAY,MAAc,EAAE,YAAoB;;;;QAlChD,aAAQ,GAAY,KAAK,CAAC;;;;QAK1B,UAAK,GAAW,IAAI,CAAC;;;;QAKrB,SAAI,GAAW,IAAI,CAAC;;;;QAKpB,iBAAY,GAAW,IAAI,CAAC;;;;QAK5B,aAAQ,GAAQ,EAAE,CAAC;;;;QAKnB,WAAM,GAAgB,IAAI,CAAC;QAUzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;KAClC;;;;;;;;IASD,2BAAQ,GAAR,UAAS,KAAa;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;SAC3B;KACF;IACH,eAAC;CAAA;;SC9De,sBAAsB,CAAC,IAAY,EAAE,YAAqB,EAAE,QAAyB;IAAzB,yBAAA,EAAA,gBAAyB;IACnG,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACpC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC;KACnB;IAED,IAAI,YAAY,IAAI,QAAQ,EAAE;QAC5B,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;KACvC;IAED,OAAO,IAAI,CAAC;CACb;AAED,SAAgB,iBAAiB,CAAC,QAAgB,EAAE,OAAe,EAAE,YAAqB,EAAE,QAAkB;IAC5G,IAAI,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAChC,OAAO,QAAQ,CAAC;KACjB;IAED,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACxC,IAAI,IAAI,GAAG,CAAC;KACb;IAED,IAAI,IAAI,OAAO,CAAC;IAEhB,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QAC1E,IAAI,IAAI,GAAG,CAAC;KACb;IAED,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACvE,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,sBAAsB,CAAC,IAAI,GAAG,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;CACxE;AAED,SAAgB,WAAW,CAAC,QAAgB,EAAE,OAAe,EAAE,YAAsB;IACnF,IAAI,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAC/B,OAAO,sBAAsB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;KACvD;IAED,OAAO,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;CAC3D;AAED,SAAgB,oCAAoC,CAAC,MAAmB;IACtE,IAAI,YAAY,GAAG,EAAE,CAAC;IAEtB,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YACrD,IAAI,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;YACxC,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAC5B;KACF;SAAM;QACL,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;KAC9C;IAED,OAAO,YAAY,CAAC;CACrB;AAED,IAAM,YAAY,GAAG,OAAO,CAAC;AAC7B,IAAM,aAAa,GAAG,8BAA8B,CAAC;;ACzDrD;;;;;AAKA;IAAA;QACE,iBAAY,GAAoC,EAAE,CAAC;QACnD,YAAO,GAOH,EAAE,CAAC;QACP,kBAAa,GAA2D,EAAE,CAAC;KA4L5E;;;;;;;;IA5KC,6CAAe,GAAf,UAAgB,IAAY,EAAE,IAA6B;QACzD,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE;YACvC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SAC/D;QACD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,MAAA,EAAE,IAAI,MAAA,EAAE,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;KACb;;;;;;;IAQD,8CAAgB,GAAhB,UAAiB,IAA6B;QAC5C,OAAO,IAAI,CAAC,eAAe,8BAA6B,IAAI,CAAC,CAAC;KAC/D;;;;;;;IAQD,gDAAkB,GAAlB,UAAmB,IAA6B;QAC9C,OAAO,IAAI,CAAC,eAAe,kCAA+B,IAAI,CAAC,CAAC;KACjE;;;;;;;IAQD,8CAAgB,GAAhB,UAAiB,IAA6B;QAC5C,OAAO,IAAI,CAAC,eAAe,8BAA6B,IAAI,CAAC,CAAC;KAC/D;;;;;;;IAQD,+CAAiB,GAAjB,UAAkB,IAA6B;QAC7C,OAAO,IAAI,CAAC,eAAe,gCAA8B,IAAI,CAAC,CAAC;KAChE;;;;;;;IAQD,2CAAa,GAAb,UAAc,QAAgB;QAC5B,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;QAC/B,OAAO,IAAI,CAAC;KACb;;;;;;;IAQD,iCAAG,GAAH,UAAI,KAAkC;QAAtC,iBAOC;QANC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,KAAK,CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;YAChC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;KAC7B;;;;;;;;IASD,iDAAmB,GAAnB,UAAoB,cAAwE;QAC1F,IAAI,CAAC,gBAAgB,GAAG,cAAc,CAAC;QACvC,OAAO,IAAI,CAAC;KACb;;;;;;;IAQD,sCAAQ,GAAR,UAAS,MAAmB;QAC1B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAA,MAAM;YAC3B,IAAI,YAAY,GAAG,oCAAoC,CAAC,MAAM,CAAC,CAAC;YAEhE,IAAI,QAAQ,CAAC;YACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;gBACrD,IAAI,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBAClC,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,IAAI,EAAE,CAAC;gBAClD,IAAI,CAAC,QAAQ,EAAE;oBACb,QAAQ,GAAG,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;iBAC/C;gBAED,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;aACxC;SACF,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;KACb;;;;;;;;IASD,8CAAgB,GAAhB,UAAiB,MAA4B;QAC3C,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC;QACjC,OAAO,IAAI,CAAC;KACb;;;;;;IAOD,4CAAc,GAAd,UAAe,MAAc;QAC3B,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YACrD,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;SACzB;QAEG,IAAA,SAAsF,EAApF,gBAAK,EAAE,kCAAc,EAAE,0CAAkB,EAAE,kCAAc,EAAE,sCAAyB,CAAC;QAE3F,IAAI,KAAK,EAAE;YACT,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;SACtB;QAED,IAAI,cAAc,EAAE;YAClB,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC;SACxC;QAED,IAAI,kBAAkB,EAAE;YACtB,MAAM,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;SAChD;QAED,IAAI,cAAc,EAAE;YAClB,MAAM,CAAC,aAAa,GAAG,cAAc,CAAC;SACvC;QAED,IAAI,gBAAgB,EAAE;YACpB,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;SAC9C;QAED,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAE5C,IAAI,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACvC,IAAI,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC;QAC7C,IAAI,iBAAiB,EAAE;YACrB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;gBAClB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;aACxE;YAED,IAAI,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;YAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,iBAAiB,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;gBAC/C,IAAA,qBAAiC,EAA/B,gBAAI,EAAE,cAAyB,CAAC;gBACtC,gBAAgB,CAAC,OAAO,CAAC,MAAI,EAAE,IAAI,CAAC,CAAC;aACtC;SACF;KACF;IACH,0BAAC;CAAA;;AC/JD;;;AAGA;;;;;IAoJE,gBAAY,SAAoB,EAAE,OAAgB;QAAlD,iBAIC;;;;QA9CD,WAAM,GAAW,IAAI,CAAC;QAEtB,YAAO,GAAQ,EAAE,CAAC;;;;QAKlB,qBAAgB,GAAwB,EAAE,CAAC;;;;;;QAwB3C,mBAAc,GAA8B,UAAC,KAAa;YACxD,IAAI,KAAI,CAAC,MAAM,EAAE;gBACf,OAAO,KAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;aAC1C;YACD,OAAO,KAAK,CAAC;SACd,CAAA;QAOC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,EAAE,CAAC;KACd;;;;;IAMD,sBAAK,GAAL;QAAA,iBAuBC;QAtBC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;QAClC,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC;QACtC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACjC,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACjC,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC;QAC1B,IAAI,CAAC,WAAW,GAAG,IAAIC,sCAAe,EAAE,CAAC;QACzC,IAAI,CAAC,gBAAgB,GAAG,IAAIA,sCAAe,EAAE,CAAC;QAC9C,IAAI,CAAC,kBAAkB,GAAG,IAAI,OAAO,CAAC,UAAA,OAAO;YAC3C,KAAI,CAAC,yBAAyB,GAAG,OAAO,CAAC;SAC1C,CAAC,CAAC;KACJ;IAKD,sBAAI,0BAAM;;;;aAAV;YACE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;SACrB;;;OAAA;;;;;;;IAQD,iCAAgB,GAAhB,UAAiB,QAAyB,EAAE,IAAa;QACvD,IAAI,GAAG,IAAI,IAAI,SAAS,CAAC;QACzB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;KACjC;;;;IAKD,iCAAgB,GAAhB;QACE,OAAO,IAAI,CAAC,kBAAkB,CAAC;KAChC;;;;;;IAOD,0BAAS,GAAT,UAAU,gBAA8F;QAAxG,iBAqBC;QApBC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAEzB,IAAI,MAAM,GAAkC,gBAAuC,CAAC;QACpF,IAAI,MAA2B,CAAC;QAChC,IAAI,OAAO,gBAAgB,KAAK,UAAU,EAAE;YAC1C,MAAM,GAAG,IAAI,mBAAmB,EAAE,CAAC;YACnC,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;SACnC;QAED,OAAO,OAAO;aACX,OAAO,CAAC,MAAM,CAAC;aACf,IAAI,CAAC,UAAC,CAAC;YACN,IAAI,CAAC,IAAK,CAAyB,CAAC,cAAc,EAAE;gBAClD,MAAM,GAAG,CAAC,CAAC;aACZ;YAED,MAAM,CAAC,cAAc,CAAC,KAAI,CAAC,CAAC;YAC5B,KAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,KAAI,CAAC,yBAAyB,EAAE,CAAC;SAClC,CAAC,CAAC;KACN;;;;;;;IAQD,yBAAQ,GAAR,UAAS,QAAgB,EAAE,OAA2B;QACpD,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,MAAM,EAAE;YACrC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SAChD;QAED,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC,CAAC;KACxG;;;;;;;;;IAUD,gCAAe,GAAf,UAAgB,KAAa,EAAE,MAAY,EAAE,OAA2B;QACtE,IAAI,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACrC;;;;IAKD,6BAAY,GAAZ;QACE,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;KAC7B;;;;;;;IAQD,4BAAW,GAAX,UAAY,SAAqB;QAC/B,IAAI,WAAW,GAAG,IAAI,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtF,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC;QAC1B,OAAO,WAAW,CAAC;KACpB;;;;;;;;;IAUD,yBAAQ,GAAR,UAAS,WAAiC,EAAE,MAAgB,EAAE,OAAiB;QAAnC,uBAAA,EAAA,WAAgB;QAAE,wBAAA,EAAA,YAAiB;;;;QAI7E,IAAI,UAAU,GAAG,YAAY,IAAI,MAAM,GAAG,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC;QACnF,IAAI,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,WAAoC,CAAC,CAAC;QACzE,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,IAAI,CAAC,MAAM,EAAE;gBACf,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;aAC3D;YACD,MAAM,IAAI,KAAK,CAAC,wBAAsB,WAAW,iDAA6C,WAAW,4CAA0C,CAAC,CAAC;SACtJ;QACD,IAAI,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,WAAoC,EAAE,MAAM,CAAC,CAAC;QAC7E,IAAI,UAAU,GAAG,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QACrG,OAAO,OAAO,CAAC,QAAQ,GAAG,KAAG,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,UAAY,GAAG,UAAU,CAAC;KACzF;;;;;;IAOD,+BAAc,GAAd,UAAe,MAAmB;QAChC,IAAI,QAAQ,GAAG,IAAI,QAAQ,CACzB,IAAI,EACJ,MAAM,IAAI,MAAM;cACZ,MAAM,CAAC,IAAI;;cAEX,MAAM,CAAC,KAAe,CAAC,CAAC;QAC9B,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC9B,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC;QAC5B,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QAC5B,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACpC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;QAEzB,OAAO,QAAQ,CAAC;KACjB;;;;;;;IAQD,yBAAQ,GAAR,UAAS,MAAmB,EAAE,QAAmB;QAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YAC/B,IAAI,YAAY,GAAG,oCAAoC,CAAC,MAAM,CAAC,CAAC;;YAEhE,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAC/C,OAAO;SACR;QAED,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAE5B,IAAI,EAAE,WAAW,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE;YAC1D,MAAM,CAAC,SAAS,GAAG;gBACjB,SAAS,EAAE;oBACT,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,IAAI,EAAE,MAAM,CAAC,IAAI;iBAClB;aACF,CAAC;SACH;QAED,IAAI,CAAC,QAAQ,EAAE;YACb,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;SACxC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEzB,IAAI,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC;QACxB,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YAC1B,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACvB;QACD,IAAI,aAAa,GAAG,MAAM,CAAC,aAAa,KAAK,IAAI,CAAC;QAClD,IAAI,KAAK,GAAU,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;YACtC,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,MAAsB;YAC/B,aAAa,EAAE,aAAa;SACR,CAAC,CAAC;QAExB,IAAI,IAAI,EAAE;YACR,IAAI,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;YAC/B,OAAO,MAAM,CAAC,QAAQ,CAAC;YACvB,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;YACnD,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC3B,SAAS,CAAC,KAAK,GAAM,IAAI,iBAAc,CAAC;YACxC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC;YAChC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC;gBACxB,IAAI,EAAE,SAAS,CAAC,KAAK;gBACrB,OAAO,EAAE,SAAS;gBAClB,aAAa,EAAE,aAAa;aAC7B,CAAC,CAAC;YAEH,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC9B,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;YACrC,SAAS,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;SAC1D;QAED,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAE3B,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAEjC,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,KAAK,CAAC,KAAK,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;YACnF,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBAC3F,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,MAAM,CAAC,KAAK,GAAG,oFAAoF,CAAC,CAAC;aACrJ;YAED,IAAI,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,EAAE;gBACtC,QAAQ,CAAC,KAAK,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC;aACxC;YAED,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;;;;;;;;YAQ1B,UAAU,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAK,CAAC,CAAC,KAAK,GAAQ,CAAC,CAAC,KAAK,GAAA,CAAC,CAAC;SACxD;KACF;;;;;;IAOD,yBAAQ,GAAR,UAAS,IAAY;QACnB,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;KACzF;;;;;;IAOD,4BAAW,GAAX,UAAY,IAAY;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KACxC;;;;;;IAOD,oCAAmB,GAAnB,UAAoB,MAA6B;QAAjD,iBAaC;QAZC,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;SAClD;QAED,IAAI,CAAC,eAAe,GAAG,UAAA,WAAW;YAChC,OAAO,KAAI;iBACR,kBAAkB,CAAC,MAAM,EAAE,WAAW,CAAC;iBACvC,IAAI,CAAC,UAAA,CAAC;gBACL,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;gBACvB,OAAO,WAAW,CAAC;aACpB,CAAC,CAAC;SACN,CAAC;KACH;;;;IAKD,4BAAW,GAAX;QACE,IAAI,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;QAC/B,IAAI,YAAY,EAAE;YAChB,OAAO,YAAY,CAAC,WAAW,EAAE,CAAC;SACnC;QAED,IAAI,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACjD,IAAI,kBAAkB,EAAE;YACtB,kBAAkB,CAAC,YAAY,EAAE,CAAC;SACnC;QACD,OAAO,SAAS,CAAC;KAClB;;;;;IAMD,kCAAiB,GAAjB;QACE,IAAI,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC;QAE1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,QAAM,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,QAAM,EAAE,CAAC,EAAE,EAAE;YACpD,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YACrB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE;gBACxB,OAAO,CAAC,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;aAClG;iBAAM;gBACL,OAAO,CAAC,IAAI,GAAG,sBAAsB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;aACxF;SACF;KACF;;;;;;IAOD,oCAAmB,GAAnB,UAAoB,iBAAsC;;QAExD,IAAI,gBAAgB,GAAwC,iBAAiB,CAAC;QAC9E,KAAK,IAAI,YAAY,IAAI,gBAAgB,EAAE;YACzC,IAAI,cAAc,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;YACpD,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,GAAG;gBACpC,QAAQ,EAAE,cAAc,CAAC,QAAQ;aAClC,CAAC;SACH;KACF;;IAGD,gCAAe,GAAf;QACE,IAAI,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;QAC/B,IAAI,YAAY,EAAE;YAChB,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC,YAAY,EAAE,YAAY,CAAC,kBAAkB,CAAC,CAAC;SAC/E;KACF;;IAGD,6CAA4B,GAA5B,UAA6B,GAAgB,EAAE,iBAA+C;QAAjE,oBAAA,EAAA,QAAgB;QAAE,kCAAA,EAAA,wBAA+C;QAC5F,IAAI,QAAQ,GAAG,GAAG,CAAC;QACnB,IAAI,WAAW,GAAG,EAAE,CAAC;QAErB,IAAI,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE;YACrB,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;YACrC,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;SAC1C;QAED,IAAI,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAA+B,CAAC;QAC5F,IAAI,CAAC,uBAAuB,IAAI,CAAC,uBAAuB,CAAC,MAAM,EAAE;YAC/D,uBAAuB,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAA+B,CAAC;SAC9F;QAED,IAAI,eAAe,GAA8B;YAC/C,QAAQ,UAAA;YACR,WAAW,aAAA;YACX,MAAM,EAAE,IAAI;YACZ,iBAAiB,mBAAA;YACjB,mBAAmB,EAAE,IAAI,CAAC,kBAAkB;YAC5C,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,kBAAkB,EAAE,IAAI,CAAC,OAAO,CAAC,kBAAkB;aACpD;SACF,CAAC;QAEF,IAAI,MAAsC,CAAC;QAE3C,IAAI,uBAAuB,IAAI,uBAAuB,CAAC,MAAM,EAAE;YAC7D,IAAI,KAAK,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC;YACvC,IAAI,WAAW,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,eAAe,EAAE;gBAC7E,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,uBAAuB,CAAC,WAAW;gBACrE,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO;aACtC,CAAC,CAAC,CAAC;YAEJ,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,UAAU,EAAE;gBACvC,MAAM,GAAG,0BAA0B,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;aACxE;iBAAM,IAAI,KAAK,CAAC,OAAO,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,kBAAkB,KAAK,UAAU,EAAE;gBAClF,MAAM,GAAG,0BAA0B,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,kBAAkB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;aACnG;iBAAM;gBACL,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;aACvC;SACF;aAAM,IAAI,IAAI,CAAC,eAAe,EAAE;YAC/B,IAAI,WAAW,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,eAAe,EAAE;gBAC7E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC1B,WAAW,EAAE,uBAAuB,GAAG,uBAAuB,CAAC,WAAW,GAAG,EAAE;gBAC/E,MAAM,EAAE,IAAI;aACb,CAAC,CAAC,CAAC;YAEJ,MAAM,GAAG,0BAA0B,CAAC,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;SACxE;aAAM,IAAI,IAAI,CAAC,MAAM,EAAE;YACtB,IAAI,MAAM,GAAG,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAEtD,IAAI,MAAM,EAAE;gBACV,IAAI,oBAAoB,GAAG,IAAI,CAAC,gCAAgC,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;gBAE5F,IAAI,WAAW,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,eAAe,EAAE;oBAC7E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC1B,WAAW,EAAE,uBAAuB,GAAG,uBAAuB,CAAC,WAAW,GAAG,EAAE;oBAC/E,MAAM,EAAE,MAAM;oBACd,iBAAiB,EAAE,oBAAoB;oBACvC,kBAAkB,EAAE,IAAI;oBACxB,MAAM,EAAE,IAAI;iBACb,CAAC,CAAC,CAAC;gBAEJ,MAAM,GAAG,0BAA0B,CAAC,WAAW,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;aAC1E;SACF;QAED,IAAI,MAAM,IAAI,iBAAiB,EAAE;YAC/B,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;SAChE;QAED,OAAO,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,sBAAoB,GAAK,CAAC,CAAC,CAAC;KACvE;;IAGD,iDAAgC,GAAhC,UAAiC,MAAc,EAAE,WAAkC;QACjF,IAAI,WAAW,CAAC,MAAM,KAAK,MAAM,EAAE;YACjC,WAAW,CAAC,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC;YACtC,OAAO,WAAW,CAAC;SACpB;aAAM,IAAI,WAAW,CAAC,iBAAiB,EAAE;YACxC,OAAO,IAAI,CAAC,gCAAgC,CAAC,MAAM,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;SACrF;QACD,OAAO,SAAS,CAAC;KAClB;;IAGD,uCAAsB,GAAtB,UAAuB,MAAc;QACnC,IAAI,MAAM,CAAC,eAAe,EAAE;YAC1B,OAAO,MAAM,CAAC;SACf;aAAM,IAAI,MAAM,CAAC,MAAM,EAAE;YACxB,OAAO,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SACnD;QACD,OAAO,KAAK,CAAC;KACd;;;;IAKD,mCAAkB,GAAlB,UAAmB,MAA4B,EAAE,WAAkC;QAAnF,iBA0BC;QAzBC,OAAO,OAAO;aACX,OAAO,CAAC,MAAM,CAAC;aACf,IAAI,CAAC,UAAC,CAAM;YACX,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;gBACzB,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAiB,CAAC;aACvC;iBAAM,IAAI,OAAO,CAAC,KAAK,UAAU,EAAE;gBAClC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;aACvB;YAED,OAAO,CAAC,CAAC;SACV,CAAC;;;;aAID,IAAI,CAAC,UAAC,CAAuB,IAAK,OAAA,OAAO,CAAC,KAAK,QAAQ,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAiB,GAAG,CAAC,GAAA,CAAC;aAC7F,IAAI,CAAC,UAAC,CAAc;YACnB,CAAC,CAAC,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;YAClC,mBAAmB,CAAC,CAAC,CAAC,CAAC;YAEvB,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE;gBACf,CAAC,CAAC,QAAQ,GAAG,KAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;aACrC;YAED,OAAO,CAAC,CAAC;SACV,CAAC,CAAC;KACN;IACH,aAAC;CAAA,IAAA;AAED;AACA,AAAO,IAAM,eAAe,GAAG,UAAC,MAAc,EAAE,WAAkC;IAChF,OAAO,MAAG,MAAM,CAAC,OAAO,IAAI,EAAE,KAAG,WAAW,CAAC,UAAU,EAAE,IAAI,EAAE,CAAE,CAAC;CACnE,CAAC;;AAGF,AAAO,IAAM,mBAAmB,GAAG,UAAC,MAAmB;IACrD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KACzC;IAED,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE;QACpC,IAAI,MAAI,GAAG,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,MAAI,GAAG,yCAAyC,CAAC,CAAC;KAClG;IAED,IAAI,EAAE,UAAU,IAAI,MAAM,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,kBAAkB,IAAI,MAAM,CAAC,SAAS,CAAC,EAAE;QAC/F,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,MAAM,CAAC,KAAK,GAAG,yFAAyF,CAAC,CAAC;KAC1J;CACF,CAAC;;AAGF,AAAO,IAAM,0BAA0B,GAAG,UACxC,WAAkC,EAClC,SAAmB,EACnB,OAAa;IAEb,OAAO,OAAO;SACX,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;SAC7C,IAAI,CAAC;QACJ,IAAI,EAAE,WAAW,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;YACxC,WAAW,CAAC,MAAM,CAAC,SAAS,GAAG;gBAC7B,SAAS,EAAE;oBACT,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ;iBACtC;aACF,CAAC;SACH;QAED,OAAO,WAAW,CAAC;KACpB,CAAC,CAAC;CACN,CAAC;;AC3tBF;AACA,AAAO,IAAM,YAAY,GAAG,UAAC,WAAkC,EAAE,KAA2B;IAC1F,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;IACf,IAAM,IAAI,GAAS;QACjB,KAAK,EAAE,CAAC;QAER,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE;YACxB,IAAI,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;YAE/B,IAAI;gBACF,OAAO,WAAW,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;aACvC;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;aACvB;SACF;aAAM;YACL,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;SACxB;KACM,CAAC;IAEV,IAAI,CAAC,QAAQ,GAAG,uBAAuB,CAAC,IAAI,8BAA2B,CAAC;IACxE,IAAI,CAAC,MAAM,GAAG,uBAAuB,CAAC,IAAI,4BAA0B,CAAC;IACrE,IAAI,CAAC,MAAM,GAAG,uBAAuB,CAAC,IAAI,4BAA0B,CAAC;IAErE,OAAO,IAAI,CAAC;CACb,CAAC;;AAGF,AAAO,IAAM,uBAAuB,GAAG,UAAC,IAAU,EAAE,MAAsB;IACxE,OAAO,UAAC,MAAW,IAAK,OAAA,OAAO;SAC5B,OAAO,CAAC;QACP,MAAM,QAAA;QACN,MAAM,QAAA;QACN,SAAS,EAAE,MAAM;KAClB,CAAC,GAAA,CAAC;CACN,CAAC;;AClCF;;;AAGA;IAAA;;;;;QAKE,UAAK,GAAyB,EAAE,CAAC;KAuClC;;;;;;IAhCC,0BAAO,GAAP,UAAQ,IAAuD;QAC7D,IAAI,GAAG,CAAC;QAER,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;YAC9B,GAAG,GAAG,IAAI,CAAC;SACZ;aAAM,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,UAAU,EAAE;;;YAG9C,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBAC5C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aACxB;YAED,OAAO,IAAI,CAAC;SACb;aAAM;YACL,GAAG,GAAI,IAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC7C;QAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;KACb;;;;;;IAOD,sBAAG,GAAH,UAAI,WAAkC;QACpC,IAAM,MAAM,GAAG,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACrD,OAAO,MAAM,EAAE,CAAC;KACjB;IACH,eAAC;CAAA;;AC5BD;;;;;;AAMA,SAAgB,mBAAmB,CAAC,GAAQ;IAC1C,OAAO,GAAG,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,UAAU,CAAC;CAClD;;;;AAKD;;;;;IAcE,kBAAY,GAAW,EAAE,OAA+B;QAA/B,wBAAA,EAAA,YAA+B;QACtD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC;KACvC;;;;;;IAOD,4BAAS,GAAT,UAAU,MAAc;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;KACtB;;;;;;IAOD,2BAAQ,GAAR,UAAS,SAAiB;QACxB,IAAI,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,SAAS,IAAI,IAAI,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC;QAC1F,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;KACnD;IACH,eAAC;CAAA,IAAA;AAED;;;AAGA;;;;;;IAkBE,yBAAY,KAAa,EAAE,MAAgB,EAAE,OAA+B;QAAjD,uBAAA,EAAA,WAAgB;QAAE,wBAAA,EAAA,YAA+B;QAC1E,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC;KACvC;;;;;;IAOD,mCAAS,GAAT,UAAU,MAAc;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;KACtB;;;;;;IAOD,kCAAQ,GAAR,UAAS,SAAiB;QACxB,IAAI,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,SAAS,IAAI,IAAI,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC;QAC1F,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;KACzE;IACH,sBAAC;CAAA;;ACnHD;;;AAGA,SAAgB,oBAAoB,CAClC,WAAkC,EAClC,qBAA+B;IAE/B,IAAI,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAEhC,IAAI,UAAU,IAAI,MAAM,EAAE;QACxB,OAAO,iBAAiB,CAAC,WAAW,CAAC,CAAC;KACvC;IAED,IAAM,eAAe,GAAG,WAAW,CAAC,mBAAmB,CAAC;IACxD,IAAM,sBAAsB,GAAG,WAAW,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAEnE,IAAI,eAAe,EAAE;QACnB,OAAO,oBAAoB,CAAC,WAAW,EAAE,eAAe,EAAE,sBAAsB,EAAE,qBAAqB,CAAC,CAAC;KAC1G;;IAGD,IAAM,aAAa,GAAwB,EAAE,CAAC;IAC9C,IAAI,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC;IACvC,KAAK,IAAI,YAAY,IAAI,eAAe,EAAE;QACxC,IAAI,cAAc,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;QACnD,IAAI,cAAc,CAAC,QAAQ,KAAK,IAAI,IAAI,YAAY,IAAI,sBAAsB,EAAE;YAC9E,cAAc,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC;SACvD;QACD,aAAa,CAAC,YAAY,CAAC,GAAG;YAC5B,IAAI,EAAE,YAAY;YAClB,QAAQ;YACR,MAAM,EAAE,cAAc;SACvB,CAAC;KACH;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACvC;;;;;AAMD,AAAO,IAAM,iBAAiB,GAAG,UAAC,WAAkC;IAClE,IAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAClC,IAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAClC,OAAO,MAAM;SACV,4BAA4B,CAAC,MAAM,CAAC,QAAQ,CAAC;SAC7C,IAAI,CAAC,UAAA,mBAAmB;QAEvB,IAAM,MAAM,GAAwB,EAAE,CAAC;QACvC,IAAM,yBAAyB,GAAG,WAAW,CAAC,MAAM,CAAC;QACrD,IAAM,yBAAyB,GAAG,mBAAmB,CAAC,MAAM,CAAC;QAE7D,KAAK,IAAI,GAAG,IAAI,yBAAyB,EAAE;;YAEzC,IAAI,GAAG,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;YACzC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;gBAC7C,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;;gBAEnB,IAAI,GAAG,IAAI,yBAAyB,EAAE;oBACpC,MAAM,CAAC,GAAG,CAAC,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;iBAC9C;aACF;iBAAM;gBACL,MAAM,CAAC,GAAG,CAAC,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;aAC9C;SACF;QACD,IAAI,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;;QAGhG,KAAK,IAAI,GAAG,IAAI,yBAAyB,EAAE;YACzC,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAI,GAAK,EAAE,yBAAyB,CAAC,GAAG,CAAC,CAAC,CAAC;SACxF;QAED,IAAI,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;QAC1C,IAAI,WAAW,EAAE;YACf,gBAAgB,IAAI,GAAG,GAAG,WAAW,CAAC;SACvC;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC;KACxD,CAAC,CAAC;CACN,CAAC;;;;;AAMF,AAAO,IAAM,oBAAoB,GAAG,UAClC,kBAAyC,EACzC,mBAA0C,EAC1C,sBAA2D,EAC3D,qBAA+B;IAG/B,IAAI,aAAa,GAAwB,EAAE,CAAC;IAC5C,IAAI,oBAAoB,GAAG,kBAAkB,CAAC,MAAM,CAAC;IACrD,IAAI,YAAY,GAAG,2BAA2B,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;IACxF,IAAI,OAAO,GAAoB,EAAE,CAAC;IAClC,IAAI,4BAA4B,GAAG,mBAAmB,CAAC,oBAA2D,CAAC;4BAE1G,YAAY;QAEnB,IAAM,uBAAuB,GAAG,4BAA4B,CAAC,YAAY,CAAC,CAAC;QAC3E,IAAM,qBAAqB,GAAG,uBAAuB,CAAC,SAAS,CAAC;QAChE,IAAM,6BAA6B,GAAG,oBAAoB,CAAC,SAAwC,CAAC;;;QAIpG,IAAI,kBAAkB,GAAG,YAAY,IAAI,6BAA6B;cAClE,6BAA6B,CAAC,YAAY,CAAC;cAC3C,uBAAuB,CAAC;QAE5B,IAAI,kBAAkB,CAAC,QAAQ,KAAK,IAAI,IAAI,YAAY,IAAI,sBAAsB,EAAE;YAClF,kBAAkB,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC;SAC3D;QAED,IAAM,0BAA0B,GAAG,2BAA2B,CAC5D,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,CACtB,CAAC;QACF,IAAM,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG;YACjD,IAAI,EAAE,YAAY;;YAElB,MAAM,EAAE,kBAAiC;YACzC,aAAa,EAAE,qBAAqB;YACpC,YAAY,EAAE,uBAAuB,CAAC,QAAQ;YAC9C,QAAQ,EAAE,0BAA0B;SACrB,CAAC;;;;QAKlB,IAAI,0BAA0B,gCAA2C,uBAAuB,CAAC,WAAW,EAAE;YAC5G,IAAM,IAAI,GAAG,kBAAkB,CAAC,eAAe,EAAE,CAAC;YAClD,IAAM,IAAI,GAAkB,uBAAuB;iBAChD,WAAW;iBACX,4BAA4B,CAAC,IAAI,EAAE,kBAAkB,CAAC;iBACtD,IAAI,CAAC,UAAC,gBAAuC;gBAC5C,YAAY,CAAC,0BAA0B,GAAG,gBAAgB,CAAC;gBAE3D,OAAO,oBAAoB,CACzB,gBAAgB;;;;gBAIhB,YAAY,CAAC,QAAQ,8CACtB;qBACE,IAAI,CAAC,UAAA,SAAS;oBACb,IAAI,SAAS,YAAY,QAAQ,EAAE;wBACjC,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;qBAClC;oBACD,gBAAgB,CAAC,IAAI,GAAG,SAAS,CAAC;;oBAElC,OAAO,IAAI,CAAC;iBACb,CAAC,CAAC;aACN,CAAC,CAAC;YAEL,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACpB;;IA7DH,KAAK,IAAI,YAAY,IAAI,4BAA4B;gBAA5C,YAAY;KA8DpB;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,cAAM,OAAA,aAAa,GAAA,CAAC,CAAC;CACvD,CAAC;;;;;AAMF,AAAO,IAAM,2BAA2B,GAAG,UACzC,qBAA4C,EAC5C,uBAA4C,EAC5C,iBAAoD;;AAEpD,YAAqB,EACrB,qBAA+B;IAG/B,IAAI,oBAAoB,GAAG,qBAAqB,CAAC,MAAM,CAAC;IACxD,IAAI,qBAAqB,GAAG,uBAAuB,CAAC,SAAS,CAAC,SAAS,CAAC;IACxE,IAAI,oBAA4C,CAAC;IAEjD,IAAI,uBAAuB,CAAC,QAAQ,KAAK,iBAAiB,CAAC,QAAQ,EAAE;QACnE,oBAAoB,2BAAsC;KAC3D;SAAM,IAAI,6BAA6B,IAAI,qBAAqB,EAAE;QACjE,oBAAoB,GAAG,qBAAqB,CAAC,2BAA2B,OAAjD,qBAAqB,EAAgC,qBAAqB,CAAC,aAAa,CAAC,CAAC;KAClH;SAAM,IAAI,oBAAoB,CAAC,kBAAkB,EAAE;QAClD,oBAAoB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC;KAChE;SAAM,IAAI,YAAY,IAAI,qBAAqB,EAAE;QAChD,oBAAoB,4CAA8C;KACnE;SAAM;QACL,oBAAoB,8BAAuC;KAC5D;IACD,OAAO,oBAAoB,CAAC;CAC7B,CAAC;;AAGF,AAAO,IAAM,2BAA2B,GAAG,UAAC,IAA2B,EAAE,IAA2B;IAClG,IAAI,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC7B,IAAI,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC7B,IAAI,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC;IAElF,KAAK,IAAI,GAAG,IAAI,UAAU,EAAE;QAC1B,IAAI,GAAG,KAAK,gBAAgB,EAAE;YAC5B,SAAS;SACV;QAED,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,UAAU,CAAC,GAAG,CAAC,EAAE;YACvC,OAAO,IAAI,CAAC;SACb;KACF;IAED,KAAK,IAAI,GAAG,IAAI,UAAU,EAAE;QAC1B,IAAI,GAAG,KAAK,gBAAgB,EAAE;YAC5B,SAAS;SACV;QAED,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,UAAU,CAAC,GAAG,CAAC,EAAE;YACvC,OAAO,IAAI,CAAC;SACb;KACF;IAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE;QACpC,OAAO,KAAK,CAAC;KACd;IAED,IAAI,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC;IACvC,IAAI,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC;IACvC,KAAK,IAAI,GAAG,IAAI,eAAe,EAAE;QAC/B,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,eAAe,CAAC,GAAG,CAAC,EAAE;YACjD,OAAO,IAAI,CAAC;SACb;KACF;IAED,KAAK,IAAI,GAAG,IAAI,eAAe,EAAE;QAC/B,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,eAAe,CAAC,GAAG,CAAC,EAAE;YACjD,OAAO,IAAI,CAAC;SACb;KACF;IAED,OAAO,KAAK,CAAC;CACd,CAAC;;ACpPF;;;;AAIA;IAAA;KAYC;IAXC,qCAAG,GAAH,UAAI,qBAA4C,EAAE,IAAU;QAC1D,OAAO,oBAAoB,CAAC,qBAAqB,CAAC;aAC/C,IAAI,CAAC,UAAA,IAAI;YACR,IAAI,IAAI,YAAY,QAAQ,EAAE;gBAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aAC1B;YACD,qBAAqB,CAAC,IAAI,GAAG,IAAI,CAAC;YAClC,OAAO,IAAI,EAAE,CAAC;SACf,CAAC;aACD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACvB;IACH,8BAAC;CAAA;;ACND;;;AAGA,AAAO,IAAM,YAAY,GAAG,UAC1B,WAAwB,EACxB,qBAA4C;IAE5C,IAAI,YAAY,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,CAAC;IAChE,IAAI,YAAY,GAAG,YAAY,CAAC,GAAG,CAAC,UAAC,WAAyB,IAAK,OAAA,SAAS,CAC1E,WAAW,EACX,WAAW,CAAC,qBAAqB,EACjC,WAAW,CAAC,YAAY,CACzB,GAAA,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;CAClC,CAAC;;;;AAKF,AAAO,IAAM,qBAAqB,GAAG,UACnC,qBAA4C,EAC5C,YAAiC;IAAjC,6BAAA,EAAA,iBAAiC;IAEjC,IAAI,aAAa,GAAiC,qBAAqB,CAAC,IAAI,CAAC;IAE7E,KAAK,IAAI,YAAY,IAAI,aAAa,EAAE;QACtC,IAAI,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAI,mBAAmB,GAAG,YAAY,CAAC,0BAA0B,CAAC;QAElE,IAAI,YAAY,CAAC,QAAQ,8BAAyC;YAChE,YAAY,CAAC,IAAI,CAAC,EAAE,YAAY,cAAA,EAAE,qBAAqB,uBAAA,EAAkB,CAAC,CAAC;YAE3E,IAAI,mBAAmB,EAAE;gBACvB,qBAAqB,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;aAC1D;SACF;aAAM;YACL,IAAI,mBAAmB,GAAG,qBAAqB,CAAC,sBAAsB,CAAC;gBACrE,IAAI,EAAE,YAAY;gBAClB,QAAQ,EAAE,YAAY,CAAC,QAAQ;gBAC/B,QAAQ,EAAE,YAAY,CAAC,YAAY;gBACnC,SAAS,EAAE,YAAY,CAAC,aAAa;aACtC,CAAwB,CAAC;YAE1B,IAAI,mBAAmB,EAAE;gBACvB,mBAAmB,CAAC,0BAA0B,GAAG,mBAAmB,CAAC;gBACrE,qBAAqB,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;aAC1D;SACF;KACF;IAED,OAAO,YAAY,CAAC;CACrB,CAAC;;;;AAKF,AAAO,IAAM,SAAS,GAAG,UACvB,WAAwB,EACxB,qBAA4C,EAC5C,YAA0B;IAE1B,IAAI,UAAU,GAAG,YAAY,CAAC,MAAM,CAAC;IACrC,IAAI,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC;IAEvD,OAAO,aAAa,CAAC,WAAW,EAAE,qBAAqB,EAAE,UAAU,CAAC;SACjE,IAAI,CAAC,UAAC,SAAS;QACd,IAAI,mBAAmB,GAAG,qBAAqB,CAAC,sBAAsB,CAAC;YACrE,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,QAAQ,EAAE,YAAY,CAAC,QAAQ;YAC/B,QAAQ,EAAE,QAAQ;YAClB,SAAS,EAAE,SAAS;SACrB,CAAwB,CAAC;QAE1B,IAAI,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;QACxC,IAAI,WAAW,EAAE;YACf,IAAI,IAAI,GAAG,qBAAqB,CAAC,eAAe,EAAE,CAAC;YAEnD,OAAO,WAAW;iBACf,4BAA4B,CAAC,IAAI,EAAE,qBAAqB,CAAC;iBACzD,IAAI,CAAC,UAAC,gBAAgB;gBACrB,YAAY,CAAC,0BAA0B,GAAG,gBAAgB,CAAC;gBAE3D,OAAO,oBAAoB,CAAC,gBAAgB,CAAC;qBAC1C,IAAI,CAAC,UAAC,SAAS;oBACd,IAAI,SAAS,YAAY,QAAQ,EAAE;wBACjC,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;qBAClC;oBACD,gBAAgB,CAAC,IAAI,GAAG,SAAS,CAAC;oBAClC,mBAAmB,CAAC,0BAA0B,GAAG,gBAAgB,CAAC;oBAElE,OAAO,YAAY,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;iBACpD,CAAC,CAAC;aACN,CAAC,CAAC;SACN;;QAED,OAAO,KAAK,CAAC,CAAC;KACf,CAAC,CAAC;CACN,CAAC;;;;;AAMF,AAAO,IAAM,aAAa,GAAG,UAC3B,WAAwB,EACxB,qBAA4C,EAC5C,MAAmB;IAEnB,IAAI,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC;IAC1C,IAAI,aAAa,GAAG,qBAAqB,CAAC,aAAa,CAAC;IAExD,OAAO,OAAO,CAAC,OAAO,EAAE;SACrB,IAAI,CAAC,cAAM,OAAA,WAAW,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,qBAAqB,CAAC,GAAA,CAAC;SACxE,IAAI;;;;;IAKH,UAAC,SAA4B;QACrB,IAAA,+BAAS,EAAE,yCAAc,CAAe;QAC9C,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC;QAC1B,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC;QAE1B,IAAI,iBAAiB,IAAI,SAAS,EAAE;YAClC,IAAI,aAAW,GAAG,cAAc,CAAC,cAAc,EAAE,CAAC;YAClD,SAAS,CAAC,WAAW,GAAG,aAAW,CAAC;YAEpC,OAAO,aAAW;iBACf,SAAS,CAAC,UAAA,CAAC,IAAI,OAAA,SAAS,CAAC,eAAe,CAAC,CAAC,EAAE,aAAW,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,GAAA,CAAC;iBAC/G,IAAI,CAAC,cAAM,OAAA,SAAS,GAAA,CAAC,CAAC;SAC1B;QAED,OAAO,SAAS,CAAC;KAClB,CACF,CAAC;CACL,CAAC;;ACnJF;;;;AAIA;IAAA;KASC;;;;;;IAHC,+BAAS,GAAT,UAAU,MAAc,EAAE,MAAmB,EAAE,qBAA4C;QACzF,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;KACrG;IACH,kBAAC;CAAA;;ACbD;;;AAGA;IAQE,uBAAY,WAAwB;QAClC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;KAChC;;IARM,oBAAM,GAAb,cAAkB,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE;;;;IAYzC,2BAAG,GAAH,UAAI,qBAA4C,EAAE,IAAU;QAC1D,OAAO,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,qBAAqB,CAAC;aACzD,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;KAC5B;IACH,oBAAC;CAAA;;ACvBD;;;AAGA;IAAA;KASC;IARC,+BAAG,GAAH,UAAI,qBAA4C,EAAE,IAAc;QAC9D,OAAO,qBAAqB;aACzB,cAAc,mBAAmB,IAAI,CAAC;aACtC,IAAI,CAAC;YACJ,qBAAqB,CAAC,YAAY,EAAE,CAAC;YACrC,OAAO,IAAI,EAAE,CAAC;SACf,CAAC,CAAC;KACN;IACH,wBAAC;CAAA;;ACdD;;;;AAIA,IAAkB,0BAajB;AAbD,WAAkB,0BAA0B;;;;IAI1C,oDAAsB,CAAA;;;;IAItB,kEAAoC,CAAA;;;;IAIpC,iDAAmB,CAAA;CACpB,EAbiB,0BAA0B,KAA1B,0BAA0B,QAa3C;;;;;AAMD,IAAa,kBAAkB,GAAuB;IACpD,QAAQ;IACR,eAAe;IACf,OAAO;CACR;;ACrBD;;;;;AAKA,AAAO,IAAM,oBAAoB,GAAG,UAClC,qBAA4C,EAC5C,YAA4C,EAC5C,IAAU,EACV,YAAsB;IAEtB,IAAI,IAAI,GAAiC,qBAAqB,CAAC,IAAI,CAAC;IACpE,IAAI,KAAK,GAAG,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAClD,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAErB,SAAS,OAAO,CAAC,GAAQ;QACvB,IAAI,YAAY,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE;YACvC,OAAO,OAAO,EAAE,CAAC;SAClB;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KACzB;IAED,SAAS,OAAO;QACd,IAAI,CAAC,EAAE,EAAE;YACP,IAAI;gBACF,IAAI,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBACzB,IAAI,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC;gBAC5D,OAAO,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;aACvD;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAC3B;SACF;QAED,qBAAqB,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;QAEpD,OAAO,IAAI,EAAE,CAAC;KACf;IAED,OAAO,OAAO,EAAE,CAAC;CAClB,CAAC;;;;;AAMF,AAAO,IAAM,iBAAiB,GAAG,UAC/B,IAAkC,EAClC,YAAoB,EACpB,IAA6B;IAA7B,qBAAA,EAAA,SAA6B;IAE7B,KAAK,IAAI,YAAY,IAAI,IAAI,EAAE;QAC7B,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;QACtC,IAAI,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC;QAE/C,IAAI,CAAC,YAAY,CAAC,QAAQ,KAAK,kBAAkB,CAAC,eAAe,IAAI,YAAY,CAAC,QAAQ,KAAK,kBAAkB,CAAC,OAAO;eACpH,aAAa,EAChB;YACA,IAAI,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;YAExC,IAAI,YAAY,IAAI,SAAS,EAAE;gBAC7B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aACtB;SACF;QAED,IAAI,YAAY,CAAC,QAAQ,KAAK,kBAAkB,CAAC,OAAO,IAAI,aAAa,EAAE;YACzE,wBAAwB,CAAC,aAAa,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;SAC7D;aAAM,IAAI,YAAY,CAAC,0BAA0B,EAAE;YAClD,iBAAiB,CAAC,YAAY,CAAC,0BAA0B,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;SACrF;KACF;IAED,OAAO,IAAI,CAAC;CACb,CAAC;;;;AAKF,AAAO,IAAM,wBAAwB,GAAG,UACtC,SAA4B,EAC5B,YAAoB,EACpB,IAAwB;IAExB,IAAI,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC;IAExC,IAAI,WAAW,IAAI,WAAW,CAAC,kBAAkB,EAAE;QACjD,IAAI,oBAAoB,GAAG,WAAW,CAAC,kBAAkB,CAAC,oBAAoB,CAAC;QAE/E,KAAK,IAAI,YAAY,IAAI,oBAAoB,EAAE;YAC7C,IAAI,mBAAmB,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;YAC7D,IAAI,aAAa,GAAG,mBAAmB,CAAC,SAAS,CAAC;YAClD,IAAI,aAAa,GAAG,aAAa,CAAC,SAAS,CAAC;YAE5C,IAAI,YAAY,IAAI,aAAa,EAAE;gBACjC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aAC1B;YAED,wBAAwB,CAAC,aAAa,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;SAC7D;KACF;CACF,CAAC;;;;AAKF,AAAO,IAAM,kBAAkB,GAAG,UAChC,qBAA4C,EAC5C,YAAwC,EACxC,IAAU,EACV,YAAsB;IAEtB,IAAI,KAAK,GAAG,eAAe,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC;IACjE,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC1B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEX,SAAS,OAAO,CAAC,GAAQ,EAAE,MAAc;QACvC,IAAI,YAAY,IAAI,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;YAC/C,OAAO,OAAO,EAAE,CAAC;SAClB;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KACzB;IAED,SAAS,OAAO;;QACd,CAAC,EAAE,CAAC;QAEJ,IAAI,CAAC,GAAG,MAAM,EAAE;YACd,IAAI;gBACF,IAAI,SAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBACvB,IAAI,MAAM,GAAG,CAAA,KAAA,SAAO,CAAC,SAAS,EAAC,YAAY,CAAC,WAAI,SAAO,CAAC,aAAa,CAAC,CAAC;gBACvE,OAAO,gBAAgB,CAAC,MAAM,EAAE,UAAC,GAAQ,IAAK,OAAA,OAAO,CAAC,GAAG,EAAE,SAAO,CAAC,MAAM,CAAC,GAAA,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;aAC1F;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aAC3B;SACF;QAED,OAAO,IAAI,EAAE,CAAC;KACf;IAED,OAAO,OAAO,EAAE,CAAC;CAClB,CAAC;;;;;AAYF,AAAO,IAAM,eAAe,GAAG,UAC7B,qBAA4C,EAC5C,YAAwC,EACxC,IAA6B,EAC7B,MAAe;IADf,qBAAA,EAAA,SAA6B;IAG7B,IAAI,IAAI,GAAiC,qBAAqB,CAAC,IAAI,CAAC;IAEpE,MAAM;SACH,IAAI,CAAC,IAAI,CAAC;SACV,OAAO,CAAC,UAAC,YAAY;QACpB,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;QACtC,IAAI,mBAAmB,GAAG,qBAAqB,CAAC,oBAAoB,CAAC,YAAY,CAAwB,CAAC;QAC1G,IAAI,iBAAiB,GAAG,mBAAmB,CAAC,SAAS,CAAC;QACtD,IAAI,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC;QAE5C,IACE,CAAC,YAAY,CAAC,QAAQ,KAAK,kBAAkB,CAAC,eAAe;eACxD,YAAY,CAAC,QAAQ,KAAK,kBAAkB,CAAC,OAAO;eAEtD,YAAY,IAAI,SAAS,EAC5B;YACA,IAAI,CAAC,IAAI,CAAC;gBACR,SAAS,WAAA;gBACT,aAAa,EAAE,mBAAmB,CAAC,aAAa;gBAChD,MAAM,QAAA;aACP,CAAC,CAAC;SACJ;QAED,IAAI,mBAAmB,GAAG,YAAY,CAAC,0BAA0B,CAAC;QAElE,IAAI,mBAAmB,EAAE;YACvB,eAAe,CACb,mBAAmB,EACnB,YAAY,EACZ,IAAI,EACJ,iBAAiB,CAAC,WAAW,IAAI,MAAM,CACxC,CAAC;SACH;KACF,CAAC,CAAC;IAEL,OAAO,IAAI,CAAC;CACb,CAAC;AAEF,IAAM,cAAc,GAAG,UAAU,MAAS,EAAE,MAAe;IACzD,IAAI,MAAM,YAAY,KAAK,EAAE;QAC3B,OAAO,KAAK,CAAC;KACd;IAED,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE;QAC/B,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,UAAU,EAAE;YAC1C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;SAC1B;QAED,OAAO,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC;KAC1C;IAED,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,MAAM,CAAC;CACf,CAAC;;;;;AA4BF;IAKE,0BAAY,gBAAsC;QAChD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAE5C,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,WAAW,EAAE,CAAC;SACpB;KACF;IAED,sBAAI,wCAAU;aAAd;YACE,OAAO,IAAI,CAAC,WAAW,CAAC;SACzB;;;OAAA;IAED,sCAAW,GAAX;QACE,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,aAAa,EAAE;YAC1C,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;SAClC;QAED,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;KAC1B;IACH,uBAAC;CAAA,IAAA;;;;;;;AAQD,IAAM,gBAAgB,GAAG,UAAC,GAAQ,EAAE,OAA2B,EAAE,MAA0B;;IAEzF,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE;QACzC,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KACzD;;IAGD,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,SAAS,KAAK,UAAU,EAAE;QAC9C,IAAI,KAAG,GAAgB,GAAG,CAAC;QAC3B,OAAO,IAAI,gBAAgB,CAAC,UAAA,GAAG,IAAI,OAAA,KAAG,CAAC,SAAS,CAAC;YAC/C,IAAI;gBACF,IAAI,GAAG,CAAC,UAAU,EAAE;oBAClB,GAAG,CAAC,WAAW,EAAE,CAAC;oBAClB,OAAO,CAAC,GAAG,CAAC,CAAC;iBACd;aACF;YACD,KAAK,YAAC,KAAK;gBACT,IAAI,GAAG,CAAC,UAAU,EAAE;oBAClB,GAAG,CAAC,WAAW,EAAE,CAAC;oBAClB,MAAM,CAAC,KAAK,CAAC,CAAC;iBACf;aACF;YACD,QAAQ;gBACN,IAAI,GAAG,CAAC,UAAU,EAAE;oBAClB,GAAG,CAAC,WAAW,EAAE,CAAC;oBAClB,OAAO,CAAC,GAAG,CAAC,CAAC;iBACd;aACF;SACF,CAAC,GAAA,CAAC,CAAC;KACL;;IAGD,IAAI;QACF,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;KACrB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;KACtB;CACF,CAAC;;AC1TF;;;AAGA;IAAA;KAIC;IAHC,uCAAG,GAAH,UAAI,qBAA4C,EAAE,IAAU;QAC1D,OAAO,oBAAoB,CAAC,qBAAqB,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;KAC3E;IACH,gCAAC;CAAA,IAAA;AAED;;;AAGA;IAAA;KAIC;IAHC,iCAAG,GAAH,UAAI,qBAA4C,EAAE,IAAU;QAC1D,OAAO,kBAAkB,CAAC,qBAAqB,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;KACvE;IACH,0BAAC;CAAA,IAAA;AAED;;;AAGA;IAAA;KAIC;IAHC,oCAAG,GAAH,UAAI,qBAA4C,EAAE,IAAU;QAC1D,OAAO,oBAAoB,CAAC,qBAAqB,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC9E;IACH,6BAAC;CAAA,IAAA;AAED;;;AAGA;IAAA;KAIC;IAHC,8BAAG,GAAH,UAAI,qBAA4C,EAAE,IAAU;QAC1D,OAAO,kBAAkB,CAAC,qBAAqB,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAC1E;IACH,uBAAC;CAAA;;AC7BD;;;AAGA;IAWE,sBAAY,SAAoB,EAAE,IAAY,EAAE,KAAc;QAF9D,UAAK,GAAgC,EAAE,CAAC;QAGtC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;KACxB;IAED,+BAAQ,GAAR;QAAA,iBAEC;QADC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,GAAA,CAAC,CAAC;KACnD;IACH,mBAAC;CAAA,IAAA;;;;AAKD;IASE,0BAAY,SAAoB;QAC9B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG;YACX,uBAAuB;YACvB,yBAAyB;YACzB,aAAa;YACb,kBAAkB,CAAC,SAAS,8BAA6B;YACzD,mBAAmB;YACnB,kBAAkB,CAAC,SAAS,mCAAgC,WAAW,CAAC;;YAExE,sBAAsB;YACtB,gBAAgB;YAChB,kBAAkB,CAAC,SAAS,+BAA8B,WAAW,CAAC;YACtE,iBAAiB;YACjB,kBAAkB,CAAC,SAAS,iCAA+B,cAAc,CAAC;SAC3E,CAAC;KACH;;IAtBM,uBAAM,GAAb,cAAkB,OAAO,CAACV,oCAAS,CAAC,CAAC,EAAE;;;;IA2BvC,yCAAc,GAAd,UAAe,oBAAoC;QAAnD,iBAQC;QARc,qCAAA,EAAA,2BAAoC;QACjD,IAAI,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAA,IAAI;YACrB,IAAI,oBAAoB,IAAI,IAAI,KAAK,yBAAyB,EAAE;gBAC9D,QAAQ,CAAC,OAAO,CAAC,KAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;aAC5C;SACF,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;KACjB;;IAGD,oCAAS,GAAT,UAAU,IAAY;;QAEpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAC,CAAkB,CAAC,QAAQ,KAAK,IAAI,IAAK,CAAkB,CAAC,SAAS,KAAK,IAAI,GAAA,CAAiB,CAAC;KAC9H;;;;IAKD,kCAAO,GAAP,UAAQ,IAAY,EAAE,IAA6B;QACjD,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,KAAK,EAAE;YACT,IAAI,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC;;YAE5B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBAC7B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACtB;SACF;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,iCAA+B,IAAI,MAAG,CAAC,CAAC;SACzD;KACF;;;;IAKD,qCAAU,GAAV,UAAW,IAAY,EAAE,IAAkB;QACzC,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,IAAI,EAAE;YACR,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;YAC3B,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;SAC9C;KACF;;;;;IAMD,sCAAW,GAAX,UAAY,IAAiB;QAAjB,qBAAA,EAAA,SAAiB;QAC3B,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;SACjB;KACF;;;;IAKD,gCAAK,GAAL;QACE,IAAI,CAAC,WAAW,6BAA4B,CAAC;QAC7C,IAAI,CAAC,WAAW,iCAA8B,CAAC;QAC/C,IAAI,CAAC,WAAW,6BAA4B,CAAC;QAC7C,IAAI,CAAC,WAAW,+BAA6B,CAAC;KAC/C;IACH,uBAAC;CAAA,IAAA;AAED;AACA,IAAM,kBAAkB,GAAG,UAAC,SAAoB,EAAE,IAAsB,EAAE,KAAc;IACtF,OAAO,IAAI,YAAY,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;CACjD,CAAC;;ACpHF,IAAM,MAAM,GAAGW,oBAAoB,CAAC,YAAY,CAAC,CAAC;;;;AAKlD;IAA+BH,6BAAM;IAanC,mBAAY,SAAoB,EAAE,OAAgB,EAAE,gBAAkC,EAAE,MAAuB;QAA/G,YACE,kBAAM,SAAS,EAAE,OAAO,CAAC,SAG1B;QAFC,KAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;KACtB;;IAdM,gBAAM,GAAb,cAAkB,OAAO,CAACR,oCAAS,EAAES,sBAAO,EAAE,gBAAgB,EAAEG,sCAAe,CAAC,CAAC,EAAE;;;;;IAoBnF,yBAAK,GAAL;QACE,iBAAM,KAAK,WAAE,CAAC;QACd,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;QAC9B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;SAClB;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;SACxB;KACF;;;;;;IAOD,2BAAO,GAAP,UAAQ,GAAW;QAAnB,iBAQC;QAPC,OAAO,IAAI;aACR,4BAA4B,CAAC,GAAG,CAAC;aACjC,IAAI,CAAC,UAAA,WAAW,IAAI,OAAA,KAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,GAAA,CAAC;aACxD,KAAK,CAAC,UAAA,KAAK;YACV,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpB,uBAAuB,CAAC,KAAI,CAAC,CAAC;SAC/B,CAAC,CAAC;KACN;;;;;;;IAQD,oCAAgB,GAAhB,UAAiB,QAA0B,EAAE,IAAa;QAA1D,iBA4CC;;QA1CC,IAAM,SAAS,GAAa,QAAQ,CAAC;QACrC,iBAAM,gBAAgB,YAAC,SAAS,EAAE,IAAI,CAAC,CAAC;;;;;QAMxC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAM,WAAS,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;YACjD,IAAI,iBAAiB,IAAI,WAAS,EAAE;;;;gBAIlC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;;;oBAGtB,IAAM,0BAAwB,GAAG,IAAI,CAAC,yBAAyB,CAAC;oBAChE,IAAI,CAAC,yBAAyB,GAAG,eAAY,CAAC;oBAC9C,OAAO,IAAI;yBACR,SAAS,CAAC,UAAA,MAAM;wBACf,OAAA,OAAO;6BACJ,OAAO,CAAC,WAAS,CAAC,eAAe,CAAC,MAAM,EAAE,KAAI,CAAC,CAAC;;;6BAGhD,IAAI,CAAC,cAAM,OAAA,MAAM,GAAA,CAAQ;qBAAA,CAC7B;yBACA,IAAI,CAAC;wBACJ,KAAI,CAAC,QAAQ,EAAE,CAAC;wBAChB,0BAAwB,EAAE,CAAC;qBAC5B,CAAC,CAAC;iBACN;aACF;iBAAM;gBACL,IAAI,CAAC,QAAQ,EAAE,CAAC;aACjB;SACF;;;aAGI;YACH,IAAI,CAAC,mBAAmB,EAAE,CAAC;SAC5B;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;KAC1B;;;;;;IAOD,4BAAQ,GAAR,UAAS,OAA2B;QAClC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO;SACR;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;;;QAGrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/F,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,mBAAmB,EAAE,CAAC;KAC5B;;;;IAKD,8BAAU,GAAV;QACE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;KAC3B;;IAGD,qCAAiB,GAAjB,UAAkB,WAAkC;QAApD,iBAMC;QALC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO;YACzB,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;YAC9B,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACjC,KAAI,CAAC,mBAAmB,EAAE,CAAC;SAC5B,CAAC,CAAC;KACJ;;IAGD,uCAAmB,GAAnB,UAAoB,gBAA4B;QAAhD,iBA6DC;QA7DmB,iCAAA,EAAA,oBAA4B;QAC9C,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;YAC5B,IAAI,KAAI,CAAC,YAAY,IAAI,CAAC,gBAAgB,EAAE;;gBAE1C,OAAO,KAAK,CAAC,CAAC;aACf;YAED,IAAI,WAAW,GAAG,KAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACtC,KAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;YAEvB,IAAI,CAAC,WAAW,EAAE;;gBAEhB,OAAO,KAAK,CAAC,CAAC;aACf;YAED,KAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YAEzB,IAAI,UAAU,GAAW,KAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;YACpE,IAAI,iBAAiB,GAAG,KAAI,CAAC,wBAAwB,CAAC;YAEtD,IAAI,CAAC,UAAU,IAAI,CAAC,iBAAiB,EAAE;gBACrC,KAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAC9B,KAAI,CAAC,eAAe,GAAG,IAAI,CAAC;aAC7B;iBAAM,IAAI,CAAC,UAAU,EAAE;gBACtB,KAAI,CAAC,eAAe,GAAG,IAAI,CAAC;aAC7B;iBAAM,IAAI,CAAC,iBAAiB,EAAE;gBAC7B,KAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;aACjC;iBAAM,IAAI,iBAAiB,GAAG,UAAU,EAAE;gBACzC,KAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;aACjC;iBAAM,IAAI,iBAAiB,GAAG,UAAU,EAAE;gBACzC,KAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;aAC9B;YAAC,IAAI,CAAC,UAAU,EAAE;gBACjB,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;gBACxB,KAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;aACxD;YACD,KAAI,CAAC,wBAAwB,GAAG,UAAU,CAAC;YAE3C,WAAW,CAAC,mBAAmB,GAAG,KAAI,CAAC,kBAAkB,CAAC;YAE1D,IAAI,mBAAmB,GAAG,KAAI,CAAC,mBAAmB,CAAC;YAEnD,IAAI,CAAC,gBAAgB,EAAE;gBACrB,KAAI,CAAC,MAAM,CAAC,OAAO,kDAAyB,EAAE,WAAW,aAAA,EAAE,CAAC,CAAC;aAC9D;iBAAM,IAAI,gBAAgB,KAAK,mBAAmB,GAAG,CAAC,EAAE;gBACvD,MAAM,CAAC,KAAK,CAAI,gBAAgB,GAAG,CAAC,sGAAmG,CAAC,CAAC;gBACzI,uBAAuB,CAAC,KAAI,CAAC,CAAC;gBAC9B,OAAO,KAAI,CAAC,mBAAmB,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC;aACvD;iBAAM,IAAI,gBAAgB,GAAG,mBAAmB,EAAE;gBACjD,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;aACrE;YAED,IAAI,QAAQ,GAAG,KAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,KAAI,CAAC,eAAe,CAAC,CAAC;YAE3E,OAAO,QAAQ;iBACZ,GAAG,CAAC,WAAW,CAAC;iBAChB,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAI,CAAC,GAAA,CAAC;iBAC1E,KAAK,CAAC,UAAA,KAAK;gBACV,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,EAAoB,CAAC;aACxF,CAAC;iBACD,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,gBAAgB,EAAE,KAAI,CAAC,GAAA,CAAC,CAAC;SACtF,CAAC,CAAC;KACJ;;IAGD,kCAAc,GAAd,UAAe,QAAkB;QAC/B,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;SACjC;QAED,IAAI,QAAQ,CAAC,SAAS,EAAE;YACtB,IAAI,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;YAEnC,OAAO,SAAS,EAAE;gBAChB,IAAI,SAAS,CAAC,SAAS,EAAE;oBACvB,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;oBAC/C,OAAO,SAAS,CAAC,SAAS,CAAC;iBAC5B;gBAED,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC;aAC9B;SACF;QAED,OAAO,SAAS,CAAC;KAClB;IACH,gBAAC;CA5ND,CAA+B,MAAM,GA4NpC;AAED,IAAM,aAAa,GAAG,UACpB,WAAkC,EAClC,MAAsB,EACtB,gBAAwB,EACxB,MAAiB;IAEjB,IAAI,EAAE,MAAM,IAAI,WAAW,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,EAAE;QAC5D,MAAM,GAAG,MAAM,IAAI,EAAoB,CAAC;QACxC,MAAM,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,sEAAoE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,eAAY,CAAC,CAAC;KACnI;IAED,IAAI,WAAW,GAAmB,IAAI,CAAC;IACvC,IAAI,uBAAuB,GAAG,IAAI,CAAC;IACnC,IAAI,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;QACtC,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;KAC1D;SAAM;QACL,WAAW,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACrB,IAAI,MAAM,CAAC,MAAM,YAAY,KAAK,EAAE;gBAClC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;aACxC;YAED,uBAAuB,CAAC,MAAM,CAAC,CAAC;SACjC;KACF;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC;SAC5C,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,GAAG,CAAC,CAAC,GAAA,CAAC;SAC3D,IAAI,CAAC,UAAA,WAAW,IAAI,OAAA,WAAW,IAAI,WAAW,IAAI,MAAM,GAAA,CAAC,CAAC;CAC9D,CAAC;AAEF,IAAM,kBAAkB,GAAG,UACzB,WAAkC,EAClC,MAAsB,EACtB,kBAA2B,EAC3B,MAAiB;IAEjB,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5B,IAAI,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IACpC,IAAI,SAAS,GAAG,EAAE,WAAW,aAAA,EAAE,MAAM,QAAA,EAAE,CAAC;IACxC,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC;QAC5B,MAAM,CAAC,oBAAoB,GAAG,KAAK,CAAC;QACpC,MAAM,CAAC,wBAAwB,GAAG,KAAK,CAAC;QACxC,MAAM,CAAC,iBAAiB,GAAG,KAAK,CAAC;QACjC,MAAM,CAAC,eAAe,GAAG,KAAK,CAAC;QAC/B,MAAM,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACnC,MAAM,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACnC,MAAM,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAChC,MAAM,CAAC,eAAe,GAAG,KAAK,CAAC;QAE/B,IAAI,SAAS,SAAQ,CAAC;QAEtB,IAAI,MAAM,CAAC,MAAM,YAAY,KAAK,EAAE;YAClC,SAAS,yCAAqB;SAC/B;aAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YAC5B,SAAS,+CAAwB;SAClC;aAAM;YACL,IAAI,WAAW,GAAG,WAAW,CAAC,WAAW,IAAI,GAAG,GAAG,WAAW,CAAC,WAAW,IAAI,EAAE,CAAC;YACjF,MAAM,CAAC,OAAO,CAAC,gBAAgB,GAAG,WAAW,CAAC,QAAQ,GAAG,WAAW,CAAC;YACrE,SAAS,6CAAuB;SACjC;QAED,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAC9C,eAAe,CAAC,OAAO,8CAAuB,SAAS,CAAC,CAAC;KAC1D;SAAM;QACL,eAAe,CAAC,OAAO,yDAA4B,SAAS,CAAC,CAAC;KAC/D;IAED,OAAO,MAAM,CAAC;CACf,CAAC;AAEF,IAAM,uBAAuB,GAAG,UAAC,MAAiB;IAChD,IAAI,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACvD,IAAI,gBAAgB,EAAE;QACpB,MAAM,CAAC,QAAQ,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;KACtE;SAAM,IAAI,MAAM,CAAC,aAAa,EAAE;QAC/B,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;KACzE;SAAM;QACL,MAAM,CAAC,KAAK,CAAC,wFAAwF,CAAC,CAAC;KACxG;CACF,CAAC;;ACzUF;;;AAGA,WAAkB,cAAc;IAC9B,yCAAuB,CAAA;IACvB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,qCAAmB,CAAA;CACpB,EALiBC,sBAAc,KAAdA,sBAAc,QAK/B;;ACRD;;;;AAIA,AACA,WAAkB,WAAW;IAC3B,0DAA2C,CAAA;IAC3C,gDAAiC,CAAA;IACjC,sDAAuC,CAAA;IACvC,sDAAuC,CAAA;IACvC,oDAAqC,CAAA;IACrC,iEAAkD,CAAA;CACnD,EAPiBC,mBAAW,KAAXA,mBAAW,QAO5B;;ACZD;;;AAGA,AACA,WAAkB,gBAAgB;;;;;IAKhC,2CAAuB,CAAA;;;;;;;;;IASvB,+CAA2B,CAAA;;;;;;;IAO3B,2CAAuB,CAAA;;;;IAIvB,6CAAyB,CAAA;CAC1B,EA1BiBC,wBAAgB,KAAhBA,wBAAgB,QA0BjC;;;;;;;;;;;;;;;;;;;;;;;;;AC9BD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACpMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,IAAI,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;AACO,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;AAChC,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,IAAI,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,EAAE;AAC3C,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AACzF,CAAC;AAwBD;AACO,SAAS,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE;AAC1D,IAAI,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;AACjI,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AACnI,SAAS,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;AACtJ,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAClE;;AClDA,IAAA,YAAA,IAAA,YAAA;AAUE,IAAA,SAAA,YAAA,CAAY,GAAgB,EAAA;AAN5B,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC/B,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAMhC,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;AAEf,QAAA,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AACjD,QAAA,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;AAC7D,QAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAC/C,QAAA,IAAI,CAAC,iBAAiB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AACrD,QAAA,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AACjD,QAAA,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AACjD,QAAA,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;AACnD,QAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAE/C,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAEzC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAEzC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QAEnD,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QAEpD,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;KAC3C;AAKD,IAAA,YAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,WAAmB,EAAE,aAAqB,EAAE,YAAoB,EAAA;AACvE,QAAA,WAAW,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;AACxC,QAAA,aAAa,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC;QAC5C,IAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACjG,QAAA,OAAO,CAAC,aAAa,CAAC,GAAG,YAAY,CAAC;KACvC,CAAA;AAKD,IAAA,YAAA,CAAA,SAAA,CAAA,iBAAiB,GAAjB,UAAkB,aAAqB,EAAE,YAAoB,EAAA;AAC3D,QAAA,aAAa,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC;AAC5C,QAAA,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,GAAG,YAAY,CAAC;KAChD,CAAA;AAKD,IAAA,YAAA,CAAA,SAAA,CAAA,GAAG,GAAH,UAAI,WAAmB,EAAE,aAAqB,EAAA;QAC5C,IAAI,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,WAAW,EAAE,aAAa,CAAC,EAAE;AAC/D,YAAA,OAAO,aAAa,CAAC;AACtB,SAAA;AACD,QAAA,WAAW,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;AACxC,QAAA,aAAa,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC;QAC5C,IAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC3C,QAAA,IAAI,OAAO,KAAK,SAAS,IAAI,aAAa,IAAI,OAAO,EAAE;AACrD,YAAA,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC;AAC/B,SAAA;AACD,QAAA,IAAI,aAAa,IAAI,IAAI,CAAC,WAAW,EAAE;AACrC,YAAA,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;AACxC,SAAA;AAED,QAAA,IAAI,yBAAyB,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE;AACjD,YAAA,OAAO,aAAa,CAAC;AACtB,SAAA;AACD,QAAA,OAAOC,wBAAS,CAAC,aAAa,CAAC,CAAC;KACjC,CAAA;AA/EM,IAAA,YAAA,CAAA,MAAM,GAAG,CAACC,0BAAW,CAAC,CAAC;IAgFhC,OAAC,YAAA,CAAA;AAAA,CAlFD,EAkFC;;ACtFD,IAAA,8BAAA,IAAA,YAAA;IA0BE,SACE,8BAAA,CAAA,eAAgC,EAChC,cAAsB,EACtB,KAA8B,EAC9B,IAAiB,EACjB,eAAgC,EAChC,SAAiB,EAAA;AAEjB,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;AACrC,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;AAC/C,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;KACvB;IAED,8BAAa,CAAA,SAAA,CAAA,aAAA,GAAb,UAAc,MAAM,EAAA;AAClB,QAAA,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AAC3B,YAAA,OAAO,IAAI,yBAAyB,CAClC,MAAM,EACN,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAe,EAC3B,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAW,EACvB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAW,CACxB,CAAC;AACH,SAAA;QACD,OAAO,IAAI,oBAAoB,CAC7B,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,KAAK,EACV,MAAM,EACN,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,eAAe,CACrB,CAAC;KACH,CAAA;IACH,OAAC,8BAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAED,SAAS,cAAc,CAAC,MAAM,EAAE,YAAY,EAAA;IAC1C,IAAI,YAAY,KAAK,OAAO,EAAE;AAC5B,QAAAC,qBAAU,CAAC,SAAS,CAAC,oBAAoB,CAAC;aACvC,IAAI,CAAC,2HAA2H,CAAC,CAAC;AACtI,KAAA;AAAM,SAAA,IAAI,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,CAAC,QAAQ,KAAK,UAAU,IAAI,YAAY,KAAK,aAAa,EAAE;AACjH,QAAA,MAAM,IAAI,KAAK,CAAC,wIAAwI,CAAC,CAAC;AAC3J,KAAA;AACH,CAAC;AAED,IAAA,oBAAA,IAAA,YAAA;IAoBE,SAAY,oBAAA,CAAA,eAAgC,EAAE,KAA8B,EAAE,MAAW,EAAE,cAAsB,EAAE,IAAiB,EAAE,eAAgC,EAAA;AACpK,QAAA,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AACvC,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,eAAe,CAAC,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAC1E,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;KACxC;AAED,IAAA,oBAAA,CAAA,SAAA,CAAA,WAAW,GAAX,YAAA;QACE,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,KAAK,GAAG,EAAE,CAAC;AACf,YAAA,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AACvB,YAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;gBAC9C,KAAK,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,cAAA,CAAA,MAAA,CAAe,CAAC,CAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AACpE,aAAA;AACD,YAAA,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;AACvE,SAAA;KACF,CAAA;AAED,IAAA,oBAAA,CAAA,SAAA,CAAA,qBAAqB,GAArB,YAAA;QACE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE;YACtD,IAAI,KAAK,GAAG,IAAI,CAAC,sBAAe,CAAC,CAAE,CAAC,CAAC;AACrC,YAAA,IAAI,KAAK,CAAC,IAAI,KAAKC,0BAAW,CAAC,OAAO,EAAE;gBACtC,KAAK,CAAC,IAAI,EAAE,CAAC;AACd,aAAA;AACF,SAAA;KACF,CAAA;IAED,oBAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,MAAM,EAAA;QACT,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC1B,OAAO;AACR,aAAA;YACD,IAAI,CAAC,MAAM,EAAE,CAAC;AACf,SAAA;AACD,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AAErB,QAAA,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AACvB,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE;YACjD,IAAI,OAAO,GAAG,IAAI,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC,CAAe,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AACjI,YAAA,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrB,YAAA,IAAI,CAAC,cAAe,CAAA,MAAA,CAAA,CAAC,CAAE,CAAC,GAAG,OAAO,CAAC;AACpC,SAAA;AAED,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,WAAW,EAAE,CAAC;KACpB,CAAA;AAED,IAAA,oBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;AACR,SAAA;AACD,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;AACnB,QAAA,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AACvB,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE;AACjD,YAAA,IAAI,MAAI,GAAG,cAAe,CAAA,MAAA,CAAA,CAAC,CAAE,CAAC;AAC9B,YAAA,IAAI,CAAC,MAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AACrB,SAAA;KACF,CAAA;IACH,OAAC,oBAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AASD,IAAA,yBAAA,IAAA,YAAA;AAmCE,IAAA,SAAA,yBAAA,CACE,MAA4B,EAC5B,eAAgC,EAChC,gBAA4B,EAC5B,IAAiB,EACjB,eAAgC,EAChC,cAAuB,EACvB,IAAa,EACb,KAAc,EAAA;QAEd,IAAI,MAAM,YAAY,oBAAoB,EAAE;AAC1C,YAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACtB,SAAA;AAAM,aAAA;AACL,YAAA,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AACvC,YAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,YAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;YACrC,IAAI,CAAC,cAAc,GAAG,eAAe,CAAC,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAC3E,SAAA;AACD,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AACzC,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;KACpB;IAED,yBAAY,CAAA,SAAA,CAAA,YAAA,GAAZ,UAAa,KAAK,EAAA;AAChB,QAAA,KAAK,GAAG,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,GAAG,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;AACtE,QAAA,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE;AACxB,YAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,IAAI,IAAI,CAAC,MAAM,EAAE;AACf,gBAAA,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;AAC3B,aAAA;AAAM,iBAAA;gBACL,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;AAChG,aAAA;AACF,SAAA;KACF,CAAA;AAED,IAAA,yBAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,YAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;AACR,SAAA;AAED,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AAClF,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAEjC,QAAA,IAAI,IAAI,CAAC,IAAI,KAAKA,0BAAW,CAAC,OAAO,EAAE;YACrC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AACjD,YAAA,IAAI,IAAI,CAAC,QAAQ,YAAY,KAAK,EAAE;AAClC,gBAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAClC,aAAA;AACD,YAAA,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACvB,SAAA;KACF,CAAA;IAED,yBAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,MAAM,EAAA;QACT,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC1B,OAAO;AACR,aAAA;YACD,IAAI,CAAC,MAAM,EAAE,CAAC;AACf,SAAA;AACD,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACpB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AAErB,QAAA,IAAI,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAC7C,IAAI,gBAAgB,CAAC,IAAI,EAAE;YACzB,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AAC3D,SAAA;AAED,QAAA,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AACxE,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAEjC,QAAA,IAAI,IAAI,CAAC,IAAI,KAAKA,0BAAW,CAAC,MAAM,EAAE;YACpCC,oCAAqB,CAAC,IAAI,CAAC,CAAC;AAC7B,SAAA;KACF,CAAA;AAED,IAAA,yBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;AACR,SAAA;AACD,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,QAAA,IAAI,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAC7C,IAAI,gBAAgB,CAAC,MAAM,EAAE;YAC3B,gBAAgB,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5C,SAAA;AACD,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;AACnB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AAClB,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;AACrB,QAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KACtB,CAAA;IAED,yBAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,QAAQ,EAAA;AACd,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;AACR,SAAA;AACD,QAAA,IAAI,QAAQ,EAAE;AACZ,YAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AAClF,YAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAClC,SAAA;QACD,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AACjD,QAAA,IAAI,IAAI,CAAC,QAAQ,YAAY,KAAK,EAAE;AAClC,YAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAClC,SAAA;KACF,CAAA;IA7IU,yBAAyB,GAAA,UAAA,CAAA;AADrC,QAAAC,0BAAW,EAAE;AACD,KAAA,EAAA,yBAAyB,CA8IrC,CAAA;IAAD,OAAC,yBAAA,CAAA;AAAA,CA9ID,EA8IC;;AC/SD,IAAA,aAAA,IAAA,YAAA;IAmBE,SAAY,aAAA,CAAA,eAAgC,EAAE,cAAsB,EAAE,gBAA4B,EAAE,eAAgC,EAAE,gBAAyB,EAAA;AAC7J,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AACzC,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;AACrC,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;KAC1C;AAED,IAAA,aAAA,CAAA,SAAA,CAAA,aAAa,GAAb,YAAA;QACE,OAAO,IAAI,UAAU,CACnB,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,gBAAgB,CACtB,CAAC;KACH,CAAA;IACH,OAAC,aAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAGD,IAAA,UAAA,IAAA,YAAA;IAiCE,SAAY,UAAA,CAAA,eAAgC,EAAE,gBAA4B,EAAE,cAAsB,EAAE,eAAgC,EAAE,gBAAyB,EAAA;AAC7J,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AACzC,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;AACrC,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;AACnB,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;AACnB,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;KAC1C;AAED,IAAA,UAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,YAAA;AACE,QAAA,IAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAChF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC;KAC1C,CAAA;IAED,UAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,OAAO,EAAA;AACV,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;AACR,SAAA;QACD,IAAI,OAAO,KAAKC,4BAAa,EAAE;YAC7B,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,OAAO;AACR,SAAA;AACD,QAAA,MAAM,IAAI,KAAK,CAAC,kCAA2B,OAAO,CAAE,CAAC,CAAC;KACvD,CAAA;IAKD,UAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,MAAM,EAAA;QACT,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC1B,OAAO;AACR,aAAA;YACD,IAAI,CAAC,MAAM,EAAE,CAAC;AACf,SAAA;AAED,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACpB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,eAAe,CAAC;AAErF,QAAA,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE;AAC9B,YAAA,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AAChE,SAAA;QAEDF,oCAAqB,CAAC,IAAI,CAAC,CAAC;KAC7B,CAAA;AAED,IAAA,UAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;AACR,SAAA;AACD,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,QAAA,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;YAChC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AACjD,SAAA;AACD,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;AACnB,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;AACnB,QAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KACtB,CAAA;IAGD,UAAS,CAAA,SAAA,CAAA,SAAA,GAAT,UAAU,IAAa,EAAA;AACrB,QAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C,CAAA;AAED,IAAA,UAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;AACR,SAAA;QACD,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;KAClD,CAAA;IAzGU,UAAU,GAAA,UAAA,CAAA;AADtB,QAAAC,0BAAW,EAAE;AACD,KAAA,EAAA,UAAU,CA0GtB,CAAA;IAAD,OAAC,UAAA,CAAA;AAAA,CA1GD,EA0GC;;ACrJD,IAAA,iCAAA,IAAA,YAAA;IAmBE,SAAY,iCAAA,CAAA,eAAgC,EAAE,cAAsB,EAAE,KAAe,EAAE,eAAgC,EAAE,gBAAyB,EAAA;AAChJ,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;AACrC,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;KAC1C;AAED,IAAA,iCAAA,CAAA,SAAA,CAAA,aAAa,GAAb,YAAA;QACE,OAAO,IAAI,uBAAuB,CAChC,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,gBAAgB,CACtB,CAAC;KACH,CAAA;IACH,OAAC,iCAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAED,IAAA,uBAAA,IAAA,YAAA;IAoCE,SAAY,uBAAA,CAAA,eAAgC,EAAE,cAAsB,EAAE,KAA8B,EAAE,eAAgC,EAAE,gBAAyB,EAAA;AAC/J,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;AACrC,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AACzC,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;KACpB;IAKD,uBAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,MAAM,EAAA;QACT,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC1B,OAAO;AACR,aAAA;YACD,IAAI,CAAC,MAAM,EAAE,CAAC;AACf,SAAA;AAED,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACpB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,eAAe,CAAC;AAErF,QAAA,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC;AAC9D,QAAA,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACxC,CAAA;AAED,IAAA,uBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;AACR,SAAA;AACD,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;AACnB,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;AACnB,QAAA,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC;AACnC,QAAA,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;KAClC,CAAA;AAED,IAAA,uBAAA,CAAA,SAAA,CAAA,0BAA0B,GAA1B,YAAA;AACE,QAAA,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,yBAAyB,CAClC,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,KAAK,CAAC,CAAC,CAA0B,EACtCF,0BAAW,CAAC,MAAM,EAClB,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAW,EACvB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAW,CACxB,CAAC;AACH,SAAA;QACD,OAAO,IAAI,oBAAoB,CAC7B,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,cAAc,EACnBA,0BAAW,CAAC,MAAM,EAClB,IAAI,CAAC,eAAe,CACrB,CAAC;KACH,CAAA;IACH,OAAC,uBAAA,CAAA;AAAD,CAAC,EAAA;;AC7HD,IAAA,iBAAA,IAAA,YAAA;AAkBE,IAAA,SAAA,iBAAA,CAAY,MAAc,EAAE,eAAgC,EAAE,YAA0B,EAAE,YAA0B,EAAA;AAClH,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;AACjC,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;KAClC;IAED,iBAAS,CAAA,SAAA,CAAA,SAAA,GAAT,UAAU,SAAwB,EAAE,OAAgB,EAAE,IAAmB,EAAE,mBAAyC,EAAE,OAA8B,EAAA;AAClJ,QAAA,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,EAAE;AACxB,YAAA,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAC;AACnF,SAAA;AAED,QAAA,OAAO,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAC;KAC1F,CAAA;IAGD,iBAAoB,CAAA,SAAA,CAAA,oBAAA,GAApB,UAAqB,SAAwB,EAAE,OAAgB,EAAE,IAAmB,EAAE,mBAAwC,EAAE,OAA6B,EAAA;AAC3J,QAAAD,qBAAU,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC;AAClF,QAAA,OAAO,mBAAmB,CAAC;KAC5B,CAAA;AAED,IAAA,iBAAA,CAAA,SAAA,CAAA,2BAA2B,GAA3B,UAA4B,OAAgB,EAAE,QAAgB,EAAE,OAA6B,EAAA;QAC3F,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAE5C,IAAI,OAAO,KAAK,OAAO,KAAK,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,OAAO,CAAC,IAAK,OAAe,CAAC,IAAI,KAAK,UAAU,IAAK,OAAe,CAAC,IAAI,KAAK,OAAO;AACjJ,eAAA,OAAO,KAAK,OAAO,IAAI,QAAQ,KAAK,SAAS,KAAM,OAAe,CAAC,IAAI,KAAK,UAAU,IAAK,OAAe,CAAC,IAAI,KAAK,OAAO,CAAC;eAC5H,CAAC,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,QAAQ,KAAK,QAAQ,KAAK,OAAO;AACxE,eAAA,CAAC,QAAQ,KAAK,aAAa,IAAI,QAAQ,KAAK,WAAW,KAAM,OAAuB,CAAC,eAAe,KAAK,MAAM;AAC/G,eAAA,QAAQ,KAAK,WAAW;eACxB,QAAQ,KAAK,YAAY,EAAE;YAC9B,OAAOC,0BAAW,CAAC,MAAM,CAAC;AAC3B,SAAA;AAED,QAAA,IAAI,OAAO;eACN,QAAQ,IAAI,OAAO,CAAC,UAAU;AAC9B,eAAA,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;eAC5B,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,kBAAkB,IAAIA,0BAAW,CAAC,OAAO,EAAE;YAC3E,OAAO,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,kBAAkB,CAAC;AACxD,SAAA;QAED,OAAOA,0BAAW,CAAC,MAAM,CAAC;KAC3B,CAAA;IAED,iBAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,SAAwB,EAAE,OAAgB,EAAE,IAAmB,EAAE,mBAAwC,EAAE,OAA6B,EAAA;AAC3I,QAAA,IAAI,WAAW,GAAG,mBAAmB,IAAII,qCAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEtF,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAIC,gCAAiB,CAC3D,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,EACrD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EACjC,IAAI,CAAC,kBAAkB,KAAK,SAAS,IAAI,IAAI,CAAC,kBAAkB,KAAK,IAAI;AACvE,cAAE,IAAI,CAAC,2BAA2B,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC;cACjE,IAAI,CAAC,kBAAkB,EAC3B,SAAS,CAAC,eAAe,CAC1B,CAAC;AAEF,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;AAED,IAAA,iBAAA,CAAA,SAAA,CAAA,OAAO,GAAP,UAAQ,SAAwB,EAAE,OAAY,EAAE,IAAmB,EAAA;AACjE,QAAA,OAAO,IAAIC,iCAAkB,CAC3B,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EACjCC,iCAAkB,CAAC,IAAI,EACvB,IAAI,EACJ,SAAS,CAAC,eAAe,CAC1B,CAAC;KACH,CAAA;AAED,IAAA,iBAAA,CAAA,SAAA,CAAA,OAAO,GAAP,UAAQ,SAAwB,EAAE,OAAY,EAAE,IAAmB,EAAA;AACjE,QAAA,OAAO,IAAID,iCAAkB,CAC3B,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EACjCC,iCAAkB,CAAC,SAAS,EAC5B,IAAI,EACJ,SAAS,CAAC,eAAe,CAC1B,CAAC;KACH,CAAA;AAED,IAAA,iBAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,SAAwB,EAAE,OAAY,EAAE,IAAmB,EAAA;AAClE,QAAA,OAAO,IAAID,iCAAkB,CAC3B,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EACjCC,iCAAkB,CAAC,QAAQ,EAC3B,IAAI,EACJ,SAAS,CAAC,eAAe,CAC1B,CAAC;KACH,CAAA;IAED,iBAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,SAAwB,EAAE,OAAY,EAAE,IAAmB,EAAE,mBAAwC,EAAA;AACxG,QAAA,IAAI,WAAW,GAAG,mBAAmB,IAAIH,qCAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAEtF,QAAA,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAII,6BAAc,CACxD,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EACjC,SAAS,CAAC,eAAe,CAC1B,CAAC;AAEF,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;IAED,iBAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,SAAwB,EAAE,OAAgB,EAAE,IAAmB,EAAE,mBAAwC,EAAE,OAA6B,EAAA;AAC9I,QAAA,IAAI,WAAW,GAAG,mBAAmB,IAAIJ,qCAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACtF,QAAA,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;AAC/B,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,IAAI,MAAM,GAAG,EAAE,CAAC;AAChB,QAAA,IAAI,OAAe,CAAC;AACpB,QAAA,IAAI,CAAS,CAAC;AACd,QAAA,IAAI,EAAU,CAAC;QACf,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC9C,YAAA,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAEvB,YAAA,IAAI,OAAO,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE;gBAChC,IAAI,CAAC,SAAS,EAAE;oBACd,IAAI,GAAG,IAAI,CAAC,uBAAuB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACzD,iBAAA;AACD,gBAAA,IAAI,GAAG,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AACtE,gBAAA,QAAQ,CAAC,0BAA0B,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;gBAEpF,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;oBAC1C,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;AACxD,iBAAA;gBAED,MAAM,GAAG,EAAE,CAAC;gBACZ,IAAI,GAAG,IAAI,CAAC;AACb,aAAA;AAAM,iBAAA,IAAI,OAAO,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,EAAE;gBAC3C,SAAS,GAAG,IAAI,CAAC;AACjB,gBAAA,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;gBACrB,MAAM,GAAG,EAAE,CAAC;AACb,aAAA;iBAAM,IAAI,OAAO,KAAK,IAAI,EAAE;gBAC3B,MAAM,IAAI,OAAO,CAAC;gBAClB,QAAQ,GAAG,IAAI,CAAC;gBAChB,SAAS;AACV,aAAA;AAAM,iBAAA;gBACL,MAAM,IAAI,OAAO,CAAC;gBAElB,IAAI,IAAI,KAAK,IAAI,IAAI,QAAQ,KAAK,KAAK,IAAI,OAAO,KAAK,IAAI,EAAE;oBAC3D,QAAQ,GAAG,CAAC,QAAQ,CAAC;AACtB,iBAAA;AACF,aAAA;YAED,QAAQ,GAAG,KAAK,CAAC;AAClB,SAAA;QAKD,IAAI,CAAC,SAAS,EAAE;YACd,IAAI,GAAG,IAAI,CAAC,uBAAuB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACzD,SAAA;QAED,IAAI,IAAI,KAAK,IAAI,EAAE;AACjB,YAAA,IAAI,GAAG,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AACtE,YAAA,QAAQ,CAAC,0BAA0B,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;YAEpF,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAC1C,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;AACxD,aAAA;AACF,SAAA;AAED,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;AAGD,IAAA,iBAAA,CAAA,SAAA,CAAA,uBAAuB,GAAvB,UAAwB,SAAgD,EAAE,OAA6B,EAAA;QACrG,IAAI,IAAI,GAAG,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AACzD,QAAA,IAAI,IAAI,IAAI,IAAI,CAAC,eAAe,EAAE;AAChC,YAAA,OAAO,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC;AACvC,SAAA;AACD,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;IAED,iBAAK,CAAA,SAAA,CAAA,KAAA,CAAA,GAAL,UAAM,SAAwB,EAAE,OAAgB,EAAE,IAAmB,EAAE,mBAAwC,EAAA;AAC7G,QAAA,IAAI,KAAqB,CAAC;AAC1B,QAAA,IAAI,QAAe,CAAC;AACpB,QAAA,IAAI,WAAsE,CAAC;AAC3E,QAAA,IAAI,SAAiB,CAAC;AACtB,QAAA,IAAI,eAAoB,CAAC;AAEzB,QAAA,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;AAC3B,QAAA,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAClD,KAAK,GAAG,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE3E,QAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CAAC,4FAA4F,CAAC,CAAC;AAC/G,SAAA;QAED,WAAW,GAAG,mBAAmB,IAAIA,qCAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAElF,QAAA,IAAI,eAAe,EAAE;AACnB,YAAA,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACpG,WAAW,CAAC,UAAU,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YACzC,WAAW,CAAC,UAAU,CAAC,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC5C,SAAA;AAAM,aAAA;YACL,WAAW,CAAC,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACzC,SAAA;AAED,QAAA,WAAW,CAAC,UAAU,CAAC,KAAK,GAAG,IAAIC,gCAAiB,CAClD,IAAI,CAAC,eAAe,EACpB,OAAO,EACP,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAC3BL,0BAAW,CAAC,MAAM,EAClB,SAAS,CAAC,eAAe,CAC1B,CAAC;AAEF,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;IAED,iBAAS,CAAA,SAAA,CAAA,SAAA,CAAA,GAAT,UAAU,SAAwB,EAAE,OAAgB,EAAE,IAAmB,EAAE,mBAAwC,EAAA;AACjH,QAAA,IAAI,WAAW,GAAG,mBAAmB,IAAII,qCAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEtF,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAIC,gCAAiB,CAC3D,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,EACrD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EACjCL,0BAAW,CAAC,MAAM,EAClB,SAAS,CAAC,eAAe,CAC1B,CAAC;AAEF,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;IAED,iBAAS,CAAA,SAAA,CAAA,SAAA,CAAA,GAAT,UAAU,SAAwB,EAAE,OAAgB,EAAE,IAAmB,EAAE,mBAAwC,EAAA;AACjH,QAAA,IAAI,WAAW,GAAG,mBAAmB,IAAII,qCAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEtF,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAIC,gCAAiB,CAC3D,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,EACrD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EACjCL,0BAAW,CAAC,MAAM,EAClB,SAAS,CAAC,eAAe,CAC1B,CAAC;AAEF,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;IAED,iBAAW,CAAA,SAAA,CAAA,WAAA,CAAA,GAAX,UAAY,SAAwB,EAAE,OAAgB,EAAE,IAAmB,EAAE,mBAAwC,EAAA;AACnH,QAAA,IAAI,WAAW,GAAG,mBAAmB,IAAII,qCAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEtF,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAIC,gCAAiB,CAC3D,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,EACrD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EACjCL,0BAAW,CAAC,QAAQ,EACpB,SAAS,CAAC,eAAe,CAC1B,CAAC;AAEF,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;IAED,iBAAU,CAAA,SAAA,CAAA,UAAA,CAAA,GAAV,UAAW,SAAwB,EAAE,OAAgB,EAAE,IAAmB,EAAE,mBAAwC,EAAA;AAClH,QAAA,IAAI,WAAW,GAAG,mBAAmB,IAAII,qCAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEtF,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAIC,gCAAiB,CAC3D,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,EACrD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EACjCL,0BAAW,CAAC,OAAO,EACnB,SAAS,CAAC,eAAe,CAC1B,CAAC;AAEF,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;IA/RM,iBAAM,CAAA,MAAA,GAAG,CAACS,qBAAM,EAAEC,8BAAe,EAAEC,2BAAY,EAAE,YAAY,CAAC,CAAC;IAgSxE,OAAC,iBAAA,CAAA;AAAA,CAlSD,EAkSC,EAAA;AAED,MAAM,CAAC,cAAc,CAAC,iBAAiB,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;;AC1StI,IAAI,IAAI,GAAkB,EAAE,CAAC;AAE7B,IAAA,yBAAA,IAAA,UAAA,MAAA,EAAA;IAA+C,SAAe,CAAA,yBAAA,EAAA,MAAA,CAAA,CAAA;AAiB5D,IAAA,SAAA,yBAAA,CAAY,MAAc,EAAE,eAAgC,EAAE,iBAAoC,EAAE,YAA0B,EAAA;AAA9H,QAAA,IAAA,KAAA,GACE,iBAAO,IAQR,IAAA,CAAA;AAPC,QAAA,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,KAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,KAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,KAAI,CAAC,qBAAqB,GAAG,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACvD,QAAA,iBAAiB,CAAC,QAAQ,GAAG,KAAI,CAAC;AAClC,QAAA,KAAI,CAAC,YAAY,GAAG,YAAY,CAAC;AACjC,QAAA,KAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;;KAClD;IAED,yBAAgB,CAAA,SAAA,CAAA,gBAAA,GAAhB,UAAiB,SAAwB,EAAE,WAAmB,EAAE,QAAgB,EAAE,SAAiB,EAAA;QACjG,IAAI,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAEhC,QAAA,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;AAE/B,QAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAChC,YAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;YAC3B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAE/B,YAAA,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,EAAE;gBAC1B,IAAI,CAAC,UAAU,GAAG,IAAIC,6BAAc,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;AAC7G,gBAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACpB,gBAAA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;AACvB,aAAA;AAAM,iBAAA;AACL,gBAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AACxB,aAAA;AACF,SAAA;aAAM,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC7B,YAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,YAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,YAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,CAAC,UAAU,GAAG,IAAIA,6BAAc,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;AAC1G,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,YAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,YAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAM,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACzE,IAAI,kBAAkB,KAAK,IAAI,EAAE;AAC/B,gBAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AACxB,aAAA;AAAM,iBAAA;AACL,gBAAA,IAAI,CAAC,UAAU,GAAG,IAAI,8BAA8B,CAClD,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,EAC5C,kBAAkB,EAClBZ,0BAAW,CAAC,MAAM,EAClB,SAAS,CAAC,eAAe,EACzB,QAAQ,CACT,CAAC;AACH,aAAA;AACF,SAAA;AAED,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;IAGD,yBAA0B,CAAA,SAAA,CAAA,0BAAA,GAA1B,UAA2B,SAAwB,EAAE,OAAgB,EAAE,OAAsB,EAAE,mBAAwC,EAAE,OAA6B,EAAA;AACpK,QAAA,IAAI,WAAW,CAAC;QAEhB,IAAI,OAAO,CAAC,UAAU,EAAE;AACtB,YAAA,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE;gBAC9B,OAAO,OAAO,CAAC,UAAU,CAAC;AAC3B,aAAA;YAED,WAAW,GAAG,mBAAmB,IAAII,qCAAmB,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACrF,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;AAC/D,SAAA;aAAM,IAAI,OAAO,CAAC,OAAO,EAAE;AAC1B,YAAA,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAC5C,SAAS,EACT,OAAO,EACP,OAAO,EACP,mBAAmB,EACnB,OAAO,CAAC,CAAC;AACZ,SAAA;AAED,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;AAED,IAAA,yBAAA,CAAA,SAAA,CAAA,oBAAoB,GAApB,UAAqB,SAAwB,EAAE,UAAmB,EAAA;QAChE,IAAI,WAAW,GAAG,EAAE,CAAC;AACrB,QAAA,IAAI,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;AACvC,QAAA,IAAI,IAAU,CAAC;AACf,QAAA,IAAI,KAAe,CAAC;AACpB,QAAA,IAAI,QAAgB,CAAC;AACrB,QAAA,IAAI,SAAiB,CAAC;AACtB,QAAA,IAAI,OAAe,CAAC;AACpB,QAAA,IAAI,oBAAoB,GAAG,IAAI,CAAC,oBAAoB,CAAC;QACrD,IAAI,gBAAgB,GAAG,UAAU,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;AACrE,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;AACnD,YAAA,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AACrB,YAAA,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;AACrB,YAAA,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;AAC3B,YAAA,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAE5B,IAAI,QAAQ,KAAK,oBAAoB,EAAE;gBACrC,SAAS;AACV,aAAA;AAED,YAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AACtB,gBAAA,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBACnB,IAAI,OAAO,KAAK,MAAM,EAAE;AACtB,oBAAAL,qBAAU,CAAC,SAAS,CAAC,6BAA6B,CAAC;yBAChD,IAAI,CAAC,2CAA2C,CAAA,MAAA,CAAA,KAAK,CAAC,CAAC,CAAC,EAAkB,mBAAA,CAAA,CAAA,MAAA,CAAA,QAAQ,EAAG,IAAA,CAAA,CAAC,CAAC;oBAC1F,SAAS;AACV,iBAAA;AACD,gBAAA,WAAW,CAAC,IAAI,CAAC,IAAI,aAAa,CAChC,IAAI,CAAC,eAAe,EACpBF,wBAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACnB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAC5B,SAAS,CAAC,eAAe,EACzB,gBAAgB,CACjB,CAAC,CAAC;AACJ,aAAA;AAAM,iBAAA;AACL,gBAAA,QAAQ,GAAGA,wBAAS,CAAC,QAAQ,CAAC,CAAC;gBAC/B,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;gBACtD,IAAI,KAAK,KAAK,IAAI,EAAE;AAClB,oBAAAE,qBAAU,CAAC,SAAS,CAAC,6BAA6B,CAAC;yBAChD,IAAI,CAAC,0DAA2D,CAAA,MAAA,CAAA,QAAQ,EAAW,QAAA,CAAA,CAAA,MAAA,CAAA,SAAS,EAAW,UAAA,CAAA,CAAA,MAAA,CAAA,QAAQ,EAAS,KAAA,CAAA,CAAA,MAAA,CAAA,SAAS,EAAO,OAAA,CAAA,CAAC,CAAC;AAC9I,iBAAA;AACD,gBAAA,IAAI,KAAK,EAAE;oBACT,WAAW,CAAC,IAAI,CAAC,IAAI,iCAAiC,CACpD,IAAI,CAAC,eAAe,EACpB,QAAQ,EACR,KAAK,EACL,SAAS,CAAC,eAAe,EACzB,gBAAgB,CACjB,CAAC,CAAC;AACJ,iBAAA;AAAM,qBAAA;oBACL,WAAW,CAAC,IAAI,CAAC,IAAI,aAAa,CAChC,IAAI,CAAC,eAAe,EACpB,QAAQ,EACR,IAAIc,4BAAa,CAAC,SAAS,CAAC,EAC5B,SAAS,CAAC,eAAe,EACzB,gBAAgB,CACjB,CAAC,CAAC;AACJ,iBAAA;AACF,aAAA;AACF,SAAA;AACD,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;AAED,IAAA,yBAAA,CAAA,SAAA,CAAA,kBAAkB,GAAlB,UAAmB,SAAwB,EAAE,KAAa,EAAA;QACxD,IAAM,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACxD,IAAI,KAAK,KAAK,IAAI,EAAE;AAClB,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;QACD,OAAO,IAAI,8BAA8B,CACvC,IAAI,CAAC,eAAe,EACpB,aAAa,EACb,KAAK,EACLb,0BAAW,CAAC,MAAM,EAClB,SAAS,CAAC,eAAe,EACzB,aAAa,CACd,CAAC;KACH,CAAA;AAED,IAAA,yBAAA,CAAA,SAAA,CAAA,kBAAkB,GAAlB,UAAmB,SAAwB,EAAE,KAAa,EAAA;QACxD,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/B,QAAA,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;AACtB,QAAA,IAAI,IAAI,CAAC;QACT,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,IAAI,KAAK,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,kBAAkB,CAAC;AACvB,QAAA,IAAI,KAAK,CAAC;QACV,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE;YAC3B,IAAI,GAAG,CAAC,CAAC;YACT,kBAAkB,GAAG,CAAC,CAAC;YACvB,CAAC,IAAI,CAAC,CAAC;YAEP,GAAG;AACD,gBAAA,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAChB,gBAAA,CAAC,EAAE,CAAC;AAEJ,gBAAA,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,EAAE;oBAChC,IAAI,KAAK,KAAK,IAAI,EAAE;wBAClB,KAAK,GAAG,IAAI,CAAC;AACd,qBAAA;yBAAM,IAAI,KAAK,KAAK,IAAI,EAAE;wBACzB,KAAK,GAAG,IAAI,CAAC;AACd,qBAAA;oBACD,SAAS;AACV,iBAAA;gBAED,IAAI,IAAI,KAAK,IAAI,EAAE;AACjB,oBAAA,CAAC,EAAE,CAAC;oBACJ,SAAS;AACV,iBAAA;gBAED,IAAI,KAAK,KAAK,IAAI,EAAE;oBAClB,SAAS;AACV,iBAAA;gBAED,IAAI,IAAI,KAAK,GAAG,EAAE;AAChB,oBAAA,IAAI,EAAE,CAAC;AACR,iBAAA;qBAAM,IAAI,IAAI,KAAK,GAAG,EAAE;AACvB,oBAAA,IAAI,EAAE,CAAC;AACR,iBAAA;AACF,aAAA,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE;YAE7B,IAAI,IAAI,KAAK,CAAC,EAAE;AAEd,gBAAA,KAAK,GAAG,KAAK,IAAI,EAAE,CAAC;AACpB,gBAAA,IAAI,KAAK,CAAC,kBAAkB,GAAG,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,kBAAkB,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE;oBAEpF,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,kBAAkB,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;AACzG,oBAAA,SAAS,EAAE,CAAC;AACZ,oBAAA,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC;AAC9C,oBAAA,SAAS,EAAE,CAAC;AACb,iBAAA;AAAM,qBAAA;AAEL,oBAAA,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;AAC5D,oBAAA,SAAS,EAAE,CAAC;oBACZ,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,kBAAkB,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACrF,oBAAA,SAAS,EAAE,CAAC;AACb,iBAAA;gBACD,GAAG,GAAG,CAAC,CAAC;gBACR,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAC5B,aAAA;AAAM,iBAAA;gBACL,MAAM;AACP,aAAA;AACF,SAAA;QAGD,IAAI,SAAS,KAAK,CAAC,EAAE;AACnB,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;QAGD,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACrC,QAAA,OAAO,KAAK,CAAC;KACd,CAAA;IAvPM,yBAAM,CAAA,MAAA,GAAG,CAACS,qBAAM,EAAEC,8BAAe,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAC;IAwP7E,OAAC,yBAAA,CAAA;CAAA,CA1P8C1B,iCAAe,CA0P7D;;ACnQK,SAAU,SAAS,CAAC,MAAM,EAAA;IAC9B,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAACA,iCAAe,EAAE,yBAAyB,CAAC,CAAC;IAC/E,MAAM,CAAC,SAAS,CAAC,aAAa,CAACA,iCAAe,EAAE,yBAAyB,CAAC,CAAC;AAC7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1G,IAAI,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;AACO,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;AAChC,IAAI,IAAI,OAAO,CAAC,KAAK,UAAU,IAAI,CAAC,KAAK,IAAI;AAC7C,QAAQ,MAAM,IAAI,SAAS,CAAC,sBAAsB,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,+BAA+B,CAAC,CAAC;AAClG,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,IAAI,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,EAAE;AAC3C,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AACzF,CAAC;AAwBD;AACO,SAAS,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE;AAC1D,IAAI,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;AACjI,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AACnI,SAAS,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;AACtJ,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAClE;;AChDA,IAAY,kBASX,CAAA;AATD,CAAA,UAAY,kBAAkB,EAAA;AAI5B,IAAA,kBAAA,CAAA,iBAAA,CAAA,GAAA,kBAAoC,CAAA;AAIpC,IAAA,kBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EATW,kBAAkB,KAAlB,kBAAkB,GAS7B,EAAA,CAAA,CAAA,CAAA;AAOD,IAAA,OAAA,IAAA,YAAA;IAgHE,SAAY,OAAA,CAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAA;AA5E3E,QAAA,IAAA,CAAA,kBAAkB,GAAuB,kBAAkB,CAAC,eAAe,CAAC;AA6EpF,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AAC3C,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;AACnC,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;AAC9B,QAAA,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACpC;AAvHM,IAAA,OAAA,CAAA,MAAM,GAAb,YAAA;AACE,QAAA,OAAO,CAACJ,cAAG,CAAC,OAAO,EAAEC,oCAAS,EAAEiC,mCAAiB,EAAE1B,0BAAQ,EAAEN,+BAAa,EAAEiC,0BAAS,CAAC,CAAC;KACxF,CAAA;IA4HD,OAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,UAAgB,EAAA;AACtB,QAAA,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;KAC9B,CAAA;AAQD,IAAA,OAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,cAAc,EAAE,eAAe,EAAA;AAClC,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;AACrC,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAC3B,QAAA,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AACzB,QAAA,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;AACnC,QAAA,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AAC3B,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,cAAc,CAAC,IAAI,CAAC,CAAC;AACtB,SAAA;KACF,CAAA;AAKD,IAAA,OAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;QACE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACnC,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AAC3B,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,aAAa,GAAG,IAAI,CAAC;QACzB,IAAI,aAAa,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;KACvD,CAAA;AAQD,IAAA,OAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,UAAa,QAAQ,EAAE,QAAQ,EAAA;AAC7B,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;QAC9B,aAAa,CAAC,IAAI,CAAC,CAAC;KACrB,CAAA;AAQD,IAAA,OAAA,CAAA,SAAA,CAAA,WAAW,GAAX,UAAY,QAAQ,EAAE,QAAQ,EAAA;AAC5B,QAAA,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC;QAC7B,aAAa,CAAC,IAAI,CAAC,CAAC;KACrB,CAAA;AAQD,IAAA,OAAA,CAAA,SAAA,CAAA,gBAAgB,GAAhB,UAAiB,QAAQ,EAAE,QAAQ,EAAA;AACjC,QAAA,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,QAAQ,CAAC;QAClC,aAAa,CAAC,IAAI,CAAC,CAAC;KACrB,CAAA;AArLS,IAAA,UAAA,CAAA;QAATC,0BAAQ;AAAY,KAAA,EAAA,OAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAOX,IAAA,UAAA,CAAA;QAATA,0BAAQ;AAAW,KAAA,EAAA,OAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAOV,IAAA,UAAA,CAAA;QAATA,0BAAQ;AAAgB,KAAA,EAAA,OAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AASf,IAAA,UAAA,CAAA;QAATA,0BAAQ;AAA6E,KAAA,EAAA,OAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAQ5E,IAAA,UAAA,CAAA;QAATA,0BAAQ;AAAgB,KAAA,EAAA,OAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IA5Cd,OAAO,GAAA,UAAA,CAAA;QAFnBC,wBAAM;QACNC,+BAAa,CAAC,SAAS,CAAC;AACZ,KAAA,EAAA,OAAO,CAmMnB,CAAA;IAAD,OAAC,OAAA,CAAA;AAAA,CAnMD,EAmMC,EAAA;AAED,SAAS,OAAO,CAAC,GAAG,EAAA;AAClB,IAAA,KAAK,IAAM,CAAC,IAAI,GAAG,EAAE;AACnB,QAAA,OAAO,KAAK,CAAC;AACd,KAAA;AACD,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,oBAAoB,CAAC,EAAE,EAAE,KAAK,EAAA;IACrC,IAAI,EAAE,IAAI,OAAO,EAAE,CAAC,QAAQ,KAAK,UAAU,EAAE;QAC3C,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5C,KAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAiB,EAAE,WAA+B,EAAA;AAC3E,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;QAChC,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,eAAe,EAAE,QAAQ,CAAC,eAAe;QACzC,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,aAAa,EAAE,QAAQ,CAAC,aAAa;QACrC,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB;QAC7C,IAAI,EAAE,QAAQ,CAAC,OAAO;QACtB,SAAS,EAAE,QAAQ,CAAC,SAAS;AAC9B,KAAA,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,QAAiB,EAAA;AACvC,IAAA,IAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;IACjC,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAEvC,IAAA,IAAI,qBAAqB,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE;AAE5C,QAAA,IAAI,WAAW,GAAG;YAChB,IAAI,EAAE,QAAQ,CAAC,IAAI;AACnB,YAAA,SAAS,EAAE,QAAQ,CAAC,gBAAgB,IAAI,QAAQ,CAAC,SAAS;YAC1D,KAAK,EAAE,QAAQ,CAAC,KAAK;SACA,CAAC;QAGxB,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAGlD,QAAA,WAAW,GAAG,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAEvD,QAAA,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,UAAA,UAAU,EAAA;AACpF,YAAA,QAAQ,CAAC,iBAAiB,GAAG,UAAU,CAAC;AACxC,YAAA,QAAQ,CAAC,gBAAgB,GAAG,UAAU,GAAG,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC;AACvE,SAAC,CAAC,CAAC;AACJ,KAAA;AAAM,SAAA;AAEL,QAAA,QAAQ,CAAC,WAAW,GAAG,oBAAoB,CAAC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AACtF,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE;YAAE,OAAO;AAAE,SAAA;AACvC,KAAA;AAED,IAAA,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW;AACxC,SAAA,IAAI,CAAC,YAAA;QACJ,uBAAuB,CAAC,QAAQ,CAAC,CAAC;KACnC,EAAE,UAAA,MAAM,EAAA;QACP,uBAAuB,CAAC,QAAQ,CAAC,CAAC;AAClC,QAAA,MAAM,MAAM,CAAC;AACf,KAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,uBAAuB,CAAC,QAAQ,EAAA;AACvC,IAAA,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC;AAC5B,IAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAC9B,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC1B,KAAA;AACH,CAAC;AAED,SAAS,aAAa,CAAC,QAAiB,EAAA;AACtC,IAAA,IAAI,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,eAAe,EAAE;QAAE,OAAO;AAAE,KAAA;AACjE,IAAA,QAAQ,CAAC,eAAe,GAAG,IAAI,CAAC;AAChC,IAAA,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,YAAA;AAChC,QAAA,QAAQ,CAAC,eAAe,GAAG,KAAK,CAAC;QACjC,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC3B,KAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,QAAiB,EAAE,OAAY,EAAA;AAC5D,IAAA,IAAI,kBAAkB,GAAG,QAAQ,CAAC,kBAAkB,CAAC;AACrD,IAAA,IAAM,EAAE,GAAG,QAAQ,CAAC,gBAAgB,CAAC;IACrC,IAAI,EAAE,IAAI,OAAO,EAAE,CAAC,2BAA2B,KAAK,UAAU,EAAE;AAC9D,QAAA,kBAAkB,GAAG,EAAE,CAAC,2BAA2B,EAAE,CAAC;AACvD,KAAA;IAED,OAAO,MAAM,IAAI,OAAO;AACnB,WAAA,WAAW,IAAI,OAAO;AACtB,WAAA,kBAAkB,KAAK,kBAAkB,CAAC,OAAO,CAAC;AACzD;;ACrTA,IAAA,MAAA,IAAA,YAAA;IA8BE,SAAY,MAAA,CAAA,WAAwB,EAAE,QAAkB,EAAA;AACtD,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AAC3B,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;AAI5B,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;KACnB;AAED,IAAA,MAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,cAAc,EAAE,eAAe,EAAA;AAElC,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;AACrC,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;KACxC,CAAA;AAED,IAAA,MAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;YACtB,OAAO;AACR,SAAA;AAED,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;AAKnB,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE;YAC/B,OAAO;AACR,SAAA;QAED,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,YAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAoB,IAAI,EAAoB,IAAI,CAAC,CAAC;AACjF,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;AAC3B,SAAA;AAED,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB,CAAA;AAKD,IAAA,MAAA,CAAA,SAAA,CAAA,KAAK,GAAL,YAAA;QACE,IAAI,IAAI,CAAC,OAAO,EAAE;AAIhB,YAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;AACtB,gBAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AAC3D,aAAA;YACD,OAAO;AACR,SAAA;AAED,QAAA,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;YACtB,IAAI,CAAC,IAAI,GAAI,IAAI,CAAC,WAAmB,CAAC,MAAM,EAAE,CAAC;AAChD,SAAA;AAED,QAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;AACtB,YAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AAC3D,SAAA;AAED,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACrC,CAAA;AAKD,IAAA,MAAA,CAAA,SAAA,CAAA,KAAK,GAAL,YAAA;QAAA,IAeC,KAAA,GAAA,IAAA,CAAA;AAdC,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;AACR,SAAA;AAED,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,QAAA,IAAI,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,OAAO,YAAY,OAAO,EAAE;YAC9B,OAAO,OAAO,CAAC,IAAI,CAAC,YAAA;gBAClB,KAAI,CAAC,WAAW,EAAE,CAAC;AACrB,aAAC,CAAC,CAAC;AACJ,SAAA;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;KACpB,CAAA;AAKD,IAAA,MAAA,CAAA,SAAA,CAAA,WAAW,GAAX,YAAA;AACE,QAAA,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,KAAK,OAAO,GAAG,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;AAC5D,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACnB,IAAI,CAAC,KAAK,EAAE;AACV,YAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AAClB,SAAA;KACF,CAAA;IACH,OAAC,MAAA,CAAA;AAAD,CAAC,EAAA,CAAA;;AC3HD,IAAA,EAAA,IAAA,UAAA,MAAA,EAAA;IAAwB,SAAM,CAAA,EAAA,EAAA,MAAA,CAAA,CAAA;AAA9B,IAAA,SAAA,EAAA,GAAA;QAAA,IAwEC,KAAA,GAAA,MAAA,KAAA,IAAA,IAAA,MAAA,CAAA,KAAA,CAAA,IAAA,EAAA,SAAA,CAAA,IAAA,IAAA,CAAA;QArEW,KAAK,CAAA,KAAA,GAAmB,IAAI,CAAC;;KAqExC;AAzDC,IAAA,EAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,cAAc,EAAE,eAAe,EAAA;AAClC,QAAA,MAAA,CAAA,SAAA,CAAM,IAAI,CAAC,IAAA,CAAA,IAAA,EAAA,cAAc,EAAE,eAAe,CAAC,CAAC;QAC5C,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,CAAC,KAAK,EAAE,CAAC;AACd,SAAA;AAAM,aAAA;YACL,IAAI,CAAC,KAAK,EAAE,CAAC;AACd,SAAA;KACF,CAAA;IAMD,EAAgB,CAAA,SAAA,CAAA,gBAAA,GAAhB,UAAiB,QAAQ,EAAA;AACvB,QAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;KACxB,CAAA;IAKD,EAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,IAAI,EAAA;QAAZ,IAqBC,KAAA,GAAA,IAAA,CAAA;QApBC,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,OAAO;AACR,SAAA;AAED,QAAA,IAAI,OAAO,CAAC;QACZ,IAAI,IAAI,CAAC,MAAM,EAAE;AACf,YAAA,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AAChF,SAAA;AAAM,aAAA;AACL,YAAA,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;AAC9C,SAAA;AAED,QAAA,IAAI,OAAO,EAAE;AACX,YAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,OAAO,CAAC,IAAI,CAAC,YAAA;AACX,gBAAA,KAAI,CAAC,SAAS,GAAG,KAAK,CAAC;AACvB,gBAAA,IAAI,KAAI,CAAC,SAAS,KAAK,KAAI,CAAC,OAAO,EAAE;AACnC,oBAAA,KAAI,CAAC,OAAO,CAAC,KAAI,CAAC,SAAS,CAAC,CAAC;AAC9B,iBAAA;AACH,aAAC,CAAC,CAAC;AACJ,SAAA;KACF,CAAA;AAKD,IAAA,EAAA,CAAA,SAAA,CAAA,KAAK,GAAL,UAAM,MAAM,EAAE,GAAG,EAAA;QACf,QAAQ,IAAI,CAAC,SAAS;AACtB,YAAA,KAAK,QAAQ;gBACX,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,YAAA,EAAM,OAAA,MAAM,CAAC,KAAK,EAAE,CAAA,EAAA,CAAC,CAAC;AACjE,YAAA,KAAK,MAAM;AACT,gBAAA,OAAO,OAAO,CAAC,GAAG,CAAC,CAAE,MAAM,CAAC,KAAK,EAAE,EAAE,GAAG,CAAC,KAAK,EAAE,CAAE,CAAC,CAAC;AACtD,YAAA;AACE,gBAAA,IAAI,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;gBAC7B,OAAO,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,YAAM,EAAA,OAAA,GAAG,CAAC,KAAK,EAAE,CAAA,EAAA,CAAC,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;AAChE,SAAA;KACF,CAAA;AAtEoC,IAAA,UAAA,CAAA;AAApC,QAAAF,0BAAQ,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;AAAgB,KAAA,EAAA,EAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAC1C,IAAA,UAAA,CAAA;QAATA,0BAAQ;AAAoC,KAAA,EAAA,EAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AACnC,IAAA,UAAA,CAAA;QAATA,0BAAQ;AAA8B,KAAA,EAAA,EAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAH5B,EAAE,GAAA,UAAA,CAAA;QAHdG,iCAAe,CAAC,IAAI,CAAC;QACrBC,oCAAkB;AAClB,QAAAC,iCAAM,CAACC,kCAAgB,EAAElC,0BAAQ,CAAC;AACtB,KAAA,EAAA,EAAE,CAwEd,CAAA;IAAD,OAAC,EAAA,CAAA;CAAA,CAxEuB,MAAM,CAwE7B;;AC5ED,IAAA,IAAA,IAAA,UAAA,MAAA,EAAA;IAA0B,SAAM,CAAA,IAAA,EAAA,MAAA,CAAA,CAAA;IAO9B,SAAY,IAAA,CAAA,WAAW,EAAE,QAAQ,EAAA;AAAjC,QAAA,IAAA,KAAA,GACE,MAAM,CAAA,IAAA,CAAA,IAAA,EAAA,WAAW,EAAE,QAAQ,CAAC,IAE7B,IAAA,CAAA;QADC,KAAI,CAAC,aAAa,EAAE,CAAC;;KACtB;AAED,IAAA,IAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,cAAc,EAAE,eAAe,EAAA;AAClC,QAAA,MAAA,CAAA,SAAA,CAAM,IAAI,CAAC,IAAA,CAAA,IAAA,EAAA,cAAc,EAAE,eAAe,CAAC,CAAC;AAE5C,QAAA,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACvB,IAAI,CAAC,KAAK,EAAE,CAAC;AACd,SAAA;AAAM,aAAA;YACL,IAAI,CAAC,KAAK,EAAE,CAAC;AACd,SAAA;KACF,CAAA;AAKD,IAAA,IAAA,CAAA,SAAA,CAAA,aAAa,GAAb,YAAA;QAME,IAAI,QAAQ,GAAI,IAAI,CAAC,QAAsC,CAAC,MAAM,CAAC,eAAe,CAAC;AACnF,QAAA,OAAO,QAAQ,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;AAC/B,YAAA,QAAQ,GAAG,QAAQ,CAAC,eAAe,CAAC;AACrC,SAAA;QACD,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE;AAChC,YAAA,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;AACtE,SAAA;QACD,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;AACrC,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;KACzB,CAAA;IAxCU,IAAI,GAAA,UAAA,CAAA;QAHhB+B,iCAAe,CAAC,MAAM,CAAC;QACvBC,oCAAkB;AAClB,QAAAC,iCAAM,CAACC,kCAAgB,EAAElC,0BAAQ,CAAC;AACtB,KAAA,EAAA,IAAI,CAyChB,CAAA;IAAD,OAAC,IAAA,CAAA;CAAA,CAzCyB,MAAM,CAyC/B;;ACtCD,IAAA,IAAA,IAAA,YAAA;IAkBE,SAAY,IAAA,CAAA,WAAwB,EAAE,QAAkB,EAAA;AACtD,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;AAClC,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;AAOD,IAAA,IAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,cAAc,EAAE,eAAe,EAAA;AAClC,QAAA,IAAI,CAAC,qBAAqB,GAAG,eAAe,CAAC;AAC7C,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC/B,CAAA;IAMD,IAAY,CAAA,SAAA,CAAA,YAAA,GAAZ,UAAa,QAAQ,EAAA;QACnB,IAAI,eAAe,GAAGmC,oCAAqB,CAAC,QAAQ,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAClF,QAAA,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACrB,IAAI,CAAC,IAAI,EAAE;YACT,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;AAC7C,YAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;AACrC,YAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACzB,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;AACtC,SAAA;KACF,CAAA;AAKD,IAAA,IAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AACrB,QAAA,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;AAElC,QAAA,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,MAAM,EAAE,CAAC;AACf,SAAA;KACF,CAAA;IA7DU,IAAI,GAAA,UAAA,CAAA;QAHhBJ,iCAAe,CAAC,MAAM,CAAC;QACvBC,oCAAkB;AAClB,QAAAC,iCAAM,CAACC,kCAAgB,EAAElC,0BAAQ,CAAC;AACtB,KAAA,EAAA,IAAI,CA8DhB,CAAA;IAAD,OAAC,IAAA,CAAA;AAAA,CA9DD,EA8DC;;AC/DD,IAAM,OAAO,GAAGY,0BAAW,CAAC,OAAO,CAAC;AAMpB,SAAA,sBAAsB,CAAC,KAAK,EAAE,UAAU,EAAA;AACtD,IAAA,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAE1B,IAAI,UAAU,GAAG,CAAC,EAAE;AAClB,QAAA,UAAU,GAAG,UAAU,GAAG,CAAC,CAAC;AAC7B,KAAA;AAED,IAAA,OAAO,UAAU,GAAG,MAAM,EAAE,EAAE,UAAU,EAAE;AACxC,QAAA,qBAAqB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAC9E,KAAA;AACH,CAAC;AASK,SAAU,yBAAyB,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAY,EAAA;IACjF,IAAI,cAAc,GAAG,EAAE,CAAC;AACxB,IAAA,IAAI,eAAe,GAAGuB,oCAAqB,CAAC,cAAc,EAAE,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;AAE1F,IAAA,IAAI,OAAO,GAAG,KAAK,WAAW,EAAE;AAC9B,QAAA,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AACjC,QAAA,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;AACrC,KAAA;AAAM,SAAA;AACL,QAAA,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;AACrC,KAAA;AACD,IAAA,qBAAqB,CAAC,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AACtD,IAAA,OAAO,eAAe,CAAC;AACzB,CAAC;SAQe,qBAAqB,CAAC,eAAe,EAAE,KAAK,EAAE,MAAM,EAAA;AAClE,IAAA,IAAI,KAAK,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC;IAC1B,IAAI,IAAI,IAAI,KAAK,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC;AAClC,IAAA,IAAI,IAAI,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;AAE3B,IAAA,eAAe,CAAC,MAAM,GAAG,KAAK,CAAC;AAC/B,IAAA,eAAe,CAAC,MAAM,GAAG,KAAK,CAAC;AAC/B,IAAA,eAAe,CAAC,KAAK,GAAG,IAAI,CAAC;IAC7B,eAAe,CAAC,OAAO,GAAG,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC;AAC3C,IAAA,eAAe,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC;AAC7B,IAAA,eAAe,CAAC,KAAK,GAAG,IAAI,CAAC;AAC/B,CAAC;AAKe,SAAA,wBAAwB,CAAC,WAAW,EAAE,QAAQ,EAAA;IAC5D,OAAO,WAAW,CAAC,oBAAoB;AACpC,SAAA,MAAM,CAAC,UAAA,EAAE,EAAA,EAAI,OAAA,EAAE,CAAC,gBAAgB,KAAK,QAAQ,CAAhC,EAAgC,CAAC,CAAC,CAAC,CAAC;SACjD,UAAU;SACV,KAAK;AACL,SAAA,gBAAgB,CAAC;AACtB,CAAC;AAKK,SAAU,gBAAgB,CAAC,UAAU,EAAA;IACzC,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,OAAO,UAAU,YAAYC,8BAAe,EAAE;AAC5C,QAAA,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;AACpC,KAAA;IACD,OAAO,UAAU,YAAYC,6BAAc,EAAE;AAC3C,QAAA,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACnC,SAAS,GAAG,IAAI,CAAC;AAClB,KAAA;IACD,OAAO,SAAS,GAAG,UAAU,GAAG,IAAI,CAAC;AACvC,CAAC;AAKK,SAAU,SAAS,CAAC,UAAU,EAAA;IAClC,OAAO,UAAU,YAAYD,8BAAe,EAAE;AAC5C,QAAA,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE;AACjC,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;AACD,QAAA,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;AACpC,KAAA;AACD,IAAA,OAAO,KAAK,CAAC;AACf,CAAC;AAKK,SAAU,oBAAoB,CAAC,OAAO,EAAA;IAC1C,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE;AAC5C,QAAA,OAAO,CAAC,IAAI,CAACrB,4BAAa,CAAC,CAAC;AAC7B,KAAA;SAAM,IAAI,OAAO,CAAC,qBAAqB,EAAE;QACxC,OAAO,CAAC,qBAAqB,EAAE,CAAC;AACjC,KAAA;AACH,CAAC;AAKK,SAAU,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,UAAmB,EAAA;IAC/D,IAAI,CAAC,OAAO,EAAE;AAEZ,QAAA,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC5B,KAAA;AACD,IAAA,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;AAC5B,IAAA,KAAK,IAAI,KAAK,GAAG,UAAU,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE;QACzD,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE;AAC/B,YAAA,OAAO,KAAK,CAAC;AACd,SAAA;AACF,KAAA;IACD,OAAO,CAAC,CAAC,CAAC;AACZ;;AC7HA,IAAA,mBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,mBAAA,GAAA;KAyQC;AAnQC,IAAA,mBAAA,CAAA,SAAA,CAAA,qBAAqB,GAArB,UAAsB,eAAe,EAAE,KAAK,EAAA;AAC1C,QAAA,OAAO,eAAe,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;KAChD,CAAA;AAOD,IAAA,mBAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,MAAM,EAAE,KAAK,EAAA;QAA7B,IA8FC,KAAA,GAAA,IAAA,CAAA;QA7FC,IAAM,OAAO,GAAG,MAAgB,CAAC;AACjC,QAAA,IAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;AAIjC,QAAA,IAAI,CAAC,KAAK,IAAI,WAAW,KAAK,CAAC,EAAE;YAC/B,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;YAC7D,OAAO;AACR,SAAA;AAED,QAAA,IAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;AACjC,QAAA,IAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC;QAIpC,IAAI,WAAW,KAAK,CAAC,EAAE;AACrB,YAAA,IAAI,CAAC,+BAA+B,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACrD,OAAO;AACR,SAAA;QAED,IAAI,OAAO,CAAC,qBAAqB,EAAE;YACjC,IAAM,gBAAgB,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC3C,YAAA,IAAM,wBAAwB,GAAG,OAAO,CAAC,KAAK,CAAC;AAC/C,YAAA,IAAM,SAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;YAGlC,IAAI,wBAAsB,GAAG,EAAE,CAAC;YAChC,IAAM,aAAa,GAAG,EAAE,CAAC;YAEzB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,WAAW,EAAE,KAAK,EAAE,EAAE;AAChD,gBAAA,IAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;gBACrC,IAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC;gBAE9D,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,SAAO,CAAC,KAAK,CAAC,CAAC,EAAE;AAE3C,oBAAA,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,iBAAA;AAAM,qBAAA;AAEL,oBAAA,wBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACtC,iBAAA;AACF,aAAA;YAED,IAAI,WAAW,SAAA,CAAC;YAChB,IAAI,aAAa,SAAA,CAAC;AAElB,YAAA,IAAI,wBAAsB,CAAC,MAAM,GAAG,CAAC,EAAE;AACrC,gBAAA,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;AACzF,gBAAA,WAAW,GAAG,YAAA;oBAEZ,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,WAAW,EAAE,KAAK,EAAE,EAAE;AAChD,wBAAA,IAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;AAC1B,wBAAA,IAAM,WAAW,GAAG,OAAO,CAAC,wBAAsB,EAAE,IAAI,EAAE,SAAO,EAAE,KAAK,CAAC,CAAC;wBAC1E,IAAI,IAAI,SAAA,CAAC;AAET,wBAAA,IAAI,WAAW,KAAK,CAAC,CAAC,EAAE;AACtB,4BAAA,IAAM,eAAe,GAAG,yBAAyB,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;4BAC7F,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;4BAE3E,wBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;AACpD,yBAAA;6BAAM,IAAI,WAAW,KAAK,KAAK,EAAE;AAChC,4BAAA,IAAI,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC7B,4BAAA,wBAAsB,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;AACjD,yBAAA;AAAM,6BAAA;AACL,4BAAA,IAAI,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC7B,4BAAA,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AACrC,4BAAA,wBAAsB,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;4BAC9C,wBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;AACpD,yBAAA;AAED,wBAAA,IAAI,IAAI,EAAE;4BACR,qBAAqB,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;AACjE,yBAAA;AACF,qBAAA;AAID,oBAAA,KAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5C,iBAAC,CAAC;AACH,aAAA;AAAM,iBAAA;AAEL,gBAAA,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC7E,gBAAA,WAAW,GAAG,YAAA,EAAM,OAAA,KAAI,CAAC,+BAA+B,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA,EAAA,CAAC;AAC1E,aAAA;YAED,IAAI,aAAa,YAAY,OAAO,EAAE;AACpC,gBAAA,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACjC,aAAA;AAAM,iBAAA;AACL,gBAAA,WAAW,EAAE,CAAC;AACf,aAAA;AACF,SAAA;AAAM,aAAA;AAEL,YAAA,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC3C,SAAA;KACF,CAAA;AAKD,IAAA,mBAAA,CAAA,SAAA,CAAA,+BAA+B,GAA/B,UAAgC,MAAM,EAAE,KAAK,EAAA;AAC3C,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;AAC9C,YAAA,IAAI,eAAe,GAAG,yBAAyB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACzE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AACjE,SAAA;KACF,CAAA;AAKD,IAAA,mBAAA,CAAA,SAAA,CAAA,oBAAoB,GAApB,UAAqB,MAAM,EAAE,KAAK,EAAA;AAChC,QAAA,IAAI,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;AAC/B,QAAA,IAAI,WAAW,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QAErC,OAAO,WAAW,GAAG,WAAW,EAAE;AAChC,YAAA,WAAW,EAAE,CAAC;AACd,YAAA,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACrE,SAAA;AAED,QAAA,IAAI,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE;YACpC,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC1B,YAAA,IAAI,IAAI,GAAG,CAAC,KAAK,WAAW,GAAG,CAAC,CAAC;YACjC,IAAI,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9B,YAAA,IAAI,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;AACzC,YAAA,IAAI,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;YAE3C,IAAI,cAAc,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;mBACjC,eAAe,CAAC,OAAO,KAAK,MAAM;AAClC,mBAAA,eAAe,CAAC,KAAK,KAAK,IAAI,EAAE;gBAEnC,SAAS;AACV,aAAA;YAED,cAAc,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACjC,YAAA,eAAe,CAAC,OAAO,GAAG,MAAM,CAAC;AACjC,YAAA,eAAe,CAAC,KAAK,GAAG,IAAI,CAAC;AAC7B,YAAA,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AAC7B,SAAA;QAED,KAAK,IAAI,CAAC,GAAG,WAAW,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE;AAC9C,YAAA,IAAI,eAAe,GAAG,yBAAyB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;YAClF,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AACjE,SAAA;KACF,CAAA;AAQD,IAAA,mBAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAA;QAAtC,IA8BC,KAAA,GAAA,IAAA,CAAA;QA7BC,IAAI,MAAM,CAAC,eAAe,EAAE;AAC1B,YAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC5C,gBAAA,IAAA,EAA+B,GAAA,OAAO,CAAC,CAAC,CAAC,EAAxC,KAAK,GAAA,EAAA,CAAA,KAAA,EAAE,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,UAAU,gBAAc,CAAC;gBAC9CuB,0BAAW,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AACjE,aAAA;YAED,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChC,OAAO;AACR,SAAA;AAGD,QAAA,IAAI,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QACrE,IAAI,YAAY,YAAY,OAAO,EAAE;AACnC,YAAA,IAAI,eAAa,GAAG,MAAM,CAAC,eAAe,GAAG,EAAE,CAAC;AAEhD,YAAA,IAAI,kBAAgB,GAAG,YAAA;AACrB,gBAAA,IAAI,CAAC,eAAa,CAAC,MAAM,EAAE;AACzB,oBAAA,MAAM,CAAC,eAAe,GAAG,SAAS,CAAC;AACnC,oBAAA,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;oBAC3B,OAAO;AACR,iBAAA;AAED,gBAAA,IAAI,WAAW,GAAG,KAAI,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,eAAa,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;AAC/F,gBAAA,eAAa,GAAG,MAAM,CAAC,eAAe,GAAG,EAAE,CAAC;AAC5C,gBAAA,WAAW,CAAC,IAAI,CAAC,kBAAgB,CAAC,CAAC;AACrC,aAAC,CAAC;AAEF,YAAA,YAAY,CAAC,IAAI,CAAC,kBAAgB,CAAC,CAAC;AACrC,SAAA;KACF,CAAA;AAaD,IAAA,mBAAA,CAAA,SAAA,CAAA,WAAW,GAAX,UAAY,MAAM,EAAE,KAAK,EAAE,OAAO,EAAA;QAAlC,IA6BC,KAAA,GAAA,IAAA,CAAA;QA5BC,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAI,UAAU,GAAG,EAAE,CAAC;AAEpB,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,YAAA,IAAI,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AACxB,YAAA,IAAI,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;AAE7B,YAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAEhD,gBAAA,IAAI,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,GAAG,WAAW,GAAG,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBAC5F,IAAI,aAAa,YAAY,OAAO,EAAE;AACpC,oBAAA,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAChC,iBAAA;AACF,aAAA;AACD,YAAA,WAAW,IAAI,MAAM,CAAC,UAAU,CAAC;AAClC,SAAA;AAED,QAAA,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;YACzB,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,YAAA;AAClC,gBAAA,IAAI,cAAc,GAAG,KAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;gBACtE,sBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,cAAc,CAAC,CAAC;AACzD,aAAC,CAAC,CAAC;AACJ,SAAA;AAED,QAAA,IAAI,cAAc,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACtE,sBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,cAAc,CAAC,CAAC;AAEvD,QAAA,OAAO,SAAS,CAAC;KAClB,CAAA;AAKD,IAAA,mBAAA,CAAA,SAAA,CAAA,mBAAmB,GAAnB,UAAoB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAA;AACxC,QAAA,IAAI,WAAmB,CAAC;AACxB,QAAA,IAAI,cAAsB,CAAC;AAC3B,QAAA,IAAI,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;AAC/B,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,YAAA,IAAI,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AACxB,YAAA,IAAI,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC;YAC1C,IAAI,GAAG,GAAG,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;AAE3C,YAAA,IAAI,OAAO,cAAc,KAAK,WAAW,IAAI,cAAc,KAAK,IAAI,IAAI,cAAc,GAAG,MAAM,CAAC,KAAK,EAAE;gBACrG,cAAc,GAAG,WAAW,CAAC;AAC9B,aAAA;AAED,YAAA,OAAO,QAAQ,GAAG,GAAG,EAAE,EAAE,QAAQ,EAAE;AACjC,gBAAA,IAAI,eAAe,GAAG,yBAAyB,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;gBAChG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAC9E,aAAA;AACF,SAAA;AAED,QAAA,OAAO,cAAc,CAAC;KACvB,CAAA;IACH,OAAC,mBAAA,CAAA;AAAD,CAAC,EAAA;;AC3QD,IAAA,iBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,iBAAA,GAAA;KAgHC;AA3GC,IAAA,iBAAA,CAAA,SAAA,CAAA,qBAAqB,GAArB,UAAsB,eAAe,EAAE,KAAK,EAAA;AAC1C,QAAA,OAAO,eAAe,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;KAC9C,CAAA;AAMD,IAAA,iBAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,MAAM,EAAE,KAAK,EAAA;QAA7B,IAOC,KAAA,GAAA,IAAA,CAAA;AANC,QAAA,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAC/E,IAAI,aAAa,YAAY,OAAO,EAAE;AACpC,YAAA,aAAa,CAAC,IAAI,CAAC,YAAM,EAAA,OAAA,KAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAzC,EAAyC,CAAC,CAAC;YACpE,OAAO;AACR,SAAA;AACD,QAAA,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KAC3C,CAAA;AAKD,IAAA,iBAAA,CAAA,SAAA,CAAA,qBAAqB,GAArB,UAAsB,MAAM,EAAE,KAAK,EAAA;QACjC,IAAI,KAAK,GAAG,CAAC,CAAC;AACd,QAAA,IAAI,eAAe,CAAC;AAEpB,QAAA,KAAK,CAAC,OAAO,CAAC,UAAC,KAAK,EAAE,GAAG,EAAA;AACvB,YAAA,eAAe,GAAG,yBAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YACnF,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAChE,YAAA,EAAE,KAAK,CAAC;AACV,SAAC,CAAC,CAAC;KACJ,CAAA;AAOD,IAAA,iBAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,MAAM,EAAE,GAAG,EAAE,OAAO,EAAA;AAClC,QAAA,IAAI,GAAG,CAAC;AACR,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,eAAe,CAAC;AACpB,QAAA,IAAI,WAAW,CAAC;AAChB,QAAA,IAAI,QAAQ,CAAC;AACb,QAAA,IAAI,MAAM,CAAC;QACX,IAAI,UAAU,GAAG,EAAE,CAAC;AACpB,QAAA,IAAI,aAAa,CAAC;AAElB,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC5C,YAAA,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,YAAA,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;YACjB,QAAQ,MAAM,CAAC,IAAI;AACnB,gBAAA,KAAK,QAAQ;oBACX,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACnD,oBAAA,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;oBACpF,IAAI,aAAa,YAAY,OAAO,EAAE;AACpC,wBAAA,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAChC,qBAAA;oBACD,eAAe,GAAG,yBAAyB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;oBAC9F,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;oBAChF,MAAM;AACR,gBAAA,KAAK,KAAK;oBACR,QAAQ,GAAG,MAAM,CAAC,SAAS,EAAE,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,SAAS,EAAE,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;oBAClF,eAAe,GAAG,yBAAyB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC3F,oBAAA,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;oBACjF,MAAM;AACR,gBAAA,KAAK,QAAQ;AACX,oBAAA,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE;wBAAE,OAAO;AAAE,qBAAA;oBAC9C,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACnD,oBAAA,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;oBACpF,IAAI,aAAa,YAAY,OAAO,EAAE;AACpC,wBAAA,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAChC,qBAAA;oBACD,MAAM;AACR,gBAAA,KAAK,OAAO;oBACV,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;oBAC3D,MAAM;AACR,gBAAA;oBACE,SAAS;AACV,aAAA;AACF,SAAA;AAED,QAAA,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACzB,YAAA,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,YAAA;gBAC3B,sBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;AAC5C,aAAC,CAAC,CAAC;AACJ,SAAA;AAAM,aAAA;YACL,sBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3C,SAAA;KACF,CAAA;AAKD,IAAA,iBAAA,CAAA,SAAA,CAAA,kBAAkB,GAAlB,UAAmB,MAAM,EAAE,GAAG,EAAA;AAC5B,QAAA,IAAI,CAAS,CAAC;AACd,QAAA,IAAI,EAAU,CAAC;AACf,QAAA,IAAI,KAAK,CAAC;AAEV,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,YAAA,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACvB,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE;AAC5C,gBAAA,OAAO,CAAC,CAAC;AACV,aAAA;AACF,SAAA;AAED,QAAA,OAAO,SAAS,CAAC;KAClB,CAAA;IACH,OAAC,iBAAA,CAAA;AAAD,CAAC,EAAA;;ACjHD,IAAA,kBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,kBAAA,GAAA;KAQC;AAPC,IAAA,kBAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,MAAM,EAAE,KAAK,EAAA;AAC3B,QAAA,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;KAC7B,CAAA;AAED,IAAA,kBAAA,CAAA,SAAA,CAAA,qBAAqB,GAArB,UAAsB,eAAe,EAAE,KAAK,EAAA;KAE3C,CAAA;IACH,OAAC,kBAAA,CAAA;AAAD,CAAC,EAAA;;ACPD,IAAA,oBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,oBAAA,GAAA;KAqDC;AAjDC,IAAA,oBAAA,CAAA,SAAA,CAAA,qBAAqB,GAArB,YAAA;AACE,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAMD,IAAA,oBAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,MAAM,EAAE,KAAK,EAAA;QAA7B,IAOC,KAAA,GAAA,IAAA,CAAA;AANC,QAAA,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAC/E,IAAI,aAAa,YAAY,OAAO,EAAE;AACpC,YAAA,aAAa,CAAC,IAAI,CAAC,YAAM,EAAA,OAAA,KAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAzC,EAAyC,CAAC,CAAC;YACpE,OAAO;AACR,SAAA;AACD,QAAA,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KAC3C,CAAA;AAKD,IAAA,oBAAA,CAAA,SAAA,CAAA,qBAAqB,GAArB,UAAsB,MAAM,EAAE,KAAK,EAAA;AACjC,QAAA,IAAI,cAAc,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;AACxC,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,eAAe,CAAC;AACpB,QAAA,IAAI,aAAa,CAAC;AAElB,QAAA,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC1B,QAAA,aAAa,GAAG,cAAc,GAAG,KAAK,CAAC;QAEvC,IAAI,aAAa,GAAG,CAAC,EAAE;YACrB,IAAI,aAAa,GAAG,cAAc,EAAE;gBAClC,aAAa,GAAG,cAAc,CAAC;AAChC,aAAA;AAED,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,aAAa,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC3C,gBAAA,MAAM,CAAC,UAAU,CAAC,cAAc,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAClF,aAAA;YAED,OAAO;AACR,SAAA;AAED,QAAA,KAAK,CAAC,GAAG,cAAc,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YAChD,eAAe,GAAG,yBAAyB,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YAC9D,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AACjE,SAAA;QAED,sBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;KAC3C,CAAA;IACH,OAAC,oBAAA,CAAA;AAAD,CAAC,EAAA;;ACrDD,IAAA,iBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,iBAAA,GAAA;KAsGC;AAjGC,IAAA,iBAAA,CAAA,SAAA,CAAA,qBAAqB,GAArB,UAAsB,eAAe,EAAE,KAAK,EAAA;AAC1C,QAAA,OAAO,eAAe,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;KAC9C,CAAA;AAMD,IAAA,iBAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,MAAM,EAAE,KAAK,EAAA;QAA7B,IAOC,KAAA,GAAA,IAAA,CAAA;AANC,QAAA,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAC/E,IAAI,aAAa,YAAY,OAAO,EAAE;AACpC,YAAA,aAAa,CAAC,IAAI,CAAC,YAAM,EAAA,OAAA,KAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAzC,EAAyC,CAAC,CAAC;YACpE,OAAO;AACR,SAAA;AACD,QAAA,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KAC3C,CAAA;AAKD,IAAA,iBAAA,CAAA,SAAA,CAAA,qBAAqB,GAArB,UAAsB,MAAM,EAAE,KAAK,EAAA;QACjC,IAAI,KAAK,GAAG,CAAC,CAAC;AACd,QAAA,IAAI,eAAe,CAAC;AAEpB,QAAA,KAAK,CAAC,OAAO,CAAC,UAAA,KAAK,EAAA;AACjB,YAAA,eAAe,GAAG,yBAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC9E,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAChE,YAAA,EAAE,KAAK,CAAC;AACV,SAAC,CAAC,CAAC;KACJ,CAAA;AAQD,IAAA,iBAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,MAAM,EAAE,GAAG,EAAE,OAAO,EAAA;AAClC,QAAA,IAAI,KAAK,CAAC;AACV,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,eAAe,CAAC;AACpB,QAAA,IAAI,WAAW,CAAC;AAChB,QAAA,IAAI,MAAM,CAAC;QACX,IAAI,UAAU,GAAG,EAAE,CAAC;AACpB,QAAA,IAAI,aAAa,CAAC;AAElB,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC5C,YAAA,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,YAAA,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;YACrB,QAAQ,MAAM,CAAC,IAAI;AACnB,gBAAA,KAAK,KAAK;AACR,oBAAA,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AACrC,oBAAA,eAAe,GAAG,yBAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;oBAC3E,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;oBACzE,MAAM;AACR,gBAAA,KAAK,QAAQ;oBACX,WAAW,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACvD,oBAAA,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;oBACpF,IAAI,aAAa,YAAY,OAAO,EAAE;AACpC,wBAAA,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAChC,qBAAA;oBACD,MAAM;AACR,gBAAA,KAAK,OAAO;oBACV,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;oBAC3D,MAAM;AACR,gBAAA;oBACE,SAAS;AACV,aAAA;AACF,SAAA;AAED,QAAA,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACzB,YAAA,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,YAAA;gBAC3B,sBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;AAC5C,aAAC,CAAC,CAAC;AACJ,SAAA;AAAM,aAAA;YACL,sBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3C,SAAA;KACF,CAAA;AAKD,IAAA,iBAAA,CAAA,SAAA,CAAA,oBAAoB,GAApB,UAAqB,MAAM,EAAE,KAAK,EAAA;AAChC,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,KAAK,CAAC;AAEV,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,YAAA,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACvB,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,EAAE;AAChD,gBAAA,OAAO,CAAC,CAAC;AACV,aAAA;AACF,SAAA;AAED,QAAA,OAAO,SAAS,CAAC;KAClB,CAAA;IACH,OAAC,iBAAA,CAAA;AAAD,CAAC,EAAA;;ACvFD,IAAA,qBAAA,IAAA,YAAA;AAUE,IAAA,SAAA,qBAAA,GAAA;AACE,QAAA,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;AACnB,QAAA,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QAErB,IAAI,CAAC,WAAW,CAAC,UAAA,KAAK,EAAI,EAAA,OAAA,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAArC,EAAqC,EAAE,IAAI,kBAAkB,EAAoB,CAAC,CAAC;AAC7G,QAAA,IAAI,CAAC,WAAW,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,YAAY,KAAK,GAAA,EAAE,IAAI,mBAAmB,EAAE,CAAC,CAAC;AAC7E,QAAA,IAAI,CAAC,WAAW,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,YAAY,GAAG,GAAA,EAAE,IAAI,iBAAiB,EAAE,CAAC,CAAC;AACzE,QAAA,IAAI,CAAC,WAAW,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,YAAY,GAAG,GAAA,EAAE,IAAI,iBAAiB,EAAE,CAAC,CAAC;AACzE,QAAA,IAAI,CAAC,WAAW,CAAC,UAAA,KAAK,EAAA,EAAI,OAAA,OAAO,KAAK,KAAK,QAAQ,GAAA,EAAE,IAAI,oBAAoB,EAA+C,CAAC,CAAC;KAC/H;AAMD,IAAA,qBAAA,CAAA,SAAA,CAAA,WAAW,GAAX,UAAY,OAAgC,EAAE,QAAwB,EAAA;AACpE,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC5B,QAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KAChC,CAAA;IAKD,qBAAW,CAAA,SAAA,CAAA,WAAA,GAAX,UAAY,KAAU,EAAA;AACpB,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAE7B,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACjD,YAAA,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;AACtB,gBAAA,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAC3B,aAAA;AACF,SAAA;AAED,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;IACH,OAAC,qBAAA,CAAA;AAAD,CAAC,EAAA;;AC5DM,IAAM,0BAA0B,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpG,SAAS,yBAAyB,CAAC,WAAW,EAAA;AAC5C,IAAA,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC;AACzB,IAAA,IAAI,IAAI,GAAG,CAAC,CAAC,WAAW,KAAK,IAAI,GAAG,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,aAAa,CAAC;AACpE,IAAA,OAAO,0BAA0B,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,cAAc,IAAI,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,aAAa,CAAC;WACrJ,CAAC,CAAC,WAAW,IAAI,qBAAqB,CAAC,CAAC,CAAC,WAAW,CAAC;WACrD,WAAW,CAAC,WAAW,IAAI,qBAAqB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AACjF,CAAC;AAED,SAAS,uBAAuB,CAAC,WAAW,EAAA;AAE1C,IAAA,IAAI,SAAS,GAAG,WAAW,CAAC,oBAAoB,CAAC;AACjD,IAAA,IAAI,SAAS,EAAE;AACb,QAAA,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;QACzB,OAAO,CAAC,EAAE,EAAE;AACV,YAAA,IAAI,yBAAyB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;AAC3C,gBAAA,OAAO,IAAI,CAAC;AACb,aAAA;AACF,SAAA;AACF,KAAA;IAGD,OAAO,WAAW,CAAC,WAAW,IAAI,qBAAqB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AACnF,CAAC;AAEK,SAAU,qBAAqB,CAAC,WAAW,EAAA;IAE/C,IAAI,wBAAwB,IAAI,WAAW,EAAE;QAC3C,OAAO,WAAW,CAAC,sBAAsB,CAAC;AAC3C,KAAA;AAGD,IAAA,WAAW,CAAC,sBAAsB,GAAG,KAAK,CAAC;IAG3C,IAAI,WAAW,CAAC,WAAW,EAAE;QAC3B,WAAW,CAAC,sBAAsB,GAAG,qBAAqB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QACpF,OAAO,WAAW,CAAC,sBAAsB,CAAC;AAC3C,KAAA;IAGD,IAAI,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE;AACrD,QAAA,WAAW,CAAC,sBAAsB,GAAG,IAAI,CAAC;AAC1C,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;AAGD,IAAA,KAAK,IAAI,EAAE,IAAI,WAAW,CAAC,YAAY,EAAE;QACvC,IAAI,uBAAuB,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE;AACzD,YAAA,WAAW,CAAC,sBAAsB,GAAG,IAAI,CAAC;AAC1C,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;AACF,KAAA;AAGD,IAAA,WAAW,CAAC,sBAAsB,GAAG,KAAK,CAAC;AAC3C,IAAA,OAAO,KAAK,CAAC;AACf;;ACvDA,IAAA,gBAAA,IAAA,YAAA;AACE,IAAA,SAAA,gBAAA,CAAY,OAAO,EAAA;AACjB,QAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;AAClB,YAAA,KAAK,EAAE,OAAO;AACd,YAAA,qBAAqB,EAAE,IAAI;SAC5B,EAAE,OAAO,CAAC,CAAC;KACb;AAOD,IAAA,gBAAA,CAAA,SAAA,CAAA,SAAS,GAAT,YAAA;AACE,QAAA,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KACxD,CAAA;AAOD,IAAA,gBAAA,CAAA,SAAA,CAAA,KAAK,GAAL,YAAA;AACE,QAAA,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;KACpD,CAAA;IAQD,gBAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,KAAa,EAAA;AAChB,QAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;KACnD,CAAA;AAOD,IAAA,gBAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;AACE,QAAA,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;KACtD,CAAA;AASD,IAAA,gBAAA,CAAA,SAAA,CAAA,OAAO,GAAP,UAAQ,cAAc,EAAE,eAAe,EAAA;AACrC,QAAA,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;KACtD,CAAA;AAUD,IAAA,gBAAA,CAAA,SAAA,CAAA,UAAU,GAAV,UAAW,KAAK,EAAE,cAAc,EAAE,eAAe,EAAA;AAC/C,QAAA,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;KACzD,CAAA;AAQD,IAAA,gBAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,WAAW,EAAE,WAAW,EAAA;AAC/B,QAAA,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;KACvD,CAAA;AAQD,IAAA,gBAAA,CAAA,SAAA,CAAA,cAAc,GAAd,UAAe,aAAuB,EAAE,aAAuB,EAAA;AAC7D,QAAA,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;KAC7D,CAAA;AASD,IAAA,gBAAA,CAAA,SAAA,CAAA,WAAW,GAAX,UAAY,aAA0B,EAAE,aAAuB,EAAE,aAAuB,EAAA;AACtF,QAAA,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;KACzD,CAAA;AASD,IAAA,gBAAA,CAAA,SAAA,CAAA,UAAU,GAAV,UAAW,KAAa,EAAE,aAAuB,EAAE,aAAuB,EAAA;AACxE,QAAA,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;KACzD,CAAA;IAQD,gBAAc,CAAA,SAAA,CAAA,cAAA,GAAd,UAAe,IAAU,EAAA;AACvB,QAAA,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;KAC7D,CAAA;IACH,OAAC,gBAAA,CAAA;AAAD,CAAC,EAAA;;ACtGD,IAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAQvD,IAAA,MAAA,IAAA,UAAA,MAAA,EAAA;IAA4B,SAAgB,CAAA,MAAA,EAAA,MAAA,CAAA,CAAA;IA4E1C,SAAY,MAAA,CAAA,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAA;AAA/F,QAAA,IAAA,KAAA,GACE,MAAM,CAAA,IAAA,CAAA,IAAA,EAAA;AACJ,YAAA,KAAK,EAAE,MAAM;AACb,YAAA,qBAAqB,EAAE,qBAAqB,CAAC,WAAW,CAAC;AAC1D,SAAA,CAAC,IAcH,IAAA,CAAA;AAZC,QAAA,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,QAAA,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,QAAA,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,KAAI,CAAC,eAAe,GAAG,aAAa,CAAC,eAAe,CAAC;AACrD,QAAA,KAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,KAAI,CAAC,GAAG,GAAG,KAAK,CAAC;AACjB,QAAA,KAAI,CAAC,KAAK,GAAG,OAAO,CAAC;AACrB,QAAA,KAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,KAAI,CAAC,cAAc,GAAG,KAAK,CAAC;QAC5B,KAAI,CAAC,gBAAgB,GAAG,wBAAwB,CAAC,KAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QACjF,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC,KAAI,CAAC,gBAAgB,CAAC,CAAC;AAClD,QAAA,KAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;;KACjE;eA9FU,MAAM,CAAA;AAgGjB,IAAA,MAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,OAAO,EAAE,OAAO,EAAA;QACnB,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KACpC,CAAA;AAOD,IAAA,MAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,cAAc,EAAE,eAAe,EAAA;QAClC,IAAI,CAAC,KAAK,GAAG,EAAE,cAAc,gBAAA,EAAE,eAAe,EAAA,eAAA,EAAE,CAAC;AACjD,QAAA,IAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;AACrC,QAAA,IAAI,EAAE,uBAAuB,IAAI,WAAW,CAAC,EAAE;YAC7C,WAAW,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC,+BAA+B,EAAE,CAAC;AAC/E,SAAA;AACD,QAAA,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC,uBAAuB,CAAC,CAAC;QAC3D,IAAI,CAAC,YAAY,EAAE,CAAC;KACrB,CAAA;AAKD,IAAA,MAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AAClB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AAClB,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,sBAAsB,EAAE,CAAC;KAC/B,CAAA;AAKD,IAAA,MAAA,CAAA,SAAA,CAAA,sBAAsB,GAAtB,YAAA;QACE,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC3B,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAC5D,YAAA,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;AAC/B,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;AACzB,SAAA;KACF,CAAA;AAKD,IAAA,MAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,YAAA;QAAA,IAsBC,KAAA,GAAA,IAAA,CAAA;QArBC,IAAI,CAAC,sBAAsB,EAAE,CAAC;AAG9B,QAAA,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACf,OAAO;AACR,SAAA;AAED,QAAA,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACxD,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,aAAA,CAAA,MAAA,CAAc,IAAI,CAAC,gBAAgB,EAAqB,qBAAA,CAAA,CAAC,CAAC;AAC3E,SAAA;QAED,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE;YACtD,IAAI,CAAC,kBAAkB,EAAE,CAAC;AAC3B,SAAA;AACD,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3C,QAAA,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,cAAc,CAAC,YAAA;AAC5C,YAAA,KAAI,CAAC,cAAc,GAAG,KAAK,CAAC;AAC9B,SAAC,CAAC,CAAC;KACJ,CAAA;AAKD,IAAA,MAAA,CAAA,SAAA,CAAA,mBAAmB,GAAnB,YAAA;QACE,IAAI,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,EAAE;AACf,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;QACD,OAAO,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KAC9C,CAAA;AAKD,IAAA,MAAA,CAAA,SAAA,CAAA,uBAAuB,GAAvB,UAAwB,UAAU,EAAE,OAAO,EAAA;AACzC,QAAA,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC5B,OAAO;AACR,SAAA;QACD,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,OAAO;AACR,SAAA;QACD,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;KAC1D,CAAA;AAMD,IAAA,MAAA,CAAA,SAAA,CAAA,4BAA4B,GAA5B,UAA6B,UAAU,EAAE,OAAO,EAAA;QAAhD,IAsBC,KAAA,GAAA,IAAA,CAAA;AArBC,QAAA,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC5B,OAAO;AACR,SAAA;QAGD,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,OAAO;AACR,SAAA;AACD,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AAC3B,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AAChF,QAAA,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,cAAc,CAAC,YAAA,EAAM,OAAA,KAAI,CAAC,cAAc,GAAG,KAAK,CAA3B,EAA2B,CAAC,CAAC;AAGjF,QAAA,IAAI,QAAQ,KAAK,IAAI,CAAC,KAAK,EAAE;YAE3B,IAAI,CAAC,YAAY,EAAE,CAAC;AACrB,SAAA;AAAM,aAAA;AAGL,YAAA,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;AACvB,SAAA;KACF,CAAA;AAKD,IAAA,MAAA,CAAA,SAAA,CAAA,uBAAuB,GAAvB,YAAA;AACE,QAAA,IAAI,KAAK,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACvC,IAAI,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,EAAE;AACb,YAAA,OAAO,KAAK,CAAC;AACd,SAAA;AACD,QAAA,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;AACtF,QAAA,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;AAC5B,YAAA,OAAO,KAAK,CAAC;AACd,SAAA;AACD,QAAA,IAAI,CAAC,WAAW,GAAG,8BAA8B,CAAC;QAClD,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAC1D,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAKD,IAAA,MAAA,CAAA,SAAA,CAAA,kBAAkB,GAAlB,YAAA;AACE,QAAA,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AACvB,QAAA,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QAC3F,IAAI,IAAI,CAAC,kBAAkB,EAAE;AAC3B,YAAA,IAAI,CAAC,WAAW,GAAG,yBAAyB,CAAC;YAC7C,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAC3D,SAAA;KACF,CAAA;AAOD,IAAA,MAAA,CAAA,SAAA,CAAA,+BAA+B,GAA/B,YAAA;AACE,QAAA,IAAM,WAAW,GAAgB,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;AAC9D,QAAA,IAAI,WAAW,EAAE;AACf,YAAA,IAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;AACtC,YAAA,IAAM,YAAY,GAAG,WAAW,CAAC,YAAiD,CAAC;YAEnF,IAAI,QAAM,CAAC,eAAe,EAAE;AAC1B,gBAAA,OAAO,+BAA+B,CAAC,YAAY,CAAC,CAAC;AACtD,aAAA;AAID,YAAA,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAClC,gBAAA,OAAO,SAAS,CAAC;AAClB,aAAA;AAID,YAAA,IAAM,eAAe,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;AACvD,YAAA,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE;AACjD,gBAAA,OAAO,SAAS,CAAC;AAClB,aAAA;YACD,IAAM,uBAAuB,GAAG,eAAe,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;AAC7E,YAAA,OAAO,+BAA+B,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAC;AAC/E,SAAA;AAED,QAAA,OAAO,SAAS,CAAC;KAClB,CAAA;AAGD,IAAA,MAAA,CAAA,SAAA,CAAA,SAAS,GAAT,YAAA,EAAc,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAA;IACrD,MAAK,CAAA,SAAA,CAAA,KAAA,GAAL,YAAU,EAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;AAC1C,IAAA,MAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,KAAK,EAAA,EAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAA;AACrD,IAAA,MAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;AACE,QAAA,IAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;AAC3C,QAAA,OAAO,cAAc;AACnB,cAAE,cAAc,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC,eAAe,CAAC;cACpF,IAAI,CAAC;KACV,CAAA;AAED,IAAA,MAAA,CAAA,SAAA,CAAA,OAAO,GAAP,UAAQ,cAAc,EAAE,eAAe,EAAA;QACrC,IAAI,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;AACrC,QAAA,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAC3C,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KACzB,CAAA;AAED,IAAA,MAAA,CAAA,SAAA,CAAA,UAAU,GAAV,UAAW,KAAK,EAAE,cAAc,EAAE,eAAe,EAAA;QAC/C,IAAI,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;AACrC,QAAA,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KACnC,CAAA;AAED,IAAA,MAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,WAAW,EAAE,WAAW,EAAA;QAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;KAC9C,CAAA;AAED,IAAA,MAAA,CAAA,SAAA,CAAA,cAAc,GAAd,UAAe,aAAa,EAAE,aAAa,EAAA;QACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;KAC9D,CAAA;AAED,IAAA,MAAA,CAAA,SAAA,CAAA,WAAW,GAAX,UAAY,aAAa,EAAE,aAAa,EAAE,aAAa,EAAA;AACrD,QAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;KAC9E,CAAA;AAED,IAAA,MAAA,CAAA,SAAA,CAAA,UAAU,GAAV,UAAW,KAAK,EAAE,aAAa,EAAE,aAAa,EAAA;AAC5C,QAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;KACpE,CAAA;IAED,MAAc,CAAA,SAAA,CAAA,cAAA,GAAd,UAAe,IAAU,EAAA;QACvB,IAAM,KAAK,GAAG,IAAsD,CAAC;AACrE,QAAA,IAAI,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC9B,OAAO,CAAC,EAAE,EAAE;YACV,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,SAAA;AACD,QAAA,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC;QAC7B,OAAO,CAAC,EAAE,EAAE;AACV,YAAA,IAAI,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC;YACpD,OAAO,CAAC,EAAE,EAAE;AACV,gBAAA,IAAI,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;gBAC9D,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC/B,aAAA;AACF,SAAA;KACF,CAAA;;IApUM,MAAe,CAAA,eAAA,GAAG,IAAI,CAAC;AAOpB,IAAA,UAAA,CAAA;QAATV,0BAAQ;AAAO,KAAA,EAAA,MAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAMN,IAAA,UAAA,CAAA;QAATA,0BAAQ;AAAO,KAAA,EAAA,MAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAMN,IAAA,UAAA,CAAA;QAATA,0BAAQ;AAAK,KAAA,EAAA,MAAA,CAAA,SAAA,EAAA,KAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAMJ,IAAA,UAAA,CAAA;QAATA,0BAAQ;AAAO,KAAA,EAAA,MAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;IAlCL,MAAM,GAAA,QAAA,GAAA,UAAA,CAAA;QAHlBG,iCAAe,CAAC,QAAQ,CAAC;QACzBC,oCAAkB;AAClB,QAAAC,iCAAM,CAACC,kCAAgB,EAAEK,mCAAiB,EAAEvC,0BAAQ,EAAEN,+BAAa,EAAE4B,8BAAe,EAAE,qBAAqB,CAAC;AAChG,KAAA,EAAA,MAAM,CA8UlB,CAAA;IAAD,OAAC,MAAA,CAAA;CAAA,CA9U2B,gBAAgB,CA8U3C,EAAA;AAKD,IAAM,+BAA+B,GAAG,UAAC,YAA+C,EAAE,iBAA0B,EAAA;IAClH,IAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACjD,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC9C,QAAA,IAAM,aAAa,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;AAGxC,QAAA,IAAI,iBAAiB,KAAK,SAAS,IAAI,aAAa,KAAK,iBAAiB,EAAE;YAC1E,SAAS;AACV,SAAA;QACD,IAAM,WAAW,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC,WAAkC,CAAC;AACnF,QAAA,IAAI,WAAW,EAAE;AACf,YAAA,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE;gBAC9C,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC,cAAc,KAAK,SAAS,EAAE;AAChD,oBAAA,IAAM,wBAAwB,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;AACjD,oBAAA,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC1B,oBAAA,OAAO,wBAAwB,CAAC;AACjC,iBAAA;AACF,aAAA;AACF,SAAA;AACF,KAAA;AACH,CAAC,CAAC;AAOF,IAAM,gBAAgB,GAAG,UAAC,EAA8B,EAAA;AACtD,IAAA,IAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;AACd,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;QACnD,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAkB,CAAC,EAAE;AAC7C,YAAA,EAAE,KAAK,CAAC;AACT,SAAA;AACF,KAAA;AACD,IAAA,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAOF,IAAM,oBAAoB,GAAG,UAAC,EAA8B,EAAA;AAC1D,IAAA,IAAI,UAAU,GAAG,EAAE,CAAC,UAAqB,CAAC;IAC1C,OAAO,UAAU,KAAK,IAAI,EAAE;AAC1B,QAAA,IAAI,UAAU,CAAC,QAAQ,KAAkB,CAAC,EAAE;AAC1C,YAAA,OAAO,UAAU,CAAC;AACnB,SAAA;AACD,QAAA,UAAU,GAAG,UAAU,CAAC,WAAsB,CAAC;AAChD,KAAA;AACD,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;;ACraM,IAAM,oBAAoB,GAAG,cAAc,CAAC;AAEnD,IAAM,gBAAgB,GAAG,GAAI,CAAA,MAAA,CAAA,oBAAoB,kCAA+B,CAAC;SAEjE,4BAA4B,GAAA;AAC1C,IAAA9B,cAAG,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;AACrC,CAAC;AAEK,SAAU,gCAAgC,CAAC,WAAgB,EAAA;IAC/D,IAAIgD,kBAAO,CAAC,SAAS,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,mBAAmB,EAAE;AACxE,QAAA,WAAW,CAAC,mBAAmB,GAAG,IAAI,CAAC;AACvC,QAAAhD,cAAG,CAAC,YAAY,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;AACjD,KAAA;AACH;;ACLA,IAAA,IAAA,IAAA,YAAA;AAsBE,IAAA,SAAA,IAAA,CAAY,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAA;AACxC,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;KAChC;AAdM,IAAA,IAAA,CAAA,MAAM,GAAb,YAAA;AACE,QAAA,OAAO,CAACA,cAAG,CAAC,OAAO,EAAEiD,0BAAQ,EAAEC,mCAAQ,CAAC,EAAE,CAAClD,cAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;KACjE,CAAA;AAiBD,IAAA,IAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;AACE,QAAA,gCAAgC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;KACpD,CAAA;IAMD,IAAY,CAAA,SAAA,CAAA,YAAA,GAAZ,UAAa,QAAQ,EAAA;AACnB,QAAA,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAC3B,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC7B,QAAA,IAAI,QAAQ,EAAE;AACZ,YAAA,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;AACrD,SAAA;AAAM,aAAA;AACL,YAAA,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;AAClD,SAAA;KACF,CAAA;IAMD,IAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,cAAc,EAAA;AACjB,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC/B,CAAA;IAvDU,IAAI,GAAA,UAAA,CAAA;QADhBuC,iCAAe,CAAC,MAAM,CAAC;AACX,KAAA,EAAA,IAAI,CAwDhB,CAAA;IAAD,OAAC,IAAA,CAAA;AAAA,CAxDD,EAwDC;;ACxDD,IAAA,IAAA,IAAA,YAAA;AAyBE,IAAA,SAAA,IAAA,CAAY,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAA;AACxC,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;KAChC;AAdM,IAAA,IAAA,CAAA,MAAM,GAAb,YAAA;AACE,QAAA,OAAO,CAACvC,cAAG,CAAC,OAAO,EAAEiD,0BAAQ,EAAEC,mCAAQ,CAAC,EAAE,CAAClD,cAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;KACjE,CAAA;AAiBD,IAAA,IAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;AACE,QAAA,gCAAgC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;KACpD,CAAA;IAMD,IAAY,CAAA,SAAA,CAAA,YAAA,GAAZ,UAAa,QAAQ,EAAA;AACnB,QAAA,IAAI,QAAQ,EAAE;YACZ,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;AAC5D,SAAA;AAAM,aAAA;YACL,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;AAC/D,SAAA;KACF,CAAA;IAMD,IAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,cAAc,EAAA;AACjB,QAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC/B,CAAA;IAGD,IAAK,CAAA,SAAA,CAAA,KAAA,GAAL,UAAM,KAAU,EAAA;AACd,QAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C,CAAA;IA7DU,IAAI,GAAA,UAAA,CAAA;QADhBuC,iCAAe,CAAC,MAAM,CAAC;AACX,KAAA,EAAA,IAAI,CA8DhB,CAAA;IAAD,OAAC,IAAA,CAAA;AAAA,CA9DD,EA8DC;;ACrED,IAAA,aAAA,IAAA,YAAA;AAAA,IAAA,SAAA,aAAA,GAAA;KAUC;IAJC,aAAQ,CAAA,SAAA,CAAA,QAAA,GAAR,UAAS,KAAK,EAAA;AACZ,QAAA,MAAM,IAAI,KAAK,CAAC,sOACgI,CAAC,CAAC;KACnJ,CAAA;IACH,OAAC,aAAA,CAAA;AAAD,CAAC,EAAA;;ACJD,IAAA,0BAAA,IAAA,YAAA;AAOE,IAAA,SAAA,0BAAA,CAAY,SAAwB,EAAA;AAClC,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;KAC5B;IAMD,0BAAM,CAAA,SAAA,CAAA,MAAA,GAAN,UAAO,eAAe,EAAA;AACpB,QAAA,IAAI,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,EAAE;AAC7D,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;KACjD,CAAA;IArBU,0BAA0B,GAAA,UAAA,CAAA;QAFtCY,6BAAc,CAAC,cAAc,CAAC;QAC9BV,iCAAM,CAAC,aAAa,CAAC;AACT,KAAA,EAAA,0BAA0B,CAsBtC,CAAA;IAAD,OAAC,0BAAA,CAAA;AAAA,CAtBD,EAsBC;;ACtBD,IAAA,WAAA,IAAA,YAAA;IAaE,SAAY,WAAA,CAAA,WAAwB,EAAE,QAAkB,EAAA;AACtD,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;AAOD,IAAA,WAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,cAAc,EAAE,eAAe,EAAA;AAClC,QAAA,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;YACtB,IAAI,CAAC,IAAI,GAAI,IAAI,CAAC,WAAmB,CAAC,MAAM,EAAE,CAAC;YAC/C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9B,SAAA;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;KACjD,CAAA;AAKD,IAAA,WAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;KACpB,CAAA;IAtCU,WAAW,GAAA,UAAA,CAAA;QAHvBF,iCAAe,CAAC,aAAa,CAAC;QAC9BC,oCAAkB;AAClB,QAAAC,iCAAM,CAACC,kCAAgB,EAAElC,0BAAQ,CAAC;AACtB,KAAA,EAAA,WAAW,CAuCvB,CAAA;IAAD,OAAC,WAAA,CAAA;AAAA,CAvCD,EAuCC;;ACvCD,IAAA,KAAA,IAAA,YAAA;IA+BE,SAAY,KAAA,CAAA,OAAO,EAAE,SAAS,EAAA;AAC5B,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;AACxB,QAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;KACzB;AAbM,IAAA,KAAA,CAAA,MAAM,GAAb,YAAA;AACE,QAAA,OAAO,CAACR,cAAG,CAAC,OAAO,EAAEmC,0BAAS,CAAC,CAAC;KACjC,CAAA;AAgBD,IAAA,KAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,YAAA;QACE,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,MAAM,EAAE,CAAC;AACf,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AACxB,SAAA;KACF,CAAA;AAKD,IAAA,KAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;QAAA,IAUC,KAAA,GAAA,IAAA,CAAA;QATC,IAAI,IAAI,CAAC,KAAK,EAAE;AACd,YAAA,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,YAAA;gBAC5B,IAAI,KAAI,CAAC,KAAK,EAAE;AACd,oBAAA,KAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;AACtB,iBAAA;AACH,aAAC,CAAC,CAAC;AACJ,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;AACrB,SAAA;KACF,CAAA;AAKD,IAAA,KAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;AACE,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,IAAI,CAAC,UAAU,EAAE;AACnB,YAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YACxB,IAAI,CAAC,MAAM,EAAE,CAAC;AACf,SAAA;QACD,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KAC7C,CAAA;AAKD,IAAA,KAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;AACE,QAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KAChD,CAAA;IAED,KAAW,CAAA,SAAA,CAAA,WAAA,GAAX,UAAY,CAAC,EAAA;AACX,QAAA,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE;AACtB,YAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AACnB,SAAA;AAAM,aAAA,IAAInC,cAAG,CAAC,aAAa,KAAK,IAAI,CAAC,OAAO,EAAE;AAC7C,YAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACpB,SAAA;KACF,CAAA;IA5FU,KAAK,GAAA,UAAA,CAAA;AADjB,QAAAuC,iCAAe,CAAC,OAAO,EAAEnB,0BAAW,CAAC,MAAM,CAAC;AAChC,KAAA,EAAA,KAAK,CA6FjB,CAAA;IAAD,OAAC,KAAA,CAAA;AAAA,CA7FD,EA6FC;;AC/FD,IAAI,aAAa,GAAG,8BAA8B,CAAC;AAEnD,SAAS,YAAY,CAAC,OAAe,EAAE,GAAW,EAAA;AAChD,IAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;AAC3B,QAAA,MAAM,IAAI,KAAK,CAAC,4CAAqC,OAAO,CAAE,CAAC,CAAC;AACjE,KAAA;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,UAAC,KAAK,EAAE,EAAE,EAAA;QAC1C,IAAI,KAAK,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACzB,QAAA,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,GAAG,EAAE;AACnC,YAAA,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAClC,SAAA;QACD,OAAO,QAAQ,GAAGb,0BAAc,CAAC,EAAE,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC;AACxD,KAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAA,WAAA,IAAA,YAAA;AAkBE,IAAA,SAAA,WAAA,CAAY,OAAe,EAAA;AACzB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACpB,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,QAAA,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC;KACvC;AAED,IAAA,WAAA,CAAA,SAAA,CAAA,UAAU,GAAV,UAAW,SAAoB,EAAE,MAAgB,EAAA;QAC/C,IAAI,CAAC,OAAO,GAAG,IAAK,MAAc,CAAC,IAAI,CAAC,CAAC;KAC1C,CAAA;AAED,IAAA,WAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,QAAuB,EAAE,IAAa,EAAA;QAC7C,IAAI,IAAI,KAAK,QAAQ,EAAE;AACrB,YAAA,QAAQ,CAAC,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAChD,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACrB,SAAA;KACF,CAAA;IAED,WAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,SAAoB,EAAA;QAAzB,IAaC,KAAA,GAAA,IAAA,CAAA;AAZC,QAAA,OAAO,SAAS,CAAC,GAAG,CAACJ,oBAAM,CAAC;AACzB,aAAA,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;AACtB,aAAA,KAAK,CAAC,YAAM,EAAA,OAAA,IAAI,CAAA,EAAA,CAAC;aACjB,IAAI,CAAC,UAAA,IAAI,EAAA;YACR,IAAI,GAAG,YAAY,CAAC,KAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACxC,YAAA,KAAI,CAAC,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC;YACxB,IAAI,KAAI,CAAC,OAAO,EAAE;AAChB,gBAAA,KAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC;AACrC,gBAAAH,cAAG,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AACxB,aAAA;AACD,YAAA,OAAO,KAAI,CAAC;AACd,SAAC,CAAC,CAAC;KACN,CAAA;IACH,OAAC,WAAA,CAAA;AAAD,CAAC,EAAA,CAAA,CAAA;AAED,IAAA,kBAAA,IAAA,YAAA;AAIE,IAAA,SAAA,kBAAA,CAAY,KAAkB,EAAA;AAC5B,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;KACjB;AAED,IAAA,kBAAA,CAAA,SAAA,CAAA,aAAa,GAAb,UAAc,OAAyB,EAAE,SAAwB,EAAE,WAAmC,EAAA;QACpG,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/BA,cAAG,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,OAAc,EAAE,IAAI,CAAC,CAAC;AAClD,SAAA;aAAM,IAAIgD,kBAAO,CAAC,SAAS,EAAE;AAC5B,YAAA,IAAI,SAAS,GAAGhD,cAAG,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,OAAc,EAAE,IAAI,CAAY,CAAC;AAC5E,YAAA,SAAS,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC5C,SAAA;aAAM,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,wBAAwB,EAAE;AAC/D,YAAAA,cAAG,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3B,YAAA,IAAI,CAAC,KAAK,CAAC,wBAAwB,GAAG,IAAI,CAAC;AAC5C,SAAA;KACF,CAAA;IACH,OAAC,kBAAA,CAAA;AAAD,CAAC,EAAA,CAAA,CAAA;AAEK,SAAU,kBAAkB,CAAC,OAAe,EAAA;AAEhD,IAAA,IAAA,OAAA,IAAA,UAAA,MAAA,EAAA;QAAsB,SAAkB,CAAA,OAAA,EAAA,MAAA,CAAA,CAAA;AAAxC,QAAA,SAAA,OAAA,GAAA;;SAA2C;QAArC,OAAO,GAAA,UAAA,CAAA;AADZ,YAAAoD,0BAAQ,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;AAC7B,SAAA,EAAA,OAAO,CAA8B,CAAA;QAAD,OAAC,OAAA,CAAA;KAAA,CAArB,kBAAkB,CAAG,CAAA,CAAA;AAC3C,IAAA,OAAO,OAAO,CAAC;AACjB;;ACjGA,IAAA,mBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,mBAAA,GAAA;KAQC;AAPC,IAAA,mBAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,OAAO,EAAE,MAAM,EAAA;AAClB,QAAA,OAAO,CAAC,cAAc,GAAG,IAAIC,oCAAqB,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;KAC5F,CAAA;AAED,IAAA,mBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,UAAO,OAAO,EAAE,MAAM,EAAA;KAErB,CAAA;IAPU,mBAAmB,GAAA,UAAA,CAAA;QAD/BC,8BAAe,CAAC,MAAM,CAAC;AACX,KAAA,EAAA,mBAAmB,CAQ/B,CAAA;IAAD,OAAC,mBAAA,CAAA;AAAA,CARD,EAQC;;ACTD,IAAI,mBAAmB,GAAG;AAExB,IAAA,IAAI,EAAC,UAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAA;AACnC,QAAA,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;AACpC,QAAA,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;KAC1B;IAGD,MAAM,EAAA,UAAC,OAAO,EAAE,MAAM,EAAA;AACpB,QAAA,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC;AACpC,QAAA,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;KAC7B;CACF,CAAC;AAIF,IAAA,sBAAA,IAAA,YAAA;AAIE,IAAA,SAAA,sBAAA,GAAA;AACE,QAAA,IAAI,CAAC,IAAI,GAAGlC,0BAAW,CAAC,OAAO,CAAC;KACjC;IANU,sBAAsB,GAAA,UAAA,CAAA;QAFlCmC,qBAAK,CAAC,mBAAmB,CAAC;QAC1BD,8BAAe,CAAC,SAAS,CAAC;AACd,KAAA,EAAA,sBAAsB,CAOlC,CAAA;IAAD,OAAC,sBAAA,CAAA;AAAA,CAPD,EAOC,EAAA;AAID,IAAA,qBAAA,IAAA,YAAA;AAIE,IAAA,SAAA,qBAAA,GAAA;AACE,QAAA,IAAI,CAAC,IAAI,GAAGlC,0BAAW,CAAC,MAAM,CAAC;KAChC;IANU,qBAAqB,GAAA,UAAA,CAAA;QAFjCmC,qBAAK,CAAC,mBAAmB,CAAC;QAC1BD,8BAAe,CAAC,QAAQ,CAAC;AACb,KAAA,EAAA,qBAAqB,CAOjC,CAAA;IAAD,OAAC,qBAAA,CAAA;AAAA,CAPD,EAOC,EAAA;AAID,IAAA,qBAAA,IAAA,YAAA;AAIE,IAAA,SAAA,qBAAA,GAAA;AACE,QAAA,IAAI,CAAC,IAAI,GAAGlC,0BAAW,CAAC,MAAM,CAAC;KAChC;IANU,qBAAqB,GAAA,UAAA,CAAA;QAFjCmC,qBAAK,CAAC,mBAAmB,CAAC;QAC1BD,8BAAe,CAAC,QAAQ,CAAC;AACb,KAAA,EAAA,qBAAqB,CAOjC,CAAA;IAAD,OAAC,qBAAA,CAAA;AAAA,CAPD,EAOC,EAAA;AAID,IAAA,uBAAA,IAAA,YAAA;AAIE,IAAA,SAAA,uBAAA,GAAA;AACE,QAAA,IAAI,CAAC,IAAI,GAAGlC,0BAAW,CAAC,QAAQ,CAAC;KAClC;IANU,uBAAuB,GAAA,UAAA,CAAA;QAFnCmC,qBAAK,CAAC,mBAAmB,CAAC;QAC1BD,8BAAe,CAAC,UAAU,CAAC;AACf,KAAA,EAAA,uBAAuB,CAOnC,CAAA;IAAD,OAAC,uBAAA,CAAA;AAAA,CAPD,EAOC,EAAA;AAID,IAAA,qBAAA,IAAA,YAAA;AAIE,IAAA,SAAA,qBAAA,GAAA;AACE,QAAA,IAAI,CAAC,IAAI,GAAGlC,0BAAW,CAAC,MAAM,CAAC;KAChC;IANU,qBAAqB,GAAA,UAAA,CAAA;QAFjCmC,qBAAK,CAAC,mBAAmB,CAAC;QAC1BD,8BAAe,CAAC,QAAQ,CAAC;AACb,KAAA,EAAA,qBAAqB,CAOjC,CAAA;IAAD,OAAC,qBAAA,CAAA;AAAA,CAPD,EAOC;;ACpED,SAAS,QAAQ,CAAC,QAAQ,EAAA;IAA1B,IAoBC,KAAA,GAAA,IAAA,CAAA;AAnBC,IAAA,IAAI,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC;IAC/B,IAAI,OAAO,GAAG,CAAC,IAAI,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC;AACvC,IAAA,IAAI,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE;AAC1B,QAAA,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC9B,QAAA,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;AACvB,QAAA,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;AACzB,QAAA,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC/B,OAAO;AACR,KAAA;AACD,IAAA,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC1B,IAAA,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI,EAAE;AAC5B,QAAA,KAAK,CAAC,SAAS,GAAG,UAAU,CAC1B,YAAA;AACE,YAAA,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;AACvB,YAAA,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;AACzB,YAAA,KAAI,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AACvC,SAAC,EACD,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC;AAC1B,KAAA;AACH,CAAC;AAGD,IAAA,uBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,uBAAA,GAAA;KAoCC;AAnCC,IAAA,uBAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,OAAO,EAAE,MAAM,EAAE,KAAW,EAAA;AAAX,QAAA,IAAA,KAAA,KAAA,KAAA,CAAA,EAAA,EAAA,KAAW,GAAA,GAAA,CAAA,EAAA;QAE/B,IAAI,gBAAgB,GAAG,cAAc,CAAC;QACtC,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,gBAAgB,GAAG,YAAY,CAAC;AACjC,SAAA;aAAM,IAAI,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,IAAI,KAAKlC,0BAAW,CAAC,MAAM,EAAE;YACtE,gBAAgB,GAAG,cAAc,CAAC;AACnC,SAAA;AAKD,QAAA,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACpD,QAAA,OAAO,CAAC,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAGxD,QAAA,OAAO,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAAC;QAGrC,OAAO,CAAC,aAAa,GAAG;AACtB,YAAA,KAAK,EAAE,KAAK;AACZ,YAAA,IAAI,EAAE,CAAC;AACP,YAAA,SAAS,EAAE,IAAI;SAChB,CAAC;KACH,CAAA;AAGD,IAAA,uBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,UAAO,OAAO,EAAE,MAAM,EAAA;AAEpB,QAAA,IAAI,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC;AAC3D,QAAA,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;AACnD,QAAA,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;AAC/B,QAAA,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;AAC9C,QAAA,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;KAC9B,CAAA;IAnCU,uBAAuB,GAAA,UAAA,CAAA;QADnCkC,8BAAe,CAAC,UAAU,CAAC;AACf,KAAA,EAAA,uBAAuB,CAoCnC,CAAA;IAAD,OAAC,uBAAA,CAAA;AAAA,CApCD,EAoCC;;ACtDD,IAAM,KAAK,GAAG,EAAE,CAAC;AAEjB,SAAS,kBAAkB,CAAC,KAAK,EAAA;IAAjC,IAIC,KAAA,GAAA,IAAA,CAAA;AAHC,IAAA,IAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC;AACjC,IAAA,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC9B,KAAK,CAAC,SAAS,GAAG,UAAU,CAAC,YAAM,EAAA,OAAA,KAAI,CAAC,eAAe,CAAC,KAAK,CAAC,GAAA,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAA;IAAjD,IAgBC,KAAA,GAAA,IAAA,CAAA;AAfC,IAAA,IAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC;AACjC,IAAA,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC9B,IAAA,IAAI,OAAO,KAAK,KAAK,CAAC,qBAAqB,EAAE;AAC3C,QAAA,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAClD,OAAO;AACR,KAAA;AACD,IAAA,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,EAAE;AAC5B,QAAA,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC3B,KAAA;AACD,IAAA,KAAK,CAAC,SAAS,GAAG,UAAU,CAAC,YAAA;AAC3B,QAAA,IAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;AACjC,QAAA,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;QACvB,KAAI,CAAC,eAAe,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AACrD,KAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AAClB,CAAC;AAGD,IAAA,uBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,uBAAA,GAAA;KAmCC;AAlCC,IAAA,uBAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,OAAO,EAAE,MAAM,EAAE,KAAW,EAAA;AAAX,QAAA,IAAA,KAAA,KAAA,KAAA,CAAA,EAAA,EAAA,KAAW,GAAA,GAAA,CAAA,EAAA;AAC/B,QAAA,IAAM,YAAY,GAAG,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC;QACtD,IAAM,gBAAgB,GAAG,YAAY,GAAG,YAAY,GAAG,MAAM,CAAC;QAC9D,IAAM,SAAS,GAAG,YAAY,GAAG,kBAAkB,GAAG,YAAY,CAAC;AACnE,QAAA,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC1B,IAAM,qBAAqB,GAAG,IAAI,KAAKlC,0BAAW,CAAC,MAAM,IAAI,IAAI,KAAKA,0BAAW,CAAC,QAAQ,GAAGoC,4BAAa,GAAGjC,4BAAa,CAAC;AAK3H,QAAA,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACpD,QAAA,OAAO,CAAC,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAGxD,QAAA,OAAO,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;QAGtC,OAAO,CAAC,aAAa,GAAG;AACtB,YAAA,qBAAqB,EAAA,qBAAA;AACrB,YAAA,KAAK,EAAA,KAAA;AACL,YAAA,SAAS,EAAE,CAAC;AACZ,YAAA,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH,CAAA;AAGD,IAAA,uBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,UAAO,OAAO,EAAE,MAAM,EAAA;AAEpB,QAAA,IAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC;AAC7D,QAAA,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;AACnD,QAAA,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;AAC/B,QAAA,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;AAC9C,QAAA,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;KAC9B,CAAA;IAlCU,uBAAuB,GAAA,UAAA,CAAA;QADnC+B,8BAAe,CAAC,UAAU,CAAC;AACf,KAAA,EAAA,uBAAuB,CAmCnC,CAAA;IAAD,OAAC,uBAAA,CAAA;AAAA,CAnCD,EAmCC;;AClED,SAAS,uBAAuB,CAAC,KAAK,EAAA;AACpC,IAAA,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC;AAChG,CAAC;AAED,SAAS,eAAe,CAAC,KAAK,EAAA;AAC5B,IAAA,IAAI,MAAM,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;AAC5C,IAAA,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;QAAE,OAAO;AAAE,KAAA;AACvC,IAAA,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAGD,IAAA,mBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,mBAAA,GAAA;KAaC;AAZC,IAAA,mBAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,OAAO,EAAE,MAAM,EAAA;QAClB,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;AAC/C,YAAA,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;AAC/D,SAAA;AACD,QAAA,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;AACjD,QAAA,OAAO,CAAC,UAAU,GAAG,eAAe,CAAC;KACtC,CAAA;AAED,IAAA,mBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,UAAO,OAAO,EAAE,MAAM,EAAA;AACpB,QAAA,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAC;AACjD,QAAA,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;KACpC,CAAA;IAZU,mBAAmB,GAAA,UAAA,CAAA;QAD/BA,8BAAe,CAAC,MAAM,CAAC;AACX,KAAA,EAAA,mBAAmB,CAa/B,CAAA;IAAD,OAAC,mBAAA,CAAA;AAAA,CAbD,EAaC;;ACzBD,IAAA,eAAA,IAAA,YAAA;AAAA,IAAA,SAAA,eAAA,GAAA;QACE,IAAO,CAAA,OAAA,GAAG,EAAE,CAAC;KAYd;IAVC,eAAM,CAAA,SAAA,CAAA,MAAA,GAAN,UAAO,IAAY,EAAA;QACjB,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO;AACR,SAAA;AACD,QAAA,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,EAAE;YACV,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC/B,4BAAa,CAAC,CAAC;AACjC,SAAA;KACF,CAAA;IACH,OAAC,eAAA,CAAA;AAAD,CAAC,EAAA;;ACXD,IAAA,qBAAA,IAAA,YAAA;AAME,IAAA,SAAA,qBAAA,CAAY,eAAe,EAAA;AACzB,QAAA,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC;KACxC;IALM,qBAAM,CAAA,MAAA,GAAb,cAAkB,OAAO,CAAC,eAAe,CAAC,CAAC,EAAE,CAAA;AAO7C,IAAA,qBAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,OAAO,EAAE,MAAM,EAAA;QAAE,IAAQ,KAAA,GAAA,EAAA,CAAA;aAAR,IAAQ,EAAA,GAAA,CAAA,EAAR,EAAQ,GAAA,SAAA,CAAA,MAAA,EAAR,EAAQ,EAAA,EAAA;YAAR,KAAQ,CAAA,EAAA,GAAA,CAAA,CAAA,GAAA,SAAA,CAAA,EAAA,CAAA,CAAA;;AAC5B,QAAA,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;AACzB,YAAA,MAAM,IAAI,KAAK,CAAC,oIAAoI,CAAC,CAAC;AACvJ,SAAA;AACD,QAAA,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAC3B,QAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AACtB,YAAA,IAAI,MAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACpB,YAAA,IAAI,QAAQ,GAAG,OAAO,CAAC,MAAI,CAAC,KAAK,OAAO,CAAC,MAAI,CAAC,GAAG,EAAE,CAAC,CAAC;AACrD,YAAA,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACvB,YAAA,OAAO,CAAC,UAAU,GAAG,MAAI,CAAC;AAC3B,SAAA;AAAM,aAAA,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;AAC3B,YAAA,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;YACrB,OAAO,CAAC,EAAE,EAAE;AACV,gBAAA,IAAI,MAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACpB,gBAAA,IAAI,QAAQ,GAAG,OAAO,CAAC,MAAI,CAAC,KAAK,OAAO,CAAC,MAAI,CAAC,GAAG,EAAE,CAAC,CAAC;AACrD,gBAAA,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACxB,aAAA;AACD,YAAA,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC;AAC5B,SAAA;AAAM,aAAA;AACL,YAAA,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAC7C,SAAA;KACF,CAAA;AAGD,IAAA,qBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,UAAO,OAAO,EAAE,MAAM,EAAA;AACpB,QAAA,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAC3B,QAAA,IAAI,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC;AAC9B,QAAA,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;AAC1B,QAAA,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI,KAAK,GAAG,IAAI,CAAC;AACjB,YAAA,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;YACrB,OAAO,CAAC,EAAE,EAAE;AACV,gBAAA,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACjB,gBAAA,IAAI,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAC1B,gBAAA,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/C,aAAA;AACF,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAC7B,YAAA,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/C,SAAA;KACF,CAAA;IAlDU,qBAAqB,GAAA,UAAA,CAAA;QADjC+B,8BAAe,CAAC,QAAQ,CAAC;AACb,KAAA,EAAA,qBAAqB,CAmDjC,CAAA;IAAD,OAAC,qBAAA,CAAA;AAAA,CAnDD,EAmDC;;ACpDD,IAAM,kBAAkB,GAAG,0IAA0I,CAAC;AACtK,IAAM,oBAAoB,GAAG,iHAAiH,CAAC;AAG/I,IAAA,4BAAA,IAAA,YAAA;AAAA,IAAA,SAAA,4BAAA,GAAA;KAiCC;AA/BC,IAAA,4BAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,OAAO,EAAE,MAAM,EAAA;QAAE,IAAS,MAAA,GAAA,EAAA,CAAA;aAAT,IAAS,EAAA,GAAA,CAAA,EAAT,EAAS,GAAA,SAAA,CAAA,MAAA,EAAT,EAAS,EAAA,EAAA;YAAT,MAAS,CAAA,EAAA,GAAA,CAAA,CAAA,GAAA,SAAA,CAAA,EAAA,CAAA,CAAA;;AAC7B,QAAA,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AACvB,YAAA,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;AACrC,SAAA;AACD,QAAA,IAAI,OAAO,CAAC,IAAI,KAAKlC,0BAAW,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,KAAKA,0BAAW,CAAC,QAAQ,EAAE;AAChF,YAAA,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACvC,SAAA;AAGD,QAAA,IAAI,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;AACjG,QAAA,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;AAC3B,YAAA,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACvC,SAAA;AACD,QAAA,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC;QAGxC,cAAc,CAAC,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC;AAGhE,QAAA,IAAI,OAAO,GAAG,IAAIqC,8BAAe,CAAC,MAAM,CAAC,CAAC;AAC1C,QAAA,cAAc,CAAC,OAAO,GAAG,OAAO,CAAC;KAClC,CAAA;AAGD,IAAA,4BAAA,CAAA,SAAA,CAAA,MAAM,GAAN,UAAO,OAAO,EAAE,MAAM,EAAA;AACpB,QAAA,IAAI,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;AAE5C,QAAA,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;AACjC,QAAA,cAAc,CAAC,OAAO,GAAG,cAAc,CAAC,eAAe,CAAC;AACxD,QAAA,cAAc,CAAC,eAAe,GAAG,IAAI,CAAC;KACvC,CAAA;IAhCU,4BAA4B,GAAA,UAAA,CAAA;QADxCH,8BAAe,CAAC,eAAe,CAAC;AACpB,KAAA,EAAA,4BAA4B,CAiCxC,CAAA;IAAD,OAAC,4BAAA,CAAA;AAAA,CAjCD,EAiCC;;ACpCK,SAAU,qBAAqB,CAAC,EAKrC,EAAA;QALuC,IAAI,GAAA,EAAA,CAAA,IAAA,EAAE,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,aAAa,GAAA,EAAA,CAAA,aAAA,EAAE,gBAAgB,GAAA,EAAA,CAAA,gBAAA,CAAA;AAQpF,IAAA,IAAA,cAAA,IAAA,YAAA;AAAA,QAAA,SAAA,cAAA,GAAA;SAKC;QAHC,cAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,cAAc,EAAA;AACjB,YAAA,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC;SAC/B,CAAA;QAJG,cAAc,GAAA,UAAA,CAAA;YAFnBhB,+BAAa,CAAC,IAAI,CAAC;YACnBoB,yBAAO,CAAC,OAAO,CAAC;AACX,SAAA,EAAA,cAAc,CAKnB,CAAA;QAAD,OAAC,cAAA,CAAA;AAAA,KALD,EAKC,CAAA,CAAA;AAED,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;QACtDtB,0BAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;AAC5C,KAAA;AAED,IAAA,QAAQ,gBAAgB;AACxB,QAAA,KAAK,MAAM;YACTuB,8BAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;YAC/C,MAAM;AAER,QAAA,KAAK,QAAQ;YACXA,8BAAY,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;YACjD,MAAM;AAER,QAAA,KAAK,EAAE;YACLA,8BAAY,CAAC,cAAc,CAAC,CAAC;YAC7B,MAAM;AAER,QAAA,KAAK,IAAI;YAEP,MAAM;AAER,QAAA;YACEC,wBAAS,CAAC,2BAA2B,CAAC;AACnC,iBAAA,IAAI,CAAC,8EAAA,CAAA,MAAA,CAAyE,gBAAgB,CAAE,CAAC,CAAC;YACrG,MAAM;AACP,KAAA;AAED,IAAA,OAAO,cAAc,CAAC;AACxB;;AC5CM,SAAU,cAAc,CAAC,OAAO,EAAA;AACpC,IAAA,OAAO,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAC7D,CAAC;AAEK,SAAUC,WAAS,CAAC,MAAM,EAAA;IAC9B,IAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAAChE,4BAAU,CAAC,CAAC;AACpD,IAAA,IAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;AAErC,IAAA,UAAU,CAAC,iBAAiB,CAAC,OAAO,EAAE;QACpC,OAAO,EAAE,UAAS,OAAO,EAAA;YACvB,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,UAAA,aAAa,EAAA;;gBACpD,IAAI,aAAa,GAAG,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;gBACpE,IAAM,gBAAgB,GAAkC,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAC9G,gBAAA,IAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;AAErC,gBAAA,IAAI,aAAa,EAAE;oBACjB,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAA,CAAC,EAAA,EAAI,OAAA,CAAC,CAAC,IAAI,EAAE,CAAA,EAAA,CAAC,CAAC;AAC5D,oBAAA,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;AACpD,iBAAA;AAAM,qBAAA;oBACL,aAAa,GAAG,EAAE,CAAC;AACpB,iBAAA;AAED,gBAAA,OAAA,EAAA,GAAA,EAAA,EAAS,GAAC,IAAI,CAAA,GAAG,qBAAqB,CAAC,EAAC,IAAI,EAAA,IAAA,EAAE,OAAO,EAAA,OAAA,EAAE,aAAa,EAAA,aAAA,EAAE,gBAAgB,EAAA,gBAAA,EAAC,CAAC,EAAG,EAAA,CAAA;AAC7F,aAAC,CAAC,CAAC;SACJ;AACF,KAAA,CAAC,CAAC;AACL;;ACYA,SAAS,SAAS,CAAC,MAAW,EAAA;AAC5B,IAAA,4BAA4B,EAAE,CAAC;IAE/B,MAAM,CAAC,eAAe,CACpB,OAAO,EACP,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,KAAK,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,mBAAmB,CACpB,CAAC;IAEFiE,WAA2B,CAAC,MAAM,CAAC,CAAC;IAEpC,IAAI,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,GAAG,CAACjE,4BAAU,CAAC,CAAC;AAClD,IAAA,IAAI,mBAAmB,GAAG;AACxB,QAAA,KAAK,YAAC,OAAO,EAAA;;AACX,YAAA,OAAA,EAAA,GAAA,EAAA,EAAS,GAAC,OAAO,CAAA,GAAG,kBAAkB,CAAC,OAAO,CAAC,EAAG,EAAA,CAAA;SACnD;KACF,CAAC;AACF,IAAA,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG,EAAA,EAAI,OAAA,UAAU,CAAC,iBAAiB,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAA,EAAA,CAAC,CAAC;AACtH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1G,IAAI,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;AACO,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;AAChC,IAAI,IAAI,OAAO,CAAC,KAAK,UAAU,IAAI,CAAC,KAAK,IAAI;AAC7C,QAAQ,MAAM,IAAI,SAAS,CAAC,sBAAsB,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,+BAA+B,CAAC,CAAC;AAClG,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,IAAI,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,EAAE;AAC3C,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AACzF;;ACDA,IAAA,oBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,oBAAA,GAAA;KAEC;IAAD,OAAC,oBAAA,CAAA;AAAD,CAAC,EAAA,CAAA,CAAA;AAKD,IAAA,UAAA,IAAA,YAAA;AAsHE,IAAA,SAAA,UAAA,CACE,OAAgB,EAChB,SAAoB,EACpB,QAAkB,EAClB,MAAc,EACd,WAAwB,EACxB,sBAA8C,EAC9C,iBAAoC,EAAA;AAEpC,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,QAAA,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;AACrD,QAAA,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AAI3C,QAAA,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;AAOtE,QAAA,IAAI,EAAE,oBAAoB,IAAI,sBAAsB,CAAC,EAAE;AACrD,YAAA,sBAAsB,CAAC,kBAAkB,GAAG,IAAI,CAAC;AACjD,YAAA,IAAI,CAAC,8BAA8B,GAAG,sBAAsB,CAAC,MAAM,EAAE,CAAC;AACvE,SAAA;KACF;AAjJM,IAAA,UAAA,CAAA,MAAM,GAAb,YAAA;AACE,QAAA,OAAO,CAACG,cAAG,CAAC,OAAO,EAAEC,oCAAS,EAAEO,0BAAQ,EAAEuD,oBAAM,EAAEC,6BAAW,EAAE1D,wCAAsB,EAAE4B,mCAAiB,CAAC,CAAC;KAC3G,CAAA;IAiJD,UAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,UAAgB,EAAA;AACtB,QAAA,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;KAC9B,CAAA;AAED,IAAA,UAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,cAAmB,EAAE,eAAgC,EAAA;AAGxD,QAAA,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,cAAc,CAAC;AAC1C,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;KACxC,CAAA;AAKD,IAAA,UAAA,CAAA,SAAA,CAAA,OAAO,GAAP,UAAQ,oBAAyB,EAAE,UAAoB,EAAA;QAAvD,IA+DC,KAAA,GAAA,IAAA,CAAA;QA7DC,IAAM,mBAAmB,GAAG,oBAAsD,CAAC;AACnF,QAAA,IAAM,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;AAChD,QAAA,IAAM,cAAc,GAAG,SAAS,CAAC,cAAc,CAAC;AAChD,QAAA,IAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;AACtC,QAAA,IAAM,iBAAiB,GAAG,SAAS,CAAC,iBAAmD,CAAC;AACxF,QAAA,IAAM,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC;QAC5C,IAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC;QAC1D,IAAM,cAAc,GAAG,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;QAEjG,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAuB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAG3E,QAAA,IAAM,iBAAiB,GAAG;YACxB,SAAS,EAAE,cAAc,CAAC,eAAe,IAAI,MAAM,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe;YAC3F,IAAI,EAAE,cAAc,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU;YACvE,KAAK,EAAE,cAAc,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW;AAC3E,YAAA,MAAM,EAAE,mBAAmB,CAAC,SAAS,CAAC,MAAM;AAC5C,YAAA,cAAc,EAAE,cAAc;YAC9B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;AAMF,QAAA,IAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,CAAC;AACnF,QAAA,IAAI,YAAY,IAAI,SAAS,CAAC,IAAI,EAAE;YAClC,YAAY,CAAC,cAAc,CAAC+B,sBAAM,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;AACpG,SAAA;AAGD,QAAA,OAAO,QAAQ;AACZ,aAAA,IAAI,CAAC,cAAc,EAAE,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC;aAGvE,IAAI,CAAC,UAAC,WAA+C,EAAA;AAKpD,YAAA,IAAI,CAAC,KAAI,CAAC,8BAA8B,EAAE;gBACxC,KAAI,CAAC,oCAAoC,GAAG,KAAI,CAAC,sBAAsB,CAAC,UAAU,EAAE,CAAC;AACtF,aAAA;AAED,YAAA,IAAI,iBAAiB,CAAC,SAAS,IAAI,iBAAiB,CAAC,IAAI,EAAE;AACzD,gBAAA,mBAAmB,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AAC3D,aAAA;AAED,YAAA,IAAM,oCAAoC,GAAGzC,qCAAmB,CAAC,OAAO,CACtE,KAAI,CAAC,OAAO,EACZ,SAAS,EACT,WAA0B,CAC3B,CAAC;YACF,mBAAmB,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,oCAAoC,CAAC,CAAC;AAEvG,YAAA,IAAI,UAAU,EAAE;AACd,gBAAA,OAAO,IAAI,CAAC;AACb,aAAA;AAED,YAAA,KAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;AACjC,SAAC,CAAC,CAAC;KACN,CAAA;IAED,UAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,oBAAyB,EAAA;QAA9B,IAgFC,KAAA,GAAA,IAAA,CAAA;QA9EC,IAAM,mBAAmB,GAAmC,oBAAoB,CAAC;AACjF,QAAA,IAAM,kBAAkB,GAAG,mBAAmB,CAAC,UAAU,CAAC;AAC1D,QAAA,IAAM,iBAAiB,GAAG,mBAAmB,CAAC,iBAAiB,CAAC;AAChE,QAAA,IAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC;AAG/B,QAAA,IAAM,IAAI,GAAG,YAAA;AACX,YAAA,IAAM,YAAY,GAAG0C,gCAAc,CAAC,KAAI,CAAC,SAAS,CAAC,IAAIA,gCAAc,CAAC,KAAK,CAAC;AAC5E,YAAA,IAAM,QAAQ,GAAG,KAAI,CAAC,QAAQ,CAAC;YAE/B,YAAY,CACV,QAAQ,EACR,YAAY,EACZ,cAAM,OAAA,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAI,CAAC,IAAI,CAAC,CAAC,CAAA,EAAA,CAC/C,CAAC,IAAI,CAAC,YAAA;gBACL,KAAI,CAAC,OAAO,EAAE,CAAC;AACjB,aAAC,CAAC,CAAC;AACL,SAAC,CAAC;QAGF,IAAM,KAAK,GAAG,UAAC,wBAA8B,EAAA;YAC3C,kBAAkB,CAAC,QAAQ,CAAC,KAAI,CAAC,eAAe,EAAE,wBAAwB,CAAC,CAAC;AAC5E,YAAA,IAAM,yBAAyB,GAAG,KAAI,CAAC,oCAAoC,CAAC;AAM5E,YAAA,IAAI,yBAAyB,EAAE;AAC7B,gBAAA,OAAO,yBAAyB;AAC7B,qBAAA,0BAA0B,EAAE;AAC5B,qBAAA,IAAI,CAAC,YAAA;AACJ,oBAAA,KAAI,CAAC,oCAAoC,GAAG,IAAI,CAAC;oBACjD,OAAO,IAAI,EAAE,CAAC;AAChB,iBAAC,CAAC,CAAC;AACN,aAAA;YAGD,OAAO,IAAI,EAAE,CAAC;AAChB,SAAC,CAAC;AAIF,QAAA,IAAI,iBAAiB,EAAE;AACrB,YAAA,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE;AAGhC,gBAAA,iBAAiB,CAAC,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC1D,aAAA;YAGD,OAAO,IAAI,CAAC,iBAAiB;iBAI1B,gBAAgB,CAAC,iBAAuC,CAAC;iBACzD,IAAI,CAAC,UAAC,gBAA4B,EAAA;AACjC,gBAAA,IAAM,UAAU,GAAG,gBAAgB,CAAC,IAAI,CAAC;AACzC,gBAAAC,2BAAS,CAAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;AAG9F,gBAAA,gBAAgB,CAAC,QAAQ,CAACxB,oCAAqB,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,KAAI,CAAC,UAAU,CAAC,CAAC;gBAC/F,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;gBAClD,OAAO,UAAU,IAAI,gBAAgB,CAAC;AACxC,aAAC,CAAC;iBACD,IAAI,CAAC,UAAC,OAA0B,EAAA;AAC/B,gBAAA,KAAI,CAAC,IAAI,GAAG,OAAe,CAAC;AAC5B,gBAAA,OAAO,KAAK,CAAC,OAAe,CAAC,CAAC;AAChC,aAAC,CAAC,CAAC;AACN,SAAA;AAMD,QAAA,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC;AAEpC,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KAC/B,CAAA;AAOD,IAAA,UAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;AACE,QAAA,IAAM,QAAQ,GAAG,IAAI,CAAC,8BAA8B,CAAC;AACrD,QAAA,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,IAAI,EAAE,CAAC;AAChB,YAAA,IAAI,CAAC,8BAA8B,GAAG,IAAI,CAAC;AAC5C,SAAA;KACF,CAAA;IArTM,UAAK,CAAA,KAAA,GAAsB,IAAI,CAAC;AAIhC,IAAA,UAAA,CAAA,SAAS,GAA0B;AACxC,QAAA,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,yBAAyB,CAAQ;KAC3G,CAAC;IA+SJ,OAAC,UAAA,CAAA;AAAA,CAnUD,EAmUC,EAAA;AAKD,IAAA,iBAAA,IAAA,YAAA;AAWE,IAAA,SAAA,iBAAA,GAAA;QAAA,IAEC,KAAA,GAAA,IAAA,CAAA;AADC,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,UAAC,OAAO,EAAA,EAAK,OAAA,KAAI,CAAC,OAAO,GAAG,OAAO,CAAtB,EAAsB,CAAC,CAAC;KACjE;AAMD,IAAA,iBAAA,CAAA,SAAA,CAAA,WAAW,GAAX,YAAA;QACE,OAAO,IAAI,CAAC,OAAO,CAAC;KACrB,CAAA;IAGD,iBAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,UAAsB,EAAA;AAC5B,QAAA,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;KAC1B,CAAA;IACH,OAAC,iBAAA,CAAA;AAAD,CAAC,EAAA;;AC9XD,IAAA,UAAA,IAAA,YAAA;AAAA,IAAA,SAAA,UAAA,GAAA;KAA2B;IAAD,OAAC,UAAA,CAAA;AAAD,CAAC,EAAA,CAAA,CAAA;AAC3ByB,4BAAU,CAAC,uBAAuB,CAAC,CAAC,UAAU,CAAC,CAAC;AAKhD,IAAA,qBAAA,IAAA,UAAA,MAAA,EAAA;IAA2C,SAAW,CAAA,qBAAA,EAAA,MAAA,CAAA,CAAA;AAQpD,IAAA,SAAA,qBAAA,CACE,iBAAoC,EAAA;AADtC,QAAA,IAAA,KAAA,GAGE,iBAAO,IAER,IAAA,CAAA;AADC,QAAA,KAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;;KAC5C;AAOD,IAAA,qBAAA,CAAA,SAAA,CAAA,gBAAgB,GAAhB,UAAiB,MAAc,EAAE,MAAmB,EAAA;AAClD,QAAA,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM,EAAA;AACjC,YAAA,IAAI,SAAmC,CAAC;YACxC,IAAI,UAAU,IAAI,MAAM,EAAE;AACxB,gBAAA,IAAI,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;gBAC/B,IAAI,QAAQ,KAAK,IAAI,EAAE;oBACrB,SAAS,GAAG,UAAU,CAAC;AACxB,iBAAA;AAAM,qBAAA;oBAIL,QAAQ,GAAG7D,0BAAc,CAAC,QAAQ,EAAE0D,sBAAM,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;AACjG,oBAAA,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;AAC5B,wBAAA,SAAS,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AAC1C,qBAAA;AAAM,yBAAA;wBACL,SAAS,GAAG,QAAQ,CAAC;AACtB,qBAAA;AACF,iBAAA;AACD,gBAAA,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;AAC3B,aAAA;AAED,YAAA,MAAM,CAAC,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC,CAAC;AAClE,SAAC,CAAC,CAAC;KACJ,CAAA;IAOD,qBAAoB,CAAA,SAAA,CAAA,oBAAA,GAApB,UAAqB,MAAc,EAAA;QACjC,IAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;AAEtD,QAAA,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;QACpD,cAAc,CAAC,cAAc,GAAG,YAAA;AAC9B,YAAA,IAAI,WAAmB,CAAC;YAExB,cAAc,CAAC,eAAe,CAC5BF,oBAAM,EACN,YAAM,EAAA,OAAA,WAAW,KAAK,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAA,EAAA,CACxE,CAAC;AAEF,YAAA,OAAO,cAAc,CAAC,GAAG,CAACA,oBAAM,CAAC,CAAC;AACpC,SAAC,CAAC;AACF,QAAA,OAAO,cAAc,CAAC;KACvB,CAAA;AAMD,IAAA,qBAAA,CAAA,SAAA,CAAA,SAAS,GAAT,UAAU,MAAc,EAAE,MAAmB,EAAE,cAAqC,EAAA;QAApF,IASC,KAAA,GAAA,IAAA,CAAA;AARC,QAAA,OAAO,IAAI;AACR,aAAA,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC;aAChC,IAAI,CAAC,UAAA,SAAS,EAAI,EAAA,OAAA,KAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC;AACxD,YAAA,SAAS,EAAE,SAAS;AACpB,YAAA,cAAc,EAAE,KAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC;AACjD,YAAA,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,YAAY;AACxC,YAAA,MAAM,EAAE,MAAM;SACO,CAAC,CAAA,EAAA,CAAC,CAAC;KAC7B,CAAA;AA7EM,IAAA,qBAAA,CAAA,MAAM,GAAG,CAAC7B,mCAAiB,CAAC,CAAC;IA8EtC,OAAC,qBAAA,CAAA;CAAA,CAjF0CmC,yBAAW,CAiFrD,EAAA;AAGK,SAAU,kBAAkB,CAAC,QAAgB,EAAA;IACjD,IAAM,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpD,IAAA,IAAA,YAAA,IAAA,YAAA;AAAA,QAAA,SAAA,YAAA,GAAA;SAOC;QAHC,YAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,cAAmB,EAAA;AACtB,YAAA,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC;SAC/B,CAAA;QACH,OAAC,YAAA,CAAA;AAAD,KAAC,EAAA,CAAA,CAAA;AAED,IAAA/B,+BAAa,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;AAClC,IAAAoB,yBAAO,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;AAEhC,IAAA,OAAO,YAAY,CAAC;AACtB;;AC7GA,IAAM,MAAM,GAAGvC,qBAAU,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;AAKlD,IAAA,SAAA,IAAA,YAAA;IAiDE,SACE,SAAA,CAAA,MAAc,EACd,OAAgB,EAAA;AAEhB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,QAAA,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;KACzB;AArDM,IAAA,SAAA,CAAA,MAAM,GAAb,YAAA;AACE,QAAA,OAAO,CAAC4C,oBAAM,EAAE/D,cAAG,CAAC,OAAO,CAAC,CAAC;KAC9B,CAAA;AAqDD,IAAA,SAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,YAAA;AACE,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,aAAa,EAAE,CAAC;KACtB,CAAA;AAED,IAAA,SAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;KACvB,CAAA;AAED,IAAA,SAAA,CAAA,SAAA,CAAA,gBAAgB,GAAhB,UAAiB,KAAU,EAAE,QAAa,EAAA;AACxC,QAAA,IAAI,QAAQ,EAAE;AACZ,YAAA,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;AACxC,SAAA;AAED,QAAA,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;KAC7B,CAAA;AAED,IAAA,SAAA,CAAA,SAAA,CAAA,aAAa,GAAb,YAAA;QAAA,IAwBC,KAAA,GAAA,IAAA,CAAA;QAvBC,OAAO,IAAI,CAAC,MAAM;AACf,aAAA,gBAAgB,EAAE;AAClB,aAAA,IAAI,CAAC,YAAA;AACJ,YAAA,IAAI,CAAC,KAAI,CAAC,QAAQ,EAAE;AAElB,gBAAA,OAAO,IAAI,CAAC;AACb,aAAA;AACD,YAAA,IAAM,OAAO,GAAG,KAAI,CAAC,OAAgC,CAAC;AAEtD,YAAA,IAAM,IAAI,GAAG,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,MAAM,CAAC,CAAC;AAE3D,YAAA,IAAI,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE;AACzB,gBAAA,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,KAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;AACxD,aAAA;AAAM,iBAAA;gBACL,OAAO,CAAC,YAAY,CAAC,KAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC5C,aAAA;AAGD,YAAA,OAAO,IAAI,CAAC;AACd,SAAC,CAAC;aACD,KAAK,CAAC,UAAC,MAAW,EAAA;AACjB,YAAA,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACvB,SAAC,CAAC,CAAC;KACN,CAAA;AAzFM,IAAA,SAAA,CAAA,SAAS,GAA0B;AACxC,QAAA,IAAI,EAAE,WAAW;AACjB,QAAA,IAAI,EAAE,YAAY;AAClB,QAAA,SAAS,EAAE;YACT,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE;AACxE,YAAA,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE;YAClD,WAAW;AACL,SAAA;KACT,CAAC;IAkFJ,OAAC,SAAA,CAAA;AAAA,CApGD,EAoGC;;ACxGK,SAAU,SAAS,CAAC,MAA+B,EAAA;IACvD,MAAM;AACH,SAAA,SAAS,CAACqE,yBAAW,EAAE,qBAAqB,CAAC;AAC7C,SAAA,SAAS,CAACN,oBAAM,EAAEO,uBAAS,CAAC;AAC5B,SAAA,eAAe,CACd,UAAU,EACV,SAAS,CACV,CAAC;IAEJ,MAAM,CAAC,SAAS,CAAC,aAAa,CAACP,oBAAM,EAAEO,uBAAS,CAAC,CAAC;AACpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACFA,IAAA,aAAA,IAAA,YAAA;AASE,IAAA,SAAA,aAAA,CAAY,OAAoB,EAAA;AAC9B,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,QAAA,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;KACzB;IAGD,aAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,OAAqB,EAAA;AACnC,QAAA,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;AACpF,QAAA,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACrD,CAAA;IAGD,aAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,OAAqB,EAAA;AACnC,QAAA,IAAI,KAAK,CAAC;QACV,IAAI,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAC1D,QAAA,IAAI,aAAa,EAAE;AACjB,YAAA,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACvC,YAAA,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE;AACd,gBAAA,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AAChC,aAAA;AACF,SAAA;AACD,QAAA,OAAO,OAAO,CAAC;KAChB,CAAA;IASD,aAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,SAAiB,EAAE,MAAmB,EAAE,OAAc,EAAE,UAAiB,EAAA;AAAtD,QAAA,IAAA,MAAA,KAAA,KAAA,CAAA,EAAA,EAAA,MAAmB,GAAA,EAAA,CAAA,EAAA;AAAE,QAAA,IAAA,OAAA,KAAA,KAAA,CAAA,EAAA,EAAA,OAAc,GAAA,IAAA,CAAA,EAAA;AAAE,QAAA,IAAA,UAAA,KAAA,KAAA,CAAA,EAAA,EAAA,UAAiB,GAAA,IAAA,CAAA,EAAA;AAC/E,QAAA,IAAI,KAAK,GAAGtE,cAAG,CAAC,iBAAiB,CAAC,SAAS,EAAE,EAAC,UAAU,EAAA,UAAA,EAAE,OAAO,EAAA,OAAA,EAAE,MAAM,EAAA,MAAA,EAAC,CAAC,CAAC;AAC5E,QAAA,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;KACnC,CAAA;AAMD,IAAA,aAAA,CAAA,SAAA,CAAA,SAAS,GAAT,UAAU,SAAiB,EAAE,OAAiB,EAAE,gBAAoD,EAAA;AAClG,QAAA,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;YACjC,IAAI,gBAAgB,KAAK,SAAS,EAAE;AAClC,gBAAA,gBAAgB,GAAG,aAAa,CAAC,sBAAsB,CAAC;AACzD,aAAA;AACD,YAAA,IAAM,YAAY,GAAG,IAAI,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;AAC7F,YAAA,OAAO,YAAY,CAAC;AACrB,SAAA;AAED,QAAA,OAAO,SAAS,CAAC;KAClB,CAAA;AAMD,IAAA,aAAA,CAAA,SAAA,CAAA,aAAa,GAAb,UAAc,SAAiB,EAAE,OAAiB,EAAE,gBAAoD,EAAA;AACtG,QAAA,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;YACjC,IAAI,gBAAgB,KAAK,SAAS,EAAE;AAClC,gBAAA,gBAAgB,GAAG,aAAa,CAAC,sBAAsB,CAAC;AACzD,aAAA;AACD,YAAA,IAAM,YAAY,GAAG,IAAI,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC;AAC5F,YAAA,OAAO,YAAY,CAAC;AACrB,SAAA;AAED,QAAA,OAAO,SAAS,CAAC;KAClB,CAAA;IAMD,aAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,SAAiB,EAAA;AACvB,QAAA,IAAI,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YAC9C,IAAI,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;AAClD,YAAA,IAAI,aAAa,EAAE;gBACjB,OAAO,aAAa,CAAC,MAAM,EAAE;AAC3B,oBAAA,IAAI,YAAY,GAAG,aAAa,CAAC,GAAG,EAAE,CAAC;AACvC,oBAAA,IAAI,YAAY,EAAE;wBAChB,YAAY,CAAC,OAAO,EAAE,CAAC;AACxB,qBAAA;AACF,iBAAA;AACF,aAAA;AACF,SAAA;AAAM,aAAA;YACL,IAAI,CAAC,UAAU,EAAE,CAAC;AACnB,SAAA;KACF,CAAA;AAKD,IAAA,aAAA,CAAA,SAAA,CAAA,UAAU,GAAV,YAAA;AACE,QAAA,KAAK,IAAI,GAAG,IAAI,IAAI,CAAC,aAAa,EAAE;AAClC,YAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACnB,SAAA;KACF,CAAA;IAvGM,aAAsB,CAAA,sBAAA,GAAsC,IAAI,CAAC;IAwG1E,OAAC,aAAA,CAAA;AAAA,CAzGD,EAyGC,EAAA;AAED,IAAA,gBAAA,IAAA,YAAA;IAQE,SAAY,gBAAA,CAAA,KAAoB,EAAE,SAAiB,EAAE,OAAiB,EAAE,gBAAgD,EAAE,IAAa,EAAA;AACrI,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AAEvB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,gBAAgB,KAAK,SAAS,GAAG,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC;AACnG,QAAA,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;AAC7B,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AACzC,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAClE,QAAA,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;KAC7B;IAED,gBAAW,CAAA,SAAA,CAAA,WAAA,GAAX,UAAY,CAAQ,EAAA;AAElB,QAAA,IAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACxB,EAAE,CAAC,CAAC,CAAC,CAAC;QACN,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,OAAO,EAAE,CAAC;AAChB,SAAA;KACF,CAAA;AAED,IAAA,gBAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;AACE,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;AACpF,QAAA,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;KAClC,CAAA;IACH,OAAC,gBAAA,CAAA;AAAD,CAAC,EAAA,CAAA;;ACtJD,IAAA,mBAAA,IAAA,YAAA;AAME,IAAA,SAAA,mBAAA,GAAA;AACE,QAAA,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;KACxB;IAMD,mBAAa,CAAA,SAAA,CAAA,aAAA,GAAb,UAAc,GAAW,EAAA;AACvB,QAAA,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;KAC/B,CAAA;IAMD,mBAAa,CAAA,SAAA,CAAA,aAAA,GAAb,UAAc,GAAW,EAAA;AACvB,QAAA,OAAO,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC;KACjC,CAAA;IACH,OAAC,mBAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAKD,IAAA,sBAAA,IAAA,YAAA;IAeE,SAAY,sBAAA,CAAA,eAAuB,EAAE,gBAAwB,EAAA;AAAjD,QAAA,IAAA,eAAA,KAAA,KAAA,CAAA,EAAA,EAAA,eAAuB,GAAA,KAAA,CAAA,EAAA;AAAE,QAAA,IAAA,gBAAA,KAAA,KAAA,CAAA,EAAA,EAAA,gBAAwB,GAAA,KAAA,CAAA,EAAA;AAC3D,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AACzC,QAAA,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;KAChC;AAXM,IAAA,sBAAA,CAAA,MAAM,GAAG,IAAI,sBAAsB,EAAE,CAAC;IAY/C,OAAC,sBAAA,CAAA;AAAA,CApBD,EAoBC,EAAA;AAsBD,IAAA,mBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,mBAAA,GAAA;KAqGC;AA/DQ,IAAA,mBAAA,CAAA,OAAO,GAAd,YAAA;AACE,QAAA,IAAI,WAAW,GAAG,IAAI,mBAAmB,EAAE,CAAC;AAC5C,QAAA,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;AAC3B,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;AAQM,IAAA,mBAAA,CAAA,QAAQ,GAAf,UAAgB,IAA0B,EAAE,UAAkB,EAAA;AAC5D,QAAA,IAAI,WAAW,GAAG,IAAI,mBAAmB,EAAE,CAAC;AAC5C,QAAA,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;AACxB,QAAA,WAAW,CAAC,UAAU,GAAG,UAAU,IAAI,EAAE,CAAC;AAC1C,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;AAQM,IAAA,mBAAA,CAAA,OAAO,GAAd,UAAe,IAAU,EAAE,IAA0B,EAAA;AACnD,QAAA,IAAI,WAAW,GAAG,IAAI,mBAAmB,EAAE,CAAC;AAC5C,QAAA,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;AACxB,QAAA,WAAW,CAAC,UAAU,GAAG,EAAE,CAAC;AAC5B,QAAA,WAAW,CAAC,iBAAiB,GAAG,EAAG,IAAgB,CAAC,YAAY,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC;AACzG,QAAA,WAAW,CAAC,mBAAmB,GAAG,IAAI,CAAC;AACvC,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;AAQM,IAAA,mBAAA,CAAA,SAAS,GAAhB,UAAiB,QAAgB,EAAE,IAA2B,EAAA;AAC5D,QAAA,IAAI,WAAW,GAAG,IAAI,mBAAmB,EAAE,CAAC;AAC5C,QAAA,WAAW,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAChC,QAAA,WAAW,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC;AAChC,QAAA,WAAW,CAAC,UAAU,GAAG,EAAE,CAAC;AAC5B,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;AASM,IAAA,mBAAA,CAAA,OAAO,GAAd,UAAe,IAAa,EAAE,SAAiB,EAAE,WAAwB,EAAA;AACvE,QAAA,IAAI,WAAW,GAAG,IAAI,mBAAmB,EAAE,CAAC;AAC5C,QAAA,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;AACxB,QAAA,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC;AAClC,QAAA,WAAW,CAAC,WAAW,GAAG,WAAW,CAAC;AACtC,QAAA,WAAW,CAAC,qBAAqB,GAAG,IAAI,CAAC;AACzC,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;AApEM,IAAA,mBAAA,CAAA,MAAM,GAAwB,IAAI,mBAAmB,EAAE,CAAC;IAqEjE,OAAC,mBAAA,CAAA;AAAA,CArGD,EAqGC,EAAA;AAED,IAAM,OAAO,GAAG,mBAAmB,CAAC,SAAS,CAAC;AAC9C,OAAO,CAAC,mBAAmB,GAAG,KAAK,CAAC;AACpC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;AACxB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;AAChC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;AAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;AAChC,OAAO,CAAC,qBAAqB,GAAG,KAAK,CAAC;AACtC,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;AAC9B,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;AACzB,OAAO,CAAC,iBAAiB,GAAG,KAAK,CAAC;AAClC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AACpB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;AAC1B,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AACpB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;AACxB,OAAO,CAAC,qBAAqB,GAAG,KAAK,CAAC;AAKtC,IAAA,iBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,iBAAA,GAAA;KAoIC;IA1FQ,iBAAU,CAAA,UAAA,GAAjB,UAAkB,gBAAwB,EAAA;AACxC,QAAA,IAAI,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAC1C,QAAA,WAAW,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AAChD,QAAA,WAAW,CAAC,UAAU,GAAG,IAAI,CAAC;AAC9B,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;IAOM,iBAAiB,CAAA,iBAAA,GAAxB,UAAyB,UAAU,EAAA;AACjC,QAAA,IAAI,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAC1C,QAAA,WAAW,CAAC,iBAAiB,GAAG,UAAU,CAAC;AAC3C,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;IAYM,iBAAU,CAAA,UAAA,GAAjB,UAAkB,WAA0B,EAAA;AAC1C,QAAA,IAAI,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAC1C,QAAA,WAAW,CAAC,WAAW,GAAG,WAAW,CAAC;AACtC,QAAA,WAAW,CAAC,UAAU,GAAG,IAAI,CAAC;AAC9B,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;AAQM,IAAA,iBAAA,CAAA,OAAO,GAAd,UAAe,gBAAwB,EAAE,kBAAuC,EAAA;AAC9E,QAAA,IAAI,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAC1C,QAAA,WAAW,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AAChD,QAAA,WAAW,CAAC,WAAW,GAAG,iBAAiB,CAAC,aAAa,CAAC;AAC1D,QAAA,WAAW,CAAC,oBAAoB,GAAG,CAAC,kBAAkB,CAAC,CAAC;AACxD,QAAA,WAAW,CAAC,WAAW,GAAG,kBAAkB,CAAC,WAAW,CAAC;QACzD,WAAW,CAAC,SAAS,GAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzD,QAAA,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;AAC3B,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;AAYM,IAAA,iBAAA,CAAA,MAAM,GAAb,UAAc,UAAkB,EAAE,gBAAwB,EAAE,SAA0B,EAAE,oBAAgD,EAAE,WAA0B,EAAE,kBAAuC,EAAA;AAC3M,QAAA,IAAI,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAC1C,QAAA,WAAW,CAAC,UAAU,GAAG,UAAU,CAAC;AACpC,QAAA,WAAW,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AAChD,QAAA,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC;AAClC,QAAA,WAAW,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;AACxD,QAAA,WAAW,CAAC,WAAW,GAAG,WAAW,CAAC;AACtC,QAAA,WAAW,CAAC,iBAAiB,GAAG,kBAAkB,GAAG,kBAAkB,CAAC,iBAAiB,GAAG,IAAI,CAAC;AACjG,QAAA,WAAW,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AACpD,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;IAUM,iBAAS,CAAA,SAAA,GAAhB,UAAiB,SAA0B,EAAE,oBAAgD,EAAE,WAA0B,EAAE,MAAc,EAAA;AACvI,QAAA,IAAI,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAC1C,QAAA,WAAW,CAAC,WAAW,GAAG,WAAW,CAAC;AACtC,QAAA,WAAW,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;AACxD,QAAA,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC;AAClC,QAAA,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC;AAC5B,QAAA,OAAO,WAAW,CAAC;KACpB,CAAA;AAjGM,IAAA,iBAAA,CAAA,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAa,CAAC;IAkGvD,OAAC,iBAAA,CAAA;AAAA,CApID,EAoIC,EAAA;AAED,IAAM,OAAO,GAAG,iBAAiB,CAAC,SAAS,CAAC;AAE5C,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;AAC1B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;AAEhC,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC;AAC3B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;AACxB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;AAEnC,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;AACjC,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC;AAE3B,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;AAC3B,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;AAC3B,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;AAEzB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;AAE3B,OAAO,CAAC,iBAAiB,GAAG,KAAK,CAAC;AAClC,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;AAClC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;AAExB,OAAO,CAAC,MAAM,GAAG,IAAI;;ACpWrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAwCA;AACO,SAAS,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE;AAC1D,IAAI,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;AACjI,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AACnI,SAAS,KAAK,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;AACtJ,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAClE;;AC3DA,IAAM,cAAc,GAAG,UAAU,CAAC;AAElC,SAAS,iBAAiB,CAAC,IAAY,EAAA;AACrC,IAAA,OAAO,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAEK,SAAU,UAAU,CAAC,IAAY,EAAA;IACrC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;AACnG,CAAC;AAKK,SAAU,gBAAgB,CAAC,IAAS,EAAA;AAExC,IAAA,OAAO,EAAE,IAAI,CAAC,qBAAqB,KAAK,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AAChF;;ACTA,IAAA,wBAAA,IAAA,YAAA;IAkCE,SAAY,wBAAA,CAAA,SAAoB,EAAE,GAAW,EAAE,YAAoB,EAAE,cAAwB,EAAE,YAAkB,EAAA;AAC/G,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;AACf,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;AACjC,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;AACtB,QAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;AACxB,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC;KAClD;AAKD,IAAA,wBAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;QACE,OAAO,IAAI,CAAC,YAAY,CAAC;KAC1B,CAAA;IAMD,wBAAQ,CAAA,SAAA,CAAA,QAAA,GAAR,UAAS,QAAa,EAAA;AACpB,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;QAEjC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE;AAClC,YAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,YAAA,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC;AAE7B,YAAA,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,EAAE;AACrC,gBAAA,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;oBAC3B,IAAI,CAAC,IAAI,EAAE,CAAC;AACb,iBAAA;AAAM,qBAAA;AACL,oBAAA,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;AACvB,oBAAA,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACrC,iBAAA;AACF,aAAA;AACF,SAAA;KACF,CAAA;AAKD,IAAA,wBAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,YAAA;AACE,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC7B,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;AAEjC,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,IAAI,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE;YACjC,OAAO;AACR,SAAA;QAED,IAAI,IAAI,CAAC,cAAc,EAAE;AACvB,YAAA,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACzC,SAAA;AAED,QAAA,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACzC,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;KAC1B,CAAA;AAGD,IAAA,wBAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,QAAa,EAAE,QAAa,EAAA;AAC1C,QAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C,CAAA;AAOD,IAAA,wBAAA,CAAA,SAAA,CAAA,SAAS,GAAT,UAAU,OAAY,EAAE,QAAkB,EAAA;AACxC,QAAA,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;KACvC,CAAA;AAGD,IAAA,wBAAA,CAAA,SAAA,CAAA,aAAa,GAAb,UAAc,OAAY,EAAE,QAAkB,EAAA;AAC5C,QAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C,CAAA;AAOD,IAAA,wBAAA,CAAA,SAAA,CAAA,WAAW,GAAX,UAAY,OAAY,EAAE,QAAkB,EAAA;AAC1C,QAAA,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;KAC1C,CAAA;AAED,IAAA,wBAAA,CAAA,SAAA,CAAA,gBAAgB,GAAhB,UAAiB,OAAY,EAAE,QAAkB,EAAA;AAC/C,QAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C,CAAA;IA5HU,wBAAwB,GAAA,UAAA,CAAA;AADpC,QAAAuE,mCAAoB,EAAE;AACV,KAAA,EAAA,wBAAwB,CA6HpC,CAAA;IAAD,OAAC,wBAAA,CAAA;AAAA,CA7HD,EA6HC;;AC5HD,SAAS,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAA;AACjC,IAAA,IAAI,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC;IAEpC,IAAI,MAAM,KAAK,SAAS,EAAE;QAOxB,IAAI,IAAI,GAAG,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC;AACvD,QAAA,IAAI,QAAQ,GAAGC,wBAAQ,CAAC,GAAG,CAACA,wBAAQ,CAAC,QAAQ,EAAE,IAAI,CAAyB,CAAC;AAC7E,QAAA,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;AAC3B,YAAA,QAAQ,CAAC,UAAU,CAACvE,oCAAS,CAAC,QAAQ,IAAI,IAAIA,oCAAS,EAAE,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;AAClF,SAAA;QAED,MAAM,GAAG,QAAQ,CAAC,eAAe,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC;AACvE,QAAA,QAAQ,CAAC,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACrD,KAAA;AAED,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC;AAKD,IAAA,gBAAA,IAAA,YAAA;AAqCE,IAAA,SAAA,gBAAA,CAAY,YAA6B,EAAA;AACvC,QAAA,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE;AACpC,YAAA,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;AAC1B,SAAA;AAAM,aAAA;AACL,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AACnC,SAAA;AAED,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzD,QAAA,IAAI,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;AACjD,QAAA,IAAI,kBAAkB,KAAK,IAAI,IAAI,kBAAkB,KAAK,SAAS,EAAE;AACnE,YAAA,IAAI,CAAC,kBAAkB,GAAGmB,0BAAW,CAAC,MAAM,CAAC;AAC9C,SAAA;AAAM,aAAA,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE;YAEjD,IAAI,CAAC,kBAAkB,GAAGA,0BAAW,CAAC,kBAAkB,CAAC,IAAIA,0BAAW,CAAC,MAAM,CAAC;AACjF,SAAA;QACD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC;AAChD,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AAClB,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;KACxB;AAQD,IAAA,gBAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,UAAa,MAAgB,EAAE,QAA8B,EAAE,UAAmB,EAAA;AAChF,QAAA,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;AAC3C,QAAA,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;AAEtB,QAAA,IAAI,UAAU,EAAE;AACd,YAAA,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;AAC7B,YAAA,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAiB,CAAoB,CAAC;AACxE,SAAA;AAED,QAAA,OAAO,SAAS,CAAC;KAClB,CAAA;IAGD,gBAAoB,CAAA,SAAA,CAAA,oBAAA,GAApB,UAAqB,UAAqD,EAAA;AACxE,QAAA,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AAErB,QAAA,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC;AAC/B,QAAA,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC;QAE7B,IAAI,aAAa,IAAI,UAAU,EAAE;AAC/B,YAAA,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,WAAW,CAAC;YAC3C,OAAO,UAAU,CAAC,WAAW,CAAC;YAC9B,OAAO,UAAU,CAAC,QAAQ,CAAC;AAC5B,SAAA;QAED,IAAI,OAAO,IAAI,UAAU,EAAE;AACzB,YAAA,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC;YACrC,OAAO,UAAU,CAAC,KAAK,CAAC;YACxB,OAAO,UAAU,CAAC,QAAQ,CAAC;AAC5B,SAAA;QAED,UAAU,CAAC,GAAG,GAAG,YAAA;YACf,OAAO,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC5C,SAAC,CAAC;AAEF,QAAA,UAAU,CAAC,GAAG,GAAG,UAAS,KAAK,EAAA;YAC7B,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1C,SAAC,CAAC;AAED,QAAA,UAAU,CAAC,GAAgC,CAAC,WAAW,GAAG,UAAS,GAAG,EAAA;AACrE,YAAA,OAAO,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAChC,SAAC,CAAC;AAEF,QAAA,OAAO,UAAU,CAAC;KACnB,CAAA;AAQD,IAAA,gBAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,MAAgB,EAAE,QAA8B,EAAA;AACvD,QAAA,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AACrB,QAAA,IAAI,WAAW,CAAC;AAEhB,QAAA,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;AAC/B,YAAA,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;AAC/B,YAAA,IAAI,WAAW,IAAI,MAAM,CAAC,SAAS,EAAE;AACnC,gBAAA,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC;AAClC,aAAA;AACF,SAAA;AAED,QAAA,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE;AAG5B,YAAA,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9E,SAAA;KACF,CAAA;IAOD,gBAAc,CAAA,SAAA,CAAA,cAAA,GAAd,UAAe,SAAiB,EAAA;QAC9B,IAAI,cAAc,GAAG,IAAI,CAAC;AAC1B,QAAA,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;AACrC,QAAA,IAAI,iBAAiB,GAAG,IAAI,CAAC,aAAa,CAAC;AAC3C,QAAA,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;AACrB,QAAA,IAAI,YAAY,CAAC;QAEjB,IAAI,IAAI,CAAC,UAAU,EAAE;AACnB,YAAA,OAAO,SAAS,CAAC;AAClB,SAAA;QAED,IAAI,iBAAiB,IAAI,SAAS,EAAE;YAClC,IAAI,iBAAiB,IAAI,SAAS,EAAE;AAClC,gBAAA,cAAc,GAAG,UAAC,QAAQ,EAAE,QAAQ,EAAA;oBAClC,SAAS,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAChD,SAAsC,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACpF,iBAAC,CAAC;AACH,aAAA;AAAM,iBAAA;AACL,gBAAA,cAAc,GAAG,UAAC,QAAQ,EAAE,QAAQ,EAAA,EAAK,OAAA,SAAS,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA,EAAA,CAAC;AAC3F,aAAA;AACF,SAAA;aAAM,IAAI,iBAAiB,IAAI,SAAS,EAAE;AACzC,YAAA,cAAc,GAAG,UAAC,QAAQ,EAAE,QAAQ,EAAA,EAAK,OAAC,SAAsC,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA,EAAA,CAAC;AAC5H,SAAA;aAAM,IAAI,iBAAiB,KAAK,IAAI,EAAE;AACrC,YAAA,MAAM,IAAI,KAAK,CAAC,yBAAkB,iBAAiB,EAAA,+CAAA,CAA+C,CAAC,CAAC;AACrG,SAAA;QAED,IAAI,YAAY,KAAK,SAAS,EAAE;AAC9B,YAAA,YAAY,GAAG,OAAO,YAAY,KAAK,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,YAAY,CAAC;AACjG,SAAA;AAED,QAAA,OAAO,IAAI,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;KAC/G,CAAA;IAGD,gBAAW,CAAA,SAAA,CAAA,WAAA,GAAX,UAAY,SAAiB,EAAE,cAAmC,EAAE,UAAsD,EAAE,mBAA6B,EAAE,eAAqC,EAAA;AAC9L,QAAA,IAAI,cAAwB,CAAC;AAC7B,QAAA,IAAI,QAAkC,CAAC;AACvC,QAAA,IAAI,SAAqC,CAAC;AAC1C,QAAA,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QAErC,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,YAAA,KAAK,IAAI,GAAG,IAAI,UAAU,EAAE;AAC1B,gBAAA,IAAI,CAAC,sBAAsB,CAAC,SAAS,EAAE,cAAc,EAAE,mBAAmB,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,eAAe,CAAC,CAAC;AACpH,aAAA;AACF,SAAA;AAAM,aAAA,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;AAC3B,YAAA,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAErC,IAAI,UAAU,KAAK,IAAI,EAAE;AACvB,gBAAA,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC;AACzC,gBAAA,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAEvC,gBAAA,IAAI,mBAAmB,EAAE;AACvB,oBAAA,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC;AAChC,iBAAA;AAED,gBAAA,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;AACjC,oBAAA,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;oBACjC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACjB,iBAAA;AAAM,qBAAA,IAAI,SAAS,EAAE;AACpB,oBAAA,eAAe,CAAC,IAAI,CAAC,EAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,aAAa,CAAC,SAAS,CAAC,EAAC,CAAC,CAAC;AACzF,iBAAA;qBAAM,IAAI,YAAY,KAAK,SAAS,EAAE;oBACrC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACjB,iBAAA;AAED,gBAAA,QAAQ,CAAC,cAAc,GAAG,cAAc,CAAC;AAC1C,aAAA;AAED,YAAA,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC;AAC5B,SAAA;KACF,CAAA;AAGD,IAAA,gBAAA,CAAA,SAAA,CAAA,sBAAsB,GAAtB,UAAuB,SAAS,EAAE,cAAc,EAAE,mBAA4B,EAAE,IAAY,EAAE,SAAqC,EAAE,eAAoC,EAAA;AACvK,QAAA,IAAI,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC;QACzC,IAAI,cAAc,GAAG,IAAI,CAAC;AAC1B,QAAA,IAAI,QAAkC,CAAC;AACvC,QAAA,IAAI,IAAuB,CAAC;QAE5B,IAAI,iBAAiB,IAAI,SAAS,EAAE;YAClC,IAAI,iBAAiB,IAAI,SAAS,EAAE;AAClC,gBAAA,cAAc,GAAG,UAAC,QAAQ,EAAE,QAAQ,EAAA;oBAClC,SAAS,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBACjD,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACtD,iBAAC,CAAC;AACH,aAAA;AAAM,iBAAA;AACL,gBAAA,cAAc,GAAG,UAAC,QAAQ,EAAE,QAAQ,EAAA,EAAK,OAAA,SAAS,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA,EAAA,CAAC;AAC3F,aAAA;AACF,SAAA;aAAM,IAAI,iBAAiB,IAAI,SAAS,EAAE;AACzC,YAAA,cAAc,GAAG,UAAC,QAAQ,EAAE,QAAQ,EAAA,EAAK,OAAA,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA,EAAA,CAAC;AAC9F,SAAA;QAED,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,wBAAwB,CAC5D,IAAI,CAAC,KAAK,CAAC,SAAS,EACpB,SAAS,EACT,IAAI,EACJ,cAAc,CACf,CAAC;AAEF,QAAA,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,EAAE;AACrC,YAAA,YAAY,EAAE,IAAI;AAClB,YAAA,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;YACrC,GAAG,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;AACtC,SAAA,CAAC,CAAC;AAEH,QAAA,IAAI,mBAAmB,EAAE;AACvB,YAAA,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC;AAChC,SAAA;AAED,QAAA,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;AACjC,YAAA,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;YAC5B,QAAQ,CAAC,IAAI,EAAE,CAAC;AACjB,SAAA;AAAM,aAAA,IAAI,SAAS,EAAE;AACpB,YAAA,IAAI,GAAG,EAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,aAAa,CAAC,SAAS,CAAC,EAAC,CAAC;AACzE,YAAA,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,SAAA;AAED,QAAA,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC;AAC3B,QAAA,QAAQ,CAAC,cAAc,GAAG,cAAc,CAAC;KAC1C,CAAA;IACH,OAAC,gBAAA,CAAA;AAAD,CAAC,EAAA;;AC/RD,IAAA,WAAA,IAAA,YAAA;AAAA,IAAA,SAAA,WAAA,GAAA;KAiGC;IAtFC,WAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,KAAU,EAAA;QACxB,IAAI,CAAC,KAAK,EAAE;AACV,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,iBAAiB,IAAI,KAAK,EAAE;YAC3D,IAAI,QAAM,GAAG6C,sBAAM,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAE3C,YAAA,KAAK,GAAG,KAAK,CAAC,eAAe,EAAE,CAAC;AAEhC,YAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,gBAAA,KAAK,GAAG,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC;AACzC,aAAA;AAED,YAAA,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAE3B,IAAI,QAAM,CAAC,QAAQ,EAAE;AAClB,gBAAA,KAA8B,CAAC,cAAc,CAAC,QAAM,CAAC,QAAQ,CAAC,CAAC;AACjE,aAAA;AAED,YAAA,OAAO,KAAK,CAAC;AACd,SAAA;AAED,QAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,YAAA,KAAK,GAAG,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC;AACzC,SAAA;AAED,QAAA,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AAChC,YAAA,OAAO,KAAK,CAAC;AACd,SAAA;AAED,QAAA,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;AAC/B,YAAA,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC;AAC3B,SAAA;QAGD,IAAI,OAAO,IAAI,KAAK,EAAE;AACpB,YAAA,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;YACpB,IAAI,IAAI,SAAA,CAAC;AACT,YAAA,CAAC,GAAG,OAAO,CAAC,KAAK,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAChD,IAAI,CAAC,KAAK,IAAI,EAAE;AACd,gBAAA,IAAI,GAAG,IAAI,cAAc,EAAE,CAAC;AAC7B,aAAA;AAAM,iBAAA;AACL,gBAAA,IAAI,GAAG,CAAC,YAAY,kBAAkB,GAAG,CAAC,GAAG,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC;AACxE,aAAA;YACDO,wBAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,uBAAuB,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAClE,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;QAED,IAAI,MAAM,GAAGP,sBAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC/B,QAAA,IAAI,QAAQ,GAAGO,wBAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,uBAAuB,EAAE,KAAK,CAA0C,CAAC;QAEjH,IAAI,CAAC,QAAQ,EAAE;AACb,YAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;AACpB,gBAAA,MAAM,IAAI,KAAK,CAAC,sDAAsD,GAAG,KAAK,CAAC,CAAC;AACjF,aAAA;AAED,YAAA,QAAQ,GAAG,IAAI,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;AACpD,SAAA;aAAM,IAAI,MAAM,CAAC,QAAQ,EAAE;AAC1B,YAAA,QAAQ,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AACrC,SAAA;AAED,QAAA,OAAO,QAAQ,CAAC;KACjB,CAAA;IAQD,WAA0B,CAAA,SAAA,CAAA,0BAAA,GAA1B,UAA2B,MAAc,EAAA;AACvC,QAAA,OAAO,IAAI,wBAAwB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;KACnD,CAAA;IAQD,WAAsB,CAAA,SAAA,CAAA,sBAAA,GAAtB,UAAuB,MAAc,EAAA;AACnC,QAAA,IAAI,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC/B,QAAA,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;QACxH,OAAO,EAAE,GAAG,OAAO,CAAC;KACrB,CAAA;IA5FM,WAAuB,CAAA,uBAAA,GAAG,uBAAuB,CAAC;IA6F3D,OAAC,WAAA,CAAA;AAAA,CAjGD,EAiGC;;ACjGD,SAAS,EAAE,CAAC,IAAI,EAAA;AACd,IAAA,MAAM,IAAI,KAAK,CAAC,yCAAkC,IAAI,EAAA,KAAA,CAAK,CAAC,CAAC;AAC/D,CAAC;AA8BD,IAAA,eAAA,IAAA,YAAA;AAAA,IAAA,SAAA,eAAA,GAAA;KA8CC;IArCC,eAAgB,CAAA,SAAA,CAAA,gBAAA,GAAhB,UAAiB,SAAwB,EAAE,WAAmB,EAAE,QAAgB,EAAE,SAAiB,EAAA;QACjG,EAAE,CAAC,kBAAkB,CAAC,CAAC;KACxB,CAAA;IAWD,eAA0B,CAAA,SAAA,CAAA,0BAAA,GAA1B,UAA2B,SAAwB,EAAE,OAAgB,EAAE,IAAY,EAAE,mBAA4B,EAAE,OAA8B,EAAA;QAC/I,EAAE,CAAC,4BAA4B,CAAC,CAAC;KAClC,CAAA;AASD,IAAA,eAAA,CAAA,SAAA,CAAA,oBAAoB,GAApB,UAAqB,SAAwB,EAAE,OAAgB,EAAA;QAC7D,EAAE,CAAC,sBAAsB,CAAC,CAAC;KAC5B,CAAA;AAQD,IAAA,eAAA,CAAA,SAAA,CAAA,kBAAkB,GAAlB,UAAmB,SAAwB,EAAE,KAAa,EAAA;QACxD,EAAE,CAAC,oBAAoB,CAAC,CAAC;KAC1B,CAAA;IACH,OAAC,eAAA,CAAA;AAAD,CAAC,EAAA;;AC9ED,IAAI,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAW,CAAC;AAE1C,IAAA,mBAAA,IAAA,YAAA;AASE,IAAA,SAAA,mBAAA,CAAY,OAAO,EAAA;AACjB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,QAAA,IAAI,CAAC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;KACrC;AAPM,IAAA,mBAAA,CAAA,MAAM,GAAb,YAAA;AACE,QAAA,OAAO,CAACxE,cAAG,CAAC,OAAO,CAAC,CAAC;KACtB,CAAA;AAQD,IAAA,mBAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,UAAa,QAAQ,EAAE,QAAQ,KAAI,CAAA;IACrC,OAAC,mBAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAED,IAAA,eAAA,IAAA,YAAA;AA0BE,IAAA,SAAA,eAAA,CAAY,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,eAAe,EAAA;AACxD,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC5B,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;AAI5B,QAAA,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;AACrB,QAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAExB,IAAI,IAAI,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAChD,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC;KACnC;AAKD,IAAA,MAAA,CAAA,cAAA,CAAI,eAAsB,CAAA,SAAA,EAAA,wBAAA,EAAA;AAA1B,QAAA,GAAA,EAAA,YAAA;YACE,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,CAAC;SACvD;;;AAAA,KAAA,CAAA,CAAA;IAQD,eAAqB,CAAA,SAAA,CAAA,qBAAA,GAArB,UAAsB,IAAU,EAAE,KAAa,EAAE,gBAAuC,EAAE,KAAc,EAAA;AACtG,QAAA,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;AAC7B,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACzE,YAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;YAErF,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAChC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC;AAExD,YAAA,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACvG,SAAA;KACF,CAAA;IAED,eAAa,CAAA,SAAA,CAAA,aAAA,GAAb,UAAc,eAA6C,EAAA;AACzD,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;KACxC,CAAA;IAED,eAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,IAAU,EAAE,IAAU,EAAE,gBAAuC,EAAE,KAAa,EAAA;AACpF,QAAA,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;AAC7B,YAAA,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;AAC/B,YAAA,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;AAC5B,YAAA,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;AAC1B,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;AACzB,SAAA;AAED,QAAA,IAAK,IAAuB,CAAC,QAAQ,YAAY,eAAe,EAAE;AAC9D,YAAA,IAAuB,CAAC,QAA4B,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAC3E,OAAO;AACR,SAAA;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;AACnB,QAAA,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;KACnE,CAAA;AAED,IAAA,eAAA,CAAA,SAAA,CAAA,UAAU,GAAV,UAAW,IAAU,EAAE,gBAAuC,EAAA;QAC5D,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAExD,IAAI,IAAI,CAAC,sBAAsB,EAAE;YAC/B,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;AAC7D,SAAA;KACF,CAAA;IAED,eAAS,CAAA,SAAA,CAAA,SAAA,GAAT,UAAU,gBAAuC,EAAA;AAC/C,QAAA,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;AACrB,QAAA,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAEjD,IAAI,IAAI,CAAC,sBAAsB,EAAE;YAC/B,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;AAC7D,SAAA;KACF,CAAA;AAED,IAAA,eAAA,CAAA,SAAA,CAAA,WAAW,GAAX,UAAY,IAAU,EAAE,gBAAuC,EAAA;QAC7D,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;KAC1D,CAAA;IAED,eAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,SAAe,EAAA;AACrB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;KAC5B,CAAA;IAED,eAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,IAAU,EAAA;QACb,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,YAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AAClE,SAAA;KACF,CAAA;AAED,IAAA,eAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;QACE,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,YAAA,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;AAC7B,SAAA;KACF,CAAA;AAED,IAAA,eAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;QACE,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,YAAA,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;AAC7B,SAAA;KACF,CAAA;AAED,IAAA,eAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;QACE,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,YAAA,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;AAC3B,SAAA;KACF,CAAA;IACH,OAAC,eAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAED,IAAA,UAAA,IAAA,YAAA;AAyBE,IAAA,SAAA,UAAA,CAAY,MAAM,EAAE,IAAI,EAAE,eAAe,EAAA;AACvC,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,MAAM,CAAC,yBAAyB,GAAG,IAAI,CAAC;AAC7C,QAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC5B,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;AACxB,QAAA,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;AACrB,QAAA,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;AACnB,QAAA,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;AAC/B,QAAA,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;KAC9B;AAED,IAAA,MAAA,CAAA,cAAA,CAAI,UAAsB,CAAA,SAAA,EAAA,wBAAA,EAAA;AAA1B,QAAA,GAAA,EAAA,YAAA;YACE,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,CAAC;SACvD;;;AAAA,KAAA,CAAA,CAAA;IAUD,UAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,IAAU,EAAE,IAAU,EAAE,gBAAuC,EAAE,KAAc,EAAE,WAAoB,EAAA;QAC3G,IAAI,KAAK,GAAG,IAAsB,CAAC;AACnC,QAAA,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;AAC7B,YAAA,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;AAC/B,YAAA,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;AAC5B,YAAA,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;AAC1B,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;AACzB,SAAA;AAED,QAAA,IAAI,KAAK,CAAC,QAAQ,YAAY,eAAe,EAAE;AAC7C,YAAA,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACnC,OAAO;AACR,SAAA;AAED,QAAA,IAAI,IAAI,CAAC,gBAAgB,KAAK,IAAI,EAAE;AAClC,YAAA,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAC9E,SAAA;AAAM,aAAA;AACL,YAAA,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;AACzB,YAAA,KAAK,CAAC,kBAAkB,GAAG,gBAAgB,CAAC;AAC5C,YAAA,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;AAE5B,YAAA,IAAI,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;AACpE,YAAA,IAAI,QAAM,GAAG,MAAM,CAAC,UAAU,CAAC;AAE/B,YAAA,QAAM,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AACnC,YAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC1B,IAAI,CAAC,WAAW,EAAE,CAAC;AACpB,SAAA;KACF,CAAA;AAED,IAAA,UAAA,CAAA,SAAA,CAAA,UAAU,GAAV,UAAW,IAAU,EAAE,gBAAuC,EAAA;AAC5D,QAAA,IAAI,IAAI,CAAC,gBAAgB,KAAK,IAAI,EAAE;YAClC,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AAC/D,SAAA;aAAM,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;AACxD,YAAA,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;AAC5E,SAAA;AAAM,aAAA;YAEL,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,iBAAiB,KAAK,gBAAgB,CAAxC,EAAwC,CAAC,CAAC;AAC9E,YAAA,IAAI,KAAK,EAAE;AACT,gBAAA,IAAI,QAAQ,GAAG,KAAK,CAAC,oBAAoB,CAAC;AAC1C,gBAAA,IAAI,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC;AAEhC,gBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACjD,oBAAA,IAAI,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAExB,oBAAA,IAAI,KAAK,CAAC,WAAW,KAAK,IAAI,EAAE;AAC9B,wBAAA,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACtB,wBAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACjC,wBAAA,CAAC,EAAE,CAAC;AAAC,wBAAA,EAAE,EAAE,CAAC;wBAIV,IAAI,CAAC,WAAW,EAAE,CAAC;wBACnB,IAAI,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACrC,wBAAA,IAAI,GAAG,GAAG,CAAC,CAAC,EAAE;AACZ,4BAAA,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAC5B,yBAAA;AACF,qBAAA;AACF,iBAAA;gBAED,IAAI,IAAI,CAAC,sBAAsB,EAAE;oBAC/B,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;AAC7D,iBAAA;AACF,aAAA;AACF,SAAA;KACF,CAAA;IAED,UAAS,CAAA,SAAA,CAAA,SAAA,GAAT,UAAU,gBAAuC,EAAA;AAC/C,QAAA,IAAI,IAAI,CAAC,gBAAgB,KAAK,IAAI,EAAE;YAClC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACxD,SAAA;aAAM,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;YACxD,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;AACrE,SAAA;AAAM,aAAA;YACL,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,iBAAiB,KAAK,gBAAgB,CAAxC,EAAwC,CAAC,CAAC;AAE9E,YAAA,IAAI,KAAK,EAAE;AACT,gBAAA,IAAI,QAAQ,GAAG,KAAK,CAAC,oBAAoB,CAAC;AAC1C,gBAAA,IAAI,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC;AAEhC,gBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACjD,oBAAA,IAAI,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;oBACxB,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;oBAI9C,IAAI,CAAC,WAAW,EAAE,CAAC;oBACnB,IAAI,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACrC,oBAAA,IAAI,GAAG,GAAG,CAAC,CAAC,EAAE;AACZ,wBAAA,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAC5B,qBAAA;AACF,iBAAA;AAED,gBAAA,KAAK,CAAC,oBAAoB,GAAG,EAAE,CAAC;gBAEhC,IAAI,IAAI,CAAC,sBAAsB,EAAE;oBAC/B,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;AAC7D,iBAAA;AACF,aAAA;AACF,SAAA;KACF,CAAA;IAGD,UAAW,CAAA,SAAA,CAAA,WAAA,GAAX,UAAY,IAAU,EAAE,IAAU,EAAE,gBAAwC,EAAE,KAAc,EAAA;AAC1F,QAAA,IAAI,gBAAgB,EAAE;YAEpB,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,iBAAiB,KAAK,gBAAgB,CAAxC,EAAwC,CAAC,CAAC;AAC9E,YAAA,IAAI,KAAK,EAAE;gBACT,IAAI,KAAK,KAAK,SAAS,EAAE;AACvB,oBAAA,IAAI,QAAQ,GAAG,KAAK,CAAC,oBAAoB,CAAC;AAC1C,oBAAA,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC;oBACnB,IAAI,QAAQ,SAAA,CAAC;AAEb,oBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACjD,wBAAA,IAAI,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAE1B,wBAAA,IAAI,OAAO,CAAC,WAAW,KAAK,QAAQ,EAAE;AACpC,4BAAA,SAAS,EAAE,CAAC;AACZ,4BAAA,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC;AAE/B,4BAAA,IAAI,SAAS,IAAI,KAAK,IAAI,QAAQ,KAAK,IAAI,EAAE;gCAC3C,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;AAC5B,gCAAA,OAAO,OAAO,CAAC;AAChB,6BAAA;AACF,yBAAA;AACF,qBAAA;AACF,iBAAA;AAED,gBAAA,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtC,gBAAA,OAAO,KAAK,CAAC;AACd,aAAA;AACF,SAAA;QAED,OAAO,IAAI,CAAC,MAAM,CAAC;KACpB,CAAA;IAED,UAAS,CAAA,SAAA,CAAA,SAAA,GAAT,UAAU,KAAmD,EAAA;AAC3D,QAAA,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;KAC/B,CAAA;AAED,IAAA,UAAA,CAAA,SAAA,CAAA,WAAW,GAAX,UAAY,IAAU,EAAE,gBAAuC,EAAA;QAC7D,IAAI,MAAM,GAAGA,cAAG,CAAC,aAAa,CAAC,QAAQ,CAAmB,CAAC;AAC3D,QAAA,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;AACpC,QAAA,MAAM,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;AAC5C,QAAA,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC;AAC1B,QAAA,MAAM,CAAC,oBAAoB,GAAG,EAAE,CAAC;QACjC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AACzC,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAE3B,QAAA,IAAI,IAAI,CAAC,kBAAkB,KAAK,IAAI,EAAE;AACpC,YAAA,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;AAC9B,SAAA;AAED,QAAA,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACtC,CAAA;IAED,UAAqB,CAAA,SAAA,CAAA,qBAAA,GAArB,UAAsB,IAAU,EAAE,KAAa,EAAE,gBAAuC,EAAE,KAAc,EAAA;AACtG,QAAA,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;AAC7B,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACzE,YAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;YACrF,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjD,SAAA;AAED,QAAA,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;AAC7B,YAAA,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AACnC,YAAA,IAAI,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;YAEjD,IAAI,kBAAkB,KAAK,IAAI,EAAE;AAC/B,gBAAA,KAAK,IAAI,QAAQ,IAAI,KAAK,EAAE;AAC1B,oBAAA,IAAI,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;AAE3B,oBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,kBAAkB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC3D,wBAAA,IAAI,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;wBACnC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAChE,qBAAA;AACF,iBAAA;AACF,aAAA;AAED,YAAA,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;AAC3B,YAAA,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;AACxE,SAAA;KACF,CAAA;IAKD,UAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,SAAe,EAAA;AACrB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;KAC5B,CAAA;IAKD,UAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,IAAU,EAAA;QACb,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,YAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AAClE,SAAA;KACF,CAAA;AAED,IAAA,UAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;QACE,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,YAAA,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;AAC7B,SAAA;KACF,CAAA;AAED,IAAA,UAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;QACE,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,YAAA,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;AAC7B,SAAA;KACF,CAAA;AAED,IAAA,UAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;QACE,IAAI,IAAI,CAAC,WAAW,EAAE;AACpB,YAAA,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;AAC3B,SAAA;KACF,CAAA;IACH,OAAC,UAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAED,IAAA,SAAA,IAAA,YAAA;AAAA,IAAA,SAAA,SAAA,GAAA;KAuHC;IApHQ,SAAW,CAAA,WAAA,GAAlB,UAAmB,IAAI,EAAA;AACrB,QAAA,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE;YACtC,OAAO,SAAS,CAAC,cAAc,CAAC;AACjC,SAAA;AAED,QAAA,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;KACnC,CAAA;IAMM,SAAc,CAAA,cAAA,GAArB,UACE,IAAU,EACV,KAAmD,EACnD,gBAAwC,EACxC,KAAc,EACd,mBAA4B,EAAA;AAE5B,QAAA,IAAI,KAAK,CAAC;QAEV,IAAI,IAAI,KAAK,IAAI,EAAE;YACjB,KAAK,GAAG,OAAO,CAAC;AACjB,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;AAC1C,YAAA,IAAI,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC;AAC3B,YAAA,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;YAEtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;gBAC3B,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AAC1B,aAAA;AACF,SAAA;AAED,QAAA,SAAS,CAAC,eAAe,CACvB,IAAI,EACJ,KAAK,EACL,KAAK,EACL,gBAAgB,EAChB,KAAK,EACL,mBAAmB,CACpB,CAAC;KACH,CAAA;AAEM,IAAA,SAAA,CAAA,gBAAgB,GAAvB,UAAwB,IAAU,EAAE,KAAmD,EAAE,gBAAuC,EAAA;AAC9H,QAAA,KAAK,IAAI,QAAQ,IAAI,KAAK,EAAE;YAC1B,KAAK,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AACpD,SAAA;KACF,CAAA;AAMM,IAAA,SAAA,CAAA,eAAe,GAAtB,UAAuB,KAAmD,EAAE,gBAAuC,EAAA;AACjH,QAAA,KAAK,IAAI,QAAQ,IAAI,KAAK,EAAE;YAC1B,KAAK,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAC7C,SAAA;KACF,CAAA;AAWM,IAAA,SAAA,CAAA,eAAe,GAAtB,UACE,IAAU,EACV,KAAa,EACb,KAAmD,EACnD,gBAAwC,EACxC,KAAc,EACd,mBAA4B,EAAA;AAE5B,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC9C,YAAA,IAAI,WAAW,GAAG,KAAK,CAAC,CAAC,CAAmB,CAAC;AAC7C,YAAA,IAAI,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;YAEpC,IAAI,WAAW,CAAC,yBAAyB,EAAE;AACxC,gBAAA,WAAW,CAAC,QAAkC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAEjE,gBAAA,KAAK,IAAI,QAAQ,IAAI,KAAK,EAAE;AAC1B,oBAAA,KAAK,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,QAAiC,CAAC,CAAC;AAClF,iBAAA;AAED,gBAAA,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACnB,gBAAA,EAAE,EAAE,CAAC;AAAC,gBAAA,CAAC,EAAE,CAAC;AACX,aAAA;AAAM,iBAAA,IAAI,QAAQ,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,IAAI,WAAW,CAAC,QAAQ,YAAY,eAAe,EAAE;gBAC9F,IAAI,QAAQ,KAAK,CAAC,IAAI,gBAAgB,CAAC,WAAW,CAAC,EAAE;AACnD,oBAAA,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACnB,oBAAA,EAAE,EAAE,CAAC;AAAC,oBAAA,CAAC,EAAE,CAAC;AACX,iBAAA;AAAM,qBAAA;AACL,oBAAA,IAAI,KAAK,GAAG,KAAK,CAAC,mBAAmB,IAAI,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AAE7E,oBAAA,IAAI,KAAK,EAAE;wBACT,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;AAC1D,wBAAA,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACnB,wBAAA,EAAE,EAAE,CAAC;AAAC,wBAAA,CAAC,EAAE,CAAC;AACX,qBAAA;AACF,iBAAA;AACF,aAAA;AAAM,iBAAA;AACL,gBAAA,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACnB,gBAAA,EAAE,EAAE,CAAC;AAAC,gBAAA,CAAC,EAAE,CAAC;AACX,aAAA;AACF,SAAA;AAED,QAAA,KAAK,IAAI,QAAQ,IAAI,KAAK,EAAE;AAC1B,YAAA,IAAI,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;YAE3B,IAAI,IAAI,CAAC,sBAAsB,EAAE;gBAC/B,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;AAClE,aAAA;AACF,SAAA;KACF,CAAA;IArHM,SAAc,CAAA,cAAA,GAAG,yBAAkC,CAAC;IAsH7D,OAAC,SAAA,CAAA;AAAA,CAvHD,EAuHC;;ACriBD,IAAA,8BAAA,IAAA,YAAA;AAIE,IAAA,SAAA,8BAAA,CAAY,KAAK,EAAA;AACf,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC;KAChC;AAKD,IAAA,8BAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,YAAA;AACE,QAAA,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC;AAC/B,QAAA,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC;KACtC,CAAA;IACH,OAAC,8BAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAKD,IAAA,oCAAA,IAAA,YAAA;AAOE,IAAA,SAAA,oCAAA,CAAY,KAAK,EAAA;AACf,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;AAClC,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;KACxC;AAMD,IAAA,oCAAA,CAAA,SAAA,CAAA,0BAA0B,GAA1B,YAAA;AACE,QAAA,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC,QAAQ,CAAC;KACtB,CAAA;AAKD,IAAA,oCAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;QACE,IAAI,CAAC,gBAAgB,EAAE,CAAC;KACzB,CAAA;AAGD,IAAA,oCAAA,CAAA,SAAA,CAAA,gBAAgB,GAAhB,YAAA;AACE,QAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C,CAAA;AAGD,IAAA,oCAAA,CAAA,SAAA,CAAA,eAAe,GAAf,YAAA;QAAA,IAIC,KAAA,GAAA,IAAA,CAAA;AAHC,QAAA,OAAO,IAAI,OAAO,CAAO,UAAC,OAAO,EAAA;AAC/B,YAAA,KAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;AAClC,SAAC,CAAC,CAAC;KACJ,CAAA;IACH,OAAC,oCAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAKD,IAAA,sBAAA,IAAA,YAAA;AAQE,IAAA,SAAA,sBAAA,GAAA;AACE,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;AAC5B,QAAA,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;KAC5B;AAMD,IAAA,sBAAA,CAAA,SAAA,CAAA,UAAU,GAAV,YAAA;AACE,QAAA,OAAO,IAAI,CAAC,eAAe,KAAK,IAAI;AAClC,cAAE,IAAI,oCAAoC,CAAC,IAAI,CAAC;cAC9C,IAAI,CAAC;KACV,CAAA;AAMD,IAAA,sBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,OAAO,IAAI,8BAA8B,CAAC,IAAI,CAAC,CAAC;KACjD,CAAA;AAGD,IAAA,sBAAA,CAAA,SAAA,CAAA,uBAAuB,GAAvB,YAAA;AACE,QAAA,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,EAAE;AAC/B,YAAA,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;AAE3B,YAAA,IAAI,IAAI,CAAC,eAAe,KAAK,IAAI,EAAE;AACjC,gBAAA,IAAI,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC;AACjC,gBAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;gBAC5B,KAAK,CAAC,OAAO,EAAE,CAAC;AACjB,aAAA;AACF,SAAA;KACF,CAAA;IACH,OAAC,sBAAA,CAAA;AAAD,CAAC,EAAA;;AC3ED,IAAA,IAAA,IAAA,YAAA;AAqFE,IAAA,SAAA,IAAA,CAAY,SAAoB,EAAE,WAAwB,EAAE,QAA0B,EAAE,WAAyB,EAAE,QAAmB,EAAE,QAAoB,EAAE,KAAa,EAAA;AACzK,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,QAAA,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;AACvC,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AACtC,QAAA,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;AACpC,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,KAAK,GAAG,KAA6B,CAAC;AAC3C,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;AACtB,QAAA,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;AACvB,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,QAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;AACxB,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AAC3B,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;AAC5B,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AACvB,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AAC3B,QAAA,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;AACnC,QAAA,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;AAC/B,QAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;AAGxB,QAAA,KAAK,IAAI,CAAC,IAAI,KAAK,EAAE;AACnB,YAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,MAAM;AACP,SAAA;KACF;AAKD,IAAA,IAAA,CAAA,SAAA,CAAA,aAAa,GAAb,YAAA;AACE,QAAA,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;KAC1C,CAAA;AAKD,IAAA,IAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;AACE,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;AAEnC,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YAChD,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,SAAA;KACF,CAAA;AAOD,IAAA,IAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,cAAsB,EAAE,eAAwB,EAAE,aAAuB,EAAA;AAC5E,QAAA,IAAI,WAAW,CAAC;AAChB,QAAA,IAAI,QAAQ,CAAC;AACb,QAAA,IAAI,QAAQ,CAAC;AACb,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AAEP,QAAA,IAAI,aAAa,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC3C,OAAO;AACR,SAAA;QAED,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,IAAI,CAAC,cAAc,KAAK,cAAc,EAAE;gBAC1C,OAAO;AACR,aAAA;YAED,IAAI,CAAC,MAAM,EAAE,CAAC;AACf,SAAA;AAED,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACpB,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,eAAe,GAAG,eAAe,IAAI2C,oCAAqB,CAAC,cAAc,CAAC,CAAC;QAEhF,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AAE/C,QAAA,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACzB,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YAC7C,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,SAAA;AAED,QAAA,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,EAAE;AAC/B,YAAA,cAAgC,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;AAChH,YAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AAC5B,SAAA;AAED,QAAA,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;AAC/B,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YAChD,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,SAAA;AAED,QAAA,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACzB,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC7C,YAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;AACzD,SAAA;QAED,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AACxD,SAAA;KACF,CAAA;IAMD,IAAU,CAAA,SAAA,CAAA,UAAA,GAAV,UAAW,OAAe,EAAA;AACxB,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAkB,CAAC,CAAC;QAEvC,IAAI,IAAI,CAAC,OAAO,EAAE;AACf,YAAA,OAAmB,CAAC,IAAI,CAAC,IAAwB,CAAC,CAAC;AACrD,SAAA;KACF,CAAA;AAKD,IAAA,IAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,IAAI,WAAW,CAAC;AAChB,QAAA,IAAI,QAAQ,CAAC;AACb,QAAA,IAAI,QAAQ,CAAC;AACb,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;QAEP,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;YACrB,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AAEjD,YAAA,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE;AAC5B,gBAAA,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;AAC1B,aAAA;AAED,YAAA,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACzB,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC7C,gBAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AACtB,aAAA;AAED,YAAA,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;AAC/B,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,gBAAA,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AACzB,aAAA;AAED,YAAA,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACzB,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC7C,gBAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AACtB,aAAA;AAED,YAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AAC3B,YAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;AAC7B,SAAA;KACF,CAAA;IAMD,IAAiB,CAAA,SAAA,CAAA,iBAAA,GAAjB,UAAkB,OAAa,EAAA;QAC7B,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KACzD,CAAA;IAMD,IAAa,CAAA,SAAA,CAAA,aAAA,GAAb,UAAc,MAAe,EAAA;AAC3B,QAAA,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KACnC,CAAA;AAKD,IAAA,IAAA,CAAA,SAAA,CAAA,WAAW,GAAX,YAAA;AACE,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC7B,QAAA,IAAI,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;AAC9B,QAAA,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;AACzB,QAAA,IAAI,IAAI,CAAC;AAET,QAAA,OAAO,OAAO,EAAE;AACd,YAAA,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC;AAC3B,YAAA,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAE9B,IAAI,OAAO,KAAK,GAAG,EAAE;gBACnB,MAAM;AACP,aAAA;YAED,OAAO,GAAG,IAAI,CAAC;AAChB,SAAA;KACF,CAAA;AAKD,IAAA,IAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;AACE,QAAA,IAAI,WAAW,CAAC;AAChB,QAAA,IAAI,QAAQ,CAAC;AACb,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;QAEP,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,OAAO;AACR,SAAA;AAED,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AAEvB,QAAA,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE;AAC5B,YAAA,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;AAC5B,SAAA;AAED,QAAA,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;AAC/B,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,YAAA,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC3B,SAAA;AAED,QAAA,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACzB,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC7C,YAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AACxB,SAAA;KACF,CAAA;AAKD,IAAA,IAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;AACE,QAAA,IAAI,WAAW,CAAC;AAChB,QAAA,IAAI,QAAQ,CAAC;AACb,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;QAEP,IAAI,IAAI,CAAC,UAAU,EAAE;AACnB,YAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;AAExB,YAAA,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE;AAC5B,gBAAA,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;AAC5B,aAAA;AAED,YAAA,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;AAC/B,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,gBAAA,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC3B,aAAA;AAED,YAAA,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACzB,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC7C,gBAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AACxB,aAAA;AACF,SAAA;KACF,CAAA;IACH,OAAC,IAAA,CAAA;AAAD,CAAC,EAAA;;AC/WD,IAAA,QAAA,IAAA,YAAA;AAAA,IAAA,SAAA,QAAA,GAAA;KA4EC;IApEC,QAAK,CAAA,SAAA,CAAA,KAAA,GAAL,UAAM,OAAoB,EAAA;AACxB,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KAC/B,CAAA;IAOD,QAAK,CAAA,SAAA,CAAA,KAAA,GAAL,UAAM,OAAoB,EAAA;AACxB,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KAC/B,CAAA;AAQD,IAAA,QAAA,CAAA,SAAA,CAAA,WAAW,GAAX,UAAY,OAAoB,EAAE,SAAiB,EAAA;AACjD,QAAA,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACpC,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KAC/B,CAAA;AAQD,IAAA,QAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,OAAoB,EAAE,SAAiB,EAAA;AAC9C,QAAA,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AACjC,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KAC/B,CAAA;AASD,IAAA,QAAA,CAAA,SAAA,CAAA,OAAO,GAAP,UAAQ,OAAyC,EAAE,SAAiB,EAAA;AAClE,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KAC/B,CAAA;IAQD,QAAW,CAAA,SAAA,CAAA,WAAA,GAAX,UAAY,UAAqB,EAAA;AAC/B,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KAC/B,CAAA;AAOD,IAAA,QAAA,CAAA,SAAA,CAAA,cAAc,GAAd,UAAe,UAAkB,EAAE,UAAkB,KAAU,CAAA;AAM/D,IAAA,QAAA,CAAA,SAAA,CAAA,gBAAgB,GAAhB,UAAiB,UAAkB,EAAA,GAAU,CAAA;IAC/C,OAAC,QAAA,CAAA;AAAD,CAAC,EAAA;;AC3ED,SAAS,oBAAoB,CAAC,IAAI,EAAA;AAChC,IAAA,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE;QACxC,OAAO,IAAI,CAAC,iBAAiB,CAAC;AAC/B,KAAA;AAED,IAAA,IAAI,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;AAE9B,IAAA,OAAO,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;AACxC,QAAA,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;AAC/B,KAAA;AAED,IAAA,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;QACrC,QAAQ,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,OAAO,GAAG,IAAI,EAAE;AAC7F,KAAA;AAED,IAAA,QAAQ,IAAI,CAAC,iBAAiB,GAAG,IAAI,EAAE;AACzC,CAAC;AAMD,IAAA,QAAA,IAAA,YAAA;AA4BE,IAAA,SAAA,QAAA,CAAY,MAAY,EAAE,iBAA0B,EAAE,QAAsC,EAAA;AAAtC,QAAA,IAAA,QAAA,KAAA,KAAA,CAAA,EAAA,EAAA,QAAA,GAAqB,QAAQ,CAAC,QAAQ,CAAA,EAAA;AAC1F,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AAC3C,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AAC3B,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;AAC5B,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;AACnB,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,QAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;AACxB,QAAA,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;AAC5B,QAAA,MAAyB,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC1C,QAAA,MAAyB,CAAC,yBAAyB,GAAG,KAAK,CAAC;KAC9D;AAQD,IAAA,QAAA,CAAA,SAAA,CAAA,WAAW,GAAX,UAAY,IAAU,EAAE,SAAmB,EAAA;AAAnB,QAAA,IAAA,SAAA,KAAA,KAAA,CAAA,EAAA,EAAA,SAAmB,GAAA,OAAA,CAAA,EAAA;AACzC,QAAA,IAAI,iBAAiB,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAEnD,IAAI,iBAAiB,KAAK,IAAI,EAAE;AAC9B,YAAA,QAAQ,SAAS;AACjB,gBAAA,KAAK,OAAO;oBACV,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAChD,gBAAA,KAAK,OAAO;oBACV,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAChD,gBAAA;AACE,oBAAA,MAAM,IAAI,KAAK,CAAC,+BAA+B,GAAG,SAAS,CAAC,CAAC;AAC9D,aAAA;AACF,SAAA;KACF,CAAA;AAMD,IAAA,QAAA,CAAA,SAAA,CAAA,2BAA2B,GAA3B,YAAA;AACE,QAAA,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AAEzB,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;AACjB,YAAA,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,SAAS,EAAE,MAAM,CAAC,SAAS;AAC3B,YAAA,aAAa,iBAAK;YAClB,WAAW,EAAA,YAAA;AACT,gBAAA,IAAI,IAAI,CAAC;AAET,gBAAA,OAAO,IAAI,GAAG,MAAM,CAAC,SAAS,EAAE;AAC9B,oBAAA,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAC1B,iBAAA;aACF;AACD,YAAA,OAAO,iBAAK;AACZ,YAAA,IAAI,iBAAK;AACT,YAAA,MAAM,iBAAK;AACX,YAAA,QAAQ,iBAAK;AACb,YAAA,QAAQ,iBAAK;AACK,SAAA,CAAC,CAAC;KACvB,CAAA;AAOD,IAAA,QAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,cAAsB,EAAE,eAAuB,EAAA;AAClD,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,QAAQ,CAAC;QAEb,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,IAAI,CAAC,cAAc,KAAK,cAAc,EAAE;gBAC1C,OAAO;AACR,aAAA;YAED,IAAI,CAAC,MAAM,EAAE,CAAC;AACf,SAAA;AAED,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,cAAc,GAAG,cAAc,GAAG,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC;QAC7E,IAAI,CAAC,eAAe,GAAG,eAAe,GAAG,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC;AAEjF,QAAA,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACzB,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC7C,YAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;AACzD,SAAA;KACF,CAAA;AAKD,IAAA,QAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;QACE,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,SAAA,CAAC;YACN,IAAI,EAAE,SAAA,CAAC;AACP,YAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAE7B,YAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,YAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AAC3B,YAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;AAE5B,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC7C,gBAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;AACtB,aAAA;AACF,SAAA;KACF,CAAA;IAOD,QAAG,CAAA,SAAA,CAAA,GAAA,GAAH,UAAI,IAAU,EAAA;QACZ,IAAI,IAAI,CAAC,iBAAiB,EAAE;AAC1B,YAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAiB,CAAC,CAAC;AAC5C,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrC,SAAA;AAED,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACxC,SAAA;KACF,CAAA;AAQD,IAAA,QAAA,CAAA,SAAA,CAAA,MAAM,GAAN,UAAO,KAAa,EAAE,IAAU,EAAA;AAC9B,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC7B,QAAA,IAAI,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;AAE7B,QAAA,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,KAAK,KAAK,IAAI,MAAM,EAAE;AACpD,YAAA,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACvB,SAAA;QAED,IAAI,CAAC,iBAAiB,CAAE,QAAQ,CAAC,KAAK,CAAU,CAAC,UAAU,CAAC,CAAC;QAC7D,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAEhC,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACxC,SAAA;KACF,CAAA;AAOD,IAAA,QAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,WAAW,EAAE,WAAW,EAAA;QAC3B,IAAI,WAAW,KAAK,WAAW,EAAE;YAC/B,OAAO;AACR,SAAA;AAED,QAAA,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC/B,QAAA,IAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;QAEnC,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,iBAAiB,CAAE,QAAQ,CAAC,WAAW,CAAU,CAAC,UAAU,CAAC,CAAC;AACnE,QAAA,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAChC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;KACvC,CAAA;AASD,IAAA,QAAA,CAAA,SAAA,CAAA,MAAM,GAAN,UAAO,IAAU,EAAE,aAAuB,EAAE,aAAuB,EAAA;AACjE,QAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;KACjF,CAAA;AASD,IAAA,QAAA,CAAA,SAAA,CAAA,UAAU,GAAV,UAAW,aAAqB,EAAE,aAAuB,EAAE,aAAuB,EAAA;QAAlF,IA8CC,KAAA,GAAA,IAAA,CAAA;AA7CC,QAAA,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC/B,QAAA,IAAI,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC;AAC9B,QAAA,IAAI,CAAC,CAAC;QACN,IAAI,UAAU,GAAG,EAAE,CAAC;AAEpB,QAAA,aAAa,CAAC,OAAO,CAAC,UAAA,KAAK,EAAA;AACzB,YAAA,IAAI,aAAa,EAAE;gBACjB,KAAK,CAAC,WAAW,EAAE,CAAC;gBACpB,OAAO;AACR,aAAA;YAED,IAAI,SAAS,GAAG,KAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjD,YAAA,IAAI,SAAS,EAAE;AACb,gBAAA,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAA,EAAM,OAAA,KAAK,CAAC,WAAW,EAAE,GAAA,CAAC,CAAC,CAAC;AAC5D,aAAA;AAAM,iBAAA;gBACL,KAAK,CAAC,WAAW,EAAE,CAAC;AACrB,aAAA;AACH,SAAC,CAAC,CAAC;AAEH,QAAA,IAAI,YAAY,GAAG,YAAA;YACjB,IAAI,KAAI,CAAC,UAAU,EAAE;gBACnB,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACvB,oBAAA,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC7B,iBAAA;AACF,aAAA;AAED,YAAA,IAAI,aAAa,EAAE;gBACjB,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACvB,oBAAA,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;AAClC,iBAAA;AACF,aAAA;YAED,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;gBACvB,IAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjD,IAAI,KAAK,IAAI,CAAC,EAAE;AACd,oBAAA,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AAC3B,iBAAA;AACF,aAAA;AACH,SAAC,CAAC;AAEF,QAAA,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACzB,YAAA,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,YAAA,EAAM,OAAA,YAAY,EAAE,CAAd,EAAc,CAAC,CAAC;AAC3D,SAAA;QAED,OAAO,YAAY,EAAE,CAAC;KACvB,CAAA;AASD,IAAA,QAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,KAAa,EAAE,aAAuB,EAAE,aAAuB,EAAA;QAAxE,IA2BC,KAAA,GAAA,IAAA,CAAA;QA1BC,IAAI,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAEhC,QAAA,IAAI,YAAY,GAAG,YAAA;YACjB,KAAK,GAAG,KAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACpC,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,KAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAE/B,IAAI,KAAI,CAAC,UAAU,EAAE;gBACnB,IAAI,CAAC,QAAQ,EAAE,CAAC;AACjB,aAAA;AAED,YAAA,IAAI,aAAa,EAAE;gBACjB,IAAI,CAAC,aAAa,EAAE,CAAC;AACtB,aAAA;AAED,YAAA,OAAO,IAAI,CAAC;AACd,SAAC,CAAC;QAEF,IAAI,CAAC,aAAa,EAAE;YAClB,IAAI,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAChD,YAAA,IAAI,SAAS,EAAE;gBACb,OAAO,SAAS,CAAC,IAAI,CAAC,YAAA,EAAM,OAAA,YAAY,EAAE,CAAA,EAAA,CAAC,CAAC;AAC7C,aAAA;AACF,SAAA;QAED,OAAO,YAAY,EAAE,CAAC;KACvB,CAAA;AAQD,IAAA,QAAA,CAAA,SAAA,CAAA,SAAS,GAAT,UAAU,aAAuB,EAAE,aAAuB,EAAA;QAA1D,IA6CC,KAAA,GAAA,IAAA,CAAA;AA5CC,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC7B,QAAA,IAAI,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC;AACzB,QAAA,IAAI,CAAC,CAAC;QACN,IAAI,UAAU,GAAG,EAAE,CAAC;AAEpB,QAAA,QAAQ,CAAC,OAAO,CAAC,UAAA,KAAK,EAAA;AACpB,YAAA,IAAI,aAAa,EAAE;gBACjB,KAAK,CAAC,WAAW,EAAE,CAAC;gBACpB,OAAO;AACR,aAAA;YAED,IAAI,SAAS,GAAG,KAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjD,YAAA,IAAI,SAAS,EAAE;AACb,gBAAA,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAA,EAAM,OAAA,KAAK,CAAC,WAAW,EAAE,GAAA,CAAC,CAAC,CAAC;AAC5D,aAAA;AAAM,iBAAA;gBACL,KAAK,CAAC,WAAW,EAAE,CAAC;AACrB,aAAA;AACH,SAAC,CAAC,CAAC;AAEH,QAAA,IAAI,YAAY,GAAG,YAAA;YACjB,IAAI,KAAI,CAAC,UAAU,EAAE;gBACnB,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACvB,oBAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AACxB,iBAAA;AACF,aAAA;AAED,YAAA,IAAI,aAAa,EAAE;gBACjB,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACvB,oBAAA,IAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAE1B,oBAAA,IAAI,KAAK,EAAE;wBACT,KAAK,CAAC,aAAa,EAAE,CAAC;AACvB,qBAAA;AACF,iBAAA;AACF,aAAA;AAED,YAAA,KAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;AACrB,SAAC,CAAC;AAEF,QAAA,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACzB,YAAA,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,YAAA,EAAM,OAAA,YAAY,EAAE,CAAd,EAAc,CAAC,CAAC;AAC3D,SAAA;QAED,OAAO,YAAY,EAAE,CAAC;KACvB,CAAA;AAKD,IAAA,QAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;AACE,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,QAAQ,CAAC;AACb,QAAA,IAAI,KAAK,CAAC;QAEV,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,OAAO;AACR,SAAA;AAED,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AAEvB,QAAA,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACzB,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC7C,YAAA,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YACpB,KAAK,CAAC,QAAQ,EAAE,CAAC;AACjB,YAAA,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAClC,SAAA;KACF,CAAA;AAKD,IAAA,QAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;AACE,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,QAAQ,CAAC;QAEb,IAAI,IAAI,CAAC,UAAU,EAAE;AACnB,YAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;AACxB,YAAA,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACzB,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC7C,gBAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AACxB,aAAA;AACF,SAAA;KACF,CAAA;IAED,QAAS,CAAA,SAAA,CAAA,SAAA,GAAT,UAAU,KAAa,EAAA;QAAvB,IAUC,KAAA,GAAA,IAAA,CAAA;AATC,QAAA,IAAI,CAAC,cAAc,GAAG,KAAY,CAAC;AACnC,QAAA,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC;AAC/B,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC;AACrC,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC;AACjC,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAwB,CAAC;AAC5C,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,mBAA0B,CAAC;AAChD,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,qBAAqB,CAAC;AAC7C,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,oBAAoB,CAAC;QAC3C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,IAAI,EAAI,EAAA,OAAA,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,KAAqD,EAAE,KAAI,CAAC,CAAA,EAAA,CAAC,CAAC;KAC5H,CAAA;IAOD,QAAc,CAAA,SAAA,CAAA,cAAA,GAAd,UAAe,IAAI,EAAA;QACjB,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AAE1D,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,QAAQ,EAAE,CAAC;AACjB,SAAA;KACF,CAAA;AAQD,IAAA,QAAA,CAAA,SAAA,CAAA,iBAAiB,GAAjB,UAAkB,KAAK,EAAE,IAAI,EAAA;QAC3B,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;AAC3E,YAAA,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAChB,SAAA;AAAM,aAAA;AACL,YAAA,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAEjE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;YAErC,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,IAAI,CAAC,QAAQ,EAAE,CAAC;AACjB,aAAA;AACF,SAAA;KACF,CAAA;AAQD,IAAA,QAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,WAAW,EAAE,WAAW,EAAA;QACtC,IAAI,WAAW,KAAK,WAAW,EAAE;YAC/B,OAAO;AACR,SAAA;AAED,QAAA,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC/B,QAAA,IAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;QAEnC,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AAC5D,QAAA,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AAEvE,QAAA,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAChC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;KACvC,CAAA;AAQD,IAAA,QAAA,CAAA,SAAA,CAAA,iBAAiB,GAAjB,UAAkB,IAAI,EAAE,aAAa,EAAA;QACnC,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AAC5D,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAErD,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,QAAQ,EAAE,CAAC;AACjB,SAAA;AACD,QAAA,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,aAAa,EAAE,CAAC;AACtB,SAAA;KACF,CAAA;AAQD,IAAA,QAAA,CAAA,SAAA,CAAA,mBAAmB,GAAnB,UAAoB,KAAK,EAAE,aAAa,EAAA;QACtC,IAAI,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAEhC,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QAC5D,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAE/B,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,QAAQ,EAAE,CAAC;AACjB,SAAA;AACD,QAAA,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,aAAa,EAAE,CAAC;AACtB,SAAA;KACF,CAAA;AAQD,IAAA,QAAA,CAAA,SAAA,CAAA,qBAAqB,GAArB,UAAsB,aAAa,EAAE,aAAc,EAAA;QAAnD,IAEC,KAAA,GAAA,IAAA,CAAA;AADC,QAAA,aAAa,CAAC,OAAO,CAAC,UAAA,IAAI,EAAA,EAAI,OAAA,KAAI,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,CAAhC,EAAgC,CAAC,CAAC;KACjE,CAAA;IAOD,QAAoB,CAAA,SAAA,CAAA,oBAAA,GAApB,UAAqB,aAAa,EAAA;QAChC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AAErD,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC7B,QAAA,IAAI,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC;QAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC3B,YAAA,IAAI,aAAa,EAAE;AACjB,gBAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;AAC7B,aAAA;iBAAM,IAAI,IAAI,CAAC,UAAU,EAAE;AAC1B,gBAAA,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AACxB,aAAA;AACF,SAAA;AAED,QAAA,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;KACpB,CAAA;IACH,OAAC,QAAA,CAAA;AAAD,CAAC,EAAA;;AChiBD,IAAM,SAAS,GAAG8B,mCAAe,CAAC;AAGlC,IAAA,gBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,gBAAA,GAAA;KAKC;AAJC,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAG,GAAH,UAAI,SAAS,EAAE,GAAG,EAAA;AAChB,QAAA,IAAI,EAAE,GAAI,GAAmC,CAAC,cAAc,CAAC;QAC7D,OAAO,EAAE,IAAI,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;KAClF,CAAA;IAJG,gBAAgB,GAAA,UAAA,CAAA;QADrB,SAAS;AACJ,KAAA,EAAA,gBAAgB,CAKrB,CAAA;IAAD,OAAC,gBAAA,CAAA;AAAA,CALD,EAKC,CAAA,CAAA;AAED,IAAI,wBAAwB,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAEtD,SAAS,mBAAmB,CAAC,GAAG,EAAA;AAC9B,IAAA,IAAI,GAAG,KAAKzE,cAAG,CAAC,OAAO,EAAE;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC;AACrB,KAAA;IAED,IAAI,GAAG,KAAK,gBAAgB,EAAE;QAC5B,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;AAC9B,SAAA;AAED,QAAA,IAAI,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;AAC3C,QAAA,IAAI,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;AAE7C,QAAA,IAAI,gBAAgB,EAAE;YACpB,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC;AACrD,SAAA;AAED,QAAA,IAAI,CAAC,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAC9E,OAAO,IAAI,CAAC,gBAAgB,CAAC;AAC9B,KAAA;IAED,IAAI,GAAG,KAAK,QAAQ,EAAE;AACpB,QAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;AAC/B,YAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;YAC/E,IAAI,CAAC,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;YAClE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACnC,SAAA;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC;AACtB,KAAA;IAED,IAAI,GAAG,KAAK,aAAa,EAAE;AACzB,QAAA,OAAO,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AACrF,KAAA;IAED,IAAI,GAAG,KAAK,sBAAsB,EAAE;AAClC,QAAA,OAAO,IAAI,CAAC,sBAAsB,KAAK,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5F,KAAA;IAED,IAAI,GAAG,KAAK,aAAa,EAAE;QACzB,OAAO,IAAI,CAAC,aAAa,CAAC;AAC3B,KAAA;IAED,IAAI,GAAG,KAAK,iBAAiB,EAAE;QAC7B,OAAO,IAAI,CAAC,WAAW,CAAC;AACzB,KAAA;AAED,IAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAA;AACjG,IAAA,IAAI,SAAS,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;AACrC,IAAA,IAAI,SAAS,CAAC;AACd,IAAA,IAAI,CAAC,CAAC;AAEN,IAAA,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC;AAC5B,IAAA,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;AACpC,IAAA,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC9B,IAAA,SAAS,CAAC,aAAa,GAAG,SAAS,CAAC;AACpC,IAAA,SAAS,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AAE9C,IAAA,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;AAClC,IAAA,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;IAErB,OAAO,CAAC,EAAE,EAAE;AACV,QAAA,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC;AAClE,KAAA;AAED,IAAA,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC;AACnC,IAAA,SAAS,CAAC,GAAG,GAAG,mBAAmB,CAAC;AAEpC,IAAA,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,YAAY,CAAC,IAAI,EAAA;IACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,YAAY,CAAC,IAAI,EAAA;IACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,YAAY,CAAC,IAAI,EAAE,KAAK,EAAA;IAC/B,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,EAAA;IACxD,IAAI,MAAM,GAAGA,cAAG,CAAC,aAAa,CAAC,QAAQ,CAA4H,CAAC;AAEpK,IAAA,IAAI,kBAAkB,EAAE;AACtB,QAAA,IAAI,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;AAEpC,QAAA,IAAI,UAAU,IAAI,UAAU,CAAC,OAAO,KAAK,YAAY,EAAE;AACrD,YAAA,MAAM,CAAC,cAAc,GAAG,UAAU,CAAC;AACpC,SAAA;AAED,QAAA,MAAM,CAAC,QAAQ,GAAG,OAAO,CAAC;AAE1B,QAAA,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;AACnC,QAAA,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;AACnC,QAAA,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;AACpC,KAAA;AAED,IAAAA,cAAG,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjC,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAaD,SAAS,iBAAiB,CACxB,UAAqC,EACrC,OAAgB,EAChB,WAA8B,EAC9B,WAAyB,EACzB,QAAmB,EACnB,QAAgB,EAChB,WAAuC,EACvC,gBAA6C,EAC7C,SAAwB,EAAA;AAExB,IAAA,IAAI,oBAAoB,GAAG,WAAW,CAAC,oBAAoB,CAAC;AAC5D,IAAA,IAAI,WAAW,GAAG,WAAW,CAAC,WAAkC,CAAC;AACjE,IAAA,IAAI,gBAAgB,CAAC;AACrB,IAAA,IAAI,CAAC,CAAC;AACN,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,IAAI,OAAO,CAAC;AACZ,IAAA,IAAI,QAAQ,CAAC;IAEb,IAAI,WAAW,CAAC,iBAAiB,EAAE;AACjC,QAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;AAC/E,QAAA,OAAO,CAAC,WAAiC,CAAC,qBAAqB,GAAG,IAAI,CAAC;AACxE,QAAA,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACxC,OAAO;AACR,KAAA;IAED,IAAI,WAAW,CAAC,UAAU,EAAE;QAC1B,IAAI,aAAa,GAAGA,cAAG,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,IAAI,SAAA,CAAC;QAET,IAAI,WAAW,CAAC,eAAe,EAAE;AAC/B,YAAA,IAAI,GAAG,IAAI,eAAe,CAAC,aAAa,EAAE,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,eAAe,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAC;AAC/H,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,GAAG,IAAI,UAAU,CAAC,aAAa,EAAE,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAC;AAC7F,SAAA;AAED,QAAAA,cAAG,CAAC,WAAW,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AACxC,QAAA,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;AACzC,QAAA,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,OAAO;AACR,KAAA;IAED,IAAI,WAAW,CAAC,UAAU,EAAE;AAC1B,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YAChD,QAAQ,CAAC,IAAI,CAAE,WAAW,CAAC,CAAC,CAAmB,CAAC,aAAa,EAAE,CAAC,CAAC;AAClE,SAAA;AACD,QAAA,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACxC,OAAO;AACR,KAAA;IAED,IAAI,oBAAoB,CAAC,MAAM,EAAE;AAC/B,QAAA,IAAI,CAAC,WAAW,CAAC,iBAAiB,EAAE;YAClC,OAAO,GAAG,qBAAqB,CAAC,OAAO,EAAE,WAAW,CAAC,kBAAkB,CAAuB,CAAC;AAChG,SAAA;AAED,QAAA,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,gBAAgB;AACnD,YAAA,sBAAsB,CACpB,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,EACxC,OAAO,EACP,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,SAAS,CACR,CAAC;AAEN,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,oBAAoB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACzD,YAAA,OAAO,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAClC,YAAA,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC7E,YAAA,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC5B,SAAA;AACF,KAAA;AAED,IAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,QAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;AACtD,KAAA;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAK,EAAE,MAAO,EAAA;IACzC,IAAI,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAClC,IAAA,IAAI,iBAAiB,CAAC;AACtB,IAAA,IAAI,CAAC,CAAC;AACN,IAAA,IAAI,OAAO,CAAC;AACZ,IAAA,IAAI,GAAG,CAAC;AACR,IAAA,IAAI,KAAK,CAAC;AAEV,IAAA,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;AAEtB,IAAA,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACtC,QAAA,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AACxB,QAAA,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACzC,QAAA,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,IAAI,EAAE,CAAC;AACrD,QAAA,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACxD,QAAA,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACrB,KAAA;AAED,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAG,EAAA;IAC9B,IAAI,MAAM,GAAG,EAAE,CAAC;AAEhB,IAAA,KAAK,IAAI,GAAG,IAAI,GAAG,EAAE;QACnB,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AACtC,KAAA;AAED,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,yBAAyB,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,WAAyB,EAAE,QAAmB,EAAE,QAAgB,EAAA;AAClI,IAAA,IAAI,oBAAoB,GAAG,WAAW,CAAC,oBAAoB,CAAC;AAC5D,IAAA,IAAI,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;AAC1C,IAAA,IAAI,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;AACtC,IAAA,IAAI,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;AAChC,IAAA,IAAI,CAAC,CAAC;AACN,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,IAAI,OAAO,CAAC;AACZ,IAAA,IAAI,QAAQ,CAAC;AACb,IAAA,IAAI,qBAAqB,CAAC;AAE1B,IAAA,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,EAAE;AACV,QAAA,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC;AAClE,KAAA;AAGD,IAAA,KAAK,IAAI,GAAG,IAAI,MAAM,EAAE;AACtB,QAAA,qBAAqB,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;AAElD,QAAA,IAAI,qBAAqB,EAAE;YACzB,IAAI,GAAG,KAAK,OAAO,EAAE;AAEnB,gBAAA,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,qBAAqB,GAAG,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1E,aAAA;iBAAM,IAAI,GAAG,KAAK,OAAO,EAAE;gBAE1B,IAAI,WAAW,GAAG,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACnD,gBAAA,mBAAmB,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;gBACxD,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC;AACjE,aAAA;AAGF,SAAA;AAAM,aAAA;YAEL,OAAO,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACxC,SAAA;AACF,KAAA;IAGD,IAAI,oBAAoB,CAAC,MAAM,EAAE;AAC/B,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,oBAAoB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACzD,YAAA,OAAO,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAClC,YAAA,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;YAEtE,IAAI,QAAQ,CAAC,WAAW,EAAE;AACxB,gBAAA,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACrC,aAAA;AAED,YAAA,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC5B,SAAA;AACF,KAAA;AAGD,IAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,QAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;AACtD,KAAA;AACH,CAAC;AAKD,IAAA,gBAAA,IAAA,YAAA;AAgBE,IAAA,SAAA,gBAAA,CAAY,eAA0B,EAAE,WAAwB,EAAE,gBAAyB,EAAA;AACzF,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,wBAAwB,GAAG,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC;KACxE;AAMD,IAAA,gBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,IAAI,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC;AACtG,QAAA,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;AAC9B,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAKD,IAAA,MAAA,CAAA,cAAA,CAAI,gBAAS,CAAA,SAAA,EAAA,WAAA,EAAA;AAAb,QAAA,GAAA,EAAA,YAAA;AACE,YAAA,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;SACnC;;;AAAA,KAAA,CAAA,CAAA;AAOD,IAAA,gBAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,UAAa,IAAqB,EAAE,yBAAkC,EAAA;QACpE,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC;KAChE,CAAA;AAMD,IAAA,gBAAA,CAAA,SAAA,CAAA,aAAa,GAAb,YAAA;AACE,QAAA,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;KACzC,CAAA;IAMD,gBAAiB,CAAA,SAAA,CAAA,iBAAA,GAAjB,UAAkB,IAAU,EAAA;AAC1B,QAAA,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;KAC1C,CAAA;IACH,OAAC,gBAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAKD,IAAA,WAAA,IAAA,YAAA;AAmBE,IAAA,SAAA,WAAA,CAAY,QAA0B,EAAE,YAAoB,EAAE,SAAwB,EAAA;QAftF,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;AAgBhB,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;AACjC,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;AACpB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;KACnB;AAOD,IAAA,WAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,UAAa,IAAqB,EAAE,yBAAmC,EAAA;AACrE,QAAA,IAAI,IAAI,EAAE;YACR,IAAI,IAAI,KAAK,GAAG,EAAE;AAChB,gBAAA,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC;AACzB,aAAA;AAAM,iBAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AACnC,gBAAA,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC3B,aAAA;AACF,SAAA;QAED,IAAI,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC,IAAI,CAAC,yBAAyB,EAAE;AACvD,YAAA,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAC/B,SAAA;AAED,QAAA,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE;AACtB,YAAA,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;AACjB,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AACnB,SAAA;QAED,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;KACrC,CAAA;AAMD,IAAA,WAAA,CAAA,SAAA,CAAA,aAAa,GAAb,YAAA;QACE,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,IAAI,IAAI,IAAI,CAAC;KAChE,CAAA;IAMD,WAAiB,CAAA,SAAA,CAAA,iBAAA,GAAjB,UAAkB,IAAU,EAAA;QAC1B,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,QAAQ,EAAE,CAAC;AACjB,SAAA;QAED,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,MAAM,EAAE,CAAC;AACf,SAAA;AAED,QAAA,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE;AAC7D,YAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;AACtB,YAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvB,SAAA;KACF,CAAA;AASD,IAAA,WAAA,CAAA,SAAA,CAAA,MAAM,GAAN,UAAO,SAAoB,EAAE,iBAAyC,EAAE,OAAiB,EAAA;AACvF,QAAA,iBAAiB,GAAG,iBAAiB,IAAI,mBAAmB,CAAC,MAAM,CAAC;AAEpE,QAAA,IAAI,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACtC,IAAI,UAAU,KAAK,IAAI,EAAE;AACvB,YAAA,OAAO,UAAU,CAAC;AACnB,SAAA;QAED,IAAI,QAAQ,GAAG,iBAAiB,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAqB,CAAC;QAC7G,IAAI,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAC5D,QAAA,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;AACrC,QAAA,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAC/B,IAAI,WAAW,GAAiB,EAAE,CAAC;QACnC,IAAI,QAAQ,GAAc,EAAE,CAAC;QAC7B,IAAI,QAAQ,GAAW,EAAE,CAAC;QAC1B,IAAI,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACtC,QAAA,IAAI,UAAU,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AACrC,QAAA,IAAI,gBAAgB,GAAG,iBAAiB,CAAC,gBAA+C,CAAC;AACzF,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,IAAU,CAAC;AACf,QAAA,IAAI,YAAY,CAAC;AACjB,QAAA,IAAI,WAAW,CAAC;AAEhB,QAAA,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAEzF,QAAA,IAAI,OAAO,IAAI,IAAI,CAAC,oBAAoB,KAAK,IAAI,EAAE;AACjD,YAAA,yBAAyB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC3G,SAAA;QAGD,IAAI,iBAAiB,CAAC,OAAO,IAAK,QAA+B,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE;YAC9F,YAAY,GAAG,QAAQ,CAAC;YACxB,WAAW,GAAG,YAAY,CAAC,YAAY,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC;AACtE,YAAA,iBAAiB,CAAC,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AACrI,SAAA;AAED,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAClD,YAAA,YAAY,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YAChC,WAAW,GAAG,YAAY,CAAC,YAAY,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC;AACtE,YAAA,iBAAiB,CAAC,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AACrI,SAAA;AAED,QAAA,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAGzF,QAAA,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,EAAE;YAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;AAChB,SAAA;QAED,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAEhD,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;IACH,OAAC,WAAA,CAAA;AAAD,CAAC,EAAA;;AClgBD,IAAI,cAAc,GAAG,CAAC,CAAC;AACvB,SAAS,iBAAiB,GAAA;IACxB,OAAO,EAAE,cAAc,CAAC;AAC1B,CAAC;AAED,IAAI,cAAc,GAAG,CAAC,CAAC;AACvB,SAAS,iBAAiB,GAAA;AACxB,IAAA,OAAO,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;AACvC,CAAC;AAED,SAAS,yBAAyB,CAAC,OAAO,EAAA;IACxC,IAAI,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;AAC1C,IAAA,IAAI,UAAU,GAAG,iBAAiB,EAAE,CAAC;AAErC,IAAA,OAAO,CAAC,YAAY,CAAC,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,YAAY,GAAG,WAAW,EAAE,CAAC;AAC5E,IAAA,OAAO,CAAC,YAAY,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;AAEjD,IAAA,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,gBAAgB,EAAA;IAC/E,IAAI,YAAY,GAAGA,cAAG,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;AACvD,IAAAA,cAAG,CAAC,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AAEpC,IAAA,IAAI,UAAU,GAAG,yBAAyB,CAAC,YAAY,CAAC,CAAC;IACzD,IAAI,WAAW,GAAG,iBAAiB,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;AAEjE,IAAA,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,cAAc,CAAC;IAC7E,WAAW,CAAC,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAExD,IAAA,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE;AACzB,QAAA,IAAI,QAAQ,GAAGA,cAAG,CAAC,sBAAsB,EAAE,CAAC;QAC5C,IAAI,KAAK,SAAA,CAAC;AAEV,QAAA,OAAO,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE;AAC9B,YAAA,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC7B,SAAA;QAED,WAAW,CAAC,mBAAmB,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACzE,KAAA;AAED,IAAA,YAAY,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC;AAEvC,IAAA,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,IAAM,iBAAiB,GAAG,eAAe,CAAC,SAAS,CAAC,oBAAoB,CAAC;AAKzE,IAAA,YAAA,IAAA,YAAA;IAkBE,SAAY,YAAA,CAAA,eAAgC,EAAE,SAAwB,EAAA;AACpE,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;AACvC,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;KAC5B;AAlBM,IAAA,YAAA,CAAA,MAAM,GAAb,YAAA;AACE,QAAA,OAAO,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;KACzC,CAAA;AAyBD,IAAA,YAAA,CAAA,SAAA,CAAA,OAAO,GAAP,UAAQ,MAAuC,EAAE,SAAyB,EAAE,kBAA2C,EAAA;AACrH,QAAA,SAAS,GAAG,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC;AACxC,QAAA,kBAAkB,GAAG,kBAAkB,IAAI,sBAAsB,CAAC,MAAM,CAAC;AACzE,QAAA,MAAM,GAAG,OAAO,MAAM,KAAK,QAAQ,GAAGA,cAAG,CAAC,wBAAwB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAEpF,QAAA,IAAI,OAAO,CAAC;AACZ,QAAA,IAAI,IAAI,CAAC;AACT,QAAA,IAAI,SAAS,CAAC;QAEd,IAAK,MAA8B,CAAC,OAAO,EAAE;AAC3C,YAAA,IAAI,GAAI,MAAkB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAChD,YAAA,SAAS,GAAI,MAAkB,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;YAC3D,OAAO,GAAGA,cAAG,CAAC,SAAS,CAAE,MAA8B,CAAC,OAAO,CAAC,CAAC;AAClE,SAAA;AAAM,aAAA;YACL,OAAO,GAAG,MAAM,CAAC;AAClB,SAAA;QAED,kBAAkB,CAAC,eAAe,GAAG,kBAAkB,CAAC,eAAe,IAAIgD,kBAAO,CAAC,SAAS,CAAC;QAC7F,SAAS,CAAC,WAAW,CAAC,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC;QAE/E,IAAI,YAAY,GAAG,EAAE,CAAC;AACtB,QAAA,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;AAEzG,QAAA,IAAI,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;AACpC,QAAA,IAAI,UAAU,IAAI,UAAU,CAAC,QAAQ,KAAK,CAAC,EAAE;YAC3C,IAAI,QAAQ,GAAG,UAAU,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;AACvD,YAAA,IAAI,QAAQ,EAAE;AACZ,gBAAA,IAAI,GAAG,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAEjC,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC,kBAAkB,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,EAAE;AAC1G,oBAAA,OAAO,CAAC,YAAY,CAAChD,cAAG,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC;AAC7D,iBAAA;AACF,aAAA;AACF,SAAA;QAED,IAAI,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QAEhE,OAAO,CAAC,oBAAoB,GAAG,kBAAkB,CAAC,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;AACtH,QAAA,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;AAEpB,QAAA,IAAI,SAAS,EAAE;AACb,YAAA,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;AACjC,SAAA;AAED,QAAA,SAAS,CAAC,WAAW,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAE/C,QAAA,OAAO,OAAO,CAAC;KAChB,CAAA;AAGD,IAAA,YAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,UAAa,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,EAAA;QACtF,QAAQ,IAAI,CAAC,QAAQ;AACrB,YAAA,KAAK,CAAC;AACJ,gBAAA,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAC3G,YAAA,KAAK,CAAC;AAEJ,gBAAA,IAAI,UAAU,GAAG,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;AAClH,gBAAA,IAAI,UAAU,EAAE;oBACd,IAAI,MAAM,GAAGA,cAAG,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;AAC5C,oBAAA,IAAI,UAAU,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;AACnD,oBAAA,CAAC,IAAI,CAAC,UAAU,IAAI,UAAU,EAAE,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC3D,oBAAA,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;oBACvB,YAAY,CAAC,UAAU,CAAC,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;oBAE3E,OAAO,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,KAAK,CAAC,EAAE;AAC1D,wBAAA,CAAC,IAAI,CAAC,UAAU,IAAI,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC/D,qBAAA;AACF,iBAAA;AAAM,qBAAA;oBAEL,OAAO,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,KAAK,CAAC,EAAE;AAC1D,wBAAA,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;AACzB,qBAAA;AACF,iBAAA;gBACD,OAAO,IAAI,CAAC,WAAW,CAAC;AAC1B,YAAA,KAAK,EAAE;AACL,gBAAA,IAAI,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC;AACnC,gBAAA,OAAO,YAAY,EAAE;AACnB,oBAAA,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;AACjH,iBAAA;gBACD,MAAM;AAGP,SAAA;QAED,OAAO,IAAI,CAAC,WAAW,CAAC;KACzB,CAAA;AAGD,IAAA,YAAA,CAAA,SAAA,CAAA,iBAAiB,GAAjB,UAAkB,IAAI,EAAE,SAAwB,EAAA;QAC9C,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;AACzC,QAAA,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,IAAI,eAAe,GAAG,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AACzE,QAAA,IAAI,cAAc,CAAC;AACnB,QAAA,IAAI,QAA0B,CAAC;AAC/B,QAAA,IAAI,WAAgC,CAAC;AACrC,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,IAAI,CAAC;AACT,QAAA,IAAI,QAAQ,CAAC;AACb,QAAA,IAAI,SAAS,CAAC;AACd,QAAA,IAAI,IAAmB,CAAC;AACxB,QAAA,IAAI,IAA0B,CAAC;QAC/B,IAAI,WAAW,GAAyD,EAAE,CAAC;AAC3E,QAAA,IAAI,UAAyD,CAAC;QAC9D,IAAI,oBAAoB,GAA0B,EAAE,CAAC;QACrD,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,SAAS,GAAG,EAAE,CAAC;AAEnB,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC/C,YAAA,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AACrB,YAAA,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;AACrB,YAAA,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;AAEvB,YAAA,IAAI,GAAG,eAAe,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAkB,CAAC;YAClG,IAAI,GAAG,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAE7C,YAAA,IAAI,IAAI,EAAE;gBACR,cAAc,GAAG,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACvD,gBAAA,IAAI,cAAc,EAAE;AAClB,oBAAA,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;AAE3C,oBAAA,IAAI,QAAQ,EAAE;AACZ,wBAAA,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC,kBAAkB,CAAC;wBAEtD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;AACrC,4BAAA,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC;AACvD,yBAAA;AAKD,wBAAA,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE;AACxE,4BAAA,IAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;4BAC7C,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC;AAGrD,4BAAA,IAAI,CAAC,kBAAkB,GAAG,eAAe,CAAC,kBAAkB,CAAC;AAC9D,yBAAA;AACF,qBAAA;AACF,iBAAA;AACF,aAAA;AAED,YAAA,WAAW,GAAG,eAAe,CAAC,0BAA0B,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAEjG,YAAA,IAAI,WAAW,EAAE;gBACf,IAAI,WAAW,CAAC,WAAW,EAAE;oBAC3B,IAAI,GAAG,SAAS,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACrD,iBAAA;gBAED,IAAI,WAAW,CAAC,QAAQ,EAAE;AACxB,oBAAA,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC/B,iBAAA;AAAM,qBAAA;AACL,oBAAA,IAAI,IAAI,EAAE;AACR,wBAAA,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;AACxB,wBAAA,IAAI,CAAC,oBAAoB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;wBAElD,IAAI,IAAI,CAAC,YAAY,EAAE;AACrB,4BAAA,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;AACnF,yBAAA;AAAM,6BAAA;AACL,4BAAA,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACxC,yBAAA;AACF,qBAAA;AAAM,yBAAA;AACL,wBAAA,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;AAChE,qBAAA;AACF,iBAAA;AACF,aAAA;AAAM,iBAAA;AACL,gBAAA,IAAI,IAAI,EAAE;oBACR,WAAW,GAAG,mBAAmB,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC5D,oBAAA,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,CAAC;oBAErE,IAAI,IAAI,CAAC,YAAY,EAAE;AACrB,wBAAA,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;AACnF,qBAAA;AAAM,yBAAA;AACL,wBAAA,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACxC,qBAAA;AACF,iBAAA;qBAAM,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,cAAc,EAAE;oBAClF,SAAS,GAAG,IAAI,CAAC;AACjB,oBAAA,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;AAC9B,iBAAA;AACF,aAAA;AACF,SAAA;QAED,IAAI,WAAW,CAAC,MAAM,IAAI,oBAAoB,CAAC,MAAM,IAAI,SAAS,EAAE;AAClE,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,oBAAoB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACzD,gBAAA,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AACtC,gBAAA,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;gBAC7D,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzC,aAAA;AAED,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,gBAAA,UAAU,GAAI,WAAW,CAAC,CAAC,CAAsB,CAAC;AAClD,gBAAA,IAAI,UAAU,CAAC,YAAY,KAAK,SAAS,EAAE;AACzC,oBAAA,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAC/C,iBAAA;AACF,aAAA;AAED,YAAA,OAAO,iBAAiB,CAAC,SAAS,CAAC,SAAS,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;AAC1F,SAAA;AAED,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAGD,IAAA,YAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,IAAa,EAAE,SAAwB,EAAE,YAAiB,EAAE,UAAgB,EAAE,gBAAwB,EAAE,cAAuB,EAAA;QAC7I,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;AACzC,QAAA,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,IAAI,WAAW,GAAyD,EAAE,CAAC;AAC3E,QAAA,IAAI,UAAyD,CAAC;QAC9D,IAAI,oBAAoB,GAA0B,EAAE,CAAC;QACrD,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,IAAI,eAAe,GAAG,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AACzE,QAAA,IAAI,kBAAuC,CAAC;AAC5C,QAAA,IAAI,WAAwB,CAAC;AAC7B,QAAA,IAAI,IAA0B,CAAC;AAC/B,QAAA,IAAI,kBAAuC,CAAC;AAC5C,QAAA,IAAI,eAAiC,CAAC;AACtC,QAAA,IAAI,CAAS,CAAC;AACd,QAAA,IAAI,EAAU,CAAC;AACf,QAAA,IAAI,IAAU,CAAC;AACf,QAAA,IAAI,QAAgB,CAAC;AACrB,QAAA,IAAI,SAAS,CAAC;AACd,QAAA,IAAI,gBAAgB,CAAC;AACrB,QAAA,IAAI,WAAgC,CAAC;AACrC,QAAA,IAAI,IAAmB,CAAC;AACxB,QAAA,IAAI,QAA0B,CAAC;AAC/B,QAAA,IAAI,cAAc,CAAC;AACnB,QAAA,IAAI,UAAkB,CAAC;AACvB,QAAA,IAAI,UAAU,CAAC;QAEf,IAAI,OAAO,KAAK,MAAM,EAAE;AACtB,YAAA,IAAI,cAAc,EAAE;AAClB,gBAAA,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;AAC9E,aAAA;YACD,OAAO,IAAI,CAAC,WAAW,CAAC;AACzB,SAAA;aAAM,IAAI,OAAO,KAAK,UAAU,EAAE;AACjC,YAAA,IAAI,EAAE,SAAS,IAAI,IAAI,CAAC,EAAE;gBACxB,MAAM,IAAI,KAAK,CAAC,6CAA6C,GAAG,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,CAAC;AACnG,aAAA;YACD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAC5C,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAC9C,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,CAAC;AAIxE,YAAA,IAAI,OAAO,KAAK,KAAK,IAAI,CAAC,IAAI,IAAI,eAAe,CAAC,oBAAoB,KAAK,iBAAiB,EAAE;gBAC5F,WAAW,GAAG,eAAe,CAAC,oBAAoB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACpE,gBAAA,UAAU,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;gBAC7C,YAAY,CAAC,UAAU,CAAC,GAAG,iBAAiB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;gBACrE,OAAO,IAAI,CAAC,WAAW,CAAC;AACzB,aAAA;AACD,YAAA,IAAI,IAAI,EAAE;gBACR,kBAAkB,GAAG,mBAAmB,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC7D,gBAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAC;AAC9E,gBAAA,oBAAoB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AAC/C,aAAA;AACF,SAAA;AAED,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC/C,YAAA,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AACrB,YAAA,gBAAgB,GAAG,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;AACxC,YAAA,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;AACvB,YAAA,IAAI,GAAG,eAAe,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAkB,CAAC;AAElG,YAAA,IAAI,cAAc,IAAI,IAAI,CAAC,QAAQ,KAAK,MAAM,EAAE;AAC9C,gBAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AACtC,aAAA;YAED,IAAI,GAAG,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC7C,eAAe,GAAG,IAAI,CAAC;AAEvB,YAAA,IAAI,IAAI,EAAE;gBACR,cAAc,GAAG,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACvD,gBAAA,IAAI,cAAc,EAAE;AAClB,oBAAA,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;AAE3C,oBAAA,IAAI,QAAQ,EAAE;AACZ,wBAAA,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC,kBAAkB,CAAC;wBAEtD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;AACrC,4BAAA,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC;AACvD,yBAAA;AAKD,wBAAA,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE;AACxE,4BAAA,IAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;4BAC7C,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC;AAGrD,4BAAA,IAAI,CAAC,kBAAkB,GAAG,eAAe,CAAC,kBAAkB,CAAC;AAC9D,yBAAA;AACF,qBAAA;AACF,iBAAA;AACF,aAAA;AAAM,iBAAA,IAAI,kBAAkB,EAAE;gBAC7B,eAAe,GAAG,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACpE,gBAAA,IAAI,eAAe,EAAE;AACnB,oBAAA,IAAI,CAAC,kBAAkB,GAAG,eAAe,CAAC,kBAAkB,CAAC;AAC9D,iBAAA;AACF,aAAA;AAED,YAAA,IAAI,eAAe,EAAE;AACnB,gBAAA,WAAW,GAAG,eAAe,CAAC,0BAA0B,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;AACrG,aAAA;AAAM,iBAAA;AACL,gBAAA,WAAW,GAAG,eAAe,CAAC,0BAA0B,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAClG,aAAA;AAED,YAAA,IAAI,WAAW,EAAE;gBACf,IAAI,WAAW,CAAC,WAAW,EAAE;oBAC3B,IAAI,GAAG,SAAS,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACrD,iBAAA;gBAED,IAAI,WAAW,CAAC,QAAQ,EAAE;AACxB,oBAAA,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC/B,iBAAA;AAAM,qBAAA;AACL,oBAAA,IAAI,IAAI,EAAE;AACR,wBAAA,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;AACxB,wBAAA,IAAI,CAAC,oBAAoB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;wBAElD,IAAI,IAAI,CAAC,YAAY,EAAE;AACrB,4BAAA,WAAW,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;4BAChD,kBAAkB,GAAG,WAAW,CAAC;4BACjC,MAAM;AACP,yBAAA;AAAM,6BAAA;AACL,4BAAA,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACxC,yBAAA;AACF,qBAAA;AAAM,yBAAA,IAAI,eAAe,EAAE;AAC1B,wBAAA,kBAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC;AACpF,qBAAA;AAAM,yBAAA;AACL,wBAAA,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;AAChE,qBAAA;AACF,iBAAA;AACF,aAAA;AAAM,iBAAA;AACL,gBAAA,IAAI,IAAI,EAAE;oBACR,WAAW,GAAG,mBAAmB,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC5D,oBAAA,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,CAAC;oBAErE,IAAI,IAAI,CAAC,YAAY,EAAE;AACrB,wBAAA,WAAW,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;wBAChD,kBAAkB,GAAG,WAAW,CAAC;wBACjC,MAAM;AACP,qBAAA;AAAM,yBAAA;AACL,wBAAA,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACxC,qBAAA;AACF,iBAAA;AAAM,qBAAA,IAAI,eAAe,EAAE;AAC1B,oBAAA,kBAAkB,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;AACrD,iBAAA;AAGF,aAAA;AACF,SAAA;AAED,QAAA,IAAI,kBAAkB,EAAE;AACtB,YAAA,kBAAkB,CAAC,WAAW,GAAG,WAAW,CAAC;AAC7C,YAAA,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,EAAE,UAAU,CAAC,CAAC;AAC9F,YAAA,UAAU,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;AAC7C,YAAA,YAAY,CAAC,UAAU,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;AAC5F,SAAA;AAAM,aAAA;YACL,IAAI,qBAAqB,GAAG,KAAK,CAAC;AAElC,YAAA,IAAI,WAAW,CAAC,MAAM,IAAI,oBAAoB,CAAC,MAAM,EAAE;AACrD,gBAAA,UAAU,GAAG,oBAAoB,CAAC,MAAM,GAAG,iBAAiB,EAAE,GAAG,KAAK,CAAC;AAEvE,gBAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,oBAAoB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACzD,oBAAA,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AACtC,oBAAA,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;oBACzE,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACxC,oBAAA,qBAAqB,GAAG,qBAAqB,IAAI,WAAW,CAAC,qBAAqB,CAAC;AACpF,iBAAA;AAED,gBAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,oBAAA,UAAU,GAAI,WAAW,CAAC,CAAC,CAAsB,CAAC;AAClD,oBAAA,IAAI,UAAU,CAAC,YAAY,KAAK,SAAS,EAAE;AACzC,wBAAA,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAC/C,qBAAA;AACF,iBAAA;AAED,gBAAA,UAAU,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;gBAC7C,YAAY,CAAC,UAAU,CAAC,GAAG,iBAAiB,CAAC,MAAM,CACjD,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,WAAW,EACX,kBAAkB,CACnB,CAAC;AACH,aAAA;AAED,YAAA,IAAI,qBAAqB,EAAE;gBACzB,OAAO,IAAI,CAAC,WAAW,CAAC;AACzB,aAAA;AAED,YAAA,IAAI,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC;AACnC,YAAA,OAAO,YAAY,EAAE;AACnB,gBAAA,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,IAAI,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAC/H,aAAA;AACF,SAAA;QAED,OAAO,IAAI,CAAC,WAAW,CAAC;KACzB,CAAA;AAGD,IAAA,YAAA,CAAA,SAAA,CAAA,oBAAoB,GAApB,UAAqB,WAAW,EAAE,SAAS,EAAA;AACzC,QAAA,IAAI,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;AAC5B,QAAA,IAAI,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;AACpC,QAAA,IAAI,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;AACxC,QAAA,IAAI,QAAQ,CAAC;AACb,QAAA,IAAI,GAAG,CAAC;AACR,QAAA,IAAI,KAAK,CAAC;QAEV,IAAI,cAAc,GAAG,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACtD,IAAI,cAAc,IAAI,QAAQ,IAAI,UAAU,IAAI,cAAc,KAAK,QAAQ,EAAE;YAC3E,UAAU,CAAC,cAAc,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;AAClD,YAAA,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC7B,SAAA;QAED,KAAK,GAAG,IAAI,UAAU,EAAE;AACtB,YAAA,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;YAExB,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC/C,gBAAA,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;gBAEhC,IAAI,QAAQ,KAAK,SAAS,EAAE;AAC1B,oBAAA,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC;AACtC,iBAAA;AAAM,qBAAA;AACL,oBAAA,KAAK,CAAC,cAAc,GAAG,GAAG,CAAC;AAC5B,iBAAA;AACF,aAAA;AACF,SAAA;KACF,CAAA;IACH,OAAC,YAAA,CAAA;AAAD,CAAC,EAAA;;ACxgBD,IAAA,uBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,uBAAA,GAAA;KAmBC;AAfC,IAAA,uBAAA,CAAA,SAAA,CAAA,UAAU,GAAV,UAAW,SAAS,EAAE,MAAM,EAAA;QAC1B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;KACvC,CAAA;AAED,IAAA,uBAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,QAAQ,EAAE,IAAI,EAAA;AACrB,QAAA,QAAQ,CAAC,uBAAuB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KACjD,CAAA;AAED,IAAA,uBAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,SAAS,EAAE,MAAM,KAAI,CAAA;IAEnB,uBAAU,CAAA,UAAA,GAAjB,UAAkB,IAAI,EAAA;AACpB,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;YACpC,OAAO,IAAI,uBAAuB,EAAE,CAAC;AACtC,SAAA;KACF,CAAA;IACH,OAAC,uBAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAEK,SAAU,eAAe,CAAC,MAAO,EAAA;IACrC,IAAI,IAAI,GAAG,UAAS,CAAC,EAAA;AACnB,QAAAwE,wBAAQ,CAAC,MAAM,CAACA,wBAAQ,CAAC,QAAQ,EAAE,IAAI,uBAAuB,EAAE,EAAE,CAAC,CAAC,CAAC;AACvE,KAAC,CAAC;AAEF,IAAA,OAAO,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AACtC;;ACfA,IAAA,cAAA,IAAA,YAAA;AA8BE,IAAA,SAAA,cAAA,CAAY,QAAgB,EAAA;AAC1B,QAAA,IAAI,CAAC,EAAE,GAAG,QAAQ,CAAC;AACnB,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AAC3B,QAAA,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;AACzB,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;AACtB,QAAA,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;AACzB,QAAA,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;AAC3B,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;AACrB,QAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;KACzB;IAMD,cAAU,CAAA,SAAA,CAAA,UAAA,GAAV,UAAW,SAAoB,EAAA;AAC7B,QAAA,IAAI,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC;AAChC,QAAA,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;AAC/B,QAAA,IAAI,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;QAE3B,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,OAAO;AACR,SAAA;AAED,QAAA,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAE1B,IAAI,OAAO,KAAK,SAAS,EAAE;AACzB,YAAA,OAAO,CAAC,QAAQ,CAAC,YAAY,GAAG,EAAE,CAAC;AACnC,YAAA,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC/B,SAAA;AAED,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAClD,YAAA,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AACvB,YAAA,OAAO,CAAC,QAAQ,CAAC,YAAY,GAAG,EAAE,CAAC;AACnC,YAAA,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC/B,SAAA;KACF,CAAA;AAOD,IAAA,cAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,QAAsB,EAAE,IAAY,EAAA;AAC3C,QAAA,IAAI,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC;AAC7B,QAAA,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAE/B,IAAI,IAAI,KAAK,SAAS,EAAE;AACtB,YAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC9B,IAAI,GAAG,IAAI,CAAC;AACb,SAAA;AAED,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YAClD,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACtC,IAAI,GAAG,IAAI,CAAC;AACb,SAAA;KACF,CAAA;AAQD,IAAA,cAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,SAAoB,EAAE,WAAiC,EAAA;AAC1D,QAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE;AAE1B,YAAA,OAAO,IAAI,CAAC,WAAW,KAAK,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC7E,SAAA;AAED,QAAA,IAAI,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC;AAC7B,QAAA,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;AAC/B,QAAA,IAAI,KAAK,CAAC;QAEV,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,KAAK,GAAG,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACxC,YAAA,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAC7C,YAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAClD,gBAAA,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAC1D,aAAA;AACF,SAAA;AAAM,aAAA;YACL,KAAK,GAAG,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AACpC,YAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAClD,gBAAA,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AACtD,aAAA;AACF,SAAA;AAED,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,QAAQ,CAAC;KACtB,CAAA;IACH,OAAC,cAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAKD,IAAA,mBAAA,IAAA,YAAA;AAcE,IAAA,SAAA,mBAAA,CAAY,GAAW,EAAE,aAAkB,EAAE,gBAAyB,EAAA;QACpE,IAAI,CAAC,gBAAgB,EAAE;YACrB,gBAAgB,GAAGA,wBAAQ,CAAC,GAAG,CAACA,wBAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;YAElE,IAAI,CAAC,gBAAgB,EAAE;AACrB,gBAAA,gBAAgB,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,gBAAA,gBAAyC,CAAC,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;gBACzEA,wBAAQ,CAAC,MAAM,CAACA,wBAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;AACrE,aAAA;AACF,SAAA;QAED,IAAI,gBAAgB,YAAY,oBAAoB,EAAE;AACpD,YAAA,IAAI,gBAAgB,CAAC,WAAW,KAAK,SAAS,EAAE;AAE9C,gBAAA,gBAAgB,CAAC,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;AAChD,aAAA;AAAM,iBAAA,IAAI,gBAAgB,CAAC,aAAa,KAAK,SAAS,EAAE;AAEvD,gBAAA,gBAAgB,CAAC,aAAa,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;AAClD,aAAA;iBAAM,IAAI,gBAAgB,CAAC,aAAa,KAAK,IAAI,IAAI,gBAAgB,CAAC,WAAW,KAAK,IAAI,EAAE;AAE3F,gBAAA,oBAAoB,CAAC,UAAU,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AACxD,aAAA;AACF,SAAA;AAAM,aAAA,IAAI,CAAE,gBAAwB,CAAC,IAAI,EAAE;AACzC,YAAA,gBAAwB,CAAC,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;AAClD,SAAA;AAED,QAAA,IAAI,CAAC,QAAQ,GAAG,gBAAoC,CAAC;AACrD,QAAA,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC;KAC5B;IAMD,mBAAU,CAAA,SAAA,CAAA,UAAA,GAAV,UAAW,SAAoB,EAAA;QAC7B,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;KACjD,CAAA;AAOD,IAAA,mBAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,QAAuB,EAAE,IAAa,EAAA;QAC7C,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;KACxC,CAAA;AAQD,IAAA,mBAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,SAAoB,EAAE,WAAiC,EAAA;AAC1D,QAAA,OAAQ,IAAI,CAAC,QAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;KACxE,CAAA;IACH,OAAC,mBAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAKD,IAAA,cAAA,IAAA,YAAA;AAME,IAAA,SAAA,cAAA,GAAA;QACE,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KAClC;IAOD,cAAW,CAAA,SAAA,CAAA,WAAA,GAAX,UAAY,QAAgB,EAAA;AAC1B,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;KAC7B,CAAA;AASD,IAAA,cAAA,CAAA,SAAA,CAAA,OAAO,GAAP,UAAQ,QAAgB,EAAE,cAAmB,EAAE,eAAwB,EAAA;AACrE,QAAA,IAAI,YAAiC,CAAC;AACtC,QAAA,IAAI,aAAa,CAAC;AAClB,QAAA,IAAI,WAAW,CAAC;AAChB,QAAA,IAAI,gBAAkC,CAAC;AACvC,QAAA,IAAI,GAAW,CAAC;AAChB,QAAA,IAAI,aAAa,CAAC;QAClB,IAAI,SAAS,GAA0B,EAAE,CAAC;AAC1C,QAAA,IAAI,YAA8B,CAAC;AACnC,QAAA,IAAI,EAAgB,CAAC;AACrB,QAAA,IAAI,cAA8B,CAAC;AAEnC,QAAA,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AACtC,QAAA,IAAI,cAAc,EAAE;AAClB,YAAA,OAAO,cAAc,CAAC;AACvB,SAAA;AAED,QAAA,cAAc,GAAG,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC9C,QAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC;AAEtC,QAAA,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE;AACxC,YAAA,cAAc,GAAG,EAAC,SAAS,EAAE,cAAc,EAAC,CAAC;AAC9C,SAAA;AAED,QAAA,IAAI,eAAe,EAAE;YACnB,YAAY,GAAG,IAAI,mBAAmB,CAAC,eAAe,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC;AAC1F,SAAA;QAED,KAAK,GAAG,IAAI,cAAc,EAAE;AAC1B,YAAA,aAAa,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;YAEpC,IAAI,GAAG,KAAK,eAAe,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE;gBAClE,SAAS;AACV,aAAA;YAID,gBAAgB,GAAGA,wBAAQ,CAAC,GAAG,CAACA,wBAAQ,CAAC,QAAQ,EAAE,aAAa,CAAqB,CAAC;AAEtF,YAAA,IAAI,gBAAgB,EAAE;gBACpB,IAAI,gBAAgB,YAAY,oBAAoB,EAAE;AAEpD,oBAAA,aAAa,CAAC,UAAU,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;oBAE1D,IAAI,gBAAgB,CAAC,aAAa,KAAK,IAAI,IAAI,gBAAgB,CAAC,WAAW,KAAK,IAAI,EAAE;AAEpF,wBAAA,oBAAoB,CAAC,UAAU,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AACxD,qBAAA;oBAED,IAAI,gBAAgB,CAAC,aAAa,KAAK,IAAI,IAAI,gBAAgB,CAAC,WAAW,KAAK,IAAI,EAAE;AAEpF,wBAAA,gBAAgB,CAAC,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;AAChD,qBAAA;AACF,iBAAA;AAED,gBAAA,IAAI,CAAC,YAAY,IAAI,gBAAgB,YAAY,oBAAoB,IAAI,gBAAgB,CAAC,WAAW,KAAK,IAAI,EAAE;oBAC9G,YAAY,GAAG,IAAI,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAAC;AAC9E,iBAAA;AAAM,qBAAA;AACL,oBAAA,SAAS,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC/E,iBAAA;AACF,aAAA;AAAM,iBAAA,IAAI,YAAY,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE;gBAChD,EAAE,GAAG,aAAa,CAAC;AACpB,aAAA;iBAAM,IAAI,aAAa,YAAYE,mCAAqB,EAAE;gBACzD,EAAE,GAAG,IAAI,4BAA4B,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAChE,aAAA;AAAM,iBAAA;gBACL,IAAI,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;oBAC1D,IAAK,YAAqC,CAAC,WAAW,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE;wBAChF,YAAY,GAAG,IAAI,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AAC1E,qBAAA;AAAM,yBAAA;AACL,wBAAA,SAAS,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC;AAC3E,qBAAA;oBACDF,wBAAQ,CAAC,MAAM,CAACA,wBAAQ,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;AACjE,iBAAA;qBAAM,IAAI,YAAY,GAAG,oBAAoB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;oBAC9D,IAAK,YAAqC,CAAC,WAAW,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE;wBAChF,YAAY,GAAG,IAAI,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AAC1E,qBAAA;AAAM,yBAAA;AACL,wBAAA,SAAS,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC;AAC3E,qBAAA;oBAEDA,wBAAQ,CAAC,MAAM,CAACA,wBAAQ,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;AACjE,iBAAA;AAAM,qBAAA,IAAI,YAAY,GAAGG,qCAAsB,CAAC,UAAU,CAAC,GAAG,CAAC;AAC3D,uBAAAC,sCAAuB,CAAC,UAAU,CAAC,GAAG,CAAC;AACvC,uBAAA,uBAAuB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;AAC5C,oBAAA,SAAS,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC;oBAC1EJ,wBAAQ,CAAC,MAAM,CAACA,wBAAQ,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;AACjE,iBAAA;qBAAM,IAAI,CAAC,aAAa,EAAE;oBACzB,aAAa,GAAG,aAAa,CAAC;oBAC9B,WAAW,GAAG,GAAG,CAAC;AACnB,iBAAA;AACF,aAAA;AACF,SAAA;AAED,QAAA,IAAI,CAAC,YAAY,IAAI,aAAa,EAAE;YAClC,YAAY,GAAG,IAAI,mBAAmB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AACpE,SAAA;AAED,QAAA,cAAc,CAAC,cAAc,GAAG,cAAc,CAAC;AAC/C,QAAA,cAAc,CAAC,YAAY,GAAG,YAAY,CAAC;AAC3C,QAAA,cAAc,CAAC,SAAS,GAAG,SAAS,CAAC;AACrC,QAAA,cAAc,CAAC,YAAY,GAAG,EAAE,CAAC;AAEjC,QAAA,OAAO,cAAc,CAAC;KACvB,CAAA;IACH,OAAC,cAAA,CAAA;AAAD,CAAC,EAAA;;AC3UD,IAAI,MAAM,GAAGrD,qBAAU,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;AAEhD,SAAS,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,EAAA;IACrD,IAAI,kBAAkB,YAAYuD,mCAAqB,EAAE;AACvD,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC5C,KAAA;AAED,IAAA,OAAO,MAAM,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;AACjD,CAAC;AAED,IAAA,gBAAA,IAAA,YAAA;AAEE,IAAA,SAAA,gBAAA,CAAY,OAAO,EAAA;QAAnB,IAEC,KAAA,GAAA,IAAA,CAAA;AADC,QAAA,OAAO,CAAC,IAAI,CAAC,UAAA,CAAC,EAAI,EAAA,OAAA,KAAI,CAAC,WAAW,GAAG,CAAC,CAApB,EAAoB,CAAC,CAAC;KACzC;IAED,gBAAM,CAAA,SAAA,CAAA,MAAA,GAAN,UAAO,SAAoB,EAAE,cAAuB,EAAE,iBAAyC,EAAE,OAAiB,EAAA;AAChH,QAAA,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;KACvF,CAAA;AAED,IAAA,MAAA,CAAA,cAAA,CAAI,gBAAS,CAAA,SAAA,EAAA,WAAA,EAAA;AAAb,QAAA,GAAA,EAAA,YAAA;AACE,YAAA,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;SACnC;;;AAAA,KAAA,CAAA,CAAA;AAED,IAAA,gBAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,UAAa,IAAqB,EAAE,yBAAkC,EAAA;QACpE,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC;KAChE,CAAA;AAED,IAAA,gBAAA,CAAA,SAAA,CAAA,aAAa,GAAb,YAAA;AACE,QAAA,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;KACzC,CAAA;IAED,gBAAiB,CAAA,SAAA,CAAA,iBAAA,GAAjB,UAAkB,IAAU,EAAA;AAC1B,QAAA,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;KAC1C,CAAA;IACH,OAAC,gBAAA,CAAA;AAAD,CAAC,EAAA,CAAA,CAAA;AAED,IAAI,cAAc,GAAG,IAAI,CAAC;AAK1B,IAAA,UAAA,IAAA,YAAA;IAsCE,SAAY,UAAA,CAAA,MAAc,EAAE,SAAoB,EAAE,YAA0B,EAAE,cAA8B,EAAE,YAA2B,EAAA;AACvI,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;AACjC,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;AACrC,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;AACjC,QAAA,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QAErB,IAAI,cAAc,KAAK,IAAI,EAAE;AAC3B,YAAA,cAAc,GAAI,IAAI,oBAAoB,EAAE,CAAC;AAC7C,YAAA,cAAc,CAAC,aAAa,GAAG,SAAS,CAAC;YACzCF,wBAAQ,CAAC,MAAM,CAACA,wBAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,mBAAmB,CAAC,CAAC;AACzE,SAAA;AAED,QAAA,cAAc,CAAC,UAAU,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;AAC1D,QAAA,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;KACvC;AAnDM,IAAA,UAAA,CAAA,MAAM,GAAb,YAAA;QACE,OAAO,CAACrE,oBAAM,EAAEF,oCAAS,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;KACzE,CAAA;AAwDD,IAAA,UAAA,CAAA,SAAA,CAAA,iBAAiB,GAAjB,UAAkB,SAAiB,EAAE,cAAsB,EAAA;AACzD,QAAA,IAAI,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,kBAAkB,CAAC;AAC3D,QAAA,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,cAA8B,CAAC,CAAC;KAC7D,CAAA;IAUD,UAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,kBAAgD,EAAE,kBAA2C,EAAE,WAAiC,EAAE,MAAY,EAAA;QAA9J,IAoCC,KAAA,GAAA,IAAA,CAAA;AAnCC,QAAA,WAAW,GAAG,WAAW,IAAI,IAAI,mBAAmB,EAAE,CAAC;AAEvD,QAAA,OAAO,mBAAmB,CAAC,IAAI,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,IAAI,CAAC,UAAA,aAAa,EAAA;AAC5E,YAAA,IAAM,GAAG,GAAG,aAAa,CAAC,OAAO,CAAC;YAElC,IAAI,aAAa,CAAC,OAAO,EAAE;AACzB,gBAAA,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE;AACnC,oBAAA,WAAW,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;oBAC/B,OAAO,aAAa,CAAC,OAAO,CAAC;AAC9B,iBAAA;AAED,gBAAA,IAAI,aAAa,CAAC,QAAQ,KAAK,IAAI,EAAE;oBAEnC,OAAO,aAAa,CAAC,OAAO,CAAC;AAC9B,iBAAA;AAED,gBAAA,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;AACrE,aAAA;AAED,YAAA,WAAW,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;AAE/B,YAAA,aAAa,CAAC,OAAO,GAAG,KAAI,CAAC,qBAAqB,CAAC,aAAa,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,UAAA,SAAS,EAAA;AACvH,gBAAA,aAAa,CAAC,SAAS,GAAG,SAAS,CAAC;AAEpC,gBAAA,IAAI,aAAa,CAAC,QAAQ,KAAK,IAAI,EAAE;AAEnC,oBAAA,OAAO,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC;AACrC,iBAAA;AAED,gBAAA,IAAI,WAAW,GAAG,KAAI,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAAC;AACnG,gBAAA,OAAO,aAAa,CAAC,OAAO,GAAG,WAAW,CAAC;AAC7C,aAAC,CAAC,CAAC;YAEH,OAAO,aAAa,CAAC,OAAO,CAAC;AAC/B,SAAC,CAAC,CAAC;KACJ,CAAA;IAUD,UAAqB,CAAA,SAAA,CAAA,qBAAA,GAArB,UAAsB,aAAoC,EAAE,kBAA2C,EAAE,WAAiC,EAAE,MAAY,EAAA;AACtJ,QAAA,IAAI,SAAS,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;AAC5E,QAAA,IAAI,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC;AAC9C,QAAA,IAAI,SAAS,CAAC;AACd,QAAA,IAAI,KAAK,CAAC;AAEV,QAAA,kBAAkB,GAAG,kBAAkB,IAAI,sBAAsB,CAAC,MAAM,CAAC;QAEzE,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,EAAE;AACvE,YAAA,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACnC,SAAA;AAED,QAAA,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,UAAA,CAAC,EAAI,EAAA,OAAA,CAAC,CAAC,GAAG,CAAL,EAAK,CAAC,CAAC;AACzC,QAAA,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,UAAA,CAAC,EAAI,EAAA,OAAA,CAAC,CAAC,IAAI,CAAN,EAAM,CAAC,CAAC;QACtC,MAAM,CAAC,KAAK,CAAC,0BAA2B,CAAA,MAAA,CAAA,aAAa,CAAC,OAAO,CAAE,EAAE,SAAS,CAAC,CAAC;AAE5E,QAAA,IAAI,MAAM,EAAE;AAEV,YAAA,IAAI,iBAAiB,GAAGuE,wBAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,2BAA2B,EAAE,MAAM,CAAgC,CAAC;AACpH,YAAA,IAAI,iBAAiB,EAAE;AACrB,gBAAA,IAAI,mBAAmB,GAAG,SAAS,CAAC,MAAM,CAAC;AAC3C,gBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC1D,oBAAA,IAAI,GAAG,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAC/B,oBAAA,IAAI,QAAQ,GAAG,OAAO,GAAG,KAAK,UAAU;0BACpCP,sBAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ;AAC1B,0BAAE1D,0BAAc,CAAE,GAAW,CAAC,GAAG,IAAI,GAAa,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;oBAE7E,IAAI,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;AACtC,wBAAA,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACzB,wBAAA,KAAK,CAAC,IAAI,CAAE,GAAW,CAAC,EAAE,CAAC,CAAC;AAC7B,qBAAA;AACF,iBAAA;AACD,gBAAA,MAAM,CAAC,KAAK,CAAC,oCAAqC,CAAA,MAAA,CAAA,kBAAkB,CAAC,kBAAkB,CAAE,EAAE,SAAS,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAClI,aAAA;AACF,SAAA;AAED,QAAA,OAAO,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,WAAW,CAAC,CAAC;KAC/F,CAAA;AAQD,IAAA,UAAA,CAAA,SAAA,CAAA,uBAAuB,GAAvB,UAAwB,YAAoB,EAAE,YAAqB,EAAA;QAAnE,IAaC,KAAA,GAAA,IAAA,CAAA;AAZC,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,UAAA,eAAe,EAAA;YAC9D,IAAI,YAAY,GAAG0D,sBAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC;AACxD,YAAA,IAAI,cAAc,GAAG,KAAI,CAAC,cAAc,CAAC,OAAO,CAAC,YAAY,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;AAE9F,YAAA,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE;AAChC,gBAAA,MAAM,IAAI,KAAK,CAAC,0CAAkC,YAAY,EAAA,KAAA,CAAI,CAAC,CAAC;AACrE,aAAA;AAED,YAAA,cAAc,CAAC,UAAU,CAAC,KAAI,CAAC,SAAS,CAAC,CAAC;YAE1C,OAAO,cAAc,CAAC,YAAY,CAAC;AACrC,SAAC,CAAC,CAAC;KACJ,CAAA;IAUD,UAAmB,CAAA,SAAA,CAAA,mBAAA,GAAnB,UAAoB,SAAmB,EAAE,KAAe,EAAE,SAAwB,EAAE,kBAA2C,EAAE,WAAiC,EAAA;QAAlK,IA+CC,KAAA,GAAA,IAAA,CAAA;AA9CC,QAAA,WAAW,GAAG,WAAW,IAAI,IAAI,mBAAmB,EAAE,CAAC;AACvD,QAAA,kBAAkB,GAAG,kBAAkB,IAAI,sBAAsB,CAAC,MAAM,CAAC;AAEzE,QAAA,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,UAAA,CAAC,EAAI,EAAA,OAAA,KAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAA1B,EAA0B,CAAC,CAAC;AAE3D,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,UAAA,OAAO,EAAA;AACvD,YAAA,IAAI,CAAC,CAAC;AACN,YAAA,IAAI,EAAE,CAAC;AACP,YAAA,IAAI,QAAQ,CAAC;AACb,YAAA,IAAI,YAAY,CAAC;AACjB,YAAA,IAAI,OAAO,CAAC;AACZ,YAAA,IAAI,gBAAgB,CAAC;AACrB,YAAA,IAAI,SAAS,GAAG,KAAI,CAAC,SAAS,CAAC;AAC/B,YAAA,IAAI,cAAc,GAAG,KAAI,CAAC,cAAc,CAAC;YACzC,IAAI,WAAW,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAK5C,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC5C,gBAAA,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;gBACrB,YAAY,GAAGA,sBAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;gBAE5C,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AACzD,gBAAA,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;gBAC/B,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvC,gBAAA,WAAW,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;AAC3B,aAAA;YAED,IAAI,kBAAkB,CAAC,kBAAkB,EAAE;gBACzC,gBAAgB,GAAG,cAAc,CAAC,WAAW,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;AAErF,gBAAA,IAAI,gBAAgB,EAAE;AACpB,oBAAA,gBAAgB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACtC,iBAAA;AACF,aAAA;AAID,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,gBAAA,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAC9D,aAAA;AAED,YAAA,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,cAAM,OAAA,SAAS,CAAT,EAAS,CAAC,CAAC;AACxD,SAAC,CAAC,CAAC;KACJ,CAAA;IAGD,UAAkB,CAAA,SAAA,CAAA,kBAAA,GAAlB,UAAmB,EAAE,EAAA;QACnB,IAAI,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAChC,QAAA,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YAChB,IAAI,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC9B,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YAEtC,IAAI,UAAU,KAAK,SAAS,EAAE;AAC5B,gBAAA,OAAO,EAAE,CAAC;AACX,aAAA;YAED,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;AACrD,SAAA;AAED,QAAA,OAAO,EAAE,CAAC;KACX,CAAA;IAnPM,UAA2B,CAAA,2BAAA,GAAG,4BAA4B,CAAC;IAoPpE,OAAC,UAAA,CAAA;AAAA,CA9PD,EA8PC;;ACzSD,IAAA,UAAA,IAAA,YAAA;AA8CE,IAAA,SAAA,UAAA,CAAY,QAA8B,EAAE,WAAgC,EAAE,SAAiB,EAAE,SAAoB,EAAA;AACnH,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;AACxB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AAClB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC,aAAa,IAAI,IAAI,CAAC;QAErD,IAAI,cAAc,GAAG,QAAQ,CAAC,eAAe,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC;AACpF,QAAA,IAAI,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;AACvC,QAAA,IAAI,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;AACxC,QAAA,IAAI,eAAe,GAAG,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;AAChD,QAAA,IAAI,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AACrC,QAAA,IAAI,CAAS,CAAC;AACd,QAAA,IAAI,EAAU,CAAC;AAEf,QAAA,QAAQ,CAAC,wBAAwB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AAE7D,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC/C,YAAA,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE,cAAc,EAAE,UAAwD,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;AAC9I,SAAA;KACF;IAMD,UAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,UAAgB,EAAA;AACtB,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE;YAC/B,IAAI,CAAC,SAA8B,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AACrE,SAAA;KACF,CAAA;AAQD,IAAA,UAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,eAAwB,EAAE,UAAiB,EAAA;QAClD,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;AAC1C,QAAA,IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,eAAe,IAAItB,oCAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACrF,QAAA,IAAI,CAAC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;AAEnC,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE;AAC/B,YAAA,IAAI,CAAC,SAA8B,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7E,SAAA;AAED,QAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACtB,CAAA;IAMD,UAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,KAAa,EAAA;AAChB,QAAA,IAAI,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;AACnD,QAAA,IAAI,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;AAC3C,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,CAAoB,CAAC;AACzB,QAAA,IAAI,QAAkC,CAAC;AACvC,QAAA,IAAI,cAAc,CAAC;QAEnB,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,EAAE;gBACxB,OAAO;AACR,aAAA;YAED,IAAI,CAAC,MAAM,EAAE,CAAC;AACf,SAAA;AAED,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACpB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AAEnB,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACpD,YAAA,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;AACvB,YAAA,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC;AACtB,YAAA,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC;AACzC,YAAA,QAAQ,CAAC,UAAU,GAAG,KAAK,CAAC;AAE5B,YAAA,IAAI,kBAAkB,EAAE;AACtB,gBAAA,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC;AAChC,aAAA;AAED,YAAA,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAc,CAAC,CAAC;YAC/B,QAAQ,CAAC,IAAI,EAAE,CAAC;AAEhB,YAAA,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC;AAC3B,YAAA,QAAQ,CAAC,cAAc,GAAG,cAAc,CAAC;AAC1C,SAAA;AAED,QAAA,IAAI,eAAe,CAAC;AACpB,QAAA,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;AACtB,YAAA,IAAI,kBAAkB,EAAE;AACtB,gBAAA,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;AAClC,aAAA;YAGD,IAAI,IAAI,CAAC,SAAS,KAAM,KAAe,CAAC,eAAe,CAAC,cAAc,EAAE;AACtE,gBAAA,eAAe,GAAI,KAAe,CAAC,eAAe,CAAC;AAEpD,aAAA;AAAM,iBAAA,IAAI,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE;gBACjD,eAAe,GAAGA,oCAAqB,CAAC,IAAI,CAAC,SAAS,EAAG,KAAe,CAAC,eAAe,CAAC,CAAC;AAG3F,aAAA;AAAM,iBAAA;AACL,gBAAA,eAAe,GAAGA,oCAAqB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACxD,gBAAA,eAAe,CAAC,uBAAuB,GAAI,KAAe,CAAC,eAAe,CAAC;AAC5E,aAAA;YAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;AACjD,SAAA;AAAM,aAAA,IAAI,kBAAkB,EAAE;AAC7B,YAAA,eAAe,GAAI,KAAe,CAAC,eAAe,CAAC;AAOnD,YAAA,IAAK,KAAe,CAAC,eAAe,CAAC,uBAAuB,KAAK,SAAS;AACpE,mBAAA,IAAI,CAAC,SAAiB,CAAC,WAAW,IAAK,IAAI,CAAC,SAAiB,CAAC,WAAW,CAAC,wBAAwB,CAAC,gBAAgB,EAAE;gBAEzH,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAG,KAAe,CAAC,eAAe,CAAC,CAAC;gBACtE,eAAe,CAAC,qBAAqB,GAAI,KAAe,CAAC,eAAe,CAAC,uBAAuB,CAAC;AAClG,aAAA;YACA,IAAI,CAAC,SAA2B,CAAC,IAAI,CAAE,KAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAC1F,SAAA;KACF,CAAA;AAKD,IAAA,UAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;QACE,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;YAC3C,IAAI,CAAC,SAAA,CAAC;YACN,IAAI,EAAE,SAAA,CAAC;AAEP,YAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,YAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;AAElB,YAAA,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;AACtB,gBAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;AACpB,aAAA;AAED,YAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;AAC9B,gBAAA,IAAI,CAAC,SAA6B,CAAC,MAAM,EAAE,CAAC;AAC9C,aAAA;AAED,YAAA,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;AAC/B,gBAAA,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;AACjC,aAAA;AAED,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;gBACpD,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;AACrC,aAAA;AACF,SAAA;KACF,CAAA;AAKD,IAAA,UAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;QACE,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,OAAO;AACR,SAAA;AAED,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;AAEvB,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE;AAChC,YAAA,IAAI,CAAC,SAA+B,CAAC,QAAQ,EAAE,CAAC;AAClD,SAAA;AAED,QAAA,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;AACtB,YAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;AACtB,SAAA;KACF,CAAA;AAKD,IAAA,UAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,YAAA;QACE,IAAI,IAAI,CAAC,UAAU,EAAE;AACnB,YAAA,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;AAExB,YAAA,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;AACtB,gBAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;AACtB,aAAA;AAED,YAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE;AAChC,gBAAA,IAAI,CAAC,SAA+B,CAAC,QAAQ,EAAE,CAAC;AAClD,aAAA;AACF,SAAA;KACF,CAAA;IACH,OAAC,UAAA,CAAA;AAAD,CAAC,EAAA;;AChPD,IAAI,cAAc,GAAG,CAAC,CAAC;AAEvB,SAAS,cAAc,GAAA;IACrB,OAAO,EAAE,cAAc,CAAC;AAC1B,CAAC;AAED,SAAS,gBAAgB,GAAK,EAAA,OAAO,IAAI,CAAC,EAAE;AAC5C,SAAS,mBAAmB,MAAK;AAMjC,IAAA,oBAAA,IAAA,YAAA;AAwFE,IAAA,SAAA,oBAAA,GAAA;AACE,QAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;AACxB,QAAA,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;AAC1B,QAAA,IAAI,CAAC,2BAA2B,GAAG,SAAS,CAAC;AAC7C,QAAA,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;AAC1B,QAAA,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;AAC7B,QAAA,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;AAC7B,QAAA,IAAI,CAAC,iBAAiB,GAAG,mBAAmB,CAAC;AAC7C,QAAA,IAAI,CAAC,cAAc,GAAG,gBAAgB,CAAC;AACvC,QAAA,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;AAC3B,QAAA,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;AAC1B,QAAA,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;AAC/B,QAAA,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;AAC3B,QAAA,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;AACrB,QAAA,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;AACrB,QAAA,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;AAC3B,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;KAC7B;AAOM,IAAA,oBAAA,CAAA,UAAU,GAAjB,UAAkB,IAAY,EAAE,QAA+B,EAAA;AAC7D,QAAA,IAAI,QAAQ,CAAC;AAEb,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;AACpC,YAAA,QAAQ,GAAG,QAAQ,IAAI,IAAI,oBAAoB,EAAE,CAAC;AAClD,YAAA,QAAQ,CAAC,aAAa,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC;AAC1E,SAAA;AAED,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;AAClC,YAAA,QAAQ,GAAG,QAAQ,IAAI,IAAI,oBAAoB,EAAE,CAAC;AAClD,YAAA,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC;AACxE,SAAA;AAED,QAAA,OAAO,QAAQ,CAAC;KACjB,CAAA;IAMD,oBAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,QAAgB,EAAA;AAC9B,QAAA,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;AAC/B,YAAA,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;AACzB,SAAA;AAED,QAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KACnC,CAAA;AAQD,IAAA,oBAAA,CAAA,SAAA,CAAA,UAAU,GAAV,UAAW,SAAoB,EAAE,MAAgB,EAAA;AAC/C,QAAA,IAAI,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,QAAA,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;AACjC,QAAA,IAAI,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;AACvC,QAAA,IAAI,2BAA2B,GAAG,IAAI,CAAC,2BAA2B,CAAC;AACnE,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,OAAyB,CAAC;QAE9B,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,OAAO;AACR,SAAA;AAED,QAAA,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;AACzB,QAAA,MAAsC,CAAC,cAAc,GAAG,cAAc,EAAE,CAAC;QAE1E,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC,GAAG,CAACb,8BAAe,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,CAACK,0BAAS,CAAC,CAAC;AAE1C,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,eAAe,IAAIa,kBAAO,CAAC,SAAS,CAAC;QAC/D,IAAI,CAAC,cAAc,IAAI,SAAS,IAAI,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,WAAW,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC;QACrC,IAAI,CAAC,aAAa,IAAI,QAAQ,IAAI,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,eAAe,IAAI,UAAU,IAAI,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,eAAe,IAAI,UAAU,IAAI,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,aAAa,CAAC;QAEvD,IAAI,aAAa,KAAK,IAAI,EAAE;AAC1B,YAAA,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;AAC3B,gBAAA,IAAI,gBAAgB,CAAC;AACnB,oBAAA,IAAI,EAAE,OAAO;oBACb,aAAa,EAAE,cAAc,IAAI,KAAK,GAAG,cAAc,GAAG,IAAI;AAC9D,oBAAA,SAAS,EAAE,aAAa;AACxB,oBAAA,kBAAkB,EAAE,2BAA2B;AAChD,iBAAA,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC/B,aAAA;AAED,YAAA,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;YAExB,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE;gBACvD,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC;AAChE,gBAAA,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAChC,aAAA;AAAM,iBAAA;AACL,gBAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;oBAC/C,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACrC,oBAAA,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE;wBACjC,IAAI,IAAI,CAAC,eAAe,EAAE;AACxB,4BAAA,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;AACjG,yBAAA;AACD,wBAAA,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AACtC,qBAAA;AACF,iBAAA;gBAED,OAAO,GAAG,IAAI,gBAAgB,CAAC;AAC7B,oBAAA,IAAI,EAAE,OAAO;oBACb,aAAa,EAAE,cAAc,IAAI,KAAK,GAAG,cAAc,GAAG,IAAI;AAC9D,oBAAA,SAAS,EAAE,aAAa;AACxB,oBAAA,kBAAkB,EAAE,2BAA2B;AAChD,iBAAA,CAAC,CAAC;AAEH,gBAAA,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;AAC1B,gBAAA,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACpC,aAAA;AACF,SAAA;AAAM,aAAA;AACL,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;gBAC/C,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACtC,aAAA;AAID,YAAA,IAAI,CAAC,wBAAwB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAClD,SAAA;KACF,CAAA;AASD,IAAA,oBAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,QAAuB,EAAE,IAAa,EAAA;QAA/C,IAkBC,KAAA,GAAA,IAAA,CAAA;AAjBC,QAAA,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;AAC/B,YAAA,QAAQ,CAAC,iBAAiB,CAAC,IAAI,IAAI,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;YAEjF,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;AAC/B,gBAAA,IAAI,CAAC,OAAO;qBAIT,OAAO,CAAE,UAAC,KAAK,EAAA;oBACd,QAAQ,CAAC,iBAAiB,CAAC,KAAK,EAAE,KAAI,EAAE,KAAI,CAAC,aAAa,CAAC,CAAC;AAC9D,iBAAC,CAAC,CAAC;AACN,aAAA;AACF,SAAA;AAED,QAAA,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;YAC7B,QAAQ,CAAC,eAAe,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAC1D,SAAA;KACF,CAAA;IAGD,oBAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,OAAY,EAAA;AAClB,QAAA,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C,CAAA;IAYD,oBAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,SAAoB,EAAE,MAAgB,EAAE,WAAiC,EAAE,YAA2B,EAAE,aAAuB,EAAA;QAApI,IAuBC,KAAA,GAAA,IAAA,CAAA;AAtBC,QAAA,IAAI,OAAO,CAAC;AAEZ,QAAA,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;AAC7B,YAAA,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,eAAe,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,IAAI,MAAM,CAAC,CAAC;YACvG,OAAO,GAAG,IAAI,sBAAsB,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;AAEjE,YAAA,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;gBAC1B,YAAY,CAAC,QAAQ,GAAGiB,sBAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC;AACrD,aAAA;AAED,YAAA,OAAO,YAAY;AAChB,iBAAA,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC;iBACxE,IAAI,CAAC,UAAA,WAAW,EAAA;AACf,gBAAA,IAAI,CAAC,aAAa,IAAI,CAAC,KAAI,CAAC,WAAW,EAAE;AACvC,oBAAA,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAChC,iBAAA;AAED,gBAAA,OAAO,WAAW,CAAC;AACrB,aAAC,CAAC,CAAC;AACN,SAAA;AAED,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KAC9B,CAAA;IAWD,oBAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,QAAsB,EAAE,SAAwB,EAAE,IAAa,EAAE,WAAgC,EAAE,UAAiB,EAAA;QAC1H,IAAI,IAAI,CAAC,YAAY,EAAE;AACrB,YAAA,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE;gBAC5B,IAAI,QAAQ,GAAGjE,cAAG,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AAC7C,gBAAA,IAAI,QAAQ,GAAGA,cAAG,CAAC,sBAAsB,EAAE,CAAC;gBAC5C,IAAI,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;gBAChD,IAAI,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAErC,gBAAA,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;gBACnDA,cAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAC5C,gBAAA,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBAC3B,WAAW,CAAC,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEhE,gBAAA,IAAI,IAAI,EAAE;AACR,oBAAA,WAAW,CAAC,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;AACpC,oBAAA,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;AAC9B,iBAAA;AAED,gBAAA,IAAI,SAAS,EAAE;AACb,oBAAA,WAAW,CAAC,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;AAChD,oBAAA,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;AACpC,iBAAA;gBAED,IAAI,GAAG,QAAQ,CAAC;AACjB,aAAA;AACF,SAAA;AAAM,aAAA,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;YACpC,IAAI,gBAAgB,GAAG,EAAE,CAAC;AAE1B,YAAA,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE,EAAE;AACvF,gBAAA,IAAI,YAAY,GAAG,IAAI,CAAC,UAAqB,CAAC;AAC9C,gBAAA,IAAI,cAAc,GAAG,IAAI,CAAC,aAAa,GAAG,IAAI,GAAGA,cAAG,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;gBACjF,IAAI,WAAW,SAAA,CAAC;gBAChB,IAAI,SAAS,SAAQ,CAAC;AAEtB,gBAAA,OAAO,YAAY,EAAE;AACnB,oBAAA,WAAW,GAAG,YAAY,CAAC,WAAW,CAAC;AAEvC,oBAAA,IAAI,YAAY,CAAC,OAAO,KAAK,UAAU,KAAK,SAAS,GAAG,YAAY,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,EAAE;AAClG,wBAAA,gBAAgB,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AACxE,wBAAAA,cAAG,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACzC,wBAAA,WAAW,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;AACjD,qBAAA;yBAAM,IAAI,cAAc,KAAK,IAAI,EAAE;wBAClC,IAAI,YAAY,CAAC,QAAQ,KAAK,CAAC,IAAI,gBAAgB,CAAC,YAAY,CAAC,EAAE;AACjE,4BAAAA,cAAG,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AAC1C,yBAAA;AAAM,6BAAA;AACL,4BAAA,cAAc,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;AAC1C,yBAAA;AACF,qBAAA;oBAED,YAAY,GAAG,WAAW,CAAC;AAC5B,iBAAA;gBAED,IAAI,cAAc,KAAK,IAAI,IAAI,cAAc,CAAC,aAAa,EAAE,EAAE;AAC7D,oBAAA,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;AAClC,iBAAA;AAED,gBAAA,WAAW,CAAC,qBAAqB,GAAG,KAAK,CAAC;AAC3C,aAAA;AAAM,iBAAA;AACL,gBAAA,WAAW,CAAC,qBAAqB,GAAG,IAAI,CAAC;AAC1C,aAAA;AACF,SAAA;AAAM,aAAA,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,EAAE;AACvE,YAAA,WAAW,CAAC,qBAAqB,GAAG,IAAI,CAAC;AAC1C,SAAA;AAED,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;IAUD,oBAAM,CAAA,SAAA,CAAA,MAAA,GAAN,UAAO,SAAoB,EAAE,WAAiC,EAAE,OAAiB,EAAE,QAAoB,EAAA;AACrG,QAAA,IAAI,QAAQ,CAAC;QACb,IAAI,EAAE,GAAG,IAAI,CAAC;AAEd,QAAA,WAAW,GAAG,WAAW,IAAI,mBAAmB,CAAC,MAAM,CAAC;AACxD,QAAA,OAAO,GAAG,OAAO,IAAI,IAAI,CAAC;AAC1B,QAAA,QAAQ,GAAG,QAAQ,IAAI,IAAI,CAAC;AAE5B,QAAA,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,IAAI,OAAO,EAAE;YACxC,IAAI,IAAI,CAAC,aAAa,EAAE;gBACtB,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;gBACvD,SAAS,CAAC,gBAAgB,CAACA,cAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACpD,aAAA;AAAM,iBAAA;gBACL,QAAQ,GAAG,OAAO,CAAC;gBACnB,IAAI,IAAI,CAAC,eAAe,EAAE;oBACxB,SAAS,CAAC,gBAAgB,CAACA,cAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACpD,iBAAA;AACF,aAAA;AACF,SAAA;QAED,IAAI,OAAO,KAAK,IAAI,EAAE;YACpB,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC;AACpC,SAAA;AAED,QAAA,IAAI,SAAS,GAAG,WAAW,CAAC,SAAS,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACpE,QAAA,IAAI,UAAU,GAAG,IAAI,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACzE,QAAA,IAAI,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;AACvC,QAAA,IAAI,WAAW,CAAC;QAEhB,IAAI,IAAI,CAAC,YAAY,EAAE;AAErB,YAAA,EAAE,CAAC,UAAU,GAAG,UAAU,CAAC;AAC5B,SAAA;AAAM,aAAA,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;YAEpC,WAAW,GAAG,WAAW,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC;AAC1D,YAAA,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC;AAEhC,YAAA,IAAI,WAAW,EAAE;AACf,gBAAA,UAAU,CAAC,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AACvE,aAAA;YAED,IAAI,OAAO,KAAK,IAAI,EAAE;AACpB,gBAAA,EAAE,CAAC,UAAU,GAAG,UAAU,CAAC;gBAE3B,IAAI,UAAU,CAAC,IAAI,EAAE;AACnB,oBAAA,IAAI,CAAC,IAAI,CAAC,aAAa,KAAK,OAAO,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,cAAc,CAAC,EAAE;AACtF,wBAAA,IAAI,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,cAAc,CAAC;wBACrE,UAAU,CAAC,IAAI,CAAC,WAAW,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;wBAC3D,cAAc,CAAC,UAAU,IAAIA,cAAG,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;AAC7D,qBAAA;oBAED,IAAI,WAAW,CAAC,iBAAiB,EAAE;wBACjC,IAAI,aAAa,KAAK,IAAI,EAAE;AAC1B,4BAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACtD,gCAAA,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AACrF,6BAAA;AACF,yBAAA;AAED,wBAAA,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AACzC,qBAAA;AAAM,yBAAA;AACL,wBAAA,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAC7C,qBAAA;AACF,iBAAA;qBAAM,IAAI,aAAa,KAAK,IAAI,EAAE;AACjC,oBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACtD,wBAAA,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AACxE,qBAAA;AACF,iBAAA;AACF,aAAA;iBAAM,IAAI,UAAU,CAAC,IAAI,EAAE;AAE1B,gBAAA,UAAU,CAAC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;gBAExC,IAAI,aAAa,KAAK,IAAI,EAAE;AAC1B,oBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;wBACtD,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAC9F,qBAAA;AACF,iBAAA;AACF,aAAA;iBAAM,IAAI,aAAa,KAAK,IAAI,EAAE;AAEjC,gBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACtD,oBAAA,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AACjF,iBAAA;AACF,aAAA;AACF,SAAA;aAAM,IAAI,aAAa,KAAK,IAAI,EAAE;AAEjC,YAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACtD,gBAAA,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AACxE,aAAA;AACF,SAAA;QAED,IAAI,EAAE,KAAK,IAAI,EAAE;AACf,YAAA,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC;AAChC,SAAA;AAED,QAAA,IAAI,WAAW,CAAC,mBAAmB,IAAI,WAAW,EAAE;AAClD,YAAA,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;AAC3B,SAAA;AAED,QAAA,OAAO,UAAU,CAAC;KACnB,CAAA;AAGD,IAAA,oBAAA,CAAA,SAAA,CAAA,wBAAwB,GAAxB,UAAyB,QAAgB,EAAE,MAAc,EAAA;AACvD,QAAA,IAAI,UAAU,CAAC;AACf,QAAA,IAAI,CAAC,CAAC;AACN,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,IAAI,QAAQ,CAAC;QAEb,IAAI,uBAAuB,IAAI,MAAM,EAAE;YACrC,OAAO;AACR,SAAA;AAEA,QAAA,MAAc,CAAC,qBAAqB,GAAG,IAAI,CAAC;AAC7C,QAAA,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;AAE7B,QAAA,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YAC/C,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YAElD,IAAI,QAAQ,KAAK,SAAS,EAAE;AAC1B,gBAAA,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC;AAC1C,aAAA;AACF,SAAA;KACF,CAAA;AAGD,IAAA,oBAAA,CAAA,SAAA,CAAA,wBAAwB,GAAxB,UAAyB,SAAoB,EAAE,MAAgB,EAAA;AAM7D,QAAA,IAAI,QAA8B,CAAC;QACnC,IAAI,OAAO,GAAG,MAAM,CAAC;AAGrB,QAAA,OAAO,IAAI,EAAE;YACX,IAAI,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACpD,YAAA,MAAM,GAAG,KAAK,IAAI,KAAK,CAAC,WAAW,CAAC;YACpC,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO;AACR,aAAA;YACD,QAAQ,GAAGwE,wBAAQ,CAAC,MAAM,CAACA,wBAAQ,CAAC,QAAQ,EAAE,MAAM,CAAyB,CAAC;AAC9E,YAAA,IAAI,QAAQ,EAAE;gBACZ,MAAM;AACP,aAAA;AACF,SAAA;AACD,QAAA,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC9B,QAAA,IAAA,OAAA,GAAA,UAAA,CAAC,EAAM,EAAE,EAAA;YAChB,IAAI,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAElC,YAAA,IAAI,OAAK,UAAU,CAAC,IAAI,CAAC,UAAA,CAAC,EAAI,EAAA,OAAA,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAApB,EAAoB,CAAC,EAAE;;AAEpD,aAAA;YAGD,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,OAAO,EAAA,MAAA,CAAO,CAAC;;;AARzD,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAA;AAAnD,YAAA,OAAA,CAAA,CAAS,CAAA,CAAA;AASjB,SAAA;KACF,CAAA;IACH,OAAC,oBAAA,CAAA;AAAD,CAAC,EAAA;;AC/hBD,SAAS,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAA;IAC5C,IAAI,CAAC,IAAI,EAAE;QACT,OAAO;AACR,KAAA;AAED,IAAA,IAAI,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAC5B,IAAA,IAAI,QAAQ,EAAE;QACZ,IAAI,QAAQ,KAAK,QAAQ,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,wBAAA,CAAA,MAAA,CAAyB,IAAI,EAAsD,qDAAA,CAAA,CAAA,MAAA,CAAA,IAAI,EAAG,GAAA,CAAA,CAAC,CAAC;AAC7G,SAAA;QAED,OAAO;AACR,KAAA;AAED,IAAA,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;AAC1B,CAAC;AA8He,SAAA,oBAAoB,CAAC,IAAY,EAAE,IAAY,EAAA;AAC7D,IAAA,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;AACtB,QAAA,IAAI,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAC/BrD,qBAAU;aACP,SAAS,CAAC,YAAY,CAAC;aACvB,IAAI,CAAC,WAAI,IAAI,EAAA,mBAAA,CAAA,CAAA,MAAA,CAAoB,IAAI,EAAoC,mCAAA,CAAA,CAAA,MAAA,CAAA,OAAO,EAA8E,8EAAA,CAAA,CAAC,CAAC;AACnK,QAAA,OAAO,OAAO,CAAC;AAChB,KAAA;AACD,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;AAED,IAAM,cAAc,GAAG,iBAAiB,CAAC;AAMzC,IAAA,aAAA,IAAA,YAAA;IA8LE,SAAY,aAAA,CAAA,MAAsB,EAAE,OAAgB,EAAA;QAPpD,IAAe,CAAA,eAAA,GAAG,IAAI,CAAC;AAQrB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC;AACtC,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG;YACrB,eAAe,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;YAClD,gBAAgB,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC;SACrD,CAAC;QACF,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;KAC7H;AA3JM,IAAA,aAAA,CAAA,UAAU,GAAjB,UAAkB,MAAuB,EAAE,QAA+B,EAAA;AACxE,QAAA,IAAI,QAAQ,CAAC;AAIb,QAAA,IAAI,QAAQ,IAAI,cAAc,IAAI,QAAQ,EAAE;AAC1C,YAAA,OAAO,QAAQ,CAAC;AACjB,SAAA;QACD,IAAI,WAAW,IAAI,MAAM,EAAE;AACzB,YAAA,IAAI,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC;AAE9B,YAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAG9B,gBAAA,QAAQ,GAAG,QAAQ,IAAI,IAAI,oBAAoB,EAAE,CAAC;AAClD,gBAAA,QAAQ,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;AAChC,gBAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE;oBAEzB,QAAQ,CAAC,WAAW,GAAG,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACvE,iBAAA;AACF,aAAA;AAAM,iBAAA;AAEL,gBAAA,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;AAEhC,oBAAA,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC9B,iBAAA;AACD,gBAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAG9B,oBAAA,MAAM,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC3B,iBAAA;gBAID,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;AAEnC,gBAAA,IAAI,YAAY,GAAG,MAAM,CAAC,IAAI,IAAI,SAAS,CAAC;AAG5C,gBAAA,IAAI,MAAI,GAAG,MAAM,CAAC,IAAI,CAAC;AACvB,gBAAA,QAAQ,YAAY;AACpB,oBAAA,KAAK,SAAS,CAAC;AAAC,oBAAA,KAAK,WAAW;AAE9B,wBAAA,QAAQ,GAAG,QAAQ,IAAI,IAAI,oBAAoB,EAAE,CAAC;AAClD,wBAAA,QAAQ,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;wBAChC,IAAI,YAAY,KAAK,SAAS,EAAE;AAK9B,4BAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE;gCACzB,QAAQ,CAAC,WAAW,GAAG,MAAI;AACzB,sCAAE,oBAAoB,CAAC,MAAI,EAAE,gBAAgB,CAAC;AAC9C,sCAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC7B,6BAAA;AACF,yBAAA;AAAM,6BAAA;AAKL,4BAAA,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;gCAC3B,QAAQ,CAAC,aAAa,GAAG,MAAI;AAC3B,sCAAE,oBAAoB,CAAC,MAAI,EAAE,kBAAkB,CAAC;AAChD,sCAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC7B,6BAAA;AACF,yBAAA;wBACD,IAAI,oBAAoB,IAAI,MAAM,EAAE;AAEjC,4BAAA,MAAc,CAAC,YAAY,GAAG,MAAM,CAAC,kBAAkB,CAAC;4BACzD,OAAO,MAAM,CAAC,kBAAkB,CAAC;AAClC,yBAAA;wBACD,IAAI,oBAAoB,IAAI,MAAM,IAAI,QAAQ,CAAC,2BAA2B,KAAK,SAAS,EAAE;AAGvF,4BAAA,MAAc,CAAC,2BAA2B,GAAG,MAAM,CAAC,kBAAkB,CAAC;4BACxE,OAAO,MAAM,CAAC,kBAAkB,CAAC;AAClC,yBAAA;wBAED,OAAO,MAAM,CAAC,IAAI,CAAC;AAEnB,wBAAA,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;wBAChC,MAAM;AACR,oBAAA,KAAK,gBAAgB;AACnB,wBAAA,QAAQ,GAAG,IAAIwD,qCAAsB,CAAC1D,wBAAS,CAAC,MAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;wBACtE,MAAM;AACR,oBAAA,KAAK,iBAAiB;AACpB,wBAAA,QAAQ,GAAG,IAAI2D,sCAAuB,CAAC3D,wBAAS,CAAC,MAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;wBACvE,MAAM;AACR,oBAAA,KAAK,iBAAiB;AACpB,wBAAA,QAAQ,GAAG,IAAI,uBAAuB,EAAE,CAAC;wBACzC,MAAM;AACP,iBAAA;AACF,aAAA;YAED,IAAI,QAAQ,YAAY,oBAAoB,EAAE;AAM5C,gBAAA,IAAI,SAAS,GAAG,OAAO,MAAM,KAAK,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC1E,gBAAA,IAAI,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC;AACvC,gBAAA,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;AAC5B,oBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;AAClD,wBAAA,IAAI,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AACxB,wBAAA,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;4BACrD,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAA,MAAA,CAAA,CAAC,EAAgB,iBAAA,CAAA,CAAA,MAAA,CAAA,MAAM,CAAC,IAAI,EAAgE,mEAAA,CAAA,CAAC,CAAC;AAChJ,yBAAA;AACD,wBAAA,IAAI,OAAO,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;wBAIzC,IAAI,OAAO,GAAG,KAAK,CAAC;AACpB,wBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;4BACrD,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,EAAE;gCACzC,OAAO,GAAG,IAAI,CAAC;gCACf,MAAM;AACP,6BAAA;AACF,yBAAA;AACD,wBAAA,IAAI,OAAO,EAAE;4BACX,SAAS;AACV,yBAAA;AACD,wBAAA,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACxC,qBAAA;AACF,iBAAA;AACF,aAAA;AACF,SAAA;AACD,QAAA,OAAO,QAAQ,CAAC;KACjB,CAAA;AA8BD,IAAA,aAAA,CAAA,SAAA,CAAA,WAAW,GAAX,UAAY,GAAG,EAAE,IAAI,EAAA;AACnB,QAAA,IAAI,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE;YACnC,IAAI,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,OAAO,GAAG,CAAC,CAAC;YAChB,IAAI,YAAY,SAAA,CAAC;AAEjB,YAAA,OAAO,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,SAAS,EAAE;AACnE,gBAAA,OAAO,EAAE,CAAC;AACX,aAAA;AAED,YAAA,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAClB,YAAA,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;AAC3B,SAAA;KACF,CAAA;IAGD,aAAW,CAAA,SAAA,CAAA,WAAA,GAAX,UAAY,IAAY,EAAE,GAAI,EAAE,GAAI,EAAE,KAAM,EAAE,IAAK,EAAA;QACjD,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,YAAA,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AACtD,SAAA;AAED,QAAA,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE;AACd,YAAA,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAExC,YAAA,IAAI,YAAY,GAAG,IAAI,GAAG,GAAG,CAAC;AAC9B,YAAA,IAAI,IAAI,CAAC,YAAY,CAAC,EAAE;AACtB,gBAAA,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAE1C,gBAAA,YAAY,GAAG,IAAI,GAAG,GAAG,CAAC;AAC1B,gBAAA,IAAI,IAAI,CAAC,YAAY,CAAC,EAAE;AACtB,oBAAA,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;oBAE1C,IAAI,OAAO,GAAG,CAAC,CAAC;AAEhB,oBAAA,OAAO,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,SAAS,EAAE;AACnE,wBAAA,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAC1C,wBAAA,OAAO,EAAE,CAAC;AACX,qBAAA;AACF,iBAAA;AACF,aAAA;AACF,SAAA;KACF,CAAA;IAMD,aAAuB,CAAA,SAAA,CAAA,uBAAA,GAAvB,UAAwB,KAAsB,EAAA;AAC5C,QAAA,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACzC,QAAA,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AACxC,QAAA,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AACxC,QAAA,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;AACvC,QAAA,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AACtC,QAAA,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;KACzC,CAAA;IAOD,aAAkB,CAAA,SAAA,CAAA,kBAAA,GAAlB,UAAmB,uBAAwC,EAAA;QACzD,OAAO,IAAI,CAAC,eAAe,KAAK,IAAI,CAAC,eAAe,GAAG,uBAAuB,CAAC,CAAC;KACjF,CAAA;IAMD,aAAa,CAAA,SAAA,CAAA,aAAA,GAAb,UAAc,SAAwB,EAAA;AACpC,QAAA,IAAI,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;AAEjC,QAAA,IAAI,CAAC,MAAM,GAAG,SAAS,IAAI,IAAI,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC;AAEtC,QAAA,IAAI,SAAS,CAAC,MAAM,KAAK,IAAI,EAAE;AAC7B,YAAA,SAAS,CAAC,MAAM,GAAG,cAAc,CAAC;AAClC,YAAA,SAAS,CAAC,SAAS,GAAG,cAAc,KAAK,IAAI,CAAC;AAC/C,SAAA;KACF,CAAA;IAOD,aAAc,CAAA,SAAA,CAAA,cAAA,GAAd,UAAe,IAAY,EAAA;QACzB,OAAOV,0BAAc,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;KAC3C,CAAA;AAOD,IAAA,aAAA,CAAA,SAAA,CAAA,eAAe,GAAf,UAAgB,OAAe,EAAE,QAA8B,EAAA;QAC7D,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;KAC1D,CAAA;IAOD,aAAU,CAAA,SAAA,CAAA,UAAA,GAAV,UAAW,OAAe,EAAA;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;KAC5F,CAAA;IAOD,aAAY,CAAA,SAAA,CAAA,YAAA,GAAZ,UAAa,SAAiB,EAAA;QAC5B,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;KACtG,CAAA;AAQD,IAAA,aAAA,CAAA,SAAA,CAAA,iBAAiB,GAAjB,UAAkB,SAAiB,EAAE,QAA8B,EAAE,cAAsB,EAAA;AACzF,QAAA,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,cAAc,CAAC;QAC9C,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;KAChE,CAAA;IAOD,aAAY,CAAA,SAAA,CAAA,YAAA,GAAZ,UAAa,SAAiB,EAAA;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;KACpG,CAAA;AAOD,IAAA,aAAA,CAAA,SAAA,CAAA,sBAAsB,GAAtB,UAAuB,IAAY,EAAE,cAAsB,EAAA;QACzD,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,EAAE,cAAc,EAAE,kBAAkB,CAAC,CAAC;KAC1E,CAAA;IAOD,aAAiB,CAAA,SAAA,CAAA,iBAAA,GAAjB,UAAkB,IAAY,EAAA;QAC5B,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;KACpG,CAAA;AAOD,IAAA,aAAA,CAAA,SAAA,CAAA,uBAAuB,GAAvB,UAAwB,IAAY,EAAE,eAAuB,EAAA;QAC3D,QAAQ,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,EAAE,eAAe,EAAE,mBAAmB,CAAC,CAAC;KAC7E,CAAA;IAOD,aAAkB,CAAA,SAAA,CAAA,kBAAA,GAAlB,UAAmB,IAAY,EAAA;QAC7B,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;KACtG,CAAA;AAOD,IAAA,aAAA,CAAA,SAAA,CAAA,aAAa,GAAb,UAAc,IAAY,EAAE,KAAU,EAAA;QACpC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;KAC/C,CAAA;IAOD,aAAQ,CAAA,SAAA,CAAA,QAAA,GAAR,UAAS,IAAY,EAAA;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;KAClF,CAAA;AAUD,IAAA,aAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,UAAa,SAAoB,EAAE,IAAc,EAAA;AAC/C,QAAA,IAAI,gBAAgB,GAAGiE,wBAAQ,CAAC,MAAM,CAACA,wBAAQ,CAAC,QAAQ,EAAE,IAAI,CAAqB,CAAC;AACpF,QAAA,IAAI,gBAAgB,EAAE;YACpB,IAAI,gBAAgB,YAAY,oBAAoB,EAAE;AAEpD,gBAAA,aAAa,CAAC,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;gBAGjD,IAAI,gBAAgB,CAAC,aAAa,KAAK,IAAI,IAAI,gBAAgB,CAAC,WAAW,KAAK,IAAI,EAAE;oBAEpF,oBAAoB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAC9D,iBAAA;gBACD,IAAI,gBAAgB,CAAC,aAAa,KAAK,IAAI,IAAI,gBAAgB,CAAC,WAAW,KAAK,IAAI,EAAE;oBAEpF,gBAAgB,CAAC,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtD,iBAAA;AACF,aAAA;AACF,SAAA;AAAM,aAAA;AACL,YAAA,gBAAgB,GAAG,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC;AAC5C,mBAAA,oBAAoB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;AAC1C,mBAAAG,qCAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;AAC5C,mBAAAC,sCAAuB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;AAC7C,mBAAA,uBAAuB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnD,IAAI,CAAC,gBAAgB,EAAE;AAErB,gBAAA,gBAAgB,GAAG,IAAI,oBAAoB,EAAE,CAAC;gBAC7C,gBAAyC,CAAC,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChF,aAAA;YACDJ,wBAAQ,CAAC,MAAM,CAACA,wBAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC;AAC5D,SAAA;AACD,QAAA,gBAAgB,CAAC,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC7C,QAAA,gBAAgB,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC3C,QAAA,OAAO,gBAAgB,CAAC;KACzB,CAAA;IACH,OAAC,aAAA,CAAA;AAAD,CAAC,EAAA;;ICjkBY,YAAY,GAA0BK,wBAAQ,CAAC,MAAM,CAAC,uBAAuB,EAAE;IAC1F,QAAQ,EAAR,UAAS,MAAW,EAAA;QAClB,IAAI,EAAE,OAAQ,MAAuB,CAAC,eAAe,KAAK,UAAU,CAAC,EAAE;AACrE,YAAA,OAAO,8KAA8K,CAAC;AACvL,SAAA;AAED,QAAA,OAAO,IAAI,CAAC;KACb;IACD,OAAO,EAAP,UAAQ,MAAW,EAAA;QACjB,IAAI,EAAE,OAAQ,MAA+B,CAAC,cAAc,KAAK,UAAU,CAAC,EAAE;AAC5E,YAAA,MAAM,CAAC,cAAc,GAAGnF,mBAAQ,CAAC,IAAI,CAAC;AACvC,SAAA;KACF;AACF,CAAA,EAAE;AAMH,IAAA,oBAAA,IAAA,YAAA;AAeE,IAAA,SAAA,oBAAA,CAAY,IAAY,EAAA;AACtB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;KAC1B;IAUD,oBAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,UAAsB,EAAE,kBAA0C,EAAE,WAAiC,EAAE,MAAY,EAAA;QACjI,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;AAC/C,YAAA,IAAI,CAAC,YAAY,GAAGa,0BAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9D,SAAA;AAED,QAAA,kBAAkB,CAAC,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC;AACtD,QAAA,OAAO,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;KAC5G,CAAA;IAMD,oBAAc,CAAA,SAAA,CAAA,cAAA,GAAd,UAAe,IAAY,EAAA;AACzB,QAAA,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,EAAE;YAC9B,IAAI,CAAC,YAAY,GAAGA,0BAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrD,SAAA;KACF,CAAA;IA7CU,oBAAoB,GAAA,UAAA,CAAA;AADhC,QAAA,YAAY,EAAE;AACF,KAAA,EAAA,oBAAoB,CA8ChC,CAAA;IAAD,OAAC,oBAAA,CAAA;AAAA,CA9CD,EA8CC,EAAA;AAMD,IAAA,wBAAA,IAAA,YAAA;IAQE,SAAY,wBAAA,CAAA,WAAwB,EAAE,MAAc,EAAA;AAClD,QAAA,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;KAC3D;IAUD,wBAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,UAAsB,EAAE,kBAA0C,EAAE,WAAiC,EAAE,MAAY,EAAA;AACjI,QAAA,kBAAkB,CAAC,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC;AACtD,QAAA,OAAO,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;KAC1F,CAAA;IAxBU,wBAAwB,GAAA,UAAA,CAAA;AADpC,QAAA,YAAY,EAAE;AACF,KAAA,EAAA,wBAAwB,CAyBpC,CAAA;IAAD,OAAC,wBAAA,CAAA;AAAA,CAzBD,EAyBC,EAAA;AAYD,IAAA,cAAA,IAAA,YAAA;IAUE,SAAY,cAAA,CAAA,YAAsE,EAAE,iBAA0B,EAAA;AAC5G,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,IAAI,CAAC;AACzC,QAAA,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,IAAI,EAAE,CAAC;KAClD;IAUD,cAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,UAAsB,EAAE,kBAA0C,EAAE,WAAiC,EAAE,MAAY,EAAA;AACjI,QAAA,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AACvB,QAAA,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;AAErC,QAAA,IAAI,KAAK,IAAI,KAAK,CAAC,cAAc,EAAE;AACjC,YAAA,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,SAAA;AAED,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,GAAG,IAAImE,mCAAqB,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC;AAGxF,QAAA,KAAK,CAAC,YAAY,GAAG,EAAE,CAAC;AACxB,QAAA,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAE9B,IAAI,YAAY,KAAK,IAAI,EAAE;AACzB,YAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACrD,gBAAA,IAAI,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBAE9B,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;AAChE,oBAAA,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9B,iBAAA;AAAM,qBAAA;oBACL,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;AAC/C,iBAAA;AACF,aAAA;AACF,SAAA;AAED,QAAA,kBAAkB,CAAC,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC;AAGtD,QAAA,OAAO,UAAU,CAAC,eAAe,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;KACnF,CAAA;IArDU,cAAc,GAAA,UAAA,CAAA;AAD1B,QAAA,YAAY,EAAE;AACF,KAAA,EAAA,cAAc,CAsD1B,CAAA;IAAD,OAAC,cAAA,CAAA;AAAA,CAtDD,EAsDC,EAAA;AAMD,IAAA,4BAAA,IAAA,YAAA;IAQE,SAAY,4BAAA,CAAA,QAAgB,EAAE,KAA4B,EAAA;AACxD,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;KACpB;IAUD,4BAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,UAAsB,EAAE,kBAA0C,EAAE,WAAiC,EAAE,MAAY,EAAA;AACjI,QAAA,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEvB,IAAI,KAAK,CAAC,cAAc,EAAE;YACxB,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACvC,SAAA;AAED,QAAA,kBAAkB,CAAC,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC;AACtD,QAAA,OAAO,UAAU,CAAC,eAAe,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;KACnF,CAAA;IA9BU,4BAA4B,GAAA,UAAA,CAAA;AADxC,QAAA,YAAY,EAAE;AACF,KAAA,EAAA,4BAA4B,CA+BxC,CAAA;IAAD,OAAC,4BAAA,CAAA;AAAA,CA/BD,EA+BC,EAAA;AAMD,IAAA,kBAAA,IAAA,YAAA;AAYE,IAAA,SAAA,kBAAA,CAAY,MAAc,EAAE,YAAsE,EAAE,iBAA0B,EAAA;AAC5H,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,IAAI,CAAC;AACzC,QAAA,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,IAAI,EAAE,CAAC;KAClD;IAUD,kBAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,UAAsB,EAAE,kBAA0C,EAAE,WAAiC,EAAE,MAAY,EAAA;AACjI,QAAA,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AACvB,QAAA,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;AAErC,QAAA,IAAI,KAAK,IAAI,KAAK,CAAC,cAAc,EAAE;YACjC,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACvC,SAAA;AAED,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,GAAG,IAAIA,mCAAqB,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACxF,KAAK,CAAC,QAAQ,GAAG1E,cAAG,CAAC,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE3D,IAAI,YAAY,KAAK,IAAI,EAAE;AACzB,YAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AACrD,gBAAA,IAAI,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBAE9B,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;AAChE,oBAAA,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9B,iBAAA;AAAM,qBAAA;oBACL,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;AAC/C,iBAAA;AACF,aAAA;AACF,SAAA;AAED,QAAA,kBAAkB,CAAC,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC;AACtD,QAAA,OAAO,UAAU,CAAC,eAAe,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;KACnF,CAAA;IAnDU,kBAAkB,GAAA,UAAA,CAAA;AAD9B,QAAA,YAAY,EAAE;AACF,KAAA,EAAA,kBAAkB,CAoD9B,CAAA;IAAD,OAAC,kBAAA,CAAA;AAAA,CApDD,EAoDC,EAAA;AAQD,IAAA,kBAAA,IAAA,YAAA;AAWE,IAAA,SAAA,kBAAA,CAAY,MAAwD,EAAA;AAClE,QAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,KAAK,MAAM,YAAYA,cAAG,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,KAAK,UAAU,CAAC,EAAE;AAClG,YAAA,MAAM,GAAG;AACP,gBAAA,QAAQ,EAAE,MAAM;aACjB,CAAC;AACH,SAAA;AACD,QAAA,IAAI,CAAC,QAAQ,GAAI,MAA4B,CAAC,QAAQ,CAAC;QACvD,IAAI,CAAC,YAAY,GAAI,MAA4B,CAAC,YAAY,IAAI,EAAE,CAAC;AACrE,QAAA,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;AAC5B,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACpB,QAAA,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC;KAC7B;IAUD,kBAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,UAAsB,EAAE,kBAA0C,EAAE,WAAgC,EAAE,MAAW,EAAA;QAAjI,IAyDC,KAAA,GAAA,IAAA,CAAA;QAxDC,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACtC,SAAA;AACD,QAAA,IAAI,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;AAG9B,QAAA,IAAI,IAAI,GAAG,OAAO,KAAK,KAAK,UAAU,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;QACzD,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;AACxB,QAAA,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;QAE3C,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAC,YAAqD,EAAA;AAClF,YAAA,IAAI,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;AACrC,YAAA,IAAI,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;AAC3C,YAAA,IAAI,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;AAC3C,YAAA,IAAI,aAAa,GAAG,IAAI,aAAa,CAAC,YAAY,CAAC,CAAC;AAEpD,YAAA,IAAI,QAAQ,CAAC;YACb,IAAI,MAAM,GAAG,EAAE,CAAC;AAEhB,YAAA,IAAI,MAAM,EAAE;AAEV,gBAAA,aAAa,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC/C,aAAA;AAED,YAAA,KAAgB,UAAY,EAAZ,cAAA,GAAA,YAAY,EAAZ,EAAY,GAAA,cAAA,CAAA,MAAA,EAAZ,IAAY,EAAE;AAAzB,gBAAA,IAAI,GAAG,GAAA,cAAA,CAAA,EAAA,CAAA,CAAA;AACV,gBAAA,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;oBAE7B,QAAQ,GAAG,aAAa,CAAC,YAAY,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACtD,oBAAA,IAAI,QAAQ,CAAC,WAAW,KAAK,IAAI,EAAE;AACjC,wBAAA,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACvB,qBAAA;AACF,iBAAA;AAAM,qBAAA,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;AAEzC,oBAAA,KAAK,IAAI,GAAG,IAAI,GAAG,EAAE;AACnB,wBAAA,IAAI,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;AACxB,wBAAA,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;4BAClC,QAAQ,GAAG,aAAa,CAAC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC3D,4BAAA,IAAI,QAAQ,CAAC,WAAW,KAAK,IAAI,EAAE;AACjC,gCAAA,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACvB,6BAAA;AACF,yBAAA;AACF,qBAAA;AACF,iBAAA;AAAM,qBAAA;oBACL,MAAM,IAAI,KAAK,CAAC,sDAAA,CAAA,MAAA,CAAsD,OAAO,GAAG,EAAA,IAAA,CAAG,CAAC,CAAC;AACtF,iBAAA;AACF,aAAA;AAED,YAAA,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,UAAA,EAAE,EAAI,EAAA,OAAA,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,CAA7B,EAA6B,CAAC,CAAC,CAAC,IAAI,CAAC,YAAA;AACvE,gBAAA,IAAM,OAAO,GAAG,KAAI,CAAC,QAAQ,KAAK,IAAI;AACpC,sBAAE,YAAY,CAAC,OAAO,CAAC,KAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,kBAAkB,CAAC;sBACtE,IAAI,CAAC;AACT,gBAAA,KAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AAC3B,gBAAA,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,gBAAA,OAAO,OAAO,CAAC;AACjB,aAAC,CAAC,CAAC;AACL,SAAC,CAAC,CAAC;KACJ,CAAA;IAzFU,kBAAkB,GAAA,UAAA,CAAA;AAD9B,QAAA,YAAY,EAAE;AACF,KAAA,EAAA,kBAAkB,CA0F9B,CAAA;IAAD,OAAC,kBAAA,CAAA;AAAA,CA1FD,EA0FC;;ACtYD,SAAS,MAAM,CAAC,QAAkB,EAAE,QAAc,EAAA;AAChD,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;UAC1B,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC;UACnC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC;AAEY,IAAA,cAAc,GAAG;AAE5B,IAAA,MAAM,EAAN,UAAO,QAAkB,EAAE,QAAc,EAAE,QAAQ,EAAA;AACjD,QAAA,OAAO,CAAC,QAAQ,KAAK,SAAS;cAC1B,QAAQ,EAAE;AACZ,cAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,YAAM,EAAA,OAAA,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAA1B,EAA0B,CAAC,CAAC;KACvD;AAGD,IAAA,IAAI,EAAJ,UAAK,QAAkB,EAAE,QAAc,EAAE,QAAQ,EAAA;AAC/C,QAAA,OAAO,CAAC,QAAQ,KAAK,SAAS;cAC1B,QAAQ,EAAE;AACZ,cAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;KAC3D;AAGD,IAAA,KAAK,EAAL,UAAM,QAAkB,EAAE,QAAc,EAAE,QAAQ,EAAA;AAChD,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KACjE;;;AC2DH,SAAS,oBAAoB,CAAC,OAAO,EAAA;AACnC,IAAA,IAAI,OAAO,CAAC,cAAc,IAAI,OAAO,OAAO,CAAC,SAAS,CAAC,QAAQ,KAAK,UAAU,EAAE;AAC9E,QAAA,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC1B,KAAA;AAED,IAAA,OAAO,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;AACxE,CAAC;AAMD,IAAA,iBAAA,IAAA,YAAA;IAYE,SAAY,iBAAA,CAAA,UAAsB,EAAE,WAAwB,EAAA;AAC1D,QAAA,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;AAC7B,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;KAChC;AAGD,IAAA,iBAAA,CAAA,SAAA,CAAA,KAAK,GAAL,UAAM,OAAO,EAAE,IAAI,EAAA;AACjB,QAAA,IAAI,YAAY,GAAG,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,cAAc,CAAC,KAAK,CAAC;QAC7E,IAAI,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;AAEtD,QAAA,OAAO,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,aAAa,EAAE,YAAA;AACnD,YAAA,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,YAAA;gBACtD,IAAI,OAAO,CAAC,iBAAiB,EAAE;AAC7B,oBAAA,OAAO,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;AACpC,iBAAA;AACH,aAAC,CAAC,CAAC;SACJ,CAAC,CAAC,IAAI,CAAC,YAAA;YACN,IAAI,OAAO,CAAC,8BAA8B,EAAE;AAC1C,gBAAA,OAAO,CAAC,8BAA8B,CAAC,IAAI,EAAE,CAAC;AAC/C,aAAA;AACH,SAAC,CAAC,CAAC;KACJ,CAAA;IAGD,iBAAwB,CAAA,SAAA,CAAA,wBAAA,GAAxB,UAAyB,OAA2B,EAAA;QAApD,IAiBC,KAAA,GAAA,IAAA,CAAA;QAhBC,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,UAAA,UAAU,EAAA;YACnD,IAAI,OAAO,CAAC,oCAAoC,EAAE;gBAChD,OAAO,OAAO,CAAC,oCAAoC;AAChD,qBAAA,0BAA0B,EAAE;AAC5B,qBAAA,IAAI,CAAC,YAAA;oBACJ,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;oBAEjE,OAAO,KAAI,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;AAC9C,iBAAC,CAAC;AACD,qBAAA,IAAI,CAAC,YAAM,EAAA,OAAA,UAAU,CAAV,EAAU,CAAC,CAAC;AAC3B,aAAA;YAED,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;AAEjE,YAAA,OAAO,KAAI,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAM,EAAA,OAAA,UAAU,CAAV,EAAU,CAAC,CAAC;AACrE,SAAC,CAAC,CAAC;KACJ,CAAA;IAOD,iBAAgB,CAAA,SAAA,CAAA,gBAAA,GAAhB,UAAiB,OAA2B,EAAA;QAA5C,IAiCC,KAAA,GAAA,IAAA,CAAA;AAhCC,QAAA,IAAI,cAAc,CAAC;AACnB,QAAA,IAAI,SAAS,CAAC;AACd,QAAA,IAAI,iBAAiB,CAAC;AAEtB,QAAA,IAAI,CAAC,CAAC;AAEN,QAAA,OAAO,IAAI;aACR,eAAe,CAAC,OAAO,CAAC;aACxB,IAAI,CAAC,oBAAoB,CAAC;AAC1B,aAAA,IAAI,CAAC,YAAA;AACJ,YAAA,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;AACxC,YAAA,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;AAC9B,YAAA,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAC9C,YAAA,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC;AAE/B,YAAA,IAAI,YAAY,GAAG,KAAI,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,IAAI,SAAS,CAAC,CAAC;YAE/E,IAAI,OAAO,CAAC,aAAa,EAAE;gBACxB,YAAqC,CAAC,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACtF,aAAA;AAED,YAAA,OAAO,CAAC,CAAC,IAAI,CACX,cAAc,EACd,iBAAiB,CAAC,KAAK,EACvB,IAAI,EACJ,YAAY,EACZ,IAAI,CACL,CAAC;AACJ,SAAC,CAAC,CAAC,IAAI,CAAC,UAAA,WAAW,EAAI,EAAA,OAAA,CAAC,CAAC,MAAM,CAC7B,cAAc,EACd,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,CAAC,CAClE,CAHsB,EAGtB,CAAC,CAAC;KACN,CAAA;IAOD,iBAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,OAA2B,EAAA;AACzC,QAAA,IAAI,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;AAE1G,QAAA,IAAI,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;AACzC,YAAA,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,aAAa;kBACrC,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC;AACzD,kBAAE,OAAO,CAAC,SAAS,CAAC;AAEtB,YAAA,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,UAAA,iBAAiB,EAAA;AACtF,gBAAA,cAAc,CAAC,YAAY,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;gBAErD,IAAI,OAAO,CAAC,IAAI,EAAE;oBAChB,cAAc,CAAC,gBAAgB,CAACA,cAAG,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAC5D,iBAAA;AAED,gBAAA,OAAO,CAAC,SAAS,GAAG,cAAc,CAAC,SAAS,GAAG,cAAc,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAC3F,gBAAA,OAAO,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AAC9C,gBAAA,OAAO,OAAO,CAAC;AACjB,aAAC,CAAC,CAAC;AACJ,SAAA;AAID,QAAA,IAAI,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC;QACzC,IAAI,OAAO,GAAG,OAAO,OAAO,CAAC,SAAS,KAAK,UAAU,CAAC;AACtD,QAAA,IAAI,OAAO,EAAE;AACX,YAAA,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC;AACzB,YAAA,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AACnC,SAAA;AACD,QAAA,IAAI,CAAC,GAAGwE,wBAAQ,CAAC,cAAc,CAACA,wBAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,IAAI,CAAyB,CAAC;QAGvG,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW,IAAI,iBAAiB,CAAC;QAGnD,CAAC,CAAC,UAAU,CAAC,OAAO,GAAG,cAAc,IAAI,OAAO,CAAC,SAAS,IAAI,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC;AAGrF,QAAA,OAAO,CAAC,iBAAiB,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAyB,CAAC;QAEhF,IAAI,OAAO,CAAC,IAAI,EAAE;YAChB,cAAc,CAAC,gBAAgB,CAACxE,cAAG,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAC5D,SAAA;QACD,cAAc,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;AACtG,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACjC,CAAA;IAOD,iBAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,OAA2B,EAAA;QAAnC,IA2CC,KAAA,GAAA,IAAA,CAAA;AA1CC,QAAA,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;AACnF,QAAA,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE9D,IAAI,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,sBAAsB,CAA2B,CAAC;AAC/F,QAAA,IAAI,oCAAoC,GAAG,WAAW,CAAC,UAAU,EAAE,CAAC;AAEpE,QAAA,IAAI,oCAAoC,EAAE;AACxC,YAAA,OAAO,CAAC,oCAAoC,GAAG,oCAAoC,CAAC;AACrF,SAAA;AAAM,aAAA;AACL,YAAA,OAAO,CAAC,8BAA8B,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC;AAC/D,SAAA;QAED,IAAI,OAAO,CAAC,SAAS,EAAE;AACrB,YAAA,OAAO,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAC/C,SAAA;aAAM,IAAI,OAAO,CAAC,IAAI,EAAE;YACvB,IAAI,OAAO,CAAC,aAAa,EAAE;gBACxB,OAAO,CAAC,IAA6B,CAAC,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACtF,aAAA;AAED,YAAA,OAAO,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,sBAAsB,EAAE,CAAC,CAAC,IAAI,CAAC,UAAA,WAAW,EAAA;gBACjG,IAAI,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;gBACxD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;gBAE7D,IAAI,OAAO,CAAC,oCAAoC,EAAE;AAChD,oBAAA,OAAO,OAAO,CAAC,oCAAoC,CAAC,0BAA0B,EAAE;AAC7E,yBAAA,IAAI,CAAC,YAAA,EAAM,OAAA,KAAI,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA,EAAA,CAAC;AACvC,yBAAA,IAAI,CAAC,YAAM,EAAA,OAAA,MAAM,CAAN,EAAM,CAAC,CAAC;AACvB,iBAAA;AAED,gBAAA,OAAO,KAAI,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,YAAM,EAAA,OAAA,MAAM,CAAN,EAAM,CAAC,CAAC;AACxD,aAAC,CAAC,CAAC;AACJ,SAAA;aAAM,IAAI,OAAO,CAAC,QAAQ,EAAE;AAC3B,YAAA,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YAE7B,IAAI,OAAO,CAAC,8BAA8B,EAAE;AAC1C,gBAAA,OAAO,CAAC,8BAA8B,CAAC,IAAI,EAAE,CAAC;AAC/C,aAAA;AAED,YAAA,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,SAAA;AAED,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KAC9B,CAAA;IAnMU,iBAAiB,GAAA,UAAA,CAAA;AAD7B,QAAAyC,iCAAM,CAAC,UAAU,EAAE,WAAW,CAAC;AACnB,KAAA,EAAA,iBAAiB,CAoM7B,CAAA;IAAD,OAAC,iBAAA,CAAA;AAAA,CApMD,EAoMC;;ACnSY,IAAA,cAAc,GAAG;AAC5B,IAAA,UAAU,EAAE,uBAAuB;AACnC,IAAA,WAAW,EAAE,wBAAwB;AACrC,IAAA,SAAS,EAAE,sBAAsB;AACjC,IAAA,YAAY,EAAE,yBAAyB;AAEvC,IAAA,UAAU,EAAE,uBAAuB;AACnC,IAAA,WAAW,EAAE,wBAAwB;AACrC,IAAA,SAAS,EAAE,sBAAsB;AACjC,IAAA,YAAY,EAAE,yBAAyB;AAEvC,IAAA,WAAW,EAAE,wBAAwB;AAErC,IAAA,gBAAgB,EAAE,8BAA8B;AAChD,IAAA,iBAAiB,EAAE,+BAA+B;AAClD,IAAA,eAAe,EAAE,6BAA6B;AAC9C,IAAA,kBAAkB,EAAE,gCAAgC;AAEpD,IAAA,aAAa,EAAE,2BAA2B;AAC1C,IAAA,cAAc,EAAE,4BAA4B;AAC5C,IAAA,YAAY,EAAE,0BAA0B;AACxC,IAAA,eAAe,EAAE,6BAA6B;AAE9C,IAAA,YAAY,EAAE,yBAAyB;AACvC,IAAA,aAAa,EAAE,0BAA0B;AACzC,IAAA,WAAW,EAAE,wBAAwB;AACrC,IAAA,cAAc,EAAE,2BAA2B;AAE3C,IAAA,aAAa,EAAE,0BAA0B;AACzC,IAAA,YAAY,EAAE,yBAAyB;;;ACzBzC,SAAS,4BAA4B,CAAC,gBAAgB,EAAE,GAAa,EAAA;AACnE,IAAA,OAAO,UAAS,MAAM,EAAE,GAAG,EAAE,UAAU,EAAA;AACrC,QAAA,IAAI,YAAY,GAAG,OAAO,GAAG,KAAK,QAAQ,GAAG,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;AACzE,QAAA,IAAI,CAAC,GAAG+B,wBAAQ,CAAC,cAAc,CAACA,wBAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,YAAY,CAAyB,CAAC;AAE/G,QAAA,IAAI,OAAO,gBAAgB,KAAK,QAAQ,EAAE;AACxC,YAAA,gBAAgB,GAAG;AACjB,gBAAA,QAAQ,EAAE,gBAAgB;AAC1B,gBAAA,IAAI,EAAE,GAAG;aACV,CAAC;AACH,SAAA;AAED,QAAA,IAAI,UAAU,EAAE;AACd,YAAA,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC3B,YAAA,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC;AAChC,SAAA;AAED,QAAA,gBAAgB,CAAC,GAAG,GAAG,GAAG,CAAC;QAC3B,CAAC,CAAC,eAAe,CAAC,IAAI,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACzD,KAAC,CAAC;AACJ,CAAC;AAKK,SAAU,QAAQ,CAAC,gBAAiC,EAAA;AACxD,IAAA,OAAO,4BAA4B,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AAC9D,CAAC;AAKK,SAAU,KAAK,CAAC,gBAAiC,EAAA;AACrD,IAAA,OAAO,4BAA4B,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;AAC/D,CAAC;AAiBD,IAAA,aAAA,IAAA,YAAA;AAcE,IAAA,SAAA,aAAA,CAAY,MAAM,EAAA;AAChB,QAAA,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;AACxB,QAAA,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;AACnE,QAAA,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAChC,QAAA,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;KACvB;AAED,IAAA,aAAA,CAAA,SAAA,CAAA,MAAM,GAAN,UAAO,QAAiB,EAAE,SAAc,EAAE,UAAsB,EAAA;QAC9D,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;KACzH,CAAA;IACH,OAAC,aAAA,CAAA;AAAD,CAAC,EAAA,CAAA,CAAA;AAED,IAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,SAAS,aAAa,CAAC,gBAA4D,EAAE,MAA2B,EAAE,MAAsB,EAAA;IACtI,IAAI,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAE7C,IAAI,CAAC,SAAS,EAAE;QACd,SAAS,GAAG,EAAE,CAAC;AACf,QAAA,gBAAgB,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACzC,KAAA;AAED,IAAA,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,aAAa,CAAC,SAA2B,EAAE,QAAkC,EAAA;AACpF,IAAA,IAAI,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AAC/B,IAAA,IAAI,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;AACnC,IAAA,IAAI,gBAAgB,GAA+C,IAAI,GAAG,EAAE,CAAC;AAE7E,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAClD,QAAA,IAAI,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC1B,QAAA,IAAI,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;AAC9B,QAAA,IAAI,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC;AAElC,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAChD,YAAA,IAAI,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AACtB,YAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE;gBACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,EAAE,CAAC,EAAE;AACtC,oBAAA,IAAI,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAIxB,oBAAA,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAe,CAAC,EAAE;AACpC,wBAAA,aAAa,CAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACjD,qBAAA;AACF,iBAAA;AACF,aAAA;AACF,SAAA;AAED,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;AAC9C,YAAA,IAAI,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACpB,YAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE;gBACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,EAAE,CAAC,EAAE;AACtC,oBAAA,IAAI,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAIxB,oBAAA,IAAI,MAAM,CAAC,KAAK,CAAC,IAAe,CAAC,EAAE;AACjC,wBAAA,aAAa,CAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACjD,qBAAA;AACF,iBAAA;AACF,aAAA;AACF,SAAA;AACF,KAAA;AAED,IAAA,gBAAgB,CAAC,OAAO,CAAC,UAAC,eAAe,EAAE,MAAM,EAAA;QAC/C,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,aAAa,KAAK,IAAI,EAAE;YAKnD,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,eAAe,CAAC,CAAC;AACzD,SAAA;AACH,KAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAA,mBAAA,IAAA,YAAA;AA4CE,IAAA,SAAA,mBAAA,CAAY,QAAgB,EAAE,QAAiB,EAAE,QAAgB,EAAE,SAAiB,EAAE,UAAsB,EAAE,aAAqB,EAAE,GAAY,EAAA;AAC/I,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAwC,CAAC;AACzD,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;AAC7B,QAAA,IAAI,CAAC,aAAa,GAAG,aAAa,IAAI,SAAS,GAAG,aAAa,GAAG,IAAI,CAAC;QACvE,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC;AACvD,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;AAEf,QAAA,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE;YACzE,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC;AAChD,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;AACzB,SAAA;AACD,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;AACnB,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;KACtB;IAED,mBAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,OAAgB,EAAA;QACtB,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;AAClC,YAAA,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;AAC7B,gBAAA,OAAO,IAAI,CAAC;AACb,aAAA;AAED,YAAA,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;AACnC,YAAA,IAAI,YAAY,GAAI,OAA0B,CAAC,cAAc,CAAC;AAE9D,YAAA,IAAI,YAAY,IAAK,YAA2B,CAAC,kBAAkB,EAAE;AACnE,gBAAA,IAAI,OAAO,GAAI,YAA2B,CAAC,kBAAkB,CAAC;AAE9D,gBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;oBAChD,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,WAAW,EAAE;AAC1C,wBAAA,OAAO,IAAI,CAAC;AACb,qBAAA;AACF,iBAAA;AAED,gBAAA,OAAO,KAAK,CAAC;AACd,aAAA;AAED,YAAA,OAAQ,OAA0B,CAAC,WAAW,KAAK,WAAW,CAAC;AAChE,SAAA;AAED,QAAA,OAAO,KAAK,CAAC;KACd,CAAA;IAED,mBAAI,CAAA,SAAA,CAAA,IAAA,GAAJ,UAAK,MAAM,EAAA;QACT,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC1B,OAAO;AACR,aAAA;AACD,YAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACtB,SAAA;AACD,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AAEpB,QAAA,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC7B,QAAA,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;AAC/B,QAAA,IAAI,QAAQ,GAAG,QAAQ,CAAC,iBAAiB,CAAC;QAE1C,IAAI,CAAC,QAAQ,EAAE;YACb,QAAQ,GAAG,QAAQ,CAAC,iBAAiB,GAAGxE,cAAG,CAAC,sBAAsB,CAAC,aAAa,CAA6B,CAAC;AAE9G,YAAA,IAAI,OAAO,GAAG;AACZ,gBAAA,SAAS,EAAE,IAAI;AACf,gBAAA,OAAO,EAAE,CAAC,IAAI,CAAC,aAAa;aAC7B,CAAC;AAEF,YAAA,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACpC,YAAA,QAAQ,CAAC,OAAO,GAAG,EAAE,CAAC;AACvB,SAAA;AAED,QAAA,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE5B,IAAI,IAAI,CAAC,aAAa,EAAE;AACtB,YAAA,IAAI,OAAO,GAAG,QAAQ,CAAC,iBAAiB,CAAC;YAEzC,IAAI,IAAI,CAAC,GAAG,EAAE;gBACZ,IAAI,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACrC,IAAI,CAAC,KAAK,EAAE;oBACV,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;AACvC,iBAAA;AAAM,qBAAA;AAGL,oBAAA,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACjB,iBAAA;AAED,gBAAA,OAAO,OAAO,EAAE;AACd,oBAAA,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;wBACzB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,EAAE,CAAC,UAAU,GAAG,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,GAAG,OAAO,CAAC,CAAC;AAC7F,qBAAA;AAED,oBAAA,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACtC,iBAAA;AAED,gBAAA,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;oBAC/B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,CAAC;AACjD,iBAAA;AACF,aAAA;AAAM,iBAAA;AACL,gBAAA,OAAO,OAAO,EAAE;AACd,oBAAA,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;wBACzB,IAAI,KAAK,GAAG,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,EAAE,CAAC,UAAU,GAAG,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,GAAG,OAAO,CAAC;wBAC5F,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;AAEtC,wBAAA,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;4BAC/B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC;AAC3C,yBAAA;wBAED,MAAM;AACP,qBAAA;AAED,oBAAA,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACtC,iBAAA;AACF,aAAA;AACF,SAAA;KACF,CAAA;IAED,mBAAQ,CAAA,SAAA,CAAA,QAAA,GAAR,UAAS,OAAgB,EAAA;AACvB,QAAA,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACzB,IAAI,KAAK,GAAG,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,EAAE,CAAC,UAAU,GAAG,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,GAAG,OAAO,CAAC;YAM5F,IAAI,IAAI,CAAC,GAAG,EAAE;gBACZ,IAAI,KAAK,IAAW,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBAC3F,IAAI,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEjC,gBAAA,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;AAChB,oBAAA,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACxB,iBAAA;AAED,gBAAA,OAAO,IAAI,CAAC;AACb,aAAA;YAGD,IAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACnD,IAAI,YAAY,KAAK,KAAK,EAAE;gBAC1B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;gBAIrC,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;oBAC/C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC;AAC3C,iBAAA;AACF,aAAA;AACF,SAAA;AAED,QAAA,OAAO,KAAK,CAAC;KACd,CAAA;IAED,mBAAK,CAAA,SAAA,CAAA,KAAA,GAAL,UAAM,OAAgB,EAAA;AACpB,QAAA,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACzB,IAAI,KAAK,GAAG,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,EAAE,CAAC,UAAU,GAAG,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,GAAG,OAAO,CAAC;YAM5F,IAAI,IAAI,CAAC,GAAG,EAAE;gBACZ,IAAI,KAAK,IAAW,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAE3F,gBAAA,IAAI,IAAI,CAAC,QAAQ,KAAK,GAAG,EAAE;AACzB,oBAAA,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAClB,oBAAA,OAAO,IAAI,CAAC;AACb,iBAAA;gBAED,IAAI,KAAK,GAAG,CAAC,CAAC;AACd,gBAAA,IAAI,IAAI,GAAG,OAAO,CAAC,sBAAsB,CAAC;AAE1C,gBAAA,OAAO,IAAI,EAAE;AACX,oBAAA,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;AACtB,wBAAA,KAAK,EAAE,CAAC;AACT,qBAAA;AAED,oBAAA,IAAI,GAAG,IAAI,CAAC,sBAAsB,CAAC;AACpC,iBAAA;gBAED,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AAC9B,gBAAA,OAAO,IAAI,CAAC;AACb,aAAA;YAOD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;YAItC,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE;gBAC/C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC;AAC3C,aAAA;AACF,SAAA;AAED,QAAA,OAAO,KAAK,CAAC;KACd,CAAA;AAED,IAAA,mBAAA,CAAA,SAAA,CAAA,MAAM,GAAN,YAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;AACR,SAAA;AACD,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;AACnB,QAAA,IAAI,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC;AACpD,QAAA,IAAI,aAAa,EAAE;AACjB,YAAA,IAAI,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;AACpC,YAAA,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE;gBAC7B,IAAI,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAChC,gBAAA,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE;AACd,oBAAA,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AACxB,iBAAA;AACD,gBAAA,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;oBACxB,aAAa,CAAC,UAAU,EAAE,CAAC;AAC3B,oBAAA,IAAI,CAAC,QAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC;AACxC,iBAAA;AACF,aAAA;YAGD,IAAI,IAAI,CAAC,aAAa,EAAE;gBACtB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;AACtC,aAAA;AACF,SAAA;KACF,CAAA;IACH,OAAC,mBAAA,CAAA;AAAD,CAAC,EAAA,CAAA;;ACzZD,IAAA,qBAAA,IAAA,YAAA;AAAA,IAAA,SAAA,qBAAA,GAAA;KA+BC;AAvBC,IAAA,qBAAA,CAAA,SAAA,CAAA,UAAU,GAAV,UAAW,SAAoB,EAAE,MAAgB,KAAU,CAAA;AAU3D,IAAA,qBAAA,CAAA,SAAA,CAAA,QAAQ,GAAR,UAAS,QAAuB,EAAE,IAAa,KAAU,CAAA;AAQzD,IAAA,qBAAA,CAAA,SAAA,CAAA,IAAI,GAAJ,UAAK,SAAoB,EAAE,MAAgB,EAAA;AACzC,QAAA,IAAI,MAAM,GAAG,IAAK,MAAc,EAAE,CAAC;QACnC,IAAI,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC+B,2BAAY,CAAC,CAAC;AAC/C,QAAA,YAAY,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;KAC5C,CAAA;IACH,OAAC,qBAAA,CAAA;AAAD,CAAC,EAAA;;ACzBK,SAAU,QAAQ,CAAC,gBAAiC,EAAA;AACxD,IAAA,OAAO,UAAS,MAAM,EAAA;AACpB,QAAA,IAAI,QAAQ,GAAG,OAAO,gBAAgB,KAAK,QAAQ,IAAI,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,KAAK,MAAM,CAAC,SAAS,CAAC;AACpH,QAAA,IAAI,QAAQ,EAAE;AACZ,YAAA,MAAM,CAAC,SAAS,GAAG,gBAAgB,CAAC;AACrC,SAAA;AAAM,aAAA;YACLyC,wBAAQ,CAAC,MAAM,CAACA,wBAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAC9D,SAAA;AACH,KAAC,CAAC;AACJ,CAAC;AAMK,SAAU,QAAQ,CAAC,QAAuC,EAAA;AAC9D,IAAA,OAAO,UAAS,MAAM,EAAA;QACpB,IAAI,QAAQ,YAAY,oBAAoB,EAAE;YAC5CA,wBAAQ,CAAC,MAAM,CAACA,wBAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AACtD,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,GAAGA,wBAAQ,CAAC,cAAc,CAACA,wBAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;AACjF,YAAA,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC5B,SAAA;AACH,KAAC,CAAC;AACJ,CAAC;AAMK,SAAU,aAAa,CAAC,IAAY,EAAA;AACxC,IAAA,OAAO,UAAS,MAAM,EAAA;AACpB,QAAA,IAAI,CAAC,GAAGA,wBAAQ,CAAC,cAAc,CAACA,wBAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,MAAM,CAAyB,CAAC;QACzG,CAAC,CAAC,WAAW,GAAG,oBAAoB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAC/D,KAAC,CAAC;AACJ,CAAC;SAQe,eAAe,CAAC,IAAY,EAAE,kBAA2B,EAAE,OAAkB,EAAA;AAC3F,IAAA,OAAO,UAAS,MAAM,EAAA;AACpB,QAAA,IAAI,CAAC,GAAGA,wBAAQ,CAAC,cAAc,CAACA,wBAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,MAAM,CAAyB,CAAC;QACzG,CAAC,CAAC,aAAa,GAAG,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;AACjE,QAAA,CAAC,CAAC,2BAA2B,GAAG,kBAAkB,CAAC;AACnD,QAAA,CAAC,CAAC,OAAO,GAAG,OAAc,CAAC;AAC7B,KAAC,CAAC;AACJ,CAAC;AAOK,SAAU,kBAAkB,CAAC,MAAO,EAAA;IACxC,IAAI,IAAI,GAAG,UAAS,CAAC,EAAA;AACnB,QAAA,IAAI,CAAC,GAAGA,wBAAQ,CAAC,cAAc,CAACA,wBAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAC,CAAyB,CAAC;AACpG,QAAA,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC;AACxB,KAAC,CAAC;AAEF,IAAA,OAAO,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AACtC,CAAC;SAMe,QAAQ,CAAC,oBAAsC,EAAE,GAAI,EAAE,UAAW,EAAA;AAChF,IAAA,IAAI,IAAI,GAAG,UAAS,MAAM,EAAE,IAAI,EAAE,WAAW,EAAA;AAC3C,QAAA,IAAI,YAAY,GAAG,IAAI,GAAG,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;AACtD,QAAA,IAAI,CAAC,GAAGA,wBAAQ,CAAC,cAAc,CAACA,wBAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,YAAY,CAAC,CAAC;AACvF,QAAA,IAAI,IAAI,CAAC;AAET,QAAA,IAAI,IAAI,EAAE;AACR,YAAA,oBAAoB,GAAG,oBAAoB,IAAI,EAAE,CAAC;AACjD,YAAA,oBAA4B,CAAC,IAAI,GAAG,IAAI,CAAC;AAC3C,SAAA;AAED,QAAA,IAAI,GAAG,IAAI,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;AACzD,KAAC,CAAC;IAEF,IAAI,CAAC,oBAAoB,EAAE;AACzB,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;AAED,IAAA,IAAI,GAAG,EAAE;QACP,IAAI,MAAM,GAAG,oBAAoB,CAAC;QAClC,oBAAoB,GAAG,IAAI,CAAC;QAC5B,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;AACtC,KAAA;AAED,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;AAMK,SAAU,cAAc,CAAC,MAAO,EAAA;IACpC,IAAI,IAAI,GAAG,UAAS,CAAC,EAAA;AACnB,QAAA,IAAI,CAAC,GAAGA,wBAAQ,CAAC,cAAc,CAACA,wBAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAC,CAAyB,CAAC;AACpG,QAAA,CAAC,CAAC,iBAAiB,GAAG,IAAI,CAAC;AAC7B,KAAC,CAAC;AAEF,IAAA,OAAO,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AACtC,CAAC;AAED,IAAM,uBAAuB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAK3C,SAAU,YAAY,CAAC,eAAgB,EAAA;IAC3C,IAAI,OAAO,GAAG,OAAO,eAAe,KAAK,UAAU,IAAI,CAAC,eAAe;AACrE,UAAE,uBAAuB;UACvB,eAAe,CAAC;IAEpB,IAAI,IAAI,GAAG,UAAS,CAAC,EAAA;AACnB,QAAA,IAAI,CAAC,GAAGA,wBAAQ,CAAC,cAAc,CAACA,wBAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAC,CAAyB,CAAC;AACpG,QAAA,CAAC,CAAC,eAAe,GAAG,IAAI,CAAC;AACzB,QAAA,CAAC,CAAC,gBAAgB,GAAG,OAAO,CAAC;AAC/B,KAAC,CAAC;AAEF,IAAA,OAAO,OAAO,eAAe,KAAK,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC;AAC9E,CAAC;AAMK,SAAU,iBAAiB,CAAC,SAAmB,EAAA;AACnD,IAAA,OAAO,UAAS,CAAC,EAAA;AACf,QAAA,IAAI,CAAC,GAAGA,wBAAQ,CAAC,cAAc,CAACA,wBAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAC,CAAyB,CAAC;AACpG,QAAA,CAAC,CAAC,iBAAiB,GAAG,UAAS,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,kBAAkB,EAAA;YACtF,IAAI;gBACF,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAC;AACtE,aAAA;AAAC,YAAA,OAAO,KAAK,EAAE;gBACdrD,qBAAU,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACjD,aAAA;AACH,SAAC,CAAC;AACJ,KAAC,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,GAAK,EAAA,OAAO,KAAK,CAAC,EAAE;AAU1C,SAAU,cAAc,CAAC,SAA6B,EAAA;AAC1D,IAAA,OAAO,UAAS,CAAC,EAAA;AACf,QAAA,IAAI,CAAC,GAAGqD,wBAAQ,CAAC,cAAc,CAACA,wBAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAC,CAAyB,CAAC;AACpG,QAAA,CAAC,CAAC,cAAc,GAAG,SAAS,GAAG,UAAS,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAA;YAC5E,IAAI;gBACF,OAAQ,SAAoC,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AACtF,aAAA;AAAC,YAAA,OAAO,KAAK,EAAE;gBACdrD,qBAAU,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAChD,gBAAA,OAAO,KAAK,CAAC;AACd,aAAA;AACH,SAAC,GAAG,mBAAmB,CAAC;AAC1B,KAAC,CAAC;AACJ,CAAC;AAMK,SAAU,aAAa,CAAC,MAAO,EAAA;IACnC,IAAI,IAAI,GAAG,UAAS,CAAC,EAAA;AACnB,QAAA,IAAI,CAAC,GAAGqD,wBAAQ,CAAC,cAAc,CAACA,wBAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAC,CAAyB,CAAC;AACpG,QAAA,CAAC,CAAC,aAAa,GAAG,IAAI,CAAC;AACzB,KAAC,CAAC;AAEF,IAAA,OAAO,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AACtC,CAAC;AAMK,SAAU,eAAe,CAAC,QAAgB,EAAA;AAC9C,IAAA,OAAO,UAAS,MAAM,EAAA;QACpBA,wBAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,uBAAuB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AACzE,KAAC,CAAC;AACJ,CAAC;AAMK,SAAU,OAAO,CAAC,IAAY,EAAA;IAClC,OAAO,eAAe,CAAC,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;AACzD,CAAC;SASe,UAAU,CAAC,MAAa,EAAE,YAAiE,EAAE,iBAAyB,EAAA;AACpI,IAAA,OAAO,eAAe,CAAC,IAAI,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAC1F,CAAC;AAKe,SAAA,MAAM,CAAC,oBAAyC,EAAE,iBAAyB,EAAA;AACzF,IAAA,IAAI,MAAM,CAAC;AACX,IAAA,IAAI,YAAY,CAAC;AACjB,IAAA,IAAI,OAAO,oBAAoB,KAAK,UAAU,EAAE;QAC9C,MAAM,GAAG,oBAAoB,CAAC;AAC/B,KAAA;AAAM,SAAA;QACL,YAAY,GAAG,oBAAoB,CAAC;QACpC,MAAM,GAAG,SAAS,CAAC;AACpB,KAAA;IAED,IAAI,IAAI,GAAG,UAAS,CAAC,EAAA;AACnB,QAAAA,wBAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,uBAAuB,EAAE,IAAI,cAAc,CAAC,YAAY,EAAE,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/G,KAAC,CAAC;AAEF,IAAA,OAAO,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AACtC,CAAC;AAcK,SAAU,IAAI,CAAC,gBAAqE,EAAA;AACxF,IAAA,OAAO,UAAS,MAAM,EAAA;AACpB,QAAA,MAAM,CAAC,KAAK,GAAG,gBAAgB,CAAC;AAClC,KAAC,CAAC;AACJ,CAAC;AAMK,SAAU,aAAa,CAAC,MAAO,EAAA;IACnC,IAAI,IAAI,GAAG,UAAS,CAAC,EAAA;AACnB,QAAAA,wBAAQ,CAAC,MAAM,CAACA,wBAAQ,CAAC,QAAQ,EAAE,IAAI,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC;AACrE,KAAC,CAAC;AAEF,IAAA,OAAO,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AACtC,CAAC;SAOe,aAAa,GAAA;IAAC,IAAY,SAAA,GAAA,EAAA,CAAA;SAAZ,IAAY,EAAA,GAAA,CAAA,EAAZ,EAAY,GAAA,SAAA,CAAA,MAAA,EAAZ,EAAY,EAAA,EAAA;QAAZ,SAAY,CAAA,EAAA,CAAA,GAAA,SAAA,CAAA,EAAA,CAAA,CAAA;;AACxC,IAAA,OAAO,UAAS,MAAM,EAAA;QACpBA,wBAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,2BAA2B,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAC7E,KAAC,CAAC;AACJ;;ACtPA,IAAA,gBAAA,IAAA,YAAA;AAqBE,IAAA,SAAA,gBAAA,CAAY,SAAoB,EAAE,cAA8B,EAAE,YAA0B,EAAE,iBAAoC,EAAA;AAChI,QAAA,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;AAC5B,QAAA,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;AACtC,QAAA,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;AAClC,QAAA,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;AAC5C,QAAA,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC,CAAC;KAC1E;IAMD,gBAAiB,CAAA,SAAA,CAAA,iBAAA,GAAjB,UAAkB,QAAkB,EAAA;AAClC,QAAA,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACrC,QAAA,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC;KAC1E,CAAA;IAQD,gBAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,OAA2B,EAAA;QACjC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACjD,CAAA;IAQD,gBAAO,CAAA,SAAA,CAAA,OAAA,GAAP,UAAQ,WAAyC,EAAA;AAC/C,QAAA,IAAI,WAAW,YAAYxE,cAAG,CAAC,OAAO,EAAE;AACtC,YAAA,WAAW,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AACxC,SAAA;AAED,QAAA,IAAI,oBAAoB,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;AAClD,QAAA,IAAI,SAAS,GAAG,WAAW,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAE5E,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,WAAW,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AAGpI,QAAA,IAAI,OAAO,GAAG,IAAI,WAAW,CAAC,WAAW,CAAC,OAAsC,EAAE,oBAAoB,EAAE,SAAS,CAAC,CAAC;AACnH,QAAA,IAAI,SAAS,GAAG,WAAW,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;AACvE,QAAA,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,mBAAmB,CAAC,OAAO,EAAE,CAAC,CAAC;AAEpE,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,IAAI,EAAE,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;QAEzE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAqB,CAAC;AAC9D,QAAA,IAAI,CAAC,QAAQ,GAAGA,cAAG,CAAC,sBAAsB,EAAE,CAAC;QAC7C,IAAI,CAAC,QAAQ,EAAE,CAAC;AAEhB,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;IAzEM,gBAAM,CAAA,MAAA,GAAG,CAACC,oCAAS,EAAE,cAAc,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC;IA0E/E,OAAC,gBAAA,CAAA;AAAA,CA7ED,EA6EC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7GD,IAAA,UAAA,IAAA,YAAA;IAaE,SAAY,UAAA,CAAA,OAAgB,EAAE,WAA8B,EAAA;AAC1D,QAAA2D,wBAAS,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,WAAW,CAAC,CAAC;KAChE;AAbD,IAAA,MAAA,CAAA,cAAA,CAAW,UAAM,EAAA,QAAA,EAAA;aAAjB,YAAsB,EAAA,OAAO,CAAC5D,cAAG,CAAC,OAAO,EAAE+C,mCAAiB,CAAC,CAAC,EAAE;;;AAAA,KAAA,CAAA,CAAA;AAEzD,IAAA,UAAA,CAAA,SAAS,GAA0B;AACxC,QAAA,IAAI,EAAE,WAAW;AACjB,QAAA,IAAI,EAAE,aAAa;KACpB,CAAA;IASH,OAAC,UAAA,CAAA;AAAA,CAhBD,EAgBC;;ACjBD,IAAA,OAAA,IAAA,YAAA;AAaE,IAAA,SAAA,OAAA,GAAA;AACE,QAAA,IAAI,CAAC,MAAM,GAAGa,wBAAS,CAAC,UAAU,CAAC,CAAC;KACrC;AAEO,IAAA,OAAA,CAAA,SAAA,CAAA,IAAI,GAAZ,UAAa,aAAqB,EAAE,OAAY,EAAA;QAC9C,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,aAAa,KAAK,SAAS,EAAE;YAC9C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5C,SAAA;AAAM,aAAA,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;AACjE,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACrD,SAAA;KACF,CAAA;IAMM,OAAO,CAAA,SAAA,CAAA,OAAA,GAAd,UAAe,IAAS,EAAA;AACtB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KACtB,CAAA;IAMM,OAAI,CAAA,SAAA,CAAA,IAAA,GAAX,UAAY,cAAkB,EAAA;AAC5B,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;KACnC,CAAA;AAKM,IAAA,OAAA,CAAA,SAAA,CAAA,QAAQ,GAAf,YAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KACvB,CAAA;AAKM,IAAA,OAAA,CAAA,SAAA,CAAA,QAAQ,GAAf,YAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KACvB,CAAA;AAKM,IAAA,OAAA,CAAA,SAAA,CAAA,MAAM,GAAb,YAAA;AACE,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KACrB,CAAA;AA5DM,IAAA,OAAA,CAAA,SAAS,GAA0B;AACxC,QAAA,IAAI,EAAE,WAAW;AACjB,QAAA,IAAI,EAAE,UAAU;KACjB,CAAC;IA0DJ,OAAC,OAAA,CAAA;AAAA,CA9DD,EA8DC;;ACtED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;AACrD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC7B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACzF,SAAS;AACT,QAAQ,OAAO,CAAC,CAAC;AACjB,MAAK;AACL,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC3C;;AChCgB,SAAA,OAAO,CAAI,MAAe,EAAE,OAII,EAAA;AAJJ,IAAA,IAAA,OAAA,KAAA,KAAA,CAAA,EAAA,EAAA,OAAA,GAAA,EAIvC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAC,CAAA,EAAA;IAE9C,IAAI,QAAQ,GAAG,KAAK,CAAC;AAErB,IAAA,OAAO,GACL,QAAA,CAAA,EAAA,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,EAAE,EACZ,OAAO,EAAE,IAAI,EACV,EAAA,OAAO,CACX,CAAC;AAEF,IAAA,SAAS,IAAI,GAAA;AACX,QAAA,IAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAEzB,QAAA,IAAM,KAAK,GAAG,OAAO,KAAK,IAAI,KAAK,EAAE,OAAO,YAAY,QAAQ,CAAC;YAC/D,CAAE,OAAe,CAAC,MAAM,IAAK,OAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAE3D,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,CAAC,KAAK,IAAI,QAAQ,EAAE;AAC3C,YAAA,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACjC,SAAA;QAED,OAAO,IAAI,OAAO,CAAC,UAAA,EAAE,EAAI,EAAA,OAAA,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA,EAAA,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACvE;IAED,OAAO,OAAO,CAAC,IAAI,CAAC;QAClB,IAAI,OAAO,CACT,UAAC,CAAC,EAAE,EAAE,EAAA,EAAK,OAAA,UAAU,CAAC,YAAA;YACpB,QAAQ,GAAG,IAAI,CAAC;AAChB,YAAA,EAAE,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,GAAG,mBAAmB,GAAG,qBAAqB,CAAC,CAAC,CAAC;AAC/E,SAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA,EAAA,CACpB;AACD,QAAA,IAAI,EAAE;AACP,KAAA,CAAe,CAAC;AACnB,CAAC;AAEe,SAAA,sBAAsB,CAAC,QAAgB,EAAE,OAIxD,EAAA;AACC,IAAA,OAAO,OAAO,CAAC,YAAM,EAAA,OAAA,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAY,CAA3C,EAA2C,EAAE,OAAO,CAAC,CAAC;AAC7E,CAAC;AAEe,SAAA,uBAAuB,CAAC,QAAgB,EAAE,OAIzD,EAAA;AACC,IAAA,OAAO,OAAO,CAAC,YAAM,EAAA,OAAA,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAnC,EAAmC,EAAE,OAAO,CAAC,CAAC;AACrE;;ACjDA,IAAA,cAAA,IAAA,YAAA;AAAA,IAAA,SAAA,cAAA,GAAA;KAIC;IAHe,cAAa,CAAA,aAAA,GAA3B,UAAqC,SAAiC,EAAA;AAAjC,QAAA,IAAA,SAAA,KAAA,KAAA,CAAA,EAAA,EAAA,SAAiC,GAAA,EAAA,CAAA,EAAA;QACpE,OAAO,IAAI,eAAe,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;KACvD,CAAA;IACH,OAAC,cAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAED,IAAA,eAAA,IAAA,YAAA;AAAA,IAAA,SAAA,eAAA,GAAA;QASU,IAAS,CAAA,SAAA,GAA8C,EAAE,CAAC;KA8HnE;IAzHQ,eAAS,CAAA,SAAA,CAAA,SAAA,GAAhB,UAAiB,OAAgB,EAAA;AAC/B,QAAA,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;KAC5C,CAAA;IAEM,eAAS,CAAA,SAAA,CAAA,SAAA,GAAhB,UAAiB,SAAuD,EAAA;AACtE,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;KAC5B,CAAA;IAEM,eAAa,CAAA,SAAA,CAAA,aAAA,GAApB,UAAqB,SAA4B,EAAA;AAC/C,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;IAEM,eAAM,CAAA,SAAA,CAAA,MAAA,GAAb,UAAc,IAAY,EAAA;AACxB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;IAEM,eAAO,CAAA,SAAA,CAAA,OAAA,GAAd,UAAe,cAAkB,EAAA;AAC/B,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;AACrC,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;AAEM,IAAA,eAAA,CAAA,SAAA,CAAA,uBAAuB,GAA9B,YAAA;QACE,IAAI,CAAC,iBAAiB,EAAE,CAAC;AACzB,QAAA,OAAO,IAAI,CAAC;KACb,CAAA;IAEM,eAAM,CAAA,SAAA,CAAA,MAAA,GAAb,UAAc,SAA4E,EAAA;QAA1F,IA0BC,KAAA,GAAA,IAAA,CAAA;QAzBC,OAAO,SAAS,CAAC,UAAC,OAAwB,EAAA;AACxC,YAAA,OAAO,OAAO,CAAC,OAAO,CAAC,KAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,YAAA;gBACnD,IAAI,KAAI,CAAC,SAAS,EAAE;oBAClB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,KAAI,CAAC,SAAS,CAAC,CAAC;AAC7C,iBAAA;AAED,gBAAA,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,YAAA;oBAC1B,KAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;oBAC1C,KAAI,CAAC,IAAI,CAAC,SAAS,GAAG,KAAI,CAAC,IAAI,CAAC;oBAEhC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAI,CAAC,IAAI,CAAC,CAAC;AAErC,oBAAA,OAAO,OAAO,CAAC,OAAO,CAAC,KAAI,CAAC,cAAc,EAAE,KAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAA;AAC1D,wBAAA,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;wBAC7B,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,IAAI,CAAC,iBAA4B,CAAC;AAEtD,wBAAA,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;AACnC,4BAAA,KAAI,CAAC,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,yBAAA;wBAED,OAAO,IAAI,OAAO,CAAC,UAAA,OAAO,EAAI,EAAA,OAAA,UAAU,CAAC,YAAA,EAAM,OAAA,OAAO,EAAE,GAAA,EAAE,CAAC,CAAC,CAAA,EAAA,CAAkB,CAAC;AACjF,qBAAC,CAAC,CAAC;AACL,iBAAC,CAAC,CAAC;AACL,aAAC,CAAC,CAAC;AACL,SAAC,CAAC,CAAC;KACJ,CAAA;AAEM,IAAA,eAAA,CAAA,SAAA,CAAA,OAAO,GAAd,YAAA;QACE,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;AAC1D,YAAA,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAC;AACH,SAAA;AAED,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACzB,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;AAEvB,QAAA,OAAQ,IAAI,CAAC,IAAI,CAAC,UAAmB,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC9D,CAAA;AAEO,IAAA,eAAA,CAAA,SAAA,CAAA,iBAAiB,GAAzB,YAAA;QAAA,IAmCC,KAAA,GAAA,IAAA,CAAA;AAjCC,QAAA,IAAM,aAAa,GAAGkB,sBAAI,CAAC,SAAS,CAAC,IAAI,CAAC;AAE1C,QAAAA,sBAAI,CAAC,SAAS,CAAC,IAAI,GAAG,YAAA,GAAQ,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,UAAA,cAAc,EAAI,EAAA,OAAA,IAAI,OAAO,CAAC,UAAA,OAAO,EAAA;AAC/C,YAAAA,sBAAI,CAAC,SAAS,CAAC,IAAI,GAAG,aAAa,CAAC;YACpC,IAAI,cAAc,KAAK,SAAS,EAAE;AAChC,gBAAA,KAAI,CAAC,cAAc,GAAG,cAAc,CAAC;AACtC,aAAA;YACD,KAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAI,CAAC,cAAc,CAAC,CAAC;YACxC,UAAU,CAAC,YAAM,EAAA,OAAA,OAAO,EAAE,GAAA,EAAE,CAAC,CAAC,CAAC;SAChC,CAAC,CAP4B,EAO5B,CAAC;AAGH,QAAA,IAAM,iBAAiB,GAAGA,sBAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;AAElD,QAAAA,sBAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,YAAA,GAAQ,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,YAAA,EAAM,OAAA,IAAI,OAAO,CAAC,UAAA,OAAO,EAAA;AACvC,YAAAA,sBAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,iBAAiB,CAAC;AAC5C,YAAA,KAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACzB,UAAU,CAAC,YAAM,EAAA,OAAA,OAAO,EAAE,GAAA,EAAE,CAAC,CAAC,CAAC;SAChC,CAAC,CAJoB,EAIpB,CAAC;QAGH,IAAI,CAAC,QAAQ,GAAG,YAAA,EAAM,OAAA,IAAI,OAAO,CAAC,UAAA,OAAO,EAAA;AACvC,YAAA,KAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACzB,UAAU,CAAC,YAAM,EAAA,OAAA,OAAO,EAAE,GAAA,EAAE,CAAC,CAAC,CAAC;SAChC,CAAC,CAHoB,EAGpB,CAAC;QAGH,IAAI,CAAC,MAAM,GAAG,YAAA,EAAM,OAAA,IAAI,OAAO,CAAC,UAAA,OAAO,EAAA;AACrC,YAAA,KAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACvB,UAAU,CAAC,YAAM,EAAA,OAAA,OAAO,EAAE,GAAA,EAAE,CAAC,CAAC,CAAC;SAChC,CAAC,CAHkB,EAGlB,CAAC;KACJ,CAAA;AAEM,IAAA,eAAA,CAAA,SAAA,CAAA,cAAc,GAArB,UAAsB,QAAgB,EAAE,OAIvC,EAAA;QAJD,IAMC,KAAA,GAAA,IAAA,CAAA;AADC,QAAA,OAAO,OAAO,CAAC,YAAA,EAAM,OAAA,KAAI,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAY,CAAA,EAAA,EAAE,OAAO,CAAC,CAAC;KAChF,CAAA;AAEM,IAAA,eAAA,CAAA,SAAA,CAAA,eAAe,GAAtB,UAAuB,QAAgB,EAAE,OAIxC,EAAA;QAJD,IAMC,KAAA,GAAA,IAAA,CAAA;AADC,QAAA,OAAO,OAAO,CAAC,YAAA,EAAM,OAAA,KAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAwB,CAAA,EAAA,EAAE,OAAO,CAAC,CAAC;KAC/F,CAAA;IACH,OAAC,eAAA,CAAA;AAAD,CAAC,EAAA;;AChJK,SAAU,SAAS,CAAC,MAA8B,EAAA;IACtD,MAAM,CAAC,eAAe,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AAChD;;;;;;;;;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACz3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzk4OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"vendor-bundle.js","sourcesContent":[null,null,null,null,null,null,"/* eslint-disable @typescript-eslint/ban-types */\r\nimport * as TheLogManager from 'aurelia-logging';\r\nimport { ViewEngine, HtmlBehaviorResource } from 'aurelia-templating';\r\nimport { join } from 'aurelia-path';\r\nimport type { Container } from 'aurelia-dependency-injection';\r\nimport type { Aurelia } from './aurelia';\r\nimport type { Loader } from 'aurelia-loader';\r\n\r\nconst logger = TheLogManager.getLogger('aurelia');\r\nconst extPattern = /\\.[^/.]+$/;\r\n\r\nfunction runTasks(config: FrameworkConfiguration, tasks) {\r\n let current;\r\n let next = () => {\r\n current = tasks.shift();\r\n if (current) {\r\n return Promise.resolve(current(config)).then(next);\r\n }\r\n\r\n return Promise.resolve();\r\n };\r\n\r\n return next();\r\n}\r\n\r\nexport interface FrameworkPluginInfo {\r\n moduleId?: string;\r\n resourcesRelativeTo?: string[];\r\n configure?: (config: FrameworkConfiguration, pluginConfig?: any) => any;\r\n config?: any;\r\n}\r\n\r\nfunction loadPlugin(fwConfig: FrameworkConfiguration, loader: Loader, info: FrameworkPluginInfo) {\r\n logger.debug(`Loading plugin ${info.moduleId}.`);\r\n if (typeof info.moduleId === 'string') {\r\n fwConfig.resourcesRelativeTo = info.resourcesRelativeTo;\r\n\r\n let id = info.moduleId; // General plugins installed/configured by the end user.\r\n\r\n if (info.resourcesRelativeTo.length > 1 ) { // In case of bootstrapper installed plugins like `aurelia-templating-resources` or `aurelia-history-browser`.\r\n return loader.normalize(info.moduleId, info.resourcesRelativeTo[1])\r\n .then(normalizedId => _loadPlugin(normalizedId));\r\n }\r\n\r\n return _loadPlugin(id);\r\n } else if (typeof info.configure === 'function') {\r\n if (fwConfig.configuredPlugins.indexOf(info.configure) !== -1) {\r\n return Promise.resolve();\r\n }\r\n fwConfig.configuredPlugins.push(info.configure);\r\n // use info.config || {} to keep behavior consistent with loading from string\r\n return Promise.resolve(info.configure.call(null, fwConfig, info.config || {}));\r\n }\r\n throw new Error(invalidConfigMsg(info.moduleId || info.configure, 'plugin'));\r\n\r\n function _loadPlugin(moduleId) {\r\n return loader.loadModule(moduleId).then(m => { // eslint-disable-line consistent-return\r\n if ('configure' in m) {\r\n if (fwConfig.configuredPlugins.indexOf(m.configure) !== -1) {\r\n return Promise.resolve();\r\n }\r\n return Promise.resolve(m.configure(fwConfig, info.config || {})).then(() => {\r\n fwConfig.configuredPlugins.push(m.configure);\r\n fwConfig.resourcesRelativeTo = null;\r\n logger.debug(`Configured plugin ${info.moduleId}.`);\r\n });\r\n }\r\n\r\n fwConfig.resourcesRelativeTo = null;\r\n logger.debug(`Loaded plugin ${info.moduleId}.`);\r\n });\r\n }\r\n}\r\n\r\nfunction loadResources(aurelia, resourcesToLoad, appResources) {\r\n // if devs want to go all in static, and remove loader\r\n // the code after this fucntion shouldn't run\r\n // add a check to make sure it only runs when there is something to do so\r\n if (Object.keys(resourcesToLoad).length === 0) {\r\n return Promise.resolve();\r\n }\r\n let viewEngine = aurelia.container.get(ViewEngine);\r\n\r\n return Promise.all(Object.keys(resourcesToLoad).map(n => _normalize(resourcesToLoad[n])))\r\n .then(loads => {\r\n let names = [];\r\n let importIds = [];\r\n\r\n loads.forEach(l => {\r\n names.push(undefined);\r\n importIds.push(l.importId);\r\n });\r\n\r\n return viewEngine.importViewResources(importIds, names, appResources);\r\n });\r\n\r\n function _normalize(load) {\r\n let moduleId = load.moduleId;\r\n let ext = getExt(moduleId);\r\n\r\n if (isOtherResource(moduleId)) {\r\n moduleId = removeExt(moduleId);\r\n }\r\n\r\n return aurelia.loader.normalize(moduleId, load.relativeTo)\r\n .then(normalized => {\r\n return {\r\n name: load.moduleId,\r\n importId: isOtherResource(load.moduleId) ? addOriginalExt(normalized, ext) : normalized\r\n };\r\n });\r\n }\r\n\r\n function isOtherResource(name) {\r\n let ext = getExt(name);\r\n if (!ext) return false;\r\n if (ext === '') return false;\r\n if (ext === '.js' || ext === '.ts') return false;\r\n return true;\r\n }\r\n\r\n function removeExt(name) {\r\n return name.replace(extPattern, '');\r\n }\r\n\r\n function addOriginalExt(normalized, ext) {\r\n return removeExt(normalized) + '.' + ext;\r\n }\r\n}\r\n\r\nfunction getExt(name: string) { // eslint-disable-line consistent-return\r\n let match = name.match(extPattern);\r\n if (match && match.length > 0) {\r\n return (match[0].split('.'))[1];\r\n }\r\n}\r\n\r\nfunction loadBehaviors(config: FrameworkConfiguration) {\r\n return Promise.all(config.behaviorsToLoad.map(m => m.load(config.container, m.target))).then(() => {\r\n config.behaviorsToLoad = null;\r\n });\r\n}\r\n\r\nfunction assertProcessed(plugins: FrameworkConfiguration) {\r\n if (plugins.processed) {\r\n throw new Error('This config instance has already been applied. To load more plugins or global resources, create a new FrameworkConfiguration instance.');\r\n }\r\n}\r\n\r\nfunction invalidConfigMsg(cfg: any, type: string) {\r\n return `Invalid ${type} [${cfg}], ${type} must be specified as functions or relative module IDs.`;\r\n}\r\n\r\n/**\r\n * Manages configuring the aurelia framework instance.\r\n */\r\nexport class FrameworkConfiguration {\r\n /**\r\n * The root DI container used by the application.\r\n */\r\n container: Container;\r\n\r\n /**\r\n * The aurelia instance.\r\n */\r\n aurelia: Aurelia;\r\n\r\n /**\r\n * Plugin / feature loading instruction\r\n * @type {FrameworkPluginInfo[]}\r\n *\r\n * @internal\r\n */\r\n info: FrameworkPluginInfo[];\r\n\r\n /** @internal */\r\n processed: boolean;\r\n\r\n /** @internal */\r\n preTasks: any[];\r\n\r\n /** @internal */\r\n postTasks: any[];\r\n\r\n /** @internal */\r\n behaviorsToLoad: any[];\r\n\r\n /** @internal */\r\n configuredPlugins: any[];\r\n\r\n /** @internal */\r\n resourcesToLoad: Record;\r\n\r\n /** @internal */\r\n bootstrapperName: string;\r\n\r\n /** @internal */\r\n resourcesRelativeTo: string[];\r\n\r\n /**\r\n * Creates an instance of FrameworkConfiguration.\r\n * @param aurelia An instance of Aurelia.\r\n */\r\n constructor(aurelia: Aurelia) {\r\n this.aurelia = aurelia;\r\n this.container = aurelia.container;\r\n this.info = [];\r\n this.processed = false;\r\n this.preTasks = [];\r\n this.postTasks = [];\r\n /**\r\n * Custom element's metadata queue for loading view factory\r\n * @type {HtmlBehaviorResource[]}\r\n */\r\n this.behaviorsToLoad = [];\r\n /**\r\n * Plugin configure functions temporary cache for avoid duplicate calls\r\n * @type {Function[]}\r\n */\r\n this.configuredPlugins = [];\r\n this.resourcesToLoad = {};\r\n this.preTask(() => aurelia.loader.normalize('aurelia-bootstrapper', undefined)\r\n .then(name => this.bootstrapperName = name));\r\n this.postTask(() => loadResources(aurelia, this.resourcesToLoad, aurelia.resources));\r\n }\r\n\r\n /**\r\n * Adds an existing object to the framework's dependency injection container.\r\n * @param type The object type of the dependency that the framework will inject.\r\n * @param instance The existing instance of the dependency that the framework will inject.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n instance(type: any, instance: any): FrameworkConfiguration {\r\n this.container.registerInstance(type, instance);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a singleton to the framework's dependency injection container.\r\n * @param type The object type of the dependency that the framework will inject.\r\n * @param implementation The constructor function of the dependency that the framework will inject.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n singleton(type: any, implementation?: Function): FrameworkConfiguration {\r\n this.container.registerSingleton(type, implementation as any);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a transient to the framework's dependency injection container.\r\n * @param type The object type of the dependency that the framework will inject.\r\n * @param implementation The constructor function of the dependency that the framework will inject.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n transient(type: any, implementation?: Function): FrameworkConfiguration {\r\n this.container.registerTransient(type, implementation as any);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds an async function that runs before the plugins are run.\r\n * @param task The function to run before start.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n preTask(task: Function): FrameworkConfiguration {\r\n assertProcessed(this);\r\n this.preTasks.push(task);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds an async function that runs after the plugins are run.\r\n * @param task The function to run after start.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n postTask(task: Function): FrameworkConfiguration {\r\n assertProcessed(this);\r\n this.postTasks.push(task);\r\n return this;\r\n }\r\n\r\n /**\r\n * Configures an internal feature plugin before Aurelia starts.\r\n * @param plugin The folder for the internal plugin to configure (expects an index.js in that folder).\r\n * @param config The configuration for the specified plugin.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n feature(plugin: string | ((config: FrameworkConfiguration, pluginConfig?: any) => any), config: any = {}): FrameworkConfiguration {\r\n switch (typeof plugin) {\r\n case 'string':\r\n let hasIndex = /\\/index$/i.test(plugin);\r\n let moduleId = hasIndex || getExt(plugin) ? plugin : plugin + '/index';\r\n let root = hasIndex ? plugin.slice(0, -6) : plugin;\r\n this.info.push({ moduleId, resourcesRelativeTo: [root, ''], config });\r\n break;\r\n // return this.plugin({ moduleId, resourcesRelativeTo: [root, ''], config });\r\n case 'function':\r\n this.info.push({ configure: plugin, config: config || {} });\r\n break;\r\n default:\r\n throw new Error(invalidConfigMsg(plugin, 'feature'));\r\n }\r\n return this;\r\n // return this.plugin(plugin, config);\r\n }\r\n\r\n /**\r\n * Adds globally available view resources to be imported into the Aurelia framework.\r\n * @param resources The relative module id to the resource. (Relative to the plugin's installer.)\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n globalResources(resources: string | Function | Array): FrameworkConfiguration {\r\n assertProcessed(this);\r\n\r\n // eslint-disable-next-line prefer-rest-params\r\n let toAdd = Array.isArray(resources) ? resources : arguments;\r\n let resource;\r\n let resourcesRelativeTo = this.resourcesRelativeTo || ['', ''];\r\n\r\n for (let i = 0, ii = toAdd.length; i < ii; ++i) {\r\n resource = toAdd[i];\r\n switch (typeof resource) {\r\n case 'string':\r\n let parent = resourcesRelativeTo[0];\r\n let grandParent = resourcesRelativeTo[1];\r\n let name = resource;\r\n\r\n if ((resource.startsWith('./') || resource.startsWith('../')) && parent !== '') {\r\n name = join(parent, resource);\r\n }\r\n\r\n this.resourcesToLoad[name] = { moduleId: name, relativeTo: grandParent };\r\n break;\r\n case 'function':\r\n let meta = this.aurelia.resources.autoRegister(this.container, resource);\r\n if (meta instanceof HtmlBehaviorResource && meta.elementName !== null) {\r\n if (this.behaviorsToLoad.push(meta) === 1) {\r\n this.postTask(() => loadBehaviors(this));\r\n }\r\n }\r\n break;\r\n default:\r\n throw new Error(invalidConfigMsg(resource, 'resource'));\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Renames a global resource that was imported.\r\n * @param resourcePath The path to the resource.\r\n * @param newName The new name.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n globalName(resourcePath: string, newName: string): FrameworkConfiguration {\r\n assertProcessed(this);\r\n this.resourcesToLoad[resourcePath] = { moduleId: newName, relativeTo: '' };\r\n return this;\r\n }\r\n\r\n /**\r\n * Configures an external, 3rd party plugin before Aurelia starts.\r\n * @param plugin The ID of the 3rd party plugin to configure.\r\n * @param pluginConfig The configuration for the specified plugin.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n plugin(\r\n plugin: string | ((frameworkConfig: FrameworkConfiguration) => any) | FrameworkPluginInfo,\r\n pluginConfig?: any\r\n ): FrameworkConfiguration {\r\n assertProcessed(this);\r\n\r\n let info: FrameworkPluginInfo;\r\n switch (typeof plugin) {\r\n case 'string':\r\n info = { moduleId: plugin, resourcesRelativeTo: [plugin, ''], config: pluginConfig || {} };\r\n break;\r\n case 'function':\r\n info = { configure: plugin, config: pluginConfig || {} };\r\n break;\r\n default:\r\n throw new Error(invalidConfigMsg(plugin, 'plugin'));\r\n }\r\n this.info.push(info);\r\n return this;\r\n }\r\n\r\n /** @internal */\r\n _addNormalizedPlugin(name, config?) {\r\n let plugin = { moduleId: name, resourcesRelativeTo: [name, ''], config: config || {} };\r\n this.info.push(plugin);\r\n\r\n this.preTask(() => {\r\n let relativeTo = [name, this.bootstrapperName];\r\n plugin.moduleId = name;\r\n plugin.resourcesRelativeTo = relativeTo;\r\n return Promise.resolve();\r\n });\r\n\r\n return this;\r\n }\r\n\r\n // Default configuration helpers\r\n // Note: Please do NOT add PLATFORM.moduleName() around those module names.\r\n // Those functions are not guaranteed to be called, they are here to faciliate\r\n // common configurations. If they are not called, we don't want to include a\r\n // static dependency on those modules.\r\n // Including those modules in the bundle or not is a decision that must be\r\n // taken by the bundling tool, at build time.\r\n\r\n /**\r\n * Plugs in the default binding language from aurelia-templating-binding.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n defaultBindingLanguage(): FrameworkConfiguration {\r\n return this._addNormalizedPlugin('aurelia-templating-binding');\r\n }\r\n\r\n /**\r\n * Plugs in the router from aurelia-templating-router.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n router(): FrameworkConfiguration {\r\n return this._addNormalizedPlugin('aurelia-templating-router');\r\n }\r\n\r\n /**\r\n * Plugs in the default history implementation from aurelia-history-browser.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n history(): FrameworkConfiguration {\r\n return this._addNormalizedPlugin('aurelia-history-browser');\r\n }\r\n\r\n /**\r\n * Plugs in the default templating resources (if, repeat, show, compose, etc.) from aurelia-templating-resources.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n defaultResources(): FrameworkConfiguration {\r\n return this._addNormalizedPlugin('aurelia-templating-resources');\r\n }\r\n\r\n /**\r\n * Plugs in the event aggregator from aurelia-event-aggregator.\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n eventAggregator(): FrameworkConfiguration {\r\n return this._addNormalizedPlugin('aurelia-event-aggregator');\r\n }\r\n\r\n /**\r\n * Sets up a basic Aurelia configuration. This is equivalent to calling `.defaultBindingLanguage().defaultResources().eventAggregator();`\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n basicConfiguration(): FrameworkConfiguration {\r\n return this.defaultBindingLanguage().defaultResources().eventAggregator();\r\n }\r\n\r\n /**\r\n * Sets up the standard Aurelia configuration. This is equivalent to calling `.defaultBindingLanguage().defaultResources().eventAggregator().history().router();`\r\n * @return Returns the current FrameworkConfiguration instance.\r\n */\r\n standardConfiguration(): FrameworkConfiguration {\r\n return this.basicConfiguration().history().router();\r\n }\r\n\r\n /**\r\n * Plugs in the ConsoleAppender and sets the log level to debug.\r\n * @param level The log level (none/error/warn/info/debug), default to 'debug'.\r\n * @return {FrameworkConfiguration} Returns the current FrameworkConfiguration instance.\r\n */\r\n developmentLogging(level?: string): FrameworkConfiguration {\r\n let logLevel = level ? TheLogManager.logLevel[level] : undefined;\r\n\r\n if (logLevel === undefined) {\r\n logLevel = TheLogManager.logLevel.debug;\r\n }\r\n\r\n this.preTask(() => {\r\n return this.aurelia.loader.normalize('aurelia-logging-console', this.bootstrapperName).then(name => {\r\n return this.aurelia.loader.loadModule(name).then(m => {\r\n TheLogManager.addAppender(new m.ConsoleAppender());\r\n TheLogManager.setLevel(logLevel);\r\n });\r\n });\r\n });\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Loads and configures the plugins registered with this instance.\r\n * @return Returns a promise which resolves when all plugins are loaded and configured.\r\n */\r\n apply(): Promise {\r\n if (this.processed) {\r\n return Promise.resolve();\r\n }\r\n\r\n return runTasks(this, this.preTasks).then(() => {\r\n let loader = this.aurelia.loader;\r\n let info = this.info;\r\n let current;\r\n\r\n let next = () => {\r\n current = info.shift();\r\n if (current) {\r\n return loadPlugin(this, loader, current).then(next);\r\n }\r\n\r\n this.processed = true;\r\n this.configuredPlugins = null;\r\n return Promise.resolve();\r\n };\r\n\r\n return next().then(() => runTasks(this, this.postTasks));\r\n });\r\n }\r\n}\r\n\r\n/** @internal */\r\ndeclare module 'aurelia-templating' {\r\n interface HtmlBehaviorResource {\r\n elementName: string | null;\r\n }\r\n}\r\n","import * as TheLogManager from 'aurelia-logging';\r\nimport {Container} from 'aurelia-dependency-injection';\r\nimport {Loader} from 'aurelia-loader';\r\nimport {BindingLanguage, ViewSlot, ViewResources, TemplatingEngine, CompositionTransaction, View, CompositionContext} from 'aurelia-templating';\r\nimport {DOM, PLATFORM} from 'aurelia-pal';\r\nimport {relativeToFile} from 'aurelia-path';\r\nimport {FrameworkConfiguration} from './framework-configuration';\r\n\r\nfunction preventActionlessFormSubmit() {\r\n DOM.addEventListener('submit', evt => {\r\n const target = evt.target as HTMLFormElement;\r\n const action = target.action;\r\n\r\n if (target.tagName.toLowerCase() === 'form' && !action) {\r\n evt.preventDefault();\r\n }\r\n }, false);\r\n}\r\n\r\n/**\r\n * The framework core that provides the main Aurelia object.\r\n */\r\nexport class Aurelia {\r\n /**\r\n * The DOM Element that Aurelia will attach to.\r\n */\r\n host: Element;\r\n /**\r\n /**\r\n * The loader used by the application.\r\n */\r\n loader: Loader;\r\n /**\r\n * The root DI container used by the application.\r\n */\r\n container: Container;\r\n /**\r\n * The global view resources used by the application.\r\n */\r\n resources: ViewResources;\r\n\r\n /**\r\n * The configuration used during application startup.\r\n */\r\n use: FrameworkConfiguration;\r\n\r\n /** @internal */\r\n private logger: TheLogManager.Logger;\r\n\r\n /** @internal */\r\n _started: Promise;\r\n\r\n /** @internal */\r\n private hostConfigured: boolean;\r\n\r\n /** @internal */\r\n private root: View;\r\n\r\n /** @internal */\r\n private configModuleId: string;\r\n\r\n /** @internal */\r\n private hostSlot: ViewSlot;\r\n\r\n /**\r\n * Creates an instance of Aurelia.\r\n * @param loader The loader for this Aurelia instance to use. If a loader is not specified, Aurelia will use the loader type specified by PLATFORM.Loader.\r\n * @param container The dependency injection container for this Aurelia instance to use. If a container is not specified, Aurelia will create an empty, global container.\r\n * @param resources The resource registry for this Aurelia instance to use. If a resource registry is not specified, Aurelia will create an empty registry.\r\n */\r\n constructor(loader?: Loader, container?: Container, resources?: ViewResources) {\r\n this.loader = loader || new PLATFORM.Loader();\r\n this.container = container || (new Container()).makeGlobal();\r\n this.resources = resources || new ViewResources();\r\n this.use = new FrameworkConfiguration(this);\r\n this.logger = TheLogManager.getLogger('aurelia');\r\n this.hostConfigured = false;\r\n this.host = null;\r\n\r\n this.use.instance(Aurelia, this);\r\n this.use.instance(Loader, this.loader);\r\n this.use.instance(ViewResources, this.resources);\r\n }\r\n\r\n /**\r\n * Loads plugins, then resources, and then starts the Aurelia instance.\r\n * @return Returns a Promise with the started Aurelia instance.\r\n */\r\n start(): Promise {\r\n if (this._started) {\r\n return this._started;\r\n }\r\n\r\n this.logger.info('Aurelia Starting');\r\n return this._started = this.use.apply().then(() => {\r\n preventActionlessFormSubmit();\r\n\r\n if (!this.container.hasResolver(BindingLanguage)) {\r\n let message = 'You must configure Aurelia with a BindingLanguage implementation.';\r\n this.logger.error(message);\r\n throw new Error(message);\r\n }\r\n\r\n this.logger.info('Aurelia Started');\r\n let evt = DOM.createCustomEvent('aurelia-started', { bubbles: true, cancelable: true });\r\n DOM.dispatchEvent(evt);\r\n return this;\r\n });\r\n }\r\n\r\n /**\r\n * Enhances the host's existing elements with behaviors and bindings.\r\n * @param bindingContext A binding context for the enhanced elements.\r\n * @param applicationHost The DOM object that Aurelia will enhance.\r\n * @return Returns a Promise for the current Aurelia instance.\r\n */\r\n enhance(bindingContext: object = {}, applicationHost: string | Element = null): Promise {\r\n this._configureHost(applicationHost || DOM.querySelectorAll('body')[0]);\r\n\r\n return new Promise(resolve => {\r\n let engine = this.container.get(TemplatingEngine) as TemplatingEngine;\r\n this.root = engine.enhance({container: this.container, element: this.host, resources: this.resources, bindingContext: bindingContext});\r\n this.root.attached();\r\n this._onAureliaComposed();\r\n resolve(this);\r\n });\r\n }\r\n\r\n /**\r\n * Instantiates the root component and adds it to the DOM.\r\n * @param root The root component to load upon bootstrap.\r\n * @param applicationHost The DOM object that Aurelia will attach to.\r\n * @return Returns a Promise of the current Aurelia instance.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/ban-types\r\n setRoot(root: string | Function = null, applicationHost: string | Element = null): Promise {\r\n let instruction = {} as CompositionContext;\r\n\r\n if (this.root && this.root.viewModel && this.root.viewModel.router) {\r\n this.root.viewModel.router.deactivate();\r\n this.root.viewModel.router.reset();\r\n }\r\n\r\n this._configureHost(applicationHost);\r\n\r\n let engine = this.container.get(TemplatingEngine) as TemplatingEngine;\r\n let transaction = this.container.get(CompositionTransaction);\r\n delete (transaction as any).initialComposition;\r\n\r\n if (!root) {\r\n if (this.configModuleId) {\r\n root = relativeToFile('./app', this.configModuleId);\r\n } else {\r\n root = 'app';\r\n }\r\n }\r\n\r\n instruction.viewModel = root;\r\n instruction.container = instruction.childContainer = this.container;\r\n instruction.viewSlot = this.hostSlot;\r\n instruction.host = this.host;\r\n\r\n return engine.compose(instruction).then((r: View) => {\r\n this.root = r;\r\n instruction.viewSlot.attached();\r\n this._onAureliaComposed();\r\n return this;\r\n });\r\n }\r\n\r\n /** @internal */\r\n _configureHost(applicationHost) {\r\n if (this.hostConfigured) {\r\n return;\r\n }\r\n applicationHost = applicationHost || this.host;\r\n\r\n if (!applicationHost || typeof applicationHost === 'string') {\r\n this.host = DOM.getElementById(applicationHost || 'applicationHost');\r\n } else {\r\n this.host = applicationHost;\r\n }\r\n\r\n if (!this.host) {\r\n throw new Error('No applicationHost was specified.');\r\n }\r\n\r\n this.hostConfigured = true;\r\n (this.host as any).aurelia = this;\r\n this.hostSlot = new ViewSlot(this.host, true);\r\n this.hostSlot.transformChildNodesIntoView();\r\n this.container.registerInstance(DOM.boundary, this.host);\r\n }\r\n\r\n /** @internal */\r\n _onAureliaComposed() {\r\n let evt = DOM.createCustomEvent('aurelia-composed', { bubbles: true, cancelable: true });\r\n setTimeout(() => DOM.dispatchEvent(evt), 1);\r\n }\r\n}\r\n\r\n/** @internal */\r\ndeclare module 'aurelia-templating' {\r\n interface View {\r\n viewModel: any;\r\n }\r\n}\r\n","import { DOM, PLATFORM } from 'aurelia-pal';\nimport { BrowserHistory } from './browser-history';\nimport { AnchorEventInfo } from './interfaces';\n\n/**\n * Class responsible for handling interactions that should trigger browser history navigations.\n */\nexport class LinkHandler {\n /**\n * Activate the instance.\n *\n * @param history The BrowserHistory instance that navigations should be dispatched to.\n */\n activate(history: BrowserHistory): void {/**/}\n\n /**\n * Deactivate the instance. Event handlers and other resources should be cleaned up here.\n */\n deactivate(): void {/**/}\n}\n\n/**\n * The default LinkHandler implementation. Navigations are triggered by click events on\n * anchor elements with relative hrefs when the history instance is using pushstate.\n */\nexport class DefaultLinkHandler extends LinkHandler {\n\n /**@internal */\n handler: (e: Event) => void;\n\n /**@internal */\n history: BrowserHistory;\n /**\n * Creates an instance of DefaultLinkHandler.\n */\n constructor() {\n super();\n\n this.handler = (e) => {\n let { shouldHandleEvent, href } = DefaultLinkHandler.getEventInfo(e);\n\n if (shouldHandleEvent) {\n e.preventDefault();\n this.history.navigate(href);\n }\n };\n }\n\n /**\n * Activate the instance.\n *\n * @param history The BrowserHistory instance that navigations should be dispatched to.\n */\n activate(history: BrowserHistory): void {\n if (history._hasPushState) {\n this.history = history;\n DOM.addEventListener('click', this.handler, true);\n }\n }\n\n /**\n * Deactivate the instance. Event handlers and other resources should be cleaned up here.\n */\n deactivate(): void {\n DOM.removeEventListener('click', this.handler, true);\n }\n\n /**\n * Gets the href and a \"should handle\" recommendation, given an Event.\n *\n * @param event The Event to inspect for target anchor and href.\n */\n static getEventInfo(event: Event): AnchorEventInfo {\n let $event = event as MouseEvent;\n let info = {\n shouldHandleEvent: false,\n href: null,\n anchor: null\n };\n\n let target = DefaultLinkHandler.findClosestAnchor($event.target as Element);\n if (!target || !DefaultLinkHandler.targetIsThisWindow(target)) {\n return info;\n }\n\n if (hasAttribute(target, 'download')\n || hasAttribute(target, 'router-ignore')\n || hasAttribute(target, 'data-router-ignore')\n ) {\n return info;\n }\n\n if ($event.altKey || $event.ctrlKey || $event.metaKey || $event.shiftKey) {\n return info;\n }\n\n let href = target.getAttribute('href');\n info.anchor = target;\n info.href = href;\n\n let leftButtonClicked = $event.which === 1;\n let isRelative = href && !(href.charAt(0) === '#' || (/^[a-z]+:/i).test(href));\n\n info.shouldHandleEvent = leftButtonClicked && isRelative;\n return info;\n }\n\n /**\n * Finds the closest ancestor that's an anchor element.\n *\n * @param el The element to search upward from.\n * @returns The link element that is the closest ancestor.\n */\n static findClosestAnchor(el: Element): Element {\n while (el) {\n if (el.tagName === 'A') {\n return el;\n }\n\n el = el.parentNode as Element;\n }\n }\n\n /**\n * Gets a value indicating whether or not an anchor targets the current window.\n *\n * @param target The anchor element whose target should be inspected.\n * @returns True if the target of the link element is this window; false otherwise.\n */\n static targetIsThisWindow(target: Element): boolean {\n let targetWindow = target.getAttribute('target');\n let win = PLATFORM.global;\n\n return !targetWindow ||\n targetWindow === win.name ||\n targetWindow === '_self';\n }\n}\n\nconst hasAttribute = (el: Element, attr: string) => el.hasAttribute(attr);\n","import { DOM, PLATFORM } from 'aurelia-pal';\nimport { LinkHandler } from './link-handler';\nimport { History } from 'aurelia-history';\n\n/**\n * An implementation of the basic history API.\n */\nexport class BrowserHistory extends History {\n /**@internal */\n static inject = [LinkHandler];\n\n /**@internal */\n _isActive: boolean;\n\n /**@internal*/\n _checkUrlCallback: any;\n /**@internal*/\n location: Location;\n /**@internal*/\n history: typeof PLATFORM['history'];\n /**@internal*/\n linkHandler: LinkHandler;\n /**@internal*/\n options: any;\n /**@internal*/\n root: string;\n /**@internal*/\n _wantsHashChange: boolean;\n /**@internal*/\n _hasPushState: boolean;\n /**@internal*/\n fragment: string;\n\n /**\n * Creates an instance of BrowserHistory\n * @param linkHandler An instance of LinkHandler.\n */\n constructor(linkHandler: LinkHandler) {\n super();\n\n this._isActive = false;\n this._checkUrlCallback = this._checkUrl.bind(this);\n\n this.location = PLATFORM.location;\n this.history = PLATFORM.history;\n this.linkHandler = linkHandler;\n }\n\n /**\n * Activates the history object.\n * @param options The set of options to activate history with.\n * @returns Whether or not activation occurred.\n */\n activate(options?: Object): boolean {\n if (this._isActive) {\n throw new Error('History has already been activated.');\n }\n\n let $history = this.history;\n let wantsPushState = !!(options as any).pushState;\n\n this._isActive = true;\n let normalizedOptions = this.options = Object.assign({}, { root: '/' }, this.options, options);\n\n // Normalize root to always include a leading and trailing slash.\n let rootUrl = this.root = ('/' + normalizedOptions.root + '/').replace(rootStripper, '/');\n\n let wantsHashChange = this._wantsHashChange = normalizedOptions.hashChange !== false;\n let hasPushState = this._hasPushState = !!(normalizedOptions.pushState && $history && $history.pushState);\n\n // Determine how we check the URL state.\n let eventName: string;\n if (hasPushState) {\n eventName = 'popstate';\n } else if (wantsHashChange) {\n eventName = 'hashchange';\n }\n\n PLATFORM.addEventListener(eventName, this._checkUrlCallback);\n\n // Determine if we need to change the base url, for a pushState link\n // opened by a non-pushState browser.\n if (wantsHashChange && wantsPushState) {\n // Transition from hashChange to pushState or vice versa if both are requested.\n let $location = this.location;\n let atRoot = $location.pathname.replace(/[^\\/]$/, '$&/') === rootUrl;\n\n // If we've started off with a route from a `pushState`-enabled\n // browser, but we're currently in a browser that doesn't support it...\n if (!hasPushState && !atRoot) {\n let fragment = this.fragment = this._getFragment(null, true);\n $location.replace(rootUrl + $location.search + '#' + fragment);\n // Return immediately as browser will do redirect to new url\n return true;\n\n // Or if we've started out with a hash-based route, but we're currently\n // in a browser where it could be `pushState`-based instead...\n } else if (hasPushState && atRoot && $location.hash) {\n let fragment = this.fragment = this._getHash().replace(routeStripper, '');\n $history.replaceState({}, DOM.title, rootUrl + fragment + $location.search);\n }\n }\n\n if (!this.fragment) {\n this.fragment = this._getFragment('');\n }\n\n this.linkHandler.activate(this);\n\n if (!normalizedOptions.silent) {\n return this._loadUrl('');\n }\n }\n\n /**\n * Deactivates the history object.\n */\n deactivate(): void {\n const handler = this._checkUrlCallback;\n PLATFORM.removeEventListener('popstate', handler);\n PLATFORM.removeEventListener('hashchange', handler);\n this._isActive = false;\n this.linkHandler.deactivate();\n }\n\n /**\n * Returns the fully-qualified root of the current history object.\n * @returns The absolute root of the application.\n */\n getAbsoluteRoot(): string {\n let $location = this.location;\n let origin = createOrigin($location.protocol, $location.hostname, $location.port);\n return `${origin}${this.root}`;\n }\n\n /**\n * Causes a history navigation to occur.\n *\n * @param fragment The history fragment to navigate to.\n * @param options The set of options that specify how the navigation should occur.\n * @return Promise if triggering navigation, otherwise true/false indicating if navigation occurred.\n */\n navigate(fragment?: string, {trigger = true, replace = false} = {}): boolean {\n let location = this.location;\n if (fragment && absoluteUrl.test(fragment)) {\n location.href = fragment;\n return true;\n }\n\n if (!this._isActive) {\n return false;\n }\n\n fragment = this._getFragment(fragment || '');\n\n if (this.fragment === fragment && !replace) {\n return false;\n }\n\n this.fragment = fragment;\n\n let url = this.root + fragment;\n\n // Don't include a trailing slash on the root.\n if (fragment === '' && url !== '/') {\n url = url.slice(0, -1);\n }\n\n // If pushState is available, we use it to set the fragment as a real URL.\n if (this._hasPushState) {\n url = url.replace('//', '/');\n this.history[replace ? 'replaceState' : 'pushState']({}, DOM.title, url);\n } else if (this._wantsHashChange) {\n // If hash changes haven't been explicitly disabled, update the hash\n // fragment to store history.\n updateHash(location, fragment, replace);\n } else {\n // If you've told us that you explicitly don't want fallback hashchange-\n // based history, then `navigate` becomes a page refresh.\n location.assign(url);\n }\n\n if (trigger) {\n return this._loadUrl(fragment);\n }\n\n return true;\n }\n\n /**\n * Causes the history state to navigate back.\n */\n navigateBack(): void {\n this.history.back();\n }\n\n /**\n * Sets the document title.\n */\n setTitle(title: string): void {\n DOM.title = title;\n }\n\n /**\n * Sets a key in the history page state.\n * @param key The key for the value.\n * @param value The value to set.\n */\n setState(key: string, value: any): void {\n let $history = this.history;\n let state = Object.assign({}, $history.state);\n let { pathname, search, hash } = this.location;\n state[key] = value;\n $history.replaceState(state, null, `${pathname}${search}${hash}`);\n }\n\n /**\n * Gets a key in the history page state.\n * @param key The key for the value.\n * @return The value for the key.\n */\n getState(key: string): any {\n let state = Object.assign({}, this.history.state);\n return state[key];\n }\n\n /**\n * Returns the current index in the navigation history.\n * @returns The current index.\n */\n getHistoryIndex(): number {\n let historyIndex = this.getState('HistoryIndex');\n if (historyIndex === undefined) {\n historyIndex = this.history.length - 1;\n this.setState('HistoryIndex', historyIndex);\n }\n return historyIndex;\n }\n\n /**\n * Move to a specific position in the navigation history.\n * @param movement The amount of steps, positive or negative, to move.\n */\n go(movement: number): void {\n this.history.go(movement);\n }\n\n /**\n * @internal\n */\n _getHash(): string {\n return this.location.hash.substr(1);\n }\n\n /**\n * @internal\n */\n _getFragment(fragment: string, forcePushState?: boolean): string {\n let rootUrl: string;\n\n if (!fragment) {\n if (this._hasPushState || !this._wantsHashChange || forcePushState) {\n let location = this.location;\n fragment = location.pathname + location.search;\n rootUrl = this.root.replace(trailingSlash, '');\n if (!fragment.indexOf(rootUrl)) {\n fragment = fragment.substr(rootUrl.length);\n }\n } else {\n fragment = this._getHash();\n }\n }\n\n return '/' + fragment.replace(routeStripper, '');\n }\n\n /**\n * Url change handler.\n * Invoked when current fragment is different with previous fragment\n * @internal\n */\n _checkUrl(): void {\n let current = this._getFragment('');\n if (current !== this.fragment) {\n this._loadUrl('');\n }\n }\n\n /**\n * invoke routeHandler\n * @internal\n */\n _loadUrl(fragmentOverride: string): boolean {\n let fragment = this.fragment = this._getFragment(fragmentOverride);\n\n return this.options.routeHandler ?\n this.options.routeHandler(fragment) :\n false;\n }\n}\n\n// Cached regex for stripping a leading hash/slash and trailing space.\nconst routeStripper = /^#?\\/*|\\s+$/g;\n\n// Cached regex for stripping leading and trailing slashes.\nconst rootStripper = /^\\/+|\\/+$/g;\n\n// Cached regex for removing a trailing slash.\nconst trailingSlash = /\\/$/;\n\n// Cached regex for detecting if a URL is absolute,\n// i.e., starts with a scheme or is scheme-relative.\n// See http://www.ietf.org/rfc/rfc2396.txt section 3.1 for valid scheme format\nconst absoluteUrl = /^([a-z][a-z0-9+\\-.]*:)?\\/\\//i;\n\n// Update the hash location, either replacing the current entry, or adding\n// a new one to the browser history.\nfunction updateHash($location: Location, fragment: string, replace: boolean) {\n if (replace) {\n let href = $location.href.replace(/(javascript:|#).*$/, '');\n $location.replace(href + '#' + fragment);\n } else {\n // Some browsers require that `hash` contains a leading #.\n $location.hash = '#' + fragment;\n }\n}\n\nfunction createOrigin(protocol: string, hostname: string, port: string) {\n return `${protocol}//${hostname}${port ? ':' + port : ''}`;\n}\n","import {History} from 'aurelia-history';\nimport {LinkHandler, DefaultLinkHandler} from './link-handler';\nimport { BrowserHistory } from './browser-history';\n\n/**\n * Configures the plugin by registering BrowserHistory as the implementation of History in the DI container.\n * @param config The FrameworkConfiguration object provided by Aurelia.\n */\nexport function configure(config: Object): void {\n // work around for converting to TS without breaking compat\n const $config = config as any;\n $config.singleton(History, BrowserHistory);\n $config.transient(LinkHandler, DefaultLinkHandler);\n}\n\nexport {\n LinkHandler,\n DefaultLinkHandler,\n BrowserHistory\n};\n",null,null,null,null,null,null,null,null,null,null,null,"import { ViewPortInstruction, RouteConfig, ViewPort, LifecycleArguments, ViewPortComponent } from './interfaces';\nimport { Router } from './router';\nimport { ActivationStrategyType, InternalActivationStrategy } from './activation-strategy';\n\n/**\n * Initialization options for a navigation instruction\n */\nexport interface NavigationInstructionInit {\n fragment: string;\n queryString?: string;\n params?: Record;\n queryParams?: Record;\n config: RouteConfig;\n parentInstruction?: NavigationInstruction;\n previousInstruction?: NavigationInstruction;\n router: Router;\n options?: Object;\n plan?: Record;\n}\n\nexport interface ViewPortInstructionInit {\n name: string;\n strategy: ActivationStrategyType;\n moduleId: string;\n component: ViewPortComponent;\n}\n\n/**\n * Class used to represent an instruction during a navigation.\n */\nexport class NavigationInstruction {\n /**\n * The URL fragment.\n */\n fragment: string;\n\n /**\n * The query string.\n */\n queryString: string;\n\n /**\n * Parameters extracted from the route pattern.\n */\n params: any;\n\n /**\n * Parameters extracted from the query string.\n */\n queryParams: any;\n\n /**\n * The route config for the route matching this instruction.\n */\n config: RouteConfig;\n\n /**\n * The parent instruction, if this instruction was created by a child router.\n */\n parentInstruction: NavigationInstruction;\n\n parentCatchHandler: any;\n\n /**\n * The instruction being replaced by this instruction in the current router.\n */\n previousInstruction: NavigationInstruction;\n\n /**\n * viewPort instructions to used activation.\n */\n viewPortInstructions: Record;\n\n /**\n * The router instance.\n */\n router: Router;\n\n /**\n * Current built viewport plan of this nav instruction\n */\n plan: Record = null;\n\n options: Record = {};\n\n /**@internal */\n lifecycleArgs: LifecycleArguments;\n /**@internal */\n resolve?: (val?: any) => void;\n\n constructor(init: NavigationInstructionInit) {\n Object.assign(this, init);\n\n this.params = this.params || {};\n this.viewPortInstructions = {};\n\n let ancestorParams = [];\n let current: NavigationInstruction = this;\n do {\n let currentParams = Object.assign({}, current.params);\n if (current.config && current.config.hasChildRouter) {\n // remove the param for the injected child route segment\n delete currentParams[current.getWildCardName()];\n }\n\n ancestorParams.unshift(currentParams);\n current = current.parentInstruction;\n } while (current);\n\n let allParams = Object.assign({}, this.queryParams, ...ancestorParams);\n this.lifecycleArgs = [allParams, this.config, this];\n }\n\n /**\n * Gets an array containing this instruction and all child instructions for the current navigation.\n */\n getAllInstructions(): Array {\n let instructions: NavigationInstruction[] = [this];\n let viewPortInstructions: Record = this.viewPortInstructions;\n\n for (let key in viewPortInstructions) {\n let childInstruction = viewPortInstructions[key].childNavigationInstruction;\n if (childInstruction) {\n instructions.push(...childInstruction.getAllInstructions());\n }\n }\n\n return instructions;\n }\n\n /**\n * Gets an array containing the instruction and all child instructions for the previous navigation.\n * Previous instructions are no longer available after navigation completes.\n */\n getAllPreviousInstructions(): Array {\n return this.getAllInstructions().map(c => c.previousInstruction).filter(c => c);\n }\n\n /**\n * Adds a viewPort instruction. Returns the newly created instruction based on parameters\n */\n addViewPortInstruction(initOptions: ViewPortInstructionInit): /*ViewPortInstruction*/ any;\n addViewPortInstruction(viewPortName: string, strategy: ActivationStrategyType, moduleId: string, component: any): /*ViewPortInstruction*/ any;\n addViewPortInstruction(\n nameOrInitOptions: string | ViewPortInstructionInit,\n strategy?: ActivationStrategyType,\n moduleId?: string,\n component?: any\n ): /*ViewPortInstruction*/ any {\n\n let viewPortInstruction: ViewPortInstruction;\n let viewPortName = typeof nameOrInitOptions === 'string' ? nameOrInitOptions : nameOrInitOptions.name;\n const lifecycleArgs = this.lifecycleArgs;\n const config: RouteConfig = Object.assign({}, lifecycleArgs[1], { currentViewPort: viewPortName });\n\n if (typeof nameOrInitOptions === 'string') {\n viewPortInstruction = {\n name: nameOrInitOptions,\n strategy: strategy,\n moduleId: moduleId,\n component: component,\n childRouter: component.childRouter,\n lifecycleArgs: [lifecycleArgs[0], config, lifecycleArgs[2]] as LifecycleArguments\n };\n } else {\n viewPortInstruction = {\n name: viewPortName,\n strategy: nameOrInitOptions.strategy,\n component: nameOrInitOptions.component,\n moduleId: nameOrInitOptions.moduleId,\n childRouter: nameOrInitOptions.component.childRouter,\n lifecycleArgs: [lifecycleArgs[0], config, lifecycleArgs[2]] as LifecycleArguments\n };\n }\n\n return this.viewPortInstructions[viewPortName] = viewPortInstruction;\n }\n\n /**\n * Gets the name of the route pattern's wildcard parameter, if applicable.\n */\n getWildCardName(): string {\n // todo: potential issue, or at least unsafe typings\n let configRoute = this.config.route as string;\n let wildcardIndex = configRoute.lastIndexOf('*');\n return configRoute.substr(wildcardIndex + 1);\n }\n\n /**\n * Gets the path and query string created by filling the route\n * pattern's wildcard parameter with the matching param.\n */\n getWildcardPath(): string {\n let wildcardName = this.getWildCardName();\n let path = this.params[wildcardName] || '';\n let queryString = this.queryString;\n\n if (queryString) {\n path += '?' + queryString;\n }\n\n return path;\n }\n\n /**\n * Gets the instruction's base URL, accounting for wildcard route parameters.\n */\n getBaseUrl(): string {\n let $encodeURI = encodeURI;\n let fragment = decodeURI(this.fragment);\n\n if (fragment === '') {\n let nonEmptyRoute = this.router.routes.find(route => {\n return route.name === this.config.name &&\n route.route !== '';\n });\n if (nonEmptyRoute) {\n fragment = nonEmptyRoute.route as any;\n }\n }\n\n if (!this.params) {\n return $encodeURI(fragment);\n }\n\n let wildcardName = this.getWildCardName();\n let path = this.params[wildcardName] || '';\n\n if (!path) {\n return $encodeURI(fragment);\n }\n\n return $encodeURI(fragment.substr(0, fragment.lastIndexOf(path)));\n }\n\n /**\n * Finalize a viewport instruction\n * @internal\n */\n _commitChanges(waitToSwap: boolean): Promise {\n let router = this.router;\n router.currentInstruction = this;\n\n const previousInstruction = this.previousInstruction;\n if (previousInstruction) {\n previousInstruction.config.navModel.isActive = false;\n }\n\n this.config.navModel.isActive = true;\n\n router.refreshNavigation();\n\n let loads: Promise[] = [];\n let delaySwaps: ISwapPlan[] = [];\n let viewPortInstructions: Record = this.viewPortInstructions;\n\n for (let viewPortName in viewPortInstructions) {\n let viewPortInstruction = viewPortInstructions[viewPortName];\n let viewPort = router.viewPorts[viewPortName];\n\n if (!viewPort) {\n throw new Error(`There was no router-view found in the view for ${viewPortInstruction.moduleId}.`);\n }\n\n let childNavInstruction = viewPortInstruction.childNavigationInstruction;\n if (viewPortInstruction.strategy === InternalActivationStrategy.Replace) {\n if (childNavInstruction && childNavInstruction.parentCatchHandler) {\n loads.push(childNavInstruction._commitChanges(waitToSwap));\n } else {\n if (waitToSwap) {\n delaySwaps.push({ viewPort, viewPortInstruction });\n }\n loads.push(\n viewPort\n .process(viewPortInstruction, waitToSwap)\n .then(() => childNavInstruction\n ? childNavInstruction._commitChanges(waitToSwap)\n : Promise.resolve()\n )\n );\n }\n } else {\n if (childNavInstruction) {\n loads.push(childNavInstruction._commitChanges(waitToSwap));\n }\n }\n }\n\n return Promise\n .all(loads)\n .then(() => {\n delaySwaps.forEach(x => x.viewPort.swap(x.viewPortInstruction));\n return null;\n })\n .then(() => prune(this));\n }\n\n /**@internal */\n _updateTitle(): void {\n let router = this.router;\n let title = this._buildTitle(router.titleSeparator);\n if (title) {\n router.history.setTitle(title);\n }\n }\n\n /**@internal */\n _buildTitle(separator: string = ' | '): string {\n let title = '';\n let childTitles = [];\n let navModelTitle = this.config.navModel.title;\n let instructionRouter = this.router;\n let viewPortInstructions: Record = this.viewPortInstructions;\n\n if (navModelTitle) {\n title = instructionRouter.transformTitle(navModelTitle);\n }\n\n for (let viewPortName in viewPortInstructions) {\n let viewPortInstruction = viewPortInstructions[viewPortName];\n let child_nav_instruction = viewPortInstruction.childNavigationInstruction;\n\n if (child_nav_instruction) {\n let childTitle = child_nav_instruction._buildTitle(separator);\n if (childTitle) {\n childTitles.push(childTitle);\n }\n }\n }\n\n if (childTitles.length) {\n title = childTitles.join(separator) + (title ? separator : '') + title;\n }\n\n if (instructionRouter.title) {\n title += (title ? separator : '') + instructionRouter.transformTitle(instructionRouter.title);\n }\n\n return title;\n }\n}\n\nconst prune = (instruction: NavigationInstruction): void => {\n instruction.previousInstruction = null;\n instruction.plan = null;\n};\n\ninterface ISwapPlan {\n viewPort: ViewPort;\n viewPortInstruction: ViewPortInstruction;\n}\n","import { Router } from './router';\nimport { RouteConfig } from './interfaces';\n\n/**\n* Class for storing and interacting with a route's navigation settings.\n*/\nexport class NavModel {\n\n /**\n * True if this nav item is currently active.\n */\n isActive: boolean = false;\n\n /**\n * The title.\n */\n title: string = null;\n\n /**\n * This nav item's absolute href.\n */\n href: string = null;\n\n /**\n * This nav item's relative href.\n */\n relativeHref: string = null;\n\n /**\n * Data attached to the route at configuration time.\n */\n settings: any = {};\n\n /**\n * The route config.\n */\n config: RouteConfig = null;\n\n /**\n * The router associated with this navigation model.\n */\n router: Router;\n\n order: number | boolean;\n\n constructor(router: Router, relativeHref: string) {\n this.router = router;\n this.relativeHref = relativeHref;\n }\n\n /**\n * Sets the route's title and updates document.title.\n * If the a navigation is in progress, the change will be applied\n * to document.title when the navigation completes.\n *\n * @param title The new title.\n */\n setTitle(title: string): void {\n this.title = title;\n\n if (this.isActive) {\n this.router.updateTitle();\n }\n }\n}\n","import { RouteConfig } from './interfaces';\n\nexport function _normalizeAbsolutePath(path: string, hasPushState: boolean, absolute: boolean = false) {\n if (!hasPushState && path[0] !== '#') {\n path = '#' + path;\n }\n\n if (hasPushState && absolute) {\n path = path.substring(1, path.length);\n }\n\n return path;\n}\n\nexport function _createRootedPath(fragment: string, baseUrl: string, hasPushState: boolean, absolute?: boolean) {\n if (isAbsoluteUrl.test(fragment)) {\n return fragment;\n }\n\n let path = '';\n\n if (baseUrl.length && baseUrl[0] !== '/') {\n path += '/';\n }\n\n path += baseUrl;\n\n if ((!path.length || path[path.length - 1] !== '/') && fragment[0] !== '/') {\n path += '/';\n }\n\n if (path.length && path[path.length - 1] === '/' && fragment[0] === '/') {\n path = path.substring(0, path.length - 1);\n }\n\n return _normalizeAbsolutePath(path + fragment, hasPushState, absolute);\n}\n\nexport function _resolveUrl(fragment: string, baseUrl: string, hasPushState?: boolean) {\n if (isRootedPath.test(fragment)) {\n return _normalizeAbsolutePath(fragment, hasPushState);\n }\n\n return _createRootedPath(fragment, baseUrl, hasPushState);\n}\n\nexport function _ensureArrayWithSingleRoutePerConfig(config: RouteConfig) {\n let routeConfigs = [];\n\n if (Array.isArray(config.route)) {\n for (let i = 0, ii = config.route.length; i < ii; ++i) {\n let current = Object.assign({}, config);\n current.route = config.route[i];\n routeConfigs.push(current);\n }\n } else {\n routeConfigs.push(Object.assign({}, config));\n }\n\n return routeConfigs;\n}\n\nconst isRootedPath = /^#?\\//;\nconst isAbsoluteUrl = /^([a-z][a-z0-9+\\-.]*:)?\\/\\//i;\n","import { RouteConfig, PipelineStep, RouteConfigSpecifier } from './interfaces';\nimport { _ensureArrayWithSingleRoutePerConfig } from './util';\nimport { Router } from './router';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { PipelineSlotName } from './pipeline-slot-name';\n\n/**\n * Class used to configure a [[Router]] instance.\n *\n * @constructor\n */\nexport class RouterConfiguration {\n instructions: Array<(router: Router) => void> = [];\n options: {\n [key: string]: any;\n compareQueryParams?: boolean;\n root?: string;\n pushState?: boolean;\n hashChange?: boolean;\n silent?: boolean;\n } = {};\n pipelineSteps: Array<{ name: string, step: Function | PipelineStep }> = [];\n title: string;\n titleSeparator: string;\n unknownRouteConfig: RouteConfigSpecifier;\n viewPortDefaults: Record;\n\n /**@internal */\n _fallbackRoute: string;\n\n /**\n * Adds a step to be run during the [[Router]]'s navigation pipeline.\n *\n * @param name The name of the pipeline slot to insert the step into.\n * @param step The pipeline step.\n * @chainable\n */\n addPipelineStep(name: string, step: Function | PipelineStep): RouterConfiguration {\n if (step === null || step === undefined) {\n throw new Error('Pipeline step cannot be null or undefined.');\n }\n this.pipelineSteps.push({ name, step });\n return this;\n }\n\n /**\n * Adds a step to be run during the [[Router]]'s authorize pipeline slot.\n *\n * @param step The pipeline step.\n * @chainable\n */\n addAuthorizeStep(step: Function | PipelineStep): RouterConfiguration {\n return this.addPipelineStep(PipelineSlotName.Authorize, step);\n }\n\n /**\n * Adds a step to be run during the [[Router]]'s preActivate pipeline slot.\n *\n * @param step The pipeline step.\n * @chainable\n */\n addPreActivateStep(step: Function | PipelineStep): RouterConfiguration {\n return this.addPipelineStep(PipelineSlotName.PreActivate, step);\n }\n\n /**\n * Adds a step to be run during the [[Router]]'s preRender pipeline slot.\n *\n * @param step The pipeline step.\n * @chainable\n */\n addPreRenderStep(step: Function | PipelineStep): RouterConfiguration {\n return this.addPipelineStep(PipelineSlotName.PreRender, step);\n }\n\n /**\n * Adds a step to be run during the [[Router]]'s postRender pipeline slot.\n *\n * @param step The pipeline step.\n * @chainable\n */\n addPostRenderStep(step: Function | PipelineStep): RouterConfiguration {\n return this.addPipelineStep(PipelineSlotName.PostRender, step);\n }\n\n /**\n * Configures a route that will be used if there is no previous location available on navigation cancellation.\n *\n * @param fragment The URL fragment to use as the navigation destination.\n * @chainable\n */\n fallbackRoute(fragment: string): RouterConfiguration {\n this._fallbackRoute = fragment;\n return this;\n }\n\n /**\n * Maps one or more routes to be registered with the router.\n *\n * @param route The [[RouteConfig]] to map, or an array of [[RouteConfig]] to map.\n * @chainable\n */\n map(route: RouteConfig | RouteConfig[]): RouterConfiguration {\n if (Array.isArray(route)) {\n route.forEach(r => this.map(r));\n return this;\n }\n\n return this.mapRoute(route);\n }\n\n /**\n * Configures defaults to use for any view ports.\n *\n * @param viewPortConfig a view port configuration object to use as a\n * default, of the form { viewPortName: { moduleId } }.\n * @chainable\n */\n useViewPortDefaults(viewPortConfig: Record): RouterConfiguration {\n this.viewPortDefaults = viewPortConfig;\n return this;\n }\n\n /**\n * Maps a single route to be registered with the router.\n *\n * @param route The [[RouteConfig]] to map.\n * @chainable\n */\n mapRoute(config: RouteConfig): RouterConfiguration {\n this.instructions.push(router => {\n let routeConfigs = _ensureArrayWithSingleRoutePerConfig(config);\n\n let navModel;\n for (let i = 0, ii = routeConfigs.length; i < ii; ++i) {\n let routeConfig = routeConfigs[i];\n routeConfig.settings = routeConfig.settings || {};\n if (!navModel) {\n navModel = router.createNavModel(routeConfig);\n }\n\n router.addRoute(routeConfig, navModel);\n }\n });\n\n return this;\n }\n\n /**\n * Registers an unknown route handler to be run when the URL fragment doesn't match any registered routes.\n *\n * @param config A string containing a moduleId to load, or a [[RouteConfig]], or a function that takes the\n * [[NavigationInstruction]] and selects a moduleId to load.\n * @chainable\n */\n mapUnknownRoutes(config: RouteConfigSpecifier): RouterConfiguration {\n this.unknownRouteConfig = config;\n return this;\n }\n\n /**\n * Applies the current configuration to the specified [[Router]].\n *\n * @param router The [[Router]] to apply the configuration to.\n */\n exportToRouter(router: Router): void {\n let instructions = this.instructions;\n for (let i = 0, ii = instructions.length; i < ii; ++i) {\n instructions[i](router);\n }\n\n let { title, titleSeparator, unknownRouteConfig, _fallbackRoute, viewPortDefaults } = this;\n\n if (title) {\n router.title = title;\n }\n\n if (titleSeparator) {\n router.titleSeparator = titleSeparator;\n }\n\n if (unknownRouteConfig) {\n router.handleUnknownRoutes(unknownRouteConfig);\n }\n\n if (_fallbackRoute) {\n router.fallbackRoute = _fallbackRoute;\n }\n\n if (viewPortDefaults) {\n router.useViewPortDefaults(viewPortDefaults);\n }\n\n Object.assign(router.options, this.options);\n\n let pipelineSteps = this.pipelineSteps;\n let pipelineStepCount = pipelineSteps.length;\n if (pipelineStepCount) {\n if (!router.isRoot) {\n throw new Error('Pipeline steps can only be added to the root router');\n }\n\n let pipelineProvider = router.pipelineProvider;\n for (let i = 0, ii = pipelineStepCount; i < ii; ++i) {\n let { name, step } = pipelineSteps[i];\n pipelineProvider.addStep(name, step);\n }\n }\n }\n}\n","import { RouteRecognizer, RouteHandler, ConfigurableRoute, State, RecognizedRoute } from 'aurelia-route-recognizer';\nimport { Container } from 'aurelia-dependency-injection';\nimport { History, NavigationOptions } from 'aurelia-history';\nimport { NavigationInstruction, NavigationInstructionInit } from './navigation-instruction';\nimport { NavModel } from './nav-model';\nimport { RouterConfiguration } from './router-configuration';\nimport {\n _ensureArrayWithSingleRoutePerConfig,\n _normalizeAbsolutePath,\n _createRootedPath,\n _resolveUrl\n} from './util';\nimport { RouteConfig, RouteConfigSpecifier, ViewPortInstruction } from './interfaces';\nimport { PipelineProvider } from './pipeline-provider';\n\n/**@internal */\ndeclare module 'aurelia-history' {\n interface History {\n // This is wrong, as it's an implementation detail from aurelia-history-browser\n // but we are poking it in here so probably will need to make it official in `aurelia-history`\n /**\n * A private flag of Aurelia History implementation to indicate if push state should be used\n */\n _hasPushState: boolean;\n\n previousLocation: string;\n }\n}\n\n/**@internal */\ndeclare module 'aurelia-route-recognizer' {\n interface State {\n types: {\n dynamics: DynamicSegment;\n stars: StarSegment;\n };\n }\n\n interface RouteHandler {\n navigationStrategy?: (instruction: NavigationInstruction) => any;\n }\n\n interface RecognizedRoute {\n config?: RouteConfig;\n queryParams?: Record;\n }\n}\n\ntype RouterConfigurationResolution = RouterConfiguration | ((cfg: RouterConfiguration) => void | RouterConfiguration | Promise);\n\n/**\n * The primary class responsible for handling routing and navigation.\n */\nexport class Router {\n\n /**\n * Container associated with this router. Also used to create child container for creating child router.\n */\n container: Container;\n\n /**\n * History instance of Aurelia abstract class for wrapping platform history global object\n */\n history: History;\n\n /**\n * A registry of registered viewport. Will be used to handle process navigation instruction route loading\n * and dom swapping\n */\n viewPorts: Record;\n\n /**\n * List of route configs registered with this router\n */\n routes: RouteConfig[];\n\n /**\n * The [[Router]]'s current base URL, typically based on the [[Router.currentInstruction]].\n */\n baseUrl: string;\n\n /**\n * If defined, used in generation of document title for [[Router]]'s routes.\n */\n title: string | undefined;\n\n /**\n * The separator used in the document title between [[Router]]'s routes.\n */\n titleSeparator: string | undefined;\n\n /**\n * True if the [[Router]] has been configured.\n */\n isConfigured: boolean;\n\n /**\n * True if the [[Router]] is currently processing a navigation.\n */\n isNavigating: boolean;\n\n /**\n * True if the [[Router]] is navigating due to explicit call to navigate function(s).\n */\n isExplicitNavigation: boolean;\n\n /**\n * True if the [[Router]] is navigating due to explicit call to navigateBack function.\n */\n isExplicitNavigationBack: boolean;\n\n /**\n * True if the [[Router]] is navigating into the app for the first time in the browser session.\n */\n isNavigatingFirst: boolean;\n\n /**\n * True if the [[Router]] is navigating to a page instance not in the browser session history.\n */\n isNavigatingNew: boolean;\n\n /**\n * True if the [[Router]] is navigating forward in the browser session history.\n */\n isNavigatingForward: boolean;\n\n /**\n * True if the [[Router]] is navigating back in the browser session history.\n */\n isNavigatingBack: boolean;\n\n /**\n * True if the [[Router]] is navigating due to a browser refresh.\n */\n isNavigatingRefresh: boolean;\n\n /**\n * True if the previous instruction successfully completed the CanDeactivatePreviousStep in the current navigation.\n */\n couldDeactivate: boolean;\n\n /**\n * The currently active navigation tracker.\n */\n currentNavigationTracker: number;\n\n /**\n * The navigation models for routes that specified [[RouteConfig.nav]].\n */\n navigation: NavModel[];\n\n /**\n * The currently active navigation instruction.\n */\n currentInstruction: NavigationInstruction;\n\n /**\n * The parent router, or null if this instance is not a child router.\n */\n parent: Router = null;\n\n options: any = {};\n\n /**\n * The defaults used when a viewport lacks specified content\n */\n viewPortDefaults: Record = {};\n\n /**@internal */\n catchAllHandler: (instruction: NavigationInstruction) => NavigationInstruction | Promise;\n /**@internal */\n fallbackRoute: string;\n /**@internal */\n pipelineProvider: PipelineProvider;\n /**@internal */\n _fallbackOrder: number;\n /**@internal */\n _recognizer: RouteRecognizer;\n /**@internal */\n _childRecognizer: RouteRecognizer;\n /**@internal */\n _configuredPromise: Promise;\n /**@internal */\n _resolveConfiguredPromise: (value?: any) => void;\n\n /**\n * Extension point to transform the document title before it is built and displayed.\n * By default, child routers delegate to the parent router, and the app router\n * returns the title unchanged.\n */\n transformTitle: (title: string) => string = (title: string) => {\n if (this.parent) {\n return this.parent.transformTitle(title);\n }\n return title;\n }\n\n /**\n * @param container The [[Container]] to use when child routers.\n * @param history The [[History]] implementation to delegate navigation requests to.\n */\n constructor(container: Container, history: History) {\n this.container = container;\n this.history = history;\n this.reset();\n }\n\n /**\n * Fully resets the router's internal state. Primarily used internally by the framework when multiple calls to setRoot are made.\n * Use with caution (actually, avoid using this). Do not use this to simply change your navigation model.\n */\n reset() {\n this.viewPorts = {};\n this.routes = [];\n this.baseUrl = '';\n this.isConfigured = false;\n this.isNavigating = false;\n this.isExplicitNavigation = false;\n this.isExplicitNavigationBack = false;\n this.isNavigatingFirst = false;\n this.isNavigatingNew = false;\n this.isNavigatingRefresh = false;\n this.isNavigatingForward = false;\n this.isNavigatingBack = false;\n this.couldDeactivate = false;\n this.navigation = [];\n this.currentInstruction = null;\n this.viewPortDefaults = {};\n this._fallbackOrder = 100;\n this._recognizer = new RouteRecognizer();\n this._childRecognizer = new RouteRecognizer();\n this._configuredPromise = new Promise(resolve => {\n this._resolveConfiguredPromise = resolve;\n });\n }\n\n /**\n * Gets a value indicating whether or not this [[Router]] is the root in the router tree. I.e., it has no parent.\n */\n get isRoot(): boolean {\n return !this.parent;\n }\n\n /**\n * Registers a viewPort to be used as a rendering target for activated routes.\n *\n * @param viewPort The viewPort.\n * @param name The name of the viewPort. 'default' if unspecified.\n */\n registerViewPort(viewPort: /*ViewPort*/any, name?: string): void {\n name = name || 'default';\n this.viewPorts[name] = viewPort;\n }\n\n /**\n * Returns a Promise that resolves when the router is configured.\n */\n ensureConfigured(): Promise {\n return this._configuredPromise;\n }\n\n /**\n * Configures the router.\n *\n * @param callbackOrConfig The [[RouterConfiguration]] or a callback that takes a [[RouterConfiguration]].\n */\n configure(callbackOrConfig: RouterConfiguration | ((config: RouterConfiguration) => RouterConfiguration)): Promise {\n this.isConfigured = true;\n\n let result: RouterConfigurationResolution = callbackOrConfig as RouterConfiguration;\n let config: RouterConfiguration;\n if (typeof callbackOrConfig === 'function') {\n config = new RouterConfiguration();\n result = callbackOrConfig(config);\n }\n\n return Promise\n .resolve(result)\n .then((c) => {\n if (c && (c as RouterConfiguration).exportToRouter) {\n config = c;\n }\n\n config.exportToRouter(this);\n this.isConfigured = true;\n this._resolveConfiguredPromise();\n });\n }\n\n /**\n * Navigates to a new location.\n *\n * @param fragment The URL fragment to use as the navigation destination.\n * @param options The navigation options.\n */\n navigate(fragment: string, options?: NavigationOptions): boolean {\n if (!this.isConfigured && this.parent) {\n return this.parent.navigate(fragment, options);\n }\n\n this.isExplicitNavigation = true;\n return this.history.navigate(_resolveUrl(fragment, this.baseUrl, this.history._hasPushState), options);\n }\n\n /**\n * Navigates to a new location corresponding to the route and params specified. Equivallent to [[Router.generate]] followed\n * by [[Router.navigate]].\n *\n * @param route The name of the route to use when generating the navigation location.\n * @param params The route parameters to be used when populating the route pattern.\n * @param options The navigation options.\n */\n navigateToRoute(route: string, params?: any, options?: NavigationOptions): boolean {\n let path = this.generate(route, params);\n return this.navigate(path, options);\n }\n\n /**\n * Navigates back to the most recent location in history.\n */\n navigateBack(): void {\n this.isExplicitNavigationBack = true;\n this.history.navigateBack();\n }\n\n /**\n * Creates a child router of the current router.\n *\n * @param container The [[Container]] to provide to the child router. Uses the current [[Router]]'s [[Container]] if unspecified.\n * @returns {Router} The new child Router.\n */\n createChild(container?: Container): Router {\n let childRouter = new Router(container || this.container.createChild(), this.history);\n childRouter.parent = this;\n return childRouter;\n }\n\n /**\n * Generates a URL fragment matching the specified route pattern.\n *\n * @param name The name of the route whose pattern should be used to generate the fragment.\n * @param params The route params to be used to populate the route pattern.\n * @param options If options.absolute = true, then absolute url will be generated; otherwise, it will be relative url.\n * @returns {string} A string containing the generated URL fragment.\n */\n generate(nameOrRoute: string | RouteConfig, params: any = {}, options: any = {}): string {\n // A child recognizer generates routes for potential child routes. Any potential child route is added\n // to the childRoute property of params for the childRouter to recognize. When generating routes, we\n // use the childRecognizer when childRoute params are available to generate a child router enabled route.\n let recognizer = 'childRoute' in params ? this._childRecognizer : this._recognizer;\n let hasRoute = recognizer.hasRoute(nameOrRoute as string | RouteHandler);\n if (!hasRoute) {\n if (this.parent) {\n return this.parent.generate(nameOrRoute, params, options);\n }\n throw new Error(`A route with name '${nameOrRoute}' could not be found. Check that \\`name: '${nameOrRoute}'\\` was specified in the route's config.`);\n }\n let path = recognizer.generate(nameOrRoute as string | RouteHandler, params);\n let rootedPath = _createRootedPath(path, this.baseUrl, this.history._hasPushState, options.absolute);\n return options.absolute ? `${this.history.getAbsoluteRoot()}${rootedPath}` : rootedPath;\n }\n\n /**\n * Creates a [[NavModel]] for the specified route config.\n *\n * @param config The route config.\n */\n createNavModel(config: RouteConfig): NavModel {\n let navModel = new NavModel(\n this,\n 'href' in config\n ? config.href\n // potential error when config.route is a string[] ?\n : config.route as string);\n navModel.title = config.title;\n navModel.order = config.nav;\n navModel.href = config.href;\n navModel.settings = config.settings;\n navModel.config = config;\n\n return navModel;\n }\n\n /**\n * Registers a new route with the router.\n *\n * @param config The [[RouteConfig]].\n * @param navModel The [[NavModel]] to use for the route. May be omitted for single-pattern routes.\n */\n addRoute(config: RouteConfig, navModel?: NavModel): void {\n if (Array.isArray(config.route)) {\n let routeConfigs = _ensureArrayWithSingleRoutePerConfig(config);\n // the following is wrong. todo: fix this after TS refactoring release\n routeConfigs.forEach(this.addRoute.bind(this));\n return;\n }\n\n validateRouteConfig(config);\n\n if (!('viewPorts' in config) && !config.navigationStrategy) {\n config.viewPorts = {\n 'default': {\n moduleId: config.moduleId,\n view: config.view\n }\n };\n }\n\n if (!navModel) {\n navModel = this.createNavModel(config);\n }\n\n this.routes.push(config);\n\n let path = config.route;\n if (path.charAt(0) === '/') {\n path = path.substr(1);\n }\n let caseSensitive = config.caseSensitive === true;\n let state: State = this._recognizer.add({\n path: path,\n handler: config as RouteHandler,\n caseSensitive: caseSensitive\n } as ConfigurableRoute);\n\n if (path) {\n let settings = config.settings;\n delete config.settings;\n let withChild = JSON.parse(JSON.stringify(config));\n config.settings = settings;\n withChild.route = `${path}/*childRoute`;\n withChild.hasChildRouter = true;\n this._childRecognizer.add({\n path: withChild.route,\n handler: withChild,\n caseSensitive: caseSensitive\n });\n\n withChild.navModel = navModel;\n withChild.settings = config.settings;\n withChild.navigationStrategy = config.navigationStrategy;\n }\n\n config.navModel = navModel;\n\n let navigation = this.navigation;\n\n if ((navModel.order || navModel.order === 0) && navigation.indexOf(navModel) === -1) {\n if ((!navModel.href && navModel.href !== '') && (state.types.dynamics || state.types.stars)) {\n throw new Error('Invalid route config for \"' + config.route + '\" : dynamic routes must specify an \"href:\" to be included in the navigation model.');\n }\n\n if (typeof navModel.order !== 'number') {\n navModel.order = ++this._fallbackOrder;\n }\n\n navigation.push(navModel);\n // this is a potential error / inconsistency between browsers\n //\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort\n // If compareFunction(a, b) returns 0, leave a and b unchanged with respect to each other,\n // but sorted with respect to all different elements.\n // Note: the ECMAscript standard does not guarantee this behaviour,\n // and thus not all browsers (e.g. Mozilla versions dating back to at least 2003) respect this.\n navigation.sort((a, b) => a.order - b.order);\n }\n }\n\n /**\n * Gets a value indicating whether or not this [[Router]] or one of its ancestors has a route registered with the specified name.\n *\n * @param name The name of the route to check.\n */\n hasRoute(name: string): boolean {\n return !!(this._recognizer.hasRoute(name) || this.parent && this.parent.hasRoute(name));\n }\n\n /**\n * Gets a value indicating whether or not this [[Router]] has a route registered with the specified name.\n *\n * @param name The name of the route to check.\n */\n hasOwnRoute(name: string): boolean {\n return this._recognizer.hasRoute(name);\n }\n\n /**\n * Register a handler to use when the incoming URL fragment doesn't match any registered routes.\n *\n * @param config The moduleId, or a function that selects the moduleId, or a [[RouteConfig]].\n */\n handleUnknownRoutes(config?: RouteConfigSpecifier): void {\n if (!config) {\n throw new Error('Invalid unknown route handler');\n }\n\n this.catchAllHandler = instruction => {\n return this\n ._createRouteConfig(config, instruction)\n .then(c => {\n instruction.config = c;\n return instruction;\n });\n };\n }\n\n /**\n * Updates the document title using the current navigation instruction.\n */\n updateTitle(): void {\n let parentRouter = this.parent;\n if (parentRouter) {\n return parentRouter.updateTitle();\n }\n\n let currentInstruction = this.currentInstruction;\n if (currentInstruction) {\n currentInstruction._updateTitle();\n }\n return undefined;\n }\n\n /**\n * Updates the navigation routes with hrefs relative to the current location.\n * Note: This method will likely move to a plugin in a future release.\n */\n refreshNavigation(): void {\n let nav = this.navigation;\n\n for (let i = 0, length = nav.length; i < length; i++) {\n let current = nav[i];\n if (!current.config.href) {\n current.href = _createRootedPath(current.relativeHref, this.baseUrl, this.history._hasPushState);\n } else {\n current.href = _normalizeAbsolutePath(current.config.href, this.history._hasPushState);\n }\n }\n }\n\n /**\n * Sets the default configuration for the view ports. This specifies how to\n * populate a view port for which no module is specified. The default is\n * an empty view/view-model pair.\n */\n useViewPortDefaults($viewPortDefaults: Record): void {\n // a workaround to have strong typings while not requiring to expose interface ViewPortInstruction\n let viewPortDefaults: Record = $viewPortDefaults;\n for (let viewPortName in viewPortDefaults) {\n let viewPortConfig = viewPortDefaults[viewPortName];\n this.viewPortDefaults[viewPortName] = {\n moduleId: viewPortConfig.moduleId\n };\n }\n }\n\n /**@internal */\n _refreshBaseUrl(): void {\n let parentRouter = this.parent;\n if (parentRouter) {\n this.baseUrl = generateBaseUrl(parentRouter, parentRouter.currentInstruction);\n }\n }\n\n /**@internal */\n _createNavigationInstruction(url: string = '', parentInstruction: NavigationInstruction = null): Promise {\n let fragment = url;\n let queryString = '';\n\n let queryIndex = url.indexOf('?');\n if (queryIndex !== -1) {\n fragment = url.substr(0, queryIndex);\n queryString = url.substr(queryIndex + 1);\n }\n\n let urlRecognizationResults = this._recognizer.recognize(url) as IRouteRecognizationResults;\n if (!urlRecognizationResults || !urlRecognizationResults.length) {\n urlRecognizationResults = this._childRecognizer.recognize(url) as IRouteRecognizationResults;\n }\n\n let instructionInit: NavigationInstructionInit = {\n fragment,\n queryString,\n config: null,\n parentInstruction,\n previousInstruction: this.currentInstruction,\n router: this,\n options: {\n compareQueryParams: this.options.compareQueryParams\n }\n };\n\n let result: Promise;\n\n if (urlRecognizationResults && urlRecognizationResults.length) {\n let first = urlRecognizationResults[0];\n let instruction = new NavigationInstruction(Object.assign({}, instructionInit, {\n params: first.params,\n queryParams: first.queryParams || urlRecognizationResults.queryParams,\n config: first.config || first.handler\n }));\n\n if (typeof first.handler === 'function') {\n result = evaluateNavigationStrategy(instruction, first.handler, first);\n } else if (first.handler && typeof first.handler.navigationStrategy === 'function') {\n result = evaluateNavigationStrategy(instruction, first.handler.navigationStrategy, first.handler);\n } else {\n result = Promise.resolve(instruction);\n }\n } else if (this.catchAllHandler) {\n let instruction = new NavigationInstruction(Object.assign({}, instructionInit, {\n params: { path: fragment },\n queryParams: urlRecognizationResults ? urlRecognizationResults.queryParams : {},\n config: null // config will be created by the catchAllHandler\n }));\n\n result = evaluateNavigationStrategy(instruction, this.catchAllHandler);\n } else if (this.parent) {\n let router = this._parentCatchAllHandler(this.parent);\n\n if (router) {\n let newParentInstruction = this._findParentInstructionFromRouter(router, parentInstruction);\n\n let instruction = new NavigationInstruction(Object.assign({}, instructionInit, {\n params: { path: fragment },\n queryParams: urlRecognizationResults ? urlRecognizationResults.queryParams : {},\n router: router,\n parentInstruction: newParentInstruction,\n parentCatchHandler: true,\n config: null // config will be created by the chained parent catchAllHandler\n }));\n\n result = evaluateNavigationStrategy(instruction, router.catchAllHandler);\n }\n }\n\n if (result && parentInstruction) {\n this.baseUrl = generateBaseUrl(this.parent, parentInstruction);\n }\n\n return result || Promise.reject(new Error(`Route not found: ${url}`));\n }\n\n /**@internal */\n _findParentInstructionFromRouter(router: Router, instruction: NavigationInstruction): NavigationInstruction {\n if (instruction.router === router) {\n instruction.fragment = router.baseUrl; // need to change the fragment in case of a redirect instead of moduleId\n return instruction;\n } else if (instruction.parentInstruction) {\n return this._findParentInstructionFromRouter(router, instruction.parentInstruction);\n }\n return undefined;\n }\n\n /**@internal */\n _parentCatchAllHandler(router: Router): Router | false {\n if (router.catchAllHandler) {\n return router;\n } else if (router.parent) {\n return this._parentCatchAllHandler(router.parent);\n }\n return false;\n }\n\n /**\n * @internal\n */\n _createRouteConfig(config: RouteConfigSpecifier, instruction: NavigationInstruction): Promise {\n return Promise\n .resolve(config)\n .then((c: any) => {\n if (typeof c === 'string') {\n return { moduleId: c } as RouteConfig;\n } else if (typeof c === 'function') {\n return c(instruction);\n }\n\n return c;\n })\n // typing here could be either RouteConfig or RedirectConfig\n // but temporarily treat both as RouteConfig\n // todo: improve typings precision\n .then((c: string | RouteConfig) => typeof c === 'string' ? { moduleId: c } as RouteConfig : c)\n .then((c: RouteConfig) => {\n c.route = instruction.params.path;\n validateRouteConfig(c);\n\n if (!c.navModel) {\n c.navModel = this.createNavModel(c);\n }\n\n return c;\n });\n }\n}\n\n/* @internal exported for unit testing */\nexport const generateBaseUrl = (router: Router, instruction: NavigationInstruction): string => {\n return `${router.baseUrl || ''}${instruction.getBaseUrl() || ''}`;\n};\n\n/* @internal exported for unit testing */\nexport const validateRouteConfig = (config: RouteConfig): void => {\n if (typeof config !== 'object') {\n throw new Error('Invalid Route Config');\n }\n\n if (typeof config.route !== 'string') {\n let name = config.name || '(no name)';\n throw new Error('Invalid Route Config for \"' + name + '\": You must specify a \"route:\" pattern.');\n }\n\n if (!('redirect' in config || config.moduleId || config.navigationStrategy || config.viewPorts)) {\n throw new Error('Invalid Route Config for \"' + config.route + '\": You must specify a \"moduleId:\", \"redirect:\", \"navigationStrategy:\", or \"viewPorts:\".');\n }\n};\n\n/* @internal exported for unit testing */\nexport const evaluateNavigationStrategy = (\n instruction: NavigationInstruction,\n evaluator: Function,\n context?: any\n): Promise => {\n return Promise\n .resolve(evaluator.call(context, instruction))\n .then(() => {\n if (!('viewPorts' in instruction.config)) {\n instruction.config.viewPorts = {\n 'default': {\n moduleId: instruction.config.moduleId\n }\n };\n }\n\n return instruction;\n });\n};\n\ninterface IRouteRecognizationResults extends Array {\n queryParams: Record;\n}\n","import { PipelineStatus } from './pipeline-status';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { Next, StepRunnerFunction, NextCompletionHandler } from './interfaces';\n\n/**@internal exported for unit testing */\nexport const createNextFn = (instruction: NavigationInstruction, steps: StepRunnerFunction[]): Next => {\n let index = -1;\n const next: Next = function() {\n index++;\n\n if (index < steps.length) {\n let currentStep = steps[index];\n\n try {\n return currentStep(instruction, next);\n } catch (e) {\n return next.reject(e);\n }\n } else {\n return next.complete();\n }\n } as Next;\n\n next.complete = createCompletionHandler(next, PipelineStatus.Completed);\n next.cancel = createCompletionHandler(next, PipelineStatus.Canceled);\n next.reject = createCompletionHandler(next, PipelineStatus.Rejected);\n\n return next;\n};\n\n/**@internal exported for unit testing */\nexport const createCompletionHandler = (next: Next, status: PipelineStatus): NextCompletionHandler => {\n return (output: any) => Promise\n .resolve({\n status,\n output,\n completed: status === PipelineStatus.Completed\n });\n};\n","import { PipelineStep, PipelineResult, Next, StepRunnerFunction, IPipelineSlot } from './interfaces';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { createNextFn } from './next';\n\n/**\n * The class responsible for managing and processing the navigation pipeline.\n */\nexport class Pipeline {\n /**\n * The pipeline steps. And steps added via addStep will be converted to a function\n * The actualy running functions with correct step contexts of this pipeline\n */\n steps: StepRunnerFunction[] = [];\n\n /**\n * Adds a step to the pipeline.\n *\n * @param step The pipeline step.\n */\n addStep(step: StepRunnerFunction | PipelineStep | IPipelineSlot): Pipeline {\n let run;\n\n if (typeof step === 'function') {\n run = step;\n } else if (typeof step.getSteps === 'function') {\n // getSteps is to enable support open slots\n // where devs can add multiple steps into the same slot name\n let steps = step.getSteps();\n for (let i = 0, l = steps.length; i < l; i++) {\n this.addStep(steps[i]);\n }\n\n return this;\n } else {\n run = (step as PipelineStep).run.bind(step);\n }\n\n this.steps.push(run);\n\n return this;\n }\n\n /**\n * Runs the pipeline.\n *\n * @param instruction The navigation instruction to process.\n */\n run(instruction: NavigationInstruction): Promise {\n const nextFn = createNextFn(instruction, this.steps);\n return nextFn();\n }\n}\n","import { NavigationOptions } from 'aurelia-history';\nimport { Router } from './router';\n\n/**@internal */\ndeclare module 'aurelia-history' {\n interface NavigationOptions {\n useAppRouter?: boolean;\n }\n}\n\n/**\n* When a navigation command is encountered, the current navigation\n* will be cancelled and control will be passed to the navigation\n* command so it can determine the correct action.\n*/\nexport interface NavigationCommand {\n navigate: (router: Router) => void;\n /**@internal */\n shouldContinueProcessing?: boolean;\n /**@internal */\n setRouter?: (router: Router) => void;\n}\n\n/**\n* Determines if the provided object is a navigation command.\n* A navigation command is anything with a navigate method.\n*\n* @param obj The object to check.\n*/\nexport function isNavigationCommand(obj: any): obj is NavigationCommand {\n return obj && typeof obj.navigate === 'function';\n}\n\n/**\n* Used during the activation lifecycle to cause a redirect.\n*/\nexport class Redirect implements NavigationCommand {\n\n url: string;\n /**@internal */\n options: NavigationOptions;\n /**@internal */\n shouldContinueProcessing: boolean;\n\n private router: Router;\n\n /**\n * @param url The URL fragment to use as the navigation destination.\n * @param options The navigation options.\n */\n constructor(url: string, options: NavigationOptions = {}) {\n this.url = url;\n this.options = Object.assign({ trigger: true, replace: true }, options);\n this.shouldContinueProcessing = false;\n }\n\n /**\n * Called by the activation system to set the child router.\n *\n * @param router The router.\n */\n setRouter(router: Router): void {\n this.router = router;\n }\n\n /**\n * Called by the navigation pipeline to navigate.\n *\n * @param appRouter The router to be redirected.\n */\n navigate(appRouter: Router): void {\n let navigatingRouter = this.options.useAppRouter ? appRouter : (this.router || appRouter);\n navigatingRouter.navigate(this.url, this.options);\n }\n}\n\n/**\n * Used during the activation lifecycle to cause a redirect to a named route.\n */\nexport class RedirectToRoute implements NavigationCommand {\n\n route: string;\n params: any;\n /**@internal */\n options: NavigationOptions;\n\n /**@internal */\n shouldContinueProcessing: boolean;\n\n /**@internal */\n router: Router;\n\n /**\n * @param route The name of the route.\n * @param params The parameters to be sent to the activation method.\n * @param options The options to use for navigation.\n */\n constructor(route: string, params: any = {}, options: NavigationOptions = {}) {\n this.route = route;\n this.params = params;\n this.options = Object.assign({ trigger: true, replace: true }, options);\n this.shouldContinueProcessing = false;\n }\n\n /**\n * Called by the activation system to set the child router.\n *\n * @param router The router.\n */\n setRouter(router: Router): void {\n this.router = router;\n }\n\n /**\n * Called by the navigation pipeline to navigate.\n *\n * @param appRouter The router to be redirected.\n */\n navigate(appRouter: Router): void {\n let navigatingRouter = this.options.useAppRouter ? appRouter : (this.router || appRouter);\n navigatingRouter.navigateToRoute(this.route, this.params, this.options);\n }\n}\n","import { ViewPortPlan, ViewPortInstruction, RouteConfig, ViewPort } from './interfaces';\nimport { Redirect } from './navigation-commands';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { InternalActivationStrategy, ActivationStrategyType } from './activation-strategy';\n\ntype ViewPortPlansRecord = Record;\n\n/**\n * @internal exported for unit testing\n */\nexport function _buildNavigationPlan(\n instruction: NavigationInstruction,\n forceLifecycleMinimum?: boolean\n): Promise {\n let config = instruction.config;\n\n if ('redirect' in config) {\n return buildRedirectPlan(instruction);\n }\n\n const prevInstruction = instruction.previousInstruction;\n const defaultViewPortConfigs = instruction.router.viewPortDefaults;\n\n if (prevInstruction) {\n return buildTransitionPlans(instruction, prevInstruction, defaultViewPortConfigs, forceLifecycleMinimum);\n }\n\n // first navigation, only need to prepare a few information for each viewport plan\n const viewPortPlans: ViewPortPlansRecord = {};\n let viewPortConfigs = config.viewPorts;\n for (let viewPortName in viewPortConfigs) {\n let viewPortConfig = viewPortConfigs[viewPortName];\n if (viewPortConfig.moduleId === null && viewPortName in defaultViewPortConfigs) {\n viewPortConfig = defaultViewPortConfigs[viewPortName];\n }\n viewPortPlans[viewPortName] = {\n name: viewPortName,\n strategy: InternalActivationStrategy.Replace,\n config: viewPortConfig\n };\n }\n\n return Promise.resolve(viewPortPlans);\n}\n\n/**\n * Build redirect plan based on config of a navigation instruction\n * @internal exported for unit testing\n */\nexport const buildRedirectPlan = (instruction: NavigationInstruction) => {\n const config = instruction.config;\n const router = instruction.router;\n return router\n ._createNavigationInstruction(config.redirect)\n .then(redirectInstruction => {\n\n const params: Record = {};\n const originalInstructionParams = instruction.params;\n const redirectInstructionParams = redirectInstruction.params;\n\n for (let key in redirectInstructionParams) {\n // If the param on the redirect points to another param, e.g. { route: first/:this, redirect: second/:this }\n let val = redirectInstructionParams[key];\n if (typeof val === 'string' && val[0] === ':') {\n val = val.slice(1);\n // And if that param is found on the original instruction then use it\n if (val in originalInstructionParams) {\n params[key] = originalInstructionParams[val];\n }\n } else {\n params[key] = redirectInstructionParams[key];\n }\n }\n let redirectLocation = router.generate(redirectInstruction.config, params, instruction.options);\n\n // Special handling for child routes\n for (let key in originalInstructionParams) {\n redirectLocation = redirectLocation.replace(`:${key}`, originalInstructionParams[key]);\n }\n\n let queryString = instruction.queryString;\n if (queryString) {\n redirectLocation += '?' + queryString;\n }\n\n return Promise.resolve(new Redirect(redirectLocation));\n });\n};\n\n/**\n * @param viewPortPlans the Plan record that holds information about built plans\n * @internal exported for unit testing\n */\nexport const buildTransitionPlans = (\n currentInstruction: NavigationInstruction,\n previousInstruction: NavigationInstruction,\n defaultViewPortConfigs: Record,\n forceLifecycleMinimum?: boolean\n): Promise => {\n\n let viewPortPlans: ViewPortPlansRecord = {};\n let newInstructionConfig = currentInstruction.config;\n let hasNewParams = hasDifferentParameterValues(previousInstruction, currentInstruction);\n let pending: Promise[] = [];\n let previousViewPortInstructions = previousInstruction.viewPortInstructions as Record;\n\n for (let viewPortName in previousViewPortInstructions) {\n\n const prevViewPortInstruction = previousViewPortInstructions[viewPortName];\n const prevViewPortComponent = prevViewPortInstruction.component;\n const newInstructionViewPortConfigs = newInstructionConfig.viewPorts as Record;\n\n // if this is invoked on a viewport without any changes, based on new url,\n // newViewPortConfig will be the existing viewport instruction\n let nextViewPortConfig = viewPortName in newInstructionViewPortConfigs\n ? newInstructionViewPortConfigs[viewPortName]\n : prevViewPortInstruction;\n\n if (nextViewPortConfig.moduleId === null && viewPortName in defaultViewPortConfigs) {\n nextViewPortConfig = defaultViewPortConfigs[viewPortName];\n }\n\n const viewPortActivationStrategy = determineActivationStrategy(\n currentInstruction,\n prevViewPortInstruction,\n nextViewPortConfig,\n hasNewParams,\n forceLifecycleMinimum\n );\n const viewPortPlan = viewPortPlans[viewPortName] = {\n name: viewPortName,\n // ViewPortInstruction can quack like a RouteConfig\n config: nextViewPortConfig as RouteConfig,\n prevComponent: prevViewPortComponent,\n prevModuleId: prevViewPortInstruction.moduleId,\n strategy: viewPortActivationStrategy\n } as ViewPortPlan;\n\n // recursively build nav plans for all existing child routers/viewports of this viewport\n // this is possible because existing child viewports and routers already have necessary information\n // to process the wildcard path from parent instruction\n if (viewPortActivationStrategy !== InternalActivationStrategy.Replace && prevViewPortInstruction.childRouter) {\n const path = currentInstruction.getWildcardPath();\n const task: Promise = prevViewPortInstruction\n .childRouter\n ._createNavigationInstruction(path, currentInstruction)\n .then((childInstruction: NavigationInstruction) => {\n viewPortPlan.childNavigationInstruction = childInstruction;\n\n return _buildNavigationPlan(\n childInstruction,\n // is it safe to assume viewPortPlan has not been changed from previous assignment?\n // if so, can just use local variable viewPortPlanStrategy\n // there could be user code modifying viewport plan during _createNavigationInstruction?\n viewPortPlan.strategy === InternalActivationStrategy.InvokeLifecycle\n )\n .then(childPlan => {\n if (childPlan instanceof Redirect) {\n return Promise.reject(childPlan);\n }\n childInstruction.plan = childPlan;\n // for bluebird ?\n return null;\n });\n });\n\n pending.push(task);\n }\n }\n\n return Promise.all(pending).then(() => viewPortPlans);\n};\n\n/**\n * @param newViewPortConfig if this is invoked on a viewport without any changes, based on new url, newViewPortConfig will be the existing viewport instruction\n * @internal exported for unit testing\n */\nexport const determineActivationStrategy = (\n currentNavInstruction: NavigationInstruction,\n prevViewPortInstruction: ViewPortInstruction,\n newViewPortConfig: RouteConfig | ViewPortInstruction,\n // indicates whether there is difference between old and new url params\n hasNewParams: boolean,\n forceLifecycleMinimum?: boolean\n): ActivationStrategyType => {\n\n let newInstructionConfig = currentNavInstruction.config;\n let prevViewPortViewModel = prevViewPortInstruction.component.viewModel;\n let viewPortPlanStrategy: ActivationStrategyType;\n\n if (prevViewPortInstruction.moduleId !== newViewPortConfig.moduleId) {\n viewPortPlanStrategy = InternalActivationStrategy.Replace;\n } else if ('determineActivationStrategy' in prevViewPortViewModel) {\n viewPortPlanStrategy = prevViewPortViewModel.determineActivationStrategy(...currentNavInstruction.lifecycleArgs);\n } else if (newInstructionConfig.activationStrategy) {\n viewPortPlanStrategy = newInstructionConfig.activationStrategy;\n } else if (hasNewParams || forceLifecycleMinimum) {\n viewPortPlanStrategy = InternalActivationStrategy.InvokeLifecycle;\n } else {\n viewPortPlanStrategy = InternalActivationStrategy.NoChange;\n }\n return viewPortPlanStrategy;\n};\n\n/**@internal exported for unit testing */\nexport const hasDifferentParameterValues = (prev: NavigationInstruction, next: NavigationInstruction): boolean => {\n let prevParams = prev.params;\n let nextParams = next.params;\n let nextWildCardName = next.config.hasChildRouter ? next.getWildCardName() : null;\n\n for (let key in nextParams) {\n if (key === nextWildCardName) {\n continue;\n }\n\n if (prevParams[key] !== nextParams[key]) {\n return true;\n }\n }\n\n for (let key in prevParams) {\n if (key === nextWildCardName) {\n continue;\n }\n\n if (prevParams[key] !== nextParams[key]) {\n return true;\n }\n }\n\n if (!next.options.compareQueryParams) {\n return false;\n }\n\n let prevQueryParams = prev.queryParams;\n let nextQueryParams = next.queryParams;\n for (let key in nextQueryParams) {\n if (prevQueryParams[key] !== nextQueryParams[key]) {\n return true;\n }\n }\n\n for (let key in prevQueryParams) {\n if (prevQueryParams[key] !== nextQueryParams[key]) {\n return true;\n }\n }\n\n return false;\n};\n","import { Next } from './interfaces';\nimport { Redirect } from './navigation-commands';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { _buildNavigationPlan } from './navigation-plan';\n\n/**\n * Transform a navigation instruction into viewport plan record object,\n * or a redirect request if user viewmodel demands\n */\nexport class BuildNavigationPlanStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise {\n return _buildNavigationPlan(navigationInstruction)\n .then(plan => {\n if (plan instanceof Redirect) {\n return next.cancel(plan);\n }\n navigationInstruction.plan = plan;\n return next();\n })\n .catch(next.cancel);\n }\n}\n","import { RouteConfig, ViewPortComponent, ViewPortPlan, ViewPortInstruction } from './interfaces';\nimport { Redirect } from './navigation-commands';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { _buildNavigationPlan } from './navigation-plan';\nimport { InternalActivationStrategy } from './activation-strategy';\nimport { RouteLoader } from './route-loader';\n\n/**\n * Loading plan calculated based on a navigration-instruction and a viewport plan\n */\ninterface ILoadingPlan {\n viewPortPlan: ViewPortPlan;\n navigationInstruction: NavigationInstruction;\n}\n\n/**\n * @internal Exported for unit testing\n */\nexport const loadNewRoute = (\n routeLoader: RouteLoader,\n navigationInstruction: NavigationInstruction\n): Promise => {\n let loadingPlans = determineLoadingPlans(navigationInstruction);\n let loadPromises = loadingPlans.map((loadingPlan: ILoadingPlan) => loadRoute(\n routeLoader,\n loadingPlan.navigationInstruction,\n loadingPlan.viewPortPlan\n ));\n\n return Promise.all(loadPromises);\n};\n\n/**\n * @internal Exported for unit testing\n */\nexport const determineLoadingPlans = (\n navigationInstruction: NavigationInstruction,\n loadingPlans: ILoadingPlan[] = []\n): ILoadingPlan[] => {\n let viewPortPlans: Record = navigationInstruction.plan;\n\n for (let viewPortName in viewPortPlans) {\n let viewPortPlan = viewPortPlans[viewPortName];\n let childNavInstruction = viewPortPlan.childNavigationInstruction;\n\n if (viewPortPlan.strategy === InternalActivationStrategy.Replace) {\n loadingPlans.push({ viewPortPlan, navigationInstruction } as ILoadingPlan);\n\n if (childNavInstruction) {\n determineLoadingPlans(childNavInstruction, loadingPlans);\n }\n } else {\n let viewPortInstruction = navigationInstruction.addViewPortInstruction({\n name: viewPortName,\n strategy: viewPortPlan.strategy,\n moduleId: viewPortPlan.prevModuleId,\n component: viewPortPlan.prevComponent\n }) as ViewPortInstruction;\n\n if (childNavInstruction) {\n viewPortInstruction.childNavigationInstruction = childNavInstruction;\n determineLoadingPlans(childNavInstruction, loadingPlans);\n }\n }\n }\n\n return loadingPlans;\n};\n\n/**\n * @internal Exported for unit testing\n */\nexport const loadRoute = (\n routeLoader: RouteLoader,\n navigationInstruction: NavigationInstruction,\n viewPortPlan: ViewPortPlan\n): Promise => {\n let planConfig = viewPortPlan.config;\n let moduleId = planConfig ? planConfig.moduleId : null;\n\n return loadComponent(routeLoader, navigationInstruction, planConfig)\n .then((component) => {\n let viewPortInstruction = navigationInstruction.addViewPortInstruction({\n name: viewPortPlan.name,\n strategy: viewPortPlan.strategy,\n moduleId: moduleId,\n component: component\n }) as ViewPortInstruction;\n\n let childRouter = component.childRouter;\n if (childRouter) {\n let path = navigationInstruction.getWildcardPath();\n\n return childRouter\n ._createNavigationInstruction(path, navigationInstruction)\n .then((childInstruction) => {\n viewPortPlan.childNavigationInstruction = childInstruction;\n\n return _buildNavigationPlan(childInstruction)\n .then((childPlan) => {\n if (childPlan instanceof Redirect) {\n return Promise.reject(childPlan);\n }\n childInstruction.plan = childPlan;\n viewPortInstruction.childNavigationInstruction = childInstruction;\n\n return loadNewRoute(routeLoader, childInstruction);\n });\n });\n }\n // ts complains without this, though they are same\n return void 0;\n });\n};\n\n/**\n * Load a routed-component based on navigation instruction and route config\n * @internal exported for unit testing only\n */\nexport const loadComponent = (\n routeLoader: RouteLoader,\n navigationInstruction: NavigationInstruction,\n config: RouteConfig\n): Promise => {\n let router = navigationInstruction.router;\n let lifecycleArgs = navigationInstruction.lifecycleArgs;\n\n return Promise.resolve()\n .then(() => routeLoader.loadRoute(router, config, navigationInstruction))\n .then(\n /**\n * @param component an object carrying information about loaded route\n * typically contains information about view model, childContainer, view and router\n */\n (component: ViewPortComponent) => {\n let { viewModel, childContainer } = component;\n component.router = router;\n component.config = config;\n\n if ('configureRouter' in viewModel) {\n let childRouter = childContainer.getChildRouter();\n component.childRouter = childRouter;\n\n return childRouter\n .configure(c => viewModel.configureRouter(c, childRouter, lifecycleArgs[0], lifecycleArgs[1], lifecycleArgs[2]))\n .then(() => component);\n }\n\n return component;\n }\n );\n};\n","import { RouteConfig } from './interfaces';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { Router } from './router';\n\n/**\n * Abstract class that is responsible for loading view / view model from a route config\n * The default implementation can be found in `aurelia-templating-router`\n */\nexport class RouteLoader {\n /**\n * Load a route config based on its viewmodel / view configuration\n */\n // return typing: return typings used to be never\n // as it was a throw. Changing it to Promise should not cause any issues\n loadRoute(router: Router, config: RouteConfig, navigationInstruction: NavigationInstruction): Promise {\n throw new Error('Route loaders must implement \"loadRoute(router, config, navigationInstruction)\".');\n }\n}\n","import { Next } from './interfaces';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { loadNewRoute } from './utilities-route-loading';\nimport { RouteLoader } from './route-loader';\n/**\n * A pipeline step responsible for loading a route config of a navigation instruction\n */\nexport class LoadRouteStep {\n /**@internal */\n static inject() { return [RouteLoader]; }\n /**\n * Route loader isntance that will handle loading route config\n * @internal\n */\n routeLoader: RouteLoader;\n constructor(routeLoader: RouteLoader) {\n this.routeLoader = routeLoader;\n }\n /**\n * Run the internal to load route config of a navigation instruction to prepare for next steps in the pipeline\n */\n run(navigationInstruction: NavigationInstruction, next: Next): Promise {\n return loadNewRoute(this.routeLoader, navigationInstruction)\n .then(next, next.cancel);\n }\n}\n","import { NavigationInstruction } from './navigation-instruction';\n\n/**\n * A pipeline step for instructing a piepline to commit changes on a navigation instruction\n */\nexport class CommitChangesStep {\n run(navigationInstruction: NavigationInstruction, next: Function): Promise {\n return navigationInstruction\n ._commitChanges(/*wait to swap?*/ true)\n .then(() => {\n navigationInstruction._updateTitle();\n return next();\n });\n }\n}\n","/**\n * An optional interface describing the available activation strategies.\n * @internal Used internally.\n */\nexport const enum InternalActivationStrategy {\n /**\n * Reuse the existing view model, without invoking Router lifecycle hooks.\n */\n NoChange = 'no-change',\n /**\n * Reuse the existing view model, invoking Router lifecycle hooks.\n */\n InvokeLifecycle = 'invoke-lifecycle',\n /**\n * Replace the existing view model, invoking Router lifecycle hooks.\n */\n Replace = 'replace'\n}\n\n/**\n * The strategy to use when activating modules during navigation.\n */\n// kept for compat reason\nexport const activationStrategy: ActivationStrategy = {\n noChange: InternalActivationStrategy.NoChange,\n invokeLifecycle: InternalActivationStrategy.InvokeLifecycle,\n replace: InternalActivationStrategy.Replace\n};\n\n/**\n * An optional interface describing the available activation strategies.\n */\nexport interface ActivationStrategy {\n /**\n * Reuse the existing view model, without invoking Router lifecycle hooks.\n */\n noChange: 'no-change';\n /**\n * Reuse the existing view model, invoking Router lifecycle hooks.\n */\n invokeLifecycle: 'invoke-lifecycle';\n /**\n * Replace the existing view model, invoking Router lifecycle hooks.\n */\n replace: 'replace';\n}\n\n/**\n * Enum like type for activation strategy built-in values\n */\nexport type ActivationStrategyType = ActivationStrategy[keyof ActivationStrategy];\n","import { Next, ViewPortComponent, ViewPortPlan, ViewPortInstruction, LifecycleArguments } from './interfaces';\nimport { isNavigationCommand } from './navigation-commands';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { activationStrategy } from './activation-strategy';\nimport { Router } from './router';\n\n/**\n * Recursively find list of deactivate-able view models\n * and invoke the either 'canDeactivate' or 'deactivate' on each\n * @internal exported for unit testing\n */\nexport const processDeactivatable = (\n navigationInstruction: NavigationInstruction,\n callbackName: 'canDeactivate' | 'deactivate',\n next: Next,\n ignoreResult?: boolean\n): Promise => {\n let plan: Record = navigationInstruction.plan;\n let infos = findDeactivatable(plan, callbackName);\n let i = infos.length; // query from inside out\n\n function inspect(val: any): Promise {\n if (ignoreResult || shouldContinue(val)) {\n return iterate();\n }\n\n return next.cancel(val);\n }\n\n function iterate(): Promise {\n if (i--) {\n try {\n let viewModel = infos[i];\n let result = viewModel[callbackName](navigationInstruction);\n return processPotential(result, inspect, next.cancel);\n } catch (error) {\n return next.cancel(error);\n }\n }\n\n navigationInstruction.router.couldDeactivate = true;\n\n return next();\n }\n\n return iterate();\n};\n\n/**\n * Recursively find and returns a list of deactivate-able view models\n * @internal exported for unit testing\n */\nexport const findDeactivatable = (\n plan: Record,\n callbackName: string,\n list: IActivatableInfo[] = []\n): any[] => {\n for (let viewPortName in plan) {\n let viewPortPlan = plan[viewPortName];\n let prevComponent = viewPortPlan.prevComponent;\n\n if ((viewPortPlan.strategy === activationStrategy.invokeLifecycle || viewPortPlan.strategy === activationStrategy.replace)\n && prevComponent\n ) {\n let viewModel = prevComponent.viewModel;\n\n if (callbackName in viewModel) {\n list.push(viewModel);\n }\n }\n\n if (viewPortPlan.strategy === activationStrategy.replace && prevComponent) {\n addPreviousDeactivatable(prevComponent, callbackName, list);\n } else if (viewPortPlan.childNavigationInstruction) {\n findDeactivatable(viewPortPlan.childNavigationInstruction.plan, callbackName, list);\n }\n }\n\n return list;\n};\n\n/**\n * @internal exported for unit testing\n */\nexport const addPreviousDeactivatable = (\n component: ViewPortComponent,\n callbackName: string,\n list: IActivatableInfo[]\n): void => {\n let childRouter = component.childRouter;\n\n if (childRouter && childRouter.currentInstruction) {\n let viewPortInstructions = childRouter.currentInstruction.viewPortInstructions;\n\n for (let viewPortName in viewPortInstructions) {\n let viewPortInstruction = viewPortInstructions[viewPortName];\n let prevComponent = viewPortInstruction.component;\n let prevViewModel = prevComponent.viewModel;\n\n if (callbackName in prevViewModel) {\n list.push(prevViewModel);\n }\n\n addPreviousDeactivatable(prevComponent, callbackName, list);\n }\n }\n};\n\n/**\n * @internal exported for unit testing\n */\nexport const processActivatable = (\n navigationInstruction: NavigationInstruction,\n callbackName: 'canActivate' | 'activate',\n next: Next,\n ignoreResult?: boolean\n): Promise => {\n let infos = findActivatable(navigationInstruction, callbackName);\n let length = infos.length;\n let i = -1; // query from top down\n\n function inspect(val: any, router: Router): Promise {\n if (ignoreResult || shouldContinue(val, router)) {\n return iterate();\n }\n\n return next.cancel(val);\n }\n\n function iterate(): Promise {\n i++;\n\n if (i < length) {\n try {\n let current = infos[i];\n let result = current.viewModel[callbackName](...current.lifecycleArgs);\n return processPotential(result, (val: any) => inspect(val, current.router), next.cancel);\n } catch (error) {\n return next.cancel(error);\n }\n }\n\n return next();\n }\n\n return iterate();\n};\n\ninterface IActivatableInfo {\n viewModel: any;\n lifecycleArgs: LifecycleArguments;\n router: Router;\n}\n\n/**\n * Find list of activatable view model and add to list (3rd parameter)\n * @internal exported for unit testing\n */\nexport const findActivatable = (\n navigationInstruction: NavigationInstruction,\n callbackName: 'canActivate' | 'activate',\n list: IActivatableInfo[] = [],\n router?: Router\n): IActivatableInfo[] => {\n let plan: Record = navigationInstruction.plan;\n\n Object\n .keys(plan)\n .forEach((viewPortName) => {\n let viewPortPlan = plan[viewPortName];\n let viewPortInstruction = navigationInstruction.viewPortInstructions[viewPortName] as ViewPortInstruction;\n let viewPortComponent = viewPortInstruction.component;\n let viewModel = viewPortComponent.viewModel;\n\n if (\n (viewPortPlan.strategy === activationStrategy.invokeLifecycle\n || viewPortPlan.strategy === activationStrategy.replace\n )\n && callbackName in viewModel\n ) {\n list.push({\n viewModel,\n lifecycleArgs: viewPortInstruction.lifecycleArgs,\n router\n });\n }\n\n let childNavInstruction = viewPortPlan.childNavigationInstruction;\n\n if (childNavInstruction) {\n findActivatable(\n childNavInstruction,\n callbackName,\n list,\n viewPortComponent.childRouter || router\n );\n }\n });\n\n return list;\n};\n\nconst shouldContinue = (output: T, router?: Router): boolean | T => {\n if (output instanceof Error) {\n return false;\n }\n\n if (isNavigationCommand(output)) {\n if (typeof output.setRouter === 'function') {\n output.setRouter(router);\n }\n\n return !!output.shouldContinueProcessing;\n }\n\n if (output === undefined) {\n return true;\n }\n\n return output;\n};\n\n/**\n * A basic interface for an Observable type\n */\nexport interface IObservable {\n subscribe(sub?: IObservableConfig): ISubscription;\n}\n\nexport interface IObservableConfig {\n next(): void;\n error(err?: any): void;\n complete(): void;\n}\n\n/**\n * A basic interface for a Subscription to an Observable\n */\ninterface ISubscription {\n unsubscribe(): void;\n}\n\ntype SafeSubscriptionFunc = (sub: SafeSubscription) => ISubscription;\n\n/**\n * wraps a subscription, allowing unsubscribe calls even if\n * the first value comes synchronously\n */\nclass SafeSubscription {\n\n private _subscribed: boolean;\n private _subscription: ISubscription;\n\n constructor(subscriptionFunc: SafeSubscriptionFunc) {\n this._subscribed = true;\n this._subscription = subscriptionFunc(this);\n\n if (!this._subscribed) {\n this.unsubscribe();\n }\n }\n\n get subscribed(): boolean {\n return this._subscribed;\n }\n\n unsubscribe(): void {\n if (this._subscribed && this._subscription) {\n this._subscription.unsubscribe();\n }\n\n this._subscribed = false;\n }\n}\n\n/**\n * A function to process return value from `activate`/`canActivate` steps\n * Supports observable/promise\n *\n * For observable, resolve at first next() or on complete()\n */\nconst processPotential = (obj: any, resolve: (val?: any) => any, reject: (err?: any) => any): any => {\n // if promise like\n if (obj && typeof obj.then === 'function') {\n return Promise.resolve(obj).then(resolve).catch(reject);\n }\n\n // if observable\n if (obj && typeof obj.subscribe === 'function') {\n let obs: IObservable = obj;\n return new SafeSubscription(sub => obs.subscribe({\n next() {\n if (sub.subscribed) {\n sub.unsubscribe();\n resolve(obj);\n }\n },\n error(error) {\n if (sub.subscribed) {\n sub.unsubscribe();\n reject(error);\n }\n },\n complete() {\n if (sub.subscribed) {\n sub.unsubscribe();\n resolve(obj);\n }\n }\n }));\n }\n\n // else just resolve\n try {\n return resolve(obj);\n } catch (error) {\n return reject(error);\n }\n};\n","import { Next } from './interfaces';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { processDeactivatable, processActivatable } from './utilities-activation';\n\n/**\n * A pipeline step responsible for finding and activating method `canDeactivate` on a view model of a route\n */\nexport class CanDeactivatePreviousStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise {\n return processDeactivatable(navigationInstruction, 'canDeactivate', next);\n }\n}\n\n/**\n * A pipeline step responsible for finding and activating method `canActivate` on a view model of a route\n */\nexport class CanActivateNextStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise {\n return processActivatable(navigationInstruction, 'canActivate', next);\n }\n}\n\n/**\n * A pipeline step responsible for finding and activating method `deactivate` on a view model of a route\n */\nexport class DeactivatePreviousStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise {\n return processDeactivatable(navigationInstruction, 'deactivate', next, true);\n }\n}\n\n/**\n * A pipeline step responsible for finding and activating method `activate` on a view model of a route\n */\nexport class ActivateNextStep {\n run(navigationInstruction: NavigationInstruction, next: Next): Promise {\n return processActivatable(navigationInstruction, 'activate', next, true);\n }\n}\n","import { Container } from 'aurelia-dependency-injection';\nimport { Pipeline } from './pipeline';\nimport { BuildNavigationPlanStep } from './step-build-navigation-plan';\nimport { LoadRouteStep } from './step-load-route';\nimport { CommitChangesStep } from './step-commit-changes';\nimport { CanDeactivatePreviousStep, CanActivateNextStep, DeactivatePreviousStep, ActivateNextStep } from './step-activation';\nimport { PipelineStep, StepRunnerFunction, IPipelineSlot } from './interfaces';\nimport { PipelineSlotName } from './pipeline-slot-name';\n\n/**\n * A multi-slots Pipeline Placeholder Step for hooking into a pipeline execution\n */\nclass PipelineSlot implements IPipelineSlot {\n\n /**@internal */\n container: Container;\n /**@internal */\n slotName: string;\n /**@internal */\n slotAlias?: string;\n\n steps: (Function | PipelineStep)[] = [];\n\n constructor(container: Container, name: string, alias?: string) {\n this.container = container;\n this.slotName = name;\n this.slotAlias = alias;\n }\n\n getSteps(): (StepRunnerFunction | IPipelineSlot | PipelineStep)[] {\n return this.steps.map(x => this.container.get(x));\n }\n}\n\n/**\n * Class responsible for creating the navigation pipeline.\n */\nexport class PipelineProvider {\n\n /**@internal */\n static inject() { return [Container]; }\n /**@internal */\n container: Container;\n /**@internal */\n steps: (Function | PipelineSlot)[];\n\n constructor(container: Container) {\n this.container = container;\n this.steps = [\n BuildNavigationPlanStep,\n CanDeactivatePreviousStep, // optional\n LoadRouteStep,\n createPipelineSlot(container, PipelineSlotName.Authorize),\n CanActivateNextStep, // optional\n createPipelineSlot(container, PipelineSlotName.PreActivate, 'modelbind'),\n // NOTE: app state changes start below - point of no return\n DeactivatePreviousStep, // optional\n ActivateNextStep, // optional\n createPipelineSlot(container, PipelineSlotName.PreRender, 'precommit'),\n CommitChangesStep,\n createPipelineSlot(container, PipelineSlotName.PostRender, 'postcomplete')\n ];\n }\n\n /**\n * Create the navigation pipeline.\n */\n createPipeline(useCanDeactivateStep: boolean = true): Pipeline {\n let pipeline = new Pipeline();\n this.steps.forEach(step => {\n if (useCanDeactivateStep || step !== CanDeactivatePreviousStep) {\n pipeline.addStep(this.container.get(step));\n }\n });\n return pipeline;\n }\n\n /**@internal */\n _findStep(name: string): PipelineSlot {\n // Steps that are not PipelineSlots are constructor functions, and they will automatically fail. Probably.\n return this.steps.find(x => (x as PipelineSlot).slotName === name || (x as PipelineSlot).slotAlias === name) as PipelineSlot;\n }\n\n /**\n * Adds a step into the pipeline at a known slot location.\n */\n addStep(name: string, step: PipelineStep | Function): void {\n let found = this._findStep(name);\n if (found) {\n let slotSteps = found.steps;\n // prevent duplicates\n if (!slotSteps.includes(step)) {\n slotSteps.push(step);\n }\n } else {\n throw new Error(`Invalid pipeline slot name: ${name}.`);\n }\n }\n\n /**\n * Removes a step from a slot in the pipeline\n */\n removeStep(name: string, step: PipelineStep): void {\n let slot = this._findStep(name);\n if (slot) {\n let slotSteps = slot.steps;\n slotSteps.splice(slotSteps.indexOf(step), 1);\n }\n }\n\n /**\n * Clears all steps from a slot in the pipeline\n * @internal\n */\n _clearSteps(name: string = ''): void {\n let slot = this._findStep(name);\n if (slot) {\n slot.steps = [];\n }\n }\n\n /**\n * Resets all pipeline slots\n */\n reset(): void {\n this._clearSteps(PipelineSlotName.Authorize);\n this._clearSteps(PipelineSlotName.PreActivate);\n this._clearSteps(PipelineSlotName.PreRender);\n this._clearSteps(PipelineSlotName.PostRender);\n }\n}\n\n/**@internal */\nconst createPipelineSlot = (container: Container, name: PipelineSlotName, alias?: string): PipelineSlot => {\n return new PipelineSlot(container, name, alias);\n};\n","import * as LogManager from 'aurelia-logging';\nimport { Container } from 'aurelia-dependency-injection';\nimport { History, NavigationOptions } from 'aurelia-history';\nimport { Router } from './router';\nimport { PipelineProvider } from './pipeline-provider';\nimport { isNavigationCommand } from './navigation-commands';\nimport { EventAggregator } from 'aurelia-event-aggregator';\nimport { NavigationInstruction } from './navigation-instruction';\nimport { ViewPort, ConfiguresRouter, PipelineResult } from './interfaces';\nimport { RouterEvent } from './router-event';\nimport { RouterConfiguration } from './router-configuration';\n\n/**@internal */\ndeclare module 'aurelia-dependency-injection' {\n interface Container {\n viewModel?: any;\n }\n}\n\nconst logger = LogManager.getLogger('app-router');\n\n/**\n * The main application router.\n */\nexport class AppRouter extends Router {\n\n /**@internal */\n static inject() { return [Container, History, PipelineProvider, EventAggregator]; }\n\n events: EventAggregator;\n /**@internal */\n maxInstructionCount: number;\n /**@internal */\n _queue: NavigationInstruction[];\n /**@internal */\n isActive: boolean;\n\n constructor(container: Container, history: History, pipelineProvider: PipelineProvider, events: EventAggregator) {\n super(container, history); // Note the super will call reset internally.\n this.pipelineProvider = pipelineProvider;\n this.events = events;\n }\n\n /**\n * Fully resets the router's internal state. Primarily used internally by the framework when multiple calls to setRoot are made.\n * Use with caution (actually, avoid using this). Do not use this to simply change your navigation model.\n */\n reset(): void {\n super.reset();\n this.maxInstructionCount = 10;\n if (!this._queue) {\n this._queue = [];\n } else {\n this._queue.length = 0;\n }\n }\n\n /**\n * Loads the specified URL.\n *\n * @param url The URL fragment to load.\n */\n loadUrl(url: string): Promise {\n return this\n ._createNavigationInstruction(url)\n .then(instruction => this._queueInstruction(instruction))\n .catch(error => {\n logger.error(error);\n restorePreviousLocation(this);\n });\n }\n\n /**\n * Registers a viewPort to be used as a rendering target for activated routes.\n *\n * @param viewPort The viewPort. This is typically a element in Aurelia default impl\n * @param name The name of the viewPort. 'default' if unspecified.\n */\n registerViewPort(viewPort: /*ViewPort*/ any, name?: string): Promise {\n // having strong typing without changing public API\n const $viewPort: ViewPort = viewPort;\n super.registerViewPort($viewPort, name);\n\n // beside adding viewport to the registry of this instance\n // AppRouter also configure routing/history to start routing functionality\n // There are situation where there are more than 1 element at root view\n // in that case, still only activate once via the following guard\n if (!this.isActive) {\n const viewModel = this._findViewModel($viewPort);\n if ('configureRouter' in viewModel) {\n // If there are more than one element at root view\n // use this flag to guard against configure method being invoked multiple times\n // this flag is set inside method configure\n if (!this.isConfigured) {\n // replace the real resolve with a noop to guarantee that any action in base class Router\n // won't resolve the configurePromise prematurely\n const resolveConfiguredPromise = this._resolveConfiguredPromise;\n this._resolveConfiguredPromise = () => {/**/};\n return this\n .configure(config =>\n Promise\n .resolve(viewModel.configureRouter(config, this))\n // an issue with configure interface. Should be fixed there\n // todo: fix this via configure interface in router\n .then(() => config) as any\n )\n .then(() => {\n this.activate();\n resolveConfiguredPromise();\n });\n }\n } else {\n this.activate();\n }\n }\n // when a viewport is added dynamically to a root view that is already activated\n // just process the navigation instruction\n else {\n this._dequeueInstruction();\n }\n\n return Promise.resolve();\n }\n\n /**\n * Activates the router. This instructs the router to begin listening for history changes and processing instructions.\n *\n * @params options The set of options to activate the router with.\n */\n activate(options?: NavigationOptions): void {\n if (this.isActive) {\n return;\n }\n\n this.isActive = true;\n // route handler property is responsible for handling url change\n // the interface of aurelia-history isn't clear on this perspective\n this.options = Object.assign({ routeHandler: this.loadUrl.bind(this) }, this.options, options);\n this.history.activate(this.options);\n this._dequeueInstruction();\n }\n\n /**\n * Deactivates the router.\n */\n deactivate(): void {\n this.isActive = false;\n this.history.deactivate();\n }\n\n /**@internal */\n _queueInstruction(instruction: NavigationInstruction): Promise {\n return new Promise((resolve) => {\n instruction.resolve = resolve;\n this._queue.unshift(instruction);\n this._dequeueInstruction();\n });\n }\n\n /**@internal */\n _dequeueInstruction(instructionCount: number = 0): Promise {\n return Promise.resolve().then(() => {\n if (this.isNavigating && !instructionCount) {\n // ts complains about inconsistent returns without void 0\n return void 0;\n }\n\n let instruction = this._queue.shift();\n this._queue.length = 0;\n\n if (!instruction) {\n // ts complains about inconsistent returns without void 0\n return void 0;\n }\n\n this.isNavigating = true;\n\n let navtracker: number = this.history.getState('NavigationTracker');\n let currentNavTracker = this.currentNavigationTracker;\n\n if (!navtracker && !currentNavTracker) {\n this.isNavigatingFirst = true;\n this.isNavigatingNew = true;\n } else if (!navtracker) {\n this.isNavigatingNew = true;\n } else if (!currentNavTracker) {\n this.isNavigatingRefresh = true;\n } else if (currentNavTracker < navtracker) {\n this.isNavigatingForward = true;\n } else if (currentNavTracker > navtracker) {\n this.isNavigatingBack = true;\n } if (!navtracker) {\n navtracker = Date.now();\n this.history.setState('NavigationTracker', navtracker);\n }\n this.currentNavigationTracker = navtracker;\n\n instruction.previousInstruction = this.currentInstruction;\n\n let maxInstructionCount = this.maxInstructionCount;\n\n if (!instructionCount) {\n this.events.publish(RouterEvent.Processing, { instruction });\n } else if (instructionCount === maxInstructionCount - 1) {\n logger.error(`${instructionCount + 1} navigation instructions have been attempted without success. Restoring last known good location.`);\n restorePreviousLocation(this);\n return this._dequeueInstruction(instructionCount + 1);\n } else if (instructionCount > maxInstructionCount) {\n throw new Error('Maximum navigation attempts exceeded. Giving up.');\n }\n\n let pipeline = this.pipelineProvider.createPipeline(!this.couldDeactivate);\n\n return pipeline\n .run(instruction)\n .then(result => processResult(instruction, result, instructionCount, this))\n .catch(error => {\n return { output: error instanceof Error ? error : new Error(error) } as PipelineResult;\n })\n .then(result => resolveInstruction(instruction, result, !!instructionCount, this));\n });\n }\n\n /**@internal */\n _findViewModel(viewPort: ViewPort): ConfiguresRouter | undefined {\n if (this.container.viewModel) {\n return this.container.viewModel;\n }\n\n if (viewPort.container) {\n let container = viewPort.container;\n\n while (container) {\n if (container.viewModel) {\n this.container.viewModel = container.viewModel;\n return container.viewModel;\n }\n\n container = container.parent;\n }\n }\n\n return undefined;\n }\n}\n\nconst processResult = (\n instruction: NavigationInstruction,\n result: PipelineResult,\n instructionCount: number,\n router: AppRouter\n): Promise => {\n if (!(result && 'completed' in result && 'output' in result)) {\n result = result || {} as PipelineResult;\n result.output = new Error(`Expected router pipeline to return a navigation result, but got [${JSON.stringify(result)}] instead.`);\n }\n\n let finalResult: PipelineResult = null;\n let navigationCommandResult = null;\n if (isNavigationCommand(result.output)) {\n navigationCommandResult = result.output.navigate(router);\n } else {\n finalResult = result;\n\n if (!result.completed) {\n if (result.output instanceof Error) {\n logger.error(result.output.toString());\n }\n\n restorePreviousLocation(router);\n }\n }\n\n return Promise.resolve(navigationCommandResult)\n .then(_ => router._dequeueInstruction(instructionCount + 1))\n .then(innerResult => finalResult || innerResult || result);\n};\n\nconst resolveInstruction = (\n instruction: NavigationInstruction,\n result: PipelineResult,\n isInnerInstruction: boolean,\n router: AppRouter\n): PipelineResult => {\n instruction.resolve(result);\n\n let eventAggregator = router.events;\n let eventArgs = { instruction, result };\n if (!isInnerInstruction) {\n router.isNavigating = false;\n router.isExplicitNavigation = false;\n router.isExplicitNavigationBack = false;\n router.isNavigatingFirst = false;\n router.isNavigatingNew = false;\n router.isNavigatingRefresh = false;\n router.isNavigatingForward = false;\n router.isNavigatingBack = false;\n router.couldDeactivate = false;\n\n let eventName: string;\n\n if (result.output instanceof Error) {\n eventName = RouterEvent.Error;\n } else if (!result.completed) {\n eventName = RouterEvent.Canceled;\n } else {\n let queryString = instruction.queryString ? ('?' + instruction.queryString) : '';\n router.history.previousLocation = instruction.fragment + queryString;\n eventName = RouterEvent.Success;\n }\n\n eventAggregator.publish(eventName, eventArgs);\n eventAggregator.publish(RouterEvent.Complete, eventArgs);\n } else {\n eventAggregator.publish(RouterEvent.ChildComplete, eventArgs);\n }\n\n return result;\n};\n\nconst restorePreviousLocation = (router: AppRouter): void => {\n let previousLocation = router.history.previousLocation;\n if (previousLocation) {\n router.navigate(previousLocation, { trigger: false, replace: true });\n } else if (router.fallbackRoute) {\n router.navigate(router.fallbackRoute, { trigger: true, replace: true });\n } else {\n logger.error('Router navigation failed, and no previous location or fallbackRoute could be restored.');\n }\n};\n","/**\n* The status of a Pipeline.\n*/\nexport const enum PipelineStatus {\n Completed = 'completed',\n Canceled = 'canceled',\n Rejected = 'rejected',\n Running = 'running'\n}\n","/**\n * A list of known router events used by the Aurelia router\n * to signal the pipeline has come to a certain state\n */\n// const enum is preserved in tsconfig\nexport const enum RouterEvent {\n Processing = 'router:navigation:processing',\n Error = 'router:navigation:error',\n Canceled = 'router:navigation:canceled',\n Complete = 'router:navigation:complete',\n Success = 'router:navigation:success',\n ChildComplete = 'router:navigation:child:complete'\n}\n","/**\n * Available pipeline slot names to insert interceptor into router pipeline\n */\n// const enum is preserved in tsconfig\nexport const enum PipelineSlotName {\n /**\n * Authorization slot. Invoked early in the pipeline,\n * before `canActivate` hook of incoming route\n */\n Authorize = 'authorize',\n /**\n * Pre-activation slot. Invoked early in the pipeline,\n * Invoked timing:\n * - after Authorization slot\n * - after canActivate hook on new view model\n * - before deactivate hook on old view model\n * - before activate hook on new view model\n */\n PreActivate = 'preActivate',\n /**\n * Pre-render slot. Invoked later in the pipeline\n * Invokcation timing:\n * - after activate hook on new view model\n * - before commit step on new navigation instruction\n */\n PreRender = 'preRender',\n /**\n * Post-render slot. Invoked last in the pipeline\n */\n PostRender = 'postRender'\n}\n",null,"/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n 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); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n 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; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n 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);\r\n 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); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n",null,null,null,null,null,null,null,"/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n 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); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n 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; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n 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);\r\n 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); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","import { Container } from 'aurelia-dependency-injection';\r\nimport { DOM } from 'aurelia-pal';\r\nimport { TaskQueue } from 'aurelia-task-queue';\r\nimport { bindable, CompositionContext, CompositionEngine, customElement, noView, View, ViewResources, ViewSlot } from 'aurelia-templating';\r\n\r\n/**\r\n * Available activation strategies for the view and view-model bound to `` element\r\n *\r\n * @export\r\n * @enum {string}\r\n */\r\nexport enum ActivationStrategy {\r\n /**\r\n * Default activation strategy; the 'activate' lifecycle hook will be invoked when the model changes.\r\n */\r\n InvokeLifecycle = 'invoke-lifecycle',\r\n /**\r\n * The view/view-model will be recreated, when the \"model\" changes.\r\n */\r\n Replace = 'replace'\r\n}\r\n\r\n/**\r\n * Used to compose a new view / view-model template or bind to an existing instance.\r\n */\r\n@noView\r\n@customElement('compose')\r\nexport class Compose {\r\n\r\n /**@internal */\r\n static inject() {\r\n return [DOM.Element, Container, CompositionEngine, ViewSlot, ViewResources, TaskQueue];\r\n }\r\n\r\n /**\r\n * Model to bind the custom element to.\r\n *\r\n * @property model\r\n * @type {CustomElement}\r\n */\r\n @bindable model: any;\r\n /**\r\n * View to bind the custom element to.\r\n *\r\n * @property view\r\n * @type {HtmlElement}\r\n */\r\n @bindable view: any;\r\n /**\r\n * View-model to bind the custom element's template to.\r\n *\r\n * @property viewModel\r\n * @type {Class}\r\n */\r\n @bindable viewModel: any;\r\n\r\n /**\r\n * Strategy to activate the view-model. Default is \"invoke-lifecycle\".\r\n * Bind \"replace\" to recreate the view/view-model when the model changes.\r\n *\r\n * @property activationStrategy\r\n * @type {ActivationStrategy}\r\n */\r\n @bindable activationStrategy: ActivationStrategy = ActivationStrategy.InvokeLifecycle;\r\n\r\n /**\r\n * SwapOrder to control the swapping order of the custom element's view.\r\n *\r\n * @property view\r\n * @type {String}\r\n */\r\n @bindable swapOrder: any;\r\n\r\n /**\r\n *@internal\r\n */\r\n element: any;\r\n /**\r\n *@internal\r\n */\r\n container: any;\r\n /**\r\n *@internal\r\n */\r\n compositionEngine: any;\r\n /**\r\n *@internal\r\n */\r\n viewSlot: any;\r\n /**\r\n *@internal\r\n */\r\n viewResources: any;\r\n /**\r\n *@internal\r\n */\r\n taskQueue: any;\r\n /**\r\n *@internal\r\n */\r\n currentController: any;\r\n /**\r\n *@internal\r\n */\r\n currentViewModel: any;\r\n /**\r\n *@internal\r\n */\r\n changes: any;\r\n /**\r\n *@internal\r\n */\r\n owningView: View;\r\n /**\r\n *@internal\r\n */\r\n bindingContext: any;\r\n /**\r\n *@internal\r\n */\r\n overrideContext: any;\r\n /**\r\n *@internal\r\n */\r\n pendingTask: any;\r\n /**\r\n *@internal\r\n */\r\n updateRequested: any;\r\n\r\n /**\r\n * Creates an instance of Compose.\r\n * @param element The Compose element.\r\n * @param container The dependency injection container instance.\r\n * @param compositionEngine CompositionEngine instance to compose the element.\r\n * @param viewSlot The slot the view is injected in to.\r\n * @param viewResources Collection of resources used to compile the the view.\r\n * @param taskQueue The TaskQueue instance.\r\n */\r\n constructor(element, container, compositionEngine, viewSlot, viewResources, taskQueue) {\r\n this.element = element;\r\n this.container = container;\r\n this.compositionEngine = compositionEngine;\r\n this.viewSlot = viewSlot;\r\n this.viewResources = viewResources;\r\n this.taskQueue = taskQueue;\r\n this.currentController = null;\r\n this.currentViewModel = null;\r\n this.changes = Object.create(null);\r\n }\r\n\r\n /**\r\n * Invoked when the component has been created.\r\n *\r\n * @param owningView The view that this component was created inside of.\r\n */\r\n created(owningView: View) {\r\n this.owningView = owningView;\r\n }\r\n\r\n /**\r\n * Used to set the bindingContext.\r\n *\r\n * @param bindingContext The context in which the view model is executed in.\r\n * @param overrideContext The context in which the view model is executed in.\r\n */\r\n bind(bindingContext, overrideContext) {\r\n this.bindingContext = bindingContext;\r\n this.overrideContext = overrideContext;\r\n let changes = this.changes;\r\n changes.view = this.view;\r\n changes.viewModel = this.viewModel;\r\n changes.model = this.model;\r\n if (!this.pendingTask) {\r\n processChanges(this);\r\n }\r\n }\r\n\r\n /**\r\n * Unbinds the Compose.\r\n */\r\n unbind() {\r\n this.changes = Object.create(null);\r\n this.bindingContext = null;\r\n this.overrideContext = null;\r\n let returnToCache = true;\r\n let skipAnimation = true;\r\n this.viewSlot.removeAll(returnToCache, skipAnimation);\r\n }\r\n\r\n /**\r\n * Invoked everytime the bound model changes.\r\n * @param newValue The new value.\r\n * @param oldValue The old value.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n modelChanged(newValue, oldValue) {\r\n this.changes.model = newValue;\r\n requestUpdate(this);\r\n }\r\n\r\n /**\r\n * Invoked everytime the bound view changes.\r\n * @param newValue The new value.\r\n * @param oldValue The old value.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n viewChanged(newValue, oldValue) {\r\n this.changes.view = newValue;\r\n requestUpdate(this);\r\n }\r\n\r\n /**\r\n * Invoked everytime the bound view model changes.\r\n * @param newValue The new value.\r\n * @param oldValue The old value.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n viewModelChanged(newValue, oldValue) {\r\n this.changes.viewModel = newValue;\r\n requestUpdate(this);\r\n }\r\n}\r\n\r\nfunction isEmpty(obj) {\r\n for (const _ in obj) {\r\n return false;\r\n }\r\n return true;\r\n}\r\n\r\nfunction tryActivateViewModel(vm, model) {\r\n if (vm && typeof vm.activate === 'function') {\r\n return Promise.resolve(vm.activate(model));\r\n }\r\n}\r\n\r\nfunction createInstruction(composer: Compose, instruction: CompositionContext): CompositionContext {\r\n return Object.assign(instruction, {\r\n bindingContext: composer.bindingContext,\r\n overrideContext: composer.overrideContext,\r\n owningView: composer.owningView,\r\n container: composer.container,\r\n viewSlot: composer.viewSlot,\r\n viewResources: composer.viewResources,\r\n currentController: composer.currentController,\r\n host: composer.element,\r\n swapOrder: composer.swapOrder\r\n });\r\n}\r\n\r\nfunction processChanges(composer: Compose) {\r\n const changes = composer.changes;\r\n composer.changes = Object.create(null);\r\n\r\n if (needsReInitialization(composer, changes)) {\r\n // init context\r\n let instruction = {\r\n view: composer.view,\r\n viewModel: composer.currentViewModel || composer.viewModel,\r\n model: composer.model\r\n } as CompositionContext;\r\n\r\n // apply changes\r\n instruction = Object.assign(instruction, changes);\r\n\r\n // create context\r\n instruction = createInstruction(composer, instruction);\r\n\r\n composer.pendingTask = composer.compositionEngine.compose(instruction).then(controller => {\r\n composer.currentController = controller;\r\n composer.currentViewModel = controller ? controller.viewModel : null;\r\n });\r\n } else {\r\n // just try to activate the current view model\r\n composer.pendingTask = tryActivateViewModel(composer.currentViewModel, changes.model);\r\n if (!composer.pendingTask) { return; }\r\n }\r\n\r\n composer.pendingTask = composer.pendingTask\r\n .then(() => {\r\n completeCompositionTask(composer);\r\n }, reason => {\r\n completeCompositionTask(composer);\r\n throw reason;\r\n });\r\n}\r\n\r\nfunction completeCompositionTask(composer) {\r\n composer.pendingTask = null;\r\n if (!isEmpty(composer.changes)) {\r\n processChanges(composer);\r\n }\r\n}\r\n\r\nfunction requestUpdate(composer: Compose) {\r\n if (composer.pendingTask || composer.updateRequested) { return; }\r\n composer.updateRequested = true;\r\n composer.taskQueue.queueMicroTask(() => {\r\n composer.updateRequested = false;\r\n processChanges(composer);\r\n });\r\n}\r\n\r\nfunction needsReInitialization(composer: Compose, changes: any) {\r\n let activationStrategy = composer.activationStrategy;\r\n const vm = composer.currentViewModel;\r\n if (vm && typeof vm.determineActivationStrategy === 'function') {\r\n activationStrategy = vm.determineActivationStrategy();\r\n }\r\n\r\n return 'view' in changes\r\n || 'viewModel' in changes\r\n || activationStrategy === ActivationStrategy.Replace;\r\n}\r\n","import { ViewFactory, ViewSlot } from 'aurelia-templating';\r\n\r\n/**\r\n * For internal use only. May change without warning.\r\n */\r\nexport class IfCore {\r\n /**\r\n * @internal\r\n */\r\n viewFactory: ViewFactory;\r\n /**\r\n * @internal\r\n */\r\n viewSlot: ViewSlot;\r\n /**\r\n * @internal\r\n */\r\n view: any;\r\n /**\r\n * @internal\r\n */\r\n bindingContext: any;\r\n /**\r\n * @internal\r\n */\r\n overrideContext: any;\r\n /**\r\n * @internal\r\n */\r\n showing: boolean;\r\n /**\r\n * @internal\r\n */\r\n cache: boolean | string;\r\n\r\n constructor(viewFactory: ViewFactory, viewSlot: ViewSlot) {\r\n this.viewFactory = viewFactory;\r\n this.viewSlot = viewSlot;\r\n this.view = null;\r\n this.bindingContext = null;\r\n this.overrideContext = null;\r\n // If the child view is animated, `value` might not reflect the internal\r\n // state anymore, so we use `showing` for that.\r\n // Eventually, `showing` and `value` should be consistent.\r\n this.showing = false;\r\n this.cache = true;\r\n }\r\n\r\n bind(bindingContext, overrideContext) {\r\n // Store parent bindingContext, so we can pass it down\r\n this.bindingContext = bindingContext;\r\n this.overrideContext = overrideContext;\r\n }\r\n\r\n unbind() {\r\n if (this.view === null) {\r\n return;\r\n }\r\n\r\n this.view.unbind();\r\n\r\n // It seems to me that this code is subject to race conditions when animating.\r\n // For example a view could be returned to the cache and reused while it's still\r\n // attached to the DOM and animated.\r\n if (!this.viewFactory.isCaching) {\r\n return;\r\n }\r\n\r\n if (this.showing) {\r\n this.showing = false;\r\n this.viewSlot.remove(this.view, /*returnToCache:*/true, /*skipAnimation:*/true);\r\n } else {\r\n this.view.returnToCache();\r\n }\r\n\r\n this.view = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _show() {\r\n if (this.showing) {\r\n // Ensures the view is bound.\r\n // It might not be the case when the if was unbound but not detached, then rebound.\r\n // Typical case where this happens is nested ifs\r\n if (!this.view.isBound) {\r\n this.view.bind(this.bindingContext, this.overrideContext);\r\n }\r\n return;\r\n }\r\n\r\n if (this.view === null) {\r\n this.view = (this.viewFactory as any).create();\r\n }\r\n\r\n if (!this.view.isBound) {\r\n this.view.bind(this.bindingContext, this.overrideContext);\r\n }\r\n\r\n this.showing = true;\r\n return this.viewSlot.add(this.view); // Promise or void\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _hide() {\r\n if (!this.showing) {\r\n return;\r\n }\r\n\r\n this.showing = false;\r\n let removed = this.viewSlot.remove(this.view); // Promise or View\r\n\r\n if (removed instanceof Promise) {\r\n return removed.then(() => {\r\n this._unbindView();\r\n });\r\n }\r\n\r\n this._unbindView();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _unbindView() {\r\n const cache = this.cache === 'false' ? false : !!this.cache;\r\n this.view.unbind();\r\n if (!cache) {\r\n this.view = null;\r\n }\r\n }\r\n}\r\n","import {BoundViewFactory, ViewSlot, bindable, customAttribute, templateController} from 'aurelia-templating';\r\nimport {inject} from 'aurelia-dependency-injection';\r\nimport {IfCore} from './if-core';\r\n\r\n/**\r\n * Binding to conditionally include or not include template logic depending on returned result\r\n * - value should be Boolean or will be treated as such (truthy / falsey)\r\n */\r\n@customAttribute('if')\r\n@templateController\r\n@inject(BoundViewFactory, ViewSlot)\r\nexport class If extends IfCore {\r\n @bindable({ primaryProperty: true }) condition: any;\r\n @bindable swapOrder: 'before'|'with'|'after';\r\n @bindable cache: boolean|string = true;\r\n\r\n /**@internal*/\r\n animating: any;\r\n /**@internal*/\r\n elseVm: any;\r\n\r\n /**\r\n * Binds the if to the binding context and override context\r\n * @param bindingContext The binding context\r\n * @param overrideContext An override context for binding.\r\n */\r\n bind(bindingContext, overrideContext) {\r\n super.bind(bindingContext, overrideContext);\r\n if (this.condition) {\r\n this._show();\r\n } else {\r\n this._hide();\r\n }\r\n }\r\n\r\n /**\r\n * Invoked everytime value property changes.\r\n * @param newValue The new value\r\n */\r\n conditionChanged(newValue) {\r\n this._update(newValue);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _update(show) {\r\n if (this.animating) {\r\n return;\r\n }\r\n\r\n let promise;\r\n if (this.elseVm) {\r\n promise = show ? this._swap(this.elseVm, this) : this._swap(this, this.elseVm);\r\n } else {\r\n promise = show ? this._show() : this._hide();\r\n }\r\n\r\n if (promise) {\r\n this.animating = true;\r\n promise.then(() => {\r\n this.animating = false;\r\n if (this.condition !== this.showing) {\r\n this._update(this.condition);\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _swap(remove, add) {\r\n switch (this.swapOrder) {\r\n case 'before':\r\n return Promise.resolve(add._show()).then(() => remove._hide());\r\n case 'with':\r\n return Promise.all([ remove._hide(), add._show() ]);\r\n default: // \"after\", default and unknown values\r\n let promise = remove._hide();\r\n return promise ? promise.then(() => add._show()) : add._show();\r\n }\r\n }\r\n}\r\n","import { inject } from 'aurelia-dependency-injection';\r\nimport { BoundViewFactory, customAttribute, templateController, ViewSlot } from 'aurelia-templating';\r\nimport { IfCore } from './if-core';\r\n\r\n@customAttribute('else')\r\n@templateController\r\n@inject(BoundViewFactory, ViewSlot)\r\nexport class Else extends IfCore {\r\n\r\n /**\r\n * @internal\r\n */\r\n ifVm: any;\r\n\r\n constructor(viewFactory, viewSlot) {\r\n super(viewFactory, viewSlot);\r\n this._registerInIf();\r\n }\r\n\r\n bind(bindingContext, overrideContext) {\r\n super.bind(bindingContext, overrideContext);\r\n // Render on initial\r\n if (this.ifVm.condition) {\r\n this._hide();\r\n } else {\r\n this._show();\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _registerInIf() {\r\n // We support the pattern
.\r\n // Obvisouly between the two, we must accepts text (spaces) and comments.\r\n // The `if` node is expected to be a comment anchor, because of `@templateController`.\r\n // To simplify the code we basically walk up to the first Aurelia predecessor,\r\n // so having static tags in between (no binding) would work but is not intended to be supported.\r\n let previous = (this.viewSlot as ViewSlot & { anchor: any}).anchor.previousSibling;\r\n while (previous && !previous.au) {\r\n previous = previous.previousSibling;\r\n }\r\n if (!previous || !previous.au.if) {\r\n throw new Error(\"Can't find matching If for Else custom attribute.\");\r\n }\r\n this.ifVm = previous.au.if.viewModel;\r\n this.ifVm.elseVm = this;\r\n }\r\n}\r\n","import {inject} from 'aurelia-dependency-injection';\r\nimport {BoundViewFactory, ViewSlot, customAttribute, templateController, ViewFactory} from 'aurelia-templating';\r\nimport {createOverrideContext} from 'aurelia-binding';\r\n\r\n/**\r\n * Creates a binding context for decandant elements to bind to.\r\n */\r\n@customAttribute('with')\r\n@templateController\r\n@inject(BoundViewFactory, ViewSlot)\r\nexport class With {\r\n\r\n /**@internal*/\r\n viewFactory: any;\r\n /**@internal*/\r\n viewSlot: any;\r\n /**@internal*/\r\n parentOverrideContext: any;\r\n /**@internal*/\r\n view: any;\r\n\r\n value: any;\r\n\r\n /**\r\n * Creates an instance of With.\r\n * @param viewFactory The factory generating the view.\r\n * @param viewSlot The slot the view is injected in to.\r\n */\r\n constructor(viewFactory: ViewFactory, viewSlot: ViewSlot) {\r\n this.viewFactory = viewFactory;\r\n this.viewSlot = viewSlot;\r\n this.parentOverrideContext = null;\r\n this.view = null;\r\n }\r\n\r\n /**\r\n * Binds the With with provided binding context and override context.\r\n * @param bindingContext The binding context.\r\n * @param overrideContext An override context for binding.\r\n */\r\n bind(bindingContext, overrideContext) {\r\n this.parentOverrideContext = overrideContext;\r\n this.valueChanged(this.value);\r\n }\r\n\r\n /**\r\n * Invoked everytime the bound value changes.\r\n * @param newValue The new value.\r\n */\r\n valueChanged(newValue) {\r\n let overrideContext = createOverrideContext(newValue, this.parentOverrideContext);\r\n let view = this.view;\r\n if (!view) {\r\n view = this.view = this.viewFactory.create();\r\n view.bind(newValue, overrideContext);\r\n this.viewSlot.add(view);\r\n } else {\r\n view.bind(newValue, overrideContext);\r\n }\r\n }\r\n\r\n /**\r\n * Unbinds With\r\n */\r\n unbind() {\r\n let view = this.view;\r\n this.parentOverrideContext = null;\r\n\r\n if (view) {\r\n view.unbind();\r\n }\r\n }\r\n}\r\n","import {\r\n createOverrideContext,\r\n BindingBehavior,\r\n ValueConverter,\r\n sourceContext,\r\n bindingMode,\r\n OverrideContext\r\n} from 'aurelia-binding';\r\n\r\nconst oneTime = bindingMode.oneTime;\r\n\r\n/**\r\n * Update the override context.\r\n * @param startIndex index in collection where to start updating.\r\n */\r\nexport function updateOverrideContexts(views, startIndex) {\r\n let length = views.length;\r\n\r\n if (startIndex > 0) {\r\n startIndex = startIndex - 1;\r\n }\r\n\r\n for (; startIndex < length; ++startIndex) {\r\n updateOverrideContext(views[startIndex].overrideContext, startIndex, length);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a complete override context.\r\n * @param data The item's value.\r\n * @param index The item's index.\r\n * @param length The collections total length.\r\n * @param key The key in a key/value pair.\r\n */\r\nexport function createFullOverrideContext(repeat, data, index, length, key?: string): OverrideContext {\r\n let bindingContext = {};\r\n let overrideContext = createOverrideContext(bindingContext, repeat.scope.overrideContext);\r\n // is key/value pair (Map)\r\n if (typeof key !== 'undefined') {\r\n bindingContext[repeat.key] = key;\r\n bindingContext[repeat.value] = data;\r\n } else {\r\n bindingContext[repeat.local] = data;\r\n }\r\n updateOverrideContext(overrideContext, index, length);\r\n return overrideContext;\r\n}\r\n\r\n/**\r\n * Updates the override context.\r\n * @param context The context to be updated.\r\n * @param index The context's index.\r\n * @param length The collection's length.\r\n */\r\nexport function updateOverrideContext(overrideContext, index, length) {\r\n let first = (index === 0);\r\n let last = (index === length - 1);\r\n let even = index % 2 === 0;\r\n\r\n overrideContext.$index = index;\r\n overrideContext.$first = first;\r\n overrideContext.$last = last;\r\n overrideContext.$middle = !(first || last);\r\n overrideContext.$odd = !even;\r\n overrideContext.$even = even;\r\n}\r\n\r\n/**\r\n * Gets a repeat instruction's source expression.\r\n */\r\nexport function getItemsSourceExpression(instruction, attrName) {\r\n return instruction.behaviorInstructions\r\n .filter(bi => bi.originalAttrName === attrName)[0]\r\n .attributes\r\n .items\r\n .sourceExpression;\r\n}\r\n\r\n/**\r\n * Unwraps an expression to expose the inner, pre-converted / behavior-free expression.\r\n */\r\nexport function unwrapExpression(expression) {\r\n let unwrapped = false;\r\n while (expression instanceof BindingBehavior) {\r\n expression = expression.expression;\r\n }\r\n while (expression instanceof ValueConverter) {\r\n expression = expression.expression;\r\n unwrapped = true;\r\n }\r\n return unwrapped ? expression : null;\r\n}\r\n\r\n/**\r\n * Returns whether an expression has the OneTimeBindingBehavior applied.\r\n */\r\nexport function isOneTime(expression) {\r\n while (expression instanceof BindingBehavior) {\r\n if (expression.name === 'oneTime') {\r\n return true;\r\n }\r\n expression = expression.expression;\r\n }\r\n return false;\r\n}\r\n\r\n/**\r\n * Forces a binding instance to reevaluate.\r\n */\r\nexport function updateOneTimeBinding(binding) {\r\n if (binding.call && binding.mode === oneTime) {\r\n binding.call(sourceContext);\r\n } else if (binding.updateOneTimeBindings) {\r\n binding.updateOneTimeBindings();\r\n }\r\n}\r\n\r\n/**\r\n * Returns the index of the element in an array, optionally using a matcher function.\r\n */\r\nexport function indexOf(array, item, matcher, startIndex?: number) {\r\n if (!matcher) {\r\n // native indexOf is more performant than a for loop\r\n return array.indexOf(item);\r\n }\r\n const length = array.length;\r\n for (let index = startIndex || 0; index < length; index++) {\r\n if (matcher(array[index], item)) {\r\n return index;\r\n }\r\n }\r\n return -1;\r\n}\r\n","import {createFullOverrideContext, updateOverrideContexts, updateOverrideContext, indexOf} from './repeat-utilities';\r\nimport {mergeSplice} from 'aurelia-binding';\r\nimport { Repeat } from './repeat';\r\n\r\n/**\r\n * A strategy for repeating a template over an array.\r\n */\r\nexport class ArrayRepeatStrategy {\r\n /**\r\n * Gets an observer for the specified collection.\r\n * @param observerLocator The observer locator instance.\r\n * @param items The items to be observed.\r\n */\r\n getCollectionObserver(observerLocator, items) {\r\n return observerLocator.getArrayObserver(items);\r\n }\r\n\r\n /**\r\n * Handle the repeat's collection instance changing.\r\n * @param repeat The repeater instance.\r\n * @param items The new array instance.\r\n */\r\n instanceChanged(repeat, items) {\r\n const $repeat = repeat as Repeat;\r\n const itemsLength = items.length;\r\n\r\n // if the new instance does not contain any items,\r\n // just remove all views and don't do any further processing\r\n if (!items || itemsLength === 0) {\r\n $repeat.removeAllViews(true, !$repeat.viewsRequireLifecycle);\r\n return;\r\n }\r\n\r\n const children = $repeat.views();\r\n const viewsLength = children.length;\r\n\r\n // likewise, if we previously didn't have any views,\r\n // simply make them and return\r\n if (viewsLength === 0) {\r\n this._standardProcessInstanceChanged($repeat, items);\r\n return;\r\n }\r\n\r\n if ($repeat.viewsRequireLifecycle) {\r\n const childrenSnapshot = children.slice(0);\r\n const itemNameInBindingContext = $repeat.local;\r\n const matcher = $repeat.matcher();\r\n\r\n // the cache of the current state (it will be transformed along with the views to keep track of indicies)\r\n let itemsPreviouslyInViews = [];\r\n const viewsToRemove = [];\r\n\r\n for (let index = 0; index < viewsLength; index++) {\r\n const view = childrenSnapshot[index];\r\n const oldItem = view.bindingContext[itemNameInBindingContext];\r\n\r\n if (indexOf(items, oldItem, matcher) === -1) {\r\n // remove the item if no longer in the new instance of items\r\n viewsToRemove.push(view);\r\n } else {\r\n // or add the item to the cache list\r\n itemsPreviouslyInViews.push(oldItem);\r\n }\r\n }\r\n\r\n let updateViews;\r\n let removePromise;\r\n\r\n if (itemsPreviouslyInViews.length > 0) {\r\n removePromise = $repeat.removeViews(viewsToRemove, true, !$repeat.viewsRequireLifecycle);\r\n updateViews = () => {\r\n // update views (create new and move existing)\r\n for (let index = 0; index < itemsLength; index++) {\r\n const item = items[index];\r\n const indexOfView = indexOf(itemsPreviouslyInViews, item, matcher, index);\r\n let view;\r\n\r\n if (indexOfView === -1) { // create views for new items\r\n const overrideContext = createFullOverrideContext($repeat, items[index], index, itemsLength);\r\n $repeat.insertView(index, overrideContext.bindingContext, overrideContext);\r\n // reflect the change in our cache list so indicies are valid\r\n itemsPreviouslyInViews.splice(index, 0, undefined);\r\n } else if (indexOfView === index) { // leave unchanged items\r\n view = children[indexOfView];\r\n itemsPreviouslyInViews[indexOfView] = undefined;\r\n } else { // move the element to the right place\r\n view = children[indexOfView];\r\n $repeat.moveView(indexOfView, index);\r\n itemsPreviouslyInViews.splice(indexOfView, 1);\r\n itemsPreviouslyInViews.splice(index, 0, undefined);\r\n }\r\n\r\n if (view) {\r\n updateOverrideContext(view.overrideContext, index, itemsLength);\r\n }\r\n }\r\n\r\n // remove extraneous elements in case of duplicates,\r\n // also update binding contexts if objects changed using the matcher function\r\n this._inPlaceProcessItems($repeat, items);\r\n };\r\n } else {\r\n // if all of the items are different, remove all and add all from scratch\r\n removePromise = $repeat.removeAllViews(true, !$repeat.viewsRequireLifecycle);\r\n updateViews = () => this._standardProcessInstanceChanged($repeat, items);\r\n }\r\n\r\n if (removePromise instanceof Promise) {\r\n removePromise.then(updateViews);\r\n } else {\r\n updateViews();\r\n }\r\n } else {\r\n // no lifecycle needed, use the fast in-place processing\r\n this._inPlaceProcessItems($repeat, items);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _standardProcessInstanceChanged(repeat, items) {\r\n for (let i = 0, ii = items.length; i < ii; i++) {\r\n let overrideContext = createFullOverrideContext(repeat, items[i], i, ii);\r\n repeat.addView(overrideContext.bindingContext, overrideContext);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _inPlaceProcessItems(repeat, items) {\r\n let itemsLength = items.length;\r\n let viewsLength = repeat.viewCount();\r\n // remove unneeded views.\r\n while (viewsLength > itemsLength) {\r\n viewsLength--;\r\n repeat.removeView(viewsLength, true, !repeat.viewsRequireLifecycle);\r\n }\r\n // avoid repeated evaluating the property-getter for the \"local\" property.\r\n let local = repeat.local;\r\n // re-evaluate bindings on existing views.\r\n for (let i = 0; i < viewsLength; i++) {\r\n let view = repeat.view(i);\r\n let last = i === itemsLength - 1;\r\n let middle = i !== 0 && !last;\r\n let bindingContext = view.bindingContext;\r\n let overrideContext = view.overrideContext;\r\n // any changes to the binding context?\r\n if (bindingContext[local] === items[i]\r\n && overrideContext.$middle === middle\r\n && overrideContext.$last === last) {\r\n // no changes. continue...\r\n continue;\r\n }\r\n // update the binding context and refresh the bindings.\r\n bindingContext[local] = items[i];\r\n overrideContext.$middle = middle;\r\n overrideContext.$last = last;\r\n repeat.updateBindings(view);\r\n }\r\n // add new views\r\n for (let i = viewsLength; i < itemsLength; i++) {\r\n let overrideContext = createFullOverrideContext(repeat, items[i], i, itemsLength);\r\n repeat.addView(overrideContext.bindingContext, overrideContext);\r\n }\r\n }\r\n\r\n /**\r\n * Handle the repeat's collection instance mutating.\r\n * @param repeat The repeat instance.\r\n * @param array The modified array.\r\n * @param splices Records of array changes.\r\n */\r\n instanceMutated(repeat, array, splices) {\r\n if (repeat.__queuedSplices) {\r\n for (let i = 0, ii = splices.length; i < ii; ++i) {\r\n let {index, removed, addedCount} = splices[i];\r\n mergeSplice(repeat.__queuedSplices, index, removed, addedCount);\r\n }\r\n // Array.prototype.slice is used here to clone the array\r\n repeat.__array = array.slice(0);\r\n return;\r\n }\r\n\r\n // Array.prototype.slice is used here to clone the array\r\n let maybePromise = this._runSplices(repeat, array.slice(0), splices);\r\n if (maybePromise instanceof Promise) {\r\n let queuedSplices = repeat.__queuedSplices = [];\r\n\r\n let runQueuedSplices = () => {\r\n if (!queuedSplices.length) {\r\n repeat.__queuedSplices = undefined;\r\n repeat.__array = undefined;\r\n return;\r\n }\r\n\r\n let nextPromise = this._runSplices(repeat, repeat.__array, queuedSplices) || Promise.resolve();\r\n queuedSplices = repeat.__queuedSplices = [];\r\n nextPromise.then(runQueuedSplices);\r\n };\r\n\r\n maybePromise.then(runQueuedSplices);\r\n }\r\n }\r\n\r\n /**\r\n * Run a normalised set of splices against the viewSlot children.\r\n * @param repeat The repeat instance.\r\n * @param array The modified array.\r\n * @param splices Records of array changes.\r\n * @return {Promise|undefined} A promise if animations have to be run.\r\n * @pre The splices must be normalised so as:\r\n * * Any item added may not be later removed.\r\n * * Removals are ordered by asending index\r\n * @internal\r\n */\r\n _runSplices(repeat, array, splices) {\r\n let removeDelta = 0;\r\n let rmPromises = [];\r\n\r\n for (let i = 0, ii = splices.length; i < ii; ++i) {\r\n let splice = splices[i];\r\n let removed = splice.removed;\r\n\r\n for (let j = 0, jj = removed.length; j < jj; ++j) {\r\n // the rmPromises.length correction works due to the ordered removal precondition\r\n let viewOrPromise = repeat.removeView(splice.index + removeDelta + rmPromises.length, true);\r\n if (viewOrPromise instanceof Promise) {\r\n rmPromises.push(viewOrPromise);\r\n }\r\n }\r\n removeDelta -= splice.addedCount;\r\n }\r\n\r\n if (rmPromises.length > 0) {\r\n return Promise.all(rmPromises).then(() => {\r\n let spliceIndexLow = this._handleAddedSplices(repeat, array, splices);\r\n updateOverrideContexts(repeat.views(), spliceIndexLow);\r\n });\r\n }\r\n\r\n let spliceIndexLow = this._handleAddedSplices(repeat, array, splices);\r\n updateOverrideContexts(repeat.views(), spliceIndexLow);\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _handleAddedSplices(repeat, array, splices) {\r\n let spliceIndex: number;\r\n let spliceIndexLow: number;\r\n let arrayLength = array.length;\r\n for (let i = 0, ii = splices.length; i < ii; ++i) {\r\n let splice = splices[i];\r\n let addIndex = spliceIndex = splice.index;\r\n let end = splice.index + splice.addedCount;\r\n\r\n if (typeof spliceIndexLow === 'undefined' || spliceIndexLow === null || spliceIndexLow > splice.index) {\r\n spliceIndexLow = spliceIndex;\r\n }\r\n\r\n for (; addIndex < end; ++addIndex) {\r\n let overrideContext = createFullOverrideContext(repeat, array[addIndex], addIndex, arrayLength);\r\n repeat.insertView(addIndex, overrideContext.bindingContext, overrideContext);\r\n }\r\n }\r\n\r\n return spliceIndexLow;\r\n }\r\n}\r\n","import {createFullOverrideContext, updateOverrideContexts} from './repeat-utilities';\r\n\r\n/**\r\n * A strategy for repeating a template over a Map.\r\n */\r\nexport class MapRepeatStrategy {\r\n /**\r\n * Gets a Map observer.\r\n * @param items The items to be observed.\r\n */\r\n getCollectionObserver(observerLocator, items) {\r\n return observerLocator.getMapObserver(items);\r\n }\r\n\r\n /**\r\n * Process the provided Map entries.\r\n * @param items The entries to process.\r\n */\r\n instanceChanged(repeat, items) {\r\n let removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);\r\n if (removePromise instanceof Promise) {\r\n removePromise.then(() => this._standardProcessItems(repeat, items));\r\n return;\r\n }\r\n this._standardProcessItems(repeat, items);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _standardProcessItems(repeat, items) {\r\n let index = 0;\r\n let overrideContext;\r\n\r\n items.forEach((value, key) => {\r\n overrideContext = createFullOverrideContext(repeat, value, index, items.size, key);\r\n repeat.addView(overrideContext.bindingContext, overrideContext);\r\n ++index;\r\n });\r\n }\r\n\r\n /**\r\n * Handle changes in a Map collection.\r\n * @param map The underlying Map collection.\r\n * @param records The change records.\r\n */\r\n instanceMutated(repeat, map, records) {\r\n let key;\r\n let i;\r\n let ii;\r\n let overrideContext;\r\n let removeIndex;\r\n let addIndex;\r\n let record;\r\n let rmPromises = [];\r\n let viewOrPromise;\r\n\r\n for (i = 0, ii = records.length; i < ii; ++i) {\r\n record = records[i];\r\n key = record.key;\r\n switch (record.type) {\r\n case 'update':\r\n removeIndex = this._getViewIndexByKey(repeat, key);\r\n viewOrPromise = repeat.removeView(removeIndex, true, !repeat.viewsRequireLifecycle);\r\n if (viewOrPromise instanceof Promise) {\r\n rmPromises.push(viewOrPromise);\r\n }\r\n overrideContext = createFullOverrideContext(repeat, map.get(key), removeIndex, map.size, key);\r\n repeat.insertView(removeIndex, overrideContext.bindingContext, overrideContext);\r\n break;\r\n case 'add':\r\n addIndex = repeat.viewCount() <= map.size - 1 ? repeat.viewCount() : map.size - 1;\r\n overrideContext = createFullOverrideContext(repeat, map.get(key), addIndex, map.size, key);\r\n repeat.insertView(map.size - 1, overrideContext.bindingContext, overrideContext);\r\n break;\r\n case 'delete':\r\n if (record.oldValue === undefined) { return; }\r\n removeIndex = this._getViewIndexByKey(repeat, key);\r\n viewOrPromise = repeat.removeView(removeIndex, true, !repeat.viewsRequireLifecycle);\r\n if (viewOrPromise instanceof Promise) {\r\n rmPromises.push(viewOrPromise);\r\n }\r\n break;\r\n case 'clear':\r\n repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);\r\n break;\r\n default:\r\n continue;\r\n }\r\n }\r\n\r\n if (rmPromises.length > 0) {\r\n Promise.all(rmPromises).then(() => {\r\n updateOverrideContexts(repeat.views(), 0);\r\n });\r\n } else {\r\n updateOverrideContexts(repeat.views(), 0);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _getViewIndexByKey(repeat, key) {\r\n let i: number;\r\n let ii: number;\r\n let child;\r\n\r\n for (i = 0, ii = repeat.viewCount(); i < ii; ++i) {\r\n child = repeat.view(i);\r\n if (child.bindingContext[repeat.key] === key) {\r\n return i;\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unused-vars */\r\n/**\r\n * A strategy for repeating a template over null or undefined (does nothing)\r\n */\r\nexport class NullRepeatStrategy {\r\n instanceChanged(repeat, items) {\r\n repeat.removeAllViews(true);\r\n }\r\n\r\n getCollectionObserver(observerLocator, items) {\r\n // empty\r\n }\r\n}\r\n","import {createFullOverrideContext, updateOverrideContexts} from './repeat-utilities';\r\n\r\n/**\r\n * A strategy for repeating a template over a number.\r\n */\r\nexport class NumberRepeatStrategy {\r\n /**\r\n * Return the strategies collection observer. In this case none.\r\n */\r\n getCollectionObserver() {\r\n return null;\r\n }\r\n\r\n /**\r\n * Process the provided Number.\r\n * @param value The Number of how many time to iterate.\r\n */\r\n instanceChanged(repeat, value) {\r\n let removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);\r\n if (removePromise instanceof Promise) {\r\n removePromise.then(() => this._standardProcessItems(repeat, value));\r\n return;\r\n }\r\n this._standardProcessItems(repeat, value);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _standardProcessItems(repeat, value) {\r\n let childrenLength = repeat.viewCount();\r\n let i;\r\n let ii;\r\n let overrideContext;\r\n let viewsToRemove;\r\n\r\n value = Math.floor(value);\r\n viewsToRemove = childrenLength - value;\r\n\r\n if (viewsToRemove > 0) {\r\n if (viewsToRemove > childrenLength) {\r\n viewsToRemove = childrenLength;\r\n }\r\n\r\n for (i = 0, ii = viewsToRemove; i < ii; ++i) {\r\n repeat.removeView(childrenLength - (i + 1), true, !repeat.viewsRequireLifecycle);\r\n }\r\n\r\n return;\r\n }\r\n\r\n for (i = childrenLength, ii = value; i < ii; ++i) {\r\n overrideContext = createFullOverrideContext(repeat, i, i, ii);\r\n repeat.addView(overrideContext.bindingContext, overrideContext);\r\n }\r\n\r\n updateOverrideContexts(repeat.views(), 0);\r\n }\r\n}\r\n","import {createFullOverrideContext, updateOverrideContexts} from './repeat-utilities';\r\n\r\n/**\r\n * A strategy for repeating a template over a Set.\r\n */\r\nexport class SetRepeatStrategy {\r\n /**\r\n * Gets a Set observer.\r\n * @param items The items to be observed.\r\n */\r\n getCollectionObserver(observerLocator, items) {\r\n return observerLocator.getSetObserver(items);\r\n }\r\n\r\n /**\r\n * Process the provided Set entries.\r\n * @param items The entries to process.\r\n */\r\n instanceChanged(repeat, items) {\r\n let removePromise = repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);\r\n if (removePromise instanceof Promise) {\r\n removePromise.then(() => this._standardProcessItems(repeat, items));\r\n return;\r\n }\r\n this._standardProcessItems(repeat, items);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _standardProcessItems(repeat, items) {\r\n let index = 0;\r\n let overrideContext;\r\n\r\n items.forEach(value => {\r\n overrideContext = createFullOverrideContext(repeat, value, index, items.size);\r\n repeat.addView(overrideContext.bindingContext, overrideContext);\r\n ++index;\r\n });\r\n }\r\n\r\n /**\r\n * Handle changes in a Set collection.\r\n * @param repeat The repeat instance.\r\n * @param set The underlying Set collection.\r\n * @param records The change records.\r\n */\r\n instanceMutated(repeat, set, records) {\r\n let value;\r\n let i;\r\n let ii;\r\n let overrideContext;\r\n let removeIndex;\r\n let record;\r\n let rmPromises = [];\r\n let viewOrPromise;\r\n\r\n for (i = 0, ii = records.length; i < ii; ++i) {\r\n record = records[i];\r\n value = record.value;\r\n switch (record.type) {\r\n case 'add':\r\n let size = Math.max(set.size - 1, 0);\r\n overrideContext = createFullOverrideContext(repeat, value, size, set.size);\r\n repeat.insertView(size, overrideContext.bindingContext, overrideContext);\r\n break;\r\n case 'delete':\r\n removeIndex = this._getViewIndexByValue(repeat, value);\r\n viewOrPromise = repeat.removeView(removeIndex, true, !repeat.viewsRequireLifecycle);\r\n if (viewOrPromise instanceof Promise) {\r\n rmPromises.push(viewOrPromise);\r\n }\r\n break;\r\n case 'clear':\r\n repeat.removeAllViews(true, !repeat.viewsRequireLifecycle);\r\n break;\r\n default:\r\n continue;\r\n }\r\n }\r\n\r\n if (rmPromises.length > 0) {\r\n Promise.all(rmPromises).then(() => {\r\n updateOverrideContexts(repeat.views(), 0);\r\n });\r\n } else {\r\n updateOverrideContexts(repeat.views(), 0);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _getViewIndexByValue(repeat, value) {\r\n let i;\r\n let ii;\r\n let child;\r\n\r\n for (i = 0, ii = repeat.viewCount(); i < ii; ++i) {\r\n child = repeat.view(i);\r\n if (child.bindingContext[repeat.local] === value) {\r\n return i;\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n}\r\n","import { ArrayRepeatStrategy } from './array-repeat-strategy';\r\nimport { MapRepeatStrategy } from './map-repeat-strategy';\r\nimport { NullRepeatStrategy } from './null-repeat-strategy';\r\nimport { NumberRepeatStrategy } from './number-repeat-strategy';\r\nimport { Repeat } from './repeat';\r\nimport { SetRepeatStrategy } from './set-repeat-strategy';\r\n\r\n/**\r\n * A strategy is for repeating a template over an iterable or iterable-like object.\r\n */\r\nexport interface RepeatStrategy {\r\n instanceChanged(repeat: Repeat, items: any): void;\r\n instanceMutated(repeat: Repeat, items: any, changes: any): void;\r\n getCollectionObserver(observerLocator: any, items: any): any;\r\n}\r\n\r\n/**\r\n * Locates the best strategy to best repeating a template over different types of collections.\r\n * Custom strategies can be plugged in as well.\r\n */\r\nexport class RepeatStrategyLocator {\r\n\r\n /**@internal*/\r\n matchers: any[];\r\n /**@internal*/\r\n strategies: any[];\r\n\r\n /**\r\n * Creates a new RepeatStrategyLocator.\r\n */\r\n constructor() {\r\n this.matchers = [];\r\n this.strategies = [];\r\n\r\n this.addStrategy(items => items === null || items === undefined, new NullRepeatStrategy() as RepeatStrategy);\r\n this.addStrategy(items => items instanceof Array, new ArrayRepeatStrategy());\r\n this.addStrategy(items => items instanceof Map, new MapRepeatStrategy());\r\n this.addStrategy(items => items instanceof Set, new SetRepeatStrategy());\r\n this.addStrategy(items => typeof items === 'number', new NumberRepeatStrategy() as Partial as RepeatStrategy);\r\n }\r\n\r\n /**\r\n * Adds a repeat strategy to be located when repeating a template over different collection types.\r\n * @param strategy A repeat strategy that can iterate a specific collection type.\r\n */\r\n addStrategy(matcher: (items: any) => boolean, strategy: RepeatStrategy) {\r\n this.matchers.push(matcher);\r\n this.strategies.push(strategy);\r\n }\r\n\r\n /**\r\n * Gets the best strategy to handle iteration.\r\n */\r\n getStrategy(items: any): RepeatStrategy {\r\n let matchers = this.matchers;\r\n\r\n for (let i = 0, ii = matchers.length; i < ii; ++i) {\r\n if (matchers[i](items)) {\r\n return this.strategies[i];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n","/**\r\n* Behaviors that do not require the composition lifecycle callbacks when replacing\r\n* their binding context.\r\n*/\r\nexport const lifecycleOptionalBehaviors = ['focus', 'if', 'else', 'repeat', 'show', 'hide', 'with'];\r\n\r\nfunction behaviorRequiresLifecycle(instruction) {\r\n let t = instruction.type;\r\n let name = t.elementName !== null ? t.elementName : t.attributeName;\r\n return lifecycleOptionalBehaviors.indexOf(name) === -1 && (t.handlesAttached || t.handlesBind || t.handlesCreated || t.handlesDetached || t.handlesUnbind)\r\n || t.viewFactory && viewsRequireLifecycle(t.viewFactory)\r\n || instruction.viewFactory && viewsRequireLifecycle(instruction.viewFactory);\r\n}\r\n\r\nfunction targetRequiresLifecycle(instruction) {\r\n // check each behavior instruction.\r\n let behaviors = instruction.behaviorInstructions;\r\n if (behaviors) {\r\n let i = behaviors.length;\r\n while (i--) {\r\n if (behaviorRequiresLifecycle(behaviors[i])) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n // check the instruction's view factory (if it has one).\r\n return instruction.viewFactory && viewsRequireLifecycle(instruction.viewFactory);\r\n}\r\n\r\nexport function viewsRequireLifecycle(viewFactory) {\r\n // already analyzed?\r\n if ('_viewsRequireLifecycle' in viewFactory) {\r\n return viewFactory._viewsRequireLifecycle;\r\n }\r\n\r\n // set prop to avoid infinite recursion.\r\n viewFactory._viewsRequireLifecycle = false;\r\n\r\n // access inner view factory.\r\n if (viewFactory.viewFactory) {\r\n viewFactory._viewsRequireLifecycle = viewsRequireLifecycle(viewFactory.viewFactory);\r\n return viewFactory._viewsRequireLifecycle;\r\n }\r\n\r\n // template uses animation?\r\n if (viewFactory.template.querySelector('.au-animate')) {\r\n viewFactory._viewsRequireLifecycle = true;\r\n return true;\r\n }\r\n\r\n // target instructions require lifecycle?\r\n for (let id in viewFactory.instructions) {\r\n if (targetRequiresLifecycle(viewFactory.instructions[id])) {\r\n viewFactory._viewsRequireLifecycle = true;\r\n return true;\r\n }\r\n }\r\n\r\n // safe to skip lifecycle.\r\n viewFactory._viewsRequireLifecycle = false;\r\n return false;\r\n}\r\n","/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { View } from 'aurelia-templating';\r\n\r\n/**\r\n* An abstract base class for elements and attributes that repeat\r\n* views.\r\n*/\r\nexport class AbstractRepeater {\r\n constructor(options) {\r\n Object.assign(this, {\r\n local: 'items',\r\n viewsRequireLifecycle: true\r\n }, options);\r\n }\r\n\r\n /**\r\n * Returns the number of views the repeater knows about.\r\n *\r\n * @return the number of views.\r\n */\r\n viewCount(): number {\r\n throw new Error('subclass must implement `viewCount`');\r\n }\r\n\r\n /**\r\n * Returns all of the repeaters views as an array.\r\n *\r\n * @return The repeater's array of views;\r\n */\r\n views(): any[] {\r\n throw new Error('subclass must implement `views`');\r\n }\r\n\r\n /**\r\n * Returns a single view from the repeater at the provided index.\r\n *\r\n * @param index The index of the requested view.\r\n * @return {View|ViewSlot} The requested view.\r\n */\r\n view(index: number): any {\r\n throw new Error('subclass must implement `view`');\r\n }\r\n\r\n /**\r\n * Returns the matcher function to be used by the repeater, or null if strict matching is to be performed.\r\n *\r\n * @return The requested matcher function.\r\n */\r\n matcher(): Function | null {\r\n throw new Error('subclass must implement `matcher`');\r\n }\r\n\r\n /**\r\n * Adds a view to the repeater, binding the view to the\r\n * provided contexts.\r\n *\r\n * @param {Object} bindingContext The binding context to bind the new view to.\r\n * @param {Object} overrideContext A secondary binding context that can override the primary context.\r\n */\r\n addView(bindingContext, overrideContext): any {\r\n throw new Error('subclass must implement `addView`');\r\n }\r\n\r\n /**\r\n * Inserts a view to the repeater at a specific index, binding the view to the\r\n * provided contexts.\r\n *\r\n * @param {Number} index The index at which to create the new view at.\r\n * @param {Object} bindingContext The binding context to bind the new view to.\r\n * @param {Object} overrideContext A secondary binding context that can override the primary context.\r\n */\r\n insertView(index, bindingContext, overrideContext): any {\r\n throw new Error('subclass must implement `insertView`');\r\n }\r\n\r\n /**\r\n * Moves a view across the repeater.\r\n *\r\n * @param {Number} sourceIndex The index of the view to be moved.\r\n * @param {Number} sourceIndex The index where the view should be placed at.\r\n */\r\n moveView(sourceIndex, targetIndex): any {\r\n throw new Error('subclass must implement `moveView`');\r\n }\r\n\r\n /**\r\n * Removes all views from the repeater.\r\n * @param {Boolean} returnToCache Should the view be returned to the view cache?\r\n * @param {Boolean} skipAnimation Should the removal animation be skipped?\r\n * @return {Promise|null}\r\n */\r\n removeAllViews(returnToCache?: boolean, skipAnimation?: boolean): any {\r\n throw new Error('subclass must implement `removeAllViews`');\r\n }\r\n\r\n /**\r\n * Removes an array of Views from the repeater.\r\n *\r\n * @param {Array} viewsToRemove The array of views to be removed.\r\n * @param {Boolean} returnToCache Should the view be returned to the view cache?\r\n * @param {Boolean} skipAnimation Should the removal animation be skipped?\r\n */\r\n removeViews(viewsToRemove: Array, returnToCache?: boolean, skipAnimation?: boolean): any {\r\n throw new Error('subclass must implement `removeView`');\r\n }\r\n\r\n /**\r\n * Removes a view from the repeater at a specific index.\r\n *\r\n * @param {Number} index The index of the view to be removed.\r\n * @param {Boolean} returnToCache Should the view be returned to the view cache?\r\n * @param {Boolean} skipAnimation Should the removal animation be skipped?\r\n */\r\n removeView(index: number, returnToCache?: boolean, skipAnimation?: boolean): any {\r\n throw new Error('subclass must implement `removeView`');\r\n }\r\n\r\n /**\r\n * Forces a particular view to update it's bindings, called as part of\r\n * an in-place processing of items for better performance\r\n *\r\n * @param {Object} view the target view for bindings updates\r\n */\r\n updateBindings(view: View) {\r\n throw new Error('subclass must implement `updateBindings`');\r\n }\r\n}\r\n","/*eslint no-loop-func:0, no-unused-vars:0*/\r\nimport {inject} from 'aurelia-dependency-injection';\r\nimport {ObserverLocator, BindingExpression} from 'aurelia-binding';\r\nimport {\r\n BoundViewFactory,\r\n TargetInstruction,\r\n ViewSlot,\r\n ViewResources,\r\n customAttribute,\r\n bindable,\r\n templateController,\r\n View,\r\n ViewFactory\r\n} from 'aurelia-templating';\r\nimport {RepeatStrategyLocator} from './repeat-strategy-locator';\r\nimport {\r\n getItemsSourceExpression,\r\n unwrapExpression,\r\n isOneTime,\r\n updateOneTimeBinding\r\n} from './repeat-utilities';\r\nimport {viewsRequireLifecycle} from './analyze-view-factory';\r\nimport {AbstractRepeater} from './abstract-repeater';\r\n\r\nconst matcherExtractionMarker = '__marker_extracted__';\r\n\r\n/**\r\n * Binding to iterate over iterable objects (Array, Map and Number) to genereate a template for each iteration.\r\n */\r\n@customAttribute('repeat')\r\n@templateController\r\n@inject(BoundViewFactory, TargetInstruction, ViewSlot, ViewResources, ObserverLocator, RepeatStrategyLocator)\r\nexport class Repeat extends AbstractRepeater {\r\n\r\n /**\r\n * Setting this to `true` to enable legacy behavior, where a repeat would take first `matcher` binding\r\n * any where inside its view if there's no `matcher` binding on the repeated element itself.\r\n *\r\n * Default value is true to avoid breaking change\r\n * @default true\r\n */\r\n static useInnerMatcher = true;\r\n\r\n /**\r\n * List of items to bind the repeater to.\r\n *\r\n * @property items\r\n */\r\n @bindable items;\r\n /**\r\n * Local variable which gets assigned on each iteration.\r\n *\r\n * @property local\r\n */\r\n @bindable local;\r\n /**\r\n * Key when iterating over Maps.\r\n *\r\n * @property key\r\n */\r\n @bindable key;\r\n /**\r\n * Value when iterating over Maps.\r\n *\r\n * @property value\r\n */\r\n @bindable value;\r\n\r\n /**@internal*/\r\n viewFactory: any;\r\n /**@internal*/\r\n instruction: any;\r\n /**@internal*/\r\n viewSlot: any;\r\n /**@internal*/\r\n lookupFunctions: any;\r\n /**@internal*/\r\n observerLocator: any;\r\n /**@internal*/\r\n strategyLocator: any;\r\n /**@internal*/\r\n ignoreMutation: boolean;\r\n /**@internal*/\r\n sourceExpression: any;\r\n /**@internal*/\r\n isOneTime: any;\r\n /**@internal*/\r\n viewsRequireLifecycle: any;\r\n /**@internal*/\r\n scope: { bindingContext: any; overrideContext: any; };\r\n /**@internal*/\r\n matcherBinding: any;\r\n /**@internal*/\r\n collectionObserver: any;\r\n /**@internal*/\r\n strategy: any;\r\n /**@internal */\r\n callContext: 'handleCollectionMutated' | 'handleInnerCollectionMutated';\r\n\r\n /**\r\n * Creates an instance of Repeat.\r\n * @param viewFactory The factory generating the view\r\n * @param instruction The instructions for how the element should be enhanced.\r\n * @param viewResources Collection of resources used to compile the the views.\r\n * @param viewSlot The slot the view is injected in to.\r\n * @param observerLocator The observer locator instance.\r\n * @param collectionStrategyLocator The strategy locator to locate best strategy to iterate the collection.\r\n */\r\n constructor(viewFactory, instruction, viewSlot, viewResources, observerLocator, strategyLocator) {\r\n super({\r\n local: 'item',\r\n viewsRequireLifecycle: viewsRequireLifecycle(viewFactory)\r\n });\r\n\r\n this.viewFactory = viewFactory;\r\n this.instruction = instruction;\r\n this.viewSlot = viewSlot;\r\n this.lookupFunctions = viewResources.lookupFunctions;\r\n this.observerLocator = observerLocator;\r\n this.key = 'key';\r\n this.value = 'value';\r\n this.strategyLocator = strategyLocator;\r\n this.ignoreMutation = false;\r\n this.sourceExpression = getItemsSourceExpression(this.instruction, 'repeat.for');\r\n this.isOneTime = isOneTime(this.sourceExpression);\r\n this.viewsRequireLifecycle = viewsRequireLifecycle(viewFactory);\r\n }\r\n\r\n call(context, changes) {\r\n this[context](this.items, changes);\r\n }\r\n\r\n /**\r\n * Binds the repeat to the binding context and override context.\r\n * @param bindingContext The binding context.\r\n * @param overrideContext An override context for binding.\r\n */\r\n bind(bindingContext, overrideContext) {\r\n this.scope = { bindingContext, overrideContext };\r\n const instruction = this.instruction;\r\n if (!(matcherExtractionMarker in instruction)) {\r\n instruction[matcherExtractionMarker] = this._captureAndRemoveMatcherBinding();\r\n }\r\n this.matcherBinding = instruction[matcherExtractionMarker];\r\n this.itemsChanged();\r\n }\r\n\r\n /**\r\n * Unbinds the repeat\r\n */\r\n unbind() {\r\n this.scope = null;\r\n this.items = null;\r\n this.matcherBinding = null;\r\n this.viewSlot.removeAll(true, true);\r\n this._unsubscribeCollection();\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _unsubscribeCollection() {\r\n if (this.collectionObserver) {\r\n this.collectionObserver.unsubscribe(this.callContext, this);\r\n this.collectionObserver = null;\r\n this.callContext = null;\r\n }\r\n }\r\n\r\n /**\r\n * Invoked everytime the item property changes.\r\n */\r\n itemsChanged() {\r\n this._unsubscribeCollection();\r\n\r\n // still bound?\r\n if (!this.scope) {\r\n return;\r\n }\r\n\r\n let items = this.items;\r\n this.strategy = this.strategyLocator.getStrategy(items);\r\n if (!this.strategy) {\r\n throw new Error(`Value for '${this.sourceExpression}' is non-repeatable`);\r\n }\r\n\r\n if (!this.isOneTime && !this._observeInnerCollection()) {\r\n this._observeCollection();\r\n }\r\n this.ignoreMutation = true;\r\n this.strategy.instanceChanged(this, items);\r\n this.observerLocator.taskQueue.queueMicroTask(() => {\r\n this.ignoreMutation = false;\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _getInnerCollection() {\r\n let expression = unwrapExpression(this.sourceExpression);\r\n if (!expression) {\r\n return null;\r\n }\r\n return expression.evaluate(this.scope, null);\r\n }\r\n\r\n /**\r\n * Invoked when the underlying collection changes.\r\n */\r\n handleCollectionMutated(collection, changes) {\r\n if (!this.collectionObserver) {\r\n return;\r\n }\r\n if (this.ignoreMutation) {\r\n return;\r\n }\r\n this.strategy.instanceMutated(this, collection, changes);\r\n }\r\n\r\n /**\r\n * Invoked when the underlying inner collection changes.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n handleInnerCollectionMutated(collection, changes) {\r\n if (!this.collectionObserver) {\r\n return;\r\n }\r\n // guard against source expressions that have observable side-effects that could\r\n // cause an infinite loop- eg a value converter that mutates the source array.\r\n if (this.ignoreMutation) {\r\n return;\r\n }\r\n this.ignoreMutation = true;\r\n let newItems = this.sourceExpression.evaluate(this.scope, this.lookupFunctions);\r\n this.observerLocator.taskQueue.queueMicroTask(() => this.ignoreMutation = false);\r\n\r\n // call itemsChanged...\r\n if (newItems === this.items) {\r\n // call itemsChanged directly.\r\n this.itemsChanged();\r\n } else {\r\n // call itemsChanged indirectly by assigning the new collection value to\r\n // the items property, which will trigger the self-subscriber to call itemsChanged.\r\n this.items = newItems;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _observeInnerCollection() {\r\n let items = this._getInnerCollection();\r\n let strategy = this.strategyLocator.getStrategy(items);\r\n if (!strategy) {\r\n return false;\r\n }\r\n this.collectionObserver = strategy.getCollectionObserver(this.observerLocator, items);\r\n if (!this.collectionObserver) {\r\n return false;\r\n }\r\n this.callContext = 'handleInnerCollectionMutated';\r\n this.collectionObserver.subscribe(this.callContext, this);\r\n return true;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n _observeCollection() {\r\n let items = this.items;\r\n this.collectionObserver = this.strategy.getCollectionObserver(this.observerLocator, items);\r\n if (this.collectionObserver) {\r\n this.callContext = 'handleCollectionMutated';\r\n this.collectionObserver.subscribe(this.callContext, this);\r\n }\r\n }\r\n\r\n /**\r\n * Capture and remove matcher binding is a way to cache matcher binding + reduce redundant work\r\n * caused by multiple unnecessary matcher bindings\r\n * @internal\r\n */\r\n _captureAndRemoveMatcherBinding() {\r\n const viewFactory: ViewFactory = this.viewFactory.viewFactory;\r\n if (viewFactory) {\r\n const template = viewFactory.template;\r\n const instructions = viewFactory.instructions as Record;\r\n // legacy behavior enabled when Repeat.useInnerMathcer === true\r\n if (Repeat.useInnerMatcher) {\r\n return extractMatcherBindingExpression(instructions);\r\n }\r\n // if the template has more than 1 immediate child element\r\n // it's a repeat put on a